summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-11-01 14:53:16 +0000
committerChristian Heim <phreak@gentoo.org>2006-11-01 14:53:16 +0000
commit643adb91e59c3de8aba80ffc10bd5c4754d0e77e (patch)
treee4816b6706574a53b6339bb3b781952f9653a8c1
parentSmall touchup fixes. (diff)
downloadmisc-643adb91e59c3de8aba80ffc10bd5c4754d0e77e.tar.gz
misc-643adb91e59c3de8aba80ffc10bd5c4754d0e77e.tar.bz2
misc-643adb91e59c3de8aba80ffc10bd5c4754d0e77e.zip
Removing 023.030 from our patchtree, the plain diff won't apply against vanilla 2.6.9 (needs redhat-patches before that).
svn path=/; revision=513
-rw-r--r--openvz-sources/023.030/0100_patch-023stab030-core.patch97742
-rw-r--r--openvz-sources/023.030/5123_linux-2.6.8.1-drbd-0.7.19.patch13391
-rw-r--r--openvz-sources/023.030/5124_linux-2.6.8.1-drbd-0.7.19-0.7.20.patch1052
-rw-r--r--openvz-sources/023.030/5125_linux-2.6.9-e1000-7.2.7.patch12852
-rw-r--r--openvz-sources/023.030/5126_linux-2.6.9-r8169-2.2.patch-1.patch3485
-rw-r--r--openvz-sources/023.030/5127_linux-2.6.9-sk98lin-8.31.2.3.patch42467
-rw-r--r--openvz-sources/023.030/5128_linux-2.6.9-sky2-1.4.patch1130
-rw-r--r--openvz-sources/023.030/5129_linux-2.6.9-qla4xxx-5.00.02.patch36540
-rw-r--r--openvz-sources/023.030/5130_linux-2.6.9-arcmsr-1.20.0X.12.patch8019
-rw-r--r--openvz-sources/023.030/5131_linux-2.6.9-dell_rbu-0.9.patch213
-rw-r--r--openvz-sources/023.030/5132_linux-2.6.9-aoe-14.patch2296
-rw-r--r--openvz-sources/023.030/5133_linux-2.6.9-dpt_i2o-2.5.0-2426.patch5916
-rw-r--r--openvz-sources/023.030/5134_linux-2.6.9-i2o-1.325.patch9634
-rw-r--r--openvz-sources/023.030/5135_linux-2.6.9-qla2xxx-8.01.05.patch103977
-rw-r--r--openvz-sources/023.030/5210_diff-drv-megaraid-entropy-20051025.patch26
-rw-r--r--openvz-sources/023.030/5224_diff-cciss-timeout-20060228.patch32
-rw-r--r--openvz-sources/023.030/5232_diff-scsi-megaraid-dma64-20060621.patch24
-rw-r--r--openvz-sources/023.030/5233_diff-scsi-mpt-fusion-sleeps.patch148
-rw-r--r--openvz-sources/023.030/5234_diff-drv-adp94xx-freeze-20060906.patch18
-rw-r--r--openvz-sources/023.030/5235_diff-wrn-implicit-funcs-20060906.patch53
20 files changed, 0 insertions, 339015 deletions
diff --git a/openvz-sources/023.030/0100_patch-023stab030-core.patch b/openvz-sources/023.030/0100_patch-023stab030-core.patch
deleted file mode 100644
index cd79ce7..0000000
--- a/openvz-sources/023.030/0100_patch-023stab030-core.patch
+++ /dev/null
@@ -1,97742 +0,0 @@
-diff -uprN linux-2.6.9-42.0.3.EL.orig/COPYING.SWsoft linux-2.6.9-ve023stab030/COPYING.SWsoft
---- linux-2.6.9-42.0.3.EL.orig/COPYING.SWsoft 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/COPYING.SWsoft 2006-10-11 19:07:55.000000000 +0400
-@@ -0,0 +1,350 @@
-+
-+Nothing in this license should be construed as a grant by SWsoft of any rights
-+beyond the rights specified in the GNU General Public License, and nothing in
-+this license should be construed as a waiver by SWsoft of its patent, copyright
-+and/or trademark rights, beyond the waiver required by the GNU General Public
-+License. This license is expressly inapplicable to any product that is not
-+within the scope of the GNU General Public License
-+
-+----------------------------------------
-+
-+ GNU GENERAL PUBLIC LICENSE
-+ Version 2, June 1991
-+
-+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ Everyone is permitted to copy and distribute verbatim copies
-+ of this license document, but changing it is not allowed.
-+
-+ Preamble
-+
-+ The licenses for most software are designed to take away your
-+freedom to share and change it. By contrast, the GNU General Public
-+License is intended to guarantee your freedom to share and change free
-+software--to make sure the software is free for all its users. This
-+General Public License applies to most of the Free Software
-+Foundation's software and to any other program whose authors commit to
-+using it. (Some other Free Software Foundation software is covered by
-+the GNU Library General Public License instead.) You can apply it to
-+your programs, too.
-+
-+ When we speak of free software, we are referring to freedom, 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 or use pieces of it
-+in new free programs; and that you know you can do these things.
-+
-+ To protect your rights, we need to make restrictions that forbid
-+anyone to deny you these rights or to ask you to surrender the rights.
-+These restrictions translate to certain responsibilities for you if you
-+distribute copies of the software, or if you modify it.
-+
-+ For example, if you distribute copies of such a program, whether
-+gratis or for a fee, you must give the recipients all the rights that
-+you have. You must make sure that they, too, receive or can get the
-+source code. And you must show them these terms so they know their
-+rights.
-+
-+ We protect your rights with two steps: (1) copyright the software, and
-+(2) offer you this license which gives you legal permission to copy,
-+distribute and/or modify the software.
-+
-+ Also, for each author's protection and ours, we want to make certain
-+that everyone understands that there is no warranty for this free
-+software. If the software is modified by someone else and passed on, we
-+want its recipients to know that what they have is not the original, so
-+that any problems introduced by others will not reflect on the original
-+authors' reputations.
-+
-+ Finally, any free program is threatened constantly by software
-+patents. We wish to avoid the danger that redistributors of a free
-+program will individually obtain patent licenses, in effect making the
-+program proprietary. To prevent this, we have made it clear that any
-+patent must be licensed for everyone's free use or not licensed at all.
-+
-+ The precise terms and conditions for copying, distribution and
-+modification follow.
-+
-+ GNU GENERAL PUBLIC LICENSE
-+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-+
-+ 0. This License applies to any program or other work which contains
-+a notice placed by the copyright holder saying it may be distributed
-+under the terms of this General Public License. The "Program", below,
-+refers to any such program or work, and a "work based on the Program"
-+means either the Program or any derivative work under copyright law:
-+that is to say, a work containing the Program or a portion of it,
-+either verbatim or with modifications and/or translated into another
-+language. (Hereinafter, translation is included without limitation in
-+the term "modification".) Each licensee is addressed as "you".
-+
-+Activities other than copying, distribution and modification are not
-+covered by this License; they are outside its scope. The act of
-+running the Program is not restricted, and the output from the Program
-+is covered only if its contents constitute a work based on the
-+Program (independent of having been made by running the Program).
-+Whether that is true depends on what the Program does.
-+
-+ 1. You may copy and distribute verbatim copies of the Program's
-+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 give any other recipients of the Program a copy of this License
-+along with the Program.
-+
-+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 Program or any portion
-+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
-+ stating that you changed the files and the date of any change.
-+
-+ b) You must cause any work that you distribute or publish, that in
-+ whole or in part contains or is derived from the Program or any
-+ part thereof, to be licensed as a whole at no charge to all third
-+ parties under the terms of this License.
-+
-+ c) If the modified program normally reads commands interactively
-+ when run, you must cause it, when started running for such
-+ interactive use in the most ordinary way, to print or display an
-+ announcement including an appropriate copyright notice and a
-+ notice that there is no warranty (or else, saying that you provide
-+ a warranty) and that users may redistribute the program under
-+ these conditions, and telling the user how to view a copy of this
-+ License. (Exception: if the Program itself is interactive but
-+ does not normally print such an announcement, your work based on
-+ the Program is not required to print an announcement.)
-+
-+These requirements apply to the modified work as a whole. If
-+identifiable sections of that work are not derived from the Program,
-+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 Program, 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 Program.
-+
-+In addition, mere aggregation of another work not based on the Program
-+with the Program (or with a work based on the Program) on a volume of
-+a storage or distribution medium does not bring the other work under
-+the scope of this License.
-+
-+ 3. You may copy and distribute the Program (or a work based on it,
-+under Section 2) in object code or executable form under the terms of
-+Sections 1 and 2 above provided that you also do one of the following:
-+
-+ a) 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; or,
-+
-+ b) Accompany it with a written offer, valid for at least three
-+ years, to give any third party, for a charge no more than your
-+ cost of physically performing source distribution, a complete
-+ machine-readable copy of the corresponding source code, to be
-+ distributed under the terms of Sections 1 and 2 above on a medium
-+ customarily used for software interchange; or,
-+
-+ c) Accompany it with the information you received as to the offer
-+ to distribute corresponding source code. (This alternative is
-+ allowed only for noncommercial distribution and only if you
-+ received the program in object code or executable form with such
-+ an offer, in accord with Subsection b above.)
-+
-+The source code for a work means the preferred form of the work for
-+making modifications to it. For an executable work, 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 executable. However, as a
-+special exception, the source code 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.
-+
-+If distribution of executable or 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 counts as
-+distribution of the source code, even though third parties are not
-+compelled to copy the source along with the object code.
-+
-+ 4. You may not copy, modify, sublicense, or distribute the Program
-+except as expressly provided under this License. Any attempt
-+otherwise to copy, modify, sublicense or distribute the Program 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.
-+
-+ 5. 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 Program or its derivative works. These actions are
-+prohibited by law if you do not accept this License. Therefore, by
-+modifying or distributing the Program (or any work based on the
-+Program), you indicate your acceptance of this License to do so, and
-+all its terms and conditions for copying, distributing or modifying
-+the Program or works based on it.
-+
-+ 6. Each time you redistribute the Program (or any work based on the
-+Program), the recipient automatically receives a license from the
-+original licensor to copy, distribute or modify the Program 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 to
-+this License.
-+
-+ 7. 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 Program at all. For example, if a patent
-+license would not permit royalty-free redistribution of the Program 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 Program.
-+
-+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.
-+
-+ 8. If the distribution and/or use of the Program is restricted in
-+certain countries either by patents or by copyrighted interfaces, the
-+original copyright holder who places the Program 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.
-+
-+ 9. The Free Software Foundation may publish revised and/or new versions
-+of the 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 Program
-+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 Program does not specify a version number of
-+this License, you may choose any version ever published by the Free Software
-+Foundation.
-+
-+ 10. If you wish to incorporate parts of the Program into other free
-+programs whose distribution conditions are different, 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
-+
-+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
-+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-+REPAIR OR CORRECTION.
-+
-+ 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
-+PROGRAMS), 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 Programs
-+
-+ If you develop a new program, and you want it to be of the greatest
-+possible use to the public, the best way to achieve this is to make it
-+free software which everyone can redistribute and change under these terms.
-+
-+ To do so, attach the following notices to the program. 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.
-+
-+ <one line to give the program's name and a brief idea of what it does.>
-+ Copyright (C) <year> <name of author>
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2 of the License, or
-+ (at your option) any later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software
-+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+
-+
-+Also add information on how to contact you by electronic and paper mail.
-+
-+If the program is interactive, make it output a short notice like this
-+when it starts in an interactive mode:
-+
-+ Gnomovision version 69, Copyright (C) year name of author
-+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-+ This is free software, and you are welcome to redistribute it
-+ under certain conditions; type `show c' for details.
-+
-+The hypothetical commands `show w' and `show c' should show the appropriate
-+parts of the General Public License. Of course, the commands you use may
-+be called something other than `show w' and `show c'; they could even be
-+mouse-clicks or menu items--whatever suits your program.
-+
-+You should also get your employer (if you work as a programmer) or your
-+school, if any, to sign a "copyright disclaimer" for the program, if
-+necessary. Here is a sample; alter the names:
-+
-+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
-+
-+ <signature of Ty Coon>, 1 April 1989
-+ Ty Coon, President of Vice
-+
-+This General Public License does not permit incorporating your program into
-+proprietary programs. If your program is a subroutine library, you may
-+consider it more useful to permit linking proprietary applications with the
-+library. If this is what you want to do, use the GNU Library General
-+Public License instead of this License.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/Documentation/power/swsusp.txt linux-2.6.9-ve023stab030/Documentation/power/swsusp.txt
---- linux-2.6.9-42.0.3.EL.orig/Documentation/power/swsusp.txt 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/Documentation/power/swsusp.txt 2006-10-11 19:07:55.000000000 +0400
-@@ -183,8 +183,8 @@ A: All such kernel threads need to be fi
- where it is safe to be frozen (no kernel semaphores should be held at
- that point and it must be safe to sleep there), and add:
-
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- Q: What is the difference between between "platform", "shutdown" and
- "firmware" in /sys/power/disk?
-diff -uprN linux-2.6.9-42.0.3.EL.orig/Documentation/ve.txt linux-2.6.9-ve023stab030/Documentation/ve.txt
---- linux-2.6.9-42.0.3.EL.orig/Documentation/ve.txt 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/Documentation/ve.txt 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,37 @@
-+ OpenVZ Overview
-+ ---------------
-+ (C) SWsoft, 2005, http://www.sw-soft.com, All rights reserved.
-+ Licensing governed by "linux/COPYING.SWsoft" file.
-+
-+OpenVZ is a virtualization technology which allows to run multiple
-+isolated VPSs (Virtual Private Server) on a single operating system.
-+It uses a single instance of Linux kernel in memory which efficiently
-+manages resources between VPSs.
-+
-+Virtual environment (VE) notion which is used in kernel is the original
-+name of more modern notion of Virtual Private Server (VPS).
-+
-+From user point of view, every VPS is an isolated operating system with
-+private file system, private set of users, private root superuser,
-+private set of processes and so on. Every application which do not
-+require direct hardware access can't feel the difference between VPS
-+and real standalone server.
-+
-+From kernel point of view, VPS is an isolated set of processes spawned
-+from their private 'init' process. Kernel controls which resources are
-+accessible inside VPS and which amount of these resources can be
-+consumed/used by VPS processes. Also kernel provides isolation between
-+VPSs thus ensuring that one VPS can't use private resources of another
-+VPS, make DoS/hack/crash attack on it's neighbour and so on.
-+
-+main Open Virtuozzo config options:
-+ CONFIG_FAIRSCHED=y
-+ CONFIG_SCHED_VCPU=y
-+ CONFIG_VE=y
-+ CONFIG_VE_CALLS=m
-+ CONFIG_VE_NETDEV=m
-+ CONFIG_VE_IPTABLES=y
-+
-+Official product pages:
-+ http://www.virtuozzo.com
-+ http://openvz.org
-diff -uprN linux-2.6.9-42.0.3.EL.orig/Documentation/vsched.txt linux-2.6.9-ve023stab030/Documentation/vsched.txt
---- linux-2.6.9-42.0.3.EL.orig/Documentation/vsched.txt 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/Documentation/vsched.txt 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,83 @@
-+Copyright (C) 2005 SWsoft. All rights reserved.
-+Licensing governed by "linux/COPYING.SWsoft" file.
-+
-+Hierarchical CPU schedulers
-+~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+
-+Hierarchical CPU scheduler is a stack of CPU schedulers which allows
-+to organize different policies of scheduling in the system and/or between
-+groups of processes.
-+
-+Virtuozzo uses a hierarchical Fair CPU scheduler organized as a 2-stage
-+CPU scheduler, where the scheduling decisions are made in 2 steps:
-+1. On the first step Fair CPU scheduler selects a group of processes
-+ which should get some CPU time.
-+2. Then standard Linux scheduler chooses a process inside the group.
-+Such scheduler efficiently allows to isolate one group of processes
-+from another and still allows a group to use more than 1 CPU on SMP systems.
-+
-+This document describes a new middle layer of Virtuozzo hierarchical CPU
-+scheduler which makes decisions after Fair scheduler, but before Linux
-+scheduler and which is called VCPU scheduler.
-+
-+
-+Where VCPU scheduler comes from?
-+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+
-+Existing hierarchical CPU scheduler uses isolated algorithms on each stage
-+of decision making, i.e. every scheduler makes its decisions without
-+taking into account the details of other schedulers. This can lead to a number
-+of problems described below.
-+
-+On SMP systems there are possible situations when the first CPU scheduler
-+in the hierarchy (e.g. Fair scheduler) wants to schedule some group of
-+processes on the physical CPU, but the underlying process scheduler
-+(e.g. Linux O(1) CPU scheduler) is unable to schedule any processes
-+on this physical CPU. Usually this happens due to the fact that Linux
-+kernel scheduler uses per-physical CPU runqueues.
-+
-+Another problem is that Linux scheduler also knows nothing about
-+Fair scheduler and can't balance efficiently without taking into account
-+statistics about process groups from Fair scheduler. Without such
-+statistics Linux scheduler can concentrate all processes on one physical
-+CPU, thus making CPU consuming highly inefficient.
-+
-+VCPU scheduler solves these problems by adding a new layer between
-+Fair schedule and Linux scheduler.
-+
-+VCPU scheduler
-+~~~~~~~~~~~~~~
-+
-+VCPU scheduler is a CPU scheduler which splits notion of
-+physical and virtual CPUs (VCPU and PCPU). This means that tasks are
-+running on virtual CPU runqueues, while VCPUs are running on PCPUs.
-+
-+The Virtuozzo hierarchical fair scheduler becomes 3 stage CPU scheduler:
-+1. First, Fair CPU scheduler select a group of processes.
-+2. Then VCPU scheduler select a virtual CPU to run (this is actually
-+ a runqueue).
-+3. Standard Linux scheduler chooses a process from the runqueue.
-+
-+For example on the picture below PCPU0 executes tasks from
-+VCPU1 runqueue and PCPU1 is idle:
-+
-+ virtual | physical | virtual
-+ idle CPUs | CPUs | CPUS
-+--------------------|------------------------|--------------------------
-+ | | -----------------
-+ | | | virtual sched X |
-+ | | | ----------- |
-+ | | | | VCPU0 | |
-+ | | | ----------- |
-+ ------------ | ----------- | ----------- |
-+| idle VCPU0 | | | PCPU0 | <---> | | VCPU1 | |
-+ ------------ | ----------- | ----------- |
-+ | | -----------------
-+ | |
-+ | | -----------------
-+ | | | virtual sched Y |
-+ ------------ ----------- | | ----------- |
-+| idle VCPU1 | <---> | PCPU1 | | | | VCPU0 | |
-+ ------------ ----------- | | ----------- |
-+ | | -----------------
-+ | |
-diff -uprN linux-2.6.9-42.0.3.EL.orig/Makefile linux-2.6.9-ve023stab030/Makefile
---- linux-2.6.9-42.0.3.EL.orig/Makefile 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/Makefile 2006-10-11 19:08:02.000000000 +0400
-@@ -1,7 +1,7 @@
- VERSION = 2
- PATCHLEVEL = 6
- SUBLEVEL = 9
--EXTRAVERSION = -prep
-+EXTRAVERSION = -023stab030
- NAME=AC 1
-
- # *DOCUMENTATION*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/arm/kernel/signal.c linux-2.6.9-ve023stab030/arch/arm/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/arm/kernel/signal.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/arm/kernel/signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -672,9 +672,10 @@ static int do_signal(sigset_t *oldset, s
- if (!user_mode(regs))
- return 0;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (current->ptrace & PT_SINGLESTEP)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/Kconfig.debug linux-2.6.9-ve023stab030/arch/i386/Kconfig.debug
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/Kconfig.debug 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/Kconfig.debug 2006-10-11 19:07:55.000000000 +0400
-@@ -55,6 +55,14 @@ config 4KSTACKS
- on the VM subsystem for higher order allocations. This option
- will also use IRQ stacks to compensate for the reduced stackspace.
-
-+config NMI_WATCHDOG
-+ bool "NMI Watchdog"
-+ default y
-+ help
-+ If you say Y here the kernel will activate NMI watchdog by default
-+ on boot. You can still activate NMI watchdog via nmi_watchdog
-+ command line option even if you say N here.
-+
- config SCHEDSTATS
- bool "Collect scheduler statistics"
- depends on DEBUG_KERNEL && PROC_FS
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/boot/video.S linux-2.6.9-ve023stab030/arch/i386/boot/video.S
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/boot/video.S 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/boot/video.S 2006-10-11 19:07:55.000000000 +0400
-@@ -123,6 +123,9 @@ video: pushw %ds # We use different seg
- cmpw $ASK_VGA, %ax # Bring up the menu
- jz vid2
-
-+#ifndef CONFIG_FB
-+ mov $VIDEO_80x25, %ax # hack to force 80x25 mode
-+#endif
- call mode_set # Set the mode
- jc vid1
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/apic.c linux-2.6.9-ve023stab030/arch/i386/kernel/apic.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/apic.c 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/apic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -1017,9 +1017,7 @@ void __init setup_boot_APIC_clock(void)
-
- void __init setup_secondary_APIC_clock(void)
- {
-- local_irq_disable(); /* FIXME: Do we need this? --RR */
- setup_APIC_timer(calibration_result);
-- local_irq_enable();
- }
-
- void __init disable_APIC_timer(void)
-@@ -1140,6 +1138,7 @@ void smp_apic_timer_interrupt(struct pt_
- #endif
- int cpu;
- u32 *isp;
-+ struct ve_struct *envid;
-
- /*
- * the NMI deadlock-detector uses this.
-@@ -1157,6 +1156,7 @@ void smp_apic_timer_interrupt(struct pt_
- * Besides, if we don't timer interrupts ignore the global
- * interrupt lock, which is the WrongThing (tm) to do.
- */
-+ envid = set_exec_env(get_ve0());
- irq_enter();
-
- #ifdef CONFIG_4KSTACKS
-@@ -1183,6 +1183,7 @@ void smp_apic_timer_interrupt(struct pt_
- smp_local_timer_interrupt(&regs);
-
- irq_exit();
-+ (void)set_exec_env(envid);
- }
-
- /*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/amd.c linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/amd.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/amd.c 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/amd.c 2006-10-11 19:07:55.000000000 +0400
-@@ -30,6 +30,22 @@ static void __init init_amd(struct cpuin
- int mbytes = num_physpages >> (20-PAGE_SHIFT);
- int r;
-
-+#ifdef CONFIG_SMP
-+ unsigned long long value;
-+
-+ /* Disable TLB flush filter by setting HWCR.FFDIS on K8
-+ * bit 6 of msr C001_0015
-+ *
-+ * Errata 63 for SH-B3 steppings
-+ * Errata 122 for all steppings (F+ have it disabled by default)
-+ */
-+ if (c->x86 == 15) {
-+ rdmsrl(MSR_K7_HWCR, value);
-+ value |= 1 << 6;
-+ wrmsrl(MSR_K7_HWCR, value);
-+ }
-+#endif
-+
- /*
- * FIXME: We should handle the K5 here. Set up the write
- * range and also turn on MSR 83 bits 4 and 31 (write alloc,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/common.c linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/common.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/common.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/common.c 2006-10-11 19:07:55.000000000 +0400
-@@ -235,8 +235,6 @@ void __init early_cpu_detect(void)
- c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
-
- }
--
-- early_intel_workaround(c);
- }
-
- void __init generic_identify(struct cpuinfo_x86 * c)
-@@ -302,6 +300,8 @@ static void __init squash_the_stupid_ser
- /* Disabling the serial number may affect the cpuid level */
- c->cpuid_level = cpuid_eax(0);
- }
-+
-+ early_intel_workaround(c);
- }
-
- static int __init x86_serial_nr_setup(char *s)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/mcheck/mce.c linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/mcheck/mce.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/mcheck/mce.c 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/mcheck/mce.c 2006-10-11 19:07:56.000000000 +0400
-@@ -28,7 +28,8 @@ static asmlinkage void unexpected_machin
- }
-
- /* Call the installed machine check handler for this CPU setup. */
--void asmlinkage (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check;
-+void asmlinkage (*machine_check_vector)(struct pt_regs *, long error_code)
-+ __attribute__((__section__(".entry.text"))) = unexpected_machine_check;
-
- /* This has to be run for each processor */
- void __init mcheck_init(struct cpuinfo_x86 *c)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/mtrr/if.c linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/mtrr/if.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/mtrr/if.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/mtrr/if.c 2006-10-11 19:07:57.000000000 +0400
-@@ -358,7 +358,7 @@ static int __init mtrr_if_init(void)
- return -ENODEV;
-
- proc_root_mtrr =
-- create_proc_entry("mtrr", S_IWUSR | S_IRUGO, &proc_root);
-+ create_proc_entry("mtrr", S_IWUSR | S_IRUGO, NULL);
- if (proc_root_mtrr) {
- proc_root_mtrr->owner = THIS_MODULE;
- proc_root_mtrr->proc_fops = &mtrr_fops;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/proc.c linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/proc.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/cpu/proc.c 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/cpu/proc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -3,6 +3,8 @@
- #include <linux/string.h>
- #include <asm/semaphore.h>
- #include <linux/seq_file.h>
-+#include <linux/vsched.h>
-+#include <linux/fairsched.h>
-
- /*
- * Get CPU information for use by the procfs.
-@@ -58,11 +60,17 @@ static int show_cpuinfo(struct seq_file
- struct cpuinfo_x86 *c = v;
- int i, n = c - cpu_data;
- int fpu_exception;
-+ unsigned long vcpu_khz;
-
- #ifdef CONFIG_SMP
-- if (!cpu_online(n))
-+ if (!vcpu_online(n))
- return 0;
- #endif
-+#ifdef CONFIG_FAIRSCHED
-+ vcpu_khz = ve_scale_khz(cpu_khz);
-+#else
-+ vcpu_khz = cpu_khz;
-+#endif
- seq_printf(m, "processor\t: %d\n"
- "vendor_id\t: %s\n"
- "cpu family\t: %d\n"
-@@ -81,7 +89,7 @@ static int show_cpuinfo(struct seq_file
-
- if ( cpu_has(c, X86_FEATURE_TSC) ) {
- seq_printf(m, "cpu MHz\t\t: %lu.%03lu\n",
-- cpu_khz / 1000, (cpu_khz % 1000));
-+ vcpu_khz / 1000, (vcpu_khz % 1000));
- }
-
- /* Cache size */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/entry.S linux-2.6.9-ve023stab030/arch/i386/kernel/entry.S
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/entry.S 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/entry.S 2006-10-11 19:08:01.000000000 +0400
-@@ -1076,4 +1076,27 @@ ENTRY(sys_call_table)
- .long sys_request_key
- .long sys_keyctl
-
-+ .rept 500-(.-sys_call_table)/4
-+ .long sys_ni_syscall
-+ .endr
-+ .long sys_fairsched_mknod /* 500 */
-+ .long sys_fairsched_rmnod
-+ .long sys_fairsched_chwt
-+ .long sys_fairsched_mvpr
-+ .long sys_fairsched_rate
-+ .long sys_fairsched_vcpus
-+
-+ .rept 510-(.-sys_call_table)/4
-+ .long sys_ni_syscall
-+ .endr
-+
-+ .long sys_getluid /* 510 */
-+ .long sys_setluid
-+ .long sys_setublimit
-+ .long sys_ubstat
-+ .long sys_ni_syscall
-+ .long sys_ni_syscall
-+ .long sys_lchmod /* 516 */
-+ .long sys_lutime
-+
- syscall_table_size=(.-sys_call_table)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/entry_trampoline.c linux-2.6.9-ve023stab030/arch/i386/kernel/entry_trampoline.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/entry_trampoline.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/entry_trampoline.c 2006-10-11 19:07:56.000000000 +0400
-@@ -47,14 +47,14 @@ void __init init_entry_mappings(void)
- * set up the initial thread's virtual stack related
- * fields:
- */
-- for (p = 0; p < ARRAY_SIZE(current->thread.stack_page); p++)
-- current->thread.stack_page[p] = virt_to_page((char *)current->thread_info + (p*PAGE_SIZE));
-+ for (p = 0; p < ARRAY_SIZE(current->thread_info->stack_page); p++)
-+ current->thread_info->stack_page[p] = virt_to_page((char *)current->thread_info + (p*PAGE_SIZE));
-
- current->thread_info->virtual_stack = (void *)__kmap_atomic_vaddr(KM_VSTACK_TOP);
-
-- for (p = 0; p < ARRAY_SIZE(current->thread.stack_page); p++) {
-+ for (p = 0; p < ARRAY_SIZE(current->thread_info->stack_page); p++) {
- __kunmap_atomic_type(KM_VSTACK_TOP-p);
-- __kmap_atomic(current->thread.stack_page[p], KM_VSTACK_TOP-p);
-+ __kmap_atomic(current->thread_info->stack_page[p], KM_VSTACK_TOP-p);
- }
- #endif
- current->thread_info->real_stack = (void *)current->thread_info;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/i386_ksyms.c linux-2.6.9-ve023stab030/arch/i386/kernel/i386_ksyms.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/i386_ksyms.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/i386_ksyms.c 2006-10-11 19:07:59.000000000 +0400
-@@ -180,6 +180,8 @@ EXPORT_SYMBOL_GPL(unset_nmi_callback);
- extern int memcmp(const void *,const void *,__kernel_size_t);
- EXPORT_SYMBOL(memcmp);
-
-+EXPORT_SYMBOL(empty_zero_page);
-+
- EXPORT_SYMBOL(register_die_notifier);
- #ifdef CONFIG_HAVE_DEC_LOCK
- EXPORT_SYMBOL(atomic_dec_and_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/irq.c linux-2.6.9-ve023stab030/arch/i386/kernel/irq.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/irq.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/irq.c 2006-10-11 19:07:57.000000000 +0400
-@@ -45,6 +45,9 @@
- #include <asm/desc.h>
- #include <asm/irq.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_task.h>
-+
- /*
- * Linux has a controller-independent x86 interrupt architecture.
- * every controller has a 'controller-template', that is used
-@@ -79,6 +82,68 @@ static void register_irq_proc (unsigned
- #ifdef CONFIG_4KSTACKS
- union irq_ctx *hardirq_ctx[NR_CPUS];
- union irq_ctx *softirq_ctx[NR_CPUS];
-+union irq_ctx *overflow_ctx[NR_CPUS];
-+#endif
-+
-+#ifdef CONFIG_DEBUG_STACKOVERFLOW
-+static void report_stack_overflow(unsigned long delta)
-+{
-+ printk("Stack overflow %lu task=%s (%p)",
-+ delta, current->comm, current);
-+ dump_stack();
-+}
-+
-+void check_stack_overflow(void)
-+{
-+ /* Debugging check for stack overflow: is there less than 512KB free? */
-+ long esp;
-+ unsigned long flags;
-+#ifdef CONFIG_4KSTACKS
-+ u32 *isp;
-+ union irq_ctx * curctx;
-+ union irq_ctx * irqctx;
-+#endif
-+
-+ __asm__ __volatile__("andl %%esp,%0" :
-+ "=r" (esp) : "0" (THREAD_SIZE - 1));
-+ if (likely(esp > (sizeof(struct thread_info) + STACK_WARN)))
-+ return;
-+
-+ local_irq_save(flags);
-+#ifdef CONFIG_4KSTACKS
-+ curctx = (union irq_ctx *) current_thread_info();
-+ irqctx = overflow_ctx[smp_processor_id()];
-+
-+ if (curctx == irqctx)
-+ report_stack_overflow(esp);
-+ else {
-+ /* build the stack frame on the IRQ stack */
-+ isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
-+ irqctx->tinfo.task = curctx->tinfo.task;
-+ irqctx->tinfo.real_stack = curctx->tinfo.real_stack;
-+ irqctx->tinfo.virtual_stack = curctx->tinfo.virtual_stack;
-+ irqctx->tinfo.previous_esp = current_stack_pointer();
-+
-+ *--isp = (u32) esp;
-+
-+ asm volatile(
-+ " xchgl %%ebx,%%esp \n"
-+ " call report_stack_overflow \n"
-+ " xchgl %%ebx,%%esp \n"
-+ :
-+ : "b"(isp)
-+ : "memory", "cc", "eax", "edx", "ecx"
-+ );
-+ }
-+#else
-+ report_stack_overflow(esp);
-+#endif
-+ local_irq_restore(flags);
-+}
-+#else
-+void check_stack_overflow(void)
-+{
-+}
- #endif
-
- /*
-@@ -221,10 +286,12 @@ asmlinkage int handle_IRQ_event(unsigned
- {
- int status = 1; /* Force the "do bottom halves" bit */
- int ret, retval = 0;
-+ struct user_beancounter *ub;
-
- if (!(action->flags & SA_INTERRUPT))
- local_irq_enable();
-
-+ ub = set_exec_ub(get_ub0());
- do {
- ret = action->handler(irq, action->dev_id, regs);
- if (ret == IRQ_HANDLED)
-@@ -232,6 +299,8 @@ asmlinkage int handle_IRQ_event(unsigned
- retval |= ret;
- action = action->next;
- } while (action);
-+ (void)set_exec_ub(ub);
-+
- if (status & SA_SAMPLE_RANDOM)
- add_interrupt_randomness(irq);
- local_irq_disable();
-@@ -579,23 +648,13 @@ asmlinkage unsigned int do_IRQ(struct pt
- irq_desc_t *desc = irq_desc + irq;
- struct irqaction * action;
- unsigned int status;
-+ struct ve_struct *envid;
-
-+ envid = set_exec_env(get_ve0());
- irq_enter();
-
--#ifdef CONFIG_DEBUG_STACKOVERFLOW
-- /* Debugging check for stack overflow: is there less than 1KB free? */
-- {
-- long esp;
-+ check_stack_overflow();
-
-- __asm__ __volatile__("andl %%esp,%0" :
-- "=r" (esp) : "0" (THREAD_SIZE - 1));
-- if (unlikely(esp < (sizeof(struct thread_info) + STACK_WARN))) {
-- printk("do_IRQ: stack overflow: %ld\n",
-- esp - sizeof(struct thread_info));
-- dump_stack();
-- }
-- }
--#endif
- kstat_this_cpu.irqs[irq]++;
- spin_lock(&desc->lock);
- desc->handler->ack(irq);
-@@ -693,7 +752,6 @@ asmlinkage unsigned int do_IRQ(struct pt
- }
-
- #else
--
- for (;;) {
- irqreturn_t action_ret;
-
-@@ -720,6 +778,7 @@ out:
- spin_unlock(&desc->lock);
-
- irq_exit();
-+ (void)set_exec_env(envid);
-
- return 1;
- }
-@@ -1236,6 +1295,9 @@ void init_irq_proc (void)
- */
- static char softirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE)));
- static char hardirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE)));
-+#ifdef CONFIG_DEBUG_STACKOVERFLOW
-+static char overflow_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE)));
-+#endif
-
- /*
- * allocate per-cpu stacks for hardirq and for softirq processing
-@@ -1265,8 +1327,19 @@ void irq_ctx_init(int cpu)
-
- softirq_ctx[cpu] = irqctx;
-
-- printk("CPU %u irqstacks, hard=%p soft=%p\n",
-- cpu,hardirq_ctx[cpu],softirq_ctx[cpu]);
-+#ifdef CONFIG_DEBUG_STACKOVERFLOW
-+ irqctx = (union irq_ctx*) &overflow_stack[cpu*THREAD_SIZE];
-+ irqctx->tinfo.task = NULL;
-+ irqctx->tinfo.exec_domain = NULL;
-+ irqctx->tinfo.cpu = cpu;
-+ irqctx->tinfo.preempt_count = HARDIRQ_OFFSET;
-+ irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
-+
-+ overflow_ctx[cpu] = irqctx;
-+#endif
-+
-+ printk("CPU %u irqstacks, hard=%p soft=%p overflow=%p\n",
-+ cpu,hardirq_ctx[cpu],softirq_ctx[cpu],overflow_ctx[cpu]);
- }
-
- extern asmlinkage void __do_softirq(void);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/ldt.c linux-2.6.9-ve023stab030/arch/i386/kernel/ldt.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/ldt.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/ldt.c 2006-10-11 19:07:59.000000000 +0400
-@@ -13,6 +13,7 @@
- #include <linux/smp_lock.h>
- #include <linux/vmalloc.h>
- #include <linux/slab.h>
-+#include <linux/module.h>
-
- #include <asm/uaccess.h>
- #include <asm/system.h>
-@@ -45,7 +46,7 @@ static int alloc_ldt(mm_context_t *pc, i
- int nr = i/PAGE_SIZE;
- BUG_ON(i >= 64*1024);
- if (!pc->ldt_pages[nr]) {
-- pc->ldt_pages[nr] = alloc_page(GFP_HIGHUSER);
-+ pc->ldt_pages[nr] = alloc_page(GFP_HIGHUSER|__GFP_UBC);
- if (!pc->ldt_pages[nr])
- return -ENOMEM;
- clear_highpage(pc->ldt_pages[nr]);
-@@ -83,6 +84,15 @@ static inline int copy_ldt(mm_context_t
- return 0;
- }
-
-+static void free_ldt(mm_context_t *mc)
-+{
-+ int i;
-+
-+ for (i = 0; i < MAX_LDT_PAGES; i++)
-+ if (mc->ldt_pages[i])
-+ __free_page(mc->ldt_pages[i]);
-+}
-+
- /*
- * we do not have to muck with descriptors here, that is
- * done in switch_mm() as needed.
-@@ -99,10 +109,13 @@ int init_new_context(struct task_struct
- if (old_mm && old_mm->context.size > 0) {
- down(&old_mm->context.sem);
- retval = copy_ldt(&mm->context, &old_mm->context);
-+ if (retval < 0)
-+ free_ldt(&mm->context);
- up(&old_mm->context.sem);
- }
- return retval;
- }
-+EXPORT_SYMBOL(init_new_context);
-
- /*
- * No need to lock the MM as we are the last user
-@@ -299,3 +312,4 @@ void load_LDT_nolock(mm_context_t *pc, i
- set_ldt_desc(cpu, (void *)__kmap_atomic_vaddr(KM_LDT_PAGE0), count);
- load_LDT_desc();
- }
-+EXPORT_SYMBOL(load_LDT_nolock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/nmi.c linux-2.6.9-ve023stab030/arch/i386/kernel/nmi.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/nmi.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/nmi.c 2006-10-11 19:07:55.000000000 +0400
-@@ -34,7 +34,12 @@
-
- #include "mach_traps.h"
-
--unsigned int nmi_watchdog = NMI_NONE;
-+#ifdef CONFIG_NMI_WATCHDOG
-+#define NMI_DEFAULT NMI_IO_APIC
-+#else
-+#define NMI_DEFAULT NMI_NONE
-+#endif
-+unsigned int nmi_watchdog = NMI_DEFAULT;
- extern int unknown_nmi_panic;
- static unsigned int nmi_hz = HZ;
- static unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */
-@@ -467,6 +472,21 @@ void touch_nmi_watchdog (void)
- alert_counter[i] = 0;
- }
-
-+static spinlock_t show_regs_lock = SPIN_LOCK_UNLOCKED;
-+
-+void smp_show_regs(struct pt_regs *regs, void *info)
-+{
-+ if (regs == NULL)
-+ return;
-+
-+ bust_spinlocks(1);
-+ spin_lock(&show_regs_lock);
-+ printk("----------- IPI show regs -----------");
-+ show_regs(regs);
-+ spin_unlock(&show_regs_lock);
-+ bust_spinlocks(0);
-+}
-+
- extern void die_nmi(struct pt_regs *, const char *msg);
-
- void nmi_watchdog_tick (struct pt_regs * regs)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/process.c linux-2.6.9-ve023stab030/arch/i386/kernel/process.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/process.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/process.c 2006-10-11 19:08:00.000000000 +0400
-@@ -57,6 +57,7 @@
- #include <linux/err.h>
-
- asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-+EXPORT_SYMBOL_GPL(ret_from_fork);
-
- int hlt_counter;
-
-@@ -227,11 +228,14 @@ __setup("idle=", idle_setup);
- void show_regs(struct pt_regs * regs)
- {
- unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
-+ extern int die_counter;
-
- printk("\n");
-- printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
-- printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
-- print_symbol("EIP is at %s\n", regs->eip);
-+ printk("Pid: %d, comm: %20s, oopses: %d\n", current->pid, current->comm, die_counter);
-+ printk("EIP: %04x:[<%08lx>] CPU: %d, VCPU: %d:%d\n",0xffff & regs->xcs,regs->eip, smp_processor_id(),
-+ task_vsched_id(current), task_cpu(current));
-+ if (decode_call_traces)
-+ print_symbol("EIP is at %s\n", regs->eip);
-
- if (regs->xcs & 3)
- printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
-@@ -255,6 +259,8 @@ void show_regs(struct pt_regs * regs)
- : "=r" (cr4): "0" (0));
- printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
- show_trace(NULL, &regs->esp);
-+ if (!decode_call_traces)
-+ printk(" EIP: [<%08lx>]\n",regs->eip);
- }
-
- EXPORT_SYMBOL_GPL(show_regs);
-@@ -282,6 +288,13 @@ int kernel_thread(int (*fn)(void *), voi
- {
- struct pt_regs regs;
-
-+ /* Don't allow kernel_thread() inside VE */
-+ if (!ve_is_super(get_exec_env())) {
-+ printk("kernel_thread call inside VE\n");
-+ dump_stack();
-+ return -EPERM;
-+ }
-+
- memset(&regs, 0, sizeof(regs));
-
- regs.ebx = (unsigned long) fn;
-@@ -388,8 +401,8 @@ int copy_thread(int nr, unsigned long cl
- * IMPORTANT: this code relies on the fact that the task
- * structure is an THREAD_SIZE aligned piece of physical memory.
- */
-- for (i = 0; i < ARRAY_SIZE(p->thread.stack_page); i++)
-- p->thread.stack_page[i] =
-+ for (i = 0; i < ARRAY_SIZE(p->thread_info->stack_page); i++)
-+ p->thread_info->stack_page[i] =
- virt_to_page((unsigned long)p->thread_info + (i*PAGE_SIZE));
-
- p->thread.eip = (unsigned long) ret_from_fork;
-@@ -589,9 +602,9 @@ struct task_struct fastcall * __switch_t
- * needed because otherwise NMIs could interrupt the
- * user-return code with a virtual stack and stale TLBs.)
- */
-- for (i = 0; i < ARRAY_SIZE(next->stack_page); i++) {
-+ for (i = 0; i < ARRAY_SIZE(next_p->thread_info->stack_page); i++) {
- __kunmap_atomic_type(KM_VSTACK_TOP-i);
-- __kmap_atomic(next->stack_page[i], KM_VSTACK_TOP-i);
-+ __kmap_atomic(next_p->thread_info->stack_page[i], KM_VSTACK_TOP-i);
- }
- /*
- * NOTE: here we rely on the task being the stack as well
-@@ -633,8 +646,8 @@ struct task_struct fastcall * __switch_t
- * Save away %fs and %gs. No need to save %es and %ds, as
- * those are always kernel segments while inside the kernel.
- */
-- asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs));
-- asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
-+ asm volatile("mov %%fs,%0":"=m" (prev->fs));
-+ asm volatile("mov %%gs,%0":"=m" (prev->gs));
-
- /*
- * Restore %fs and %gs if needed.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/ptrace.c linux-2.6.9-ve023stab030/arch/i386/kernel/ptrace.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/ptrace.c 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/ptrace.c 2006-10-11 19:08:00.000000000 +0400
-@@ -254,7 +254,7 @@ asmlinkage int sys_ptrace(long request,
- }
- ret = -ESRCH;
- read_lock(&tasklist_lock);
-- child = find_task_by_pid(pid);
-+ child = find_task_by_pid_ve(pid);
- if (child)
- get_task_struct(child);
- read_unlock(&tasklist_lock);
-@@ -540,8 +540,10 @@ void do_syscall_trace(struct pt_regs *re
- goto out;
- /* the 0x80 provides a way for the tracing parent to distinguish
- between a syscall stop and SIGTRAP delivery */
-+ set_pn_state(current, entryexit ? PN_STOP_LEAVE : PN_STOP_ENTRY);
- ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
- !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
-+ clear_pn_state(current);
-
- /*
- * this isn't the same as continuing with a signal, but it will do
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/setup.c linux-2.6.9-ve023stab030/arch/i386/kernel/setup.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/setup.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/setup.c 2006-10-11 19:07:55.000000000 +0400
-@@ -39,6 +39,7 @@
- #include <linux/efi.h>
- #include <linux/init.h>
- #include <linux/edd.h>
-+#include <linux/mmzone.h>
- #include <video/edid.h>
-
- #include <asm/apic.h>
-@@ -1148,7 +1149,19 @@ static unsigned long __init setup_memory
- INITRD_START ? INITRD_START + PAGE_OFFSET : 0;
- initrd_end = initrd_start+INITRD_SIZE;
- }
-- else {
-+ else if ((max_low_pfn << PAGE_SHIFT) <
-+ PAGE_ALIGN(INITRD_START + INITRD_SIZE)) {
-+ /* GRUB places initrd as high as possible, so when
-+ VMALLOC_AREA is bigger than std Linux has, such
-+ initrd is inaccessiable in normal zone (highmem) */
-+
-+ /* initrd should be totally in highmem, sorry */
-+ BUG_ON(INITRD_START < (max_low_pfn << PAGE_SHIFT));
-+
-+ initrd_copy = INITRD_SIZE;
-+ printk(KERN_ERR "initrd: GRUB workaround enabled\n");
-+ /* initrd is copied from highmem in initrd_move() */
-+ } else {
- printk(KERN_ERR "initrd extends beyond end of memory "
- "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
- INITRD_START + INITRD_SIZE,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/signal.c linux-2.6.9-ve023stab030/arch/i386/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/signal.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/signal.c 2006-10-11 19:07:59.000000000 +0400
-@@ -26,6 +26,7 @@
- #include <asm/uaccess.h>
- #include <asm/i387.h>
- #include "sigframe.h"
-+#include <linux/module.h>
-
- #define DEBUG_SIG 0
-
-@@ -43,6 +44,7 @@ sys_sigsuspend(int history0, int history
- mask &= _BLOCKABLE;
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
-+ set_sigsuspend_state(current, saveset);
- siginitset(&current->blocked, mask);
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-@@ -51,8 +53,10 @@ sys_sigsuspend(int history0, int history
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
-- if (do_signal(regs, &saveset))
-+ if (do_signal(regs, &saveset)) {
-+ clear_sigsuspend_state(current);
- return -EINTR;
-+ }
- }
- }
-
-@@ -71,6 +75,7 @@ sys_rt_sigsuspend(struct pt_regs regs)
-
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
-+ set_sigsuspend_state(current, saveset);
- current->blocked = newset;
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-@@ -79,8 +84,10 @@ sys_rt_sigsuspend(struct pt_regs regs)
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
-- if (do_signal(&regs, &saveset))
-+ if (do_signal(&regs, &saveset)) {
-+ clear_sigsuspend_state(current);
- return -EINTR;
-+ }
- }
- }
-
-@@ -589,9 +596,10 @@ int fastcall do_signal(struct pt_regs *r
- if ((regs->xcs & 3) != 3)
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-@@ -630,6 +638,7 @@ int fastcall do_signal(struct pt_regs *r
- }
- return 0;
- }
-+EXPORT_SYMBOL(do_signal);
-
- /*
- * notification of userspace execution resumption
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/smp.c linux-2.6.9-ve023stab030/arch/i386/kernel/smp.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/smp.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/smp.c 2006-10-11 19:07:59.000000000 +0400
-@@ -19,6 +19,7 @@
- #include <linux/mc146818rtc.h>
- #include <linux/cache.h>
- #include <linux/interrupt.h>
-+#include <linux/module.h>
-
- #include <asm/mtrr.h>
- #include <asm/tlbflush.h>
-@@ -420,6 +421,7 @@ void flush_tlb_mm (struct mm_struct * mm
-
- preempt_enable();
- }
-+EXPORT_SYMBOL(flush_tlb_mm);
-
- void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
- {
-@@ -485,7 +487,8 @@ struct call_data_struct {
- int wait;
- };
-
--static struct call_data_struct * call_data;
-+static struct call_data_struct call_fn_data;
-+static struct call_data_struct * call_data = &call_fn_data;
- static struct call_data_struct * saved_call_data;
-
- /*
-@@ -566,36 +569,32 @@ int smp_call_function (void (*func) (voi
- * hardware interrupt handler or from a bottom half handler.
- */
- {
-- struct call_data_struct data;
- int cpus = num_online_cpus()-1;
-
- if (!cpus)
- return 0;
-
- /* Can deadlock when called with interrupts disabled */
-- /* Only if we are waiting for other CPU to ack */
-- WARN_ON(irqs_disabled() && wait >= 0);
--
-- data.func = func;
-- data.info = info;
-- atomic_set(&data.started, 0);
-- data.wait = wait;
-- if (wait)
-- atomic_set(&data.finished, 0);
-+ WARN_ON(irqs_disabled());
-
- spin_lock(&call_lock);
-- call_data = &data;
-+ call_fn_data.func = func;
-+ call_fn_data.info = info;
-+ call_fn_data.wait = wait;
-+ atomic_set(&call_fn_data.started, 0);
-+ if (wait)
-+ atomic_set(&call_fn_data.finished, 0);
- mb();
--
-+
- /* Send a message to all other CPUs and wait for them to respond */
- send_IPI_allbutself(CALL_FUNCTION_VECTOR);
-
- /* Wait for response */
-- while (atomic_read(&data.started) != cpus)
-+ while (atomic_read(&call_fn_data.started) != cpus)
- cpu_relax();
-
- if (wait)
-- while (atomic_read(&data.finished) != cpus)
-+ while (atomic_read(&call_fn_data.finished) != cpus)
- cpu_relax();
- spin_unlock(&call_lock);
-
-@@ -619,9 +618,17 @@ static void stop_this_cpu (void * dummy)
- * this function calls the 'stop' function on all other CPUs in the system.
- */
-
-+static struct call_data_struct stop_cpus_data = {
-+ .func = stop_this_cpu,
-+ .info = NULL,
-+ .wait = 0,
-+};
-+
- void smp_send_stop(void)
- {
-- smp_call_function(stop_this_cpu, NULL, 1, 0);
-+ call_data = &stop_cpus_data;
-+ mb();
-+ send_IPI_allbutself(CALL_FUNCTION_VECTOR);
-
- local_irq_disable();
- disable_local_APIC();
-@@ -640,17 +647,24 @@ asmlinkage void smp_reschedule_interrupt
-
- asmlinkage void smp_call_function_interrupt(void)
- {
-- void (*func) (void *info) = call_data->func;
-- void *info = call_data->info;
-- int wait = call_data->wait;
-+ struct call_data_struct *data;
-+ void (*func) (void *info);
-+ void *info;
-+ int wait;
-
- ack_APIC_irq();
-+
-+ data = call_data;
-+ func = data->func;
-+ info = data->info;
-+ wait = data->wait;
-+
- /*
- * Notify initiating CPU that I've grabbed the data and am
- * about to execute the function
- */
- mb();
-- atomic_inc(&call_data->started);
-+ atomic_inc(&data->started);
- /*
- * At this point the info structure may be out of scope unless wait==1
- */
-@@ -660,7 +674,7 @@ asmlinkage void smp_call_function_interr
-
- if (wait) {
- mb();
-- atomic_inc(&call_data->finished);
-+ atomic_inc(&data->finished);
- }
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/smpboot.c linux-2.6.9-ve023stab030/arch/i386/kernel/smpboot.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/smpboot.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/smpboot.c 2006-10-11 19:08:02.000000000 +0400
-@@ -302,6 +302,8 @@ static void __init synchronize_tsc_bp (v
- }
- if (!buggy)
- printk("passed.\n");
-+ /* TSC reset. kill whatever might rely on old values */
-+ VE_TASK_INFO(current)->wakeup_stamp = 0;
- }
-
- static void __init synchronize_tsc_ap (void)
-@@ -327,6 +329,8 @@ static void __init synchronize_tsc_ap (v
- atomic_inc(&tsc_count_stop);
- while (atomic_read(&tsc_count_stop) != num_booting_cpus()) mb();
- }
-+ /* TSC reset. kill whatever might rely on old values */
-+ VE_TASK_INFO(current)->wakeup_stamp = 0;
- }
- #undef NR_LOOPS
-
-@@ -503,6 +507,10 @@ int __init start_secondary(void *unused)
- set_cpu_sibling_map(smp_processor_id());
-
- cpu_set(smp_processor_id(), cpu_online_map);
-+
-+ /* We can take interrupts now: we're officially "up". */
-+ local_irq_enable();
-+
- wmb();
- return cpu_idle();
- }
-@@ -831,6 +839,9 @@ static int __init do_boot_cpu(int apicid
- if (IS_ERR(idle))
- panic("failed fork for CPU %d", cpu);
- idle->thread.eip = (unsigned long) start_secondary;
-+ /* Cosmetic: sleep_time won't be changed afterwards for the idle
-+ * thread; keep it 0 rather than -cycles. */
-+ VE_TASK_INFO(idle)->sleep_time = 0;
- /* start_eip had better be page-aligned! */
- start_eip = setup_trampoline();
-
-@@ -900,6 +911,7 @@ static int __init do_boot_cpu(int apicid
- unmap_cpu_to_logical_apicid(cpu);
- cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */
- cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */
-+ fini_idle(cpu); /* undo fork_idle() */
- cpucount--;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/sys_i386.c linux-2.6.9-ve023stab030/arch/i386/kernel/sys_i386.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/sys_i386.c 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/sys_i386.c 2006-10-11 19:07:57.000000000 +0400
-@@ -217,7 +217,7 @@ asmlinkage int sys_uname(struct old_utsn
- if (!name)
- return -EFAULT;
- down_read(&uts_sem);
-- err=copy_to_user(name, &system_utsname, sizeof (*name));
-+ err=copy_to_user(name, &ve_utsname, sizeof (*name));
- up_read(&uts_sem);
- return err?-EFAULT:0;
- }
-@@ -233,15 +233,15 @@ asmlinkage int sys_olduname(struct oldol
-
- down_read(&uts_sem);
-
-- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
-+ error = __copy_to_user(name->sysname,ve_utsname.sysname,__OLD_UTS_LEN);
- error |= __put_user(0,name->sysname+__OLD_UTS_LEN);
-- error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
-+ error |= __copy_to_user(name->nodename,ve_utsname.nodename,__OLD_UTS_LEN);
- error |= __put_user(0,name->nodename+__OLD_UTS_LEN);
-- error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
-+ error |= __copy_to_user(name->release,ve_utsname.release,__OLD_UTS_LEN);
- error |= __put_user(0,name->release+__OLD_UTS_LEN);
-- error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
-+ error |= __copy_to_user(name->version,ve_utsname.version,__OLD_UTS_LEN);
- error |= __put_user(0,name->version+__OLD_UTS_LEN);
-- error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
-+ error |= __copy_to_user(name->machine,ve_utsname.machine,__OLD_UTS_LEN);
- error |= __put_user(0,name->machine+__OLD_UTS_LEN);
-
- up_read(&uts_sem);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/sysenter.c linux-2.6.9-ve023stab030/arch/i386/kernel/sysenter.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/sysenter.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/sysenter.c 2006-10-11 19:07:56.000000000 +0400
-@@ -14,6 +14,7 @@
- #include <linux/string.h>
- #include <linux/elf.h>
- #include <linux/mman.h>
-+#include <linux/module.h>
-
- #include <asm/cpufeature.h>
- #include <asm/msr.h>
-@@ -48,6 +49,7 @@ extern const char vsyscall_int80_start,
- extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
-
- struct page *sysenter_page;
-+EXPORT_SYMBOL(sysenter_page);
-
- static int __init sysenter_setup(void)
- {
-@@ -75,30 +77,55 @@ static int __init sysenter_setup(void)
- __initcall(sysenter_setup);
-
- extern void SYSENTER_RETURN_OFFSET;
-+EXPORT_SYMBOL(SYSENTER_RETURN_OFFSET);
-
- unsigned int vdso_enabled = 0;
-
--void map_vsyscall(void)
-+static struct page *special_mapping_nopage(struct vm_area_struct *vma,
-+ unsigned long address, int *type)
-+{
-+ BUG_ON(address < vma->vm_start || address >= vma->vm_end);
-+
-+ if (sysenter_page) {
-+ get_page(sysenter_page);
-+ return sysenter_page;
-+ }
-+
-+ return NOPAGE_SIGBUS;
-+}
-+
-+struct vm_operations_struct special_mapping_vmops = {
-+ .nopage = special_mapping_nopage,
-+};
-+EXPORT_SYMBOL(special_mapping_vmops);
-+
-+/*
-+ * This is called from binfmt_elf, we create the special vma for the
-+ * vDSO and insert it into the mm struct tree.
-+ */
-+int arch_setup_additional_pages(struct linux_binprm *bprm,
-+ int executable_stack, unsigned long map_address)
- {
- struct thread_info *ti = current_thread_info();
- struct vm_area_struct *vma;
-- unsigned long addr;
-+ unsigned long addr = map_address;
-
-- if (unlikely(!vdso_enabled)) {
-+ if (unlikely(!vdso_enabled) && map_address == 0) {
- current->mm->context.vdso = NULL;
-- return;
-+ return 0;
- }
-
- /*
- * Map the vDSO (it will be randomized):
- */
- down_write(&current->mm->mmap_sem);
-- addr = do_mmap(NULL, 0, 4096, PROT_READ | PROT_EXEC, MAP_PRIVATE, 0);
-+ addr = do_mmap(NULL, addr, 4096, PROT_READ | PROT_EXEC, MAP_PRIVATE, 0);
- current->mm->context.vdso = (void *)addr;
- ti->sysenter_return = (void *)addr + (long)&SYSENTER_RETURN_OFFSET;
- if (addr != -1) {
- vma = find_vma(current->mm, addr);
- if (vma) {
-+ vma->vm_ops = &special_mapping_vmops;
- pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
- get_page(sysenter_page);
- install_page(current->mm, vma, addr,
-@@ -107,7 +134,9 @@ void map_vsyscall(void)
- }
- }
- up_write(&current->mm->mmap_sem);
-+ return 0;
- }
-+EXPORT_SYMBOL(arch_setup_additional_pages);
-
- static int __init vdso_setup(char *str)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/timers/timer_pit.c linux-2.6.9-ve023stab030/arch/i386/kernel/timers/timer_pit.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/timers/timer_pit.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/timers/timer_pit.c 2006-10-11 19:07:55.000000000 +0400
-@@ -30,6 +30,9 @@ static int __init init_pit(char* overrid
- printk(KERN_ERR "Warning: clock= override failed. Defaulting to PIT\n");
-
- count_p = LATCH;
-+
-+ init_cpu_khz();
-+
- return 0;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/timers/timer_tsc.c linux-2.6.9-ve023stab030/arch/i386/kernel/timers/timer_tsc.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/timers/timer_tsc.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/timers/timer_tsc.c 2006-10-11 19:07:56.000000000 +0400
-@@ -81,7 +81,7 @@ static int count2; /* counter for mark_o
- * Equal to 2^32 * (1 / (clocks per usec) ).
- * Initialized in time_init.
- */
--static unsigned long fast_gettimeoffset_quotient;
-+unsigned long fast_gettimeoffset_quotient;
-
- static unsigned long get_offset_tsc(void)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/traps.c linux-2.6.9-ve023stab030/arch/i386/kernel/traps.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/traps.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/traps.c 2006-10-11 19:08:00.000000000 +0400
-@@ -117,9 +117,11 @@ static inline unsigned long print_contex
- #ifdef CONFIG_FRAME_POINTER
- while (valid_stack_ptr(tinfo, (void *)ebp)) {
- addr = *(unsigned long *)(ebp + 4);
-- printk(" [<%08lx>] ", addr);
-- print_symbol("%s", addr);
-- printk("\n");
-+ printk(" [<%08lx>]", addr);
-+ if (decode_call_traces) {
-+ print_symbol(" %s", addr);
-+ printk("\n");
-+ }
- ebp = *(unsigned long *)ebp;
- }
- #else
-@@ -127,8 +129,10 @@ static inline unsigned long print_contex
- addr = *stack++;
- if (__kernel_text_address(addr)) {
- printk(" [<%08lx>]", addr);
-- print_symbol(" %s", addr);
-- printk("\n");
-+ if (decode_call_traces) {
-+ print_symbol(" %s", addr);
-+ printk("\n");
-+ }
- }
- }
- #endif
-@@ -158,7 +162,10 @@ void show_trace(struct task_struct *task
- stack = (unsigned long*)context->previous_esp;
- if (!stack)
- break;
-- printk(" =======================\n");
-+ if (decode_call_traces)
-+ printk(" =======================\n");
-+ else
-+ printk(" =<ctx>= ");
- }
- }
-
-@@ -182,10 +189,16 @@ void show_stack(struct task_struct *task
- printk("\n ");
- printk("%08lx ", *stack++);
- }
-- printk("\nCall Trace:\n");
-+ printk("\nCall Trace:");
-+ if (decode_call_traces)
-+ printk("\n");
- show_trace(task, esp);
-+ if (!decode_call_traces)
-+ printk("\n");
- }
-
-+EXPORT_SYMBOL(show_stack);
-+
- /*
- * The architecture-independent dump_stack generator
- */
-@@ -194,6 +207,8 @@ void dump_stack(void)
- unsigned long stack;
-
- show_trace(current, &stack);
-+ if (!decode_call_traces)
-+ printk("\n");
- }
-
- EXPORT_SYMBOL(dump_stack);
-@@ -213,9 +228,10 @@ void show_registers(struct pt_regs *regs
- ss = regs->xss & 0xffff;
- }
- print_modules();
-- printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx"
-+ printk("CPU: %d, VCPU: %d:%d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx"
- " (%s) \n",
-- smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-+ smp_processor_id(), task_vsched_id(current), task_cpu(current),
-+ 0xffff & regs->xcs, regs->eip,
- print_tainted(), regs->eflags, UTS_RELEASE);
- print_symbol("EIP is at %s\n", regs->eip);
- printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
-@@ -224,8 +240,10 @@ void show_registers(struct pt_regs *regs
- regs->esi, regs->edi, regs->ebp, esp);
- printk("ds: %04x es: %04x ss: %04x\n",
- regs->xds & 0xffff, regs->xes & 0xffff, ss);
-- printk("Process %s (pid: %d, threadinfo=%p task=%p)",
-- current->comm, current->pid, current_thread_info(), current);
-+ printk("Process %s (pid: %d, veid=%d, threadinfo=%p task=%p)",
-+ current->comm, current->pid,
-+ VEID(VE_TASK_INFO(current)->owner_env),
-+ current_thread_info(), current);
- /*
- * When in-kernel, we also print out the stack and code at the
- * time of the fault..
-@@ -272,9 +290,9 @@ static void handle_BUG(struct pt_regs *r
- goto no_bug;
- if (ud2 != 0x0b0f)
- goto no_bug;
-- if (__direct_get_user(line, (unsigned short *)(eip + 2)))
-+ if (__direct_get_user(line, (unsigned short *)(eip + 4)))
- goto bug;
-- if (__direct_get_user(file, (char **)(eip + 4)) ||
-+ if (__direct_get_user(file, (char **)(eip + 7)) ||
- __direct_get_user(c, file))
- file = "<bad filename>";
-
-@@ -289,6 +307,15 @@ bug:
- printk("Kernel BUG\n");
- }
-
-+static void inline check_kernel_csum_bug(void)
-+{
-+ if (kernel_text_csum_broken)
-+ printk("Kernel code checksum mismatch detected %d times\n",
-+ kernel_text_csum_broken);
-+}
-+
-+int die_counter;
-+
- void die(const char * str, struct pt_regs * regs, long err)
- {
- static struct {
-@@ -300,7 +327,6 @@ void die(const char * str, struct pt_reg
- .lock_owner = -1,
- .lock_owner_depth = 0
- };
-- static int die_counter;
-
- if (die.lock_owner != smp_processor_id()) {
- console_verbose();
-@@ -330,6 +356,7 @@ void die(const char * str, struct pt_reg
- printk("\n");
- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
- show_registers(regs);
-+ check_kernel_csum_bug();
- try_crashdump(regs);
- } else
- printk(KERN_ERR "Recursive die() failure, output suppressed\n");
-@@ -680,7 +707,6 @@ void die_nmi (struct pt_regs *regs, cons
- smp_processor_id(), regs->eip);
- show_registers(regs);
- try_crashdump(regs);
-- printk("console shuts up ...\n");
- console_silent();
- spin_unlock(&nmi_print_lock);
- bust_spinlocks(0);
-@@ -1081,14 +1107,13 @@ void __init trap_init_virtual_GDT(void)
-
- #ifdef CONFIG_X86_HIGH_ENTRY
- if (!cpu) {
-+ int i;
- __set_fixmap(FIX_GDT_0, __pa(cpu_gdt_table), PAGE_KERNEL);
- __set_fixmap(FIX_GDT_1, __pa(cpu_gdt_table) + PAGE_SIZE, PAGE_KERNEL);
-- __set_fixmap(FIX_TSS_0, __pa(init_tss), PAGE_KERNEL);
-- __set_fixmap(FIX_TSS_1, __pa(init_tss) + 1*PAGE_SIZE, PAGE_KERNEL);
-- __set_fixmap(FIX_TSS_2, __pa(init_tss) + 2*PAGE_SIZE, PAGE_KERNEL);
-- __set_fixmap(FIX_TSS_3, __pa(init_tss) + 3*PAGE_SIZE, PAGE_KERNEL);
-+ for(i = 0; i < FIX_TSS_COUNT; i++)
-+ __set_fixmap(FIX_TSS_0 - i, __pa(init_tss) + i * PAGE_SIZE, PAGE_KERNEL);
- }
--
-+
- gdt_desc->address = __fix_to_virt(FIX_GDT_0) + sizeof(cpu_gdt_table[0]) * cpu;
- #else
- gdt_desc->address = (unsigned long)cpu_gdt_table[cpu];
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vm86.c linux-2.6.9-ve023stab030/arch/i386/kernel/vm86.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vm86.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/vm86.c 2006-10-11 19:07:55.000000000 +0400
-@@ -300,8 +300,8 @@ static void do_sys_vm86(struct kernel_vm
- */
- info->regs32->eax = 0;
- tsk->thread.saved_esp0 = tsk->thread.esp0;
-- asm volatile("movl %%fs,%0":"=m" (tsk->thread.saved_fs));
-- asm volatile("movl %%gs,%0":"=m" (tsk->thread.saved_gs));
-+ asm volatile("mov %%fs,%0":"=m" (tsk->thread.saved_fs));
-+ asm volatile("mov %%gs,%0":"=m" (tsk->thread.saved_gs));
-
- tss = init_tss + get_cpu();
- tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vsyscall-sigreturn.S linux-2.6.9-ve023stab030/arch/i386/kernel/vsyscall-sigreturn.S
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vsyscall-sigreturn.S 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/vsyscall-sigreturn.S 2006-10-11 19:07:56.000000000 +0400
-@@ -15,7 +15,7 @@
- */
-
- .text
-- .org __kernel_vsyscall+32
-+ .org __kernel_vsyscall+0x100,0x90
- .globl __kernel_sigreturn
- .type __kernel_sigreturn,@function
- __kernel_sigreturn:
-@@ -27,6 +27,7 @@ __kernel_sigreturn:
- .size __kernel_sigreturn,.-.LSTART_sigreturn
-
- .balign 32
-+ .org __kernel_vsyscall+0x200,0x90
- .globl __kernel_rt_sigreturn
- .type __kernel_rt_sigreturn,@function
- __kernel_rt_sigreturn:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vsyscall-sysenter.S linux-2.6.9-ve023stab030/arch/i386/kernel/vsyscall-sysenter.S
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/kernel/vsyscall-sysenter.S 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/kernel/vsyscall-sysenter.S 2006-10-11 19:07:56.000000000 +0400
-@@ -26,12 +26,12 @@ __kernel_vsyscall:
- movl %esp,%ebp
- sysenter
-
-- /* 7: align return point with nop's to make disassembly easier */
-- .space 7,0x90
-+ /* 17: align return point with nop's to make disassembly easier */
-+ .space 13,0x90
-
-- /* 14: System call restart point is here! (SYSENTER_RETURN_OFFSET-2) */
-+ /* 30: System call restart point is here! (SYSENTER_RETURN_OFFSET-2) */
- jmp .Lenter_kernel
-- /* 16: System call normal return point is here! */
-+ /* 32: System call normal return point is here! */
- .globl SYSENTER_RETURN_OFFSET /* Symbol used by sysenter.c */
- SYSENTER_RETURN_OFFSET:
- pop %ebp
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/fault.c linux-2.6.9-ve023stab030/arch/i386/mm/fault.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/fault.c 2006-10-11 18:29:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/mm/fault.c 2006-10-11 19:07:56.000000000 +0400
-@@ -31,32 +31,6 @@
- extern void die(const char *,struct pt_regs *,long);
-
- /*
-- * Unlock any spinlocks which will prevent us from getting the
-- * message out
-- */
--void bust_spinlocks(int yes)
--{
-- int loglevel_save = console_loglevel;
--
-- if (yes) {
-- oops_in_progress = 1;
-- return;
-- }
--#ifdef CONFIG_VT
-- unblank_screen();
--#endif
-- oops_in_progress = 0;
-- /*
-- * OK, the message is on the console. Now we call printk()
-- * without oops_in_progress set so that printk will give klogd
-- * a poke. Hold onto your hats...
-- */
-- console_loglevel = 15; /* NMI oopser may have shut the console up */
-- printk(" ");
-- console_loglevel = loglevel_save;
--}
--
--/*
- * Return EIP plus the CS segment base. The segment limit is also
- * adjusted, clamped to the kernel/user address space (whichever is
- * appropriate), and returned in *eip_limit.
-@@ -146,12 +120,16 @@ static inline unsigned long get_segment_
- */
- static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
- {
-+ mm_segment_t oldfs;
- unsigned long limit;
- unsigned long instr = get_segment_eip (regs, &limit);
- int scan_more = 1;
- int prefetch = 0;
- int i;
-
-+ oldfs = get_fs();
-+ if ((regs->xcs & 0xffff) == __KERNEL_CS)
-+ set_fs(KERNEL_DS);
- for (i = 0; scan_more && i < 15; i++) {
- unsigned char opcode;
- unsigned char instr_hi;
-@@ -196,6 +174,7 @@ static int __is_prefetch(struct pt_regs
- break;
- }
- }
-+ set_fs(oldfs);
- return prefetch;
- }
-
-@@ -246,6 +225,8 @@ asmlinkage void do_page_fault(struct pt_
-
- tsk = current;
-
-+ check_stack_overflow();
-+
- info.si_code = SEGV_MAPERR;
-
- /*
-@@ -359,7 +340,6 @@ good_area:
- goto bad_area;
- }
-
-- survive:
- /*
- * If for any reason at all we couldn't handle the fault,
- * make sure we exit gracefully rather than endlessly redo
-@@ -498,14 +478,14 @@ no_context:
- */
- out_of_memory:
- up_read(&mm->mmap_sem);
-- if (tsk->pid == 1) {
-- yield();
-- down_read(&mm->mmap_sem);
-- goto survive;
-+ if (error_code & 4) {
-+ /*
-+ * 0-order allocation always success if something really
-+ * fatal not happen: beancounter overdraft or OOM. Den
-+ */
-+ force_sig(SIGKILL, tsk);
-+ return;
- }
-- printk("VM: killing process %s\n", tsk->comm);
-- if (error_code & 4)
-- do_exit(SIGKILL);
- goto no_context;
-
- do_sigbus:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/hugetlbpage.c linux-2.6.9-ve023stab030/arch/i386/mm/hugetlbpage.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/hugetlbpage.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/mm/hugetlbpage.c 2006-10-11 19:07:56.000000000 +0400
-@@ -18,6 +18,8 @@
- #include <asm/tlb.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_vmpages.h>
-+
- static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
- {
- pgd_t *pgd;
-@@ -43,6 +45,7 @@ static void set_huge_pte(struct mm_struc
- pte_t entry;
-
- mm->rss += (HPAGE_SIZE / PAGE_SIZE);
-+ ub_unused_privvm_dec(mm_ub(mm), HPAGE_SIZE / PAGE_SIZE, vma);
- if (write_access) {
- entry =
- pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
-@@ -83,6 +86,7 @@ int copy_hugetlb_page_range(struct mm_st
- get_page(ptepage);
- set_pte(dst_pte, entry);
- dst->rss += (HPAGE_SIZE / PAGE_SIZE);
-+ ub_unused_privvm_dec(mm_ub(dst), HPAGE_SIZE / PAGE_SIZE, vma);
- addr += HPAGE_SIZE;
- }
- return 0;
-@@ -219,6 +223,7 @@ void unmap_hugepage_range(struct vm_area
- put_page(page);
- }
- mm->rss -= (end - start) >> PAGE_SHIFT;
-+ ub_unused_privvm_inc(mm_ub(mm), (end - start) >> PAGE_SHIFT, vma);
- flush_tlb_range(vma, start, end);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/init.c linux-2.6.9-ve023stab030/arch/i386/mm/init.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/init.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/mm/init.c 2006-10-11 19:07:56.000000000 +0400
-@@ -27,6 +27,7 @@
- #include <linux/slab.h>
- #include <linux/proc_fs.h>
- #include <linux/efi.h>
-+#include <linux/initrd.h>
-
- #include <asm/processor.h>
- #include <asm/system.h>
-@@ -40,8 +41,14 @@
- #include <asm/tlbflush.h>
- #include <asm/sections.h>
- #include <asm/desc.h>
-+#include <asm/setup.h>
-
--unsigned int __VMALLOC_RESERVE = 128 << 20;
-+unsigned int __VMALLOC_RESERVE =
-+#ifdef CONFIG_X86_4G
-+ (320 << 20);
-+#else
-+ (128 << 20);
-+#endif
-
- DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
- unsigned long highstart_pfn, highend_pfn;
-@@ -392,9 +399,29 @@ static void clear_mappings(pgd_t *pgd_ba
- flush_tlb_all();
- }
-
-+#ifdef CONFIG_SOFTWARE_SUSPEND
-+/*
-+ * Swap suspend & friends need this for resume because things like the intel-agp
-+ * driver might have split up a kernel 4MB mapping.
-+ */
-+char __nosavedata swsusp_pg_dir[PAGE_SIZE]
-+ __attribute__ ((aligned (PAGE_SIZE)));
-+
-+static inline void save_pg_dir(void)
-+{
-+ memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
-+}
-+#else
-+static inline void save_pg_dir(void)
-+{
-+}
-+#endif
-+
- void zap_low_mappings(void)
- {
- printk("zapping low mappings.\n");
-+
-+ save_pg_dir();
- /*
- * Zap initial low-memory mappings.
- */
-@@ -587,6 +614,37 @@ extern void set_max_mapnr_init(void);
-
- static struct kcore_list kcore_mem, kcore_vmalloc;
-
-+#ifdef CONFIG_BLK_DEV_INITRD
-+/*
-+ * This function move initrd from highmem to normal zone, if needed.
-+ * Note, we have to do it before highmem pages are given to buddy allocator.
-+ */
-+static void initrd_move(void)
-+{
-+ unsigned long i, start, off;
-+ struct page *page;
-+ void *addr;
-+
-+ if (initrd_copy <= 0)
-+ return;
-+
-+ initrd_start = (unsigned long)
-+ alloc_bootmem_low_pages(PAGE_ALIGN(INITRD_SIZE));
-+ initrd_end = INITRD_START + initrd_copy;
-+ start = (initrd_end - initrd_copy) & PAGE_MASK;
-+ off = (initrd_end - initrd_copy) & ~PAGE_MASK;
-+ for (i = 0; i < initrd_copy; i += PAGE_SIZE) {
-+ page = pfn_to_page((start + i) >> PAGE_SHIFT);
-+ addr = kmap_atomic(page, KM_USER0);
-+ memcpy((void *)initrd_start + i,
-+ addr, PAGE_SIZE);
-+ kunmap_atomic(addr, KM_USER0);
-+ }
-+ initrd_start += off;
-+ initrd_end = initrd_start + initrd_copy;
-+}
-+#endif
-+
- void __init mem_init(void)
- {
- extern int ppro_with_ram_bug(void);
-@@ -619,6 +677,9 @@ void __init mem_init(void)
- high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
- #endif
-
-+#ifdef CONFIG_BLK_DEV_INITRD
-+ initrd_move();
-+#endif
- /* this will put all low memory onto the freelists */
- totalram_pages += __free_all_bootmem();
-
-@@ -673,7 +734,7 @@ void __init pgtable_cache_init(void)
- pmd_cache = kmem_cache_create("pmd",
- PTRS_PER_PMD*sizeof(pmd_t),
- PTRS_PER_PMD*sizeof(pmd_t),
-- 0,
-+ SLAB_UBC,
- pmd_ctor,
- NULL);
- if (!pmd_cache)
-@@ -683,7 +744,7 @@ void __init pgtable_cache_init(void)
- kpmd_cache = kmem_cache_create("kpmd",
- PTRS_PER_PMD*sizeof(pmd_t),
- PTRS_PER_PMD*sizeof(pmd_t),
-- 0,
-+ SLAB_UBC,
- kpmd_ctor,
- NULL);
- if (!kpmd_cache)
-@@ -705,7 +766,7 @@ void __init pgtable_cache_init(void)
- pgd_cache = kmem_cache_create("pgd",
- PTRS_PER_PGD*sizeof(pgd_t),
- PTRS_PER_PGD*sizeof(pgd_t),
-- 0,
-+ SLAB_UBC,
- ctor,
- dtor);
- if (!pgd_cache)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/pgtable.c linux-2.6.9-ve023stab030/arch/i386/mm/pgtable.c
---- linux-2.6.9-42.0.3.EL.orig/arch/i386/mm/pgtable.c 2006-10-11 18:29:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/i386/mm/pgtable.c 2006-10-11 19:07:57.000000000 +0400
-@@ -5,8 +5,10 @@
- #include <linux/config.h>
- #include <linux/sched.h>
- #include <linux/kernel.h>
-+#include <linux/module.h>
- #include <linux/errno.h>
- #include <linux/mm.h>
-+#include <linux/vmalloc.h>
- #include <linux/swap.h>
- #include <linux/smp.h>
- #include <linux/highmem.h>
-@@ -55,6 +57,7 @@ void show_mem(void)
- printk("%d reserved pages\n",reserved);
- printk("%d pages shared\n",shared);
- printk("%d pages swap cached\n",cached);
-+ vprintstat();
- }
-
- EXPORT_SYMBOL_GPL(show_mem);
-@@ -147,9 +150,10 @@ struct page *pte_alloc_one(struct mm_str
- struct page *pte;
-
- #ifdef CONFIG_HIGHPTE
-- pte = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM|__GFP_REPEAT, 0);
-+ pte = alloc_pages(GFP_KERNEL_UBC|__GFP_SOFT_UBC|
-+ __GFP_HIGHMEM|__GFP_REPEAT, 0);
- #else
-- pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
-+ pte = alloc_pages(GFP_KERNEL_UBC|__GFP_SOFT_UBC|__GFP_REPEAT, 0);
- #endif
- if (pte)
- clear_highpage(pte);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/binfmt_elf32.c linux-2.6.9-ve023stab030/arch/ia64/ia32/binfmt_elf32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/binfmt_elf32.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/ia32/binfmt_elf32.c 2006-10-11 19:07:56.000000000 +0400
-@@ -18,6 +18,8 @@
- #include <asm/param.h>
- #include <asm/signal.h>
-
-+#include <ub/ub_vmpages.h>
-+
- #include "ia32priv.h"
- #include "elfcore32.h"
-
-@@ -140,6 +142,11 @@ ia64_elf32_init (struct pt_regs *regs)
- * Install LDT as anonymous memory. This gives us all-zero segment descriptors
- * until a task modifies them via modify_ldt().
- */
-+ if (ub_memory_charge(mm_ub(current->mm),
-+ PAGE_ALIGN(IA32_LDT_ENTRIES * IA32_LDT_ENTRY_SIZE),
-+ VM_WRITE, NULL, UB_SOFT))
-+ return;
-+
- vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
- if (vma) {
- memset(vma, 0, sizeof(*vma));
-@@ -153,11 +160,18 @@ ia64_elf32_init (struct pt_regs *regs)
- if (insert_vm_struct(current->mm, vma)) {
- kmem_cache_free(vm_area_cachep, vma);
- up_write(&current->mm->mmap_sem);
-+ ub_memory_uncharge(mm_ub(current->mm),
-+ PAGE_ALIGN(IA32_LDT_ENTRIES *
-+ IA32_LDT_ENTRY_SIZE),
-+ VM_WRITE, NULL);
- return;
- }
- }
- up_write(&current->mm->mmap_sem);
-- }
-+ } else
-+ ub_memory_uncharge(mm_ub(current->mm),
-+ PAGE_ALIGN(IA32_LDT_ENTRIES * IA32_LDT_ENTRY_SIZE),
-+ VM_WRITE, NULL);
-
- ia64_psr(regs)->ac = 0; /* turn off alignment checking */
- regs->loadrs = 0;
-@@ -199,7 +213,7 @@ ia64_elf32_init (struct pt_regs *regs)
- int
- ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
- {
-- unsigned long stack_base;
-+ unsigned long stack_base, vm_end, vm_start;
- struct vm_area_struct *mpnt;
- struct mm_struct *mm = current->mm;
- int i, ret;
-@@ -212,23 +226,29 @@ ia32_setup_arg_pages (struct linux_binpr
- bprm->loader += stack_base;
- bprm->exec += stack_base;
-
-+ vm_end = IA32_STACK_TOP;
-+ vm_start = PAGE_MASK & (unsigned long)bprm->p;
-+
-+ ret = ub_memory_charge(mm_ub(mm), vm_end - vm_start, VM_STACK_FLAGS,
-+ NULL, UB_HARD);
-+ if (ret)
-+ goto out;
-+
-+ ret = -ENOMEM;
- mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
- if (!mpnt)
-- return -ENOMEM;
-+ goto out_uncharge;
-
-- if (security_vm_enough_memory((IA32_STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))
-- >> PAGE_SHIFT)) {
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return -ENOMEM;
-- }
-+ if (security_vm_enough_memory((vm_end - vm_start) >> PAGE_SHIFT))
-+ goto out_free;
-
- memset(mpnt, 0, sizeof(*mpnt));
-
- down_write(&current->mm->mmap_sem);
- {
- mpnt->vm_mm = current->mm;
-- mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
-- mpnt->vm_end = IA32_STACK_TOP;
-+ mpnt->vm_start = vm_start;
-+ mpnt->vm_end = vm_end;
- if (executable_stack == EXSTACK_ENABLE_X)
- mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC;
- else if (executable_stack == EXSTACK_DISABLE_X)
-@@ -237,11 +257,8 @@ ia32_setup_arg_pages (struct linux_binpr
- mpnt->vm_flags = VM_STACK_FLAGS;
- mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)?
- PAGE_COPY_EXEC: PAGE_COPY;
-- if ((ret = insert_vm_struct(current->mm, mpnt))) {
-- up_write(&current->mm->mmap_sem);
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return ret;
-- }
-+ if ((ret = insert_vm_struct(current->mm, mpnt)))
-+ goto out_up;
- current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt);
- }
-
-@@ -260,6 +277,16 @@ ia32_setup_arg_pages (struct linux_binpr
- current->thread.ppl = ia32_init_pp_list();
-
- return 0;
-+
-+out_up:
-+ up_write(&current->mm->mmap_sem);
-+ vm_unacct_memory((vm_end - vm_start) >> PAGE_SHIFT);
-+out_free:
-+ kmem_cache_free(vm_area_cachep, mpnt);
-+out_uncharge:
-+ ub_memory_uncharge(mm_ub(mm), vm_end - vm_start, VM_STACK_FLAGS, NULL);
-+out:
-+ return ret;
- }
-
- static void
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32_entry.S linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32_entry.S
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32_entry.S 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32_entry.S 2006-10-11 19:07:55.000000000 +0400
-@@ -341,7 +341,11 @@ ia32_syscall_table:
- data8 sys_ni_syscall /* init_module */
- data8 sys_ni_syscall /* delete_module */
- data8 sys_ni_syscall /* get_kernel_syms */ /* 130 */
-+#ifndef CONFIG_QUOTA_COMPAT
- data8 sys_quotactl
-+#else
-+ data8 sys32_quotactl
-+#endif
- data8 sys_getpgid
- data8 sys_fchdir
- data8 sys_ni_syscall /* sys_bdflush */
-@@ -387,7 +391,7 @@ ia32_syscall_table:
- data8 sys32_rt_sigaction
- data8 sys32_rt_sigprocmask /* 175 */
- data8 sys_rt_sigpending
-- data8 sys32_rt_sigtimedwait
-+ data8 compat_rt_sigtimedwait
- data8 sys32_rt_sigqueueinfo
- data8 sys32_rt_sigsuspend
- data8 sys32_pread /* 180 */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32_signal.c linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32_signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32_signal.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32_signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -59,19 +59,19 @@ struct rt_sigframe_ia32
- int sig;
- int pinfo;
- int puc;
-- siginfo_t32 info;
-+ compat_siginfo_t info;
- struct ucontext_ia32 uc;
- struct _fpstate_ia32 fpstate;
- char retcode[8];
- };
-
- int
--copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 __user *from)
-+copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t *from)
- {
- unsigned long tmp;
- int err;
-
-- if (!access_ok(VERIFY_READ, from, sizeof(siginfo_t32)))
-+ if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t)))
- return -EFAULT;
-
- err = __get_user(to->si_signo, &from->si_signo);
-@@ -110,12 +110,12 @@ copy_siginfo_from_user32 (siginfo_t *to,
- }
-
- int
--copy_siginfo_to_user32 (siginfo_t32 __user *to, siginfo_t *from)
-+copy_siginfo_to_user32 (compat_siginfo_t *to, siginfo_t *from)
- {
- unsigned int addr;
- int err;
-
-- if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t32)))
-+ if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
- return -EFAULT;
-
- /* If you change siginfo_t structure, please be sure
-@@ -516,6 +516,7 @@ sys32_signal (int sig, unsigned int hand
-
- sigact_set_handler(&new_sa, handler, 0);
- new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
-+ sigemptyset(&new_sa.sa.sa_mask);
-
- ret = do_sigaction(sig, &new_sa, &old_sa);
-
-@@ -587,35 +588,7 @@ sys32_rt_sigprocmask (int how, compat_si
- return 0;
- }
-
--asmlinkage long
--sys32_rt_sigtimedwait (compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
-- struct compat_timespec __user *uts, unsigned int sigsetsize)
--{
-- mm_segment_t old_fs = get_fs();
-- struct timespec t;
-- siginfo_t info;
-- sigset_t s;
-- int ret;
--
-- if (copy_from_user(&s.sig, uthese, sizeof(compat_sigset_t)))
-- return -EFAULT;
-- if (uts && get_compat_timespec(&t, uts))
-- return -EFAULT;
-- set_fs(KERNEL_DS);
-- ret = sys_rt_sigtimedwait((sigset_t __user *) &s,
-- uinfo ? (siginfo_t __user *) &info : NULL,
-- uts ? (struct timespec __user *) &t : NULL,
-- sigsetsize);
-- set_fs(old_fs);
-- if (ret >= 0 && uinfo) {
-- if (copy_siginfo_to_user32(uinfo, &info))
-- return -EFAULT;
-- }
-- return ret;
--}
--
--asmlinkage long
--sys32_rt_sigqueueinfo (int pid, int sig, siginfo_t32 __user *uinfo)
-+sys32_rt_sigqueueinfo (int pid, int sig, compat_siginfo_t *uinfo)
- {
- mm_segment_t old_fs = get_fs();
- siginfo_t info;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32priv.h linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32priv.h
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/ia32priv.h 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/ia32/ia32priv.h 2006-10-11 19:07:55.000000000 +0400
-@@ -232,7 +232,7 @@ typedef union sigval32 {
-
- #define SIGEV_PAD_SIZE32 ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
-
--typedef struct siginfo32 {
-+typedef struct compat_siginfo {
- int si_signo;
- int si_errno;
- int si_code;
-@@ -282,7 +282,7 @@ typedef struct siginfo32 {
- int _fd;
- } _sigpoll;
- } _sifields;
--} siginfo_t32;
-+} compat_siginfo_t;
-
- typedef struct sigevent32 {
- sigval_t32 sigev_value;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/sys_ia32.c linux-2.6.9-ve023stab030/arch/ia64/ia32/sys_ia32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/ia32/sys_ia32.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/ia32/sys_ia32.c 2006-10-11 19:07:57.000000000 +0400
-@@ -766,7 +766,7 @@ emulate_mmap (struct file *file, unsigne
- ia32_set_pp((unsigned int)start, (unsigned int)end, flags);
- if (start > pstart) {
- if (flags & MAP_SHARED)
-- printk(KERN_INFO
-+ ve_printk(VE_LOG, KERN_INFO
- "%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n",
- current->comm, current->pid, start);
- ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
-@@ -779,7 +779,7 @@ emulate_mmap (struct file *file, unsigne
- }
- if (end < pend) {
- if (flags & MAP_SHARED)
-- printk(KERN_INFO
-+ ve_printk(VE_LOG, KERN_INFO
- "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
- current->comm, current->pid, end);
- ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
-@@ -810,7 +810,7 @@ emulate_mmap (struct file *file, unsigne
- is_congruent = (flags & MAP_ANONYMOUS) || (offset_in_page(poff) == 0);
-
- if ((flags & MAP_SHARED) && !is_congruent)
-- printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
-+ ve_printk(VE_LOG, KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
- "(addr=0x%lx,off=0x%llx)\n", current->comm, current->pid, start, off);
-
- DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
-@@ -1518,7 +1518,7 @@ getreg (struct task_struct *child, int r
- return __USER_DS;
- case PT_CS: return __USER_CS;
- default:
-- printk(KERN_ERR "ia32.getreg(): unknown register %d\n", regno);
-+ ve_printk(VE_LOG, KERN_ERR "ia32.getreg(): unknown register %d\n", regno);
- break;
- }
- return 0;
-@@ -1544,18 +1544,18 @@ putreg (struct task_struct *child, int r
- case PT_EFL: child->thread.eflag = value; break;
- case PT_DS: case PT_ES: case PT_FS: case PT_GS: case PT_SS:
- if (value != __USER_DS)
-- printk(KERN_ERR
-+ ve_printk(VE_LOG, KERN_ERR
- "ia32.putreg: attempt to set invalid segment register %d = %x\n",
- regno, value);
- break;
- case PT_CS:
- if (value != __USER_CS)
-- printk(KERN_ERR
-+ ve_printk(VE_LOG, KERN_ERR
- "ia32.putreg: attempt to to set invalid segment register %d = %x\n",
- regno, value);
- break;
- default:
-- printk(KERN_ERR "ia32.putreg: unknown register %d\n", regno);
-+ ve_printk(VE_LOG, KERN_ERR "ia32.putreg: unknown register %d\n", regno);
- break;
- }
- }
-@@ -1796,7 +1796,7 @@ sys32_ptrace (int request, pid_t pid, un
-
- ret = -ESRCH;
- read_lock(&tasklist_lock);
-- child = find_task_by_pid(pid);
-+ child = find_task_by_pid_ve(pid);
- if (child)
- get_task_struct(child);
- read_unlock(&tasklist_lock);
-@@ -2355,7 +2355,7 @@ sys32_sendfile (int out_fd, int in_fd, i
- ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
- set_fs(old_fs);
-
-- if (!ret && offset && put_user(of, offset))
-+ if (offset && put_user(of, offset))
- return -EFAULT;
-
- return ret;
-@@ -2662,7 +2662,7 @@ long sys32_fadvise64_64(int fd, __u32 of
- }
-
- asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-- siginfo_t32 __user *uinfo, int options,
-+ compat_siginfo_t __user *uinfo, int options,
- struct compat_rusage __user *uru)
- {
- siginfo_t info;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/asm-offsets.c linux-2.6.9-ve023stab030/arch/ia64/kernel/asm-offsets.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/asm-offsets.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/asm-offsets.c 2006-10-11 19:07:57.000000000 +0400
-@@ -43,11 +43,21 @@ void foo(void)
- DEFINE(IA64_TASK_CLEAR_CHILD_TID_OFFSET,offsetof (struct task_struct, clear_child_tid));
- DEFINE(IA64_TASK_GROUP_LEADER_OFFSET, offsetof (struct task_struct, group_leader));
- DEFINE(IA64_TASK_PENDING_OFFSET,offsetof (struct task_struct, pending));
-+#ifdef CONFIG_VE
-+ DEFINE(IA64_TASK_PID_OFFSET, offsetof
-+ (struct task_struct, pids[PIDTYPE_PID].vnr));
-+#else
- DEFINE(IA64_TASK_PID_OFFSET, offsetof (struct task_struct, pid));
-+#endif
- DEFINE(IA64_TASK_REAL_PARENT_OFFSET, offsetof (struct task_struct, real_parent));
- DEFINE(IA64_TASK_SIGHAND_OFFSET,offsetof (struct task_struct, sighand));
- DEFINE(IA64_TASK_SIGNAL_OFFSET,offsetof (struct task_struct, signal));
-+#ifdef CONFIG_VE
-+ DEFINE(IA64_TASK_TGID_OFFSET, offsetof
-+ (struct task_struct, pids[PIDTYPE_TGID].vnr));
-+#else
- DEFINE(IA64_TASK_TGID_OFFSET, offsetof (struct task_struct, tgid));
-+#endif
- DEFINE(IA64_TASK_THREAD_KSP_OFFSET, offsetof (struct task_struct, thread.ksp));
- DEFINE(IA64_TASK_THREAD_ON_USTACK_OFFSET, offsetof (struct task_struct, thread.on_ustack));
- DEFINE(IA64_THREAD_INFO_CPU_OFFSET, offsetof (struct thread_info, cpu));
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/entry.S linux-2.6.9-ve023stab030/arch/ia64/kernel/entry.S
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/entry.S 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/entry.S 2006-10-11 19:08:01.000000000 +0400
-@@ -1561,5 +1561,20 @@ sys_call_table:
- data8 sys_ni_syscall
- data8 sys_ni_syscall
- data8 sys_ni_syscall
-+.rept 1499-1280
-+ data8 sys_ni_syscall // 1280 - 1498
-+.endr
-+ data8 sys_fairsched_vcpus
-+ data8 sys_fairsched_mknod // 1500
-+ data8 sys_fairsched_rmnod
-+ data8 sys_fairsched_chwt
-+ data8 sys_fairsched_mvpr
-+ data8 sys_fairsched_rate
-+ data8 sys_getluid // 1505
-+ data8 sys_setluid
-+ data8 sys_setublimit
-+ data8 sys_ubstat
-+ data8 sys_lchmod
-+ data8 sys_lutime // 1510
-
- .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/entry.h linux-2.6.9-ve023stab030/arch/ia64/kernel/entry.h
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/entry.h 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/entry.h 2006-10-11 19:07:55.000000000 +0400
-@@ -60,7 +60,7 @@
- .spillsp @priunat,SW(AR_UNAT)+16+(off); \
- .spillsp ar.rnat,SW(AR_RNAT)+16+(off); \
- .spillsp ar.bspstore,SW(AR_BSPSTORE)+16+(off); \
-- .spillsp pr,SW(PR)+16+(off))
-+ .spillsp pr,SW(PR)+16+(off)
-
- #define DO_SAVE_SWITCH_STACK \
- movl r28=1f; \
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/fsys.S linux-2.6.9-ve023stab030/arch/ia64/kernel/fsys.S
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/fsys.S 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/fsys.S 2006-10-11 19:07:57.000000000 +0400
-@@ -72,6 +72,7 @@ ENTRY(fsys_getpid)
- FSYS_RETURN
- END(fsys_getpid)
-
-+#ifndef CONFIG_VE
- ENTRY(fsys_getppid)
- .prologue
- .altrp b6
-@@ -118,6 +119,7 @@ ENTRY(fsys_getppid)
- #endif
- FSYS_RETURN
- END(fsys_getppid)
-+#endif
-
- ENTRY(fsys_set_tid_address)
- .prologue
-@@ -644,7 +646,11 @@ fsyscall_table:
- data8 0 // chown
- data8 0 // lseek // 1040
- data8 fsys_getpid // getpid
-+#ifdef CONFIG_VE
-+ data8 0 // getppid
-+#else
- data8 fsys_getppid // getppid
-+#endif
- data8 0 // mount
- data8 0 // umount
- data8 0 // setuid // 1045
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/ia64_ksyms.c linux-2.6.9-ve023stab030/arch/ia64/kernel/ia64_ksyms.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/ia64_ksyms.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/ia64_ksyms.c 2006-10-11 19:07:59.000000000 +0400
-@@ -95,6 +95,8 @@ EXPORT_SYMBOL(xor_ia64_4);
- EXPORT_SYMBOL(xor_ia64_5);
- #endif
-
-+EXPORT_SYMBOL(empty_zero_page);
-+
- #include <asm/pal.h>
- EXPORT_SYMBOL(ia64_pal_call_phys_stacked);
- EXPORT_SYMBOL(ia64_pal_call_phys_static);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/irq.c linux-2.6.9-ve023stab030/arch/ia64/kernel/irq.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/irq.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/irq.c 2006-10-11 19:07:56.000000000 +0400
-@@ -56,6 +56,8 @@
- #include <asm/delay.h>
- #include <asm/irq.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_task.h>
-
- /*
- * Linux has a controller-independent x86 interrupt architecture.
-@@ -258,10 +260,12 @@ int handle_IRQ_event(unsigned int irq,
- {
- int status = 1; /* Force the "do bottom halves" bit */
- int ret, retval = 0;
-+ struct user_beancounter *ub;
-
- if (!(action->flags & SA_INTERRUPT))
- local_irq_enable();
-
-+ ub = set_exec_ub(get_ub0());
- do {
- ret = action->handler(irq, action->dev_id, regs);
- if (ret == IRQ_HANDLED)
-@@ -269,6 +273,7 @@ int handle_IRQ_event(unsigned int irq,
- retval |= ret;
- action = action->next;
- } while (action);
-+ (void)set_exec_ub(ub);
- if (status & SA_SAMPLE_RANDOM)
- add_interrupt_randomness(irq);
- local_irq_disable();
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/irq_ia64.c linux-2.6.9-ve023stab030/arch/ia64/kernel/irq_ia64.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/irq_ia64.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/irq_ia64.c 2006-10-11 19:07:57.000000000 +0400
-@@ -120,6 +120,7 @@ void
- ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
- {
- unsigned long saved_tpr;
-+ struct ve_struct *ve;
-
- #if IRQ_DEBUG
- {
-@@ -156,6 +157,12 @@ ia64_handle_irq (ia64_vector vector, str
- * 16 (without this, it would be ~240, which could easily lead
- * to kernel stack overflows).
- */
-+
-+#ifdef CONFIG_HOTPLUG_CPU
-+#warning "Fix fixup_irqs & ia64_process_pending_intr to set correct env and ub!"
-+#endif
-+
-+ ve = set_exec_env(get_ve0());
- irq_enter();
- saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
- ia64_srlz_d();
-@@ -181,6 +188,7 @@ ia64_handle_irq (ia64_vector vector, str
- * come through until ia64_eoi() has been done.
- */
- irq_exit();
-+ (void)set_exec_env(ve);
- }
-
- #ifdef CONFIG_HOTPLUG_CPU
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/mca.c linux-2.6.9-ve023stab030/arch/ia64/kernel/mca.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/mca.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/mca.c 2006-10-11 19:07:57.000000000 +0400
-@@ -533,13 +533,13 @@ init_handler_platform (pal_min_state_are
- #endif
- {
- struct task_struct *g, *t;
-- do_each_thread (g, t) {
-+ do_each_thread_all(g, t) {
- if (t == current)
- continue;
-
- printk("\nBacktrace of pid %d (%s)\n", t->pid, t->comm);
- show_stack(t, NULL);
-- } while_each_thread (g, t);
-+ } while_each_thread_all(g, t);
- }
- #ifdef CONFIG_SMP
- if (!tasklist_lock.write_lock)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/perfmon.c linux-2.6.9-ve023stab030/arch/ia64/kernel/perfmon.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/perfmon.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/perfmon.c 2006-10-11 19:07:57.000000000 +0400
-@@ -2628,7 +2628,7 @@ pfm_get_task(pfm_context_t *ctx, pid_t p
-
- read_lock(&tasklist_lock);
-
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
-
- /* make sure task cannot go away while we operate on it */
- if (p) get_task_struct(p);
-@@ -4183,12 +4183,12 @@ pfm_check_task_exist(pfm_context_t *ctx)
-
- read_lock(&tasklist_lock);
-
-- do_each_thread (g, t) {
-+ do_each_thread_ve(g, t) {
- if (t->thread.pfm_context == ctx) {
- ret = 0;
- break;
- }
-- } while_each_thread (g, t);
-+ } while_each_thread_ve(g, t);
-
- read_unlock(&tasklist_lock);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/process.c linux-2.6.9-ve023stab030/arch/ia64/kernel/process.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/process.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/process.c 2006-10-11 19:08:00.000000000 +0400
-@@ -85,6 +85,8 @@ show_stack (struct task_struct *task, un
- }
- }
-
-+EXPORT_SYMBOL(show_stack);
-+
- void
- dump_stack (void)
- {
-@@ -644,6 +646,13 @@ kernel_thread (int (*fn)(void *), void *
- struct pt_regs pt;
- } regs;
-
-+ /* Don't allow kernel_thread() inside VE */
-+ if (!ve_is_super(get_exec_env())) {
-+ printk("kernel_thread call inside VE\n");
-+ dump_stack();
-+ return -EPERM;
-+ }
-+
- memset(&regs, 0, sizeof(regs));
- regs.pt.cr_iip = helper_fptr[0]; /* set entry point (IP) */
- regs.pt.r1 = helper_fptr[1]; /* set GP */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/ptrace.c linux-2.6.9-ve023stab030/arch/ia64/kernel/ptrace.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/ptrace.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/ptrace.c 2006-10-11 19:08:00.000000000 +0400
-@@ -589,7 +589,7 @@ find_thread_for_addr (struct task_struct
- goto out;
- } while ((p = next_thread(p)) != child);
-
-- do_each_thread(g, p) {
-+ do_each_thread_ve(g, p) {
- if (child->mm != mm)
- continue;
-
-@@ -597,7 +597,7 @@ find_thread_for_addr (struct task_struct
- child = p;
- goto out;
- }
-- } while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- out:
- mmput(mm);
- return child;
-@@ -1332,7 +1332,7 @@ sys_ptrace (long request, pid_t pid, uns
- ret = -ESRCH;
- read_lock(&tasklist_lock);
- {
-- child = find_task_by_pid(pid);
-+ child = find_task_by_pid_ve(pid);
- if (child) {
- if (peek_or_poke)
- child = find_thread_for_addr(child, addr);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/setup.c linux-2.6.9-ve023stab030/arch/ia64/kernel/setup.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/setup.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/setup.c 2006-10-11 19:08:01.000000000 +0400
-@@ -40,6 +40,7 @@
- #include <linux/serial_core.h>
- #include <linux/efi.h>
- #include <linux/initrd.h>
-+#include <linux/vsched.h>
-
- #include <asm/ia32.h>
- #include <asm/machvec.h>
-@@ -466,6 +467,13 @@ show_cpuinfo (struct seq_file *m, void *
- #endif
- unsigned long mask;
- int i;
-+ unsigned long vcpu_khz;
-+
-+#ifdef CONFIG_FAIRSCHED
-+ vcpu_khz = ve_scale_khz(c->proc_freq);
-+#else
-+ vcpu_khz = c->proc_freq;
-+#endif
-
- mask = c->features;
-
-@@ -513,7 +521,7 @@ show_cpuinfo (struct seq_file *m, void *
- "BogoMIPS : %lu.%02lu\n",
- cpunum, c->vendor, family, c->model, c->revision, c->archrev,
- features, c->ppn, c->number,
-- c->proc_freq / 1000000, c->proc_freq % 1000000,
-+ vcpu_khz / 1000000, vcpu_khz % 1000000,
- c->itc_freq / 1000000, c->itc_freq % 1000000,
- lpj*HZ/500000, (lpj*HZ/5000) % 100);
- #ifdef CONFIG_SMP
-@@ -535,7 +543,7 @@ static void *
- c_start (struct seq_file *m, loff_t *pos)
- {
- #ifdef CONFIG_SMP
-- while (*pos < NR_CPUS && !cpu_isset(*pos, cpu_online_map))
-+ while (*pos < NR_CPUS && !vcpu_online(*pos))
- ++*pos;
- #endif
- return *pos < NR_CPUS ? cpu_data(*pos) : NULL;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/signal.c linux-2.6.9-ve023stab030/arch/ia64/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/signal.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/signal.c 2006-10-11 19:07:57.000000000 +0400
-@@ -269,7 +269,7 @@ ia64_rt_sigreturn (struct sigscratch *sc
- si.si_signo = SIGSEGV;
- si.si_errno = 0;
- si.si_code = SI_KERNEL;
-- si.si_pid = current->pid;
-+ si.si_pid = virt_pid(current);
- si.si_uid = current->uid;
- si.si_addr = sc;
- force_sig_info(SIGSEGV, &si, current);
-@@ -376,7 +376,7 @@ force_sigsegv_info (int sig, void __user
- si.si_signo = SIGSEGV;
- si.si_errno = 0;
- si.si_code = SI_KERNEL;
-- si.si_pid = current->pid;
-+ si.si_pid = virt_pid(current);
- si.si_uid = current->uid;
- si.si_addr = addr;
- force_sig_info(SIGSEGV, &si, current);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/smpboot.c linux-2.6.9-ve023stab030/arch/ia64/kernel/smpboot.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/smpboot.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/smpboot.c 2006-10-11 19:08:02.000000000 +0400
-@@ -432,6 +432,7 @@ do_boot_cpu (int sapicid, int cpu)
- printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
- ia64_cpu_to_sapicid[cpu] = -1;
- cpu_clear(cpu, cpu_online_map); /* was set in smp_callin() */
-+ fini_idle(cpu); /* undo fork_idle() */
- return -EINVAL;
- }
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/sys_ia64.c linux-2.6.9-ve023stab030/arch/ia64/kernel/sys_ia64.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/sys_ia64.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/sys_ia64.c 2006-10-11 19:07:56.000000000 +0400
-@@ -179,10 +179,25 @@ sys_pipe (long arg0, long arg1, long arg
- return retval;
- }
-
-+int ia64_map_check_rgn(unsigned long addr, unsigned long len)
-+{
-+ unsigned long roff;
-+
-+ /*
-+ * Don't permit mappings into unmapped space, the virtual page table
-+ * of a region, or across a region boundary. Note: RGN_MAP_LIMIT is
-+ * equal to 2^n-PAGE_SIZE (for some integer n <= 61) and len > 0.
-+ */
-+ roff = REGION_OFFSET(addr);
-+ if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len)))
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
- static inline unsigned long
- do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff)
- {
-- unsigned long roff;
- struct file *file = NULL;
-
- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-@@ -211,17 +226,6 @@ do_mmap2 (unsigned long addr, unsigned l
- goto out;
- }
-
-- /*
-- * Don't permit mappings into unmapped space, the virtual page table of a region,
-- * or across a region boundary. Note: RGN_MAP_LIMIT is equal to 2^n-PAGE_SIZE
-- * (for some integer n <= 61) and len > 0.
-- */
-- roff = REGION_OFFSET(addr);
-- if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len))) {
-- addr = -EINVAL;
-- goto out;
-- }
--
- down_write(&current->mm->mmap_sem);
- addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
- up_write(&current->mm->mmap_sem);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/time.c linux-2.6.9-ve023stab030/arch/ia64/kernel/time.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/time.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/time.c 2006-10-11 19:07:57.000000000 +0400
-@@ -36,6 +36,9 @@ u64 jiffies_64 = INITIAL_JIFFIES;
-
- EXPORT_SYMBOL(jiffies_64);
-
-+unsigned int cpu_khz; /* TSC clocks / usec, not used here */
-+EXPORT_SYMBOL(cpu_khz);
-+
- #define TIME_KEEPER_ID 0 /* smp_processor_id() of time-keeper */
-
- #ifdef CONFIG_IA64_DEBUG_IRQ
-@@ -233,6 +236,8 @@ ia64_init_itm (void)
- register_time_interpolator(&itc_interpolator);
- }
-
-+ cpu_khz = local_cpu_data->proc_freq / 1000;
-+
- /* Setup the CPU local timer tick */
- ia64_cpu_local_tick();
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/traps.c linux-2.6.9-ve023stab030/arch/ia64/kernel/traps.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/traps.c 2006-10-11 18:29:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/traps.c 2006-10-11 19:07:54.000000000 +0400
-@@ -51,34 +51,6 @@ trap_init (void)
- fpswa_interface = __va(ia64_boot_param->fpswa);
- }
-
--/*
-- * Unlock any spinlocks which will prevent us from getting the message out (timerlist_lock
-- * is acquired through the console unblank code)
-- */
--void
--bust_spinlocks (int yes)
--{
-- int loglevel_save = console_loglevel;
--
-- if (yes) {
-- oops_in_progress = 1;
-- return;
-- }
--
--#ifdef CONFIG_VT
-- unblank_screen();
--#endif
-- oops_in_progress = 0;
-- /*
-- * OK, the message is on the console. Now we call printk() without
-- * oops_in_progress set so that printk will give klogd a poke. Hold onto
-- * your hats...
-- */
-- console_loglevel = 15; /* NMI oopser may have shut the console up */
-- printk(" ");
-- console_loglevel = loglevel_save;
--}
--
- void
- die (const char *str, struct pt_regs *regs, long err)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/unaligned.c linux-2.6.9-ve023stab030/arch/ia64/kernel/unaligned.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/unaligned.c 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/unaligned.c 2006-10-11 19:07:57.000000000 +0400
-@@ -1281,7 +1281,7 @@ within_logging_rate_limit (void)
- {
- static unsigned long count, last_time;
-
-- if (jiffies - last_time > 5*HZ)
-+ if (jiffies - last_time > 60*HZ)
- count = 0;
- if (++count < 5) {
- last_time = jiffies;
-@@ -1339,7 +1339,7 @@ ia64_handle_unaligned (unsigned long ifa
- if (user_mode(regs))
- tty_write_message(current->signal->tty, buf);
- buf[len-1] = '\0'; /* drop '\r' */
-- printk(KERN_WARNING "%s", buf); /* watch for command names containing %s */
-+ ve_printk(VE_LOG, KERN_WARNING "%s", buf); /* watch for command names containing %s */
- }
- } else {
- if (within_logging_rate_limit())
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/unwind.c linux-2.6.9-ve023stab030/arch/ia64/kernel/unwind.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/kernel/unwind.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/kernel/unwind.c 2006-10-11 19:07:55.000000000 +0400
-@@ -362,7 +362,7 @@ unw_access_gr (struct unw_frame_info *in
- if (info->pri_unat_loc)
- nat_addr = info->pri_unat_loc;
- else
-- nat_addr = &info->sw->ar_unat;
-+ nat_addr = &info->sw->caller_unat;
- nat_mask = (1UL << ((long) addr & 0x1f8)/8);
- }
- } else {
-@@ -524,7 +524,7 @@ unw_access_ar (struct unw_frame_info *in
- case UNW_AR_UNAT:
- addr = info->unat_loc;
- if (!addr)
-- addr = &info->sw->ar_unat;
-+ addr = &info->sw->caller_unat;
- break;
-
- case UNW_AR_LC:
-@@ -1784,7 +1784,7 @@ run_script (struct unw_script *script, s
-
- case UNW_INSN_SETNAT_MEMSTK:
- if (!state->pri_unat_loc)
-- state->pri_unat_loc = &state->sw->ar_unat;
-+ state->pri_unat_loc = &state->sw->caller_unat;
- /* register off. is a multiple of 8, so the least 3 bits (type) are 0 */
- s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK;
- break;
-@@ -2246,11 +2246,11 @@ unw_init (void)
- if (8*sizeof(unw_hash_index_t) < UNW_LOG_HASH_SIZE)
- unw_hash_index_t_is_too_narrow();
-
-- unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(AR_UNAT);
-+ unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(CALLER_UNAT);
- unw.sw_off[unw.preg_index[UNW_REG_BSPSTORE]] = SW(AR_BSPSTORE);
-- unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_UNAT);
-+ unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_PFS);
- unw.sw_off[unw.preg_index[UNW_REG_RP]] = SW(B0);
-- unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(AR_UNAT);
-+ unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(CALLER_UNAT);
- unw.sw_off[unw.preg_index[UNW_REG_PR]] = SW(PR);
- unw.sw_off[unw.preg_index[UNW_REG_LC]] = SW(AR_LC);
- unw.sw_off[unw.preg_index[UNW_REG_FPSR]] = SW(AR_FPSR);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/lib/memcpy_mck.S linux-2.6.9-ve023stab030/arch/ia64/lib/memcpy_mck.S
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/lib/memcpy_mck.S 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/lib/memcpy_mck.S 2006-10-11 19:07:55.000000000 +0400
-@@ -634,8 +634,11 @@ END(memcpy)
- clrrrb
- ;;
- alloc saved_pfs_stack=ar.pfs,3,3,3,0
-+ cmp.lt p8,p0=A,r0
- sub B = dst0, saved_in0 // how many byte copied so far
- ;;
-+(p8) mov A = 0; // A shouldn't be negative, cap it
-+ ;;
- sub C = A, B
- sub D = saved_in2, A
- ;;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/discontig.c linux-2.6.9-ve023stab030/arch/ia64/mm/discontig.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/discontig.c 2006-10-11 18:29:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/mm/discontig.c 2006-10-11 19:07:57.000000000 +0400
-@@ -22,6 +22,7 @@
- #include <asm/meminit.h>
- #include <asm/numa.h>
- #include <asm/sections.h>
-+#include <linux/module.h>
-
- /*
- * Track per-node information needed to setup the boot memory allocator, the
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/fault.c linux-2.6.9-ve023stab030/arch/ia64/mm/fault.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/fault.c 2006-10-11 18:29:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/mm/fault.c 2006-10-11 19:07:56.000000000 +0400
-@@ -16,6 +16,9 @@
- #include <asm/uaccess.h>
- #include <asm/kdebug.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+
- extern void die (char *, struct pt_regs *, long);
-
- /*
-@@ -36,6 +39,11 @@ expand_backing_store (struct vm_area_str
- if (address - vma->vm_start > current->rlim[RLIMIT_STACK].rlim_cur
- || (((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) > current->rlim[RLIMIT_AS].rlim_cur))
- return -ENOMEM;
-+
-+ if (ub_memory_charge(mm_ub(vma->vm_mm), PAGE_SIZE,
-+ vma->vm_flags, vma->vm_file, UB_HARD))
-+ return -ENOMEM;
-+
- vma->vm_end += PAGE_SIZE;
- vma->vm_mm->total_vm += grow;
- if (vma->vm_flags & VM_LOCKED)
-@@ -252,13 +260,13 @@ ia64_do_page_fault (unsigned long addres
-
- out_of_memory:
- up_read(&mm->mmap_sem);
-- if (current->pid == 1) {
-- yield();
-- down_read(&mm->mmap_sem);
-- goto survive;
-- }
-- printk(KERN_CRIT "VM: killing process %s\n", current->comm);
-- if (user_mode(regs))
-- do_exit(SIGKILL);
-+ if (user_mode(regs)) {
-+ /*
-+ * 0-order allocation always success if something really
-+ * fatal not happen: beancounter overdraft or OOM. Den
-+ */
-+ force_sig(SIGKILL, current);
-+ return;
-+ }
- goto no_context;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/init.c linux-2.6.9-ve023stab030/arch/ia64/mm/init.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ia64/mm/init.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ia64/mm/init.c 2006-10-11 19:07:56.000000000 +0400
-@@ -37,6 +37,8 @@
- #include <asm/unistd.h>
- #include <asm/mca.h>
-
-+#include <ub/ub_vmpages.h>
-+
- DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
-
- extern void ia64_tlb_init (void);
-@@ -117,6 +119,10 @@ ia64_init_addr_space (void)
-
- ia64_set_rbs_bot();
-
-+ if (ub_memory_charge(mm_ub(current->mm), PAGE_SIZE,
-+ VM_DATA_DEFAULT_FLAGS, NULL, UB_SOFT))
-+ return;
-+
- /*
- * If we're out of memory and kmem_cache_alloc() returns NULL, we simply ignore
- * the problem. When the process attempts to write to the register backing store
-@@ -134,10 +140,14 @@ ia64_init_addr_space (void)
- if (insert_vm_struct(current->mm, vma)) {
- up_write(&current->mm->mmap_sem);
- kmem_cache_free(vm_area_cachep, vma);
-+ ub_memory_uncharge(mm_ub(current->mm), PAGE_SIZE,
-+ VM_DATA_DEFAULT_FLAGS, NULL);
- return;
- }
- up_write(&current->mm->mmap_sem);
-- }
-+ } else
-+ ub_memory_uncharge(mm_ub(current->mm), PAGE_SIZE,
-+ VM_DATA_DEFAULT_FLAGS, NULL);
-
- /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */
- if (!(current->personality & MMAP_PAGE_ZERO)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/irixelf.c linux-2.6.9-ve023stab030/arch/mips/kernel/irixelf.c
---- linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/irixelf.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/mips/kernel/irixelf.c 2006-10-11 19:07:55.000000000 +0400
-@@ -448,7 +448,12 @@ static inline int look_for_irix_interpre
- if (retval < 0)
- goto out;
-
-- file = open_exec(*name);
-+ /*
-+ * I don't understand this loop.
-+ * Are we suppose to break the loop after successful open and
-+ * read, or close the file, or store it somewhere? --SAW
-+ */
-+ file = open_exec(*name, bprm);
- if (IS_ERR(file)) {
- retval = PTR_ERR(file);
- goto out;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/irixsig.c linux-2.6.9-ve023stab030/arch/mips/kernel/irixsig.c
---- linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/irixsig.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/mips/kernel/irixsig.c 2006-10-11 19:07:55.000000000 +0400
-@@ -182,9 +182,10 @@ asmlinkage int do_irix_signal(sigset_t *
- if (!user_mode(regs))
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/signal.c linux-2.6.9-ve023stab030/arch/mips/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/signal.c 2004-10-19 01:55:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/mips/kernel/signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -551,9 +551,10 @@ asmlinkage int do_signal(sigset_t *oldse
- if (!user_mode(regs))
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/signal32.c linux-2.6.9-ve023stab030/arch/mips/kernel/signal32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/mips/kernel/signal32.c 2004-10-19 01:54:19.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/mips/kernel/signal32.c 2006-10-11 19:07:55.000000000 +0400
-@@ -700,9 +700,10 @@ asmlinkage int do_signal32(sigset_t *old
- if (!user_mode(regs))
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/ppc64/boot/zlib.c linux-2.6.9-ve023stab030/arch/ppc64/boot/zlib.c
---- linux-2.6.9-42.0.3.EL.orig/arch/ppc64/boot/zlib.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/ppc64/boot/zlib.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1307,7 +1307,7 @@ local int huft_build(
- {
- *t = (inflate_huft *)Z_NULL;
- *m = 0;
-- return Z_OK;
-+ return Z_DATA_ERROR;
- }
-
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/s390/kernel/compat_signal.c linux-2.6.9-ve023stab030/arch/s390/kernel/compat_signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/s390/kernel/compat_signal.c 2004-10-19 01:55:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/s390/kernel/compat_signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -250,9 +250,6 @@ sys32_sigaction(int sig, const struct ol
- return ret;
- }
-
--int
--do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
--
- asmlinkage long
- sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
- struct sigaction32 __user *oact, size_t sigsetsize)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/s390/mm/fault.c linux-2.6.9-ve023stab030/arch/s390/mm/fault.c
---- linux-2.6.9-42.0.3.EL.orig/arch/s390/mm/fault.c 2006-10-11 18:29:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/s390/mm/fault.c 2006-10-11 19:07:54.000000000 +0400
-@@ -61,17 +61,9 @@ void bust_spinlocks(int yes)
- if (yes) {
- oops_in_progress = 1;
- } else {
-- int loglevel_save = console_loglevel;
- oops_in_progress = 0;
- console_unblank();
-- /*
-- * OK, the message is on the console. Now we call printk()
-- * without oops_in_progress set so that printk will give klogd
-- * a poke. Hold onto your hats...
-- */
-- console_loglevel = 15;
-- printk(" ");
-- console_loglevel = loglevel_save;
-+ wake_up_klogd();
- }
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/sh/kernel/signal.c linux-2.6.9-ve023stab030/arch/sh/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/sh/kernel/signal.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/sh/kernel/signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -580,9 +580,10 @@ int do_signal(struct pt_regs *regs, sigs
- if (!user_mode(regs))
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/sh64/kernel/signal.c linux-2.6.9-ve023stab030/arch/sh64/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/sh64/kernel/signal.c 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/sh64/kernel/signal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -701,10 +701,11 @@ int do_signal(struct pt_regs *regs, sigs
- if (!user_mode(regs))
- return 1;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-- }
-+ if (unlikely(test_thread_flag(TIF_FREEZE))) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
-+ }
-
- if (!oldset)
- oldset = &current->blocked;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/boot/compressed/head.S linux-2.6.9-ve023stab030/arch/x86_64/boot/compressed/head.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/boot/compressed/head.S 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/boot/compressed/head.S 2006-10-11 19:07:58.000000000 +0400
-@@ -35,7 +35,7 @@
- startup_32:
- cld
- cli
-- movl $(__KERNEL_DS),%eax
-+ movl $(__BOOT_DS),%eax
- movl %eax,%ds
- movl %eax,%es
- movl %eax,%fs
-@@ -77,7 +77,7 @@ startup_32:
- jnz 3f
- addl $8,%esp
- xorl %ebx,%ebx
-- ljmp $(__KERNEL_CS), $0x100000
-+ ljmp $(__BOOT_CS), $0x100000
-
- /*
- * We come here, if we were loaded high.
-@@ -105,7 +105,7 @@ startup_32:
- popl %eax # hcount
- movl $0x100000,%edi
- cli # make sure we don't get interrupted
-- ljmp $(__KERNEL_CS), $0x1000 # and jump to the move routine
-+ ljmp $(__BOOT_CS), $0x1000 # and jump to the move routine
-
- /*
- * Routine (template) for moving the decompressed kernel in place,
-@@ -128,7 +128,7 @@ move_routine_start:
- movsl
- movl %ebx,%esi # Restore setup pointer
- xorl %ebx,%ebx
-- ljmp $(__KERNEL_CS), $0x100000
-+ ljmp $(__BOOT_CS), $0x100000
- move_routine_end:
-
-
-@@ -138,5 +138,5 @@ user_stack:
- .fill 4096,4,0
- stack_start:
- .long user_stack+4096
-- .word __KERNEL_DS
-+ .word __BOOT_DS
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/boot/setup.S linux-2.6.9-ve023stab030/arch/x86_64/boot/setup.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/boot/setup.S 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/boot/setup.S 2006-10-11 19:07:58.000000000 +0400
-@@ -727,7 +727,7 @@ flush_instr:
- subw $DELTA_INITSEG, %si
- shll $4, %esi # Convert to 32-bit pointer
- # NOTE: For high loaded big kernels we need a
--# jmpi 0x100000,__KERNEL_CS
-+# jmpi 0x100000,__BOOT_CS
- #
- # but we yet haven't reloaded the CS register, so the default size
- # of the target offset still is 16 bit.
-@@ -738,7 +738,7 @@ flush_instr:
- .byte 0x66, 0xea # prefix + jmpi-opcode
- code32: .long 0x1000 # will be set to 0x100000
- # for big kernels
-- .word __KERNEL_CS
-+ .word __BOOT_CS
-
- # Here's a bunch of information about your current kernel..
- kernel_version: .ascii UTS_RELEASE
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_aout.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_aout.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_aout.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_aout.c 2006-10-11 19:07:57.000000000 +0400
-@@ -343,14 +343,14 @@ static int load_aout_binary(struct linux
- if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
- (N_MAGIC(ex) != NMAGIC) && (jiffies-error_time2) > 5*HZ)
- {
-- printk(KERN_NOTICE "executable not page aligned\n");
-+ ve_printk(VE_LOG, KERN_NOTICE "executable not page aligned\n");
- error_time2 = jiffies;
- }
-
- if ((fd_offset & ~PAGE_MASK) != 0 &&
- (jiffies-error_time) > 5*HZ)
- {
-- printk(KERN_WARNING
-+ ve_printk(VE_LOG, KERN_WARNING
- "fd_offset is not page aligned. Please convert program: %s\n",
- bprm->file->f_dentry->d_name.name);
- error_time = jiffies;
-@@ -461,7 +461,7 @@ static int load_aout_library(struct file
- static unsigned long error_time;
- if ((jiffies-error_time) > 5*HZ)
- {
-- printk(KERN_WARNING
-+ ve_printk(VE_LOG, KERN_WARNING
- "N_TXTOFF is not page aligned. Please convert library: %s\n",
- file->f_dentry->d_name.name);
- error_time = jiffies;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_binfmt.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_binfmt.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_binfmt.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_binfmt.c 2006-10-11 19:07:58.000000000 +0400
-@@ -27,12 +27,14 @@
- #include <asm/ia32.h>
- #include <asm/vsyscall32.h>
-
-+#include <ub/ub_vmpages.h>
-+
- #define ELF_NAME "elf/i386"
-
- #define AT_SYSINFO 32
- #define AT_SYSINFO_EHDR 33
-
--int sysctl_vsyscall32 = 1;
-+int sysctl_vsyscall32 = 0;
-
- #define ARCH_DLINFO do { \
- if (sysctl_vsyscall32) { \
-@@ -46,7 +48,7 @@ struct elf_phdr;
-
- #define IA32_EMULATOR 1
-
--#define ELF_ET_DYN_BASE (TASK_UNMAPPED_32 + 0x1000000)
-+#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
-
- #undef ELF_ARCH
- #define ELF_ARCH EM_386
-@@ -65,6 +67,13 @@ typedef unsigned int elf_greg_t;
- #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
- typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-+#if 0
-+/*
-+ * this doesn't work with CPT.
-+ * Process migrated from i686 can have vsyscall page at arbitrary
-+ * address due to execshield. -- dev@
-+ */
-+
- /*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents. Dumping its
-@@ -73,8 +82,8 @@ typedef elf_greg_t elf_gregset_t[ELF_NGR
- * Dumping its extra ELF program headers includes all the other information
- * a debugger needs to easily find how the vsyscall DSO was being used.
- */
--#define ELF_CORE_EXTRA_PHDRS (VSYSCALL32_EHDR->e_phnum)
--#define ELF_CORE_WRITE_EXTRA_PHDRS \
-+#define DO_ELF_CORE_EXTRA_PHDRS (VSYSCALL32_EHDR->e_phnum)
-+#define DO_ELF_CORE_WRITE_EXTRA_PHDRS \
- do { \
- const struct elf32_phdr *const vsyscall_phdrs = \
- (const struct elf32_phdr *) (VSYSCALL32_BASE \
-@@ -96,7 +105,7 @@ do { \
- DUMP_WRITE(&phdr, sizeof(phdr)); \
- } \
- } while (0)
--#define ELF_CORE_WRITE_EXTRA_DATA \
-+#define DO_ELF_CORE_WRITE_EXTRA_DATA \
- do { \
- const struct elf32_phdr *const vsyscall_phdrs = \
- (const struct elf32_phdr *) (VSYSCALL32_BASE \
-@@ -109,6 +118,20 @@ do { \
- } \
- } while (0)
-
-+#define ELF_CORE_EXTRA_PHDRS ({ (sysctl_vsyscall32 != 0 ? \
-+ DO_ELF_CORE_EXTRA_PHDRS : 0); })
-+
-+#define ELF_CORE_WRITE_EXTRA_PHDRS do { \
-+ if (sysctl_vsyscall32 != 0) \
-+ DO_ELF_CORE_WRITE_EXTRA_PHDRS; \
-+ } while (0)
-+
-+#define ELF_CORE_WRITE_EXTRA_DATA do { \
-+ if (sysctl_vsyscall32 != 0) \
-+ DO_ELF_CORE_WRITE_EXTRA_DATA; \
-+ } while (0)
-+#endif
-+
- struct elf_siginfo
- {
- int si_signo; /* signal number */
-@@ -306,6 +329,9 @@ MODULE_AUTHOR("Eric Youngdale, Andi Klee
-
- static void elf32_init(struct pt_regs *);
-
-+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
-+extern int arch_setup_additional_pages(struct linux_binprm *, int exstack, unsigned long map_address);
-+
- #include "../../../fs/binfmt_elf.c"
-
- static void elf32_init(struct pt_regs *regs)
-@@ -330,7 +356,7 @@ static void elf32_init(struct pt_regs *r
-
- int setup_arg_pages(struct linux_binprm *bprm, int executable_stack)
- {
-- unsigned long stack_base;
-+ unsigned long stack_base, vm_end, vm_start;
- struct vm_area_struct *mpnt;
- struct mm_struct *mm = current->mm;
- int i, ret;
-@@ -343,22 +369,28 @@ int setup_arg_pages(struct linux_binprm
- bprm->loader += stack_base;
- bprm->exec += stack_base;
-
-+ vm_end = IA32_STACK_TOP;
-+ vm_start = PAGE_MASK & (unsigned long)bprm->p;
-+
-+ ret = -ENOMEM;
-+ if (ub_memory_charge(mm_ub(mm), vm_end - vm_start,
-+ vm_stack_flags32, NULL, UB_HARD))
-+ goto out;
-+
- mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-- if (!mpnt)
-- return -ENOMEM;
--
-- if (security_vm_enough_memory((IA32_STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))>>PAGE_SHIFT)) {
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return -ENOMEM;
-- }
-+ if (!mpnt)
-+ goto out_uncharge;
-+
-+ if (security_vm_enough_memory((vm_end - vm_start)>>PAGE_SHIFT))
-+ goto out_uncharge_free;
-
- memset(mpnt, 0, sizeof(*mpnt));
-
- down_write(&mm->mmap_sem);
- {
- mpnt->vm_mm = mm;
-- mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
-- mpnt->vm_end = IA32_STACK_TOP;
-+ mpnt->vm_start = vm_start;
-+ mpnt->vm_end = vm_end;
- if (executable_stack == EXSTACK_ENABLE_X)
- mpnt->vm_flags = vm_stack_flags32 | VM_EXEC;
- else if (executable_stack == EXSTACK_DISABLE_X)
-@@ -367,11 +399,8 @@ int setup_arg_pages(struct linux_binprm
- mpnt->vm_flags = vm_stack_flags32;
- mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC) ?
- PAGE_COPY_EXEC : PAGE_COPY;
-- if ((ret = insert_vm_struct(mm, mpnt))) {
-- up_write(&mm->mmap_sem);
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return ret;
-- }
-+ if ((ret = insert_vm_struct(mm, mpnt)))
-+ goto out_up;
- mm->stack_vm = mm->total_vm = vma_pages(mpnt);
- }
-
-@@ -386,6 +415,17 @@ int setup_arg_pages(struct linux_binprm
- up_write(&mm->mmap_sem);
-
- return 0;
-+
-+out_up:
-+ up_write(&mm->mmap_sem);
-+ vm_unacct_memory((vm_end - vm_start) >> PAGE_SHIFT);
-+out_uncharge_free:
-+ kmem_cache_free(vm_area_cachep, mpnt);
-+out_uncharge:
-+ ub_memory_uncharge(mm_ub(mm), vm_end - vm_start,
-+ vm_stack_flags32, NULL);
-+out:
-+ return ret;
- }
-
- static unsigned long
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_ioctl.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_ioctl.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_ioctl.c 2004-10-19 01:54:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_ioctl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -24,17 +24,27 @@
- static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr)
- {
-
-- struct file *file = fget(fd);
-+ struct file *file;
- struct tty_struct *real_tty;
-+ int ret;
-
-+ file = fget(fd);
- if (!file)
- return -EBADF;
-+
-+ ret = -EINVAL;
- if (file->f_op->ioctl != tty_ioctl)
-- return -EINVAL;
-+ goto out;
- real_tty = (struct tty_struct *)file->private_data;
- if (!real_tty)
-- return -EINVAL;
-- return put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
-+ goto out;
-+
-+ ret = put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
-+
-+out:
-+ fput(file);
-+
-+ return ret;
- }
-
- #define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_signal.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32_signal.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32_signal.c 2006-10-11 19:07:58.000000000 +0400
-@@ -44,10 +44,10 @@
- asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
- void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
-
--int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from)
-+int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
- {
- int err;
-- if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t32)))
-+ if (!access_ok (VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
- return -EFAULT;
-
- /* If you change siginfo_t structure, please make sure that
-@@ -95,11 +95,11 @@ int ia32_copy_siginfo_to_user(siginfo_t3
- return err;
- }
-
--int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from)
-+int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
- {
- int err;
- u32 ptr32;
-- if (!access_ok (VERIFY_READ, from, sizeof(siginfo_t32)))
-+ if (!access_ok (VERIFY_READ, from, sizeof(compat_siginfo_t)))
- return -EFAULT;
-
- err = __get_user(to->si_signo, &from->si_signo);
-@@ -123,6 +123,7 @@ sys32_sigsuspend(int history0, int histo
- mask &= _BLOCKABLE;
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
-+ set_sigsuspend_state(current, saveset);
- siginitset(&current->blocked, mask);
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-@@ -131,8 +132,10 @@ sys32_sigsuspend(int history0, int histo
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
-- if (do_signal(regs, &saveset))
-+ if (do_signal(regs, &saveset)) {
-+ clear_sigsuspend_state(current);
- return -EINTR;
-+ }
- }
- }
-
-@@ -188,7 +191,7 @@ struct rt_sigframe
- int sig;
- u32 pinfo;
- u32 puc;
-- struct siginfo32 info;
-+ struct compat_siginfo info;
- struct ucontext_ia32 uc;
- struct _fpstate_ia32 fpstate;
- char retcode[8];
-@@ -542,7 +545,7 @@ void ia32_setup_rt_frame(int sig, struct
- }
- err |= __put_user((u32)(u64)&frame->info, &frame->pinfo);
- err |= __put_user((u32)(u64)&frame->uc, &frame->puc);
-- err |= ia32_copy_siginfo_to_user(&frame->info, info);
-+ err |= copy_siginfo_to_user32(&frame->info, info);
- if (err)
- goto give_sigsegv;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32entry.S linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32entry.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ia32entry.S 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ia32entry.S 2006-10-11 19:07:56.000000000 +0400
-@@ -64,7 +64,8 @@ ENTRY(ia32_sysenter_target)
- pushq $__USER32_DS
- pushq %rbp
- pushfq
-- movl $VSYSCALL32_SYSEXIT, %r10d
-+ GET_THREAD_INFO(%r10)
-+ movl threadinfo_sysenter_return(%r10), %r10d
- pushq $__USER32_CS
- movl %eax, %eax
- pushq %r10
-@@ -95,7 +96,7 @@ sysenter_do_call:
- RESTORE_ARGS 1,24,1,1,1,1
- popfq
- popq %rcx /* User %esp */
-- movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */
-+ movl threadinfo_sysenter_return(%r10),%edx /* User %eip */
- swapgs
- sti /* sti only takes effect after the next instruction */
- /* sysexit */
-@@ -433,7 +434,11 @@ ia32_sys_call_table:
- .quad sys_init_module
- .quad sys_delete_module
- .quad quiet_ni_syscall /* 130 get_kernel_syms */
-- .quad sys32_quotactl /* quotactl */
-+#ifndef CONFIG_QUOTA_COMPAT
-+ .quad sys_quotactl /* quotactl */
-+#else
-+ .quad sys32_quotactl
-+#endif
- .quad sys_getpgid
- .quad sys_fchdir
- .quad quiet_ni_syscall /* bdflush */
-@@ -479,7 +484,7 @@ ia32_sys_call_table:
- .quad sys32_rt_sigaction
- .quad sys32_rt_sigprocmask /* 175 */
- .quad sys32_rt_sigpending
-- .quad sys32_rt_sigtimedwait
-+ .quad compat_rt_sigtimedwait
- .quad sys32_rt_sigqueueinfo
- .quad stub32_rt_sigsuspend
- .quad sys32_pread /* 180 */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ptrace32.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/ptrace32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/ptrace32.c 2004-10-19 01:53:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/ptrace32.c 2006-10-11 19:07:57.000000000 +0400
-@@ -205,7 +205,7 @@ static struct task_struct *find_target(i
-
- *err = -ESRCH;
- read_lock(&tasklist_lock);
-- child = find_task_by_pid(pid);
-+ child = find_task_by_pid_ve(pid);
- if (child)
- get_task_struct(child);
- read_unlock(&tasklist_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/sys_ia32.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/sys_ia32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/sys_ia32.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/sys_ia32.c 2006-10-11 19:08:00.000000000 +0400
-@@ -736,7 +736,7 @@ int sys32_ni_syscall(int call)
- static char lastcomm[sizeof(me->comm)];
-
- if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
-- printk(KERN_INFO "IA32 syscall %d from %s not implemented\n",
-+ ve_printk(VE_LOG, KERN_INFO "IA32 syscall %d from %s not implemented\n",
- call, me->comm);
- strncpy(lastcomm, me->comm, sizeof(lastcomm));
- }
-@@ -858,51 +858,13 @@ sys32_rt_sigpending(compat_sigset_t __us
-
-
- asmlinkage long
--sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
-- struct compat_timespec __user *uts, compat_size_t sigsetsize)
--{
-- sigset_t s;
-- compat_sigset_t s32;
-- struct timespec t;
-- int ret;
-- mm_segment_t old_fs = get_fs();
-- siginfo_t info;
--
-- if (copy_from_user (&s32, uthese, sizeof(compat_sigset_t)))
-- return -EFAULT;
-- switch (_NSIG_WORDS) {
-- case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
-- case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32);
-- case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
-- case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
-- }
-- if (uts && get_compat_timespec(&t, uts))
-- return -EFAULT;
-- if (uinfo) {
-- /* stop data leak to user space in case of structure fill mismatch
-- * between sys_rt_sigtimedwait & ia32_copy_siginfo_to_user.
-- */
-- memset(&info, 0, sizeof(info));
-- }
-- set_fs (KERNEL_DS);
-- ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
-- sigsetsize);
-- set_fs (old_fs);
-- if (ret >= 0 && uinfo) {
-- if (ia32_copy_siginfo_to_user(uinfo, &info))
-- return -EFAULT;
-- }
-- return ret;
--}
--
--asmlinkage long
--sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
-+sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
- {
- siginfo_t info;
- int ret;
- mm_segment_t old_fs = get_fs();
-
-- if (ia32_copy_siginfo_from_user(&info, uinfo))
-+ if (copy_siginfo_from_user32(&info, uinfo))
- return -EFAULT;
- set_fs (KERNEL_DS);
- ret = sys_rt_sigqueueinfo(pid, sig, &info);
-@@ -1023,7 +985,7 @@ sys32_sendfile(int out_fd, int in_fd, co
- ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
- set_fs(old_fs);
-
-- if (!ret && offset && put_user(of, offset))
-+ if (offset && put_user(of, offset))
- return -EFAULT;
-
- return ret;
-@@ -1151,13 +1113,13 @@ asmlinkage long sys32_olduname(struct ol
-
- down_read(&uts_sem);
-
-- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
-+ error = __copy_to_user(&name->sysname,&ve_utsname.sysname,__OLD_UTS_LEN);
- __put_user(0,name->sysname+__OLD_UTS_LEN);
-- __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
-+ __copy_to_user(&name->nodename,&ve_utsname.nodename,__OLD_UTS_LEN);
- __put_user(0,name->nodename+__OLD_UTS_LEN);
-- __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
-+ __copy_to_user(&name->release,&ve_utsname.release,__OLD_UTS_LEN);
- __put_user(0,name->release+__OLD_UTS_LEN);
-- __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
-+ __copy_to_user(&name->version,&ve_utsname.version,__OLD_UTS_LEN);
- __put_user(0,name->version+__OLD_UTS_LEN);
- {
- char *arch = "x86_64";
-@@ -1180,7 +1142,7 @@ long sys32_uname(struct old_utsname __us
- if (!name)
- return -EFAULT;
- down_read(&uts_sem);
-- err=copy_to_user(name, &system_utsname, sizeof (*name));
-+ err=copy_to_user(name, &ve_utsname, sizeof (*name));
- up_read(&uts_sem);
- if (personality(current->personality) == PER_LINUX32)
- err |= copy_to_user(&name->machine, "i686", 5);
-@@ -1239,7 +1201,7 @@ asmlinkage long sys32_clone(unsigned int
- }
-
- asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-- siginfo_t32 __user *uinfo, int options,
-+ compat_siginfo_t __user *uinfo, int options,
- struct compat_rusage __user *uru)
- {
- siginfo_t info;
-@@ -1261,7 +1223,7 @@ asmlinkage long sys32_waitid(int which,
-
- BUG_ON(info.si_code & __SI_MASK);
- info.si_code |= __SI_CHLD;
-- return ia32_copy_siginfo_to_user(uinfo, &info);
-+ return copy_siginfo_to_user32(uinfo, &info);
- }
-
- /*
-@@ -1436,25 +1398,13 @@ long sys32_vm86_warning(void)
- struct task_struct *me = current;
- static char lastcomm[sizeof(me->comm)];
- if (strncmp(lastcomm, me->comm, sizeof(lastcomm))) {
-- printk(KERN_INFO "%s: vm86 mode not supported on 64 bit kernel\n",
-+ ve_printk(VE_LOG, KERN_INFO "%s: vm87 mode not supported on 64 bit kernel\n",
- me->comm);
- strncpy(lastcomm, me->comm, sizeof(lastcomm));
- }
- return -ENOSYS;
- }
-
--long sys32_quotactl(void)
--{
-- struct task_struct *me = current;
-- static char lastcomm[8];
-- if (strcmp(lastcomm, me->comm)) {
-- printk(KERN_INFO "%s: 32bit quotactl not supported on 64 bit kernel\n",
-- me->comm);
-- strcpy(lastcomm, me->comm);
-- }
-- return -ENOSYS;
--}
--
- long sys32_lookup_dcookie(u32 addr_low, u32 addr_high,
- char __user * buf, size_t len)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/syscall32.c linux-2.6.9-ve023stab030/arch/x86_64/ia32/syscall32.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/syscall32.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/syscall32.c 2006-10-11 19:07:59.000000000 +0400
-@@ -4,11 +4,14 @@
- on demand because 32bit cannot reach the kernel's fixmaps */
-
- #include <linux/mm.h>
-+#include <linux/mman.h>
- #include <linux/string.h>
- #include <linux/kernel.h>
- #include <linux/gfp.h>
- #include <linux/init.h>
- #include <linux/stringify.h>
-+#include <linux/security.h>
-+#include <linux/module.h>
- #include <asm/proto.h>
- #include <asm/tlbflush.h>
- #include <asm/ia32_unistd.h>
-@@ -29,53 +32,93 @@ extern int sysctl_vsyscall32;
-
- char *syscall32_page;
- static int use_sysenter __initdata = -1;
-+EXPORT_SYMBOL(syscall32_page);
-
--/*
-- * Map the 32bit vsyscall page on demand.
-- *
-- * RED-PEN: This knows too much about high level VM.
-- *
-- * Alternative would be to generate a vma with appropriate backing options
-- * and let it be handled by generic VM.
-- */
--int __map_syscall32(struct mm_struct *mm, unsigned long address)
--{
-- pte_t *pte;
-- pmd_t *pmd;
-- int err = 0;
--
-- spin_lock(&mm->page_table_lock);
-- pmd = pmd_alloc(mm, pgd_offset(mm, address), address);
-- if (pmd && (pte = pte_alloc_map(mm, pmd, address)) != NULL) {
-- if (pte_none(*pte)) {
-- set_pte(pte,
-- mk_pte(virt_to_page(syscall32_page),
-- PAGE_KERNEL_VSYSCALL32));
-- }
-- /* Flush only the local CPU. Other CPUs taking a fault
-- will just end up here again */
-- __flush_tlb_one(address);
-- } else
-- err = -ENOMEM;
-- spin_unlock(&mm->page_table_lock);
-- return err;
-+
-+static struct page *
-+syscall32_nopage(struct vm_area_struct *vma, unsigned long adr, int *type)
-+{
-+ struct page *p = virt_to_page(adr - vma->vm_start + syscall32_page);
-+ get_page(p);
-+ return p;
-+}
-+
-+/* Prevent VMA merging */
-+static void syscall32_vma_close(struct vm_area_struct *vma)
-+{
- }
-
--int map_syscall32(struct mm_struct *mm, unsigned long address)
-+struct vm_operations_struct syscall32_vm_ops = {
-+ .close = syscall32_vma_close,
-+ .nopage = syscall32_nopage,
-+};
-+EXPORT_SYMBOL(syscall32_vm_ops);
-+
-+struct linux_binprm;
-+
-+/* Setup a VMA at program startup for the vsyscall page */
-+int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack,
-+ unsigned long map_address)
- {
-- int err;
-- down_read(&mm->mmap_sem);
-- err = __map_syscall32(mm, address);
-- up_read(&mm->mmap_sem);
-- return err;
-+ int npages = (__VSYSCALL32_END - __VSYSCALL32_BASE) >> PAGE_SHIFT;
-+ struct vm_area_struct *vma;
-+ struct mm_struct *mm = current->mm;
-+ unsigned long addr = map_address ? : __VSYSCALL32_BASE;
-+ int ret;
-+
-+ if (sysctl_vsyscall32 == 0 && map_address == 0)
-+ return 0;
-+
-+ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-+ if (!vma)
-+ return -ENOMEM;
-+ if (security_vm_enough_memory(npages)) {
-+ kmem_cache_free(vm_area_cachep, vma);
-+ return -ENOMEM;
-+ }
-+
-+ down_write(&mm->mmap_sem);
-+ addr = get_unmapped_area_prot(NULL, addr, PAGE_SIZE * npages, 0,
-+ MAP_PRIVATE | MAP_FIXED, PROT_READ | PROT_EXEC);
-+ if (unlikely(addr & ~PAGE_MASK)) {
-+ ret = addr;
-+ goto out;
-+ }
-+
-+ memset(vma, 0, sizeof(struct vm_area_struct));
-+ /* Could randomize here */
-+ vma->vm_start = addr;
-+ vma->vm_end = addr + PAGE_SIZE * npages;
-+ /* MAYWRITE to allow gdb to COW and set breakpoints */
-+ vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYEXEC|VM_MAYWRITE;
-+ vma->vm_flags |= mm->def_flags;
-+ vma->vm_page_prot = protection_map[vma->vm_flags & 7];
-+ vma->vm_ops = &syscall32_vm_ops;
-+ vma->vm_mm = mm;
-+
-+ ret = insert_vm_struct(mm, vma);
-+ if (ret) {
-+ goto out;
-+ }
-+ mm->context.vdso = (void *)addr;
-+ current_thread_info()->sysenter_return = VSYSCALL32_SYSEXIT;
-+
-+ mm->total_vm += npages;
-+ up_write(&mm->mmap_sem);
-+ return 0;
-+out:
-+ up_write(&mm->mmap_sem);
-+ kmem_cache_free(vm_area_cachep, vma);
-+ vm_unacct_memory(npages);
-+ return ret;
- }
-+EXPORT_SYMBOL(arch_setup_additional_pages);
-
- static int __init init_syscall32(void)
- {
- syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
- if (!syscall32_page)
- panic("Cannot allocate syscall32 page");
-- SetPageReserved(virt_to_page(syscall32_page));
- if (use_sysenter > 0) {
- memcpy(syscall32_page, syscall32_sysenter,
- syscall32_sysenter_end - syscall32_sysenter);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/vsyscall-sysenter.S linux-2.6.9-ve023stab030/arch/x86_64/ia32/vsyscall-sysenter.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/vsyscall-sysenter.S 2004-10-19 01:55:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/vsyscall-sysenter.S 2006-10-11 19:07:56.000000000 +0400
-@@ -19,9 +19,9 @@ __kernel_vsyscall:
- .Lenter_kernel:
- movl %esp,%ebp
- sysenter
-- .space 7,0x90
-+ .space 23,0x90
- jmp .Lenter_kernel
-- /* 16: System call normal return point is here! */
-+ /* 32: System call normal return point is here! */
- pop %ebp
- .Lpop_ebp:
- pop %edx
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/vsyscall.lds linux-2.6.9-ve023stab030/arch/x86_64/ia32/vsyscall.lds
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/ia32/vsyscall.lds 2004-10-19 01:53:25.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/ia32/vsyscall.lds 2006-10-11 19:07:56.000000000 +0400
-@@ -4,11 +4,11 @@
- */
-
- /* This must match <asm/fixmap.h>. */
--VSYSCALL_BASE = 0xffffe000;
-+__VSYSCALL_BASE = 0xbffff000;
-
- SECTIONS
- {
-- . = VSYSCALL_BASE + SIZEOF_HEADERS;
-+ . = __VSYSCALL_BASE + SIZEOF_HEADERS;
-
- .hash : { *(.hash) } :text
- .dynsym : { *(.dynsym) }
-@@ -21,18 +21,18 @@ SECTIONS
- For the layouts to match, we need to skip more than enough
- space for the dynamic symbol table et al. If this amount
- is insufficient, ld -shared will barf. Just increase it here. */
-- . = VSYSCALL_BASE + 0x400;
-+ . = __VSYSCALL_BASE + 0x400;
-
- .text.vsyscall : { *(.text.vsyscall) } :text =0x90909090
-
- /* This is an 32bit object and we cannot easily get the offsets
- into the 64bit kernel. Just hardcode them here. This assumes
- that all the stubs don't need more than 0x100 bytes. */
-- . = VSYSCALL_BASE + 0x500;
-+ . = __VSYSCALL_BASE + 0x500;
-
- .text.sigreturn : { *(.text.sigreturn) } :text =0x90909090
-
-- . = VSYSCALL_BASE + 0x600;
-+ . = __VSYSCALL_BASE + 0x600;
-
- .text.rtsigreturn : { *(.text.rtsigreturn) } :text =0x90909090
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/acpi/wakeup.S linux-2.6.9-ve023stab030/arch/x86_64/kernel/acpi/wakeup.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/acpi/wakeup.S 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/acpi/wakeup.S 2006-10-11 19:07:58.000000000 +0400
-@@ -77,7 +77,7 @@ wakeup_code:
-
- .byte 0x66, 0xea # prefix + jmpi-opcode
- .long wakeup_32 - __START_KERNEL_map
-- .word __KERNEL_CS
-+ .word __BOOT_CS
-
- .code32
- wakeup_32:
-@@ -96,13 +96,13 @@ wakeup_32:
- jnc bogus_cpu
- movl %edx,%edi
-
-- movw $__KERNEL_DS, %ax
-+ movw $__BOOT_DS, %ax
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
-
-- movw $__KERNEL_DS, %ax
-+ movw $__BOOT_DS, %ax
- movw %ax, %ss
-
- mov $(wakeup_stack - __START_KERNEL_map), %esp
-@@ -187,7 +187,7 @@ reach_compatibility_mode:
-
- wakeup_jumpvector:
- .long wakeup_long64 - __START_KERNEL_map
-- .word __KERNEL_CS
-+ .word __BOOT_CS
-
- .code64
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/apic.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/apic.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/apic.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/apic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -895,6 +895,7 @@ void smp_local_timer_interrupt(struct pt
- */
- void smp_apic_timer_interrupt(struct pt_regs *regs)
- {
-+ struct ve_struct *ve;
- /*
- * the NMI deadlock-detector uses this.
- */
-@@ -910,9 +911,11 @@ void smp_apic_timer_interrupt(struct pt_
- * Besides, if we don't timer interrupts ignore the global
- * interrupt lock, which is the WrongThing (tm) to do.
- */
-+ ve = set_exec_env(get_ve0());
- irq_enter();
- smp_local_timer_interrupt(regs);
- irq_exit();
-+ (void)set_exec_env(ve);
- }
-
- /*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/asm-offsets.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/asm-offsets.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/asm-offsets.c 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/asm-offsets.c 2006-10-11 19:07:56.000000000 +0400
-@@ -32,6 +32,7 @@ int main(void)
- ENTRY(flags);
- ENTRY(addr_limit);
- ENTRY(preempt_count);
-+ ENTRY(sysenter_return);
- BLANK();
- #undef ENTRY
- #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/entry.S linux-2.6.9-ve023stab030/arch/x86_64/kernel/entry.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/entry.S 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/entry.S 2006-10-11 19:07:57.000000000 +0400
-@@ -173,6 +173,10 @@ rff_trace:
- *
- * XXX if we had a free scratch register we could save the RSP into the stack frame
- * and report it properly in ps. Unfortunately we haven't.
-+ *
-+ * When user can change the frames always force IRET. That is because
-+ * it deals with uncanonical addresses better. SYSRET has trouble
-+ * with them due to bugs in both AMD and Intel CPUs.
- */
-
- ENTRY(system_call)
-@@ -236,7 +240,10 @@ sysret_signal:
- xorl %esi,%esi # oldset -> arg2
- call ptregscall_common
- 1: movl $_TIF_NEED_RESCHED,%edi
-- jmp sysret_check
-+ /* Use IRET because user could have changed frame. This
-+ works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
-+ cli
-+ jmp int_with_check
-
- /* Do syscall tracing */
- tracesys:
-@@ -257,7 +264,8 @@ tracesys:
- call syscall_trace_leave
- RESTORE_TOP_OF_STACK %rbx
- RESTORE_REST
-- jmp ret_from_sys_call
-+ /* Use IRET because user could have changed frame */
-+ jmp int_ret_from_sys_call
-
- badsys:
- movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
-@@ -360,20 +368,9 @@ ENTRY(stub_execve)
- popq %r11
- CFI_ADJUST_CFA_OFFSET -8
- SAVE_REST
-- movq %r11, %r15
- FIXUP_TOP_OF_STACK %r11
- call sys_execve
-- GET_THREAD_INFO(%rcx)
-- bt $TIF_IA32,threadinfo_flags(%rcx)
-- jc exec_32bit
- RESTORE_TOP_OF_STACK %r11
-- movq %r15, %r11
-- RESTORE_REST
-- push %r11
-- ret
--
--exec_32bit:
-- CFI_ADJUST_CFA_OFFSET REST_SKIP
- movq %rax,RAX(%rsp)
- RESTORE_REST
- jmp int_ret_from_sys_call
-@@ -476,7 +473,8 @@ iret_label:
- /* force a signal here? this matches i386 behaviour */
- /* running with kernel gs */
- bad_iret:
-- movq $-9999,%rdi /* better code? */
-+ movq $11,%rdi /* SIGSEGV */
-+ sti
- jmp do_exit
- .previous
-
-@@ -734,7 +732,7 @@ ENTRY(kernel_thread)
- xorl %r9d,%r9d
-
- # clone now
-- call do_fork
-+ call do_fork_kthread
- movq %rax,RAX(%rsp)
- xorl %edi,%edi
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/head.S linux-2.6.9-ve023stab030/arch/x86_64/kernel/head.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/head.S 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/head.S 2006-10-11 19:07:58.000000000 +0400
-@@ -39,7 +39,7 @@ startup_32:
-
- movl %ebx,%ebp /* Save trampoline flag */
-
-- movl $__KERNEL_DS,%eax
-+ movl $__BOOT_DS,%eax
- movl %eax,%ds
-
- /* If the CPU doesn't support CPUID this will double fault.
-@@ -159,7 +159,14 @@ reach_long64:
- /* esi is pointer to real mode structure with interesting info.
- pass it to C */
- movl %esi, %edi
--
-+
-+ /* Switch to __KERNEL_CS. The segment is the same, but selector
-+ * is different. */
-+ pushq $__KERNEL_CS
-+ pushq $switch_cs
-+ lretq
-+switch_cs:
-+
- /* Finally jump to run C code and to be on real kernel address
- * Since we are running on identity-mapped space we have to jump
- * to the full 64bit address , this is only possible as indirect
-@@ -192,7 +199,7 @@ pGDT32:
- .org 0xf10
- ljumpvector:
- .long reach_long64-__START_KERNEL_map
-- .word __KERNEL_CS
-+ .word __BOOT_CS
-
- ENTRY(stext)
- ENTRY(_stext)
-@@ -326,7 +333,7 @@ gdt:
- ENTRY(gdt_table32)
- .quad 0x0000000000000000 /* This one is magic */
- .quad 0x0000000000000000 /* unused */
-- .quad 0x00af9a000000ffff /* __KERNEL_CS */
-+ .quad 0x00af9a000000ffff /* __BOOT_CS */
- gdt32_end:
-
- /* We need valid kernel segments for data and code in long mode too
-@@ -337,23 +344,30 @@ gdt32_end:
- .align L1_CACHE_BYTES
-
- /* The TLS descriptors are currently at a different place compared to i386.
-- Hopefully nobody expects them at a fixed place (Wine?) */
-+ Hopefully nobody expects them at a fixed place (Wine?)
-+ Descriptors rearranged to plase 32bit and TLS selectors in the same
-+ places, because it is really necessary. sysret/exit mandates order
-+ of kernel/user cs/ds, so we have to extend gdt.
-+*/
-
- ENTRY(cpu_gdt_table)
-- .quad 0x0000000000000000 /* NULL descriptor */
-- .quad 0x008f9a000000ffff /* __KERNEL_COMPAT32_CS */
-- .quad 0x00af9a000000ffff /* __KERNEL_CS */
-- .quad 0x00cf92000000ffff /* __KERNEL_DS */
-- .quad 0x00cffe000000ffff /* __USER32_CS */
-- .quad 0x00cff2000000ffff /* __USER_DS, __USER32_DS */
-- .quad 0x00affa000000ffff /* __USER_CS */
-- .quad 0x00cf9a000000ffff /* __KERNEL32_CS */
-- .quad 0,0 /* TSS */
-- .quad 0 /* LDT */
-- .quad 0,0,0 /* three TLS descriptors */
-- .quad 0 /* unused now */
-- .quad 0x00009a000000ffff /* __KERNEL16_CS - 16bit PM for S3 wakeup. */
-+ .quad 0x0000000000000000 /* 0 NULL descriptor */
-+ .quad 0x008f9a000000ffff /* 1 __KERNEL_COMPAT32_CS */
-+ .quad 0x00af9a000000ffff /* 2 __BOOT_CS */
-+ .quad 0x00cf92000000ffff /* 3 __BOOT_DS */
-+ .quad 0,0 /* 4,5 TSS */
-+ .quad 0,0,0 /* 6-8 three TLS descriptors */
-+ .quad 0x00009a000000ffff /* 9 __KERNEL16_CS - 16bit PM for S3 wakeup. */
- /* base must be patched for real base address. */
-+ .quad 0 /* 10 LDT */
-+ .quad 0x00cf9a000000ffff /* 11 __KERNEL32_CS */
-+ .quad 0x00af9a000000ffff /* 12 __KERNEL_CS */
-+ .quad 0x00cf92000000ffff /* 13 __KERNEL_DS */
-+ .quad 0x00cffe000000ffff /* 14 __USER32_CS */
-+ .quad 0x00cff2000000ffff /* 15 __USER_DS, __USER32_DS */
-+ .quad 0x00affa000000ffff /* 16 __USER_CS */
-+ .quad 0,0,0,0,0,0,0
-+ .quad 0,0,0,0,0,0,0,0
- gdt_end:
- /* asm/segment.h:GDT_ENTRIES must match this */
- /* This should be a multiple of the cache line size */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/irq.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/irq.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/irq.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/irq.c 2006-10-11 19:07:57.000000000 +0400
-@@ -45,7 +45,8 @@
- #include <asm/desc.h>
- #include <asm/irq.h>
-
--
-+#include <ub/beancounter.h>
-+#include <ub/ub_task.h>
-
- /*
- * Linux has a controller-independent x86 interrupt architecture.
-@@ -214,16 +215,19 @@ int handle_IRQ_event(unsigned int irq, s
- {
- int status = 1; /* Force the "do bottom halves" bit */
- int ret;
-+ struct user_beancounter *ub;
-
- if (!(action->flags & SA_INTERRUPT))
- local_irq_enable();
-
-+ ub = set_exec_ub(get_ub0());
- do {
- ret = action->handler(irq, action->dev_id, regs);
- if (ret == IRQ_HANDLED)
- status |= action->flags;
- action = action->next;
- } while (action);
-+ (void)set_exec_ub(ub);
- if (status & SA_SAMPLE_RANDOM)
- add_interrupt_randomness(irq);
- local_irq_disable();
-@@ -342,9 +346,11 @@ asmlinkage unsigned int do_IRQ(struct pt
- irq_desc_t *desc = irq_desc + irq;
- struct irqaction * action;
- unsigned int status;
-+ struct ve_struct *ve;
-
- if (irq > 256) BUG();
-
-+ ve = set_exec_env(get_ve0());
- irq_enter();
- kstat_cpu(cpu).irqs[irq]++;
- spin_lock(&desc->lock);
-@@ -407,6 +413,7 @@ out:
- spin_unlock(&desc->lock);
-
- irq_exit();
-+ (void)set_exec_env(ve);
- return 1;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/ldt.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/ldt.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/ldt.c 2004-10-19 01:55:18.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/ldt.c 2006-10-11 19:07:59.000000000 +0400
-@@ -22,6 +22,7 @@
- #include <asm/ldt.h>
- #include <asm/desc.h>
- #include <asm/proto.h>
-+#include <linux/module.h>
-
- #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
- static void flush_ldt(void *null)
-@@ -109,6 +110,7 @@ int init_new_context(struct task_struct
- }
- return retval;
- }
-+EXPORT_SYMBOL(init_new_context);
-
- /*
- *
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/nmi.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/nmi.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/nmi.c 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/nmi.c 2006-10-11 19:07:55.000000000 +0400
-@@ -60,6 +60,7 @@ int panic_on_timeout;
- unsigned int nmi_watchdog = NMI_DEFAULT;
- static unsigned int nmi_hz = HZ;
- unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */
-+static unsigned int nmi_p4_cccr_val;
-
- /* Note that these events don't tick when the CPU idles. This means
- the frequency varies with CPU load. */
-@@ -71,12 +72,41 @@ unsigned int nmi_perfctr_msr; /* the MSR
- #define K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 0x76
- #define K7_NMI_EVENT K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING
-
--#define P6_EVNTSEL0_ENABLE (1 << 22)
--#define P6_EVNTSEL_INT (1 << 20)
--#define P6_EVNTSEL_OS (1 << 17)
--#define P6_EVNTSEL_USR (1 << 16)
--#define P6_EVENT_CPU_CLOCKS_NOT_HALTED 0x79
--#define P6_NMI_EVENT P6_EVENT_CPU_CLOCKS_NOT_HALTED
-+#define MSR_P4_MISC_ENABLE 0x1A0
-+#define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7)
-+#define MSR_P4_MISC_ENABLE_PEBS_UNAVAIL (1<<12)
-+#define MSR_P4_PERFCTR0 0x300
-+#define MSR_P4_CCCR0 0x360
-+#define P4_ESCR_EVENT_SELECT(N) ((N)<<25)
-+#define P4_ESCR_OS (1<<3)
-+#define P4_ESCR_USR (1<<2)
-+#define P4_CCCR_OVF_PMI0 (1<<26)
-+#define P4_CCCR_OVF_PMI1 (1<<27)
-+#define P4_CCCR_THRESHOLD(N) ((N)<<20)
-+#define P4_CCCR_COMPLEMENT (1<<19)
-+#define P4_CCCR_COMPARE (1<<18)
-+#define P4_CCCR_REQUIRED (3<<16)
-+#define P4_CCCR_ESCR_SELECT(N) ((N)<<13)
-+#define P4_CCCR_ENABLE (1<<12)
-+/* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter
-+ CRU_ESCR0 (with any non-null event selector) through a complemented
-+ max threshold. [IA32-Vol3, Section 14.9.9] */
-+#define MSR_P4_IQ_COUNTER0 0x30C
-+#define P4_NMI_CRU_ESCR0 (P4_ESCR_EVENT_SELECT(0x3F)|P4_ESCR_OS|P4_ESCR_USR)
-+#define P4_NMI_IQ_CCCR0 \
-+ (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \
-+ P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE)
-+
-+static __init inline int nmi_known_cpu(void)
-+{
-+ switch (boot_cpu_data.x86_vendor) {
-+ case X86_VENDOR_AMD:
-+ return boot_cpu_data.x86 == 15;
-+ case X86_VENDOR_INTEL:
-+ return boot_cpu_data.x86 == 15;
-+ }
-+ return 0;
-+}
-
- /* Run after command line and cpu_init init, but before all other checks */
- void __init nmi_watchdog_default(void)
-@@ -84,19 +114,10 @@ void __init nmi_watchdog_default(void)
- if (nmi_watchdog != NMI_DEFAULT)
- return;
-
-- /* For some reason the IO APIC watchdog doesn't work on the AMD
-- 8111 chipset. For now switch to local APIC mode using
-- perfctr0 there. On Intel CPUs we don't have code to handle
-- the perfctr and the IO-APIC seems to work, so use that. */
--
-- if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
-- nmi_watchdog = NMI_LOCAL_APIC;
-- printk(KERN_INFO
-- "Using local APIC NMI watchdog using perfctr0\n");
-- } else {
-- printk(KERN_INFO "Using IO APIC NMI watchdog\n");
-+ if (nmi_known_cpu())
-+ nmi_watchdog = NMI_LOCAL_APIC;
-+ else
- nmi_watchdog = NMI_IO_APIC;
-- }
- }
-
- /* Why is there no CPUID flag for this? */
-@@ -182,7 +203,10 @@ static void disable_lapic_nmi_watchdog(v
- wrmsr(MSR_K7_EVNTSEL0, 0, 0);
- break;
- case X86_VENDOR_INTEL:
-- wrmsr(MSR_IA32_EVNTSEL0, 0, 0);
-+ if (boot_cpu_data.x86 == 15) {
-+ wrmsr(MSR_P4_IQ_CCCR0, 0, 0);
-+ wrmsr(MSR_P4_CRU_ESCR0, 0, 0);
-+ }
- break;
- }
- nmi_active = -1;
-@@ -297,6 +321,14 @@ late_initcall(init_lapic_nmi_sysfs);
- * Original code written by Keith Owens.
- */
-
-+static void clear_msr_range(unsigned int base, unsigned int n)
-+{
-+ unsigned int i;
-+
-+ for(i = 0; i < n; ++i)
-+ wrmsr(base+i, 0, 0);
-+}
-+
- static void setup_k7_watchdog(void)
- {
- int i;
-@@ -328,6 +360,47 @@ static void setup_k7_watchdog(void)
- wrmsr(MSR_K7_EVNTSEL0, evntsel, 0);
- }
-
-+static int setup_p4_watchdog(void)
-+{
-+ unsigned int misc_enable, dummy;
-+
-+ rdmsr(MSR_P4_MISC_ENABLE, misc_enable, dummy);
-+ if (!(misc_enable & MSR_P4_MISC_ENABLE_PERF_AVAIL))
-+ return 0;
-+
-+ nmi_perfctr_msr = MSR_P4_IQ_COUNTER0;
-+ nmi_p4_cccr_val = P4_NMI_IQ_CCCR0;
-+#ifdef CONFIG_SMP
-+ if (smp_num_siblings == 2)
-+ nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1;
-+#endif
-+
-+ if (!(misc_enable & MSR_P4_MISC_ENABLE_PEBS_UNAVAIL))
-+ clear_msr_range(0x3F1, 2);
-+ /* MSR 0x3F0 seems to have a default value of 0xFC00, but current
-+ docs doesn't fully define it, so leave it alone for now. */
-+ if (boot_cpu_data.x86_model >= 0x3) {
-+ /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
-+ clear_msr_range(0x3A0, 26);
-+ clear_msr_range(0x3BC, 3);
-+ } else {
-+ clear_msr_range(0x3A0, 31);
-+ }
-+ clear_msr_range(0x3C0, 6);
-+ clear_msr_range(0x3C8, 6);
-+ clear_msr_range(0x3E0, 2);
-+ clear_msr_range(MSR_P4_CCCR0, 18);
-+ clear_msr_range(MSR_P4_PERFCTR0, 18);
-+
-+ wrmsr(MSR_P4_CRU_ESCR0, P4_NMI_CRU_ESCR0, 0);
-+ wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0 & ~P4_CCCR_ENABLE, 0);
-+ Dprintk("setting P4_IQ_COUNTER0 to 0x%08lx\n", -(cpu_khz/nmi_hz*1000));
-+ wrmsr(MSR_P4_IQ_COUNTER0, -(cpu_khz/nmi_hz*1000), -1);
-+ apic_write(APIC_LVTPC, APIC_DM_NMI);
-+ wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0);
-+ return 1;
-+}
-+
- void setup_apic_nmi_watchdog(void)
- {
- switch (boot_cpu_data.x86_vendor) {
-@@ -338,6 +411,13 @@ void setup_apic_nmi_watchdog(void)
- return;
- setup_k7_watchdog();
- break;
-+ case X86_VENDOR_INTEL:
-+ if (boot_cpu_data.x86 != 15)
-+ return;
-+ if (!setup_p4_watchdog())
-+ return;
-+ break;
-+
- default:
- return;
- }
-@@ -400,8 +480,20 @@ void nmi_watchdog_tick (struct pt_regs *
- last_irq_sums[cpu] = sum;
- alert_counter[cpu] = 0;
- }
-- if (nmi_perfctr_msr)
-+ if (nmi_perfctr_msr) {
-+ if (nmi_perfctr_msr == MSR_P4_IQ_COUNTER0) {
-+ /*
-+ * P4 quirks:
-+ * - An overflown perfctr will assert its interrupt
-+ * until the OVF flag in its CCCR is cleared.
-+ * - LVTPC is masked on interrupt and must be
-+ * unmasked by the LVTPC handler.
-+ */
-+ wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0);
-+ apic_write(APIC_LVTPC, APIC_DM_NMI);
-+ }
- wrmsr(nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000), -1);
-+ }
- }
-
- static int dummy_nmi_callback(struct pt_regs * regs, int cpu)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/process.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/process.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/process.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/process.c 2006-10-11 19:08:02.000000000 +0400
-@@ -49,6 +49,13 @@
- #include <asm/ia32.h>
-
- asmlinkage extern void ret_from_fork(void);
-+EXPORT_SYMBOL(ret_from_fork);
-+
-+asmlinkage extern void int_ret_from_sys_call(void);
-+EXPORT_SYMBOL(int_ret_from_sys_call);
-+
-+asmlinkage extern void execve(void);
-+EXPORT_SYMBOL(execve);
-
- unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
-
-@@ -213,8 +220,9 @@ void __show_regs(struct pt_regs * regs)
- printk("Pid: %d, comm: %.20s %s %s\n",
- current->pid, current->comm, print_tainted(), UTS_RELEASE);
- printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
-- printk_address(regs->rip);
-- printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags);
-+ if (decode_call_traces)
-+ printk_address(regs->rip);
-+ printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags);
- printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
- regs->rax, regs->rbx, regs->rcx);
- printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
-@@ -373,10 +381,10 @@ int copy_thread(int nr, unsigned long cl
- p->thread.fs = me->thread.fs;
- p->thread.gs = me->thread.gs;
-
-- asm("movl %%gs,%0" : "=m" (p->thread.gsindex));
-- asm("movl %%fs,%0" : "=m" (p->thread.fsindex));
-- asm("movl %%es,%0" : "=m" (p->thread.es));
-- asm("movl %%ds,%0" : "=m" (p->thread.ds));
-+ asm("mov %%gs,%0" : "=m" (p->thread.gsindex));
-+ asm("mov %%fs,%0" : "=m" (p->thread.fsindex));
-+ asm("mov %%es,%0" : "=m" (p->thread.es));
-+ asm("mov %%ds,%0" : "=m" (p->thread.ds));
-
- if (unlikely(me->thread.io_bitmap_ptr != NULL)) {
- p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
-@@ -437,11 +445,11 @@ struct task_struct *__switch_to(struct t
- * Switch DS and ES.
- * This won't pick up thread selector changes, but I guess that is ok.
- */
-- asm volatile("movl %%es,%0" : "=m" (prev->es));
-+ asm volatile("mov %%es,%0" : "=m" (prev->es));
- if (unlikely(next->es | prev->es))
- loadsegment(es, next->es);
-
-- asm volatile ("movl %%ds,%0" : "=m" (prev->ds));
-+ asm volatile ("mov %%ds,%0" : "=m" (prev->ds));
- if (unlikely(next->ds | prev->ds))
- loadsegment(ds, next->ds);
-
-@@ -625,7 +633,7 @@ long do_arch_prctl(struct task_struct *t
-
- switch (code) {
- case ARCH_SET_GS:
-- if (addr >= TASK_SIZE)
-+ if (addr >= TASK_SIZE_OF(task))
- return -EPERM;
- cpu = get_cpu();
- /* handle small bases via the GDT because that's faster to
-@@ -651,7 +659,7 @@ long do_arch_prctl(struct task_struct *t
- case ARCH_SET_FS:
- /* Not strictly needed for fs, but do it for symmetry
- with gs */
-- if (addr >= TASK_SIZE)
-+ if (addr >= TASK_SIZE_OF(task))
- return -EPERM;
- cpu = get_cpu();
- /* handle small bases via the GDT because that's faster to
-@@ -730,3 +738,20 @@ int dump_task_regs(struct task_struct *t
-
- return 1;
- }
-+
-+long do_fork_kthread(unsigned long clone_flags,
-+ unsigned long stack_start,
-+ struct pt_regs *regs,
-+ unsigned long stack_size,
-+ int __user *parent_tidptr,
-+ int __user *child_tidptr)
-+{
-+ if (ve_is_super(get_exec_env()))
-+ return do_fork(clone_flags, stack_start, regs, stack_size,
-+ parent_tidptr, child_tidptr);
-+
-+ /* Don't allow kernel_thread() inside VE */
-+ printk("kernel_thread call inside VE\n");
-+ dump_stack();
-+ return -EPERM;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/ptrace.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/ptrace.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/ptrace.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/ptrace.c 2006-10-11 19:08:00.000000000 +0400
-@@ -129,12 +129,12 @@ static int putreg(struct task_struct *ch
- value &= 0xffff;
- return 0;
- case offsetof(struct user_regs_struct,fs_base):
-- if (value >= TASK_SIZE)
-+ if (value >= TASK_SIZE_OF(child))
- return -EIO;
- child->thread.fs = value;
- return 0;
- case offsetof(struct user_regs_struct,gs_base):
-- if (value >= TASK_SIZE)
-+ if (value >= TASK_SIZE_OF(child))
- return -EIO;
- child->thread.gs = value;
- return 0;
-@@ -158,7 +158,7 @@ static int putreg(struct task_struct *ch
- * user stack. So just disallow directly setting
- * any value in danger of being noncanonical.
- */
-- if (value >= TASK_SIZE)
-+ if (value >= TASK_SIZE_OF(child))
- return -EIO;
- break;
- }
-@@ -182,6 +182,15 @@ static unsigned long getreg(struct task_
- return child->thread.fs;
- case offsetof(struct user_regs_struct, gs_base):
- return child->thread.gs;
-+ case offsetof(struct user_regs_struct, cs):
-+ if (test_tsk_thread_flag(child, TIF_SYSCALL_TRACE)) {
-+ val = get_stack_long(child, regno - sizeof(struct pt_regs));
-+ if (val == __USER_CS)
-+ return 0x33;
-+ if (val == __USER32_CS)
-+ return 0x23;
-+ }
-+ /* fall through */
- default:
- regno = regno - sizeof(struct pt_regs);
- val = get_stack_long(child, regno);
-@@ -215,7 +224,7 @@ asmlinkage long sys_ptrace(long request,
- }
- ret = -ESRCH;
- read_lock(&tasklist_lock);
-- child = find_task_by_pid(pid);
-+ child = find_task_by_pid_ve(pid);
- if (child)
- get_task_struct(child);
- read_unlock(&tasklist_lock);
-@@ -298,6 +307,10 @@ asmlinkage long sys_ptrace(long request,
- break;
-
- case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
-+ {
-+ int dsize;
-+
-+ dsize = test_tsk_thread_flag(child, TIF_IA32) ? 3 : 7;
- ret = -EIO;
- if ((addr & 7) ||
- addr > sizeof(struct user) - 7)
-@@ -309,22 +322,22 @@ asmlinkage long sys_ptrace(long request,
- break;
- /* Disallows to set a breakpoint into the vsyscall */
- case offsetof(struct user, u_debugreg[0]):
-- if (data >= TASK_SIZE-7) break;
-+ if (data >= TASK_SIZE_OF(child) - dsize) break;
- child->thread.debugreg0 = data;
- ret = 0;
- break;
- case offsetof(struct user, u_debugreg[1]):
-- if (data >= TASK_SIZE-7) break;
-+ if (data >= TASK_SIZE_OF(child) - dsize) break;
- child->thread.debugreg1 = data;
- ret = 0;
- break;
- case offsetof(struct user, u_debugreg[2]):
-- if (data >= TASK_SIZE-7) break;
-+ if (data >= TASK_SIZE_OF(child) - dsize) break;
- child->thread.debugreg2 = data;
- ret = 0;
- break;
- case offsetof(struct user, u_debugreg[3]):
-- if (data >= TASK_SIZE-7) break;
-+ if (data >= TASK_SIZE_OF(child) - dsize) break;
- child->thread.debugreg3 = data;
- ret = 0;
- break;
-@@ -346,6 +359,7 @@ asmlinkage long sys_ptrace(long request,
- break;
- }
- break;
-+ }
- case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
- case PTRACE_CONT: { /* restart after signal. */
- long tmp;
-@@ -516,8 +530,10 @@ static void syscall_trace(struct pt_regs
- current_thread_info()->flags, current->ptrace);
- #endif
-
-+ set_pn_state(current, (regs->rax != -ENOSYS) ? PN_STOP_LEAVE : PN_STOP_ENTRY);
- ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
- ? 0x80 : 0));
-+ clear_pn_state(current);
- /*
- * this isn't the same as continuing with a signal, but it will do
- * for normal use. strace only continues with a signal if the
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/setup.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/setup.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/setup.c 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/setup.c 2006-10-11 19:08:01.000000000 +0400
-@@ -41,6 +41,7 @@
- #include <linux/kallsyms.h>
- #include <linux/edd.h>
- #include <linux/dmi.h>
-+#include <linux/vsched.h>
- #include <asm/mtrr.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
-@@ -1206,12 +1207,18 @@ static int show_cpuinfo(struct seq_file
- "vid", /* voltage id control */
- "ttp", /* thermal trip */
- };
-+ unsigned long vcpu_khz;
-
-
- #ifdef CONFIG_SMP
-- if (!cpu_online(c-cpu_data))
-+ if (!vcpu_online(c-cpu_data))
- return 0;
- #endif
-+#ifdef CONFIG_FAIRSCHED
-+ vcpu_khz = ve_scale_khz(cpu_khz);
-+#else
-+ vcpu_khz = cpu_khz;
-+#endif
-
- seq_printf(m,"processor\t: %u\n"
- "vendor_id\t: %s\n"
-@@ -1231,7 +1238,7 @@ static int show_cpuinfo(struct seq_file
-
- if (cpu_has(c,X86_FEATURE_TSC)) {
- seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
-- cpu_khz / 1000, (cpu_khz % 1000));
-+ vcpu_khz / 1000, (vcpu_khz % 1000));
- }
-
- /* Cache size */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/signal.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/signal.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/signal.c 2006-10-11 19:07:59.000000000 +0400
-@@ -31,6 +31,7 @@
- #include <asm/proto.h>
- #include <asm/ia32_unistd.h>
- #include <asm/vsyscall.h>
-+#include <linux/module.h>
-
- /* #define DEBUG_SIG 1 */
-
-@@ -56,6 +57,7 @@ sys_rt_sigsuspend(sigset_t __user *unews
-
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
-+ set_sigsuspend_state(current, saveset);
- current->blocked = newset;
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-@@ -67,8 +69,10 @@ sys_rt_sigsuspend(sigset_t __user *unews
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
-- if (do_signal(regs, &saveset))
-+ if (do_signal(regs, &saveset)) {
-+ clear_sigsuspend_state(current);
- return -EINTR;
-+ }
- }
- }
-
-@@ -431,9 +435,10 @@ int do_signal(struct pt_regs *regs, sigs
- return 1;
- }
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-- goto no_signal;
-+ if (test_thread_flag(TIF_FREEZE)) {
-+ refrigerator();
-+ if (!signal_pending(current))
-+ goto no_signal;
- }
-
- if (!oldset)
-@@ -474,6 +479,7 @@ int do_signal(struct pt_regs *regs, sigs
- }
- return 0;
- }
-+EXPORT_SYMBOL(do_signal);
-
- void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/smp.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/smp.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/smp.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/smp.c 2006-10-11 19:07:59.000000000 +0400
-@@ -20,6 +20,7 @@
- #include <linux/kernel_stat.h>
- #include <linux/mc146818rtc.h>
- #include <linux/interrupt.h>
-+#include <linux/module.h>
-
- #include <asm/mtrr.h>
- #include <asm/pgalloc.h>
-@@ -211,6 +212,7 @@ void flush_tlb_mm (struct mm_struct * mm
-
- preempt_enable();
- }
-+EXPORT_SYMBOL(flush_tlb_mm);
-
- void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
- {
-@@ -279,7 +281,8 @@ struct call_data_struct {
- int wait;
- };
-
--static struct call_data_struct * call_data;
-+static struct call_data_struct call_fn_data;
-+static struct call_data_struct * call_data = &call_fn_data;
- static struct call_data_struct * saved_call_data;
-
- /*
-@@ -347,30 +350,28 @@ void dump_smp_call_function (void (*func
- static void __smp_call_function (void (*func) (void *info), void *info,
- int nonatomic, int wait)
- {
-- struct call_data_struct data;
- int cpus = num_online_cpus()-1;
-
- if (!cpus)
- return;
-
-- data.func = func;
-- data.info = info;
-- atomic_set(&data.started, 0);
-- data.wait = wait;
-+ call_fn_data.func = func;
-+ call_fn_data.info = info;
-+ call_fn_data.wait = wait;
-+ atomic_set(&call_fn_data.started, 0);
- if (wait)
-- atomic_set(&data.finished, 0);
-+ atomic_set(&call_fn_data.finished, 0);
-
-- call_data = &data;
- wmb();
- /* Send a message to all other CPUs and wait for them to respond */
- send_IPI_allbutself(CALL_FUNCTION_VECTOR);
-
- /* Wait for response */
-- while (atomic_read(&data.started) != cpus)
-+ while (atomic_read(&call_fn_data.started) != cpus)
- cpu_relax();
-
- if (wait)
-- while (atomic_read(&data.finished) != cpus)
-+ while (atomic_read(&call_fn_data.finished) != cpus)
- cpu_relax();
-
- }
-@@ -416,18 +417,18 @@ static void smp_really_stop_cpu(void *du
- asm("hlt");
- }
-
-+static struct call_data_struct stop_cpus_data = {
-+ .func = &smp_really_stop_cpu,
-+ .info = NULL,
-+ .wait = 0,
-+};
-+
- void smp_send_stop(void)
- {
-- int nolock = 0;
-- /* Don't deadlock on the call lock in panic */
-- if (!spin_trylock(&call_lock)) {
-- udelay(100);
-- /* ignore locking because we have paniced anyways */
-- nolock = 1;
-- }
-- __smp_call_function(smp_really_stop_cpu, NULL, 1, 0);
-- if (!nolock)
-- spin_unlock(&call_lock);
-+ call_data = &stop_cpus_data;
-+ mb();
-+ send_IPI_allbutself(CALL_FUNCTION_VECTOR);
-+
- local_irq_disable();
- disable_local_APIC();
- local_irq_enable();
-@@ -445,11 +446,17 @@ asmlinkage void smp_reschedule_interrupt
-
- asmlinkage void smp_call_function_interrupt(void)
- {
-- void (*func) (void *info) = call_data->func;
-- void *info = call_data->info;
-- int wait = call_data->wait;
-+ struct call_data_struct *data;
-+ void (*func) (void *info);
-+ void *info;
-+ int wait;
-
- ack_APIC_irq();
-+
-+ data = call_data;
-+ func = data->func;
-+ info = data->info;
-+ wait = data->wait;
- /*
- * Notify initiating CPU that I've grabbed the data and am
- * about to execute the function
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/smpboot.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/smpboot.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/smpboot.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/smpboot.c 2006-10-11 19:08:02.000000000 +0400
-@@ -712,6 +712,7 @@ static void __init do_boot_cpu (int apic
- if (boot_error) {
- cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */
- clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
-+ fini_idle(cpu); /* undo fork_idle() */
- cpucount--;
- x86_cpu_to_apicid[cpu] = BAD_APICID;
- x86_cpu_to_log_apicid[cpu] = BAD_APICID;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/sys_x86_64.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/sys_x86_64.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/sys_x86_64.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/sys_x86_64.c 2006-10-11 19:07:57.000000000 +0400
-@@ -71,13 +71,7 @@ out:
- void find_start_end(unsigned long flags, unsigned long *begin,
- unsigned long *end)
- {
--#ifdef CONFIG_IA32_EMULATION
-- if (test_thread_flag(TIF_IA32)) {
-- *begin = TASK_UNMAPPED_32;
-- *end = IA32_PAGE_OFFSET;
-- } else
--#endif
-- if (flags & MAP_32BIT) {
-+ if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) {
- /* This is usually used needed to map code in small
- model, so it needs to be in the first 31bit. Limit
- it to that. This means we need to move the
-@@ -85,12 +79,12 @@ void find_start_end(unsigned long flags,
- conflicts with the heap, but we assume that glibc
- malloc knows how to fall back to mmap. Give it 1GB
- of playground for now. -AK */
-- *begin = 0x40000000;
-- *end = 0x80000000;
-- } else {
-- *begin = TASK_UNMAPPED_64;
-- *end = TASK_SIZE;
-- }
-+ *begin = 0x40000000;
-+ *end = 0x80000000;
-+ } else {
-+ *begin = TASK_UNMAPPED_BASE;
-+ *end = TASK_SIZE;
-+ }
- }
-
- unsigned long
-@@ -243,7 +237,7 @@ asmlinkage long sys_uname(struct new_uts
- {
- int err;
- down_read(&uts_sem);
-- err = copy_to_user(name, &system_utsname, sizeof (*name));
-+ err = copy_to_user(name, &ve_utsname, sizeof (*name));
- up_read(&uts_sem);
- if (personality(current->personality) == PER_LINUX32)
- err |= copy_to_user(&name->machine, "i686", 5);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/time.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/time.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/time.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/time.c 2006-10-11 19:07:57.000000000 +0400
-@@ -67,6 +67,8 @@ unsigned long vxtime_hz = PIT_TICK_RATE;
- int report_lost_ticks; /* command line option */
- unsigned long long monotonic_base;
-
-+EXPORT_SYMBOL(cpu_khz);
-+
- struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */
-
- volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/trampoline.S linux-2.6.9-ve023stab030/arch/x86_64/kernel/trampoline.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/trampoline.S 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/trampoline.S 2006-10-11 19:07:58.000000000 +0400
-@@ -46,7 +46,7 @@ r_base = .
- lidt idt_48 - r_base # load idt with 0, 0
- lgdt gdt_48 - r_base # load gdt with whatever is appropriate
-
-- movw $__KERNEL_DS,%ax
-+ movw $__BOOT_DS,%ax
- movw %ax,%ds
- movw %ax,%es
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/traps.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/traps.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/traps.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/traps.c 2006-10-11 19:08:02.000000000 +0400
-@@ -95,7 +95,7 @@ static int kstack_depth_to_print = 10;
-
- #ifdef CONFIG_KALLSYMS
- #include <linux/kallsyms.h>
--int printk_address(unsigned long address)
-+void printk_address(unsigned long address)
- {
- unsigned long offset = 0, symsize;
- const char *symname;
-@@ -103,19 +103,24 @@ int printk_address(unsigned long address
- char *delim = ":";
- char namebuf[128];
-
-+ if (!decode_call_traces)
-+ return printk(" [<%016lx>]", address);
-+
- symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
-- if (!symname)
-- return printk("[<%016lx>]", address);
-+ if (!symname) {
-+ printk(" [<%016lx>]\n", address);
-+ return;
-+ }
- if (!modname)
- modname = delim = "";
-- return printk("<%016lx>{%s%s%s%s%+ld}",
-- address,delim,modname,delim,symname,offset);
-+ printk(" [<%016lx>] %s%s%s%s+0x%lx/0x%lx\n",
-+ address, delim, modname, delim, symname, offset, symsize);
- }
- #else
--int printk_address(unsigned long address)
--{
-- return printk("[<%016lx>]", address);
--}
-+void printk_address(unsigned long address)
-+{
-+ printk(" [<%016lx>]\n", address);
-+}
- #endif
-
- unsigned long *in_exception_stack(int cpu, unsigned long stack)
-@@ -144,26 +149,17 @@ void show_trace(unsigned long *stack)
- unsigned long addr;
- unsigned long *irqstack, *irqstack_end, *estack_end;
- const int cpu = safe_smp_processor_id();
-- int i;
-
- printk("\nCall Trace:");
-- i = 0;
-
- estack_end = in_exception_stack(cpu, (unsigned long)stack);
- if (estack_end) {
- while (stack < estack_end) {
- addr = *stack++;
- if (__kernel_text_address(addr)) {
-- i += printk_address(addr);
-- i += printk(" ");
-- if (i > 50) {
-- printk("\n");
-- i = 0;
-- }
-+ printk_address(addr);
- }
- }
-- i += printk(" <EOE> ");
-- i += 7;
- stack = (unsigned long *) estack_end[-2];
- }
-
-@@ -171,7 +167,7 @@ void show_trace(unsigned long *stack)
- irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE + 64);
-
- if (stack >= irqstack && stack < irqstack_end) {
-- printk("<IRQ> ");
-+ printk(" <IRQ> ");
- while (stack < irqstack_end) {
- addr = *stack++;
- /*
-@@ -183,28 +179,17 @@ void show_trace(unsigned long *stack)
- * out the call path that was taken.
- */
- if (__kernel_text_address(addr)) {
-- i += printk_address(addr);
-- i += printk(" ");
-- if (i > 50) {
-- printk("\n ");
-- i = 0;
-- }
-+ printk_address(addr);
- }
- }
- stack = (unsigned long *) (irqstack_end[-1]);
-- printk(" <EOI> ");
-- i += 7;
-+ printk(" <EOI> ");
- }
-
- while (((long) stack & (THREAD_SIZE-1)) != 0) {
- addr = *stack++;
- if (__kernel_text_address(addr)) {
-- i += printk_address(addr);
-- i += printk(" ");
-- if (i > 50) {
-- printk("\n ");
-- i = 0;
-- }
-+ printk_address(addr);
- }
- }
- printk("\n");
-@@ -240,12 +225,14 @@ void show_stack(struct task_struct *tsk,
- break;
- }
- if (i && ((i % 4) == 0))
-- printk("\n ");
-- printk("%016lx ", *stack++);
-+ printk("\n");
-+ printk(" %016lx", *stack++);
- }
- show_trace((unsigned long *)rsp);
- }
-
-+EXPORT_SYMBOL(show_stack);
-+
- /*
- * The architecture-independent dump_stack generator
- */
-@@ -267,10 +254,13 @@ void show_registers(struct pt_regs *regs
-
- rsp = regs->rsp;
-
-- printk("CPU %d ", cpu);
-+ printk("CPU: %d, VCPU: %d:%d ", cpu, task_vsched_id(current),
-+ task_cpu(current));
- __show_regs(regs);
-- printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
-- cur->comm, cur->pid, cur->thread_info, cur);
-+ printk("Process %s (pid: %d, veid=%d, threadinfo %p, task %p)\n",
-+ cur->comm, cur->pid,
-+ VEID(VE_TASK_INFO(current)->owner_env),
-+ cur->thread_info, cur);
-
- /*
- * When in-kernel, we also print out the stack and code at the
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/vmlinux.lds.S linux-2.6.9-ve023stab030/arch/x86_64/kernel/vmlinux.lds.S
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/vmlinux.lds.S 2004-10-19 01:53:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/vmlinux.lds.S 2006-10-11 19:07:55.000000000 +0400
-@@ -45,32 +45,31 @@ SECTIONS
- }
- __bss_end = .;
-
-- . = ALIGN(64);
-+ . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
- .data.cacheline_aligned : { *(.data.cacheline_aligned) }
-
-+#define AFTER(x) BINALIGN(LOADADDR(x) + SIZEOF(x), 16)
-+#define BINALIGN(x,y) (((x) + (y) - 1) & ~((y) - 1))
-+#define CACHE_ALIGN(x) BINALIGN(x, CONFIG_X86_L1_CACHE_BYTES)
-+
- .vsyscall_0 -10*1024*1024: AT ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095)) { *(.vsyscall_0) }
- __vsyscall_0 = LOADADDR(.vsyscall_0);
-- . = ALIGN(64);
-- .xtime_lock : AT ((LOADADDR(.vsyscall_0) + SIZEOF(.vsyscall_0) + 63) & ~(63)) { *(.xtime_lock) }
-+ . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
-+ .xtime_lock : AT CACHE_ALIGN(AFTER(.vsyscall_0)) { *(.xtime_lock) }
- xtime_lock = LOADADDR(.xtime_lock);
-- . = ALIGN(16);
-- .vxtime : AT ((LOADADDR(.xtime_lock) + SIZEOF(.xtime_lock) + 15) & ~(15)) { *(.vxtime) }
-+ .vxtime : AT AFTER(.xtime_lock) { *(.vxtime) }
- vxtime = LOADADDR(.vxtime);
-- . = ALIGN(16);
-- .wall_jiffies : AT ((LOADADDR(.vxtime) + SIZEOF(.vxtime) + 15) & ~(15)) { *(.wall_jiffies) }
-+ .wall_jiffies : AT AFTER(.vxtime) { *(.wall_jiffies) }
- wall_jiffies = LOADADDR(.wall_jiffies);
-- . = ALIGN(16);
-- .sys_tz : AT ((LOADADDR(.wall_jiffies) + SIZEOF(.wall_jiffies) + 15) & ~(15)) { *(.sys_tz) }
-+ .sys_tz : AT AFTER(.wall_jiffies) { *(.sys_tz) }
- sys_tz = LOADADDR(.sys_tz);
-- . = ALIGN(16);
-- .sysctl_vsyscall : AT ((LOADADDR(.sys_tz) + SIZEOF(.sys_tz) + 15) & ~(15)) { *(.sysctl_vsyscall) }
-- sysctl_vsyscall = LOADADDR(.sysctl_vsyscall);
-- . = ALIGN(16);
-- .jiffies : AT ((LOADADDR(.sysctl_vsyscall) + SIZEOF(.sysctl_vsyscall) + 15) & ~(15)) { *(.jiffies) }
-- jiffies = LOADADDR(.jiffies);
-- . = ALIGN(16);
-- .xtime : AT ((LOADADDR(.jiffies) + SIZEOF(.jiffies) + 15) & ~(15)) { *(.xtime) }
-+ .sysctl_vsyscall : AT AFTER(.sys_tz) { *(.sysctl_vsyscall) }
-+ sysctl_vsyscall = LOADADDR(.sysctl_vsyscall);
-+ .xtime : AT AFTER(.sysctl_vsyscall) { *(.xtime) }
- xtime = LOADADDR(.xtime);
-+ . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
-+ .jiffies : AT CACHE_ALIGN(AFTER(.xtime)) { *(.jiffies) }
-+ jiffies = LOADADDR(.jiffies);
- .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) }
- . = LOADADDR(.vsyscall_0) + 4096;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/vsyscall.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/vsyscall.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/vsyscall.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/vsyscall.c 2006-10-11 19:07:55.000000000 +0400
-@@ -165,14 +165,12 @@ static void __init map_vsyscall(void)
-
- static int __init vsyscall_init(void)
- {
-- if ((unsigned long) &vgettimeofday != VSYSCALL_ADDR(__NR_vgettimeofday))
-- panic("vgettimeofday link addr broken");
-- if ((unsigned long) &vtime != VSYSCALL_ADDR(__NR_vtime))
-- panic("vtime link addr broken");
-- if (VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE))
-- panic("fixmap first vsyscall %lx should be %lx", __fix_to_virt(VSYSCALL_FIRST_PAGE),
-- VSYSCALL_ADDR(0));
-+ BUG_ON(((unsigned long) &vgettimeofday !=
-+ VSYSCALL_ADDR(__NR_vgettimeofday)));
-+ BUG_ON((unsigned long) &vtime != VSYSCALL_ADDR(__NR_vtime));
-+ BUG_ON((VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE)));
- map_vsyscall();
-+ sysctl_vsyscall = 1;
-
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/x8664_ksyms.c linux-2.6.9-ve023stab030/arch/x86_64/kernel/x8664_ksyms.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/kernel/x8664_ksyms.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/kernel/x8664_ksyms.c 2006-10-11 19:07:59.000000000 +0400
-@@ -36,6 +36,8 @@
-
- extern spinlock_t rtc_lock;
-
-+EXPORT_SYMBOL(cpu_gdt_table);
-+
- #ifdef CONFIG_SMP
- extern void __write_lock_failed(rwlock_t *rw);
- extern void __read_lock_failed(rwlock_t *rw);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/mm/fault.c linux-2.6.9-ve023stab030/arch/x86_64/mm/fault.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/mm/fault.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/mm/fault.c 2006-10-11 19:08:02.000000000 +0400
-@@ -34,27 +34,6 @@
- #include <asm/kdebug.h>
- #include <asm-generic/sections.h>
-
--void bust_spinlocks(int yes)
--{
-- int loglevel_save = console_loglevel;
-- if (yes) {
-- oops_in_progress = 1;
-- } else {
--#ifdef CONFIG_VT
-- unblank_screen();
--#endif
-- oops_in_progress = 0;
-- /*
-- * OK, the message is on the console. Now we call printk()
-- * without oops_in_progress set so that printk will give klogd
-- * a poke. Hold onto your hats...
-- */
-- console_loglevel = 15; /* NMI oopser may have shut the console up */
-- printk(" ");
-- console_loglevel = loglevel_save;
-- }
--}
--
- /* Sometimes the CPU reports invalid exceptions on prefetch.
- Check that here and ignore.
- Opcode checker based on code by Richard Brunner */
-@@ -232,7 +211,7 @@ static noinline void pgtable_bad(unsigne
- }
-
- int page_fault_trace;
--int exception_trace = 1;
-+int exception_trace = 0;
-
- /*
- * This routine handles page faults. It determines the address,
-@@ -277,7 +256,7 @@ asmlinkage void do_page_fault(struct pt_
- local_irq_enable();
-
- if (unlikely(page_fault_trace))
-- printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n",
-+ ve_printk(VE_LOG, "pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n",
- regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code);
-
- tsk = current;
-@@ -320,7 +299,6 @@ asmlinkage void do_page_fault(struct pt_
- if (unlikely(in_atomic() || !mm))
- goto bad_area_nosemaphore;
-
-- again:
- /* When running in the kernel we expect faults to occur only to
- * addresses in user space. All other faults represent errors in the
- * kernel and should generate an OOPS. Unfortunatly, in the case of an
-@@ -408,17 +386,6 @@ bad_area:
- up_read(&mm->mmap_sem);
-
- bad_area_nosemaphore:
--
--#ifdef CONFIG_IA32_EMULATION
-- /* 32bit vsyscall. map on demand. */
-- if (test_thread_flag(TIF_IA32) && ((error_code & 0x1) == 0) &&
-- address >= VSYSCALL32_BASE && address < VSYSCALL32_END) {
-- if (map_syscall32(mm, address) < 0)
-- goto out_of_memory2;
-- return;
-- }
--#endif
--
- /* User mode accesses just cause a SIGSEGV */
- if (error_code & 4) {
- if (is_prefetch(regs, address, error_code))
-@@ -435,7 +402,7 @@ bad_area_nosemaphore:
- return;
-
- if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
-- printk(KERN_INFO
-+ ve_printk(VE_LOG, KERN_INFO
- "%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
- tsk->comm, tsk->pid, address, regs->rip,
- regs->rsp, error_code);
-@@ -485,7 +452,6 @@ no_context:
- printk(KERN_ALERT "Unable to handle kernel paging request");
- printk(" at %016lx RIP: \n" KERN_ALERT,address);
- printk_address(regs->rip);
-- printk("\n");
- dump_pagetable(address);
- __die("Oops", regs, error_code);
- /* Executive summary in case the body of the oops scrolled away */
-@@ -500,14 +466,14 @@ no_context:
- */
- out_of_memory:
- up_read(&mm->mmap_sem);
--out_of_memory2:
-- if (current->pid == 1) {
-- yield();
-- goto again;
-- }
-- printk("VM: killing process %s\n", tsk->comm);
-- if (error_code & 4)
-- do_exit(SIGKILL);
-+ if (error_code & 4) {
-+ /*
-+ * 0-order allocation always success if something really
-+ * fatal not happen: beancounter overdraft or OOM. Den
-+ */
-+ force_sig(SIGKILL, tsk);
-+ return;
-+ }
- goto no_context;
-
- do_sigbus:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/arch/x86_64/mm/init.c linux-2.6.9-ve023stab030/arch/x86_64/mm/init.c
---- linux-2.6.9-42.0.3.EL.orig/arch/x86_64/mm/init.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/arch/x86_64/mm/init.c 2006-10-11 19:07:55.000000000 +0400
-@@ -644,9 +644,9 @@ static __init int x8664_sysctl_init(void
- __initcall(x8664_sysctl_init);
- #endif
-
--/* Pseudo VMAs to allow ptrace access for the vsyscall pages. x86-64 has two
-- different ones: one for 32bit and one for 64bit. Use the appropiate
-- for the target task. */
-+/* A pseudo VMAs to allow ptrace access for the vsyscall page. This only
-+ covers the 64bit vsyscall page now. 32bit has a real VMA now and does
-+ not need special handling anymore. */
-
- static struct vm_area_struct gate_vma = {
- .vm_start = VSYSCALL_START,
-@@ -654,29 +654,16 @@ static struct vm_area_struct gate_vma =
- .vm_page_prot = PAGE_READONLY
- };
-
--static struct vm_area_struct gate32_vma = {
-- .vm_start = VSYSCALL32_BASE,
-- .vm_end = VSYSCALL32_END,
-- .vm_page_prot = PAGE_READONLY
--};
--
- struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
- {
--#ifdef CONFIG_IA32_EMULATION
-- if (test_tsk_thread_flag(tsk, TIF_IA32)) {
-- /* lookup code assumes the pages are present. set them up
-- now */
-- if (__map_syscall32(tsk->mm, VSYSCALL32_BASE) < 0)
-- return NULL;
-- return &gate32_vma;
-- }
--#endif
-- return &gate_vma;
-+ return test_tsk_thread_flag(tsk, TIF_IA32) ? NULL : &gate_vma;
- }
-
- int in_gate_area(struct task_struct *task, unsigned long addr)
- {
- struct vm_area_struct *vma = get_gate_vma(task);
-+ if (!vma)
-+ return 0;
- return (addr >= vma->vm_start) && (addr < vma->vm_end);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/base/class.c linux-2.6.9-ve023stab030/drivers/base/class.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/base/class.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/base/class.c 2006-10-11 19:07:57.000000000 +0400
-@@ -70,8 +70,13 @@ static struct kobj_type ktype_class = {
- };
-
- /* Hotplug events for classes go to the class_obj subsys */
--static decl_subsys(class, &ktype_class, NULL);
-+decl_subsys(class, &ktype_class, NULL);
-
-+#ifndef CONFIG_VE
-+#define visible_class_subsys class_subsys
-+#else
-+#define visible_class_subsys (*get_exec_env()->class_subsys)
-+#endif
-
- int class_create_file(struct class * cls, const struct class_attribute * attr)
- {
-@@ -144,7 +149,7 @@ int class_register(struct class * cls)
- if (error)
- return error;
-
-- subsys_set_kset(cls, class_subsys);
-+ subsys_set_kset(cls, visible_class_subsys);
-
- error = subsystem_register(&cls->subsys);
- if (!error) {
-@@ -305,8 +310,13 @@ static struct kset_hotplug_ops class_hot
- .hotplug = class_hotplug,
- };
-
--static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops);
-+decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops);
-
-+#ifndef CONFIG_VE
-+#define visible_class_obj_subsys class_obj_subsys
-+#else
-+#define visible_class_obj_subsys (*get_exec_env()->class_obj_subsys)
-+#endif
-
- static int class_device_add_attrs(struct class_device * cd)
- {
-@@ -343,7 +353,7 @@ static void class_device_remove_attrs(st
-
- void class_device_initialize(struct class_device *class_dev)
- {
-- kobj_set_kset_s(class_dev, class_obj_subsys);
-+ kobj_set_kset_s(class_dev, visible_class_obj_subsys);
- kobject_init(&class_dev->kobj);
- INIT_LIST_HEAD(&class_dev->node);
- }
-@@ -641,10 +651,19 @@ error:
- return ERR_PTR(retval);
- }
-
-+void prepare_sysfs_classes(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->class_subsys = &class_subsys;
-+ get_ve0()->class_obj_subsys = &class_obj_subsys;
-+#endif
-+}
-+
- int __init classes_init(void)
- {
- int retval;
-
-+ prepare_sysfs_classes();
- retval = subsystem_register(&class_subsys);
- if (retval)
- return retval;
-@@ -679,3 +698,6 @@ EXPORT_SYMBOL_GPL(class_device_remove_fi
-
- EXPORT_SYMBOL_GPL(class_interface_register);
- EXPORT_SYMBOL_GPL(class_interface_unregister);
-+
-+EXPORT_SYMBOL(class_subsys);
-+EXPORT_SYMBOL(class_obj_subsys);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/base/class_simple.c linux-2.6.9-ve023stab030/drivers/base/class_simple.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/base/class_simple.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/base/class_simple.c 2006-10-11 19:07:57.000000000 +0400
-@@ -26,7 +26,11 @@ struct simple_dev {
- };
- #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
-
-+#ifdef CONFIG_VE
-+#define simple_dev_list (get_exec_env()->_simple_dev_list)
-+#else
- static LIST_HEAD(simple_dev_list);
-+#endif
- static spinlock_t simple_dev_list_lock = SPIN_LOCK_UNLOCKED;
-
- static void release_simple_dev(struct class_device *class_dev)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/block/floppy.c linux-2.6.9-ve023stab030/drivers/block/floppy.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/block/floppy.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/block/floppy.c 2006-10-11 19:07:55.000000000 +0400
-@@ -3774,7 +3774,7 @@ static int floppy_open(struct inode *ino
- * Needed so that programs such as fdrawcmd still can work on write
- * protected disks */
- if (filp->f_mode & 2
-- || permission(filp->f_dentry->d_inode, 2, NULL) == 0)
-+ || permission(filp->f_dentry->d_inode, 2, NULL, NULL) == 0)
- filp->private_data = (void *)8;
-
- if (UFDCS->rawcmd == 1)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/block/genhd.c linux-2.6.9-ve023stab030/drivers/block/genhd.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/block/genhd.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/block/genhd.c 2006-10-11 19:07:57.000000000 +0400
-@@ -16,6 +16,8 @@
- #include <linux/kobj_map.h>
-
- static struct subsystem block_subsys;
-+struct subsystem *get_block_subsys(void) {return &block_subsys;}
-+EXPORT_SYMBOL(get_block_subsys);
-
- /*
- * Can be deleted altogether. Later.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/block/ll_rw_blk.c linux-2.6.9-ve023stab030/drivers/block/ll_rw_blk.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/block/ll_rw_blk.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/block/ll_rw_blk.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2328,7 +2328,7 @@ EXPORT_SYMBOL(__blk_attempt_remerge);
- static int __make_request(request_queue_t *q, struct bio *bio)
- {
- struct request *req, *freereq = NULL;
-- int el_ret, rw, nr_sectors, cur_nr_sectors, barrier, err;
-+ int el_ret, rw, nr_sectors, cur_nr_sectors, barrier, err, sync;
- sector_t sector;
-
- sector = bio->bi_sector;
-@@ -2376,6 +2376,7 @@ again:
- drive_stat_acct(req, nr_sectors, 0);
- if (!attempt_back_merge(q, req))
- elv_merged_request(q, req);
-+ sync = bio_sync(bio);
- goto out;
-
- case ELEVATOR_FRONT_MERGE:
-@@ -2402,6 +2403,7 @@ again:
- drive_stat_acct(req, nr_sectors, 0);
- if (!attempt_front_merge(q, req))
- elv_merged_request(q, req);
-+ sync = bio_sync(bio);
- goto out;
-
- /*
-@@ -2467,11 +2469,12 @@ get_rq:
- req->rq_disk = bio->bi_bdev->bd_disk;
- req->start_time = jiffies;
-
-+ sync = bio_sync(bio);
- add_request(q, req);
- out:
- if (freereq)
- __blk_put_request(q, freereq);
-- if (bio_sync(bio))
-+ if (sync)
- __generic_unplug_device(q);
-
- spin_unlock_irq(q->queue_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/keyboard.c linux-2.6.9-ve023stab030/drivers/char/keyboard.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/keyboard.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/keyboard.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1076,7 +1076,7 @@ void kbd_keycode(unsigned int keycode, i
- sysrq_down = down;
- return;
- }
-- if (sysrq_down && down && !rep) {
-+ if ((sysrq_down || sysrq_eat_all()) && down && !rep) {
- handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty);
- return;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/mem.c linux-2.6.9-ve023stab030/drivers/char/mem.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/mem.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/mem.c 2006-10-11 19:07:56.000000000 +0400
-@@ -246,8 +246,6 @@ static ssize_t read_kmem(struct file *fi
- ssize_t virtr = 0;
- char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
-
-- return -EPERM;
--
- if (p < (unsigned long) high_memory) {
- read = count;
- if (count > (unsigned long) high_memory - p)
-@@ -655,6 +653,7 @@ static const struct {
- struct file_operations *fops;
- } devlist[] = { /* list of minor devices */
- {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
-+ {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
- {3, "null", S_IRUGO | S_IWUGO, &null_fops},
- #if defined(CONFIG_ISA) || !defined(__mc68000__)
- {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/n_tty.c linux-2.6.9-ve023stab030/drivers/char/n_tty.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/n_tty.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/n_tty.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1151,7 +1151,7 @@ static inline int copy_from_read_buf(str
-
- {
- int retval;
-- ssize_t n;
-+ size_t n;
- unsigned long flags;
-
- retval = 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/pty.c linux-2.6.9-ve023stab030/drivers/char/pty.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/pty.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/pty.c 2006-10-11 19:07:57.000000000 +0400
-@@ -32,16 +32,36 @@
- #include <asm/bitops.h>
- #include <linux/devpts_fs.h>
-
-+#include <ub/ub_misc.h>
-+
- /* These are global because they are accessed in tty_io.c */
- #ifdef CONFIG_UNIX98_PTYS
- struct tty_driver *ptm_driver;
- struct tty_driver *pts_driver;
-+EXPORT_SYMBOL(ptm_driver);
-+EXPORT_SYMBOL(pts_driver);
-+
-+#ifdef CONFIG_VE
-+#define ve_ptm_driver (get_exec_env()->ptm_driver)
-+#else
-+#define ve_ptm_driver ptm_driver
-+#endif
-+
-+void prepare_pty(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->ptm_driver = ptm_driver;
-+ /* don't clean ptm_driver and co. here, they are used in vecalls.c */
-+#endif
-+}
- #endif
-
- static void pty_close(struct tty_struct * tty, struct file * filp)
- {
- if (!tty)
- return;
-+
-+ ub_pty_uncharge(tty);
- if (tty->driver->subtype == PTY_TYPE_MASTER) {
- if (tty->count > 1)
- printk("master pty_close: count = %d!!\n", tty->count);
-@@ -61,8 +81,12 @@ static void pty_close(struct tty_struct
- if (tty->driver->subtype == PTY_TYPE_MASTER) {
- set_bit(TTY_OTHER_CLOSED, &tty->flags);
- #ifdef CONFIG_UNIX98_PTYS
-- if (tty->driver == ptm_driver)
-+ if (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) {
-+ struct ve_struct *old_env;
-+ old_env = set_exec_env(VE_OWNER_TTY(tty));
- devpts_pty_kill(tty->index);
-+ set_exec_env(old_env);
-+ }
- #endif
- tty_vhangup(tty->link);
- }
-@@ -235,6 +259,8 @@ static int pty_open(struct tty_struct *t
-
- if (!tty || !tty->link)
- goto out;
-+ if (ub_pty_charge(tty))
-+ goto out;
-
- retval = -EIO;
- if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
-@@ -273,6 +299,12 @@ static struct tty_operations pty_ops = {
- #ifdef CONFIG_LEGACY_PTYS
- static struct tty_driver *pty_driver, *pty_slave_driver;
-
-+struct tty_driver *get_pty_driver(void) {return pty_driver;}
-+struct tty_driver *get_pty_slave_driver(void) {return pty_slave_driver;}
-+
-+EXPORT_SYMBOL(get_pty_driver);
-+EXPORT_SYMBOL(get_pty_slave_driver);
-+
- static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file,
- unsigned int cmd, unsigned long arg)
- {
-@@ -438,6 +470,7 @@ static int __init pty_init(void)
- {
- legacy_pty_init();
- unix98_pty_init();
-+ prepare_pty();
- return 0;
- }
- module_init(pty_init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/sysrq.c linux-2.6.9-ve023stab030/drivers/char/sysrq.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/sysrq.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/sysrq.c 2006-10-11 19:08:02.000000000 +0400
-@@ -31,10 +31,14 @@
- #include <linux/suspend.h>
- #include <linux/writeback.h>
- #include <linux/buffer_head.h> /* for fsync_bdev() */
-+#include <linux/kallsyms.h>
-+#include <linux/slab.h>
-+#include <linux/stop_machine.h>
-
- #include <linux/spinlock.h>
-
- #include <asm/ptrace.h>
-+#include <asm/uaccess.h>
-
- extern void reset_vc(unsigned int);
-
-@@ -144,16 +148,386 @@ static struct sysrq_key_op sysrq_mountro
- .action_msg = "Emergency Remount R/O",
- };
-
-+#ifdef CONFIG_SYSRQ_DEBUG
-+/*
-+ * Alt-SysRq debugger
-+ * Implemented functions:
-+ * dumping memory
-+ * resolvind symbols
-+ * writing memory
-+ * quitting :)
-+ */
-+
-+/* Memory accessing routines */
-+#define DUMP_LINES 22
-+unsigned long *dumpmem_addr;
-+
-+static void dump_mem(void)
-+{
-+ unsigned long value[4];
-+ mm_segment_t old_fs;
-+ int line, err;
-+
-+ old_fs = get_fs();
-+ set_fs(KERNEL_DS);
-+ err = 0;
-+ for (line = 0; line < DUMP_LINES; line++) {
-+ err |= __get_user(value[0], dumpmem_addr++);
-+ err |= __get_user(value[1], dumpmem_addr++);
-+ err |= __get_user(value[2], dumpmem_addr++);
-+ err |= __get_user(value[3], dumpmem_addr++);
-+ if (err) {
-+ printk("Invalid address 0x%p\n", dumpmem_addr - 4);
-+ break;
-+ }
-+ printk("0x%p: %08lx %08lx %08lx %08lx\n", dumpmem_addr - 4,
-+ value[0], value[1], value[2], value[3]);
-+ }
-+ set_fs(old_fs);
-+}
-+
-+static unsigned long *writemem_addr;
-+
-+static void write_mem(unsigned long val)
-+{
-+ mm_segment_t old_fs;
-+ unsigned long old_val;
-+
-+ old_fs = get_fs();
-+ set_fs(KERNEL_DS);
-+ if (__get_user(old_val, writemem_addr))
-+ goto err;
-+ printk("Changing [0x%p] %08lX to %08lX\n", writemem_addr, old_val, val);
-+ __put_user(val, writemem_addr);
-+err:
-+ set_fs(old_fs);
-+}
-+
-+/* reading user input */
-+#define NAME_LEN (64)
-+static struct {
-+ unsigned long hex;
-+ char name[NAME_LEN + 1];
-+ void (*entered)(void);
-+} debug_input;
-+
-+static void debug_read_hex(int key)
-+{
-+ static int entered = 0;
-+ int val;
-+
-+ if (key >= '0' && key <= '9')
-+ val = key - '0';
-+ else if (key >= 'a' && key <= 'f')
-+ val = key - 'a' + 0xa;
-+ else
-+ return;
-+
-+ entered++;
-+ debug_input.hex = (debug_input.hex << 4) + val;
-+ printk("%c", key);
-+ if (entered != sizeof(unsigned long) * 2)
-+ return;
-+
-+ printk("\n");
-+ entered = 0;
-+ debug_input.entered();
-+}
-+
-+static void debug_read_string(int key)
-+{
-+ static int pos;
-+ static int shift;
-+
-+ if (key == 0) {
-+ /* actually key == 0 not only for shift */
-+ shift = 1;
-+ return;
-+ }
-+
-+ if (key == 0x0d) /* enter */
-+ goto finish;
-+
-+ if (key >= 'a' && key <= 'z') {
-+ if (shift)
-+ key = key - 'a' + 'A';
-+ goto correct;
-+ }
-+ if (key == '-') {
-+ if (shift)
-+ key = '_';
-+ goto correct;
-+ }
-+ if (key >= '0' && key <= '9')
-+ goto correct;
-+ return;
-+
-+correct:
-+ debug_input.name[pos] = key;
-+ pos++;
-+ shift = 0;
-+ printk("%c", key);
-+ if (pos != NAME_LEN)
-+ return;
-+
-+finish:
-+ printk("\n");
-+ pos = 0;
-+ shift = 0;
-+ debug_input.entered();
-+ memset(debug_input.name, 0, NAME_LEN);
-+}
-+
-+static int sysrq_debug_mode;
-+#define DEBUG_SELECT_ACTION 1
-+#define DEBUG_READ_INPUT 2
-+static struct sysrq_key_op *debug_sysrq_key_table[];
-+static void (*handle_debug_input)(int key);
-+static void swap_opts(struct sysrq_key_op **);
-+#define PROMPT "> "
-+
-+int sysrq_eat_all(void)
-+{
-+ return sysrq_debug_mode;
-+}
-+
-+static inline void debug_switch_read_input(void (*fn_read)(int),
-+ void (*fn_fini)(void))
-+{
-+ WARN_ON(fn_read == NULL || fn_fini == NULL);
-+ debug_input.entered = fn_fini;
-+ handle_debug_input = fn_read;
-+ sysrq_debug_mode = DEBUG_READ_INPUT;
-+}
-+
-+static inline void debug_switch_select_action(void)
-+{
-+ sysrq_debug_mode = DEBUG_SELECT_ACTION;
-+ handle_debug_input = NULL;
-+ printk(PROMPT);
-+}
-+
-+/* handle key press in debug mode */
-+static void __handle_debug(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ if (sysrq_debug_mode == DEBUG_SELECT_ACTION) {
-+ __handle_sysrq(key, pt_regs, tty);
-+ if (sysrq_debug_mode)
-+ printk(PROMPT);
-+ } else {
-+ __sysrq_lock_table();
-+ handle_debug_input(key);
-+ __sysrq_unlock_table();
-+ }
-+}
-+
-+/* dump memory */
-+static void debug_dumpmem_addr_entered(void)
-+{
-+ dumpmem_addr = (unsigned long *)debug_input.hex;
-+ dump_mem();
-+ debug_switch_select_action();
-+}
-+
-+static void sysrq_handle_dumpmem(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ debug_switch_read_input(debug_read_hex, debug_dumpmem_addr_entered);
-+}
-+static struct sysrq_key_op sysrq_debug_dumpmem = {
-+ .handler = sysrq_handle_dumpmem,
-+ .help_msg = "Dump memory\n",
-+ .action_msg = "Enter address",
-+};
-+
-+static void sysrq_handle_dumpnext(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ dump_mem();
-+}
-+static struct sysrq_key_op sysrq_debug_dumpnext = {
-+ .handler = sysrq_handle_dumpnext,
-+ .help_msg = "dump neXt\n",
-+ .action_msg = "",
-+};
-+
-+/* resolve symbol */
-+static void debug_resolve_name_entered(void)
-+{
-+ unsigned long sym_addr;
-+
-+ sym_addr = kallsyms_lookup_name(debug_input.name);
-+ printk("%s: %08lX\n", debug_input.name, sym_addr);
-+ if (sym_addr) {
-+ printk("Now you can dump it via X\n");
-+ dumpmem_addr = (unsigned long *)sym_addr;
-+ }
-+ debug_switch_select_action();
-+}
-+
-+static void sysrq_handle_resolve(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ debug_switch_read_input(debug_read_string, debug_resolve_name_entered);
-+}
-+static struct sysrq_key_op sysrq_debug_resove = {
-+ .handler = sysrq_handle_resolve,
-+ .help_msg = "Resolve symbol\n",
-+ .action_msg = "Enter symbol name",
-+};
-+
-+/* write memory */
-+static void debug_writemem_val_entered(void)
-+{
-+ write_mem(debug_input.hex);
-+ debug_switch_select_action();
-+}
-+
-+static void debug_writemem_addr_entered(void)
-+{
-+ mm_segment_t old_fs;
-+ unsigned long val;
-+
-+ writemem_addr = (unsigned long *)debug_input.hex;
-+ old_fs = get_fs();
-+ set_fs(KERNEL_DS);
-+ if (!__get_user(val, writemem_addr))
-+ printk(" [0x%p] = %08lX\n", writemem_addr, val);
-+ set_fs(old_fs);
-+ debug_switch_read_input(debug_read_hex, debug_writemem_val_entered);
-+}
-+
-+static void sysrq_handle_writemem(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ debug_switch_read_input(debug_read_hex, debug_writemem_addr_entered);
-+}
-+static struct sysrq_key_op sysrq_debug_writemem = {
-+ .handler = sysrq_handle_writemem,
-+ .help_msg = "Write memory\n",
-+ .action_msg = "Enter address and then value",
-+};
-+
-+/* switch to debug mode */
-+static void sysrq_handle_debug(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ swap_opts(debug_sysrq_key_table);
-+ printk("Welcome sysrq debugging mode\n"
-+ "Press H for help\n");
-+ debug_switch_select_action();
-+}
-+static struct sysrq_key_op sysrq_debug_enter = {
-+ .handler = sysrq_handle_debug,
-+ .help_msg = "start Degugging",
-+ .action_msg = "Select desired action",
-+};
-+
-+/* quit debug mode */
-+static void sysrq_handle_quit(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ swap_opts(NULL);
-+ sysrq_debug_mode = 0;
-+}
-+static struct sysrq_key_op sysrq_debug_quit = {
-+ .handler = sysrq_handle_quit,
-+ .help_msg = "Quit debug mode\n",
-+ .action_msg = "Thank you for using debugger",
-+};
-+#endif
-+
- /* END SYNC SYSRQ HANDLERS BLOCK */
-
-
- /* SHOW SYSRQ HANDLERS BLOCK */
-
-+static void show_regs_noregs(void)
-+{
-+ struct task_struct *p;
-+
-+ p = current;
-+ printk("\n");
-+ printk("Pid: %d, comm: %.20s, CPU: %d, VCPU: %d:%d\n",
-+ p->pid, p->comm,
-+ smp_processor_id(), task_vsched_id(p), task_cpu(p));
-+ dump_stack();
-+}
-+
-+#ifdef CONFIG_SMP
-+
-+static spinlock_t show_regs_lock = SPIN_LOCK_UNLOCKED;
-+static spinlock_t show_regs_ser = SPIN_LOCK_UNLOCKED;
-+struct show_regs_state {
-+ struct timer_list timer;
-+};
-+static DEFINE_PER_CPU(struct show_regs_state, show_regs_state);
-+
-+static void show_regs_other(unsigned long cpu)
-+{
-+ if (!spin_trylock(&show_regs_ser)) {
-+ mod_timer(&per_cpu(show_regs_state, cpu).timer, jiffies + 1);
-+ return;
-+ }
-+
-+ if (cpu == smp_processor_id()) /* CPU might be dead */
-+ show_regs_noregs();
-+ spin_unlock(&show_regs_ser);
-+}
-+
-+static void schedule_show_regs(void)
-+{
-+ int cpu, i;
-+ struct timer_list *t;
-+ unsigned long flags;
-+
-+ cpu = smp_processor_id();
-+ spin_lock_irqsave(&show_regs_lock, flags);
-+ for_each_online_cpu(i) {
-+ if (i == cpu)
-+ continue;
-+ t = &per_cpu(show_regs_state, i).timer;
-+ if (timer_pending(t))
-+ continue;
-+ /* this may race with timer function, but we don't care */
-+ t->expires = jiffies;
-+ add_timer_on(t, i);
-+ }
-+ spin_unlock_irqrestore(&show_regs_lock, flags);
-+}
-+
-+static int show_regs_init(void)
-+{
-+ int i;
-+ struct timer_list *t;
-+
-+ for_each_cpu(i) {
-+ t = &per_cpu(show_regs_state, i).timer;
-+ init_timer(t);
-+ t->function = &show_regs_other;
-+ t->data = i;
-+ }
-+ return 0;
-+}
-+
-+postcore_initcall(show_regs_init);
-+
-+#endif
-+
- static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs,
- struct tty_struct *tty)
- {
-+ preempt_disable();
- if (pt_regs)
- show_regs(pt_regs);
-+ else
-+ show_regs_noregs();
-+#ifdef CONFIG_SMP
-+ if (num_online_cpus() > 1)
-+ schedule_show_regs();
-+#endif
-+ preempt_enable();
- }
- static struct sysrq_key_op sysrq_showregs_op = {
- .handler = sysrq_handle_showregs,
-@@ -178,6 +552,7 @@ static void sysrq_handle_showmem(int key
- struct tty_struct *tty)
- {
- show_mem();
-+ show_slab_info();
- }
- static struct sysrq_key_op sysrq_showmem_op = {
- .handler = sysrq_handle_showmem,
-@@ -216,7 +591,7 @@ static void send_sig_all(int sig)
- {
- struct task_struct *p;
-
-- for_each_process(p) {
-+ for_each_process_all(p) {
- if (p->mm && p->pid != 1)
- /* Not swapper, init nor kernel thread */
- force_sig(sig, p);
-@@ -247,13 +622,40 @@ static struct sysrq_key_op sysrq_kill_op
- .action_msg = "Kill All Tasks",
- };
-
-+#ifdef CONFIG_SCHED_VCPU
-+static void sysrq_handle_vschedstate(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ show_vsched();
-+}
-+static struct sysrq_key_op sysrq_vschedstate_op = {
-+ .handler = sysrq_handle_vschedstate,
-+ .help_msg = "showvsched(A)",
-+ .action_msg = "show_vsched(A)",
-+};
-+#endif
-+
-+#ifdef CONFIG_STOP_MACHINE
-+static void sysrq_handle_stopmachine(int key, struct pt_regs *pt_regs,
-+ struct tty_struct *tty)
-+{
-+ stop_machine_show_state();
-+}
-+
-+static struct sysrq_key_op sysrq_stopmachine_op = {
-+ .handler = sysrq_handle_stopmachine,
-+ .help_msg = "smachiNe",
-+ .action_msg = "Show stop machine state",
-+};
-+#endif
-+
- /* END SIGNAL SYSRQ HANDLERS BLOCK */
-
-
- /* Key Operations table and lock */
- static spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED;
- #define SYSRQ_KEY_TABLE_LENGTH 36
--static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
-+static struct sysrq_key_op *def_sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
- /* 0 */ &sysrq_loglevel_op,
- /* 1 */ &sysrq_loglevel_op,
- /* 2 */ &sysrq_loglevel_op,
-@@ -264,12 +666,20 @@ static struct sysrq_key_op *sysrq_key_ta
- /* 7 */ &sysrq_loglevel_op,
- /* 8 */ &sysrq_loglevel_op,
- /* 9 */ &sysrq_loglevel_op,
-+#ifdef CONFIG_SCHED_VCPU
-+/* a */ &sysrq_vschedstate_op,
-+#else
- /* a */ NULL, /* Don't use for system provided sysrqs,
- it is handled specially on the sparc
- and will never arrive */
-+#endif
- /* b */ &sysrq_reboot_op,
- /* c */ &sysrq_crash_op,
-+#ifdef CONFIG_SYSRQ_DEBUG
-+/* d */ &sysrq_debug_enter,
-+#else
- /* d */ NULL,
-+#endif
- /* e */ &sysrq_term_op,
- /* f */ NULL,
- /* g */ NULL,
-@@ -283,7 +693,11 @@ static struct sysrq_key_op *sysrq_key_ta
- #endif
- /* l */ NULL,
- /* m */ &sysrq_showmem_op,
-+#ifdef CONFIG_STOP_MACHINE
-+/* n */ &sysrq_stopmachine_op,
-+#else
- /* n */ NULL,
-+#endif
- /* o */ NULL, /* This will often be registered
- as 'Off' at init time */
- /* p */ &sysrq_showregs_op,
-@@ -303,6 +717,29 @@ static struct sysrq_key_op *sysrq_key_ta
- /* z */ NULL
- };
-
-+#ifdef CONFIG_SYSRQ_DEBUG
-+static struct sysrq_key_op *debug_sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
-+ [13] = &sysrq_debug_dumpmem, /* d */
-+ [26] = &sysrq_debug_quit, /* q */
-+ [27] = &sysrq_debug_resove, /* r */
-+ [32] = &sysrq_debug_writemem, /* w */
-+ [33] = &sysrq_debug_dumpnext, /* x */
-+};
-+
-+static struct sysrq_key_op **sysrq_key_table = def_sysrq_key_table;
-+
-+/* call swap_opts(NULL) to restore opts to defaults */
-+static void swap_opts(struct sysrq_key_op **swap_to)
-+{
-+ if (swap_to)
-+ sysrq_key_table = swap_to;
-+ else
-+ sysrq_key_table = def_sysrq_key_table;
-+}
-+#else
-+#define sysrq_key_table def_sysrq_key_table
-+#endif
-+
- /* key2index calculation, -1 on invalid index */
- static int sysrq_key_table_key2index(int key) {
- int retval;
-@@ -391,6 +828,12 @@ void handle_sysrq(int key, struct pt_reg
- {
- if (!sysrq_enabled)
- return;
-+#ifdef CONFIG_SYSRQ_DEBUG
-+ if (sysrq_debug_mode) {
-+ __handle_debug(key, pt_regs, tty);
-+ return;
-+ }
-+#endif
- __handle_sysrq(key, pt_regs, tty);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/tty_io.c linux-2.6.9-ve023stab030/drivers/char/tty_io.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/tty_io.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/tty_io.c 2006-10-11 19:07:57.000000000 +0400
-@@ -86,6 +86,7 @@
- #include <linux/string.h>
- #include <linux/slab.h>
- #include <linux/poll.h>
-+#include <linux/ve_owner.h>
- #include <linux/proc_fs.h>
- #include <linux/init.h>
- #include <linux/module.h>
-@@ -104,6 +105,7 @@
- #include <linux/devfs_fs_kernel.h>
-
- #include <linux/kmod.h>
-+#include <ub/ub_mem.h>
-
- #undef TTY_DEBUG_HANGUP
-
-@@ -121,11 +123,16 @@ struct termios tty_std_termios = { /* fo
-
- EXPORT_SYMBOL(tty_std_termios);
-
-+/* this lock protects tty_drivers list, this pretty guys do no locking */
-+rwlock_t tty_driver_guard = RW_LOCK_UNLOCKED;
-+EXPORT_SYMBOL(tty_driver_guard);
-+
- /* This list gets poked at by procfs and various bits of boot up code. This
- could do with some rationalisation such as pulling the tty proc function
- into this file */
-
- LIST_HEAD(tty_drivers); /* linked list of tty drivers */
-+EXPORT_SYMBOL(tty_drivers);
-
- /* Semaphore to protect creating and releasing a tty. This is shared with
- vt.c for deeply disgusting hack reasons */
-@@ -135,6 +142,13 @@ DECLARE_MUTEX(tty_sem);
- extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */
- extern int pty_limit; /* Config limit on Unix98 ptys */
- static DEFINE_IDR(allocated_ptys);
-+#ifdef CONFIG_VE
-+#define ve_allocated_ptys (*(get_exec_env()->allocated_ptys))
-+#define ve_ptm_driver (get_exec_env()->ptm_driver)
-+#else
-+#define ve_allocated_ptys allocated_ptys
-+#define ve_ptm_driver ptm_driver
-+#endif
- static DECLARE_MUTEX(allocated_ptys_lock);
- #endif
-
-@@ -156,11 +170,25 @@ extern void rs_360_init(void);
- static void release_mem(struct tty_struct *tty, int idx);
-
-
-+DCL_VE_OWNER(TTYDRV, TAIL_SOFT, struct tty_driver, owner_env, , ())
-+DCL_VE_OWNER(TTY, TAIL_SOFT, struct tty_struct, owner_env, , ())
-+
-+void prepare_tty(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->allocated_ptys = &allocated_ptys;
-+ /*
-+ * in this case, tty_register_driver() setups
-+ * owner_env correctly right from the bootup
-+ */
-+#endif
-+}
-+
- static struct tty_struct *alloc_tty_struct(void)
- {
- struct tty_struct *tty;
-
-- tty = kmalloc(sizeof(struct tty_struct), GFP_KERNEL);
-+ tty = ub_kmalloc(sizeof(struct tty_struct), GFP_KERNEL);
- if (tty)
- memset(tty, 0, sizeof(struct tty_struct));
- return tty;
-@@ -586,14 +614,37 @@ struct tty_driver *get_tty_driver(dev_t
- {
- struct tty_driver *p;
-
-+ read_lock(&tty_driver_guard);
- list_for_each_entry(p, &tty_drivers, tty_drivers) {
- dev_t base = MKDEV(p->major, p->minor_start);
- if (device < base || device >= base + p->num)
- continue;
- *index = device - base;
-- return p;
-+#ifdef CONFIG_VE
-+ if (in_interrupt())
-+ goto found;
-+ if (p->major!=PTY_MASTER_MAJOR && p->major!=PTY_SLAVE_MAJOR
-+#ifdef CONFIG_UNIX98_PTYS
-+ && (p->major<UNIX98_PTY_MASTER_MAJOR ||
-+ p->major>UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT-1) &&
-+ (p->major<UNIX98_PTY_SLAVE_MAJOR ||
-+ p->major>UNIX98_PTY_SLAVE_MAJOR+UNIX98_PTY_MAJOR_COUNT-1)
-+#endif
-+ ) goto found;
-+ if (ve_is_super(VE_OWNER_TTYDRV(p)) &&
-+ ve_is_super(get_exec_env()))
-+ goto found;
-+ if (!ve_accessible_strict(VE_OWNER_TTYDRV(p), get_exec_env()))
-+ continue;
-+#endif
-+ goto found;
- }
-+ read_unlock(&tty_driver_guard);
- return NULL;
-+
-+found:
-+ read_unlock(&tty_driver_guard);
-+ return p;
- }
-
- /*
-@@ -821,7 +872,7 @@ void do_tty_hangup(void *data)
-
- read_lock(&tasklist_lock);
- if (tty->session > 0) {
-- do_each_task_pid(tty->session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(tty->session, PIDTYPE_SID, p) {
- if (p->signal->tty == tty)
- p->signal->tty = NULL;
- if (!p->signal->leader)
-@@ -830,7 +881,7 @@ void do_tty_hangup(void *data)
- send_group_sig_info(SIGCONT, SEND_SIG_PRIV, p);
- if (tty->pgrp > 0)
- p->signal->tty_old_pgrp = tty->pgrp;
-- } while_each_task_pid(tty->session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(tty->session, PIDTYPE_SID, p);
- }
- read_unlock(&tasklist_lock);
-
-@@ -947,9 +998,9 @@ void disassociate_ctty(int on_exit)
-
- /* Now clear signal->tty under the lock */
- read_lock(&tasklist_lock);
-- do_each_task_pid(current->signal->session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(current->signal->session, PIDTYPE_SID, p) {
- p->signal->tty = NULL;
-- } while_each_task_pid(current->signal->session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(current->signal->session, PIDTYPE_SID, p);
- read_unlock(&tasklist_lock);
- up(&tty_sem);
- unlock_kernel();
-@@ -1140,21 +1191,28 @@ static inline void tty_line_name(struct
- * really quite straightforward. The semaphore locking can probably be
- * relaxed for the (most common) case of reopening a tty.
- */
--static int init_dev(struct tty_driver *driver, int idx,
-- struct tty_struct **ret_tty)
-+static int init_dev(struct tty_driver *driver, int idx,
-+ struct tty_struct *i_tty, struct tty_struct **ret_tty)
- {
- struct tty_struct *tty, *o_tty;
- struct termios *tp, **tp_loc, *o_tp, **o_tp_loc;
- struct termios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc;
-+ struct ve_struct * owner;
- int retval=0;
-
-- /* check whether we're reopening an existing tty */
-- if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
-- tty = devpts_get_tty(idx);
-- if (tty && driver->subtype == PTY_TYPE_MASTER)
-- tty = tty->link;
-- } else {
-- tty = driver->ttys[idx];
-+ owner = VE_OWNER_TTYDRV(driver);
-+
-+ if (i_tty)
-+ tty = i_tty;
-+ else {
-+ /* check whether we're reopening an existing tty */
-+ if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
-+ tty = devpts_get_tty(idx);
-+ if (tty && driver->subtype == PTY_TYPE_MASTER)
-+ tty = tty->link;
-+ } else {
-+ tty = driver->ttys[idx];
-+ }
- }
- if (tty) goto fast_track;
-
-@@ -1182,6 +1240,7 @@ static int init_dev(struct tty_driver *d
- tty->driver = driver;
- tty->index = idx;
- tty_line_name(driver, idx, tty->name);
-+ SET_VE_OWNER_TTY(tty, owner);
-
- if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
- tp_loc = &tty->termios;
-@@ -1192,7 +1251,7 @@ static int init_dev(struct tty_driver *d
- }
-
- if (!*tp_loc) {
-- tp = (struct termios *) kmalloc(sizeof(struct termios),
-+ tp = (struct termios *) ub_kmalloc(sizeof(struct termios),
- GFP_KERNEL);
- if (!tp)
- goto free_mem_out;
-@@ -1200,7 +1259,7 @@ static int init_dev(struct tty_driver *d
- }
-
- if (!*ltp_loc) {
-- ltp = (struct termios *) kmalloc(sizeof(struct termios),
-+ ltp = (struct termios *) ub_kmalloc(sizeof(struct termios),
- GFP_KERNEL);
- if (!ltp)
- goto free_mem_out;
-@@ -1215,6 +1274,7 @@ static int init_dev(struct tty_driver *d
- o_tty->driver = driver->other;
- o_tty->index = idx;
- tty_line_name(driver->other, idx, o_tty->name);
-+ SET_VE_OWNER_TTY(o_tty, owner);
-
- if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
- o_tp_loc = &o_tty->termios;
-@@ -1226,7 +1286,7 @@ static int init_dev(struct tty_driver *d
-
- if (!*o_tp_loc) {
- o_tp = (struct termios *)
-- kmalloc(sizeof(struct termios), GFP_KERNEL);
-+ ub_kmalloc(sizeof(struct termios), GFP_KERNEL);
- if (!o_tp)
- goto free_mem_out;
- *o_tp = driver->other->init_termios;
-@@ -1234,7 +1294,7 @@ static int init_dev(struct tty_driver *d
-
- if (!*o_ltp_loc) {
- o_ltp = (struct termios *)
-- kmalloc(sizeof(struct termios), GFP_KERNEL);
-+ ub_kmalloc(sizeof(struct termios), GFP_KERNEL);
- if (!o_ltp)
- goto free_mem_out;
- memset(o_ltp, 0, sizeof(struct termios));
-@@ -1252,6 +1312,10 @@ static int init_dev(struct tty_driver *d
- *o_ltp_loc = o_ltp;
- o_tty->termios = *o_tp_loc;
- o_tty->termios_locked = *o_ltp_loc;
-+#ifdef CONFIG_VE
-+ if (driver->other->refcount == 0)
-+ (void)get_ve(owner);
-+#endif
- driver->other->refcount++;
- if (driver->subtype == PTY_TYPE_MASTER)
- o_tty->count++;
-@@ -1276,6 +1340,10 @@ static int init_dev(struct tty_driver *d
- *ltp_loc = ltp;
- tty->termios = *tp_loc;
- tty->termios_locked = *ltp_loc;
-+#ifdef CONFIG_VE
-+ if (driver->refcount == 0)
-+ (void)get_ve(owner);
-+#endif
- driver->refcount++;
- tty->count++;
-
-@@ -1389,6 +1457,10 @@ static void release_mem(struct tty_struc
- }
- o_tty->magic = 0;
- o_tty->driver->refcount--;
-+#ifdef CONFIG_VE
-+ if (o_tty->driver->refcount == 0)
-+ put_ve(VE_OWNER_TTY(o_tty));
-+#endif
- file_list_lock();
- list_del_init(&o_tty->tty_files);
- file_list_unlock();
-@@ -1411,6 +1483,10 @@ static void release_mem(struct tty_struc
-
- tty->magic = 0;
- tty->driver->refcount--;
-+#ifdef CONFIG_VE
-+ if (tty->driver->refcount == 0)
-+ put_ve(VE_OWNER_TTY(tty));
-+#endif
- file_list_lock();
- list_del_init(&tty->tty_files);
- file_list_unlock();
-@@ -1434,6 +1510,9 @@ static void release_dev(struct file * fi
- int idx;
- char buf[64];
- unsigned long flags;
-+#ifdef CONFIG_UNIX98_PTYS
-+ struct idr *idr_alloced;
-+#endif
-
- tty = (struct tty_struct *)filp->private_data;
- if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "release_dev"))
-@@ -1449,6 +1528,9 @@ static void release_dev(struct file * fi
- devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
- devpts_master = pty_master && devpts;
- o_tty = tty->link;
-+#ifdef CONFIG_UNIX98_PTYS
-+ idr_alloced = tty->owner_env->allocated_ptys;
-+#endif
-
- #ifdef TTY_PARANOIA_CHECK
- if (idx < 0 || idx >= tty->driver->num) {
-@@ -1618,13 +1700,13 @@ static void release_dev(struct file * fi
- struct task_struct *p;
-
- read_lock(&tasklist_lock);
-- do_each_task_pid(tty->session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(tty->session, PIDTYPE_SID, p) {
- p->signal->tty = NULL;
-- } while_each_task_pid(tty->session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(tty->session, PIDTYPE_SID, p);
- if (o_tty)
-- do_each_task_pid(o_tty->session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(o_tty->session, PIDTYPE_SID, p) {
- p->signal->tty = NULL;
-- } while_each_task_pid(o_tty->session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(o_tty->session, PIDTYPE_SID, p);
- read_unlock(&tasklist_lock);
- }
-
-@@ -1697,7 +1779,7 @@ static void release_dev(struct file * fi
- /* Make this pty number available for reallocation */
- if (devpts) {
- down(&allocated_ptys_lock);
-- idr_remove(&allocated_ptys, idx);
-+ idr_remove(idr_alloced, idx);
- up(&allocated_ptys_lock);
- }
- #endif
-@@ -1718,7 +1800,7 @@ static void release_dev(struct file * fi
- */
- static int tty_open(struct inode * inode, struct file * filp)
- {
-- struct tty_struct *tty;
-+ struct tty_struct *tty, *c_tty;
- int noctty, retval;
- struct tty_driver *driver;
- int index;
-@@ -1731,6 +1813,7 @@ retry_open:
- noctty = filp->f_flags & O_NOCTTY;
- index = -1;
- retval = 0;
-+ c_tty = NULL;
-
- down(&tty_sem);
-
-@@ -1741,6 +1824,7 @@ retry_open:
- }
- driver = current->signal->tty->driver;
- index = current->signal->tty->index;
-+ c_tty = current->signal->tty;
- filp->f_flags |= O_NONBLOCK; /* Don't let /dev/tty block */
- /* noctty = 1; */
- goto got_driver;
-@@ -1749,6 +1833,12 @@ retry_open:
- if (device == MKDEV(TTY_MAJOR,0)) {
- extern int fg_console;
- extern struct tty_driver *console_driver;
-+#ifdef CONFIG_VE
-+ if (!ve_is_super(get_exec_env())) {
-+ up(&tty_sem);
-+ return -ENODEV;
-+ }
-+#endif
- driver = console_driver;
- index = fg_console;
- noctty = 1;
-@@ -1756,6 +1846,12 @@ retry_open:
- }
- #endif
- if (device == MKDEV(TTYAUX_MAJOR,1)) {
-+#ifdef CONFIG_VE
-+ if (!ve_is_super(get_exec_env())) {
-+ up(&tty_sem);
-+ return -ENODEV;
-+ }
-+#endif
- driver = console_device(&index);
- if (driver) {
- /* Don't let /dev/console block */
-@@ -1773,7 +1869,7 @@ retry_open:
- return -ENODEV;
- }
- got_driver:
-- retval = init_dev(driver, index, &tty);
-+ retval = init_dev(driver, index, c_tty, &tty);
- up(&tty_sem);
- if (retval)
- return retval;
-@@ -1843,11 +1939,11 @@ static int ptmx_open(struct inode * inod
-
- /* find a device that is not in use. */
- down(&allocated_ptys_lock);
-- if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
-+ if (!idr_pre_get(&ve_allocated_ptys, GFP_KERNEL)) {
- up(&allocated_ptys_lock);
- return -ENOMEM;
- }
-- idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
-+ idr_ret = idr_get_new(&ve_allocated_ptys, NULL, &index);
- if (idr_ret < 0) {
- up(&allocated_ptys_lock);
- if (idr_ret == -EAGAIN)
-@@ -1855,14 +1951,14 @@ static int ptmx_open(struct inode * inod
- return -EIO;
- }
- if (index >= pty_limit) {
-- idr_remove(&allocated_ptys, index);
-+ idr_remove(&ve_allocated_ptys, index);
- up(&allocated_ptys_lock);
- return -EIO;
- }
- up(&allocated_ptys_lock);
-
- down(&tty_sem);
-- retval = init_dev(ptm_driver, index, &tty);
-+ retval = init_dev(ve_ptm_driver, index, NULL, &tty);
- up(&tty_sem);
-
- if (retval)
-@@ -1886,7 +1982,7 @@ out1:
- release_dev(filp);
- out:
- down(&allocated_ptys_lock);
-- idr_remove(&allocated_ptys, index);
-+ idr_remove(&ve_allocated_ptys, index);
- up(&allocated_ptys_lock);
- return retval;
- }
-@@ -2000,6 +2096,8 @@ static int tioccons(struct file *file)
- {
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-+ if (!ve_is_super(get_exec_env()))
-+ return -EACCES;
- if (file->f_op->write == redirected_tty_write) {
- struct file *f;
- spin_lock(&redirect_lock);
-@@ -2060,9 +2158,9 @@ static int tiocsctty(struct tty_struct *
- */
-
- read_lock(&tasklist_lock);
-- do_each_task_pid(tty->session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(tty->session, PIDTYPE_SID, p) {
- p->signal->tty = NULL;
-- } while_each_task_pid(tty->session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(tty->session, PIDTYPE_SID, p);
- read_unlock(&tasklist_lock);
- } else
- return -EPERM;
-@@ -2084,7 +2182,7 @@ static int tiocgpgrp(struct tty_struct *
- */
- if (tty == real_tty && current->signal->tty != real_tty)
- return -ENOTTY;
-- return put_user(real_tty->pgrp, p);
-+ return put_user(pid_type_to_vpid(PIDTYPE_PGID, real_tty->pgrp), p);
- }
-
- static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
-@@ -2104,6 +2202,9 @@ static int tiocspgrp(struct tty_struct *
- return -EFAULT;
- if (pgrp < 0)
- return -EINVAL;
-+ pgrp = vpid_to_pid(pgrp);
-+ if (pgrp < 0)
-+ return -EPERM;
- if (session_of_pgrp(pgrp) != current->signal->session)
- return -EPERM;
- real_tty->pgrp = pgrp;
-@@ -2120,7 +2221,7 @@ static int tiocgsid(struct tty_struct *t
- return -ENOTTY;
- if (real_tty->session <= 0)
- return -ENOTTY;
-- return put_user(real_tty->session, p);
-+ return put_user(pid_type_to_vpid(PIDTYPE_SID, real_tty->session), p);
- }
-
- static int tiocsetd(struct tty_struct *tty, int __user *p)
-@@ -2393,7 +2494,7 @@ static void __do_SAK(void *arg)
- tty->driver->flush_buffer(tty);
-
- read_lock(&tasklist_lock);
-- do_each_task_pid(session, PIDTYPE_SID, p) {
-+ do_each_task_pid_all(session, PIDTYPE_SID, p) {
- if (p->signal->tty == tty || session > 0) {
- printk(KERN_NOTICE "SAK: killed process %d"
- " (%s): p->signal->session==tty->session\n",
-@@ -2420,7 +2521,7 @@ static void __do_SAK(void *arg)
- spin_unlock(&p->files->file_lock);
- }
- task_unlock(p);
-- } while_each_task_pid(session, PIDTYPE_SID, p);
-+ } while_each_task_pid_all(session, PIDTYPE_SID, p);
- read_unlock(&tasklist_lock);
- #endif
- }
-@@ -2803,8 +2904,11 @@ int tty_register_driver(struct tty_drive
-
- if (!driver->put_char)
- driver->put_char = tty_default_put_char;
--
-+
-+ SET_VE_OWNER_TTYDRV(driver, get_exec_env());
-+ write_lock_irq(&tty_driver_guard);
- list_add(&driver->tty_drivers, &tty_drivers);
-+ write_unlock_irq(&tty_driver_guard);
-
- if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
- for(i = 0; i < driver->num; i++)
-@@ -2831,7 +2935,9 @@ int tty_unregister_driver(struct tty_dri
- unregister_chrdev_region(MKDEV(driver->major, driver->minor_start),
- driver->num);
-
-+ write_lock_irq(&tty_driver_guard);
- list_del(&driver->tty_drivers);
-+ write_unlock_irq(&tty_driver_guard);
-
- /*
- * Free the termios and termios_locked structures because
-@@ -2959,6 +3065,44 @@ static int __init tty_init(void)
-
- vty_init();
- #endif
-+ prepare_tty();
- return 0;
- }
- module_init(tty_init);
-+
-+#ifdef CONFIG_UNIX98_PTYS
-+struct class_simple *init_ve_tty_class(void)
-+{
-+ struct class_simple *ve_tty_class;
-+ struct class_device *ve_ptmx_dev_class;
-+
-+ ve_tty_class = class_simple_create(THIS_MODULE, "tty");
-+ if (IS_ERR(ve_tty_class))
-+ return ve_tty_class;
-+
-+ ve_ptmx_dev_class = class_simple_device_add(ve_tty_class,
-+ MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx");
-+ if (IS_ERR(ve_ptmx_dev_class)) {
-+ class_simple_destroy(ve_tty_class);
-+ return (struct class_simple *)ve_ptmx_dev_class;
-+ }
-+
-+ return ve_tty_class;
-+}
-+
-+void fini_ve_tty_class(struct class_simple *ve_tty_class)
-+{
-+ class_simple_device_remove(MKDEV(TTYAUX_MAJOR, 2));
-+ class_simple_destroy(ve_tty_class);
-+}
-+#else
-+struct class_simple *init_ve_tty_class(void)
-+{
-+return NULL;
-+}
-+void fini_ve_tty_class(struct class_simple *ve_tty_class)
-+{
-+}
-+#endif
-+EXPORT_SYMBOL(init_ve_tty_class);
-+EXPORT_SYMBOL(fini_ve_tty_class);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/char/vt.c linux-2.6.9-ve023stab030/drivers/char/vt.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/char/vt.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/char/vt.c 2006-10-11 19:08:00.000000000 +0400
-@@ -2262,8 +2262,10 @@ void vt_console_print(struct console *co
- }
- set_cursor(currcons);
-
-- if (!oops_in_progress)
-- poke_blanked_console();
-+ if (!oops_in_progress) {
-+ if (!printk_no_wake)
-+ poke_blanked_console();
-+ }
-
- quit:
- clear_bit(0, &printing);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/cmd64x.c linux-2.6.9-ve023stab030/drivers/ide/pci/cmd64x.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/cmd64x.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/ide/pci/cmd64x.c 2006-10-11 19:07:55.000000000 +0400
-@@ -579,7 +579,7 @@ static unsigned int __devinit init_chips
-
- #ifdef __i386__
- if (dev->resource[PCI_ROM_RESOURCE].start) {
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
- printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
- }
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/hpt34x.c linux-2.6.9-ve023stab030/drivers/ide/pci/hpt34x.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/hpt34x.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/ide/pci/hpt34x.c 2006-10-11 19:07:55.000000000 +0400
-@@ -192,7 +192,7 @@ static unsigned int __devinit init_chips
-
- if (cmd & PCI_COMMAND_MEMORY) {
- if (pci_resource_start(dev, PCI_ROM_RESOURCE)) {
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS,
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
- dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
- printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n",
- dev->resource[PCI_ROM_RESOURCE].start);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/hpt366.c linux-2.6.9-ve023stab030/drivers/ide/pci/hpt366.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/ide/pci/hpt366.c 2006-10-11 18:29:20.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/ide/pci/hpt366.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1106,7 +1106,7 @@ static unsigned int __devinit init_chips
- u8 test = 0;
-
- if (dev->resource[PCI_ROM_RESOURCE].start)
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS,
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
- dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-
- pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &test);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/ieee1394/ieee1394_core.c linux-2.6.9-ve023stab030/drivers/ieee1394/ieee1394_core.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/ieee1394/ieee1394_core.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/ieee1394/ieee1394_core.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1034,8 +1034,8 @@ static int hpsbpkt_thread(void *__hi)
- if (khpsbpkt_kill)
- break;
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-+ if (test_thread_flag(TIF_FREEZE)) {
-+ refrigerator();
- continue;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/ieee1394/nodemgr.c linux-2.6.9-ve023stab030/drivers/ieee1394/nodemgr.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/ieee1394/nodemgr.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/ieee1394/nodemgr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1481,8 +1481,8 @@ static int nodemgr_host_thread(void *__h
-
- if (down_interruptible(&hi->reset_sem) ||
- down_interruptible(&nodemgr_serialize)) {
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-+ if (test_thread_flag(TIF_FREEZE)) {
-+ refrigerator();
- continue;
- }
- printk("NodeMgr: received unexpected signal?!\n" );
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/input/serio/serio.c linux-2.6.9-ve023stab030/drivers/input/serio/serio.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/input/serio/serio.c 2004-10-19 01:53:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/input/serio/serio.c 2006-10-11 19:07:55.000000000 +0400
-@@ -225,8 +225,8 @@ static int serio_thread(void *nothing)
- do {
- serio_handle_events();
- wait_event_interruptible(serio_wait, !list_empty(&serio_event_list));
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- } while (!signal_pending(current));
-
- printk(KERN_DEBUG "serio: kseriod exiting\n");
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/md/md.c linux-2.6.9-ve023stab030/drivers/md/md.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/md/md.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/md/md.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2839,8 +2839,8 @@ int md_thread(void * arg)
-
- wait_event_interruptible(thread->wqueue,
- test_bit(THREAD_WAKEUP, &thread->flags));
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- clear_bit(THREAD_WAKEUP, &thread->flags);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/8139too.c linux-2.6.9-ve023stab030/drivers/net/8139too.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/8139too.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/8139too.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1626,8 +1626,8 @@ static int rtl8139_thread (void *data)
- do {
- timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
- /* make swsusp happy with our thread */
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- } while (!signal_pending (current) && (timeout > 0));
-
- if (signal_pending (current)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/sir_kthread.c linux-2.6.9-ve023stab030/drivers/net/irda/sir_kthread.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/sir_kthread.c 2004-10-19 01:55:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/irda/sir_kthread.c 2006-10-11 19:07:55.000000000 +0400
-@@ -136,8 +136,8 @@ static int irda_thread(void *startup)
- remove_wait_queue(&irda_rq_queue.kick, &wait);
-
- /* make swsusp happy with our thread */
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- run_irda_queue();
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/stir4200.c linux-2.6.9-ve023stab030/drivers/net/irda/stir4200.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/stir4200.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/irda/stir4200.c 2006-10-11 19:07:55.000000000 +0400
-@@ -767,7 +767,7 @@ static int stir_transmit_thread(void *ar
- && !signal_pending(current))
- {
- /* if suspending, then power off and wait */
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- if (stir->receiving)
- receive_stop(stir);
- else
-@@ -775,7 +775,7 @@ static int stir_transmit_thread(void *ar
-
- write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
-
-- refrigerator(PF_FREEZE);
-+ refrigerator();
-
- if (change_speed(stir, stir->speed))
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/vlsi_ir.h linux-2.6.9-ve023stab030/drivers/net/irda/vlsi_ir.h
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/irda/vlsi_ir.h 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/irda/vlsi_ir.h 2006-10-11 19:07:57.000000000 +0400
-@@ -58,7 +58,7 @@ typedef void irqreturn_t;
-
- /* PDE() introduced in 2.5.4 */
- #ifdef CONFIG_PROC_FS
--#define PDE(inode) ((inode)->u.generic_ip)
-+#define LPDE(inode) ((inode)->u.generic_ip)
- #endif
-
- /* irda crc16 calculation exported in 2.5.42 */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/loopback.c linux-2.6.9-ve023stab030/drivers/net/loopback.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/loopback.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/loopback.c 2006-10-11 19:07:58.000000000 +0400
-@@ -59,6 +59,13 @@
- #include <linux/percpu.h>
-
- static DEFINE_PER_CPU(struct net_device_stats, loopback_stats);
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define LOOPBACK_STATS(cpu) (ve_is_super(get_exec_env())) ? \
-+ &per_cpu(loopback_stats, cpu) : \
-+ (&(get_exec_env()->_loopback_stats)[(cpu)])
-+#else
-+#define LOOPBACK_STATS(cpu) &per_cpu(loopback_stats, cpu)
-+#endif
-
- #define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16)
-
-@@ -128,6 +135,11 @@ static int loopback_xmit(struct sk_buff
- {
- struct net_device_stats *lb_stats;
-
-+ if (unlikely(get_exec_env()->disable_net)) {
-+ kfree_skb(skb);
-+ return 0;
-+ }
-+
- skb_orphan(skb);
-
- skb->protocol=eth_type_trans(skb,dev);
-@@ -146,7 +158,7 @@ static int loopback_xmit(struct sk_buff
-
- dev->last_rx = jiffies;
-
-- lb_stats = &per_cpu(loopback_stats, get_cpu());
-+ lb_stats = LOOPBACK_STATS(get_cpu());
- lb_stats->rx_bytes += skb->len;
- lb_stats->tx_bytes += skb->len;
- lb_stats->rx_packets++;
-@@ -174,7 +186,7 @@ static struct net_device_stats *get_stat
-
- if (!cpu_possible(i))
- continue;
-- lb_stats = &per_cpu(loopback_stats, i);
-+ lb_stats = LOOPBACK_STATS(i);
- stats->rx_bytes += lb_stats->rx_bytes;
- stats->tx_bytes += lb_stats->tx_bytes;
- stats->rx_packets += lb_stats->rx_packets;
-@@ -195,6 +207,30 @@ static struct ethtool_ops loopback_ethto
- .set_tso = ethtool_op_set_tso,
- };
-
-+static void loopback_destructor(struct net_device *dev)
-+{
-+ kfree(dev->priv);
-+ dev->priv = NULL;
-+}
-+
-+struct net_device templ_loopback_dev = {
-+ .name = "lo",
-+ .mtu = (16 * 1024) + 20 + 20 + 12,
-+ .hard_start_xmit = loopback_xmit,
-+ .hard_header = eth_header,
-+ .hard_header_cache = eth_header_cache,
-+ .header_cache_update = eth_header_cache_update,
-+ .hard_header_len = ETH_HLEN, /* 14 */
-+ .addr_len = ETH_ALEN, /* 6 */
-+ .tx_queue_len = 0,
-+ .type = ARPHRD_LOOPBACK, /* 0x0001*/
-+ .rebuild_header = eth_rebuild_header,
-+ .flags = IFF_LOOPBACK,
-+ .features = NETIF_F_SG|NETIF_F_FRAGLIST
-+ |NETIF_F_NO_CSUM|NETIF_F_HIGHDMA
-+ |NETIF_F_LLTX|NETIF_F_VIRTUAL,
-+};
-+
- struct net_device loopback_dev = {
- .name = "lo",
- .mtu = (16 * 1024) + 20 + 20 + 12,
-@@ -225,9 +261,11 @@ int __init loopback_init(void)
- memset(stats, 0, sizeof(struct net_device_stats));
- loopback_dev.priv = stats;
- loopback_dev.get_stats = &get_stats;
-+ loopback_dev.destructor = &loopback_destructor;
- }
-
- return register_netdev(&loopback_dev);
- };
-
- EXPORT_SYMBOL(loopback_dev);
-+EXPORT_SYMBOL(templ_loopback_dev);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/net_init.c linux-2.6.9-ve023stab030/drivers/net/net_init.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/net_init.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/net_init.c 2006-10-11 19:07:57.000000000 +0400
-@@ -51,6 +51,7 @@
- #include <linux/if_ltalk.h>
- #include <linux/rtnetlink.h>
- #include <net/neighbour.h>
-+#include <ub/ub_mem.h>
-
- /* The network devices currently exist only in the socket namespace, so these
- entries are unused. The only ones that make sense are
-@@ -85,7 +86,7 @@ struct net_device *alloc_netdev(int size
- & ~NETDEV_ALIGN_CONST;
- alloc_size += sizeof(struct net_device_wrapper) + NETDEV_ALIGN_CONST;
-
-- p = kmalloc (alloc_size, GFP_KERNEL);
-+ p = ub_kmalloc(alloc_size, GFP_KERNEL);
- if (!p) {
- printk(KERN_ERR "alloc_dev: Unable to allocate device.\n");
- return NULL;
-@@ -401,6 +402,10 @@ int register_netdev(struct net_device *d
-
- out:
- rtnl_unlock();
-+ if (err == 0 && dev->reg_state != NETREG_REGISTERED) {
-+ unregister_netdev(dev);
-+ err = -ENOMEM;
-+ }
- return err;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/open_vznet.c linux-2.6.9-ve023stab030/drivers/net/open_vznet.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/open_vznet.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/drivers/net/open_vznet.c 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,190 @@
-+/*
-+ * open_vznet.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+/*
-+ * Virtual Networking device used to change VE ownership on packets
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/seq_file.h>
-+
-+#include <linux/inet.h>
-+#include <net/ip.h>
-+#include <linux/skbuff.h>
-+#include <linux/venet.h>
-+
-+void veip_stop(struct ve_struct *ve)
-+{
-+ struct list_head *p, *tmp;
-+
-+ write_lock_irq(&veip_hash_lock);
-+ if (ve->veip == NULL)
-+ goto unlock;
-+ list_for_each_safe(p, tmp, &ve->veip->ip_lh) {
-+ struct ip_entry_struct *ptr;
-+ ptr = list_entry(p, struct ip_entry_struct, ve_list);
-+ ptr->active_env = NULL;
-+ list_del(&ptr->ve_list);
-+ list_del(&ptr->ip_hash);
-+ kfree(ptr);
-+ }
-+ veip_put(ve->veip);
-+ ve->veip = NULL;
-+unlock:
-+ write_unlock_irq(&veip_hash_lock);
-+}
-+
-+int veip_start(struct ve_struct *ve)
-+{
-+ int err;
-+
-+ err = 0;
-+ write_lock_irq(&veip_hash_lock);
-+ ve->veip = veip_findcreate(ve->veid);
-+ if (ve->veip == NULL)
-+ err = -ENOMEM;
-+ write_unlock_irq(&veip_hash_lock);
-+ return err;
-+}
-+
-+int veip_entry_add(struct ve_struct *ve, struct sockaddr_in *addr)
-+{
-+ struct ip_entry_struct *entry, *found;
-+ int err;
-+
-+ entry = kmalloc(sizeof(struct ip_entry_struct), GFP_KERNEL);
-+ if (entry == NULL)
-+ return -ENOMEM;
-+
-+ memset(entry, 0, sizeof(struct ip_entry_struct));
-+ entry->ip = addr->sin_addr.s_addr;
-+
-+ write_lock_irq(&veip_hash_lock);
-+ err = -EADDRINUSE;
-+ found = ip_entry_lookup(entry->ip);
-+ if (found != NULL)
-+ goto out_unlock;
-+ else {
-+ ip_entry_hash(entry, ve->veip);
-+ found = entry;
-+ entry = NULL;
-+ }
-+ err = 0;
-+ found->active_env = ve;
-+out_unlock:
-+ write_unlock_irq(&veip_hash_lock);
-+ if (entry != NULL)
-+ kfree(entry);
-+ return err;
-+}
-+
-+int veip_entry_del(envid_t veid, struct sockaddr_in *addr)
-+{
-+ struct ip_entry_struct *found;
-+ int err;
-+
-+ err = -EADDRNOTAVAIL;
-+ write_lock_irq(&veip_hash_lock);
-+ found = ip_entry_lookup(addr->sin_addr.s_addr);
-+ if (found == NULL)
-+ goto out;
-+ if (found->active_env->veid != veid)
-+ goto out;
-+
-+ err = 0;
-+ found->active_env = NULL;
-+
-+ list_del(&found->ip_hash);
-+ list_del(&found->ve_list);
-+ kfree(found);
-+out:
-+ write_unlock_irq(&veip_hash_lock);
-+ return err;
-+}
-+
-+static struct ve_struct *venet_find_ve(__u32 ip)
-+{
-+ struct ip_entry_struct *entry;
-+
-+ entry = ip_entry_lookup(ip);
-+ if (entry == NULL)
-+ return NULL;
-+
-+ return entry->active_env;
-+}
-+
-+int venet_change_skb_owner(struct sk_buff *skb)
-+{
-+ struct ve_struct *ve, *ve_old;
-+ struct iphdr *iph;
-+
-+ ve_old = skb->owner_env;
-+ iph = skb->nh.iph;
-+
-+ read_lock(&veip_hash_lock);
-+ if (!ve_is_super(ve_old)) {
-+ /* from VE to host */
-+ ve = venet_find_ve(iph->saddr);
-+ if (ve == NULL)
-+ goto out_drop;
-+ if (!ve_accessible_strict(ve, ve_old))
-+ goto out_source;
-+ skb->owner_env = get_ve0();
-+ } else {
-+ /* from host to VE */
-+ ve = venet_find_ve(iph->daddr);
-+ if (ve == NULL)
-+ goto out_drop;
-+ skb->owner_env = ve;
-+ }
-+ read_unlock(&veip_hash_lock);
-+
-+ return 0;
-+
-+out_drop:
-+ read_unlock(&veip_hash_lock);
-+ return -ESRCH;
-+
-+out_source:
-+ read_unlock(&veip_hash_lock);
-+ if (net_ratelimit()) {
-+ printk(KERN_WARNING "Dropped packet, source wrong "
-+ "veid=%u src-IP=%u.%u.%u.%u "
-+ "dst-IP=%u.%u.%u.%u\n",
-+ skb->owner_env->veid,
-+ NIPQUAD(skb->nh.iph->saddr),
-+ NIPQUAD(skb->nh.iph->daddr));
-+ }
-+ return -EACCES;
-+}
-+
-+#ifdef CONFIG_PROC_FS
-+int veip_seq_show(struct seq_file *m, void *v)
-+{
-+ struct list_head *p;
-+ struct ip_entry_struct *entry;
-+ char s[16];
-+
-+ p = (struct list_head *)v;
-+ if (p == ip_entry_hash_table) {
-+ seq_puts(m, "Version: 2.5\n");
-+ return 0;
-+ }
-+ entry = list_entry(p, struct ip_entry_struct, ip_hash);
-+ sprintf(s, "%u.%u.%u.%u", NIPQUAD(entry->ip));
-+ seq_printf(m, "%15s %10u\n", s, 0);
-+ return 0;
-+}
-+#endif
-+
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Virtuozzo Virtual Network Device");
-+MODULE_LICENSE("GPL v2");
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/tun.c linux-2.6.9-ve023stab030/drivers/net/tun.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/tun.c 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/tun.c 2006-10-11 19:07:57.000000000 +0400
-@@ -44,6 +44,7 @@
-
- #include <asm/system.h>
- #include <asm/uaccess.h>
-+#include <ub/beancounter.h>
-
- #ifdef TUN_DEBUG
- static int debug;
-@@ -71,6 +72,9 @@ static int tun_net_close(struct net_devi
- static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
- {
- struct tun_struct *tun = netdev_priv(dev);
-+#if 0
-+ struct user_beancounter *ub;
-+#endif
-
- DBG(KERN_INFO "%s: tun_net_xmit %d\n", tun->dev->name, skb->len);
-
-@@ -90,6 +94,21 @@ static int tun_net_xmit(struct sk_buff *
- if (skb_queue_len(&tun->readq) >= dev->tx_queue_len)
- goto drop;
- }
-+
-+#if 0
-+ ub = netdev_bc(dev)->exec_ub;
-+ if (ub && (skb_bc(skb)->charged == 0)) {
-+ unsigned long charge;
-+ charge = skb_charge_fullsize(skb);
-+ if (charge_beancounter(ub, UB_OTHERSOCKBUF, charge, 1))
-+ goto drop;
-+ get_beancounter(ub);
-+ skb_bc(skb)->ub = ub;
-+ skb_bc(skb)->charged = charge;
-+ skb_bc(skb)->resource = UB_OTHERSOCKBUF;
-+ }
-+#endif
-+
- skb_queue_tail(&tun->readq, skb);
-
- /* Notify and wake up reader process */
-@@ -174,24 +193,31 @@ static __inline__ ssize_t tun_get_user(s
- {
- struct tun_pi pi = { 0, __constant_htons(ETH_P_IP) };
- struct sk_buff *skb;
-- size_t len = count;
-+ size_t len = count, align = 0;
-
- if (!(tun->flags & TUN_NO_PI)) {
-- if ((len -= sizeof(pi)) > len)
-+ if ((len -= sizeof(pi)) > count)
- return -EINVAL;
-
- if(memcpy_fromiovec((void *)&pi, iv, sizeof(pi)))
- return -EFAULT;
- }
-+
-+ if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV)
-+ align = NET_IP_ALIGN;
-
-- if (!(skb = alloc_skb(len + 2, GFP_KERNEL))) {
-+ if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
- tun->stats.rx_dropped++;
- return -ENOMEM;
- }
-
-- skb_reserve(skb, 2);
-- if (memcpy_fromiovec(skb_put(skb, len), iv, len))
-+ if (align)
-+ skb_reserve(skb, align);
-+ if (memcpy_fromiovec(skb_put(skb, len), iv, len)) {
-+ tun->stats.rx_dropped++;
-+ kfree_skb(skb);
- return -EFAULT;
-+ }
-
- skb->dev = tun->dev;
- switch (tun->flags & TUN_TYPE_MASK) {
-@@ -322,6 +348,7 @@ static ssize_t tun_chr_readv(struct file
-
- ret = tun_put_user(tun, skb, (struct iovec *) iv, len);
-
-+ /* skb will be uncharged in kfree_skb() */
- kfree_skb(skb);
- break;
- }
-@@ -355,6 +382,7 @@ static void tun_setup(struct net_device
- dev->stop = tun_net_close;
- dev->get_stats = tun_net_stats;
- dev->destructor = free_netdev;
-+ dev->features |= NETIF_F_VIRTUAL;
- }
-
- static struct tun_struct *tun_get_by_name(const char *name)
-@@ -363,8 +391,9 @@ static struct tun_struct *tun_get_by_nam
-
- ASSERT_RTNL();
- list_for_each_entry(tun, &tun_dev_list, list) {
-- if (!strncmp(tun->dev->name, name, IFNAMSIZ))
-- return tun;
-+ if (ve_accessible_strict(tun->dev->owner_env, get_exec_env()) &&
-+ !strncmp(tun->dev->name, name, IFNAMSIZ))
-+ return tun;
- }
-
- return NULL;
-@@ -383,7 +412,8 @@ static int tun_set_iff(struct file *file
-
- /* Check permissions */
- if (tun->owner != -1 &&
-- current->euid != tun->owner && !capable(CAP_NET_ADMIN))
-+ current->euid != tun->owner &&
-+ !capable(CAP_NET_ADMIN) && !capable(CAP_VE_NET_ADMIN))
- return -EPERM;
- }
- else if (__dev_get_by_name(ifr->ifr_name))
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/venet_core.c linux-2.6.9-ve023stab030/drivers/net/venet_core.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/venet_core.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/drivers/net/venet_core.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,626 @@
-+/*
-+ * venet_core.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+/*
-+ * Common part for Virtuozzo virtual network devices
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/interrupt.h>
-+#include <linux/fs.h>
-+#include <linux/types.h>
-+#include <linux/string.h>
-+#include <linux/socket.h>
-+#include <linux/errno.h>
-+#include <linux/fcntl.h>
-+#include <linux/in.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/tcp.h>
-+#include <linux/proc_fs.h>
-+#include <linux/seq_file.h>
-+
-+#include <asm/system.h>
-+#include <asm/uaccess.h>
-+#include <asm/io.h>
-+#include <asm/unistd.h>
-+
-+#include <linux/inet.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <net/ip.h>
-+#include <linux/skbuff.h>
-+#include <net/sock.h>
-+#include <linux/if_ether.h> /* For the statistics structure. */
-+#include <linux/if_arp.h> /* For ARPHRD_ETHER */
-+#include <linux/venet.h>
-+#include <linux/ve_proto.h>
-+#include <linux/vzctl.h>
-+#include <linux/vzctl_venet.h>
-+
-+struct list_head ip_entry_hash_table[VEIP_HASH_SZ];
-+rwlock_t veip_hash_lock = RW_LOCK_UNLOCKED;
-+LIST_HEAD(veip_lh);
-+
-+#define ip_entry_hash_function(ip) (ntohl(ip) & (VEIP_HASH_SZ - 1))
-+
-+void ip_entry_hash(struct ip_entry_struct *entry, struct veip_struct *veip)
-+{
-+ list_add(&entry->ip_hash,
-+ ip_entry_hash_table + ip_entry_hash_function(entry->ip));
-+ list_add(&entry->ve_list, &veip->ip_lh);
-+}
-+
-+void veip_put(struct veip_struct *veip)
-+{
-+ if (!list_empty(&veip->ip_lh))
-+ return;
-+ if (!list_empty(&veip->src_lh))
-+ return;
-+ if (!list_empty(&veip->dst_lh))
-+ return;
-+
-+ list_del(&veip->list);
-+ kfree(veip);
-+}
-+
-+struct ip_entry_struct *ip_entry_lookup(u32 addr)
-+{
-+ struct ip_entry_struct *entry;
-+ struct list_head *tmp;
-+
-+ list_for_each(tmp, ip_entry_hash_table + ip_entry_hash_function(addr)) {
-+ entry = list_entry(tmp, struct ip_entry_struct, ip_hash);
-+ if (entry->ip != addr)
-+ continue;
-+ return entry;
-+ }
-+ return NULL;
-+}
-+
-+struct veip_struct *veip_find(envid_t veid)
-+{
-+ struct veip_struct *ptr;
-+ list_for_each_entry(ptr, &veip_lh, list) {
-+ if (ptr->veid != veid)
-+ continue;
-+ return ptr;
-+ }
-+ return NULL;
-+}
-+
-+struct veip_struct *veip_findcreate(envid_t veid)
-+{
-+ struct veip_struct *ptr;
-+
-+ ptr = veip_find(veid);
-+ if (ptr != NULL)
-+ return ptr;
-+
-+ ptr = kmalloc(sizeof(struct veip_struct), GFP_ATOMIC);
-+ if (ptr == NULL)
-+ return NULL;
-+ memset(ptr, 0, sizeof(struct veip_struct));
-+ INIT_LIST_HEAD(&ptr->ip_lh);
-+ INIT_LIST_HEAD(&ptr->src_lh);
-+ INIT_LIST_HEAD(&ptr->dst_lh);
-+ list_add(&ptr->list, &veip_lh);
-+ ptr->veid = veid;
-+ return ptr;
-+}
-+
-+/*
-+ * Device functions
-+ */
-+
-+static int venet_open(struct net_device *dev)
-+{
-+ if (!try_module_get(THIS_MODULE))
-+ return -EBUSY;
-+ return 0;
-+}
-+
-+static int venet_close(struct net_device *master)
-+{
-+ module_put(THIS_MODULE);
-+ return 0;
-+}
-+
-+static void venet_destructor(struct net_device *dev)
-+{
-+ kfree(dev->priv);
-+ dev->priv = NULL;
-+}
-+
-+/*
-+ * The higher levels take care of making this non-reentrant (it's
-+ * called with bh's disabled).
-+ */
-+static int venet_xmit(struct sk_buff *skb, struct net_device *dev)
-+{
-+ struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
-+ struct net_device *rcv = NULL;
-+ struct iphdr *iph;
-+ int length;
-+
-+ if (unlikely(get_exec_env()->disable_net))
-+ goto outf;
-+
-+ /*
-+ * Optimise so buffers with skb->free=1 are not copied but
-+ * instead are lobbed from tx queue to rx queue
-+ */
-+ if (atomic_read(&skb->users) != 1) {
-+ struct sk_buff *skb2 = skb;
-+ skb = skb_clone(skb, GFP_ATOMIC); /* Clone the buffer */
-+ if (skb == NULL) {
-+ kfree_skb(skb2);
-+ goto out;
-+ }
-+ kfree_skb(skb2);
-+ } else
-+ skb_orphan(skb);
-+
-+ if (skb->protocol != __constant_htons(ETH_P_IP))
-+ goto outf;
-+
-+ iph = skb->nh.iph;
-+ if (MULTICAST(iph->daddr))
-+ goto outf;
-+
-+ if (venet_change_skb_owner(skb) < 0)
-+ goto outf;
-+
-+ if (unlikely(VE_OWNER_SKB(skb)->disable_net))
-+ goto outf;
-+
-+ rcv = VE_OWNER_SKB(skb)->_venet_dev;
-+ if (!rcv)
-+ /* VE going down */
-+ goto outf;
-+
-+ dev_hold(rcv);
-+
-+ if (!(rcv->flags & IFF_UP)) {
-+ /* Target VE does not want to receive packets */
-+ dev_put(rcv);
-+ goto outf;
-+ }
-+
-+ skb->pkt_type = PACKET_HOST;
-+ skb->dev = rcv;
-+
-+ skb->mac.raw = skb->data;
-+ memset(skb->data - dev->hard_header_len, 0, dev->hard_header_len);
-+
-+ dst_release(skb->dst);
-+ skb->dst = NULL;
-+#ifdef CONFIG_NETFILTER
-+ nf_conntrack_put(skb->nfct);
-+ skb->nfct = NULL;
-+#ifdef CONFIG_NETFILTER_DEBUG
-+ skb->nf_debug = 0;
-+#endif
-+#endif
-+ length = skb->len;
-+
-+ netif_rx(skb);
-+
-+ stats->tx_bytes += length;
-+ stats->tx_packets++;
-+ if (rcv) {
-+ struct net_device_stats *rcv_stats =
-+ (struct net_device_stats *)rcv->priv;
-+ rcv_stats->rx_bytes += length;
-+ rcv_stats->rx_packets++;
-+ dev_put(rcv);
-+ }
-+
-+ return 0;
-+
-+outf:
-+ kfree_skb(skb);
-+ ++stats->tx_dropped;
-+out:
-+ return 0;
-+}
-+
-+static struct net_device_stats *get_stats(struct net_device *dev)
-+{
-+ return (struct net_device_stats *)dev->priv;
-+}
-+
-+/* Initialize the rest of the LOOPBACK device. */
-+int venet_init_dev(struct net_device *dev)
-+{
-+ dev->hard_start_xmit = venet_xmit;
-+ dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
-+ if (dev->priv == NULL)
-+ return -ENOMEM;
-+ memset(dev->priv, 0, sizeof(struct net_device_stats));
-+ dev->get_stats = get_stats;
-+ dev->open = venet_open;
-+ dev->stop = venet_close;
-+ dev->destructor = venet_destructor;
-+
-+ /*
-+ * Fill in the generic fields of the device structure.
-+ */
-+ dev->type = ARPHRD_VOID;
-+ dev->hard_header_len = ETH_HLEN;
-+ dev->mtu = 1500; /* eth_mtu */
-+ dev->tx_queue_len = 0;
-+
-+ memset(dev->broadcast, 0xFF, ETH_ALEN);
-+
-+ /* New-style flags. */
-+ dev->flags = IFF_BROADCAST|IFF_NOARP|IFF_POINTOPOINT;
-+ return 0;
-+}
-+
-+static void venet_setup(struct net_device *dev)
-+{
-+ dev->init = venet_init_dev;
-+ /*
-+ * No other features, as they are:
-+ * - checksumming is required, and nobody else will done our job
-+ */
-+ dev->features |= NETIF_F_VENET | NETIF_F_VIRTUAL | NETIF_F_LLTX;
-+}
-+
-+#ifdef CONFIG_PROC_FS
-+static int veinfo_seq_show(struct seq_file *m, void *v)
-+{
-+ struct ve_struct *ve = (struct ve_struct *)v;
-+ struct list_head *tmp;
-+
-+ seq_printf(m, "%10u %5u %5u", ve->veid,
-+ ve->class_id, atomic_read(&ve->pcounter));
-+ read_lock(&veip_hash_lock);
-+ if (ve->veip == NULL)
-+ goto unlock;
-+ list_for_each(tmp, &ve->veip->ip_lh) {
-+ char ip[16];
-+ struct ip_entry_struct *entry;
-+
-+ entry = list_entry(tmp, struct ip_entry_struct, ve_list);
-+ if (entry->active_env == NULL)
-+ continue;
-+
-+ sprintf(ip, "%u.%u.%u.%u", NIPQUAD(entry->ip));
-+ seq_printf(m, " %15s", ip);
-+ }
-+unlock:
-+ read_unlock(&veip_hash_lock);
-+ seq_putc(m, '\n');
-+ return 0;
-+}
-+
-+static void *ve_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ struct ve_struct *ve, *curve;
-+ loff_t l;
-+
-+ curve = get_exec_env();
-+ read_lock(&ve_list_guard);
-+ if (!ve_is_super(curve)) {
-+ if (*pos != 0)
-+ return NULL;
-+ return curve;
-+ }
-+ for (ve = ve_list_head, l = *pos;
-+ ve != NULL && l > 0;
-+ ve = ve->next, l--);
-+ return ve;
-+}
-+
-+static void *ve_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ struct ve_struct *ve = (struct ve_struct *)v;
-+
-+ if (!ve_is_super(get_exec_env()))
-+ return NULL;
-+ (*pos)++;
-+ return ve->next;
-+}
-+
-+static void ve_seq_stop(struct seq_file *m, void *v)
-+{
-+ read_unlock(&ve_list_guard);
-+}
-+
-+
-+static struct seq_operations veinfo_seq_op = {
-+ start: ve_seq_start,
-+ next: ve_seq_next,
-+ stop: ve_seq_stop,
-+ show: veinfo_seq_show
-+};
-+
-+static int veinfo_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &veinfo_seq_op);
-+}
-+
-+static struct file_operations proc_veinfo_operations = {
-+ open: veinfo_open,
-+ read: seq_read,
-+ llseek: seq_lseek,
-+ release: seq_release
-+};
-+
-+static void *veip_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ loff_t l;
-+ struct list_head *p;
-+ int i;
-+
-+ l = *pos;
-+ write_lock_irq(&veip_hash_lock);
-+ if (l == 0)
-+ return ip_entry_hash_table;
-+ for (i = 0; i < VEIP_HASH_SZ; i++) {
-+ list_for_each(p, ip_entry_hash_table + i) {
-+ if (--l == 0)
-+ return p;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+static void *veip_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ struct list_head *p;
-+
-+ p = (struct list_head *)v;
-+ while (1) {
-+ p = p->next;
-+ if (p < ip_entry_hash_table ||
-+ p >= ip_entry_hash_table + VEIP_HASH_SZ) {
-+ (*pos)++;
-+ return p;
-+ }
-+ if (++p >= ip_entry_hash_table + VEIP_HASH_SZ)
-+ return NULL;
-+ }
-+ return NULL;
-+}
-+
-+static void veip_seq_stop(struct seq_file *m, void *v)
-+{
-+ write_unlock_irq(&veip_hash_lock);
-+}
-+
-+static struct seq_operations veip_seq_op = {
-+ start: veip_seq_start,
-+ next: veip_seq_next,
-+ stop: veip_seq_stop,
-+ show: veip_seq_show
-+};
-+
-+static int veip_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &veip_seq_op);
-+}
-+
-+static struct file_operations proc_veip_operations = {
-+ open: veip_open,
-+ read: seq_read,
-+ llseek: seq_lseek,
-+ release: seq_release
-+};
-+#endif
-+
-+int real_ve_ip_map(envid_t veid, int op, struct sockaddr *uservaddr, int addrlen)
-+{
-+ int err;
-+ struct sockaddr_in addr;
-+ struct ve_struct *ve;
-+
-+ err = -EPERM;
-+ if (!capable(CAP_SETVEID))
-+ goto out;
-+
-+ err = -EINVAL;
-+ if (addrlen != sizeof(struct sockaddr_in))
-+ goto out;
-+
-+ err = move_addr_to_kernel(uservaddr, addrlen, &addr);
-+ if (err < 0)
-+ goto out;
-+
-+ switch (op)
-+ {
-+ case VE_IP_ADD:
-+ ve = get_ve_by_id(veid);
-+ err = -ESRCH;
-+ if (!ve)
-+ goto out;
-+
-+ down_read(&ve->op_sem);
-+ if (ve->is_running)
-+ err = veip_entry_add(ve, &addr);
-+ up_read(&ve->op_sem);
-+ put_ve(ve);
-+ break;
-+
-+ case VE_IP_DEL:
-+ err = veip_entry_del(veid, &addr);
-+ break;
-+ default:
-+ err = -EINVAL;
-+ }
-+
-+out:
-+ return err;
-+}
-+
-+int venet_ioctl(struct inode *ino, struct file *file, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ int err;
-+
-+ err = -ENOTTY;
-+ switch(cmd) {
-+ case VENETCTL_VE_IP_MAP: {
-+ struct vzctl_ve_ip_map s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = real_ve_ip_map(s.veid, s.op, s.addr, s.addrlen);
-+ }
-+ break;
-+ }
-+ return err;
-+}
-+
-+static struct vzioctlinfo venetcalls = {
-+ type: VENETCTLTYPE,
-+ func: venet_ioctl,
-+ owner: THIS_MODULE,
-+};
-+
-+int venet_dev_start(struct ve_struct *env)
-+{
-+ struct net_device *dev_venet;
-+ int err;
-+
-+ dev_venet = alloc_netdev(0, "venet%d", venet_setup);
-+ if (!dev_venet)
-+ return -ENOMEM;
-+ err = dev_alloc_name(dev_venet, dev_venet->name);
-+ if (err<0)
-+ goto err;
-+ if ((err = register_netdev(dev_venet)) != 0)
-+ goto err;
-+ env->_venet_dev = dev_venet;
-+ return 0;
-+err:
-+ free_netdev(dev_venet);
-+ printk(KERN_ERR "VENET initialization error err=%d\n", err);
-+ return err;
-+}
-+
-+static int venet_start(unsigned int hooknum, void *data)
-+{
-+ struct ve_struct *env;
-+ int err;
-+
-+ env = (struct ve_struct *)data;
-+ if (env->veip)
-+ return -EEXIST;
-+ if (!ve_is_super(env) && !try_module_get(THIS_MODULE))
-+ return 0;
-+
-+ err = veip_start(env);
-+ if (err)
-+ goto err;
-+
-+ err = venet_dev_start(env);
-+ if (err)
-+ goto err_free;
-+ return 0;
-+
-+err_free:
-+ veip_stop(env);
-+err:
-+ if (!ve_is_super(env))
-+ module_put(THIS_MODULE);
-+ return err;
-+}
-+
-+static int venet_stop(unsigned int hooknum, void *data)
-+{
-+ struct ve_struct *env;
-+
-+ env = (struct ve_struct *)data;
-+ veip_stop(env);
-+ if (!ve_is_super(env))
-+ module_put(THIS_MODULE);
-+ return 0;
-+}
-+
-+#define VE_HOOK_PRI_NET 0
-+
-+static struct ve_hook venet_ve_hook_init = {
-+ hook: venet_start,
-+ undo: venet_stop,
-+ hooknum: VE_HOOK_INIT,
-+ priority: VE_HOOK_PRI_NET
-+};
-+
-+static struct ve_hook venet_ve_hook_fini = {
-+ hook: venet_stop,
-+ hooknum: VE_HOOK_FINI,
-+ priority: VE_HOOK_PRI_NET
-+};
-+
-+__init int venet_init(void)
-+{
-+#ifdef CONFIG_PROC_FS
-+ struct proc_dir_entry *de;
-+#endif
-+ int i, err;
-+
-+ if (get_ve0()->_venet_dev != NULL)
-+ return -EEXIST;
-+
-+ for (i = 0; i < VEIP_HASH_SZ; i++)
-+ INIT_LIST_HEAD(ip_entry_hash_table + i);
-+
-+ err = venet_start(VE_HOOK_INIT, (void *)get_ve0());
-+ if (err)
-+ return err;
-+
-+#ifdef CONFIG_PROC_FS
-+ de = create_proc_glob_entry("vz/veinfo",
-+ S_IFREG|S_IRUSR, NULL);
-+ if (de)
-+ de->proc_fops = &proc_veinfo_operations;
-+ else
-+ printk(KERN_WARNING "venet: can't make veinfo proc entry\n");
-+
-+ de = create_proc_entry("vz/veip", S_IFREG|S_IRUSR, NULL);
-+ if (de)
-+ de->proc_fops = &proc_veip_operations;
-+ else
-+ printk(KERN_WARNING "venet: can't make veip proc entry\n");
-+#endif
-+
-+ ve_hook_register(&venet_ve_hook_init);
-+ ve_hook_register(&venet_ve_hook_fini);
-+ vzioctl_register(&venetcalls);
-+ return 0;
-+}
-+
-+__exit void venet_exit(void)
-+{
-+ struct net_device *dev_venet;
-+
-+ vzioctl_unregister(&venetcalls);
-+ ve_hook_unregister(&venet_ve_hook_fini);
-+ ve_hook_unregister(&venet_ve_hook_init);
-+#ifdef CONFIG_PROC_FS
-+ remove_proc_entry("vz/veip", NULL);
-+ remove_proc_entry("vz/veinfo", NULL);
-+#endif
-+
-+ dev_venet = get_ve0()->_venet_dev;
-+ if (dev_venet != NULL) {
-+ get_ve0()->_venet_dev = NULL;
-+ unregister_netdev(dev_venet);
-+ free_netdev(dev_venet);
-+ }
-+ veip_stop(get_ve0());
-+}
-+
-+module_init(venet_init);
-+module_exit(venet_exit);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/veth.c linux-2.6.9-ve023stab030/drivers/net/veth.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/veth.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/drivers/net/veth.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,590 @@
-+/*
-+ * veth.c
-+ *
-+ * Copyright (C) 2006 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+/*
-+ * Virtual ethernet device used to change VE ownership on packets
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/interrupt.h>
-+#include <linux/fs.h>
-+#include <linux/types.h>
-+#include <linux/string.h>
-+#include <linux/socket.h>
-+#include <linux/errno.h>
-+#include <linux/fcntl.h>
-+#include <linux/in.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/tcp.h>
-+#include <linux/proc_fs.h>
-+#include <linux/seq_file.h>
-+
-+#include <asm/system.h>
-+#include <asm/uaccess.h>
-+#include <asm/io.h>
-+#include <asm/unistd.h>
-+
-+#include <linux/inet.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <net/ip.h>
-+#include <linux/skbuff.h>
-+#include <net/sock.h>
-+#include <linux/if_ether.h> /* For the statistics structure. */
-+#include <linux/if_arp.h> /* For ARPHRD_ETHER */
-+#include <linux/ve_proto.h>
-+#include <linux/vzctl.h>
-+#include <linux/vzctl_veth.h>
-+
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/nfcalls.h>
-+
-+struct veth_struct
-+{
-+ struct net_device_stats stats;
-+ struct net_device *pair;
-+ struct list_head hwaddr_list;
-+};
-+
-+struct list_head veth_hwaddr_list;
-+rwlock_t ve_hwaddr_lock = RW_LOCK_UNLOCKED;
-+DECLARE_MUTEX(hwaddr_sem);
-+
-+#define veth_from_netdev(dev) \
-+ ((struct veth_struct *)(netdev_priv(dev)))
-+#define veth_to_netdev(veth) \
-+ ((struct net_device*)((char*)veth - \
-+ (unsigned long)netdev_priv(NULL)))
-+
-+struct net_device * veth_dev_start(char *dev_addr, char *name);
-+
-+struct veth_struct *hwaddr_entry_lookup(char *name)
-+{
-+ struct veth_struct *entry;
-+ struct list_head *tmp;
-+
-+ list_for_each(tmp, &veth_hwaddr_list) {
-+ entry = list_entry(tmp, struct veth_struct, hwaddr_list);
-+ BUG_ON(entry->pair == NULL);
-+ if (strncmp(name, entry->pair->name, IFNAMSIZ) == 0)
-+ return entry;
-+ }
-+ return NULL;
-+}
-+
-+int veth_entry_add(struct ve_struct *ve, char *dev_addr, char *name,
-+ char *dev_addr_ve, char *name_ve)
-+{
-+ struct net_device *dev_ve;
-+ struct net_device *dev_ve0;
-+ struct ve_struct *old_env;
-+ char dev_name[IFNAMSIZ];
-+ int err;
-+
-+ down(&hwaddr_sem);
-+
-+ if (name[0] == '\0')
-+ snprintf(dev_name, sizeof(dev_name), "vz%d.%%d", ve->veid);
-+ else {
-+ memcpy(dev_name, name, IFNAMSIZ);
-+ dev_name[IFNAMSIZ - 1] = '\0';
-+ }
-+ dev_ve0 = veth_dev_start(dev_addr, dev_name);
-+ if (IS_ERR(dev_ve0)) {
-+ err = PTR_ERR(dev_ve0);
-+ goto err;
-+ }
-+
-+ old_env = set_exec_env(ve);
-+ if (name_ve[0] == '\0')
-+ sprintf(dev_name, "eth%%d");
-+ else {
-+ memcpy(dev_name, name_ve, IFNAMSIZ);
-+ dev_name[IFNAMSIZ - 1] = '\0';
-+ }
-+ dev_ve = veth_dev_start(dev_addr_ve, dev_name);
-+ if (IS_ERR(dev_ve)) {
-+ err = PTR_ERR(dev_ve);
-+ goto err_ve;
-+ }
-+ set_exec_env(old_env);
-+ veth_from_netdev(dev_ve)->pair = dev_ve0;
-+ veth_from_netdev(dev_ve0)->pair = dev_ve;
-+
-+ write_lock(&ve_hwaddr_lock);
-+ list_add(&(veth_from_netdev(dev_ve)->hwaddr_list), &veth_hwaddr_list);
-+ write_unlock(&ve_hwaddr_lock);
-+
-+ up(&hwaddr_sem);
-+ return 0;
-+
-+err_ve:
-+ set_exec_env(old_env);
-+ unregister_netdev(dev_ve0);
-+err:
-+ up(&hwaddr_sem);
-+ return err;
-+}
-+
-+int veth_entry_del(struct ve_struct *ve, char *name)
-+{
-+ struct veth_struct *found;
-+ struct ve_struct *old_env;
-+ struct net_device *dev;
-+ int err;
-+
-+ err = -ENODEV;
-+ down(&hwaddr_sem);
-+ found = hwaddr_entry_lookup(name);
-+ if (found == NULL)
-+ goto out;
-+ if (veth_to_netdev(found)->owner_env != ve)
-+ goto out;
-+
-+ write_lock(&ve_hwaddr_lock);
-+ list_del(&found->hwaddr_list);
-+ write_unlock(&ve_hwaddr_lock);
-+ err = 0;
-+ dev = found->pair;
-+ BUG_ON(found->pair == NULL);
-+
-+ old_env = get_exec_env();
-+ set_exec_env(ve);
-+ unregister_netdev(veth_to_netdev(found));
-+ set_exec_env(old_env);
-+
-+ unregister_netdev(dev);
-+
-+out:
-+ up(&hwaddr_sem);
-+ return err;
-+}
-+
-+/*
-+ * Device functions
-+ */
-+
-+static int veth_open(struct net_device *dev)
-+{
-+ return 0;
-+}
-+
-+static int veth_close(struct net_device *master)
-+{
-+ return 0;
-+}
-+
-+static void veth_destructor(struct net_device *dev)
-+{
-+ free_netdev(dev);
-+}
-+
-+static struct net_device_stats *get_stats(struct net_device *dev)
-+{
-+ return &veth_from_netdev(dev)->stats;
-+}
-+
-+/*
-+ * The higher levels take care of making this non-reentrant (it's
-+ * called with bh's disabled).
-+ */
-+static int veth_xmit(struct sk_buff *skb, struct net_device *dev)
-+{
-+ struct net_device_stats *stats = get_stats(dev);
-+ struct net_device *rcv = NULL;
-+ struct veth_struct *entry;
-+ int length;
-+
-+ if (unlikely(get_exec_env()->disable_net))
-+ goto outf;
-+
-+ skb_orphan(skb);
-+
-+ entry = veth_from_netdev(dev);
-+ rcv = entry->pair;
-+ if (!rcv)
-+ /* VE going down */
-+ goto outf;
-+
-+ if (unlikely(rcv->owner_env->disable_net))
-+ goto outf;
-+
-+ skb->owner_env = rcv->owner_env;
-+
-+ if (!(rcv->flags & IFF_UP)) {
-+ /* Target VE does not want to receive packets */
-+ goto outf;
-+ }
-+
-+ skb->dev = rcv;
-+ skb->pkt_type = PACKET_HOST;
-+ skb->protocol = eth_type_trans(skb, rcv);
-+
-+ dst_release(skb->dst);
-+ skb->dst = NULL;
-+#ifdef CONFIG_NETFILTER
-+ nf_conntrack_put(skb->nfct);
-+ skb->nfct = NULL;
-+#ifdef CONFIG_NETFILTER_DEBUG
-+ skb->nf_debug = 0;
-+#endif
-+#endif
-+ length = skb->len;
-+
-+ netif_rx(skb);
-+
-+ stats->tx_bytes += length;
-+ stats->tx_packets++;
-+ if (rcv) {
-+ struct net_device_stats *rcv_stats = get_stats(rcv);
-+ rcv_stats->rx_bytes += length;
-+ rcv_stats->rx_packets++;
-+ }
-+
-+ return 0;
-+
-+outf:
-+ kfree_skb(skb);
-+ stats->tx_dropped++;
-+ return 0;
-+}
-+
-+int veth_init_dev(struct net_device *dev)
-+{
-+ dev->hard_start_xmit = veth_xmit;
-+ dev->get_stats = get_stats;
-+ dev->open = veth_open;
-+ dev->stop = veth_close;
-+ dev->destructor = veth_destructor;
-+
-+ ether_setup(dev);
-+
-+ /* remove setted by ether_setup() handler */
-+ dev->change_mtu = NULL;
-+
-+ dev->tx_queue_len = 0;
-+ return 0;
-+}
-+
-+static void veth_setup(struct net_device *dev)
-+{
-+ dev->init = veth_init_dev;
-+ /*
-+ * No other features, as they are:
-+ * - checksumming is required, and nobody else will done our job
-+ */
-+ dev->features |= NETIF_F_VENET | NETIF_F_VIRTUAL | NETIF_F_LLTX;
-+}
-+
-+#ifdef CONFIG_PROC_FS
-+#define ADDR_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
-+#define ADDR(x) (x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5]
-+static int vehwaddr_seq_show(struct seq_file *m, void *v)
-+{
-+ struct list_head *p;
-+ struct veth_struct *entry;
-+
-+ p = (struct list_head *)v;
-+ if (p == &veth_hwaddr_list) {
-+ seq_puts(m, "Version: 1.0\n");
-+ return 0;
-+ }
-+ entry = list_entry(p, struct veth_struct, hwaddr_list);
-+ seq_printf(m, ADDR_FMT " %16s ",
-+ ADDR(entry->pair->dev_addr), entry->pair->name);
-+ seq_printf(m, ADDR_FMT " %16s %10u\n",
-+ ADDR(veth_to_netdev(entry)->dev_addr),
-+ veth_to_netdev(entry)->name,
-+ VEID(veth_to_netdev(entry)->owner_env));
-+ return 0;
-+}
-+
-+static void *vehwaddr_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ loff_t l;
-+ struct list_head *p;
-+
-+ l = *pos;
-+ read_lock(&ve_hwaddr_lock);
-+ if (l == 0)
-+ return &veth_hwaddr_list;
-+ list_for_each(p, &veth_hwaddr_list) {
-+ if (--l == 0)
-+ return p;
-+ }
-+ return NULL;
-+}
-+
-+static void *vehwaddr_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ struct list_head *p;
-+
-+ p = (struct list_head *)v;
-+ (*pos)++;
-+ return p->next == &veth_hwaddr_list ? NULL : p->next;
-+}
-+
-+static void vehwaddr_seq_stop(struct seq_file *m, void *v)
-+{
-+ read_unlock(&ve_hwaddr_lock);
-+}
-+
-+static struct seq_operations vehwaddr_seq_op = {
-+ .start = vehwaddr_seq_start,
-+ .next = vehwaddr_seq_next,
-+ .stop = vehwaddr_seq_stop,
-+ .show = vehwaddr_seq_show
-+};
-+
-+static int vehwaddr_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &vehwaddr_seq_op);
-+}
-+
-+static struct file_operations proc_vehwaddr_operations = {
-+ .open = vehwaddr_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release
-+};
-+#endif
-+
-+int real_ve_hwaddr(envid_t veid, int op,
-+ unsigned char *dev_addr, int addrlen, char *name,
-+ unsigned char *dev_addr_ve, int addrlen_ve, char *name_ve)
-+{
-+ int err;
-+ struct ve_struct *ve;
-+ char ve_addr[ETH_ALEN];
-+
-+ err = -EPERM;
-+ if (!capable(CAP_NET_ADMIN))
-+ goto out;
-+
-+ err = -EINVAL;
-+ switch (op)
-+ {
-+ case VE_ETH_ADD:
-+ if (addrlen != ETH_ALEN)
-+ goto out;
-+ if (addrlen_ve != ETH_ALEN && addrlen_ve != 0)
-+ goto out;
-+ /* If ve addr is not set then we use dev_addr[3] & 0x80 for it */
-+ if (addrlen_ve == 0 && (dev_addr[3] & 0x80))
-+ goto out;
-+ if (addrlen_ve == 0) {
-+ memcpy(ve_addr, dev_addr, ETH_ALEN);
-+ ve_addr[3] |= 0x80;
-+ } else {
-+ memcpy(ve_addr, dev_addr_ve, ETH_ALEN);
-+ }
-+
-+ ve = get_ve_by_id(veid);
-+ err = -ESRCH;
-+ if (!ve)
-+ goto out;
-+
-+ down_read(&ve->op_sem);
-+ if (ve->is_running)
-+ err = veth_entry_add(ve, dev_addr, name,
-+ ve_addr, name_ve);
-+ up_read(&ve->op_sem);
-+ put_ve(ve);
-+ break;
-+
-+ case VE_ETH_DEL:
-+ if (name[0] == '\0')
-+ goto out;
-+ ve = get_ve_by_id(veid);
-+ err = -ESRCH;
-+ if (!ve)
-+ goto out;
-+
-+ down_read(&ve->op_sem);
-+ if (ve->is_running)
-+ err = veth_entry_del(ve, name);
-+ up_read(&ve->op_sem);
-+ put_ve(ve);
-+ break;
-+ }
-+
-+out:
-+ return err;
-+}
-+
-+int veth_ioctl(struct inode *ino, struct file *file, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ int err;
-+
-+ err = -ENOTTY;
-+ switch(cmd) {
-+ case VETHCTL_VE_HWADDR: {
-+ struct vzctl_ve_hwaddr s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = real_ve_hwaddr(s.veid, s.op,
-+ s.dev_addr, s.addrlen, s.dev_name,
-+ s.dev_addr_ve, s.addrlen_ve, s.dev_name_ve);
-+ }
-+ break;
-+ }
-+ return err;
-+}
-+
-+static struct vzioctlinfo vethcalls = {
-+ .type = VETHCTLTYPE,
-+ .func = veth_ioctl,
-+ .owner = THIS_MODULE,
-+};
-+
-+struct net_device * veth_dev_start(char *dev_addr, char *name)
-+{
-+ struct net_device *dev;
-+ int err;
-+
-+ dev = alloc_netdev(sizeof(struct veth_struct), name, veth_setup);
-+ if (!dev)
-+ return ERR_PTR(-ENOMEM);
-+ if (strchr(dev->name, '%')) {
-+ err = dev_alloc_name(dev, dev->name);
-+ if (err < 0)
-+ goto err;
-+ }
-+ if ((err = register_netdev(dev)) != 0)
-+ goto err;
-+
-+ memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
-+ dev->addr_len = ETH_ALEN;
-+
-+ return dev;
-+err:
-+ free_netdev(dev);
-+ printk(KERN_ERR "%s initialization error err=%d\n", name, err);
-+ return ERR_PTR(err);
-+}
-+
-+static int veth_stop(unsigned int hooknum, void *data)
-+{
-+ struct ve_struct *old_env;
-+ struct ve_struct *env;
-+ struct list_head *tmp, *n;
-+
-+ env = (struct ve_struct *)data;
-+ down(&hwaddr_sem);
-+ list_for_each_safe(tmp, n, &veth_hwaddr_list) {
-+ struct veth_struct *entry;
-+ struct net_device *dev;
-+ entry = list_entry(tmp, struct veth_struct, hwaddr_list);
-+ if (VEID(env) != VEID(veth_to_netdev(entry)->owner_env))
-+ continue;
-+
-+ write_lock(&ve_hwaddr_lock);
-+ list_del(&entry->hwaddr_list);
-+ write_unlock(&ve_hwaddr_lock);
-+
-+ dev = entry->pair;
-+ BUG_ON(entry->pair == NULL);
-+ old_env = set_exec_env(env);
-+ unregister_netdev(veth_to_netdev(entry));
-+ set_exec_env(old_env);
-+
-+ old_env = set_exec_env(get_ve0());
-+ unregister_netdev(dev);
-+ set_exec_env(old_env);
-+ }
-+ up(&hwaddr_sem);
-+ return 0;
-+}
-+
-+#define VE_HOOK_PRI_NET 0
-+
-+static struct ve_hook veth_ve_hook_fini = {
-+ .hook = veth_stop,
-+ .hooknum = VE_HOOK_FINI,
-+ .priority = VE_HOOK_PRI_NET,
-+ .owner = THIS_MODULE,
-+};
-+
-+__init int veth_init(void)
-+{
-+#ifdef CONFIG_PROC_FS
-+ struct proc_dir_entry *de;
-+#endif
-+
-+ INIT_LIST_HEAD(&veth_hwaddr_list);
-+
-+#ifdef CONFIG_PROC_FS
-+ de = create_proc_entry("vz/veth",
-+ S_IFREG|S_IRUSR, NULL);
-+ if (de)
-+ de->proc_fops = &proc_vehwaddr_operations;
-+ else
-+ printk(KERN_WARNING "veth: can't make vehwaddr proc entry\n");
-+
-+#endif
-+
-+ ve_hook_register(&veth_ve_hook_fini);
-+ vzioctl_register(&vethcalls);
-+ KSYMRESOLVE(veth_open);
-+ KSYMMODRESOLVE(vzethdev);
-+ return 0;
-+}
-+
-+__exit void veth_exit(void)
-+{
-+ struct veth_struct *entry;
-+ struct list_head *tmp, *n;
-+ struct ve_struct *ve;
-+ struct ve_struct *old_env;
-+
-+ KSYMMODUNRESOLVE(vzethdev);
-+ KSYMUNRESOLVE(veth_open);
-+ vzioctl_unregister(&vethcalls);
-+ ve_hook_unregister(&veth_ve_hook_fini);
-+#ifdef CONFIG_PROC_FS
-+ remove_proc_entry("vz/veth", NULL);
-+#endif
-+
-+ down(&hwaddr_sem);
-+ list_for_each_safe(tmp, n, &veth_hwaddr_list) {
-+ struct net_device *dev;
-+ entry = list_entry(tmp, struct veth_struct, hwaddr_list);
-+ ve = get_ve(veth_to_netdev(entry)->owner_env);
-+
-+ write_lock(&ve_hwaddr_lock);
-+ list_del(&entry->hwaddr_list);
-+ write_unlock(&ve_hwaddr_lock);
-+
-+ dev = entry->pair;
-+ BUG_ON(entry->pair == NULL);
-+ old_env = set_exec_env(ve);
-+ unregister_netdev(veth_to_netdev(entry));
-+ set_exec_env(old_env);
-+
-+ unregister_netdev(dev);
-+
-+ put_ve(ve);
-+ }
-+ up(&hwaddr_sem);
-+}
-+
-+module_init(veth_init);
-+module_exit(veth_exit);
-+
-+MODULE_AUTHOR("Andrey Mirkin <amirkin@sw.ru>");
-+MODULE_DESCRIPTION("Virtuozzo Virtual Ethernet Device");
-+MODULE_LICENSE("GPL v2");
-+
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/net/wireless/airo.c linux-2.6.9-ve023stab030/drivers/net/wireless/airo.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/net/wireless/airo.c 2004-10-19 01:53:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/net/wireless/airo.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2915,8 +2915,8 @@ static int airo_thread(void *data) {
- flush_signals(current);
-
- /* make swsusp happy with our thread */
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- if (test_bit(JOB_DIE, &ai->flags))
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/pci/probe.c linux-2.6.9-ve023stab030/drivers/pci/probe.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/pci/probe.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/pci/probe.c 2006-10-11 19:07:57.000000000 +0400
-@@ -26,6 +26,7 @@ LIST_HEAD(pci_root_buses);
- EXPORT_SYMBOL(pci_root_buses);
-
- LIST_HEAD(pci_devices);
-+EXPORT_SYMBOL(pci_devices);
-
- /*
- * PCI Bus Class
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/pcmcia/cs.c linux-2.6.9-ve023stab030/drivers/pcmcia/cs.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/pcmcia/cs.c 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/pcmcia/cs.c 2006-10-11 19:07:55.000000000 +0400
-@@ -714,8 +714,8 @@ static int pccardd(void *__skt)
- }
-
- schedule();
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- if (!skt->thread)
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/sbus/char/bbc_envctrl.c linux-2.6.9-ve023stab030/drivers/sbus/char/bbc_envctrl.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/sbus/char/bbc_envctrl.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/sbus/char/bbc_envctrl.c 2006-10-11 19:07:57.000000000 +0400
-@@ -613,7 +613,7 @@ void bbc_envctrl_cleanup(void)
- int found = 0;
-
- read_lock(&tasklist_lock);
-- for_each_process(p) {
-+ for_each_process_all(p) {
- if (p == kenvctrld_task) {
- found = 1;
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/sbus/char/envctrl.c linux-2.6.9-ve023stab030/drivers/sbus/char/envctrl.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/sbus/char/envctrl.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/sbus/char/envctrl.c 2006-10-11 19:07:57.000000000 +0400
-@@ -1151,7 +1151,7 @@ static void __exit envctrl_cleanup(void)
- int found = 0;
-
- read_lock(&tasklist_lock);
-- for_each_process(p) {
-+ for_each_process_all(p) {
- if (p == kenvctrld_task) {
- found = 1;
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/aic7xxx/aic79xx_osm.c linux-2.6.9-ve023stab030/drivers/scsi/aic7xxx/aic79xx_osm.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/aic7xxx/aic79xx_osm.c 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/aic7xxx/aic79xx_osm.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2600,7 +2600,6 @@ ahd_linux_dv_thread(void *data)
- sprintf(current->comm, "ahd_dv_%d", ahd->unit);
- #else
- daemonize("ahd_dv_%d", ahd->unit);
-- current->flags |= PF_FREEZE;
- #endif
- unlock_kernel();
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/aic7xxx/aic7xxx_osm.c linux-2.6.9-ve023stab030/drivers/scsi/aic7xxx/aic7xxx_osm.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/aic7xxx/aic7xxx_osm.c 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/aic7xxx/aic7xxx_osm.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2300,7 +2300,6 @@ ahc_linux_dv_thread(void *data)
- sprintf(current->comm, "ahc_dv_%d", ahc->unit);
- #else
- daemonize("ahc_dv_%d", ahc->unit);
-- current->flags |= PF_FREEZE;
- #endif
- unlock_kernel();
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/lpfc/Makefile linux-2.6.9-ve023stab030/drivers/scsi/lpfc/Makefile
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/lpfc/Makefile 2006-10-11 18:29:47.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/lpfc/Makefile 2006-10-11 19:07:56.000000000 +0400
-@@ -6,6 +6,10 @@ lpfc-objs := lpfc_mem.o lpfc_sli.o lpfc_
- lpfc_hbadisc.o lpfc_init.o lpfc_mbox.o lpfc_nportdisc.o lpfc_scsiport.o \
- lpfc_fcp.o
-
--lpfcdfc-objs := lpfc_cdev.o lpfc_ct.o lpfc_debug_ioctl.o lpfc_els.o \
--lpfc_hbaapi_ioctl.o lpfc_hbadisc.o lpfc_init.o lpfc_mbox.o lpfc_mem.o \
--lpfc_misc.o lpfc_nportdisc.o lpfc_scsiport.o lpfc_sli.o lpfc_util_ioctl.o
-+lpfcdfc-objs := lpfc_cdev.o lpfc_debug_ioctl.o lpfc_hbaapi_ioctl.o \
-+lpfc_misc.o lpfc_util_ioctl.o
-+
-+ifeq ($(CONFIG_SCSI_LPFC), m)
-+lpfcdfc-objs += lpfc_ct.o lpfc_els.o lpfc_hbadisc.o lpfc_init.o lpfc_mbox.o \
-+lpfc_mem.o lpfc_nportdisc.o lpfc_scsiport.o lpfc_sli.o
-+endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/lpfc/lpfc_fcp.c linux-2.6.9-ve023stab030/drivers/scsi/lpfc/lpfc_fcp.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/lpfc/lpfc_fcp.c 2006-10-11 18:29:47.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/lpfc/lpfc_fcp.c 2006-10-11 19:07:56.000000000 +0400
-@@ -60,7 +60,7 @@ static char *lpfc_drvr_name = LPFC_DRIVE
-
- static struct scsi_transport_template *lpfc_transport_template = NULL;
-
--static struct list_head lpfc_hba_list = LIST_HEAD_INIT(lpfc_hba_list);
-+struct list_head lpfc_hba_list = LIST_HEAD_INIT(lpfc_hba_list);
-
- static const char *
- lpfc_info(struct Scsi_Host *host)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/scsi_error.c linux-2.6.9-ve023stab030/drivers/scsi/scsi_error.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/scsi_error.c 2006-10-11 18:29:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/scsi_error.c 2006-10-11 19:07:55.000000000 +0400
-@@ -561,7 +561,7 @@ static int scsi_request_sense(struct scs
-
- memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense));
-
-- scsi_result = kmalloc(252, GFP_ATOMIC | (scmd->device->host->hostt->unchecked_isa_dma) ? __GFP_DMA : 0);
-+ scsi_result = kmalloc(252, GFP_ATOMIC | ((scmd->device->host->hostt->unchecked_isa_dma) ? __GFP_DMA : 0));
-
-
- if (unlikely(!scsi_result)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/scsi/scsi_scan.c linux-2.6.9-ve023stab030/drivers/scsi/scsi_scan.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/scsi/scsi_scan.c 2006-10-11 18:29:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/scsi/scsi_scan.c 2006-10-11 19:07:55.000000000 +0400
-@@ -688,7 +688,7 @@ static int scsi_probe_and_add_lun(struct
- if (!sreq)
- goto out_free_sdev;
- result = kmalloc(256, GFP_ATOMIC |
-- (host->unchecked_isa_dma) ? __GFP_DMA : 0);
-+ ((host->unchecked_isa_dma) ? __GFP_DMA : 0));
- if (!result)
- goto out_free_sreq;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/serial/8250.c linux-2.6.9-ve023stab030/drivers/serial/8250.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/serial/8250.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/serial/8250.c 2006-10-11 19:07:55.000000000 +0400
-@@ -20,27 +20,28 @@
- * membase is an 'ioremapped' cookie.
- */
- #include <linux/config.h>
-+#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-+#define SUPPORT_SYSRQ
-+#endif
-+
- #include <linux/module.h>
- #include <linux/moduleparam.h>
--#include <linux/tty.h>
- #include <linux/ioport.h>
- #include <linux/init.h>
- #include <linux/console.h>
- #include <linux/sysrq.h>
-+#include <linux/delay.h>
-+#include <linux/device.h>
-+#include <linux/tty.h>
-+#include <linux/tty_flip.h>
- #include <linux/serial_reg.h>
-+#include <linux/serial_core.h>
- #include <linux/serial.h>
- #include <linux/serialP.h>
--#include <linux/delay.h>
--#include <linux/device.h>
-
- #include <asm/io.h>
- #include <asm/irq.h>
-
--#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
--#define SUPPORT_SYSRQ
--#endif
--
--#include <linux/serial_core.h>
- #include "8250.h"
-
- /*
-@@ -875,16 +876,22 @@ receive_chars(struct uart_8250_port *up,
- struct tty_struct *tty = up->port.info->tty;
- unsigned char ch;
- int max_count = 256;
-+ char flag;
-
- do {
-+ /* The following is not allowed by the tty layer and
-+ unsafe. It should be fixed ASAP */
- if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
-- tty->flip.work.func((void *)tty);
-- if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-- return; // if TTY_DONT_FLIP is set
-+ if(tty->low_latency) {
-+ spin_unlock(&up->port.lock);
-+ tty_flip_buffer_push(tty);
-+ spin_lock(&up->port.lock);
-+ }
-+ /* If this failed then we will throw away the
-+ bytes but must do so to clear interrupts */
- }
- ch = serial_inp(up, UART_RX);
-- *tty->flip.char_buf_ptr = ch;
-- *tty->flip.flag_buf_ptr = TTY_NORMAL;
-+ flag = TTY_NORMAL;
- up->port.icount.rx++;
-
- if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE |
-@@ -924,35 +931,30 @@ receive_chars(struct uart_8250_port *up,
- #endif
- if (*status & UART_LSR_BI) {
- DEBUG_INTR("handling break....");
-- *tty->flip.flag_buf_ptr = TTY_BREAK;
-+ flag = TTY_BREAK;
- } else if (*status & UART_LSR_PE)
-- *tty->flip.flag_buf_ptr = TTY_PARITY;
-+ flag = TTY_PARITY;
- else if (*status & UART_LSR_FE)
-- *tty->flip.flag_buf_ptr = TTY_FRAME;
-+ flag = TTY_FRAME;
- }
- if (uart_handle_sysrq_char(&up->port, ch, regs))
- goto ignore_char;
-- if ((*status & up->port.ignore_status_mask) == 0) {
-- tty->flip.flag_buf_ptr++;
-- tty->flip.char_buf_ptr++;
-- tty->flip.count++;
-- }
-+ if ((*status & up->port.ignore_status_mask) == 0)
-+ tty_insert_flip_char(tty, ch, flag);
- if ((*status & UART_LSR_OE) &&
-- tty->flip.count < TTY_FLIPBUF_SIZE) {
-+ tty->flip.count < TTY_FLIPBUF_SIZE)
- /*
- * Overrun is special, since it's reported
- * immediately, and doesn't affect the current
- * character.
- */
-- *tty->flip.flag_buf_ptr = TTY_OVERRUN;
-- tty->flip.flag_buf_ptr++;
-- tty->flip.char_buf_ptr++;
-- tty->flip.count++;
-- }
-+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
- ignore_char:
- *status = serial_inp(up, UART_LSR);
- } while ((*status & UART_LSR_DR) && (max_count-- > 0));
-+ spin_unlock(&up->port.lock);
- tty_flip_buffer_push(tty);
-+ spin_lock(&up->port.lock);
- }
-
- static _INLINE_ void transmit_chars(struct uart_8250_port *up)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/usb/core/devio.c linux-2.6.9-ve023stab030/drivers/usb/core/devio.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/usb/core/devio.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/usb/core/devio.c 2006-10-11 19:07:57.000000000 +0400
-@@ -502,7 +502,7 @@ static int usbdev_open(struct inode *ino
- INIT_LIST_HEAD(&ps->async_completed);
- init_waitqueue_head(&ps->wait);
- ps->discsignr = 0;
-- ps->disc_pid = current->pid;
-+ ps->disc_pid = virt_pid(current);
- ps->disc_uid = current->uid;
- ps->disc_euid = current->euid;
- ps->disccontext = NULL;
-@@ -958,7 +958,7 @@ static int proc_submiturb(struct dev_sta
- as->userbuffer = NULL;
- as->signr = uurb.signr;
- as->ifnum = ifnum;
-- as->pid = current->pid;
-+ as->pid = virt_pid(current);
- as->uid = current->uid;
- as->euid = current->euid;
- if (!(uurb.endpoint & USB_DIR_IN)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/usb/core/hub.c linux-2.6.9-ve023stab030/drivers/usb/core/hub.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/usb/core/hub.c 2006-10-11 18:29:42.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/usb/core/hub.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2622,8 +2622,8 @@ static int hub_thread(void *__unused)
- do {
- hub_events();
- wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- } while (!signal_pending(current));
-
- pr_debug ("%s: khubd exiting\n", usbcore_name);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/drivers/w1/w1.c linux-2.6.9-ve023stab030/drivers/w1/w1.c
---- linux-2.6.9-42.0.3.EL.orig/drivers/w1/w1.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/drivers/w1/w1.c 2006-10-11 19:07:55.000000000 +0400
-@@ -617,8 +617,8 @@ int w1_control(void *data)
- timeout = w1_timeout*HZ;
- do {
- timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- } while (!signal_pending(current) && (timeout > 0));
-
- if (signal_pending(current))
-@@ -690,8 +690,8 @@ int w1_process(void *data)
- timeout = w1_timeout*HZ;
- do {
- timeout = interruptible_sleep_on_timeout(&dev->kwait, timeout);
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- } while (!signal_pending(current) && (timeout > 0));
-
- if (signal_pending(current))
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/afs/mntpt.c linux-2.6.9-ve023stab030/fs/afs/mntpt.c
---- linux-2.6.9-42.0.3.EL.orig/fs/afs/mntpt.c 2004-10-19 01:53:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/afs/mntpt.c 2006-10-11 19:07:57.000000000 +0400
-@@ -162,6 +162,7 @@ static struct vfsmount *afs_mntpt_do_aut
- char *buf, *devname = NULL, *options = NULL;
- filler_t *filler;
- int ret;
-+ struct file_system_type *fstype;
-
- kenter("{%s}", mntpt->d_name.name);
-
-@@ -210,7 +211,12 @@ static struct vfsmount *afs_mntpt_do_aut
-
- /* try and do the mount */
- kdebug("--- attempting mount %s -o %s ---", devname, options);
-- mnt = do_kern_mount("afs", 0, devname, options);
-+ fstype = get_fs_type("afs");
-+ ret = -ENODEV;
-+ if (!fstype)
-+ goto error;
-+ mnt = do_kern_mount(fstype, 0, devname, options);
-+ put_filesystem(fstype);
- kdebug("--- mount result %p ---", mnt);
-
- free_page((unsigned long) devname);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/aio.c linux-2.6.9-ve023stab030/fs/aio.c
---- linux-2.6.9-42.0.3.EL.orig/fs/aio.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/aio.c 2006-10-11 19:07:59.000000000 +0400
-@@ -44,11 +44,13 @@ long aio_wakeups = 0; /* for testing onl
-
- /*------ sysctl variables----*/
- atomic_t aio_nr = ATOMIC_INIT(0); /* current system wide number of aio requests */
-+EXPORT_SYMBOL(aio_nr);
- unsigned aio_max_nr = 0x10000; /* system wide maximum number of aio requests */
- /*----end sysctl variables---*/
-
- static kmem_cache_t *kiocb_cachep;
- static kmem_cache_t *kioctx_cachep;
-+EXPORT_SYMBOL(kioctx_cachep);
-
- static struct workqueue_struct *aio_wq;
-
-@@ -308,6 +310,7 @@ void wait_for_all_aios(struct kioctx *ct
- __set_task_state(tsk, TASK_RUNNING);
- remove_wait_queue(&ctx->wait, &wait);
- }
-+EXPORT_SYMBOL(wait_for_all_aios);
-
- /* wait_on_sync_kiocb:
- * Waits on the given sync kiocb to complete.
-@@ -871,6 +874,7 @@ static void aio_kick_handler(void *data)
- if (requeue)
- queue_work(aio_wq, &ctx->wq);
- }
-+EXPORT_SYMBOL(aio_kick_handler);
-
-
- /*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs/autofs_i.h linux-2.6.9-ve023stab030/fs/autofs/autofs_i.h
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs/autofs_i.h 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs/autofs_i.h 2006-10-11 19:07:57.000000000 +0400
-@@ -123,7 +123,7 @@ static inline struct autofs_sb_info *aut
- filesystem without "magic".) */
-
- static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
-- return sbi->catatonic || process_group(current) == sbi->oz_pgrp;
-+ return sbi->catatonic || virt_pgid(current) == sbi->oz_pgrp;
- }
-
- /* Hash operations */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs/init.c linux-2.6.9-ve023stab030/fs/autofs/init.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs/init.c 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs/init.c 2006-10-11 19:07:57.000000000 +0400
-@@ -25,6 +25,7 @@ static struct file_system_type autofs_fs
- .name = "autofs",
- .get_sb = autofs_get_sb,
- .kill_sb = kill_anon_super,
-+ .fs_flags = FS_VIRTUALIZED,
- };
-
- static int __init init_autofs_fs(void)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs/inode.c linux-2.6.9-ve023stab030/fs/autofs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs/inode.c 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -66,7 +66,7 @@ static int parse_options(char *options,
-
- *uid = current->uid;
- *gid = current->gid;
-- *pgrp = process_group(current);
-+ *pgrp = virt_pgid(current);
-
- *minproto = *maxproto = AUTOFS_PROTO_VERSION;
-
-@@ -138,7 +138,7 @@ int autofs_fill_super(struct super_block
- sbi->magic = AUTOFS_SBI_MAGIC;
- sbi->catatonic = 0;
- sbi->exp_timeout = 0;
-- sbi->oz_pgrp = process_group(current);
-+ sbi->oz_pgrp = virt_pgid(current);
- autofs_initialize_hash(&sbi->dirhash);
- sbi->queues = NULL;
- memset(sbi->symlink_bitmap, 0, sizeof(long)*AUTOFS_SYMLINK_BITMAP_LEN);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs/root.c linux-2.6.9-ve023stab030/fs/autofs/root.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs/root.c 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs/root.c 2006-10-11 19:07:57.000000000 +0400
-@@ -353,7 +353,7 @@ static int autofs_root_unlink(struct ino
-
- /* This allows root to remove symlinks */
- lock_kernel();
-- if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) {
-+ if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_SYS_ADMIN) ) {
- unlock_kernel();
- return -EACCES;
- }
-@@ -540,7 +540,7 @@ static int autofs_root_ioctl(struct inod
- _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT )
- return -ENOTTY;
-
-- if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) )
-+ if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_SYS_ADMIN) )
- return -EPERM;
-
- switch(cmd) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs4/autofs_i.h linux-2.6.9-ve023stab030/fs/autofs4/autofs_i.h
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs4/autofs_i.h 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs4/autofs_i.h 2006-10-11 19:07:57.000000000 +0400
-@@ -83,6 +83,7 @@ struct autofs_wait_queue {
-
- struct autofs_sb_info {
- u32 magic;
-+ struct dentry *root;
- struct file *pipe;
- pid_t oz_pgrp;
- int catatonic;
-@@ -112,7 +113,7 @@ static inline struct autofs_info *autofs
- filesystem without "magic".) */
-
- static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) {
-- return sbi->catatonic || process_group(current) == sbi->oz_pgrp;
-+ return sbi->catatonic || virt_pgid(current) == sbi->oz_pgrp;
- }
-
- /* Does a dentry have some pending activity? */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs4/init.c linux-2.6.9-ve023stab030/fs/autofs4/init.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs4/init.c 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs4/init.c 2006-10-11 19:07:57.000000000 +0400
-@@ -25,6 +25,7 @@ static struct file_system_type autofs_fs
- .name = "autofs",
- .get_sb = autofs_get_sb,
- .kill_sb = kill_anon_super,
-+ .fs_flags = FS_VIRTUALIZED,
- };
-
- static int __init init_autofs4_fs(void)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs4/inode.c linux-2.6.9-ve023stab030/fs/autofs4/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs4/inode.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs4/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -16,6 +16,7 @@
- #include <linux/pagemap.h>
- #include <linux/parser.h>
- #include <asm/bitops.h>
-+#include <linux/smp_lock.h>
- #include "autofs_i.h"
- #include <linux/module.h>
-
-@@ -76,6 +77,66 @@ void autofs4_free_ino(struct autofs_info
- kfree(ino);
- }
-
-+/*
-+ * Deal with the infamous "Busy inodes after umount ..." message.
-+ *
-+ * Clean up the dentry tree. This happens with autofs if the user
-+ * space program goes away due to a SIGKILL, SIGSEGV etc.
-+ */
-+static void autofs4_force_release(struct autofs_sb_info *sbi)
-+{
-+ struct dentry *this_parent = sbi->root;
-+ struct list_head *next;
-+
-+ spin_lock(&dcache_lock);
-+repeat:
-+ next = this_parent->d_subdirs.next;
-+resume:
-+ while (next != &this_parent->d_subdirs) {
-+ struct dentry *dentry = list_entry(next, struct dentry, d_child);
-+
-+ /* Negative dentry - don`t care */
-+ if (!simple_positive(dentry)) {
-+ next = next->next;
-+ continue;
-+ }
-+
-+ if (!list_empty(&dentry->d_subdirs)) {
-+ this_parent = dentry;
-+ goto repeat;
-+ }
-+
-+ next = next->next;
-+ spin_unlock(&dcache_lock);
-+
-+ DPRINTK("dentry %p %.*s",
-+ dentry, (int)dentry->d_name.len, dentry->d_name.name);
-+
-+ dput(dentry);
-+ spin_lock(&dcache_lock);
-+ }
-+
-+ if (this_parent != sbi->root) {
-+ struct dentry *dentry = this_parent;
-+
-+ next = this_parent->d_child.next;
-+ this_parent = this_parent->d_parent;
-+ spin_unlock(&dcache_lock);
-+ DPRINTK("parent dentry %p %.*s",
-+ dentry, (int)dentry->d_name.len, dentry->d_name.name);
-+ dput(dentry);
-+ spin_lock(&dcache_lock);
-+ goto resume;
-+ }
-+ spin_unlock(&dcache_lock);
-+
-+ dput(sbi->root);
-+ sbi->root = NULL;
-+ shrink_dcache_sb(sbi->sb);
-+
-+ return;
-+}
-+
- static void autofs4_put_super(struct super_block *sb)
- {
- struct autofs_sb_info *sbi = autofs4_sbi(sb);
-@@ -85,6 +146,10 @@ static void autofs4_put_super(struct sup
- if ( !sbi->catatonic )
- autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */
-
-+ /* Clean up and release dangling references */
-+ if (sbi)
-+ autofs4_force_release(sbi);
-+
- kfree(sbi);
-
- DPRINTK("shutting down");
-@@ -116,7 +181,7 @@ static int parse_options(char *options,
-
- *uid = current->uid;
- *gid = current->gid;
-- *pgrp = process_group(current);
-+ *pgrp = virt_pgid(current);
-
- *minproto = AUTOFS_MIN_PROTO_VERSION;
- *maxproto = AUTOFS_MAX_PROTO_VERSION;
-@@ -199,9 +264,10 @@ int autofs4_fill_super(struct super_bloc
-
- s->s_fs_info = sbi;
- sbi->magic = AUTOFS_SBI_MAGIC;
-+ sbi->root = NULL;
- sbi->catatonic = 0;
- sbi->exp_timeout = 0;
-- sbi->oz_pgrp = process_group(current);
-+ sbi->oz_pgrp = virt_pgid(current);
- sbi->sb = s;
- sbi->version = 0;
- sbi->sub_version = 0;
-@@ -266,6 +332,13 @@ int autofs4_fill_super(struct super_bloc
- sbi->pipe = pipe;
-
- /*
-+ * Take a reference to the root dentry so we get a chance to
-+ * clean up the dentry tree on umount.
-+ * See autofs4_force_release.
-+ */
-+ sbi->root = dget(root);
-+
-+ /*
- * Success! Install the root dentry now to indicate completion.
- */
- s->s_root = root;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/autofs4/root.c linux-2.6.9-ve023stab030/fs/autofs4/root.c
---- linux-2.6.9-42.0.3.EL.orig/fs/autofs4/root.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/autofs4/root.c 2006-10-11 19:07:57.000000000 +0400
-@@ -599,7 +599,7 @@ static int autofs4_dir_unlink(struct ino
- struct autofs_info *ino = autofs4_dentry_ino(dentry);
-
- /* This allows root to remove symlinks */
-- if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) )
-+ if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_SYS_ADMIN) )
- return -EACCES;
-
- dput(ino->dentry);
-@@ -627,7 +627,9 @@ static int autofs4_dir_rmdir(struct inod
- spin_unlock(&dcache_lock);
- return -ENOTEMPTY;
- }
-+ spin_lock(&dentry->d_lock);
- __d_drop(dentry);
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
-
- dput(ino->dentry);
-@@ -789,7 +791,7 @@ static int autofs4_root_ioctl(struct ino
- _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT )
- return -ENOTTY;
-
-- if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) )
-+ if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_SYS_ADMIN) )
- return -EPERM;
-
- switch(cmd) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_aout.c linux-2.6.9-ve023stab030/fs/binfmt_aout.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_aout.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_aout.c 2006-10-11 19:07:58.000000000 +0400
-@@ -438,9 +438,11 @@ beyond_if:
- #endif
- start_thread(regs, ex.a_entry, current->mm->start_stack);
- if (unlikely(current->ptrace & PT_PTRACED)) {
-- if (current->ptrace & PT_TRACE_EXEC)
-+ if (current->ptrace & PT_TRACE_EXEC) {
-+ set_pn_state(current, PN_STOP_EXEC);
- ptrace_notify ((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
-- else
-+ clear_pn_state(current);
-+ } else
- send_sig(SIGTRAP, current, 0);
- }
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_elf.c linux-2.6.9-ve023stab030/fs/binfmt_elf.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_elf.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_elf.c 2006-10-11 19:07:58.000000000 +0400
-@@ -103,15 +103,17 @@ static int set_brk(unsigned long start,
- be in memory */
-
-
--static void padzero(unsigned long elf_bss)
-+static int padzero(unsigned long elf_bss)
- {
- unsigned long nbyte;
-
- nbyte = ELF_PAGEOFFSET(elf_bss);
- if (nbyte) {
- nbyte = ELF_MIN_ALIGN - nbyte;
-- clear_user((void __user *) elf_bss, nbyte);
-+ if (clear_user((void __user *) elf_bss, nbyte))
-+ return -EFAULT;
- }
-+ return 0;
- }
-
- /* Let's use some macros to make this stack manipulation a litle clearer */
-@@ -127,7 +129,7 @@ static void padzero(unsigned long elf_bs
- #define STACK_ALLOC(sp, len) ({ sp -= len ; sp; })
- #endif
-
--static void
-+static int
- create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
- int interp_aout, unsigned long load_addr,
- unsigned long interp_load_addr)
-@@ -160,7 +162,8 @@ create_elf_tables(struct linux_binprm *b
- p = (unsigned long)arch_align_stack((unsigned long)p);
- #endif
- u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
-- __copy_to_user(u_platform, k_platform, len);
-+ if (__copy_to_user(u_platform, k_platform, len))
-+ return -EFAULT;
- }
-
- /* Create the ELF interpreter info */
-@@ -222,7 +225,8 @@ create_elf_tables(struct linux_binprm *b
- #endif
-
- /* Now, let's put argc (and argv, envp if appropriate) on the stack */
-- __put_user(argc, sp++);
-+ if (__put_user(argc, sp++))
-+ return -EFAULT;
- if (interp_aout) {
- argv = sp + 2;
- envp = argv + argc + 1;
-@@ -240,25 +244,29 @@ create_elf_tables(struct linux_binprm *b
- __put_user((elf_addr_t)p, argv++);
- len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
- if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
-- return;
-+ return 0;
- p += len;
- }
-- __put_user(0, argv);
-+ if (__put_user(0, argv))
-+ return -EFAULT;
- current->mm->arg_end = current->mm->env_start = p;
- while (envc-- > 0) {
- size_t len;
- __put_user((elf_addr_t)p, envp++);
- len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
- if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
-- return;
-+ return 0;
- p += len;
- }
-- __put_user(0, envp);
-+ if (__put_user(0, envp))
-+ return -EFAULT;
- current->mm->env_end = p;
-
- /* Put the elf_info on the stack in the right place. */
- sp = (elf_addr_t __user *)envp + 1;
-- copy_to_user(sp, elf_info, ei_index * sizeof(elf_addr_t));
-+ if (copy_to_user(sp, elf_info, ei_index * sizeof(elf_addr_t)))
-+ return -EFAULT;
-+ return 0;
- }
-
- #ifndef elf_map
-@@ -378,7 +386,7 @@ static unsigned long load_elf_interp(str
- eppnt = elf_phdata;
- for (i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) {
- if (eppnt->p_type == PT_LOAD) {
-- int elf_type = MAP_PRIVATE | MAP_DENYWRITE;
-+ int elf_type = MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECPRIO;
- int elf_prot = 0;
- unsigned long vaddr = 0;
- unsigned long k, map_addr;
-@@ -439,7 +447,11 @@ static unsigned long load_elf_interp(str
- * that there are zero-mapped pages up to and including the
- * last bss page.
- */
-- padzero(elf_bss);
-+ if (padzero(elf_bss)) {
-+ error = -EFAULT;
-+ goto out_close;
-+ }
-+
- elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); /* What we have mapped so far */
-
- /* Map the last of the bss segment */
-@@ -662,7 +674,7 @@ static int load_elf_binary(struct linux_
- */
- SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter);
-
-- interpreter = open_exec(elf_interpreter);
-+ interpreter = open_exec(elf_interpreter, NULL);
- retval = PTR_ERR(interpreter);
- if (IS_ERR(interpreter))
- goto out_free_interp;
-@@ -840,7 +852,11 @@ static int load_elf_binary(struct linux_
- nbyte = ELF_MIN_ALIGN - nbyte;
- if (nbyte > elf_brk - elf_bss)
- nbyte = elf_brk - elf_bss;
-- clear_user((void __user *) elf_bss + load_bias, nbyte);
-+ if (clear_user((void __user *) elf_bss + load_bias, nbyte)) {
-+ retval = -EFAULT;
-+ send_sig(SIGKILL, current, 0);
-+ goto out_free_dentry;
-+ }
- }
- }
-
-@@ -848,7 +864,8 @@ static int load_elf_binary(struct linux_
- if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
- if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
-
-- elf_flags = MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE;
-+ elf_flags = MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE|
-+ MAP_EXECPRIO;
-
- vaddr = elf_ppnt->p_vaddr;
- if (loc->elf_ex.e_type == ET_EXEC || load_addr_set)
-@@ -924,7 +941,11 @@ static int load_elf_binary(struct linux_
- send_sig(SIGKILL, current, 0);
- goto out_free_dentry;
- }
-- padzero(elf_bss);
-+ if (padzero(elf_bss)) {
-+ send_sig(SIGSEGV, current, 0);
-+ retval = -EFAULT; /* Nobody gets to see this, but.. */
-+ goto out_free_dentry;
-+ }
-
- if (elf_interpreter) {
- if (interpreter_type == INTERPRETER_AOUT)
-@@ -966,9 +987,13 @@ static int load_elf_binary(struct linux_
- * Map the vsyscall trampoline. This address is then passed via
- * AT_SYSINFO.
- */
--#ifdef __HAVE_ARCH_VSYSCALL
-- map_vsyscall();
--#endif
-+#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
-+ retval = arch_setup_additional_pages(bprm, executable_stack, 0);
-+ if (retval < 0) {
-+ send_sig(SIGKILL, current, 0);
-+ goto out;
-+ }
-+#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
-
- compute_creds(bprm);
- current->flags &= ~PF_FORKNOEXEC;
-@@ -1014,9 +1039,11 @@ static int load_elf_binary(struct linux_
-
- start_thread(regs, elf_entry, bprm->p);
- if (unlikely(current->ptrace & PT_PTRACED)) {
-- if (current->ptrace & PT_TRACE_EXEC)
-+ if (current->ptrace & PT_TRACE_EXEC) {
-+ set_pn_state(current, PN_STOP_EXEC);
- ptrace_notify ((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
-- else
-+ clear_pn_state(current);
-+ } else
- send_sig(SIGTRAP, current, 0);
- }
- retval = 0;
-@@ -1111,7 +1138,10 @@ static int load_elf_library(struct file
- goto out_free_ph;
-
- elf_bss = eppnt->p_vaddr + eppnt->p_filesz;
-- padzero(elf_bss);
-+ if (padzero(elf_bss)) {
-+ error = -EFAULT;
-+ goto out_free_ph;
-+ }
-
- len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + ELF_MIN_ALIGN - 1);
- bss = eppnt->p_memsz + eppnt->p_vaddr;
-@@ -1296,10 +1326,10 @@ static void fill_prstatus(struct elf_prs
- prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
- prstatus->pr_sigpend = p->pending.signal.sig[0];
- prstatus->pr_sighold = p->blocked.sig[0];
-- prstatus->pr_pid = p->pid;
-- prstatus->pr_ppid = p->parent->pid;
-- prstatus->pr_pgrp = process_group(p);
-- prstatus->pr_sid = p->signal->session;
-+ prstatus->pr_pid = virt_pid(p);
-+ prstatus->pr_ppid = virt_pid(p->parent);
-+ prstatus->pr_pgrp = virt_pgid(p);
-+ prstatus->pr_sid = virt_sid(p);
- if (p->pid == p->tgid) {
- /*
- * This is the record for the group leader. Add in the
-@@ -1323,7 +1353,7 @@ static void fill_prstatus(struct elf_prs
- jiffies_to_timeval(p->signal->cstime, &prstatus->pr_cstime);
- }
-
--static void fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
-+static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
- struct mm_struct *mm)
- {
- unsigned int i, len;
-@@ -1334,17 +1364,18 @@ static void fill_psinfo(struct elf_prpsi
- len = mm->arg_end - mm->arg_start;
- if (len >= ELF_PRARGSZ)
- len = ELF_PRARGSZ-1;
-- copy_from_user(&psinfo->pr_psargs,
-- (const char __user *)mm->arg_start, len);
-+ if (copy_from_user(&psinfo->pr_psargs,
-+ (const char __user *)mm->arg_start, len))
-+ return -EFAULT;
- for(i = 0; i < len; i++)
- if (psinfo->pr_psargs[i] == 0)
- psinfo->pr_psargs[i] = ' ';
- psinfo->pr_psargs[len] = 0;
-
-- psinfo->pr_pid = p->pid;
-- psinfo->pr_ppid = p->parent->pid;
-- psinfo->pr_pgrp = process_group(p);
-- psinfo->pr_sid = p->signal->session;
-+ psinfo->pr_pid = virt_pid(p);
-+ psinfo->pr_ppid = virt_pid(p->parent);
-+ psinfo->pr_pgrp = virt_pgid(p);
-+ psinfo->pr_sid = virt_sid(p);
-
- i = p->state ? ffz(~p->state) + 1 : 0;
- psinfo->pr_state = i;
-@@ -1356,7 +1387,7 @@ static void fill_psinfo(struct elf_prpsi
- SET_GID(psinfo->pr_gid, p->gid);
- strncpy(psinfo->pr_fname, p->comm, sizeof(psinfo->pr_fname));
-
-- return;
-+ return 0;
- }
-
- /* Here is the structure in which status of each thread is captured. */
-@@ -1477,7 +1508,7 @@ static int elf_core_dump(long signr, str
- if (signr) {
- struct elf_thread_status *tmp;
- read_lock(&tasklist_lock);
-- do_each_thread(g,p)
-+ do_each_thread_ve(g,p)
- if (current->mm == p->mm && current != p) {
- tmp = kmalloc(sizeof(*tmp), GFP_ATOMIC);
- if (!tmp) {
-@@ -1489,7 +1520,7 @@ static int elf_core_dump(long signr, str
- tmp->thread = p;
- list_add(&tmp->list, &thread_list);
- }
-- while_each_thread(g,p);
-+ while_each_thread_ve(g,p);
- read_unlock(&tasklist_lock);
- list_for_each(t, &thread_list) {
- struct elf_thread_status *tmp;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_em86.c linux-2.6.9-ve023stab030/fs/binfmt_em86.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_em86.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_em86.c 2006-10-11 19:07:55.000000000 +0400
-@@ -82,7 +82,7 @@ static int load_em86(struct linux_binprm
- * Note that we use open_exec() as the name is now in kernel
- * space, and we don't need to copy it.
- */
-- file = open_exec(interp);
-+ file = open_exec(interp, bprm);
- if (IS_ERR(file))
- return PTR_ERR(file);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_flat.c linux-2.6.9-ve023stab030/fs/binfmt_flat.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_flat.c 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_flat.c 2006-10-11 19:07:55.000000000 +0400
-@@ -774,7 +774,7 @@ static int load_flat_shared_library(int
-
- /* Open the file up */
- bprm.filename = buf;
-- bprm.file = open_exec(bprm.filename);
-+ bprm.file = open_exec(bprm.filename, &bprm);
- res = PTR_ERR(bprm.file);
- if (IS_ERR(bprm.file))
- return res;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_misc.c linux-2.6.9-ve023stab030/fs/binfmt_misc.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_misc.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_misc.c 2006-10-11 19:07:55.000000000 +0400
-@@ -150,7 +150,8 @@ static int load_misc_binary(struct linux
-
- /* if the binary is not readable than enforce mm->dumpable=0
- regardless of the interpreter's permissions */
-- if (permission(bprm->file->f_dentry->d_inode, MAY_READ, NULL))
-+ if (permission(bprm->file->f_dentry->d_inode, MAY_READ,
-+ NULL, NULL))
- bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
-
- allow_write_access(bprm->file);
-@@ -179,7 +180,7 @@ static int load_misc_binary(struct linux
-
- bprm->interp = iname; /* for binfmt_script */
-
-- interp_file = open_exec (iname);
-+ interp_file = open_exec (iname, bprm);
- retval = PTR_ERR (interp_file);
- if (IS_ERR (interp_file))
- goto _error;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/binfmt_script.c linux-2.6.9-ve023stab030/fs/binfmt_script.c
---- linux-2.6.9-42.0.3.EL.orig/fs/binfmt_script.c 2004-10-19 01:53:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/binfmt_script.c 2006-10-11 19:07:55.000000000 +0400
-@@ -85,7 +85,7 @@ static int load_script(struct linux_binp
- /*
- * OK, now restart the process with the interpreter's dentry.
- */
-- file = open_exec(interp);
-+ file = open_exec(interp, bprm);
- if (IS_ERR(file))
- return PTR_ERR(file);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/block_dev.c linux-2.6.9-ve023stab030/fs/block_dev.c
---- linux-2.6.9-42.0.3.EL.orig/fs/block_dev.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/block_dev.c 2006-10-11 19:07:57.000000000 +0400
-@@ -561,9 +561,16 @@ static int do_open(struct block_device *
- {
- struct module *owner = NULL;
- struct gendisk *disk;
-- int ret = -ENXIO;
-+ int ret;
- int part;
-
-+#ifdef CONFIG_VE
-+ ret = get_device_perms_ve(S_IFBLK, bdev->bd_dev,
-+ file->f_mode&(FMODE_READ|FMODE_WRITE));
-+ if (ret)
-+ return ret;
-+#endif
-+ ret = -ENXIO;
- file->f_mapping = bdev->bd_inode->i_mapping;
- lock_kernel();
- disk = get_gendisk(bdev->bd_dev, &part);
-@@ -830,7 +837,7 @@ EXPORT_SYMBOL(ioctl_by_bdev);
- * namespace if possible and return it. Return ERR_PTR(error)
- * otherwise.
- */
--struct block_device *lookup_bdev(const char *path)
-+struct block_device *lookup_bdev(const char *path, int mode)
- {
- struct block_device *bdev;
- struct inode *inode;
-@@ -848,6 +855,11 @@ struct block_device *lookup_bdev(const c
- error = -ENOTBLK;
- if (!S_ISBLK(inode->i_mode))
- goto fail;
-+#ifdef CONFIG_VE
-+ error = get_device_perms_ve(S_IFBLK, inode->i_rdev, mode);
-+ if (error)
-+ goto fail;
-+#endif
- error = -EACCES;
- if (nd.mnt->mnt_flags & MNT_NODEV)
- goto fail;
-@@ -879,12 +891,13 @@ struct block_device *open_bdev_excl(cons
- mode_t mode = FMODE_READ;
- int error = 0;
-
-- bdev = lookup_bdev(path);
-+ if (!(flags & MS_RDONLY))
-+ mode |= FMODE_WRITE;
-+
-+ bdev = lookup_bdev(path, mode);
- if (IS_ERR(bdev))
- return bdev;
-
-- if (!(flags & MS_RDONLY))
-- mode |= FMODE_WRITE;
- error = blkdev_get(bdev, mode, 0);
- if (error)
- return ERR_PTR(error);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/buffer.c linux-2.6.9-ve023stab030/fs/buffer.c
---- linux-2.6.9-42.0.3.EL.orig/fs/buffer.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/buffer.c 2006-10-11 19:08:02.000000000 +0400
-@@ -2029,11 +2029,11 @@ static int __block_prepare_write(struct
- if (!buffer_mapped(bh)) {
- err = get_block(inode, block, bh, 1);
- if (err)
-- goto out;
-+ break;
- if (buffer_new(bh)) {
-- clear_buffer_new(bh);
-- unmap_underlying_metadata(bh->b_bdev,
-- bh->b_blocknr);
-+ if (buffer_mapped(bh))
-+ unmap_underlying_metadata(bh->b_bdev,
-+ bh->b_blocknr);
- if (PageUptodate(page)) {
- set_buffer_uptodate(bh);
- continue;
-@@ -2071,10 +2071,17 @@ static int __block_prepare_write(struct
- while(wait_bh > wait) {
- wait_on_buffer(*--wait_bh);
- if (!buffer_uptodate(*wait_bh))
-- return -EIO;
-+ err = -EIO;
- }
-- return 0;
--out:
-+ if (!err) {
-+ bh = head;
-+ do {
-+ if (buffer_new(bh))
-+ clear_buffer_new(bh);
-+ } while ((bh = bh->b_this_page) != head);
-+ return 0;
-+ }
-+ /* Error case: */
- /*
- * Zero out any newly allocated blocks to avoid exposing stale
- * data. If BH_New is set, we know that the block was newly
-@@ -2094,6 +2101,7 @@ out:
- clear_buffer_new(bh);
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr+block_start, 0, bh->b_size);
-+ flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
- set_buffer_uptodate(bh);
- mark_buffer_dirty(bh);
-@@ -2565,6 +2573,7 @@ failed:
- */
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr, 0, PAGE_CACHE_SIZE);
-+ flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
- SetPageUptodate(page);
- set_page_dirty(page);
-@@ -3139,7 +3148,7 @@ void __init buffer_init(void)
-
- bh_cachep = kmem_cache_create("buffer_head",
- sizeof(struct buffer_head), 0,
-- SLAB_PANIC, init_buffer_head, NULL);
-+ SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_buffer_head, NULL);
- for (i = 0; i < ARRAY_SIZE(bh_wait_queue_heads); i++)
- init_waitqueue_head(&bh_wait_queue_heads[i].wqh);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/char_dev.c linux-2.6.9-ve023stab030/fs/char_dev.c
---- linux-2.6.9-42.0.3.EL.orig/fs/char_dev.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/char_dev.c 2006-10-11 19:07:57.000000000 +0400
-@@ -298,6 +298,13 @@ int chrdev_open(struct inode * inode, st
- struct cdev *new = NULL;
- int ret = 0;
-
-+#ifdef CONFIG_VE
-+ ret = get_device_perms_ve(S_IFCHR, inode->i_rdev,
-+ filp->f_mode&(FMODE_READ|FMODE_WRITE));
-+ if (ret)
-+ return ret;
-+#endif
-+
- spin_lock(&cdev_lock);
- p = inode->i_cdev;
- if (!p) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/cifs/cifsfs.c linux-2.6.9-ve023stab030/fs/cifs/cifsfs.c
---- linux-2.6.9-42.0.3.EL.orig/fs/cifs/cifsfs.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/cifs/cifsfs.c 2006-10-11 19:07:55.000000000 +0400
-@@ -212,7 +212,8 @@ cifs_statfs(struct super_block *sb, stru
- longer available? */
- }
-
--static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd)
-+static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- struct cifs_sb_info *cifs_sb;
-
-@@ -224,7 +225,7 @@ static int cifs_permission(struct inode
- on the client (above and beyond ACL on servers) for
- servers which do not support setting and viewing mode bits,
- so allowing client to check permissions is useful */
-- return vfs_permission(inode, mask);
-+ return vfs_permission(inode, mask, exec_perm);
- }
-
- static kmem_cache_t *cifs_inode_cachep;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/coda/dir.c linux-2.6.9-ve023stab030/fs/coda/dir.c
---- linux-2.6.9-42.0.3.EL.orig/fs/coda/dir.c 2004-10-19 01:53:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/coda/dir.c 2006-10-11 19:07:55.000000000 +0400
-@@ -147,7 +147,8 @@ exit:
- }
-
-
--int coda_permission(struct inode *inode, int mask, struct nameidata *nd)
-+int coda_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *perm)
- {
- int error = 0;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/coda/pioctl.c linux-2.6.9-ve023stab030/fs/coda/pioctl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/coda/pioctl.c 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/coda/pioctl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -25,7 +25,7 @@
-
- /* pioctl ops */
- static int coda_ioctl_permission(struct inode *inode, int mask,
-- struct nameidata *nd);
-+ struct nameidata *nd, struct exec_perm *);
- static int coda_pioctl(struct inode * inode, struct file * filp,
- unsigned int cmd, unsigned long user_data);
-
-@@ -43,7 +43,8 @@ struct file_operations coda_ioctl_operat
-
- /* the coda pioctl inode ops */
- static int coda_ioctl_permission(struct inode *inode, int mask,
-- struct nameidata *nd)
-+ struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/compat.c linux-2.6.9-ve023stab030/fs/compat.c
---- linux-2.6.9-42.0.3.EL.orig/fs/compat.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/compat.c 2006-10-11 19:08:00.000000000 +0400
-@@ -25,6 +25,7 @@
- #include <linux/file.h>
- #include <linux/vfs.h>
- #include <linux/ioctl32.h>
-+#include <linux/virtinfo.h>
- #include <linux/init.h>
- #include <linux/sockios.h> /* for SIOCDEVPRIVATE */
- #include <linux/smb.h>
-@@ -157,6 +158,8 @@ asmlinkage long compat_sys_statfs(const
- if (!error) {
- struct kstatfs tmp;
- error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
-+ if (!error)
-+ error = faudit_statfs(nd.mnt->mnt_sb, &tmp);
- if (!error && put_compat_statfs(buf, &tmp))
- error = -EFAULT;
- path_release(&nd);
-@@ -175,6 +178,8 @@ asmlinkage long compat_sys_fstatfs(unsig
- if (!file)
- goto out;
- error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
-+ if (!error)
-+ error = faudit_statfs(file->f_vfsmnt->mnt_sb, &tmp);
- if (!error && put_compat_statfs(buf, &tmp))
- error = -EFAULT;
- fput(file);
-@@ -218,6 +223,8 @@ asmlinkage long compat_statfs64(const ch
- if (!error) {
- struct kstatfs tmp;
- error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
-+ if (!error)
-+ error = faudit_statfs(nd.mnt->mnt_sb, &tmp);
- if (!error && put_compat_statfs64(buf, &tmp))
- error = -EFAULT;
- path_release(&nd);
-@@ -239,6 +246,8 @@ asmlinkage long compat_fstatfs64(unsigne
- if (!file)
- goto out;
- error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
-+ if (!error)
-+ error = faudit_statfs(file->f_vfsmnt->mnt_sb, &tmp);
- if (!error && put_compat_statfs64(buf, &tmp))
- error = -EFAULT;
- fput(file);
-@@ -1451,20 +1460,24 @@ int compat_do_execve(char * filename,
- int retval;
- int i;
-
-- file = open_exec(filename);
--
-- retval = PTR_ERR(file);
-- if (IS_ERR(file))
-+ retval = virtinfo_gencall(VIRTINFO_DOEXECVE, NULL);
-+ if (retval)
- return retval;
-
-- sched_exec();
--
- retval = -ENOMEM;
- bprm = kmalloc(sizeof(*bprm), GFP_KERNEL);
- if (!bprm)
-- goto out_ret;
-+ return ERR_PTR(-ENOMEM);
- memset(bprm, 0, sizeof(*bprm));
-
-+ file = open_exec(filename, bprm);
-+
-+ retval = PTR_ERR(file);
-+ if (IS_ERR(file))
-+ goto out_open;
-+
-+ sched_exec();
-+
- bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- bprm->file = file;
- bprm->filename = filename;
-@@ -1536,8 +1549,8 @@ out_file:
- allow_write_access(bprm->file);
- fput(bprm->file);
- }
-+out_open:
- kfree(bprm);
--
- out_ret:
- return retval;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/compat_ioctl.c linux-2.6.9-ve023stab030/fs/compat_ioctl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/compat_ioctl.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/compat_ioctl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -654,8 +654,11 @@ int siocdevprivate_ioctl(unsigned int fd
- /* Don't check these user accesses, just let that get trapped
- * in the ioctl handler instead.
- */
-- copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0], IFNAMSIZ);
-- __put_user(data64, &u_ifreq64->ifr_ifru.ifru_data);
-+ if (copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0],
-+ IFNAMSIZ))
-+ return -EFAULT;
-+ if (__put_user(data64, &u_ifreq64->ifr_ifru.ifru_data))
-+ return -EFAULT;
-
- return sys_ioctl(fd, cmd, (unsigned long) u_ifreq64);
- }
-@@ -693,6 +696,11 @@ static int dev_ifsioc(unsigned int fd, u
- set_fs (old_fs);
- if (!err) {
- switch (cmd) {
-+ /* TUNSETIFF is defined as _IOW, it should be _IORW
-+ * as the data is copied back to user space, but that
-+ * cannot be fixed without breaking all existing apps.
-+ */
-+ case TUNSETIFF:
- case SIOCGIFFLAGS:
- case SIOCGIFMETRIC:
- case SIOCGIFMTU:
-@@ -2373,7 +2381,9 @@ put_dirent32 (struct dirent *d, struct c
- __put_user(d->d_ino, &d32->d_ino);
- __put_user(d->d_off, &d32->d_off);
- __put_user(d->d_reclen, &d32->d_reclen);
-- __copy_to_user(d32->d_name, d->d_name, d->d_reclen);
-+ if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen))
-+ return -EFAULT;
-+
- return ret;
- }
-
-@@ -2516,7 +2526,8 @@ static int serial_struct_ioctl(unsigned
- if (cmd == TIOCSSERIAL) {
- if (verify_area(VERIFY_READ, ss32, sizeof(SS32)))
- return -EFAULT;
-- __copy_from_user(&ss, ss32, offsetof(SS32, iomem_base));
-+ if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base)))
-+ return -EFAULT;
- __get_user(udata, &ss32->iomem_base);
- ss.iomem_base = compat_ptr(udata);
- __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
-@@ -2529,7 +2540,8 @@ static int serial_struct_ioctl(unsigned
- if (cmd == TIOCGSERIAL && err >= 0) {
- if (verify_area(VERIFY_WRITE, ss32, sizeof(SS32)))
- return -EFAULT;
-- __copy_to_user(ss32,&ss,offsetof(SS32,iomem_base));
-+ if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base)))
-+ return -EFAULT;
- __put_user((unsigned long)ss.iomem_base >> 32 ?
- 0xffffffff : (unsigned)(unsigned long)ss.iomem_base,
- &ss32->iomem_base);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/dcache.c linux-2.6.9-ve023stab030/fs/dcache.c
---- linux-2.6.9-42.0.3.EL.orig/fs/dcache.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/dcache.c 2006-10-11 19:07:57.000000000 +0400
-@@ -19,6 +19,7 @@
- #include <linux/mm.h>
- #include <linux/fs.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/init.h>
- #include <linux/smp_lock.h>
- #include <linux/hash.h>
-@@ -26,12 +27,17 @@
- #include <linux/module.h>
- #include <linux/mount.h>
- #include <linux/file.h>
-+#include <linux/namei.h>
- #include <asm/uaccess.h>
- #include <linux/security.h>
- #include <linux/seqlock.h>
- #include <linux/swap.h>
- #include <linux/bootmem.h>
- #include <linux/audit.h>
-+#include <linux/kernel_stat.h>
-+
-+#include <ub/ub_dcache.h>
-+#include <ub/ub_dcache_op.h>
-
- /* #define DCACHE_DEBUG 1 */
-
-@@ -42,9 +48,7 @@ seqlock_t rename_lock __cacheline_aligne
-
- EXPORT_SYMBOL(dcache_lock);
-
--static kmem_cache_t *dentry_cache;
--
--#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
-+kmem_cache_t *dentry_cache;
-
- /*
- * This is the single most critical data structure when it comes
-@@ -71,6 +75,7 @@ static void d_callback(struct rcu_head *
- {
- struct dentry * dentry = container_of(head, struct dentry, d_rcu);
-
-+ ub_dentry_free(dentry);
- if (dname_external(dentry))
- kfree(dentry->d_name.name);
- kmem_cache_free(dentry_cache, dentry);
-@@ -141,27 +146,24 @@ static inline void dentry_iput(struct de
- * releasing its resources. If the parent dentries were scheduled for release
- * they too may now get deleted.
- *
-+ * This traverse upward doesn't change d_inuse of any dentry
-+ *
- * no dcache lock, please.
-+ * preemption is disabled by the caller.
- */
-
--void dput(struct dentry *dentry)
-+void dput_recursive(struct dentry *dentry)
- {
-- if (!dentry)
-- return;
--
- repeat:
- if (atomic_read(&dentry->d_count) == 1)
- might_sleep();
- if (!atomic_dec_and_lock(&dentry->d_count, &dcache_lock))
-- return;
-+ goto out_preempt;
-
- spin_lock(&dentry->d_lock);
-- if (atomic_read(&dentry->d_count)) {
-- spin_unlock(&dentry->d_lock);
-- spin_unlock(&dcache_lock);
-- return;
-- }
--
-+ if (atomic_read(&dentry->d_count))
-+ goto out_unlock;
-+
- /*
- * AV: ->d_delete() is _NOT_ allowed to block now.
- */
-@@ -175,10 +177,14 @@ repeat:
- if (list_empty(&dentry->d_lru)) {
- dentry->d_flags |= DCACHE_REFERENCED;
- list_add(&dentry->d_lru, &dentry_unused);
-+ list_add(&dentry->d_sb_lru, &dentry->d_sb->s_dentry_unused);
- dentry_stat.nr_unused++;
- }
-+out_unlock:
- spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
-+out_preempt:
-+ preempt_enable();
- return;
-
- unhash_it:
-@@ -192,14 +198,17 @@ kill_it: {
- */
- if (!list_empty(&dentry->d_lru)) {
- list_del(&dentry->d_lru);
-+ list_del(&dentry->d_sb_lru);
- dentry_stat.nr_unused--;
- }
- list_del(&dentry->d_child);
- dentry_stat.nr_dentry--; /* For d_free, below */
-+ preempt_enable_no_resched();
- /*drops the locks, at that point nobody can reach this dentry */
- dentry_iput(dentry);
- parent = dentry->d_parent;
- d_free(dentry);
-+ preempt_disable();
- if (dentry == parent)
- return;
- dentry = parent;
-@@ -207,6 +216,16 @@ kill_it: {
- }
- }
-
-+void dput(struct dentry *dentry)
-+{
-+ if (!dentry)
-+ return;
-+
-+ preempt_disable();
-+ ub_dentry_uncharge(dentry);
-+ dput_recursive(dentry);
-+}
-+
- /**
- * d_invalidate - invalidate a dentry
- * @dentry: dentry to invalidate
-@@ -272,7 +291,10 @@ static inline struct dentry * __dget_loc
- if (!list_empty(&dentry->d_lru)) {
- dentry_stat.nr_unused--;
- list_del_init(&dentry->d_lru);
-+ list_del_init(&dentry->d_sb_lru);
- }
-+
-+ ub_dentry_charge_nofail(dentry);
- return dentry;
- }
-
-@@ -345,13 +367,16 @@ restart:
- tmp = head;
- while ((tmp = tmp->next) != head) {
- struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
-+ spin_lock(&dentry->d_lock);
- if (!atomic_read(&dentry->d_count)) {
- __dget_locked(dentry);
- __d_drop(dentry);
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
- dput(dentry);
- goto restart;
- }
-+ spin_unlock(&dentry->d_lock);
- }
- spin_unlock(&dcache_lock);
- }
-@@ -372,8 +397,14 @@ static inline void prune_one_dentry(stru
- dentry_iput(dentry);
- parent = dentry->d_parent;
- d_free(dentry);
-- if (parent != dentry)
-- dput(parent);
-+ if (parent != dentry) {
-+ /*
-+ * dentry is not in use, only child (not outside)
-+ * references change, so parent->d_inuse does not change
-+ */
-+ preempt_disable();
-+ dput_recursive(parent);
-+ }
- spin_lock(&dcache_lock);
- }
-
-@@ -394,6 +425,10 @@ static inline void prune_one_dentry(stru
-
- static void prune_dcache(int count, struct super_block *sb)
- {
-+ struct list_head *lru_head;
-+
-+ lru_head = sb ? &sb->s_dentry_unused : &dentry_unused;
-+
- spin_lock(&dcache_lock);
- for (; count ; count--) {
- struct dentry *dentry;
-@@ -402,26 +437,16 @@ static void prune_dcache(int count, stru
-
- cond_resched_lock(&dcache_lock);
-
-- tmp = dentry_unused.prev;
-- if (unlikely(sb)) {
-- /* Try to find a dentry for this sb, but don't try
-- * too hard, if they aren't near the tail they will
-- * be moved down again soon
-- */
-- int skip = count;
-- while (skip &&
-- tmp != &dentry_unused &&
-- list_entry(tmp, struct dentry, d_lru)->d_sb != sb) {
-- skip--;
-- tmp = tmp->prev;
-- }
-- }
-- if (tmp == &dentry_unused)
-+ tmp = lru_head->prev;
-+ if (tmp == lru_head)
- break;
-- list_del_init(tmp);
-- prefetch(dentry_unused.prev);
-- dentry_stat.nr_unused--;
-- dentry = list_entry(tmp, struct dentry, d_lru);
-+
-+ prefetch(lru_head->prev);
-+ dentry_stat.nr_unused--;
-+ dentry = sb ? list_entry(tmp, struct dentry, d_sb_lru) :
-+ list_entry(tmp, struct dentry, d_lru);
-+ list_del_init(&dentry->d_lru);
-+ list_del_init(&dentry->d_sb_lru);
-
- spin_lock(&dentry->d_lock);
- /*
-@@ -437,6 +462,8 @@ static void prune_dcache(int count, stru
- if (dentry->d_flags & DCACHE_REFERENCED) {
- dentry->d_flags &= ~DCACHE_REFERENCED;
- list_add(&dentry->d_lru, &dentry_unused);
-+ list_add(&dentry->d_sb_lru,
-+ &dentry->d_sb->s_dentry_unused);
- dentry_stat.nr_unused++;
- spin_unlock(&dentry->d_lock);
- continue;
-@@ -452,7 +479,8 @@ static void prune_dcache(int count, stru
- * If this dentry is for "my" filesystem, then I can prune it
- * without taking the s_umount lock (I already hold it).
- */
-- if (sb && dentry->d_sb == sb) {
-+ if (sb) {
-+ BUG_ON(dentry->d_sb != sb);
- prune_one_dentry(dentry);
- continue;
- }
-@@ -508,45 +536,22 @@ static void prune_dcache(int count, stru
-
- void shrink_dcache_sb(struct super_block * sb)
- {
-- struct list_head *tmp, *next;
- struct dentry *dentry;
-
-- /*
-- * Pass one ... move the dentries for the specified
-- * superblock to the most recent end of the unused list.
-- */
- spin_lock(&dcache_lock);
-- next = dentry_unused.next;
-- while (next != &dentry_unused) {
-- tmp = next;
-- next = tmp->next;
-- dentry = list_entry(tmp, struct dentry, d_lru);
-- if (dentry->d_sb != sb)
-- continue;
-- list_del(tmp);
-- list_add(tmp, &dentry_unused);
-- }
--
-- /*
-- * Pass two ... free the dentries for this superblock.
-- */
--repeat:
-- next = dentry_unused.next;
-- while (next != &dentry_unused) {
-- tmp = next;
-- next = tmp->next;
-- dentry = list_entry(tmp, struct dentry, d_lru);
-- if (dentry->d_sb != sb)
-- continue;
-+ while (!list_empty(&sb->s_dentry_unused)) {
-+ dentry = list_first_entry(&sb->s_dentry_unused,
-+ struct dentry, d_sb_lru);
- dentry_stat.nr_unused--;
-- list_del_init(tmp);
-+ list_del_init(&dentry->d_lru);
-+ list_del_init(&dentry->d_sb_lru);
- spin_lock(&dentry->d_lock);
- if (atomic_read(&dentry->d_count)) {
- spin_unlock(&dentry->d_lock);
- continue;
- }
- prune_one_dentry(dentry);
-- goto repeat;
-+ cond_resched_lock(&dcache_lock);
- }
- spin_unlock(&dcache_lock);
- }
-@@ -628,16 +633,28 @@ resume:
- if (!list_empty(&dentry->d_lru)) {
- dentry_stat.nr_unused--;
- list_del_init(&dentry->d_lru);
-+ list_del_init(&dentry->d_sb_lru);
- }
- /*
- * move only zero ref count dentries to the end
- * of the unused list for prune_dcache
- */
- if (!atomic_read(&dentry->d_count)) {
-- list_add(&dentry->d_lru, dentry_unused.prev);
-+ list_add_tail(&dentry->d_lru, &dentry_unused);
-+ list_add_tail(&dentry->d_sb_lru,
-+ &dentry->d_sb->s_dentry_unused);
- dentry_stat.nr_unused++;
- found++;
- }
-+
-+ /*
-+ * We can return to the caller if we have found some (this
-+ * ensures forward progress). We'll be coming back to find
-+ * the rest.
-+ */
-+ if (found && need_resched())
-+ goto out;
-+
- /*
- * Descend a level if the d_subdirs list is non-empty.
- */
-@@ -662,6 +679,7 @@ this_parent->d_parent->d_name.name, this
- #endif
- goto resume;
- }
-+out:
- spin_unlock(&dcache_lock);
- return found;
- }
-@@ -704,6 +722,7 @@ void shrink_dcache_anon(struct super_blo
- if (!list_empty(&this->d_lru)) {
- dentry_stat.nr_unused--;
- list_del_init(&this->d_lru);
-+ list_del_init(&this->d_sb_lru);
- }
-
- /*
-@@ -712,6 +731,8 @@ void shrink_dcache_anon(struct super_blo
- */
- if (!atomic_read(&this->d_count)) {
- list_add_tail(&this->d_lru, &dentry_unused);
-+ list_add_tail(&this->d_sb_lru,
-+ &this->d_sb->s_dentry_unused);
- dentry_stat.nr_unused++;
- found++;
- }
-@@ -735,12 +756,18 @@ void shrink_dcache_anon(struct super_blo
- */
- static int shrink_dcache_memory(int nr, unsigned int gfp_mask)
- {
-+ int res = -1;
-+
-+ KSTAT_PERF_ENTER(shrink_dcache)
- if (nr) {
- if (!(gfp_mask & __GFP_FS))
-- return -1;
-+ goto out;
- prune_dcache(nr, NULL);
- }
-- return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
-+ res = (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
-+out:
-+ KSTAT_PERF_LEAVE(shrink_dcache)
-+ return res;
- }
-
- /**
-@@ -758,21 +785,26 @@ struct dentry *d_alloc(struct dentry * p
- struct dentry *dentry;
- char *dname;
-
-+ dname = NULL;
-+ if (name->len > DNAME_INLINE_LEN-1) {
-+ dname = kmalloc(name->len + 1, GFP_KERNEL);
-+ if (!dname)
-+ goto err_name;
-+ }
-+
-+ ub_dentry_alloc_start();
- dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
- if (!dentry)
-- return NULL;
-+ goto err_dentry;
-
-- if (name->len > DNAME_INLINE_LEN-1) {
-- dname = kmalloc(name->len + 1, GFP_KERNEL);
-- if (!dname) {
-- kmem_cache_free(dentry_cache, dentry);
-- return NULL;
-- }
-- } else {
-+ preempt_disable();
-+ if (dname == NULL)
- dname = dentry->d_iname;
-- }
- dentry->d_name.name = dname;
-
-+ if (ub_dentry_alloc(dentry))
-+ goto err_charge;
-+
- dentry->d_name.len = name->len;
- dentry->d_name.hash = name->hash;
- memcpy(dname, name->name, name->len);
-@@ -792,6 +824,7 @@ struct dentry *d_alloc(struct dentry * p
- dentry->d_bucket = NULL;
- INIT_HLIST_NODE(&dentry->d_hash);
- INIT_LIST_HEAD(&dentry->d_lru);
-+ INIT_LIST_HEAD(&dentry->d_sb_lru);
- INIT_LIST_HEAD(&dentry->d_subdirs);
- INIT_LIST_HEAD(&dentry->d_alias);
-
-@@ -803,12 +836,27 @@ struct dentry *d_alloc(struct dentry * p
- }
-
- spin_lock(&dcache_lock);
-- if (parent)
-+ if (parent) {
- list_add(&dentry->d_child, &parent->d_subdirs);
-+ if (parent->d_flags & DCACHE_VIRTUAL)
-+ dentry->d_flags |= DCACHE_VIRTUAL;
-+ }
- dentry_stat.nr_dentry++;
- spin_unlock(&dcache_lock);
-+ preempt_enable();
-+ ub_dentry_alloc_end();
-
- return dentry;
-+
-+err_charge:
-+ preempt_enable();
-+ kmem_cache_free(dentry_cache, dentry);
-+err_dentry:
-+ if (name->len > DNAME_INLINE_LEN - 1)
-+ kfree(dname);
-+ ub_dentry_alloc_end();
-+err_name:
-+ return NULL;
- }
-
- /**
-@@ -1087,6 +1135,8 @@ struct dentry * __d_lookup(struct dentry
- atomic_inc(&dentry->d_count);
- found = dentry;
- audit_update_watch(dentry, 0);
-+ if (ub_dentry_charge(found))
-+ goto charge_failure;
- }
- terminate:
- spin_unlock(&dentry->d_lock);
-@@ -1097,6 +1147,14 @@ next:
- rcu_read_unlock();
-
- return found;
-+
-+charge_failure:
-+ spin_unlock(&found->d_lock);
-+ rcu_read_unlock();
-+ /* dentry is now unhashed, just kill it */
-+ dput(found);
-+ /* ... and fail lookup */
-+ return NULL;
- }
-
- /**
-@@ -1346,6 +1404,32 @@ already_unhashed:
- }
-
- /**
-+ * __d_path_add_deleted - prepend "(deleted) " text
-+ * @end: a pointer to the character after free space at the beginning of the
-+ * buffer
-+ * @buflen: remaining free space
-+ */
-+static inline char * __d_path_add_deleted(char * end, int buflen)
-+{
-+ buflen -= 10;
-+ if (buflen < 0)
-+ return ERR_PTR(-ENAMETOOLONG);
-+ end -= 10;
-+ memcpy(end, "(deleted) ", 10);
-+ return end;
-+}
-+
-+/**
-+ * d_root_check - checks if dentry is accessible from current's fs root
-+ * @dentry: dentry to be verified
-+ * @vfsmnt: vfsmnt to which the dentry belongs
-+ */
-+int d_root_check(struct dentry *dentry, struct vfsmount *vfsmnt)
-+{
-+ return PTR_ERR(d_path(dentry, vfsmnt, NULL, 0));
-+}
-+
-+/**
- * d_path - return the path of a dentry
- * @dentry: dentry to report
- * @vfsmnt: vfsmnt to which the dentry belongs
-@@ -1366,36 +1450,35 @@ char * __d_path( struct dentry *dentry,
- char *buffer, int buflen)
- {
- char * end = buffer+buflen;
-- char * retval;
-+ char * retval = NULL;
- int namelen;
-+ int deleted;
-+ struct vfsmount *oldvfsmnt;
-
-- *--end = '\0';
-- buflen--;
-- if (!IS_ROOT(dentry) && d_unhashed(dentry)) {
-- buflen -= 10;
-- end -= 10;
-- if (buflen < 0)
-+ oldvfsmnt = vfsmnt;
-+ deleted = (!IS_ROOT(dentry) && d_unhashed(dentry));
-+ if (buffer != NULL) {
-+ *--end = '\0';
-+ buflen--;
-+
-+ if (buflen < 1)
- goto Elong;
-- memcpy(end, " (deleted)", 10);
-+ /* Get '/' right */
-+ retval = end-1;
-+ *retval = '/';
- }
-
-- if (buflen < 1)
-- goto Elong;
-- /* Get '/' right */
-- retval = end-1;
-- *retval = '/';
--
- for (;;) {
- struct dentry * parent;
-
- if (dentry == root && vfsmnt == rootmnt)
- break;
- if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
-- /* Global root? */
-+ /* root of a tree? */
- spin_lock(&vfsmount_lock);
- if (vfsmnt->mnt_parent == vfsmnt) {
- spin_unlock(&vfsmount_lock);
-- goto global_root;
-+ goto other_root;
- }
- dentry = vfsmnt->mnt_mountpoint;
- vfsmnt = vfsmnt->mnt_parent;
-@@ -1404,27 +1487,51 @@ char * __d_path( struct dentry *dentry,
- }
- parent = dentry->d_parent;
- prefetch(parent);
-+ if (buffer != NULL) {
-+ namelen = dentry->d_name.len;
-+ buflen -= namelen + 1;
-+ if (buflen < 0)
-+ goto Elong;
-+ end -= namelen;
-+ memcpy(end, dentry->d_name.name, namelen);
-+ *--end = '/';
-+ retval = end;
-+ }
-+ dentry = parent;
-+ }
-+ /* the given root point is reached */
-+finish:
-+ if (buffer != NULL && deleted)
-+ retval = __d_path_add_deleted(end, buflen);
-+ return retval;
-+
-+other_root:
-+ /*
-+ * We traversed the tree upward and reached a root, but the given
-+ * lookup terminal point wasn't encountered. It means either that the
-+ * dentry is out of our scope or belongs to an abstract space like
-+ * sock_mnt or pipe_mnt. Check for it.
-+ *
-+ * There are different options to check it.
-+ * We may assume that any dentry tree is unreachable unless it's
-+ * connected to `root' (defined as fs root of init aka child reaper)
-+ * and expose all paths that are not connected to it.
-+ * The other option is to allow exposing of known abstract spaces
-+ * explicitly and hide the path information for other cases.
-+ * This approach is more safe, let's take it. 2001/04/22 SAW
-+ */
-+ if (!(oldvfsmnt->mnt_sb->s_flags & MS_NOUSER))
-+ return ERR_PTR(-EINVAL);
-+ if (buffer != NULL) {
- namelen = dentry->d_name.len;
-- buflen -= namelen + 1;
-+ buflen -= namelen;
- if (buflen < 0)
- goto Elong;
-- end -= namelen;
-- memcpy(end, dentry->d_name.name, namelen);
-- *--end = '/';
-- retval = end;
-- dentry = parent;
-+ retval -= namelen-1; /* hit the slash */
-+ memcpy(retval, dentry->d_name.name, namelen);
- }
-+ goto finish;
-
-- return retval;
--
--global_root:
-- namelen = dentry->d_name.len;
-- buflen -= namelen;
-- if (buflen < 0)
-- goto Elong;
-- retval -= namelen-1; /* hit the slash */
-- memcpy(retval, dentry->d_name.name, namelen);
-- return retval;
- Elong:
- return ERR_PTR(-ENAMETOOLONG);
- }
-@@ -1451,6 +1558,226 @@ char * d_path(struct dentry *dentry, str
- return res;
- }
-
-+#ifdef CONFIG_VE
-+#include <net/sock.h>
-+#include <linux/ip.h>
-+#include <linux/file.h>
-+#include <linux/namespace.h>
-+#include <linux/vzratelimit.h>
-+
-+static void mark_sub_tree_virtual(struct dentry *d)
-+{
-+ struct dentry *orig_root;
-+
-+ orig_root = d;
-+ while (1) {
-+ spin_lock(&d->d_lock);
-+ d->d_flags |= DCACHE_VIRTUAL;
-+ spin_unlock(&d->d_lock);
-+
-+ if (!list_empty(&d->d_subdirs)) {
-+ d = list_entry(d->d_subdirs.next,
-+ struct dentry, d_child);
-+ continue;
-+ }
-+ if (d == orig_root)
-+ break;
-+ while (d == list_entry(d->d_parent->d_subdirs.prev,
-+ struct dentry, d_child)) {
-+ d = d->d_parent;
-+ if (d == orig_root)
-+ goto out;
-+ }
-+ d = list_entry(d->d_child.next,
-+ struct dentry, d_child);
-+ }
-+out:
-+ return;
-+}
-+
-+void mark_tree_virtual(struct vfsmount *m, struct dentry *d)
-+{
-+ struct vfsmount *orig_rootmnt;
-+
-+ spin_lock(&dcache_lock);
-+ spin_lock(&vfsmount_lock);
-+ orig_rootmnt = m;
-+ while (1) {
-+ mark_sub_tree_virtual(d);
-+ if (!list_empty(&m->mnt_mounts)) {
-+ m = list_entry(m->mnt_mounts.next,
-+ struct vfsmount, mnt_child);
-+ d = m->mnt_root;
-+ continue;
-+ }
-+ if (m == orig_rootmnt)
-+ break;
-+ while (m == list_entry(m->mnt_parent->mnt_mounts.prev,
-+ struct vfsmount, mnt_child)) {
-+ m = m->mnt_parent;
-+ if (m == orig_rootmnt)
-+ goto out;
-+ }
-+ m = list_entry(m->mnt_child.next,
-+ struct vfsmount, mnt_child);
-+ d = m->mnt_root;
-+ }
-+out:
-+ spin_unlock(&vfsmount_lock);
-+ spin_unlock(&dcache_lock);
-+}
-+EXPORT_SYMBOL(mark_tree_virtual);
-+
-+static struct vz_rate_info area_ri = { 20, 10*HZ };
-+#define VE_AREA_ACC_CHECK 0x0001
-+#define VE_AREA_ACC_DENY 0x0002
-+#define VE_AREA_EXEC_CHECK 0x0010
-+#define VE_AREA_EXEC_DENY 0x0020
-+#define VE0_AREA_ACC_CHECK 0x0100
-+#define VE0_AREA_ACC_DENY 0x0200
-+#define VE0_AREA_EXEC_CHECK 0x1000
-+#define VE0_AREA_EXEC_DENY 0x2000
-+int ve_area_access_check = 0;
-+
-+static void print_connection_info(struct task_struct *tsk)
-+{
-+ struct files_struct *files;
-+ int fd;
-+
-+ files = get_files_struct(tsk);
-+ if (!files)
-+ return;
-+
-+ spin_lock(&files->file_lock);
-+ for (fd = 0; fd < files->max_fds; fd++) {
-+ struct file *file;
-+ struct inode *inode;
-+ struct socket *socket;
-+ struct sock *sk;
-+ struct inet_opt *inet;
-+
-+ file = files->fd[fd];
-+ if (file == NULL)
-+ continue;
-+
-+ inode = file->f_dentry->d_inode;
-+ if (!inode->i_sock)
-+ continue;
-+
-+ socket = SOCKET_I(inode);
-+ if (socket == NULL)
-+ continue;
-+
-+ sk = socket->sk;
-+ if (sk->sk_family != PF_INET || sk->sk_type != SOCK_STREAM)
-+ continue;
-+
-+ inet = inet_sk(sk);
-+ printk(KERN_ALERT "connection from %u.%u.%u.%u:%u to port %u\n",
-+ NIPQUAD(inet->daddr), ntohs(inet->dport),
-+ inet->num);
-+ }
-+ spin_unlock(&files->file_lock);
-+ put_files_struct(files);
-+}
-+
-+static void check_alert(struct vfsmount *vfsmnt, struct dentry *dentry,
-+ char *str)
-+{
-+ struct task_struct *tsk;
-+ unsigned long page;
-+ struct super_block *sb;
-+ char *p;
-+
-+ if (!vz_ratelimit(&area_ri))
-+ return;
-+
-+ tsk = current;
-+ p = ERR_PTR(-ENOMEM);
-+ page = __get_free_page(GFP_KERNEL);
-+ if (page) {
-+ spin_lock(&dcache_lock);
-+ p = __d_path(dentry, vfsmnt, tsk->fs->root, tsk->fs->rootmnt,
-+ (char *)page, PAGE_SIZE);
-+ spin_unlock(&dcache_lock);
-+ }
-+ if (IS_ERR(p))
-+ p = "(undefined)";
-+
-+ sb = dentry->d_sb;
-+ printk(KERN_ALERT "%s check alert! file:[%s] from %d/%s, dev%x\n"
-+ "Task %d/%d[%s] from VE%d, execenv %d\n",
-+ str, p, VE_OWNER_FSTYPE(sb->s_type)->veid,
-+ sb->s_type->name, sb->s_dev,
-+ tsk->pid, virt_pid(tsk), tsk->comm,
-+ VE_TASK_INFO(tsk)->owner_env->veid,
-+ get_exec_env()->veid);
-+
-+ free_page(page);
-+
-+ print_connection_info(tsk);
-+
-+ read_lock(&tasklist_lock);
-+ tsk = tsk->real_parent;
-+ get_task_struct(tsk);
-+ read_unlock(&tasklist_lock);
-+
-+ printk(KERN_ALERT "Parent %d/%d[%s] from VE%d\n",
-+ tsk->pid, virt_pid(tsk), tsk->comm,
-+ VE_TASK_INFO(tsk)->owner_env->veid);
-+
-+ print_connection_info(tsk);
-+ put_task_struct(tsk);
-+ dump_stack();
-+}
-+#endif
-+
-+int check_area_access_ve(struct dentry *dentry, struct vfsmount *mnt)
-+{
-+#ifdef CONFIG_VE
-+ int check, alert, deny;
-+
-+ if (ve_is_super(get_exec_env())) {
-+ check = ve_area_access_check & VE0_AREA_ACC_CHECK;
-+ alert = dentry->d_flags & DCACHE_VIRTUAL;
-+ deny = ve_area_access_check & VE0_AREA_ACC_DENY;
-+ } else {
-+ check = ve_area_access_check & VE_AREA_ACC_CHECK;
-+ alert = !(dentry->d_flags & DCACHE_VIRTUAL);
-+ deny = ve_area_access_check & VE_AREA_ACC_DENY;
-+ }
-+
-+ if (check && alert)
-+ check_alert(mnt, dentry, "Access");
-+ if (deny && alert)
-+ return -EACCES;
-+#endif
-+ return 0;
-+}
-+
-+int check_area_execute_ve(struct dentry *dentry, struct vfsmount *mnt)
-+{
-+#ifdef CONFIG_VE
-+ int check, alert, deny;
-+
-+ if (ve_is_super(get_exec_env())) {
-+ check = ve_area_access_check & VE0_AREA_EXEC_CHECK;
-+ alert = dentry->d_flags & DCACHE_VIRTUAL;
-+ deny = ve_area_access_check & VE0_AREA_EXEC_DENY;
-+ } else {
-+ check = ve_area_access_check & VE_AREA_EXEC_CHECK;
-+ alert = !(dentry->d_flags & DCACHE_VIRTUAL);
-+ deny = ve_area_access_check & VE_AREA_EXEC_DENY;
-+ }
-+
-+ if (check && alert)
-+ check_alert(mnt, dentry, "Exec");
-+ if (deny && alert)
-+ return -EACCES;
-+#endif
-+ return 0;
-+}
-+
- /*
- * NOTE! The user-level library version returns a
- * character pointer. The kernel system call just
-@@ -1587,10 +1914,12 @@ resume:
- goto repeat;
- }
- atomic_dec(&dentry->d_count);
-+ ub_dentry_uncharge_locked(dentry);
- }
- if (this_parent != root) {
- next = this_parent->d_child.next;
- atomic_dec(&this_parent->d_count);
-+ ub_dentry_uncharge_locked(this_parent);
- this_parent = this_parent->d_parent;
- goto resume;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/dcookies.c linux-2.6.9-ve023stab030/fs/dcookies.c
---- linux-2.6.9-42.0.3.EL.orig/fs/dcookies.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/dcookies.c 2006-10-11 19:07:55.000000000 +0400
-@@ -93,12 +93,10 @@ static struct dcookie_struct * alloc_dco
- if (!dcs)
- return NULL;
-
-- atomic_inc(&dentry->d_count);
-- atomic_inc(&vfsmnt->mnt_count);
- dentry->d_cookie = dcs;
-
-- dcs->dentry = dentry;
-- dcs->vfsmnt = vfsmnt;
-+ dcs->dentry = dget(dentry);
-+ dcs->vfsmnt = mntget(vfsmnt);
- hash_dcookie(dcs);
-
- return dcs;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/devpts/inode.c linux-2.6.9-ve023stab030/fs/devpts/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/devpts/inode.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/devpts/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -12,6 +12,7 @@
-
- #include <linux/module.h>
- #include <linux/init.h>
-+#include <linux/ve.h>
- #include <linux/fs.h>
- #include <linux/sched.h>
- #include <linux/namei.h>
-@@ -43,13 +44,29 @@ struct inode_operations devpts_file_inod
- static struct vfsmount *devpts_mnt;
- static struct dentry *devpts_root;
-
--static struct {
-- int setuid;
-- int setgid;
-- uid_t uid;
-- gid_t gid;
-- umode_t mode;
--} config = {.mode = 0600};
-+void prepare_devpts(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->devpts_mnt = devpts_mnt;
-+ devpts_mnt = (struct vfsmount *)0x11121314;
-+
-+ /* ve0.devpts_root should be filled inside fill_super() */
-+ BUG_ON(devpts_root != NULL);
-+ devpts_root = (struct dentry *)0x12131415;
-+#endif
-+}
-+
-+#ifndef CONFIG_VE
-+#define visible_devpts_mnt devpts_mnt
-+#define visible_devpts_root devpts_root
-+#define visible_devpts_config config
-+#else
-+#define visible_devpts_mnt (get_exec_env()->devpts_mnt)
-+#define visible_devpts_root (get_exec_env()->devpts_root)
-+#define visible_devpts_config (*(get_exec_env()->devpts_config))
-+#endif
-+
-+static struct devpts_config config = {.mode = 0600};
-
- static int devpts_remount(struct super_block *sb, int *flags, char *data)
- {
-@@ -75,15 +92,16 @@ static int devpts_remount(struct super_b
- } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1)
- mode = n & ~S_IFMT;
- else {
-- printk("devpts: called with bogus options\n");
-+ ve_printk(VE_LOG,
-+ "devpts: called with bogus options\n");
- return -EINVAL;
- }
- }
-- config.setuid = setuid;
-- config.setgid = setgid;
-- config.uid = uid;
-- config.gid = gid;
-- config.mode = mode;
-+ visible_devpts_config.setuid = setuid;
-+ visible_devpts_config.setgid = setgid;
-+ visible_devpts_config.uid = uid;
-+ visible_devpts_config.gid = gid;
-+ visible_devpts_config.mode = mode;
-
- return 0;
- }
-@@ -117,10 +135,10 @@ devpts_fill_super(struct super_block *s,
- inode->i_fop = &simple_dir_operations;
- inode->i_nlink = 2;
-
-- devpts_root = s->s_root = d_alloc_root(inode);
-+ visible_devpts_root = s->s_root = d_alloc_root(inode);
- if (s->s_root)
- return 0;
--
-+
- printk("devpts: get root dentry failed\n");
- iput(inode);
- fail:
-@@ -133,13 +151,15 @@ static struct super_block *devpts_get_sb
- return get_sb_single(fs_type, flags, data, devpts_fill_super);
- }
-
--static struct file_system_type devpts_fs_type = {
-+struct file_system_type devpts_fs_type = {
- .owner = THIS_MODULE,
- .name = "devpts",
- .get_sb = devpts_get_sb,
- .kill_sb = kill_anon_super,
- };
-
-+EXPORT_SYMBOL(devpts_fs_type);
-+
- /*
- * The normal naming convention is simply /dev/pts/<number>; this conforms
- * to the System V naming convention
-@@ -148,7 +168,7 @@ static struct file_system_type devpts_fs
- static struct dentry *get_node(int num)
- {
- char s[12];
-- struct dentry *root = devpts_root;
-+ struct dentry *root = visible_devpts_root;
- down(&root->d_inode->i_sem);
- return lookup_one_len(s, root, sprintf(s, "%d", num));
- }
-@@ -159,7 +179,7 @@ int devpts_pty_new(struct tty_struct *tt
- struct tty_driver *driver = tty->driver;
- dev_t device = MKDEV(driver->major, driver->minor_start+number);
- struct dentry *dentry;
-- struct inode *inode = new_inode(devpts_mnt->mnt_sb);
-+ struct inode *inode = new_inode(visible_devpts_mnt->mnt_sb);
-
- /* We're supposed to be given the slave end of a pty */
- BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY);
-@@ -170,10 +190,12 @@ int devpts_pty_new(struct tty_struct *tt
-
- inode->i_ino = number+2;
- inode->i_blksize = 1024;
-- inode->i_uid = config.setuid ? config.uid : current->fsuid;
-- inode->i_gid = config.setgid ? config.gid : current->fsgid;
-+ inode->i_uid = visible_devpts_config.setuid ?
-+ visible_devpts_config.uid : current->fsuid;
-+ inode->i_gid = visible_devpts_config.setgid ?
-+ visible_devpts_config.gid : current->fsgid;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-- init_special_inode(inode, S_IFCHR|config.mode, device);
-+ init_special_inode(inode, S_IFCHR|visible_devpts_config.mode, device);
- inode->i_op = &devpts_file_inode_operations;
- inode->u.generic_ip = tty;
-
-@@ -181,7 +203,7 @@ int devpts_pty_new(struct tty_struct *tt
- if (!IS_ERR(dentry) && !dentry->d_inode)
- d_instantiate(dentry, inode);
-
-- up(&devpts_root->d_inode->i_sem);
-+ up(&visible_devpts_root->d_inode->i_sem);
-
- return 0;
- }
-@@ -198,7 +220,7 @@ struct tty_struct *devpts_get_tty(int nu
- dput(dentry);
- }
-
-- up(&devpts_root->d_inode->i_sem);
-+ up(&visible_devpts_root->d_inode->i_sem);
-
- return tty;
- }
-@@ -216,22 +238,28 @@ void devpts_pty_kill(int number)
- }
- dput(dentry);
- }
-- up(&devpts_root->d_inode->i_sem);
-+ up(&visible_devpts_root->d_inode->i_sem);
- }
-
- static int __init init_devpts_fs(void)
- {
-- int err = register_filesystem(&devpts_fs_type);
-+ int err;
-+#ifdef CONFIG_VE
-+ get_ve0()->devpts_config = &config;
-+#endif
-+ err = register_filesystem(&devpts_fs_type);
- if (!err) {
- devpts_mnt = kern_mount(&devpts_fs_type);
- if (IS_ERR(devpts_mnt))
- err = PTR_ERR(devpts_mnt);
- }
-+ prepare_devpts();
- return err;
- }
-
- static void __exit exit_devpts_fs(void)
- {
-+ /* the code is never called, the argument is irrelevant */
- unregister_filesystem(&devpts_fs_type);
- mntput(devpts_mnt);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/dquot.c linux-2.6.9-ve023stab030/fs/dquot.c
---- linux-2.6.9-42.0.3.EL.orig/fs/dquot.c 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/dquot.c 2006-10-11 19:07:58.000000000 +0400
-@@ -152,7 +152,9 @@ static struct quota_format_type *find_qu
- struct quota_format_type *actqf;
-
- spin_lock(&dq_list_lock);
-- for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
-+ for (actqf = quota_formats;
-+ actqf && (actqf->qf_fmt_id != id || actqf->qf_ops == NULL);
-+ actqf = actqf->qf_next);
- if (!actqf || !try_module_get(actqf->qf_owner)) {
- int qm;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/eventpoll.c linux-2.6.9-ve023stab030/fs/eventpoll.c
---- linux-2.6.9-42.0.3.EL.orig/fs/eventpoll.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/eventpoll.c 2006-10-11 19:07:59.000000000 +0400
-@@ -151,11 +151,10 @@
- /* Tells if the epoll_ctl(2) operation needs an event copy from userspace */
- #define EP_OP_HASH_EVENT(op) ((op) != EPOLL_CTL_DEL)
-
-+/* Maximum msec timeout value storeable in a long int */
-+#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX - 999ULL) / HZ)
-+
-
--struct epoll_filefd {
-- struct file *file;
-- int fd;
--};
-
- /*
- * Node that is linked into the "wake_task_list" member of the "struct poll_safewake".
-@@ -179,36 +178,6 @@ struct poll_safewake {
- spinlock_t lock;
- };
-
--/*
-- * This structure is stored inside the "private_data" member of the file
-- * structure and rapresent the main data sructure for the eventpoll
-- * interface.
-- */
--struct eventpoll {
-- /* Protect the this structure access */
-- rwlock_t lock;
--
-- /*
-- * This semaphore is used to ensure that files are not removed
-- * while epoll is using them. This is read-held during the event
-- * collection loop and it is write-held during the file cleanup
-- * path, the epoll file exit code and the ctl operations.
-- */
-- struct rw_semaphore sem;
--
-- /* Wait queue used by sys_epoll_wait() */
-- wait_queue_head_t wq;
--
-- /* Wait queue used by file->poll() */
-- wait_queue_head_t poll_wait;
--
-- /* List of ready file descriptors */
-- struct list_head rdllist;
--
-- /* RB-Tree root used to store monitored fd structs */
-- struct rb_root rbr;
--};
--
- /* Wait structure used by the poll hooks */
- struct eppoll_entry {
- /* List header used to link this structure to the "struct epitem" */
-@@ -227,50 +196,6 @@ struct eppoll_entry {
- wait_queue_head_t *whead;
- };
-
--/*
-- * Each file descriptor added to the eventpoll interface will
-- * have an entry of this type linked to the hash.
-- */
--struct epitem {
-- /* RB-Tree node used to link this structure to the eventpoll rb-tree */
-- struct rb_node rbn;
--
-- /* List header used to link this structure to the eventpoll ready list */
-- struct list_head rdllink;
--
-- /* The file descriptor information this item refers to */
-- struct epoll_filefd ffd;
--
-- /* Number of active wait queue attached to poll operations */
-- int nwait;
--
-- /* List containing poll wait queues */
-- struct list_head pwqlist;
--
-- /* The "container" of this item */
-- struct eventpoll *ep;
--
-- /* The structure that describe the interested events and the source fd */
-- struct epoll_event event;
--
-- /*
-- * Used to keep track of the usage count of the structure. This avoids
-- * that the structure will desappear from underneath our processing.
-- */
-- atomic_t usecnt;
--
-- /* List header used to link this item to the "struct file" items list */
-- struct list_head fllink;
--
-- /* List header used to link the item to the transfer list */
-- struct list_head txlink;
--
-- /*
-- * This is used during the collection/transfer of events to userspace
-- * to pin items empty events set.
-- */
-- unsigned int revents;
--};
-
- /* Wrapper struct used by poll queueing */
- struct ep_pqueue {
-@@ -285,13 +210,13 @@ static void ep_poll_safewake(struct poll
- static int ep_getfd(int *efd, struct inode **einode, struct file **efile);
- static int ep_file_init(struct file *file);
- static void ep_free(struct eventpoll *ep);
--static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
-+struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
- static void ep_use_epitem(struct epitem *epi);
--static void ep_release_epitem(struct epitem *epi);
-+void ep_release_epitem(struct epitem *epi);
- static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead,
- poll_table *pt);
- static void ep_rbtree_insert(struct eventpoll *ep, struct epitem *epi);
--static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
-+int ep_insert(struct eventpoll *ep, struct epoll_event *event,
- struct file *tfile, int fd);
- static int ep_modify(struct eventpoll *ep, struct epitem *epi,
- struct epoll_event *event);
-@@ -321,6 +246,7 @@ static struct super_block *eventpollfs_g
- * This semaphore is used to serialize ep_free() and eventpoll_release_file().
- */
- struct semaphore epsem;
-+EXPORT_SYMBOL(epsem);
-
- /* Safe wake up implementation */
- static struct poll_safewake psw;
-@@ -335,10 +261,11 @@ static kmem_cache_t *pwq_cache;
- static struct vfsmount *eventpoll_mnt;
-
- /* File callbacks that implement the eventpoll file behaviour */
--static struct file_operations eventpoll_fops = {
-+struct file_operations eventpoll_fops = {
- .release = ep_eventpoll_close,
- .poll = ep_eventpoll_poll
- };
-+EXPORT_SYMBOL(eventpoll_fops);
-
- /*
- * This is used to register the virtual file system from where
-@@ -513,6 +440,7 @@ eexit_1:
- current, size, error));
- return error;
- }
-+EXPORT_SYMBOL(sys_epoll_create);
-
-
- /*
-@@ -821,7 +749,7 @@ static void ep_free(struct eventpoll *ep
- * the returned item, so the caller must call ep_release_epitem()
- * after finished using the "struct epitem".
- */
--static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd)
-+struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd)
- {
- int kcmp;
- unsigned long flags;
-@@ -851,6 +779,7 @@ static struct epitem *ep_find(struct eve
-
- return epir;
- }
-+EXPORT_SYMBOL(ep_find);
-
-
- /*
-@@ -869,12 +798,13 @@ static void ep_use_epitem(struct epitem
- * has finished using the structure. It might lead to freeing the
- * structure itself if the count goes to zero.
- */
--static void ep_release_epitem(struct epitem *epi)
-+void ep_release_epitem(struct epitem *epi)
- {
-
- if (atomic_dec_and_test(&epi->usecnt))
- EPI_MEM_FREE(epi);
- }
-+EXPORT_SYMBOL(ep_release_epitem);
-
-
- /*
-@@ -921,7 +851,7 @@ static void ep_rbtree_insert(struct even
- }
-
-
--static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
-+int ep_insert(struct eventpoll *ep, struct epoll_event *event,
- struct file *tfile, int fd)
- {
- int error, revents, pwake = 0;
-@@ -1013,6 +943,7 @@ eexit_2:
- eexit_1:
- return error;
- }
-+EXPORT_SYMBOL(ep_insert);
-
-
- /*
-@@ -1479,8 +1410,8 @@ static int ep_poll(struct eventpoll *ep,
- * and the overflow condition. The passed timeout is in milliseconds,
- * that why (t * HZ) / 1000.
- */
-- jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
-- MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000;
-+ jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
-+ MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;
-
- retry:
- write_lock_irqsave(&ep->lock, flags);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/exec.c linux-2.6.9-ve023stab030/fs/exec.c
---- linux-2.6.9-42.0.3.EL.orig/fs/exec.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/exec.c 2006-10-11 19:08:00.000000000 +0400
-@@ -26,6 +26,7 @@
- #include <linux/slab.h>
- #include <linux/file.h>
- #include <linux/mman.h>
-+#include <linux/virtinfo.h>
- #include <linux/a.out.h>
- #include <linux/stat.h>
- #include <linux/fcntl.h>
-@@ -52,6 +53,8 @@
- #include <asm/uaccess.h>
- #include <asm/mmu_context.h>
-
-+#include <ub/ub_vmpages.h>
-+
- #ifdef CONFIG_KMOD
- #include <linux/kmod.h>
- #endif
-@@ -59,6 +62,7 @@
- int core_uses_pid;
- char core_pattern[65] = "core";
- int suid_dumpable = 0;
-+int sysctl_at_vsyscall = 1;
-
- EXPORT_SYMBOL(suid_dumpable);
-
-@@ -136,7 +140,7 @@ asmlinkage long sys_uselib(const char __
- if (!S_ISREG(nd.dentry->d_inode->i_mode))
- goto exit;
-
-- error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC, &nd);
-+ error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC, &nd, NULL);
- if (error)
- goto exit;
-
-@@ -304,10 +308,14 @@ void install_arg_page(struct vm_area_str
- struct page *page, unsigned long address)
- {
- struct mm_struct *mm = vma->vm_mm;
-+ struct page_beancounter *pbc;
- pgd_t * pgd;
- pmd_t * pmd;
- pte_t * pte;
-
-+ if (pb_alloc(&pbc))
-+ return;
-+
- if (unlikely(anon_vma_prepare(vma)))
- goto out_sig;
-
-@@ -326,9 +334,14 @@ void install_arg_page(struct vm_area_str
- goto out;
- }
- mm->rss++;
-+ vma->vm_rss++;
- lru_cache_add_active(page);
- set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(
- page, vma->vm_page_prot))));
-+
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
-+ pb_add_ref(page, mm_ub(mm), &pbc);
-+
- page_add_anon_rmap(page, vma, address);
- pte_unmap(pte);
- spin_unlock(&mm->page_table_lock);
-@@ -340,6 +353,31 @@ out:
- out_sig:
- __free_page(page);
- force_sig(SIGKILL, current);
-+ pb_free(&pbc);
-+}
-+
-+static inline void get_stack_vma_params(struct mm_struct *mm, int exec_stack,
-+ unsigned long stack_base, struct linux_binprm *bprm,
-+ unsigned long *start, unsigned long *end, unsigned long *flags)
-+{
-+#ifdef CONFIG_STACK_GROWSUP
-+ *start = stack_base;
-+ *end = PAGE_MASK &
-+ (PAGE_SIZE - 1 + (unsigned long) bprm->p);
-+#else
-+ *start = PAGE_MASK & (unsigned long) bprm->p;
-+ *end = STACK_TOP;
-+#endif
-+ /* Adjust stack execute permissions; explicitly enable
-+ * for EXSTACK_ENABLE_X, disable for EXSTACK_DISABLE_X
-+ * and leave alone (arch default) otherwise. */
-+ if (unlikely(exec_stack == EXSTACK_ENABLE_X))
-+ *flags = VM_STACK_FLAGS | VM_EXEC;
-+ else if (exec_stack == EXSTACK_DISABLE_X)
-+ *flags = VM_STACK_FLAGS & ~VM_EXEC;
-+ else
-+ *flags = VM_STACK_FLAGS;
-+ *flags |= mm->def_flags;
- }
-
- int setup_arg_pages(struct linux_binprm *bprm, int executable_stack)
-@@ -350,6 +388,10 @@ int setup_arg_pages(struct linux_binprm
- int i, ret;
- long arg_size;
-
-+ unsigned long vm_start;
-+ unsigned long vm_end;
-+ unsigned long vm_flags;
-+
- #ifdef CONFIG_STACK_GROWSUP
- /* Move the argument and environment strings to the bottom of the
- * stack space.
-@@ -410,44 +452,32 @@ int setup_arg_pages(struct linux_binprm
- bprm->loader += stack_base;
- bprm->exec += stack_base;
-
-- mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-+ get_stack_vma_params(mm, executable_stack, stack_base, bprm,
-+ &vm_start, &vm_end, &vm_flags);
-+
-+ ret = -ENOMEM;
-+ if (ub_memory_charge(mm_ub(mm), vm_end - vm_start, vm_flags,
-+ NULL, UB_SOFT))
-+ goto out;
-+ mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL | __GFP_SOFT_UBC);
- if (!mpnt)
-- return -ENOMEM;
-+ goto out_uncharge;
-
-- if (security_vm_enough_memory(arg_size >> PAGE_SHIFT)) {
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return -ENOMEM;
-- }
-+ if (security_vm_enough_memory(arg_size >> PAGE_SHIFT))
-+ goto out_free;
-
- memset(mpnt, 0, sizeof(*mpnt));
-
- down_write(&mm->mmap_sem);
- {
- mpnt->vm_mm = mm;
--#ifdef CONFIG_STACK_GROWSUP
-- mpnt->vm_start = stack_base;
-- mpnt->vm_end = PAGE_MASK &
-- (PAGE_SIZE - 1 + (unsigned long) bprm->p);
--#else
-- mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
-- mpnt->vm_end = STACK_TOP;
--#endif
-- /* Adjust stack execute permissions; explicitly enable
-- * for EXSTACK_ENABLE_X, disable for EXSTACK_DISABLE_X
-- * and leave alone (arch default) otherwise. */
-- if (unlikely(executable_stack == EXSTACK_ENABLE_X))
-- mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC;
-- else if (executable_stack == EXSTACK_DISABLE_X)
-- mpnt->vm_flags = VM_STACK_FLAGS & ~VM_EXEC;
-- else
-- mpnt->vm_flags = VM_STACK_FLAGS;
-- mpnt->vm_flags |= mm->def_flags;
-+ mpnt->vm_start = vm_start;
-+ mpnt->vm_end = vm_end;
-+ mpnt->vm_flags = vm_flags;
-+ mpnt->vm_rss = 0;
- mpnt->vm_page_prot = protection_map[mpnt->vm_flags & 0x7];
-- if ((ret = insert_vm_struct(mm, mpnt))) {
-- up_write(&mm->mmap_sem);
-- kmem_cache_free(vm_area_cachep, mpnt);
-- return ret;
-- }
-+ if ((ret = insert_vm_struct(mm, mpnt)))
-+ goto out_up;
- mm->stack_vm = mm->total_vm = vma_pages(mpnt);
- }
-
-@@ -462,6 +492,16 @@ int setup_arg_pages(struct linux_binprm
- up_write(&mm->mmap_sem);
-
- return 0;
-+
-+out_up:
-+ up_write(&mm->mmap_sem);
-+ vm_unacct_memory(arg_size >> PAGE_SHIFT);
-+out_free:
-+ kmem_cache_free(vm_area_cachep, mpnt);
-+out_uncharge:
-+ ub_memory_uncharge(mm_ub(mm), vm_end - vm_start, vm_flags, NULL);
-+out:
-+ return ret;
- }
-
- EXPORT_SYMBOL(setup_arg_pages);
-@@ -483,7 +523,7 @@ static inline void free_arg_pages(struct
-
- #endif /* CONFIG_MMU */
-
--struct file *open_exec(const char *name)
-+struct file *open_exec(const char *name, struct linux_binprm *bprm)
- {
- struct nameidata nd;
- int err;
-@@ -498,9 +538,13 @@ struct file *open_exec(const char *name)
- file = ERR_PTR(-EACCES);
- if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
- S_ISREG(inode->i_mode)) {
-- int err = permission(inode, MAY_EXEC, &nd);
-- if (!err && !(inode->i_mode & 0111))
-- err = -EACCES;
-+ int err;
-+ if (bprm != NULL) {
-+ bprm->perm.set = 0;
-+ err = permission(inode, MAY_EXEC, &nd,
-+ &bprm->perm);
-+ } else
-+ err = permission(inode, MAY_EXEC, &nd, NULL);
- file = ERR_PTR(err);
- if (!err) {
- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
-@@ -539,16 +583,11 @@ int kernel_read(struct file *file, unsig
-
- EXPORT_SYMBOL(kernel_read);
-
--static int exec_mmap(struct mm_struct *mm)
-+static int exec_mmap(struct linux_binprm *bprm)
- {
- struct task_struct *tsk;
-- struct mm_struct * old_mm, *active_mm;
--
-- /* Add it to the list of mm's */
-- spin_lock(&mmlist_lock);
-- list_add(&mm->mmlist, &init_mm.mmlist);
-- mmlist_nr++;
-- spin_unlock(&mmlist_lock);
-+ struct mm_struct *mm, *old_mm, *active_mm;
-+ int ret;
-
- /* Notify parent that we're no longer interested in the old VM */
- tsk = current;
-@@ -570,21 +609,40 @@ static int exec_mmap(struct mm_struct *m
- return -EINTR;
- }
- }
-+
-+ ret = 0;
- task_lock(tsk);
-+ mm = bprm->mm;
- active_mm = tsk->active_mm;
- tsk->mm = mm;
- tsk->active_mm = mm;
- activate_mm(active_mm, mm);
- task_unlock(tsk);
- arch_pick_mmap_layout(mm);
-+
-+ /* Add it to the list of mm's */
-+ spin_lock(&mmlist_lock);
-+ list_add(&mm->mmlist, &init_mm.mmlist);
-+ mmlist_nr++;
-+ spin_unlock(&mmlist_lock);
-+ bprm->mm = NULL; /* We're using it now */
-+
-+#ifdef CONFIG_VZ_GENCALLS
-+ if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_EXECMMAP,
-+ bprm) & NOTIFY_FAIL) {
-+ /* similar to binfmt_elf */
-+ send_sig(SIGKILL, current, 0);
-+ ret = -ENOMEM;
-+ }
-+#endif
- if (old_mm) {
- up_read(&old_mm->mmap_sem);
- if (active_mm != old_mm) BUG();
- mmput(old_mm);
-- return 0;
-+ return ret;
- }
- mmdrop(active_mm);
-- return 0;
-+ return ret;
- }
-
- /*
-@@ -595,17 +653,21 @@ static int exec_mmap(struct mm_struct *m
- */
- static inline int de_thread(struct task_struct *tsk)
- {
-- struct signal_struct *newsig, *oldsig = tsk->signal;
-+ struct signal_struct *sig = tsk->signal;
- struct sighand_struct *newsighand, *oldsighand = tsk->sighand;
- spinlock_t *lock = &oldsighand->siglock;
-+ struct task_struct *leader = NULL;
- int count;
-
- /*
- * If we don't share sighandlers, then we aren't sharing anything
- * and we can just re-use it all.
- */
-- if (atomic_read(&oldsighand->count) <= 1)
-+ if (atomic_read(&oldsighand->count) <= 1) {
-+ BUG_ON(atomic_read(&sig->count) != 1);
-+ exit_itimers(sig);
- return 0;
-+ }
-
- newsighand = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
- if (!newsighand)
-@@ -615,40 +677,6 @@ static inline int de_thread(struct task_
- atomic_set(&newsighand->count, 1);
- memcpy(newsighand->action, oldsighand->action, sizeof(newsighand->action));
-
-- /*
-- * See if we need to allocate a new signal structure
-- */
-- newsig = NULL;
-- if (atomic_read(&oldsig->count) > 1) {
-- newsig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
-- if (!newsig) {
-- kmem_cache_free(sighand_cachep, newsighand);
-- return -ENOMEM;
-- }
-- atomic_set(&newsig->count, 1);
-- newsig->group_exit = 0;
-- newsig->group_exit_code = 0;
-- newsig->group_exit_task = NULL;
-- newsig->group_stop_count = 0;
-- newsig->curr_target = NULL;
-- init_sigpending(&newsig->shared_pending);
-- INIT_LIST_HEAD(&newsig->posix_timers);
--
-- newsig->tty = oldsig->tty;
-- newsig->pgrp = oldsig->pgrp;
-- newsig->session = oldsig->session;
-- newsig->leader = oldsig->leader;
-- newsig->tty_old_pgrp = oldsig->tty_old_pgrp;
--#ifdef CONFIG_KEYS
-- rcu_read_lock();
-- newsig->session_keyring =
-- key_get(rcu_dereference(oldsig->session_keyring));
-- rcu_read_unlock();
--
-- newsig->process_keyring = key_get(oldsig->process_keyring);
--#endif
-- }
--
- if (thread_group_empty(current))
- goto no_thread_group;
-
-@@ -658,7 +686,7 @@ static inline int de_thread(struct task_
- */
- read_lock(&tasklist_lock);
- spin_lock_irq(lock);
-- if (oldsig->group_exit) {
-+ if (sig->group_exit) {
- /*
- * Another group action in progress, just
- * return so that the signal is processed.
-@@ -666,11 +694,9 @@ static inline int de_thread(struct task_
- spin_unlock_irq(lock);
- read_unlock(&tasklist_lock);
- kmem_cache_free(sighand_cachep, newsighand);
-- if (newsig)
-- kmem_cache_free(signal_cachep, newsig);
- return -EAGAIN;
- }
-- oldsig->group_exit = 1;
-+ sig->group_exit = 1;
- zap_other_threads(current);
- read_unlock(&tasklist_lock);
-
-@@ -680,14 +706,16 @@ static inline int de_thread(struct task_
- count = 2;
- if (current->pid == current->tgid)
- count = 1;
-- while (atomic_read(&oldsig->count) > count) {
-- oldsig->group_exit_task = current;
-- oldsig->notify_count = count;
-+ while (atomic_read(&sig->count) > count) {
-+ sig->group_exit_task = current;
-+ sig->notify_count = count;
- __set_current_state(TASK_UNINTERRUPTIBLE);
- spin_unlock_irq(lock);
- schedule();
- spin_lock_irq(lock);
- }
-+ sig->group_exit_task = NULL;
-+ sig->notify_count = 0;
- spin_unlock_irq(lock);
-
- /*
-@@ -696,22 +724,23 @@ static inline int de_thread(struct task_
- * and to assume its PID:
- */
- if (current->pid != current->tgid) {
-- struct task_struct *leader = current->group_leader, *parent;
-- struct dentry *proc_dentry1, *proc_dentry2;
-- unsigned long exit_state, ptrace;
-+ struct task_struct *parent;
-+ struct dentry *proc_dentry1[2], *proc_dentry2[2];
-+ unsigned long ptrace;
-
- /*
- * Wait for the thread group leader to be a zombie.
- * It should already be zombie at this point, most
- * of the time.
- */
-+ leader = current->group_leader;
- while (leader->exit_state != EXIT_ZOMBIE)
- yield();
-
- spin_lock(&leader->proc_lock);
- spin_lock(&current->proc_lock);
-- proc_dentry1 = proc_pid_unhash(current);
-- proc_dentry2 = proc_pid_unhash(leader);
-+ proc_pid_unhash(current, proc_dentry1);
-+ proc_pid_unhash(leader, proc_dentry2);
- write_lock_irq(&tasklist_lock);
-
- if (leader->tgid != current->tgid)
-@@ -757,48 +786,60 @@ static inline int de_thread(struct task_
- list_del(&current->tasks);
- list_add_tail(&current->tasks, &init_task.tasks);
- current->exit_signal = SIGCHLD;
-- exit_state = leader->exit_state;
-+ BUG_ON(leader->exit_state != EXIT_ZOMBIE);
-+ leader->exit_state = EXIT_DEAD;
-
- write_unlock_irq(&tasklist_lock);
- spin_unlock(&leader->proc_lock);
- spin_unlock(&current->proc_lock);
- proc_pid_flush(proc_dentry1);
- proc_pid_flush(proc_dentry2);
--
-- if (exit_state != EXIT_ZOMBIE)
-- BUG();
-- release_task(leader);
- }
-
-+ /*
-+ * Now there are really no other threads at all,
-+ * so it's safe to stop telling them to kill themselves.
-+ */
-+ sig->group_exit = 0;
-+
- no_thread_group:
-+ exit_itimers(sig);
-+ if (leader)
-+ release_task(leader);
-
-- write_lock_irq(&tasklist_lock);
-- spin_lock(&oldsighand->siglock);
-- spin_lock(&newsighand->siglock);
--
-- if (current == oldsig->curr_target)
-- oldsig->curr_target = next_thread(current);
-- if (newsig)
-- current->signal = newsig;
-- current->sighand = newsighand;
-- init_sigpending(&current->pending);
-- recalc_sigpending();
--
-- spin_unlock(&newsighand->siglock);
-- spin_unlock(&oldsighand->siglock);
-- write_unlock_irq(&tasklist_lock);
--
-- if (newsig && atomic_dec_and_test(&oldsig->count)) {
-- exit_itimers(oldsig);
-- exit_thread_group_keys(oldsig);
-- kmem_cache_free(signal_cachep, oldsig);
-- }
-+ BUG_ON(atomic_read(&sig->count) != 1);
-+
-+ if (atomic_read(&oldsighand->count) == 1) {
-+ /*
-+ * Now that we nuked the rest of the thread group,
-+ * it turns out we are not sharing sighand any more either.
-+ * So we can just keep it.
-+ */
-+ kmem_cache_free(sighand_cachep, newsighand);
-+ } else {
-+ /*
-+ * Move our state over to newsighand and switch it in.
-+ */
-+ spin_lock_init(&newsighand->siglock);
-+ atomic_set(&newsighand->count, 1);
-+ memcpy(newsighand->action, oldsighand->action,
-+ sizeof(newsighand->action));
-+
-+ write_lock_irq(&tasklist_lock);
-+ spin_lock(&oldsighand->siglock);
-+ spin_lock(&newsighand->siglock);
-
-- if (atomic_dec_and_test(&oldsighand->count))
-- kmem_cache_free(sighand_cachep, oldsighand);
-+ current->sighand = newsighand;
-+ recalc_sigpending();
-+
-+ spin_unlock(&newsighand->siglock);
-+ spin_unlock(&oldsighand->siglock);
-+ write_unlock_irq(&tasklist_lock);
-+
-+ if (atomic_dec_and_test(&oldsighand->count))
-+ kmem_cache_free(sighand_cachep, oldsighand);
-+ }
-
-- if (!thread_group_empty(current))
-- BUG();
- if (current->tgid != current->pid)
- BUG();
- return 0;
-@@ -879,12 +920,10 @@ int flush_old_exec(struct linux_binprm *
- /*
- * Release all of the old mmap stuff
- */
-- retval = exec_mmap(bprm->mm);
-+ retval = exec_mmap(bprm);
- if (retval)
- goto mmap_failed;
-
-- bprm->mm = NULL; /* We're using it now */
--
- /* This is the point of no return */
- steal_locks(files);
- put_files_struct(files);
-@@ -911,11 +950,12 @@ int flush_old_exec(struct linux_binprm *
- flush_thread();
-
- if (bprm->e_uid != current->euid || bprm->e_gid != current->egid ||
-- permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL) ||
-+ permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL, NULL) ||
- (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
- suid_keys(current);
- current->mm->dumpable = suid_dumpable;
- }
-+ current->mm->vps_dumpable = 1;
-
- /* An exec changes our domain. We are no longer part of the thread
- group */
-@@ -946,13 +986,6 @@ int prepare_binprm(struct linux_binprm *
- struct inode * inode = bprm->file->f_dentry->d_inode;
- int retval;
-
-- mode = inode->i_mode;
-- /*
-- * Check execute perms again - if the caller has CAP_DAC_OVERRIDE,
-- * vfs_permission lets a non-executable through
-- */
-- if (!(mode & 0111)) /* with at least _one_ execute bit set */
-- return -EACCES;
- if (bprm->file->f_op == NULL)
- return -EACCES;
-
-@@ -960,10 +993,24 @@ int prepare_binprm(struct linux_binprm *
- bprm->e_gid = current->egid;
-
- if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) {
-+ if (!bprm->perm.set) {
-+ /*
-+ * This piece of code creates a time window between
-+ * MAY_EXEC permission check and setuid/setgid
-+ * operations and may be considered as a security hole.
-+ * This code is here for compatibility reasons,
-+ * if the filesystem is unable to return info now.
-+ */
-+ bprm->perm.mode = inode->i_mode;
-+ bprm->perm.uid = inode->i_uid;
-+ bprm->perm.gid = inode->i_gid;
-+ }
-+ mode = bprm->perm.mode;
-+
- /* Set-uid? */
- if (mode & S_ISUID) {
- current->personality &= ~PER_CLEAR_ON_SETID;
-- bprm->e_uid = inode->i_uid;
-+ bprm->e_uid = bprm->perm.uid;
- }
-
- /* Set-gid? */
-@@ -974,7 +1021,7 @@ int prepare_binprm(struct linux_binprm *
- */
- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
- current->personality &= ~PER_CLEAR_ON_SETID;
-- bprm->e_gid = inode->i_gid;
-+ bprm->e_gid = bprm->perm.gid;
- }
- }
-
-@@ -1072,7 +1119,7 @@ int search_binary_handler(struct linux_b
-
- loader = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-
-- file = open_exec("/sbin/loader");
-+ file = open_exec("/sbin/loader", bprm);
- retval = PTR_ERR(file);
- if (IS_ERR(file))
- return retval;
-@@ -1164,20 +1211,24 @@ int do_execve(char * filename,
- int retval;
- int i;
-
-- file = open_exec(filename);
--
-- retval = PTR_ERR(file);
-- if (IS_ERR(file))
-+ retval = virtinfo_gencall(VIRTINFO_DOEXECVE, NULL);
-+ if (retval)
- return retval;
-
-- sched_exec();
--
- retval = -ENOMEM;
- bprm = kmalloc(sizeof(*bprm), GFP_KERNEL);
- if (!bprm)
- goto out_ret;
- memset(bprm, 0, sizeof(*bprm));
-
-+ file = open_exec(filename, bprm);
-+
-+ retval = PTR_ERR(file);
-+ if (IS_ERR(file))
-+ goto out_open;
-+
-+ sched_exec();
-+
- bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-
- bprm->file = file;
-@@ -1250,6 +1301,7 @@ out_file:
- allow_write_access(bprm->file);
- fput(bprm->file);
- }
-+out_open:
- kfree(bprm);
-
- out_ret:
-@@ -1307,7 +1359,7 @@ static void format_corename(char *corena
- case 'p':
- pid_in_pattern = 1;
- rc = snprintf(out_ptr, out_end - out_ptr,
-- "%d", current->tgid);
-+ "%d", virt_tgid(current));
- if (rc > out_end - out_ptr)
- goto out;
- out_ptr += rc;
-@@ -1351,7 +1403,7 @@ static void format_corename(char *corena
- case 'h':
- down_read(&uts_sem);
- rc = snprintf(out_ptr, out_end - out_ptr,
-- "%s", system_utsname.nodename);
-+ "%s", ve_utsname.nodename);
- up_read(&uts_sem);
- if (rc > out_end - out_ptr)
- goto out;
-@@ -1379,7 +1431,7 @@ static void format_corename(char *corena
- if (!pid_in_pattern
- && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) {
- rc = snprintf(out_ptr, out_end - out_ptr,
-- ".%d", current->tgid);
-+ ".%d", virt_tgid(current));
- if (rc > out_end - out_ptr)
- goto out;
- out_ptr += rc;
-@@ -1405,7 +1457,7 @@ static void zap_threads (struct mm_struc
- }
-
- read_lock(&tasklist_lock);
-- do_each_thread(g,p)
-+ do_each_thread_ve(g,p)
- if (mm == p->mm && p != tsk) {
- force_sig_specific(SIGKILL, p);
- mm->core_waiters++;
-@@ -1413,7 +1465,7 @@ static void zap_threads (struct mm_struc
- unlikely(p->parent->mm == mm))
- traced = 1;
- }
-- while_each_thread(g,p);
-+ while_each_thread_ve(g,p);
-
- read_unlock(&tasklist_lock);
-
-@@ -1425,12 +1477,12 @@ static void zap_threads (struct mm_struc
- * coredump to finish. Detach them so they can both die.
- */
- write_lock_irq(&tasklist_lock);
-- do_each_thread(g,p) {
-+ do_each_thread_ve(g,p) {
- if (mm == p->mm && p != tsk &&
- p->ptrace && p->parent->mm == mm) {
-- __ptrace_unlink(p);
-+ __ptrace_detach(p, 0);
- }
-- } while_each_thread(g,p);
-+ } while_each_thread_ve(g,p);
- write_unlock_irq(&tasklist_lock);
- }
- }
-@@ -1471,7 +1523,7 @@ int do_coredump(long signr, int exit_cod
- if (current->tux_exit)
- current->tux_exit();
- down_write(&mm->mmap_sem);
-- if (!mm->dumpable) {
-+ if (!mm->dumpable || mm->vps_dumpable != 1) {
- up_write(&mm->mmap_sem);
- goto fail;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext2/acl.c linux-2.6.9-ve023stab030/fs/ext2/acl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext2/acl.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext2/acl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -286,7 +286,7 @@ ext2_set_acl(struct inode *inode, int ty
- * inode->i_sem: don't care
- */
- int
--ext2_permission(struct inode *inode, int mask, struct nameidata *nd)
-+__ext2_permission(struct inode *inode, int mask)
- {
- int mode = inode->i_mode;
-
-@@ -336,6 +336,29 @@ check_capabilities:
- return -EACCES;
- }
-
-+int
-+ext2_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
-+{
-+ int ret;
-+
-+ if (exec_perm != NULL)
-+ down(&inode->i_sem);
-+
-+ ret = __ext2_permission(inode, mask);
-+
-+ if (exec_perm != NULL) {
-+ if (!ret) {
-+ exec_perm->set = 1;
-+ exec_perm->mode = inode->i_mode;
-+ exec_perm->uid = inode->i_uid;
-+ exec_perm->gid = inode->i_gid;
-+ }
-+ up(&inode->i_sem);
-+ }
-+ return ret;
-+}
-+
- /*
- * Initialize the ACLs of a new inode. Called from ext2_new_inode.
- *
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext2/acl.h linux-2.6.9-ve023stab030/fs/ext2/acl.h
---- linux-2.6.9-42.0.3.EL.orig/fs/ext2/acl.h 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext2/acl.h 2006-10-11 19:07:55.000000000 +0400
-@@ -59,7 +59,8 @@ static inline int ext2_acl_count(size_t
- #define EXT2_ACL_NOT_CACHED ((void *)-1)
-
- /* acl.c */
--extern int ext2_permission (struct inode *, int, struct nameidata *);
-+extern int ext2_permission (struct inode *, int, struct nameidata *,
-+ struct exec_perm *);
- extern int ext2_acl_chmod (struct inode *);
- extern int ext2_init_acl (struct inode *, struct inode *);
-
-@@ -77,7 +78,6 @@ ext2_acl_chmod (struct inode *inode)
-
- static inline int ext2_init_acl (struct inode *inode, struct inode *dir)
- {
-- inode->i_mode &= ~current->fs->umask;
- return 0;
- }
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext2/namei.c linux-2.6.9-ve023stab030/fs/ext2/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext2/namei.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext2/namei.c 2006-10-11 19:07:58.000000000 +0400
-@@ -30,6 +30,7 @@
- */
-
- #include <linux/pagemap.h>
-+#include <linux/quotaops.h>
- #include "ext2.h"
- #include "xattr.h"
- #include "acl.h"
-@@ -181,7 +182,7 @@ static int ext2_symlink (struct inode *
- inode->i_mapping->a_ops = &ext2_nobh_aops;
- else
- inode->i_mapping->a_ops = &ext2_aops;
-- err = page_symlink(inode, symname, l);
-+ err = page_symlink(inode, symname, l, GFP_KERNEL);
- if (err)
- goto out_fail;
- } else {
-@@ -269,6 +270,8 @@ static int ext2_unlink(struct inode * di
- struct page * page;
- int err = -ENOENT;
-
-+ DQUOT_INIT(inode);
-+
- de = ext2_find_entry (dir, dentry, &page);
- if (!de)
- goto out;
-@@ -311,6 +314,9 @@ static int ext2_rename (struct inode * o
- struct ext2_dir_entry_2 * old_de;
- int err = -ENOENT;
-
-+ if (new_inode)
-+ DQUOT_INIT(new_inode);
-+
- old_de = ext2_find_entry (old_dir, old_dentry, &old_page);
- if (!old_de)
- goto out;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext2/super.c linux-2.6.9-ve023stab030/fs/ext2/super.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext2/super.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext2/super.c 2006-10-11 19:07:57.000000000 +0400
-@@ -334,7 +334,6 @@ static int parse_options (char * options
- {
- char * p;
- substring_t args[MAX_OPT_ARGS];
-- unsigned long kind = EXT2_MOUNT_ERRORS_CONT;
- int option;
-
- if (!options)
-@@ -374,13 +373,19 @@ static int parse_options (char * options
- /* *sb_block = match_int(&args[0]); */
- break;
- case Opt_err_panic:
-- kind = EXT2_MOUNT_ERRORS_PANIC;
-+ clear_opt (sbi->s_mount_opt, ERRORS_CONT);
-+ clear_opt (sbi->s_mount_opt, ERRORS_RO);
-+ set_opt (sbi->s_mount_opt, ERRORS_PANIC);
- break;
- case Opt_err_ro:
-- kind = EXT2_MOUNT_ERRORS_RO;
-+ clear_opt (sbi->s_mount_opt, ERRORS_CONT);
-+ clear_opt (sbi->s_mount_opt, ERRORS_PANIC);
-+ set_opt (sbi->s_mount_opt, ERRORS_RO);
- break;
- case Opt_err_cont:
-- kind = EXT2_MOUNT_ERRORS_CONT;
-+ clear_opt (sbi->s_mount_opt, ERRORS_RO);
-+ clear_opt (sbi->s_mount_opt, ERRORS_PANIC);
-+ set_opt (sbi->s_mount_opt, ERRORS_CONT);
- break;
- case Opt_nouid32:
- set_opt (sbi->s_mount_opt, NO_UID32);
-@@ -439,7 +444,6 @@ static int parse_options (char * options
- return 0;
- }
- }
-- sbi->s_mount_opt |= kind;
- return 1;
- }
-
-@@ -669,6 +673,8 @@ static int ext2_fill_super(struct super_
- set_opt(sbi->s_mount_opt, ERRORS_PANIC);
- else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_RO)
- set_opt(sbi->s_mount_opt, ERRORS_RO);
-+ else
-+ set_opt(sbi->s_mount_opt, ERRORS_CONT);
-
- sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
- sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
-@@ -1050,7 +1056,7 @@ static struct file_system_type ext2_fs_t
- .name = "ext2",
- .get_sb = ext2_get_sb,
- .kill_sb = kill_block_super,
-- .fs_flags = FS_REQUIRES_DEV,
-+ .fs_flags = FS_REQUIRES_DEV | FS_VIRTUALIZED,
- };
-
- static int __init init_ext2_fs(void)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext2/xattr_user.c linux-2.6.9-ve023stab030/fs/ext2/xattr_user.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext2/xattr_user.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext2/xattr_user.c 2006-10-11 19:07:55.000000000 +0400
-@@ -41,7 +41,7 @@ ext2_xattr_user_get(struct inode *inode,
- return -EINVAL;
- if (!test_opt(inode->i_sb, XATTR_USER))
- return -EOPNOTSUPP;
-- error = permission(inode, MAY_READ, NULL);
-+ error = permission(inode, MAY_READ, NULL, NULL);
- if (error)
- return error;
-
-@@ -61,7 +61,7 @@ ext2_xattr_user_set(struct inode *inode,
- if ( !S_ISREG(inode->i_mode) &&
- (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
- return -EPERM;
-- error = permission(inode, MAY_WRITE, NULL);
-+ error = permission(inode, MAY_WRITE, NULL, NULL);
- if (error)
- return error;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/acl.c linux-2.6.9-ve023stab030/fs/ext3/acl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/acl.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/acl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -289,7 +289,7 @@ ext3_set_acl(handle_t *handle, struct in
- * inode->i_sem: don't care
- */
- int
--ext3_permission(struct inode *inode, int mask, struct nameidata *nd)
-+__ext3_permission(struct inode *inode, int mask)
- {
- int mode = inode->i_mode;
-
-@@ -339,6 +339,29 @@ check_capabilities:
- return -EACCES;
- }
-
-+int
-+ext3_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
-+{
-+ int ret;
-+
-+ if (exec_perm != NULL)
-+ down(&inode->i_sem);
-+
-+ ret = __ext3_permission(inode, mask);
-+
-+ if (exec_perm != NULL) {
-+ if (!ret) {
-+ exec_perm->set = 1;
-+ exec_perm->mode = inode->i_mode;
-+ exec_perm->uid = inode->i_uid;
-+ exec_perm->gid = inode->i_gid;
-+ }
-+ up(&inode->i_sem);
-+ }
-+ return ret;
-+}
-+
- /*
- * Initialize the ACLs of a new inode. Called from ext3_new_inode.
- *
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/acl.h linux-2.6.9-ve023stab030/fs/ext3/acl.h
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/acl.h 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/acl.h 2006-10-11 19:07:55.000000000 +0400
-@@ -58,7 +58,8 @@ static inline int ext3_acl_count(size_t
- #define EXT3_ACL_NOT_CACHED ((void *)-1)
-
- /* acl.c */
--extern int ext3_permission (struct inode *, int, struct nameidata *);
-+extern int ext3_permission (struct inode *, int, struct nameidata *,
-+ struct exec_perm *);
- extern int ext3_acl_chmod (struct inode *);
- extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
-
-@@ -78,7 +79,6 @@ ext3_acl_chmod(struct inode *inode)
- static inline int
- ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
- {
-- inode->i_mode &= ~current->fs->umask;
- return 0;
- }
- #endif /* CONFIG_EXT3_FS_POSIX_ACL */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/inode.c linux-2.6.9-ve023stab030/fs/ext3/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/inode.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/inode.c 2006-10-11 19:08:02.000000000 +0400
-@@ -522,6 +522,7 @@ static int ext3_alloc_branch(handle_t *h
-
- branch[0].key = cpu_to_le32(parent);
- if (parent) {
-+ keys = 1;
- for (n = 1; n < num; n++) {
- struct buffer_head *bh;
- /* Allocate the next block */
-@@ -719,6 +720,7 @@ reread:
- if (!partial) {
- clear_buffer_new(bh_result);
- got_it:
-+ clear_buffer_delay(bh_result);
- map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
- if (boundary)
- set_buffer_boundary(bh_result);
-@@ -970,11 +972,13 @@ static int walk_page_buffers( handle_t *
- * and the commit_write(). So doing the journal_start at the start of
- * prepare_write() is the right place.
- *
-- * Also, this function can nest inside ext3_writepage() ->
-- * block_write_full_page(). In that case, we *know* that ext3_writepage()
-- * has generated enough buffer credits to do the whole page. So we won't
-- * block on the journal in that case, which is good, because the caller may
-- * be PF_MEMALLOC.
-+ * [2004/09/04 SAW] journal_start() in prepare_write() causes different ranking
-+ * violations if copy_from_user() triggers a page fault (mmap_sem, may be page
-+ * lock, plus __GFP_FS allocations).
-+ * Now we read in not up-to-date buffers in prepare_write(), and do the rest
-+ * including hole instantiation and inode extension in commit_write().
-+ *
-+ * Other notes.
- *
- * By accident, ext3 can be reentered when a transaction is open via
- * quota file writes. If we were to commit the transaction while thus
-@@ -989,6 +993,27 @@ static int walk_page_buffers( handle_t *
- * write.
- */
-
-+static int ext3_get_block_delay(struct inode *inode, sector_t iblock,
-+ struct buffer_head *bh, int create)
-+{
-+ int ret;
-+
-+ ret = ext3_get_block_handle(NULL, inode, iblock, bh, 0, 0);
-+ if (ret)
-+ return ret;
-+ if (!buffer_mapped(bh)) {
-+ set_buffer_delay(bh);
-+ set_buffer_new(bh);
-+ }
-+ return ret;
-+}
-+
-+static int ext3_prepare_write(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
-+{
-+ return block_prepare_write(page, from, to, ext3_get_block_delay);
-+}
-+
- static int do_journal_get_write_access(handle_t *handle,
- struct buffer_head *bh)
- {
-@@ -997,8 +1022,52 @@ static int do_journal_get_write_access(h
- return ext3_journal_get_write_access(handle, bh);
- }
-
--static int ext3_prepare_write(struct file *file, struct page *page,
-- unsigned from, unsigned to)
-+/*
-+ * This function zeroes buffers not mapped to disk.
-+ * We do it similarly to the error path in __block_prepare_write() to avoid
-+ * keeping garbage in the page cache.
-+ * Here we check BH_delay state. We know that if the buffer appears
-+ * !buffer_mapped then
-+ * - it was !buffer_mapped at the moment of ext3_prepare_write, and
-+ * - ext3_get_block failed to map this buffer (e.g., ENOSPC).
-+ * If this !mapped buffer is not up to date (it can be up to date if
-+ * PageUptodate), then we zero its content.
-+ */
-+static void ext3_clear_delayed_buffers(struct page *page,
-+ unsigned from, unsigned to)
-+{
-+ struct buffer_head *bh, *head, *next;
-+ unsigned block_start, block_end;
-+ unsigned blocksize;
-+ void *kaddr;
-+
-+ head = page_buffers(page);
-+ blocksize = head->b_size;
-+ for ( bh = head, block_start = 0;
-+ bh != head || !block_start;
-+ block_start = block_end, bh = next)
-+ {
-+ next = bh->b_this_page;
-+ block_end = block_start + blocksize;
-+ if (block_end <= from || block_start >= to)
-+ continue;
-+ if (!buffer_delay(bh))
-+ continue;
-+ J_ASSERT_BH(bh, !buffer_mapped(bh));
-+ clear_buffer_new(bh);
-+ clear_buffer_delay(bh);
-+ if (!buffer_uptodate(bh)) {
-+ kaddr = kmap_atomic(page, KM_USER0);
-+ memset(kaddr + block_start, 0, bh->b_size);
-+ kunmap_atomic(kaddr, KM_USER0);
-+ set_buffer_uptodate(bh);
-+ mark_buffer_dirty(bh);
-+ }
-+ }
-+}
-+
-+static int ext3_map_write(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
- {
- struct inode *inode = page->mapping->host;
- int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
-@@ -1011,19 +1080,19 @@ retry:
- ret = PTR_ERR(handle);
- goto out;
- }
-- ret = block_prepare_write(page, from, to, ext3_get_block);
-- if (ret)
-- goto prepare_write_failed;
-
-- if (ext3_should_journal_data(inode)) {
-+ ret = block_prepare_write(page, from, to, ext3_get_block);
-+ if (!ret && ext3_should_journal_data(inode)) {
- ret = walk_page_buffers(handle, page_buffers(page),
- from, to, NULL, do_journal_get_write_access);
- }
--prepare_write_failed:
-- if (ret)
-- ext3_journal_stop(handle);
-+ if (!ret)
-+ goto out;
-+
-+ ext3_journal_stop(handle);
- if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
- goto retry;
-+ ext3_clear_delayed_buffers(page, from, to);
- out:
- return ret;
- }
-@@ -1058,10 +1127,15 @@ static int commit_write_fn(handle_t *han
- static int ext3_ordered_commit_write(struct file *file, struct page *page,
- unsigned from, unsigned to)
- {
-- handle_t *handle = ext3_journal_current_handle();
-+ handle_t *handle;
- struct inode *inode = page->mapping->host;
- int ret = 0, ret2;
-
-+ ret = ext3_map_write(file, page, from, to);
-+ if (ret)
-+ return ret;
-+ handle = ext3_journal_current_handle();
-+
- ret = walk_page_buffers(handle, page_buffers(page),
- from, to, NULL, ext3_journal_dirty_data);
-
-@@ -1087,11 +1161,15 @@ static int ext3_ordered_commit_write(str
- static int ext3_writeback_commit_write(struct file *file, struct page *page,
- unsigned from, unsigned to)
- {
-- handle_t *handle = ext3_journal_current_handle();
-+ handle_t *handle;
- struct inode *inode = page->mapping->host;
- int ret = 0, ret2;
- loff_t new_i_size;
-
-+ ret = ext3_map_write(file, page, from, to);
-+ if (ret)
-+ return ret;
-+ handle = ext3_journal_current_handle();
- new_i_size = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
- if (new_i_size > EXT3_I(inode)->i_disksize)
- EXT3_I(inode)->i_disksize = new_i_size;
-@@ -1105,12 +1183,17 @@ static int ext3_writeback_commit_write(s
- static int ext3_journalled_commit_write(struct file *file,
- struct page *page, unsigned from, unsigned to)
- {
-- handle_t *handle = ext3_journal_current_handle();
-+ handle_t *handle;
- struct inode *inode = page->mapping->host;
- int ret = 0, ret2;
- int partial = 0;
- loff_t pos;
-
-+ ret = ext3_map_write(file, page, from, to);
-+ if (ret)
-+ return ret;
-+ handle = ext3_journal_current_handle();
-+
- /*
- * Here we duplicate the generic_commit_write() functionality
- */
-@@ -1378,8 +1461,11 @@ static int ext3_journalled_writepage(str
- ClearPageChecked(page);
- ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
- ext3_get_block);
-- if (ret != 0)
-- goto out_unlock;
-+ if (ret != 0) {
-+ ext3_journal_stop(handle);
-+ unlock_page(page);
-+ return ret;
-+ }
- ret = walk_page_buffers(handle, page_buffers(page), 0,
- PAGE_CACHE_SIZE, NULL, do_journal_get_write_access);
-
-@@ -1405,7 +1491,6 @@ out:
-
- no_write:
- redirty_page_for_writepage(wbc, page);
--out_unlock:
- unlock_page(page);
- goto out;
- }
-@@ -2665,7 +2750,7 @@ out_brelse:
- */
- int ext3_write_inode(struct inode *inode, int wait)
- {
-- if (current->flags & PF_MEMALLOC)
-+ if ((current->flags & PF_MEMALLOC) || test_thread_flag(TIF_MEMDIE))
- return 0;
-
- if (ext3_journal_current_handle()) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/ioctl.c linux-2.6.9-ve023stab030/fs/ext3/ioctl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/ioctl.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/ioctl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -68,7 +68,7 @@ int ext3_ioctl (struct inode * inode, st
- * the relevant capability.
- */
- if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) {
-- if (!capable(CAP_SYS_RESOURCE))
-+ if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/namei.c linux-2.6.9-ve023stab030/fs/ext3/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/namei.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2137,7 +2137,7 @@ retry:
- * We have a transaction open. All is sweetness. It also sets
- * i_size in generic_commit_write().
- */
-- err = page_symlink(inode, symname, l);
-+ err = page_symlink(inode, symname, l, GFP_NOFS);
- if (err) {
- ext3_dec_count(handle, inode);
- ext3_mark_inode_dirty(handle, inode);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/super.c linux-2.6.9-ve023stab030/fs/ext3/super.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/super.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/super.c 2006-10-11 19:07:57.000000000 +0400
-@@ -148,20 +148,21 @@ static void ext3_handle_error(struct sup
- if (sb->s_flags & MS_RDONLY)
- return;
-
-- if (test_opt (sb, ERRORS_PANIC))
-- panic ("EXT3-fs (device %s): panic forced after error\n",
-- sb->s_id);
-- if (test_opt (sb, ERRORS_RO)) {
-- printk (KERN_CRIT "Remounting filesystem read-only\n");
-- sb->s_flags |= MS_RDONLY;
-- } else {
-+ if (!test_opt (sb, ERRORS_CONT)) {
- journal_t *journal = EXT3_SB(sb)->s_journal;
-
- EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
- if (journal)
- journal_abort(journal, -EIO);
- }
-+ if (test_opt (sb, ERRORS_RO)) {
-+ printk (KERN_CRIT "Remounting filesystem read-only\n");
-+ sb->s_flags |= MS_RDONLY;
-+ }
- ext3_commit_super(sb, es, 1);
-+ if (test_opt (sb, ERRORS_PANIC))
-+ panic ("EXT3-fs (device %s): panic forced after error\n",
-+ sb->s_id);
- }
-
- void ext3_error (struct super_block * sb, const char * function,
-@@ -1362,6 +1363,8 @@ static int ext3_fill_super (struct super
- set_opt(sbi->s_mount_opt, ERRORS_PANIC);
- else if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_RO)
- set_opt(sbi->s_mount_opt, ERRORS_RO);
-+ else
-+ set_opt(sbi->s_mount_opt, ERRORS_CONT);
-
- sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
- sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
-@@ -2432,7 +2435,7 @@ static struct file_system_type ext3_fs_t
- .name = "ext3",
- .get_sb = ext3_get_sb,
- .kill_sb = kill_block_super,
-- .fs_flags = FS_REQUIRES_DEV,
-+ .fs_flags = FS_REQUIRES_DEV | FS_VIRTUALIZED,
- };
-
- static int __init init_ext3_fs(void)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ext3/xattr_user.c linux-2.6.9-ve023stab030/fs/ext3/xattr_user.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ext3/xattr_user.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ext3/xattr_user.c 2006-10-11 19:07:55.000000000 +0400
-@@ -43,7 +43,7 @@ ext3_xattr_user_get(struct inode *inode,
- return -EINVAL;
- if (!test_opt(inode->i_sb, XATTR_USER))
- return -EOPNOTSUPP;
-- error = permission(inode, MAY_READ, NULL);
-+ error = permission(inode, MAY_READ, NULL, NULL);
- if (error)
- return error;
-
-@@ -63,7 +63,7 @@ ext3_xattr_user_set(struct inode *inode,
- if ( !S_ISREG(inode->i_mode) &&
- (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
- return -EPERM;
-- error = permission(inode, MAY_WRITE, NULL);
-+ error = permission(inode, MAY_WRITE, NULL, NULL);
- if (error)
- return error;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/fcntl.c linux-2.6.9-ve023stab030/fs/fcntl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/fcntl.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/fcntl.c 2006-10-11 19:07:59.000000000 +0400
-@@ -14,6 +14,7 @@
- #include <linux/module.h>
- #include <linux/security.h>
- #include <linux/ptrace.h>
-+#include <linux/ve_owner.h>
-
- #include <asm/poll.h>
- #include <asm/siginfo.h>
-@@ -203,6 +204,7 @@ out_fput:
- fput(file);
- goto out;
- }
-+EXPORT_SYMBOL(sys_dup2);
-
- asmlinkage long sys_dup(unsigned int fildes)
- {
-@@ -221,6 +223,9 @@ static int setfl(int fd, struct file * f
- struct inode * inode = filp->f_dentry->d_inode;
- int error = 0;
-
-+ if (!capable(CAP_SYS_RAWIO))
-+ arg &= ~O_DIRECT;
-+
- /* O_APPEND cannot be cleared if the file is marked as append-only */
- if (!(arg & O_APPEND) && IS_APPEND(inode))
- return -EPERM;
-@@ -264,6 +269,7 @@ static int setfl(int fd, struct file * f
- static void f_modown(struct file *filp, unsigned long pid,
- uid_t uid, uid_t euid, int force)
- {
-+ pid = comb_vpid_to_pid(pid);
- write_lock_irq(&filp->f_owner.lock);
- if (force || !filp->f_owner.pid) {
- filp->f_owner.pid = pid;
-@@ -330,7 +336,7 @@ static long do_fcntl(int fd, unsigned in
- * current syscall conventions, the only way
- * to fix this will be in libc.
- */
-- err = filp->f_owner.pid;
-+ err = comb_pid_to_vpid(filp->f_owner.pid);
- force_successful_syscall_return();
- break;
- case F_SETOWN:
-@@ -481,6 +487,8 @@ static void send_sigio_to_task(struct ta
-
- void send_sigio(struct fown_struct *fown, int fd, int band)
- {
-+ struct file *f;
-+ struct ve_struct *env;
- struct task_struct *p;
- int pid;
-
-@@ -488,17 +496,21 @@ void send_sigio(struct fown_struct *fown
- pid = fown->pid;
- if (!pid)
- goto out_unlock_fown;
--
-+
-+ /* hack: fown's are always embedded in struct file */
-+ f = container_of(fown, struct file, f_owner);
-+ env = VE_OWNER_FILP(f);
-+
- read_lock(&tasklist_lock);
- if (pid > 0) {
-- p = find_task_by_pid(pid);
-- if (p) {
-+ p = find_task_by_pid_all(pid);
-+ if (p && ve_accessible(VE_TASK_INFO(p)->owner_env, env)) {
- send_sigio_to_task(p, fown, fd, band);
- }
- } else {
-- do_each_task_pid(-pid, PIDTYPE_PGID, p) {
-+ __do_each_task_pid_ve(-pid, PIDTYPE_PGID, p, env) {
- send_sigio_to_task(p, fown, fd, band);
-- } while_each_task_pid(-pid, PIDTYPE_PGID, p);
-+ } __while_each_task_pid_ve(-pid, PIDTYPE_PGID, p, env);
- }
- read_unlock(&tasklist_lock);
- out_unlock_fown:
-@@ -514,6 +526,8 @@ static void send_sigurg_to_task(struct t
-
- int send_sigurg(struct fown_struct *fown)
- {
-+ struct file *f;
-+ struct ve_struct *env;
- struct task_struct *p;
- int pid, ret = 0;
-
-@@ -524,16 +538,20 @@ int send_sigurg(struct fown_struct *fown
-
- ret = 1;
-
-+ /* hack: fown's are always embedded in struct file */
-+ f = container_of(fown, struct file, f_owner);
-+ env = VE_OWNER_FILP(f);
-+
- read_lock(&tasklist_lock);
- if (pid > 0) {
-- p = find_task_by_pid(pid);
-- if (p) {
-+ p = find_task_by_pid_all(pid);
-+ if (p && ve_accessible(VE_TASK_INFO(p)->owner_env, env)) {
- send_sigurg_to_task(p, fown);
- }
- } else {
-- do_each_task_pid(-pid, PIDTYPE_PGID, p) {
-+ __do_each_task_pid_ve(-pid, PIDTYPE_PGID, p, env) {
- send_sigurg_to_task(p, fown);
-- } while_each_task_pid(-pid, PIDTYPE_PGID, p);
-+ } __while_each_task_pid_ve(-pid, PIDTYPE_PGID, p, env);
- }
- read_unlock(&tasklist_lock);
- out_unlock_fown:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/file.c linux-2.6.9-ve023stab030/fs/file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/file.c 2004-10-19 01:53:13.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/file.c 2006-10-11 19:07:59.000000000 +0400
-@@ -12,9 +12,11 @@
- #include <linux/slab.h>
- #include <linux/vmalloc.h>
- #include <linux/file.h>
-+#include <linux/module.h>
-
- #include <asm/bitops.h>
-
-+#include <ub/ub_mem.h>
-
- /*
- * Allocate an fd array, using kmalloc or vmalloc.
-@@ -26,9 +28,9 @@ struct file ** alloc_fd_array(int num)
- int size = num * sizeof(struct file *);
-
- if (size <= PAGE_SIZE)
-- new_fds = (struct file **) kmalloc(size, GFP_KERNEL);
-+ new_fds = (struct file **) ub_kmalloc(size, GFP_KERNEL);
- else
-- new_fds = (struct file **) vmalloc(size);
-+ new_fds = (struct file **) ub_vmalloc(size);
- return new_fds;
- }
-
-@@ -124,6 +126,7 @@ int expand_fd_array(struct files_struct
- out:
- return error;
- }
-+EXPORT_SYMBOL(expand_fd_array);
-
- /*
- * Allocate an fdset array, using kmalloc or vmalloc.
-@@ -135,9 +138,9 @@ fd_set * alloc_fdset(int num)
- int size = num / 8;
-
- if (size <= PAGE_SIZE)
-- new_fdset = (fd_set *) kmalloc(size, GFP_KERNEL);
-+ new_fdset = (fd_set *) ub_kmalloc(size, GFP_KERNEL);
- else
-- new_fdset = (fd_set *) vmalloc(size);
-+ new_fdset = (fd_set *) ub_vmalloc(size);
- return new_fdset;
- }
-
-@@ -225,4 +228,4 @@ out:
- spin_lock(&files->file_lock);
- return error;
- }
--
-+EXPORT_SYMBOL(expand_fdset);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/file_table.c linux-2.6.9-ve023stab030/fs/file_table.c
---- linux-2.6.9-42.0.3.EL.orig/fs/file_table.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/file_table.c 2006-10-11 19:07:57.000000000 +0400
-@@ -8,6 +8,7 @@
- #include <linux/string.h>
- #include <linux/slab.h>
- #include <linux/file.h>
-+#include <linux/ve_owner.h>
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/smp_lock.h>
-@@ -17,6 +18,8 @@
- #include <linux/mount.h>
- #include <linux/cdev.h>
-
-+#include <ub/ub_misc.h>
-+
- /* sysctl tunables... */
- struct files_stat_struct files_stat = {
- .max_files = NR_FILE
-@@ -54,6 +57,8 @@ void filp_dtor(void * objp, struct kmem_
-
- static inline void file_free(struct file *f)
- {
-+ ub_file_uncharge(f);
-+ put_ve(VE_OWNER_FILP(f));
- kmem_cache_free(filp_cachep, f);
- }
-
-@@ -63,41 +68,56 @@ static inline void file_free(struct file
- */
- struct file *get_empty_filp(void)
- {
--static int old_max;
-+ static int old_max;
- struct file * f;
-
-+#if 0
-+ /*
-+ * nr_files limit is broken until some recent mainstream kernels.
-+ * someone very clever decided to do inc/dec from slab
-+ * constructor and destructor.
-+ * just remove this check at all, as we have UBC numfile limit.
-+ */
- /*
- * Privileged users can go above max_files
- */
-- if (files_stat.nr_files < files_stat.max_files ||
-- capable(CAP_SYS_ADMIN)) {
-- f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
-- if (f) {
-- memset(f, 0, sizeof(*f));
-- if (security_file_alloc(f)) {
-- file_free(f);
-- goto fail;
-- }
-- eventpoll_init_file(f);
-- atomic_set(&f->f_count, 1);
-- f->f_uid = current->fsuid;
-- f->f_gid = current->fsgid;
-- f->f_owner.lock = RW_LOCK_UNLOCKED;
-- /* f->f_version: 0 */
-- INIT_LIST_HEAD(&f->f_list);
-- return f;
-- }
-+ if (files_stat.nr_files >= files_stat.max_files &&
-+ !capable(CAP_SYS_ADMIN))
-+ goto over;
-+#endif
-+ f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
-+ if (f == NULL)
-+ goto fail;
-+
-+ memset(f, 0, sizeof(*f));
-+ if (ub_file_charge(f)) {
-+ kmem_cache_free(filp_cachep, f);
-+ goto fail;
- }
-
-+ SET_VE_OWNER_FILP(f, get_ve(get_exec_env()));
-+ if (security_file_alloc(f)) {
-+ file_free(f);
-+ goto fail;
-+ }
-+ eventpoll_init_file(f);
-+ atomic_set(&f->f_count, 1);
-+ f->f_uid = current->fsuid;
-+ f->f_gid = current->fsgid;
-+ f->f_owner.lock = RW_LOCK_UNLOCKED;
-+ /* f->f_version: 0 */
-+ INIT_LIST_HEAD(&f->f_list);
-+ return f;
-+
-+#if 0
-+over:
- /* Ran out of filps - report that */
-- if (files_stat.max_files >= old_max) {
-+ if (files_stat.nr_files > old_max) {
- printk(KERN_INFO "VFS: file-max limit %d reached\n",
-- files_stat.max_files);
-- old_max = files_stat.max_files;
-- } else {
-- /* Big problems... */
-- printk(KERN_WARNING "VFS: filp allocation failed\n");
-+ files_stat.max_files);
-+ old_max = files_stat.nr_files;
- }
-+#endif
- fail:
- return NULL;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/filesystems.c linux-2.6.9-ve023stab030/fs/filesystems.c
---- linux-2.6.9-42.0.3.EL.orig/fs/filesystems.c 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/filesystems.c 2006-10-11 19:07:57.000000000 +0400
-@@ -11,6 +11,7 @@
- #include <linux/kmod.h>
- #include <linux/init.h>
- #include <linux/module.h>
-+#include <linux/ve_owner.h>
- #include <asm/uaccess.h>
-
- /*
-@@ -20,8 +21,8 @@
- * During the unload module must call unregister_filesystem().
- * We can access the fields of list element if:
- * 1) spinlock is held or
-- * 2) we hold the reference to the module.
-- * The latter can be guaranteed by call of try_module_get(); if it
-+ * 2) we hold the reference to the element.
-+ * The latter can be guaranteed by call of try_filesystem(); if it
- * returned 0 we must skip the element, otherwise we got the reference.
- * Once the reference is obtained we can drop the spinlock.
- */
-@@ -29,23 +30,51 @@
- static struct file_system_type *file_systems;
- static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
-
-+int try_get_filesystem(struct file_system_type *fs)
-+{
-+ if (try_module_get(fs->owner)) {
-+#ifdef CONFIG_VE
-+ get_ve(VE_OWNER_FSTYPE(fs));
-+#endif
-+ return 1;
-+ }
-+ return 0;
-+}
-+
- /* WARNING: This can be used only if we _already_ own a reference */
- void get_filesystem(struct file_system_type *fs)
- {
-+#ifdef CONFIG_VE
-+ get_ve(VE_OWNER_FSTYPE(fs));
-+#endif
- __module_get(fs->owner);
- }
-
- void put_filesystem(struct file_system_type *fs)
- {
- module_put(fs->owner);
-+#ifdef CONFIG_VE
-+ put_ve(VE_OWNER_FSTYPE(fs));
-+#endif
-+}
-+
-+static inline int check_ve_fstype(struct file_system_type *p,
-+ struct ve_struct *env)
-+{
-+ return ((p->fs_flags & FS_VIRTUALIZED) ||
-+ ve_accessible_strict(VE_OWNER_FSTYPE(p), env));
- }
-
--static struct file_system_type **find_filesystem(const char *name)
-+static struct file_system_type **find_filesystem(const char *name,
-+ struct ve_struct *env)
- {
- struct file_system_type **p;
-- for (p=&file_systems; *p; p=&(*p)->next)
-+ for (p=&file_systems; *p; p=&(*p)->next) {
-+ if (!check_ve_fstype(*p, env))
-+ continue;
- if (strcmp((*p)->name,name) == 0)
- break;
-+ }
- return p;
- }
-
-@@ -72,8 +101,10 @@ int register_filesystem(struct file_syst
- if (fs->next)
- return -EBUSY;
- INIT_LIST_HEAD(&fs->fs_supers);
-+ if (VE_OWNER_FSTYPE(fs) == NULL)
-+ SET_VE_OWNER_FSTYPE(fs, get_ve0());
- write_lock(&file_systems_lock);
-- p = find_filesystem(fs->name);
-+ p = find_filesystem(fs->name, VE_OWNER_FSTYPE(fs));
- if (*p)
- res = -EBUSY;
- else
-@@ -130,11 +161,14 @@ static int fs_index(const char __user *
-
- err = -EINVAL;
- read_lock(&file_systems_lock);
-- for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
-+ for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next) {
-+ if (!check_ve_fstype(tmp, get_exec_env()))
-+ continue;
- if (strcmp(tmp->name,name) == 0) {
- err = index;
- break;
- }
-+ index++;
- }
- read_unlock(&file_systems_lock);
- putname(name);
-@@ -147,9 +181,15 @@ static int fs_name(unsigned int index, c
- int len, res;
-
- read_lock(&file_systems_lock);
-- for (tmp = file_systems; tmp; tmp = tmp->next, index--)
-- if (index <= 0 && try_module_get(tmp->owner))
-- break;
-+ for (tmp = file_systems; tmp; tmp = tmp->next) {
-+ if (!check_ve_fstype(tmp, get_exec_env()))
-+ continue;
-+ if (!index) {
-+ if (try_get_filesystem(tmp))
-+ break;
-+ } else
-+ index--;
-+ }
- read_unlock(&file_systems_lock);
- if (!tmp)
- return -EINVAL;
-@@ -167,8 +207,9 @@ static int fs_maxindex(void)
- int index;
-
- read_lock(&file_systems_lock);
-- for (tmp = file_systems, index = 0 ; tmp ; tmp = tmp->next, index++)
-- ;
-+ for (tmp = file_systems, index = 0 ; tmp ; tmp = tmp->next)
-+ if (check_ve_fstype(tmp, get_exec_env()))
-+ index++;
- read_unlock(&file_systems_lock);
- return index;
- }
-@@ -204,9 +245,10 @@ int get_filesystem_list(char * buf)
- read_lock(&file_systems_lock);
- tmp = file_systems;
- while (tmp && len < PAGE_SIZE - 80) {
-- len += sprintf(buf+len, "%s\t%s\n",
-- (tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
-- tmp->name);
-+ if (check_ve_fstype(tmp, get_exec_env()))
-+ len += sprintf(buf+len, "%s\t%s\n",
-+ (tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
-+ tmp->name);
- tmp = tmp->next;
- }
- read_unlock(&file_systems_lock);
-@@ -218,14 +260,14 @@ struct file_system_type *get_fs_type(con
- struct file_system_type *fs;
-
- read_lock(&file_systems_lock);
-- fs = *(find_filesystem(name));
-- if (fs && !try_module_get(fs->owner))
-+ fs = *(find_filesystem(name, get_exec_env()));
-+ if (fs && !try_get_filesystem(fs))
- fs = NULL;
- read_unlock(&file_systems_lock);
- if (!fs && (request_module("%s", name) == 0)) {
- read_lock(&file_systems_lock);
-- fs = *(find_filesystem(name));
-- if (fs && !try_module_get(fs->owner))
-+ fs = *(find_filesystem(name, get_exec_env()));
-+ if (fs && !try_get_filesystem(fs))
- fs = NULL;
- read_unlock(&file_systems_lock);
- }
-@@ -233,3 +275,5 @@ struct file_system_type *get_fs_type(con
- }
-
- EXPORT_SYMBOL(get_fs_type);
-+EXPORT_SYMBOL(get_filesystem);
-+EXPORT_SYMBOL(put_filesystem);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/fs-writeback.c linux-2.6.9-ve023stab030/fs/fs-writeback.c
---- linux-2.6.9-42.0.3.EL.orig/fs/fs-writeback.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/fs-writeback.c 2006-10-11 19:07:55.000000000 +0400
-@@ -477,32 +477,6 @@ static void set_sb_syncing(int val)
- spin_unlock(&sb_lock);
- }
-
--/*
-- * Find a superblock with inodes that need to be synced
-- */
--static struct super_block *get_super_to_sync(void)
--{
-- struct super_block *sb;
--restart:
-- spin_lock(&sb_lock);
-- sb = sb_entry(super_blocks.prev);
-- for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
-- if (sb->s_syncing)
-- continue;
-- sb->s_syncing = 1;
-- sb->s_count++;
-- spin_unlock(&sb_lock);
-- down_read(&sb->s_umount);
-- if (!sb->s_root) {
-- drop_super(sb);
-- goto restart;
-- }
-- return sb;
-- }
-- spin_unlock(&sb_lock);
-- return NULL;
--}
--
- /**
- * sync_inodes
- *
-@@ -521,23 +495,39 @@ restart:
- * outstanding dirty inodes, the writeback goes block-at-a-time within the
- * filesystem's write_inode(). This is extremely slow.
- */
--void sync_inodes(int wait)
-+static void __sync_inodes(int wait)
- {
- struct super_block *sb;
-
-- set_sb_syncing(0);
-- while ((sb = get_super_to_sync()) != NULL) {
-- sync_inodes_sb(sb, 0);
-- sync_blockdev(sb->s_bdev);
-- drop_super(sb);
-+ spin_lock(&sb_lock);
-+restart:
-+ list_for_each_entry(sb, &super_blocks, s_list) {
-+ if (sb->s_syncing)
-+ continue;
-+ sb->s_syncing = 1;
-+ sb->s_count++;
-+ spin_unlock(&sb_lock);
-+ down_read(&sb->s_umount);
-+ if (sb->s_root) {
-+ sync_inodes_sb(sb, wait);
-+ sync_blockdev(sb->s_bdev);
-+ }
-+ up_read(&sb->s_umount);
-+ spin_lock(&sb_lock);
-+ if (__put_super_and_need_restart(sb))
-+ goto restart;
- }
-+ spin_unlock(&sb_lock);
-+}
-+
-+void sync_inodes(int wait)
-+{
-+ set_sb_syncing(0);
-+ __sync_inodes(0);
-+
- if (wait) {
- set_sb_syncing(0);
-- while ((sb = get_super_to_sync()) != NULL) {
-- sync_inodes_sb(sb, 1);
-- sync_blockdev(sb->s_bdev);
-- drop_super(sb);
-- }
-+ __sync_inodes(1);
- }
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/hfs/inode.c linux-2.6.9-ve023stab030/fs/hfs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/hfs/inode.c 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/hfs/inode.c 2006-10-11 19:07:55.000000000 +0400
-@@ -513,11 +513,11 @@ void hfs_clear_inode(struct inode *inode
- }
-
- static int hfs_permission(struct inode *inode, int mask,
-- struct nameidata *nd)
-+ struct nameidata *nd, struct exec_perm *exec_perm)
- {
- if (S_ISREG(inode->i_mode) && mask & MAY_EXEC)
- return 0;
-- return vfs_permission(inode, mask);
-+ return vfs_permission(inode, mask, NULL);
- }
-
- static int hfs_file_open(struct inode *inode, struct file *file)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/hfsplus/dir.c linux-2.6.9-ve023stab030/fs/hfsplus/dir.c
---- linux-2.6.9-42.0.3.EL.orig/fs/hfsplus/dir.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/hfsplus/dir.c 2006-10-11 19:07:55.000000000 +0400
-@@ -396,7 +396,7 @@ int hfsplus_symlink(struct inode *dir, s
- if (!inode)
- return -ENOSPC;
-
-- res = page_symlink(inode, symname, strlen(symname) + 1);
-+ res = page_symlink(inode, symname, strlen(symname) + 1, GFP_KERNEL);
- if (res) {
- inode->i_nlink = 0;
- hfsplus_delete_inode(inode);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/hfsplus/inode.c linux-2.6.9-ve023stab030/fs/hfsplus/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/hfsplus/inode.c 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/hfsplus/inode.c 2006-10-11 19:07:55.000000000 +0400
-@@ -252,15 +252,19 @@ static void hfsplus_set_perms(struct ino
- perms->dev = cpu_to_be32(HFSPLUS_I(inode).dev);
- }
-
--static int hfsplus_permission(struct inode *inode, int mask, struct nameidata *nd)
-+static int hfsplus_permission(struct inode *inode, int mask,
-+ struct nameidata *nd, struct exec_perm *exec_perm)
- {
- /* MAY_EXEC is also used for lookup, if no x bit is set allow lookup,
- * open_exec has the same test, so it's still not executable, if a x bit
- * is set fall back to standard permission check.
-+ *
-+ * The comment above and the check below don't make much sense
-+ * with S_ISREG condition... --SAW
- */
- if (S_ISREG(inode->i_mode) && mask & MAY_EXEC && !(inode->i_mode & 0111))
- return 0;
-- return vfs_permission(inode, mask);
-+ return vfs_permission(inode, mask, exec_perm);
- }
-
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/hpfs/namei.c linux-2.6.9-ve023stab030/fs/hpfs/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/hpfs/namei.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/hpfs/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -415,7 +415,7 @@ again:
- d_drop(dentry);
- spin_lock(&dentry->d_lock);
- if (atomic_read(&dentry->d_count) > 1 ||
-- permission(inode, MAY_WRITE, NULL) ||
-+ permission(inode, MAY_WRITE, NULL, NULL) ||
- !S_ISREG(inode->i_mode) ||
- get_write_access(inode)) {
- spin_unlock(&dentry->d_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/hugetlbfs/inode.c linux-2.6.9-ve023stab030/fs/hugetlbfs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/hugetlbfs/inode.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/hugetlbfs/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -224,6 +224,7 @@ static void hugetlbfs_delete_inode(struc
- struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(inode->i_sb);
-
- hlist_del_init(&inode->i_hash);
-+ list_del(&inode->i_sb_list);
- list_del_init(&inode->i_list);
- inode->i_state |= I_FREEING;
- inodes_stat.nr_inodes--;
-@@ -266,6 +267,7 @@ static void hugetlbfs_forget_inode(struc
- inodes_stat.nr_unused--;
- hlist_del_init(&inode->i_hash);
- out_truncate:
-+ list_del(&inode->i_sb_list);
- list_del_init(&inode->i_list);
- inode->i_state |= I_FREEING;
- inodes_stat.nr_inodes--;
-@@ -478,7 +480,7 @@ static int hugetlbfs_symlink(struct inod
- gid, S_IFLNK|S_IRWXUGO, 0);
- if (inode) {
- int l = strlen(symname)+1;
-- error = page_symlink(inode, symname, l);
-+ error = page_symlink(inode, symname, l, GFP_KERNEL);
- if (!error) {
- d_instantiate(dentry, inode);
- dget(dentry);
-@@ -758,7 +760,7 @@ struct file *hugetlb_zero_setup(size_t s
- struct inode *inode;
- struct dentry *dentry, *root;
- struct qstr quick_string;
-- char buf[16];
-+ char buf[64];
-
- if (!can_do_hugetlb_shm())
- return ERR_PTR(-EPERM);
-@@ -770,7 +772,8 @@ struct file *hugetlb_zero_setup(size_t s
- return ERR_PTR(-ENOMEM);
-
- root = hugetlbfs_vfsmount->mnt_root;
-- snprintf(buf, 16, "%lu", hugetlbfs_counter());
-+ snprintf(buf, sizeof(buf), "VE%d-%d",
-+ get_exec_env()->veid, hugetlbfs_counter());
- quick_string.name = buf;
- quick_string.len = strlen(quick_string.name);
- quick_string.hash = 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/inode.c linux-2.6.9-ve023stab030/fs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/inode.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/inode.c 2006-10-11 19:07:58.000000000 +0400
-@@ -9,8 +9,10 @@
- #include <linux/mm.h>
- #include <linux/dcache.h>
- #include <linux/init.h>
-+#include <linux/kernel_stat.h>
- #include <linux/quotaops.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/writeback.h>
- #include <linux/module.h>
- #include <linux/backing-dev.h>
-@@ -98,13 +100,15 @@ DECLARE_MUTEX(iprune_sem);
- */
- struct inodes_stat_t inodes_stat;
-
--static kmem_cache_t * inode_cachep;
-+kmem_cache_t * inode_cachep;
-+
-+static struct address_space_operations vfs_empty_aops;
-+struct inode_operations vfs_empty_iops;
-+static struct file_operations vfs_empty_fops;
-+EXPORT_SYMBOL(vfs_empty_iops);
-
- static struct inode *alloc_inode(struct super_block *sb)
- {
-- static struct address_space_operations empty_aops;
-- static struct inode_operations empty_iops;
-- static struct file_operations empty_fops;
- struct inode *inode;
-
- if (sb->s_op->alloc_inode)
-@@ -120,8 +124,8 @@ static struct inode *alloc_inode(struct
- inode->i_flags = 0;
- atomic_set(&inode->i_count, 1);
- inode->i_sock = 0;
-- inode->i_op = &empty_iops;
-- inode->i_fop = &empty_fops;
-+ inode->i_op = &vfs_empty_iops;
-+ inode->i_fop = &vfs_empty_fops;
- inode->i_nlink = 1;
- atomic_set(&inode->i_writecount, 0);
- inode->i_size = 0;
-@@ -145,7 +149,7 @@ static struct inode *alloc_inode(struct
- return NULL;
- }
-
-- mapping->a_ops = &empty_aops;
-+ mapping->a_ops = &vfs_empty_aops;
- mapping->host = inode;
- mapping->flags = 0;
- mapping_set_gfp_mask(mapping, GFP_HIGHUSER);
-@@ -298,10 +302,11 @@ static void dispose_list(struct list_hea
- /*
- * Invalidate all inodes for a device.
- */
--static int invalidate_list(struct list_head *head, struct super_block * sb, struct list_head * dispose)
-+static int invalidate_list(struct list_head *head, struct list_head * dispose,
-+ int verify)
- {
- struct list_head *next;
-- int busy = 0, count = 0;
-+ int busy = 0, count = 0, print_once = 1;
-
- next = head->next;
- for (;;) {
-@@ -311,18 +316,63 @@ static int invalidate_list(struct list_h
- next = next->next;
- if (tmp == head)
- break;
-- inode = list_entry(tmp, struct inode, i_list);
-- if (inode->i_sb != sb)
-- continue;
-+ inode = list_entry(tmp, struct inode, i_sb_list);
- invalidate_inode_buffers(inode);
- if (!atomic_read(&inode->i_count)) {
- hlist_del_init(&inode->i_hash);
-+ list_del(&inode->i_sb_list);
- list_move(&inode->i_list, dispose);
- inode->i_state |= I_FREEING;
- count++;
- continue;
- }
- busy = 1;
-+
-+ if (!verify)
-+ continue;
-+
-+ if (print_once) {
-+ struct super_block *sb = inode->i_sb;
-+ printk("VFS: Busy inodes after unmount. "
-+ "sb = %p, fs type = %s, sb count = %d, "
-+ "sb->s_root = %s\n", sb,
-+ (sb->s_type != NULL) ? sb->s_type->name : "",
-+ sb->s_count,
-+ (sb->s_root != NULL) ?
-+ (char *)sb->s_root->d_name.name : "");
-+ print_once = 0;
-+ }
-+
-+ {
-+ struct dentry *d;
-+ int i;
-+
-+ printk("inode = %p, inode->i_count = %d, "
-+ "inode->i_nlink = %d, "
-+ "inode->i_mode = %d, "
-+ "inode->i_state = %ld, "
-+ "inode->i_flags = %d, "
-+ "inode->i_devices.next = %p, "
-+ "inode->i_devices.prev = %p, "
-+ "inode->i_ino = %ld\n",
-+ inode,
-+ atomic_read(&inode->i_count),
-+ inode->i_nlink,
-+ inode->i_mode,
-+ inode->i_state,
-+ inode->i_flags,
-+ inode->i_devices.next,
-+ inode->i_devices.prev,
-+ inode->i_ino);
-+ printk("inode dump: ");
-+ for (i = 0; i < sizeof(*inode); i++)
-+ printk("%2.2x ", *((u_char *)inode + i));
-+ printk("\n");
-+ list_for_each_entry(d, &inode->i_dentry, d_alias)
-+ printk(" d_alias %s\n",
-+ d->d_name.name);
-+
-+ }
- }
- /* only unused inodes may be cached with i_count zero */
- inodes_stat.nr_unused -= count;
-@@ -345,17 +395,14 @@ static int invalidate_list(struct list_h
- * fails because there are busy inodes then a non zero value is returned.
- * If the discard is successful all the inodes have been discarded.
- */
--int invalidate_inodes(struct super_block * sb)
-+int invalidate_inodes(struct super_block * sb, int verify)
- {
- int busy;
- LIST_HEAD(throw_away);
-
- down(&iprune_sem);
- spin_lock(&inode_lock);
-- busy = invalidate_list(&inode_in_use, sb, &throw_away);
-- busy |= invalidate_list(&inode_unused, sb, &throw_away);
-- busy |= invalidate_list(&sb->s_dirty, sb, &throw_away);
-- busy |= invalidate_list(&sb->s_io, sb, &throw_away);
-+ busy = invalidate_list(&sb->s_inodes, &throw_away, verify);
- spin_unlock(&inode_lock);
-
- dispose_list(&throw_away);
-@@ -384,7 +431,7 @@ int __invalidate_device(struct block_dev
- * hold).
- */
- shrink_dcache_sb(sb);
-- res = invalidate_inodes(sb);
-+ res = invalidate_inodes(sb, 0);
- drop_super(sb);
- }
- invalidate_bdev(bdev, 0);
-@@ -455,6 +502,7 @@ static void prune_icache(int nr_to_scan)
- continue;
- }
- hlist_del_init(&inode->i_hash);
-+ list_del(&inode->i_sb_list);
- list_move(&inode->i_list, &freeable);
- inode->i_state |= I_FREEING;
- nr_pruned++;
-@@ -482,6 +530,7 @@ static void prune_icache(int nr_to_scan)
- */
- static int shrink_icache_memory(int nr, unsigned int gfp_mask)
- {
-+ KSTAT_PERF_ENTER(shrink_icache)
- if (nr) {
- /*
- * Nasty deadlock avoidance. We may hold various FS locks,
-@@ -492,6 +541,7 @@ static int shrink_icache_memory(int nr,
- return -1;
- prune_icache(nr);
- }
-+ KSTAT_PERF_LEAVE(shrink_icache)
- return (inodes_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
- }
-
-@@ -565,6 +615,7 @@ struct inode *new_inode(struct super_blo
- if (inode) {
- spin_lock(&inode_lock);
- inodes_stat.nr_inodes++;
-+ list_add(&inode->i_sb_list, &sb->s_inodes);
- list_add(&inode->i_list, &inode_in_use);
- inode->i_ino = ++last_ino;
- inode->i_state = 0;
-@@ -613,6 +664,7 @@ static struct inode * get_new_inode(stru
- goto set_failed;
-
- inodes_stat.nr_inodes++;
-+ list_add(&inode->i_sb_list, &sb->s_inodes);
- list_add(&inode->i_list, &inode_in_use);
- hlist_add_head(&inode->i_hash, head);
- inode->i_state = I_LOCK|I_NEW;
-@@ -661,6 +713,7 @@ static struct inode * get_new_inode_fast
- if (!old) {
- inode->i_ino = ino;
- inodes_stat.nr_inodes++;
-+ list_add(&inode->i_sb_list, &sb->s_inodes);
- list_add(&inode->i_list, &inode_in_use);
- hlist_add_head(&inode->i_hash, head);
- inode->i_state = I_LOCK|I_NEW;
-@@ -997,6 +1050,7 @@ void generic_delete_inode(struct inode *
- {
- struct super_operations *op = inode->i_sb->s_op;
-
-+ list_del(&inode->i_sb_list);
- list_del_init(&inode->i_list);
- inode->i_state|=I_FREEING;
- inodes_stat.nr_inodes--;
-@@ -1039,6 +1093,7 @@ static void generic_forget_inode(struct
- return;
- }
- inode->i_state |= I_WILL_FREE;
-+ BUG_ON(inode->i_state & I_LOCK);
- spin_unlock(&inode_lock);
- write_inode_now(inode, 1);
- spin_lock(&inode_lock);
-@@ -1046,6 +1101,7 @@ static void generic_forget_inode(struct
- inodes_stat.nr_unused--;
- hlist_del_init(&inode->i_hash);
- }
-+ list_del(&inode->i_sb_list);
- list_del_init(&inode->i_list);
- inode->i_state |= I_FREEING;
- inodes_stat.nr_inodes--;
-@@ -1226,33 +1282,15 @@ int remove_inode_dquot_ref(struct inode
- void remove_dquot_ref(struct super_block *sb, int type, struct list_head *tofree_head)
- {
- struct inode *inode;
-- struct list_head *act_head;
-
- if (!sb->dq_op)
- return; /* nothing to do */
-- spin_lock(&inode_lock); /* This lock is for inodes code */
-
-+ spin_lock(&inode_lock); /* This lock is for inodes code */
- /* We hold dqptr_sem so we are safe against the quota code */
-- list_for_each(act_head, &inode_in_use) {
-- inode = list_entry(act_head, struct inode, i_list);
-- if (inode->i_sb == sb && !IS_NOQUOTA(inode))
-- remove_inode_dquot_ref(inode, type, tofree_head);
-- }
-- list_for_each(act_head, &inode_unused) {
-- inode = list_entry(act_head, struct inode, i_list);
-- if (inode->i_sb == sb && !IS_NOQUOTA(inode))
-- remove_inode_dquot_ref(inode, type, tofree_head);
-- }
-- list_for_each(act_head, &sb->s_dirty) {
-- inode = list_entry(act_head, struct inode, i_list);
-+ list_for_each_entry(inode, &sb->s_inodes, i_sb_list)
- if (!IS_NOQUOTA(inode))
- remove_inode_dquot_ref(inode, type, tofree_head);
-- }
-- list_for_each(act_head, &sb->s_io) {
-- inode = list_entry(act_head, struct inode, i_list);
-- if (!IS_NOQUOTA(inode))
-- remove_inode_dquot_ref(inode, type, tofree_head);
-- }
- spin_unlock(&inode_lock);
- }
-
-@@ -1368,7 +1406,8 @@ void __init inode_init(unsigned long mem
-
- /* inode slab cache */
- inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
-- 0, SLAB_PANIC, init_once, NULL);
-+ 0, SLAB_RECLAIM_ACCOUNT | SLAB_PANIC,
-+ init_once, NULL);
- set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
- audit_filesystem_init();
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/isofs/compress.c linux-2.6.9-ve023stab030/fs/isofs/compress.c
---- linux-2.6.9-42.0.3.EL.orig/fs/isofs/compress.c 2004-10-19 01:53:13.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/isofs/compress.c 2006-10-11 19:07:55.000000000 +0400
-@@ -147,8 +147,14 @@ static int zisofs_readpage(struct file *
- cend = le32_to_cpu(*(__le32 *)(bh->b_data + (blockendptr & bufmask)));
- brelse(bh);
-
-+ if (cstart > cend)
-+ goto eio;
-+
- csize = cend-cstart;
-
-+ if (csize > deflateBound(1UL << zisofs_block_shift))
-+ goto eio;
-+
- /* Now page[] contains an array of pages, any of which can be NULL,
- and the locks on which we hold. We should now read the data and
- release the pages. If the pages are NULL the decompressed data
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jbd/commit.c linux-2.6.9-ve023stab030/fs/jbd/commit.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jbd/commit.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jbd/commit.c 2006-10-11 19:07:55.000000000 +0400
-@@ -103,10 +103,10 @@ void journal_commit_transaction(journal_
- {
- transaction_t *commit_transaction;
- struct journal_head *jh, *new_jh, *descriptor;
-- struct buffer_head *wbuf[64];
-+ struct buffer_head **wbuf = journal->j_wbuf;
- int bufs;
- int flags;
-- int err;
-+ int err, data_err;
- unsigned long blocknr;
- char *tagp = NULL;
- journal_header_t *header;
-@@ -234,6 +234,7 @@ void journal_commit_transaction(journal_
- */
-
- err = 0;
-+ data_err = 0;
- /*
- * Whenever we unlock the journal and sleep, things can get added
- * onto ->t_sync_datalist, so we have to keep looping back to
-@@ -271,7 +272,7 @@ write_out_data:
- BUFFER_TRACE(bh, "start journal writeout");
- get_bh(bh);
- wbuf[bufs++] = bh;
-- if (bufs == ARRAY_SIZE(wbuf)) {
-+ if (bufs == journal->j_wbufsize) {
- jbd_debug(2, "submit %d writes\n",
- bufs);
- spin_unlock(&journal->j_list_lock);
-@@ -284,6 +285,8 @@ write_out_data:
- BUFFER_TRACE(bh, "writeout complete: unfile");
- if (!inverted_lock(journal, bh))
- goto write_out_data;
-+ if (unlikely(!buffer_uptodate(bh)))
-+ data_err = -EIO;
- __journal_unfile_buffer(jh);
- jbd_unlock_bh_state(bh);
- journal_remove_journal_head(bh);
-@@ -315,8 +318,6 @@ write_out_data:
- if (buffer_locked(bh)) {
- spin_unlock(&journal->j_list_lock);
- wait_on_buffer(bh);
-- if (unlikely(!buffer_uptodate(bh)))
-- err = -EIO;
- spin_lock(&journal->j_list_lock);
- }
- if (!inverted_lock(journal, bh)) {
-@@ -324,6 +325,8 @@ write_out_data:
- spin_lock(&journal->j_list_lock);
- continue;
- }
-+ if (unlikely(!buffer_uptodate(bh)))
-+ data_err = -EIO;
- if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) {
- __journal_unfile_buffer(jh);
- jbd_unlock_bh_state(bh);
-@@ -368,6 +371,7 @@ write_out_data:
- descriptor = NULL;
- bufs = 0;
- while (commit_transaction->t_buffers) {
-+ int error;
-
- /* Find the next buffer to be journaled... */
-
-@@ -428,11 +432,12 @@ write_out_data:
-
- /* Where is the buffer to be written? */
-
-- err = journal_next_log_block(journal, &blocknr);
-+ error = journal_next_log_block(journal, &blocknr);
- /* If the block mapping failed, just abandon the buffer
- and repeat this loop: we'll fall into the
- refile-on-abort condition above. */
-- if (err) {
-+ if (error) {
-+ err = error;
- __journal_abort_hard(journal);
- continue;
- }
-@@ -491,7 +496,7 @@ write_out_data:
- /* If there's no more to do, or if the descriptor is full,
- let the IO rip! */
-
-- if (bufs == ARRAY_SIZE(wbuf) ||
-+ if (bufs == journal->j_wbufsize ||
- commit_transaction->t_buffers == NULL ||
- space_left < sizeof(journal_block_tag_t) + 16) {
-
-@@ -618,6 +623,8 @@ wait_for_iobuf:
-
- jbd_debug(3, "JBD: commit phase 6\n");
-
-+ if (err)
-+ goto skip_commit;
- if (is_journal_aborted(journal))
- goto skip_commit;
-
-@@ -688,8 +695,13 @@ wait_for_iobuf:
-
- skip_commit: /* The journal should be unlocked by now. */
-
-- if (err)
-+ if (err) {
-+ char b[BDEVNAME_SIZE];
-+
-+ printk(KERN_ERR "Error %d writing journal on %s\n",
-+ err, bdevname(journal->j_dev, b));
- __journal_abort_hard(journal);
-+ }
-
- /*
- * Call any callbacks that had been registered for handles in this
-@@ -790,11 +802,22 @@ skip_commit: /* The journal should be un
- jbd_unlock_bh_state(bh);
- } else {
- J_ASSERT_BH(bh, !buffer_dirty(bh));
-- J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
-- __journal_unfile_buffer(jh);
-- jbd_unlock_bh_state(bh);
-- journal_remove_journal_head(bh); /* needs a brelse */
-- release_buffer_page(bh);
-+ /* The buffer on BJ_Forget list and not jbddirty means
-+ * it has been freed by this transaction and hence it
-+ * could not have been reallocated until this
-+ * transaction has committed. *BUT* it could be
-+ * reallocated once we have written all the data to
-+ * disk and before we process the buffer on BJ_Forget
-+ * list. */
-+ JBUFFER_TRACE(jh, "refile or unfile freed buffer");
-+ __journal_refile_buffer(jh);
-+ if (!jh->b_transaction) {
-+ jbd_unlock_bh_state(bh);
-+ /* needs a brelse */
-+ journal_remove_journal_head(bh);
-+ release_buffer_page(bh);
-+ } else
-+ jbd_unlock_bh_state(bh);
- }
- spin_unlock(&journal->j_list_lock);
- cond_resched();
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jbd/journal.c linux-2.6.9-ve023stab030/fs/jbd/journal.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jbd/journal.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jbd/journal.c 2006-10-11 19:07:55.000000000 +0400
-@@ -153,6 +153,9 @@ int kjournald(void *arg)
- spin_lock(&journal->j_state_lock);
-
- loop:
-+ if (journal->j_flags & JFS_UNMOUNT)
-+ goto end_loop;
-+
- jbd_debug(1, "commit_sequence=%d, commit_request=%d\n",
- journal->j_commit_sequence, journal->j_commit_request);
-
-@@ -162,11 +165,11 @@ loop:
- del_timer_sync(journal->j_commit_timer);
- journal_commit_transaction(journal);
- spin_lock(&journal->j_state_lock);
-- goto end_loop;
-+ goto loop;
- }
-
- wake_up(&journal->j_wait_done_commit);
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- /*
- * The simpler the better. Flushing journal isn't a
- * good idea, because that depends on threads that may
-@@ -174,7 +177,7 @@ loop:
- */
- jbd_debug(1, "Now suspending kjournald\n");
- spin_unlock(&journal->j_state_lock);
-- refrigerator(PF_FREEZE);
-+ refrigerator();
- spin_lock(&journal->j_state_lock);
- } else {
- /*
-@@ -212,10 +215,9 @@ loop:
- journal->j_commit_request = transaction->t_tid;
- jbd_debug(1, "woke because of timeout\n");
- }
--end_loop:
-- if (!(journal->j_flags & JFS_UNMOUNT))
-- goto loop;
-+ goto loop;
-
-+end_loop:
- spin_unlock(&journal->j_state_lock);
- del_timer_sync(journal->j_commit_timer);
- journal->j_task = NULL;
-@@ -224,10 +226,16 @@ end_loop:
- return 0;
- }
-
--static void journal_start_thread(journal_t *journal)
-+static int journal_start_thread(journal_t *journal)
- {
-- kernel_thread(kjournald, journal, CLONE_VM|CLONE_FS|CLONE_FILES);
-+ int err;
-+
-+ err = kernel_thread(kjournald, journal, CLONE_VM|CLONE_FS|CLONE_FILES);
-+ if (err < 0)
-+ return err;
-+
- wait_event(journal->j_wait_done_commit, journal->j_task != 0);
-+ return 0;
- }
-
- static void journal_kill_thread(journal_t *journal)
-@@ -723,6 +731,7 @@ journal_t * journal_init_dev(struct bloc
- {
- journal_t *journal = journal_init_common();
- struct buffer_head *bh;
-+ int n;
-
- if (!journal)
- return NULL;
-@@ -738,6 +747,17 @@ journal_t * journal_init_dev(struct bloc
- journal->j_sb_buffer = bh;
- journal->j_superblock = (journal_superblock_t *)bh->b_data;
-
-+ /* journal descriptor can store up to n blocks -bzzz */
-+ n = journal->j_blocksize / sizeof(journal_block_tag_t);
-+ journal->j_wbufsize = n;
-+ journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
-+ if (!journal->j_wbuf) {
-+ printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
-+ __FUNCTION__);
-+ kfree(journal);
-+ journal = NULL;
-+ }
-+
- return journal;
- }
-
-@@ -754,6 +774,7 @@ journal_t * journal_init_inode (struct i
- struct buffer_head *bh;
- journal_t *journal = journal_init_common();
- int err;
-+ int n;
- unsigned long blocknr;
-
- if (!journal)
-@@ -770,6 +791,17 @@ journal_t * journal_init_inode (struct i
- journal->j_maxlen = inode->i_size >> inode->i_sb->s_blocksize_bits;
- journal->j_blocksize = inode->i_sb->s_blocksize;
-
-+ /* journal descriptor can store up to n blocks -bzzz */
-+ n = journal->j_blocksize / sizeof(journal_block_tag_t);
-+ journal->j_wbufsize = n;
-+ journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
-+ if (!journal->j_wbuf) {
-+ printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
-+ __FUNCTION__);
-+ kfree(journal);
-+ return NULL;
-+ }
-+
- err = journal_bmap(journal, 0, &blocknr);
- /* If that failed, give up */
- if (err) {
-@@ -829,8 +861,7 @@ static int journal_reset(journal_t *jour
-
- /* Add the dynamic fields and write it to disk. */
- journal_update_superblock(journal, 1);
-- journal_start_thread(journal);
-- return 0;
-+ return journal_start_thread(journal);
- }
-
- /**
-@@ -1143,6 +1174,7 @@ void journal_destroy(journal_t *journal)
- iput(journal->j_inode);
- if (journal->j_revoke)
- journal_destroy_revoke(journal);
-+ kfree(journal->j_wbuf);
- kfree(journal);
- }
-
-@@ -1493,7 +1525,7 @@ void __journal_abort_soft (journal_t *jo
- * entered abort state during the update.
- *
- * Recursive transactions are not disturbed by journal abort until the
-- * final journal_stop, which will receive the -EIO error.
-+ * final journal_stop.
- *
- * Finally, the journal_abort call allows the caller to supply an errno
- * which will be recorded (if possible) in the journal superblock. This
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jbd/transaction.c linux-2.6.9-ve023stab030/fs/jbd/transaction.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jbd/transaction.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jbd/transaction.c 2006-10-11 19:08:02.000000000 +0400
-@@ -1416,7 +1416,8 @@ int journal_stop(handle_t *handle)
- * Special case: JFS_SYNC synchronous updates require us
- * to wait for the commit to complete.
- */
-- if (handle->h_sync && !(current->flags & PF_MEMALLOC))
-+ if (handle->h_sync && !(current->flags & PF_MEMALLOC) &&
-+ !test_thread_flag(TIF_MEMDIE))
- err = log_wait_commit(journal, tid);
- } else {
- spin_unlock(&transaction->t_handle_lock);
-@@ -1898,6 +1899,7 @@ zap_buffer_unlocked:
- clear_buffer_mapped(bh);
- clear_buffer_req(bh);
- clear_buffer_new(bh);
-+ clear_buffer_delay(bh);
- bh->b_bdev = NULL;
- return may_free;
- }
-@@ -2071,7 +2073,8 @@ void __journal_refile_buffer(struct jour
- __journal_temp_unlink_buffer(jh);
- jh->b_transaction = jh->b_next_transaction;
- jh->b_next_transaction = NULL;
-- __journal_file_buffer(jh, jh->b_transaction, BJ_Metadata);
-+ __journal_file_buffer(jh, jh->b_transaction,
-+ was_dirty ? BJ_Metadata : BJ_Reserved);
- J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING);
-
- if (was_dirty)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jffs2/background.c linux-2.6.9-ve023stab030/fs/jffs2/background.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jffs2/background.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jffs2/background.c 2006-10-11 19:07:55.000000000 +0400
-@@ -93,8 +93,8 @@ static int jffs2_garbage_collect_thread(
- schedule();
- }
-
-- if (current->flags & PF_FREEZE) {
-- refrigerator(0);
-+ if (test_thread_flag(TIF_FREEZE)) {
-+ refrigerator();
- /* refrigerator() should recalc sigpending for us
- but doesn't. No matter - allow_signal() will. */
- continue;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jfs/acl.c linux-2.6.9-ve023stab030/fs/jfs/acl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jfs/acl.c 2004-10-19 01:53:10.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jfs/acl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -128,7 +128,7 @@ out:
- *
- * modified vfs_permission to check posix acl
- */
--int jfs_permission(struct inode * inode, int mask, struct nameidata *nd)
-+int __jfs_permission(struct inode * inode, int mask)
- {
- umode_t mode = inode->i_mode;
- struct jfs_inode_info *ji = JFS_IP(inode);
-@@ -207,6 +207,28 @@ check_capabilities:
- return -EACCES;
- }
-
-+int jfs_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
-+{
-+ int ret;
-+
-+ if (exec_perm != NULL)
-+ down(&inode->i_sem);
-+
-+ ret = __jfs_permission(inode, mask);
-+
-+ if (exec_perm != NULL) {
-+ if (!ret) {
-+ exec_perm->set = 1;
-+ exec_perm->mode = inode->i_mode;
-+ exec_perm->uid = inode->i_uid;
-+ exec_perm->gid = inode->i_gid;
-+ }
-+ up(&inode->i_sem);
-+ }
-+ return ret;
-+}
-+
- int jfs_init_acl(struct inode *inode, struct inode *dir)
- {
- struct posix_acl *acl = NULL;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_acl.h linux-2.6.9-ve023stab030/fs/jfs/jfs_acl.h
---- linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_acl.h 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jfs/jfs_acl.h 2006-10-11 19:07:55.000000000 +0400
-@@ -22,7 +22,7 @@
-
- #include <linux/xattr_acl.h>
-
--int jfs_permission(struct inode *, int, struct nameidata *);
-+int jfs_permission(struct inode *, int, struct nameidata *, struct exec_perm *);
- int jfs_init_acl(struct inode *, struct inode *);
- int jfs_setattr(struct dentry *, struct iattr *);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_logmgr.c linux-2.6.9-ve023stab030/fs/jfs/jfs_logmgr.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_logmgr.c 2004-10-19 01:54:20.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jfs/jfs_logmgr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2328,9 +2328,9 @@ int jfsIOWait(void *arg)
- lbmStartIO(bp);
- spin_lock_irq(&log_redrive_lock);
- }
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- spin_unlock_irq(&log_redrive_lock);
-- refrigerator(PF_FREEZE);
-+ refrigerator();
- } else {
- add_wait_queue(&jfs_IO_thread_wait, &wq);
- set_current_state(TASK_INTERRUPTIBLE);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_txnmgr.c linux-2.6.9-ve023stab030/fs/jfs/jfs_txnmgr.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jfs/jfs_txnmgr.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jfs/jfs_txnmgr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2773,9 +2773,9 @@ int jfs_lazycommit(void *arg)
- break;
- }
-
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- LAZY_UNLOCK(flags);
-- refrigerator(PF_FREEZE);
-+ refrigerator();
- } else {
- DECLARE_WAITQUEUE(wq, current);
-
-@@ -2984,9 +2984,9 @@ int jfs_sync(void *arg)
- /* Add anon_list2 back to anon_list */
- list_splice_init(&TxAnchor.anon_list2, &TxAnchor.anon_list);
-
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- TXN_UNLOCK();
-- refrigerator(PF_FREEZE);
-+ refrigerator();
- } else {
- DECLARE_WAITQUEUE(wq, current);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/jfs/xattr.c linux-2.6.9-ve023stab030/fs/jfs/xattr.c
---- linux-2.6.9-42.0.3.EL.orig/fs/jfs/xattr.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/jfs/xattr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -778,7 +778,7 @@ static int can_set_xattr(struct inode *i
- (!S_ISDIR(inode->i_mode) || inode->i_mode &S_ISVTX))
- return -EPERM;
-
-- return permission(inode, MAY_WRITE, NULL);
-+ return permission(inode, MAY_WRITE, NULL, NULL);
- }
-
- int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
-@@ -939,7 +939,7 @@ static int can_get_xattr(struct inode *i
- {
- if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0)
- return 0;
-- return permission(inode, MAY_READ, NULL);
-+ return permission(inode, MAY_READ, NULL, NULL);
- }
-
- ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/libfs.c linux-2.6.9-ve023stab030/fs/libfs.c
---- linux-2.6.9-42.0.3.EL.orig/fs/libfs.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/libfs.c 2006-10-11 19:07:57.000000000 +0400
-@@ -426,10 +426,13 @@ static spinlock_t pin_fs_lock = SPIN_LOC
- int simple_pin_fs(char *name, struct vfsmount **mount, int *count)
- {
- struct vfsmount *mnt = NULL;
-+ struct file_system_type *fstype;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
-- mnt = do_kern_mount(name, 0, name, NULL);
-+ fstype = get_fs_type(name);
-+ mnt = do_kern_mount(fstype, 0, name, NULL);
-+ put_filesystem(fstype);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/lockd/clntproc.c linux-2.6.9-ve023stab030/fs/lockd/clntproc.c
---- linux-2.6.9-42.0.3.EL.orig/fs/lockd/clntproc.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/lockd/clntproc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -126,10 +126,10 @@ static void nlmclnt_setlockargs(struct n
- nlmclnt_next_cookie(&argp->cookie);
- argp->state = nsm_local_state;
- memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh));
-- lock->caller = system_utsname.nodename;
-+ lock->caller = ve_utsname.nodename;
- lock->oh.data = req->a_owner;
- lock->oh.len = sprintf(req->a_owner, "%d@%s",
-- current->pid, system_utsname.nodename);
-+ current->pid, ve_utsname.nodename);
- locks_copy_lock(&lock->fl, fl);
- }
-
-@@ -150,7 +150,7 @@ nlmclnt_setgrantargs(struct nlm_rqst *ca
- {
- locks_copy_lock(&call->a_args.lock.fl, &lock->fl);
- memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh));
-- call->a_args.lock.caller = system_utsname.nodename;
-+ call->a_args.lock.caller = ve_utsname.nodename;
- call->a_args.lock.oh.len = lock->oh.len;
-
- /* set default data area */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/lockd/mon.c linux-2.6.9-ve023stab030/fs/lockd/mon.c
---- linux-2.6.9-42.0.3.EL.orig/fs/lockd/mon.c 2006-10-11 18:29:34.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/lockd/mon.c 2006-10-11 19:07:57.000000000 +0400
-@@ -149,7 +149,7 @@ xdr_encode_common(struct rpc_rqst *rqstp
- */
- sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
- if (!(p = xdr_encode_string(p, buffer))
-- || !(p = xdr_encode_string(p, system_utsname.nodename)))
-+ || !(p = xdr_encode_string(p, ve_utsname.nodename)))
- return ERR_PTR(-EIO);
- *p++ = htonl(argp->prog);
- *p++ = htonl(argp->vers);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/locks.c linux-2.6.9-ve023stab030/fs/locks.c
---- linux-2.6.9-42.0.3.EL.orig/fs/locks.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/locks.c 2006-10-11 19:07:59.000000000 +0400
-@@ -127,6 +127,8 @@
- #include <asm/semaphore.h>
- #include <asm/uaccess.h>
-
-+#include <ub/ub_misc.h>
-+
- #define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
- #define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
- #define IS_LEASE(fl) (fl->fl_flags & FL_LEASE)
-@@ -146,9 +148,23 @@ static LIST_HEAD(blocked_list);
- static kmem_cache_t *filelock_cache;
-
- /* Allocate an empty lock structure. */
--static struct file_lock *locks_alloc_lock(void)
-+static struct file_lock *locks_alloc_lock(int charge)
- {
-- return kmem_cache_alloc(filelock_cache, SLAB_KERNEL);
-+ struct file_lock *flock;
-+
-+ flock = kmem_cache_alloc(filelock_cache, SLAB_KERNEL);
-+ if (flock == NULL)
-+ goto out;
-+ flock->fl_charged = 0;
-+ if (!charge)
-+ goto out;
-+ if (!ub_flock_charge(flock, 1))
-+ goto out;
-+
-+ kmem_cache_free(filelock_cache, flock);
-+ flock = NULL;
-+out:
-+ return flock;
- }
-
- /* Free a lock which is not in use. */
-@@ -174,6 +190,7 @@ static inline void locks_free_lock(struc
- }
- fl->fl_lmops = NULL;
-
-+ ub_flock_uncharge(fl);
- kmem_cache_free(filelock_cache, fl);
- }
-
-@@ -253,8 +270,8 @@ static int flock_make_lock(struct file *
- int type = flock_translate_cmd(cmd);
- if (type < 0)
- return type;
--
-- fl = locks_alloc_lock();
-+
-+ fl = locks_alloc_lock(type != F_UNLCK);
- if (fl == NULL)
- return -ENOMEM;
-
-@@ -386,7 +403,7 @@ static int flock64_to_posix_lock(struct
- /* Allocate a file_lock initialised to this type of lease */
- static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
- {
-- struct file_lock *fl = locks_alloc_lock();
-+ struct file_lock *fl = locks_alloc_lock(1);
- if (fl == NULL)
- return -ENOMEM;
-
-@@ -657,8 +674,9 @@ EXPORT_SYMBOL(posix_locks_deadlock);
- * at the head of the list, but that's secret knowledge known only to
- * flock_lock_file and posix_lock_file.
- */
--static int flock_lock_file(struct file *filp, struct file_lock *new_fl)
-+static int flock_lock_file(struct file *filp, struct file_lock *request)
- {
-+ struct file_lock *new_fl = NULL;
- struct file_lock **before;
- struct inode * inode = filp->f_dentry->d_inode;
- int error = 0;
-@@ -673,17 +691,20 @@ static int flock_lock_file(struct file *
- continue;
- if (filp != fl->fl_file)
- continue;
-- if (new_fl->fl_type == fl->fl_type)
-+ if (request->fl_type == fl->fl_type)
- goto out;
- found = 1;
- locks_delete_lock(before);
- break;
- }
-- unlock_kernel();
-
-- if (new_fl->fl_type == F_UNLCK)
-- return 0;
-+ if (request->fl_type == F_UNLCK)
-+ goto out;
-
-+ error = -ENOMEM;
-+ new_fl = locks_alloc_lock(0);
-+ if (new_fl == NULL)
-+ goto out;
- /*
- * If a higher-priority process was blocked on the old file lock,
- * give it the opportunity to lock the file.
-@@ -691,26 +712,32 @@ static int flock_lock_file(struct file *
- if (found)
- cond_resched();
-
-- lock_kernel();
- for_each_lock(inode, before) {
- struct file_lock *fl = *before;
- if (IS_POSIX(fl))
- break;
- if (IS_LEASE(fl))
- continue;
-- if (!flock_locks_conflict(new_fl, fl))
-+ if (!flock_locks_conflict(request, fl))
- continue;
- error = -EAGAIN;
-- if (new_fl->fl_flags & FL_SLEEP) {
-- locks_insert_block(fl, new_fl);
-- }
-+ if (request->fl_flags & FL_SLEEP)
-+ locks_insert_block(fl, request);
- goto out;
- }
-+ locks_copy_lock(new_fl, request);
- locks_insert_lock(&inode->i_flock, new_fl);
-+
-+ WARN_ON(!request->fl_charged);
-+ new_fl->fl_charged = 1;
-+ request->fl_charged = 0;
-+ new_fl = NULL;
- error = 0;
-
- out:
- unlock_kernel();
-+ if (new_fl)
-+ locks_free_lock(new_fl);
- return error;
- }
-
-@@ -729,8 +756,11 @@ static int __posix_lock_file(struct inod
- * We may need two file_lock structures for this operation,
- * so we get them in advance to avoid races.
- */
-- new_fl = locks_alloc_lock();
-- new_fl2 = locks_alloc_lock();
-+ if (request->fl_type != F_UNLCK)
-+ new_fl = locks_alloc_lock(1);
-+ else
-+ new_fl = NULL;
-+ new_fl2 = locks_alloc_lock(0);
-
- lock_kernel();
- if (request->fl_type != F_UNLCK) {
-@@ -758,7 +788,7 @@ static int __posix_lock_file(struct inod
- goto out;
-
- error = -ENOLCK; /* "no luck" */
-- if (!(new_fl && new_fl2))
-+ if (!((request->fl_type == F_UNLCK || new_fl) && new_fl2))
- goto out;
-
- /*
-@@ -860,19 +890,29 @@ static int __posix_lock_file(struct inod
- if (!added) {
- if (request->fl_type == F_UNLCK)
- goto out;
-+ error = -ENOLCK;
-+ if (right && (left == right) && ub_flock_charge(new_fl, 1))
-+ goto out;
- locks_copy_lock(new_fl, request);
- locks_insert_lock(before, new_fl);
- new_fl = NULL;
-+ error = 0;
- }
- if (right) {
- if (left == right) {
- /* The new lock breaks the old one in two pieces,
- * so we have to use the second new lock.
- */
-+ error = -ENOLCK;
-+ if (added && ub_flock_charge(new_fl2,
-+ request->fl_type != F_UNLCK))
-+ goto out;
-+ new_fl2->fl_charged = 1;
- left = new_fl2;
- new_fl2 = NULL;
- locks_copy_lock(left, right);
- locks_insert_lock(before, left);
-+ error = 0;
- }
- right->fl_start = request->fl_end + 1;
- locks_wake_up_blocks(right);
-@@ -1399,15 +1439,14 @@ asmlinkage long sys_flock(unsigned int f
- error = flock_lock_file_wait(filp, lock);
-
- out_free:
-- if (list_empty(&lock->fl_link)) {
-- locks_free_lock(lock);
-- }
-+ locks_free_lock(lock);
-
- out_putf:
- fput(filp);
- out:
- return error;
- }
-+EXPORT_SYMBOL(sys_flock);
-
- /* Report the first existing lock that would conflict with l.
- * This implements the F_GETLK command of fcntl().
-@@ -1444,7 +1483,7 @@ int fcntl_getlk(struct file *filp, struc
-
- flock.l_type = F_UNLCK;
- if (fl != NULL) {
-- flock.l_pid = fl->fl_pid;
-+ flock.l_pid = pid_type_to_vpid(PIDTYPE_TGID, fl->fl_pid);
- #if BITS_PER_LONG == 32
- /*
- * Make sure we can represent the posix lock via
-@@ -1476,7 +1515,7 @@ out:
- int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
- struct flock __user *l)
- {
-- struct file_lock *file_lock = locks_alloc_lock();
-+ struct file_lock *file_lock = locks_alloc_lock(0);
- struct flock flock;
- struct inode *inode;
- int error;
-@@ -1600,7 +1639,7 @@ int fcntl_getlk64(struct file *filp, str
-
- flock.l_type = F_UNLCK;
- if (fl != NULL) {
-- flock.l_pid = fl->fl_pid;
-+ flock.l_pid = pid_type_to_vpid(PIDTYPE_TGID, fl->fl_pid);
- flock.l_start = fl->fl_start;
- flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
- fl->fl_end - fl->fl_start + 1;
-@@ -1621,7 +1660,7 @@ out:
- int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
- struct flock64 __user *l)
- {
-- struct file_lock *file_lock = locks_alloc_lock();
-+ struct file_lock *file_lock = locks_alloc_lock(1);
- struct flock64 flock;
- struct inode *inode;
- int error;
-@@ -1847,7 +1886,9 @@ EXPORT_SYMBOL(posix_unblock_lock);
- static void lock_get_status(char* out, struct file_lock *fl, int id, char *pfx)
- {
- struct inode *inode = NULL;
-+ unsigned int fl_pid;
-
-+ fl_pid = pid_type_to_vpid(PIDTYPE_TGID, fl->fl_pid);
- if (fl->fl_file != NULL)
- inode = fl->fl_file->f_dentry->d_inode;
-
-@@ -1889,16 +1930,16 @@ static void lock_get_status(char* out, s
- }
- if (inode) {
- #ifdef WE_CAN_BREAK_LSLK_NOW
-- out += sprintf(out, "%d %s:%ld ", fl->fl_pid,
-+ out += sprintf(out, "%d %s:%ld ", fl_pid,
- inode->i_sb->s_id, inode->i_ino);
- #else
- /* userspace relies on this representation of dev_t ;-( */
-- out += sprintf(out, "%d %02x:%02x:%ld ", fl->fl_pid,
-+ out += sprintf(out, "%d %02x:%02x:%ld ", fl_pid,
- MAJOR(inode->i_sb->s_dev),
- MINOR(inode->i_sb->s_dev), inode->i_ino);
- #endif
- } else {
-- out += sprintf(out, "%d <none>:0 ", fl->fl_pid);
-+ out += sprintf(out, "%d <none>:0 ", fl_pid);
- }
- if (IS_POSIX(fl)) {
- if (fl->fl_end == OFFSET_MAX)
-@@ -1947,11 +1988,17 @@ int get_locks_status(char *buffer, char
- char *q = buffer;
- off_t pos = 0;
- int i = 0;
-+ struct ve_struct *env;
-
- lock_kernel();
-+ env = get_exec_env();
- list_for_each(tmp, &file_lock_list) {
- struct list_head *btmp;
- struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
-+
-+ if (!ve_accessible(VE_OWNER_FILP(fl->fl_file), env))
-+ continue;
-+
- lock_get_status(q, fl, ++i, "");
- move_lock_status(&q, &pos, offset);
-
-@@ -2105,7 +2152,7 @@ EXPORT_SYMBOL(steal_locks);
- static int __init filelock_init(void)
- {
- filelock_cache = kmem_cache_create("file_lock_cache",
-- sizeof(struct file_lock), 0, SLAB_PANIC,
-+ sizeof(struct file_lock), 0, SLAB_PANIC | SLAB_UBC,
- init_once, NULL);
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/minix/namei.c linux-2.6.9-ve023stab030/fs/minix/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/minix/namei.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/minix/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -116,7 +116,7 @@ static int minix_symlink(struct inode *
-
- inode->i_mode = S_IFLNK | 0777;
- minix_set_inode(inode, 0);
-- err = page_symlink(inode, symname, i);
-+ err = page_symlink(inode, symname, i, GFP_KERNEL);
- if (err)
- goto out_fail;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/mpage.c linux-2.6.9-ve023stab030/fs/mpage.c
---- linux-2.6.9-42.0.3.EL.orig/fs/mpage.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/mpage.c 2006-10-11 19:07:55.000000000 +0400
-@@ -709,6 +709,8 @@ retry:
- bio = mpage_writepage(bio, page, get_block,
- &last_block_in_bio, &ret, wbc);
- }
-+ if (unlikely(ret == WRITEPAGE_ACTIVATE))
-+ unlock_page(page);
- if (ret || (--(wbc->nr_to_write) <= 0))
- done = 1;
- if (wbc->nonblocking && bdi_write_congested(bdi)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/namei.c linux-2.6.9-ve023stab030/fs/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/namei.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/namei.c 2006-10-11 19:07:59.000000000 +0400
-@@ -115,11 +115,12 @@ static inline int do_getname(const char
- int retval;
- unsigned long len = PATH_MAX;
-
-- if ((unsigned long) filename >= TASK_SIZE) {
-- if (!segment_eq(get_fs(), KERNEL_DS))
-+ if (!segment_eq(get_fs(), KERNEL_DS)) {
-+ if ((unsigned long) filename >= TASK_SIZE)
- return -EFAULT;
-- } else if (TASK_SIZE - (unsigned long) filename < PATH_MAX)
-- len = TASK_SIZE - (unsigned long) filename;
-+ if (TASK_SIZE - (unsigned long) filename < PATH_MAX)
-+ len = TASK_SIZE - (unsigned long) filename;
-+ }
-
- retval = strncpy_from_user((char *)page, filename, len);
- if (retval > 0) {
-@@ -135,6 +136,7 @@ char * getname(const char __user * filen
- {
- char *tmp, *result;
-
-+ ub_dentry_checkup();
- result = ERR_PTR(-ENOMEM);
- tmp = __getname();
- if (tmp) {
-@@ -159,7 +161,7 @@ char * getname(const char __user * filen
- * for filesystem access without changing the "normal" uids which
- * are used for other things..
- */
--int vfs_permission(struct inode * inode, int mask)
-+int __vfs_permission(struct inode * inode, int mask)
- {
- umode_t mode = inode->i_mode;
-
-@@ -208,7 +210,29 @@ int vfs_permission(struct inode * inode,
- return -EACCES;
- }
-
--int permission(struct inode * inode,int mask, struct nameidata *nd)
-+int vfs_permission(struct inode * inode, int mask, struct exec_perm * exec_perm)
-+{
-+ int ret;
-+
-+ if (exec_perm != NULL)
-+ down(&inode->i_sem);
-+
-+ ret = __vfs_permission(inode, mask);
-+
-+ if (exec_perm != NULL) {
-+ if (!ret) {
-+ exec_perm->set = 1;
-+ exec_perm->mode = inode->i_mode;
-+ exec_perm->uid = inode->i_uid;
-+ exec_perm->gid = inode->i_gid;
-+ }
-+ up(&inode->i_sem);
-+ }
-+ return ret;
-+}
-+
-+int permission(struct inode * inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- int retval;
- int submask;
-@@ -219,9 +243,9 @@ int permission(struct inode * inode,int
- submask = mask & ~MAY_APPEND;
-
- if (inode->i_op && inode->i_op->permission)
-- retval = inode->i_op->permission(inode, submask, nd);
-+ retval = inode->i_op->permission(inode, submask, nd, exec_perm);
- else
-- retval = vfs_permission(inode, submask);
-+ retval = vfs_permission(inode, submask, exec_perm);
- if (retval)
- return retval;
-
-@@ -304,6 +328,21 @@ static struct dentry * cached_lookup(str
- if (!dentry)
- dentry = d_lookup(parent, name);
-
-+ /*
-+ * The revalidation rules are simple:
-+ * d_revalidate operation is called when we're about to use a cached
-+ * dentry rather than call d_lookup.
-+ * d_revalidate method may unhash the dentry itself or return FALSE, in
-+ * which case if the dentry can be released d_lookup will be called.
-+ *
-+ * Additionally, by request of NFS people
-+ * (http://linux.bkbits.net:8080/linux-2.4/cset@1.181?nav=index.html|src/|src/fs|related/fs/namei.c)
-+ * d_revalidate is called when `/', `.' or `..' are looked up.
-+ * Since re-lookup is impossible on them, we introduce a hack and
-+ * return an error in this case.
-+ *
-+ * 2003/02/19 SAW
-+ */
- if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
- if (!dentry->d_op->d_revalidate(dentry, nd) && !d_invalidate(dentry)) {
- dput(dentry);
-@@ -368,6 +407,7 @@ static struct dentry * real_lookup(struc
- struct dentry * result;
- struct inode *dir = parent->d_inode;
-
-+repeat:
- down(&dir->i_sem);
- /*
- * First re-do the cached lookup just in case it was created
-@@ -406,7 +446,7 @@ static struct dentry * real_lookup(struc
- if (result->d_op && result->d_op->d_revalidate) {
- if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) {
- dput(result);
-- result = ERR_PTR(-ENOENT);
-+ goto repeat;
- }
- }
- return result;
-@@ -582,7 +622,14 @@ static inline void follow_dotdot(struct
- read_unlock(&current->fs->lock);
- break;
- }
-- read_unlock(&current->fs->lock);
-+#ifdef CONFIG_VE
-+ if (*dentry == get_exec_env()->fs_root &&
-+ *mnt == get_exec_env()->fs_rootmnt) {
-+ read_unlock(&current->fs->lock);
-+ break;
-+ }
-+#endif
-+ read_unlock(&current->fs->lock);
- spin_lock(&dcache_lock);
- if (*dentry != (*mnt)->mnt_root) {
- *dentry = dget((*dentry)->d_parent);
-@@ -666,6 +713,7 @@ static fastcall int __link_path_walk(con
- {
- struct path next;
- struct inode *inode;
-+ int real_components = 0;
- int err, atomic;
- unsigned int lookup_flags = nd->flags;
-
-@@ -688,7 +736,7 @@ static fastcall int __link_path_walk(con
-
- err = exec_permission_lite(inode, nd);
- if (err == -EAGAIN) {
-- err = permission(inode, MAY_EXEC, nd);
-+ err = permission(inode, MAY_EXEC, nd, NULL);
- }
- if (err)
- break;
-@@ -740,10 +788,14 @@ static fastcall int __link_path_walk(con
- }
- nd->flags |= LOOKUP_CONTINUE;
- /* This does the actual lookups.. */
-+ real_components++;
- err = do_lookup(nd, &this, &next, atomic);
- if (err)
- break;
- /* Check mountpoints.. */
-+ err = -ENOENT;
-+ if ((lookup_flags & LOOKUP_STRICT) && d_mountpoint(nd->dentry))
-+ goto out_dput;
- follow_mount(&next.mnt, &next.dentry);
-
- err = -ENOENT;
-@@ -755,6 +807,10 @@ static fastcall int __link_path_walk(con
- goto out_dput;
-
- if (inode->i_op->follow_link) {
-+ err = -ENOENT;
-+ if (lookup_flags & LOOKUP_STRICT)
-+ goto out_dput;
-+
- mntget(next.mnt);
- err = do_follow_link(next.dentry, nd);
- dput(next.dentry);
-@@ -805,9 +861,13 @@ last_component:
- err = do_lookup(nd, &this, &next, atomic);
- if (err)
- break;
-+ err = -ENOENT;
-+ if ((lookup_flags & LOOKUP_STRICT) && d_mountpoint(nd->dentry))
-+ goto out_dput;
- follow_mount(&next.mnt, &next.dentry);
- inode = next.dentry->d_inode;
- if ((lookup_flags & LOOKUP_FOLLOW)
-+ && !(lookup_flags & LOOKUP_STRICT)
- && inode && inode->i_op && inode->i_op->follow_link) {
- mntget(next.mnt);
- err = do_follow_link(next.dentry, nd);
-@@ -835,26 +895,40 @@ lookup_parent:
- nd->last_type = LAST_NORM;
- if (this.name[0] != '.')
- goto return_base;
-- if (this.len == 1)
-+ if (this.len == 1) {
- nd->last_type = LAST_DOT;
-- else if (this.len == 2 && this.name[1] == '.')
-+ goto return_reval;
-+ } else if (this.len == 2 && this.name[1] == '.') {
- nd->last_type = LAST_DOTDOT;
-- else
-- goto return_base;
-+ goto return_reval;
-+ }
-+return_base:
-+ if (!(nd->flags & LOOKUP_NOAREACHECK)) {
-+ err = check_area_access_ve(nd->dentry, nd->mnt);
-+ if (err)
-+ break;
-+ }
-+ return 0;
- return_reval:
- /*
- * We bypassed the ordinary revalidation routines.
- * We may need to check the cached dentry for staleness.
- */
-- if (nd->dentry && nd->dentry->d_sb &&
-+ if (!real_components && nd->dentry && nd->dentry->d_sb &&
- (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
- err = -ESTALE;
- /* Note: we do not d_invalidate() */
- if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd))
-+ /*
-+ * This lookup is for `/' or `.' or `..'.
-+ * The filesystem unhashed the dentry itself
-+ * inside d_revalidate (otherwise, d_invalidate
-+ * wouldn't succeed). As a special courtesy to
-+ * NFS we return an error. 2003/02/19 SAW
-+ */
- break;
- }
--return_base:
-- return 0;
-+ goto return_base;
- out_dput:
- dput(next.dentry);
- break;
-@@ -1015,7 +1089,7 @@ static struct dentry * __lookup_hash(str
- int err;
-
- inode = base->d_inode;
-- err = permission(inode, MAY_EXEC, nd);
-+ err = permission(inode, MAY_EXEC, nd, NULL);
- dentry = ERR_PTR(err);
- if (err)
- goto out;
-@@ -1146,7 +1220,7 @@ static inline int may_delete(struct inod
-
- audit_notify_watch(victim->d_inode, MAY_WRITE);
-
-- error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
-+ error = permission(dir,MAY_WRITE | MAY_EXEC, NULL, NULL);
- if (error)
- return error;
- if (IS_APPEND(dir))
-@@ -1183,7 +1257,7 @@ static inline int may_create(struct inod
- return -EEXIST;
- if (IS_DEADDIR(dir))
- return -ENOENT;
-- return permission(dir,MAY_WRITE | MAY_EXEC, nd);
-+ return permission(dir, MAY_WRITE | MAY_EXEC, nd, NULL);
- }
-
- /*
-@@ -1294,7 +1368,7 @@ int may_open(struct nameidata *nd, int a
- if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
- return -EISDIR;
-
-- error = permission(inode, acc_mode, nd);
-+ error = permission(inode, acc_mode, nd, NULL);
- if (error)
- return error;
-
-@@ -1642,6 +1716,7 @@ out:
-
- return error;
- }
-+EXPORT_SYMBOL(sys_mknod);
-
- int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
- {
-@@ -1698,6 +1773,7 @@ out:
-
- return error;
- }
-+EXPORT_SYMBOL(sys_mkdir);
-
- /*
- * We try to drop the dentry early: we should have
-@@ -1717,17 +1793,13 @@ out:
- void dentry_unhash(struct dentry *dentry)
- {
- dget(dentry);
-- spin_lock(&dcache_lock);
-- switch (atomic_read(&dentry->d_count)) {
-- default:
-- spin_unlock(&dcache_lock);
-+ if (atomic_read(&dentry->d_count))
- shrink_dcache_parent(dentry);
-- spin_lock(&dcache_lock);
-- if (atomic_read(&dentry->d_count) != 2)
-- break;
-- case 2:
-+ spin_lock(&dcache_lock);
-+ spin_lock(&dentry->d_lock);
-+ if (atomic_read(&dentry->d_count) == 2)
- __d_drop(dentry);
-- }
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
- }
-
-@@ -1805,6 +1877,7 @@ exit:
- putname(name);
- return error;
- }
-+EXPORT_SYMBOL(sys_rmdir);
-
- int vfs_unlink(struct inode *dir, struct dentry *dentry)
- {
-@@ -1888,6 +1961,7 @@ slashes:
- S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
- goto exit2;
- }
-+EXPORT_SYMBOL(sys_unlink);
-
- int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
- {
-@@ -1945,6 +2019,7 @@ out:
- putname(from);
- return error;
- }
-+EXPORT_SYMBOL(sys_symlink);
-
- int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
- {
-@@ -2076,7 +2151,7 @@ int vfs_rename_dir(struct inode *old_dir
- * we'll need to flip '..'.
- */
- if (new_dir != old_dir) {
-- error = permission(old_dentry->d_inode, MAY_WRITE, NULL);
-+ error = permission(old_dentry->d_inode, MAY_WRITE, NULL, NULL);
- if (error)
- return error;
- }
-@@ -2148,6 +2223,9 @@ int vfs_rename(struct inode *old_dir, st
- int error;
- int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
-
-+ if (DQUOT_RENAME(old_dentry->d_inode, old_dir, new_dir))
-+ return -EXDEV;
-+
- if (old_dentry->d_inode == new_dentry->d_inode)
- return 0;
-
-@@ -2277,6 +2355,7 @@ asmlinkage long sys_rename(const char __
- putname(from);
- return error;
- }
-+EXPORT_SYMBOL(sys_rename);
-
- int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link)
- {
-@@ -2374,13 +2453,16 @@ void page_put_link(struct dentry *dentry
- }
- }
-
--int page_symlink(struct inode *inode, const char *symname, int len)
-+int page_symlink(struct inode *inode, const char *symname, int len,
-+ int gfp_mask)
- {
- struct address_space *mapping = inode->i_mapping;
-- struct page *page = grab_cache_page(mapping, 0);
-+ struct page *page;
- int err = -ENOMEM;
- char *kaddr;
-
-+ page = find_or_create_page(mapping, 0,
-+ mapping_gfp_mask(mapping) | gfp_mask);
- if (!page)
- goto fail;
- err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/namespace.c linux-2.6.9-ve023stab030/fs/namespace.c
---- linux-2.6.9-42.0.3.EL.orig/fs/namespace.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/namespace.c 2006-10-11 19:08:02.000000000 +0400
-@@ -37,6 +37,7 @@ static inline int sysfs_init(void)
-
- /* spinlock for vfsmount related operations, inplace of dcache_lock */
- spinlock_t vfsmount_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
-+EXPORT_SYMBOL(vfsmount_lock);
-
- static struct list_head *mount_hashtable;
- static int hash_mask, hash_bits;
-@@ -238,10 +239,32 @@ static int show_vfsmnt(struct seq_file *
- { 0, NULL }
- };
- struct proc_fs_info *fs_infop;
-+ char *path_buf, *path;
-
-- mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
-+ /* skip FS_NOMOUNT mounts (rootfs) */
-+ if (mnt->mnt_sb->s_flags & MS_NOUSER)
-+ return 0;
-+
-+ path_buf = (char *) __get_free_page(GFP_KERNEL);
-+ if (!path_buf)
-+ return -ENOMEM;
-+ path = d_path(mnt->mnt_root, mnt, path_buf, PAGE_SIZE);
-+ if (IS_ERR(path)) {
-+ free_page((unsigned long) path_buf);
-+ /*
-+ * This means that the file position will be incremented, i.e.
-+ * the total number of "invisible" vfsmnt will leak.
-+ */
-+ return 0;
-+ }
-+
-+ if (ve_is_super(get_exec_env()))
-+ mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
-+ else
-+ mangle(m, mnt->mnt_sb->s_type->name);
- seq_putc(m, ' ');
-- seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
-+ mangle(m, path);
-+ free_page((unsigned long) path_buf);
- seq_putc(m, ' ');
- mangle(m, mnt->mnt_sb->s_type->name);
- seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
-@@ -364,6 +387,7 @@ void umount_tree(struct vfsmount *mnt)
- spin_lock(&vfsmount_lock);
- }
- }
-+EXPORT_SYMBOL(umount_tree);
-
- static int do_umount(struct vfsmount *mnt, int flags)
- {
-@@ -480,7 +504,7 @@ asmlinkage long sys_umount(char __user *
- goto dput_and_out;
-
- retval = -EPERM;
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- goto dput_and_out;
-
- retval = do_umount(nd.mnt, flags);
-@@ -505,7 +529,7 @@ asmlinkage long sys_oldumount(char __use
-
- static int mount_is_safe(struct nameidata *nd)
- {
-- if (capable(CAP_SYS_ADMIN))
-+ if (capable(CAP_VE_SYS_ADMIN))
- return 0;
- return -EPERM;
- #ifdef notyet
-@@ -515,7 +539,7 @@ static int mount_is_safe(struct nameidat
- if (current->uid != nd->dentry->d_inode->i_uid)
- return -EPERM;
- }
-- if (permission(nd->dentry->d_inode, MAY_WRITE, nd))
-+ if (permission(nd->dentry->d_inode, MAY_WRITE, nd, NULL))
- return -EPERM;
- return 0;
- #endif
-@@ -618,7 +642,8 @@ out_unlock:
- /*
- * do loopback mount.
- */
--static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
-+static int do_loopback(struct nameidata *nd, char *old_name, int recurse,
-+ int mnt_flags)
- {
- struct nameidata old_nd;
- struct vfsmount *mnt = NULL;
-@@ -642,6 +667,7 @@ static int do_loopback(struct nameidata
- }
-
- if (mnt) {
-+ mnt->mnt_flags |= mnt_flags;
- /* stop bind mounts from expiring */
- spin_lock(&vfsmount_lock);
- list_del_init(&mnt->mnt_fslink);
-@@ -672,8 +698,9 @@ static int do_remount(struct nameidata *
- {
- int err;
- struct super_block * sb = nd->mnt->mnt_sb;
-+ int bind = 0;
-
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
-
- if (!check_mnt(nd->mnt))
-@@ -682,12 +709,19 @@ static int do_remount(struct nameidata *
- if (nd->dentry != nd->mnt->mnt_root)
- return -EINVAL;
-
-+ /* do not allow to remount bind-mounts with another mountpoint flags */
-+ if (nd->dentry != sb->s_root) {
-+ if ((flags & ~(MS_BIND|MS_POSIXACL|MS_NOUSER)) != 0)
-+ return -EINVAL;
-+ bind = 1;
-+ }
-+
- down_write(&sb->s_umount);
-- err = do_remount_sb(sb, flags, data, 0);
-+ err = bind ? 0 : do_remount_sb(sb, flags, data, 0);
- if (!err)
- nd->mnt->mnt_flags=mnt_flags;
- up_write(&sb->s_umount);
-- if (!err)
-+ if (!err && !bind)
- security_sb_post_remount(nd->mnt, flags, data);
- return err;
- }
-@@ -697,7 +731,7 @@ static int do_move_mount(struct nameidat
- struct nameidata old_nd, parent_nd;
- struct vfsmount *p;
- int err = 0;
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
- if (!old_name || !*old_name)
- return -EINVAL;
-@@ -764,15 +798,20 @@ static int do_new_mount(struct nameidata
- int mnt_flags, char *name, void *data)
- {
- struct vfsmount *mnt;
-+ struct file_system_type *fstype;
-
- if (!type || !memchr(type, 0, PAGE_SIZE))
- return -EINVAL;
-
- /* we need capabilities... */
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
-
-- mnt = do_kern_mount(type, flags, name, data);
-+ fstype = get_fs_type(type);
-+ if (fstype == NULL)
-+ return -ENODEV;
-+ mnt = do_kern_mount(fstype, flags, name, data);
-+ put_filesystem(fstype);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
-
-@@ -809,6 +848,10 @@ int do_add_mount(struct vfsmount *newmnt
- newmnt->mnt_flags = mnt_flags;
- err = graft_tree(newmnt, nd);
-
-+ if (newmnt->mnt_mountpoint->d_flags & DCACHE_VIRTUAL)
-+ /* unaccessible yet - no lock */
-+ newmnt->mnt_root->d_flags |= DCACHE_VIRTUAL;
-+
- if (err == 0 && fslist) {
- /* add to the specified expiration list */
- spin_lock(&vfsmount_lock);
-@@ -1048,7 +1091,7 @@ long do_mount(char * dev_name, char * di
- retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
- data_page);
- else if (flags & MS_BIND)
-- retval = do_loopback(&nd, dev_name, flags & MS_REC);
-+ retval = do_loopback(&nd, dev_name, flags & MS_REC, mnt_flags);
- else if (flags & MS_MOVE)
- retval = do_move_mount(&nd, dev_name);
- else
-@@ -1186,6 +1229,7 @@ out1:
- free_page(type_page);
- return retval;
- }
-+EXPORT_SYMBOL(sys_mount);
-
- /*
- * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
-@@ -1238,7 +1282,7 @@ static void chroot_fs_refs(struct nameid
- struct fs_struct *fs;
-
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_ve(g, p) {
- task_lock(p);
- fs = p->fs;
- if (fs) {
-@@ -1251,7 +1295,7 @@ static void chroot_fs_refs(struct nameid
- put_fs_struct(fs);
- } else
- task_unlock(p);
-- } while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- read_unlock(&tasklist_lock);
- }
-
-@@ -1364,8 +1408,13 @@ static void __init init_mount_tree(void)
- struct vfsmount *mnt;
- struct namespace *namespace;
- struct task_struct *g, *p;
-+ struct file_system_type *fstype;
-
-- mnt = do_kern_mount("rootfs", 0, "rootfs", NULL);
-+ fstype = get_fs_type("rootfs");
-+ if (fstype == NULL)
-+ panic("Can't create rootfs");
-+ mnt = do_kern_mount(fstype, 0, "rootfs", NULL);
-+ put_filesystem(fstype);
- if (IS_ERR(mnt))
- panic("Can't create rootfs");
- namespace = kmalloc(sizeof(*namespace), GFP_KERNEL);
-@@ -1380,10 +1429,10 @@ static void __init init_mount_tree(void)
-
- init_task.namespace = namespace;
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_all(g, p) {
- get_namespace(namespace);
- p->namespace = namespace;
-- } while_each_thread(g, p);
-+ } while_each_thread_all(g, p);
- read_unlock(&tasklist_lock);
-
- set_fs_pwd(current->fs, namespace->root, namespace->root->mnt_root);
-@@ -1398,7 +1447,7 @@ void __init mnt_init(unsigned long mempa
- int i;
-
- mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount),
-- 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
-
- order = 0;
- mount_hashtable = (struct list_head *)
-@@ -1458,3 +1507,4 @@ void __put_namespace(struct namespace *n
- up_write(&namespace->sem);
- kfree(namespace);
- }
-+EXPORT_SYMBOL(__put_namespace);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ncpfs/ioctl.c linux-2.6.9-ve023stab030/fs/ncpfs/ioctl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ncpfs/ioctl.c 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ncpfs/ioctl.c 2006-10-11 19:07:55.000000000 +0400
-@@ -34,7 +34,7 @@ ncp_get_fs_info(struct ncp_server* serve
- {
- struct ncp_fs_info info;
-
-- if ((permission(inode, MAY_WRITE, NULL) != 0)
-+ if ((permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid)) {
- return -EACCES;
- }
-@@ -62,7 +62,7 @@ ncp_get_fs_info_v2(struct ncp_server* se
- {
- struct ncp_fs_info_v2 info2;
-
-- if ((permission(inode, MAY_WRITE, NULL) != 0)
-+ if ((permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid)) {
- return -EACCES;
- }
-@@ -190,7 +190,7 @@ int ncp_ioctl(struct inode *inode, struc
- switch (cmd) {
- case NCP_IOC_NCPREQUEST:
-
-- if ((permission(inode, MAY_WRITE, NULL) != 0)
-+ if ((permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid)) {
- return -EACCES;
- }
-@@ -254,7 +254,7 @@ int ncp_ioctl(struct inode *inode, struc
- {
- unsigned long tmp = server->m.mounted_uid;
-
-- if ( (permission(inode, MAY_READ, NULL) != 0)
-+ if ( (permission(inode, MAY_READ, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -268,7 +268,7 @@ int ncp_ioctl(struct inode *inode, struc
- {
- struct ncp_setroot_ioctl sr;
-
-- if ( (permission(inode, MAY_READ, NULL) != 0)
-+ if ( (permission(inode, MAY_READ, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -343,7 +343,7 @@ int ncp_ioctl(struct inode *inode, struc
-
- #ifdef CONFIG_NCPFS_PACKET_SIGNING
- case NCP_IOC_SIGN_INIT:
-- if ((permission(inode, MAY_WRITE, NULL) != 0)
-+ if ((permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -366,7 +366,7 @@ int ncp_ioctl(struct inode *inode, struc
- return 0;
-
- case NCP_IOC_SIGN_WANTED:
-- if ( (permission(inode, MAY_READ, NULL) != 0)
-+ if ( (permission(inode, MAY_READ, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -379,7 +379,7 @@ int ncp_ioctl(struct inode *inode, struc
- {
- int newstate;
-
-- if ( (permission(inode, MAY_WRITE, NULL) != 0)
-+ if ( (permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -400,7 +400,7 @@ int ncp_ioctl(struct inode *inode, struc
-
- #ifdef CONFIG_NCPFS_IOCTL_LOCKING
- case NCP_IOC_LOCKUNLOCK:
-- if ( (permission(inode, MAY_WRITE, NULL) != 0)
-+ if ( (permission(inode, MAY_WRITE, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid))
- {
- return -EACCES;
-@@ -605,7 +605,7 @@ outrel:
- #endif /* CONFIG_NCPFS_NLS */
-
- case NCP_IOC_SETDENTRYTTL:
-- if ((permission(inode, MAY_WRITE, NULL) != 0) &&
-+ if ((permission(inode, MAY_WRITE, NULL, NULL) != 0) &&
- (current->uid != server->m.mounted_uid))
- return -EACCES;
- {
-@@ -635,7 +635,7 @@ outrel:
- so we have this out of switch */
- if (cmd == NCP_IOC_GETMOUNTUID) {
- __kernel_uid_t uid = 0;
-- if ((permission(inode, MAY_READ, NULL) != 0)
-+ if ((permission(inode, MAY_READ, NULL, NULL) != 0)
- && (current->uid != server->m.mounted_uid)) {
- return -EACCES;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfs/dir.c linux-2.6.9-ve023stab030/fs/nfs/dir.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfs/dir.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfs/dir.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1709,7 +1709,8 @@ out:
- return -EACCES;
- }
-
--int nfs_permission(struct inode *inode, int mask, struct nameidata *nd)
-+int nfs_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- struct rpc_cred *cred;
- int mode = inode->i_mode;
-@@ -1750,6 +1751,7 @@ int nfs_permission(struct inode *inode,
- if (!NFS_PROTO(inode)->access)
- goto out_notsup;
-
-+ /* Can NFS fill exec_perm atomically? Don't know... --SAW */
- cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
- res = nfs_do_access(inode, cred, mask);
- put_rpccred(cred);
-@@ -1758,7 +1760,7 @@ int nfs_permission(struct inode *inode,
- out_notsup:
- res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
- if (res == 0)
-- res = vfs_permission(inode, mask);
-+ res = vfs_permission(inode, mask, exec_perm);
- unlock_kernel();
- return res;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfs/direct.c linux-2.6.9-ve023stab030/fs/nfs/direct.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfs/direct.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfs/direct.c 2006-10-11 19:07:57.000000000 +0400
-@@ -56,6 +56,7 @@
- #include <asm/atomic.h>
-
- #define NFSDBG_FACILITY NFSDBG_VFS
-+#define MAX_DIRECTIO_SIZE (4096UL << PAGE_SHIFT)
-
- static void nfs_free_user_pages(struct page **pages, int npages, int do_dirty);
- static kmem_cache_t *nfs_direct_cachep;
-@@ -111,6 +112,11 @@ static inline int nfs_get_user_pages(int
- unsigned long page_count;
- size_t array_size;
-
-+ if (size > MAX_DIRECTIO_SIZE) {
-+ *pages = NULL;
-+ return -EFBIG;
-+ }
-+
- page_count = (user_addr + size + PAGE_SIZE - 1) >> PAGE_SHIFT;
- page_count -= user_addr >> PAGE_SHIFT;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfs/nfsroot.c linux-2.6.9-ve023stab030/fs/nfs/nfsroot.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfs/nfsroot.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfs/nfsroot.c 2006-10-11 19:07:57.000000000 +0400
-@@ -314,7 +314,7 @@ static int __init root_nfs_name(char *na
- /* Override them by options set on kernel command-line */
- root_nfs_parse(name, buf);
-
-- cp = system_utsname.nodename;
-+ cp = ve_utsname.nodename;
- if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) {
- printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
- return -1;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfsctl.c linux-2.6.9-ve023stab030/fs/nfsctl.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfsctl.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfsctl.c 2006-10-11 19:07:57.000000000 +0400
-@@ -23,8 +23,14 @@ static struct file *do_open(char *name,
- {
- struct nameidata nd;
- int error;
-+ struct file_system_type *fstype;
-
-- nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
-+ fstype = get_fs_type("nfsd");
-+ if (fstype == NULL)
-+ return ERR_PTR(-ENODEV);
-+
-+ nd.mnt = do_kern_mount(fstype, 0, "nfsd", NULL);
-+ put_filesystem(fstype);
-
- if (IS_ERR(nd.mnt))
- return (struct file *)nd.mnt;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfsd/nfsfh.c linux-2.6.9-ve023stab030/fs/nfsd/nfsfh.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfsd/nfsfh.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfsd/nfsfh.c 2006-10-11 19:07:55.000000000 +0400
-@@ -56,7 +56,7 @@ int nfsd_acceptable(void *expv, struct d
- /* make sure parents give x permission to user */
- int err;
- parent = dget_parent(tdentry);
-- err = permission(parent->d_inode, MAY_EXEC, NULL);
-+ err = permission(parent->d_inode, MAY_EXEC, NULL, NULL);
- if (err < 0) {
- dput(parent);
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/nfsd/vfs.c linux-2.6.9-ve023stab030/fs/nfsd/vfs.c
---- linux-2.6.9-42.0.3.EL.orig/fs/nfsd/vfs.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/nfsd/vfs.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1776,12 +1776,13 @@ nfsd_permission(struct svc_export *exp,
- inode->i_uid == current->fsuid)
- return 0;
-
-- err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), NULL);
-+ err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC),
-+ NULL, NULL);
-
- /* Allow read access to binaries even when mode 111 */
- if (err == -EACCES && S_ISREG(inode->i_mode) &&
- acc == (MAY_READ | MAY_OWNER_OVERRIDE))
-- err = permission(inode, MAY_EXEC, NULL);
-+ err = permission(inode, MAY_EXEC, NULL, NULL);
-
- return err? nfserrno(err) : 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ntfs/super.c linux-2.6.9-ve023stab030/fs/ntfs/super.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ntfs/super.c 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ntfs/super.c 2006-10-11 19:07:55.000000000 +0400
-@@ -2528,7 +2528,7 @@ iput_tmp_ino_err_out_now:
- * method again... FIXME: Do we need to do this twice now because of
- * attribute inodes? I think not, so leave as is for now... (AIA)
- */
-- if (invalidate_inodes(sb)) {
-+ if (invalidate_inodes(sb, 0)) {
- ntfs_error(sb, "Busy inodes left. This is most likely a NTFS "
- "driver bug.");
- /* Copied from fs/super.c. I just love this message. (-; */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/open.c linux-2.6.9-ve023stab030/fs/open.c
---- linux-2.6.9-42.0.3.EL.orig/fs/open.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/open.c 2006-10-11 19:07:59.000000000 +0400
-@@ -23,6 +23,7 @@
- #include <linux/fs.h>
- #include <linux/pagemap.h>
- #include <linux/audit.h>
-+#include <linux/faudit.h>
-
- #include <asm/unistd.h>
-
-@@ -47,7 +48,21 @@ int vfs_statfs(struct super_block *sb, s
-
- EXPORT_SYMBOL(vfs_statfs);
-
--static int vfs_statfs_native(struct super_block *sb, struct statfs *buf)
-+int faudit_statfs(struct super_block *sb, struct kstatfs *buf)
-+{
-+ struct faudit_statfs_arg arg;
-+
-+ arg.sb = sb;
-+ arg.stat = buf;
-+
-+ if (virtinfo_notifier_call(VITYPE_FAUDIT, VIRTINFO_FAUDIT_STATFS, &arg)
-+ != NOTIFY_DONE)
-+ return arg.err;
-+ return 0;
-+}
-+
-+static int vfs_statfs_native(struct super_block *sb, struct vfsmount *mnt,
-+ struct statfs *buf)
- {
- struct kstatfs st;
- int retval;
-@@ -56,6 +71,10 @@ static int vfs_statfs_native(struct supe
- if (retval)
- return retval;
-
-+ retval = faudit_statfs(mnt->mnt_sb, &st);
-+ if (retval)
-+ return retval;
-+
- if (sizeof(*buf) == sizeof(st))
- memcpy(buf, &st, sizeof(st));
- else {
-@@ -90,7 +109,8 @@ static int vfs_statfs_native(struct supe
- return 0;
- }
-
--static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf)
-+static int vfs_statfs64(struct super_block *sb, struct vfsmount *mnt,
-+ struct statfs64 *buf)
- {
- struct kstatfs st;
- int retval;
-@@ -99,6 +119,10 @@ static int vfs_statfs64(struct super_blo
- if (retval)
- return retval;
-
-+ retval = faudit_statfs(mnt->mnt_sb, &st);
-+ if (retval)
-+ return retval;
-+
- if (sizeof(*buf) == sizeof(st))
- memcpy(buf, &st, sizeof(st));
- else {
-@@ -125,7 +149,8 @@ asmlinkage long sys_statfs(const char __
- error = user_path_walk(path, &nd);
- if (!error) {
- struct statfs tmp;
-- error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp);
-+ error = vfs_statfs_native(nd.dentry->d_inode->i_sb,
-+ nd.mnt, &tmp);
- if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
- error = -EFAULT;
- path_release(&nd);
-@@ -144,7 +169,8 @@ asmlinkage long sys_statfs64(const char
- error = user_path_walk(path, &nd);
- if (!error) {
- struct statfs64 tmp;
-- error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp);
-+ error = vfs_statfs64(nd.dentry->d_inode->i_sb,
-+ nd.mnt, &tmp);
- if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
- error = -EFAULT;
- path_release(&nd);
-@@ -163,7 +189,8 @@ asmlinkage long sys_fstatfs(unsigned int
- file = fget(fd);
- if (!file)
- goto out;
-- error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp);
-+ error = vfs_statfs_native(file->f_dentry->d_inode->i_sb,
-+ file->f_vfsmnt, &tmp);
- if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
- error = -EFAULT;
- fput(file);
-@@ -184,7 +211,8 @@ asmlinkage long sys_fstatfs64(unsigned i
- file = fget(fd);
- if (!file)
- goto out;
-- error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp);
-+ error = vfs_statfs64(file->f_dentry->d_inode->i_sb,
-+ file->f_vfsmnt, &tmp);
- if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
- error = -EFAULT;
- fput(file);
-@@ -235,7 +263,7 @@ static inline long do_sys_truncate(const
- if (!S_ISREG(inode->i_mode))
- goto dput_and_out;
-
-- error = permission(inode,MAY_WRITE,&nd);
-+ error = permission(inode,MAY_WRITE,&nd,NULL);
- if (error)
- goto dput_and_out;
-
-@@ -389,7 +417,7 @@ asmlinkage long sys_utime(char __user *
- goto dput_and_out;
-
- if (current->fsuid != inode->i_uid &&
-- (error = permission(inode,MAY_WRITE,&nd)) != 0)
-+ (error = permission(inode,MAY_WRITE,&nd,NULL)) != 0)
- goto dput_and_out;
- }
- down(&inode->i_sem);
-@@ -442,7 +470,7 @@ long do_utimes(char __user * filename, s
- goto dput_and_out;
-
- if (current->fsuid != inode->i_uid &&
-- (error = permission(inode,MAY_WRITE,&nd)) != 0)
-+ (error = permission(inode,MAY_WRITE,&nd,NULL)) != 0)
- goto dput_and_out;
- }
- down(&inode->i_sem);
-@@ -501,7 +529,7 @@ asmlinkage long sys_access(const char __
-
- res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
- if (!res) {
-- res = permission(nd.dentry->d_inode, mode, &nd);
-+ res = permission(nd.dentry->d_inode, mode, &nd, NULL);
- /* SuS v2 requires we report a read only fs too */
- if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
- && !special_file(nd.dentry->d_inode->i_mode))
-@@ -525,7 +553,7 @@ asmlinkage long sys_chdir(const char __u
- if (error)
- goto out;
-
-- error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
-+ error = permission(nd.dentry->d_inode,MAY_EXEC,&nd,NULL);
- if (error)
- goto dput_and_out;
-
-@@ -560,7 +588,7 @@ asmlinkage long sys_fchdir(unsigned int
- if (!S_ISDIR(inode->i_mode))
- goto out_putf;
-
-- error = permission(inode, MAY_EXEC, NULL);
-+ error = permission(inode, MAY_EXEC, NULL, NULL);
- if (!error)
- set_fs_pwd(current->fs, mnt, dentry);
- out_putf:
-@@ -578,7 +606,7 @@ asmlinkage long sys_chroot(const char __
- if (error)
- goto out;
-
-- error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
-+ error = permission(nd.dentry->d_inode,MAY_EXEC,&nd,NULL);
- if (error)
- goto dput_and_out;
-
-@@ -713,6 +741,7 @@ asmlinkage long sys_chown(const char __u
- }
- return error;
- }
-+EXPORT_SYMBOL(sys_chown);
-
- asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group)
- {
-@@ -807,6 +836,9 @@ static struct file *__dentry_open(struct
- struct inode *inode;
- int error;
-
-+ if (!capable(CAP_SYS_RAWIO))
-+ flags &= ~O_DIRECT;
-+
- f->f_flags = flags;
- f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
- inode = dentry->d_inode;
-@@ -1105,3 +1137,85 @@ int nonseekable_open(struct inode *inode
- }
-
- EXPORT_SYMBOL(nonseekable_open);
-+
-+asmlinkage long sys_lchmod(char __user * filename, mode_t mode)
-+{
-+ struct nameidata nd;
-+ struct inode * inode;
-+ int error;
-+ struct iattr newattrs;
-+
-+ error = user_path_walk_link(filename, &nd);
-+ if (error)
-+ goto out;
-+ inode = nd.dentry->d_inode;
-+
-+ error = -EROFS;
-+ if (IS_RDONLY(inode))
-+ goto dput_and_out;
-+
-+ /* NOTE: Don't forget that I_IMMUTABLE and I_APPEND
-+ * checks must be in notify change
-+ */
-+
-+ down(&inode->i_sem);
-+ if (mode == (mode_t) -1)
-+ mode = inode->i_mode;
-+ newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
-+ newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-+ error = notify_change(nd.dentry, &newattrs);
-+ up(&inode->i_sem);
-+
-+dput_and_out:
-+ path_release(&nd);
-+out:
-+ return error;
-+}
-+
-+asmlinkage long sys_lutime(char __user * filename,
-+ struct utimbuf __user * times)
-+{
-+ int error;
-+ struct nameidata nd;
-+ struct inode * inode;
-+ struct iattr newattrs;
-+
-+ error = user_path_walk_link(filename, &nd);
-+ if (error)
-+ goto out;
-+ inode = nd.dentry->d_inode;
-+
-+ error = -EROFS;
-+ if (IS_RDONLY(inode))
-+ goto dput_and_out;
-+
-+ /* NOTE: Don't forget that I_IMMUTABLE and I_APPEND
-+ * checks must be in notify change
-+ */
-+
-+ /* Don't worry, the checks are done in inode_change_ok() */
-+ newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME;
-+ if (times) {
-+ error = get_user(newattrs.ia_atime.tv_sec, &times->actime);
-+ newattrs.ia_atime.tv_nsec = 0;
-+ if (!error)
-+ error = get_user(newattrs.ia_mtime.tv_sec,
-+ &times->modtime);
-+ newattrs.ia_mtime.tv_nsec = 0;
-+ if (error)
-+ goto dput_and_out;
-+
-+ newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
-+ } else {
-+ if (current->fsuid != inode->i_uid &&
-+ (error = permission(inode, MAY_WRITE, NULL, NULL)) != 0)
-+ goto dput_and_out;
-+ }
-+ down(&inode->i_sem);
-+ error = notify_change(nd.dentry, &newattrs);
-+ up(&inode->i_sem);
-+dput_and_out:
-+ path_release(&nd);
-+out:
-+ return error;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/partitions/check.c linux-2.6.9-ve023stab030/fs/partitions/check.c
---- linux-2.6.9-42.0.3.EL.orig/fs/partitions/check.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/partitions/check.c 2006-10-11 19:07:57.000000000 +0400
-@@ -127,6 +127,7 @@ char *disk_name(struct gendisk *hd, int
-
- return buf;
- }
-+EXPORT_SYMBOL(disk_name);
-
- const char *bdevname(struct block_device *bdev, char *buf)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/pipe.c linux-2.6.9-ve023stab030/fs/pipe.c
---- linux-2.6.9-42.0.3.EL.orig/fs/pipe.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/pipe.c 2006-10-11 19:07:56.000000000 +0400
-@@ -534,7 +534,7 @@ struct inode* pipe_new(struct inode* ino
- {
- unsigned long page;
-
-- page = __get_free_page(GFP_USER);
-+ page = __get_free_page(GFP_USER_UBC);
- if (!page)
- return NULL;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/array.c linux-2.6.9-ve023stab030/fs/proc/array.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/array.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/array.c 2006-10-11 19:07:58.000000000 +0400
-@@ -62,6 +62,7 @@
- #include <linux/string.h>
- #include <linux/mman.h>
- #include <linux/proc_fs.h>
-+#include <linux/fairsched.h>
- #include <linux/ioport.h>
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
-@@ -73,6 +74,7 @@
- #include <linux/highmem.h>
- #include <linux/file.h>
- #include <linux/times.h>
-+#include <ub/beancounter.h>
-
- #include <asm/uaccess.h>
- #include <asm/pgtable.h>
-@@ -157,8 +159,13 @@ static inline char * task_state(struct t
- {
- struct group_info *group_info;
- int g;
-+ pid_t pid, ppid, tgid;
-+
-+ pid = get_task_pid(p);
-+ tgid = get_task_tgid(p);
-
- read_lock(&tasklist_lock);
-+ ppid = get_task_ppid(p);
- buffer += sprintf(buffer,
- "State:\t%s\n"
- "SleepAVG:\t%lu%%\n"
-@@ -166,13 +173,19 @@ static inline char * task_state(struct t
- "Pid:\t%d\n"
- "PPid:\t%d\n"
- "TracerPid:\t%d\n"
-+#ifdef CONFIG_FAIRSCHED
-+ "FNid:\t%d\n"
-+#endif
- "Uid:\t%d\t%d\t%d\t%d\n"
- "Gid:\t%d\t%d\t%d\t%d\n",
- get_task_state(p),
- (p->sleep_avg/1024)*100/(1020000000/1024),
-- p->tgid,
-- p->pid, pid_alive(p) ? p->group_leader->real_parent->tgid : 0,
-- pid_alive(p) && p->ptrace ? p->parent->pid : 0,
-+ tgid,
-+ pid, ppid,
-+ pid_alive(p) && p->ptrace ? get_task_pid(p->parent) : 0,
-+#ifdef CONFIG_FAIRSCHED
-+ task_fairsched_node_id(p),
-+#endif
- p->uid, p->euid, p->suid, p->fsuid,
- p->gid, p->egid, p->sgid, p->fsgid);
- read_unlock(&tasklist_lock);
-@@ -191,6 +204,20 @@ static inline char * task_state(struct t
- put_group_info(group_info);
-
- buffer += sprintf(buffer, "\n");
-+
-+#ifdef CONFIG_VE
-+ buffer += sprintf(buffer,
-+ "envID:\t%d\n"
-+ "VPid:\t%d\n"
-+ "PNState:\t%u\n"
-+ "StopState:\t%u\n"
-+ "SigSuspState:\t%u\n",
-+ VE_TASK_INFO(p)->owner_env->veid,
-+ virt_pid(p),
-+ p->pn_state,
-+ p->stopped_state,
-+ p->sigsuspend_state);
-+#endif
- return buffer;
- }
-
-@@ -236,7 +263,7 @@ static void collect_sigign_sigcatch(stru
-
- static inline char * task_sig(struct task_struct *p, char *buffer)
- {
-- sigset_t pending, shpending, blocked, ignored, caught;
-+ sigset_t pending, shpending, blocked, ignored, caught, saved;
- int num_threads = 0;
-
- sigemptyset(&pending);
-@@ -244,6 +271,7 @@ static inline char * task_sig(struct tas
- sigemptyset(&blocked);
- sigemptyset(&ignored);
- sigemptyset(&caught);
-+ sigemptyset(&saved);
-
- /* Gather all the data with the appropriate locks held */
- read_lock(&tasklist_lock);
-@@ -252,6 +280,7 @@ static inline char * task_sig(struct tas
- pending = p->pending.signal;
- shpending = p->signal->shared_pending.signal;
- blocked = p->blocked;
-+ saved = p->saved_sigset;
- collect_sigign_sigcatch(p, &ignored, &caught);
- num_threads = atomic_read(&p->signal->count);
- spin_unlock_irq(&p->sighand->siglock);
-@@ -266,6 +295,7 @@ static inline char * task_sig(struct tas
- buffer = render_sigset_t("SigBlk:\t", &blocked, buffer);
- buffer = render_sigset_t("SigIgn:\t", &ignored, buffer);
- buffer = render_sigset_t("SigCgt:\t", &caught, buffer);
-+ buffer = render_sigset_t("SigSvd:\t", &saved, buffer);
-
- return buffer;
- }
-@@ -280,6 +310,24 @@ static inline char *task_cap(struct task
- cap_t(p->cap_effective));
- }
-
-+#ifdef CONFIG_USER_RESOURCE
-+static inline char *task_show_ub(struct task_struct *p, char *buffer)
-+{
-+ char ub_info[64];
-+
-+ print_ub_uid(get_task_ub(p), ub_info, sizeof(ub_info));
-+ buffer += sprintf(buffer, "TaskUB:\t%s\n", ub_info);
-+ task_lock(p);
-+ if (p->mm != NULL)
-+ print_ub_uid(mm_ub(p->mm), ub_info, sizeof(ub_info));
-+ else
-+ strcpy(ub_info, "N/A");
-+ task_unlock(p);
-+ buffer += sprintf(buffer, "MMUB:\t%s\n", ub_info);
-+ return buffer;
-+}
-+#endif
-+
- int proc_pid_status(struct task_struct *task, char * buffer)
- {
- char * orig = buffer;
-@@ -297,6 +345,9 @@ int proc_pid_status(struct task_struct *
- #if defined(CONFIG_ARCH_S390)
- buffer = task_show_regs(task, buffer);
- #endif
-+#ifdef CONFIG_USER_RESOURCE
-+ buffer = task_show_ub(task, buffer);
-+#endif
- return buffer - orig;
- }
-
-@@ -316,6 +367,8 @@ static int do_task_stat(struct task_stru
- unsigned long min_flt = 0, maj_flt = 0, utime = 0, stime = 0;
- struct task_struct *t;
- char tcomm[sizeof(task->comm)];
-+ char mm_ub_info[64];
-+ char task_ub_info[64];
-
- state = *get_task_state(task);
- vsize = eip = esp = 0;
-@@ -352,11 +405,11 @@ static int do_task_stat(struct task_stru
- }
- if (task->signal) {
- if (task->signal->tty) {
-- tty_pgrp = task->signal->tty->pgrp;
-+ tty_pgrp = pid_type_to_vpid(PIDTYPE_PGID, task->signal->tty->pgrp);
- tty_nr = new_encode_dev(tty_devnum(task->signal->tty));
- }
-- pgid = process_group(task);
-- sid = task->signal->session;
-+ pgid = get_task_pgid(task);
-+ sid = get_task_sid(task);
- cmin_flt = task->signal->cmin_flt;
- cmaj_flt = task->signal->cmaj_flt;
- cutime = task->signal->cutime;
-@@ -368,7 +421,7 @@ static int do_task_stat(struct task_stru
- stime += task->signal->stime;
- }
- }
-- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
-+ ppid = get_task_ppid(task);
- read_unlock(&tasklist_lock);
-
- if ((!whole || num_threads<2) &&
-@@ -388,17 +441,34 @@ static int do_task_stat(struct task_stru
- priority = task_prio(task);
- nice = task_nice(task);
-
-+#ifndef CONFIG_VE
- /* Temporary variable needed for gcc-2.96 */
- /* convert timespec -> nsec*/
- start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC
- + task->start_time.tv_nsec;
- /* convert nsec -> ticks */
- start_time = nsec_to_clock_t(start_time);
-+#else
-+ start_time = ve_relative_clock(&task->start_time);
-+#endif
-+
-+#ifdef CONFIG_USER_RESOURCE
-+ print_ub_uid(get_task_ub(task), task_ub_info, sizeof(task_ub_info));
-+ if (mm != NULL)
-+ print_ub_uid(mm_ub(mm), mm_ub_info, sizeof(mm_ub_info));
-+ else
-+ strcpy(mm_ub_info, "N/A");
-+#else
-+ strcpy(task_ub_info, "0");
-+ strcpy(mm_ub_info, "0");
-+#endif
-
- res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
- %lu %lu %lu %lu %lu %lu %lu %ld %ld %d %lu %llu %lu %ld %lu %lu %lu %lu %lu \
--%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
-- task->pid,
-+%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu \
-+0 0 0 0 0 0 0 0 %d %u \
-+%s %s\n",
-+ get_task_pid(task),
- tcomm,
- state,
- ppid,
-@@ -442,7 +512,11 @@ static int do_task_stat(struct task_stru
- task->exit_signal,
- task_cpu(task),
- task->rt_priority,
-- task->policy);
-+ task->policy,
-+ virt_pid(task),
-+ VEID(VE_TASK_INFO(task)->owner_env),
-+ task_ub_info,
-+ mm_ub_info);
- if(mm)
- mmput(mm);
- return res;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/base.c linux-2.6.9-ve023stab030/fs/proc/base.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/base.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/base.c 2006-10-11 19:07:57.000000000 +0400
-@@ -213,22 +213,25 @@ static int proc_fd_link(struct inode *in
- struct files_struct *files;
- struct file *file;
- int fd = proc_type(inode) - PROC_TID_FD_DIR;
-+ int err = -ENOENT;
-
- files = get_files_struct(task);
- if (files) {
- spin_lock(&files->file_lock);
- file = fcheck_files(files, fd);
- if (file) {
-- *mnt = mntget(file->f_vfsmnt);
-- *dentry = dget(file->f_dentry);
-- spin_unlock(&files->file_lock);
-- put_files_struct(files);
-- return 0;
-+ if (d_root_check(file->f_dentry, file->f_vfsmnt)) {
-+ err = -EACCES;
-+ } else {
-+ *mnt = mntget(file->f_vfsmnt);
-+ *dentry = dget(file->f_dentry);
-+ err = 0;
-+ }
- }
- spin_unlock(&files->file_lock);
- put_files_struct(files);
- }
-- return -ENOENT;
-+ return err;
- }
-
- static int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
-@@ -245,13 +248,16 @@ static int proc_exe_link(struct inode *i
- while (vma) {
- if ((vma->vm_flags & VM_EXECUTABLE) &&
- vma->vm_file) {
-- *mnt = mntget(vma->vm_file->f_vfsmnt);
-- *dentry = dget(vma->vm_file->f_dentry);
-- result = 0;
-+ result = d_root_check(vma->vm_file->f_dentry,
-+ vma->vm_file->f_vfsmnt);
-+ if (!result) {
-+ *mnt = mntget(vma->vm_file->f_vfsmnt);
-+ *dentry = dget(vma->vm_file->f_dentry);
-+ }
- break;
- }
- vma = vma->vm_next;
-- }
-+ }
- up_read(&mm->mmap_sem);
- mmput(mm);
- out:
-@@ -269,10 +275,12 @@ static int proc_cwd_link(struct inode *i
- task_unlock(proc_task(inode));
- if (fs) {
- read_lock(&fs->lock);
-- *mnt = mntget(fs->pwdmnt);
-- *dentry = dget(fs->pwd);
-+ result = d_root_check(fs->pwd, fs->pwdmnt);
-+ if (!result) {
-+ *mnt = mntget(fs->pwdmnt);
-+ *dentry = dget(fs->pwd);
-+ }
- read_unlock(&fs->lock);
-- result = 0;
- put_fs_struct(fs);
- }
- return result;
-@@ -323,6 +331,11 @@ static int may_ptrace_attach(struct task
- rmb();
- if (task->mm->dumpable != 1 && !capable(CAP_SYS_PTRACE))
- goto out;
-+ if (task->mm->vps_dumpable != 1 && !ve_is_super(get_exec_env()))
-+ goto out;
-+ /* optional: defensive measure */
-+ if (!ve_accessible(VE_TASK_INFO(task)->owner_env, get_exec_env()))
-+ goto out;
- if (security_ptrace(current, task))
- goto out;
-
-@@ -484,9 +497,10 @@ out:
- goto exit;
- }
-
--static int proc_permission(struct inode *inode, int mask, struct nameidata *nd)
-+static int proc_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
-- if (vfs_permission(inode, mask) != 0)
-+ if (vfs_permission(inode, mask, exec_perm) != 0)
- return -EACCES;
- return proc_check_root(inode);
- }
-@@ -1014,6 +1028,10 @@ static struct inode *proc_pid_make_inode
- struct inode * inode;
- struct proc_inode *ei;
-
-+ if (!ve_accessible(VE_TASK_INFO(task)->owner_env,
-+ VE_OWNER_FSTYPE(sb->s_type)))
-+ return NULL;
-+
- /* We need a new inode */
-
- inode = new_inode(sb);
-@@ -1119,6 +1137,10 @@ static void pid_base_iput(struct dentry
- spin_lock(&task->proc_lock);
- if (task->proc_dentry == dentry)
- task->proc_dentry = NULL;
-+#ifdef CONFIG_VE
-+ if (VE_TASK_INFO(task)->glob_proc_dentry == dentry)
-+ VE_TASK_INFO(task)->glob_proc_dentry = NULL;
-+#endif
- spin_unlock(&task->proc_lock);
- iput(inode);
- }
-@@ -1557,14 +1579,14 @@ static int proc_self_readlink(struct den
- int buflen)
- {
- char tmp[30];
-- sprintf(tmp, "%d", current->tgid);
-+ sprintf(tmp, "%d", get_task_tgid(current));
- return vfs_readlink(dentry,buffer,buflen,tmp);
- }
-
- static int proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
- {
- char tmp[30];
-- sprintf(tmp, "%d", current->tgid);
-+ sprintf(tmp, "%d", get_task_tgid(current));
- return vfs_follow_link(nd,tmp);
- }
-
-@@ -1589,24 +1611,33 @@ static struct inode_operations proc_self
- * of PIDTYPE_PID.
- */
-
--struct dentry *proc_pid_unhash(struct task_struct *p)
-+struct dentry *__proc_pid_unhash(struct task_struct *p, struct dentry *proc_dentry)
- {
-- struct dentry *proc_dentry;
--
-- proc_dentry = p->proc_dentry;
- if (proc_dentry != NULL) {
-
- spin_lock(&dcache_lock);
-+ spin_lock(&proc_dentry->d_lock);
- if (!d_unhashed(proc_dentry)) {
- dget_locked(proc_dentry);
- __d_drop(proc_dentry);
-- } else
-+ spin_unlock(&proc_dentry->d_lock);
-+ } else {
-+ spin_unlock(&proc_dentry->d_lock);
- proc_dentry = NULL;
-+ }
- spin_unlock(&dcache_lock);
- }
- return proc_dentry;
- }
-
-+void proc_pid_unhash(struct task_struct *p, struct dentry *pd[2])
-+{
-+ pd[0] = __proc_pid_unhash(p, p->proc_dentry);
-+#ifdef CONFIG_VE
-+ pd[1] = __proc_pid_unhash(p, VE_TASK_INFO(p)->glob_proc_dentry);
-+#endif
-+}
-+
- /**
- * proc_pid_flush - recover memory used by stale /proc/<pid>/x entries
- * @proc_entry: directoy to prune.
-@@ -1614,7 +1645,7 @@ struct dentry *proc_pid_unhash(struct ta
- * Shrink the /proc directory that was used by the just killed thread.
- */
-
--void proc_pid_flush(struct dentry *proc_dentry)
-+void __proc_pid_flush(struct dentry *proc_dentry)
- {
- might_sleep();
- if(proc_dentry != NULL) {
-@@ -1623,12 +1654,21 @@ void proc_pid_flush(struct dentry *proc_
- }
- }
-
-+void proc_pid_flush(struct dentry *proc_dentry[2])
-+{
-+ __proc_pid_flush(proc_dentry[0]);
-+#ifdef CONFIG_VE
-+ __proc_pid_flush(proc_dentry[1]);
-+#endif
-+}
-+
- /* SMP-safe */
- struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
- {
- struct task_struct *task;
- struct inode *inode;
- struct proc_inode *ei;
-+ struct dentry *pd[2];
- unsigned tgid;
- int died;
-
-@@ -1652,7 +1692,19 @@ struct dentry *proc_pid_lookup(struct in
- goto out;
-
- read_lock(&tasklist_lock);
-- task = find_task_by_pid(tgid);
-+ task = find_task_by_pid_ve(tgid);
-+ /* In theory we are allowed to lookup both /proc/VIRT_PID and
-+ * /proc/GLOBAL_PID inside VE. However, current /proc implementation
-+ * cannot maintain two references to one task, so that we have
-+ * to prohibit /proc/GLOBAL_PID.
-+ */
-+ if (task && !ve_is_super(get_exec_env()) && !is_virtual_pid(tgid)) {
-+ /* However, VE_ENTERed tasks are exception, they use global
-+ * pids.
-+ */
-+ if (virt_pid(task) != tgid)
-+ task = NULL;
-+ }
- if (task)
- get_task_struct(task);
- read_unlock(&tasklist_lock);
-@@ -1677,16 +1729,23 @@ struct dentry *proc_pid_lookup(struct in
- died = 0;
- d_add(dentry, inode);
- spin_lock(&task->proc_lock);
-+#ifdef CONFIG_VE
-+ if (ve_is_super(VE_OWNER_FSTYPE(inode->i_sb->s_type)))
-+ VE_TASK_INFO(task)->glob_proc_dentry = dentry;
-+ else
-+ task->proc_dentry = dentry;
-+#else
- task->proc_dentry = dentry;
-+#endif
- if (!pid_alive(task)) {
-- dentry = proc_pid_unhash(task);
-+ proc_pid_unhash(task, pd);
- died = 1;
- }
- spin_unlock(&task->proc_lock);
-
- put_task_struct(task);
- if (died) {
-- proc_pid_flush(dentry);
-+ proc_pid_flush(pd);
- goto out;
- }
- return NULL;
-@@ -1707,7 +1766,12 @@ static struct dentry *proc_task_lookup(s
- goto out;
-
- read_lock(&tasklist_lock);
-- task = find_task_by_pid(tid);
-+ task = find_task_by_pid_ve(tid);
-+ /* See comment above in similar place. */
-+ if (task && !ve_is_super(get_exec_env()) && !is_virtual_pid(tid)) {
-+ if (virt_pid(task) != tid)
-+ task = NULL;
-+ }
- if (task)
- get_task_struct(task);
- read_unlock(&tasklist_lock);
-@@ -1747,27 +1811,35 @@ out:
- * tasklist lock while doing this, and we must release it before
- * we actually do the filldir itself, so we use a temp buffer..
- */
--static int get_tgid_list(int index, unsigned long version, unsigned int *tgids)
-+static int get_tgid_list(int index, unsigned long version, unsigned int *tgids,
-+ struct ve_struct *owner)
- {
- struct task_struct *p;
- int nr_tgids = 0;
-
- index--;
- read_lock(&tasklist_lock);
-+ if (list_empty(&owner->vetask_lh))
-+ goto out;
- p = NULL;
- if (version) {
-- p = find_task_by_pid(version);
-- if (p && !thread_group_leader(p))
-+ struct ve_struct *oldve;
-+
-+ oldve = set_exec_env(owner);
-+ p = find_task_by_pid_ve(version);
-+ (void)set_exec_env(oldve);
-+
-+ if (p != NULL && !thread_group_leader(p))
- p = NULL;
- }
-
- if (p)
- index = 0;
- else
-- p = next_task(&init_task);
-+ p = __first_task_ve(owner);
-
-- for ( ; p != &init_task; p = next_task(p)) {
-- int tgid = p->pid;
-+ for ( ; p != NULL; p = __next_task_ve(owner, p)) {
-+ int tgid = get_task_pid_ve(p, owner);
- if (!pid_alive(p))
- continue;
- if (--index >= 0)
-@@ -1777,6 +1849,7 @@ static int get_tgid_list(int index, unsi
- if (nr_tgids >= PROC_MAXPIDS)
- break;
- }
-+out:
- read_unlock(&tasklist_lock);
- return nr_tgids;
- }
-@@ -1800,7 +1873,7 @@ static int get_tid_list(int index, unsig
- * via next_thread().
- */
- if (pid_alive(task)) do {
-- int tid = task->pid;
-+ int tid = get_task_pid(task);
-
- if (--index >= 0)
- continue;
-@@ -1836,7 +1909,8 @@ int proc_pid_readdir(struct file * filp,
- next_tgid = filp->f_version;
- filp->f_version = 0;
- for (;;) {
-- nr_tgids = get_tgid_list(nr, next_tgid, tgid_array);
-+ nr_tgids = get_tgid_list(nr, next_tgid, tgid_array,
-+ VE_OWNER_FSTYPE(filp->f_dentry->d_sb->s_type));
- if (!nr_tgids) {
- /* no more entries ! */
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/generic.c linux-2.6.9-ve023stab030/fs/proc/generic.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/generic.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/generic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -10,7 +10,9 @@
-
- #include <linux/errno.h>
- #include <linux/time.h>
-+#include <linux/fs.h>
- #include <linux/proc_fs.h>
-+#include <linux/ve_owner.h>
- #include <linux/stat.h>
- #include <linux/module.h>
- #include <linux/mount.h>
-@@ -230,6 +232,7 @@ proc_file_lseek(struct file *file, loff_
- return retval;
- }
-
-+#ifndef CONFIG_VE
- static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
- {
- struct inode *inode = dentry->d_inode;
-@@ -250,9 +253,12 @@ static int proc_notify_change(struct den
- out:
- return error;
- }
-+#endif
-
- static struct inode_operations proc_file_inode_operations = {
-+#ifndef CONFIG_VE
- .setattr = proc_notify_change,
-+#endif
- };
-
- /*
-@@ -260,16 +266,21 @@ static struct inode_operations proc_file
- * returns the struct proc_dir_entry for "/proc/tty/driver", and
- * returns "serial" in residual.
- */
--static int xlate_proc_name(const char *name,
-- struct proc_dir_entry **ret, const char **residual)
-+static int __xlate_proc_name(struct proc_dir_entry *root, const char *name,
-+ struct proc_dir_entry **ret, const char **residual)
- {
- const char *cp = name, *next;
- struct proc_dir_entry *de;
- int len;
- int rtn = 0;
-
-+ if (*ret != NULL) {
-+ de_get(*ret);
-+ return 0;
-+ }
-+
- spin_lock(&proc_subdir_lock);
-- de = &proc_root;
-+ de = root;
- while (1) {
- next = strchr(cp, '/');
- if (!next)
-@@ -287,12 +298,29 @@ static int xlate_proc_name(const char *n
- cp += len + 1;
- }
- *residual = cp;
-- *ret = de;
-+ *ret = de_get(de);
- out:
- spin_unlock(&proc_subdir_lock);
- return rtn;
- }
-
-+#ifndef CONFIG_VE
-+#define xlate_proc_loc_name xlate_proc_name
-+#else
-+static int xlate_proc_loc_name(const char *name,
-+ struct proc_dir_entry **ret, const char **residual)
-+{
-+ return __xlate_proc_name(get_exec_env()->proc_root,
-+ name, ret, residual);
-+}
-+#endif
-+
-+static int xlate_proc_name(const char *name,
-+ struct proc_dir_entry **ret, const char **residual)
-+{
-+ return __xlate_proc_name(&proc_root, name, ret, residual);
-+}
-+
- static DEFINE_IDR(proc_inum_idr);
- static spinlock_t proc_inum_lock = SPIN_LOCK_UNLOCKED; /* protects the above */
-
-@@ -368,38 +396,107 @@ static struct dentry_operations proc_den
- * Don't create negative dentries here, return -ENOENT by hand
- * instead.
- */
-+
-+static inline struct proc_dir_entry *__proc_lookup(struct proc_dir_entry *de,
-+ struct dentry *d)
-+{
-+ for (de = de->subdir; de; de = de->next) {
-+ if (de->namelen != d->d_name.len)
-+ continue;
-+ if (!memcmp(d->d_name.name, de->name, de->namelen))
-+ break;
-+ }
-+ return de_get(de);
-+}
-+
- struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
- {
- struct inode *inode = NULL;
-- struct proc_dir_entry * de;
-+ struct proc_dir_entry *lde, *gde;
- int error = -ENOENT;
-
- lock_kernel();
-+ lde = LPDE(dir);
-+ if (!lde)
-+ goto out;
-+
- spin_lock(&proc_subdir_lock);
-- de = PDE(dir);
-- if (de) {
-- for (de = de->subdir; de ; de = de->next) {
-- if (de->namelen != dentry->d_name.len)
-- continue;
-- if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
-- unsigned int ino = de->low_ino;
-+ lde = __proc_lookup(lde, dentry);
-+#ifdef CONFIG_VE
-+ gde = GPDE(dir);
-+ if (gde)
-+ gde = __proc_lookup(gde, dentry);
-+#else
-+ gde = NULL;
-+#endif
-+ spin_unlock(&proc_subdir_lock);
-+ /*
-+ * There are following possible cases after lookup:
-+ *
-+ * lde gde
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ * NULL NULL ENOENT
-+ * loc NULL found in local tree
-+ * loc glob found in both trees
-+ * NULL glob found in global tree
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ *
-+ * We initialized inode as follows after lookup:
-+ *
-+ * inode->lde inode->gde
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ * loc NULL in local tree
-+ * loc glob both trees
-+ * glob glob global tree
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ * i.e. inode->lde is always initialized
-+ */
-
-- spin_unlock(&proc_subdir_lock);
-- error = -EINVAL;
-- inode = proc_get_inode(dir->i_sb, ino, de);
-- spin_lock(&proc_subdir_lock);
-- break;
-- }
-- }
-+ if (lde == NULL && gde == NULL)
-+ goto out;
-+
-+ if (lde != NULL) {
-+ inode = proc_get_inode(dir->i_sb, lde->low_ino, lde);
-+ } else {
-+ inode = proc_get_inode(dir->i_sb, gde->low_ino, gde);
- }
-- spin_unlock(&proc_subdir_lock);
-- unlock_kernel();
-
- if (inode) {
-+#ifdef CONFIG_VE
-+ GPDE(inode) = gde;
-+ if (gde) {
-+ de_get(gde);
-+ /* we have taken a ref in proc_get_inode() already */
-+ __module_get(gde->owner);
-+ }
-+ /* if dentry is found in both trees and it is a directory
-+ * then inode's nlink count must be altered, because local
-+ * and global subtrees may differ.
-+ * on the other hand, they may intersect, so actual nlink
-+ * value is difficult to calculate - upper estimate is used
-+ * instead of it.
-+ * dentry found in global tree only must not be writable
-+ * in non-super ve.
-+ */
-+ if (lde && gde && lde != gde && gde->nlink > 1)
-+ inode->i_nlink += gde->nlink - 2;
-+ if (lde == NULL && !ve_is_super(
-+ VE_OWNER_FSTYPE(dir->i_sb->s_type)))
-+ inode->i_mode &= ~S_IWUGO;
-+#endif
-+ unlock_kernel();
-+ de_put(lde);
-+ de_put(gde);
- dentry->d_op = &proc_dentry_operations;
- d_add(dentry, inode);
- return NULL;
- }
-+
-+ de_put(lde);
-+ de_put(gde);
-+
-+out:
-+ unlock_kernel();
- return ERR_PTR(error);
- }
-
-@@ -450,11 +547,8 @@ int proc_readdir(struct file * filp,
- de = de->subdir;
- i -= 2;
- for (;;) {
-- if (!de) {
-- ret = 1;
-- spin_unlock(&proc_subdir_lock);
-- goto out;
-- }
-+ if (!de)
-+ goto lookup_global;
- if (!i)
- break;
- de = de->next;
-@@ -462,20 +556,70 @@ int proc_readdir(struct file * filp,
- }
-
- do {
-+ struct proc_dir_entry *next;
- /* filldir passes info to user space */
-+ de_get(de);
- spin_unlock(&proc_subdir_lock);
- if (filldir(dirent, de->name, de->namelen, filp->f_pos,
-- de->low_ino, de->mode >> 12) < 0)
-+ de->low_ino, de->mode >> 12) < 0) {
-+ de_put(de);
- goto out;
-+ }
- spin_lock(&proc_subdir_lock);
- filp->f_pos++;
-- de = de->next;
-+ next = de->next;
-+ de_put(de);
-+ de = next;
- } while (de);
-+lookup_global:
-+#ifdef CONFIG_VE
-+ de = GPDE(inode);
-+ if (de == NULL)
-+ goto done;
-+
-+ de = de->subdir;
-+
-+ while (de) {
-+ struct proc_dir_entry *p;
-+
-+ /* check that we haven't filled this dir already */
-+ for (p = LPDE(inode)->subdir; p; p = p->next) {
-+ if (de->namelen != p->namelen)
-+ continue;
-+ if (!memcmp(de->name, p->name, p->namelen))
-+ break;
-+ }
-+ if (p) {
-+ de = de->next;
-+ continue;
-+ }
-+ /* skip first i entries */
-+ if (i > 0) {
-+ i--;
-+ de = de->next;
-+ continue;
-+ }
-+
-+ de_get(de);
-+ spin_unlock(&proc_subdir_lock);
-+ if (filldir(dirent, de->name, de->namelen, filp->f_pos,
-+ de->low_ino, de->mode >> 12) < 0) {
-+ de_put(de);
-+ goto out;
-+ }
-+ spin_lock(&proc_subdir_lock);
-+ filp->f_pos++;
-+ p = de->next;
-+ de_put(de);
-+ de = p;
-+ }
-+done:
-+#endif
- spin_unlock(&proc_subdir_lock);
- }
- ret = 1;
- out: unlock_kernel();
-- return ret;
-+ return ret;
- }
-
- /*
-@@ -493,7 +637,9 @@ static struct file_operations proc_dir_o
- */
- static struct inode_operations proc_dir_inode_operations = {
- .lookup = proc_lookup,
-+#ifndef CONFIG_VE
- .setattr = proc_notify_change,
-+#endif
- };
-
- static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp)
-@@ -506,8 +652,13 @@ static int proc_register(struct proc_dir
- dp->low_ino = i;
-
- spin_lock(&proc_subdir_lock);
-+ if (dir->deleted) {
-+ spin_unlock(&proc_subdir_lock);
-+ return -EINVAL;
-+ }
-+
- dp->next = dir->subdir;
-- dp->parent = dir;
-+ dp->parent = de_get(dir);
- dir->subdir = dp;
- spin_unlock(&proc_subdir_lock);
-
-@@ -571,12 +722,13 @@ static struct proc_dir_entry *proc_creat
- /* make sure name is valid */
- if (!name || !strlen(name)) goto out;
-
-- if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0)
-+ if (xlate_proc_loc_name(name, parent, &fn) != 0)
- goto out;
- len = strlen(fn);
-
- ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
-- if (!ent) goto out;
-+ if (!ent)
-+ goto out_put;
-
- memset(ent, 0, sizeof(struct proc_dir_entry));
- memcpy(((char *) ent) + sizeof(struct proc_dir_entry), fn, len + 1);
-@@ -584,8 +736,13 @@ static struct proc_dir_entry *proc_creat
- ent->namelen = len;
- ent->mode = mode;
- ent->nlink = nlink;
-- out:
-+ atomic_set(&ent->count, 1);
- return ent;
-+
-+out_put:
-+ de_put(*parent);
-+out:
-+ return NULL;
- }
-
- struct proc_dir_entry *proc_symlink(const char *name,
-@@ -609,6 +766,7 @@ struct proc_dir_entry *proc_symlink(cons
- kfree(ent);
- ent = NULL;
- }
-+ de_put(parent);
- }
- return ent;
- }
-@@ -627,6 +785,7 @@ struct proc_dir_entry *proc_mkdir_mode(c
- kfree(ent);
- ent = NULL;
- }
-+ de_put(parent);
- }
- return ent;
- }
-@@ -665,10 +824,27 @@ struct proc_dir_entry *create_proc_entry
- kfree(ent);
- ent = NULL;
- }
-+ de_put(parent);
- }
- return ent;
- }
-
-+struct proc_dir_entry *create_proc_glob_entry(const char *name, mode_t mode,
-+ struct proc_dir_entry *parent)
-+{
-+ const char *path;
-+ struct proc_dir_entry *ent;
-+
-+ path = name;
-+ if (xlate_proc_name(path, &parent, &name) != 0)
-+ return NULL;
-+
-+ ent = create_proc_entry(name, mode, parent);
-+ de_put(parent);
-+ return ent;
-+}
-+EXPORT_SYMBOL(create_proc_glob_entry);
-+
- void free_proc_entry(struct proc_dir_entry *de)
- {
- unsigned int ino = de->low_ino;
-@@ -687,17 +863,14 @@ void free_proc_entry(struct proc_dir_ent
- * Remove a /proc entry and free it if it's not currently in use.
- * If it is in use, we set the 'deleted' flag.
- */
--void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
-+static void __remove_proc_entry(const char *name, struct proc_dir_entry *parent)
- {
- struct proc_dir_entry **p;
- struct proc_dir_entry *de;
- const char *fn = name;
- int len;
-
-- if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
-- goto out;
- len = strlen(fn);
--
- spin_lock(&proc_subdir_lock);
- for (p = &parent->subdir; *p; p=&(*p)->next ) {
- if (!proc_match(len, fn, *p))
-@@ -705,21 +878,49 @@ void remove_proc_entry(const char *name,
- de = *p;
- *p = de->next;
- de->next = NULL;
-+ de_put(parent);
- if (S_ISDIR(de->mode))
- parent->nlink--;
- proc_kill_inodes(de);
- de->nlink = 0;
-- BUG_ON(de->subdir);
-- if (!atomic_read(&de->count))
-- free_proc_entry(de);
-- else {
-- de->deleted = 1;
-- printk("remove_proc_entry: %s/%s busy, count=%d\n",
-- parent->name, de->name, atomic_read(&de->count));
-- }
-+ WARN_ON(de->subdir);
-+ de->deleted = 1;
-+ de_put(de);
- break;
- }
- spin_unlock(&proc_subdir_lock);
--out:
- return;
- }
-+
-+void remove_proc_loc_entry(const char *name, struct proc_dir_entry *parent)
-+{
-+ const char *path;
-+
-+ path = name;
-+ if (xlate_proc_loc_name(path, &parent, &name))
-+ return;
-+
-+ __remove_proc_entry(name, parent);
-+ de_put(parent);
-+}
-+
-+void remove_proc_glob_entry(const char *name, struct proc_dir_entry *parent)
-+{
-+ const char *path;
-+
-+ path = name;
-+ if (xlate_proc_name(path, &parent, &name))
-+ return;
-+
-+ __remove_proc_entry(name, parent);
-+ de_put(parent);
-+}
-+
-+void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
-+{
-+ remove_proc_loc_entry(name, parent);
-+#ifdef CONFIG_VE
-+ if (ve_is_super(get_exec_env()))
-+ remove_proc_glob_entry(name, parent);
-+#endif
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/inode.c linux-2.6.9-ve023stab030/fs/proc/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/inode.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -8,6 +8,7 @@
- #include <linux/proc_fs.h>
- #include <linux/kernel.h>
- #include <linux/mm.h>
-+#include <linux/ve_owner.h>
- #include <linux/string.h>
- #include <linux/stat.h>
- #include <linux/file.h>
-@@ -22,34 +23,23 @@
-
- extern void free_proc_entry(struct proc_dir_entry *);
-
--static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de)
--{
-- if (de)
-- atomic_inc(&de->count);
-- return de;
--}
--
- /*
- * Decrements the use count and checks for deferred deletion.
- */
--static void de_put(struct proc_dir_entry *de)
-+void de_put(struct proc_dir_entry *de)
- {
- if (de) {
-- lock_kernel();
- if (!atomic_read(&de->count)) {
- printk("de_put: entry %s already free!\n", de->name);
-- unlock_kernel();
- return;
- }
-
- if (atomic_dec_and_test(&de->count)) {
-- if (de->deleted) {
-+ if (unlikely(!de->deleted))
- printk("de_put: deferred delete of %s\n",
-- de->name);
-- free_proc_entry(de);
-- }
-- }
-- unlock_kernel();
-+ de->name);
-+ free_proc_entry(de);
-+ }
- }
- }
-
-@@ -67,12 +57,19 @@ static void proc_delete_inode(struct ino
- put_task_struct(tsk);
-
- /* Let go of any associated proc directory entry */
-- de = PROC_I(inode)->pde;
-+ de = LPDE(inode);
- if (de) {
- if (de->owner)
- module_put(de->owner);
- de_put(de);
- }
-+#ifdef CONFIG_VE
-+ de = GPDE(inode);
-+ if (de) {
-+ module_put(de->owner);
-+ de_put(de);
-+ }
-+#endif
- clear_inode(inode);
- }
-
-@@ -99,6 +96,9 @@ static struct inode *proc_alloc_inode(st
- ei->pde = NULL;
- inode = &ei->vfs_inode;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-+#ifdef CONFIG_VE
-+ GPDE(inode) = NULL;
-+#endif
- return inode;
- }
-
-@@ -200,10 +200,13 @@ struct inode *proc_get_inode(struct supe
-
- WARN_ON(de && de->deleted);
-
-+ if (de != NULL && !try_module_get(de->owner))
-+ goto out_mod;
-+
- inode = iget(sb, ino);
- if (!inode)
-- goto out_fail;
--
-+ goto out_ino;
-+
- PROC_I(inode)->pde = de;
- if (de) {
- if (de->mode) {
-@@ -215,20 +218,20 @@ struct inode *proc_get_inode(struct supe
- inode->i_size = de->size;
- if (de->nlink)
- inode->i_nlink = de->nlink;
-- if (!try_module_get(de->owner))
-- goto out_fail;
- if (de->proc_iops)
- inode->i_op = de->proc_iops;
- if (de->proc_fops)
- inode->i_fop = de->proc_fops;
- }
-
--out:
- return inode;
-
--out_fail:
-+out_ino:
-+ if (de != NULL)
-+ module_put(de->owner);
-+out_mod:
- de_put(de);
-- goto out;
-+ return NULL;
- }
-
- int proc_fill_super(struct super_block *s, void *data, int silent)
-@@ -251,6 +254,14 @@ int proc_fill_super(struct super_block *
- s->s_root = d_alloc_root(root_inode);
- if (!s->s_root)
- goto out_no_root;
-+
-+#ifdef CONFIG_VE
-+ LPDE(root_inode) = de_get(get_exec_env()->proc_root);
-+ GPDE(root_inode) = &proc_root;
-+#else
-+ LPDE(root_inode) = &proc_root;
-+#endif
-+
- parse_options(data, &root_inode->i_uid, &root_inode->i_gid);
- return 0;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/kcore.c linux-2.6.9-ve023stab030/fs/proc/kcore.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/kcore.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/kcore.c 2006-10-11 19:07:56.000000000 +0400
-@@ -25,7 +25,7 @@
-
- static int open_kcore(struct inode * inode, struct file * filp)
- {
-- return -EPERM;
-+ return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
- }
-
- static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/kmsg.c linux-2.6.9-ve023stab030/fs/proc/kmsg.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/kmsg.c 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/kmsg.c 2006-10-11 19:07:57.000000000 +0400
-@@ -11,6 +11,7 @@
- #include <linux/kernel.h>
- #include <linux/poll.h>
- #include <linux/fs.h>
-+#include <linux/veprintk.h>
-
- #include <asm/uaccess.h>
- #include <asm/io.h>
-@@ -40,7 +41,7 @@ static ssize_t kmsg_read(struct file *fi
-
- static unsigned int kmsg_poll(struct file *file, poll_table *wait)
- {
-- poll_wait(file, &log_wait, wait);
-+ poll_wait(file, &ve_log_wait, wait);
- if (do_syslog(9, NULL, 0))
- return POLLIN | POLLRDNORM;
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/proc_misc.c linux-2.6.9-ve023stab030/fs/proc/proc_misc.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/proc_misc.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/proc_misc.c 2006-10-11 19:08:00.000000000 +0400
-@@ -31,6 +31,7 @@
- #include <linux/pagemap.h>
- #include <linux/swap.h>
- #include <linux/slab.h>
-+#include <linux/virtinfo.h>
- #include <linux/smp.h>
- #include <linux/signal.h>
- #include <linux/module.h>
-@@ -44,14 +45,17 @@
- #include <linux/jiffies.h>
- #include <linux/sysrq.h>
- #include <linux/vmalloc.h>
-+#include <linux/version.h>
-+#include <linux/compile.h>
- #include <asm/uaccess.h>
- #include <asm/pgtable.h>
- #include <asm/io.h>
- #include <asm/tlb.h>
- #include <asm/div64.h>
-+#ifdef CONFIG_FAIRSCHED
-+#include <linux/fairsched.h>
-+#endif
-
--#define LOAD_INT(x) ((x) >> FSHIFT)
--#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
- /*
- * Warning: stuff below (imported functions) assumes that its output will fit
- * into one page. For some of those functions it may be wrong. Moreover, we
-@@ -83,15 +87,33 @@ static int loadavg_read_proc(char *page,
- {
- int a, b, c;
- int len;
--
-- a = avenrun[0] + (FIXED_1/200);
-- b = avenrun[1] + (FIXED_1/200);
-- c = avenrun[2] + (FIXED_1/200);
-+ unsigned long __nr_running;
-+ int __nr_threads;
-+ unsigned long *__avenrun;
-+ struct ve_struct *ve;
-+
-+ ve = get_exec_env();
-+
-+ if (ve_is_super(ve)) {
-+ __avenrun = &avenrun[0];
-+ __nr_running = nr_running();
-+ __nr_threads = nr_threads;
-+ }
-+#ifdef CONFIG_VE
-+ else {
-+ __avenrun = &ve->avenrun[0];
-+ __nr_running = nr_running_ve(ve);
-+ __nr_threads = atomic_read(&ve->pcounter);
-+ }
-+#endif
-+ a = __avenrun[0] + (FIXED_1/200);
-+ b = __avenrun[1] + (FIXED_1/200);
-+ c = __avenrun[2] + (FIXED_1/200);
- len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
- LOAD_INT(a), LOAD_FRAC(a),
- LOAD_INT(b), LOAD_FRAC(b),
- LOAD_INT(c), LOAD_FRAC(c),
-- nr_running(), nr_threads, last_pid);
-+ __nr_running, __nr_threads, last_pid);
- return proc_calc_metrics(page, start, off, count, eof, len);
- }
-
-@@ -139,6 +161,13 @@ static int uptime_read_proc(char *page,
- u64 idle_jiffies = init_task.utime + init_task.stime;
-
- do_posix_clock_monotonic_gettime(&uptime);
-+#ifdef CONFIG_VE
-+ if (!ve_is_super(get_exec_env())) {
-+ set_normalized_timespec(&uptime,
-+ uptime.tv_sec - get_exec_env()->start_timespec.tv_sec,
-+ uptime.tv_nsec - get_exec_env()->start_timespec.tv_nsec);
-+ }
-+#endif
- jiffies_to_timespec(idle_jiffies, &idle);
- len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
- (unsigned long) uptime.tv_sec,
-@@ -152,34 +181,36 @@ static int uptime_read_proc(char *page,
- static int meminfo_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
- {
-- struct sysinfo i;
-+ struct meminfo mi;
- int len;
-- struct page_state ps;
-- unsigned long inactive;
-- unsigned long active;
-- unsigned long free;
-- unsigned long vmtot;
-- unsigned long committed;
-- unsigned long allowed;
-+ unsigned long dummy;
- struct vmalloc_info vmi;
-
-- get_page_state(&ps);
-- get_zone_counts(&active, &inactive, &free);
-+ get_page_state(&mi.ps);
-+ get_zone_counts(&mi.active, &mi.inactive, &dummy);
-
- /*
- * display in kilobytes.
- */
- #define K(x) ((x) << (PAGE_SHIFT - 10))
-- si_meminfo(&i);
-- si_swapinfo(&i);
-- committed = atomic_read(&vm_committed_space);
-- allowed = ((totalram_pages - hugetlb_total_pages())
-+ si_meminfo(&mi.si);
-+ si_swapinfo(&mi.si);
-+ mi.committed_space = atomic_read(&vm_committed_space);
-+ mi.allowed = ((totalram_pages - hugetlb_total_pages())
- * sysctl_overcommit_ratio / 100) + total_swap_pages;
-+ mi.swapcache = total_swapcache_pages;
-+ mi.cache = get_page_cache_size() - mi.swapcache - mi.si.bufferram;
-
-- vmtot = (VMALLOC_END-VMALLOC_START)>>10;
-+ mi.vmalloc_total = (VMALLOC_END - VMALLOC_START) >> PAGE_SHIFT;
- vmi = get_vmalloc_info();
-- vmi.used >>= 10;
-- vmi.largest_chunk >>= 10;
-+ mi.vmalloc_used = vmi.used >> PAGE_SHIFT;
-+ mi.vmalloc_largest = vmi.largest_chunk >> PAGE_SHIFT;
-+
-+#ifdef CONFIG_USER_RESOURCE
-+ if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_MEMINFO, &mi)
-+ & NOTIFY_FAIL)
-+ return -ENOMSG;
-+#endif
-
- /*
- * Tagged format, for easy grepping and expansion.
-@@ -208,32 +239,36 @@ static int meminfo_read_proc(char *page,
- "VmallocTotal: %8lu kB\n"
- "VmallocUsed: %8lu kB\n"
- "VmallocChunk: %8lu kB\n",
-- K(i.totalram),
-- K(i.freeram),
-- K(i.bufferram),
-- K(get_page_cache_size()-total_swapcache_pages-i.bufferram),
-- K(total_swapcache_pages),
-- K(active),
-- K(inactive),
-- K(i.totalhigh),
-- K(i.freehigh),
-- K(i.totalram-i.totalhigh),
-- K(i.freeram-i.freehigh),
-- K(i.totalswap),
-- K(i.freeswap),
-- K(ps.nr_dirty),
-- K(ps.nr_writeback),
-- K(ps.nr_mapped),
-- K(ps.nr_slab),
-- K(allowed),
-- K(committed),
-- K(ps.nr_page_table_pages),
-- vmtot,
-- vmi.used,
-- vmi.largest_chunk
-+ K(mi.si.totalram),
-+ K(mi.si.freeram),
-+ K(mi.si.bufferram),
-+ K(mi.cache),
-+ K(mi.swapcache),
-+ K(mi.active),
-+ K(mi.inactive),
-+ K(mi.si.totalhigh),
-+ K(mi.si.freehigh),
-+ K(mi.si.totalram-mi.si.totalhigh),
-+ K(mi.si.freeram-mi.si.freehigh),
-+ K(mi.si.totalswap),
-+ K(mi.si.freeswap),
-+ K(mi.ps.nr_dirty),
-+ K(mi.ps.nr_writeback),
-+ K(mi.ps.nr_mapped),
-+ K(mi.ps.nr_slab),
-+ K(mi.allowed),
-+ K(mi.committed_space),
-+ K(mi.ps.nr_page_table_pages),
-+ K(mi.vmalloc_total),
-+ K(mi.vmalloc_used),
-+ K(mi.vmalloc_largest)
- );
-
-+#ifdef CONFIG_HUGETLB_PAGE
-+#warning Virtualize hugetlb_report_meminfo
-+#else
- len += hugetlb_report_meminfo(page + len);
-+#endif
-
- return proc_calc_metrics(page, start, off, count, eof, len);
- #undef K
-@@ -258,8 +293,15 @@ static int version_read_proc(char *page,
- {
- extern char *linux_banner;
- int len;
-+ struct new_utsname *utsname = &ve_utsname;
-
-- strcpy(page, linux_banner);
-+ if (ve_is_super(get_exec_env()))
-+ strcpy(page, linux_banner);
-+ else
-+ sprintf(page, "Linux version %s ("
-+ LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") ("
-+ LINUX_COMPILER ") %s\n",
-+ utsname->release, utsname->version);
- len = strlen(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
- }
-@@ -415,21 +457,14 @@ static struct file_operations proc_slabi
- .release = seq_release,
- };
-
--int show_stat(struct seq_file *p, void *v)
-+static void show_stat_ve0(struct seq_file *p)
- {
-- int i;
-- extern unsigned long total_forks;
-- unsigned long jif;
-- u64 sum = 0, user = 0, nice = 0, system = 0,
-- idle = 0, iowait = 0, irq = 0, softirq = 0;
--
-- jif = - wall_to_monotonic.tv_sec;
-- if (wall_to_monotonic.tv_nsec)
-- --jif;
-+ int i, j;
-+ struct page_state page_state;
-+ u64 sum, user, nice, system, idle, iowait, irq, softirq;
-
-+ sum = user = nice = system = idle = iowait = irq = softirq = 0;
- for_each_cpu(i) {
-- int j;
--
- user += kstat_cpu(i).cpustat.user;
- nice += kstat_cpu(i).cpustat.nice;
- system += kstat_cpu(i).cpustat.system;
-@@ -449,8 +484,8 @@ int show_stat(struct seq_file *p, void *
- (unsigned long long)jiffies_64_to_clock_t(iowait),
- (unsigned long long)jiffies_64_to_clock_t(irq),
- (unsigned long long)jiffies_64_to_clock_t(softirq));
-- for_each_online_cpu(i) {
-
-+ for_each_online_cpu(i) {
- /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
- user = kstat_cpu(i).cpustat.user;
- nice = kstat_cpu(i).cpustat.nice;
-@@ -459,6 +494,7 @@ int show_stat(struct seq_file *p, void *
- iowait = kstat_cpu(i).cpustat.iowait;
- irq = kstat_cpu(i).cpustat.irq;
- softirq = kstat_cpu(i).cpustat.softirq;
-+
- seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu\n",
- i,
- (unsigned long long)jiffies_64_to_clock_t(user),
-@@ -475,6 +511,84 @@ int show_stat(struct seq_file *p, void *
- for (i = 0; i < NR_IRQS; i++)
- seq_printf(p, " %u", kstat_irqs(i));
- #endif
-+ get_full_page_state(&page_state);
-+ seq_printf(p, "\nswap %lu %lu",
-+ page_state.pswpin, page_state.pswpout);
-+}
-+
-+#ifdef CONFIG_VE
-+static void show_stat_ve(struct seq_file *p, struct ve_struct *env)
-+{
-+ int i;
-+ u64 user, nice, system;
-+ cycles_t idle, iowait;
-+ cpumask_t ve_cpus;
-+
-+ ve_cpu_online_map(env, &ve_cpus);
-+
-+ user = nice = system = idle = iowait = 0;
-+ for_each_cpu_mask(i, ve_cpus) {
-+ user += VE_CPU_STATS(env, i)->user;
-+ nice += VE_CPU_STATS(env, i)->nice;
-+ system += VE_CPU_STATS(env, i)->system;
-+ idle += ve_sched_get_idle_time(env, i);
-+ iowait += ve_sched_get_iowait_time(env, i);
-+ }
-+
-+ seq_printf(p, "cpu %llu %llu %llu %llu %llu 0 0\n",
-+ (unsigned long long)jiffies_64_to_clock_t(user),
-+ (unsigned long long)jiffies_64_to_clock_t(nice),
-+ (unsigned long long)jiffies_64_to_clock_t(system),
-+ (unsigned long long)cycles_to_clocks(idle),
-+ (unsigned long long)cycles_to_clocks(iowait));
-+
-+ for_each_cpu_mask(i, ve_cpus) {
-+ user = VE_CPU_STATS(env, i)->user;
-+ nice = VE_CPU_STATS(env, i)->nice;
-+ system = VE_CPU_STATS(env, i)->system;
-+ idle = ve_sched_get_idle_time(env, i);
-+ iowait = ve_sched_get_iowait_time(env, i);
-+
-+ seq_printf(p, "cpu%d %llu %llu %llu %llu %llu 0 0\n",
-+ i,
-+ (unsigned long long)jiffies_64_to_clock_t(user),
-+ (unsigned long long)jiffies_64_to_clock_t(nice),
-+ (unsigned long long)jiffies_64_to_clock_t(system),
-+ (unsigned long long)cycles_to_clocks(idle),
-+ (unsigned long long)cycles_to_clocks(iowait));
-+ }
-+ seq_printf(p, "intr 0");
-+ seq_printf(p, "\nswap %d %d", 0, 0);
-+}
-+#endif
-+
-+int show_stat(struct seq_file *p, void *v)
-+{
-+ extern unsigned long total_forks;
-+ unsigned long seq, jif;
-+ struct ve_struct *env;
-+ unsigned long __nr_running, __nr_iowait;
-+
-+ do {
-+ seq = read_seqbegin(&xtime_lock);
-+ jif = - wall_to_monotonic.tv_sec;
-+ if (wall_to_monotonic.tv_nsec)
-+ --jif;
-+ } while (read_seqretry(&xtime_lock, seq));
-+
-+ env = get_exec_env();
-+ if (ve_is_super(env)) {
-+ show_stat_ve0(p);
-+ __nr_running = nr_running();
-+ __nr_iowait = nr_iowait();
-+ }
-+#ifdef CONFIG_VE
-+ else {
-+ show_stat_ve(p, env);
-+ __nr_running = nr_running_ve(env);
-+ __nr_iowait = nr_iowait_ve();
-+ }
-+#endif
-
- seq_printf(p,
- "\nctxt %llu\n"
-@@ -485,8 +599,8 @@ int show_stat(struct seq_file *p, void *
- nr_context_switches(),
- (unsigned long)jif,
- total_forks,
-- nr_running(),
-- nr_iowait());
-+ __nr_running,
-+ __nr_iowait);
-
- return 0;
- }
-@@ -583,7 +697,8 @@ static int cmdline_read_proc(char *page,
- {
- int len;
-
-- len = sprintf(page, "%s\n", saved_command_line);
-+ len = sprintf(page, "%s\n",
-+ ve_is_super(get_exec_env()) ? saved_command_line : "");
- return proc_calc_metrics(page, start, off, count, eof, len);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/proc_tty.c linux-2.6.9-ve023stab030/fs/proc/proc_tty.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/proc_tty.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/proc_tty.c 2006-10-11 19:07:57.000000000 +0400
-@@ -6,6 +6,7 @@
-
- #include <asm/uaccess.h>
-
-+#include <linux/ve_owner.h>
- #include <linux/init.h>
- #include <linux/errno.h>
- #include <linux/time.h>
-@@ -108,24 +109,35 @@ static int show_tty_driver(struct seq_fi
- /* iterator */
- static void *t_start(struct seq_file *m, loff_t *pos)
- {
-- struct list_head *p;
-+ struct tty_driver *drv;
-+
- loff_t l = *pos;
-- list_for_each(p, &tty_drivers)
-+ read_lock(&tty_driver_guard);
-+ list_for_each_entry(drv, &tty_drivers, tty_drivers) {
-+ if (!ve_accessible_strict(VE_OWNER_TTYDRV(drv), get_exec_env()))
-+ continue;
- if (!l--)
-- return list_entry(p, struct tty_driver, tty_drivers);
-+ return drv;
-+ }
- return NULL;
- }
-
- static void *t_next(struct seq_file *m, void *v, loff_t *pos)
- {
-- struct list_head *p = ((struct tty_driver *)v)->tty_drivers.next;
-+ struct tty_driver *drv;
-+
- (*pos)++;
-- return p==&tty_drivers ? NULL :
-- list_entry(p, struct tty_driver, tty_drivers);
-+ drv = (struct tty_driver *)v;
-+ list_for_each_entry_continue(drv, &tty_drivers, tty_drivers) {
-+ if (ve_accessible_strict(VE_OWNER_TTYDRV(drv), get_exec_env()))
-+ return drv;
-+ }
-+ return NULL;
- }
-
- static void t_stop(struct seq_file *m, void *v)
- {
-+ read_unlock(&tty_driver_guard);
- }
-
- static struct seq_operations tty_drivers_op = {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/proc/root.c linux-2.6.9-ve023stab030/fs/proc/root.c
---- linux-2.6.9-42.0.3.EL.orig/fs/proc/root.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/proc/root.c 2006-10-11 19:07:57.000000000 +0400
-@@ -30,12 +30,14 @@ static struct super_block *proc_get_sb(s
- return get_sb_single(fs_type, flags, data, proc_fill_super);
- }
-
--static struct file_system_type proc_fs_type = {
-+struct file_system_type proc_fs_type = {
- .name = "proc",
- .get_sb = proc_get_sb,
- .kill_sb = kill_anon_super,
- };
-
-+EXPORT_SYMBOL(proc_fs_type);
-+
- extern int __init proc_init_inodecache(void);
- void __init proc_root_init(void)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/quota.c linux-2.6.9-ve023stab030/fs/quota.c
---- linux-2.6.9-42.0.3.EL.orig/fs/quota.c 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/quota.c 2006-10-11 19:07:58.000000000 +0400
-@@ -94,26 +94,29 @@ static int check_quotactl_valid(struct s
- if (cmd == Q_GETQUOTA || cmd == Q_XGETQUOTA) {
- if (((type == USRQUOTA && current->euid != id) ||
- (type == GRPQUOTA && !in_egroup_p(id))) &&
-- !capable(CAP_SYS_ADMIN))
-+ !capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
- }
- else if (cmd != Q_GETFMT && cmd != Q_SYNC && cmd != Q_GETINFO && cmd != Q_XGETQSTAT)
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
-
- return security_quotactl (cmd, type, id, sb);
- }
-
--static struct super_block *get_super_to_sync(int type)
-+void sync_dquots(struct super_block *sb, int type)
- {
-- struct list_head *head;
- int cnt, dirty;
--
--restart:
-+
-+ if (sb) {
-+ if (sb->s_qcop && sb->s_qcop->quota_sync)
-+ sb->s_qcop->quota_sync(sb, type);
-+ return;
-+ }
-+
- spin_lock(&sb_lock);
-- list_for_each(head, &super_blocks) {
-- struct super_block *sb = list_entry(head, struct super_block, s_list);
--
-+restart:
-+ list_for_each_entry(sb, &super_blocks, s_list) {
- /* This test just improves performance so it needn't be reliable... */
- for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
- if ((type == cnt || type == -1) && sb_has_quota_enabled(sb, cnt)
-@@ -124,29 +127,14 @@ restart:
- sb->s_count++;
- spin_unlock(&sb_lock);
- down_read(&sb->s_umount);
-- if (!sb->s_root) {
-- drop_super(sb);
-+ if (sb->s_root && sb->s_qcop->quota_sync)
-+ sb->s_qcop->quota_sync(sb, type);
-+ up_read(&sb->s_umount);
-+ spin_lock(&sb_lock);
-+ if (__put_super_and_need_restart(sb))
- goto restart;
-- }
-- return sb;
- }
- spin_unlock(&sb_lock);
-- return NULL;
--}
--
--void sync_dquots(struct super_block *sb, int type)
--{
-- if (sb) {
-- if (sb->s_qcop->quota_sync)
-- sb->s_qcop->quota_sync(sb, type);
-- }
-- else {
-- while ((sb = get_super_to_sync(type)) != 0) {
-- if (sb->s_qcop->quota_sync)
-- sb->s_qcop->quota_sync(sb, type);
-- drop_super(sb);
-- }
-- }
- }
-
- /* Copy parameters and call proper function */
-@@ -258,6 +246,250 @@ static int do_quotactl(struct super_bloc
- return 0;
- }
-
-+static struct super_block *quota_get_sb(const char __user *special)
-+{
-+ struct super_block *sb;
-+ struct block_device *bdev;
-+ char *tmp;
-+
-+ tmp = getname(special);
-+ if (IS_ERR(tmp))
-+ return (struct super_block *)tmp;
-+ bdev = lookup_bdev(tmp, FMODE_QUOTACTL);
-+ putname(tmp);
-+ if (IS_ERR(bdev))
-+ return (struct super_block *)bdev;
-+ sb = get_super(bdev);
-+ bdput(bdev);
-+ if (!sb)
-+ return ERR_PTR(-ENODEV);
-+ return sb;
-+}
-+
-+#ifdef CONFIG_QUOTA_COMPAT
-+
-+#define QC_QUOTAON 0x0100 /* enable quotas */
-+#define QC_QUOTAOFF 0x0200 /* disable quotas */
-+/* GETQUOTA, SETQUOTA and SETUSE which were at 0x0300-0x0500 has now other parameteres */
-+#define QC_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
-+#define QC_SETQLIM 0x0700 /* set limits */
-+/* GETSTATS at 0x0800 is now longer... */
-+#define QC_GETINFO 0x0900 /* get info about quotas - graces, flags... */
-+#define QC_SETINFO 0x0A00 /* set info about quotas */
-+#define QC_SETGRACE 0x0B00 /* set inode and block grace */
-+#define QC_SETFLAGS 0x0C00 /* set flags for quota */
-+#define QC_GETQUOTA 0x0D00 /* get limits and usage */
-+#define QC_SETQUOTA 0x0E00 /* set limits and usage */
-+#define QC_SETUSE 0x0F00 /* set usage */
-+/* 0x1000 used by old RSQUASH */
-+#define QC_GETSTATS 0x1100 /* get collected stats */
-+#define QC_GETQUOTI 0x2B00 /* get limits and usage by index */
-+
-+struct compat_dqblk {
-+ unsigned int dqb_ihardlimit;
-+ unsigned int dqb_isoftlimit;
-+ unsigned int dqb_curinodes;
-+ unsigned int dqb_bhardlimit;
-+ unsigned int dqb_bsoftlimit;
-+ qsize_t dqb_curspace;
-+ __kernel_time_t dqb_btime;
-+ __kernel_time_t dqb_itime;
-+};
-+
-+struct compat_dqinfo {
-+ unsigned int dqi_bgrace;
-+ unsigned int dqi_igrace;
-+ unsigned int dqi_flags;
-+ unsigned int dqi_blocks;
-+ unsigned int dqi_free_blk;
-+ unsigned int dqi_free_entry;
-+};
-+
-+struct compat_dqstats {
-+ __u32 lookups;
-+ __u32 drops;
-+ __u32 reads;
-+ __u32 writes;
-+ __u32 cache_hits;
-+ __u32 allocated_dquots;
-+ __u32 free_dquots;
-+ __u32 syncs;
-+ __u32 version;
-+};
-+
-+asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr);
-+static long compat_quotactl(unsigned int cmds, unsigned int type,
-+ const char __user *special, qid_t id,
-+ void __user *addr)
-+{
-+ struct super_block *sb;
-+ long ret;
-+
-+ sb = NULL;
-+ switch (cmds) {
-+ case QC_QUOTAON:
-+ return sys_quotactl(QCMD(Q_QUOTAON, type),
-+ special, id, addr);
-+
-+ case QC_QUOTAOFF:
-+ return sys_quotactl(QCMD(Q_QUOTAOFF, type),
-+ special, id, addr);
-+
-+ case QC_SYNC:
-+ return sys_quotactl(QCMD(Q_SYNC, type),
-+ special, id, addr);
-+
-+ case QC_GETQUOTA: {
-+ struct if_dqblk idq;
-+ struct compat_dqblk cdq;
-+
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ break;
-+ ret = check_quotactl_valid(sb, type, Q_GETQUOTA, id);
-+ if (ret)
-+ break;
-+ ret = sb->s_qcop->get_dqblk(sb, type, id, &idq);
-+ if (ret)
-+ break;
-+ cdq.dqb_ihardlimit = idq.dqb_ihardlimit;
-+ cdq.dqb_isoftlimit = idq.dqb_isoftlimit;
-+ cdq.dqb_curinodes = idq.dqb_curinodes;
-+ cdq.dqb_bhardlimit = idq.dqb_bhardlimit;
-+ cdq.dqb_bsoftlimit = idq.dqb_bsoftlimit;
-+ cdq.dqb_curspace = idq.dqb_curspace;
-+ cdq.dqb_btime = idq.dqb_btime;
-+ cdq.dqb_itime = idq.dqb_itime;
-+ ret = 0;
-+ if (copy_to_user(addr, &cdq, sizeof(cdq)))
-+ ret = -EFAULT;
-+ break;
-+ }
-+
-+ case QC_SETQUOTA:
-+ case QC_SETUSE:
-+ case QC_SETQLIM: {
-+ struct if_dqblk idq;
-+ struct compat_dqblk cdq;
-+
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ break;
-+ ret = check_quotactl_valid(sb, type, Q_SETQUOTA, id);
-+ if (ret)
-+ break;
-+ ret = -EFAULT;
-+ if (copy_from_user(&cdq, addr, sizeof(cdq)))
-+ break;
-+ idq.dqb_ihardlimit = cdq.dqb_ihardlimit;
-+ idq.dqb_isoftlimit = cdq.dqb_isoftlimit;
-+ idq.dqb_curinodes = cdq.dqb_curinodes;
-+ idq.dqb_bhardlimit = cdq.dqb_bhardlimit;
-+ idq.dqb_bsoftlimit = cdq.dqb_bsoftlimit;
-+ idq.dqb_curspace = cdq.dqb_curspace;
-+ idq.dqb_valid = 0;
-+ if (cmds == QC_SETQUOTA || cmds == QC_SETQLIM)
-+ idq.dqb_valid |= QIF_LIMITS;
-+ if (cmds == QC_SETQUOTA || cmds == QC_SETUSE)
-+ idq.dqb_valid |= QIF_USAGE;
-+ ret = sb->s_qcop->set_dqblk(sb, type, id, &idq);
-+ break;
-+ }
-+
-+ case QC_GETINFO: {
-+ struct if_dqinfo iinf;
-+ struct compat_dqinfo cinf;
-+
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ break;
-+ ret = check_quotactl_valid(sb, type, Q_GETQUOTA, id);
-+ if (ret)
-+ break;
-+ ret = sb->s_qcop->get_info(sb, type, &iinf);
-+ if (ret)
-+ break;
-+ cinf.dqi_bgrace = iinf.dqi_bgrace;
-+ cinf.dqi_igrace = iinf.dqi_igrace;
-+ cinf.dqi_flags = 0;
-+ if (iinf.dqi_flags & DQF_INFO_DIRTY)
-+ cinf.dqi_flags |= 0x0010;
-+ cinf.dqi_blocks = 0;
-+ cinf.dqi_free_blk = 0;
-+ cinf.dqi_free_entry = 0;
-+ ret = 0;
-+ if (copy_to_user(addr, &cinf, sizeof(cinf)))
-+ ret = -EFAULT;
-+ break;
-+ }
-+
-+ case QC_SETINFO:
-+ case QC_SETGRACE:
-+ case QC_SETFLAGS: {
-+ struct if_dqinfo iinf;
-+ struct compat_dqinfo cinf;
-+
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ break;
-+ ret = check_quotactl_valid(sb, type, Q_SETINFO, id);
-+ if (ret)
-+ break;
-+ ret = -EFAULT;
-+ if (copy_from_user(&cinf, addr, sizeof(cinf)))
-+ break;
-+ iinf.dqi_bgrace = cinf.dqi_bgrace;
-+ iinf.dqi_igrace = cinf.dqi_igrace;
-+ iinf.dqi_flags = cinf.dqi_flags;
-+ iinf.dqi_valid = 0;
-+ if (cmds == QC_SETINFO || cmds == QC_SETGRACE)
-+ iinf.dqi_valid |= IIF_BGRACE | IIF_IGRACE;
-+ if (cmds == QC_SETINFO || cmds == QC_SETFLAGS)
-+ iinf.dqi_valid |= IIF_FLAGS;
-+ ret = sb->s_qcop->set_info(sb, type, &iinf);
-+ break;
-+ }
-+
-+ case QC_GETSTATS: {
-+ struct compat_dqstats stat;
-+
-+ memset(&stat, 0, sizeof(stat));
-+ stat.version = 6*10000+5*100+0;
-+ ret = 0;
-+ if (copy_to_user(addr, &stat, sizeof(stat)))
-+ ret = -EFAULT;
-+ break;
-+ }
-+
-+ case QC_GETQUOTI:
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ break;
-+ ret = check_quotactl_valid(sb, type, Q_GETINFO, id);
-+ if (ret)
-+ break;
-+ ret = -ENOSYS;
-+ if (!sb->s_qcop->get_quoti)
-+ break;
-+ ret = sb->s_qcop->get_quoti(sb, type, id, addr);
-+ break;
-+
-+ default:
-+ ret = -ENOSYS;
-+ break;
-+ }
-+ if (sb && !IS_ERR(sb))
-+ drop_super(sb);
-+ return ret;
-+}
-+
-+#endif
-+
- /*
- * This is the system call interface. This communicates with
- * the user-level programs. Currently this only supports diskquota
-@@ -268,25 +500,20 @@ asmlinkage long sys_quotactl(unsigned in
- {
- uint cmds, type;
- struct super_block *sb = NULL;
-- struct block_device *bdev;
-- char *tmp;
- int ret;
-
- cmds = cmd >> SUBCMDSHIFT;
- type = cmd & SUBCMDMASK;
-
-+#ifdef CONFIG_QUOTA_COMPAT
-+ if (cmds >= 0x0100 && cmds < 0x3000)
-+ return compat_quotactl(cmds, type, special, id, addr);
-+#endif
-+
- if (cmds != Q_SYNC || special) {
-- tmp = getname(special);
-- if (IS_ERR(tmp))
-- return PTR_ERR(tmp);
-- bdev = lookup_bdev(tmp);
-- putname(tmp);
-- if (IS_ERR(bdev))
-- return PTR_ERR(bdev);
-- sb = get_super(bdev);
-- bdput(bdev);
-- if (!sb)
-- return -ENODEV;
-+ sb = quota_get_sb(special);
-+ if (IS_ERR(sb))
-+ return PTR_ERR(sb);
- }
-
- ret = check_quotactl_valid(sb, type, cmds, id);
-@@ -297,3 +524,92 @@ asmlinkage long sys_quotactl(unsigned in
-
- return ret;
- }
-+
-+#ifdef CONFIG_QUOTA_COMPAT
-+/*
-+ * These code works when _old_ 32-bit quota utils
-+ * works on 64-bit platform
-+ */
-+struct compat32_dqblk {
-+ unsigned int dqb_ihardlimit;
-+ unsigned int dqb_isoftlimit;
-+ unsigned int dqb_curinodes;
-+ unsigned int dqb_bhardlimit;
-+ unsigned int dqb_bsoftlimit;
-+ unsigned int dqb_curspace[2];
-+ int dqb_btime;
-+ int dqb_itime;
-+};
-+
-+asmlinkage long
-+sys32_quotactl(unsigned int cmd, const char __user *special,
-+ qid_t id, void __user *addr)
-+{
-+ uint cmds, type;
-+ struct if_dqblk idq;
-+ struct compat32_dqblk c32dq;
-+ struct super_block *sb;
-+ long ret;
-+
-+ cmds = cmd >> SUBCMDSHIFT;
-+
-+ if (cmds != QC_GETQUOTA && cmds != QC_SETQUOTA &&
-+ cmds != QC_SETUSE && cmds != QC_SETQLIM)
-+ return sys_quotactl(cmd, special, id, addr);
-+
-+ sb = quota_get_sb(special);
-+ ret = PTR_ERR(sb);
-+ if (IS_ERR(sb))
-+ goto out_sb;
-+
-+ type = cmd & SUBCMDMASK;
-+
-+ switch (cmds) {
-+ case QC_GETQUOTA: {
-+ ret = check_quotactl_valid(sb, type, Q_GETQUOTA, id);
-+ if (ret)
-+ break;
-+ ret = sb->s_qcop->get_dqblk(sb, type, id, &idq);
-+ if (ret)
-+ break;
-+ c32dq.dqb_ihardlimit = idq.dqb_ihardlimit;
-+ c32dq.dqb_isoftlimit = idq.dqb_isoftlimit;
-+ c32dq.dqb_curinodes = idq.dqb_curinodes;
-+ c32dq.dqb_bhardlimit = idq.dqb_bhardlimit;
-+ c32dq.dqb_bsoftlimit = idq.dqb_bsoftlimit;
-+ memcpy(c32dq.dqb_curspace, &idq.dqb_curspace, 8);
-+ c32dq.dqb_btime = idq.dqb_btime;
-+ c32dq.dqb_itime = idq.dqb_itime;
-+ if (copy_to_user(addr, &c32dq, sizeof(c32dq)))
-+ ret = -EFAULT;
-+ break;
-+ }
-+ case QC_SETQUOTA:
-+ case QC_SETUSE:
-+ case QC_SETQLIM: {
-+ ret = check_quotactl_valid(sb, type, Q_SETQUOTA, id);
-+ if (ret)
-+ break;
-+ ret = -EFAULT;
-+ if (copy_from_user(&c32dq, addr, sizeof(c32dq)))
-+ break;
-+ idq.dqb_ihardlimit = c32dq.dqb_ihardlimit;
-+ idq.dqb_isoftlimit = c32dq.dqb_isoftlimit;
-+ idq.dqb_curinodes = c32dq.dqb_curinodes;
-+ idq.dqb_bhardlimit = c32dq.dqb_bhardlimit;
-+ idq.dqb_bsoftlimit = c32dq.dqb_bsoftlimit;
-+ memcpy(&idq.dqb_curspace, c32dq.dqb_curspace, 8);
-+ idq.dqb_valid = 0;
-+ if (cmds == QC_SETQUOTA || cmds == QC_SETQLIM)
-+ idq.dqb_valid |= QIF_LIMITS;
-+ if (cmds == QC_SETQUOTA || cmds == QC_SETUSE)
-+ idq.dqb_valid |= QIF_USAGE;
-+ ret = sb->s_qcop->set_dqblk(sb, type, id, &idq);
-+ break;
-+ }
-+ }
-+ drop_super(sb);
-+out_sb:
-+ return ret;
-+}
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ramfs/inode.c linux-2.6.9-ve023stab030/fs/ramfs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ramfs/inode.c 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ramfs/inode.c 2006-10-11 19:07:55.000000000 +0400
-@@ -129,7 +129,7 @@ static int ramfs_symlink(struct inode *
- inode = ramfs_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);
- if (inode) {
- int l = strlen(symname)+1;
-- error = page_symlink(inode, symname, l);
-+ error = page_symlink(inode, symname, l, GFP_KERNEL);
- if (!error) {
- if (dir->i_mode & S_ISGID)
- inode->i_gid = dir->i_gid;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/file.c linux-2.6.9-ve023stab030/fs/reiserfs/file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/file.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/reiserfs/file.c 2006-10-11 19:07:55.000000000 +0400
-@@ -536,7 +536,7 @@ error_exit:
-
- /* Unlock pages prepared by reiserfs_prepare_file_region_for_write */
- void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pages */
-- int num_pages /* amount of pages */) {
-+ size_t num_pages /* amount of pages */) {
- int i; // loop counter
-
- for (i=0; i < num_pages ; i++) {
-@@ -567,7 +567,7 @@ int reiserfs_copy_from_user_to_file_regi
- int offset; // offset in page
-
- for ( i = 0, offset = (pos & (PAGE_CACHE_SIZE-1)); i < num_pages ; i++,offset=0) {
-- int count = min_t(int,PAGE_CACHE_SIZE-offset,write_bytes); // How much of bytes to write to this page
-+ size_t count = min_t(size_t,PAGE_CACHE_SIZE-offset,write_bytes); // How much of bytes to write to this page
- struct page *page=prepared_pages[i]; // Current page we process.
-
- fault_in_pages_readable( buf, count);
-@@ -662,8 +662,8 @@ int reiserfs_submit_file_region_for_writ
- struct reiserfs_transaction_handle *th,
- struct inode *inode,
- loff_t pos, /* Writing position offset */
-- int num_pages, /* Number of pages to write */
-- int write_bytes, /* number of bytes to write */
-+ size_t num_pages, /* Number of pages to write */
-+ size_t write_bytes, /* number of bytes to write */
- struct page **prepared_pages /* list of pages */
- )
- {
-@@ -796,9 +796,9 @@ int reiserfs_check_for_tail_and_convert(
- int reiserfs_prepare_file_region_for_write(
- struct inode *inode /* Inode of the file */,
- loff_t pos, /* position in the file */
-- int num_pages, /* number of pages to
-+ size_t num_pages, /* number of pages to
- prepare */
-- int write_bytes, /* Amount of bytes to be
-+ size_t write_bytes, /* Amount of bytes to be
- overwritten from
- @pos */
- struct page **prepared_pages /* pointer to array
-@@ -1177,10 +1177,9 @@ ssize_t reiserfs_file_write( struct file
- while ( count > 0) {
- /* This is the main loop in which we running until some error occures
- or until we write all of the data. */
-- int num_pages;/* amount of pages we are going to write this iteration */
-- int write_bytes; /* amount of bytes to write during this iteration */
-- int blocks_to_allocate; /* how much blocks we need to allocate for
-- this iteration */
-+ size_t num_pages;/* amount of pages we are going to write this iteration */
-+ size_t write_bytes; /* amount of bytes to write during this iteration */
-+ size_t blocks_to_allocate; /* how much blocks we need to allocate for this iteration */
-
- /* (pos & (PAGE_CACHE_SIZE-1)) is an idiom for offset into a page of pos*/
- num_pages = !!((pos+count) & (PAGE_CACHE_SIZE - 1)) + /* round up partial
-@@ -1194,7 +1193,7 @@ ssize_t reiserfs_file_write( struct file
- /* If we were asked to write more data than we want to or if there
- is not that much space, then we shorten amount of data to write
- for this iteration. */
-- num_pages = min_t(int, REISERFS_WRITE_PAGES_AT_A_TIME, reiserfs_can_fit_pages(inode->i_sb));
-+ num_pages = min_t(size_t, REISERFS_WRITE_PAGES_AT_A_TIME, reiserfs_can_fit_pages(inode->i_sb));
- /* Also we should not forget to set size in bytes accordingly */
- write_bytes = (num_pages << PAGE_CACHE_SHIFT) -
- (pos & (PAGE_CACHE_SIZE-1));
-@@ -1220,7 +1219,7 @@ ssize_t reiserfs_file_write( struct file
- // But overwriting files on absolutelly full volumes would not
- // be very efficient. Well, people are not supposed to fill
- // 100% of disk space anyway.
-- write_bytes = min_t(int, count, inode->i_sb->s_blocksize - (pos & (inode->i_sb->s_blocksize - 1)));
-+ write_bytes = min_t(size_t, count, inode->i_sb->s_blocksize - (pos & (inode->i_sb->s_blocksize - 1)));
- num_pages = 1;
- // No blocks were claimed before, so do it now.
- reiserfs_claim_blocks_to_be_allocated(inode->i_sb, 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits));
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/namei.c linux-2.6.9-ve023stab030/fs/reiserfs/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/namei.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/reiserfs/namei.c 2006-10-11 19:07:58.000000000 +0400
-@@ -799,6 +799,9 @@ static int reiserfs_rmdir (struct inode
- struct reiserfs_dir_entry de;
-
-
-+ inode = dentry->d_inode;
-+ DQUOT_INIT(inode);
-+
- /* we will be doing 2 balancings and update 2 stat data */
- jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2;
-
-@@ -814,8 +817,6 @@ static int reiserfs_rmdir (struct inode
- goto end_rmdir;
- }
-
-- inode = dentry->d_inode;
--
- reiserfs_update_inode_transaction(inode) ;
- reiserfs_update_inode_transaction(dir) ;
-
-@@ -878,6 +879,7 @@ static int reiserfs_unlink (struct inode
- unsigned long savelink;
-
- inode = dentry->d_inode;
-+ DQUOT_INIT(inode);
-
- /* in this transaction we can be doing at max two balancings and update
- two stat datas */
-@@ -1146,6 +1148,8 @@ static int reiserfs_rename (struct inode
-
- old_inode = old_dentry->d_inode;
- new_dentry_inode = new_dentry->d_inode;
-+ if (new_dentry_inode)
-+ DQUOT_INIT(new_dentry_inode);
-
- // make sure, that oldname still exists and points to an object we
- // are going to rename
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/xattr.c linux-2.6.9-ve023stab030/fs/reiserfs/xattr.c
---- linux-2.6.9-42.0.3.EL.orig/fs/reiserfs/xattr.c 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/reiserfs/xattr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1442,9 +1442,26 @@ check_capabilities:
- }
-
- int
--reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd)
-+reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
-- return __reiserfs_permission (inode, mask, nd, 1);
-+ int ret;
-+
-+ if (exec_perm != NULL)
-+ down(&inode->i_sem);
-+
-+ ret = __reiserfs_permission (inode, mask, nd, 1);
-+
-+ if (exec_perm != NULL) {
-+ if (!ret) {
-+ exec_perm->set = 1;
-+ exec_perm->mode = inode->i_mode;
-+ exec_perm->uid = inode->i_uid;
-+ exec_perm->gid = inode->i_gid;
-+ }
-+ up(&inode->i_sem);
-+ }
-+ return ret;
- }
-
- int
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/select.c linux-2.6.9-ve023stab030/fs/select.c
---- linux-2.6.9-42.0.3.EL.orig/fs/select.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/select.c 2006-10-11 19:07:56.000000000 +0400
-@@ -25,6 +25,8 @@
- #include <asm/uaccess.h>
- #include <asm/div64.h>
-
-+#include <ub/ub_mem.h>
-+
- #define ROUND_UP(x,y) (((x)+(y)-1)/(y))
- #define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
-
-@@ -95,7 +97,8 @@ void __pollwait(struct file *filp, wait_
- if (!table || POLL_TABLE_FULL(table)) {
- struct poll_table_page *new_table;
-
-- new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL);
-+ new_table = (struct poll_table_page *) __get_free_page(
-+ GFP_KERNEL_UBC);
- if (!new_table) {
- p->error = -ENOMEM;
- __set_current_state(TASK_RUNNING);
-@@ -271,7 +274,11 @@ int do_select(int n, fd_set_bits *fds, l
-
- static void *select_bits_alloc(int size)
- {
-- return kmalloc(6 * size, GFP_KERNEL);
-+ int flags;
-+ flags = GFP_KERNEL;
-+ if (size > PAGE_SIZE / 6)
-+ flags |= __GFP_UBC;
-+ return kmalloc(6 * size, flags);
- }
-
- static void select_bits_free(void *bits, int size)
-@@ -462,6 +469,7 @@ asmlinkage long sys_poll(struct pollfd _
- struct poll_list *walk;
- int timeout_msecs;
- int64_t lltimeout;
-+ int flags;
-
- /* Do a sanity check on nfds ... */
- if (nfds > current->files->max_fdset && nfds > OPEN_MAX)
-@@ -488,12 +496,15 @@ asmlinkage long sys_poll(struct pollfd _
- walk = NULL;
- i = nfds;
- err = -ENOMEM;
-+ flags = GFP_KERNEL | __GFP_UBC;
- while(i!=0) {
- struct poll_list *pp;
-+ if (i <= POLLFD_PER_PAGE)
-+ flags &= ~__GFP_UBC;
- pp = kmalloc(sizeof(struct poll_list)+
- sizeof(struct pollfd)*
- (i>POLLFD_PER_PAGE?POLLFD_PER_PAGE:i),
-- GFP_KERNEL);
-+ flags);
- if(pp==NULL)
- goto out_fds;
- pp->next=NULL;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/seq_file.c linux-2.6.9-ve023stab030/fs/seq_file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/seq_file.c 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/seq_file.c 2006-10-11 19:07:57.000000000 +0400
-@@ -311,6 +311,8 @@ int seq_path(struct seq_file *m,
- if (m->count < m->size) {
- char *s = m->buf + m->count;
- char *p = d_path(dentry, mnt, s, m->size - m->count);
-+ if (IS_ERR(p) && PTR_ERR(p) != -ENAMETOOLONG)
-+ return 0;
- if (!IS_ERR(p)) {
- while (s <= p) {
- char c = *p++;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/simfs.c linux-2.6.9-ve023stab030/fs/simfs.c
---- linux-2.6.9-42.0.3.EL.orig/fs/simfs.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/simfs.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,289 @@
-+/*
-+ * fs/simfs.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/fs.h>
-+#include <linux/file.h>
-+#include <linux/init.h>
-+#include <linux/namei.h>
-+#include <linux/err.h>
-+#include <linux/module.h>
-+#include <linux/mount.h>
-+#include <linux/vzquota.h>
-+#include <linux/statfs.h>
-+#include <linux/virtinfo.h>
-+#include <linux/faudit.h>
-+#include <linux/genhd.h>
-+
-+#include <asm/unistd.h>
-+#include <asm/uaccess.h>
-+
-+#define SIMFS_GET_LOWER_FS_SB(sb) sb->s_root->d_sb
-+
-+static struct super_operations sim_super_ops;
-+
-+static int sim_getattr(struct vfsmount *mnt, struct dentry *dentry,
-+ struct kstat *stat)
-+{
-+ struct super_block *sb;
-+ struct inode *inode;
-+
-+ inode = dentry->d_inode;
-+ if (!inode->i_op->getattr) {
-+ generic_fillattr(inode, stat);
-+ if (!stat->blksize) {
-+ unsigned blocks;
-+
-+ sb = inode->i_sb;
-+ blocks = (stat->size + sb->s_blocksize-1) >>
-+ sb->s_blocksize_bits;
-+ stat->blocks = (sb->s_blocksize / 512) * blocks;
-+ stat->blksize = sb->s_blocksize;
-+ }
-+ } else {
-+ int err;
-+
-+ err = inode->i_op->getattr(mnt, dentry, stat);
-+ if (err)
-+ return err;
-+ }
-+
-+ sb = mnt->mnt_sb;
-+ if (sb->s_op == &sim_super_ops)
-+ stat->dev = sb->s_dev;
-+ return 0;
-+}
-+
-+static void quota_get_stat(struct super_block *sb, struct kstatfs *buf)
-+{
-+ int err;
-+ struct dq_stat qstat;
-+ struct virt_info_quota q;
-+ long free_file, adj_file;
-+ s64 blk, free_blk, adj_blk;
-+ int bsize_bits;
-+
-+ q.super = sb;
-+ q.qstat = &qstat;
-+ err = virtinfo_notifier_call(VITYPE_QUOTA, VIRTINFO_QUOTA_GETSTAT, &q);
-+ if (err != NOTIFY_OK)
-+ return;
-+
-+ bsize_bits = ffs(buf->f_bsize) - 1;
-+ free_blk = (s64)(qstat.bsoftlimit - qstat.bcurrent) >> bsize_bits;
-+ if (free_blk < 0)
-+ free_blk = 0;
-+ /*
-+ * In the regular case, we always set buf->f_bfree and buf->f_blocks to
-+ * the values reported by quota. In case of real disk space shortage,
-+ * we adjust the values. We want this adjustment to look as if the
-+ * total disk space were reduced, not as if the usage were increased.
-+ * -- SAW
-+ */
-+ adj_blk = 0;
-+ if (buf->f_bfree < free_blk)
-+ adj_blk = free_blk - buf->f_bfree;
-+ buf->f_bfree = (long)(free_blk - adj_blk);
-+
-+ if (free_blk < buf->f_bavail)
-+ buf->f_bavail = (long)free_blk; /* min(f_bavail, free_blk) */
-+
-+ blk = (qstat.bsoftlimit >> bsize_bits) - adj_blk;
-+ buf->f_blocks = blk > LONG_MAX ? LONG_MAX : blk;
-+
-+ free_file = qstat.isoftlimit - qstat.icurrent;
-+ if (free_file < 0)
-+ free_file = 0;
-+ if (buf->f_ffree == -1)
-+ /*
-+ * One filesystem uses -1 to represent the fact that it doesn't
-+ * have a detached limit for inode number.
-+ * May be, because -1 is a good pretendent for the maximum value
-+ * of signed long type, may be, because it's just nice to have
-+ * an exceptional case... Guess what that filesystem is :-)
-+ * -- SAW
-+ */
-+ buf->f_ffree = free_file;
-+ adj_file = 0;
-+ if (buf->f_ffree < free_file)
-+ adj_file = free_file - buf->f_ffree;
-+ buf->f_ffree = free_file - adj_file;
-+ buf->f_files = qstat.isoftlimit - adj_file;
-+}
-+
-+static int sim_statfs(struct super_block *sb, struct kstatfs *buf)
-+{
-+ int err;
-+ struct super_block *lsb;
-+ struct kstatfs statbuf;
-+
-+ err = 0;
-+ if (sb->s_op != &sim_super_ops)
-+ return 0;
-+
-+ lsb = SIMFS_GET_LOWER_FS_SB(sb);
-+
-+ err = -ENOSYS;
-+ if (lsb && lsb->s_op && lsb->s_op->statfs)
-+ err = lsb->s_op->statfs(lsb, &statbuf);
-+ if (err)
-+ return err;
-+
-+ quota_get_stat(sb, &statbuf);
-+ buf->f_files = statbuf.f_files;
-+ buf->f_ffree = statbuf.f_ffree;
-+ buf->f_blocks = statbuf.f_blocks;
-+ buf->f_bfree = statbuf.f_bfree;
-+ buf->f_bavail = statbuf.f_bavail;
-+ return 0;
-+}
-+
-+static int sim_systemcall(struct vnotifier_block *me, unsigned long n,
-+ void *d, int old_ret)
-+{
-+ int err;
-+
-+ switch (n) {
-+ case VIRTINFO_FAUDIT_STAT: {
-+ struct faudit_stat_arg *arg;
-+
-+ arg = (struct faudit_stat_arg *)d;
-+ err = sim_getattr(arg->mnt, arg->dentry, arg->stat);
-+ arg->err = err;
-+ }
-+ break;
-+ case VIRTINFO_FAUDIT_STATFS: {
-+ struct faudit_statfs_arg *arg;
-+
-+ arg = (struct faudit_statfs_arg *)d;
-+ err = sim_statfs(arg->sb, arg->stat);
-+ arg->err = err;
-+ }
-+ break;
-+ default:
-+ return old_ret;
-+ }
-+ return (err ? NOTIFY_BAD : NOTIFY_OK);
-+}
-+
-+static struct inode *sim_quota_root(struct super_block *sb)
-+{
-+ return sb->s_root->d_inode;
-+}
-+
-+void sim_put_super(struct super_block *sb)
-+{
-+ struct virt_info_quota viq;
-+
-+ viq.super = sb;
-+ virtinfo_notifier_call(VITYPE_QUOTA, VIRTINFO_QUOTA_OFF, &viq);
-+ bdput(sb->s_bdev);
-+}
-+
-+static struct super_operations sim_super_ops = {
-+ .get_quota_root = sim_quota_root,
-+ .put_super = sim_put_super,
-+};
-+
-+static int sim_fill_super(struct super_block *s, void *data)
-+{
-+ int err;
-+ struct nameidata *nd;
-+
-+ err = set_anon_super(s, NULL);
-+ if (err)
-+ goto out;
-+
-+ err = 0;
-+ nd = (struct nameidata *)data;
-+ s->s_root = dget(nd->dentry);
-+ s->s_op = &sim_super_ops;
-+out:
-+ return err;
-+}
-+
-+struct super_block *sim_get_sb(struct file_system_type *type,
-+ int flags, const char *dev_name, void *opt)
-+{
-+ int err;
-+ struct nameidata nd;
-+ struct super_block *sb;
-+ struct block_device *bd;
-+ struct virt_info_quota viq;
-+ static struct hd_struct fake_hds;
-+
-+ sb = ERR_PTR(-EINVAL);
-+ if (opt == NULL)
-+ goto out;
-+
-+ err = path_lookup(opt, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
-+ sb = ERR_PTR(err);
-+ if (err)
-+ goto out;
-+
-+ sb = sget(type, NULL, sim_fill_super, &nd);
-+ if (IS_ERR(sb))
-+ goto out_path;
-+
-+ bd = bdget(sb->s_dev);
-+ if (!bd)
-+ goto out_killsb;
-+
-+ sb->s_bdev = bd;
-+ bd->bd_part = &fake_hds;
-+ viq.super = sb;
-+ virtinfo_notifier_call(VITYPE_QUOTA, VIRTINFO_QUOTA_ON, &viq);
-+out_path:
-+ path_release(&nd);
-+out:
-+ return sb;
-+
-+out_killsb:
-+ up_write(&sb->s_umount);
-+ deactivate_super(sb);
-+ sb = ERR_PTR(-ENODEV);
-+ goto out_path;
-+}
-+
-+static struct file_system_type sim_fs_type = {
-+ .owner = THIS_MODULE,
-+ .name = "simfs",
-+ .get_sb = sim_get_sb,
-+ .kill_sb = kill_anon_super,
-+};
-+
-+static struct vnotifier_block sim_syscalls = {
-+ .notifier_call = sim_systemcall,
-+};
-+
-+static int __init init_simfs(void)
-+{
-+ int err;
-+
-+ err = register_filesystem(&sim_fs_type);
-+ if (err)
-+ return err;
-+
-+ virtinfo_notifier_register(VITYPE_FAUDIT, &sim_syscalls);
-+ return 0;
-+}
-+
-+static void __exit exit_simfs(void)
-+{
-+ virtinfo_notifier_unregister(VITYPE_FAUDIT, &sim_syscalls);
-+ unregister_filesystem(&sim_fs_type);
-+}
-+
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Open Virtuozzo Simulation of File System");
-+MODULE_LICENSE("GPL v2");
-+
-+module_init(init_simfs);
-+module_exit(exit_simfs);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/smbfs/dir.c linux-2.6.9-ve023stab030/fs/smbfs/dir.c
---- linux-2.6.9-42.0.3.EL.orig/fs/smbfs/dir.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/smbfs/dir.c 2006-10-11 19:07:55.000000000 +0400
-@@ -436,6 +436,11 @@ smb_lookup(struct inode *dir, struct den
- if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
- goto out;
-
-+ /* Do not allow lookup of names with backslashes in */
-+ error = -EINVAL;
-+ if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
-+ goto out;
-+
- lock_kernel();
- error = smb_proc_getattr(dentry, &finfo);
- #ifdef SMBFS_PARANOIA
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/smbfs/file.c linux-2.6.9-ve023stab030/fs/smbfs/file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/smbfs/file.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/smbfs/file.c 2006-10-11 19:07:55.000000000 +0400
-@@ -387,7 +387,8 @@ smb_file_release(struct inode *inode, st
- * privileges, so we need our own check for this.
- */
- static int
--smb_file_permission(struct inode *inode, int mask, struct nameidata *nd)
-+smb_file_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- int mode = inode->i_mode;
- int error = 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/smbfs/inode.c linux-2.6.9-ve023stab030/fs/smbfs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/smbfs/inode.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/smbfs/inode.c 2006-10-11 19:07:55.000000000 +0400
-@@ -233,7 +233,7 @@ smb_invalidate_inodes(struct smb_sb_info
- {
- VERBOSE("\n");
- shrink_dcache_sb(SB_of(server));
-- invalidate_inodes(SB_of(server));
-+ invalidate_inodes(SB_of(server), 0);
- }
-
- /*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/smbfs/sock.c linux-2.6.9-ve023stab030/fs/smbfs/sock.c
---- linux-2.6.9-42.0.3.EL.orig/fs/smbfs/sock.c 2004-10-19 01:53:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/smbfs/sock.c 2006-10-11 19:07:58.000000000 +0400
-@@ -100,6 +100,7 @@ smb_close_socket(struct smb_sb_info *ser
-
- VERBOSE("closing socket %p\n", sock);
- sock->sk->sk_data_ready = server->data_ready;
-+ sock->sk->sk_user_data = NULL;
- server->sock_file = NULL;
- fput(file);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/stat.c linux-2.6.9-ve023stab030/fs/stat.c
---- linux-2.6.9-42.0.3.EL.orig/fs/stat.c 2004-10-19 01:53:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/stat.c 2006-10-11 19:07:57.000000000 +0400
-@@ -14,6 +14,7 @@
- #include <linux/fs.h>
- #include <linux/namei.h>
- #include <linux/security.h>
-+#include <linux/faudit.h>
-
- #include <asm/uaccess.h>
- #include <asm/unistd.h>
-@@ -41,11 +42,19 @@ int vfs_getattr(struct vfsmount *mnt, st
- {
- struct inode *inode = dentry->d_inode;
- int retval;
-+ struct faudit_stat_arg arg;
-
- retval = security_inode_getattr(mnt, dentry);
- if (retval)
- return retval;
-
-+ arg.mnt = mnt;
-+ arg.dentry = dentry;
-+ arg.stat = stat;
-+ if (virtinfo_notifier_call(VITYPE_FAUDIT, VIRTINFO_FAUDIT_STAT, &arg)
-+ != NOTIFY_DONE)
-+ return arg.err;
-+
- if (inode->i_op->getattr)
- return inode->i_op->getattr(mnt, dentry, stat);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/super.c linux-2.6.9-ve023stab030/fs/super.c
---- linux-2.6.9-42.0.3.EL.orig/fs/super.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/super.c 2006-10-11 19:07:57.000000000 +0400
-@@ -23,6 +23,7 @@
- #include <linux/config.h>
- #include <linux/module.h>
- #include <linux/slab.h>
-+#include <linux/ve_owner.h>
- #include <linux/init.h>
- #include <linux/smp_lock.h>
- #include <linux/acct.h>
-@@ -65,8 +66,10 @@ static struct super_block *alloc_super(v
- }
- INIT_LIST_HEAD(&s->s_dirty);
- INIT_LIST_HEAD(&s->s_io);
-+ INIT_LIST_HEAD(&s->s_inodes);
- INIT_LIST_HEAD(&s->s_files);
- INIT_LIST_HEAD(&s->s_instances);
-+ INIT_LIST_HEAD(&s->s_dentry_unused);
- INIT_HLIST_HEAD(&s->s_anon);
- init_rwsem(&s->s_umount);
- sema_init(&s->s_lock, 1);
-@@ -233,7 +236,7 @@ void generic_shutdown_super(struct super
- lock_kernel();
- sb->s_flags &= ~MS_ACTIVE;
- /* bad name - it should be evict_inodes() */
-- invalidate_inodes(sb);
-+ invalidate_inodes(sb, 0);
-
- if (sop->write_super && sb->s_dirt)
- sop->write_super(sb);
-@@ -241,10 +244,9 @@ void generic_shutdown_super(struct super
- sop->put_super(sb);
-
- /* Forget any remaining inodes */
-- if (invalidate_inodes(sb)) {
-- printk("VFS: Busy inodes after unmount. "
-- "Self-destruct in 5 seconds. Have a nice day...\n");
-- }
-+ if (invalidate_inodes(sb, 1))
-+ printk("Self-destruct in 5 seconds. "
-+ "Have a nice day...\n");
-
- unlock_kernel();
- unlock_super(sb);
-@@ -337,20 +339,22 @@ static inline void write_super(struct su
- */
- void sync_supers(void)
- {
-- struct super_block * sb;
--restart:
-+ struct super_block *sb;
-+
- spin_lock(&sb_lock);
-- sb = sb_entry(super_blocks.next);
-- while (sb != sb_entry(&super_blocks))
-+restart:
-+ list_for_each_entry(sb, &super_blocks, s_list) {
- if (sb->s_dirt) {
- sb->s_count++;
- spin_unlock(&sb_lock);
- down_read(&sb->s_umount);
- write_super(sb);
-- drop_super(sb);
-- goto restart;
-- } else
-- sb = sb_entry(sb->s_list.next);
-+ up_read(&sb->s_umount);
-+ spin_lock(&sb_lock);
-+ if (__put_super_and_need_restart(sb))
-+ goto restart;
-+ }
-+ }
- spin_unlock(&sb_lock);
- }
-
-@@ -377,20 +381,16 @@ void sync_filesystems(int wait)
-
- down(&mutex); /* Could be down_interruptible */
- spin_lock(&sb_lock);
-- for (sb = sb_entry(super_blocks.next); sb != sb_entry(&super_blocks);
-- sb = sb_entry(sb->s_list.next)) {
-+ list_for_each_entry(sb, &super_blocks, s_list) {
- if (!sb->s_op->sync_fs)
- continue;
- if (sb->s_flags & MS_RDONLY)
- continue;
- sb->s_need_sync_fs = 1;
- }
-- spin_unlock(&sb_lock);
-
- restart:
-- spin_lock(&sb_lock);
-- for (sb = sb_entry(super_blocks.next); sb != sb_entry(&super_blocks);
-- sb = sb_entry(sb->s_list.next)) {
-+ list_for_each_entry(sb, &super_blocks, s_list) {
- if (!sb->s_need_sync_fs)
- continue;
- sb->s_need_sync_fs = 0;
-@@ -401,8 +401,11 @@ restart:
- down_read(&sb->s_umount);
- if (sb->s_root && (wait || sb->s_dirt))
- sb->s_op->sync_fs(sb, wait);
-- drop_super(sb);
-- goto restart;
-+ up_read(&sb->s_umount);
-+ /* restart only when sb is no longer on the list */
-+ spin_lock(&sb_lock);
-+ if (__put_super_and_need_restart(sb))
-+ goto restart;
- }
- spin_unlock(&sb_lock);
- up(&mutex);
-@@ -418,20 +421,20 @@ restart:
-
- struct super_block * get_super(struct block_device *bdev)
- {
-- struct list_head *p;
-+ struct super_block *sb;
-+
- if (!bdev)
- return NULL;
- rescan:
- spin_lock(&sb_lock);
-- list_for_each(p, &super_blocks) {
-- struct super_block *s = sb_entry(p);
-- if (s->s_bdev == bdev) {
-- s->s_count++;
-+ list_for_each_entry(sb, &super_blocks, s_list) {
-+ if (sb->s_bdev == bdev) {
-+ sb->s_count++;
- spin_unlock(&sb_lock);
-- down_read(&s->s_umount);
-- if (s->s_root)
-- return s;
-- drop_super(s);
-+ down_read(&sb->s_umount);
-+ if (sb->s_root)
-+ return sb;
-+ drop_super(sb);
- goto rescan;
- }
- }
-@@ -443,19 +446,18 @@ EXPORT_SYMBOL(get_super);
-
- struct super_block * user_get_super(dev_t dev)
- {
-- struct list_head *p;
-+ struct super_block *sb;
-
- rescan:
- spin_lock(&sb_lock);
-- list_for_each(p, &super_blocks) {
-- struct super_block *s = sb_entry(p);
-- if (s->s_dev == dev) {
-- s->s_count++;
-+ list_for_each_entry(sb, &super_blocks, s_list) {
-+ if (sb->s_dev == dev) {
-+ sb->s_count++;
- spin_unlock(&sb_lock);
-- down_read(&s->s_umount);
-- if (s->s_root)
-- return s;
-- drop_super(s);
-+ down_read(&sb->s_umount);
-+ if (sb->s_root)
-+ return sb;
-+ drop_super(sb);
- goto rescan;
- }
- }
-@@ -470,11 +472,20 @@ asmlinkage long sys_ustat(unsigned dev,
- struct super_block *s;
- struct ustat tmp;
- struct kstatfs sbuf;
-- int err = -EINVAL;
-+ dev_t kdev;
-+ int err;
-
-- s = user_get_super(new_decode_dev(dev));
-- if (s == NULL)
-- goto out;
-+ kdev = new_decode_dev(dev);
-+#ifdef CONFIG_VE
-+ err = get_device_perms_ve(S_IFBLK, kdev, FMODE_READ);
-+ if (err)
-+ goto out;
-+#endif
-+
-+ err = -EINVAL;
-+ s = user_get_super(kdev);
-+ if (s == NULL)
-+ goto out;
- err = vfs_statfs(s, &sbuf);
- drop_super(s);
- if (err)
-@@ -588,6 +599,13 @@ void emergency_remount(void)
- static struct idr unnamed_dev_idr;
- static spinlock_t unnamed_dev_lock = SPIN_LOCK_UNLOCKED;/* protects the above */
-
-+/* for compatibility with coreutils still unaware of new minor sizes */
-+int unnamed_dev_majors[] = {
-+ 0, 144, 145, 146, 242, 243, 244, 245,
-+ 246, 247, 248, 249, 250, 251, 252, 253
-+};
-+EXPORT_SYMBOL(unnamed_dev_majors);
-+
- int set_anon_super(struct super_block *s, void *data)
- {
- int dev;
-@@ -605,13 +623,13 @@ int set_anon_super(struct super_block *s
- else if (error)
- return -EAGAIN;
-
-- if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
-+ if ((dev & MAX_ID_MASK) >= (1 << MINORBITS)) {
- spin_lock(&unnamed_dev_lock);
- idr_remove(&unnamed_dev_idr, dev);
- spin_unlock(&unnamed_dev_lock);
- return -EMFILE;
- }
-- s->s_dev = MKDEV(0, dev & MINORMASK);
-+ s->s_dev = make_unnamed_dev(dev);
- return 0;
- }
-
-@@ -619,8 +637,9 @@ EXPORT_SYMBOL(set_anon_super);
-
- void kill_anon_super(struct super_block *sb)
- {
-- int slot = MINOR(sb->s_dev);
-+ int slot;
-
-+ slot = unnamed_dev_idx(sb->s_dev);
- generic_shutdown_super(sb);
- spin_lock(&unnamed_dev_lock);
- idr_remove(&unnamed_dev_idr, slot);
-@@ -776,17 +795,14 @@ struct super_block *get_sb_single(struct
- EXPORT_SYMBOL(get_sb_single);
-
- struct vfsmount *
--do_kern_mount(const char *fstype, int flags, const char *name, void *data)
-+do_kern_mount(struct file_system_type *type, int flags,
-+ const char *name, void *data)
- {
-- struct file_system_type *type = get_fs_type(fstype);
- struct super_block *sb = ERR_PTR(-ENOMEM);
- struct vfsmount *mnt;
- int error;
- char *secdata = NULL;
-
-- if (!type)
-- return ERR_PTR(-ENODEV);
--
- mnt = alloc_vfsmnt(name);
- if (!mnt)
- goto out;
-@@ -818,7 +834,6 @@ do_kern_mount(const char *fstype, int fl
- mnt->mnt_namespace = current->namespace;
- up_write(&sb->s_umount);
- free_secdata(secdata);
-- put_filesystem(type);
- return mnt;
- out_sb:
- up_write(&sb->s_umount);
-@@ -829,7 +844,6 @@ out_free_secdata:
- out_mnt:
- free_vfsmnt(mnt);
- out:
-- put_filesystem(type);
- return (struct vfsmount *)sb;
- }
-
-@@ -837,7 +851,7 @@ EXPORT_SYMBOL_GPL(do_kern_mount);
-
- struct vfsmount *kern_mount(struct file_system_type *type)
- {
-- return do_kern_mount(type->name, 0, type->name, NULL);
-+ return do_kern_mount(type, 0, type->name, NULL);
- }
-
- EXPORT_SYMBOL(kern_mount);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/bin.c linux-2.6.9-ve023stab030/fs/sysfs/bin.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/bin.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/bin.c 2006-10-11 19:07:57.000000000 +0400
-@@ -158,6 +158,11 @@ struct file_operations bin_fops = {
-
- int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
- {
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
-+
- BUG_ON(!kobj || !kobj->dentry || !attr);
-
- return sysfs_add_file(kobj->dentry, &attr->attr, SYSFS_KOBJ_BIN_ATTR);
-@@ -173,6 +178,10 @@ int sysfs_create_bin_file(struct kobject
-
- int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr)
- {
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- sysfs_hash_and_remove(kobj->dentry,attr->attr.name);
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/dir.c linux-2.6.9-ve023stab030/fs/sysfs/dir.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/dir.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/dir.c 2006-10-11 19:07:57.000000000 +0400
-@@ -138,12 +138,16 @@ int sysfs_create_dir(struct kobject * ko
- struct dentry * parent;
- int error = 0;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- BUG_ON(!kobj);
-
- if (kobj->parent)
- parent = kobj->parent->dentry;
-- else if (sysfs_mount && sysfs_mount->mnt_sb)
-- parent = sysfs_mount->mnt_sb->s_root;
-+ else if (visible_sysfs_mount && visible_sysfs_mount->mnt_sb)
-+ parent = visible_sysfs_mount->mnt_sb->s_root;
- else
- return -EFAULT;
-
-@@ -267,11 +271,16 @@ void sysfs_remove_subdir(struct dentry *
-
- void sysfs_remove_dir(struct kobject * kobj)
- {
-- struct dentry * dentry = dget(kobj->dentry);
-+ struct dentry * dentry;
- struct sysfs_dirent * parent_sd;
- struct sysfs_dirent * sd, * tmp;
-
-- if (!dentry)
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return;
-+#endif
-+ dentry = dget(kobj->dentry);
-+ if (!dentry)
- return;
-
- pr_debug("sysfs %s: removing dir\n",dentry->d_name.name);
-@@ -298,6 +307,10 @@ int sysfs_rename_dir(struct kobject * ko
- int error = 0;
- struct dentry * new_dentry, * parent;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- if (!strcmp(kobject_name(kobj), new_name))
- return -EINVAL;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/file.c linux-2.6.9-ve023stab030/fs/sysfs/file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/file.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/file.c 2006-10-11 19:07:57.000000000 +0400
-@@ -378,6 +378,10 @@ int sysfs_add_file(struct dentry * dir,
-
- int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
- {
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- BUG_ON(!kobj || !kobj->dentry || !attr);
-
- return sysfs_add_file(kobj->dentry, attr, SYSFS_KOBJ_ATTR);
-@@ -399,6 +403,10 @@ int sysfs_update_file(struct kobject * k
- struct dentry * victim;
- int res = -ENOENT;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- down(&dir->d_inode->i_sem);
- victim = sysfs_get_dentry(dir, attr->name);
- if (!IS_ERR(victim)) {
-@@ -437,6 +445,10 @@ int sysfs_update_file(struct kobject * k
-
- void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
- {
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return;
-+#endif
- sysfs_hash_and_remove(kobj->dentry,attr->name);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/group.c linux-2.6.9-ve023stab030/fs/sysfs/group.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/group.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/group.c 2006-10-11 19:07:57.000000000 +0400
-@@ -45,6 +45,10 @@ int sysfs_create_group(struct kobject *
- struct dentry * dir;
- int error;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- BUG_ON(!kobj || !kobj->dentry);
-
- if (grp->name) {
-@@ -67,6 +71,10 @@ void sysfs_remove_group(struct kobject *
- {
- struct dentry * dir;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return;
-+#endif
- if (grp->name)
- dir = sysfs_get_dentry(kobj->dentry,grp->name);
- else
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/inode.c linux-2.6.9-ve023stab030/fs/sysfs/inode.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/inode.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/inode.c 2006-10-11 19:07:57.000000000 +0400
-@@ -8,12 +8,19 @@
-
- #undef DEBUG
-
-+#include <linux/config.h>
- #include <linux/pagemap.h>
- #include <linux/namei.h>
- #include <linux/backing-dev.h>
- #include "sysfs.h"
-
--extern struct super_block * sysfs_sb;
-+
-+#ifndef CONFIG_VE
-+extern struct super_block *sysfs_sb;
-+#define visible_sysfs_sb sysfs_sb
-+#else
-+#define visible_sysfs_sb (get_exec_env()->sysfs_sb)
-+#endif
-
- static struct address_space_operations sysfs_aops = {
- .readpage = simple_readpage,
-@@ -28,7 +35,7 @@ static struct backing_dev_info sysfs_bac
-
- struct inode * sysfs_new_inode(mode_t mode)
- {
-- struct inode * inode = new_inode(sysfs_sb);
-+ struct inode * inode = new_inode(visible_sysfs_sb);
- if (inode) {
- inode->i_mode = mode;
- inode->i_uid = 0;
-@@ -129,13 +136,17 @@ void sysfs_drop_dentry(struct sysfs_dire
-
- if (dentry) {
- spin_lock(&dcache_lock);
-+ spin_lock(&dentry->d_lock);
- if (!(d_unhashed(dentry) && dentry->d_inode)) {
- dget_locked(dentry);
- __d_drop(dentry);
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
- simple_unlink(parent->d_inode, dentry);
-- } else
-+ } else {
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
-+ }
- }
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/mount.c linux-2.6.9-ve023stab030/fs/sysfs/mount.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/mount.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/mount.c 2006-10-11 19:07:57.000000000 +0400
-@@ -7,6 +7,7 @@
- #include <linux/fs.h>
- #include <linux/mount.h>
- #include <linux/pagemap.h>
-+#include <linux/module.h>
- #include <linux/init.h>
-
- #include "sysfs.h"
-@@ -17,6 +18,15 @@
- struct vfsmount *sysfs_mount;
- struct super_block * sysfs_sb = NULL;
-
-+void prepare_sysfs(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->sysfs_mnt = sysfs_mount;
-+ sysfs_mount = (struct vfsmount *)SYSFS_MAGIC;
-+ /* ve0.sysfs_sb is setup by sysfs_fill_super() */
-+#endif
-+}
-+
- static struct super_operations sysfs_ops = {
- .statfs = simple_statfs,
- .drop_inode = generic_delete_inode,
-@@ -29,6 +39,14 @@ static struct sysfs_dirent sysfs_root =
- .s_type = SYSFS_ROOT,
- };
-
-+#ifdef CONFIG_VE
-+static void init_ve0_sysfs_root(void)
-+{
-+ get_ve0()->sysfs_root = &sysfs_root;
-+}
-+#define sysfs_root (*(get_exec_env()->sysfs_root))
-+#endif
-+
- static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
- {
- struct inode *inode;
-@@ -38,7 +56,7 @@ static int sysfs_fill_super(struct super
- sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
- sb->s_magic = SYSFS_MAGIC;
- sb->s_op = &sysfs_ops;
-- sysfs_sb = sb;
-+ visible_sysfs_sb = sb;
-
- inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO);
- if (inode) {
-@@ -68,16 +86,21 @@ static struct super_block *sysfs_get_sb(
- return get_sb_single(fs_type, flags, data, sysfs_fill_super);
- }
-
--static struct file_system_type sysfs_fs_type = {
-+struct file_system_type sysfs_fs_type = {
- .name = "sysfs",
- .get_sb = sysfs_get_sb,
- .kill_sb = kill_litter_super,
- };
-
-+EXPORT_SYMBOL(sysfs_fs_type);
-+
- int __init sysfs_init(void)
- {
- int err;
-
-+#ifdef CONFIG_VE
-+ init_ve0_sysfs_root();
-+#endif
- err = register_filesystem(&sysfs_fs_type);
- if (!err) {
- sysfs_mount = kern_mount(&sysfs_fs_type);
-@@ -87,5 +110,6 @@ int __init sysfs_init(void)
- sysfs_mount = NULL;
- }
- }
-+ prepare_sysfs();
- return err;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/symlink.c linux-2.6.9-ve023stab030/fs/sysfs/symlink.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/symlink.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/symlink.c 2006-10-11 19:07:57.000000000 +0400
-@@ -84,6 +84,10 @@ int sysfs_create_link(struct kobject * k
- struct dentry * dentry = kobj->dentry;
- int error = 0;
-
-+#ifdef CONFIG_VE
-+ if (!get_exec_env()->sysfs_sb)
-+ return 0;
-+#endif
- BUG_ON(!kobj || !kobj->dentry || !name);
-
- down(&dentry->d_inode->i_sem);
-@@ -101,6 +105,10 @@ int sysfs_create_link(struct kobject * k
-
- void sysfs_remove_link(struct kobject * kobj, char * name)
- {
-+#ifdef CONFIG_VE
-+ if(!get_exec_env()->sysfs_sb)
-+ return;
-+#endif
- sysfs_hash_and_remove(kobj->dentry,name);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysfs/sysfs.h linux-2.6.9-ve023stab030/fs/sysfs/sysfs.h
---- linux-2.6.9-42.0.3.EL.orig/fs/sysfs/sysfs.h 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysfs/sysfs.h 2006-10-11 19:07:57.000000000 +0400
-@@ -1,5 +1,13 @@
-
--extern struct vfsmount * sysfs_mount;
-+#ifndef CONFIG_VE
-+extern struct vfsmount *sysfs_mount;
-+extern struct super_block *sysfs_sb;
-+#define visible_sysfs_mount sysfs_mount
-+#define visible_sysfs_sb sysfs_sb
-+#else
-+#define visible_sysfs_mount (get_exec_env()->sysfs_mnt)
-+#define visible_sysfs_sb (get_exec_env()->sysfs_sb)
-+#endif
-
- extern struct inode * sysfs_new_inode(mode_t mode);
- extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *));
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/sysv/namei.c linux-2.6.9-ve023stab030/fs/sysv/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/sysv/namei.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/sysv/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -114,7 +114,7 @@ static int sysv_symlink(struct inode * d
- goto out;
-
- sysv_set_inode(inode, 0);
-- err = page_symlink(inode, symname, l);
-+ err = page_symlink(inode, symname, l, GFP_KERNEL);
- if (err)
- goto out_fail;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/udf/file.c linux-2.6.9-ve023stab030/fs/udf/file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/udf/file.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/udf/file.c 2006-10-11 19:07:55.000000000 +0400
-@@ -188,7 +188,7 @@ int udf_ioctl(struct inode *inode, struc
- {
- int result = -EINVAL;
-
-- if ( permission(inode, MAY_READ, NULL) != 0 )
-+ if ( permission(inode, MAY_READ, NULL, NULL) != 0 )
- {
- udf_debug("no permission to access inode %lu\n",
- inode->i_ino);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/ufs/namei.c linux-2.6.9-ve023stab030/fs/ufs/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/ufs/namei.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/ufs/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -156,7 +156,7 @@ static int ufs_symlink (struct inode * d
- /* slow symlink */
- inode->i_op = &page_symlink_inode_operations;
- inode->i_mapping->a_ops = &ufs_aops;
-- err = page_symlink(inode, symname, l);
-+ err = page_symlink(inode, symname, l, GFP_KERNEL);
- if (err)
- goto out_fail;
- } else {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/umsdos/namei.c linux-2.6.9-ve023stab030/fs/umsdos/namei.c
---- linux-2.6.9-42.0.3.EL.orig/fs/umsdos/namei.c 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/umsdos/namei.c 2006-10-11 19:07:55.000000000 +0400
-@@ -499,7 +499,7 @@ static int umsdos_symlink_x (struct inod
- }
-
- len = strlen (symname) + 1;
-- ret = page_symlink(dentry->d_inode, symname, len);
-+ ret = page_symlink(dentry->d_inode, symname, len, GFP_KERNEL);
- if (ret < 0)
- goto out_unlink;
- out:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdq_file.c linux-2.6.9-ve023stab030/fs/vzdq_file.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdq_file.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdq_file.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,880 @@
-+/*
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains Virtuozzo quota files as proc entry implementation.
-+ * It is required for std quota tools to work correctly as they are expecting
-+ * aquota.user and aquota.group files.
-+ */
-+
-+#include <linux/ctype.h>
-+#include <linux/slab.h>
-+#include <linux/list.h>
-+#include <linux/module.h>
-+#include <linux/proc_fs.h>
-+#include <linux/sysctl.h>
-+#include <linux/mount.h>
-+#include <linux/namespace.h>
-+#include <linux/quotaio_v2.h>
-+#include <asm/uaccess.h>
-+
-+#include <linux/ve.h>
-+#include <linux/ve_proto.h>
-+#include <linux/vzdq_tree.h>
-+#include <linux/vzquota.h>
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * File read operation
-+ *
-+ * FIXME: functions in this section (as well as many functions in vzdq_ugid.c,
-+ * perhaps) abuse vz_quota_sem.
-+ * Taking a global semaphore for lengthy and user-controlled operations inside
-+ * VPSs is not a good idea in general.
-+ * In this case, the reasons for taking this semaphore are completely unclear,
-+ * especially taking into account that the only function that has comments
-+ * about the necessity to be called under this semaphore
-+ * (create_proc_quotafile) is actually called OUTSIDE it.
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+#define DQBLOCK_SIZE 1024
-+#define DQUOTBLKNUM 21U
-+#define DQTREE_DEPTH 4
-+#define TREENUM_2_BLKNUM(num) (((num) + 1) << 1)
-+#define ISINDBLOCK(num) ((num)%2 != 0)
-+#define FIRST_DATABLK 2 /* first even number */
-+#define LAST_IND_LEVEL (DQTREE_DEPTH - 1)
-+#define CONVERT_LEVEL(level) ((level) * (QUOTAID_EBITS/QUOTAID_BBITS))
-+#define GETLEVINDX(ind, lev) (((ind) >> QUOTAID_BBITS*(lev)) \
-+ & QUOTATREE_BMASK)
-+
-+#if (QUOTAID_EBITS / QUOTAID_BBITS) != (QUOTATREE_DEPTH / DQTREE_DEPTH)
-+#error xBITS and DQTREE_DEPTH does not correspond
-+#endif
-+
-+#define BLOCK_NOT_FOUND 1
-+
-+/* data for quota file -- one per proc entry */
-+struct quotatree_data {
-+ struct list_head list;
-+ struct vz_quota_master *qmblk;
-+ int type; /* type of the tree */
-+};
-+
-+/* serialized by vz_quota_sem */
-+static LIST_HEAD(qf_data_head);
-+
-+static const u_int32_t vzquota_magics[] = V2_INITQMAGICS;
-+static const u_int32_t vzquota_versions[] = V2_INITQVERSIONS;
-+
-+static inline loff_t get_depoff(int depth)
-+{
-+ loff_t res = 1;
-+ while (depth) {
-+ res += (1 << ((depth - 1)*QUOTAID_EBITS + 1));
-+ depth--;
-+ }
-+ return res;
-+}
-+
-+static inline loff_t get_blknum(loff_t num, int depth)
-+{
-+ loff_t res;
-+ res = (num << 1) + get_depoff(depth);
-+ return res;
-+}
-+
-+static int get_depth(loff_t num)
-+{
-+ int i;
-+ for (i = 0; i < DQTREE_DEPTH; i++) {
-+ if (num >= get_depoff(i) && (i == DQTREE_DEPTH - 1
-+ || num < get_depoff(i + 1)))
-+ return i;
-+ }
-+ return -1;
-+}
-+
-+static inline loff_t get_offset(loff_t num)
-+{
-+ loff_t res, tmp;
-+
-+ tmp = get_depth(num);
-+ if (tmp < 0)
-+ return -1;
-+ num -= get_depoff(tmp);
-+ BUG_ON(num < 0);
-+ res = num >> 1;
-+
-+ return res;
-+}
-+
-+static inline loff_t get_quot_blk_num(struct quotatree_tree *tree, int level)
-+{
-+ /* return maximum available block num */
-+ return tree->levels[level].freenum;
-+}
-+
-+static inline loff_t get_block_num(struct quotatree_tree *tree)
-+{
-+ loff_t ind_blk_num, quot_blk_num, max_ind, max_quot;
-+
-+ quot_blk_num = get_quot_blk_num(tree, CONVERT_LEVEL(DQTREE_DEPTH) - 1);
-+ max_quot = TREENUM_2_BLKNUM(quot_blk_num);
-+ ind_blk_num = get_quot_blk_num(tree, CONVERT_LEVEL(DQTREE_DEPTH - 1));
-+ max_ind = (quot_blk_num) ? get_blknum(ind_blk_num, LAST_IND_LEVEL)
-+ : get_blknum(ind_blk_num, 0);
-+
-+ return (max_ind > max_quot) ? max_ind + 1 : max_quot + 1;
-+}
-+
-+/* Write quota file header */
-+static int read_header(void *buf, struct quotatree_tree *tree,
-+ struct dq_info *dq_ugid_info, int type)
-+{
-+ struct v2_disk_dqheader *dqh;
-+ struct v2_disk_dqinfo *dq_disk_info;
-+
-+ dqh = buf;
-+ dq_disk_info = buf + sizeof(struct v2_disk_dqheader);
-+
-+ dqh->dqh_magic = vzquota_magics[type];
-+ dqh->dqh_version = vzquota_versions[type];
-+
-+ dq_disk_info->dqi_bgrace = dq_ugid_info[type].bexpire;
-+ dq_disk_info->dqi_igrace = dq_ugid_info[type].iexpire;
-+ dq_disk_info->dqi_flags = 0; /* no flags */
-+ dq_disk_info->dqi_blocks = get_block_num(tree);
-+ dq_disk_info->dqi_free_blk = 0; /* first block in the file */
-+ dq_disk_info->dqi_free_entry = FIRST_DATABLK;
-+
-+ return 0;
-+}
-+
-+static int get_block_child(int depth, struct quotatree_node *p, u_int32_t *buf)
-+{
-+ int i, j, lev_num;
-+
-+ lev_num = QUOTATREE_DEPTH/DQTREE_DEPTH - 1;
-+ for (i = 0; i < BLOCK_SIZE/sizeof(u_int32_t); i++) {
-+ struct quotatree_node *next, *parent;
-+
-+ parent = p;
-+ next = p;
-+ for (j = lev_num; j >= 0; j--) {
-+ if (!next->blocks[GETLEVINDX(i,j)]) {
-+ buf[i] = 0;
-+ goto bad_branch;
-+ }
-+ parent = next;
-+ next = next->blocks[GETLEVINDX(i,j)];
-+ }
-+ buf[i] = (depth == DQTREE_DEPTH - 1) ?
-+ TREENUM_2_BLKNUM(parent->num)
-+ : get_blknum(next->num, depth + 1);
-+
-+ bad_branch:
-+ ;
-+ }
-+
-+ return 0;
-+}
-+
-+/*
-+ * Write index block to disk (or buffer)
-+ * @buf has length 256*sizeof(u_int32_t) bytes
-+ */
-+static int read_index_block(int num, u_int32_t *buf,
-+ struct quotatree_tree *tree)
-+{
-+ struct quotatree_node *p;
-+ u_int32_t index;
-+ loff_t off;
-+ int depth, res;
-+
-+ res = BLOCK_NOT_FOUND;
-+ index = 0;
-+ depth = get_depth(num);
-+ off = get_offset(num);
-+ if (depth < 0 || off < 0)
-+ return -EINVAL;
-+
-+ list_for_each_entry(p, &tree->levels[CONVERT_LEVEL(depth)].usedlh,
-+ list) {
-+ if (p->num >= off)
-+ res = 0;
-+ if (p->num != off)
-+ continue;
-+ get_block_child(depth, p, buf);
-+ break;
-+ }
-+
-+ return res;
-+}
-+
-+static inline void convert_quot_format(struct v2_disk_dqblk *dq,
-+ struct vz_quota_ugid *vzq)
-+{
-+ dq->dqb_id = vzq->qugid_id;
-+ dq->dqb_ihardlimit = vzq->qugid_stat.ihardlimit;
-+ dq->dqb_isoftlimit = vzq->qugid_stat.isoftlimit;
-+ dq->dqb_curinodes = vzq->qugid_stat.icurrent;
-+ dq->dqb_bhardlimit = vzq->qugid_stat.bhardlimit / QUOTABLOCK_SIZE;
-+ dq->dqb_bsoftlimit = vzq->qugid_stat.bsoftlimit / QUOTABLOCK_SIZE;
-+ dq->dqb_curspace = vzq->qugid_stat.bcurrent;
-+ dq->dqb_btime = vzq->qugid_stat.btime;
-+ dq->dqb_itime = vzq->qugid_stat.itime;
-+}
-+
-+static int read_dquot(loff_t num, void *buf, struct quotatree_tree *tree)
-+{
-+ int res, i, entries = 0;
-+ struct v2_disk_dqdbheader *dq_header;
-+ struct quotatree_node *p;
-+ struct v2_disk_dqblk *blk = buf + sizeof(struct v2_disk_dqdbheader);
-+
-+ res = BLOCK_NOT_FOUND;
-+ dq_header = buf;
-+ memset(dq_header, 0, sizeof(*dq_header));
-+
-+ list_for_each_entry(p, &(tree->levels[QUOTATREE_DEPTH - 1].usedlh),
-+ list) {
-+ if (TREENUM_2_BLKNUM(p->num) >= num)
-+ res = 0;
-+ if (TREENUM_2_BLKNUM(p->num) != num)
-+ continue;
-+
-+ for (i = 0; i < QUOTATREE_BSIZE; i++) {
-+ if (!p->blocks[i])
-+ continue;
-+ convert_quot_format(blk + entries,
-+ (struct vz_quota_ugid *)p->blocks[i]);
-+ entries++;
-+ res = 0;
-+ }
-+ break;
-+ }
-+ dq_header->dqdh_entries = entries;
-+
-+ return res;
-+}
-+
-+static int read_block(int num, void *buf, struct quotatree_tree *tree,
-+ struct dq_info *dq_ugid_info, int magic)
-+{
-+ int res;
-+
-+ memset(buf, 0, DQBLOCK_SIZE);
-+ if (!num)
-+ res = read_header(buf, tree, dq_ugid_info, magic);
-+ else if (ISINDBLOCK(num))
-+ res = read_index_block(num, (u_int32_t*)buf, tree);
-+ else
-+ res = read_dquot(num, buf, tree);
-+
-+ return res;
-+}
-+
-+/*
-+ * FIXME: this function can handle quota files up to 2GB only.
-+ */
-+static int read_proc_quotafile(char *page, char **start, off_t off, int count,
-+ int *eof, void *data)
-+{
-+ off_t blk_num, blk_off, buf_off;
-+ char *tmp;
-+ size_t buf_size;
-+ struct quotatree_data *qtd;
-+ struct quotatree_tree *tree;
-+ struct dq_info *dqi;
-+ int res;
-+
-+ tmp = kmalloc(DQBLOCK_SIZE, GFP_KERNEL);
-+ if (!tmp)
-+ return -ENOMEM;
-+
-+ qtd = data;
-+ down(&vz_quota_sem);
-+ down(&qtd->qmblk->dq_sem);
-+
-+ res = 0;
-+ tree = QUGID_TREE(qtd->qmblk, qtd->type);
-+ if (!tree) {
-+ *eof = 1;
-+ goto out_dq;
-+ }
-+
-+ dqi = &qtd->qmblk->dq_ugid_info[qtd->type];
-+
-+ buf_off = 0;
-+ buf_size = count;
-+ blk_num = off / DQBLOCK_SIZE;
-+ blk_off = off % DQBLOCK_SIZE;
-+
-+ while (buf_size > 0) {
-+ off_t len;
-+
-+ len = min((size_t)(DQBLOCK_SIZE-blk_off), buf_size);
-+ res = read_block(blk_num, tmp, tree, dqi, qtd->type);
-+ if (res < 0)
-+ goto out_err;
-+ if (res == BLOCK_NOT_FOUND) {
-+ *eof = 1;
-+ break;
-+ }
-+ memcpy(page + buf_off, tmp + blk_off, len);
-+
-+ blk_num++;
-+ buf_size -= len;
-+ blk_off = 0;
-+ buf_off += len;
-+ }
-+ res = buf_off;
-+
-+out_err:
-+ *start = NULL + count;
-+out_dq:
-+ up(&qtd->qmblk->dq_sem);
-+ up(&vz_quota_sem);
-+ kfree(tmp);
-+
-+ return res;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * /proc/vz/vzaquota/QID/aquota.* files
-+ *
-+ * FIXME: this code lacks serialization of read/readdir/lseek.
-+ * However, this problem should be fixed after the mainstream issue of what
-+ * appears to be non-atomic read and update of file position in sys_read.
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+static inline unsigned long vzdq_aquot_getino(dev_t dev)
-+{
-+ return 0xec000000UL + dev;
-+}
-+
-+static inline dev_t vzdq_aquot_getidev(struct inode *inode)
-+{
-+ return (dev_t)(unsigned long)PROC_I(inode)->op.proc_get_link;
-+}
-+
-+static inline void vzdq_aquot_setidev(struct inode *inode, dev_t dev)
-+{
-+ PROC_I(inode)->op.proc_get_link = (void *)(unsigned long)dev;
-+}
-+
-+static ssize_t vzdq_aquotf_read(struct file *file,
-+ char __user *buf, size_t size, loff_t *ppos)
-+{
-+ char *page;
-+ size_t bufsize;
-+ ssize_t l, l2, copied;
-+ char *start;
-+ struct inode *inode;
-+ struct block_device *bdev;
-+ struct super_block *sb;
-+ struct quotatree_data data;
-+ int eof, err;
-+
-+ err = -ENOMEM;
-+ page = (char *)__get_free_page(GFP_KERNEL);
-+ if (page == NULL)
-+ goto out_err;
-+
-+ err = -ENODEV;
-+ inode = file->f_dentry->d_inode;
-+ bdev = bdget(vzdq_aquot_getidev(inode));
-+ if (bdev == NULL)
-+ goto out_err;
-+ sb = get_super(bdev);
-+ bdput(bdev);
-+ if (sb == NULL)
-+ goto out_err;
-+ data.qmblk = vzquota_find_qmblk(sb);
-+ data.type = PROC_I(inode)->type - 1;
-+ drop_super(sb);
-+ if (data.qmblk == NULL || data.qmblk == VZ_QUOTA_BAD)
-+ goto out_err;
-+
-+ copied = 0;
-+ l = l2 = 0;
-+ while (1) {
-+ bufsize = min(size, (size_t)PAGE_SIZE);
-+ if (bufsize <= 0)
-+ break;
-+
-+ l = read_proc_quotafile(page, &start, *ppos, bufsize,
-+ &eof, &data);
-+ if (l <= 0)
-+ break;
-+
-+ l2 = copy_to_user(buf, page, l);
-+ copied += l - l2;
-+ if (l2)
-+ break;
-+
-+ buf += l;
-+ size -= l;
-+ *ppos += (unsigned long)start;
-+ l = l2 = 0;
-+ }
-+
-+ qmblk_put(data.qmblk);
-+ free_page((unsigned long)page);
-+ if (copied)
-+ return copied;
-+ else if (l2) /* last copy_to_user failed */
-+ return -EFAULT;
-+ else /* read error or EOF */
-+ return l;
-+
-+out_err:
-+ if (page != NULL)
-+ free_page((unsigned long)page);
-+ return err;
-+}
-+
-+static struct file_operations vzdq_aquotf_file_operations = {
-+ .read = &vzdq_aquotf_read,
-+};
-+
-+static struct inode_operations vzdq_aquotf_inode_operations = {
-+};
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * /proc/vz/vzaquota/QID directory
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+static int vzdq_aquotq_readdir(struct file *file, void *data, filldir_t filler)
-+{
-+ loff_t n;
-+ int err;
-+
-+ n = file->f_pos;
-+ for (err = 0; !err; n++) {
-+ switch (n) {
-+ case 0:
-+ err = (*filler)(data, ".", 1, n,
-+ file->f_dentry->d_inode->i_ino,
-+ DT_DIR);
-+ break;
-+ case 1:
-+ err = (*filler)(data, "..", 2, n,
-+ parent_ino(file->f_dentry), DT_DIR);
-+ break;
-+ case 2:
-+ err = (*filler)(data, "aquota.user", 11, n,
-+ file->f_dentry->d_inode->i_ino
-+ + USRQUOTA + 1,
-+ DT_REG);
-+ break;
-+ case 3:
-+ err = (*filler)(data, "aquota.group", 12, n,
-+ file->f_dentry->d_inode->i_ino
-+ + GRPQUOTA + 1,
-+ DT_REG);
-+ break;
-+ default:
-+ goto out;
-+ }
-+ }
-+out:
-+ file->f_pos = n;
-+ return err;
-+}
-+
-+struct vzdq_aquotq_lookdata {
-+ dev_t dev;
-+ int type;
-+};
-+
-+static int vzdq_aquotq_looktest(struct inode *inode, void *data)
-+{
-+ struct vzdq_aquotq_lookdata *d;
-+
-+ d = data;
-+ return inode->i_op == &vzdq_aquotf_inode_operations &&
-+ vzdq_aquot_getidev(inode) == d->dev &&
-+ PROC_I(inode)->type == d->type + 1;
-+}
-+
-+static int vzdq_aquotq_lookset(struct inode *inode, void *data)
-+{
-+ struct vzdq_aquotq_lookdata *d;
-+ struct super_block *sb;
-+ struct quotatree_data qtd;
-+ struct quotatree_tree *tree;
-+
-+ d = data;
-+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-+ inode->i_ino = vzdq_aquot_getino(d->dev) + d->type + 1;
-+ inode->i_mode = S_IFREG | S_IRUSR;
-+ inode->i_uid = 0;
-+ inode->i_gid = 0;
-+ inode->i_nlink = 1;
-+ inode->i_op = &vzdq_aquotf_inode_operations;
-+ inode->i_fop = &vzdq_aquotf_file_operations;
-+ PROC_I(inode)->type = d->type + 1;
-+ vzdq_aquot_setidev(inode, d->dev);
-+
-+ /* Setting size */
-+ sb = user_get_super(d->dev);
-+ if (sb == NULL)
-+ return -ENODEV;
-+ qtd.qmblk = vzquota_find_qmblk(sb);
-+ drop_super(sb);
-+
-+ if (qtd.qmblk == NULL)
-+ return -ESRCH;
-+ if (qtd.qmblk == VZ_QUOTA_BAD)
-+ return -EIO;
-+
-+ qtd.type = PROC_I(inode)->type - 1;
-+ tree = QUGID_TREE(qtd.qmblk, qtd.type);
-+ inode->i_size = get_block_num(tree) * 1024;
-+ return 0;
-+}
-+
-+static int vzdq_aquotq_revalidate(struct dentry *vdentry, struct nameidata *nd)
-+{
-+ return 0;
-+}
-+
-+static struct dentry_operations vzdq_aquotq_dentry_operations = {
-+ .d_revalidate = &vzdq_aquotq_revalidate,
-+};
-+
-+static struct dentry *vzdq_aquotq_lookup(struct inode *dir,
-+ struct dentry *dentry,
-+ struct nameidata *nd)
-+{
-+ struct inode *inode;
-+ struct vzdq_aquotq_lookdata d;
-+ int k;
-+
-+ if (dentry->d_name.len == 11) {
-+ if (memcmp(dentry->d_name.name, "aquota.user", 11))
-+ goto out;
-+ k = USRQUOTA;
-+ } else if (dentry->d_name.len == 12) {
-+ if (memcmp(dentry->d_name.name, "aquota.group", 11))
-+ goto out;
-+ k = GRPQUOTA;
-+ } else
-+ goto out;
-+ d.dev = vzdq_aquot_getidev(dir);
-+ d.type = k;
-+ inode = iget5_locked(dir->i_sb, dir->i_ino + k + 1,
-+ vzdq_aquotq_looktest, vzdq_aquotq_lookset, &d);
-+ if (inode == NULL)
-+ goto out;
-+ unlock_new_inode(inode);
-+ dentry->d_op = &vzdq_aquotq_dentry_operations;
-+ d_add(dentry, inode);
-+ return NULL;
-+
-+out:
-+ return ERR_PTR(-ENOENT);
-+}
-+
-+static struct file_operations vzdq_aquotq_file_operations = {
-+ .read = &generic_read_dir,
-+ .readdir = &vzdq_aquotq_readdir,
-+};
-+
-+static struct inode_operations vzdq_aquotq_inode_operations = {
-+ .lookup = &vzdq_aquotq_lookup,
-+};
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * /proc/vz/vzaquota directory
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+struct vzdq_aquot_de {
-+ struct list_head list;
-+ struct vfsmount *mnt;
-+};
-+
-+static int vzdq_aquot_buildmntlist(struct ve_struct *ve,
-+ struct list_head *head)
-+{
-+ struct vfsmount *rmnt, *mnt;
-+ struct vzdq_aquot_de *p;
-+ int err;
-+
-+#ifdef CONFIG_VE
-+ rmnt = mntget(ve->fs_rootmnt);
-+#else
-+ read_lock(&current->fs->lock);
-+ rmnt = mntget(current->fs->rootmnt);
-+ read_unlock(&current->fs->lock);
-+#endif
-+ mnt = rmnt;
-+ down_read(&rmnt->mnt_namespace->sem);
-+ while (1) {
-+ list_for_each_entry(p, head, list) {
-+ if (p->mnt->mnt_sb == mnt->mnt_sb)
-+ goto skip;
-+ }
-+
-+ err = -ENOMEM;
-+ p = kmalloc(sizeof(*p), GFP_KERNEL);
-+ if (p == NULL)
-+ goto out;
-+ p->mnt = mntget(mnt);
-+ list_add_tail(&p->list, head);
-+
-+skip:
-+ err = 0;
-+ if (list_empty(&mnt->mnt_mounts)) {
-+ while (1) {
-+ if (mnt == rmnt)
-+ goto out;
-+ if (mnt->mnt_child.next !=
-+ &mnt->mnt_parent->mnt_mounts)
-+ break;
-+ mnt = mnt->mnt_parent;
-+ }
-+ mnt = list_entry(mnt->mnt_child.next,
-+ struct vfsmount, mnt_child);
-+ } else
-+ mnt = list_first_entry(&mnt->mnt_mounts,
-+ struct vfsmount, mnt_child);
-+ }
-+out:
-+ up_read(&rmnt->mnt_namespace->sem);
-+ mntput(rmnt);
-+ return err;
-+}
-+
-+static void vzdq_aquot_releasemntlist(struct ve_struct *ve,
-+ struct list_head *head)
-+{
-+ struct vzdq_aquot_de *p;
-+
-+ while (!list_empty(head)) {
-+ p = list_first_entry(head, typeof(*p), list);
-+ mntput(p->mnt);
-+ list_del(&p->list);
-+ kfree(p);
-+ }
-+}
-+
-+static int vzdq_aquotd_readdir(struct file *file, void *data, filldir_t filler)
-+{
-+ struct ve_struct *ve, *old_ve;
-+ struct list_head mntlist;
-+ struct vzdq_aquot_de *de;
-+ struct super_block *sb;
-+ struct vz_quota_master *qmblk;
-+ loff_t i, n;
-+ char buf[24];
-+ int l, err;
-+
-+ i = 0;
-+ n = file->f_pos;
-+ ve = VE_OWNER_FSTYPE(file->f_dentry->d_sb->s_type);
-+ old_ve = set_exec_env(ve);
-+
-+ INIT_LIST_HEAD(&mntlist);
-+#ifdef CONFIG_VE
-+ /*
-+ * The only reason of disabling readdir for the host system is that
-+ * this readdir can be slow and CPU consuming with large number of VPSs
-+ * (or just mount points).
-+ */
-+ err = ve_is_super(ve);
-+#else
-+ err = 0;
-+#endif
-+ if (!err) {
-+ err = vzdq_aquot_buildmntlist(ve, &mntlist);
-+ if (err)
-+ goto out_err;
-+ }
-+
-+ if (i >= n) {
-+ if ((*filler)(data, ".", 1, i,
-+ file->f_dentry->d_inode->i_ino, DT_DIR))
-+ goto out_fill;
-+ }
-+ i++;
-+
-+ if (i >= n) {
-+ if ((*filler)(data, "..", 2, i,
-+ parent_ino(file->f_dentry), DT_DIR))
-+ goto out_fill;
-+ }
-+ i++;
-+
-+ list_for_each_entry (de, &mntlist, list) {
-+ sb = de->mnt->mnt_sb;
-+#ifdef CONFIG_VE
-+ if (get_device_perms_ve(S_IFBLK, sb->s_dev, FMODE_QUOTACTL))
-+ continue;
-+#endif
-+ qmblk = vzquota_find_qmblk(sb);
-+ if (qmblk == NULL || qmblk == VZ_QUOTA_BAD)
-+ continue;
-+
-+ qmblk_put(qmblk);
-+ i++;
-+ if (i <= n)
-+ continue;
-+
-+ l = sprintf(buf, "%08x", new_encode_dev(sb->s_dev));
-+ if ((*filler)(data, buf, l, i - 1,
-+ vzdq_aquot_getino(sb->s_dev), DT_DIR))
-+ break;
-+ }
-+
-+out_fill:
-+ err = 0;
-+ file->f_pos = i;
-+out_err:
-+ vzdq_aquot_releasemntlist(ve, &mntlist);
-+ set_exec_env(old_ve);
-+ return err;
-+}
-+
-+static int vzdq_aquotd_looktest(struct inode *inode, void *data)
-+{
-+ return inode->i_op == &vzdq_aquotq_inode_operations &&
-+ vzdq_aquot_getidev(inode) == (dev_t)(unsigned long)data;
-+}
-+
-+static int vzdq_aquotd_lookset(struct inode *inode, void *data)
-+{
-+ dev_t dev;
-+
-+ dev = (dev_t)(unsigned long)data;
-+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-+ inode->i_ino = vzdq_aquot_getino(dev);
-+ inode->i_mode = S_IFDIR | S_IRUSR | S_IXUSR;
-+ inode->i_uid = 0;
-+ inode->i_gid = 0;
-+ inode->i_nlink = 2;
-+ inode->i_op = &vzdq_aquotq_inode_operations;
-+ inode->i_fop = &vzdq_aquotq_file_operations;
-+ vzdq_aquot_setidev(inode, dev);
-+ return 0;
-+}
-+
-+static struct dentry *vzdq_aquotd_lookup(struct inode *dir,
-+ struct dentry *dentry,
-+ struct nameidata *nd)
-+{
-+ struct ve_struct *ve, *old_ve;
-+ const unsigned char *s;
-+ int l;
-+ dev_t dev;
-+ struct inode *inode;
-+
-+ ve = VE_OWNER_FSTYPE(dir->i_sb->s_type);
-+ old_ve = set_exec_env(ve);
-+#ifdef CONFIG_VE
-+ /*
-+ * Lookup is much lighter than readdir, so it can be allowed for the
-+ * host system. But it would be strange to be able to do lookup only
-+ * without readdir...
-+ */
-+ if (ve_is_super(ve))
-+ goto out;
-+#endif
-+
-+ dev = 0;
-+ l = dentry->d_name.len;
-+ if (l <= 0)
-+ goto out;
-+ for (s = dentry->d_name.name; l > 0; s++, l--) {
-+ if (!isxdigit(*s))
-+ goto out;
-+ if (dev & ~(~0UL >> 4))
-+ goto out;
-+ dev <<= 4;
-+ if (isdigit(*s))
-+ dev += *s - '0';
-+ else if (islower(*s))
-+ dev += *s - 'a' + 10;
-+ else
-+ dev += *s - 'A' + 10;
-+ }
-+ dev = new_decode_dev(dev);
-+
-+#ifdef CONFIG_VE
-+ if (get_device_perms_ve(S_IFBLK, dev, FMODE_QUOTACTL))
-+ goto out;
-+#endif
-+
-+ inode = iget5_locked(dir->i_sb, vzdq_aquot_getino(dev),
-+ vzdq_aquotd_looktest, vzdq_aquotd_lookset,
-+ (void *)(unsigned long)dev);
-+ if (inode == NULL)
-+ goto out;
-+ unlock_new_inode(inode);
-+
-+ d_add(dentry, inode);
-+ set_exec_env(old_ve);
-+ return NULL;
-+
-+out:
-+ set_exec_env(old_ve);
-+ return ERR_PTR(-ENOENT);
-+}
-+
-+static struct file_operations vzdq_aquotd_file_operations = {
-+ .read = &generic_read_dir,
-+ .readdir = &vzdq_aquotd_readdir,
-+};
-+
-+static struct inode_operations vzdq_aquotd_inode_operations = {
-+ .lookup = &vzdq_aquotd_lookup,
-+};
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Initialization and deinitialization
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * FIXME: creation of proc entries here is unsafe with respect to module
-+ * unloading.
-+ */
-+void vzaquota_init(void)
-+{
-+ struct proc_dir_entry *de;
-+
-+ de = create_proc_glob_entry("vz/vzaquota",
-+ S_IFDIR | S_IRUSR | S_IXUSR, NULL);
-+ if (de != NULL) {
-+ de->proc_iops = &vzdq_aquotd_inode_operations;
-+ de->proc_fops = &vzdq_aquotd_file_operations;
-+ } else
-+ printk("VZDQ: vz/vzaquota creation failed\n");
-+#if defined(CONFIG_SYSCTL)
-+ de = create_proc_glob_entry("sys/fs/quota",
-+ S_IFDIR | S_IRUSR | S_IXUSR, NULL);
-+ if (de == NULL)
-+ printk("VZDQ: sys/fs/quota creation failed\n");
-+#endif
-+}
-+
-+void vzaquota_fini(void)
-+{
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdq_mgmt.c linux-2.6.9-ve023stab030/fs/vzdq_mgmt.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdq_mgmt.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdq_mgmt.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,724 @@
-+/*
-+ * Copyright (C) 2001, 2002, 2004, 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <linux/string.h>
-+#include <linux/list.h>
-+#include <asm/semaphore.h>
-+#include <linux/sched.h>
-+#include <linux/fs.h>
-+#include <linux/dcache.h>
-+#include <linux/mount.h>
-+#include <linux/namei.h>
-+#include <linux/writeback.h>
-+#include <linux/gfp.h>
-+#include <asm/uaccess.h>
-+#include <linux/proc_fs.h>
-+#include <linux/quota.h>
-+#include <linux/vzctl_quota.h>
-+#include <linux/vzquota.h>
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Switching quota on.
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * check limits copied from user
-+ */
-+int vzquota_check_sane_limits(struct dq_stat *qstat)
-+{
-+ int err;
-+
-+ err = -EINVAL;
-+
-+ /* softlimit must be less then hardlimit */
-+ if (qstat->bsoftlimit > qstat->bhardlimit)
-+ goto out;
-+
-+ if (qstat->isoftlimit > qstat->ihardlimit)
-+ goto out;
-+
-+ err = 0;
-+out:
-+ return err;
-+}
-+
-+/*
-+ * check usage values copied from user
-+ */
-+int vzquota_check_sane_values(struct dq_stat *qstat)
-+{
-+ int err;
-+
-+ err = -EINVAL;
-+
-+ /* expiration time must not be set if softlimit was not exceeded */
-+ if (qstat->bcurrent < qstat->bsoftlimit && qstat->btime != (time_t)0)
-+ goto out;
-+
-+ if (qstat->icurrent < qstat->isoftlimit && qstat->itime != (time_t)0)
-+ goto out;
-+
-+ err = vzquota_check_sane_limits(qstat);
-+out:
-+ return err;
-+}
-+
-+/*
-+ * create new quota master block
-+ * this function should:
-+ * - copy limits and usage parameters from user buffer;
-+ * - allock, initialize quota block and insert it to hash;
-+ */
-+static int vzquota_create(unsigned int quota_id, struct vz_quota_stat *u_qstat)
-+{
-+ int err;
-+ struct vz_quota_stat qstat;
-+ struct vz_quota_master *qmblk;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -EFAULT;
-+ if (copy_from_user(&qstat, u_qstat, sizeof(qstat)))
-+ goto out;
-+
-+ err = -EINVAL;
-+ if (quota_id == 0)
-+ goto out;
-+
-+ if (vzquota_check_sane_values(&qstat.dq_stat))
-+ goto out;
-+ err = 0;
-+ qmblk = vzquota_alloc_master(quota_id, &qstat);
-+
-+ if (IS_ERR(qmblk)) /* ENOMEM or EEXIST */
-+ err = PTR_ERR(qmblk);
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+/**
-+ * vzquota_on - turn quota on
-+ *
-+ * This function should:
-+ * - find and get refcnt of directory entry for quota root and corresponding
-+ * mountpoint;
-+ * - find corresponding quota block and mark it with given path;
-+ * - check quota tree;
-+ * - initialize quota for the tree root.
-+ */
-+static int vzquota_on(unsigned int quota_id, const char *quota_root)
-+{
-+ int err;
-+ struct nameidata nd;
-+ struct vz_quota_master *qmblk;
-+ struct super_block *dqsb;
-+
-+ dqsb = NULL;
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EBUSY;
-+ if (qmblk->dq_state != VZDQ_STARTING)
-+ goto out;
-+
-+ err = user_path_walk(quota_root, &nd);
-+ if (err)
-+ goto out;
-+ /* init path must be a directory */
-+ err = -ENOTDIR;
-+ if (!S_ISDIR(nd.dentry->d_inode->i_mode))
-+ goto out_path;
-+
-+ qmblk->dq_root_dentry = nd.dentry;
-+ qmblk->dq_root_mnt = nd.mnt;
-+ qmblk->dq_sb = nd.dentry->d_inode->i_sb;
-+ err = vzquota_get_super(qmblk->dq_sb);
-+ if (err)
-+ goto out_super;
-+
-+ /*
-+ * Serialization with quota initialization and operations is performed
-+ * through generation check: generation is memorized before qmblk is
-+ * found and compared under inode_qmblk_lock with assignment.
-+ *
-+ * Note that the dentry tree is shrunk only for high-level logical
-+ * serialization, purely as a courtesy to the user: to have consistent
-+ * quota statistics, files should be closed etc. on quota on.
-+ */
-+ err = vzquota_on_qmblk(qmblk->dq_sb, qmblk->dq_root_dentry->d_inode,
-+ qmblk);
-+ if (err)
-+ goto out_init;
-+ qmblk->dq_state = VZDQ_WORKING;
-+
-+ up(&vz_quota_sem);
-+ return 0;
-+
-+out_init:
-+ dqsb = qmblk->dq_sb;
-+out_super:
-+ /* clear for qmblk_put/quota_free_master */
-+ qmblk->dq_sb = NULL;
-+ qmblk->dq_root_dentry = NULL;
-+ qmblk->dq_root_mnt = NULL;
-+out_path:
-+ path_release(&nd);
-+out:
-+ if (dqsb)
-+ vzquota_put_super(dqsb);
-+ up(&vz_quota_sem);
-+ return err;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Switching quota off.
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * destroy quota block by ID
-+ */
-+static int vzquota_destroy(unsigned int quota_id)
-+{
-+ int err;
-+ struct vz_quota_master *qmblk;
-+ struct dentry *dentry;
-+ struct vfsmount *mnt;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EBUSY;
-+ if (qmblk->dq_state == VZDQ_WORKING)
-+ goto out; /* quota_off first */
-+
-+ list_del_init(&qmblk->dq_hash);
-+ dentry = qmblk->dq_root_dentry;
-+ qmblk->dq_root_dentry = NULL;
-+ mnt = qmblk->dq_root_mnt;
-+ qmblk->dq_root_mnt = NULL;
-+
-+ if (qmblk->dq_sb)
-+ vzquota_put_super(qmblk->dq_sb);
-+ up(&vz_quota_sem);
-+
-+ qmblk_put(qmblk);
-+ dput(dentry);
-+ mntput(mnt);
-+ return 0;
-+
-+out:
-+ up(&vz_quota_sem);
-+ return err;
-+}
-+
-+/**
-+ * vzquota_off - turn quota off
-+ */
-+
-+static int __vzquota_sync_list(struct list_head *lh,
-+ struct vz_quota_master *qmblk,
-+ enum writeback_sync_modes sync_mode)
-+{
-+ struct writeback_control wbc;
-+ LIST_HEAD(list);
-+ struct vz_quota_ilink *qlnk;
-+ struct inode *inode;
-+ int err, ret;
-+
-+ memset(&wbc, 0, sizeof(wbc));
-+ wbc.sync_mode = sync_mode;
-+
-+ err = ret = 0;
-+ while (!list_empty(lh)) {
-+ if (need_resched()) {
-+ inode_qmblk_unlock(qmblk->dq_sb);
-+ schedule();
-+ inode_qmblk_lock(qmblk->dq_sb);
-+ continue;
-+ }
-+
-+ qlnk = list_first_entry(lh, struct vz_quota_ilink, list);
-+ list_move(&qlnk->list, &list);
-+
-+ inode = igrab(QLNK_INODE(qlnk));
-+ if (!inode)
-+ continue;
-+
-+ inode_qmblk_unlock(qmblk->dq_sb);
-+
-+ wbc.nr_to_write = LONG_MAX;
-+ ret = sync_inode(inode, &wbc);
-+ if (ret)
-+ err = ret;
-+ iput(inode);
-+
-+ inode_qmblk_lock(qmblk->dq_sb);
-+ }
-+
-+ list_splice(&list, lh);
-+ return err;
-+}
-+
-+static int vzquota_sync_list(struct list_head *lh,
-+ struct vz_quota_master *qmblk)
-+{
-+ (void)__vzquota_sync_list(lh, qmblk, WB_SYNC_NONE);
-+ return __vzquota_sync_list(lh, qmblk, WB_SYNC_ALL);
-+}
-+
-+static int vzquota_sync_inodes(struct vz_quota_master *qmblk)
-+{
-+ int err;
-+ LIST_HEAD(qlnk_list);
-+
-+ list_splice_init(&qmblk->dq_ilink_list, &qlnk_list);
-+ err = vzquota_sync_list(&qlnk_list, qmblk);
-+ if (!err && !list_empty(&qmblk->dq_ilink_list))
-+ err = -EBUSY;
-+ list_splice(&qlnk_list, &qmblk->dq_ilink_list);
-+
-+ return err;
-+}
-+
-+static int vzquota_off(unsigned int quota_id)
-+{
-+ int err, ret;
-+ struct vz_quota_master *qmblk;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EALREADY;
-+ if (qmblk->dq_state != VZDQ_WORKING)
-+ goto out;
-+
-+ inode_qmblk_lock(qmblk->dq_sb); /* protects dq_ilink_list also */
-+ ret = vzquota_sync_inodes(qmblk);
-+ inode_qmblk_unlock(qmblk->dq_sb);
-+
-+ err = vzquota_off_qmblk(qmblk->dq_sb, qmblk);
-+ if (err)
-+ goto out;
-+
-+ err = ret;
-+ /* vzquota_destroy will free resources */
-+ qmblk->dq_state = VZDQ_STOPING;
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Other VZQUOTA ioctl's.
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * this function should:
-+ * - set new limits/buffer under quota master block lock
-+ * - if new softlimit less then usage, then set expiration time
-+ * - no need to alloc ugid hash table - we'll do that on demand
-+ */
-+int vzquota_update_limit(struct dq_stat *_qstat,
-+ struct dq_stat *qstat)
-+{
-+ int err;
-+
-+ err = -EINVAL;
-+ if (vzquota_check_sane_limits(qstat))
-+ goto out;
-+
-+ err = 0;
-+
-+ /* limits */
-+ _qstat->bsoftlimit = qstat->bsoftlimit;
-+ _qstat->bhardlimit = qstat->bhardlimit;
-+ /*
-+ * If the soft limit is exceeded, administrator can override the moment
-+ * when the grace period for limit exceeding ends.
-+ * Specifying the moment may be useful if the soft limit is set to be
-+ * lower than the current usage. In the latter case, if the grace
-+ * period end isn't specified, the grace period will start from the
-+ * moment of the first write operation.
-+ * There is a race with the user level. Soft limit may be already
-+ * exceeded before the limit change, and grace period end calculated by
-+ * the kernel will be overriden. User level may check if the limit is
-+ * already exceeded, but check and set calls are not atomic.
-+ * This race isn't dangerous. Under normal cicrumstances, the
-+ * difference between the grace period end calculated by the kernel and
-+ * the user level should be not greater than as the difference between
-+ * the moments of check and set calls, i.e. not bigger than the quota
-+ * timer resolution - 1 sec.
-+ */
-+ if (qstat->btime != (time_t)0 &&
-+ _qstat->bcurrent >= _qstat->bsoftlimit)
-+ _qstat->btime = qstat->btime;
-+
-+ _qstat->isoftlimit = qstat->isoftlimit;
-+ _qstat->ihardlimit = qstat->ihardlimit;
-+ if (qstat->itime != (time_t)0 &&
-+ _qstat->icurrent >= _qstat->isoftlimit)
-+ _qstat->itime = qstat->itime;
-+
-+out:
-+ return err;
-+}
-+
-+/*
-+ * set new quota limits.
-+ * this function should:
-+ * copy new limits from user level
-+ * - find quota block
-+ * - set new limits and flags.
-+ */
-+static int vzquota_setlimit(unsigned int quota_id,
-+ struct vz_quota_stat *u_qstat)
-+{
-+ int err;
-+ struct vz_quota_stat qstat;
-+ struct vz_quota_master *qmblk;
-+
-+ down(&vz_quota_sem); /* for hash list protection */
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EFAULT;
-+ if (copy_from_user(&qstat, u_qstat, sizeof(qstat)))
-+ goto out;
-+
-+ qmblk_data_write_lock(qmblk);
-+ err = vzquota_update_limit(&qmblk->dq_stat, &qstat.dq_stat);
-+ if (err == 0)
-+ qmblk->dq_info = qstat.dq_info;
-+ qmblk_data_write_unlock(qmblk);
-+
-+out:
-+ up(&vz_quota_sem);
-+ return err;
-+}
-+
-+/*
-+ * get quota limits.
-+ * very simple - just return stat buffer to user
-+ */
-+static int vzquota_getstat(unsigned int quota_id,
-+ struct vz_quota_stat *u_qstat)
-+{
-+ int err;
-+ struct vz_quota_stat qstat;
-+ struct vz_quota_master *qmblk;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ qmblk_data_read_lock(qmblk);
-+ /* copy whole buffer under lock */
-+ memcpy(&qstat.dq_stat, &qmblk->dq_stat, sizeof(qstat.dq_stat));
-+ memcpy(&qstat.dq_info, &qmblk->dq_info, sizeof(qstat.dq_info));
-+ qmblk_data_read_unlock(qmblk);
-+
-+ err = copy_to_user(u_qstat, &qstat, sizeof(qstat));
-+ if (err)
-+ err = -EFAULT;
-+
-+out:
-+ up(&vz_quota_sem);
-+ return err;
-+}
-+
-+/*
-+ * This is a system call to turn per-VE disk quota on.
-+ * Note this call is allowed to run ONLY from VE0
-+ */
-+long do_vzquotactl(int cmd, unsigned int quota_id,
-+ struct vz_quota_stat *qstat, const char *ve_root)
-+{
-+ int ret;
-+
-+ ret = -EPERM;
-+ /* access allowed only from root of VE0 */
-+ if (!capable(CAP_SYS_RESOURCE) ||
-+ !capable(CAP_SYS_ADMIN))
-+ goto out;
-+
-+ switch (cmd) {
-+ case VZ_DQ_CREATE:
-+ ret = vzquota_create(quota_id, qstat);
-+ break;
-+ case VZ_DQ_DESTROY:
-+ ret = vzquota_destroy(quota_id);
-+ break;
-+ case VZ_DQ_ON:
-+ ret = vzquota_on(quota_id, ve_root);
-+ break;
-+ case VZ_DQ_OFF:
-+ ret = vzquota_off(quota_id);
-+ break;
-+ case VZ_DQ_SETLIMIT:
-+ ret = vzquota_setlimit(quota_id, qstat);
-+ break;
-+ case VZ_DQ_GETSTAT:
-+ ret = vzquota_getstat(quota_id, qstat);
-+ break;
-+
-+ default:
-+ ret = -EINVAL;
-+ goto out;
-+ }
-+
-+out:
-+ return ret;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Proc filesystem routines
-+ * ---------------------------------------------------------------------*/
-+
-+#if defined(CONFIG_PROC_FS)
-+
-+#define QUOTA_UINT_LEN 15
-+#define QUOTA_TIME_LEN_FMT_UINT "%11u"
-+#define QUOTA_NUM_LEN_FMT_UINT "%15u"
-+#define QUOTA_NUM_LEN_FMT_ULL "%15Lu"
-+#define QUOTA_TIME_LEN_FMT_STR "%11s"
-+#define QUOTA_NUM_LEN_FMT_STR "%15s"
-+#define QUOTA_PROC_MAX_LINE_LEN 2048
-+
-+/*
-+ * prints /proc/ve_dq header line
-+ */
-+static int print_proc_header(char * buffer)
-+{
-+ return sprintf(buffer,
-+ "%-11s"
-+ QUOTA_NUM_LEN_FMT_STR
-+ QUOTA_NUM_LEN_FMT_STR
-+ QUOTA_NUM_LEN_FMT_STR
-+ QUOTA_TIME_LEN_FMT_STR
-+ QUOTA_TIME_LEN_FMT_STR
-+ "\n",
-+ "qid: path",
-+ "usage", "softlimit", "hardlimit", "time", "expire");
-+}
-+
-+/*
-+ * prints proc master record id, dentry path
-+ */
-+static int print_proc_master_id(char * buffer, char * path_buf,
-+ struct vz_quota_master * qp)
-+{
-+ char *path;
-+ int over;
-+
-+ path = NULL;
-+ switch (qp->dq_state) {
-+ case VZDQ_WORKING:
-+ if (!path_buf) {
-+ path = "";
-+ break;
-+ }
-+ path = d_path(qp->dq_root_dentry,
-+ qp->dq_root_mnt, path_buf, PAGE_SIZE);
-+ if (IS_ERR(path)) {
-+ path = "";
-+ break;
-+ }
-+ /* do not print large path, truncate it */
-+ over = strlen(path) -
-+ (QUOTA_PROC_MAX_LINE_LEN - 3 - 3 -
-+ QUOTA_UINT_LEN);
-+ if (over > 0) {
-+ path += over - 3;
-+ path[0] = path[1] = path[3] = '.';
-+ }
-+ break;
-+ case VZDQ_STARTING:
-+ path = "-- started --";
-+ break;
-+ case VZDQ_STOPING:
-+ path = "-- stopped --";
-+ break;
-+ }
-+
-+ return sprintf(buffer, "%u: %s\n", qp->dq_id, path);
-+}
-+
-+/*
-+ * prints struct vz_quota_stat data
-+ */
-+static int print_proc_stat(char * buffer, struct dq_stat *qs,
-+ struct dq_info *qi)
-+{
-+ return sprintf(buffer,
-+ "%11s"
-+ QUOTA_NUM_LEN_FMT_ULL
-+ QUOTA_NUM_LEN_FMT_ULL
-+ QUOTA_NUM_LEN_FMT_ULL
-+ QUOTA_TIME_LEN_FMT_UINT
-+ QUOTA_TIME_LEN_FMT_UINT
-+ "\n"
-+ "%11s"
-+ QUOTA_NUM_LEN_FMT_UINT
-+ QUOTA_NUM_LEN_FMT_UINT
-+ QUOTA_NUM_LEN_FMT_UINT
-+ QUOTA_TIME_LEN_FMT_UINT
-+ QUOTA_TIME_LEN_FMT_UINT
-+ "\n",
-+ "1k-blocks",
-+ qs->bcurrent >> 10,
-+ qs->bsoftlimit >> 10,
-+ qs->bhardlimit >> 10,
-+ (unsigned int)qs->btime,
-+ (unsigned int)qi->bexpire,
-+ "inodes",
-+ qs->icurrent,
-+ qs->isoftlimit,
-+ qs->ihardlimit,
-+ (unsigned int)qs->itime,
-+ (unsigned int)qi->iexpire);
-+}
-+
-+
-+/*
-+ * for /proc filesystem output
-+ */
-+static int vzquota_read_proc(char *page, char **start, off_t off, int count,
-+ int *eof, void *data)
-+{
-+ int len, i;
-+ off_t printed = 0;
-+ char *p = page;
-+ struct vz_quota_master *qp;
-+ struct vz_quota_ilink *ql2;
-+ struct list_head *listp;
-+ char *path_buf;
-+
-+ path_buf = (char*)__get_free_page(GFP_KERNEL);
-+ if (path_buf == NULL)
-+ return -ENOMEM;
-+
-+ len = print_proc_header(p);
-+ printed += len;
-+ if (off < printed) /* keep header in output */ {
-+ *start = p + off;
-+ p += len;
-+ }
-+
-+ down(&vz_quota_sem);
-+
-+ /* traverse master hash table for all records */
-+ for (i = 0; i < vzquota_hash_size; i++) {
-+ list_for_each(listp, &vzquota_hash_table[i]) {
-+ qp = list_entry(listp,
-+ struct vz_quota_master, dq_hash);
-+
-+ /* Skip other VE's information if not root of VE0 */
-+ if ((!capable(CAP_SYS_ADMIN) ||
-+ !capable(CAP_SYS_RESOURCE))) {
-+ ql2 = INODE_QLNK(current->fs->root->d_inode);
-+ if (ql2 == NULL || qp != ql2->qmblk)
-+ continue;
-+ }
-+ /*
-+ * Now print the next record
-+ */
-+ len = 0;
-+ /* we print quotaid and path only in VE0 */
-+ if (capable(CAP_SYS_ADMIN))
-+ len += print_proc_master_id(p+len,path_buf, qp);
-+ len += print_proc_stat(p+len, &qp->dq_stat,
-+ &qp->dq_info);
-+ printed += len;
-+ /* skip unnecessary lines */
-+ if (printed <= off)
-+ continue;
-+ p += len;
-+ /* provide start offset */
-+ if (*start == NULL)
-+ *start = p + (off - printed);
-+ /* have we printed all requested size? */
-+ if (PAGE_SIZE - (p - page) < QUOTA_PROC_MAX_LINE_LEN ||
-+ (p - *start) >= count)
-+ goto out;
-+ }
-+ }
-+
-+ *eof = 1; /* checked all hash */
-+out:
-+ up(&vz_quota_sem);
-+
-+ len = 0;
-+ if (*start != NULL) {
-+ len = (p - *start);
-+ if (len > count)
-+ len = count;
-+ }
-+
-+ if (path_buf)
-+ free_page((unsigned long) path_buf);
-+
-+ return len;
-+}
-+
-+/*
-+ * Register procfs read callback
-+ */
-+int vzquota_proc_init(void)
-+{
-+ struct proc_dir_entry *de;
-+
-+ de = create_proc_entry("vz/vzquota", S_IFREG|S_IRUSR, NULL);
-+ if (de == NULL) {
-+ /* create "vz" subdirectory, if not exist */
-+ de = create_proc_entry("vz", S_IFDIR|S_IRUGO|S_IXUGO, NULL);
-+ if (de == NULL)
-+ goto out_err;
-+ de = create_proc_entry("vzquota", S_IFREG|S_IRUSR, de);
-+ if (de == NULL)
-+ goto out_err;
-+ }
-+ de->read_proc = vzquota_read_proc;
-+ de->data = NULL;
-+ return 0;
-+out_err:
-+ return -EBUSY;
-+}
-+
-+void vzquota_proc_release(void)
-+{
-+ /* Unregister procfs read callback */
-+ remove_proc_entry("vz/vzquota", NULL);
-+}
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdq_ops.c linux-2.6.9-ve023stab030/fs/vzdq_ops.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdq_ops.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdq_ops.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,617 @@
-+/*
-+ * Copyright (C) 2001, 2002, 2004, 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <linux/types.h>
-+#include <asm/semaphore.h>
-+#include <linux/sched.h>
-+#include <linux/fs.h>
-+#include <linux/quota.h>
-+#include <linux/vzquota.h>
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Quota superblock operations - helper functions.
-+ * --------------------------------------------------------------------- */
-+
-+static inline void vzquota_incr_inodes(struct dq_stat *dqstat,
-+ unsigned long number)
-+{
-+ dqstat->icurrent += number;
-+}
-+
-+static inline void vzquota_incr_space(struct dq_stat *dqstat,
-+ __u64 number)
-+{
-+ dqstat->bcurrent += number;
-+}
-+
-+static inline void vzquota_decr_inodes(struct dq_stat *dqstat,
-+ unsigned long number)
-+{
-+ if (dqstat->icurrent > number)
-+ dqstat->icurrent -= number;
-+ else
-+ dqstat->icurrent = 0;
-+ if (dqstat->icurrent < dqstat->isoftlimit)
-+ dqstat->itime = (time_t) 0;
-+}
-+
-+static inline void vzquota_decr_space(struct dq_stat *dqstat,
-+ __u64 number)
-+{
-+ if (dqstat->bcurrent > number)
-+ dqstat->bcurrent -= number;
-+ else
-+ dqstat->bcurrent = 0;
-+ if (dqstat->bcurrent < dqstat->bsoftlimit)
-+ dqstat->btime = (time_t) 0;
-+}
-+
-+/*
-+ * better printk() message or use /proc/vzquotamsg interface
-+ * similar to /proc/kmsg
-+ */
-+static inline void vzquota_warn(struct dq_info *dq_info, int dq_id, int flag,
-+ const char *fmt)
-+{
-+ if (dq_info->flags & flag) /* warning already printed for this
-+ masterblock */
-+ return;
-+ printk(fmt, dq_id);
-+ dq_info->flags |= flag;
-+}
-+
-+/*
-+ * ignore_hardlimit -
-+ *
-+ * Intended to allow superuser of VE0 to overwrite hardlimits.
-+ *
-+ * ignore_hardlimit() has a very bad feature:
-+ *
-+ * writepage() operation for writable mapping of a file with holes
-+ * may trigger get_block() with wrong current and as a consequence,
-+ * opens a possibility to overcommit hardlimits
-+ */
-+/* for the reason above, it is disabled now */
-+static inline int ignore_hardlimit(struct dq_info *dqstat)
-+{
-+#if 0
-+ return ve_is_super(get_exec_env()) &&
-+ capable(CAP_SYS_RESOURCE) &&
-+ (dqstat->options & VZ_QUOTA_OPT_RSQUASH);
-+#else
-+ return 0;
-+#endif
-+}
-+
-+static int vzquota_check_inodes(struct dq_info *dq_info,
-+ struct dq_stat *dqstat,
-+ unsigned long number, int dq_id)
-+{
-+ if (number == 0)
-+ return QUOTA_OK;
-+
-+ if (dqstat->icurrent + number > dqstat->ihardlimit &&
-+ !ignore_hardlimit(dq_info)) {
-+ vzquota_warn(dq_info, dq_id, VZ_QUOTA_INODES,
-+ "VZ QUOTA: file hardlimit reached for id=%d\n");
-+ return NO_QUOTA;
-+ }
-+
-+ if (dqstat->icurrent + number > dqstat->isoftlimit) {
-+ if (dqstat->itime == (time_t)0) {
-+ vzquota_warn(dq_info, dq_id, 0,
-+ "VZ QUOTA: file softlimit exceeded "
-+ "for id=%d\n");
-+ dqstat->itime = CURRENT_TIME_SECONDS + dq_info->iexpire;
-+ } else if (CURRENT_TIME_SECONDS >= dqstat->itime &&
-+ !ignore_hardlimit(dq_info)) {
-+ vzquota_warn(dq_info, dq_id, VZ_QUOTA_INODES,
-+ "VZ QUOTA: file softlimit expired "
-+ "for id=%d\n");
-+ return NO_QUOTA;
-+ }
-+ }
-+
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_check_space(struct dq_info *dq_info,
-+ struct dq_stat *dqstat,
-+ __u64 number, int dq_id, char prealloc)
-+{
-+ if (number == 0)
-+ return QUOTA_OK;
-+
-+ if (dqstat->bcurrent + number > dqstat->bhardlimit &&
-+ !ignore_hardlimit(dq_info)) {
-+ if (!prealloc)
-+ vzquota_warn(dq_info, dq_id, VZ_QUOTA_SPACE,
-+ "VZ QUOTA: disk hardlimit reached "
-+ "for id=%d\n");
-+ return NO_QUOTA;
-+ }
-+
-+ if (dqstat->bcurrent + number > dqstat->bsoftlimit) {
-+ if (dqstat->btime == (time_t)0) {
-+ if (!prealloc) {
-+ vzquota_warn(dq_info, dq_id, 0,
-+ "VZ QUOTA: disk softlimit exceeded "
-+ "for id=%d\n");
-+ dqstat->btime = CURRENT_TIME_SECONDS
-+ + dq_info->bexpire;
-+ } else {
-+ /*
-+ * Original Linux quota doesn't allow
-+ * preallocation to exceed softlimit so
-+ * exceeding will be always printed
-+ */
-+ return NO_QUOTA;
-+ }
-+ } else if (CURRENT_TIME_SECONDS >= dqstat->btime &&
-+ !ignore_hardlimit(dq_info)) {
-+ if (!prealloc)
-+ vzquota_warn(dq_info, dq_id, VZ_QUOTA_SPACE,
-+ "VZ QUOTA: disk quota "
-+ "softlimit expired "
-+ "for id=%d\n");
-+ return NO_QUOTA;
-+ }
-+ }
-+
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_check_ugid_inodes(struct vz_quota_master *qmblk,
-+ struct vz_quota_ugid *qugid[],
-+ int type, unsigned long number)
-+{
-+ struct dq_info *dqinfo;
-+ struct dq_stat *dqstat;
-+
-+ if (qugid[type] == NULL)
-+ return QUOTA_OK;
-+ if (qugid[type] == VZ_QUOTA_UGBAD)
-+ return NO_QUOTA;
-+
-+ if (type == USRQUOTA && !(qmblk->dq_flags & VZDQ_USRQUOTA))
-+ return QUOTA_OK;
-+ if (type == GRPQUOTA && !(qmblk->dq_flags & VZDQ_GRPQUOTA))
-+ return QUOTA_OK;
-+ if (number == 0)
-+ return QUOTA_OK;
-+
-+ dqinfo = &qmblk->dq_ugid_info[type];
-+ dqstat = &qugid[type]->qugid_stat;
-+
-+ if (dqstat->ihardlimit != 0 &&
-+ dqstat->icurrent + number > dqstat->ihardlimit)
-+ return NO_QUOTA;
-+
-+ if (dqstat->isoftlimit != 0 &&
-+ dqstat->icurrent + number > dqstat->isoftlimit) {
-+ if (dqstat->itime == (time_t)0)
-+ dqstat->itime = CURRENT_TIME_SECONDS + dqinfo->iexpire;
-+ else if (CURRENT_TIME_SECONDS >= dqstat->itime)
-+ return NO_QUOTA;
-+ }
-+
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_check_ugid_space(struct vz_quota_master *qmblk,
-+ struct vz_quota_ugid *qugid[],
-+ int type, __u64 number, char prealloc)
-+{
-+ struct dq_info *dqinfo;
-+ struct dq_stat *dqstat;
-+
-+ if (qugid[type] == NULL)
-+ return QUOTA_OK;
-+ if (qugid[type] == VZ_QUOTA_UGBAD)
-+ return NO_QUOTA;
-+
-+ if (type == USRQUOTA && !(qmblk->dq_flags & VZDQ_USRQUOTA))
-+ return QUOTA_OK;
-+ if (type == GRPQUOTA && !(qmblk->dq_flags & VZDQ_GRPQUOTA))
-+ return QUOTA_OK;
-+ if (number == 0)
-+ return QUOTA_OK;
-+
-+ dqinfo = &qmblk->dq_ugid_info[type];
-+ dqstat = &qugid[type]->qugid_stat;
-+
-+ if (dqstat->bhardlimit != 0 &&
-+ dqstat->bcurrent + number > dqstat->bhardlimit)
-+ return NO_QUOTA;
-+
-+ if (dqstat->bsoftlimit != 0 &&
-+ dqstat->bcurrent + number > dqstat->bsoftlimit) {
-+ if (dqstat->btime == (time_t)0) {
-+ if (!prealloc)
-+ dqstat->btime = CURRENT_TIME_SECONDS
-+ + dqinfo->bexpire;
-+ else
-+ /*
-+ * Original Linux quota doesn't allow
-+ * preallocation to exceed softlimit so
-+ * exceeding will be always printed
-+ */
-+ return NO_QUOTA;
-+ } else if (CURRENT_TIME_SECONDS >= dqstat->btime)
-+ return NO_QUOTA;
-+ }
-+
-+ return QUOTA_OK;
-+}
-+
-+/* ----------------------------------------------------------------------
-+ * Quota superblock operations
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * S_NOQUOTA note.
-+ * In the current kernel (2.6.8.1), S_NOQUOTA flag is set only for
-+ * - quota file (absent in our case)
-+ * - after explicit DQUOT_DROP (earlier than clear_inode) in functions like
-+ * filesystem-specific new_inode, before the inode gets outside links.
-+ * For the latter case, the only quota operation where care about S_NOQUOTA
-+ * might be required is vzquota_drop, but there S_NOQUOTA has already been
-+ * checked in DQUOT_DROP().
-+ * So, S_NOQUOTA may be ignored for now in the VZDQ code.
-+ *
-+ * The above note is not entirely correct.
-+ * Both for ext2 and ext3 filesystems, DQUOT_FREE_INODE is called from
-+ * delete_inode if new_inode fails (for example, because of inode quota
-+ * limits), so S_NOQUOTA check is needed in free_inode.
-+ * This seems to be the dark corner of the current quota API.
-+ */
-+
-+/*
-+ * Initialize quota operations for the specified inode.
-+ */
-+static int vzquota_initialize(struct inode *inode, int type)
-+{
-+ vzquota_inode_init_call(inode);
-+ return 0; /* ignored by caller */
-+}
-+
-+/*
-+ * Release quota for the specified inode.
-+ */
-+static int vzquota_drop(struct inode *inode)
-+{
-+ vzquota_inode_drop_call(inode);
-+ return 0; /* ignored by caller */
-+}
-+
-+/*
-+ * Allocate block callback.
-+ *
-+ * If (prealloc) disk quota exceeding warning is not printed.
-+ * See Linux quota to know why.
-+ *
-+ * Return:
-+ * QUOTA_OK == 0 on SUCCESS
-+ * NO_QUOTA == 1 if allocation should fail
-+ */
-+static int vzquota_alloc_space(struct inode *inode,
-+ qsize_t number, int prealloc)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+ int ret = QUOTA_OK;
-+
-+ qmblk = vzquota_inode_data(inode, &data);
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return NO_QUOTA;
-+ if (qmblk != NULL) {
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ int cnt;
-+ struct vz_quota_ugid * qugid[MAXQUOTAS];
-+#endif
-+
-+ /* checking first */
-+ ret = vzquota_check_space(&qmblk->dq_info, &qmblk->dq_stat,
-+ number, qmblk->dq_id, prealloc);
-+ if (ret == NO_QUOTA)
-+ goto no_quota;
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ qugid[cnt] = INODE_QLNK(inode)->qugid[cnt];
-+ ret = vzquota_check_ugid_space(qmblk, qugid,
-+ cnt, number, prealloc);
-+ if (ret == NO_QUOTA)
-+ goto no_quota;
-+ }
-+ /* check ok, may increment */
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ if (qugid[cnt] == NULL)
-+ continue;
-+ vzquota_incr_space(&qugid[cnt]->qugid_stat, number);
-+ }
-+#endif
-+ vzquota_incr_space(&qmblk->dq_stat, number);
-+ vzquota_data_unlock(inode, &data);
-+ }
-+
-+ inode_add_bytes(inode, number);
-+ might_sleep();
-+ return QUOTA_OK;
-+
-+no_quota:
-+ vzquota_data_unlock(inode, &data);
-+ return NO_QUOTA;
-+}
-+
-+/*
-+ * Allocate inodes callback.
-+ *
-+ * Return:
-+ * QUOTA_OK == 0 on SUCCESS
-+ * NO_QUOTA == 1 if allocation should fail
-+ */
-+static int vzquota_alloc_inode(const struct inode *inode, unsigned long number)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+ int ret = QUOTA_OK;
-+
-+ qmblk = vzquota_inode_data((struct inode *)inode, &data);
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return NO_QUOTA;
-+ if (qmblk != NULL) {
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ int cnt;
-+ struct vz_quota_ugid *qugid[MAXQUOTAS];
-+#endif
-+
-+ /* checking first */
-+ ret = vzquota_check_inodes(&qmblk->dq_info, &qmblk->dq_stat,
-+ number, qmblk->dq_id);
-+ if (ret == NO_QUOTA)
-+ goto no_quota;
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ qugid[cnt] = INODE_QLNK(inode)->qugid[cnt];
-+ ret = vzquota_check_ugid_inodes(qmblk, qugid,
-+ cnt, number);
-+ if (ret == NO_QUOTA)
-+ goto no_quota;
-+ }
-+ /* check ok, may increment */
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ if (qugid[cnt] == NULL)
-+ continue;
-+ vzquota_incr_inodes(&qugid[cnt]->qugid_stat, number);
-+ }
-+#endif
-+ vzquota_incr_inodes(&qmblk->dq_stat, number);
-+ vzquota_data_unlock((struct inode *)inode, &data);
-+ }
-+
-+ might_sleep();
-+ return QUOTA_OK;
-+
-+no_quota:
-+ vzquota_data_unlock((struct inode *)inode, &data);
-+ return NO_QUOTA;
-+}
-+
-+/*
-+ * Free space callback.
-+ */
-+static int vzquota_free_space(struct inode *inode, qsize_t number)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+
-+ qmblk = vzquota_inode_data(inode, &data);
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return NO_QUOTA; /* isn't checked by the caller */
-+ if (qmblk != NULL) {
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ int cnt;
-+ struct vz_quota_ugid * qugid;
-+#endif
-+
-+ vzquota_decr_space(&qmblk->dq_stat, number);
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ qugid = INODE_QLNK(inode)->qugid[cnt];
-+ if (qugid == NULL || qugid == VZ_QUOTA_UGBAD)
-+ continue;
-+ vzquota_decr_space(&qugid->qugid_stat, number);
-+ }
-+#endif
-+ vzquota_data_unlock(inode, &data);
-+ }
-+ inode_sub_bytes(inode, number);
-+ might_sleep();
-+ return QUOTA_OK;
-+}
-+
-+/*
-+ * Free inodes callback.
-+ */
-+static int vzquota_free_inode(const struct inode *inode, unsigned long number)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+
-+ qmblk = vzquota_inode_data((struct inode *)inode, &data);
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return NO_QUOTA;
-+ if (qmblk != NULL) {
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ int cnt;
-+ struct vz_quota_ugid * qugid;
-+#endif
-+
-+ vzquota_decr_inodes(&qmblk->dq_stat, number);
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ qugid = INODE_QLNK(inode)->qugid[cnt];
-+ if (qugid == NULL || qugid == VZ_QUOTA_UGBAD)
-+ continue;
-+ vzquota_decr_inodes(&qugid->qugid_stat, number);
-+ }
-+#endif
-+ vzquota_data_unlock((struct inode *)inode, &data);
-+ }
-+ might_sleep();
-+ return QUOTA_OK;
-+}
-+
-+void vzquota_inode_off(struct inode * inode)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+
-+ /* The call is made through virtinfo, it can be an inode
-+ * not controlled by vzquota.
-+ */
-+ if (inode->i_sb->dq_op != &vz_quota_operations)
-+ return;
-+
-+ qmblk = vzquota_inode_data(inode, &data);
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return;
-+
-+ if (qmblk == NULL) {
-+ /* Tricky place. If qmblk == NULL, it means that this inode
-+ * is not in area controlled by vzquota (except for rare
-+ * case of already set S_NOQUOTA). But we have to set
-+ * S_NOQUOTA in any case because vzquota can be turned
-+ * on later, when this inode is invalid from viewpoint
-+ * of vzquota.
-+ *
-+ * To be safe, we reacquire vzquota lock.
-+ */
-+ inode_qmblk_lock(inode->i_sb);
-+ inode->i_flags |= S_NOQUOTA;
-+ inode_qmblk_unlock(inode->i_sb);
-+ return;
-+ } else {
-+ loff_t bytes = inode_get_bytes(inode);
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ int cnt;
-+ struct vz_quota_ugid * qugid;
-+#endif
-+
-+ inode->i_flags |= S_NOQUOTA;
-+
-+ vzquota_decr_space(&qmblk->dq_stat, bytes);
-+ vzquota_decr_inodes(&qmblk->dq_stat, 1);
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+ qugid = INODE_QLNK(inode)->qugid[cnt];
-+ if (qugid == NULL || qugid == VZ_QUOTA_UGBAD)
-+ continue;
-+ vzquota_decr_space(&qugid->qugid_stat, bytes);
-+ vzquota_decr_inodes(&qugid->qugid_stat, 1);
-+ }
-+#endif
-+
-+ vzquota_data_unlock(inode, &data);
-+
-+ vzquota_inode_drop_call(inode);
-+ }
-+}
-+
-+
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+
-+/*
-+ * helper function for quota_transfer
-+ * check that we can add inode to this quota_id
-+ */
-+static int vzquota_transfer_check(struct vz_quota_master *qmblk,
-+ struct vz_quota_ugid *qugid[],
-+ unsigned int type, __u64 size)
-+{
-+ if (vzquota_check_ugid_space(qmblk, qugid, type, size, 0) != QUOTA_OK ||
-+ vzquota_check_ugid_inodes(qmblk, qugid, type, 1) != QUOTA_OK)
-+ return -1;
-+ return 0;
-+}
-+
-+int vzquota_transfer_usage(struct inode *inode,
-+ int mask,
-+ struct vz_quota_ilink *qlnk)
-+{
-+ struct vz_quota_ugid *qugid_old;
-+ __u64 space;
-+ int i;
-+
-+ space = inode_get_bytes(inode);
-+ for (i = 0; i < MAXQUOTAS; i++) {
-+ if (!(mask & (1 << i)))
-+ continue;
-+ if (vzquota_transfer_check(qlnk->qmblk, qlnk->qugid, i, space))
-+ return -1;
-+ }
-+
-+ for (i = 0; i < MAXQUOTAS; i++) {
-+ if (!(mask & (1 << i)))
-+ continue;
-+ qugid_old = INODE_QLNK(inode)->qugid[i];
-+ vzquota_decr_space(&qugid_old->qugid_stat, space);
-+ vzquota_decr_inodes(&qugid_old->qugid_stat, 1);
-+ vzquota_incr_space(&qlnk->qugid[i]->qugid_stat, space);
-+ vzquota_incr_inodes(&qlnk->qugid[i]->qugid_stat, 1);
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * Transfer the inode between diffent user/group quotas.
-+ */
-+static int vzquota_transfer(struct inode *inode, struct iattr *iattr)
-+{
-+ return vzquota_inode_transfer_call(inode, iattr) ?
-+ NO_QUOTA : QUOTA_OK;
-+}
-+
-+#else /* CONFIG_VZ_QUOTA_UGID */
-+
-+static int vzquota_transfer(struct inode *inode, struct iattr *iattr)
-+{
-+ return QUOTA_OK;
-+}
-+
-+#endif
-+
-+/*
-+ * Called under following semaphores:
-+ * old_d->d_inode->i_sb->s_vfs_rename_sem
-+ * old_d->d_inode->i_sem
-+ * new_d->d_inode->i_sem
-+ * [not verified --SAW]
-+ */
-+static int vzquota_rename(struct inode *inode,
-+ struct inode *old_dir, struct inode *new_dir)
-+{
-+ return vzquota_rename_check(inode, old_dir, new_dir) ?
-+ NO_QUOTA : QUOTA_OK;
-+}
-+
-+/*
-+ * Structure of superblock diskquota operations.
-+ */
-+struct dquot_operations vz_quota_operations = {
-+ initialize: vzquota_initialize,
-+ drop: vzquota_drop,
-+ alloc_space: vzquota_alloc_space,
-+ alloc_inode: vzquota_alloc_inode,
-+ free_space: vzquota_free_space,
-+ free_inode: vzquota_free_inode,
-+ transfer: vzquota_transfer,
-+ rename: vzquota_rename
-+};
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdq_tree.c linux-2.6.9-ve023stab030/fs/vzdq_tree.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdq_tree.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdq_tree.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,286 @@
-+/*
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains Virtuozzo quota tree implementation
-+ */
-+
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+#include <linux/vzdq_tree.h>
-+
-+struct quotatree_tree *quotatree_alloc(void)
-+{
-+ int l;
-+ struct quotatree_tree *tree;
-+
-+ tree = kmalloc(sizeof(struct quotatree_tree), GFP_KERNEL);
-+ if (tree == NULL)
-+ goto out;
-+
-+ for (l = 0; l < QUOTATREE_DEPTH; l++) {
-+ INIT_LIST_HEAD(&tree->levels[l].usedlh);
-+ INIT_LIST_HEAD(&tree->levels[l].freelh);
-+ tree->levels[l].freenum = 0;
-+ }
-+ tree->root = NULL;
-+ tree->leaf_num = 0;
-+out:
-+ return tree;
-+}
-+
-+static struct quotatree_node *
-+quotatree_follow(struct quotatree_tree *tree, quotaid_t id, int level,
-+ struct quotatree_find_state *st)
-+{
-+ void **block;
-+ struct quotatree_node *parent;
-+ int l, index;
-+
-+ parent = NULL;
-+ block = (void **)&tree->root;
-+ l = 0;
-+ while (l < level && *block != NULL) {
-+ index = (id >> QUOTATREE_BSHIFT(l)) & QUOTATREE_BMASK;
-+ parent = *block;
-+ block = parent->blocks + index;
-+ l++;
-+ }
-+ if (st != NULL) {
-+ st->block = block;
-+ st->level = l;
-+ }
-+
-+ return parent;
-+}
-+
-+void *quotatree_find(struct quotatree_tree *tree, quotaid_t id,
-+ struct quotatree_find_state *st)
-+{
-+ quotatree_follow(tree, id, QUOTATREE_DEPTH, st);
-+ if (st->level == QUOTATREE_DEPTH)
-+ return *st->block;
-+ else
-+ return NULL;
-+}
-+
-+void *quotatree_leaf_byindex(struct quotatree_tree *tree, unsigned int index)
-+{
-+ int i, count;
-+ struct quotatree_node *p;
-+ void *leaf;
-+
-+ if (QTREE_LEAFNUM(tree) <= index)
-+ return NULL;
-+
-+ count = 0;
-+ list_for_each_entry(p, &QTREE_LEAFLVL(tree)->usedlh, list) {
-+ for (i = 0; i < QUOTATREE_BSIZE; i++) {
-+ leaf = p->blocks[i];
-+ if (leaf == NULL)
-+ continue;
-+ if (count == index)
-+ return leaf;
-+ count++;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+/* returns data leaf (vz_quota_ugid) after _existent_ ugid (@id)
-+ * in the tree... */
-+void *quotatree_get_next(struct quotatree_tree *tree, quotaid_t id)
-+{
-+ int off;
-+ struct quotatree_node *parent, *p;
-+ struct list_head *lh;
-+
-+ /* get parent refering correct quota tree node of the last level */
-+ parent = quotatree_follow(tree, id, QUOTATREE_DEPTH, NULL);
-+ if (!parent)
-+ return NULL;
-+
-+ off = (id & QUOTATREE_BMASK) + 1; /* next ugid */
-+ lh = &parent->list;
-+ do {
-+ p = list_entry(lh, struct quotatree_node, list);
-+ for ( ; off < QUOTATREE_BSIZE; off++)
-+ if (p->blocks[off])
-+ return p->blocks[off];
-+ off = 0;
-+ lh = lh->next;
-+ } while (lh != &QTREE_LEAFLVL(tree)->usedlh);
-+
-+ return NULL;
-+}
-+
-+int quotatree_insert(struct quotatree_tree *tree, quotaid_t id,
-+ struct quotatree_find_state *st, void *data)
-+{
-+ struct quotatree_node *p;
-+ int l, index;
-+
-+ while (st->level < QUOTATREE_DEPTH) {
-+ l = st->level;
-+ if (!list_empty(&tree->levels[l].freelh)) {
-+ p = list_entry(tree->levels[l].freelh.next,
-+ struct quotatree_node, list);
-+ list_del(&p->list);
-+ } else {
-+ p = kmalloc(sizeof(struct quotatree_node), GFP_NOFS | __GFP_NOFAIL);
-+ if (p == NULL)
-+ return -ENOMEM;
-+ /* save block number in the l-level
-+ * it uses for quota file generation */
-+ p->num = tree->levels[l].freenum++;
-+ }
-+ list_add(&p->list, &tree->levels[l].usedlh);
-+ memset(p->blocks, 0, sizeof(p->blocks));
-+ *st->block = p;
-+
-+ index = (id >> QUOTATREE_BSHIFT(l)) & QUOTATREE_BMASK;
-+ st->block = p->blocks + index;
-+ st->level++;
-+ }
-+ tree->leaf_num++;
-+ *st->block = data;
-+
-+ return 0;
-+}
-+
-+static struct quotatree_node *
-+quotatree_remove_ptr(struct quotatree_tree *tree, quotaid_t id,
-+ int level)
-+{
-+ struct quotatree_node *parent;
-+ struct quotatree_find_state st;
-+
-+ parent = quotatree_follow(tree, id, level, &st);
-+ if (st.level == QUOTATREE_DEPTH)
-+ tree->leaf_num--;
-+ *st.block = NULL;
-+ return parent;
-+}
-+
-+void quotatree_remove(struct quotatree_tree *tree, quotaid_t id)
-+{
-+ struct quotatree_node *p;
-+ int level, i;
-+
-+ p = quotatree_remove_ptr(tree, id, QUOTATREE_DEPTH);
-+ for (level = QUOTATREE_DEPTH - 1; level >= QUOTATREE_CDEPTH; level--) {
-+ for (i = 0; i < QUOTATREE_BSIZE; i++)
-+ if (p->blocks[i] != NULL)
-+ return;
-+ list_move(&p->list, &tree->levels[level].freelh);
-+ p = quotatree_remove_ptr(tree, id, level);
-+ }
-+}
-+
-+#if 0
-+static void quotatree_walk(struct quotatree_tree *tree,
-+ struct quotatree_node *node_start,
-+ quotaid_t id_start,
-+ int level_start, int level_end,
-+ int (*callback)(struct quotatree_tree *,
-+ quotaid_t id,
-+ int level,
-+ void *ptr,
-+ void *data),
-+ void *data)
-+{
-+ struct quotatree_node *p;
-+ int l, shift, index;
-+ quotaid_t id;
-+ struct quotatree_find_state st;
-+
-+ p = node_start;
-+ l = level_start;
-+ shift = (QUOTATREE_DEPTH - l) * QUOTAID_BBITS;
-+ id = id_start;
-+ index = 0;
-+
-+ /*
-+ * Invariants:
-+ * shift == (QUOTATREE_DEPTH - l) * QUOTAID_BBITS;
-+ * id & ((1 << shift) - 1) == 0
-+ * p is l-level node corresponding to id
-+ */
-+ do {
-+ if (!p)
-+ break;
-+
-+ if (l < level_end) {
-+ for (; index < QUOTATREE_BSIZE; index++)
-+ if (p->blocks[index] != NULL)
-+ break;
-+ if (index < QUOTATREE_BSIZE) {
-+ /* descend */
-+ p = p->blocks[index];
-+ l++;
-+ shift -= QUOTAID_BBITS;
-+ id += (quotaid_t)index << shift;
-+ index = 0;
-+ continue;
-+ }
-+ }
-+
-+ if ((*callback)(tree, id, l, p, data))
-+ break;
-+
-+ /* ascend and to the next node */
-+ p = quotatree_follow(tree, id, l, &st);
-+
-+ index = ((id >> shift) & QUOTATREE_BMASK) + 1;
-+ l--;
-+ shift += QUOTAID_BBITS;
-+ id &= ~(((quotaid_t)1 << shift) - 1);
-+ } while (l >= level_start);
-+}
-+#endif
-+
-+static void free_list(struct list_head *node_list)
-+{
-+ struct quotatree_node *p, *tmp;
-+
-+ list_for_each_entry_safe(p, tmp, node_list, list) {
-+ list_del(&p->list);
-+ kfree(p);
-+ }
-+}
-+
-+static inline void quotatree_free_nodes(struct quotatree_tree *tree)
-+{
-+ int i;
-+
-+ for (i = 0; i < QUOTATREE_DEPTH; i++) {
-+ free_list(&tree->levels[i].usedlh);
-+ free_list(&tree->levels[i].freelh);
-+ }
-+}
-+
-+static void quotatree_free_leafs(struct quotatree_tree *tree,
-+ void (*dtor)(void *))
-+{
-+ int i;
-+ struct quotatree_node *p;
-+
-+ list_for_each_entry(p, &QTREE_LEAFLVL(tree)->usedlh, list) {
-+ for (i = 0; i < QUOTATREE_BSIZE; i++) {
-+ if (p->blocks[i] == NULL)
-+ continue;
-+
-+ dtor(p->blocks[i]);
-+ }
-+ }
-+}
-+
-+void quotatree_free(struct quotatree_tree *tree, void (*dtor)(void *))
-+{
-+ quotatree_free_leafs(tree, dtor);
-+ quotatree_free_nodes(tree);
-+ kfree(tree);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdq_ugid.c linux-2.6.9-ve023stab030/fs/vzdq_ugid.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdq_ugid.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdq_ugid.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,1179 @@
-+/*
-+ * Copyright (C) 2002 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains Virtuozzo UID/GID disk quota implementation
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+#include <linux/list.h>
-+#include <linux/smp_lock.h>
-+#include <linux/rcupdate.h>
-+#include <asm/uaccess.h>
-+#include <linux/proc_fs.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/quota.h>
-+#include <linux/quotaio_v2.h>
-+#include <linux/virtinfo.h>
-+#include <linux/namei.h>
-+#include <linux/mount.h>
-+#include <linux/namespace.h>
-+
-+#include <linux/vzctl.h>
-+#include <linux/vzctl_quota.h>
-+#include <linux/vzquota.h>
-+
-+/*
-+ * XXX
-+ * may be something is needed for sb->s_dquot->info[]?
-+ */
-+
-+#define USRQUOTA_MASK (1 << USRQUOTA)
-+#define GRPQUOTA_MASK (1 << GRPQUOTA)
-+#define QTYPE2MASK(type) (1 << (type))
-+
-+static kmem_cache_t *vz_quota_ugid_cachep;
-+
-+/* guard to protect vz_quota_master from destroy in quota_on/off. Also protects
-+ * list on the hash table */
-+extern struct semaphore vz_quota_sem;
-+
-+inline struct vz_quota_ugid *vzquota_get_ugid(struct vz_quota_ugid *qugid)
-+{
-+ if (qugid != VZ_QUOTA_UGBAD)
-+ atomic_inc(&qugid->qugid_count);
-+ return qugid;
-+}
-+
-+/* we don't limit users with zero limits */
-+static inline int vzquota_fake_stat(struct dq_stat *stat)
-+{
-+ return stat->bhardlimit == 0 && stat->bsoftlimit == 0 &&
-+ stat->ihardlimit == 0 && stat->isoftlimit == 0;
-+}
-+
-+/* callback function for quotatree_free() */
-+static inline void vzquota_free_qugid(void *ptr)
-+{
-+ kmem_cache_free(vz_quota_ugid_cachep, ptr);
-+}
-+
-+/*
-+ * destroy ugid, if it have zero refcount, limits and usage
-+ * must be called under qmblk->dq_sem
-+ */
-+void vzquota_put_ugid(struct vz_quota_master *qmblk,
-+ struct vz_quota_ugid *qugid)
-+{
-+ if (qugid == VZ_QUOTA_UGBAD)
-+ return;
-+ qmblk_data_read_lock(qmblk);
-+ if (atomic_dec_and_test(&qugid->qugid_count) &&
-+ (qmblk->dq_flags & VZDQUG_FIXED_SET) == 0 &&
-+ vzquota_fake_stat(&qugid->qugid_stat) &&
-+ qugid->qugid_stat.bcurrent == 0 &&
-+ qugid->qugid_stat.icurrent == 0) {
-+ quotatree_remove(QUGID_TREE(qmblk, qugid->qugid_type),
-+ qugid->qugid_id);
-+ qmblk->dq_ugid_count--;
-+ vzquota_free_qugid(qugid);
-+ }
-+ qmblk_data_read_unlock(qmblk);
-+}
-+
-+/*
-+ * Get ugid block by its index, like it would present in array.
-+ * In reality, this is not array - this is leafs chain of the tree.
-+ * NULL if index is out of range.
-+ * qmblk semaphore is required to protect the tree.
-+ */
-+static inline struct vz_quota_ugid *
-+vzquota_get_byindex(struct vz_quota_master *qmblk, unsigned int index, int type)
-+{
-+ return quotatree_leaf_byindex(QUGID_TREE(qmblk, type), index);
-+}
-+
-+/*
-+ * get next element from ugid "virtual array"
-+ * ugid must be in current array and this array may not be changed between
-+ * two accesses (quaranteed by "stopped" quota state and quota semaphore)
-+ * qmblk semaphore is required to protect the tree
-+ */
-+static inline struct vz_quota_ugid *
-+vzquota_get_next(struct vz_quota_master *qmblk, struct vz_quota_ugid *qugid)
-+{
-+ return quotatree_get_next(QUGID_TREE(qmblk, qugid->qugid_type),
-+ qugid->qugid_id);
-+}
-+
-+/*
-+ * requires dq_sem
-+ */
-+struct vz_quota_ugid *__vzquota_find_ugid(struct vz_quota_master *qmblk,
-+ unsigned int quota_id, int type, int flags)
-+{
-+ struct vz_quota_ugid *qugid;
-+ struct quotatree_tree *tree;
-+ struct quotatree_find_state st;
-+
-+ tree = QUGID_TREE(qmblk, type);
-+ qugid = quotatree_find(tree, quota_id, &st);
-+ if (qugid)
-+ goto success;
-+
-+ /* caller does not want alloc */
-+ if (flags & VZDQUG_FIND_DONT_ALLOC)
-+ goto fail;
-+
-+ if (flags & VZDQUG_FIND_FAKE)
-+ goto doit;
-+
-+ /* check limit */
-+ if (qmblk->dq_ugid_count >= qmblk->dq_ugid_max)
-+ goto fail;
-+
-+ /* see comment at VZDQUG_FIXED_SET define */
-+ if (qmblk->dq_flags & VZDQUG_FIXED_SET)
-+ goto fail;
-+
-+doit:
-+ /* alloc new structure */
-+ qugid = kmem_cache_alloc(vz_quota_ugid_cachep,
-+ SLAB_NOFS | __GFP_NOFAIL);
-+ if (qugid == NULL)
-+ goto fail;
-+
-+ /* initialize new structure */
-+ qugid->qugid_id = quota_id;
-+ memset(&qugid->qugid_stat, 0, sizeof(qugid->qugid_stat));
-+ qugid->qugid_type = type;
-+ atomic_set(&qugid->qugid_count, 0);
-+
-+ /* insert in tree */
-+ if (quotatree_insert(tree, quota_id, &st, qugid) < 0)
-+ goto fail_insert;
-+ qmblk->dq_ugid_count++;
-+
-+success:
-+ vzquota_get_ugid(qugid);
-+ return qugid;
-+
-+fail_insert:
-+ vzquota_free_qugid(qugid);
-+fail:
-+ return VZ_QUOTA_UGBAD;
-+}
-+
-+/*
-+ * takes dq_sem, may schedule
-+ */
-+struct vz_quota_ugid *vzquota_find_ugid(struct vz_quota_master *qmblk,
-+ unsigned int quota_id, int type, int flags)
-+{
-+ struct vz_quota_ugid *qugid;
-+
-+ down(&qmblk->dq_sem);
-+ qugid = __vzquota_find_ugid(qmblk, quota_id, type, flags);
-+ up(&qmblk->dq_sem);
-+
-+ return qugid;
-+}
-+
-+/*
-+ * destroy all ugid records on given quota master
-+ */
-+void vzquota_kill_ugid(struct vz_quota_master *qmblk)
-+{
-+ BUG_ON((qmblk->dq_gid_tree == NULL && qmblk->dq_uid_tree != NULL) ||
-+ (qmblk->dq_uid_tree == NULL && qmblk->dq_gid_tree != NULL));
-+
-+ if (qmblk->dq_uid_tree != NULL) {
-+ quotatree_free(qmblk->dq_uid_tree, vzquota_free_qugid);
-+ quotatree_free(qmblk->dq_gid_tree, vzquota_free_qugid);
-+ }
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Management interface to ugid quota for (super)users.
-+ * --------------------------------------------------------------------- */
-+
-+/**
-+ * vzquota_find_qmblk - helper to emulate quota on virtual filesystems
-+ *
-+ * This function finds a quota master block corresponding to the root of
-+ * a virtual filesystem.
-+ * Returns a quota master block with reference taken, or %NULL if not under
-+ * quota, or %VZ_QUOTA_BAD if quota inconsistency is found (and all allocation
-+ * operations will fail).
-+ *
-+ * Note: this function uses vzquota_inode_qmblk().
-+ * The latter is a rather confusing function: it returns qmblk that used to be
-+ * on the inode some time ago (without guarantee that it still has any
-+ * relations to the inode). So, vzquota_find_qmblk() leaves it up to the
-+ * caller to think whether the inode could have changed its qmblk and what to
-+ * do in that case.
-+ * Currently, the callers appear to not care :(
-+ */
-+struct vz_quota_master *vzquota_find_qmblk(struct super_block *sb)
-+{
-+ struct inode *qrinode;
-+ struct vz_quota_master *qmblk;
-+
-+ qmblk = NULL;
-+ qrinode = NULL;
-+ if (sb->s_op->get_quota_root != NULL)
-+ qrinode = sb->s_op->get_quota_root(sb);
-+ if (qrinode != NULL)
-+ qmblk = vzquota_inode_qmblk(qrinode);
-+ return qmblk;
-+}
-+
-+static int vzquota_initialize2(struct inode *inode, int type)
-+{
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_drop2(struct inode *inode)
-+{
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_alloc_space2(struct inode *inode,
-+ qsize_t number, int prealloc)
-+{
-+ inode_add_bytes(inode, number);
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_alloc_inode2(const struct inode *inode, unsigned long number)
-+{
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_free_space2(struct inode *inode, qsize_t number)
-+{
-+ inode_sub_bytes(inode, number);
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_free_inode2(const struct inode *inode, unsigned long number)
-+{
-+ return QUOTA_OK;
-+}
-+
-+static int vzquota_transfer2(struct inode *inode, struct iattr *iattr)
-+{
-+ return QUOTA_OK;
-+}
-+
-+struct dquot_operations vz_quota_operations2 = {
-+ initialize: vzquota_initialize2,
-+ drop: vzquota_drop2,
-+ alloc_space: vzquota_alloc_space2,
-+ alloc_inode: vzquota_alloc_inode2,
-+ free_space: vzquota_free_space2,
-+ free_inode: vzquota_free_inode2,
-+ transfer: vzquota_transfer2
-+};
-+
-+
-+asmlinkage long sys_unlink(const char __user * pathname);
-+asmlinkage long sys_rename(const char __user * oldname,
-+ const char __user * newname);
-+asmlinkage long sys_symlink(const char __user * oldname,
-+ const char __user * newname);
-+static int vz_restore_symlink(struct super_block *sb, char *path, int type)
-+{
-+ mm_segment_t oldfs;
-+ char *newpath;
-+ char dest[64];
-+ const char *names[] = {
-+ [USRQUOTA] "aquota.user",
-+ [GRPQUOTA] "aquota.group"
-+ };
-+ int err;
-+
-+ newpath = kmalloc(strlen(path) + sizeof(".new"), GFP_KERNEL);
-+ if (newpath == NULL)
-+ return -ENOMEM;
-+
-+ strcpy(newpath, path);
-+ strcat(newpath, ".new");
-+
-+ sprintf(dest, "/proc/vz/vzaquota/%08x/%s",
-+ new_encode_dev(sb->s_dev), names[type]);
-+
-+ oldfs = get_fs();
-+ set_fs(KERNEL_DS);
-+ err = sys_unlink(newpath);
-+ if (err < 0 && err != -ENOENT)
-+ goto out_restore;
-+ err = sys_symlink(dest, newpath);
-+ if (err < 0)
-+ goto out_restore;
-+ err = sys_rename(newpath, path);
-+out_restore:
-+ set_fs(oldfs);
-+ kfree(newpath);
-+ return err;
-+}
-+
-+static int vz_quota_on(struct super_block *sb, int type,
-+ int format_id, char *path)
-+{
-+ struct vz_quota_master *qmblk;
-+ int mask, mask2;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+
-+ err = vz_restore_symlink(sb, path, type);
-+ if (err < 0)
-+ goto out;
-+
-+ mask = 0;
-+ mask2 = 0;
-+ sb->dq_op = &vz_quota_operations2;
-+ sb->s_qcop = &vz_quotactl_operations;
-+ if (type == USRQUOTA) {
-+ mask = DQUOT_USR_ENABLED;
-+ mask2 = VZDQ_USRQUOTA;
-+ }
-+ if (type == GRPQUOTA) {
-+ mask = DQUOT_GRP_ENABLED;
-+ mask2 = VZDQ_GRPQUOTA;
-+ }
-+ err = -EBUSY;
-+ if (qmblk->dq_flags & mask2)
-+ goto out;
-+
-+ err = 0;
-+ qmblk->dq_flags |= mask2;
-+ sb->s_dquot.flags |= mask;
-+
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+static int vz_quota_off(struct super_block *sb, int type)
-+{
-+ struct vz_quota_master *qmblk;
-+ int mask2;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+
-+ mask2 = 0;
-+ if (type == USRQUOTA)
-+ mask2 = VZDQ_USRQUOTA;
-+ if (type == GRPQUOTA)
-+ mask2 = VZDQ_GRPQUOTA;
-+ err = -EINVAL;
-+ if (!(qmblk->dq_flags & mask2))
-+ goto out;
-+
-+ qmblk->dq_flags &= ~mask2;
-+ err = 0;
-+
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+static int vz_quota_sync(struct super_block *sb, int type)
-+{
-+ return 0; /* vz quota is always uptodate */
-+}
-+
-+static int vz_get_dqblk(struct super_block *sb, int type,
-+ qid_t id, struct if_dqblk *di)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid *ugid;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+
-+ err = 0;
-+ ugid = vzquota_find_ugid(qmblk, id, type, VZDQUG_FIND_DONT_ALLOC);
-+ if (ugid != VZ_QUOTA_UGBAD) {
-+ qmblk_data_read_lock(qmblk);
-+ di->dqb_bhardlimit = ugid->qugid_stat.bhardlimit >> 10;
-+ di->dqb_bsoftlimit = ugid->qugid_stat.bsoftlimit >> 10;
-+ di->dqb_curspace = ugid->qugid_stat.bcurrent;
-+ di->dqb_ihardlimit = ugid->qugid_stat.ihardlimit;
-+ di->dqb_isoftlimit = ugid->qugid_stat.isoftlimit;
-+ di->dqb_curinodes = ugid->qugid_stat.icurrent;
-+ di->dqb_btime = ugid->qugid_stat.btime;
-+ di->dqb_itime = ugid->qugid_stat.itime;
-+ qmblk_data_read_unlock(qmblk);
-+ di->dqb_valid = QIF_ALL;
-+ vzquota_put_ugid(qmblk, ugid);
-+ } else {
-+ memset(di, 0, sizeof(*di));
-+ di->dqb_valid = QIF_ALL;
-+ }
-+
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+/* must be called under vz_quota_sem */
-+static int __vz_set_dqblk(struct vz_quota_master *qmblk,
-+ int type, qid_t id, struct if_dqblk *di)
-+{
-+ struct vz_quota_ugid *ugid;
-+
-+ ugid = vzquota_find_ugid(qmblk, id, type, 0);
-+ if (ugid == VZ_QUOTA_UGBAD)
-+ return -ESRCH;
-+
-+ qmblk_data_write_lock(qmblk);
-+ /*
-+ * Subtle compatibility breakage.
-+ *
-+ * Some old non-vz kernel quota didn't start grace period
-+ * if the new soft limit happens to be below the usage.
-+ * Non-vz kernel quota in 2.4.20 starts the grace period
-+ * (if it hasn't been started).
-+ * Current non-vz kernel performs even more complicated
-+ * manipulations...
-+ *
-+ * Also, current non-vz kernels have inconsistency related to
-+ * the grace time start. In regular operations the grace period
-+ * is started if the usage is greater than the soft limit (and,
-+ * strangely, is cancelled if the usage is less).
-+ * However, set_dqblk starts the grace period if the usage is greater
-+ * or equal to the soft limit.
-+ *
-+ * Here we try to mimic the behavior of the current non-vz kernel.
-+ */
-+ if (di->dqb_valid & QIF_BLIMITS) {
-+ ugid->qugid_stat.bhardlimit =
-+ (__u64)di->dqb_bhardlimit << 10;
-+ ugid->qugid_stat.bsoftlimit =
-+ (__u64)di->dqb_bsoftlimit << 10;
-+ if (di->dqb_bsoftlimit == 0 ||
-+ ugid->qugid_stat.bcurrent < ugid->qugid_stat.bsoftlimit)
-+ ugid->qugid_stat.btime = 0;
-+ else if (!(di->dqb_valid & QIF_BTIME))
-+ ugid->qugid_stat.btime = CURRENT_TIME_SECONDS
-+ + qmblk->dq_ugid_info[type].bexpire;
-+ else
-+ ugid->qugid_stat.btime = di->dqb_btime;
-+ }
-+ if (di->dqb_valid & QIF_ILIMITS) {
-+ ugid->qugid_stat.ihardlimit = di->dqb_ihardlimit;
-+ ugid->qugid_stat.isoftlimit = di->dqb_isoftlimit;
-+ if (di->dqb_isoftlimit == 0 ||
-+ ugid->qugid_stat.icurrent < ugid->qugid_stat.isoftlimit)
-+ ugid->qugid_stat.itime = 0;
-+ else if (!(di->dqb_valid & QIF_ITIME))
-+ ugid->qugid_stat.itime = CURRENT_TIME_SECONDS
-+ + qmblk->dq_ugid_info[type].iexpire;
-+ else
-+ ugid->qugid_stat.itime = di->dqb_itime;
-+ }
-+ qmblk_data_write_unlock(qmblk);
-+ vzquota_put_ugid(qmblk, ugid);
-+
-+ return 0;
-+}
-+
-+static int vz_set_dqblk(struct super_block *sb, int type,
-+ qid_t id, struct if_dqblk *di)
-+{
-+ struct vz_quota_master *qmblk;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+ err = __vz_set_dqblk(qmblk, type, id, di);
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+static int vz_get_dqinfo(struct super_block *sb, int type,
-+ struct if_dqinfo *ii)
-+{
-+ struct vz_quota_master *qmblk;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+
-+ err = 0;
-+ ii->dqi_bgrace = qmblk->dq_ugid_info[type].bexpire;
-+ ii->dqi_igrace = qmblk->dq_ugid_info[type].iexpire;
-+ ii->dqi_flags = 0;
-+ ii->dqi_valid = IIF_ALL;
-+
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+/* must be called under vz_quota_sem */
-+static int __vz_set_dqinfo(struct vz_quota_master *qmblk,
-+ int type, struct if_dqinfo *ii)
-+{
-+ if (ii->dqi_valid & IIF_FLAGS)
-+ if (ii->dqi_flags & DQF_MASK)
-+ return -EINVAL;
-+
-+ if (ii->dqi_valid & IIF_BGRACE)
-+ qmblk->dq_ugid_info[type].bexpire = ii->dqi_bgrace;
-+ if (ii->dqi_valid & IIF_IGRACE)
-+ qmblk->dq_ugid_info[type].iexpire = ii->dqi_igrace;
-+ return 0;
-+}
-+
-+static int vz_set_dqinfo(struct super_block *sb, int type,
-+ struct if_dqinfo *ii)
-+{
-+ struct vz_quota_master *qmblk;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ down(&vz_quota_sem);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+ err = __vz_set_dqinfo(qmblk, type, ii);
-+out:
-+ up(&vz_quota_sem);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+ return err;
-+}
-+
-+#ifdef CONFIG_QUOTA_COMPAT
-+
-+#define Q_GETQUOTI_SIZE 1024
-+
-+#define UGID2DQBLK(dst, src) \
-+ do { \
-+ (dst)->dqb_ihardlimit = (src)->qugid_stat.ihardlimit; \
-+ (dst)->dqb_isoftlimit = (src)->qugid_stat.isoftlimit; \
-+ (dst)->dqb_curinodes = (src)->qugid_stat.icurrent; \
-+ /* in 1K blocks */ \
-+ (dst)->dqb_bhardlimit = (src)->qugid_stat.bhardlimit >> 10; \
-+ /* in 1K blocks */ \
-+ (dst)->dqb_bsoftlimit = (src)->qugid_stat.bsoftlimit >> 10; \
-+ /* in bytes, 64 bit */ \
-+ (dst)->dqb_curspace = (src)->qugid_stat.bcurrent; \
-+ (dst)->dqb_btime = (src)->qugid_stat.btime; \
-+ (dst)->dqb_itime = (src)->qugid_stat.itime; \
-+ } while (0)
-+
-+static int vz_get_quoti(struct super_block *sb, int type, qid_t idx,
-+ struct v2_disk_dqblk *dqblk)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct v2_disk_dqblk *data, *kbuf;
-+ struct vz_quota_ugid *ugid;
-+ int count;
-+ int err;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ err = -ESRCH;
-+ if (qmblk == NULL)
-+ goto out;
-+ err = -EIO;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out;
-+
-+ err = -ENOMEM;
-+ kbuf = vmalloc(Q_GETQUOTI_SIZE * sizeof(*kbuf));
-+ if (!kbuf)
-+ goto out;
-+
-+ down(&vz_quota_sem);
-+ down(&qmblk->dq_sem);
-+ for (ugid = vzquota_get_byindex(qmblk, idx, type), count = 0;
-+ ugid != NULL && count < Q_GETQUOTI_SIZE;
-+ count++)
-+ {
-+ data = kbuf + count;
-+ qmblk_data_read_lock(qmblk);
-+ UGID2DQBLK(data, ugid);
-+ qmblk_data_read_unlock(qmblk);
-+ data->dqb_id = ugid->qugid_id;
-+
-+ /* Find next entry */
-+ ugid = vzquota_get_next(qmblk, ugid);
-+ BUG_ON(ugid != NULL && ugid->qugid_type != type);
-+ }
-+ up(&qmblk->dq_sem);
-+ up(&vz_quota_sem);
-+
-+ err = count;
-+ if (copy_to_user(dqblk, kbuf, count * sizeof(*kbuf)))
-+ err = -EFAULT;
-+
-+ vfree(kbuf);
-+out:
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qmblk);
-+
-+ return err;
-+}
-+
-+#endif
-+
-+struct quotactl_ops vz_quotactl_operations = {
-+ quota_on: vz_quota_on,
-+ quota_off: vz_quota_off,
-+ quota_sync: vz_quota_sync,
-+ get_info: vz_get_dqinfo,
-+ set_info: vz_set_dqinfo,
-+ get_dqblk: vz_get_dqblk,
-+ set_dqblk: vz_set_dqblk,
-+#ifdef CONFIG_QUOTA_COMPAT
-+ get_quoti: vz_get_quoti
-+#endif
-+};
-+
-+
-+/* ----------------------------------------------------------------------
-+ * Management interface for host system admins.
-+ * --------------------------------------------------------------------- */
-+
-+static int quota_ugid_addstat(unsigned int quota_id, unsigned int ugid_size,
-+ struct vz_quota_iface *u_ugid_buf)
-+{
-+ struct vz_quota_master *qmblk;
-+ int ret;
-+
-+ down(&vz_quota_sem);
-+
-+ ret = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ ret = -EBUSY;
-+ if (qmblk->dq_state != VZDQ_STARTING)
-+ goto out; /* working quota doesn't accept new ugids */
-+
-+ ret = 0;
-+ /* start to add ugids */
-+ for (ret = 0; ret < ugid_size; ret++) {
-+ struct vz_quota_iface ugid_buf;
-+ struct vz_quota_ugid *ugid;
-+
-+ if (copy_from_user(&ugid_buf, u_ugid_buf, sizeof(ugid_buf)))
-+ break;
-+
-+ if (ugid_buf.qi_type >= MAXQUOTAS)
-+ break; /* bad quota type - this is the only check */
-+
-+ ugid = vzquota_find_ugid(qmblk,
-+ ugid_buf.qi_id, ugid_buf.qi_type, 0);
-+ if (ugid == VZ_QUOTA_UGBAD) {
-+ qmblk->dq_flags |= VZDQUG_FIXED_SET;
-+ break; /* limit reached */
-+ }
-+
-+ /* update usage/limits
-+ * we can copy the data without the lock, because the data
-+ * cannot be modified in VZDQ_STARTING state */
-+ ugid->qugid_stat = ugid_buf.qi_stat;
-+
-+ vzquota_put_ugid(qmblk, ugid);
-+
-+ u_ugid_buf++; /* next user buffer */
-+ }
-+out:
-+ up(&vz_quota_sem);
-+
-+ return ret;
-+}
-+
-+static int quota_ugid_setgrace(unsigned int quota_id,
-+ struct dq_info u_dq_info[])
-+{
-+ struct vz_quota_master *qmblk;
-+ struct dq_info dq_info[MAXQUOTAS];
-+ struct dq_info *target;
-+ int err, type;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EBUSY;
-+ if (qmblk->dq_state != VZDQ_STARTING)
-+ goto out; /* working quota doesn't accept changing options */
-+
-+ err = -EFAULT;
-+ if (copy_from_user(dq_info, u_dq_info, sizeof(dq_info)))
-+ goto out;
-+
-+ err = 0;
-+
-+ /* update in qmblk */
-+ for (type = 0; type < MAXQUOTAS; type ++) {
-+ target = &qmblk->dq_ugid_info[type];
-+ target->bexpire = dq_info[type].bexpire;
-+ target->iexpire = dq_info[type].iexpire;
-+ }
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+static int do_quota_ugid_getstat(struct vz_quota_master *qmblk, int index, int size,
-+ struct vz_quota_iface *u_ugid_buf)
-+{
-+ int type, count;
-+ struct vz_quota_ugid *ugid;
-+
-+ if (QTREE_LEAFNUM(qmblk->dq_uid_tree) +
-+ QTREE_LEAFNUM(qmblk->dq_gid_tree)
-+ <= index)
-+ return 0;
-+
-+ count = 0;
-+
-+ type = index < QTREE_LEAFNUM(qmblk->dq_uid_tree) ? USRQUOTA : GRPQUOTA;
-+ if (type == GRPQUOTA)
-+ index -= QTREE_LEAFNUM(qmblk->dq_uid_tree);
-+
-+ /* loop through ugid and then qgid quota */
-+repeat:
-+ for (ugid = vzquota_get_byindex(qmblk, index, type);
-+ ugid != NULL && count < size;
-+ ugid = vzquota_get_next(qmblk, ugid), count++)
-+ {
-+ struct vz_quota_iface ugid_buf;
-+
-+ /* form interface buffer and send in to user-level */
-+ qmblk_data_read_lock(qmblk);
-+ memcpy(&ugid_buf.qi_stat, &ugid->qugid_stat,
-+ sizeof(ugid_buf.qi_stat));
-+ qmblk_data_read_unlock(qmblk);
-+ ugid_buf.qi_id = ugid->qugid_id;
-+ ugid_buf.qi_type = ugid->qugid_type;
-+
-+ memcpy(u_ugid_buf, &ugid_buf, sizeof(ugid_buf));
-+ u_ugid_buf++; /* next portion of user buffer */
-+ }
-+
-+ if (type == USRQUOTA && count < size) {
-+ type = GRPQUOTA;
-+ index = 0;
-+ goto repeat;
-+ }
-+
-+ return count;
-+}
-+
-+static int quota_ugid_getstat(unsigned int quota_id,
-+ int index, int size, struct vz_quota_iface *u_ugid_buf)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_iface *k_ugid_buf;
-+ int err;
-+
-+ if (index < 0 || size < 0)
-+ return -EINVAL;
-+
-+ if (size > INT_MAX / sizeof(struct vz_quota_iface))
-+ return -EINVAL;
-+
-+ k_ugid_buf = vmalloc(size * sizeof(struct vz_quota_iface));
-+ if (k_ugid_buf == NULL)
-+ return -ENOMEM;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ down(&qmblk->dq_sem);
-+ err = do_quota_ugid_getstat(qmblk, index, size, k_ugid_buf);
-+ up(&qmblk->dq_sem);
-+ if (err < 0)
-+ goto out;
-+
-+ if (copy_to_user(u_ugid_buf, k_ugid_buf,
-+ size * sizeof(struct vz_quota_iface)))
-+ err = -EFAULT;
-+
-+out:
-+ up(&vz_quota_sem);
-+ vfree(k_ugid_buf);
-+ return err;
-+}
-+
-+static int quota_ugid_getgrace(unsigned int quota_id,
-+ struct dq_info u_dq_info[])
-+{
-+ struct vz_quota_master *qmblk;
-+ struct dq_info dq_info[MAXQUOTAS];
-+ struct dq_info *target;
-+ int err, type;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = 0;
-+ /* update from qmblk */
-+ for (type = 0; type < MAXQUOTAS; type ++) {
-+ target = &qmblk->dq_ugid_info[type];
-+ dq_info[type].bexpire = target->bexpire;
-+ dq_info[type].iexpire = target->iexpire;
-+ dq_info[type].flags = target->flags;
-+ }
-+
-+ if (copy_to_user(u_dq_info, dq_info, sizeof(dq_info)))
-+ err = -EFAULT;
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+static int quota_ugid_getconfig(unsigned int quota_id,
-+ struct vz_quota_ugid_stat *info)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid_stat kinfo;
-+ int err;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = 0;
-+ kinfo.limit = qmblk->dq_ugid_max;
-+ kinfo.count = qmblk->dq_ugid_count;
-+ kinfo.flags = qmblk->dq_flags;
-+
-+ if (copy_to_user(info, &kinfo, sizeof(kinfo)))
-+ err = -EFAULT;
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+static int quota_ugid_setconfig(unsigned int quota_id,
-+ struct vz_quota_ugid_stat *info)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid_stat kinfo;
-+ int err;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ENOENT;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EFAULT;
-+ if (copy_from_user(&kinfo, info, sizeof(kinfo)))
-+ goto out;
-+
-+ err = 0;
-+ qmblk->dq_ugid_max = kinfo.limit;
-+ if (qmblk->dq_state == VZDQ_STARTING) {
-+ qmblk->dq_flags = kinfo.flags;
-+ if (qmblk->dq_flags & VZDQUG_ON)
-+ qmblk->dq_flags |= VZDQ_USRQUOTA | VZDQ_GRPQUOTA;
-+ }
-+
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+static int quota_ugid_setlimit(unsigned int quota_id,
-+ struct vz_quota_ugid_setlimit *u_lim)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid_setlimit lim;
-+ int err;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ESRCH;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EFAULT;
-+ if (copy_from_user(&lim, u_lim, sizeof(lim)))
-+ goto out;
-+
-+ err = __vz_set_dqblk(qmblk, lim.type, lim.id, &lim.dqb);
-+
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+static int quota_ugid_setinfo(unsigned int quota_id,
-+ struct vz_quota_ugid_setinfo *u_info)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid_setinfo info;
-+ int err;
-+
-+ down(&vz_quota_sem);
-+
-+ err = -ESRCH;
-+ qmblk = vzquota_find_master(quota_id);
-+ if (qmblk == NULL)
-+ goto out;
-+
-+ err = -EFAULT;
-+ if (copy_from_user(&info, u_info, sizeof(info)))
-+ goto out;
-+
-+ err = __vz_set_dqinfo(qmblk, info.type, &info.dqi);
-+
-+out:
-+ up(&vz_quota_sem);
-+
-+ return err;
-+}
-+
-+/*
-+ * This is a system call to maintain UGID quotas
-+ * Note this call is allowed to run ONLY from VE0
-+ */
-+long do_vzquotaugidctl(struct vzctl_quotaugidctl *qub)
-+{
-+ int ret;
-+
-+ ret = -EPERM;
-+ /* access allowed only from root of VE0 */
-+ if (!capable(CAP_SYS_RESOURCE) ||
-+ !capable(CAP_SYS_ADMIN))
-+ goto out;
-+
-+ switch (qub->cmd) {
-+ case VZ_DQ_UGID_GETSTAT:
-+ ret = quota_ugid_getstat(qub->quota_id,
-+ qub->ugid_index, qub->ugid_size,
-+ (struct vz_quota_iface *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_ADDSTAT:
-+ ret = quota_ugid_addstat(qub->quota_id, qub->ugid_size,
-+ (struct vz_quota_iface *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_GETGRACE:
-+ ret = quota_ugid_getgrace(qub->quota_id,
-+ (struct dq_info *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_SETGRACE:
-+ ret = quota_ugid_setgrace(qub->quota_id,
-+ (struct dq_info *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_GETCONFIG:
-+ ret = quota_ugid_getconfig(qub->quota_id,
-+ (struct vz_quota_ugid_stat *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_SETCONFIG:
-+ ret = quota_ugid_setconfig(qub->quota_id,
-+ (struct vz_quota_ugid_stat *)qub->addr);
-+ break;
-+ case VZ_DQ_UGID_SETLIMIT:
-+ ret = quota_ugid_setlimit(qub->quota_id,
-+ (struct vz_quota_ugid_setlimit *)
-+ qub->addr);
-+ break;
-+ case VZ_DQ_UGID_SETINFO:
-+ ret = quota_ugid_setinfo(qub->quota_id,
-+ (struct vz_quota_ugid_setinfo *)
-+ qub->addr);
-+ break;
-+ default:
-+ ret = -EINVAL;
-+ goto out;
-+ }
-+out:
-+ return ret;
-+}
-+
-+static void ugid_quota_on_sb(struct super_block *sb)
-+{
-+ struct super_block *real_sb;
-+ struct vz_quota_master *qmblk;
-+
-+ if (!sb->s_op->get_quota_root)
-+ return;
-+
-+ real_sb = sb->s_op->get_quota_root(sb)->i_sb;
-+ if (real_sb->dq_op != &vz_quota_operations)
-+ return;
-+
-+ sb->dq_op = &vz_quota_operations2;
-+ sb->s_qcop = &vz_quotactl_operations;
-+ INIT_LIST_HEAD(&sb->s_dquot.info[USRQUOTA].dqi_dirty_list);
-+ INIT_LIST_HEAD(&sb->s_dquot.info[GRPQUOTA].dqi_dirty_list);
-+ sb->s_dquot.info[USRQUOTA].dqi_format = &vz_quota_empty_v2_format;
-+ sb->s_dquot.info[GRPQUOTA].dqi_format = &vz_quota_empty_v2_format;
-+
-+ qmblk = vzquota_find_qmblk(sb);
-+ if ((qmblk == NULL) || (qmblk == VZ_QUOTA_BAD))
-+ return;
-+ down(&vz_quota_sem);
-+ if (qmblk->dq_flags & VZDQ_USRQUOTA)
-+ sb->s_dquot.flags |= DQUOT_USR_ENABLED;
-+ if (qmblk->dq_flags & VZDQ_GRPQUOTA)
-+ sb->s_dquot.flags |= DQUOT_GRP_ENABLED;
-+ up(&vz_quota_sem);
-+ qmblk_put(qmblk);
-+}
-+
-+static void ugid_quota_off_sb(struct super_block *sb)
-+{
-+ /* can't make quota off on mounted super block */
-+ BUG_ON(sb->s_root != NULL);
-+}
-+
-+static int ugid_notifier_call(struct vnotifier_block *self,
-+ unsigned long n, void *data, int old_ret)
-+{
-+ struct virt_info_quota *viq;
-+
-+ viq = (struct virt_info_quota *)data;
-+
-+ switch (n) {
-+ case VIRTINFO_QUOTA_ON:
-+ ugid_quota_on_sb(viq->super);
-+ break;
-+ case VIRTINFO_QUOTA_OFF:
-+ ugid_quota_off_sb(viq->super);
-+ break;
-+ case VIRTINFO_QUOTA_GETSTAT:
-+ break;
-+ default:
-+ return old_ret;
-+ }
-+ return NOTIFY_OK;
-+}
-+
-+static struct vnotifier_block ugid_notifier_block = {
-+ .notifier_call = ugid_notifier_call,
-+};
-+
-+/* ----------------------------------------------------------------------
-+ * Init/exit.
-+ * --------------------------------------------------------------------- */
-+
-+struct quota_format_type vz_quota_empty_v2_format = {
-+ qf_fmt_id: QFMT_VFS_V0,
-+ qf_ops: NULL,
-+ qf_owner: THIS_MODULE
-+};
-+
-+int vzquota_ugid_init()
-+{
-+ int err;
-+
-+ vz_quota_ugid_cachep = kmem_cache_create("vz_quota_ugid",
-+ sizeof(struct vz_quota_ugid),
-+ 0, SLAB_HWCACHE_ALIGN,
-+ NULL, NULL);
-+ if (vz_quota_ugid_cachep == NULL)
-+ goto err_slab;
-+
-+ err = register_quota_format(&vz_quota_empty_v2_format);
-+ if (err)
-+ goto err_reg;
-+
-+ virtinfo_notifier_register(VITYPE_QUOTA, &ugid_notifier_block);
-+ return 0;
-+
-+err_reg:
-+ kmem_cache_destroy(vz_quota_ugid_cachep);
-+ return err;
-+
-+err_slab:
-+ printk(KERN_ERR "Cannot create VZ_QUOTA SLAB cache\n");
-+ return -ENOMEM;
-+}
-+
-+void vzquota_ugid_release()
-+{
-+ virtinfo_notifier_unregister(VITYPE_QUOTA, &ugid_notifier_block);
-+ unregister_quota_format(&vz_quota_empty_v2_format);
-+
-+ if (kmem_cache_destroy(vz_quota_ugid_cachep))
-+ printk(KERN_ERR "VZQUOTA: kmem_cache_destroy failed\n");
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/vzdquot.c linux-2.6.9-ve023stab030/fs/vzdquot.c
---- linux-2.6.9-42.0.3.EL.orig/fs/vzdquot.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/fs/vzdquot.c 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,1714 @@
-+/*
-+ * Copyright (C) 2001, 2002, 2004, 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains the core of Virtuozzo disk quota implementation:
-+ * maintenance of VZDQ information in inodes,
-+ * external interfaces,
-+ * module entry.
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <linux/string.h>
-+#include <linux/list.h>
-+#include <asm/atomic.h>
-+#include <linux/spinlock.h>
-+#include <asm/semaphore.h>
-+#include <linux/slab.h>
-+#include <linux/fs.h>
-+#include <linux/dcache.h>
-+#include <linux/quota.h>
-+#include <linux/rcupdate.h>
-+#include <linux/module.h>
-+#include <asm/uaccess.h>
-+#include <linux/vzctl.h>
-+#include <linux/vzctl_quota.h>
-+#include <linux/vzquota.h>
-+#include <linux/virtinfo.h>
-+#include <linux/vzdq_tree.h>
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Locking
-+ *
-+ * ---------------------------------------------------------------------- */
-+
-+/*
-+ * Serializes on/off and all other do_vzquotactl operations.
-+ * Protects qmblk hash.
-+ */
-+struct semaphore vz_quota_sem;
-+
-+/*
-+ * Data access locks
-+ * inode_qmblk
-+ * protects qmblk pointers in all inodes and qlnk content in general
-+ * (but not qmblk content);
-+ * also protects related qmblk invalidation procedures;
-+ * can't be per-inode because of vzquota_dtree_qmblk complications
-+ * and problems with serialization with quota_on,
-+ * but can be per-superblock;
-+ * qmblk_data
-+ * protects qmblk fields (such as current usage)
-+ * quota_data
-+ * protects charge/uncharge operations, thus, implies
-+ * qmblk_data lock and, if CONFIG_VZ_QUOTA_UGID, inode_qmblk lock
-+ * (to protect ugid pointers).
-+ *
-+ * Lock order:
-+ * inode_qmblk_lock -> dcache_lock
-+ * inode_qmblk_lock -> qmblk_data
-+ */
-+static spinlock_t vzdq_qmblk_lock = SPIN_LOCK_UNLOCKED;
-+
-+inline void inode_qmblk_lock(struct super_block *sb)
-+{
-+ spin_lock(&vzdq_qmblk_lock);
-+}
-+
-+inline void inode_qmblk_unlock(struct super_block *sb)
-+{
-+ spin_unlock(&vzdq_qmblk_lock);
-+}
-+
-+inline void qmblk_data_read_lock(struct vz_quota_master *qmblk)
-+{
-+ spin_lock(&qmblk->dq_data_lock);
-+}
-+
-+inline void qmblk_data_read_unlock(struct vz_quota_master *qmblk)
-+{
-+ spin_unlock(&qmblk->dq_data_lock);
-+}
-+
-+inline void qmblk_data_write_lock(struct vz_quota_master *qmblk)
-+{
-+ spin_lock(&qmblk->dq_data_lock);
-+}
-+
-+inline void qmblk_data_write_unlock(struct vz_quota_master *qmblk)
-+{
-+ spin_unlock(&qmblk->dq_data_lock);
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Master hash table handling.
-+ *
-+ * SMP not safe, serialied by vz_quota_sem within quota syscalls
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+static kmem_cache_t *vzquota_cachep;
-+
-+/*
-+ * Hash function.
-+ */
-+#define QHASH_BITS 6
-+#define VZ_QUOTA_HASH_SIZE (1 << QHASH_BITS)
-+#define QHASH_MASK (VZ_QUOTA_HASH_SIZE - 1)
-+
-+struct list_head vzquota_hash_table[VZ_QUOTA_HASH_SIZE];
-+int vzquota_hash_size = VZ_QUOTA_HASH_SIZE;
-+
-+static inline int vzquota_hash_func(unsigned int qid)
-+{
-+ return (((qid >> QHASH_BITS) ^ qid) & QHASH_MASK);
-+}
-+
-+/**
-+ * vzquota_alloc_master - alloc and instantiate master quota record
-+ *
-+ * Returns:
-+ * pointer to newly created record if SUCCESS
-+ * -ENOMEM if out of memory
-+ * -EEXIST if record with given quota_id already exist
-+ */
-+struct vz_quota_master *vzquota_alloc_master(unsigned int quota_id,
-+ struct vz_quota_stat *qstat)
-+{
-+ int err;
-+ struct vz_quota_master *qmblk;
-+
-+ err = -EEXIST;
-+ if (vzquota_find_master(quota_id) != NULL)
-+ goto out;
-+
-+ err = -ENOMEM;
-+ qmblk = kmem_cache_alloc(vzquota_cachep, SLAB_KERNEL);
-+ if (qmblk == NULL)
-+ goto out;
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ qmblk->dq_uid_tree = quotatree_alloc();
-+ if (!qmblk->dq_uid_tree)
-+ goto out_free;
-+
-+ qmblk->dq_gid_tree = quotatree_alloc();
-+ if (!qmblk->dq_gid_tree)
-+ goto out_free_tree;
-+#endif
-+
-+ qmblk->dq_state = VZDQ_STARTING;
-+ init_MUTEX(&qmblk->dq_sem);
-+ spin_lock_init(&qmblk->dq_data_lock);
-+
-+ qmblk->dq_id = quota_id;
-+ qmblk->dq_stat = qstat->dq_stat;
-+ qmblk->dq_info = qstat->dq_info;
-+ qmblk->dq_root_dentry = NULL;
-+ qmblk->dq_root_mnt = NULL;
-+ qmblk->dq_sb = NULL;
-+ qmblk->dq_ugid_count = 0;
-+ qmblk->dq_ugid_max = 0;
-+ qmblk->dq_flags = 0;
-+ memset(qmblk->dq_ugid_info, 0, sizeof(qmblk->dq_ugid_info));
-+ INIT_LIST_HEAD(&qmblk->dq_ilink_list);
-+
-+ atomic_set(&qmblk->dq_count, 1);
-+
-+ /* insert in hash chain */
-+ list_add(&qmblk->dq_hash,
-+ &vzquota_hash_table[vzquota_hash_func(quota_id)]);
-+
-+ /* success */
-+ return qmblk;
-+
-+out_free_tree:
-+ quotatree_free(qmblk->dq_uid_tree, NULL);
-+out_free:
-+ kmem_cache_free(vzquota_cachep, qmblk);
-+out:
-+ return ERR_PTR(err);
-+}
-+
-+static struct vz_quota_master *vzquota_alloc_fake(void)
-+{
-+ struct vz_quota_master *qmblk;
-+
-+ qmblk = kmem_cache_alloc(vzquota_cachep, SLAB_KERNEL);
-+ if (qmblk == NULL)
-+ return NULL;
-+ memset(qmblk, 0, sizeof(*qmblk));
-+ qmblk->dq_state = VZDQ_STOPING;
-+ qmblk->dq_flags = VZDQ_NOQUOT;
-+ spin_lock_init(&qmblk->dq_data_lock);
-+ INIT_LIST_HEAD(&qmblk->dq_ilink_list);
-+ atomic_set(&qmblk->dq_count, 1);
-+ return qmblk;
-+}
-+
-+/**
-+ * vzquota_find_master - find master record with given id
-+ *
-+ * Returns qmblk without touching its refcounter.
-+ * Called under vz_quota_sem.
-+ */
-+struct vz_quota_master *vzquota_find_master(unsigned int quota_id)
-+{
-+ int i;
-+ struct vz_quota_master *qp;
-+
-+ i = vzquota_hash_func(quota_id);
-+ list_for_each_entry(qp, &vzquota_hash_table[i], dq_hash) {
-+ if (qp->dq_id == quota_id)
-+ return qp;
-+ }
-+ return NULL;
-+}
-+
-+/**
-+ * vzquota_free_master - release resources taken by qmblk, freeing memory
-+ *
-+ * qmblk is assumed to be already taken out from the hash.
-+ * Should be called outside vz_quota_sem.
-+ */
-+void vzquota_free_master(struct vz_quota_master *qmblk)
-+{
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ vzquota_kill_ugid(qmblk);
-+#endif
-+ BUG_ON(!list_empty(&qmblk->dq_ilink_list));
-+ kmem_cache_free(vzquota_cachep, qmblk);
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Passing quota information through current
-+ *
-+ * Used in inode -> qmblk lookup at inode creation stage (since at that
-+ * time there are no links between the inode being created and its parent
-+ * directory).
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+#define VZDQ_CUR_MAGIC 0x57d0fee2
-+
-+static inline int vzquota_cur_qmblk_check(void)
-+{
-+ return current->magic == VZDQ_CUR_MAGIC;
-+}
-+
-+static inline struct inode *vzquota_cur_qmblk_fetch(void)
-+{
-+ return current->ino;
-+}
-+
-+static inline void vzquota_cur_qmblk_set(struct inode *data)
-+{
-+ struct task_struct *tsk;
-+
-+ tsk = current;
-+ tsk->magic = VZDQ_CUR_MAGIC;
-+ tsk->ino = data;
-+}
-+
-+#if 0
-+static inline void vzquota_cur_qmblk_reset(void)
-+{
-+ current->magic = 0;
-+}
-+#endif
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Superblock quota operations
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+/*
-+ * Kernel structure abuse.
-+ * We use files[0] pointer as an int variable:
-+ * reference counter of how many quota blocks uses this superblock.
-+ * files[1] is used for generations structure which helps us to track
-+ * when traversing of dentries is really required.
-+ */
-+#define __VZ_QUOTA_NOQUOTA(sb) (*(struct vz_quota_master **)\
-+ &sb->s_dquot.files[1])
-+#define __VZ_QUOTA_TSTAMP(sb) ((struct timeval *)\
-+ &sb->s_dquot.dqio_sem)
-+
-+#if defined(VZ_QUOTA_UNLOAD)
-+
-+#define __VZ_QUOTA_SBREF(sb) (*(int *)&sb->s_dquot.files[0])
-+
-+struct dquot_operations *orig_dq_op;
-+struct quotactl_ops *orig_dq_cop;
-+
-+/**
-+ * quota_get_super - account for new a quoted tree under the superblock
-+ *
-+ * One superblock can have multiple directory subtrees with different VZ
-+ * quotas. We keep a counter of such subtrees and set VZ quota operations or
-+ * reset the default ones.
-+ *
-+ * Called under vz_quota_sem (from quota_on).
-+ */
-+int vzquota_get_super(struct super_block *sb)
-+{
-+ if (sb->dq_op != &vz_quota_operations) {
-+ down(&sb->s_dquot.dqonoff_sem);
-+ if (sb->s_dquot.flags & (DQUOT_USR_ENABLED|DQUOT_GRP_ENABLED)) {
-+ up(&sb->s_dquot.dqonoff_sem);
-+ return -EEXIST;
-+ }
-+ if (orig_dq_op == NULL && sb->dq_op != NULL)
-+ orig_dq_op = sb->dq_op;
-+ sb->dq_op = &vz_quota_operations;
-+ if (orig_dq_cop == NULL && sb->s_qcop != NULL)
-+ orig_dq_cop = sb->s_qcop;
-+ /* XXX this may race with sys_quotactl */
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ sb->s_qcop = &vz_quotactl_operations;
-+#else
-+ sb->s_qcop = NULL;
-+#endif
-+ do_gettimeofday(__VZ_QUOTA_TSTAMP(sb));
-+ memset(&sb->s_dquot.info, 0, sizeof(sb->s_dquot.info));
-+
-+ INIT_LIST_HEAD(&sb->s_dquot.info[USRQUOTA].dqi_dirty_list);
-+ INIT_LIST_HEAD(&sb->s_dquot.info[GRPQUOTA].dqi_dirty_list);
-+ sb->s_dquot.info[USRQUOTA].dqi_format = &vz_quota_empty_v2_format;
-+ sb->s_dquot.info[GRPQUOTA].dqi_format = &vz_quota_empty_v2_format;
-+ /*
-+ * To get quotaops.h call us we need to mark superblock
-+ * as having quota. These flags mark the moment when
-+ * our dq_op start to be called.
-+ *
-+ * The ordering of dq_op and s_dquot.flags assignment
-+ * needs to be enforced, but other CPUs do not do rmb()
-+ * between s_dquot.flags and dq_op accesses.
-+ */
-+ wmb(); synchronize_kernel();
-+ sb->s_dquot.flags = DQUOT_USR_ENABLED|DQUOT_GRP_ENABLED;
-+ __module_get(THIS_MODULE);
-+ up(&sb->s_dquot.dqonoff_sem);
-+ }
-+ /* protected by vz_quota_sem */
-+ __VZ_QUOTA_SBREF(sb)++;
-+ return 0;
-+}
-+
-+/**
-+ * quota_put_super - release superblock when one quota tree goes away
-+ *
-+ * Called under vz_quota_sem.
-+ */
-+void vzquota_put_super(struct super_block *sb)
-+{
-+ int count;
-+
-+ count = --__VZ_QUOTA_SBREF(sb);
-+ if (count == 0) {
-+ down(&sb->s_dquot.dqonoff_sem);
-+ sb->s_dquot.flags = 0;
-+ wmb(); synchronize_kernel();
-+ sema_init(&sb->s_dquot.dqio_sem, 1);
-+ sb->s_qcop = orig_dq_cop;
-+ sb->dq_op = orig_dq_op;
-+ inode_qmblk_lock(sb);
-+ quota_gen_put(SB_QGEN(sb));
-+ SB_QGEN(sb) = NULL;
-+ /* release qlnk's without qmblk */
-+ remove_inode_quota_links_list(&non_vzquota_inodes_lh,
-+ sb, NULL);
-+ /*
-+ * Races with quota initialization:
-+ * after this inode_qmblk_unlock all inode's generations are
-+ * invalidated, quota_inode_qmblk checks superblock operations.
-+ */
-+ inode_qmblk_unlock(sb);
-+ /*
-+ * Module refcounting: in theory, this is the best place
-+ * to call module_put(THIS_MODULE).
-+ * In reality, it can't be done because we can't be sure that
-+ * other CPUs do not enter our code segment through dq_op
-+ * cached long time ago. Quotaops interface isn't supposed to
-+ * go into modules currently (that is, into unloadable
-+ * modules). By omitting module_put, our module isn't
-+ * unloadable.
-+ */
-+ up(&sb->s_dquot.dqonoff_sem);
-+ }
-+}
-+
-+#else
-+
-+struct vzquota_new_sop {
-+ struct super_operations new_op;
-+ struct super_operations *old_op;
-+};
-+
-+/**
-+ * vzquota_shutdown_super - callback on umount
-+ */
-+void vzquota_shutdown_super(struct super_block *sb)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vzquota_new_sop *sop;
-+
-+ qmblk = __VZ_QUOTA_NOQUOTA(sb);
-+ __VZ_QUOTA_NOQUOTA(sb) = NULL;
-+ if (qmblk != NULL)
-+ qmblk_put(qmblk);
-+ sop = container_of(sb->s_op, struct vzquota_new_sop, new_op);
-+ sb->s_op = sop->old_op;
-+ kfree(sop);
-+ (*sb->s_op->put_super)(sb);
-+}
-+
-+/**
-+ * vzquota_get_super - account for new a quoted tree under the superblock
-+ *
-+ * One superblock can have multiple directory subtrees with different VZ
-+ * quotas.
-+ *
-+ * Called under vz_quota_sem (from vzquota_on).
-+ */
-+int vzquota_get_super(struct super_block *sb)
-+{
-+ struct vz_quota_master *qnew;
-+ struct vzquota_new_sop *sop;
-+ int err;
-+
-+ down(&sb->s_dquot.dqonoff_sem);
-+ err = -EEXIST;
-+ if ((sb->s_dquot.flags & (DQUOT_USR_ENABLED|DQUOT_GRP_ENABLED)) &&
-+ sb->dq_op != &vz_quota_operations)
-+ goto out_up;
-+
-+ /*
-+ * This allocation code should be under sb->dq_op check below, but
-+ * it doesn't really matter...
-+ */
-+ if (__VZ_QUOTA_NOQUOTA(sb) == NULL) {
-+ qnew = vzquota_alloc_fake();
-+ if (qnew == NULL)
-+ goto out_up;
-+ __VZ_QUOTA_NOQUOTA(sb) = qnew;
-+ }
-+
-+ if (sb->dq_op != &vz_quota_operations) {
-+ sop = kmalloc(sizeof(*sop), GFP_KERNEL);
-+ if (sop == NULL) {
-+ vzquota_free_master(__VZ_QUOTA_NOQUOTA(sb));
-+ __VZ_QUOTA_NOQUOTA(sb) = NULL;
-+ goto out_up;
-+ }
-+ memcpy(&sop->new_op, sb->s_op, sizeof(sop->new_op));
-+ sop->new_op.put_super = &vzquota_shutdown_super;
-+ sop->old_op = sb->s_op;
-+ sb->s_op = &sop->new_op;
-+
-+ sb->dq_op = &vz_quota_operations;
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ sb->s_qcop = &vz_quotactl_operations;
-+#else
-+ sb->s_qcop = NULL;
-+#endif
-+ do_gettimeofday(__VZ_QUOTA_TSTAMP(sb));
-+
-+ memset(&sb->s_dquot.info, 0, sizeof(sb->s_dquot.info));
-+ /* these 2 list heads are checked in sync_dquots() */
-+ INIT_LIST_HEAD(&sb->s_dquot.info[USRQUOTA].dqi_dirty_list);
-+ INIT_LIST_HEAD(&sb->s_dquot.info[GRPQUOTA].dqi_dirty_list);
-+ sb->s_dquot.info[USRQUOTA].dqi_format =
-+ &vz_quota_empty_v2_format;
-+ sb->s_dquot.info[GRPQUOTA].dqi_format =
-+ &vz_quota_empty_v2_format;
-+
-+ /*
-+ * To get quotaops.h to call us we need to mark superblock
-+ * as having quota. These flags mark the moment when
-+ * our dq_op start to be called.
-+ *
-+ * The ordering of dq_op and s_dquot.flags assignment
-+ * needs to be enforced, but other CPUs do not do rmb()
-+ * between s_dquot.flags and dq_op accesses.
-+ */
-+ wmb(); synchronize_kernel();
-+ sb->s_dquot.flags = DQUOT_USR_ENABLED|DQUOT_GRP_ENABLED;
-+ }
-+ err = 0;
-+
-+out_up:
-+ up(&sb->s_dquot.dqonoff_sem);
-+ return err;
-+}
-+
-+/**
-+ * vzquota_put_super - one quota tree less on this superblock
-+ *
-+ * Called under vz_quota_sem.
-+ */
-+void vzquota_put_super(struct super_block *sb)
-+{
-+ /*
-+ * Even if this put is the last one,
-+ * sb->s_dquot.flags can't be cleared, because otherwise vzquota_drop
-+ * won't be called and the remaining qmblk references won't be put.
-+ */
-+}
-+
-+#endif
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Helpers for inode -> qmblk link maintenance
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+#define __VZ_QUOTA_EMPTY ((void *)0xbdbdbdbd)
-+#define VZ_QUOTA_IS_NOQUOTA(qm, sb) ((qm)->dq_flags & VZDQ_NOQUOT)
-+#define VZ_QUOTA_EMPTY_IOPS (&vfs_empty_iops)
-+extern struct inode_operations vfs_empty_iops;
-+
-+static int VZ_QUOTA_IS_ACTUAL(struct inode *inode)
-+{
-+ struct vz_quota_master *qmblk;
-+
-+ qmblk = INODE_QLNK(inode)->qmblk;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ return 1;
-+ if (qmblk == __VZ_QUOTA_EMPTY)
-+ return 0;
-+ if (qmblk->dq_flags & VZDQ_NOACT)
-+ /* not actual (invalidated) qmblk */
-+ return 0;
-+ return 1;
-+}
-+
-+static inline int vzquota_qlnk_is_empty(struct vz_quota_ilink *qlnk)
-+{
-+ return qlnk->qmblk == __VZ_QUOTA_EMPTY;
-+}
-+
-+static inline void vzquota_qlnk_set_empty(struct vz_quota_ilink *qlnk)
-+{
-+ qlnk->qmblk = __VZ_QUOTA_EMPTY;
-+ qlnk->origin = VZ_QUOTAO_SETE;
-+}
-+
-+void vzquota_qlnk_init(struct vz_quota_ilink *qlnk)
-+{
-+ memset(qlnk, 0, sizeof(*qlnk));
-+ INIT_LIST_HEAD(&qlnk->list);
-+ vzquota_qlnk_set_empty(qlnk);
-+ qlnk->origin = VZ_QUOTAO_INIT;
-+}
-+
-+void vzquota_qlnk_destroy(struct vz_quota_ilink *qlnk)
-+{
-+ might_sleep();
-+ if (vzquota_qlnk_is_empty(qlnk))
-+ return;
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+ if (qlnk->qmblk != NULL && qlnk->qmblk != VZ_QUOTA_BAD) {
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid *quid, *qgid;
-+ qmblk = qlnk->qmblk;
-+ quid = qlnk->qugid[USRQUOTA];
-+ qgid = qlnk->qugid[GRPQUOTA];
-+ if (quid != NULL || qgid != NULL) {
-+ down(&qmblk->dq_sem);
-+ if (qgid != NULL)
-+ vzquota_put_ugid(qmblk, qgid);
-+ if (quid != NULL)
-+ vzquota_put_ugid(qmblk, quid);
-+ up(&qmblk->dq_sem);
-+ }
-+ }
-+#endif
-+ if (qlnk->qmblk != NULL && qlnk->qmblk != VZ_QUOTA_BAD)
-+ qmblk_put(qlnk->qmblk);
-+ qlnk->origin = VZ_QUOTAO_DESTR;
-+}
-+
-+/**
-+ * vzquota_qlnk_swap - swap inode's and temporary vz_quota_ilink contents
-+ * @qlt: temporary
-+ * @qli: inode's
-+ *
-+ * Locking is provided by the caller (depending on the context).
-+ * After swap, @qli is inserted into the corresponding dq_ilink_list,
-+ * @qlt list is reinitialized.
-+ */
-+static void vzquota_qlnk_swap(struct vz_quota_ilink *qlt,
-+ struct vz_quota_ilink *qli)
-+{
-+ struct vz_quota_master *qb;
-+ struct vz_quota_ugid *qu;
-+ int i;
-+
-+ qb = qlt->qmblk;
-+ qlt->qmblk = qli->qmblk;
-+ qli->qmblk = qb;
-+ list_del_init(&qli->list);
-+ if (qb != __VZ_QUOTA_EMPTY && qb != VZ_QUOTA_BAD)
-+ list_add(&qli->list, &qb->dq_ilink_list);
-+ INIT_LIST_HEAD(&qlt->list);
-+ qli->origin = VZ_QUOTAO_SWAP;
-+
-+ for (i = 0; i < MAXQUOTAS; i++) {
-+ qu = qlt->qugid[i];
-+ qlt->qugid[i] = qli->qugid[i];
-+ qli->qugid[i] = qu;
-+ }
-+}
-+
-+/**
-+ * vzquota_qlnk_reinit_locked - destroy qlnk content, called under locks
-+ *
-+ * Called under dcache_lock and inode_qmblk locks.
-+ * Returns 1 if locks were dropped inside, 0 if atomic.
-+ */
-+static int vzquota_qlnk_reinit_locked(struct vz_quota_ilink *qlnk,
-+ struct inode *inode)
-+{
-+ if (vzquota_qlnk_is_empty(qlnk))
-+ return 0;
-+ if (qlnk->qmblk == VZ_QUOTA_BAD) {
-+ vzquota_qlnk_set_empty(qlnk);
-+ return 0;
-+ }
-+ spin_unlock(&dcache_lock);
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(qlnk);
-+ vzquota_qlnk_init(qlnk);
-+ inode_qmblk_lock(inode->i_sb);
-+ spin_lock(&dcache_lock);
-+ return 1;
-+}
-+
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+/**
-+ * vzquota_qlnk_reinit_attr - destroy and reinit qlnk content
-+ *
-+ * Similar to vzquota_qlnk_reinit_locked, called under different locks.
-+ */
-+static int vzquota_qlnk_reinit_attr(struct vz_quota_ilink *qlnk,
-+ struct inode *inode,
-+ struct vz_quota_master *qmblk)
-+{
-+ if (vzquota_qlnk_is_empty(qlnk))
-+ return 0;
-+ /* may be optimized if qlnk->qugid all NULLs */
-+ qmblk_data_write_unlock(qmblk);
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(qlnk);
-+ vzquota_qlnk_init(qlnk);
-+ inode_qmblk_lock(inode->i_sb);
-+ qmblk_data_write_lock(qmblk);
-+ return 1;
-+}
-+#endif
-+
-+/**
-+ * vzquota_qlnk_fill - fill vz_quota_ilink content
-+ * @qlnk: vz_quota_ilink to fill
-+ * @inode: inode for which @qlnk is filled (i_sb, i_uid, i_gid)
-+ * @qmblk: qmblk to which this @qlnk will belong
-+ *
-+ * Called under dcache_lock and inode_qmblk locks.
-+ * Returns 1 if locks were dropped inside, 0 if atomic.
-+ * @qlnk is expected to be empty.
-+ */
-+static int vzquota_qlnk_fill(struct vz_quota_ilink *qlnk,
-+ struct inode *inode,
-+ struct vz_quota_master *qmblk)
-+{
-+ if (qmblk != VZ_QUOTA_BAD)
-+ qmblk_get(qmblk);
-+ qlnk->qmblk = qmblk;
-+
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+ if (qmblk != VZ_QUOTA_BAD &&
-+ !VZ_QUOTA_IS_NOQUOTA(qmblk, inode->i_sb) &&
-+ (qmblk->dq_flags & VZDQUG_ON)) {
-+ struct vz_quota_ugid *quid, *qgid;
-+
-+ spin_unlock(&dcache_lock);
-+ inode_qmblk_unlock(inode->i_sb);
-+
-+ down(&qmblk->dq_sem);
-+ quid = __vzquota_find_ugid(qmblk, inode->i_uid, USRQUOTA, 0);
-+ qgid = __vzquota_find_ugid(qmblk, inode->i_gid, GRPQUOTA, 0);
-+ up(&qmblk->dq_sem);
-+
-+ inode_qmblk_lock(inode->i_sb);
-+ spin_lock(&dcache_lock);
-+ qlnk->qugid[USRQUOTA] = quid;
-+ qlnk->qugid[GRPQUOTA] = qgid;
-+ return 1;
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+/**
-+ * vzquota_qlnk_fill_attr - fill vz_quota_ilink content for uid, gid
-+ *
-+ * This function is a helper for vzquota_transfer, and differs from
-+ * vzquota_qlnk_fill only by locking.
-+ */
-+static int vzquota_qlnk_fill_attr(struct vz_quota_ilink *qlnk,
-+ struct inode *inode,
-+ struct iattr *iattr,
-+ int mask,
-+ struct vz_quota_master *qmblk)
-+{
-+ qmblk_get(qmblk);
-+ qlnk->qmblk = qmblk;
-+
-+ if (mask) {
-+ struct vz_quota_ugid *quid, *qgid;
-+
-+ quid = qgid = NULL; /* to make gcc happy */
-+ if (!(mask & (1 << USRQUOTA)))
-+ quid = vzquota_get_ugid(INODE_QLNK(inode)->
-+ qugid[USRQUOTA]);
-+ if (!(mask & (1 << GRPQUOTA)))
-+ qgid = vzquota_get_ugid(INODE_QLNK(inode)->
-+ qugid[GRPQUOTA]);
-+
-+ qmblk_data_write_unlock(qmblk);
-+ inode_qmblk_unlock(inode->i_sb);
-+
-+ down(&qmblk->dq_sem);
-+ if (mask & (1 << USRQUOTA))
-+ quid = __vzquota_find_ugid(qmblk, iattr->ia_uid,
-+ USRQUOTA, 0);
-+ if (mask & (1 << GRPQUOTA))
-+ qgid = __vzquota_find_ugid(qmblk, iattr->ia_gid,
-+ GRPQUOTA, 0);
-+ up(&qmblk->dq_sem);
-+
-+ inode_qmblk_lock(inode->i_sb);
-+ qmblk_data_write_lock(qmblk);
-+ qlnk->qugid[USRQUOTA] = quid;
-+ qlnk->qugid[GRPQUOTA] = qgid;
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+#endif
-+
-+/**
-+ * __vzquota_inode_init - make sure inode's qlnk is initialized
-+ *
-+ * May be called if qlnk is already initialized, detects this situation itself.
-+ * Called under inode_qmblk_lock.
-+ */
-+static void __vzquota_inode_init(struct inode *inode, unsigned char origin)
-+{
-+ if (inode->i_dquot[USRQUOTA] == NODQUOT) {
-+ vzquota_qlnk_init(INODE_QLNK(inode));
-+ inode->i_dquot[USRQUOTA] = (void *)~(unsigned long)NODQUOT;
-+ }
-+ INODE_QLNK(inode)->origin = origin;
-+}
-+
-+/**
-+ * vzquota_inode_drop - destroy VZ quota information in the inode
-+ *
-+ * Inode must not be externally accessible or dirty.
-+ */
-+static void vzquota_inode_drop(struct inode *inode)
-+{
-+ struct vz_quota_ilink qlnk;
-+
-+ vzquota_qlnk_init(&qlnk);
-+ inode_qmblk_lock(inode->i_sb);
-+ vzquota_qlnk_swap(&qlnk, INODE_QLNK(inode));
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_DRCAL;
-+ inode->i_dquot[USRQUOTA] = NODQUOT;
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(&qlnk);
-+}
-+
-+/**
-+ * vzquota_inode_qmblk_set - initialize inode's qlnk
-+ * @inode: inode to be initialized
-+ * @qmblk: quota master block to which this inode should belong (may be BAD)
-+ * @qlnk: placeholder to store data to resolve locking issues
-+ *
-+ * Returns 1 if locks were dropped and rechecks possibly needed, 0 otherwise.
-+ * Called under dcache_lock and inode_qmblk locks.
-+ * @qlnk will be destroyed in the caller chain.
-+ *
-+ * It is not mandatory to restart parent checks since quota on/off currently
-+ * shrinks dentry tree and checks that there are not outside references.
-+ * But if at some time that shink is removed, restarts will be required.
-+ * Additionally, the restarts prevent inconsistencies if the dentry tree
-+ * changes (inode is moved). This is not a big deal, but anyway...
-+ */
-+static int vzquota_inode_qmblk_set(struct inode *inode,
-+ struct vz_quota_master *qmblk,
-+ struct vz_quota_ilink *qlnk)
-+{
-+ if (qmblk == NULL) {
-+ printk(KERN_ERR "VZDQ: NULL in set, "
-+ "orig %u, dev %s, inode %lu, fs %s\n",
-+ INODE_QLNK(inode)->origin,
-+ inode->i_sb->s_id, inode->i_ino,
-+ inode->i_sb->s_type->name);
-+ printk(KERN_ERR "current %d (%s), VE %d\n",
-+ current->pid, current->comm,
-+ VEID(get_exec_env()));
-+ dump_stack();
-+ qmblk = VZ_QUOTA_BAD;
-+ }
-+ while (1) {
-+ if (vzquota_qlnk_is_empty(qlnk) &&
-+ vzquota_qlnk_fill(qlnk, inode, qmblk))
-+ return 1;
-+ if (qlnk->qmblk == qmblk)
-+ break;
-+ if (vzquota_qlnk_reinit_locked(qlnk, inode))
-+ return 1;
-+ }
-+ vzquota_qlnk_swap(qlnk, INODE_QLNK(inode));
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_QSET;
-+ return 0;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * vzquota_inode_qmblk (inode -> qmblk lookup) parts
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+static int vzquota_dparents_check_attach(struct inode *inode)
-+{
-+ if (!list_empty(&inode->i_dentry))
-+ return 0;
-+ printk(KERN_ERR "VZDQ: no parent for "
-+ "dev %s, inode %lu, fs %s\n",
-+ inode->i_sb->s_id,
-+ inode->i_ino,
-+ inode->i_sb->s_type->name);
-+ return -1;
-+}
-+
-+static struct inode *vzquota_dparents_check_actual(struct inode *inode)
-+{
-+ struct dentry *de;
-+
-+ list_for_each_entry(de, &inode->i_dentry, d_alias) {
-+ if (de->d_parent == de) /* detached dentry, perhaps */
-+ continue;
-+ /* first access to parent, make sure its qlnk initialized */
-+ __vzquota_inode_init(de->d_parent->d_inode, VZ_QUOTAO_ACT);
-+ if (!VZ_QUOTA_IS_ACTUAL(de->d_parent->d_inode))
-+ return de->d_parent->d_inode;
-+ }
-+ return NULL;
-+}
-+
-+static struct vz_quota_master *vzquota_dparents_check_same(struct inode *inode)
-+{
-+ struct dentry *de;
-+ struct vz_quota_master *qmblk;
-+
-+ qmblk = NULL;
-+ list_for_each_entry(de, &inode->i_dentry, d_alias) {
-+ if (de->d_parent == de) /* detached dentry, perhaps */
-+ continue;
-+ if (qmblk == NULL) {
-+ qmblk = INODE_QLNK(de->d_parent->d_inode)->qmblk;
-+ continue;
-+ }
-+ if (INODE_QLNK(de->d_parent->d_inode)->qmblk != qmblk) {
-+ printk(KERN_WARNING "VZDQ: multiple quotas for "
-+ "dev %s, inode %lu, fs %s\n",
-+ inode->i_sb->s_id,
-+ inode->i_ino,
-+ inode->i_sb->s_type->name);
-+ qmblk = VZ_QUOTA_BAD;
-+ break;
-+ }
-+ }
-+ if (qmblk == NULL) {
-+ printk(KERN_WARNING "VZDQ: not attached to tree, "
-+ "dev %s, inode %lu, fs %s\n",
-+ inode->i_sb->s_id,
-+ inode->i_ino,
-+ inode->i_sb->s_type->name);
-+ qmblk = VZ_QUOTA_BAD;
-+ }
-+ return qmblk;
-+}
-+
-+static void vzquota_dbranch_actualize(struct inode *inode,
-+ struct inode *refinode)
-+{
-+ struct inode *pinode;
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ilink qlnk;
-+
-+ vzquota_qlnk_init(&qlnk);
-+
-+start:
-+ if (inode == inode->i_sb->s_root->d_inode) {
-+ /* filesystem root */
-+ atomic_inc(&inode->i_count);
-+ do {
-+ qmblk = __VZ_QUOTA_NOQUOTA(inode->i_sb);
-+ } while (vzquota_inode_qmblk_set(inode, qmblk, &qlnk));
-+ goto out;
-+ }
-+
-+ if (!vzquota_dparents_check_attach(inode)) {
-+ pinode = vzquota_dparents_check_actual(inode);
-+ if (pinode != NULL) {
-+ inode = pinode;
-+ goto start;
-+ }
-+ }
-+
-+ atomic_inc(&inode->i_count);
-+ while (1) {
-+ if (VZ_QUOTA_IS_ACTUAL(inode)) /* actualized without us */
-+ break;
-+ /*
-+ * Need to check parents again if we have slept inside
-+ * vzquota_inode_qmblk_set() in the loop.
-+ * If the state of parents is different, just return and repeat
-+ * the actualizing process again from the inode passed to
-+ * vzquota_inode_qmblk_recalc().
-+ */
-+ if (!vzquota_dparents_check_attach(inode)) {
-+ if (vzquota_dparents_check_actual(inode) != NULL)
-+ break;
-+ qmblk = vzquota_dparents_check_same(inode);
-+ } else
-+ qmblk = VZ_QUOTA_BAD;
-+ if (!vzquota_inode_qmblk_set(inode, qmblk, &qlnk)){/* success */
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_ACT;
-+ break;
-+ }
-+ }
-+
-+out:
-+ spin_unlock(&dcache_lock);
-+ inode_qmblk_unlock(refinode->i_sb);
-+ vzquota_qlnk_destroy(&qlnk);
-+ iput(inode);
-+ inode_qmblk_lock(refinode->i_sb);
-+ spin_lock(&dcache_lock);
-+}
-+
-+static void vzquota_dtree_qmblk_recalc(struct inode *inode,
-+ struct vz_quota_ilink *qlnk)
-+{
-+ struct inode *pinode;
-+ struct vz_quota_master *qmblk;
-+
-+ if (inode == inode->i_sb->s_root->d_inode) {
-+ /* filesystem root */
-+ do {
-+ qmblk = __VZ_QUOTA_NOQUOTA(inode->i_sb);
-+ } while (vzquota_inode_qmblk_set(inode, qmblk, qlnk));
-+ return;
-+ }
-+
-+start:
-+ if (VZ_QUOTA_IS_ACTUAL(inode))
-+ return;
-+ /*
-+ * Here qmblk is (re-)initialized for all ancestors.
-+ * This is not a very efficient procedure, but it guarantees that
-+ * the quota tree is consistent (that is, the inode doesn't have two
-+ * ancestors with different qmblk).
-+ */
-+ if (!vzquota_dparents_check_attach(inode)) {
-+ pinode = vzquota_dparents_check_actual(inode);
-+ if (pinode != NULL) {
-+ vzquota_dbranch_actualize(pinode, inode);
-+ goto start;
-+ }
-+ qmblk = vzquota_dparents_check_same(inode);
-+ } else
-+ qmblk = VZ_QUOTA_BAD;
-+
-+ if (vzquota_inode_qmblk_set(inode, qmblk, qlnk))
-+ goto start;
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_DTREE;
-+}
-+
-+static void vzquota_det_qmblk_recalc(struct inode *inode,
-+ struct vz_quota_ilink *qlnk)
-+{
-+ struct inode *parent;
-+ struct vz_quota_master *qmblk;
-+ char *msg;
-+ int cnt;
-+ time_t timeout;
-+
-+ cnt = 0;
-+ parent = NULL;
-+start:
-+ /*
-+ * qmblk of detached inodes shouldn't be considered as not actual.
-+ * They are not in any dentry tree, so quota on/off shouldn't affect
-+ * them.
-+ */
-+ if (!vzquota_qlnk_is_empty(INODE_QLNK(inode)))
-+ return;
-+
-+ timeout = 3;
-+ qmblk = __VZ_QUOTA_NOQUOTA(inode->i_sb);
-+ msg = "detached inode not in creation";
-+ if (inode->i_op != VZ_QUOTA_EMPTY_IOPS)
-+ goto fail;
-+ qmblk = VZ_QUOTA_BAD;
-+ msg = "unexpected creation context";
-+ if (!vzquota_cur_qmblk_check())
-+ goto fail;
-+ timeout = 0;
-+ parent = vzquota_cur_qmblk_fetch();
-+ msg = "uninitialized parent";
-+ if (vzquota_qlnk_is_empty(INODE_QLNK(parent)))
-+ goto fail;
-+ msg = "parent not in tree";
-+ if (list_empty(&parent->i_dentry))
-+ goto fail;
-+ msg = "parent has 0 refcount";
-+ if (!atomic_read(&parent->i_count))
-+ goto fail;
-+ msg = "parent has different sb";
-+ if (parent->i_sb != inode->i_sb)
-+ goto fail;
-+ if (!VZ_QUOTA_IS_ACTUAL(parent)) {
-+ vzquota_dbranch_actualize(parent, inode);
-+ goto start;
-+ }
-+
-+ qmblk = INODE_QLNK(parent)->qmblk;
-+set:
-+ if (vzquota_inode_qmblk_set(inode, qmblk, qlnk))
-+ goto start;
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_DET;
-+ return;
-+
-+fail:
-+ {
-+ struct timeval tv, tvo;
-+ do_gettimeofday(&tv);
-+ memcpy(&tvo, __VZ_QUOTA_TSTAMP(inode->i_sb), sizeof(tvo));
-+ tv.tv_sec -= tvo.tv_sec;
-+ if (tv.tv_usec < tvo.tv_usec) {
-+ tv.tv_sec--;
-+ tv.tv_usec += USEC_PER_SEC - tvo.tv_usec;
-+ } else
-+ tv.tv_usec -= tvo.tv_usec;
-+ if (tv.tv_sec < timeout)
-+ goto set;
-+ printk(KERN_ERR "VZDQ: %s, orig %u,"
-+ " dev %s, inode %lu, fs %s\n",
-+ msg, INODE_QLNK(inode)->origin,
-+ inode->i_sb->s_id, inode->i_ino,
-+ inode->i_sb->s_type->name);
-+ if (!cnt++) {
-+ printk(KERN_ERR "current %d (%s), VE %d,"
-+ " time %ld.%06ld\n",
-+ current->pid, current->comm,
-+ VEID(get_exec_env()),
-+ tv.tv_sec, tv.tv_usec);
-+ dump_stack();
-+ }
-+ if (parent != NULL)
-+ printk(KERN_ERR "VZDQ: parent of %lu is %lu\n",
-+ inode->i_ino, parent->i_ino);
-+ }
-+ goto set;
-+}
-+
-+static void vzquota_inode_qmblk_recalc(struct inode *inode,
-+ struct vz_quota_ilink *qlnk)
-+{
-+ spin_lock(&dcache_lock);
-+ if (!list_empty(&inode->i_dentry))
-+ vzquota_dtree_qmblk_recalc(inode, qlnk);
-+ else
-+ vzquota_det_qmblk_recalc(inode, qlnk);
-+ spin_unlock(&dcache_lock);
-+}
-+
-+/**
-+ * vzquota_inode_qmblk - obtain inode's qmblk
-+ *
-+ * Returns qmblk with refcounter taken, %NULL if not under
-+ * VZ quota or %VZ_QUOTA_BAD.
-+ *
-+ * FIXME: This function should be removed when vzquota_find_qmblk /
-+ * get_quota_root / vzquota_dstat code is cleaned up.
-+ */
-+struct vz_quota_master *vzquota_inode_qmblk(struct inode *inode)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ilink qlnk;
-+
-+ might_sleep();
-+
-+ if (inode->i_sb->dq_op != &vz_quota_operations)
-+ return NULL;
-+#if defined(VZ_QUOTA_UNLOAD)
-+#error Make sure qmblk does not disappear
-+#endif
-+
-+ vzquota_qlnk_init(&qlnk);
-+ inode_qmblk_lock(inode->i_sb);
-+ __vzquota_inode_init(inode, VZ_QUOTAO_INICAL);
-+
-+ if (vzquota_qlnk_is_empty(INODE_QLNK(inode)) ||
-+ !VZ_QUOTA_IS_ACTUAL(inode))
-+ vzquota_inode_qmblk_recalc(inode, &qlnk);
-+
-+ qmblk = INODE_QLNK(inode)->qmblk;
-+ if (qmblk != VZ_QUOTA_BAD) {
-+ if (!VZ_QUOTA_IS_NOQUOTA(qmblk, inode->i_sb))
-+ qmblk_get(qmblk);
-+ else
-+ qmblk = NULL;
-+ }
-+
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(&qlnk);
-+ return qmblk;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Calls from quota operations
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+/**
-+ * vzquota_inode_init_call - call from DQUOT_INIT
-+ */
-+void vzquota_inode_init_call(struct inode *inode)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+
-+ /* initializes inode's quota inside */
-+ qmblk = vzquota_inode_data(inode, &data);
-+ if (qmblk != NULL && qmblk != VZ_QUOTA_BAD)
-+ vzquota_data_unlock(inode, &data);
-+
-+ /*
-+ * The check is needed for repeated new_inode() calls from a single
-+ * ext3 call like create or mkdir in case of -ENOSPC.
-+ */
-+ spin_lock(&dcache_lock);
-+ if (!list_empty(&inode->i_dentry))
-+ vzquota_cur_qmblk_set(inode);
-+ spin_unlock(&dcache_lock);
-+}
-+
-+/**
-+ * vzquota_inode_drop_call - call from DQUOT_DROP
-+ */
-+void vzquota_inode_drop_call(struct inode *inode)
-+{
-+ vzquota_inode_drop(inode);
-+}
-+
-+/**
-+ * vzquota_inode_data - initialize (if nec.) and lock inode quota ptrs
-+ * @inode: the inode
-+ * @data: storage space
-+ *
-+ * Returns: qmblk is NULL or VZ_QUOTA_BAD or actualized qmblk.
-+ * On return if qmblk is neither NULL nor VZ_QUOTA_BAD:
-+ * qmblk in inode's qlnk is the same as returned,
-+ * ugid pointers inside inode's qlnk are valid,
-+ * some locks are taken (and should be released by vzquota_data_unlock).
-+ * If qmblk is NULL or VZ_QUOTA_BAD, locks are NOT taken.
-+ */
-+struct vz_quota_master *vzquota_inode_data(struct inode *inode,
-+ struct vz_quota_datast *data)
-+{
-+ struct vz_quota_master *qmblk;
-+
-+ might_sleep();
-+
-+ vzquota_qlnk_init(&data->qlnk);
-+ inode_qmblk_lock(inode->i_sb);
-+ if (unlikely(inode->i_flags & S_NOQUOTA)) {
-+ inode_qmblk_unlock(inode->i_sb);
-+ return NULL;
-+ }
-+ __vzquota_inode_init(inode, VZ_QUOTAO_INICAL);
-+
-+ if (vzquota_qlnk_is_empty(INODE_QLNK(inode)) ||
-+ !VZ_QUOTA_IS_ACTUAL(inode))
-+ vzquota_inode_qmblk_recalc(inode, &data->qlnk);
-+
-+ qmblk = INODE_QLNK(inode)->qmblk;
-+ if (qmblk != VZ_QUOTA_BAD) {
-+ if (!VZ_QUOTA_IS_NOQUOTA(qmblk, inode->i_sb)) {
-+ /*
-+ * Note that in the current implementation,
-+ * inode_qmblk_lock can theoretically be dropped here.
-+ * This place is serialized with quota_off because
-+ * quota_off fails when there are extra dentry
-+ * references and syncs inodes before removing quota
-+ * information from them.
-+ * However, quota usage information should stop being
-+ * updated immediately after vzquota_off.
-+ */
-+ qmblk_data_write_lock(qmblk);
-+ } else {
-+ inode_qmblk_unlock(inode->i_sb);
-+ qmblk = NULL;
-+ }
-+ } else {
-+ inode_qmblk_unlock(inode->i_sb);
-+ }
-+ return qmblk;
-+}
-+
-+void vzquota_data_unlock(struct inode *inode,
-+ struct vz_quota_datast *data)
-+{
-+ qmblk_data_write_unlock(INODE_QLNK(inode)->qmblk);
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(&data->qlnk);
-+}
-+
-+#if defined(CONFIG_VZ_QUOTA_UGID)
-+/**
-+ * vzquota_inode_transfer_call - call from vzquota_transfer
-+ */
-+int vzquota_inode_transfer_call(struct inode *inode, struct iattr *iattr)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_datast data;
-+ struct vz_quota_ilink qlnew;
-+ int mask;
-+ int ret;
-+
-+ might_sleep();
-+ vzquota_qlnk_init(&qlnew);
-+start:
-+ qmblk = vzquota_inode_data(inode, &data);
-+ ret = NO_QUOTA;
-+ if (qmblk == VZ_QUOTA_BAD)
-+ goto out_destr;
-+ ret = QUOTA_OK;
-+ if (qmblk == NULL)
-+ goto out_destr;
-+ qmblk_get(qmblk);
-+
-+ ret = QUOTA_OK;
-+ if (!(qmblk->dq_flags & VZDQUG_ON))
-+ /* no ugid quotas */
-+ goto out_unlock;
-+
-+ mask = 0;
-+ if ((iattr->ia_valid & ATTR_UID) && iattr->ia_uid != inode->i_uid)
-+ mask |= 1 << USRQUOTA;
-+ if ((iattr->ia_valid & ATTR_GID) && iattr->ia_gid != inode->i_gid)
-+ mask |= 1 << GRPQUOTA;
-+ while (1) {
-+ if (vzquota_qlnk_is_empty(&qlnew) &&
-+ vzquota_qlnk_fill_attr(&qlnew, inode, iattr, mask, qmblk))
-+ break;
-+ if (qlnew.qmblk == INODE_QLNK(inode)->qmblk &&
-+ qlnew.qmblk == qmblk)
-+ goto finish;
-+ if (vzquota_qlnk_reinit_attr(&qlnew, inode, qmblk))
-+ break;
-+ }
-+
-+ /* prepare for restart */
-+ vzquota_data_unlock(inode, &data);
-+ qmblk_put(qmblk);
-+ goto start;
-+
-+finish:
-+ /* all references obtained successfully */
-+ ret = vzquota_transfer_usage(inode, mask, &qlnew);
-+ if (!ret) {
-+ vzquota_qlnk_swap(&qlnew, INODE_QLNK(inode));
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_TRANS;
-+ }
-+out_unlock:
-+ vzquota_data_unlock(inode, &data);
-+ qmblk_put(qmblk);
-+out_destr:
-+ vzquota_qlnk_destroy(&qlnew);
-+ return ret;
-+}
-+#endif
-+
-+int vzquota_rename_check(struct inode *inode,
-+ struct inode *old_dir, struct inode *new_dir)
-+{
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ilink qlnk1, qlnk2;
-+ int c, ret;
-+
-+ if (inode->i_sb != old_dir->i_sb || inode->i_sb != new_dir->i_sb)
-+ return -1;
-+
-+ might_sleep();
-+
-+ vzquota_qlnk_init(&qlnk1);
-+ vzquota_qlnk_init(&qlnk2);
-+ inode_qmblk_lock(inode->i_sb);
-+ __vzquota_inode_init(inode, VZ_QUOTAO_INICAL);
-+ __vzquota_inode_init(old_dir, VZ_QUOTAO_INICAL);
-+ __vzquota_inode_init(new_dir, VZ_QUOTAO_INICAL);
-+
-+ do {
-+ c = 0;
-+ if (vzquota_qlnk_is_empty(INODE_QLNK(inode)) ||
-+ !VZ_QUOTA_IS_ACTUAL(inode)) {
-+ vzquota_inode_qmblk_recalc(inode, &qlnk1);
-+ c++;
-+ }
-+ if (vzquota_qlnk_is_empty(INODE_QLNK(new_dir)) ||
-+ !VZ_QUOTA_IS_ACTUAL(new_dir)) {
-+ vzquota_inode_qmblk_recalc(new_dir, &qlnk2);
-+ c++;
-+ }
-+ } while (c);
-+
-+ ret = 0;
-+ qmblk = INODE_QLNK(inode)->qmblk;
-+ if (qmblk != INODE_QLNK(new_dir)->qmblk) {
-+ ret = -1;
-+ if (qmblk != VZ_QUOTA_BAD &&
-+ !VZ_QUOTA_IS_NOQUOTA(qmblk, inode->i_sb) &&
-+ qmblk->dq_root_dentry->d_inode == inode &&
-+ VZ_QUOTA_IS_NOQUOTA(INODE_QLNK(new_dir)->qmblk,
-+ inode->i_sb) &&
-+ VZ_QUOTA_IS_NOQUOTA(INODE_QLNK(old_dir)->qmblk,
-+ inode->i_sb))
-+ /* quota root rename is allowed */
-+ ret = 0;
-+ }
-+
-+ inode_qmblk_unlock(inode->i_sb);
-+ vzquota_qlnk_destroy(&qlnk2);
-+ vzquota_qlnk_destroy(&qlnk1);
-+ return ret;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * qmblk-related parts of on/off operations
-+ *
-+ * --------------------------------------------------------------------- */
-+
-+/**
-+ * vzquota_check_dtree - check dentry tree if quota on/off is allowed
-+ *
-+ * This function doesn't allow quota to be turned on/off if some dentries in
-+ * the tree have external references.
-+ * In addition to technical reasons, it enforces user-space correctness:
-+ * current usage (taken from or reported to the user space) can be meaningful
-+ * and accurate only if the tree is not being modified.
-+ * Side effect: additional vfsmount structures referencing the tree (bind
-+ * mounts of tree nodes to some other places) are not allowed at on/off time.
-+ */
-+int vzquota_check_dtree(struct vz_quota_master *qmblk, int off)
-+{
-+ struct dentry *dentry;
-+ int err, count;
-+
-+ err = -EBUSY;
-+ dentry = qmblk->dq_root_dentry;
-+
-+ if (d_unhashed(dentry) && dentry != dentry->d_sb->s_root)
-+ goto unhashed;
-+
-+ /* attempt to shrink */
-+ if (!list_empty(&dentry->d_subdirs)) {
-+ spin_unlock(&dcache_lock);
-+ inode_qmblk_unlock(dentry->d_sb);
-+ shrink_dcache_parent(dentry);
-+ inode_qmblk_lock(dentry->d_sb);
-+ spin_lock(&dcache_lock);
-+ if (!list_empty(&dentry->d_subdirs))
-+ goto out;
-+
-+ count = 1;
-+ if (dentry == dentry->d_sb->s_root)
-+ count += 2; /* sb and mnt refs */
-+ if (atomic_read(&dentry->d_count) < count) {
-+ printk(KERN_ERR "%s: too small count %d vs %d.\n",
-+ __FUNCTION__,
-+ atomic_read(&dentry->d_count), count);
-+ goto out;
-+ }
-+ if (atomic_read(&dentry->d_count) > count)
-+ goto out;
-+ }
-+
-+ err = 0;
-+out:
-+ return err;
-+
-+unhashed:
-+ /*
-+ * Quota root is removed.
-+ * Allow to turn quota off, but not on.
-+ */
-+ if (off)
-+ err = 0;
-+ goto out;
-+}
-+
-+int vzquota_on_qmblk(struct super_block *sb, struct inode *inode,
-+ struct vz_quota_master *qmblk)
-+{
-+ struct vz_quota_ilink qlnk;
-+ struct vz_quota_master *qold, *qnew;
-+ int err;
-+
-+ might_sleep();
-+
-+ qold = NULL;
-+ qnew = vzquota_alloc_fake();
-+ if (qnew == NULL)
-+ return -ENOMEM;
-+
-+ vzquota_qlnk_init(&qlnk);
-+ inode_qmblk_lock(sb);
-+ __vzquota_inode_init(inode, VZ_QUOTAO_INICAL);
-+
-+ spin_lock(&dcache_lock);
-+ while (1) {
-+ err = vzquota_check_dtree(qmblk, 0);
-+ if (err)
-+ break;
-+ if (!vzquota_inode_qmblk_set(inode, qmblk, &qlnk))
-+ break;
-+ }
-+ INODE_QLNK(inode)->origin = VZ_QUOTAO_ON;
-+ spin_unlock(&dcache_lock);
-+
-+ if (!err) {
-+ qold = __VZ_QUOTA_NOQUOTA(sb);
-+ qold->dq_flags |= VZDQ_NOACT;
-+ __VZ_QUOTA_NOQUOTA(sb) = qnew;
-+ }
-+
-+ inode_qmblk_unlock(sb);
-+ vzquota_qlnk_destroy(&qlnk);
-+ if (qold != NULL)
-+ qmblk_put(qold);
-+
-+ return err;
-+}
-+
-+int vzquota_off_qmblk(struct super_block *sb, struct vz_quota_master *qmblk)
-+{
-+ int ret;
-+
-+ ret = 0;
-+ inode_qmblk_lock(sb);
-+
-+ spin_lock(&dcache_lock);
-+ if (vzquota_check_dtree(qmblk, 1))
-+ ret = -EBUSY;
-+ spin_unlock(&dcache_lock);
-+
-+ if (!ret)
-+ qmblk->dq_flags |= VZDQ_NOACT | VZDQ_NOQUOT;
-+ inode_qmblk_unlock(sb);
-+ return ret;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * External interfaces
-+ *
-+ * ---------------------------------------------------------------------*/
-+
-+static int vzquota_ioctl(struct inode *ino, struct file *file,
-+ unsigned int cmd, unsigned long arg)
-+{
-+ int err;
-+ struct vzctl_quotactl qb;
-+ struct vzctl_quotaugidctl qub;
-+
-+ switch (cmd) {
-+ case VZCTL_QUOTA_CTL:
-+ err = -ENOTTY;
-+ break;
-+ case VZCTL_QUOTA_NEW_CTL:
-+ err = -EFAULT;
-+ if (copy_from_user(&qb, (void *)arg, sizeof(qb)))
-+ break;
-+ err = do_vzquotactl(qb.cmd, qb.quota_id,
-+ qb.qstat, qb.ve_root);
-+ break;
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ case VZCTL_QUOTA_UGID_CTL:
-+ err = -EFAULT;
-+ if (copy_from_user(&qub, (void *)arg, sizeof(qub)))
-+ break;
-+ err = do_vzquotaugidctl(&qub);
-+ break;
-+#endif
-+ default:
-+ err = -ENOTTY;
-+ }
-+ might_sleep(); /* debug */
-+ return err;
-+}
-+
-+static struct vzioctlinfo vzdqcalls = {
-+ .type = VZDQCTLTYPE,
-+ .func = vzquota_ioctl,
-+ .owner = THIS_MODULE,
-+};
-+
-+/**
-+ * vzquota_dstat - get quota usage info for virtual superblock
-+ */
-+static int vzquota_dstat(struct super_block *super, struct dq_stat *qstat)
-+{
-+ struct vz_quota_master *qmblk;
-+
-+ qmblk = vzquota_find_qmblk(super);
-+ if (qmblk == NULL)
-+ return -ENOENT;
-+ if (qmblk == VZ_QUOTA_BAD) {
-+ memset(qstat, 0, sizeof(*qstat));
-+ return 0;
-+ }
-+
-+ qmblk_data_read_lock(qmblk);
-+ memcpy(qstat, &qmblk->dq_stat, sizeof(*qstat));
-+ qmblk_data_read_unlock(qmblk);
-+ qmblk_put(qmblk);
-+ return 0;
-+}
-+
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Init/exit helpers
-+ *
-+ * ---------------------------------------------------------------------*/
-+
-+static int vzquota_cache_init(void)
-+{
-+ int i;
-+
-+ vzquota_cachep = kmem_cache_create("vz_quota_master",
-+ sizeof(struct vz_quota_master),
-+ 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-+ if (vzquota_cachep == NULL) {
-+ printk(KERN_ERR "Cannot create VZ_QUOTA SLAB cache\n");
-+ goto nomem2;
-+ }
-+ for (i = 0; i < VZ_QUOTA_HASH_SIZE; i++)
-+ INIT_LIST_HEAD(&vzquota_hash_table[i]);
-+
-+ return 0;
-+
-+nomem2:
-+ return -ENOMEM;
-+}
-+
-+static void vzquota_cache_release(void)
-+{
-+ int i;
-+
-+ /* sanity check */
-+ for (i = 0; i < VZ_QUOTA_HASH_SIZE; i++)
-+ if (!list_empty(&vzquota_hash_table[i]))
-+ BUG();
-+
-+ /* release caches */
-+ if (kmem_cache_destroy(vzquota_cachep))
-+ printk(KERN_ERR
-+ "VZQUOTA: vz_quota_master kmem_cache_destroy failed\n");
-+ vzquota_cachep = NULL;
-+}
-+
-+static int quota_notifier_call(struct vnotifier_block *self,
-+ unsigned long n, void *data, int err)
-+{
-+ struct virt_info_quota *viq;
-+ struct super_block *sb;
-+
-+ viq = (struct virt_info_quota *)data;
-+ switch (n) {
-+ case VIRTINFO_QUOTA_ON:
-+ err = NOTIFY_BAD;
-+ if (!try_module_get(THIS_MODULE))
-+ break;
-+ sb = viq->super;
-+ memset(&sb->s_dquot.info, 0, sizeof(sb->s_dquot.info));
-+ INIT_LIST_HEAD(&sb->s_dquot.info[USRQUOTA].dqi_dirty_list);
-+ INIT_LIST_HEAD(&sb->s_dquot.info[GRPQUOTA].dqi_dirty_list);
-+ err = NOTIFY_OK;
-+ break;
-+ case VIRTINFO_QUOTA_OFF:
-+ module_put(THIS_MODULE);
-+ err = NOTIFY_OK;
-+ break;
-+ case VIRTINFO_QUOTA_GETSTAT:
-+ err = NOTIFY_BAD;
-+ if (vzquota_dstat(viq->super, viq->qstat))
-+ break;
-+ err = NOTIFY_OK;
-+ break;
-+ case VIRTINFO_QUOTA_DISABLE:
-+ err = NOTIFY_OK;
-+ vzquota_inode_off((struct inode *)data);
-+ break;
-+ }
-+ return err;
-+}
-+
-+struct vnotifier_block quota_notifier_block = {
-+ .notifier_call = quota_notifier_call,
-+ .priority = INT_MAX,
-+};
-+
-+/* ----------------------------------------------------------------------
-+ *
-+ * Init/exit procedures
-+ *
-+ * ---------------------------------------------------------------------*/
-+
-+static int __init vzquota_init(void)
-+{
-+ int err;
-+
-+ if ((err = vzquota_cache_init()) != 0)
-+ goto out_cache;
-+
-+ if ((err = vzquota_proc_init()) != 0)
-+ goto out_proc;
-+
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+ if ((err = vzquota_ugid_init()) != 0)
-+ goto out_ugid;
-+#endif
-+
-+ init_MUTEX(&vz_quota_sem);
-+ vzioctl_register(&vzdqcalls);
-+ virtinfo_notifier_register(VITYPE_QUOTA, &quota_notifier_block);
-+#if defined(CONFIG_VZ_QUOTA_UGID) && defined(CONFIG_PROC_FS)
-+ vzaquota_init();
-+#endif
-+
-+ return 0;
-+
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+out_ugid:
-+ vzquota_proc_release();
-+#endif
-+out_proc:
-+ vzquota_cache_release();
-+out_cache:
-+ return err;
-+}
-+
-+#if defined(VZ_QUOTA_UNLOAD)
-+static void __exit vzquota_release(void)
-+{
-+ virtinfo_notifier_unregister(VITYPE_QUOTA, &quota_notifier_block);
-+ vzioctl_unregister(&vzdqcalls);
-+#ifdef CONFIG_VZ_QUOTA_UGID
-+#ifdef CONFIG_PROC_FS
-+ vzaquota_fini();
-+#endif
-+ vzquota_ugid_release();
-+#endif
-+ vzquota_proc_release();
-+ vzquota_cache_release();
-+}
-+#endif
-+
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Virtuozzo Disk Quota");
-+MODULE_LICENSE("GPL v2");
-+
-+module_init(vzquota_init)
-+#if defined(VZ_QUOTA_UNLOAD)
-+module_exit(vzquota_release)
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_buf.c linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_buf.c
---- linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_buf.c 2004-10-19 01:53:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_buf.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1666,8 +1666,8 @@ pagebuf_daemon(
- INIT_LIST_HEAD(&tmp);
- do {
- /* swsusp */
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_iops.c
---- linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_iops.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_iops.c 2006-10-11 19:07:55.000000000 +0400
-@@ -464,7 +464,8 @@ STATIC int
- linvfs_permission(
- struct inode *inode,
- int mode,
-- struct nameidata *nd)
-+ struct nameidata *nd,
-+ struct exec_perm *exec_perm)
- {
- vnode_t *vp = LINVFS_GET_VP(inode);
- int error;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_super.c linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_super.c
---- linux-2.6.9-42.0.3.EL.orig/fs/xfs/linux-2.6/xfs_super.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/fs/xfs/linux-2.6/xfs_super.c 2006-10-11 19:07:55.000000000 +0400
-@@ -485,8 +485,8 @@ xfssyncd(
- set_current_state(TASK_INTERRUPTIBLE);
- timeleft = schedule_timeout(timeleft);
- /* swsusp */
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- if (vfsp->vfs_flag & VFS_UMOUNT)
- break;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-alpha/thread_info.h linux-2.6.9-ve023stab030/include/asm-alpha/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-alpha/thread_info.h 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-alpha/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -77,6 +77,7 @@ register struct thread_info *__current_t
- #define TIF_UAC_NOPRINT 6 /* see sysinfo.h */
- #define TIF_UAC_NOFIX 7
- #define TIF_UAC_SIGBUS 8
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-arm/thread_info.h linux-2.6.9-ve023stab030/include/asm-arm/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-arm/thread_info.h 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-arm/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -128,6 +128,7 @@ extern void iwmmxt_task_release(struct t
- #define TIF_SYSCALL_TRACE 8
- #define TIF_POLLING_NRFLAG 16
- #define TIF_USING_IWMMXT 17
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
- #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-arm26/thread_info.h linux-2.6.9-ve023stab030/include/asm-arm26/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-arm26/thread_info.h 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-arm26/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -125,6 +125,7 @@ extern void free_thread_info(struct thre
- #define TIF_SYSCALL_TRACE 8
- #define TIF_USED_FPU 16
- #define TIF_POLLING_NRFLAG 17
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
- #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-cris/thread_info.h linux-2.6.9-ve023stab030/include/asm-cris/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-cris/thread_info.h 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-cris/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -85,6 +85,7 @@ struct thread_info {
- #define TIF_SIGPENDING 2 /* signal pending */
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-generic/tlb.h linux-2.6.9-ve023stab030/include/asm-generic/tlb.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-generic/tlb.h 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-generic/tlb.h 2006-10-11 19:07:56.000000000 +0400
-@@ -110,6 +110,9 @@ tlb_is_full_mm(struct mmu_gather *tlb)
- * handling the additional races in SMP caused by other CPUs caching valid
- * mappings in their TLBs.
- */
-+#include <ub/ub_mem.h>
-+#include <ub/ub_vmpages.h>
-+
- static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
- {
- tlb->need_flush = 1;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-h8300/thread_info.h linux-2.6.9-ve023stab030/include/asm-h8300/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-h8300/thread_info.h 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-h8300/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -93,6 +93,7 @@ static inline struct thread_info *curren
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/a.out.h linux-2.6.9-ve023stab030/include/asm-i386/a.out.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/a.out.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/a.out.h 2006-10-11 19:07:56.000000000 +0400
-@@ -19,7 +19,7 @@ struct exec
-
- #ifdef __KERNEL__
-
--#define STACK_TOP TASK_SIZE
-+#define STACK_TOP (TASK_SIZE - PAGE_SIZE * 2)
-
- #endif
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/bug.h linux-2.6.9-ve023stab030/include/asm-i386/bug.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/bug.h 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/bug.h 2006-10-11 19:07:55.000000000 +0400
-@@ -12,7 +12,10 @@
- #if 1 /* Set to zero for a slightly smaller kernel */
- #define BUG() \
- __asm__ __volatile__( "ud2\n" \
-+ "\t.byte 0x66\n"\
-+ "\t.byte 0xb8\n" /* mov $xxx, %ax */\
- "\t.word %c0\n" \
-+ "\t.byte 0xb8\n" /* mov $xxx, %eax */\
- "\t.long %c1\n" \
- : : "i" (__LINE__), "i" (__FILE__))
- #else
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/elf.h linux-2.6.9-ve023stab030/include/asm-i386/elf.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/elf.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/elf.h 2006-10-11 19:07:58.000000000 +0400
-@@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxr
- For the moment, we have only optimizations for the Intel generations,
- but that could change... */
-
--#define ELF_PLATFORM (system_utsname.machine)
-+#define ELF_PLATFORM (ve_utsname.machine)
-
- /*
- * Architecture-neutral AT_ values in 0-17, leave some room
-@@ -146,12 +146,18 @@ extern void __kernel_vsyscall;
-
- #define ARCH_DLINFO \
- do { \
-- if (VSYSCALL_BASE) { \
-+ if (sysctl_at_vsyscall && VSYSCALL_BASE) { \
- NEW_AUX_ENT(AT_SYSINFO, VSYSCALL_ENTRY); \
- NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE); \
- } \
- } while (0)
-
-+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
-+struct linux_binprm;
-+extern int arch_setup_additional_pages(struct linux_binprm *bprm,
-+ int executable_stack, unsigned long map_address);
-+
-+#if 0 /* Disabled for exec-shield, where a normal vma holds the vDSO. */
- /*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents. Dumping its
-@@ -195,13 +201,11 @@ do { \
- PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
- } \
- } while (0)
-+#endif
-
- #endif
-
- #define __HAVE_ARCH_RANDOMIZE_BRK
- extern void randomize_brk(unsigned long old_brk);
-
--#define __HAVE_ARCH_VSYSCALL
--extern void map_vsyscall(void);
--
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/fixmap.h linux-2.6.9-ve023stab030/include/asm-i386/fixmap.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/fixmap.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/fixmap.h 2006-10-11 19:07:56.000000000 +0400
-@@ -20,7 +20,6 @@
- * Leave one empty page between vmalloc'ed areas and
- * the start of the fixmap.
- */
--#define __FIXADDR_TOP 0xfffff000
-
- #ifndef __ASSEMBLY__
- #include <linux/kernel.h>
-@@ -30,6 +29,8 @@
- #include <linux/threads.h>
- #include <asm/kmap_types.h>
-
-+#define __FIXADDR_TOP (0xfffff000UL)
-+
- /*
- * Here we define all the compile-time 'special' virtual
- * addresses. The point is to have a constant address at
-@@ -55,6 +56,10 @@
- * future, say framebuffers for the console driver(s) could be
- * fix-mapped?
- */
-+
-+#define TSS_SIZE sizeof(struct tss_struct)
-+#define FIX_TSS_COUNT ((TSS_SIZE * NR_CPUS + PAGE_SIZE - 1)/ PAGE_SIZE)
-+
- enum fixed_addresses {
- FIX_HOLE,
- FIX_VSYSCALL,
-@@ -76,17 +81,18 @@ enum fixed_addresses {
- FIX_IDT,
- FIX_GDT_1,
- FIX_GDT_0,
-- FIX_TSS_3,
-- FIX_TSS_2,
-- FIX_TSS_1,
-- FIX_TSS_0,
-+ FIX_TSS_LAST,
-+ FIX_TSS_0 = FIX_TSS_LAST + FIX_TSS_COUNT - 1,
- FIX_ENTRY_TRAMPOLINE_1,
- FIX_ENTRY_TRAMPOLINE_0,
- #ifdef CONFIG_X86_CYCLONE_TIMER
- FIX_CYCLONE_TIMER, /*cyclone timer register*/
- FIX_VSTACK_HOLE_2,
- #endif
-- FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
-+ /* reserved pte's for temporary kernel mappings */
-+ __FIX_KMAP_BEGIN,
-+ FIX_KMAP_BEGIN = __FIX_KMAP_BEGIN + (__FIX_KMAP_BEGIN & 1) +
-+ ((__FIXADDR_TOP >> PAGE_SHIFT) & 1),
- FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
- #ifdef CONFIG_ACPI_BOOT
- FIX_ACPI_BEGIN,
-@@ -124,7 +130,7 @@ extern void __set_fixmap (enum fixed_add
-
- /* IMPORTANT: we have to align FIXADDR_TOP so that the virtual stack */
- /* is THREAD_SIZE aligned. */
--#define FIXADDR_TOP (((unsigned long)__FIXADDR_TOP) & ~(THREAD_SIZE-1))
-+#define FIXADDR_TOP __FIXADDR_TOP
-
- #define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
- #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/kmap_types.h linux-2.6.9-ve023stab030/include/asm-i386/kmap_types.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/kmap_types.h 2006-10-11 18:29:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/kmap_types.h 2006-10-11 19:07:56.000000000 +0400
-@@ -11,7 +11,8 @@ enum km_type {
- */
- KM_BOUNCE_READ,
- KM_VSTACK_BASE,
-- KM_VSTACK_TOP = KM_VSTACK_BASE + STACK_PAGE_COUNT-1,
-+ __KM_VSTACK_TOP = KM_VSTACK_BASE + STACK_PAGE_COUNT-1,
-+ KM_VSTACK_TOP = __KM_VSTACK_TOP + (__KM_VSTACK_TOP % 2),
-
- KM_LDT_PAGE15,
- KM_LDT_PAGE0 = KM_LDT_PAGE15 + 16-1,
-@@ -31,7 +32,8 @@ enum km_type {
- KM_SOFTIRQ1,
- KM_CRASHDUMP,
- KM_UNUSED,
-- KM_TYPE_NR
-+ __KM_TYPE_NR,
-+ KM_TYPE_NR=__KM_TYPE_NR + (__KM_TYPE_NR % 2)
- };
-
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/mman.h linux-2.6.9-ve023stab030/include/asm-i386/mman.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/mman.h 2004-10-19 01:53:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/mman.h 2006-10-11 19:07:56.000000000 +0400
-@@ -22,6 +22,7 @@
- #define MAP_NORESERVE 0x4000 /* don't check for reservations */
- #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
- #define MAP_NONBLOCK 0x10000 /* do not block on IO */
-+#define MAP_EXECPRIO 0x80000 /* map from exec - try not to fail */
-
- #define MS_ASYNC 1 /* sync memory asynchronously */
- #define MS_INVALIDATE 2 /* invalidate the caches */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/page.h linux-2.6.9-ve023stab030/include/asm-i386/page.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/page.h 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/page.h 2006-10-11 19:07:56.000000000 +0400
-@@ -101,7 +101,7 @@ typedef struct { unsigned long pgprot; }
-
- #ifdef CONFIG_X86_4G_VM_LAYOUT
- #define __PAGE_OFFSET (0x02000000)
--#define TASK_SIZE ((current->personality & 0x8000000) ? 0xc0000000 : 0xff000000)
-+#define TASK_SIZE (0xc0000000)
- #else
- #define __PAGE_OFFSET (0xc0000000)
- #define TASK_SIZE (0xc0000000)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/processor.h linux-2.6.9-ve023stab030/include/asm-i386/processor.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/processor.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/processor.h 2006-10-11 19:07:56.000000000 +0400
-@@ -84,8 +84,6 @@ struct cpuinfo_x86 {
-
- extern struct cpuinfo_x86 boot_cpu_data;
- extern struct cpuinfo_x86 new_cpu_data;
--extern struct tss_struct init_tss[NR_CPUS];
--extern struct tss_struct doublefault_tss;
-
- #ifdef CONFIG_SMP
- extern struct cpuinfo_x86 cpu_data[];
-@@ -317,7 +315,6 @@ extern unsigned long arch_align_stack(un
- #define IO_BITMAP_BITS 1024
- #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
- #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
--#define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
- #define INVALID_IO_BITMAP_OFFSET 0x8000
- #define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000
-
-@@ -423,16 +420,14 @@ struct tss_struct {
-
- #define ARCH_MIN_TASKALIGN 16
-
-+#define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
-
--#define STACK_PAGE_COUNT (4096/PAGE_SIZE)
--
--
--
-+extern struct tss_struct init_tss[NR_CPUS];
-+extern struct tss_struct doublefault_tss;
-
- struct thread_struct {
- /* cached TLS descriptors. */
- struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
-- void *stack_page[STACK_PAGE_COUNT];
- unsigned long esp0;
- unsigned long sysenter_cs;
- unsigned long eip;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/string.h linux-2.6.9-ve023stab030/include/asm-i386/string.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/string.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/string.h 2006-10-11 19:07:55.000000000 +0400
-@@ -140,7 +140,8 @@ __asm__ __volatile__(
- "orb $1,%%al\n"
- "3:"
- :"=a" (__res), "=&S" (d0), "=&D" (d1)
-- :"1" (cs),"2" (ct));
-+ :"1" (cs),"2" (ct)
-+ :"memory");
- return __res;
- }
-
-@@ -162,8 +163,9 @@ __asm__ __volatile__(
- "3:\tsbbl %%eax,%%eax\n\t"
- "orb $1,%%al\n"
- "4:"
-- :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
-- :"1" (cs),"2" (ct),"3" (count));
-+ :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
-+ :"1" (cs),"2" (ct),"3" (count)
-+ :"memory");
- return __res;
- }
-
-@@ -182,7 +184,9 @@ __asm__ __volatile__(
- "movl $1,%1\n"
- "2:\tmovl %1,%0\n\t"
- "decl %0"
-- :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c));
-+ :"=a" (__res), "=&S" (d0)
-+ :"1" (s),"0" (c)
-+ :"memory");
- return __res;
- }
-
-@@ -199,7 +203,9 @@ __asm__ __volatile__(
- "leal -1(%%esi),%0\n"
- "2:\ttestb %%al,%%al\n\t"
- "jne 1b"
-- :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c));
-+ :"=g" (__res), "=&S" (d0), "=&a" (d1)
-+ :"0" (0),"1" (s),"2" (c)
-+ :"memory");
- return __res;
- }
-
-@@ -215,7 +221,9 @@ __asm__ __volatile__(
- "scasb\n\t"
- "notl %0\n\t"
- "decl %0"
-- :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffffu));
-+ :"=c" (__res), "=&D" (d0)
-+ :"1" (s),"a" (0), "0" (0xffffffffu)
-+ :"memory");
- return __res;
- }
-
-@@ -326,7 +334,9 @@ __asm__ __volatile__(
- "je 1f\n\t"
- "movl $1,%0\n"
- "1:\tdecl %0"
-- :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count));
-+ :"=D" (__res), "=&c" (d0)
-+ :"a" (c),"0" (cs),"1" (count)
-+ :"memory");
- return __res;
- }
-
-@@ -362,7 +372,7 @@ __asm__ __volatile__(
- "je 2f\n\t"
- "stosb\n"
- "2:"
-- : "=&c" (d0), "=&D" (d1)
-+ :"=&c" (d0), "=&D" (d1)
- :"a" (c), "q" (count), "0" (count/4), "1" ((long) s)
- :"memory");
- return (s);
-@@ -385,7 +395,8 @@ __asm__ __volatile__(
- "jne 1b\n"
- "3:\tsubl %2,%0"
- :"=a" (__res), "=&d" (d0)
-- :"c" (s),"1" (count));
-+ :"c" (s),"1" (count)
-+ :"memory");
- return __res;
- }
- /* end of additional stuff */
-@@ -466,7 +477,8 @@ static inline void * memscan(void * addr
- "dec %%edi\n"
- "1:"
- : "=D" (addr), "=c" (size)
-- : "0" (addr), "1" (size), "a" (c));
-+ : "0" (addr), "1" (size), "a" (c)
-+ : "memory");
- return addr;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/system.h linux-2.6.9-ve023stab030/include/asm-i386/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/system.h 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/system.h 2006-10-11 19:07:55.000000000 +0400
-@@ -81,7 +81,7 @@ static inline unsigned long _get_base(ch
- #define loadsegment(seg,value) \
- asm volatile("\n" \
- "1:\t" \
-- "movl %0,%%" #seg "\n" \
-+ "mov %0,%%" #seg "\n" \
- "2:\n" \
- ".section .fixup,\"ax\"\n" \
- "3:\t" \
-@@ -93,13 +93,13 @@ static inline unsigned long _get_base(ch
- ".align 4\n\t" \
- ".long 1b,3b\n" \
- ".previous" \
-- : :"m" (*(unsigned int *)&(value)))
-+ : :"m" (value))
-
- /*
- * Save a segment register away
- */
- #define savesegment(seg, value) \
-- asm volatile("movl %%" #seg ",%0":"=m" (*(int *)&(value)))
-+ asm volatile("mov %%" #seg ",%0":"=m" (value))
-
- /*
- * Clear and set 'TS' bit respectively
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/thread_info.h linux-2.6.9-ve023stab030/include/asm-i386/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/thread_info.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -16,6 +16,15 @@
- #include <asm/processor.h>
- #endif
-
-+#define PREEMPT_ACTIVE 0x4000000
-+#ifdef CONFIG_4KSTACKS
-+#define THREAD_SIZE (4096)
-+#else
-+#define THREAD_SIZE (8192)
-+#endif
-+#define STACK_PAGE_COUNT (THREAD_SIZE/PAGE_SIZE)
-+#define STACK_WARN (THREAD_SIZE/8)
-+
- /*
- * low level task data that entry.S needs immediate access to
- * - this struct should fit entirely inside of one cache line
-@@ -39,6 +48,7 @@ struct thread_info {
- */
- void *sysenter_return;
- void *real_stack, *virtual_stack, *user_pgd;
-+ void *stack_page[STACK_PAGE_COUNT];
- struct restart_block restart_block;
-
- unsigned long previous_esp; /* ESP of the previous stack in case
-@@ -53,14 +63,6 @@ struct thread_info {
-
- #endif
-
--#define PREEMPT_ACTIVE 0x4000000
--#ifdef CONFIG_4KSTACKS
--#define THREAD_SIZE (4096)
--#else
--#define THREAD_SIZE (8192)
--#endif
--
--#define STACK_WARN (THREAD_SIZE/8)
- /*
- * macros/functions for gaining access to the thread information structure
- *
-@@ -108,13 +110,13 @@ static inline unsigned long current_stac
- ({ \
- struct thread_info *ret; \
- \
-- ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
-+ ret = kmalloc(THREAD_SIZE, GFP_KERNEL_UBC); \
- if (ret) \
- memset(ret, 0, THREAD_SIZE); \
- ret; \
- })
- #else
--#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
-+#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL_UBC)
- #endif
-
- #define free_thread_info(info) kfree(info)
-@@ -149,6 +151,8 @@ static inline unsigned long current_stac
- #define TIF_DB7 6 /* has debug registers */
- #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
- #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_FREEZE 17 /* Freeze request, atomic version of PF_FREEZE */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/timex.h linux-2.6.9-ve023stab030/include/asm-i386/timex.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/timex.h 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/timex.h 2006-10-11 19:07:57.000000000 +0400
-@@ -43,8 +43,7 @@ static inline cycles_t get_cycles (void)
- unsigned long long ret=0;
-
- #ifndef CONFIG_X86_TSC
-- if (!cpu_has_tsc)
-- return 0;
-+#error "CONFIG_X86_TCS is not set!"
- #endif
-
- #if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/uaccess.h linux-2.6.9-ve023stab030/include/asm-i386/uaccess.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/uaccess.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/uaccess.h 2006-10-11 19:07:56.000000000 +0400
-@@ -156,18 +156,28 @@ extern int zero_user_size(unsigned int s
- extern int copy_str_fromuser_size(unsigned int size, void *val, const void *ptr);
- extern int strlen_fromuser_size(unsigned int size, const void *ptr);
-
--
-+/*
-+ * GCC 2.96 has stupid bug which forces us to use volatile or barrier below.
-+ * without volatile or barrier compiler generates ABSOLUTELY wrong code which
-+ * igonores XXX_size function return code, but generates EFAULT :)))
-+ * the bug was found in sys_utime()
-+ */
- # define indirect_get_user(x,ptr) \
- ({ int __ret_gu,__val_gu; \
- __typeof__(ptr) __ptr_gu = (ptr); \
- __ret_gu = get_user_size(sizeof(*__ptr_gu), &__val_gu,__ptr_gu) ? -EFAULT : 0;\
-+ barrier(); \
- (x) = (__typeof__(*__ptr_gu))__val_gu; \
- __ret_gu; \
- })
- #define indirect_put_user(x,ptr) \
- ({ \
-+ int __ret_pu; \
- __typeof__(*(ptr)) *__ptr_pu = (ptr), __x_pu = (x); \
-- put_user_size(sizeof(*__ptr_pu), &__x_pu, __ptr_pu) ? -EFAULT : 0; \
-+ __ret_pu = put_user_size(sizeof(*__ptr_pu), \
-+ &__x_pu, __ptr_pu) ? -EFAULT : 0; \
-+ barrier(); \
-+ __ret_pu; \
- })
- #define __indirect_put_user indirect_put_user
- #define __indirect_get_user indirect_get_user
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-i386/unistd.h linux-2.6.9-ve023stab030/include/asm-i386/unistd.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-i386/unistd.h 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-i386/unistd.h 2006-10-11 19:08:01.000000000 +0400
-@@ -293,8 +293,19 @@
- #define __NR_add_key 286
- #define __NR_request_key 287
- #define __NR_keyctl 288
--
--#define NR_syscalls 289
-+#define __NR_fairsched_mknod 500 /* FairScheduler syscalls */
-+#define __NR_fairsched_rmnod 501
-+#define __NR_fairsched_chwt 502
-+#define __NR_fairsched_mvpr 503
-+#define __NR_fairsched_rate 504
-+#define __NR_fairsched_vcpus 505
-+#define __NR_getluid 510
-+#define __NR_setluid 511
-+#define __NR_setublimit 512
-+#define __NR_ubstat 513
-+#define __NR_lchmod 516
-+#define __NR_lutime 517
-+#define NR_syscalls 517
-
- #ifndef __KERNEL_SYSCALLS_NO_ERRNO__
- /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/mman.h linux-2.6.9-ve023stab030/include/asm-ia64/mman.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/mman.h 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/mman.h 2006-10-11 19:07:56.000000000 +0400
-@@ -30,6 +30,7 @@
- #define MAP_NORESERVE 0x04000 /* don't check for reservations */
- #define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */
- #define MAP_NONBLOCK 0x10000 /* do not block on IO */
-+#define MAP_EXECPRIO 0x80000 /* map from exec - try not to fail */
-
- #define MS_ASYNC 1 /* sync memory asynchronously */
- #define MS_INVALIDATE 2 /* invalidate the caches */
-@@ -48,4 +49,10 @@
- #define MAP_ANON MAP_ANONYMOUS
- #define MAP_FILE 0
-
-+#ifndef __ASSEMBLY__
-+#define ARCH_HAS_MMAP_CHECK
-+#define arch_mmap_check ia64_map_check_rgn
-+int ia64_map_check_rgn(unsigned long addr, unsigned long len);
-+#endif
-+
- #endif /* _ASM_IA64_MMAN_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/processor.h linux-2.6.9-ve023stab030/include/asm-ia64/processor.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/processor.h 2006-10-11 18:29:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/processor.h 2006-10-11 19:07:57.000000000 +0400
-@@ -323,7 +323,7 @@ struct thread_struct {
- regs->loadrs = 0; \
- regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \
- regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \
-- if (unlikely(!current->mm->dumpable)) { \
-+ if (unlikely(!current->mm->dumpable || !current->mm->vps_dumpable)) { \
- /* \
- * Zap scratch regs to avoid leaking bits between processes with different \
- * uid/privileges. \
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/system.h linux-2.6.9-ve023stab030/include/asm-ia64/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/system.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/system.h 2006-10-11 19:07:56.000000000 +0400
-@@ -279,7 +279,7 @@ do { \
- spin_lock(&(next)->switch_lock); \
- spin_unlock(&(rq)->lock); \
- } while (0)
--#define finish_arch_switch(rq, prev) spin_unlock_irq(&(prev)->switch_lock)
-+#define finish_arch_switch(rq, prev) spin_unlock(&(prev)->switch_lock)
- #define task_running(rq, p) ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
-
- #define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/thread_info.h linux-2.6.9-ve023stab030/include/asm-ia64/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/thread_info.h 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -67,6 +67,8 @@ struct thread_info {
- #define TIF_SYSCALL_TRACE 3 /* syscall trace active */
- #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
- #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_FREEZE 17 /* Freeze request, atomic version of PF_FREEZE */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define TIF_WORK_MASK 0x7 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE */
- #define TIF_ALLWORK_MASK 0x1f /* bits 0..4 are "work to do on user-return" bits */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/timex.h linux-2.6.9-ve023stab030/include/asm-ia64/timex.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/timex.h 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/timex.h 2006-10-11 19:07:57.000000000 +0400
-@@ -10,11 +10,14 @@
- * Also removed cacheflush_time as it's entirely unused.
- */
-
--#include <asm/intrinsics.h>
--#include <asm/processor.h>
-+extern unsigned int cpu_khz;
-
- typedef unsigned long cycles_t;
-
-+#ifdef __KERNEL__
-+#include <asm/intrinsics.h>
-+#include <asm/processor.h>
-+
- /*
- * For performance reasons, we don't want to define CLOCK_TICK_TRATE as
- * local_cpu_data->itc_rate. Fortunately, we don't have to, either: according to George
-@@ -37,4 +40,5 @@ get_cycles (void)
- return ret;
- }
-
-+#endif /* __KERNEL__ */
- #endif /* _ASM_IA64_TIMEX_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/unistd.h linux-2.6.9-ve023stab030/include/asm-ia64/unistd.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ia64/unistd.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ia64/unistd.h 2006-10-11 19:08:01.000000000 +0400
-@@ -263,12 +263,24 @@
- #define __NR_add_key 1271
- #define __NR_request_key 1272
- #define __NR_keyctl 1273
-+#define __NR_fairsched_vcpus 1499
-+#define __NR_fairsched_mknod 1500
-+#define __NR_fairsched_rmnod 1501
-+#define __NR_fairsched_chwt 1502
-+#define __NR_fairsched_mvpr 1503
-+#define __NR_fairsched_rate 1504
-+#define __NR_getluid 1505
-+#define __NR_setluid 1506
-+#define __NR_setublimit 1507
-+#define __NR_ubstat 1508
-+#define __NR_lchmod 1509
-+#define __NR_lutime 1510
-
- #ifdef __KERNEL__
-
- #include <linux/config.h>
-
--#define NR_syscalls 256 /* length of syscall table */
-+#define NR_syscalls (__NR_lutime - __NR_ni_syscall + 1) /* length of syscall table */
-
- #define __ARCH_WANT_SYS_RT_SIGACTION
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-m32r/thread_info.h linux-2.6.9-ve023stab030/include/asm-m32r/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-m32r/thread_info.h 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-m32r/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -123,6 +123,7 @@ static inline struct thread_info *curren
- #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
- #define TIF_IRET 5 /* return with iret */
- #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-m68k/thread_info.h linux-2.6.9-ve023stab030/include/asm-m68k/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-m68k/thread_info.h 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-m68k/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -48,6 +48,7 @@ struct thread_info {
- #define TIF_NOTIFY_RESUME 2 /* resumption notification requested */
- #define TIF_SIGPENDING 3 /* signal pending */
- #define TIF_NEED_RESCHED 4 /* rescheduling necessary */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- extern int thread_flag_fixme(void);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-m68knommu/thread_info.h linux-2.6.9-ve023stab030/include/asm-m68knommu/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-m68knommu/thread_info.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-m68knommu/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -91,6 +91,7 @@ static inline struct thread_info *curren
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-mips/system.h linux-2.6.9-ve023stab030/include/asm-mips/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-mips/system.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-mips/system.h 2006-10-11 19:07:56.000000000 +0400
-@@ -496,7 +496,7 @@ do { \
- spin_lock(&(next)->switch_lock); \
- spin_unlock(&(rq)->lock); \
- } while (0)
--#define finish_arch_switch(rq, prev) spin_unlock_irq(&(prev)->switch_lock)
-+#define finish_arch_switch(rq, prev) spin_unlock(&(prev)->switch_lock)
- #define task_running(rq, p) ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
-
- #endif /* _ASM_SYSTEM_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-mips/thread_info.h linux-2.6.9-ve023stab030/include/asm-mips/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-mips/thread_info.h 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-mips/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -116,6 +116,7 @@ register struct thread_info *__current_t
- #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
- #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
- #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
- #define TIF_SYSCALL_TRACE 31 /* syscall trace active */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-parisc/thread_info.h linux-2.6.9-ve023stab030/include/asm-parisc/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-parisc/thread_info.h 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-parisc/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -60,6 +60,7 @@ struct thread_info {
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling TIF_NEED_RESCHED */
- #define TIF_32BIT 5 /* 32 bit binary */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ppc/thread_info.h linux-2.6.9-ve023stab030/include/asm-ppc/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ppc/thread_info.h 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ppc/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -76,6 +76,8 @@ static inline struct thread_info *curren
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-+
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-ppc64/thread_info.h linux-2.6.9-ve023stab030/include/asm-ppc64/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-ppc64/thread_info.h 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-ppc64/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -98,6 +98,7 @@ static inline struct thread_info *curren
- #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
- #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
- #define TIF_SINGLESTEP 9 /* singlestepping active */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-s390/system.h linux-2.6.9-ve023stab030/include/asm-s390/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-s390/system.h 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-s390/system.h 2006-10-11 19:07:56.000000000 +0400
-@@ -107,7 +107,7 @@ static inline void restore_access_regs(u
- #define task_running(rq, p) ((rq)->curr == (p))
- #define finish_arch_switch(rq, prev) do { \
- set_fs(current->thread.mm_segment); \
-- spin_unlock_irq(&(rq)->lock); \
-+ spin_unlock(&(rq)->lock); \
- } while (0)
-
- #define nop() __asm__ __volatile__ ("nop")
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-s390/thread_info.h linux-2.6.9-ve023stab030/include/asm-s390/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-s390/thread_info.h 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-s390/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -100,6 +100,7 @@ static inline struct thread_info *curren
- #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
- #define TIF_31BIT 18 /* 32bit process */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sh/thread_info.h linux-2.6.9-ve023stab030/include/asm-sh/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sh/thread_info.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sh/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -93,6 +93,7 @@ static inline struct thread_info *curren
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
- #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
- #define TIF_USERSPACE 31 /* true if FS sets userspace */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sh64/thread_info.h linux-2.6.9-ve023stab030/include/asm-sh64/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sh64/thread_info.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sh64/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -74,6 +74,7 @@ static inline struct thread_info *curren
- #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
- #define TIF_SIGPENDING 2 /* signal pending */
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define THREAD_SIZE 16384
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sparc/system.h linux-2.6.9-ve023stab030/include/asm-sparc/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sparc/system.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sparc/system.h 2006-10-11 19:07:56.000000000 +0400
-@@ -109,7 +109,7 @@ extern void fpsave(unsigned long *fpregs
- "save %sp, -0x40, %sp\n\t" \
- "restore; restore; restore; restore; restore; restore; restore"); \
- } while(0)
--#define finish_arch_switch(rq, next) spin_unlock_irq(&(rq)->lock)
-+#define finish_arch_switch(rq, next) spin_unlock(&(rq)->lock)
- #define task_running(rq, p) ((rq)->curr == (p))
-
- /* Much care has gone into this code, do not touch it.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sparc/thread_info.h linux-2.6.9-ve023stab030/include/asm-sparc/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sparc/thread_info.h 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sparc/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -138,6 +138,7 @@ BTFIXUPDEF_CALL(void, free_thread_info,
- * this quantum (SMP) */
- #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
- * TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sparc64/system.h linux-2.6.9-ve023stab030/include/asm-sparc64/system.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sparc64/system.h 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sparc64/system.h 2006-10-11 19:07:56.000000000 +0400
-@@ -146,7 +146,7 @@ do { spin_lock(&(next)->switch_lock); \
- } while (0)
-
- #define finish_arch_switch(rq, prev) \
--do { spin_unlock_irq(&(prev)->switch_lock); \
-+do { spin_unlock(&(prev)->switch_lock); \
- } while (0)
-
- #define task_running(rq, p) \
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-sparc64/thread_info.h linux-2.6.9-ve023stab030/include/asm-sparc64/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-sparc64/thread_info.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-sparc64/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -228,6 +228,7 @@ register struct thread_info *current_thr
- * an immediate value in instructions such as andcc.
- */
- #define TIF_ABI_PENDING 12
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-um/thread_info.h linux-2.6.9-ve023stab030/include/asm-um/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-um/thread_info.h 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-um/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -70,6 +70,7 @@ static inline struct thread_info *curren
- * TIF_NEED_RESCHED
- */
- #define TIF_RESTART_BLOCK 4
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
- #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-v850/thread_info.h linux-2.6.9-ve023stab030/include/asm-v850/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-v850/thread_info.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-v850/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -83,6 +83,7 @@ struct thread_info {
- #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
- #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- /* as above, but as bit values */
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/a.out.h linux-2.6.9-ve023stab030/include/asm-x86_64/a.out.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/a.out.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/a.out.h 2006-10-11 19:07:55.000000000 +0400
-@@ -21,7 +21,7 @@ struct exec
-
- #ifdef __KERNEL__
- #include <linux/thread_info.h>
--#define STACK_TOP (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE)
-+#define STACK_TOP TASK_SIZE
- #endif
-
- #endif /* __A_OUT_GNU_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/calling.h linux-2.6.9-ve023stab030/include/asm-x86_64/calling.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/calling.h 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/calling.h 2006-10-11 19:07:55.000000000 +0400
-@@ -143,22 +143,6 @@
- RESTORE_ARGS 0,\addskip
- .endm
-
-- /* push in order ss, rsp, eflags, cs, rip */
-- .macro FAKE_STACK_FRAME child_rip
-- xorl %eax,%eax
-- subq $6*8,%rsp
-- movq %rax,5*8(%rsp) /* ss */
-- movq %rax,4*8(%rsp) /* rsp */
-- movq $(1<<9),3*8(%rsp) /* eflags */
-- movq $__KERNEL_CS,2*8(%rsp) /* cs */
-- movq \child_rip,1*8(%rsp) /* rip */
-- movq %rax,(%rsp) /* orig_rax */
-- .endm
--
-- .macro UNFAKE_STACK_FRAME
-- addq $8*6, %rsp
-- .endm
--
- .macro icebp
- .byte 0xf1
- .endm
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/ia32.h linux-2.6.9-ve023stab030/include/asm-x86_64/ia32.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/ia32.h 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/ia32.h 2006-10-11 19:07:56.000000000 +0400
-@@ -78,7 +78,7 @@ struct stat64 {
- unsigned long long st_ino;
- } __attribute__((packed));
-
--typedef struct siginfo32 {
-+typedef struct compat_siginfo {
- int si_signo;
- int si_errno;
- int si_code;
-@@ -128,7 +128,7 @@ typedef struct siginfo32 {
- int _fd;
- } _sigpoll;
- } _sifields;
--} siginfo_t32;
-+} compat_siginfo_t;
-
- struct sigframe32
- {
-@@ -145,7 +145,7 @@ struct rt_sigframe32
- int sig;
- u32 pinfo;
- u32 puc;
-- struct siginfo32 info;
-+ struct compat_siginfo info;
- struct ucontext_ia32 uc;
- struct _fpstate_ia32 fpstate;
- };
-@@ -157,7 +157,7 @@ struct ustat32 {
- char f_fpack[6];
- };
-
--#define IA32_STACK_TOP IA32_PAGE_OFFSET
-+#define IA32_STACK_TOP (IA32_PAGE_OFFSET - PAGE_SIZE * 2)
-
- #ifdef __KERNEL__
- struct user_desc;
-@@ -165,8 +165,6 @@ struct siginfo_t;
- int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info);
- int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info);
- int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
--int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from);
--int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from);
- #endif
-
- #endif /* !CONFIG_IA32_SUPPORT */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/kdebug.h linux-2.6.9-ve023stab030/include/asm-x86_64/kdebug.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/kdebug.h 2006-10-11 18:29:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/kdebug.h 2006-10-11 19:08:02.000000000 +0400
-@@ -42,7 +42,7 @@ static inline int notify_die(enum die_va
- return notifier_call_chain(&die_chain, val, &args);
- }
-
--extern int printk_address(unsigned long address);
-+extern void printk_address(unsigned long address);
- extern void die(const char *,struct pt_regs *,long);
- extern void __die(const char *,struct pt_regs *,long);
- extern void show_registers(struct pt_regs *regs);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/mman.h linux-2.6.9-ve023stab030/include/asm-x86_64/mman.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/mman.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/mman.h 2006-10-11 19:07:56.000000000 +0400
-@@ -23,6 +23,7 @@
- #define MAP_NORESERVE 0x4000 /* don't check for reservations */
- #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
- #define MAP_NONBLOCK 0x10000 /* do not block on IO */
-+#define MAP_EXECPRIO 0x80000 /* map from exec - try not to fail */
-
- #define MS_ASYNC 1 /* sync memory asynchronously */
- #define MS_INVALIDATE 2 /* invalidate the caches */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/mmu.h linux-2.6.9-ve023stab030/include/asm-x86_64/mmu.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/mmu.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/mmu.h 2006-10-11 19:07:56.000000000 +0400
-@@ -15,6 +15,7 @@ typedef struct {
- rwlock_t ldtlock;
- int size;
- struct semaphore sem;
-+ void *vdso;
- } mm_context_t;
-
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/pgalloc.h linux-2.6.9-ve023stab030/include/asm-x86_64/pgalloc.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/pgalloc.h 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/pgalloc.h 2006-10-11 19:07:56.000000000 +0400
-@@ -35,12 +35,12 @@ extern __inline__ void pmd_free(pmd_t *p
-
- static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
- {
-- return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
-+ return (pmd_t *)get_zeroed_page(GFP_KERNEL_UBC|__GFP_REPEAT);
- }
-
- static inline pgd_t *pgd_alloc (struct mm_struct *mm)
- {
-- return (pgd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
-+ return (pgd_t *)get_zeroed_page(GFP_KERNEL_UBC|__GFP_REPEAT);
- }
-
- static inline void pgd_free (pgd_t *pgd)
-@@ -56,7 +56,7 @@ static inline pte_t *pte_alloc_one_kerne
-
- static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
- {
-- void *p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
-+ void *p = (void *)get_zeroed_page(GFP_KERNEL_UBC|__GFP_REPEAT);
- if (!p)
- return NULL;
- return virt_to_page(p);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/pgtable.h linux-2.6.9-ve023stab030/include/asm-x86_64/pgtable.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/pgtable.h 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/pgtable.h 2006-10-11 19:07:55.000000000 +0400
-@@ -440,7 +440,7 @@ extern inline pte_t pte_modify(pte_t pte
- }
-
- #define pte_index(address) \
-- ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
-+ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
- #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \
- pte_index(address))
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/processor.h linux-2.6.9-ve023stab030/include/asm-x86_64/processor.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/processor.h 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/processor.h 2006-10-11 19:07:58.000000000 +0400
-@@ -168,17 +168,17 @@ static inline void clear_in_cr4 (unsigne
- /* This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
--#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
--#define TASK_UNMAPPED_32 PAGE_ALIGN(IA32_PAGE_OFFSET/3)
--#define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3)
--#define TASK_UNMAPPED_BASE \
-- (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64)
-+#define IA32_PAGE_OFFSET 0xc0000000
-+#define TASK_SIZE (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE64)
-+#define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE64))
-+
-+#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE/3)
-
-
- /*
- * User space process size: 512GB - 1GB (default).
- */
--#define TASK_SIZE (0x0000007fc0000000UL)
-+#define TASK_SIZE64 (0x0000007fc0000000UL)
-
- #define TASK_SIZE_3264 (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE)
-
-@@ -188,7 +188,6 @@ static inline void clear_in_cr4 (unsigne
- #define IO_BITMAP_BITS 1024
- #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
- #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
--#define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
- #define INVALID_IO_BITMAP_OFFSET 0x8000
-
- struct i387_fxsave_struct {
-@@ -237,6 +236,8 @@ DECLARE_PER_CPU(struct tss_struct,init_t
-
- #define ARCH_MIN_TASKALIGN 16
-
-+#define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
-+
- struct thread_struct {
- unsigned long rsp0;
- unsigned long rsp;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/segment.h linux-2.6.9-ve023stab030/include/asm-x86_64/segment.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/segment.h 2004-10-19 01:55:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/segment.h 2006-10-11 19:07:58.000000000 +0400
-@@ -3,32 +3,31 @@
-
- #include <asm/cache.h>
-
--#define __KERNEL_CS 0x10
--#define __KERNEL_DS 0x18
--
--#define __KERNEL32_CS 0x38
--
-+#define __KERNEL_COMPAT32_CS 0x8
-+#define GDT_ENTRY_BOOT_CS 2
-+#define __BOOT_CS (GDT_ENTRY_BOOT_CS * 8)
-+#define GDT_ENTRY_BOOT_DS 3
-+#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
-+#define GDT_ENTRY_TSS 4 /* needs two entries */
- /*
- * we cannot use the same code segment descriptor for user and kernel
- * -- not even in the long flat mode, because of different DPL /kkeil
- * The segment offset needs to contain a RPL. Grr. -AK
- * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets)
- */
--
--#define __USER32_CS 0x23 /* 4*8+3 */
--#define __USER_DS 0x2b /* 5*8+3 */
--#define __USER_CS 0x33 /* 6*8+3 */
--#define __USER32_DS __USER_DS
-+#define GDT_ENTRY_TLS_MIN 6
-+#define GDT_ENTRY_TLS_MAX 8
-+#define GDT_ENTRY_KERNELCS16 9
- #define __KERNEL16_CS (GDT_ENTRY_KERNELCS16 * 8)
--#define __KERNEL_COMPAT32_CS 0x8
-
--#define GDT_ENTRY_TLS 1
--#define GDT_ENTRY_TSS 8 /* needs two entries */
- #define GDT_ENTRY_LDT 10
--#define GDT_ENTRY_TLS_MIN 11
--#define GDT_ENTRY_TLS_MAX 13
--/* 14 free */
--#define GDT_ENTRY_KERNELCS16 15
-+#define __KERNEL32_CS 0x58 /* 11*8 */
-+#define __KERNEL_CS 0x60 /* 12*8 */
-+#define __KERNEL_DS 0x68 /* 13*8 */
-+#define __USER32_CS 0x73 /* 14*8+3 */
-+#define __USER_DS 0x7b /* 15*8+3 */
-+#define __USER32_DS __USER_DS
-+#define __USER_CS 0x83 /* 16*8+3 */
-
- #define GDT_ENTRY_TLS_ENTRIES 3
-
-@@ -40,7 +39,7 @@
- #define FS_TLS_SEL ((GDT_ENTRY_TLS_MIN+FS_TLS)*8 + 3)
-
- #define IDT_ENTRIES 256
--#define GDT_ENTRIES 16
-+#define GDT_ENTRIES 32
- #define GDT_SIZE (GDT_ENTRIES * 8)
- #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/thread_info.h linux-2.6.9-ve023stab030/include/asm-x86_64/thread_info.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/thread_info.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/thread_info.h 2006-10-11 19:08:02.000000000 +0400
-@@ -33,6 +33,7 @@ struct thread_info {
-
- mm_segment_t addr_limit;
- struct restart_block restart_block;
-+ void *sysenter_return;
- };
- #endif
-
-@@ -106,6 +107,8 @@ static inline struct thread_info *stack_
- #define TIF_IA32 17 /* 32bit process */
- #define TIF_FORK 18 /* ret_from_fork */
- #define TIF_ABI_PENDING 19
-+#define TIF_FREEZE 20 /* Freeze request, atomic version of PF_FREEZE */
-+#define TIF_MEMDIE 21 /* Process was killed by OOM */
-
- #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
- #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/unistd.h linux-2.6.9-ve023stab030/include/asm-x86_64/unistd.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/unistd.h 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/unistd.h 2006-10-11 19:08:01.000000000 +0400
-@@ -570,8 +570,33 @@ __SYSCALL(__NR_add_key, sys_add_key)
- __SYSCALL(__NR_request_key, sys_request_key)
- #define __NR_keyctl 250
- __SYSCALL(__NR_keyctl, sys_keyctl)
-+#define __NR_fairsched_vcpus 499
-+__SYSCALL(__NR_fairsched_rate, sys_fairsched_rate)
-+#define __NR_getluid 500
-+__SYSCALL(__NR_getluid, sys_getluid)
-+#define __NR_setluid 501
-+__SYSCALL(__NR_setluid, sys_setluid)
-+#define __NR_setublimit 502
-+__SYSCALL(__NR_setublimit, sys_setublimit)
-+#define __NR_ubstat 503
-+__SYSCALL(__NR_ubstat, sys_ubstat)
-+#define __NR_fairsched_mknod 504 /* FairScheduler syscalls */
-+__SYSCALL(__NR_fairsched_mknod, sys_fairsched_mknod)
-+#define __NR_fairsched_rmnod 505
-+__SYSCALL(__NR_fairsched_rmnod, sys_fairsched_rmnod)
-+#define __NR_fairsched_chwt 506
-+__SYSCALL(__NR_fairsched_chwt, sys_fairsched_chwt)
-+#define __NR_fairsched_mvpr 507
-+__SYSCALL(__NR_fairsched_mvpr, sys_fairsched_mvpr)
-+#define __NR_fairsched_rate 508
-+__SYSCALL(__NR_fairsched_rate, sys_fairsched_rate)
-+#define __NR_lchmod 509
-+__SYSCALL(__NR_lchmod, sys_lchmod)
-+#define __NR_lutime 510
-+__SYSCALL(__NR_lutime, sys_lutime)
-+
-+#define __NR_syscall_max __NR_lutime
-
--#define __NR_syscall_max __NR_keyctl
- #ifndef __NO_STUBS
-
- /* user-visible error numbers are in the range -1 - -4095 */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/vsyscall.h linux-2.6.9-ve023stab030/include/asm-x86_64/vsyscall.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/vsyscall.h 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/vsyscall.h 2006-10-11 19:07:55.000000000 +0400
-@@ -1,8 +1,6 @@
- #ifndef _ASM_X86_64_VSYSCALL_H_
- #define _ASM_X86_64_VSYSCALL_H_
-
--#include <linux/seqlock.h>
--
- enum vsyscall_num {
- __NR_vgettimeofday,
- __NR_vtime,
-@@ -15,13 +13,15 @@ enum vsyscall_num {
-
- #ifdef __KERNEL__
-
-+#include <linux/seqlock.h>
-+
- #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
- #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16)))
- #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
- #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
- #define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16)))
- #define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16)))
--#define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(64)))
-+#define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16)))
-
- #define VXTIME_TSC 1
- #define VXTIME_HPET 2
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/vsyscall32.h linux-2.6.9-ve023stab030/include/asm-x86_64/vsyscall32.h
---- linux-2.6.9-42.0.3.EL.orig/include/asm-x86_64/vsyscall32.h 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/asm-x86_64/vsyscall32.h 2006-10-11 19:07:56.000000000 +0400
-@@ -4,15 +4,21 @@
- /* Values need to match arch/x86_64/ia32/vsyscall.lds */
-
- #ifdef __ASSEMBLY__
--#define VSYSCALL32_BASE 0xffffe000
--#define VSYSCALL32_SYSEXIT (VSYSCALL32_BASE + 0x410)
-+#define __IA32_PAGE_OFFSET 0xc0000000
-+#define VSYSCALL32_BASE (__IA32_PAGE_OFFSET-PAGE_SIZE)
-+/* For CPT: VSYSCALL32_SYSEXIT value must match SYSENTER_RETURN_OFFSET
-+ value to be able to migrate vsyscall-sysenter page from x86_64 to i386 */
-+#define VSYSCALL32_SYSEXIT (VSYSCALL32_BASE + 0x420)
- #else
--#define VSYSCALL32_BASE 0xffffe000UL
-+#define VSYSCALL32_BASE ((unsigned long)current->mm->context.vdso)
- #define VSYSCALL32_END (VSYSCALL32_BASE + PAGE_SIZE)
- #define VSYSCALL32_EHDR ((const struct elf32_hdr *) VSYSCALL32_BASE)
-
-+#define __VSYSCALL32_BASE ((unsigned long)(IA32_PAGE_OFFSET-PAGE_SIZE))
-+#define __VSYSCALL32_END (__VSYSCALL32_BASE + PAGE_SIZE)
-+
- #define VSYSCALL32_VSYSCALL ((void *)VSYSCALL32_BASE + 0x400)
--#define VSYSCALL32_SYSEXIT ((void *)VSYSCALL32_BASE + 0x410)
-+#define VSYSCALL32_SYSEXIT ((void *)VSYSCALL32_BASE + 0x420)
- #define VSYSCALL32_SIGRETURN ((void __user *)VSYSCALL32_BASE + 0x500)
- #define VSYSCALL32_RTSIGRETURN ((void __user *)VSYSCALL32_BASE + 0x600)
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/binfmts.h linux-2.6.9-ve023stab030/include/linux/binfmts.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/binfmts.h 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/binfmts.h 2006-10-11 19:07:55.000000000 +0400
-@@ -2,6 +2,7 @@
- #define _LINUX_BINFMTS_H
-
- #include <linux/capability.h>
-+#include <linux/fs.h>
-
- struct pt_regs;
-
-@@ -28,6 +29,7 @@ struct linux_binprm{
- int sh_bang;
- struct file * file;
- int e_uid, e_gid;
-+ struct exec_perm perm;
- kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
- void *security;
- int argc, envc;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/capability.h linux-2.6.9-ve023stab030/include/linux/capability.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/capability.h 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/capability.h 2006-10-11 19:07:57.000000000 +0400
-@@ -147,12 +147,9 @@ typedef __u32 kernel_cap_t;
-
- #define CAP_NET_BROADCAST 11
-
--/* Allow interface configuration */
- /* Allow administration of IP firewall, masquerading and accounting */
- /* Allow setting debug option on sockets */
- /* Allow modification of routing tables */
--/* Allow setting arbitrary process / process group ownership on
-- sockets */
- /* Allow binding to any address for transparent proxying */
- /* Allow setting TOS (type of service) */
- /* Allow setting promiscuous mode */
-@@ -183,6 +180,7 @@ typedef __u32 kernel_cap_t;
- #define CAP_SYS_MODULE 16
-
- /* Allow ioperm/iopl access */
-+/* Allow O_DIRECT access */
- /* Allow sending USB messages to any device via /proc/bus/usb */
-
- #define CAP_SYS_RAWIO 17
-@@ -201,24 +199,19 @@ typedef __u32 kernel_cap_t;
-
- /* Allow configuration of the secure attention key */
- /* Allow administration of the random device */
--/* Allow examination and configuration of disk quotas */
- /* Allow configuring the kernel's syslog (printk behaviour) */
- /* Allow setting the domainname */
- /* Allow setting the hostname */
- /* Allow calling bdflush() */
--/* Allow mount() and umount(), setting up new smb connection */
-+/* Allow setting up new smb connection */
- /* Allow some autofs root ioctls */
- /* Allow nfsservctl */
- /* Allow VM86_REQUEST_IRQ */
- /* Allow to read/write pci config on alpha */
- /* Allow irix_prctl on mips (setstacksize) */
- /* Allow flushing all cache on m68k (sys_cacheflush) */
--/* Allow removing semaphores */
--/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
-- and shared memory */
- /* Allow locking/unlocking of shared memory segment */
- /* Allow turning swap on/off */
--/* Allow forged pids on socket credentials passing */
- /* Allow setting readahead and flushing buffers on block devices */
- /* Allow setting geometry in floppy driver */
- /* Allow turning DMA on/off in xd driver */
-@@ -235,6 +228,8 @@ typedef __u32 kernel_cap_t;
- /* Allow enabling/disabling tagged queuing on SCSI controllers and sending
- arbitrary SCSI commands */
- /* Allow setting encryption key on loopback filesystem */
-+/* Modify data journaling mode on ext3 filesystem (uses journaling
-+ resources) */
-
- #define CAP_SYS_ADMIN 21
-
-@@ -254,8 +249,6 @@ typedef __u32 kernel_cap_t;
- /* Override resource limits. Set resource limits. */
- /* Override quota limits. */
- /* Override reserved space on ext2 filesystem */
--/* Modify data journaling mode on ext3 filesystem (uses journaling
-- resources) */
- /* NOTE: ext2 honors fsuid when checking for resource overrides, so
- you can override using fsuid too */
- /* Override size restrictions on IPC message queues */
-@@ -288,6 +281,36 @@ typedef __u32 kernel_cap_t;
-
- #define CAP_AUDIT_CONTROL 30
-
-+/* Allow access to all information. In the other case some structures will be
-+ hiding to ensure different Virtual Environment non-interaction on the same
-+ node */
-+#define CAP_SETVEID 29
-+
-+#define CAP_VE_ADMIN 30
-+
-+/* Replacement for CAP_NET_ADMIN:
-+ delegated rights to the Virtual environment of its network administration.
-+ For now the following rights have been delegated:
-+
-+ Allow setting arbitrary process / process group ownership on sockets
-+ Allow interface configuration
-+*/
-+#define CAP_VE_NET_ADMIN CAP_VE_ADMIN
-+
-+/* Replacement for CAP_SYS_ADMIN:
-+ delegated rights to the Virtual environment of its administration.
-+ For now the following rights have been delegated:
-+*/
-+/* Allow mount/umount/remount */
-+/* Allow examination and configuration of disk quotas */
-+/* Allow removing semaphores */
-+/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
-+ and shared memory */
-+/* Allow locking/unlocking of shared memory segment */
-+/* Allow forged pids on socket credentials passing */
-+
-+#define CAP_VE_SYS_ADMIN CAP_VE_ADMIN
-+
- #ifdef __KERNEL__
- /*
- * Bounding set
-@@ -352,9 +375,16 @@ static inline kernel_cap_t cap_invert(ke
- #define cap_issubset(a,set) (!(cap_t(a) & ~cap_t(set)))
-
- #define cap_clear(c) do { cap_t(c) = 0; } while(0)
-+
-+#ifndef CONFIG_VE
- #define cap_set_full(c) do { cap_t(c) = ~0; } while(0)
--#define cap_mask(c,mask) do { cap_t(c) &= cap_t(mask); } while(0)
-+#else
-+#define cap_set_full(c) \
-+ do {cap_t(c) = ve_is_super(get_exec_env()) ? ~0 : \
-+ get_exec_env()->cap_default; } while(0)
-+#endif
-
-+#define cap_mask(c,mask) do { cap_t(c) &= cap_t(mask); } while(0)
- #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
-
- #endif /* __KERNEL__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/coda_linux.h linux-2.6.9-ve023stab030/include/linux/coda_linux.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/coda_linux.h 2004-10-19 01:53:24.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/coda_linux.h 2006-10-11 19:07:55.000000000 +0400
-@@ -38,7 +38,8 @@ extern struct file_operations coda_ioctl
- int coda_open(struct inode *i, struct file *f);
- int coda_flush(struct file *f);
- int coda_release(struct inode *i, struct file *f);
--int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
-+int coda_permission(struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm);
- int coda_revalidate_inode(struct dentry *);
- int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
- int coda_setattr(struct dentry *, struct iattr *);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/compat.h linux-2.6.9-ve023stab030/include/linux/compat.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/compat.h 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/compat.h 2006-10-11 19:07:55.000000000 +0400
-@@ -145,5 +145,8 @@ long compat_get_bitmap(unsigned long *ma
- long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
- unsigned long bitmap_size);
-
-+struct compat_siginfo;
-+int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
-+int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
- #endif /* CONFIG_COMPAT */
- #endif /* _LINUX_COMPAT_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/console.h linux-2.6.9-ve023stab030/include/linux/console.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/console.h 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/console.h 2006-10-11 19:08:00.000000000 +0400
-@@ -126,4 +126,22 @@ extern int is_console_locked(void);
- #define VESA_HSYNC_SUSPEND 2
- #define VESA_POWERDOWN 3
-
-+
-+#include <linux/preempt.h>
-+#include <linux/cache.h>
-+#include <linux/threads.h>
-+
-+struct printk_aligned {
-+ int v;
-+} ____cacheline_aligned;
-+extern struct printk_aligned printk_no_wake_var[NR_CPUS];
-+#define __printk_no_wake (printk_no_wake_var[smp_processor_id()].v)
-+#define printk_no_wake ({ \
-+ int v; \
-+ preempt_disable(); \
-+ v = __printk_no_wake; \
-+ preempt_enable_no_resched(); \
-+ v; \
-+ })
-+
- #endif /* _LINUX_CONSOLE_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/cpt_image.h linux-2.6.9-ve023stab030/include/linux/cpt_image.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/cpt_image.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/cpt_image.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1504 @@
-+#ifndef __CPT_IMAGE_H_
-+#define __CPT_IMAGE_H_ 1
-+
-+#define CPT_NULL (~0ULL)
-+#define CPT_NOINDEX (~0U)
-+
-+/*
-+ * Image file layout.
-+ *
-+ * - major header
-+ * - sections[]
-+ *
-+ * Each section is:
-+ * - section header
-+ * - array of objects
-+ *
-+ * All data records are arch independent, 64 bit aligned.
-+ */
-+
-+enum _cpt_object_type
-+{
-+ CPT_OBJ_TASK = 0,
-+ CPT_OBJ_MM,
-+ CPT_OBJ_FS,
-+ CPT_OBJ_FILES,
-+ CPT_OBJ_FILE,
-+ CPT_OBJ_SIGHAND_STRUCT,
-+ CPT_OBJ_SIGNAL_STRUCT,
-+ CPT_OBJ_TTY,
-+ CPT_OBJ_SOCKET,
-+ CPT_OBJ_SYSVSEM_UNDO,
-+ CPT_OBJ_NAMESPACE,
-+ CPT_OBJ_SYSV_SHM,
-+ CPT_OBJ_INODE,
-+ CPT_OBJ_UBC,
-+ CPT_OBJ_SLM_SGREG,
-+ CPT_OBJ_SLM_REGOBJ,
-+ CPT_OBJ_SLM_MM,
-+ CPT_OBJ_MAX,
-+ /* The objects above are stored in memory while checkpointing */
-+
-+ CPT_OBJ_VMA = 1024,
-+ CPT_OBJ_FILEDESC,
-+ CPT_OBJ_SIGHANDLER,
-+ CPT_OBJ_SIGINFO,
-+ CPT_OBJ_LASTSIGINFO,
-+ CPT_OBJ_SYSV_SEM,
-+ CPT_OBJ_SKB,
-+ CPT_OBJ_FLOCK,
-+ CPT_OBJ_OPENREQ,
-+ CPT_OBJ_VFSMOUNT,
-+ CPT_OBJ_TRAILER,
-+ CPT_OBJ_SYSVSEM_UNDO_REC,
-+ CPT_OBJ_NET_DEVICE,
-+ CPT_OBJ_NET_IFADDR,
-+ CPT_OBJ_NET_ROUTE,
-+ CPT_OBJ_NET_CONNTRACK,
-+ CPT_OBJ_NET_CONNTRACK_EXPECT,
-+ CPT_OBJ_AIO_CONTEXT,
-+ CPT_OBJ_VEINFO,
-+ CPT_OBJ_EPOLL,
-+ CPT_OBJ_EPOLL_FILE,
-+ CPT_OBJ_SKFILTER,
-+ CPT_OBJ_SIGALTSTACK,
-+ CPT_OBJ_SOCK_MCADDR,
-+ CPT_OBJ_BIND_MNT,
-+
-+ CPT_OBJ_X86_REGS = 4096,
-+ CPT_OBJ_X86_64_REGS,
-+ CPT_OBJ_PAGES,
-+ CPT_OBJ_COPYPAGES,
-+ CPT_OBJ_REMAPPAGES,
-+ CPT_OBJ_LAZYPAGES,
-+ CPT_OBJ_NAME,
-+ CPT_OBJ_BITS,
-+ CPT_OBJ_REF,
-+ CPT_OBJ_ITERPAGES,
-+ CPT_OBJ_ITERYOUNGPAGES,
-+ CPT_OBJ_VSYSCALL,
-+};
-+
-+#define CPT_ALIGN(n) (((n)+7)&~7)
-+
-+struct cpt_major_hdr
-+{
-+ __u8 cpt_signature[4]; /* Magic number */
-+ __u16 cpt_hdrlen; /* Length of this header */
-+ __u16 cpt_image_version; /* Format of this file */
-+#define CPT_VERSION_8 0
-+#define CPT_VERSION_9 0x100
-+#define CPT_VERSION_16 0x200
-+ __u16 cpt_os_arch; /* Architecture */
-+#define CPT_OS_ARCH_I386 0
-+#define CPT_OS_ARCH_EMT64 1
-+#define CPT_OS_ARCH_IA64 2
-+ __u16 __cpt_pad1;
-+ __u32 cpt_ve_features; /* VE features */
-+ __u32 cpt_ve_features2; /* VE features */
-+ __u16 cpt_pagesize; /* Page size used by OS */
-+ __u16 cpt_hz; /* HZ used by OS */
-+ __u64 cpt_start_jiffies64; /* Jiffies */
-+ __u32 cpt_start_sec; /* Seconds */
-+ __u32 cpt_start_nsec; /* Nanoseconds */
-+ __u32 cpt_cpu_caps[4]; /* CPU capabilities */
-+ __u32 cpt_kernel_config[4]; /* Kernel config */
-+ __u64 cpt_iptables_mask; /* Used netfilter modules */
-+} __attribute__ ((aligned (8)));
-+
-+#define CPT_SIGNATURE0 0x79
-+#define CPT_SIGNATURE1 0x1c
-+#define CPT_SIGNATURE2 0x01
-+#define CPT_SIGNATURE3 0x63
-+
-+/* CPU capabilities */
-+#define CPT_CPU_X86_CMOV 0
-+#define CPT_CPU_X86_FXSR 1
-+#define CPT_CPU_X86_SSE 2
-+#define CPT_CPU_X86_SSE2 3
-+#define CPT_CPU_X86_MMX 4
-+#define CPT_CPU_X86_3DNOW 5
-+#define CPT_CPU_X86_3DNOW2 6
-+#define CPT_CPU_X86_SEP 7
-+#define CPT_CPU_X86_EMT64 8
-+#define CPT_CPU_X86_IA64 9
-+#define CPT_CPU_X86_SYSCALL 10
-+#define CPT_CPU_X86_SYSCALL32 11
-+#define CPT_CPU_X86_SEP32 12
-+
-+/* Unsupported features */
-+#define CPT_EXTERNAL_PROCESS 16
-+#define CPT_NAMESPACES 17
-+#define CPT_SCHEDULER_POLICY 18
-+#define CPT_PTRACED_FROM_VE0 19
-+#define CPT_UNSUPPORTED_FSTYPE 20
-+#define CPT_BIND_MOUNT 21
-+#define CPT_UNSUPPORTED_NETDEV 22
-+
-+/* This mask is used to determine whether VE
-+ has some unsupported features or not */
-+#define CPT_UNSUPPORTED_MASK 0xffff0000UL
-+
-+#define CPT_KERNEL_CONFIG_PAE 0
-+
-+struct cpt_section_hdr
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_section;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_align;
-+} __attribute__ ((aligned (8)));
-+
-+enum
-+{
-+ CPT_SECT_ERROR, /* Error section, content is string */
-+ CPT_SECT_VEINFO,
-+ CPT_SECT_FILES, /* Files. Content is array of file objects */
-+ CPT_SECT_TASKS,
-+ CPT_SECT_MM,
-+ CPT_SECT_FILES_STRUCT,
-+ CPT_SECT_FS,
-+ CPT_SECT_SIGHAND_STRUCT,
-+ CPT_SECT_TTY,
-+ CPT_SECT_SOCKET,
-+ CPT_SECT_NAMESPACE,
-+ CPT_SECT_SYSVSEM_UNDO,
-+ CPT_SECT_INODE, /* Inodes with i->i_nlink==0 and
-+ * deleted dentires with inodes not
-+ * referenced inside dumped process.
-+ */
-+ CPT_SECT_SYSV_SHM,
-+ CPT_SECT_SYSV_SEM,
-+ CPT_SECT_ORPHANS,
-+ CPT_SECT_NET_DEVICE,
-+ CPT_SECT_NET_IFADDR,
-+ CPT_SECT_NET_ROUTE,
-+ CPT_SECT_NET_IPTABLES,
-+ CPT_SECT_NET_CONNTRACK,
-+ CPT_SECT_NET_CONNTRACK_VE0,
-+ CPT_SECT_UTSNAME,
-+ CPT_SECT_TRAILER,
-+ CPT_SECT_UBC,
-+ CPT_SECT_SLM_SGREGS,
-+ CPT_SECT_SLM_REGOBJS,
-+/* Due to silly mistake we cannot index sections beyond this value */
-+#define CPT_SECT_MAX_INDEX (CPT_SECT_SLM_REGOBJS+1)
-+ CPT_SECT_EPOLL,
-+ CPT_SECT_VSYSCALL,
-+ CPT_SECT_MAX
-+};
-+
-+struct cpt_major_tail
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_lazypages;
-+ __u32 cpt_64bit;
-+ __u64 cpt_sections[CPT_SECT_MAX_INDEX];
-+ __u32 cpt_nsect;
-+ __u8 cpt_signature[4]; /* Magic number */
-+} __attribute__ ((aligned (8)));
-+
-+
-+/* Common object header. */
-+struct cpt_object_hdr
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+} __attribute__ ((aligned (8)));
-+
-+enum _cpt_content_type {
-+ CPT_CONTENT_VOID,
-+ CPT_CONTENT_ARRAY,
-+ CPT_CONTENT_DATA,
-+ CPT_CONTENT_NAME,
-+
-+ CPT_CONTENT_STACK,
-+ CPT_CONTENT_X86_FPUSTATE_OLD,
-+ CPT_CONTENT_X86_FPUSTATE,
-+ CPT_CONTENT_MM_CONTEXT,
-+ CPT_CONTENT_SEMARRAY,
-+ CPT_CONTENT_SEMUNDO,
-+ CPT_CONTENT_NLMARRAY,
-+ CPT_CONTENT_MAX
-+};
-+
-+/* CPT_OBJ_BITS: encode array of bytes */
-+struct cpt_obj_bits
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_size;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+/* CPT_OBJ_REF: a reference to another object */
-+struct cpt_obj_ref
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_pos;
-+} __attribute__ ((aligned (8)));
-+
-+/* CPT_OBJ_VEINFO: various ve specific data */
-+struct cpt_veinfo_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ /* ipc ctls */
-+ __u32 shm_ctl_max;
-+ __u32 shm_ctl_all;
-+ __u32 shm_ctl_mni;
-+ __u32 msg_ctl_max;
-+ __u32 msg_ctl_mni;
-+ __u32 msg_ctl_mnb;
-+ __u32 sem_ctl_arr[4];
-+
-+ /* start time */
-+ __u64 start_timespec_delta;
-+ __u64 start_jiffies_delta;
-+} __attribute__ ((aligned (8)));
-+
-+/* CPT_OBJ_FILE: one struct file */
-+struct cpt_file_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_flags;
-+ __u32 cpt_mode;
-+ __u64 cpt_pos;
-+ __u32 cpt_uid;
-+ __u32 cpt_gid;
-+
-+ __u32 cpt_i_mode;
-+ __u32 cpt_lflags;
-+#define CPT_DENTRY_DELETED 1
-+#define CPT_DENTRY_ROOT 2
-+#define CPT_DENTRY_CLONING 4
-+#define CPT_DENTRY_PROC 8
-+#define CPT_DENTRY_EPOLL 0x10
-+#define CPT_DENTRY_REPLACED 0x20
-+ __u64 cpt_inode;
-+ __u64 cpt_priv;
-+
-+ __u32 cpt_fown_fd;
-+ __u32 cpt_fown_pid;
-+ __u32 cpt_fown_uid;
-+ __u32 cpt_fown_euid;
-+ __u32 cpt_fown_signo;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+/* Followed by file name, encoded as CPT_OBJ_NAME */
-+
-+struct cpt_epoll_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_file;
-+} __attribute__ ((aligned (8)));
-+/* Followed by array of struct cpt_epoll_file */
-+
-+struct cpt_epoll_file_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_file;
-+ __u32 cpt_fd;
-+ __u32 cpt_events;
-+ __u64 cpt_data;
-+ __u32 cpt_revents;
-+ __u32 cpt_ready;
-+} __attribute__ ((aligned (8)));
-+
-+
-+/* CPT_OBJ_FILEDESC: one file descriptor */
-+struct cpt_fd_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_fd;
-+ __u32 cpt_flags;
-+#define CPT_FD_FLAG_CLOSEEXEC 1
-+ __u64 cpt_file;
-+} __attribute__ ((aligned (8)));
-+
-+/* CPT_OBJ_FILES: one files_struct */
-+struct cpt_files_struct_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_index;
-+ __u32 cpt_max_fds;
-+ __u32 cpt_next_fd;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+/* Followed by array of cpt_fd_image */
-+
-+/* CPT_OBJ_FS: one fs_struct */
-+struct cpt_fs_struct_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_umask;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+/* Followed by two/three CPT_OBJ_FILENAME for root, pwd and, optionally, altroot */
-+
-+/* CPT_OBJ_INODE: one struct inode */
-+struct cpt_inode_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_dev;
-+ __u64 cpt_ino;
-+ __u32 cpt_mode;
-+ __u32 cpt_nlink;
-+ __u32 cpt_uid;
-+ __u32 cpt_gid;
-+ __u64 cpt_rdev;
-+ __u64 cpt_size;
-+ __u64 cpt_blksize;
-+ __u64 cpt_atime;
-+ __u64 cpt_mtime;
-+ __u64 cpt_ctime;
-+ __u64 cpt_blocks;
-+ __u32 cpt_sb;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+/* CPT_OBJ_VFSMOUNT: one vfsmount */
-+struct cpt_vfsmount_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_mntflags;
-+#define CPT_MNT_BIND 0x80000000
-+#define CPT_MNT_EXT 0x40000000
-+ __u32 cpt_flags;
-+} __attribute__ ((aligned (8)));
-+
-+
-+struct cpt_flock_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_owner;
-+ __u32 cpt_pid;
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+ __u32 cpt_flags;
-+ __u32 cpt_type;
-+} __attribute__ ((aligned (8)));
-+
-+
-+struct cpt_tty_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_flags;
-+ __u32 cpt_link;
-+ __u32 cpt_index;
-+ __u32 cpt_drv_type;
-+ __u32 cpt_drv_subtype;
-+ __u32 cpt_drv_flags;
-+ __u8 cpt_packet;
-+ __u8 cpt_stopped;
-+ __u8 cpt_hw_stopped;
-+ __u8 cpt_flow_stopped;
-+
-+ __u32 cpt_canon_data;
-+ __u32 cpt_canon_head;
-+ __u32 cpt_canon_column;
-+ __u32 cpt_column;
-+ __u8 cpt_ctrl_status;
-+ __u8 cpt_erasing;
-+ __u8 cpt_lnext;
-+ __u8 cpt_icanon;
-+ __u8 cpt_raw;
-+ __u8 cpt_real_raw;
-+ __u8 cpt_closing;
-+ __u8 __cpt_pad1;
-+ __u16 cpt_minimum_to_wake;
-+ __u16 __cpt_pad2;
-+ __u32 cpt_pgrp;
-+ __u32 cpt_session;
-+ __u32 cpt_c_line;
-+ __u8 cpt_name[64];
-+ __u16 cpt_ws_row;
-+ __u16 cpt_ws_col;
-+ __u16 cpt_ws_prow;
-+ __u16 cpt_ws_pcol;
-+ __u8 cpt_c_cc[32];
-+ __u32 cpt_c_iflag;
-+ __u32 cpt_c_oflag;
-+ __u32 cpt_c_cflag;
-+ __u32 cpt_c_lflag;
-+ __u32 cpt_read_flags[4096/32];
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_sock_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_file;
-+ __u32 cpt_parent;
-+ __u32 cpt_index;
-+
-+ __u64 cpt_ssflags;
-+ __u16 cpt_type;
-+ __u16 cpt_family;
-+ __u8 cpt_sstate;
-+ __u8 cpt_passcred;
-+ __u8 cpt_state;
-+ __u8 cpt_reuse;
-+
-+ __u8 cpt_zapped;
-+ __u8 cpt_shutdown;
-+ __u8 cpt_userlocks;
-+ __u8 cpt_no_check;
-+ __u8 cpt_debug;
-+ __u8 cpt_rcvtstamp;
-+ __u8 cpt_localroute;
-+ __u8 cpt_protocol;
-+
-+ __u32 cpt_err;
-+ __u32 cpt_err_soft;
-+
-+ __u16 cpt_max_ack_backlog;
-+ __u16 __cpt_pad1;
-+ __u32 cpt_priority;
-+
-+ __u32 cpt_rcvlowat;
-+ __u32 cpt_bound_dev_if;
-+
-+ __u64 cpt_rcvtimeo;
-+ __u64 cpt_sndtimeo;
-+ __u32 cpt_rcvbuf;
-+ __u32 cpt_sndbuf;
-+ __u64 cpt_flags;
-+ __u64 cpt_lingertime;
-+ __u32 cpt_peer_pid;
-+ __u32 cpt_peer_uid;
-+
-+ __u32 cpt_peer_gid;
-+ __u32 cpt_laddrlen;
-+ __u32 cpt_laddr[128/4];
-+ __u32 cpt_raddrlen;
-+ __u32 cpt_raddr[128/4];
-+ /* AF_UNIX */
-+ __u32 cpt_peer;
-+
-+ __u8 cpt_socketpair;
-+ __u8 cpt_deleted;
-+ __u16 __cpt_pad4;
-+ __u32 __cpt_pad5;
-+/*
-+ struct sk_filter *sk_filter;
-+ */
-+
-+ __u64 cpt_stamp;
-+ __u32 cpt_daddr;
-+ __u16 cpt_dport;
-+ __u16 cpt_sport;
-+
-+ __u32 cpt_saddr;
-+ __u32 cpt_rcv_saddr;
-+
-+ __u32 cpt_uc_ttl;
-+ __u32 cpt_tos;
-+
-+ __u32 cpt_cmsg_flags;
-+ __u32 cpt_mc_index;
-+
-+ __u32 cpt_mc_addr;
-+/*
-+ struct ip_options *opt;
-+ */
-+ __u8 cpt_hdrincl;
-+ __u8 cpt_mc_ttl;
-+ __u8 cpt_mc_loop;
-+ __u8 cpt_pmtudisc;
-+
-+ __u8 cpt_recverr;
-+ __u8 cpt_freebind;
-+ __u16 cpt_idcounter;
-+ __u32 cpt_cork_flags;
-+
-+ __u32 cpt_cork_fragsize;
-+ __u32 cpt_cork_length;
-+ __u32 cpt_cork_addr;
-+ __u32 cpt_cork_saddr;
-+ __u32 cpt_cork_daddr;
-+ __u32 cpt_cork_oif;
-+
-+ __u32 cpt_udp_pending;
-+ __u32 cpt_udp_corkflag;
-+ __u16 cpt_udp_encap;
-+ __u16 cpt_udp_len;
-+ __u32 __cpt_pad7;
-+
-+ __u64 cpt_saddr6[2];
-+ __u64 cpt_rcv_saddr6[2];
-+ __u64 cpt_daddr6[2];
-+ __u32 cpt_flow_label6;
-+ __u32 cpt_frag_size6;
-+ __u32 cpt_hop_limit6;
-+ __u32 cpt_mcast_hops6;
-+
-+ __u32 cpt_mcast_oif6;
-+ __u8 cpt_rxopt6;
-+ __u8 cpt_mc_loop6;
-+ __u8 cpt_recverr6;
-+ __u8 cpt_sndflow6;
-+
-+ __u8 cpt_pmtudisc6;
-+ __u8 cpt_ipv6only6;
-+ __u8 cpt_mapped;
-+ __u8 __cpt_pad8;
-+ __u32 cpt_pred_flags;
-+
-+ __u32 cpt_rcv_nxt;
-+ __u32 cpt_snd_nxt;
-+
-+ __u32 cpt_snd_una;
-+ __u32 cpt_snd_sml;
-+
-+ __u32 cpt_rcv_tstamp;
-+ __u32 cpt_lsndtime;
-+
-+ __u8 cpt_tcp_header_len;
-+ __u8 cpt_ack_pending;
-+ __u8 cpt_quick;
-+ __u8 cpt_pingpong;
-+ __u8 cpt_blocked;
-+ __u8 __cpt_pad9;
-+ __u16 __cpt_pad10;
-+
-+ __u32 cpt_ato;
-+ __u32 cpt_ack_timeout;
-+
-+ __u32 cpt_lrcvtime;
-+ __u16 cpt_last_seg_size;
-+ __u16 cpt_rcv_mss;
-+
-+ __u32 cpt_snd_wl1;
-+ __u32 cpt_snd_wnd;
-+
-+ __u32 cpt_max_window;
-+ __u32 cpt_pmtu_cookie;
-+
-+ __u32 cpt_mss_cache;
-+ __u16 cpt_mss_cache_std;
-+ __u16 cpt_mss_clamp;
-+
-+ __u16 cpt_ext_header_len;
-+ __u16 cpt_ext2_header_len;
-+ __u8 cpt_ca_state;
-+ __u8 cpt_retransmits;
-+ __u8 cpt_reordering;
-+ __u8 cpt_frto_counter;
-+
-+ __u32 cpt_frto_highmark;
-+ __u8 cpt_adv_cong;
-+ __u8 cpt_defer_accept;
-+ __u8 cpt_backoff;
-+ __u8 __cpt_pad11;
-+
-+ __u32 cpt_srtt;
-+ __u32 cpt_mdev;
-+
-+ __u32 cpt_mdev_max;
-+ __u32 cpt_rttvar;
-+
-+ __u32 cpt_rtt_seq;
-+ __u32 cpt_rto;
-+
-+ __u32 cpt_packets_out;
-+ __u32 cpt_left_out;
-+
-+ __u32 cpt_retrans_out;
-+ __u32 cpt_snd_ssthresh;
-+
-+ __u32 cpt_snd_cwnd;
-+ __u16 cpt_snd_cwnd_cnt;
-+ __u16 cpt_snd_cwnd_clamp;
-+
-+ __u32 cpt_snd_cwnd_used;
-+ __u32 cpt_snd_cwnd_stamp;
-+
-+ __u32 cpt_timeout;
-+ __u32 cpt_ka_timeout;
-+
-+ __u32 cpt_rcv_wnd;
-+ __u32 cpt_rcv_wup;
-+
-+ __u32 cpt_write_seq;
-+ __u32 cpt_pushed_seq;
-+
-+ __u32 cpt_copied_seq;
-+ __u8 cpt_tstamp_ok;
-+ __u8 cpt_wscale_ok;
-+ __u8 cpt_sack_ok;
-+ __u8 cpt_saw_tstamp;
-+
-+ __u8 cpt_snd_wscale;
-+ __u8 cpt_rcv_wscale;
-+ __u8 cpt_nonagle;
-+ __u8 cpt_keepalive_probes;
-+ __u32 cpt_rcv_tsval;
-+
-+ __u32 cpt_rcv_tsecr;
-+ __u32 cpt_ts_recent;
-+
-+ __u64 cpt_ts_recent_stamp;
-+ __u16 cpt_user_mss;
-+ __u8 cpt_dsack;
-+ __u8 cpt_eff_sacks;
-+ __u32 cpt_sack_array[2*5];
-+ __u32 cpt_window_clamp;
-+
-+ __u32 cpt_rcv_ssthresh;
-+ __u8 cpt_probes_out;
-+ __u8 cpt_num_sacks;
-+ __u16 cpt_advmss;
-+
-+ __u8 cpt_syn_retries;
-+ __u8 cpt_ecn_flags;
-+ __u16 cpt_prior_ssthresh;
-+ __u32 cpt_lost_out;
-+
-+ __u32 cpt_sacked_out;
-+ __u32 cpt_fackets_out;
-+
-+ __u32 cpt_high_seq;
-+ __u32 cpt_retrans_stamp;
-+
-+ __u32 cpt_undo_marker;
-+ __u32 cpt_undo_retrans;
-+
-+ __u32 cpt_urg_seq;
-+ __u16 cpt_urg_data;
-+ __u8 cpt_pending;
-+ __u8 cpt_urg_mode;
-+
-+ __u32 cpt_snd_up;
-+ __u32 cpt_keepalive_time;
-+
-+ __u32 cpt_keepalive_intvl;
-+ __u32 cpt_linger2;
-+
-+ __u32 cpt_rcvrtt_rtt;
-+ __u32 cpt_rcvrtt_seq;
-+
-+ __u32 cpt_rcvrtt_time;
-+ __u32 __cpt_pad12;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_sockmc_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u16 cpt_family;
-+ __u16 cpt_mode;
-+ __u32 cpt_ifindex;
-+ __u32 cpt_mcaddr[4];
-+} __attribute__ ((aligned (8)));
-+/* Followed by array of source addresses, each zero padded to 16 bytes */
-+
-+struct cpt_openreq_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_rcv_isn;
-+ __u32 cpt_snt_isn;
-+
-+ __u16 cpt_rmt_port;
-+ __u16 cpt_mss;
-+ __u8 cpt_family;
-+ __u8 cpt_retrans;
-+ __u8 cpt_snd_wscale;
-+ __u8 cpt_rcv_wscale;
-+
-+ __u8 cpt_tstamp_ok;
-+ __u8 cpt_sack_ok;
-+ __u8 cpt_wscale_ok;
-+ __u8 cpt_ecn_ok;
-+ __u8 cpt_acked;
-+ __u8 __cpt_pad1;
-+ __u16 __cpt_pad2;
-+
-+ __u32 cpt_window_clamp;
-+ __u32 cpt_rcv_wnd;
-+ __u32 cpt_ts_recent;
-+ __u32 cpt_iif;
-+ __u64 cpt_expires;
-+
-+ __u64 cpt_loc_addr[2];
-+ __u64 cpt_rmt_addr[2];
-+/*
-+ struct ip_options *opt;
-+ */
-+
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_skb_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_owner;
-+ __u32 cpt_queue;
-+#define CPT_SKB_NQ 0
-+#define CPT_SKB_RQ 1
-+#define CPT_SKB_WQ 2
-+#define CPT_SKB_OFOQ 3
-+
-+ __u64 cpt_stamp;
-+ __u32 cpt_len;
-+ __u32 cpt_hspace;
-+ __u32 cpt_tspace;
-+ __u32 cpt_h;
-+ __u32 cpt_nh;
-+ __u32 cpt_mac;
-+
-+ __u64 cpt_cb[5];
-+ __u32 cpt_mac_len;
-+ __u32 cpt_csum;
-+ __u8 cpt_local_df;
-+ __u8 cpt_pkt_type;
-+ __u8 cpt_ip_summed;
-+ __u8 __cpt_pad1;
-+ __u32 cpt_priority;
-+ __u16 cpt_protocol;
-+ __u16 cpt_security;
-+ __u16 cpt_tso_segs;
-+ __u16 cpt_tso_size;
-+} __attribute__ ((aligned (8)));
-+
-+
-+struct cpt_sysvshm_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_key;
-+ __u64 cpt_uid;
-+ __u64 cpt_gid;
-+ __u64 cpt_cuid;
-+ __u64 cpt_cgid;
-+ __u64 cpt_mode;
-+ __u64 cpt_seq;
-+
-+ __u32 cpt_id;
-+ __u32 cpt_mlockuser;
-+ __u64 cpt_segsz;
-+ __u64 cpt_atime;
-+ __u64 cpt_ctime;
-+ __u64 cpt_dtime;
-+ __u64 cpt_creator;
-+ __u64 cpt_last;
-+} __attribute__ ((aligned (8)));
-+
-+
-+struct cpt_sysvsem_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_key;
-+ __u64 cpt_uid;
-+ __u64 cpt_gid;
-+ __u64 cpt_cuid;
-+ __u64 cpt_cgid;
-+ __u64 cpt_mode;
-+ __u64 cpt_seq;
-+ __u32 cpt_id;
-+ __u32 __cpt_pad1;
-+
-+ __u64 cpt_otime;
-+ __u64 cpt_ctime;
-+} __attribute__ ((aligned (8)));
-+/* Content is array of pairs semval/sempid */
-+
-+struct cpt_sysvsem_undo_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_id;
-+ __u32 cpt_nsem;
-+} __attribute__ ((aligned (8)));
-+
-+
-+struct cpt_mm_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start_code;
-+ __u64 cpt_end_code;
-+ __u64 cpt_start_data;
-+ __u64 cpt_end_data;
-+ __u64 cpt_start_brk;
-+ __u64 cpt_brk;
-+ __u64 cpt_start_stack;
-+ __u64 cpt_start_arg;
-+ __u64 cpt_end_arg;
-+ __u64 cpt_start_env;
-+ __u64 cpt_end_env;
-+ __u64 cpt_def_flags;
-+ __u64 cpt_mmub;
-+ __u8 cpt_dumpable;
-+ __u8 cpt_vps_dumpable;
-+ __u8 cpt_used_hugetlb;
-+ __u8 __cpt_pad;
-+ __u32 cpt_vdso;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_page_block
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_remappage_block
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+ __u64 cpt_pgoff;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_copypage_block
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+ __u64 cpt_source;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_lazypage_block
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+ __u64 cpt_index;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_iterpage_block
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+} __attribute__ ((aligned (8)));
-+/* Followed by array of PFNs */
-+
-+struct cpt_vma_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_file;
-+ __u32 cpt_type;
-+#define CPT_VMA_TYPE_0 0
-+#define CPT_VMA_TYPE_SHM 1
-+#define CPT_VMA_VDSO 2
-+ __u32 cpt_anonvma;
-+ __u64 cpt_anonvmaid;
-+
-+ __u64 cpt_start;
-+ __u64 cpt_end;
-+ __u64 cpt_flags;
-+ __u64 cpt_pgprot;
-+ __u64 cpt_pgoff;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_aio_ctx_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_max_reqs;
-+ __u32 cpt_ring_pages;
-+ __u32 cpt_tail;
-+ __u32 cpt_nr;
-+ __u64 cpt_mmap_base;
-+ /* Data (io_event's) and struct aio_ring are stored in user space VM */
-+} __attribute__ ((aligned (8)));
-+
-+
-+/* Format of MM section.
-+ *
-+ * It is array of MM objects (mm_struct). Each MM object is
-+ * header, encoding mm_struct, followed by array of VMA objects.
-+ * Each VMA consists of VMA header, encoding vm_area_struct, and
-+ * if the VMA contains copied pages, the header is followed by
-+ * array of tuples start-end each followed by data.
-+ *
-+ * ATTN: no block/page alignment. Only 64bit alignment. This might be not good?
-+ */
-+
-+struct cpt_restart_block {
-+ __u64 fn;
-+#define CPT_RBL_0 0
-+#define CPT_RBL_NANOSLEEP 1
-+#define CPT_RBL_COMPAT_NANOSLEEP 2
-+ __u64 arg0;
-+ __u64 arg1;
-+ __u64 arg2;
-+ __u64 arg3;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_siginfo_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_qflags;
-+ __u32 cpt_signo;
-+ __u32 cpt_errno;
-+ __u32 cpt_code;
-+
-+ __u64 cpt_sigval;
-+ __u32 cpt_pid;
-+ __u32 cpt_uid;
-+ __u64 cpt_utime;
-+ __u64 cpt_stime;
-+
-+ __u64 cpt_user;
-+} __attribute__ ((aligned (8)));
-+
-+/* Portable presentaions for segment registers */
-+
-+#define CPT_SEG_ZERO 0
-+#define CPT_SEG_TLS1 1
-+#define CPT_SEG_TLS2 2
-+#define CPT_SEG_TLS3 3
-+#define CPT_SEG_USER32_DS 4
-+#define CPT_SEG_USER32_CS 5
-+#define CPT_SEG_USER64_DS 6
-+#define CPT_SEG_USER64_CS 7
-+#define CPT_SEG_LDT 256
-+
-+struct cpt_x86_regs
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_debugreg[8];
-+ __u32 cpt_fs;
-+ __u32 cpt_gs;
-+
-+ __u32 cpt_ebx;
-+ __u32 cpt_ecx;
-+ __u32 cpt_edx;
-+ __u32 cpt_esi;
-+ __u32 cpt_edi;
-+ __u32 cpt_ebp;
-+ __u32 cpt_eax;
-+ __u32 cpt_xds;
-+ __u32 cpt_xes;
-+ __u32 cpt_orig_eax;
-+ __u32 cpt_eip;
-+ __u32 cpt_xcs;
-+ __u32 cpt_eflags;
-+ __u32 cpt_esp;
-+ __u32 cpt_xss;
-+ __u32 cpt_pad;
-+};
-+
-+struct cpt_x86_64_regs
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_debugreg[8];
-+
-+ __u64 cpt_fsbase;
-+ __u64 cpt_gsbase;
-+ __u32 cpt_fsindex;
-+ __u32 cpt_gsindex;
-+ __u32 cpt_ds;
-+ __u32 cpt_es;
-+
-+ __u64 cpt_r15;
-+ __u64 cpt_r14;
-+ __u64 cpt_r13;
-+ __u64 cpt_r12;
-+ __u64 cpt_rbp;
-+ __u64 cpt_rbx;
-+ __u64 cpt_r11;
-+ __u64 cpt_r10;
-+ __u64 cpt_r9;
-+ __u64 cpt_r8;
-+ __u64 cpt_rax;
-+ __u64 cpt_rcx;
-+ __u64 cpt_rdx;
-+ __u64 cpt_rsi;
-+ __u64 cpt_rdi;
-+ __u64 cpt_orig_rax;
-+ __u64 cpt_rip;
-+ __u64 cpt_cs;
-+ __u64 cpt_eflags;
-+ __u64 cpt_rsp;
-+ __u64 cpt_ss;
-+};
-+
-+struct cpt_task_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_state;
-+ __u64 cpt_flags;
-+ __u64 cpt_ptrace;
-+ __u32 cpt_prio;
-+ __u32 cpt_static_prio;
-+ __u32 cpt_policy;
-+ __u32 cpt_rt_priority;
-+
-+ /* struct thread_info */
-+ __u64 cpt_exec_domain;
-+ __u64 cpt_thrflags;
-+ __u64 cpt_thrstatus;
-+ __u64 cpt_addr_limit;
-+
-+ __u64 cpt_personality;
-+
-+ __u64 cpt_mm;
-+ __u64 cpt_files;
-+ __u64 cpt_fs;
-+ __u64 cpt_signal;
-+ __u64 cpt_sighand;
-+ __u64 cpt_sigblocked;
-+ __u64 cpt_sigrblocked;
-+ __u64 cpt_sigpending;
-+ __u64 cpt_namespace;
-+ __u64 cpt_sysvsem_undo;
-+ __u32 cpt_pid;
-+ __u32 cpt_tgid;
-+ __u32 cpt_ppid;
-+ __u32 cpt_rppid;
-+ __u32 cpt_pgrp;
-+ __u32 cpt_session;
-+ __u32 cpt_old_pgrp;
-+ __u32 __cpt_pad;
-+ __u32 cpt_leader;
-+ __u8 cpt_pn_state;
-+ __u8 cpt_stopped_state;
-+ __u8 cpt_sigsuspend_state;
-+ __u8 cpt_64bit;
-+ __u64 cpt_set_tid;
-+ __u64 cpt_clear_tid;
-+ __u32 cpt_exit_code;
-+ __u32 cpt_exit_signal;
-+ __u32 cpt_pdeath_signal;
-+ __u32 cpt_user;
-+ __u32 cpt_uid;
-+ __u32 cpt_euid;
-+ __u32 cpt_suid;
-+ __u32 cpt_fsuid;
-+ __u32 cpt_gid;
-+ __u32 cpt_egid;
-+ __u32 cpt_sgid;
-+ __u32 cpt_fsgid;
-+ __u32 cpt_ngids;
-+ __u32 cpt_gids[32];
-+ __u32 __cpt_pad2;
-+ __u64 cpt_ecap;
-+ __u64 cpt_icap;
-+ __u64 cpt_pcap;
-+ __u8 cpt_comm[16];
-+ __u64 cpt_tls[3];
-+ struct cpt_restart_block cpt_restart;
-+ __u64 cpt_it_real_value; /* V8: jiffies, V9..: nsec */
-+ __u64 cpt_it_real_incr; /* V8: jiffies, V9..: nsec */
-+ __u64 cpt_it_prof_value;
-+ __u64 cpt_it_prof_incr;
-+ __u64 cpt_it_virt_value;
-+ __u64 cpt_it_virt_incr;
-+
-+ __u16 cpt_used_math;
-+ __u8 cpt_keepcap;
-+ __u8 cpt_did_exec;
-+ __u32 cpt_ptrace_message;
-+
-+ __u64 cpt_utime;
-+ __u64 cpt_stime;
-+ __u64 cpt_starttime; /* V8: jiffies, V9...: timespec */
-+ __u64 cpt_nvcsw;
-+ __u64 cpt_nivcsw;
-+ __u64 cpt_min_flt;
-+ __u64 cpt_maj_flt;
-+
-+ __u64 cpt_sigsuspend_blocked;
-+ __u64 cpt_cutime, cpt_cstime;
-+ __u64 cpt_cnvcsw, cpt_cnivcsw;
-+ __u64 cpt_cmin_flt, cpt_cmaj_flt;
-+
-+#define CPT_RLIM_NLIMITS 16
-+ __u64 cpt_rlim_cur[CPT_RLIM_NLIMITS];
-+ __u64 cpt_rlim_max[CPT_RLIM_NLIMITS];
-+
-+ __u64 cpt_task_ub;
-+ __u64 cpt_exec_ub;
-+ __u64 cpt_mm_ub;
-+ __u64 cpt_fork_sub;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_sigaltstack_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_stack;
-+ __u32 cpt_stacksize;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_signal_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_leader;
-+ __u8 cpt_pgrp_type;
-+ __u8 cpt_old_pgrp_type;
-+ __u8 cpt_session_type;
-+#define CPT_PGRP_NORMAL 0
-+#define CPT_PGRP_ORPHAN 1
-+#define CPT_PGRP_STRAY 2
-+ __u8 __cpt_pad1;
-+ __u64 cpt_pgrp;
-+ __u64 cpt_old_pgrp;
-+ __u64 cpt_session;
-+ __u64 cpt_sigpending;
-+ __u64 cpt_ctty;
-+
-+ __u32 cpt_curr_target;
-+ __u32 cpt_group_exit;
-+ __u32 cpt_group_exit_code;
-+ __u32 cpt_group_exit_task;
-+ __u32 cpt_notify_count;
-+ __u32 cpt_group_stop_count;
-+ __u32 cpt_stop_state;
-+ __u32 __cpt_pad2;
-+
-+ __u64 cpt_utime, cpt_stime, cpt_cutime, cpt_cstime;
-+ __u64 cpt_nvcsw, cpt_nivcsw, cpt_cnvcsw, cpt_cnivcsw;
-+ __u64 cpt_min_flt, cpt_maj_flt, cpt_cmin_flt, cpt_cmaj_flt;
-+
-+ __u64 cpt_rlim_cur[CPT_RLIM_NLIMITS];
-+ __u64 cpt_rlim_max[CPT_RLIM_NLIMITS];
-+} __attribute__ ((aligned (8)));
-+/* Followed by list of posix timers. */
-+
-+struct cpt_sighand_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+} __attribute__ ((aligned (8)));
-+/* Followed by list of sighandles. */
-+
-+struct cpt_sighandler_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_signo;
-+ __u32 __cpt_pad1;
-+ __u64 cpt_handler;
-+ __u64 cpt_restorer;
-+ __u64 cpt_flags;
-+ __u64 cpt_mask;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_netdev_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_index;
-+ __u32 cpt_flags;
-+ __u8 cpt_name[16];
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_ifaddr_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_index;
-+ __u8 cpt_family;
-+ __u8 cpt_masklen;
-+ __u8 cpt_flags;
-+ __u8 cpt_scope;
-+ __u32 cpt_address[4];
-+ __u32 cpt_peer[4];
-+ __u32 cpt_broadcast[4];
-+ __u8 cpt_label[16];
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_ipct_tuple
-+{
-+ __u32 cpt_src;
-+ __u16 cpt_srcport;
-+ __u16 __cpt_pad1;
-+
-+ __u32 cpt_dst;
-+ __u16 cpt_dstport;
-+ __u16 cpt_protonum;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_nat_manip
-+{
-+ __u8 cpt_direction;
-+ __u8 cpt_hooknum;
-+ __u8 cpt_maniptype;
-+ __u8 __cpt_pad1;
-+
-+ __u32 cpt_manip_addr;
-+ __u16 cpt_manip_port;
-+ __u16 __cpt_pad2;
-+ __u32 __cpt_pad3;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_nat_seq
-+{
-+ __u32 cpt_correction_pos;
-+ __u32 cpt_offset_before;
-+ __u32 cpt_offset_after;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_ip_connexpect_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_timeout;
-+ __u32 cpt_sibling_conntrack; /* Index of child conntrack */
-+ __u32 cpt_seq;
-+
-+ struct cpt_ipct_tuple cpt_ct_tuple;
-+ struct cpt_ipct_tuple cpt_tuple;
-+ struct cpt_ipct_tuple cpt_mask;
-+
-+ /* union ip_conntrack_expect_help. Used by ftp, irc, amanda */
-+ __u32 cpt_help[3];
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_ip_conntrack_image
-+{
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ struct cpt_ipct_tuple cpt_tuple[2];
-+ __u64 cpt_status;
-+ __u64 cpt_timeout;
-+ __u32 cpt_index;
-+ __u8 cpt_ct_helper;
-+ __u8 cpt_nat_helper;
-+ __u16 cpt_pad1;
-+
-+ /* union ip_conntrack_proto. Used by tcp and icmp. */
-+ __u32 cpt_proto_data[2];
-+
-+ /* union ip_conntrack_help. Used only by ftp helper. */
-+ __u32 cpt_help_data[4];
-+
-+ /* nat info */
-+ __u32 cpt_initialized;
-+ __u32 cpt_num_manips;
-+ struct cpt_nat_manip cpt_nat_manips[6];
-+
-+ struct cpt_nat_seq cpt_nat_seq[2];
-+
-+ __u32 cpt_masq_index;
-+ __u32 __cpt_pad2;
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_beancounter_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u64 cpt_parent;
-+ __u32 cpt_id;
-+ __u32 __cpt_pad;
-+ __u64 cpt_parms[32 * 6 * 2];
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_slm_sgreg_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_size;
-+ __u32 __cpt_pad1;
-+ __u32 cpt_id;
-+ __u16 cpt_resource;
-+ __u8 cpt_regname[32];
-+} __attribute__ ((aligned (8)));
-+
-+struct cpt_slm_obj_image {
-+ __u64 cpt_next;
-+ __u32 cpt_object;
-+ __u16 cpt_hdrlen;
-+ __u16 cpt_content;
-+
-+ __u32 cpt_size;
-+ __u32 __cpt_pad1;
-+} __attribute__ ((aligned (8)));
-+
-+
-+#ifdef __KERNEL__
-+#include <linux/signal.h>
-+#include <linux/time.h>
-+
-+static inline void *cpt_ptr_import(__u64 ptr)
-+{
-+ return (void*)(unsigned long)ptr;
-+}
-+
-+static inline __u64 cpt_ptr_export(void __user *ptr)
-+{
-+ return (__u64)(unsigned long)ptr;
-+}
-+
-+static inline void cpt_sigset_import(sigset_t *sig, __u64 ptr)
-+{
-+ memcpy(sig, &ptr, sizeof(*sig));
-+}
-+
-+static inline __u64 cpt_sigset_export(sigset_t *sig)
-+{
-+ return *(__u64*)sig;
-+}
-+
-+static inline __u64 cpt_timespec_export(struct timespec *tv)
-+{
-+ return (((u64)tv->tv_sec) << 32) + tv->tv_nsec;
-+}
-+
-+static inline void cpt_timespec_import(struct timespec *tv, __u64 val)
-+{
-+ tv->tv_sec = val>>32;
-+ tv->tv_nsec = (val&0xFFFFFFFF);
-+}
-+
-+static inline __u64 cpt_timeval_export(struct timeval *tv)
-+{
-+ return (((u64)tv->tv_sec) << 32) + tv->tv_usec;
-+}
-+
-+static inline void cpt_timeval_import(struct timeval *tv, __u64 val)
-+{
-+ tv->tv_sec = val>>32;
-+ tv->tv_usec = (val&0xFFFFFFFF);
-+}
-+
-+#endif
-+
-+#endif /* __CPT_IMAGE_H_ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/cpt_ioctl.h linux-2.6.9-ve023stab030/include/linux/cpt_ioctl.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/cpt_ioctl.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/cpt_ioctl.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,32 @@
-+#ifndef _CPT_IOCTL_H_
-+#define _CPT_IOCTL_H_ 1
-+
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+
-+#define CPTCTLTYPE '-'
-+#define CPT_SET_DUMPFD _IOW(CPTCTLTYPE, 1, int)
-+#define CPT_SET_STATUSFD _IOW(CPTCTLTYPE, 2, int)
-+#define CPT_SET_LOCKFD _IOW(CPTCTLTYPE, 3, int)
-+#define CPT_SET_VEID _IOW(CPTCTLTYPE, 4, int)
-+#define CPT_SUSPEND _IO(CPTCTLTYPE, 5)
-+#define CPT_DUMP _IO(CPTCTLTYPE, 6)
-+#define CPT_UNDUMP _IO(CPTCTLTYPE, 7)
-+#define CPT_RESUME _IO(CPTCTLTYPE, 8)
-+#define CPT_KILL _IO(CPTCTLTYPE, 9)
-+#define CPT_JOIN_CONTEXT _IO(CPTCTLTYPE, 10)
-+#define CPT_GET_CONTEXT _IOW(CPTCTLTYPE, 11, unsigned int)
-+#define CPT_PUT_CONTEXT _IO(CPTCTLTYPE, 12)
-+#define CPT_SET_PAGEINFDIN _IOW(CPTCTLTYPE, 13, int)
-+#define CPT_SET_PAGEINFDOUT _IOW(CPTCTLTYPE, 14, int)
-+#define CPT_PAGEIND _IO(CPTCTLTYPE, 15)
-+#define CPT_VMPREP _IOW(CPTCTLTYPE, 16, int)
-+#define CPT_SET_LAZY _IOW(CPTCTLTYPE, 17, int)
-+#define CPT_SET_CPU_FLAGS _IOW(CPTCTLTYPE, 18, unsigned int)
-+#define CPT_TEST_CAPS _IOW(CPTCTLTYPE, 19, unsigned int)
-+#define CPT_TEST_VECAPS _IOW(CPTCTLTYPE, 20, unsigned int)
-+#define CPT_SET_ERRORFD _IOW(CPTCTLTYPE, 21, int)
-+
-+#define CPT_ITER _IOW(CPTCTLTYPE, 23, int)
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/dcache.h linux-2.6.9-ve023stab030/include/linux/dcache.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/dcache.h 2006-10-11 18:29:42.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/dcache.h 2006-10-11 19:07:57.000000000 +0400
-@@ -80,6 +80,8 @@ struct dcookie_struct;
-
- #define DNAME_INLINE_LEN_MIN 36
-
-+#include <ub/ub_dcache.h>
-+
- struct dentry {
- atomic_t d_count;
- unsigned int d_flags; /* protected by d_lock */
-@@ -95,6 +97,7 @@ struct dentry {
- struct qstr d_name;
-
- struct list_head d_lru; /* LRU list */
-+ struct list_head d_sb_lru; /* per-sb LRU list */
- struct list_head d_child; /* child of parent list */
- struct list_head d_subdirs; /* our children */
- struct list_head d_alias; /* inode alias list */
-@@ -107,9 +110,15 @@ struct dentry {
- struct dcookie_struct *d_cookie; /* cookie, if any */
- struct hlist_node d_hash; /* lookup hash list */
- int d_mounted;
-+ /* It can't be at the end because of DNAME_INLINE_LEN */
-+ struct dentry_beancounter dentry_bc;
- unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
- };
-
-+#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
-+
-+#define dentry_bc(__d) (&(__d)->dentry_bc)
-+
- struct dentry_operations {
- int (*d_revalidate)(struct dentry *, struct nameidata *);
- int (*d_hash) (struct dentry *, struct qstr *);
-@@ -157,6 +166,9 @@ d_iput: no no no yes
-
- #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
- #define DCACHE_UNHASHED 0x0010
-+#define DCACHE_VIRTUAL 0x0100 /* ve accessible */
-+
-+extern void mark_tree_virtual(struct vfsmount *m, struct dentry *d);
-
- extern spinlock_t dcache_lock;
-
-@@ -164,17 +176,16 @@ extern spinlock_t dcache_lock;
- * d_drop - drop a dentry
- * @dentry: dentry to drop
- *
-- * d_drop() unhashes the entry from the parent
-- * dentry hashes, so that it won't be found through
-- * a VFS lookup any more. Note that this is different
-- * from deleting the dentry - d_delete will try to
-- * mark the dentry negative if possible, giving a
-- * successful _negative_ lookup, while d_drop will
-+ * d_drop() unhashes the entry from the parent dentry hashes, so that it won't
-+ * be found through a VFS lookup any more. Note that this is different from
-+ * deleting the dentry - d_delete will try to mark the dentry negative if
-+ * possible, giving a successful _negative_ lookup, while d_drop will
- * just make the cache lookup fail.
- *
-- * d_drop() is used mainly for stuff that wants
-- * to invalidate a dentry for some reason (NFS
-- * timeouts or autofs deletes).
-+ * d_drop() is used mainly for stuff that wants to invalidate a dentry for some
-+ * reason (NFS timeouts or autofs deletes).
-+ *
-+ * __d_drop requires dentry->d_lock.
- */
-
- static inline void __d_drop(struct dentry *dentry)
-@@ -188,7 +199,9 @@ static inline void __d_drop(struct dentr
- static inline void d_drop(struct dentry *dentry)
- {
- spin_lock(&dcache_lock);
-+ spin_lock(&dentry->d_lock);
- __d_drop(dentry);
-+ spin_unlock(&dentry->d_lock);
- spin_unlock(&dcache_lock);
- }
-
-@@ -259,6 +272,7 @@ char * __d_path( struct dentry *dentry,
- struct dentry *root, struct vfsmount *rootmnt,
- char *buffer, int buflen);
-
-+extern int d_root_check(struct dentry *, struct vfsmount *);
- extern char * d_path(struct dentry *, struct vfsmount *, char *, int);
-
- /* Allocation counts.. */
-@@ -279,6 +293,13 @@ extern char * d_path(struct dentry *, st
- static inline struct dentry *dget(struct dentry *dentry)
- {
- if (dentry) {
-+#ifdef CONFIG_USER_RESOURCE
-+ preempt_disable();
-+ if (ub_dentry_on &&
-+ atomic_inc_and_test(&dentry_bc(dentry)->d_inuse))
-+ BUG();
-+ preempt_enable_no_resched();
-+#endif
- BUG_ON(!atomic_read(&dentry->d_count));
- atomic_inc(&dentry->d_count);
- }
-@@ -321,6 +342,8 @@ extern struct dentry *lookup_create(stru
-
- extern int sysctl_vfs_cache_pressure;
-
-+extern int check_area_access_ve(struct dentry *, struct vfsmount *);
-+extern int check_area_execute_ve(struct dentry *, struct vfsmount *);
- #endif /* __KERNEL__ */
-
- #endif /* __LINUX_DCACHE_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/devpts_fs.h linux-2.6.9-ve023stab030/include/linux/devpts_fs.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/devpts_fs.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/devpts_fs.h 2006-10-11 19:07:57.000000000 +0400
-@@ -21,6 +21,13 @@ int devpts_pty_new(struct tty_struct *tt
- struct tty_struct *devpts_get_tty(int number); /* get tty structure */
- void devpts_pty_kill(int number); /* unlink */
-
-+struct devpts_config {
-+ int setuid;
-+ int setgid;
-+ uid_t uid;
-+ gid_t gid;
-+ umode_t mode;
-+};
- #else
-
- /* Dummy stubs in the no-pty case */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/elfcore.h linux-2.6.9-ve023stab030/include/linux/elfcore.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/elfcore.h 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/elfcore.h 2006-10-11 19:07:58.000000000 +0400
-@@ -6,6 +6,8 @@
- #include <linux/time.h>
- #include <linux/user.h>
-
-+extern int sysctl_at_vsyscall;
-+
- struct elf_siginfo
- {
- int si_signo; /* signal number */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/eventpoll.h linux-2.6.9-ve023stab030/include/linux/eventpoll.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/eventpoll.h 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/eventpoll.h 2006-10-11 19:07:59.000000000 +0400
-@@ -85,6 +85,87 @@ static inline void eventpoll_release(str
- eventpoll_release_file(file);
- }
-
-+struct epoll_filefd {
-+ struct file *file;
-+ int fd;
-+};
-+
-+/*
-+ * This structure is stored inside the "private_data" member of the file
-+ * structure and rapresent the main data sructure for the eventpoll
-+ * interface.
-+ */
-+struct eventpoll {
-+ /* Protect the this structure access */
-+ rwlock_t lock;
-+
-+ /*
-+ * This semaphore is used to ensure that files are not removed
-+ * while epoll is using them. This is read-held during the event
-+ * collection loop and it is write-held during the file cleanup
-+ * path, the epoll file exit code and the ctl operations.
-+ */
-+ struct rw_semaphore sem;
-+
-+ /* Wait queue used by sys_epoll_wait() */
-+ wait_queue_head_t wq;
-+
-+ /* Wait queue used by file->poll() */
-+ wait_queue_head_t poll_wait;
-+
-+ /* List of ready file descriptors */
-+ struct list_head rdllist;
-+
-+ /* RB-Tree root used to store monitored fd structs */
-+ struct rb_root rbr;
-+};
-+
-+/*
-+ * Each file descriptor added to the eventpoll interface will
-+ * have an entry of this type linked to the hash.
-+ */
-+struct epitem {
-+ /* RB-Tree node used to link this structure to the eventpoll rb-tree */
-+ struct rb_node rbn;
-+
-+ /* List header used to link this structure to the eventpoll ready list */
-+ struct list_head rdllink;
-+
-+ /* The file descriptor information this item refers to */
-+ struct epoll_filefd ffd;
-+
-+ /* Number of active wait queue attached to poll operations */
-+ int nwait;
-+
-+ /* List containing poll wait queues */
-+ struct list_head pwqlist;
-+
-+ /* The "container" of this item */
-+ struct eventpoll *ep;
-+
-+ /* The structure that describe the interested events and the source fd */
-+ struct epoll_event event;
-+
-+ /*
-+ * Used to keep track of the usage count of the structure. This avoids
-+ * that the structure will desappear from underneath our processing.
-+ */
-+ atomic_t usecnt;
-+
-+ /* List header used to link this item to the "struct file" items list */
-+ struct list_head fllink;
-+
-+ /* List header used to link the item to the transfer list */
-+ struct list_head txlink;
-+
-+ /*
-+ * This is used during the collection/transfer of events to userspace
-+ * to pin items empty events set.
-+ */
-+ unsigned int revents;
-+};
-+
-+extern struct semaphore epsem;
-
- #else
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/fairsched.h linux-2.6.9-ve023stab030/include/linux/fairsched.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/fairsched.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/fairsched.h 2006-10-11 19:08:01.000000000 +0400
-@@ -0,0 +1,121 @@
-+#ifndef __LINUX_FAIRSCHED_H__
-+#define __LINUX_FAIRSCHED_H__
-+
-+/*
-+ * Fair Scheduler
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/cache.h>
-+#include <linux/cpumask.h>
-+#include <asm/timex.h>
-+
-+#define FAIRSCHED_HAS_CPU_BINDING 0
-+
-+typedef struct { cycles_t t; } fschtag_t;
-+typedef struct { unsigned long d; } fschdur_t;
-+typedef struct { cycles_t v; } fschvalue_t;
-+
-+struct vcpu_scheduler;
-+
-+struct fairsched_node {
-+ struct list_head runlist;
-+
-+ /*
-+ * Fair Scheduler fields
-+ *
-+ * nr_running >= nr_ready (!= if delayed)
-+ */
-+ fschtag_t start_tag;
-+ int nr_ready;
-+ int nr_runnable;
-+ int nr_pcpu;
-+ int vcpus;
-+
-+ /*
-+ * Rate limitator fields
-+ */
-+ cycles_t last_updated_at;
-+ fschvalue_t value; /* leaky function value */
-+ cycles_t delay; /* removed from schedule till */
-+ unsigned char delayed;
-+
-+ /*
-+ * Configuration
-+ *
-+ * Read-only most of the time.
-+ */
-+ unsigned weight ____cacheline_aligned_in_smp;
-+ /* fairness weight */
-+ unsigned char rate_limited;
-+ unsigned rate; /* max CPU share */
-+ fschtag_t max_latency;
-+ unsigned min_weight;
-+
-+ struct list_head nodelist;
-+ int id;
-+#ifdef CONFIG_VE
-+ struct ve_struct *owner_env;
-+#endif
-+ struct vcpu_scheduler *vsched;
-+};
-+
-+#ifdef CONFIG_FAIRSCHED
-+
-+#define FSCHWEIGHT_MAX ((1 << 16) - 1)
-+#define FSCHRATE_SHIFT 10
-+
-+/*
-+ * Fairsched nodes used in boot process.
-+ */
-+extern struct fairsched_node fairsched_init_node;
-+extern struct fairsched_node fairsched_idle_node;
-+
-+/*
-+ * For proc output.
-+ */
-+extern unsigned fairsched_nr_cpus;
-+extern void fairsched_cpu_online_map(int id, cpumask_t *mask);
-+
-+/* I hope vsched_id is always equal to fairsched node id --SAW */
-+#define task_fairsched_node_id(p) task_vsched_id(p)
-+
-+/*
-+ * Core functions.
-+ */
-+extern void fairsched_incrun(struct fairsched_node *node);
-+extern void fairsched_decrun(struct fairsched_node *node);
-+extern void fairsched_inccpu(struct fairsched_node *node);
-+extern void fairsched_deccpu(struct fairsched_node *node);
-+extern struct fairsched_node *fairsched_schedule(
-+ struct fairsched_node *prev_node,
-+ struct fairsched_node *cur_node,
-+ int cur_node_active,
-+ cycles_t time);
-+
-+/*
-+ * Management functions.
-+ */
-+void fairsched_init_early(void);
-+asmlinkage int sys_fairsched_mknod(unsigned int parent, unsigned int weight,
-+ unsigned int newid);
-+asmlinkage int sys_fairsched_rmnod(unsigned int id);
-+asmlinkage int sys_fairsched_mvpr(pid_t pid, unsigned int nodeid);
-+asmlinkage int sys_fairsched_vcpus(unsigned int id, unsigned int vcpus);
-+
-+#else /* CONFIG_FAIRSCHED */
-+
-+#define task_fairsched_node_id(p) 0
-+#define fairsched_incrun(p) do { } while (0)
-+#define fairsched_decrun(p) do { } while (0)
-+#define fairsched_deccpu(p) do { } while (0)
-+#define fairsched_cpu_online_map(id, mask) do { *(mask) = cpu_online_map; } while (0)
-+
-+#endif /* CONFIG_FAIRSCHED */
-+
-+#endif /* __LINUX_FAIRSCHED_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/faudit.h linux-2.6.9-ve023stab030/include/linux/faudit.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/faudit.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/faudit.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,51 @@
-+/*
-+ * include/linux/faudit.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __FAUDIT_H_
-+#define __FAUDIT_H_
-+
-+#include <linux/config.h>
-+#include <linux/virtinfo.h>
-+
-+struct vfsmount;
-+struct dentry;
-+struct super_block;
-+struct kstatfs;
-+struct kstat;
-+struct pt_regs;
-+
-+struct faudit_regs_arg {
-+ int err;
-+ struct pt_regs *regs;
-+};
-+
-+struct faudit_stat_arg {
-+ int err;
-+ struct vfsmount *mnt;
-+ struct dentry *dentry;
-+ struct kstat *stat;
-+};
-+
-+struct faudit_statfs_arg {
-+ int err;
-+ struct super_block *sb;
-+ struct kstatfs *stat;
-+};
-+
-+#define VIRTINFO_FAUDIT (0)
-+#define VIRTINFO_FAUDIT_EXIT (VIRTINFO_FAUDIT + 0)
-+#define VIRTINFO_FAUDIT_FORK (VIRTINFO_FAUDIT + 1)
-+#define VIRTINFO_FAUDIT_CLONE (VIRTINFO_FAUDIT + 2)
-+#define VIRTINFO_FAUDIT_VFORK (VIRTINFO_FAUDIT + 3)
-+#define VIRTINFO_FAUDIT_EXECVE (VIRTINFO_FAUDIT + 4)
-+#define VIRTINFO_FAUDIT_STAT (VIRTINFO_FAUDIT + 5)
-+#define VIRTINFO_FAUDIT_STATFS (VIRTINFO_FAUDIT + 6)
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/fb.h linux-2.6.9-ve023stab030/include/linux/fb.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/fb.h 2004-10-19 01:53:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/fb.h 2006-10-11 19:07:55.000000000 +0400
-@@ -748,7 +748,6 @@ extern void fb_destroy_modedb(struct fb_
-
- /* drivers/video/modedb.c */
- #define VESA_MODEDB_SIZE 34
--extern const struct fb_videomode vesa_modes[];
- extern void fb_var_to_videomode(struct fb_videomode *mode,
- struct fb_var_screeninfo *var);
- extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
-@@ -798,6 +797,8 @@ struct fb_modelist {
- struct fb_videomode mode;
- };
-
-+extern const struct fb_videomode vesa_modes[];
-+
- extern int fb_find_mode(struct fb_var_screeninfo *var,
- struct fb_info *info, const char *mode_option,
- const struct fb_videomode *db,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/fs.h linux-2.6.9-ve023stab030/include/linux/fs.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/fs.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/fs.h 2006-10-11 19:07:58.000000000 +0400
-@@ -7,6 +7,7 @@
- */
-
- #include <linux/config.h>
-+#include <linux/ve_owner.h>
- #include <linux/linkage.h>
- #include <linux/limits.h>
- #include <linux/wait.h>
-@@ -80,6 +81,7 @@ extern int leases_enable, dir_notify_ena
- #define FMODE_LSEEK 4
- #define FMODE_PREAD 8
- #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
-+#define FMODE_QUOTACTL 4
-
- #define RW_MASK 1
- #define RWA_MASK 2
-@@ -98,6 +100,7 @@ extern int leases_enable, dir_notify_ena
- /* public flags for file_system_type */
- #define FS_REQUIRES_DEV 1
- #define FS_BINARY_MOUNTDATA 2
-+#define FS_VIRTUALIZED 64 /* Can mount this fstype inside ve */
- #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
- #define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon
- * as nfs_rename() will be cleaned up
-@@ -294,6 +297,9 @@ struct iattr {
- * Includes for diskquotas.
- */
- #include <linux/quota.h>
-+#if defined(CONFIG_VZ_QUOTA) || defined(CONFIG_VZ_QUOTA_MODULE)
-+#include <linux/vzquota_qlnk.h>
-+#endif
-
- /*
- * oh the beauties of C type declarations.
-@@ -421,6 +427,7 @@ static inline int mapping_writably_mappe
- struct inode {
- struct hlist_node i_hash;
- struct list_head i_list;
-+ struct list_head i_sb_list;
- struct list_head i_dentry;
- unsigned long i_ino;
- atomic_t i_count;
-@@ -451,6 +458,9 @@ struct inode {
- #ifdef CONFIG_QUOTA
- struct dquot *i_dquot[MAXQUOTAS];
- #endif
-+#if defined(CONFIG_VZ_QUOTA) || defined(CONFIG_VZ_QUOTA_MODULE)
-+ struct vz_quota_ilink i_qlnk;
-+#endif
- /* These three should probably be a union */
- struct list_head i_devices;
- struct pipe_inode_info *i_pipe;
-@@ -539,6 +549,12 @@ static inline unsigned imajor(struct ino
-
- extern struct block_device *I_BDEV(struct inode *inode);
-
-+struct exec_perm {
-+ umode_t mode;
-+ uid_t uid, gid;
-+ int set;
-+};
-+
- struct fown_struct {
- rwlock_t lock; /* protects pid, uid, euid fields */
- int pid; /* pid or -pgrp where SIGIO should be sent */
-@@ -577,6 +593,7 @@ struct file {
- struct fown_struct f_owner;
- unsigned int f_uid, f_gid;
- struct file_ra_state f_ra;
-+ struct user_beancounter *f_ub;
-
- unsigned long f_version;
- void *f_security;
-@@ -590,7 +607,10 @@ struct file {
- spinlock_t f_ep_lock;
- #endif /* #ifdef CONFIG_EPOLL */
- struct address_space *f_mapping;
-+ struct ve_struct *owner_env;
- };
-+DCL_VE_OWNER_PROTO(FILP, GENERIC, struct file, owner_env,
-+ inline, (always_inline))
- extern spinlock_t files_lock;
- #define file_list_lock() spin_lock(&files_lock);
- #define file_list_unlock() spin_unlock(&files_lock);
-@@ -649,6 +669,7 @@ struct file_lock {
- struct file *fl_file;
- unsigned char fl_flags;
- unsigned char fl_type;
-+ unsigned char fl_charged;
- loff_t fl_start;
- loff_t fl_end;
-
-@@ -763,9 +784,11 @@ struct super_block {
- void *s_security;
- struct xattr_handler **s_xattr;
-
-+ struct list_head s_inodes; /* all inodes */
- struct list_head s_dirty; /* dirty inodes */
- struct list_head s_io; /* parked for writeback */
- struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
-+ struct list_head s_dentry_unused;
- struct list_head s_files;
-
- struct block_device *s_bdev;
-@@ -960,7 +983,8 @@ struct inode_operations {
- int (*follow_link) (struct dentry *, struct nameidata *);
- void (*put_link) (struct dentry *, struct nameidata *);
- void (*truncate) (struct inode *);
-- int (*permission) (struct inode *, int, struct nameidata *);
-+ int (*permission) (struct inode *, int, struct nameidata *,
-+ struct exec_perm *);
- int (*setattr) (struct dentry *, struct iattr *);
- int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
- int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
-@@ -1004,6 +1028,8 @@ struct super_operations {
- void (*umount_begin) (struct super_block *);
-
- int (*show_options)(struct seq_file *, struct vfsmount *);
-+
-+ struct inode *(*get_quota_root)(struct super_block *);
- };
-
- /* Inode state bits. Protected by inode_lock. */
-@@ -1156,8 +1182,15 @@ struct file_system_type {
- struct module *owner;
- struct file_system_type * next;
- struct list_head fs_supers;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(FSTYPE, MODULE_NOCHECK, struct file_system_type, owner_env
-+ , , ())
-+
-+void get_filesystem(struct file_system_type *fs);
-+void put_filesystem(struct file_system_type *fs);
-+
- struct super_block *get_sb_bdev(struct file_system_type *fs_type,
- int flags, const char *dev_name, void *data,
- int (*fill_super)(struct super_block *, void *, int));
-@@ -1195,8 +1228,11 @@ extern struct vfsmount *kern_mount(struc
- extern int may_umount_tree(struct vfsmount *);
- extern int may_umount(struct vfsmount *);
- extern long do_mount(char *, char *, char *, unsigned long, void *);
-+extern void umount_tree(struct vfsmount *);
-+#define kern_umount mntput
-
- extern int vfs_statfs(struct super_block *, struct kstatfs *);
-+extern int faudit_statfs(struct super_block *, struct kstatfs *);
-
- /* Return value for VFS lock functions - tells locks.c to lock conventionally
- * REALLY kosha for root NFS and nfs_lock
-@@ -1315,7 +1351,7 @@ extern void chrdev_show(struct seq_file
- #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
- extern const char *__bdevname(dev_t, char *buffer);
- extern const char *bdevname(struct block_device *bdev, char *buffer);
--extern struct block_device *lookup_bdev(const char *);
-+extern struct block_device *lookup_bdev(const char *, int mode);
- extern struct block_device *open_bdev_excl(const char *, int, void *);
- extern void close_bdev_excl(struct block_device *);
- extern void blkdev_show(struct seq_file *,off_t);
-@@ -1346,7 +1382,7 @@ extern int fs_may_remount_ro(struct supe
- #define bio_data_dir(bio) ((bio)->bi_rw & 1)
-
- extern int check_disk_change(struct block_device *);
--extern int invalidate_inodes(struct super_block *);
-+extern int invalidate_inodes(struct super_block *, int);
- extern int __invalidate_device(struct block_device *, int);
- extern int invalidate_partition(struct gendisk *, int);
- unsigned long invalidate_mapping_pages(struct address_space *mapping,
-@@ -1374,8 +1410,9 @@ extern int do_remount_sb(struct super_bl
- extern sector_t bmap(struct inode *, sector_t);
- extern int setattr_mask(unsigned int);
- extern int notify_change(struct dentry *, struct iattr *);
--extern int permission(struct inode *, int, struct nameidata *);
--extern int vfs_permission(struct inode *, int);
-+extern int permission(struct inode *, int, struct nameidata *,
-+ struct exec_perm *);
-+extern int vfs_permission(struct inode *, int, struct exec_perm *);
- extern int get_write_access(struct inode *);
- extern int deny_write_access(struct file *);
- static inline void put_write_access(struct inode * inode)
-@@ -1392,8 +1429,9 @@ extern int do_pipe(int *);
- extern int open_namei(const char *, int, int, struct nameidata *);
- extern int may_open(struct nameidata *, int, int);
-
-+struct linux_binprm;
- extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
--extern struct file * open_exec(const char *);
-+extern struct file * open_exec(const char *, struct linux_binprm *);
-
- /* fs/dcache.c -- generic fs support functions */
- extern int is_subdir(struct dentry *, struct dentry *);
-@@ -1566,7 +1604,7 @@ extern int vfs_follow_link(struct nameid
- extern int page_readlink(struct dentry *, char __user *, int);
- extern int page_follow_link_light(struct dentry *, struct nameidata *);
- extern void page_put_link(struct dentry *, struct nameidata *);
--extern int page_symlink(struct inode *inode, const char *symname, int len);
-+extern int page_symlink(struct inode *inode, const char *symname, int len, int gfp_mask);
- extern struct inode_operations page_symlink_inode_operations;
- extern int generic_readlink(struct dentry *, char __user *, int);
- extern void generic_fillattr(struct inode *, struct kstat *);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/gfp.h linux-2.6.9-ve023stab030/include/linux/gfp.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/gfp.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/gfp.h 2006-10-11 19:07:56.000000000 +0400
-@@ -38,19 +38,25 @@ struct vm_area_struct;
- #define __GFP_NO_GROW 0x2000 /* Slab internal usage */
- #define __GFP_COMP 0x4000 /* Add compound page metadata */
-
--#define __GFP_BITS_SHIFT 16 /* Room for 16 __GFP_FOO bits */
-+#define __GFP_UBC 0x10000 /* charge kmem in buddy and slab */
-+#define __GFP_SOFT_UBC 0x20000 /* use soft charging */
-+
-+#define __GFP_BITS_SHIFT 18 /* Room for 18 __GFP_FOO bits */
- #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
-
- /* if you forget to add the bitmask here kernel will crash, period */
- #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
- __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
-- __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP)
-+ __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
-+ __GFP_UBC|__GFP_SOFT_UBC)
-
- #define GFP_ATOMIC (__GFP_HIGH | __GFP_NOWARN)
- #define GFP_NOIO (__GFP_WAIT)
- #define GFP_NOFS (__GFP_WAIT | __GFP_IO)
- #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
-+#define GFP_KERNEL_UBC (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_UBC)
- #define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS)
-+#define GFP_USER_UBC (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_UBC)
- #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM)
-
- /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/inetdevice.h linux-2.6.9-ve023stab030/include/linux/inetdevice.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/inetdevice.h 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/inetdevice.h 2006-10-11 19:07:57.000000000 +0400
-@@ -30,6 +30,11 @@ struct ipv4_devconf
- };
-
- extern struct ipv4_devconf ipv4_devconf;
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_ipv4_devconf (*(get_exec_env()->_ipv4_devconf))
-+#else
-+#define ve_ipv4_devconf ipv4_devconf
-+#endif
-
- struct in_device
- {
-@@ -56,28 +61,28 @@ struct in_device
- };
-
- #define IN_DEV_FORWARD(in_dev) ((in_dev)->cnf.forwarding)
--#define IN_DEV_MFORWARD(in_dev) (ipv4_devconf.mc_forwarding && (in_dev)->cnf.mc_forwarding)
--#define IN_DEV_RPFILTER(in_dev) (ipv4_devconf.rp_filter && (in_dev)->cnf.rp_filter)
--#define IN_DEV_SOURCE_ROUTE(in_dev) (ipv4_devconf.accept_source_route && (in_dev)->cnf.accept_source_route)
--#define IN_DEV_BOOTP_RELAY(in_dev) (ipv4_devconf.bootp_relay && (in_dev)->cnf.bootp_relay)
--
--#define IN_DEV_LOG_MARTIANS(in_dev) (ipv4_devconf.log_martians || (in_dev)->cnf.log_martians)
--#define IN_DEV_PROXY_ARP(in_dev) (ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp)
--#define IN_DEV_SHARED_MEDIA(in_dev) (ipv4_devconf.shared_media || (in_dev)->cnf.shared_media)
--#define IN_DEV_TX_REDIRECTS(in_dev) (ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects)
--#define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
-+#define IN_DEV_MFORWARD(in_dev) (ve_ipv4_devconf.mc_forwarding && (in_dev)->cnf.mc_forwarding)
-+#define IN_DEV_RPFILTER(in_dev) (ve_ipv4_devconf.rp_filter && (in_dev)->cnf.rp_filter)
-+#define IN_DEV_SOURCE_ROUTE(in_dev) (ve_ipv4_devconf.accept_source_route && (in_dev)->cnf.accept_source_route)
-+#define IN_DEV_BOOTP_RELAY(in_dev) (ve_ipv4_devconf.bootp_relay && (in_dev)->cnf.bootp_relay)
-+
-+#define IN_DEV_LOG_MARTIANS(in_dev) (ve_ipv4_devconf.log_martians || (in_dev)->cnf.log_martians)
-+#define IN_DEV_PROXY_ARP(in_dev) (ve_ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp)
-+#define IN_DEV_SHARED_MEDIA(in_dev) (ve_ipv4_devconf.shared_media || (in_dev)->cnf.shared_media)
-+#define IN_DEV_TX_REDIRECTS(in_dev) (ve_ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects)
-+#define IN_DEV_SEC_REDIRECTS(in_dev) (ve_ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
- #define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag)
- #define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id)
-
- #define IN_DEV_RX_REDIRECTS(in_dev) \
- ((IN_DEV_FORWARD(in_dev) && \
-- (ipv4_devconf.accept_redirects && (in_dev)->cnf.accept_redirects)) \
-+ (ve_ipv4_devconf.accept_redirects && (in_dev)->cnf.accept_redirects)) \
- || (!IN_DEV_FORWARD(in_dev) && \
-- (ipv4_devconf.accept_redirects || (in_dev)->cnf.accept_redirects)))
-+ (ve_ipv4_devconf.accept_redirects || (in_dev)->cnf.accept_redirects)))
-
--#define IN_DEV_ARPFILTER(in_dev) (ipv4_devconf.arp_filter || (in_dev)->cnf.arp_filter)
--#define IN_DEV_ARP_ANNOUNCE(in_dev) (max(ipv4_devconf.arp_announce, (in_dev)->cnf.arp_announce))
--#define IN_DEV_ARP_IGNORE(in_dev) (max(ipv4_devconf.arp_ignore, (in_dev)->cnf.arp_ignore))
-+#define IN_DEV_ARPFILTER(in_dev) (ve_ipv4_devconf.arp_filter || (in_dev)->cnf.arp_filter)
-+#define IN_DEV_ARP_ANNOUNCE(in_dev) (max(ve_ipv4_devconf.arp_announce, (in_dev)->cnf.arp_announce))
-+#define IN_DEV_ARP_IGNORE(in_dev) (max(ve_ipv4_devconf.arp_ignore, (in_dev)->cnf.arp_ignore))
-
- struct in_ifaddr
- {
-@@ -108,6 +113,7 @@ extern u32 inet_select_addr(const struc
- extern u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope);
- extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask);
- extern void inet_forward_change(void);
-+extern void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, int destroy);
-
- static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa)
- {
-@@ -175,6 +181,10 @@ static inline void in_dev_put(struct in_
- #define __in_dev_put(idev) atomic_dec(&(idev)->refcnt)
- #define in_dev_hold(idev) atomic_inc(&(idev)->refcnt)
-
-+struct ve_struct;
-+extern int devinet_sysctl_init(struct ve_struct *);
-+extern void devinet_sysctl_fini(struct ve_struct *);
-+extern void devinet_sysctl_free(struct ve_struct *);
- #endif /* __KERNEL__ */
-
- static __inline__ __u32 inet_make_mask(int logmask)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/initrd.h linux-2.6.9-ve023stab030/include/linux/initrd.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/initrd.h 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/initrd.h 2006-10-11 19:07:55.000000000 +0400
-@@ -14,7 +14,7 @@ extern int rd_image_start;
- extern int initrd_below_start_ok;
-
- /* free_initrd_mem always gets called with the next two as arguments.. */
--extern unsigned long initrd_start, initrd_end;
-+extern unsigned long initrd_start, initrd_end, initrd_copy;
- extern void free_initrd_mem(unsigned long, unsigned long);
-
- extern unsigned int real_root_dev;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/irq.h linux-2.6.9-ve023stab030/include/linux/irq.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/irq.h 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/irq.h 2006-10-11 19:07:55.000000000 +0400
-@@ -77,4 +77,6 @@ extern hw_irq_controller no_irq_type; /
-
- #endif
-
-+void check_stack_overflow(void);
-+
- #endif /* __irq_h */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/jbd.h linux-2.6.9-ve023stab030/include/linux/jbd.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/jbd.h 2006-10-11 18:29:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/jbd.h 2006-10-11 19:07:55.000000000 +0400
-@@ -242,6 +242,21 @@ typedef struct journal_superblock_s
- #include <asm/bug.h>
-
- #define JBD_ASSERTIONS
-+#define JBD_SOFT_ASSERTIONS
-+#ifdef JBD_SOFT_ASSERTIONS
-+#define J_BUG() \
-+do { \
-+ unsigned long stack; \
-+ printk("Stack=%p current=%p pid=%d ve=%d process='%s'\n", \
-+ &stack, current, current->pid, \
-+ get_exec_env()->veid, \
-+ current->comm); \
-+ dump_stack(); \
-+} while(0)
-+#else
-+#define J_BUG() BUG()
-+#endif
-+
- #ifdef JBD_ASSERTIONS
- #define J_ASSERT(assert) \
- do { \
-@@ -249,7 +264,7 @@ do { \
- printk (KERN_EMERG \
- "Assertion failure in %s() at %s:%d: \"%s\"\n", \
- __FUNCTION__, __FILE__, __LINE__, # assert); \
-- BUG(); \
-+ J_BUG(); \
- } \
- } while (0)
-
-@@ -828,6 +843,12 @@ struct journal_s
- struct jbd_revoke_table_s *j_revoke_table[2];
-
- /*
-+ * array of bhs for journal_commit_transaction
-+ */
-+ struct buffer_head **j_wbuf;
-+ int j_wbufsize;
-+
-+ /*
- * An opaque pointer to fs-private information. ext3 puts its
- * superblock pointer here
- */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/jiffies.h linux-2.6.9-ve023stab030/include/linux/jiffies.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/jiffies.h 2004-10-19 01:53:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/jiffies.h 2006-10-11 19:07:56.000000000 +0400
-@@ -15,6 +15,7 @@
- */
- extern u64 jiffies_64;
- extern unsigned long volatile jiffies;
-+extern unsigned long cycles_per_jiffy, cycles_per_clock;
-
- #if (BITS_PER_LONG < 64)
- u64 get_jiffies_64(void);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/kdev_t.h linux-2.6.9-ve023stab030/include/linux/kdev_t.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/kdev_t.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/kdev_t.h 2006-10-11 19:07:57.000000000 +0400
-@@ -87,6 +87,57 @@ static inline unsigned sysv_minor(u32 de
- return dev & 0x3ffff;
- }
-
-+#define UNNAMED_MAJOR_COUNT 16
-+
-+#if UNNAMED_MAJOR_COUNT > 1
-+
-+extern int unnamed_dev_majors[UNNAMED_MAJOR_COUNT];
-+
-+static inline dev_t make_unnamed_dev(int idx)
-+{
-+ /*
-+ * Here we transfer bits from 8 to 8+log2(UNNAMED_MAJOR_COUNT) of the
-+ * unnamed device index into major number.
-+ */
-+ return MKDEV(unnamed_dev_majors[(idx >> 8) & (UNNAMED_MAJOR_COUNT - 1)],
-+ idx & ~((UNNAMED_MAJOR_COUNT - 1) << 8));
-+}
-+
-+static inline int unnamed_dev_idx(dev_t dev)
-+{
-+ int i;
-+ for (i = 0; i < UNNAMED_MAJOR_COUNT &&
-+ MAJOR(dev) != unnamed_dev_majors[i]; i++);
-+ return MINOR(dev) | (i << 8);
-+}
-+
-+static inline int is_unnamed_dev(dev_t dev)
-+{
-+ int i;
-+ for (i = 0; i < UNNAMED_MAJOR_COUNT &&
-+ MAJOR(dev) != unnamed_dev_majors[i]; i++);
-+ return i < UNNAMED_MAJOR_COUNT;
-+}
-+
-+#else /* UNNAMED_MAJOR_COUNT */
-+
-+static inline dev_t make_unnamed_dev(int idx)
-+{
-+ return MKDEV(0, idx);
-+}
-+
-+static inline int unnamed_dev_idx(dev_t dev)
-+{
-+ return MINOR(dev);
-+}
-+
-+static inline int is_unnamed_dev(dev_t dev)
-+{
-+ return MAJOR(dev) == 0;
-+}
-+
-+#endif /* UNNAMED_MAJOR_COUNT */
-+
-
- #else /* __KERNEL__ */
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/kernel.h linux-2.6.9-ve023stab030/include/linux/kernel.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/kernel.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/kernel.h 2006-10-11 19:08:00.000000000 +0400
-@@ -107,10 +107,18 @@ extern int __kernel_text_address(unsigne
- extern int kernel_text_address(unsigned long addr);
- extern int session_of_pgrp(int pgrp);
-
--asmlinkage int vprintk(const char *fmt, va_list args);
-+asmlinkage int vprintk(const char *fmt, va_list args)
-+ __attribute__ ((format (printf, 1, 0)));
- asmlinkage int printk(const char * fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
-
-+#define VE0_LOG 1
-+#define VE_LOG 2
-+#define VE_LOG_BOTH (VE0_LOG | VE_LOG)
-+asmlinkage int ve_printk(int, const char * fmt, ...)
-+ __attribute__ ((format (printf, 2, 3)));
-+void prepare_printk(void);
-+
- unsigned long int_sqrt(unsigned long);
-
- static inline int __attribute_pure__ long_log2(unsigned long x)
-@@ -129,9 +137,14 @@ static inline unsigned long __attribute_
- extern int printk_ratelimit(void);
- extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
-
-+extern int console_silence_loglevel;
-+
- static inline void console_silent(void)
- {
-- console_loglevel = 0;
-+ if (console_loglevel > console_silence_loglevel) {
-+ printk("console shuts up ...\n");
-+ console_loglevel = 0;
-+ }
- }
-
- static inline void console_verbose(void)
-@@ -141,12 +154,16 @@ static inline void console_verbose(void)
- }
-
- extern void bust_spinlocks(int yes);
-+extern void wake_up_klogd(void);
- extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
- extern int panic_on_oops;
- extern int panic_on_unrecovered_nmi;
-+extern int decode_call_traces;
- extern int tainted;
-+extern int kernel_text_csum_broken;
- extern const char *print_tainted(void);
- extern void add_taint(unsigned);
-+extern int alloc_fail_warn;
-
- #define crashdump_mode() unlikely(netdump_mode || diskdump_mode)
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/kmem_cache.h linux-2.6.9-ve023stab030/include/linux/kmem_cache.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/kmem_cache.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/kmem_cache.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,196 @@
-+#ifndef __KMEM_CACHE_H__
-+#define __KMEM_CACHE_H__
-+
-+#include <linux/config.h>
-+#include <linux/threads.h>
-+#include <linux/smp.h>
-+#include <linux/spinlock.h>
-+#include <linux/list.h>
-+#include <linux/mm.h>
-+#include <asm/atomic.h>
-+
-+/*
-+ * SLAB_DEBUG - 1 for kmem_cache_create() to honour; SLAB_DEBUG_INITIAL,
-+ * SLAB_RED_ZONE & SLAB_POISON.
-+ * 0 for faster, smaller code (especially in the critical paths).
-+ *
-+ * SLAB_STATS - 1 to collect stats for /proc/slabinfo.
-+ * 0 for faster, smaller code (especially in the critical paths).
-+ *
-+ * SLAB_FORCED_DEBUG - 1 enables SLAB_RED_ZONE and SLAB_POISON (if possible)
-+ */
-+
-+#ifdef CONFIG_DEBUG_SLAB
-+#define SLAB_DEBUG 1
-+#define SLAB_STATS 1
-+#define SLAB_FORCED_DEBUG 1
-+#else
-+#define SLAB_DEBUG 0
-+#define SLAB_STATS 0
-+#define SLAB_FORCED_DEBUG 0
-+#endif
-+
-+/*
-+ * struct array_cache
-+ *
-+ * Per cpu structures
-+ * Purpose:
-+ * - LIFO ordering, to hand out cache-warm objects from _alloc
-+ * - reduce the number of linked list operations
-+ * - reduce spinlock operations
-+ *
-+ * The limit is stored in the per-cpu structure to reduce the data cache
-+ * footprint.
-+ *
-+ */
-+struct array_cache {
-+ unsigned int avail;
-+ unsigned int limit;
-+ unsigned int batchcount;
-+ unsigned int touched;
-+};
-+
-+/* bootstrap: The caches do not work without cpuarrays anymore,
-+ * but the cpuarrays are allocated from the generic caches...
-+ */
-+#define BOOT_CPUCACHE_ENTRIES 1
-+struct arraycache_init {
-+ struct array_cache cache;
-+ void * entries[BOOT_CPUCACHE_ENTRIES];
-+};
-+
-+/*
-+ * The slab lists of all objects.
-+ * Hopefully reduce the internal fragmentation
-+ * NUMA: The spinlock could be moved from the kmem_cache_t
-+ * into this structure, too. Figure out what causes
-+ * fewer cross-node spinlock operations.
-+ */
-+struct kmem_list3 {
-+ struct list_head slabs_partial; /* partial list first, better asm code */
-+ struct list_head slabs_full;
-+ struct list_head slabs_free;
-+ unsigned long free_objects;
-+ int free_touched;
-+ unsigned long next_reap;
-+ struct array_cache *shared;
-+};
-+
-+#define LIST3_INIT(parent) \
-+ { \
-+ .slabs_full = LIST_HEAD_INIT(parent.slabs_full), \
-+ .slabs_partial = LIST_HEAD_INIT(parent.slabs_partial), \
-+ .slabs_free = LIST_HEAD_INIT(parent.slabs_free) \
-+ }
-+#define list3_data(cachep) \
-+ (&(cachep)->lists)
-+
-+/* NUMA: per-node */
-+#define list3_data_ptr(cachep, ptr) \
-+ list3_data(cachep)
-+
-+/*
-+ * kmem_cache_t
-+ *
-+ * manages a cache.
-+ */
-+
-+struct kmem_cache_s {
-+/* 1) per-cpu data, touched during every alloc/free */
-+ struct array_cache *array[NR_CPUS];
-+ unsigned int batchcount;
-+ unsigned int limit;
-+/* 2) touched by every alloc & free from the backend */
-+ struct kmem_list3 lists;
-+ /* NUMA: kmem_3list_t *nodelists[MAX_NUMNODES] */
-+ unsigned int objsize;
-+ unsigned int flags; /* constant flags */
-+ unsigned int num; /* # of objs per slab */
-+ unsigned int free_limit; /* upper limit of objects in the lists */
-+ spinlock_t spinlock;
-+
-+/* 3) cache_grow/shrink */
-+ /* order of pgs per slab (2^n) */
-+ unsigned int gfporder;
-+
-+ /* force GFP flags, e.g. GFP_DMA */
-+ unsigned int gfpflags;
-+
-+ size_t colour; /* cache colouring range */
-+ unsigned int colour_off; /* colour offset */
-+ unsigned int colour_next; /* cache colouring */
-+ kmem_cache_t *slabp_cache;
-+ unsigned int slab_size;
-+ unsigned int dflags; /* dynamic flags */
-+
-+ /* constructor func */
-+ void (*ctor)(void *, kmem_cache_t *, unsigned long);
-+
-+ /* de-constructor func */
-+ void (*dtor)(void *, kmem_cache_t *, unsigned long);
-+
-+/* 4) cache creation/removal */
-+ const char *name;
-+ struct list_head next;
-+
-+/* 5) statistics */
-+ unsigned long grown;
-+ unsigned long reaped;
-+ unsigned long shrunk;
-+#if SLAB_STATS
-+ unsigned long num_active;
-+ unsigned long num_allocations;
-+ unsigned long high_mark;
-+ unsigned long errors;
-+ unsigned long max_freeable;
-+ atomic_t allochit;
-+ atomic_t allocmiss;
-+ atomic_t freehit;
-+ atomic_t freemiss;
-+#endif
-+#if SLAB_DEBUG
-+ int dbghead;
-+ int reallen;
-+#endif
-+#ifdef CONFIG_USER_RESOURCE
-+ unsigned int objuse;
-+#endif
-+};
-+
-+/* Macros for storing/retrieving the cachep and or slab from the
-+ * global 'mem_map'. These are used to find the slab an obj belongs to.
-+ * With kfree(), these are used to find the cache which an obj belongs to.
-+ */
-+#define SET_PAGE_CACHE(pg,x) ((pg)->lru.next = (struct list_head *)(x))
-+#define GET_PAGE_CACHE(pg) ((kmem_cache_t *)(pg)->lru.next)
-+#define SET_PAGE_SLAB(pg,x) ((pg)->lru.prev = (struct list_head *)(x))
-+#define GET_PAGE_SLAB(pg) ((struct slab *)(pg)->lru.prev)
-+
-+#define CFLGS_OFF_SLAB (0x80000000UL)
-+#define CFLGS_ENVIDS (0x04000000UL)
-+#define OFF_SLAB(x) ((x)->flags & CFLGS_OFF_SLAB)
-+#define ENVIDS(x) ((x)->flags & CFLGS_ENVIDS)
-+
-+static inline unsigned int kmem_cache_memusage(kmem_cache_t *cache)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ return cache->objuse;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+static inline unsigned int kmem_obj_memusage(void *obj)
-+{
-+ kmem_cache_t *cachep;
-+
-+ cachep = GET_PAGE_CACHE(virt_to_page(obj));
-+ return kmem_cache_memusage(cachep);
-+}
-+
-+static inline void kmem_mark_nocharge(kmem_cache_t *cachep)
-+{
-+ cachep->flags |= SLAB_NO_CHARGE;
-+}
-+
-+#endif /* __KMEM_CACHE_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/kmem_slab.h linux-2.6.9-ve023stab030/include/linux/kmem_slab.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/kmem_slab.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/kmem_slab.h 2006-10-11 19:07:55.000000000 +0400
-@@ -0,0 +1,69 @@
-+#ifndef __KMEM_SLAB_H__
-+#define __KMEM_SLAB_H__
-+
-+/*
-+ * kmem_bufctl_t:
-+ *
-+ * Bufctl's are used for linking objs within a slab
-+ * linked offsets.
-+ *
-+ * This implementation relies on "struct page" for locating the cache &
-+ * slab an object belongs to.
-+ * This allows the bufctl structure to be small (one int), but limits
-+ * the number of objects a slab (not a cache) can contain when off-slab
-+ * bufctls are used. The limit is the size of the largest general cache
-+ * that does not use off-slab slabs.
-+ * For 32bit archs with 4 kB pages, is this 56.
-+ * This is not serious, as it is only for large objects, when it is unwise
-+ * to have too many per slab.
-+ * Note: This limit can be raised by introducing a general cache whose size
-+ * is less than 512 (PAGE_SIZE<<3), but greater than 256.
-+ */
-+
-+#define BUFCTL_END (((kmem_bufctl_t)(~0U))-0)
-+#define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1)
-+#define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2)
-+
-+/*
-+ * struct slab
-+ *
-+ * Manages the objs in a slab. Placed either at the beginning of mem allocated
-+ * for a slab, or allocated from an general cache.
-+ * Slabs are chained into three list: fully used, partial, fully free slabs.
-+ */
-+struct slab {
-+ struct list_head list;
-+ unsigned long colouroff;
-+ void *s_mem; /* including colour offset */
-+ unsigned int inuse; /* num of objs active in slab */
-+ kmem_bufctl_t free;
-+};
-+
-+/*
-+ * struct slab_rcu
-+ *
-+ * slab_destroy on a SLAB_DESTROY_BY_RCU cache uses this structure to
-+ * arrange for kmem_freepages to be called via RCU. This is useful if
-+ * we need to approach a kernel structure obliquely, from its address
-+ * obtained without the usual locking. We can lock the structure to
-+ * stabilize it and check it's still at the given address, only if we
-+ * can be sure that the memory has not been meanwhile reused for some
-+ * other kind of object (which our subsystem's lock might corrupt).
-+ *
-+ * rcu_read_lock before reading the address, then rcu_read_unlock after
-+ * taking the spinlock within the structure expected at that address.
-+ *
-+ * We assume struct slab_rcu can overlay struct slab when destroying.
-+ */
-+struct slab_rcu {
-+ struct rcu_head head;
-+ kmem_cache_t *cachep;
-+ void *addr;
-+};
-+
-+static inline kmem_bufctl_t *slab_bufctl(struct slab *slabp)
-+{
-+ return (kmem_bufctl_t *)(slabp+1);
-+}
-+
-+#endif /* __KMEM_SLAB_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/list.h linux-2.6.9-ve023stab030/include/linux/list.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/list.h 2006-10-11 18:29:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/list.h 2006-10-11 19:07:57.000000000 +0400
-@@ -320,6 +320,12 @@ static inline void list_splice_init(stru
- #define list_entry(ptr, type, member) \
- container_of(ptr, type, member)
-
-+#define list_first_entry(ptr, type, member) \
-+ container_of((ptr)->next, type, member)
-+
-+#define list_first_entry(ptr, type, member) \
-+ container_of((ptr)->next, type, member)
-+
- /**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
-@@ -412,6 +418,20 @@ static inline void list_splice_init(stru
- prefetch(pos->member.next))
-
- /**
-+ * list_for_each_entry_continue_reverse - iterate backwards over list of given
-+ * type continuing after existing point
-+ * @pos: the type * to use as a loop counter.
-+ * @head: the head for your list.
-+ * @member: the name of the list_struct within the struct.
-+ */
-+#define list_for_each_entry_continue_reverse(pos, head, member) \
-+ for (pos = list_entry(pos->member.prev, typeof(*pos), member), \
-+ prefetch(pos->member.prev); \
-+ &pos->member != (head); \
-+ pos = list_entry(pos->member.prev, typeof(*pos), member), \
-+ prefetch(pos->member.prev))
-+
-+/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos: the type * to use as a loop counter.
- * @n: another type * to use as temporary storage
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/major.h linux-2.6.9-ve023stab030/include/linux/major.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/major.h 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/major.h 2006-10-11 19:07:57.000000000 +0400
-@@ -165,4 +165,7 @@
-
- #define VIOTAPE_MAJOR 230
-
-+#define UNNAMED_EXTRA_MAJOR 130
-+#define UNNAMED_EXTRA_MAJOR_COUNT 120
-+
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/mm.h linux-2.6.9-ve023stab030/include/linux/mm.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/mm.h 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/mm.h 2006-10-11 19:07:57.000000000 +0400
-@@ -110,6 +110,8 @@ struct vm_area_struct {
- #ifdef CONFIG_NUMA
- struct mempolicy *vm_policy; /* NUMA policy for the VMA */
- #endif
-+ /* rss counter by vma */
-+ unsigned long vm_rss;
- };
-
- /*
-@@ -200,6 +202,9 @@ typedef unsigned long page_flags_t;
- * moment. Note that we have no way to track which tasks are using
- * a page.
- */
-+struct user_beancounter;
-+struct page_beancounter;
-+
- struct page {
- page_flags_t flags; /* Atomic flags, some possibly
- * updated asynchronously */
-@@ -238,6 +243,10 @@ struct page {
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie. highmem) */
- #endif /* WANT_PAGE_VIRTUAL */
-+ union {
-+ struct user_beancounter *page_ub;
-+ struct page_beancounter *page_pbc;
-+ } bc;
- };
-
- /*
-@@ -528,10 +537,8 @@ struct page *shmem_nopage(struct vm_area
- int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new);
- struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
- unsigned long addr);
--int shmem_lock(struct file *file, int lock, struct user_struct *user);
- #else
- #define shmem_nopage filemap_nopage
--#define shmem_lock(a, b, c) ({0;}) /* always in memory, no need to lock */
- #define shmem_set_policy(a, b) (0)
- #define shmem_get_policy(a, b) (NULL)
- #endif
-@@ -770,6 +777,7 @@ extern struct vm_area_struct *find_exten
- extern struct page * vmalloc_to_page(void *addr);
- extern struct page * follow_page(struct mm_struct *mm, unsigned long address,
- int write);
-+extern struct page * follow_page_k(unsigned long address, int write);
- extern struct page * follow_page_pte(struct mm_struct *mm,
- unsigned long address, int write, pte_t *pte);
- extern int remap_page_range(struct vm_area_struct *vma, unsigned long from,
-@@ -808,5 +816,25 @@ extern struct vm_area_struct *get_gate_v
- int in_gate_area(struct task_struct *task, unsigned long addr);
- #endif
-
-+/*
-+ * Common MM functions for inclusion in the VFS
-+ * or in other stackable file systems. Some of these
-+ * functions were in linux/mm/ C files.
-+ *
-+ */
-+static inline int sync_page(struct page *page)
-+{
-+ struct address_space *mapping;
-+
-+ /*
-+ * FIXME, fercrissake. What is this barrier here for?
-+ */
-+ smp_mb();
-+ mapping = page_mapping(page);
-+ if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
-+ return mapping->a_ops->sync_page(page);
-+ return 0;
-+}
-+
- #endif /* __KERNEL__ */
- #endif /* _LINUX_MM_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/module.h linux-2.6.9-ve023stab030/include/linux/module.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/module.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/module.h 2006-10-11 19:07:58.000000000 +0400
-@@ -188,7 +188,7 @@ void *__symbol_get_gpl(const char *symbo
- __EXPORT_SYMBOL(sym, "")
-
- #define EXPORT_SYMBOL_GPL(sym) \
-- __EXPORT_SYMBOL(sym, "_gpl")
-+ __EXPORT_SYMBOL(sym, "")
-
- #endif
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/mount.h linux-2.6.9-ve023stab030/include/linux/mount.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/mount.h 2004-10-19 01:53:11.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/mount.h 2006-10-11 19:07:57.000000000 +0400
-@@ -63,7 +63,7 @@ static inline void mntput(struct vfsmoun
-
- extern void free_vfsmnt(struct vfsmount *mnt);
- extern struct vfsmount *alloc_vfsmnt(const char *name);
--extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
-+extern struct vfsmount *do_kern_mount(struct file_system_type *type, int flags,
- const char *name, void *data);
-
- struct nameidata;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/namei.h linux-2.6.9-ve023stab030/include/linux/namei.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/namei.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/namei.h 2006-10-11 19:07:57.000000000 +0400
-@@ -54,6 +54,8 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LA
- #define LOOKUP_OPEN (0x0100)
- #define LOOKUP_CREATE (0x0200)
- #define LOOKUP_ACCESS (0x0400)
-+#define LOOKUP_NOAREACHECK (0x1000) /* no area check on lookup */
-+#define LOOKUP_STRICT (0x2000) /* no symlinks or other filesystems */
-
- extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
- #define user_path_walk(name,nd) \
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netdevice.h linux-2.6.9-ve023stab030/include/linux/netdevice.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netdevice.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netdevice.h 2006-10-11 19:07:57.000000000 +0400
-@@ -37,6 +37,7 @@
- #include <linux/config.h>
- #include <linux/device.h>
- #include <linux/percpu.h>
-+#include <linux/ctype.h>
-
- struct divert_blk;
- struct vlan_group;
-@@ -252,6 +253,11 @@ struct netdev_boot_setup {
- };
- #define NETDEV_BOOT_SETUP_MAX 8
-
-+struct netdev_bc {
-+ struct user_beancounter *exec_ub, *owner_ub;
-+};
-+
-+#define netdev_bc(dev) (&(dev)->dev_bc)
-
- /*
- * The DEVICE structure.
-@@ -400,6 +406,7 @@ struct net_device
- enum { NETREG_UNINITIALIZED=0,
- NETREG_REGISTERING, /* called register_netdevice */
- NETREG_REGISTERED, /* completed register todo */
-+ NETREG_REGISTER_ERR, /* register todo failed */
- NETREG_UNREGISTERING, /* called unregister_netdevice */
- NETREG_UNREGISTERED, /* completed unregister todo */
- NETREG_RELEASED, /* called free_netdev */
-@@ -419,6 +426,8 @@ struct net_device
- #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
- #define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
- #define NETIF_F_LLTX 4096 /* LockLess TX */
-+#define NETIF_F_VIRTUAL 0x40000000 /* can be registered in ve */
-+#define NETIF_F_VENET 0x80000000 /* Device is VENET device */
-
- /* Called after device is detached from network. */
- void (*uninit)(struct net_device *dev);
-@@ -488,10 +497,16 @@ struct net_device
- struct divert_blk *divert;
- #endif /* CONFIG_NET_DIVERT */
-
-+ struct ve_struct *owner_env; /* Owner VE of the interface */
-+ struct netdev_bc dev_bc;
-+
- /* class/net/name entry */
- struct class_device class_dev;
- /* how much padding had been added by alloc_netdev() */
- int padded;
-+
-+ /* List entry in global devices list to keep track of their names assignment */
-+ struct list_head dev_global_list_entry;
- };
-
- /*
-@@ -543,8 +558,21 @@ struct packet_type {
-
- extern struct net_device loopback_dev; /* The loopback */
- extern struct net_device *dev_base; /* All devices */
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define visible_loopback_dev (*get_exec_env()->_loopback_dev)
-+#define dev_base (get_exec_env()->_net_dev_base)
-+#define visible_dev_head(x) (&(x)->_net_dev_head)
-+#define visible_dev_index_head(x) (&(x)->_net_dev_index_head)
-+#else
-+#define visible_loopback_dev loopback_dev
-+#define visible_dev_head(x) NULL
-+#define visible_dev_index_head(x) NULL
-+#endif
- extern rwlock_t dev_base_lock; /* Device list lock */
-
-+struct hlist_head *dev_name_hash(const char *name, struct ve_struct *env);
-+struct hlist_head *dev_index_hash(int ifindex, struct ve_struct *env);
-+
- extern int netdev_boot_setup_add(char *name, struct ifmap *map);
- extern int netdev_boot_setup_check(struct net_device *dev);
- extern unsigned long netdev_boot_base(const char *prefix, int unit);
-@@ -564,11 +592,14 @@ extern int dev_close(struct net_device
- extern int dev_queue_xmit(struct sk_buff *skb);
- extern int register_netdevice(struct net_device *dev);
- extern int unregister_netdevice(struct net_device *dev);
-+extern void netdevice_notify(int event, struct net_device *dev);
- extern void free_netdev(struct net_device *dev);
- extern void synchronize_net(void);
- extern int register_netdevice_notifier(struct notifier_block *nb);
- extern int unregister_netdevice_notifier(struct notifier_block *nb);
- extern int call_netdevice_notifiers(unsigned long val, void *v);
-+extern int dev_new_index(struct net_device *dev);
-+extern void dev_free_index(struct net_device *dev);
- extern struct net_device *dev_get_by_index(int ifindex);
- extern struct net_device *__dev_get_by_index(int ifindex);
- extern int dev_restart(struct net_device *dev);
-@@ -958,6 +989,18 @@ extern int skb_checksum_help(struct sk_b
- extern char *net_sysctl_strdup(const char *s);
- #endif
-
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static inline int ve_is_dev_movable(struct net_device *dev)
-+{
-+ return !(dev->features & NETIF_F_VIRTUAL);
-+}
-+#else
-+static inline int ve_is_dev_movable(struct net_device *dev)
-+{
-+ return 0;
-+}
-+#endif
-+
- #endif /* __KERNEL__ */
-
- #endif /* _LINUX_DEV_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter.h linux-2.6.9-ve023stab030/include/linux/netfilter.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter.h 2006-10-11 19:07:57.000000000 +0400
-@@ -25,6 +25,8 @@
- #define NFC_UNKNOWN 0x4000
- #define NFC_ALTERED 0x8000
-
-+#define NFC_IPT_MASK (0x00FFFFFF)
-+
- #ifdef __KERNEL__
- #include <linux/config.h>
- #ifdef CONFIG_NETFILTER
-@@ -93,6 +95,9 @@ struct nf_info
- int nf_register_hook(struct nf_hook_ops *reg);
- void nf_unregister_hook(struct nf_hook_ops *reg);
-
-+int visible_nf_register_hook(struct nf_hook_ops *reg);
-+int visible_nf_unregister_hook(struct nf_hook_ops *reg);
-+
- /* Functions to register get/setsockopt ranges (non-inclusive). You
- need to check permissions yourself! */
- int nf_register_sockopt(struct nf_sockopt_ops *reg);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack.h 2006-10-11 19:07:58.000000000 +0400
-@@ -166,6 +166,11 @@ struct ip_conntrack_counter
-
- struct ip_conntrack_helper;
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/ve.h>
-+#include <linux/ve_owner.h>
-+#endif
-+
- struct ip_conntrack
- {
- /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
-@@ -215,11 +220,21 @@ struct ip_conntrack
- /* Traversed often, so hopefully in different cacheline to top */
- /* These are my tuples; original and reply */
- struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *ct_owner_env;
-+#endif
- };
-
-+#ifdef CONFIG_VE_IPTABLES
-+DCL_VE_OWNER_PROTO(CT, , struct ip_conntrack, ct_owner_env, , )
-+#endif
-+
- /* get master conntrack via master expectation */
- #define master_ct(conntr) (conntr->master ? conntr->master->expectant : NULL)
-
-+/* add conntrack entry to hash tables */
-+extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
-+
- /* Alter reply tuple (maybe alter helper). If it's already taken,
- return 0 and don't do alteration. */
- extern int
-@@ -243,10 +258,17 @@ ip_conntrack_get(const struct sk_buff *s
- /* decrement reference count on a conntrack */
- extern inline void ip_conntrack_put(struct ip_conntrack *ct);
-
-+/* allocate conntrack structure */
-+extern struct ip_conntrack *ip_conntrack_alloc(struct user_beancounter *ub);
-+
- /* find unconfirmed expectation based on tuple */
- struct ip_conntrack_expect *
- ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
-
-+/* insert expecation into lists */
-+void ip_conntrack_expect_insert(struct ip_conntrack_expect *new,
-+ struct ip_conntrack *related_to);
-+
- /* decrement reference count on an expectation */
- void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
-
-@@ -269,7 +291,15 @@ extern int ip_conntrack_tcp_update(struc
- int dir);
-
- /* Call me when a conntrack is destroyed. */
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ip_conntrack_destroyed \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_destroyed)
-+#else
- extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
-+#define ve_ip_conntrack_destroyed ip_conntrack_destroyed
-+#endif
-+
-
- /* Fake conntrack entry for untracked connections */
- extern struct ip_conntrack ip_conntrack_untracked;
-@@ -290,6 +320,7 @@ static inline int is_confirmed(struct ip
- }
-
- extern unsigned int ip_conntrack_htable_size;
-+extern int ip_conntrack_disable_ve0;
-
- struct ip_conntrack_stat
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_core.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_core.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_core.h 2004-10-19 01:55:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_core.h 2006-10-11 19:07:57.000000000 +0400
-@@ -45,8 +45,22 @@ static inline int ip_conntrack_confirm(s
- return NF_ACCEPT;
- }
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ip_conntrack_hash \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_hash)
-+#define ve_ip_conntrack_expect_list \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_expect_list)
-+#define ve_ip_conntrack_vmalloc \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_vmalloc)
-+#else
- extern struct list_head *ip_conntrack_hash;
- extern struct list_head ip_conntrack_expect_list;
-+#define ve_ip_conntrack_hash ip_conntrack_hash
-+#define ve_ip_conntrack_expect_list ip_conntrack_expect_list
-+#define ve_ip_conntrack_vmalloc ip_conntrack_vmalloc
-+#endif /* CONFIG_VE_IPTABLES */
-+
- DECLARE_RWLOCK_EXTERN(ip_conntrack_lock);
- DECLARE_RWLOCK_EXTERN(ip_conntrack_expect_tuple_lock);
- #endif /* _IP_CONNTRACK_CORE_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_helper.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_helper.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_helper.h 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_helper.h 2006-10-11 19:07:57.000000000 +0400
-@@ -36,6 +36,9 @@ extern void ip_conntrack_helper_unregist
- extern struct ip_conntrack_helper *ip_ct_find_helper(const struct ip_conntrack_tuple *tuple);
-
-
-+extern int virt_ip_conntrack_helper_register(struct ip_conntrack_helper *);
-+extern void virt_ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
-+
- /* Allocate space for an expectation: this is mandatory before calling
- ip_conntrack_expect_related. */
- extern struct ip_conntrack_expect *ip_conntrack_expect_alloc(void);
-@@ -46,4 +49,5 @@ extern int ip_conntrack_change_expect(st
- struct ip_conntrack_tuple *newtuple);
- extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
-
-+extern struct list_head helpers;
- #endif /*_IP_CONNTRACK_HELPER_H*/
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_protocol.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2004-10-19 01:55:27.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2006-10-11 19:07:57.000000000 +0400
-@@ -56,7 +56,14 @@ struct ip_conntrack_protocol
- };
-
- #define MAX_IP_CT_PROTO 256
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ip_ct_protos \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_protos)
-+#else
- extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
-+#define ve_ip_ct_protos ip_ct_protos
-+#endif /* CONFIG_VE_IPTABLES */
-
- /* Protocol registration. */
- extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
-@@ -64,7 +71,7 @@ extern void ip_conntrack_protocol_unregi
-
- static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol)
- {
-- return ip_ct_protos[protocol];
-+ return ve_ip_ct_protos[protocol];
- }
-
- /* Existing built-in protocols */
-@@ -74,16 +81,51 @@ extern struct ip_conntrack_protocol ip_c
- extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
- extern int ip_conntrack_protocol_tcp_init(void);
-
-+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_SYSCTL)
-+#include <linux/sched.h>
-+#define ve_ip_ct_tcp_timeouts \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_tcp_timeouts)
-+#define ve_ip_ct_udp_timeout \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_udp_timeout)
-+#define ve_ip_ct_udp_timeout_stream \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_udp_timeout_stream)
-+#define ve_ip_ct_icmp_timeout \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_icmp_timeout)
-+#define ve_ip_ct_generic_timeout \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_generic_timeout)
-+#define ve_ip_ct_log_invalid \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_log_invalid)
-+#define ve_ip_ct_tcp_timeout_max_retrans \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_tcp_timeout_max_retrans)
-+#define ve_ip_ct_tcp_loose \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_tcp_loose)
-+#define ve_ip_ct_tcp_be_liberal \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_tcp_be_liberal)
-+#define ve_ip_ct_tcp_max_retrans \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_tcp_max_retrans)
-+#else
-+#define ve_ip_ct_tcp_timeouts *tcp_timeouts
-+#define ve_ip_ct_udp_timeout ip_ct_udp_timeout
-+#define ve_ip_ct_udp_timeout_stream ip_ct_udp_timeout_stream
-+#define ve_ip_ct_icmp_timeout ip_ct_icmp_timeout
-+#define ve_ip_ct_generic_timeout ip_ct_generic_timeout
-+#define ve_ip_ct_log_invalid ip_ct_log_invalid
-+#define ve_ip_ct_tcp_timeout_max_retrans ip_ct_tcp_timeout_max_retrans
-+#define ve_ip_ct_tcp_loose ip_ct_tcp_loose
-+#define ve_ip_ct_tcp_be_liberal ip_ct_tcp_be_liberal
-+#define ve_ip_ct_tcp_max_retrans ip_ct_tcp_max_retrans
-+#endif
-+
- /* Log invalid packets */
- extern unsigned int ip_ct_log_invalid;
-
- #ifdef CONFIG_SYSCTL
- #ifdef DEBUG_INVALID_PACKETS
- #define LOG_INVALID(proto) \
-- (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
-+ (ve_ip_ct_log_invalid == (proto) || ve_ip_ct_log_invalid == IPPROTO_RAW)
- #else
- #define LOG_INVALID(proto) \
-- ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
-+ ((ve_ip_ct_log_invalid == (proto) || ve_ip_ct_log_invalid == IPPROTO_RAW) \
- && net_ratelimit())
- #endif
- #else
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat.h 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat.h 2006-10-11 19:08:01.000000000 +0400
-@@ -1,5 +1,6 @@
- #ifndef _IP_NAT_H
- #define _IP_NAT_H
-+#include <linux/config.h>
- #include <linux/netfilter_ipv4.h>
- #include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
-
-@@ -55,6 +56,23 @@ struct ip_nat_multi_range
- struct ip_nat_range range[1];
- };
-
-+#ifdef CONFIG_COMPAT
-+#include <net/compat.h>
-+
-+struct compat_ip_nat_range
-+{
-+ compat_uint_t flags;
-+ u_int32_t min_ip, max_ip;
-+ union ip_conntrack_manip_proto min, max;
-+};
-+
-+struct compat_ip_nat_multi_range
-+{
-+ compat_uint_t rangesize;
-+ struct compat_ip_nat_range range[1];
-+};
-+#endif
-+
- /* Worst case: local-out manip + 1 post-routing, and reverse dirn. */
- #define IP_NAT_MAX_MANIPS (2*3)
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_core.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_core.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_core.h 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_core.h 2006-10-11 19:07:58.000000000 +0400
-@@ -23,5 +23,6 @@ extern void replace_in_hashes(struct ip_
- struct ip_nat_info *info);
- extern void place_in_hashes(struct ip_conntrack *conntrack,
- struct ip_nat_info *info);
-+extern int ip_nat_install_conntrack(struct ip_conntrack *conntrack, int helper);
-
- #endif /* _IP_NAT_CORE_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_helper.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_helper.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_helper.h 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_helper.h 2006-10-11 19:07:57.000000000 +0400
-@@ -40,6 +40,8 @@ struct ip_nat_helper
-
- extern int ip_nat_helper_register(struct ip_nat_helper *me);
- extern void ip_nat_helper_unregister(struct ip_nat_helper *me);
-+extern int visible_ip_nat_helper_register(struct ip_nat_helper *me);
-+extern void visible_ip_nat_helper_unregister(struct ip_nat_helper *me);
-
- extern struct ip_nat_helper *
- ip_nat_find_helper(const struct ip_conntrack_tuple *tuple);
-@@ -65,4 +67,6 @@ extern int ip_nat_mangle_udp_packet(stru
- extern int ip_nat_seq_adjust(struct sk_buff **pskb,
- struct ip_conntrack *ct,
- enum ip_conntrack_info ctinfo);
-+
-+extern void init_ip_nat_helpers(void);
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_protocol.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_protocol.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_protocol.h 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_protocol.h 2006-10-11 19:07:57.000000000 +0400
-@@ -46,7 +46,14 @@ struct ip_nat_protocol
- };
-
- #define MAX_IP_NAT_PROTO 256
-+
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ip_nat_protos (get_exec_env()->_ip_conntrack->_ip_nat_protos)
-+#else
- extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO];
-+#define ve_ip_nat_protos ip_nat_protos
-+#endif /* CONFIG_VE_IPTABLES */
-
- /* Protocol registration. */
- extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
-@@ -54,7 +61,7 @@ extern void ip_nat_protocol_unregister(s
-
- static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol)
- {
-- return ip_nat_protos[protocol];
-+ return ve_ip_nat_protos[protocol];
- }
-
- /* Built-in protocols. */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_rule.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_rule.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_nat_rule.h 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_nat_rule.h 2006-10-11 19:07:57.000000000 +0400
-@@ -6,7 +6,7 @@
-
- #ifdef __KERNEL__
-
--extern int ip_nat_rule_init(void) __init;
-+extern int ip_nat_rule_init(void);
- extern void ip_nat_rule_cleanup(void);
- extern int ip_nat_rule_find(struct sk_buff **pskb,
- unsigned int hooknum,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_tables.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_tables.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ip_tables.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ip_tables.h 2006-10-11 19:08:01.000000000 +0400
-@@ -16,6 +16,7 @@
- #define _IPTABLES_H
-
- #ifdef __KERNEL__
-+#include <linux/config.h>
- #include <linux/if.h>
- #include <linux/types.h>
- #include <linux/in.h>
-@@ -340,6 +341,12 @@ ipt_get_target(struct ipt_entry *e)
- #include <linux/init.h>
- extern void ipt_init(void) __init;
-
-+#ifdef CONFIG_COMPAT
-+#define COMPAT_TO_USER 1
-+#define COMPAT_FROM_USER -1
-+#define COMPAT_CALC_SIZE 0
-+#endif
-+
- struct ipt_match
- {
- struct list_head list;
-@@ -369,6 +376,9 @@ struct ipt_match
- /* Called when entry of this type deleted. */
- void (*destroy)(void *matchinfo, unsigned int matchinfosize);
-
-+#ifdef CONFIG_COMPAT
-+ int (*compat)(void *match, void **dstptr, int *size, int convert);
-+#endif
- /* Set this to THIS_MODULE. */
- struct module *me;
- };
-@@ -403,6 +413,9 @@ struct ipt_target
- const void *targinfo,
- void *userdata);
-
-+#ifdef CONFIG_COMPAT
-+ int (*compat)(void *target, void **dstptr, int *size, int convert);
-+#endif
- /* Set this to THIS_MODULE. */
- struct module *me;
- };
-@@ -410,9 +423,15 @@ struct ipt_target
- extern int ipt_register_target(struct ipt_target *target);
- extern void ipt_unregister_target(struct ipt_target *target);
-
-+extern int visible_ipt_register_target(struct ipt_target *target);
-+extern void visible_ipt_unregister_target(struct ipt_target *target);
-+
- extern int ipt_register_match(struct ipt_match *match);
- extern void ipt_unregister_match(struct ipt_match *match);
-
-+extern int visible_ipt_register_match(struct ipt_match *match);
-+extern void visible_ipt_unregister_match(struct ipt_match *match);
-+
- /* Furniture shopping... */
- struct ipt_table
- {
-@@ -447,5 +466,75 @@ extern unsigned int ipt_do_table(struct
- void *userdata);
-
- #define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_entry)-1)) & ~(__alignof__(struct ipt_entry)-1))
-+
-+#ifdef CONFIG_COMPAT
-+#include <net/compat.h>
-+
-+struct compat_ipt_counters
-+{
-+ u_int32_t cnt[4];
-+};
-+
-+struct compat_ipt_counters_info
-+{
-+ char name[IPT_TABLE_MAXNAMELEN];
-+ compat_uint_t num_counters;
-+ struct compat_ipt_counters counters[0];
-+};
-+
-+struct compat_ipt_getinfo
-+{
-+ char name[IPT_TABLE_MAXNAMELEN];
-+ compat_uint_t valid_hooks;
-+ compat_uint_t hook_entry[NF_IP_NUMHOOKS];
-+ compat_uint_t underflow[NF_IP_NUMHOOKS];
-+ compat_uint_t num_entries;
-+ compat_uint_t size;
-+};
-+
-+struct compat_ipt_entry
-+{
-+ struct ipt_ip ip;
-+ compat_uint_t nfcache;
-+ u_int16_t target_offset;
-+ u_int16_t next_offset;
-+ compat_uint_t comefrom;
-+ struct compat_ipt_counters counters;
-+ unsigned char elems[0];
-+};
-+
-+struct compat_ipt_entry_match
-+{
-+ union {
-+ struct {
-+ u_int16_t match_size;
-+ char name[IPT_FUNCTION_MAXNAMELEN];
-+ } user;
-+ u_int16_t match_size;
-+ } u;
-+ unsigned char data[0];
-+};
-+
-+struct compat_ipt_entry_target
-+{
-+ union {
-+ struct {
-+ u_int16_t target_size;
-+ char name[IPT_FUNCTION_MAXNAMELEN];
-+ } user;
-+ u_int16_t target_size;
-+ } u;
-+ unsigned char data[0];
-+};
-+
-+#define COMPAT_IPT_ALIGN(s) (((s) + (__alignof__(struct compat_ipt_entry)-1)) \
-+ & ~(__alignof__(struct compat_ipt_entry)-1))
-+
-+extern int ipt_match_align_compat(void *match, void **dstptr,
-+ int *size, int off, int convert);
-+extern int ipt_target_align_compat(void *target, void **dstptr,
-+ int *size, int off, int convert);
-+
-+#endif /* CONFIG_COMPAT */
- #endif /*__KERNEL__*/
- #endif /* _IPTABLES_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_conntrack.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_conntrack.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_conntrack.h 2004-10-19 01:54:54.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_conntrack.h 2006-10-11 19:08:01.000000000 +0400
-@@ -5,6 +5,8 @@
- #ifndef _IPT_CONNTRACK_H
- #define _IPT_CONNTRACK_H
-
-+#include <linux/config.h>
-+
- #define IPT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
- #define IPT_CONNTRACK_STATE_INVALID (1 << 0)
-
-@@ -36,4 +38,21 @@ struct ipt_conntrack_info
- /* Inverse flags */
- u_int8_t invflags;
- };
-+
-+#ifdef CONFIG_COMPAT
-+struct compat_ipt_conntrack_info
-+{
-+ compat_uint_t statemask, statusmask;
-+
-+ struct ip_conntrack_tuple tuple[IP_CT_DIR_MAX];
-+ struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
-+
-+ compat_ulong_t expires_min, expires_max;
-+
-+ /* Flags word */
-+ u_int8_t flags;
-+ /* Inverse flags */
-+ u_int8_t invflags;
-+};
-+#endif
- #endif /*_IPT_CONNTRACK_H*/
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_helper.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_helper.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_helper.h 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_helper.h 2006-10-11 19:08:01.000000000 +0400
-@@ -1,8 +1,17 @@
- #ifndef _IPT_HELPER_H
- #define _IPT_HELPER_H
-
-+#include <linux/config.h>
-+
- struct ipt_helper_info {
- int invert;
- char name[30];
- };
-+
-+#ifdef CONFIG_COMPAT
-+struct compat_ipt_helper_info {
-+ compat_int_t invert;
-+ char name[30];
-+};
-+#endif
- #endif /* _IPT_HELPER_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_limit.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_limit.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_limit.h 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_limit.h 2006-10-11 19:08:01.000000000 +0400
-@@ -1,6 +1,8 @@
- #ifndef _IPT_RATE_H
- #define _IPT_RATE_H
-
-+#include <linux/config.h>
-+
- /* timings are in milliseconds. */
- #define IPT_LIMIT_SCALE 10000
-
-@@ -18,4 +20,20 @@ struct ipt_rateinfo {
- /* Ugly, ugly fucker. */
- struct ipt_rateinfo *master;
- };
-+
-+#ifdef CONFIG_COMPAT
-+struct compat_ipt_rateinfo {
-+ u_int32_t avg; /* Average secs between packets * scale */
-+ u_int32_t burst; /* Period multiplier for upper limit. */
-+
-+ /* Used internally by the kernel */
-+ compat_ulong_t prev;
-+ u_int32_t credit;
-+ u_int32_t credit_cap, cost;
-+
-+ /* Ugly, ugly fucker. */
-+ compat_uptr_t master;
-+};
-+#endif
-+
- #endif /*_IPT_RATE_H*/
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_state.h linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_state.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netfilter_ipv4/ipt_state.h 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netfilter_ipv4/ipt_state.h 2006-10-11 19:08:01.000000000 +0400
-@@ -1,6 +1,8 @@
- #ifndef _IPT_STATE_H
- #define _IPT_STATE_H
-
-+#include <linux/config.h>
-+
- #define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
- #define IPT_STATE_INVALID (1 << 0)
-
-@@ -10,4 +12,11 @@ struct ipt_state_info
- {
- unsigned int statemask;
- };
-+
-+#ifdef CONFIG_COMPAT
-+struct compat_ipt_state_info
-+{
-+ compat_uint_t statemask;
-+};
-+#endif
- #endif /*_IPT_STATE_H*/
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/netlink.h linux-2.6.9-ve023stab030/include/linux/netlink.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/netlink.h 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/netlink.h 2006-10-11 19:07:58.000000000 +0400
-@@ -101,6 +101,20 @@ enum {
- #include <linux/capability.h>
- #include <linux/skbuff.h>
-
-+struct netlink_opt
-+{
-+ u32 pid;
-+ unsigned groups;
-+ u32 dst_pid;
-+ unsigned dst_groups;
-+ unsigned long state;
-+ int (*handler)(int unit, struct sk_buff *skb);
-+ wait_queue_head_t wait;
-+ struct netlink_callback *cb;
-+ spinlock_t cb_lock;
-+ void (*data_ready)(struct sock *sk, int bytes);
-+};
-+
- struct netlink_skb_parms
- {
- struct ucred creds; /* Skb credentials */
-@@ -131,7 +145,7 @@ extern int netlink_unregister_notifier(s
- /* finegrained unicast helpers: */
- struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid);
- struct sock *netlink_getsockbyfilp(struct file *filp);
--int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo);
-+int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo, struct sock *ssk);
- void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
- int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/nfcalls.h linux-2.6.9-ve023stab030/include/linux/nfcalls.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/nfcalls.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/nfcalls.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,234 @@
-+/*
-+ * include/linux/nfcalls.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _LINUX_NFCALLS_H
-+#define _LINUX_NFCALLS_H
-+
-+#include <linux/rcupdate.h>
-+
-+#ifdef CONFIG_MODULES
-+extern struct module no_module;
-+
-+#define DECL_KSYM_MODULE(name) \
-+ extern struct module *vz_mod_##name
-+#define DECL_KSYM_CALL(type, name, args) \
-+ extern type (*vz_##name) args
-+
-+#define INIT_KSYM_MODULE(name) \
-+ struct module *vz_mod_##name = &no_module; \
-+ EXPORT_SYMBOL(vz_mod_##name)
-+#define INIT_KSYM_CALL(type, name, args) \
-+ type (*vz_##name) args; \
-+ EXPORT_SYMBOL(vz_##name)
-+
-+#define __KSYMERRCALL(err, type, mod, name, args) \
-+({ \
-+ type ret = (type)err; \
-+ if (!__vzksym_module_get(vz_mod_##mod)) { \
-+ if (vz_##name) \
-+ ret = ((*vz_##name)args); \
-+ __vzksym_module_put(vz_mod_##mod); \
-+ } \
-+ ret; \
-+})
-+#define __KSYMSAFECALL_VOID(mod, name, args) \
-+do { \
-+ if (!__vzksym_module_get(vz_mod_##mod)) { \
-+ if (vz_##name) \
-+ ((*vz_##name)args); \
-+ __vzksym_module_put(vz_mod_##mod); \
-+ } \
-+} while (0)
-+#else
-+#define DECL_KSYM_CALL(type, name, args) \
-+ extern type name args
-+#define INIT_KSYM_MODULE(name)
-+#define INIT_KSYM_CALL(type, name, args) \
-+ type name args
-+#define __KSYMERRCALL(err, type, mod, name, args) ((*name)args)
-+#define __KSYMSAFECALL_VOID(mod, name, args) ((*name)args)
-+#endif
-+
-+#define KSYMERRCALL(err, mod, name, args) \
-+ __KSYMERRCALL(err, int, mod, name, args)
-+#define KSYMSAFECALL(type, mod, name, args) \
-+ __KSYMERRCALL(0, type, mod, name, args)
-+#define KSYMSAFECALL_VOID(mod, name, args) \
-+ __KSYMSAFECALL_VOID(mod, name, args)
-+
-+#if defined(CONFIG_VE) && defined(CONFIG_MODULES)
-+/* should be called _after_ KSYMRESOLVE's */
-+#define KSYMMODRESOLVE(name) \
-+ __vzksym_modresolve(&vz_mod_##name, THIS_MODULE)
-+#define KSYMMODUNRESOLVE(name) \
-+ __vzksym_modunresolve(&vz_mod_##name)
-+
-+#define KSYMRESOLVE(name) \
-+ vz_##name = &name
-+#define KSYMUNRESOLVE(name) \
-+ vz_##name = NULL
-+#else
-+#define KSYMRESOLVE(name) do { } while (0)
-+#define KSYMUNRESOLVE(name) do { } while (0)
-+#define KSYMMODRESOLVE(name) do { } while (0)
-+#define KSYMMODUNRESOLVE(name) do { } while (0)
-+#endif
-+
-+#ifdef CONFIG_MODULES
-+static inline void __vzksym_modresolve(struct module **modp, struct module *mod)
-+{
-+ /*
-+ * we want to be sure, that pointer updates are visible first:
-+ * 1. wmb() is here only for piece of sure
-+ * (note, no rmb() in KSYMSAFECALL)
-+ * 2. synchronize_kernel() guarantees that updates are visible
-+ * on all cpus and allows us to remove rmb() in KSYMSAFECALL
-+ */
-+ wmb(); synchronize_kernel();
-+ *modp = mod;
-+ /* just to be sure, our changes are visible as soon as possible */
-+ wmb(); synchronize_kernel();
-+}
-+
-+static inline void __vzksym_modunresolve(struct module **modp)
-+{
-+ /*
-+ * try_module_get() in KSYMSAFECALL should fail at this moment since
-+ * THIS_MODULE in in unloading state (we should be called from fini),
-+ * no need to syncronize pointers/ve_module updates.
-+ */
-+ *modp = &no_module;
-+ /*
-+ * synchronize_kernel() guarantees here that we see
-+ * updated module pointer before the module really gets away
-+ */
-+ synchronize_kernel();
-+}
-+
-+static inline int __vzksym_module_get(struct module *mod)
-+{
-+ /*
-+ * we want to avoid rmb(), so use synchronize_kernel() in KSYMUNRESOLVE
-+ * and smp_read_barrier_depends() here...
-+ */
-+ smp_read_barrier_depends(); /* for module loading */
-+ if (!try_module_get(mod))
-+ return -EBUSY;
-+
-+ return 0;
-+}
-+
-+static inline void __vzksym_module_put(struct module *mod)
-+{
-+ module_put(mod);
-+}
-+#endif
-+
-+#if defined(CONFIG_VE_IPTABLES)
-+#ifdef CONFIG_MODULES
-+DECL_KSYM_MODULE(ip_tables);
-+DECL_KSYM_MODULE(iptable_filter);
-+DECL_KSYM_MODULE(iptable_mangle);
-+DECL_KSYM_MODULE(ipt_limit);
-+DECL_KSYM_MODULE(ipt_multiport);
-+DECL_KSYM_MODULE(ipt_tos);
-+DECL_KSYM_MODULE(ipt_TOS);
-+DECL_KSYM_MODULE(ipt_REJECT);
-+DECL_KSYM_MODULE(ipt_TCPMSS);
-+DECL_KSYM_MODULE(ipt_tcpmss);
-+DECL_KSYM_MODULE(ipt_ttl);
-+DECL_KSYM_MODULE(ipt_LOG);
-+DECL_KSYM_MODULE(ipt_length);
-+DECL_KSYM_MODULE(ip_conntrack);
-+DECL_KSYM_MODULE(ip_conntrack_ftp);
-+DECL_KSYM_MODULE(ip_conntrack_irc);
-+DECL_KSYM_MODULE(ipt_conntrack);
-+DECL_KSYM_MODULE(ipt_state);
-+DECL_KSYM_MODULE(ipt_helper);
-+DECL_KSYM_MODULE(iptable_nat);
-+DECL_KSYM_MODULE(ip_nat_ftp);
-+DECL_KSYM_MODULE(ip_nat_irc);
-+DECL_KSYM_MODULE(ipt_REDIRECT);
-+DECL_KSYM_MODULE(ipt_owner);
-+#endif
-+
-+struct sk_buff;
-+
-+DECL_KSYM_CALL(int, init_netfilter, (void));
-+DECL_KSYM_CALL(int, init_iptables, (void));
-+DECL_KSYM_CALL(int, init_iptable_filter, (void));
-+DECL_KSYM_CALL(int, init_iptable_mangle, (void));
-+DECL_KSYM_CALL(int, init_iptable_limit, (void));
-+DECL_KSYM_CALL(int, init_iptable_multiport, (void));
-+DECL_KSYM_CALL(int, init_iptable_tos, (void));
-+DECL_KSYM_CALL(int, init_iptable_TOS, (void));
-+DECL_KSYM_CALL(int, init_iptable_REJECT, (void));
-+DECL_KSYM_CALL(int, init_iptable_TCPMSS, (void));
-+DECL_KSYM_CALL(int, init_iptable_tcpmss, (void));
-+DECL_KSYM_CALL(int, init_iptable_ttl, (void));
-+DECL_KSYM_CALL(int, init_iptable_LOG, (void));
-+DECL_KSYM_CALL(int, init_iptable_length, (void));
-+DECL_KSYM_CALL(int, init_iptable_conntrack, (void));
-+DECL_KSYM_CALL(int, init_iptable_ftp, (void));
-+DECL_KSYM_CALL(int, init_iptable_irc, (void));
-+DECL_KSYM_CALL(int, init_iptable_conntrack_match, (void));
-+DECL_KSYM_CALL(int, init_iptable_state, (void));
-+DECL_KSYM_CALL(int, init_iptable_helper, (void));
-+DECL_KSYM_CALL(int, init_iptable_nat, (void));
-+DECL_KSYM_CALL(int, init_iptable_nat_ftp, (void));
-+DECL_KSYM_CALL(int, init_iptable_nat_irc, (void));
-+DECL_KSYM_CALL(int, init_iptable_REDIRECT, (void));
-+DECL_KSYM_CALL(int, init_iptable_owner, (void));
-+DECL_KSYM_CALL(void, fini_iptable_owner, (void));
-+DECL_KSYM_CALL(void, fini_iptable_nat_irc, (void));
-+DECL_KSYM_CALL(void, fini_iptable_nat_ftp, (void));
-+DECL_KSYM_CALL(void, fini_iptable_nat, (void));
-+DECL_KSYM_CALL(void, fini_iptable_helper, (void));
-+DECL_KSYM_CALL(void, fini_iptable_state, (void));
-+DECL_KSYM_CALL(void, fini_iptable_conntrack_match, (void));
-+DECL_KSYM_CALL(void, fini_iptable_irc, (void));
-+DECL_KSYM_CALL(void, fini_iptable_ftp, (void));
-+DECL_KSYM_CALL(void, fini_iptable_conntrack, (void));
-+DECL_KSYM_CALL(void, fini_iptable_length, (void));
-+DECL_KSYM_CALL(void, fini_iptable_LOG, (void));
-+DECL_KSYM_CALL(void, fini_iptable_ttl, (void));
-+DECL_KSYM_CALL(void, fini_iptable_tcpmss, (void));
-+DECL_KSYM_CALL(void, fini_iptable_TCPMSS, (void));
-+DECL_KSYM_CALL(void, fini_iptable_REJECT, (void));
-+DECL_KSYM_CALL(void, fini_iptable_TOS, (void));
-+DECL_KSYM_CALL(void, fini_iptable_tos, (void));
-+DECL_KSYM_CALL(void, fini_iptable_multiport, (void));
-+DECL_KSYM_CALL(void, fini_iptable_limit, (void));
-+DECL_KSYM_CALL(void, fini_iptable_filter, (void));
-+DECL_KSYM_CALL(void, fini_iptable_mangle, (void));
-+DECL_KSYM_CALL(void, fini_iptables, (void));
-+DECL_KSYM_CALL(void, fini_netfilter, (void));
-+DECL_KSYM_CALL(void, fini_iptable_REDIRECT, (void));
-+
-+DECL_KSYM_CALL(void, ipt_flush_table, (struct ipt_table *table));
-+#endif /* CONFIG_VE_IPTABLES */
-+
-+#if defined(CONFIG_VE_ETHDEV) || defined(CONFIG_VE_ETHDEV_MODULE)
-+#ifdef CONFIG_MODULES
-+DECL_KSYM_MODULE(vzethdev);
-+#endif
-+DECL_KSYM_CALL(int, veth_open, (struct net_device *dev));
-+#endif
-+
-+#ifdef CONFIG_VE_CALLS_MODULE
-+DECL_KSYM_MODULE(vzmon);
-+DECL_KSYM_CALL(int, real_get_device_perms_ve,
-+ (int dev_type, dev_t dev, int access_mode));
-+DECL_KSYM_CALL(void, real_do_env_cleanup, (struct ve_struct *env));
-+DECL_KSYM_CALL(void, real_do_env_free, (struct ve_struct *env));
-+DECL_KSYM_CALL(void, real_update_load_avg_ve, (void));
-+#endif
-+
-+#endif /* _LINUX_NFCALLS_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/nfs_fs.h linux-2.6.9-ve023stab030/include/linux/nfs_fs.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/nfs_fs.h 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/nfs_fs.h 2006-10-11 19:07:55.000000000 +0400
-@@ -312,7 +312,8 @@ extern struct inode *nfs_fhget(struct su
- struct nfs_fattr *);
- extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
- extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
--extern int nfs_permission(struct inode *, int, struct nameidata *);
-+extern int nfs_permission(struct inode *, int, struct nameidata *,
-+ struct exec_perm *);
- extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);
- extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
- extern int nfs_open(struct inode *, struct file *);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/notifier.h linux-2.6.9-ve023stab030/include/linux/notifier.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/notifier.h 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/notifier.h 2006-10-11 19:07:56.000000000 +0400
-@@ -27,8 +27,9 @@ extern int notifier_call_chain(struct no
-
- #define NOTIFY_DONE 0x0000 /* Don't care */
- #define NOTIFY_OK 0x0001 /* Suits me */
-+#define NOTIFY_FAIL 0x0002 /* Reject */
- #define NOTIFY_STOP_MASK 0x8000 /* Don't call further */
--#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002) /* Bad/Veto action */
-+#define NOTIFY_BAD (NOTIFY_STOP_MASK|NOTIFY_FAIL) /* Bad/Veto action */
- /*
- * Clean way to return from the notifier and stop further calls.
- */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/page-flags.h linux-2.6.9-ve023stab030/include/linux/page-flags.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/page-flags.h 2004-10-19 01:54:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/page-flags.h 2006-10-11 19:07:58.000000000 +0400
-@@ -76,6 +76,8 @@
- #define PG_reclaim 18 /* To be reclaimed asap */
-
-
-+#define PG_checkpointed 21 /* Page transferred */
-+
- /*
- * Global page accounting. One instance per CPU. Only unsigned longs are
- * allowed.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/pid.h linux-2.6.9-ve023stab030/include/linux/pid.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/pid.h 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/pid.h 2006-10-11 19:07:57.000000000 +0400
-@@ -1,6 +1,18 @@
- #ifndef _LINUX_PID_H
- #define _LINUX_PID_H
-
-+#define VPID_BIT 10
-+#define VPID_DIV (1<<VPID_BIT)
-+
-+#ifdef CONFIG_VE
-+#define __is_virtual_pid(pid) ((pid) & VPID_DIV)
-+#define is_virtual_pid(pid) \
-+ (__is_virtual_pid(pid) || ((pid)==1 && !ve_is_super(get_exec_env())))
-+#else
-+#define __is_virtual_pid(pid) 0
-+#define is_virtual_pid(pid) 0
-+#endif
-+
- enum pid_type
- {
- PIDTYPE_PID,
-@@ -15,6 +27,9 @@ struct pid
- /* Try to keep pid_chain in the same cacheline as nr for find_pid */
- int nr;
- struct hlist_node pid_chain;
-+#ifdef CONFIG_VE
-+ int vnr;
-+#endif
- /* list of pids with the same nr, only one of them is in the hash */
- struct list_head pid_list;
- };
-@@ -40,18 +55,91 @@ extern int alloc_pidmap(void);
- extern void FASTCALL(free_pidmap(int));
- extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thread);
-
--#define do_each_task_pid(who, type, task) \
-- if ((task = find_task_by_pid_type(type, who))) { \
-+#ifndef CONFIG_VE
-+
-+#define vpid_to_pid(pid) (pid)
-+#define __vpid_to_pid(pid) (pid)
-+#define pid_type_to_vpid(pid, type) (pid)
-+#define __pid_type_to_vpid(pid, type) (pid)
-+
-+#define comb_vpid_to_pid(pid) (pid)
-+#define comb_pid_to_vpid(pid) (pid)
-+
-+#else
-+
-+struct ve_struct;
-+extern void free_vpid(int vpid, struct ve_struct *ve);
-+extern int alloc_vpid(int pid, int vpid);
-+extern int vpid_to_pid(int pid);
-+extern int __vpid_to_pid(int pid);
-+extern pid_t pid_type_to_vpid(int type, pid_t pid);
-+extern pid_t _pid_type_to_vpid(int type, pid_t pid);
-+
-+static inline int comb_vpid_to_pid(int vpid)
-+{
-+ int pid = vpid;
-+
-+ if (vpid > 0) {
-+ pid = vpid_to_pid(vpid);
-+ if (unlikely(pid < 0))
-+ return 0;
-+ } else if (vpid < 0) {
-+ pid = vpid_to_pid(-vpid);
-+ if (unlikely(pid < 0))
-+ return 0;
-+ pid = -pid;
-+ }
-+ return pid;
-+}
-+
-+static inline int comb_pid_to_vpid(int pid)
-+{
-+ int vpid = pid;
-+
-+ if (pid > 0) {
-+ vpid = pid_type_to_vpid(PIDTYPE_PID, pid);
-+ if (unlikely(vpid < 0))
-+ return 0;
-+ } else if (pid < 0) {
-+ vpid = pid_type_to_vpid(PIDTYPE_PGID, -pid);
-+ if (unlikely(vpid < 0))
-+ return 0;
-+ vpid = -vpid;
-+ }
-+ return vpid;
-+}
-+#endif
-+
-+#define do_each_task_pid_all(who, type, task) \
-+ if ((task = find_task_by_pid_type_all(type, who))) { \
- prefetch((task)->pids[type].pid_list.next); \
- do {
-
--#define while_each_task_pid(who, type, task) \
-+#define while_each_task_pid_all(who, type, task) \
- } while (task = pid_task((task)->pids[type].pid_list.next,\
- type), \
- prefetch((task)->pids[type].pid_list.next), \
- hlist_unhashed(&(task)->pids[type].pid_chain)); \
- } \
-
-+#ifndef CONFIG_VE
-+#define __do_each_task_pid_ve(who, type, task, owner) \
-+ do_each_task_pid_all(who, type, task)
-+#define __while_each_task_pid_ve(who, type, task, owner) \
-+ while_each_task_pid_all(who, type, task)
-+#else /* CONFIG_VE */
-+#define __do_each_task_pid_ve(who, type, task, owner) \
-+ do_each_task_pid_all(who, type, task) \
-+ if (ve_accessible(VE_TASK_INFO(task)->owner_env, owner))
-+#define __while_each_task_pid_ve(who, type, task, owner) \
-+ while_each_task_pid_all(who, type, task)
-+#endif /* CONFIG_VE */
-+
-+#define do_each_task_pid_ve(who, type, task) \
-+ __do_each_task_pid_ve(who, type, task, get_exec_env());
-+#define while_each_task_pid_ve(who, type, task) \
-+ __while_each_task_pid_ve(who, type, task, get_exec_env());
-+
- extern int pid_alive(struct task_struct *p);
-
- #endif /* _LINUX_PID_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/proc_fs.h linux-2.6.9-ve023stab030/include/linux/proc_fs.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/proc_fs.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/proc_fs.h 2006-10-11 19:07:57.000000000 +0400
-@@ -96,8 +96,8 @@ extern void proc_misc_init(void);
- struct mm_struct;
-
- struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
--struct dentry *proc_pid_unhash(struct task_struct *p);
--void proc_pid_flush(struct dentry *proc_dentry);
-+void proc_pid_unhash(struct task_struct *p, struct dentry * [2]);
-+void proc_pid_flush(struct dentry *proc_dentry[2]);
- int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
- unsigned long task_vsize(struct mm_struct *);
- int task_statm(struct mm_struct *, int *, int *, int *, int *);
-@@ -105,7 +105,11 @@ char *task_mem(struct mm_struct *, char
-
- extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
- struct proc_dir_entry *parent);
-+extern struct proc_dir_entry *create_proc_glob_entry(const char *name,
-+ mode_t mode,
-+ struct proc_dir_entry *parent);
- extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
-+extern void remove_proc_glob_entry(const char *name, struct proc_dir_entry *parent);
-
- extern struct vfsmount *proc_mnt;
- extern int proc_fill_super(struct super_block *,void *,int);
-@@ -181,6 +185,15 @@ static inline struct proc_dir_entry *pro
- return create_proc_info_entry(name,mode,proc_net,get_info);
- }
-
-+static inline struct proc_dir_entry *__proc_net_fops_create(const char *name,
-+ mode_t mode, struct file_operations *fops, struct proc_dir_entry *p)
-+{
-+ struct proc_dir_entry *res = create_proc_entry(name, mode, p);
-+ if (res)
-+ res->proc_fops = fops;
-+ return res;
-+}
-+
- static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
- mode_t mode, struct file_operations *fops)
- {
-@@ -190,6 +203,11 @@ static inline struct proc_dir_entry *pro
- return res;
- }
-
-+static inline void __proc_net_remove(const char *name)
-+{
-+ remove_proc_entry(name, NULL);
-+}
-+
- static inline void proc_net_remove(const char *name)
- {
- remove_proc_entry(name,proc_net);
-@@ -200,15 +218,20 @@ static inline void proc_net_remove(const
- #define proc_root_driver NULL
- #define proc_net NULL
-
-+#define __proc_net_fops_create(name, mode, fops, p) ({ (void)(mode), NULL; })
- #define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; })
- #define proc_net_create(name, mode, info) ({ (void)(mode), NULL; })
-+static inline void __proc_net_remove(const char *name) {}
- static inline void proc_net_remove(const char *name) {}
-
--static inline struct dentry *proc_pid_unhash(struct task_struct *p) { return NULL; }
--static inline void proc_pid_flush(struct dentry *proc_dentry) { }
-+static inline void proc_pid_unhash(struct task_struct *p, struct dentry * [2])
-+ { return NULL; }
-+static inline void proc_pid_flush(struct dentry *proc_dentry[2]) { }
-
- static inline struct proc_dir_entry *create_proc_entry(const char *name,
- mode_t mode, struct proc_dir_entry *parent) { return NULL; }
-+static inline struct proc_dir_entry *create_proc_glob_entry(const char *name,
-+ mode_t mode, struct proc_dir_entry *parent) { return NULL; }
-
- #define remove_proc_entry(name, parent) do {} while (0)
-
-@@ -266,4 +289,18 @@ static inline struct proc_dir_entry *PDE
- return PROC_I(inode)->pde;
- }
-
-+static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de)
-+{
-+ if (de)
-+ atomic_inc(&de->count);
-+ return de;
-+}
-+
-+extern void de_put(struct proc_dir_entry *de);
-+
-+#define LPDE(inode) (PROC_I((inode))->pde)
-+#ifdef CONFIG_VE
-+#define GPDE(inode) (*(struct proc_dir_entry **)(&(inode)->i_pipe))
-+#endif
-+
- #endif /* _LINUX_PROC_FS_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/ptrace.h linux-2.6.9-ve023stab030/include/linux/ptrace.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/ptrace.h 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/ptrace.h 2006-10-11 19:07:55.000000000 +0400
-@@ -80,6 +80,7 @@ extern int ptrace_readdata(struct task_s
- extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
- extern int ptrace_attach(struct task_struct *tsk);
- extern int ptrace_detach(struct task_struct *, unsigned int);
-+extern void __ptrace_detach(struct task_struct *, unsigned int);
- extern void ptrace_disable(struct task_struct *);
- extern int ptrace_check_attach(struct task_struct *task, int kill);
- extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/quota.h linux-2.6.9-ve023stab030/include/linux/quota.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/quota.h 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/quota.h 2006-10-11 19:07:58.000000000 +0400
-@@ -37,7 +37,6 @@
-
- #include <linux/errno.h>
- #include <linux/types.h>
--#include <linux/spinlock.h>
-
- #define __DQUOT_VERSION__ "dquot_6.5.1"
- #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
-@@ -45,8 +44,6 @@
- typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
- typedef __u64 qsize_t; /* Type in which we store sizes */
-
--extern spinlock_t dq_data_lock;
--
- /* Size of blocks in which are counted size limits */
- #define QUOTABLOCK_BITS 10
- #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
-@@ -133,10 +130,14 @@ struct if_dqinfo {
-
- #ifdef __KERNEL__
-
-+#include <linux/spinlock.h>
-+
- #include <linux/dqblk_xfs.h>
- #include <linux/dqblk_v1.h>
- #include <linux/dqblk_v2.h>
-
-+extern spinlock_t dq_data_lock;
-+
- /* Maximal numbers of writes for quota operation (insert/delete/update)
- * (over all formats) - info block, 4 pointer blocks, data block */
- #define DQUOT_MAX_WRITES 6
-@@ -239,6 +240,8 @@ struct quota_format_ops {
- int (*release_dqblk)(struct dquot *dquot); /* Called when last reference to dquot is being dropped */
- };
-
-+struct inode;
-+struct iattr;
- /* Operations working with dquots */
- struct dquot_operations {
- int (*initialize) (struct inode *, int);
-@@ -253,9 +256,11 @@ struct dquot_operations {
- int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
- int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
- int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
-+ int (*rename) (struct inode *, struct inode *, struct inode *);
- };
-
- /* Operations handling requests from userspace */
-+struct v2_disk_dqblk;
- struct quotactl_ops {
- int (*quota_on)(struct super_block *, int, int, char *);
- int (*quota_off)(struct super_block *, int);
-@@ -268,6 +273,9 @@ struct quotactl_ops {
- int (*set_xstate)(struct super_block *, unsigned int, int);
- int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
- int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
-+#ifdef CONFIG_QUOTA_COMPAT
-+ int (*get_quoti)(struct super_block *, int, unsigned int, struct v2_disk_dqblk *);
-+#endif
- };
-
- struct quota_format_type {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/quotaops.h linux-2.6.9-ve023stab030/include/linux/quotaops.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/quotaops.h 2004-10-19 01:53:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/quotaops.h 2006-10-11 19:07:58.000000000 +0400
-@@ -170,6 +170,19 @@ static __inline__ int DQUOT_TRANSFER(str
- return 0;
- }
-
-+static __inline__ int DQUOT_RENAME(struct inode *inode,
-+ struct inode *old_dir, struct inode *new_dir)
-+{
-+ struct dquot_operations *q_op;
-+
-+ q_op = inode->i_sb->dq_op;
-+ if (q_op && q_op->rename) {
-+ if (q_op->rename(inode, old_dir, new_dir) == NO_QUOTA)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
- /* The following two functions cannot be called inside a transaction */
- #define DQUOT_SYNC(sb) sync_dquots(sb, -1)
-
-@@ -197,6 +210,7 @@ static __inline__ int DQUOT_OFF(struct s
- #define DQUOT_SYNC(sb) do { } while(0)
- #define DQUOT_OFF(sb) do { } while(0)
- #define DQUOT_TRANSFER(inode, iattr) (0)
-+#define DQUOT_RENAME(inode, old_dir, new_dir) (0)
- extern __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
- {
- inode_add_bytes(inode, nr);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/reiserfs_xattr.h linux-2.6.9-ve023stab030/include/linux/reiserfs_xattr.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/reiserfs_xattr.h 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/reiserfs_xattr.h 2006-10-11 19:07:55.000000000 +0400
-@@ -42,7 +42,8 @@ int reiserfs_removexattr (struct dentry
- int reiserfs_delete_xattrs (struct inode *inode);
- int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs);
- int reiserfs_xattr_init (struct super_block *sb, int mount_flags);
--int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd);
-+int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd,
-+ struct exec_perm *exec_perm);
- int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd);
-
- int reiserfs_xattr_del (struct inode *, const char *);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/rtnetlink.h linux-2.6.9-ve023stab030/include/linux/rtnetlink.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/rtnetlink.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/rtnetlink.h 2006-10-11 19:07:55.000000000 +0400
-@@ -798,7 +798,8 @@ extern struct semaphore rtnl_sem;
- #define rtnl_shlock() down(&rtnl_sem)
- #define rtnl_shlock_nowait() down_trylock(&rtnl_sem)
-
--#define rtnl_shunlock() do { up(&rtnl_sem); \
-+#define __rtnl_shunlock() up(&rtnl_sem)
-+#define rtnl_shunlock() do { __rtnl_shunlock(); \
- if (rtnl && rtnl->sk_receive_queue.qlen) \
- rtnl->sk_data_ready(rtnl, 0); \
- } while(0)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/sched.h linux-2.6.9-ve023stab030/include/linux/sched.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/sched.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/sched.h 2006-10-11 19:08:02.000000000 +0400
-@@ -30,7 +30,12 @@
- #include <linux/pid.h>
- #include <linux/percpu.h>
-
-+#include <ub/ub_task.h>
-+
- struct exec_domain;
-+struct task_beancounter;
-+struct user_beancounter;
-+struct ve_struct;
- extern int exec_shield;
- extern int exec_shield_randomize;
- extern int print_fatal_signals;
-@@ -87,6 +92,9 @@ extern unsigned long avenrun[]; /* Load
- load += n*(FIXED_1-exp); \
- load >>= FSHIFT;
-
-+#define LOAD_INT(x) ((x) >> FSHIFT)
-+#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
-+
- #define CT_TO_SECS(x) ((x) / HZ)
- #define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ)
-
-@@ -94,10 +102,22 @@ extern int nr_threads;
- extern int last_pid;
- DECLARE_PER_CPU(unsigned long, process_counts);
- extern int nr_processes(void);
-+
-+extern unsigned long nr_sleeping(void);
-+extern unsigned long nr_stopped(void);
-+extern unsigned long nr_zombie;
-+extern unsigned long nr_dead;
- extern unsigned long nr_running(void);
- extern unsigned long nr_uninterruptible(void);
- extern unsigned long nr_iowait(void);
-
-+#ifdef CONFIG_VE
-+struct ve_struct;
-+extern unsigned long nr_running_ve(struct ve_struct *);
-+extern unsigned long nr_iowait_ve(void);
-+extern unsigned long nr_uninterruptible_ve(struct ve_struct *);
-+#endif
-+
- #include <linux/time.h>
- #include <linux/param.h>
- #include <linux/resource.h>
-@@ -152,11 +172,16 @@ typedef struct task_struct task_t;
- extern void sched_init(void);
- extern void sched_init_smp(void);
- extern void init_idle(task_t *idle, int cpu);
-+extern void fini_idle(int cpu);
-
- extern cpumask_t nohz_cpu_mask;
-
- extern void show_state(void);
- extern void show_regs(struct pt_regs *);
-+extern void smp_show_regs(struct pt_regs *, void *);
-+extern void show_vsched(void);
-+extern int vsched_init_default(int cpu);
-+extern void vsched_fini_default(int cpu);
-
- /*
- * TASK is a pointer to the task whose backtrace we want to see (or NULL for current
-@@ -174,6 +199,8 @@ extern void update_process_times(int use
- extern void scheduler_tick(int user_tick, int system);
- extern unsigned long cache_decay_ticks;
-
-+int setscheduler(pid_t pid, int policy, struct sched_param __user *param);
-+
- /* Attach to any functions which should be ignored in wchan output. */
- #define __sched __attribute__((__section__(".sched.text")))
- /* Is this address in the __sched functions? */
-@@ -241,6 +268,7 @@ struct mm_struct {
- unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
-
- unsigned dumpable:2;
-+ unsigned vps_dumpable:2;
- cpumask_t cpu_vm_mask;
-
- /* Architecture-specific MM context */
-@@ -259,8 +287,12 @@ struct mm_struct {
- struct kioctx *ioctx_list;
-
- struct kioctx default_kioctx;
-+
-+ struct user_beancounter *mm_ub;
- };
-
-+#define mm_ub(__mm) ((__mm)->mm_ub)
-+
- extern int mmlist_nr;
-
- struct sighand_struct {
-@@ -269,6 +301,9 @@ struct sighand_struct {
- spinlock_t siglock;
- };
-
-+#include <linux/ve.h>
-+#include <linux/ve_task.h>
-+
- /*
- * NOTE! "signal_struct" does not have it's own
- * locking, because a shared signal_struct always
-@@ -461,6 +496,8 @@ extern int groups_search(struct group_in
-
- struct audit_context; /* See audit.c */
- struct mempolicy;
-+struct vcpu_scheduler;
-+struct vcpu_info;
-
- /* auxilliary task structure to avoid KABI breakage */
- struct task_struct_aux {
-@@ -483,6 +520,14 @@ struct task_struct {
-
- int lock_depth; /* Lock depth */
-
-+#ifdef CONFIG_SCHED_VCPU
-+ struct vcpu_scheduler *vsched;
-+ struct vcpu_info *vcpu;
-+
-+ /* id's are saved to avoid locking (e.g. on vsched->id access) */
-+ int vsched_id;
-+ int vcpu_id;
-+#endif
- int prio, static_prio;
- struct list_head run_list;
- prio_array_t *array;
-@@ -501,6 +546,7 @@ struct task_struct {
- #endif
-
- struct list_head tasks;
-+
- /*
- * ptrace_list/ptrace_children forms the list of my children
- * that were stolen by a ptracer.
-@@ -623,6 +669,11 @@ struct task_struct {
-
- unsigned long ptrace_message;
- siginfo_t *last_siginfo; /* For ptrace use. */
-+/* state tracking for suspend */
-+ sigset_t saved_sigset;
-+ __u8 pn_state;
-+ __u8 stopped_state:1, sigsuspend_state:1;
-+
- /*
- * current io wait handle: wait queue entry to use for io waits
- * If this thread is processing aio, this points at the waitqueue
-@@ -634,6 +685,16 @@ struct task_struct {
- struct mempolicy *mempolicy;
- short il_next; /* could be shared with used_math */
- #endif
-+#ifdef CONFIG_USER_RESOURCE
-+ struct task_beancounter task_bc;
-+#endif
-+#ifdef CONFIG_VE
-+ struct ve_task_info ve_task_info;
-+#endif
-+#if defined(CONFIG_VZ_QUOTA) || defined(CONFIG_VZ_QUOTA_MODULE)
-+ unsigned long magic;
-+ struct inode *ino;
-+#endif
- };
-
- static inline pid_t process_group(struct task_struct *tsk)
-@@ -660,10 +721,8 @@ do { if (atomic_dec_and_test(&(tsk)->usa
- #define PF_DUMPCORE 0x00000200 /* dumped core */
- #define PF_SIGNALED 0x00000400 /* killed by a signal */
- #define PF_MEMALLOC 0x00000800 /* Allocating memory */
--#define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */
- #define PF_FLUSHER 0x00002000 /* responsible for disk writeback */
-
--#define PF_FREEZE 0x00004000 /* this task should be frozen for suspend */
- #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
- #define PF_FROZEN 0x00010000 /* frozen for system suspend */
- #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
-@@ -674,6 +733,71 @@ do { if (atomic_dec_and_test(&(tsk)->usa
- #define PF_RELOCEXEC 0x00400000 /* relocate shared libraries */
-
-
-+static inline unsigned long cycles_to_clocks(cycles_t cycles)
-+{
-+ extern unsigned long cycles_per_clock;
-+ do_div(cycles, cycles_per_clock);
-+ return cycles;
-+}
-+
-+static inline u64 cycles_to_jiffies(cycles_t cycles)
-+{
-+ extern unsigned long cycles_per_jiffy;
-+ do_div(cycles, cycles_per_jiffy);
-+ return cycles;
-+}
-+
-+#ifndef CONFIG_VE
-+#define set_pn_state(tsk, state) do { } while(0)
-+#define clear_pn_state(tsk) do { } while(0)
-+#define set_sigsuspend_state(tsk, sig) do { } while(0)
-+#define clear_sigsuspend_state(tsk) do { } while(0)
-+#define set_stop_state(tsk) do { } while(0)
-+#define clear_stop_state(tsk) do { } while(0)
-+#else
-+#define PN_STOP_TF 1 /* was not in 2.6.8 */
-+#define PN_STOP_TF_RT 2 /* was not in 2.6.8 */
-+#define PN_STOP_ENTRY 3
-+#define PN_STOP_FORK 4
-+#define PN_STOP_VFORK 5
-+#define PN_STOP_SIGNAL 6
-+#define PN_STOP_EXIT 7
-+#define PN_STOP_EXEC 8
-+#define PN_STOP_LEAVE 9
-+
-+static inline void set_pn_state(struct task_struct *tsk, int state)
-+{
-+ tsk->pn_state = state;
-+}
-+
-+static inline void clear_pn_state(struct task_struct *tsk)
-+{
-+ tsk->pn_state = 0;
-+}
-+
-+static inline void set_sigsuspend_state(struct task_struct *tsk, sigset_t saveset)
-+{
-+ tsk->sigsuspend_state = 1;
-+ tsk->saved_sigset = saveset;
-+}
-+
-+static inline void clear_sigsuspend_state(struct task_struct *tsk)
-+{
-+ tsk->sigsuspend_state = 0;
-+ siginitset(&tsk->saved_sigset, 0);
-+}
-+
-+static inline void set_stop_state(struct task_struct *tsk)
-+{
-+ tsk->stopped_state = 1;
-+}
-+
-+static inline void clear_stop_state(struct task_struct *tsk)
-+{
-+ tsk->stopped_state = 0;
-+}
-+#endif
-+
- #ifdef CONFIG_SMP
- extern int set_cpus_allowed(task_t *p, cpumask_t new_mask);
- #else
-@@ -698,6 +822,7 @@ extern int task_prio(const task_t *p);
- extern int task_nice(const task_t *p);
- extern int task_curr(const task_t *p);
- extern int idle_cpu(int cpu);
-+extern task_t *idle_task(int cpu);
-
- void yield(void);
-
-@@ -726,12 +851,243 @@ extern struct task_struct init_task;
-
- extern struct mm_struct init_mm;
-
--#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr)
--extern struct task_struct *find_task_by_pid_type(int type, int pid);
-+#define find_task_by_pid_all(nr) \
-+ find_task_by_pid_type_all(PIDTYPE_PID, nr)
-+extern struct task_struct *find_task_by_pid_type_all(int type, int pid);
- extern void set_special_pids(pid_t session, pid_t pgrp);
- extern void __set_special_pids(pid_t session, pid_t pgrp);
-
-+#ifndef CONFIG_VE
-+#define find_task_by_pid_ve find_task_by_pid_all
-+
-+#define get_exec_env() NULL
-+static inline struct ve_struct * set_exec_env(struct ve_struct *new_env)
-+{
-+ return NULL;
-+}
-+#define ve_is_super(env) 1
-+#define ve_accessible(target, owner) 1
-+#define ve_accessible_strict(target, owner) 1
-+#define ve_accessible_veid(target, owner) 1
-+#define ve_accessible_strict_veid(target, owner) 1
-+
-+#define VEID(envid) 0
-+#define get_ve0() NULL
-+
-+static inline pid_t virt_pid(struct task_struct *tsk)
-+{
-+ return tsk->pid;
-+}
-+
-+static inline pid_t virt_tgid(struct task_struct *tsk)
-+{
-+ return tsk->tgid;
-+}
-+
-+static inline pid_t virt_pgid(struct task_struct *tsk)
-+{
-+ return tsk->signal->pgrp;
-+}
-+
-+static inline pid_t virt_sid(struct task_struct *tsk)
-+{
-+ return tsk->signal->session;
-+}
-+
-+static inline pid_t get_task_pid_ve(struct task_struct *tsk, struct ve_struct *ve)
-+{
-+ return tsk->pid;
-+}
-+
-+static inline pid_t get_task_pid(struct task_struct *tsk)
-+{
-+ return tsk->pid;
-+}
-+
-+static inline pid_t get_task_tgid(struct task_struct *tsk)
-+{
-+ return tsk->tgid;
-+}
-+
-+static inline pid_t get_task_pgid(struct task_struct *tsk)
-+{
-+ return tsk->signal->pgrp;
-+}
-+
-+static inline pid_t get_task_sid(struct task_struct *tsk)
-+{
-+ return tsk->signal->session;
-+}
-+
-+static inline void set_virt_pid(struct task_struct *tsk, pid_t pid)
-+{
-+}
-+
-+static inline void set_virt_tgid(struct task_struct *tsk, pid_t pid)
-+{
-+}
-+
-+static inline void set_virt_pgid(struct task_struct *tsk, pid_t pid)
-+{
-+}
-+
-+static inline void set_virt_sid(struct task_struct *tsk, pid_t pid)
-+{
-+}
-+
-+static inline pid_t get_task_ppid(struct task_struct *p)
-+{
-+ if (!pid_alive(p))
-+ return 0;
-+ return (p->pid > 1 ? p->group_leader->real_parent->pid : 0);
-+}
-+
-+#else /* CONFIG_VE */
-+
-+#include <asm/current.h>
-+#include <linux/ve.h>
-+
-+extern struct ve_struct ve0;
-+
-+#define find_task_by_pid_ve(nr) \
-+ find_task_by_pid_type_ve(PIDTYPE_PID, nr)
-+
-+extern struct task_struct *find_task_by_pid_type_ve(int type, int pid);
-+
-+#define get_ve0() (&ve0)
-+#define VEID(envid) ((envid)->veid)
-+
-+#define get_exec_env() (VE_TASK_INFO(current)->exec_env)
-+static inline struct ve_struct *set_exec_env(struct ve_struct *new_env)
-+{
-+ struct ve_struct *old_env;
-+
-+ old_env = VE_TASK_INFO(current)->exec_env;
-+ VE_TASK_INFO(current)->exec_env = new_env;
-+
-+ return old_env;
-+}
-+
-+#define ve_is_super(env) ((env) == get_ve0())
-+#define ve_accessible_strict(target, owner) ((target) == (owner))
-+static inline int ve_accessible(struct ve_struct *target,
-+ struct ve_struct *owner) {
-+ return ve_is_super(owner) || ve_accessible_strict(target, owner);
-+}
-+
-+#define ve_accessible_strict_veid(target, owner) ((target) == (owner))
-+static inline int ve_accessible_veid(envid_t target, envid_t owner)
-+{
-+ return get_ve0()->veid == owner ||
-+ ve_accessible_strict_veid(target, owner);
-+}
-+
-+static inline pid_t virt_pid(struct task_struct *tsk)
-+{
-+ return tsk->pids[PIDTYPE_PID].vnr;
-+}
-+
-+static inline pid_t virt_tgid(struct task_struct *tsk)
-+{
-+ return tsk->pids[PIDTYPE_TGID].vnr;
-+}
-+
-+static inline pid_t virt_pgid(struct task_struct *tsk)
-+{
-+ return tsk->pids[PIDTYPE_PGID].vnr;
-+}
-+
-+static inline pid_t virt_sid(struct task_struct *tsk)
-+{
-+ return tsk->pids[PIDTYPE_SID].vnr;
-+}
-+
-+static inline pid_t get_task_pid_ve(struct task_struct *tsk, struct ve_struct *env)
-+{
-+ return ve_is_super(env) ? tsk->pid : virt_pid(tsk);
-+}
-+
-+static inline pid_t get_task_pid(struct task_struct *tsk)
-+{
-+ return get_task_pid_ve(tsk, get_exec_env());
-+}
-+
-+static inline pid_t get_task_tgid(struct task_struct *tsk)
-+{
-+ return ve_is_super(get_exec_env()) ? tsk->tgid : virt_tgid(tsk);
-+}
-+
-+static inline pid_t get_task_pgid(struct task_struct *tsk)
-+{
-+ return ve_is_super(get_exec_env()) ? tsk->signal->pgrp : virt_pgid(tsk);
-+}
-+
-+static inline pid_t get_task_sid(struct task_struct *tsk)
-+{
-+ return ve_is_super(get_exec_env()) ? tsk->signal->session : virt_sid(tsk);
-+}
-+
-+static inline void set_virt_pid(struct task_struct *tsk, pid_t pid)
-+{
-+ tsk->pids[PIDTYPE_PID].vnr = pid;
-+}
-+
-+static inline void set_virt_tgid(struct task_struct *tsk, pid_t pid)
-+{
-+ tsk->pids[PIDTYPE_TGID].vnr = pid;
-+}
-+
-+static inline void set_virt_pgid(struct task_struct *tsk, pid_t pid)
-+{
-+ tsk->pids[PIDTYPE_PGID].vnr = pid;
-+}
-+
-+static inline void set_virt_sid(struct task_struct *tsk, pid_t pid)
-+{
-+ tsk->pids[PIDTYPE_SID].vnr = pid;
-+}
-+
-+static inline pid_t get_task_ppid(struct task_struct *p)
-+{
-+ struct task_struct *parent;
-+ struct ve_struct *env;
-+
-+ if (!pid_alive(p))
-+ return 0;
-+ env = get_exec_env();
-+ if (get_task_pid_ve(p, env) == 1)
-+ return 0;
-+ parent = p->group_leader->real_parent;
-+ return ve_accessible(VE_TASK_INFO(parent)->owner_env, env) ?
-+ get_task_pid_ve(parent, env) : 1;
-+}
-+
-+void ve_sched_get_cpu_stat(struct ve_struct *envid, cycles_t *idle,
-+ cycles_t *strv, unsigned int cpu);
-+void ve_sched_attach(struct ve_struct *envid);
-+
-+#endif /* CONFIG_VE */
-+
-+#if defined(CONFIG_VE)
-+extern cycles_t ve_sched_get_idle_time(struct ve_struct *, int);
-+extern cycles_t ve_sched_get_iowait_time(struct ve_struct *, int);
-+#else
-+#define ve_sched_get_idle_time(ve, cpu) 0
-+#define ve_sched_get_iowait_time(ve, cpu) 0
-+#endif
-+
-+#ifdef CONFIG_SCHED_VCPU
-+struct vcpu_scheduler;
-+extern void fastcall vsched_cpu_online_map(struct vcpu_scheduler *sched,
-+ cpumask_t *mask);
-+#else
-+#define vsched_cpu_online_map(vsched, mask) do { \
-+ *mask = cpu_online_map; \
-+ } while (0)
-+#endif
-+
- /* per-UID process charging. */
-+extern int set_user(uid_t new_ruid, int dumpclear);
- extern struct user_struct * alloc_uid(uid_t);
- static inline struct user_struct *get_uid(struct user_struct *u)
- {
-@@ -747,6 +1103,7 @@ extern unsigned long itimer_ticks;
- extern unsigned long itimer_next;
- extern void do_timer(struct pt_regs *);
-
-+extern void wake_up_init(task_t *p);
- extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
- extern int FASTCALL(wake_up_process(struct task_struct * tsk));
- extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
-@@ -803,7 +1160,7 @@ extern struct sigqueue *sigqueue_alloc(v
- extern void sigqueue_free(struct sigqueue *);
- extern int send_sigqueue(int, struct sigqueue *, struct task_struct *);
- extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
--extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *);
-+extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
- extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
-
- /* These can be the second arg to send_sig_info/send_group_sig_info. */
-@@ -882,6 +1239,9 @@ extern task_t *child_reaper;
- extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
- extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
- task_t *fork_idle(int);
-+extern struct task_struct * copy_process(unsigned long, unsigned long,
-+ struct pt_regs *, unsigned long, int __user *, int __user *,
-+ long pid, long vpid);
-
- extern void set_task_comm(struct task_struct *tsk, char *from);
- extern void get_task_comm(char *to, struct task_struct *tsk);
-@@ -907,22 +1267,98 @@ extern void wait_task_inactive(task_t *
- add_parent(p, (p)->parent); \
- } while (0)
-
--#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
--#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
-+#define next_task_all(p) list_entry((p)->tasks.next, struct task_struct, tasks)
-+#define prev_task_all(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
-
--#define for_each_process(p) \
-- for (p = &init_task ; (p = next_task(p)) != &init_task ; )
-+#define for_each_process_all(p) \
-+ for (p = &init_task ; (p = next_task_all(p)) != &init_task ; )
-
- /*
- * Careful: do_each_thread/while_each_thread is a double loop so
- * 'break' will not work as expected - use goto instead.
- */
--#define do_each_thread(g, t) \
-- for (g = t = &init_task ; (g = t = next_task(g)) != &init_task ; ) do
-+#define do_each_thread_all(g, t) \
-+ for (g = t = &init_task ; (g = t = next_task_all(g)) != &init_task ; ) do
-
--#define while_each_thread(g, t) \
-+#define while_each_thread_all(g, t) \
- while ((t = next_thread(t)) != g)
-
-+#ifndef CONFIG_VE
-+
-+#define SET_VE_LINKS(p)
-+#define REMOVE_VE_LINKS(p)
-+#define for_each_process_ve(p) for_each_process_all(p)
-+#define do_each_thread_ve(g, t) do_each_thread_all(g, t)
-+#define while_each_thread_ve(g, t) while_each_thread_all(g, t)
-+#define first_task_ve() next_task_ve(&init_task)
-+#define next_task_ve(p) \
-+ (next_task_all(p) != &init_task ? next_task_all(p) : NULL)
-+
-+#else /* CONFIG_VE */
-+
-+#define SET_VE_LINKS(p) \
-+ do { \
-+ if (thread_group_leader(p)) \
-+ list_add_tail(&VE_TASK_INFO(p)->vetask_list, \
-+ &VE_TASK_INFO(p)->owner_env->vetask_lh); \
-+ } while (0)
-+
-+#define REMOVE_VE_LINKS(p) \
-+ do { \
-+ if (thread_group_leader(p)) \
-+ list_del(&VE_TASK_INFO(p)->vetask_list); \
-+ } while(0)
-+
-+static inline task_t* __first_task_ve(struct ve_struct *ve)
-+{
-+ task_t *tsk;
-+
-+ if (unlikely(ve_is_super(ve))) {
-+ tsk = next_task_all(&init_task);
-+ if (tsk == &init_task)
-+ tsk = NULL;
-+ } else {
-+ /* probably can return ve->init_entry, but it's more clear */
-+ BUG_ON(list_empty(&ve->vetask_lh));
-+ tsk = VE_TASK_LIST_2_TASK(ve->vetask_lh.next);
-+ }
-+ return tsk;
-+}
-+
-+static inline task_t* __next_task_ve(struct ve_struct *ve, task_t *tsk)
-+{
-+ if (unlikely(ve_is_super(ve))) {
-+ tsk = next_task_all(tsk);
-+ if (tsk == &init_task)
-+ tsk = NULL;
-+ } else {
-+ struct list_head *tmp;
-+
-+ BUG_ON(VE_TASK_INFO(tsk)->owner_env != ve);
-+ tmp = VE_TASK_INFO(tsk)->vetask_list.next;
-+ if (tmp == &ve->vetask_lh)
-+ tsk = NULL;
-+ else
-+ tsk = VE_TASK_LIST_2_TASK(tmp);
-+ }
-+ return tsk;
-+}
-+
-+#define first_task_ve() __first_task_ve(get_exec_env())
-+#define next_task_ve(p) __next_task_ve(get_exec_env(), p)
-+/* no one uses prev_task_ve(), copy next_task_ve() if needed */
-+
-+#define for_each_process_ve(p) \
-+ for (p = first_task_ve(); p != NULL ; p = next_task_ve(p))
-+
-+#define do_each_thread_ve(g, t) \
-+ for (g = t = first_task_ve() ; g != NULL; g = t = next_task_ve(g)) do
-+
-+#define while_each_thread_ve(g, t) \
-+ while ((t = next_thread(t)) != g)
-+
-+#endif /* CONFIG_VE */
-+
- extern task_t * FASTCALL(next_thread(const task_t *p));
-
- #define thread_group_leader(p) (p->pid == p->tgid)
-@@ -1045,28 +1481,61 @@ extern void signal_wake_up(struct task_s
- */
- #ifdef CONFIG_SMP
-
--static inline unsigned int task_cpu(const struct task_struct *p)
-+static inline unsigned int task_pcpu(const struct task_struct *p)
- {
- return p->thread_info->cpu;
- }
-
--static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
-+static inline void set_task_pcpu(struct task_struct *p, unsigned int cpu)
- {
- p->thread_info->cpu = cpu;
- }
-
- #else
-
-+static inline unsigned int task_pcpu(const struct task_struct *p)
-+{
-+ return 0;
-+}
-+
-+static inline void set_task_pcpu(struct task_struct *p, unsigned int cpu)
-+{
-+}
-+
-+#endif /* CONFIG_SMP */
-+
-+#ifdef CONFIG_SCHED_VCPU
-+
-+static inline unsigned int task_vsched_id(const struct task_struct *p)
-+{
-+ return p->vsched_id;
-+}
-+
- static inline unsigned int task_cpu(const struct task_struct *p)
- {
-+ return p->vcpu_id;
-+}
-+
-+extern void set_task_cpu(struct task_struct *p, unsigned int vcpu);
-+
-+#else
-+
-+static inline unsigned int task_vsched_id(const struct task_struct *p)
-+{
- return 0;
- }
-
-+static inline unsigned int task_cpu(const struct task_struct *p)
-+{
-+ return task_pcpu(p);
-+}
-+
- static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
- {
-+ set_task_pcpu(p, cpu);
- }
-
--#endif /* CONFIG_SMP */
-+#endif /* CONFIG_SCHED_VCPU */
-
- #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
- extern void arch_pick_mmap_layout(struct mm_struct *mm);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/security.h linux-2.6.9-ve023stab030/include/linux/security.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/security.h 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/security.h 2006-10-11 19:07:57.000000000 +0400
-@@ -62,7 +62,8 @@ static inline int cap_netlink_send (stru
-
- static inline int cap_netlink_recv (struct sk_buff *skb)
- {
-- if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
-+ if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_VE_NET_ADMIN) &&
-+ !cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
- return -EPERM;
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/shm.h linux-2.6.9-ve023stab030/include/linux/shm.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/shm.h 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/shm.h 2006-10-11 19:07:57.000000000 +0400
-@@ -73,6 +73,8 @@ struct shm_info {
- };
-
- #ifdef __KERNEL__
-+struct user_beancounter;
-+
- struct shmid_kernel /* private to the kernel */
- {
- struct kern_ipc_perm shm_perm;
-@@ -86,8 +88,12 @@ struct shmid_kernel /* private to the ke
- pid_t shm_cprid;
- pid_t shm_lprid;
- struct user_struct *mlock_user;
-+ struct user_beancounter *shmidk_ub;
-+ struct ipc_ids *_shm_ids;
- };
-
-+#define shmid_ub(__shmid) (__shmid)->shmidk_ub
-+
- /* shm_mode upper byte flags */
- #define SHM_DEST 01000 /* segment will be destroyed on last detach */
- #define SHM_LOCKED 02000 /* segment will not be swapped */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/shmem_fs.h linux-2.6.9-ve023stab030/include/linux/shmem_fs.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/shmem_fs.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/shmem_fs.h 2006-10-11 19:07:56.000000000 +0400
-@@ -8,6 +8,8 @@
-
- #define SHMEM_NR_DIRECT 16
-
-+struct user_beancounter;
-+
- struct shmem_inode_info {
- spinlock_t lock;
- unsigned long flags;
-@@ -19,8 +21,11 @@ struct shmem_inode_info {
- swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
- struct list_head swaplist; /* chain of maybes on swap */
- struct inode vfs_inode;
-+ struct user_beancounter *info_ub;
- };
-
-+#define shm_info_ub(__shmi) (__shmi)->info_ub
-+
- struct shmem_sb_info {
- unsigned long max_blocks; /* How many blocks are allowed */
- unsigned long free_blocks; /* How many are left for allocation */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/signal.h linux-2.6.9-ve023stab030/include/linux/signal.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/signal.h 2004-10-19 01:53:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/signal.h 2006-10-11 19:07:56.000000000 +0400
-@@ -14,14 +14,19 @@
- * Real Time signals may be queued.
- */
-
-+struct user_beancounter;
-+
- struct sigqueue {
- struct list_head list;
- spinlock_t *lock;
- int flags;
- siginfo_t info;
- struct user_struct *user;
-+ struct user_beancounter *sig_ub;
- };
-
-+#define sig_ub(__q) ((__q)->sig_ub)
-+
- /* flags values. */
- #define SIGQUEUE_PREALLOC 1
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/skbuff.h linux-2.6.9-ve023stab030/include/linux/skbuff.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/skbuff.h 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/skbuff.h 2006-10-11 19:07:57.000000000 +0400
-@@ -19,6 +19,7 @@
- #include <linux/compiler.h>
- #include <linux/time.h>
- #include <linux/cache.h>
-+#include <linux/ve_owner.h>
-
- #include <asm/atomic.h>
- #include <asm/types.h>
-@@ -189,6 +190,8 @@ struct skb_shared_info {
- * @tc_index: Traffic control index
- */
-
-+#include <ub/ub_sk.h>
-+
- struct sk_buff {
- /* These two members must be first. */
- struct sk_buff *next;
-@@ -280,13 +283,18 @@ struct sk_buff {
- *data,
- *tail,
- *end;
-+ struct skb_beancounter skb_bc;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(SKB, SLAB, struct sk_buff, owner_env, , (noinline, regparm(1)))
-+
- #ifdef __KERNEL__
- /*
- * Handling routines are only of interest to the kernel
- */
- #include <linux/slab.h>
-+#include <ub/ub_net.h>
-
- #include <asm/system.h>
-
-@@ -897,6 +905,8 @@ static inline int pskb_trim(struct sk_bu
- */
- static inline void skb_orphan(struct sk_buff *skb)
- {
-+ ub_skb_uncharge(skb);
-+
- if (skb->destructor)
- skb->destructor(skb);
- skb->destructor = NULL;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/slab.h linux-2.6.9-ve023stab030/include/linux/slab.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/slab.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/slab.h 2006-10-11 19:08:01.000000000 +0400
-@@ -48,6 +48,27 @@ typedef struct kmem_cache_s kmem_cache_t
- #define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */
- #define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */
-
-+/*
-+ * allocation rules: __GFP_UBC 0
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ * cache (SLAB_UBC) charge charge
-+ * (usual caches: mm, vma, task_struct, ...)
-+ *
-+ * cache (SLAB_UBC | SLAB_NO_CHARGE) charge ---
-+ * (ub_kmalloc) (kmalloc)
-+ *
-+ * cache (no UB flags) BUG() ---
-+ * (nonub caches, mempools)
-+ *
-+ * pages charge ---
-+ * (ub_vmalloc, (vmalloc,
-+ * poll, fdsets, ...) non-ub allocs)
-+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+ */
-+#define SLAB_UBC 0x20000000UL /* alloc space for ubs ... */
-+#define SLAB_NO_CHARGE 0x40000000UL /* ... but don't charge */
-+
-+
- /* flags passed to a constructor func */
- #define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */
- #define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */
-@@ -73,11 +94,12 @@ struct cache_sizes {
- kmem_cache_t *cs_dmacachep;
- };
- extern struct cache_sizes malloc_sizes[];
-+extern int malloc_cache_num;
- extern void *__kmalloc(size_t, int);
-
- static inline void *kmalloc(size_t size, int flags)
- {
-- if (__builtin_constant_p(size)) {
-+ if (__builtin_constant_p(size) && __builtin_constant_p(flags)) {
- int i = 0;
- #define CACHE(x) \
- if (size <= x) \
-@@ -91,6 +113,8 @@ static inline void *kmalloc(size_t size,
- __you_cannot_kmalloc_that_much();
- }
- found:
-+ if (flags & __GFP_UBC)
-+ i += malloc_cache_num;
- return kmem_cache_alloc((flags & GFP_DMA) ?
- malloc_sizes[i].cs_dmacachep :
- malloc_sizes[i].cs_cachep, flags);
-@@ -121,6 +145,8 @@ extern kmem_cache_t *bio_cachep;
-
- extern atomic_t slab_reclaim_pages;
-
-+void show_slab_info(void);
-+
- #endif /* __KERNEL__ */
-
- #endif /* _LINUX_SLAB_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/socket.h linux-2.6.9-ve023stab030/include/linux/socket.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/socket.h 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/socket.h 2006-10-11 19:07:57.000000000 +0400
-@@ -290,6 +290,7 @@ extern void memcpy_tokerneliovec(struct
- extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ulen);
- extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr);
- extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
-+extern int vz_security_proto_check(int family, int type, int protocol);
-
- struct socket;
- struct file * sock_map_file(struct socket *sock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/stop_machine.h linux-2.6.9-ve023stab030/include/linux/stop_machine.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/stop_machine.h 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/stop_machine.h 2006-10-11 19:08:02.000000000 +0400
-@@ -8,6 +8,8 @@
- #include <linux/cpu.h>
- #include <asm/system.h>
-
-+void stop_machine_show_state(void);
-+
- #ifdef CONFIG_SMP
- /**
- * stop_machine_run: freeze the machine on all CPUs and run this function
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/suspend.h linux-2.6.9-ve023stab030/include/linux/suspend.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/suspend.h 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/suspend.h 2006-10-11 19:07:55.000000000 +0400
-@@ -45,7 +45,7 @@ static inline int software_suspend(void)
-
-
- #ifdef CONFIG_PM
--extern void refrigerator(unsigned long);
-+extern void refrigerator(void);
- extern int freeze_processes(void);
- extern void thaw_processes(void);
-
-@@ -53,7 +53,7 @@ extern int pm_prepare_console(void);
- extern void pm_restore_console(void);
-
- #else
--static inline void refrigerator(unsigned long flag) {}
-+static inline void refrigerator(void) {}
- #endif /* CONFIG_PM */
-
- #ifdef CONFIG_SMP
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/swap.h linux-2.6.9-ve023stab030/include/linux/swap.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/swap.h 2004-10-19 01:53:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/swap.h 2006-10-11 19:07:58.000000000 +0400
-@@ -13,6 +13,7 @@
- #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
- #define SWAP_FLAG_PRIO_MASK 0x7fff
- #define SWAP_FLAG_PRIO_SHIFT 0
-+#define SWAP_FLAG_READONLY 0x40000000 /* set if swap is read-only */
-
- static inline int current_is_kswapd(void)
- {
-@@ -79,6 +80,7 @@ struct address_space;
- struct sysinfo;
- struct writeback_control;
- struct zone;
-+struct user_beancounter;
-
- /*
- * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of
-@@ -106,6 +108,7 @@ enum {
- SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
- SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
- SWP_ACTIVE = (SWP_USED | SWP_WRITEOK),
-+ SWP_READONLY = (1 << 2)
- };
-
- #define SWAP_CLUSTER_MAX 32
-@@ -118,6 +121,8 @@ enum {
- * extent_list.prev points at the lowest-index extent. That list is
- * sorted.
- */
-+struct user_beancounter;
-+
- struct swap_info_struct {
- unsigned int flags;
- spinlock_t sdev_lock;
-@@ -132,6 +137,7 @@ struct swap_info_struct {
- unsigned int highest_bit;
- unsigned int cluster_next;
- unsigned int cluster_nr;
-+ struct user_beancounter **owner_map;
- int prio; /* swap priority */
- int pages;
- unsigned long max;
-@@ -148,7 +154,8 @@ struct swap_list_t {
- #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
-
- /* linux/mm/oom_kill.c */
--extern void out_of_memory(int gfp_mask);
-+struct oom_freeing_stat;
-+extern void out_of_memory(struct oom_freeing_stat *, int gfp_mask);
-
- /* linux/mm/memory.c */
- extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
-@@ -161,6 +168,7 @@ extern unsigned int nr_free_pages(void);
- extern unsigned int nr_free_pages_pgdat(pg_data_t *pgdat);
- extern unsigned int nr_free_buffer_pages(void);
- extern unsigned int nr_free_pagecache_pages(void);
-+extern unsigned int nr_lowmem_pages(void);
-
- /* linux/mm/swap.c */
- extern void FASTCALL(lru_cache_add(struct page *));
-@@ -194,6 +202,7 @@ extern struct address_space swapper_spac
- #define total_swapcache_pages swapper_space.nrpages
- extern void show_swap_cache_info(void);
- extern int add_to_swap(struct page *);
-+extern int add_to_swap_cache(struct page *page, swp_entry_t entry);
- extern void __delete_from_swap_cache(struct page *);
- extern void delete_from_swap_cache(struct page *);
- extern int move_to_swap_cache(struct page *, swp_entry_t);
-@@ -209,7 +218,7 @@ extern long total_swap_pages;
- extern unsigned int nr_swapfiles;
- extern struct swap_info_struct swap_info[];
- extern void si_swapinfo(struct sysinfo *);
--extern swp_entry_t get_swap_page(void);
-+extern swp_entry_t get_swap_page(struct user_beancounter *);
- extern int swap_duplicate(swp_entry_t);
- extern int valid_swaphandles(swp_entry_t, unsigned long *);
- extern void swap_free(swp_entry_t);
-@@ -218,6 +227,7 @@ extern sector_t map_swap_page(struct swa
- extern struct swap_info_struct *get_swap_info_struct(unsigned);
- extern int can_share_swap_page(struct page *);
- extern int remove_exclusive_swap_page(struct page *);
-+extern int try_to_remove_exclusive_swap_page(struct page *);
- struct backing_dev_info;
-
- extern struct swap_list_t swap_list;
-@@ -274,7 +284,7 @@ static inline int remove_exclusive_swap_
- return 0;
- }
-
--static inline swp_entry_t get_swap_page(void)
-+static inline swp_entry_t get_swap_page(struct user_beancounter *ub)
- {
- swp_entry_t entry;
- entry.val = 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/sysctl.h linux-2.6.9-ve023stab030/include/linux/sysctl.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/sysctl.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/sysctl.h 2006-10-11 19:08:01.000000000 +0400
-@@ -139,6 +139,14 @@ enum
- KERN_SERCONS_ESC=68, /* int: ascii code of ser-cons "break" or -1 */
- KERN_PANIC_ON_NMI=69, /* int: whether we will panic on an unrecovered */
- KERN_WAKE_BALANCE=70, /* int: behavior of load balancing on wakeup */
-+ KERN_SILENCE_LEVEL=69, /* int: Console silence loglevel */
-+ KERN_ALLOC_FAIL_WARN=70, /* int: whether we'll print "alloc failure" */
-+ KERN_FAIRSCHED_MAX_LATENCY=201, /* int: Max start_tag delta */
-+ KERN_VCPU_SCHED_TIMESLICE=202,
-+ KERN_VCPU_TIMESLICE=203,
-+ KERN_VIRT_PIDS=204, /* int: VE pids virtualization */
-+ KERN_VIRT_OSRELEASE=205,/* virtualization of utsname.release */
-+ KERN_SCALE_VCPU_FREQUENCY=206, /* Scale cpu frequency inside VE */
- };
-
-
-@@ -331,6 +339,7 @@ enum
- NET_TCP_RMEM=85,
- NET_TCP_APP_WIN=86,
- NET_TCP_ADV_WIN_SCALE=87,
-+ NET_TCP_USE_SG=245,
- NET_IPV4_NONLOCAL_BIND=88,
- NET_IPV4_ICMP_RATELIMIT=89,
- NET_IPV4_ICMP_RATEMASK=90,
-@@ -353,10 +362,13 @@ enum
- NET_TCP_TSO_WIN_DIVISOR=107,
- NET_TCP_BIC_BETA=108,
- NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
-+ NET_TCP_MAX_TW_BUCKETS_VE=151,
-+ NET_TCP_MAX_TW_KMEM_FRACTION=152,
- };
-
- enum {
- NET_IPV4_ROUTE_FLUSH=1,
-+ NET_IPV4_ROUTE_SRC_CHECK=188,
- NET_IPV4_ROUTE_MIN_DELAY=2,
- NET_IPV4_ROUTE_MAX_DELAY=3,
- NET_IPV4_ROUTE_GC_THRESH=4,
-@@ -728,6 +740,12 @@ enum
- FS_XFS=17, /* struct: control xfs parameters */
- FS_AIO_NR=18, /* current system-wide number of aio requests */
- FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
-+ FS_AT_VSYSCALL=20, /* int: to announce vsyscall data */
-+};
-+
-+/* /proc/sys/debug */
-+enum {
-+ DBG_DECODE_CALLTRACES = 1, /* int: decode call traces on oops */
- };
-
- /* /proc/sys/fs/quota/ */
-@@ -858,6 +876,8 @@ extern int proc_doulongvec_minmax(ctl_ta
- void __user *, size_t *, loff_t *);
- extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int,
- struct file *, void __user *, size_t *, loff_t *);
-+extern int proc_doutsstring(ctl_table *table, int write, struct file *,
-+ void __user *, size_t *, loff_t *);
-
- extern int do_sysctl (int __user *name, int nlen,
- void __user *oldval, size_t __user *oldlenp,
-@@ -911,6 +931,8 @@ extern ctl_handler sysctl_jiffies;
- */
-
- /* A sysctl table is an array of struct ctl_table: */
-+struct ve_struct;
-+
- struct ctl_table
- {
- int ctl_name; /* Binary ID */
-@@ -924,6 +946,7 @@ struct ctl_table
- struct proc_dir_entry *de; /* /proc control block */
- void *extra1;
- void *extra2;
-+ struct ve_struct *owner_env;
- };
-
- /* struct ctl_table_header is used to maintain dynamic lists of
-@@ -942,6 +965,9 @@ struct ctl_table_header * register_sysct
- int insert_at_head);
- void unregister_sysctl_table(struct ctl_table_header * table);
-
-+ctl_table *clone_sysctl_template(ctl_table *tmpl, int nr);
-+void free_sysctl_clone(ctl_table *clone);
-+
- #else /* __KERNEL__ */
-
- #endif /* __KERNEL__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/sysrq.h linux-2.6.9-ve023stab030/include/linux/sysrq.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/sysrq.h 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/sysrq.h 2006-10-11 19:07:55.000000000 +0400
-@@ -29,6 +29,12 @@ struct sysrq_key_op {
- * are available -- else NULL's).
- */
-
-+#ifdef CONFIG_SYSRQ_DEBUG
-+int sysrq_eat_all(void);
-+#else
-+#define sysrq_eat_all() (0)
-+#endif
-+
- void handle_sysrq(int, struct pt_regs *, struct tty_struct *);
- void __handle_sysrq(int, struct pt_regs *, struct tty_struct *);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/tcp.h linux-2.6.9-ve023stab030/include/linux/tcp.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/tcp.h 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/tcp.h 2006-10-11 19:07:55.000000000 +0400
-@@ -212,6 +212,27 @@ enum tcp_congestion_algo {
- TCP_BIC,
- };
-
-+struct tcp_options_received {
-+ /* PAWS/RTTM data */
-+ long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
-+ __u32 ts_recent; /* Time stamp to echo next */
-+ __u32 rcv_tsval; /* Time stamp value */
-+ __u32 rcv_tsecr; /* Time stamp echo reply */
-+ char saw_tstamp; /* Saw TIMESTAMP on last packet */
-+ char tstamp_ok; /* TIMESTAMP seen on SYN packet */
-+ char sack_ok; /* SACK seen on SYN packet */
-+ char wscale_ok; /* Wscale seen on SYN packet */
-+ __u8 snd_wscale; /* Window scaling received from sender */
-+ __u8 rcv_wscale; /* Window scaling to send to receiver */
-+ /* SACKs data */
-+ __u8 dsack; /* D-SACK is scheduled */
-+ __u8 eff_sacks; /* Size of SACK array to send with next packet */
-+ __u8 num_sacks; /* Number of SACK blocks */
-+ __u8 __pad;
-+ __u16 user_mss; /* mss requested by user in ioctl */
-+ __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
-+};
-+
- struct tcp_opt {
- int tcp_header_len; /* Bytes of tcp header to send */
-
-@@ -262,22 +283,19 @@ struct tcp_opt {
- __u32 pmtu_cookie; /* Last pmtu seen by socket */
- __u32 mss_cache; /* Cached effective mss, not including SACKS */
- __u16 mss_cache_std; /* Like mss_cache, but without TSO */
-- __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
- __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
- __u16 ext2_header_len;/* Options depending on route */
- __u8 ca_state; /* State of fast-retransmit machine */
- __u8 retransmits; /* Number of unrecovered RTO timeouts. */
-+ __u32 frto_highmark; /* snd_nxt when RTO occurred */
-
- __u8 reordering; /* Packet reordering metric. */
- __u8 frto_counter; /* Number of new acks after RTO */
-- __u32 frto_highmark; /* snd_nxt when RTO occurred */
-
- __u8 adv_cong; /* Using Vegas, Westwood, or BIC */
- __u8 defer_accept; /* User waits for some data after accept() */
-- /* one byte hole, try to pack */
-
- /* RTT measurement */
-- __u8 backoff; /* backoff */
- __u32 srtt; /* smoothed round trip time << 3 */
- __u32 mdev; /* medium deviation */
- __u32 mdev_max; /* maximal mdev for the last rtt period */
-@@ -288,6 +306,15 @@ struct tcp_opt {
- tcp_pcount_t packets_out; /* Packets which are "in flight" */
- tcp_pcount_t left_out; /* Packets which leaved network */
- tcp_pcount_t retrans_out; /* Retransmitted packets out */
-+ __u8 backoff; /* backoff */
-+/*
-+ * Options received (usually on last packet, some only on SYN packets).
-+ */
-+ __u8 nonagle; /* Disable Nagle algorithm? */
-+ __u8 keepalive_probes; /* num of allowed keep alive probes */
-+
-+ __u8 probes_out; /* unanswered 0 window probes */
-+ struct tcp_options_received rx_opt;
-
-
- /*
-@@ -314,40 +341,19 @@ struct tcp_opt {
- __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
- __u32 pushed_seq; /* Last pushed seq, required to talk to windows */
- __u32 copied_seq; /* Head of yet unread data */
--/*
-- * Options received (usually on last packet, some only on SYN packets).
-- */
-- char tstamp_ok, /* TIMESTAMP seen on SYN packet */
-- wscale_ok, /* Wscale seen on SYN packet */
-- sack_ok; /* SACK seen on SYN packet */
-- char saw_tstamp; /* Saw TIMESTAMP on last packet */
-- __u8 snd_wscale; /* Window scaling received from sender */
-- __u8 rcv_wscale; /* Window scaling to send to receiver */
-- __u8 nonagle; /* Disable Nagle algorithm? */
-- __u8 keepalive_probes; /* num of allowed keep alive probes */
--
--/* PAWS/RTTM data */
-- __u32 rcv_tsval; /* Time stamp value */
-- __u32 rcv_tsecr; /* Time stamp echo reply */
-- __u32 ts_recent; /* Time stamp to echo next */
-- long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
-
- /* SACKs data */
-- __u16 user_mss; /* mss requested by user in ioctl */
-- __u8 dsack; /* D-SACK is scheduled */
-- __u8 eff_sacks; /* Size of SACK array to send with next packet */
- struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
- struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
-
- __u32 window_clamp; /* Maximal window to advertise */
- __u32 rcv_ssthresh; /* Current window clamp */
-- __u8 probes_out; /* unanswered 0 window probes */
-- __u8 num_sacks; /* Number of SACK blocks */
- __u16 advmss; /* Advertised MSS */
-
- __u8 syn_retries; /* num of allowed syn retries */
- __u8 ecn_flags; /* ECN status bits. */
- __u16 prior_ssthresh; /* ssthresh saved at recovery start */
-+ __u16 __pad1;
- tcp_pcount_t lost_out; /* Lost packets */
- tcp_pcount_t sacked_out;/* SACK'd packets */
- tcp_pcount_t fackets_out;/* FACK'd packets */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/tty.h linux-2.6.9-ve023stab030/include/linux/tty.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/tty.h 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/tty.h 2006-10-11 19:07:57.000000000 +0400
-@@ -239,6 +239,8 @@ struct device;
- * size each time the window is created or resized anyway.
- * - TYT, 9/14/92
- */
-+struct user_beancounter;
-+
- struct tty_struct {
- int magic;
- struct tty_driver *driver;
-@@ -294,8 +296,12 @@ struct tty_struct {
- spinlock_t read_lock;
- /* If the tty has a pending do_SAK, queue it here - akpm */
- struct work_struct SAK_work;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(TTY, TAIL_SOFT, struct tty_struct, owner_env, , ())
-+#define tty_ub(__tty) (slab_ub(__tty))
-+
- /* tty magic number */
- #define TTY_MAGIC 0x5401
-
-@@ -323,6 +329,7 @@ struct tty_struct {
- #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
- #define TTY_HUPPED 18 /* Post driver->hangup() */
- #define TTY_OPENED 19 /* set by initial driver->open call */
-+#define TTY_CHARGED 20
-
- #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/tty_driver.h linux-2.6.9-ve023stab030/include/linux/tty_driver.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/tty_driver.h 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/tty_driver.h 2006-10-11 19:07:57.000000000 +0400
-@@ -115,6 +115,7 @@
- * character to the device.
- */
-
-+#include <linux/ve_owner.h>
- #include <linux/fs.h>
- #include <linux/list.h>
- #include <linux/cdev.h>
-@@ -214,14 +215,21 @@ struct tty_driver {
- unsigned int set, unsigned int clear);
-
- struct list_head tty_drivers;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(TTYDRV, TAIL_SOFT, struct tty_driver, owner_env, , ())
-+
- extern struct list_head tty_drivers;
-+extern rwlock_t tty_driver_guard;
-
- struct tty_driver *alloc_tty_driver(int lines);
- void put_tty_driver(struct tty_driver *driver);
- void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
-
-+struct class_simple *init_ve_tty_class(void);
-+void fini_ve_tty_class(struct class_simple *ve_tty_class);
-+
- /* tty driver magic number */
- #define TTY_DRIVER_MAGIC 0x5402
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/ve.h linux-2.6.9-ve023stab030/include/linux/ve.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/ve.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/ve.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,337 @@
-+/*
-+ * include/linux/ve.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _LINUX_VE_H
-+#define _LINUX_VE_H
-+
-+#include <linux/config.h>
-+
-+#ifndef __ENVID_T_DEFINED__
-+typedef unsigned envid_t;
-+#define __ENVID_T_DEFINED__
-+#endif
-+
-+#include <linux/types.h>
-+#include <linux/capability.h>
-+#include <linux/utsname.h>
-+#include <linux/sysctl.h>
-+#include <linux/vzstat.h>
-+#include <linux/kobject.h>
-+
-+#ifdef VZMON_DEBUG
-+# define VZTRACE(fmt,args...) \
-+ printk(KERN_DEBUG fmt, ##args)
-+#else
-+# define VZTRACE(fmt,args...)
-+#endif /* VZMON_DEBUG */
-+
-+struct tty_driver;
-+struct devpts_config;
-+struct task_struct;
-+struct new_utsname;
-+struct file_system_type;
-+struct icmp_mib;
-+struct ip_mib;
-+struct tcp_mib;
-+struct udp_mib;
-+struct linux_mib;
-+struct fib_info;
-+struct fib_rule;
-+struct veip_struct;
-+struct ve_monitor;
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+struct fib_table;
-+struct devcnfv4_struct;
-+#ifdef CONFIG_VE_IPTABLES
-+struct ipt_filter_initial_table;
-+struct ipt_nat_initial_table;
-+struct ipt_table;
-+struct ip_conntrack;
-+struct nf_hook_ops;
-+struct ve_ip_conntrack {
-+ struct list_head *_ip_conntrack_hash;
-+ struct list_head _ip_conntrack_expect_list;
-+ struct list_head _ip_conntrack_helpers;
-+ struct ip_conntrack_protocol **_ip_ct_protos;
-+ int _ip_conntrack_max;
-+ unsigned long _ip_ct_tcp_timeouts[10];
-+ unsigned long _ip_ct_udp_timeout;
-+ unsigned long _ip_ct_udp_timeout_stream;
-+ unsigned long _ip_ct_icmp_timeout;
-+ unsigned long _ip_ct_generic_timeout;
-+ atomic_t _ip_conntrack_count;
-+ void (*_ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
-+#ifdef CONFIG_SYSCTL
-+ unsigned int _ip_ct_log_invalid;
-+ unsigned long _ip_ct_tcp_timeout_max_retrans;
-+ int _ip_ct_tcp_loose;
-+ int _ip_ct_tcp_be_liberal;
-+ int _ip_ct_tcp_max_retrans;
-+ struct ctl_table_header *_ip_ct_sysctl_header;
-+ ctl_table *_ip_ct_net_table;
-+ ctl_table *_ip_ct_ipv4_table;
-+ ctl_table *_ip_ct_netfilter_table;
-+ ctl_table *_ip_ct_sysctl_table;
-+#endif /*CONFIG_SYSCTL*/
-+
-+ int _ip_conntrack_ftp_ports_c;
-+ int _ip_conntrack_irc_ports_c;
-+
-+ struct list_head _ip_nat_helpers;
-+ struct list_head *_ip_nat_bysource;
-+ struct ipt_nat_initial_table *_ip_nat_initial_table;
-+ struct ipt_table *_ip_nat_table;
-+ struct ip_nat_protocol **_ip_nat_protos;
-+
-+ int _ip_nat_ftp_ports_c;
-+ int _ip_nat_irc_ports_c;
-+
-+ /* resource accounting */
-+ struct user_beancounter *ub;
-+};
-+#endif
-+#endif
-+
-+#define UIDHASH_BITS_VE 6
-+#define UIDHASH_SZ_VE (1 << UIDHASH_BITS_VE)
-+
-+struct ve_cpu_stats {
-+ cycles_t idle_time;
-+ cycles_t iowait_time;
-+ cycles_t strt_idle_time;
-+ cycles_t used_time;
-+ seqcount_t stat_lock;
-+ int nr_running;
-+ int nr_unint;
-+ u64 user;
-+ u64 nice;
-+ u64 system;
-+} ____cacheline_aligned;
-+
-+struct ve_struct {
-+ struct ve_struct *prev;
-+ struct ve_struct *next;
-+
-+ envid_t veid;
-+ struct task_struct *init_entry;
-+ struct list_head vetask_lh;
-+ kernel_cap_t cap_default;
-+ atomic_t pcounter;
-+ /* ref counter to ve from ipc */
-+ atomic_t counter;
-+ unsigned int class_id;
-+ struct veip_struct *veip;
-+ struct rw_semaphore op_sem;
-+ int is_running;
-+ int is_locked;
-+ atomic_t suspend;
-+ int virt_pids;
-+ /* see vzcalluser.h for VE_FEATURE_XXX definitions */
-+ __u64 features;
-+
-+/* VE's root */
-+ struct vfsmount *fs_rootmnt;
-+ struct dentry *fs_root;
-+
-+/* sysctl */
-+ struct new_utsname *utsname;
-+ struct list_head sysctl_lh;
-+ struct ctl_table_header *kern_header;
-+ struct ctl_table *kern_table;
-+ struct ctl_table_header *quota_header;
-+ struct ctl_table *quota_table;
-+ struct file_system_type *proc_fstype;
-+ struct vfsmount *proc_mnt;
-+ struct proc_dir_entry *proc_root;
-+ struct proc_dir_entry *proc_sys_root;
-+
-+ int _sysctl_local_port_range[2];
-+ int _tcp_port_rover;
-+
-+/* SYSV IPC */
-+ struct ipc_ids *_shm_ids;
-+ struct ipc_ids *_msg_ids;
-+ struct ipc_ids *_sem_ids;
-+ int _used_sems;
-+ int _shm_tot;
-+ size_t _shm_ctlmax;
-+ size_t _shm_ctlall;
-+ int _shm_ctlmni;
-+ int _msg_ctlmax;
-+ int _msg_ctlmni;
-+ int _msg_ctlmnb;
-+ int _sem_ctls[4];
-+
-+/* BSD pty's */
-+ struct tty_driver *pty_driver;
-+ struct tty_driver *pty_slave_driver;
-+
-+#ifdef CONFIG_UNIX98_PTYS
-+ struct tty_driver *ptm_driver;
-+ struct tty_driver *pts_driver;
-+ struct idr *allocated_ptys;
-+#endif
-+ struct file_system_type *devpts_fstype;
-+ struct vfsmount *devpts_mnt;
-+ struct dentry *devpts_root;
-+ struct devpts_config *devpts_config;
-+
-+ struct file_system_type *shmem_fstype;
-+ struct vfsmount *shmem_mnt;
-+#ifdef CONFIG_SYSFS
-+ struct file_system_type *sysfs_fstype;
-+ struct vfsmount *sysfs_mnt;
-+ struct super_block *sysfs_sb;
-+ struct sysfs_dirent *sysfs_root;
-+#endif
-+ struct subsystem *class_subsys;
-+ struct subsystem *class_obj_subsys;
-+ struct list_head _simple_dev_list;
-+ struct class *net_class;
-+ struct class_simple *tty_class;
-+
-+/* User uids hash */
-+ struct list_head uidhash_table[UIDHASH_SZ_VE];
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ struct hlist_head _net_dev_head;
-+ struct hlist_head _net_dev_index_head;
-+ struct net_device *_net_dev_base, **_net_dev_tail;
-+ int ifindex;
-+ struct net_device *_loopback_dev;
-+ struct net_device_stats *_loopback_stats;
-+ struct net_device *_venet_dev;
-+ struct ipv4_devconf *_ipv4_devconf;
-+ struct ipv4_devconf *_ipv4_devconf_dflt;
-+ struct ctl_table_header *forward_header;
-+ struct ctl_table *forward_table;
-+#endif
-+ unsigned long rt_flush_required;
-+
-+ struct neigh_table *ve_nd_tbl;
-+ struct neigh_table *ve_arp_tbl;
-+
-+/* per VE CPU stats*/
-+ struct timespec start_timespec;
-+ u64 start_jiffies; /* Deprecated */
-+ cycles_t start_cycles;
-+ unsigned long avenrun[3]; /* loadavg data */
-+
-+ cycles_t cpu_used_ve;
-+ struct kstat_lat_pcpu_struct sched_lat_ve;
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ struct hlist_head *_fib_info_hash;
-+ struct hlist_head *_fib_info_laddrhash;
-+ int _fib_hash_size;
-+ int _fib_info_cnt;
-+
-+ struct fib_rule *_local_rule;
-+ struct fib_rule *_fib_rules;
-+#ifdef CONFIG_IP_MULTIPLE_TABLES
-+ /* XXX: why a magic constant? */
-+ struct fib_table *_fib_tables[256]; /* RT_TABLE_MAX - for now */
-+#else
-+ struct fib_table *_main_table;
-+ struct fib_table *_local_table;
-+#endif
-+ struct icmp_mib *_icmp_statistics[2];
-+ struct ipstats_mib *_ip_statistics[2];
-+ struct tcp_mib *_tcp_statistics[2];
-+ struct udp_mib *_udp_statistics[2];
-+ struct linux_mib *_net_statistics[2];
-+ struct venet_stat *stat;
-+#ifdef CONFIG_VE_IPTABLES
-+/* core/netfilter.c virtualization */
-+ void *_nf_hooks;
-+ struct ipt_filter_initial_table *_ipt_filter_initial_table; /* initial_table struct */
-+ struct ipt_table *_ve_ipt_filter_pf; /* packet_filter struct */
-+ struct nf_hook_ops *_ve_ipt_filter_io; /* ipt_ops struct */
-+ struct ipt_table *_ipt_mangle_table;
-+ struct nf_hook_ops *_ipt_mangle_hooks;
-+ struct list_head *_ipt_target;
-+ struct list_head *_ipt_match;
-+ struct list_head *_ipt_tables;
-+
-+ struct ipt_target *_ipt_standard_target;
-+ struct ipt_target *_ipt_error_target;
-+ struct ipt_match *_tcp_matchstruct;
-+ struct ipt_match *_udp_matchstruct;
-+ struct ipt_match *_icmp_matchstruct;
-+
-+ __u64 _iptables_modules;
-+ struct ve_ip_conntrack *_ip_conntrack;
-+#endif /* CONFIG_VE_IPTABLES */
-+#endif
-+ wait_queue_head_t *_log_wait;
-+ unsigned long *_log_start;
-+ unsigned long *_log_end;
-+ unsigned long *_logged_chars;
-+ char *log_buf;
-+#define VE_DEFAULT_LOG_BUF_LEN 4096
-+
-+ struct ve_cpu_stats ve_cpu_stats[NR_CPUS] ____cacheline_aligned;
-+ unsigned long down_at;
-+ struct list_head cleanup_list;
-+
-+ unsigned long jiffies_fixup;
-+ unsigned char disable_net;
-+ unsigned char sparse_vpid;
-+ struct ve_monitor *monitor;
-+ struct proc_dir_entry *monitor_proc;
-+ unsigned long meminfo_val;
-+};
-+
-+#define VE_CPU_STATS(ve, cpu) (&((ve)->ve_cpu_stats[(cpu)]))
-+
-+extern int nr_ve;
-+
-+#ifdef CONFIG_VE
-+
-+int get_device_perms_ve(int dev_type, dev_t dev, int access_mode);
-+void do_env_cleanup(struct ve_struct *envid);
-+void do_update_load_avg_ve(void);
-+void do_env_free(struct ve_struct *ptr);
-+
-+#define ve_utsname (*get_exec_env()->utsname)
-+
-+static inline struct ve_struct *get_ve(struct ve_struct *ptr)
-+{
-+ if (ptr != NULL)
-+ atomic_inc(&ptr->counter);
-+ return ptr;
-+}
-+
-+static inline void put_ve(struct ve_struct *ptr)
-+{
-+ if (ptr && atomic_dec_and_test(&ptr->counter)) {
-+ if (atomic_read(&ptr->pcounter) > 0)
-+ BUG();
-+ if (ptr->is_running)
-+ BUG();
-+ do_env_free(ptr);
-+ }
-+}
-+
-+extern unsigned long long ve_relative_clock(struct timespec * ts);
-+
-+#ifdef CONFIG_FAIRSCHED
-+#define ve_cpu_online_map(ve, mask) fairsched_cpu_online_map(ve->veid, mask)
-+#else
-+#define ve_cpu_online_map(ve, mask) do { *mask = cpu_online_map; } while (0)
-+#endif
-+#else /* CONFIG_VE */
-+#define ve_utsname system_utsname
-+#define get_ve(ve) (NULL)
-+#define put_ve(ve) do { } while (0)
-+#endif /* CONFIG_VE */
-+
-+#endif /* _LINUX_VE_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/ve_owner.h linux-2.6.9-ve023stab030/include/linux/ve_owner.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/ve_owner.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/ve_owner.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,32 @@
-+/*
-+ * include/linux/ve_proto.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VE_OWNER_H__
-+#define __VE_OWNER_H__
-+
-+#include <linux/config.h>
-+#include <linux/vmalloc.h>
-+
-+
-+#define DCL_VE_OWNER(name, kind, type, member, attr1, attr2)
-+ /* prototype declares static inline functions */
-+
-+#define DCL_VE_OWNER_PROTO(name, kind, type, member, attr1, attr2) \
-+type; \
-+static inline struct ve_struct *VE_OWNER_##name(type *obj) \
-+{ \
-+ return obj->member; \
-+} \
-+static inline void SET_VE_OWNER_##name(type *obj, struct ve_struct *ve) \
-+{ \
-+ obj->member = ve; \
-+}
-+
-+#endif /* __VE_OWNER_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/ve_proto.h linux-2.6.9-ve023stab030/include/linux/ve_proto.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/ve_proto.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/ve_proto.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,73 @@
-+/*
-+ * include/linux/ve_proto.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VE_H__
-+#define __VE_H__
-+
-+#ifdef CONFIG_VE
-+
-+extern struct semaphore ve_call_guard;
-+extern rwlock_t ve_call_lock;
-+
-+#ifdef CONFIG_SYSVIPC
-+extern void prepare_ipc(void);
-+extern int init_ve_ipc(struct ve_struct *);
-+extern void fini_ve_ipc(struct ve_struct *);
-+extern void ve_ipc_cleanup(void);
-+#endif
-+
-+extern struct tty_driver *get_pty_driver(void);
-+extern struct tty_driver *get_pty_slave_driver(void);
-+#ifdef CONFIG_UNIX98_PTYS
-+extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */
-+extern struct tty_driver *pts_driver; /* Unix98 pty slaves; for /dev/ptmx */
-+#endif
-+
-+extern rwlock_t tty_driver_guard;
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+void ip_fragment_cleanup(struct ve_struct *envid);
-+void tcp_v4_kill_ve_sockets(struct ve_struct *envid);
-+struct fib_table * fib_hash_init(int id);
-+int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr);
-+extern int main_loopback_init(struct net_device*);
-+int venet_init(void);
-+#endif
-+
-+extern struct ve_struct *ve_list_head;
-+extern rwlock_t ve_list_guard;
-+extern struct ve_struct *get_ve_by_id(envid_t);
-+extern struct ve_struct *__find_ve_by_id(envid_t);
-+
-+extern int do_setdevperms(envid_t veid, unsigned type,
-+ dev_t dev, unsigned mask);
-+
-+#define VE_HOOK_INIT 0
-+#define VE_HOOK_FINI 1
-+#define VE_MAX_HOOKS 2
-+
-+typedef int ve_hookfn(unsigned int hooknum, void *data);
-+
-+struct ve_hook
-+{
-+ struct list_head list;
-+ ve_hookfn *hook;
-+ ve_hookfn *undo;
-+ struct module *owner;
-+ int hooknum;
-+ /* Functions are called in ascending priority. */
-+ int priority;
-+};
-+
-+extern int ve_hook_register(struct ve_hook *vh);
-+extern void ve_hook_unregister(struct ve_hook *vh);
-+
-+#endif
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/ve_task.h linux-2.6.9-ve023stab030/include/linux/ve_task.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/ve_task.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/ve_task.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,34 @@
-+/*
-+ * include/linux/ve_task.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VE_TASK_H__
-+#define __VE_TASK_H__
-+
-+#include <linux/seqlock.h>
-+
-+struct ve_task_info {
-+/* virtualization */
-+ struct ve_struct *owner_env;
-+ struct ve_struct *exec_env;
-+ struct list_head vetask_list;
-+ struct dentry *glob_proc_dentry;
-+/* statistics: scheduling latency */
-+ cycles_t sleep_time;
-+ cycles_t sched_time;
-+ cycles_t sleep_stamp;
-+ cycles_t wakeup_stamp;
-+ seqcount_t wakeup_lock;
-+};
-+
-+#define VE_TASK_INFO(task) (&(task)->ve_task_info)
-+#define VE_TASK_LIST_2_TASK(lh) \
-+ list_entry(lh, struct task_struct, ve_task_info.vetask_list)
-+
-+#endif /* __VE_TASK_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/venet.h linux-2.6.9-ve023stab030/include/linux/venet.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/venet.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/venet.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,68 @@
-+/*
-+ * include/linux/venet.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _VENET_H
-+#define _VENET_H
-+
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <linux/vzcalluser.h>
-+
-+#define VEIP_HASH_SZ 512
-+
-+struct ve_struct;
-+struct venet_stat;
-+struct ip_entry_struct
-+{
-+ __u32 ip;
-+ struct ve_struct *active_env;
-+ struct venet_stat *stat;
-+ struct veip_struct *veip;
-+ struct list_head ip_hash;
-+ struct list_head ve_list;
-+};
-+
-+struct veip_struct
-+{
-+ struct list_head src_lh;
-+ struct list_head dst_lh;
-+ struct list_head ip_lh;
-+ struct list_head list;
-+ envid_t veid;
-+};
-+
-+/* veip_hash_lock should be taken for write by caller */
-+void ip_entry_hash(struct ip_entry_struct *entry, struct veip_struct *veip);
-+/* veip_hash_lock should be taken for write by caller */
-+void ip_entry_unhash(struct ip_entry_struct *entry);
-+/* veip_hash_lock should be taken for read by caller */
-+struct ip_entry_struct *ip_entry_lookup(u32 addr);
-+
-+/* veip_hash_lock should be taken for read by caller */
-+struct veip_struct *veip_find(envid_t veid);
-+/* veip_hash_lock should be taken for write by caller */
-+struct veip_struct *veip_findcreate(envid_t veid);
-+/* veip_hash_lock should be taken for write by caller */
-+void veip_put(struct veip_struct *veip);
-+
-+int veip_start(struct ve_struct *ve);
-+void veip_stop(struct ve_struct *ve);
-+int veip_entry_add(struct ve_struct *ve, struct sockaddr_in *addr);
-+int veip_entry_del(envid_t veid, struct sockaddr_in *addr);
-+int venet_change_skb_owner(struct sk_buff *skb);
-+
-+extern struct list_head ip_entry_hash_table[];
-+extern rwlock_t veip_hash_lock;
-+
-+#ifdef CONFIG_PROC_FS
-+int veip_seq_show(struct seq_file *m, void *v);
-+#endif
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/veprintk.h linux-2.6.9-ve023stab030/include/linux/veprintk.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/veprintk.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/veprintk.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,38 @@
-+/*
-+ * include/linux/veprintk.h
-+ *
-+ * Copyright (C) 2006 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VE_PRINTK_H__
-+#define __VE_PRINTK_H__
-+
-+#ifdef CONFIG_VE
-+
-+#define ve_log_wait (*(get_exec_env()->_log_wait))
-+#define ve_log_start (*(get_exec_env()->_log_start))
-+#define ve_log_end (*(get_exec_env()->_log_end))
-+#define ve_logged_chars (*(get_exec_env()->_logged_chars))
-+#define ve_log_buf (get_exec_env()->log_buf)
-+#define ve_log_buf_len (ve_is_super(get_exec_env()) ? \
-+ log_buf_len : VE_DEFAULT_LOG_BUF_LEN)
-+#define VE_LOG_BUF_MASK (ve_log_buf_len - 1)
-+#define VE_LOG_BUF(idx) (ve_log_buf[(idx) & VE_LOG_BUF_MASK])
-+
-+#else
-+
-+#define ve_log_wait log_wait
-+#define ve_log_start log_start
-+#define ve_log_end log_end
-+#define ve_logged_chars logged_chars
-+#define ve_log_buf log_buf
-+#define ve_log_buf_len log_buf_len
-+#define VE_LOG_BUF_MASK LOG_BUF_MASK
-+#define VE_LOG_BUF(idx) LOG_BUF(idx)
-+
-+#endif /* CONFIG_VE */
-+#endif /* __VE_PRINTK_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/virtinfo.h linux-2.6.9-ve023stab030/include/linux/virtinfo.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/virtinfo.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/virtinfo.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,86 @@
-+/*
-+ * include/linux/virtinfo.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __LINUX_VIRTINFO_H
-+#define __LINUX_VIRTINFO_H
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <linux/page-flags.h>
-+#include <linux/notifier.h>
-+
-+struct vnotifier_block
-+{
-+ int (*notifier_call)(struct vnotifier_block *self,
-+ unsigned long, void *, int);
-+ struct vnotifier_block *next;
-+ int priority;
-+};
-+
-+extern struct semaphore virtinfo_sem;
-+void __virtinfo_notifier_register(int type, struct vnotifier_block *nb);
-+void virtinfo_notifier_register(int type, struct vnotifier_block *nb);
-+void virtinfo_notifier_unregister(int type, struct vnotifier_block *nb);
-+int virtinfo_notifier_call(int type, unsigned long n, void *data);
-+
-+struct meminfo {
-+ struct sysinfo si;
-+ unsigned long active, inactive;
-+ unsigned long cache, swapcache;
-+ unsigned long committed_space, allowed;
-+ struct page_state ps;
-+ unsigned long vmalloc_total, vmalloc_used, vmalloc_largest;
-+};
-+
-+#define VIRTINFO_DOFORK 0
-+#define VIRTINFO_DOEXIT 1
-+#define VIRTINFO_DOEXECVE 2
-+#define VIRTINFO_DOFORKRET 3
-+#define VIRTINFO_DOFORKPOST 4
-+#define VIRTINFO_EXIT 5
-+#define VIRTINFO_EXITMMAP 6
-+#define VIRTINFO_EXECMMAP 7
-+#define VIRTINFO_ENOUGHMEM 8
-+#define VIRTINFO_OUTOFMEM 9
-+#define VIRTINFO_PAGEIN 10
-+#define VIRTINFO_MEMINFO 11
-+#define VIRTINFO_SYSINFO 12
-+#define VIRTINFO_NEWUBC 13
-+
-+enum virt_info_types {
-+ VITYPE_GENERAL,
-+ VITYPE_FAUDIT,
-+ VITYPE_QUOTA,
-+ VITYPE_SCP,
-+
-+ VIRT_TYPES
-+};
-+
-+#ifdef CONFIG_VZ_GENCALLS
-+
-+static inline int virtinfo_gencall(unsigned long n, void *data)
-+{
-+ int r;
-+
-+ r = virtinfo_notifier_call(VITYPE_GENERAL, n, data);
-+ if (r & NOTIFY_FAIL)
-+ return -ENOBUFS;
-+ if (r & NOTIFY_OK)
-+ return -ERESTARTNOINTR;
-+ return 0;
-+}
-+
-+#else
-+
-+#define virtinfo_gencall(n, data) 0
-+
-+#endif
-+
-+#endif /* __LINUX_VIRTINFO_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/virtinfoscp.h linux-2.6.9-ve023stab030/include/linux/virtinfoscp.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/virtinfoscp.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/virtinfoscp.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,21 @@
-+#ifndef __VIRTINFO_SCP_H__
-+#define __VIRTINFO_SCP_H__
-+
-+/*
-+ * Dump and restore operations are non-symmetric.
-+ * With respect to finish/fail hooks, 2 dump hooks are called from
-+ * different proc operations, but restore hooks are called from a single one.
-+ */
-+#define VIRTINFO_SCP_COLLECT 0x10
-+#define VIRTINFO_SCP_DUMP 0x11
-+#define VIRTINFO_SCP_DMPFIN 0x12
-+#define VIRTINFO_SCP_RSTCHECK 0x13
-+#define VIRTINFO_SCP_RESTORE 0x14
-+#define VIRTINFO_SCP_RSTFAIL 0x15
-+
-+#define VIRTINFO_SCP_RSTTSK 0x20
-+#define VIRTINFO_SCP_RSTMM 0x21
-+
-+#define VIRTNOTIFY_CHANGE 0x100
-+
-+#endif /* __VIRTINFO_SCP_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vmalloc.h linux-2.6.9-ve023stab030/include/linux/vmalloc.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vmalloc.h 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/vmalloc.h 2006-10-11 19:07:57.000000000 +0400
-@@ -10,6 +10,10 @@
- #define VM_MAP 0x00000004 /* vmap()ed pages */
- /* bits [20..32] reserved for arch specific ioremap internals */
-
-+/* align size to 2^n page boundary */
-+#define POWER2_PAGE_ALIGN(size) \
-+ ((typeof(size))(1UL << (PAGE_SHIFT + get_order(size))))
-+
- struct vm_struct {
- void *addr;
- unsigned long size;
-@@ -27,6 +31,8 @@ extern void *vmalloc(unsigned long size)
- extern void *vmalloc_exec(unsigned long size);
- extern void *vmalloc_32(unsigned long size);
- extern void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot);
-+extern void *vmalloc_best(unsigned long size);
-+extern void *ub_vmalloc_best(unsigned long size);
- extern void vfree(void *addr);
-
- extern void *vmap(struct page **pages, unsigned int count,
-@@ -39,6 +45,9 @@ extern void vunmap(void *addr);
- extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
- extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
- unsigned long start, unsigned long end);
-+extern struct vm_struct * get_vm_area_best(unsigned long size,
-+ unsigned long flags);
-+extern void vprintstat(void);
- extern struct vm_struct *remove_vm_area(void *addr);
- extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
- struct page ***pages);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vsched.h linux-2.6.9-ve023stab030/include/linux/vsched.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vsched.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vsched.h 2006-10-11 19:08:01.000000000 +0400
-@@ -0,0 +1,35 @@
-+/*
-+ * include/linux/vsched.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VSCHED_H__
-+#define __VSCHED_H__
-+
-+#include <linux/config.h>
-+#include <linux/cache.h>
-+#include <linux/fairsched.h>
-+#include <linux/sched.h>
-+
-+extern int vsched_create(int id, struct fairsched_node *node);
-+extern int vsched_destroy(struct vcpu_scheduler *vsched);
-+
-+extern int vsched_mvpr(struct task_struct *p, struct vcpu_scheduler *vsched);
-+extern int vsched_set_vcpus(struct vcpu_scheduler *vsched, unsigned int vcpus);
-+
-+extern int vcpu_online(int cpu);
-+
-+#ifdef CONFIG_VE
-+#ifdef CONFIG_FAIRSCHED
-+extern unsigned long ve_scale_khz(unsigned long khz);
-+#else
-+#define ve_scale_khz(khz) (khz)
-+#endif
-+#endif
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzcalluser.h linux-2.6.9-ve023stab030/include/linux/vzcalluser.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzcalluser.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzcalluser.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,230 @@
-+/*
-+ * include/linux/vzcalluser.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _LINUX_VZCALLUSER_H
-+#define _LINUX_VZCALLUSER_H
-+
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+
-+#define KERN_VZ_PRIV_RANGE 51
-+
-+#ifndef __ENVID_T_DEFINED__
-+typedef unsigned envid_t;
-+#define __ENVID_T_DEFINED__
-+#endif
-+
-+/*
-+ * VE management ioctls
-+ */
-+
-+struct vzctl_old_env_create {
-+ envid_t veid;
-+ unsigned flags;
-+#define VE_CREATE 1 /* Create VE, VE_ENTER added automatically */
-+#define VE_EXCLUSIVE 2 /* Fail if exists */
-+#define VE_ENTER 4 /* Enter existing VE */
-+#define VE_TEST 8 /* Test if VE exists */
-+#define VE_LOCK 16 /* Do not allow entering created VE */
-+#define VE_SKIPLOCK 32 /* Allow entering embrion VE */
-+ __u32 addr;
-+};
-+
-+struct vzctl_mark_env_to_down {
-+ envid_t veid;
-+};
-+
-+struct vzctl_setdevperms {
-+ envid_t veid;
-+ unsigned type;
-+#define VE_USE_MAJOR 010 /* Test MAJOR supplied in rule */
-+#define VE_USE_MINOR 030 /* Test MINOR supplied in rule */
-+#define VE_USE_MASK 030 /* Testing mask, VE_USE_MAJOR|VE_USE_MINOR */
-+ unsigned dev;
-+ unsigned mask;
-+};
-+
-+struct vzctl_ve_netdev {
-+ envid_t veid;
-+ int op;
-+#define VE_NETDEV_ADD 1
-+#define VE_NETDEV_DEL 2
-+ char *dev_name;
-+};
-+
-+struct vzctl_ve_meminfo {
-+ envid_t veid;
-+ unsigned long val;
-+};
-+
-+/* these masks represent modules */
-+#define VE_IP_IPTABLES_MOD (1U<<0)
-+#define VE_IP_FILTER_MOD (1U<<1)
-+#define VE_IP_MANGLE_MOD (1U<<2)
-+#define VE_IP_MATCH_LIMIT_MOD (1U<<3)
-+#define VE_IP_MATCH_MULTIPORT_MOD (1U<<4)
-+#define VE_IP_MATCH_TOS_MOD (1U<<5)
-+#define VE_IP_TARGET_TOS_MOD (1U<<6)
-+#define VE_IP_TARGET_REJECT_MOD (1U<<7)
-+#define VE_IP_TARGET_TCPMSS_MOD (1U<<8)
-+#define VE_IP_MATCH_TCPMSS_MOD (1U<<9)
-+#define VE_IP_MATCH_TTL_MOD (1U<<10)
-+#define VE_IP_TARGET_LOG_MOD (1U<<11)
-+#define VE_IP_MATCH_LENGTH_MOD (1U<<12)
-+#define VE_IP_CONNTRACK_MOD (1U<<14)
-+#define VE_IP_CONNTRACK_FTP_MOD (1U<<15)
-+#define VE_IP_CONNTRACK_IRC_MOD (1U<<16)
-+#define VE_IP_MATCH_CONNTRACK_MOD (1U<<17)
-+#define VE_IP_MATCH_STATE_MOD (1U<<18)
-+#define VE_IP_MATCH_HELPER_MOD (1U<<19)
-+#define VE_IP_NAT_MOD (1U<<20)
-+#define VE_IP_NAT_FTP_MOD (1U<<21)
-+#define VE_IP_NAT_IRC_MOD (1U<<22)
-+#define VE_IP_TARGET_REDIRECT_MOD (1U<<23)
-+#define VE_IP_MATCH_OWNER_MOD (1U<<24)
-+
-+/* these masks represent modules with their dependences */
-+#define VE_IP_IPTABLES (VE_IP_IPTABLES_MOD)
-+#define VE_IP_FILTER (VE_IP_FILTER_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MANGLE (VE_IP_MANGLE_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_LIMIT (VE_IP_MATCH_LIMIT_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_MULTIPORT (VE_IP_MATCH_MULTIPORT_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_TOS (VE_IP_MATCH_TOS_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_TARGET_TOS (VE_IP_TARGET_TOS_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_TARGET_REJECT (VE_IP_TARGET_REJECT_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_TARGET_TCPMSS (VE_IP_TARGET_TCPMSS_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_TCPMSS (VE_IP_MATCH_TCPMSS_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_TTL (VE_IP_MATCH_TTL_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_TARGET_LOG (VE_IP_TARGET_LOG_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_MATCH_LENGTH (VE_IP_MATCH_LENGTH_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_CONNTRACK (VE_IP_CONNTRACK_MOD \
-+ | VE_IP_IPTABLES)
-+#define VE_IP_CONNTRACK_FTP (VE_IP_CONNTRACK_FTP_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_CONNTRACK_IRC (VE_IP_CONNTRACK_IRC_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_MATCH_CONNTRACK (VE_IP_MATCH_CONNTRACK_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_MATCH_STATE (VE_IP_MATCH_STATE_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_MATCH_HELPER (VE_IP_MATCH_HELPER_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_NAT (VE_IP_NAT_MOD \
-+ | VE_IP_CONNTRACK)
-+#define VE_IP_NAT_FTP (VE_IP_NAT_FTP_MOD \
-+ | VE_IP_NAT | VE_IP_CONNTRACK_FTP)
-+#define VE_IP_NAT_IRC (VE_IP_NAT_IRC_MOD \
-+ | VE_IP_NAT | VE_IP_CONNTRACK_IRC)
-+#define VE_IP_TARGET_REDIRECT (VE_IP_TARGET_REDIRECT_MOD \
-+ | VE_IP_NAT)
-+#define VE_IP_MATCH_OWNER (VE_IP_MATCH_OWNER_MOD \
-+ | VE_IP_IPTABLES)
-+
-+/* safe iptables mask to be used by default */
-+#define VE_IP_DEFAULT \
-+ (VE_IP_IPTABLES | \
-+ VE_IP_FILTER | VE_IP_MANGLE | \
-+ VE_IP_MATCH_LIMIT | VE_IP_MATCH_MULTIPORT | \
-+ VE_IP_MATCH_TOS | VE_IP_TARGET_REJECT | \
-+ VE_IP_TARGET_TCPMSS | VE_IP_MATCH_TCPMSS | \
-+ VE_IP_MATCH_TTL | VE_IP_MATCH_LENGTH)
-+
-+#define VE_IPT_CMP(x,y) (((x) & (y)) == (y))
-+
-+struct vzctl_env_create_cid {
-+ envid_t veid;
-+ unsigned flags;
-+ __u32 class_id;
-+};
-+
-+struct vzctl_env_create {
-+ envid_t veid;
-+ unsigned flags;
-+ __u32 class_id;
-+};
-+
-+struct env_create_param {
-+ __u64 iptables_mask;
-+};
-+#define VZCTL_ENV_CREATE_DATA_MINLEN sizeof(struct env_create_param)
-+
-+struct env_create_param2 {
-+ __u64 iptables_mask;
-+ __u64 feature_mask;
-+#define VE_FEATURE_SYSFS (1ULL << 0)
-+ __u32 total_vcpus; /* 0 - don't care, same as in host */
-+};
-+#define VZCTL_ENV_CREATE_DATA_MAXLEN sizeof(struct env_create_param2)
-+
-+typedef struct env_create_param2 env_create_param_t;
-+
-+struct vzctl_env_create_data {
-+ envid_t veid;
-+ unsigned flags;
-+ __u32 class_id;
-+ env_create_param_t *data;
-+ int datalen;
-+};
-+
-+struct vz_load_avg {
-+ int val_int;
-+ int val_frac;
-+};
-+
-+struct vz_cpu_stat {
-+ unsigned long user_jif;
-+ unsigned long nice_jif;
-+ unsigned long system_jif;
-+ unsigned long uptime_jif;
-+ __u64 idle_clk;
-+ __u64 strv_clk;
-+ __u64 uptime_clk;
-+ struct vz_load_avg avenrun[3]; /* loadavg data */
-+};
-+
-+struct vzctl_cpustatctl {
-+ envid_t veid;
-+ struct vz_cpu_stat *cpustat;
-+};
-+
-+#define VZCTLTYPE '.'
-+#define VZCTL_OLD_ENV_CREATE _IOW(VZCTLTYPE, 0, \
-+ struct vzctl_old_env_create)
-+#define VZCTL_MARK_ENV_TO_DOWN _IOW(VZCTLTYPE, 1, \
-+ struct vzctl_mark_env_to_down)
-+#define VZCTL_SETDEVPERMS _IOW(VZCTLTYPE, 2, \
-+ struct vzctl_setdevperms)
-+#define VZCTL_ENV_CREATE_CID _IOW(VZCTLTYPE, 4, \
-+ struct vzctl_env_create_cid)
-+#define VZCTL_ENV_CREATE _IOW(VZCTLTYPE, 5, \
-+ struct vzctl_env_create)
-+#define VZCTL_GET_CPU_STAT _IOW(VZCTLTYPE, 6, \
-+ struct vzctl_cpustatctl)
-+#define VZCTL_ENV_CREATE_DATA _IOW(VZCTLTYPE, 10, \
-+ struct vzctl_env_create_data)
-+#define VZCTL_VE_NETDEV _IOW(VZCTLTYPE, 11, \
-+ struct vzctl_ve_netdev)
-+#define VZCTL_VE_MEMINFO _IOW(VZCTLTYPE, 13, \
-+ struct vzctl_ve_meminfo)
-+
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl.h linux-2.6.9-ve023stab030/include/linux/vzctl.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzctl.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,30 @@
-+/*
-+ * include/linux/vzctl.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _LINUX_VZCTL_H
-+#define _LINUX_VZCTL_H
-+
-+#include <linux/list.h>
-+
-+struct module;
-+struct inode;
-+struct file;
-+struct vzioctlinfo {
-+ unsigned type;
-+ int (*func)(struct inode *, struct file *,
-+ unsigned int, unsigned long);
-+ struct module *owner;
-+ struct list_head list;
-+};
-+
-+extern void vzioctl_register(struct vzioctlinfo *inf);
-+extern void vzioctl_unregister(struct vzioctlinfo *inf);
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_quota.h linux-2.6.9-ve023stab030/include/linux/vzctl_quota.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_quota.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzctl_quota.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,43 @@
-+/*
-+ * include/linux/vzctl_quota.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __LINUX_VZCTL_QUOTA_H__
-+#define __LINUX_VZCTL_QUOTA_H__
-+
-+/*
-+ * Quota management ioctl
-+ */
-+
-+struct vz_quota_stat;
-+struct vzctl_quotactl {
-+ int cmd;
-+ unsigned int quota_id;
-+ struct vz_quota_stat *qstat;
-+ char *ve_root;
-+};
-+
-+struct vzctl_quotaugidctl {
-+ int cmd; /* subcommand */
-+ unsigned int quota_id; /* quota id where it applies to */
-+ unsigned int ugid_index;/* for reading statistic. index of first
-+ uid/gid record to read */
-+ unsigned int ugid_size; /* size of ugid_buf array */
-+ void *addr; /* user-level buffer */
-+};
-+
-+#define VZDQCTLTYPE '+'
-+#define VZCTL_QUOTA_CTL _IOWR(VZDQCTLTYPE, 1, \
-+ struct vzctl_quotactl)
-+#define VZCTL_QUOTA_NEW_CTL _IOWR(VZDQCTLTYPE, 2, \
-+ struct vzctl_quotactl)
-+#define VZCTL_QUOTA_UGID_CTL _IOWR(VZDQCTLTYPE, 3, \
-+ struct vzctl_quotaugidctl)
-+
-+#endif /* __LINUX_VZCTL_QUOTA_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_venet.h linux-2.6.9-ve023stab030/include/linux/vzctl_venet.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_venet.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzctl_venet.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,36 @@
-+/*
-+ * include/linux/vzctl_venet.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _VZCTL_VENET_H
-+#define _VZCTL_VENET_H
-+
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+
-+#ifndef __ENVID_T_DEFINED__
-+typedef unsigned envid_t;
-+#define __ENVID_T_DEFINED__
-+#endif
-+
-+struct vzctl_ve_ip_map {
-+ envid_t veid;
-+ int op;
-+#define VE_IP_ADD 1
-+#define VE_IP_DEL 2
-+ struct sockaddr *addr;
-+ int addrlen;
-+};
-+
-+#define VENETCTLTYPE '('
-+
-+#define VENETCTL_VE_IP_MAP _IOW(VENETCTLTYPE, 3, \
-+ struct vzctl_ve_ip_map)
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_veth.h linux-2.6.9-ve023stab030/include/linux/vzctl_veth.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzctl_veth.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzctl_veth.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,40 @@
-+/*
-+ * include/linux/vzctl_veth.h
-+ *
-+ * Copyright (C) 2006 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _VZCTL_VETH_H
-+#define _VZCTL_VETH_H
-+
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+
-+#ifndef __ENVID_T_DEFINED__
-+typedef unsigned envid_t;
-+#define __ENVID_T_DEFINED__
-+#endif
-+
-+struct vzctl_ve_hwaddr {
-+ envid_t veid;
-+ int op;
-+#define VE_ETH_ADD 1
-+#define VE_ETH_DEL 2
-+ unsigned char dev_addr[6];
-+ int addrlen;
-+ char dev_name[16];
-+ unsigned char dev_addr_ve[6];
-+ int addrlen_ve;
-+ char dev_name_ve[16];
-+};
-+
-+#define VETHCTLTYPE '['
-+
-+#define VETHCTL_VE_HWADDR _IOW(VETHCTLTYPE, 3, \
-+ struct vzctl_ve_hwaddr)
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzdq_tree.h linux-2.6.9-ve023stab030/include/linux/vzdq_tree.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzdq_tree.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzdq_tree.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,99 @@
-+/*
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains Virtuozzo disk quota tree definition
-+ */
-+
-+#ifndef _VZDQ_TREE_H
-+#define _VZDQ_TREE_H
-+
-+#include <linux/list.h>
-+#include <asm/string.h>
-+
-+typedef unsigned int quotaid_t;
-+#define QUOTAID_BITS 32
-+#define QUOTAID_BBITS 4
-+#define QUOTAID_EBITS 8
-+
-+#if QUOTAID_EBITS % QUOTAID_BBITS
-+#error Quota bit assumption failure
-+#endif
-+
-+#define QUOTATREE_BSIZE (1 << QUOTAID_BBITS)
-+#define QUOTATREE_BMASK (QUOTATREE_BSIZE - 1)
-+#define QUOTATREE_DEPTH ((QUOTAID_BITS + QUOTAID_BBITS - 1) \
-+ / QUOTAID_BBITS)
-+#define QUOTATREE_EDEPTH ((QUOTAID_BITS + QUOTAID_EBITS - 1) \
-+ / QUOTAID_EBITS)
-+#define QUOTATREE_BSHIFT(lvl) ((QUOTATREE_DEPTH - (lvl) - 1) * QUOTAID_BBITS)
-+
-+/*
-+ * Depth of keeping unused node (not inclusive).
-+ * 0 means release all nodes including root,
-+ * QUOTATREE_DEPTH means never release nodes.
-+ * Current value: release all nodes strictly after QUOTATREE_EDEPTH
-+ * (measured in external shift units).
-+ */
-+#define QUOTATREE_CDEPTH (QUOTATREE_DEPTH \
-+ - 2 * QUOTATREE_DEPTH / QUOTATREE_EDEPTH \
-+ + 1)
-+
-+/*
-+ * Levels 0..(QUOTATREE_DEPTH-1) are tree nodes.
-+ * On level i the maximal number of nodes is 2^(i*QUOTAID_BBITS),
-+ * and each node contains 2^QUOTAID_BBITS pointers.
-+ * Level 0 is a (single) tree root node.
-+ *
-+ * Nodes of level (QUOTATREE_DEPTH-1) contain pointers to caller's data.
-+ * Nodes of lower levels contain pointers to nodes.
-+ *
-+ * Double pointer in array of i-level node, pointing to a (i+1)-level node
-+ * (such as inside quotatree_find_state) are marked by level (i+1), not i.
-+ * Level 0 double pointer is a pointer to root inside tree struct.
-+ *
-+ * The tree is permanent, i.e. all index blocks allocated are keeped alive to
-+ * preserve the blocks numbers in the quota file tree to keep its changes
-+ * locally.
-+ */
-+struct quotatree_node {
-+ struct list_head list;
-+ quotaid_t num;
-+ void *blocks[QUOTATREE_BSIZE];
-+};
-+
-+struct quotatree_level {
-+ struct list_head usedlh, freelh;
-+ quotaid_t freenum;
-+};
-+
-+struct quotatree_tree {
-+ struct quotatree_level levels[QUOTATREE_DEPTH];
-+ struct quotatree_node *root;
-+ unsigned int leaf_num;
-+};
-+
-+struct quotatree_find_state {
-+ void **block;
-+ int level;
-+};
-+
-+/* number of leafs (objects) and leaf level of the tree */
-+#define QTREE_LEAFNUM(tree) ((tree)->leaf_num)
-+#define QTREE_LEAFLVL(tree) (&(tree)->levels[QUOTATREE_DEPTH - 1])
-+
-+struct quotatree_tree *quotatree_alloc(void);
-+void *quotatree_find(struct quotatree_tree *tree, quotaid_t id,
-+ struct quotatree_find_state *st);
-+int quotatree_insert(struct quotatree_tree *tree, quotaid_t id,
-+ struct quotatree_find_state *st, void *data);
-+void quotatree_remove(struct quotatree_tree *tree, quotaid_t id);
-+void quotatree_free(struct quotatree_tree *tree, void (*dtor)(void *));
-+void *quotatree_get_next(struct quotatree_tree *tree, quotaid_t id);
-+void *quotatree_leaf_byindex(struct quotatree_tree *tree, unsigned int index);
-+
-+#endif /* _VZDQ_TREE_H */
-+
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzquota.h linux-2.6.9-ve023stab030/include/linux/vzquota.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzquota.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzquota.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,293 @@
-+/*
-+ *
-+ * Copyright (C) 2001-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * This file contains Virtuozzo disk quota implementation
-+ */
-+
-+#ifndef _VZDQUOTA_H
-+#define _VZDQUOTA_H
-+
-+#include <linux/types.h>
-+#include <linux/quota.h>
-+
-+/* vzquotactl syscall commands */
-+#define VZ_DQ_CREATE 5 /* create quota master block */
-+#define VZ_DQ_DESTROY 6 /* destroy qmblk */
-+#define VZ_DQ_ON 7 /* mark dentry with already created qmblk */
-+#define VZ_DQ_OFF 8 /* remove mark, don't destroy qmblk */
-+#define VZ_DQ_SETLIMIT 9 /* set new limits */
-+#define VZ_DQ_GETSTAT 10 /* get usage statistic */
-+/* set of syscalls to maintain UGID quotas */
-+#define VZ_DQ_UGID_GETSTAT 1 /* get usage/limits for ugid(s) */
-+#define VZ_DQ_UGID_ADDSTAT 2 /* set usage/limits statistic for ugid(s) */
-+#define VZ_DQ_UGID_GETGRACE 3 /* get expire times */
-+#define VZ_DQ_UGID_SETGRACE 4 /* set expire times */
-+#define VZ_DQ_UGID_GETCONFIG 5 /* get ugid_max limit, cnt, flags of qmblk */
-+#define VZ_DQ_UGID_SETCONFIG 6 /* set ugid_max limit, flags of qmblk */
-+#define VZ_DQ_UGID_SETLIMIT 7 /* set ugid B/I limits */
-+#define VZ_DQ_UGID_SETINFO 8 /* set ugid info */
-+
-+/* common structure for vz and ugid quota */
-+struct dq_stat {
-+ /* blocks limits */
-+ __u64 bhardlimit; /* absolute limit in bytes */
-+ __u64 bsoftlimit; /* preferred limit in bytes */
-+ time_t btime; /* time limit for excessive disk use */
-+ __u64 bcurrent; /* current bytes count */
-+ /* inodes limits */
-+ __u32 ihardlimit; /* absolute limit on allocated inodes */
-+ __u32 isoftlimit; /* preferred inode limit */
-+ time_t itime; /* time limit for excessive inode use */
-+ __u32 icurrent; /* current # allocated inodes */
-+};
-+
-+/* Values for dq_info->flags */
-+#define VZ_QUOTA_INODES 0x01 /* inodes limit warning printed */
-+#define VZ_QUOTA_SPACE 0x02 /* space limit warning printed */
-+
-+struct dq_info {
-+ time_t bexpire; /* expire timeout for excessive disk use */
-+ time_t iexpire; /* expire timeout for excessive inode use */
-+ unsigned flags; /* see previos defines */
-+};
-+
-+struct vz_quota_stat {
-+ struct dq_stat dq_stat;
-+ struct dq_info dq_info;
-+};
-+
-+/* UID/GID interface record - for user-kernel level exchange */
-+struct vz_quota_iface {
-+ unsigned int qi_id; /* UID/GID this applies to */
-+ unsigned int qi_type; /* USRQUOTA|GRPQUOTA */
-+ struct dq_stat qi_stat; /* limits, options, usage stats */
-+};
-+
-+/* values for flags and dq_flags */
-+/* this flag is set if the userspace has been unable to provide usage
-+ * information about all ugids
-+ * if the flag is set, we don't allocate new UG quota blocks (their
-+ * current usage is unknown) or free existing UG quota blocks (not to
-+ * lose information that this block is ok) */
-+#define VZDQUG_FIXED_SET 0x01
-+/* permit to use ugid quota */
-+#define VZDQUG_ON 0x02
-+#define VZDQ_USRQUOTA 0x10
-+#define VZDQ_GRPQUOTA 0x20
-+#define VZDQ_NOACT 0x1000 /* not actual */
-+#define VZDQ_NOQUOT 0x2000 /* not under quota tree */
-+
-+struct vz_quota_ugid_stat {
-+ unsigned int limit; /* max amount of ugid records */
-+ unsigned int count; /* amount of ugid records */
-+ unsigned int flags;
-+};
-+
-+struct vz_quota_ugid_setlimit {
-+ unsigned int type; /* quota type (USR/GRP) */
-+ unsigned int id; /* ugid */
-+ struct if_dqblk dqb; /* limits info */
-+};
-+
-+struct vz_quota_ugid_setinfo {
-+ unsigned int type; /* quota type (USR/GRP) */
-+ struct if_dqinfo dqi; /* grace info */
-+};
-+
-+#ifdef __KERNEL__
-+#include <linux/list.h>
-+#include <asm/atomic.h>
-+#include <asm/semaphore.h>
-+#include <linux/time.h>
-+#include <linux/vzquota_qlnk.h>
-+#include <linux/vzdq_tree.h>
-+
-+/* One-second resolution for grace times */
-+#define CURRENT_TIME_SECONDS (get_seconds())
-+
-+/* Values for dq_info flags */
-+#define VZ_QUOTA_INODES 0x01 /* inodes limit warning printed */
-+#define VZ_QUOTA_SPACE 0x02 /* space limit warning printed */
-+
-+/* values for dq_state */
-+#define VZDQ_STARTING 0 /* created, not turned on yet */
-+#define VZDQ_WORKING 1 /* quota created, turned on */
-+#define VZDQ_STOPING 2 /* created, turned on and off */
-+
-+/* master quota record - one per veid */
-+struct vz_quota_master {
-+ struct list_head dq_hash; /* next quota in hash list */
-+ atomic_t dq_count; /* inode reference count */
-+ unsigned int dq_flags; /* see VZDQUG_FIXED_SET */
-+ unsigned int dq_state; /* see values above */
-+ unsigned int dq_id; /* VEID this applies to */
-+ struct dq_stat dq_stat; /* limits, grace, usage stats */
-+ struct dq_info dq_info; /* grace times and flags */
-+ spinlock_t dq_data_lock; /* for dq_stat */
-+
-+ struct semaphore dq_sem; /* semaphore to protect
-+ ugid tree */
-+
-+ struct list_head dq_ilink_list; /* list of vz_quota_ilink */
-+ struct quotatree_tree *dq_uid_tree; /* vz_quota_ugid tree for UIDs */
-+ struct quotatree_tree *dq_gid_tree; /* vz_quota_ugid tree for GIDs */
-+ unsigned int dq_ugid_count; /* amount of ugid records */
-+ unsigned int dq_ugid_max; /* max amount of ugid records */
-+ struct dq_info dq_ugid_info[MAXQUOTAS]; /* ugid grace times */
-+
-+ struct dentry *dq_root_dentry;/* dentry of fs tree */
-+ struct vfsmount *dq_root_mnt; /* vfsmnt of this dentry */
-+ struct super_block *dq_sb; /* superblock of our quota root */
-+};
-+
-+/* UID/GID quota record - one per pair (quota_master, uid or gid) */
-+struct vz_quota_ugid {
-+ unsigned int qugid_id; /* UID/GID this applies to */
-+ struct dq_stat qugid_stat; /* limits, options, usage stats */
-+ int qugid_type; /* USRQUOTA|GRPQUOTA */
-+ atomic_t qugid_count; /* reference count */
-+};
-+
-+#define VZ_QUOTA_UGBAD ((struct vz_quota_ugid *)0xfeafea11)
-+
-+struct vz_quota_datast {
-+ struct vz_quota_ilink qlnk;
-+};
-+
-+#define VIRTINFO_QUOTA_GETSTAT 0
-+#define VIRTINFO_QUOTA_ON 1
-+#define VIRTINFO_QUOTA_OFF 2
-+#define VIRTINFO_QUOTA_DISABLE 3
-+
-+struct virt_info_quota {
-+ struct super_block *super;
-+ struct dq_stat *qstat;
-+};
-+
-+/*
-+ * Interface to VZ quota core
-+ */
-+#define INODE_QLNK(inode) (&(inode)->i_qlnk)
-+#define QLNK_INODE(qlnk) container_of((qlnk), struct inode, i_qlnk)
-+
-+#define VZ_QUOTA_BAD ((struct vz_quota_master *)0xefefefef)
-+
-+#define VZ_QUOTAO_SETE 1
-+#define VZ_QUOTAO_INIT 2
-+#define VZ_QUOTAO_DESTR 3
-+#define VZ_QUOTAO_SWAP 4
-+#define VZ_QUOTAO_INICAL 5
-+#define VZ_QUOTAO_DRCAL 6
-+#define VZ_QUOTAO_QSET 7
-+#define VZ_QUOTAO_TRANS 8
-+#define VZ_QUOTAO_ACT 9
-+#define VZ_QUOTAO_DTREE 10
-+#define VZ_QUOTAO_DET 11
-+#define VZ_QUOTAO_ON 12
-+
-+extern struct semaphore vz_quota_sem;
-+void inode_qmblk_lock(struct super_block *sb);
-+void inode_qmblk_unlock(struct super_block *sb);
-+void qmblk_data_read_lock(struct vz_quota_master *qmblk);
-+void qmblk_data_read_unlock(struct vz_quota_master *qmblk);
-+void qmblk_data_write_lock(struct vz_quota_master *qmblk);
-+void qmblk_data_write_unlock(struct vz_quota_master *qmblk);
-+
-+/* for quota operations */
-+void vzquota_inode_init_call(struct inode *inode);
-+void vzquota_inode_drop_call(struct inode *inode);
-+int vzquota_inode_transfer_call(struct inode *, struct iattr *);
-+struct vz_quota_master *vzquota_inode_data(struct inode *inode,
-+ struct vz_quota_datast *);
-+void vzquota_data_unlock(struct inode *inode, struct vz_quota_datast *);
-+int vzquota_rename_check(struct inode *inode,
-+ struct inode *old_dir, struct inode *new_dir);
-+struct vz_quota_master *vzquota_inode_qmblk(struct inode *inode);
-+/* for second-level quota */
-+struct vz_quota_master *vzquota_find_qmblk(struct super_block *);
-+/* for management operations */
-+struct vz_quota_master *vzquota_alloc_master(unsigned int quota_id,
-+ struct vz_quota_stat *qstat);
-+void vzquota_free_master(struct vz_quota_master *);
-+struct vz_quota_master *vzquota_find_master(unsigned int quota_id);
-+int vzquota_on_qmblk(struct super_block *sb, struct inode *inode,
-+ struct vz_quota_master *qmblk);
-+int vzquota_off_qmblk(struct super_block *sb, struct vz_quota_master *qmblk);
-+int vzquota_get_super(struct super_block *sb);
-+void vzquota_put_super(struct super_block *sb);
-+
-+static inline struct vz_quota_master *qmblk_get(struct vz_quota_master *qmblk)
-+{
-+ if (!atomic_read(&qmblk->dq_count))
-+ BUG();
-+ atomic_inc(&qmblk->dq_count);
-+ return qmblk;
-+}
-+
-+static inline void __qmblk_put(struct vz_quota_master *qmblk)
-+{
-+ atomic_dec(&qmblk->dq_count);
-+}
-+
-+static inline void qmblk_put(struct vz_quota_master *qmblk)
-+{
-+ if (!atomic_dec_and_test(&qmblk->dq_count))
-+ return;
-+ vzquota_free_master(qmblk);
-+}
-+
-+extern struct list_head vzquota_hash_table[];
-+extern int vzquota_hash_size;
-+
-+/*
-+ * Interface to VZ UGID quota
-+ */
-+extern struct quotactl_ops vz_quotactl_operations;
-+extern struct dquot_operations vz_quota_operations2;
-+extern struct quota_format_type vz_quota_empty_v2_format;
-+
-+#define QUGID_TREE(qmblk, type) (((type) == USRQUOTA) ? \
-+ qmblk->dq_uid_tree : \
-+ qmblk->dq_gid_tree)
-+
-+#define VZDQUG_FIND_DONT_ALLOC 1
-+#define VZDQUG_FIND_FAKE 2
-+struct vz_quota_ugid *vzquota_find_ugid(struct vz_quota_master *qmblk,
-+ unsigned int quota_id, int type, int flags);
-+struct vz_quota_ugid *__vzquota_find_ugid(struct vz_quota_master *qmblk,
-+ unsigned int quota_id, int type, int flags);
-+struct vz_quota_ugid *vzquota_get_ugid(struct vz_quota_ugid *qugid);
-+void vzquota_put_ugid(struct vz_quota_master *qmblk,
-+ struct vz_quota_ugid *qugid);
-+void vzquota_kill_ugid(struct vz_quota_master *qmblk);
-+int vzquota_ugid_init(void);
-+void vzquota_ugid_release(void);
-+int vzquota_transfer_usage(struct inode *inode, int mask,
-+ struct vz_quota_ilink *qlnk);
-+void vzquota_inode_off(struct inode *inode);
-+
-+struct vzctl_quotaugidctl;
-+long do_vzquotaugidctl(struct vzctl_quotaugidctl *qub);
-+
-+/*
-+ * Other VZ quota parts
-+ */
-+extern struct dquot_operations vz_quota_operations;
-+
-+long do_vzquotactl(int cmd, unsigned int quota_id,
-+ struct vz_quota_stat *qstat, const char *ve_root);
-+int vzquota_proc_init(void);
-+void vzquota_proc_release(void);
-+struct vz_quota_master *vzquota_find_qmblk(struct super_block *);
-+extern struct semaphore vz_quota_sem;
-+
-+void vzaquota_init(void);
-+void vzaquota_fini(void);
-+
-+#endif /* __KERNEL__ */
-+
-+#endif /* _VZDQUOTA_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzquota_qlnk.h linux-2.6.9-ve023stab030/include/linux/vzquota_qlnk.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzquota_qlnk.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzquota_qlnk.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,25 @@
-+/*
-+ * include/linux/vzquota_qlnk.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _VZDQUOTA_QLNK_H
-+#define _VZDQUOTA_QLNK_H
-+
-+struct vz_quota_master;
-+struct vz_quota_ugid;
-+
-+/* inode link, used to track inodes using quota via dq_ilink_list */
-+struct vz_quota_ilink {
-+ struct vz_quota_master *qmblk;
-+ struct vz_quota_ugid *qugid[MAXQUOTAS];
-+ struct list_head list;
-+ unsigned char origin;
-+};
-+
-+#endif /* _VZDQUOTA_QLNK_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzratelimit.h linux-2.6.9-ve023stab030/include/linux/vzratelimit.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzratelimit.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzratelimit.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,28 @@
-+/*
-+ * include/linux/vzratelimit.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VZ_RATELIMIT_H__
-+#define __VZ_RATELIMIT_H__
-+
-+/*
-+ * Generic ratelimiting stuff.
-+ */
-+
-+struct vz_rate_info {
-+ int burst;
-+ int interval; /* jiffy_t per event */
-+ int bucket; /* kind of leaky bucket */
-+ unsigned long last; /* last event */
-+};
-+
-+/* Return true if rate limit permits. */
-+int vz_ratelimit(struct vz_rate_info *p);
-+
-+#endif /* __VZ_RATELIMIT_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/vzstat.h linux-2.6.9-ve023stab030/include/linux/vzstat.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/vzstat.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/linux/vzstat.h 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,176 @@
-+/*
-+ * include/linux/vzstat.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __VZSTAT_H__
-+#define __VZSTAT_H__
-+
-+struct swap_cache_info_struct {
-+ unsigned long add_total;
-+ unsigned long del_total;
-+ unsigned long find_success;
-+ unsigned long find_total;
-+ unsigned long noent_race;
-+ unsigned long exist_race;
-+ unsigned long remove_race;
-+};
-+
-+struct kstat_lat_snap_struct {
-+ cycles_t maxlat, totlat;
-+ unsigned long count;
-+};
-+struct kstat_lat_pcpu_snap_struct {
-+ cycles_t maxlat, totlat;
-+ unsigned long count;
-+ seqcount_t lock;
-+} ____cacheline_maxaligned_in_smp;
-+
-+struct kstat_lat_struct {
-+ struct kstat_lat_snap_struct cur, last;
-+ cycles_t avg[3];
-+};
-+struct kstat_lat_pcpu_struct {
-+ struct kstat_lat_pcpu_snap_struct cur[NR_CPUS];
-+ cycles_t max_snap;
-+ struct kstat_lat_snap_struct last;
-+ cycles_t avg[3];
-+};
-+
-+struct kstat_perf_snap_struct {
-+ cycles_t wall_tottime, cpu_tottime;
-+ cycles_t wall_maxdur, cpu_maxdur;
-+ unsigned long count;
-+};
-+struct kstat_perf_struct {
-+ struct kstat_perf_snap_struct cur, last;
-+};
-+
-+struct kstat_zone_avg {
-+ unsigned long free_pages_avg[3],
-+ nr_active_avg[3],
-+ nr_inactive_avg[3];
-+};
-+
-+#define KSTAT_ALLOCSTAT_NR 5
-+
-+struct kernel_stat_glob {
-+ unsigned long nr_unint_avg[3];
-+
-+ unsigned long alloc_fails[KSTAT_ALLOCSTAT_NR];
-+ struct kstat_lat_struct alloc_lat[KSTAT_ALLOCSTAT_NR];
-+ struct kstat_lat_pcpu_struct sched_lat;
-+ struct kstat_lat_struct swap_in;
-+
-+ struct kstat_perf_struct ttfp, cache_reap,
-+ refill_inact, shrink_icache, shrink_dcache;
-+
-+ struct kstat_zone_avg zone_avg[3]; /* MAX_NR_ZONES */
-+} ____cacheline_aligned;
-+
-+extern struct kernel_stat_glob kstat_glob ____cacheline_aligned;
-+extern spinlock_t kstat_glb_lock;
-+
-+#define KSTAT_PERF_ENTER(name) \
-+ unsigned long flags; \
-+ cycles_t start, sleep_time; \
-+ \
-+ start = get_cycles(); \
-+ sleep_time = VE_TASK_INFO(current)->sleep_time; \
-+
-+#define KSTAT_PERF_LEAVE(name) \
-+ spin_lock_irqsave(&kstat_glb_lock, flags); \
-+ kstat_glob.name.cur.count++; \
-+ start = get_cycles() - start; \
-+ if (kstat_glob.name.cur.wall_maxdur < start) \
-+ kstat_glob.name.cur.wall_maxdur = start;\
-+ kstat_glob.name.cur.wall_tottime += start; \
-+ start -= VE_TASK_INFO(current)->sleep_time - \
-+ sleep_time; \
-+ if (kstat_glob.name.cur.cpu_maxdur < start) \
-+ kstat_glob.name.cur.cpu_maxdur = start; \
-+ kstat_glob.name.cur.cpu_tottime += start; \
-+ spin_unlock_irqrestore(&kstat_glb_lock, flags); \
-+
-+/*
-+ * Add another statistics reading.
-+ * Serialization is the caller's due.
-+ */
-+static inline void KSTAT_LAT_ADD(struct kstat_lat_struct *p,
-+ cycles_t dur)
-+{
-+ p->cur.count++;
-+ if (p->cur.maxlat < dur)
-+ p->cur.maxlat = dur;
-+ p->cur.totlat += dur;
-+}
-+
-+static inline void KSTAT_LAT_PCPU_ADD(struct kstat_lat_pcpu_struct *p, int cpu,
-+ cycles_t dur)
-+{
-+ struct kstat_lat_pcpu_snap_struct *cur;
-+
-+ cur = &p->cur[cpu];
-+ write_seqcount_begin(&cur->lock);
-+ cur->count++;
-+ if (cur->maxlat < dur)
-+ cur->maxlat = dur;
-+ cur->totlat += dur;
-+ write_seqcount_end(&cur->lock);
-+}
-+
-+/*
-+ * Move current statistics to last, clear last.
-+ * Serialization is the caller's due.
-+ */
-+static inline void KSTAT_LAT_UPDATE(struct kstat_lat_struct *p)
-+{
-+ cycles_t m;
-+ memcpy(&p->last, &p->cur, sizeof(p->last));
-+ p->cur.maxlat = 0;
-+ m = p->last.maxlat;
-+ CALC_LOAD(p->avg[0], EXP_1, m)
-+ CALC_LOAD(p->avg[1], EXP_5, m)
-+ CALC_LOAD(p->avg[2], EXP_15, m)
-+}
-+
-+static inline void KSTAT_LAT_PCPU_UPDATE(struct kstat_lat_pcpu_struct *p)
-+{
-+ unsigned i, cpu;
-+ struct kstat_lat_pcpu_snap_struct snap, *cur;
-+ cycles_t m;
-+
-+ memset(&p->last, 0, sizeof(p->last));
-+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
-+ cur = &p->cur[cpu];
-+ do {
-+ i = read_seqcount_begin(&cur->lock);
-+ memcpy(&snap, cur, sizeof(snap));
-+ } while (read_seqcount_retry(&cur->lock, i));
-+ /*
-+ * read above and this update of maxlat is not atomic,
-+ * but this is OK, since it happens rarely and losing
-+ * a couple of peaks is not essential. xemul
-+ */
-+ cur->maxlat = 0;
-+
-+ p->last.count += snap.count;
-+ p->last.totlat += snap.totlat;
-+ if (p->last.maxlat < snap.maxlat)
-+ p->last.maxlat = snap.maxlat;
-+ }
-+
-+ m = (p->last.maxlat > p->max_snap ? p->last.maxlat : p->max_snap);
-+ CALC_LOAD(p->avg[0], EXP_1, m);
-+ CALC_LOAD(p->avg[1], EXP_5, m);
-+ CALC_LOAD(p->avg[2], EXP_15, m);
-+ /* reset max_snap to calculate it correctly next time */
-+ p->max_snap = 0;
-+}
-+
-+#endif /* __VZSTAT_H__ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/linux/zlib.h linux-2.6.9-ve023stab030/include/linux/zlib.h
---- linux-2.6.9-42.0.3.EL.orig/include/linux/zlib.h 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/linux/zlib.h 2006-10-11 19:07:55.000000000 +0400
-@@ -506,6 +506,11 @@ extern int zlib_deflateReset (z_streamp
- stream state was inconsistent (such as zalloc or state being NULL).
- */
-
-+static inline unsigned long deflateBound(unsigned long s)
-+{
-+ return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
-+}
-+
- extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
- /*
- Dynamically update the compression level and compression strategy. The
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/af_unix.h linux-2.6.9-ve023stab030/include/net/af_unix.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/af_unix.h 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/af_unix.h 2006-10-11 19:08:00.000000000 +0400
-@@ -3,6 +3,7 @@
- extern void unix_inflight(struct file *fp);
- extern void unix_notinflight(struct file *fp);
- extern void unix_gc(void);
-+extern void unix_destruct_fds(struct sk_buff *skb);
-
- #define UNIX_HASH_SIZE 256
-
-@@ -13,23 +14,37 @@ extern atomic_t unix_tot_inflight;
-
- static inline struct sock *first_unix_socket(int *i)
- {
-+ struct sock *s;
-+ struct ve_struct *ve;
-+
-+ ve = get_exec_env();
- for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
-- if (!hlist_empty(&unix_socket_table[*i]))
-- return __sk_head(&unix_socket_table[*i]);
-+ for (s = sk_head(&unix_socket_table[*i]);
-+ s != NULL && !ve_accessible(VE_OWNER_SK(s), ve);
-+ s = sk_next(s));
-+ if (s != NULL)
-+ return s;
- }
- return NULL;
- }
-
- static inline struct sock *next_unix_socket(int *i, struct sock *s)
- {
-- struct sock *next = sk_next(s);
-- /* More in this chain? */
-- if (next)
-- return next;
-+ struct ve_struct *ve;
-+
-+ ve = get_exec_env();
-+ for (s = sk_next(s); s != NULL; s = sk_next(s)) {
-+ if (!ve_accessible(VE_OWNER_SK(s), ve))
-+ continue;
-+ return s;
-+ }
- /* Look for next non-empty chain. */
- for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
-- if (!hlist_empty(&unix_socket_table[*i]))
-- return __sk_head(&unix_socket_table[*i]);
-+ for (s = sk_head(&unix_socket_table[*i]);
-+ s != NULL && !ve_accessible(VE_OWNER_SK(s), ve);
-+ s = sk_next(s));
-+ if (s != NULL)
-+ return s;
- }
- return NULL;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/arp.h linux-2.6.9-ve023stab030/include/net/arp.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/arp.h 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/arp.h 2006-10-11 19:07:57.000000000 +0400
-@@ -7,7 +7,14 @@
-
- #define HAVE_ARP_CREATE
-
--extern struct neigh_table arp_tbl;
-+#ifdef CONFIG_VE
-+#define arp_tbl (*(get_exec_env()->ve_arp_tbl))
-+extern int ve_arp_init(struct ve_struct *ve);
-+extern void ve_arp_fini(struct ve_struct *ve);
-+#else
-+struct neigh_table global_arp_tbl;
-+#define arp_tbl global_arp_tbl
-+#endif
-
- extern void arp_init(void);
- extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/compat.h linux-2.6.9-ve023stab030/include/net/compat.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/compat.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/compat.h 2006-10-11 19:08:01.000000000 +0400
-@@ -23,6 +23,12 @@ struct compat_cmsghdr {
- compat_int_t cmsg_type;
- };
-
-+#if defined(CONFIG_X86_64)
-+#define is_current_32bits() (current_thread_info()->flags & _TIF_IA32)
-+#else
-+#define is_current_32bits() 0
-+#endif
-+
- #else /* defined(CONFIG_COMPAT) */
- #define compat_msghdr msghdr /* to avoid compiler warnings */
- #endif /* defined(CONFIG_COMPAT) */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/flow.h linux-2.6.9-ve023stab030/include/net/flow.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/flow.h 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/flow.h 2006-10-11 19:07:57.000000000 +0400
-@@ -10,6 +10,7 @@
- #include <linux/in6.h>
- #include <asm/atomic.h>
-
-+struct ve_struct;
- struct flowi {
- int oif;
- int iif;
-@@ -77,6 +78,9 @@ struct flowi {
- #define fl_icmp_type uli_u.icmpt.type
- #define fl_icmp_code uli_u.icmpt.code
- #define fl_ipsec_spi uli_u.spi
-+#ifdef CONFIG_VE
-+ struct ve_struct *owner_env;
-+#endif
- } __attribute__((__aligned__(BITS_PER_LONG/8)));
-
- #define FLOW_DIR_IN 0
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/icmp.h linux-2.6.9-ve023stab030/include/net/icmp.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/icmp.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/icmp.h 2006-10-11 19:07:57.000000000 +0400
-@@ -34,9 +34,14 @@ struct icmp_err {
-
- extern struct icmp_err icmp_err_convert[];
- DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics);
--#define ICMP_INC_STATS(field) SNMP_INC_STATS(icmp_statistics, field)
--#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field)
--#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field)
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_icmp_statistics (get_exec_env()->_icmp_statistics)
-+#else
-+#define ve_icmp_statistics icmp_statistics
-+#endif
-+#define ICMP_INC_STATS(field) SNMP_INC_STATS(ve_icmp_statistics, field)
-+#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ve_icmp_statistics, field)
-+#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ve_icmp_statistics, field)
-
- extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info);
- extern int icmp_rcv(struct sk_buff *skb);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/ip.h linux-2.6.9-ve023stab030/include/net/ip.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/ip.h 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/ip.h 2006-10-11 19:07:57.000000000 +0400
-@@ -151,17 +151,34 @@ struct ipv4_config
-
- extern struct ipv4_config ipv4_config;
- DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
--#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
--#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
--#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field)
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_ip_statistics (get_exec_env()->_ip_statistics)
-+#else
-+#define ve_ip_statistics ip_statistics
-+#endif
-+#define IP_INC_STATS(field) SNMP_INC_STATS(ve_ip_statistics, field)
-+#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ve_ip_statistics, field)
-+#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ve_ip_statistics, field)
- DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
--#define NET_INC_STATS(field) SNMP_INC_STATS(net_statistics, field)
--#define NET_INC_STATS_BH(field) SNMP_INC_STATS_BH(net_statistics, field)
--#define NET_INC_STATS_USER(field) SNMP_INC_STATS_USER(net_statistics, field)
--#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd)
--#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd)
--
--extern int sysctl_local_port_range[2];
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_net_statistics (get_exec_env()->_net_statistics)
-+#else
-+#define ve_net_statistics net_statistics
-+#endif
-+#define NET_INC_STATS(field) SNMP_INC_STATS(ve_net_statistics, field)
-+#define NET_INC_STATS_BH(field) SNMP_INC_STATS_BH(ve_net_statistics, field)
-+#define NET_INC_STATS_USER(field) SNMP_INC_STATS_USER(ve_net_statistics, field)
-+#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(ve_net_statistics, field, adnd)
-+#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(ve_net_statistics, field, adnd)
-+
-+extern int _sysctl_local_port_range[];
-+#ifdef CONFIG_VE
-+#define sysctl_local_port_range (get_exec_env()->_sysctl_local_port_range)
-+#else
-+#define sysctl_local_port_range _sysctl_local_port_range
-+#endif
-+extern int ip_local_port_range_min[];
-+extern int ip_local_port_range_max[];
- extern int sysctl_ip_default_ttl;
- extern int sysctl_ip_nonlocal_bind;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/ip_fib.h linux-2.6.9-ve023stab030/include/net/ip_fib.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/ip_fib.h 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/ip_fib.h 2006-10-11 19:07:57.000000000 +0400
-@@ -138,10 +138,22 @@ struct fib_table {
- unsigned char tb_data[0];
- };
-
-+struct fn_zone;
-+struct fn_hash
-+{
-+ struct fn_zone *fn_zones[33];
-+ struct fn_zone *fn_zone_list;
-+};
-+
- #ifndef CONFIG_IP_MULTIPLE_TABLES
-
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ip_fib_local_table get_exec_env()->_local_table
-+#define ip_fib_main_table get_exec_env()->_main_table
-+#else
- extern struct fib_table *ip_fib_local_table;
- extern struct fib_table *ip_fib_main_table;
-+#endif
-
- static inline struct fib_table *fib_get_table(int id)
- {
-@@ -173,7 +185,12 @@ static inline void fib_select_default(co
- #define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL])
- #define ip_fib_main_table (fib_tables[RT_TABLE_MAIN])
-
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define fib_tables get_exec_env()->_fib_tables
-+#else
- extern struct fib_table * fib_tables[RT_TABLE_MAX+1];
-+#endif
-+
- extern int fib_lookup(const struct flowi *flp, struct fib_result *res);
- extern struct fib_table *__fib_new_table(int id);
- extern void fib_rule_put(struct fib_rule *r);
-@@ -219,10 +236,19 @@ extern u32 __fib_res_prefsrc(struct fib
-
- /* Exported by fib_hash.c */
- extern struct fib_table *fib_hash_init(int id);
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+struct ve_struct;
-+extern int init_ve_route(struct ve_struct *ve);
-+extern void fini_ve_route(struct ve_struct *ve);
-+#else
-+#define init_ve_route(ve) (0)
-+#define fini_ve_route(ve) do { } while (0)
-+#endif
-
- #ifdef CONFIG_IP_MULTIPLE_TABLES
- /* Exported by fib_rules.c */
--
-+extern int fib_rules_create(void);
-+extern void fib_rules_destroy(void);
- extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
- extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
- extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/ndisc.h linux-2.6.9-ve023stab030/include/net/ndisc.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/ndisc.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/ndisc.h 2006-10-11 19:07:57.000000000 +0400
-@@ -37,7 +37,14 @@
- #include <net/neighbour.h>
- #include <asm/atomic.h>
-
--extern struct neigh_table nd_tbl;
-+#ifdef CONFIG_VE
-+#define nd_tbl (*(get_exec_env()->ve_nd_tbl))
-+extern int ve_ndisc_init(struct ve_struct *ve);
-+extern void ve_ndisc_fini(struct ve_struct *ve);
-+#else
-+extern struct neigh_table global_nd_tbl;
-+#define nd_tbl global_nd_tbl
-+#endif
-
- struct nd_msg {
- struct icmp6hdr icmph;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/neighbour.h linux-2.6.9-ve023stab030/include/net/neighbour.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/neighbour.h 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/neighbour.h 2006-10-11 19:07:57.000000000 +0400
-@@ -188,6 +188,8 @@ struct neigh_table
- atomic_t entries;
- rwlock_t lock;
- unsigned long last_rand;
-+ struct ve_struct *owner_env;
-+ struct user_beancounter *owner_ub;
- struct neigh_parms *parms_list;
- kmem_cache_t *kmem_cachep;
- struct neigh_statistics *stats;
-@@ -208,7 +210,7 @@ struct neigh_table
- #define NEIGH_UPDATE_F_ISROUTER 0x40000000
- #define NEIGH_UPDATE_F_ADMIN 0x80000000
-
--extern void neigh_table_init(struct neigh_table *tbl);
-+extern int neigh_table_init(struct neigh_table *tbl);
- extern int neigh_table_clear(struct neigh_table *tbl);
- extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
- const void *pkey,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/scm.h linux-2.6.9-ve023stab030/include/net/scm.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/scm.h 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/scm.h 2006-10-11 19:07:57.000000000 +0400
-@@ -40,7 +40,7 @@ static __inline__ int scm_send(struct so
- memset(scm, 0, sizeof(*scm));
- scm->creds.uid = current->uid;
- scm->creds.gid = current->gid;
-- scm->creds.pid = current->tgid;
-+ scm->creds.pid = virt_tgid(current);
- if (msg->msg_controllen <= 0)
- return 0;
- return __scm_send(sock, msg, scm);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/sock.h linux-2.6.9-ve023stab030/include/net/sock.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/sock.h 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/sock.h 2006-10-11 19:07:57.000000000 +0400
-@@ -55,6 +55,8 @@
- #include <net/dst.h>
- #include <net/checksum.h>
-
-+#include <ub/ub_net.h>
-+
- /*
- * This structure really needs to be cleaned up.
- * Most of it is for TCP, and not used by any of
-@@ -266,8 +268,12 @@ struct sock {
- struct sk_buff *skb);
- void (*sk_create_child)(struct sock *sk, struct sock *newsk);
- void (*sk_destruct)(struct sock *sk);
-+ struct sock_beancounter sk_bc;
-+ struct ve_struct *sk_owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(SK, SLAB, struct sock, sk_owner_env, , (noinline, regparm(1)))
-+
- /*
- * Hashed lists helper routines
- */
-@@ -488,6 +494,8 @@ do { if (!(__sk)->sk_backlog.tail) {
- })
-
- extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
-+extern int __sk_stream_wait_memory(struct sock *sk, long *timeo_p,
-+ unsigned long amount);
- extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
- extern void sk_stream_wait_close(struct sock *sk, long timeo_p);
- extern int sk_stream_error(struct sock *sk, int flags, int err);
-@@ -683,8 +691,11 @@ static inline void sk_stream_writequeue_
-
- static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
- {
-- return (int)skb->truesize <= sk->sk_forward_alloc ||
-- sk_stream_mem_schedule(sk, skb->truesize, 1);
-+ if ((int)skb->truesize > sk->sk_forward_alloc &&
-+ !sk_stream_mem_schedule(sk, skb->truesize, 1))
-+ /* The situation is bad according to mainstream. Den */
-+ return 0;
-+ return ub_tcprcvbuf_charge(sk, skb) == 0;
- }
-
- /* Used by processes to "lock" a socket state, so that
-@@ -733,6 +744,11 @@ extern struct sk_buff *sock_alloc_send
- unsigned long size,
- int noblock,
- int *errcode);
-+extern struct sk_buff *sock_alloc_send_skb2(struct sock *sk,
-+ unsigned long size,
-+ unsigned long size2,
-+ int noblock,
-+ int *errcode);
- extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
- unsigned long header_len,
- unsigned long data_len,
-@@ -1081,6 +1097,10 @@ static inline int sock_queue_rcv_skb(str
- goto out;
- }
-
-+ err = ub_sockrcvbuf_charge(sk, skb);
-+ if (err < 0)
-+ goto out;
-+
- /* It would be deadlock, if sock_queue_rcv_skb is used
- with socket lock! We assume that users of this
- function are lock free.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/tcp.h linux-2.6.9-ve023stab030/include/net/tcp.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/tcp.h 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/tcp.h 2006-10-11 19:07:58.000000000 +0400
-@@ -30,6 +30,7 @@
- #include <linux/slab.h>
- #include <linux/cache.h>
- #include <linux/percpu.h>
-+#include <linux/ve_owner.h>
- #include <net/checksum.h>
- #include <net/sock.h>
- #include <net/snmp.h>
-@@ -39,6 +40,10 @@
- #endif
- #include <linux/seq_file.h>
-
-+
-+#define TCP_PAGE(sk) (sk->sk_sndmsg_page)
-+#define TCP_OFF(sk) (sk->sk_sndmsg_off)
-+
- /* This is for all connections with a full identity, no wildcards.
- * New scheme, half the table is for TIME_WAIT, the other half is
- * for the rest. I'll experiment with dynamic table growth later.
-@@ -83,12 +88,16 @@ struct tcp_ehash_bucket {
- * ports are created in O(1) time? I thought so. ;-) -DaveM
- */
- struct tcp_bind_bucket {
-+ struct ve_struct *owner_env;
- unsigned short port;
- signed short fastreuse;
- struct hlist_node node;
- struct hlist_head owners;
- };
-
-+DCL_VE_OWNER_PROTO(TB, GENERIC, struct tcp_bind_bucket, owner_env,
-+ inline, (always_inline));
-+
- #define tb_for_each(tb, node, head) hlist_for_each_entry(tb, node, head, node)
-
- struct tcp_bind_hashbucket {
-@@ -155,16 +164,22 @@ extern struct tcp_hashinfo {
-
- extern kmem_cache_t *tcp_bucket_cachep;
- extern struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
-- unsigned short snum);
-+ unsigned short snum,
-+ struct ve_struct *env);
- extern void tcp_bucket_destroy(struct tcp_bind_bucket *tb);
- extern void tcp_bucket_unlock(struct sock *sk);
--extern int tcp_port_rover;
-+extern int _tcp_port_rover;
-+#ifdef CONFIG_VE
-+#define tcp_port_rover (get_exec_env()->_tcp_port_rover)
-+#else
-+#define tcp_port_rover _tcp_port_rover
-+#endif
- extern struct sock *tcp_v4_lookup_listener(u32 addr, unsigned short hnum, int dif);
-
- /* These are AF independent. */
--static __inline__ int tcp_bhashfn(__u16 lport)
-+static __inline__ int tcp_bhashfn(__u16 lport, unsigned veid)
- {
-- return (lport & (tcp_bhash_size - 1));
-+ return ((lport + (veid ^ (veid >> 16))) & (tcp_bhash_size - 1));
- }
-
- extern void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb,
-@@ -214,13 +229,19 @@ struct tcp_tw_bucket {
- unsigned long tw_ttd;
- struct tcp_bind_bucket *tw_tb;
- struct hlist_node tw_death_node;
-+ spinlock_t tw_lock;
- #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct in6_addr tw_v6_daddr;
- struct in6_addr tw_v6_rcv_saddr;
- int tw_v6_ipv6only;
- #endif
-+ envid_t tw_owner_env;
- };
-
-+#define TW_VEID(tw) ((tw)->tw_owner_env)
-+#define SET_TW_VEID(tw, veid) ((tw)->tw_owner_env) = (veid)
-+
-+
- static __inline__ void tw_add_node(struct tcp_tw_bucket *tw,
- struct hlist_head *list)
- {
-@@ -301,7 +322,11 @@ static inline int tcp_v6_ipv6only(const
- # define tcp_v6_ipv6only(__sk) 0
- #endif
-
-+#define TW_WSCALE_MASK 0x0f
-+#define TW_WSCALE_SPEC 0x10
-+
- extern kmem_cache_t *tcp_timewait_cachep;
-+#include <ub/ub_net.h>
-
- static inline void tcp_tw_put(struct tcp_tw_bucket *tw)
- {
-@@ -337,28 +362,38 @@ extern void tcp_tw_deschedule(struct tcp
- #define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr) \
- __u64 __name = (((__u64)(__daddr))<<32)|((__u64)(__saddr));
- #endif /* __BIG_ENDIAN */
--#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
-+#define TCP_IPV4_MATCH_ALLVE(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- (((*((__u64 *)&(inet_sk(__sk)->daddr)))== (__cookie)) && \
- ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
- (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
--#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
-+#define TCP_IPV4_TW_MATCH_ALLVE(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- (((*((__u64 *)&(tcptw_sk(__sk)->tw_daddr))) == (__cookie)) && \
- ((*((__u32 *)&(tcptw_sk(__sk)->tw_dport))) == (__ports)) && \
- (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
- #else /* 32-bit arch */
- #define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr)
--#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
-+#define TCP_IPV4_MATCH_ALLVE(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- ((inet_sk(__sk)->daddr == (__saddr)) && \
- (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
- ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
- (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
--#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
-+#define TCP_IPV4_TW_MATCH_ALLVE(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- ((tcptw_sk(__sk)->tw_daddr == (__saddr)) && \
- (tcptw_sk(__sk)->tw_rcv_saddr == (__daddr)) && \
- ((*((__u32 *)&(tcptw_sk(__sk)->tw_dport))) == (__ports)) && \
- (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
- #endif /* 64-bit arch */
-
-+#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif, __ve)\
-+ (TCP_IPV4_MATCH_ALLVE((__sk), (__cookie), (__saddr), (__daddr), \
-+ (__ports), (__dif)) \
-+ && ve_accessible_strict(VE_OWNER_SK((__sk)), (__ve)))
-+
-+#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif, __ve)\
-+ (TCP_IPV4_TW_MATCH_ALLVE((__sk), (__cookie), (__saddr), (__daddr), \
-+ (__ports), (__dif)) \
-+ && ve_accessible_strict(TW_VEID(tcptw_sk(__sk)), VEID(__ve)))
-+
- #define TCP_IPV6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \
- (((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
- ((__sk)->sk_family == AF_INET6) && \
-@@ -367,16 +402,16 @@ extern void tcp_tw_deschedule(struct tcp
- (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
-
- /* These can have wildcards, don't try too hard. */
--static __inline__ int tcp_lhashfn(unsigned short num)
-+static __inline__ int tcp_lhashfn(unsigned short num, unsigned veid)
- {
-- return num & (TCP_LHTABLE_SIZE - 1);
-+ return ((num + (veid ^ (veid >> 16))) & (TCP_LHTABLE_SIZE - 1));
- }
-
- static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
- {
-- return tcp_lhashfn(inet_sk(sk)->num);
-+ return tcp_lhashfn(inet_sk(sk)->num, VEID(VE_OWNER_SK(sk)));
- }
--
-+
- #define MAX_TCP_HEADER (128 + MAX_HEADER)
-
- /*
-@@ -586,6 +621,8 @@ extern int sysctl_tcp_rfc1337;
- extern int sysctl_tcp_abort_on_overflow;
- extern int sysctl_tcp_max_orphans;
- extern int sysctl_tcp_max_tw_buckets;
-+extern int sysctl_tcp_max_tw_kmem_fraction;
-+extern int sysctl_tcp_max_tw_buckets_ve;
- extern int sysctl_tcp_fack;
- extern int sysctl_tcp_reordering;
- extern int sysctl_tcp_ecn;
-@@ -594,7 +631,9 @@ extern int sysctl_tcp_mem[3];
- extern int sysctl_tcp_wmem[3];
- extern int sysctl_tcp_rmem[3];
- extern int sysctl_tcp_app_win;
-+#ifndef sysctl_tcp_adv_win_scale
- extern int sysctl_tcp_adv_win_scale;
-+#endif
- extern int sysctl_tcp_tw_reuse;
- extern int sysctl_tcp_frto;
- extern int sysctl_tcp_low_latency;
-@@ -610,6 +649,7 @@ extern int sysctl_tcp_bic_low_window;
- extern int sysctl_tcp_bic_beta;
- extern int sysctl_tcp_moderate_rcvbuf;
- extern int sysctl_tcp_tso_win_divisor;
-+extern int sysctl_tcp_use_sg;
-
- extern atomic_t tcp_memory_allocated;
- extern atomic_t tcp_sockets_allocated;
-@@ -762,12 +802,17 @@ static inline int between(__u32 seq1, __
- extern struct proto tcp_prot;
-
- DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
--#define TCP_INC_STATS(field) SNMP_INC_STATS(tcp_statistics, field)
--#define TCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(tcp_statistics, field)
--#define TCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(tcp_statistics, field)
--#define TCP_DEC_STATS(field) SNMP_DEC_STATS(tcp_statistics, field)
--#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val)
--#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val)
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_tcp_statistics (get_exec_env()->_tcp_statistics)
-+#else
-+#define ve_tcp_statistics tcp_statistics
-+#endif
-+#define TCP_INC_STATS(field) SNMP_INC_STATS(ve_tcp_statistics, field)
-+#define TCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ve_tcp_statistics, field)
-+#define TCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ve_tcp_statistics, field)
-+#define TCP_DEC_STATS(field) SNMP_DEC_STATS(ve_tcp_statistics, field)
-+#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(ve_tcp_statistics, field, val)
-+#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(ve_tcp_statistics, field, val)
-
- extern void tcp_put_port(struct sock *sk);
- extern void tcp_inherit_port(struct sock *sk, struct sock *child);
-@@ -834,9 +879,9 @@ static __inline__ void tcp_delack_init(s
- memset(&tp->ack, 0, sizeof(tp->ack));
- }
-
--static inline void tcp_clear_options(struct tcp_opt *tp)
-+static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
- {
-- tp->tstamp_ok = tp->sack_ok = tp->wscale_ok = tp->snd_wscale = 0;
-+ rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
- }
-
- enum tcp_tw_status
-@@ -885,7 +930,7 @@ extern int tcp_recvmsg(struct kiocb *i
- extern int tcp_listen_start(struct sock *sk);
-
- extern void tcp_parse_options(struct sk_buff *skb,
-- struct tcp_opt *tp,
-+ struct tcp_options_received *opt_rx,
- int estab);
-
- /*
-@@ -1068,7 +1113,7 @@ static __inline__ void __tcp_fast_path_o
-
- static __inline__ void tcp_fast_path_on(struct tcp_opt *tp)
- {
-- __tcp_fast_path_on(tp, tp->snd_wnd>>tp->snd_wscale);
-+ __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
- }
-
- static inline void tcp_fast_path_check(struct sock *sk, struct tcp_opt *tp)
-@@ -1105,7 +1150,7 @@ extern u32 __tcp_select_window(struct so
- * only use of the low 32-bits of jiffies and hide the ugly
- * casts with the following macro.
- */
--#define tcp_time_stamp ((__u32)(jiffies))
-+#define tcp_time_stamp ((__u32)(jiffies + get_exec_env()->jiffies_fixup))
-
- /* This is what the send packet queueing engine uses to pass
- * TCP per-packet control information to the transmission
-@@ -1350,7 +1395,7 @@ static inline __u32 tcp_current_ssthresh
-
- static inline void tcp_sync_left_out(struct tcp_opt *tp)
- {
-- if (tp->sack_ok &&
-+ if (tp->rx_opt.sack_ok &&
- (tcp_get_pcount(&tp->sacked_out) >=
- tcp_get_pcount(&tp->packets_out) - tcp_get_pcount(&tp->lost_out)))
- tcp_set_pcount(&tp->sacked_out,
-@@ -1680,39 +1725,39 @@ static __inline__ void tcp_done(struct s
- tcp_destroy_sock(sk);
- }
-
--static __inline__ void tcp_sack_reset(struct tcp_opt *tp)
-+static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt)
- {
-- tp->dsack = 0;
-- tp->eff_sacks = 0;
-- tp->num_sacks = 0;
-+ rx_opt->dsack = 0;
-+ rx_opt->eff_sacks = 0;
-+ rx_opt->num_sacks = 0;
- }
-
- static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_opt *tp, __u32 tstamp)
- {
-- if (tp->tstamp_ok) {
-+ if (tp->rx_opt.tstamp_ok) {
- *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
- (TCPOPT_NOP << 16) |
- (TCPOPT_TIMESTAMP << 8) |
- TCPOLEN_TIMESTAMP);
- *ptr++ = htonl(tstamp);
-- *ptr++ = htonl(tp->ts_recent);
-+ *ptr++ = htonl(tp->rx_opt.ts_recent);
- }
-- if (tp->eff_sacks) {
-- struct tcp_sack_block *sp = tp->dsack ? tp->duplicate_sack : tp->selective_acks;
-+ if (tp->rx_opt.eff_sacks) {
-+ struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks;
- int this_sack;
-
- *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
- (TCPOPT_NOP << 16) |
- (TCPOPT_SACK << 8) |
- (TCPOLEN_SACK_BASE +
-- (tp->eff_sacks * TCPOLEN_SACK_PERBLOCK)));
-- for(this_sack = 0; this_sack < tp->eff_sacks; this_sack++) {
-+ (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)));
-+ for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) {
- *ptr++ = htonl(sp[this_sack].start_seq);
- *ptr++ = htonl(sp[this_sack].end_seq);
- }
-- if (tp->dsack) {
-- tp->dsack = 0;
-- tp->eff_sacks--;
-+ if (tp->rx_opt.dsack) {
-+ tp->rx_opt.dsack = 0;
-+ tp->rx_opt.eff_sacks--;
- }
- }
- }
-@@ -1858,17 +1903,17 @@ static inline void tcp_synq_drop(struct
- }
-
- static __inline__ void tcp_openreq_init(struct open_request *req,
-- struct tcp_opt *tp,
-+ struct tcp_options_received *rx_opt,
- struct sk_buff *skb)
- {
- req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
- req->rcv_isn = TCP_SKB_CB(skb)->seq;
-- req->mss = tp->mss_clamp;
-- req->ts_recent = tp->saw_tstamp ? tp->rcv_tsval : 0;
-- req->tstamp_ok = tp->tstamp_ok;
-- req->sack_ok = tp->sack_ok;
-- req->snd_wscale = tp->snd_wscale;
-- req->wscale_ok = tp->wscale_ok;
-+ req->mss = rx_opt->mss_clamp;
-+ req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
-+ req->tstamp_ok = rx_opt->tstamp_ok;
-+ req->sack_ok = rx_opt->sack_ok;
-+ req->snd_wscale = rx_opt->snd_wscale;
-+ req->wscale_ok = rx_opt->wscale_ok;
- req->acked = 0;
- req->ecn_ok = 0;
- req->rmt_port = skb->h.th->source;
-@@ -1917,11 +1962,11 @@ static inline int tcp_fin_time(struct tc
- return fin_timeout;
- }
-
--static inline int tcp_paws_check(struct tcp_opt *tp, int rst)
-+static inline int tcp_paws_check(struct tcp_options_received *rx_opt, int rst)
- {
-- if ((s32)(tp->rcv_tsval - tp->ts_recent) >= 0)
-+ if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
- return 0;
-- if (xtime.tv_sec >= tp->ts_recent_stamp + TCP_PAWS_24DAYS)
-+ if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
- return 0;
-
- /* RST segments are not recommended to carry timestamp,
-@@ -1936,7 +1981,7 @@ static inline int tcp_paws_check(struct
-
- However, we can relax time bounds for RST segments to MSL.
- */
-- if (rst && xtime.tv_sec >= tp->ts_recent_stamp + TCP_PAWS_MSL)
-+ if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
- return 0;
- return 1;
- }
-@@ -1948,6 +1993,8 @@ static inline void tcp_v4_setup_caps(str
- if (sk->sk_no_largesend || dst->header_len)
- sk->sk_route_caps &= ~NETIF_F_TSO;
- }
-+ if (!sysctl_tcp_use_sg)
-+ sk->sk_route_caps &= ~NETIF_F_SG;
- }
-
- #define TCP_CHECK_TIMER(sk) do { } while (0)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/net/udp.h linux-2.6.9-ve023stab030/include/net/udp.h
---- linux-2.6.9-42.0.3.EL.orig/include/net/udp.h 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/include/net/udp.h 2006-10-11 19:07:57.000000000 +0400
-@@ -40,13 +40,19 @@ extern rwlock_t udp_hash_lock;
-
- extern int udp_port_rover;
-
--static inline int udp_lport_inuse(u16 num)
-+static inline int udp_hashfn(u16 num, unsigned veid)
-+{
-+ return ((num + (veid ^ (veid >> 16))) & (UDP_HTABLE_SIZE - 1));
-+}
-+
-+static inline int udp_lport_inuse(u16 num, struct ve_struct *env)
- {
- struct sock *sk;
- struct hlist_node *node;
-
-- sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)])
-- if (inet_sk(sk)->num == num)
-+ sk_for_each(sk, node, &udp_hash[udp_hashfn(num, VEID(env))])
-+ if (inet_sk(sk)->num == num &&
-+ ve_accessible_strict(VE_OWNER_SK(sk), env))
- return 1;
- return 0;
- }
-@@ -73,9 +79,14 @@ extern int udp_ioctl(struct sock *sk, in
- extern int udp_disconnect(struct sock *sk, int flags);
-
- DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
--#define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field)
--#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field)
--#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field)
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_udp_statistics (get_exec_env()->_udp_statistics)
-+#else
-+#define ve_udp_statistics udp_statistics
-+#endif
-+#define UDP_INC_STATS(field) SNMP_INC_STATS(ve_udp_statistics, field)
-+#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ve_udp_statistics, field)
-+#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ve_udp_statistics, field)
-
- /* /proc */
- struct udp_seq_afinfo {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/beancounter.h linux-2.6.9-ve023stab030/include/ub/beancounter.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/beancounter.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/beancounter.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,373 @@
-+/*
-+ * include/ub/beancounter.h
-+ *
-+ * Copyright (C) 1999-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * Andrey Savochkin saw@sw-soft.com
-+ *
-+ */
-+
-+#ifndef _LINUX_BEANCOUNTER_H
-+#define _LINUX_BEANCOUNTER_H
-+
-+/*
-+ * Generic ratelimiting stuff.
-+ */
-+
-+struct ub_rate_info {
-+ int burst;
-+ int interval; /* jiffy_t per event */
-+ int bucket; /* kind of leaky bucket */
-+ unsigned long last; /* last event */
-+};
-+
-+/* Return true if rate limit permits. */
-+int ub_ratelimit(struct ub_rate_info *);
-+
-+#include <ub/ub_decl.h>
-+
-+/*
-+ * This magic is used to distinuish user beancounter and pages beancounter
-+ * in struct page. page_ub and page_bc are placed in union and MAGIC
-+ * ensures us that we don't use pbc as ubc in ub_page_uncharge().
-+ */
-+#define UB_MAGIC 0x62756275
-+
-+/*
-+ * Resource list.
-+ */
-+
-+#define UB_KMEMSIZE 0 /* Unswappable kernel memory size including
-+ * struct task, page directories, etc.
-+ */
-+#define UB_LOCKEDPAGES 1 /* Mlock()ed pages. */
-+#define UB_PRIVVMPAGES 2 /* Total number of pages, counting potentially
-+ * private pages as private and used.
-+ */
-+#define UB_SHMPAGES 3 /* IPC SHM segment size. */
-+#define UB_ZSHMPAGES 4 /* Anonymous shared memory. */
-+#define UB_NUMPROC 5 /* Number of processes. */
-+#define UB_PHYSPAGES 6 /* All resident pages, for swapout guarantee. */
-+#define UB_VMGUARPAGES 7 /* Guarantee for memory allocation,
-+ * checked against PRIVVMPAGES.
-+ */
-+#define UB_OOMGUARPAGES 8 /* Guarantees against OOM kill.
-+ * Only limit is used, no accounting.
-+ */
-+#define UB_NUMTCPSOCK 9 /* Number of TCP sockets. */
-+#define UB_NUMFLOCK 10 /* Number of file locks. */
-+#define UB_NUMPTY 11 /* Number of PTYs. */
-+#define UB_NUMSIGINFO 12 /* Number of siginfos. */
-+#define UB_TCPSNDBUF 13 /* Total size of tcp send buffers. */
-+#define UB_TCPRCVBUF 14 /* Total size of tcp receive buffers. */
-+#define UB_OTHERSOCKBUF 15 /* Total size of other socket
-+ * send buffers (all buffers for PF_UNIX).
-+ */
-+#define UB_DGRAMRCVBUF 16 /* Total size of other socket
-+ * receive buffers.
-+ */
-+#define UB_NUMOTHERSOCK 17 /* Number of other sockets. */
-+#define UB_DCACHESIZE 18 /* Size of busy dentry/inode cache. */
-+#define UB_NUMFILE 19 /* Number of open files. */
-+
-+#define UB_RESOURCES 24
-+
-+#define UB_UNUSEDPRIVVM (UB_RESOURCES + 0)
-+#define UB_TMPFSPAGES (UB_RESOURCES + 1)
-+#define UB_SWAPPAGES (UB_RESOURCES + 2)
-+#define UB_HELDPAGES (UB_RESOURCES + 3)
-+
-+struct ubparm {
-+ /*
-+ * A barrier over which resource allocations are failed gracefully.
-+ * If the amount of consumed memory is over the barrier further sbrk()
-+ * or mmap() calls fail, the existing processes are not killed.
-+ */
-+ unsigned long barrier;
-+ /* hard resource limit */
-+ unsigned long limit;
-+ /* consumed resources */
-+ unsigned long held;
-+ /* maximum amount of consumed resources through the last period */
-+ unsigned long maxheld;
-+ /* minimum amount of consumed resources through the last period */
-+ unsigned long minheld;
-+ /* count of failed charges */
-+ unsigned long failcnt;
-+};
-+
-+/*
-+ * Kernel internal part.
-+ */
-+
-+#ifdef __KERNEL__
-+
-+#include <linux/config.h>
-+#include <ub/ub_debug.h>
-+#include <linux/interrupt.h>
-+#include <asm/atomic.h>
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <linux/cache.h>
-+#include <linux/threads.h>
-+
-+/*
-+ * UB_MAXVALUE is essentially LONG_MAX declared in a cross-compiling safe form.
-+ */
-+#define UB_MAXVALUE ( (1UL << (sizeof(unsigned long)*8-1)) - 1)
-+
-+
-+/*
-+ * Resource management structures
-+ * Serialization issues:
-+ * beancounter list management is protected via ub_hash_lock
-+ * task pointers are set only for current task and only once
-+ * refcount is managed atomically
-+ * value and limit comparison and change are protected by per-ub spinlock
-+ */
-+
-+struct page_beancounter;
-+struct task_beancounter;
-+struct sock_beancounter;
-+
-+struct page_private {
-+ unsigned long ubp_unused_privvmpages;
-+ unsigned long ubp_tmpfs_respages;
-+ unsigned long ubp_swap_pages;
-+ unsigned long long ubp_held_pages;
-+};
-+
-+struct sock_private {
-+ unsigned long ubp_rmem_thres;
-+ unsigned long ubp_wmem_pressure;
-+ unsigned long ubp_maxadvmss;
-+ unsigned long ubp_rmem_pressure;
-+#define UB_RMEM_EXPAND 0
-+#define UB_RMEM_KEEP 1
-+#define UB_RMEM_SHRINK 2
-+ struct list_head ubp_other_socks;
-+ struct list_head ubp_tcp_socks;
-+ atomic_t ubp_orphan_count;
-+};
-+
-+struct ub_perfstat {
-+ unsigned long unmap;
-+ unsigned long swapin;
-+} ____cacheline_aligned_in_smp;
-+
-+struct user_beancounter
-+{
-+ unsigned long ub_magic;
-+ atomic_t ub_refcount;
-+ struct user_beancounter *ub_next;
-+ spinlock_t ub_lock;
-+ uid_t ub_uid;
-+
-+ struct ub_rate_info ub_limit_rl;
-+ int ub_oom_noproc;
-+
-+ struct page_private ppriv;
-+#define ub_unused_privvmpages ppriv.ubp_unused_privvmpages
-+#define ub_tmpfs_respages ppriv.ubp_tmpfs_respages
-+#define ub_swap_pages ppriv.ubp_swap_pages
-+#define ub_held_pages ppriv.ubp_held_pages
-+ struct sock_private spriv;
-+#define ub_rmem_thres spriv.ubp_rmem_thres
-+#define ub_maxadvmss spriv.ubp_maxadvmss
-+#define ub_rmem_pressure spriv.ubp_rmem_pressure
-+#define ub_wmem_pressure spriv.ubp_wmem_pressure
-+#define ub_tcp_sk_list spriv.ubp_tcp_socks
-+#define ub_other_sk_list spriv.ubp_other_socks
-+#define ub_orphan_count spriv.ubp_orphan_count
-+
-+ struct user_beancounter *parent;
-+ void *private_data;
-+ unsigned long ub_aflags;
-+
-+ /* resources statistic and settings */
-+ struct ubparm ub_parms[UB_RESOURCES];
-+ /* resources statistic for last interval */
-+ struct ubparm ub_store[UB_RESOURCES];
-+
-+ struct ub_perfstat ub_perfstat[NR_CPUS];
-+
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+ struct list_head ub_cclist;
-+ long ub_pages_charged[NR_CPUS];
-+ long ub_vmalloc_charged[NR_CPUS];
-+#endif
-+ int ub_tw_count;
-+};
-+
-+enum ub_severity { UB_HARD, UB_SOFT, UB_FORCE };
-+
-+#define UB_AFLAG_NOTIF_PAGEIN 0
-+
-+static inline int ub_barrier_hit(struct user_beancounter *ub, int resource)
-+{
-+ return ub->ub_parms[resource].held > ub->ub_parms[resource].barrier;
-+}
-+
-+static inline int ub_hfbarrier_hit(struct user_beancounter *ub, int resource)
-+{
-+ return (ub->ub_parms[resource].held >
-+ ((ub->ub_parms[resource].barrier) >> 1));
-+}
-+
-+static inline int ub_barrier_farnr(struct user_beancounter *ub, int resource)
-+{
-+ struct ubparm *p;
-+ p = ub->ub_parms + resource;
-+ return p->held <= (p->barrier >> 3);
-+}
-+
-+static inline int ub_barrier_farsz(struct user_beancounter *ub, int resource)
-+{
-+ struct ubparm *p;
-+ p = ub->ub_parms + resource;
-+ return p->held <= (p->barrier >> 3) && p->barrier >= 1024 * 1024;
-+}
-+
-+#ifndef CONFIG_USER_RESOURCE
-+
-+extern inline struct user_beancounter *get_beancounter_byuid
-+ (uid_t uid, int create) { return NULL; }
-+extern inline struct user_beancounter *get_beancounter
-+ (struct user_beancounter *ub) { return NULL; }
-+extern inline void put_beancounter(struct user_beancounter *ub) { }
-+
-+static inline void page_ubc_init(void) { }
-+static inline void beancounter_init(unsigned long mempages) { }
-+static inline void ub0_init(void) { }
-+
-+static inline int charge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val,
-+ enum ub_severity strict) { return 0; }
-+static inline void uncharge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val) { }
-+
-+static inline void beancounter_proc_init(void) { };
-+
-+#else /* CONFIG_USER_RESOURCE */
-+
-+/*
-+ * Charge/uncharge operations
-+ */
-+
-+extern int __charge_beancounter_locked(struct user_beancounter *ub,
-+ int resource, unsigned long val, enum ub_severity strict);
-+
-+extern void __uncharge_beancounter_locked(struct user_beancounter *ub,
-+ int resource, unsigned long val);
-+
-+extern void __put_beancounter(struct user_beancounter *ub);
-+
-+extern void uncharge_warn(struct user_beancounter *ub, int resource,
-+ unsigned long val, unsigned long held);
-+
-+extern const char *ub_rnames[];
-+/*
-+ * Put a beancounter reference
-+ */
-+
-+static inline void put_beancounter(struct user_beancounter *ub)
-+{
-+ if (unlikely(ub == NULL))
-+ return;
-+
-+ __put_beancounter(ub);
-+}
-+
-+/* fast put, refcount can't reach zero */
-+static inline void __put_beancounter_batch(struct user_beancounter *ub, int n)
-+{
-+ atomic_sub(n, &ub->ub_refcount);
-+}
-+
-+static inline void put_beancounter_batch(struct user_beancounter *ub, int n)
-+{
-+ if (n > 1)
-+ __put_beancounter_batch(ub, n - 1);
-+ __put_beancounter(ub);
-+}
-+
-+/*
-+ * Create a new beancounter reference
-+ */
-+extern struct user_beancounter *get_beancounter_byuid(uid_t uid, int create);
-+
-+static inline
-+struct user_beancounter *get_beancounter(struct user_beancounter *ub)
-+{
-+ if (unlikely(ub == NULL))
-+ return NULL;
-+
-+ atomic_inc(&ub->ub_refcount);
-+ return ub;
-+}
-+
-+static inline void get_beancounter_batch(struct user_beancounter *ub, int n)
-+{
-+ atomic_add(n, &ub->ub_refcount);
-+}
-+
-+extern struct user_beancounter *get_subbeancounter_byid(
-+ struct user_beancounter *,
-+ int id, int create);
-+extern struct user_beancounter *subbeancounter_findcreate(
-+ struct user_beancounter *p, int id);
-+
-+extern void beancounter_init(unsigned long);
-+extern void page_ubc_init(void);
-+extern struct user_beancounter ub0;
-+extern void ub0_init(void);
-+#define get_ub0() (&ub0)
-+
-+extern void print_ub_uid(struct user_beancounter *ub, char *buf, int size);
-+
-+/*
-+ * Resource charging
-+ * Change user's account and compare against limits
-+ */
-+
-+static inline void ub_adjust_maxheld(struct user_beancounter *ub, int resource)
-+{
-+ if (ub->ub_parms[resource].maxheld < ub->ub_parms[resource].held)
-+ ub->ub_parms[resource].maxheld = ub->ub_parms[resource].held;
-+ if (ub->ub_parms[resource].minheld > ub->ub_parms[resource].held)
-+ ub->ub_parms[resource].minheld = ub->ub_parms[resource].held;
-+}
-+
-+int charge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val,
-+ enum ub_severity strict);
-+void uncharge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val);
-+void __charge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val);
-+void __uncharge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val);
-+
-+static inline void charge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ if (ub->parent != NULL)
-+ __charge_beancounter_notop(ub, resource, val);
-+}
-+
-+static inline void uncharge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ if (ub->parent != NULL)
-+ __uncharge_beancounter_notop(ub, resource, val);
-+}
-+
-+extern void beancounter_proc_init(void);
-+
-+#endif /* CONFIG_USER_RESOURCE */
-+
-+#endif /* __KERNEL__ */
-+#endif /* _LINUX_BEANCOUNTER_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_dcache.h linux-2.6.9-ve023stab030/include/ub/ub_dcache.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_dcache.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_dcache.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,48 @@
-+/*
-+ * include/ub/ub_dcache.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_DCACHE_H_
-+#define __UB_DCACHE_H_
-+
-+#include <ub/ub_decl.h>
-+
-+/*
-+ * UB_DCACHESIZE accounting
-+ */
-+
-+struct dentry_beancounter
-+{
-+ /*
-+ * d_inuse =
-+ * <number of external refs> +
-+ * <number of 'used' childs>
-+ *
-+ * d_inuse == -1 means that dentry is unused
-+ * state change -1 => 0 causes charge
-+ * state change 0 => -1 causes uncharge
-+ */
-+ atomic_t d_inuse;
-+ /* charged size, including name length if name is not inline */
-+ unsigned long d_ubsize;
-+ struct user_beancounter *d_ub;
-+};
-+
-+#ifdef CONFIG_USER_RESOURCE
-+
-+extern int ub_dentry_on;
-+extern void ub_dentry_checkup(void);
-+
-+#else
-+
-+static inline void ub_dentry_checkup(void) { }
-+
-+#endif
-+
-+#endif /* __UB_DCACHE_H_ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_dcache_op.h linux-2.6.9-ve023stab030/include/ub/ub_dcache_op.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_dcache_op.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_dcache_op.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,105 @@
-+/*
-+ * include/ub/ub_dcache_op.h
-+ *
-+ * Copyright (C) 2006 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_DCACHE_OP_H_
-+#define __UB_DCACHE_OP_H_
-+
-+struct dentry;
-+
-+#ifdef CONFIG_USER_RESOURCE
-+
-+#include <linux/spinlock.h>
-+#include <ub/ub_dcache.h>
-+#include <ub/ub_task.h>
-+
-+extern int ub_dentry_alloc_barrier;
-+extern spinlock_t dcache_lock;
-+
-+static inline int ub_dentry_alloc(struct dentry *d)
-+{
-+ extern int __ub_dentry_alloc(struct dentry *);
-+
-+ if (!ub_dentry_on)
-+ return 0;
-+ return __ub_dentry_alloc(d);
-+}
-+
-+static inline void ub_dentry_free(struct dentry *d)
-+{
-+}
-+
-+static inline void ub_dentry_alloc_start(void)
-+{
-+ extern void __ub_dentry_alloc_start(void);
-+
-+ if (ub_dentry_alloc_barrier)
-+ __ub_dentry_alloc_start();
-+}
-+
-+static inline void ub_dentry_alloc_end(void)
-+{
-+ extern void __ub_dentry_alloc_end(void);
-+
-+ if (task_bc(current)->dentry_alloc)
-+ __ub_dentry_alloc_end();
-+}
-+
-+static inline int ub_dentry_charge(struct dentry *d)
-+{
-+ extern int __ub_dentry_charge(struct dentry *);
-+
-+ if (!ub_dentry_on)
-+ return 0;
-+ return __ub_dentry_charge(d);
-+}
-+
-+static inline void ub_dentry_charge_nofail(struct dentry *d)
-+{
-+ extern void __ub_dentry_charge_nofail(struct dentry *);
-+
-+ if (!ub_dentry_on)
-+ return;
-+ __ub_dentry_charge_nofail(d);
-+}
-+
-+static inline void ub_dentry_uncharge_locked(struct dentry *d)
-+{
-+ extern void __ub_dentry_uncharge(struct dentry *);
-+
-+ if (!ub_dentry_on)
-+ return;
-+ __ub_dentry_uncharge(d);
-+}
-+
-+static inline void ub_dentry_uncharge(struct dentry *d)
-+{
-+ extern void __ub_dentry_uncharge(struct dentry *);
-+
-+ if (!ub_dentry_on)
-+ return;
-+ spin_lock(&dcache_lock);
-+ __ub_dentry_uncharge(d);
-+ spin_unlock(&dcache_lock);
-+}
-+
-+#else /* CONFIG_USER_RESOURCE */
-+
-+static inline int ub_dentry_alloc(struct dentry *d) { return 0; }
-+static inline void ub_dentry_free(struct dentry *d) { }
-+static inline void ub_dentry_alloc_start(void) { }
-+static inline void ub_dentry_alloc_end(void) { }
-+static inline int ub_dentry_charge(struct dentry *d) { return 0; }
-+static inline void ub_dentry_charge_nofail(struct dentry *d) { }
-+static inline void ub_dentry_uncharge_locked(struct dentry *d) { }
-+static inline void ub_dentry_uncharge(struct dentry *d) { }
-+
-+#endif /* CONFIG_USER_RESOURCE */
-+
-+#endif /* __UB_DCACHE_OP_H_ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_debug.h linux-2.6.9-ve023stab030/include/ub/ub_debug.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_debug.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_debug.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,95 @@
-+/*
-+ * include/ub/ub_debug.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_DEBUG_H_
-+#define __UB_DEBUG_H_
-+
-+/*
-+ * general debugging
-+ */
-+
-+#define UBD_ALLOC 0x1
-+#define UBD_CHARGE 0x2
-+#define UBD_LIMIT 0x4
-+#define UBD_TRACE 0x8
-+
-+/*
-+ * ub_net debugging
-+ */
-+
-+#define UBD_NET_SOCKET 0x10
-+#define UBD_NET_SLEEP 0x20
-+#define UBD_NET_SEND 0x40
-+#define UBD_NET_RECV 0x80
-+
-+/*
-+ * Main routines
-+ */
-+
-+#define UB_DEBUG (0)
-+#define DEBUG_RESOURCE (0ULL)
-+
-+#define ub_dbg_cond(__cond, __str, args...) \
-+ do { \
-+ if ((__cond) != 0) \
-+ printk(__str, ##args); \
-+ } while(0)
-+
-+#define ub_debug(__section, __str, args...) \
-+ ub_dbg_cond(UB_DEBUG & (__section), __str, ##args)
-+
-+#define ub_debug_resource(__resource, __str, args...) \
-+ ub_dbg_cond((UB_DEBUG & UBD_CHARGE) && \
-+ (DEBUG_RESOURCE & (1 << (__resource))), \
-+ __str, ##args)
-+
-+#if UB_DEBUG & UBD_TRACE
-+#define ub_debug_trace(__cond, __b, __r) \
-+ do { \
-+ static struct ub_rate_info ri = { __b, __r }; \
-+ if ((__cond) != 0 && ub_ratelimit(&ri)) \
-+ dump_stack(); \
-+ } while(0)
-+#else
-+#define ub_debug_trace(__cond, __burst, __rate)
-+#endif
-+
-+#include <linux/config.h>
-+
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+#include <linux/list.h>
-+#include <linux/kmem_cache.h>
-+
-+struct user_beancounter;
-+struct ub_cache_counter {
-+ struct list_head ulist;
-+ struct ub_cache_counter *next;
-+ struct user_beancounter *ub;
-+ kmem_cache_t *cachep;
-+ unsigned long counter;
-+};
-+
-+extern spinlock_t cc_lock;
-+extern void init_cache_counters(void);
-+extern void ub_free_counters(struct user_beancounter *);
-+extern void ub_kmemcache_free(kmem_cache_t *cachep);
-+
-+struct vm_struct;
-+extern void inc_vmalloc_charged(struct vm_struct *, int);
-+extern void dec_vmalloc_charged(struct vm_struct *);
-+#else
-+#define init_cache_counters() do { } while (0)
-+#define inc_vmalloc_charged(vm, f) do { } while (0)
-+#define dec_vmalloc_charged(vm) do { } while (0)
-+#define ub_free_counters(ub) do { } while (0)
-+#define ub_kmemcache_free(cachep) do { } while (0)
-+#endif
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_decl.h linux-2.6.9-ve023stab030/include/ub/ub_decl.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_decl.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_decl.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,42 @@
-+/*
-+ * include/ub/ub_decl.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_DECL_H_
-+#define __UB_DECL_H_
-+
-+#ifdef __KERNEL__
-+#include <linux/config.h>
-+
-+/*
-+ * Naming convension:
-+ * ub_<section|object>_<operation>
-+ */
-+
-+#ifdef CONFIG_USER_RESOURCE
-+
-+#define UB_DECLARE_FUNC(ret_type, decl) extern ret_type decl;
-+#define UB_DECLARE_VOID_FUNC(decl) extern void decl;
-+
-+#else /* CONFIG_USER_RESOURCE */
-+
-+#define UB_DECLARE_FUNC(ret_type, decl) \
-+ static inline ret_type decl \
-+ { \
-+ return (ret_type)0; \
-+ }
-+#define UB_DECLARE_VOID_FUNC(decl) \
-+ static inline void decl \
-+ { \
-+ }
-+
-+#endif /* CONFIG_USER_RESOURCE */
-+#endif
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_hash.h linux-2.6.9-ve023stab030/include/ub/ub_hash.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_hash.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_hash.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,41 @@
-+/*
-+ * include/ub/ub_hash.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef _LINUX_UBHASH_H
-+#define _LINUX_UBHASH_H
-+
-+#ifdef __KERNEL__
-+
-+#define UB_HASH_SIZE 256
-+
-+struct ub_hash_slot {
-+ struct user_beancounter *ubh_beans;
-+};
-+
-+extern struct ub_hash_slot ub_hash[];
-+extern spinlock_t ub_hash_lock;
-+
-+#ifdef CONFIG_USER_RESOURCE
-+
-+/*
-+ * Iterate over beancounters
-+ * @__slot - hash slot
-+ * @__ubp - beancounter ptr
-+ * Can use break :)
-+ */
-+#define for_each_beancounter(__slot, __ubp) \
-+ for (__slot = 0, __ubp = NULL; \
-+ __slot < UB_HASH_SIZE && __ubp == NULL; __slot++) \
-+ for (__ubp = ub_hash[__slot].ubh_beans; __ubp; \
-+ __ubp = __ubp->ub_next)
-+
-+#endif /* CONFIG_USER_RESOURCE */
-+#endif /* __KERNEL__ */
-+#endif /* _LINUX_UBHASH_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_mem.h linux-2.6.9-ve023stab030/include/ub/ub_mem.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_mem.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_mem.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,87 @@
-+/*
-+ * include/ub/ub_mem.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_SLAB_H_
-+#define __UB_SLAB_H_
-+
-+#include <linux/config.h>
-+#include <linux/kmem_slab.h>
-+#include <ub/beancounter.h>
-+#include <ub/ub_decl.h>
-+
-+/*
-+ * UB_KMEMSIZE accounting
-+ * oom_killer related
-+ */
-+
-+/*
-+ * Memory freeing statistics to make correct OOM decision
-+ */
-+
-+struct oom_freeing_stat
-+{
-+ unsigned long oom_generation; /* current OOM gen */
-+ unsigned long freed;
-+ unsigned long swapped; /* page referrence counters removed */
-+ unsigned long written; /* IO started */
-+ unsigned long slabs; /* slabs shrinked */
-+};
-+
-+extern int oom_generation;
-+extern int oom_kill_counter;
-+extern spinlock_t oom_generation_lock;
-+
-+#ifdef CONFIG_UBC_DEBUG_ITEMS
-+#define CHARGE_ORDER(__o) (1 << (__o))
-+#define CHARGE_SIZE(__s) 1
-+#else
-+#define CHARGE_ORDER(__o) (PAGE_SIZE << (__o))
-+#define CHARGE_SIZE(__s) (__s)
-+#endif
-+
-+#define page_ub(__page) ((__page)->bc.page_ub)
-+
-+struct mm_struct;
-+struct page;
-+
-+UB_DECLARE_FUNC(struct user_beancounter *, slab_ub(void *obj))
-+UB_DECLARE_FUNC(struct user_beancounter *, vmalloc_ub(void *obj))
-+UB_DECLARE_FUNC(struct user_beancounter *, mem_ub(void *obj))
-+
-+UB_DECLARE_FUNC(int, ub_page_charge(struct page *page, int order, int mask))
-+UB_DECLARE_VOID_FUNC(ub_page_uncharge(struct page *page, int order))
-+
-+UB_DECLARE_VOID_FUNC(ub_clear_oom(void))
-+UB_DECLARE_VOID_FUNC(ub_oomkill_task(struct mm_struct *mm,
-+ struct user_beancounter *ub, long overdraft))
-+UB_DECLARE_FUNC(int, ub_slab_charge(void *objp, int flags))
-+UB_DECLARE_VOID_FUNC(ub_slab_uncharge(void *obj))
-+
-+#ifdef CONFIG_USER_RESOURCE
-+/* Flags without __GFP_UBC must comply with vmalloc */
-+#define ub_vmalloc(size) __vmalloc(size, \
-+ GFP_KERNEL | __GFP_HIGHMEM | __GFP_UBC, PAGE_KERNEL)
-+#define ub_kmalloc(size, flags) kmalloc(size, ((flags) | __GFP_UBC))
-+extern struct user_beancounter *ub_select_worst(long *);
-+#else
-+#define ub_vmalloc(size) vmalloc(size)
-+#define ub_kmalloc(size, flags) kmalloc(size, flags)
-+static inline struct user_beancounter *ub_select_worst(long *over)
-+{
-+ *over = 0;
-+ return NULL;
-+}
-+#endif
-+
-+#define slab_ubcs(cachep, slabp) ((struct user_beancounter **)\
-+ (ALIGN((unsigned long)(slab_bufctl(slabp) + (cachep)->num),\
-+ sizeof(void *))))
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_misc.h linux-2.6.9-ve023stab030/include/ub/ub_misc.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_misc.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_misc.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,33 @@
-+/*
-+ * include/ub/ub_misc.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_MISC_H_
-+#define __UB_MISC_H_
-+
-+#include <ub/ub_decl.h>
-+
-+struct tty_struct;
-+struct file;
-+struct file_lock;
-+
-+UB_DECLARE_FUNC(int, ub_file_charge(struct file *f))
-+UB_DECLARE_VOID_FUNC(ub_file_uncharge(struct file *f))
-+UB_DECLARE_FUNC(int, ub_flock_charge(struct file_lock *fl, int hard))
-+UB_DECLARE_VOID_FUNC(ub_flock_uncharge(struct file_lock *fl))
-+UB_DECLARE_FUNC(int, ub_siginfo_charge(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_siginfo_uncharge(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_task_charge(struct task_struct *parent,
-+ struct task_struct *task))
-+UB_DECLARE_VOID_FUNC(ub_task_uncharge(struct task_struct *task))
-+UB_DECLARE_FUNC(int, ub_pty_charge(struct tty_struct *tty))
-+UB_DECLARE_VOID_FUNC(ub_pty_uncharge(struct tty_struct *tty))
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_net.h linux-2.6.9-ve023stab030/include/ub/ub_net.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_net.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_net.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,220 @@
-+/*
-+ * include/ub/ub_net.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_NET_H_
-+#define __UB_NET_H_
-+
-+/*
-+ * UB_NUMXXXSOCK, UB_XXXBUF accounting
-+ */
-+
-+#include <ub/ub_decl.h>
-+#include <ub/ub_sk.h>
-+#include <ub/beancounter.h>
-+
-+#define bid2sid(__bufid) \
-+ ((__bufid) == UB_TCPSNDBUF ? UB_NUMTCPSOCK : UB_NUMOTHERSOCK)
-+
-+#define SOCK_MIN_UBCSPACE ((int)((2048 - sizeof(struct skb_shared_info)) & \
-+ ~(SMP_CACHE_BYTES-1)))
-+#define SOCK_MIN_UBCSPACE_CH skb_charge_size(SOCK_MIN_UBCSPACE)
-+
-+static inline int ub_skb_alloc_bc(struct sk_buff *skb, int gfp_mask)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ memset(skb_bc(skb), 0, sizeof(struct skb_beancounter));
-+#endif
-+ return 0;
-+}
-+
-+static inline void ub_skb_free_bc(struct sk_buff *skb)
-+{
-+}
-+
-+#define IS_TCP_SOCK(__family, __type) \
-+ ((__family) == PF_INET && (__type) == SOCK_STREAM)
-+
-+/* number of sockets */
-+UB_DECLARE_FUNC(int, ub_sock_charge(struct sock *sk, int family, int type))
-+UB_DECLARE_FUNC(int, ub_tcp_sock_charge(struct sock *sk))
-+UB_DECLARE_FUNC(int, ub_other_sock_charge(struct sock *sk))
-+UB_DECLARE_VOID_FUNC(ub_sock_uncharge(struct sock *sk))
-+
-+/* management of queue for send space */
-+UB_DECLARE_FUNC(long, ub_sock_wait_for_space(struct sock *sk, long timeo,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_sock_snd_queue_add(struct sock *sk, int resource,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_sock_sndqueuedel(struct sock *sk))
-+
-+/* send space */
-+UB_DECLARE_FUNC(int, ub_sock_make_wreserv(struct sock *sk, int bufid,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_sock_get_wreserv(struct sock *sk, int bufid,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_sock_ret_wreserv(struct sock *sk, int bufid,
-+ unsigned long size, unsigned long ressize))
-+UB_DECLARE_FUNC(int, ub_sock_tcp_chargesend(struct sock *sk,
-+ struct sk_buff *skb, enum ub_severity strict))
-+UB_DECLARE_VOID_FUNC(ub_sock_tcp_unchargesend(struct sock *sk,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_sock_tcp_chargepage(struct sock *sk))
-+UB_DECLARE_VOID_FUNC(ub_sock_tcp_detachpage(struct sock *sk))
-+
-+UB_DECLARE_FUNC(int, ub_nlrcvbuf_charge(struct sk_buff *skb, struct sock *sk))
-+
-+/* receive space */
-+UB_DECLARE_FUNC(int, ub_sockrcvbuf_charge(struct sock *sk, struct sk_buff *skb))
-+UB_DECLARE_FUNC(int, ub_sock_tcp_chargerecv(struct sock *sk,
-+ struct sk_buff *skb, enum ub_severity strict))
-+
-+/* skb destructor */
-+UB_DECLARE_VOID_FUNC(ub_skb_uncharge(struct sk_buff *skb))
-+
-+static inline int ub_sock_makewres_other(struct sock *sk, unsigned long size)
-+{
-+ return ub_sock_make_wreserv(sk, UB_OTHERSOCKBUF, size);
-+}
-+
-+static inline int ub_sock_makewres_tcp(struct sock *sk, unsigned long size)
-+{
-+ return ub_sock_make_wreserv(sk, UB_TCPSNDBUF, size);
-+}
-+
-+static inline int ub_sock_getwres_other(struct sock *sk, unsigned long size)
-+{
-+ return ub_sock_get_wreserv(sk, UB_OTHERSOCKBUF, size);
-+}
-+
-+static inline int ub_sock_getwres_tcp(struct sock *sk, unsigned long size)
-+{
-+ return ub_sock_get_wreserv(sk, UB_TCPSNDBUF, size);
-+}
-+
-+static inline void ub_sock_retwres_other(struct sock *sk, unsigned long size,
-+ unsigned long ressize)
-+{
-+ ub_sock_ret_wreserv(sk, UB_OTHERSOCKBUF, size, ressize);
-+}
-+
-+static inline void ub_sock_retwres_tcp(struct sock *sk, unsigned long size,
-+ unsigned long ressize)
-+{
-+ ub_sock_ret_wreserv(sk, UB_TCPSNDBUF, size, ressize);
-+}
-+
-+static inline void ub_sock_sndqueueadd_other(struct sock *sk, unsigned long sz)
-+{
-+ ub_sock_snd_queue_add(sk, UB_OTHERSOCKBUF, sz);
-+}
-+
-+static inline void ub_sock_sndqueueadd_tcp(struct sock *sk, unsigned long sz)
-+{
-+ ub_sock_snd_queue_add(sk, UB_TCPSNDBUF, sz);
-+}
-+
-+static inline int ub_tcpsndbuf_charge(struct sock *sk,
-+ struct sk_buff *skb)
-+{
-+ return ub_sock_tcp_chargesend(sk, skb, UB_HARD);
-+}
-+
-+static inline int ub_tcpsndbuf_charge_forced(struct sock *sk,
-+ struct sk_buff *skb)
-+{
-+ return ub_sock_tcp_chargesend(sk, skb, UB_FORCE);
-+}
-+
-+static inline int ub_tcprcvbuf_charge(struct sock *sk, struct sk_buff *skb)
-+{
-+ return ub_sock_tcp_chargerecv(sk, skb, UB_HARD);
-+}
-+
-+static inline int ub_tcprcvbuf_charge_forced(struct sock *sk,
-+ struct sk_buff *skb)
-+{
-+ return ub_sock_tcp_chargerecv(sk, skb, UB_FORCE);
-+}
-+
-+/* Charge size */
-+static inline unsigned long skb_charge_datalen(unsigned long chargesize)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ unsigned long slabsize;
-+
-+ chargesize -= sizeof(struct sk_buff);
-+ slabsize = 64;
-+ do {
-+ slabsize <<= 1;
-+ } while (slabsize <= chargesize);
-+
-+ slabsize >>= 1;
-+ return (slabsize - sizeof(struct skb_shared_info)) &
-+ ~(SMP_CACHE_BYTES-1);
-+#else
-+ return 0;
-+#endif
-+}
-+
-+static inline unsigned long skb_charge_size_gen(unsigned long size)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ unsigned int slabsize;
-+
-+ size = SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
-+ slabsize = 32; /* min size is 64 because of skb_shared_info */
-+ do {
-+ slabsize <<= 1;
-+ } while (slabsize < size);
-+
-+ return slabsize + sizeof(struct sk_buff);
-+#else
-+ return 0;
-+#endif
-+
-+}
-+
-+static inline unsigned long skb_charge_size_const(unsigned long size)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ unsigned int ret;
-+ if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 64)
-+ ret = 64 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 128)
-+ ret = 128 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 256)
-+ ret = 256 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 512)
-+ ret = 512 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 1024)
-+ ret = 1024 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 2048)
-+ ret = 2048 + sizeof(struct sk_buff);
-+ else if (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info) <= 4096)
-+ ret = 4096 + sizeof(struct sk_buff);
-+ else
-+ ret = skb_charge_size_gen(size);
-+ return ret;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+
-+#define skb_charge_size(__size) \
-+ (__builtin_constant_p(__size) ? \
-+ skb_charge_size_const(__size) : \
-+ skb_charge_size_gen(__size))
-+
-+UB_DECLARE_FUNC(int, skb_charge_fullsize(struct sk_buff *skb))
-+UB_DECLARE_VOID_FUNC(ub_skb_set_charge(struct sk_buff *skb,
-+ struct sock *sk, unsigned long size, int res))
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_orphan.h linux-2.6.9-ve023stab030/include/ub/ub_orphan.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_orphan.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_orphan.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,103 @@
-+/*
-+ * include/ub/ub_orphan.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_ORPHAN_H_
-+#define __UB_ORPHAN_H_
-+
-+#include "ub/beancounter.h"
-+#include "ub/ub_net.h"
-+
-+
-+extern int ub_too_many_orphans(struct sock *sk, int count);
-+static inline int tcp_too_many_orphans(struct sock *sk, int count)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ if (ub_too_many_orphans(sk, count))
-+ return 1;
-+#endif
-+ return (atomic_read(&tcp_orphan_count) > sysctl_tcp_max_orphans ||
-+ (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
-+ atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]));
-+}
-+
-+static inline atomic_t *tcp_get_orphan_count_ptr(struct sock *sk)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ if (sock_has_ubc(sk))
-+ return &sock_bc(sk)->ub->ub_orphan_count;
-+#endif
-+ return &tcp_orphan_count;
-+}
-+
-+static inline void tcp_inc_orphan_count(struct sock *sk)
-+{
-+ atomic_inc(tcp_get_orphan_count_ptr(sk));
-+}
-+
-+static inline void tcp_dec_orphan_count(struct sock *sk)
-+{
-+ atomic_dec(tcp_get_orphan_count_ptr(sk));
-+}
-+
-+static inline int tcp_get_orphan_count(struct sock *sk)
-+{
-+ return atomic_read(tcp_get_orphan_count_ptr(sk));
-+}
-+
-+
-+/* ub->ub_tw_count is serialized via tw_death_lock thats why the logic is
-+ so strange and places are very interesting. Den */
-+#ifdef CONFIG_USER_RESOURCE
-+
-+#include <ub/ub_mem.h>
-+#include <linux/kmem_cache.h>
-+
-+struct tcp_tw_bucket;
-+static inline void ub_inc_tw_count(struct tcp_tw_bucket *tw)
-+{
-+ struct user_beancounter *ub;
-+ ub = slab_ub(tw);
-+ if (ub == NULL)
-+ return;
-+ ub->ub_tw_count++;
-+}
-+
-+static inline void ub_dec_tw_count(struct tcp_tw_bucket *tw)
-+{
-+ struct user_beancounter *ub;
-+ ub = slab_ub(tw);
-+ if (ub == NULL)
-+ return;
-+ ub->ub_tw_count--;
-+}
-+
-+static inline int ub_check_tw_count(struct sock *sk)
-+{
-+ unsigned long mem_max, mem;
-+ struct user_beancounter *ub;
-+
-+ ub = sock_bc(sk)->ub;
-+ if (ub == NULL)
-+ return 1;
-+ mem_max = sysctl_tcp_max_tw_kmem_fraction *
-+ ((ub->ub_parms[UB_KMEMSIZE].limit >> 10) + 1);
-+ mem = ub->ub_tw_count * kmem_cache_memusage(tcp_timewait_cachep);
-+ return ub->ub_tw_count < sysctl_tcp_max_tw_buckets_ve && mem < mem_max;
-+}
-+
-+#else /* CONFIG_USER_RESOURCE */
-+
-+#define ub_inc_tw_count(tw) do { } while (0)
-+#define ub_dec_tw_count(tw) do { } while (0)
-+#define ub_check_tw_count(sk) (1)
-+
-+#endif
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_page.h linux-2.6.9-ve023stab030/include/ub/ub_page.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_page.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_page.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,48 @@
-+/*
-+ * include/ub/ub_page.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_PAGE_H_
-+#define __UB_PAGE_H_
-+
-+#include <linux/config.h>
-+
-+/*
-+ * Page_beancounters
-+ */
-+
-+struct page;
-+struct user_beancounter;
-+
-+#define PB_MAGIC 0x62700001UL
-+
-+struct page_beancounter {
-+ unsigned long pb_magic;
-+ struct page *page;
-+ struct user_beancounter *ub;
-+ struct page_beancounter *next_hash;
-+ unsigned refcount;
-+ struct list_head page_list;
-+};
-+
-+#define PB_REFCOUNT_BITS 24
-+#define PB_SHIFT_GET(c) ((c) >> PB_REFCOUNT_BITS)
-+#define PB_SHIFT_INC(c) ((c) += (1 << PB_REFCOUNT_BITS))
-+#define PB_SHIFT_DEC(c) ((c) -= (1 << PB_REFCOUNT_BITS))
-+#define PB_COUNT_GET(c) ((c) & ((1 << PB_REFCOUNT_BITS) - 1))
-+#define PB_COUNT_INC(c) ((c)++)
-+#define PB_COUNT_DEC(c) ((c)--)
-+#define PB_REFCOUNT_MAKE(s, c) (((s) << PB_REFCOUNT_BITS) + (c))
-+
-+#define page_pbc(__page) ((__page)->bc.page_pbc)
-+
-+struct address_space;
-+extern int is_shmem_mapping(struct address_space *);
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_sk.h linux-2.6.9-ve023stab030/include/ub/ub_sk.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_sk.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_sk.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,50 @@
-+/*
-+ * include/ub/ub_sk.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_SK_H_
-+#define __UB_SK_H_
-+
-+#include <linux/config.h>
-+#include <ub/ub_task.h>
-+
-+struct sock;
-+struct sk_buff;
-+
-+struct skb_beancounter {
-+ struct user_beancounter *ub;
-+ unsigned long charged:27, resource:5;
-+};
-+
-+struct sock_beancounter {
-+ struct user_beancounter *ub;
-+ /*
-+ * poll_reserv accounts space already charged for future sends.
-+ * It is required to make poll agree with sendmsg.
-+ * Additionally, it makes real charges (with taking bc spinlock)
-+ * in the send path rarer, speeding networking up.
-+ * Changes are protected by socket lock (not bc!)
-+ * May be read without serialization in poll.
-+ */
-+ unsigned long poll_reserv;
-+ unsigned long forw_space;
-+ /* fields below are protected by bc spinlock */
-+ unsigned long ub_waitspc; /* space waiting for */
-+ unsigned long ub_wcharged;
-+ struct list_head ub_sock_list;
-+};
-+
-+#define sock_bc(__sk) (&(__sk)->sk_bc)
-+#define skb_bc(__skb) (&(__skb)->skb_bc)
-+#define skbc_sock(__skbc) (container_of(__skbc, struct sock, sk_bc))
-+#define sock_has_ubc(__sk) (sock_bc(__sk)->ub != NULL)
-+
-+#define set_sk_exec_ub(__sk) (set_exec_ub(sock_bc(sk)->ub))
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_stat.h linux-2.6.9-ve023stab030/include/ub/ub_stat.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_stat.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_stat.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,70 @@
-+/*
-+ * include/ub/ub_stat.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_STAT_H_
-+#define __UB_STAT_H_
-+
-+/* sys_ubstat commands list */
-+#define UBSTAT_READ_ONE 0x010000
-+#define UBSTAT_READ_ALL 0x020000
-+#define UBSTAT_READ_FULL 0x030000
-+#define UBSTAT_UBLIST 0x040000
-+#define UBSTAT_UBPARMNUM 0x050000
-+#define UBSTAT_GETTIME 0x060000
-+
-+#define UBSTAT_CMD(func) ((func) & 0xF0000)
-+#define UBSTAT_PARMID(func) ((func) & 0x0FFFF)
-+
-+#define TIME_MAX_SEC (LONG_MAX / HZ)
-+#define TIME_MAX_JIF (TIME_MAX_SEC * HZ)
-+
-+typedef unsigned long ubstattime_t;
-+
-+typedef struct {
-+ ubstattime_t start_time;
-+ ubstattime_t end_time;
-+ ubstattime_t cur_time;
-+} ubgettime_t;
-+
-+typedef struct {
-+ long maxinterval;
-+ int signum;
-+} ubnotifrq_t;
-+
-+typedef struct {
-+ unsigned long maxheld;
-+ unsigned long failcnt;
-+} ubstatparm_t;
-+
-+typedef struct {
-+ unsigned long barrier;
-+ unsigned long limit;
-+ unsigned long held;
-+ unsigned long maxheld;
-+ unsigned long minheld;
-+ unsigned long failcnt;
-+ unsigned long __unused1;
-+ unsigned long __unused2;
-+} ubstatparmf_t;
-+
-+typedef struct {
-+ ubstattime_t start_time;
-+ ubstattime_t end_time;
-+ ubstatparmf_t param[0];
-+} ubstatfull_t;
-+
-+#ifdef __KERNEL__
-+struct ub_stat_notify {
-+ struct list_head list;
-+ struct task_struct *task;
-+ int signum;
-+};
-+#endif
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_task.h linux-2.6.9-ve023stab030/include/ub/ub_task.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_task.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_task.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,54 @@
-+/*
-+ * include/ub/ub_task.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_TASK_H_
-+#define __UB_TASK_H_
-+
-+#include <linux/config.h>
-+
-+struct user_beancounter;
-+
-+
-+#ifdef CONFIG_USER_RESOURCE
-+
-+struct task_beancounter {
-+ struct user_beancounter *exec_ub;
-+ struct user_beancounter *task_ub;
-+ struct user_beancounter *fork_sub;
-+ unsigned long file_precharged, file_quant, file_count;
-+ unsigned long kmem_precharged;
-+ char dentry_alloc, pgfault_handle;
-+ void *task_fnode, *task_freserv;
-+ unsigned long task_data[4];
-+ unsigned long pgfault_allot;
-+};
-+
-+#define task_bc(__tsk) (&((__tsk)->task_bc))
-+
-+#define get_exec_ub() (task_bc(current)->exec_ub)
-+#define get_task_ub(__task) (task_bc(__task)->task_ub)
-+#define set_exec_ub(__newub) \
-+({ \
-+ struct user_beancounter *old; \
-+ struct task_beancounter *tbc; \
-+ tbc = task_bc(current); \
-+ old = tbc->exec_ub; \
-+ tbc->exec_ub = __newub; \
-+ old; \
-+})
-+
-+#else /* CONFIG_USER_RESOURCE */
-+
-+#define get_exec_ub() (NULL)
-+#define get_task_ub(task) (NULL)
-+#define set_exec_ub(__ub) (NULL)
-+
-+#endif /* CONFIG_USER_RESOURCE */
-+#endif /* __UB_TASK_H_ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_tcp.h linux-2.6.9-ve023stab030/include/ub/ub_tcp.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_tcp.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_tcp.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,76 @@
-+/*
-+ * include/ub/ub_tcp.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_TCP_H_
-+#define __UB_TCP_H_
-+
-+/*
-+ * UB_NUMXXXSOCK, UB_XXXBUF accounting
-+ */
-+
-+#include <ub/ub_sk.h>
-+#include <ub/beancounter.h>
-+
-+static inline void ub_tcp_update_maxadvmss(struct sock *sk)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ if (!sock_has_ubc(sk))
-+ return;
-+ if (sock_bc(sk)->ub->ub_maxadvmss >= tcp_sk(sk)->advmss)
-+ return;
-+
-+ sock_bc(sk)->ub->ub_maxadvmss =
-+ skb_charge_size(MAX_HEADER + sizeof(struct iphdr)
-+ + sizeof(struct tcphdr) + tcp_sk(sk)->advmss);
-+#endif
-+}
-+
-+static inline int ub_tcp_rmem_allows_expand(struct sock *sk)
-+{
-+ if (tcp_memory_pressure)
-+ return 0;
-+#ifdef CONFIG_USER_RESOURCE
-+ if (sock_has_ubc(sk)) {
-+ struct user_beancounter *ub;
-+
-+ ub = sock_bc(sk)->ub;
-+ if (ub->ub_rmem_pressure == UB_RMEM_EXPAND)
-+ return 1;
-+ if (ub->ub_rmem_pressure == UB_RMEM_SHRINK)
-+ return 0;
-+ return sk->sk_rcvbuf <= ub->ub_rmem_thres;
-+ }
-+#endif
-+ return 1;
-+}
-+
-+static inline int ub_tcp_memory_pressure(struct sock *sk)
-+{
-+ if (tcp_memory_pressure)
-+ return 1;
-+#ifdef CONFIG_USER_RESOURCE
-+ if (sock_has_ubc(sk))
-+ return sock_bc(sk)->ub->ub_rmem_pressure != UB_RMEM_EXPAND;
-+#endif
-+ return 0;
-+}
-+
-+static inline int ub_tcp_shrink_rcvbuf(struct sock *sk)
-+{
-+ if (tcp_memory_pressure)
-+ return 1;
-+#ifdef CONFIG_USER_RESOURCE
-+ if (sock_has_ubc(sk))
-+ return sock_bc(sk)->ub->ub_rmem_pressure == UB_RMEM_SHRINK;
-+#endif
-+ return 0;
-+}
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/include/ub/ub_vmpages.h linux-2.6.9-ve023stab030/include/ub/ub_vmpages.h
---- linux-2.6.9-42.0.3.EL.orig/include/ub/ub_vmpages.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/include/ub/ub_vmpages.h 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,121 @@
-+/*
-+ * include/ub/ub_vmpages.h
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#ifndef __UB_PAGES_H_
-+#define __UB_PAGES_H_
-+
-+#include <linux/linkage.h>
-+#include <linux/config.h>
-+#include <ub/beancounter.h>
-+#include <ub/ub_decl.h>
-+
-+/*
-+ * UB_XXXPAGES
-+ */
-+
-+/*
-+ * Check whether vma has private or copy-on-write mapping.
-+ * Should match checks in ub_protected_charge().
-+ */
-+#define VM_UB_PRIVATE(__flags, __file) \
-+ ( ((__flags) & VM_WRITE) ? \
-+ (__file) == NULL || !((__flags) & VM_SHARED) : \
-+ 0 \
-+ )
-+
-+#define UB_PAGE_WEIGHT_SHIFT 24
-+#define UB_PAGE_WEIGHT (1 << UB_PAGE_WEIGHT_SHIFT)
-+
-+struct page_beancounter;
-+
-+/* Mprotect charging result */
-+#define PRIVVM_ERROR -1
-+#define PRIVVM_NO_CHARGE 0
-+#define PRIVVM_TO_PRIVATE 1
-+#define PRIVVM_TO_SHARED 2
-+
-+#ifdef CONFIG_USER_RESOURCE
-+extern int ub_protected_charge(struct user_beancounter *ub, unsigned long size,
-+ unsigned long newflags, struct vm_area_struct *vma);
-+#else
-+static inline int ub_protected_charge(struct user_beancounter *ub,
-+ unsigned long size, unsigned long flags,
-+ struct vm_area_struct *vma)
-+{
-+ return PRIVVM_NO_CHARGE;
-+}
-+#endif
-+
-+UB_DECLARE_VOID_FUNC(ub_tmpfs_respages_inc(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_tmpfs_respages_dec(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_shmpages_charge(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_shmpages_uncharge(struct user_beancounter *ub,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_locked_mem_charge(struct user_beancounter *ub, long sz))
-+UB_DECLARE_VOID_FUNC(ub_locked_mem_uncharge(struct user_beancounter *ub,
-+ long size))
-+UB_DECLARE_FUNC(int, ub_privvm_charge(struct user_beancounter *ub,
-+ unsigned long flags, struct file *file,
-+ unsigned long size))
-+UB_DECLARE_VOID_FUNC(ub_privvm_uncharge(struct user_beancounter *ub,
-+ unsigned long flags, struct file *file,
-+ unsigned long size))
-+UB_DECLARE_FUNC(int, ub_unused_privvm_inc(struct user_beancounter * ub,
-+ long size, struct vm_area_struct *vma))
-+UB_DECLARE_VOID_FUNC(ub_unused_privvm_dec(struct user_beancounter *ub, long sz,
-+ struct vm_area_struct *vma))
-+UB_DECLARE_VOID_FUNC(__ub_unused_privvm_dec(struct user_beancounter *ub, long sz))
-+UB_DECLARE_FUNC(int, ub_memory_charge(struct user_beancounter * ub,
-+ unsigned long size, unsigned vm_flags,
-+ struct file *vm_file, int strict))
-+UB_DECLARE_VOID_FUNC(ub_memory_uncharge(struct user_beancounter * ub,
-+ unsigned long size, unsigned vm_flags,
-+ struct file *vm_file))
-+UB_DECLARE_FUNC(unsigned long, pages_in_vma_range(struct vm_area_struct *vma,
-+ unsigned long start, unsigned long end))
-+#define pages_in_vma(vma) \
-+ (pages_in_vma_range((vma), (vma)->vm_start, (vma)->vm_end))
-+
-+extern void fastcall __ub_update_physpages(struct user_beancounter *ub);
-+extern void fastcall __ub_update_oomguarpages(struct user_beancounter *ub);
-+extern void fastcall __ub_update_privvm(struct user_beancounter *ub);
-+
-+#ifdef CONFIG_USER_SWAP_ACCOUNTING
-+extern void ub_swapentry_inc(struct user_beancounter *ub);
-+extern void ub_swapentry_dec(struct user_beancounter *ub);
-+#endif
-+
-+#ifdef CONFIG_USER_RSS_ACCOUNTING
-+#define PB_DECLARE_FUNC(ret, decl) UB_DECLARE_FUNC(ret, decl)
-+#define PB_DECLARE_VOID_FUNC(decl) UB_DECLARE_VOID_FUNC(decl)
-+#else
-+#define PB_DECLARE_FUNC(ret, decl) static inline ret decl {return (ret)0;}
-+#define PB_DECLARE_VOID_FUNC(decl) static inline void decl { }
-+#endif
-+
-+PB_DECLARE_FUNC(int, pb_reserve_all(struct page_beancounter **pbc))
-+PB_DECLARE_FUNC(int, pb_alloc(struct page_beancounter **pbc))
-+PB_DECLARE_FUNC(int, pb_alloc_list(struct page_beancounter **pbc, int num,
-+ struct mm_struct *mm))
-+PB_DECLARE_FUNC(int, pb_add_ref(struct page *page, struct user_beancounter *ub,
-+ struct page_beancounter **pbc))
-+PB_DECLARE_VOID_FUNC(pb_free_list(struct page_beancounter **pb))
-+PB_DECLARE_VOID_FUNC(pb_free(struct page_beancounter **pb))
-+PB_DECLARE_VOID_FUNC(pb_add_list_ref(struct page *page,
-+ struct user_beancounter *ub,
-+ struct page_beancounter **pbc))
-+PB_DECLARE_VOID_FUNC(pb_remove_ref(struct page *page,
-+ struct user_beancounter *ub))
-+PB_DECLARE_FUNC(struct user_beancounter *, pb_grab_page_ub(struct page *page))
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/init/do_mounts_initrd.c linux-2.6.9-ve023stab030/init/do_mounts_initrd.c
---- linux-2.6.9-42.0.3.EL.orig/init/do_mounts_initrd.c 2004-10-19 01:53:11.000000000 +0400
-+++ linux-2.6.9-ve023stab030/init/do_mounts_initrd.c 2006-10-11 19:07:55.000000000 +0400
-@@ -10,7 +10,7 @@
-
- #include "do_mounts.h"
-
--unsigned long initrd_start, initrd_end;
-+unsigned long initrd_start, initrd_end, initrd_copy;
- int initrd_below_start_ok;
- unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
- static int __initdata old_fd, root_fd;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/init/main.c linux-2.6.9-ve023stab030/init/main.c
---- linux-2.6.9-42.0.3.EL.orig/init/main.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/init/main.c 2006-10-11 19:07:57.000000000 +0400
-@@ -51,6 +51,8 @@
- #include <asm/setup.h>
- #include <asm/timex.h>
-
-+#include <ub/beancounter.h>
-+
- /*
- * This is one of the first .c files built. Error out early
- * if we have compiler trouble..
-@@ -87,6 +89,7 @@ extern void sbus_init(void);
- extern void sysctl_init(void);
- extern void signals_init(void);
- extern void buffer_init(void);
-+extern void fairsched_init_late(void);
- extern void pidhash_init(void);
- extern void pidmap_init(void);
- extern void prio_tree_init(void);
-@@ -108,6 +111,16 @@ extern void tc_init(void);
- enum system_states system_state;
- EXPORT_SYMBOL(system_state);
-
-+#ifdef CONFIG_VE
-+extern void init_ve_system(void);
-+#endif
-+
-+void prepare_ve0_process(struct task_struct *tsk);
-+void prepare_ve0_proc_root(void);
-+void prepare_ve0_sysctl(void);
-+void prepare_ve0_loopback(void);
-+void prepare_virtual_fs(void);
-+
- /*
- * Boot command-line arguments
- */
-@@ -200,6 +213,52 @@ unsigned long loops_per_jiffy = (1<<12);
-
- EXPORT_SYMBOL(loops_per_jiffy);
-
-+unsigned long cycles_per_jiffy, cycles_per_clock;
-+
-+void calibrate_cycles(void)
-+{
-+ unsigned long ticks;
-+ cycles_t time;
-+
-+ ticks = jiffies;
-+ while (ticks == jiffies)
-+ /* nothing */;
-+ time = get_cycles();
-+ ticks = jiffies;
-+ while (ticks == jiffies)
-+ /* nothing */;
-+
-+ time = get_cycles() - time;
-+ cycles_per_jiffy = time;
-+ if ((time >> 32) != 0) {
-+ printk("CPU too fast! timings are incorrect\n");
-+ cycles_per_jiffy = -1;
-+ }
-+}
-+
-+EXPORT_SYMBOL(cycles_per_jiffy);
-+
-+void calc_cycles_per_jiffy(void)
-+{
-+#if defined(__i386__)
-+ extern unsigned long fast_gettimeoffset_quotient;
-+ unsigned long low, high;
-+
-+ if (fast_gettimeoffset_quotient != 0) {
-+ __asm__("divl %2"
-+ :"=a" (low), "=d" (high)
-+ :"r" (fast_gettimeoffset_quotient),
-+ "0" (0), "1" (1000000/HZ));
-+
-+ cycles_per_jiffy = low;
-+ }
-+#endif
-+ if (cycles_per_jiffy == 0)
-+ calibrate_cycles();
-+
-+ cycles_per_clock = cycles_per_jiffy * (HZ / CLOCKS_PER_SEC);
-+}
-+
- #ifdef ARCH_HAS_READ_CURRENT_TIMER
-
- /* This routine uses the read_current_timer() routine and gets the
-@@ -351,6 +410,7 @@ void __devinit calibrate_delay(void)
- loops_per_jiffy);
- }
-
-+ calc_cycles_per_jiffy();
- }
-
- static int __init debug_kernel(char *str)
-@@ -579,6 +639,7 @@ asmlinkage void __init start_kernel(void
- * enable them
- */
- lock_kernel();
-+ ub0_init();
- page_address_init();
- printk(linux_banner);
- setup_arch(&command_line);
-@@ -590,6 +651,8 @@ asmlinkage void __init start_kernel(void
- */
- smp_prepare_boot_cpu();
-
-+ prepare_ve0_process(&init_task);
-+
- /*
- * Set up the scheduler prior starting any interrupts (such as the
- * timer interrupt). Full topology setup happens at smp_init()
-@@ -647,6 +710,7 @@ asmlinkage void __init start_kernel(void
- #endif
- fork_init(num_physpages);
- proc_caches_init();
-+ beancounter_init(num_physpages);
- buffer_init();
- unnamed_dev_init();
- key_init();
-@@ -657,13 +721,17 @@ asmlinkage void __init start_kernel(void
- /* rootfs populating might need page-writeback */
- page_writeback_init();
- #ifdef CONFIG_PROC_FS
-+ prepare_ve0_proc_root();
-+ prepare_ve0_sysctl();
- proc_root_init();
-+ beancounter_proc_init();
- #endif
- check_bugs();
-
- acpi_early_init(); /* before LAPIC and SMP init */
-
- /* Do the rest non-__init'ed, we're now alive */
-+ page_ubc_init();
- rest_init();
- }
-
-@@ -725,6 +793,9 @@ static void __init do_initcalls(void)
- */
- static void __init do_basic_setup(void)
- {
-+ prepare_ve0_loopback();
-+ init_ve_system();
-+
- /* drivers will send hotplug events */
- init_workqueues();
- usermodehelper_init();
-@@ -744,7 +815,7 @@ static void __init do_basic_setup(void)
- static void do_pre_smp_initcalls(void)
- {
- extern int spawn_ksoftirqd(void);
--#ifdef CONFIG_SMP
-+#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_VCPU)
- extern int migration_init(void);
-
- migration_init();
-@@ -797,6 +868,12 @@ static int init(void * unused)
- fixup_cpu_present_map();
- smp_init();
-
-+ /*
-+ * This should be done after all cpus are known to
-+ * be online. smp_init gives us confidence in it.
-+ */
-+ fairsched_init_late();
-+
- /*
- * Do this before initcalls, because some drivers want to access
- * firmware files.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/init/version.c linux-2.6.9-ve023stab030/init/version.c
---- linux-2.6.9-42.0.3.EL.orig/init/version.c 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/init/version.c 2006-10-11 19:07:57.000000000 +0400
-@@ -28,6 +28,12 @@ struct new_utsname system_utsname = {
-
- EXPORT_SYMBOL(system_utsname);
-
-+struct new_utsname virt_utsname = {
-+ /* we need only this field */
-+ .release = UTS_RELEASE,
-+};
-+EXPORT_SYMBOL(virt_utsname);
-+
- const char *linux_banner =
- "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
- LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/compat.c linux-2.6.9-ve023stab030/ipc/compat.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/compat.c 2004-10-19 01:54:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/compat.c 2006-10-11 19:07:57.000000000 +0400
-@@ -33,6 +33,8 @@
- #include <asm/semaphore.h>
- #include <asm/uaccess.h>
-
-+#include <linux/ve_owner.h>
-+
- #include "util.h"
-
- struct compat_msgbuf {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/mqueue.c linux-2.6.9-ve023stab030/ipc/mqueue.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/mqueue.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/mqueue.c 2006-10-11 19:07:55.000000000 +0400
-@@ -635,7 +635,8 @@ static int oflag2acc[O_ACCMODE] = { MAY_
- return ERR_PTR(-EINVAL);
- }
-
-- if (permission(dentry->d_inode, oflag2acc[oflag & O_ACCMODE], NULL)) {
-+ if (permission(dentry->d_inode, oflag2acc[oflag & O_ACCMODE],
-+ NULL, NULL)) {
- dput(dentry);
- mntput(mqueue_mnt);
- return ERR_PTR(-EACCES);
-@@ -1015,7 +1016,7 @@ retry:
- goto out;
- }
-
-- ret = netlink_attachskb(sock, nc, 0, MAX_SCHEDULE_TIMEOUT);
-+ ret = netlink_attachskb(sock, nc, 0, MAX_SCHEDULE_TIMEOUT, NULL);
- if (ret == 1)
- goto retry;
- if (ret) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/msg.c linux-2.6.9-ve023stab030/ipc/msg.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/msg.c 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/msg.c 2006-10-11 19:07:59.000000000 +0400
-@@ -28,6 +28,7 @@
- #include <asm/current.h>
- #include <asm/uaccess.h>
- #include "util.h"
-+#include <linux/module.h>
-
- /* sysctl: */
- int msg_ctlmax = MSGMAX;
-@@ -76,6 +77,16 @@ static int newque (key_t key, int msgflg
- static int sysvipc_msg_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, void *data);
- #endif
-
-+void prepare_msg(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->_msg_ids = &msg_ids;
-+ get_ve0()->_msg_ctlmax = msg_ctlmax;
-+ get_ve0()->_msg_ctlmnb = msg_ctlmnb;
-+ get_ve0()->_msg_ctlmni = msg_ctlmni;
-+#endif
-+}
-+
- void __init msg_init (void)
- {
- ipc_init_ids(&msg_ids,msg_ctlmni);
-@@ -85,6 +96,23 @@ void __init msg_init (void)
- #endif
- }
-
-+#ifdef CONFIG_VE
-+# define msg_ids (*(get_exec_env()->_msg_ids))
-+# define msg_ctlmax (get_exec_env()->_msg_ctlmax)
-+# define msg_ctlmnb (get_exec_env()->_msg_ctlmnb)
-+# define msg_ctlmni (get_exec_env()->_msg_ctlmni)
-+#endif
-+
-+#ifdef CONFIG_VE
-+void ve_msg_ipc_init (void)
-+{
-+ msg_ctlmax = MSGMAX;
-+ msg_ctlmnb = MSGMNB;
-+ msg_ctlmni = MSGMNI;
-+ ve_ipc_init_ids(&msg_ids, MSGMNI);
-+}
-+#endif
-+
- static int newque (key_t key, int msgflg)
- {
- int id;
-@@ -105,7 +133,7 @@ static int newque (key_t key, int msgflg
- return retval;
- }
-
-- id = ipc_addid(&msg_ids, &msq->q_perm, msg_ctlmni);
-+ id = ipc_addid(&msg_ids, &msq->q_perm, msg_ctlmni, -1);
- if(id == -1) {
- security_msg_queue_free(msq);
- ipc_rcu_putref(msq);
-@@ -446,7 +474,7 @@ asmlinkage long sys_msgctl (int msqid, i
- ipcp = &msq->q_perm;
- err = -EPERM;
- if (current->euid != ipcp->cuid &&
-- current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN))
-+ current->euid != ipcp->uid && !capable(CAP_VE_SYS_ADMIN))
- /* We _could_ check for CAP_CHOWN above, but we don't */
- goto out_unlock_up;
-
-@@ -536,7 +564,7 @@ static inline int pipelined_send(struct
- msr->r_msg = ERR_PTR(-E2BIG);
- } else {
- msr->r_msg = NULL;
-- msq->q_lrpid = msr->r_tsk->pid;
-+ msq->q_lrpid = virt_pid(msr->r_tsk);
- msq->q_rtime = get_seconds();
- wake_up_process(msr->r_tsk);
- smp_mb();
-@@ -618,7 +646,7 @@ asmlinkage long sys_msgsnd (int msqid, s
- }
- }
-
-- msq->q_lspid = current->tgid;
-+ msq->q_lspid = virt_tgid(current);
- msq->q_stime = get_seconds();
-
- if(!pipelined_send(msq,msg)) {
-@@ -714,7 +742,7 @@ asmlinkage long sys_msgrcv (int msqid, s
- list_del(&msg->m_list);
- msq->q_qnum--;
- msq->q_rtime = get_seconds();
-- msq->q_lrpid = current->tgid;
-+ msq->q_lrpid = virt_tgid(current);
- msq->q_cbytes -= msg->m_ts;
- atomic_sub(msg->m_ts,&msg_bytes);
- atomic_dec(&msg_hdrs);
-@@ -859,3 +887,40 @@ done:
- return len;
- }
- #endif
-+
-+#ifdef CONFIG_VE
-+void ve_msg_ipc_cleanup(void)
-+{
-+ int i;
-+ struct msg_queue *msq;
-+
-+ down(&msg_ids.sem);
-+ for (i = 0; i <= msg_ids.max_id; i++) {
-+ msq = msg_lock(i);
-+ if (msq == NULL)
-+ continue;
-+ freeque(msq, i);
-+ }
-+ up(&msg_ids.sem);
-+}
-+
-+int sysvipc_walk_msg(int (*func)(int i, struct msg_queue*, void *), void *arg)
-+{
-+ int i;
-+ int err = 0;
-+ struct msg_queue * msq;
-+
-+ down(&msg_ids.sem);
-+ for(i = 0; i <= msg_ids.max_id; i++) {
-+ if ((msq = msg_lock(i)) == NULL)
-+ continue;
-+ err = func(msg_buildid(i,msq->q_perm.seq), msq, arg);
-+ msg_unlock(msq);
-+ if (err)
-+ break;
-+ }
-+ up(&msg_ids.sem);
-+ return err;
-+}
-+EXPORT_SYMBOL(sysvipc_walk_msg);
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/msgutil.c linux-2.6.9-ve023stab030/ipc/msgutil.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/msgutil.c 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/msgutil.c 2006-10-11 19:07:56.000000000 +0400
-@@ -17,6 +17,8 @@
-
- #include "util.h"
-
-+#include <ub/ub_mem.h>
-+
- struct msg_msgseg {
- struct msg_msgseg* next;
- /* the next part of the message follows immediately */
-@@ -36,7 +38,7 @@ struct msg_msg *load_msg(const void __us
- if (alen > DATALEN_MSG)
- alen = DATALEN_MSG;
-
-- msg = (struct msg_msg *)kmalloc(sizeof(*msg) + alen, GFP_KERNEL);
-+ msg = (struct msg_msg *)ub_kmalloc(sizeof(*msg) + alen, GFP_KERNEL);
- if (msg == NULL)
- return ERR_PTR(-ENOMEM);
-
-@@ -56,7 +58,7 @@ struct msg_msg *load_msg(const void __us
- alen = len;
- if (alen > DATALEN_SEG)
- alen = DATALEN_SEG;
-- seg = (struct msg_msgseg *)kmalloc(sizeof(*seg) + alen,
-+ seg = (struct msg_msgseg *)ub_kmalloc(sizeof(*seg) + alen,
- GFP_KERNEL);
- if (seg == NULL) {
- err = -ENOMEM;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/sem.c linux-2.6.9-ve023stab030/ipc/sem.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/sem.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/sem.c 2006-10-11 19:07:59.000000000 +0400
-@@ -73,8 +73,10 @@
- #include <linux/security.h>
- #include <linux/audit.h>
- #include <asm/uaccess.h>
-+#include <linux/module.h>
- #include "util.h"
-
-+#include <ub/ub_mem.h>
-
- #define sem_lock(id) ((struct sem_array*)ipc_lock(&sem_ids,id))
- #define sem_unlock(sma) ipc_unlock(&(sma)->sem_perm)
-@@ -83,9 +85,13 @@
- ipc_checkid(&sem_ids,&sma->sem_perm,semid)
- #define sem_buildid(id, seq) \
- ipc_buildid(&sem_ids, id, seq)
-+
-+int sem_ctls[4] = {SEMMSL, SEMMNS, SEMOPM, SEMMNI};
-+
- static struct ipc_ids sem_ids;
-+static int used_sems;
-
--static int newary (key_t, int, int);
-+static int newary (key_t, int, int, int);
- static void freeary (struct sem_array *sma, int id);
- #ifdef CONFIG_PROC_FS
- static int sysvipc_sem_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, void *data);
-@@ -103,24 +109,51 @@ static int sysvipc_sem_read_proc(char *b
- *
- */
-
--int sem_ctls[4] = {SEMMSL, SEMMNS, SEMOPM, SEMMNI};
- #define sc_semmsl (sem_ctls[0])
- #define sc_semmns (sem_ctls[1])
- #define sc_semopm (sem_ctls[2])
- #define sc_semmni (sem_ctls[3])
-
--static int used_sems;
-+void prepare_sem(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->_sem_ids = &sem_ids;
-+ get_ve0()->_used_sems = used_sems;
-+ get_ve0()->_sem_ctls[0] = sem_ctls[0];
-+ get_ve0()->_sem_ctls[1] = sem_ctls[1];
-+ get_ve0()->_sem_ctls[2] = sem_ctls[2];
-+ get_ve0()->_sem_ctls[3] = sem_ctls[3];
-+#endif
-+}
-
- void __init sem_init (void)
- {
- used_sems = 0;
-- ipc_init_ids(&sem_ids,sc_semmni);
-+ ipc_init_ids(&sem_ids, SEMMNI);
-
- #ifdef CONFIG_PROC_FS
- create_proc_read_entry("sysvipc/sem", 0, NULL, sysvipc_sem_read_proc, NULL);
- #endif
- }
-
-+#ifdef CONFIG_VE
-+# define sem_ids (*(get_exec_env()->_sem_ids))
-+# define used_sems (get_exec_env()->_used_sems)
-+# define sem_ctls (get_exec_env()->_sem_ctls)
-+#endif
-+
-+#ifdef CONFIG_VE
-+void ve_sem_ipc_init (void)
-+{
-+ used_sems = 0;
-+ sem_ctls[0] = SEMMSL;
-+ sem_ctls[1] = SEMMNS;
-+ sem_ctls[2] = SEMOPM;
-+ sem_ctls[3] = SEMMNI;
-+ ve_ipc_init_ids(&sem_ids, SEMMNI);
-+}
-+#endif
-+
- /*
- * Lockless wakeup algorithm:
- * Without the check/retry algorithm a lockless wakeup is possible:
-@@ -155,7 +188,7 @@ void __init sem_init (void)
- */
- #define IN_WAKEUP 1
-
--static int newary (key_t key, int nsems, int semflg)
-+static int newary (key_t key, int semid, int nsems, int semflg)
- {
- int id;
- int retval;
-@@ -184,7 +217,7 @@ static int newary (key_t key, int nsems,
- return retval;
- }
-
-- id = ipc_addid(&sem_ids, &sma->sem_perm, sc_semmni);
-+ id = ipc_addid(&sem_ids, &sma->sem_perm, sc_semmni, semid);
- if(id == -1) {
- security_sem_free(sma);
- ipc_rcu_putref(sma);
-@@ -213,12 +246,12 @@ asmlinkage long sys_semget (key_t key, i
- down(&sem_ids.sem);
-
- if (key == IPC_PRIVATE) {
-- err = newary(key, nsems, semflg);
-+ err = newary(key, -1, nsems, semflg);
- } else if ((id = ipc_findkey(&sem_ids, key)) == -1) { /* key not used */
- if (!(semflg & IPC_CREAT))
- err = -ENOENT;
- else
-- err = newary(key, nsems, semflg);
-+ err = newary(key, -1, nsems, semflg);
- } else if (semflg & IPC_CREAT && semflg & IPC_EXCL) {
- err = -EEXIST;
- } else {
-@@ -737,7 +770,7 @@ static int semctl_main(int semid, int se
- for (un = sma->undo; un; un = un->id_next)
- un->semadj[semnum] = 0;
- curr->semval = val;
-- curr->sempid = current->tgid;
-+ curr->sempid = virt_tgid(current);
- sma->sem_ctime = get_seconds();
- /* maybe some queued-up processes were waiting for this */
- update_queue(sma);
-@@ -817,7 +850,7 @@ static int semctl_down(int semid, int se
- ipcp = &sma->sem_perm;
-
- if (current->euid != ipcp->cuid &&
-- current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) {
-+ current->euid != ipcp->uid && !capable(CAP_VE_SYS_ADMIN)) {
- err=-EPERM;
- goto out_unlock;
- }
-@@ -938,7 +971,8 @@ static inline int get_undo_list(struct s
- undo_list = current->sysvsem.undo_list;
- if (!undo_list) {
- size = sizeof(struct sem_undo_list);
-- undo_list = (struct sem_undo_list *) kmalloc(size, GFP_KERNEL);
-+ undo_list = (struct sem_undo_list *) ub_kmalloc(size,
-+ GFP_KERNEL);
- if (undo_list == NULL)
- return -ENOMEM;
- memset(undo_list, 0, size);
-@@ -1004,7 +1038,8 @@ static struct sem_undo *find_undo(int se
- ipc_rcu_getref(sma);
- sem_unlock(sma);
-
-- new = (struct sem_undo *) kmalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);
-+ new = (struct sem_undo *) ub_kmalloc(sizeof(struct sem_undo) +
-+ sizeof(short)*nsems, GFP_KERNEL);
- if (!new) {
- ipc_lock_by_ptr(&sma->sem_perm);
- ipc_rcu_putref(sma);
-@@ -1062,7 +1097,7 @@ asmlinkage long sys_semtimedop(int semid
- if (nsops > sc_semopm)
- return -E2BIG;
- if(nsops > SEMOPM_FAST) {
-- sops = kmalloc(sizeof(*sops)*nsops,GFP_KERNEL);
-+ sops = ub_kmalloc(sizeof(*sops)*nsops, GFP_KERNEL);
- if(sops==NULL)
- return -ENOMEM;
- }
-@@ -1134,7 +1169,7 @@ retry_undos:
- if (error)
- goto out_unlock_free;
-
-- error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
-+ error = try_atomic_semop (sma, sops, nsops, un, virt_tgid(current));
- if (error <= 0) {
- if (alter && error == 0)
- update_queue (sma);
-@@ -1149,7 +1184,7 @@ retry_undos:
- queue.sops = sops;
- queue.nsops = nsops;
- queue.undo = un;
-- queue.pid = current->tgid;
-+ queue.pid = virt_tgid(current);
- queue.id = semid;
- queue.alter = alter;
- if (alter)
-@@ -1321,7 +1356,7 @@ found:
- sem->semval = 0;
- if (sem->semval > SEMVMX)
- sem->semval = SEMVMX;
-- sem->sempid = current->tgid;
-+ sem->sempid = virt_tgid(current);
- }
- }
- sma->sem_otime = get_seconds();
-@@ -1332,6 +1367,7 @@ next_entry:
- }
- kfree(undo_list);
- }
-+EXPORT_SYMBOL(exit_sem);
-
- #ifdef CONFIG_PROC_FS
- static int sysvipc_sem_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
-@@ -1381,3 +1417,60 @@ done:
- return len;
- }
- #endif
-+
-+#ifdef CONFIG_VE
-+void ve_sem_ipc_cleanup(void)
-+{
-+ int i;
-+ struct sem_array *sma;
-+
-+ down(&sem_ids.sem);
-+ for (i = 0; i <= sem_ids.max_id; i++) {
-+ sma = sem_lock(i);
-+ if (sma == NULL)
-+ continue;
-+ freeary(sma, i);
-+ }
-+ up(&sem_ids.sem);
-+}
-+
-+int sysvipc_setup_sem(key_t key, int semid, size_t size, int semflg)
-+{
-+ int err = 0;
-+ struct sem_array *sma;
-+
-+ down(&sem_ids.sem);
-+ sma = sem_lock(semid);
-+ if (!sma) {
-+ err = newary(key, semid, size, semflg);
-+ if (err >= 0)
-+ sma = sem_lock(semid);
-+ }
-+ if (sma)
-+ sem_unlock(sma);
-+ up(&sem_ids.sem);
-+
-+ return err > 0 ? 0 : err;
-+}
-+EXPORT_SYMBOL(sysvipc_setup_sem);
-+
-+int sysvipc_walk_sem(int (*func)(int i, struct sem_array*, void *), void *arg)
-+{
-+ int i;
-+ int err = 0;
-+ struct sem_array *sma;
-+
-+ down(&sem_ids.sem);
-+ for (i = 0; i <= sem_ids.max_id; i++) {
-+ if ((sma = sem_lock(i)) == NULL)
-+ continue;
-+ err = func(sem_buildid(i,sma->sem_perm.seq), sma, arg);
-+ sem_unlock(sma);
-+ if (err)
-+ break;
-+ }
-+ up(&sem_ids.sem);
-+ return err;
-+}
-+EXPORT_SYMBOL(sysvipc_walk_sem);
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/shm.c linux-2.6.9-ve023stab030/ipc/shm.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/shm.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/shm.c 2006-10-11 19:07:59.000000000 +0400
-@@ -28,6 +28,10 @@
- #include <linux/security.h>
- #include <linux/audit.h>
- #include <asm/uaccess.h>
-+#include <linux/module.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-
- #include "util.h"
-
-@@ -44,7 +48,7 @@ static struct ipc_ids shm_ids;
- #define shm_buildid(id, seq) \
- ipc_buildid(&shm_ids, id, seq)
-
--static int newseg (key_t key, int shmflg, size_t size);
-+static int newseg (key_t key, int shmid, int shmflg, size_t size);
- static void shm_open (struct vm_area_struct *shmd);
- static void shm_close (struct vm_area_struct *shmd);
- #ifdef CONFIG_PROC_FS
-@@ -56,6 +60,28 @@ size_t shm_ctlall = SHMALL;
- int shm_ctlmni = SHMMNI;
-
- static int shm_tot; /* total number of shared memory pages */
-+
-+void prepare_shm(void)
-+{
-+#ifdef CONFIG_VE
-+ int i;
-+ struct shmid_kernel* shp;
-+
-+ get_ve0()->_shm_ids = &shm_ids;
-+ for (i = 0; i <= shm_ids.max_id; i++) {
-+ shp = (struct shmid_kernel *)ipc_lock(&shm_ids, i);
-+ if (shp != NULL) {
-+ shp->_shm_ids = &shm_ids;
-+ ipc_unlock(&shp->shm_perm);
-+ }
-+ }
-+
-+ get_ve0()->_shm_ctlmax = shm_ctlmax;
-+ get_ve0()->_shm_ctlall = shm_ctlall;
-+ get_ve0()->_shm_ctlmni = shm_ctlmni;
-+ get_ve0()->_shm_tot = shm_tot;
-+#endif
-+}
-
- void __init shm_init (void)
- {
-@@ -65,6 +91,42 @@ void __init shm_init (void)
- #endif
- }
-
-+#ifdef CONFIG_VE
-+# define shm_ids (*(get_exec_env()->_shm_ids))
-+# define shm_ctlmax (get_exec_env()->_shm_ctlmax)
-+# define shm_ctlall (get_exec_env()->_shm_ctlall)
-+# define shm_ctlmni (get_exec_env()->_shm_ctlmni)
-+/* renamed since there is a struct field named shm_tot */
-+# define shm_total (get_exec_env()->_shm_tot)
-+#else
-+# define shm_total shm_tot
-+#endif
-+
-+#ifdef CONFIG_VE
-+void ve_shm_ipc_init (void)
-+{
-+ shm_ctlmax = SHMMAX;
-+ shm_ctlall = SHMALL;
-+ shm_ctlmni = SHMMNI;
-+ shm_total = 0;
-+ ve_ipc_init_ids(&shm_ids, 1);
-+}
-+#endif
-+
-+static struct shmid_kernel* shm_lock_by_sb(int id, struct super_block* sb)
-+{
-+ struct ve_struct *fs_envid;
-+ fs_envid = VE_OWNER_FSTYPE(sb->s_type);
-+ return (struct shmid_kernel *)ipc_lock(fs_envid->_shm_ids, id);
-+}
-+
-+static inline int *shm_total_sb(struct super_block *sb)
-+{
-+ struct ve_struct *fs_envid;
-+ fs_envid = VE_OWNER_FSTYPE(sb->s_type);
-+ return &fs_envid->_shm_tot;
-+}
-+
- static inline int shm_checkid(struct shmid_kernel *s, int id)
- {
- if (ipc_checkid(&shm_ids,&s->shm_perm,id))
-@@ -72,25 +134,25 @@ static inline int shm_checkid(struct shm
- return 0;
- }
-
--static inline struct shmid_kernel *shm_rmid(int id)
-+static inline struct shmid_kernel *shm_rmid(struct ipc_ids *ids, int id)
- {
-- return (struct shmid_kernel *)ipc_rmid(&shm_ids,id);
-+ return (struct shmid_kernel *)ipc_rmid(ids, id);
- }
-
--static inline int shm_addid(struct shmid_kernel *shp)
-+static inline int shm_addid(struct shmid_kernel *shp, int reqid)
- {
-- return ipc_addid(&shm_ids, &shp->shm_perm, shm_ctlmni);
-+ return ipc_addid(&shm_ids, &shp->shm_perm, shm_ctlmni, reqid);
- }
-
-
-
--static inline void shm_inc (int id) {
-+static inline void shm_inc (int id, struct super_block * sb) {
- struct shmid_kernel *shp;
-
-- if(!(shp = shm_lock(id)))
-+ if(!(shp = shm_lock_by_sb(id, sb)))
- BUG();
- shp->shm_atim = get_seconds();
-- shp->shm_lprid = current->tgid;
-+ shp->shm_lprid = virt_tgid(current);
- shp->shm_nattch++;
- shm_unlock(shp);
- }
-@@ -98,7 +160,40 @@ static inline void shm_inc (int id) {
- /* This is called by fork, once for every shm attach. */
- static void shm_open (struct vm_area_struct *shmd)
- {
-- shm_inc (shmd->vm_file->f_dentry->d_inode->i_ino);
-+ shm_inc (shmd->vm_file->f_dentry->d_inode->i_ino,
-+ shmd->vm_file->f_dentry->d_inode->i_sb);
-+}
-+
-+int shmem_lock(struct shmid_kernel *shp, int lock, struct user_struct *user)
-+{
-+ struct file *file = shp->shm_file;
-+ struct inode *inode = file->f_dentry->d_inode;
-+ struct shmem_inode_info *info = SHMEM_I(inode);
-+ unsigned long size;
-+
-+ spin_lock(&info->lock);
-+ if (lock && !(info->flags & VM_LOCKED)) {
-+ size = shp->shm_segsz + PAGE_SIZE - 1;
-+ if (ub_locked_mem_charge(shmid_ub(shp), size) < 0)
-+ goto out_charge;
-+ if (!user_shm_lock(inode->i_size, user))
-+ goto out_nomem;
-+ info->flags |= VM_LOCKED;
-+ }
-+ if (!lock && (info->flags & VM_LOCKED) && user) {
-+ size = shp->shm_segsz + PAGE_SIZE - 1;
-+ user_shm_unlock(inode->i_size, user);
-+ ub_locked_mem_uncharge(shmid_ub(shp), size);
-+ info->flags &= ~VM_LOCKED;
-+ }
-+ spin_unlock(&info->lock);
-+ return 0;
-+
-+out_nomem:
-+ ub_locked_mem_uncharge(shmid_ub(shp), size);
-+out_charge:
-+ spin_unlock(&info->lock);
-+ return -ENOMEM;
- }
-
- /*
-@@ -111,16 +206,27 @@ static void shm_open (struct vm_area_str
- */
- static void shm_destroy (struct shmid_kernel *shp)
- {
-- shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
-- shm_rmid (shp->id);
-+ int numpages;
-+ struct super_block *sb;
-+ int *shm_totalp;
-+ struct file *file;
-+
-+ file = shp->shm_file;
-+ numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
-+ sb = file->f_dentry->d_inode->i_sb;
-+ shm_totalp = shm_total_sb(sb);
-+ *shm_totalp -= numpages;
-+ shm_rmid(shp->_shm_ids, shp->id);
- shm_unlock(shp);
- if (!is_file_hugepages(shp->shm_file))
-- shmem_lock(shp->shm_file, 0, shp->mlock_user);
-+ shmem_lock(shp, 0, shp->mlock_user);
- else
- user_shm_unlock(shp->shm_file->f_dentry->d_inode->i_size,
- shp->mlock_user);
-- fput (shp->shm_file);
-+ fput (file);
- security_shm_free(shp);
-+ put_beancounter(shmid_ub(shp));
-+ shmid_ub(shp) = NULL;
- ipc_rcu_putref(shp);
- }
-
-@@ -134,13 +240,25 @@ static void shm_close (struct vm_area_st
- {
- struct file * file = shmd->vm_file;
- int id = file->f_dentry->d_inode->i_ino;
-+ struct super_block *sb;
- struct shmid_kernel *shp;
-+ struct ipc_ids* ids;
-+#ifdef CONFIG_VE
-+ struct ve_struct *fs_envid;
-+#endif
-
-- down (&shm_ids.sem);
-+ sb = file->f_dentry->d_inode->i_sb;
-+#ifdef CONFIG_VE
-+ fs_envid = get_ve(VE_OWNER_FSTYPE(sb->s_type));
-+ ids = fs_envid->_shm_ids;
-+#else
-+ ids = &shm_ids;
-+#endif
-+ down (&ids->sem);
- /* remove from the list of attaches of the shm segment */
-- if(!(shp = shm_lock(id)))
-+ if(!(shp = shm_lock_by_sb(id, sb)))
- BUG();
-- shp->shm_lprid = current->tgid;
-+ shp->shm_lprid = virt_tgid(current);
- shp->shm_dtim = get_seconds();
- shp->shm_nattch--;
- if(shp->shm_nattch == 0 &&
-@@ -148,7 +266,10 @@ static void shm_close (struct vm_area_st
- shm_destroy (shp);
- else
- shm_unlock(shp);
-- up (&shm_ids.sem);
-+ up (&ids->sem);
-+#ifdef CONFIG_VE
-+ put_ve(fs_envid);
-+#endif
- }
-
- static int shm_mmap(struct file * file, struct vm_area_struct * vma)
-@@ -157,7 +278,8 @@ static int shm_mmap(struct file * file,
- vma->vm_ops = &shm_vm_ops;
- if (!(vma->vm_flags & VM_WRITE))
- vma->vm_flags &= ~VM_MAYWRITE;
-- shm_inc(file->f_dentry->d_inode->i_ino);
-+ shm_inc(file->f_dentry->d_inode->i_ino,
-+ file->f_dentry->d_inode->i_sb);
- return 0;
- }
-
-@@ -175,19 +297,19 @@ static struct vm_operations_struct shm_v
- #endif
- };
-
--static int newseg (key_t key, int shmflg, size_t size)
-+static int newseg (key_t key, int shmid, int shmflg, size_t size)
- {
- int error;
- struct shmid_kernel *shp;
- int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
- struct file * file;
-- char name[13];
-+ char name[26];
- int id;
-
- if (size < SHMMIN || size > shm_ctlmax)
- return -EINVAL;
-
-- if (shm_tot + numpages >= shm_ctlall)
-+ if (shm_total + numpages >= shm_ctlall)
- return -ENOSPC;
-
- shp = ipc_rcu_alloc(sizeof(*shp));
-@@ -210,7 +332,11 @@ static int newseg (key_t key, int shmflg
- file = hugetlb_zero_setup(size);
- shp->mlock_user = current->user;
- } else {
-+#ifdef CONFIG_VE
-+ sprintf (name, "VE%d.SYSV%08x", get_exec_env()->veid, key);
-+#else
- sprintf (name, "SYSV%08x", key);
-+#endif
- file = shmem_file_setup(name, size, VM_ACCOUNT);
- }
- error = PTR_ERR(file);
-@@ -218,24 +344,26 @@ static int newseg (key_t key, int shmflg
- goto no_file;
-
- error = -ENOSPC;
-- id = shm_addid(shp);
-+ id = shm_addid(shp, shmid);
- if(id == -1)
- goto no_id;
-
-- shp->shm_cprid = current->tgid;
-+ shp->shm_cprid = virt_tgid(current);
- shp->shm_lprid = 0;
- shp->shm_atim = shp->shm_dtim = 0;
- shp->shm_ctim = get_seconds();
- shp->shm_segsz = size;
- shp->shm_nattch = 0;
- shp->id = shm_buildid(id,shp->shm_perm.seq);
-+ shp->_shm_ids = &shm_ids;
- shp->shm_file = file;
-+ shmid_ub(shp) = get_beancounter(get_exec_ub());
- file->f_dentry->d_inode->i_ino = shp->id;
- if (shmflg & SHM_HUGETLB)
- set_file_hugepages(file);
- else
- file->f_op = &shm_file_operations;
-- shm_tot += numpages;
-+ shm_total += numpages;
- shm_unlock(shp);
- return shp->id;
-
-@@ -254,12 +382,12 @@ asmlinkage long sys_shmget (key_t key, s
-
- down(&shm_ids.sem);
- if (key == IPC_PRIVATE) {
-- err = newseg(key, shmflg, size);
-+ err = newseg(key, -1, shmflg, size);
- } else if ((id = ipc_findkey(&shm_ids, key)) == -1) {
- if (!(shmflg & IPC_CREAT))
- err = -ENOENT;
- else
-- err = newseg(key, shmflg, size);
-+ err = newseg(key, -1, shmflg, size);
- } else if ((shmflg & IPC_CREAT) && (shmflg & IPC_EXCL)) {
- err = -EEXIST;
- } else {
-@@ -452,7 +580,7 @@ asmlinkage long sys_shmctl (int shmid, i
- down(&shm_ids.sem);
- shm_info.used_ids = shm_ids.in_use;
- shm_get_stat (&shm_info.shm_rss, &shm_info.shm_swp);
-- shm_info.shm_tot = shm_tot;
-+ shm_info.shm_tot = shm_total;
- shm_info.swap_attempts = 0;
- shm_info.swap_successes = 0;
- err = shm_ids.max_id;
-@@ -539,14 +667,14 @@ asmlinkage long sys_shmctl (int shmid, i
- if(cmd==SHM_LOCK) {
- struct user_struct * user = current->user;
- if (!is_file_hugepages(shp->shm_file)) {
-- err = shmem_lock(shp->shm_file, 1, user);
-+ err = shmem_lock(shp, 1, user);
- if (!err) {
- shp->shm_flags |= SHM_LOCKED;
- shp->mlock_user = user;
- }
- }
- } else if (!is_file_hugepages(shp->shm_file)) {
-- shmem_lock(shp->shm_file, 0, shp->mlock_user);
-+ shmem_lock(shp, 0, shp->mlock_user);
- shp->shm_flags &= ~SHM_LOCKED;
- shp->mlock_user = NULL;
- }
-@@ -576,7 +704,7 @@ asmlinkage long sys_shmctl (int shmid, i
-
- if (current->euid != shp->shm_perm.uid &&
- current->euid != shp->shm_perm.cuid &&
-- !capable(CAP_SYS_ADMIN)) {
-+ !capable(CAP_VE_SYS_ADMIN)) {
- err=-EPERM;
- goto out_unlock_up;
- }
-@@ -615,7 +743,7 @@ asmlinkage long sys_shmctl (int shmid, i
- err=-EPERM;
- if (current->euid != shp->shm_perm.uid &&
- current->euid != shp->shm_perm.cuid &&
-- !capable(CAP_SYS_ADMIN)) {
-+ !capable(CAP_VE_SYS_ADMIN)) {
- goto out_unlock_up;
- }
-
-@@ -840,6 +968,7 @@ asmlinkage long sys_shmdt(char __user *s
- * could possibly have landed at. Also cast things to loff_t to
- * prevent overflows and make comparisions vs. equal-width types.
- */
-+ size = PAGE_ALIGN(size);
- while (vma && (loff_t)(vma->vm_end - addr) <= size) {
- next = vma->vm_next;
-
-@@ -916,3 +1045,74 @@ done:
- return len;
- }
- #endif
-+
-+#ifdef CONFIG_VE
-+void ve_shm_ipc_cleanup(void)
-+{
-+ int i;
-+
-+ down(&shm_ids.sem);
-+ for (i = 0; i <= shm_ids.max_id; i++) {
-+ struct shmid_kernel *shp;
-+
-+ if (!(shp = shm_lock(i)))
-+ continue;
-+ if (shp->shm_nattch) {
-+ shp->shm_flags |= SHM_DEST;
-+ shp->shm_perm.key = IPC_PRIVATE;
-+ shm_unlock(shp);
-+ } else
-+ shm_destroy(shp);
-+ }
-+ up(&shm_ids.sem);
-+}
-+#endif
-+
-+struct file * sysvipc_setup_shm(key_t key, int shmid, size_t size, int shmflg)
-+{
-+ struct shmid_kernel *shp;
-+ struct file *file;
-+
-+ down(&shm_ids.sem);
-+ shp = shm_lock(shmid);
-+ if (!shp) {
-+ int err;
-+
-+ err = newseg(key, shmid, shmflg, size);
-+ file = ERR_PTR(err);
-+ if (err < 0)
-+ goto out;
-+ shp = shm_lock(shmid);
-+ }
-+ file = ERR_PTR(-EINVAL);
-+ if (shp) {
-+ file = shp->shm_file;
-+ get_file(file);
-+ shm_unlock(shp);
-+ }
-+out:
-+ up(&shm_ids.sem);
-+
-+ return file;
-+}
-+EXPORT_SYMBOL(sysvipc_setup_shm);
-+
-+int sysvipc_walk_shm(int (*func)(struct shmid_kernel*, void *), void *arg)
-+{
-+ int i;
-+ int err = 0;
-+ struct shmid_kernel* shp;
-+
-+ down(&shm_ids.sem);
-+ for(i = 0; i <= shm_ids.max_id; i++) {
-+ if ((shp = shm_lock(i)) == NULL)
-+ continue;
-+ err = func(shp, arg);
-+ shm_unlock(shp);
-+ if (err)
-+ break;
-+ }
-+ up(&shm_ids.sem);
-+ return err;
-+}
-+EXPORT_SYMBOL(sysvipc_walk_shm);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/util.c linux-2.6.9-ve023stab030/ipc/util.c
---- linux-2.6.9-42.0.3.EL.orig/ipc/util.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/util.c 2006-10-11 19:07:59.000000000 +0400
-@@ -13,6 +13,7 @@
- */
-
- #include <linux/config.h>
-+#include <linux/module.h>
- #include <linux/mm.h>
- #include <linux/shm.h>
- #include <linux/init.h>
-@@ -27,8 +28,12 @@
-
- #include <asm/unistd.h>
-
-+#include <ub/ub_mem.h>
-+
- #include "util.h"
-
-+DCL_VE_OWNER(IPCIDS, STATIC_SOFT, struct ipc_ids, owner_env, inline, ())
-+
- /**
- * ipc_init - initialise IPC subsystem
- *
-@@ -55,7 +60,7 @@ __initcall(ipc_init);
- * array itself.
- */
-
--void __init ipc_init_ids(struct ipc_ids* ids, int size)
-+void ve_ipc_init_ids(struct ipc_ids* ids, int size)
- {
- int i;
- sema_init(&ids->sem,1);
-@@ -82,7 +87,25 @@ void __init ipc_init_ids(struct ipc_ids*
- }
- for(i=0;i<ids->size;i++)
- ids->entries[i].p = NULL;
-+#ifdef CONFIG_VE
-+ SET_VE_OWNER_IPCIDS(ids, get_exec_env());
-+#endif
-+}
-+
-+void __init ipc_init_ids(struct ipc_ids* ids, int size)
-+{
-+ ve_ipc_init_ids(ids, size);
-+}
-+
-+#ifdef CONFIG_VE
-+static void ipc_free_ids(struct ipc_ids* ids)
-+{
-+ if (ids == NULL)
-+ return;
-+ ipc_rcu_putref(ids->entries);
-+ kfree(ids);
- }
-+#endif
-
- /**
- * ipc_findkey - find a key in an ipc identifier set
-@@ -164,10 +187,20 @@ static int grow_ary(struct ipc_ids* ids,
- * Called with ipc_ids.sem held.
- */
-
--int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
-+int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size, int reqid)
- {
- int id;
-
-+ if (reqid >= 0) {
-+ id = reqid%SEQ_MULTIPLIER;
-+ size = grow_ary(ids,id+1);
-+ if (id >= size)
-+ return -1;
-+ if (ids->entries[id].p == NULL)
-+ goto found;
-+ return -1;
-+ }
-+
- size = grow_ary(ids,size);
-
- /*
-@@ -180,6 +213,10 @@ int ipc_addid(struct ipc_ids* ids, struc
- }
- return -1;
- found:
-+#ifdef CONFIG_VE
-+ if (ids->in_use == 0)
-+ (void)get_ve(VE_OWNER_IPCIDS(ids));
-+#endif
- ids->in_use++;
- if (id > ids->max_id)
- ids->max_id = id;
-@@ -187,9 +224,13 @@ found:
- new->cuid = new->uid = current->euid;
- new->gid = new->cgid = current->egid;
-
-- new->seq = ids->seq++;
-- if(ids->seq > ids->seq_max)
-- ids->seq = 0;
-+ if (reqid >= 0) {
-+ new->seq = reqid/SEQ_MULTIPLIER;
-+ } else {
-+ new->seq = ids->seq++;
-+ if(ids->seq > ids->seq_max)
-+ ids->seq = 0;
-+ }
-
- new->lock = SPIN_LOCK_UNLOCKED;
- new->deleted = 0;
-@@ -237,6 +278,10 @@ struct kern_ipc_perm* ipc_rmid(struct ip
- } while (ids->entries[lid].p == NULL);
- ids->max_id = lid;
- }
-+#ifdef CONFIG_VE
-+ if (ids->in_use == 0)
-+ put_ve(VE_OWNER_IPCIDS(ids));
-+#endif
- p->deleted = 1;
- return p;
- }
-@@ -253,9 +298,9 @@ void* ipc_alloc(int size)
- {
- void* out;
- if(size > PAGE_SIZE)
-- out = vmalloc(size);
-+ out = ub_vmalloc(size);
- else
-- out = kmalloc(size, GFP_KERNEL);
-+ out = ub_kmalloc(size, GFP_KERNEL);
- return out;
- }
-
-@@ -338,7 +383,7 @@ void* ipc_rcu_alloc(int size)
- * workqueue if necessary (for vmalloc).
- */
- if (rcu_use_vmalloc(size)) {
-- out = vmalloc(HDRLEN_VMALLOC + size);
-+ out = ub_vmalloc(HDRLEN_VMALLOC + size);
- if (out) {
- out += HDRLEN_VMALLOC;
- container_of(out, struct ipc_rcu_hdr, data)->is_vmalloc = 1;
-@@ -563,6 +608,85 @@ int ipc_checkid(struct ipc_ids* ids, str
- return 0;
- }
-
-+#ifdef CONFIG_VE
-+
-+void prepare_ipc(void)
-+{
-+ /*
-+ * Note: we don't need to call SET_VE_OWNER_IPCIDS inside,
-+ * since we use static variables for ve0 (see STATIC_SOFT decl).
-+ */
-+ prepare_msg();
-+ prepare_sem();
-+ prepare_shm();
-+}
-+
-+int init_ve_ipc(struct ve_struct * envid)
-+{
-+ struct ve_struct * saved_envid;
-+
-+ envid->_msg_ids = kmalloc(sizeof(struct ipc_ids) + sizeof(void *),
-+ GFP_KERNEL);
-+ if (envid->_msg_ids == NULL)
-+ goto out_nomem;
-+ envid->_sem_ids = kmalloc(sizeof(struct ipc_ids) + sizeof(void *),
-+ GFP_KERNEL);
-+ if (envid->_sem_ids == NULL)
-+ goto out_free_msg;
-+ envid->_shm_ids = kmalloc(sizeof(struct ipc_ids) + sizeof(void *),
-+ GFP_KERNEL);
-+ if (envid->_shm_ids == NULL)
-+ goto out_free_sem;
-+
-+ /*
-+ * Bad style, but save a lot of code (charging to proper VE)
-+ * Here we temporary change VEID of the process involved in VE init.
-+ * The same is effect for ve_ipc_cleanup in real_do_env_cleanup().
-+ */
-+ saved_envid = set_exec_env(envid);
-+
-+ ve_msg_ipc_init();
-+ ve_sem_ipc_init();
-+ ve_shm_ipc_init();
-+
-+ (void)set_exec_env(saved_envid);
-+ return 0;
-+
-+out_free_sem:
-+ kfree(envid->_sem_ids);
-+out_free_msg:
-+ kfree(envid->_msg_ids);
-+out_nomem:
-+ return -ENOMEM;
-+}
-+
-+void ve_ipc_cleanup(void)
-+{
-+ ve_msg_ipc_cleanup();
-+ ve_sem_ipc_cleanup();
-+ ve_shm_ipc_cleanup();
-+}
-+
-+void ve_ipc_free(struct ve_struct *envid)
-+{
-+ ipc_free_ids(envid->_msg_ids);
-+ ipc_free_ids(envid->_sem_ids);
-+ ipc_free_ids(envid->_shm_ids);
-+ envid->_msg_ids = envid->_sem_ids = envid->_shm_ids = NULL;
-+}
-+
-+void fini_ve_ipc(struct ve_struct *ptr)
-+{
-+ ve_ipc_cleanup();
-+ ve_ipc_free(ptr);
-+}
-+
-+EXPORT_SYMBOL(init_ve_ipc);
-+EXPORT_SYMBOL(ve_ipc_cleanup);
-+EXPORT_SYMBOL(ve_ipc_free);
-+EXPORT_SYMBOL(fini_ve_ipc);
-+#endif /* CONFIG_VE */
-+
- #ifdef __ARCH_WANT_IPC_PARSE_VERSION
-
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/ipc/util.h linux-2.6.9-ve023stab030/ipc/util.h
---- linux-2.6.9-42.0.3.EL.orig/ipc/util.h 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/ipc/util.h 2006-10-11 19:07:58.000000000 +0400
-@@ -15,6 +15,20 @@ void sem_init (void);
- void msg_init (void);
- void shm_init (void);
-
-+#ifdef CONFIG_VE
-+
-+void ve_msg_ipc_init(void);
-+void ve_sem_ipc_init(void);
-+void ve_shm_ipc_init(void);
-+void prepare_msg(void);
-+void prepare_sem(void);
-+void prepare_shm(void);
-+void ve_msg_ipc_cleanup(void);
-+void ve_sem_ipc_cleanup(void);
-+void ve_shm_ipc_cleanup(void);
-+
-+#endif
-+
- struct ipc_ids {
- int size;
- int in_use;
-@@ -23,17 +37,21 @@ struct ipc_ids {
- unsigned short seq_max;
- struct semaphore sem;
- struct ipc_id* entries;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(IPCIDS, STATIC_SOFT, struct ipc_ids, owner_env, inline, ())
-+
- struct ipc_id {
- struct kern_ipc_perm* p;
- };
-
--void __init ipc_init_ids(struct ipc_ids* ids, int size);
-+void ipc_init_ids(struct ipc_ids* ids, int size);
-+void ve_ipc_init_ids(struct ipc_ids* ids, int size);
-
- /* must be called with ids->sem acquired.*/
- int ipc_findkey(struct ipc_ids* ids, key_t key);
--int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size);
-+int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size, int reqid);
-
- /* must be called with both locks acquired. */
- struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/Kconfig.openvz linux-2.6.9-ve023stab030/kernel/Kconfig.openvz
---- linux-2.6.9-42.0.3.EL.orig/kernel/Kconfig.openvz 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/Kconfig.openvz 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,62 @@
-+# Copyright (C) 2005 SWsoft
-+# All rights reserved.
-+# Licensing governed by "linux/COPYING.SWsoft" file.
-+
-+config VE
-+ bool "Virtual Environment support"
-+ depends on !SECURITY
-+ default y
-+ help
-+ This option adds support of virtual Linux running on the original box
-+ with fully supported virtual network driver, tty subsystem and
-+ configurable access for hardware and other resources.
-+
-+config VE_CALLS
-+ tristate "VE calls interface"
-+ depends on VE
-+ default m
-+ help
-+ This option controls how to build vzmon code containing VE calls.
-+ By default it's build in module vzmon.o
-+
-+config VZ_GENCALLS
-+ bool
-+ default y
-+
-+config VE_NETDEV
-+ tristate "VE networking"
-+ depends on VE
-+ default m
-+ help
-+ This option controls whether to build VE networking code.
-+
-+config VE_ETHDEV
-+ tristate "Virtual ethernet device"
-+ depends on VE_CALLS
-+ default m
-+ help
-+ This option controls whether to build virtual ethernet device.
-+
-+config VE_IPTABLES
-+ bool "VE netfiltering"
-+ depends on VE && VE_NETDEV && INET && NETFILTER
-+ default y
-+ help
-+ This option controls whether to build VE netfiltering code.
-+
-+config VZ_WDOG
-+ tristate "VE watchdog module"
-+ depends on VE
-+ default m
-+ help
-+ This option controls building of vzwdog module, which dumps
-+ a lot of useful system info on console periodically.
-+
-+config VZ_CHECKPOINT
-+ tristate "Checkpointing & restoring Virtual Environments"
-+ depends on SOFTWARE_SUSPEND
-+ default m
-+ help
-+ This option adds two modules, "cpt" and "rst", which allow
-+ to save a running Virtual Environment and restore it
-+ on another host (live migration) or on the same host (checkpointing).
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/audit.c linux-2.6.9-ve023stab030/kernel/audit.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/audit.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/audit.c 2006-10-11 19:08:02.000000000 +0400
-@@ -288,9 +288,10 @@ int kauditd_thread(void *dummy)
- BUG_ON(err != -ECONNREFUSED);
- printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
- read_lock(&tasklist_lock);
-- tsk = find_task_by_pid(audit_pid);
-- if (tsk && (tsk->flags & (PF_MEMDIE|PF_MEMALLOC)) == PF_MEMDIE)
-- tsk->flags &= ~PF_MEMDIE;
-+ tsk = find_task_by_pid_all(audit_pid);
-+ if (tsk && !(tsk->flags & PF_MEMALLOC))
-+ clear_tsk_thread_flag(tsk,
-+ TIF_MEMDIE);
- read_unlock(&tasklist_lock);
-
- audit_pid = 0;
-@@ -437,14 +438,16 @@ static int audit_receive_msg(struct sk_b
- if (old != audit_pid) {
- read_lock(&tasklist_lock);
- if (old) {
-- tsk = find_task_by_pid(old);
-- if (tsk && (tsk->flags & (PF_MEMDIE|PF_MEMALLOC)) == PF_MEMDIE)
-- tsk->flags &= ~PF_MEMDIE;
-+ tsk = find_task_by_pid_all(old);
-+ if (tsk && !(tsk->flags & PF_MEMALLOC))
-+ clear_tsk_thread_flag(tsk,
-+ TIF_MEMDIE);
- }
- if (audit_pid) {
-- tsk = find_task_by_pid(audit_pid);
-+ tsk = find_task_by_pid_all(audit_pid);
- if (tsk)
-- tsk->flags |= PF_MEMDIE;
-+ set_tsk_thread_flag(tsk,
-+ TIF_MEMDIE);
- }
- read_unlock(&tasklist_lock);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/capability.c linux-2.6.9-ve023stab030/kernel/capability.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/capability.c 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/capability.c 2006-10-11 19:07:57.000000000 +0400
-@@ -23,6 +23,7 @@ EXPORT_SYMBOL(cap_bset);
- * Locking rule: acquire this prior to tasklist_lock.
- */
- spinlock_t task_capability_lock = SPIN_LOCK_UNLOCKED;
-+EXPORT_SYMBOL(task_capability_lock);
-
- /*
- * For sys_getproccap() and sys_setproccap(), any of the three
-@@ -59,8 +60,8 @@ asmlinkage long sys_capget(cap_user_head
- spin_lock(&task_capability_lock);
- read_lock(&tasklist_lock);
-
-- if (pid && pid != current->pid) {
-- target = find_task_by_pid(pid);
-+ if (pid && pid != virt_pid(current)) {
-+ target = find_task_by_pid_ve(pid);
- if (!target) {
- ret = -ESRCH;
- goto out;
-@@ -90,11 +91,15 @@ static inline void cap_set_pg(int pgrp,
- {
- task_t *g, *target;
-
-- do_each_task_pid(pgrp, PIDTYPE_PGID, g) {
-+ pgrp = vpid_to_pid(pgrp);
-+ if (pgrp < 0)
-+ return;
-+
-+ do_each_task_pid_ve(pgrp, PIDTYPE_PGID, g) {
- target = g;
-- while_each_thread(g, target)
-+ while_each_thread_ve(g, target)
- security_capset_set(target, effective, inheritable, permitted);
-- } while_each_task_pid(pgrp, PIDTYPE_PGID, g);
-+ } while_each_task_pid_ve(pgrp, PIDTYPE_PGID, g);
- }
-
- /*
-@@ -107,11 +112,11 @@ static inline void cap_set_all(kernel_ca
- {
- task_t *g, *target;
-
-- do_each_thread(g, target) {
-+ do_each_thread_ve(g, target) {
- if (target == current || target->pid == 1)
- continue;
- security_capset_set(target, effective, inheritable, permitted);
-- } while_each_thread(g, target);
-+ } while_each_thread_ve(g, target);
- }
-
- /*
-@@ -157,8 +162,8 @@ asmlinkage long sys_capset(cap_user_head
- spin_lock(&task_capability_lock);
- read_lock(&tasklist_lock);
-
-- if (pid > 0 && pid != current->pid) {
-- target = find_task_by_pid(pid);
-+ if (pid > 0 && pid != virt_pid(current)) {
-+ target = find_task_by_pid_ve(pid);
- if (!target) {
- ret = -ESRCH;
- goto out;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/compat.c linux-2.6.9-ve023stab030/kernel/compat.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/compat.c 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/compat.c 2006-10-11 19:07:59.000000000 +0400
-@@ -20,6 +20,7 @@
- #include <linux/futex.h> /* for FUTEX_WAIT */
- #include <linux/syscalls.h>
- #include <linux/unistd.h>
-+#include <linux/module.h>
-
- #include <asm/uaccess.h>
-
-@@ -37,7 +38,7 @@ int put_compat_timespec(const struct tim
- __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
- }
-
--static long compat_nanosleep_restart(struct restart_block *restart)
-+long compat_nanosleep_restart(struct restart_block *restart)
- {
- unsigned long expire = restart->arg0, now = jiffies;
- struct compat_timespec __user *rmtp;
-@@ -65,6 +66,7 @@ static long compat_nanosleep_restart(str
- /* The 'restart' block is already filled in */
- return -ERESTART_RESTARTBLOCK;
- }
-+EXPORT_SYMBOL(compat_nanosleep_restart);
-
- asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
- struct compat_timespec __user *rmtp)
-@@ -598,6 +600,85 @@ long compat_clock_nanosleep(clockid_t wh
- return err;
- }
-
-+void
-+sigset_from_compat (sigset_t *set, compat_sigset_t *compat)
-+{
-+ switch (_NSIG_WORDS) {
-+ case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 );
-+ case 3: set->sig[2] = compat->sig[4] | (((long)compat->sig[5]) << 32 );
-+ case 2: set->sig[1] = compat->sig[2] | (((long)compat->sig[3]) << 32 );
-+ case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );
-+ }
-+}
-+
-+asmlinkage long
-+compat_rt_sigtimedwait (compat_sigset_t __user *uthese,
-+ struct compat_siginfo __user *uinfo,
-+ struct compat_timespec __user *uts, compat_size_t sigsetsize)
-+{
-+ compat_sigset_t s32;
-+ sigset_t s;
-+ int sig;
-+ struct timespec t;
-+ siginfo_t info;
-+ long ret, timeout = 0;
-+
-+ if (sigsetsize != sizeof(sigset_t))
-+ return -EINVAL;
-+
-+ if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
-+ return -EFAULT;
-+ sigset_from_compat(&s, &s32);
-+ sigdelsetmask(&s,sigmask(SIGKILL)|sigmask(SIGSTOP));
-+ signotset(&s);
-+
-+ if (uts) {
-+ if (get_compat_timespec (&t, uts))
-+ return -EFAULT;
-+ if (t.tv_nsec >= 1000000000L || t.tv_nsec < 0
-+ || t.tv_sec < 0)
-+ return -EINVAL;
-+ }
-+
-+ spin_lock_irq(&current->sighand->siglock);
-+ sig = dequeue_signal(current, &s, &info);
-+ if (!sig) {
-+ timeout = MAX_SCHEDULE_TIMEOUT;
-+ if (uts)
-+ timeout = timespec_to_jiffies(&t)
-+ +(t.tv_sec || t.tv_nsec);
-+ if (timeout) {
-+ current->real_blocked = current->blocked;
-+ sigandsets(&current->blocked, &current->blocked, &s);
-+
-+ recalc_sigpending();
-+ spin_unlock_irq(&current->sighand->siglock);
-+
-+ current->state = TASK_INTERRUPTIBLE;
-+ timeout = schedule_timeout(timeout);
-+
-+ spin_lock_irq(&current->sighand->siglock);
-+ sig = dequeue_signal(current, &s, &info);
-+ current->blocked = current->real_blocked;
-+ siginitset(&current->real_blocked, 0);
-+ recalc_sigpending();
-+ }
-+ }
-+ spin_unlock_irq(&current->sighand->siglock);
-+
-+ if (sig) {
-+ ret = sig;
-+ if (uinfo) {
-+ if (copy_siginfo_to_user32(uinfo, &info))
-+ ret = -EFAULT;
-+ }
-+ }else {
-+ ret = timeout?-EINTR:-EAGAIN;
-+ }
-+ return ret;
-+
-+}
-+
- /* timer_create is architecture specific because it needs sigevent conversion */
-
- long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/configs.c linux-2.6.9-ve023stab030/kernel/configs.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/configs.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/configs.c 2006-10-11 19:07:57.000000000 +0400
-@@ -89,8 +89,7 @@ static int __init ikconfig_init(void)
- struct proc_dir_entry *entry;
-
- /* create the current config file */
-- entry = create_proc_entry("config.gz", S_IFREG | S_IRUGO,
-- &proc_root);
-+ entry = create_proc_entry("config.gz", S_IFREG | S_IRUGO, NULL);
- if (!entry)
- return -ENOMEM;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/Makefile linux-2.6.9-ve023stab030/kernel/cpt/Makefile
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/Makefile 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/Makefile 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,20 @@
-+obj-$(CONFIG_VZ_CHECKPOINT) += vzcpt.o vzrst.o
-+
-+vzcpt-objs := cpt_proc.o cpt_dump.o cpt_obj.o cpt_context.o cpt_process.o \
-+ cpt_mm.o cpt_pagein.o cpt_files.o cpt_kernel.o \
-+ cpt_socket.o cpt_socket_in.o cpt_tty.o cpt_sysvipc.o cpt_net.o \
-+ cpt_conntrack.o cpt_ubc.o cpt_epoll.o cpt_iterative.o
-+
-+vzrst-objs := rst_proc.o rst_undump.o cpt_obj.o rst_context.o rst_process.o \
-+ rst_mm.o rst_pagein.o rst_files.o cpt_kernel.o \
-+ rst_socket.o rst_socket_in.o rst_tty.o rst_sysvipc.o rst_net.o \
-+ rst_conntrack.o rst_ubc.o rst_epoll.o rst_iterative.o
-+
-+ifeq ($(CONFIG_X86_64), y)
-+vzcpt-objs += cpt_x8664.o
-+vzrst-objs += cpt_x8664.o rst_x8664.o
-+endif
-+
-+ifneq ($(CONFIG_X86_64), y)
-+vzrst-objs += rst_i386.o
-+endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_conntrack.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_conntrack.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_conntrack.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_conntrack.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,368 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/netdevice.h>
-+#include <linux/inetdevice.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/unistd.h>
-+#include <linux/ve.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/cpt_image.h>
-+#include <linux/icmp.h>
-+#include <linux/ip.h>
-+
-+#if defined(CONFIG_VE_IPTABLES) && \
-+ (defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE))
-+
-+#include <linux/netfilter.h>
-+#include <linux/netfilter_ipv4/ip_conntrack.h>
-+#include <linux/netfilter_ipv4/ip_nat.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_core.h>
-+#include <linux/netfilter_ipv4/lockhelp.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+
-+/* How does it work?
-+ *
-+ * Network is disabled, so new conntrack entries will not appear.
-+ * However, some of them can disappear because of timeouts.
-+ *
-+ * So, we take read_lock, collect all required information atomically,
-+ * essentially, creating parallel "refcount" structures holding pointers.
-+ * We delete conntrack timers as well, so the structures cannot disappear
-+ * after releasing the lock. Now, after releasing lock we can dump everything
-+ * safely. And on exit we restore timers to their original values.
-+ *
-+ * Note, this approach is not going to work in VE0.
-+ */
-+
-+struct ct_holder
-+{
-+ struct ct_holder *next;
-+ struct ip_conntrack_tuple_hash *cth;
-+ int index;
-+};
-+
-+static void encode_tuple(struct cpt_ipct_tuple *v, struct ip_conntrack_tuple *tuple)
-+{
-+ v->cpt_dst = tuple->dst.ip;
-+ v->cpt_dstport = tuple->dst.u.all;
-+ v->cpt_protonum = tuple->dst.protonum;
-+
-+ v->cpt_src = tuple->src.ip;
-+ v->cpt_srcport = tuple->src.u.all;
-+}
-+
-+static void encode_nat_manip(struct cpt_nat_manip *v, struct ip_nat_info_manip *manip)
-+{
-+ v->cpt_direction = manip->direction;
-+ v->cpt_hooknum = manip->hooknum;
-+ v->cpt_maniptype = manip->maniptype;
-+
-+ v->cpt_manip_addr = manip->manip.ip;
-+ v->cpt_manip_port = manip->manip.u.all;
-+}
-+
-+static int dump_one_expect(struct cpt_ip_connexpect_image *v,
-+ struct ip_conntrack_expect *exp,
-+ int sibling, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+
-+ v->cpt_next = sizeof(*v);
-+ v->cpt_object = CPT_OBJ_NET_CONNTRACK_EXPECT;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ encode_tuple(&v->cpt_ct_tuple, &exp->ct_tuple);
-+ encode_tuple(&v->cpt_tuple, &exp->tuple);
-+ encode_tuple(&v->cpt_mask, &exp->mask);
-+ v->cpt_sibling_conntrack = sibling;
-+ v->cpt_seq = exp->seq;
-+ if (sizeof(v->cpt_help) != sizeof(exp->help)) {
-+ eprintk_ctx("conntrack module exp->help version mismatch\n");
-+ return -EINVAL;
-+ }
-+ memcpy(v->cpt_help, &exp->help, sizeof(v->cpt_help));
-+ v->cpt_timeout = 0;
-+ if (exp->expectant->helper->timeout)
-+ v->cpt_timeout = exp->timeout.expires - jiffies;
-+ return err;
-+}
-+
-+/* NOTE. We use one page to dump list of expectations. This may be not enough
-+ * in theory. In practice there is only one expectation per conntrack record.
-+ * Moreover, taking into account that _ALL_ of expecations are saved in one
-+ * global list, which is looked up each incoming/outpging packet, the system
-+ * would be severely dead when even one conntrack would have so much of
-+ * expectations. Shortly, I am not going to repair this.
-+ */
-+
-+static int dump_expect_list(struct ip_conntrack *ct, struct ct_holder *list,
-+ cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ unsigned long pg;
-+ struct cpt_ip_connexpect_image *v;
-+ struct ip_conntrack_expect *exp;
-+
-+ if (ct->expecting == 0)
-+ return err;
-+ if (ct->expecting*sizeof(struct cpt_ip_connexpect_image) > PAGE_SIZE)
-+ return -ENOBUFS;
-+
-+ pg = __get_free_page(GFP_KERNEL);
-+ if (!pg)
-+ return -ENOMEM;
-+ v = (struct cpt_ip_connexpect_image *)pg;
-+
-+ READ_LOCK(&ip_conntrack_lock);
-+ list_for_each_entry(exp, &ct->sibling_list, expected_list) {
-+ int sibling;
-+
-+ if (ct->helper == NULL) {
-+ eprintk_ctx("conntrack: no helper and non-trivial expectation\n");
-+ err = -EINVAL;
-+ break;
-+ }
-+
-+ if (exp->expectant != ct) {
-+ eprintk_ctx("exp->expectant != ct\n");
-+ err = -EINVAL;
-+ break;
-+ }
-+
-+ sibling = 0;
-+ if (exp->sibling) {
-+ struct ct_holder *c;
-+ for (c = list; c; c = c->next) {
-+ if (c->cth->ctrack == exp->sibling) {
-+ sibling = c->index;
-+ break;
-+ }
-+ }
-+ /* NOTE: exp->sibling could be not "confirmed" and, hence,
-+ * out of hash table. We should just ignore such a sibling,
-+ * the connection is going to be retried, the packet
-+ * apparently was lost somewhere.
-+ */
-+ if (sibling == 0)
-+ dprintk_ctx("sibling conntrack is not found\n");
-+ }
-+
-+ /* If the expectation still does not have exp->sibling
-+ * and timer is not running, it is about to die on another
-+ * cpu. Skip it. */
-+ if (!sibling &&
-+ ct->helper->timeout &&
-+ !timer_pending(&exp->timeout)) {
-+ dprintk_ctx("conntrack: expectation: no timer\n");
-+ continue;
-+ }
-+
-+ err = dump_one_expect(v, exp, sibling, ctx);
-+ if (err)
-+ break;
-+
-+ v++;
-+ }
-+ READ_UNLOCK(&ip_conntrack_lock);
-+
-+ if (err == 0 && (unsigned long)v != pg)
-+ ctx->write((void*)pg, (unsigned long)v - pg, ctx);
-+
-+ free_page(pg);
-+ return err;
-+}
-+
-+static int dump_one_ct(struct ct_holder *c, struct ct_holder *list,
-+ cpt_context_t *ctx)
-+{
-+ struct ip_conntrack_tuple_hash *h = c->cth;
-+ struct ip_conntrack *ct = h->ctrack;
-+ struct cpt_ip_conntrack_image v;
-+ int err = 0;
-+ int i;
-+
-+ if (sizeof(v.cpt_proto_data) != sizeof(ct->proto)) {
-+ eprintk_ctx("conntrack module ct->proto version mismatch\n");
-+ return -EINVAL;
-+ }
-+ if (sizeof(v.cpt_help_data) != sizeof(ct->help)) {
-+ eprintk_ctx("conntrack module ct->help version mismatch\n");
-+ return -EINVAL;
-+ }
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NET_CONNTRACK;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_ARRAY;
-+
-+ READ_LOCK(&ip_conntrack_lock);
-+ v.cpt_status = ct->status;
-+ v.cpt_timeout = ct->timeout.expires - jiffies;
-+ v.cpt_ct_helper = (ct->helper != NULL);
-+ v.cpt_index = c->index;
-+ encode_tuple(&v.cpt_tuple[0], &ct->tuplehash[0].tuple);
-+ encode_tuple(&v.cpt_tuple[1], &ct->tuplehash[1].tuple);
-+ memcpy(&v.cpt_proto_data, &ct->proto, sizeof(v.cpt_proto_data));
-+ memcpy(&v.cpt_help_data, &ct->help, sizeof(v.cpt_help_data));
-+
-+#ifdef CONFIG_IP_NF_NAT_NEEDED
-+#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
-+ defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
-+ v.cpt_masq_index = ct->nat.masq_index;
-+#endif
-+ v.cpt_nat_helper = (ct->nat.info.helper != NULL);
-+ v.cpt_initialized = ct->nat.info.initialized;
-+ v.cpt_num_manips = ct->nat.info.num_manips;
-+ v.cpt_initialized = ct->nat.info.initialized;
-+ for (i=0; i<ct->nat.info.num_manips; i++)
-+ encode_nat_manip(&v.cpt_nat_manips[i], &ct->nat.info.manips[i]);
-+ v.cpt_nat_seq[0].cpt_correction_pos = ct->nat.info.seq[0].correction_pos;
-+ v.cpt_nat_seq[0].cpt_offset_before = ct->nat.info.seq[0].offset_before;
-+ v.cpt_nat_seq[0].cpt_offset_after = ct->nat.info.seq[0].offset_after;
-+ v.cpt_nat_seq[1].cpt_correction_pos = ct->nat.info.seq[1].correction_pos;
-+ v.cpt_nat_seq[1].cpt_offset_before = ct->nat.info.seq[1].offset_before;
-+ v.cpt_nat_seq[1].cpt_offset_after = ct->nat.info.seq[1].offset_after;
-+#else
-+ v.cpt_initialized = 0;
-+ v.cpt_nat_helper = 0;
-+#endif
-+ READ_UNLOCK(&ip_conntrack_lock);
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ err = dump_expect_list(ct, list, ctx);
-+
-+ cpt_close_object(ctx);
-+ return err;
-+}
-+
-+int cpt_dump_ip_conntrack(cpt_context_t * ctx)
-+{
-+ struct ct_holder *ct_list = NULL;
-+ struct ct_holder *c, **cp;
-+ int err = 0;
-+ int index = 0;
-+ int idx;
-+
-+ if (get_exec_env()->_ip_conntrack == NULL)
-+ return 0;
-+
-+ for (idx = atomic_read(&(get_exec_env()->_ip_conntrack->_ip_conntrack_count)); idx >= 0; idx--) {
-+ c = kmalloc(sizeof(struct ct_holder), GFP_KERNEL);
-+ if (c == NULL) {
-+ err = -ENOMEM;
-+ goto done;
-+ }
-+ memset(c, 0, sizeof(struct ct_holder));
-+ c->next = ct_list;
-+ ct_list = c;
-+ }
-+
-+ c = ct_list;
-+
-+ READ_LOCK(&ip_conntrack_lock);
-+ for (idx = 0; idx < ip_conntrack_htable_size; idx++) {
-+ struct ip_conntrack_tuple_hash *h;
-+ list_for_each_entry(h, &ve_ip_conntrack_hash[idx], list) {
-+ /* Skip reply tuples, they are covered by original
-+ * direction. */
-+ if (DIRECTION(h))
-+ continue;
-+
-+ /* Oops, we have not enough of holders...
-+ * It is impossible. */
-+ if (unlikely(c == NULL)) {
-+ READ_UNLOCK(&ip_conntrack_lock);
-+ eprintk_ctx("unexpected conntrack appeared\n");
-+ err = -ENOMEM;
-+ goto done;
-+ }
-+
-+ /* If timer is not running, it means that it
-+ * has just been scheduled on another cpu.
-+ * We should skip this conntrack, it is about to be
-+ * destroyed. */
-+ if (!del_timer(&h->ctrack->timeout)) {
-+ dprintk_ctx("conntrack: no timer\n");
-+ continue;
-+ }
-+
-+ /* Timer is deleted. refcnt is _not_ decreased.
-+ * We are going to restore the timer on exit
-+ * from this function. */
-+ c->cth = h;
-+ c->index = ++index;
-+ c = c->next;
-+ }
-+ }
-+ READ_UNLOCK(&ip_conntrack_lock);
-+
-+ /* No conntracks? Good. */
-+ if (index == 0)
-+ goto done;
-+
-+ /* Comb the list a little. */
-+ cp = &ct_list;
-+ while ((c = *cp) != NULL) {
-+ /* Discard unused entries; they can appear, if some
-+ * entries were timed out since we preallocated the list.
-+ */
-+ if (c->cth == NULL) {
-+ *cp = c->next;
-+ kfree(c);
-+ continue;
-+ }
-+
-+ /* Move conntracks attached to expectations to the beginning
-+ * of the list. */
-+ if (c->cth->ctrack->master && c != ct_list) {
-+ *cp = c->next;
-+ c->next = ct_list;
-+ ct_list = c;
-+ dprintk_ctx("conntrack: %d moved in list\n", c->index);
-+ continue;
-+ }
-+ cp = &c->next;
-+ }
-+
-+ cpt_open_section(ctx, CPT_SECT_NET_CONNTRACK);
-+
-+ for (c = ct_list; c; c = c->next) {
-+ err = dump_one_ct(c, ct_list, ctx);
-+ if (err)
-+ goto done;
-+ }
-+
-+ cpt_close_section(ctx);
-+
-+done:
-+ while ((c = ct_list) != NULL) {
-+ ct_list = c->next;
-+ if (c->cth) {
-+ /* Restore timer. refcnt is preserved. */
-+ add_timer(&c->cth->ctrack->timeout);
-+ }
-+ kfree(c);
-+ }
-+ return err;
-+}
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_context.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_context.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_context.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_context.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,238 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+
-+static void file_write(const void *addr, size_t count, struct cpt_context *ctx)
-+{
-+ mm_segment_t oldfs;
-+ ssize_t err = -EBADF;
-+ struct file *file = ctx->file;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (file)
-+ err = file->f_op->write(file, addr, count, &file->f_pos);
-+ set_fs(oldfs);
-+ if (err != count && !ctx->write_error)
-+ ctx->write_error = err < 0 ? err : -EIO;
-+}
-+
-+static void file_pwrite(void *addr, size_t count, struct cpt_context *ctx, loff_t pos)
-+{
-+ mm_segment_t oldfs;
-+ ssize_t err = -EBADF;
-+ struct file *file = ctx->file;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (file)
-+ err = file->f_op->write(file, addr, count, &pos);
-+ set_fs(oldfs);
-+ if (err != count && !ctx->write_error)
-+ ctx->write_error = err < 0 ? err : -EIO;
-+}
-+
-+static void file_align(struct cpt_context *ctx)
-+{
-+ struct file *file = ctx->file;
-+
-+ if (file)
-+ file->f_pos = CPT_ALIGN(file->f_pos);
-+}
-+
-+void cpt_context_init(struct cpt_context *ctx)
-+{
-+ int i;
-+
-+ memset(ctx, 0, sizeof(*ctx));
-+
-+ init_MUTEX(&ctx->main_sem);
-+ ctx->refcount = 1;
-+
-+ ctx->current_section = -1;
-+ ctx->current_object = -1;
-+ ctx->pagesize = PAGE_SIZE;
-+ ctx->write = file_write;
-+ ctx->pwrite = file_pwrite;
-+ ctx->align = file_align;
-+ for (i=0; i < CPT_SECT_MAX; i++)
-+ ctx->sections[i] = CPT_NULL;
-+ init_completion(&ctx->pgin_notify);
-+ cpt_object_init(ctx);
-+}
-+
-+int cpt_open_dumpfile(struct cpt_context *ctx)
-+{
-+ ctx->tmpbuf = (char*)__get_free_page(GFP_KERNEL);
-+ if (ctx->tmpbuf == NULL)
-+ return -ENOMEM;
-+ __cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+int cpt_close_dumpfile(struct cpt_context *ctx)
-+{
-+ if (ctx->file) {
-+ fput(ctx->file);
-+ ctx->file = NULL;
-+ }
-+ if (ctx->tmpbuf) {
-+ free_page((unsigned long)ctx->tmpbuf);
-+ ctx->tmpbuf = NULL;
-+ }
-+ if (ctx->write_error)
-+ eprintk_ctx("error while writing dump file: %d\n", ctx->write_error);
-+ return ctx->write_error;
-+}
-+
-+int cpt_major_hdr_out(struct cpt_context *ctx)
-+{
-+ struct cpt_major_hdr hdr;
-+
-+ if (ctx->file == NULL)
-+ return 0;
-+
-+ memset(&hdr, 0, sizeof(hdr));
-+ hdr.cpt_signature[0] = CPT_SIGNATURE0;
-+ hdr.cpt_signature[1] = CPT_SIGNATURE1;
-+ hdr.cpt_signature[2] = CPT_SIGNATURE2;
-+ hdr.cpt_signature[3] = CPT_SIGNATURE3;
-+ hdr.cpt_hdrlen = sizeof(hdr);
-+ hdr.cpt_image_version = CPT_VERSION_9;
-+#ifdef CONFIG_X86_64
-+ hdr.cpt_os_arch = CPT_OS_ARCH_EMT64;
-+#else
-+ hdr.cpt_os_arch = CPT_OS_ARCH_I386;
-+#endif
-+ hdr.cpt_ve_features = (__u32)ctx->features;
-+ hdr.cpt_ve_features2 = (__u32)(ctx->features>>32);
-+ hdr.cpt_pagesize = PAGE_SIZE;
-+ hdr.cpt_hz = HZ;
-+ hdr.cpt_start_jiffies64 = ctx->virt_jiffies64;
-+ hdr.cpt_start_sec = ctx->start_time.tv_sec;
-+ hdr.cpt_start_nsec = ctx->start_time.tv_nsec;
-+ hdr.cpt_cpu_caps[0] = ctx->src_cpu_flags;
-+ hdr.cpt_kernel_config[0] = ctx->kernel_config_flags;
-+ hdr.cpt_iptables_mask = ctx->iptables_mask;
-+
-+ ctx->write(&hdr, sizeof(hdr), ctx);
-+ return 0;
-+}
-+
-+int cpt_close_section(struct cpt_context *ctx)
-+{
-+ if (ctx->file && ctx->current_section >= 0) {
-+ __u64 next = ctx->file->f_pos - ctx->current_section;
-+ ctx->pwrite(&next, 8, ctx, ctx->current_section);
-+ ctx->current_section = -1;
-+ }
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_close_section);
-+
-+int cpt_open_section(struct cpt_context *ctx, __u32 type)
-+{
-+ struct cpt_section_hdr hdr;
-+
-+ if (ctx->file == NULL)
-+ return 0;
-+
-+ cpt_close_section(ctx);
-+
-+ ctx->current_section = ctx->file->f_pos;
-+ ctx->sections[type] = ctx->current_section;
-+
-+ hdr.cpt_next = 0;
-+ hdr.cpt_section = type;
-+ hdr.cpt_hdrlen = sizeof(hdr);
-+ hdr.cpt_align = 0;
-+ ctx->write(&hdr, sizeof(hdr), ctx);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_open_section);
-+
-+
-+int cpt_close_object(struct cpt_context *ctx)
-+{
-+ if (ctx->file && ctx->current_object >= 0) {
-+ __u64 next = ctx->file->f_pos - ctx->current_object;
-+ ctx->pwrite(&next, 8, ctx, ctx->current_object);
-+ ctx->current_object = -1;
-+ }
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_close_object);
-+
-+int cpt_open_object(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ if (ctx->file == NULL)
-+ return 0;
-+
-+ cpt_close_object(ctx);
-+
-+ ctx->current_object = ctx->file->f_pos;
-+ if (obj)
-+ cpt_obj_setpos(obj, ctx->current_object, ctx);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_open_object);
-+
-+int cpt_push_object(loff_t *saved, struct cpt_context *ctx)
-+{
-+ if (ctx->file) {
-+ *saved = ctx->current_object;
-+ ctx->current_object = ctx->file->f_pos;
-+ }
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_push_object);
-+
-+int cpt_pop_object(loff_t *saved, struct cpt_context *ctx)
-+{
-+ ctx->current_object = *saved;
-+ return 0;
-+}
-+EXPORT_SYMBOL(cpt_pop_object);
-+
-+int cpt_dump_tail(struct cpt_context *ctx)
-+{
-+ struct cpt_major_tail hdr;
-+ int i;
-+
-+ if (ctx->file == NULL)
-+ return 0;
-+
-+ cpt_open_section(ctx, CPT_SECT_TRAILER);
-+ memset(&hdr, 0, sizeof(hdr));
-+ hdr.cpt_next = sizeof(hdr);
-+ hdr.cpt_object = CPT_OBJ_TRAILER;
-+ hdr.cpt_hdrlen = sizeof(hdr);
-+ hdr.cpt_content = CPT_CONTENT_VOID;
-+ hdr.cpt_lazypages = ctx->lazypages;
-+ hdr.cpt_64bit = ctx->tasks64;
-+ hdr.cpt_signature[0] = CPT_SIGNATURE0;
-+ hdr.cpt_signature[1] = CPT_SIGNATURE1;
-+ hdr.cpt_signature[2] = CPT_SIGNATURE2;
-+ hdr.cpt_signature[3] = CPT_SIGNATURE3;
-+ hdr.cpt_nsect = CPT_SECT_MAX_INDEX;
-+ for (i = 0; i < CPT_SECT_MAX_INDEX; i++)
-+ hdr.cpt_sections[i] = ctx->sections[i];
-+
-+ ctx->write(&hdr, sizeof(hdr), ctx);
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_context.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_context.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_context.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_context.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,200 @@
-+#include <linux/fs.h>
-+#include <asm/uaccess.h>
-+
-+#define CPT_CTX_ERROR -1
-+#define CPT_CTX_IDLE 0
-+#define CPT_CTX_SUSPENDING 1
-+#define CPT_CTX_SUSPENDED 2
-+#define CPT_CTX_DUMPING 3
-+#define CPT_CTX_UNDUMPING 4
-+#define CPT_CTX_UNDUMPED 5
-+
-+#define CPT_TID(tsk) (tsk)->pid, virt_pid(tsk), (tsk)->comm
-+#define CPT_FID "%d,%d(%s)"
-+
-+
-+typedef struct cpt_context
-+{
-+ struct list_head ctx_list;
-+ int refcount;
-+ int ctx_state;
-+ int objcount;
-+ int sticky;
-+ struct semaphore main_sem;
-+
-+ struct file *errorfile;
-+ struct file *statusfile;
-+ struct file *lockfile;
-+
-+ int errno;
-+ char *error_msg;
-+ loff_t err_offset;
-+
-+ struct file *file;
-+ struct file *pagein_file_in;
-+ struct file *pagein_file_out;
-+ char *tmpbuf;
-+ int pagesize;
-+
-+ int iter_done;
-+ void *iter_dir;
-+ struct user_beancounter *iter_ub;
-+
-+ loff_t current_section;
-+ loff_t current_object;
-+
-+ loff_t sections[CPT_SECT_MAX];
-+
-+ __u32 errormask;
-+ __u32 write_error;
-+
-+ struct list_head object_array[CPT_OBJ_MAX];
-+
-+ void (*write)(const void *addr, size_t count, struct cpt_context *ctx);
-+ void (*pwrite)(void *addr, size_t count, struct cpt_context *ctx, loff_t pos);
-+ ssize_t (*read)(void *addr, size_t count, struct cpt_context *ctx);
-+ ssize_t (*pread)(void *addr, size_t count, struct cpt_context *ctx, loff_t pos);
-+ void (*align)(struct cpt_context *ctx);
-+ int ve_id;
-+ int contextid;
-+ __u64 cpt_jiffies64; /* Host jiffies64 at the moment of cpt/rst,
-+ * corresponging to start_time */
-+ __u64 virt_jiffies64; /* Virtual jiffies64. It is == cpt_jiffies64 when
-+ * VE did not migrate. */
-+ struct timespec start_time;
-+ struct timespec delta_time;
-+ __s64 delta_nsec;
-+ int image_version;
-+ __u64 iptables_mask;
-+ __u64 features;
-+
-+#define CPT_ANONVMA_HBITS (sizeof(void*) == 4 ? 10 : 9)
-+#define CPT_ANONVMA_HSIZE (1<<CPT_ANONVMA_HBITS)
-+ struct hlist_head *anonvmas;
-+ int lazy_vm;
-+ int lazypages;
-+ int tasks64;
-+ int lazytype;
-+ task_t *pgin_task;
-+ unsigned long last_pagein;
-+ __u32 src_cpu_flags;
-+ __u32 dst_cpu_flags;
-+ __u32 kernel_config_flags;
-+ struct pagein_desc **pgin_dir;
-+ struct pgin_device *pagein_dev;
-+ struct completion pgin_notify;
-+ struct completion *pgind_completion;
-+ struct swap_info_struct *pgin_swp;
-+
-+ struct filejob *filejob_queue;
-+
-+ int slm_count;
-+
-+ char *vdso;
-+} cpt_context_t;
-+
-+typedef struct {
-+ int pid;
-+ cpt_context_t *ctx;
-+ struct completion done;
-+} pagein_info_t;
-+
-+int pagein_info_printf(char *buf, cpt_context_t *ctx);
-+
-+int cpt_open_dumpfile(struct cpt_context *);
-+int cpt_close_dumpfile(struct cpt_context *);
-+int rst_open_dumpfile(struct cpt_context *);
-+void rst_close_dumpfile(struct cpt_context *);
-+void cpt_context_init(struct cpt_context *);
-+void rst_context_init(struct cpt_context *);
-+void cpt_context_destroy(struct cpt_context *);
-+
-+void rst_report_error(int err, cpt_context_t *ctx);
-+
-+
-+int cpt_major_hdr_out(struct cpt_context *ctx);
-+int cpt_dump_tail(struct cpt_context *ctx);
-+int cpt_close_section(struct cpt_context *ctx);
-+int cpt_open_section(struct cpt_context *ctx, __u32 type);
-+int cpt_close_object(struct cpt_context *ctx);
-+int cpt_open_object(cpt_object_t *obj, struct cpt_context *ctx);
-+int cpt_push_object(loff_t *saved, struct cpt_context *ctx);
-+int cpt_pop_object(loff_t *saved, struct cpt_context *ctx);
-+
-+int rst_get_section(int type, struct cpt_context * ctx, loff_t *, loff_t *);
-+__u8 *__rst_get_name(loff_t *pos_p, struct cpt_context *ctx);
-+__u8 *rst_get_name(loff_t pos, struct cpt_context *ctx);
-+void rst_put_name(__u8 *name, struct cpt_context *ctx);
-+int _rst_get_object(int type, loff_t pos, void *tmp, int size, struct cpt_context *ctx);
-+void * __rst_get_object(int type, loff_t pos, struct cpt_context *ctx);
-+
-+#define rst_get_object(type, pos, tmp, ctx) \
-+ _rst_get_object((type), (pos), (tmp), sizeof(*(tmp)), (ctx))
-+
-+extern int debug_level;
-+
-+#define cpt_printk(lvl, fmt, args...) do { \
-+ if (lvl <= debug_level) \
-+ printk(fmt, ##args); \
-+ } while (0)
-+
-+#define dprintk(a...) cpt_printk(3, "CPT DBG: " a)
-+#define dprintk_ctx(f, arg...) dprintk("%p,%u: " f, ctx, ctx->ve_id, ##arg)
-+
-+#define wprintk(a...) cpt_printk(2, "CPT WRN: " a)
-+#define wprintk_ctx(f, arg...) wprintk("%p,%u: " f, ctx, ctx->ve_id, ##arg)
-+
-+#define eprintk(a...) cpt_printk(1, "CPT ERR: " a)
-+#define eprintk_ctx(f, arg...) \
-+do { \
-+ eprintk("%p,%u :" f, ctx, ctx->ve_id, ##arg); \
-+ if (ctx->error_msg && ctx->err_offset < PAGE_SIZE) \
-+ ctx->err_offset += snprintf((char*)(ctx->error_msg + \
-+ ctx->err_offset), \
-+ PAGE_SIZE - ctx->err_offset, f, ##arg); \
-+} while(0)
-+
-+#define CPT_TMPBUF_FREE 0x789adf12
-+#define CPT_TMPBUF_BUSY 0xabcd9876
-+
-+static inline void *cpt_get_buf(cpt_context_t *ctx)
-+{
-+ void *buf = ctx->tmpbuf;
-+
-+ BUG_ON(*(u32*)(buf + PAGE_SIZE - 4) != CPT_TMPBUF_FREE);
-+ *(u32*)(buf + PAGE_SIZE - 4) = CPT_TMPBUF_BUSY;
-+ return buf;
-+}
-+
-+static inline void __cpt_release_buf(cpt_context_t *ctx)
-+{
-+ void *buf = ctx->tmpbuf;
-+
-+ *(u32*)(buf + PAGE_SIZE - 4) = CPT_TMPBUF_FREE;
-+}
-+
-+static inline void cpt_release_buf(cpt_context_t *ctx)
-+{
-+ void *buf = ctx->tmpbuf;
-+
-+ BUG_ON(*(u32*)(buf + PAGE_SIZE - 4) != CPT_TMPBUF_BUSY);
-+ *(u32*)(buf + PAGE_SIZE - 4) = CPT_TMPBUF_FREE;
-+}
-+
-+static inline void cpt_flush_error(cpt_context_t *ctx)
-+{
-+ mm_segment_t oldfs;
-+
-+ if (ctx->errorfile && ctx->error_msg && ctx->err_offset) {
-+ if (ctx->errorfile->f_op && ctx->errorfile->f_op->write) {
-+ oldfs = get_fs();
-+ set_fs(KERNEL_DS);
-+ ctx->errorfile->f_op->write(ctx->errorfile,
-+ ctx->error_msg, ctx->err_offset,
-+ &ctx->errorfile->f_pos);
-+ set_fs(oldfs);
-+ }
-+ ctx->error_msg[0] = 0;
-+ ctx->err_offset = 0;
-+ }
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_dump.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_dump.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_dump.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_dump.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1056 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/ptrace.h>
-+#include <linux/smp_lock.h>
-+#include <linux/ve.h>
-+#include <linux/virtinfo.h>
-+#include <linux/virtinfoscp.h>
-+#include <ub/ub_task.h>
-+#include <linux/cpt_image.h>
-+#include <linux/namespace.h>
-+#include <linux/netdevice.h>
-+#include <linux/nfcalls.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_dump.h"
-+#include "cpt_files.h"
-+#include "cpt_mm.h"
-+#include "cpt_process.h"
-+#include "cpt_net.h"
-+#include "cpt_socket.h"
-+#include "cpt_ubc.h"
-+#include "cpt_kernel.h"
-+
-+
-+static int vps_child_level(task_t *root, task_t *c)
-+{
-+ int level = 0;
-+ int veid = VE_TASK_INFO(c)->owner_env->veid;
-+
-+ while (VE_TASK_INFO(c)->owner_env->veid == veid) {
-+ if (c->pid != c->tgid)
-+ c = c->group_leader;
-+ if (c == root)
-+ return level;
-+
-+ c = c->real_parent;
-+ level++;
-+ }
-+ return -1;
-+}
-+
-+static inline int freezable(struct task_struct * p)
-+{
-+ if (p->exit_state)
-+ return 0;
-+
-+ switch (p->state) {
-+ case EXIT_ZOMBIE:
-+ case EXIT_DEAD:
-+ case TASK_STOPPED:
-+#if TASK_TRACED != TASK_STOPPED
-+ case TASK_TRACED:
-+#endif
-+ return 0;
-+ default:
-+ return 1;
-+ }
-+}
-+
-+static void wake_ve(cpt_context_t *ctx)
-+{
-+ task_t *p, *g;
-+
-+ do_each_thread_ve(g, p) {
-+ spin_lock_irq(&p->sighand->siglock);
-+ if (p->flags & PF_FROZEN) {
-+ p->flags &= ~PF_FROZEN;
-+ wake_up_process(p);
-+ }
-+ spin_unlock_irq(&p->sighand->siglock);
-+ } while_each_thread_ve(g, p);
-+}
-+
-+/*
-+ * Some comment is necessary about PF_FREEZE,PF_FROZEN,TIF_FREEZE...
-+ *
-+ * SWSUSP uses PF_FREEZE flag in tsk->flags raising it in context
-+ * of another process. Apparently, it is unacceptable on SMP.
-+ * Let's take freeze_processes() in kernel/power/process.c as an example.
-+ * Unserialized modifications tsk->flags easily
-+ * (believe or not, but it happens with probability of almost 100% :-))
-+ * creates the situation when setting PF_FREEZE in freeze_processes(),
-+ * which quickly spins raising PF_FREEZE of all the processes,
-+ * _clears_ PF_FROZEN just set in refrigerator(), so that suspend deadlocks.
-+ *
-+ * So, to make things clean, we require that those flags may be modified
-+ * only under tsk->sighand->siglock, which is quite natural because PF_FREEZE
-+ * is just a kind of signal.
-+ *
-+ * It is not enough, because we are still not allowed to change tsk->flags
-+ * in context of another process, we can corrupt another flags, when the process
-+ * running on another cpu modifies them. So, we use TIF_FREEZE in thread flags,
-+ * which can be changed atomically.
-+ *
-+ * PF_FROZEN also changes in context of another process, but this happens
-+ * only when the process is already in refrigerator() which does not modify
-+ * tsk->flags.
-+ */
-+
-+static int vps_stop_tasks(struct cpt_context *ctx)
-+{
-+ unsigned long start_time = jiffies;
-+ task_t *p, *g;
-+ int todo;
-+ int round = 0;
-+
-+ do_gettimespec(&ctx->start_time);
-+ ctx->cpt_jiffies64 = get_jiffies_64();
-+ ctx->virt_jiffies64 = ctx->cpt_jiffies64 + get_exec_env()->jiffies_fixup;
-+
-+ read_lock(&tasklist_lock);
-+
-+ atomic_inc(&get_exec_env()->suspend);
-+
-+ for(;;) {
-+ task_t *root;
-+ todo = 0;
-+
-+ root = find_task_by_pid_ve(1);
-+ if (!root) {
-+ read_unlock(&tasklist_lock);
-+ eprintk_ctx("cannot find ve init\n");
-+ atomic_dec(&get_exec_env()->suspend);
-+ return -ESRCH;
-+ }
-+
-+ do_each_thread_ve(g, p) {
-+ if (vps_child_level(root, p) >= 0) {
-+ if (!is_virtual_pid(virt_pid(p))) {
-+ eprintk_ctx("external process %d/%d(%s) inside VPS (e.g. vzctl enter or vzctl exec).\n", virt_pid(p), p->pid, p->comm);
-+ todo = -1;
-+ goto out;
-+ }
-+ if (task_aux(p)->vfork_done) {
-+ /* Task between vfork()...exec()
-+ * cannot be frozen, because parent
-+ * wait in uninterruptible state.
-+ * So, we do nothing, waiting for
-+ * exec(), unless:
-+ */
-+ if (p->state == TASK_STOPPED ||
-+ p->state == TASK_TRACED) {
-+ eprintk_ctx("task %d/%d(%s) is stopped while vfork(). Checkpointing is impossible.\n", virt_pid(p), p->pid, p->comm);
-+ todo = -1;
-+ /* It is fatal, _user_ stopped
-+ * vfork()ing task, so that we
-+ * cannot suspend now.
-+ */
-+ } else {
-+ todo = -3;
-+ }
-+ goto out;
-+ }
-+ if (p->state == TASK_TRACED
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-+ && !p->stopped_state
-+#endif
-+ ) {
-+ int ptrace_id = p->pn_state;
-+ /* Debugger waits for signal. */
-+ switch (ptrace_id) {
-+ case PN_STOP_TF:
-+ case PN_STOP_TF_RT:
-+ case PN_STOP_ENTRY:
-+ case PN_STOP_FORK:
-+ case PN_STOP_VFORK:
-+ case PN_STOP_SIGNAL:
-+ case PN_STOP_EXIT:
-+ case PN_STOP_LEAVE:
-+ break;
-+ default:
-+ eprintk_ctx("task %d/%d(%s) is stopped by debugger while %d.\n", virt_pid(p), p->pid, p->comm, ptrace_id);
-+ todo = -1;
-+ goto out;
-+ }
-+ }
-+ if (p->flags & PF_NOFREEZE) {
-+ todo = -1;
-+ goto out;
-+ }
-+
-+ if (!freezable(p))
-+ continue;
-+
-+ spin_lock_irq(&p->sighand->siglock);
-+ if (!(p->flags & PF_FROZEN)) {
-+ set_tsk_thread_flag(p, TIF_FREEZE);
-+ signal_wake_up(p, 0);
-+ }
-+ spin_unlock_irq(&p->sighand->siglock);
-+
-+ if (p->flags & PF_FROZEN) {
-+ if (p->state != TASK_UNINTERRUPTIBLE)
-+ printk("BUG: Holy Crap 1 %ld " CPT_FID "\n", p->state, CPT_TID(p));
-+ continue;
-+ }
-+
-+ if (round == 10)
-+ wprintk_ctx("%d/%d(%s) is running\n", virt_pid(p), p->pid, p->comm);
-+
-+ todo++;
-+ } else {
-+ if (p != current) {
-+ eprintk_ctx("foreign process %d/%d(%s) inside VPS (e.g. vzctl enter or vzctl exec).\n", virt_pid(p), p->pid, p->comm);
-+ todo = -1;
-+ goto out;
-+ }
-+ }
-+ } while_each_thread_ve(g, p);
-+
-+out:
-+ if (todo &&
-+ (time_after(jiffies, start_time + 10*HZ) ||
-+ signal_pending(current) || todo < 0)) {
-+ atomic_dec(&get_exec_env()->suspend);
-+ wake_ve(ctx);
-+ if (todo > 0)
-+ todo = -2;
-+#if 0
-+ /* This is sign of failure of printk(), which is not
-+ * ours. So, no prefixes. */
-+ printk(">\n");
-+#endif
-+ }
-+
-+ read_unlock(&tasklist_lock);
-+
-+ if (!todo) {
-+ atomic_dec(&get_exec_env()->suspend);
-+ return 0;
-+ }
-+
-+ if (todo == -1) {
-+ eprintk_ctx("suspend is impossible now.\n");
-+ return -EAGAIN;
-+ }
-+
-+ if (todo == -2) {
-+ eprintk_ctx("interrupted or timed out.\n");
-+ return -EINTR;
-+ }
-+
-+ if (todo == -3) {
-+ if (time_after(jiffies, start_time + 10*HZ) ||
-+ signal_pending(current)) {
-+ eprintk_ctx("vfork() is active, suspend is impossible now.\n");
-+ return -EAGAIN;
-+ }
-+ }
-+
-+ if (todo < 0)
-+ atomic_inc(&get_exec_env()->suspend);
-+
-+ if (todo < 0 || round > 0) {
-+ current->state = TASK_INTERRUPTIBLE;
-+ schedule_timeout(HZ/50);
-+ } else {
-+ yield();
-+ }
-+
-+ read_lock(&tasklist_lock);
-+ round++;
-+ }
-+}
-+
-+static int cpt_unlock_ve(struct cpt_context *ctx)
-+{
-+ struct ve_struct *env;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+ down_write(&env->op_sem);
-+ env->is_locked = 0;
-+ up_write(&env->op_sem);
-+ put_ve(env);
-+ return 0;
-+}
-+
-+int cpt_resume(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ virtinfo_notifier_call(VITYPE_SCP, VIRTINFO_SCP_DMPFIN, ctx);
-+
-+ cpt_unlock_sockets(ctx);
-+
-+ if (ctx->pgin_task) {
-+ wait_for_completion(&ctx->pgin_notify);
-+ put_task_struct(ctx->pgin_task);
-+ ctx->pgin_task = NULL;
-+ }
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+
-+ if (tsk->exit_state) {
-+ put_task_struct(tsk);
-+ continue;
-+ }
-+
-+ spin_lock_irq(&tsk->sighand->siglock);
-+ if (tsk->flags & PF_FROZEN) {
-+ tsk->flags &= ~PF_FROZEN;
-+ wake_up_process(tsk);
-+ } else if (freezable(tsk)) {
-+ eprintk_ctx("strange, %s not frozen\n", tsk->comm );
-+ }
-+ spin_unlock_irq(&tsk->sighand->siglock);
-+ put_task_struct(tsk);
-+ }
-+
-+ cpt_resume_network(ctx);
-+
-+ cpt_unlock_ve(ctx);
-+
-+ cpt_finish_ubc(ctx);
-+ cpt_object_destroy(ctx);
-+ return 0;
-+}
-+
-+int cpt_kill(struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct ve_struct *env;
-+ cpt_object_t *obj;
-+ task_t *root_task = NULL;
-+ long delay;
-+
-+ if (!ctx->ve_id)
-+ return -EINVAL;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+
-+ /* from here cpt_kill succeeds */
-+ virtinfo_notifier_call(VITYPE_SCP, VIRTINFO_SCP_DMPFIN, ctx);
-+
-+ if (VE_TASK_INFO(current)->owner_env == env) {
-+ wprintk_ctx("attempt to kill ve from inside, escaping...\n");
-+
-+ write_lock_irq(&tasklist_lock);
-+ VE_TASK_INFO(current)->owner_env = get_ve0();
-+ REMOVE_VE_LINKS(current);
-+ SET_VE_LINKS(current);
-+
-+ atomic_inc(&get_ve0()->pcounter);
-+ atomic_dec(&env->pcounter);
-+ write_unlock_irq(&tasklist_lock);
-+ set_exec_env(get_ve0());
-+ }
-+
-+ if (ctx->pgin_task) {
-+ wait_for_completion(&ctx->pgin_notify);
-+ put_task_struct(ctx->pgin_task);
-+ ctx->pgin_task = NULL;
-+ }
-+
-+ cpt_kill_sockets(ctx);
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+
-+ if (tsk->exit_state) {
-+ put_task_struct(tsk);
-+ continue;
-+ }
-+
-+#ifndef CONFIG_X86_64
-+ /* Write bogus value into eip, the task must not reach it,
-+ * this can happen only as result of a bug in signal delivery.
-+ */
-+ task_pt_regs(tsk)->eip = 0x1234;
-+#endif
-+
-+ if (virt_pid(tsk) == 1) {
-+ root_task = tsk;
-+ continue;
-+ }
-+
-+ if (tsk->ptrace) {
-+ write_lock_irq(&tasklist_lock);
-+ tsk->ptrace = 0;
-+ if (!list_empty(&tsk->ptrace_list)) {
-+ list_del_init(&tsk->ptrace_list);
-+ REMOVE_LINKS(tsk);
-+ tsk->parent = tsk->real_parent;
-+ SET_LINKS(tsk);
-+ }
-+ write_unlock_irq(&tasklist_lock);
-+ }
-+
-+ send_sig(SIGKILL, tsk, 1);
-+
-+ spin_lock_irq(&tsk->sighand->siglock);
-+ sigfillset(&tsk->blocked);
-+ sigdelsetmask(&tsk->blocked, sigmask(SIGKILL));
-+ set_tsk_thread_flag(tsk, TIF_SIGPENDING);
-+ if (tsk->flags & PF_FROZEN)
-+ tsk->flags &= ~PF_FROZEN;
-+ spin_unlock_irq(&tsk->sighand->siglock);
-+
-+ wake_up_process(tsk);
-+ put_task_struct(tsk);
-+ }
-+
-+ yield();
-+
-+ if (root_task != NULL) {
-+ send_sig(SIGKILL, root_task, 1);
-+
-+ spin_lock_irq(&root_task->sighand->siglock);
-+ sigfillset(&root_task->blocked);
-+ sigdelsetmask(&root_task->blocked, sigmask(SIGKILL));
-+ set_tsk_thread_flag(root_task, TIF_SIGPENDING);
-+ if (root_task->flags & PF_FROZEN)
-+ root_task->flags &= ~PF_FROZEN;
-+ spin_unlock_irq(&root_task->sighand->siglock);
-+
-+ wake_up_process(root_task);
-+ put_task_struct(root_task);
-+ }
-+
-+ cpt_finish_ubc(ctx);
-+ cpt_object_destroy(ctx);
-+
-+ delay = 1;
-+ while (atomic_read(&env->counter) != 1) {
-+ if (signal_pending(current))
-+ break;
-+ current->state = TASK_INTERRUPTIBLE;
-+ delay = (delay < HZ) ? (delay << 1) : HZ;
-+ schedule_timeout(delay);
-+ }
-+ put_ve(env);
-+
-+ return err;
-+}
-+
-+static void collect_task_ubc(task_t *t, struct cpt_context *ctx)
-+{
-+ struct task_beancounter *tbc;
-+
-+ tbc = task_bc(t);
-+ cpt_add_ubc(tbc->exec_ub, ctx);
-+ cpt_add_ubc(tbc->task_ub, ctx);
-+ cpt_add_ubc(tbc->fork_sub, ctx);
-+}
-+
-+static cpt_object_t * remember_task(task_t * child, cpt_object_t * head,
-+ cpt_context_t * ctx)
-+{
-+ cpt_object_t *cobj;
-+
-+ if (freezable(child) && !(child->flags&PF_FROZEN)) {
-+ eprintk_ctx("process " CPT_FID " is not frozen\n", CPT_TID(child));
-+ put_task_struct(child);
-+ return NULL;
-+ }
-+
-+ if (lookup_cpt_object(CPT_OBJ_TASK, child, ctx)) BUG();
-+ if ((cobj = alloc_cpt_object(GFP_KERNEL, ctx)) == NULL) {
-+ put_task_struct(child);
-+ return NULL;
-+ }
-+ cobj->o_count = 1;
-+ cpt_obj_setobj(cobj, child, ctx);
-+ insert_cpt_object(CPT_OBJ_TASK, cobj, head, ctx);
-+ collect_task_ubc(child, ctx);
-+ return cobj;
-+}
-+
-+static int vps_collect_tasks(struct cpt_context *ctx)
-+{
-+ int err = -ESRCH;
-+ cpt_object_t *obj;
-+ task_t *root;
-+
-+ read_lock(&tasklist_lock);
-+ root = find_task_by_pid_ve(1);
-+ if (root)
-+ get_task_struct(root);
-+ read_unlock(&tasklist_lock);
-+
-+ if (!root) {
-+ err = -ESRCH;
-+ eprintk_ctx("vps_collect_tasks: cannot find root\n");
-+ goto out;
-+ }
-+
-+ if ((obj = alloc_cpt_object(GFP_KERNEL, ctx)) == NULL) {
-+ put_task_struct(root);
-+ return -ENOMEM;
-+ }
-+ obj->o_count = 1;
-+ cpt_obj_setobj(obj, root, ctx);
-+ intern_cpt_object(CPT_OBJ_TASK, obj, ctx);
-+ collect_task_ubc(root, ctx);
-+
-+ /* Collect process subtree recursively */
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ cpt_object_t *head = obj;
-+ task_t *tsk = obj->o_obj;
-+ task_t *child;
-+
-+ if (freezable(tsk) && !(tsk->flags&PF_FROZEN)) {
-+ eprintk_ctx("process " CPT_FID " is not frozen\n", CPT_TID(tsk));
-+ err = -EINVAL;
-+ goto out;
-+ }
-+
-+ if (tsk->state == TASK_RUNNING)
-+ printk("BUG: Holy Crap 2 %ld " CPT_FID "\n", tsk->state, CPT_TID(tsk));
-+
-+ wait_task_inactive(tsk);
-+
-+ err = check_task_state(tsk, ctx);
-+ if (err)
-+ goto out;
-+
-+ if (tsk->pid == tsk->tgid) {
-+ child = tsk;
-+ for (;;) {
-+ read_lock(&tasklist_lock);
-+ child = next_thread(child);
-+ if (child != tsk)
-+ get_task_struct(child);
-+ read_unlock(&tasklist_lock);
-+
-+ if (child == tsk)
-+ break;
-+
-+ if (child->real_parent != tsk->real_parent) {
-+ put_task_struct(child);
-+ eprintk_ctx("illegal thread structure, kernel bug\n");
-+ err = -EINVAL;
-+ goto out;
-+ }
-+
-+ if ((head = remember_task(child, head, ctx)) == NULL) {
-+ eprintk_ctx("task obj allocation failure\n");
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+ }
-+ }
-+
-+ /* About locking. VE is frozen. But lists of children
-+ * may change at least for init, when entered task reparents
-+ * to init and when reparented task exits. If we take care
-+ * of this case, we still can unlock while scanning
-+ * tasklists.
-+ */
-+ read_lock(&tasklist_lock);
-+ list_for_each_entry(child, &tsk->children, sibling) {
-+ if (child->real_parent != tsk)
-+ continue;
-+ if (child->pid != child->tgid)
-+ continue;
-+ get_task_struct(child);
-+ read_unlock(&tasklist_lock);
-+
-+ if ((head = remember_task(child, head, ctx)) == NULL) {
-+ eprintk_ctx("task obj allocation failure\n");
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+
-+ read_lock(&tasklist_lock);
-+ }
-+
-+ list_for_each_entry(child, &tsk->ptrace_children, ptrace_list) {
-+ if (child->real_parent != tsk)
-+ continue;
-+ if (child->pid != child->tgid)
-+ continue;
-+ get_task_struct(child);
-+ read_unlock(&tasklist_lock);
-+
-+ if ((head = remember_task(child, head, ctx)) == NULL) {
-+ eprintk_ctx("task obj allocation failure\n");
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+
-+ read_lock(&tasklist_lock);
-+ }
-+ read_unlock(&tasklist_lock);
-+ }
-+
-+ return 0;
-+
-+out:
-+ while (!list_empty(&ctx->object_array[CPT_OBJ_TASK])) {
-+ struct list_head *head = ctx->object_array[CPT_OBJ_TASK].next;
-+ cpt_object_t *obj = list_entry(head, cpt_object_t, o_list);
-+ task_t *tsk;
-+
-+ list_del(head);
-+ tsk = obj->o_obj;
-+ put_task_struct(tsk);
-+ free_cpt_object(obj, ctx);
-+ }
-+ return err;
-+}
-+
-+static int cpt_collect(struct cpt_context *ctx)
-+{
-+ int err;
-+
-+ if ((err = cpt_collect_mm(ctx)) != 0)
-+ return err;
-+
-+ if ((err = cpt_collect_sysv(ctx)) != 0)
-+ return err;
-+
-+ if ((err = cpt_collect_files(ctx)) != 0)
-+ return err;
-+
-+ if ((err = cpt_collect_fs(ctx)) != 0)
-+ return err;
-+
-+ if ((err = cpt_collect_namespace(ctx)) != 0)
-+ return err;
-+
-+ if ((err = cpt_collect_signals(ctx)) != 0)
-+ return err;
-+
-+ if (virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_COLLECT, ctx) & NOTIFY_FAIL)
-+ return -ECHRNG;
-+
-+ return 0;
-+}
-+
-+static int cpt_dump_veinfo(cpt_context_t *ctx)
-+{
-+ struct cpt_veinfo_image i;
-+ struct ve_struct *ve;
-+ struct timespec delta;
-+
-+ cpt_open_section(ctx, CPT_SECT_VEINFO);
-+ cpt_open_object(NULL, ctx);
-+
-+ i.cpt_next = CPT_NULL;
-+ i.cpt_object = CPT_OBJ_VEINFO;
-+ i.cpt_hdrlen = sizeof(i);
-+ i.cpt_content = CPT_CONTENT_VOID;
-+
-+ ve = get_exec_env();
-+ i.shm_ctl_all = ve->_shm_ctlall;
-+ i.shm_ctl_max = ve->_shm_ctlmax;
-+ i.shm_ctl_mni = ve->_shm_ctlmni;
-+
-+ i.msg_ctl_max = ve->_msg_ctlmax;
-+ i.msg_ctl_mni = ve->_msg_ctlmni;
-+ i.msg_ctl_mnb = ve->_msg_ctlmnb;
-+
-+ BUG_ON(sizeof(ve->_sem_ctls) != sizeof(i.sem_ctl_arr));
-+ i.sem_ctl_arr[0] = ve->_sem_ctls[0];
-+ i.sem_ctl_arr[1] = ve->_sem_ctls[1];
-+ i.sem_ctl_arr[2] = ve->_sem_ctls[2];
-+ i.sem_ctl_arr[3] = ve->_sem_ctls[3];
-+
-+ do_posix_clock_monotonic_gettime(&delta);
-+ set_normalized_timespec(&delta,
-+ delta.tv_sec - ve->start_timespec.tv_sec,
-+ delta.tv_nsec - ve->start_timespec.tv_nsec);
-+ i.start_timespec_delta = cpt_timespec_export(&delta);
-+ i.start_jiffies_delta = get_jiffies_64() - ve->start_jiffies;
-+
-+ ctx->write(&i, sizeof(i), ctx);
-+ cpt_close_object(ctx);
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int cpt_dump_utsname(cpt_context_t *ctx)
-+{
-+ int len;
-+ struct cpt_object_hdr o;
-+
-+ cpt_open_section(ctx, CPT_SECT_UTSNAME);
-+
-+ len = strlen(ve_utsname.nodename);
-+ o.cpt_next = sizeof(o) + CPT_ALIGN(len + 1);
-+ o.cpt_object = CPT_OBJ_NAME;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_NAME;
-+
-+ ctx->write(&o, sizeof(o), ctx);
-+ ctx->write(ve_utsname.nodename, len+1, ctx);
-+ ctx->align(ctx);
-+
-+ len = strlen(ve_utsname.domainname);
-+ o.cpt_next = sizeof(o) + CPT_ALIGN(len + 1);
-+ o.cpt_object = CPT_OBJ_NAME;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_NAME;
-+
-+ ctx->write(&o, sizeof(o), ctx);
-+ ctx->write(ve_utsname.domainname, len+1, ctx);
-+ ctx->align(ctx);
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int cpt_dump_vsyscall(cpt_context_t *ctx)
-+{
-+ struct cpt_page_block *pgb = cpt_get_buf(ctx);
-+
-+ cpt_open_section(ctx, CPT_SECT_VSYSCALL);
-+ cpt_open_object(NULL, ctx);
-+
-+ pgb->cpt_next = CPT_NULL;
-+ pgb->cpt_object = CPT_OBJ_VSYSCALL;
-+ pgb->cpt_hdrlen = sizeof(*pgb);
-+ pgb->cpt_content = CPT_CONTENT_DATA;
-+ pgb->cpt_start = cpt_ptr_export(vsyscall_addr);
-+ pgb->cpt_end = pgb->cpt_start + PAGE_SIZE;
-+
-+ ctx->write(pgb, sizeof(*pgb), ctx);
-+ cpt_release_buf(ctx);
-+
-+ ctx->write(vsyscall_addr, PAGE_SIZE, ctx);
-+
-+ cpt_close_object(ctx);
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+int cpt_dump(struct cpt_context *ctx)
-+{
-+ struct ve_struct *oldenv, *env;
-+ int err, err2 = 0;
-+
-+ if (!ctx->ve_id)
-+ return -EINVAL;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+
-+ down_read(&env->op_sem);
-+ err = -ESRCH;
-+ if (!env->is_running)
-+ goto out_noenv;
-+ if (!env->is_locked)
-+ goto out_noenv;
-+
-+ oldenv = set_exec_env(env);
-+
-+ /* Phase 2: real checkpointing */
-+ err = cpt_open_dumpfile(ctx);
-+ if (err)
-+ goto out;
-+
-+ cpt_major_hdr_out(ctx);
-+
-+ if (!err)
-+ err = cpt_dump_veinfo(ctx);
-+ if (!err)
-+ err = cpt_dump_ubc(ctx);
-+ if (!err)
-+ err = cpt_dump_ifinfo(ctx);
-+ if (!err)
-+ err = cpt_dump_files(ctx);
-+ if (!err)
-+ err = cpt_dump_files_struct(ctx);
-+ if (!err)
-+ err = cpt_dump_fs_struct(ctx);
-+ if (!err)
-+ err = cpt_dump_namespace(ctx);
-+ if (!err)
-+ err = cpt_dump_sighand(ctx);
-+ if (!err)
-+ err = cpt_dump_vm(ctx);
-+ if (!err)
-+ err = cpt_dump_sysvsem(ctx);
-+ if (!err)
-+ err = cpt_dump_tasks(ctx);
-+ if (!err)
-+ err = cpt_dump_orphaned_sockets(ctx);
-+#if defined(CONFIG_VE_IPTABLES) && \
-+ (defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE))
-+ if (!err)
-+ err = cpt_dump_ip_conntrack(ctx);
-+#endif
-+ if (!err) {
-+ if (virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_DUMP, ctx) & NOTIFY_FAIL)
-+ err = -ECHRNG;
-+ }
-+ if (!err)
-+ err = cpt_dump_utsname(ctx);
-+
-+ if (!err)
-+ err = cpt_dump_vsyscall(ctx);
-+
-+ if (!err)
-+ err = cpt_dump_tail(ctx);
-+
-+ err2 = cpt_close_dumpfile(ctx);
-+
-+out:
-+ set_exec_env(oldenv);
-+out_noenv:
-+ up_read(&env->op_sem);
-+ put_ve(env);
-+ return err ? : err2;
-+}
-+
-+int cpt_vps_suspend(struct cpt_context *ctx)
-+{
-+ struct ve_struct *oldenv, *env;
-+ int err = 0;
-+
-+ ctx->kernel_config_flags = test_kernel_config();
-+ cpt_object_init(ctx);
-+
-+ if (!ctx->ve_id) {
-+ env = get_exec_env();
-+ if (env == get_ve0())
-+ return -EINVAL;
-+ wprintk("undefined ve_id\n");
-+ ctx->ve_id = env->veid;
-+ get_ve(env);
-+ } else {
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+ }
-+
-+ ctx->iptables_mask = env->_iptables_modules;
-+ ctx->features = env->features;
-+
-+ down_write(&env->op_sem);
-+ err = -ESRCH;
-+ if (!env->is_running)
-+ goto out_noenv;
-+
-+ err = -EBUSY;
-+ if (env->is_locked)
-+ goto out_noenv;
-+ env->is_locked = 1;
-+ downgrade_write(&env->op_sem);
-+
-+ oldenv = set_exec_env(env);
-+
-+ /* Phase 0: find and stop all the tasks */
-+ if ((err = vps_stop_tasks(ctx)) != 0)
-+ goto out;
-+
-+ if ((err = cpt_suspend_network(ctx)) != 0)
-+ goto out_wake;
-+
-+ /* At the moment all the state is frozen. We do not need to lock
-+ * the state, which can be changed only if the tasks are running.
-+ */
-+
-+ /* Phase 1: collect task tree */
-+ if ((err = vps_collect_tasks(ctx)) != 0)
-+ goto out_wake;
-+
-+ /* Phase 1': collect all the resources */
-+ if ((err = cpt_collect(ctx)) != 0)
-+ goto out;
-+
-+out:
-+ set_exec_env(oldenv);
-+ up_read(&env->op_sem);
-+ put_ve(env);
-+ return err;
-+
-+out_noenv:
-+ up_write(&env->op_sem);
-+ put_ve(env);
-+ return err;
-+
-+out_wake:
-+ read_lock(&tasklist_lock);
-+ wake_ve(ctx);
-+ read_unlock(&tasklist_lock);
-+ goto out;
-+}
-+
-+static void check_unsupported_netdevices(struct cpt_context *ctx, __u32 *caps)
-+{
-+ struct net_device *dev;
-+
-+ read_lock(&dev_base_lock);
-+ for (dev = dev_base; dev; dev = dev->next) {
-+ if (dev != get_exec_env()->_loopback_dev &&
-+#if defined(CONFIG_VE_ETHDEV) || defined(CONFIG_VE_ETHDEV_MODULE)
-+ dev->open != vz_veth_open &&
-+#endif
-+ dev != get_exec_env()->_venet_dev) {
-+ eprintk_ctx("unsupported netdevice %s\n", dev->name);
-+ *caps |= (1<<CPT_UNSUPPORTED_NETDEV);
-+ }
-+ }
-+ read_unlock(&dev_base_lock);
-+}
-+
-+static void check_one_process(struct cpt_context *ctx, __u32 *caps,
-+ unsigned int flags, struct ve_struct *env,
-+ task_t *root, task_t *p)
-+{
-+ if (p->used_math)
-+ *caps |= flags;
-+#ifdef CONFIG_X86_64
-+ if (!(p->thread_info->flags & _TIF_IA32))
-+ *caps |= ((1<<CPT_CPU_X86_EMT64)|(1<<CPT_CPU_X86_SYSCALL));
-+ else if (p->mm && p->mm->context.vdso) {
-+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-+ *caps |= (1<<CPT_CPU_X86_SEP32);
-+ else
-+ *caps |= (1<<CPT_CPU_X86_SYSCALL32);
-+ }
-+#else
-+ if (p->mm && p->mm->context.vdso)
-+ *caps |= (1<<CPT_CPU_X86_SEP);
-+#endif
-+ if (vps_child_level(root, p) >= 0) {
-+ if (!is_virtual_pid(virt_pid(p))) {
-+ eprintk_ctx("external process %d/%d(%s) inside VE (e.g. vzctl enter or vzctl exec).\n", virt_pid(p), p->pid, p->comm);
-+ *caps |= (1<<CPT_EXTERNAL_PROCESS);
-+ }
-+ } else {
-+ eprintk_ctx("foreign process %d/%d(%s) inside VE (e.g. vzctl enter or vzctl exec).\n", virt_pid(p), p->pid, p->comm);
-+ *caps |= (1<<CPT_EXTERNAL_PROCESS);
-+ }
-+ if (p->namespace && p->namespace != current->namespace) {
-+ eprintk_ctx("namespaces are not supported: process %d/%d(%s)\n", virt_pid(p), p->pid, p->comm);
-+ *caps |= (1<<CPT_NAMESPACES);
-+ }
-+ if (p->policy != SCHED_NORMAL) {
-+ eprintk_ctx("scheduler policy is not supported %d/%d(%s)\n", virt_pid(p), p->pid, p->comm);
-+ *caps |= (1<<CPT_SCHEDULER_POLICY);
-+ }
-+ if (p->parent) {
-+ if (p->parent != p->real_parent &&
-+ VE_TASK_INFO(p->parent)->owner_env != env) {
-+ eprintk_ctx("task %d/%d(%s) is ptraced from VE0\n", p->pid, virt_pid(p), p->comm);
-+ *caps |= (1<<CPT_PTRACED_FROM_VE0);
-+ }
-+ }
-+}
-+
-+static void check_unsupported_mounts(struct cpt_context *ctx, __u32 *caps,
-+ struct ve_struct *env, struct namespace *n, char *path_buf)
-+{
-+ struct list_head *p;
-+ char *path;
-+
-+ down_read(&n->sem);
-+ list_for_each(p, &n->list) {
-+ struct vfsmount *mnt = list_entry(p, struct vfsmount, mnt_list);
-+
-+ path = __d_path(mnt->mnt_root, mnt,
-+ env->fs_root, env->fs_rootmnt,
-+ path_buf, PAGE_SIZE);
-+ if (IS_ERR(path))
-+ continue;
-+
-+ if (check_one_vfsmount(mnt)) {
-+ eprintk_ctx("Unsupported filesystem %s\n", mnt->mnt_sb->s_type->name);
-+ *caps |= (1<<CPT_UNSUPPORTED_FSTYPE);
-+ }
-+ }
-+ up_read(&n->sem);
-+}
-+
-+int cpt_vps_caps(struct cpt_context *ctx, __u32 *caps)
-+{
-+ task_t *p;
-+ task_t *root;
-+ struct ve_struct *env;
-+ struct ve_struct *old_env;
-+ struct namespace *n;
-+ int err;
-+ unsigned int flags = test_cpu_caps();
-+
-+ if (!ctx->ve_id)
-+ return -EINVAL;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (env == NULL)
-+ return -ESRCH;
-+
-+ *caps = flags & (1<<CPT_CPU_X86_CMOV);
-+ flags &= ~((1<<CPT_CPU_X86_EMT64)|(1<<CPT_CPU_X86_IA64));
-+ flags &= ~((1<<CPT_CPU_X86_SYSCALL32)|(1<<CPT_CPU_X86_SEP32));
-+ flags &= ~((1<<CPT_CPU_X86_SYSCALL)|(1<<CPT_CPU_X86_SEP));
-+
-+ old_env = set_exec_env(env);
-+
-+ check_unsupported_netdevices(ctx, caps);
-+
-+ read_lock(&tasklist_lock);
-+ root = find_task_by_pid_ve(1);
-+ if (!root) {
-+ read_unlock(&tasklist_lock);
-+ eprintk_ctx("cannot find ve init\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+ get_task_struct(root);
-+ for (p = __first_task_ve(env); p != NULL ; p = __next_task_ve(env, p))
-+ check_one_process(ctx, caps, flags, env, root, p);
-+ read_unlock(&tasklist_lock);
-+
-+ task_lock(root);
-+ n = root->namespace;
-+ if (n)
-+ get_namespace(n);
-+ task_unlock(root);
-+
-+ if (n) {
-+ char *path_buf;
-+
-+ path_buf = (char *) __get_free_page(GFP_KERNEL);
-+ if (!path_buf) {
-+ put_namespace(n);
-+ err = -ENOMEM;
-+ goto out_root;
-+ }
-+
-+ check_unsupported_mounts(ctx, caps, env, n, path_buf);
-+
-+ free_page((unsigned long) path_buf);
-+ put_namespace(n);
-+ }
-+
-+ err = 0;
-+
-+out_root:
-+ put_task_struct(root);
-+out:
-+ set_exec_env(old_env);
-+ put_ve(env);
-+
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_dump.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_dump.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_dump.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_dump.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,14 @@
-+int cpt_dump(struct cpt_context *cpt);
-+int rst_undump(struct cpt_context *cpt);
-+int cpt_suspend(struct cpt_context *cpt);
-+int cpt_resume(struct cpt_context *cpt);
-+int cpt_kill(struct cpt_context *cpt);
-+int rst_clean(struct cpt_context *cpt);
-+int rst_resume(struct cpt_context *cpt);
-+int rst_kill(struct cpt_context *cpt);
-+
-+int cpt_freeze_one(pid_t pid, int freeze);
-+int cpt_vps_suspend(struct cpt_context *ctx);
-+int vps_rst_undump(struct cpt_context *ctx);
-+
-+int cpt_vps_caps(struct cpt_context *ctx, __u32 *caps);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_epoll.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_epoll.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_epoll.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_epoll.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,105 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/namespace.h>
-+#include <linux/mount.h>
-+#include <linux/namei.h>
-+#include <linux/smp_lock.h>
-+#include <asm/uaccess.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/eventpoll.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_kernel.h"
-+#include "cpt_fsmagic.h"
-+#include "cpt_syscalls.h"
-+
-+extern struct file_operations eventpoll_fops;
-+
-+int cpt_dump_epolldev(cpt_object_t *obj, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ struct file *file = obj->o_obj;
-+ struct eventpoll *ep;
-+ struct rb_node *rbp;
-+ struct cpt_epoll_image ei;
-+
-+ if (file->f_op != &eventpoll_fops) {
-+ eprintk_ctx("bad epoll file\n");
-+ return -EINVAL;
-+ }
-+
-+ ep = file->private_data;
-+
-+ /* eventpoll.c does not protect open /proc/N/fd, silly.
-+ * Opener will get an invalid file with uninitialized private_data
-+ */
-+ if (unlikely(ep == NULL)) {
-+ eprintk_ctx("bad epoll device\n");
-+ return -EINVAL;
-+ }
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ ei.cpt_next = CPT_NULL;
-+ ei.cpt_object = CPT_OBJ_EPOLL;
-+ ei.cpt_hdrlen = sizeof(ei);
-+ ei.cpt_content = CPT_CONTENT_ARRAY;
-+ ei.cpt_file = obj->o_pos;
-+
-+ ctx->write(&ei, sizeof(ei), ctx);
-+
-+ down(&epsem);
-+ for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
-+ loff_t saved_obj;
-+ cpt_object_t *tobj;
-+ struct cpt_epoll_file_image efi;
-+ struct epitem *epi;
-+ epi = rb_entry(rbp, struct epitem, rbn);
-+ tobj = lookup_cpt_object(CPT_OBJ_FILE, epi->ffd.file, ctx);
-+ if (tobj == NULL) {
-+ eprintk_ctx("epoll device refers to an external file\n");
-+ err = -EBUSY;
-+ break;
-+ }
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_open_object(NULL, ctx);
-+
-+ efi.cpt_next = CPT_NULL;
-+ efi.cpt_object = CPT_OBJ_EPOLL_FILE;
-+ efi.cpt_hdrlen = sizeof(efi);
-+ efi.cpt_content = CPT_CONTENT_VOID;
-+ efi.cpt_file = tobj->o_pos;
-+ efi.cpt_fd = epi->ffd.fd;
-+ efi.cpt_events = epi->event.events;
-+ efi.cpt_data = epi->event.data;
-+ efi.cpt_revents = epi->revents;
-+ efi.cpt_ready = 0;
-+ if (!list_empty(&epi->rdllink))
-+ efi.cpt_ready = 1;
-+
-+ ctx->write(&efi, sizeof(efi), ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+ up(&epsem);
-+
-+ cpt_close_object(ctx);
-+
-+ return err;
-+}
-+
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_files.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_files.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_files.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_files.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1400 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/namespace.h>
-+#include <linux/mount.h>
-+#include <linux/namei.h>
-+#include <linux/smp_lock.h>
-+#include <asm/uaccess.h>
-+#include <linux/vzcalluser.h>
-+#include <ub/ub_mem.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_socket.h"
-+#include "cpt_kernel.h"
-+#include "cpt_fsmagic.h"
-+#include "cpt_syscalls.h"
-+
-+void cpt_printk_dentry(struct dentry *d, struct vfsmount *mnt)
-+{
-+ char *path;
-+ unsigned long pg = __get_free_page(GFP_KERNEL);
-+
-+ if (!pg)
-+ return;
-+
-+ path = d_path(d, mnt, (char *)pg, PAGE_SIZE);
-+
-+ if (!IS_ERR(path))
-+ printk("<%s>", path);
-+ free_page(pg);
-+}
-+
-+int cpt_verify_overmount(char *path, struct dentry *d, struct vfsmount *mnt,
-+ cpt_context_t *ctx)
-+{
-+ if (path[0] == '/' && !(!IS_ROOT(d) && d_unhashed(d))) {
-+ struct nameidata nd;
-+ if (path_lookup(path, 0, &nd)) {
-+ eprintk_ctx("d_path cannot be looked up %s\n", path);
-+ return -EINVAL;
-+ }
-+ if (nd.dentry != d || nd.mnt != mnt) {
-+ eprintk_ctx("d_path is invisible %s\n", path);
-+ path_release(&nd);
-+ return -EINVAL;
-+ }
-+ path_release(&nd);
-+ }
-+ return 0;
-+}
-+
-+static int
-+cpt_replaced(struct dentry * de, struct vfsmount *mnt, cpt_context_t * ctx)
-+{
-+ int result = 0;
-+
-+#if defined(CONFIG_VZFS_FS) || defined(CONFIG_VZFS_FS_MODULE)
-+ char *path;
-+ unsigned long pg;
-+ struct dentry * renamed_dentry;
-+
-+ if (de->d_sb->s_magic != FSMAGIC_VEFS)
-+ return 0;
-+ if (de->d_inode->i_nlink != 0 ||
-+ atomic_read(&de->d_inode->i_writecount) > 0)
-+ return 0;
-+
-+ renamed_dentry = vefs_replaced_dentry(de);
-+ if (renamed_dentry == NULL)
-+ return 0;
-+
-+ pg = __get_free_page(GFP_KERNEL);
-+ if (!pg)
-+ return 0;
-+
-+ path = d_path(de, mnt, (char *)pg, PAGE_SIZE);
-+ if (!IS_ERR(path)) {
-+ int len;
-+ struct nameidata nd;
-+
-+ len = pg + PAGE_SIZE - 1 - (unsigned long)path;
-+ if (len >= sizeof("(deleted) ") - 1 &&
-+ !memcmp(path, "(deleted) ", sizeof("(deleted) ") - 1)) {
-+ len -= sizeof("(deleted) ") - 1;
-+ path += sizeof("(deleted) ") - 1;
-+ }
-+
-+ if (path_lookup(path, 0, &nd) == 0) {
-+ if (mnt == nd.mnt &&
-+ vefs_is_renamed_dentry(nd.dentry, renamed_dentry))
-+ result = 1;
-+ path_release(&nd);
-+ }
-+ }
-+ free_page(pg);
-+#endif
-+ return result;
-+}
-+
-+static int cpt_dump_dentry(struct dentry *d, struct vfsmount *mnt,
-+ int replaced, cpt_context_t *ctx)
-+{
-+ int len;
-+ char *path;
-+ char *pg = cpt_get_buf(ctx);
-+
-+ path = d_path(d, mnt, pg, PAGE_SIZE);
-+ len = PTR_ERR(path);
-+
-+ if (IS_ERR(path)) {
-+ struct cpt_object_hdr o;
-+ char tmp[1];
-+ /* VZ changes d_path() to return EINVAL, when path
-+ * is not supposed to be visible inside VE. */
-+ if (len != -EINVAL)
-+ eprintk_ctx("d_path err=%d\n", len);
-+ else
-+ len = 0;
-+
-+ o.cpt_next = sizeof(o) + CPT_ALIGN(1);
-+ o.cpt_object = CPT_OBJ_NAME;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_NAME;
-+ tmp[0] = 0;
-+
-+ ctx->write(&o, sizeof(o), ctx);
-+ ctx->write(tmp, 1, ctx);
-+ ctx->align(ctx);
-+
-+ __cpt_release_buf(ctx);
-+ return len;
-+ } else {
-+ struct cpt_object_hdr o;
-+
-+ len = pg + PAGE_SIZE - 1 - path;
-+ if (replaced &&
-+ len >= sizeof("(deleted) ") - 1 &&
-+ !memcmp(path, "(deleted) ", sizeof("(deleted) ") - 1)) {
-+ len -= sizeof("(deleted) ") - 1;
-+ path += sizeof("(deleted) ") - 1;
-+ }
-+ o.cpt_next = sizeof(o) + CPT_ALIGN(len + 1);
-+ o.cpt_object = CPT_OBJ_NAME;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_NAME;
-+ path[len] = 0;
-+
-+ if (cpt_verify_overmount(path, d, mnt, ctx)) {
-+ __cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+
-+ ctx->write(&o, sizeof(o), ctx);
-+ ctx->write(path, len+1, ctx);
-+ ctx->align(ctx);
-+ __cpt_release_buf(ctx);
-+ }
-+ return 0;
-+}
-+
-+int cpt_dump_string(const char *s, struct cpt_context *ctx)
-+{
-+ int len;
-+ struct cpt_object_hdr o;
-+
-+ len = strlen(s);
-+ o.cpt_next = sizeof(o) + CPT_ALIGN(len + 1);
-+ o.cpt_object = CPT_OBJ_NAME;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_NAME;
-+
-+ ctx->write(&o, sizeof(o), ctx);
-+ ctx->write(s, len+1, ctx);
-+ ctx->align(ctx);
-+ return 0;
-+}
-+
-+static int
-+cpt_dump_filename(struct file *file, int replaced, cpt_context_t *ctx)
-+{
-+ return cpt_dump_dentry(file->f_dentry, file->f_vfsmnt, replaced, ctx);
-+}
-+
-+int cpt_dump_inode(struct dentry *d, struct vfsmount *mnt, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_inode_image *v = cpt_get_buf(ctx);
-+ struct kstat sbuf;
-+
-+ v->cpt_next = sizeof(*v);
-+ v->cpt_object = CPT_OBJ_INODE;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ if ((err = vfs_getattr(mnt, d, &sbuf)) != 0) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+
-+ v->cpt_dev = d->d_inode->i_sb->s_dev;
-+ v->cpt_ino = d->d_inode->i_ino;
-+ v->cpt_mode = sbuf.mode;
-+ v->cpt_nlink = sbuf.nlink;
-+ v->cpt_uid = sbuf.uid;
-+ v->cpt_gid = sbuf.gid;
-+ v->cpt_rdev = d->d_inode->i_rdev;
-+ v->cpt_size = sbuf.size;
-+ v->cpt_atime = cpt_timespec_export(&sbuf.atime);
-+ v->cpt_mtime = cpt_timespec_export(&sbuf.mtime);
-+ v->cpt_ctime = cpt_timespec_export(&sbuf.ctime);
-+ v->cpt_blksize = sbuf.blksize;
-+ v->cpt_blocks = sbuf.blocks;
-+ v->cpt_sb = d->d_inode->i_sb->s_magic;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+int cpt_collect_files(cpt_context_t * ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+ int index = 0;
-+
-+ /* Collect process fd sets */
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->files && cpt_object_add(CPT_OBJ_FILES, tsk->files, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+
-+ /* Collect files from fd sets */
-+ for_each_object(obj, CPT_OBJ_FILES) {
-+ int fd;
-+ struct files_struct *f = obj->o_obj;
-+
-+ cpt_obj_setindex(obj, index++, ctx);
-+
-+ if (obj->o_count != atomic_read(&f->count)) {
-+ eprintk_ctx("files_struct is referenced outside %d %d\n", obj->o_count, atomic_read(&f->count));
-+ return -EBUSY;
-+ }
-+
-+ for (fd = 0; fd < f->max_fds; fd++) {
-+ struct file *file = fcheck_files(f, fd);
-+ if (file && cpt_object_add(CPT_OBJ_FILE, file, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+ }
-+
-+ /* Collect files queued by AF_UNIX sockets. */
-+ if ((err = cpt_collect_passedfds(ctx)) < 0)
-+ return err;
-+
-+ /* OK. At this point we should count all the references. */
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+ struct file *parent;
-+ cpt_object_t *ino_obj;
-+
-+ if (obj->o_count != atomic_read(&file->f_count)) {
-+ eprintk_ctx("file struct is referenced outside %d %d\n", obj->o_count, atomic_read(&file->f_count));
-+ cpt_printk_dentry(file->f_dentry, file->f_vfsmnt);
-+ return -EBUSY;
-+ }
-+
-+ switch (file->f_dentry->d_inode->i_sb->s_magic) {
-+ case FSMAGIC_FUTEX:
-+ case FSMAGIC_MQUEUE:
-+ case FSMAGIC_BDEV:
-+ eprintk_ctx("file on unsupported FS: magic %08lx\n", file->f_dentry->d_inode->i_sb->s_magic);
-+ return -EBUSY;
-+ }
-+
-+ /* Collect inode. It is necessary mostly to resolve deleted
-+ * hard links. */
-+ ino_obj = cpt_object_add(CPT_OBJ_INODE, file->f_dentry->d_inode, ctx);
-+ if (ino_obj == NULL)
-+ return -ENOMEM;
-+
-+ parent = ino_obj->o_parent;
-+ if (!parent || (!IS_ROOT(parent->f_dentry) && d_unhashed(parent->f_dentry)))
-+ ino_obj->o_parent = file;
-+
-+ if (S_ISCHR(file->f_dentry->d_inode->i_mode)) {
-+ int maj = imajor(file->f_dentry->d_inode);
-+ if (maj == PTY_MASTER_MAJOR ||
-+ (maj >= UNIX98_PTY_MASTER_MAJOR &&
-+ maj < UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) ||
-+ maj == PTY_SLAVE_MAJOR ||
-+ maj == UNIX98_PTY_SLAVE_MAJOR ||
-+ maj == TTYAUX_MAJOR) {
-+ err = cpt_collect_tty(file, ctx);
-+ if (err)
-+ return err;
-+ }
-+ }
-+
-+ if (S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
-+ err = cpt_collect_socket(file, ctx);
-+ if (err)
-+ return err;
-+ }
-+ }
-+
-+ err = cpt_index_sockets(ctx);
-+
-+ return err;
-+}
-+
-+/* /dev/ptmx is special, all the files share one inode, but real tty backend
-+ * is attached via file->private_data.
-+ */
-+
-+static inline int is_cloning_inode(struct inode *ino)
-+{
-+ return S_ISCHR(ino->i_mode) &&
-+ ino->i_rdev == MKDEV(TTYAUX_MAJOR,2);
-+}
-+
-+static int dump_one_flock(struct file_lock *fl, int owner, struct cpt_context *ctx)
-+{
-+ pid_t pid;
-+ struct cpt_flock_image *v = cpt_get_buf(ctx);
-+
-+ v->cpt_next = sizeof(*v);
-+ v->cpt_object = CPT_OBJ_FLOCK;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ v->cpt_owner = owner;
-+
-+ pid = fl->fl_pid;
-+ if (pid && !is_virtual_pid(fl->fl_pid)) {
-+ pid = _pid_type_to_vpid(PIDTYPE_TGID, fl->fl_pid);
-+ if (pid == -1) {
-+ if (!(fl->fl_flags&FL_FLOCK)) {
-+ eprintk_ctx("posix lock from another VE?\n");
-+ cpt_release_buf(ctx);
-+ return -EBUSY;
-+ }
-+ pid = 0;
-+ }
-+ }
-+
-+ v->cpt_pid = pid;
-+ v->cpt_start = fl->fl_start;
-+ v->cpt_end = fl->fl_end;
-+ v->cpt_flags = fl->fl_flags;
-+ v->cpt_type = fl->fl_type;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+
-+int cpt_dump_flock(struct file *file, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct file_lock *fl;
-+
-+ lock_kernel();
-+ for (fl = file->f_dentry->d_inode->i_flock;
-+ fl; fl = fl->fl_next) {
-+ if (file != fl->fl_file)
-+ continue;
-+ if (fl->fl_flags & FL_LEASE) {
-+ eprintk_ctx("lease lock is not supported\n");
-+ err = -EINVAL;
-+ break;
-+ }
-+ if (fl->fl_flags & FL_POSIX) {
-+ cpt_object_t *obj;
-+ obj = lookup_cpt_object(CPT_OBJ_FILES, fl->fl_owner, ctx);
-+ if (obj) {
-+ dump_one_flock(fl, obj->o_index, ctx);
-+ continue;
-+ } else {
-+ eprintk_ctx("unknown lock owner %p\n", fl->fl_owner);
-+ err = -EINVAL;
-+ }
-+ }
-+ if (fl->fl_flags & FL_FLOCK) {
-+ dump_one_flock(fl, -1, ctx);
-+ continue;
-+ }
-+ }
-+ unlock_kernel();
-+ return err;
-+}
-+
-+static int __comb_pid_to_vpid(int pid)
-+{
-+ int vpid = pid;
-+
-+ if (pid > 0) {
-+ vpid = _pid_type_to_vpid(PIDTYPE_PID, pid);
-+ if (unlikely(vpid < 0)) {
-+ dprintk("pid %d does not exist amymore.\n", pid);
-+ return 0;
-+ }
-+ } else if (pid < 0) {
-+ vpid = _pid_type_to_vpid(PIDTYPE_PGID, -pid);
-+ if (unlikely(vpid < 0)) {
-+ dprintk("pgid %d does not exist amymore.\n", -pid);
-+ return 0;
-+ }
-+ vpid = -vpid;
-+ }
-+ return vpid;
-+}
-+
-+static int dump_one_file(cpt_object_t *obj, struct file *file, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ cpt_object_t *iobj;
-+ struct cpt_file_image *v = cpt_get_buf(ctx);
-+ struct kstat sbuf;
-+ int replaced = 0;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_FILE;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_flags = file->f_flags;
-+ v->cpt_mode = file->f_mode;
-+ v->cpt_pos = file->f_pos;
-+ v->cpt_uid = file->f_uid;
-+ v->cpt_gid = file->f_gid;
-+
-+ vfs_getattr(file->f_vfsmnt, file->f_dentry, &sbuf);
-+
-+ v->cpt_i_mode = sbuf.mode;
-+ v->cpt_lflags = 0;
-+ if (IS_ROOT(file->f_dentry))
-+ v->cpt_lflags |= CPT_DENTRY_ROOT;
-+ else if (d_unhashed(file->f_dentry)) {
-+ if (cpt_replaced(file->f_dentry, file->f_vfsmnt, ctx)) {
-+ v->cpt_lflags |= CPT_DENTRY_REPLACED;
-+ replaced = 1;
-+ } else {
-+ v->cpt_lflags |= CPT_DENTRY_DELETED;
-+ }
-+ }
-+ if (is_cloning_inode(file->f_dentry->d_inode))
-+ v->cpt_lflags |= CPT_DENTRY_CLONING;
-+ if (file->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_PROC)
-+ v->cpt_lflags |= CPT_DENTRY_PROC;
-+ v->cpt_inode = CPT_NULL;
-+ if (!(v->cpt_lflags & CPT_DENTRY_REPLACED)) {
-+ iobj = lookup_cpt_object(CPT_OBJ_INODE, file->f_dentry->d_inode, ctx);
-+ if (iobj)
-+ v->cpt_inode = iobj->o_pos;
-+ }
-+ v->cpt_priv = CPT_NULL;
-+ v->cpt_fown_fd = -1;
-+ if (S_ISCHR(v->cpt_i_mode)) {
-+ iobj = lookup_cpt_object(CPT_OBJ_TTY, file->private_data, ctx);
-+ if (iobj) {
-+ v->cpt_priv = iobj->o_pos;
-+ if (file->f_flags&FASYNC)
-+ v->cpt_fown_fd = cpt_tty_fasync(file, ctx);
-+ }
-+ }
-+ if (S_ISSOCK(v->cpt_i_mode)) {
-+ if (obj->o_index < 0) {
-+ eprintk_ctx("BUG: no socket index\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_priv = obj->o_index;
-+ if (file->f_flags&FASYNC)
-+ v->cpt_fown_fd = cpt_socket_fasync(file, ctx);
-+ }
-+ if (file->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_EPOLL) {
-+ v->cpt_priv = file->f_dentry->d_inode->i_ino;
-+ v->cpt_lflags |= CPT_DENTRY_EPOLL;
-+ }
-+
-+ v->cpt_fown_pid = __comb_pid_to_vpid((int)file->f_owner.pid);
-+ v->cpt_fown_uid = file->f_owner.uid;
-+ v->cpt_fown_euid = file->f_owner.euid;
-+ v->cpt_fown_signo = file->f_owner.signum;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ if (!S_ISSOCK(v->cpt_i_mode)) {
-+ err = cpt_dump_filename(file, replaced, ctx);
-+ if (err)
-+ return err;
-+ if ((file->f_mode & FMODE_WRITE) &&
-+ file->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_VEFS)
-+ vefs_track_notify(file->f_dentry, 1);
-+ }
-+
-+ if (file->f_dentry->d_inode->i_flock)
-+ err = cpt_dump_flock(file, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ return err;
-+}
-+
-+/* About this weird function... Crappy code dealing with SYSV shared memory
-+ * defines TMPFS inode and file with f_op doing only mmap. So...
-+ * Maybe, this is wrong and leaks something. It is clear access to
-+ * SYSV shmem via mmap is quite unusual and impossible from user space.
-+ */
-+static int dump_content_shm(struct file *file, struct cpt_context *ctx)
-+{
-+ struct cpt_obj_bits *v;
-+ loff_t saved_pos;
-+ unsigned long addr;
-+
-+ addr = do_mmap_pgoff(file, 0, file->f_dentry->d_inode->i_size,
-+ PROT_READ, MAP_SHARED, 0);
-+ if (IS_ERR((void*)addr))
-+ return PTR_ERR((void*)addr);
-+
-+ cpt_push_object(&saved_pos, ctx);
-+ cpt_open_object(NULL, ctx);
-+ v = cpt_get_buf(ctx);
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_BITS;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_DATA;
-+ v->cpt_size = file->f_dentry->d_inode->i_size;
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ ctx->write((void*)addr, file->f_dentry->d_inode->i_size, ctx);
-+ ctx->align(ctx);
-+ do_munmap(current->mm, addr, file->f_dentry->d_inode->i_size);
-+
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_pos, ctx);
-+ return 0;
-+}
-+
-+static int data_is_zero(char *addr, int len)
-+{
-+ int i;
-+ unsigned long zerolong = 0;
-+
-+ for (i=0; i<len/sizeof(unsigned long); i++) {
-+ if (((unsigned long*)(addr))[i] != 0)
-+ return 0;
-+ }
-+ i = len % sizeof(unsigned long);
-+ if (!i)
-+ return 1;
-+ return memcmp(addr + len - i, &zerolong, i) == 0;
-+}
-+
-+
-+static int dump_content_regular(struct file *file, struct cpt_context *ctx)
-+{
-+ loff_t saved_pos;
-+ loff_t pos = 0;
-+ loff_t obj_opened = CPT_NULL;
-+ struct cpt_page_block pgb;
-+ ssize_t (*do_read)(struct file *, char __user *, size_t, loff_t *);
-+
-+ if (file->f_op == NULL)
-+ return -EINVAL;
-+
-+ if ((do_read = file->f_op->read) == NULL) {
-+ if (file->f_op->mmap == NULL)
-+ return -EINVAL;
-+ if (file->f_dentry->d_inode->i_sb->s_magic != FSMAGIC_TMPFS) {
-+ eprintk_ctx("unreadable, but not SYSV SHM file\n");
-+ return -EINVAL;
-+ }
-+
-+ do_read = file->f_dentry->d_inode->i_fop->read;
-+ cpt_dump_content_sysvshm(file, ctx);
-+ if (!do_read) {
-+ wprintk_ctx("TMPFS is not configured?\n");
-+ return dump_content_shm(file, ctx);
-+ }
-+ }
-+
-+ if (!(file->f_mode & FMODE_READ)) {
-+ file = dentry_open(dget(file->f_dentry),
-+ mntget(file->f_vfsmnt), O_RDONLY);
-+ } else {
-+ atomic_inc(&file->f_count);
-+ }
-+
-+ for (;;) {
-+ mm_segment_t oldfs;
-+ int err;
-+
-+ (void)cpt_get_buf(ctx);
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = do_read(file, ctx->tmpbuf, PAGE_SIZE, &pos);
-+ set_fs(oldfs);
-+ if (err < 0) {
-+ eprintk_ctx("dump_content_regular: do_read: %d", err);
-+ fput(file);
-+ __cpt_release_buf(ctx);
-+ return err;
-+ }
-+ if (err == 0) {
-+ __cpt_release_buf(ctx);
-+ break;
-+ }
-+ if (data_is_zero(ctx->tmpbuf, err)) {
-+ if (obj_opened != CPT_NULL) {
-+ ctx->pwrite(&pgb.cpt_end, 8, ctx, obj_opened + offsetof(struct cpt_page_block, cpt_end));
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_pos, ctx);
-+ obj_opened = CPT_NULL;
-+ }
-+ } else {
-+ if (obj_opened == CPT_NULL) {
-+ cpt_push_object(&saved_pos, ctx);
-+ cpt_open_object(NULL, ctx);
-+ obj_opened = ctx->file->f_pos;
-+ pgb.cpt_next = CPT_NULL;
-+ pgb.cpt_object = CPT_OBJ_PAGES;
-+ pgb.cpt_hdrlen = sizeof(pgb);
-+ pgb.cpt_content = CPT_CONTENT_DATA;
-+ pgb.cpt_start = pos - err;
-+ pgb.cpt_end = pgb.cpt_start;
-+ ctx->write(&pgb, sizeof(pgb), ctx);
-+ }
-+ ctx->write(ctx->tmpbuf, err, ctx);
-+ pgb.cpt_end += err;
-+ }
-+ __cpt_release_buf(ctx);
-+ }
-+
-+ fput(file);
-+
-+ if (obj_opened != CPT_NULL) {
-+ ctx->pwrite(&pgb.cpt_end, 8, ctx, obj_opened + offsetof(struct cpt_page_block, cpt_end));
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_pos, ctx);
-+ obj_opened = CPT_NULL;
-+ }
-+ return 0;
-+}
-+
-+
-+static int dump_content_chrdev(struct file *file, struct cpt_context *ctx)
-+{
-+ struct inode *ino = file->f_dentry->d_inode;
-+ int maj;
-+
-+ maj = imajor(ino);
-+ if (maj == MEM_MAJOR) {
-+ /* Well, OK. */
-+ return 0;
-+ }
-+ if (maj == PTY_MASTER_MAJOR ||
-+ (maj >= UNIX98_PTY_MASTER_MAJOR &&
-+ maj < UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) ||
-+ maj == PTY_SLAVE_MAJOR ||
-+ maj == UNIX98_PTY_SLAVE_MAJOR ||
-+ maj == TTYAUX_MAJOR) {
-+ return cpt_dump_content_tty(file, ctx);
-+ }
-+ eprintk_ctx("unsupported chrdev %d/%d\n", maj, iminor(ino));
-+ return -EINVAL;
-+}
-+
-+static int dump_content_blkdev(struct file *file, struct cpt_context *ctx)
-+{
-+ struct inode *ino = file->f_dentry->d_inode;
-+
-+ /* We are not going to transfer them. */
-+ eprintk_ctx("unsupported blkdev %d/%d\n", imajor(ino), iminor(ino));
-+ return -EINVAL;
-+}
-+
-+static int dump_content_fifo(struct file *file, struct cpt_context *ctx)
-+{
-+ struct inode *ino = file->f_dentry->d_inode;
-+ cpt_object_t *obj;
-+ loff_t saved_pos;
-+ int readers;
-+ int writers;
-+ int anon = 0;
-+
-+ down(PIPE_SEM(*ino));
-+ readers = PIPE_READERS(*ino);
-+ writers = PIPE_WRITERS(*ino);
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file1 = obj->o_obj;
-+ if (file1->f_dentry->d_inode == ino) {
-+ if (file1->f_mode & FMODE_READ)
-+ readers--;
-+ if (file1->f_mode & FMODE_WRITE)
-+ writers--;
-+ }
-+ }
-+ up(PIPE_SEM(*ino));
-+ if (readers || writers) {
-+ struct dentry *dr = file->f_dentry->d_sb->s_root;
-+ if (dr->d_name.len == 7 && memcmp(dr->d_name.name,"pipefs:",7) == 0)
-+ anon = 1;
-+
-+ if (anon) {
-+ eprintk_ctx("pipe has %d/%d external readers/writers\n", readers, writers);
-+ return -EBUSY;
-+ }
-+ /* If fifo has external readers/writers, we are in troubles.
-+ * If the buffer is not empty, we must move its content.
-+ * But if the fifo is owned by a service, we cannot do
-+ * this. See?
-+ *
-+ * For now we assume, that if fifo is opened by another
-+ * process, we do not own it and, hence, migrate without
-+ * data.
-+ */
-+ return 0;
-+ }
-+
-+ /* OK, we must save fifo state. No semaphores required. */
-+
-+ if (PIPE_LEN(*ino)) {
-+ struct cpt_obj_bits *v = cpt_get_buf(ctx);
-+ cpt_push_object(&saved_pos, ctx);
-+ cpt_open_object(NULL, ctx);
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_BITS;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_DATA;
-+ v->cpt_size = PIPE_LEN(*ino);
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ ctx->write(PIPE_BASE(*ino) + PIPE_START(*ino), PIPE_MAX_RCHUNK(*ino), ctx);
-+ if (PIPE_LEN(*ino) > PIPE_MAX_RCHUNK(*ino))
-+ ctx->write(PIPE_BASE(*ino), PIPE_LEN(*ino)-PIPE_MAX_RCHUNK(*ino), ctx);
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_pos, ctx);
-+ }
-+
-+ return 0;
-+}
-+
-+static int dump_content_socket(struct file *file, struct cpt_context *ctx)
-+{
-+ return 0;
-+}
-+
-+static int dump_one_inode(struct file *file, struct dentry *d,
-+ struct vfsmount *mnt, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct inode *ino = d->d_inode;
-+ cpt_object_t *iobj;
-+ int dump_it = 0;
-+
-+ iobj = lookup_cpt_object(CPT_OBJ_INODE, ino, ctx);
-+ if (!iobj)
-+ return -EINVAL;
-+
-+ if (iobj->o_pos >= 0)
-+ return 0;
-+
-+ if ((!IS_ROOT(d) && d_unhashed(d)) &&
-+ !cpt_replaced(d, mnt, ctx))
-+ dump_it = 1;
-+ if (!S_ISREG(ino->i_mode) && !S_ISDIR(ino->i_mode)) {
-+ /* One more bug in epoll: invalid inode mode.
-+ * What a load of crap...
-+ */
-+ if (ino->i_sb->s_magic == FSMAGIC_EPOLL &&
-+ (ino->i_mode & S_IFMT) == 0)
-+ return 0;
-+ dump_it = 1;
-+ }
-+
-+ if (!dump_it)
-+ return 0;
-+
-+ cpt_open_object(iobj, ctx);
-+ cpt_dump_inode(d, mnt, ctx);
-+
-+ if (!IS_ROOT(d) && d_unhashed(d)) {
-+ struct file *parent;
-+ parent = iobj->o_parent;
-+ if (!parent ||
-+ (!IS_ROOT(parent->f_dentry) && d_unhashed(parent->f_dentry))) {
-+ /* Inode is not deleted, but it does not
-+ * have references from inside checkpointed
-+ * process group. We have options:
-+ * A. Fail, abort checkpointing
-+ * B. Proceed. File will be cloned.
-+ * A is correct, B is more complicated */
-+ /* Just as a hint where to create deleted file */
-+ if (ino->i_nlink != 0) {
-+ eprintk_ctx("deleted reference to existing inode, checkpointing is impossible\n");
-+ return -EBUSY;
-+ }
-+ } else {
-+ /* Refer to _another_ file name. */
-+ err = cpt_dump_filename(parent, 0, ctx);
-+ if (err)
-+ return err;
-+ if (S_ISREG(ino->i_mode) || S_ISDIR(ino->i_mode))
-+ dump_it = 0;
-+ }
-+ }
-+ if (dump_it) {
-+ if (S_ISREG(ino->i_mode)) {
-+ if ((err = dump_content_regular(file, ctx)) != 0) {
-+ eprintk_ctx("dump_content_regular ");
-+ cpt_printk_dentry(d, mnt);
-+ }
-+ } else if (S_ISDIR(ino->i_mode)) {
-+ /* We cannot do anything. The directory should be
-+ * empty, so it is not a big deal.
-+ */
-+ } else if (S_ISCHR(ino->i_mode)) {
-+ err = dump_content_chrdev(file, ctx);
-+ } else if (S_ISBLK(ino->i_mode)) {
-+ err = dump_content_blkdev(file, ctx);
-+ } else if (S_ISFIFO(ino->i_mode)) {
-+ err = dump_content_fifo(file, ctx);
-+ } else if (S_ISSOCK(ino->i_mode)) {
-+ err = dump_content_socket(file, ctx);
-+ } else {
-+ eprintk_ctx("unknown inode mode %o\n", ino->i_mode & S_IFMT);
-+ err = -EINVAL;
-+ }
-+ }
-+ cpt_close_object(ctx);
-+
-+ return err;
-+}
-+
-+int cpt_dump_files(struct cpt_context *ctx)
-+{
-+ int epoll_nr;
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_TTY);
-+ for_each_object(obj, CPT_OBJ_TTY) {
-+ int err;
-+
-+ if ((err = cpt_dump_tty(obj, ctx)) != 0)
-+ return err;
-+ }
-+ cpt_close_section(ctx);
-+
-+ cpt_open_section(ctx, CPT_SECT_INODE);
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+ int err;
-+
-+ if ((err = dump_one_inode(file, file->f_dentry,
-+ file->f_vfsmnt, ctx)) != 0)
-+ return err;
-+ }
-+ for_each_object(obj, CPT_OBJ_FS) {
-+ struct fs_struct *fs = obj->o_obj;
-+ int err;
-+
-+ if (fs->root &&
-+ (err = dump_one_inode(NULL, fs->root, fs->rootmnt, ctx)) != 0)
-+ return err;
-+ if (fs->pwd &&
-+ (err = dump_one_inode(NULL, fs->pwd, fs->pwdmnt, ctx)) != 0)
-+ return err;
-+ if (fs->altroot &&
-+ (err = dump_one_inode(NULL, fs->altroot, fs->altrootmnt, ctx)) != 0)
-+ return err;
-+ }
-+ cpt_close_section(ctx);
-+
-+ epoll_nr = 0;
-+ cpt_open_section(ctx, CPT_SECT_FILES);
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+ int err;
-+
-+ if ((err = dump_one_file(obj, file, ctx)) != 0)
-+ return err;
-+ if (file->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_EPOLL)
-+ epoll_nr++;
-+ }
-+ cpt_close_section(ctx);
-+
-+ if (epoll_nr) {
-+ cpt_open_section(ctx, CPT_SECT_EPOLL);
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+ if (file->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_EPOLL) {
-+ int err;
-+ if ((err = cpt_dump_epolldev(obj, ctx)) != 0)
-+ return err;
-+ }
-+ }
-+ cpt_close_section(ctx);
-+ }
-+
-+ cpt_open_section(ctx, CPT_SECT_SOCKET);
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ int err;
-+
-+ if ((err = cpt_dump_socket(obj, obj->o_obj, obj->o_index, -1, ctx)) != 0)
-+ return err;
-+ }
-+ cpt_close_section(ctx);
-+
-+ return 0;
-+}
-+
-+static int dump_filedesc(int fd, struct file *file,
-+ struct files_struct *f, struct cpt_context *ctx)
-+{
-+ struct cpt_fd_image *v = cpt_get_buf(ctx);
-+ cpt_object_t *obj;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_FILEDESC;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ v->cpt_fd = fd;
-+ obj = lookup_cpt_object(CPT_OBJ_FILE, file, ctx);
-+ if (!obj) BUG();
-+ v->cpt_file = obj->o_pos;
-+ v->cpt_flags = 0;
-+ if (FD_ISSET(fd, f->close_on_exec))
-+ v->cpt_flags = CPT_FD_FLAG_CLOSEEXEC;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+
-+static int dump_one_file_struct(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct files_struct *f = obj->o_obj;
-+ struct cpt_files_struct_image *v = cpt_get_buf(ctx);
-+ int fd;
-+ loff_t saved_obj;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_FILES;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_index = obj->o_index;
-+ v->cpt_max_fds = f->max_fds;
-+ v->cpt_next_fd = f->next_fd;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ for (fd = 0; fd < f->max_fds; fd++) {
-+ struct file *file = fcheck_files(f, fd);
-+ if (file)
-+ dump_filedesc(fd, file, f, ctx);
-+ }
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+
-+int cpt_dump_files_struct(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_FILES_STRUCT);
-+
-+ for_each_object(obj, CPT_OBJ_FILES) {
-+ int err;
-+
-+ if ((err = dump_one_file_struct(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+int cpt_collect_fs(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->fs) {
-+ if (cpt_object_add(CPT_OBJ_FS, tsk->fs, ctx) == NULL)
-+ return -ENOMEM;
-+ if (tsk->fs->pwd &&
-+ cpt_object_add(CPT_OBJ_INODE, tsk->fs->pwd->d_inode, ctx) == NULL)
-+ return -ENOMEM;
-+ if (tsk->fs->root &&
-+ cpt_object_add(CPT_OBJ_INODE, tsk->fs->root->d_inode, ctx) == NULL)
-+ return -ENOMEM;
-+ if (tsk->fs->altroot &&
-+ cpt_object_add(CPT_OBJ_INODE, tsk->fs->altroot->d_inode, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int cpt_dump_dir(struct dentry *d, struct vfsmount *mnt, struct cpt_context *ctx)
-+{
-+ struct file file;
-+
-+ memset(&file, 0, sizeof(file));
-+
-+ file.f_dentry = d;
-+ file.f_vfsmnt = mnt;
-+ file.f_mode = FMODE_READ|FMODE_PREAD|FMODE_LSEEK;
-+ return dump_one_file(NULL, &file, ctx);
-+}
-+
-+static int dump_one_fs(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct fs_struct *fs = obj->o_obj;
-+ struct cpt_fs_struct_image *v = cpt_get_buf(ctx);
-+ loff_t saved_obj;
-+ int err;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_FS;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_umask = fs->umask;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ err = cpt_dump_dir(fs->root, fs->rootmnt, ctx);
-+ if (!err)
-+ err = cpt_dump_dir(fs->pwd, fs->pwdmnt, ctx);
-+ if (!err && fs->altroot)
-+ err = cpt_dump_dir(fs->altroot, fs->altrootmnt, ctx);
-+
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ return err;
-+}
-+
-+int cpt_dump_fs_struct(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_FS);
-+
-+ for_each_object(obj, CPT_OBJ_FS) {
-+ int err;
-+
-+ if ((err = dump_one_fs(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int check_one_namespace(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct namespace *n = obj->o_obj;
-+ struct list_head *p;
-+ char *path_buf, *path;
-+
-+ path_buf = (char *) __get_free_page(GFP_KERNEL);
-+ if (!path_buf)
-+ return -ENOMEM;
-+
-+ down_read(&n->sem);
-+ list_for_each(p, &n->list) {
-+ struct vfsmount *mnt = list_entry(p, struct vfsmount, mnt_list);
-+
-+ path = d_path(mnt->mnt_root, mnt, path_buf, PAGE_SIZE);
-+ if (IS_ERR(path))
-+ continue;
-+
-+ if (check_one_vfsmount(mnt)) {
-+ eprintk_ctx("unsupported fs type %s\n", mnt->mnt_sb->s_type->name);
-+ err = -EINVAL;
-+ break;
-+ }
-+ }
-+ up_read(&n->sem);
-+
-+ free_page((unsigned long) path_buf);
-+
-+ return err;
-+}
-+
-+int cpt_collect_namespace(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->namespace && cpt_object_add(CPT_OBJ_NAMESPACE, tsk->namespace, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+
-+ for_each_object(obj, CPT_OBJ_NAMESPACE) {
-+ int err;
-+ if ((err = check_one_namespace(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+struct args_t
-+{
-+ int* pfd;
-+ char* path;
-+};
-+
-+static int dumptmpfs(void *arg)
-+{
-+ int i;
-+ struct args_t *args = arg;
-+ int *pfd = args->pfd;
-+ char *path = args->path;
-+ char *argv[] = { "tar", "-c", "-S", "--numeric-owner", path, NULL };
-+
-+ i = real_env_create(VEID(get_exec_env()), VE_ENTER|VE_SKIPLOCK, 2, NULL, 0);
-+ if (i < 0) {
-+ eprintk("cannot enter ve to dump tmpfs\n");
-+ module_put(THIS_MODULE);
-+ return 1;
-+ }
-+
-+ if (pfd[1] != 1)
-+ sc_dup2(pfd[1], 1);
-+
-+ for (i=0; i<current->files->max_fds; i++) {
-+ if (i != 1)
-+ sc_close(i);
-+ }
-+
-+ module_put(THIS_MODULE);
-+
-+ set_fs(KERNEL_DS);
-+ i = sc_execve("/bin/tar", argv, NULL);
-+ eprintk("failed to exec /bin/tar: %d\n", i);
-+ return -1;
-+}
-+
-+static int cpt_dump_tmpfs(char *path, struct cpt_context *ctx)
-+{
-+ int err;
-+ int pid;
-+ int pfd[2];
-+ struct file *f;
-+ struct cpt_object_hdr v;
-+ char buf[16];
-+ int n;
-+ loff_t saved_obj;
-+ struct args_t args;
-+
-+ err = sc_pipe(pfd);
-+ if (err < 0)
-+ return err;
-+ args.pfd = pfd;
-+ args.path = path;
-+ err = pid = local_kernel_thread(dumptmpfs, (void*)&args, SIGCHLD, 0);
-+ if (err < 0)
-+ goto out;
-+ f = fget(pfd[0]);
-+ sc_close(pfd[1]);
-+ sc_close(pfd[0]);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_open_object(NULL, ctx);
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NAME;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_NAME;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ do {
-+ mm_segment_t oldfs;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ n = f->f_op->read(f, buf, sizeof(buf), &f->f_pos);
-+ set_fs(oldfs);
-+ if (n > 0)
-+ ctx->write(buf, n, ctx);
-+ } while (n > 0);
-+
-+ fput(f);
-+
-+ if ((err = sc_waitx(pid, 0)) < 0)
-+ eprintk_ctx("wait4: %d\n", err);
-+
-+ buf[0] = 0;
-+ ctx->write(buf, 1, ctx);
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ return n;
-+
-+out:
-+ if (pfd[1] >= 0)
-+ sc_close(pfd[1]);
-+ if (pfd[0] >= 0)
-+ sc_close(pfd[0]);
-+ return err;
-+}
-+
-+static int loopy_root(struct vfsmount *mnt)
-+{
-+ struct list_head *p;
-+
-+ list_for_each(p, &mnt->mnt_namespace->list) {
-+ struct vfsmount * m = list_entry(p, struct vfsmount, mnt_list);
-+ if (m == mnt)
-+ return 0;
-+ if (m->mnt_sb == mnt->mnt_sb)
-+ return 1;
-+ }
-+ /* Cannot happen */
-+ return 0;
-+}
-+
-+static int cpt_dump_bind_mnt(struct vfsmount * mnt, cpt_context_t * ctx)
-+{
-+ struct list_head *p;
-+ int err = -EINVAL;
-+
-+ /* One special case: mount --bind /a /a */
-+ if (mnt->mnt_root == mnt->mnt_mountpoint)
-+ return cpt_dump_dentry(mnt->mnt_root, mnt, 0, ctx);
-+
-+ list_for_each_prev(p, &mnt->mnt_list) {
-+ struct vfsmount * m;
-+
-+ if (p == &mnt->mnt_namespace->list)
-+ break;
-+
-+ m = list_entry(p, struct vfsmount, mnt_list);
-+
-+ if (m->mnt_sb != mnt->mnt_sb)
-+ continue;
-+
-+ err = cpt_dump_dentry(mnt->mnt_root, m, 0, ctx);
-+ if (err == 0)
-+ break;
-+ }
-+ return err;
-+}
-+
-+static int dump_vfsmount(struct vfsmount *mnt, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct cpt_vfsmount_image v;
-+ loff_t saved_obj;
-+ char *path_buf, *path;
-+
-+ path_buf = (char *) __get_free_page(GFP_KERNEL);
-+ if (!path_buf)
-+ return -ENOMEM;
-+
-+ path = d_path(mnt->mnt_root, mnt, path_buf, PAGE_SIZE);
-+ if (IS_ERR(path)) {
-+ free_page((unsigned long) path_buf);
-+ return PTR_ERR(path) == -EINVAL ? 0 : PTR_ERR(path);
-+ }
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_VFSMOUNT;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v.cpt_mntflags = mnt->mnt_flags;
-+ if (slab_ub(mnt) != get_exec_ub()) {
-+ v.cpt_mntflags |= CPT_MNT_EXT;
-+ } else {
-+ if (mnt->mnt_root != mnt->mnt_sb->s_root || loopy_root(mnt))
-+ v.cpt_mntflags |= CPT_MNT_BIND;
-+ }
-+ v.cpt_flags = mnt->mnt_sb->s_flags;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_dump_string(mnt->mnt_devname ? : "none", ctx);
-+ cpt_dump_string(path, ctx);
-+ cpt_dump_string(mnt->mnt_sb->s_type->name, ctx);
-+
-+ if (v.cpt_mntflags & CPT_MNT_BIND)
-+ err = cpt_dump_bind_mnt(mnt, ctx);
-+ else if (!(v.cpt_mntflags & CPT_MNT_EXT) &&
-+ strcmp(mnt->mnt_sb->s_type->name, "tmpfs") == 0)
-+ cpt_dump_tmpfs(path, ctx);
-+
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ if (mnt->mnt_sb->s_magic == FSMAGIC_VEFS)
-+ vefs_track_force_stop(mnt->mnt_sb);
-+
-+ free_page((unsigned long) path_buf);
-+
-+ return err;
-+}
-+
-+static int dump_one_namespace(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct namespace *n = obj->o_obj;
-+ struct cpt_object_hdr v;
-+ struct list_head *p;
-+ loff_t saved_obj;
-+ int err = 0;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v.cpt_next = -1;
-+ v.cpt_object = CPT_OBJ_NAMESPACE;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_ARRAY;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+
-+ down_read(&n->sem);
-+ list_for_each(p, &n->list) {
-+ err = dump_vfsmount(list_entry(p, struct vfsmount, mnt_list), ctx);
-+ if (err)
-+ break;
-+ }
-+ up_read(&n->sem);
-+
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ return err;
-+}
-+
-+int cpt_dump_namespace(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_NAMESPACE);
-+
-+ for_each_object(obj, CPT_OBJ_NAMESPACE) {
-+ int err;
-+
-+ if ((err = dump_one_namespace(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_files.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_files.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_files.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_files.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,55 @@
-+int cpt_collect_files(cpt_context_t *);
-+int cpt_collect_fs(cpt_context_t *);
-+int cpt_collect_namespace(cpt_context_t *);
-+int cpt_collect_sysvsem_undo(cpt_context_t *);
-+int cpt_collect_tty(struct file *, cpt_context_t *);
-+int cpt_dump_files(struct cpt_context *ctx);
-+int cpt_dump_files_struct(struct cpt_context *ctx);
-+int cpt_dump_fs_struct(struct cpt_context *ctx);
-+int cpt_dump_content_sysvshm(struct file *file, struct cpt_context *ctx);
-+int cpt_dump_content_tty(struct file *file, struct cpt_context *ctx);
-+int cpt_dump_tty(cpt_object_t *, struct cpt_context *ctx);
-+struct file * rst_sysv_shm(loff_t pos, struct cpt_context *ctx);
-+struct file * rst_open_tty(struct cpt_file_image *fi, struct cpt_inode_image *ii, unsigned flags, struct cpt_context *ctx);
-+__u32 cpt_tty_fasync(struct file *file, struct cpt_context *ctx);
-+
-+int rst_posix_locks(struct cpt_context *ctx);
-+
-+struct file *rst_file(loff_t pos, int fd, struct cpt_context *ctx);
-+int rst_files_complete(struct cpt_task_image *ti, struct cpt_context *ctx);
-+__u32 rst_files_flag(struct cpt_task_image *ti, struct cpt_context *ctx);
-+int rst_fs_complete(struct cpt_task_image *ti, struct cpt_context *ctx);
-+int rst_restore_fs(struct cpt_context *ctx);
-+
-+int cpt_collect_sysv(cpt_context_t *);
-+int cpt_dump_sysvsem(struct cpt_context *ctx);
-+int rst_sysv_ipc(struct cpt_context *ctx);
-+int rst_semundo_complete(struct cpt_task_image *ti, struct cpt_context *ctx);
-+__u32 rst_semundo_flag(struct cpt_task_image *ti, struct cpt_context *ctx);
-+
-+int cpt_dump_namespace(struct cpt_context *ctx);
-+int rst_root_namespace(struct cpt_context *ctx);
-+
-+int rst_stray_files(struct cpt_context *ctx);
-+int rst_tty_jobcontrol(struct cpt_context *ctx);
-+
-+void rst_flush_filejobs(struct cpt_context *);
-+int rst_do_filejobs(struct cpt_context *);
-+
-+int rst_eventpoll(struct cpt_context *);
-+struct file *cpt_open_epolldev(struct cpt_file_image *fi,
-+ unsigned flags,
-+ struct cpt_context *ctx);
-+int cpt_dump_epolldev(cpt_object_t *obj, struct cpt_context *);
-+
-+int cpt_verify_overmount(char *path, struct dentry *d, struct vfsmount *mnt,
-+ cpt_context_t *ctx);
-+
-+#define check_one_vfsmount(mnt) \
-+ (strcmp(mnt->mnt_sb->s_type->name, "rootfs") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "vzfs") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "simfs") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "tmpfs") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "devpts") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "proc") != 0 && \
-+ strcmp(mnt->mnt_sb->s_type->name, "sysfs") != 0)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_fsmagic.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_fsmagic.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_fsmagic.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_fsmagic.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,16 @@
-+/* Collected from kernel sources. */
-+
-+#define FSMAGIC_TMPFS 0x01021994
-+#define FSMAGIC_PIPEFS 0x50495045
-+#define FSMAGIC_SOCKFS 0x534F434B
-+#define FSMAGIC_PFMFS 0xa0b4d889
-+#define FSMAGIC_BDEV 0x62646576
-+#define FSMAGIC_EPOLL 0x03111965
-+#define FSMAGIC_FUTEX 0x0BAD1DEA
-+#define FSMAGIC_MQUEUE 0x19800202
-+#define FSMAGIC_PROC 0x9fa0
-+#define FSMAGIC_DEVPTS 0x1CD1
-+#define FSMAGIC_AUTOFS 0x0187
-+#define FSMAGIC_EXT2 0xEF53
-+#define FSMAGIC_REISER 0x52654973
-+#define FSMAGIC_VEFS 0x565a4653
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_iterative.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_iterative.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_iterative.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_iterative.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,468 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/hugetlb.h>
-+#include <linux/errno.h>
-+#include <linux/ve.h>
-+#include <linux/ve_proto.h>
-+#include <linux/pagemap.h>
-+#include <linux/rmap.h>
-+#include <linux/uio.h>
-+#include <asm/ldt.h>
-+#include <asm/mmu.h>
-+#include <asm/tlb.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_pagein.h"
-+
-+struct iter_data
-+{
-+#define CPT_XFER_BATCH 64
-+ int xfer_nr;
-+ struct page *xfer_batch[CPT_XFER_BATCH];
-+ int iter_new;
-+ int iter_young;
-+ int iter;
-+};
-+
-+/* Algo is the following:
-+ *
-+ * 1. At the first iteration all appropriate pte's are maked COW,
-+ * pages are marked PG_checkpointed and transferred (indexed
-+ * by pfn).
-+ * 2. do_wp_page(), if it wants to pte_mkwrite(), clears PG_checkpointed.
-+ * Also, PG_checkpointed is cleared, when a page is unmapped.
-+ * 3. At the next iterations we check PG_checkpoint. If it is set,
-+ * we are lucky. If it is not, page is new or it was changed, so that
-+ * we send new copy.
-+ * 4. Iterations stop when amount of new pages is < thresh_1 or it is
-+ * more than pages found at the first iteration / 2^N. So, we never
-+ * transfer more than 2*memsize.
-+ * 5. Then we freeze VE.
-+ * 6. cpt_mm, if sees a page, marked PG_checkpoint, sends its pfn.
-+ * (well, and panics, if pte is writable).
-+ */
-+
-+static int add_to_xfer_list(struct page *pg, struct iter_data *iter,
-+ cpt_context_t *ctx)
-+{
-+ int slot = iter->xfer_nr;
-+
-+ BUG_ON(slot >= CPT_XFER_BATCH);
-+ iter->xfer_batch[slot] = pg;
-+ return ((iter->xfer_nr = slot + 1) == CPT_XFER_BATCH);
-+}
-+
-+static int submit_page(struct page *pg, cpt_context_t *ctx)
-+{
-+ int err;
-+ struct iovec iov[2];
-+ struct file *file = ctx->pagein_file_out;
-+ mm_segment_t oldfs;
-+ struct pgin_reply rep;
-+
-+ rep.rmid = PGIN_RMID;
-+ rep.error = 0;
-+ rep.handle = page_to_pfn(pg);
-+
-+ iov[0].iov_base = &rep;
-+ iov[0].iov_len = sizeof(rep);
-+ iov[1].iov_base = kmap(pg);
-+ iov[1].iov_len = PAGE_SIZE;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = file->f_op->writev(file, iov, 2, &file->f_pos);
-+ set_fs(oldfs);
-+ kunmap(pg);
-+ if (err < 0)
-+ return err;
-+ if (err != sizeof(rep) + PAGE_SIZE)
-+ return -EIO;
-+ return 0;
-+}
-+
-+static int flush_transfer(struct iter_data *iter, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ int slot;
-+
-+ for (slot = 0; slot < iter->xfer_nr; slot++) {
-+ struct page *pg = iter->xfer_batch[slot];
-+ if (!err)
-+ err = submit_page(pg, ctx);
-+ page_cache_release(pg);
-+ }
-+ iter->xfer_nr = 0;
-+ return err;
-+}
-+
-+#define pmd_addr_end(addr, end) \
-+({ unsigned long __boundary = ((addr) + PMD_SIZE) & PMD_MASK; \
-+ (__boundary - 1 < (end) - 1)? __boundary: (end); \
-+})
-+
-+#define pgd_addr_end(addr, end) \
-+({ unsigned long __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \
-+ (__boundary - 1 < (end) - 1)? __boundary: (end); \
-+})
-+
-+static inline int pgd_none_or_clear_bad(pgd_t *pgd)
-+{
-+ if (pgd_none(*pgd))
-+ return 1;
-+ if (unlikely(pgd_bad(*pgd)))
-+ return 1;
-+ return 0;
-+}
-+
-+static inline int pmd_none_or_clear_bad(pmd_t *pmd)
-+{
-+ if (pmd_none(*pmd))
-+ return 1;
-+ if (unlikely(pmd_bad(*pmd)))
-+ return 1;
-+ return 0;
-+}
-+
-+static inline int iter_one_pmd(struct vm_area_struct *vma, pmd_t *pmd,
-+ unsigned long addr, unsigned long end,
-+ struct iter_data *iter, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ pte_t *pte;
-+ struct mm_struct *mm = vma->vm_mm;
-+
-+ spin_lock(&mm->page_table_lock);
-+ pte = pte_offset_map(pmd, addr);
-+ do {
-+ pte_t ptent = *pte;
-+ struct page *pg;
-+ int retr = 0;
-+
-+retry:
-+ if (pte_none(ptent))
-+ continue;
-+ if (!pte_present(*pte)) {
-+ if (pte_file(ptent))
-+ continue;
-+
-+ pte_unmap(pte);
-+ spin_unlock(&mm->page_table_lock);
-+ err = handle_mm_fault(mm, vma, addr, 0);
-+ if (err == VM_FAULT_SIGBUS)
-+ return -EFAULT;
-+ if (err == VM_FAULT_OOM)
-+ return -ENOMEM;
-+ err = 0;
-+ spin_lock(&mm->page_table_lock);
-+ pte = pte_offset_map(pmd, addr);
-+ ptent = *pte;
-+ retr = 1;
-+ goto retry;
-+ }
-+
-+ if (!pfn_valid(pte_pfn(ptent)) ||
-+ (pg = pfn_to_page(pte_pfn(ptent))) == NULL ||
-+ !PageAnon(pg) ||
-+ PageReserved(pg) ||
-+ pg == ZERO_PAGE(addr))
-+ continue;
-+
-+ if (iter->iter >= 0) {
-+ if (ptep_test_and_clear_young(pte) && !retr)
-+ iter->iter_young++;
-+ }
-+
-+ if (iter->iter == 0) {
-+ /* Just clear the state */
-+ clear_bit(PG_checkpointed, &pg->flags);
-+ iter->iter_new++;
-+ continue;
-+ }
-+
-+ if (test_bit(PG_checkpointed, &pg->flags)) {
-+ if (pte_write(ptent)) {
-+ eprintk("COW lost %lu %lu!\n", addr, page_to_pfn(pg));
-+ spin_unlock(&mm->page_table_lock);
-+ return -EFAULT;
-+ }
-+ continue;
-+ }
-+
-+ iter->iter_new++;
-+ get_page(pg);
-+ set_bit(PG_checkpointed, &pg->flags);
-+ ptep_set_wrprotect(pte);
-+ if (add_to_xfer_list(pg, iter, ctx)) {
-+ pte_unmap(pte);
-+ spin_unlock(&mm->page_table_lock);
-+ err = flush_transfer(iter, ctx);
-+ flush_tlb_range(vma, vma->vm_start, vma->vm_end);
-+ if (err)
-+ return err;
-+ spin_lock(&mm->page_table_lock);
-+ pte = pte_offset_map(pmd, addr);
-+ }
-+ } while (pte++, addr += PAGE_SIZE, addr != end);
-+
-+ pte_unmap(pte-1);
-+ spin_unlock(&mm->page_table_lock);
-+
-+ return err;
-+}
-+
-+static inline int
-+iter_one_pgd(struct vm_area_struct * vma, pgd_t *pgd,
-+ unsigned long addr, unsigned long end, struct iter_data *iter,
-+ cpt_context_t *ctx)
-+{
-+ pmd_t *pmd;
-+ unsigned long next;
-+
-+ pmd = pmd_offset(pgd, addr);
-+ do {
-+ int err;
-+ next = pmd_addr_end(addr, end);
-+ if (pmd_none_or_clear_bad(pmd))
-+ continue;
-+ err = iter_one_pmd(vma, pmd, addr, next, iter, ctx);
-+ if (err)
-+ return err;
-+ } while (pmd++, addr = next, addr != end);
-+ return 0;
-+}
-+
-+static int iter_one_vma(struct iter_data *iter, struct vm_area_struct *vma,
-+ task_t *tsk, cpt_context_t *ctx)
-+{
-+ pgd_t *pgd;
-+ unsigned long addr, end, next;
-+
-+ addr = vma->vm_start;
-+ end = vma->vm_end;
-+
-+ pgd = pgd_offset(vma->vm_mm, addr);
-+ do {
-+ int err;
-+ next = pgd_addr_end(addr, end);
-+ if (pgd_none_or_clear_bad(pgd))
-+ continue;
-+ err = iter_one_pgd(vma, pgd, addr, next, iter, ctx);
-+ if (err)
-+ return err;
-+ } while (pgd++, addr = next, addr != end);
-+ return 0;
-+}
-+
-+static int iter_one_mm(task_t *tsk, struct mm_struct *mm,
-+ void *data, cpt_context_t *ctx)
-+{
-+ int err = 0, err2 = 0;
-+ struct iter_data *iter = data;
-+ struct vm_area_struct *vma;
-+
-+ /* OK, now we are going to scan VM */
-+ down_read(&mm->mmap_sem);
-+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
-+ /* Do only true simple anonymous VMAs. */
-+ if (!vma->anon_vma)
-+ continue;
-+ if (is_vm_hugetlb_page(vma))
-+ continue;
-+ if ((vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) != VM_MAYWRITE)
-+ continue;
-+ err = iter_one_vma(iter, vma, tsk, ctx);
-+ if (iter->xfer_nr) {
-+ flush_tlb_range(vma, vma->vm_start, vma->vm_end);
-+ if (iter->iter)
-+ err2 = flush_transfer(iter, ctx);
-+ }
-+ if (err || err2)
-+ break;
-+ }
-+ up_read(&mm->mmap_sem);
-+ return err ? : err2;
-+}
-+
-+int cpt_walk_mm(int (*doit)(task_t *tsk, struct mm_struct *mm,
-+ void *data, cpt_context_t *ctx),
-+ void *data,
-+ cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ task_t *p;
-+ struct ve_struct *env;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (env == NULL)
-+ return -ESRCH;
-+
-+ write_lock_irq(&tasklist_lock);
-+
-+ do {
-+ struct mm_struct *mm;
-+
-+ /* VE is empty, stop scanning. */
-+ if (list_empty(&env->vetask_lh))
-+ break;
-+
-+ p = VE_TASK_LIST_2_TASK(env->vetask_lh.prev);
-+ REMOVE_VE_LINKS(p);
-+ list_add(&VE_TASK_INFO(p)->vetask_list, &env->vetask_lh);
-+
-+ get_task_struct(p);
-+ write_unlock_irq(&tasklist_lock);
-+
-+ mm = get_task_mm(p);
-+ if (mm) {
-+ err = doit(p, mm, data, ctx);
-+ mmput(mm);
-+ }
-+
-+ put_task_struct(p);
-+
-+ cond_resched();
-+
-+ write_lock_irq(&tasklist_lock);
-+ if (err)
-+ break;
-+ } while (p != env->init_entry);
-+
-+ write_unlock_irq(&tasklist_lock);
-+
-+ put_ve(env);
-+
-+ return err;
-+}
-+
-+static int nread(struct file *file, void *buf, int len)
-+{
-+ int offset = 0;
-+
-+ while (offset < len) {
-+ int res;
-+ mm_segment_t oldfs;
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ res = vfs_read(file, buf+offset, len-offset, &file->f_pos);
-+ set_fs(oldfs);
-+ if (res < 0)
-+ return res;
-+ if (res == 0)
-+ return -EIO;
-+ offset += res;
-+ }
-+ return 0;
-+}
-+
-+int cpt_iteration(cpt_context_t *ctx)
-+{
-+ int err;
-+ int prev_iter, first_iter, prev_young;
-+ struct iter_data *iter;
-+ int tmo;
-+
-+ if (ctx->pagein_file_out == NULL ||
-+ ctx->pagein_file_out->f_op->writev == NULL)
-+ return -EBADF;
-+
-+ iter = kmalloc(sizeof(struct iter_data), GFP_KERNEL);
-+ if (iter == NULL)
-+ return -ENOMEM;
-+ memset(iter, 0, sizeof(struct iter_data));
-+
-+ /* Clear the state */
-+ cpt_walk_mm(iter_one_mm, iter, ctx);
-+
-+ iter->iter_new = 0;
-+ iter->iter_young = 0;
-+ iter->iter = 1;
-+ err = cpt_walk_mm(iter_one_mm, iter, ctx);
-+ prev_iter = first_iter = iter->iter_new;
-+ prev_young = iter->iter_young;
-+ printk("%d: Found %d pages, %d young\n", iter->iter, prev_iter, iter->iter_young);
-+ iter->iter_new = 0;
-+ iter->iter_young= 0;
-+ if (err)
-+ goto out;
-+
-+ tmo = HZ/20;
-+
-+ for (;;) {
-+ iter->iter++;
-+ current->state = TASK_UNINTERRUPTIBLE;
-+ schedule_timeout(tmo);
-+ err = cpt_walk_mm(iter_one_mm, iter, ctx);
-+ if (err)
-+ break;
-+ printk("%d: Found %d pages, %d young, %d tmo\n", iter->iter, iter->iter_new, iter->iter_young, tmo);
-+ if (iter->iter_new > prev_iter/2 ||
-+ iter->iter_young > prev_young/2) {
-+ tmo /= 2;
-+ if (tmo < 2)
-+ tmo = 2;
-+ }
-+ if (iter->iter_new > first_iter/2 ||
-+ iter->iter_new < 10 ||
-+ iter->iter > 10) {
-+ current->state = TASK_UNINTERRUPTIBLE;
-+ schedule_timeout(tmo/2);
-+ iter->iter = -1;
-+ prev_iter = iter->iter_new;
-+ iter->iter_new = 0;
-+ cpt_walk_mm(iter_one_mm, iter, ctx);
-+ printk("%d: Found %d pages, tmo %d\n", iter->iter, iter->iter_new, tmo);
-+ ctx->iter_done = 1;
-+ do {
-+ union {
-+ struct pgin_reply rep;
-+ struct pgin_request req;
-+ } u;
-+ mm_segment_t oldfs;
-+ struct file * file = ctx->pagein_file_out;
-+
-+ u.rep.rmid = PGIN_RMID;
-+ u.rep.error = ITER_STOP;
-+ u.rep.handle = 0;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ vfs_write(file, (void*)&u.rep, sizeof(u.rep), &file->f_pos);
-+ err = nread(ctx->pagein_file_in, &u.req, sizeof(u.req));
-+ set_fs(oldfs);
-+ if (!err) {
-+ if (u.req.rmid != PGIN_RMID ||
-+ u.req.size != PGIN_STOP)
-+ err = -EIO;
-+ }
-+ } while (0);
-+ break;
-+ }
-+ prev_iter = iter->iter_new;
-+ prev_young = iter->iter_young;
-+ first_iter /= 2;
-+ iter->iter_new = 0;
-+ iter->iter_young= 0;
-+ }
-+
-+out:
-+ if (err) {
-+ if (ctx->pagein_file_out) {
-+ fput(ctx->pagein_file_out);
-+ ctx->pagein_file_out = NULL;
-+ }
-+ if (ctx->pagein_file_in) {
-+ fput(ctx->pagein_file_in);
-+ ctx->pagein_file_in = NULL;
-+ }
-+ }
-+ kfree(iter);
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_kernel.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_kernel.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_kernel.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_kernel.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,139 @@
-+#define __KERNEL_SYSCALLS__ 1
-+
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/sched.h>
-+#include <linux/mm.h>
-+#include <linux/kernel.h>
-+#include <asm/cpufeature.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_kernel.h"
-+#include "cpt_syscalls.h"
-+
-+#ifndef CONFIG_X86_64
-+
-+extern void local_kernel_thread_helper(void);
-+__asm__(".section .text\n"
-+ ".align 4\n"
-+ "local_kernel_thread_helper:\n\t"
-+ "movl %edx,%eax\n\t"
-+ "pushl %edx\n\t"
-+ "call *%ebx\n\t"
-+ "pushl %eax\n\t"
-+ "pushl $0\n\t"
-+ "call complete_and_exit\n"
-+ ".previous");
-+
-+/*
-+ * Create a kernel thread
-+ */
-+int asm_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags, pid_t pid)
-+{
-+ struct pt_regs regs;
-+
-+ memset(&regs, 0, sizeof(regs));
-+
-+ regs.ebx = (unsigned long) fn;
-+ regs.edx = (unsigned long) arg;
-+
-+ regs.xds = __USER_DS;
-+ regs.xes = __USER_DS;
-+ regs.orig_eax = -1;
-+ regs.eip = (unsigned long) local_kernel_thread_helper;
-+ regs.xcs = __KERNEL_CS;
-+ regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
-+
-+ /* Ok, create the new process.. */
-+ return do_fork_pid(flags | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL, pid);
-+}
-+#endif
-+
-+int local_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags, pid_t pid)
-+{
-+ pid_t ret;
-+
-+ if (current->fs == NULL) {
-+ /* do_fork_pid() hates processes without fs, oopses. */
-+ printk("CPT BUG: local_kernel_thread: current->fs==NULL\n");
-+ return -EINVAL;
-+ }
-+ if (!try_module_get(THIS_MODULE))
-+ return -EBUSY;
-+ ret = asm_kernel_thread(fn, arg, flags, pid);
-+ if (ret < 0)
-+ module_put(THIS_MODULE);
-+ return ret;
-+}
-+
-+#ifdef __i386__
-+int __execve(const char *file, char **argv, char **envp)
-+{
-+ long res;
-+ __asm__ volatile ("int $0x80"
-+ : "=a" (res)
-+ : "0" (__NR_execve),"b" ((long)(file)),"c" ((long)(argv)),
-+ "d" ((long)(envp)) : "memory");
-+ return (int)res;
-+}
-+#endif
-+
-+int sc_execve(char *cmd, char **argv, char **env)
-+{
-+ int ret;
-+#ifndef __i386__
-+ ret = execve(cmd, argv, env);
-+#else
-+ ret = __execve(cmd, argv, env);
-+#endif
-+ return ret;
-+}
-+
-+unsigned int test_cpu_caps()
-+{
-+ unsigned int flags = 0;
-+ if (boot_cpu_has(X86_FEATURE_CMOV))
-+ flags |= 1 << CPT_CPU_X86_CMOV;
-+ if (cpu_has_fxsr)
-+ flags |= 1 << CPT_CPU_X86_FXSR;
-+ if (cpu_has_xmm)
-+ flags |= 1 << CPT_CPU_X86_SSE;
-+#ifndef CONFIG_X86_64
-+ if (cpu_has_xmm2)
-+#endif
-+ flags |= 1 << CPT_CPU_X86_SSE2;
-+ if (cpu_has_mmx)
-+ flags |= 1 << CPT_CPU_X86_MMX;
-+ if (boot_cpu_has(X86_FEATURE_3DNOW))
-+ flags |= 1 << CPT_CPU_X86_3DNOW;
-+ if (boot_cpu_has(X86_FEATURE_3DNOWEXT))
-+ flags |= 1 << CPT_CPU_X86_3DNOW2;
-+ if (boot_cpu_has(X86_FEATURE_SEP))
-+ flags |= 1 << CPT_CPU_X86_SEP;
-+ if (boot_cpu_has(X86_FEATURE_SYSCALL))
-+ flags |= 1 << CPT_CPU_X86_SYSCALL;
-+#ifdef CONFIG_X86_64
-+ if (boot_cpu_has(X86_FEATURE_SYSCALL) &&
-+ boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
-+ flags |= 1 << CPT_CPU_X86_SYSCALL32;
-+#endif
-+ if (boot_cpu_has(X86_FEATURE_SEP)
-+#ifdef CONFIG_X86_64
-+ && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL
-+#endif
-+ )
-+ flags |= 1 << CPT_CPU_X86_SEP32;
-+#ifdef CONFIG_X86_64
-+ flags |= 1 << CPT_CPU_X86_EMT64;
-+#endif
-+ return flags;
-+}
-+
-+unsigned int test_kernel_config()
-+{
-+ unsigned int flags = 0;
-+#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
-+ flags |= 1 << CPT_KERNEL_CONFIG_PAE;
-+#endif
-+ return flags;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_kernel.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_kernel.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_kernel.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_kernel.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,159 @@
-+/* Interface to kernel vars which we had to _add_. */
-+
-+asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-+
-+
-+struct env_create_param2;
-+int real_env_create(envid_t veid, unsigned flags, u32 class_id,
-+ struct env_create_param2 *data, int datalen);
-+
-+struct ve_struct *get_ve_by_id(envid_t veid);
-+
-+#if defined(CONFIG_VZFS_FS) || defined(CONFIG_VZFS_FS_MODULE)
-+void vefs_track_force_stop(struct super_block *super);
-+
-+void vefs_track_notify(struct dentry *vdentry, int track_cow);
-+
-+struct dentry * vefs_replaced_dentry(struct dentry *de);
-+int vefs_is_renamed_dentry(struct dentry *vde, struct dentry *pde);
-+#else
-+static inline void vefs_track_force_stop(struct super_block *super) { };
-+
-+static inline void vefs_track_notify(struct dentry *vdentry, int track_cow) { };
-+#endif
-+
-+int __copy_page_range(struct vm_area_struct *vma, struct mm_struct *src,
-+ unsigned long address, size_t size);
-+
-+long do_fork_pid(unsigned long clone_flags,
-+ unsigned long stack_start,
-+ struct pt_regs *regs,
-+ unsigned long stack_size,
-+ int __user *parent_tidptr,
-+ int __user *child_tidptr,
-+ long pid0);
-+
-+void wait_for_all_aios(struct kioctx *ctx);
-+extern kmem_cache_t *kioctx_cachep;
-+extern void aio_kick_handler(void *);
-+
-+struct shmid_kernel;
-+struct msg_queue;
-+struct sem_array;
-+
-+int sysvipc_walk_msg(int (*func)(int, struct msg_queue*, void *), void *arg);
-+int sysvipc_walk_shm(int (*func)(struct shmid_kernel*, void *), void *arg);
-+struct file * sysvipc_setup_shm(key_t key, int shmid, size_t size, int shmflg);
-+int sysvipc_walk_sem(int (*func)(int, struct sem_array*, void *), void *arg);
-+int sysvipc_setup_sem(key_t key, int semid, size_t size, int semflg);
-+
-+#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
-+
-+extern long __sched nanosleep_restart(struct restart_block *restart);
-+extern long compat_nanosleep_restart(struct restart_block *restart);
-+
-+extern long do_fork_pid(unsigned long clone_flags,
-+ unsigned long stack_start,
-+ struct pt_regs *regs,
-+ unsigned long stack_size,
-+ int __user *parent_tidptr,
-+ int __user *child_tidptr,
-+ long pid);
-+
-+extern kmem_cache_t *sigqueue_cachep;
-+
-+extern struct or_calltable or_ipv4;
-+extern struct or_calltable or_ipv6;
-+extern struct tcp_func ipv6_mapped;
-+
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-+#define TASK_TRACED TASK_STOPPED
-+#define unix_peer(sk) ((sk)->sk_pair)
-+#define page_mapcount(pg) ((pg)->mapcount)
-+#else
-+#define unix_peer(sk) (unix_sk(sk)->peer)
-+#endif
-+
-+#ifdef CONFIG_X86_64
-+#define cpu_has_fxsr 1
-+#endif
-+
-+static inline void do_gettimespec(struct timespec *ts)
-+{
-+ struct timeval tv;
-+ do_gettimeofday(&tv);
-+ ts->tv_sec = tv.tv_sec;
-+ ts->tv_nsec = tv.tv_usec*1000;
-+}
-+
-+int local_kernel_thread(int (*fn)(void *),
-+ void * arg,
-+ unsigned long flags,
-+ pid_t pid);
-+int asm_kernel_thread(int (*fn)(void *),
-+ void * arg,
-+ unsigned long flags,
-+ pid_t pid);
-+
-+unsigned int test_cpu_caps(void);
-+unsigned int test_kernel_config(void);
-+
-+#define test_one_flag_old(src, dst, flag, message, ret) \
-+if (src & (1 << flag)) \
-+ if (!(dst & (1 << flag))) { \
-+ wprintk("Destination cpu does not have " message "\n"); \
-+ ret = 1; \
-+ }
-+#define test_one_flag(src, dst, flag, message, ret) \
-+if (src & (1 << flag)) \
-+ if (!(dst & (1 << flag))) { \
-+ eprintk_ctx("Destination cpu does not have " message "\n"); \
-+ ret = 1; \
-+ }
-+
-+#include <asm/div64.h>
-+
-+static inline long div_long_long_rem_signed(const long long dividend,
-+ const long divisor, long *remainder)
-+{
-+ long res;
-+
-+ if (unlikely(dividend < 0)) {
-+ res = -div_long_long_rem(-dividend, divisor, remainder);
-+ *remainder = -(*remainder);
-+ } else
-+ res = div_long_long_rem(dividend, divisor, remainder);
-+
-+ return res;
-+}
-+
-+static inline struct timespec _ns_to_timespec(const s64 nsec)
-+{
-+ struct timespec ts;
-+
-+ if (!nsec)
-+ return (struct timespec) {0, 0};
-+
-+ ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec);
-+ if (unlikely(nsec < 0))
-+ set_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec);
-+
-+ return ts;
-+}
-+
-+static inline long _ns_to_jiffies(s64 nsec)
-+{
-+ long jif, rem;
-+
-+#if BITS_PER_LONG == 32
-+ if (nsec > (s64)(MAX_SCHEDULE_TIMEOUT-1) * TICK_NSEC)
-+ nsec = (s64)(MAX_SCHEDULE_TIMEOUT-1) * TICK_NSEC;
-+ else if (nsec < -(s64)(MAX_SCHEDULE_TIMEOUT-1) * TICK_NSEC)
-+ nsec = -(s64)(MAX_SCHEDULE_TIMEOUT-1) * TICK_NSEC;
-+#endif
-+
-+ jif = div_long_long_rem_signed(nsec, TICK_NSEC, &rem);
-+
-+ return jif;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_mm.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_mm.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_mm.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_mm.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1018 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/hugetlb.h>
-+#include <linux/errno.h>
-+#include <linux/ve.h>
-+#include <linux/pagemap.h>
-+#include <linux/rmap.h>
-+#include <asm/ldt.h>
-+#include <asm/mmu.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_kernel.h"
-+#include "cpt_fsmagic.h"
-+#include "cpt_pagein.h"
-+#include "cpt_ubc.h"
-+
-+static int collect_one_mm(struct mm_struct *mm, cpt_context_t * ctx)
-+{
-+ struct vm_area_struct *vma;
-+
-+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
-+ if (vma->vm_file) {
-+ if (cpt_object_add(CPT_OBJ_FILE, vma->vm_file, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+ }
-+ if (cpt_add_ubc(mm_ub(mm), ctx) == NULL)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+int cpt_collect_mm(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+ int err;
-+ int index;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->mm && cpt_object_add(CPT_OBJ_MM, tsk->mm, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+
-+ index = 1;
-+ for_each_object(obj, CPT_OBJ_MM) {
-+ struct mm_struct *mm = obj->o_obj;
-+ if (obj->o_count != atomic_read(&mm->mm_users)) {
-+ eprintk_ctx("mm_struct is referenced outside %d %d\n", obj->o_count, atomic_read(&mm->mm_users));
-+ return -EAGAIN;
-+ }
-+ cpt_obj_setindex(obj, index++, ctx);
-+
-+ if ((err = collect_one_mm(mm, ctx)) != 0)
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+#if 0
-+static int page_is_zero(struct mm_struct *mm, struct page *page)
-+{
-+ char *maddr;
-+ int i;
-+
-+ page_cache_get(page);
-+ spin_unlock(&mm->page_table_lock);
-+
-+ maddr = kmap(page);
-+ for (i=0; i<PAGE_SIZE/sizeof(unsigned long); i++) {
-+ if (((unsigned long*)(maddr))[i])
-+ break;
-+ }
-+ kunmap(page);
-+
-+ page_cache_release(page);
-+ spin_lock(&mm->page_table_lock);
-+ return (i == PAGE_SIZE/sizeof(unsigned long));
-+}
-+#endif
-+
-+static int zcnt, scnt, scnt0, ucnt;
-+
-+/* Function where_is_anon_page() returns address of a anonymous page in mm
-+ * of already dumped process. This happens f.e. after fork(). We do not use
-+ * this right now, just keep statistics, it is diffucult to restore such state,
-+ * but the most direct use is to save space in dumped image. */
-+
-+static struct anon_vma *page_lock_anon_vma(struct page *page)
-+{
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ struct anon_vma *anon_vma = NULL;
-+ unsigned long anon_mapping;
-+
-+ rcu_read_lock();
-+ anon_mapping = (unsigned long) page->mapping;
-+ if (!(anon_mapping & PAGE_MAPPING_ANON))
-+ goto out;
-+ if (!page_mapped(page))
-+ goto out;
-+
-+ anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON);
-+ spin_lock(&anon_vma->lock);
-+out:
-+ rcu_read_unlock();
-+#else
-+ struct anon_vma *anon_vma = (struct anon_vma *) page->mapping;
-+
-+ spin_lock(&anon_vma->lock);
-+#endif
-+ return anon_vma;
-+}
-+
-+static inline unsigned long
-+vma_address0(struct page *page, struct vm_area_struct *vma)
-+{
-+ pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
-+ unsigned long address;
-+
-+ address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
-+ if (unlikely(address < vma->vm_start || address >= vma->vm_end))
-+ address |= 1;
-+ return address;
-+}
-+
-+static int really_this_one(struct vm_area_struct *vma, unsigned long address,
-+ struct page *page)
-+{
-+ struct mm_struct *mm = vma->vm_mm;
-+ pgd_t *pgd;
-+ pmd_t *pmd;
-+ pte_t *pte;
-+ int result;
-+
-+ pgd = pgd_offset(mm, address);
-+ if (unlikely(!pgd_present(*pgd)))
-+ return 0;
-+
-+ pmd = pmd_offset(pgd, address);
-+ if (unlikely(!pmd_present(*pmd)))
-+ return 0;
-+
-+ result = 0;
-+ pte = pte_offset_map(pmd, address);
-+ if (pte_present(*pte) &&
-+ page_to_pfn(page) == pte_pfn(*pte))
-+ result = 1;
-+ pte_unmap(pte);
-+ return result;
-+}
-+
-+static loff_t where_is_anon_page(cpt_object_t *mmobj, unsigned long mapaddr,
-+ struct page *page, cpt_context_t * ctx)
-+{
-+ loff_t mmptr = CPT_NULL;
-+ struct anon_vma *anon_vma;
-+ struct vm_area_struct *vma;
-+ int idx = mmobj->o_index;
-+
-+ if (!PageAnon(page))
-+ return CPT_NULL;
-+
-+ anon_vma = page_lock_anon_vma(page);
-+ if (!anon_vma)
-+ return CPT_NULL;
-+
-+ list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
-+ unsigned long addr = vma_address0(page, vma);
-+ cpt_object_t *obj;
-+
-+ /* We do not try to support mremapped regions (addr != mapaddr),
-+ * only mmaps directly inherited via fork().
-+ * With this limitation we may check self-consistency of
-+ * vmas (vm_start, vm_pgoff, anon_vma) before
-+ * doing __copy_page_range() in rst_mm.
-+ */
-+ if (mmobj->o_obj != vma->vm_mm && addr == mapaddr) {
-+ obj = lookup_cpt_object(CPT_OBJ_MM, vma->vm_mm, ctx);
-+ if (obj && obj->o_pos != CPT_NULL && obj->o_index < idx) {
-+ if (spin_trylock(&vma->vm_mm->page_table_lock)) {
-+ if (really_this_one(vma, addr, page)) {
-+ mmptr = obj->o_pos;
-+ idx = obj->o_index;
-+ }
-+ spin_unlock(&vma->vm_mm->page_table_lock);
-+ }
-+ }
-+ }
-+ }
-+ spin_unlock(&anon_vma->lock);
-+
-+ return mmptr;
-+}
-+
-+struct page_area
-+{
-+ int type;
-+ unsigned long start;
-+ unsigned long end;
-+ pgoff_t pgoff;
-+ loff_t mm;
-+ __u64 list[16];
-+};
-+
-+struct page_desc
-+{
-+ int type;
-+ pgoff_t index;
-+ loff_t mm;
-+ int shared;
-+};
-+
-+enum {
-+ PD_ABSENT,
-+ PD_COPY,
-+ PD_ZERO,
-+ PD_CLONE,
-+ PD_FUNKEY,
-+ PD_LAZY,
-+ PD_ITER,
-+ PD_ITERYOUNG,
-+};
-+
-+/* 0: page can be obtained from backstore, or still not mapped anonymous page,
-+ or something else, which does not requre copy.
-+ 1: page requires copy
-+ 2: page requres copy but its content is zero. Quite useless.
-+ 3: wp page is shared after fork(). It is to be COWed when modified.
-+ 4: page is something unsupported... We copy it right now.
-+ */
-+
-+
-+
-+static void page_get_desc(cpt_object_t *mmobj,
-+ struct vm_area_struct *vma, unsigned long addr,
-+ struct page_desc *pdesc, cpt_context_t * ctx)
-+{
-+ struct mm_struct *mm = vma->vm_mm;
-+ pgd_t *pgd;
-+ pmd_t *pmd;
-+ pte_t *ptep, pte;
-+ pgoff_t linear_index = (addr - vma->vm_start)/PAGE_SIZE + vma->vm_pgoff;
-+
-+ pdesc->index = linear_index;
-+ pdesc->shared = 0;
-+
-+ if (vma->vm_flags & VM_IO) {
-+ pdesc->type = PD_ABSENT;
-+ return;
-+ }
-+
-+ spin_lock(&mm->page_table_lock);
-+ pgd = pgd_offset(mm, addr);
-+ if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-+ goto out_absent;
-+ pmd = pmd_offset(pgd, addr);
-+ if (pmd_none(*pmd))
-+ goto out_absent;
-+ if (pmd_huge(*pmd)) {
-+ eprintk_ctx("page_huge\n");
-+ goto out_unsupported;
-+ }
-+ if (unlikely(pmd_bad(*pmd)))
-+ goto out_absent;
-+retry:
-+ ptep = pte_offset_map(pmd, addr);
-+ if (!ptep)
-+ goto out_absent;
-+ pte = *ptep;
-+ pte_unmap(ptep);
-+ if (pte_none(pte))
-+ goto out_absent;
-+
-+ if (!pte_present(pte)) {
-+ if (pte_file(pte)) {
-+ pdesc->index = pte_to_pgoff(pte);
-+ goto out_absent;
-+ }
-+ if (vma->vm_flags & VM_SHARED) {
-+ /* It is impossible: shared mappings cannot be in swap */
-+ eprintk_ctx("shared mapping is not present: %08lx@%Ld\n", addr, mmobj->o_pos);
-+ goto out_unsupported;
-+ }
-+
-+ /* Otherwise it is in swap. */
-+ if (!ctx->lazy_vm) {
-+ int err;
-+ /* If lazy transfer is not enabled,
-+ * raise it from swap now, so that we
-+ * save at least when the page is shared.
-+ */
-+ spin_unlock(&mm->page_table_lock);
-+ err = handle_mm_fault(mm, vma, addr, 0);
-+ if (err == VM_FAULT_SIGBUS)
-+ goto out_absent;
-+ if (err == VM_FAULT_OOM)
-+ goto out_absent;
-+ err = 0;
-+ spin_lock(&mm->page_table_lock);
-+ goto retry;
-+ }
-+ goto out_lazy;
-+ } else {
-+ unsigned long pfn;
-+ struct page *pg;
-+
-+ pfn = pte_pfn(pte);
-+ if (pfn_valid(pfn) && (pg = pfn_to_page(pfn)) != NULL) {
-+ if (pg->mapping && !PageAnon(pg)) {
-+ if (vma->vm_file == NULL) {
-+ eprintk_ctx("pg->mapping!=NULL for fileless vma: %08lx\n", addr);
-+ goto out_unsupported;
-+ }
-+ if (vma->vm_file->f_mapping != pg->mapping) {
-+ eprintk_ctx("pg->mapping!=f_mapping: %08lx %p %p %Ld\n", addr, vma->vm_file->f_mapping, pg->mapping, mmobj->o_pos);
-+ goto out_unsupported;
-+ }
-+ pdesc->index = (pg->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT));
-+ /* Page is in backstore. For us it is like
-+ * it is not present.
-+ */
-+ goto out_absent;
-+ }
-+
-+ if (PageReserved(pg)) {
-+ /* Special case: ZERO_PAGE is used, when an
-+ * anonymous page is accessed but not written. */
-+ if (pg == ZERO_PAGE(addr)) {
-+ if (pte_write(pte)) {
-+ eprintk_ctx("not funny already, writable ZERO_PAGE\n");
-+ goto out_unsupported;
-+ }
-+ zcnt++;
-+ goto out_absent;
-+ }
-+ eprintk_ctx("reserved page %lu at %08lx@%Ld\n", pg->index, addr, mmobj->o_pos);
-+ goto out_unsupported;
-+ }
-+
-+ if (!pg->mapping) {
-+ eprintk_ctx("page without mapping at %08lx@%Ld\n", addr, mmobj->o_pos);
-+ goto out_unsupported;
-+ }
-+
-+ if (pg->mapping && page_mapcount(pg) > 1) {
-+ pdesc->shared = 1;
-+ pdesc->mm = where_is_anon_page(mmobj, addr, pg, ctx);
-+ if (pdesc->mm != CPT_NULL) {
-+ scnt0++;
-+ goto out_clone;
-+ } else {
-+ scnt++;
-+ }
-+ }
-+
-+ if (ctx->iter_done &&
-+ test_bit(PG_checkpointed, &pg->flags)) {
-+ if (pte_write(pte)) {
-+ wprintk_ctx("writable PG_checkpointed page\n");
-+ }
-+ pdesc->index = page_to_pfn(pg);
-+ goto out_iter;
-+ }
-+
-+ if (!pte_young(pte))
-+ goto out_lazy;
-+ }
-+ }
-+ spin_unlock(&mm->page_table_lock);
-+ pdesc->type = PD_COPY;
-+ return;
-+
-+out_iter:
-+ pdesc->type = pte_young(pte) ? PD_ITERYOUNG : PD_ITER;
-+ spin_unlock(&mm->page_table_lock);
-+ return;
-+
-+out_lazy:
-+ spin_unlock(&mm->page_table_lock);
-+ pdesc->type = PD_LAZY;
-+ return;
-+
-+out_absent:
-+ spin_unlock(&mm->page_table_lock);
-+ pdesc->type = PD_ABSENT;
-+ return;
-+
-+out_clone:
-+ spin_unlock(&mm->page_table_lock);
-+ pdesc->type = PD_CLONE;
-+ return;
-+
-+out_unsupported:
-+ spin_unlock(&mm->page_table_lock);
-+ ucnt++;
-+ pdesc->type = PD_FUNKEY;
-+ return;
-+}
-+
-+/* ATTN: We give "current" to get_user_pages(). This is wrong, but get_user_pages()
-+ * does not really need this thing. It just stores some page fault stats there.
-+ *
-+ * BUG: some archs (f.e. sparc64, but not Intel*) require flush cache pages
-+ * before accessing vma.
-+ */
-+void dump_pages(struct vm_area_struct *vma, unsigned long start,
-+ unsigned long end, struct cpt_context *ctx)
-+{
-+#define MAX_PAGE_BATCH 16
-+ struct page *pg[MAX_PAGE_BATCH];
-+ int npages = (end - start)/PAGE_SIZE;
-+ int count = 0;
-+
-+ while (count < npages) {
-+ int copy = npages - count;
-+ int n;
-+
-+ if (copy > MAX_PAGE_BATCH)
-+ copy = MAX_PAGE_BATCH;
-+ n = get_user_pages(current, vma->vm_mm, start, copy,
-+ 0, 1, pg, NULL);
-+ if (n == copy) {
-+ int i;
-+ for (i=0; i<n; i++) {
-+ char *maddr = kmap(pg[i]);
-+ ctx->write(maddr, PAGE_SIZE, ctx);
-+ kunmap(pg[i]);
-+ }
-+ } else {
-+ eprintk_ctx("get_user_pages fault");
-+ for ( ; n > 0; n--)
-+ page_cache_release(pg[n-1]);
-+ return;
-+ }
-+ start += n*PAGE_SIZE;
-+ count += n;
-+ for ( ; n > 0; n--)
-+ page_cache_release(pg[n-1]);
-+ }
-+ return;
-+}
-+
-+int dump_page_block(struct vm_area_struct *vma, struct cpt_page_block *pgb,
-+ int copy,
-+ struct cpt_context *ctx)
-+{
-+ loff_t saved_object;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ pgb->cpt_object = (copy != PD_LAZY) ? CPT_OBJ_PAGES : CPT_OBJ_LAZYPAGES;
-+ pgb->cpt_hdrlen = sizeof(*pgb);
-+ pgb->cpt_content = (copy == PD_COPY || copy == PD_LAZY) ? CPT_CONTENT_DATA : CPT_CONTENT_VOID;
-+
-+ ctx->write(pgb, sizeof(*pgb), ctx);
-+ if (copy == PD_COPY || copy == PD_LAZY)
-+ dump_pages(vma, pgb->cpt_start, pgb->cpt_end, ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+int dump_remappage_block(struct vm_area_struct *vma, struct page_area *pa,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_remappage_block pgb;
-+ loff_t saved_object;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ pgb.cpt_object = CPT_OBJ_REMAPPAGES;
-+ pgb.cpt_hdrlen = sizeof(pgb);
-+ pgb.cpt_content = CPT_CONTENT_VOID;
-+ pgb.cpt_start = pa->start;
-+ pgb.cpt_end = pa->end;
-+ pgb.cpt_pgoff = pa->pgoff - (pa->end-pa->start)/PAGE_SIZE + 1;
-+
-+ ctx->write(&pgb, sizeof(pgb), ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+int dump_copypage_block(struct vm_area_struct *vma, struct page_area *pa,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_copypage_block pgb;
-+ loff_t saved_object;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ pgb.cpt_object = CPT_OBJ_COPYPAGES;
-+ pgb.cpt_hdrlen = sizeof(pgb);
-+ pgb.cpt_content = CPT_CONTENT_VOID;
-+ pgb.cpt_start = pa->start;
-+ pgb.cpt_end = pa->end;
-+ pgb.cpt_source = pa->mm;
-+
-+ ctx->write(&pgb, sizeof(pgb), ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+#define IDX_PER_PAGE (PAGE_SIZE/sizeof(struct pagein_desc))
-+
-+int alloc_pgin_index(struct vm_area_struct *vma, unsigned long addr, int npg,
-+ cpt_context_t *ctx)
-+{
-+ u32 index, i;
-+
-+ index = ctx->lazypages;
-+ ctx->lazypages += npg;
-+
-+ if (unlikely(ctx->pgin_dir == NULL)) {
-+ ctx->pgin_dir = (struct pagein_desc**)__get_free_page(GFP_KERNEL);
-+ if (ctx->pgin_dir == NULL)
-+ return -ENOMEM;
-+ memset(ctx->pgin_dir, 0, PAGE_SIZE);
-+ }
-+
-+ for (i = index; i < index + npg; i++) {
-+ u32 page_nr = i/IDX_PER_PAGE;
-+
-+ if (page_nr > PAGE_SIZE/sizeof(struct pgin_desc*)) {
-+ eprintk_ctx("pgin swap space overflow\n");
-+ return -ENOSPC;
-+ }
-+
-+ if (unlikely(ctx->pgin_dir[page_nr] == NULL)) {
-+ ctx->pgin_dir[page_nr] = (struct pagein_desc*)__get_free_page(GFP_KERNEL);
-+ if (ctx->pgin_dir[page_nr] == NULL)
-+ return -ENOMEM;
-+ memset(ctx->pgin_dir[page_nr], 0, PAGE_SIZE);
-+ }
-+
-+ ctx->pgin_dir[page_nr][i%IDX_PER_PAGE].mm = vma->vm_mm;
-+ ctx->pgin_dir[page_nr][i%IDX_PER_PAGE].offset = addr;
-+ addr += PAGE_SIZE;
-+ }
-+
-+ return index;
-+}
-+
-+int dump_lazypage_block(struct vm_area_struct *vma, struct page_area *pa,
-+ cpt_context_t *ctx)
-+{
-+ struct cpt_lazypage_block pgb;
-+ loff_t saved_object;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ pgb.cpt_object = CPT_OBJ_LAZYPAGES;
-+ pgb.cpt_hdrlen = sizeof(pgb);
-+ pgb.cpt_content = CPT_CONTENT_VOID;
-+ pgb.cpt_start = pa->start;
-+ pgb.cpt_end = pa->end;
-+ pgb.cpt_index = alloc_pgin_index(vma, pa->start,
-+ (pa->end-pa->start)/PAGE_SIZE, ctx);
-+ ctx->write(&pgb, sizeof(pgb), ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+
-+int dump_iterpage_block(struct vm_area_struct *vma, struct page_area *pa,
-+ cpt_context_t *ctx)
-+{
-+ struct cpt_iterpage_block pgb;
-+ loff_t saved_object;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ pgb.cpt_object = pa->type == PD_ITER ? CPT_OBJ_ITERPAGES :
-+ CPT_OBJ_ITERYOUNGPAGES;
-+ pgb.cpt_hdrlen = sizeof(pgb);
-+ pgb.cpt_content = CPT_CONTENT_VOID;
-+ pgb.cpt_start = pa->start;
-+ pgb.cpt_end = pa->end;
-+ ctx->write(&pgb, sizeof(pgb), ctx);
-+
-+ ctx->write(pa->list, 8*((pa->end-pa->start)/PAGE_SIZE), ctx);
-+
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+
-+static int can_expand(struct page_area *pa, struct page_desc *pd)
-+{
-+ if (pa->start == pa->end)
-+ return 1;
-+ if (pa->type != pd->type)
-+ return 0;
-+ if (pa->type == PD_ITER || pa->type == PD_ITERYOUNG) {
-+ if (pa->end - pa->start >= PAGE_SIZE*16)
-+ return 0;
-+ pa->list[(pa->end - pa->start)/PAGE_SIZE] = pd->index;
-+ }
-+ if (pa->type == PD_ABSENT)
-+ return pd->index == pa->pgoff + 1;
-+ if (pa->type == PD_CLONE)
-+ return pd->mm == pa->mm;
-+ return 1;
-+}
-+
-+static int dump_one_vma(cpt_object_t *mmobj,
-+ struct vm_area_struct *vma, struct cpt_context *ctx)
-+{
-+ struct cpt_vma_image *v = cpt_get_buf(ctx);
-+ unsigned long addr;
-+ loff_t saved_object;
-+ struct cpt_page_block pgb;
-+ struct page_area pa;
-+ int cloned_pages = 0;
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ v->cpt_object = CPT_OBJ_VMA;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_start = vma->vm_start;
-+ v->cpt_end = vma->vm_end;
-+ v->cpt_flags = vma->vm_flags;
-+ if (vma->vm_flags&VM_HUGETLB) {
-+ eprintk_ctx("huge TLB VMAs are still not supported\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_pgprot = vma->vm_page_prot.pgprot;
-+ v->cpt_pgoff = vma->vm_pgoff;
-+ v->cpt_file = CPT_NULL;
-+ if ((void *)vma->vm_start == vma->vm_mm->context.vdso &&
-+ vma->vm_ops == &vsyscall_vm_ops)
-+ v->cpt_type = CPT_VMA_VDSO;
-+ else
-+ v->cpt_type = CPT_VMA_TYPE_0;
-+ v->cpt_anonvma = 0;
-+
-+ /* We have to remember what VMAs are bound to one anon_vma.
-+ * So, we store an identifier of group of VMAs. It is handy
-+ * to use absolute address of anon_vma as this identifier. */
-+ v->cpt_anonvmaid = (unsigned long)vma->anon_vma;
-+
-+ if (vma->vm_file) {
-+ struct file *filp;
-+ cpt_object_t *obj = lookup_cpt_object(CPT_OBJ_FILE, vma->vm_file, ctx);
-+ if (obj == NULL) BUG();
-+ filp = obj->o_obj;
-+ if (filp->f_op &&
-+ filp->f_op->read == NULL &&
-+ filp->f_dentry->d_inode->i_sb->s_magic == FSMAGIC_TMPFS)
-+ v->cpt_type = CPT_VMA_TYPE_SHM;
-+ v->cpt_file = obj->o_pos;
-+ }
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ if (v->cpt_type == CPT_VMA_VDSO)
-+ goto out;
-+
-+ pa.type = PD_ABSENT;
-+ pa.pgoff = vma->vm_pgoff;
-+ pa.mm = CPT_NULL;
-+ pa.start = vma->vm_start;
-+ pa.end = vma->vm_start;
-+
-+ for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) {
-+ struct page_desc pd;
-+
-+ page_get_desc(mmobj, vma, addr, &pd, ctx);
-+ cloned_pages += pd.shared;
-+
-+ if (pd.type == PD_FUNKEY) {
-+ eprintk_ctx("dump_one_vma: funkey page\n");
-+ return -EINVAL;
-+ }
-+
-+ if (pd.type == PD_LAZY &&
-+ (ctx->lazy_vm == 0 || (vma->vm_flags&VM_LOCKED)))
-+ pd.type = PD_COPY;
-+
-+ if (!can_expand(&pa, &pd)) {
-+ if (pa.type == PD_COPY ||
-+ pa.type == PD_ZERO) {
-+ pgb.cpt_start = pa.start;
-+ pgb.cpt_end = pa.end;
-+ dump_page_block(vma, &pgb, pa.type, ctx);
-+ } else if (pa.type == PD_CLONE) {
-+ dump_copypage_block(vma, &pa, ctx);
-+ cloned_pages++;
-+ } else if (pa.type == PD_LAZY) {
-+ dump_lazypage_block(vma, &pa, ctx);
-+ } else if (pa.type == PD_ITER || pa.type == PD_ITERYOUNG) {
-+ dump_iterpage_block(vma, &pa, ctx);
-+ cloned_pages++;
-+ } else if (pa.type == PD_ABSENT &&
-+ pa.pgoff != (pa.end - vma->vm_start)/PAGE_SIZE + vma->vm_pgoff - 1) {
-+ dump_remappage_block(vma, &pa, ctx);
-+ }
-+ pa.start = addr;
-+ }
-+ pa.type = pd.type;
-+ pa.end = addr + PAGE_SIZE;
-+ pa.pgoff = pd.index;
-+ if (addr == pa.start)
-+ pa.list[0] = pd.index;
-+ pa.mm = pd.mm;
-+ }
-+
-+ if (pa.end > pa.start) {
-+ if (pa.type == PD_COPY ||
-+ pa.type == PD_ZERO) {
-+ pgb.cpt_start = pa.start;
-+ pgb.cpt_end = pa.end;
-+ dump_page_block(vma, &pgb, pa.type, ctx);
-+ } else if (pa.type == PD_CLONE) {
-+ dump_copypage_block(vma, &pa, ctx);
-+ cloned_pages++;
-+ } else if (pa.type == PD_LAZY) {
-+ dump_lazypage_block(vma, &pa, ctx);
-+ } else if (pa.type == PD_ITER || pa.type == PD_ITERYOUNG) {
-+ dump_iterpage_block(vma, &pa, ctx);
-+ cloned_pages++;
-+ } else if (pa.type == PD_ABSENT &&
-+ pa.pgoff != (pa.end - vma->vm_start)/PAGE_SIZE + vma->vm_pgoff - 1) {
-+ dump_remappage_block(vma, &pa, ctx);
-+ }
-+ }
-+
-+ if (cloned_pages) {
-+ __u32 anonvma = 1;
-+ loff_t anonpos = ctx->current_object + offsetof(struct cpt_vma_image, cpt_anonvma);
-+ ctx->pwrite(&anonvma, 4, ctx, anonpos);
-+ }
-+
-+out:
-+ cpt_close_object(ctx);
-+
-+ cpt_pop_object(&saved_object, ctx);
-+
-+ return 0;
-+}
-+
-+static int dump_one_aio_ctx(struct mm_struct *mm, struct kioctx *aio_ctx,
-+ cpt_context_t *ctx)
-+{
-+ loff_t saved_object;
-+ struct cpt_aio_ctx_image aimg;
-+
-+ if (!list_empty(&aio_ctx->run_list)) {
-+ /* This is impossible at least with kernel 2.6.8.1. */
-+ eprintk_ctx("run list is not empty, cannot suspend AIO\n");
-+ return -EBUSY;
-+ }
-+
-+ /* Wait for pending IOCBs. Linux AIO is mostly _fake_.
-+ * It is acltaully synchronous, except for direct IO and
-+ * some funny raw USB things, which cannot happen inside VE.
-+ * However, we do this for future.
-+ */
-+ wait_for_all_aios(aio_ctx);
-+
-+ if (!list_empty(&aio_ctx->run_list) ||
-+ !list_empty(&aio_ctx->active_reqs) ||
-+ aio_ctx->reqs_active) {
-+ eprintk_ctx("were not able to suspend AIO\n");
-+ return -EBUSY;
-+ }
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ aimg.cpt_next = CPT_ALIGN(sizeof(aimg));
-+ aimg.cpt_object = CPT_OBJ_AIO_CONTEXT;
-+ aimg.cpt_hdrlen = sizeof(aimg);
-+ aimg.cpt_content = CPT_CONTENT_ARRAY;
-+
-+ aimg.cpt_max_reqs = aio_ctx->max_reqs;
-+ aimg.cpt_ring_pages = aio_ctx->ring_info.nr_pages;
-+ aimg.cpt_nr = aio_ctx->ring_info.nr;
-+ aimg.cpt_tail = aio_ctx->ring_info.tail;
-+ aimg.cpt_mmap_base = aio_ctx->ring_info.mmap_base;
-+
-+ ctx->write(&aimg, sizeof(aimg), ctx);
-+
-+ cpt_pop_object(&saved_object, ctx);
-+ return 0;
-+}
-+
-+static int dump_one_mm(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct mm_struct *mm = obj->o_obj;
-+ struct vm_area_struct *vma;
-+ struct cpt_mm_image *v = cpt_get_buf(ctx);
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = -1;
-+ v->cpt_object = CPT_OBJ_MM;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_start_code = mm->start_code;
-+ v->cpt_end_code = mm->end_code;
-+ v->cpt_start_data = mm->start_data;
-+ v->cpt_end_data = mm->end_data;
-+ v->cpt_start_brk = mm->start_brk;
-+ v->cpt_brk = mm->brk;
-+ v->cpt_start_stack = mm->start_stack;
-+ v->cpt_start_arg = mm->arg_start;
-+ v->cpt_end_arg = mm->arg_end;
-+ v->cpt_start_env = mm->env_start;
-+ v->cpt_end_env = mm->env_end;
-+ v->cpt_def_flags = mm->def_flags;
-+ v->cpt_mmub = cpt_lookup_ubc(mm_ub(mm), ctx);
-+ v->cpt_dumpable = mm->dumpable;
-+ v->cpt_vps_dumpable = mm->vps_dumpable;
-+ v->cpt_used_hugetlb = 0;
-+#ifdef CONFIG_HUGETLB_PAGE
-+ v->cpt_used_hugetlb = mm->used_hugetlb;
-+#endif
-+ v->cpt_vdso = (__u32)(unsigned long)mm->context.vdso;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ if (mm->context.size) {
-+ loff_t saved_object;
-+ struct cpt_obj_bits b;
-+ int size;
-+#ifndef CONFIG_X86_64
-+ int i;
-+#endif
-+
-+ dprintk_ctx("nontrivial LDT\n");
-+
-+ cpt_push_object(&saved_object, ctx);
-+
-+ cpt_open_object(NULL, ctx);
-+ b.cpt_next = CPT_NULL;
-+ b.cpt_object = CPT_OBJ_BITS;
-+ b.cpt_hdrlen = sizeof(b);
-+ b.cpt_content = CPT_CONTENT_MM_CONTEXT;
-+ b.cpt_size = mm->context.size*LDT_ENTRY_SIZE;
-+
-+ ctx->write(&b, sizeof(b), ctx);
-+
-+ size = mm->context.size*LDT_ENTRY_SIZE;
-+
-+#ifdef CONFIG_X86_64
-+ ctx->write(mm->context.ldt, size, ctx);
-+#else
-+ for (i = 0; i < size; i += PAGE_SIZE) {
-+ int nr = i / PAGE_SIZE, bytes;
-+ char *kaddr = kmap(mm->context.ldt_pages[nr]);
-+
-+ bytes = size - i;
-+ if (bytes > PAGE_SIZE)
-+ bytes = PAGE_SIZE;
-+ ctx->write(kaddr, bytes, ctx);
-+ kunmap(mm->context.ldt_pages[nr]);
-+ }
-+#endif
-+
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_object, ctx);
-+ }
-+
-+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
-+ int err;
-+
-+ if ((err = dump_one_vma(obj, vma, ctx)) != 0)
-+ return err;
-+ }
-+
-+ if (mm->ioctx_list) {
-+ struct kioctx *aio_ctx;
-+ int err;
-+
-+ for (aio_ctx = mm->ioctx_list; aio_ctx; aio_ctx = aio_ctx->next)
-+ if ((err = dump_one_aio_ctx(mm, aio_ctx, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+
-+int cpt_dump_vm(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ scnt = scnt0 = zcnt = 0;
-+
-+ cpt_open_section(ctx, CPT_SECT_MM);
-+
-+ for_each_object(obj, CPT_OBJ_MM) {
-+ int err;
-+
-+ if ((err = dump_one_mm(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+
-+ if (scnt)
-+ dprintk_ctx("cpt_dump_vm: %d shared private anon pages\n", scnt);
-+ if (scnt0)
-+ dprintk_ctx("cpt_dump_vm: %d anon pages are cloned\n", scnt0);
-+ if (zcnt)
-+ dprintk_ctx("cpt_dump_vm: %d silly pages canceled\n", zcnt);
-+ return 0;
-+}
-+
-+int scan_one_task(task_t *p)
-+{
-+ struct mm_struct *mm = get_task_mm(p);
-+ unsigned long addr;
-+ int young = 0;
-+
-+ if (unlikely(mm == NULL))
-+ return 0;
-+
-+ spin_lock(&mm->page_table_lock);
-+ for (addr = 0; addr < TASK_SIZE; addr += PGDIR_SIZE) {
-+ pgd_t * pgd = pgd_offset(mm, addr);
-+ unsigned long addr2;
-+
-+ if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-+ continue;
-+
-+ for (addr2 = addr; addr2 < addr + PGDIR_SIZE; addr2 += PMD_SIZE) {
-+ pmd_t * pmd = pmd_offset(pgd, addr2);
-+ unsigned long addr3;
-+
-+ if (pmd_none(*pmd) || pmd_huge(*pmd) || unlikely(pmd_bad(*pmd)))
-+ continue;
-+
-+ for (addr3 = addr2; addr3 < addr2 + PMD_SIZE; addr3 += PAGE_SIZE) {
-+ pte_t *pte = pte_offset_map(pmd, addr3);
-+ if (!pte)
-+ continue;
-+ if (pte_present(*pte) &&
-+ ptep_test_and_clear_young(pte))
-+ young++;
-+ pte_unmap(pte);
-+ }
-+ }
-+ }
-+ spin_unlock(&mm->page_table_lock);
-+ mmput(mm);
-+ return young;
-+}
-+
-+int cpt_mm_prepare(unsigned long veid)
-+{
-+ task_t *p;
-+ struct ve_struct *env;
-+ int young_tot = 0;
-+
-+ env = get_ve_by_id(veid);
-+ if (env == NULL)
-+ return -ESRCH;
-+
-+ write_lock_irq(&tasklist_lock);
-+
-+ /* The idea is to take task from tail of list and relink it
-+ * to the head. Then we can release tasklist lock. Stop condition
-+ * is when this task is init_entry, which is supposed to stay
-+ * at the head of list in normal state.
-+ *
-+ * If someone else is messing with the list, we will miss some
-+ * tasks. If it is another cpt_mm_prepare(), the work will be
-+ * done anyway.
-+ */
-+ do {
-+ /* VE is empty, stop scanning. */
-+ if (list_empty(&env->vetask_lh))
-+ break;
-+
-+ p = VE_TASK_LIST_2_TASK(env->vetask_lh.prev);
-+ REMOVE_VE_LINKS(p);
-+ list_add(&VE_TASK_INFO(p)->vetask_list, &env->vetask_lh);
-+
-+ get_task_struct(p);
-+ write_unlock_irq(&tasklist_lock);
-+
-+ young_tot += scan_one_task(p);
-+
-+ put_task_struct(p);
-+
-+ cond_resched();
-+
-+ write_lock_irq(&tasklist_lock);
-+ } while (p != env->init_entry);
-+
-+ write_unlock_irq(&tasklist_lock);
-+
-+ put_ve(env);
-+
-+ return young_tot;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_mm.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_mm.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_mm.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_mm.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,40 @@
-+int cpt_collect_mm(cpt_context_t *);
-+
-+int cpt_dump_vm(struct cpt_context *ctx);
-+
-+__u32 rst_mm_flag(struct cpt_task_image *ti, struct cpt_context *ctx);
-+int rst_mm_basic(cpt_object_t *obj, struct cpt_task_image *ti, struct cpt_context *ctx);
-+int rst_mm_complete(struct cpt_task_image *ti, struct cpt_context *ctx);
-+
-+int cpt_mm_prepare(unsigned long veid);
-+
-+int cpt_free_pgin_dir(struct cpt_context *);
-+int cpt_start_pagein(struct cpt_context *);
-+int rst_setup_pagein(struct cpt_context *);
-+int rst_complete_pagein(struct cpt_context *, int);
-+int rst_pageind(struct cpt_context *);
-+int rst_swapoff(struct cpt_context *);
-+int cpt_iteration(cpt_context_t *ctx);
-+int rst_iteration(cpt_context_t *ctx);
-+void rst_drop_iter_dir(cpt_context_t *ctx);
-+int rst_iter(struct vm_area_struct *vma, u64 pfn,
-+ unsigned long addr, cpt_context_t * ctx);
-+
-+extern int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack,
-+ unsigned long map_address);
-+
-+#ifdef CONFIG_X86_64
-+extern char *syscall32_page;
-+extern struct vm_operations_struct syscall32_vm_ops;
-+#define vsyscall_addr syscall32_page
-+#define vsyscall_vm_ops syscall32_vm_ops
-+#define SYSEXIT_RETURN VSYSCALL32_SYSEXIT
-+#else
-+extern struct page *sysenter_page;
-+extern struct vm_operations_struct special_mapping_vmops;
-+#define vsyscall_addr page_address(sysenter_page)
-+#define vsyscall_vm_ops special_mapping_vmops
-+extern void SYSENTER_RETURN_OFFSET;
-+#define SYSEXIT_RETURN (current->mm->context.vdso + \
-+ (unsigned long)&SYSENTER_RETURN_OFFSET)
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_net.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_net.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_net.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_net.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,359 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/netdevice.h>
-+#include <linux/inetdevice.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/ve.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/cpt_image.h>
-+#include <linux/nfcalls.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_kernel.h"
-+#include "cpt_syscalls.h"
-+
-+int cpt_dump_link(struct cpt_context * ctx)
-+{
-+ struct net_device *dev;
-+
-+ cpt_open_section(ctx, CPT_SECT_NET_DEVICE);
-+ for (dev = dev_base; dev; dev = dev->next) {
-+ struct cpt_netdev_image v;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NET_DEVICE;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_VOID;
-+
-+ v.cpt_index = dev->ifindex;
-+ v.cpt_flags = dev->flags;
-+ memcpy(v.cpt_name, dev->name, IFNAMSIZ);
-+ ctx->write(&v, sizeof(v), ctx);
-+ cpt_close_object(ctx);
-+
-+ if (dev != get_exec_env()->_loopback_dev &&
-+#if defined(CONFIG_VE_ETHDEV) || defined(CONFIG_VE_ETHDEV_MODULE)
-+ dev->open != vz_veth_open &&
-+#endif
-+ dev != get_exec_env()->_venet_dev) {
-+ eprintk_ctx("unsupported netdevice %s\n", dev->name);
-+ cpt_close_section(ctx);
-+ return -EBUSY;
-+ }
-+ }
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+int cpt_suspend_network(struct cpt_context *ctx)
-+{
-+ get_exec_env()->disable_net = 1;
-+ synchronize_net();
-+ return 0;
-+}
-+
-+int cpt_resume_network(struct cpt_context *ctx)
-+{
-+ struct ve_struct *env;
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+ env->disable_net = 0;
-+ put_ve(env);
-+ return 0;
-+}
-+
-+int cpt_dump_ifaddr(struct cpt_context * ctx)
-+{
-+ struct net_device *dev;
-+
-+ cpt_open_section(ctx, CPT_SECT_NET_IFADDR);
-+ for (dev = dev_base; dev; dev = dev->next) {
-+ struct in_device *idev = in_dev_get(dev);
-+ struct in_ifaddr *ifa;
-+
-+ if (!idev)
-+ continue;
-+
-+ for (ifa = idev->ifa_list; ifa; ifa = ifa->ifa_next) {
-+ struct cpt_ifaddr_image v;
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NET_IFADDR;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_VOID;
-+
-+ v.cpt_index = dev->ifindex;
-+ v.cpt_family = AF_INET;
-+ v.cpt_masklen = ifa->ifa_prefixlen;
-+ v.cpt_flags = ifa->ifa_flags;
-+ v.cpt_scope = ifa->ifa_scope;
-+ memset(&v.cpt_address, 0, sizeof(v.cpt_address));
-+ memset(&v.cpt_peer, 0, sizeof(v.cpt_peer));
-+ memset(&v.cpt_broadcast, 0, sizeof(v.cpt_broadcast));
-+ v.cpt_address[0] = ifa->ifa_local;
-+ v.cpt_peer[0] = ifa->ifa_address;
-+ v.cpt_broadcast[0] = ifa->ifa_broadcast;
-+ memcpy(v.cpt_label, ifa->ifa_label, IFNAMSIZ);
-+ ctx->write(&v, sizeof(v), ctx);
-+ cpt_close_object(ctx);
-+ }
-+ in_dev_put(idev);
-+ }
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int cpt_dump_route(struct cpt_context * ctx)
-+{
-+ int err;
-+ struct socket *sock;
-+ struct msghdr msg;
-+ struct iovec iov;
-+ struct {
-+ struct nlmsghdr nlh;
-+ struct rtgenmsg g;
-+ } req;
-+ struct sockaddr_nl nladdr;
-+ struct cpt_object_hdr v;
-+ mm_segment_t oldfs;
-+ char *pg;
-+
-+ err = sock_create_kern(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
-+ if (err)
-+ return err;
-+
-+ memset(&nladdr, 0, sizeof(nladdr));
-+ nladdr.nl_family = AF_NETLINK;
-+
-+ req.nlh.nlmsg_len = sizeof(req);
-+ req.nlh.nlmsg_type = RTM_GETROUTE;
-+ req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
-+ req.nlh.nlmsg_pid = 0;
-+ req.g.rtgen_family = AF_INET;
-+
-+ iov.iov_base=&req;
-+ iov.iov_len=sizeof(req);
-+ msg.msg_name=&nladdr;
-+ msg.msg_namelen=sizeof(nladdr);
-+ msg.msg_iov=&iov;
-+ msg.msg_iovlen=1;
-+ msg.msg_control=NULL;
-+ msg.msg_controllen=0;
-+ msg.msg_flags=MSG_DONTWAIT;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = sock_sendmsg(sock, &msg, sizeof(req));
-+ set_fs(oldfs);
-+
-+ if (err < 0)
-+ goto out_sock;
-+
-+ pg = (char*)__get_free_page(GFP_KERNEL);
-+ if (pg == NULL) {
-+ err = -ENOMEM;
-+ goto out_sock;
-+ }
-+
-+ cpt_open_section(ctx, CPT_SECT_NET_ROUTE);
-+ cpt_open_object(NULL, ctx);
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NET_ROUTE;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_NLMARRAY;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+
-+ for (;;) {
-+ struct nlmsghdr *h;
-+
-+ iov.iov_base = pg;
-+ iov.iov_len = PAGE_SIZE;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT);
-+ set_fs(oldfs);
-+
-+ if (err < 0)
-+ goto out_sock_pg;
-+ if (msg.msg_flags & MSG_TRUNC) {
-+ err = -ENOBUFS;
-+ goto out_sock_pg;
-+ }
-+
-+ h = (struct nlmsghdr*)pg;
-+ while (NLMSG_OK(h, err)) {
-+ if (h->nlmsg_type == NLMSG_DONE) {
-+ err = 0;
-+ goto done;
-+ }
-+ if (h->nlmsg_type == NLMSG_ERROR) {
-+ struct nlmsgerr *errm = (struct nlmsgerr*)NLMSG_DATA(h);
-+ err = errm->error;
-+ eprintk_ctx("NLMSG error: %d\n", errm->error);
-+ goto done;
-+ }
-+ if (h->nlmsg_type != RTM_NEWROUTE) {
-+ eprintk_ctx("NLMSG: %d\n", h->nlmsg_type);
-+ err = -EINVAL;
-+ goto done;
-+ }
-+ ctx->write(h, NLMSG_ALIGN(h->nlmsg_len), ctx);
-+ h = NLMSG_NEXT(h, err);
-+ }
-+ if (err) {
-+ eprintk_ctx("!!!Remnant of size %d %d %d\n", err, h->nlmsg_len, h->nlmsg_type);
-+ err = -EINVAL;
-+ break;
-+ }
-+ }
-+done:
-+ cpt_close_object(ctx);
-+ cpt_close_section(ctx);
-+
-+out_sock_pg:
-+ free_page((unsigned long)pg);
-+out_sock:
-+ sock_release(sock);
-+ return err;
-+}
-+
-+static int dumpfn(void *arg)
-+{
-+ int i;
-+ int *pfd = arg;
-+ char *argv[] = { "iptables-save", "-c", NULL };
-+
-+ i = real_env_create(VEID(get_exec_env()), VE_ENTER|VE_SKIPLOCK, 2, NULL, 0);
-+ if (i < 0) {
-+ eprintk("cannot enter ve to dump iptables\n");
-+ module_put(THIS_MODULE);
-+ return 1;
-+ }
-+
-+ if (pfd[1] != 1)
-+ sc_dup2(pfd[1], 1);
-+
-+ for (i=0; i<current->files->max_fds; i++) {
-+ if (i != 1)
-+ sc_close(i);
-+ }
-+
-+ module_put(THIS_MODULE);
-+
-+ set_fs(KERNEL_DS);
-+ i = sc_execve("/sbin/iptables-save", argv, NULL);
-+ if (i == -ENOENT)
-+ i = sc_execve("/usr/sbin/iptables-save", argv, NULL);
-+ eprintk("failed to exec iptables-save: %d\n", i);
-+ return -1;
-+}
-+
-+
-+static int cpt_dump_iptables(struct cpt_context * ctx)
-+{
-+ int err;
-+ int pid;
-+ int pfd[2];
-+ struct file *f;
-+ struct cpt_object_hdr v;
-+ char buf[16];
-+ loff_t pos;
-+ int n;
-+
-+ err = sc_pipe(pfd);
-+ if (err < 0) {
-+ eprintk_ctx("sc_pipe: %d\n", err);
-+ return err;
-+ }
-+ err = pid = local_kernel_thread(dumpfn, (void*)pfd, SIGCHLD, 0);
-+ if (err < 0) {
-+ eprintk_ctx("local_kernel_thread: %d\n", err);
-+ goto out;
-+ }
-+ f = fget(pfd[0]);
-+ sc_close(pfd[1]);
-+ sc_close(pfd[0]);
-+
-+ cpt_open_section(ctx, CPT_SECT_NET_IPTABLES);
-+
-+ cpt_open_object(NULL, ctx);
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_NAME;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_NAME;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ pos = ctx->file->f_pos;
-+ do {
-+ mm_segment_t oldfs;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ n = f->f_op->read(f, buf, sizeof(buf), &f->f_pos);
-+ set_fs(oldfs);
-+ if (n > 0)
-+ ctx->write(buf, n, ctx);
-+ } while (n > 0);
-+
-+ if (n < 0)
-+ eprintk_ctx("read: %d\n", n);
-+
-+ fput(f);
-+
-+ if ((err = sc_waitx(pid, 0)) < 0)
-+ eprintk_ctx("wait4: %d\n", err);
-+
-+ if (ctx->file->f_pos != pos) {
-+ buf[0] = 0;
-+ ctx->write(buf, 1, ctx);
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_close_section(ctx);
-+ } else {
-+ pos = ctx->current_section;
-+ cpt_close_object(ctx);
-+ cpt_close_section(ctx);
-+ ctx->sections[CPT_SECT_NET_IPTABLES] = CPT_NULL;
-+ ctx->file->f_pos = pos;
-+ }
-+ return n;
-+
-+out:
-+ if (pfd[1] >= 0)
-+ sc_close(pfd[1]);
-+ if (pfd[0] >= 0)
-+ sc_close(pfd[0]);
-+ return err;
-+}
-+
-+int cpt_dump_ifinfo(struct cpt_context * ctx)
-+{
-+ int err;
-+
-+ rtnl_lock();
-+ err = cpt_dump_link(ctx);
-+ if (!err)
-+ err = cpt_dump_ifaddr(ctx);
-+ rtnl_unlock();
-+ if (!err)
-+ err = cpt_dump_route(ctx);
-+ if (!err)
-+ err = cpt_dump_iptables(ctx);
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_net.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_net.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_net.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_net.h 2006-10-11 19:07:58.000000000 +0400
-@@ -0,0 +1,7 @@
-+int cpt_dump_ifinfo(struct cpt_context *ctx);
-+int rst_restore_net(struct cpt_context *ctx);
-+int cpt_suspend_network(struct cpt_context *ctx);
-+int cpt_resume_network(struct cpt_context *ctx);
-+int rst_resume_network(struct cpt_context *ctx);
-+int cpt_dump_ip_conntrack(struct cpt_context *ctx);
-+int rst_restore_ip_conntrack(struct cpt_context * ctx);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_obj.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_obj.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_obj.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_obj.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,161 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+cpt_object_t *alloc_cpt_object(int gfp, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = kmalloc(sizeof(cpt_object_t), gfp);
-+ if (obj) {
-+ INIT_LIST_HEAD(&obj->o_list);
-+ INIT_LIST_HEAD(&obj->o_hash);
-+ INIT_LIST_HEAD(&obj->o_alist);
-+ obj->o_count = 1;
-+ obj->o_pos = CPT_NULL;
-+ obj->o_lock = 0;
-+ obj->o_parent = NULL;
-+ obj->o_index = CPT_NOINDEX;
-+ obj->o_obj = NULL;
-+ obj->o_image = NULL;
-+ ctx->objcount++;
-+ }
-+ return obj;
-+}
-+EXPORT_SYMBOL(alloc_cpt_object);
-+
-+void free_cpt_object(cpt_object_t *obj, cpt_context_t *ctx)
-+{
-+ list_del(&obj->o_alist);
-+ kfree(obj);
-+ ctx->objcount--;
-+}
-+
-+void intern_cpt_object(enum _cpt_object_type type, cpt_object_t *obj, cpt_context_t *ctx)
-+{
-+ list_add_tail(&obj->o_list, &ctx->object_array[type]);
-+}
-+EXPORT_SYMBOL(intern_cpt_object);
-+
-+void insert_cpt_object(enum _cpt_object_type type, cpt_object_t *obj,
-+ cpt_object_t *head, cpt_context_t *ctx)
-+{
-+ list_add(&obj->o_list, &head->o_list);
-+}
-+EXPORT_SYMBOL(insert_cpt_object);
-+
-+cpt_object_t * __cpt_object_add(enum _cpt_object_type type, void *p,
-+ unsigned gfp_mask, cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = lookup_cpt_object(type, p, ctx);
-+
-+ if (obj) {
-+ obj->o_count++;
-+ return obj;
-+ }
-+
-+ if ((obj = alloc_cpt_object(gfp_mask, ctx)) != NULL) {
-+ if (p)
-+ cpt_obj_setobj(obj, p, ctx);
-+ intern_cpt_object(type, obj, ctx);
-+ return obj;
-+ }
-+ return NULL;
-+}
-+EXPORT_SYMBOL(__cpt_object_add);
-+
-+cpt_object_t * cpt_object_add(enum _cpt_object_type type, void *p, cpt_context_t *ctx)
-+{
-+ return __cpt_object_add(type, p, GFP_KERNEL, ctx);
-+}
-+EXPORT_SYMBOL(cpt_object_add);
-+
-+cpt_object_t * cpt_object_get(enum _cpt_object_type type, void *p, cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = lookup_cpt_object(type, p, ctx);
-+
-+ if (obj)
-+ obj->o_count++;
-+
-+ return obj;
-+}
-+EXPORT_SYMBOL(cpt_object_get);
-+
-+int cpt_object_init(cpt_context_t *ctx)
-+{
-+ int i;
-+
-+ for (i=0; i<CPT_OBJ_MAX; i++) {
-+ INIT_LIST_HEAD(&ctx->object_array[i]);
-+ }
-+ return 0;
-+}
-+
-+int cpt_object_destroy(cpt_context_t *ctx)
-+{
-+ int i;
-+
-+ for (i=0; i<CPT_OBJ_MAX; i++) {
-+ while (!list_empty(&ctx->object_array[i])) {
-+ struct list_head *head = ctx->object_array[i].next;
-+ cpt_object_t *obj = list_entry(head, cpt_object_t, o_list);
-+ list_del(head);
-+ if (obj->o_image)
-+ kfree(obj->o_image);
-+ free_cpt_object(obj, ctx);
-+ }
-+ }
-+ if (ctx->objcount != 0)
-+ eprintk_ctx("BUG: ctx->objcount=%d\n", ctx->objcount);
-+ return 0;
-+}
-+
-+cpt_object_t *lookup_cpt_object(enum _cpt_object_type type, void *p, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, type) {
-+ if (obj->o_obj == p)
-+ return obj;
-+ }
-+ return NULL;
-+}
-+EXPORT_SYMBOL(lookup_cpt_object);
-+
-+cpt_object_t *lookup_cpt_obj_bypos(enum _cpt_object_type type, loff_t pos, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, type) {
-+ if (obj->o_pos == pos)
-+ return obj;
-+ }
-+ return NULL;
-+}
-+EXPORT_SYMBOL(lookup_cpt_obj_bypos);
-+
-+cpt_object_t *lookup_cpt_obj_byindex(enum _cpt_object_type type, __u32 index, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, type) {
-+ if (obj->o_index == index)
-+ return obj;
-+ }
-+ return NULL;
-+}
-+EXPORT_SYMBOL(lookup_cpt_obj_byindex);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_obj.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_obj.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_obj.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_obj.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,62 @@
-+#ifndef __CPT_OBJ_H_
-+#define __CPT_OBJ_H_ 1
-+
-+#include <linux/list.h>
-+#include <linux/cpt_image.h>
-+
-+typedef struct _cpt_object
-+{
-+ struct list_head o_list;
-+ struct list_head o_hash;
-+ int o_count;
-+ int o_index;
-+ int o_lock;
-+ loff_t o_pos;
-+ loff_t o_ppos;
-+ void *o_obj;
-+ void *o_image;
-+ void *o_parent;
-+ struct list_head o_alist;
-+} cpt_object_t;
-+
-+struct cpt_context;
-+
-+#define for_each_object(obj, type) list_for_each_entry(obj, &ctx->object_array[type], o_list)
-+
-+
-+extern cpt_object_t *alloc_cpt_object(int gfp, struct cpt_context *ctx);
-+extern void free_cpt_object(cpt_object_t *obj, struct cpt_context *ctx);
-+
-+cpt_object_t *lookup_cpt_object(enum _cpt_object_type type, void *p, struct cpt_context *ctx);
-+cpt_object_t *lookup_cpt_obj_bypos(enum _cpt_object_type type, loff_t pos, struct cpt_context *ctx);
-+cpt_object_t *lookup_cpt_obj_byindex(enum _cpt_object_type type, __u32 index, struct cpt_context *ctx);
-+
-+static inline void cpt_obj_setpos(cpt_object_t *cpt, loff_t pos, struct cpt_context *ctx)
-+{
-+ cpt->o_pos = pos;
-+ /* Add to pos hash table */
-+}
-+
-+static inline void cpt_obj_setobj(cpt_object_t *cpt, void *ptr, struct cpt_context *ctx)
-+{
-+ cpt->o_obj = ptr;
-+ /* Add to hash table */
-+}
-+
-+static inline void cpt_obj_setindex(cpt_object_t *cpt, __u32 index, struct cpt_context *ctx)
-+{
-+ cpt->o_index = index;
-+ /* Add to index hash table */
-+}
-+
-+
-+extern void intern_cpt_object(enum _cpt_object_type type, cpt_object_t *obj, struct cpt_context *ctx);
-+extern void insert_cpt_object(enum _cpt_object_type type, cpt_object_t *obj, cpt_object_t *head, struct cpt_context *ctx);
-+extern cpt_object_t *__cpt_object_add(enum _cpt_object_type type, void *p, unsigned int gfp_mask, struct cpt_context *ctx);
-+extern cpt_object_t *cpt_object_add(enum _cpt_object_type type, void *p, struct cpt_context *ctx);
-+extern cpt_object_t *cpt_object_get(enum _cpt_object_type type, void *p, struct cpt_context *ctx);
-+
-+extern int cpt_object_init(struct cpt_context *ctx);
-+extern int cpt_object_destroy(struct cpt_context *ctx);
-+
-+#endif /* __CPT_OBJ_H_ */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_pagein.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_pagein.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_pagein.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_pagein.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,233 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/pagemap.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/uio.h>
-+#include <asm/uaccess.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_kernel.h"
-+#include "cpt_pagein.h"
-+
-+#include "cpt_syscalls.h"
-+
-+#define MAX_PGVEC_INLINE 8
-+#define MAX_PGVEC 1024
-+
-+static int send_reply(struct file *file, struct pgin_reply *repl,
-+ struct page **pgvec, int npg)
-+{
-+ int i;
-+ int err;
-+ struct iovec iov_buf[1 + MAX_PGVEC_INLINE];
-+ struct iovec *iov = iov_buf;
-+
-+
-+ if (npg+1 > MAX_PGVEC_INLINE) {
-+ iov = kmalloc((npg+1)*sizeof(struct iovec), GFP_KERNEL);
-+ if (iov == NULL)
-+ return -ENOMEM;
-+ }
-+
-+ iov[0].iov_base = repl;
-+ iov[0].iov_len = sizeof(*repl);
-+ for (i=0; i<npg; i++) {
-+ iov[i+1].iov_base = kmap(pgvec[i]);
-+ iov[i+1].iov_len = PAGE_SIZE;
-+ }
-+ err = file->f_op->writev(file, iov, npg + 1, &file->f_pos);
-+ for (i=0; i<npg; i++) {
-+ kunmap(pgvec[i]);
-+ }
-+ if (iov != iov_buf)
-+ kfree(iov);
-+ if (err < 0)
-+ return err;
-+ if (err != sizeof(*repl) + PAGE_SIZE*npg)
-+ return -EIO;
-+ return 0;
-+}
-+
-+#define IDX_PER_PAGE (PAGE_SIZE/sizeof(struct pagein_desc))
-+
-+static int do_req(struct pgin_request *req, cpt_context_t *ctx)
-+{
-+ int err = -EIO;
-+ struct pgin_reply repl;
-+ struct page *pgvec_buf[MAX_PGVEC_INLINE];
-+ struct page **pgvec = pgvec_buf;
-+ u32 idx;
-+ int npg = 0;
-+
-+ repl.rmid = PGIN_RMID;
-+ repl.handle = req->handle;
-+
-+ if (req->rmid != PGIN_RMID) {
-+ eprintk_ctx("pgoutd: bad record mark %08x\n", req->rmid);
-+ return -EFAULT;
-+ }
-+
-+ if (req->size == PGIN_STOP)
-+ return 1;
-+
-+ if (req->size == PGIN_START) {
-+ repl.error = 0;
-+ return send_reply(ctx->pagein_file_out, &repl, NULL, 0);
-+ }
-+
-+// dprintk_ctx("pgoutd: idx=%u %u\n", (u32)req->index, req->size);
-+
-+ if (req->size > MAX_PGVEC) {
-+ eprintk_ctx("pgoutd: too long\n");
-+ goto eio;
-+ }
-+
-+ if (req->size > MAX_PGVEC_INLINE) {
-+ pgvec = kmalloc(req->size*sizeof(struct page *), GFP_KERNEL);
-+ if (!pgvec) {
-+ eprintk_ctx("pgoutd: cannot allocate pgvec\n");
-+ goto eio;
-+ }
-+ }
-+
-+ if (req->index + req->size > ctx->lazypages) {
-+ eprintk_ctx("%u %u %d\n", (u32)req->index, req->size, ctx->lazypages);
-+ goto eio;
-+ }
-+
-+ for (idx = req->index; idx < req->index + req->size; idx++) {
-+ struct pagein_desc *pd = ctx->pgin_dir[idx/IDX_PER_PAGE];
-+ pd += idx%IDX_PER_PAGE;
-+
-+ err = get_user_pages(current, pd->mm, pd->offset,
-+ 1, 0, 1, pgvec+npg, NULL);
-+ if (err <= 0) {
-+ eprintk_ctx("%d idx=%d %p %08lx\n", err, idx, pd->mm, pd->offset);
-+ goto eio;
-+ }
-+ npg++;
-+ }
-+ repl.error = 0;
-+ err = send_reply(ctx->pagein_file_out, &repl, pgvec, npg);
-+ while (--npg >= 0)
-+ page_cache_release(pgvec[npg]);
-+ if (pgvec != pgvec_buf)
-+ kfree(pgvec);
-+ return err;
-+
-+eio:
-+ eprintk_ctx("pgoutd: EIO\n");
-+ while (--npg >= 0)
-+ page_cache_release(pgvec[npg]);
-+ if (pgvec && pgvec != pgvec_buf)
-+ kfree(pgvec);
-+ repl.error = err;
-+ return send_reply(ctx->pagein_file_out, &repl, NULL, 0);
-+}
-+
-+static int pgin_loop(void *arg)
-+{
-+ cpt_context_t *ctx = (cpt_context_t *)arg;
-+ char buf[sizeof(struct pgin_request)];
-+ struct file * f = ctx->pagein_file_in;
-+
-+ if (f == NULL) {
-+ eprintk_ctx("null pagein_file_in\n");
-+ goto out;
-+ }
-+
-+ daemonize("pgoutd");
-+ allow_signal(SIGKILL);
-+ set_fs(KERNEL_DS);
-+
-+ for (;;) {
-+ int err;
-+ int bytes = 0;
-+
-+ do {
-+ int n = vfs_read(f, buf + bytes, sizeof(buf) - bytes, &f->f_pos);
-+ if (n <= 0) {
-+ eprintk_ctx("pagein_file_in %d\n", n);
-+ goto out;
-+ }
-+ bytes += n;
-+ } while (bytes < sizeof(buf));
-+
-+ err = do_req((struct pgin_request*)buf, ctx);
-+ if (err == 1) {
-+ dprintk_ctx("pagein_file_in do_req %d\n", err);
-+ break;
-+ }
-+ }
-+
-+out:
-+ complete(&ctx->pgin_notify);
-+ return 0;
-+}
-+
-+static void cpt_start_pagein_worker(void *_info)
-+{
-+ pagein_info_t *info;
-+
-+ info = (pagein_info_t *)_info;
-+ info->pid = kernel_thread(pgin_loop, info->ctx,
-+ CLONE_KERNEL | CLONE_VM | SIGCHLD);
-+ complete(&info->done);
-+}
-+
-+int cpt_start_pagein(cpt_context_t *ctx)
-+{
-+ pagein_info_t create;
-+ DECLARE_WORK(work, cpt_start_pagein_worker, &create);
-+
-+ if (ctx->lazypages == 0)
-+ return 0;
-+
-+ if (ctx->pagein_file_in == NULL ||
-+ ctx->pagein_file_out == NULL ||
-+ ctx->pagein_file_out->f_op->writev == NULL)
-+ return -EBADF;
-+
-+ create.pid = -EINVAL;
-+ create.ctx = ctx;
-+ init_completion(&create.done);
-+ schedule_work(&work);
-+ wait_for_completion(&create.done);
-+
-+ if (create.pid < 0)
-+ return create.pid;
-+
-+ read_lock(&tasklist_lock);
-+ ctx->pgin_task = find_task_by_pid_all(create.pid);
-+ if (ctx->pgin_task)
-+ get_task_struct(ctx->pgin_task);
-+ read_unlock(&tasklist_lock);
-+ if (ctx->pgin_task == NULL) {
-+ eprintk_ctx("pgin task is lost\n");
-+ return -ESRCH;
-+ }
-+ return 0;
-+}
-+
-+void cpt_free_pgin_dir(cpt_context_t *ctx)
-+{
-+ int i;
-+
-+ for (i=0; i<PAGE_SIZE/sizeof(struct pagein_desc*); i++) {
-+ unsigned long pg = (unsigned long)ctx->pgin_dir[i];
-+ if (pg)
-+ free_page(pg);
-+ }
-+
-+ free_page((unsigned long)ctx->pgin_dir);
-+ ctx->pgin_dir = NULL;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_pagein.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_pagein.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_pagein.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_pagein.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,28 @@
-+
-+#define PGIN_RMID 0xF1AD1966
-+#define PGIN_START 0xFFFFFFFF
-+#define PGIN_STOP 0xFFFFFFFE
-+
-+#define ITER_PASS 0x1
-+#define ITER_STOP 0x2
-+
-+struct pgin_request
-+{
-+ __u32 rmid;
-+ __u32 size;
-+ __u64 index;
-+ __u64 handle;
-+};
-+
-+struct pgin_reply
-+{
-+ __u32 rmid;
-+ __u32 error;
-+ __u64 handle;
-+};
-+
-+struct pagein_desc
-+{
-+ struct mm_struct *mm;
-+ unsigned long offset;
-+};
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_proc.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_proc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_proc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_proc.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,574 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/errno.h>
-+#include <linux/mm.h>
-+#include <linux/list.h>
-+#include <linux/proc_fs.h>
-+#include <linux/smp_lock.h>
-+#include <asm/uaccess.h>
-+#include <linux/cpt_ioctl.h>
-+#include <linux/delay.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_dump.h"
-+#include "cpt_mm.h"
-+#include "cpt_kernel.h"
-+
-+MODULE_AUTHOR("Alexey Kuznetsov <alexey@sw.ru>");
-+MODULE_LICENSE("GPL v2");
-+
-+/* List of contexts and lock protecting the list */
-+struct list_head cpt_context_list;
-+spinlock_t cpt_context_lock;
-+
-+static int proc_read(char *buffer, char **start, off_t offset,
-+ int length, int *eof, void *data)
-+{
-+ off_t pos = 0;
-+ off_t begin = 0;
-+ int len = 0;
-+ cpt_context_t *ctx;
-+
-+ len += sprintf(buffer, "Ctx Id VE State\n");
-+
-+ spin_lock(&cpt_context_lock);
-+
-+ list_for_each_entry(ctx, &cpt_context_list, ctx_list) {
-+ len += sprintf(buffer+len,"%p %08x %-8u %d",
-+ ctx,
-+ ctx->contextid,
-+ ctx->ve_id,
-+ ctx->ctx_state
-+ );
-+
-+ buffer[len++] = '\n';
-+
-+ pos = begin+len;
-+ if (pos < offset) {
-+ len = 0;
-+ begin = pos;
-+ }
-+ if (pos > offset+length)
-+ goto done;
-+ }
-+ *eof = 1;
-+
-+done:
-+ spin_unlock(&cpt_context_lock);
-+ *start = buffer + (offset - begin);
-+ len -= (offset - begin);
-+ if(len > length)
-+ len = length;
-+ if(len < 0)
-+ len = 0;
-+ return len;
-+}
-+
-+void cpt_context_release(cpt_context_t *ctx)
-+{
-+ list_del(&ctx->ctx_list);
-+ spin_unlock(&cpt_context_lock);
-+
-+ if (ctx->ctx_state > 0)
-+ cpt_resume(ctx);
-+ ctx->ctx_state = CPT_CTX_ERROR;
-+
-+ if (ctx->pgin_task)
-+ put_task_struct(ctx->pgin_task);
-+ if (ctx->pgin_dir)
-+ cpt_free_pgin_dir(ctx);
-+ if (ctx->objcount)
-+ eprintk_ctx("%d objects leaked\n", ctx->objcount);
-+ if (ctx->file)
-+ fput(ctx->file);
-+ cpt_flush_error(ctx);
-+ if (ctx->errorfile) {
-+ fput(ctx->errorfile);
-+ ctx->errorfile = NULL;
-+ }
-+ if (ctx->error_msg) {
-+ free_page((unsigned long)ctx->error_msg);
-+ ctx->error_msg = NULL;
-+ }
-+ if (ctx->statusfile)
-+ fput(ctx->statusfile);
-+ if (ctx->lockfile)
-+ fput(ctx->lockfile);
-+ if (ctx->pagein_file_out)
-+ fput(ctx->pagein_file_out);
-+ if (ctx->pagein_file_in)
-+ fput(ctx->pagein_file_in);
-+ kfree(ctx);
-+
-+ spin_lock(&cpt_context_lock);
-+}
-+
-+static void __cpt_context_put(cpt_context_t *ctx)
-+{
-+ if (!--ctx->refcount)
-+ cpt_context_release(ctx);
-+}
-+
-+static void cpt_context_put(cpt_context_t *ctx)
-+{
-+ spin_lock(&cpt_context_lock);
-+ __cpt_context_put(ctx);
-+ spin_unlock(&cpt_context_lock);
-+}
-+
-+cpt_context_t * cpt_context_open(void)
-+{
-+ cpt_context_t *ctx;
-+
-+ if ((ctx = kmalloc(sizeof(*ctx), GFP_KERNEL)) != NULL) {
-+ cpt_context_init(ctx);
-+ spin_lock(&cpt_context_lock);
-+ list_add_tail(&ctx->ctx_list, &cpt_context_list);
-+ spin_unlock(&cpt_context_lock);
-+ ctx->error_msg = (char*)__get_free_page(GFP_KERNEL);
-+ if (ctx->error_msg != NULL)
-+ ctx->error_msg[0] = 0;
-+ }
-+ return ctx;
-+}
-+
-+cpt_context_t * cpt_context_lookup(unsigned int contextid)
-+{
-+ cpt_context_t *ctx;
-+
-+ spin_lock(&cpt_context_lock);
-+ list_for_each_entry(ctx, &cpt_context_list, ctx_list) {
-+ if (ctx->contextid == contextid) {
-+ ctx->refcount++;
-+ spin_unlock(&cpt_context_lock);
-+ return ctx;
-+ }
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ return NULL;
-+}
-+
-+int cpt_context_lookup_veid(unsigned int veid)
-+{
-+ cpt_context_t *ctx;
-+
-+ spin_lock(&cpt_context_lock);
-+ list_for_each_entry(ctx, &cpt_context_list, ctx_list) {
-+ if (ctx->ve_id == veid && ctx->ctx_state > 0) {
-+ spin_unlock(&cpt_context_lock);
-+ return 1;
-+ }
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ return 0;
-+}
-+
-+static int cpt_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg)
-+{
-+ int err = 0;
-+ cpt_context_t *ctx;
-+ struct file *dfile = NULL;
-+ int try;
-+
-+ unlock_kernel();
-+
-+ if (cmd == CPT_VMPREP) {
-+ err = cpt_mm_prepare(arg);
-+ goto out_lock;
-+ }
-+
-+ if (cmd == CPT_TEST_CAPS) {
-+ unsigned int src_flags, dst_flags = arg;
-+
-+ err = 0;
-+ src_flags = test_cpu_caps();
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_CMOV, "cmov", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_FXSR, "fxsr", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_SSE, "sse", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_SSE2, "sse2", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_MMX, "mmx", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_3DNOW, "3dnow", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_3DNOW2, "3dnowext", err);
-+ test_one_flag_old(src_flags, dst_flags, CPT_CPU_X86_SEP, "sysenter", err);
-+ goto out_lock;
-+ }
-+
-+ if (cmd == CPT_JOIN_CONTEXT || cmd == CPT_PUT_CONTEXT) {
-+ cpt_context_t *old_ctx;
-+
-+ ctx = NULL;
-+ if (cmd == CPT_JOIN_CONTEXT) {
-+ err = -ENOENT;
-+ ctx = cpt_context_lookup(arg);
-+ if (!ctx)
-+ goto out_lock;
-+ }
-+
-+ spin_lock(&cpt_context_lock);
-+ old_ctx = (cpt_context_t*)file->private_data;
-+ file->private_data = ctx;
-+
-+ if (old_ctx) {
-+ if (cmd == CPT_PUT_CONTEXT && old_ctx->sticky) {
-+ old_ctx->sticky = 0;
-+ old_ctx->refcount--;
-+ }
-+ __cpt_context_put(old_ctx);
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ err = 0;
-+ goto out_lock;
-+ }
-+
-+ spin_lock(&cpt_context_lock);
-+ ctx = (cpt_context_t*)file->private_data;
-+ if (ctx)
-+ ctx->refcount++;
-+ spin_unlock(&cpt_context_lock);
-+
-+ if (!ctx) {
-+ cpt_context_t *old_ctx;
-+
-+ err = -ENOMEM;
-+ ctx = cpt_context_open();
-+ if (!ctx)
-+ goto out_lock;
-+
-+ spin_lock(&cpt_context_lock);
-+ old_ctx = (cpt_context_t*)file->private_data;
-+ if (!old_ctx) {
-+ ctx->refcount++;
-+ file->private_data = ctx;
-+ } else {
-+ old_ctx->refcount++;
-+ }
-+ if (old_ctx) {
-+ __cpt_context_put(ctx);
-+ ctx = old_ctx;
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ }
-+
-+ if (cmd == CPT_GET_CONTEXT) {
-+ unsigned int contextid = (unsigned int)arg;
-+
-+ if (ctx->contextid && ctx->contextid != contextid) {
-+ err = -EINVAL;
-+ goto out_nosem;
-+ }
-+ if (!ctx->contextid) {
-+ cpt_context_t *c1 = cpt_context_lookup(contextid);
-+ if (c1) {
-+ cpt_context_put(c1);
-+ err = -EEXIST;
-+ goto out_nosem;
-+ }
-+ ctx->contextid = contextid;
-+ }
-+ spin_lock(&cpt_context_lock);
-+ if (!ctx->sticky) {
-+ ctx->sticky = 1;
-+ ctx->refcount++;
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ goto out_nosem;
-+ }
-+
-+ down(&ctx->main_sem);
-+
-+ err = -EBUSY;
-+ if (ctx->ctx_state < 0)
-+ goto out;
-+
-+ err = 0;
-+ switch (cmd) {
-+ case CPT_SET_DUMPFD:
-+ if (ctx->ctx_state == CPT_CTX_DUMPING) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ err = -EBADF;
-+ dfile = fget(arg);
-+ if (dfile == NULL)
-+ break;
-+ if (dfile->f_op == NULL ||
-+ dfile->f_op->write == NULL) {
-+ fput(dfile);
-+ break;
-+ }
-+ err = 0;
-+ }
-+ if (ctx->file)
-+ fput(ctx->file);
-+ ctx->file = dfile;
-+ break;
-+ case CPT_SET_ERRORFD:
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->errorfile)
-+ fput(ctx->errorfile);
-+ ctx->errorfile = dfile;
-+ break;
-+ case CPT_SET_PAGEINFDIN:
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->pagein_file_in)
-+ fput(ctx->pagein_file_in);
-+ ctx->pagein_file_in = dfile;
-+ break;
-+ case CPT_SET_PAGEINFDOUT:
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->pagein_file_out)
-+ fput(ctx->pagein_file_out);
-+ ctx->pagein_file_out = dfile;
-+ break;
-+ case CPT_SET_LAZY:
-+ ctx->lazy_vm = arg;
-+ break;
-+ case CPT_ITER:
-+ err = cpt_iteration(ctx);
-+ break;
-+ case CPT_SET_VEID:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ ctx->ve_id = arg;
-+ break;
-+ case CPT_SET_CPU_FLAGS:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ ctx->dst_cpu_flags = arg;
-+ ctx->src_cpu_flags = test_cpu_caps();
-+ break;
-+ case CPT_SUSPEND:
-+ if (cpt_context_lookup_veid(ctx->ve_id) ||
-+ ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ ctx->ctx_state = CPT_CTX_SUSPENDING;
-+ try = 0;
-+ do {
-+ err = cpt_vps_suspend(ctx);
-+ if (err)
-+ cpt_resume(ctx);
-+ if (err == -EAGAIN)
-+ msleep(1000);
-+ try++;
-+ } while (err == -EAGAIN && try < 3);
-+ if (err) {
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ } else {
-+ ctx->ctx_state = CPT_CTX_SUSPENDED;
-+ }
-+ break;
-+ case CPT_DUMP:
-+ if (!ctx->ctx_state) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ err = cpt_dump(ctx);
-+ break;
-+ case CPT_PAGEIND:
-+ err = cpt_start_pagein(ctx);
-+ break;
-+ case CPT_RESUME:
-+ if (ctx->ctx_state == CPT_CTX_IDLE) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ err = cpt_resume(ctx);
-+ if (!err)
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ break;
-+ case CPT_KILL:
-+ if (ctx->ctx_state == CPT_CTX_IDLE) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ err = cpt_kill(ctx);
-+ if (!err)
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ break;
-+ case CPT_TEST_VECAPS:
-+ {
-+ __u32 dst_flags = arg;
-+ __u32 src_flags;
-+
-+ err = cpt_vps_caps(ctx, &src_flags);
-+ if (err)
-+ break;
-+
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_CMOV, "cmov", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_FXSR, "fxsr", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SSE, "sse", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SSE2, "sse2", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_MMX, "mmx", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_3DNOW, "3dnow", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_3DNOW2, "3dnowext", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SEP, "sysenter", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_EMT64, "emt64", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_IA64, "ia64", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SYSCALL, "syscall", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SYSCALL32, "syscall32", err);
-+ test_one_flag(src_flags, dst_flags, CPT_CPU_X86_SEP32, "sysenter32", err);
-+ if (src_flags & CPT_UNSUPPORTED_MASK)
-+ err = 1;
-+ break;
-+ }
-+ default:
-+ err = -EINVAL;
-+ break;
-+ }
-+
-+out:
-+ cpt_flush_error(ctx);
-+ up(&ctx->main_sem);
-+out_nosem:
-+ cpt_context_put(ctx);
-+out_lock:
-+ lock_kernel();
-+ return err;
-+}
-+
-+static int cpt_open(struct inode *inode, struct file *file)
-+{
-+ if (!try_module_get(THIS_MODULE))
-+ return -EBUSY;
-+
-+ return 0;
-+}
-+
-+static int cpt_release(struct inode * inode, struct file * file)
-+{
-+ cpt_context_t *ctx;
-+
-+ spin_lock(&cpt_context_lock);
-+ ctx = (cpt_context_t*)file->private_data;
-+ file->private_data = NULL;
-+
-+ if (ctx)
-+ __cpt_context_put(ctx);
-+ spin_unlock(&cpt_context_lock);
-+
-+ module_put(THIS_MODULE);
-+ return 0;
-+}
-+
-+
-+static struct file_operations cpt_fops = {
-+ .owner = THIS_MODULE,
-+ .open = cpt_open,
-+ .release = cpt_release,
-+ .ioctl = cpt_ioctl,
-+};
-+
-+static struct proc_dir_entry *proc_ent;
-+
-+int debug_level = 1;
-+
-+static struct ctl_table_header *ctl_header;
-+
-+static ctl_table debug_table[] = {
-+ {
-+ .ctl_name = 9475,
-+ .procname = "cpt",
-+ .data = &debug_level,
-+ .maxlen = sizeof(debug_level),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ { .ctl_name = 0 }
-+};
-+static ctl_table root_table[] = {
-+ {
-+ .ctl_name = CTL_DEBUG,
-+ .procname = "debug",
-+ .mode = 0555,
-+ .child = debug_table,
-+ },
-+ { .ctl_name = 0 }
-+};
-+
-+static int __init init_cpt(void)
-+{
-+ int err;
-+
-+ err = -ENOMEM;
-+ ctl_header = register_sysctl_table(root_table, 0);
-+ if (!ctl_header)
-+ goto err;
-+
-+ spin_lock_init(&cpt_context_lock);
-+ INIT_LIST_HEAD(&cpt_context_list);
-+
-+ err = -EINVAL;
-+ proc_ent = create_proc_entry("cpt", 0600, NULL);
-+ if (!proc_ent)
-+ goto err_out;
-+
-+ cpt_fops.read = proc_ent->proc_fops->read;
-+ cpt_fops.write = proc_ent->proc_fops->write;
-+ cpt_fops.llseek = proc_ent->proc_fops->llseek;
-+ proc_ent->proc_fops = &cpt_fops;
-+
-+ proc_ent->read_proc = proc_read;
-+ proc_ent->data = NULL;
-+ proc_ent->owner = THIS_MODULE;
-+ return 0;
-+
-+err_out:
-+ unregister_sysctl_table(ctl_header);
-+err:
-+ return err;
-+}
-+module_init(init_cpt);
-+
-+static void __exit exit_cpt(void)
-+{
-+ remove_proc_entry("cpt", NULL);
-+ unregister_sysctl_table(ctl_header);
-+
-+ spin_lock(&cpt_context_lock);
-+ while (!list_empty(&cpt_context_list)) {
-+ cpt_context_t *ctx;
-+ ctx = list_entry(cpt_context_list.next, cpt_context_t, ctx_list);
-+
-+ if (!ctx->sticky)
-+ ctx->refcount++;
-+ ctx->sticky = 0;
-+
-+ BUG_ON(ctx->refcount != 1);
-+
-+ __cpt_context_put(ctx);
-+ }
-+ spin_unlock(&cpt_context_lock);
-+}
-+module_exit(exit_cpt);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_process.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_process.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_process.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_process.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,945 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_ubc.h"
-+#include "cpt_process.h"
-+#include "cpt_kernel.h"
-+
-+#ifdef CONFIG_X86_64
-+#define task_pt_regs(t) (((struct pt_regs *) (THREAD_SIZE + (unsigned long) (t)->thread_info)) - 1)
-+#endif
-+
-+int check_task_state(task_t *tsk, struct cpt_context *ctx)
-+{
-+#ifdef CONFIG_X86_64
-+ if (!(tsk->thread_info->flags&_TIF_IA32)) {
-+ if (task_pt_regs(tsk)->rip >= VSYSCALL_START &&
-+ task_pt_regs(tsk)->rip < VSYSCALL_END) {
-+ eprintk_ctx(CPT_FID "cannot be checkpointied while vsyscall, try later\n", CPT_TID(tsk));
-+ return -EAGAIN;
-+ }
-+ }
-+#endif
-+ return 0;
-+}
-+
-+static u32 encode_segment(u32 segreg)
-+{
-+ segreg &= 0xFFFF;
-+
-+ if (segreg == 0)
-+ return CPT_SEG_ZERO;
-+ if ((segreg & 3) != 3) {
-+ wprintk("Invalid RPL of a segment reg %x\n", segreg);
-+ return CPT_SEG_ZERO;
-+ }
-+
-+ /* LDT descriptor, it is just an index to LDT array */
-+ if (segreg & 4)
-+ return CPT_SEG_LDT + (segreg >> 3);
-+
-+ /* TLS descriptor. */
-+ if ((segreg >> 3) >= GDT_ENTRY_TLS_MIN &&
-+ (segreg >> 3) <= GDT_ENTRY_TLS_MAX)
-+ return CPT_SEG_TLS1 + ((segreg>>3) - GDT_ENTRY_TLS_MIN);
-+
-+ /* One of standard desriptors */
-+#ifdef CONFIG_X86_64
-+ if (segreg == __USER32_DS)
-+ return CPT_SEG_USER32_DS;
-+ if (segreg == __USER32_CS)
-+ return CPT_SEG_USER32_CS;
-+ if (segreg == __USER_DS)
-+ return CPT_SEG_USER64_DS;
-+ if (segreg == __USER_CS)
-+ return CPT_SEG_USER64_CS;
-+#else
-+ if (segreg == __USER_DS)
-+ return CPT_SEG_USER32_DS;
-+ if (segreg == __USER_CS)
-+ return CPT_SEG_USER32_CS;
-+#endif
-+ wprintk("Invalid segment reg %x\n", segreg);
-+ return CPT_SEG_ZERO;
-+}
-+
-+#ifdef CONFIG_X86_64
-+static void xlate_ptregs_64_to_32(struct cpt_x86_regs *d, struct pt_regs *s, task_t *tsk)
-+{
-+ d->cpt_ebp = s->rbp;
-+ d->cpt_ebx = s->rbx;
-+ d->cpt_eax = s->rax;
-+ d->cpt_ecx = s->rcx;
-+ d->cpt_edx = s->rdx;
-+ d->cpt_esi = s->rsi;
-+ d->cpt_edi = s->rdi;
-+ d->cpt_orig_eax = s->orig_rax;
-+ d->cpt_eip = s->rip;
-+ d->cpt_xcs = encode_segment(s->cs);
-+ d->cpt_eflags = s->eflags;
-+ d->cpt_esp = s->rsp;
-+ d->cpt_xss = encode_segment(s->ss);
-+ d->cpt_xds = encode_segment(tsk->thread.ds);
-+ d->cpt_xes = encode_segment(tsk->thread.es);
-+}
-+
-+static int dump_registers(task_t *tsk, struct cpt_context *ctx)
-+{
-+ cpt_open_object(NULL, ctx);
-+
-+ if (tsk->thread_info->flags&_TIF_IA32) {
-+ struct cpt_x86_regs ri;
-+ ri.cpt_next = sizeof(ri);
-+ ri.cpt_object = CPT_OBJ_X86_REGS;
-+ ri.cpt_hdrlen = sizeof(ri);
-+ ri.cpt_content = CPT_CONTENT_VOID;
-+
-+ ri.cpt_debugreg[0] = tsk->thread.debugreg0;
-+ ri.cpt_debugreg[1] = tsk->thread.debugreg1;
-+ ri.cpt_debugreg[2] = tsk->thread.debugreg2;
-+ ri.cpt_debugreg[3] = tsk->thread.debugreg3;
-+ ri.cpt_debugreg[4] = 0;
-+ ri.cpt_debugreg[5] = 0;
-+ ri.cpt_debugreg[6] = tsk->thread.debugreg6;
-+ ri.cpt_debugreg[7] = tsk->thread.debugreg7;
-+ ri.cpt_fs = encode_segment(tsk->thread.fsindex);
-+ ri.cpt_gs = encode_segment(tsk->thread.gsindex);
-+
-+ xlate_ptregs_64_to_32(&ri, task_pt_regs(tsk), tsk);
-+
-+ ctx->write(&ri, sizeof(ri), ctx);
-+ } else {
-+ struct cpt_x86_64_regs ri;
-+ ri.cpt_next = sizeof(ri);
-+ ri.cpt_object = CPT_OBJ_X86_64_REGS;
-+ ri.cpt_hdrlen = sizeof(ri);
-+ ri.cpt_content = CPT_CONTENT_VOID;
-+
-+ ri.cpt_fsbase = tsk->thread.fs;
-+ ri.cpt_gsbase = tsk->thread.gs;
-+ ri.cpt_fsindex = encode_segment(tsk->thread.fsindex);
-+ ri.cpt_gsindex = encode_segment(tsk->thread.gsindex);
-+ ri.cpt_ds = encode_segment(tsk->thread.ds);
-+ ri.cpt_es = encode_segment(tsk->thread.es);
-+ ri.cpt_debugreg[0] = tsk->thread.debugreg0;
-+ ri.cpt_debugreg[1] = tsk->thread.debugreg1;
-+ ri.cpt_debugreg[2] = tsk->thread.debugreg2;
-+ ri.cpt_debugreg[3] = tsk->thread.debugreg3;
-+ ri.cpt_debugreg[4] = 0;
-+ ri.cpt_debugreg[5] = 0;
-+ ri.cpt_debugreg[6] = tsk->thread.debugreg6;
-+ ri.cpt_debugreg[7] = tsk->thread.debugreg7;
-+
-+ memcpy(&ri.cpt_r15, task_pt_regs(tsk), sizeof(struct pt_regs));
-+
-+ ri.cpt_cs = encode_segment(task_pt_regs(tsk)->cs);
-+ ri.cpt_ss = encode_segment(task_pt_regs(tsk)->ss);
-+
-+ ctx->write(&ri, sizeof(ri), ctx);
-+ }
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+
-+#else
-+
-+static int dump_registers(task_t *tsk, struct cpt_context *ctx)
-+{
-+ struct cpt_x86_regs ri;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ ri.cpt_next = sizeof(ri);
-+ ri.cpt_object = CPT_OBJ_X86_REGS;
-+ ri.cpt_hdrlen = sizeof(ri);
-+ ri.cpt_content = CPT_CONTENT_VOID;
-+
-+ ri.cpt_debugreg[0] = tsk->thread.debugreg[0];
-+ ri.cpt_debugreg[1] = tsk->thread.debugreg[1];
-+ ri.cpt_debugreg[2] = tsk->thread.debugreg[2];
-+ ri.cpt_debugreg[3] = tsk->thread.debugreg[3];
-+ ri.cpt_debugreg[4] = tsk->thread.debugreg[4];
-+ ri.cpt_debugreg[5] = tsk->thread.debugreg[5];
-+ ri.cpt_debugreg[6] = tsk->thread.debugreg[6];
-+ ri.cpt_debugreg[7] = tsk->thread.debugreg[7];
-+ ri.cpt_fs = encode_segment(tsk->thread.fs);
-+ ri.cpt_gs = encode_segment(tsk->thread.gs);
-+
-+ memcpy(&ri.cpt_ebx, task_pt_regs(tsk), sizeof(struct pt_regs));
-+
-+ ri.cpt_xcs = encode_segment(task_pt_regs(tsk)->xcs);
-+ ri.cpt_xss = encode_segment(task_pt_regs(tsk)->xss);
-+ ri.cpt_xds = encode_segment(task_pt_regs(tsk)->xds);
-+ ri.cpt_xes = encode_segment(task_pt_regs(tsk)->xes);
-+
-+ ctx->write(&ri, sizeof(ri), ctx);
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+#endif
-+
-+static int dump_kstack(task_t *tsk, struct cpt_context *ctx)
-+{
-+ struct cpt_obj_bits hdr;
-+ unsigned long size;
-+ void *start;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+#ifdef CONFIG_X86_64
-+ size = tsk->thread.rsp0 - tsk->thread.rsp;
-+ start = (void*)tsk->thread.rsp;
-+#else
-+ size = tsk->thread.esp0 - tsk->thread.esp;
-+ start = (void*)tsk->thread.esp;
-+#endif
-+
-+ hdr.cpt_next = sizeof(hdr) + CPT_ALIGN(size);
-+ hdr.cpt_object = CPT_OBJ_BITS;
-+ hdr.cpt_hdrlen = sizeof(hdr);
-+ hdr.cpt_content = CPT_CONTENT_STACK;
-+ hdr.cpt_size = size;
-+
-+ ctx->write(&hdr, sizeof(hdr), ctx);
-+ ctx->write(start, size, ctx);
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+/* Formats of i387_fxsave_struct are the same for x86_64
-+ * and i386. Plain luck. */
-+
-+static int dump_fpustate(task_t *tsk, struct cpt_context *ctx)
-+{
-+ struct cpt_obj_bits hdr;
-+ unsigned long size;
-+ int type;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ type = CPT_CONTENT_X86_FPUSTATE;
-+ size = sizeof(struct i387_fxsave_struct);
-+#ifndef CONFIG_X86_64
-+ if (!cpu_has_fxsr) {
-+ size = sizeof(struct i387_fsave_struct);
-+ type = CPT_CONTENT_X86_FPUSTATE_OLD;
-+ }
-+#endif
-+
-+ hdr.cpt_next = sizeof(hdr) + CPT_ALIGN(size);
-+ hdr.cpt_object = CPT_OBJ_BITS;
-+ hdr.cpt_hdrlen = sizeof(hdr);
-+ hdr.cpt_content = type;
-+ hdr.cpt_size = size;
-+
-+ ctx->write(&hdr, sizeof(hdr), ctx);
-+ ctx->write(&tsk->thread.i387, size, ctx);
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+static int encode_siginfo(struct cpt_siginfo_image *si, siginfo_t *info)
-+{
-+ si->cpt_signo = info->si_signo;
-+ si->cpt_errno = info->si_errno;
-+ si->cpt_code = info->si_code;
-+
-+ switch(si->cpt_code & __SI_MASK) {
-+ case __SI_TIMER:
-+ si->cpt_pid = info->si_tid;
-+ si->cpt_uid = info->si_overrun;
-+ si->cpt_sigval = cpt_ptr_export(info->_sifields._timer._sigval.sival_ptr);
-+ si->cpt_utime = info->si_sys_private;
-+ break;
-+ case __SI_POLL:
-+ si->cpt_pid = info->si_band;
-+ si->cpt_uid = info->si_fd;
-+ break;
-+ case __SI_FAULT:
-+ si->cpt_sigval = cpt_ptr_export(info->si_addr);
-+#ifdef __ARCH_SI_TRAPNO
-+ si->cpt_pid = info->si_trapno;
-+#endif
-+ break;
-+ case __SI_CHLD:
-+ si->cpt_pid = is_virtual_pid(info->si_pid) ? info->si_pid : pid_type_to_vpid(PIDTYPE_PID, info->si_pid);
-+ si->cpt_uid = info->si_uid;
-+ si->cpt_sigval = info->si_status;
-+ si->cpt_stime = info->si_stime;
-+ si->cpt_utime = info->si_utime;
-+ break;
-+ case __SI_KILL:
-+ case __SI_RT:
-+ case __SI_MESGQ:
-+ default:
-+ si->cpt_pid = is_virtual_pid(info->si_pid) ? info->si_pid : pid_type_to_vpid(PIDTYPE_TGID, info->si_pid);
-+ si->cpt_uid = info->si_uid;
-+ si->cpt_sigval = cpt_ptr_export(info->si_ptr);
-+ break;
-+ }
-+ return 0;
-+}
-+
-+static int dump_sigqueue(struct sigpending *list, struct cpt_context *ctx)
-+{
-+ struct sigqueue *q;
-+ loff_t saved_obj;
-+
-+ if (list_empty(&list->list))
-+ return 0;
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ list_for_each_entry(q, &list->list, list) {
-+ struct cpt_siginfo_image si;
-+
-+ si.cpt_next = sizeof(si);
-+ si.cpt_object = CPT_OBJ_SIGINFO;
-+ si.cpt_hdrlen = sizeof(si);
-+ si.cpt_content = CPT_CONTENT_VOID;
-+
-+ si.cpt_qflags = q->flags;
-+ si.cpt_user = q->user->uid;
-+
-+ if (encode_siginfo(&si, &q->info))
-+ return -EINVAL;
-+
-+ ctx->write(&si, sizeof(si), ctx);
-+ }
-+ cpt_pop_object(&saved_obj, ctx);
-+ return 0;
-+}
-+
-+
-+
-+static int dump_one_signal_struct(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct signal_struct *sig = obj->o_obj;
-+ struct cpt_signal_image *v = cpt_get_buf(ctx);
-+ task_t *tsk;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_SIGNAL_STRUCT;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ if (sig->pgrp <= 0) {
-+ eprintk_ctx("bad pgid\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_pgrp_type = CPT_PGRP_NORMAL;
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_type_ve(PIDTYPE_PID, sig->pgrp);
-+ if (tsk == NULL)
-+ v->cpt_pgrp_type = CPT_PGRP_ORPHAN;
-+ read_unlock(&tasklist_lock);
-+ v->cpt_pgrp = pid_type_to_vpid(PIDTYPE_PGID, sig->pgrp);
-+
-+ v->cpt_old_pgrp = 0;
-+ if (sig->tty_old_pgrp < 0) {
-+ eprintk_ctx("bad tty_old_pgrp\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ if (sig->tty_old_pgrp > 0) {
-+ v->cpt_old_pgrp_type = CPT_PGRP_NORMAL;
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_type_ve(PIDTYPE_PID, sig->tty_old_pgrp);
-+ if (tsk == NULL) {
-+ v->cpt_old_pgrp_type = CPT_PGRP_ORPHAN;
-+ tsk = find_task_by_pid_type_ve(PIDTYPE_PGID, sig->tty_old_pgrp);
-+ }
-+ read_unlock(&tasklist_lock);
-+ if (tsk == NULL) {
-+ eprintk_ctx("tty_old_pgrp does not exist anymore\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_old_pgrp = _pid_type_to_vpid(PIDTYPE_PGID, sig->tty_old_pgrp);
-+ if ((int)v->cpt_old_pgrp < 0) {
-+ dprintk_ctx("stray tty_old_pgrp %d\n", sig->tty_old_pgrp);
-+ v->cpt_old_pgrp = -1;
-+ v->cpt_old_pgrp_type = CPT_PGRP_STRAY;
-+ }
-+ }
-+
-+ if (sig->session <= 0) {
-+ eprintk_ctx("bad session\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_session_type = CPT_PGRP_NORMAL;
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_type_ve(PIDTYPE_PID, sig->session);
-+ if (tsk == NULL)
-+ v->cpt_session_type = CPT_PGRP_ORPHAN;
-+ read_unlock(&tasklist_lock);
-+ v->cpt_session = pid_type_to_vpid(PIDTYPE_SID, sig->session);
-+
-+ v->cpt_leader = sig->leader;
-+ v->cpt_ctty = CPT_NULL;
-+ if (sig->tty) {
-+ cpt_object_t *cobj = lookup_cpt_object(CPT_OBJ_TTY, sig->tty, ctx);
-+ if (cobj)
-+ v->cpt_ctty = cobj->o_pos;
-+ else {
-+ eprintk_ctx("controlling tty is not found\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ }
-+ memcpy(&v->cpt_sigpending, &sig->shared_pending.signal, 8);
-+
-+ v->cpt_curr_target = 0;
-+ if (sig->curr_target)
-+ v->cpt_curr_target = virt_pid(sig->curr_target);
-+ v->cpt_group_exit = sig->group_exit;
-+ v->cpt_group_exit_code = sig->group_exit_code;
-+ v->cpt_group_exit_task = 0;
-+ if (sig->group_exit_task)
-+ v->cpt_group_exit_task = virt_pid(sig->group_exit_task);
-+ v->cpt_notify_count = sig->notify_count;
-+ v->cpt_group_stop_count = sig->group_stop_count;
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
-+ v->cpt_stop_state = sig->stop_state;
-+
-+ v->cpt_utime = sig->utime;
-+ v->cpt_stime = sig->stime;
-+ v->cpt_cutime = sig->cutime;
-+ v->cpt_cstime = sig->cstime;
-+ v->cpt_nvcsw = sig->nvcsw;
-+ v->cpt_nivcsw = sig->nivcsw;
-+ v->cpt_cnvcsw = sig->cnvcsw;
-+ v->cpt_cnivcsw = sig->cnivcsw;
-+ v->cpt_min_flt = sig->min_flt;
-+ v->cpt_maj_flt = sig->maj_flt;
-+ v->cpt_cmin_flt = sig->cmin_flt;
-+ v->cpt_cmaj_flt = sig->cmaj_flt;
-+#endif
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+ if (RLIM_NLIMITS > CPT_RLIM_NLIMITS)
-+ __asm__("undefined\n");
-+
-+ for (i=0; i<CPT_RLIM_NLIMITS; i++) {
-+ if (i < RLIM_NLIMITS) {
-+ v->cpt_rlim_cur[i] = sig->rlim[i].rlim_cur;
-+ v->cpt_rlim_max[i] = sig->rlim[i].rlim_max;
-+ } else {
-+ v->cpt_rlim_cur[i] = CPT_NULL;
-+ v->cpt_rlim_max[i] = CPT_NULL;
-+ }
-+ }
-+#endif
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ dump_sigqueue(&sig->shared_pending, ctx);
-+
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+
-+static int dump_one_process(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ task_t *tsk = obj->o_obj;
-+ int last_thread;
-+ struct cpt_task_image *v = cpt_get_buf(ctx);
-+ cpt_object_t *tobj;
-+ cpt_object_t *tg_obj;
-+ loff_t saved_obj;
-+ int i;
-+ int err;
-+ struct timespec delta;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_signal = CPT_NULL;
-+ tg_obj = lookup_cpt_object(CPT_OBJ_SIGNAL_STRUCT, tsk->signal, ctx);
-+ if (!tg_obj) BUG();
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_TASK;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_state = tsk->state;
-+ if (tsk->state == EXIT_ZOMBIE) {
-+ eprintk_ctx("invalid zombie state on" CPT_FID "\n", CPT_TID(tsk));
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ } else if (tsk->state == EXIT_DEAD) {
-+ if (tsk->exit_state != EXIT_DEAD &&
-+ tsk->exit_state != EXIT_ZOMBIE) {
-+ eprintk_ctx("invalid exit_state %ld on" CPT_FID "\n", tsk->exit_state, CPT_TID(tsk));
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ }
-+ if (tsk->exit_state) {
-+ v->cpt_state = tsk->exit_state;
-+ if (tsk->state != EXIT_DEAD) {
-+ eprintk_ctx("invalid tsk->state %ld/%ld on" CPT_FID "\n",
-+ tsk->state, tsk->exit_state, CPT_TID(tsk));
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ }
-+ v->cpt_flags = tsk->flags&~PF_FROZEN;
-+ v->cpt_ptrace = tsk->ptrace;
-+ v->cpt_prio = tsk->prio;
-+ v->cpt_exit_code = tsk->exit_code;
-+ v->cpt_exit_signal = tsk->exit_signal;
-+ v->cpt_pdeath_signal = tsk->pdeath_signal;
-+ v->cpt_static_prio = tsk->static_prio;
-+ v->cpt_rt_priority = tsk->rt_priority;
-+ v->cpt_policy = tsk->policy;
-+ if (v->cpt_policy != SCHED_NORMAL) {
-+ eprintk_ctx("scheduler policy is not supported %d/%d(%s)\n", virt_pid(tsk), tsk->pid, tsk->comm);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+
-+ v->cpt_mm = CPT_NULL;
-+ if (tsk->mm) {
-+ tobj = lookup_cpt_object(CPT_OBJ_MM, tsk->mm, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_mm = tobj->o_pos;
-+ }
-+ v->cpt_files = CPT_NULL;
-+ if (tsk->files) {
-+ tobj = lookup_cpt_object(CPT_OBJ_FILES, tsk->files, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_files = tobj->o_pos;
-+ }
-+ v->cpt_fs = CPT_NULL;
-+ if (tsk->fs) {
-+ tobj = lookup_cpt_object(CPT_OBJ_FS, tsk->fs, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_fs = tobj->o_pos;
-+ }
-+ v->cpt_namespace = CPT_NULL;
-+ if (tsk->namespace) {
-+ tobj = lookup_cpt_object(CPT_OBJ_NAMESPACE, tsk->namespace, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_namespace = tobj->o_pos;
-+
-+ if (tsk->namespace != current->namespace)
-+ eprintk_ctx("namespaces are not supported: process %d/%d(%s)\n", virt_pid(tsk), tsk->pid, tsk->comm);
-+ }
-+ v->cpt_sysvsem_undo = CPT_NULL;
-+ if (tsk->sysvsem.undo_list && !tsk->exit_state) {
-+ tobj = lookup_cpt_object(CPT_OBJ_SYSVSEM_UNDO, tsk->sysvsem.undo_list, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_sysvsem_undo = tobj->o_pos;
-+ }
-+ v->cpt_sighand = CPT_NULL;
-+ if (tsk->sighand) {
-+ tobj = lookup_cpt_object(CPT_OBJ_SIGHAND_STRUCT, tsk->sighand, ctx);
-+ if (!tobj) BUG();
-+ v->cpt_sighand = tobj->o_pos;
-+ }
-+ v->cpt_sigblocked = cpt_sigset_export(&tsk->blocked);
-+ v->cpt_sigrblocked = cpt_sigset_export(&tsk->real_blocked);
-+ v->cpt_sigsuspend_blocked = cpt_sigset_export(&tsk->saved_sigset);
-+
-+ v->cpt_pid = virt_pid(tsk);
-+ v->cpt_tgid = virt_tgid(tsk);
-+ v->cpt_ppid = 0;
-+ if (tsk->parent) {
-+ if (tsk->parent != tsk->real_parent &&
-+ !lookup_cpt_object(CPT_OBJ_TASK, tsk->parent, ctx)) {
-+ eprintk_ctx("task %d/%d(%s) is ptraced from ve0\n", tsk->pid, virt_pid(tsk), tsk->comm);
-+ cpt_release_buf(ctx);
-+ return -EBUSY;
-+ }
-+ v->cpt_ppid = virt_pid(tsk->parent);
-+ }
-+ v->cpt_rppid = tsk->real_parent ? virt_pid(tsk->real_parent) : 0;
-+ v->cpt_pgrp = virt_pgid(tsk);
-+ v->cpt_session = virt_sid(tsk);
-+ v->cpt_old_pgrp = 0;
-+ if (tsk->signal->tty_old_pgrp)
-+ v->cpt_old_pgrp = _pid_type_to_vpid(PIDTYPE_PGID, tsk->signal->tty_old_pgrp);
-+ v->cpt_leader = tsk->group_leader ? virt_pid(tsk->group_leader) : 0;
-+ v->cpt_set_tid = (unsigned long)tsk->set_child_tid;
-+ v->cpt_clear_tid = (unsigned long)tsk->clear_child_tid;
-+ memcpy(v->cpt_comm, tsk->comm, 16);
-+ v->cpt_user = tsk->user->uid;
-+ v->cpt_uid = tsk->uid;
-+ v->cpt_euid = tsk->euid;
-+ v->cpt_suid = tsk->suid;
-+ v->cpt_fsuid = tsk->fsuid;
-+ v->cpt_gid = tsk->gid;
-+ v->cpt_egid = tsk->egid;
-+ v->cpt_sgid = tsk->sgid;
-+ v->cpt_fsgid = tsk->fsgid;
-+ v->cpt_ngids = 0;
-+ if (tsk->group_info && tsk->group_info->ngroups != 0) {
-+ int i = tsk->group_info->ngroups;
-+ if (i > 32) {
-+ eprintk_ctx("too many of groups, truncated\n");
-+ i = 32;
-+ }
-+ v->cpt_ngids = i;
-+ for (i--; i>=0; i--)
-+ v->cpt_gids[i] = tsk->group_info->small_block[i];
-+ }
-+ memcpy(&v->cpt_ecap, &tsk->cap_effective, 8);
-+ memcpy(&v->cpt_icap, &tsk->cap_inheritable, 8);
-+ memcpy(&v->cpt_pcap, &tsk->cap_permitted, 8);
-+ v->cpt_keepcap = tsk->keep_capabilities;
-+
-+ v->cpt_did_exec = tsk->did_exec;
-+ v->cpt_exec_domain = -1;
-+ v->cpt_thrflags = tsk->thread_info->flags & ~(1<<TIF_FREEZE);
-+ v->cpt_64bit = 0;
-+#ifdef CONFIG_X86_64
-+ /* Clear x86_64 specific flags */
-+ v->cpt_thrflags &= ~(_TIF_FORK|_TIF_ABI_PENDING|_TIF_IA32);
-+ if (!(tsk->thread_info->flags & _TIF_IA32)) {
-+ ctx->tasks64++;
-+ v->cpt_64bit = 1;
-+ }
-+#endif
-+ v->cpt_thrstatus = tsk->thread_info->status;
-+ v->cpt_addr_limit = -1;
-+
-+ v->cpt_personality = tsk->personality;
-+
-+ for (i=0; i<GDT_ENTRY_TLS_ENTRIES; i++) {
-+ if (i>=3) {
-+ eprintk_ctx("too many tls descs\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+#ifndef CONFIG_X86_64
-+ v->cpt_tls[i] = (((u64)tsk->thread.tls_array[i].b)<<32) + tsk->thread.tls_array[i].a;
-+#else
-+ v->cpt_tls[i] = tsk->thread.tls_array[i];
-+#endif
-+ }
-+
-+ v->cpt_restart.fn = CPT_RBL_0;
-+ if (tsk->thread_info->restart_block.fn != current->thread_info->restart_block.fn) {
-+ long val;
-+
-+ if (tsk->thread_info->restart_block.fn != nanosleep_restart
-+#ifdef CONFIG_X86_64
-+ && tsk->thread_info->restart_block.fn != compat_nanosleep_restart
-+#endif
-+ ) {
-+ eprintk_ctx("unknown restart block %p\n", tsk->thread_info->restart_block.fn);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_restart.fn = CPT_RBL_NANOSLEEP;
-+#ifdef CONFIG_X86_64
-+ if (tsk->thread_info->restart_block.fn == compat_nanosleep_restart)
-+ v->cpt_restart.fn = CPT_RBL_COMPAT_NANOSLEEP;
-+#endif
-+ val = tsk->thread_info->restart_block.arg0 - (unsigned long)ctx->cpt_jiffies64;
-+ if (val < 0)
-+ val = 0;
-+ v->cpt_restart.arg0 = (s64)val * TICK_NSEC;
-+ v->cpt_restart.arg1 = 0;
-+ v->cpt_restart.arg2 = tsk->thread_info->restart_block.arg1;
-+ v->cpt_restart.arg3 = CLOCK_MONOTONIC;
-+ }
-+ v->cpt_it_real_incr = tsk->it_real_incr*TICK_NSEC;
-+ v->cpt_it_prof_incr = tsk->it_prof_incr;
-+ v->cpt_it_virt_incr = tsk->it_virt_incr;
-+ v->cpt_it_real_value = 0;
-+ if (timer_pending(&tsk->real_timer)) {
-+ unsigned long val = tsk->real_timer.expires -
-+ (unsigned long)ctx->cpt_jiffies64;
-+ if ((long)val <= 0)
-+ val = 1;
-+ v->cpt_it_real_value = (u64)val * TICK_NSEC;
-+ }
-+ v->cpt_it_prof_value = tsk->it_prof_value;
-+ v->cpt_it_virt_value = tsk->it_virt_value;
-+ v->cpt_used_math = tsk->used_math;
-+
-+ if (tsk->notifier) {
-+ eprintk_ctx("task notifier is in use: process %d/%d(%s)\n", virt_pid(tsk), tsk->pid, tsk->comm);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+
-+ v->cpt_utime = tsk->utime;
-+ v->cpt_stime = tsk->stime;
-+ delta = tsk->start_time;
-+ set_normalized_timespec(&delta,
-+ delta.tv_sec - get_exec_env()->start_timespec.tv_sec,
-+ delta.tv_nsec - get_exec_env()->start_timespec.tv_nsec);
-+ v->cpt_starttime = cpt_timespec_export(&delta);
-+ v->cpt_nvcsw = tsk->nvcsw;
-+ v->cpt_nivcsw = tsk->nivcsw;
-+ v->cpt_min_flt = tsk->min_flt;
-+ v->cpt_maj_flt = tsk->maj_flt;
-+
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
-+ v->cpt_cutime = tsk->cutime;
-+ v->cpt_cstime = tsk->cstime;
-+ v->cpt_cnvcsw = tsk->cnvcsw;
-+ v->cpt_cnivcsw = tsk->cnivcsw;
-+ v->cpt_cmin_flt = tsk->cmin_flt;
-+ v->cpt_cmaj_flt = tsk->cmaj_flt;
-+#endif
-+
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
-+ if (RLIM_NLIMITS > CPT_RLIM_NLIMITS)
-+ __asm__("undefined\n");
-+
-+ for (i=0; i<CPT_RLIM_NLIMITS; i++) {
-+ if (i < RLIM_NLIMITS) {
-+ v->cpt_rlim_cur[i] = tsk->rlim[i].rlim_cur;
-+ v->cpt_rlim_max[i] = tsk->rlim[i].rlim_max;
-+ } else {
-+ v->cpt_rlim_cur[i] = CPT_NULL;
-+ v->cpt_rlim_max[i] = CPT_NULL;
-+ }
-+ }
-+#endif
-+
-+ if (tsk->mm)
-+ v->cpt_mm_ub = cpt_lookup_ubc(mm_ub(tsk->mm), ctx);
-+ else
-+ v->cpt_mm_ub = CPT_NULL;
-+ v->cpt_task_ub = cpt_lookup_ubc(task_bc(tsk)->task_ub, ctx);
-+ v->cpt_exec_ub = cpt_lookup_ubc(task_bc(tsk)->exec_ub, ctx);
-+ v->cpt_fork_sub = cpt_lookup_ubc(task_bc(tsk)->fork_sub, ctx);
-+
-+ v->cpt_ptrace_message = tsk->ptrace_message;
-+ v->cpt_pn_state = tsk->pn_state;
-+ v->cpt_stopped_state = tsk->stopped_state;
-+ v->cpt_sigsuspend_state = tsk->sigsuspend_state;
-+
-+#ifndef CONFIG_X86_64
-+ if (tsk->thread.vm86_info) {
-+ eprintk_ctx("vm86 task is running\n");
-+ cpt_release_buf(ctx);
-+ return -EBUSY;
-+ }
-+#endif
-+
-+ v->cpt_sigpending = cpt_sigset_export(&tsk->pending.signal);
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ dump_kstack(tsk, ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ err = dump_registers(tsk, ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ if (err)
-+ return err;
-+
-+ if (tsk->used_math) {
-+ cpt_push_object(&saved_obj, ctx);
-+ dump_fpustate(tsk, ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+
-+ if (tsk->last_siginfo) {
-+ struct cpt_siginfo_image si;
-+ cpt_push_object(&saved_obj, ctx);
-+
-+ si.cpt_next = sizeof(si);
-+ si.cpt_object = CPT_OBJ_LASTSIGINFO;
-+ si.cpt_hdrlen = sizeof(si);
-+ si.cpt_content = CPT_CONTENT_VOID;
-+
-+ if (encode_siginfo(&si, tsk->last_siginfo))
-+ return -EINVAL;
-+
-+ ctx->write(&si, sizeof(si), ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+
-+ if (tsk->sas_ss_size) {
-+ struct cpt_sigaltstack_image si;
-+ cpt_push_object(&saved_obj, ctx);
-+
-+ si.cpt_next = sizeof(si);
-+ si.cpt_object = CPT_OBJ_SIGALTSTACK;
-+ si.cpt_hdrlen = sizeof(si);
-+ si.cpt_content = CPT_CONTENT_VOID;
-+
-+ si.cpt_stack = tsk->sas_ss_sp;
-+ si.cpt_stacksize = tsk->sas_ss_size;
-+
-+ ctx->write(&si, sizeof(si), ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+
-+ dump_sigqueue(&tsk->pending, ctx);
-+
-+ last_thread = 1;
-+ read_lock(&tasklist_lock);
-+ do {
-+ task_t * next = next_thread(tsk);
-+ if (next != tsk && !thread_group_leader(next))
-+ last_thread = 0;
-+ } while (0);
-+ read_unlock(&tasklist_lock);
-+
-+ if (last_thread) {
-+ task_t *prev_tsk;
-+ int err;
-+ loff_t pos = ctx->file->f_pos;
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ err = dump_one_signal_struct(tg_obj, ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ if (err)
-+ return err;
-+
-+ prev_tsk = tsk;
-+ for (;;) {
-+ if (prev_tsk->tgid == tsk->tgid) {
-+ loff_t tg_pos;
-+
-+ tg_pos = obj->o_pos + offsetof(struct cpt_task_image, cpt_signal);
-+ ctx->pwrite(&pos, sizeof(pos), ctx, tg_pos);
-+ if (thread_group_leader(prev_tsk))
-+ break;
-+ }
-+
-+ if (obj->o_list.prev == &ctx->object_array[CPT_OBJ_TASK]) {
-+ eprintk_ctx("bug: thread group leader is lost\n");
-+ return -EINVAL;
-+ }
-+
-+ obj = list_entry(obj->o_list.prev, cpt_object_t, o_list);
-+ prev_tsk = obj->o_obj;
-+ }
-+ }
-+
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+int cpt_dump_tasks(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_TASKS);
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ int err;
-+
-+ if ((err = dump_one_process(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+int cpt_collect_signals(cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ /* Collect process fd sets */
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->signal && !list_empty(&tsk->signal->posix_timers)) {
-+ eprintk_ctx("task %d/%d(%s) uses posix timers\n", tsk->pid, virt_pid(tsk), tsk->comm);
-+ return -EBUSY;
-+ }
-+ if (tsk->signal && cpt_object_add(CPT_OBJ_SIGNAL_STRUCT, tsk->signal, ctx) == NULL)
-+ return -ENOMEM;
-+ if (tsk->sighand && cpt_object_add(CPT_OBJ_SIGHAND_STRUCT, tsk->sighand, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+ return 0;
-+}
-+
-+
-+static int dump_one_sighand_struct(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct sighand_struct *sig = obj->o_obj;
-+ struct cpt_sighand_image *v = cpt_get_buf(ctx);
-+ int i;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_SIGHAND_STRUCT;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ for (i=0; i< _NSIG; i++) {
-+ if (sig->action[i].sa.sa_handler != SIG_DFL ||
-+ sig->action[i].sa.sa_flags) {
-+ loff_t saved_obj;
-+ struct cpt_sighandler_image *o = cpt_get_buf(ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_open_object(NULL, ctx);
-+
-+ o->cpt_next = CPT_NULL;
-+ o->cpt_object = CPT_OBJ_SIGHANDLER;
-+ o->cpt_hdrlen = sizeof(*o);
-+ o->cpt_content = CPT_CONTENT_VOID;
-+
-+ o->cpt_signo = i;
-+ o->cpt_handler = (unsigned long)sig->action[i].sa.sa_handler;
-+ o->cpt_restorer = (unsigned long)sig->action[i].sa.sa_restorer;
-+ o->cpt_flags = sig->action[i].sa.sa_flags;
-+ memcpy(&o->cpt_mask, &sig->action[i].sa.sa_mask, 8);
-+ ctx->write(o, sizeof(*o), ctx);
-+ cpt_release_buf(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+ }
-+
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+int cpt_dump_sighand(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ cpt_open_section(ctx, CPT_SECT_SIGHAND_STRUCT);
-+
-+ for_each_object(obj, CPT_OBJ_SIGHAND_STRUCT) {
-+ int err;
-+
-+ if ((err = dump_one_sighand_struct(obj, ctx)) != 0)
-+ return err;
-+ }
-+
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_process.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_process.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_process.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_process.h 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,12 @@
-+int cpt_collect_signals(cpt_context_t *);
-+int cpt_dump_signal(struct cpt_context *);
-+int cpt_dump_sighand(struct cpt_context *);
-+int cpt_dump_tasks(struct cpt_context *);
-+
-+int rst_signal_complete(struct cpt_task_image *ti, int *exiting, struct cpt_context *ctx);
-+__u32 rst_signal_flag(struct cpt_task_image *ti, struct cpt_context *ctx);
-+
-+int rst_restore_process(struct cpt_context *ctx);
-+int rst_process_linkage(struct cpt_context *ctx);
-+
-+int check_task_state(task_t *tsk, struct cpt_context *ctx);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,748 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/un.h>
-+#include <linux/tcp.h>
-+#include <net/sock.h>
-+#include <net/scm.h>
-+#include <net/af_unix.h>
-+#include <net/tcp.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_socket.h"
-+#include "cpt_files.h"
-+#include "cpt_kernel.h"
-+
-+static int dump_rqueue(int owner, struct sock *sk, struct cpt_context *ctx);
-+
-+
-+/* Sockets are quite different of another kinds of files.
-+ * There is one simplification: only one struct file can refer to a socket,
-+ * so we could store information about socket directly in section FILES as
-+ * a description of a file and append f.e. array of not-yet-accepted
-+ * connections of listening socket as array of auxiliary data.
-+ *
-+ * Complications are:
-+ * 1. TCP sockets can be orphans. We have to relocate orphans as well,
-+ * so we have to create special section for orphans.
-+ * 2. AF_UNIX sockets are distinguished objects: set of links between
-+ * AF_UNIX sockets is quite arbitrary.
-+ * A. Each socket can refers to many of files due to FD passing.
-+ * B. Each socket except for connected ones can have in queue skbs
-+ * sent by any of sockets.
-+ *
-+ * 2A is relatively easy: after our tasks are frozen we make an additional
-+ * recursive pass throgh set of collected files and get referenced to
-+ * FD passed files. After end of recursion, all the files are treated
-+ * in the same way. All they will be stored in section FILES.
-+ *
-+ * 2B. We have to resolve all those references at some point.
-+ * It is the place where pipe-like approach to image fails.
-+ *
-+ * All this makes socket checkpointing quite chumbersome.
-+ * Right now we collect all the sockets and assign some numeric index value
-+ * to each of them. The socket section is separate and put after section FILES,
-+ * so section FILES refers to sockets by index, section SOCKET refers to FILES
-+ * as usual by position in image. All the refs inside socket section are
-+ * by index. When restoring we read socket section, create objects to hold
-+ * mappings index <-> pos. At the second pass we open sockets (simultaneosly
-+ * with their pairs) and create FILE objects.
-+ */
-+
-+
-+/* ====== FD passing ====== */
-+
-+/* Almost nobody does FD passing via AF_UNIX sockets, nevertheless we
-+ * have to implement this. A problem is that in general case we receive
-+ * skbs from an unknown context, so new files can arrive to checkpointed
-+ * set of processes even after they are stopped. Well, we are going just
-+ * to ignore unknown fds while doing real checkpointing. It is fair because
-+ * links outside checkpointed set are going to fail anyway.
-+ *
-+ * ATTN: the procedure is recursive. We linearize the recursion adding
-+ * newly found files to the end of file list, so they will be analyzed
-+ * in the same loop.
-+ */
-+
-+static int collect_one_passedfd(struct file *file, cpt_context_t * ctx)
-+{
-+ struct inode *inode = file->f_dentry->d_inode;
-+ struct socket *sock;
-+ struct sock *sk;
-+ struct sk_buff *skb;
-+
-+ if (!inode->i_sock)
-+ return -ENOTSOCK;
-+
-+ sock = &container_of(inode, struct socket_alloc, vfs_inode)->socket;
-+
-+ if (sock->ops->family != AF_UNIX)
-+ return 0;
-+
-+ sk = sock->sk;
-+
-+ /* Subtle locking issue. skbs cannot be removed while
-+ * we are scanning, because all the processes are stopped.
-+ * They still can be added to tail of queue. Locking while
-+ * we dereference skb->next is enough to resolve this.
-+ * See above about collision with skbs added after we started
-+ * checkpointing.
-+ */
-+
-+ skb = skb_peek(&sk->sk_receive_queue);
-+ while (skb && skb != (struct sk_buff*)&sk->sk_receive_queue) {
-+ if (UNIXCB(skb).fp && skb->sk &&
-+ (!sock_flag(skb->sk, SOCK_DEAD) || unix_peer(sk) == skb->sk)) {
-+ struct scm_fp_list *fpl = UNIXCB(skb).fp;
-+ int i;
-+
-+ for (i = fpl->count-1; i >= 0; i--) {
-+ if (cpt_object_add(CPT_OBJ_FILE, fpl->fp[i], ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+ }
-+
-+ spin_lock_irq(&sk->sk_receive_queue.lock);
-+ skb = skb->next;
-+ spin_unlock_irq(&sk->sk_receive_queue.lock);
-+ }
-+
-+ return 0;
-+}
-+
-+int cpt_collect_passedfds(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+
-+ if (S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
-+ int err;
-+
-+ if ((err = collect_one_passedfd(file, ctx)) < 0)
-+ return err;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+/* ====== End of FD passing ====== */
-+
-+/* Must be called under bh_lock_sock() */
-+
-+void clear_backlog(struct sock *sk)
-+{
-+ struct sk_buff *skb = sk->sk_backlog.head;
-+
-+ sk->sk_backlog.head = sk->sk_backlog.tail = NULL;
-+ while (skb) {
-+ struct sk_buff *next = skb->next;
-+
-+ skb->next = NULL;
-+ kfree_skb(skb);
-+ skb = next;
-+ }
-+}
-+
-+void release_sock_nobacklog(struct sock *sk)
-+{
-+ spin_lock_bh(&(sk->sk_lock.slock));
-+ clear_backlog(sk);
-+ sk->sk_lock.owner = NULL;
-+ if (waitqueue_active(&(sk->sk_lock.wq)))
-+ wake_up(&(sk->sk_lock.wq));
-+ spin_unlock_bh(&(sk->sk_lock.slock));
-+}
-+
-+int cpt_dump_skb(int type, int owner, struct sk_buff *skb,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_skb_image *v = cpt_get_buf(ctx);
-+ loff_t saved_obj;
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_open_object(NULL, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_SKB;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_owner = owner;
-+ v->cpt_queue = type;
-+ v->cpt_stamp = cpt_timeval_export(&skb->stamp);
-+ v->cpt_hspace = skb->data - skb->head;
-+ v->cpt_tspace = skb->end - skb->tail;
-+ v->cpt_h = skb->h.raw - skb->head;
-+ v->cpt_nh = skb->nh.raw - skb->head;
-+ v->cpt_mac = skb->mac.raw - skb->head;
-+ if (sizeof(skb->cb) != sizeof(v->cpt_cb)) BUG();
-+ memcpy(v->cpt_cb, skb->cb, sizeof(skb->cb));
-+ v->cpt_len = skb->len;
-+ v->cpt_mac_len = skb->mac_len;
-+ v->cpt_csum = skb->csum;
-+ v->cpt_local_df = skb->local_df;
-+ v->cpt_pkt_type = skb->pkt_type;
-+ v->cpt_ip_summed = skb->ip_summed;
-+ v->cpt_priority = skb->priority;
-+ v->cpt_protocol = skb->protocol;
-+ v->cpt_tso_segs = skb_shinfo(skb)->tso_segs;
-+ v->cpt_tso_size = skb_shinfo(skb)->tso_size;
-+ v->cpt_security = skb->security;
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ if (skb->len + (skb->data - skb->head) > 0) {
-+ struct cpt_obj_bits ob;
-+ loff_t saved_obj2;
-+
-+ cpt_push_object(&saved_obj2, ctx);
-+ cpt_open_object(NULL, ctx);
-+ ob.cpt_next = CPT_NULL;
-+ ob.cpt_object = CPT_OBJ_BITS;
-+ ob.cpt_hdrlen = sizeof(ob);
-+ ob.cpt_content = CPT_CONTENT_DATA;
-+ ob.cpt_size = skb->len + v->cpt_hspace;
-+
-+ ctx->write(&ob, sizeof(ob), ctx);
-+
-+ ctx->write(skb->head, (skb->data-skb->head) + (skb->len-skb->data_len), ctx);
-+ if (skb->data_len) {
-+ int offset = skb->len - skb->data_len;
-+ while (offset < skb->len) {
-+ int copy = skb->len - offset;
-+ if (copy > PAGE_SIZE)
-+ copy = PAGE_SIZE;
-+ (void)cpt_get_buf(ctx);
-+ if (skb_copy_bits(skb, offset, ctx->tmpbuf, copy))
-+ BUG();
-+ ctx->write(ctx->tmpbuf, copy, ctx);
-+ __cpt_release_buf(ctx);
-+ offset += copy;
-+ }
-+ }
-+
-+ ctx->align(ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj2, ctx);
-+ }
-+
-+ if (skb->sk && skb->sk->sk_family == AF_UNIX) {
-+ struct scm_fp_list *fpl = UNIXCB(skb).fp;
-+
-+ if (fpl) {
-+ int i;
-+
-+ for (i = 0; i < fpl->count; i++) {
-+ struct cpt_fd_image v;
-+ cpt_object_t *obj;
-+ loff_t saved_obj2;
-+
-+ obj = lookup_cpt_object(CPT_OBJ_FILE, fpl->fp[i], ctx);
-+
-+ if (!obj) {
-+ eprintk_ctx("lost passed FD\n");
-+ return -EINVAL;
-+ }
-+
-+ cpt_push_object(&saved_obj2, ctx);
-+ cpt_open_object(NULL, ctx);
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_FILEDESC;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_VOID;
-+
-+ v.cpt_fd = i;
-+ v.cpt_file = obj->o_pos;
-+ v.cpt_flags = 0;
-+ ctx->write(&v, sizeof(v), ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj2, ctx);
-+ }
-+ }
-+ }
-+
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ return 0;
-+}
-+
-+static int dump_rqueue(int idx, struct sock *sk, struct cpt_context *ctx)
-+{
-+ struct sk_buff *skb;
-+ struct sock *sk_cache = NULL;
-+
-+ skb = skb_peek(&sk->sk_receive_queue);
-+ while (skb && skb != (struct sk_buff*)&sk->sk_receive_queue) {
-+ int err;
-+
-+ if (sk->sk_family == AF_UNIX) {
-+ cpt_object_t *obj;
-+ if (skb->sk != sk_cache) {
-+ idx = -1;
-+ sk_cache = NULL;
-+ obj = lookup_cpt_object(CPT_OBJ_SOCKET, skb->sk, ctx);
-+ if (obj) {
-+ idx = obj->o_index;
-+ sk_cache = skb->sk;
-+ } else if (unix_peer(sk) != skb->sk)
-+ goto next_skb;
-+ }
-+ }
-+
-+ err = cpt_dump_skb(CPT_SKB_RQ, idx, skb, ctx);
-+ if (err)
-+ return err;
-+
-+next_skb:
-+ spin_lock_irq(&sk->sk_receive_queue.lock);
-+ skb = skb->next;
-+ spin_unlock_irq(&sk->sk_receive_queue.lock);
-+ }
-+ return 0;
-+}
-+
-+static int dump_wqueue(int idx, struct sock *sk, struct cpt_context *ctx)
-+{
-+ struct sk_buff *skb;
-+
-+ skb = skb_peek(&sk->sk_write_queue);
-+ while (skb && skb != (struct sk_buff*)&sk->sk_write_queue) {
-+ int err = cpt_dump_skb(CPT_SKB_WQ, idx, skb, ctx);
-+ if (err)
-+ return err;
-+
-+ spin_lock_irq(&sk->sk_write_queue.lock);
-+ skb = skb->next;
-+ spin_unlock_irq(&sk->sk_write_queue.lock);
-+ }
-+ return 0;
-+}
-+
-+void cpt_dump_sock_attr(struct sock *sk, cpt_context_t *ctx)
-+{
-+ if (sk->sk_filter) {
-+ loff_t saved_obj;
-+ struct cpt_obj_bits v;
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_SKFILTER;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_DATA;
-+ v.cpt_size = sk->sk_filter->len*sizeof(struct sock_filter);
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+ ctx->write(sk->sk_filter->insns, v.cpt_size, ctx);
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+}
-+
-+/* Dump socket content */
-+
-+int cpt_dump_socket(cpt_object_t *obj, struct sock *sk, int index, int parent, struct cpt_context *ctx)
-+{
-+ struct cpt_sock_image *v = cpt_get_buf(ctx);
-+ struct socket *sock;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_SOCKET;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_file = CPT_NULL;
-+ sock = sk->sk_socket;
-+ if (sock && sock->file) {
-+ cpt_object_t *tobj;
-+ tobj = lookup_cpt_object(CPT_OBJ_FILE, sock->file, ctx);
-+ if (tobj)
-+ v->cpt_file = tobj->o_pos;
-+ }
-+ v->cpt_index = index;
-+ v->cpt_parent = parent;
-+
-+ if (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) {
-+ if (sock && !obj->o_lock) {
-+ lock_sock(sk);
-+ obj->o_lock = 1;
-+ }
-+ }
-+
-+ /* Some bits stored in inode */
-+ v->cpt_ssflags = sock ? sock->flags : 0;
-+ v->cpt_sstate = sock ? sock->state : 0;
-+ v->cpt_passcred = sock ? sock->passcred : 0;
-+
-+ /* Common data */
-+ v->cpt_family = sk->sk_family;
-+ v->cpt_type = sk->sk_type;
-+ v->cpt_state = sk->sk_state;
-+ v->cpt_reuse = sk->sk_reuse;
-+ v->cpt_zapped = sk->sk_zapped;
-+ v->cpt_shutdown = sk->sk_shutdown;
-+ v->cpt_userlocks = sk->sk_userlocks;
-+ v->cpt_no_check = sk->sk_no_check;
-+ v->cpt_debug = sk->sk_debug;
-+ v->cpt_rcvtstamp = sk->sk_rcvtstamp;
-+ v->cpt_localroute = sk->sk_localroute;
-+ v->cpt_protocol = sk->sk_protocol;
-+ v->cpt_err = sk->sk_err;
-+ v->cpt_err_soft = sk->sk_err_soft;
-+ v->cpt_max_ack_backlog = sk->sk_max_ack_backlog;
-+ v->cpt_priority = sk->sk_priority;
-+ v->cpt_rcvlowat = sk->sk_rcvlowat;
-+ v->cpt_rcvtimeo = CPT_NULL;
-+ if (sk->sk_rcvtimeo != MAX_SCHEDULE_TIMEOUT)
-+ v->cpt_rcvtimeo = sk->sk_rcvtimeo > INT_MAX ? INT_MAX : sk->sk_rcvtimeo;
-+ v->cpt_sndtimeo = CPT_NULL;
-+ if (sk->sk_sndtimeo != MAX_SCHEDULE_TIMEOUT)
-+ v->cpt_sndtimeo = sk->sk_sndtimeo > INT_MAX ? INT_MAX : sk->sk_sndtimeo;
-+ v->cpt_rcvbuf = sk->sk_rcvbuf;
-+ v->cpt_sndbuf = sk->sk_sndbuf;
-+ v->cpt_bound_dev_if = sk->sk_bound_dev_if;
-+ v->cpt_flags = sk->sk_flags;
-+ v->cpt_lingertime = CPT_NULL;
-+ if (sk->sk_lingertime != MAX_SCHEDULE_TIMEOUT)
-+ v->cpt_lingertime = sk->sk_lingertime > INT_MAX ? INT_MAX : sk->sk_lingertime;
-+ v->cpt_peer_pid = sk->sk_peercred.pid;
-+ v->cpt_peer_uid = sk->sk_peercred.uid;
-+ v->cpt_peer_gid = sk->sk_peercred.gid;
-+ v->cpt_stamp = cpt_timeval_export(&sk->sk_stamp);
-+
-+ v->cpt_peer = -1;
-+ v->cpt_socketpair = 0;
-+ v->cpt_deleted = 0;
-+
-+ v->cpt_laddrlen = 0;
-+ if (sock) {
-+ int alen = sizeof(v->cpt_laddr);
-+ int err = sock->ops->getname(sock, (struct sockaddr*)&v->cpt_laddr, &alen, 0);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ v->cpt_laddrlen = alen;
-+ }
-+ v->cpt_raddrlen = 0;
-+ if (sock) {
-+ int alen = sizeof(v->cpt_raddr);
-+ int err = sock->ops->getname(sock, (struct sockaddr*)&v->cpt_raddr, &alen, 2);
-+ if (!err)
-+ v->cpt_raddrlen = alen;
-+ }
-+
-+ if (sk->sk_family == AF_UNIX) {
-+ if (unix_sk(sk)->dentry) {
-+ struct dentry *d = unix_sk(sk)->dentry;
-+ v->cpt_deleted = !IS_ROOT(d) && d_unhashed(d);
-+ if (!v->cpt_deleted) {
-+ int err = 0;
-+ char *path;
-+ unsigned long pg = __get_free_page(GFP_KERNEL);
-+
-+ if (!pg) {
-+ cpt_release_buf(ctx);
-+ return -ENOMEM;
-+ }
-+
-+ path = d_path(d, unix_sk(sk)->mnt, (char *)pg, PAGE_SIZE);
-+
-+ if (!IS_ERR(path)) {
-+ int len = strlen(path);
-+ if (len < 126) {
-+ strcpy(((char*)v->cpt_laddr)+2, path);
-+ v->cpt_laddrlen = len + 2;
-+ } else {
-+ wprintk_ctx("af_unix path is too long: %s (%s)\n", path, ((char*)v->cpt_laddr)+2);
-+ }
-+ err = cpt_verify_overmount(path, d, unix_sk(sk)->mnt, ctx);
-+ } else {
-+ eprintk_ctx("cannot get path of an af_unix socket\n");
-+ err = PTR_ERR(path);
-+ }
-+ free_page(pg);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ }
-+ }
-+
-+ /* If the socket is connected, find its peer. If peer is not
-+ * in our table, the socket is connected to external process
-+ * and we consider it disconnected.
-+ */
-+ if (unix_peer(sk)) {
-+ cpt_object_t *pobj;
-+ pobj = lookup_cpt_object(CPT_OBJ_SOCKET, unix_peer(sk), ctx);
-+ if (pobj)
-+ v->cpt_peer = pobj->o_index;
-+ else
-+ v->cpt_shutdown = SHUTDOWN_MASK;
-+
-+ if (unix_peer(unix_peer(sk)) == sk)
-+ v->cpt_socketpair = 1;
-+ }
-+
-+ /* If the socket shares address with another socket it is
-+ * child of some listening socket. Find and record it. */
-+ if (unix_sk(sk)->addr &&
-+ atomic_read(&unix_sk(sk)->addr->refcnt) > 1 &&
-+ sk->sk_state != TCP_LISTEN) {
-+ cpt_object_t *pobj;
-+ for_each_object(pobj, CPT_OBJ_SOCKET) {
-+ struct sock *psk = pobj->o_obj;
-+ if (psk->sk_family == AF_UNIX &&
-+ psk->sk_state == TCP_LISTEN &&
-+ unix_sk(psk)->addr == unix_sk(sk)->addr) {
-+ v->cpt_parent = pobj->o_index;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+
-+ if (sk->sk_family == AF_INET || sk->sk_family == AF_INET6)
-+ cpt_dump_socket_in(v, sk, ctx);
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ cpt_dump_sock_attr(sk, ctx);
-+
-+ dump_rqueue(index, sk, ctx);
-+ if (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) {
-+ dump_wqueue(index, sk, ctx);
-+ cpt_dump_ofo_queue(index, sk, ctx);
-+ }
-+
-+ if ((sk->sk_family == AF_INET || sk->sk_family == AF_INET6)
-+ && sk->sk_state == TCP_LISTEN)
-+ cpt_dump_synwait_queue(sk, index, ctx);
-+
-+ cpt_close_object(ctx);
-+
-+ if ((sk->sk_family == AF_INET || sk->sk_family == AF_INET6)
-+ && sk->sk_state == TCP_LISTEN)
-+ cpt_dump_accept_queue(sk, index, ctx);
-+
-+ return 0;
-+}
-+
-+int cpt_dump_orphaned_sockets(struct cpt_context *ctx)
-+{
-+ int i;
-+
-+ cpt_open_section(ctx, CPT_SECT_ORPHANS);
-+
-+ for (i = 0; i < tcp_ehash_size; i++) {
-+ struct tcp_ehash_bucket *head = &tcp_ehash[i];
-+ struct sock *sk;
-+ struct hlist_node *node;
-+
-+retry:
-+ read_lock_bh(&head->lock);
-+ sk_for_each(sk, node, &head->chain) {
-+
-+ if (VE_OWNER_SK(sk) != get_exec_env())
-+ continue;
-+ if (sk->sk_socket)
-+ continue;
-+ if (!sock_flag(sk, SOCK_DEAD))
-+ continue;
-+ if (lookup_cpt_object(CPT_OBJ_SOCKET, sk, ctx))
-+ continue;
-+ sock_hold(sk);
-+ read_unlock_bh(&head->lock);
-+
-+ local_bh_disable();
-+ bh_lock_sock(sk);
-+ if (sock_owned_by_user(sk))
-+ eprintk_ctx("BUG: sk locked by whom?\n");
-+ sk->sk_lock.owner = (void *)1;
-+ bh_unlock_sock(sk);
-+ local_bh_enable();
-+
-+ cpt_dump_socket(NULL, sk, -1, -1, ctx);
-+
-+ local_bh_disable();
-+ bh_lock_sock(sk);
-+ sk->sk_lock.owner = NULL;
-+ clear_backlog(sk);
-+ tcp_done(sk);
-+ bh_unlock_sock(sk);
-+ local_bh_enable();
-+ sock_put(sk);
-+
-+ goto retry;
-+ }
-+ read_unlock_bh(&head->lock);
-+ }
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int can_dump(struct sock *sk, cpt_context_t *ctx)
-+{
-+ switch (sk->sk_family) {
-+ case AF_NETLINK:
-+ if (((struct netlink_opt *)(sk->sk_protinfo))->cb) {
-+ eprintk_ctx("netlink socket has active callback\n");
-+ return 0;
-+ }
-+ break;
-+ }
-+ return 1;
-+}
-+
-+/* We are not going to block suspend when we have external AF_UNIX connections.
-+ * But we cannot stop feed of new packets/connections to our environment
-+ * from outside. Taking into account that it is intrincically unreliable,
-+ * we collect some amount of data, but when checkpointing/restoring we
-+ * are going to drop everything, which does not make sense: skbs sent
-+ * by outside processes, connections from outside etc. etc.
-+ */
-+
-+/* The first pass. When we see socket referenced by a file, we just
-+ * add it to socket table */
-+int cpt_collect_socket(struct file *file, cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+ struct socket *sock;
-+ struct sock *sk;
-+
-+ if (!file->f_dentry->d_inode->i_sock)
-+ return -ENOTSOCK;
-+ sock = &container_of(file->f_dentry->d_inode, struct socket_alloc, vfs_inode)->socket;
-+ sk = sock->sk;
-+ if (!can_dump(sk, ctx))
-+ return -EBUSY;
-+ if ((obj = cpt_object_add(CPT_OBJ_SOCKET, sk, ctx)) == NULL)
-+ return -ENOMEM;
-+ obj->o_parent = file;
-+
-+ return 0;
-+}
-+
-+/*
-+ * We should end with table containing:
-+ * * all sockets opened by our processes in the table.
-+ * * all the sockets queued in listening queues on _our_ listening sockets,
-+ * which are connected to our opened sockets.
-+ */
-+
-+static int collect_one_unix_listening_sock(cpt_object_t *obj, cpt_context_t * ctx)
-+{
-+ struct sock *sk = obj->o_obj;
-+ cpt_object_t *cobj;
-+ struct sk_buff *skb;
-+
-+ skb = skb_peek(&sk->sk_receive_queue);
-+ while (skb && skb != (struct sk_buff*)&sk->sk_receive_queue) {
-+ struct sock *lsk = skb->sk;
-+ if (unix_peer(lsk) &&
-+ lookup_cpt_object(CPT_OBJ_SOCKET, unix_peer(lsk), ctx)) {
-+ if ((cobj = cpt_object_add(CPT_OBJ_SOCKET, lsk, ctx)) == NULL)
-+ return -ENOMEM;
-+ cobj->o_parent = obj->o_parent;
-+ }
-+ spin_lock_irq(&sk->sk_receive_queue.lock);
-+ skb = skb->next;
-+ spin_unlock_irq(&sk->sk_receive_queue.lock);
-+ }
-+
-+ return 0;
-+}
-+
-+int cpt_index_sockets(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+ unsigned long index = 0;
-+
-+ /* Collect not-yet-accepted children of listening sockets. */
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct sock *sk = obj->o_obj;
-+
-+ if (sk->sk_state != TCP_LISTEN)
-+ continue;
-+
-+ if (sk->sk_family == AF_UNIX)
-+ collect_one_unix_listening_sock(obj, ctx);
-+ }
-+
-+ /* Assign indices to all the sockets. */
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct sock *sk = obj->o_obj;
-+ cpt_obj_setindex(obj, index++, ctx);
-+
-+ if (sk->sk_socket && sk->sk_socket->file) {
-+ cpt_object_t *tobj;
-+ tobj = lookup_cpt_object(CPT_OBJ_FILE, sk->sk_socket->file, ctx);
-+ if (tobj)
-+ cpt_obj_setindex(tobj, obj->o_index, ctx);
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+void cpt_unlock_sockets(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct sock *sk = obj->o_obj;
-+ if (sk && obj->o_lock) {
-+ if (sk->sk_socket)
-+ release_sock(sk);
-+ }
-+ }
-+}
-+
-+void cpt_kill_sockets(cpt_context_t * ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct sock *sk = obj->o_obj;
-+ if (sk && obj->o_lock) {
-+ cpt_kill_socket(sk, ctx);
-+ if (sk->sk_socket)
-+ release_sock_nobacklog(sk);
-+ }
-+ }
-+}
-+
-+__u32 cpt_socket_fasync(struct file *file, struct cpt_context *ctx)
-+{
-+ struct fasync_struct *fa;
-+ struct inode *inode = file->f_dentry->d_inode;
-+ struct socket *sock;
-+
-+ sock = &container_of(inode, struct socket_alloc, vfs_inode)->socket;
-+
-+ for (fa = sock->fasync_list; fa; fa = fa->fa_next) {
-+ if (fa->fa_file == file)
-+ return fa->fa_fd;
-+ }
-+ return -1;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,27 @@
-+struct sock;
-+
-+int cpt_collect_passedfds(cpt_context_t *);
-+int cpt_index_sockets(cpt_context_t *);
-+int cpt_collect_socket(struct file *, cpt_context_t *);
-+int cpt_dump_socket(cpt_object_t *obj, struct sock *sk, int index, int parent, struct cpt_context *ctx);
-+int cpt_dump_accept_queue(struct sock *sk, int index, struct cpt_context *ctx);
-+int cpt_dump_synwait_queue(struct sock *sk, int index, struct cpt_context *ctx);
-+int rst_sockets(struct cpt_context *ctx);
-+int rst_sockets_complete(struct cpt_context *ctx);
-+int cpt_dump_orphaned_sockets(struct cpt_context *ctx);
-+
-+int rst_sock_attr(loff_t *pos_p, struct sock *sk, cpt_context_t *ctx);
-+struct sk_buff * rst_skb(loff_t *pos_p, __u32 *owner, __u32 *queue, struct cpt_context *ctx);
-+
-+void cpt_unlock_sockets(cpt_context_t *);
-+void cpt_kill_sockets(cpt_context_t *);
-+
-+
-+int cpt_kill_socket(struct sock *, cpt_context_t *);
-+int cpt_dump_socket_in(struct cpt_sock_image *, struct sock *, struct cpt_context*);
-+int rst_socket_in(struct cpt_sock_image *si, loff_t pos, struct sock *, struct cpt_context *ctx);
-+__u32 cpt_socket_fasync(struct file *file, struct cpt_context *ctx);
-+int cpt_attach_accept(struct sock *lsk, struct sock *sk, cpt_context_t *);
-+int rst_restore_synwait_queue(struct sock *sk, struct cpt_sock_image *si, loff_t pos, struct cpt_context *ctx);
-+int cpt_dump_ofo_queue(int idx, struct sock *sk, struct cpt_context *ctx);
-+int cpt_dump_skb(int type, int owner, struct sk_buff *skb, struct cpt_context *ctx);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket_in.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket_in.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_socket_in.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_socket_in.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,372 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/tcp.h>
-+#include <net/sock.h>
-+#include <net/tcp.h>
-+#include <linux/ipv6.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_socket.h"
-+#include "cpt_kernel.h"
-+
-+static inline __u32 jiffies_export(unsigned long tmo)
-+{
-+ __s32 delta = (long)(tmo - jiffies);
-+ return delta;
-+}
-+
-+static inline __u32 tcp_jiffies_export(__u32 tmo)
-+{
-+ __s32 delta = tmo - tcp_time_stamp;
-+ return delta;
-+}
-+
-+int cpt_dump_ofo_queue(int idx, struct sock *sk, struct cpt_context *ctx)
-+{
-+ struct sk_buff *skb;
-+ struct tcp_opt *tp;
-+
-+ if (sk->sk_type != SOCK_STREAM || sk->sk_protocol != IPPROTO_TCP)
-+ return 0;
-+
-+ tp = tcp_sk(sk);
-+
-+ skb = skb_peek(&tp->out_of_order_queue);
-+ while (skb && skb != (struct sk_buff*)&tp->out_of_order_queue) {
-+ int err;
-+
-+ err = cpt_dump_skb(CPT_SKB_OFOQ, idx, skb, ctx);
-+ if (err)
-+ return err;
-+
-+ spin_lock_irq(&tp->out_of_order_queue.lock);
-+ skb = skb->next;
-+ spin_unlock_irq(&tp->out_of_order_queue.lock);
-+ }
-+ return 0;
-+}
-+
-+static int cpt_dump_socket_tcp(struct cpt_sock_image *si, struct sock *sk,
-+ struct cpt_context *ctx)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+
-+ si->cpt_pred_flags = tp->pred_flags;
-+ si->cpt_rcv_nxt = tp->rcv_nxt;
-+ si->cpt_snd_nxt = tp->snd_nxt;
-+ si->cpt_snd_una = tp->snd_una;
-+ si->cpt_snd_sml = tp->snd_sml;
-+ si->cpt_rcv_tstamp = tcp_jiffies_export(tp->rcv_tstamp);
-+ si->cpt_lsndtime = tcp_jiffies_export(tp->lsndtime);
-+ si->cpt_tcp_header_len = tp->tcp_header_len;
-+ si->cpt_ack_pending = tp->ack.pending;
-+ si->cpt_quick = tp->ack.quick;
-+ si->cpt_pingpong = tp->ack.pingpong;
-+ si->cpt_blocked = tp->ack.blocked;
-+ si->cpt_ato = tp->ack.ato;
-+ si->cpt_ack_timeout = jiffies_export(tp->ack.timeout);
-+ si->cpt_lrcvtime = tcp_jiffies_export(tp->ack.lrcvtime);
-+ si->cpt_last_seg_size = tp->ack.last_seg_size;
-+ si->cpt_rcv_mss = tp->ack.rcv_mss;
-+ si->cpt_snd_wl1 = tp->snd_wl1;
-+ si->cpt_snd_wnd = tp->snd_wnd;
-+ si->cpt_max_window = tp->max_window;
-+ si->cpt_pmtu_cookie = tp->pmtu_cookie;
-+ si->cpt_mss_cache = tp->mss_cache;
-+ si->cpt_mss_cache_std = tp->mss_cache_std;
-+ si->cpt_mss_clamp = tp->rx_opt.mss_clamp;
-+ si->cpt_ext_header_len = tp->ext_header_len;
-+ si->cpt_ext2_header_len = tp->ext2_header_len;
-+ si->cpt_ca_state = tp->ca_state;
-+ si->cpt_retransmits = tp->retransmits;
-+ si->cpt_reordering = tp->reordering;
-+ si->cpt_frto_counter = tp->frto_counter;
-+ si->cpt_frto_highmark = tp->frto_highmark;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ si->cpt_adv_cong = tp->adv_cong;
-+#endif
-+ si->cpt_defer_accept = tp->defer_accept;
-+ si->cpt_backoff = tp->backoff;
-+ si->cpt_srtt = tp->srtt;
-+ si->cpt_mdev = tp->mdev;
-+ si->cpt_mdev_max = tp->mdev_max;
-+ si->cpt_rttvar = tp->rttvar;
-+ si->cpt_rtt_seq = tp->rtt_seq;
-+ si->cpt_rto = tp->rto;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ si->cpt_packets_out = tp->packets_out.val;
-+ si->cpt_left_out = tp->left_out.val;
-+ si->cpt_retrans_out = tp->retrans_out.val;
-+ si->cpt_lost_out = tp->lost_out.val;
-+ si->cpt_sacked_out = tp->sacked_out.val;
-+ si->cpt_fackets_out = tp->fackets_out.val;
-+#else
-+ si->cpt_packets_out = tp->packets_out;
-+ si->cpt_left_out = tp->left_out;
-+ si->cpt_retrans_out = tp->retrans_out;
-+ si->cpt_lost_out = tp->lost_out;
-+ si->cpt_sacked_out = tp->sacked_out;
-+ si->cpt_fackets_out = tp->fackets_out;
-+#endif
-+ si->cpt_snd_ssthresh = tp->snd_ssthresh;
-+ si->cpt_snd_cwnd = tp->snd_cwnd;
-+ si->cpt_snd_cwnd_cnt = tp->snd_cwnd_cnt;
-+ si->cpt_snd_cwnd_clamp = tp->snd_cwnd_clamp;
-+ si->cpt_snd_cwnd_used = tp->snd_cwnd_used;
-+ si->cpt_snd_cwnd_stamp = tcp_jiffies_export(tp->snd_cwnd_stamp);
-+ si->cpt_timeout = jiffies_export(tp->timeout);
-+ si->cpt_ka_timeout = 0;
-+ si->cpt_rcv_wnd = tp->rcv_wnd;
-+ si->cpt_rcv_wup = tp->rcv_wup;
-+ si->cpt_write_seq = tp->write_seq;
-+ si->cpt_pushed_seq = tp->pushed_seq;
-+ si->cpt_copied_seq = tp->copied_seq;
-+ si->cpt_tstamp_ok = tp->rx_opt.tstamp_ok;
-+ si->cpt_wscale_ok = tp->rx_opt.wscale_ok;
-+ si->cpt_sack_ok = tp->rx_opt.sack_ok;
-+ si->cpt_saw_tstamp = tp->rx_opt.saw_tstamp;
-+ si->cpt_snd_wscale = tp->rx_opt.snd_wscale;
-+ si->cpt_rcv_wscale = tp->rx_opt.rcv_wscale;
-+ si->cpt_nonagle = tp->nonagle;
-+ si->cpt_keepalive_probes = tp->keepalive_probes;
-+ si->cpt_rcv_tsval = tp->rx_opt.rcv_tsval;
-+ si->cpt_rcv_tsecr = tp->rx_opt.rcv_tsecr;
-+ si->cpt_ts_recent = tp->rx_opt.ts_recent;
-+ si->cpt_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
-+ si->cpt_user_mss = tp->rx_opt.user_mss;
-+ si->cpt_dsack = tp->rx_opt.dsack;
-+ si->cpt_eff_sacks = tp->rx_opt.eff_sacks;
-+ si->cpt_sack_array[0] = tp->duplicate_sack[0].start_seq;
-+ si->cpt_sack_array[1] = tp->duplicate_sack[0].end_seq;
-+ si->cpt_sack_array[2] = tp->selective_acks[0].start_seq;
-+ si->cpt_sack_array[3] = tp->selective_acks[0].end_seq;
-+ si->cpt_sack_array[4] = tp->selective_acks[1].start_seq;
-+ si->cpt_sack_array[5] = tp->selective_acks[1].end_seq;
-+ si->cpt_sack_array[6] = tp->selective_acks[2].start_seq;
-+ si->cpt_sack_array[7] = tp->selective_acks[2].end_seq;
-+ si->cpt_sack_array[8] = tp->selective_acks[3].start_seq;
-+ si->cpt_sack_array[9] = tp->selective_acks[3].end_seq;
-+ si->cpt_window_clamp = tp->window_clamp;
-+ si->cpt_rcv_ssthresh = tp->rcv_ssthresh;
-+ si->cpt_probes_out = tp->probes_out;
-+ si->cpt_num_sacks = tp->rx_opt.num_sacks;
-+ si->cpt_advmss = tp->advmss;
-+ si->cpt_syn_retries = tp->syn_retries;
-+ si->cpt_ecn_flags = tp->ecn_flags;
-+ si->cpt_prior_ssthresh = tp->prior_ssthresh;
-+ si->cpt_high_seq = tp->high_seq;
-+ si->cpt_retrans_stamp = tp->retrans_stamp;
-+ si->cpt_undo_marker = tp->undo_marker;
-+ si->cpt_undo_retrans = tp->undo_retrans;
-+ si->cpt_urg_seq = tp->urg_seq;
-+ si->cpt_urg_data = tp->urg_data;
-+ si->cpt_pending = tp->pending;
-+ si->cpt_urg_mode = tp->urg_mode;
-+ si->cpt_snd_up = tp->snd_up;
-+ si->cpt_keepalive_time = tp->keepalive_time;
-+ si->cpt_keepalive_intvl = tp->keepalive_intvl;
-+ si->cpt_linger2 = tp->linger2;
-+
-+ if (sk->sk_state != TCP_LISTEN &&
-+ sk->sk_state != TCP_CLOSE &&
-+ sock_flag(sk, SOCK_KEEPOPEN)) {
-+ si->cpt_ka_timeout = jiffies_export(sk->sk_timer.expires);
-+ }
-+
-+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
-+ if (sk->sk_family == AF_INET6 && tp->af_specific == &ipv6_mapped)
-+ si->cpt_mapped = 1;
-+#endif
-+
-+ return 0;
-+}
-+
-+
-+int cpt_dump_socket_in(struct cpt_sock_image *si, struct sock *sk,
-+ struct cpt_context *ctx)
-+{
-+ struct inet_opt *inet = inet_sk(sk);
-+ struct ipv6_pinfo *np = inet6_sk(sk);
-+
-+ if (sk->sk_family == AF_INET) {
-+ struct sockaddr_in *sin = ((struct sockaddr_in*)si->cpt_laddr);
-+ sin->sin_family = AF_INET;
-+ sin->sin_port = inet->sport;
-+ sin->sin_addr.s_addr = inet->rcv_saddr;
-+ si->cpt_laddrlen = sizeof(*sin);
-+ } else if (sk->sk_family == AF_INET6) {
-+ struct sockaddr_in6 *sin6 = ((struct sockaddr_in6*)si->cpt_laddr);
-+ sin6->sin6_family = AF_INET6;
-+ sin6->sin6_port = inet->sport;
-+ memcpy(&sin6->sin6_addr, &np->rcv_saddr, 16);
-+ si->cpt_laddrlen = sizeof(*sin6);
-+ }
-+ if (!inet->num)
-+ si->cpt_laddrlen = 0;
-+
-+ si->cpt_daddr = inet->daddr;
-+ si->cpt_dport = inet->dport;
-+ si->cpt_saddr = inet->saddr;
-+ si->cpt_rcv_saddr = inet->rcv_saddr;
-+ si->cpt_sport = inet->sport;
-+ si->cpt_uc_ttl = inet->uc_ttl;
-+ si->cpt_tos = inet->tos;
-+ si->cpt_cmsg_flags = inet->cmsg_flags;
-+ si->cpt_mc_index = inet->mc_index;
-+ si->cpt_mc_addr = inet->mc_addr;
-+ si->cpt_hdrincl = inet->hdrincl;
-+ si->cpt_mc_ttl = inet->mc_ttl;
-+ si->cpt_mc_loop = inet->mc_loop;
-+ si->cpt_pmtudisc = inet->pmtudisc;
-+ si->cpt_recverr = inet->recverr;
-+ si->cpt_freebind = inet->freebind;
-+ si->cpt_idcounter = inet->id;
-+
-+ si->cpt_cork_flags = inet->cork.flags;
-+ si->cpt_cork_fragsize = 0;
-+ si->cpt_cork_length = inet->cork.length;
-+ si->cpt_cork_addr = inet->cork.addr;
-+ si->cpt_cork_saddr = inet->cork.fl.fl4_src;
-+ si->cpt_cork_daddr = inet->cork.fl.fl4_dst;
-+ si->cpt_cork_oif = inet->cork.fl.oif;
-+ if (inet->cork.rt) {
-+ si->cpt_cork_fragsize = inet->cork.fragsize;
-+ si->cpt_cork_saddr = inet->cork.rt->fl.fl4_src;
-+ si->cpt_cork_daddr = inet->cork.rt->fl.fl4_dst;
-+ si->cpt_cork_oif = inet->cork.rt->fl.oif;
-+ }
-+
-+ if (sk->sk_type == SOCK_DGRAM && sk->sk_protocol == IPPROTO_UDP) {
-+ struct udp_opt *up = udp_sk(sk);
-+ si->cpt_udp_pending = up->pending;
-+ si->cpt_udp_corkflag = up->corkflag;
-+ si->cpt_udp_encap = up->encap_type;
-+ si->cpt_udp_len = up->len;
-+ }
-+
-+ if (sk->sk_family == AF_INET6) {
-+ memcpy(si->cpt_saddr6, &np->saddr, 16);
-+ memcpy(si->cpt_rcv_saddr6, &np->rcv_saddr, 16);
-+ memcpy(si->cpt_daddr6, &np->daddr, 16);
-+ si->cpt_flow_label6 = np->flow_label;
-+ si->cpt_frag_size6 = np->frag_size;
-+ si->cpt_hop_limit6 = np->hop_limit;
-+ si->cpt_mcast_hops6 = np->mcast_hops;
-+ si->cpt_mcast_oif6 = np->mcast_oif;
-+ si->cpt_rxopt6 = np->rxopt.all;
-+ si->cpt_mc_loop6 = np->mc_loop;
-+ si->cpt_recverr6 = np->recverr;
-+ si->cpt_sndflow6 = np->sndflow;
-+ si->cpt_pmtudisc6 = np->pmtudisc;
-+ si->cpt_ipv6only6 = np->ipv6only;
-+ si->cpt_mapped = 0;
-+ }
-+
-+ if (sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP)
-+ cpt_dump_socket_tcp(si, sk, ctx);
-+
-+ return 0;
-+}
-+
-+int cpt_dump_accept_queue(struct sock *sk, int index, struct cpt_context *ctx)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ struct open_request *req;
-+
-+ for (req=tp->accept_queue; req; req=req->dl_next)
-+ cpt_dump_socket(NULL, req->sk, -1, index, ctx);
-+ return 0;
-+}
-+
-+
-+static int dump_openreq(struct open_request *req, struct sock *sk, int index,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_openreq_image *v = cpt_get_buf(ctx);
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_OPENREQ;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ v->cpt_rcv_isn = req->rcv_isn;
-+ v->cpt_snt_isn = req->snt_isn;
-+ v->cpt_rmt_port = req->rmt_port;
-+ v->cpt_mss = req->mss;
-+ v->cpt_family = (req->class == &or_ipv4 ? AF_INET : AF_INET6);
-+ v->cpt_retrans = req->retrans;
-+ v->cpt_snd_wscale = req->snd_wscale;
-+ v->cpt_rcv_wscale = req->rcv_wscale;
-+ v->cpt_tstamp_ok = req->tstamp_ok;
-+ v->cpt_sack_ok = req->sack_ok;
-+ v->cpt_wscale_ok = req->wscale_ok;
-+ v->cpt_ecn_ok = req->ecn_ok;
-+ v->cpt_acked = req->acked;
-+ v->cpt_window_clamp = req->window_clamp;
-+ v->cpt_rcv_wnd = req->rcv_wnd;
-+ v->cpt_ts_recent = req->ts_recent;
-+ v->cpt_expires = jiffies_export(req->expires);
-+
-+ if (v->cpt_family == AF_INET) {
-+ memcpy(v->cpt_loc_addr, &req->af.v4_req.loc_addr, 4);
-+ memcpy(v->cpt_rmt_addr, &req->af.v4_req.rmt_addr, 4);
-+ } else {
-+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
-+ memcpy(v->cpt_loc_addr, &req->af.v6_req.loc_addr, 16);
-+ memcpy(v->cpt_rmt_addr, &req->af.v6_req.rmt_addr, 16);
-+ v->cpt_iif = req->af.v6_req.iif;
-+#endif
-+ }
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+int cpt_dump_synwait_queue(struct sock *sk, int index, struct cpt_context *ctx)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ struct tcp_listen_opt *lopt = tp->listen_opt;
-+ struct open_request *req;
-+ int i;
-+
-+ for (i=0; i<TCP_SYNQ_HSIZE; i++) {
-+ for (req=lopt->syn_table[i]; req; req=req->dl_next) {
-+ loff_t saved_obj;
-+ cpt_push_object(&saved_obj, ctx);
-+ dump_openreq(req, sk, index, ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+ }
-+ }
-+ return 0;
-+}
-+
-+
-+int cpt_kill_socket(struct sock *sk, cpt_context_t * ctx)
-+{
-+ if (sk->sk_state != TCP_CLOSE &&
-+ (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) &&
-+ sk->sk_protocol == IPPROTO_TCP) {
-+ if (sk->sk_state != TCP_LISTEN)
-+ tcp_set_state(sk, TCP_CLOSE);
-+ else
-+ sk->sk_prot->disconnect(sk, 0);
-+ }
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_syscalls.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_syscalls.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_syscalls.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_syscalls.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,95 @@
-+#include <linux/unistd.h>
-+#include <linux/syscalls.h>
-+#include <asm/uaccess.h>
-+
-+#define WRAP(c, args) return sys_##c args
-+#define WRAP2(c, args) int err; mm_segment_t oldfs; \
-+ oldfs = get_fs(); set_fs(KERNEL_DS); \
-+ err = sys_##c args ;\
-+ set_fs(oldfs); \
-+ return err
-+
-+static inline int sc_close(int fd)
-+{
-+ WRAP(close, (fd));
-+}
-+
-+static inline int sc_dup2(int fd1, int fd2)
-+{
-+ WRAP(dup2, (fd1, fd2));
-+}
-+
-+static inline int sc_unlink(char *name)
-+{
-+ WRAP2(unlink, (name));
-+}
-+
-+static inline int sc_pipe(int *pfd)
-+{
-+ return do_pipe(pfd);
-+}
-+
-+static inline int sc_mknod(char *name, int mode, int dev)
-+{
-+ WRAP2(mknod, (name, mode, dev));
-+}
-+
-+static inline int sc_chmod(char *name, int mode)
-+{
-+ WRAP2(mkdir, (name, mode));
-+}
-+
-+static inline int sc_chown(char *name, int uid, int gid)
-+{
-+ WRAP2(chown, (name, uid, gid));
-+}
-+
-+static inline int sc_mkdir(char *name, int mode)
-+{
-+ WRAP2(mkdir, (name, mode));
-+}
-+
-+static inline int sc_rmdir(char *name)
-+{
-+ WRAP2(rmdir, (name));
-+}
-+
-+static inline int sc_mount(char *mntdev, char *mntpnt, char *type, unsigned long flags)
-+{
-+ WRAP2(mount, (mntdev ? : "none", mntpnt, type, flags, NULL));
-+}
-+
-+static inline int sc_mprotect(unsigned long start, size_t len,
-+ unsigned long prot)
-+{
-+ WRAP(mprotect, (start, len, prot));
-+}
-+
-+static inline int sc_mlock(unsigned long start, size_t len)
-+{
-+ WRAP(mlock, (start, len));
-+}
-+
-+static inline int sc_munlock(unsigned long start, size_t len)
-+{
-+ WRAP(munlock, (start, len));
-+}
-+
-+static inline int sc_remap_file_pages(unsigned long start, size_t len,
-+ unsigned long prot, unsigned long pgoff,
-+ unsigned long flags)
-+{
-+ WRAP(remap_file_pages, (start, len, prot, pgoff, flags));
-+}
-+
-+static inline int sc_waitx(int pid, int opt)
-+{
-+ WRAP(wait4, (pid, NULL, opt, NULL));
-+}
-+
-+static inline int sc_flock(int fd, int flags)
-+{
-+ WRAP(flock, (fd, flags));
-+}
-+
-+extern int sc_execve(char *cms, char **argv, char **env);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_sysvipc.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_sysvipc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_sysvipc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_sysvipc.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,306 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/shm.h>
-+#include <linux/sem.h>
-+#include <linux/msg.h>
-+#include <asm/uaccess.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_kernel.h"
-+
-+struct _warg {
-+ struct file *file;
-+ struct cpt_sysvshm_image *v;
-+};
-+
-+static int dump_one_shm(struct shmid_kernel *shp, void *arg)
-+{
-+ struct _warg *warg = arg;
-+ struct cpt_sysvshm_image *v = (struct cpt_sysvshm_image *)warg->v;
-+
-+ if (shp->shm_file != warg->file)
-+ return 0;
-+
-+ v->cpt_key = shp->shm_perm.key;
-+ v->cpt_uid = shp->shm_perm.uid;
-+ v->cpt_gid = shp->shm_perm.gid;
-+ v->cpt_cuid = shp->shm_perm.cuid;
-+ v->cpt_cgid = shp->shm_perm.cgid;
-+ v->cpt_mode = shp->shm_perm.mode;
-+ v->cpt_seq = shp->shm_perm.seq;
-+
-+ v->cpt_id = shp->id;
-+ v->cpt_segsz = shp->shm_segsz;
-+ v->cpt_atime = shp->shm_atim;
-+ v->cpt_ctime = shp->shm_ctim;
-+ v->cpt_dtime = shp->shm_dtim;
-+ v->cpt_creator = shp->shm_cprid;
-+ v->cpt_last = shp->shm_lprid;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ v->cpt_mlockuser = shp->mlock_user ? shp->mlock_user->uid : -1;
-+#else
-+ v->cpt_mlockuser = -1;
-+#endif
-+ return 1;
-+}
-+
-+int cpt_dump_content_sysvshm(struct file *file, struct cpt_context *ctx)
-+{
-+ struct cpt_sysvshm_image *v = cpt_get_buf(ctx);
-+ struct _warg warg;
-+
-+ v->cpt_next = sizeof(*v);
-+ v->cpt_object = CPT_OBJ_SYSV_SHM;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ warg.file = file;
-+ warg.v = v;
-+ if (sysvipc_walk_shm(dump_one_shm, &warg) == 0) {
-+ cpt_release_buf(ctx);
-+ return -ESRCH;
-+ }
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+
-+int match_sem(int id, struct sem_array *sema, void *arg)
-+{
-+ if (id != (unsigned long)arg)
-+ return 0;
-+ return sema->sem_nsems + 1;
-+}
-+
-+static int get_sem_nsem(int id, cpt_context_t *ctx)
-+{
-+ int res;
-+ res = sysvipc_walk_sem(match_sem, (void*)(unsigned long)id);
-+ if (res > 0)
-+ return res - 1;
-+ eprintk_ctx("get_sem_nsem: SYSV semaphore %d not found\n", id);
-+ return -ESRCH;
-+}
-+
-+static int dump_one_semundo(struct sem_undo *su, struct cpt_context *ctx)
-+{
-+ struct cpt_sysvsem_undo_image v;
-+ loff_t saved_obj;
-+
-+ cpt_open_object(NULL, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_SYSVSEM_UNDO_REC;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_SEMUNDO;
-+ v.cpt_id = su->semid;
-+ v.cpt_nsem = get_sem_nsem(su->semid, ctx);
-+ if ((int)v.cpt_nsem < 0)
-+ return -ESRCH;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ ctx->write(su->semadj, v.cpt_nsem*sizeof(short), ctx);
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+ return 0;
-+}
-+
-+struct sem_warg {
-+ int last_id;
-+ struct cpt_sysvsem_image *v;
-+};
-+
-+static int dump_one_sem(int id, struct sem_array *sma, void *arg)
-+{
-+ struct sem_warg * warg = (struct sem_warg *)arg;
-+ struct cpt_sysvsem_image *v = warg->v;
-+ int i;
-+
-+ if (warg->last_id != -1) {
-+ if ((id % IPCMNI) <= warg->last_id)
-+ return 0;
-+ }
-+
-+ v->cpt_next = sizeof(*v);
-+ v->cpt_object = CPT_OBJ_SYSV_SEM;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_SEMARRAY;
-+
-+ v->cpt_key = sma->sem_perm.key;
-+ v->cpt_uid = sma->sem_perm.uid;
-+ v->cpt_gid = sma->sem_perm.gid;
-+ v->cpt_cuid = sma->sem_perm.cuid;
-+ v->cpt_cgid = sma->sem_perm.cgid;
-+ v->cpt_mode = sma->sem_perm.mode;
-+ v->cpt_seq = sma->sem_perm.seq;
-+
-+ v->cpt_id = id;
-+ v->cpt_ctime = sma->sem_ctime;
-+ v->cpt_otime = sma->sem_otime;
-+
-+ for (i=0; i<sma->sem_nsems; i++) {
-+ struct {
-+ __u32 semval;
-+ __u32 sempid;
-+ } *s = (void*)v + v->cpt_next;
-+ if (v->cpt_next >= PAGE_SIZE - sizeof(*s))
-+ return -EINVAL;
-+ s->semval = sma->sem_base[i].semval;
-+ s->sempid = sma->sem_base[i].sempid;
-+ v->cpt_next += sizeof(*s);
-+ }
-+
-+ warg->last_id = id % IPCMNI;
-+ return 1;
-+}
-+
-+
-+int cpt_dump_sysvsem(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+ struct sem_warg warg;
-+
-+ /* Dumping semaphores is quite tricky because we cannot
-+ * write to dump file under lock inside sysvipc_walk_sem().
-+ */
-+ cpt_open_section(ctx, CPT_SECT_SYSV_SEM);
-+ warg.last_id = -1;
-+ warg.v = cpt_get_buf(ctx);
-+ for (;;) {
-+ if (sysvipc_walk_sem(dump_one_sem, &warg) <= 0)
-+ break;
-+ ctx->write(warg.v, warg.v->cpt_next, ctx);
-+ }
-+ cpt_release_buf(ctx);
-+ cpt_close_section(ctx);
-+
-+ cpt_open_section(ctx, CPT_SECT_SYSVSEM_UNDO);
-+ for_each_object(obj, CPT_OBJ_SYSVSEM_UNDO) {
-+ struct sem_undo_list *semu = obj->o_obj;
-+ struct sem_undo *su;
-+ struct cpt_object_hdr v;
-+ loff_t saved_obj;
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v.cpt_next = CPT_NULL;
-+ v.cpt_object = CPT_OBJ_SYSVSEM_UNDO;
-+ v.cpt_hdrlen = sizeof(v);
-+ v.cpt_content = CPT_CONTENT_ARRAY;
-+
-+ ctx->write(&v, sizeof(v), ctx);
-+
-+ cpt_push_object(&saved_obj, ctx);
-+ for (su = semu->proc_list; su; su = su->proc_next) {
-+ if (su->semid != -1) {
-+ int err;
-+ err = dump_one_semundo(su, ctx);
-+ if (err < 0)
-+ return err;
-+ }
-+ }
-+ cpt_pop_object(&saved_obj, ctx);
-+
-+ cpt_close_object(ctx);
-+ }
-+ cpt_close_section(ctx);
-+ return 0;
-+}
-+
-+static int collect_one_msg(int id, struct msg_queue *msq, void *arg)
-+{
-+ int *retp = arg;
-+ (*retp)++;
-+ return 0;
-+}
-+
-+int cpt_collect_sysvmsg(cpt_context_t * ctx)
-+{
-+ int ret = 0;
-+ sysvipc_walk_msg(collect_one_msg, &ret);
-+ if (ret) {
-+ eprintk_ctx("SYSV msgqueues are not supported, found %d\n", ret);
-+ return -EBUSY;
-+ }
-+ return 0;
-+}
-+
-+static int cpt_collect_sysvsem_undo(cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ if (tsk->exit_state) {
-+ /* ipc/sem.c forgets to clear tsk->sysvsem.undo_list
-+ * on exit. Grrr... */
-+ continue;
-+ }
-+ if (tsk->sysvsem.undo_list &&
-+ cpt_object_add(CPT_OBJ_SYSVSEM_UNDO, tsk->sysvsem.undo_list, ctx) == NULL)
-+ return -ENOMEM;
-+ }
-+
-+ for_each_object(obj, CPT_OBJ_SYSVSEM_UNDO) {
-+ struct sem_undo_list *semu = obj->o_obj;
-+
-+ if (atomic_read(&semu->refcnt) != obj->o_count) {
-+ eprintk_ctx("sem_undo_list is referenced outside %d %d\n", obj->o_count, atomic_read(&semu->refcnt));
-+ return -EBUSY;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int collect_one_shm(struct shmid_kernel *shp, void *arg)
-+{
-+ cpt_context_t *ctx = arg;
-+
-+ if (__cpt_object_add(CPT_OBJ_FILE, shp->shm_file, GFP_ATOMIC, ctx) == NULL)
-+ return -ENOMEM;
-+ return 0;
-+}
-+
-+int cpt_collect_sysvshm(cpt_context_t * ctx)
-+{
-+ int err;
-+
-+ err = sysvipc_walk_shm(collect_one_shm, ctx);
-+
-+ return err < 0 ? err : 0;
-+}
-+
-+int cpt_collect_sysv(cpt_context_t * ctx)
-+{
-+ int err;
-+
-+ err = cpt_collect_sysvsem_undo(ctx);
-+ if (err)
-+ return err;
-+ err = cpt_collect_sysvmsg(ctx);
-+ if (err)
-+ return err;
-+ err = cpt_collect_sysvshm(ctx);
-+ if (err)
-+ return err;
-+
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_tty.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_tty.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_tty.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_tty.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,205 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/tty.h>
-+#include <asm/uaccess.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+/* We must support at least N_TTY. */
-+
-+int cpt_dump_content_tty(struct file *file, struct cpt_context *ctx)
-+{
-+ struct tty_struct *tty = file->private_data;
-+ cpt_object_t *obj;
-+ struct cpt_obj_ref o;
-+ loff_t saved_pos;
-+
-+ obj = lookup_cpt_object(CPT_OBJ_TTY, tty, ctx);
-+ if (!obj)
-+ return -EINVAL;
-+
-+ cpt_push_object(&saved_pos, ctx);
-+
-+ o.cpt_next = sizeof(o);
-+ o.cpt_object = CPT_OBJ_REF;
-+ o.cpt_hdrlen = sizeof(o);
-+ o.cpt_content = CPT_CONTENT_VOID;
-+ o.cpt_pos = obj->o_pos;
-+ ctx->write(&o, sizeof(o), ctx);
-+
-+ cpt_pop_object(&saved_pos, ctx);
-+
-+ return 0;
-+}
-+
-+int cpt_collect_tty(struct file *file, cpt_context_t * ctx)
-+{
-+ struct tty_struct *tty = file->private_data;
-+
-+ if (tty) {
-+ if (cpt_object_add(CPT_OBJ_TTY, tty, ctx) == NULL)
-+ return -ENOMEM;
-+ if (tty->link) {
-+ cpt_object_t *obj;
-+
-+ obj = cpt_object_add(CPT_OBJ_TTY, tty->link, ctx);
-+ if (obj == NULL)
-+ return -ENOMEM;
-+ /* Undo o_count, tty->link is not a reference */
-+ obj->o_count--;
-+ }
-+ }
-+ return 0;
-+}
-+
-+int cpt_dump_tty(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct tty_struct *tty = obj->o_obj;
-+ struct cpt_tty_image *v;
-+
-+ if (tty->link) {
-+ if (lookup_cpt_object(CPT_OBJ_TTY, tty->link, ctx) == NULL) {
-+ eprintk_ctx("orphan pty %s %d\n", tty->name, tty->driver->subtype == PTY_TYPE_SLAVE);
-+ return -EINVAL;
-+ }
-+ if (tty->link->link != tty) {
-+ eprintk_ctx("bad pty pair\n");
-+ return -EINVAL;
-+ }
-+ if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
-+ tty->driver->subtype == PTY_TYPE_SLAVE &&
-+ tty->link->count)
-+ obj->o_count++;
-+ }
-+ if (obj->o_count != tty->count) {
-+ eprintk_ctx("tty %s is referenced outside %d %d\n", tty->name, obj->o_count, tty->count);
-+ return -EBUSY;
-+ }
-+
-+ cpt_open_object(obj, ctx);
-+
-+ v = cpt_get_buf(ctx);
-+ v->cpt_next = -1;
-+ v->cpt_object = CPT_OBJ_TTY;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_ARRAY;
-+
-+ v->cpt_index = tty->index;
-+ v->cpt_link = -1;
-+ if (tty->link)
-+ v->cpt_link = tty->link->index;
-+ v->cpt_drv_type = tty->driver->type;
-+ v->cpt_drv_subtype = tty->driver->subtype;
-+ v->cpt_drv_flags = tty->driver->flags;
-+ v->cpt_packet = tty->packet;
-+ v->cpt_stopped = tty->stopped;
-+ v->cpt_hw_stopped = tty->hw_stopped;
-+ v->cpt_flow_stopped = tty->flow_stopped;
-+ v->cpt_flags = tty->flags;
-+ v->cpt_ctrl_status = tty->ctrl_status;
-+ v->cpt_canon_data = tty->canon_data;
-+ v->cpt_canon_head = tty->canon_head - tty->read_tail;
-+ v->cpt_canon_column = tty->canon_column;
-+ v->cpt_column = tty->column;
-+ v->cpt_erasing = tty->erasing;
-+ v->cpt_lnext = tty->lnext;
-+ v->cpt_icanon = tty->icanon;
-+ v->cpt_raw = tty->raw;
-+ v->cpt_real_raw = tty->real_raw;
-+ v->cpt_closing = tty->closing;
-+ v->cpt_minimum_to_wake = tty->minimum_to_wake;
-+ v->cpt_pgrp = 0;
-+ if (tty->pgrp > 0) {
-+ v->cpt_pgrp = _pid_type_to_vpid(PIDTYPE_PGID, tty->pgrp);
-+ if ((int)v->cpt_pgrp < 0) {
-+ dprintk_ctx("cannot map tty->pgrp %d -> %d\n", tty->pgrp, (int)v->cpt_pgrp);
-+ v->cpt_pgrp = -1;
-+ }
-+ }
-+ v->cpt_session = 0;
-+ if (tty->session > 0) {
-+ v->cpt_session = _pid_type_to_vpid(PIDTYPE_SID, tty->session);
-+ if ((int)v->cpt_session < 0) {
-+ eprintk_ctx("cannot map tty->session %d -> %d\n", tty->session, (int)v->cpt_session);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ }
-+ memcpy(v->cpt_name, tty->name, 64);
-+ v->cpt_ws_row = tty->winsize.ws_row;
-+ v->cpt_ws_col = tty->winsize.ws_col;
-+ v->cpt_ws_prow = tty->winsize.ws_ypixel;
-+ v->cpt_ws_pcol = tty->winsize.ws_xpixel;
-+ if (tty->termios == NULL) {
-+ eprintk_ctx("NULL termios");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ v->cpt_c_line = tty->termios->c_line;
-+ v->cpt_c_iflag = tty->termios->c_iflag;
-+ v->cpt_c_oflag = tty->termios->c_oflag;
-+ v->cpt_c_cflag = tty->termios->c_cflag;
-+ v->cpt_c_lflag = tty->termios->c_lflag;
-+ memcpy(v->cpt_c_cc, tty->termios->c_cc, NCCS);
-+ if (NCCS < 32)
-+ memset(v->cpt_c_cc + NCCS, 255, 32 - NCCS);
-+ memcpy(v->cpt_read_flags, tty->read_flags, sizeof(v->cpt_read_flags));
-+
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ if (tty->read_buf && tty->read_cnt) {
-+ struct cpt_obj_bits *v = cpt_get_buf(ctx);
-+ loff_t saved_pos;
-+
-+ cpt_push_object(&saved_pos, ctx);
-+ cpt_open_object(NULL, ctx);
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_BITS;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_DATA;
-+ v->cpt_size = tty->read_cnt;
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_release_buf(ctx);
-+
-+ if (tty->read_cnt) {
-+ int n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail);
-+ ctx->write(tty->read_buf + tty->read_tail, n, ctx);
-+ if (tty->read_cnt > n)
-+ ctx->write(tty->read_buf, tty->read_cnt-n, ctx);
-+ ctx->align(ctx);
-+ }
-+
-+ cpt_close_object(ctx);
-+ cpt_pop_object(&saved_pos, ctx);
-+ }
-+
-+ cpt_close_object(ctx);
-+
-+ return 0;
-+}
-+
-+__u32 cpt_tty_fasync(struct file *file, struct cpt_context *ctx)
-+{
-+ struct tty_struct * tty;
-+ struct fasync_struct *fa;
-+
-+ tty = (struct tty_struct *)file->private_data;
-+
-+ for (fa = tty->fasync; fa; fa = fa->fa_next) {
-+ if (fa->fa_file == file)
-+ return fa->fa_fd;
-+ }
-+ return -1;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_ubc.c linux-2.6.9-ve023stab030/kernel/cpt/cpt_ubc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_ubc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_ubc.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,121 @@
-+#include <linux/types.h>
-+#include <ub/beancounter.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+cpt_object_t *cpt_add_ubc(struct user_beancounter *bc, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = cpt_object_add(CPT_OBJ_UBC, bc, ctx);
-+ if (obj != NULL) {
-+ if (obj->o_count == 1)
-+ get_beancounter(bc);
-+ if (bc->parent != NULL && obj->o_parent == NULL)
-+ obj->o_parent = cpt_add_ubc(bc->parent, ctx);
-+ }
-+ return obj;
-+}
-+
-+__u64 cpt_lookup_ubc(struct user_beancounter *bc, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = lookup_cpt_object(CPT_OBJ_UBC, bc, ctx);
-+ if (obj == NULL) {
-+ char buf[48];
-+ print_ub_uid(bc, buf, sizeof(buf));
-+ printk(KERN_ERR "CPT: unknown ub %s (%p)\n", buf, bc);
-+ dump_stack();
-+ return CPT_NULL;
-+ }
-+ return obj->o_pos;
-+}
-+
-+static void dump_one_bc_parm(__u64 *dmp, struct ubparm *prm, int held)
-+{
-+ dmp[0] = (prm->barrier < UB_MAXVALUE ? prm->barrier : CPT_NULL);
-+ dmp[1] = (prm->limit < UB_MAXVALUE ? prm->limit : CPT_NULL);
-+ dmp[2] = (held ? prm->held : CPT_NULL);
-+ dmp[3] = prm->maxheld;
-+ dmp[4] = prm->minheld;
-+ dmp[5] = prm->failcnt;
-+}
-+
-+static int dump_one_bc(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct user_beancounter *bc;
-+ struct cpt_beancounter_image *v;
-+ int i;
-+
-+ bc = obj->o_obj;
-+ v = cpt_get_buf(ctx);
-+
-+ v->cpt_next = CPT_NULL;
-+ v->cpt_object = CPT_OBJ_UBC;
-+ v->cpt_hdrlen = sizeof(*v);
-+ v->cpt_content = CPT_CONTENT_VOID;
-+
-+ if (obj->o_parent != NULL)
-+ v->cpt_parent = ((cpt_object_t *)obj->o_parent)->o_pos;
-+ else
-+ v->cpt_parent = CPT_NULL;
-+ v->cpt_id = (obj->o_parent != NULL) ? bc->ub_uid : 0;
-+ for (i = 0; i < UB_RESOURCES; i++)
-+ dump_one_bc_parm(v->cpt_parms, bc->ub_parms, 0);
-+ for (i = 0; i < UB_RESOURCES; i++)
-+ dump_one_bc_parm(v->cpt_parms + UB_RESOURCES * 6,
-+ bc->ub_store, 1);
-+ memset(v->cpt_parms + UB_RESOURCES * 12, 0,
-+ sizeof(v->cpt_parms)
-+ - UB_RESOURCES * 12 * sizeof(v->cpt_parms[0]));
-+
-+ cpt_open_object(obj, ctx);
-+ ctx->write(v, sizeof(*v), ctx);
-+ cpt_close_object(ctx);
-+
-+ cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+int cpt_dump_ubc(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+ int skipped;
-+ int top;
-+
-+ cpt_open_section(ctx, CPT_SECT_UBC);
-+
-+ do {
-+ skipped = 0;
-+ top = 0;
-+ for_each_object(obj, CPT_OBJ_UBC) {
-+ if (obj->o_parent == NULL)
-+ top++;
-+ if (obj->o_pos != CPT_NULL)
-+ continue;
-+ if (obj->o_parent != NULL &&
-+ ((cpt_object_t *)obj->o_parent)->o_pos == CPT_NULL)
-+ skipped++;
-+ else
-+ dump_one_bc(obj, ctx);
-+ }
-+ } while (skipped && (top < 2));
-+
-+ cpt_close_section(ctx);
-+ if (top > 1) {
-+ eprintk_ctx("More than one top level ub exist");
-+ return -EINVAL;
-+ }
-+
-+ return 0;
-+}
-+
-+void cpt_finish_ubc(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_UBC)
-+ put_beancounter(obj->o_obj);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_ubc.h linux-2.6.9-ve023stab030/kernel/cpt/cpt_ubc.h
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_ubc.h 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_ubc.h 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,9 @@
-+cpt_object_t *cpt_add_ubc(struct user_beancounter *bc, struct cpt_context *ctx);
-+__u64 cpt_lookup_ubc(struct user_beancounter *bc, struct cpt_context *ctx);
-+int cpt_dump_ubc(struct cpt_context *ctx);
-+
-+struct user_beancounter *rst_lookup_ubc(__u64 pos, struct cpt_context *ctx);
-+int rst_undump_ubc(struct cpt_context *ctx);
-+
-+void cpt_finish_ubc(struct cpt_context *ctx);
-+void rst_finish_ubc(struct cpt_context *ctx);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_x8664.S linux-2.6.9-ve023stab030/kernel/cpt/cpt_x8664.S
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/cpt_x8664.S 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/cpt_x8664.S 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,65 @@
-+#define ASSEMBLY 1
-+#include <linux/config.h>
-+
-+#undef CONFIG_DEBUG_INFO
-+
-+#include <linux/linkage.h>
-+#include <asm/segment.h>
-+#include <asm/smp.h>
-+#include <asm/cache.h>
-+#include <asm/errno.h>
-+#include <asm/dwarf2.h>
-+#include <asm/calling.h>
-+#include <asm/offset.h>
-+#include <asm/msr.h>
-+#include <asm/unistd.h>
-+#include <asm/thread_info.h>
-+#include <asm/hw_irq.h>
-+#include <asm/errno.h>
-+
-+ .code64
-+
-+ .macro FAKE_STACK_FRAME child_rip
-+ /* push in order ss, rsp, eflags, cs, rip */
-+ xorq %rax, %rax
-+ pushq %rax /* ss */
-+ pushq %rax /* rsp */
-+ pushq $(1<<9) /* eflags - interrupts on */
-+ pushq $__KERNEL_CS /* cs */
-+ pushq \child_rip /* rip */
-+ pushq %rax /* orig rax */
-+ .endm
-+
-+ .macro UNFAKE_STACK_FRAME
-+ addq $8*6, %rsp
-+ .endm
-+
-+ENTRY(asm_kernel_thread)
-+ FAKE_STACK_FRAME $child_rip
-+ SAVE_ALL
-+
-+ # rdi: flags, rsi: usp, rdx: will be &pt_regs
-+ movq %rdx,%rdi
-+ orq $0x00800000,%rdi
-+ movq $-1, %rsi
-+ movq %rsp, %rdx
-+
-+ xorl %r8d,%r8d
-+ xorl %r9d,%r9d
-+ pushq %rcx
-+ call do_fork_pid
-+ addq $8, %rsp
-+ /* call do_fork */
-+ movq %rax,RAX(%rsp)
-+ xorl %edi,%edi
-+ RESTORE_ALL
-+ UNFAKE_STACK_FRAME
-+ ret
-+
-+child_rip:
-+ movq %rdi, %rax
-+ movq %rsi, %rdi
-+ call *%rax
-+ xorq %rdi, %rdi
-+ xorq %rsi, %rsi
-+ call complete_and_exit
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_conntrack.c linux-2.6.9-ve023stab030/kernel/cpt/rst_conntrack.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_conntrack.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_conntrack.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,305 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/netdevice.h>
-+#include <linux/inetdevice.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/unistd.h>
-+#include <linux/ve.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/cpt_image.h>
-+#include <linux/icmp.h>
-+#include <linux/ip.h>
-+
-+#if defined(CONFIG_VE_IPTABLES) && \
-+ (defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE))
-+
-+#include <linux/netfilter.h>
-+#include <linux/netfilter_ipv4/ip_conntrack.h>
-+#include <linux/netfilter_ipv4/ip_nat.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
-+#include <linux/netfilter_ipv4/ip_conntrack_core.h>
-+#include <linux/netfilter_ipv4/ip_nat_helper.h>
-+#include <linux/netfilter_ipv4/ip_nat_core.h>
-+#include <linux/netfilter_ipv4/lockhelp.h>
-+
-+#define ASSERT_READ_LOCK(x) do { } while (0)
-+#define ASSERT_WRITE_LOCK(x) do { } while (0)
-+
-+#include <linux/netfilter_ipv4/listhelp.h>
-+
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+struct ct_holder
-+{
-+ struct ct_holder *next;
-+ struct ip_conntrack *ct;
-+ int index;
-+};
-+
-+static void decode_tuple(struct cpt_ipct_tuple *v, struct ip_conntrack_tuple *tuple)
-+{
-+ tuple->dst.ip = v->cpt_dst;
-+ tuple->dst.u.all = v->cpt_dstport;
-+ tuple->dst.protonum = v->cpt_protonum;
-+
-+ tuple->src.ip = v->cpt_src;
-+ tuple->src.u.all = v->cpt_srcport;
-+}
-+
-+static void decode_nat_manip(struct cpt_nat_manip *v, struct ip_nat_info_manip *manip)
-+{
-+ manip->direction = v->cpt_direction;
-+ manip->hooknum = v->cpt_hooknum;
-+ manip->maniptype = v->cpt_maniptype;
-+
-+ manip->manip.ip = v->cpt_manip_addr;
-+ manip->manip.u.all = v->cpt_manip_port;
-+}
-+
-+
-+static int undump_expect_list(struct ip_conntrack *ct,
-+ struct cpt_ip_conntrack_image *ci,
-+ loff_t pos, struct ct_holder *ct_list,
-+ cpt_context_t *ctx)
-+{
-+ loff_t end;
-+ int err;
-+
-+ end = pos + ci->cpt_next;
-+ pos += ci->cpt_hdrlen;
-+ while (pos < end) {
-+ struct cpt_ip_connexpect_image v;
-+ struct ip_conntrack_expect *exp;
-+ struct ip_conntrack *sibling;
-+
-+ err = rst_get_object(CPT_OBJ_NET_CONNTRACK_EXPECT, pos, &v, ctx);
-+ if (err)
-+ return err;
-+
-+ if (sizeof(v.cpt_help) != sizeof(union ip_conntrack_expect_help)) {
-+ eprintk_ctx("conntrack exp->help version mismatch\n");
-+ return -EINVAL;
-+ }
-+
-+ sibling = NULL;
-+ if (v.cpt_sibling_conntrack) {
-+ struct ct_holder *c;
-+
-+ for (c = ct_list; c; c = c->next) {
-+ if (c->index == v.cpt_sibling_conntrack) {
-+ sibling = c->ct;
-+ break;
-+ }
-+ }
-+ if (!sibling) {
-+ eprintk_ctx("lost sibling of expectation\n");
-+ return -EINVAL;
-+ }
-+ }
-+
-+ WRITE_LOCK(&ip_conntrack_lock);
-+
-+ /* It is possible. Helper module could be just unregistered,
-+ * if expectation were on the list, it would be destroyed. */
-+ if (ct->helper == NULL) {
-+ WRITE_UNLOCK(&ip_conntrack_lock);
-+ dprintk_ctx("conntrack: no helper and non-trivial expectation\n");
-+ continue;
-+ }
-+
-+ exp = ip_conntrack_expect_alloc();
-+ if (exp == NULL) {
-+ WRITE_UNLOCK(&ip_conntrack_lock);
-+ return -ENOMEM;
-+ }
-+
-+ if (ct->helper->timeout && !del_timer(&exp->timeout)) {
-+ /* Dying already. We can do nothing. */
-+ WRITE_UNLOCK(&ip_conntrack_lock);
-+ dprintk_ctx("conntrack expectation is dying\n");
-+ continue;
-+ }
-+
-+ decode_tuple(&v.cpt_ct_tuple, &exp->ct_tuple);
-+ decode_tuple(&v.cpt_tuple, &exp->tuple);
-+ decode_tuple(&v.cpt_mask, &exp->mask);
-+
-+ exp->seq = v.cpt_seq;
-+
-+ memcpy(&exp->help, &v.cpt_help, sizeof(exp->help));
-+
-+ ip_conntrack_expect_insert(exp, ct);
-+ if (sibling) {
-+ exp->sibling = sibling;
-+ sibling->master = exp;
-+ LIST_DELETE(&ve_ip_conntrack_expect_list, exp);
-+ ct->expecting--;
-+ nf_conntrack_get(&master_ct(sibling)->ct_general);
-+ } else if (ct->helper->timeout) {
-+ exp->timeout.expires = jiffies + v.cpt_timeout;
-+ add_timer(&exp->timeout);
-+ }
-+ WRITE_UNLOCK(&ip_conntrack_lock);
-+
-+ pos += v.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+static int undump_one_ct(struct cpt_ip_conntrack_image *ci, loff_t pos,
-+ struct ct_holder **ct_list, cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ struct ip_conntrack *conntrack;
-+ int i;
-+ struct ct_holder *c;
-+
-+ c = kmalloc(sizeof(struct ct_holder), GFP_KERNEL);
-+ if (c == NULL)
-+ return -ENOMEM;
-+
-+ conntrack = ip_conntrack_alloc(get_exec_env()->_ip_conntrack->ub);
-+ if (!conntrack || IS_ERR(conntrack)) {
-+ kfree(c);
-+ return -ENOMEM;
-+ }
-+
-+ c->ct = conntrack;
-+ c->next = *ct_list;
-+ *ct_list = c;
-+ c->index = ci->cpt_index;
-+
-+ decode_tuple(&ci->cpt_tuple[0], &conntrack->tuplehash[0].tuple);
-+ conntrack->tuplehash[0].ctrack = conntrack;
-+ decode_tuple(&ci->cpt_tuple[1], &conntrack->tuplehash[1].tuple);
-+ conntrack->tuplehash[1].ctrack = conntrack;
-+
-+ conntrack->status = ci->cpt_status;
-+
-+ memcpy(&conntrack->proto, ci->cpt_proto_data, sizeof(conntrack->proto));
-+ memcpy(&conntrack->help, ci->cpt_help_data, sizeof(conntrack->help));
-+
-+#ifdef CONFIG_IP_NF_NAT_NEEDED
-+#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
-+ defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
-+ conntrack->nat.masq_index = ci->cpt_masq_index;
-+#endif
-+ if (ci->cpt_initialized) {
-+ conntrack->nat.info.initialized = ci->cpt_initialized;
-+ conntrack->nat.info.num_manips = ci->cpt_num_manips;
-+ for (i=0; i<conntrack->nat.info.num_manips; i++)
-+ decode_nat_manip(&ci->cpt_nat_manips[i], &conntrack->nat.info.manips[i]);
-+ conntrack->nat.info.seq[0].correction_pos = ci->cpt_nat_seq[0].cpt_correction_pos;
-+ conntrack->nat.info.seq[0].offset_before = ci->cpt_nat_seq[0].cpt_offset_before;
-+ conntrack->nat.info.seq[0].offset_after = ci->cpt_nat_seq[0].cpt_offset_after;
-+ conntrack->nat.info.seq[1].correction_pos = ci->cpt_nat_seq[1].cpt_correction_pos;
-+ conntrack->nat.info.seq[1].offset_before = ci->cpt_nat_seq[1].cpt_offset_before;
-+ conntrack->nat.info.seq[1].offset_after = ci->cpt_nat_seq[1].cpt_offset_after;
-+ err = ip_nat_install_conntrack(conntrack, ci->cpt_nat_helper);
-+ if (err) {
-+ eprintk_ctx("conntrack: cannot find NAT helper, some module is not loaded\n");
-+ conntrack->nat.info.initialized = 0;
-+ conntrack->nat.info.num_manips = 0;
-+ }
-+ }
-+#endif
-+
-+ WRITE_LOCK(&ip_conntrack_lock);
-+
-+ if (ci->cpt_ct_helper) {
-+ conntrack->helper = ip_ct_find_helper(&conntrack->tuplehash[1].tuple);
-+ if (conntrack->helper == NULL) {
-+ eprintk_ctx("conntrack: cannot find helper, some module is not loaded\n");
-+ err = -EINVAL;
-+ }
-+ }
-+
-+ atomic_inc(&(get_exec_env()->_ip_conntrack->_ip_conntrack_count));
-+
-+ ip_conntrack_hash_insert(conntrack);
-+ conntrack->timeout.expires = jiffies + ci->cpt_timeout;
-+
-+ WRITE_UNLOCK(&ip_conntrack_lock);
-+
-+ if (err == 0 && ci->cpt_next > ci->cpt_hdrlen)
-+ err = undump_expect_list(conntrack, ci, pos, *ct_list, ctx);
-+
-+ return err;
-+}
-+
-+int rst_restore_ip_conntrack(struct cpt_context * ctx)
-+{
-+ int err = 0;
-+ loff_t sec = ctx->sections[CPT_SECT_NET_CONNTRACK];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_ip_conntrack_image ci;
-+ struct ct_holder *c;
-+ struct ct_holder *ct_list = NULL;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ if (sizeof(ci.cpt_proto_data) != sizeof(union ip_conntrack_proto)) {
-+ eprintk_ctx("conntrack module ct->proto version mismatch\n");
-+ return -EINVAL;
-+ }
-+ if (sizeof(ci.cpt_help_data) != sizeof(union ip_conntrack_help)) {
-+ eprintk_ctx("conntrack module ct->help version mismatch\n");
-+ return -EINVAL;
-+ }
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NET_CONNTRACK || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ err = rst_get_object(CPT_OBJ_NET_CONNTRACK, sec, &ci, ctx);
-+ if (err)
-+ break;
-+ err = undump_one_ct(&ci, sec, &ct_list, ctx);
-+ if (err)
-+ break;
-+ sec += ci.cpt_next;
-+ }
-+
-+ while ((c = ct_list) != NULL) {
-+ ct_list = c->next;
-+ if (c->ct)
-+ add_timer(&c->ct->timeout);
-+ kfree(c);
-+ }
-+
-+ return err;
-+}
-+
-+#else
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+int rst_restore_ip_conntrack(struct cpt_context * ctx)
-+{
-+ if (ctx->sections[CPT_SECT_NET_CONNTRACK] != CPT_NULL)
-+ return -EINVAL;
-+ return 0;
-+}
-+
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_context.c linux-2.6.9-ve023stab030/kernel/cpt/rst_context.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_context.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_context.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,296 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+static ssize_t file_read(void *addr, size_t count, struct cpt_context *ctx)
-+{
-+ mm_segment_t oldfs;
-+ ssize_t err = -EBADF;
-+ struct file *file = ctx->file;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (file)
-+ err = file->f_op->read(file, addr, count, &file->f_pos);
-+ set_fs(oldfs);
-+ if (err != count)
-+ return err >= 0 ? -EIO : err;
-+ return 0;
-+}
-+
-+static ssize_t file_pread(void *addr, size_t count, struct cpt_context *ctx, loff_t pos)
-+{
-+ mm_segment_t oldfs;
-+ ssize_t err = -EBADF;
-+ struct file *file = ctx->file;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (file)
-+ err = file->f_op->read(file, addr, count, &pos);
-+ set_fs(oldfs);
-+ if (err != count)
-+ return err >= 0 ? -EIO : err;
-+ return 0;
-+}
-+
-+static void file_align(struct cpt_context *ctx)
-+{
-+ struct file *file = ctx->file;
-+
-+ if (file)
-+ file->f_pos = CPT_ALIGN(file->f_pos);
-+}
-+
-+int rst_get_section(int type, struct cpt_context *ctx, loff_t *start, loff_t *end)
-+{
-+ struct cpt_section_hdr hdr;
-+ int err;
-+ loff_t pos;
-+
-+ pos = ctx->sections[type];
-+ *start = *end = pos;
-+
-+ if (pos != CPT_NULL) {
-+ if ((err = ctx->pread(&hdr, sizeof(hdr), ctx, pos)) != 0)
-+ return err;
-+ if (hdr.cpt_section != type || hdr.cpt_hdrlen < sizeof(hdr))
-+ return -EINVAL;
-+ *start = pos + hdr.cpt_hdrlen;
-+ *end = pos + hdr.cpt_next;
-+ }
-+ return 0;
-+}
-+EXPORT_SYMBOL(rst_get_section);
-+
-+void rst_context_init(struct cpt_context *ctx)
-+{
-+ int i;
-+
-+ memset(ctx, 0, sizeof(*ctx));
-+
-+ init_MUTEX(&ctx->main_sem);
-+ ctx->refcount = 1;
-+
-+ ctx->current_section = -1;
-+ ctx->current_object = -1;
-+ ctx->pagesize = PAGE_SIZE;
-+ ctx->read = file_read;
-+ ctx->pread = file_pread;
-+ ctx->align = file_align;
-+ for (i=0; i < CPT_SECT_MAX; i++)
-+ ctx->sections[i] = CPT_NULL;
-+ init_completion(&ctx->pgin_notify);
-+ cpt_object_init(ctx);
-+}
-+
-+static int parse_sections(loff_t start, loff_t end, cpt_context_t *ctx)
-+{
-+ struct cpt_section_hdr h;
-+
-+ while (start < end) {
-+ int err;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, start);
-+ if (err)
-+ return err;
-+ if (h.cpt_hdrlen < sizeof(h) ||
-+ h.cpt_next < h.cpt_hdrlen ||
-+ start + h.cpt_next > end)
-+ return -EINVAL;
-+ if (h.cpt_section >= CPT_SECT_MAX)
-+ return -EINVAL;
-+ ctx->sections[h.cpt_section] = start;
-+ start += h.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+int rst_open_dumpfile(struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_major_tail *v;
-+ struct cpt_major_hdr h;
-+ unsigned long size;
-+
-+ err = -EBADF;
-+ if (!ctx->file)
-+ goto err_out;
-+
-+ err = -ENOMEM;
-+ ctx->tmpbuf = (char*)__get_free_page(GFP_KERNEL);
-+ if (ctx->tmpbuf == NULL)
-+ goto err_out;
-+ __cpt_release_buf(ctx);
-+
-+ size = ctx->file->f_dentry->d_inode->i_size;
-+
-+ if (size & 7) {
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+ if (size < sizeof(struct cpt_major_hdr) +
-+ sizeof(struct cpt_major_tail)) {
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+ err = ctx->pread(&h, sizeof(h), ctx, 0);
-+ if (err) {
-+ eprintk_ctx("too short image 1 %d\n", err);
-+ goto err_out;
-+ }
-+ if (h.cpt_signature[0] != CPT_SIGNATURE0 ||
-+ h.cpt_signature[1] != CPT_SIGNATURE1 ||
-+ h.cpt_signature[2] != CPT_SIGNATURE2 ||
-+ h.cpt_signature[3] != CPT_SIGNATURE3) {
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+ ctx->virt_jiffies64 = h.cpt_start_jiffies64;
-+ ctx->start_time.tv_sec = h.cpt_start_sec;
-+ ctx->start_time.tv_nsec = h.cpt_start_nsec;
-+ ctx->kernel_config_flags = h.cpt_kernel_config[0];
-+ ctx->iptables_mask = h.cpt_iptables_mask;
-+ ctx->image_version = h.cpt_image_version;
-+ ctx->features = (__u64)((__u64)h.cpt_ve_features2<<32 | h.cpt_ve_features);
-+
-+ v = cpt_get_buf(ctx);
-+ err = ctx->pread(v, sizeof(*v), ctx, size - sizeof(*v));
-+ if (err) {
-+ eprintk_ctx("too short image 2 %d\n", err);
-+ cpt_release_buf(ctx);
-+ goto err_out;
-+ }
-+ if (v->cpt_signature[0] != CPT_SIGNATURE0 ||
-+ v->cpt_signature[1] != CPT_SIGNATURE1 ||
-+ v->cpt_signature[2] != CPT_SIGNATURE2 ||
-+ v->cpt_signature[3] != CPT_SIGNATURE3 ||
-+ v->cpt_nsect != CPT_SECT_MAX_INDEX) {
-+ err = -EINVAL;
-+ cpt_release_buf(ctx);
-+ goto err_out;
-+ }
-+ if ((err = parse_sections(h.cpt_hdrlen, size - sizeof(*v) - sizeof(struct cpt_section_hdr), ctx)) < 0) {
-+ cpt_release_buf(ctx);
-+ goto err_out;
-+ }
-+ ctx->lazypages = v->cpt_lazypages;
-+ ctx->tasks64 = v->cpt_64bit;
-+ cpt_release_buf(ctx);
-+ return 0;
-+
-+err_out:
-+ if (ctx->tmpbuf) {
-+ free_page((unsigned long)ctx->tmpbuf);
-+ ctx->tmpbuf = NULL;
-+ }
-+ return err;
-+}
-+
-+void rst_close_dumpfile(struct cpt_context *ctx)
-+{
-+ if (ctx->file) {
-+ fput(ctx->file);
-+ ctx->file = NULL;
-+ }
-+ if (ctx->tmpbuf) {
-+ free_page((unsigned long)ctx->tmpbuf);
-+ ctx->tmpbuf = NULL;
-+ }
-+}
-+
-+int _rst_get_object(int type, loff_t pos, void *tmp, int size, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_object_hdr *hdr = tmp;
-+ err = ctx->pread(hdr, sizeof(struct cpt_object_hdr), ctx, pos);
-+ if (err)
-+ return err;
-+ if (type > 0 && type != hdr->cpt_object)
-+ return -EINVAL;
-+ if (hdr->cpt_hdrlen > hdr->cpt_next)
-+ return -EINVAL;
-+ if (hdr->cpt_hdrlen < sizeof(struct cpt_object_hdr))
-+ return -EINVAL;
-+ if (size < sizeof(*hdr))
-+ return -EINVAL;
-+ if (size > hdr->cpt_hdrlen)
-+ size = hdr->cpt_hdrlen;
-+ if (size > sizeof(*hdr))
-+ err = ctx->pread(hdr+1, size - sizeof(*hdr),
-+ ctx, pos + sizeof(*hdr));
-+ return err;
-+}
-+EXPORT_SYMBOL(_rst_get_object);
-+
-+void * __rst_get_object(int type, loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ void *tmp;
-+ struct cpt_object_hdr hdr;
-+ err = ctx->pread(&hdr, sizeof(hdr), ctx, pos);
-+ if (err)
-+ return NULL;
-+ if (type > 0 && type != hdr.cpt_object)
-+ return NULL;
-+ if (hdr.cpt_hdrlen > hdr.cpt_next)
-+ return NULL;
-+ if (hdr.cpt_hdrlen < sizeof(struct cpt_object_hdr))
-+ return NULL;
-+ tmp = kmalloc(hdr.cpt_hdrlen, GFP_KERNEL);
-+ if (!tmp)
-+ return NULL;
-+ err = ctx->pread(tmp, hdr.cpt_hdrlen, ctx, pos);
-+ if (!err)
-+ return tmp;
-+ kfree(tmp);
-+ return NULL;
-+}
-+EXPORT_SYMBOL(__rst_get_object);
-+
-+__u8 *__rst_get_name(loff_t *pos_p, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_object_hdr hdr;
-+ __u8 *name;
-+
-+ err = rst_get_object(CPT_OBJ_NAME, *pos_p, &hdr, ctx);
-+ if (err)
-+ return NULL;
-+ if (hdr.cpt_next - hdr.cpt_hdrlen > PAGE_SIZE)
-+ return NULL;
-+ name = (void*)__get_free_page(GFP_KERNEL);
-+ if (!name)
-+ return NULL;
-+ err = ctx->pread(name, hdr.cpt_next - hdr.cpt_hdrlen,
-+ ctx, *pos_p + hdr.cpt_hdrlen);
-+ if (err) {
-+ free_page((unsigned long)name);
-+ return NULL;
-+ }
-+ *pos_p += hdr.cpt_next;
-+ return name;
-+}
-+
-+__u8 *rst_get_name(loff_t pos, struct cpt_context *ctx)
-+{
-+ return __rst_get_name(&pos, ctx);
-+}
-+
-+void rst_put_name(__u8 *name, struct cpt_context *ctx)
-+{
-+ unsigned long addr = (unsigned long)name;
-+
-+ if (addr)
-+ free_page(addr&~(PAGE_SIZE-1));
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_epoll.c linux-2.6.9-ve023stab030/kernel/cpt/rst_epoll.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_epoll.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_epoll.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,162 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/namespace.h>
-+#include <linux/mount.h>
-+#include <linux/namei.h>
-+#include <linux/smp_lock.h>
-+#include <asm/uaccess.h>
-+#include <linux/vzcalluser.h>
-+#include <linux/eventpoll.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_kernel.h"
-+#include "cpt_fsmagic.h"
-+#include "cpt_syscalls.h"
-+
-+/* Those funcations are static in fs/eventpoll.c */
-+extern struct file_operations eventpoll_fops;
-+extern int ep_insert(struct eventpoll *ep, struct epoll_event *event,
-+ struct file *tfile, int fd);
-+extern struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
-+extern void ep_release_epitem(struct epitem *epi);
-+
-+
-+struct file *cpt_open_epolldev(struct cpt_file_image *fi,
-+ unsigned flags,
-+ struct cpt_context *ctx)
-+{
-+ struct file *file;
-+ int efd;
-+
-+ /* Argument "size" is ignored, use just 1 */
-+ efd = sys_epoll_create(1);
-+ if (efd < 0)
-+ return ERR_PTR(efd);
-+
-+ file = fget(efd);
-+ sys_close(efd);
-+ return file;
-+}
-+
-+static int restore_one_epoll(cpt_object_t *obj,
-+ loff_t pos,
-+ struct cpt_epoll_image *ebuf,
-+ cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ loff_t endpos;
-+ struct file *file = obj->o_obj;
-+ struct eventpoll *ep;
-+
-+ if (file->f_op != &eventpoll_fops) {
-+ eprintk_ctx("bad epoll file\n");
-+ return -EINVAL;
-+ }
-+
-+ ep = file->private_data;
-+
-+ if (unlikely(ep == NULL)) {
-+ eprintk_ctx("bad epoll device\n");
-+ return -EINVAL;
-+ }
-+
-+ endpos = pos + ebuf->cpt_next;
-+ pos += ebuf->cpt_hdrlen;
-+ while (pos < endpos) {
-+ struct cpt_epoll_file_image efi;
-+ struct epoll_event epds;
-+
-+ cpt_object_t *tobj;
-+
-+ err = rst_get_object(CPT_OBJ_EPOLL_FILE, pos, &efi, ctx);
-+ if (err)
-+ return err;
-+ tobj = lookup_cpt_obj_bypos(CPT_OBJ_FILE, efi.cpt_file, ctx);
-+ if (!tobj) {
-+ eprintk_ctx("epoll file not found\n");
-+ return -EINVAL;
-+ }
-+ epds.events = efi.cpt_events;
-+ epds.data = efi.cpt_data;
-+ down_write(&ep->sem);
-+ err = ep_insert(ep, &epds, tobj->o_obj, efi.cpt_fd);
-+ if (!err) {
-+ struct epitem *epi;
-+ epi = ep_find(ep, tobj->o_obj, efi.cpt_fd);
-+ if (epi) {
-+ epi->revents = efi.cpt_revents;
-+ if (efi.cpt_ready) {
-+ unsigned long flags;
-+ write_lock_irqsave(&ep->lock, flags);
-+ if (list_empty(&epi->rdllink))
-+ list_add_tail(&epi->rdllink, &ep->rdllist);
-+ write_unlock_irqrestore(&ep->lock, flags);
-+ }
-+ ep_release_epitem(epi);
-+ }
-+ }
-+ up_write(&ep->sem);
-+ if (err)
-+ break;
-+ pos += efi.cpt_next;
-+ }
-+ return err;
-+}
-+
-+int rst_eventpoll(cpt_context_t *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_EPOLL];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_EPOLL || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ cpt_object_t *obj;
-+ struct cpt_epoll_image *ebuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_EPOLL, sec, ebuf, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_FILE, ebuf->cpt_file, ctx);
-+ if (obj == NULL) {
-+ eprintk_ctx("cannot find epoll file object\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ err = restore_one_epoll(obj, sec, ebuf, ctx);
-+ cpt_release_buf(ctx);
-+ if (err)
-+ return err;
-+ sec += ebuf->cpt_next;
-+ }
-+
-+ return 0;
-+
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_files.c linux-2.6.9-ve023stab030/kernel/cpt/rst_files.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_files.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_files.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1424 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/mount.h>
-+#include <linux/tty.h>
-+#include <linux/namei.h>
-+#include <linux/vmalloc.h>
-+#include <linux/smp_lock.h>
-+#include <linux/vmalloc.h>
-+#include <asm/uaccess.h>
-+#include <ub/ub_mem.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_kernel.h"
-+#include "cpt_fsmagic.h"
-+
-+#include "cpt_syscalls.h"
-+
-+
-+struct filejob {
-+ struct filejob *next;
-+ int pid;
-+ loff_t fdi;
-+};
-+
-+static int rst_filejob_queue(loff_t pos, cpt_context_t *ctx)
-+{
-+ struct filejob *j;
-+
-+ j = kmalloc(sizeof(*j), GFP_KERNEL);
-+ if (j == NULL)
-+ return -ENOMEM;
-+ j->pid = current->pid;
-+ j->fdi = pos;
-+ j->next = ctx->filejob_queue;
-+ ctx->filejob_queue = j;
-+ return 0;
-+}
-+
-+/* Sorta ugly... Multiple readers/writers of named pipe rewrite buffer
-+ * many times. We need to mark it in CPT_OBJ_INODE table in some way.
-+ */
-+static int fixup_pipe_data(struct file *file, struct cpt_file_image *fi,
-+ struct cpt_context *ctx)
-+{
-+ struct inode *ino = file->f_dentry->d_inode;
-+ struct cpt_inode_image ii;
-+ struct cpt_obj_bits b;
-+ int err;
-+
-+ if (!S_ISFIFO(ino->i_mode)) {
-+ eprintk_ctx("fixup_pipe_data: not a pipe %Ld\n", fi->cpt_inode);
-+ return -EINVAL;
-+ }
-+ if (fi->cpt_inode == CPT_NULL)
-+ return 0;
-+
-+ err = rst_get_object(CPT_OBJ_INODE, fi->cpt_inode, &ii, ctx);
-+ if (err)
-+ return err;
-+
-+ if (ii.cpt_next <= ii.cpt_hdrlen)
-+ return 0;
-+
-+ err = rst_get_object(CPT_OBJ_BITS, fi->cpt_inode + ii.cpt_hdrlen, &b, ctx);
-+ if (err)
-+ return err;
-+
-+ if (b.cpt_size == 0)
-+ return 0;
-+
-+ if (b.cpt_size > PAGE_SIZE) {
-+ eprintk_ctx("too large pipe buffer to restore with this kernel\n");
-+ return -EINVAL;
-+ }
-+
-+ err = ctx->pread(PIPE_BASE(*ino), b.cpt_size, ctx,
-+ fi->cpt_inode + ii.cpt_hdrlen + b.cpt_hdrlen);
-+
-+ down(PIPE_SEM(*ino));
-+ PIPE_LEN(*ino) = b.cpt_size;
-+ PIPE_START(*ino) = 0;
-+ up(PIPE_SEM(*ino));
-+
-+ return err;
-+}
-+
-+static int make_flags(struct cpt_file_image *fi)
-+{
-+ int flags = O_NOFOLLOW;
-+ switch (fi->cpt_mode&(FMODE_READ|FMODE_WRITE)) {
-+ case FMODE_READ|FMODE_WRITE:
-+ flags |= O_RDWR; break;
-+ case FMODE_WRITE:
-+ flags |= O_WRONLY; break;
-+ case FMODE_READ:
-+ flags |= O_RDONLY; break;
-+ default: break;
-+ }
-+ flags |= fi->cpt_flags&~(O_ACCMODE|O_CREAT|O_TRUNC|O_EXCL|FASYNC);
-+ flags |= O_NONBLOCK|O_NOCTTY;
-+ return flags;
-+}
-+
-+static struct file *open_pipe(char *name,
-+ struct cpt_file_image *fi,
-+ unsigned flags,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+ struct cpt_inode_image ii;
-+ struct file *rf, *wf;
-+
-+ err = rst_get_object(CPT_OBJ_INODE, fi->cpt_inode, &ii, ctx);
-+ if (err)
-+ return ERR_PTR(err);
-+
-+ if (ii.cpt_sb == FSMAGIC_PIPEFS) {
-+ int pfd[2];
-+
-+ if ((err = sc_pipe(pfd)) < 0)
-+ return ERR_PTR(err);
-+
-+ rf = fcheck(pfd[0]);
-+ wf = fcheck(pfd[1]);
-+ get_file(rf);
-+ get_file(wf);
-+ sc_close(pfd[0]);
-+ sc_close(pfd[1]);
-+
-+ if (fi->cpt_mode&FMODE_READ) {
-+ struct file *tf;
-+ tf = wf; wf = rf; rf = tf;
-+ }
-+ } else {
-+ if (fi->cpt_mode&FMODE_READ) {
-+ rf = filp_open(name, flags, 0);
-+ if (IS_ERR(rf)) {
-+ dprintk_ctx("filp_open\n");
-+ return rf;
-+ }
-+ dprintk_ctx(CPT_FID "open RDONLY fifo ino %Ld %p %x\n", CPT_TID(current), fi->cpt_inode, rf, rf->f_dentry->d_inode->i_mode);
-+ return rf;
-+ }
-+
-+ dprintk_ctx(CPT_FID "open WRONLY fifo ino %Ld\n", CPT_TID(current), fi->cpt_inode);
-+
-+ rf = filp_open(name, O_RDWR|O_NONBLOCK, 0);
-+ if (IS_ERR(rf))
-+ return rf;
-+ wf = dentry_open(dget(rf->f_dentry),
-+ mntget(rf->f_vfsmnt), flags);
-+ }
-+
-+ /* Add pipe inode to obj table. */
-+ obj = cpt_object_add(CPT_OBJ_INODE, wf->f_dentry->d_inode, ctx);
-+ if (obj == NULL) {
-+ fput(rf); fput(wf);
-+ return ERR_PTR(-ENOMEM);
-+ }
-+ cpt_obj_setpos(obj, fi->cpt_inode, ctx);
-+ obj->o_parent = rf;
-+
-+ /* Add another side of pipe to obj table, it will not be used
-+ * (o_pos = PT_NULL), another processes opeining pipe will find
-+ * inode and open it with dentry_open(). */
-+ obj = cpt_object_add(CPT_OBJ_FILE, rf, ctx);
-+ if (obj == NULL) {
-+ fput(wf);
-+ return ERR_PTR(-ENOMEM);
-+ }
-+ return wf;
-+}
-+
-+static struct file *open_special(struct cpt_file_image *fi,
-+ unsigned flags,
-+ int deleted,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_inode_image *ii;
-+ struct file *file;
-+
-+ /* Directories and named pipes are not special actually */
-+ if (S_ISDIR(fi->cpt_i_mode) || S_ISFIFO(fi->cpt_i_mode))
-+ return NULL;
-+
-+ /* No support for block devices at the moment. */
-+ if (S_ISBLK(fi->cpt_i_mode))
-+ return ERR_PTR(-EINVAL);
-+
-+ if (S_ISSOCK(fi->cpt_i_mode)) {
-+ eprintk_ctx("bug: socket is not open\n");
-+ return ERR_PTR(-EINVAL);
-+ }
-+
-+ /* Support only (some) character devices at the moment. */
-+ if (!S_ISCHR(fi->cpt_i_mode))
-+ return ERR_PTR(-EINVAL);
-+
-+ ii = __rst_get_object(CPT_OBJ_INODE, fi->cpt_inode, ctx);
-+ if (ii == NULL)
-+ return ERR_PTR(-ENOMEM);
-+
-+ /* Do not worry about this right now. /dev/null,zero,*random are here.
-+ * To prohibit at least /dev/mem?
-+ */
-+ if (MAJOR(ii->cpt_rdev) == MEM_MAJOR) {
-+ kfree(ii);
-+ return NULL;
-+ }
-+
-+ file = rst_open_tty(fi, ii, flags, ctx);
-+ kfree(ii);
-+ return file;
-+}
-+
-+static int restore_posix_lock(struct file *file, struct cpt_flock_image *fli, cpt_context_t *ctx)
-+{
-+ struct file_lock lock;
-+ cpt_object_t *obj;
-+
-+ memset(&lock, 0, sizeof(lock));
-+ lock.fl_type = fli->cpt_type;
-+ lock.fl_flags = fli->cpt_flags & ~FL_SLEEP;
-+ lock.fl_start = fli->cpt_start;
-+ lock.fl_end = fli->cpt_end;
-+ obj = lookup_cpt_obj_byindex(CPT_OBJ_FILES, fli->cpt_owner, ctx);
-+ if (!obj) {
-+ eprintk_ctx("unknown lock owner %d\n", (int)fli->cpt_owner);
-+ return -EINVAL;
-+ }
-+ lock.fl_owner = obj->o_obj;
-+ lock.fl_pid = vpid_to_pid(fli->cpt_pid);
-+ if (lock.fl_pid < 0) {
-+ eprintk_ctx("unknown lock pid %d\n", lock.fl_pid);
-+ return -EINVAL;
-+ }
-+ lock.fl_file = file;
-+
-+ if (lock.fl_owner == NULL)
-+ eprintk_ctx("no lock owner\n");
-+ return posix_lock_file(file, &lock);
-+}
-+
-+static int restore_flock(struct file *file, struct cpt_flock_image *fli,
-+ cpt_context_t *ctx)
-+{
-+ int cmd, err, fd;
-+ fd = get_unused_fd();
-+ if (fd < 0) {
-+ eprintk_ctx("BSD flock cannot be restored\n");
-+ return fd;
-+ }
-+ get_file(file);
-+ fd_install(fd, file);
-+ if (fli->cpt_type == F_RDLCK) {
-+ cmd = LOCK_SH;
-+ } else if (fli->cpt_type == F_WRLCK) {
-+ cmd = LOCK_EX;
-+ } else {
-+ eprintk_ctx("flock flavor is unknown: %u\n", fli->cpt_type);
-+ sc_close(fd);
-+ return -EINVAL;
-+ }
-+
-+ err = sc_flock(fd, LOCK_NB | cmd);
-+ sc_close(fd);
-+ return err;
-+}
-+
-+
-+static int fixup_posix_locks(struct file *file,
-+ struct cpt_file_image *fi,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t end;
-+ struct cpt_flock_image fli;
-+
-+ end = pos + fi->cpt_next;
-+ pos += fi->cpt_hdrlen;
-+ while (pos < end) {
-+ err = rst_get_object(-1, pos, &fli, ctx);
-+ if (err)
-+ return err;
-+ if (fli.cpt_object == CPT_OBJ_FLOCK &&
-+ (fli.cpt_flags&FL_POSIX)) {
-+ err = restore_posix_lock(file, &fli, ctx);
-+ if (err)
-+ return err;
-+ dprintk_ctx("posix lock restored\n");
-+ }
-+ pos += fli.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+int rst_posix_locks(struct cpt_context *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+ struct cpt_file_image fi;
-+
-+ if (obj->o_pos == CPT_NULL)
-+ continue;
-+
-+ err = rst_get_object(CPT_OBJ_FILE, obj->o_pos, &fi, ctx);
-+ if (err < 0)
-+ return err;
-+ if (fi.cpt_next > fi.cpt_hdrlen)
-+ fixup_posix_locks(file, &fi, obj->o_pos, ctx);
-+ }
-+ return 0;
-+}
-+
-+static int fixup_flocks(struct file *file,
-+ struct cpt_file_image *fi,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t end;
-+ struct cpt_flock_image fli;
-+
-+ end = pos + fi->cpt_next;
-+ pos += fi->cpt_hdrlen;
-+ while (pos < end) {
-+ err = rst_get_object(-1, pos, &fli, ctx);
-+ if (err)
-+ return err;
-+ if (fli.cpt_object == CPT_OBJ_FLOCK &&
-+ (fli.cpt_flags&FL_FLOCK)) {
-+ err = restore_flock(file, &fli, ctx);
-+ if (err)
-+ return err;
-+ dprintk_ctx("bsd lock restored\n");
-+ }
-+ pos += fli.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+
-+static int fixup_reg_data(struct file *file, loff_t pos, loff_t end,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_page_block pgb;
-+ ssize_t (*do_write)(struct file *, const char __user *, size_t, loff_t *ppos);
-+
-+ do_write = file->f_op->write;
-+ if (do_write == NULL) {
-+ eprintk_ctx("no write method. Cannot restore contents of the file.\n");
-+ return -EINVAL;
-+ }
-+
-+ atomic_inc(&file->f_count);
-+
-+ while (pos < end) {
-+ loff_t opos;
-+ loff_t ipos;
-+ int count;
-+
-+ err = rst_get_object(CPT_OBJ_PAGES, pos, &pgb, ctx);
-+ if (err)
-+ goto out;
-+ dprintk_ctx("restoring file data block: %08x-%08x\n",
-+ (__u32)pgb.cpt_start, (__u32)pgb.cpt_end);
-+ ipos = pos + pgb.cpt_hdrlen;
-+ opos = pgb.cpt_start;
-+ count = pgb.cpt_end-pgb.cpt_start;
-+ while (count > 0) {
-+ mm_segment_t oldfs;
-+ int copy = count;
-+
-+ if (copy > PAGE_SIZE)
-+ copy = PAGE_SIZE;
-+ (void)cpt_get_buf(ctx);
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = ctx->pread(ctx->tmpbuf, copy, ctx, ipos);
-+ set_fs(oldfs);
-+ if (err) {
-+ __cpt_release_buf(ctx);
-+ goto out;
-+ }
-+ if (!(file->f_mode & FMODE_WRITE)) {
-+ fput(file);
-+ file = dentry_open(dget(file->f_dentry),
-+ mntget(file->f_vfsmnt), O_WRONLY);
-+ if (IS_ERR(file)) {
-+ __cpt_release_buf(ctx);
-+ return PTR_ERR(file);
-+ }
-+ }
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ ipos += copy;
-+ err = do_write(file, ctx->tmpbuf, copy, &opos);
-+ set_fs(oldfs);
-+ __cpt_release_buf(ctx);
-+ if (err != copy) {
-+ if (err >= 0)
-+ err = -EIO;
-+ goto out;
-+ }
-+ count -= copy;
-+ }
-+ pos += pgb.cpt_next;
-+ }
-+ err = 0;
-+
-+out:
-+ fput(file);
-+ return err;
-+}
-+
-+
-+static int fixup_file_content(struct file **file_p, struct cpt_file_image *fi,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_inode_image ii;
-+ struct file *file = *file_p;
-+ struct iattr newattrs;
-+
-+ if (!S_ISREG(fi->cpt_i_mode))
-+ return 0;
-+
-+ err = rst_get_object(CPT_OBJ_INODE, fi->cpt_inode, &ii, ctx);
-+ if (err)
-+ return err;
-+
-+ if (file == NULL) {
-+ file = shmem_file_setup("dev/zero", ii.cpt_size, 0);
-+ if (IS_ERR(file))
-+ return PTR_ERR(file);
-+ *file_p = file;
-+ }
-+
-+ if (ii.cpt_next > ii.cpt_hdrlen) {
-+ err = fixup_reg_data(file, fi->cpt_inode+ii.cpt_hdrlen,
-+ fi->cpt_inode+ii.cpt_next, ctx);
-+ if (err)
-+ return err;
-+ }
-+
-+ /* vzfs can not track ATTR_SIZE and ATTR_XTIME set at one time */
-+ down(&file->f_dentry->d_inode->i_sem);
-+ down_write(&file->f_dentry->d_inode->i_alloc_sem);
-+ /* stage 1 - update size like do_truncate does */
-+ newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-+ newattrs.ia_size = ii.cpt_size;
-+ cpt_timespec_import(&newattrs.ia_ctime, ii.cpt_ctime);
-+ err = notify_change(file->f_dentry, &newattrs);
-+ if (err)
-+ goto out;
-+
-+ /* stage 2 - update times */
-+ newattrs.ia_valid = ATTR_MTIME | ATTR_ATIME |
-+ ATTR_ATIME_SET | ATTR_MTIME_SET;
-+ cpt_timespec_import(&newattrs.ia_atime, ii.cpt_atime);
-+ cpt_timespec_import(&newattrs.ia_mtime, ii.cpt_mtime);
-+ err = notify_change(file->f_dentry, &newattrs);
-+
-+out:
-+ up_write(&file->f_dentry->d_inode->i_alloc_sem);
-+ up(&file->f_dentry->d_inode->i_sem);
-+ return err;
-+}
-+
-+static int fixup_file_flags(struct file *file, struct cpt_file_image *fi,
-+ int was_dentry_open, loff_t pos,
-+ cpt_context_t *ctx)
-+{
-+ if (fi->cpt_pos != file->f_pos) {
-+ int err = -ESPIPE;
-+ if (file->f_op->llseek)
-+ err = file->f_op->llseek(file, fi->cpt_pos, 0);
-+ if (err < 0) {
-+ dprintk_ctx("file %Ld lseek %Ld - %Ld\n", pos, file->f_pos, fi->cpt_pos);
-+ file->f_pos = fi->cpt_pos;
-+ }
-+ }
-+ file->f_uid = fi->cpt_uid;
-+ file->f_gid = fi->cpt_gid;
-+ file->f_owner.pid = 0;
-+ if (fi->cpt_fown_pid) {
-+ file->f_owner.pid = comb_vpid_to_pid(fi->cpt_fown_pid);
-+ if (file->f_owner.pid == 0) {
-+ wprintk_ctx("fixup_file_flags: owner %d does not exist anymore\n", file->f_owner.pid);
-+ return -EINVAL;
-+ }
-+ }
-+ file->f_owner.uid = fi->cpt_fown_uid;
-+ file->f_owner.euid = fi->cpt_fown_euid;
-+ file->f_owner.signum = fi->cpt_fown_signo;
-+
-+ if (file->f_mode != fi->cpt_mode) {
-+ if (was_dentry_open &&
-+ ((file->f_mode^fi->cpt_mode)&(FMODE_PREAD|FMODE_LSEEK))) {
-+ file->f_mode &= ~(FMODE_PREAD|FMODE_LSEEK);
-+ file->f_mode |= fi->cpt_mode&(FMODE_PREAD|FMODE_LSEEK);
-+ }
-+ if (file->f_mode != fi->cpt_mode)
-+ wprintk_ctx("file %ld mode mismatch %08x %08x\n", (long)pos, file->f_mode, fi->cpt_mode);
-+ }
-+ if (file->f_flags != fi->cpt_flags) {
-+ if (!(fi->cpt_flags&O_NOFOLLOW))
-+ file->f_flags &= ~O_NOFOLLOW;
-+ if ((file->f_flags^fi->cpt_flags)&O_NONBLOCK) {
-+ file->f_flags &= ~O_NONBLOCK;
-+ file->f_flags |= fi->cpt_flags&O_NONBLOCK;
-+ }
-+ if (fi->cpt_flags&FASYNC) {
-+ if (fi->cpt_fown_fd == -1) {
-+ wprintk_ctx("No fd for FASYNC\n");
-+ return -EINVAL;
-+ } else if (file->f_op && file->f_op->fasync) {
-+ if (file->f_op->fasync(fi->cpt_fown_fd, file, 1) < 0) {
-+ wprintk_ctx("FASYNC problem\n");
-+ return -EINVAL;
-+ } else {
-+ file->f_flags |= FASYNC;
-+ }
-+ }
-+ }
-+ if (file->f_flags != fi->cpt_flags) {
-+ eprintk_ctx("file %ld flags mismatch %08x %08x\n", (long)pos, file->f_flags, fi->cpt_flags);
-+ return -EINVAL;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static struct file *
-+open_deleted(char *name, unsigned flags, struct cpt_file_image *fi,
-+ cpt_context_t *ctx)
-+{
-+ struct file * file;
-+ char *suffix = NULL;
-+ int attempt = 0;
-+ int tmp_pass = 0;
-+ mode_t mode = fi->cpt_i_mode;
-+
-+ /* Strip (deleted) part... */
-+ if (strlen(name) > strlen(" (deleted)")) {
-+ if (strcmp(name + strlen(name) - strlen(" (deleted)"), " (deleted)") == 0) {
-+ suffix = &name[strlen(name) - strlen(" (deleted)")];
-+ *suffix = 0;
-+ } else if (memcmp(name, "(deleted) ", strlen("(deleted) ")) == 0) {
-+ memmove(name, name + strlen("(deleted) "), strlen(name) - strlen(" (deleted)") + 1);
-+ suffix = name + strlen(name);
-+ }
-+ }
-+
-+try_again:
-+ for (;;) {
-+ if (attempt) {
-+ if (attempt > 1000) {
-+ eprintk_ctx("open_deleted: failed after %d attempts\n", attempt);
-+ return ERR_PTR(-EEXIST);
-+ }
-+ if (suffix == NULL) {
-+ eprintk_ctx("open_deleted: no suffix\n");
-+ return ERR_PTR(-EEXIST);
-+ }
-+ sprintf(suffix, ".%08x", (unsigned)((xtime.tv_nsec>>10)+attempt));
-+ }
-+ attempt++;
-+
-+ if (S_ISFIFO(mode)) {
-+ int err;
-+ err = sc_mknod(name, S_IFIFO|(mode&017777), 0);
-+ if (err == -EEXIST)
-+ continue;
-+ if (err < 0 && !tmp_pass)
-+ goto change_dir;
-+ if (err < 0)
-+ return ERR_PTR(err);
-+ file = open_pipe(name, fi, flags, ctx);
-+ sc_unlink(name);
-+ } else if (S_ISCHR(mode)) {
-+ int err;
-+ struct cpt_inode_image *ii;
-+
-+ ii = __rst_get_object(CPT_OBJ_INODE, fi->cpt_inode, ctx);
-+ if (ii == NULL)
-+ return ERR_PTR(-ENOMEM);
-+ err = sc_mknod(name, S_IFCHR|(mode&017777), new_encode_dev(ii->cpt_rdev));
-+ kfree(ii);
-+ if (err == -EEXIST)
-+ continue;
-+ if (err < 0 && !tmp_pass)
-+ goto change_dir;
-+ if (err < 0)
-+ return ERR_PTR(err);
-+ file = filp_open(name, flags, mode&017777);
-+ sc_unlink(name);
-+ } else if (S_ISDIR(mode)) {
-+ int err;
-+ err = sc_mkdir(name, mode&017777);
-+ if (err == -EEXIST)
-+ continue;
-+ if (err < 0 && !tmp_pass)
-+ goto change_dir;
-+ if (err < 0)
-+ return ERR_PTR(err);
-+ file = filp_open(name, flags, mode&017777);
-+ sc_rmdir(name);
-+ } else {
-+ file = filp_open(name, O_CREAT|O_EXCL|flags, mode&017777);
-+ if (IS_ERR(file)) {
-+ if (PTR_ERR(file) == -EEXIST)
-+ continue;
-+ if (!tmp_pass)
-+ goto change_dir;
-+ } else {
-+ sc_unlink(name);
-+ }
-+ }
-+ break;
-+ }
-+
-+ if (IS_ERR(file)) {
-+ eprintk_ctx("filp_open %s: %ld\n", name, PTR_ERR(file));
-+ return file;
-+ } else {
-+ dprintk_ctx("deleted file created as %s, %p, %x\n", name, file, file->f_dentry->d_inode->i_mode);
-+ }
-+ return file;
-+
-+change_dir:
-+ sprintf(name, "/tmp/rst%u", current->pid);
-+ suffix = name + strlen(name);
-+ attempt = 1;
-+ tmp_pass = 1;
-+ goto try_again;
-+}
-+
-+struct file *rst_file(loff_t pos, int fd, struct cpt_context *ctx)
-+{
-+ int err;
-+ int was_dentry_open = 0;
-+ cpt_object_t *obj;
-+ cpt_object_t *iobj;
-+ struct cpt_file_image fi;
-+ __u8 *name = NULL;
-+ struct file *file;
-+ int flags;
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_FILE, pos, ctx);
-+ if (obj) {
-+ file = obj->o_obj;
-+ if (obj->o_index >= 0) {
-+ dprintk_ctx("file is attached to a socket\n");
-+ err = rst_get_object(CPT_OBJ_FILE, pos, &fi, ctx);
-+ if (err < 0)
-+ goto err_out;
-+ fixup_file_flags(file, &fi, 0, pos, ctx);
-+ }
-+ get_file(file);
-+ return file;
-+ }
-+
-+ err = rst_get_object(CPT_OBJ_FILE, pos, &fi, ctx);
-+ if (err < 0)
-+ goto err_out;
-+
-+ flags = make_flags(&fi);
-+
-+ /* Easy way, inode has been already open. */
-+ if (fi.cpt_inode != CPT_NULL &&
-+ !(fi.cpt_lflags & CPT_DENTRY_CLONING) &&
-+ (iobj = lookup_cpt_obj_bypos(CPT_OBJ_INODE, fi.cpt_inode, ctx)) != NULL &&
-+ iobj->o_parent) {
-+ struct file *filp = iobj->o_parent;
-+ file = dentry_open(dget(filp->f_dentry),
-+ mntget(filp->f_vfsmnt), flags);
-+ dprintk_ctx("rst_file: file obtained by dentry_open\n");
-+ was_dentry_open = 1;
-+ goto map_file;
-+ }
-+
-+ if (fi.cpt_next > fi.cpt_hdrlen)
-+ name = rst_get_name(pos + sizeof(fi), ctx);
-+
-+ if (!name) {
-+ eprintk_ctx("no name for file?\n");
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+
-+ if (fi.cpt_lflags & CPT_DENTRY_DELETED) {
-+ if (fi.cpt_inode == CPT_NULL) {
-+ eprintk_ctx("deleted file and no inode.\n");
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+
-+ /* One very special case... */
-+ if (S_ISREG(fi.cpt_i_mode) &&
-+ (!name[0] || strcmp(name, "/dev/zero (deleted)") == 0)) {
-+ /* MAP_ANON|MAP_SHARED mapping.
-+ * kernel makes this damn ugly way, when file which
-+ * is passed to mmap by user does not match
-+ * file finally attached to VMA. Ok, rst_mm
-+ * has to take care of this. Otherwise, it will fail.
-+ */
-+ file = NULL;
-+ } else if (S_ISREG(fi.cpt_i_mode) ||
-+ S_ISCHR(fi.cpt_i_mode) ||
-+ S_ISFIFO(fi.cpt_i_mode) ||
-+ S_ISDIR(fi.cpt_i_mode)) {
-+ if (S_ISCHR(fi.cpt_i_mode)) {
-+ file = open_special(&fi, flags, 1, ctx);
-+ if (file != NULL)
-+ goto map_file;
-+ }
-+ file = open_deleted(name, flags, &fi, ctx);
-+ if (IS_ERR(file))
-+ goto out;
-+ } else {
-+ eprintk_ctx("not a regular deleted file.\n");
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+
-+ err = fixup_file_content(&file, &fi, ctx);
-+ if (err)
-+ goto err_put;
-+ goto map_file;
-+ } else {
-+ if (!name[0]) {
-+ eprintk_ctx("empty name for file?\n");
-+ err = -EINVAL;
-+ goto err_out;
-+ }
-+ if ((fi.cpt_lflags & CPT_DENTRY_EPOLL) &&
-+ (file = cpt_open_epolldev(&fi, flags, ctx)) != NULL)
-+ goto map_file;
-+ if (S_ISFIFO(fi.cpt_i_mode) &&
-+ (file = open_pipe(name, &fi, flags, ctx)) != NULL)
-+ goto map_file;
-+ if (!S_ISREG(fi.cpt_i_mode) &&
-+ (file = open_special(&fi, flags, 0, ctx)) != NULL)
-+ goto map_file;
-+ }
-+
-+ file = filp_open(name, flags, 0);
-+
-+map_file:
-+ if (!IS_ERR(file)) {
-+ fixup_file_flags(file, &fi, was_dentry_open, pos, ctx);
-+
-+ if (S_ISFIFO(fi.cpt_i_mode) && !was_dentry_open) {
-+ err = fixup_pipe_data(file, &fi, ctx);
-+ if (err)
-+ goto err_put;
-+ }
-+
-+ /* This is very special hack. Logically, cwd/root are
-+ * nothing but open directories. Nevertheless, this causes
-+ * failures of restores, when number of open files in VE
-+ * is close to limit. So, if it is rst_file() of cwd/root
-+ * (fd = -2) and the directory is not deleted, we skip
-+ * adding files to object table. If the directory is
-+ * not unlinked, this cannot cause any problems.
-+ */
-+ if (fd != -2 ||
-+ !S_ISDIR(file->f_dentry->d_inode->i_mode) ||
-+ (fi.cpt_lflags & CPT_DENTRY_DELETED)) {
-+ obj = cpt_object_get(CPT_OBJ_FILE, file, ctx);
-+ if (!obj) {
-+ obj = cpt_object_add(CPT_OBJ_FILE, file, ctx);
-+ if (obj)
-+ get_file(file);
-+ }
-+ if (obj)
-+ cpt_obj_setpos(obj, pos, ctx);
-+
-+ obj = cpt_object_add(CPT_OBJ_INODE, file->f_dentry->d_inode, ctx);
-+ if (obj) {
-+ cpt_obj_setpos(obj, fi.cpt_inode, ctx);
-+ if (!obj->o_parent || !(fi.cpt_lflags & CPT_DENTRY_DELETED))
-+ obj->o_parent = file;
-+ }
-+ }
-+
-+ if (fi.cpt_next > fi.cpt_hdrlen) {
-+ err = fixup_flocks(file, &fi, pos, ctx);
-+ if (err)
-+ goto err_put;
-+ }
-+ } else {
-+ if (fi.cpt_lflags & CPT_DENTRY_PROC) {
-+ dprintk_ctx("rst_file /proc delayed\n");
-+ file = NULL;
-+ }
-+ }
-+
-+out:
-+ if (name)
-+ rst_put_name(name, ctx);
-+ return file;
-+
-+err_put:
-+ if (file)
-+ fput(file);
-+err_out:
-+ if (name)
-+ rst_put_name(name, ctx);
-+ return ERR_PTR(err);
-+}
-+
-+
-+__u32 rst_files_flag(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ __u32 flag = 0;
-+
-+ if (ti->cpt_files == CPT_NULL ||
-+ lookup_cpt_obj_bypos(CPT_OBJ_FILES, ti->cpt_files, ctx))
-+ flag |= CLONE_FILES;
-+ if (ti->cpt_fs == CPT_NULL ||
-+ lookup_cpt_obj_bypos(CPT_OBJ_FS, ti->cpt_fs, ctx))
-+ flag |= CLONE_FS;
-+ return flag;
-+}
-+
-+static void local_close_files(struct files_struct * files)
-+{
-+ int i, j;
-+
-+ j = 0;
-+ for (;;) {
-+ unsigned long set;
-+ i = j * __NFDBITS;
-+ if (i >= files->max_fdset || i >= files->max_fds)
-+ break;
-+ set = files->open_fds->fds_bits[j];
-+ while (set) {
-+ if (set & 1) {
-+ struct file * file = xchg(&files->fd[i], NULL);
-+ if (file)
-+ filp_close(file, files);
-+ }
-+ i++;
-+ set >>= 1;
-+ }
-+ files->open_fds->fds_bits[j] = 0;
-+ files->close_on_exec->fds_bits[j] = 0;
-+ j++;
-+ }
-+}
-+
-+
-+int rst_files_complete(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ struct cpt_files_struct_image fi;
-+ struct files_struct *f = current->files;
-+ cpt_object_t *obj;
-+ loff_t pos, endpos;
-+ int err;
-+
-+ if (ti->cpt_files == CPT_NULL) {
-+ current->files = NULL;
-+ if (f)
-+ put_files_struct(f);
-+ return 0;
-+ }
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_FILES, ti->cpt_files, ctx);
-+ if (obj) {
-+ if (obj->o_obj != f) {
-+ put_files_struct(f);
-+ f = obj->o_obj;
-+ atomic_inc(&f->count);
-+ current->files = f;
-+ }
-+ return 0;
-+ }
-+
-+ err = rst_get_object(CPT_OBJ_FILES, ti->cpt_files, &fi, ctx);
-+ if (err)
-+ return err;
-+
-+ local_close_files(f);
-+
-+ if (fi.cpt_max_fds > f->max_fdset) {
-+ spin_lock(&f->file_lock);
-+ err = expand_fdset(f, fi.cpt_max_fds-1);
-+ spin_unlock(&f->file_lock);
-+ if (err)
-+ return err;
-+ }
-+ if (fi.cpt_max_fds > f->max_fds) {
-+ spin_lock(&f->file_lock);
-+ err = expand_fd_array(f, fi.cpt_max_fds-1);
-+ spin_unlock(&f->file_lock);
-+ if (err)
-+ return err;
-+ }
-+
-+ pos = ti->cpt_files + fi.cpt_hdrlen;
-+ endpos = ti->cpt_files + fi.cpt_next;
-+ while (pos < endpos) {
-+ struct cpt_fd_image fdi;
-+ struct file *filp;
-+
-+ err = rst_get_object(CPT_OBJ_FILEDESC, pos, &fdi, ctx);
-+ if (err)
-+ return err;
-+ filp = rst_file(fdi.cpt_file, fdi.cpt_fd, ctx);
-+ if (IS_ERR(filp)) {
-+ eprintk_ctx("rst_file: %ld %Lu\n", PTR_ERR(filp), fdi.cpt_file);
-+ return PTR_ERR(filp);
-+ }
-+ if (filp == NULL) {
-+ int err = rst_filejob_queue(pos, ctx);
-+ if (err)
-+ return err;
-+ } else {
-+ if (fdi.cpt_fd >= f->max_fds) BUG();
-+ f->fd[fdi.cpt_fd] = filp;
-+ FD_SET(fdi.cpt_fd, f->open_fds);
-+ if (fdi.cpt_flags&CPT_FD_FLAG_CLOSEEXEC)
-+ FD_SET(fdi.cpt_fd, f->close_on_exec);
-+ }
-+ pos += fdi.cpt_next;
-+ }
-+ f->next_fd = fi.cpt_next_fd;
-+
-+ obj = cpt_object_add(CPT_OBJ_FILES, f, ctx);
-+ if (obj) {
-+ cpt_obj_setpos(obj, ti->cpt_files, ctx);
-+ cpt_obj_setindex(obj, fi.cpt_index, ctx);
-+ }
-+ return 0;
-+}
-+
-+int rst_do_filejobs(cpt_context_t *ctx)
-+{
-+ struct filejob *j;
-+
-+ while ((j = ctx->filejob_queue) != NULL) {
-+ int err;
-+ task_t *tsk;
-+ struct cpt_fd_image fdi;
-+ struct file *filp;
-+
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_ve(j->pid);
-+ if (tsk)
-+ get_task_struct(tsk);
-+ read_unlock(&tasklist_lock);
-+ if (!tsk)
-+ return -EINVAL;
-+
-+ err = rst_get_object(CPT_OBJ_FILEDESC, j->fdi, &fdi, ctx);
-+ if (err) {
-+ put_task_struct(tsk);
-+ return err;
-+ }
-+
-+ if (fdi.cpt_fd >= tsk->files->max_fds) BUG();
-+ if (tsk->files->fd[fdi.cpt_fd] ||
-+ FD_ISSET(fdi.cpt_fd, tsk->files->open_fds)) {
-+ eprintk_ctx("doing filejob %Ld: fd is busy\n", j->fdi);
-+ put_task_struct(tsk);
-+ return -EBUSY;
-+ }
-+
-+ filp = rst_file(fdi.cpt_file, fdi.cpt_fd, ctx);
-+ if (IS_ERR(filp)) {
-+ eprintk_ctx("rst_do_filejobs: 1: %ld %Lu\n", PTR_ERR(filp), fdi.cpt_file);
-+ put_task_struct(tsk);
-+ return PTR_ERR(filp);
-+ }
-+ if (fdi.cpt_fd >= tsk->files->max_fds) BUG();
-+ tsk->files->fd[fdi.cpt_fd] = filp;
-+ FD_SET(fdi.cpt_fd, tsk->files->open_fds);
-+ if (fdi.cpt_flags&CPT_FD_FLAG_CLOSEEXEC)
-+ FD_SET(fdi.cpt_fd, tsk->files->close_on_exec);
-+
-+ dprintk_ctx("filejob %Ld done\n", j->fdi);
-+
-+ put_task_struct(tsk);
-+ ctx->filejob_queue = j->next;
-+ kfree(j);
-+ }
-+ return 0;
-+}
-+
-+void rst_flush_filejobs(cpt_context_t *ctx)
-+{
-+ struct filejob *j;
-+
-+ while ((j = ctx->filejob_queue) != NULL) {
-+ ctx->filejob_queue = j->next;
-+ kfree(j);
-+ }
-+}
-+
-+int rst_fs_complete(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ struct fs_struct *f = current->fs;
-+ cpt_object_t *obj;
-+
-+ if (ti->cpt_fs == CPT_NULL) {
-+ exit_fs(current);
-+ return 0;
-+ }
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_FS, ti->cpt_fs, ctx);
-+ if (obj) {
-+ if (obj->o_obj != f) {
-+ exit_fs(current);
-+ f = obj->o_obj;
-+ atomic_inc(&f->count);
-+ current->fs = f;
-+ }
-+ return 0;
-+ }
-+
-+ /* Do _not_ restore root. Image contains absolute pathnames.
-+ * So, we fix it in context of rst process.
-+ */
-+
-+ obj = cpt_object_add(CPT_OBJ_FS, f, ctx);
-+ if (obj)
-+ cpt_obj_setpos(obj, ti->cpt_fs, ctx);
-+
-+ return 0;
-+}
-+
-+static int get_dir(struct dentry **dp, struct vfsmount **mp,
-+ loff_t *pos, struct cpt_context *ctx)
-+{
-+ struct cpt_file_image fi;
-+ struct file * file;
-+ int err;
-+
-+ err = rst_get_object(CPT_OBJ_FILE, *pos, &fi, ctx);
-+ if (err)
-+ return err;
-+
-+ file = rst_file(*pos, -2, ctx);
-+ if (IS_ERR(file))
-+ return PTR_ERR(file);
-+
-+ *dp = dget(file->f_dentry);
-+ *mp = mntget(file->f_vfsmnt);
-+ *pos += fi.cpt_next;
-+ fput(file);
-+ return 0;
-+}
-+
-+static void __set_fs_root(struct fs_struct *fs, struct vfsmount *mnt,
-+ struct dentry *dentry)
-+{
-+ struct dentry *old_root;
-+ struct vfsmount *old_rootmnt;
-+ write_lock(&fs->lock);
-+ old_root = fs->root;
-+ old_rootmnt = fs->rootmnt;
-+ fs->rootmnt = mnt;
-+ fs->root = dentry;
-+ write_unlock(&fs->lock);
-+ if (old_root) {
-+ dput(old_root);
-+ mntput(old_rootmnt);
-+ }
-+}
-+
-+static void __set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
-+ struct dentry *dentry)
-+{
-+ struct dentry *old_pwd;
-+ struct vfsmount *old_pwdmnt;
-+
-+ write_lock(&fs->lock);
-+ old_pwd = fs->pwd;
-+ old_pwdmnt = fs->pwdmnt;
-+ fs->pwdmnt = mnt;
-+ fs->pwd = dentry;
-+ write_unlock(&fs->lock);
-+
-+ if (old_pwd) {
-+ dput(old_pwd);
-+ mntput(old_pwdmnt);
-+ }
-+}
-+
-+
-+int rst_restore_fs(struct cpt_context *ctx)
-+{
-+ loff_t pos;
-+ cpt_object_t *obj;
-+ int err = 0;
-+
-+ for_each_object(obj, CPT_OBJ_FS) {
-+ struct cpt_fs_struct_image fi;
-+ struct fs_struct *fs = obj->o_obj;
-+ int i;
-+ struct dentry *d[3];
-+ struct vfsmount *m[3];
-+
-+ err = rst_get_object(CPT_OBJ_FS, obj->o_pos, &fi, ctx);
-+ if (err)
-+ return err;
-+
-+ fs->umask = fi.cpt_umask;
-+
-+ pos = obj->o_pos + fi.cpt_hdrlen;
-+ d[0] = d[1] = d[2] = NULL;
-+ m[0] = m[1] = m[2] = NULL;
-+ i = 0;
-+ while (pos < obj->o_pos + fi.cpt_next && i<3) {
-+ err = get_dir(d+i, m+i, &pos, ctx);
-+ if (err) {
-+ eprintk_ctx("cannot get_dir: %d", err);
-+ for (--i; i >= 0; i--) {
-+ if (d[i])
-+ dput(d[i]);
-+ if (m[i])
-+ mntput(m[i]);
-+ }
-+ return err;
-+ }
-+ i++;
-+ }
-+ if (d[0])
-+ __set_fs_root(fs, m[0], d[0]);
-+ if (d[1])
-+ __set_fs_pwd(fs, m[1], d[1]);
-+ if (d[2]) {
-+ struct dentry *olddentry;
-+ struct vfsmount *oldmnt;
-+ write_lock(&fs->lock);
-+ oldmnt = fs->altrootmnt;
-+ olddentry = fs->altroot;
-+ fs->altrootmnt = m[2];
-+ fs->altroot = d[2];
-+ write_unlock(&fs->lock);
-+
-+ if (olddentry) {
-+ dput(olddentry);
-+ mntput(oldmnt);
-+ }
-+ }
-+ }
-+ return err;
-+}
-+
-+int do_one_mount(char *mntpnt, char *mnttype, char *mntbind,
-+ unsigned long flags, unsigned long mnt_flags,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+
-+ if (mntbind && (strcmp(mntbind, "/") == 0 || strcmp(mntbind, "") == 0))
-+ mntbind = NULL;
-+
-+ if (mntbind)
-+ flags |= MS_BIND;
-+ /* Join per-mountpoint flags with global flags */
-+ if (mnt_flags & MNT_NOSUID)
-+ flags |= MS_NOSUID;
-+ if (mnt_flags & MNT_NODEV)
-+ flags |= MS_NODEV;
-+ if (mnt_flags & MNT_NOEXEC)
-+ flags |= MS_NOEXEC;
-+
-+ err = sc_mount(mntbind, mntpnt, mnttype, flags);
-+ if (err < 0) {
-+ eprintk_ctx("%d mounting %s %s %08lx\n", err, mntpnt, mnttype, flags);
-+ return err;
-+ }
-+ return 0;
-+}
-+
-+static int undumptmpfs(void *arg)
-+{
-+ int i;
-+ int *pfd = arg;
-+ char *argv[] = { "tar", "x", "-C", "/", "-S", NULL };
-+
-+ if (pfd[0] != 0)
-+ sc_dup2(pfd[0], 0);
-+
-+ for (i=1; i<current->files->max_fds; i++)
-+ sc_close(i);
-+
-+ module_put(THIS_MODULE);
-+
-+ set_fs(KERNEL_DS);
-+ i = sc_execve("/bin/tar", argv, NULL);
-+ eprintk("failed to exec /bin/tar: %d\n", i);
-+ return -1;
-+}
-+
-+static int rst_restore_tmpfs(loff_t *pos, struct cpt_context * ctx)
-+{
-+ int err;
-+ int pfd[2];
-+ struct file *f;
-+ struct cpt_object_hdr v;
-+ int n;
-+ loff_t end;
-+ int pid;
-+
-+ err = rst_get_object(CPT_OBJ_NAME, *pos, &v, ctx);
-+ if (err < 0)
-+ return err;
-+
-+ err = sc_pipe(pfd);
-+ if (err < 0)
-+ return err;
-+ pid = err = local_kernel_thread(undumptmpfs, (void*)pfd, SIGCHLD, 0);
-+ if (err < 0)
-+ goto out;
-+ f = fget(pfd[1]);
-+ sc_close(pfd[1]);
-+ sc_close(pfd[0]);
-+
-+ ctx->file->f_pos = *pos + v.cpt_hdrlen;
-+ end = *pos + v.cpt_next;
-+ *pos += v.cpt_next;
-+ do {
-+ char buf[16];
-+ mm_segment_t oldfs;
-+
-+ n = end - ctx->file->f_pos;
-+ if (n > sizeof(buf))
-+ n = sizeof(buf);
-+
-+ if (ctx->read(buf, n, ctx))
-+ break;
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ f->f_op->write(f, buf, n, &f->f_pos);
-+ set_fs(oldfs);
-+ } while (ctx->file->f_pos < end);
-+
-+ fput(f);
-+
-+ clear_tsk_thread_flag(current,TIF_SIGPENDING);
-+
-+ if ((err = sc_waitx(pid, 0)) < 0)
-+ eprintk_ctx("wait4: %d\n", err);
-+
-+ return 0;
-+
-+out:
-+ if (pfd[1] >= 0)
-+ sc_close(pfd[1]);
-+ if (pfd[0] >= 0)
-+ sc_close(pfd[0]);
-+ return err;
-+}
-+
-+int restore_one_vfsmount(struct cpt_vfsmount_image *mi, loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t endpos;
-+
-+ endpos = pos + mi->cpt_next;
-+ pos += mi->cpt_hdrlen;
-+
-+ while (pos < endpos) {
-+ char *mntdev;
-+ char *mntpnt;
-+ char *mnttype;
-+ char *mntbind;
-+
-+ mntdev = __rst_get_name(&pos, ctx);
-+ mntpnt = __rst_get_name(&pos, ctx);
-+ mnttype = __rst_get_name(&pos, ctx);
-+ mntbind = NULL;
-+ if (mi->cpt_mntflags & CPT_MNT_BIND)
-+ mntbind = __rst_get_name(&pos, ctx);
-+ err = -EINVAL;
-+ if (mnttype && mntpnt) {
-+ err = 0;
-+ if (!(mi->cpt_mntflags & CPT_MNT_EXT) &&
-+ strcmp(mntpnt, "/")) {
-+ err = do_one_mount(mntpnt, mnttype, mntbind,
-+ mi->cpt_flags,
-+ mi->cpt_mntflags, ctx);
-+ if (!err &&
-+ strcmp(mnttype, "tmpfs") == 0 &&
-+ !(mi->cpt_mntflags & (CPT_MNT_BIND)))
-+ rst_restore_tmpfs(&pos, ctx);
-+ }
-+ }
-+ if (mntdev)
-+ rst_put_name(mntdev, ctx);
-+ if (mntpnt)
-+ rst_put_name(mntpnt, ctx);
-+ if (mnttype)
-+ rst_put_name(mnttype, ctx);
-+ if (mntbind)
-+ rst_put_name(mntbind, ctx);
-+ if (err)
-+ return err;
-+ }
-+ return 0;
-+}
-+
-+int restore_one_namespace(loff_t pos, loff_t endpos, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_vfsmount_image mi;
-+
-+ while (pos < endpos) {
-+ err = rst_get_object(CPT_OBJ_VFSMOUNT, pos, &mi, ctx);
-+ if (err)
-+ return err;
-+ err = restore_one_vfsmount(&mi, pos, ctx);
-+ if (err)
-+ return err;
-+ pos += mi.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+int rst_root_namespace(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_NAMESPACE];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_object_hdr sbuf;
-+ int done = 0;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NAMESPACE || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ err = rst_get_object(CPT_OBJ_NAMESPACE, sec, &sbuf, ctx);
-+ if (err)
-+ return err;
-+ if (done) {
-+ eprintk_ctx("multiple namespaces are not supported\n");
-+ break;
-+ }
-+ done++;
-+ err = restore_one_namespace(sec+sbuf.cpt_hdrlen, sec+sbuf.cpt_next, ctx);
-+ if (err)
-+ return err;
-+ sec += sbuf.cpt_next;
-+ }
-+
-+ return 0;
-+}
-+
-+int rst_stray_files(struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ loff_t sec = ctx->sections[CPT_SECT_FILES];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_FILES || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ struct cpt_object_hdr sbuf;
-+ cpt_object_t *obj;
-+
-+ err = _rst_get_object(CPT_OBJ_FILE, sec, &sbuf, sizeof(sbuf), ctx);
-+ if (err)
-+ break;
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_FILE, sec, ctx);
-+ if (!obj) {
-+ struct file *file;
-+
-+ dprintk_ctx("stray file %Ld\n", sec);
-+
-+ file = rst_sysv_shm(sec, ctx);
-+
-+ if (IS_ERR(file)) {
-+ eprintk_ctx("rst_stray_files: %ld\n", PTR_ERR(file));
-+ return PTR_ERR(file);
-+ } else {
-+ fput(file);
-+ }
-+ }
-+ sec += sbuf.cpt_next;
-+ }
-+
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_i386.S linux-2.6.9-ve023stab030/kernel/cpt/rst_i386.S
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_i386.S 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_i386.S 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,41 @@
-+#define ASSEMBLY 1
-+
-+#include <linux/config.h>
-+#include <linux/linkage.h>
-+#include <asm/thread_info.h>
-+#include <asm/asm_offsets.h>
-+#include <asm/errno.h>
-+#include <asm/segment.h>
-+#include <asm/page.h>
-+#include <asm/smp.h>
-+#include <asm/page.h>
-+
-+ .section .text
-+ .align 4
-+ .global ret_last_siginfo
-+ret_last_siginfo:
-+ call rlsi
-+ movl %eax,%esp
-+ ret
-+
-+ .align 8
-+ .global ret_child_tid
-+ret_child_tid:
-+ push %esp
-+ call rct
-+ movl %eax,%esp
-+ ret
-+
-+ .align 4
-+ .global ret_from_rst
-+ret_from_rst:
-+ pushl %eax
-+ jmp ret_from_fork+6
-+
-+ .align 4
-+ .global pre_ret_from_fork
-+pre_ret_from_fork:
-+ pushl %eax
-+ call schedule_tail
-+ popl %eax
-+ ret
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_iterative.c linux-2.6.9-ve023stab030/kernel/cpt/rst_iterative.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_iterative.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_iterative.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,469 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/hugetlb.h>
-+#include <linux/errno.h>
-+#include <linux/ve.h>
-+#include <linux/ve_proto.h>
-+#include <linux/pagemap.h>
-+#include <linux/rmap.h>
-+#include <linux/uio.h>
-+#include <asm/ldt.h>
-+#include <asm/mmu.h>
-+#include <asm/tlb.h>
-+#include <linux/swapops.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_pagein.h"
-+
-+/* TODO:
-+ * 1. Error handling and recovery
-+ */
-+
-+struct swp_node
-+{
-+ swp_entry_t ent;
-+ struct anon_vma *anon;
-+};
-+
-+#define PFN_PER_PAGE (PAGE_SIZE/sizeof(struct swp_node))
-+
-+#define ITERDIR_SIZE (16*PAGE_SIZE)
-+
-+struct swp_node * lookup_pfn(u64 pfn, cpt_context_t *ctx)
-+{
-+ struct swp_node **dir = ctx->iter_dir;
-+ struct swp_node *pd;
-+
-+ if (pfn/PFN_PER_PAGE > ITERDIR_SIZE/sizeof(void*))
-+ return NULL;
-+
-+ if (dir == NULL)
-+ return NULL;
-+
-+ pd = dir[pfn/PFN_PER_PAGE];
-+ if (pd == NULL)
-+ return NULL;
-+
-+ pd += pfn%PFN_PER_PAGE;
-+ return pd->ent.val ? pd : NULL;
-+}
-+
-+int alloc_pfn(u64 pfn, swp_entry_t ent, cpt_context_t *ctx)
-+{
-+ struct swp_node **dir = ctx->iter_dir;
-+
-+ if (pfn/PFN_PER_PAGE > ITERDIR_SIZE/sizeof(void*))
-+ return -EINVAL;
-+
-+ if (dir == NULL) {
-+ ctx->iter_dir = vmalloc(ITERDIR_SIZE);
-+ if (ctx->iter_dir == NULL)
-+ return -ENOMEM;
-+ memset(ctx->iter_dir, 0, ITERDIR_SIZE);
-+ dir = ctx->iter_dir;
-+ }
-+
-+ if (unlikely(dir[pfn/PFN_PER_PAGE] == NULL)) {
-+ dir[pfn/PFN_PER_PAGE] = (void*)__get_free_page(GFP_KERNEL);
-+ if (dir[pfn/PFN_PER_PAGE] == NULL)
-+ return -ENOMEM;
-+ memset(dir[pfn/PFN_PER_PAGE], 0, PAGE_SIZE);
-+ }
-+
-+ dir[pfn/PFN_PER_PAGE][pfn%PFN_PER_PAGE].ent = ent;
-+ dir[pfn/PFN_PER_PAGE][pfn%PFN_PER_PAGE].anon = NULL;
-+ return 0;
-+}
-+
-+static int iter_clone(struct mm_struct * mm,
-+ unsigned long addr,
-+ struct page *src_page,
-+ cpt_context_t * ctx)
-+{
-+ int err;
-+ struct page *page;
-+ void *dst, *src;
-+
-+ err = get_user_pages(current, mm, addr,
-+ 1, 1, 1, &page, NULL);
-+ if (err == 0)
-+ err = -EFAULT;
-+ if (err < 0) {
-+ eprintk_ctx("iter_clone: get_user_pages: %d\n", err);
-+ return err;
-+ }
-+
-+ dst = kmap(page);
-+ src = kmap(src_page);
-+ memcpy(dst, src, PAGE_SIZE);
-+ kunmap(src_page);
-+ kunmap(page);
-+
-+ page_cache_release(page);
-+ return 0;
-+}
-+
-+int rst_iter(struct vm_area_struct *vma, u64 pfn,
-+ unsigned long addr, cpt_context_t * ctx)
-+{
-+ int err = -EFAULT;
-+ struct mm_struct *mm = vma->vm_mm;
-+ pgd_t *pgd;
-+ pmd_t *pmd;
-+ pte_t *pte;
-+ struct swp_node *swn;
-+
-+ swn = lookup_pfn(pfn, ctx);
-+ if (swn == NULL) {
-+ eprintk_ctx("rst_iter: missing pfn\n");
-+ return -EINVAL;
-+ }
-+
-+ if (swn->anon && swn->anon != vma->anon_vma) {
-+ struct page * page;
-+ spin_unlock(&mm->page_table_lock);
-+ err = -ENOMEM;
-+ page = read_swap_cache_async(swn->ent, vma, addr);
-+ if (page) {
-+ err = -EIO;
-+ wait_on_page_locked(page);
-+ if (PageUptodate(page))
-+ err = iter_clone(mm, addr, page, ctx);
-+ page_cache_release(page);
-+ }
-+ spin_lock(&mm->page_table_lock);
-+ wprintk("cloning iter page due to anon vma mismatch %d\n", err);
-+ return err;
-+ }
-+
-+ pgd = pgd_offset(mm, addr);
-+ if (unlikely(pgd_bad(*pgd)))
-+ return -EINVAL;
-+
-+ pmd = pmd_alloc(mm, pgd, addr);
-+ if (unlikely(!pmd))
-+ return -ENOMEM;
-+
-+ pte = pte_alloc_map(mm, pmd, addr);
-+ if (unlikely(!pte))
-+ return -ENOMEM;
-+
-+ if (pte_none(*pte)) {
-+ if (!swap_duplicate(swn->ent))
-+ BUG();
-+ set_pte(pte, swp_entry_to_pte(swn->ent));
-+ swn->anon = vma->anon_vma;
-+ err = 0;
-+ } else {
-+ eprintk_ctx("rst_iter for populated pte: 0x%lx %Lx\n", addr, pfn);
-+ }
-+ pte_unmap(pte);
-+
-+ return err;
-+}
-+
-+static int nread(struct file *file, char *buf, int len)
-+{
-+ int offset = 0;
-+
-+ while (offset < len) {
-+ int res;
-+ mm_segment_t oldfs;
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ res = vfs_read(file, buf+offset, len-offset, &file->f_pos);
-+ set_fs(oldfs);
-+ if (res < 0)
-+ return res;
-+ if (res == 0)
-+ return -EIO;
-+ offset += res;
-+ }
-+ return 0;
-+}
-+
-+
-+static struct page *dontread_swap_cache(swp_entry_t entry, struct file *file)
-+{
-+ struct page *found_page, *new_page = NULL;
-+ int err = 0;
-+ void *dst;
-+
-+ do {
-+ /*
-+ * First check the swap cache. Since this is normally
-+ * called after lookup_swap_cache() failed, re-calling
-+ * that would confuse statistics.
-+ */
-+ spin_lock_irq(&swapper_space.tree_lock);
-+ found_page = radix_tree_lookup(&swapper_space.page_tree,
-+ entry.val);
-+ if (found_page)
-+ page_cache_get(found_page);
-+ spin_unlock_irq(&swapper_space.tree_lock);
-+ if (found_page)
-+ break;
-+
-+ /*
-+ * Get a new page to read into from swap.
-+ */
-+ if (!new_page) {
-+ new_page = alloc_page(GFP_HIGHUSER);
-+ if (!new_page)
-+ break; /* Out of memory */
-+ }
-+
-+ err = add_to_swap_cache(new_page, entry);
-+ if (!err) {
-+ lru_cache_add_active(new_page);
-+ goto dirty_page;
-+ }
-+ } while (err != -ENOENT && err != -ENOMEM);
-+
-+ if (new_page)
-+ page_cache_release(new_page);
-+ if (found_page) {
-+ lock_page(found_page);
-+ new_page = found_page;
-+ goto dirty_page;
-+ }
-+ return NULL;
-+
-+dirty_page:
-+ dst = kmap(new_page);
-+ err = nread(file, dst, PAGE_SIZE);
-+ kunmap(new_page);
-+ SetPageDirty(new_page);
-+ SetPageUptodate(new_page);
-+ unlock_page(new_page);
-+ if (err) {
-+ page_cache_release(new_page);
-+ return NULL;
-+ }
-+ return new_page;
-+}
-+
-+extern int __add_to_swap_cache(struct page *page,
-+ swp_entry_t entry, int gfp_mask);
-+
-+
-+static int add_to_swap_ub(struct page * page, struct user_beancounter *ub)
-+{
-+ swp_entry_t entry;
-+ int pf_flags;
-+ int err;
-+
-+ if (!PageLocked(page))
-+ BUG();
-+
-+ for (;;) {
-+ entry = get_swap_page(ub);
-+ if (!entry.val)
-+ return 0;
-+
-+ /* Radix-tree node allocations are performing
-+ * GFP_ATOMIC allocations under PF_MEMALLOC.
-+ * They can completely exhaust the page allocator.
-+ *
-+ * So PF_MEMALLOC is dropped here. This causes the slab
-+ * allocations to fail earlier, so radix-tree nodes will
-+ * then be allocated from the mempool reserves.
-+ *
-+ * We're still using __GFP_HIGH for radix-tree node
-+ * allocations, so some of the emergency pools are available,
-+ * just not all of them.
-+ */
-+
-+ pf_flags = current->flags;
-+ current->flags &= ~PF_MEMALLOC;
-+
-+ /*
-+ * Add it to the swap cache and mark it dirty
-+ */
-+ err = __add_to_swap_cache(page, entry, GFP_ATOMIC);
-+
-+ if (pf_flags & PF_MEMALLOC)
-+ current->flags |= PF_MEMALLOC;
-+
-+ switch (err) {
-+ case 0: /* Success */
-+ SetPageUptodate(page);
-+ SetPageDirty(page);
-+ return 1;
-+ case -EEXIST:
-+ /* Raced with "speculative" read_swap_cache_async */
-+ swap_free(entry);
-+ continue;
-+ default:
-+ /* -ENOMEM radix-tree allocation failure */
-+ swap_free(entry);
-+ return 0;
-+ }
-+ }
-+}
-+
-+
-+int rst_iteration(cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ struct file * file = ctx->pagein_file_in;
-+ mm_segment_t oldfs;
-+ struct user_beancounter *ub;
-+
-+ if (file == NULL || ctx->pagein_file_out == NULL)
-+ return -EBADF;
-+
-+ ub = ctx->iter_ub;
-+ if (ub == NULL) {
-+ if (ctx->ve_id == 0) {
-+ ub = get_beancounter(mm_ub(&init_mm));
-+ } else {
-+ ub = get_beancounter_byuid(ctx->ve_id, 1);
-+ err = -ENOMEM;
-+ if (ub == NULL)
-+ goto out;
-+ }
-+ ctx->iter_ub = ub;
-+ }
-+ get_beancounter(ub);
-+
-+ for (;;) {
-+ struct swp_node * swn;
-+ swp_entry_t ent;
-+ void *dst;
-+ struct page * page;
-+ struct pgin_reply rep;
-+
-+ err = nread(file, (void*)&rep, sizeof(rep));
-+ if (err)
-+ break;
-+
-+ if (rep.rmid != PGIN_RMID) {
-+ err = -EINVAL;
-+ eprintk_ctx("iter stream corrupt\n");
-+ break;
-+ }
-+
-+ if (rep.handle == 0) {
-+ switch (rep.error) {
-+ case ITER_PASS:
-+ continue;
-+ case ITER_STOP:
-+ break;
-+ default:
-+ eprintk_ctx("iter stream corrupt: unknown control code %d\n", rep.error);
-+ err = -EINVAL;
-+ }
-+ break;
-+ }
-+
-+ err = -ENOMEM;
-+
-+ swn = lookup_pfn(rep.handle, ctx);
-+ if (swn) {
-+ page = dontread_swap_cache(swn->ent, file);
-+ if (page == NULL)
-+ break;
-+ page_cache_release(page);
-+ continue;
-+ }
-+
-+ if (nr_swap_pages*4 < total_swap_pages)
-+ break;
-+
-+ page = alloc_page(GFP_HIGHUSER);
-+ if (page == NULL)
-+ break;
-+
-+ dst = kmap(page);
-+ err = nread(file, dst, PAGE_SIZE);
-+ kunmap(page);
-+
-+ if (err) {
-+ page_cache_release(page);
-+ break;
-+ }
-+
-+ ent.val = 0;
-+ lock_page(page);
-+ if (add_to_swap_ub(page, ub))
-+ ent.val = page->private;
-+ unlock_page(page);
-+ page_cache_release(page);
-+ err = -ENOMEM;
-+ if (ent.val == 0)
-+ break;
-+
-+ err = alloc_pfn(rep.handle, ent, ctx);
-+ if (err)
-+ break;
-+
-+ swap_duplicate(ent);
-+ }
-+ put_beancounter(ub);
-+
-+out:
-+ if (!err) {
-+ struct pgin_request req;
-+ req.rmid = PGIN_RMID;
-+ req.size = PGIN_STOP;
-+ req.index = 0;
-+ req.handle = 0;
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = vfs_write(ctx->pagein_file_out, (void*)&req, sizeof(req),
-+ &ctx->pagein_file_out->f_pos);
-+ set_fs(oldfs);
-+ if (err != sizeof(req)) {
-+ if (err >= 0)
-+ err = -EIO;
-+ } else {
-+ err = 0;
-+ }
-+ }
-+ if (err) {
-+ fput(ctx->pagein_file_out);
-+ ctx->pagein_file_out = NULL;
-+ fput(ctx->pagein_file_in);
-+ ctx->pagein_file_in = NULL;
-+ rst_drop_iter_dir(ctx);
-+ }
-+ return err;
-+}
-+
-+void rst_drop_iter_dir(cpt_context_t *ctx)
-+{
-+ int i, k;
-+
-+ if (ctx->iter_dir == NULL)
-+ goto free_ub;
-+
-+ for (i=0; i<ITERDIR_SIZE/sizeof(void*); i++) {
-+ struct swp_node **dir = ctx->iter_dir;
-+ if (dir[i]) {
-+ for (k=0; k<PFN_PER_PAGE; k++) {
-+ swp_entry_t ent = dir[i][k].ent;
-+ if (ent.val)
-+ free_swap_and_cache(ent);
-+ }
-+ free_page((unsigned long)dir[i]);
-+ }
-+ }
-+
-+ vfree(ctx->iter_dir);
-+ ctx->iter_dir = NULL;
-+
-+free_ub:
-+ if (ctx->iter_ub) {
-+ put_beancounter(ctx->iter_ub);
-+ ctx->iter_ub = NULL;
-+ }
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_mm.c linux-2.6.9-ve023stab030/kernel/cpt/rst_mm.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_mm.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_mm.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1335 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/virtinfo.h>
-+#include <linux/virtinfoscp.h>
-+#include <linux/hugetlb.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/mman.h>
-+#include <linux/vmalloc.h>
-+#include <linux/rmap.h>
-+#include <linux/hash.h>
-+#include <asm/pgalloc.h>
-+#include <asm/tlb.h>
-+#include <asm/tlbflush.h>
-+#include <asm/pgtable.h>
-+#include <asm/mmu.h>
-+#include <asm/ldt.h>
-+#include <asm/desc.h>
-+#include <asm/mmu_context.h>
-+#include <linux/swapops.h>
-+#include <linux/cpt_image.h>
-+
-+#ifdef CONFIG_VE
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-+#endif
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_files.h"
-+#include "cpt_ubc.h"
-+#include "cpt_mm.h"
-+#include "cpt_kernel.h"
-+#include "cpt_pagein.h"
-+
-+#include "cpt_syscalls.h"
-+
-+#define __PAGE_NX (1ULL<<63)
-+
-+static unsigned long make_prot(struct cpt_vma_image *vmai)
-+{
-+ unsigned long prot = 0;
-+
-+ if (vmai->cpt_flags&VM_READ)
-+ prot |= PROT_READ;
-+ if (vmai->cpt_flags&VM_WRITE)
-+ prot |= PROT_WRITE;
-+ if (vmai->cpt_flags&VM_EXEC)
-+ prot |= PROT_EXEC;
-+ if (vmai->cpt_flags&VM_GROWSDOWN)
-+ prot |= PROT_GROWSDOWN;
-+ if (vmai->cpt_flags&VM_GROWSUP)
-+ prot |= PROT_GROWSUP;
-+ return prot;
-+}
-+
-+static unsigned long make_flags(struct cpt_vma_image *vmai)
-+{
-+ unsigned long flags = MAP_FIXED;
-+
-+ if (vmai->cpt_flags&(VM_SHARED|VM_MAYSHARE))
-+ flags |= MAP_SHARED;
-+ else
-+ flags |= MAP_PRIVATE;
-+
-+ if (vmai->cpt_file == CPT_NULL)
-+ flags |= MAP_ANONYMOUS;
-+ if (vmai->cpt_flags&VM_GROWSDOWN)
-+ flags |= MAP_GROWSDOWN;
-+ if (vmai->cpt_flags&VM_DENYWRITE)
-+ flags |= MAP_DENYWRITE;
-+ if (vmai->cpt_flags&VM_EXECUTABLE)
-+ flags |= MAP_EXECUTABLE;
-+ if (!(vmai->cpt_flags&VM_ACCOUNT))
-+ flags |= MAP_NORESERVE;
-+ return flags;
-+}
-+
-+
-+#ifndef CONFIG_X86_64
-+static int __alloc_ldt(mm_context_t *pc, int mincount)
-+{
-+ int oldsize, newsize, i;
-+
-+ if (mincount <= pc->size)
-+ return 0;
-+ /*
-+ * LDT got larger - reallocate if necessary.
-+ */
-+ oldsize = pc->size;
-+ mincount = (mincount+511)&(~511);
-+ newsize = mincount*LDT_ENTRY_SIZE;
-+ for (i = 0; i < newsize; i += PAGE_SIZE) {
-+ int nr = i/PAGE_SIZE;
-+ BUG_ON(i >= 64*1024);
-+ if (!pc->ldt_pages[nr]) {
-+ pc->ldt_pages[nr] = alloc_page(GFP_HIGHUSER|__GFP_UBC);
-+ if (!pc->ldt_pages[nr])
-+ return -ENOMEM;
-+ clear_highpage(pc->ldt_pages[nr]);
-+ }
-+ }
-+ pc->size = mincount;
-+ return 0;
-+}
-+
-+static int do_rst_ldt(struct cpt_obj_bits *li, loff_t pos, struct cpt_context *ctx)
-+{
-+ struct mm_struct *mm = current->mm;
-+ int i;
-+ int err;
-+ int size;
-+
-+ err = __alloc_ldt(&mm->context, li->cpt_size/LDT_ENTRY_SIZE);
-+ if (err)
-+ return err;
-+
-+ size = mm->context.size*LDT_ENTRY_SIZE;
-+
-+ for (i = 0; i < size; i += PAGE_SIZE) {
-+ int nr = i / PAGE_SIZE, bytes;
-+ char *kaddr = kmap(mm->context.ldt_pages[nr]);
-+
-+ bytes = size - i;
-+ if (bytes > PAGE_SIZE)
-+ bytes = PAGE_SIZE;
-+ err = ctx->pread(kaddr, bytes, ctx, pos + li->cpt_hdrlen + i);
-+ kunmap(mm->context.ldt_pages[nr]);
-+ if (err)
-+ return err;
-+ }
-+
-+ load_LDT(&mm->context);
-+ return 0;
-+}
-+
-+#else
-+
-+static int do_rst_ldt(struct cpt_obj_bits *li, loff_t pos, struct cpt_context *ctx)
-+{
-+ struct mm_struct *mm = current->mm;
-+ int oldsize = mm->context.size;
-+ void *oldldt;
-+ void *newldt;
-+ int err;
-+
-+ if (li->cpt_size > PAGE_SIZE)
-+ newldt = vmalloc(li->cpt_size);
-+ else
-+ newldt = kmalloc(li->cpt_size, GFP_KERNEL);
-+
-+ if (!newldt)
-+ return -ENOMEM;
-+
-+ err = ctx->pread(newldt, li->cpt_size, ctx, pos + li->cpt_hdrlen);
-+ if (err)
-+ return err;
-+
-+ oldldt = mm->context.ldt;
-+ mm->context.ldt = newldt;
-+ mm->context.size = li->cpt_size/LDT_ENTRY_SIZE;
-+
-+ load_LDT(&mm->context);
-+
-+ if (oldsize) {
-+ if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
-+ vfree(oldldt);
-+ else
-+ kfree(oldldt);
-+ }
-+ return 0;
-+}
-+#endif
-+
-+static int
-+restore_aio_ring(struct kioctx *aio_ctx, struct cpt_aio_ctx_image *aimg)
-+{
-+ struct aio_ring_info *info = &aio_ctx->ring_info;
-+ unsigned nr_events = aio_ctx->max_reqs;
-+ unsigned long size;
-+ int nr_pages;
-+
-+ /* We recalculate parameters of the ring exactly like
-+ * fs/aio.c does and then compare calculated values
-+ * with ones, stored in dump. They must be the same. */
-+
-+ nr_events += 2;
-+
-+ size = sizeof(struct aio_ring);
-+ size += sizeof(struct io_event) * nr_events;
-+ nr_pages = (size + PAGE_SIZE-1) >> PAGE_SHIFT;
-+
-+ if (nr_pages != aimg->cpt_ring_pages)
-+ return -EINVAL;
-+
-+ info->nr_pages = nr_pages;
-+
-+ nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
-+
-+ if (nr_events != aimg->cpt_nr)
-+ return -EINVAL;
-+
-+ info->nr = 0;
-+ info->ring_pages = info->internal_pages;
-+ if (nr_pages > AIO_RING_PAGES) {
-+ info->ring_pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL);
-+ if (!info->ring_pages)
-+ return -ENOMEM;
-+ memset(info->ring_pages, 0, sizeof(struct page *) * nr_pages);
-+ }
-+
-+ info->mmap_size = nr_pages * PAGE_SIZE;
-+
-+ down_read(&current->mm->mmap_sem);
-+ info->mmap_base = aimg->cpt_mmap_base;
-+ info->nr_pages = get_user_pages(current, current->mm,
-+ info->mmap_base, nr_pages,
-+ 1, 0, info->ring_pages, NULL);
-+ up_read(&current->mm->mmap_sem);
-+
-+ if (unlikely(info->nr_pages != nr_pages)) {
-+ int i;
-+
-+ for (i=0; i<info->nr_pages; i++)
-+ put_page(info->ring_pages[i]);
-+ if (info->ring_pages && info->ring_pages != info->internal_pages)
-+ kfree(info->ring_pages);
-+ return -EFAULT;
-+ }
-+
-+ aio_ctx->user_id = info->mmap_base;
-+
-+ info->nr = nr_events;
-+ info->tail = aimg->cpt_tail;
-+
-+ return 0;
-+}
-+
-+static int do_rst_aio(struct cpt_aio_ctx_image *aimg, loff_t pos, cpt_context_t *ctx)
-+{
-+ int err;
-+ struct kioctx *aio_ctx;
-+
-+ aio_ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL);
-+ if (!aio_ctx)
-+ return -ENOMEM;
-+
-+ memset(aio_ctx, 0, sizeof(*aio_ctx));
-+ aio_ctx->max_reqs = aimg->cpt_max_reqs;
-+
-+ if ((err = restore_aio_ring(aio_ctx, aimg)) < 0) {
-+ kmem_cache_free(kioctx_cachep, aio_ctx);
-+ eprintk_ctx("AIO %Ld restore_aio_ring: %d\n", pos, err);
-+ return err;
-+ }
-+
-+ aio_ctx->mm = current->mm;
-+ atomic_inc(&aio_ctx->mm->mm_count);
-+ atomic_set(&aio_ctx->users, 1);
-+ spin_lock_init(&aio_ctx->ctx_lock);
-+ spin_lock_init(&aio_ctx->ring_info.ring_lock);
-+ init_waitqueue_head(&aio_ctx->wait);
-+ INIT_LIST_HEAD(&aio_ctx->active_reqs);
-+ INIT_LIST_HEAD(&aio_ctx->run_list);
-+ INIT_WORK(&aio_ctx->wq, aio_kick_handler, ctx);
-+
-+ atomic_add(aio_ctx->max_reqs, &aio_nr);
-+
-+ write_lock(&aio_ctx->mm->ioctx_list_lock);
-+ aio_ctx->next = aio_ctx->mm->ioctx_list;
-+ aio_ctx->mm->ioctx_list = aio_ctx;
-+ write_unlock(&aio_ctx->mm->ioctx_list_lock);
-+
-+ return 0;
-+}
-+
-+static int rst_pagein(struct vm_area_struct *vma, u32 idx,
-+ unsigned long addr, cpt_context_t * ctx)
-+{
-+ int err = -EFAULT;
-+ struct mm_struct *mm = vma->vm_mm;
-+ pgd_t *pgd;
-+ pmd_t *pmd;
-+ pte_t *pte;
-+
-+ pgd = pgd_offset(mm, addr);
-+ if (unlikely(pgd_bad(*pgd)))
-+ return -EINVAL;
-+
-+ pmd = pmd_alloc(mm, pgd, addr);
-+ if (unlikely(!pmd))
-+ return -ENOMEM;
-+
-+ pte = pte_alloc_map(mm, pmd, addr);
-+ if (unlikely(!pte))
-+ return -ENOMEM;
-+
-+ if (pte_none(*pte)) {
-+ swp_entry_t entry;
-+ swap_list_lock();
-+ swap_device_lock(ctx->pgin_swp);
-+ if (ctx->pgin_swp->swap_map[idx+1]++ == 0) {
-+ ctx->pgin_swp->inuse_pages++;
-+ nr_swap_pages--;
-+ }
-+#if CONFIG_USER_SWAP_ACCOUNTING
-+ if (ctx->pgin_swp->owner_map[idx+1] == NULL) {
-+ struct user_beancounter *ub = mm_ub(mm);
-+ ub_swapentry_inc(ub);
-+ ctx->pgin_swp->owner_map[idx+1] = get_beancounter(ub);
-+ }
-+#endif
-+ swap_device_unlock(ctx->pgin_swp);
-+ swap_list_unlock();
-+ entry = swp_entry(ctx->lazytype, idx+1);
-+ set_pte(pte, swp_entry_to_pte(entry));
-+ err = 0;
-+ } else {
-+ eprintk_ctx("rst_pagein for populated pte: 0x%lx %u\n", addr, idx);
-+ }
-+ pte_unmap(pte);
-+
-+ return err;
-+}
-+
-+struct anonvma_map
-+{
-+ struct hlist_node list;
-+ struct anon_vma *avma;
-+ __u64 id;
-+};
-+
-+static int verify_create_anonvma(struct mm_struct *mm,
-+ struct cpt_vma_image *vmai,
-+ cpt_context_t *ctx)
-+{
-+ struct anon_vma *avma = NULL;
-+ struct anon_vma *new_avma;
-+ struct vm_area_struct *vma;
-+ int h;
-+
-+ if (!ctx->anonvmas) {
-+ if (CPT_ANONVMA_HSIZE*sizeof(struct hlist_head) > PAGE_SIZE)
-+ return -EINVAL;
-+ if ((ctx->anonvmas = (void*)__get_free_page(GFP_KERNEL)) == NULL)
-+ return -ENOMEM;
-+ for (h = 0; h < CPT_ANONVMA_HSIZE; h++)
-+ INIT_HLIST_HEAD(&ctx->anonvmas[h]);
-+ } else {
-+ struct anonvma_map *map;
-+ struct hlist_node *elem;
-+
-+ h = hash_long((unsigned long)vmai->cpt_anonvmaid, CPT_ANONVMA_HBITS);
-+ hlist_for_each_entry(map, elem, &ctx->anonvmas[h], list) {
-+ if (map->id == vmai->cpt_anonvmaid) {
-+ avma = map->avma;
-+ break;
-+ }
-+ }
-+ }
-+
-+ down_read(&mm->mmap_sem);
-+ if ((vma = find_vma(mm, vmai->cpt_start)) == NULL) {
-+ up_read(&mm->mmap_sem);
-+ return -ESRCH;
-+ }
-+ if (vma->vm_start != vmai->cpt_start) {
-+ up_read(&mm->mmap_sem);
-+ eprintk_ctx("vma start mismatch\n");
-+ return -EINVAL;
-+ }
-+ if (vma->vm_pgoff != vmai->cpt_pgoff) {
-+ dprintk_ctx("vma pgoff mismatch, fixing\n");
-+ if (vma->vm_file || (vma->vm_flags&(VM_SHARED|VM_MAYSHARE))) {
-+ eprintk_ctx("cannot fixup vma pgoff\n");
-+ up_read(&mm->mmap_sem);
-+ return -EINVAL;
-+ }
-+ vma->vm_pgoff = vmai->cpt_pgoff;
-+ }
-+
-+ if (!vma->anon_vma) {
-+ if (avma) {
-+ vma->anon_vma = avma;
-+ anon_vma_link(vma);
-+ } else {
-+ int err;
-+
-+ err = anon_vma_prepare(vma);
-+
-+ if (err) {
-+ up_read(&mm->mmap_sem);
-+ return err;
-+ }
-+ }
-+ } else {
-+ /* Note, we _can_ arrive to the situation, when two
-+ * different anonvmaid's point to one anon_vma, this happens
-+ * f.e. when mmap() merged new area to previous one and
-+ * they will share one anon_vma even if they did not on
-+ * original host.
-+ *
-+ * IT IS OK. To all that I understand, we may merge all
-+ * the anon_vma's and rmap can scan all the huge list of vmas
-+ * searching for page. It is just "suboptimal".
-+ *
-+ * Real disaster would happen, if vma already got an anon_vma
-+ * with different id. It is very rare case, kernel does the
-+ * best efforts to merge anon_vmas when some attributes are
-+ * different. In this case we will fall to copying memory.
-+ */
-+ if (avma && vma->anon_vma != avma) {
-+ up_read(&mm->mmap_sem);
-+ wprintk_ctx("anon_vma mismatch\n");
-+ return 0;
-+ }
-+ }
-+
-+ new_avma = vma->anon_vma;
-+ up_read(&mm->mmap_sem);
-+
-+ if (!avma) {
-+ struct anonvma_map *map;
-+
-+ if (!new_avma)
-+ return -EINVAL;
-+
-+ if ((map = ub_kmalloc(sizeof(*map), GFP_KERNEL)) == NULL)
-+ return -ENOMEM;
-+
-+ map->id = vmai->cpt_anonvmaid;
-+ map->avma = new_avma;
-+ h = hash_long((unsigned long)vmai->cpt_anonvmaid, CPT_ANONVMA_HBITS);
-+ hlist_add_head(&map->list, &ctx->anonvmas[h]);
-+ }
-+ return 0;
-+}
-+
-+static int copy_mm_pages(struct mm_struct *src, unsigned long start,
-+ unsigned long end)
-+{
-+ int err;
-+
-+ for (; start < end; start += PAGE_SIZE) {
-+ struct page *page;
-+ struct page *spage;
-+ void *maddr, *srcaddr;
-+
-+ err = get_user_pages(current, current->mm,
-+ start, 1, 1, 1, &page, NULL);
-+ if (err == 0)
-+ err = -EFAULT;
-+ if (err < 0)
-+ return err;
-+
-+ err = get_user_pages(current, src,
-+ start, 1, 0, 1, &spage, NULL);
-+
-+ if (err == 0)
-+ err = -EFAULT;
-+ if (err < 0) {
-+ page_cache_release(page);
-+ return err;
-+ }
-+
-+ srcaddr = kmap(spage);
-+ maddr = kmap(page);
-+ memcpy(maddr, srcaddr, PAGE_SIZE);
-+ set_page_dirty_lock(page);
-+ kunmap(page);
-+ kunmap(spage);
-+ page_cache_release(page);
-+ page_cache_release(spage);
-+ }
-+ return 0;
-+}
-+
-+static int do_rst_vma(struct cpt_vma_image *vmai, loff_t vmapos, loff_t mmpos, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ unsigned long addr;
-+ struct mm_struct *mm = current->mm;
-+ struct vm_area_struct *vma;
-+ struct file *file = NULL;
-+ unsigned long prot;
-+ int checked = 0;
-+
-+ if (vmai->cpt_type == CPT_VMA_VDSO) {
-+ if (ctx->vdso == NULL) {
-+ err = arch_setup_additional_pages(NULL, 0, vmai->cpt_start);
-+ goto out;
-+ }
-+ }
-+
-+ prot = make_prot(vmai);
-+
-+ if (vmai->cpt_file != CPT_NULL) {
-+ if (vmai->cpt_type == CPT_VMA_TYPE_0) {
-+ file = rst_file(vmai->cpt_file, -1, ctx);
-+ if (IS_ERR(file)) {
-+ eprintk_ctx("do_rst_vma: rst_file: %Ld\n", vmai->cpt_file);
-+ return PTR_ERR(file);
-+ }
-+ } else if (vmai->cpt_type == CPT_VMA_TYPE_SHM) {
-+ file = rst_sysv_shm(vmai->cpt_file, ctx);
-+ if (IS_ERR(file))
-+ return PTR_ERR(file);
-+ }
-+ }
-+
-+ down_write(&mm->mmap_sem);
-+ addr = do_mmap_pgoff(file, vmai->cpt_start,
-+ vmai->cpt_end-vmai->cpt_start,
-+ prot, make_flags(vmai),
-+ vmai->cpt_pgoff);
-+
-+ if (addr != vmai->cpt_start) {
-+ up_write(&mm->mmap_sem);
-+
-+ err = -EINVAL;
-+ if (IS_ERR((void*)addr))
-+ err = addr;
-+ goto out;
-+ }
-+
-+ vma = find_vma(mm, vmai->cpt_start);
-+ if (vma == NULL) {
-+ up_write(&mm->mmap_sem);
-+ eprintk_ctx("cannot find mmapped vma\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+
-+ /* do_mmap_pgoff() can merge new area to previous one (not to the next,
-+ * we mmap in order, the rest of mm is still unmapped). This can happen
-+ * f.e. if flags are to be adjusted later, or if we had different
-+ * anon_vma on two adjacent regions. Split it by brute force. */
-+ if (vma->vm_start != vmai->cpt_start) {
-+ dprintk_ctx("vma %Ld merged, split\n", vmapos);
-+ err = split_vma(mm, vma, (unsigned long)vmai->cpt_start, 0);
-+ if (err) {
-+ up_write(&mm->mmap_sem);
-+ eprintk_ctx("cannot split vma\n");
-+ goto out;
-+ }
-+ }
-+ up_write(&mm->mmap_sem);
-+
-+ if (vmai->cpt_anonvma && vmai->cpt_anonvmaid) {
-+ err = verify_create_anonvma(mm, vmai, ctx);
-+ if (err) {
-+ eprintk_ctx("cannot verify_create_anonvma %Ld\n", vmapos);
-+ goto out;
-+ }
-+ }
-+
-+ if (vmai->cpt_type == CPT_VMA_VDSO) {
-+ struct page *page;
-+ void *maddr;
-+
-+ err = get_user_pages(current, current->mm,
-+ (unsigned long)vmai->cpt_start,
-+ 1, 1, 1, &page, NULL);
-+ if (err == 0)
-+ err = -EFAULT;
-+ if (err < 0) {
-+ eprintk_ctx("can't get vdso: get_user_pages: %d\n", err);
-+ goto out;
-+ }
-+ err = 0;
-+ maddr = kmap(page);
-+ memcpy(maddr, ctx->vdso, PAGE_SIZE);
-+ set_page_dirty_lock(page);
-+ kunmap(page);
-+ page_cache_release(page);
-+ goto out;
-+ }
-+ if (vmai->cpt_next > vmai->cpt_hdrlen) {
-+ loff_t offset = vmapos + vmai->cpt_hdrlen;
-+
-+ do {
-+ union {
-+ struct cpt_page_block pb;
-+ struct cpt_remappage_block rpb;
-+ struct cpt_copypage_block cpb;
-+ struct cpt_lazypage_block lpb;
-+ struct cpt_iterpage_block ipb;
-+ } u;
-+ loff_t pos;
-+
-+ err = rst_get_object(-1, offset, &u, ctx);
-+ if (err) {
-+ eprintk_ctx("vma fix object: %d\n", err);
-+ goto out;
-+ }
-+ if (u.rpb.cpt_object == CPT_OBJ_REMAPPAGES) {
-+ err = sc_remap_file_pages(u.rpb.cpt_start,
-+ u.rpb.cpt_end-u.rpb.cpt_start,
-+ 0, u.rpb.cpt_pgoff, 0);
-+ if (err < 0) {
-+ eprintk_ctx("remap_file_pages: %d (%08x,%u,%u)\n", err,
-+ (__u32)u.rpb.cpt_start, (__u32)(u.rpb.cpt_end-u.rpb.cpt_start),
-+ (__u32)u.rpb.cpt_pgoff);
-+ goto out;
-+ }
-+ offset += u.rpb.cpt_next;
-+ continue;
-+ } else if (u.cpb.cpt_object == CPT_OBJ_LAZYPAGES) {
-+ addr = u.lpb.cpt_start;
-+
-+ down_read(&mm->mmap_sem);
-+ if ((vma = find_vma(mm, u.lpb.cpt_start)) == NULL) {
-+ up_read(&mm->mmap_sem);
-+ eprintk_ctx("lost vm_area_struct\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+ err = anon_vma_prepare(vma);
-+ if (err) {
-+ up_read(&mm->mmap_sem);
-+ goto out;
-+ }
-+ spin_lock(&mm->page_table_lock);
-+ while (addr < u.lpb.cpt_end) {
-+ err = rst_pagein(vma, u.lpb.cpt_index + (addr-u.lpb.cpt_start)/PAGE_SIZE,
-+ addr, ctx);
-+ if (err)
-+ break;
-+ addr += PAGE_SIZE;
-+ }
-+ spin_unlock(&mm->page_table_lock);
-+ up_read(&mm->mmap_sem);
-+ if (err)
-+ goto out;
-+ offset += u.cpb.cpt_next;
-+ continue;
-+ } else if (u.cpb.cpt_object == CPT_OBJ_COPYPAGES) {
-+ struct vm_area_struct *vma, *vma1;
-+ struct mm_struct *src;
-+ struct anon_vma *src_anon;
-+ cpt_object_t *mobj;
-+
-+ if (!vmai->cpt_anonvmaid) {
-+ err = -EINVAL;
-+ eprintk_ctx("CPT_OBJ_COPYPAGES in !anonvma\n");
-+ goto out;
-+ }
-+
-+ mobj = lookup_cpt_obj_bypos(CPT_OBJ_MM, u.cpb.cpt_source, ctx);
-+ if (!mobj) {
-+ eprintk_ctx("lost mm_struct to clone pages from\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+ src = mobj->o_obj;
-+
-+ down_read(&src->mmap_sem);
-+ src_anon = NULL;
-+ vma1 = find_vma(src, u.cpb.cpt_start);
-+ if (vma1)
-+ src_anon = vma1->anon_vma;
-+ up_read(&src->mmap_sem);
-+
-+ if (!vma1) {
-+ eprintk_ctx("lost src vm_area_struct\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+
-+ down_read(&mm->mmap_sem);
-+ if ((vma = find_vma(mm, u.cpb.cpt_start)) == NULL) {
-+ up_read(&mm->mmap_sem);
-+ eprintk_ctx("lost vm_area_struct\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+
-+ if (!src_anon ||
-+ !vma->anon_vma ||
-+ vma->anon_vma != src_anon ||
-+ vma->vm_start - vma1->vm_start !=
-+ (vma->vm_pgoff - vma1->vm_pgoff) << PAGE_SHIFT) {
-+ up_read(&mm->mmap_sem);
-+ wprintk_ctx("anon_vma mismatch in vm_area_struct %Ld\n", vmapos);
-+ err = copy_mm_pages(mobj->o_obj,
-+ u.cpb.cpt_start,
-+ u.cpb.cpt_end);
-+ } else {
-+ spin_lock(&mm->page_table_lock);
-+ err = __copy_page_range(vma, mobj->o_obj,
-+ u.cpb.cpt_start,
-+ u.cpb.cpt_end-u.cpb.cpt_start);
-+ spin_unlock(&mm->page_table_lock);
-+ up_read(&mm->mmap_sem);
-+ }
-+ if (err) {
-+ eprintk_ctx("clone_page_range: %d (%08x,%u,%ld)\n", err,
-+ (__u32)u.cpb.cpt_start, (__u32)(u.cpb.cpt_end-u.cpb.cpt_start),
-+ (long)u.cpb.cpt_source);
-+ goto out;
-+ }
-+
-+ offset += u.cpb.cpt_next;
-+ continue;
-+ } else if (u.pb.cpt_object == CPT_OBJ_ITERPAGES ||
-+ u.pb.cpt_object == CPT_OBJ_ITERYOUNGPAGES
-+ ) {
-+ u64 page_pos[16];
-+ pos = offset + sizeof(u.pb);
-+
-+ addr = u.lpb.cpt_start;
-+
-+ err = ctx->pread(&page_pos,
-+ 8*(u.lpb.cpt_end-addr)/PAGE_SIZE,
-+ ctx,
-+ pos);
-+ if (err) {
-+ eprintk_ctx("Oops\n");
-+ goto out;
-+ }
-+
-+ down_read(&mm->mmap_sem);
-+ if ((vma = find_vma(mm, u.lpb.cpt_start)) == NULL) {
-+ eprintk_ctx("lost vm_area_struct\n");
-+ err = -ESRCH;
-+ goto out;
-+ }
-+ err = anon_vma_prepare(vma);
-+ if (err) {
-+ up_read(&mm->mmap_sem);
-+ goto out;
-+ }
-+ spin_lock(&mm->page_table_lock);
-+ while (addr < u.lpb.cpt_end) {
-+ err = rst_iter(vma,
-+ page_pos[(addr-u.lpb.cpt_start)/PAGE_SIZE],
-+ addr,
-+ ctx);
-+ if (err)
-+ break;
-+ addr += PAGE_SIZE;
-+ }
-+ spin_unlock(&mm->page_table_lock);
-+ if (u.pb.cpt_object == CPT_OBJ_ITERYOUNGPAGES) {
-+ make_pages_present((unsigned long)u.lpb.cpt_start,
-+ (unsigned long)u.lpb.cpt_end);
-+ }
-+ up_read(&mm->mmap_sem);
-+ if (err)
-+ goto out;
-+ offset += u.cpb.cpt_next;
-+ continue;
-+ }
-+ if (u.pb.cpt_object != CPT_OBJ_PAGES) {
-+ eprintk_ctx("unknown vma fix object %d\n", u.pb.cpt_object);
-+ err = -EINVAL;
-+ goto out;
-+ }
-+ pos = offset + sizeof(u.pb);
-+ if (!(vmai->cpt_flags&VM_ACCOUNT) && !(prot&PROT_WRITE)) {
-+ /* I guess this is get_user_pages() messed things,
-+ * this happens f.e. when gdb inserts breakpoints.
-+ */
-+ int i;
-+ for (i=0; i<(u.pb.cpt_end-u.pb.cpt_start)/PAGE_SIZE; i++) {
-+ struct page *page;
-+ void *maddr;
-+ err = get_user_pages(current, current->mm,
-+ (unsigned long)u.pb.cpt_start + i*PAGE_SIZE,
-+ 1, 1, 1, &page, NULL);
-+ if (err == 0)
-+ err = -EFAULT;
-+ if (err < 0) {
-+ eprintk_ctx("get_user_pages: %d\n", err);
-+ goto out;
-+ }
-+ err = 0;
-+ maddr = kmap(page);
-+ if (u.pb.cpt_content == CPT_CONTENT_VOID) {
-+ memset(maddr, 0, PAGE_SIZE);
-+ } else if (u.pb.cpt_content == CPT_CONTENT_DATA) {
-+ err = ctx->pread(maddr, PAGE_SIZE,
-+ ctx, pos + i*PAGE_SIZE);
-+ if (err) {
-+ kunmap(page);
-+ goto out;
-+ }
-+ } else {
-+ err = -EINVAL;
-+ kunmap(page);
-+ goto out;
-+ }
-+ set_page_dirty_lock(page);
-+ kunmap(page);
-+ page_cache_release(page);
-+ }
-+ } else {
-+ if (!(prot&PROT_WRITE))
-+ sc_mprotect(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start, prot | PROT_WRITE);
-+ if (u.pb.cpt_content == CPT_CONTENT_VOID) {
-+ int i;
-+ for (i=0; i<(u.pb.cpt_end-u.pb.cpt_start)/sizeof(unsigned long); i++) {
-+ err = __put_user(0UL, ((unsigned long __user*)(unsigned long)u.pb.cpt_start) + i);
-+ if (err) {
-+ eprintk_ctx("__put_user 2 %d\n", err);
-+ goto out;
-+ }
-+ }
-+ } else if (u.pb.cpt_content == CPT_CONTENT_DATA) {
-+ loff_t tpos = pos;
-+ err = ctx->file->f_op->read(ctx->file, cpt_ptr_import(u.pb.cpt_start),
-+ u.pb.cpt_end-u.pb.cpt_start,
-+ &tpos);
-+ if (err != u.pb.cpt_end-u.pb.cpt_start) {
-+ if (err >= 0)
-+ err = -EIO;
-+ goto out;
-+ }
-+ } else {
-+ err = -EINVAL;
-+ goto out;
-+ }
-+ if (!(prot&PROT_WRITE))
-+ sc_mprotect(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start, prot);
-+ }
-+ err = 0;
-+ offset += u.pb.cpt_next;
-+ } while (offset < vmapos + vmai->cpt_next);
-+ }
-+
-+check:
-+ do {
-+ struct vm_area_struct *vma;
-+ down_read(&mm->mmap_sem);
-+ vma = find_vma(mm, addr);
-+ if (vma) {
-+ if ((vma->vm_flags^vmai->cpt_flags)&VM_READHINTMASK) {
-+ VM_ClearReadHint(vma);
-+ vma->vm_flags |= vmai->cpt_flags&VM_READHINTMASK;
-+ }
-+ if ((vma->vm_flags^vmai->cpt_flags)&VM_LOCKED) {
-+ dprintk_ctx("fixing up VM_LOCKED %Ld\n", vmapos);
-+ up_read(&mm->mmap_sem);
-+ if (vma->vm_flags&VM_LOCKED)
-+ err = sc_munlock(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start);
-+ else
-+ err = sc_mlock(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start);
-+ /* When mlock fails with EFAULT, it means
-+ * that it could not bring in pages.
-+ * It can happen after mlock() on unreadable
-+ * VMAs. But VMA is correctly locked,
-+ * so that this error can be ignored. */
-+ if (err == -EFAULT)
-+ err = 0;
-+ if (err)
-+ goto out;
-+ goto check;
-+ }
-+ if ((vma->vm_page_prot.pgprot^vmai->cpt_pgprot)&~__PAGE_NX)
-+ wprintk_ctx("VMA %08lx@%ld pgprot mismatch %08Lx %08Lx\n", addr, (long)vmapos,
-+ (__u64)vma->vm_page_prot.pgprot, (__u64)vmai->cpt_pgprot);
-+#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
-+ if (((vma->vm_page_prot.pgprot^vmai->cpt_pgprot)&__PAGE_NX) &&
-+ (ctx->kernel_config_flags&CPT_KERNEL_CONFIG_PAE))
-+ wprintk_ctx("VMA %08lx@%ld pgprot mismatch %08Lx %08Lx\n", addr, (long)vmapos,
-+ (__u64)vma->vm_page_prot.pgprot, (__u64)vmai->cpt_pgprot);
-+#endif
-+ if (vma->vm_flags != vmai->cpt_flags) {
-+ unsigned long x = vma->vm_flags ^ vmai->cpt_flags;
-+ if (x & VM_EXEC) {
-+ /* Crap. On i386 this is OK.
-+ * It is impossible to make via mmap/mprotect
-+ * exec.c clears VM_EXEC on stack. */
-+ vma->vm_flags &= ~VM_EXEC;
-+ } else if ((x & VM_ACCOUNT) && !checked) {
-+ checked = 1;
-+ if (!(prot&PROT_WRITE)) {
-+ up_read(&mm->mmap_sem);
-+ sc_mprotect(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start, prot | PROT_WRITE);
-+ sc_mprotect(vmai->cpt_start, vmai->cpt_end-vmai->cpt_start, prot);
-+ goto check;
-+ }
-+ wprintk_ctx("VMA %08lx@%ld flag mismatch %08x %08x\n", addr, (long)vmapos,
-+ (__u32)vma->vm_flags, (__u32)vmai->cpt_flags);
-+ } else {
-+ wprintk_ctx("VMA %08lx@%ld flag mismatch %08x %08x\n", addr, (long)vmapos,
-+ (__u32)vma->vm_flags, (__u32)vmai->cpt_flags);
-+ }
-+ }
-+ } else {
-+ wprintk_ctx("no VMA for %08lx@%ld\n", addr, (long)vmapos);
-+ }
-+ up_read(&mm->mmap_sem);
-+ } while (0);
-+
-+out:
-+ if (file)
-+ fput(file);
-+ return err;
-+}
-+
-+static int do_rst_mm(struct cpt_mm_image *vmi, loff_t pos, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ unsigned int def_flags;
-+ struct mm_struct *mm = current->mm;
-+ struct user_beancounter *bc;
-+
-+ down_write(&mm->mmap_sem);
-+ do_munmap(mm, 0, TASK_SIZE);
-+
-+ /*
-+ * MM beancounter is usually correct from the fork time,
-+ * but not for init, for example.
-+ * Luckily, mm_ub can be changed for a completely empty MM.
-+ */
-+ bc = rst_lookup_ubc(vmi->cpt_mmub, ctx);
-+ err = virtinfo_notifier_call(VITYPE_SCP, VIRTINFO_SCP_RSTMM, bc);
-+ if (err & NOTIFY_FAIL) {
-+ up_write(&mm->mmap_sem);
-+ return -ECHRNG;
-+ }
-+ if ((err & VIRTNOTIFY_CHANGE) && bc != mm_ub(mm)) {
-+ struct user_beancounter *old_bc = mm_ub(mm);
-+ mm_ub(mm) = bc;
-+ bc = old_bc;
-+ }
-+ err = 0;
-+ put_beancounter(bc);
-+
-+ mm->start_code = vmi->cpt_start_code;
-+ mm->end_code = vmi->cpt_end_code;
-+ mm->start_data = vmi->cpt_start_data;
-+ mm->end_data = vmi->cpt_end_data;
-+ mm->start_brk = vmi->cpt_start_brk;
-+ mm->brk = vmi->cpt_brk;
-+ mm->start_stack = vmi->cpt_start_stack;
-+ mm->arg_start = vmi->cpt_start_arg;
-+ mm->arg_end = vmi->cpt_end_arg;
-+ mm->env_start = vmi->cpt_start_env;
-+ mm->env_end = vmi->cpt_end_env;
-+ mm->def_flags = 0;
-+ def_flags = vmi->cpt_def_flags;
-+
-+ mm->dumpable = vmi->cpt_dumpable;
-+ mm->vps_dumpable = vmi->cpt_vps_dumpable;
-+ if (ctx->image_version >= CPT_VERSION_9) {
-+ mm->context.vdso = cpt_ptr_import(vmi->cpt_vdso);
-+ current_thread_info()->sysenter_return = SYSEXIT_RETURN;
-+ }
-+
-+#if 0 /* def CONFIG_HUGETLB_PAGE*/
-+/* NB: ? */
-+ int used_hugetlb;
-+#endif
-+ up_write(&mm->mmap_sem);
-+
-+ if (vmi->cpt_next > vmi->cpt_hdrlen) {
-+ loff_t offset = pos + vmi->cpt_hdrlen;
-+ do {
-+ union {
-+ struct cpt_vma_image vmai;
-+ struct cpt_aio_ctx_image aioi;
-+ struct cpt_obj_bits bits;
-+ } u;
-+ err = rst_get_object(-1, offset, &u, ctx);
-+ if (err)
-+ goto out;
-+ if (u.vmai.cpt_object == CPT_OBJ_VMA) {
-+ err = do_rst_vma(&u.vmai, offset, pos, ctx);
-+ if (err)
-+ goto out;
-+ } else if (u.bits.cpt_object == CPT_OBJ_BITS &&
-+ u.bits.cpt_content == CPT_CONTENT_MM_CONTEXT) {
-+ err = do_rst_ldt(&u.bits, offset, ctx);
-+ if (err)
-+ goto out;
-+ } else if (u.aioi.cpt_object == CPT_OBJ_AIO_CONTEXT) {
-+ err = do_rst_aio(&u.aioi, offset, ctx);
-+ if (err)
-+ goto out;
-+ } else {
-+ eprintk_ctx("unknown object %u in mm image\n", u.vmai.cpt_object);
-+ err = -EINVAL;
-+ goto out;
-+ }
-+ offset += u.vmai.cpt_next;
-+ } while (offset < pos + vmi->cpt_next);
-+ }
-+
-+ down_write(&mm->mmap_sem);
-+ mm->def_flags = def_flags;
-+ up_write(&mm->mmap_sem);
-+
-+
-+out:
-+ return err;
-+}
-+
-+int rst_mm_complete(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ cpt_object_t *mobj;
-+ void *tmp = (void*)__get_free_page(GFP_KERNEL);
-+ struct cpt_mm_image *vmi = (struct cpt_mm_image *)tmp;
-+
-+ if (!tmp)
-+ return -ENOMEM;
-+
-+ if (ti->cpt_mm == CPT_NULL) {
-+ if (current->mm) {
-+ virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_EXIT,
-+ current);
-+ exit_mm(current);
-+ }
-+ goto out;
-+ }
-+
-+ mobj = lookup_cpt_obj_bypos(CPT_OBJ_MM, ti->cpt_mm, ctx);
-+ if (mobj) {
-+ if (current->mm != mobj->o_obj) BUG();
-+ goto out;
-+ }
-+
-+ if (current->mm == NULL) {
-+ struct mm_struct *mm = mm_alloc();
-+ if (mm == NULL) {
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+ err = init_new_context(current, mm);
-+ if (err) {
-+ mmdrop(mm);
-+ goto out;
-+ }
-+ current->mm = mm;
-+ }
-+
-+ if ((err = rst_get_object(CPT_OBJ_MM, ti->cpt_mm, vmi, ctx)) != 0)
-+ goto out;
-+ if ((err = do_rst_mm(vmi, ti->cpt_mm, ctx)) != 0) {
-+ eprintk_ctx("do_rst_mm %Ld\n", ti->cpt_mm);
-+ goto out;
-+ }
-+ err = -ENOMEM;
-+ mobj = cpt_object_add(CPT_OBJ_MM, current->mm, ctx);
-+ if (mobj != NULL) {
-+ err = 0;
-+ cpt_obj_setpos(mobj, ti->cpt_mm, ctx);
-+ }
-+
-+out:
-+ if (tmp)
-+ free_page((unsigned long)tmp);
-+ return err;
-+}
-+
-+/* This is part of mm setup, made in parent context. Mostly, it is the place,
-+ * where we graft mm of another process to child.
-+ */
-+
-+int rst_mm_basic(cpt_object_t *obj, struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ task_t *tsk = obj->o_obj;
-+ cpt_object_t *mobj;
-+
-+ /* Task without mm. Just get rid of this. */
-+ if (ti->cpt_mm == CPT_NULL) {
-+ if (tsk->mm) {
-+ virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_EXIT,
-+ tsk);
-+ mmput(tsk->mm);
-+ tsk->mm = NULL;
-+ }
-+ return 0;
-+ }
-+
-+ mobj = lookup_cpt_obj_bypos(CPT_OBJ_MM, ti->cpt_mm, ctx);
-+ if (mobj) {
-+ struct mm_struct *newmm = mobj->o_obj;
-+ /* Good, the MM is already created. */
-+ if (newmm == tsk->mm) {
-+ /* Already done by clone(). */
-+ return 0;
-+ }
-+ mmput(tsk->mm);
-+ atomic_inc(&newmm->mm_users);
-+ tsk->mm = newmm;
-+ tsk->active_mm = newmm;
-+ }
-+ return 0;
-+}
-+
-+/* We use CLONE_VM when mm of child is going to be shared with parent.
-+ * Otherwise mm is copied.
-+ */
-+
-+__u32 rst_mm_flag(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ if (ti->cpt_mm == CPT_NULL ||
-+ lookup_cpt_obj_bypos(CPT_OBJ_MM, ti->cpt_mm, ctx))
-+ return CLONE_VM;
-+ return 0;
-+}
-+
-+static void unuse_ahead(swp_entry_t entry)
-+{
-+ int i, num;
-+ struct page *new_page;
-+ unsigned long offset, toff;
-+ struct swap_info_struct *swapdev = swp_type(entry) + swap_info;
-+
-+ i = 16;
-+ num = 0;
-+
-+ toff = swp_offset(entry);
-+ BUG_ON(!toff);
-+ offset = toff;
-+
-+ swap_device_lock(swapdev);
-+ do {
-+ /* Don't read-ahead past the end of the swap area */
-+ if (toff >= swapdev->max)
-+ break;
-+ /* Don't read in free or bad pages */
-+ if (!swapdev->swap_map[toff])
-+ break;
-+ if (swapdev->swap_map[toff] == SWAP_MAP_BAD)
-+ break;
-+ toff++;
-+ num++;
-+ } while (--i);
-+ swap_device_unlock(swapdev);
-+
-+ for (i = 0; i < num; offset++, i++) {
-+ /* Ok, do the async read-ahead now */
-+ new_page = read_swap_cache_async(swp_entry(swp_type(entry),
-+ offset), NULL, 0);
-+ if (!new_page)
-+ break;
-+ page_cache_release(new_page);
-+ }
-+ /* Is this necessary? */
-+ lru_add_drain(); /* Push any new pages onto the LRU now */
-+}
-+
-+static int swapoff_pmd(struct vm_area_struct * vma, pmd_t *dir,
-+ unsigned long address, unsigned long size, unsigned long offset,
-+ cpt_context_t *ctx)
-+{
-+ int err;
-+ pte_t * pte;
-+ unsigned long end;
-+
-+ if (pmd_none(*dir))
-+ return 0;
-+ if (pmd_bad(*dir)) {
-+ pmd_ERROR(*dir);
-+ pmd_clear(dir);
-+ return 0;
-+ }
-+ pte = pte_offset_map(dir, address);
-+ offset += address & PMD_MASK;
-+ address &= ~PMD_MASK;
-+ end = address + size;
-+ if (end > PMD_SIZE)
-+ end = PMD_SIZE;
-+ do {
-+ swp_entry_t swpent;
-+ if (pte_present(*pte) || pte_none(*pte))
-+ goto next;
-+ swpent = pte_to_swp_entry(*pte);
-+ if (swp_type(swpent) != ctx->lazytype)
-+ goto next;
-+ pte_unmap(pte);
-+ spin_unlock(&vma->vm_mm->page_table_lock);
-+
-+ unuse_ahead(swpent);
-+
-+ err = handle_mm_fault(vma->vm_mm, vma, offset + address, 0);
-+ if (err == VM_FAULT_SIGBUS)
-+ return -EFAULT;
-+ if (err == VM_FAULT_OOM)
-+ return -ENOMEM;
-+
-+ spin_lock(&vma->vm_mm->page_table_lock);
-+ pte = pte_offset_map(dir, offset + address);
-+next:
-+ address += PAGE_SIZE;
-+ pte++;
-+ } while (address && address < end);
-+ pte_unmap(pte - 1);
-+ return 0;
-+}
-+
-+static int swapoff_pgd(struct vm_area_struct * vma, pgd_t *dir,
-+ unsigned long address, unsigned long size, cpt_context_t *ctx)
-+{
-+ pmd_t * pmd;
-+ unsigned long offset, end;
-+
-+ if (pgd_none(*dir))
-+ return 0;
-+ if (pgd_bad(*dir)) {
-+ pgd_ERROR(*dir);
-+ pgd_clear(dir);
-+ return 0;
-+ }
-+ pmd = pmd_offset(dir, address);
-+ offset = address & PGDIR_MASK;
-+ address &= ~PGDIR_MASK;
-+ end = address + size;
-+ if (end > PGDIR_SIZE)
-+ end = PGDIR_SIZE;
-+ if (address >= end)
-+ BUG();
-+ do {
-+ int err;
-+
-+ err = swapoff_pmd(vma, pmd, address, end - address,
-+ offset, ctx);
-+ if (err)
-+ return err;
-+ address = (address + PMD_SIZE) & PMD_MASK;
-+ pmd++;
-+ } while (address && address < end);
-+ return 0;
-+}
-+
-+static int swapoff_vma(struct vm_area_struct *vma, task_t *p,
-+ cpt_context_t *ctx)
-+{
-+ pgd_t * pgd = pgd_offset(vma->vm_mm, vma->vm_start);
-+ unsigned long start = vma->vm_start, end = vma->vm_end;
-+
-+ do {
-+ int err;
-+ err = swapoff_pgd(vma, pgd, start, end - start, ctx);
-+ if (err)
-+ return err;
-+ start = (start + PGDIR_SIZE) & PGDIR_MASK;
-+ pgd++;
-+ } while (start && start < end);
-+ return 0;
-+}
-+
-+/* Scan VE task list and scan not-trivial mm to fetch lazy pages.
-+ * We do not guarantee, that all tasks will be swept, we do not guarantee
-+ * all tasks will be swept only once. Just do the best efforts. */
-+
-+int rst_swapoff(cpt_context_t *ctx)
-+{
-+ int err = 0;
-+ task_t *p, *put_it;
-+ struct ve_struct *env;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (env == NULL)
-+ return 0;
-+
-+ put_it = NULL;
-+
-+ read_lock(&tasklist_lock);
-+restart:
-+ err = 0;
-+ if (list_empty(&env->vetask_lh))
-+ goto out;
-+ p = __first_task_ve(env);
-+ for (; p != NULL; p = __next_task_ve(env, p)) {
-+ struct mm_struct *mm;
-+ struct vm_area_struct *vma;
-+
-+ if (!thread_group_leader(p))
-+ continue;
-+
-+ task_lock(p);
-+ mm = p->mm;
-+ if (mm == NULL) {
-+ task_unlock(p);
-+ continue;
-+ }
-+ atomic_inc(&mm->mm_users);
-+ task_unlock(p);
-+
-+ get_task_struct(p);
-+ read_unlock(&tasklist_lock);
-+
-+ if (put_it)
-+ put_task_struct(put_it);
-+ put_it = NULL;
-+
-+ down_read(&mm->mmap_sem);
-+ spin_lock(&mm->page_table_lock);
-+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
-+ if (is_vm_hugetlb_page(vma))
-+ continue;
-+ if (!(vma->vm_flags & VM_WRITE))
-+ continue;
-+ if (vma->vm_flags & VM_SHARED)
-+ continue;
-+ err = swapoff_vma(vma, p, ctx);
-+ if (err)
-+ break;
-+ }
-+ spin_unlock(&mm->page_table_lock);
-+ up_read(&mm->mmap_sem);
-+
-+ mmput(mm);
-+
-+ /* We are not in hurry at all. */
-+ yield();
-+
-+ read_lock(&tasklist_lock);
-+ put_it = p;
-+ if (err)
-+ break;
-+ if (p->exit_state)
-+ goto restart;
-+ }
-+out:
-+ read_unlock(&tasklist_lock);
-+
-+ if (put_it)
-+ put_task_struct(put_it);
-+
-+ put_ve(env);
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_net.c linux-2.6.9-ve023stab030/kernel/cpt/rst_net.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_net.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_net.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,425 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/netdevice.h>
-+#include <linux/inetdevice.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/ve.h>
-+#include <net/route.h>
-+#include <net/ip_fib.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_kernel.h"
-+#include "cpt_net.h"
-+
-+#include "cpt_syscalls.h"
-+
-+extern struct in_ifaddr *inet_alloc_ifa(void);
-+extern int inet_insert_ifa(struct in_ifaddr *ifa);
-+
-+int rst_restore_ifaddr(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_NET_IFADDR];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_ifaddr_image di;
-+ struct net_device *dev;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NET_IFADDR || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ int cindex = -1;
-+ int err;
-+ err = rst_get_object(CPT_OBJ_NET_IFADDR, sec, &di, ctx);
-+ if (err)
-+ return err;
-+ cindex = di.cpt_index;
-+ rtnl_lock();
-+ dev = __dev_get_by_index(cindex);
-+ if (dev && di.cpt_family == AF_INET) {
-+ struct in_device *in_dev;
-+ struct in_ifaddr *ifa;
-+ if ((in_dev = __in_dev_get(dev)) == NULL)
-+ in_dev = inetdev_init(dev);
-+ ifa = inet_alloc_ifa();
-+ if (ifa) {
-+ ifa->ifa_local = di.cpt_address[0];
-+ ifa->ifa_address = di.cpt_peer[0];
-+ ifa->ifa_broadcast = di.cpt_broadcast[0];
-+ ifa->ifa_prefixlen = di.cpt_masklen;
-+ ifa->ifa_mask = inet_make_mask(ifa->ifa_prefixlen);
-+ ifa->ifa_flags = di.cpt_flags;
-+ ifa->ifa_scope = di.cpt_scope;
-+ memcpy(ifa->ifa_label, di.cpt_label, IFNAMSIZ);
-+ in_dev_hold(in_dev);
-+ ifa->ifa_dev = in_dev;
-+ err = inet_insert_ifa(ifa);
-+ if (err)
-+ eprintk_ctx("add ifaddr err %d for %d %s\n", err, di.cpt_index, di.cpt_label);
-+ }
-+ } else {
-+ eprintk_ctx("unknown ifaddr 2 for %d\n", di.cpt_index);
-+ err = -EINVAL;
-+ }
-+ rtnl_unlock();
-+ if (err)
-+ return err;
-+ sec += di.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+static int rewrite_rtmsg(struct nlmsghdr *nlh, struct cpt_context *ctx)
-+{
-+ int min_len = NLMSG_LENGTH(sizeof(struct rtmsg));
-+ struct rtmsg *rtm = NLMSG_DATA(nlh);
-+
-+ if (nlh->nlmsg_len > min_len) {
-+ int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
-+ struct rtattr *rta = (void*)nlh + NLMSG_ALIGN(min_len);
-+
-+ while (RTA_OK(rta, attrlen)) {
-+ rta = RTA_NEXT(rta, attrlen);
-+ }
-+ }
-+ return rtm->rtm_protocol == RTPROT_KERNEL;
-+}
-+
-+int rst_restore_route(struct cpt_context *ctx)
-+{
-+ int err;
-+ struct socket *sock;
-+ struct msghdr msg;
-+ struct iovec iov;
-+ struct sockaddr_nl nladdr;
-+ mm_segment_t oldfs;
-+ loff_t sec = ctx->sections[CPT_SECT_NET_ROUTE];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_object_hdr v;
-+ char *pg;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NET_ROUTE || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ if (h.cpt_hdrlen >= h.cpt_next)
-+ return 0;
-+
-+ sec += h.cpt_hdrlen;
-+ err = rst_get_object(CPT_OBJ_NET_ROUTE, sec, &v, ctx);
-+ if (err < 0)
-+ return err;
-+
-+ err = sock_create_kern(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
-+ if (err)
-+ return err;
-+
-+ pg = (char*)__get_free_page(GFP_KERNEL);
-+ if (pg == NULL) {
-+ err = -ENOMEM;
-+ goto out_sock;
-+ }
-+
-+ memset(&nladdr, 0, sizeof(nladdr));
-+ nladdr.nl_family = AF_NETLINK;
-+
-+ endsec = sec + v.cpt_next;
-+ sec += v.cpt_hdrlen;
-+
-+ while (sec < endsec) {
-+ struct nlmsghdr *n;
-+ struct nlmsghdr nh;
-+ int kernel_flag;
-+
-+ err = ctx->pread(&nh, sizeof(nh), ctx, sec);
-+ if (err)
-+ goto out_sock_pg;
-+ if (nh.nlmsg_len > PAGE_SIZE) {
-+ err = -EINVAL;
-+ goto out_sock_pg;
-+ }
-+ err = ctx->pread(pg, nh.nlmsg_len, ctx, sec);
-+ if (err)
-+ goto out_sock_pg;
-+
-+ n = (struct nlmsghdr*)pg;
-+ n->nlmsg_flags = NLM_F_REQUEST|NLM_F_APPEND|NLM_F_CREATE;
-+
-+ err = rewrite_rtmsg(n, ctx);
-+ if (err < 0)
-+ goto out_sock_pg;
-+ kernel_flag = err;
-+
-+ iov.iov_base=n;
-+ iov.iov_len=nh.nlmsg_len;
-+ msg.msg_name=&nladdr;
-+ msg.msg_namelen=sizeof(nladdr);
-+ msg.msg_iov=&iov;
-+ msg.msg_iovlen=1;
-+ msg.msg_control=NULL;
-+ msg.msg_controllen=0;
-+ msg.msg_flags=MSG_DONTWAIT;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = sock_sendmsg(sock, &msg, nh.nlmsg_len);
-+ set_fs(oldfs);
-+
-+ if (err < 0)
-+ goto out_sock_pg;
-+ err = 0;
-+
-+ iov.iov_base=pg;
-+ iov.iov_len=PAGE_SIZE;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT);
-+ set_fs(oldfs);
-+ if (err != -EAGAIN) {
-+ if (err == NLMSG_LENGTH(sizeof(struct nlmsgerr)) &&
-+ n->nlmsg_type == NLMSG_ERROR) {
-+ struct nlmsgerr *e = NLMSG_DATA(n);
-+ if (e->error != -EEXIST || !kernel_flag)
-+ eprintk_ctx("NLMERR: %d\n", e->error);
-+ } else {
-+ eprintk_ctx("Res: %d %d\n", err, n->nlmsg_type);
-+ }
-+ }
-+ err = 0;
-+ sec += NLMSG_ALIGN(nh.nlmsg_len);
-+ }
-+
-+out_sock_pg:
-+ free_page((unsigned long)pg);
-+out_sock:
-+ sock_release(sock);
-+ return err;
-+}
-+
-+int rst_resume_network(struct cpt_context *ctx)
-+{
-+ struct ve_struct *env;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+ env->disable_net = 0;
-+ put_ve(env);
-+ return 0;
-+}
-+
-+int rst_restore_netdev(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_NET_DEVICE];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_netdev_image di;
-+ struct net_device *dev;
-+
-+ get_exec_env()->disable_net = 1;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NET_DEVICE || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ int err;
-+ struct net_device *dev_new;
-+ err = rst_get_object(CPT_OBJ_NET_DEVICE, sec, &di, ctx);
-+ if (err)
-+ return err;
-+ rtnl_lock();
-+ dev = __dev_get_by_name(di.cpt_name);
-+ if (dev) {
-+ if (dev->ifindex != di.cpt_index) {
-+ dev_new = __dev_get_by_index(di.cpt_index);
-+ if (!dev_new) {
-+ write_lock_bh(&dev_base_lock);
-+ hlist_del(&dev->index_hlist);
-+ if (dev->iflink == dev->ifindex)
-+ dev->iflink = di.cpt_index;
-+ dev->ifindex = di.cpt_index;
-+ hlist_add_head(&dev->index_hlist,
-+ dev_index_hash(dev->ifindex,
-+ get_exec_env()));
-+ write_unlock_bh(&dev_base_lock);
-+ } else {
-+ write_lock_bh(&dev_base_lock);
-+ hlist_del(&dev->index_hlist);
-+ hlist_del(&dev_new->index_hlist);
-+ if (dev_new->iflink == dev_new->ifindex)
-+ dev_new->iflink = dev->ifindex;
-+ dev_new->ifindex = dev->ifindex;
-+ if (dev->iflink == dev->ifindex)
-+ dev->iflink = di.cpt_index;
-+ dev->ifindex = di.cpt_index;
-+ hlist_add_head(&dev->index_hlist,
-+ dev_index_hash(dev->ifindex,
-+ get_exec_env()));
-+ hlist_add_head(&dev_new->index_hlist,
-+ dev_index_hash(dev_new->ifindex,
-+ get_exec_env()));
-+ write_unlock_bh(&dev_base_lock);
-+ }
-+ }
-+ if (di.cpt_flags^dev->flags) {
-+ err = dev_change_flags(dev, di.cpt_flags);
-+ if (err)
-+ eprintk_ctx("dev_change_flags err: %d\n", err);
-+ }
-+ } else {
-+ eprintk_ctx("unknown interface 2 %s\n", di.cpt_name);
-+ }
-+ rtnl_unlock();
-+ sec += di.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+static int dumpfn(void *arg)
-+{
-+ int i;
-+ int *pfd = arg;
-+ char *argv[] = { "iptables-restore", "-c", NULL };
-+
-+ if (pfd[0] != 0)
-+ sc_dup2(pfd[0], 0);
-+
-+ for (i=1; i<current->files->max_fds; i++)
-+ sc_close(i);
-+
-+ module_put(THIS_MODULE);
-+
-+ set_fs(KERNEL_DS);
-+ i = sc_execve("/sbin/iptables-restore", argv, NULL);
-+ if (i == -ENOENT)
-+ i = sc_execve("/usr/sbin/iptables-restore", argv, NULL);
-+ eprintk("failed to exec iptables-restore: %d\n", i);
-+ return -1;
-+}
-+
-+static int rst_restore_iptables(struct cpt_context * ctx)
-+{
-+ int err;
-+ int pfd[2];
-+ struct file *f;
-+ struct cpt_object_hdr v;
-+ int n;
-+ struct cpt_section_hdr h;
-+ loff_t sec = ctx->sections[CPT_SECT_NET_IPTABLES];
-+ loff_t end;
-+ int pid;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_NET_IPTABLES || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ if (h.cpt_hdrlen == h.cpt_next)
-+ return 0;
-+ if (h.cpt_hdrlen > h.cpt_next)
-+ return -EINVAL;
-+ sec += h.cpt_hdrlen;
-+ err = rst_get_object(CPT_OBJ_NAME, sec, &v, ctx);
-+ if (err < 0)
-+ return err;
-+
-+ err = sc_pipe(pfd);
-+ if (err < 0)
-+ return err;
-+ pid = err = local_kernel_thread(dumpfn, (void*)pfd, SIGCHLD, 0);
-+ if (err < 0)
-+ goto out;
-+ f = fget(pfd[1]);
-+ sc_close(pfd[1]);
-+ sc_close(pfd[0]);
-+
-+ ctx->file->f_pos = sec + v.cpt_hdrlen;
-+ end = sec + v.cpt_next;
-+ do {
-+ char *p;
-+ char buf[16];
-+ mm_segment_t oldfs;
-+
-+ n = end - ctx->file->f_pos;
-+ if (n > sizeof(buf))
-+ n = sizeof(buf);
-+
-+ if (ctx->read(buf, n, ctx))
-+ break;
-+ if ((p = memchr(buf, 0, n)) != NULL)
-+ n = p - buf;
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ f->f_op->write(f, buf, n, &f->f_pos);
-+ set_fs(oldfs);
-+ } while (ctx->file->f_pos < end);
-+
-+ fput(f);
-+
-+ clear_tsk_thread_flag(current,TIF_SIGPENDING);
-+
-+ if ((err = sc_waitx(pid, 0)) < 0)
-+ eprintk_ctx("wait4: %d\n", err);
-+
-+ return 0;
-+
-+out:
-+ if (pfd[1] >= 0)
-+ sc_close(pfd[1]);
-+ if (pfd[0] >= 0)
-+ sc_close(pfd[0]);
-+ return err;
-+}
-+
-+int rst_restore_net(struct cpt_context *ctx)
-+{
-+ int err;
-+
-+ err = rst_restore_netdev(ctx);
-+ if (!err)
-+ err = rst_restore_ifaddr(ctx);
-+ if (!err)
-+ err = rst_restore_route(ctx);
-+ if (!err)
-+ err = rst_restore_iptables(ctx);
-+ if (!err)
-+ err = rst_restore_ip_conntrack(ctx);
-+ return err;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_pagein.c linux-2.6.9-ve023stab030/kernel/cpt/rst_pagein.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_pagein.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_pagein.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,891 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/hugetlb.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/mman.h>
-+#include <linux/vmalloc.h>
-+#include <linux/major.h>
-+#include <linux/blkdev.h>
-+#include <linux/bio.h>
-+#include <asm/pgalloc.h>
-+#include <asm/tlb.h>
-+#include <asm/tlbflush.h>
-+#include <asm/pgtable.h>
-+#include <asm/mmu.h>
-+#include <asm/ldt.h>
-+#include <asm/desc.h>
-+#include <linux/swapops.h>
-+#include <linux/swap.h>
-+#include <linux/cpt_image.h>
-+
-+#ifdef CONFIG_VE
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-+#endif
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_files.h"
-+#include "cpt_mm.h"
-+#include "cpt_kernel.h"
-+#include "cpt_pagein.h"
-+
-+#include "cpt_syscalls.h"
-+
-+#define PGIN_MAJOR_MAX 254
-+#define PGIN_MAJOR_MIN 202
-+
-+#define PGIN_TIMEOUT (60*HZ)
-+#define PGIN_HEARTBEAT (60*HZ)
-+#define PGIN_IDLEWAIT (10*HZ)
-+#define PGIN_WAIT (120*HZ)
-+
-+static spinlock_t pgin_lock = SPIN_LOCK_UNLOCKED;
-+
-+struct pgin_device {
-+ int harderror;
-+ spinlock_t queue_lock;
-+ struct list_head queue_head;
-+ struct gendisk *disk;
-+ cpt_context_t *ctx;
-+ int blksize;
-+ u64 bytesize;
-+ struct completion *startup;
-+ struct completion *end;
-+ struct semaphore tx_sem;
-+ struct timer_list timer;
-+ int dead;
-+ int qlen;
-+ int npgs;
-+ long reqnum;
-+ long rtt;
-+ int rttmin;
-+ int rttmax;
-+};
-+
-+static void pgin_end_request(struct request *req)
-+{
-+ int uptodate = (req->errors == 0) ? 1 : 0;
-+ request_queue_t *q = req->q;
-+ struct pgin_device *d = req->rq_disk->private_data;
-+ unsigned long flags;
-+
-+ spin_lock_bh(&d->queue_lock);
-+ while (req->ref_count > 1) {
-+ spin_unlock_bh(&d->queue_lock);
-+ yield();
-+ spin_lock_bh(&d->queue_lock);
-+ }
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ if (!end_that_request_first(req, uptodate, req->nr_sectors))
-+ end_that_request_last(req);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+}
-+
-+int pgin_prepare_swap_signature(struct pgin_device *d, struct request *req)
-+{
-+ unsigned long pg;
-+ char *ptr;
-+ union swap_header *swh;
-+ struct bio *bio;
-+
-+ pg = __get_free_page(GFP_KERNEL);
-+ if (!pg)
-+ return -ENOMEM;
-+
-+ swh = (union swap_header *)pg;
-+ memset(swh, 0, PAGE_SIZE);
-+ memcpy(swh->magic.magic, "SWAPSPACE2", 10);
-+ swh->info.version = 1;
-+ swh->info.last_page = d->ctx->lazypages + 1;
-+ swh->info.nr_badpages = 0;
-+
-+ ptr = (char*)pg;
-+ rq_for_each_bio(bio, req) {
-+ int i;
-+ struct bio_vec *bvec;
-+ bio_for_each_segment(bvec, bio, i) {
-+ void *kaddr = kmap(bvec->bv_page);
-+ memcpy(kaddr + bvec->bv_offset, ptr, bvec->bv_len);
-+ ptr += bvec->bv_len;
-+ kunmap(bvec->bv_page);
-+ }
-+ }
-+
-+ free_page(pg);
-+ return 0;
-+}
-+
-+#if 0
-+int pgin_prepare_fake(struct pgin_device *d, struct request *req, int index)
-+{
-+ int pos = 0;
-+ struct bio *bio;
-+ cpt_context_t *ctx = d->ctx;
-+
-+ rq_for_each_bio(bio, req) {
-+ int i;
-+ struct bio_vec *bvec;
-+ bio_for_each_segment(bvec, bio, i) {
-+ int err;
-+ loff_t off;
-+ void *kaddr = kmap(bvec->bv_page);
-+ off = ctx->lazytable[index + (pos/PAGE_SIZE)].mm_id;
-+ err = ctx->pread(kaddr + bvec->bv_offset, bvec->bv_len, d->ctx, off);
-+ kunmap(bvec->bv_page);
-+ if (err) {
-+ eprintk_ctx("pgin read err %d @ %d\n", err, pos);
-+ return -EIO;
-+ }
-+ pos += bvec->bv_len;
-+ }
-+ }
-+
-+ return 1;
-+}
-+#endif
-+
-+static int nread(struct file *file, char *buf, int len)
-+{
-+ int offset = 0;
-+
-+ while (offset < len) {
-+ int res;
-+ res = vfs_read(file, buf+offset, len-offset, &file->f_pos);
-+ if (res < 0)
-+ return res;
-+ if (res == 0)
-+ return -EIO;
-+ offset += res;
-+ }
-+ return 0;
-+}
-+
-+int pgin_send_req(struct pgin_device *d, struct request *req)
-+{
-+ mm_segment_t oldfs;
-+ int result;
-+ struct pgin_request request;
-+ unsigned long size = req->nr_sectors << 9;
-+ cpt_context_t *ctx = d->ctx;
-+ struct file *file = d->ctx->pagein_file_out;
-+ int index;
-+ int npgs;
-+
-+ d->ctx->last_pagein = jiffies;
-+
-+// dprintk_ctx("pgin: sec=%lu len=%lu\n", req->sector, req->nr_sectors);
-+
-+ if (size % PAGE_SIZE) {
-+ eprintk_ctx("pgin: size %% PAGE_SIZE\n");
-+ goto error_out;
-+ }
-+
-+ npgs = size / PAGE_SIZE;
-+ d->npgs = npgs;
-+
-+ index = (req->sector << 9) / PAGE_SIZE;
-+ if (index == 0) {
-+ if (npgs != 1) {
-+ eprintk_ctx("pgin: signature npgs=%d\n", npgs);
-+ goto error_out;
-+ }
-+ if (pgin_prepare_swap_signature(d, req))
-+ goto error_out;
-+ req->errors = 0;
-+ return 1;
-+ }
-+ index--;
-+
-+ if (index + npgs > d->ctx->lazypages) {
-+ eprintk_ctx("pgin: out of range: %d %d %d\n", index, npgs, d->ctx->lazypages);
-+ dump_stack();
-+ goto error_out;
-+ }
-+
-+#if 0
-+ if (pgin_prepare_fake(d, req, index) < 0)
-+ goto error_out;
-+ req->errors = 0;
-+ return 1;
-+#endif
-+
-+ if (file == NULL) {
-+ eprintk_ctx("pagein: file == NULL\n");
-+ goto error_out;
-+ }
-+ if (d->dead) {
-+ eprintk_ctx("pagein: dead\n");
-+ goto error_out;
-+ }
-+
-+ mod_timer(&d->timer, jiffies + PGIN_HEARTBEAT);
-+
-+ request.rmid = PGIN_RMID;
-+ request.size = npgs;
-+ request.index = index;
-+ memcpy(&request.handle, &req, sizeof(req));
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ down(&d->tx_sem);
-+ result = vfs_write(file, (char*)&request, sizeof(request), &file->f_pos);
-+ up(&d->tx_sem);
-+ set_fs(oldfs);
-+
-+ if (result != sizeof(request)) {
-+ eprintk_ctx("pagein: damn %d\n", result);
-+ goto error_out;
-+ }
-+ return 0;
-+
-+error_out:
-+ req->errors++;
-+ return 0;
-+}
-+
-+static int pagein_send_start(cpt_context_t *ctx)
-+{
-+ int result;
-+ struct pgin_request request;
-+ struct pgin_reply reply;
-+ struct file *file = ctx->pagein_file_out;
-+
-+ if (file == NULL)
-+ return -ENOENT;
-+
-+ request.rmid = PGIN_RMID;
-+ request.size = PGIN_START;
-+ request.index = 0;
-+ memset(&request.handle, 0, sizeof(request.handle));
-+
-+ result = vfs_write(file, (char*)&request, sizeof(request), &file->f_pos);
-+ if (result < 0)
-+ return result;
-+ if (result != sizeof(request))
-+ return -EIO;
-+ result = nread(ctx->pagein_file_in, (char*)&reply, sizeof(reply));
-+ if (result)
-+ return result;
-+ if (reply.rmid != PGIN_RMID)
-+ return -EIO;
-+ return 0;
-+}
-+
-+static int pagein_send_stop(cpt_context_t *ctx)
-+{
-+ int result;
-+ struct pgin_request request;
-+ struct file *file = ctx->pagein_file_out;
-+
-+ if (file == NULL)
-+ return -ENOENT;
-+
-+ request.rmid = PGIN_RMID;
-+ request.size = PGIN_STOP;
-+ request.index = 0;
-+ memset(&request.handle, 0, sizeof(request.handle));
-+
-+ result = vfs_write(file, (char*)&request, sizeof(request), &file->f_pos);
-+ if (result < 0)
-+ return result;
-+
-+ return result == sizeof(request) ? 0 : -EIO;
-+}
-+
-+
-+static struct request *pgin_find_request(struct pgin_device *d, u64 *handle)
-+{
-+ struct request *req;
-+ struct request *xreq;
-+
-+ memcpy(&xreq, handle, sizeof(xreq));
-+
-+ spin_lock_bh(&d->queue_lock);
-+ list_for_each_entry(req, &d->queue_head, queuelist) {
-+ if (req != xreq)
-+ continue;
-+ list_del_init(&req->queuelist);
-+ d->qlen--;
-+ spin_unlock_bh(&d->queue_lock);
-+ return req;
-+ }
-+ spin_unlock_bh(&d->queue_lock);
-+ return NULL;
-+}
-+
-+static void pgin_flush_requests(struct pgin_device *d)
-+{
-+ struct request *req;
-+
-+again:
-+ spin_lock_bh(&d->queue_lock);
-+ list_for_each_entry(req, &d->queue_head, queuelist) {
-+ list_del_init(&req->queuelist);
-+ d->qlen--;
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ pgin_end_request(req);
-+ goto again;
-+ }
-+ spin_unlock_bh(&d->queue_lock);
-+}
-+
-+
-+static inline int nread_bvec(struct file *file, struct bio_vec *bvec)
-+{
-+ int result;
-+ void *kaddr = kmap(bvec->bv_page);
-+ result = nread(file, kaddr + bvec->bv_offset, bvec->bv_len);
-+ kunmap(bvec->bv_page);
-+ return result;
-+}
-+
-+struct request *pgin_read_stat(struct pgin_device *d)
-+{
-+ int result;
-+ int rtt;
-+ struct pgin_reply reply;
-+ struct request *req;
-+ struct bio *bio;
-+ cpt_context_t *ctx = d->ctx;
-+
-+ if (d->ctx->pagein_file_in == NULL) {
-+ result = -EINVAL;
-+ goto out;
-+ }
-+
-+ result = nread(d->ctx->pagein_file_in, (char*)&reply, sizeof(reply));
-+ /* nread was interruped by SIGKILL, so just exit */
-+ if (result == -ERESTARTSYS)
-+ goto out;
-+ if (result < 0) {
-+ eprintk_ctx("pgin_read_stat: nread: %d\n", result);
-+ goto out;
-+ }
-+// dprintk_ctx("pgin: repl\n");
-+
-+ req = pgin_find_request(d, &reply.handle);
-+ if (req == NULL) {
-+ result = -EBADR;
-+ eprintk_ctx("pgin: EBADR\n");
-+ goto out;
-+ }
-+
-+ if (reply.error) {
-+ req->errors++;
-+ eprintk_ctx("pgin: ERR\n");
-+ return req;
-+ }
-+
-+ rq_for_each_bio(bio, req) {
-+ int i;
-+ struct bio_vec *bvec;
-+ bio_for_each_segment(bvec, bio, i) {
-+ result = nread_bvec(d->ctx->pagein_file_in, bvec);
-+ if (result < 0) {
-+ eprintk_ctx("pgin_read_stat: nread_bvec: %d\n", result);
-+ goto out;
-+ }
-+ }
-+ }
-+ rtt = jiffies - req->start_time;
-+ if (!d->rtt) {
-+ d->rtt = d->rttmin = d->rttmax = rtt;
-+ d->reqnum = 1;
-+ } else {
-+ d->rtt += rtt;
-+ d->reqnum++;
-+ if (rtt < d->rttmin)
-+ d->rttmin = rtt;
-+ if (rtt > d->rttmax)
-+ d->rttmax = rtt;
-+ }
-+ return req;
-+
-+out:
-+ d->harderror = result;
-+ return NULL;
-+}
-+
-+static void do_pgin_request(request_queue_t * q)
-+{
-+ struct request *req;
-+
-+ while ((req = elv_next_request(q)) != NULL) {
-+ struct pgin_device *d;
-+ cpt_context_t *ctx;
-+
-+ blkdev_dequeue_request(req);
-+
-+ d = req->rq_disk->private_data;
-+ ctx = d->ctx;
-+
-+ if (rq_data_dir(req) == WRITE) {
-+ eprintk_ctx("Write on pgin device\n");
-+ goto error_out;
-+ }
-+
-+ req->errors = 0;
-+ spin_unlock_irq(q->queue_lock);
-+
-+ spin_lock_bh(&d->queue_lock);
-+ list_add(&req->queuelist, &d->queue_head);
-+ d->qlen++;
-+ req->ref_count++;
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ if (pgin_send_req(d, req)) {
-+ spin_lock_bh(&d->queue_lock);
-+ list_del_init(&req->queuelist);
-+ d->qlen--;
-+ req->ref_count--;
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ pgin_end_request(req);
-+
-+ spin_lock_irq(q->queue_lock);
-+ continue;
-+ }
-+
-+ if (req->errors) {
-+ spin_lock_bh(&d->queue_lock);
-+ list_del_init(&req->queuelist);
-+ req->ref_count--;
-+ d->qlen--;
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ pgin_end_request(req);
-+
-+ spin_lock_irq(q->queue_lock);
-+ continue;
-+ }
-+
-+ spin_lock_bh(&d->queue_lock);
-+ req->ref_count--;
-+ spin_unlock_bh(&d->queue_lock);
-+
-+ spin_lock_irq(q->queue_lock);
-+ continue;
-+
-+error_out:
-+ req->errors++;
-+ spin_unlock_irq(q->queue_lock);
-+
-+ pgin_end_request(req);
-+
-+ spin_lock_irq(q->queue_lock);
-+ }
-+ return;
-+}
-+
-+static struct block_device_operations pgin_fops =
-+{
-+ .owner = THIS_MODULE,
-+};
-+
-+static void heartbeat_timer(unsigned long arg)
-+{
-+ cpt_context_t *ctx = (cpt_context_t *)arg;
-+ struct pgin_device *d = ctx->pagein_dev;
-+ unsigned long oldest;
-+ struct request *req;
-+
-+ if (d->dead)
-+ return;
-+
-+ oldest = jiffies;
-+ spin_lock(&d->queue_lock);
-+ list_for_each_entry(req, &d->queue_head, queuelist) {
-+ if (time_before(req->start_time, oldest))
-+ oldest = req->start_time;
-+ }
-+ spin_unlock(&d->queue_lock);
-+
-+ if ((long)(jiffies - jiffies) > PGIN_TIMEOUT) {
-+ eprintk_ctx("Virtual memory transfer is stuck; killing VE\n");
-+
-+ d->dead = 1;
-+ if (ctx->pgin_task) {
-+ read_lock(&tasklist_lock);
-+ if (!ctx->pgin_task->exit_state)
-+ send_sig(SIGKILL, ctx->pgin_task, 1);
-+ read_unlock(&tasklist_lock);
-+ dprintk_ctx("rst: pgin alarm... ");
-+ put_task_struct(ctx->pgin_task);
-+ ctx->pgin_task = NULL;
-+ }
-+ } else {
-+ mod_timer(&d->timer, jiffies + PGIN_HEARTBEAT);
-+ }
-+}
-+
-+static int pagein_dev_init(cpt_context_t *ctx)
-+{
-+ int err = -ENOMEM;
-+ struct gendisk *disk;
-+ struct pgin_device *d;
-+
-+ d = kmalloc(sizeof(*d), GFP_KERNEL);
-+ if (d == NULL)
-+ return -ENOMEM;
-+
-+ memset(d, 0, sizeof(*d));
-+ ctx->pagein_dev = d;
-+ d->reqnum = 1;
-+
-+ disk = alloc_disk(1);
-+ if (!disk)
-+ goto out;
-+ d->disk = disk;
-+ disk->queue = blk_init_queue(do_pgin_request, &pgin_lock);
-+ if (!disk->queue)
-+ goto out;
-+#if 0
-+ /* Play with queue. We do not use this right now, but I leave
-+ * the dead chunk here to remember, what we can do if we need to.
-+ */
-+ disk->queue->unplug_thresh = 1;
-+ disk->queue->unplug_delay = 0;
-+#endif
-+
-+ disk->major = PGIN_MAJOR_MAX;
-+ while (disk->major >= PGIN_MAJOR_MIN) {
-+ err = register_blkdev(disk->major, "pgin");
-+ if (err == 0)
-+ break;
-+ disk->major--;
-+ }
-+ if (disk->major < PGIN_MAJOR_MIN) {
-+ disk->major = 0;
-+ goto out;
-+ }
-+
-+ spin_lock_init(&d->queue_lock);
-+ INIT_LIST_HEAD(&d->queue_head);
-+ d->blksize = PAGE_SIZE;
-+ d->bytesize = 0x7ffffc00ULL << 10;
-+ d->ctx = ctx;
-+ d->end = &ctx->pgin_notify;
-+ init_MUTEX(&d->tx_sem);
-+ init_timer(&d->timer);
-+ d->timer.function = heartbeat_timer;
-+ d->timer.data = (unsigned long)ctx;
-+ disk->first_minor = 0;
-+ disk->fops = &pgin_fops;
-+ disk->private_data = d;
-+ disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
-+ sprintf(disk->disk_name, "pgin%d", disk->major);
-+ set_capacity(disk, 0x7ffffc00ULL << 1);
-+ add_disk(disk);
-+
-+ return 0;
-+
-+out:
-+ if (d->disk) {
-+ if (d->disk->major)
-+ unregister_blkdev(d->disk->major, "pgin");
-+ if (d->disk->queue)
-+ blk_cleanup_queue(d->disk->queue);
-+ put_disk(d->disk);
-+ }
-+ return err;
-+}
-+
-+static void pagein_dev_cleanup(cpt_context_t *ctx)
-+{
-+ struct gendisk *disk;
-+
-+ if (ctx->pagein_dev) {
-+ disk = ctx->pagein_dev->disk;
-+ if (disk) {
-+ int major = disk->major;
-+ del_gendisk(disk);
-+ blk_cleanup_queue(disk->queue);
-+ put_disk(disk);
-+ if (major)
-+ unregister_blkdev(major, "pgin");
-+ }
-+ kfree(ctx->pagein_dev);
-+ ctx->pagein_dev = NULL;
-+ }
-+}
-+
-+static int plugin_swap(cpt_context_t * ctx)
-+{
-+ int major;
-+ int err;
-+ int type;
-+ mm_segment_t oldfs;
-+ char devname[16];
-+
-+ major = ctx->pagein_dev->disk->major;
-+ sprintf(devname, "/dev/pgin%d", major);
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+
-+ sys_unlink(devname);
-+ err = sys_mknod(devname, 0600|S_IFBLK, major<<8);
-+ if (err) {
-+ eprintk_ctx("sys_mknod %d\n", err);
-+ goto out;
-+ }
-+
-+ err = sys_swapon(devname, SWAP_FLAG_READONLY);
-+ if (err) {
-+ eprintk_ctx("sys_swapon %d\n", err);
-+ goto out;
-+ }
-+
-+ swap_list_lock();
-+ for (type = swap_list.head; type >= 0; type = swap_info[type].next) {
-+ struct swap_info_struct * p;
-+ p = swap_info + type;
-+ if ((p->flags & SWP_ACTIVE) == SWP_ACTIVE) {
-+ if (imajor(p->swap_file->f_dentry->d_inode) == major) {
-+ p->lowest_bit = p->max;
-+ p->highest_bit = 0;
-+ ctx->pgin_swp = p;
-+ break;
-+ }
-+ }
-+ }
-+ swap_list_unlock();
-+ if (type < 0) {
-+ eprintk_ctx("swapfile has been lost\n");
-+ err = -EFAULT;
-+ goto out;
-+ }
-+ ctx->lazytype = type;
-+
-+out:
-+ sys_unlink(devname);
-+ set_fs(oldfs);
-+ return err;
-+}
-+
-+static int pgin_thread(void *arg)
-+{
-+ struct request *req;
-+ struct cpt_context *ctx = arg;
-+ struct pgin_device *d;
-+
-+ daemonize("pgind");
-+ allow_signal(SIGKILL);
-+ set_fs(KERNEL_DS);
-+
-+ d = ctx->pagein_dev;
-+
-+ if (d->startup)
-+ complete(d->startup);
-+
-+ while ((req = pgin_read_stat(d)) != NULL)
-+ pgin_end_request(req);
-+
-+ d->dead = 1;
-+ pgin_flush_requests(d);
-+ del_timer_sync(&d->timer);
-+ if (d->end)
-+ complete(d->end);
-+ return 0;
-+}
-+
-+static void rst_start_pagein_worker(void *_info)
-+{
-+ pagein_info_t *info;
-+
-+ info = (pagein_info_t *)_info;
-+ info->pid = kernel_thread(pgin_thread, info->ctx,
-+ CLONE_KERNEL | CLONE_VM | SIGCHLD);
-+ complete(&info->done);
-+}
-+
-+int rst_setup_pagein(cpt_context_t *ctx)
-+{
-+ struct completion comp;
-+ mm_segment_t oldfs;
-+ pagein_info_t create;
-+ DECLARE_WORK(work, rst_start_pagein_worker, &create);
-+ int err;
-+
-+ if (ctx->lazypages == 0)
-+ return 0;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = pagein_send_start(ctx);
-+ set_fs(oldfs);
-+ if (err) {
-+ eprintk_ctx("rst_setup_pagein: pagein_send_start: %d\n", err);
-+ return err;
-+ }
-+ ctx->last_pagein = jiffies;
-+
-+ err = pagein_dev_init(ctx);
-+ if (err) {
-+ eprintk_ctx("pagein_dev_init\n");
-+ return err;
-+ }
-+
-+ init_completion(&comp);
-+ ctx->pagein_dev->startup = &comp;
-+
-+ create.pid = -EINVAL;
-+ create.ctx = ctx;
-+ init_completion(&create.done);
-+ schedule_work(&work);
-+ wait_for_completion(&create.done);
-+
-+ if (create.pid < 0) {
-+ eprintk_ctx("kernel_thread pgin\n");
-+ return create.pid;
-+ }
-+
-+ read_lock(&tasklist_lock);
-+ ctx->pgin_task = find_task_by_pid_all(create.pid);
-+ if (ctx->pgin_task)
-+ get_task_struct(ctx->pgin_task);
-+ read_unlock(&tasklist_lock);
-+ if (ctx->pgin_task == NULL) {
-+ eprintk_ctx("pgin task is lost\n");
-+ return -ESRCH;
-+ }
-+ dprintk_ctx("pgin pid=%d\n", create.pid);
-+
-+ wait_for_completion(&comp);
-+ ctx->pagein_dev->startup = NULL;
-+
-+ err = plugin_swap(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_setup_pagein: plugin_swap: %d\n", err);
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+int rst_pageind(cpt_context_t *ctx)
-+{
-+ struct completion comp;
-+
-+ if (!ctx->pgin_swp)
-+ return -EINVAL;
-+
-+ init_completion(&comp);
-+ ctx->pgind_completion = &comp;
-+ up(&ctx->main_sem);
-+ wait_for_completion(&comp);
-+ down(&ctx->main_sem);
-+ ctx->pgind_completion = NULL;
-+ return 0;
-+}
-+
-+int rst_complete_pagein(cpt_context_t *ctx, int kill)
-+{
-+ int err;
-+ mm_segment_t oldfs;
-+
-+ rst_drop_iter_dir(ctx);
-+
-+ if (!kill && ctx->pgin_swp) {
-+ ctx->last_pagein = jiffies;
-+ while ((long)(jiffies - ctx->last_pagein) < PGIN_IDLEWAIT &&
-+ (long)(jiffies - (unsigned long)ctx->cpt_jiffies64) < PGIN_WAIT) {
-+ current->state = TASK_INTERRUPTIBLE;
-+ schedule_timeout(PGIN_IDLEWAIT);
-+ }
-+ }
-+
-+ if (ctx->pgin_swp) {
-+ char devname[16];
-+ int major = ctx->pagein_dev->disk->major;
-+
-+ dprintk_ctx("going to suck vm...\n");
-+ ctx->pgin_swp = NULL;
-+
-+ sprintf(devname, "/dev/pgin%d", major);
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ sys_unlink(devname);
-+ sys_mknod(devname, 0600|S_IFBLK, major<<8);
-+ err = rst_swapoff(ctx);
-+ if (!err)
-+ err = sys_swapoff(devname);
-+
-+ if (err == -EFAULT || err == -ENOMEM || err == -EINTR) {
-+ struct ve_struct *env;
-+ eprintk_ctx("cannot get vm pages from source node: %d\n", err);
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (env) {
-+ int delay;
-+ send_sig(SIGKILL, env->init_entry, 1);
-+ delay = 1;
-+ while (atomic_read(&env->counter) != 1) {
-+ if (signal_pending(current))
-+ break;
-+ current->state = TASK_INTERRUPTIBLE;
-+ delay = (delay < HZ) ? (delay << 1) : HZ;
-+ schedule_timeout(delay);
-+ }
-+ put_ve(env);
-+ }
-+ err = sys_swapoff(devname);
-+ }
-+ sys_unlink(devname);
-+ set_fs(oldfs);
-+ dprintk_ctx("...sucked\n");
-+
-+ if (err)
-+ dprintk_ctx("sys_swapoff: %d\n", err);
-+ }
-+
-+ if (ctx->pagein_file_out) {
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ pagein_send_stop(ctx);
-+ set_fs(oldfs);
-+ }
-+
-+ if (ctx->pgind_completion)
-+ complete(ctx->pgind_completion);
-+
-+ if (ctx->pgin_task) {
-+ read_lock(&tasklist_lock);
-+ if (!ctx->pgin_task->exit_state)
-+ send_sig(SIGKILL, ctx->pgin_task, 1);
-+ read_unlock(&tasklist_lock);
-+ put_task_struct(ctx->pgin_task);
-+ ctx->pgin_task = NULL;
-+ dprintk_ctx("rst: wfc pgin_notify... ");
-+ wait_for_completion(&ctx->pgin_notify);
-+ dprintk_ctx("done\n");
-+ }
-+ pagein_dev_cleanup(ctx);
-+ return 0;
-+}
-+
-+int pagein_info_printf(char *buf, cpt_context_t *ctx)
-+{
-+ int len = 0;
-+
-+ if (ctx->pagein_dev) {
-+ len = sprintf(buf, " %d %d %d %d %d",
-+ ctx->pagein_dev->qlen,
-+ (int)ctx->pagein_dev->rtt/(int)ctx->pagein_dev->reqnum,
-+ ctx->pagein_dev->rttmin,
-+ ctx->pagein_dev->rttmax,
-+ ctx->pagein_dev->npgs);
-+ ctx->pagein_dev->rttmin = 0x7FFFFFF;
-+ ctx->pagein_dev->rttmax = 0;
-+ }
-+
-+ return len;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_proc.c linux-2.6.9-ve023stab030/kernel/cpt/rst_proc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_proc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_proc.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,596 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/errno.h>
-+#include <linux/mm.h>
-+#include <linux/proc_fs.h>
-+#include <linux/smp_lock.h>
-+#include <asm/uaccess.h>
-+#include <linux/cpt_ioctl.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_dump.h"
-+#include "cpt_files.h"
-+#include "cpt_mm.h"
-+#include "cpt_kernel.h"
-+
-+MODULE_AUTHOR("Alexey Kuznetsov <alexey@sw.ru>");
-+MODULE_LICENSE("GPL v2");
-+
-+/* List of contexts and lock protecting the list */
-+struct list_head cpt_context_list;
-+spinlock_t cpt_context_lock;
-+
-+static int proc_read(char *buffer, char **start, off_t offset,
-+ int length, int *eof, void *data)
-+{
-+ off_t pos = 0;
-+ off_t begin = 0;
-+ int len = 0;
-+ cpt_context_t *ctx;
-+
-+ len += sprintf(buffer, "Ctx Id VE State\n");
-+
-+ spin_lock(&cpt_context_lock);
-+
-+ list_for_each_entry(ctx, &cpt_context_list, ctx_list) {
-+ len += sprintf(buffer+len,"%p %08x %-8u %d",
-+ ctx,
-+ ctx->contextid,
-+ ctx->ve_id,
-+ ctx->ctx_state
-+ );
-+ len += pagein_info_printf(buffer+len, ctx);
-+
-+ buffer[len++] = '\n';
-+
-+ pos = begin+len;
-+ if (pos < offset) {
-+ len = 0;
-+ begin = pos;
-+ }
-+ if (pos > offset+length)
-+ goto done;
-+ }
-+ *eof = 1;
-+
-+done:
-+ spin_unlock(&cpt_context_lock);
-+ *start = buffer + (offset - begin);
-+ len -= (offset - begin);
-+ if(len > length)
-+ len = length;
-+ if(len < 0)
-+ len = 0;
-+ return len;
-+}
-+
-+void rst_context_release(cpt_context_t *ctx)
-+{
-+ list_del(&ctx->ctx_list);
-+ spin_unlock(&cpt_context_lock);
-+
-+ if (ctx->ctx_state > 0)
-+ rst_resume(ctx);
-+ ctx->ctx_state = CPT_CTX_ERROR;
-+
-+ rst_close_dumpfile(ctx);
-+
-+ if (ctx->anonvmas) {
-+ int h;
-+ for (h = 0; h < CPT_ANONVMA_HSIZE; h++) {
-+ while (!hlist_empty(&ctx->anonvmas[h])) {
-+ struct hlist_node *elem = ctx->anonvmas[h].first;
-+ hlist_del(elem);
-+ kfree(elem);
-+ }
-+ }
-+ free_page((unsigned long)ctx->anonvmas);
-+ }
-+ cpt_flush_error(ctx);
-+ if (ctx->errorfile) {
-+ fput(ctx->errorfile);
-+ ctx->errorfile = NULL;
-+ }
-+ if (ctx->error_msg) {
-+ free_page((unsigned long)ctx->error_msg);
-+ ctx->error_msg = NULL;
-+ }
-+ rst_drop_iter_dir(ctx);
-+ if (ctx->pagein_file_out)
-+ fput(ctx->pagein_file_out);
-+ if (ctx->pagein_file_in)
-+ fput(ctx->pagein_file_in);
-+ if (ctx->filejob_queue)
-+ rst_flush_filejobs(ctx);
-+ if (ctx->pgin_task)
-+ put_task_struct(ctx->pgin_task);
-+ if (ctx->vdso) {
-+ free_page((unsigned long)ctx->vdso);
-+ }
-+ if (ctx->objcount)
-+ eprintk_ctx("%d objects leaked\n", ctx->objcount);
-+ kfree(ctx);
-+
-+ spin_lock(&cpt_context_lock);
-+}
-+
-+static void __cpt_context_put(cpt_context_t *ctx)
-+{
-+ if (!--ctx->refcount)
-+ rst_context_release(ctx);
-+}
-+
-+static void cpt_context_put(cpt_context_t *ctx)
-+{
-+ spin_lock(&cpt_context_lock);
-+ __cpt_context_put(ctx);
-+ spin_unlock(&cpt_context_lock);
-+}
-+
-+cpt_context_t * rst_context_open(void)
-+{
-+ cpt_context_t *ctx;
-+
-+ if ((ctx = kmalloc(sizeof(*ctx), GFP_KERNEL)) != NULL) {
-+ rst_context_init(ctx);
-+ spin_lock(&cpt_context_lock);
-+ list_add_tail(&ctx->ctx_list, &cpt_context_list);
-+ spin_unlock(&cpt_context_lock);
-+ ctx->error_msg = (char*)__get_free_page(GFP_KERNEL);
-+ if (ctx->error_msg != NULL)
-+ ctx->error_msg[0] = 0;
-+ }
-+ return ctx;
-+}
-+
-+void rst_report_error(int err, cpt_context_t *ctx)
-+{
-+ if (ctx->statusfile) {
-+ mm_segment_t oldfs;
-+ int status = 7 /* VZ_ENVCREATE_ERROR */;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (ctx->statusfile->f_op && ctx->statusfile->f_op->write)
-+ ctx->statusfile->f_op->write(ctx->statusfile, (char*)&status, sizeof(status), &ctx->statusfile->f_pos);
-+ set_fs(oldfs);
-+ fput(ctx->statusfile);
-+ ctx->statusfile = NULL;
-+ }
-+}
-+
-+
-+cpt_context_t * cpt_context_lookup(unsigned int ctxid)
-+{
-+ cpt_context_t *ctx;
-+
-+ spin_lock(&cpt_context_lock);
-+ list_for_each_entry(ctx, &cpt_context_list, ctx_list) {
-+ if (ctx->contextid == ctxid) {
-+ ctx->refcount++;
-+ spin_unlock(&cpt_context_lock);
-+ return ctx;
-+ }
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ return NULL;
-+}
-+
-+static int rst_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg)
-+{
-+ int err = 0;
-+ cpt_context_t *ctx;
-+ struct file *dfile = NULL;
-+
-+ unlock_kernel();
-+
-+ if (cmd == CPT_TEST_CAPS) {
-+ err = test_cpu_caps();
-+ goto out_lock;
-+ }
-+
-+ if (cmd == CPT_JOIN_CONTEXT || cmd == CPT_PUT_CONTEXT) {
-+ cpt_context_t *old_ctx;
-+
-+ ctx = NULL;
-+ if (cmd == CPT_JOIN_CONTEXT) {
-+ err = -ENOENT;
-+ ctx = cpt_context_lookup(arg);
-+ if (!ctx)
-+ goto out_lock;
-+ }
-+
-+ spin_lock(&cpt_context_lock);
-+ old_ctx = (cpt_context_t*)file->private_data;
-+ file->private_data = ctx;
-+
-+ if (old_ctx) {
-+ if (cmd == CPT_PUT_CONTEXT && old_ctx->sticky) {
-+ old_ctx->sticky = 0;
-+ old_ctx->refcount--;
-+ }
-+ __cpt_context_put(old_ctx);
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ err = 0;
-+ goto out_lock;
-+ }
-+
-+ spin_lock(&cpt_context_lock);
-+ ctx = (cpt_context_t*)file->private_data;
-+ if (ctx)
-+ ctx->refcount++;
-+ spin_unlock(&cpt_context_lock);
-+
-+ if (!ctx) {
-+ cpt_context_t *old_ctx;
-+
-+ err = -ENOMEM;
-+ ctx = rst_context_open();
-+ if (!ctx)
-+ goto out_lock;
-+
-+ spin_lock(&cpt_context_lock);
-+ old_ctx = (cpt_context_t*)file->private_data;
-+ if (!old_ctx) {
-+ ctx->refcount++;
-+ file->private_data = ctx;
-+ } else {
-+ old_ctx->refcount++;
-+ }
-+ if (old_ctx) {
-+ __cpt_context_put(ctx);
-+ ctx = old_ctx;
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ }
-+
-+ if (cmd == CPT_GET_CONTEXT) {
-+ unsigned int contextid = (unsigned int)arg;
-+
-+ err = -EINVAL;
-+ if (ctx->contextid && ctx->contextid != contextid)
-+ goto out_nosem;
-+ if (!ctx->contextid) {
-+ cpt_context_t *c1 = cpt_context_lookup(contextid);
-+ if (c1) {
-+ cpt_context_put(c1);
-+ err = -EEXIST;
-+ goto out_nosem;
-+ }
-+ ctx->contextid = contextid;
-+ }
-+ spin_lock(&cpt_context_lock);
-+ if (!ctx->sticky) {
-+ ctx->sticky = 1;
-+ ctx->refcount++;
-+ }
-+ spin_unlock(&cpt_context_lock);
-+ err = 0;
-+ goto out_nosem;
-+ }
-+
-+ down(&ctx->main_sem);
-+
-+ err = -EBUSY;
-+ if (ctx->ctx_state < 0)
-+ goto out;
-+
-+ err = 0;
-+ switch (cmd) {
-+ case CPT_SET_DUMPFD:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ err = -EBADF;
-+ dfile = fget(arg);
-+ if (dfile == NULL)
-+ break;
-+ if (dfile->f_op == NULL ||
-+ dfile->f_op->read == NULL) {
-+ fput(dfile);
-+ break;
-+ }
-+ err = 0;
-+ }
-+ if (ctx->file)
-+ fput(ctx->file);
-+ ctx->file = dfile;
-+ break;
-+ case CPT_SET_PAGEINFDIN:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->pagein_file_in)
-+ fput(ctx->pagein_file_in);
-+ ctx->pagein_file_in = dfile;
-+ break;
-+ case CPT_SET_PAGEINFDOUT:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->pagein_file_out)
-+ fput(ctx->pagein_file_out);
-+ ctx->pagein_file_out = dfile;
-+ break;
-+ case CPT_ITER:
-+ err = rst_iteration(ctx);
-+ break;
-+ case CPT_SET_LOCKFD:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->lockfile)
-+ fput(ctx->lockfile);
-+ ctx->lockfile = dfile;
-+ break;
-+ case CPT_SET_STATUSFD:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->statusfile)
-+ fput(ctx->statusfile);
-+ ctx->statusfile = dfile;
-+ break;
-+ case CPT_SET_ERRORFD:
-+ if (arg >= 0) {
-+ dfile = fget(arg);
-+ if (dfile == NULL) {
-+ err = -EBADF;
-+ break;
-+ }
-+ }
-+ if (ctx->errorfile)
-+ fput(ctx->errorfile);
-+ ctx->errorfile = dfile;
-+ break;
-+ case CPT_SET_VEID:
-+ if (ctx->ctx_state > 0) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ ctx->ve_id = arg;
-+ break;
-+ case CPT_UNDUMP:
-+ if (ctx->ctx_state > 0) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ ctx->ctx_state = CPT_CTX_UNDUMPING;
-+ err = vps_rst_undump(ctx);
-+ if (err) {
-+ rst_report_error(err, ctx);
-+ if (rst_kill(ctx) == 0)
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ } else {
-+ ctx->ctx_state = CPT_CTX_UNDUMPED;
-+ }
-+ break;
-+ case CPT_PAGEIND:
-+ err = rst_pageind(ctx);
-+ break;
-+ case CPT_RESUME:
-+ if (!ctx->ctx_state) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ err = rst_resume(ctx);
-+ if (!err)
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ break;
-+ case CPT_KILL:
-+ if (!ctx->ctx_state) {
-+ err = -ENOENT;
-+ break;
-+ }
-+ err = rst_kill(ctx);
-+ if (!err)
-+ ctx->ctx_state = CPT_CTX_IDLE;
-+ break;
-+ default:
-+ err = -EINVAL;
-+ break;
-+ }
-+
-+out:
-+ cpt_flush_error(ctx);
-+ up(&ctx->main_sem);
-+out_nosem:
-+ cpt_context_put(ctx);
-+out_lock:
-+ lock_kernel();
-+ return err;
-+}
-+
-+static int rst_open(struct inode * inode, struct file * file)
-+{
-+ if (!try_module_get(THIS_MODULE))
-+ return -EBUSY;
-+
-+ return 0;
-+}
-+
-+static int rst_release(struct inode * inode, struct file * file)
-+{
-+ cpt_context_t *ctx;
-+
-+ spin_lock(&cpt_context_lock);
-+ ctx = (cpt_context_t*)file->private_data;
-+ file->private_data = NULL;
-+ if (ctx)
-+ __cpt_context_put(ctx);
-+ spin_unlock(&cpt_context_lock);
-+
-+
-+ module_put(THIS_MODULE);
-+ return 0;
-+}
-+
-+static struct file_operations rst_fops =
-+{
-+ .owner = THIS_MODULE,
-+ .ioctl = rst_ioctl,
-+ .open = rst_open,
-+ .release = rst_release,
-+};
-+
-+
-+static struct proc_dir_entry *proc_ent;
-+extern void *schedule_tail_p;
-+extern void schedule_tail_hook(void);
-+
-+int debug_level = 1;
-+
-+static struct ctl_table_header *ctl_header;
-+
-+static ctl_table debug_table[] = {
-+ {
-+ .ctl_name = 9476,
-+ .procname = "rst",
-+ .data = &debug_level,
-+ .maxlen = sizeof(debug_level),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ { .ctl_name = 0 }
-+};
-+static ctl_table root_table[] = {
-+ {
-+ .ctl_name = CTL_DEBUG,
-+ .procname = "debug",
-+ .mode = 0555,
-+ .child = debug_table,
-+ },
-+ { .ctl_name = 0 }
-+};
-+
-+#ifdef CONFIG_X86_64
-+
-+static void *vzentry_forkret_get(void)
-+{
-+ unsigned char *p;
-+
-+ p = (unsigned char *)ret_from_fork;
-+ return (void *)(*(u32 *)(p + 1) + p + 5);
-+}
-+
-+static void vzentry_forkret_set(void *data)
-+{
-+ unsigned char *p;
-+ long offset;
-+
-+ p = (unsigned char *)ret_from_fork;
-+ offset = (unsigned long)data - (unsigned long)(p + 5);
-+ if ((long)(s32)offset != offset) {
-+ printk("vzentry_forkret_set: too long hook offset\n");
-+ BUG();
-+ }
-+ *(u32 *)(p + 1) = offset;
-+}
-+
-+#endif
-+
-+static int __init init_rst(void)
-+{
-+ int err;
-+
-+ err = -ENOMEM;
-+ ctl_header = register_sysctl_table(root_table, 0);
-+ if (!ctl_header)
-+ goto err;
-+
-+ spin_lock_init(&cpt_context_lock);
-+ INIT_LIST_HEAD(&cpt_context_list);
-+
-+ err = -EINVAL;
-+ proc_ent = create_proc_entry("rst", 0600, NULL);
-+ if (!proc_ent)
-+ goto err_out;
-+
-+ rst_fops.read = proc_ent->proc_fops->read;
-+ rst_fops.write = proc_ent->proc_fops->write;
-+ rst_fops.llseek = proc_ent->proc_fops->llseek;
-+ proc_ent->proc_fops = &rst_fops;
-+
-+ proc_ent->read_proc = proc_read;
-+ proc_ent->data = NULL;
-+ proc_ent->owner = THIS_MODULE;
-+#ifdef CONFIG_X86_64
-+ schedule_tail_p = vzentry_forkret_get();
-+ vzentry_forkret_set(&schedule_tail_hook);
-+#endif
-+ return 0;
-+
-+err_out:
-+ unregister_sysctl_table(ctl_header);
-+err:
-+ return err;
-+}
-+module_init(init_rst);
-+
-+static void __exit exit_rst(void)
-+{
-+#ifdef CONFIG_X86_64
-+ /* This is wrong, of course. But still the best what we can do. */
-+ vzentry_forkret_set(schedule_tail_p);
-+#endif
-+
-+ remove_proc_entry("rst", NULL);
-+ unregister_sysctl_table(ctl_header);
-+
-+ spin_lock(&cpt_context_lock);
-+ while (!list_empty(&cpt_context_list)) {
-+ cpt_context_t *ctx;
-+ ctx = list_entry(cpt_context_list.next, cpt_context_t, ctx_list);
-+
-+ if (!ctx->sticky)
-+ ctx->refcount++;
-+ ctx->sticky = 0;
-+
-+ BUG_ON(ctx->refcount != 1);
-+
-+ __cpt_context_put(ctx);
-+ }
-+ spin_unlock(&cpt_context_lock);
-+}
-+module_exit(exit_rst);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_process.c linux-2.6.9-ve023stab030/kernel/cpt/rst_process.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_process.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_process.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,1288 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/virtinfo.h>
-+#include <linux/virtinfoscp.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/ptrace.h>
-+#include <linux/tty.h>
-+#include <asm/desc.h>
-+#include <asm/unistd.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_misc.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_files.h"
-+#include "cpt_mm.h"
-+#include "cpt_ubc.h"
-+#include "cpt_process.h"
-+#include "cpt_kernel.h"
-+
-+#ifdef CONFIG_X86_64
-+
-+#define _TIF_RESUME (1<<22)
-+
-+#define task_pt_regs(t) (((struct pt_regs *) (THREAD_SIZE + (unsigned long) (t)->thread_info)) - 1)
-+#define SYSCALL_NR(regs) ((regs)->orig_rax)
-+#define SYSCALL_RETVAL(regs) ((regs)->rax)
-+#define SYSCALL_PC(regs) ((regs)->rip)
-+
-+#define ESP(tsk) (tsk)->thread.rsp
-+
-+#define __NR32_restart_syscall 0
-+#define __NR32_rt_sigtimedwait 177
-+#define __NR32_pause 29
-+#define __NR32_futex 240
-+
-+#define syscall_is(tsk,regs,name) ((!((tsk)->thread_info->flags&_TIF_IA32) && \
-+ SYSCALL_NR(regs) == __NR_##name) || \
-+ (((tsk)->thread_info->flags&_TIF_IA32) && \
-+ SYSCALL_NR(regs) == __NR32_##name))
-+#else
-+
-+#define SYSCALL_NR(regs) ((regs)->orig_eax)
-+#define SYSCALL_RETVAL(regs) ((regs)->eax)
-+#define SYSCALL_PC(regs) ((regs)->eip)
-+
-+#define ESP(tsk) (tsk)->thread.esp
-+
-+#define syscall_is(tsk,regs,name) (SYSCALL_NR(regs) == __NR_##name)
-+
-+#endif
-+
-+static void decode_siginfo(siginfo_t *info, struct cpt_siginfo_image *si)
-+{
-+ memset(info, 0, sizeof(*info));
-+ switch(si->cpt_code & __SI_MASK) {
-+ case __SI_TIMER:
-+ info->si_tid = si->cpt_pid;
-+ info->si_overrun = si->cpt_uid;
-+ info->_sifields._timer._sigval.sival_ptr = cpt_ptr_import(si->cpt_sigval);
-+ info->si_sys_private = si->cpt_utime;
-+ break;
-+ case __SI_POLL:
-+ info->si_band = si->cpt_pid;
-+ info->si_fd = si->cpt_uid;
-+ break;
-+ case __SI_FAULT:
-+ info->si_addr = cpt_ptr_import(si->cpt_sigval);
-+#ifdef __ARCH_SI_TRAPNO
-+ info->si_trapno = si->cpt_pid;
-+#endif
-+ break;
-+ case __SI_CHLD:
-+ info->si_pid = si->cpt_pid;
-+ info->si_uid = si->cpt_uid;
-+ info->si_status = si->cpt_sigval;
-+ info->si_stime = si->cpt_stime;
-+ info->si_utime = si->cpt_utime;
-+ break;
-+ case __SI_KILL:
-+ case __SI_RT:
-+ case __SI_MESGQ:
-+ default:
-+ info->si_pid = si->cpt_pid;
-+ info->si_uid = si->cpt_uid;
-+ info->si_ptr = cpt_ptr_import(si->cpt_sigval);
-+ break;
-+ }
-+ info->si_signo = si->cpt_signo;
-+ info->si_errno = si->cpt_errno;
-+ info->si_code = si->cpt_code;
-+}
-+
-+static int restore_sigqueue(task_t *tsk,
-+ struct sigpending *queue, unsigned long start,
-+ unsigned long end)
-+{
-+ while (start < end) {
-+ struct cpt_siginfo_image *si = (struct cpt_siginfo_image *)start;
-+ if (si->cpt_object == CPT_OBJ_SIGINFO) {
-+ struct user_beancounter *ub;
-+ struct sigqueue *q = NULL;
-+ struct user_struct *up;
-+ up = alloc_uid(si->cpt_user);
-+ if (!up)
-+ return -ENOMEM;
-+ q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
-+ if (!q) {
-+ free_uid(up);
-+ return -ENOMEM;
-+ }
-+ ub = get_beancounter(get_exec_ub());
-+ if (ub_siginfo_charge(ub,
-+ kmem_cache_memusage(sigqueue_cachep)) < 0) {
-+ put_beancounter(ub);
-+ kmem_cache_free(sigqueue_cachep, q);
-+ free_uid(up);
-+ return -ENOMEM;
-+ }
-+
-+ INIT_LIST_HEAD(&q->list);
-+ /* Preallocated elements (posix timers) are not
-+ * supported yet. It is safe to replace them with
-+ * a private one. */
-+ q->flags = 0;
-+ q->lock = &tsk->sighand->siglock;
-+ q->user = up;
-+ atomic_inc(&q->user->sigpending);
-+ sig_ub(q) = ub;
-+
-+ decode_siginfo(&q->info, si);
-+ list_add_tail(&q->list, &queue->list);
-+ }
-+ start += si->cpt_next;
-+ }
-+ return 0;
-+}
-+
-+int rst_process_linkage(cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ struct cpt_task_image *ti = obj->o_image;
-+
-+ if (tsk == NULL) {
-+ eprintk_ctx("task %u(%s) is missing\n", ti->cpt_pid, ti->cpt_comm);
-+ return -EINVAL;
-+ }
-+
-+ if (virt_pgid(tsk) != ti->cpt_pgrp) {
-+ int pid;
-+
-+ if ((pid = vpid_to_pid(ti->cpt_pgrp)) < 0) {
-+ eprintk_ctx("illegal PGRP " CPT_FID "\n", CPT_TID(tsk));
-+ return -EINVAL;
-+ }
-+
-+ write_lock_irq(&tasklist_lock);
-+ detach_pid(tsk, PIDTYPE_PGID);
-+ tsk->signal->pgrp = pid;
-+ set_virt_pgid(tsk, ti->cpt_pgrp);
-+ if (thread_group_leader(tsk))
-+ attach_pid(tsk, PIDTYPE_PGID, pid);
-+ write_unlock_irq(&tasklist_lock);
-+ }
-+ if (virt_sid(tsk) != ti->cpt_session) {
-+ int pid;
-+
-+ if ((pid = vpid_to_pid(ti->cpt_session)) < 0) {
-+ eprintk_ctx("illegal SID " CPT_FID "\n", CPT_TID(tsk));
-+ return -EINVAL;
-+ }
-+
-+ write_lock_irq(&tasklist_lock);
-+ detach_pid(tsk, PIDTYPE_SID);
-+ tsk->signal->session = pid;
-+ set_virt_sid(tsk, ti->cpt_session);
-+ if (thread_group_leader(tsk))
-+ attach_pid(tsk, PIDTYPE_SID, pid);
-+ write_unlock_irq(&tasklist_lock);
-+ }
-+ if (ti->cpt_old_pgrp > 0 && tsk->signal->tty_old_pgrp == 0) {
-+ int pid;
-+
-+ if ((pid = vpid_to_pid(ti->cpt_old_pgrp)) < 0) {
-+ eprintk_ctx("illegal OLD_PGRP " CPT_FID "\n", CPT_TID(tsk));
-+ return -EINVAL;
-+ }
-+
-+ tsk->signal->tty_old_pgrp = pid;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int
-+restore_one_signal_struct(struct cpt_task_image *ti, int *exiting, cpt_context_t *ctx)
-+{
-+ int err;
-+ struct cpt_signal_image *si = cpt_get_buf(ctx);
-+
-+ current->signal->tty = NULL;
-+
-+ err = rst_get_object(CPT_OBJ_SIGNAL_STRUCT, ti->cpt_signal, si, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+
-+ if (virt_pgid(current) != si->cpt_pgrp) {
-+ int err;
-+ int pid = 0;
-+
-+ if (si->cpt_pgrp_type == CPT_PGRP_ORPHAN) {
-+ pid = alloc_pidmap();
-+ if (pid < 0) {
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ if ((err = alloc_vpid(pid, si->cpt_pgrp)) < 0) {
-+ free_pidmap(pid);
-+ pid = 0;
-+ if (err != -EEXIST) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ }
-+ }
-+ if (pid ||
-+ (pid = vpid_to_pid(si->cpt_pgrp)) > 0) {
-+ write_lock_irq(&tasklist_lock);
-+ detach_pid(current, PIDTYPE_PGID);
-+ current->signal->pgrp = pid;
-+ set_virt_pgid(current, si->cpt_pgrp);
-+ if (thread_group_leader(current))
-+ attach_pid(current, PIDTYPE_PGID, pid);
-+ write_unlock_irq(&tasklist_lock);
-+ }
-+ }
-+
-+ current->signal->tty_old_pgrp = 0;
-+ if ((int)si->cpt_old_pgrp > 0) {
-+ if (si->cpt_old_pgrp_type == CPT_PGRP_STRAY) {
-+ current->signal->tty_old_pgrp = alloc_pidmap();
-+ if (current->signal->tty_old_pgrp < 0) {
-+ eprintk_ctx("failed to allocate stray tty_old_pgrp\n");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ free_pidmap(current->signal->tty_old_pgrp);
-+ } else {
-+ current->signal->tty_old_pgrp = vpid_to_pid(si->cpt_old_pgrp);
-+ if (current->signal->tty_old_pgrp < 0) {
-+ dprintk_ctx("forward old tty PGID\n");
-+ current->signal->tty_old_pgrp = 0;
-+ }
-+ }
-+ }
-+
-+ if (virt_sid(current) != si->cpt_session) {
-+ int err;
-+ int pid = 0;
-+
-+ if (si->cpt_session_type == CPT_PGRP_ORPHAN) {
-+ pid = alloc_pidmap();
-+ if (pid < 0) {
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ if ((err = alloc_vpid(pid, si->cpt_session)) < 0) {
-+ free_pidmap(pid);
-+ pid = 0;
-+ if (err != -EEXIST) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ }
-+ }
-+ if (pid ||
-+ (pid = vpid_to_pid(si->cpt_session)) > 0) {
-+ write_lock_irq(&tasklist_lock);
-+ detach_pid(current, PIDTYPE_SID);
-+ set_virt_sid(current, si->cpt_session);
-+ current->signal->session = pid;
-+ if (thread_group_leader(current))
-+ attach_pid(current, PIDTYPE_SID, pid);
-+ write_unlock_irq(&tasklist_lock);
-+ }
-+ }
-+
-+ cpt_sigset_import(&current->signal->shared_pending.signal, si->cpt_sigpending);
-+ current->signal->leader = si->cpt_leader;
-+ if (si->cpt_ctty != CPT_NULL) {
-+ cpt_object_t *obj = lookup_cpt_obj_bypos(CPT_OBJ_TTY, si->cpt_ctty, ctx);
-+ if (obj) {
-+ struct tty_struct *tty = obj->o_obj;
-+ if (tty->session == 0 || tty->session == current->signal->session) {
-+ tty->session = current->signal->session;
-+ current->signal->tty = tty;
-+ } else {
-+ wprintk_ctx("tty session mismatch\n");
-+ }
-+ }
-+ }
-+
-+ if (si->cpt_curr_target)
-+ current->signal->curr_target = find_task_by_pid_ve(si->cpt_curr_target);
-+ *exiting = si->cpt_group_exit;
-+ current->signal->group_exit_code = si->cpt_group_exit_code;
-+ if (si->cpt_group_exit_task) {
-+ current->signal->group_exit_task = find_task_by_pid_ve(si->cpt_group_exit_task);
-+ if (current->signal->group_exit_task == NULL) {
-+ eprintk_ctx("oops, group_exit_task=NULL, pid=%u\n", si->cpt_group_exit_task);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ }
-+ current->signal->notify_count = si->cpt_notify_count;
-+ current->signal->group_stop_count = si->cpt_group_stop_count;
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
-+ current->signal->stop_state = si->cpt_stop_state;
-+
-+ current->signal->utime = si->cpt_utime;
-+ current->signal->stime = si->cpt_stime;
-+ current->signal->cutime = si->cpt_cutime;
-+ current->signal->cstime = si->cpt_cstime;
-+ current->signal->nvcsw = si->cpt_nvcsw;
-+ current->signal->nivcsw = si->cpt_nivcsw;
-+ current->signal->cnvcsw = si->cpt_cnvcsw;
-+ current->signal->cnivcsw = si->cpt_cnivcsw;
-+ current->signal->min_flt = si->cpt_min_flt;
-+ current->signal->maj_flt = si->cpt_maj_flt;
-+ current->signal->cmin_flt = si->cpt_cmin_flt;
-+ current->signal->cmaj_flt = si->cpt_cmaj_flt;
-+#endif
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+ if (RLIM_NLIMITS > CPT_RLIM_NLIMITS)
-+ __asm__("undefined\n");
-+
-+ for (i=0; i<RLIM_NLIMITS; i++) {
-+ current->signal->rlim[i].rlim_cur = si->cpt_rlim_cur[i];
-+ current->signal->rlim[i].rlim_max = si->cpt_rlim_max[i];
-+ }
-+#endif
-+
-+ if (si->cpt_next > si->cpt_hdrlen) {
-+ char *buf = kmalloc(si->cpt_next - si->cpt_hdrlen, GFP_KERNEL);
-+ if (buf == NULL) {
-+ cpt_release_buf(ctx);
-+ return -ENOMEM;
-+ }
-+ err = ctx->pread(buf, si->cpt_next - si->cpt_hdrlen, ctx,
-+ ti->cpt_signal + si->cpt_hdrlen);
-+ if (err) {
-+ kfree(buf);
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ restore_sigqueue(current,
-+ &current->signal->shared_pending, (unsigned long)buf,
-+ (unsigned long)buf + si->cpt_next - si->cpt_hdrlen);
-+ kfree(buf);
-+ }
-+ cpt_release_buf(ctx);
-+ return 0;
-+}
-+
-+int restore_one_sighand_struct(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_sighand_image si;
-+ int i;
-+ loff_t pos, endpos;
-+
-+ err = rst_get_object(CPT_OBJ_SIGHAND_STRUCT, ti->cpt_sighand, &si, ctx);
-+ if (err)
-+ return err;
-+
-+ for (i=0; i<_NSIG; i++) {
-+ current->sighand->action[i].sa.sa_handler = SIG_DFL;
-+ current->sighand->action[i].sa.sa_restorer = 0;
-+ current->sighand->action[i].sa.sa_flags = 0;
-+ memset(&current->sighand->action[i].sa.sa_mask, 0, sizeof(sigset_t));
-+ }
-+
-+ pos = ti->cpt_sighand + si.cpt_hdrlen;
-+ endpos = ti->cpt_sighand + si.cpt_next;
-+ while (pos < endpos) {
-+ struct cpt_sighandler_image shi;
-+
-+ err = rst_get_object(CPT_OBJ_SIGHANDLER, pos, &shi, ctx);
-+ if (err)
-+ return err;
-+ current->sighand->action[shi.cpt_signo].sa.sa_handler = (void*)(unsigned long)shi.cpt_handler;
-+ current->sighand->action[shi.cpt_signo].sa.sa_restorer = (void*)(unsigned long)shi.cpt_restorer;
-+ current->sighand->action[shi.cpt_signo].sa.sa_flags = shi.cpt_flags;
-+ cpt_sigset_import(&current->sighand->action[shi.cpt_signo].sa.sa_mask, shi.cpt_mask);
-+ pos += shi.cpt_next;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+__u32 rst_signal_flag(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ __u32 flag = 0;
-+
-+ if (lookup_cpt_obj_bypos(CPT_OBJ_SIGNAL_STRUCT, ti->cpt_signal, ctx))
-+ flag |= CLONE_THREAD;
-+ if (ti->cpt_sighand == CPT_NULL ||
-+ lookup_cpt_obj_bypos(CPT_OBJ_SIGHAND_STRUCT, ti->cpt_sighand, ctx))
-+ flag |= CLONE_SIGHAND;
-+ return flag;
-+}
-+
-+int
-+rst_signal_complete(struct cpt_task_image *ti, int * exiting, cpt_context_t *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+
-+ if (ti->cpt_signal == CPT_NULL || ti->cpt_sighand == CPT_NULL) {
-+ return -EINVAL;
-+ }
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_SIGHAND_STRUCT, ti->cpt_sighand, ctx);
-+ if (obj) {
-+ struct sighand_struct *sig = current->sighand;
-+ if (obj->o_obj != sig) {
-+ return -EINVAL;
-+ }
-+ } else {
-+ obj = cpt_object_add(CPT_OBJ_SIGHAND_STRUCT, current->sighand, ctx);
-+ if (obj == NULL)
-+ return -ENOMEM;
-+ cpt_obj_setpos(obj, ti->cpt_sighand, ctx);
-+ err = restore_one_sighand_struct(ti, ctx);
-+ if (err)
-+ return err;
-+ }
-+
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_SIGNAL_STRUCT, ti->cpt_signal, ctx);
-+ if (obj) {
-+ struct signal_struct *sig = current->signal;
-+ if (obj->o_obj != sig) {
-+ return -EINVAL;
-+ }
-+ if (current->signal) {
-+ set_virt_pgid(current, pid_type_to_vpid(PIDTYPE_PGID, current->signal->pgrp));
-+ set_virt_sid(current, pid_type_to_vpid(PIDTYPE_SID, current->signal->session));
-+ }
-+ } else {
-+ obj = cpt_object_add(CPT_OBJ_SIGNAL_STRUCT, current->signal, ctx);
-+ if (obj == NULL)
-+ return -ENOMEM;
-+ cpt_obj_setpos(obj, ti->cpt_signal, ctx);
-+ err = restore_one_signal_struct(ti, exiting, ctx);
-+ if (err)
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+static u32 decode_segment(u32 segid)
-+{
-+ if (segid == CPT_SEG_ZERO)
-+ return 0;
-+
-+ /* TLS descriptors */
-+ if (segid <= CPT_SEG_TLS3)
-+ return ((GDT_ENTRY_TLS_MIN + segid-CPT_SEG_TLS1)<<3) + 3;
-+
-+ /* LDT descriptor, it is just an index to LDT array */
-+ if (segid >= CPT_SEG_LDT)
-+ return ((segid - CPT_SEG_LDT) << 3) | 7;
-+
-+ /* Check for one of standard descriptors */
-+#ifdef CONFIG_X86_64
-+ if (segid == CPT_SEG_USER32_DS)
-+ return __USER32_DS;
-+ if (segid == CPT_SEG_USER32_CS)
-+ return __USER32_CS;
-+ if (segid == CPT_SEG_USER64_DS)
-+ return __USER_DS;
-+ if (segid == CPT_SEG_USER64_CS)
-+ return __USER_CS;
-+#else
-+ if (segid == CPT_SEG_USER32_DS)
-+ return __USER_DS;
-+ if (segid == CPT_SEG_USER32_CS)
-+ return __USER_CS;
-+#endif
-+ wprintk("Invalid segment reg %d\n", segid);
-+ return 0;
-+}
-+
-+asmlinkage unsigned long rct(unsigned long *child_tids)
-+{
-+ dprintk("rct: " CPT_FID "\n", CPT_TID(current));
-+ current->clear_child_tid = (void*)child_tids[0];
-+ current->set_child_tid = (void*)child_tids[1];
-+ module_put(THIS_MODULE);
-+ return (unsigned long)(child_tids+2);
-+}
-+
-+asmlinkage unsigned long rlsi(void)
-+{
-+ int signr;
-+ siginfo_t *info = current->last_siginfo;
-+ struct pt_regs *regs = task_pt_regs(current);
-+ struct k_sigaction *ka;
-+ int ptrace_id;
-+
-+ dprintk("rlsi: " CPT_FID "\n", CPT_TID(current));
-+
-+ spin_lock_irq(&current->sighand->siglock);
-+ current->last_siginfo = NULL;
-+ recalc_sigpending();
-+
-+ ptrace_id = current->pn_state;
-+ clear_pn_state(current);
-+
-+ switch (ptrace_id) {
-+ case PN_STOP_TF:
-+ case PN_STOP_TF_RT:
-+ /* frame_*signal */
-+ dprintk("SIGTRAP %u/%u(%s) %u/%u %u %ld %lu %lu\n",
-+ virt_pid(current), current->pid, current->comm,
-+ info->si_signo, info->si_code,
-+ current->exit_code, SYSCALL_NR(regs),
-+ current->ptrace, current->ptrace_message);
-+ goto out;
-+ case PN_STOP_ENTRY:
-+ case PN_STOP_LEAVE:
-+ /* do_syscall_trace */
-+ spin_unlock_irq(&current->sighand->siglock);
-+ dprintk("ptrace do_syscall_trace: %d %d\n", ptrace_id, current->exit_code);
-+ if (current->exit_code) {
-+ send_sig(current->exit_code, current, 1);
-+ current->exit_code = 0;
-+ }
-+ if (ptrace_id == PN_STOP_ENTRY && SYSCALL_RETVAL(regs) == -ENOSYS) {
-+ SYSCALL_RETVAL(regs) = SYSCALL_NR(regs);
-+ SYSCALL_PC(regs) -= 2;
-+ } else if (syscall_is(current, regs, rt_sigtimedwait)) {
-+ if (SYSCALL_RETVAL(regs) == -EAGAIN || SYSCALL_RETVAL(regs) == -EINTR) {
-+ SYSCALL_RETVAL(regs) = SYSCALL_NR(regs);
-+ SYSCALL_PC(regs) -= 2;
-+ }
-+ }
-+ goto out_nolock;
-+ case PN_STOP_FORK:
-+ /* fork */
-+ SYSCALL_RETVAL(regs) = current->ptrace_message;
-+ dprintk("ptrace fork returns pid %ld\n", SYSCALL_RETVAL(regs));
-+ goto out;
-+ case PN_STOP_VFORK:
-+ /* after vfork */
-+ SYSCALL_RETVAL(regs) = current->ptrace_message;
-+ dprintk("ptrace after vfork returns pid %ld\n", SYSCALL_RETVAL(regs));
-+ goto out;
-+ case PN_STOP_SIGNAL:
-+ /* normal case : dequeue signal */
-+ break;
-+ case PN_STOP_EXIT:
-+ dprintk("ptrace exit caught\n");
-+ current->ptrace &= ~PT_TRACE_EXIT;
-+ spin_unlock_irq(&current->sighand->siglock);
-+ module_put(THIS_MODULE);
-+ complete_and_exit(NULL, current->ptrace_message);
-+ BUG();
-+ case PN_STOP_EXEC:
-+ eprintk("ptrace after exec caught: must not happen\n");
-+ BUG();
-+ default:
-+ eprintk("ptrace with unknown identity %d\n", ptrace_id);
-+ BUG();
-+ }
-+
-+ signr = current->exit_code;
-+ if (signr == 0) {
-+ dprintk("rlsi: canceled signal %d\n", info->si_signo);
-+ goto out;
-+ }
-+ current->exit_code = 0;
-+
-+ if (signr != info->si_signo) {
-+ info->si_signo = signr;
-+ info->si_errno = 0;
-+ info->si_code = SI_USER;
-+ info->si_pid = virt_pid(current->parent);
-+ info->si_uid = current->parent->uid;
-+ }
-+
-+ /* If the (new) signal is now blocked, requeue it. */
-+ if (sigismember(&current->blocked, signr)) {
-+ dprintk("going to requeue signal %d\n", signr);
-+ goto out_resend_sig;
-+ }
-+
-+ ka = &current->sighand->action[signr-1];
-+ if (ka->sa.sa_handler == SIG_IGN) {
-+ dprintk("going to resend signal %d (ignored)\n", signr);
-+ goto out;
-+ }
-+ if (ka->sa.sa_handler != SIG_DFL) {
-+ dprintk("going to resend signal %d (not SIG_DFL)\n", signr);
-+ goto out_resend_sig;
-+ }
-+ if (signr == SIGCONT ||
-+ signr == SIGCHLD ||
-+ signr == SIGWINCH ||
-+ signr == SIGURG ||
-+ current->pid == 1)
-+ goto out;
-+
-+ /* All the rest, which we cannot handle are requeued. */
-+ dprintk("going to resend signal %d (sigh)\n", signr);
-+out_resend_sig:
-+ spin_unlock_irq(&current->sighand->siglock);
-+ send_sig_info(signr, info, current);
-+ module_put(THIS_MODULE);
-+ return (unsigned long)(info+1);
-+
-+out:
-+ spin_unlock_irq(&current->sighand->siglock);
-+out_nolock:
-+ module_put(THIS_MODULE);
-+ return (unsigned long)(info+1);
-+}
-+
-+static void ret_finish_stop(void)
-+{
-+ /* ...
-+ * do_signal() ->
-+ * get_signal_to_deliver() ->
-+ * do_signal_stop() ->
-+ * finish_stop()
-+ *
-+ * Normally after SIGCONT it will dequeue the next signal. If no signal
-+ * is found, do_signal restarts syscall unconditionally.
-+ * Otherwise signal handler is pushed on user stack.
-+ */
-+
-+ dprintk("rfs: " CPT_FID "\n", CPT_TID(current));
-+
-+ clear_stop_state(current);
-+ current->exit_code = 0;
-+
-+ module_put(THIS_MODULE);
-+}
-+
-+static void ret_finish_sigsuspend(void)
-+{
-+ struct pt_regs *regs = task_pt_regs(current);
-+
-+ /* *sigsuspend() -> do_signal() -> ...
-+ *
-+ * We can be stopped in three places:
-+ * 1. do_signal() -> refrigerator()
-+ * { sigsuspend flag, oldmask is saved }
-+ * 2. do_signal() -> get_signal_to_deliver() -> ptrace stop
-+ * { sigsuspend flag, oldmask is saved; PN_STOP_SIGNAL }
-+ * 3. do_signal() -> get_signal_to_deliver() -> do_signal_stop() ->
-+ * finish_stop()
-+ * { sigsuspend flag, oldmask is saved; stop_state }
-+ *
-+ * When we reached this hook, hook for pn (rlsi) and stop (rfs)
-+ * have already been executed. Now we are going to proceed with
-+ * *sigsuspend().
-+ */
-+ dprintk("rfss: " CPT_FID "\n", CPT_TID(current));
-+
-+ while (1) {
-+ current->state = TASK_INTERRUPTIBLE;
-+ schedule();
-+ if (do_signal(regs, &current->saved_sigset)) {
-+ clear_sigsuspend_state(current);
-+ break;
-+ }
-+ }
-+
-+ module_put(THIS_MODULE);
-+}
-+
-+static void ret_restart_sys(void)
-+{
-+ struct pt_regs *regs = task_pt_regs(current);
-+
-+ /* This hook is supposed to be executed, when we have
-+ * to complete some interrupted syscall.
-+ */
-+ dprintk("rrs: " CPT_FID "\n", CPT_TID(current));
-+
-+ if (syscall_is(current,regs,pause)) {
-+ if (SYSCALL_RETVAL(regs) == -ERESTARTNOHAND) {
-+ current->state = TASK_INTERRUPTIBLE;
-+ schedule();
-+ }
-+ } else if (syscall_is(current,regs,rt_sigtimedwait)) {
-+ if (SYSCALL_RETVAL(regs) == -EAGAIN || SYSCALL_RETVAL(regs) == -EINTR) {
-+ SYSCALL_RETVAL(regs) = SYSCALL_NR(regs);
-+ SYSCALL_PC(regs) -= 2;
-+ }
-+ } else if (syscall_is(current,regs,futex)) {
-+ if (SYSCALL_RETVAL(regs) == -EINTR) {
-+ SYSCALL_RETVAL(regs) = SYSCALL_NR(regs);
-+ SYSCALL_PC(regs) -= 2;
-+ }
-+ }
-+
-+ if (!signal_pending(current)) {
-+ if (SYSCALL_RETVAL(regs) == -ERESTARTSYS ||
-+ SYSCALL_RETVAL(regs) == -ERESTARTNOINTR ||
-+ SYSCALL_RETVAL(regs) == -ERESTARTNOHAND) {
-+ SYSCALL_RETVAL(regs) = SYSCALL_NR(regs);
-+ SYSCALL_PC(regs) -= 2;
-+ } else if (SYSCALL_RETVAL(regs) == -ERESTART_RESTARTBLOCK) {
-+ SYSCALL_RETVAL(regs) = __NR_restart_syscall;
-+#ifdef CONFIG_X86_64
-+ if (current->thread_info->flags&_TIF_IA32)
-+ SYSCALL_RETVAL(regs) = __NR32_restart_syscall;
-+#endif
-+ SYSCALL_PC(regs) -= 2;
-+ }
-+ }
-+
-+ module_put(THIS_MODULE);
-+}
-+
-+extern asmlinkage void ret_last_siginfo(void);
-+extern asmlinkage void ret_child_tid(void);
-+extern asmlinkage void ret_from_rst(void);
-+extern asmlinkage void pre_ret_from_fork(void);
-+
-+#ifndef CONFIG_X86_64
-+
-+/* tsk->thread.eip points to pre_ret_from_fork
-+ * Stack layout:
-+ * [eip of the last hook]
-+ * [args of the last hook]
-+ * [eip of previous hook]
-+ * [args of previous hook]
-+ * ...
-+ * [eip of the first hook]
-+ * [args of the first hook]
-+ * [ret_from_rst]
-+ */
-+
-+static void * add_hook(task_t *tsk, void (*hook)(void), int argsize, int *hooks)
-+{
-+ ESP(tsk) -= sizeof(unsigned long);
-+ *(unsigned long*)ESP(tsk) = tsk->thread.eip;
-+ ESP(tsk) -= argsize;
-+ tsk->thread.eip = (unsigned long)hook;
-+ if (!try_module_get(THIS_MODULE)) BUG();
-+ (*hooks)++;
-+ return (void*)ESP(tsk);
-+}
-+
-+static int restore_registers(task_t *tsk, struct pt_regs *regs,
-+ struct cpt_task_image *ti, struct cpt_x86_regs *b)
-+{
-+ if (b->cpt_object != CPT_OBJ_X86_REGS)
-+ return -EINVAL;
-+
-+ tsk->thread.esp = (unsigned long) regs;
-+ tsk->thread.esp0 = (unsigned long) (regs+1);
-+ tsk->thread.eip = (unsigned long) ret_from_rst;
-+
-+ tsk->thread.fs = decode_segment(b->cpt_fs);
-+ tsk->thread.gs = decode_segment(b->cpt_gs);
-+ tsk->thread.debugreg[0] = b->cpt_debugreg[0];
-+ tsk->thread.debugreg[1] = b->cpt_debugreg[1];
-+ tsk->thread.debugreg[2] = b->cpt_debugreg[2];
-+ tsk->thread.debugreg[3] = b->cpt_debugreg[3];
-+ tsk->thread.debugreg[4] = b->cpt_debugreg[4];
-+ tsk->thread.debugreg[5] = b->cpt_debugreg[5];
-+ tsk->thread.debugreg[6] = b->cpt_debugreg[6];
-+ tsk->thread.debugreg[7] = b->cpt_debugreg[7];
-+
-+ memcpy(regs, &b->cpt_ebx, sizeof(struct pt_regs));
-+
-+ regs->xcs = decode_segment(b->cpt_xcs);
-+ regs->xss = decode_segment(b->cpt_xss);
-+ regs->xds = decode_segment(b->cpt_xds);
-+ regs->xes = decode_segment(b->cpt_xes);
-+
-+ return 0;
-+}
-+
-+#else
-+
-+/* Stack layout:
-+ *
-+ * [eip of the last hook]
-+ * [args of the last hook]
-+ * ...
-+ * [eip of the first hook]
-+ * [args of the first hook]
-+ * [ret_from_fork+5]
-+ */
-+
-+static void * add_hook(task_t *tsk, void (*hook)(void), int argsize, int *hooks)
-+{
-+ if (!*hooks) {
-+ extern void ret_from_fork2(void);
-+ ESP(tsk) -= sizeof(unsigned long);
-+ *(unsigned long*)ESP(tsk) = (unsigned long)ret_from_fork2;
-+ tsk->thread_info->flags |= _TIF_RESUME;
-+ }
-+ ESP(tsk) -= argsize + sizeof(unsigned long);
-+ *(unsigned long*)ESP(tsk) = (unsigned long)hook;
-+ if (!try_module_get(THIS_MODULE)) BUG();
-+ (*hooks)++;
-+ return (void*)(ESP(tsk) + sizeof(unsigned long));
-+}
-+
-+static void xlate_ptregs_32_to_64(struct pt_regs *d, struct cpt_x86_regs *s)
-+{
-+ memset(d, 0, sizeof(struct pt_regs));
-+ d->rbp = s->cpt_ebp;
-+ d->rbx = s->cpt_ebx;
-+ d->rax = (s32)s->cpt_eax;
-+ d->rcx = s->cpt_ecx;
-+ d->rdx = s->cpt_edx;
-+ d->rsi = s->cpt_esi;
-+ d->rdi = s->cpt_edi;
-+ d->orig_rax = (s32)s->cpt_orig_eax;
-+ d->rip = s->cpt_eip;
-+ d->cs = s->cpt_xcs;
-+ d->eflags = s->cpt_eflags;
-+ d->rsp = s->cpt_esp;
-+ d->ss = s->cpt_xss;
-+}
-+
-+static int restore_registers(task_t *tsk, struct pt_regs *regs,
-+ struct cpt_task_image *ti, struct cpt_obj_bits *hdr)
-+{
-+ if (hdr->cpt_object == CPT_OBJ_X86_64_REGS) {
-+ struct cpt_x86_64_regs *b = (void*)hdr;
-+
-+ tsk->thread.rsp = (unsigned long) regs;
-+ tsk->thread.rsp0 = (unsigned long) (regs+1);
-+
-+ tsk->thread.fs = b->cpt_fsbase;
-+ tsk->thread.gs = b->cpt_gsbase;
-+ tsk->thread.fsindex = decode_segment(b->cpt_fsindex);
-+ tsk->thread.gsindex = decode_segment(b->cpt_gsindex);
-+ tsk->thread.ds = decode_segment(b->cpt_ds);
-+ tsk->thread.es = decode_segment(b->cpt_es);
-+ tsk->thread.debugreg0 = b->cpt_debugreg[0];
-+ tsk->thread.debugreg1 = b->cpt_debugreg[1];
-+ tsk->thread.debugreg2 = b->cpt_debugreg[2];
-+ tsk->thread.debugreg3 = b->cpt_debugreg[3];
-+ tsk->thread.debugreg6 = b->cpt_debugreg[6];
-+ tsk->thread.debugreg7 = b->cpt_debugreg[7];
-+
-+ memcpy(regs, &b->cpt_r15, sizeof(struct pt_regs));
-+
-+ tsk->thread.userrsp = regs->rsp;
-+ regs->cs = decode_segment(b->cpt_cs);
-+ regs->ss = decode_segment(b->cpt_ss);
-+ } else if (hdr->cpt_object == CPT_OBJ_X86_REGS) {
-+ struct cpt_x86_regs *b = (void*)hdr;
-+
-+ tsk->thread.rsp = (unsigned long) regs;
-+ tsk->thread.rsp0 = (unsigned long) (regs+1);
-+
-+ tsk->thread.fs = 0;
-+ tsk->thread.gs = 0;
-+ tsk->thread.fsindex = decode_segment(b->cpt_fs);
-+ tsk->thread.gsindex = decode_segment(b->cpt_gs);
-+ tsk->thread.debugreg0 = b->cpt_debugreg[0];
-+ tsk->thread.debugreg1 = b->cpt_debugreg[1];
-+ tsk->thread.debugreg2 = b->cpt_debugreg[2];
-+ tsk->thread.debugreg3 = b->cpt_debugreg[3];
-+ tsk->thread.debugreg6 = b->cpt_debugreg[6];
-+ tsk->thread.debugreg7 = b->cpt_debugreg[7];
-+
-+ xlate_ptregs_32_to_64(regs, b);
-+
-+ tsk->thread.userrsp = regs->rsp;
-+ regs->cs = decode_segment(b->cpt_xcs);
-+ regs->ss = decode_segment(b->cpt_xss);
-+ tsk->thread.ds = decode_segment(b->cpt_xds);
-+ tsk->thread.es = decode_segment(b->cpt_xes);
-+ } else {
-+ return -EINVAL;
-+ }
-+ return 0;
-+}
-+
-+#endif
-+
-+int rst_restore_process(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ struct cpt_task_image *ti = obj->o_image;
-+ struct pt_regs * regs;
-+ struct cpt_object_hdr *b;
-+ struct cpt_siginfo_image *lsi = NULL;
-+ struct group_info *gids, *ogids;
-+ struct task_beancounter *tbc;
-+ struct user_beancounter *old_bc;
-+ struct user_beancounter *new_bc;
-+ int err;
-+ int hooks = 0;
-+ int i;
-+
-+ if (tsk == NULL) {
-+ eprintk_ctx("oops, task %d/%s is missing\n", ti->cpt_pid, ti->cpt_comm);
-+ return -EFAULT;
-+ }
-+
-+ wait_task_inactive(tsk);
-+
-+ tbc = task_bc(tsk);
-+ new_bc = rst_lookup_ubc(ti->cpt_exec_ub, ctx);
-+ err = virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_RSTTSK, new_bc);
-+ if (err & NOTIFY_FAIL) {
-+ put_beancounter(new_bc);
-+ return -ECHRNG;
-+ }
-+ old_bc = tbc->exec_ub;
-+ if ((err & VIRTNOTIFY_CHANGE) && old_bc != new_bc) {
-+ dprintk(" *** replacing ub %p by %p for %p (%d %s)\n",
-+ old_bc, new_bc, tsk, tsk->pid, tsk->comm);
-+ tbc->exec_ub = new_bc;
-+ new_bc = old_bc;
-+ }
-+ put_beancounter(new_bc);
-+
-+ regs = task_pt_regs(tsk);
-+
-+ if (!tsk->exit_state) {
-+ tsk->lock_depth = -1;
-+#ifdef CONFIG_PREEMPT
-+ tsk->thread_info->preempt_count--;
-+#endif
-+ }
-+
-+ if (tsk->static_prio != ti->cpt_static_prio)
-+ set_user_nice(tsk, PRIO_TO_NICE((s32)ti->cpt_static_prio));
-+
-+ cpt_sigset_import(&tsk->blocked, ti->cpt_sigblocked);
-+ cpt_sigset_import(&tsk->real_blocked, ti->cpt_sigrblocked);
-+ cpt_sigset_import(&tsk->saved_sigset, ti->cpt_sigsuspend_blocked);
-+ cpt_sigset_import(&tsk->pending.signal, ti->cpt_sigpending);
-+
-+ tsk->uid = ti->cpt_uid;
-+ tsk->euid = ti->cpt_euid;
-+ tsk->suid = ti->cpt_suid;
-+ tsk->fsuid = ti->cpt_fsuid;
-+ tsk->gid = ti->cpt_gid;
-+ tsk->egid = ti->cpt_egid;
-+ tsk->sgid = ti->cpt_sgid;
-+ tsk->fsgid = ti->cpt_fsgid;
-+ memcpy(&tsk->cap_effective, &ti->cpt_ecap, sizeof(tsk->cap_effective));
-+ memcpy(&tsk->cap_inheritable, &ti->cpt_icap, sizeof(tsk->cap_inheritable));
-+ memcpy(&tsk->cap_permitted, &ti->cpt_pcap, sizeof(tsk->cap_permitted));
-+ tsk->keep_capabilities = (ti->cpt_keepcap != 0);
-+ tsk->did_exec = (ti->cpt_did_exec != 0);
-+ gids = groups_alloc(ti->cpt_ngids);
-+ ogids = tsk->group_info;
-+ if (gids) {
-+ int i;
-+ for (i=0; i<32; i++)
-+ gids->small_block[i] = ti->cpt_gids[i];
-+ tsk->group_info = gids;
-+ }
-+ if (ogids)
-+ put_group_info(ogids);
-+ tsk->utime = ti->cpt_utime;
-+ tsk->stime = ti->cpt_stime;
-+ if (ctx->image_version == CPT_VERSION_8)
-+ tsk->start_time = _ns_to_timespec((s64)ti->cpt_starttime*TICK_NSEC);
-+ else
-+ cpt_timespec_import(&tsk->start_time, ti->cpt_starttime);
-+ set_normalized_timespec(&tsk->start_time,
-+ tsk->start_time.tv_sec -
-+ VE_TASK_INFO(tsk)->owner_env->start_timespec.tv_sec,
-+ tsk->start_time.tv_nsec -
-+ VE_TASK_INFO(tsk)->owner_env->start_timespec.tv_nsec);
-+ tsk->nvcsw = ti->cpt_nvcsw;
-+ tsk->nivcsw = ti->cpt_nivcsw;
-+ tsk->min_flt = ti->cpt_min_flt;
-+ tsk->maj_flt = ti->cpt_maj_flt;
-+
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
-+ tsk->cutime = ti->cpt_cutime;
-+ tsk->cstime = ti->cpt_cstime;
-+ tsk->cnvcsw = ti->cpt_cnvcsw;
-+ tsk->cnivcsw = ti->cpt_cnivcsw;
-+ tsk->cmin_flt = ti->cpt_cmin_flt;
-+ tsk->cmaj_flt = ti->cpt_cmaj_flt;
-+#endif
-+
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
-+ if (RLIM_NLIMITS > CPT_RLIM_NLIMITS)
-+ __asm__("undefined\n");
-+
-+ for (i=0; i<RLIM_NLIMITS; i++) {
-+ tsk->rlim[i].rlim_cur = ti->cpt_rlim_cur[i];
-+ tsk->rlim[i].rlim_max = ti->cpt_rlim_max[i];
-+ }
-+#endif
-+
-+ for (i=0; i<3; i++) {
-+ if (i >= GDT_ENTRY_TLS_ENTRIES) {
-+ eprintk_ctx("too many tls descs\n");
-+ } else {
-+#ifndef CONFIG_X86_64
-+ tsk->thread.tls_array[i].a = ti->cpt_tls[i]&0xFFFFFFFF;
-+ tsk->thread.tls_array[i].b = ti->cpt_tls[i]>>32;
-+#else
-+ tsk->thread.tls_array[i] = ti->cpt_tls[i];
-+#endif
-+ }
-+ }
-+
-+ tsk->used_math = 0;
-+
-+ b = (void *)(ti+1);
-+ while ((void*)b < ((void*)ti) + ti->cpt_next) {
-+ /* Siginfo objects are at the end of obj array */
-+ if (b->cpt_object == CPT_OBJ_SIGINFO) {
-+ struct ve_struct *env = set_exec_env(VE_TASK_INFO(tsk)->owner_env);
-+ restore_sigqueue(tsk, &tsk->pending, (unsigned long)b, (unsigned long)ti + ti->cpt_next);
-+ set_exec_env(env);
-+ break;
-+ }
-+
-+ switch (b->cpt_object) {
-+ case CPT_OBJ_BITS:
-+ if (b->cpt_content == CPT_CONTENT_X86_FPUSTATE &&
-+ cpu_has_fxsr) {
-+ memcpy(&tsk->thread.i387,
-+ (void*)b + b->cpt_hdrlen,
-+ sizeof(struct i387_fxsave_struct));
-+ tsk->used_math = ti->cpt_used_math;
-+ }
-+#ifndef CONFIG_X86_64
-+ else if (b->cpt_content == CPT_CONTENT_X86_FPUSTATE_OLD &&
-+ !cpu_has_fxsr) {
-+ memcpy(&tsk->thread.i387,
-+ (void*)b + b->cpt_hdrlen,
-+ sizeof(struct i387_fsave_struct));
-+ tsk->used_math = ti->cpt_used_math;
-+ }
-+#endif
-+ break;
-+ case CPT_OBJ_LASTSIGINFO:
-+ lsi = (void*)b;
-+ break;
-+ case CPT_OBJ_X86_REGS:
-+ case CPT_OBJ_X86_64_REGS:
-+ if (restore_registers(tsk, regs, ti, (void*)b)) {
-+ eprintk_ctx("cannot restore registers: image is corrupted\n");
-+ return -EINVAL;
-+ }
-+ break;
-+ case CPT_OBJ_SIGALTSTACK: {
-+ struct cpt_sigaltstack_image *sas;
-+ sas = (struct cpt_sigaltstack_image *)b;
-+ tsk->sas_ss_sp = sas->cpt_stack;
-+ tsk->sas_ss_size = sas->cpt_stacksize;
-+ break;
-+ }
-+ }
-+ b = ((void*)b) + b->cpt_next;
-+ }
-+
-+ if (ti->cpt_ppid != ti->cpt_rppid) {
-+ task_t *parent;
-+ struct ve_struct *env = set_exec_env(VE_TASK_INFO(tsk)->owner_env);
-+ write_lock_irq(&tasklist_lock);
-+ parent = find_task_by_pid_ve(ti->cpt_ppid);
-+ if (parent && parent != tsk->parent) {
-+ list_add(&tsk->ptrace_list, &tsk->parent->ptrace_children);
-+ REMOVE_LINKS(tsk);
-+ tsk->parent = parent;
-+ SET_LINKS(tsk);
-+ }
-+ write_unlock_irq(&tasklist_lock);
-+ set_exec_env(env);
-+ }
-+
-+ tsk->ptrace_message = ti->cpt_ptrace_message;
-+ tsk->pn_state = ti->cpt_pn_state;
-+ tsk->stopped_state = ti->cpt_stopped_state;
-+ tsk->sigsuspend_state = ti->cpt_sigsuspend_state;
-+ tsk->thread_info->flags = ti->cpt_thrflags;
-+
-+#ifdef CONFIG_X86_64
-+ tsk->thread_info->flags |= _TIF_FORK;
-+ if (!ti->cpt_64bit)
-+ tsk->thread_info->flags |= _TIF_IA32;
-+#endif
-+
-+#ifndef CONFIG_X86_64
-+ do {
-+ if (regs->orig_eax == __NR__newselect && regs->edi) {
-+ struct timeval tv;
-+ if (access_process_vm(tsk, regs->edi, &tv,
-+ sizeof(tv), 0) != sizeof(tv)) {
-+ wprintk_ctx("task %d/%d(%s): Error 1 in access_process_vm: edi %ld\n",
-+ virt_pid(tsk), tsk->pid, tsk->comm,
-+ regs->edi);
-+ break;
-+ }
-+ dprintk_ctx("task %d/%d(%s): Old timeval in newselect: %ld.%ld\n",
-+ virt_pid(tsk), tsk->pid, tsk->comm,
-+ tv.tv_sec, tv.tv_usec);
-+ tv.tv_sec -= ctx->delta_time.tv_sec;
-+ if (tv.tv_usec < ctx->delta_time.tv_nsec / 1000) {
-+ tv.tv_usec += 1000000 - ctx->delta_time.tv_nsec / 1000;
-+ tv.tv_sec--;
-+ } else {
-+ tv.tv_usec -= ctx->delta_time.tv_nsec / 1000;
-+ }
-+ if (tv.tv_sec < 0) {
-+ tv.tv_sec = 0;
-+ tv.tv_usec = 0;
-+ }
-+ dprintk_ctx("task %d/%d(%s): New timeval in newselect: %ld.%ld\n",
-+ virt_pid(tsk), tsk->pid, tsk->comm,
-+ tv.tv_sec, tv.tv_usec);
-+ if (access_process_vm(tsk, regs->edi, &tv,
-+ sizeof(tv), 1) != sizeof(tv)) {
-+ wprintk_ctx("task %d/%d(%s): Error 1 in access_process_vm write: edi %ld\n",
-+ virt_pid(tsk), tsk->pid, tsk->comm, regs->edi);
-+ }
-+
-+ } else if (regs->orig_eax == __NR_select && regs->edi) {
-+ struct {
-+ unsigned long n;
-+ fd_set __user *inp, *outp, *exp;
-+ struct timeval __user *tvp;
-+ } a;
-+ struct timeval tv;
-+ if (access_process_vm(tsk, regs->ebx, &a,
-+ sizeof(a), 0) != sizeof(a)) {
-+ wprintk_ctx("task %d: Error 2 in access_process_vm\n", tsk->pid);
-+ break;
-+ }
-+ if (access_process_vm(tsk, (unsigned long)a.tvp,
-+ &tv, sizeof(tv), 0) != sizeof(tv)) {
-+ wprintk_ctx("task %d: Error 3 in access_process_vm\n", tsk->pid);
-+ break;
-+ }
-+ dprintk_ctx("task %d: Old timeval in select: %ld.%ld\n",
-+ tsk->pid, tv.tv_sec, tv.tv_usec);
-+ tv.tv_sec -= ctx->delta_time.tv_sec;
-+ if (tv.tv_usec < ctx->delta_time.tv_nsec / 1000) {
-+ tv.tv_usec += 1000000 - ctx->delta_time.tv_nsec / 1000;
-+ tv.tv_sec--;
-+ } else {
-+ tv.tv_usec -= ctx->delta_time.tv_nsec / 1000;
-+ }
-+ if (tv.tv_sec < 0) {
-+ tv.tv_sec = 0;
-+ tv.tv_usec = 0;
-+ }
-+ dprintk_ctx("task %d: New timeval in select: %ld.%ld\n",
-+ tsk->pid, tv.tv_sec, tv.tv_usec);
-+ if (access_process_vm(tsk, (unsigned long)a.tvp,
-+ &tv, sizeof(tv), 1) != sizeof(tv)) {
-+ wprintk_ctx("task %d: Error 3 in access_process_vm write\n", tsk->pid);
-+ }
-+ }
-+ } while (0);
-+#endif
-+
-+ if (!tsk->exit_state && (long)SYSCALL_NR(regs) >= 0) {
-+ if (SYSCALL_RETVAL(regs) == -ERESTARTSYS ||
-+ SYSCALL_RETVAL(regs) == -ERESTARTNOINTR ||
-+ SYSCALL_RETVAL(regs) == -ERESTARTNOHAND ||
-+ SYSCALL_RETVAL(regs) == -ERESTART_RESTARTBLOCK ||
-+ syscall_is(tsk,regs,pause) ||
-+ (syscall_is(tsk,regs,rt_sigtimedwait) &&
-+ (SYSCALL_RETVAL(regs) == -EAGAIN || SYSCALL_RETVAL(regs) == -EINTR)) ||
-+ (syscall_is(tsk,regs,futex) &&
-+ (SYSCALL_RETVAL(regs) == -EINTR)))
-+ add_hook(tsk, ret_restart_sys, 0, &hooks);
-+ }
-+
-+ if (tsk->sigsuspend_state) {
-+ dprintk_ctx("sigsuspend\n");
-+ add_hook(tsk, ret_finish_sigsuspend, 0, &hooks);
-+ }
-+
-+ if (lsi || tsk->pn_state) {
-+ /* ... -> ptrace_notify()
-+ * or
-+ * ... -> do_signal() -> get_signal_to_deliver() ->
-+ * ptrace stop
-+ */
-+ tsk->last_siginfo = add_hook(tsk, ret_last_siginfo, sizeof(siginfo_t), &hooks);
-+ memset(tsk->last_siginfo, 0, sizeof(siginfo_t));
-+ if (lsi)
-+ decode_siginfo(tsk->last_siginfo, lsi);
-+ }
-+
-+ tsk->ptrace = ti->cpt_ptrace;
-+ tsk->flags = ti->cpt_flags & ~PF_FROZEN;
-+ clear_tsk_thread_flag(tsk, TIF_FREEZE);
-+ tsk->exit_signal = ti->cpt_exit_signal;
-+
-+ if (tsk->stopped_state) {
-+ dprintk_ctx("finish_stop\n");
-+ if (ti->cpt_state != TASK_STOPPED)
-+ eprintk_ctx("Hellooo, state is %u\n", (unsigned)ti->cpt_state);
-+ add_hook(tsk, ret_finish_stop, 0, &hooks);
-+ }
-+
-+ if (!tsk->exit_state &&
-+ (ti->cpt_set_tid || ti->cpt_clear_tid)) {
-+ unsigned long *ptr = add_hook(tsk, ret_child_tid, sizeof(unsigned long)*2, &hooks);
-+ ptr[0] = ti->cpt_clear_tid;
-+ ptr[1] = ti->cpt_set_tid;
-+ dprintk_ctx("settids\n");
-+ }
-+
-+#ifdef CONFIG_X86_64
-+ if (!hooks && (long)SYSCALL_NR(regs) < 0) {
-+ extern void ret_from_fork2(void);
-+ ESP(tsk) -= sizeof(unsigned long);
-+ *(unsigned long*)ESP(tsk) = (unsigned long)ret_from_fork2;
-+ tsk->thread_info->flags |= _TIF_RESUME;
-+ }
-+#else
-+ tsk->thread.esp -= 4;
-+ *(__u32*)tsk->thread.esp = tsk->thread.eip;
-+ tsk->thread.eip = (unsigned long)pre_ret_from_fork;
-+#endif
-+
-+ if (ti->cpt_state == TASK_TRACED)
-+ tsk->state = TASK_TRACED;
-+ else if (ti->cpt_state & (EXIT_ZOMBIE|EXIT_DEAD)) {
-+ tsk->it_virt_value = 0;
-+ tsk->it_prof_value = 0;
-+ if (tsk->state != EXIT_DEAD)
-+ eprintk_ctx("oops, schedule() did not make us dead\n");
-+ }
-+
-+ if (ti->cpt_it_real_value &&
-+ !(ti->cpt_state & (EXIT_ZOMBIE|EXIT_DEAD))) {
-+ unsigned long tmo;
-+ s64 val = ti->cpt_it_real_value;
-+ if (ctx->image_version < CPT_VERSION_9)
-+ val *= TICK_NSEC;
-+ val -= ctx->delta_nsec;
-+ if (val <= 0)
-+ val = TICK_NSEC;
-+ tmo = _ns_to_jiffies(val + TICK_NSEC - 1);
-+ mod_timer(&tsk->real_timer, (unsigned long)ctx->cpt_jiffies64 + tmo);
-+ dprintk_ctx("itimer " CPT_FID " +%lu %lu %lu %lu %lu %lu\n", CPT_TID(tsk),
-+ tmo,
-+ (unsigned long)ctx->cpt_jiffies64 + tmo, jiffies,
-+ (unsigned long)ti->cpt_restart.arg0, timespec_to_jiffies(&ctx->delta_time), (unsigned long)ctx->cpt_jiffies64);
-+ }
-+
-+ module_put(THIS_MODULE);
-+ }
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_socket.c linux-2.6.9-ve023stab030/kernel/cpt/rst_socket.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_socket.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_socket.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,806 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/namei.h>
-+#include <linux/socket.h>
-+#include <linux/un.h>
-+#include <net/tcp.h>
-+#include <net/sock.h>
-+#include <net/scm.h>
-+#include <net/af_unix.h>
-+
-+#include <ub/ub_mem.h>
-+#include <ub/ub_orphan.h>
-+#include <ub/ub_orphan.h>
-+#include <ub/ub_net.h>
-+#include <ub/ub_tcp.h>
-+
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_socket.h"
-+#include "cpt_kernel.h"
-+
-+#include "cpt_syscalls.h"
-+
-+
-+static int setup_sock_common(struct sock *sk, struct cpt_sock_image *si,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ if (sk->sk_socket) {
-+ sk->sk_socket->passcred = si->cpt_passcred;
-+ sk->sk_socket->flags = si->cpt_ssflags;
-+ sk->sk_socket->state = si->cpt_sstate;
-+ }
-+ sk->sk_reuse = si->cpt_reuse;
-+ sk->sk_shutdown = si->cpt_shutdown;
-+ sk->sk_userlocks = si->cpt_userlocks;
-+ sk->sk_no_check = si->cpt_no_check;
-+ sk->sk_debug = si->cpt_debug;
-+ sk->sk_rcvtstamp = si->cpt_rcvtstamp;
-+ sk->sk_localroute = si->cpt_localroute;
-+ sk->sk_protocol = si->cpt_protocol;
-+ sk->sk_err = si->cpt_err;
-+ sk->sk_err_soft = si->cpt_err_soft;
-+ sk->sk_priority = si->cpt_priority;
-+ sk->sk_rcvlowat = si->cpt_rcvlowat;
-+ sk->sk_rcvtimeo = si->cpt_rcvtimeo;
-+ if (si->cpt_rcvtimeo == CPT_NULL)
-+ sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
-+ sk->sk_sndtimeo = si->cpt_sndtimeo;
-+ if (si->cpt_sndtimeo == CPT_NULL)
-+ sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
-+ sk->sk_rcvbuf = si->cpt_rcvbuf;
-+ sk->sk_sndbuf = si->cpt_sndbuf;
-+ sk->sk_bound_dev_if = si->cpt_bound_dev_if;
-+ sk->sk_flags = si->cpt_flags;
-+ sk->sk_lingertime = si->cpt_lingertime;
-+ if (si->cpt_lingertime == CPT_NULL)
-+ sk->sk_lingertime = MAX_SCHEDULE_TIMEOUT;
-+ sk->sk_peercred.pid = si->cpt_peer_pid;
-+ sk->sk_peercred.uid = si->cpt_peer_uid;
-+ sk->sk_peercred.gid = si->cpt_peer_gid;
-+ cpt_timeval_import(&sk->sk_stamp, si->cpt_stamp);
-+ return 0;
-+}
-+
-+static struct file *sock_mapfile(struct socket *sock)
-+{
-+ int fd = sock_map_fd(sock);
-+
-+ if (fd >= 0) {
-+ struct file *file = sock->file;
-+ get_file(file);
-+ sc_close(fd);
-+ return file;
-+ }
-+ return ERR_PTR(fd);
-+}
-+
-+/* Assumption is that /tmp exists and writable.
-+ * In previous versions we assumed that listen() will autobind
-+ * the socket. It does not do this for AF_UNIX by evident reason:
-+ * socket in abstract namespace is accessible, unlike socket bound
-+ * to deleted FS object.
-+ */
-+
-+static int
-+select_deleted_name(char * name, cpt_context_t *ctx)
-+{
-+ int i;
-+
-+ for (i=0; i<100; i++) {
-+ struct nameidata nd;
-+ unsigned int rnd = net_random();
-+
-+ sprintf(name, "/tmp/SOCK.%08x", rnd);
-+
-+ if (path_lookup(name, 0, &nd) != 0)
-+ return 0;
-+
-+ path_release(&nd);
-+ }
-+
-+ eprintk_ctx("failed to allocate deleted socket inode\n");
-+ return -ELOOP;
-+}
-+
-+static int
-+bind_unix_socket(struct socket *sock, struct cpt_sock_image *si,
-+ cpt_context_t *ctx)
-+{
-+ int err;
-+ char *name;
-+ struct sockaddr* addr;
-+ int addrlen;
-+ struct sockaddr_un sun;
-+ struct nameidata nd;
-+
-+ if ((addrlen = si->cpt_laddrlen) <= 2)
-+ return 0;
-+
-+ nd.dentry = NULL;
-+ name = ((char*)si->cpt_laddr) + 2;
-+ addr = (struct sockaddr *)si->cpt_laddr;
-+
-+ if (name[0]) {
-+ if (path_lookup(name, 0, &nd))
-+ nd.dentry = NULL;
-+
-+ if (si->cpt_deleted) {
-+ if (nd.dentry == NULL &&
-+ sock->ops->bind(sock, addr, addrlen) == 0) {
-+ sc_unlink(name);
-+ return 0;
-+ }
-+
-+ addr = (struct sockaddr*)&sun;
-+ addr->sa_family = AF_UNIX;
-+ name = ((char*)addr) + 2;
-+ err = select_deleted_name(name, ctx);
-+ if (err)
-+ goto out;
-+ addrlen = 2 + strlen(name);
-+ } else if (nd.dentry) {
-+ if (!S_ISSOCK(nd.dentry->d_inode->i_mode)) {
-+ eprintk_ctx("bind_unix_socket: not a socket dentry\n");
-+ err = -EINVAL;
-+ goto out;
-+ }
-+ sc_unlink(name);
-+ }
-+ }
-+
-+ err = sock->ops->bind(sock, addr, addrlen);
-+
-+ if (!err && name[0]) {
-+ if (nd.dentry) {
-+ sc_chown(name, nd.dentry->d_inode->i_uid,
-+ nd.dentry->d_inode->i_gid);
-+ sc_chmod(name, nd.dentry->d_inode->i_mode);
-+ }
-+ if (si->cpt_deleted)
-+ sc_unlink(name);
-+ }
-+
-+out:
-+ if (nd.dentry)
-+ path_release(&nd);
-+ return err;
-+}
-+
-+static int fixup_unix_address(struct socket *sock, struct cpt_sock_image *si,
-+ struct cpt_context *ctx)
-+{
-+ struct sock *sk = sock->sk;
-+ cpt_object_t *obj;
-+ struct sock *parent;
-+
-+ if (sk->sk_family != AF_UNIX || sk->sk_state == TCP_LISTEN)
-+ return 0;
-+
-+ if (si->cpt_parent == -1)
-+ return bind_unix_socket(sock, si, ctx);
-+
-+ obj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, si->cpt_parent, ctx);
-+ if (!obj)
-+ return 0;
-+
-+ parent = obj->o_obj;
-+ if (unix_sk(parent)->addr) {
-+ if (unix_sk(sk)->addr &&
-+ atomic_dec_and_test(&unix_sk(sk)->addr->refcnt))
-+ kfree(unix_sk(sk)->addr);
-+ atomic_inc(&unix_sk(parent)->addr->refcnt);
-+ unix_sk(sk)->addr = unix_sk(parent)->addr;
-+ }
-+ return 0;
-+}
-+
-+
-+static int open_socket(cpt_object_t *obj, struct cpt_sock_image *si,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ struct socket *sock;
-+ struct socket *sock2 = NULL;
-+ struct file *file;
-+ cpt_object_t *fobj;
-+ cpt_object_t *pobj = NULL;
-+
-+ err = sock_create_kern(si->cpt_family, si->cpt_type, si->cpt_protocol,
-+ &sock);
-+ if (err)
-+ return err;
-+
-+ if (si->cpt_socketpair) {
-+ err = sock_create_kern(si->cpt_family, si->cpt_type,
-+ si->cpt_protocol, &sock2);
-+ if (err)
-+ goto err_out;
-+
-+ err = sock->ops->socketpair(sock, sock2);
-+ if (err < 0)
-+ goto err_out;
-+
-+ /* Socketpair with a peer outside our environment.
-+ * So, we create real half-open pipe and do not worry
-+ * about dead end anymore. */
-+ if (si->cpt_peer == -1) {
-+ sock_release(sock2);
-+ sock2 = NULL;
-+ }
-+ }
-+
-+ cpt_obj_setobj(obj, sock->sk, ctx);
-+
-+ if (si->cpt_file != CPT_NULL) {
-+ file = sock_mapfile(sock);
-+ err = PTR_ERR(file);
-+ if (IS_ERR(file))
-+ goto err_out;
-+
-+ err = -ENOMEM;
-+
-+ obj->o_parent = file;
-+
-+ if ((fobj = cpt_object_add(CPT_OBJ_FILE, file, ctx)) == NULL)
-+ goto err_out;
-+ cpt_obj_setpos(fobj, si->cpt_file, ctx);
-+ cpt_obj_setindex(fobj, si->cpt_index, ctx);
-+ }
-+
-+ if (sock2) {
-+ struct file *file2;
-+
-+ pobj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, si->cpt_peer, ctx);
-+ if (!pobj) BUG();
-+ if (pobj->o_obj) BUG();
-+ cpt_obj_setobj(pobj, sock2->sk, ctx);
-+
-+ if (pobj->o_ppos != CPT_NULL) {
-+ file2 = sock_mapfile(sock2);
-+ err = PTR_ERR(file2);
-+ if (IS_ERR(file2))
-+ goto err_out;
-+
-+ err = -ENOMEM;
-+ if ((fobj = cpt_object_add(CPT_OBJ_FILE, file2, ctx)) == NULL)
-+ goto err_out;
-+ cpt_obj_setpos(fobj, pobj->o_ppos, ctx);
-+ cpt_obj_setindex(fobj, si->cpt_peer, ctx);
-+
-+ pobj->o_parent = file2;
-+ }
-+ }
-+
-+ setup_sock_common(sock->sk, si, obj->o_pos, ctx);
-+ if (sock->sk->sk_family == AF_INET || sock->sk->sk_family == AF_INET6) {
-+ int saved_reuse = sock->sk->sk_reuse;
-+
-+ inet_sk(sock->sk)->freebind = 1;
-+ sock->sk->sk_reuse = 2;
-+ if (si->cpt_laddrlen) {
-+ err = sock->ops->bind(sock, (struct sockaddr *)&si->cpt_laddr, si->cpt_laddrlen);
-+ if (err) {
-+ dprintk_ctx("binding failed: %d, do not worry\n", err);
-+ }
-+ }
-+ sock->sk->sk_reuse = saved_reuse;
-+ rst_socket_in(si, obj->o_pos, sock->sk, ctx);
-+ } else if (sock->sk->sk_family == AF_NETLINK) {
-+ err = sock->ops->bind(sock, (struct sockaddr *)&si->cpt_laddr, si->cpt_laddrlen);
-+ if (err) {
-+ eprintk_ctx("AF_NETLINK binding failed: %d\n", err);
-+ }
-+ if (si->cpt_raddrlen) {
-+ err = sock->ops->connect(sock, (struct sockaddr *)&si->cpt_raddr, si->cpt_raddrlen, O_NONBLOCK);
-+ if (err) {
-+ eprintk_ctx("oops, AF_NETLINK connect failed: %d\n", err);
-+ }
-+ }
-+ }
-+ fixup_unix_address(sock, si, ctx);
-+
-+ if (sock2) {
-+ err = rst_get_object(CPT_OBJ_SOCKET, pobj->o_pos, si, ctx);
-+ if (err)
-+ return err;
-+ setup_sock_common(sock2->sk, si, pobj->o_pos, ctx);
-+ fixup_unix_address(sock2, si, ctx);
-+ }
-+
-+ if ((sock->sk->sk_family == AF_INET || sock->sk->sk_family == AF_INET6)
-+ && (int)si->cpt_parent != -1) {
-+ cpt_object_t *lobj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, si->cpt_parent, ctx);
-+ if (lobj && cpt_attach_accept(lobj->o_obj, sock->sk, ctx) == 0)
-+ sock->sk = NULL;
-+ }
-+
-+
-+ if (si->cpt_file == CPT_NULL && sock->sk &&
-+ sock->sk->sk_family == AF_INET) {
-+ struct sock *sk = sock->sk;
-+
-+ if (sk) {
-+ sock->sk = NULL;
-+
-+ local_bh_disable();
-+ bh_lock_sock(sk);
-+ if (sock_owned_by_user(sk))
-+ eprintk_ctx("oops, sock is locked by user\n");
-+
-+ sock_hold(sk);
-+ sock_orphan(sk);
-+ tcp_inc_orphan_count(sk);
-+ bh_unlock_sock(sk);
-+ local_bh_enable();
-+ sock_put(sk);
-+ dprintk_ctx("orphaning socket %p\n", sk);
-+ }
-+ }
-+
-+ if (si->cpt_file == CPT_NULL && sock->sk == NULL)
-+ sock_release(sock);
-+
-+ return 0;
-+
-+err_out:
-+ if (sock2)
-+ sock_release(sock2);
-+ sock_release(sock);
-+ return err;
-+}
-+
-+static int open_listening_socket(loff_t pos, struct cpt_sock_image *si,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ struct socket *sock;
-+ struct file *file;
-+ cpt_object_t *obj, *fobj;
-+
-+ err = sock_create_kern(si->cpt_family, si->cpt_type, si->cpt_protocol,
-+ &sock);
-+ if (err) {
-+ eprintk_ctx("open_listening_socket: sock_create_kern: %d\n", err);
-+ return err;
-+ }
-+
-+ sock->sk->sk_reuse = 2;
-+ sock->sk->sk_bound_dev_if = si->cpt_bound_dev_if;
-+
-+ if (sock->sk->sk_family == AF_UNIX) {
-+ err = bind_unix_socket(sock, si, ctx);
-+ } else if (si->cpt_laddrlen) {
-+ if (sock->sk->sk_family == AF_INET || sock->sk->sk_family == AF_INET6)
-+ inet_sk(sock->sk)->freebind = 1;
-+
-+ err = sock->ops->bind(sock, (struct sockaddr *)&si->cpt_laddr, si->cpt_laddrlen);
-+
-+ if (err) {
-+ eprintk_ctx("open_listening_socket: bind: %d\n", err);
-+ goto err_out;
-+ }
-+ }
-+
-+ err = sock->ops->listen(sock, si->cpt_max_ack_backlog);
-+ if (err) {
-+ eprintk_ctx("open_listening_socket: listen: %d, %Ld, %d\n", err, pos, si->cpt_deleted);
-+ goto err_out;
-+ }
-+
-+ /* Now we may access socket body directly and fixup all the things. */
-+
-+ file = sock_mapfile(sock);
-+ err = PTR_ERR(file);
-+ if (IS_ERR(file)) {
-+ eprintk_ctx("open_listening_socket: map: %d\n", err);
-+ goto err_out;
-+ }
-+
-+ err = -ENOMEM;
-+ if ((fobj = cpt_object_add(CPT_OBJ_FILE, file, ctx)) == NULL)
-+ goto err_out;
-+ if ((obj = cpt_object_add(CPT_OBJ_SOCKET, sock->sk, ctx)) == NULL)
-+ goto err_out;
-+ cpt_obj_setpos(obj, pos, ctx);
-+ cpt_obj_setindex(obj, si->cpt_index, ctx);
-+ obj->o_parent = file;
-+ cpt_obj_setpos(fobj, si->cpt_file, ctx);
-+ cpt_obj_setindex(fobj, si->cpt_index, ctx);
-+
-+ setup_sock_common(sock->sk, si, pos, ctx);
-+
-+ if (si->cpt_family == AF_INET || si->cpt_family == AF_INET6)
-+ rst_restore_synwait_queue(sock->sk, si, pos, ctx);
-+
-+ return 0;
-+
-+err_out:
-+ sock_release(sock);
-+ return err;
-+}
-+
-+int rst_sock_attr(loff_t *pos_p, struct sock *sk, cpt_context_t *ctx)
-+{
-+ int err;
-+ struct sk_filter *fp, *old_fp;
-+ loff_t pos = *pos_p;
-+ struct cpt_obj_bits v;
-+
-+ err = rst_get_object(CPT_OBJ_SKFILTER, pos, &v, ctx);
-+ if (err)
-+ return err;
-+
-+ *pos_p += v.cpt_next;
-+
-+ if (v.cpt_size % sizeof(struct sock_filter))
-+ return -EINVAL;
-+
-+ fp = sock_kmalloc(sk, v.cpt_size+sizeof(*fp), GFP_KERNEL_UBC);
-+ if (fp == NULL)
-+ return -ENOMEM;
-+ atomic_set(&fp->refcnt, 1);
-+ fp->len = v.cpt_size/sizeof(struct sock_filter);
-+
-+ err = ctx->pread(fp->insns, v.cpt_size, ctx, pos+v.cpt_hdrlen);
-+ if (err) {
-+ sk_filter_release(sk, fp);
-+ return err;
-+ }
-+
-+ old_fp = sk->sk_filter;
-+ sk->sk_filter = fp;
-+ if (old_fp)
-+ sk_filter_release(sk, old_fp);
-+ return 0;
-+}
-+
-+struct sk_buff * rst_skb(loff_t *pos_p, __u32 *owner, __u32 *queue, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct sk_buff *skb;
-+ struct cpt_skb_image v;
-+ loff_t pos = *pos_p;
-+ struct scm_fp_list *fpl = NULL;
-+
-+ err = rst_get_object(CPT_OBJ_SKB, pos, &v, ctx);
-+ if (err)
-+ return ERR_PTR(err);
-+ *pos_p = pos + v.cpt_next;
-+
-+ if (owner)
-+ *owner = v.cpt_owner;
-+ if (queue)
-+ *queue = v.cpt_queue;
-+
-+ skb = alloc_skb(v.cpt_len + v.cpt_hspace + v.cpt_tspace, GFP_KERNEL);
-+ if (skb == NULL)
-+ return ERR_PTR(-ENOMEM);
-+ skb_reserve(skb, v.cpt_hspace);
-+ skb_put(skb, v.cpt_len);
-+ skb->h.raw = skb->head + v.cpt_h;
-+ skb->nh.raw = skb->head + v.cpt_nh;
-+ skb->mac.raw = skb->head + v.cpt_mac;
-+ memcpy(skb->cb, v.cpt_cb, sizeof(skb->cb));
-+ skb->mac_len = v.cpt_mac_len;
-+
-+ skb->csum = v.cpt_csum;
-+ skb->local_df = v.cpt_local_df;
-+ skb->pkt_type = v.cpt_pkt_type;
-+ skb->ip_summed = v.cpt_ip_summed;
-+ skb->priority = v.cpt_priority;
-+ skb->protocol = v.cpt_protocol;
-+ skb->security = v.cpt_security;
-+ cpt_timeval_import(&skb->stamp, v.cpt_stamp);
-+
-+ skb_shinfo(skb)->tso_segs = v.cpt_tso_segs;
-+ skb_shinfo(skb)->tso_size = v.cpt_tso_size;
-+ if (ctx->image_version == CPT_VERSION_8) {
-+ skb_shinfo(skb)->tso_segs = 1;
-+ skb_shinfo(skb)->tso_size = 0;
-+ }
-+
-+ if (v.cpt_next > v.cpt_hdrlen) {
-+ pos = pos + v.cpt_hdrlen;
-+ while (pos < *pos_p) {
-+ union {
-+ struct cpt_obj_bits b;
-+ struct cpt_fd_image f;
-+ } u;
-+
-+ err = rst_get_object(-1, pos, &u, ctx);
-+ if (err) {
-+ kfree_skb(skb);
-+ return ERR_PTR(err);
-+ }
-+ if (u.b.cpt_object == CPT_OBJ_BITS) {
-+ if (u.b.cpt_size != v.cpt_hspace + skb->len) {
-+ eprintk_ctx("invalid skb image %u != %u + %u\n", u.b.cpt_size, v.cpt_hspace, skb->len);
-+ kfree_skb(skb);
-+ return ERR_PTR(-EINVAL);
-+ }
-+
-+ err = ctx->pread(skb->head, u.b.cpt_size, ctx, pos+u.b.cpt_hdrlen);
-+ if (err) {
-+ kfree_skb(skb);
-+ return ERR_PTR(err);
-+ }
-+ } else if (u.f.cpt_object == CPT_OBJ_FILEDESC) {
-+ if (!fpl) {
-+ fpl = ub_kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);
-+ if (!fpl) {
-+ kfree_skb(skb);
-+ return ERR_PTR(-ENOMEM);
-+ }
-+ fpl->count = 0;
-+ UNIXCB(skb).fp = fpl;
-+ }
-+ fpl->fp[fpl->count] = rst_file(u.f.cpt_file, -1, ctx);
-+ if (!IS_ERR(fpl->fp[fpl->count]))
-+ fpl->count++;
-+ }
-+ pos += u.b.cpt_next;
-+ }
-+ }
-+
-+ return skb;
-+}
-+
-+static int restore_unix_rqueue(struct sock *sk, struct cpt_sock_image *si,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ loff_t endpos;
-+
-+ pos = pos + si->cpt_hdrlen;
-+ endpos = pos + si->cpt_next;
-+ while (pos < endpos) {
-+ struct sk_buff *skb;
-+ struct sock *owner_sk;
-+ __u32 owner;
-+
-+ skb = rst_skb(&pos, &owner, NULL, ctx);
-+ if (IS_ERR(skb)) {
-+ if (PTR_ERR(skb) == -EINVAL) {
-+ int err;
-+
-+ err = rst_sock_attr(&pos, sk, ctx);
-+ if (err)
-+ return err;
-+ }
-+ return PTR_ERR(skb);
-+ }
-+
-+ owner_sk = unix_peer(sk);
-+ if (owner != -1) {
-+ cpt_object_t *pobj;
-+ pobj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, owner, ctx);
-+ if (pobj == NULL) {
-+ eprintk_ctx("orphan af_unix skb?\n");
-+ kfree_skb(skb);
-+ continue;
-+ }
-+ owner_sk = pobj->o_obj;
-+ }
-+ if (owner_sk == NULL) {
-+ dprintk_ctx("orphan af_unix skb 2?\n");
-+ kfree_skb(skb);
-+ continue;
-+ }
-+ skb_set_owner_w(skb, owner_sk);
-+ if (UNIXCB(skb).fp)
-+ skb->destructor = unix_destruct_fds;
-+ skb_queue_tail(&sk->sk_receive_queue, skb);
-+ if (sk->sk_state == TCP_LISTEN) {
-+ struct socket *sock = skb->sk->sk_socket;
-+ if (sock == NULL) BUG();
-+ if (sock->file) BUG();
-+ skb->sk->sk_socket = NULL;
-+ skb->sk->sk_sleep = NULL;
-+ sock->sk = NULL;
-+ sock_release(sock);
-+ }
-+ }
-+ return 0;
-+}
-+
-+
-+/* All the sockets are created before we start to open files */
-+
-+int rst_sockets(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_SOCKET];
-+ loff_t endsec;
-+ cpt_object_t *obj;
-+ struct cpt_section_hdr h;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: ctx->pread: %d\n", err);
-+ return err;
-+ }
-+ if (h.cpt_section != CPT_SECT_SOCKET || h.cpt_hdrlen < sizeof(h)) {
-+ eprintk_ctx("rst_sockets: hdr err\n");
-+ return -EINVAL;
-+ }
-+
-+ /* The first pass: we create socket index and open listening sockets. */
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ struct cpt_sock_image *sbuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_SOCKET, sec, sbuf, ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: rst_get_object: %d\n", err);
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ if (sbuf->cpt_state == TCP_LISTEN) {
-+ err = open_listening_socket(sec, sbuf, ctx);
-+ cpt_release_buf(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: open_listening_socket: %d\n", err);
-+ return err;
-+ }
-+ } else {
-+ cpt_release_buf(ctx);
-+ obj = alloc_cpt_object(GFP_KERNEL, ctx);
-+ if (obj == NULL)
-+ return -ENOMEM;
-+ cpt_obj_setindex(obj, sbuf->cpt_index, ctx);
-+ cpt_obj_setpos(obj, sec, ctx);
-+ obj->o_ppos = sbuf->cpt_file;
-+ intern_cpt_object(CPT_OBJ_SOCKET, obj, ctx);
-+ }
-+ sec += sbuf->cpt_next;
-+ }
-+
-+ /* Pass 2: really restore sockets */
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct cpt_sock_image *sbuf;
-+ if (obj->o_obj != NULL)
-+ continue;
-+ sbuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_SOCKET, obj->o_pos, sbuf, ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: rst_get_object: %d\n", err);
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ if (sbuf->cpt_state == TCP_LISTEN) BUG();
-+ err = open_socket(obj, sbuf, ctx);
-+ cpt_release_buf(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: open_socket: %d\n", err);
-+ return err;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+int rst_orphans(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_ORPHANS];
-+ loff_t endsec;
-+ cpt_object_t *obj;
-+ struct cpt_section_hdr h;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_ORPHANS || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ struct cpt_sock_image *sbuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_SOCKET, sec, sbuf, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ obj = alloc_cpt_object(GFP_KERNEL, ctx);
-+ if (obj == NULL) {
-+ cpt_release_buf(ctx);
-+ return -ENOMEM;
-+ }
-+ obj->o_pos = sec;
-+ obj->o_ppos = sbuf->cpt_file;
-+ err = open_socket(obj, sbuf, ctx);
-+ dprintk_ctx("Restoring orphan: %d\n", err);
-+ free_cpt_object(obj, ctx);
-+ cpt_release_buf(ctx);
-+ if (err)
-+ return err;
-+ sec += sbuf->cpt_next;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+/* Pass 3: I understand, this is not funny already :-),
-+ * but we have to do another pass to establish links between
-+ * not-paired AF_UNIX SOCK_DGRAM sockets and to restore AF_UNIX
-+ * skb queues with proper skb->sk links.
-+ *
-+ * This could be made at the end of rst_sockets(), but we defer
-+ * restoring af_unix queues up to the end of restoring files to
-+ * make restoring passed FDs cleaner.
-+ */
-+
-+int rst_sockets_complete(struct cpt_context *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct cpt_sock_image *sbuf;
-+ struct sock *sk = obj->o_obj;
-+ struct sock *peer;
-+
-+ if (!sk) BUG();
-+
-+ if (sk->sk_family != AF_UNIX)
-+ continue;
-+
-+ sbuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_SOCKET, obj->o_pos, sbuf, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+
-+ if (sbuf->cpt_next > sbuf->cpt_hdrlen)
-+ restore_unix_rqueue(sk, sbuf, obj->o_pos, ctx);
-+
-+ cpt_release_buf(ctx);
-+
-+ if (sk->sk_type == SOCK_DGRAM && unix_peer(sk) == NULL) {
-+ cpt_object_t *pobj;
-+
-+ sbuf = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_SOCKET, obj->o_pos, sbuf, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+
-+ if (sbuf->cpt_peer != -1) {
-+ pobj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, sbuf->cpt_peer, ctx);
-+ if (pobj) {
-+ peer = pobj->o_obj;
-+ sock_hold(peer);
-+ unix_peer(sk) = peer;
-+ }
-+ }
-+ cpt_release_buf(ctx);
-+ }
-+ }
-+
-+ rst_orphans(ctx);
-+
-+ return 0;
-+}
-+
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_socket_in.c linux-2.6.9-ve023stab030/kernel/cpt/rst_socket_in.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_socket_in.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_socket_in.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,514 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/fs.h>
-+#include <linux/socket.h>
-+#include <linux/tcp.h>
-+#include <linux/jhash.h>
-+#include <net/sock.h>
-+#include <net/tcp.h>
-+#include <linux/ipv6.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_socket.h"
-+#include "cpt_kernel.h"
-+
-+static inline unsigned long jiffies_import(__u32 tmo)
-+{
-+ __s32 delta = tmo;
-+ return jiffies + (long)delta;
-+}
-+
-+static inline __u32 tcp_jiffies_import(__u32 tmo)
-+{
-+ return ((__u32)jiffies) + tmo;
-+}
-+
-+
-+static int restore_queues(struct sock *sk, struct cpt_sock_image *si,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ loff_t endpos;
-+
-+ pos = pos + si->cpt_hdrlen;
-+ endpos = pos + si->cpt_next;
-+ while (pos < endpos) {
-+ struct sk_buff *skb;
-+ __u32 type;
-+
-+ skb = rst_skb(&pos, NULL, &type, ctx);
-+ if (IS_ERR(skb)) {
-+ if (PTR_ERR(skb) == -EINVAL) {
-+ int err;
-+
-+ err = rst_sock_attr(&pos, sk, ctx);
-+ if (err)
-+ return err;
-+ }
-+ return PTR_ERR(skb);
-+ }
-+
-+ if (sk->sk_type == SOCK_STREAM) {
-+ if (type == CPT_SKB_RQ) {
-+ sk_stream_set_owner_r(skb, sk);
-+ ub_tcprcvbuf_charge_forced(sk, skb);
-+ skb_queue_tail(&sk->sk_receive_queue, skb);
-+ } else if (type == CPT_SKB_OFOQ) {
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ sk_stream_set_owner_r(skb, sk);
-+ ub_tcprcvbuf_charge_forced(sk, skb);
-+ skb_queue_tail(&tp->out_of_order_queue, skb);
-+ } else if (type == CPT_SKB_WQ) {
-+ sk->sk_wmem_queued += skb->truesize;
-+ sk->sk_forward_alloc -= skb->truesize;
-+ ub_tcpsndbuf_charge_forced(sk, skb);
-+ skb_queue_tail(&sk->sk_write_queue, skb);
-+ } else {
-+ wprintk_ctx("strange stream queue type %u\n", type);
-+ kfree_skb(skb);
-+ }
-+ } else {
-+ if (type == CPT_SKB_RQ) {
-+ skb_set_owner_r(skb, sk);
-+ skb_queue_tail(&sk->sk_receive_queue, skb);
-+ } else if (type == CPT_SKB_WQ) {
-+ struct inet_opt *inet = inet_sk(sk);
-+ if (inet->cork.fragsize) {
-+ skb_set_owner_w(skb, sk);
-+ skb_queue_tail(&sk->sk_write_queue, skb);
-+ } else {
-+ eprintk_ctx("cork skb is dropped\n");
-+ kfree_skb(skb);
-+ }
-+ } else {
-+ wprintk_ctx("strange dgram queue type %u\n", type);
-+ kfree_skb(skb);
-+ }
-+ }
-+ }
-+ return 0;
-+}
-+
-+static struct sock *find_parent(__u16 sport, cpt_context_t *ctx)
-+{
-+ cpt_object_t *obj;
-+ for_each_object(obj, CPT_OBJ_SOCKET) {
-+ struct sock *sk = obj->o_obj;
-+ if (sk &&
-+ sk->sk_state == TCP_LISTEN &&
-+ (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) &&
-+ inet_sk(sk)->sport == sport)
-+ return sk;
-+ }
-+ return NULL;
-+}
-+
-+static int rst_socket_tcp(struct cpt_sock_image *si, loff_t pos, struct sock *sk,
-+ struct cpt_context *ctx)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ struct sk_buff *skb;
-+ tp->pred_flags = si->cpt_pred_flags;
-+ tp->rcv_nxt = si->cpt_rcv_nxt;
-+ tp->snd_nxt = si->cpt_snd_nxt;
-+ tp->snd_una = si->cpt_snd_una;
-+ tp->snd_sml = si->cpt_snd_sml;
-+ tp->rcv_tstamp = tcp_jiffies_import(si->cpt_rcv_tstamp);
-+ tp->lsndtime = tcp_jiffies_import(si->cpt_lsndtime);
-+ tp->tcp_header_len = si->cpt_tcp_header_len;
-+ tp->ack.pending = si->cpt_ack_pending;
-+ tp->ack.quick = si->cpt_quick;
-+ tp->ack.pingpong = si->cpt_pingpong;
-+ tp->ack.blocked = si->cpt_blocked;
-+ tp->ack.ato = si->cpt_ato;
-+ tp->ack.timeout = jiffies_import(si->cpt_ack_timeout);
-+ tp->ack.lrcvtime = tcp_jiffies_import(si->cpt_lrcvtime);
-+ tp->ack.last_seg_size = si->cpt_last_seg_size;
-+ tp->ack.rcv_mss = si->cpt_rcv_mss;
-+ tp->snd_wl1 = si->cpt_snd_wl1;
-+ tp->snd_wnd = si->cpt_snd_wnd;
-+ tp->max_window = si->cpt_max_window;
-+ tp->pmtu_cookie = si->cpt_pmtu_cookie;
-+ tp->mss_cache = si->cpt_mss_cache;
-+ tp->mss_cache_std = si->cpt_mss_cache_std;
-+ tp->rx_opt.mss_clamp = si->cpt_mss_clamp;
-+ tp->ext_header_len = si->cpt_ext_header_len;
-+ tp->ext2_header_len = si->cpt_ext2_header_len;
-+ tp->ca_state = si->cpt_ca_state;
-+ tp->retransmits = si->cpt_retransmits;
-+ tp->reordering = si->cpt_reordering;
-+ tp->frto_counter = si->cpt_frto_counter;
-+ tp->frto_highmark = si->cpt_frto_highmark;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
-+ tp->adv_cong = si->cpt_adv_cong;
-+#endif
-+ tp->defer_accept = si->cpt_defer_accept;
-+ tp->backoff = si->cpt_backoff;
-+ tp->srtt = si->cpt_srtt;
-+ tp->mdev = si->cpt_mdev;
-+ tp->mdev_max = si->cpt_mdev_max;
-+ tp->rttvar = si->cpt_rttvar;
-+ tp->rtt_seq = si->cpt_rtt_seq;
-+ tp->rto = si->cpt_rto;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ tp->packets_out.val = si->cpt_packets_out;
-+ tp->left_out.val = si->cpt_left_out;
-+ tp->retrans_out.val = si->cpt_retrans_out;
-+ tp->lost_out.val = si->cpt_lost_out;
-+ tp->sacked_out.val = si->cpt_sacked_out;
-+ tp->fackets_out.val = si->cpt_fackets_out;
-+#else
-+ tp->packets_out = si->cpt_packets_out;
-+ tp->left_out = si->cpt_left_out;
-+ tp->retrans_out = si->cpt_retrans_out;
-+ tp->lost_out = si->cpt_lost_out;
-+ tp->sacked_out = si->cpt_sacked_out;
-+ tp->fackets_out = si->cpt_fackets_out;
-+#endif
-+ tp->snd_ssthresh = si->cpt_snd_ssthresh;
-+ tp->snd_cwnd = si->cpt_snd_cwnd;
-+ tp->snd_cwnd_cnt = si->cpt_snd_cwnd_cnt;
-+ tp->snd_cwnd_clamp = si->cpt_snd_cwnd_clamp;
-+ tp->snd_cwnd_used = si->cpt_snd_cwnd_used;
-+ tp->snd_cwnd_stamp = tcp_jiffies_import(si->cpt_snd_cwnd_stamp);
-+ tp->timeout = tcp_jiffies_import(si->cpt_timeout);
-+ tp->rcv_wnd = si->cpt_rcv_wnd;
-+ tp->rcv_wup = si->cpt_rcv_wup;
-+ tp->write_seq = si->cpt_write_seq;
-+ tp->pushed_seq = si->cpt_pushed_seq;
-+ tp->copied_seq = si->cpt_copied_seq;
-+ tp->rx_opt.tstamp_ok = si->cpt_tstamp_ok;
-+ tp->rx_opt.wscale_ok = si->cpt_wscale_ok;
-+ tp->rx_opt.sack_ok = si->cpt_sack_ok;
-+ tp->rx_opt.saw_tstamp = si->cpt_saw_tstamp;
-+ tp->rx_opt.snd_wscale = si->cpt_snd_wscale;
-+ tp->rx_opt.rcv_wscale = si->cpt_rcv_wscale;
-+ tp->nonagle = si->cpt_nonagle;
-+ tp->keepalive_probes = si->cpt_keepalive_probes;
-+ tp->rx_opt.rcv_tsval = si->cpt_rcv_tsval;
-+ tp->rx_opt.rcv_tsecr = si->cpt_rcv_tsecr;
-+ tp->rx_opt.ts_recent = si->cpt_ts_recent;
-+ tp->rx_opt.ts_recent_stamp = si->cpt_ts_recent_stamp;
-+ tp->rx_opt.user_mss = si->cpt_user_mss;
-+ tp->rx_opt.dsack = si->cpt_dsack;
-+ tp->rx_opt.eff_sacks = si->cpt_num_sacks;
-+ tp->duplicate_sack[0].start_seq = si->cpt_sack_array[0];
-+ tp->duplicate_sack[0].end_seq = si->cpt_sack_array[1];
-+ tp->selective_acks[0].start_seq = si->cpt_sack_array[2];
-+ tp->selective_acks[0].end_seq = si->cpt_sack_array[3];
-+ tp->selective_acks[1].start_seq = si->cpt_sack_array[4];
-+ tp->selective_acks[1].end_seq = si->cpt_sack_array[5];
-+ tp->selective_acks[2].start_seq = si->cpt_sack_array[6];
-+ tp->selective_acks[2].end_seq = si->cpt_sack_array[7];
-+ tp->selective_acks[3].start_seq = si->cpt_sack_array[8];
-+ tp->selective_acks[3].end_seq = si->cpt_sack_array[9];
-+
-+ tp->window_clamp = si->cpt_window_clamp;
-+ tp->rcv_ssthresh = si->cpt_rcv_ssthresh;
-+ tp->probes_out = si->cpt_probes_out;
-+ tp->rx_opt.num_sacks = si->cpt_num_sacks;
-+ tp->advmss = si->cpt_advmss;
-+ tp->syn_retries = si->cpt_syn_retries;
-+ tp->ecn_flags = si->cpt_ecn_flags;
-+ tp->prior_ssthresh = si->cpt_prior_ssthresh;
-+ tp->high_seq = si->cpt_high_seq;
-+ tp->retrans_stamp = si->cpt_retrans_stamp;
-+ tp->undo_marker = si->cpt_undo_marker;
-+ tp->undo_retrans = si->cpt_undo_retrans;
-+ tp->urg_seq = si->cpt_urg_seq;
-+ tp->urg_data = si->cpt_urg_data;
-+ tp->pending = si->cpt_pending;
-+ tp->urg_mode = si->cpt_urg_mode;
-+ tp->snd_up = si->cpt_snd_up;
-+ tp->keepalive_time = si->cpt_keepalive_time;
-+ tp->keepalive_intvl = si->cpt_keepalive_intvl;
-+ tp->linger2 = si->cpt_linger2;
-+
-+ sk->sk_send_head = NULL;
-+ for (skb = skb_peek(&sk->sk_write_queue);
-+ skb && skb != (struct sk_buff*)&sk->sk_write_queue;
-+ skb = skb->next) {
-+ if (!after(tp->snd_nxt, TCP_SKB_CB(skb)->seq)) {
-+ sk->sk_send_head = skb;
-+ break;
-+ }
-+ }
-+
-+ if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) {
-+ struct inet_opt *inet = inet_sk(sk);
-+ if (inet->num == 0) {
-+ cpt_object_t *lobj = NULL;
-+
-+ if ((int)si->cpt_parent != -1)
-+ lobj = lookup_cpt_obj_byindex(CPT_OBJ_SOCKET, si->cpt_parent, ctx);
-+
-+ if (lobj && lobj->o_obj) {
-+ inet->num = ntohs(inet->sport);
-+ tcp_inherit_port(lobj->o_obj, sk);
-+ dprintk_ctx("port inherited from parent\n");
-+ } else {
-+ struct sock *lsk = find_parent(inet->sport, ctx);
-+ if (lsk) {
-+ inet->num = ntohs(inet->sport);
-+ tcp_inherit_port(lsk, sk);
-+ dprintk_ctx("port inherited\n");
-+ } else {
-+ eprintk_ctx("we are kinda lost...\n");
-+ }
-+ }
-+ }
-+
-+ sk->sk_prot->hash(sk);
-+
-+ if (tp->ack.pending&TCP_ACK_TIMER)
-+ sk_reset_timer(sk, &tp->delack_timer, tp->ack.timeout);
-+ if (tp->pending)
-+ sk_reset_timer(sk, &tp->retransmit_timer, tp->timeout);
-+ if (sock_flag(sk, SOCK_KEEPOPEN)) {
-+ unsigned long expires = jiffies_import(si->cpt_ka_timeout);
-+ if (time_after(jiffies, expires))
-+ expires = jiffies + HZ;
-+ sk_reset_timer(sk, &sk->sk_timer, expires);
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+
-+int rst_socket_in(struct cpt_sock_image *si, loff_t pos, struct sock *sk,
-+ struct cpt_context *ctx)
-+{
-+ struct inet_opt *inet = inet_sk(sk);
-+
-+ lock_sock(sk);
-+
-+ sk->sk_state = si->cpt_state;
-+
-+ inet->daddr = si->cpt_daddr;
-+ inet->dport = si->cpt_dport;
-+ inet->saddr = si->cpt_saddr;
-+ inet->rcv_saddr = si->cpt_rcv_saddr;
-+ inet->sport = si->cpt_sport;
-+ inet->uc_ttl = si->cpt_uc_ttl;
-+ inet->tos = si->cpt_tos;
-+ inet->cmsg_flags = si->cpt_cmsg_flags;
-+ inet->mc_index = si->cpt_mc_index;
-+ inet->mc_addr = si->cpt_mc_addr;
-+ inet->hdrincl = si->cpt_hdrincl;
-+ inet->mc_ttl = si->cpt_mc_ttl;
-+ inet->mc_loop = si->cpt_mc_loop;
-+ inet->pmtudisc = si->cpt_pmtudisc;
-+ inet->recverr = si->cpt_recverr;
-+ inet->freebind = si->cpt_freebind;
-+ inet->id = si->cpt_idcounter;
-+
-+ inet->cork.flags = si->cpt_cork_flags;
-+ inet->cork.fragsize = si->cpt_cork_fragsize;
-+ inet->cork.length = si->cpt_cork_length;
-+ inet->cork.addr = si->cpt_cork_addr;
-+ inet->cork.fl.fl4_src = si->cpt_cork_saddr;
-+ inet->cork.fl.fl4_dst = si->cpt_cork_daddr;
-+ inet->cork.fl.oif = si->cpt_cork_oif;
-+ if (inet->cork.fragsize) {
-+ if (ip_route_output_key(&inet->cork.rt, &inet->cork.fl)) {
-+ eprintk_ctx("failed to restore cork route\n");
-+ inet->cork.fragsize = 0;
-+ }
-+ }
-+
-+ if (sk->sk_type == SOCK_DGRAM && sk->sk_protocol == IPPROTO_UDP) {
-+ struct udp_opt *up = udp_sk(sk);
-+ up->pending = si->cpt_udp_pending;
-+ up->corkflag = si->cpt_udp_corkflag;
-+ up->encap_type = si->cpt_udp_encap;
-+ up->len = si->cpt_udp_len;
-+ }
-+
-+ if (sk->sk_family == AF_INET6) {
-+ struct ipv6_pinfo *np = inet6_sk(sk);
-+
-+ memcpy(&np->saddr, si->cpt_saddr6, 16);
-+ memcpy(&np->rcv_saddr, si->cpt_rcv_saddr6, 16);
-+ memcpy(&np->daddr, si->cpt_daddr6, 16);
-+ np->flow_label = si->cpt_flow_label6;
-+ np->frag_size = si->cpt_frag_size6;
-+ np->hop_limit = si->cpt_hop_limit6;
-+ np->mcast_hops = si->cpt_mcast_hops6;
-+ np->mcast_oif = si->cpt_mcast_oif6;
-+ np->rxopt.all = si->cpt_rxopt6;
-+ np->mc_loop = si->cpt_mc_loop6;
-+ np->recverr = si->cpt_recverr6;
-+ np->sndflow = si->cpt_sndflow6;
-+ np->pmtudisc = si->cpt_pmtudisc6;
-+ np->ipv6only = si->cpt_ipv6only6;
-+
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+ if (si->cpt_mapped) {
-+ if (sk->sk_type == SOCK_STREAM &&
-+ sk->sk_protocol == IPPROTO_TCP) {
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ tp->af_specific = &ipv6_mapped;
-+ sk->sk_backlog_rcv = tcp_v4_do_rcv;
-+ }
-+ }
-+#endif
-+ }
-+
-+ restore_queues(sk, si, pos, ctx);
-+
-+ if (sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP)
-+ rst_socket_tcp(si, pos, sk, ctx);
-+
-+ release_sock(sk);
-+ return 0;
-+}
-+
-+int cpt_attach_accept(struct sock *lsk, struct sock *sk, cpt_context_t *ctx)
-+{
-+ struct open_request *req;
-+
-+ if (lsk->sk_state != TCP_LISTEN)
-+ return -EINVAL;
-+
-+ req = tcp_openreq_alloc();
-+ if (!req)
-+ return -ENOMEM;
-+
-+ memset(req, 0, sizeof(*req));
-+ sk->sk_socket = NULL;
-+ sk->sk_sleep = NULL;
-+ tcp_acceptq_queue(lsk, req, sk);
-+ return 0;
-+}
-+
-+static __inline__ u32 __tcp_v4_synq_hash(u32 raddr, u16 rport, u32 rnd)
-+{
-+ return (jhash_2words(raddr, (u32) rport, rnd) & (TCP_SYNQ_HSIZE - 1));
-+}
-+
-+static void __tcp_v4_synq_add(struct sock *sk, struct open_request *req)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ struct tcp_listen_opt *lopt = tp->listen_opt;
-+ u32 h = __tcp_v4_synq_hash(req->af.v4_req.rmt_addr, req->rmt_port, lopt->hash_rnd);
-+
-+ req->dl_next = lopt->syn_table[h];
-+
-+ write_lock(&tp->syn_wait_lock);
-+ lopt->syn_table[h] = req;
-+ write_unlock(&tp->syn_wait_lock);
-+
-+ tcp_synq_added(sk);
-+ if (req->retrans != 0)
-+ lopt->qlen_young--;
-+}
-+
-+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
-+static u32 tcp_v6_synq_hash(struct in6_addr *raddr, u16 rport, u32 rnd)
-+{
-+ u32 a, b, c;
-+
-+ a = raddr->s6_addr32[0];
-+ b = raddr->s6_addr32[1];
-+ c = raddr->s6_addr32[2];
-+
-+ a += JHASH_GOLDEN_RATIO;
-+ b += JHASH_GOLDEN_RATIO;
-+ c += rnd;
-+ __jhash_mix(a, b, c);
-+
-+ a += raddr->s6_addr32[3];
-+ b += (u32) rport;
-+ __jhash_mix(a, b, c);
-+
-+ return c & (TCP_SYNQ_HSIZE - 1);
-+}
-+
-+static void __tcp_v6_synq_add(struct sock *sk, struct open_request *req)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+ struct tcp_listen_opt *lopt = tp->listen_opt;
-+ u32 h = tcp_v6_synq_hash(&req->af.v6_req.rmt_addr, req->rmt_port, lopt->hash_rnd);
-+
-+ req->dl_next = lopt->syn_table[h];
-+
-+ write_lock(&tp->syn_wait_lock);
-+ lopt->syn_table[h] = req;
-+ write_unlock(&tp->syn_wait_lock);
-+
-+ tcp_synq_added(sk);
-+ if (req->retrans != 0)
-+ lopt->qlen_young--;
-+}
-+#endif
-+
-+int rst_restore_synwait_queue(struct sock *sk, struct cpt_sock_image *si,
-+ loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t end = si->cpt_next;
-+
-+ pos += si->cpt_hdrlen;
-+ while (pos < end) {
-+ struct cpt_openreq_image oi;
-+
-+ err = rst_get_object(CPT_OBJ_OPENREQ, pos, &oi, ctx);
-+ if (err) {
-+ err = rst_sock_attr(&pos, sk, ctx);
-+ if (err)
-+ return err;
-+ continue;
-+ }
-+
-+ if (oi.cpt_object == CPT_OBJ_OPENREQ) {
-+ struct open_request *req = tcp_openreq_alloc();
-+ if (req == NULL)
-+ return -ENOMEM;
-+
-+ memset(req, 0, sizeof(*req));
-+ req->rcv_isn = oi.cpt_rcv_isn;
-+ req->snt_isn = oi.cpt_snt_isn;
-+ req->rmt_port = oi.cpt_rmt_port;
-+ req->mss = oi.cpt_mss;
-+ req->retrans = oi.cpt_retrans;
-+ req->snd_wscale = oi.cpt_snd_wscale;
-+ req->rcv_wscale = oi.cpt_rcv_wscale;
-+ req->tstamp_ok = oi.cpt_tstamp_ok;
-+ req->sack_ok = oi.cpt_sack_ok;
-+ req->wscale_ok = oi.cpt_wscale_ok;
-+ req->ecn_ok = oi.cpt_ecn_ok;
-+ req->acked = oi.cpt_acked;
-+ req->window_clamp = oi.cpt_window_clamp;
-+ req->rcv_wnd = oi.cpt_rcv_wnd;
-+ req->ts_recent = oi.cpt_ts_recent;
-+ req->expires = jiffies_import(oi.cpt_expires);
-+
-+ if (oi.cpt_family == AF_INET) {
-+ memcpy(&req->af.v4_req.loc_addr, oi.cpt_loc_addr, 4);
-+ memcpy(&req->af.v4_req.rmt_addr, oi.cpt_rmt_addr, 4);
-+ req->class = &or_ipv4;
-+ __tcp_v4_synq_add(sk, req);
-+ } else {
-+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
-+ memcpy(&req->af.v6_req.loc_addr, oi.cpt_loc_addr, 16);
-+ memcpy(&req->af.v6_req.rmt_addr, oi.cpt_rmt_addr, 16);
-+ req->af.v6_req.iif = oi.cpt_iif;
-+ req->class = &or_ipv6;
-+ __tcp_v6_synq_add(sk, req);
-+#endif
-+ }
-+ }
-+ pos += oi.cpt_next;
-+ }
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_sysvipc.c linux-2.6.9-ve023stab030/kernel/cpt/rst_sysvipc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_sysvipc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_sysvipc.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,397 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/shm.h>
-+#include <asm/ipc.h>
-+#include <asm/uaccess.h>
-+#include <asm/unistd.h>
-+#include <ub/ub_mem.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_kernel.h"
-+
-+struct _warg {
-+ struct file *file;
-+ struct cpt_sysvshm_image *v;
-+};
-+
-+static int fixup_one_shm(struct shmid_kernel *shp, void *arg)
-+{
-+ struct _warg *warg = arg;
-+
-+ if (shp->shm_file != warg->file)
-+ return 0;
-+ if (shp->shm_nattch)
-+ return -EEXIST;
-+
-+ shp->shm_perm.uid = warg->v->cpt_uid;
-+ shp->shm_perm.gid = warg->v->cpt_gid;
-+ shp->shm_perm.cuid = warg->v->cpt_cuid;
-+ shp->shm_perm.cgid = warg->v->cpt_cgid;
-+ shp->shm_perm.mode = warg->v->cpt_mode;
-+
-+ shp->shm_atim = warg->v->cpt_atime;
-+ shp->shm_dtim = warg->v->cpt_dtime;
-+ shp->shm_ctim = warg->v->cpt_ctime;
-+ shp->shm_cprid = warg->v->cpt_creator;
-+ shp->shm_lprid = warg->v->cpt_last;
-+
-+ /* TODO: fix shp->mlock_user? */
-+ return 1;
-+}
-+
-+static int fixup_shm(struct file *file, struct cpt_sysvshm_image *v)
-+{
-+ struct _warg warg;
-+
-+ warg.file = file;
-+ warg.v = v;
-+
-+ return sysvipc_walk_shm(fixup_one_shm, &warg);
-+}
-+
-+static int fixup_shm_data(struct file *file, loff_t pos, loff_t end,
-+ struct cpt_context *ctx)
-+{
-+ struct cpt_page_block pgb;
-+ ssize_t (*do_write)(struct file *, const char __user *, size_t, loff_t *ppos);
-+
-+ do_write = file->f_dentry->d_inode->i_fop->write;
-+ if (do_write == NULL) {
-+ eprintk_ctx("No TMPFS? Cannot restore content of SYSV SHM\n");
-+ return -EINVAL;
-+ }
-+
-+ while (pos < end) {
-+ loff_t opos;
-+ loff_t ipos;
-+ int count;
-+ int err;
-+
-+ err = rst_get_object(CPT_OBJ_PAGES, pos, &pgb, ctx);
-+ if (err)
-+ return err;
-+ dprintk_ctx("restoring SHM block: %08x-%08x\n",
-+ (__u32)pgb.cpt_start, (__u32)pgb.cpt_end);
-+ ipos = pos + pgb.cpt_hdrlen;
-+ opos = pgb.cpt_start;
-+ count = pgb.cpt_end-pgb.cpt_start;
-+ while (count > 0) {
-+ mm_segment_t oldfs;
-+ int copy = count;
-+
-+ if (copy > PAGE_SIZE)
-+ copy = PAGE_SIZE;
-+ (void)cpt_get_buf(ctx);
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ err = ctx->pread(ctx->tmpbuf, copy, ctx, ipos);
-+ set_fs(oldfs);
-+ if (err) {
-+ __cpt_release_buf(ctx);
-+ return err;
-+ }
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ ipos += copy;
-+ err = do_write(file, ctx->tmpbuf, copy, &opos);
-+ set_fs(oldfs);
-+ __cpt_release_buf(ctx);
-+ if (err != copy) {
-+ eprintk_ctx("write() failure\n");
-+ if (err >= 0)
-+ err = -EIO;
-+ return err;
-+ }
-+ count -= copy;
-+ }
-+ pos += pgb.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+struct file * rst_sysv_shm(loff_t pos, struct cpt_context *ctx)
-+{
-+ struct file *file;
-+ int err;
-+ loff_t dpos, epos;
-+ union {
-+ struct cpt_file_image fi;
-+ struct cpt_sysvshm_image shmi;
-+ struct cpt_inode_image ii;
-+ } u;
-+
-+ err = rst_get_object(CPT_OBJ_FILE, pos, &u.fi, ctx);
-+ if (err < 0)
-+ goto err_out;
-+ pos = u.fi.cpt_inode;
-+ err = rst_get_object(CPT_OBJ_INODE, pos, &u.ii, ctx);
-+ if (err < 0)
-+ goto err_out;
-+ dpos = pos + u.ii.cpt_hdrlen;
-+ epos = pos + u.ii.cpt_next;
-+ err = rst_get_object(CPT_OBJ_SYSV_SHM, pos + u.ii.cpt_hdrlen, &u.shmi, ctx);
-+ if (err < 0)
-+ goto err_out;
-+ dpos += u.shmi.cpt_next;
-+
-+ file = sysvipc_setup_shm(u.shmi.cpt_key, u.shmi.cpt_id,
-+ u.shmi.cpt_segsz, u.shmi.cpt_mode);
-+ if (!IS_ERR(file)) {
-+ err = fixup_shm(file, &u.shmi);
-+ if (err != -EEXIST && dpos < epos)
-+ err = fixup_shm_data(file, dpos, epos, ctx);
-+ }
-+
-+ return file;
-+
-+err_out:
-+ return ERR_PTR(err);
-+}
-+
-+static int attach_one_undo(int semid, struct sem_array *sma, void *arg)
-+{
-+ struct sem_undo *su = arg;
-+ struct sem_undo_list *undo_list = current->sysvsem.undo_list;
-+
-+ if (semid != su->semid)
-+ return 0;
-+
-+ su->proc_next = undo_list->proc_list;
-+ undo_list->proc_list = su;
-+
-+ su->id_next = sma->undo;
-+ sma->undo = su;
-+
-+ return 1;
-+}
-+
-+static int attach_undo(struct sem_undo *su)
-+{
-+ return sysvipc_walk_sem(attach_one_undo, su);
-+}
-+
-+static int do_rst_semundo(struct cpt_object_hdr *sui, loff_t pos, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct sem_undo_list *undo_list;
-+
-+ if (current->sysvsem.undo_list) {
-+ eprintk_ctx("Funny undo_list\n");
-+ return 0;
-+ }
-+
-+ undo_list = ub_kmalloc(sizeof(struct sem_undo_list), GFP_KERNEL);
-+ if (undo_list == NULL)
-+ return -ENOMEM;
-+ memset(undo_list, 0, sizeof(struct sem_undo_list));
-+ atomic_set(&undo_list->refcnt, 1);
-+ spin_lock_init(&undo_list->lock);
-+ current->sysvsem.undo_list = undo_list;
-+
-+ if (sui->cpt_next > sui->cpt_hdrlen) {
-+ loff_t offset = pos + sui->cpt_hdrlen;
-+ do {
-+ struct sem_undo *new;
-+ struct cpt_sysvsem_undo_image spi;
-+ err = rst_get_object(CPT_OBJ_SYSVSEM_UNDO_REC, offset, &spi, ctx);
-+ if (err)
-+ goto out;
-+ new = ub_kmalloc(sizeof(struct sem_undo) +
-+ sizeof(short)*spi.cpt_nsem, GFP_KERNEL);
-+ if (!new) {
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+
-+ memset(new, 0, sizeof(struct sem_undo) + sizeof(short)*spi.cpt_nsem);
-+ new->semadj = (short *) &new[1];
-+ new->semid = spi.cpt_id;
-+ err = ctx->pread(new->semadj, spi.cpt_nsem*sizeof(short), ctx, offset + spi.cpt_hdrlen);
-+ if (err) {
-+ kfree(new);
-+ goto out;
-+ }
-+ err = attach_undo(new);
-+ if (err <= 0) {
-+ if (err == 0)
-+ err = -ENOENT;
-+ kfree(new);
-+ goto out;
-+ }
-+ offset += spi.cpt_next;
-+ } while (offset < pos + sui->cpt_next);
-+ }
-+ err = 0;
-+
-+out:
-+ return err;
-+}
-+
-+__u32 rst_semundo_flag(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ __u32 flag = 0;
-+
-+#if 0
-+ if (ti->cpt_sysvsem_undo == CPT_NULL ||
-+ lookup_cpt_obj_bypos(CPT_OBJ_SYSVSEM_UNDO, ti->cpt_sysvsem_undo))
-+ flag |= CLONE_SYSVSEM;
-+#endif
-+ return flag;
-+}
-+
-+int rst_semundo_complete(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct sem_undo_list *f = current->sysvsem.undo_list;
-+ cpt_object_t *obj;
-+ struct cpt_object_hdr sui;
-+
-+ if (ti->cpt_sysvsem_undo == CPT_NULL) {
-+ exit_sem(current);
-+ return 0;
-+ }
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_SYSVSEM_UNDO, ti->cpt_sysvsem_undo, ctx);
-+ if (obj) {
-+ if (obj->o_obj != f) {
-+ exit_sem(current);
-+ f = obj->o_obj;
-+ atomic_inc(&f->refcnt);
-+ current->sysvsem.undo_list = f;
-+ }
-+ return 0;
-+ }
-+
-+ if ((err = rst_get_object(CPT_OBJ_SYSVSEM_UNDO, ti->cpt_sysvsem_undo, &sui, ctx)) != 0)
-+ goto out;
-+
-+ if ((err = do_rst_semundo(&sui, ti->cpt_sysvsem_undo, ctx)) != 0)
-+ goto out;
-+
-+ err = -ENOMEM;
-+ obj = cpt_object_add(CPT_OBJ_SYSVSEM_UNDO, f, ctx);
-+ if (obj) {
-+ err = 0;
-+ cpt_obj_setpos(obj, ti->cpt_sysvsem_undo, ctx);
-+ }
-+
-+ return 0;
-+
-+out:
-+ return err;
-+}
-+
-+struct _sarg {
-+ int semid;
-+ struct cpt_sysvsem_image *v;
-+ __u32 *arr;
-+};
-+
-+static int fixup_one_sem(int semid, struct sem_array *sma, void *arg)
-+{
-+ struct _sarg *warg = arg;
-+
-+ if (semid != warg->semid)
-+ return 0;
-+
-+ sma->sem_perm.uid = warg->v->cpt_uid;
-+ sma->sem_perm.gid = warg->v->cpt_gid;
-+ sma->sem_perm.cuid = warg->v->cpt_cuid;
-+ sma->sem_perm.cgid = warg->v->cpt_cgid;
-+ sma->sem_perm.mode = warg->v->cpt_mode;
-+ sma->sem_perm.seq = warg->v->cpt_seq;
-+
-+ sma->sem_ctime = warg->v->cpt_ctime;
-+ sma->sem_otime = warg->v->cpt_otime;
-+ memcpy(sma->sem_base, warg->arr, sma->sem_nsems*8);
-+ return 1;
-+}
-+
-+static int fixup_sem(int semid, struct cpt_sysvsem_image *v, __u32 *arr)
-+{
-+ struct _sarg warg;
-+
-+ warg.semid = semid;
-+ warg.v = v;
-+ warg.arr = arr;
-+
-+ return sysvipc_walk_sem(fixup_one_sem, &warg);
-+}
-+
-+
-+static int restore_sem(loff_t pos, struct cpt_sysvsem_image *si,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ __u32 *arr;
-+ int nsems = (si->cpt_next - si->cpt_hdrlen)/8;
-+
-+ arr = kmalloc(nsems*8, GFP_KERNEL);
-+ if (!arr)
-+ return -ENOMEM;
-+
-+ err = ctx->pread(arr, nsems*8, ctx, pos+si->cpt_hdrlen);
-+ if (err)
-+ goto out;
-+ err = sysvipc_setup_sem(si->cpt_key, si->cpt_id, nsems, si->cpt_mode);
-+ if (err < 0) {
-+ eprintk_ctx("SEM 3\n");
-+ goto out;
-+ }
-+ err = fixup_sem(si->cpt_id, si, arr);
-+ if (err == 0)
-+ err = -ESRCH;
-+ if (err > 0)
-+ err = 0;
-+out:
-+ kfree(arr);
-+ return err;
-+}
-+
-+static int rst_sysv_sem(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_SYSV_SEM];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_sysvsem_image sbuf;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_SYSV_SEM || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ int err;
-+ err = rst_get_object(CPT_OBJ_SYSV_SEM, sec, &sbuf, ctx);
-+ if (err)
-+ return err;
-+ err = restore_sem(sec, &sbuf, ctx);
-+ if (err)
-+ return err;
-+ sec += sbuf.cpt_next;
-+ }
-+ return 0;
-+}
-+
-+int rst_sysv_ipc(struct cpt_context *ctx)
-+{
-+ return rst_sysv_sem(ctx);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_tty.c linux-2.6.9-ve023stab030/kernel/cpt/rst_tty.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_tty.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_tty.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,369 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/major.h>
-+#include <linux/pipe_fs_i.h>
-+#include <linux/mman.h>
-+#include <linux/mount.h>
-+#include <linux/tty.h>
-+#include <linux/vmalloc.h>
-+#include <asm/unistd.h>
-+#include <asm/uaccess.h>
-+#include <linux/cpt_image.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_mm.h"
-+#include "cpt_files.h"
-+#include "cpt_kernel.h"
-+
-+static int pty_setup(struct tty_struct *stty, loff_t pos,
-+ struct cpt_tty_image *pi, struct cpt_context *ctx)
-+{
-+ unsigned long flags;
-+
-+ stty->pgrp = -1;
-+ stty->session = 0;
-+ stty->packet = pi->cpt_packet;
-+ stty->stopped = pi->cpt_stopped;
-+ stty->hw_stopped = pi->cpt_hw_stopped;
-+ stty->flow_stopped = pi->cpt_flow_stopped;
-+#define DONOT_CHANGE ((1<<TTY_CHARGED)|(1<<TTY_CLOSING))
-+ flags = stty->flags & DONOT_CHANGE;
-+ stty->flags = flags | (pi->cpt_flags & ~DONOT_CHANGE);
-+ stty->ctrl_status = pi->cpt_ctrl_status;
-+ stty->winsize.ws_row = pi->cpt_ws_row;
-+ stty->winsize.ws_col = pi->cpt_ws_col;
-+ stty->winsize.ws_ypixel = pi->cpt_ws_prow;
-+ stty->winsize.ws_xpixel = pi->cpt_ws_pcol;
-+ stty->canon_column = pi->cpt_canon_column;
-+ stty->column = pi->cpt_column;
-+ stty->raw = pi->cpt_raw;
-+ stty->real_raw = pi->cpt_real_raw;
-+ stty->erasing = pi->cpt_erasing;
-+ stty->lnext = pi->cpt_lnext;
-+ stty->icanon = pi->cpt_icanon;
-+ stty->closing = pi->cpt_closing;
-+ stty->minimum_to_wake = pi->cpt_minimum_to_wake;
-+
-+ stty->termios->c_iflag = pi->cpt_c_iflag;
-+ stty->termios->c_oflag = pi->cpt_c_oflag;
-+ stty->termios->c_lflag = pi->cpt_c_lflag;
-+ stty->termios->c_cflag = pi->cpt_c_cflag;
-+ memcpy(&stty->termios->c_cc, &pi->cpt_c_cc, NCCS);
-+ memcpy(stty->read_flags, pi->cpt_read_flags, sizeof(stty->read_flags));
-+
-+ if (pi->cpt_next > pi->cpt_hdrlen) {
-+ int err;
-+ struct cpt_obj_bits b;
-+ err = rst_get_object(CPT_OBJ_BITS, pos + pi->cpt_hdrlen, &b, ctx);
-+ if (err)
-+ return err;
-+ if (b.cpt_size == 0)
-+ return 0;
-+ err = ctx->pread(stty->read_buf, b.cpt_size, ctx, pos + pi->cpt_hdrlen + b.cpt_hdrlen);
-+ if (err)
-+ return err;
-+
-+ spin_lock_irq(&stty->read_lock);
-+ stty->read_tail = 0;
-+ stty->read_cnt = b.cpt_size;
-+ stty->read_head = b.cpt_size;
-+ stty->canon_head = stty->read_tail + pi->cpt_canon_head;
-+ stty->canon_data = pi->cpt_canon_data;
-+ spin_unlock_irq(&stty->read_lock);
-+ }
-+
-+ return 0;
-+}
-+
-+/* Find slave/master tty in image, when we already know master/slave.
-+ * It might be optimized, of course. */
-+static loff_t find_pty_pair(struct tty_struct *stty, loff_t pos, struct cpt_tty_image *pi, struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_TTY];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_tty_image *pibuf;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return CPT_NULL;
-+ if (h.cpt_section != CPT_SECT_TTY || h.cpt_hdrlen < sizeof(h))
-+ return CPT_NULL;
-+ pibuf = kmalloc(sizeof(*pibuf), GFP_KERNEL);
-+ if (pibuf == NULL) {
-+ eprintk_ctx("cannot allocate buffer\n");
-+ return CPT_NULL;
-+ }
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ if (rst_get_object(CPT_OBJ_TTY, sec, pibuf, ctx))
-+ return CPT_NULL;
-+ if (pibuf->cpt_index == pi->cpt_index &&
-+ !((pi->cpt_drv_flags^pibuf->cpt_drv_flags)&TTY_DRIVER_DEVPTS_MEM) &&
-+ pos != sec) {
-+ pty_setup(stty, sec, pibuf, ctx);
-+ return sec;
-+ }
-+ sec += pibuf->cpt_next;
-+ }
-+ kfree(pibuf);
-+ return CPT_NULL;
-+}
-+
-+static int fixup_tty_attrs(struct cpt_inode_image *ii, struct file *master,
-+ struct cpt_context *ctx)
-+{
-+ int err;
-+ struct iattr newattrs;
-+ struct dentry *d = master->f_dentry;
-+
-+ newattrs.ia_valid = ATTR_UID|ATTR_GID|ATTR_MODE;
-+ newattrs.ia_uid = ii->cpt_uid;
-+ newattrs.ia_gid = ii->cpt_gid;
-+ newattrs.ia_mode = ii->cpt_mode;
-+
-+ down(&d->d_inode->i_sem);
-+ err = notify_change(d, &newattrs);
-+ up(&d->d_inode->i_sem);
-+
-+ return err;
-+}
-+
-+/* NOTE: "portable", but ugly thing. To allocate /dev/pts/N, we open
-+ * /dev/ptmx until we get pty with desired index.
-+ */
-+
-+struct file *ptmx_open(int index, unsigned int flags)
-+{
-+ struct file *file;
-+ struct file **stack = NULL;
-+ int depth = 0;
-+
-+ for (;;) {
-+ struct tty_struct *tty;
-+
-+ file = filp_open("/dev/ptmx", flags|O_NONBLOCK|O_NOCTTY|O_RDWR, 0);
-+ if (IS_ERR(file))
-+ break;
-+ tty = file->private_data;
-+ if (tty->index == index)
-+ break;
-+
-+ if (depth == PAGE_SIZE/sizeof(struct file *)) {
-+ fput(file);
-+ file = ERR_PTR(-EBUSY);
-+ break;
-+ }
-+ if (stack == NULL) {
-+ stack = (struct file **)__get_free_page(GFP_KERNEL);
-+ if (!stack) {
-+ fput(file);
-+ file = ERR_PTR(-ENOMEM);
-+ break;
-+ }
-+ }
-+ stack[depth] = file;
-+ depth++;
-+ }
-+ while (depth > 0) {
-+ depth--;
-+ fput(stack[depth]);
-+ }
-+ if (stack)
-+ free_page((unsigned long)stack);
-+ return file;
-+}
-+
-+
-+struct file * rst_open_tty(struct cpt_file_image *fi, struct cpt_inode_image *ii,
-+ unsigned flags, struct cpt_context *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+ struct file *master, *slave;
-+ struct tty_struct *stty;
-+ struct cpt_tty_image *pi;
-+ static char *a = "pqrstuvwxyzabcde";
-+ static char *b = "0123456789abcdef";
-+ char pairname[16];
-+ unsigned master_flags, slave_flags;
-+
-+ if (fi->cpt_priv == CPT_NULL)
-+ return ERR_PTR(-EINVAL);
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_TTY, fi->cpt_priv, ctx);
-+ if (obj && obj->o_parent) {
-+ dprintk_ctx("obtained pty as pair to existing\n");
-+ master = obj->o_parent;
-+ stty = master->private_data;
-+
-+ if (stty->driver->subtype == PTY_TYPE_MASTER &&
-+ (stty->driver->flags&TTY_DRIVER_DEVPTS_MEM)) {
-+ wprintk_ctx("cloning ptmx\n");
-+ get_file(master);
-+ return master;
-+ }
-+
-+ master = dentry_open(dget(master->f_dentry),
-+ mntget(master->f_vfsmnt), flags);
-+ if (!IS_ERR(master)) {
-+ stty = master->private_data;
-+ if (stty->driver->subtype != PTY_TYPE_MASTER)
-+ fixup_tty_attrs(ii, master, ctx);
-+ }
-+ return master;
-+ }
-+
-+ pi = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_TTY, fi->cpt_priv, pi, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return ERR_PTR(err);
-+ }
-+
-+ master_flags = slave_flags = 0;
-+ if (pi->cpt_drv_subtype == PTY_TYPE_MASTER)
-+ master_flags = flags;
-+ else
-+ slave_flags = flags;
-+
-+ /*
-+ * Open pair master/slave.
-+ */
-+ if (pi->cpt_drv_flags&TTY_DRIVER_DEVPTS_MEM) {
-+ master = ptmx_open(pi->cpt_index, master_flags);
-+ } else {
-+ sprintf(pairname, "/dev/pty%c%c", a[pi->cpt_index/16], b[pi->cpt_index%16]);
-+ master = filp_open(pairname, master_flags|O_NONBLOCK|O_NOCTTY|O_RDWR, 0);
-+ }
-+ if (IS_ERR(master)) {
-+ eprintk_ctx("filp_open master: %Ld %ld\n", fi->cpt_priv, PTR_ERR(master));
-+ cpt_release_buf(ctx);
-+ return master;
-+ }
-+ stty = master->private_data;
-+ clear_bit(TTY_PTY_LOCK, &stty->flags);
-+ if (pi->cpt_drv_flags&TTY_DRIVER_DEVPTS_MEM)
-+ sprintf(pairname, "/dev/pts/%d", stty->index);
-+ else
-+ sprintf(pairname, "/dev/tty%c%c", a[stty->index/16], b[stty->index%16]);
-+ slave = filp_open(pairname, slave_flags|O_NONBLOCK|O_NOCTTY|O_RDWR, 0);
-+ if (IS_ERR(slave)) {
-+ eprintk_ctx("filp_open slave %s: %ld\n", pairname, PTR_ERR(slave));
-+ fput(master);
-+ cpt_release_buf(ctx);
-+ return slave;
-+ }
-+
-+ if (pi->cpt_drv_subtype != PTY_TYPE_MASTER)
-+ fixup_tty_attrs(ii, slave, ctx);
-+
-+ cpt_object_add(CPT_OBJ_TTY, master->private_data, ctx);
-+ cpt_object_add(CPT_OBJ_TTY, slave->private_data, ctx);
-+ cpt_object_add(CPT_OBJ_FILE, master, ctx);
-+ cpt_object_add(CPT_OBJ_FILE, slave, ctx);
-+
-+ if (pi->cpt_drv_subtype == PTY_TYPE_MASTER) {
-+ loff_t pos;
-+ obj = lookup_cpt_object(CPT_OBJ_TTY, master->private_data, ctx);
-+ obj->o_parent = master;
-+ cpt_obj_setpos(obj, fi->cpt_priv, ctx);
-+ pty_setup(stty, fi->cpt_priv, pi, ctx);
-+
-+ obj = lookup_cpt_object(CPT_OBJ_TTY, slave->private_data, ctx);
-+ obj->o_parent = slave;
-+ pos = find_pty_pair(stty->link, fi->cpt_priv, pi, ctx);
-+ cpt_obj_setpos(obj, pos, ctx);
-+
-+ obj = lookup_cpt_object(CPT_OBJ_FILE, slave, ctx);
-+ cpt_obj_setpos(obj, CPT_NULL, ctx);
-+ get_file(master);
-+ cpt_release_buf(ctx);
-+ return master;
-+ } else {
-+ loff_t pos;
-+ obj = lookup_cpt_object(CPT_OBJ_TTY, slave->private_data, ctx);
-+ obj->o_parent = slave;
-+ cpt_obj_setpos(obj, fi->cpt_priv, ctx);
-+ pty_setup(stty->link, fi->cpt_priv, pi, ctx);
-+
-+ obj = lookup_cpt_object(CPT_OBJ_TTY, master->private_data, ctx);
-+ obj->o_parent = master;
-+ pos = find_pty_pair(stty, fi->cpt_priv, pi, ctx);
-+ cpt_obj_setpos(obj, pos, ctx);
-+
-+ obj = lookup_cpt_object(CPT_OBJ_FILE, master, ctx);
-+ cpt_obj_setpos(obj, CPT_NULL, ctx);
-+ get_file(slave);
-+ cpt_release_buf(ctx);
-+ return slave;
-+ }
-+}
-+
-+int rst_tty_jobcontrol(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_TTY];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_TTY || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ cpt_object_t *obj;
-+ struct cpt_tty_image *pibuf = cpt_get_buf(ctx);
-+
-+ if (rst_get_object(CPT_OBJ_TTY, sec, pibuf, ctx)) {
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_TTY, sec, ctx);
-+ if (obj) {
-+ struct tty_struct *stty = obj->o_obj;
-+ if ((int)pibuf->cpt_pgrp > 0) {
-+ stty->pgrp = vpid_to_pid(pibuf->cpt_pgrp);
-+ if (stty->pgrp == -1)
-+ dprintk_ctx("unknown tty pgrp %d\n", pibuf->cpt_pgrp);
-+ } else if (pibuf->cpt_pgrp) {
-+ stty->pgrp = alloc_pidmap();
-+ if (stty->pgrp < 0) {
-+ eprintk_ctx("cannot allocate stray tty->pgrp");
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ free_pidmap(stty->pgrp);
-+ }
-+ if ((int)pibuf->cpt_session > 0) {
-+ int sess;
-+ sess = vpid_to_pid(pibuf->cpt_session);
-+ if (sess == -1) {
-+ dprintk_ctx("unknown tty session %d\n", pibuf->cpt_session);
-+ } else if (stty->session <= 0) {
-+ stty->session = sess;
-+ } else if (stty->session != sess) {
-+ wprintk_ctx("tty session mismatch 2\n");
-+ }
-+ }
-+ }
-+ sec += pibuf->cpt_next;
-+ cpt_release_buf(ctx);
-+ }
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_ubc.c linux-2.6.9-ve023stab030/kernel/cpt/rst_ubc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_ubc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_ubc.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,97 @@
-+#include <linux/types.h>
-+#include <ub/beancounter.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+
-+struct user_beancounter *rst_lookup_ubc(__u64 pos, struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ obj = lookup_cpt_obj_bypos(CPT_OBJ_UBC, pos, ctx);
-+ if (obj == NULL) {
-+ printk(KERN_ERR "RST: unknown ub @%Lu\n", pos);
-+ return get_beancounter(get_exec_ub());
-+ }
-+ return get_beancounter(obj->o_obj);
-+}
-+
-+static void restore_one_bc_parm(__u64 *dmp, struct ubparm *prm, int held)
-+{
-+ prm->barrier = (dmp[0] == CPT_NULL ? UB_MAXVALUE : dmp[0]);
-+ prm->limit = (dmp[1] == CPT_NULL ? UB_MAXVALUE : dmp[1]);
-+ if (held)
-+ prm->held = dmp[2];
-+ prm->maxheld = dmp[3];
-+ prm->minheld = dmp[4];
-+ prm->failcnt = dmp[5];
-+}
-+
-+static int restore_one_bc(struct cpt_beancounter_image *v,
-+ cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ struct user_beancounter *bc;
-+ cpt_object_t *pobj;
-+ int i;
-+
-+ if (v->cpt_parent != CPT_NULL) {
-+ pobj = lookup_cpt_obj_bypos(CPT_OBJ_UBC, v->cpt_parent, ctx);
-+ if (pobj == NULL)
-+ return -ESRCH;
-+ bc = get_subbeancounter_byid(pobj->o_obj, v->cpt_id, 1);
-+ } else {
-+ bc = get_exec_ub();
-+ while (bc->parent)
-+ bc = bc->parent;
-+ get_beancounter(bc);
-+ }
-+ if (bc == NULL)
-+ return -ENOMEM;
-+ obj->o_obj = bc;
-+
-+ for (i = 0; i < UB_RESOURCES; i++)
-+ restore_one_bc_parm(v->cpt_parms, bc->ub_parms, 0);
-+ for (i = 0; i < UB_RESOURCES; i++)
-+ restore_one_bc_parm(v->cpt_parms + UB_RESOURCES * 6,
-+ bc->ub_store, 1);
-+ return 0;
-+}
-+
-+int rst_undump_ubc(struct cpt_context *ctx)
-+{
-+ loff_t start, end;
-+ struct cpt_beancounter_image *v;
-+ cpt_object_t *obj;
-+ int err;
-+
-+ err = rst_get_section(CPT_SECT_UBC, ctx, &start, &end);
-+ if (err)
-+ return err;
-+
-+ while (start < end) {
-+ v = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_UBC, start, v, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+
-+ obj = alloc_cpt_object(GFP_KERNEL, ctx);
-+ cpt_obj_setpos(obj, start, ctx);
-+ intern_cpt_object(CPT_OBJ_UBC, obj, ctx);
-+
-+ restore_one_bc(v, obj, ctx);
-+
-+ cpt_release_buf(ctx);
-+ start += v->cpt_next;
-+ }
-+ return 0;
-+}
-+
-+void rst_finish_ubc(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+
-+ for_each_object(obj, CPT_OBJ_UBC)
-+ put_beancounter(obj->o_obj);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_undump.c linux-2.6.9-ve023stab030/kernel/cpt/rst_undump.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_undump.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_undump.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,869 @@
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/errno.h>
-+#include <linux/pagemap.h>
-+#include <linux/namespace.h>
-+#include <linux/personality.h>
-+#include <linux/binfmts.h>
-+#include <linux/smp_lock.h>
-+#include <linux/virtinfo.h>
-+#include <linux/virtinfoscp.h>
-+#include <linux/vzcalluser.h>
-+#include <ub/beancounter.h>
-+#include <asm/desc.h>
-+#include <asm/unistd.h>
-+
-+#include "cpt_obj.h"
-+#include "cpt_context.h"
-+#include "cpt_files.h"
-+#include "cpt_mm.h"
-+#include "cpt_process.h"
-+#include "cpt_socket.h"
-+#include "cpt_net.h"
-+#include "cpt_ubc.h"
-+#include "cpt_kernel.h"
-+
-+static int rst_utsname(cpt_context_t *ctx);
-+
-+
-+struct thr_context {
-+ struct completion init_complete;
-+ struct completion task_done;
-+ int error;
-+ struct cpt_context *ctx;
-+ cpt_object_t *tobj;
-+};
-+
-+static int rst_clone_children(cpt_object_t *obj, struct cpt_context *ctx);
-+
-+void __put_namespace(struct namespace *namespace)
-+{
-+ eprintk("orphan namespace is lost\n");
-+}
-+
-+static int vps_rst_veinfo(struct cpt_context *ctx)
-+{
-+ int err;
-+ struct cpt_veinfo_image *i;
-+ struct ve_struct *ve;
-+ struct timespec delta;
-+ loff_t start, end;
-+
-+ err = rst_get_section(CPT_SECT_VEINFO, ctx, &start, &end);
-+ if (err)
-+ goto out;
-+
-+ i = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_VEINFO, start, i, ctx);
-+ if (err)
-+ goto out_rel;
-+
-+ ve = get_exec_env();
-+ ve->_shm_ctlall = i->shm_ctl_all;
-+ ve->_shm_ctlmax = i->shm_ctl_max;
-+ ve->_shm_ctlmni = i->shm_ctl_mni;
-+
-+ ve->_msg_ctlmax = i->msg_ctl_max;
-+ ve->_msg_ctlmni = i->msg_ctl_mni;
-+ ve->_msg_ctlmnb = i->msg_ctl_mnb;
-+
-+ BUG_ON(sizeof(ve->_sem_ctls) != sizeof(i->sem_ctl_arr));
-+ ve->_sem_ctls[0] = i->sem_ctl_arr[0];
-+ ve->_sem_ctls[1] = i->sem_ctl_arr[1];
-+ ve->_sem_ctls[2] = i->sem_ctl_arr[2];
-+ ve->_sem_ctls[3] = i->sem_ctl_arr[3];
-+
-+ cpt_timespec_import(&delta, i->start_timespec_delta);
-+ set_normalized_timespec(&ve->start_timespec,
-+ ve->start_timespec.tv_sec - delta.tv_sec,
-+ ve->start_timespec.tv_nsec - delta.tv_nsec);
-+ ve->start_jiffies -= i->start_jiffies_delta;
-+ ve->start_cycles -= (s64)i->start_jiffies_delta * cycles_per_jiffy;
-+
-+ err = 0;
-+out_rel:
-+ cpt_release_buf(ctx);
-+out:
-+ return err;
-+}
-+
-+static int vps_rst_reparent_root(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ int err;
-+ struct env_create_param2 param;
-+
-+ ctx->cpt_jiffies64 = get_jiffies_64();
-+ do_gettimespec(&ctx->delta_time);
-+
-+ set_normalized_timespec(&ctx->delta_time,
-+ ctx->delta_time.tv_sec - ctx->start_time.tv_sec,
-+ ctx->delta_time.tv_nsec - ctx->start_time.tv_nsec);
-+ ctx->delta_nsec = (s64)ctx->delta_time.tv_sec*NSEC_PER_SEC + ctx->delta_time.tv_nsec;
-+ if (ctx->delta_nsec < 0) {
-+ wprintk_ctx("Wall time is behind source by %Ld ns, "
-+ "time sensitive applications can misbehave\n", -ctx->delta_nsec);
-+ }
-+
-+ memset(&param, 0, sizeof(param));
-+ param.iptables_mask = ctx->iptables_mask;
-+ param.feature_mask = ctx->features;
-+
-+ err = real_env_create(ctx->ve_id, VE_CREATE|VE_LOCK, 2, &param, sizeof(param));
-+ if (err < 0)
-+ eprintk_ctx("real_env_create: %d\n", err);
-+ get_exec_env()->jiffies_fixup =
-+ (ctx->delta_time.tv_sec < 0 ?
-+ 0 : timespec_to_jiffies(&ctx->delta_time)) -
-+ (unsigned long)(ctx->cpt_jiffies64 - ctx->virt_jiffies64);
-+ return err < 0 ? err : 0;
-+}
-+
-+
-+static int hook(void *arg)
-+{
-+ struct thr_context *thr_ctx = arg;
-+ struct cpt_context *ctx;
-+ cpt_object_t *tobj;
-+ struct cpt_task_image *ti;
-+ int err = 0;
-+ int exiting = 0;
-+
-+ current->state = TASK_UNINTERRUPTIBLE;
-+ complete(&thr_ctx->init_complete);
-+ schedule();
-+
-+ ctx = thr_ctx->ctx;
-+ tobj = thr_ctx->tobj;
-+ ti = tobj->o_image;
-+
-+ current->fs->umask = 0;
-+
-+ if (ti->cpt_pid == 1) {
-+ err = vps_rst_reparent_root(tobj, ctx);
-+
-+ if (err) {
-+ rst_report_error(err, ctx);
-+ goto out;
-+ }
-+
-+ memcpy(&get_exec_env()->cap_default, &ti->cpt_ecap, sizeof(kernel_cap_t));
-+
-+ if (ctx->statusfile) {
-+ fput(ctx->statusfile);
-+ ctx->statusfile = NULL;
-+ }
-+
-+ if (ctx->lockfile) {
-+ mm_segment_t oldfs;
-+ ssize_t err = -EINVAL;
-+ char b;
-+
-+ oldfs = get_fs(); set_fs(KERNEL_DS);
-+ if (ctx->lockfile->f_op && ctx->lockfile->f_op->read)
-+ err = ctx->lockfile->f_op->read(ctx->lockfile, &b, 1, &ctx->lockfile->f_pos);
-+ set_fs(oldfs);
-+ fput(ctx->lockfile);
-+ ctx->lockfile = NULL;
-+ }
-+
-+ err = vps_rst_veinfo(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_veinfo: %d\n", err);
-+ goto out;
-+ }
-+
-+ err = rst_utsname(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_utsname: %d\n", err);
-+ goto out;
-+ }
-+
-+ err = rst_root_namespace(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_namespace: %d\n", err);
-+ goto out;
-+ }
-+
-+ if ((err = rst_restore_net(ctx)) != 0) {
-+ eprintk_ctx("rst_restore_net: %d\n", err);
-+ goto out;
-+ }
-+
-+ err = rst_sockets(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sockets: %d\n", err);
-+ goto out;
-+ }
-+ err = rst_sysv_ipc(ctx);
-+ if (err) {
-+ eprintk_ctx("rst_sysv_ipc: %d\n", err);
-+ goto out;
-+ }
-+ }
-+
-+ do {
-+ if (current->user->uid != ti->cpt_user) {
-+ struct user_struct *u = alloc_uid(ti->cpt_user);
-+ if (!u) {
-+ eprintk_ctx("alloc_user\n");
-+ } else {
-+ switch_uid(u);
-+ }
-+ }
-+ } while (0);
-+
-+ if ((err = rst_mm_complete(ti, ctx)) != 0) {
-+ eprintk_ctx("rst_mm: %d\n", err);
-+ goto out;
-+ }
-+
-+ if ((err = rst_files_complete(ti, ctx)) != 0) {
-+ eprintk_ctx("rst_files: %d\n", err);
-+ goto out;
-+ }
-+
-+ if ((err = rst_fs_complete(ti, ctx)) != 0) {
-+ eprintk_ctx("rst_fs: %d\n", err);
-+ goto out;
-+ }
-+
-+ if ((err = rst_semundo_complete(ti, ctx)) != 0) {
-+ eprintk_ctx("rst_semundo: %d\n", err);
-+ goto out;
-+ }
-+
-+ if ((err = rst_signal_complete(ti, &exiting, ctx)) != 0) {
-+ eprintk_ctx("rst_signal: %d\n", err);
-+ goto out;
-+ }
-+
-+ if (ti->cpt_namespace == CPT_NULL)
-+ exit_namespace(current);
-+
-+ if (ti->cpt_personality != 0)
-+ __set_personality(ti->cpt_personality);
-+
-+ current->set_child_tid = NULL;
-+ current->clear_child_tid = NULL;
-+ current->flags &= ~(PF_FORKNOEXEC|PF_SUPERPRIV);
-+ current->flags |= ti->cpt_flags&(PF_FORKNOEXEC|PF_SUPERPRIV);
-+ current->exit_code = ti->cpt_exit_code;
-+ current->pdeath_signal = ti->cpt_pdeath_signal;
-+
-+ if (ti->cpt_restart.fn != CPT_RBL_0) {
-+ if (ti->cpt_restart.fn != CPT_RBL_NANOSLEEP
-+ && ti->cpt_restart.fn != CPT_RBL_COMPAT_NANOSLEEP
-+ ) {
-+ eprintk_ctx("unknown restart block\n");
-+ } else {
-+ s64 val;
-+
-+ current->thread_info->restart_block.fn = nanosleep_restart;
-+#ifdef CONFIG_X86_64
-+ if (!ti->cpt_64bit)
-+ current->thread_info->restart_block.fn = compat_nanosleep_restart;
-+#endif
-+ val = ti->cpt_restart.arg0;
-+ if (ctx->image_version < CPT_VERSION_9)
-+ val *= TICK_NSEC;
-+ val -= ctx->delta_nsec;
-+ if (val <= 0)
-+ val = TICK_NSEC;
-+ val = _ns_to_jiffies(val + TICK_NSEC - 1);
-+ current->thread_info->restart_block.arg0 = val +
-+ (unsigned long)ctx->cpt_jiffies64;
-+ if (ctx->image_version < CPT_VERSION_9)
-+ current->thread_info->restart_block.arg1 = ti->cpt_restart.arg1;
-+ else
-+ current->thread_info->restart_block.arg1 = ti->cpt_restart.arg2;
-+ current->thread_info->restart_block.arg2 = 0;
-+ current->thread_info->restart_block.arg3 = 0;
-+ dprintk_ctx("rbl " CPT_FID " +%Ld %lu %lu %lu %lu %lu\n", CPT_TID(current),
-+ val, (unsigned long)current->thread_info->restart_block.arg0, jiffies,
-+ (unsigned long)ti->cpt_restart.arg0, timespec_to_jiffies(&ctx->delta_time), (unsigned long)ctx->cpt_jiffies64);
-+ }
-+ }
-+
-+ if (ctx->image_version < CPT_VERSION_9)
-+ current->it_real_incr = ti->cpt_it_real_incr;
-+ else
-+ current->it_real_incr = _ns_to_jiffies(ti->cpt_it_real_incr);
-+ current->it_prof_incr = ti->cpt_it_prof_incr;
-+ current->it_virt_incr = ti->cpt_it_virt_incr;
-+ current->it_prof_value = ti->cpt_it_prof_value;
-+ current->it_virt_value = ti->cpt_it_virt_value;
-+
-+ err = rst_clone_children(tobj, ctx);
-+ if (err) {
-+ eprintk_ctx("rst_clone_children\n");
-+ goto out;
-+ }
-+
-+ if (exiting)
-+ current->signal->group_exit = 1;
-+
-+ if (ti->cpt_pid == 1) {
-+ if ((err = rst_process_linkage(ctx)) != 0) {
-+ eprintk_ctx("rst_process_linkage: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_do_filejobs(ctx)) != 0) {
-+ eprintk_ctx("rst_do_filejobs: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_eventpoll(ctx)) != 0) {
-+ eprintk_ctx("rst_eventpoll: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_sockets_complete(ctx)) != 0) {
-+ eprintk_ctx("rst_sockets_complete: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_stray_files(ctx)) != 0) {
-+ eprintk_ctx("rst_stray_files: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_posix_locks(ctx)) != 0) {
-+ eprintk_ctx("rst_posix_locks: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_tty_jobcontrol(ctx)) != 0) {
-+ eprintk_ctx("rst_tty_jobcontrol: %d\n", err);
-+ goto out;
-+ }
-+ if ((err = rst_restore_fs(ctx)) != 0) {
-+ eprintk_ctx("rst_restore_fs: %d\n", err);
-+ goto out;
-+ }
-+ if (virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_RESTORE, ctx) & NOTIFY_FAIL) {
-+ err = -ECHRNG;
-+ eprintk_ctx("scp_restore failed\n");
-+ goto out;
-+ }
-+ }
-+
-+out:
-+ thr_ctx->error = err;
-+ lock_kernel();
-+ complete(&thr_ctx->task_done);
-+
-+ if (!err && (ti->cpt_state & (EXIT_ZOMBIE|EXIT_DEAD))) {
-+ preempt_disable();
-+ current->exit_state = EXIT_ZOMBIE;
-+ write_lock_irq(&tasklist_lock);
-+ nr_zombie++;
-+ write_unlock_irq(&tasklist_lock);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-+ atomic_dec(&current->signal->live);
-+#endif
-+ current->flags |= PF_DEAD;
-+ if (!(ti->cpt_flags&PF_DEAD))
-+ wprintk_ctx("zombie %d,%d(%s) is not pf_dead\n", current->pid, virt_pid(current), current->comm);
-+ module_put(current->thread_info->exec_domain->module);
-+ if (current->binfmt)
-+ module_put(current->binfmt->module);
-+ } else {
-+ __set_current_state(TASK_UNINTERRUPTIBLE);
-+ }
-+
-+ schedule();
-+
-+ dprintk_ctx("leaked through %d/%d %p\n", current->pid, virt_pid(current), current->mm);
-+
-+ module_put(THIS_MODULE);
-+ complete_and_exit(NULL, 0);
-+ return 0;
-+}
-+
-+#if 0
-+static void set_task_ubs(struct cpt_task_image *ti, struct cpt_context *ctx)
-+{
-+ struct task_beancounter *tbc;
-+
-+ tbc = task_bc(current);
-+
-+ put_beancounter(tbc->fork_sub);
-+ tbc->fork_sub = rst_lookup_ubc(ti->cpt_task_ub, ctx);
-+ if (ti->cpt_mm_ub != CPT_NULL) {
-+ put_beancounter(tbc->exec_ub);
-+ tbc->exec_ub = rst_lookup_ubc(ti->cpt_mm_ub, ctx);
-+ }
-+}
-+#endif
-+
-+static int create_root_task(cpt_object_t *obj, struct cpt_context *ctx,
-+ struct thr_context *thr_ctx)
-+{
-+ task_t *tsk;
-+ int pid;
-+
-+ thr_ctx->ctx = ctx;
-+ thr_ctx->error = 0;
-+ init_completion(&thr_ctx->init_complete);
-+ init_completion(&thr_ctx->task_done);
-+#if 0
-+ set_task_ubs(obj->o_image, ctx);
-+#endif
-+
-+ pid = local_kernel_thread(hook, thr_ctx, 0, 0);
-+ if (pid < 0)
-+ return pid;
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_ve(pid);
-+ if (tsk)
-+ get_task_struct(tsk);
-+ read_unlock(&tasklist_lock);
-+ if (tsk == NULL)
-+ return -ESRCH;
-+ cpt_obj_setobj(obj, tsk, ctx);
-+ thr_ctx->tobj = obj;
-+ return 0;
-+}
-+
-+static int rst_basic_init_task(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ task_t *tsk = obj->o_obj;
-+ struct cpt_task_image *ti = obj->o_image;
-+
-+ memcpy(tsk->comm, ti->cpt_comm, sizeof(tsk->comm));
-+ rst_mm_basic(obj, ti, ctx);
-+ return 0;
-+}
-+
-+static int make_baby(cpt_object_t *cobj,
-+ struct cpt_task_image *pi,
-+ struct cpt_context *ctx)
-+{
-+ unsigned long flags;
-+ struct cpt_task_image *ci = cobj->o_image;
-+ struct thr_context thr_ctx;
-+ task_t *tsk;
-+ pid_t pid;
-+ struct fs_struct *tfs = NULL;
-+
-+ flags = rst_mm_flag(ci, ctx) | rst_files_flag(ci, ctx)
-+ | rst_signal_flag(ci, ctx) | rst_semundo_flag(ci, ctx);
-+ if (ci->cpt_rppid != pi->cpt_pid) {
-+ flags |= CLONE_THREAD|CLONE_PARENT;
-+ if (ci->cpt_signal != pi->cpt_signal ||
-+ !(flags&CLONE_SIGHAND) ||
-+ (!(flags&CLONE_VM) && pi->cpt_mm != CPT_NULL)) {
-+ eprintk_ctx("something is wrong with threads: %d %d %d %Ld %Ld %08lx\n",
-+ (int)ci->cpt_pid, (int)ci->cpt_rppid, (int)pi->cpt_pid,
-+ ci->cpt_signal, pi->cpt_signal, flags
-+ );
-+ return -EINVAL;
-+ }
-+ }
-+
-+ thr_ctx.ctx = ctx;
-+ thr_ctx.error = 0;
-+ init_completion(&thr_ctx.init_complete);
-+ init_completion(&thr_ctx.task_done);
-+ thr_ctx.tobj = cobj;
-+
-+#if 0
-+ set_task_ubs(ci, ctx);
-+#endif
-+
-+ if (current->fs == NULL) {
-+ tfs = get_exec_env()->init_entry->fs;
-+ if (tfs == NULL)
-+ return -EINVAL;
-+ atomic_inc(&tfs->count);
-+ current->fs = tfs;
-+ }
-+ pid = local_kernel_thread(hook, &thr_ctx, flags, ci->cpt_pid);
-+ if (tfs) {
-+ current->fs = NULL;
-+ atomic_dec(&tfs->count);
-+ }
-+ if (pid < 0)
-+ return pid;
-+
-+ read_lock(&tasklist_lock);
-+ tsk = find_task_by_pid_ve(pid);
-+ if (tsk)
-+ get_task_struct(tsk);
-+ read_unlock(&tasklist_lock);
-+ if (tsk == NULL)
-+ return -ESRCH;
-+ cpt_obj_setobj(cobj, tsk, ctx);
-+ thr_ctx.tobj = cobj;
-+ wait_for_completion(&thr_ctx.init_complete);
-+#ifdef CONFIG_SMP
-+ wait_task_inactive(cobj->o_obj);
-+#endif
-+ rst_basic_init_task(cobj, ctx);
-+
-+ /* clone() increases group_stop_count if it was not zero and
-+ * CLONE_THREAD was asked. Undo.
-+ */
-+ if (current->signal->group_stop_count && (flags & CLONE_THREAD)) {
-+ if (tsk->signal != current->signal) BUG();
-+ current->signal->group_stop_count--;
-+ }
-+
-+ wake_up_process(tsk);
-+ wait_for_completion(&thr_ctx.task_done);
-+ wait_task_inactive(tsk);
-+
-+ return thr_ctx.error;
-+}
-+
-+static int rst_clone_children(cpt_object_t *obj, struct cpt_context *ctx)
-+{
-+ int err = 0;
-+ struct cpt_task_image *ti = obj->o_image;
-+ cpt_object_t *cobj;
-+
-+ for_each_object(cobj, CPT_OBJ_TASK) {
-+ struct cpt_task_image *ci = cobj->o_image;
-+ if (cobj == obj)
-+ continue;
-+ if ((ci->cpt_rppid == ti->cpt_pid && ci->cpt_tgid == ci->cpt_pid) ||
-+ (ci->cpt_leader == ti->cpt_pid &&
-+ ci->cpt_tgid != ci->cpt_pid && ci->cpt_pid != 1)) {
-+ err = make_baby(cobj, ti, ctx);
-+ if (err) {
-+ eprintk_ctx("make_baby: %d\n", err);
-+ return err;
-+ }
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int read_task_images(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t start, end;
-+
-+ err = rst_get_section(CPT_SECT_TASKS, ctx, &start, &end);
-+ if (err)
-+ return err;
-+
-+ while (start < end) {
-+ cpt_object_t *obj;
-+ struct cpt_task_image *ti = cpt_get_buf(ctx);
-+
-+ err = rst_get_object(CPT_OBJ_TASK, start, ti, ctx);
-+ if (err) {
-+ cpt_release_buf(ctx);
-+ return err;
-+ }
-+ if (ti->cpt_pid != 1 && !__is_virtual_pid(ti->cpt_pid)) {
-+ eprintk_ctx("BUG: pid %d is not virtual\n", ti->cpt_pid);
-+ cpt_release_buf(ctx);
-+ return -EINVAL;
-+ }
-+ obj = alloc_cpt_object(GFP_KERNEL, ctx);
-+ cpt_obj_setpos(obj, start, ctx);
-+ intern_cpt_object(CPT_OBJ_TASK, obj, ctx);
-+ obj->o_image = kmalloc(ti->cpt_next, GFP_KERNEL);
-+ if (obj->o_image == NULL) {
-+ cpt_release_buf(ctx);
-+ return -ENOMEM;
-+ }
-+ memcpy(obj->o_image, ti, sizeof(*ti));
-+ err = ctx->pread(obj->o_image + sizeof(*ti),
-+ ti->cpt_next - sizeof(*ti), ctx, start + sizeof(*ti));
-+ cpt_release_buf(ctx);
-+ if (err)
-+ return err;
-+ start += ti->cpt_next;
-+ }
-+ return 0;
-+}
-+
-+
-+static int vps_rst_restore_tree(struct cpt_context *ctx)
-+{
-+ int err;
-+ cpt_object_t *obj;
-+ struct thr_context thr_ctx_root;
-+
-+ err = read_task_images(ctx);
-+ if (err)
-+ return err;
-+
-+ err = rst_undump_ubc(ctx);
-+ if (err)
-+ return err;
-+
-+ if (virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_RSTCHECK, ctx) & NOTIFY_FAIL)
-+ return -ECHRNG;
-+
-+ err = rst_setup_pagein(ctx);
-+ if (err)
-+ return err;
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ err = create_root_task(obj, ctx, &thr_ctx_root);
-+ if (err)
-+ return err;
-+
-+ wait_for_completion(&thr_ctx_root.init_complete);
-+#ifdef CONFIG_SMP
-+ wait_task_inactive(obj->o_obj);
-+#endif
-+ rst_basic_init_task(obj, ctx);
-+
-+ wake_up_process(obj->o_obj);
-+ wait_for_completion(&thr_ctx_root.task_done);
-+ wait_task_inactive(obj->o_obj);
-+ err = thr_ctx_root.error;
-+ if (err)
-+ return err;
-+ break;
-+ }
-+
-+ return err;
-+}
-+
-+int rst_read_vdso(struct cpt_context *ctx)
-+{
-+ int err;
-+ loff_t start, end;
-+ struct cpt_page_block *pgb;
-+
-+ ctx->vdso = NULL;
-+ err = rst_get_section(CPT_SECT_VSYSCALL, ctx, &start, &end);
-+ if (err)
-+ return err;
-+ if (start == CPT_NULL)
-+ return 0;
-+ if (end < start + sizeof(*pgb) + PAGE_SIZE)
-+ return -EINVAL;
-+
-+ pgb = cpt_get_buf(ctx);
-+ err = rst_get_object(CPT_OBJ_VSYSCALL, start, pgb, ctx);
-+ if (err) {
-+ goto err_buf;
-+ }
-+ ctx->vdso = (char*)__get_free_page(GFP_KERNEL);
-+ if (ctx->vdso == NULL) {
-+ err = -ENOMEM;
-+ goto err_buf;
-+ }
-+ err = ctx->pread(ctx->vdso, PAGE_SIZE, ctx, start + sizeof(*pgb));
-+ if (err)
-+ goto err_page;
-+ if (!memcmp(ctx->vdso, vsyscall_addr, PAGE_SIZE)) {
-+ free_page((unsigned long)ctx->vdso);
-+ ctx->vdso = NULL;
-+ }
-+
-+ cpt_release_buf(ctx);
-+ return 0;
-+err_page:
-+ free_page((unsigned long)ctx->vdso);
-+ ctx->vdso = NULL;
-+err_buf:
-+ cpt_release_buf(ctx);
-+ return err;
-+}
-+
-+int vps_rst_undump(struct cpt_context *ctx)
-+{
-+ int err;
-+ unsigned long umask;
-+
-+ err = rst_open_dumpfile(ctx);
-+ if (err)
-+ return err;
-+
-+#ifndef CONFIG_X86_64
-+ if (ctx->tasks64) {
-+ eprintk_ctx("Cannot restore 64 bit VE on this architecture\n");
-+ return -EINVAL;
-+ }
-+#endif
-+
-+ umask = current->fs->umask;
-+ current->fs->umask = 0;
-+
-+ err = rst_read_vdso(ctx);
-+
-+ if (err == 0)
-+ err = vps_rst_restore_tree(ctx);
-+
-+ if (err == 0)
-+ err = rst_restore_process(ctx);
-+
-+ if (err)
-+ virtinfo_notifier_call(VITYPE_SCP,
-+ VIRTINFO_SCP_RSTFAIL, ctx);
-+
-+ current->fs->umask = umask;
-+
-+ return err;
-+}
-+
-+static int rst_unlock_ve(struct cpt_context *ctx)
-+{
-+ struct ve_struct *env;
-+
-+ env = get_ve_by_id(ctx->ve_id);
-+ if (!env)
-+ return -ESRCH;
-+ down_write(&env->op_sem);
-+ env->is_locked = 0;
-+ up_write(&env->op_sem);
-+ put_ve(env);
-+ return 0;
-+}
-+
-+int rst_resume(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+ int err = 0;
-+
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+
-+ fput(file);
-+ }
-+
-+ rst_resume_network(ctx);
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+ struct cpt_task_image *ti = obj->o_image;
-+
-+ if (!tsk)
-+ continue;
-+
-+ if (ti->cpt_state == TASK_UNINTERRUPTIBLE) {
-+ dprintk_ctx("task %d/%d(%s) is started\n", virt_pid(tsk), tsk->pid, tsk->comm);
-+
-+ /* Weird... If a signal is sent to stopped task,
-+ * nobody makes recalc_sigpending(). We have to do
-+ * this by hands after wake_up_process().
-+ * if we did this before a signal could arrive before
-+ * wake_up_process() and stall.
-+ */
-+ spin_lock_irq(&tsk->sighand->siglock);
-+ if (!signal_pending(tsk))
-+ recalc_sigpending_tsk(tsk);
-+ spin_unlock_irq(&tsk->sighand->siglock);
-+
-+ wake_up_process(tsk);
-+ } else {
-+ if (ti->cpt_state == TASK_STOPPED ||
-+ ti->cpt_state == TASK_TRACED) {
-+ set_task_state(tsk, ti->cpt_state);
-+ }
-+ }
-+ put_task_struct(tsk);
-+ }
-+
-+ rst_unlock_ve(ctx);
-+
-+ rst_complete_pagein(ctx, 0);
-+
-+ rst_finish_ubc(ctx);
-+ cpt_object_destroy(ctx);
-+
-+ return err;
-+}
-+
-+int rst_kill(struct cpt_context *ctx)
-+{
-+ cpt_object_t *obj;
-+ int err = 0;
-+
-+ for_each_object(obj, CPT_OBJ_FILE) {
-+ struct file *file = obj->o_obj;
-+
-+ fput(file);
-+ }
-+
-+ for_each_object(obj, CPT_OBJ_TASK) {
-+ task_t *tsk = obj->o_obj;
-+
-+ if (tsk == NULL)
-+ continue;
-+
-+ if (tsk->exit_state == 0) {
-+ send_sig(SIGKILL, tsk, 1);
-+
-+ spin_lock_irq(&tsk->sighand->siglock);
-+ sigfillset(&tsk->blocked);
-+ sigdelsetmask(&tsk->blocked, sigmask(SIGKILL));
-+ set_tsk_thread_flag(tsk, TIF_SIGPENDING);
-+ clear_tsk_thread_flag(tsk, TIF_FREEZE);
-+ if (tsk->flags & PF_FROZEN)
-+ tsk->flags &= ~PF_FROZEN;
-+ spin_unlock_irq(&tsk->sighand->siglock);
-+
-+ wake_up_process(tsk);
-+ }
-+
-+ put_task_struct(tsk);
-+ }
-+
-+ rst_complete_pagein(ctx, 1);
-+
-+ rst_finish_ubc(ctx);
-+ cpt_object_destroy(ctx);
-+
-+ return err;
-+}
-+
-+static int rst_utsname(cpt_context_t *ctx)
-+{
-+ int err;
-+ loff_t sec = ctx->sections[CPT_SECT_UTSNAME];
-+ loff_t endsec;
-+ struct cpt_section_hdr h;
-+ struct cpt_object_hdr o;
-+ int i;
-+
-+ if (sec == CPT_NULL)
-+ return 0;
-+
-+ err = ctx->pread(&h, sizeof(h), ctx, sec);
-+ if (err)
-+ return err;
-+ if (h.cpt_section != CPT_SECT_UTSNAME || h.cpt_hdrlen < sizeof(h))
-+ return -EINVAL;
-+
-+ i = 0;
-+ endsec = sec + h.cpt_next;
-+ sec += h.cpt_hdrlen;
-+ while (sec < endsec) {
-+ int len;
-+ char *ptr;
-+ err = rst_get_object(CPT_OBJ_NAME, sec, &o, ctx);
-+ if (err)
-+ return err;
-+ len = o.cpt_next - o.cpt_hdrlen;
-+ if (len > __NEW_UTS_LEN+1)
-+ return -ENAMETOOLONG;
-+ switch (i) {
-+ case 0:
-+ ptr = ve_utsname.nodename; break;
-+ case 1:
-+ ptr = ve_utsname.domainname; break;
-+ default:
-+ return -EINVAL;
-+ }
-+ err = ctx->pread(ptr, len, ctx, sec+o.cpt_hdrlen);
-+ if (err)
-+ return err;
-+ i++;
-+ sec += o.cpt_next;
-+ }
-+
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_x8664.S linux-2.6.9-ve023stab030/kernel/cpt/rst_x8664.S
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/rst_x8664.S 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/rst_x8664.S 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,64 @@
-+#define ASSEMBLY 1
-+
-+#include <linux/config.h>
-+
-+#undef CONFIG_DEBUG_INFO
-+
-+#include <linux/linkage.h>
-+#include <asm/segment.h>
-+#include <asm/smp.h>
-+#include <asm/cache.h>
-+#include <asm/errno.h>
-+#include <asm/dwarf2.h>
-+#include <asm/calling.h>
-+#include <asm/offset.h>
-+#include <asm/msr.h>
-+#include <asm/unistd.h>
-+#include <asm/thread_info.h>
-+#include <asm/hw_irq.h>
-+#include <asm/errno.h>
-+
-+ .code64
-+ .global schedule_tail_hook, schedule_tail_p
-+ .align 8
-+schedule_tail_hook:
-+ movq schedule_tail_p(%rip),%r11
-+ call *%r11
-+ GET_THREAD_INFO(%rcx)
-+ btr $22,threadinfo_flags(%rcx) /* TIF_RESUME */
-+ jc 1f
-+ retq
-+
-+ /* If TIF_RESUME is set, (%rsp) is pointer to hook function
-+ * the hook will do the work and jump to the next hook,
-+ * everything should end at ret_from_fork+5.
-+ */
-+1: addq $8,%rsp
-+ retq
-+
-+ .align 8
-+ .global ret_from_fork2
-+ret_from_fork2:
-+ cmpq $0,ORIG_RAX(%rsp)
-+ jge ret_from_fork+5
-+ RESTORE_REST
-+ jmp int_ret_from_sys_call
-+
-+ .align 8
-+ .global ret_last_siginfo
-+ret_last_siginfo:
-+ call rlsi
-+ movq %rax,%rsp
-+ retq
-+
-+ .align 8
-+ .global ret_child_tid
-+ret_child_tid:
-+ movq %rsp,%rdi
-+ call rct
-+ movq %rax,%rsp
-+ retq
-+
-+ .data
-+schedule_tail_p:
-+ .quad 0
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/vzcpt.vzksyms linux-2.6.9-ve023stab030/kernel/cpt/vzcpt.vzksyms
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/vzcpt.vzksyms 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/vzcpt.vzksyms 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,7 @@
-+handle_mm_fault
-+add_to_swap_cache
-+lru_cache_add_active
-+swap_duplicate
-+lookup_swap_cache
-+read_swap_cache_async
-+add_to_swap
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpt/vzrst.vzksyms linux-2.6.9-ve023stab030/kernel/cpt/vzrst.vzksyms
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpt/vzrst.vzksyms 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/cpt/vzrst.vzksyms 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,10 @@
-+free_swap_and_cache
-+__add_to_swap_cache
-+get_swap_page
-+make_pages_present
-+lru_cache_add_active
-+add_to_swap_cache
-+add_to_swap
-+swap_duplicate
-+swap_free
-+syscall_exit
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/cpu.c linux-2.6.9-ve023stab030/kernel/cpu.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/cpu.c 2006-10-11 18:29:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/cpu.c 2006-10-11 19:08:01.000000000 +0400
-@@ -43,13 +43,18 @@ void unregister_cpu_notifier(struct noti
- EXPORT_SYMBOL(unregister_cpu_notifier);
-
- #ifdef CONFIG_HOTPLUG_CPU
-+
-+#ifdef CONFIG_SCHED_VCPU
-+#error "CONFIG_HOTPLUG_CPU isn't supported with CONFIG_SCHED_VCPU"
-+#endif
-+
- static inline void check_for_tasks(int cpu)
- {
- struct task_struct *p;
-
- write_lock_irq(&tasklist_lock);
-- for_each_process(p) {
-- if (task_cpu(p) == cpu && (p->utime != 0 || p->stime != 0))
-+ for_each_process_all(p) {
-+ if (task_pcpu(p) == cpu && (p->utime != 0 || p->stime != 0))
- printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
- (state = %ld, flags = %lx) \n",
- p->comm, p->pid, cpu, p->state, p->flags);
-@@ -105,6 +110,13 @@ static int take_cpu_down(void *unused)
- return err;
- }
-
-+#ifdef CONFIG_SCHED_VCPU
-+#error VCPU vs. HOTPLUG: fix hotplug code below
-+/*
-+ * What should be fixed:
-+ * - check for if (idle_cpu()) yield()
-+ */
-+#endif
- int cpu_down(unsigned int cpu)
- {
- int err;
-@@ -199,6 +211,11 @@ int __devinit cpu_up(unsigned int cpu)
- ret = -EINVAL;
- goto out;
- }
-+
-+ ret = vsched_init_default(cpu);
-+ if (ret)
-+ goto out;
-+
- ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
- if (ret == NOTIFY_BAD) {
- printk("%s: attempt to bring up CPU %u failed\n",
-@@ -220,8 +237,10 @@ int __devinit cpu_up(unsigned int cpu)
- cpu_run_sbin_hotplug(cpu, "online");
-
- out_notify:
-- if (ret != 0)
-+ if (ret != 0) {
- notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu);
-+ vsched_fini_default(cpu);
-+ }
- out:
- up(&cpucontrol);
- return ret;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/dump.c linux-2.6.9-ve023stab030/kernel/dump.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/dump.c 2006-10-11 18:29:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/dump.c 2006-10-11 19:07:57.000000000 +0400
-@@ -88,7 +88,7 @@ static struct gendisk *device_to_gendisk
- int rc;
-
- /* trace symlink to "block" */
-- nd.mnt = mntget(sysfs_mount);
-+ nd.mnt = mntget(visible_sysfs_mount);
- nd.dentry = dget(dev->kobj.dentry);
- nd.flags = LOOKUP_FOLLOW;
- nd.last_type = LAST_ROOT;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/exit.c linux-2.6.9-ve023stab030/kernel/exit.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/exit.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/exit.c 2006-10-11 19:08:02.000000000 +0400
-@@ -25,12 +25,16 @@
- #include <linux/mount.h>
- #include <linux/proc_fs.h>
- #include <linux/mempolicy.h>
-+#include <linux/swap.h>
-+#include <linux/faudit.h>
-
- #include <asm/uaccess.h>
- #include <asm/unistd.h>
- #include <asm/pgtable.h>
- #include <asm/mmu_context.h>
-
-+#include <ub/ub_mem.h>
-+
- extern void sem_exit (void);
- extern struct task_struct *child_reaper;
-
-@@ -49,18 +53,19 @@ static void __unhash_process(struct task
- }
-
- REMOVE_LINKS(p);
-+ REMOVE_VE_LINKS(p);
- }
-
- void release_task(struct task_struct * p)
- {
- int zap_leader;
- task_t *leader;
-- struct dentry *proc_dentry;
-+ struct dentry *proc_dentry[2];
-
- repeat:
- atomic_dec(&p->user->processes);
- spin_lock(&p->proc_lock);
-- proc_dentry = proc_pid_unhash(p);
-+ proc_pid_unhash(p, proc_dentry);
- write_lock_irq(&tasklist_lock);
- if (unlikely(p->ptrace))
- __ptrace_unlink(p);
-@@ -68,6 +73,8 @@ repeat:
- __exit_signal(p);
- __exit_sighand(p);
- __unhash_process(p);
-+ nr_zombie--;
-+ nr_dead++;
-
- /*
- * If we are the last non-leader member of the thread
-@@ -95,6 +102,8 @@ repeat:
- spin_unlock(&p->proc_lock);
- proc_pid_flush(proc_dentry);
- release_thread(p);
-+ if (atomic_dec_and_test(&VE_TASK_INFO(p)->owner_env->pcounter))
-+ do_env_cleanup(VE_TASK_INFO(p)->owner_env);
- put_task_struct(p);
-
- p = leader;
-@@ -106,10 +115,10 @@ repeat:
-
- void unhash_process(struct task_struct *p)
- {
-- struct dentry *proc_dentry;
-+ struct dentry *proc_dentry[2];
-
- spin_lock(&p->proc_lock);
-- proc_dentry = proc_pid_unhash(p);
-+ proc_pid_unhash(p, proc_dentry);
- write_lock_irq(&tasklist_lock);
- __unhash_process(p);
- write_unlock_irq(&tasklist_lock);
-@@ -127,14 +136,16 @@ int session_of_pgrp(int pgrp)
- struct task_struct *p;
- int sid = -1;
-
-+ WARN_ON(is_virtual_pid(pgrp));
-+
- read_lock(&tasklist_lock);
-- do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
-+ do_each_task_pid_ve(pgrp, PIDTYPE_PGID, p) {
- if (p->signal->session > 0) {
- sid = p->signal->session;
- goto out;
- }
-- } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
-- p = find_task_by_pid(pgrp);
-+ } while_each_task_pid_ve(pgrp, PIDTYPE_PGID, p);
-+ p = find_task_by_pid_ve(pgrp);
- if (p)
- sid = p->signal->session;
- out:
-@@ -156,17 +167,19 @@ static int will_become_orphaned_pgrp(int
- struct task_struct *p;
- int ret = 1;
-
-- do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
-+ WARN_ON(is_virtual_pid(pgrp));
-+
-+ do_each_task_pid_ve(pgrp, PIDTYPE_PGID, p) {
- if (p == ignored_task
- || p->exit_state >= EXIT_ZOMBIE
-- || p->real_parent->pid == 1)
-+ || virt_pid(p->real_parent) == 1)
- continue;
- if (process_group(p->real_parent) != pgrp
- && p->real_parent->signal->session == p->signal->session) {
- ret = 0;
- break;
- }
-- } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
-+ } while_each_task_pid_ve(pgrp, PIDTYPE_PGID, p);
- return ret; /* (sighing) "Often!" */
- }
-
-@@ -174,6 +187,8 @@ int is_orphaned_pgrp(int pgrp)
- {
- int retval;
-
-+ WARN_ON(is_virtual_pid(pgrp));
-+
- read_lock(&tasklist_lock);
- retval = will_become_orphaned_pgrp(pgrp, NULL);
- read_unlock(&tasklist_lock);
-@@ -186,7 +201,9 @@ static inline int has_stopped_jobs(int p
- int retval = 0;
- struct task_struct *p;
-
-- do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
-+ WARN_ON(is_virtual_pid(pgrp));
-+
-+ do_each_task_pid_ve(pgrp, PIDTYPE_PGID, p) {
- if (p->state != TASK_STOPPED)
- continue;
-
-@@ -202,7 +219,7 @@ static inline int has_stopped_jobs(int p
-
- retval = 1;
- break;
-- } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
-+ } while_each_task_pid_ve(pgrp, PIDTYPE_PGID, p);
- return retval;
- }
-
-@@ -249,6 +266,9 @@ void __set_special_pids(pid_t session, p
- {
- struct task_struct *curr = current;
-
-+ WARN_ON(is_virtual_pid(pgrp));
-+ WARN_ON(is_virtual_pid(session));
-+
- if (curr->signal->session != session) {
- detach_pid(curr, PIDTYPE_SID);
- curr->signal->session = session;
-@@ -267,6 +287,7 @@ void set_special_pids(pid_t session, pid
- __set_special_pids(session, pgrp);
- write_unlock_irq(&tasklist_lock);
- }
-+EXPORT_SYMBOL(set_special_pids);
-
- /*
- * Let kernel threads use this to say that they
-@@ -513,6 +534,7 @@ void exit_mm(struct task_struct *tsk)
- {
- __exit_mm(tsk);
- }
-+EXPORT_SYMBOL(exit_mm);
-
- static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_reaper)
- {
-@@ -591,13 +613,12 @@ static inline void reparent_thread(task_
- static inline void forget_original_parent(struct task_struct * father,
- struct list_head *to_release)
- {
-- struct task_struct *p, *reaper = father;
-+ struct task_struct *p, *tsk_reaper, *reaper = father;
- struct list_head *_p, *_n;
-
- do {
- reaper = next_thread(reaper);
- if (reaper == father) {
-- reaper = child_reaper;
- break;
- }
- } while (reaper->exit_state >= EXIT_ZOMBIE);
-@@ -619,9 +640,16 @@ static inline void forget_original_paren
- /* if father isn't the real parent, then ptrace must be enabled */
- BUG_ON(father != p->real_parent && !ptrace);
-
-+ tsk_reaper = reaper;
-+ if (tsk_reaper == father)
-+#ifdef CONFIG_VE
-+ tsk_reaper = VE_TASK_INFO(p)->owner_env->init_entry;
-+ if (tsk_reaper == p)
-+#endif
-+ tsk_reaper = child_reaper;
- if (father == p->real_parent) {
-- /* reparent with a reaper, real father it's us */
-- choose_new_parent(p, reaper, child_reaper);
-+ /* reparent with a tsk_reaper, real father it's us */
-+ choose_new_parent(p, tsk_reaper, child_reaper);
- reparent_thread(p, father, 0);
- } else {
- /* reparent ptraced task to its real parent */
-@@ -642,7 +670,15 @@ static inline void forget_original_paren
- }
- list_for_each_safe(_p, _n, &father->ptrace_children) {
- p = list_entry(_p,struct task_struct,ptrace_list);
-- choose_new_parent(p, reaper, child_reaper);
-+
-+ tsk_reaper = reaper;
-+ if (tsk_reaper == father)
-+#ifdef CONFIG_VE
-+ tsk_reaper = VE_TASK_INFO(p)->owner_env->init_entry;
-+ if (tsk_reaper == p)
-+#endif
-+ tsk_reaper = child_reaper;
-+ choose_new_parent(p, tsk_reaper, child_reaper);
- reparent_thread(p, father, 1);
- }
- }
-@@ -738,6 +774,9 @@ static void exit_notify(struct task_stru
- && !capable(CAP_KILL))
- tsk->exit_signal = SIGCHLD;
-
-+ if (tsk->exit_signal != -1 && t == child_reaper)
-+ /* We dont want people slaying init. */
-+ tsk->exit_signal = SIGCHLD;
-
- /* If something other than our normal parent is ptracing us, then
- * send it a SIGCHLD instead of honoring exit_signal. exit_signal
-@@ -756,6 +795,7 @@ static void exit_notify(struct task_stru
- unlikely(tsk->parent->signal->group_exit)))
- state = EXIT_DEAD;
- tsk->exit_state = state;
-+ nr_zombie++;
-
- /*
- * Clear these here so that update_process_times() won't try to deliver
-@@ -782,25 +822,113 @@ static void exit_notify(struct task_stru
- tsk->flags |= PF_DEAD;
- }
-
-+asmlinkage long sys_wait4(pid_t pid, int * stat_addr, int options, struct rusage * ru);
-+
-+#ifdef CONFIG_VE
-+/*
-+ * Handle exitting of init process, it's a special case for VE.
-+ */
-+static void do_initproc_exit(void)
-+{
-+ struct task_struct *tsk;
-+ struct ve_struct *env;
-+ struct siginfo info;
-+ struct task_struct *g, *p;
-+ long delay = 1L;
-+
-+ tsk = current;
-+ env = VE_TASK_INFO(current)->owner_env;
-+ if (env->init_entry != tsk)
-+ return;
-+
-+ if (ve_is_super(env) && tsk->pid == 1)
-+ panic("Attempted to kill init!");
-+
-+ memset(&info, 0, sizeof(info));
-+ info.si_errno = 0;
-+ info.si_code = SI_KERNEL;
-+ info.si_pid = virt_pid(tsk);
-+ info.si_uid = current->uid;
-+ info.si_signo = SIGKILL;
-+
-+ /*
-+ * Here the VE changes its state into "not running".
-+ * op_sem taken for write is a barrier to all VE manipulations from
-+ * ioctl: it waits for operations currently in progress and blocks all
-+ * subsequent operations until is_running is set to 0 and op_sem is
-+ * released.
-+ */
-+ down_write(&env->op_sem);
-+ env->is_running = 0;
-+ up_write(&env->op_sem);
-+
-+ /* send kill to all processes of VE */
-+ read_lock(&tasklist_lock);
-+ do_each_thread_ve(g, p) {
-+ force_sig_info(SIGKILL, &info, p);
-+ } while_each_thread_ve(g, p);
-+ read_unlock(&tasklist_lock);
-+
-+ /* wait for all init childs exit */
-+ while (atomic_read(&env->pcounter) > 1) {
-+ if (sys_wait4(-1, NULL, __WALL | WNOHANG, NULL) > 0)
-+ continue;
-+ /* it was ENOCHLD or no more children somehow */
-+ if (atomic_read(&env->pcounter) == 1)
-+ break;
-+
-+ /* clear all signals to avoid wakeups */
-+ if (signal_pending(tsk))
-+ flush_signals(tsk);
-+ /* we have child without signal sent */
-+ __set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(delay);
-+ delay = (delay < HZ) ? (delay << 1) : HZ;
-+ read_lock(&tasklist_lock);
-+ do_each_thread_ve(g, p) {
-+ if (p != tsk)
-+ force_sig_info(SIGKILL, &info, p);
-+ } while_each_thread_ve(g, p);
-+ read_unlock(&tasklist_lock);
-+ }
-+ env->init_entry = child_reaper;
-+ write_lock_irq(&tasklist_lock);
-+ REMOVE_LINKS(tsk);
-+ tsk->parent = tsk->real_parent = child_reaper;
-+ SET_LINKS(tsk);
-+ write_unlock_irq(&tasklist_lock);
-+}
-+#endif
-+
- asmlinkage NORET_TYPE void do_exit(long code)
- {
- struct task_struct *tsk = current;
- int group_dead;
-+ struct mm_struct *mm;
-
-+ mm = tsk->mm;
- profile_task_exit(tsk);
-
- if (unlikely(in_interrupt()))
- panic("Aiee, killing interrupt handler!");
- if (unlikely(!tsk->pid))
- panic("Attempted to kill the idle task!");
-+#ifndef CONFIG_VE
- if (unlikely(tsk->pid == 1))
- panic("Attempted to kill init!");
-+#else
-+ do_initproc_exit();
-+#endif
-+ virtinfo_gencall(VIRTINFO_DOEXIT, NULL);
-+
- if (tsk->io_context)
- exit_io_context();
-
- if (unlikely(current->ptrace & PT_TRACE_EXIT)) {
- current->ptrace_message = code;
-+ set_pn_state(current, PN_STOP_EXIT);
- ptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP);
-+ clear_pn_state(current);
- }
-
- tsk->flags |= PF_EXITING;
-@@ -840,6 +968,21 @@ asmlinkage NORET_TYPE void do_exit(long
-
- tsk->exit_code = code;
- exit_notify(tsk);
-+
-+ /* In order to allow OOM to happen from now on */
-+ spin_lock(&oom_generation_lock);
-+ if (test_tsk_thread_flag(tsk, TIF_MEMDIE)) {
-+ if (!oom_kill_counter || !--oom_kill_counter)
-+ oom_generation++;
-+ printk("OOM killed process %s (pid=%d, ve=%d) (mm=%p) exited, "
-+ "free=%u gen=%d count=%d.\n",
-+ tsk->comm, tsk->pid,
-+ VEID(VE_TASK_INFO(current)->owner_env),
-+ mm, nr_free_pages(),
-+ oom_generation, oom_kill_counter);
-+ }
-+ spin_unlock(&oom_generation_lock);
-+
- #ifdef CONFIG_NUMA
- mpol_free(tsk->mempolicy);
- tsk->mempolicy = NULL;
-@@ -864,19 +1007,22 @@ EXPORT_SYMBOL(complete_and_exit);
-
- asmlinkage long sys_exit(int error_code)
- {
-+ virtinfo_notifier_call(VITYPE_FAUDIT,
-+ VIRTINFO_FAUDIT_EXIT, &error_code);
- do_exit((error_code&0xff)<<8);
- }
-
- task_t fastcall *next_thread(const task_t *p)
- {
-+ task_t *tsk;
- #ifdef CONFIG_SMP
-- if (!p->sighand)
-- BUG();
-- if (!spin_is_locked(&p->sighand->siglock) &&
-- !rwlock_is_locked(&tasklist_lock))
-+ if (!rwlock_is_locked(&tasklist_lock) || p->pids[PIDTYPE_TGID].nr == 0)
- BUG();
- #endif
-- return pid_task(p->pids[PIDTYPE_TGID].pid_list.next, PIDTYPE_TGID);
-+ tsk = pid_task(p->pids[PIDTYPE_TGID].pid_list.next, PIDTYPE_TGID);
-+ /* all threads should belong to ONE ve! */
-+ BUG_ON(VE_TASK_INFO(tsk)->owner_env != VE_TASK_INFO(p)->owner_env);
-+ return tsk;
- }
-
- EXPORT_SYMBOL(next_thread);
-@@ -926,14 +1072,19 @@ asmlinkage void sys_exit_group(int error
- static int eligible_child(pid_t pid, int options, task_t *p)
- {
- if (pid > 0) {
-- if (p->pid != pid)
-+ if ((is_virtual_pid(pid) ? virt_pid(p) : p->pid) != pid)
- return 0;
- } else if (!pid) {
- if (process_group(p) != process_group(current))
- return 0;
- } else if (pid != -1) {
-- if (process_group(p) != -pid)
-- return 0;
-+ if (__is_virtual_pid(-pid)) {
-+ if (virt_pgid(p) != -pid)
-+ return 0;
-+ } else {
-+ if (process_group(p) != -pid)
-+ return 0;
-+ }
- }
-
- /*
-@@ -1112,7 +1263,7 @@ static int wait_task_zombie(task_t *p, i
- p->exit_state = EXIT_ZOMBIE;
- return retval;
- }
-- retval = p->pid;
-+ retval = get_task_pid(p);
- if (p->real_parent != p->parent) {
- write_lock_irq(&tasklist_lock);
- /* Double-check with lock held. */
-@@ -1247,7 +1398,7 @@ bail_ref:
- if (!retval && infop)
- retval = put_user(p->uid, &infop->si_uid);
- if (!retval)
-- retval = p->pid;
-+ retval = get_task_pid(p);
- put_task_struct(p);
-
- BUG_ON(!retval);
-@@ -1528,6 +1679,7 @@ asmlinkage long sys_wait4(pid_t pid, int
- prevent_tail_call(ret);
- return ret;
- }
-+EXPORT_SYMBOL(sys_wait4);
-
- #ifdef __ARCH_WANT_SYS_WAITPID
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/extable.c linux-2.6.9-ve023stab030/kernel/extable.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/extable.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/extable.c 2006-10-11 19:07:57.000000000 +0400
-@@ -49,6 +49,7 @@ static int core_kernel_text(unsigned lon
- if (addr >= (unsigned long)_sinittext &&
- addr <= (unsigned long)_einittext)
- return 1;
-+
- return 0;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/fairsched.c linux-2.6.9-ve023stab030/kernel/fairsched.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/fairsched.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/fairsched.c 2006-10-11 19:08:01.000000000 +0400
-@@ -0,0 +1,1338 @@
-+/*
-+ * Fair Scheduler
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * Start-tag scheduling follows the theory presented in
-+ * http://www.cs.utexas.edu/users/dmcl/papers/ps/SIGCOMM96.ps
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <asm/timex.h>
-+#include <asm/atomic.h>
-+#include <linux/spinlock.h>
-+#include <asm/semaphore.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/proc_fs.h>
-+#include <linux/seq_file.h>
-+#include <linux/fs.h>
-+#include <linux/vmalloc.h>
-+#include <linux/dcache.h>
-+#include <linux/sysctl.h>
-+#include <linux/module.h>
-+#include <linux/sched.h>
-+#include <linux/fairsched.h>
-+#include <linux/vsched.h>
-+#include <asm/pgtable.h>
-+
-+#ifdef CONFIG_USER_RESOURCE
-+#include <ub/ub_mem.h>
-+#else
-+#define ub_vmalloc vmalloc
-+#endif
-+
-+/* we need it for vsched routines in sched.c */
-+spinlock_t fairsched_lock = SPIN_LOCK_UNLOCKED;
-+
-+#ifdef CONFIG_FAIRSCHED
-+
-+#define FAIRSHED_DEBUG " debug"
-+
-+
-+/*********************************************************************/
-+/*
-+ * Special arithmetics
-+ */
-+/*********************************************************************/
-+
-+#define CYCLES_SHIFT (8)
-+#define SCYCLES_TIME(time) \
-+ ((scycles_t) {((time) + (1 << CYCLES_SHIFT) - 1) >> CYCLES_SHIFT})
-+
-+#define CYCLES_ZERO (0)
-+static inline int CYCLES_BEFORE(cycles_t x, cycles_t y)
-+{
-+ return (__s64)(x-y) < 0;
-+}
-+static inline int CYCLES_AFTER(cycles_t x, cycles_t y)
-+{
-+ return (__s64)(y-x) < 0;
-+}
-+static inline void CYCLES_DADD(cycles_t *x, fschdur_t y) {*x+=y.d;}
-+
-+#define FSCHDUR_ZERO (0)
-+#define TICK_DUR ((fschdur_t){cycles_per_jiffy})
-+static inline fschdur_t FSCHDURATION(cycles_t x, cycles_t y)
-+{
-+ return (fschdur_t){x - y};
-+}
-+static inline int FSCHDUR_CMP(fschdur_t x, fschdur_t y)
-+{
-+ if (x.d < y.d) return -1;
-+ if (x.d > y.d) return 1;
-+ return 0;
-+}
-+static inline fschdur_t FSCHDUR_SUB(fschdur_t x, fschdur_t y)
-+{
-+ return (fschdur_t){x.d - y.d};
-+}
-+
-+#define FSCHTAG_ZERO ((fschtag_t){0})
-+static inline int FSCHTAG_CMP(fschtag_t x, fschtag_t y)
-+{
-+ if (x.t < y.t) return -1;
-+ if (x.t > y.t) return 1;
-+ return 0;
-+}
-+static inline fschtag_t FSCHTAG_MAX(fschtag_t x, fschtag_t y)
-+{
-+ return x.t >= y.t ? x : y;
-+}
-+static inline int FSCHTAG_DADD(fschtag_t *tag, fschdur_t dur, unsigned w)
-+{
-+ cycles_t new_tag;
-+ new_tag = tag->t + (cycles_t)dur.d * w;
-+ if (new_tag < tag->t)
-+ return -1;
-+ /* DEBUG */
-+ if (new_tag >= (1ULL << 48))
-+ return -1;
-+ tag->t = new_tag;
-+ return 0;
-+}
-+static inline int FSCHTAG_ADD(fschtag_t *tag, fschtag_t y)
-+{
-+ cycles_t new_tag;
-+ new_tag = tag->t + y.t;
-+ if (new_tag < tag->t)
-+ return -1;
-+ tag->t = new_tag;
-+ return 0;
-+}
-+static inline fschtag_t FSCHTAG_SUB(fschtag_t x, fschtag_t y)
-+{
-+ return (fschtag_t){x.t - y.t};
-+}
-+
-+#define FSCHVALUE_ZERO ((fschvalue_t){0})
-+#define TICK_VALUE ((fschvalue_t){(cycles_t)cycles_per_jiffy << FSCHRATE_SHIFT})
-+static inline fschvalue_t FSCHVALUE(unsigned long t)
-+{
-+ return (fschvalue_t){(cycles_t)t << FSCHRATE_SHIFT};
-+}
-+static inline int FSCHVALUE_CMP(fschvalue_t x, fschvalue_t y)
-+{
-+ if (x.v < y.v) return -1;
-+ if (x.v > y.v) return 1;
-+ return 0;
-+}
-+static inline void FSCHVALUE_DADD(fschvalue_t *val, fschdur_t dur,
-+ unsigned rate)
-+{
-+ val->v += (cycles_t)dur.d * rate;
-+}
-+static inline fschvalue_t FSCHVALUE_SUB(fschvalue_t x, fschvalue_t y)
-+{
-+ return (fschvalue_t){x.v - y.v};
-+}
-+static inline cycles_t FSCHVALUE_TO_DELAY(fschvalue_t val, unsigned rate)
-+{
-+ unsigned long t;
-+ /*
-+ * Here we lose precision to make the division 32-bit on IA-32.
-+ * The value is not greater than TICK_VALUE.
-+ * (TICK_VALUE >> FSCHRATE_SHIFT) fits unsigned long.
-+ */
-+ t = (val.v + (1 << FSCHRATE_SHIFT) - 1) >> FSCHRATE_SHIFT;
-+ return (cycles_t)((t + rate - 1) / rate) << FSCHRATE_SHIFT;
-+}
-+
-+
-+/*********************************************************************/
-+/*
-+ * Global data
-+ */
-+/*********************************************************************/
-+
-+#define fsch_assert(x) \
-+ do { \
-+ static int count; \
-+ if (!(x) && count++ < 10) \
-+ printk("fsch_assert " #x " failed\n"); \
-+ } while (0)
-+
-+/*
-+ * Configurable parameters
-+ */
-+unsigned fairsched_max_latency = 25; /* jiffies */
-+
-+/*
-+ * Parameters initialized at startup
-+ */
-+/* Number of online CPUs */
-+unsigned fairsched_nr_cpus;
-+/* Token Bucket depth (burst size) */
-+static fschvalue_t max_value;
-+
-+struct fairsched_node fairsched_init_node = {
-+ .id = INT_MAX,
-+#ifdef CONFIG_VE
-+ .owner_env = get_ve0(),
-+#endif
-+ .weight = 1,
-+};
-+EXPORT_SYMBOL(fairsched_init_node);
-+
-+struct fairsched_node fairsched_idle_node = {
-+ .id = -1,
-+};
-+
-+static int fairsched_nr_nodes;
-+static LIST_HEAD(fairsched_node_head);
-+static LIST_HEAD(fairsched_running_head);
-+static LIST_HEAD(fairsched_delayed_head);
-+
-+DEFINE_PER_CPU(cycles_t, prev_schedule);
-+static fschtag_t max_latency;
-+
-+static DECLARE_MUTEX(fairsched_mutex);
-+
-+/*********************************************************************/
-+/*
-+ * Small helper routines
-+ */
-+/*********************************************************************/
-+
-+/* this didn't proved to be very valuable statistics... */
-+#define fairsched_inc_ve_strv(node, cycles) do {} while(0)
-+#define fairsched_dec_ve_strv(node, cycles) do {} while(0)
-+
-+/*********************************************************************/
-+/*
-+ * Runlist management
-+ */
-+/*********************************************************************/
-+
-+/*
-+ * Returns the start_tag of the first runnable node, or 0.
-+ */
-+static inline fschtag_t virtual_time(void)
-+{
-+ struct fairsched_node *p;
-+
-+ if (!list_empty(&fairsched_running_head)) {
-+ p = list_first_entry(&fairsched_running_head,
-+ struct fairsched_node, runlist);
-+ return p->start_tag;
-+ }
-+ return FSCHTAG_ZERO;
-+}
-+
-+static void fairsched_recompute_max_latency(void)
-+{
-+ struct fairsched_node *p;
-+ unsigned w;
-+ fschtag_t tag;
-+
-+ w = FSCHWEIGHT_MAX;
-+ list_for_each_entry(p, &fairsched_node_head, nodelist) {
-+ if (p->weight < w)
-+ w = p->weight;
-+ }
-+ tag = FSCHTAG_ZERO;
-+ (void) FSCHTAG_DADD(&tag, TICK_DUR,
-+ fairsched_nr_cpus * fairsched_max_latency * w);
-+ max_latency = tag;
-+}
-+
-+static void fairsched_reset_start_tags(void)
-+{
-+ struct fairsched_node *cnode;
-+ fschtag_t min_tag;
-+
-+ min_tag = virtual_time();
-+ list_for_each_entry(cnode, &fairsched_node_head, nodelist) {
-+ if (FSCHTAG_CMP(cnode->start_tag, min_tag) > 0)
-+ cnode->start_tag = FSCHTAG_SUB(cnode->start_tag,
-+ min_tag);
-+ else
-+ cnode->start_tag = FSCHTAG_ZERO;
-+ }
-+}
-+
-+static void fairsched_running_insert(struct fairsched_node *node)
-+{
-+ struct list_head *tmp;
-+ struct fairsched_node *p;
-+ fschtag_t start_tag_max;
-+
-+ if (!list_empty(&fairsched_running_head)) {
-+ start_tag_max = virtual_time();
-+ if (!FSCHTAG_ADD(&start_tag_max, max_latency) &&
-+ FSCHTAG_CMP(start_tag_max, node->start_tag) < 0)
-+ node->start_tag = start_tag_max;
-+ }
-+
-+ list_for_each(tmp, &fairsched_running_head) {
-+ p = list_entry(tmp, struct fairsched_node, runlist);
-+ if (FSCHTAG_CMP(node->start_tag, p->start_tag) <= 0)
-+ break;
-+ }
-+ /* insert node just before tmp */
-+ list_add_tail(&node->runlist, tmp);
-+}
-+
-+static inline void fairsched_running_insert_fromsleep(
-+ struct fairsched_node *node)
-+{
-+ node->start_tag = FSCHTAG_MAX(node->start_tag, virtual_time());
-+ fairsched_running_insert(node);
-+}
-+
-+
-+/*********************************************************************/
-+/*
-+ * CPU limiting helper functions
-+ *
-+ * These functions compute rates, delays and manipulate with sleep
-+ * lists and so on.
-+ */
-+/*********************************************************************/
-+
-+/*
-+ * Insert a node into the list of nodes removed from scheduling,
-+ * sorted by the time at which the the node is allowed to run,
-+ * historically called `delay'.
-+ */
-+static void fairsched_delayed_insert(struct fairsched_node *node)
-+{
-+ struct fairsched_node *p;
-+ struct list_head *tmp;
-+
-+ list_for_each(tmp, &fairsched_delayed_head) {
-+ p = list_entry(tmp, struct fairsched_node,
-+ runlist);
-+ if (CYCLES_AFTER(p->delay, node->delay))
-+ break;
-+ }
-+ /* insert node just before tmp */
-+ list_add_tail(&node->runlist, tmp);
-+}
-+
-+static inline void nodevalue_add(struct fairsched_node *node,
-+ fschdur_t duration, unsigned rate)
-+{
-+ FSCHVALUE_DADD(&node->value, duration, rate);
-+ if (FSCHVALUE_CMP(node->value, max_value) > 0)
-+ node->value = max_value;
-+}
-+
-+/*
-+ * The node has been selected to run.
-+ * This function accounts in advance for the time that the node will run.
-+ * The advance not used by the node will be credited back.
-+ */
-+static void fairsched_ratelimit_charge_advance(
-+ struct fairsched_node *node,
-+ cycles_t time)
-+{
-+ fsch_assert(!node->delayed);
-+ fsch_assert(FSCHVALUE_CMP(node->value, TICK_VALUE) >= 0);
-+
-+ /*
-+ * Account for the time passed since last update.
-+ * It might be needed if the node has become runnable because of
-+ * a wakeup, but hasn't gone through other functions updating
-+ * the bucket value.
-+ */
-+ if (CYCLES_AFTER(time, node->last_updated_at)) {
-+ nodevalue_add(node, FSCHDURATION(time, node->last_updated_at),
-+ node->rate);
-+ node->last_updated_at = time;
-+ }
-+
-+ /* charge for the full tick the node might be running */
-+ node->value = FSCHVALUE_SUB(node->value, TICK_VALUE);
-+ if (FSCHVALUE_CMP(node->value, TICK_VALUE) < 0) {
-+ list_del(&node->runlist);
-+ node->delayed = 1;
-+ node->delay = node->last_updated_at + FSCHVALUE_TO_DELAY(
-+ FSCHVALUE_SUB(TICK_VALUE, node->value),
-+ node->rate);
-+ node->nr_ready = 0;
-+ fairsched_delayed_insert(node);
-+ }
-+}
-+
-+static void fairsched_ratelimit_credit_unused(
-+ struct fairsched_node *node,
-+ cycles_t time, fschdur_t duration)
-+{
-+ /* account for the time passed since last update */
-+ if (CYCLES_AFTER(time, node->last_updated_at)) {
-+ nodevalue_add(node, FSCHDURATION(time, node->last_updated_at),
-+ node->rate);
-+ node->last_updated_at = time;
-+ }
-+
-+ /*
-+ * When the node was given this CPU, it was charged for 1 tick.
-+ * Credit back the unused time.
-+ */
-+ if (FSCHDUR_CMP(duration, TICK_DUR) < 0)
-+ nodevalue_add(node, FSCHDUR_SUB(TICK_DUR, duration),
-+ 1 << FSCHRATE_SHIFT);
-+
-+ /* check if the node is allowed to run */
-+ if (FSCHVALUE_CMP(node->value, TICK_VALUE) < 0) {
-+ /*
-+ * The node was delayed and remain such.
-+ * But since the bucket value has been updated,
-+ * update the delay time and move the node in the list.
-+ */
-+ fsch_assert(node->delayed);
-+ node->delay = node->last_updated_at + FSCHVALUE_TO_DELAY(
-+ FSCHVALUE_SUB(TICK_VALUE, node->value),
-+ node->rate);
-+ } else if (node->delayed) {
-+ /*
-+ * The node was delayed, but now it is allowed to run.
-+ * We do not manipulate with lists, it will be done by the
-+ * caller.
-+ */
-+ node->nr_ready = node->nr_runnable;
-+ node->delayed = 0;
-+ }
-+}
-+
-+static void fairsched_delayed_wake(cycles_t time)
-+{
-+ struct fairsched_node *p;
-+
-+ while (!list_empty(&fairsched_delayed_head)) {
-+ p = list_entry(fairsched_delayed_head.next,
-+ struct fairsched_node,
-+ runlist);
-+ if (CYCLES_AFTER(p->delay, time))
-+ break;
-+
-+ /* ok, the delay period is completed */
-+ /* account for the time passed since last update */
-+ if (CYCLES_AFTER(time, p->last_updated_at)) {
-+ nodevalue_add(p, FSCHDURATION(time, p->last_updated_at),
-+ p->rate);
-+ p->last_updated_at = time;
-+ }
-+
-+ fsch_assert(FSCHVALUE_CMP(p->value, TICK_VALUE) >= 0);
-+ p->nr_ready = p->nr_runnable;
-+ p->delayed = 0;
-+ list_del_init(&p->runlist);
-+ if (p->nr_ready)
-+ fairsched_running_insert_fromsleep(p);
-+ }
-+}
-+
-+static struct fairsched_node *fairsched_find(unsigned int id);
-+
-+void fairsched_cpu_online_map(int id, cpumask_t *mask)
-+{
-+ struct fairsched_node *node;
-+
-+ down(&fairsched_mutex);
-+ node = fairsched_find(id);
-+ if (node == NULL)
-+ *mask = CPU_MASK_NONE;
-+ else
-+ vsched_cpu_online_map(node->vsched, mask);
-+ up(&fairsched_mutex);
-+}
-+
-+
-+/*********************************************************************/
-+/*
-+ * The heart of the algorithm:
-+ * fairsched_incrun, fairsched_decrun, fairsched_schedule
-+ *
-+ * Note: old property nr_ready >= nr_pcpu doesn't hold anymore.
-+ * However, nr_runnable, nr_ready and delayed are maintained in sync.
-+ */
-+/*********************************************************************/
-+
-+/*
-+ * Called on a wakeup inside the node.
-+ */
-+void fairsched_incrun(struct fairsched_node *node)
-+{
-+ if (!node->delayed && !node->nr_ready++)
-+ /* the node wasn't on the running list, insert */
-+ fairsched_running_insert_fromsleep(node);
-+ node->nr_runnable++;
-+}
-+
-+/*
-+ * Called from inside schedule() when a sleeping state is entered.
-+ */
-+void fairsched_decrun(struct fairsched_node *node)
-+{
-+ if (!node->delayed && !--node->nr_ready)
-+ /* nr_ready changed 1->0, remove from the running list */
-+ list_del_init(&node->runlist);
-+ --node->nr_runnable;
-+}
-+
-+void fairsched_inccpu(struct fairsched_node *node)
-+{
-+ node->nr_pcpu++;
-+ fairsched_dec_ve_strv(node, cycles);
-+}
-+
-+static inline void __fairsched_deccpu(struct fairsched_node *node)
-+{
-+ node->nr_pcpu--;
-+ fairsched_inc_ve_strv(node, cycles);
-+}
-+
-+void fairsched_deccpu(struct fairsched_node *node)
-+{
-+ if (node == &fairsched_idle_node)
-+ return;
-+
-+ __fairsched_deccpu(node);
-+}
-+
-+static void fairsched_account(struct fairsched_node *node,
-+ cycles_t time)
-+{
-+ fschdur_t duration;
-+
-+ duration = FSCHDURATION(time, __get_cpu_var(prev_schedule));
-+#ifdef CONFIG_VE
-+ CYCLES_DADD(&node->owner_env->cpu_used_ve, duration);
-+#endif
-+
-+ /*
-+ * The duration is not greater than TICK_DUR since
-+ * task->need_resched is always 1.
-+ */
-+ if (FSCHTAG_DADD(&node->start_tag, duration, node->weight)) {
-+ fairsched_reset_start_tags();
-+ (void) FSCHTAG_DADD(&node->start_tag, duration,
-+ node->weight);
-+ }
-+
-+ list_del_init(&node->runlist);
-+ if (node->rate_limited)
-+ fairsched_ratelimit_credit_unused(node, time, duration);
-+ if (!node->delayed) {
-+ if (node->nr_ready)
-+ fairsched_running_insert(node);
-+ } else
-+ fairsched_delayed_insert(node);
-+}
-+
-+/*
-+ * Scheduling decision
-+ *
-+ * Updates CPU usage for the node releasing the CPU and selects a new node.
-+ */
-+struct fairsched_node *fairsched_schedule(
-+ struct fairsched_node *prev_node,
-+ struct fairsched_node *cur_node,
-+ int cur_node_active,
-+ cycles_t time)
-+{
-+ struct fairsched_node *p;
-+
-+ if (prev_node != &fairsched_idle_node)
-+ fairsched_account(prev_node, time);
-+ __get_cpu_var(prev_schedule) = time;
-+
-+ fairsched_delayed_wake(time);
-+
-+ list_for_each_entry(p, &fairsched_running_head, runlist) {
-+ if (p->nr_pcpu < p->nr_ready ||
-+ (cur_node_active && p == cur_node)) {
-+ if (p->rate_limited)
-+ fairsched_ratelimit_charge_advance(p, time);
-+ return p;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+
-+/*********************************************************************/
-+/*
-+ * System calls
-+ *
-+ * All do_xxx functions are called under fairsched semaphore and after
-+ * capability check.
-+ *
-+ * The binary interfaces follow some other Fair Scheduler implementations
-+ * (although some system call arguments are not needed for our implementation).
-+ */
-+/*********************************************************************/
-+
-+static struct fairsched_node *fairsched_find(unsigned int id)
-+{
-+ struct fairsched_node *p;
-+
-+ list_for_each_entry(p, &fairsched_node_head, nodelist) {
-+ if (p->id == id)
-+ return p;
-+ }
-+ return NULL;
-+}
-+
-+static int do_fairsched_mknod(unsigned int parent, unsigned int weight,
-+ unsigned int newid)
-+{
-+ struct fairsched_node *node;
-+ int retval;
-+
-+ retval = -EINVAL;
-+ if (weight < 1 || weight > FSCHWEIGHT_MAX)
-+ goto out;
-+ if (newid < 0 || newid > INT_MAX)
-+ goto out;
-+
-+ retval = -EBUSY;
-+ if (fairsched_find(newid) != NULL)
-+ goto out;
-+
-+ retval = -ENOMEM;
-+ node = kmalloc(sizeof(*node), GFP_KERNEL);
-+ if (node == NULL)
-+ goto out;
-+
-+ memset(node, 0, sizeof(*node));
-+ node->weight = weight;
-+ INIT_LIST_HEAD(&node->runlist);
-+ node->id = newid;
-+ node->vcpus = 0;
-+#ifdef CONFIG_VE
-+ node->owner_env = get_exec_env();
-+#endif
-+
-+ spin_lock_irq(&fairsched_lock);
-+ list_add(&node->nodelist, &fairsched_node_head);
-+ fairsched_nr_nodes++;
-+ fairsched_recompute_max_latency();
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ retval = newid;
-+out:
-+ return retval;
-+}
-+
-+asmlinkage int sys_fairsched_mknod(unsigned int parent, unsigned int weight,
-+ unsigned int newid)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_mknod(parent, weight, newid);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+EXPORT_SYMBOL(sys_fairsched_mknod);
-+
-+static int do_fairsched_rmnod(unsigned int id)
-+{
-+ struct fairsched_node *node;
-+ int retval;
-+
-+ retval = -EINVAL;
-+ node = fairsched_find(id);
-+ if (node == NULL)
-+ goto out;
-+ if (node == &fairsched_init_node)
-+ goto out;
-+
-+ retval = vsched_destroy(node->vsched);
-+ if (retval)
-+ goto out;
-+
-+ spin_lock_irq(&fairsched_lock);
-+ list_del(&node->runlist); /* required for delayed nodes */
-+ list_del(&node->nodelist);
-+ fairsched_nr_nodes--;
-+ fairsched_recompute_max_latency();
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ kfree(node);
-+ retval = 0;
-+out:
-+ return retval;
-+}
-+
-+asmlinkage int sys_fairsched_rmnod(unsigned int id)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_rmnod(id);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+EXPORT_SYMBOL(sys_fairsched_rmnod);
-+
-+int do_fairsched_chwt(unsigned int id, unsigned weight)
-+{
-+ struct fairsched_node *node;
-+
-+ if (id == 0)
-+ return -EINVAL;
-+ if (weight < 1 || weight > FSCHWEIGHT_MAX)
-+ return -EINVAL;
-+
-+ node = fairsched_find(id);
-+ if (node == NULL)
-+ return -ENOENT;
-+
-+ spin_lock_irq(&fairsched_lock);
-+ node->weight = weight;
-+ fairsched_recompute_max_latency();
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ return 0;
-+}
-+
-+asmlinkage int sys_fairsched_chwt(unsigned int id, unsigned weight)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_chwt(id, weight);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+
-+int do_fairsched_vcpus(unsigned int id, unsigned int vcpus)
-+{
-+ struct fairsched_node *node;
-+ int ret = 0;
-+
-+ if (id == 0)
-+ return -EINVAL;
-+
-+ node = fairsched_find(id);
-+ if (node == NULL)
-+ return -ENOENT;
-+
-+ if (vcpus < 1 || vcpus > num_online_cpus())
-+ vcpus = num_online_cpus();
-+
-+ node->vcpus = vcpus;
-+ if (node->vsched != NULL) {
-+ ret = vsched_set_vcpus(node->vsched, vcpus);
-+ /* FIXME: adjust rate ... */
-+ }
-+
-+ return ret;
-+}
-+
-+asmlinkage int sys_fairsched_vcpus(unsigned int id, unsigned int vcpus)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_vcpus(id, vcpus);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+EXPORT_SYMBOL(sys_fairsched_vcpus);
-+
-+int do_fairsched_rate(unsigned int id, int op, unsigned rate)
-+{
-+ struct fairsched_node *node;
-+ cycles_t time;
-+ int retval;
-+
-+ if (id == 0)
-+ return -EINVAL;
-+ if (op == 0 && (rate < 1 || rate >= (1UL << 31)))
-+ return -EINVAL;
-+
-+ node = fairsched_find(id);
-+ if (node == NULL)
-+ return -ENOENT;
-+
-+ retval = -EINVAL;
-+ spin_lock_irq(&fairsched_lock);
-+ time = get_cycles();
-+ switch (op) {
-+ case 0:
-+ node->rate = rate;
-+ if (node->rate > (fairsched_nr_cpus << FSCHRATE_SHIFT))
-+ node->rate =
-+ fairsched_nr_cpus << FSCHRATE_SHIFT;
-+ node->rate_limited = 1;
-+ node->value = max_value;
-+ if (node->delayed) {
-+ list_del(&node->runlist);
-+ node->delay = time;
-+ fairsched_delayed_insert(node);
-+ node->last_updated_at = time;
-+ fairsched_delayed_wake(time);
-+ }
-+ retval = node->rate;
-+ break;
-+ case 1:
-+ node->rate = 0; /* This assignment is not needed
-+ for the kernel code, and it should
-+ not rely on rate being 0 when it's
-+ unset. This is a band-aid for some
-+ existing tools (don't know which one
-+ exactly). --SAW */
-+ node->rate_limited = 0;
-+ node->value = max_value;
-+ if (node->delayed) {
-+ list_del(&node->runlist);
-+ node->delay = time;
-+ fairsched_delayed_insert(node);
-+ node->last_updated_at = time;
-+ fairsched_delayed_wake(time);
-+ }
-+ retval = 0;
-+ break;
-+ case 2:
-+ if (node->rate_limited)
-+ retval = node->rate;
-+ else
-+ retval = -ENODATA;
-+ break;
-+ }
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ return retval;
-+}
-+
-+asmlinkage int sys_fairsched_rate(unsigned int id, int op, unsigned rate)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_rate(id, op, rate);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+
-+/*
-+ * Called under fairsched_mutex.
-+ */
-+static int __do_fairsched_mvpr(struct task_struct *p,
-+ struct fairsched_node *node)
-+{
-+ int retval;
-+
-+ if (node->vsched == NULL) {
-+ retval = vsched_create(node->id, node);
-+ if (retval < 0)
-+ return retval;
-+ }
-+
-+ /* no need to destroy vsched in case of mvpr failure */
-+ return vsched_mvpr(p, node->vsched);
-+}
-+
-+int do_fairsched_mvpr(pid_t pid, unsigned int nodeid)
-+{
-+ struct task_struct *p;
-+ struct fairsched_node *node;
-+ int retval;
-+
-+ retval = -ENOENT;
-+ node = fairsched_find(nodeid);
-+ if (node == NULL)
-+ goto out;
-+
-+ read_lock(&tasklist_lock);
-+ retval = -ESRCH;
-+ p = find_task_by_pid_all(pid);
-+ if (p == NULL)
-+ goto out_unlock;
-+ get_task_struct(p);
-+ read_unlock(&tasklist_lock);
-+
-+ retval = __do_fairsched_mvpr(p, node);
-+ put_task_struct(p);
-+ return retval;
-+
-+out_unlock:
-+ read_unlock(&tasklist_lock);
-+out:
-+ return retval;
-+}
-+
-+asmlinkage int sys_fairsched_mvpr(pid_t pid, unsigned int nodeid)
-+{
-+ int retval;
-+
-+ if (!capable(CAP_SETVEID))
-+ return -EPERM;
-+
-+ down(&fairsched_mutex);
-+ retval = do_fairsched_mvpr(pid, nodeid);
-+ up(&fairsched_mutex);
-+
-+ return retval;
-+}
-+EXPORT_SYMBOL(sys_fairsched_mvpr);
-+
-+
-+/*********************************************************************/
-+/*
-+ * proc interface
-+ */
-+/*********************************************************************/
-+
-+struct fairsched_node_dump {
-+#ifdef CONFIG_VE
-+ envid_t veid;
-+#endif
-+ int id;
-+ unsigned weight;
-+ unsigned rate;
-+ unsigned rate_limited : 1,
-+ delayed : 1;
-+ fschtag_t start_tag;
-+ fschvalue_t value;
-+ cycles_t delay;
-+ int nr_ready;
-+ int nr_runnable;
-+ int nr_pcpu;
-+ int nr_tasks, nr_runtasks;
-+};
-+
-+struct fairsched_dump {
-+ int len, compat;
-+ struct fairsched_node_dump nodes[0];
-+};
-+
-+static struct fairsched_dump *fairsched_do_dump(int compat)
-+{
-+ int nr_nodes;
-+ int len, i;
-+ struct fairsched_dump *dump;
-+ struct fairsched_node *node;
-+ struct fairsched_node_dump *p;
-+ unsigned long flags;
-+
-+start:
-+ nr_nodes = (ve_is_super(get_exec_env()) ? fairsched_nr_nodes + 16 : 1);
-+ len = sizeof(*dump) + nr_nodes * sizeof(dump->nodes[0]);
-+ dump = ub_vmalloc(len);
-+ if (dump == NULL)
-+ goto out;
-+
-+ spin_lock_irqsave(&fairsched_lock, flags);
-+ if (ve_is_super(get_exec_env()) && nr_nodes < fairsched_nr_nodes)
-+ goto repeat;
-+ p = dump->nodes;
-+ list_for_each_entry_reverse(node, &fairsched_node_head, nodelist) {
-+ if ((char *)p - (char *)dump >= len)
-+ break;
-+ p->nr_tasks = 0;
-+ p->nr_runtasks = 0;
-+#ifdef CONFIG_VE
-+ if (!ve_accessible(node->owner_env, get_exec_env()))
-+ continue;
-+ p->veid = node->owner_env->veid;
-+ if (compat) {
-+ p->nr_tasks = atomic_read(&node->owner_env->pcounter);
-+ for (i = 0; i < NR_CPUS; i++)
-+ p->nr_runtasks +=
-+ VE_CPU_STATS(node->owner_env, i)
-+ ->nr_running;
-+ if (p->nr_runtasks < 0)
-+ p->nr_runtasks = 0;
-+ }
-+#endif
-+ p->id = node->id;
-+ p->weight = node->weight;
-+ p->rate = node->rate;
-+ p->rate_limited = node->rate_limited;
-+ p->delayed = node->delayed;
-+ p->start_tag = node->start_tag;
-+ p->value = node->value;
-+ p->delay = node->delay;
-+ p->nr_ready = node->nr_ready;
-+ p->nr_runnable = node->nr_runnable;
-+ p->nr_pcpu = node->nr_pcpu;
-+ p++;
-+ }
-+ dump->len = p - dump->nodes;
-+ dump->compat = compat;
-+ spin_unlock_irqrestore(&fairsched_lock, flags);
-+
-+out:
-+ return dump;
-+
-+repeat:
-+ spin_unlock_irqrestore(&fairsched_lock, flags);
-+ vfree(dump);
-+ goto start;
-+}
-+
-+#define FAIRSCHED_PROC_HEADLINES 2
-+
-+#if defined(CONFIG_VE)
-+/*
-+ * File format is dictated by compatibility reasons.
-+ */
-+static int fairsched_seq_show(struct seq_file *m, void *v)
-+{
-+ struct fairsched_dump *dump;
-+ struct fairsched_node_dump *p;
-+ unsigned vid, nid, pid, r;
-+
-+ dump = m->private;
-+ p = (struct fairsched_node_dump *)((unsigned long)v & ~3UL);
-+ if (p - dump->nodes < FAIRSCHED_PROC_HEADLINES) {
-+ if (p == dump->nodes)
-+ seq_printf(m, "Version: 2.6 debug\n");
-+ else if (p == dump->nodes + 1)
-+ seq_printf(m,
-+ " veid "
-+ " id "
-+ " parent "
-+ "weight "
-+ " rate "
-+ "tasks "
-+ " run "
-+ "cpus"
-+ " "
-+ "flg "
-+ "ready "
-+ " start_tag "
-+ " value "
-+ " delay"
-+ "\n");
-+ } else {
-+ p -= FAIRSCHED_PROC_HEADLINES;
-+ vid = nid = pid = 0;
-+ r = (unsigned long)v & 3;
-+ if (p == dump->nodes) {
-+ if (r == 2)
-+ nid = p->id;
-+ } else {
-+ if (!r)
-+ nid = p->id;
-+ else if (r == 1)
-+ vid = pid = p->id;
-+ else
-+ vid = p->id, nid = 1;
-+ }
-+ seq_printf(m,
-+ "%10u "
-+ "%10u %10u %6u %5u %5u %5u %4u"
-+ " "
-+ " %c%c %5u %20Lu %20Lu %20Lu"
-+ "\n",
-+ vid,
-+ nid,
-+ pid,
-+ p->weight,
-+ p->rate,
-+ p->nr_tasks,
-+ p->nr_runtasks,
-+ p->nr_pcpu,
-+ p->rate_limited ? 'L' : '.',
-+ p->delayed ? 'D' : '.',
-+ p->nr_ready,
-+ p->start_tag.t,
-+ p->value.v,
-+ p->delay
-+ );
-+ }
-+
-+ return 0;
-+}
-+
-+static void *fairsched_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ struct fairsched_dump *dump;
-+ unsigned long l;
-+
-+ dump = m->private;
-+ if (*pos >= dump->len * 3 - 1 + FAIRSCHED_PROC_HEADLINES)
-+ return NULL;
-+ if (*pos < FAIRSCHED_PROC_HEADLINES)
-+ return dump->nodes + *pos;
-+ /* guess why... */
-+ l = (unsigned long)(dump->nodes +
-+ ((unsigned long)*pos + FAIRSCHED_PROC_HEADLINES * 2 + 1) / 3);
-+ l |= ((unsigned long)*pos + FAIRSCHED_PROC_HEADLINES * 2 + 1) % 3;
-+ return (void *)l;
-+}
-+static void *fairsched_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ ++*pos;
-+ return fairsched_seq_start(m, pos);
-+}
-+#endif
-+
-+static int fairsched2_seq_show(struct seq_file *m, void *v)
-+{
-+ struct fairsched_dump *dump;
-+ struct fairsched_node_dump *p;
-+
-+ dump = m->private;
-+ p = v;
-+ if (p - dump->nodes < FAIRSCHED_PROC_HEADLINES) {
-+ if (p == dump->nodes)
-+ seq_printf(m, "Version: 2.7" FAIRSHED_DEBUG "\n");
-+ else if (p == dump->nodes + 1)
-+ seq_printf(m,
-+ " id "
-+ "weight "
-+ " rate "
-+ " run "
-+ "cpus"
-+#ifdef FAIRSHED_DEBUG
-+ " "
-+ "flg "
-+ "ready "
-+ " start_tag "
-+ " value "
-+ " delay"
-+#endif
-+ "\n");
-+ } else {
-+ p -= FAIRSCHED_PROC_HEADLINES;
-+ seq_printf(m,
-+ "%10u %6u %5u %5u %4u"
-+#ifdef FAIRSHED_DEBUG
-+ " "
-+ " %c%c %5u %20Lu %20Lu %20Lu"
-+#endif
-+ "\n",
-+ p->id,
-+ p->weight,
-+ p->rate,
-+ p->nr_runnable,
-+ p->nr_pcpu
-+#ifdef FAIRSHED_DEBUG
-+ ,
-+ p->rate_limited ? 'L' : '.',
-+ p->delayed ? 'D' : '.',
-+ p->nr_ready,
-+ p->start_tag.t,
-+ p->value.v,
-+ p->delay
-+#endif
-+ );
-+ }
-+
-+ return 0;
-+}
-+
-+static void *fairsched2_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ struct fairsched_dump *dump;
-+
-+ dump = m->private;
-+ if (*pos >= dump->len + FAIRSCHED_PROC_HEADLINES)
-+ return NULL;
-+ return dump->nodes + *pos;
-+}
-+static void *fairsched2_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ ++*pos;
-+ return fairsched2_seq_start(m, pos);
-+}
-+static void fairsched2_seq_stop(struct seq_file *m, void *v)
-+{
-+}
-+
-+#ifdef CONFIG_VE
-+static struct seq_operations fairsched_seq_op = {
-+ .start = fairsched_seq_start,
-+ .next = fairsched_seq_next,
-+ .stop = fairsched2_seq_stop,
-+ .show = fairsched_seq_show
-+};
-+#endif
-+static struct seq_operations fairsched2_seq_op = {
-+ .start = fairsched2_seq_start,
-+ .next = fairsched2_seq_next,
-+ .stop = fairsched2_seq_stop,
-+ .show = fairsched2_seq_show
-+};
-+static int fairsched_seq_open(struct inode *inode, struct file *file)
-+{
-+ int ret;
-+ struct seq_file *m;
-+ int compat;
-+
-+#ifdef CONFIG_VE
-+ compat = (file->f_dentry->d_name.len == sizeof("fairsched") - 1);
-+ ret = seq_open(file, compat ? &fairsched_seq_op : &fairsched2_seq_op);
-+#else
-+ compat = 0;
-+ ret = seq_open(file, fairsched2_seq_op);
-+#endif
-+ if (ret)
-+ return ret;
-+ m = file->private_data;
-+ m->private = fairsched_do_dump(compat);
-+ if (m->private == NULL) {
-+ seq_release(inode, file);
-+ ret = -ENOMEM;
-+ }
-+ return ret;
-+}
-+static int fairsched_seq_release(struct inode *inode, struct file *file)
-+{
-+ struct seq_file *m;
-+ struct fairsched_dump *dump;
-+
-+ m = file->private_data;
-+ dump = m->private;
-+ m->private = NULL;
-+ vfree(dump);
-+ seq_release(inode, file);
-+ return 0;
-+}
-+static struct file_operations proc_fairsched_operations = {
-+ .open = fairsched_seq_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = fairsched_seq_release
-+};
-+
-+
-+/*********************************************************************/
-+/*
-+ * Fairsched initialization
-+ */
-+/*********************************************************************/
-+
-+int fsch_sysctl_latency(ctl_table *ctl, int write, struct file *filp,
-+ void *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ int *valp = ctl->data;
-+ int val = *valp;
-+ int ret;
-+
-+ ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
-+
-+ if (!write || *valp == val)
-+ return ret;
-+
-+ spin_lock_irq(&fairsched_lock);
-+ fairsched_recompute_max_latency();
-+ spin_unlock_irq(&fairsched_lock);
-+ return ret;
-+}
-+
-+static void fairsched_calibrate(void)
-+{
-+ fairsched_nr_cpus = num_online_cpus();
-+ max_value = FSCHVALUE(cycles_per_jiffy * (fairsched_nr_cpus + 1));
-+}
-+
-+void __init fairsched_init_early(void)
-+{
-+ printk(KERN_INFO "Virtuozzo Fair CPU scheduler\n");
-+ list_add(&fairsched_init_node.nodelist, &fairsched_node_head);
-+ fairsched_nr_nodes++;
-+}
-+
-+/*
-+ * Note: this function is execute late in the initialization sequence.
-+ * We ourselves need calibrated cycles and initialized procfs...
-+ * The consequence of this late initialization is that start tags are
-+ * efficiently ignored and each node preempts others on insertion.
-+ * But it isn't a problem (only init node can be runnable).
-+ */
-+void __init fairsched_init_late(void)
-+{
-+ struct proc_dir_entry *entry;
-+
-+ if (get_cycles() == 0)
-+ panic("FAIRSCHED: no TSC!\n");
-+ fairsched_calibrate();
-+ fairsched_recompute_max_latency();
-+
-+ entry = create_proc_glob_entry("fairsched", S_IRUGO, NULL);
-+ if (entry)
-+ entry->proc_fops = &proc_fairsched_operations;
-+ entry = create_proc_glob_entry("fairsched2", S_IRUGO, NULL);
-+ if (entry)
-+ entry->proc_fops = &proc_fairsched_operations;
-+}
-+
-+
-+#else /* CONFIG_FAIRSCHED */
-+
-+
-+/*********************************************************************/
-+/*
-+ * No Fairsched
-+ */
-+/*********************************************************************/
-+
-+asmlinkage int sys_fairsched_mknod(unsigned int parent, unsigned int weight,
-+ unsigned int newid)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage int sys_fairsched_rmnod(unsigned int id)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage int sys_fairsched_chwt(unsigned int id, unsigned int weight)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage int sys_fairsched_mvpr(pid_t pid, unsigned int nodeid)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage int sys_fairsched_rate(unsigned int id, int op, unsigned rate)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage int sys_fairsched_vcpus(unsigned int id, unsigned int vcpus)
-+{
-+ return -ENOSYS;
-+}
-+
-+void __init fairsched_init_late(void)
-+{
-+}
-+
-+#endif /* CONFIG_FAIRSCHED */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/fork.c linux-2.6.9-ve023stab030/kernel/fork.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/fork.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/fork.c 2006-10-11 19:08:02.000000000 +0400
-@@ -20,6 +20,7 @@
- #include <linux/vmalloc.h>
- #include <linux/completion.h>
- #include <linux/namespace.h>
-+#include <linux/file.h>
- #include <linux/personality.h>
- #include <linux/mempolicy.h>
- #include <linux/sem.h>
-@@ -27,6 +28,7 @@
- #include <linux/key.h>
- #include <linux/binfmts.h>
- #include <linux/mman.h>
-+#include <linux/virtinfo.h>
- #include <linux/fs.h>
- #include <linux/cpu.h>
- #include <linux/security.h>
-@@ -39,6 +41,7 @@
- #include <linux/audit.h>
- #include <linux/profile.h>
- #include <linux/rmap.h>
-+#include <linux/fairsched.h>
-
- #include <asm/pgtable.h>
- #include <asm/pgalloc.h>
-@@ -47,10 +50,15 @@
- #include <asm/cacheflush.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_misc.h>
-+#include <ub/ub_vmpages.h>
-+#include <ub/ub_mem.h>
-+
- /* The idle threads do not count..
- * Protected by write_lock_irq(&tasklist_lock)
- */
- int nr_threads;
-+EXPORT_SYMBOL(nr_threads);
-
- int max_threads;
- unsigned long total_forks; /* Handle normal Linux uptimes. */
-@@ -80,6 +88,7 @@ static kmem_cache_t *task_struct_cachep;
-
- void free_task(struct task_struct *tsk)
- {
-+ ub_task_uncharge(tsk);
- kfree(task_aux(tsk));
- free_thread_info(tsk->thread_info);
- free_task_struct(tsk);
-@@ -98,9 +107,17 @@ void __put_task_struct(struct task_struc
- free_uid(tsk->user);
- put_group_info(tsk->group_info);
-
-+#ifdef CONFIG_VE
-+ put_ve(VE_TASK_INFO(tsk)->owner_env);
-+ write_lock_irq(&tasklist_lock);
-+ nr_dead--;
-+ write_unlock_irq(&tasklist_lock);
-+#endif
-+
- if (!profile_handoff_task(tsk))
- free_task(tsk);
- }
-+EXPORT_SYMBOL(__put_task_struct);
-
- void fastcall add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
- {
-@@ -239,7 +256,7 @@ void __init fork_init(unsigned long memp
- /* create a slab on which task_structs can be allocated */
- task_struct_cachep =
- kmem_cache_create("task_struct", sizeof(struct task_struct),
-- ARCH_MIN_TASKALIGN, SLAB_PANIC, NULL, NULL);
-+ ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_UBC, NULL, NULL);
- #endif
-
- /*
-@@ -271,17 +288,12 @@ static struct task_struct *dup_task_stru
- return NULL;
-
- ti = alloc_thread_info(tsk);
-- if (!ti) {
-- free_task_struct(tsk);
-- return NULL;
-- }
-+ if (ti == NULL)
-+ goto out_free_task;
-
-- aux = kmalloc(sizeof(*aux), GFP_KERNEL);
-- if (!aux) {
-- free_thread_info(ti);
-- free_task_struct(tsk);
-- return NULL;
-- }
-+ aux = ub_kmalloc(sizeof(*aux), GFP_KERNEL);
-+ if (aux == NULL)
-+ goto out_free_thread;
-
- *ti = *orig->thread_info;
- *aux = *task_aux(orig);
-@@ -290,9 +302,24 @@ static struct task_struct *dup_task_stru
- ti->task = tsk;
- task_aux(tsk) = aux;
-
-+ /* Our parent has been killed by OOM killer... Go away */
-+ if (test_tsk_thread_flag(tsk, TIF_MEMDIE))
-+ goto out_free_aux;
-+
-+ if (ub_task_charge(orig, tsk) < 0)
-+ goto out_free_aux;
-+
- /* One for us, one for whoever does the "release_task()" (usually parent) */
- atomic_set(&tsk->usage,2);
- return tsk;
-+
-+out_free_aux:
-+ kfree(aux);
-+out_free_thread:
-+ free_thread_info(ti);
-+out_free_task:
-+ free_task_struct(tsk);
-+ return NULL;
- }
-
- #ifdef CONFIG_MMU
-@@ -342,9 +369,14 @@ static inline int dup_mmap(struct mm_str
- if (mpnt->vm_flags & VM_ACCOUNT) {
- unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
- if (security_vm_enough_memory(len))
-- goto fail_nomem;
-+ goto fail_nocharge;
- charge = len;
- }
-+
-+ if (ub_privvm_charge(mm_ub(mm), mpnt->vm_flags, mpnt->vm_file,
-+ mpnt->vm_end - mpnt->vm_start))
-+ goto fail_nocharge;
-+
- tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
- if (!tmp)
- goto fail_nomem;
-@@ -357,6 +389,7 @@ static inline int dup_mmap(struct mm_str
- tmp->vm_flags &= ~VM_LOCKED;
- tmp->vm_mm = mm;
- tmp->vm_next = NULL;
-+ tmp->vm_rss = 0;
- anon_vma_link(tmp);
- file = tmp->vm_file;
- if (file) {
-@@ -405,6 +438,9 @@ out:
- fail_nomem_policy:
- kmem_cache_free(vm_area_cachep, tmp);
- fail_nomem:
-+ ub_privvm_uncharge(mm_ub(mm), mpnt->vm_flags, mpnt->vm_file,
-+ mpnt->vm_end - mpnt->vm_start);
-+fail_nocharge:
- retval = -ENOMEM;
- vm_unacct_memory(charge);
- goto out;
-@@ -431,12 +467,15 @@ static inline void mm_free_pgd(struct mm
- spinlock_t mmlist_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
- int mmlist_nr;
-
-+EXPORT_SYMBOL(mmlist_lock);
-+
- #define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
- #define free_mm(mm) (kmem_cache_free(mm_cachep, (mm)))
-
- #include <linux/init_task.h>
-
--static struct mm_struct * mm_init(struct mm_struct * mm)
-+static struct mm_struct * mm_init(struct mm_struct * mm,
-+ struct user_beancounter * ub)
- {
- atomic_set(&mm->mm_users, 1);
- atomic_set(&mm->mm_count, 1);
-@@ -447,11 +486,15 @@ static struct mm_struct * mm_init(struct
- mm->ioctx_list = NULL;
- mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm);
- mm->free_area_cache = TASK_UNMAPPED_BASE;
-+#ifdef CONFIG_USER_RESOURCE
-+ mm_ub(mm) = get_beancounter(ub);
-+#endif
-
- if (likely(!mm_alloc_pgd(mm))) {
- mm->def_flags = 0;
- return mm;
- }
-+ put_beancounter(mm_ub(mm));
- free_mm(mm);
- return NULL;
- }
-@@ -466,10 +509,11 @@ struct mm_struct * mm_alloc(void)
- mm = allocate_mm();
- if (mm) {
- memset(mm, 0, sizeof(*mm));
-- mm = mm_init(mm);
-+ mm = mm_init(mm, get_exec_ub());
- }
- return mm;
- }
-+EXPORT_SYMBOL(mm_alloc);
-
- /*
- * Called when the last reference to the mm
-@@ -481,8 +525,10 @@ void fastcall __mmdrop(struct mm_struct
- BUG_ON(mm == &init_mm);
- mm_free_pgd(mm);
- destroy_context(mm);
-+ put_beancounter(mm_ub(mm));
- free_mm(mm);
- }
-+EXPORT_SYMBOL(__mmdrop);
-
- /*
- * Decrement the use count and release all resources for an mm.
-@@ -496,6 +542,7 @@ void mmput(struct mm_struct *mm)
- exit_aio(mm);
- exit_mmap(mm);
- put_swap_token(mm);
-+ (void) virtinfo_gencall(VIRTINFO_EXITMMAP, mm);
- mmdrop(mm);
- }
- }
-@@ -611,7 +658,7 @@ static int copy_mm(unsigned long clone_f
-
- /* Copy the current MM stuff.. */
- memcpy(mm, oldmm, sizeof(*mm));
-- if (!mm_init(mm))
-+ if (!mm_init(mm, get_task_ub(tsk)))
- goto fail_nomem;
-
- if (init_new_context(tsk,mm))
-@@ -637,6 +684,7 @@ fail_nocontext:
- * because it calls destroy_context()
- */
- mm_free_pgd(mm);
-+ put_beancounter(mm_ub(mm));
- free_mm(mm);
- return retval;
- }
-@@ -917,7 +965,7 @@ asmlinkage long sys_set_tid_address(int
- {
- current->clear_child_tid = tidptr;
-
-- return current->pid;
-+ return virt_pid(current);
- }
-
- /*
-@@ -928,13 +976,13 @@ asmlinkage long sys_set_tid_address(int
- * parts of the process environment (as per the clone
- * flags). The actual kick-off is left to the caller.
- */
--static task_t *copy_process(unsigned long clone_flags,
-+task_t *copy_process(unsigned long clone_flags,
- unsigned long stack_start,
- struct pt_regs *regs,
- unsigned long stack_size,
- int __user *parent_tidptr,
- int __user *child_tidptr,
-- int pid)
-+ long pid, long vpid)
- {
- int retval;
- struct task_struct *p = NULL;
-@@ -996,12 +1044,24 @@ static task_t *copy_process(unsigned lon
- p->did_exec = 0;
- copy_flags(clone_flags, p);
- p->pid = pid;
-+ if (pid == 0)
-+ set_virt_pid(p, 0);
-+#ifdef CONFIG_VE
-+ else {
-+ set_virt_pid(p, alloc_vpid(p->pid, vpid ? : -1));
-+ if (virt_pid(p) < 0)
-+ goto bad_fork_cleanup;
-+ }
-+#endif
- retval = -EFAULT;
- if (clone_flags & CLONE_PARENT_SETTID)
-- if (put_user(p->pid, parent_tidptr))
-+ if (put_user(virt_pid(p), parent_tidptr))
- goto bad_fork_cleanup;
-
- p->proc_dentry = NULL;
-+#ifdef CONFIG_VE
-+ VE_TASK_INFO(p)->glob_proc_dentry = NULL;
-+#endif
-
- INIT_LIST_HEAD(&p->children);
- INIT_LIST_HEAD(&p->sibling);
-@@ -1089,6 +1149,9 @@ static task_t *copy_process(unsigned lon
- * We dont wake it up yet.
- */
- p->tgid = p->pid;
-+ set_virt_tgid(p, virt_pid(p));
-+ set_virt_pgid(p, virt_pgid(current));
-+ set_virt_sid(p, virt_sid(current));
- p->group_leader = p;
- INIT_LIST_HEAD(&p->ptrace_children);
- INIT_LIST_HEAD(&p->ptrace_list);
-@@ -1104,7 +1167,7 @@ static task_t *copy_process(unsigned lon
- * the parent's CPU. This avoids alot of nasty races.
- */
- p->cpus_allowed = current->cpus_allowed;
-- set_task_cpu(p, smp_processor_id());
-+ set_task_cpu(p, task_cpu(p));
-
- /*
- * Check for pending SIGKILL! The new thread should not be allowed
-@@ -1137,6 +1200,7 @@ static task_t *copy_process(unsigned lon
- goto bad_fork_cleanup_namespace;
- }
- p->tgid = current->tgid;
-+ set_virt_tgid(p, virt_tgid(current));
- p->group_leader = current->group_leader;
-
- if (current->signal->group_stop_count > 0) {
-@@ -1156,6 +1220,12 @@ static task_t *copy_process(unsigned lon
- if (unlikely(p->ptrace & PT_PTRACED))
- __ptrace_link(p, current->parent);
-
-+#ifdef CONFIG_VE
-+ SET_VE_LINKS(p);
-+ atomic_inc(&VE_TASK_INFO(p)->owner_env->pcounter);
-+ get_ve(VE_TASK_INFO(p)->owner_env);
-+ seqcount_init(&VE_TASK_INFO(p)->wakeup_lock);
-+#endif
- attach_pid(p, PIDTYPE_PID, p->pid);
- attach_pid(p, PIDTYPE_TGID, p->tgid);
- if (thread_group_leader(p)) {
-@@ -1205,6 +1275,10 @@ bad_fork_cleanup_policy:
- bad_fork_cleanup:
- if (p->binfmt)
- module_put(p->binfmt->module);
-+#ifdef CONFIG_VE
-+ if (virt_pid(p) != p->pid && virt_pid(p) > 0)
-+ free_vpid(virt_pid(p), get_exec_env());
-+#endif
- bad_fork_cleanup_put_domain:
- module_put(p->thread_info->exec_domain->module);
- bad_fork_cleanup_count:
-@@ -1227,7 +1301,7 @@ task_t * __devinit fork_idle(int cpu)
- task_t *task;
- struct pt_regs regs;
-
-- task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 0);
-+ task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 0, 0);
- if (!task)
- return ERR_PTR(-ENOMEM);
- init_idle(task, cpu);
-@@ -1257,26 +1331,35 @@ static inline int fork_traceflag (unsign
- * It copies the process, and if successful kick-starts
- * it and waits for it to finish using the VM if required.
- */
--long do_fork(unsigned long clone_flags,
-+long do_fork_pid(unsigned long clone_flags,
- unsigned long stack_start,
- struct pt_regs *regs,
- unsigned long stack_size,
- int __user *parent_tidptr,
-- int __user *child_tidptr)
-+ int __user *child_tidptr,
-+ long vpid)
- {
- struct task_struct *p;
- int trace = 0;
-- long pid = alloc_pidmap();
-+ long pid;
-
-- if (pid < 0)
-- return -EAGAIN;
- if (unlikely(current->ptrace)) {
- trace = fork_traceflag (clone_flags);
- if (trace)
- clone_flags |= CLONE_PTRACE;
- }
-
-- p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid);
-+ pid = virtinfo_gencall(VIRTINFO_DOFORK, (void *)clone_flags);
-+ if (pid)
-+ return pid;
-+
-+ pid = alloc_pidmap();
-+ if (pid < 0) {
-+ pid = -EAGAIN;
-+ goto out;
-+ }
-+
-+ p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid, vpid);
- /*
- * Do this prior waking up the new thread - the thread pointer
- * might get invalid after that point, if the thread exits quickly.
-@@ -1284,6 +1367,7 @@ long do_fork(unsigned long clone_flags,
- if (!IS_ERR(p)) {
- struct completion vfork;
-
-+ pid = virt_pid(p);
- if (clone_flags & CLONE_VFORK) {
- task_aux(p)->vfork_done = &vfork;
- init_completion(&vfork);
-@@ -1297,6 +1381,7 @@ long do_fork(unsigned long clone_flags,
- set_tsk_thread_flag(p, TIF_SIGPENDING);
- }
-
-+ virtinfo_gencall(VIRTINFO_DOFORKRET, p);
- if (!(clone_flags & CLONE_STOPPED))
- wake_up_new_task(p, clone_flags);
- else
-@@ -1305,21 +1390,43 @@ long do_fork(unsigned long clone_flags,
-
- if (unlikely (trace)) {
- current->ptrace_message = pid;
-+ set_pn_state(current, PN_STOP_FORK);
- ptrace_notify ((trace << 8) | SIGTRAP);
-+ clear_pn_state(current);
- }
-
- if (clone_flags & CLONE_VFORK) {
- wait_for_completion(&vfork);
-- if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE))
-+ if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) {
-+ set_pn_state(current, PN_STOP_VFORK);
- ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
-+ clear_pn_state(current);
-+ }
- }
- } else {
- free_pidmap(pid);
- pid = PTR_ERR(p);
- }
-+
-+out:
-+ virtinfo_gencall(VIRTINFO_DOFORKPOST, (void *)(long)pid);
- return pid;
- }
-
-+EXPORT_SYMBOL(do_fork_pid);
-+
-+long do_fork(unsigned long clone_flags,
-+ unsigned long stack_start,
-+ struct pt_regs *regs,
-+ unsigned long stack_size,
-+ int __user *parent_tidptr,
-+ int __user *child_tidptr)
-+{
-+ return do_fork_pid(clone_flags, stack_start, regs, stack_size,
-+ parent_tidptr, child_tidptr, 0);
-+}
-+
-+
- /* SLAB cache for signal_struct structures (tsk->signal) */
- kmem_cache_t *signal_cachep;
-
-@@ -1338,24 +1445,26 @@ kmem_cache_t *vm_area_cachep;
- /* SLAB cache for mm_struct structures (tsk->mm) */
- kmem_cache_t *mm_cachep;
-
-+#include <linux/kmem_cache.h>
- void __init proc_caches_init(void)
- {
- sighand_cachep = kmem_cache_create("sighand_cache",
- sizeof(struct sighand_struct), 0,
-- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
- signal_cachep = kmem_cache_create("signal_cache",
- sizeof(struct signal_struct), 0,
-- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
- files_cachep = kmem_cache_create("files_cache",
- sizeof(struct files_struct), 0,
-- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
-+ files_cachep->flags |= CFLGS_ENVIDS;
- fs_cachep = kmem_cache_create("fs_cache",
- sizeof(struct fs_struct), 0,
-- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
- vm_area_cachep = kmem_cache_create("vm_area_struct",
- sizeof(struct vm_area_struct), 0,
-- SLAB_PANIC, NULL, NULL);
-+ SLAB_PANIC|SLAB_UBC, NULL, NULL);
- mm_cachep = kmem_cache_create("mm_struct",
- sizeof(struct mm_struct), 0,
-- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/kmod.c linux-2.6.9-ve023stab030/kernel/kmod.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/kmod.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/kmod.c 2006-10-11 19:07:57.000000000 +0400
-@@ -78,6 +78,10 @@ int request_module(const char *fmt, ...)
- #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */
- static int kmod_loop_msg;
-
-+ /* Don't allow request_module() inside VE. */
-+ if (!ve_is_super(get_exec_env()))
-+ return -EPERM;
-+
- va_start(args, fmt);
- ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);
- va_end(args);
-@@ -287,6 +291,9 @@ int call_usermodehelper(char *path, char
- };
- DECLARE_WORK(work, __call_usermodehelper, &sub_info);
-
-+ if (!ve_is_super(get_exec_env()))
-+ return -EPERM;
-+
- if (!khelper_wq)
- return -EBUSY;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/kthread.c linux-2.6.9-ve023stab030/kernel/kthread.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/kthread.c 2004-10-19 01:55:24.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/kthread.c 2006-10-11 19:07:57.000000000 +0400
-@@ -108,7 +108,7 @@ static void keventd_create_kthread(void
- create->result = ERR_PTR(pid);
- } else {
- wait_for_completion(&create->started);
-- create->result = find_task_by_pid(pid);
-+ create->result = find_task_by_pid_all(pid);
- }
- complete(&create->done);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/module.c linux-2.6.9-ve023stab030/kernel/module.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/module.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/module.c 2006-10-11 19:07:57.000000000 +0400
-@@ -2050,6 +2050,8 @@ static void *m_start(struct seq_file *m,
- loff_t n = 0;
-
- down(&module_mutex);
-+ if (!ve_is_super(get_exec_env()))
-+ return NULL;
- list_for_each(i, &modules) {
- if (n++ == *pos)
- break;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/panic.c linux-2.6.9-ve023stab030/kernel/panic.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/panic.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/panic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -24,6 +24,8 @@ int panic_timeout;
- int panic_on_oops = 1;
- int panic_on_unrecovered_nmi;
- int tainted;
-+int kernel_text_csum_broken;
-+EXPORT_SYMBOL(kernel_text_csum_broken);
-
- EXPORT_SYMBOL(panic_timeout);
-
-@@ -81,6 +83,9 @@ NORET_TYPE void panic(const char * fmt,
-
- notifier_call_chain(&panic_notifier_list, 0, buf);
-
-+ /* avoid warnings from mdelay and many similar places */
-+ preempt_count() = 1;
-+
- if (panic_timeout > 0)
- {
- /*
-@@ -139,7 +144,8 @@ const char *print_tainted(void)
- {
- static char buf[20];
- if (tainted) {
-- snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c",
-+ snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c",
-+ kernel_text_csum_broken ? 'B' : ' ',
- tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
- tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
- tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/pid.c linux-2.6.9-ve023stab030/kernel/pid.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/pid.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/pid.c 2006-10-11 19:07:59.000000000 +0400
-@@ -26,6 +26,10 @@
- #include <linux/bootmem.h>
- #include <linux/hash.h>
-
-+#ifdef CONFIG_VE
-+static void __free_vpid(int vpid, struct ve_struct *ve);
-+#endif
-+
- #define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift)
- static struct hlist_head *pid_hash[PIDTYPE_MAX];
- static int pidhash_shift;
-@@ -50,8 +54,14 @@ typedef struct pidmap {
- void *page;
- } pidmap_t;
-
-+#ifdef CONFIG_VE
-+#define PIDMAP_NRFREE (BITS_PER_PAGE/2)
-+#else
-+#define PIDMAP_NRFREE BITS_PER_PAGE
-+#endif
-+
- static pidmap_t pidmap_array[PIDMAP_ENTRIES] =
-- { [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } };
-+ { [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(PIDMAP_NRFREE), NULL } };
-
- static pidmap_t *map_limit = pidmap_array + PIDMAP_ENTRIES;
-
-@@ -62,9 +72,12 @@ fastcall void free_pidmap(int pid)
- pidmap_t *map = pidmap_array + pid / BITS_PER_PAGE;
- int offset = pid & BITS_PER_PAGE_MASK;
-
-+ BUG_ON(__is_virtual_pid(pid) || pid == 1);
-+
- clear_bit(offset, map->page);
- atomic_inc(&map->nr_free);
- }
-+EXPORT_SYMBOL(free_pidmap);
-
- /*
- * Here we search for the next map that has free bits left.
-@@ -103,6 +116,8 @@ int alloc_pidmap(void)
- pidmap_t *map;
-
- pid = last_pid + 1;
-+ if (__is_virtual_pid(pid))
-+ pid += VPID_DIV;
- if (pid >= pid_max)
- pid = RESERVED_PIDS;
-
-@@ -133,6 +148,8 @@ next_map:
- */
- scan_more:
- offset = find_next_zero_bit(map->page, BITS_PER_PAGE, offset);
-+ if (__is_virtual_pid(offset))
-+ offset += VPID_DIV;
- if (offset >= BITS_PER_PAGE)
- goto next_map;
- if (test_and_set_bit(offset, map->page))
-@@ -145,6 +162,7 @@ scan_more:
- failure:
- return -1;
- }
-+EXPORT_SYMBOL(alloc_pidmap);
-
- struct pid * fastcall find_pid(enum pid_type type, int nr)
- {
-@@ -158,6 +176,7 @@ struct pid * fastcall find_pid(enum pid_
- }
- return NULL;
- }
-+EXPORT_SYMBOL(find_pid);
-
- int fastcall attach_pid(task_t *task, enum pid_type type, int nr)
- {
-@@ -177,16 +196,20 @@ int fastcall attach_pid(task_t *task, en
-
- return 0;
- }
-+EXPORT_SYMBOL(attach_pid);
-
--static inline int __detach_pid(task_t *task, enum pid_type type)
-+static fastcall int __detach_pid(task_t *task, enum pid_type type)
- {
- struct pid *pid, *pid_next;
-- int nr;
-+ int nr = 0;
-
- pid = &task->pids[type];
- if (!hlist_unhashed(&pid->pid_chain)) {
- hlist_del(&pid->pid_chain);
-- if (!list_empty(&pid->pid_list)) {
-+
-+ if (list_empty(&pid->pid_list))
-+ nr = pid->nr;
-+ else {
- pid_next = list_entry(pid->pid_list.next,
- struct pid, pid_list);
- /* insert next pid from pid_list to hash */
-@@ -194,8 +217,8 @@ static inline int __detach_pid(task_t *t
- &pid_hash[type][pid_hashfn(pid_next->nr)]);
- }
- }
-+
- list_del(&pid->pid_list);
-- nr = pid->nr;
- pid->nr = 0;
-
- return nr;
-@@ -203,22 +226,38 @@ static inline int __detach_pid(task_t *t
-
- void fastcall detach_pid(task_t *task, enum pid_type type)
- {
-+ int i;
- int nr;
-
- nr = __detach_pid(task, type);
- if (!nr)
- return;
-
-- for (type = 0; type < PIDTYPE_MAX; ++type)
-- if (find_pid(type, nr))
-+ for (i = 0; i < PIDTYPE_MAX; ++i)
-+ if (find_pid(i, nr))
- return;
-+
-+#ifdef CONFIG_VE
-+ __free_vpid(task->pids[type].vnr, VE_TASK_INFO(task)->owner_env);
-+#endif
- free_pidmap(nr);
- }
-+EXPORT_SYMBOL(detach_pid);
-
- task_t *find_task_by_pid_type(int type, int nr)
- {
-+ BUG();
-+ return NULL;
-+}
-+
-+EXPORT_SYMBOL(find_task_by_pid_type);
-+
-+task_t *find_task_by_pid_type_all(int type, int nr)
-+{
- struct pid *pid;
-
-+ BUG_ON(nr != -1 && is_virtual_pid(nr));
-+
- pid = find_pid(type, nr);
- if (!pid)
- return NULL;
-@@ -226,7 +265,35 @@ task_t *find_task_by_pid_type(int type,
- return pid_task(&pid->pid_list, type);
- }
-
--EXPORT_SYMBOL(find_task_by_pid_type);
-+EXPORT_SYMBOL(find_task_by_pid_type_all);
-+
-+#ifdef CONFIG_VE
-+
-+task_t *find_task_by_pid_type_ve(int type, int nr)
-+{
-+ task_t *tsk;
-+ int gnr = nr;
-+ struct pid *pid;
-+
-+ if (is_virtual_pid(nr)) {
-+ gnr = __vpid_to_pid(nr);
-+ if (unlikely(gnr == -1))
-+ return NULL;
-+ }
-+
-+ pid = find_pid(type, gnr);
-+ if (!pid)
-+ return NULL;
-+
-+ tsk = pid_task(&pid->pid_list, type);
-+ if (!ve_accessible(VE_TASK_INFO(tsk)->owner_env, get_exec_env()))
-+ return NULL;
-+ return tsk;
-+}
-+
-+EXPORT_SYMBOL(find_task_by_pid_type_ve);
-+
-+#endif
-
- /*
- * This function switches the PIDs if a non-leader thread calls
-@@ -245,12 +312,16 @@ void switch_exec_pids(task_t *leader, ta
-
- leader->pid = leader->tgid = thread->pid;
- thread->pid = thread->tgid;
-+ set_virt_tgid(leader, virt_pid(thread));
-+ set_virt_pid(leader, virt_pid(thread));
-+ set_virt_pid(thread, virt_tgid(thread));
-
- attach_pid(thread, PIDTYPE_PID, thread->pid);
- attach_pid(thread, PIDTYPE_TGID, thread->tgid);
- attach_pid(thread, PIDTYPE_PGID, thread->signal->pgrp);
- attach_pid(thread, PIDTYPE_SID, thread->signal->session);
- list_add_tail(&thread->tasks, &init_task.tasks);
-+ SET_VE_LINKS(thread);
-
- attach_pid(leader, PIDTYPE_PID, leader->pid);
- attach_pid(leader, PIDTYPE_TGID, leader->tgid);
-@@ -258,6 +329,347 @@ void switch_exec_pids(task_t *leader, ta
- attach_pid(leader, PIDTYPE_SID, leader->signal->session);
- }
-
-+#ifdef CONFIG_VE
-+
-+/* Virtual PID bits.
-+ *
-+ * At the moment all internal structures in kernel store real global pid.
-+ * The only place, where virtual PID is used, is at user frontend. We
-+ * remap virtual pids obtained from user to global ones (vpid_to_pid) and
-+ * map globals to virtuals before showing them to user (virt_pid_type).
-+ *
-+ * We hold virtual PIDs inside struct pid, so map global -> virtual is easy.
-+ */
-+
-+pid_t _pid_type_to_vpid(int type, pid_t pid)
-+{
-+ struct pid * p;
-+
-+ if (unlikely(is_virtual_pid(pid)))
-+ return -1;
-+
-+ read_lock(&tasklist_lock);
-+ p = find_pid(type, pid);
-+ if (p) {
-+ pid = p->vnr;
-+ } else {
-+ pid = -1;
-+ }
-+ read_unlock(&tasklist_lock);
-+ return pid;
-+}
-+EXPORT_SYMBOL(_pid_type_to_vpid);
-+
-+pid_t pid_type_to_vpid(int type, pid_t pid)
-+{
-+ int vpid;
-+
-+ if (unlikely(pid <= 0))
-+ return pid;
-+
-+ BUG_ON(is_virtual_pid(pid));
-+
-+ if (ve_is_super(get_exec_env()))
-+ return pid;
-+
-+ vpid = _pid_type_to_vpid(type, pid);
-+ if (unlikely(vpid == -1)) {
-+ /* It is allowed: global pid can be used everywhere.
-+ * This can happen, when kernel remembers stray pids:
-+ * signal queues, locks etc.
-+ */
-+ vpid = pid;
-+ }
-+ return vpid;
-+}
-+EXPORT_SYMBOL(pid_type_to_vpid);
-+
-+/* To map virtual pids to global we maintain special hash table.
-+ *
-+ * Mapping entries are allocated when a process with non-trivial
-+ * mapping is forked, which is possible only after VE migrated.
-+ * Mappings are destroyed, when a global pid is removed from global
-+ * pidmap, which means we do not need to refcount mappings.
-+ */
-+
-+static struct hlist_head *vpid_hash;
-+
-+struct vpid_mapping
-+{
-+ int vpid;
-+ int veid;
-+ int pid;
-+ struct hlist_node link;
-+};
-+
-+static kmem_cache_t *vpid_mapping_cachep;
-+
-+static inline int vpid_hashfn(int vnr, int veid)
-+{
-+ return hash_long((unsigned long)(vnr+(veid<<16)), pidhash_shift);
-+}
-+
-+struct vpid_mapping *__lookup_vpid_mapping(int vnr, int veid)
-+{
-+ struct hlist_node *elem;
-+ struct vpid_mapping *map;
-+
-+ hlist_for_each_entry(map, elem,
-+ &vpid_hash[vpid_hashfn(vnr, veid)], link) {
-+ if (map->vpid == vnr && map->veid == veid)
-+ return map;
-+ }
-+ return NULL;
-+}
-+
-+/* __vpid_to_pid() is raw version of vpid_to_pid(). It is to be used
-+ * only under tasklist_lock. In some places we must use only this version
-+ * (f.e. __kill_pg_info is called under write lock!)
-+ *
-+ * Caller should pass virtual pid. This function returns an error, when
-+ * seeing a global pid.
-+ */
-+int __vpid_to_pid(int pid)
-+{
-+ struct vpid_mapping *map;
-+
-+ if (unlikely(!is_virtual_pid(pid) || ve_is_super(get_exec_env())))
-+ return -1;
-+
-+ if (!get_exec_env()->sparse_vpid) {
-+ int init_pid;
-+
-+ init_pid = get_exec_env()->init_entry->pid;
-+ if (pid == 1)
-+ return init_pid;
-+ if (pid == init_pid + VPID_DIV)
-+ return -1; /* vpid of init is 1 */
-+ return pid - VPID_DIV;
-+ }
-+
-+ map = __lookup_vpid_mapping(pid, VEID(get_exec_env()));
-+ if (map)
-+ return map->pid;
-+ return -1;
-+}
-+EXPORT_SYMBOL(__vpid_to_pid);
-+
-+int vpid_to_pid(int pid)
-+{
-+ /* User gave bad pid. It is his problem. */
-+ if (unlikely(pid <= 0))
-+ return pid;
-+
-+ if (!is_virtual_pid(pid))
-+ return pid;
-+
-+ read_lock(&tasklist_lock);
-+ pid = __vpid_to_pid(pid);
-+ read_unlock(&tasklist_lock);
-+ return pid;
-+}
-+EXPORT_SYMBOL(vpid_to_pid);
-+
-+/* VEs which never migrated have trivial "arithmetic" mapping pid <-> vpid:
-+ *
-+ * vpid == 1 -> ve->init_task->pid
-+ * else pid & ~VPID_DIV
-+ *
-+ * In this case VE has ve->sparse_vpid = 0 and we do not use vpid hash table.
-+ *
-+ * When VE migrates and we see non-trivial mapping the first time, we
-+ * scan process table and populate mapping hash table.
-+ */
-+
-+static int add_mapping(int pid, int vpid, int veid, struct hlist_head *cache)
-+{
-+ if (pid > 0 && vpid > 0 && !__lookup_vpid_mapping(vpid, veid)) {
-+ struct vpid_mapping *m;
-+ if (hlist_empty(cache)) {
-+ m = kmem_cache_alloc(vpid_mapping_cachep, GFP_ATOMIC);
-+ if (unlikely(m == NULL))
-+ return -ENOMEM;
-+ } else {
-+ m = hlist_entry(cache->first, struct vpid_mapping, link);
-+ hlist_del(&m->link);
-+ }
-+ m->pid = pid;
-+ m->vpid = vpid;
-+ m->veid = veid;
-+ hlist_add_head(&m->link,
-+ &vpid_hash[vpid_hashfn(vpid, veid)]);
-+ }
-+ return 0;
-+}
-+
-+static int switch_to_sparse_mapping(int pid)
-+{
-+ struct ve_struct *env = get_exec_env();
-+ struct hlist_head cache;
-+ task_t *g, *t;
-+ int pcount;
-+ int err;
-+
-+ /* Transition happens under write_lock_irq, so we try to make
-+ * it more reliable and fast preallocating mapping entries.
-+ * pcounter may be not enough, we could have lots of orphaned
-+ * process groups and sessions, which also require mappings.
-+ */
-+ INIT_HLIST_HEAD(&cache);
-+ pcount = atomic_read(&env->pcounter);
-+ err = -ENOMEM;
-+ while (pcount > 0) {
-+ struct vpid_mapping *m;
-+ m = kmem_cache_alloc(vpid_mapping_cachep, GFP_KERNEL);
-+ if (!m)
-+ goto out;
-+ hlist_add_head(&m->link, &cache);
-+ pcount--;
-+ }
-+
-+ write_lock_irq(&tasklist_lock);
-+ err = 0;
-+ if (env->sparse_vpid)
-+ goto out_unlock;
-+
-+ err = -ENOMEM;
-+ do_each_thread_ve(g, t) {
-+ if (t->pid == pid)
-+ continue;
-+ if (add_mapping(t->pid, virt_pid(t), VEID(env), &cache))
-+ goto out_unlock;
-+ } while_each_thread_ve(g, t);
-+
-+ for_each_process_ve(t) {
-+ if (t->pid == pid)
-+ continue;
-+
-+ if (add_mapping(t->tgid, virt_tgid(t), VEID(env), &cache))
-+ goto out_unlock;
-+ if (add_mapping(t->signal->pgrp, virt_pgid(t), VEID(env), &cache))
-+ goto out_unlock;
-+ if (add_mapping(t->signal->session, virt_sid(t), VEID(env), &cache))
-+ goto out_unlock;
-+ }
-+ env->sparse_vpid = 1;
-+ err = 0;
-+
-+out_unlock:
-+ if (err) {
-+ int i;
-+
-+ for (i=0; i<(1<<pidhash_shift); i++) {
-+ struct hlist_node *elem, *next;
-+ struct vpid_mapping *map;
-+
-+ hlist_for_each_entry_safe(map, elem, next, &vpid_hash[i], link) {
-+ if (map->veid == VEID(env)) {
-+ hlist_del(elem);
-+ hlist_add_head(elem, &cache);
-+ }
-+ }
-+ }
-+ }
-+ write_unlock_irq(&tasklist_lock);
-+
-+out:
-+ while (!hlist_empty(&cache)) {
-+ struct vpid_mapping *m;
-+ m = hlist_entry(cache.first, struct vpid_mapping, link);
-+ hlist_del(&m->link);
-+ kmem_cache_free(vpid_mapping_cachep, m);
-+ }
-+ return err;
-+}
-+
-+int alloc_vpid(int pid, int virt_pid)
-+{
-+ int result;
-+ struct vpid_mapping *m;
-+ struct ve_struct *env = get_exec_env();
-+
-+ if (ve_is_super(env) || !env->virt_pids)
-+ return pid;
-+
-+ if (!env->sparse_vpid) {
-+ if (virt_pid == -1)
-+ return pid + VPID_DIV;
-+
-+ if (virt_pid == 1 || virt_pid == pid + VPID_DIV)
-+ return virt_pid;
-+
-+ if ((result = switch_to_sparse_mapping(pid)) < 0)
-+ return result;
-+ }
-+
-+ m = kmem_cache_alloc(vpid_mapping_cachep, GFP_KERNEL);
-+ if (!m)
-+ return -ENOMEM;
-+
-+ m->pid = pid;
-+ m->veid = VEID(env);
-+
-+ result = (virt_pid == -1) ? pid + VPID_DIV : virt_pid;
-+
-+ write_lock_irq(&tasklist_lock);
-+ if (unlikely(__lookup_vpid_mapping(result, m->veid))) {
-+ if (virt_pid > 0) {
-+ result = -EEXIST;
-+ goto out;
-+ }
-+
-+ /* No luck. Now we search for some not-existing vpid.
-+ * It is weak place. We do linear search. */
-+ do {
-+ result++;
-+ if (!__is_virtual_pid(result))
-+ result += VPID_DIV;
-+ if (result >= pid_max)
-+ result = RESERVED_PIDS + VPID_DIV;
-+ } while (__lookup_vpid_mapping(result, m->veid) != NULL);
-+
-+ /* And set last_pid in hope future alloc_pidmap to avoid
-+ * collisions after future alloc_pidmap() */
-+ last_pid = result - VPID_DIV;
-+ }
-+ if (result > 0) {
-+ m->vpid = result;
-+ hlist_add_head(&m->link,
-+ &vpid_hash[vpid_hashfn(result, m->veid)]);
-+ }
-+out:
-+ write_unlock_irq(&tasklist_lock);
-+ if (result < 0)
-+ kmem_cache_free(vpid_mapping_cachep, m);
-+ return result;
-+}
-+EXPORT_SYMBOL(alloc_vpid);
-+
-+static void __free_vpid(int vpid, struct ve_struct *ve)
-+{
-+ struct vpid_mapping *m;
-+
-+ if (!ve->sparse_vpid)
-+ return;
-+
-+ if (!__is_virtual_pid(vpid) && (vpid != 1 || ve_is_super(ve)))
-+ return;
-+
-+ m = __lookup_vpid_mapping(vpid, ve->veid);
-+ BUG_ON(m == NULL);
-+ hlist_del(&m->link);
-+ kmem_cache_free(vpid_mapping_cachep, m);
-+}
-+
-+void free_vpid(int vpid, struct ve_struct *ve)
-+{
-+ write_lock_irq(&tasklist_lock);
-+ __free_vpid(vpid, ve);
-+ write_unlock_irq(&tasklist_lock);
-+}
-+EXPORT_SYMBOL(free_vpid);
-+#endif
-+
- /**
- * pid_alive - check that a task structure is not stale
- * @p: Task structure to be checked.
-@@ -297,6 +709,14 @@ void __init pidhash_init(void)
- for (j = 0; j < pidhash_size; j++)
- INIT_HLIST_HEAD(&pid_hash[i][j]);
- }
-+
-+#ifdef CONFIG_VE
-+ vpid_hash = alloc_bootmem(pidhash_size * sizeof(struct hlist_head));
-+ if (!vpid_hash)
-+ panic("Could not alloc vpid_hash!\n");
-+ for (j = 0; j < pidhash_size; j++)
-+ INIT_HLIST_HEAD(&vpid_hash[j]);
-+#endif
- }
-
- void __init pidmap_init(void)
-@@ -313,4 +733,12 @@ void __init pidmap_init(void)
-
- for (i = 0; i < PIDTYPE_MAX; i++)
- attach_pid(current, i, 0);
-+
-+#ifdef CONFIG_VE
-+ vpid_mapping_cachep =
-+ kmem_cache_create("vpid_mapping",
-+ sizeof(struct vpid_mapping),
-+ __alignof__(struct vpid_mapping),
-+ SLAB_PANIC|SLAB_UBC, NULL, NULL);
-+#endif
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/posix-timers.c linux-2.6.9-ve023stab030/kernel/posix-timers.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/posix-timers.c 2004-10-19 01:54:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/posix-timers.c 2006-10-11 19:07:57.000000000 +0400
-@@ -31,6 +31,7 @@
- * POSIX clocks & timers
- */
- #include <linux/mm.h>
-+#include <linux/module.h>
- #include <linux/smp_lock.h>
- #include <linux/interrupt.h>
- #include <linux/slab.h>
-@@ -223,7 +224,8 @@ static __init int init_posix_timers(void
- register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
-
- posix_timers_cache = kmem_cache_create("posix_timers_cache",
-- sizeof (struct k_itimer), 0, 0, NULL, NULL);
-+ sizeof (struct k_itimer), 0, SLAB_UBC,
-+ NULL, NULL);
- idr_init(&posix_timers_id);
- return 0;
- }
-@@ -394,6 +396,11 @@ exit:
- static void timer_notify_task(struct k_itimer *timr)
- {
- int ret;
-+ struct ve_struct *old_ve;
-+ struct user_beancounter *old_ub;
-+
-+ old_ve = set_exec_env(VE_TASK_INFO(timr->it_process)->owner_env);
-+ old_ub = set_exec_ub(task_bc(timr->it_process)->task_ub);
-
- memset(&timr->sigq->info, 0, sizeof(siginfo_t));
-
-@@ -440,6 +447,9 @@ static void timer_notify_task(struct k_i
- */
- schedule_next_timer(timr);
- }
-+
-+ (void)set_exec_ub(old_ub);
-+ (void)set_exec_env(old_ve);
- }
-
- /*
-@@ -499,7 +509,7 @@ static inline struct task_struct * good_
- struct task_struct *rtn = current->group_leader;
-
- if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
-- (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||
-+ (!(rtn = find_task_by_pid_ve(event->sigev_notify_thread_id)) ||
- rtn->tgid != current->tgid ||
- (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
- return NULL;
-@@ -1216,6 +1226,7 @@ int do_posix_clock_monotonic_gettime(str
- }
- return 0;
- }
-+EXPORT_SYMBOL(do_posix_clock_monotonic_gettime);
-
- int do_posix_clock_monotonic_settime(struct timespec *tp)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/power/process.c linux-2.6.9-ve023stab030/kernel/power/process.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/power/process.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/power/process.c 2006-10-11 19:07:59.000000000 +0400
-@@ -18,6 +18,7 @@
- */
- #define TIMEOUT (6 * HZ)
-
-+static atomic_t global_suspend = ATOMIC_INIT(0);
-
- static inline int freezeable(struct task_struct * p)
- {
-@@ -32,7 +33,7 @@ static inline int freezeable(struct task
- }
-
- /* Refrigerator is place where frozen processes are stored :-). */
--void refrigerator(unsigned long flag)
-+void refrigerator()
- {
- /* Hmm, should we be allowed to suspend when there are realtime
- processes around? */
-@@ -40,14 +41,24 @@ void refrigerator(unsigned long flag)
- save = current->state;
- current->state = TASK_UNINTERRUPTIBLE;
- pr_debug("%s entered refrigerator\n", current->comm);
-- printk("=");
-- current->flags &= ~PF_FREEZE;
-+ /* printk("="); */
-
- spin_lock_irq(&current->sighand->siglock);
-- recalc_sigpending(); /* We sent fake signal, clean it up */
-+ if (test_and_clear_thread_flag(TIF_FREEZE)) {
-+ recalc_sigpending(); /* We sent fake signal, clean it up */
-+ if (atomic_read(&global_suspend) ||
-+ atomic_read(&get_exec_env()->suspend)) {
-+ current->flags |= PF_FROZEN;
-+ } else {
-+ current->state = save;
-+ }
-+ } else {
-+ /* Freeze request could be canceled before we entered
-+ * refrigerator(). In this case we do nothing. */
-+ current->state = save;
-+ }
- spin_unlock_irq(&current->sighand->siglock);
-
-- current->flags |= PF_FROZEN;
- while (current->flags & PF_FROZEN)
- schedule();
- pr_debug("%s left refrigerator\n", current->comm);
-@@ -62,11 +73,12 @@ int freeze_processes(void)
- struct task_struct *g, *p;
-
- printk( "Stopping tasks: " );
-+ atomic_inc(&global_suspend);
- start_time = jiffies;
- do {
- todo = 0;
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_all(g, p) {
- unsigned long flags;
- if (!freezeable(p))
- continue;
-@@ -77,22 +89,25 @@ int freeze_processes(void)
-
- /* FIXME: smp problem here: we may not access other process' flags
- without locking */
-- p->flags |= PF_FREEZE;
- spin_lock_irqsave(&p->sighand->siglock, flags);
-+ set_tsk_thread_flag(p, TIF_FREEZE);
- signal_wake_up(p, 0);
- spin_unlock_irqrestore(&p->sighand->siglock, flags);
- todo++;
-- } while_each_thread(g, p);
-+ } while_each_thread_all(g, p);
- read_unlock(&tasklist_lock);
- yield(); /* Yield is okay here */
- if (time_after(jiffies, start_time + TIMEOUT)) {
- printk( "\n" );
- printk(KERN_ERR " stopping tasks failed (%d tasks remaining)\n", todo );
-+ atomic_dec(&global_suspend);
- return todo;
- }
- } while(todo);
--
-- printk( "|\n" );
-+
-+ atomic_dec(&global_suspend);
-+
-+ /* printk( "|\n" ); */
- BUG_ON(in_atomic());
- return 0;
- }
-@@ -103,15 +118,18 @@ void thaw_processes(void)
-
- printk( "Restarting tasks..." );
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_all(g, p) {
-+ unsigned long flags;
- if (!freezeable(p))
- continue;
-+ spin_lock_irqsave(&p->sighand->siglock, flags);
- if (p->flags & PF_FROZEN) {
- p->flags &= ~PF_FROZEN;
- wake_up_process(p);
- } else
- printk(KERN_INFO " Strange, %s not stopped\n", p->comm );
-- } while_each_thread(g, p);
-+ spin_unlock_irqrestore(&p->sighand->siglock, flags);
-+ } while_each_thread_all(g, p);
-
- read_unlock(&tasklist_lock);
- schedule();
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/power/swsusp.c linux-2.6.9-ve023stab030/kernel/power/swsusp.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/power/swsusp.c 2004-10-19 01:53:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/power/swsusp.c 2006-10-11 19:07:56.000000000 +0400
-@@ -246,7 +246,7 @@ static int write_page(unsigned long addr
- swp_entry_t entry;
- int error = 0;
-
-- entry = get_swap_page();
-+ entry = get_swap_page(mm_ub(&init_mm));
- if (swp_offset(entry) &&
- swapfile_used[swp_type(entry)] == SWAPFILE_SUSPEND) {
- error = rw_swap_page_sync(WRITE, entry,
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/printk.c linux-2.6.9-ve023stab030/kernel/printk.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/printk.c 2006-10-11 18:29:39.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/printk.c 2006-10-11 19:08:00.000000000 +0400
-@@ -26,10 +26,13 @@
- #include <linux/module.h>
- #include <linux/interrupt.h> /* For in_interrupt() */
- #include <linux/config.h>
-+#include <linux/slab.h>
- #include <linux/delay.h>
- #include <linux/smp.h>
- #include <linux/security.h>
- #include <linux/bootmem.h>
-+#include <linux/vzratelimit.h>
-+#include <linux/veprintk.h>
-
- #include <asm/uaccess.h>
-
-@@ -53,8 +56,12 @@ int console_printk[4] = {
-
- EXPORT_SYMBOL(console_printk);
-
-+int console_silence_loglevel;
- int oops_in_progress;
-
-+struct printk_aligned printk_no_wake_var[NR_CPUS];
-+EXPORT_SYMBOL(printk_no_wake_var);
-+
- /*
- * console_sem protects the console_drivers list, and also
- * provides serialisation for access to the entire console
-@@ -77,7 +84,7 @@ static int console_locked;
- * It is also used in interesting ways to provide interlocking in
- * release_console_sem().
- */
--static spinlock_t logbuf_lock = SPIN_LOCK_UNLOCKED;
-+spinlock_t logbuf_lock = SPIN_LOCK_UNLOCKED;
-
- static char __log_buf[__LOG_BUF_LEN];
- static char *log_buf = __log_buf;
-@@ -151,6 +158,43 @@ static int __init console_setup(char *st
-
- __setup("console=", console_setup);
-
-+static int __init setup_console_silencelevel(char *str)
-+{
-+ int level;
-+
-+ if (get_option(&str, &level) != 1)
-+ return 0;
-+
-+ console_silence_loglevel = level;
-+ return 1;
-+}
-+
-+__setup("silencelevel=", setup_console_silencelevel);
-+
-+static inline int ve_log_init(void)
-+{
-+#ifdef CONFIG_VE
-+ if (ve_log_buf != NULL)
-+ return 0;
-+
-+ if (ve_is_super(get_exec_env())) {
-+ ve0._log_wait = &log_wait;
-+ ve0._log_start = &log_start;
-+ ve0._log_end = &log_end;
-+ ve0._logged_chars = &logged_chars;
-+ ve0.log_buf = log_buf;
-+ return 0;
-+ }
-+
-+ ve_log_buf = kmalloc(ve_log_buf_len, GFP_ATOMIC);
-+ if (!ve_log_buf)
-+ return -ENOMEM;
-+
-+ memset(ve_log_buf, 0, ve_log_buf_len);
-+#endif
-+ return 0;
-+}
-+
- /**
- * add_preferred_console - add a device to the list of preferred consoles.
- *
-@@ -251,6 +295,10 @@ int do_syslog(int type, char __user * bu
- char c;
- int error = 0;
-
-+ if (!ve_is_super(get_exec_env()) &&
-+ (type == 6 || type == 7 || type == 8))
-+ goto out;
-+
- error = security_syslog(type);
- if (error)
- return error;
-@@ -270,14 +318,15 @@ int do_syslog(int type, char __user * bu
- error = verify_area(VERIFY_WRITE,buf,len);
- if (error)
- goto out;
-- error = wait_event_interruptible(log_wait, (log_start - log_end));
-+ error = wait_event_interruptible(ve_log_wait,
-+ (ve_log_start - ve_log_end));
- if (error)
- goto out;
- i = 0;
- spin_lock_irq(&logbuf_lock);
-- while (!error && (log_start != log_end) && i < len) {
-- c = LOG_BUF(log_start);
-- log_start++;
-+ while (!error && (ve_log_start != ve_log_end) && i < len) {
-+ c = VE_LOG_BUF(ve_log_start);
-+ ve_log_start++;
- spin_unlock_irq(&logbuf_lock);
- error = __put_user(c,buf);
- buf++;
-@@ -302,15 +351,17 @@ int do_syslog(int type, char __user * bu
- error = verify_area(VERIFY_WRITE,buf,len);
- if (error)
- goto out;
-+ if (ve_log_buf == NULL)
-+ goto out;
- count = len;
-- if (count > log_buf_len)
-- count = log_buf_len;
-+ if (count > ve_log_buf_len)
-+ count = ve_log_buf_len;
- spin_lock_irq(&logbuf_lock);
-- if (count > logged_chars)
-- count = logged_chars;
-+ if (count > ve_logged_chars)
-+ count = ve_logged_chars;
- if (do_clear)
-- logged_chars = 0;
-- limit = log_end;
-+ ve_logged_chars = 0;
-+ limit = ve_log_end;
- /*
- * __put_user() could sleep, and while we sleep
- * printk() could overwrite the messages
-@@ -319,9 +370,9 @@ int do_syslog(int type, char __user * bu
- */
- for(i = 0; i < count && !error; i++) {
- j = limit-1-i;
-- if (j + log_buf_len < log_end)
-+ if (j + ve_log_buf_len < ve_log_end)
- break;
-- c = LOG_BUF(j);
-+ c = VE_LOG_BUF(j);
- spin_unlock_irq(&logbuf_lock);
- error = __put_user(c,&buf[count-1-i]);
- cond_resched();
-@@ -345,7 +396,7 @@ int do_syslog(int type, char __user * bu
- }
- break;
- case 5: /* Clear ring buffer */
-- logged_chars = 0;
-+ ve_logged_chars = 0;
- break;
- case 6: /* Disable logging to console */
- console_loglevel = minimum_console_loglevel;
-@@ -363,10 +414,10 @@ int do_syslog(int type, char __user * bu
- error = 0;
- break;
- case 9: /* Number of chars in the log buffer */
-- error = log_end - log_start;
-+ error = ve_log_end - ve_log_start;
- break;
- case 10: /* Size of the log buffer */
-- error = log_buf_len;
-+ error = ve_log_buf_len;
- break;
- default:
- error = -EINVAL;
-@@ -480,14 +531,14 @@ static void call_console_drivers(unsigne
-
- static void emit_log_char(char c)
- {
-- LOG_BUF(log_end) = c;
-- log_end++;
-- if (log_end - log_start > log_buf_len)
-- log_start = log_end - log_buf_len;
-- if (log_end - con_start > log_buf_len)
-+ VE_LOG_BUF(ve_log_end) = c;
-+ ve_log_end++;
-+ if (ve_log_end - ve_log_start > ve_log_buf_len)
-+ ve_log_start = ve_log_end - ve_log_buf_len;
-+ if (ve_is_super(get_exec_env()) && log_end - con_start > log_buf_len)
- con_start = log_end - log_buf_len;
-- if (logged_chars < log_buf_len)
-- logged_chars++;
-+ if (ve_logged_chars < ve_log_buf_len)
-+ ve_logged_chars++;
- }
-
- /*
-@@ -511,6 +562,8 @@ static void zap_locks(void)
- init_MUTEX(&console_sem);
- }
-
-+static unsigned long do_release_console_sem(unsigned long *flags);
-+
- /*
- * This is printk. It can be called from any context. We want it to work.
- *
-@@ -524,25 +577,14 @@ static void zap_locks(void)
- * then changes console_loglevel may break. This is because console_loglevel
- * is inspected when the actual printing occurs.
- */
--asmlinkage int printk(const char *fmt, ...)
--{
-- va_list args;
-- int r;
--
-- va_start(args, fmt);
-- r = vprintk(fmt, args);
-- va_end(args);
--
-- return r;
--}
--
--asmlinkage int vprintk(const char *fmt, va_list args)
-+asmlinkage int ve_vprintk(const char *fmt, va_list args)
- {
- unsigned long flags;
- int printed_len;
- char *p;
- static char printk_buf[1024];
- static int log_level_unknown = 1;
-+ int err, need_wake;
-
- if (unlikely(oops_in_progress))
- zap_locks();
-@@ -550,6 +592,12 @@ asmlinkage int vprintk(const char *fmt,
- /* This stops the holder of console_sem just where we want him */
- spin_lock_irqsave(&logbuf_lock, flags);
-
-+ err = ve_log_init();
-+ if (err) {
-+ spin_unlock_irqrestore(&logbuf_lock, flags);
-+ return err;
-+ }
-+
- /* Emit the output into the temporary buffer */
- printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args);
-
-@@ -588,7 +636,26 @@ asmlinkage int vprintk(const char *fmt,
- spin_unlock_irqrestore(&logbuf_lock, flags);
- goto out;
- }
-- if (!down_trylock(&console_sem)) {
-+ if (!ve_is_super(get_exec_env())) {
-+ need_wake = (ve_log_start != ve_log_end);
-+ spin_unlock_irqrestore(&logbuf_lock, flags);
-+ if (!oops_in_progress && need_wake)
-+ wake_up_interruptible(&ve_log_wait);
-+ } else if (__printk_no_wake) {
-+ /*
-+ * A difficult case, created by the console semaphore mess...
-+ * All wakeups are omitted.
-+ */
-+ if (!atomic_add_negative(-1, &console_sem.count)) {
-+ console_locked = 1;
-+ console_may_schedule = 0;
-+ do_release_console_sem(&flags);
-+ console_locked = 0;
-+ console_may_schedule = 0;
-+ }
-+ atomic_inc(&console_sem.count);
-+ spin_unlock_irqrestore(&logbuf_lock, flags);
-+ } else if (!down_trylock(&console_sem)) {
- console_locked = 1;
- /*
- * We own the drivers. We can drop the spinlock and let
-@@ -608,8 +675,74 @@ asmlinkage int vprintk(const char *fmt,
- out:
- return printed_len;
- }
-+
-+asmlinkage int vprintk(const char *fmt, va_list args)
-+{
-+ int r;
-+ struct ve_struct *env;
-+
-+ env = set_exec_env(get_ve0());
-+ r = ve_vprintk(fmt, args);
-+ set_exec_env(env);
-+
-+ return r;
-+}
-+
-+static struct timer_list conswakeup_timer;
-+static void conswakeup_timer_call(unsigned long dumy)
-+{
-+ if (!down_trylock(&console_sem)) {
-+ console_locked = 1;
-+ console_may_schedule = 0;
-+ release_console_sem();
-+ }
-+ mod_timer(&conswakeup_timer, jiffies + 5 * HZ);
-+}
-+
-+static int __init conswakeup_init(void)
-+{
-+ init_timer(&conswakeup_timer);
-+ conswakeup_timer.function = &conswakeup_timer_call;
-+ conswakeup_timer.expires = jiffies + 5 * HZ;
-+ add_timer(&conswakeup_timer);
-+ return 0;
-+}
-+console_initcall(conswakeup_init);
-+
-+asmlinkage int printk(const char *fmt, ...)
-+{
-+ va_list args;
-+ int r;
-+
-+ va_start(args, fmt);
-+ r = vprintk(fmt, args);
-+ va_end(args);
-+
-+ return r;
-+}
-+
-+asmlinkage int ve_printk(int dst, const char *fmt, ...)
-+{
-+ va_list args;
-+ int printed_len;
-+
-+ printed_len = 0;
-+ if (ve_is_super(get_exec_env()) || (dst & VE0_LOG)) {
-+ va_start(args, fmt);
-+ printed_len = vprintk(fmt, args);
-+ va_end(args);
-+ }
-+ if (!ve_is_super(get_exec_env()) && (dst & VE_LOG)) {
-+ va_start(args, fmt);
-+ printed_len = ve_vprintk(fmt, args);
-+ va_end(args);
-+ }
-+ return printed_len;
-+}
-+
- EXPORT_SYMBOL(printk);
- EXPORT_SYMBOL(vprintk);
-+EXPORT_SYMBOL(ve_printk);
-
- /**
- * acquire_console_sem - lock the console system for exclusive use.
-@@ -635,6 +768,12 @@ int is_console_locked(void)
- }
- EXPORT_SYMBOL(is_console_locked);
-
-+void wake_up_klogd(void)
-+{
-+ if (!oops_in_progress && waitqueue_active(&log_wait))
-+ wake_up_interruptible(&log_wait);
-+}
-+
- /**
- * release_console_sem - unlock the console system
- *
-@@ -649,29 +788,39 @@ EXPORT_SYMBOL(is_console_locked);
- *
- * release_console_sem() may be called from any context.
- */
--void release_console_sem(void)
-+static unsigned long do_release_console_sem(unsigned long *flags)
- {
-- unsigned long flags;
- unsigned long _con_start, _log_end;
-- unsigned long wake_klogd = 0;
-+ unsigned long wake_klogd;
-
-+ wake_klogd = 0;
- for ( ; ; ) {
-- spin_lock_irqsave(&logbuf_lock, flags);
- wake_klogd |= log_start - log_end;
- if (con_start == log_end)
- break; /* Nothing to print */
- _con_start = con_start;
- _log_end = log_end;
- con_start = log_end; /* Flush */
-- spin_unlock_irqrestore(&logbuf_lock, flags);
-+ spin_unlock_irqrestore(&logbuf_lock, *flags);
- call_console_drivers(_con_start, _log_end);
-+ spin_lock_irqsave(&logbuf_lock, *flags);
- }
-+ return wake_klogd;
-+}
-+
-+void release_console_sem(void)
-+{
-+ unsigned long wake_klogd;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&logbuf_lock, flags);
-+ wake_klogd = do_release_console_sem(&flags);
- console_locked = 0;
- console_may_schedule = 0;
- up(&console_sem);
- spin_unlock_irqrestore(&logbuf_lock, flags);
-- if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait))
-- wake_up_interruptible(&log_wait);
-+ if (wake_klogd)
-+ wake_up_klogd();
- }
- EXPORT_SYMBOL(release_console_sem);
-
-@@ -930,3 +1079,33 @@ int printk_ratelimit(void)
- printk_ratelimit_burst);
- }
- EXPORT_SYMBOL(printk_ratelimit);
-+
-+/*
-+ * Rate limiting stuff.
-+ */
-+int vz_ratelimit(struct vz_rate_info *p)
-+{
-+ unsigned long cjif, djif;
-+ unsigned long flags;
-+ static spinlock_t ratelimit_lock = SPIN_LOCK_UNLOCKED;
-+ long new_bucket;
-+
-+ spin_lock_irqsave(&ratelimit_lock, flags);
-+ cjif = jiffies;
-+ djif = cjif - p->last;
-+ if (djif < p->interval) {
-+ if (p->bucket >= p->burst) {
-+ spin_unlock_irqrestore(&ratelimit_lock, flags);
-+ return 0;
-+ }
-+ p->bucket++;
-+ } else {
-+ new_bucket = p->bucket - (djif / (unsigned)p->interval);
-+ if (new_bucket < 0)
-+ new_bucket = 0;
-+ p->bucket = new_bucket + 1;
-+ }
-+ p->last = cjif;
-+ spin_unlock_irqrestore(&ratelimit_lock, flags);
-+ return 1;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ptrace.c linux-2.6.9-ve023stab030/kernel/ptrace.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ptrace.c 2006-10-11 18:29:48.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/ptrace.c 2006-10-11 19:07:59.000000000 +0400
-@@ -72,8 +72,8 @@ void ptrace_untrace(task_t *child)
- */
- void __ptrace_unlink(task_t *child)
- {
-- if (!child->ptrace)
-- BUG();
-+ BUG_ON(!child->ptrace);
-+
- child->ptrace = 0;
- if (!list_empty(&child->ptrace_list)) {
- list_del_init(&child->ptrace_list);
-@@ -130,7 +130,7 @@ int ptrace_attach(struct task_struct *ta
- retval = -EPERM;
- if (task->pid <= 1)
- goto bad;
-- if (task == current)
-+ if (task->tgid == current->tgid)
- goto bad;
- if (!task->mm)
- goto bad;
-@@ -144,6 +144,10 @@ int ptrace_attach(struct task_struct *ta
- rmb();
- if (!task->mm->dumpable && !capable(CAP_SYS_PTRACE))
- goto bad;
-+ if (!task->mm->vps_dumpable && !ve_is_super(get_exec_env()))
-+ goto bad;
-+ if (task->mm->vps_dumpable == 2)
-+ goto bad;
- /* the same process cannot be attached many times */
- if (task->ptrace & PT_PTRACED)
- goto bad;
-@@ -170,22 +174,27 @@ bad:
- return retval;
- }
-
-+void __ptrace_detach(struct task_struct *child, unsigned int data)
-+{
-+ child->exit_code = data;
-+ /* .. re-parent .. */
-+ __ptrace_unlink(child);
-+ /* .. and wake it up. */
-+ if (child->exit_state != EXIT_ZOMBIE)
-+ wake_up_process(child);
-+}
-+
- int ptrace_detach(struct task_struct *child, unsigned int data)
- {
- if ((unsigned long) data > _NSIG)
-- return -EIO;
-+ return -EIO;
-
- /* Architecture-specific hardware disable .. */
- ptrace_disable(child);
-
-- /* .. re-parent .. */
-- child->exit_code = data;
--
- write_lock_irq(&tasklist_lock);
-- __ptrace_unlink(child);
-- /* .. and wake it up. */
-- if (child->exit_state != EXIT_ZOMBIE)
-- wake_up_process(child);
-+ if (child->ptrace)
-+ __ptrace_detach(child, data);
- write_unlock_irq(&tasklist_lock);
-
- return 0;
-@@ -245,6 +254,7 @@ int access_process_vm(struct task_struct
-
- return buf - old_buf;
- }
-+EXPORT_SYMBOL(access_process_vm);
-
- int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/sched.c linux-2.6.9-ve023stab030/kernel/sched.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/sched.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/sched.c 2006-10-11 19:08:02.000000000 +0400
-@@ -45,6 +45,8 @@
- #include <linux/seq_file.h>
- #include <linux/times.h>
- #include <linux/kprobes.h>
-+#include <linux/vsched.h>
-+#include <linux/fairsched.h>
- #include <asm/tlb.h>
-
- #include <asm/unistd.h>
-@@ -140,7 +142,7 @@
- #ifdef CONFIG_SMP
- #define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \
- (1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \
-- num_online_cpus())
-+ vsched_num_online_vcpus(task_vsched(p)))
- #else
- #define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \
- (1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)))
-@@ -221,6 +223,7 @@ struct prio_array {
- * (such as the load balancing or the thread migration code), lock
- * acquire operations must be ordered by ascending &runqueue.
- */
-+typedef struct vcpu_info *vcpu_t;
- struct runqueue {
- spinlock_t lock;
-
-@@ -235,7 +238,7 @@ struct runqueue {
- unsigned long long nr_switches;
- unsigned long expired_timestamp, nr_uninterruptible;
- unsigned long long timestamp_last_tick;
-- task_t *curr, *idle;
-+ task_t *curr;
- struct mm_struct *prev_mm;
- prio_array_t *active, *expired, arrays[2];
- int best_expired_prio;
-@@ -246,11 +249,11 @@ struct runqueue {
-
- /* For active balancing */
- int active_balance;
-- int push_cpu;
-+#endif
-+ vcpu_t push_cpu;
-
- task_t *migration_thread;
- struct list_head migration_queue;
--#endif
-
- #ifdef CONFIG_SCHEDSTATS
- /* latency stats */
-@@ -295,7 +298,51 @@ struct runqueue {
- #endif
- };
-
--static DEFINE_PER_CPU(struct runqueue, runqueues);
-+/* VCPU scheduler state description */
-+struct vcpu_info;
-+struct vcpu_scheduler {
-+ struct list_head idle_list;
-+ struct list_head active_list;
-+ struct list_head running_list;
-+#ifdef CONFIG_FAIRSCHED
-+ struct fairsched_node *node;
-+#endif
-+ struct vcpu_info *vcpu[NR_CPUS];
-+ int id;
-+ cpumask_t vcpu_online_map, vcpu_running_map;
-+ cpumask_t pcpu_running_map;
-+ int num_online_vcpus;
-+} ____cacheline_maxaligned_in_smp;
-+
-+/* virtual CPU description */
-+struct vcpu_info {
-+ struct runqueue rq;
-+#ifdef CONFIG_SCHED_VCPU
-+ unsigned active : 1,
-+ running : 1;
-+ struct list_head list;
-+ struct vcpu_scheduler *vsched;
-+ int last_pcpu;
-+ u32 start_time;
-+#endif
-+ int id;
-+} ____cacheline_maxaligned_in_smp;
-+
-+/* physical CPU description */
-+struct pcpu_info {
-+ struct vcpu_scheduler *vsched;
-+ struct vcpu_info *vcpu;
-+ task_t *idle;
-+#ifdef CONFIG_SMP
-+ struct sched_domain *sd;
-+#endif
-+ int id;
-+} ____cacheline_maxaligned_in_smp;
-+
-+struct pcpu_info pcpu_info[NR_CPUS];
-+
-+#define pcpu(nr) (&pcpu_info[nr])
-+#define this_pcpu() (pcpu(smp_processor_id()))
-
- /*
- * sched-domains (multiprocessor balancing) declarations:
-@@ -439,22 +486,566 @@ struct sched_domain {
-
-
- #define for_each_domain(cpu, domain) \
-- for (domain = cpu_rq(cpu)->sd; domain; domain = domain->parent)
-+ for (domain = vcpu_rq(cpu)->sd; domain; domain = domain->parent)
-+
-+#ifdef CONFIG_SCHED_VCPU
-+
-+u32 vcpu_sched_timeslice = 5;
-+u32 vcpu_timeslice = 0;
-+EXPORT_SYMBOL(vcpu_sched_timeslice);
-+EXPORT_SYMBOL(vcpu_timeslice);
-+
-+extern spinlock_t fairsched_lock;
-+static struct vcpu_scheduler default_vsched, idle_vsched;
-+static struct vcpu_info boot_vcpu, boot_idle_vcpu;
-+
-+#define vsched_default_vsched() (&default_vsched)
-+#define vsched_default_vcpu(id) (default_vsched.vcpu[id])
-+
-+/*
-+ * All macroses below could be used without locks, if there is no
-+ * strict ordering requirements, because we assume, that:
-+ *
-+ * 1. VCPU could not disappear "on the fly" (FIXME)
-+ *
-+ * 2. p->vsched access is atomic.
-+ */
-+
-+#define task_vsched(tsk) ((tsk)->vsched)
-+#define this_vsched() (task_vsched(current))
-+
-+#define vsched_vcpu(vsched, id) ((vsched)->vcpu[id])
-+#define this_vcpu() (task_vcpu(current))
-+#define task_vcpu(p) ((p)->vcpu)
-+
-+#define vsched_id(vsched) ((vsched)->id)
-+#define vsched_vcpu_online_map(vsched) ((vsched)->vcpu_online_map)
-+#define vsched_num_online_vcpus(vsched) ((vsched)->num_online_vcpus)
-+#define vsched_pcpu_running_map(vsched) ((vsched)->pcpu_running_map)
-+
-+#define vcpu_vsched(vcpu) ((vcpu)->vsched)
-+#define vcpu_last_pcpu(vcpu) ((vcpu)->last_pcpu)
-+#define vcpu_isset(vcpu, mask) (cpu_isset((vcpu)->id, mask))
-+#define vcpu_is_offline(vcpu) (!vcpu_isset(vcpu, \
-+ vcpu_vsched(vcpu)->vcpu_online_map))
-+
-+static int __add_vcpu(struct vcpu_scheduler *vsched, int id);
-+
-+#else /* CONFIG_SCHED_VCPU */
-+
-+static DEFINE_PER_CPU(struct vcpu_info, vcpu_info);
-+
-+#define task_vsched(p) NULL
-+#define this_vcpu() (task_vcpu(current))
-+#define task_vcpu(p) (vcpu(task_cpu(p)))
-+
-+#define vsched_vcpu(sched, id) (vcpu(id))
-+#define vsched_id(vsched) 0
-+#define vsched_default_vsched() NULL
-+#define vsched_default_vcpu(id) (vcpu(id))
-+
-+#define vsched_vcpu_online_map(vsched) (cpu_online_map)
-+#define vsched_num_online_vcpus(vsched) (num_online_cpus())
-+#define vsched_pcpu_running_map(vsched) (cpu_online_map)
-+
-+#define vcpu(id) (&per_cpu(vcpu_info, id))
-+
-+#define vcpu_vsched(vcpu) NULL
-+#define vcpu_last_pcpu(vcpu) ((vcpu)->id)
-+#define vcpu_isset(vcpu, mask) (cpu_isset((vcpu)->id, mask))
-+#define vcpu_is_offline(vcpu) (cpu_is_offline((vcpu)->id))
-+
-+#endif /* CONFIG_SCHED_VCPU */
-+
-+#define this_rq() (vcpu_rq(this_vcpu()))
-+#define task_rq(p) (vcpu_rq(task_vcpu(p)))
-+#define vcpu_rq(vcpu) (&(vcpu)->rq)
-+#define get_vcpu() ({ preempt_disable(); this_vcpu(); })
-+#define put_vcpu() ({ put_cpu(); })
-+#define rq_vcpu(__rq) (container_of((__rq), struct vcpu_info, rq))
-+
-+task_t *idle_task(int cpu)
-+{
-+ return pcpu(cpu)->idle;
-+}
-+
-+#ifdef CONFIG_SMP
-+static inline void update_rq_cpu_load(runqueue_t *rq)
-+{
-+ unsigned long old_load, this_load;
-+
-+ if (rq->nr_running == 0) {
-+ rq->cpu_load = 0;
-+ return;
-+ }
-+
-+ old_load = rq->cpu_load;
-+ this_load = rq->nr_running * SCHED_LOAD_SCALE;
-+ /*
-+ * Round up the averaging division if load is increasing. This
-+ * prevents us from getting stuck on 9 if the load is 10, for
-+ * example.
-+ */
-+ if (this_load > old_load)
-+ old_load++;
-+ rq->cpu_load = (old_load + this_load) / 2;
-+}
-+#else /* CONFIG_SMP */
-+static inline void update_rq_cpu_load(runqueue_t *rq)
-+{
-+}
-+#endif /* CONFIG_SMP */
-+
-+#ifdef CONFIG_SCHED_VCPU
-+
-+void fastcall vsched_cpu_online_map(struct vcpu_scheduler *vsched,
-+ cpumask_t *mask)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&fairsched_lock, flags);
-+ *mask = vsched->vcpu_online_map;
-+ spin_unlock_irqrestore(&fairsched_lock, flags);
-+}
-+
-+static inline void set_task_vsched(task_t *p, struct vcpu_scheduler *vsched)
-+{
-+ /* NOTE: set_task_cpu() is required after every set_task_vsched()! */
-+ p->vsched = vsched;
-+ p->vsched_id = vsched_id(vsched);
-+}
-+
-+inline void set_task_cpu(struct task_struct *p, unsigned int vcpu_id)
-+{
-+ p->vcpu = vsched_vcpu(task_vsched(p), vcpu_id);
-+ p->vcpu_id = vcpu_id;
-+}
-+
-+static inline void set_task_vcpu(struct task_struct *p, vcpu_t vcpu)
-+{
-+ p->vcpu = vcpu;
-+ p->vcpu_id = vcpu->id;
-+}
-+
-+/* this is called when rq->nr_running changes from 0 to 1 */
-+static void vcpu_attach(runqueue_t *rq)
-+{
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+
-+ vcpu = rq_vcpu(rq);
-+ vsched = vcpu_vsched(vcpu);
-+
-+ BUG_ON(vcpu->active);
-+ spin_lock(&fairsched_lock);
-+ vcpu->active = 1;
-+ if (!vcpu->running)
-+ list_move_tail(&vcpu->list, &vsched->active_list);
-+
-+ fairsched_incrun(vsched->node);
-+ spin_unlock(&fairsched_lock);
-+}
-+
-+/* this is called when rq->nr_running changes from 1 to 0 */
-+static void vcpu_detach(runqueue_t *rq)
-+{
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+
-+ vcpu = rq_vcpu(rq);
-+ vsched = vcpu_vsched(vcpu);
-+ BUG_ON(!vcpu->active);
-+
-+ spin_lock(&fairsched_lock);
-+ fairsched_decrun(vsched->node);
-+
-+ vcpu->active = 0;
-+ if (!vcpu->running)
-+ list_move_tail(&vcpu->list, &vsched->idle_list);
-+ spin_unlock(&fairsched_lock);
-+}
-+
-+static inline void __vcpu_get(vcpu_t vcpu)
-+{
-+ struct pcpu_info *pcpu;
-+ struct vcpu_scheduler *vsched;
-+
-+ BUG_ON(!this_vcpu()->running);
-+
-+ pcpu = this_pcpu();
-+ vsched = vcpu_vsched(vcpu);
-+
-+ pcpu->vcpu = vcpu;
-+ pcpu->vsched = vsched;
-+
-+ fairsched_inccpu(vsched->node);
-+
-+ list_move_tail(&vcpu->list, &vsched->running_list);
-+ vcpu->start_time = jiffies;
-+ vcpu->last_pcpu = pcpu->id;
-+ vcpu->running = 1;
-+ __set_bit(vcpu->id, vsched->vcpu_running_map.bits);
-+ __set_bit(pcpu->id, vsched->pcpu_running_map.bits);
-+#ifdef CONFIG_SMP
-+ vcpu_rq(vcpu)->sd = pcpu->sd;
-+#endif
-+}
-+
-+static void vcpu_put(vcpu_t vcpu)
-+{
-+ struct vcpu_scheduler *vsched;
-+ struct pcpu_info *cur_pcpu;
-+ runqueue_t *rq;
-+
-+ vsched = vcpu_vsched(vcpu);
-+ rq = vcpu_rq(vcpu);
-+ cur_pcpu = this_pcpu();
-+
-+ BUG_ON(!vcpu->running);
-+
-+ spin_lock(&fairsched_lock);
-+ vcpu->running = 0;
-+ list_move_tail(&vcpu->list,
-+ vcpu->active ? &vsched->active_list : &vsched->idle_list);
-+ fairsched_deccpu(vsched->node);
-+ __clear_bit(vcpu->id, vsched->vcpu_running_map.bits);
-+ if (vsched != this_vsched())
-+ __clear_bit(cur_pcpu->id, vsched->pcpu_running_map.bits);
-+
-+ if (!vcpu->active)
-+ rq->expired_timestamp = 0;
-+ /* from this point task_running(prev_rq, prev) will be 0 */
-+ rq->curr = cur_pcpu->idle;
-+ update_rq_cpu_load(rq);
-+ spin_unlock(&fairsched_lock);
-+}
-+
-+static vcpu_t schedule_vcpu(vcpu_t cur_vcpu, cycles_t cycles)
-+{
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+ runqueue_t *rq;
-+#ifdef CONFIG_FAIRSCHED
-+ struct fairsched_node *node, *nodec;
-+
-+ nodec = vcpu_vsched(cur_vcpu)->node;
-+ node = nodec;
-+#endif
-+
-+ BUG_ON(!cur_vcpu->running);
-+restart:
-+ spin_lock(&fairsched_lock);
-+#ifdef CONFIG_FAIRSCHED
-+ node = fairsched_schedule(node, nodec,
-+ cur_vcpu->active,
-+ cycles);
-+ if (unlikely(node == NULL))
-+ goto idle;
-+
-+ vsched = node->vsched;
-+#else
-+ vsched = &default_vsched;
-+#endif
-+ /* FIXME: optimize vcpu switching, maybe we do not need to call
-+ fairsched_schedule() at all if vcpu is still active and too
-+ little time have passed so far */
-+ if (cur_vcpu->vsched == vsched && cur_vcpu->active &&
-+ jiffies - cur_vcpu->start_time < msecs_to_jiffies(vcpu_sched_timeslice)) {
-+ vcpu = cur_vcpu;
-+ goto done;
-+ }
-+
-+ if (list_empty(&vsched->active_list)) {
-+ /* nothing except for this cpu can be scheduled */
-+ if (likely(cur_vcpu->vsched == vsched && cur_vcpu->active)) {
-+ /*
-+ * Current vcpu is the one we need. We have not
-+ * put it yet, so it's not on the active_list.
-+ */
-+ vcpu = cur_vcpu;
-+ goto done;
-+ } else
-+ goto none;
-+ }
-+
-+ /* select vcpu and add to running list */
-+ vcpu = list_entry(vsched->active_list.next, struct vcpu_info, list);
-+ __vcpu_get(vcpu);
-+done:
-+ spin_unlock(&fairsched_lock);
-+
-+ rq = vcpu_rq(vcpu);
-+ if (unlikely(vcpu != cur_vcpu)) {
-+ spin_unlock(&vcpu_rq(cur_vcpu)->lock);
-+ spin_lock(&rq->lock);
-+ if (unlikely(!rq->nr_running)) {
-+ /* race with balancing? */
-+ spin_unlock(&rq->lock);
-+ vcpu_put(vcpu);
-+ spin_lock(&vcpu_rq(cur_vcpu)->lock);
-+ goto restart;
-+ }
-+ }
-+ BUG_ON(!rq->nr_running);
-+ return vcpu;
-+
-+none:
-+#ifdef CONFIG_FAIRSCHED
-+ spin_unlock(&fairsched_lock);
-+
-+ /* fairsched doesn't schedule more CPUs than we have active */
-+ BUG_ON(1);
-+#else
-+ goto idle;
-+#endif
-+
-+idle:
-+ vcpu = task_vcpu(this_pcpu()->idle);
-+ __vcpu_get(vcpu);
-+ spin_unlock(&fairsched_lock);
-+ spin_unlock(&vcpu_rq(cur_vcpu)->lock);
-+
-+ spin_lock(&vcpu_rq(vcpu)->lock);
-+ return vcpu;
-+}
-+
-+#else /* CONFIG_SCHED_VCPU */
-+
-+#define set_task_vsched(task, vsched) do { } while (0)
-+
-+static inline void vcpu_attach(runqueue_t *rq)
-+{
-+}
-+
-+static inline void vcpu_detach(runqueue_t *rq)
-+{
-+}
-+
-+static inline void vcpu_put(vcpu_t vcpu)
-+{
-+}
-+
-+static inline vcpu_t schedule_vcpu(vcpu_t prev_vcpu, cycles_t cycles)
-+{
-+ return prev_vcpu;
-+}
-+
-+static inline void set_task_vcpu(struct task_struct *p, vcpu_t vcpu)
-+{
-+ set_task_pcpu(p, vcpu->id);
-+}
-
--#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
--#define this_rq() (&__get_cpu_var(runqueues))
--#define task_rq(p) cpu_rq(task_cpu(p))
--#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
-+#endif /* CONFIG_SCHED_VCPU */
-+
-+int vcpu_online(int cpu)
-+{
-+ return cpu_isset(cpu, vsched_vcpu_online_map(this_vsched()));
-+}
-
- /*
- * Default context-switch locking:
- */
- #ifndef prepare_arch_switch
- # define prepare_arch_switch(rq, next) do { } while (0)
--# define finish_arch_switch(rq, next) spin_unlock_irq(&(rq)->lock)
-+# define finish_arch_switch(rq, next) spin_unlock(&(rq)->lock)
- # define task_running(rq, p) ((rq)->curr == (p))
- #endif
-
-+struct kernel_stat_glob kstat_glob;
-+spinlock_t kstat_glb_lock = SPIN_LOCK_UNLOCKED;
-+EXPORT_SYMBOL(kstat_glob);
-+EXPORT_SYMBOL(kstat_glb_lock);
-+
-+#ifdef CONFIG_VE
-+
-+#define ve_nr_running_inc(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_running++; \
-+ } while(0)
-+#define ve_nr_running_dec(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_running--; \
-+ } while(0)
-+#define ve_nr_iowait_inc(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_iowait++; \
-+ } while(0)
-+#define ve_nr_iowait_dec(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_iowait--; \
-+ } while(0)
-+#define ve_nr_unint_inc(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_unint++; \
-+ } while(0)
-+#define ve_nr_unint_dec(env, cpu) \
-+ do { \
-+ VE_CPU_STATS((env), (cpu))->nr_unint--; \
-+ } while(0)
-+
-+void ve_sched_attach(struct ve_struct *envid)
-+{
-+ struct task_struct *tsk;
-+ unsigned int vcpu;
-+
-+ tsk = current;
-+ preempt_disable();
-+ vcpu = task_cpu(tsk);
-+ ve_nr_running_dec(VE_TASK_INFO(tsk)->owner_env, vcpu);
-+ ve_nr_running_inc(envid, vcpu);
-+ preempt_enable();
-+}
-+EXPORT_SYMBOL(ve_sched_attach);
-+
-+#else
-+
-+#define ve_nr_running_inc(env, cpu) do { } while(0)
-+#define ve_nr_running_dec(env, cpu) do { } while(0)
-+#define ve_nr_iowait_inc(env, cpu) do { } while(0)
-+#define ve_nr_iowait_dec(env, cpu) do { } while(0)
-+#define ve_nr_unint_inc(env, cpu) do { } while(0)
-+#define ve_nr_unint_dec(env, cpu) do { } while(0)
-+
-+#endif
-+
-+struct task_nrs_struct {
-+ long nr_running;
-+ long nr_uninterruptible;
-+ long nr_stopped;
-+ long nr_sleeping;
-+ atomic_t nr_iowait;
-+ long long nr_switches;
-+} ____cacheline_aligned_in_smp;
-+
-+static struct task_nrs_struct glob_tasks_nrs[NR_CPUS];
-+unsigned long nr_zombie = 0; /* protected by tasklist_lock */
-+unsigned long nr_dead = 0;
-+EXPORT_SYMBOL(nr_zombie);
-+EXPORT_SYMBOL(nr_dead);
-+
-+#define nr_running_inc(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_running++; \
-+ ve_nr_running_inc(ve, vcpu); \
-+ } while (0)
-+#define nr_running_dec(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_running--; \
-+ ve_nr_running_dec(ve, vcpu); \
-+ } while (0)
-+
-+#define nr_unint_inc(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_uninterruptible++; \
-+ ve_nr_unint_inc(ve, vcpu); \
-+ } while (0)
-+#define nr_unint_dec(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_uninterruptible--; \
-+ ve_nr_unint_dec(ve, vcpu); \
-+ } while (0)
-+
-+#define nr_iowait_inc(cpu) do { \
-+ atomic_inc(&glob_tasks_nrs[cpu].nr_iowait); \
-+ } while (0)
-+#define nr_iowait_dec(cpu) do { \
-+ atomic_dec(&glob_tasks_nrs[cpu].nr_iowait); \
-+ } while (0)
-+
-+#define nr_stopped_inc(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_stopped++; \
-+ } while (0)
-+#define nr_stopped_dec(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_stopped--; \
-+ } while (0)
-+
-+#define nr_sleeping_inc(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_sleeping++; \
-+ } while (0)
-+#define nr_sleeping_dec(cpu, vcpu, ve) do { \
-+ glob_tasks_nrs[cpu].nr_sleeping--; \
-+ } while (0)
-+
-+#if defined(CONFIG_VE) && defined(CONFIG_SCHED_VCPU)
-+#define cycles_after(a, b) ((long long)(b) - (long long)(a) < 0)
-+
-+cycles_t ve_sched_get_idle_time(struct ve_struct *ve, int cpu)
-+{
-+ struct ve_cpu_stats *ve_stat;
-+ unsigned v;
-+ cycles_t strt, ret, cycles;
-+
-+ ve_stat = VE_CPU_STATS(ve, cpu);
-+ do {
-+ v = read_seqcount_begin(&ve_stat->stat_lock);
-+ ret = ve_stat->idle_time;
-+ strt = ve_stat->strt_idle_time;
-+ if (strt && nr_uninterruptible_ve(ve) == 0) {
-+ cycles = get_cycles();
-+ if (cycles_after(cycles, strt))
-+ ret += cycles - strt;
-+ }
-+ } while (read_seqcount_retry(&ve_stat->stat_lock, v));
-+ return ret;
-+}
-+
-+cycles_t ve_sched_get_iowait_time(struct ve_struct *ve, int vcpu)
-+{
-+ struct ve_cpu_stats *ve_stat;
-+ unsigned v;
-+ cycles_t strt, ret, cycles;
-+
-+ ve_stat = VE_CPU_STATS(ve, vcpu);
-+ do {
-+ struct runqueue *rq;
-+ rq = vcpu_rq(vsched_vcpu(this_vsched(), vcpu));
-+ v = read_seqcount_begin(&ve_stat->stat_lock);
-+ ret = ve_stat->iowait_time;
-+ strt = ve_stat->strt_idle_time;
-+ if (strt && atomic_read(&rq->nr_iowait) > 0) {
-+ cycles = get_cycles();
-+ if (cycles_after(cycles, strt))
-+ ret += cycles - strt;
-+ }
-+ } while (read_seqcount_retry(&ve_stat->stat_lock, v));
-+ return ret;
-+}
-+
-+static inline void vcpu_save_ve_idle(struct ve_struct *ve,
-+ vcpu_t vcpu, cycles_t cycles)
-+{
-+ struct ve_cpu_stats *ve_stat;
-+
-+ ve_stat = VE_CPU_STATS(ve, vcpu->id);
-+
-+ write_seqcount_begin(&ve_stat->stat_lock);
-+ if (ve_stat->strt_idle_time) {
-+ if (cycles_after(cycles, ve_stat->strt_idle_time)) {
-+ if (atomic_read(&vcpu_rq(vcpu)->nr_iowait) == 0)
-+ ve_stat->idle_time += cycles -
-+ ve_stat->strt_idle_time;
-+ else
-+ ve_stat->iowait_time += cycles -
-+ ve_stat->strt_idle_time;
-+ }
-+ ve_stat->strt_idle_time = 0;
-+ }
-+ write_seqcount_end(&ve_stat->stat_lock);
-+}
-+
-+static inline void vcpu_strt_ve_idle(struct ve_struct *ve,
-+ unsigned int vcpu, cycles_t cycles)
-+{
-+ struct ve_cpu_stats *ve_stat;
-+
-+ ve_stat = VE_CPU_STATS(ve, vcpu);
-+
-+ write_seqcount_begin(&ve_stat->stat_lock);
-+ ve_stat->strt_idle_time = cycles;
-+ write_seqcount_end(&ve_stat->stat_lock);
-+}
-+
-+#else
-+#define vcpu_save_ve_idle(ve, vcpu, cycles) do { } while (0)
-+#define vcpu_strt_ve_idle(ve, vcpu, cycles) do { } while (0)
-+#endif
-+
- /*
- * task_rq_lock - lock the runqueue a given task resides on and disable
- * interrupts. Note the ordering: we can safely lookup the task_rq without
-@@ -767,13 +1358,39 @@ static int effective_prio(task_t *p)
- return prio;
- }
-
-+static inline void write_wakeup_stamp(struct task_struct *p, cycles_t cyc)
-+{
-+ struct ve_task_info *ti;
-+
-+ ti = VE_TASK_INFO(p);
-+ write_seqcount_begin(&ti->wakeup_lock);
-+ ti->wakeup_stamp = cyc;
-+ write_seqcount_end(&ti->wakeup_lock);
-+}
-+
- /*
- * __activate_task - move a task to the runqueue.
- */
- static inline void __activate_task(task_t *p, runqueue_t *rq)
- {
-+ cycles_t cycles;
-+ unsigned int vcpu;
-+ struct ve_struct *ve;
-+
-+ cycles = get_cycles();
-+ vcpu = task_cpu(p);
-+ ve = VE_TASK_INFO(p)->owner_env;
-+
-+ write_wakeup_stamp(p, cycles);
-+ VE_TASK_INFO(p)->sleep_time += cycles;
-+ nr_running_inc(smp_processor_id(), vcpu, ve);
-+
- enqueue_task(p, rq->active);
- rq->nr_running++;
-+ if (rq->nr_running == 1) {
-+ vcpu_save_ve_idle(ve, task_vcpu(p), cycles);
-+ vcpu_attach(rq);
-+ }
- }
-
- /*
-@@ -913,11 +1530,33 @@ static void activate_task(task_t *p, run
- */
- static void deactivate_task(struct task_struct *p, runqueue_t *rq)
- {
-+ cycles_t cycles;
-+ unsigned int cpu, vcpu;
-+ struct ve_struct *ve;
-+
-+ cycles = get_cycles();
-+ cpu = smp_processor_id();
-+ vcpu = task_cpu(p);
-+ ve = VE_TASK_INFO(p)->owner_env;
-+
-+ VE_TASK_INFO(p)->sleep_time -= cycles;
- rq->nr_running--;
-- if (p->state == TASK_UNINTERRUPTIBLE)
-+ nr_running_dec(cpu, vcpu, ve);
-+ if (p->state == TASK_UNINTERRUPTIBLE) {
- rq->nr_uninterruptible++;
-+ nr_unint_inc(cpu, vcpu, ve);
-+ }
-+ if (p->state == TASK_INTERRUPTIBLE)
-+ nr_sleeping_inc(cpu, vcpu, ve);
-+ if (p->state == TASK_STOPPED)
-+ nr_stopped_inc(cpu, vcpu, ve);
-+ /* nr_zombie is calced in exit.c */
- dequeue_task(p, p->array);
- p->array = NULL;
-+ if (rq->nr_running == 0) {
-+ vcpu_strt_ve_idle(ve, vcpu, cycles);
-+ vcpu_detach(rq);
-+ }
- }
-
- /*
-@@ -928,19 +1567,24 @@ static void deactivate_task(struct task_
- * the target CPU.
- */
- #ifdef CONFIG_SMP
-+/* FIXME: need to add vsched arg */
- static void resched_task(task_t *p)
- {
- int need_resched, nrpolling;
-
-+#if 0
-+ /* FIXME: this fails due to idle rq->curre == idle */
- BUG_ON(!spin_is_locked(&task_rq(p)->lock));
-+#endif
-
- /* minimise the chance of sending an interrupt to poll_idle() */
- nrpolling = test_tsk_thread_flag(p,TIF_POLLING_NRFLAG);
- need_resched = test_and_set_tsk_thread_flag(p,TIF_NEED_RESCHED);
- nrpolling |= test_tsk_thread_flag(p,TIF_POLLING_NRFLAG);
-
-- if (!need_resched && !nrpolling && (task_cpu(p) != smp_processor_id()))
-- smp_send_reschedule(task_cpu(p));
-+ /* FIXME: think over */
-+ if (!need_resched && !nrpolling && (task_pcpu(p) != smp_processor_id()))
-+ smp_send_reschedule(task_pcpu(p));
- }
- #else
- static inline void resched_task(task_t *p)
-@@ -955,10 +1599,31 @@ static inline void resched_task(task_t *
- */
- inline int task_curr(const task_t *p)
- {
-- return cpu_curr(task_cpu(p)) == p;
-+ return task_rq(p)->curr == p;
-+}
-+
-+EXPORT_SYMBOL(task_curr);
-+
-+/**
-+ * idle_cpu - is a given cpu idle currently?
-+ * @cpu: the processor in question.
-+ */
-+inline int idle_cpu(int cpu)
-+{
-+ return pcpu(cpu)->vsched == &idle_vsched;
-+}
-+
-+EXPORT_SYMBOL_GPL(idle_cpu);
-+
-+static inline int idle_vcpu(vcpu_t cpu)
-+{
-+#ifdef CONFIG_SCHED_VCPU
-+ return !cpu->active;
-+#else
-+ return idle_cpu(cpu->id);
-+#endif
- }
-
--#ifdef CONFIG_SMP
- enum request_type {
- REQ_MOVE_TASK,
- REQ_SET_DOMAIN,
-@@ -970,7 +1635,7 @@ typedef struct {
-
- /* For REQ_MOVE_TASK */
- task_t *task;
-- int dest_cpu;
-+ vcpu_t dest_cpu;
-
- /* For REQ_SET_DOMAIN */
- struct sched_domain *sd;
-@@ -982,7 +1647,7 @@ typedef struct {
- * The task's runqueue lock must be held.
- * Returns true if you have to wait for migration thread.
- */
--static int migrate_task(task_t *p, int dest_cpu, migration_req_t *req)
-+static int migrate_task(task_t *p, vcpu_t dest_cpu, migration_req_t *req)
- {
- runqueue_t *rq = task_rq(p);
-
-@@ -990,8 +1655,13 @@ static int migrate_task(task_t *p, int d
- * If the task is not on a runqueue (and not running), then
- * it is sufficient to simply update the task's cpu field.
- */
-+#ifdef CONFIG_SCHED_VCPU
-+ BUG_ON(task_vsched(p) == &idle_vsched);
-+ BUG_ON(vcpu_vsched(dest_cpu) == &idle_vsched);
-+#endif
- if (!p->array && !task_running(rq, p)) {
-- set_task_cpu(p, dest_cpu);
-+ set_task_vsched(p, vcpu_vsched(dest_cpu));
-+ set_task_vcpu(p, dest_cpu);
- return 0;
- }
-
-@@ -1003,6 +1673,7 @@ static int migrate_task(task_t *p, int d
- return 1;
- }
-
-+#ifdef CONFIG_SMP
- /*
- * wait_task_inactive - wait for a thread to unschedule.
- *
-@@ -1032,6 +1703,7 @@ repeat:
- }
- task_rq_unlock(rq, &flags);
- }
-+EXPORT_SYMBOL(wait_task_inactive);
-
- /***
- * kick_process - kick a running thread to enter/exit the kernel
-@@ -1045,8 +1717,11 @@ void kick_process(task_t *p)
- int cpu;
-
- preempt_disable();
-- cpu = task_cpu(p);
-+ cpu = task_pcpu(p);
- if ((cpu != smp_processor_id()) && task_curr(p))
-+ /* FIXME: ??? think over */
-+ /* should add something like get_pcpu(cpu)->vcpu->id == task_cpu(p),
-+ but with serialization of vcpu access... */
- smp_send_reschedule(cpu);
- preempt_enable();
- }
-@@ -1057,9 +1732,9 @@ void kick_process(task_t *p)
- * We want to under-estimate the load of migration sources, to
- * balance conservatively.
- */
--static inline unsigned long source_load(int cpu)
-+static inline unsigned long source_load(vcpu_t cpu)
- {
-- runqueue_t *rq = cpu_rq(cpu);
-+ runqueue_t *rq = vcpu_rq(cpu);
- unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
-
- return min(rq->cpu_load, load_now);
-@@ -1068,9 +1743,9 @@ static inline unsigned long source_load(
- /*
- * Return a high guess at the load of a migration-target cpu
- */
--static inline unsigned long target_load(int cpu)
-+static inline unsigned long target_load(vcpu_t cpu)
- {
-- runqueue_t *rq = cpu_rq(cpu);
-+ runqueue_t *rq = vcpu_rq(cpu);
- unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
-
- return max(rq->cpu_load, load_now);
-@@ -1086,31 +1761,38 @@ static inline unsigned long target_load(
- * Returns the CPU we should wake onto.
- */
- #if defined(ARCH_HAS_SCHED_WAKE_IDLE)
--static int wake_idle(int cpu, task_t *p)
-+static vcpu_t wake_idle(vcpu_t cpu, task_t *p)
- {
-- cpumask_t tmp;
-- runqueue_t *rq = cpu_rq(cpu);
-+ cpumask_t tmp, vtmp;
-+ runqueue_t *rq = vcpu_rq(cpu);
- struct sched_domain *sd;
-+ struct vcpu_scheduler *vsched;
- int i;
-
-- if (idle_cpu(cpu))
-+ if (idle_vcpu(cpu))
- return cpu;
-
- sd = rq->sd;
- if (!(sd->flags & SD_WAKE_IDLE))
- return cpu;
-
-- cpus_and(tmp, sd->span, p->cpus_allowed);
--
-- for_each_cpu_mask(i, tmp) {
-- if (idle_cpu(i))
-- return i;
-+ vsched = vcpu_vsched(cpu);
-+ cpus_and(tmp, sd->span, cpu_online_map);
-+ cpus_and(vtmp, vsched_vcpu_online_map(vsched), p->cpus_allowed);
-+
-+ for_each_cpu_mask(i, vtmp) {
-+ vcpu_t vcpu;
-+ vcpu = vsched_vcpu(vsched, i);
-+ if (!cpu_isset(vcpu_last_pcpu(vcpu), tmp))
-+ continue;
-+ if (idle_vcpu(vcpu))
-+ return vcpu;
- }
-
- return cpu;
- }
- #else
--static inline int wake_idle(int cpu, task_t *p)
-+static inline vcpu_t wake_idle(vcpu_t cpu, task_t *p)
- {
- return cpu;
- }
-@@ -1134,15 +1816,17 @@ int wake_balance=1;
- */
- static int try_to_wake_up(task_t * p, unsigned int state, int sync)
- {
-- int cpu, this_cpu, success = 0;
-+ vcpu_t cpu, this_cpu;
-+ int success = 0;
- unsigned long flags;
- long old_state;
- runqueue_t *rq;
- #ifdef CONFIG_SMP
- unsigned long load, this_load;
- struct sched_domain *sd;
-- int new_cpu;
-+ vcpu_t new_cpu;
- #endif
-+ cpu = NULL;
-
- rq = task_rq_lock(p, &flags);
- schedstat_inc(rq, ttwu_cnt);
-@@ -1153,8 +1837,8 @@ static int try_to_wake_up(task_t * p, un
- if (p->array)
- goto out_running;
-
-- cpu = task_cpu(p);
-- this_cpu = smp_processor_id();
-+ cpu = task_vcpu(p);
-+ this_cpu = this_vcpu();
-
- #ifdef CONFIG_SMP
- if (unlikely(task_running(rq, p)))
-@@ -1165,7 +1849,12 @@ static int try_to_wake_up(task_t * p, un
- if (!wake_balance)
- goto out_set_cpu;
-
-- if (cpu == this_cpu || unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
-+ /* FIXME: add vsched->last_vcpu array to optimize wakeups in different vsched */
-+ if (vcpu_vsched(cpu) != vcpu_vsched(this_cpu))
-+ goto out_set_cpu;
-+ if (cpu == this_cpu || unlikely(!vcpu_isset(this_cpu, p->cpus_allowed)))
-+ goto out_set_cpu;
-+ if (vcpu_is_offline(this_cpu))
- goto out_set_cpu;
-
- load = source_load(cpu);
-@@ -1202,7 +1891,7 @@ static int try_to_wake_up(task_t * p, un
- * This domain has SD_WAKE_AFFINE and p is cache cold
- * in this domain.
- */
-- if (cpu_isset(cpu, sd->span)) {
-+ if (cpu_isset(vcpu_last_pcpu(cpu), sd->span)) {
- schedstat_inc(sd, ttwu_wake_affine);
- goto out_set_cpu;
- }
-@@ -1212,7 +1901,7 @@ static int try_to_wake_up(task_t * p, un
- * This domain has SD_WAKE_BALANCE and there is
- * an imbalance.
- */
-- if (cpu_isset(cpu, sd->span)) {
-+ if (cpu_isset(vcpu_last_pcpu(cpu), sd->span)) {
- schedstat_inc(sd, ttwu_wake_balance);
- goto out_set_cpu;
- }
-@@ -1223,9 +1912,9 @@ static int try_to_wake_up(task_t * p, un
- out_set_cpu:
- schedstat_inc(rq, ttwu_attempts);
- new_cpu = wake_idle(new_cpu, p);
-- if (new_cpu != cpu && cpu_isset(new_cpu, p->cpus_allowed)) {
-+ if (new_cpu != cpu && vcpu_isset(new_cpu, p->cpus_allowed)) {
- schedstat_inc(rq, ttwu_moved);
-- set_task_cpu(p, new_cpu);
-+ set_task_vcpu(p, new_cpu);
- task_rq_unlock(rq, &flags);
- /* might preempt at this point */
- rq = task_rq_lock(p, &flags);
-@@ -1235,20 +1924,28 @@ out_set_cpu:
- if (p->array)
- goto out_running;
-
-- this_cpu = smp_processor_id();
-- cpu = task_cpu(p);
-+ this_cpu = this_vcpu();
-+ cpu = task_vcpu(p);
- }
-
- out_activate:
- #endif /* CONFIG_SMP */
- if (old_state == TASK_UNINTERRUPTIBLE) {
- rq->nr_uninterruptible--;
-+ nr_unint_dec(smp_processor_id(), task_cpu(p),
-+ VE_TASK_INFO(p)->owner_env);
- /*
- * Tasks on involuntary sleep don't earn
- * sleep_avg beyond just interactive state.
- */
- p->activated = -1;
- }
-+ if (old_state == TASK_INTERRUPTIBLE)
-+ nr_sleeping_dec(smp_processor_id(), task_cpu(p),
-+ VE_TASK_INFO(p)->owner_env);
-+ if (old_state == TASK_STOPPED)
-+ nr_stopped_dec(smp_processor_id(), task_cpu(p),
-+ VE_TASK_INFO(p)->owner_env);
-
- /*
- * Sync wakeups (i.e. those types of wakeups where the waker
-@@ -1287,11 +1984,38 @@ int fastcall wake_up_state(task_t *p, un
- }
-
- #ifdef CONFIG_SMP
--static int find_idlest_cpu(struct task_struct *p, int this_cpu,
-+static vcpu_t find_idlest_cpu(struct task_struct *p, vcpu_t this_cpu,
- struct sched_domain *sd);
- #endif
-
- /*
-+ * init is special, it is forked from swapper (idle_vsched) and should
-+ * belong to default_vsched, so we have to change it's vsched/fairsched manually
-+ */
-+void wake_up_init(task_t *p)
-+{
-+ runqueue_t *rq;
-+ unsigned long flags;
-+
-+ /* we should change both fairsched node and vsched here */
-+ set_task_vsched(p, &default_vsched);
-+ set_task_cpu(p, 0);
-+
-+ /*
-+ * can't call wake_up_new_task() directly here,
-+ * since it assumes that a child belongs to the same vsched
-+ */
-+ p->state = TASK_RUNNING;
-+ p->sleep_avg = 0;
-+ p->interactive_credit = 0;
-+ p->prio = effective_prio(p);
-+
-+ rq = task_rq_lock(p, &flags);
-+ __activate_task(p, rq);
-+ task_rq_unlock(rq, &flags);
-+}
-+
-+/*
- * Perform scheduler related setup for a newly forked process p.
- * p is forked by current.
- */
-@@ -1333,6 +2057,7 @@ void fastcall sched_fork(task_t *p)
- p->first_time_slice = 1;
- current->time_slice >>= 1;
- p->timestamp = sched_clock();
-+ VE_TASK_INFO(p)->sleep_time -= get_cycles(); /*cosmetic: sleep till wakeup below*/
- if (unlikely(!current->time_slice)) {
- /*
- * This case is rare, it happens when the parent has only
-@@ -1358,14 +2083,20 @@ void fastcall sched_fork(task_t *p)
- void fastcall wake_up_new_task(task_t * p, unsigned long clone_flags)
- {
- unsigned long flags;
-- int this_cpu, cpu;
-+ vcpu_t this_cpu, cpu;
- runqueue_t *rq, *this_rq;
-
-+ if (unlikely(p->pid == 1)) {
-+ wake_up_init(p);
-+ return;
-+ }
-+
- rq = task_rq_lock(p, &flags);
-- cpu = task_cpu(p);
-- this_cpu = smp_processor_id();
-+ this_cpu = this_vcpu();
-+ cpu = task_vcpu(p);
-
- BUG_ON(p->state != TASK_RUNNING);
-+ BUG_ON(task_vsched(current) != task_vsched(p));
-
- schedstat_inc(rq, wunt_cnt);
- /*
-@@ -1396,6 +2127,8 @@ void fastcall wake_up_new_task(task_t *
- p->array = current->array;
- p->array->nr_active++;
- rq->nr_running++;
-+ nr_running_inc(smp_processor_id(), task_cpu(p),
-+ VE_TASK_INFO(p)->owner_env);
- }
- set_need_resched();
- } else
-@@ -1409,7 +2142,7 @@ void fastcall wake_up_new_task(task_t *
- */
- this_rq = rq;
- } else {
-- this_rq = cpu_rq(this_cpu);
-+ this_rq = vcpu_rq(this_cpu);
-
- /*
- * Not the local CPU - must adjust timestamp. This should
-@@ -1480,10 +2213,15 @@ void fastcall sched_exit(task_t * p)
- */
- static inline void finish_task_switch(task_t *prev)
- {
-- runqueue_t *rq = this_rq();
-- struct mm_struct *mm = rq->prev_mm;
-+ runqueue_t *rq;
-+ struct mm_struct *mm;
- unsigned long prev_task_flags;
-+ vcpu_t prev_vcpu, vcpu;
-
-+ prev_vcpu = task_vcpu(prev);
-+ vcpu = this_vcpu();
-+ rq = vcpu_rq(vcpu);
-+ mm = rq->prev_mm;
- rq->prev_mm = NULL;
-
- /*
-@@ -1498,7 +2236,16 @@ static inline void finish_task_switch(ta
- * Manfred Spraul <manfred@colorfullife.com>
- */
- prev_task_flags = prev->flags;
-+
-+ /*
-+ * no schedule() should happen until vcpu_put,
-+ * and schedule_tail() calls us with preempt enabled...
-+ */
- finish_arch_switch(rq, prev);
-+ if (prev_vcpu != vcpu)
-+ vcpu_put(prev_vcpu);
-+ local_irq_enable();
-+
- if (mm)
- mmdrop(mm);
- if (unlikely(prev_task_flags & PF_DEAD)) {
-@@ -1520,8 +2267,9 @@ asmlinkage void schedule_tail(task_t *pr
- finish_task_switch(prev);
-
- if (current->set_child_tid)
-- put_user(current->pid, current->set_child_tid);
-+ put_user(virt_pid(current), current->set_child_tid);
- }
-+EXPORT_SYMBOL(schedule_tail);
-
- /*
- * context_switch - switch to the new MM and the new
-@@ -1559,47 +2307,120 @@ task_t * context_switch(runqueue_t *rq,
- * threads, current number of uninterruptible-sleeping threads, total
- * number of context switches performed since bootup.
- */
-+
- unsigned long nr_running(void)
- {
-- unsigned long i, sum = 0;
--
-- for_each_online_cpu(i)
-- sum += cpu_rq(i)->nr_running;
-+ int i;
-+ long sum;
-
-- return sum;
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += glob_tasks_nrs[i].nr_running;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
- }
-+EXPORT_SYMBOL(nr_running);
-
- unsigned long nr_uninterruptible(void)
- {
-- unsigned long i, sum = 0;
--
-- for_each_cpu(i)
-- sum += cpu_rq(i)->nr_uninterruptible;
-+ int i;
-+ long sum;
-
-- return sum;
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += glob_tasks_nrs[i].nr_uninterruptible;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
- }
-+EXPORT_SYMBOL(nr_uninterruptible);
-
--unsigned long long nr_context_switches(void)
-+unsigned long nr_sleeping(void)
- {
-- unsigned long long i, sum = 0;
-+ int i;
-+ long sum;
-
-- for_each_cpu(i)
-- sum += cpu_rq(i)->nr_switches;
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += glob_tasks_nrs[i].nr_sleeping;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
-+}
-+EXPORT_SYMBOL(nr_sleeping);
-
-- return sum;
-+unsigned long nr_stopped(void)
-+{
-+ int i;
-+ long sum;
-+
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += glob_tasks_nrs[i].nr_stopped;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
- }
-+EXPORT_SYMBOL(nr_stopped);
-
- unsigned long nr_iowait(void)
- {
-- unsigned long i, sum = 0;
-+ int i;
-+ long sum;
-
-- for_each_cpu(i)
-- sum += atomic_read(&cpu_rq(i)->nr_iowait);
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += atomic_read(&glob_tasks_nrs[i].nr_iowait);
-+ return (unsigned long)(sum < 0 ? 0 : sum);
-+}
-
-+unsigned long long nr_context_switches(void)
-+{
-+ int i;
-+ long long sum;
-+
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += glob_tasks_nrs[i].nr_switches;
- return sum;
- }
-
--#ifdef CONFIG_SMP
-+#ifdef CONFIG_VE
-+unsigned long nr_running_ve(struct ve_struct *ve)
-+{
-+ int i;
-+ long sum;
-+
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += VE_CPU_STATS(ve, i)->nr_running;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
-+}
-+
-+unsigned long nr_uninterruptible_ve(struct ve_struct *ve)
-+{
-+ int i;
-+ long sum;
-+
-+ sum = 0;
-+ for (i = 0; i < NR_CPUS; i++)
-+ sum += VE_CPU_STATS(ve, i)->nr_unint;
-+ return (unsigned long)(sum < 0 ? 0 : sum);
-+}
-+
-+unsigned long nr_iowait_ve(void)
-+{
-+ int i;
-+ long sum;
-+ struct vcpu_scheduler *vsched;
-+
-+ sum = 0;
-+#ifdef CONFIG_SCHED_VCPU
-+ vsched = this_vsched();
-+ for_each_cpu_mask(i, vsched_vcpu_online_map(vsched)) {
-+ struct runqueue *rq;
-+ rq = vcpu_rq(vsched_vcpu(vsched, i));
-+ sum += atomic_read(&rq->nr_iowait);
-+ }
-+#endif
-+ return (unsigned long)(sum < 0 ? 0 : sum);
-+}
-+#endif
-+
-+#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_VCPU)
-
- /*
- * double_rq_lock - safely lock two runqueues
-@@ -1635,6 +2456,7 @@ static void double_rq_unlock(runqueue_t
- spin_unlock(&rq2->lock);
- }
-
-+#ifdef CONFIG_SMP
- /*
- * double_lock_balance - lock the busiest runqueue, this_rq is locked already.
- */
-@@ -1653,23 +2475,34 @@ static void double_lock_balance(runqueue
- /*
- * find_idlest_cpu - find the least busy runqueue.
- */
--static int find_idlest_cpu(struct task_struct *p, int this_cpu,
-+static vcpu_t find_idlest_cpu(struct task_struct *p, vcpu_t this_cpu,
- struct sched_domain *sd)
- {
- unsigned long load, min_load, this_load;
-- int i, min_cpu;
-- cpumask_t mask;
-+ int i;
-+ vcpu_t min_cpu;
-+ cpumask_t mask, vmask;
-+ struct vcpu_scheduler *vsched;
-
-- min_cpu = UINT_MAX;
-+ vsched = task_vsched(p);
-+ min_cpu = NULL;
- min_load = ULONG_MAX;
-
-- cpus_and(mask, sd->span, p->cpus_allowed);
-+ cpus_and(mask, sd->span, cpu_online_map);
-+ cpus_and(vmask, vsched_vcpu_online_map(vsched), p->cpus_allowed);
-
-- for_each_cpu_mask(i, mask) {
-- load = target_load(i);
-+ for_each_cpu_mask(i, vmask) {
-+ vcpu_t vcpu;
-+ vcpu = vsched_vcpu(vsched, i);
-+
-+ if (!cpu_isset(vcpu_last_pcpu(vcpu), mask))
-+ continue;
-+ if (vcpu_is_offline(vcpu))
-+ continue;
-
-+ load = target_load(vcpu);
- if (load < min_load) {
-- min_cpu = i;
-+ min_cpu = vcpu;
- min_load = load;
-
- /* break out early on an idle CPU: */
-@@ -1678,6 +2511,9 @@ static int find_idlest_cpu(struct task_s
- }
- }
-
-+ if (min_cpu == NULL)
-+ return this_cpu;
-+
- /* add +1 to account for the new task */
- this_load = source_load(this_cpu) + SCHED_LOAD_SCALE;
-
-@@ -1694,6 +2530,7 @@ static int find_idlest_cpu(struct task_s
-
- return this_cpu;
- }
-+#endif
-
- /*
- * If dest_cpu is allowed for this process, migrate the task to it.
-@@ -1701,15 +2538,15 @@ static int find_idlest_cpu(struct task_s
- * allow dest_cpu, which will force the cpu onto dest_cpu. Then
- * the cpu_allowed mask is restored.
- */
--static void sched_migrate_task(task_t *p, int dest_cpu)
-+static void sched_migrate_task(task_t *p, vcpu_t dest_cpu)
- {
- migration_req_t req;
- runqueue_t *rq;
- unsigned long flags;
-
- rq = task_rq_lock(p, &flags);
-- if (!cpu_isset(dest_cpu, p->cpus_allowed)
-- || unlikely(cpu_is_offline(dest_cpu)))
-+ if (unlikely(!vcpu_isset(dest_cpu, p->cpus_allowed)
-+ || vcpu_is_offline(dest_cpu)))
- goto out;
-
- schedstat_inc(rq, smt_cnt);
-@@ -1727,7 +2564,9 @@ static void sched_migrate_task(task_t *p
- out:
- task_rq_unlock(rq, &flags);
- }
-+#endif
-
-+#ifdef CONFIG_SMP
- /*
- * sched_exec(): find the highest-level, exec-balance-capable
- * domain and try to migrate the task to the least loaded CPU.
-@@ -1738,11 +2577,11 @@ out:
- void sched_exec(void)
- {
- struct sched_domain *tmp, *sd = NULL;
-- int new_cpu, this_cpu = get_cpu();
-+ vcpu_t new_cpu, this_cpu = get_vcpu();
-
- schedstat_inc(this_rq(), sbe_cnt);
- /* Prefer the current CPU if there's only this task running */
-- if (this_rq()->nr_running <= 1)
-+ if (vcpu_rq(this_cpu)->nr_running <= 1)
- goto out;
-
- for_each_domain(this_cpu, tmp)
-@@ -1760,7 +2599,7 @@ void sched_exec(void)
- }
- }
- out:
-- put_cpu();
-+ put_vcpu();
- }
-
- /*
-@@ -1769,11 +2608,25 @@ out:
- */
- static inline
- void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p,
-- runqueue_t *this_rq, prio_array_t *this_array, int this_cpu)
-+ runqueue_t *this_rq, prio_array_t *this_array, vcpu_t this_cpu)
- {
-+ struct ve_struct *ve;
-+ cycles_t cycles;
-+
-+ cycles = get_cycles();
-+ ve = VE_TASK_INFO(p)->owner_env;
-+
- dequeue_task(p, src_array);
- src_rq->nr_running--;
-- set_task_cpu(p, this_cpu);
-+ if (src_rq->nr_running == 0) {
-+ vcpu_detach(src_rq);
-+ vcpu_strt_ve_idle(ve, task_cpu(p), cycles);
-+ }
-+ set_task_vcpu(p, this_cpu);
-+ if (this_rq->nr_running == 0) {
-+ vcpu_save_ve_idle(ve, this_cpu, cycles);
-+ vcpu_attach(this_rq);
-+ }
- this_rq->nr_running++;
- enqueue_task(p, this_array);
- p->timestamp = (p->timestamp - src_rq->timestamp_last_tick)
-@@ -1790,7 +2643,7 @@ void pull_task(runqueue_t *src_rq, prio_
- * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
- */
- static inline
--int can_migrate_task(task_t *p, runqueue_t *rq, int this_cpu,
-+int can_migrate_task(task_t *p, runqueue_t *rq, vcpu_t this_cpu,
- struct sched_domain *sd, enum idle_type idle, int *all_pinned)
- {
- /*
-@@ -1801,7 +2654,7 @@ int can_migrate_task(task_t *p, runqueue
- */
- if (task_running(rq, p))
- return 0;
-- if (!cpu_isset(this_cpu, p->cpus_allowed))
-+ if (!vcpu_isset(this_cpu, p->cpus_allowed))
- return 0;
-
- *all_pinned = 0;
-@@ -1823,7 +2676,7 @@ int can_migrate_task(task_t *p, runqueue
- *
- * Called with both runqueues locked.
- */
--static int move_tasks(runqueue_t *this_rq, int this_cpu, runqueue_t *busiest,
-+static int move_tasks(runqueue_t *this_rq, vcpu_t this_cpu, runqueue_t *busiest,
- unsigned long max_nr_move, struct sched_domain *sd,
- enum idle_type idle, int *all_pinned)
- {
-@@ -1832,6 +2685,8 @@ static int move_tasks(runqueue_t *this_r
- int idx, pulled = 0, pinned = 0;
- task_t *tmp;
-
-+ if (vcpu_is_offline(this_cpu))
-+ goto out;
- if (max_nr_move <= 0 || busiest->nr_running <= 1)
- goto out;
-
-@@ -1913,12 +2768,18 @@ out:
- * moved to restore balance via the imbalance parameter.
- */
- static struct sched_group *
--find_busiest_group(struct sched_domain *sd, int this_cpu,
-+find_busiest_group(struct sched_domain *sd, vcpu_t this_cpu,
- unsigned long *imbalance, enum idle_type idle)
- {
- struct sched_group *busiest = NULL, *this = NULL, *group = sd->groups;
- unsigned long max_load, avg_load, total_load, this_load, total_pwr;
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+ cpumask_t tmp;
-+ int this_pcpu;
-
-+ vsched = vcpu_vsched(this_cpu);
-+ this_pcpu = vcpu_last_pcpu(this_cpu);
- max_load = this_load = total_load = total_pwr = 0;
-
- do {
-@@ -1926,17 +2787,19 @@ find_busiest_group(struct sched_domain *
- int local_group;
- int i, nr_cpus = 0;
-
-- local_group = cpu_isset(this_cpu, group->cpumask);
-+ local_group = cpu_isset(this_pcpu, group->cpumask);
-
- /* Tally up the load of all CPUs in the group */
- avg_load = 0;
-+ cpus_and(tmp, group->cpumask, vsched_pcpu_running_map(vsched));
-
-- for_each_cpu_mask(i, group->cpumask) {
-+ for_each_cpu_mask(i, tmp) {
-+ vcpu = pcpu(i)->vcpu;
- /* Bias balancing toward cpus of our domain */
- if (local_group)
-- load = target_load(i);
-+ load = target_load(vcpu);
- else
-- load = source_load(i);
-+ load = source_load(vcpu);
-
- nr_cpus++;
- avg_load += load;
-@@ -1965,6 +2828,8 @@ nextgroup:
-
- if (!busiest || this_load >= max_load)
- goto out_balanced;
-+ if (!this)
-+ this = busiest; /* this->cpu_power is needed below */
-
- avg_load = (SCHED_LOAD_SCALE * total_load) / total_pwr;
-
-@@ -2042,34 +2907,76 @@ out_balanced:
- /*
- * find_busiest_queue - find the busiest runqueue among the cpus in group.
- */
--static runqueue_t *find_busiest_queue(struct sched_group *group)
-+static vcpu_t find_busiest_queue(vcpu_t this_cpu,
-+ struct sched_group *group, enum idle_type idle)
- {
-+ cpumask_t tmp;
- unsigned long load, max_load = 0;
-- runqueue_t *busiest = NULL;
-+ vcpu_t vcpu;
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t busiest = NULL;
- int i;
-
-- for_each_cpu_mask(i, group->cpumask) {
-- load = source_load(i);
-+ vsched = vcpu_vsched(this_cpu);
-+ cpus_and(tmp, group->cpumask, cpu_online_map);
-+ for_each_cpu_mask(i, tmp) {
-+ vcpu = pcpu(i)->vcpu;
-+ if (vcpu_vsched(vcpu) != vsched && idle != IDLE)
-+ continue;
-+ if (vcpu_is_offline(vcpu))
-+ continue;
-+ load = source_load(vcpu);
-+ if (load > max_load) {
-+ max_load = load;
-+ busiest = vcpu;
-+ }
-+ }
-+
-+#ifdef CONFIG_SCHED_VCPU
-+ cpus_andnot(tmp, vsched->vcpu_online_map, vsched->vcpu_running_map);
-+ for_each_cpu_mask(i, tmp) {
-+ vcpu = vsched_vcpu(vsched, i);
-+ load = source_load(vcpu);
-
- if (load > max_load) {
- max_load = load;
-- busiest = cpu_rq(i);
-+ busiest = vcpu;
- }
- }
-+#endif
-
- return busiest;
- }
-
-+#ifdef CONFIG_SCHED_VCPU
-+vcpu_t find_idle_vcpu(struct vcpu_scheduler *vsched)
-+{
-+ vcpu_t vcpu;
-+
-+ vcpu = NULL;
-+ spin_lock(&fairsched_lock);
-+ if (!list_empty(&vsched->idle_list)) {
-+ vcpu = list_entry(vsched->idle_list.next,
-+ struct vcpu_info, list);
-+ if (unlikely(vcpu_is_offline(vcpu)))
-+ vcpu = NULL;
-+ }
-+ spin_unlock(&fairsched_lock);
-+ return vcpu;
-+}
-+#endif
-+
- /*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- *
- * Called with this_rq unlocked.
- */
--static int load_balance(int this_cpu, runqueue_t *this_rq,
-+static int load_balance(vcpu_t this_cpu, runqueue_t *this_rq,
- struct sched_domain *sd, enum idle_type idle)
- {
- struct sched_group *group;
-+ vcpu_t busiest_vcpu;
- runqueue_t *busiest;
- unsigned long imbalance;
- int nr_moved, all_pinned=0;
-@@ -2083,21 +2990,37 @@ static int load_balance(int this_cpu, ru
- goto out_balanced;
- }
-
-- busiest = find_busiest_queue(group);
-- if (!busiest) {
-+ busiest_vcpu = find_busiest_queue(this_cpu, group, idle);
-+ if (!busiest_vcpu) {
- schedstat_inc(sd, lb_nobusyq[idle]);
- goto out_balanced;
- }
-
-+#ifdef CONFIG_SCHED_VCPU
-+ if (vcpu_vsched(this_cpu) != vcpu_vsched(busiest_vcpu)) {
-+ spin_unlock(&this_rq->lock);
-+ this_cpu = find_idle_vcpu(vcpu_vsched(busiest_vcpu));
-+ if (!this_cpu)
-+ goto out_tune;
-+ this_rq = vcpu_rq(this_cpu);
-+ spin_lock(&this_rq->lock);
-+ /*
-+ * The check below is not mandatory, the lock may
-+ * be dropped below in double_lock_balance.
-+ */
-+ if (this_rq->nr_running)
-+ goto out_balanced;
-+ }
-+#endif
-+ busiest = vcpu_rq(busiest_vcpu);
-+
- /*
- * This should be "impossible", but since load
- * balancing is inherently racy and statistical,
- * it could happen in theory.
- */
-- if (unlikely(busiest == this_rq)) {
-- WARN_ON(1);
-+ if (unlikely(busiest == this_rq))
- goto out_balanced;
-- }
-
- schedstat_add(sd, lb_imbalance[idle], imbalance);
-
-@@ -2156,6 +3079,7 @@ static int load_balance(int this_cpu, ru
- out_balanced:
- spin_unlock(&this_rq->lock);
-
-+out_tune:
- sd->nr_balance_failed = 0;
- /* tune up the balancing interval */
- if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
-@@ -2171,11 +3095,12 @@ out_balanced:
- * Called from schedule when this_rq is about to become idle (NEWLY_IDLE).
- * this_rq is locked.
- */
--static int load_balance_newidle(int this_cpu, runqueue_t *this_rq,
-+static int load_balance_newidle(vcpu_t this_cpu, runqueue_t *this_rq,
- struct sched_domain *sd)
- {
- struct sched_group *group;
-- runqueue_t *busiest = NULL;
-+ vcpu_t busiest_vcpu;
-+ runqueue_t *busiest;
- unsigned long imbalance;
- int nr_moved = 0;
-
-@@ -2186,11 +3111,12 @@ static int load_balance_newidle(int this
- goto out_balanced;
- }
-
-- busiest = find_busiest_queue(group);
-- if (!busiest || busiest == this_rq) {
-+ busiest_vcpu = find_busiest_queue(this_cpu, group, NEWLY_IDLE);
-+ if (!busiest_vcpu || busiest_vcpu == this_cpu) {
- schedstat_inc(sd, lb_nobusyq[NEWLY_IDLE]);
- goto out_balanced;
- }
-+ busiest = vcpu_rq(busiest_vcpu);
-
- /* Attempt to move tasks */
- double_lock_balance(this_rq, busiest);
-@@ -2215,19 +3141,22 @@ out_balanced:
- /*
- * idle_balance is called by schedule() if this_cpu is about to become
- * idle. Attempts to pull tasks from other CPUs.
-+ *
-+ * Returns whether to continue with another runqueue
-+ * instead of switching to idle.
- */
--static inline void idle_balance(int this_cpu, runqueue_t *this_rq)
-+static int idle_balance(vcpu_t this_cpu, runqueue_t *this_rq)
- {
- struct sched_domain *sd;
-
- for_each_domain(this_cpu, sd) {
- if (sd->flags & SD_BALANCE_NEWIDLE) {
-- if (load_balance_newidle(this_cpu, this_rq, sd)) {
-+ if (load_balance_newidle(this_cpu, this_rq, sd))
- /* We've pulled tasks over so stop searching */
-- break;
-- }
-+ return 1;
- }
- }
-+ return 0;
- }
-
- /*
-@@ -2237,18 +3166,28 @@ static inline void idle_balance(int this
- * logical imbalance.
- *
- * Called with busiest locked.
-+ *
-+ * In human terms: balancing of CPU load by moving tasks between CPUs is
-+ * performed by 2 methods, push and pull.
-+ * In certain places when CPU is found to be idle, it performs pull from busy
-+ * CPU to current (idle) CPU.
-+ * active_load_balance implements push method, with migration thread getting
-+ * scheduled on a busy CPU (hence, making all running processes on this CPU sit
-+ * in the queue) and selecting where to push and which task.
- */
--static void active_load_balance(runqueue_t *busiest, int busiest_cpu)
-+static void active_load_balance(runqueue_t *busiest, vcpu_t busiest_cpu)
- {
- struct sched_domain *sd;
- runqueue_t *target_rq;
-- int target_cpu = busiest->push_cpu;
-+ vcpu_t target_cpu = busiest->push_cpu;
-+ struct vcpu_scheduler *vsched;
-+ int i;
-
- schedstat_inc(busiest, alb_cnt);
- if (busiest->nr_running <= 1)
- return;
-
-- target_rq = cpu_rq(target_cpu);
-+ target_rq = vcpu_rq(target_cpu);
-
- /*
- * This condition is "impossible", but since load
-@@ -2261,11 +3200,13 @@ static void active_load_balance(runqueue
- double_lock_balance(busiest, target_rq);
-
- for_each_domain(target_cpu, sd)
-- if (cpu_isset(busiest_cpu, sd->span))
-+ if (cpu_isset(vcpu_last_pcpu(busiest_cpu), sd->span))
- break;
-
-- if (unlikely(sd == NULL))
-- goto out;
-+ if (unlikely(sd == NULL)) {
-+ spin_unlock(&target_rq->lock);
-+ return;
-+ }
-
- if (move_tasks(target_rq, target_cpu, busiest, 1, sd, IDLE, NULL)) {
- schedstat_inc(busiest, alb_lost);
-@@ -2273,8 +3214,30 @@ static void active_load_balance(runqueue
- } else {
- schedstat_inc(busiest, alb_failed);
- }
--out:
- spin_unlock(&target_rq->lock);
-+
-+#ifdef CONFIG_SCHED_VCPU
-+ vsched = vcpu_vsched(busiest_cpu);
-+ if (busiest->nr_running > 2) { /* 1 for migration thread, 1 for task */
-+ cpumask_t tmp;
-+ runqueue_t *rq;
-+ vcpu_t vcpu;
-+
-+ cpus_andnot(tmp, vsched->vcpu_online_map,
-+ vsched->vcpu_running_map);
-+ for_each_cpu_mask(i, tmp) {
-+ vcpu = vsched_vcpu(vsched, i);
-+ if (!idle_vcpu(vcpu))
-+ continue;
-+ rq = vcpu_rq(vcpu);
-+ double_lock_balance(busiest, rq);
-+ move_tasks(rq, vcpu, busiest, 1, sd, IDLE, NULL);
-+ spin_unlock(&rq->lock);
-+ if (busiest->nr_running <= 2)
-+ break;
-+ }
-+ }
-+#endif
- }
-
- /*
-@@ -2287,27 +3250,18 @@ out:
- */
-
- /* Don't have all balancing operations going off at once */
--#define CPU_OFFSET(cpu) (HZ * cpu / NR_CPUS)
-+#define CPU_OFFSET(cpu) (HZ * (cpu) / NR_CPUS)
-
--static void rebalance_tick(int this_cpu, runqueue_t *this_rq,
-+static void rebalance_tick(vcpu_t this_cpu, runqueue_t *this_rq,
- enum idle_type idle)
- {
-- unsigned long old_load, this_load;
-- unsigned long j = jiffies + CPU_OFFSET(this_cpu);
-+ unsigned long j;
- struct sched_domain *sd;
-
- /* Update our load */
-- old_load = this_rq->cpu_load;
-- this_load = this_rq->nr_running * SCHED_LOAD_SCALE;
-- /*
-- * Round up the averaging division if load is increasing. This
-- * prevents us from getting stuck on 9 if the load is 10, for
-- * example.
-- */
-- if (this_load > old_load)
-- old_load++;
-- this_rq->cpu_load = (old_load + this_load) / 2;
-+ update_rq_cpu_load(this_rq);
-
-+ j = jiffies + CPU_OFFSET(smp_processor_id());
- for_each_domain(this_cpu, sd) {
- unsigned long interval = sd->balance_interval;
-
-@@ -2318,7 +3272,6 @@ static void rebalance_tick(int this_cpu,
- interval = msecs_to_jiffies(interval);
- if (unlikely(!interval))
- interval = 1;
--
- if (j - sd->last_balance >= interval) {
- if (load_balance(this_cpu, this_rq, sd, idle)) {
- /* We've pulled tasks over so no longer idle */
-@@ -2332,17 +3285,19 @@ static void rebalance_tick(int this_cpu,
- /*
- * on UP we do not need to balance between CPUs:
- */
--static inline void rebalance_tick(int cpu, runqueue_t *rq, enum idle_type idle)
-+static inline void rebalance_tick(vcpu_t cpu, runqueue_t *rq, enum idle_type idle)
- {
- }
--static inline void idle_balance(int cpu, runqueue_t *rq)
-+static inline void idle_balance(vcpu_t cpu, runqueue_t *rq)
- {
- }
- #endif
-
--static inline int wake_priority_sleeper(runqueue_t *rq)
-+static inline int wake_priority_sleeper(runqueue_t *rq, task_t *idle)
- {
- int ret = 0;
-+#ifndef CONFIG_SCHED_VCPU
-+ /* FIXME: can we implement SMT priority sleeping for this? */
- #ifdef CONFIG_SCHED_SMT
- spin_lock(&rq->lock);
- /*
-@@ -2350,11 +3305,12 @@ static inline int wake_priority_sleeper(
- * reasons reschedule the idle task to see if it can now run.
- */
- if (rq->nr_running) {
-- resched_task(rq->idle);
-+ resched_task(idle);
- ret = 1;
- }
- spin_unlock(&rq->lock);
- #endif
-+#endif
- return ret;
- }
-
-@@ -2378,6 +3334,25 @@ EXPORT_PER_CPU_SYMBOL(kstat);
- STARVATION_LIMIT * ((rq)->nr_running) + 1))) || \
- ((rq)->curr->static_prio > (rq)->best_expired_prio))
-
-+#ifdef CONFIG_VE
-+#define update_ve_nice(p, tick) do { \
-+ VE_CPU_STATS(VE_TASK_INFO(p)->owner_env, \
-+ task_cpu(p))->nice += tick; \
-+ } while (0)
-+#define update_ve_user(p, tick) do { \
-+ VE_CPU_STATS(VE_TASK_INFO(p)->owner_env, \
-+ task_cpu(p))->user += tick; \
-+ } while (0)
-+#define update_ve_system(p, tick) do { \
-+ VE_CPU_STATS(VE_TASK_INFO(p)->owner_env, \
-+ task_cpu(p))->system += tick; \
-+ } while (0)
-+#else
-+#define update_ve_nice(p, tick) do { } while (0)
-+#define update_ve_user(p, tick) do { } while (0)
-+#define update_ve_system(p, tick) do { } while (0)
-+#endif
-+
- /*
- * This function gets called by the timer code, with HZ frequency.
- * We call it with interrupts disabled.
-@@ -2388,12 +3363,17 @@ EXPORT_PER_CPU_SYMBOL(kstat);
- void scheduler_tick(int user_ticks, int sys_ticks)
- {
- int cpu = smp_processor_id();
-+ vcpu_t vcpu;
- struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
-- runqueue_t *rq = this_rq();
-+ runqueue_t *rq;
- task_t *p = current;
-
-+ vcpu = this_vcpu();
-+ rq = vcpu_rq(vcpu);
- rq->timestamp_last_tick = sched_clock();
-
-+ set_tsk_need_resched(p); //FIXME
-+
- if (rcu_pending(cpu))
- rcu_check_callbacks(cpu, user_ticks);
-
-@@ -2405,22 +3385,25 @@ void scheduler_tick(int user_ticks, int
- cpustat->softirq += sys_ticks;
- sys_ticks = 0;
- }
--
-- if (p == rq->idle) {
-- if (atomic_read(&rq->nr_iowait) > 0)
-+ if (p == pcpu(cpu)->idle) {
-+ if (atomic_read(&glob_tasks_nrs[cpu].nr_iowait) > 0)
- cpustat->iowait += sys_ticks;
- else
- cpustat->idle += sys_ticks;
-- if (wake_priority_sleeper(rq))
-+ if (wake_priority_sleeper(rq, pcpu(cpu)->idle))
- goto out;
-- rebalance_tick(cpu, rq, IDLE);
-+ rebalance_tick(vcpu, rq, IDLE);
- return;
- }
-- if (TASK_NICE(p) > 0)
-+ if (TASK_NICE(p) > 0) {
- cpustat->nice += user_ticks;
-- else
-+ update_ve_nice(p, user_ticks);
-+ } else {
- cpustat->user += user_ticks;
-+ update_ve_user(p, user_ticks);
-+ }
- cpustat->system += sys_ticks;
-+ update_ve_system(p, sys_ticks);
-
- /* Task might have expired already, but not scheduled off yet */
- if (p->array != rq->active) {
-@@ -2483,9 +3466,12 @@ void scheduler_tick(int user_ticks, int
- * This only applies to tasks in the interactive
- * delta range with at least TIMESLICE_GRANULARITY to requeue.
- */
-+ unsigned long ts_gran;
-+
-+ ts_gran = TIMESLICE_GRANULARITY(p);
- if (TASK_INTERACTIVE(p) && !((task_timeslice(p) -
-- p->time_slice) % TIMESLICE_GRANULARITY(p)) &&
-- (p->time_slice >= TIMESLICE_GRANULARITY(p)) &&
-+ p->time_slice) % ts_gran) &&
-+ (p->time_slice >= ts_gran) &&
- (p->array == rq->active)) {
-
- dequeue_task(p, rq->active);
-@@ -2497,11 +3483,12 @@ void scheduler_tick(int user_ticks, int
- out_unlock:
- spin_unlock(&rq->lock);
- out:
-- rebalance_tick(cpu, rq, NOT_IDLE);
-+ rebalance_tick(vcpu, rq, NOT_IDLE);
- }
-
--#ifdef CONFIG_SCHED_SMT
--static inline void wake_sleeping_dependent(int this_cpu, runqueue_t *this_rq)
-+#if defined(CONFIG_SCHED_SMT) && !defined(CONFIG_SCHED_VCPU)
-+/* FIXME: SMT scheduling */
-+static void wake_sleeping_dependent(vcpu_t this_cpu, runqueue_t *this_rq)
- {
- struct sched_domain *sd = this_rq->sd;
- cpumask_t sibling_map;
-@@ -2528,14 +3515,15 @@ static inline void wake_sleeping_depende
- cpu_clear(this_cpu, sibling_map);
-
- for_each_cpu_mask(i, sibling_map) {
-- runqueue_t *smt_rq = cpu_rq(i);
-+ runqueue_t *smt_rq;
-+ smt_rq = vcpu_rq(vcpu(i));
-
- /*
- * If an SMT sibling task is sleeping due to priority
- * reasons wake it up now.
- */
-- if (smt_rq->curr == smt_rq->idle && smt_rq->nr_running)
-- resched_task(smt_rq->idle);
-+ if (smt_rq->curr == pcpu(i)->idle && smt_rq->nr_running)
-+ resched_task(pcpu(i)->idle);
- }
-
- for_each_cpu_mask(i, sibling_map)
-@@ -2546,7 +3534,7 @@ static inline void wake_sleeping_depende
- */
- }
-
--static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq)
-+static int dependent_sleeper(vcpu_t cpu, runqueue_t *rq)
- {
- struct sched_domain *sd = this_rq->sd;
- cpumask_t sibling_map;
-@@ -2564,7 +3552,7 @@ static inline int dependent_sleeper(int
- spin_unlock(&this_rq->lock);
- sibling_map = sd->span;
- for_each_cpu_mask(i, sibling_map)
-- spin_lock(&cpu_rq(i)->lock);
-+ spin_lock(&vcpu_rq(vcpu(i))->lock);
- cpu_clear(this_cpu, sibling_map);
-
- /*
-@@ -2606,7 +3594,7 @@ static inline int dependent_sleeper(int
- if ((((p->time_slice * (100 - sd->per_cpu_gain) / 100) >
- task_timeslice(smt_curr) || rt_task(p)) &&
- smt_curr->mm && p->mm && !rt_task(smt_curr)) ||
-- (smt_curr == smt_rq->idle && smt_rq->nr_running))
-+ (smt_curr == pcpu(i)->idle && smt_rq->nr_running))
- resched_task(smt_curr);
- }
- out_unlock:
-@@ -2615,16 +3603,34 @@ out_unlock:
- return ret;
- }
- #else
--static inline void wake_sleeping_dependent(int this_cpu, runqueue_t *this_rq)
-+static inline void wake_sleeping_dependent(vcpu_t this_cpu, runqueue_t *this_rq)
- {
- }
-
--static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq)
-+static inline int dependent_sleeper(vcpu_t this_cpu, runqueue_t *this_rq)
- {
- return 0;
- }
- #endif
-
-+static void update_sched_lat(struct task_struct *t, cycles_t cycles)
-+{
-+ int cpu;
-+ cycles_t ve_wstamp;
-+
-+ /* safe due to runqueue lock */
-+ ve_wstamp = VE_TASK_INFO(t)->wakeup_stamp;
-+ cpu = smp_processor_id();
-+ if (ve_wstamp && cycles > ve_wstamp) {
-+ KSTAT_LAT_PCPU_ADD(&kstat_glob.sched_lat,
-+ cpu, cycles - ve_wstamp);
-+#ifdef CONFIG_VE
-+ KSTAT_LAT_PCPU_ADD(&VE_TASK_INFO(t)->exec_env->sched_lat_ve,
-+ cpu, cycles - ve_wstamp);
-+#endif
-+ }
-+}
-+
- /*
- * schedule() is the main scheduler function.
- */
-@@ -2637,7 +3643,9 @@ asmlinkage void __sched schedule(void)
- struct list_head *queue;
- unsigned long long now;
- unsigned long run_time;
-- int cpu, idx;
-+ int idx;
-+ vcpu_t vcpu;
-+ cycles_t cycles;
-
- //WARN_ON(system_state == SYSTEM_BOOTING);
- /*
-@@ -2651,8 +3659,8 @@ asmlinkage void __sched schedule(void)
- dump_stack();
- }
- }
--
- need_resched:
-+ cycles = get_cycles();
- preempt_disable();
- prev = current;
- rq = this_rq();
-@@ -2661,7 +3669,7 @@ need_resched:
- * The idle thread is not allowed to schedule!
- * Remove this check after it has been exercised a bit.
- */
-- if (unlikely(current == rq->idle) && current->state != TASK_RUNNING) {
-+ if (unlikely(current == this_pcpu()->idle) && current->state != TASK_RUNNING) {
- printk(KERN_ERR "bad: scheduling from the idle thread!\n");
- dump_stack();
- }
-@@ -2669,9 +3677,11 @@ need_resched:
- release_kernel_lock(prev);
- schedstat_inc(rq, sched_cnt);
- now = sched_clock();
-- if (likely(now - prev->timestamp < NS_MAX_SLEEP_AVG))
-+ if (likely((long long)(now - prev->timestamp) < NS_MAX_SLEEP_AVG)) {
- run_time = now - prev->timestamp;
-- else
-+ if (unlikely((long long)(now - prev->timestamp) < 0))
-+ run_time = 0;
-+ } else
- run_time = NS_MAX_SLEEP_AVG;
-
- /*
-@@ -2693,33 +3703,48 @@ need_resched:
- switch_count = &prev->nivcsw;
- if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
- switch_count = &prev->nvcsw;
-- if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
-- unlikely(signal_pending(prev))))
-+ if (unlikely(((prev->state & TASK_INTERRUPTIBLE) &&
-+ unlikely(signal_pending(prev))) ||
-+ ((prev->state & TASK_STOPPED) &&
-+ sigismember(&prev->pending.signal, SIGKILL))))
- prev->state = TASK_RUNNING;
- else
- deactivate_task(prev, rq);
- }
-
-- cpu = smp_processor_id();
-+ prev->sleep_avg -= run_time;
-+ if ((long)prev->sleep_avg <= 0) {
-+ prev->sleep_avg = 0;
-+ if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev)))
-+ prev->interactive_credit--;
-+ }
-+
-+ vcpu = rq_vcpu(rq);
-+ if (rq->nr_running &&
-+ jiffies - vcpu->start_time < msecs_to_jiffies(vcpu_timeslice))
-+ goto same_vcpu;
-+
-+ if (unlikely(!rq->nr_running))
-+ idle_balance(vcpu, rq);
-+ vcpu = schedule_vcpu(vcpu, cycles);
-+ rq = vcpu_rq(vcpu);
-+
- if (unlikely(!rq->nr_running)) {
- go_idle:
-- idle_balance(cpu, rq);
-- if (!rq->nr_running) {
-- next = rq->idle;
-- rq->expired_timestamp = 0;
-- wake_sleeping_dependent(cpu, rq);
-- /*
-- * wake_sleeping_dependent() might have released
-- * the runqueue, so break out if we got new
-- * tasks meanwhile:
-- */
-- if (!rq->nr_running)
-- goto switch_tasks;
-- }
-+ next = this_pcpu()->idle;
-+ rq->expired_timestamp = 0;
-+ wake_sleeping_dependent(vcpu, rq);
-+ /*
-+ * wake_sleeping_dependent() might have released
-+ * the runqueue, so break out if we got new
-+ * tasks meanwhile:
-+ */
-+ if (!rq->nr_running)
-+ goto switch_tasks;
- } else {
-- if (dependent_sleeper(cpu, rq)) {
-+ if (dependent_sleeper(vcpu, rq)) {
-+ next = this_pcpu()->idle;
- schedstat_inc(rq, sched_goidle);
-- next = rq->idle;
- goto switch_tasks;
- }
- /*
-@@ -2731,6 +3756,7 @@ go_idle:
- goto go_idle;
- }
-
-+same_vcpu:
- array = rq->active;
- if (unlikely(!array->nr_active)) {
- /*
-@@ -2751,6 +3777,8 @@ go_idle:
-
- if (!rt_task(next) && next->activated > 0) {
- unsigned long long delta = now - next->timestamp;
-+ if (unlikely((long long)delta < 0))
-+ delta = 0;
-
- if (next->activated == 1)
- delta = delta * (ON_RUNQUEUE_WEIGHT * 128 / 100) / 128;
-@@ -2764,30 +3792,63 @@ go_idle:
- switch_tasks:
- prefetch(next);
- clear_tsk_need_resched(prev);
-- rcu_qsctr_inc(task_cpu(prev));
-+ rcu_qsctr_inc(task_pcpu(prev));
-
-- prev->sleep_avg -= run_time;
-- if ((long)prev->sleep_avg <= 0) {
-- prev->sleep_avg = 0;
-- if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev)))
-- prev->interactive_credit--;
-- }
-+ /* updated w/o rq->lock, which is ok due to after-read-checks */
- prev->timestamp = prev->last_ran = now;
-
- sched_info_switch(prev, next);
- if (likely(prev != next)) {
-+ /* current physical CPU id should be valid after switch */
-+ set_task_vcpu(next, vcpu);
-+ set_task_pcpu(next, task_pcpu(prev));
-+
- next->timestamp = now;
- rq->nr_switches++;
-+ glob_tasks_nrs[smp_processor_id()].nr_switches++;
- rq->curr = next;
- ++*switch_count;
-
-+ VE_TASK_INFO(prev)->sleep_stamp = cycles;
-+ if (prev->state == TASK_RUNNING && prev != this_pcpu()->idle)
-+ write_wakeup_stamp(prev, cycles);
-+ update_sched_lat(next, cycles);
-+
-+ /* because next & prev are protected with
-+ * runqueue lock we may not worry about
-+ * wakeup_stamp and sched_time protection
-+ * (same thing in 'else' branch below)
-+ */
-+ if (prev != this_pcpu()->idle) {
-+#ifdef CONFIG_VE
-+ VE_CPU_STATS(VE_TASK_INFO(prev)->owner_env,
-+ smp_processor_id())->used_time +=
-+ cycles - VE_TASK_INFO(prev)->sched_time;
-+#endif
-+ VE_TASK_INFO(prev)->sched_time = 0;
-+ }
-+ VE_TASK_INFO(next)->sched_time = cycles;
-+ write_wakeup_stamp(next, 0);
-+
- prepare_arch_switch(rq, next);
- prev = context_switch(rq, prev, next);
- barrier();
-
- finish_task_switch(prev);
-- } else
-+ } else {
-+ if (prev != this_pcpu()->idle) {
-+ cycles_t cycles;
-+
-+ cycles = get_cycles();
-+#ifdef CONFIG_VE
-+ VE_CPU_STATS(VE_TASK_INFO(prev)->owner_env,
-+ smp_processor_id())->used_time +=
-+ cycles - VE_TASK_INFO(prev)->sched_time;
-+#endif
-+ VE_TASK_INFO(prev)->sched_time = cycles;
-+ }
- spin_unlock_irq(&rq->lock);
-+ }
-
- reacquire_kernel_lock(current);
- preempt_enable_no_resched();
-@@ -3079,6 +4140,9 @@ EXPORT_SYMBOL(wait_for_completion_interr
- __remove_wait_queue(q, &wait); \
- spin_unlock_irqrestore(&q->lock, flags);
-
-+#ifdef CONFIG_VE
-+#define SLEEP_ON_BKLCHECK
-+#else
- #define SLEEP_ON_BKLCHECK \
- if (unlikely(!kernel_locked()) && \
- sleep_on_bkl_warnings < 10) { \
-@@ -3087,6 +4151,7 @@ EXPORT_SYMBOL(wait_for_completion_interr
- }
-
- static int sleep_on_bkl_warnings;
-+#endif
-
- void fastcall __sched interruptible_sleep_on(wait_queue_head_t *q)
- {
-@@ -3253,23 +4318,12 @@ int task_nice(const task_t *p)
- }
-
- /**
-- * idle_cpu - is a given cpu idle currently?
-- * @cpu: the processor in question.
-- */
--int idle_cpu(int cpu)
--{
-- return cpu_curr(cpu) == cpu_rq(cpu)->idle;
--}
--
--EXPORT_SYMBOL_GPL(idle_cpu);
--
--/**
- * find_process_by_pid - find a process with a matching PID value.
- * @pid: the pid in question.
- */
- static inline task_t *find_process_by_pid(pid_t pid)
- {
-- return pid ? find_task_by_pid(pid) : current;
-+ return pid ? find_task_by_pid_ve(pid) : current;
- }
-
- /* Actually do priority change: must hold rq lock. */
-@@ -3287,7 +4341,7 @@ static void __setscheduler(struct task_s
- /*
- * setscheduler - change the scheduling policy and/or RT priority of a thread.
- */
--static int setscheduler(pid_t pid, int policy, struct sched_param __user *param)
-+int setscheduler(pid_t pid, int policy, struct sched_param __user *param)
- {
- struct sched_param lp;
- int retval = -EINVAL;
-@@ -3338,7 +4392,7 @@ recheck:
-
- retval = -EPERM;
- if ((policy == SCHED_FIFO || policy == SCHED_RR) &&
-- !capable(CAP_SYS_NICE))
-+ !capable(CAP_SYS_ADMIN))
- goto out_unlock;
- if ((current->euid != p->euid) && (current->euid != p->uid) &&
- !capable(CAP_SYS_NICE))
-@@ -3384,6 +4438,7 @@ out_unlock:
- out_nounlock:
- return retval;
- }
-+EXPORT_SYMBOL(setscheduler);
-
- /**
- * sys_sched_setscheduler - set/change the scheduler policy and RT priority
-@@ -3706,9 +4761,13 @@ EXPORT_SYMBOL(yield);
- void __sched io_schedule(void)
- {
- struct runqueue *rq = this_rq();
-+ int cpu;
-
-+ cpu = smp_processor_id();
- atomic_inc(&rq->nr_iowait);
-+ nr_iowait_inc(cpu);
- schedule();
-+ nr_iowait_dec(cpu);
- atomic_dec(&rq->nr_iowait);
- }
-
-@@ -3718,9 +4777,13 @@ long __sched io_schedule_timeout(long ti
- {
- struct runqueue *rq = this_rq();
- long ret;
-+ int cpu;
-
-+ cpu = smp_processor_id();
- atomic_inc(&rq->nr_iowait);
-+ nr_iowait_inc(cpu);
- ret = schedule_timeout(timeout);
-+ nr_iowait_dec(cpu);
- atomic_dec(&rq->nr_iowait);
- return ret;
- }
-@@ -3840,16 +4903,13 @@ static void show_task(task_t * p)
- printk(stat_nam[state]);
- else
- printk("?");
-+ if (state)
-+ printk(" %012Lx", (unsigned long long)
-+ (VE_TASK_INFO(p)->sleep_stamp >> 16));
- #if (BITS_PER_LONG == 32)
-- if (state == TASK_RUNNING)
-- printk(" running ");
-- else
-- printk(" %08lX ", thread_saved_pc(p));
-+ printk(" %08lX ", (unsigned long)p);
- #else
-- if (state == TASK_RUNNING)
-- printk(" running task ");
-- else
-- printk(" %016lx ", thread_saved_pc(p));
-+ printk(" %016lx ", (unsigned long)p);
- #endif
- #ifdef CONFIG_DEBUG_STACK_USAGE
- {
-@@ -3888,42 +4948,82 @@ void show_state(void)
- #if (BITS_PER_LONG == 32)
- printk("\n"
- " sibling\n");
-- printk(" task PC pid father child younger older\n");
-+ printk(" task taskaddr pid father child younger older\n");
- #else
- printk("\n"
- " sibling\n");
-- printk(" task PC pid father child younger older\n");
-+ printk(" task taskaddr pid father child younger older\n");
- #endif
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_all(g, p) {
- /*
- * reset the NMI-timeout, listing all files on a slow
- * console might take alot of time:
- */
- touch_nmi_watchdog();
- show_task(p);
-- } while_each_thread(g, p);
-+ } while_each_thread_all(g, p);
-
- read_unlock(&tasklist_lock);
- }
-
- EXPORT_SYMBOL_GPL(show_state);
-
-+static void init_rq(struct runqueue *rq);
-+
-+static void init_vcpu(vcpu_t vcpu, int id)
-+{
-+ memset(vcpu, 0, sizeof(struct vcpu_info));
-+ vcpu->id = id;
-+#ifdef CONFIG_SCHED_VCPU
-+ vcpu->last_pcpu = id;
-+#endif
-+ init_rq(vcpu_rq(vcpu));
-+}
-+
- void __devinit init_idle(task_t *idle, int cpu)
- {
-- runqueue_t *rq = cpu_rq(cpu);
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+ runqueue_t *rq;
- unsigned long flags;
-
-+#ifdef CONFIG_SCHED_VCPU
-+ if (cpu > 0 && __add_vcpu(&idle_vsched, cpu) != 0)
-+ panic("Can't create idle vcpu %d\n", cpu);
-+
-+ cpu_set(cpu, idle_vsched.pcpu_running_map);
-+#endif
-+ vsched = &idle_vsched;
-+ vcpu = vsched_vcpu(vsched, cpu);
-+ rq = vcpu_rq(vcpu);
-+
- idle->sleep_avg = 0;
- idle->interactive_credit = 0;
- idle->array = NULL;
- idle->prio = MAX_PRIO;
- idle->state = TASK_RUNNING;
-+ set_task_vsched(idle, &idle_vsched);
- set_task_cpu(idle, cpu);
-
- spin_lock_irqsave(&rq->lock, flags);
-- rq->curr = rq->idle = idle;
-+ pcpu(cpu)->idle = idle;
-+ rq->curr = idle;
- set_tsk_need_resched(idle);
-+ set_task_pcpu(idle, cpu);
-+ set_task_vsched(idle, vsched);
-+ set_task_vcpu(idle, vcpu);
-+#ifdef CONFIG_SCHED_VCPU
-+ /* the following code is very close to vcpu_get */
-+ spin_lock(&fairsched_lock);
-+ pcpu(cpu)->vcpu = vcpu;
-+ pcpu(cpu)->vsched = vcpu->vsched;
-+ list_move_tail(&vcpu->list, &vsched->running_list);
-+ __set_bit(cpu, vsched->vcpu_running_map.bits);
-+ __set_bit(cpu, vsched->pcpu_running_map.bits);
-+ vcpu->running = 1;
-+ spin_unlock(&fairsched_lock);
-+#endif
- spin_unlock_irqrestore(&rq->lock, flags);
-
- /* Set the preempt count _outside_ the spinlocks! */
-@@ -3943,7 +5043,7 @@ void __devinit init_idle(task_t *idle, i
- */
- cpumask_t nohz_cpu_mask = CPU_MASK_NONE;
-
--#ifdef CONFIG_SMP
-+#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_VCPU)
- /*
- * This is how migration works:
- *
-@@ -3969,15 +5069,18 @@ cpumask_t nohz_cpu_mask = CPU_MASK_NONE;
- * task must not exit() & deallocate itself prematurely. The
- * call is not atomic; no spinlocks may be held.
- */
-+#ifdef CONFIG_SMP
- int set_cpus_allowed(task_t *p, cpumask_t new_mask)
- {
- unsigned long flags;
- int ret = 0;
- migration_req_t req;
- runqueue_t *rq;
-+ struct vcpu_scheduler *vsched;
-
- rq = task_rq_lock(p, &flags);
-- if (!cpus_intersects(new_mask, cpu_online_map)) {
-+ vsched = task_vsched(p);
-+ if (!cpus_intersects(new_mask, vsched_vcpu_online_map(vsched))) {
- ret = -EINVAL;
- goto out;
- }
-@@ -3987,7 +5090,8 @@ int set_cpus_allowed(task_t *p, cpumask_
- if (cpu_isset(task_cpu(p), new_mask))
- goto out;
-
-- if (migrate_task(p, any_online_cpu(new_mask), &req)) {
-+ if (migrate_task(p, vsched_vcpu(vsched, any_online_cpu(new_mask)),
-+ &req)) {
- /* Need help from migration thread: drop lock and wait. */
- task_rq_unlock(rq, &flags);
- wake_up_process(rq->migration_thread);
-@@ -4001,6 +5105,7 @@ out:
- }
-
- EXPORT_SYMBOL_GPL(set_cpus_allowed);
-+#endif
-
- /*
- * Move (not current) task off this cpu, onto dest cpu. We're doing
-@@ -4011,25 +5116,31 @@ EXPORT_SYMBOL_GPL(set_cpus_allowed);
- * So we race with normal scheduler movements, but that's OK, as long
- * as the task is no longer on this CPU.
- */
--static void __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
-+static int __migrate_task(struct task_struct *p, vcpu_t src_cpu, vcpu_t dest_cpu)
- {
- runqueue_t *rq_dest, *rq_src;
-+ int res = 0;
-
-- if (unlikely(cpu_is_offline(dest_cpu)))
-- return;
-+ if (unlikely(vcpu_is_offline(dest_cpu)))
-+ return 0;
-
-- rq_src = cpu_rq(src_cpu);
-- rq_dest = cpu_rq(dest_cpu);
-+#ifdef CONFIG_SCHED_VCPU
-+ BUG_ON(vcpu_vsched(src_cpu) == &idle_vsched);
-+#endif
-+ rq_src = vcpu_rq(src_cpu);
-+ rq_dest = vcpu_rq(dest_cpu);
-
- double_rq_lock(rq_src, rq_dest);
- /* Already moved. */
-- if (task_cpu(p) != src_cpu)
-+ if (task_vcpu(p) != src_cpu)
- goto out;
- /* Affinity changed (again). */
-- if (!cpu_isset(dest_cpu, p->cpus_allowed))
-+ if (!vcpu_isset(dest_cpu, p->cpus_allowed))
- goto out;
-
-- set_task_cpu(p, dest_cpu);
-+ BUG_ON(task_running(rq_src, p));
-+ set_task_vsched(p, vcpu_vsched(dest_cpu));
-+ set_task_vcpu(p, dest_cpu);
- if (p->array) {
- /*
- * Sync timestamp with rq_dest's before activating.
-@@ -4044,9 +5155,11 @@ static void __migrate_task(struct task_s
- if (TASK_PREEMPTS_CURR(p, rq_dest))
- resched_task(rq_dest->curr);
- }
-+ res = 1;
-
- out:
- double_rq_unlock(rq_src, rq_dest);
-+ return res;
- }
-
- /*
-@@ -4054,12 +5167,14 @@ out:
- * thread migration by bumping thread off CPU then 'pushing' onto
- * another runqueue.
- */
-+static void migrate_live_tasks(vcpu_t src_cpu);
-+static void migrate_dead_tasks(vcpu_t dead_cpu);
- static int migration_thread(void * data)
- {
- runqueue_t *rq;
-- int cpu = (long)data;
-+ vcpu_t cpu = (vcpu_t)data;
-
-- rq = cpu_rq(cpu);
-+ rq = vcpu_rq(cpu);
- BUG_ON(rq->migration_thread != current);
-
- set_current_state(TASK_INTERRUPTIBLE);
-@@ -4067,21 +5182,21 @@ static int migration_thread(void * data)
- struct list_head *head;
- migration_req_t *req;
-
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- spin_lock_irq(&rq->lock);
-
-- if (cpu_is_offline(cpu)) {
-+ if (vcpu_is_offline(cpu)) {
- spin_unlock_irq(&rq->lock);
- goto wait_to_die;
- }
--
-+#ifdef CONFIG_SMP
- if (rq->active_balance) {
- active_load_balance(rq, cpu);
- rq->active_balance = 0;
- }
--
-+#endif
- head = &rq->migration_queue;
-
- if (list_empty(head)) {
-@@ -4095,12 +5210,14 @@ static int migration_thread(void * data)
-
- if (req->type == REQ_MOVE_TASK) {
- spin_unlock(&rq->lock);
-- __migrate_task(req->task, smp_processor_id(),
-+ __migrate_task(req->task, this_vcpu(),
- req->dest_cpu);
- local_irq_enable();
-+#ifdef CONFIG_SMP
- } else if (req->type == REQ_SET_DOMAIN) {
- rq->sd = req->sd;
- spin_unlock_irq(&rq->lock);
-+#endif
- } else {
- spin_unlock_irq(&rq->lock);
- WARN_ON(1);
-@@ -4108,8 +5225,7 @@ static int migration_thread(void * data)
-
- complete(&req->done);
- }
-- __set_current_state(TASK_RUNNING);
-- return 0;
-+ goto die;
-
- wait_to_die:
- /* Wait for kthread_stop */
-@@ -4118,18 +5234,28 @@ wait_to_die:
- schedule();
- set_current_state(TASK_INTERRUPTIBLE);
- }
-+die:
- __set_current_state(TASK_RUNNING);
-+ migrate_live_tasks(cpu);
-+ spin_lock_irq(&rq->lock);
-+ migrate_dead_tasks(cpu);
-+ spin_unlock_irq(&rq->lock);
- return 0;
- }
-
--#ifdef CONFIG_HOTPLUG_CPU
- /* Figure out where task on dead CPU should go, use force if neccessary. */
--static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *tsk)
-+static void move_task_off_dead_cpu(vcpu_t dead_cpu, struct task_struct *tsk)
- {
- int dest_cpu;
-+ struct vcpu_scheduler *vsched;
- cpumask_t mask;
-+ runqueue_t *rq;
-+ unsigned long flags;
-
-+restart:
-+#if defined(CONFIG_HOTPLUG_CPU) && !defined(CONFIG_SCHED_VCPU)
- /* On same node? */
-+#error "FIXME: wrong code in case of HOTPLUG_CPU"
- mask = node_to_cpumask(cpu_to_node(dead_cpu));
- cpus_and(mask, mask, tsk->cpus_allowed);
- dest_cpu = any_online_cpu(mask);
-@@ -4153,27 +5279,44 @@ static void move_task_off_dead_cpu(int d
- "longer affine to cpu%d\n",
- tsk->pid, tsk->comm, dead_cpu);
- }
-- __migrate_task(tsk, dead_cpu, dest_cpu);
-+#elif defined(CONFIG_SCHED_VCPU)
-+ vsched = vcpu_vsched(dead_cpu);
-+ cpus_and(mask, vsched_vcpu_online_map(vsched), tsk->cpus_allowed);
-+ dest_cpu = any_online_cpu(mask);
-+
-+ /* On any allowed CPU? */
-+ if (dest_cpu == NR_CPUS) {
-+ rq = task_rq_lock(tsk, &flags);
-+ cpus_setall(tsk->cpus_allowed);
-+ task_rq_unlock(rq, &flags);
-+ dest_cpu = any_online_cpu(vsched_vcpu_online_map(vsched));
-+ }
-+ BUG_ON(dest_cpu == NR_CPUS);
-+#endif
-+ if (!__migrate_task(tsk, dead_cpu, vsched_vcpu(vsched, dest_cpu)))
-+ goto restart;
- }
-
- /* Run through task list and migrate tasks from the dead cpu. */
--static void migrate_live_tasks(int src_cpu)
-+static void migrate_live_tasks(vcpu_t src_cpu)
- {
- struct task_struct *tsk, *t;
-
-+ BUG_ON(vcpu_isset(src_cpu, vsched_vcpu_online_map(vcpu_vsched(src_cpu))));
- write_lock_irq(&tasklist_lock);
-
-- do_each_thread(t, tsk) {
-- if (tsk == current)
-+ do_each_thread_all(t, tsk) {
-+ if (tsk == current || tsk == vcpu_rq(src_cpu)->migration_thread)
- continue;
-
-- if (task_cpu(tsk) == src_cpu)
-+ if (task_vcpu(tsk) == src_cpu)
- move_task_off_dead_cpu(src_cpu, tsk);
-- } while_each_thread(t, tsk);
-+ } while_each_thread_all(t, tsk);
-
- write_unlock_irq(&tasklist_lock);
- }
-
-+#ifdef CONFIG_HOTPLUG_CPU
- /* Schedules idle task to be the next runnable task on current CPU.
- * It does so by boosting its priority to highest possible and adding it to
- * the _front_ of runqueue. Used by CPU offline code.
-@@ -4195,14 +5338,19 @@ void sched_idle_next(void)
-
- __setscheduler(p, SCHED_FIFO, MAX_RT_PRIO-1);
- /* Add idle task to _front_ of it's priority queue */
-+#ifdef CONFIG_SCHED_VCPU
-+#error "FIXME: VCPU vs. HOTPLUG: fix the code below"
-+#endif
- __activate_idle_task(p, rq);
-
- spin_unlock_irqrestore(&rq->lock, flags);
- }
-+#endif /* CONFIG_HOTPLUG_CPU */
-
--static void migrate_dead(unsigned int dead_cpu, task_t *tsk)
-+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SCHED_VCPU)
-+static void migrate_dead(vcpu_t dead_cpu, task_t *tsk)
- {
-- struct runqueue *rq = cpu_rq(dead_cpu);
-+ struct runqueue *rq = vcpu_rq(dead_cpu);
-
- /* Must be exiting, otherwise would be on tasklist. */
- BUG_ON(tsk->exit_state != EXIT_ZOMBIE && tsk->exit_state != EXIT_DEAD);
-@@ -4225,72 +5373,111 @@ static void migrate_dead(unsigned int de
- }
-
- /* release_task() removes task from tasklist, so we won't find dead tasks. */
--static void migrate_dead_tasks(unsigned int dead_cpu)
-+static void migrate_dead_tasks(vcpu_t dead_cpu)
- {
- unsigned arr, i;
-- struct runqueue *rq = cpu_rq(dead_cpu);
-+ struct runqueue *rq = vcpu_rq(dead_cpu);
-
- for (arr = 0; arr < 2; arr++) {
- for (i = 0; i < MAX_PRIO; i++) {
- struct list_head *list = &rq->arrays[arr].queue[i];
-- while (!list_empty(list))
-- migrate_dead(dead_cpu,
-- list_entry(list->next, task_t,
-- run_list));
-+ task_t *tsk;
-+restart:
-+ list_for_each_entry(tsk, list, run_list) {
-+ if (tsk == rq->migration_thread)
-+ continue;
-+ migrate_dead(dead_cpu, tsk);
-+ goto restart;
-+ }
- }
- }
- }
--#endif /* CONFIG_HOTPLUG_CPU */
-+#endif /* CONFIG_HOTPLUG_CPU || SCHED_VCPU */
-+
-+static void migration_thread_bind(struct task_struct *k, vcpu_t cpu)
-+{
-+ BUG_ON(k->state != TASK_INTERRUPTIBLE);
-+ /* Must have done schedule() in kthread() before we set_task_cpu */
-+ wait_task_inactive(k);
-+
-+ set_task_vsched(k, vcpu_vsched(cpu));
-+ set_task_vcpu(k, cpu);
-+ k->cpus_allowed = cpumask_of_cpu(cpu->id);
-+}
-+
-+static void migration_thread_stop(runqueue_t *rq)
-+{
-+ struct task_struct *thread;
-+
-+ thread = rq->migration_thread;
-+ if (thread == NULL)
-+ return;
-+
-+ get_task_struct(thread);
-+ kthread_stop(thread);
-+
-+ /* We MUST ensure, that the do_exit of the migration thread is
-+ * completed and it will never scheduled again before vsched_destroy.
-+ * The task with flag PF_DEAD if unscheduled will never receive
-+ * CPU again. */
-+ while (!(thread->flags & PF_DEAD) || task_running(rq, thread))
-+ yield();
-+ put_task_struct(thread);
-+
-+ rq->migration_thread = NULL;
-+}
-
- /*
- * migration_call - callback that gets triggered when a CPU is added.
- * Here we can start up the necessary migration thread for the new CPU.
- */
--static int migration_call(struct notifier_block *nfb, unsigned long action,
-+static int vmigration_call(struct notifier_block *nfb, unsigned long action,
- void *hcpu)
- {
-- int cpu = (long)hcpu;
-+ vcpu_t cpu = (vcpu_t)hcpu;
- struct task_struct *p;
- struct runqueue *rq;
- unsigned long flags;
-
- switch (action) {
- case CPU_UP_PREPARE:
-- p = kthread_create(migration_thread, hcpu, "migration/%d",cpu);
-+ p = kthread_create(migration_thread, hcpu, "migration/%d/%d",
-+ vsched_id(vcpu_vsched(cpu)), cpu->id);
- if (IS_ERR(p))
- return NOTIFY_BAD;
- p->flags |= PF_NOFREEZE;
-- kthread_bind(p, cpu);
-- /* Must be high prio: stop_machine expects to yield to it. */
-+
-+ migration_thread_bind(p, cpu);
- rq = task_rq_lock(p, &flags);
-+ /* Must be high prio: stop_machine expects to yield to it. */
- __setscheduler(p, SCHED_FIFO, MAX_RT_PRIO-1);
- task_rq_unlock(rq, &flags);
-- cpu_rq(cpu)->migration_thread = p;
-+ vcpu_rq(cpu)->migration_thread = p;
-+ cpu_set(cpu->id, vcpu_vsched(cpu)->vcpu_online_map);
- break;
- case CPU_ONLINE:
- /* Strictly unneccessary, as first user will wake it. */
-- wake_up_process(cpu_rq(cpu)->migration_thread);
-+ wake_up_process(vcpu_rq(cpu)->migration_thread);
- break;
--#ifdef CONFIG_HOTPLUG_CPU
-+#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_SCHED_VCPU)
-+#error "FIXME: CPU down code doesn't work yet with VCPUs"
-+#endif
- case CPU_UP_CANCELED:
- /* Unbind it from offline cpu so it can run. Fall thru. */
-- kthread_bind(cpu_rq(cpu)->migration_thread,smp_processor_id());
-- kthread_stop(cpu_rq(cpu)->migration_thread);
-- cpu_rq(cpu)->migration_thread = NULL;
-+ migration_thread_bind(vcpu_rq(cpu)->migration_thread, this_vcpu());
-+ migration_thread_stop(vcpu_rq(cpu));
- break;
- case CPU_DEAD:
-- migrate_live_tasks(cpu);
-- rq = cpu_rq(cpu);
-- kthread_stop(rq->migration_thread);
-- rq->migration_thread = NULL;
-+ rq = vcpu_rq(cpu);
-+ migration_thread_stop(rq);
-+#ifdef CONFIG_HOTPLUG_CPU
- /* Idle task back to normal (off runqueue, low prio) */
- rq = task_rq_lock(rq->idle, &flags);
- deactivate_task(rq->idle, rq);
- rq->idle->static_prio = MAX_PRIO;
- __setscheduler(rq->idle, SCHED_NORMAL, 0);
-- migrate_dead_tasks(cpu);
- task_rq_unlock(rq, &flags);
-- BUG_ON(rq->nr_running != 0);
-+#endif
-
- /* No need to migrate the tasks: it was best-effort if
- * they didn't do lock_cpu_hotplug(). Just wake up
-@@ -4306,11 +5493,17 @@ static int migration_call(struct notifie
- }
- spin_unlock_irq(&rq->lock);
- break;
--#endif
- }
- return NOTIFY_OK;
- }
-
-+static int migration_call(struct notifier_block *nfb, unsigned long action,
-+ void *hcpu)
-+{
-+ /* we need to translate pcpu to vcpu */
-+ return vmigration_call(nfb, action, vsched_default_vcpu((long)hcpu));
-+}
-+
- /* Register at highest priority so that task migration (migrate_all_tasks)
- * happens before everything else.
- */
-@@ -4354,7 +5547,7 @@ static void cpu_attach_domain(struct sch
- {
- migration_req_t req;
- unsigned long flags;
-- runqueue_t *rq = cpu_rq(cpu);
-+ runqueue_t *rq = vcpu_rq(vsched_default_vcpu(cpu));
- int local = 1;
- struct sched_domain *tmp = sd, *tmp1;
-
-@@ -4374,6 +5567,7 @@ static void cpu_attach_domain(struct sch
-
- spin_lock_irqsave(&rq->lock, flags);
-
-+ pcpu(cpu)->sd = sd;
- if (cpu == smp_processor_id() || !cpu_online(cpu)) {
- rq->sd = sd;
- } else {
-@@ -4807,11 +6001,10 @@ void sched_domain_debug(void)
- int i;
-
- for_each_online_cpu(i) {
-- runqueue_t *rq = cpu_rq(i);
- struct sched_domain *sd;
- int level = 0;
-
-- sd = rq->sd;
-+ sd = pcpu(i)->sd;
-
- printk(KERN_DEBUG "CPU%d:\n", i);
-
-@@ -4827,7 +6020,8 @@ void sched_domain_debug(void)
- printk(KERN_DEBUG);
- for (j = 0; j < level + 1; j++)
- printk(" ");
-- printk("domain %d: span %s\n", level, str);
-+ printk("domain %d: span %s flags 0x%x\n",
-+ level, str, sd->flags);
-
- if (!cpu_isset(i, sd->span))
- printk(KERN_DEBUG "ERROR domain->span does not contain CPU%d\n", i);
-@@ -4941,6 +6135,48 @@ void __init sched_init_smp(void)
- }
- #endif /* CONFIG_SMP */
-
-+#ifdef CONFIG_VE
-+/*
-+ * This function is used to show fake CPU information.
-+ *
-+ * I'm still quite unsure that faking CPU speed is such a good idea,
-+ * but someone (Kirill?) has made this decision.
-+ * What I'm absolutely sure is that it's a part of virtualization,
-+ * not a scheduler. 20050727 SAW
-+ */
-+#ifdef CONFIG_FAIRSCHED
-+int scale_vcpu_frequency = 0;
-+EXPORT_SYMBOL(scale_vcpu_frequency);
-+
-+unsigned long ve_scale_khz(unsigned long khz)
-+{
-+ struct fairsched_node *node;
-+ int cpus;
-+ unsigned long rate;
-+
-+ if (!scale_vcpu_frequency)
-+ return khz;
-+ cpus = fairsched_nr_cpus;
-+ rate = cpus << FSCHRATE_SHIFT;
-+
-+ /*
-+ * Ideally fairsched node should be taken from the current ve_struct.
-+ * However, to simplify the code and locking, it is taken from current
-+ * (currently fairsched_node can be changed only for a sleeping task).
-+ * That means that VE0 processes moved to some special node will get
-+ * fake CPU speed, but that shouldn't be a big problem.
-+ */
-+ preempt_disable();
-+ node = current->vsched->node;
-+ if (node->rate_limited)
-+ rate = node->rate;
-+ preempt_enable();
-+
-+ return ((unsigned long long)khz * (rate / cpus)) >> FSCHRATE_SHIFT;
-+}
-+#endif
-+#endif /* CONFIG_VE */
-+
- int in_sched_functions(unsigned long addr)
- {
- /* Linker adds these: start and end of __sched functions */
-@@ -4950,14 +6186,10 @@ int in_sched_functions(unsigned long add
- && addr < (unsigned long)__sched_text_end);
- }
-
--void __init sched_init(void)
--{
-- runqueue_t *rq;
-- int i, j, k;
--
- #ifdef CONFIG_SMP
-+static void init_sd(void)
-+{
- /* Set up an initial dummy domain for early boot */
--
- memset(&sched_domain_dummy, 0, sizeof(struct sched_domain));
- sched_domain_dummy.span = CPU_MASK_ALL;
- sched_domain_dummy.groups = &sched_group_dummy;
-@@ -4969,38 +6201,588 @@ void __init sched_init(void)
- sched_group_dummy.cpumask = CPU_MASK_ALL;
- sched_group_dummy.next = &sched_group_dummy;
- sched_group_dummy.cpu_power = SCHED_LOAD_SCALE;
-+}
-+#else
-+static void inline init_sd(void)
-+{
-+}
- #endif
-
-- for (i = 0; i < NR_CPUS; i++) {
-- prio_array_t *array;
-+static void init_rq(struct runqueue *rq)
-+{
-+ int j, k;
-+ prio_array_t *array;
-
-- rq = cpu_rq(i);
-- spin_lock_init(&rq->lock);
-- rq->active = rq->arrays;
-- rq->expired = rq->arrays + 1;
-- rq->best_expired_prio = MAX_PRIO;
-+ spin_lock_init(&rq->lock);
-+ rq->active = rq->arrays;
-+ rq->expired = rq->arrays + 1;
-+ rq->best_expired_prio = MAX_PRIO;
-
- #ifdef CONFIG_SMP
-- rq->sd = &sched_domain_dummy;
-- rq->cpu_load = 0;
-- rq->active_balance = 0;
-- rq->push_cpu = 0;
-- rq->migration_thread = NULL;
-- INIT_LIST_HEAD(&rq->migration_queue);
--#endif
-- atomic_set(&rq->nr_iowait, 0);
--
-- for (j = 0; j < 2; j++) {
-- array = rq->arrays + j;
-- for (k = 0; k < MAX_PRIO; k++) {
-- INIT_LIST_HEAD(array->queue + k);
-- __clear_bit(k, array->bitmap);
-- }
-- // delimiter for bitsearch
-- __set_bit(MAX_PRIO, array->bitmap);
-+ rq->sd = &sched_domain_dummy;
-+ rq->cpu_load = 0;
-+ rq->active_balance = 0;
-+#endif
-+ rq->push_cpu = 0;
-+ rq->migration_thread = NULL;
-+ INIT_LIST_HEAD(&rq->migration_queue);
-+ atomic_set(&rq->nr_iowait, 0);
-+
-+ for (j = 0; j < 2; j++) {
-+ array = rq->arrays + j;
-+ for (k = 0; k < MAX_PRIO; k++) {
-+ INIT_LIST_HEAD(array->queue + k);
-+ __clear_bit(k, array->bitmap);
-+ }
-+ // delimiter for bitsearch
-+ __set_bit(MAX_PRIO, array->bitmap);
-+ }
-+}
-+
-+#if defined(CONFIG_SCHED_VCPU) || defined(CONFIG_FAIRSCHED)
-+/* both rq and vsched lock should be taken */
-+static void __install_vcpu(struct vcpu_scheduler *vsched, vcpu_t vcpu)
-+{
-+ int id;
-+
-+ id = vcpu->id;
-+ vcpu->vsched = vsched;
-+ vsched->vcpu[id] = vcpu;
-+ vcpu->last_pcpu = id;
-+ wmb();
-+ /* FIXME: probably locking should be reworked, e.g.
-+ we don't have corresponding rmb(), so we need to update mask
-+ only after quiscent state */
-+ /* init_boot_vcpu() should be remade if RCU is used here */
-+ list_add(&vcpu->list, &vsched->idle_list);
-+ vsched->num_online_vcpus++;
-+}
-+
-+static int install_vcpu(vcpu_t vcpu, struct vcpu_scheduler *vsched)
-+{
-+ runqueue_t *rq;
-+ unsigned long flags;
-+ int res = 0;
-+
-+ rq = vcpu_rq(vcpu);
-+ spin_lock_irqsave(&rq->lock, flags);
-+ spin_lock(&fairsched_lock);
-+
-+ if (vsched->vcpu[vcpu->id] != NULL)
-+ res = -EBUSY;
-+ else
-+ __install_vcpu(vsched, vcpu);
-+
-+ spin_unlock(&fairsched_lock);
-+ spin_unlock_irqrestore(&rq->lock, flags);
-+ return res;
-+}
-+
-+static int __add_vcpu(struct vcpu_scheduler *vsched, int id)
-+{
-+ vcpu_t vcpu;
-+ int res;
-+
-+ res = -ENOMEM;
-+ vcpu = kmalloc(sizeof(struct vcpu_info), GFP_KERNEL);
-+ if (vcpu == NULL)
-+ goto out;
-+
-+ init_vcpu(vcpu, id);
-+ vcpu_rq(vcpu)->curr = this_pcpu()->idle;
-+ res = install_vcpu(vcpu, vsched);
-+ if (res < 0)
-+ goto out_free;
-+ return 0;
-+
-+out_free:
-+ kfree(vcpu);
-+out:
-+ return res;
-+}
-+
-+void vsched_init(struct vcpu_scheduler *vsched, int id)
-+{
-+ memset(vsched, 0, sizeof(*vsched));
-+
-+ INIT_LIST_HEAD(&vsched->idle_list);
-+ INIT_LIST_HEAD(&vsched->active_list);
-+ INIT_LIST_HEAD(&vsched->running_list);
-+ vsched->num_online_vcpus = 0;
-+ vsched->vcpu_online_map = CPU_MASK_NONE;
-+ vsched->vcpu_running_map = CPU_MASK_NONE;
-+ vsched->pcpu_running_map = CPU_MASK_NONE;
-+ vsched->id = id;
-+}
-+
-+#ifdef CONFIG_FAIRSCHED
-+
-+/* No locks supposed to be held */
-+static void vsched_del_vcpu(vcpu_t vcpu, int empty);
-+static int vsched_add_vcpu(struct vcpu_scheduler *vsched)
-+{
-+ int res, err;
-+ vcpu_t vcpu;
-+ int id;
-+ static DECLARE_MUTEX(id_mutex);
-+
-+ down(&id_mutex);
-+ id = find_first_zero_bit(vsched->vcpu_online_map.bits, NR_CPUS);
-+ if (id >= NR_CPUS) {
-+ err = -EBUSY;
-+ goto out_up;
-+ }
-+
-+ err = __add_vcpu(vsched, id);
-+ if (err < 0)
-+ goto out_up;
-+
-+ vcpu = vsched_vcpu(vsched, id);
-+ err = -ENOMEM;
-+
-+ res = vmigration_call(&migration_notifier, CPU_UP_PREPARE, vcpu);
-+ if (res != NOTIFY_OK)
-+ goto out_del_up;
-+
-+ res = vmigration_call(&migration_notifier, CPU_ONLINE, vcpu);
-+ if (res != NOTIFY_OK)
-+ goto out_cancel_del_up;
-+
-+ err = 0;
-+
-+out_up:
-+ up(&id_mutex);
-+ return err;
-+
-+out_cancel_del_up:
-+ vmigration_call(&migration_notifier, CPU_UP_CANCELED, vcpu);
-+out_del_up:
-+ vsched_del_vcpu(vcpu, 0);
-+ goto out_up;
-+}
-+
-+static inline void offline_vcpu(struct vcpu_scheduler *vsched, int cpu,
-+ runqueue_t *rq)
-+{
-+ spin_lock_irq(&rq->lock);
-+ spin_lock(&fairsched_lock);
-+ cpu_clear(cpu, vsched->vcpu_online_map);
-+ vsched->num_online_vcpus--;
-+ spin_unlock(&fairsched_lock);
-+ spin_unlock_irq(&rq->lock);
-+}
-+
-+static inline void del_vcpu(struct vcpu_scheduler *vsched, int cpu,
-+ vcpu_t vcpu)
-+{
-+ spin_lock_irq(&fairsched_lock);
-+ list_del(&vcpu->list);
-+ vsched_vcpu(vsched, cpu) = NULL;
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ kfree(vcpu);
-+}
-+
-+static void vsched_del_vcpu(vcpu_t vcpu, int empty)
-+{
-+ struct vcpu_scheduler *vsched;
-+ runqueue_t *rq;
-+
-+ vsched = vcpu_vsched(vcpu);
-+ rq = vcpu_rq(vcpu);
-+
-+ offline_vcpu(vsched, vcpu->id, rq);
-+
-+ /* no need to syncronize, if no tasks at all */
-+ if (!empty)
-+ synchronize_kernel();
-+
-+ /*
-+ * all tasks should migrate from this VCPU somewhere,
-+ * also, since this moment VCPU is offline, so migration_thread
-+ * won't accept any new tasks...
-+ */
-+ vmigration_call(&migration_notifier, CPU_DEAD, vcpu);
-+ BUG_ON(rq->nr_running != 0);
-+
-+ /* vcpu_put() is called after deactivate_task. This loop makes sure
-+ * that vcpu_put() was finished and vcpu can be freed */
-+ while ((volatile int)vcpu->running)
-+ yield();
-+
-+ BUG_ON(vcpu->active); /* should be in idle_list */
-+
-+ del_vcpu(vsched, vcpu->id, vcpu);
-+}
-+
-+void fini_idle(int cpu)
-+{
-+ struct vcpu_scheduler *vsched;
-+ vcpu_t vcpu;
-+ runqueue_t *rq;
-+
-+ vsched = &idle_vsched;
-+ vcpu = vsched_vcpu(vsched, cpu);
-+ rq = vcpu_rq(vcpu);
-+ offline_vcpu(vsched, vcpu->id, rq);
-+ del_vcpu(vsched, vcpu->id, vcpu);
-+}
-+
-+int vsched_set_vcpus(struct vcpu_scheduler *vsched, unsigned int vcpus)
-+{
-+ int i, ret = 0;
-+ vcpu_t vcpu;
-+
-+ if (vsched->num_online_vcpus < vcpus) {
-+ /* need to add more VCPUs */
-+ for (i = vcpus - vsched->num_online_vcpus; i > 0; i--) {
-+ ret = vsched_add_vcpu(vsched);
-+ if (ret < 0)
-+ break;
-+ }
-+ } else if (vsched->num_online_vcpus > vcpus) {
-+ /* remove some VCPUs */
-+ while (vcpus != vsched->num_online_vcpus) {
-+ vcpu = vsched_vcpu(vsched, vsched->num_online_vcpus - 1);
-+ BUG_ON(!vcpu);
-+ vsched_del_vcpu(vcpu, 0);
-+ }
-+ }
-+#ifdef CONFIG_FAIRSCHED
-+ vsched->node->vcpus = vsched->num_online_vcpus;
-+#endif
-+ return ret;
-+}
-+
-+int vsched_mvpr(struct task_struct *p, struct vcpu_scheduler *vsched)
-+{
-+ vcpu_t dest_vcpu;
-+ int id;
-+
-+ id = first_cpu(vsched->vcpu_online_map);
-+ if (id >= NR_CPUS)
-+ goto err;
-+
-+ dest_vcpu = vsched_vcpu(vsched, id);
-+ set_cpus_allowed(p, CPU_MASK_ALL);
-+ sched_migrate_task(p, dest_vcpu);
-+
-+ if (task_vsched_id(p) != vsched_id(vsched)) {
-+ /* race: probably someone changed cpus_allowed? */
-+ printk("vsched_mvpr: failed to move task\n");
-+ goto err;
-+ }
-+
-+ return 0;
-+
-+err:
-+ return -EINVAL;
-+}
-+
-+void vsched_fairsched_link(struct vcpu_scheduler *vsched,
-+ struct fairsched_node *node)
-+{
-+ vsched->node = node;
-+ node->vsched = vsched;
-+}
-+
-+void vsched_fairsched_unlink(struct vcpu_scheduler *vsched,
-+ struct fairsched_node *node)
-+{
-+ vsched->node = NULL;
-+ node->vsched = NULL;
-+}
-+
-+int vsched_create(int id, struct fairsched_node *node)
-+{
-+ struct vcpu_scheduler *vsched;
-+ int res, cpus;
-+
-+ vsched = kmalloc(sizeof(*vsched), GFP_KERNEL);
-+ if (vsched == NULL)
-+ return -ENOMEM;
-+
-+ vsched_init(vsched, node->id);
-+ vsched_fairsched_link(vsched, node);
-+
-+ cpus = node->vcpus ? : num_online_cpus();
-+ res = vsched_set_vcpus(vsched, cpus);
-+ if (res < 0)
-+ goto err_add;
-+
-+ return 0;
-+
-+err_add:
-+ vsched_destroy(vsched);
-+ return res;
-+}
-+
-+int vsched_destroy(struct vcpu_scheduler *vsched)
-+{
-+ if (vsched == NULL)
-+ return 0;
-+
-+ vsched_set_vcpus(vsched, 0);
-+
-+ spin_lock_irq(&fairsched_lock);
-+ if (vsched->num_online_vcpus ||
-+ !list_empty(&vsched->running_list) ||
-+ !list_empty(&vsched->active_list) ||
-+ !list_empty(&vsched->idle_list))
-+ goto err_busy;
-+
-+ vsched_fairsched_unlink(vsched, vsched->node);
-+ spin_unlock_irq(&fairsched_lock);
-+
-+ kfree(vsched);
-+ return 0;
-+
-+err_busy:
-+ oops_in_progress = 1;
-+ printk(KERN_ERR "BUG in vsched_destroy, id %d: n%d r%d a%d i%d\n",
-+ vsched->id,
-+ vsched->num_online_vcpus,
-+ !list_empty(&vsched->running_list),
-+ !list_empty(&vsched->active_list),
-+ !list_empty(&vsched->idle_list));
-+ spin_unlock_irq(&fairsched_lock);
-+ oops_in_progress = 0;
-+ return -EBUSY;
-+
-+}
-+#endif /* defined(CONFIG_FAIRSCHED) */
-+#endif /* defined(CONFIG_SCHED_VCPU) || defined(CONFIG_FAIRSCHED) */
-+
-+static void init_boot_vcpu(void)
-+{
-+ int res;
-+
-+ /*
-+ * We setup boot_vcpu and it's runqueue until init_idle() happens
-+ * on cpu0. This is required since timer interrupts can happen
-+ * between sched_init() and init_idle().
-+ */
-+ init_vcpu(&boot_idle_vcpu, 0);
-+ vcpu_rq(&boot_idle_vcpu)->curr = current;
-+ res = install_vcpu(&boot_idle_vcpu, &idle_vsched);
-+ if (res < 0)
-+ panic("Can't install boot idle vcpu");
-+
-+ init_vcpu(&boot_vcpu, 0);
-+ vcpu_rq(&boot_vcpu)->curr = current;
-+ res = install_vcpu(&boot_vcpu, &default_vsched);
-+ if (res < 0)
-+ panic("Can't install boot vcpu");
-+
-+ this_pcpu()->vcpu = &boot_idle_vcpu;
-+ this_pcpu()->vsched = &idle_vsched;
-+}
-+
-+static void init_pcpu(int id)
-+{
-+ struct pcpu_info *pcpu;
-+
-+ pcpu = pcpu(id);
-+ pcpu->id = id;
-+#ifdef CONFIG_SMP
-+ pcpu->sd = &sched_domain_dummy;
-+#endif
-+
-+#ifndef CONFIG_SCHED_VCPU
-+ init_vcpu(vcpu(id), id);
-+#endif
-+}
-+
-+static void init_pcpus(void)
-+{
-+ int i;
-+ for (i = 0; i < NR_CPUS; i++)
-+ init_pcpu(i);
-+}
-+
-+#ifdef CONFIG_SCHED_VCPU
-+static void show_vcpu_list(struct vcpu_scheduler *vsched, struct list_head *lh)
-+{
-+ cpumask_t m;
-+ vcpu_t vcpu;
-+ int i;
-+
-+ cpus_clear(m);
-+ list_for_each_entry(vcpu, lh, list)
-+ cpu_set(vcpu->id, m);
-+
-+ for (i = 0; i < NR_CPUS; i++)
-+ if (cpu_isset(i, m))
-+ printk("%d ", i);
-+}
-+
-+#define PRINT(s, sz, fmt...) \
-+ do { \
-+ int __out; \
-+ __out = scnprintf(*s, *sz, fmt); \
-+ *s += __out; \
-+ *sz -= __out; \
-+ } while(0)
-+
-+static void show_rq_array(prio_array_t *array, char *header, char **s, int *sz)
-+{
-+ struct list_head *list;
-+ task_t *p;
-+ int k, h;
-+
-+ h = 0;
-+ for (k = 0; k < MAX_PRIO; k++) {
-+ list = array->queue + k;
-+ if (list_empty(list))
-+ continue;
-+
-+ if (!h) {
-+ PRINT(s, sz, header);
-+ h = 1;
- }
-+
-+ PRINT(s, sz, " prio %d (", k);
-+ list_for_each_entry(p, list, run_list)
-+ PRINT(s, sz, "%s[%d] ", p->comm, p->pid);
-+ PRINT(s, sz, ")");
- }
-+ if (h)
-+ PRINT(s, sz, "\n");
-+}
-+
-+static void show_vcpu(vcpu_t vcpu)
-+{
-+ runqueue_t *rq;
-+ char buf[1024], *s;
-+ unsigned long flags;
-+ int sz;
-+
-+ if (vcpu == NULL)
-+ return;
-+
-+ rq = vcpu_rq(vcpu);
-+ spin_lock_irqsave(&rq->lock, flags);
-+ printk(" vcpu %d: last_pcpu %d, state %s%s\n",
-+ vcpu->id, vcpu->last_pcpu,
-+ vcpu->active ? "A" : "",
-+ vcpu->running ? "R" : "");
-+
-+ printk(" rq: running %lu, load %lu, sw %Lu, sd %p\n",
-+ rq->nr_running,
-+#ifdef CONFIG_SMP
-+ rq->cpu_load,
-+#else
-+ 0LU,
-+#endif
-+ rq->nr_switches,
-+#ifdef CONFIG_SMP
-+ rq->sd
-+#else
-+ NULL
-+#endif
-+ );
-+
-+ s = buf;
-+ sz = sizeof(buf) - 1;
-+
-+ show_rq_array(rq->active, " active:", &s, &sz);
-+ show_rq_array(rq->expired, " expired:", &s, &sz);
-+ spin_unlock_irqrestore(&rq->lock, flags);
-+
-+ *s = 0;
-+ printk(buf);
-+}
-
-+static inline void fairsched_show_node(struct vcpu_scheduler *vsched)
-+{
-+#ifdef CONFIG_FAIRSCHED
-+ struct fairsched_node *node;
-+
-+ node = vsched->node;
-+ printk("fsnode: ready %d run %d cpu %d vsched %p, pcpu %d\n",
-+ node->nr_ready, node->nr_runnable, node->nr_pcpu,
-+ node->vsched, smp_processor_id());
-+#endif
-+}
-+
-+static void __show_vsched(struct vcpu_scheduler *vsched)
-+{
-+ char mask[NR_CPUS + 1];
-+ int i;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&fairsched_lock, flags);
-+ printk("vsched id=%d\n", vsched_id(vsched));
-+ fairsched_show_node(vsched);
-+
-+ printk(" idle cpus ");
-+ show_vcpu_list(vsched, &vsched->idle_list);
-+ printk("; active cpus ");
-+ show_vcpu_list(vsched, &vsched->active_list);
-+ printk("; running cpus ");
-+ show_vcpu_list(vsched, &vsched->running_list);
-+ printk("\n");
-+
-+ cpumask_scnprintf(mask, NR_CPUS, vsched->vcpu_online_map);
-+ printk(" num_online_cpus=%d, mask=%s (w=%d)\n",
-+ vsched->num_online_vcpus, mask,
-+ cpus_weight(vsched->vcpu_online_map));
-+ spin_unlock_irqrestore(&fairsched_lock, flags);
-+
-+ for (i = 0; i < NR_CPUS; i++)
-+ show_vcpu(vsched->vcpu[i]);
-+}
-+
-+void show_vsched(void)
-+{
-+ oops_in_progress = 1;
-+ __show_vsched(&idle_vsched);
-+ __show_vsched(&default_vsched);
-+ oops_in_progress = 0;
-+}
-+#endif /* CONFIG_SCHED_VCPU */
-+
-+int __devinit vsched_init_default(int cpu)
-+{
-+ if (cpu > 0)
-+ return __add_vcpu(&default_vsched, cpu);
-+ return 0;
-+}
-+
-+void __devinit vsched_fini_default(int cpu)
-+{
-+ vcpu_t vcpu;
-+ runqueue_t *rq;
-+ unsigned long flags;
-+
-+ if (cpu == 0)
-+ return;
-+
-+ vcpu = vsched_vcpu(&default_vsched, cpu);
-+ rq = vcpu_rq(vcpu);
-+
-+ offline_vcpu(&default_vsched, cpu, rq);
-+ del_vcpu(&default_vsched, cpu, vcpu);
-+}
-+
-+void __init sched_init(void)
-+{
-+ init_sd();
-+ init_pcpus();
-+#if defined(CONFIG_SCHED_VCPU)
-+ vsched_init(&idle_vsched, -1);
-+ vsched_init(&default_vsched, 0);
-+#if defined(CONFIG_FAIRSCHED)
-+ fairsched_init_early();
-+ vsched_fairsched_link(&idle_vsched, &fairsched_idle_node);
-+ vsched_fairsched_link(&default_vsched, &fairsched_init_node);
-+#endif
-+ init_boot_vcpu();
-+#else
-+#if defined(CONFIG_FAIRSCHED)
-+ fairsched_init_early();
-+#endif
-+#endif
- /*
- * The boot idle thread does lazy MMU switching as well:
- */
-@@ -5040,3 +6822,7 @@ void __might_sleep(char *file, int line,
- }
- EXPORT_SYMBOL(__might_sleep);
- #endif
-+
-+EXPORT_SYMBOL(ve_sched_get_idle_time);
-+EXPORT_SYMBOL(nr_running_ve);
-+EXPORT_SYMBOL(nr_uninterruptible_ve);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/signal.c linux-2.6.9-ve023stab030/kernel/signal.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/signal.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/signal.c 2006-10-11 19:07:59.000000000 +0400
-@@ -12,6 +12,7 @@
-
- #include <linux/config.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/module.h>
- #include <linux/smp_lock.h>
- #include <linux/init.h>
-@@ -27,13 +28,17 @@
- #include <asm/unistd.h>
- #include <asm/siginfo.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_misc.h>
-+
- extern void k_getrusage(struct task_struct *, int, struct rusage *);
-
- /*
- * SLAB caches for signal bits.
- */
-
--static kmem_cache_t *sigqueue_cachep;
-+kmem_cache_t *sigqueue_cachep;
-+EXPORT_SYMBOL(sigqueue_cachep);
-
- /*
- * In POSIX a signal is sent either to a specific thread (Linux task)
-@@ -217,12 +222,14 @@ static inline int has_pending_signals(si
- fastcall void recalc_sigpending_tsk(struct task_struct *t)
- {
- if (t->signal->group_stop_count > 0 ||
-+ test_tsk_thread_flag(t,TIF_FREEZE) ||
- PENDING(&t->pending, &t->blocked) ||
- PENDING(&t->signal->shared_pending, &t->blocked))
- set_tsk_thread_flag(t, TIF_SIGPENDING);
- else
- clear_tsk_thread_flag(t, TIF_SIGPENDING);
- }
-+EXPORT_SYMBOL(recalc_sigpending_tsk);
-
- void recalc_sigpending(void)
- {
-@@ -270,13 +277,26 @@ static struct sigqueue *__sigqueue_alloc
- struct sigqueue *q = NULL;
-
- if (atomic_read(&current->user->sigpending) <
-- current->rlim[RLIMIT_SIGPENDING].rlim_cur)
-+ current->rlim[RLIMIT_SIGPENDING].rlim_cur) {
- q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
-+ if (q != NULL) {
-+ /*
-+ * Note: use of get_exec_ub() here vs get_task_ub()
-+ * in send_signal() is not intentional. SAW 2005/03/09
-+ */
-+ if (ub_siginfo_charge(get_exec_ub(),
-+ kmem_cache_memusage(sigqueue_cachep))) {
-+ kfree(q);
-+ q = NULL;
-+ }
-+ }
-+ }
- if (q) {
- INIT_LIST_HEAD(&q->list);
- q->flags = 0;
- q->lock = NULL;
- q->user = get_uid(current->user);
-+ sig_ub(q) = get_beancounter(get_exec_ub());
- atomic_inc(&q->user->sigpending);
- }
- return(q);
-@@ -286,6 +306,8 @@ static inline void __sigqueue_free(struc
- {
- if (q->flags & SIGQUEUE_PREALLOC)
- return;
-+ ub_siginfo_uncharge(sig_ub(q), kmem_cache_memusage(sigqueue_cachep));
-+ put_beancounter(sig_ub(q));
- atomic_dec(&q->user->sigpending);
- free_uid(q->user);
- kmem_cache_free(sigqueue_cachep, q);
-@@ -353,8 +375,11 @@ void __exit_signal(struct task_struct *t
- BUG();
- spin_lock(&sighand->siglock);
- if (atomic_dec_and_test(&sig->count)) {
-- if (tsk == sig->curr_target)
-+ if (tsk == sig->curr_target) {
- sig->curr_target = next_thread(tsk);
-+ if (tsk == sig->curr_target)
-+ sig->curr_target = NULL;
-+ }
- tsk->signal = NULL;
- spin_unlock(&sighand->siglock);
- flush_sigqueue(&sig->shared_pending);
-@@ -367,8 +392,11 @@ void __exit_signal(struct task_struct *t
- wake_up_process(sig->group_exit_task);
- sig->group_exit_task = NULL;
- }
-- if (tsk == sig->curr_target)
-+ if (tsk == sig->curr_target) {
- sig->curr_target = next_thread(tsk);
-+ if (tsk == sig->curr_target)
-+ sig->curr_target = NULL;
-+ }
- tsk->signal = NULL;
- /*
- * Accumulate here the counters for all threads but the
-@@ -603,6 +631,7 @@ void signal_wake_up(struct task_struct *
- if (!wake_up_state(t, mask))
- kick_process(t);
- }
-+EXPORT_SYMBOL(signal_wake_up);
-
- /*
- * Remove signals in mask from the pending set and queue.
-@@ -783,12 +812,21 @@ static int send_signal(int sig, struct s
- pass on the info struct. */
-
- if (atomic_read(&t->user->sigpending) <
-- t->rlim[RLIMIT_SIGPENDING].rlim_cur)
-+ t->rlim[RLIMIT_SIGPENDING].rlim_cur) {
- q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
-+ if (q != NULL) {
-+ if (ub_siginfo_charge(get_task_ub(t),
-+ kmem_cache_memusage(sigqueue_cachep))) {
-+ kfree(q);
-+ q = NULL;
-+ }
-+ }
-+ }
-
- if (q) {
- q->flags = 0;
- q->user = get_uid(t->user);
-+ sig_ub(q) = get_beancounter(get_task_ub(t));
- atomic_inc(&q->user->sigpending);
- list_add_tail(&q->list, &signals->list);
- switch ((unsigned long) info) {
-@@ -796,7 +834,7 @@ static int send_signal(int sig, struct s
- q->info.si_signo = sig;
- q->info.si_errno = 0;
- q->info.si_code = SI_USER;
-- q->info.si_pid = current->pid;
-+ q->info.si_pid = virt_pid(current);
- q->info.si_uid = current->uid;
- break;
- case 1:
-@@ -958,7 +996,6 @@ __group_complete_signal(int sig, struct
- if (t == NULL)
- /* restart balancing at this thread */
- t = p->signal->curr_target = p;
-- BUG_ON(t->tgid != p->tgid);
-
- while (!wants_signal(sig, t, mask)) {
- t = next_thread(t);
-@@ -1139,13 +1176,18 @@ int __kill_pg_info(int sig, struct sigin
- if (pgrp <= 0)
- return -EINVAL;
-
-+ /* Use __vpid_to_pid(). This function is used under write_lock
-+ * tasklist_lock. */
-+ if (is_virtual_pid(pgrp))
-+ pgrp = __vpid_to_pid(pgrp);
-+
- success = 0;
- retval = -ESRCH;
-- do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
-+ do_each_task_pid_ve(pgrp, PIDTYPE_PGID, p) {
- int err = group_send_sig_info(sig, info, p);
- success |= !err;
- retval = err;
-- } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
-+ } while_each_task_pid_ve(pgrp, PIDTYPE_PGID, p);
- return success ? 0 : retval;
- }
-
-@@ -1168,7 +1210,7 @@ kill_proc_info(int sig, struct siginfo *
- struct task_struct *p;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- error = -ESRCH;
- if (p)
- error = group_send_sig_info(sig, info, p);
-@@ -1187,7 +1229,7 @@ int kill_proc_info_as_uid(int sig, struc
- return ret;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- if (!p) {
- ret = -ESRCH;
- goto out_unlock;
-@@ -1256,8 +1298,8 @@ static int kill_something_info(int sig,
- struct task_struct * p;
-
- read_lock(&tasklist_lock);
-- for_each_process(p) {
-- if (p->pid > 1 && p->tgid != current->tgid) {
-+ for_each_process_ve(p) {
-+ if (virt_pid(p) > 1 && p->tgid != current->tgid) {
- int err = group_send_sig_info(sig, info, p);
- ++count;
- if (err != -EPERM)
-@@ -1538,9 +1580,16 @@ void do_notify_parent(struct task_struct
- BUG_ON(!tsk->ptrace &&
- (tsk->group_leader != tsk || !thread_group_empty(tsk)));
-
-+#ifdef CONFIG_VE
-+ /* Allow to send only SIGCHLD from VE */
-+ if (sig != SIGCHLD &&
-+ VE_TASK_INFO(tsk)->owner_env != VE_TASK_INFO(tsk->parent)->owner_env)
-+ sig = SIGCHLD;
-+#endif
-+
- info.si_signo = sig;
- info.si_errno = 0;
-- info.si_pid = tsk->pid;
-+ info.si_pid = get_task_pid_ve(tsk, VE_TASK_INFO(tsk->parent)->owner_env);
- info.si_uid = tsk->uid;
-
- /* FIXME: find out whether or not this is supposed to be c*time. */
-@@ -1597,7 +1646,7 @@ do_notify_parent_cldstop(struct task_str
-
- info.si_signo = SIGCHLD;
- info.si_errno = 0;
-- info.si_pid = tsk->pid;
-+ info.si_pid = get_task_pid_ve(tsk, VE_TASK_INFO(parent)->owner_env);
- info.si_uid = tsk->uid;
-
- /* FIXME: find out whether or not this is supposed to be c*time. */
-@@ -1655,6 +1704,7 @@ static void ptrace_stop(int exit_code, i
- current->exit_code = exit_code;
-
- /* Let the debugger run. */
-+ set_pn_state(current, PN_STOP_SIGNAL);
- set_current_state(TASK_TRACED);
- spin_unlock_irq(&current->sighand->siglock);
- read_lock(&tasklist_lock);
-@@ -1676,6 +1726,7 @@ static void ptrace_stop(int exit_code, i
- set_current_state(TASK_RUNNING);
- current->exit_code = nostop_code;
- }
-+ clear_pn_state(current);
-
- /*
- * We are back. Now reacquire the siglock before touching
-@@ -1734,7 +1785,9 @@ finish_stop(int stop_count)
- read_unlock(&tasklist_lock);
- }
-
-+ set_stop_state(current);
- schedule();
-+ clear_stop_state(current);
- /*
- * Now we don't run again until continued.
- */
-@@ -1936,7 +1989,7 @@ relock:
- info->si_signo = signr;
- info->si_errno = 0;
- info->si_code = SI_USER;
-- info->si_pid = current->parent->pid;
-+ info->si_pid = virt_pid(current->parent);
- info->si_uid = current->parent->uid;
- }
-
-@@ -1967,8 +2020,14 @@ relock:
- continue;
-
- /* Init gets no signals it doesn't want. */
-- if (current->pid == 1)
-+ if (virt_pid(current) == 1) {
-+ /* Allow SIGKILL for non-root VE */
-+#ifdef CONFIG_VE
-+ if (current->pid == 1 ||
-+ signr != SIGKILL)
-+#endif
- continue;
-+ }
-
- if (sig_kernel_stop(signr)) {
- /*
-@@ -2324,7 +2383,7 @@ sys_kill(int pid, int sig)
- info.si_signo = sig;
- info.si_errno = 0;
- info.si_code = SI_USER;
-- info.si_pid = current->tgid;
-+ info.si_pid = virt_tgid(current);
- info.si_uid = current->uid;
-
- return kill_something_info(sig, &info, pid);
-@@ -2353,13 +2412,13 @@ asmlinkage long sys_tgkill(int tgid, int
- info.si_signo = sig;
- info.si_errno = 0;
- info.si_code = SI_TKILL;
-- info.si_pid = current->tgid;
-+ info.si_pid = virt_tgid(current);
- info.si_uid = current->uid;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- error = -ESRCH;
-- if (p && (p->tgid == tgid)) {
-+ if (p && (virt_tgid(p) == tgid)) {
- error = check_kill_permission(sig, &info, p);
- /*
- * The null signal is a permissions and process existence
-@@ -2393,11 +2452,11 @@ sys_tkill(int pid, int sig)
- info.si_signo = sig;
- info.si_errno = 0;
- info.si_code = SI_TKILL;
-- info.si_pid = current->tgid;
-+ info.si_pid = virt_tgid(current);
- info.si_uid = current->uid;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- error = -ESRCH;
- if (p) {
- error = check_kill_permission(sig, &info, p);
-@@ -2435,7 +2494,7 @@ sys_rt_sigqueueinfo(int pid, int sig, si
- }
-
- int
--do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
-+do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
- {
- struct k_sigaction *k;
-
-@@ -2458,6 +2517,8 @@ do_sigaction(int sig, const struct k_sig
- *oact = *k;
-
- if (act) {
-+ sigdelsetmask(&act->sa.sa_mask,
-+ sigmask(SIGKILL) | sigmask(SIGSTOP));
- /*
- * POSIX 3.3.1.3:
- * "Setting a signal action to SIG_IGN for a signal that is
-@@ -2483,8 +2544,6 @@ do_sigaction(int sig, const struct k_sig
- read_lock(&tasklist_lock);
- spin_lock_irq(&t->sighand->siglock);
- *k = *act;
-- sigdelsetmask(&k->sa.sa_mask,
-- sigmask(SIGKILL) | sigmask(SIGSTOP));
- rm_from_queue(sigmask(sig), &t->signal->shared_pending);
- do {
- rm_from_queue(sigmask(sig), &t->pending);
-@@ -2497,8 +2556,6 @@ do_sigaction(int sig, const struct k_sig
- }
-
- *k = *act;
-- sigdelsetmask(&k->sa.sa_mask,
-- sigmask(SIGKILL) | sigmask(SIGSTOP));
- }
-
- spin_unlock_irq(&current->sighand->siglock);
-@@ -2704,6 +2761,7 @@ sys_signal(int sig, __sighandler_t handl
-
- new_sa.sa.sa_handler = handler;
- new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
-+ sigemptyset(&new_sa.sa.sa_mask);
-
- ret = do_sigaction(sig, &new_sa, &old_sa);
-
-@@ -2729,5 +2787,5 @@ void __init signals_init(void)
- kmem_cache_create("sigqueue",
- sizeof(struct sigqueue),
- __alignof__(struct sigqueue),
-- SLAB_PANIC, NULL, NULL);
-+ SLAB_PANIC|SLAB_UBC, NULL, NULL);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/softirq.c linux-2.6.9-ve023stab030/kernel/softirq.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/softirq.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/softirq.c 2006-10-11 19:07:57.000000000 +0400
-@@ -16,8 +16,10 @@
- #include <linux/cpu.h>
- #include <linux/kthread.h>
- #include <linux/rcupdate.h>
-+#include <linux/sysctl.h>
-
- #include <asm/irq.h>
-+#include <ub/beancounter.h>
- /*
- - No shared variables, all the data are CPU local.
- - If a softirq needs serialization, let it serialize itself
-@@ -44,6 +46,8 @@ EXPORT_SYMBOL(irq_stat);
- static struct softirq_action softirq_vec[32] __cacheline_aligned_in_smp;
-
- static DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
-+static DEFINE_PER_CPU(struct task_struct *, ksoftirqd_wakeup);
-+static int ksoftirqd_stat[NR_CPUS];
-
- /*
- * we cannot loop indefinitely here to avoid userspace starvation,
-@@ -54,7 +58,7 @@ static DEFINE_PER_CPU(struct task_struct
- static inline void wakeup_softirqd(void)
- {
- /* Interrupts are disabled: no need to stop preemption */
-- struct task_struct *tsk = __get_cpu_var(ksoftirqd);
-+ struct task_struct *tsk = __get_cpu_var(ksoftirqd_wakeup);
-
- if (tsk && tsk->state != TASK_RUNNING)
- wake_up_process(tsk);
-@@ -77,10 +81,13 @@ asmlinkage void __do_softirq(void)
- __u32 pending;
- int max_restart = MAX_SOFTIRQ_RESTART;
- int cpu;
-+ struct user_beancounter *old_exec_ub;
-+ struct ve_struct *envid;
-
- pending = local_softirq_pending();
-
- local_bh_disable();
-+ envid = set_exec_env(get_ve0());
- cpu = smp_processor_id();
- restart:
- /* Reset the pending bitmask before enabling irqs */
-@@ -90,6 +97,8 @@ restart:
-
- h = softirq_vec;
-
-+ old_exec_ub = set_exec_ub(get_ub0());
-+
- do {
- if (pending & 1) {
- h->action(h);
-@@ -99,6 +108,8 @@ restart:
- pending >>= 1;
- } while (pending);
-
-+ (void)set_exec_ub(old_exec_ub);
-+
- local_irq_disable();
-
- pending = local_softirq_pending();
-@@ -108,6 +119,7 @@ restart:
- if (pending)
- wakeup_softirqd();
-
-+ (void)set_exec_env(envid);
- __local_bh_enable();
- }
-
-@@ -486,6 +498,52 @@ static int __devinit cpu_callback(struct
- return NOTIFY_OK;
- }
-
-+static int proc_ksoftirqd(ctl_table *ctl, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ int ret, cpu;
-+
-+ ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
-+ if (!write)
-+ return ret;
-+
-+ for_each_online_cpu(cpu) {
-+ per_cpu(ksoftirqd_wakeup, cpu) =
-+ ksoftirqd_stat[cpu] ? per_cpu(ksoftirqd, cpu) : NULL;
-+ }
-+ return ret;
-+}
-+
-+static int sysctl_ksoftirqd(ctl_table *table, int *name, int nlen,
-+ void *oldval, size_t *oldlenp, void *newval, size_t newlen,
-+ void **context)
-+{
-+ return -EINVAL;
-+}
-+
-+static ctl_table debug_table[] = {
-+ {
-+ .ctl_name = 1246,
-+ .procname = "ksoftirqd",
-+ .data = ksoftirqd_stat,
-+ .maxlen = sizeof(ksoftirqd_stat),
-+ .mode = 0644,
-+ .proc_handler = &proc_ksoftirqd,
-+ .strategy = &sysctl_ksoftirqd
-+ },
-+ {0}
-+};
-+
-+static ctl_table root_table[] = {
-+ {
-+ .ctl_name = CTL_DEBUG,
-+ .procname = "debug",
-+ .mode = 0555,
-+ .child = debug_table
-+ },
-+ {0}
-+};
-+
- static struct notifier_block __devinitdata cpu_nfb = {
- .notifier_call = cpu_callback
- };
-@@ -496,5 +554,6 @@ __init int spawn_ksoftirqd(void)
- cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
- cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
- register_cpu_notifier(&cpu_nfb);
-+ register_sysctl_table(root_table, 0);
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/stop_machine.c linux-2.6.9-ve023stab030/kernel/stop_machine.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/stop_machine.c 2004-10-19 01:53:10.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/stop_machine.c 2006-10-11 19:08:02.000000000 +0400
-@@ -6,11 +6,36 @@
- #include <linux/syscalls.h>
- #include <asm/atomic.h>
- #include <asm/semaphore.h>
-+#include <asm/uaccess.h>
-
- /* Since we effect priority and affinity (both of which are visible
- * to, and settable by outside processes) we do indirection via a
- * kthread. */
-
-+struct stop_machine_task {
-+ struct list_head list;
-+ struct task_struct *task;
-+ unsigned int state;
-+ unsigned int data[2];
-+};
-+
-+static struct list_head sm_queue = LIST_HEAD_INIT(sm_queue);
-+static spinlock_t sm_lock = SPIN_LOCK_UNLOCKED;
-+
-+static inline void sm_add(struct stop_machine_task *smt)
-+{
-+ spin_lock(&sm_lock);
-+ list_add(&smt->list, &sm_queue);
-+ spin_unlock(&sm_lock);
-+}
-+
-+static inline void sm_del(struct stop_machine_task *smt)
-+{
-+ spin_lock(&sm_lock);
-+ list_del(&smt->list);
-+ spin_unlock(&sm_lock);
-+}
-+
- /* Thread to stop each CPU in user context. */
- enum stopmachine_state {
- STOPMACHINE_WAIT,
-@@ -19,15 +44,65 @@ enum stopmachine_state {
- STOPMACHINE_EXIT,
- };
-
-+enum {
-+ SM_SLAVE_INIT,
-+ SM_SLAVE_EXIT,
-+
-+ SM_STOPPER_FORKING,
-+ SM_STOPPER_WAITING,
-+ SM_STOPPER_READY,
-+ SM_STOPPER_INIT,
-+ SM_STOPPER_WORK,
-+ SM_STOPPER_RESTART,
-+ SM_STOPPER_OK,
-+ SM_STOPPER_ERR,
-+
-+ SM_CALLER_INIT,
-+ SM_CALLER_LOCKED,
-+ SM_CALLER_WAIT,
-+};
-+
- static enum stopmachine_state stopmachine_state;
- static unsigned int stopmachine_num_threads;
- static atomic_t stopmachine_thread_ack;
- static DECLARE_MUTEX(stopmachine_mutex);
-
-+void stop_machine_show_state(void)
-+{
-+ struct stop_machine_task *smt;
-+ struct task_struct *tsk;
-+
-+ printk(" state: %d\n", stopmachine_state);
-+ printk(" num threads: %d\n", stopmachine_num_threads);
-+
-+ spin_lock(&sm_lock);
-+ list_for_each_entry (smt, &sm_queue, list) {
-+ tsk = smt->task;
-+ printk(" task %d (%p) state %ld: pcpu %d vcpu %d vsched %d"
-+ " sm_state %d (data %d %d)\n",
-+ tsk->pid,
-+ tsk,
-+ tsk->state,
-+ task_pcpu(tsk),
-+ task_cpu(tsk),
-+ task_vsched_id(tsk),
-+ smt->state,
-+ smt->data[0],
-+ smt->data[1]);
-+ }
-+ spin_unlock(&sm_lock);
-+}
-+
- static int stopmachine(void *cpu)
- {
- int irqs_disabled = 0;
- int prepared = 0;
-+ struct stop_machine_task smt;
-+
-+ smt.state = SM_SLAVE_INIT;
-+ smt.task = current;
-+ smt.data[0] = smt.data[1] = 0;
-+ sm_add(&smt);
-
- set_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu));
-
-@@ -52,9 +127,16 @@ static int stopmachine(void *cpu)
- mb(); /* Must read state first. */
- atomic_inc(&stopmachine_thread_ack);
- }
-- cpu_relax();
-+ /* Yield in first stage: migration threads need to
-+ * help our sisters onto their CPUs. */
-+ if (!prepared && !irqs_disabled)
-+ yield();
-+ else
-+ cpu_relax();
- }
-
-+ smt.state = SM_SLAVE_EXIT;
-+
- /* Ack: we are exiting. */
- mb(); /* Must read state first. */
- atomic_inc(&stopmachine_thread_ack);
-@@ -64,6 +146,7 @@ static int stopmachine(void *cpu)
- if (prepared)
- preempt_enable();
-
-+ sm_del(&smt);
- return 0;
- }
-
-@@ -77,20 +160,28 @@ static void stopmachine_set_state(enum s
- cpu_relax();
- }
-
--static int stop_machine(void)
-+static int stop_machine(struct stop_machine_task *smt)
- {
- int i, ret = 0;
- struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
-+ mm_segment_t old_fs = get_fs();
-
- /* One high-prio thread per cpu. We'll do this one. */
-- sys_sched_setscheduler(current->pid, SCHED_FIFO, &param);
-+ set_fs(KERNEL_DS);
-+ sys_sched_setscheduler(current->pid, SCHED_FIFO,
-+ (struct sched_param __user *)&param);
-+ set_fs(old_fs);
-
- atomic_set(&stopmachine_thread_ack, 0);
- stopmachine_num_threads = 0;
- stopmachine_state = STOPMACHINE_WAIT;
-
-+ smt->data[0] = task_cpu(current);
-+ smt->data[1] = task_pcpu(current);
-+ smt->state = SM_STOPPER_FORKING;
-+
- for_each_online_cpu(i) {
-- if (i == smp_processor_id())
-+ if (i == task_cpu(current))
- continue;
- ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL);
- if (ret < 0)
-@@ -99,9 +190,12 @@ static int stop_machine(void)
- }
-
- /* Wait for them all to come to life. */
-+ smt->state = SM_STOPPER_WAITING;
- while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)
- yield();
-
-+ smt->state = SM_STOPPER_READY;
-+
- /* If some failed, kill them all. */
- if (ret < 0) {
- stopmachine_set_state(STOPMACHINE_EXIT);
-@@ -109,13 +203,12 @@ static int stop_machine(void)
- return ret;
- }
-
-- /* Don't schedule us away at this point, please. */
-- local_irq_disable();
--
- /* Now they are all started, make them hold the CPUs, ready. */
-+ preempt_disable();
- stopmachine_set_state(STOPMACHINE_PREPARE);
-
- /* Make them disable irqs. */
-+ local_irq_disable();
- stopmachine_set_state(STOPMACHINE_DISABLE_IRQ);
-
- return 0;
-@@ -125,6 +218,7 @@ static void restart_machine(void)
- {
- stopmachine_set_state(STOPMACHINE_EXIT);
- local_irq_enable();
-+ preempt_enable_no_resched();
- }
-
- struct stop_machine_data
-@@ -138,12 +232,22 @@ static int do_stop(void *_smdata)
- {
- struct stop_machine_data *smdata = _smdata;
- int ret;
-+ struct stop_machine_task smt;
-+
-+ smt.state = SM_STOPPER_INIT;
-+ smt.task = current;
-+ smt.data[0] = smt.data[1] = 0;
-+ sm_add(&smt);
-
-- ret = stop_machine();
-+ ret = stop_machine(&smt);
- if (ret == 0) {
-+ smt.state = SM_STOPPER_WORK;
- ret = smdata->fn(smdata->data);
-+ smt.state = SM_STOPPER_RESTART;
- restart_machine();
-- }
-+ smt.state = SM_STOPPER_OK;
-+ } else
-+ smt.state = SM_STOPPER_ERR;
-
- /* We're done: you can kthread_stop us now */
- complete(&smdata->done);
-@@ -151,10 +255,13 @@ static int do_stop(void *_smdata)
- /* Wait for kthread_stop */
- set_current_state(TASK_INTERRUPTIBLE);
- while (!kthread_should_stop()) {
-+ smt.data[0]++;
- schedule();
- set_current_state(TASK_INTERRUPTIBLE);
- }
- __set_current_state(TASK_RUNNING);
-+
-+ sm_del(&smt);
- return ret;
- }
-
-@@ -163,6 +270,12 @@ struct task_struct *__stop_machine_run(i
- {
- struct stop_machine_data smdata;
- struct task_struct *p;
-+ struct stop_machine_task smt;
-+
-+ smt.state = SM_CALLER_INIT;
-+ smt.task = current;
-+ smt.data[0] = smt.data[1] = 0;
-+ sm_add(&smt);
-
- smdata.fn = fn;
- smdata.data = data;
-@@ -170,6 +283,8 @@ struct task_struct *__stop_machine_run(i
-
- down(&stopmachine_mutex);
-
-+ smt.state = SM_CALLER_LOCKED;
-+
- /* If they don't care which CPU fn runs on, bind to any online one. */
- if (cpu == NR_CPUS)
- cpu = smp_processor_id();
-@@ -178,9 +293,13 @@ struct task_struct *__stop_machine_run(i
- if (!IS_ERR(p)) {
- kthread_bind(p, cpu);
- wake_up_process(p);
-+
-+ smt.state = SM_CALLER_WAIT;
- wait_for_completion(&smdata.done);
- }
- up(&stopmachine_mutex);
-+
-+ sm_del(&smt);
- return p;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/sys.c linux-2.6.9-ve023stab030/kernel/sys.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/sys.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/sys.c 2006-10-11 19:07:59.000000000 +0400
-@@ -12,6 +12,7 @@
- #include <linux/mman.h>
- #include <linux/smp_lock.h>
- #include <linux/notifier.h>
-+#include <linux/virtinfo.h>
- #include <linux/reboot.h>
- #include <linux/prctl.h>
- #include <linux/init.h>
-@@ -215,6 +216,102 @@ int unregister_reboot_notifier(struct no
-
- EXPORT_SYMBOL(unregister_reboot_notifier);
-
-+DECLARE_MUTEX(virtinfo_sem);
-+EXPORT_SYMBOL(virtinfo_sem);
-+static struct vnotifier_block *virtinfo_chain[VIRT_TYPES];
-+
-+void __virtinfo_notifier_register(int type, struct vnotifier_block *nb)
-+{
-+ struct vnotifier_block **p;
-+
-+ for (p = &virtinfo_chain[type];
-+ *p != NULL && nb->priority < (*p)->priority;
-+ p = &(*p)->next);
-+ nb->next = *p;
-+ smp_wmb();
-+ *p = nb;
-+}
-+
-+EXPORT_SYMBOL(__virtinfo_notifier_register);
-+
-+void virtinfo_notifier_register(int type, struct vnotifier_block *nb)
-+{
-+ down(&virtinfo_sem);
-+ __virtinfo_notifier_register(type, nb);
-+ up(&virtinfo_sem);
-+}
-+
-+EXPORT_SYMBOL(virtinfo_notifier_register);
-+
-+struct virtinfo_cnt_struct {
-+ volatile unsigned long exit[NR_CPUS];
-+ volatile unsigned long entry;
-+};
-+static DEFINE_PER_CPU(struct virtinfo_cnt_struct, virtcnt);
-+
-+void virtinfo_notifier_unregister(int type, struct vnotifier_block *nb)
-+{
-+ struct vnotifier_block **p;
-+ int entry_cpu, exit_cpu;
-+ unsigned long cnt, ent;
-+
-+ down(&virtinfo_sem);
-+ for (p = &virtinfo_chain[type]; *p != nb; p = &(*p)->next);
-+ *p = nb->next;
-+ smp_mb();
-+
-+ for_each_cpu_mask(entry_cpu, cpu_possible_map) {
-+ while (1) {
-+ cnt = 0;
-+ for_each_cpu_mask(exit_cpu, cpu_possible_map)
-+ cnt +=
-+ per_cpu(virtcnt, entry_cpu).exit[exit_cpu];
-+ smp_rmb();
-+ ent = per_cpu(virtcnt, entry_cpu).entry;
-+ if (cnt == ent)
-+ break;
-+ __set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ / 100);
-+ }
-+ }
-+ up(&virtinfo_sem);
-+}
-+
-+EXPORT_SYMBOL(virtinfo_notifier_unregister);
-+
-+int virtinfo_notifier_call(int type, unsigned long n, void *data)
-+{
-+ int ret;
-+ int entry_cpu, exit_cpu;
-+ struct vnotifier_block *nb;
-+
-+ entry_cpu = get_cpu();
-+ per_cpu(virtcnt, entry_cpu).entry++;
-+ smp_wmb();
-+ put_cpu();
-+
-+ nb = virtinfo_chain[type];
-+ ret = NOTIFY_DONE;
-+ while (nb)
-+ {
-+ ret = nb->notifier_call(nb, n, data, ret);
-+ if(ret & NOTIFY_STOP_MASK) {
-+ ret &= ~NOTIFY_STOP_MASK;
-+ break;
-+ }
-+ nb = nb->next;
-+ }
-+
-+ exit_cpu = get_cpu();
-+ smp_wmb();
-+ per_cpu(virtcnt, entry_cpu).exit[exit_cpu]++;
-+ put_cpu();
-+
-+ return ret;
-+}
-+
-+EXPORT_SYMBOL(virtinfo_notifier_call);
-+
- asmlinkage long sys_ni_syscall(void)
- {
- return -ENOSYS;
-@@ -282,7 +379,9 @@ cond_syscall(compat_set_mempolicy)
- cond_syscall(sys_add_key);
- cond_syscall(sys_request_key);
- cond_syscall(sys_keyctl);
-+#ifdef CONFIG_KEYS_COMPAT
- cond_syscall(compat_sys_keyctl);
-+#endif
-
- /* arch-specific weak syscall entries */
- cond_syscall(sys_pciconfig_read)
-@@ -334,17 +433,19 @@ asmlinkage long sys_setpriority(int whic
- switch (which) {
- case PRIO_PROCESS:
- if (!who)
-- who = current->pid;
-- p = find_task_by_pid(who);
-+ who = virt_pid(current);
-+ p = find_task_by_pid_ve(who);
- if (p)
- error = set_one_prio(p, niceval, error);
- break;
- case PRIO_PGRP:
- if (!who)
- who = process_group(current);
-- do_each_task_pid(who, PIDTYPE_PGID, p) {
-+ else
-+ who = vpid_to_pid(who);
-+ do_each_task_pid_ve(who, PIDTYPE_PGID, p) {
- error = set_one_prio(p, niceval, error);
-- } while_each_task_pid(who, PIDTYPE_PGID, p);
-+ } while_each_task_pid_ve(who, PIDTYPE_PGID, p);
- break;
- case PRIO_USER:
- user = current->user;
-@@ -354,10 +455,10 @@ asmlinkage long sys_setpriority(int whic
- if ((who != current->uid) && !(user = find_user(who)))
- goto out_unlock; /* No processes for this user */
-
-- do_each_thread(g, p)
-+ do_each_thread_ve(g, p) {
- if (p->uid == who)
- error = set_one_prio(p, niceval, error);
-- while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- if (who != current->uid)
- free_uid(user); /* For find_user() */
- break;
-@@ -387,8 +488,8 @@ asmlinkage long sys_getpriority(int whic
- switch (which) {
- case PRIO_PROCESS:
- if (!who)
-- who = current->pid;
-- p = find_task_by_pid(who);
-+ who = virt_pid(current);
-+ p = find_task_by_pid_ve(who);
- if (p) {
- niceval = 20 - task_nice(p);
- if (niceval > retval)
-@@ -398,11 +499,13 @@ asmlinkage long sys_getpriority(int whic
- case PRIO_PGRP:
- if (!who)
- who = process_group(current);
-- do_each_task_pid(who, PIDTYPE_PGID, p) {
-+ else
-+ who = vpid_to_pid(who);
-+ do_each_task_pid_ve(who, PIDTYPE_PGID, p) {
- niceval = 20 - task_nice(p);
- if (niceval > retval)
- retval = niceval;
-- } while_each_task_pid(who, PIDTYPE_PGID, p);
-+ } while_each_task_pid_ve(who, PIDTYPE_PGID, p);
- break;
- case PRIO_USER:
- user = current->user;
-@@ -412,13 +515,13 @@ asmlinkage long sys_getpriority(int whic
- if ((who != current->uid) && !(user = find_user(who)))
- goto out_unlock; /* No processes for this user */
-
-- do_each_thread(g, p)
-+ do_each_thread_ve(g, p) {
- if (p->uid == who) {
- niceval = 20 - task_nice(p);
- if (niceval > retval)
- retval = niceval;
- }
-- while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- if (who != current->uid)
- free_uid(user); /* for find_user() */
- break;
-@@ -454,6 +557,35 @@ asmlinkage long sys_reboot(int magic1, i
- magic2 != LINUX_REBOOT_MAGIC2C))
- return -EINVAL;
-
-+#ifdef CONFIG_VE
-+ if (!ve_is_super(get_exec_env()))
-+ switch (cmd) {
-+ case LINUX_REBOOT_CMD_RESTART:
-+ case LINUX_REBOOT_CMD_HALT:
-+ case LINUX_REBOOT_CMD_POWER_OFF:
-+ case LINUX_REBOOT_CMD_RESTART2: {
-+ struct siginfo info;
-+
-+ info.si_errno = 0;
-+ info.si_code = SI_KERNEL;
-+ info.si_pid = virt_pid(current);
-+ info.si_uid = current->uid;
-+ info.si_signo = SIGKILL;
-+
-+ /* Sending to real init is safe */
-+ send_sig_info(SIGKILL, &info,
-+ get_exec_env()->init_entry);
-+ }
-+
-+ case LINUX_REBOOT_CMD_CAD_ON:
-+ case LINUX_REBOOT_CMD_CAD_OFF:
-+ return 0;
-+
-+ default:
-+ return -EINVAL;
-+ }
-+#endif
-+
- lock_kernel();
- switch (cmd) {
- case LINUX_REBOOT_CMD_RESTART:
-@@ -646,7 +778,7 @@ asmlinkage long sys_setgid(gid_t gid)
- return 0;
- }
-
--static int set_user(uid_t new_ruid, int dumpclear)
-+int set_user(uid_t new_ruid, int dumpclear)
- {
- struct user_struct *new_user;
-
-@@ -671,6 +803,7 @@ static int set_user(uid_t new_ruid, int
- current->uid = new_ruid;
- return 0;
- }
-+EXPORT_SYMBOL(set_user);
-
- /*
- * Unprivileged users may change the real uid to the effective uid
-@@ -953,8 +1086,26 @@ asmlinkage long sys_setfsgid(gid_t gid)
- return old_fsgid;
- }
-
-+#ifdef CONFIG_VE
-+unsigned long long ve_relative_clock(struct timespec * ts)
-+{
-+ unsigned long long offset = 0;
-+
-+ if (ts->tv_sec > get_exec_env()->start_timespec.tv_sec ||
-+ (ts->tv_sec == get_exec_env()->start_timespec.tv_sec &&
-+ ts->tv_nsec >= get_exec_env()->start_timespec.tv_nsec))
-+ offset = (unsigned long long)(ts->tv_sec -
-+ get_exec_env()->start_timespec.tv_sec) * NSEC_PER_SEC
-+ + ts->tv_nsec - get_exec_env()->start_timespec.tv_nsec;
-+ return nsec_to_clock_t(offset);
-+}
-+#endif
-+
- asmlinkage long sys_times(struct tms __user * tbuf)
- {
-+#ifdef CONFIG_VE
-+ struct timespec now;
-+#endif
- /*
- * In the SMP world we might just be unlucky and have one of
- * the times increment as we use it. Since the value is an
-@@ -999,7 +1150,12 @@ asmlinkage long sys_times(struct tms __u
- if (copy_to_user(tbuf, &tmp, sizeof(struct tms)))
- return -EFAULT;
- }
-+#ifndef CONFIG_VE
- return (long) jiffies_64_to_clock_t(get_jiffies_64());
-+#else
-+ do_posix_clock_monotonic_gettime(&now);
-+ return ve_relative_clock(&now);
-+#endif
- }
-
- /*
-@@ -1019,21 +1175,24 @@ asmlinkage long sys_setpgid(pid_t pid, p
- {
- struct task_struct *p;
- int err = -EINVAL;
-+ pid_t _pgid;
-
- if (!pid)
-- pid = current->pid;
-+ pid = virt_pid(current);
- if (!pgid)
- pgid = pid;
- if (pgid < 0)
- return -EINVAL;
-
-+ _pgid = vpid_to_pid(pgid);
-+
- /* From this point forward we keep holding onto the tasklist lock
- * so that our parent does not change from under us. -DaveM
- */
- write_lock_irq(&tasklist_lock);
-
- err = -ESRCH;
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- if (!p)
- goto out;
-
-@@ -1058,25 +1217,35 @@ asmlinkage long sys_setpgid(pid_t pid, p
- if (p->signal->leader)
- goto out;
-
-- if (pgid != pid) {
-+ pgid = virt_pid(p);
-+ if (_pgid != p->pid) {
- struct task_struct *p;
-
-- do_each_task_pid(pgid, PIDTYPE_PGID, p) {
-- if (p->signal->session == current->signal->session)
-+ do_each_task_pid_ve(_pgid, PIDTYPE_PGID, p) {
-+ if (p->signal->session == current->signal->session) {
-+ pgid = virt_pgid(p);
- goto ok_pgid;
-- } while_each_task_pid(pgid, PIDTYPE_PGID, p);
-+ }
-+ } while_each_task_pid_ve(_pgid, PIDTYPE_PGID, p);
- goto out;
- }
-
- ok_pgid:
-- err = security_task_setpgid(p, pgid);
-+ err = security_task_setpgid(p, _pgid);
- if (err)
- goto out;
-
-- if (process_group(p) != pgid) {
-+ if (process_group(p) != _pgid) {
- detach_pid(p, PIDTYPE_PGID);
-- p->signal->pgrp = pgid;
-- attach_pid(p, PIDTYPE_PGID, pgid);
-+ p->signal->pgrp = _pgid;
-+ set_virt_pgid(p, pgid);
-+ attach_pid(p, PIDTYPE_PGID, _pgid);
-+ if (atomic_read(&p->signal->count) != 1) {
-+ task_t *t;
-+ for (t = next_thread(p); t != p; t = next_thread(t)) {
-+ set_virt_pgid(t, pgid);
-+ }
-+ }
- }
-
- err = 0;
-@@ -1089,19 +1258,19 @@ out:
- asmlinkage long sys_getpgid(pid_t pid)
- {
- if (!pid) {
-- return process_group(current);
-+ return virt_pgid(current);
- } else {
- int retval;
- struct task_struct *p;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
-
- retval = -ESRCH;
- if (p) {
- retval = security_task_getpgid(p);
- if (!retval)
-- retval = process_group(p);
-+ retval = virt_pgid(p);
- }
- read_unlock(&tasklist_lock);
- return retval;
-@@ -1113,7 +1282,7 @@ asmlinkage long sys_getpgid(pid_t pid)
- asmlinkage long sys_getpgrp(void)
- {
- /* SMP - assuming writes are word atomic this is fine */
-- return process_group(current);
-+ return virt_pgid(current);
- }
-
- #endif
-@@ -1121,19 +1290,19 @@ asmlinkage long sys_getpgrp(void)
- asmlinkage long sys_getsid(pid_t pid)
- {
- if (!pid) {
-- return current->signal->session;
-+ return virt_sid(current);
- } else {
- int retval;
- struct task_struct *p;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
-
- retval = -ESRCH;
- if(p) {
- retval = security_task_getsid(p);
- if (!retval)
-- retval = p->signal->session;
-+ retval = virt_sid(p);
- }
- read_unlock(&tasklist_lock);
- return retval;
-@@ -1157,9 +1326,19 @@ asmlinkage long sys_setsid(void)
-
- current->signal->leader = 1;
- __set_special_pids(current->pid, current->pid);
-+ set_virt_pgid(current, virt_pid(current));
-+ set_virt_sid(current, virt_pid(current));
- current->signal->tty = NULL;
- current->signal->tty_old_pgrp = 0;
-- err = process_group(current);
-+ if (atomic_read(&current->signal->count) != 1) {
-+ task_t *t;
-+ for (t = next_thread(current); t != current; t = next_thread(t)) {
-+ set_virt_pgid(t, virt_pid(current));
-+ set_virt_sid(t, virt_pid(current));
-+ }
-+ }
-+
-+ err = virt_pgid(current);
- out:
- write_unlock_irq(&tasklist_lock);
- up(&tty_sem);
-@@ -1439,7 +1618,7 @@ asmlinkage long sys_newuname(struct new_
- int errno = 0;
-
- down_read(&uts_sem);
-- if (copy_to_user(name,&system_utsname,sizeof *name))
-+ if (copy_to_user(name,&ve_utsname,sizeof *name))
- errno = -EFAULT;
- up_read(&uts_sem);
- return errno;
-@@ -1450,15 +1629,15 @@ asmlinkage long sys_sethostname(char __u
- int errno;
- char tmp[__NEW_UTS_LEN];
-
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
- if (len < 0 || len > __NEW_UTS_LEN)
- return -EINVAL;
- down_write(&uts_sem);
- errno = -EFAULT;
- if (!copy_from_user(tmp, name, len)) {
-- memcpy(system_utsname.nodename, tmp, len);
-- system_utsname.nodename[len] = 0;
-+ memcpy(ve_utsname.nodename, tmp, len);
-+ ve_utsname.nodename[len] = 0;
- errno = 0;
- }
- up_write(&uts_sem);
-@@ -1474,11 +1653,11 @@ asmlinkage long sys_gethostname(char __u
- if (len < 0)
- return -EINVAL;
- down_read(&uts_sem);
-- i = 1 + strlen(system_utsname.nodename);
-+ i = 1 + strlen(ve_utsname.nodename);
- if (i > len)
- i = len;
- errno = 0;
-- if (copy_to_user(name, system_utsname.nodename, i))
-+ if (copy_to_user(name, ve_utsname.nodename, i))
- errno = -EFAULT;
- up_read(&uts_sem);
- return errno;
-@@ -1495,7 +1674,7 @@ asmlinkage long sys_setdomainname(char _
- int errno;
- char tmp[__NEW_UTS_LEN];
-
-- if (!capable(CAP_SYS_ADMIN))
-+ if (!capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
- if (len < 0 || len > __NEW_UTS_LEN)
- return -EINVAL;
-@@ -1503,8 +1682,8 @@ asmlinkage long sys_setdomainname(char _
- down_write(&uts_sem);
- errno = -EFAULT;
- if (!copy_from_user(tmp, name, len)) {
-- memcpy(system_utsname.domainname, tmp, len);
-- system_utsname.domainname[len] = 0;
-+ memcpy(ve_utsname.domainname, tmp, len);
-+ ve_utsname.domainname[len] = 0;
- errno = 0;
- }
- up_write(&uts_sem);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/sysctl.c linux-2.6.9-ve023stab030/kernel/sysctl.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/sysctl.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/sysctl.c 2006-10-11 19:08:01.000000000 +0400
-@@ -25,6 +25,8 @@
- #include <linux/slab.h>
- #include <linux/sysctl.h>
- #include <linux/proc_fs.h>
-+#include <linux/ve_owner.h>
-+#include <linux/ve.h>
- #include <linux/ctype.h>
- #include <linux/utsname.h>
- #include <linux/capability.h>
-@@ -60,6 +62,7 @@ extern int sysctl_overcommit_ratio;
- extern int max_threads;
- extern int sysrq_enabled;
- extern int core_uses_pid;
-+extern int sysctl_at_vsyscall;
- extern int suid_dumpable;
- extern char core_pattern[];
- extern int cad_pid;
-@@ -70,6 +73,10 @@ extern int printk_ratelimit_jiffies;
- extern int printk_ratelimit_burst;
- extern int percpu_pagelist_fraction;
- extern int wake_balance;
-+#ifdef CONFIG_VE
-+int glob_virt_pids = 1;
-+EXPORT_SYMBOL(glob_virt_pids);
-+#endif
-
- #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
- int unknown_nmi_panic;
-@@ -125,6 +132,10 @@ extern int msg_ctlmnb;
- extern int msg_ctlmni;
- extern int sem_ctls[];
- #endif
-+#ifdef CONFIG_SCHED_VCPU
-+extern u32 vcpu_sched_timeslice;
-+extern u32 vcpu_timeslice;
-+#endif
-
- #ifdef __sparc__
- extern char reboot_command [];
-@@ -145,15 +156,21 @@ extern int sysctl_userprocess_debug;
- #endif
-
- extern int sysctl_hz_timer;
-+int decode_call_traces = 1;
-
- #ifdef CONFIG_BSD_PROCESS_ACCT
- extern int acct_parm[];
- #endif
-
-+#ifdef CONFIG_FAIRSCHED
-+extern int fairsched_max_latency;
-+extern int scale_vcpu_frequency;
-+int fsch_sysctl_latency(ctl_table *ctl, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos);
-+#endif
-+
- static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
- ctl_table *, void **);
--static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-- void __user *buffer, size_t *lenp, loff_t *ppos);
-
- static ctl_table root_table[];
- static struct ctl_table_header root_table_header =
-@@ -173,6 +190,8 @@ extern ctl_table random_table[];
- extern ctl_table pty_table[];
- #endif
-
-+extern int ve_area_access_check; /* fs/namei.c */
-+
- #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
- int sysctl_legacy_va_layout;
- #endif
-@@ -195,6 +214,8 @@ extern struct proc_dir_entry *proc_sys_r
-
- static void register_proc_table(ctl_table *, struct proc_dir_entry *, void *);
- static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
-+
-+extern struct new_utsname virt_utsname;
- #endif
-
- /* The default sysctl tables: */
-@@ -294,6 +315,15 @@ static ctl_table kern_table[] = {
- .strategy = &sysctl_string,
- },
- {
-+ .ctl_name = KERN_VIRT_OSRELEASE,
-+ .procname = "virt_osrelease",
-+ .data = virt_utsname.release,
-+ .maxlen = sizeof(virt_utsname.release),
-+ .mode = 0644,
-+ .proc_handler = &proc_doutsstring,
-+ .strategy = &sysctl_string,
-+ },
-+ {
- .ctl_name = KERN_PANIC,
- .procname = "panic",
- .data = &panic_timeout,
-@@ -641,6 +671,24 @@ static ctl_table kern_table[] = {
- .proc_handler = &proc_dointvec,
- },
- #endif
-+#ifdef CONFIG_SCHED_VCPU
-+ {
-+ .ctl_name = KERN_VCPU_SCHED_TIMESLICE,
-+ .procname = "vcpu_sched_timeslice",
-+ .data = &vcpu_sched_timeslice,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = KERN_VCPU_TIMESLICE,
-+ .procname = "vcpu_timeslice",
-+ .data = &vcpu_timeslice,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+#endif
- {
- .ctl_name = KERN_PIDMAX,
- .procname = "pid_max",
-@@ -649,6 +697,16 @@ static ctl_table kern_table[] = {
- .mode = 0644,
- .proc_handler = &proc_dointvec,
- },
-+#ifdef CONFIG_VE
-+ {
-+ .ctl_name = KERN_VIRT_PIDS,
-+ .procname = "virt_pids",
-+ .data = &glob_virt_pids,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+#endif
- {
- .ctl_name = KERN_PANIC_ON_OOPS,
- .procname = "panic_on_oops",
-@@ -716,6 +774,22 @@ static ctl_table kern_table[] = {
- .mode = 0644,
- .proc_handler = &proc_dointvec,
- },
-+ {
-+ .ctl_name = KERN_SILENCE_LEVEL,
-+ .procname = "silence-level",
-+ .data = &console_silence_loglevel,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
-+ {
-+ .ctl_name = KERN_ALLOC_FAIL_WARN,
-+ .procname = "alloc_fail_warn",
-+ .data = &alloc_fail_warn,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
- { .ctl_name = 0 }
- };
-
-@@ -928,6 +1002,14 @@ static ctl_table vm_table[] = {
- .strategy = &sysctl_intvec,
- .extra1 = &min_percpu_pagelist_fract,
- },
-+ {
-+ .ctl_name = FS_AT_VSYSCALL,
-+ .procname = "vsyscall",
-+ .data = &sysctl_at_vsyscall,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
- { .ctl_name = 0 }
- };
-
-@@ -1038,10 +1120,36 @@ static ctl_table fs_table[] = {
- .mode = 0644,
- .proc_handler = &proc_dointvec,
- },
-+#ifdef CONFIG_FAIRSCHED
-+ {
-+ .ctl_name = KERN_FAIRSCHED_MAX_LATENCY,
-+ .procname = "fairsched-max-latency",
-+ .data = &fairsched_max_latency,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &fsch_sysctl_latency
-+ },
-+ {
-+ .ctl_name = KERN_SCALE_VCPU_FREQUENCY,
-+ .procname = "scale_vcpu_frequency",
-+ .data = &scale_vcpu_frequency,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+#endif
- { .ctl_name = 0 }
- };
-
- static ctl_table debug_table[] = {
-+ {
-+ .ctl_name = DBG_DECODE_CALLTRACES,
-+ .procname = "decode_call_traces",
-+ .data = &decode_call_traces,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
- { .ctl_name = 0 }
- };
-
-@@ -1106,6 +1214,7 @@ int do_sysctl(int __user *name, int nlen
- {
- struct list_head *tmp;
- int error = -ENOTDIR;
-+ struct ve_struct *ve;
-
- if (nlen <= 0 || nlen >= CTL_MAXNAME)
- return -ENOTDIR;
-@@ -1114,13 +1223,18 @@ int do_sysctl(int __user *name, int nlen
- if (!oldlenp || get_user(old_len, oldlenp))
- return -EFAULT;
- }
-+ ve = get_exec_env();
- spin_lock(&sysctl_lock);
-- tmp = &root_table_header.ctl_entry;
-+ tmp = ve->sysctl_lh.next;
- do {
-- struct ctl_table_header *head =
-- list_entry(tmp, struct ctl_table_header, ctl_entry);
-+ struct ctl_table_header *head;
- void *context = NULL;
-
-+ if (tmp == &ve->sysctl_lh)
-+ /* second pass over global variables */
-+ tmp = &root_table_header.ctl_entry;
-+
-+ head = list_entry(tmp, struct ctl_table_header, ctl_entry);
- if (!use_table(head))
- continue;
-
-@@ -1175,10 +1289,14 @@ static int test_perm(int mode, int op)
- static inline int ctl_perm(ctl_table *table, int op)
- {
- int error;
-+ int mode = table->mode;
-+
- error = security_sysctl(table, op);
- if (error)
- return error;
-- return test_perm(table->mode, op);
-+ if (!ve_accessible(table->owner_env, get_exec_env()))
-+ mode &= ~0222; /* disable write access */
-+ return test_perm(mode, op);
- }
-
- static int parse_table(int __user *name, int nlen,
-@@ -1344,6 +1462,8 @@ struct ctl_table_header *register_sysctl
- int insert_at_head)
- {
- struct ctl_table_header *tmp;
-+ struct list_head *lh;
-+
- tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
- if (!tmp)
- return NULL;
-@@ -1352,17 +1472,52 @@ struct ctl_table_header *register_sysctl
- tmp->used = 0;
- tmp->unregistering = NULL;
- spin_lock(&sysctl_lock);
-+#ifdef CONFIG_VE
-+ lh = &get_exec_env()->sysctl_lh;
-+#else
-+ lh = &root_table_header.ctl_entry;
-+#endif
- if (insert_at_head)
-- list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
-+ list_add(&tmp->ctl_entry, lh);
- else
-- list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
-+ list_add_tail(&tmp->ctl_entry, lh);
- spin_unlock(&sysctl_lock);
- #ifdef CONFIG_PROC_FS
-+#ifdef CONFIG_VE
-+ register_proc_table(table, get_exec_env()->proc_sys_root, tmp);
-+#else
- register_proc_table(table, proc_sys_root, tmp);
- #endif
-+#endif
- return tmp;
- }
-
-+void free_sysctl_clone(ctl_table *clone)
-+{
-+ kfree(clone);
-+}
-+
-+ctl_table *clone_sysctl_template(ctl_table *tmpl, int nr)
-+{
-+ int i;
-+ ctl_table *clone;
-+
-+ clone = kmalloc(nr * sizeof(ctl_table), GFP_KERNEL);
-+ if (clone == NULL)
-+ return NULL;
-+
-+ memcpy(clone, tmpl, nr * sizeof(ctl_table));
-+ for (i = 0; i < nr; i++) {
-+ if (tmpl[i].ctl_name == 0)
-+ continue;
-+ clone[i].owner_env = get_exec_env();
-+ if (tmpl[i].child == NULL)
-+ continue;
-+ clone[i].child = clone + (tmpl[i].child - tmpl);
-+ }
-+ return clone;
-+}
-+
- /**
- * unregister_sysctl_table - unregister a sysctl table hierarchy
- * @header: the header returned from register_sysctl_table
-@@ -1376,8 +1531,12 @@ void unregister_sysctl_table(struct ctl_
- spin_lock(&sysctl_lock);
- start_unregistering(header);
- #ifdef CONFIG_PROC_FS
-+#ifdef CONFIG_VE
-+ unregister_proc_table(header->ctl_table, get_exec_env()->proc_sys_root);
-+#else
- unregister_proc_table(header->ctl_table, proc_sys_root);
- #endif
-+#endif
- spin_unlock(&sysctl_lock);
- kfree(header);
- }
-@@ -1464,10 +1623,6 @@ static void unregister_proc_table(ctl_ta
- */
- de->data = NULL;
-
-- /* Don't unregister proc entries that are still being used.. */
-- if (atomic_read(&de->count))
-- continue;
--
- table->de = NULL;
- remove_proc_entry(table->procname, root);
- }
-@@ -1608,7 +1763,7 @@ int proc_dostring(ctl_table *table, int
- * to observe. Should this be in kernel/sys.c ????
- */
-
--static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-+int proc_doutsstring(ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
- int r;
-@@ -2132,7 +2287,7 @@ int proc_dostring(ctl_table *table, int
- return -ENOSYS;
- }
-
--static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-+int proc_doutsstring(ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
- return -ENOSYS;
-@@ -2185,7 +2340,6 @@ int proc_doulongvec_ms_jiffies_minmax(ct
-
- #endif /* CONFIG_PROC_FS */
-
--
- /*
- * General sysctl support routines
- */
-@@ -2387,6 +2541,14 @@ void unregister_sysctl_table(struct ctl_
- {
- }
-
-+ctl_table * clone_sysctl_template(ctl_table *tmpl, int nr)
-+{
-+ return NULL;
-+}
-+
-+void free_sysctl_clone(ctl_table *tmpl)
-+{
-+}
- #endif /* CONFIG_SYSCTL */
-
- /*
-@@ -2398,9 +2560,12 @@ EXPORT_SYMBOL(proc_dointvec_jiffies);
- EXPORT_SYMBOL(proc_dointvec_minmax);
- EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
- EXPORT_SYMBOL(proc_dostring);
-+EXPORT_SYMBOL(proc_doutsstring);
- EXPORT_SYMBOL(proc_doulongvec_minmax);
- EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
- EXPORT_SYMBOL(register_sysctl_table);
-+EXPORT_SYMBOL(clone_sysctl_template);
-+EXPORT_SYMBOL(free_sysctl_clone);
- EXPORT_SYMBOL(sysctl_intvec);
- EXPORT_SYMBOL(sysctl_jiffies);
- EXPORT_SYMBOL(sysctl_string);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/timer.c linux-2.6.9-ve023stab030/kernel/timer.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/timer.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/timer.c 2006-10-11 19:08:00.000000000 +0400
-@@ -33,6 +33,7 @@
- #include <linux/cpu.h>
- #include <linux/delay.h>
- #include <linux/diskdump.h>
-+#include <linux/virtinfo.h>
-
- #include <asm/uaccess.h>
- #include <asm/unistd.h>
-@@ -460,6 +461,7 @@ repeat:
- if (!list_empty(head)) {
- void (*fn)(unsigned long);
- unsigned long data;
-+ struct ve_struct *envid;
-
- timer = list_entry(head->next,struct timer_list,entry);
- fn = timer->function;
-@@ -472,9 +474,11 @@ repeat:
- * would cause a race with list_add
- */
- timer->base = NULL;
-+ envid = set_exec_env(get_ve0());
- spin_unlock_irqrestore(&base->lock, flags);
- fn(data);
- spin_lock_irq(&base->lock);
-+ (void)set_exec_env(envid);
- goto repeat;
- }
- }
-@@ -892,6 +896,22 @@ static unsigned long count_active_tasks(
- */
- unsigned long avenrun[3];
-
-+static void calc_load_ve(void)
-+{
-+ unsigned long flags, nr_unint;
-+
-+ nr_unint = nr_uninterruptible() * FIXED_1;
-+ spin_lock_irqsave(&kstat_glb_lock, flags);
-+ CALC_LOAD(kstat_glob.nr_unint_avg[0], EXP_1, nr_unint);
-+ CALC_LOAD(kstat_glob.nr_unint_avg[1], EXP_5, nr_unint);
-+ CALC_LOAD(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
-+ spin_unlock_irqrestore(&kstat_glb_lock, flags);
-+
-+#ifdef CONFIG_VE
-+ do_update_load_avg_ve();
-+#endif
-+}
-+
- /*
- * calc_load - given tick count, update the avenrun load estimates.
- * This is called while holding a write_lock on xtime_lock.
-@@ -908,6 +928,7 @@ static inline void calc_load(unsigned lo
- CALC_LOAD(avenrun[0], EXP_1, active_tasks);
- CALC_LOAD(avenrun[1], EXP_5, active_tasks);
- CALC_LOAD(avenrun[2], EXP_15, active_tasks);
-+ calc_load_ve();
- }
- }
-
-@@ -1019,7 +1040,7 @@ asmlinkage unsigned long sys_alarm(unsig
- */
- asmlinkage long sys_getpid(void)
- {
-- return current->tgid;
-+ return virt_tgid(current);
- }
-
- /*
-@@ -1041,28 +1062,15 @@ asmlinkage long sys_getpid(void)
- asmlinkage long sys_getppid(void)
- {
- int pid;
-- struct task_struct *me = current;
-- struct task_struct *parent;
-
-- parent = me->group_leader->real_parent;
-- for (;;) {
-- pid = parent->tgid;
--#ifdef CONFIG_SMP
--{
-- struct task_struct *old = parent;
--
-- /*
-- * Make sure we read the pid before re-reading the
-- * parent pointer:
-- */
-- rmb();
-- parent = me->group_leader->real_parent;
-- if (old != parent)
-- continue;
--}
--#endif
-- break;
-- }
-+ /* Some smart code used to be here. It was wrong.
-+ * ->real_parent could be released before dereference and
-+ * we accessed freed kernel memory, which faults with debugging on.
-+ * Keep it simple and stupid.
-+ */
-+ read_lock(&tasklist_lock);
-+ pid = virt_tgid(current->group_leader->real_parent);
-+ read_unlock(&tasklist_lock);
- return pid;
- }
-
-@@ -1186,10 +1194,10 @@ EXPORT_SYMBOL(schedule_timeout);
- /* Thread ID - the internal kernel "pid" */
- asmlinkage long sys_gettid(void)
- {
-- return current->pid;
-+ return virt_pid(current);
- }
-
--static long __sched nanosleep_restart(struct restart_block *restart)
-+long __sched nanosleep_restart(struct restart_block *restart)
- {
- unsigned long expire = restart->arg0, now = jiffies;
- struct timespec __user *rmtp = (struct timespec __user *) restart->arg1;
-@@ -1214,6 +1222,7 @@ static long __sched nanosleep_restart(st
- }
- return ret;
- }
-+EXPORT_SYMBOL(nanosleep_restart);
-
- asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
- {
-@@ -1256,11 +1265,12 @@ asmlinkage long sys_sysinfo(struct sysin
- unsigned long mem_total, sav_total;
- unsigned int mem_unit, bitcount;
- unsigned long seq;
-+ unsigned long *__avenrun;
-+ struct timespec tp;
-
- memset((char *)&val, 0, sizeof(struct sysinfo));
-
- do {
-- struct timespec tp;
- seq = read_seqbegin(&xtime_lock);
-
- /*
-@@ -1277,18 +1287,34 @@ asmlinkage long sys_sysinfo(struct sysin
- tp.tv_nsec = tp.tv_nsec - NSEC_PER_SEC;
- tp.tv_sec++;
- }
-- val.uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
--
-- val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
-- val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
-- val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
-+ } while (read_seqretry(&xtime_lock, seq));
-
-+ if (ve_is_super(get_exec_env())) {
-+ val.uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
-+ __avenrun = &avenrun[0];
- val.procs = nr_threads;
-- } while (read_seqretry(&xtime_lock, seq));
-+ }
-+#ifdef CONFIG_VE
-+ else {
-+ struct ve_struct *ve;
-+ ve = get_exec_env();
-+ __avenrun = &ve->avenrun[0];
-+ val.procs = atomic_read(&ve->pcounter);
-+ val.uptime = tp.tv_sec - ve->start_timespec.tv_sec;
-+ }
-+#endif
-+ val.loads[0] = __avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
-+ val.loads[1] = __avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
-+ val.loads[2] = __avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
-
- si_meminfo(&val);
- si_swapinfo(&val);
-
-+#ifdef CONFIG_USER_RESOURCE
-+ if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_SYSINFO, &val)
-+ & NOTIFY_FAIL)
-+ return -ENOMSG;
-+#endif
- /*
- * If the sum of all the available memory (i.e. ram + swap)
- * is less than can be stored in a 32 bit unsigned long then
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/Kconfig linux-2.6.9-ve023stab030/kernel/ub/Kconfig
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/Kconfig 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/Kconfig 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,89 @@
-+#
-+# User resources part (UBC)
-+#
-+# Copyright (C) 2005 SWsoft
-+# All rights reserved.
-+#
-+# Licensing governed by "linux/COPYING.SWsoft" file.
-+
-+menu "User resources"
-+
-+config USER_RESOURCE
-+ bool "Enable user resource accounting"
-+ default y
-+ help
-+ This patch provides accounting and allows to configure
-+ limits for user's consumption of exhaustible system resources.
-+ The most important resource controlled by this patch is unswappable
-+ memory (either mlock'ed or used by internal kernel structures and
-+ buffers). The main goal of this patch is to protect processes
-+ from running short of important resources because of an accidental
-+ misbehavior of processes or malicious activity aiming to ``kill''
-+ the system. It's worth to mention that resource limits configured
-+ by setrlimit(2) do not give an acceptable level of protection
-+ because they cover only small fraction of resources and work on a
-+ per-process basis. Per-process accounting doesn't prevent malicious
-+ users from spawning a lot of resource-consuming processes.
-+
-+config USER_RSS_ACCOUNTING
-+ bool "Account physical memory usage"
-+ default y
-+ depends on USER_RESOURCE
-+ help
-+ This allows to estimate per beancounter physical memory usage.
-+ Implemented alghorithm accounts shared pages of memory as well,
-+ dividing them by number of beancounter which use the page.
-+
-+config USER_SWAP_ACCOUNTING
-+ bool "Account swap usage"
-+ default y
-+ depends on USER_RESOURCE
-+ help
-+ This allows accounting of swap usage.
-+
-+config USER_RESOURCE_PROC
-+ bool "Report resource usage in /proc"
-+ default y
-+ depends on USER_RESOURCE
-+ help
-+ Allows a system administrator to inspect resource accounts and limits.
-+
-+config UBC_DEBUG
-+ bool "User resources debug features"
-+ default n
-+ depends on USER_RESOURCE
-+ help
-+ Enables to setup debug features for user resource accounting
-+
-+config UBC_DEBUG_KMEM
-+ bool "Debug kmemsize with cache counters"
-+ default n
-+ depends on UBC_DEBUG
-+ help
-+ Adds /proc/user_beancounters_debug entry to get statistics
-+ about cache usage of each beancounter
-+
-+config UBC_KEEP_UNUSED
-+ bool "Keep unused beancounter alive"
-+ default y
-+ depends on UBC_DEBUG
-+ help
-+ If on, unused beancounters are kept on the hash and maxheld value
-+ can be looked through.
-+
-+config UBC_DEBUG_ITEMS
-+ bool "Account resources in items rather than in bytes"
-+ default y
-+ depends on UBC_DEBUG
-+ help
-+ When true some of the resources (e.g. kmemsize) are accounted
-+ in items instead of bytes.
-+
-+config UBC_UNLIMITED
-+ bool "Use unlimited ubc settings"
-+ default y
-+ depends on UBC_DEBUG
-+ help
-+ When ON all limits and barriers are set to max values.
-+
-+endmenu
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/Makefile linux-2.6.9-ve023stab030/kernel/ub/Makefile
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/Makefile 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/Makefile 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,20 @@
-+#
-+# User resources part (UBC)
-+#
-+# Copyright (C) 2005 SWsoft
-+# All rights reserved.
-+#
-+# Licensing governed by "linux/COPYING.SWsoft" file.
-+
-+obj-y := ub_sys.o
-+obj-$(CONFIG_USER_RESOURCE) += beancounter.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_dcache.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_mem.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_misc.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_net.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_pages.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_stat.o
-+obj-$(CONFIG_USER_RESOURCE) += ub_oom.o
-+
-+obj-$(CONFIG_USER_RSS_ACCOUNTING) += ub_page_bc.o
-+obj-$(CONFIG_USER_RESOURCE_PROC) += ub_proc.o
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/beancounter.c linux-2.6.9-ve023stab030/kernel/ub/beancounter.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/beancounter.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/beancounter.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,683 @@
-+/*
-+ * linux/kernel/ub/beancounter.c
-+ *
-+ * Copyright (C) 1998 Alan Cox
-+ * 1998-2000 Andrey V. Savochkin <saw@saw.sw.com.sg>
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * TODO:
-+ * - more intelligent limit check in mremap(): currently the new size is
-+ * charged and _then_ old size is uncharged
-+ * (almost done: !move_vma case is completely done,
-+ * move_vma in its current implementation requires too many conditions to
-+ * do things right, because it may be not only expansion, but shrinking
-+ * also, plus do_munmap will require an additional parameter...)
-+ * - problem: bad pmd page handling
-+ * - consider /proc redesign
-+ * - TCP/UDP ports
-+ * + consider whether __charge_beancounter_locked should be inline
-+ *
-+ * Changes:
-+ * 1999/08/17 Marcelo Tosatti <marcelo@conectiva.com.br>
-+ * - Set "barrier" and "limit" parts of limits atomically.
-+ * 1999/10/06 Marcelo Tosatti <marcelo@conectiva.com.br>
-+ * - setublimit system call.
-+ */
-+
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_hash.h>
-+#include <ub/ub_vmpages.h>
-+
-+static kmem_cache_t *ub_cachep;
-+static struct user_beancounter default_beancounter;
-+struct user_beancounter ub0;
-+
-+const char *ub_rnames[] = {
-+ "kmemsize", /* 0 */
-+ "lockedpages",
-+ "privvmpages",
-+ "shmpages",
-+ "dummy",
-+ "numproc", /* 5 */
-+ "physpages",
-+ "vmguarpages",
-+ "oomguarpages",
-+ "numtcpsock",
-+ "numflock", /* 10 */
-+ "numpty",
-+ "numsiginfo",
-+ "tcpsndbuf",
-+ "tcprcvbuf",
-+ "othersockbuf", /* 15 */
-+ "dgramrcvbuf",
-+ "numothersock",
-+ "dcachesize",
-+ "numfile",
-+ "dummy", /* 20 */
-+ "dummy",
-+ "dummy",
-+ "numiptent",
-+ "unused_privvmpages", /* UB_RESOURCES */
-+ "tmpfs_respages",
-+ "swap_pages",
-+ "held_pages",
-+};
-+
-+static void init_beancounter_struct(struct user_beancounter *ub);
-+static void init_beancounter_store(struct user_beancounter *ub);
-+static void init_beancounter_nolimits(struct user_beancounter *ub);
-+
-+void print_ub_uid(struct user_beancounter *ub, char *buf, int size)
-+{
-+ if (ub->parent != NULL)
-+ snprintf(buf, size, "%u.%u", ub->parent->ub_uid, ub->ub_uid);
-+ else
-+ snprintf(buf, size, "%u", ub->ub_uid);
-+}
-+EXPORT_SYMBOL(print_ub_uid);
-+
-+#define ub_hash_fun(x) ((((x) >> 8) ^ (x)) & (UB_HASH_SIZE - 1))
-+#define ub_subhash_fun(p, id) ub_hash_fun((p)->ub_uid + (id) * 17)
-+struct ub_hash_slot ub_hash[UB_HASH_SIZE];
-+spinlock_t ub_hash_lock;
-+EXPORT_SYMBOL(ub_hash);
-+EXPORT_SYMBOL(ub_hash_lock);
-+
-+/*
-+ * Per user resource beancounting. Resources are tied to their luid.
-+ * The resource structure itself is tagged both to the process and
-+ * the charging resources (a socket doesn't want to have to search for
-+ * things at irq time for example). Reference counters keep things in
-+ * hand.
-+ *
-+ * The case where a user creates resource, kills all his processes and
-+ * then starts new ones is correctly handled this way. The refcounters
-+ * will mean the old entry is still around with resource tied to it.
-+ */
-+struct user_beancounter *get_beancounter_byuid(uid_t uid, int create)
-+{
-+ struct user_beancounter *new_ub, *ub;
-+ unsigned long flags;
-+ struct ub_hash_slot *slot;
-+
-+ slot = &ub_hash[ub_hash_fun(uid)];
-+ new_ub = NULL;
-+
-+retry:
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ ub = slot->ubh_beans;
-+ while (ub != NULL && (ub->ub_uid != uid || ub->parent != NULL))
-+ ub = ub->ub_next;
-+
-+ if (ub != NULL) {
-+ /* found */
-+ get_beancounter(ub);
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ if (new_ub != NULL)
-+ kmem_cache_free(ub_cachep, new_ub);
-+ return ub;
-+ }
-+
-+ if (!create) {
-+ /* no ub found */
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return NULL;
-+ }
-+
-+ if (new_ub != NULL) {
-+ /* install new ub */
-+ new_ub->ub_next = slot->ubh_beans;
-+ slot->ubh_beans = new_ub;
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return new_ub;
-+ }
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+
-+ /* alloc new ub */
-+ new_ub = (struct user_beancounter *)kmem_cache_alloc(ub_cachep,
-+ GFP_KERNEL);
-+ if (new_ub == NULL)
-+ return NULL;
-+
-+ ub_debug(UBD_ALLOC, "Creating ub %p in slot %p\n", new_ub, slot);
-+ memcpy(new_ub, &default_beancounter, sizeof(*new_ub));
-+ init_beancounter_struct(new_ub);
-+ new_ub->ub_uid = uid;
-+ goto retry;
-+}
-+EXPORT_SYMBOL(get_beancounter_byuid);
-+
-+struct user_beancounter *get_subbeancounter_byid(struct user_beancounter *p,
-+ int id, int create)
-+{
-+ struct user_beancounter *new_ub, *ub;
-+ unsigned long flags;
-+ struct ub_hash_slot *slot;
-+
-+ slot = &ub_hash[ub_subhash_fun(p, id)];
-+ new_ub = NULL;
-+
-+retry:
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ ub = slot->ubh_beans;
-+ while (ub != NULL && (ub->parent != p || ub->ub_uid != id))
-+ ub = ub->ub_next;
-+
-+ if (ub != NULL) {
-+ /* found */
-+ get_beancounter(ub);
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ if (new_ub != NULL) {
-+ put_beancounter(new_ub->parent);
-+ kmem_cache_free(ub_cachep, new_ub);
-+ }
-+ return ub;
-+ }
-+
-+ if (!create) {
-+ /* no ub found */
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return NULL;
-+ }
-+
-+ if (new_ub != NULL) {
-+ /* install new ub */
-+ get_beancounter(new_ub);
-+ new_ub->ub_next = slot->ubh_beans;
-+ slot->ubh_beans = new_ub;
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return new_ub;
-+ }
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+
-+ /* alloc new ub */
-+ new_ub = (struct user_beancounter *)kmem_cache_alloc(ub_cachep,
-+ GFP_KERNEL);
-+ if (new_ub == NULL)
-+ return NULL;
-+
-+ ub_debug(UBD_ALLOC, "Creating sub %p in slot %p\n", new_ub, slot);
-+ memset(new_ub, 0, sizeof(*new_ub));
-+ init_beancounter_nolimits(new_ub);
-+ init_beancounter_store(new_ub);
-+ init_beancounter_struct(new_ub);
-+ atomic_set(&new_ub->ub_refcount, 0);
-+ new_ub->ub_uid = id;
-+ new_ub->parent = get_beancounter(p);
-+ goto retry;
-+}
-+EXPORT_SYMBOL(get_subbeancounter_byid);
-+
-+struct user_beancounter *subbeancounter_findcreate(struct user_beancounter *p,
-+ int id)
-+{
-+ struct user_beancounter *ub;
-+ unsigned long flags;
-+ struct ub_hash_slot *slot;
-+
-+ slot = &ub_hash[ub_subhash_fun(p, id)];
-+
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ ub = slot->ubh_beans;
-+ while (ub != NULL && (ub->parent != p || ub->ub_uid != id))
-+ ub = ub->ub_next;
-+
-+ if (ub != NULL) {
-+ /* found */
-+ get_beancounter(ub);
-+ goto done;
-+ }
-+
-+ /* alloc new ub */
-+ /* Can be called from non-atomic contexts. Den */
-+ ub = (struct user_beancounter *)kmem_cache_alloc(ub_cachep, GFP_ATOMIC);
-+ if (ub == NULL)
-+ goto done;
-+
-+ ub_debug(UBD_ALLOC, "Creating sub %p in slot %p\n", ub, slot);
-+ memset(ub, 0, sizeof(*ub));
-+ init_beancounter_nolimits(ub);
-+ init_beancounter_store(ub);
-+ init_beancounter_struct(ub);
-+ atomic_set(&ub->ub_refcount, 0);
-+ ub->ub_uid = id;
-+ ub->parent = get_beancounter(p);
-+
-+ /* install new ub */
-+ get_beancounter(ub);
-+ ub->ub_next = slot->ubh_beans;
-+ slot->ubh_beans = ub;
-+
-+done:
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return ub;
-+}
-+EXPORT_SYMBOL(subbeancounter_findcreate);
-+#ifndef CONFIG_UBC_KEEP_UNUSED
-+
-+static int verify_res(struct user_beancounter *ub, int resource,
-+ unsigned long held)
-+{
-+ char id[64];
-+
-+ if (likely(held == 0))
-+ return 1;
-+
-+ print_ub_uid(ub, id, sizeof(id));
-+ printk(KERN_WARNING "Ub %s helds %lu in %s on put\n",
-+ id, held, ub_rnames[resource]);
-+ return 0;
-+}
-+
-+static inline void verify_held(struct user_beancounter *ub)
-+{
-+ int i, clean;
-+
-+ clean = 1;
-+ for (i = 0; i < UB_RESOURCES; i++)
-+ clean &= verify_res(ub, i, ub->ub_parms[i].held);
-+
-+ clean &= verify_res(ub, UB_UNUSEDPRIVVM, ub->ub_unused_privvmpages);
-+ clean &= verify_res(ub, UB_TMPFSPAGES, ub->ub_tmpfs_respages);
-+ clean &= verify_res(ub, UB_SWAPPAGES, ub->ub_swap_pages);
-+ clean &= verify_res(ub, UB_HELDPAGES, (unsigned long)ub->ub_held_pages);
-+
-+ ub_debug_trace(!clean, 5, 60*HZ);
-+}
-+
-+static void __unhash_beancounter(struct user_beancounter *ub)
-+{
-+ struct user_beancounter **ubptr;
-+ struct ub_hash_slot *slot;
-+
-+ if (ub->parent != NULL)
-+ slot = &ub_hash[ub_subhash_fun(ub->parent, ub->ub_uid)];
-+ else
-+ slot = &ub_hash[ub_hash_fun(ub->ub_uid)];
-+ ubptr = &slot->ubh_beans;
-+
-+ while (*ubptr != NULL) {
-+ if (*ubptr == ub) {
-+ verify_held(ub);
-+ *ubptr = ub->ub_next;
-+ return;
-+ }
-+ ubptr = &((*ubptr)->ub_next);
-+ }
-+ printk(KERN_ERR "Invalid beancounter %p, luid=%d on free, slot %p\n",
-+ ub, ub->ub_uid, slot);
-+}
-+#endif
-+
-+static void put_warn(struct user_beancounter *ub)
-+{
-+ char id[64];
-+
-+ print_ub_uid(ub, id, sizeof(id));
-+ printk(KERN_ERR "UB: Bad refcount (%d) on put of %s (%p)\n",
-+ atomic_read(&ub->ub_refcount), id, ub);
-+}
-+
-+void __put_beancounter(struct user_beancounter *ub)
-+{
-+ unsigned long flags;
-+ struct user_beancounter *parent;
-+
-+again:
-+ parent = ub->parent;
-+ ub_debug(UBD_ALLOC, "__put bc %p (cnt %d) for %.20s pid %d "
-+ "cur %08lx cpu %d.\n",
-+ ub, atomic_read(&ub->ub_refcount),
-+ current->comm, current->pid,
-+ (unsigned long)current, smp_processor_id());
-+
-+ /* equevalent to atomic_dec_and_lock_irqsave() */
-+ local_irq_save(flags);
-+ if (likely(!atomic_dec_and_lock(&ub->ub_refcount, &ub_hash_lock))) {
-+ if (unlikely(atomic_read(&ub->ub_refcount) < 0))
-+ put_warn(ub);
-+ local_irq_restore(flags);
-+ return;
-+ }
-+
-+ if (unlikely(ub == get_ub0())) {
-+ printk(KERN_ERR "Trying to put ub0\n");
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ return;
-+ }
-+
-+#ifndef CONFIG_UBC_KEEP_UNUSED
-+ __unhash_beancounter(ub);
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ ub_free_counters(ub);
-+ kmem_cache_free(ub_cachep, ub);
-+#else
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+#endif
-+ ub = parent;
-+ if (ub != NULL)
-+ goto again;
-+}
-+EXPORT_SYMBOL(__put_beancounter);
-+
-+/*
-+ * Generic resource charging stuff
-+ */
-+
-+int __charge_beancounter_locked(struct user_beancounter *ub,
-+ int resource, unsigned long val, enum ub_severity strict)
-+{
-+ ub_debug_resource(resource, "Charging %lu for %d of %p with %lu\n",
-+ val, resource, ub, ub->ub_parms[resource].held);
-+ /*
-+ * ub_value <= UB_MAXVALUE, value <= UB_MAXVALUE, and only one addition
-+ * at the moment is possible so an overflow is impossible.
-+ */
-+ ub->ub_parms[resource].held += val;
-+
-+ switch (strict) {
-+ case UB_HARD:
-+ if (ub->ub_parms[resource].held >
-+ ub->ub_parms[resource].barrier)
-+ break;
-+ case UB_SOFT:
-+ if (ub->ub_parms[resource].held >
-+ ub->ub_parms[resource].limit)
-+ break;
-+ case UB_FORCE:
-+ ub_adjust_maxheld(ub, resource);
-+ return 0;
-+ default:
-+ BUG();
-+ }
-+
-+ if (strict == UB_SOFT && ub_ratelimit(&ub->ub_limit_rl))
-+ printk(KERN_INFO "Fatal resource shortage: %s, UB %d.\n",
-+ ub_rnames[resource], ub->ub_uid);
-+ ub->ub_parms[resource].failcnt++;
-+ ub->ub_parms[resource].held -= val;
-+ return -ENOMEM;
-+}
-+
-+int charge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val, enum ub_severity strict)
-+{
-+ int retval;
-+ struct user_beancounter *p, *q;
-+ unsigned long flags;
-+
-+ retval = -EINVAL;
-+ if (val > UB_MAXVALUE)
-+ goto out;
-+
-+ local_irq_save(flags);
-+ for (p = ub; p != NULL; p = p->parent) {
-+ spin_lock(&p->ub_lock);
-+ retval = __charge_beancounter_locked(p, resource, val, strict);
-+ spin_unlock(&p->ub_lock);
-+ if (retval)
-+ goto unroll;
-+ }
-+out_restore:
-+ local_irq_restore(flags);
-+out:
-+ return retval;
-+
-+unroll:
-+ for (q = ub; q != p; q = q->parent) {
-+ spin_lock(&q->ub_lock);
-+ __uncharge_beancounter_locked(q, resource, val);
-+ spin_unlock(&q->ub_lock);
-+ }
-+ goto out_restore;
-+}
-+
-+EXPORT_SYMBOL(charge_beancounter);
-+
-+void __charge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ struct user_beancounter *p;
-+ unsigned long flags;
-+
-+ local_irq_save(flags);
-+ for (p = ub; p->parent != NULL; p = p->parent) {
-+ spin_lock(&p->ub_lock);
-+ __charge_beancounter_locked(p, resource, val, UB_FORCE);
-+ spin_unlock(&p->ub_lock);
-+ }
-+ local_irq_restore(flags);
-+}
-+
-+EXPORT_SYMBOL(__charge_beancounter_notop);
-+
-+void uncharge_warn(struct user_beancounter *ub, int resource,
-+ unsigned long val, unsigned long held)
-+{
-+ char id[64];
-+
-+ print_ub_uid(ub, id, sizeof(id));
-+ printk(KERN_ERR "Uncharging too much %lu h %lu, res %s ub %s\n",
-+ val, held, ub_rnames[resource], id);
-+ ub_debug_trace(1, 10, 10*HZ);
-+}
-+
-+void __uncharge_beancounter_locked(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ ub_debug_resource(resource, "Uncharging %lu for %d of %p with %lu\n",
-+ val, resource, ub, ub->ub_parms[resource].held);
-+ if (ub->ub_parms[resource].held < val) {
-+ uncharge_warn(ub, resource,
-+ val, ub->ub_parms[resource].held);
-+ val = ub->ub_parms[resource].held;
-+ }
-+ ub->ub_parms[resource].held -= val;
-+}
-+
-+void uncharge_beancounter(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ unsigned long flags;
-+ struct user_beancounter *p;
-+
-+ for (p = ub; p != NULL; p = p->parent) {
-+ spin_lock_irqsave(&p->ub_lock, flags);
-+ __uncharge_beancounter_locked(p, resource, val);
-+ spin_unlock_irqrestore(&p->ub_lock, flags);
-+ }
-+}
-+
-+EXPORT_SYMBOL(uncharge_beancounter);
-+
-+void __uncharge_beancounter_notop(struct user_beancounter *ub,
-+ int resource, unsigned long val)
-+{
-+ struct user_beancounter *p;
-+ unsigned long flags;
-+
-+ local_irq_save(flags);
-+ for (p = ub; p->parent != NULL; p = p->parent) {
-+ spin_lock(&p->ub_lock);
-+ __uncharge_beancounter_locked(p, resource, val);
-+ spin_unlock(&p->ub_lock);
-+ }
-+ local_irq_restore(flags);
-+}
-+
-+EXPORT_SYMBOL(__uncharge_beancounter_notop);
-+
-+
-+/*
-+ * Rate limiting stuff.
-+ */
-+int ub_ratelimit(struct ub_rate_info *p)
-+{
-+ unsigned long cjif, djif;
-+ unsigned long flags;
-+ static spinlock_t ratelimit_lock = SPIN_LOCK_UNLOCKED;
-+ long new_bucket;
-+
-+ spin_lock_irqsave(&ratelimit_lock, flags);
-+ cjif = jiffies;
-+ djif = cjif - p->last;
-+ if (djif < p->interval) {
-+ if (p->bucket >= p->burst) {
-+ spin_unlock_irqrestore(&ratelimit_lock, flags);
-+ return 0;
-+ }
-+ p->bucket++;
-+ } else {
-+ new_bucket = p->bucket - (djif / (unsigned)p->interval);
-+ if (new_bucket < 0)
-+ new_bucket = 0;
-+ p->bucket = new_bucket + 1;
-+ }
-+ p->last = cjif;
-+ spin_unlock_irqrestore(&ratelimit_lock, flags);
-+ return 1;
-+}
-+EXPORT_SYMBOL(ub_ratelimit);
-+
-+
-+/*
-+ * Initialization
-+ *
-+ * struct user_beancounter contains
-+ * - limits and other configuration settings,
-+ * with a copy stored for accounting purposes,
-+ * - structural fields: lists, spinlocks and so on.
-+ *
-+ * Before these parts are initialized, the structure should be memset
-+ * to 0 or copied from a known clean structure. That takes care of a lot
-+ * of fields not initialized explicitly.
-+ */
-+
-+static void init_beancounter_struct(struct user_beancounter *ub)
-+{
-+ ub->ub_magic = UB_MAGIC;
-+ atomic_set(&ub->ub_refcount, 1);
-+ spin_lock_init(&ub->ub_lock);
-+ INIT_LIST_HEAD(&ub->ub_tcp_sk_list);
-+ INIT_LIST_HEAD(&ub->ub_other_sk_list);
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+ INIT_LIST_HEAD(&ub->ub_cclist);
-+#endif
-+}
-+
-+static void init_beancounter_store(struct user_beancounter *ub)
-+{
-+ int k;
-+
-+ for (k = 0; k < UB_RESOURCES; k++) {
-+ memcpy(&ub->ub_store[k], &ub->ub_parms[k],
-+ sizeof(struct ubparm));
-+ }
-+}
-+
-+static void init_beancounter_nolimits(struct user_beancounter *ub)
-+{
-+ int k;
-+
-+ for (k = 0; k < UB_RESOURCES; k++) {
-+ ub->ub_parms[k].limit = UB_MAXVALUE;
-+ /* FIXME: whether this is right for physpages and guarantees? */
-+ ub->ub_parms[k].barrier = UB_MAXVALUE;
-+ }
-+
-+ /* FIXME: set unlimited rate? */
-+ ub->ub_limit_rl.burst = 4;
-+ ub->ub_limit_rl.interval = 300*HZ;
-+}
-+
-+static void init_beancounter_syslimits(struct user_beancounter *ub,
-+ unsigned long mp)
-+{
-+ extern int max_threads;
-+ int k;
-+
-+ ub->ub_parms[UB_KMEMSIZE].limit =
-+ mp > (192*1024*1024 >> PAGE_SHIFT) ?
-+ 32*1024*1024 : (mp << PAGE_SHIFT) / 6;
-+ ub->ub_parms[UB_LOCKEDPAGES].limit = 8;
-+ ub->ub_parms[UB_PRIVVMPAGES].limit = UB_MAXVALUE;
-+ ub->ub_parms[UB_SHMPAGES].limit = 64;
-+ ub->ub_parms[UB_NUMPROC].limit = max_threads / 2;
-+ ub->ub_parms[UB_NUMTCPSOCK].limit = 1024;
-+ ub->ub_parms[UB_TCPSNDBUF].limit = 1024*4*1024; /* 4k per socket */
-+ ub->ub_parms[UB_TCPRCVBUF].limit = 1024*6*1024; /* 6k per socket */
-+ ub->ub_parms[UB_NUMOTHERSOCK].limit = 256;
-+ ub->ub_parms[UB_DGRAMRCVBUF].limit = 256*4*1024; /* 4k per socket */
-+ ub->ub_parms[UB_OTHERSOCKBUF].limit = 256*8*1024; /* 8k per socket */
-+ ub->ub_parms[UB_NUMFLOCK].limit = 1024;
-+ ub->ub_parms[UB_NUMPTY].limit = 16;
-+ ub->ub_parms[UB_NUMSIGINFO].limit = 1024;
-+ ub->ub_parms[UB_DCACHESIZE].limit = 1024*1024;
-+ ub->ub_parms[UB_NUMFILE].limit = 1024;
-+
-+ for (k = 0; k < UB_RESOURCES; k++)
-+ ub->ub_parms[k].barrier = ub->ub_parms[k].limit;
-+
-+ ub->ub_limit_rl.burst = 4;
-+ ub->ub_limit_rl.interval = 300*HZ;
-+}
-+
-+void __init ub0_init(void)
-+{
-+ struct user_beancounter *ub;
-+
-+ init_cache_counters();
-+ ub = get_ub0();
-+ memset(ub, 0, sizeof(*ub));
-+ ub->ub_uid = 0;
-+ init_beancounter_nolimits(ub);
-+ init_beancounter_store(ub);
-+ init_beancounter_struct(ub);
-+
-+ memset(task_bc(current), 0, sizeof(struct task_beancounter));
-+ (void)set_exec_ub(ub);
-+ task_bc(current)->task_ub = get_beancounter(ub);
-+ __charge_beancounter_locked(ub, UB_NUMPROC, 1, UB_FORCE);
-+ task_bc(current)->fork_sub = get_beancounter(ub);
-+ mm_ub(&init_mm) = get_beancounter(ub);
-+}
-+
-+void __init ub_hash_init(void)
-+{
-+ struct ub_hash_slot *slot;
-+
-+ spin_lock_init(&ub_hash_lock);
-+ /* insert ub0 into the hash */
-+ slot = &ub_hash[ub_hash_fun(get_ub0()->ub_uid)];
-+ slot->ubh_beans = get_ub0();
-+}
-+
-+void __init beancounter_init(unsigned long mempages)
-+{
-+ extern int skbc_cache_init(void);
-+ int res;
-+
-+ res = skbc_cache_init();
-+ ub_cachep = kmem_cache_create("user_beancounters",
-+ sizeof(struct user_beancounter),
-+ 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-+ if (res < 0 || ub_cachep == NULL)
-+ panic("Can't create ubc caches\n");
-+
-+ memset(&default_beancounter, 0, sizeof(default_beancounter));
-+#ifdef CONFIG_UBC_UNLIMITED
-+ init_beancounter_nolimits(&default_beancounter);
-+#else
-+ init_beancounter_syslimits(&default_beancounter, mempages);
-+#endif
-+ init_beancounter_store(&default_beancounter);
-+ init_beancounter_struct(&default_beancounter);
-+
-+ ub_hash_init();
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_dcache.c linux-2.6.9-ve023stab030/kernel/ub/ub_dcache.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_dcache.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_dcache.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,640 @@
-+/*
-+ * kernel/ub/ub_dcache.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/dcache.h>
-+#include <linux/slab.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/kmem_slab.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/sysctl.h>
-+#include <linux/swap.h>
-+#include <linux/stop_machine.h>
-+#include <linux/cpumask.h>
-+#include <linux/nmi.h>
-+#include <linux/rwsem.h>
-+#include <linux/rcupdate.h>
-+#include <asm/bitops.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+#include <ub/ub_dcache.h>
-+#include <ub/ub_dcache_op.h>
-+
-+/*
-+ * Locking
-+ * traverse dcache_lock d_lock
-+ * ub_dentry_charge + - +
-+ * ub_dentry_uncharge + + +
-+ * ub_dentry_charge_nofail + + -
-+ *
-+ * d_inuse changes are atomic, with special handling of "not in use" <->
-+ * "in use" (-1 <-> 0) transitions. We have two sources of non-atomicity
-+ * here: (1) in many operations we need to change d_inuse of both dentry and
-+ * its parent, and (2) on state transitions we need to adjust the account.
-+ *
-+ * Regarding (1): we do not have (and do not want) a single lock covering all
-+ * operations, so in general it's impossible to get a consistent view of
-+ * a tree with respect to d_inuse counters (except by swsuspend). It also
-+ * means if a dentry with d_inuse of 0 gets one new in-use child and loses
-+ * one, it's d_inuse counter will go either 0 -> 1 -> 0 path or 0 -> -1 -> 0,
-+ * and we can't say which way.
-+ * Note that path -1 -> 0 -> -1 can't turn into -1 -> -2 -> -1, since
-+ * uncharge can be done only after return from charge (with d_genocide being
-+ * the only apparent exception).
-+ * Regarding (2): there is a similar uncertainty with the dcache account.
-+ * If the account is equal to the limit, one more dentry is started to be
-+ * used and one is put, the account will either hit the limit (and an error
-+ * will be returned), or decrement will happen before increment.
-+ *
-+ * These races do not really matter.
-+ * The only things we want are:
-+ * - if a system is suspenede with no in-use dentries, all d_inuse counters
-+ * should be correct (-1);
-+ * - d_inuse counters should always be >= -1.
-+ * This holds if ->parent references are accessed and maintained properly.
-+ * In subtle moments (like d_move) dentries exchanging their parents should
-+ * both be in-use. At d_genocide time, lookups and charges are assumed to be
-+ * impossible.
-+ */
-+
-+/*
-+ * Hierarchical accounting
-+ * UB argument must NOT be NULL
-+ */
-+
-+static int do_charge_dcache(struct user_beancounter *ub, unsigned long size,
-+ enum ub_severity sv)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (__charge_beancounter_locked(ub, UB_KMEMSIZE, CHARGE_SIZE(size), sv))
-+ goto out_mem;
-+ if (__charge_beancounter_locked(ub, UB_DCACHESIZE, size, sv))
-+ goto out_dcache;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return 0;
-+
-+out_dcache:
-+ __uncharge_beancounter_locked(ub, UB_KMEMSIZE, CHARGE_SIZE(size));
-+out_mem:
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return -ENOMEM;
-+}
-+
-+static void do_uncharge_dcache(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __uncharge_beancounter_locked(ub, UB_KMEMSIZE, CHARGE_SIZE(size));
-+ __uncharge_beancounter_locked(ub, UB_DCACHESIZE, size);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+static int charge_dcache(struct user_beancounter *ub, unsigned long size,
-+ enum ub_severity sv)
-+{
-+ struct user_beancounter *p, *q;
-+
-+ for (p = ub; p != NULL; p = p->parent) {
-+ if (do_charge_dcache(p, size, sv))
-+ goto unroll;
-+ }
-+ return 0;
-+
-+unroll:
-+ for (q = ub; q != p; q = q->parent)
-+ do_uncharge_dcache(q, size);
-+ return -ENOMEM;
-+}
-+
-+void uncharge_dcache(struct user_beancounter *ub, unsigned long size)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_uncharge_dcache(ub, size);
-+}
-+
-+/*
-+ * Simple helpers to do maintain account and d_ub field.
-+ */
-+
-+static inline int d_charge(struct dentry_beancounter *d_bc)
-+{
-+ struct user_beancounter *ub;
-+
-+ ub = get_beancounter(get_exec_ub());
-+ if (charge_dcache(ub, d_bc->d_ubsize, UB_SOFT))
-+ return -1;
-+ d_bc->d_ub = ub;
-+ return 0;
-+}
-+
-+static inline void d_forced_charge(struct dentry_beancounter *d_bc)
-+{
-+ struct user_beancounter *ub;
-+
-+ ub = get_beancounter(get_exec_ub());
-+ charge_dcache(ub, d_bc->d_ubsize, UB_FORCE);
-+ d_bc->d_ub = ub;
-+}
-+
-+static inline void d_uncharge(struct dentry_beancounter *d_bc)
-+{
-+ uncharge_dcache(d_bc->d_ub, d_bc->d_ubsize);
-+ put_beancounter(d_bc->d_ub);
-+ d_bc->d_ub = NULL;
-+}
-+
-+/*
-+ * Minor helpers
-+ */
-+
-+extern kmem_cache_t *dentry_cache;
-+extern kmem_cache_t *inode_cachep;
-+static struct rw_semaphore ub_dentry_alloc_sem;
-+
-+static inline unsigned int dentry_memusage(void)
-+{
-+ return kmem_cache_memusage(dentry_cache);
-+}
-+
-+static inline unsigned int inode_memusage(void)
-+{
-+ return kmem_cache_memusage(inode_cachep);
-+}
-+
-+static inline unsigned long d_charge_size(struct dentry *dentry)
-+{
-+ /* dentry's d_name is already set to appropriate value (see d_alloc) */
-+ return inode_memusage() + dentry_memusage() +
-+ (dname_external(dentry) ?
-+ kmem_obj_memusage((void *)dentry->d_name.name) : 0);
-+}
-+
-+/*
-+ * Entry points from dcache.c
-+ */
-+
-+/*
-+ * Set initial d_inuse on d_alloc.
-+ * Called with no locks, preemption disabled.
-+ */
-+int __ub_dentry_alloc(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+
-+ d_bc = dentry_bc(dentry);
-+ d_bc->d_ub = get_beancounter(get_exec_ub());
-+ atomic_set(&d_bc->d_inuse, 0); /* see comment in ub_dcache.h */
-+ d_bc->d_ubsize = d_charge_size(dentry);
-+
-+ if (charge_dcache(d_bc->d_ub, d_bc->d_ubsize, UB_HARD))
-+ goto failure;
-+ return 0;
-+
-+failure:
-+ put_beancounter(d_bc->d_ub);
-+ d_bc->d_ub = NULL;
-+ return -ENOMEM;
-+}
-+
-+void __ub_dentry_alloc_start(void)
-+{
-+ down_read(&ub_dentry_alloc_sem);
-+ task_bc(current)->dentry_alloc = 1;
-+}
-+
-+void __ub_dentry_alloc_end(void)
-+{
-+ task_bc(current)->dentry_alloc = 0;
-+ up_read(&ub_dentry_alloc_sem);
-+}
-+
-+/*
-+ * It is assumed that parent is already in use, so traverse upwards is
-+ * limited to one ancestor only.
-+ * Called under d_lock and rcu_read_lock.
-+ */
-+int __ub_dentry_charge(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+ struct dentry *parent;
-+ int ret;
-+
-+ d_bc = dentry_bc(dentry);
-+ if (atomic_inc_and_test(&d_bc->d_inuse)) {
-+ /* state transition 0 => -1 */
-+ if (d_charge(d_bc))
-+ goto failure;
-+
-+ if (dentry != dentry->d_parent) {
-+ parent = dentry->d_parent;
-+ if (atomic_inc_and_test(&dentry_bc(parent)->d_inuse))
-+ BUG();
-+ }
-+ }
-+ return 0;
-+
-+failure:
-+ /*
-+ * Here we would like to fail the lookup.
-+ * It is not easy: if d_lookup fails, callers expect that a dentry
-+ * with the given name doesn't exist, and create a new one.
-+ * So, first we forcedly charge for this dentry.
-+ * Then try to remove it from cache safely. If it turns out to be
-+ * possible, we can return error.
-+ */
-+ d_forced_charge(d_bc);
-+
-+ if (dentry != dentry->d_parent) {
-+ parent = dentry->d_parent;
-+ if (atomic_inc_and_test(&dentry_bc(parent)->d_inuse))
-+ BUG();
-+ }
-+
-+ ret = 0;
-+ if (spin_trylock(&dcache_lock)) {
-+ if (!list_empty(&dentry->d_subdirs)) {
-+ spin_unlock(&dentry->d_lock);
-+ spin_unlock(&dcache_lock);
-+ rcu_read_unlock();
-+ shrink_dcache_parent(dentry);
-+ rcu_read_lock();
-+ spin_lock(&dcache_lock);
-+ spin_lock(&dentry->d_lock);
-+ }
-+ if (atomic_read(&dentry->d_count) == 1) {
-+ __d_drop(dentry);
-+ ret = -1;
-+ }
-+ spin_unlock(&dcache_lock);
-+ }
-+
-+ return ret;
-+}
-+
-+/*
-+ * Go up in the tree decreasing d_inuse.
-+ * Called under dcache_lock.
-+ */
-+void __ub_dentry_uncharge(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+ struct dentry *parent;
-+
-+ /* go up until state doesn't change or and root is reached */
-+ d_bc = dentry_bc(dentry);
-+ while (atomic_add_negative(-1, &d_bc->d_inuse)) {
-+ /* state transition 0 => -1 */
-+ d_uncharge(d_bc);
-+
-+ parent = dentry->d_parent;
-+ if (dentry == parent)
-+ break;
-+ dentry = parent;
-+ d_bc = dentry_bc(dentry);
-+ }
-+}
-+
-+/*
-+ * Forced charge for __dget_locked, where API doesn't allow to return error.
-+ * Called under dcache_lock.
-+ */
-+void __ub_dentry_charge_nofail(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+ struct dentry *parent;
-+
-+ d_bc = dentry_bc(dentry);
-+ while (atomic_inc_and_test(&d_bc->d_inuse)) {
-+ /* state transition -1 => 0 */
-+ d_forced_charge(d_bc);
-+
-+ parent = dentry->d_parent;
-+ if (dentry == parent)
-+ break;
-+ dentry = parent;
-+ d_bc = dentry_bc(dentry);
-+ }
-+}
-+
-+/*
-+ * Adaptive accounting
-+ */
-+
-+int ub_dentry_on;
-+int ub_dentry_alloc_barrier;
-+EXPORT_SYMBOL(ub_dentry_on);
-+
-+static DEFINE_PER_CPU(int, checkcnt);
-+static unsigned long checklowat = 0;
-+static unsigned long checkhiwat = ULONG_MAX;
-+
-+static int sysctl_ub_dentry_chk = 10;
-+#define sysctl_ub_lowat sysctl_ub_watermark[0]
-+#define sysctl_ub_hiwat sysctl_ub_watermark[1]
-+static DECLARE_RWSEM(ub_dentry_alloc_sem);
-+/* 1024th of lowmem size */
-+static unsigned int sysctl_ub_watermark[2] = {0, 100};
-+
-+
-+static int ub_dentry_acctinit(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+
-+ d_bc = dentry_bc(dentry);
-+ d_bc->d_ub = NULL;
-+ atomic_set(&d_bc->d_inuse, -1);
-+ if (dname_external(dentry)) {
-+ struct page *page;
-+ page = virt_to_page(dentry->d_name.name);
-+ if (!PageSlab(page) || GET_PAGE_CACHE(page) == NULL) {
-+ printk("Problem with name, dentry %p, parent %p, "
-+ "name %p len %d\n",
-+ dentry, dentry->d_parent,
-+ dentry->d_name.name,
-+ dentry->d_name.len);
-+ printk(" de %p name %.10s\n",
-+ dentry, dentry->d_name.name);
-+ d_bc->d_ubsize = 0;
-+ return 0;
-+ }
-+ }
-+ d_bc->d_ubsize = d_charge_size(dentry);
-+ return 0;
-+}
-+
-+static int ub_dentry_acctcount(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+ struct dentry *child;
-+ int count;
-+
-+ count = 0;
-+ list_for_each_entry(child, &dentry->d_subdirs, d_child)
-+ count++;
-+
-+ d_bc = dentry_bc(dentry);
-+ count = atomic_read(&dentry->d_count) - count;
-+ if (count) {
-+ __ub_dentry_charge_nofail(dentry);
-+ if (count > 1)
-+ atomic_add(count - 1, &d_bc->d_inuse);
-+ }
-+
-+ return 0;
-+}
-+
-+static int ub_dentry_acctdrop(struct dentry *dentry)
-+{
-+ struct dentry_beancounter *d_bc;
-+
-+ d_bc = dentry_bc(dentry);
-+ while (atomic_read(&d_bc->d_inuse) >= 0)
-+ __ub_dentry_uncharge(dentry);
-+ return 0;
-+}
-+
-+extern void kmem_cache_free_block(kmem_cache_t *cachep, void **objpp,
-+ int nr_objects);
-+static int ub_dentry_walk(int (*fun)(struct dentry *))
-+{
-+ kmem_cache_t *cachep;
-+ struct array_cache *ac;
-+ struct slab *slabp;
-+ char *objp;
-+ int cpu, i, sz, r;
-+ unsigned long map[PAGE_SIZE / sizeof(struct dentry)
-+ / BITS_PER_LONG + 1];
-+
-+ cachep = dentry_cache;
-+ if (cachep->num >= sizeof(map) * 8)
-+ return -E2BIG;
-+
-+ /* drain all CPU caches to have up-to-date free map */
-+ ac = list3_data(cachep)->shared;
-+ kmem_cache_free_block(cachep, (void **)(ac + 1), ac->avail);
-+ ac->avail = 0;
-+ for_each_cpu(cpu) {
-+ ac = cachep->array[cpu];
-+ kmem_cache_free_block(cachep, (void **)(ac + 1), ac->avail);
-+ ac->avail = 0;
-+ }
-+
-+ list_for_each_entry(slabp, &list3_data(cachep)->slabs_full, list) {
-+ touch_nmi_watchdog();
-+ for (i = 0, objp = slabp->s_mem;
-+ i < cachep->num;
-+ i++, objp += cachep->objsize) {
-+#if SLAB_DEBUG
-+ r = (*fun)((struct dentry *)(objp + cachep->dbghead));
-+#else
-+ r = (*fun)((struct dentry *)objp);
-+#endif
-+ if (r)
-+ return r;
-+ }
-+ }
-+
-+ list_for_each_entry(slabp, &list3_data(cachep)->slabs_partial, list) {
-+ touch_nmi_watchdog();
-+ memset(map, 0xff, sizeof(map));
-+ for (i = slabp->free, r = 0;
-+ i != BUFCTL_END;
-+ i = slab_bufctl(slabp)[i], r++) {
-+ if (r > cachep->num)
-+ return -1;
-+ __clear_bit(i, map);
-+ }
-+ sz = sizeof(map) * BITS_PER_LONG;
-+ for (i = find_first_bit(map, sz);
-+ i < cachep->num;
-+ i = find_next_bit(map, sz, i + 1)) {
-+ objp = slabp->s_mem + i * cachep->objsize;
-+#if SLAB_DEBUG
-+ r = (*fun)((struct dentry *)(objp + cachep->dbghead));
-+#else
-+ r = (*fun)((struct dentry *)objp);
-+#endif
-+ if (r)
-+ return r;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int ub_dentry_accton(void *data)
-+{
-+ struct user_beancounter *ub;
-+ int err;
-+
-+ ub = get_exec_ub();
-+ set_exec_ub(get_ub0());
-+ err = ub_dentry_walk(&ub_dentry_acctinit);
-+ if (!err)
-+ err = ub_dentry_walk(&ub_dentry_acctcount);
-+ set_exec_ub(ub);
-+ if (err == 0)
-+ ub_dentry_on = 1;
-+ return err;
-+}
-+
-+static int ub_dentry_acctoff(void *data)
-+{
-+ int ret;
-+ ret = ub_dentry_walk(&ub_dentry_acctdrop);
-+ if (ret == 0)
-+ ub_dentry_on = 0;
-+ return ret;
-+}
-+
-+/*
-+ * Main function turning dcache accounting on and off.
-+ * Called with preemption disabled (for caller's convenience).
-+ */
-+static void ub_dentry_switch(int onoff, unsigned long pages, int (*fun)(void *))
-+{
-+ static char *s[] = { "off", "on" };
-+ unsigned long start_jiffies;
-+ int err, tm;
-+
-+ start_jiffies = jiffies;
-+ preempt_enable();
-+ ub_dentry_alloc_barrier = 1;
-+ /* ensure ub_dentry_alloc_barrier is visible on all CPUs */
-+ mb(); synchronize_kernel();
-+ down_write(&ub_dentry_alloc_sem);
-+ if (ub_dentry_on == onoff)
-+ goto done;
-+
-+ printk("UBC: preparing to turn dcache accounting %s, "
-+ "size %lu pages, watermarks %lu %lu\n",
-+ s[onoff], pages, checklowat, checkhiwat);
-+ err = stop_machine_run(fun, NULL, NR_CPUS);
-+ if (err) {
-+ printk(KERN_ERR "UBC: ERROR: dcache accounting switch %d\n",
-+ err);
-+ preempt_disable();
-+ checklowat = 0;
-+ checkhiwat = ULONG_MAX;
-+ sysctl_ub_dentry_chk = INT_MAX;
-+ preempt_enable();
-+ } else {
-+ tm = jiffies_to_msecs(jiffies - start_jiffies);
-+ printk("UBC: turning dcache accounting %s succeeded, "
-+ "usage %lu, time %u.%03u\n",
-+ s[onoff],
-+ get_ub0()->ub_parms[UB_DCACHESIZE].held,
-+ tm / 1000, tm % 1000);
-+ }
-+
-+done:
-+ ub_dentry_alloc_barrier = 0;
-+ up_write(&ub_dentry_alloc_sem);
-+ preempt_disable();
-+}
-+
-+void ub_dentry_checkup(void)
-+{
-+ int *p;
-+ unsigned long pages;
-+
-+ preempt_disable();
-+ p = &__get_cpu_var(checkcnt);
-+ if (++*p > sysctl_ub_dentry_chk) {
-+ *p = 0;
-+ pages = dentry_cache->grown
-+ - dentry_cache->reaped
-+ - dentry_cache->shrunk;
-+ pages <<= dentry_cache->gfporder;
-+ if (ub_dentry_on) {
-+ if (pages < checklowat)
-+ ub_dentry_switch(0, pages, &ub_dentry_acctoff);
-+ } else {
-+ if (pages >= checkhiwat)
-+ ub_dentry_switch(1, pages, &ub_dentry_accton);
-+ }
-+ }
-+ preempt_enable();
-+}
-+
-+static void ub_dentry_set_limits(unsigned long pages, unsigned long cap)
-+{
-+ down_write(&ub_dentry_alloc_sem);
-+ preempt_disable();
-+ checklowat = (pages >> 10) * sysctl_ub_lowat;
-+ checkhiwat = (pages >> 10) * sysctl_ub_hiwat;
-+ if (checkhiwat > cap) {
-+ checkhiwat = cap;
-+ checklowat = cap / sysctl_ub_hiwat * sysctl_ub_lowat;
-+ }
-+ preempt_enable();
-+ up_write(&ub_dentry_alloc_sem);
-+}
-+
-+static int ub_dentry_proc_handler(ctl_table *ctl, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ int r;
-+
-+ r = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
-+ if (!r && write)
-+ ub_dentry_set_limits(totalram_pages - totalhigh_pages,
-+ ULONG_MAX);
-+ return r;
-+}
-+
-+static ctl_table ub_dentry_sysctl_table[] = {
-+ {
-+ .ctl_name = 1000,
-+ .procname = "dentry_check",
-+ .data = &sysctl_ub_dentry_chk,
-+ .maxlen = sizeof(sysctl_ub_dentry_chk),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = 1001,
-+ .procname = "dentry_watermark",
-+ .data = &sysctl_ub_lowat,
-+ .maxlen = sizeof(sysctl_ub_lowat) * 2,
-+ .mode = 0644,
-+ .proc_handler = &ub_dentry_proc_handler,
-+ },
-+ { .ctl_name = 0 }
-+};
-+static ctl_table ub_dentry_sysctl_root[] = {
-+ {
-+ .ctl_name = 23681,
-+ .procname = "ubc",
-+ .mode = 0555,
-+ .child = ub_dentry_sysctl_table,
-+ },
-+ { .ctl_name = 0 }
-+};
-+
-+static int __init ub_dentry_init(void)
-+{
-+ /*
-+ * Initial watermarks are limited, to limit walk time.
-+ * 384MB translates into 0.8 sec on PIII 866MHz.
-+ */
-+ ub_dentry_set_limits(totalram_pages - totalhigh_pages,
-+ 384 * 1024 * 1024 / PAGE_SIZE);
-+ if (register_sysctl_table(ub_dentry_sysctl_root, 0) == NULL)
-+ return -ENOMEM;
-+ return 0;
-+}
-+__initcall(ub_dentry_init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_mem.c linux-2.6.9-ve023stab030/kernel/ub/ub_mem.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_mem.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_mem.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,469 @@
-+/*
-+ * kernel/ub/ub_mem.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/slab.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/kmem_slab.h>
-+#include <linux/highmem.h>
-+#include <linux/vmalloc.h>
-+#include <linux/mm.h>
-+#include <linux/gfp.h>
-+#include <linux/swap.h>
-+#include <linux/spinlock.h>
-+#include <linux/sched.h>
-+#include <linux/module.h>
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+#include <ub/ub_hash.h>
-+
-+/*
-+ * Initialization
-+ */
-+
-+extern void __init page_beancounters_init(void);
-+
-+void __init page_ubc_init(void)
-+{
-+#ifdef CONFIG_USER_RSS_ACCOUNTING
-+ page_beancounters_init();
-+#endif
-+}
-+
-+/*
-+ * Slab accounting
-+ */
-+
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+
-+#define CC_HASH_SIZE 1024
-+static struct ub_cache_counter *cc_hash[CC_HASH_SIZE];
-+spinlock_t cc_lock;
-+
-+static void __free_cache_counters(struct user_beancounter *ub,
-+ kmem_cache_t *cachep)
-+{
-+ struct ub_cache_counter *cc, **pprev, *del;
-+ int i;
-+ unsigned long flags;
-+
-+ del = NULL;
-+ spin_lock_irqsave(&cc_lock, flags);
-+ for (i = 0; i < CC_HASH_SIZE; i++) {
-+ pprev = &cc_hash[i];
-+ cc = cc_hash[i];
-+ while (cc != NULL) {
-+ if (cc->ub != ub && cc->cachep != cachep) {
-+ pprev = &cc->next;
-+ cc = cc->next;
-+ continue;
-+ }
-+
-+ list_del(&cc->ulist);
-+ *pprev = cc->next;
-+ cc->next = del;
-+ del = cc;
-+ cc = *pprev;
-+ }
-+ }
-+ spin_unlock_irqrestore(&cc_lock, flags);
-+
-+ while (del != NULL) {
-+ cc = del->next;
-+ kfree(del);
-+ del = cc;
-+ }
-+}
-+
-+void ub_free_counters(struct user_beancounter *ub)
-+{
-+ __free_cache_counters(ub, NULL);
-+}
-+
-+void ub_kmemcache_free(kmem_cache_t *cachep)
-+{
-+ __free_cache_counters(NULL, cachep);
-+}
-+
-+void __init init_cache_counters(void)
-+{
-+ memset(cc_hash, 0, CC_HASH_SIZE * sizeof(cc_hash[0]));
-+ spin_lock_init(&cc_lock);
-+}
-+
-+#define cc_hash_fun(ub, cachep) ( \
-+ (((unsigned long)(ub) >> L1_CACHE_SHIFT) ^ \
-+ ((unsigned long)(ub) >> (BITS_PER_LONG / 2)) ^ \
-+ ((unsigned long)(cachep) >> L1_CACHE_SHIFT) ^ \
-+ ((unsigned long)(cachep) >> (BITS_PER_LONG / 2)) \
-+ ) & (CC_HASH_SIZE - 1))
-+
-+static int change_slab_charged(struct user_beancounter *ub, void *objp,
-+ unsigned long val, int mask)
-+{
-+ struct ub_cache_counter *cc, *new_cnt, **pprev;
-+ kmem_cache_t *cachep;
-+ unsigned long flags;
-+
-+ cachep = GET_PAGE_CACHE(virt_to_page(objp));
-+ new_cnt = NULL;
-+
-+again:
-+ spin_lock_irqsave(&cc_lock, flags);
-+ cc = cc_hash[cc_hash_fun(ub, cachep)];
-+ while (cc) {
-+ if (cc->ub == ub && cc->cachep == cachep)
-+ goto found;
-+ cc = cc->next;
-+ }
-+
-+ if (new_cnt != NULL)
-+ goto insert;
-+
-+ spin_unlock_irqrestore(&cc_lock, flags);
-+
-+ new_cnt = kmalloc(sizeof(*new_cnt), mask & ~__GFP_UBC);
-+ if (new_cnt == NULL)
-+ return -ENOMEM;
-+
-+ new_cnt->counter = 0;
-+ new_cnt->ub = ub;
-+ new_cnt->cachep = cachep;
-+ goto again;
-+
-+insert:
-+ pprev = &cc_hash[cc_hash_fun(ub, cachep)];
-+ new_cnt->next = *pprev;
-+ *pprev = new_cnt;
-+ list_add(&new_cnt->ulist, &ub->ub_cclist);
-+ cc = new_cnt;
-+ new_cnt = NULL;
-+
-+found:
-+ cc->counter += val;
-+ spin_unlock_irqrestore(&cc_lock, flags);
-+ if (new_cnt)
-+ kfree(new_cnt);
-+ return 0;
-+}
-+
-+static inline int inc_slab_charged(struct user_beancounter *ub,
-+ void *objp, int mask)
-+{
-+ return change_slab_charged(ub, objp, 1, mask);
-+}
-+
-+static inline void dec_slab_charged(struct user_beancounter *ub, void *objp)
-+{
-+ if (change_slab_charged(ub, objp, -1, 0) < 0)
-+ BUG();
-+}
-+
-+#include <linux/vmalloc.h>
-+
-+static inline int inc_pages_charged(struct user_beancounter *ub,
-+ struct page *pg, int order)
-+{
-+ int cpu;
-+
-+ cpu = get_cpu();
-+ ub->ub_pages_charged[cpu]++;
-+ put_cpu();
-+ return 0;
-+}
-+
-+static inline void dec_pages_charged(struct user_beancounter *ub,
-+ struct page *pg, int order)
-+{
-+ int cpu;
-+
-+ cpu = get_cpu();
-+ ub->ub_pages_charged[cpu]--;
-+ put_cpu();
-+}
-+
-+void inc_vmalloc_charged(struct vm_struct *vm, int flags)
-+{
-+ int cpu;
-+ struct user_beancounter *ub;
-+
-+ if (!(flags & __GFP_UBC))
-+ return;
-+
-+ ub = get_exec_ub();
-+ if (ub == NULL)
-+ return;
-+
-+ cpu = get_cpu();
-+ ub->ub_vmalloc_charged[cpu] += vm->nr_pages;
-+ put_cpu();
-+}
-+
-+void dec_vmalloc_charged(struct vm_struct *vm)
-+{
-+ int cpu;
-+ struct user_beancounter *ub;
-+
-+ ub = page_ub(vm->pages[0]);
-+ if (ub == NULL)
-+ return;
-+
-+ cpu = get_cpu();
-+ ub->ub_vmalloc_charged[cpu] -= vm->nr_pages;
-+ put_cpu();
-+}
-+
-+#else
-+#define inc_slab_charged(ub, o, m) (0)
-+#define dec_slab_charged(ub, o) do { } while (0)
-+#define inc_pages_charged(ub, pg, o) (0)
-+#define dec_pages_charged(ub, pg, o) do { } while (0)
-+#endif
-+
-+static inline struct user_beancounter **slab_ub_ref(void *objp)
-+{
-+ struct page *pg;
-+ kmem_cache_t *cachep;
-+ struct slab *slabp;
-+ int objnr;
-+
-+ pg = virt_to_page(objp);
-+ cachep = GET_PAGE_CACHE(pg);
-+ BUG_ON(!(cachep->flags & SLAB_UBC));
-+ slabp = GET_PAGE_SLAB(pg);
-+ objnr = (objp - slabp->s_mem) / cachep->objsize;
-+ return slab_ubcs(cachep, slabp) + objnr;
-+}
-+
-+struct user_beancounter *slab_ub(void *objp)
-+{
-+ struct user_beancounter **ub_ref;
-+
-+ ub_ref = slab_ub_ref(objp);
-+ return *ub_ref;
-+}
-+
-+EXPORT_SYMBOL(slab_ub);
-+
-+#define UB_KMEM_QUANT (PAGE_SIZE * 4)
-+
-+/* called with IRQ disabled */
-+static int ub_kmemsize_charge(struct user_beancounter *ub,
-+ unsigned long size,
-+ enum ub_severity strict)
-+{
-+ struct task_beancounter *tbc;
-+
-+ tbc = task_bc(current);
-+ if (ub != tbc->task_ub || size > UB_KMEM_QUANT)
-+ goto just_charge;
-+ if (tbc->kmem_precharged >= size) {
-+ tbc->kmem_precharged -= size;
-+ return 0;
-+ }
-+
-+ if (charge_beancounter(ub, UB_KMEMSIZE, UB_KMEM_QUANT, UB_HARD) == 0) {
-+ tbc->kmem_precharged += UB_KMEM_QUANT - size;
-+ return 0;
-+ }
-+
-+just_charge:
-+ return charge_beancounter(ub, UB_KMEMSIZE, size, strict);
-+}
-+
-+/* called with IRQ disabled */
-+static void ub_kmemsize_uncharge(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ struct task_beancounter *tbc;
-+
-+ if (size > UB_MAXVALUE) {
-+ printk("ub_kmemsize_uncharge: size %lu\n", size);
-+ dump_stack();
-+ }
-+
-+ tbc = task_bc(current);
-+ if (ub != tbc->task_ub)
-+ goto just_uncharge;
-+
-+ tbc->kmem_precharged += size;
-+ if (tbc->kmem_precharged < UB_KMEM_QUANT * 2)
-+ return;
-+ size = tbc->kmem_precharged - UB_KMEM_QUANT;
-+ tbc->kmem_precharged -= size;
-+
-+just_uncharge:
-+ uncharge_beancounter(ub, UB_KMEMSIZE, size);
-+}
-+
-+/* called with IRQ disabled */
-+int ub_slab_charge(void *objp, int flags)
-+{
-+ unsigned int size;
-+ struct user_beancounter *ub;
-+
-+ ub = get_beancounter(get_exec_ub());
-+ if (ub == NULL)
-+ return 0;
-+
-+ size = CHARGE_SIZE(kmem_obj_memusage(objp));
-+ if (ub_kmemsize_charge(ub, size,
-+ (flags & __GFP_SOFT_UBC ? UB_SOFT : UB_HARD)))
-+ goto out_err;
-+
-+ if (inc_slab_charged(ub, objp, flags) < 0) {
-+ ub_kmemsize_uncharge(ub, size);
-+ goto out_err;
-+ }
-+ *slab_ub_ref(objp) = ub;
-+ return 0;
-+
-+out_err:
-+ put_beancounter(ub);
-+ return -ENOMEM;
-+}
-+
-+/* called with IRQ disabled */
-+void ub_slab_uncharge(void *objp)
-+{
-+ unsigned int size;
-+ struct user_beancounter **ub_ref;
-+
-+ ub_ref = slab_ub_ref(objp);
-+ if (*ub_ref == NULL)
-+ return;
-+
-+ dec_slab_charged(*ub_ref, objp);
-+ size = CHARGE_SIZE(kmem_obj_memusage(objp));
-+ ub_kmemsize_uncharge(*ub_ref, size);
-+ put_beancounter(*ub_ref);
-+ *ub_ref = NULL;
-+}
-+
-+static void ub_bad_page(struct page *page, struct user_beancounter *ub,
-+ char *str)
-+{
-+ page_ub(page) = NULL;
-+ printk(KERN_ERR "UBC: BUG: fix page state for %p: %s\n", page, str);
-+ printk(KERN_ERR " flags: 0x%0*lx mapping: %p mapcount: %d count: %d\n",
-+ (int)(2*sizeof(page_flags_t)), (unsigned long)page->flags,
-+ page->mapping, page_mapcount(page), page_count(page));
-+ printk(KERN_ERR " UB %p mg %lu id %d\n", ub, ub->ub_magic, ub->ub_uid);
-+ dump_stack();
-+}
-+
-+static inline void ub_check_null(struct page *page)
-+{
-+ struct user_beancounter *ub;
-+
-+ ub = page_ub(page);
-+ if (unlikely(ub != NULL))
-+ ub_bad_page(page, ub, "ub is not NULL");
-+}
-+
-+static inline int ub_check_magic(struct page *pg, struct user_beancounter *ub)
-+{
-+ if (likely(ub->ub_magic == UB_MAGIC))
-+ return 0;
-+
-+ ub_bad_page(pg, ub, "ub magic is bad");
-+ return -1;
-+}
-+
-+/*
-+ * Pages accounting
-+ */
-+
-+int ub_page_charge(struct page *page, int order, int mask)
-+{
-+ struct user_beancounter *ub;
-+ unsigned long flags;
-+
-+ ub = NULL;
-+ if (!(mask & __GFP_UBC))
-+ goto out;
-+
-+ ub = get_beancounter(get_exec_ub());
-+ if (ub == NULL)
-+ goto out;
-+
-+ local_irq_save(flags);
-+ if (ub_kmemsize_charge(ub, CHARGE_ORDER(order),
-+ (mask & __GFP_SOFT_UBC ? UB_SOFT : UB_HARD)))
-+ goto err;
-+ if (inc_pages_charged(ub, page, order) < 0) {
-+ ub_kmemsize_uncharge(ub, CHARGE_ORDER(order));
-+ goto err;
-+ }
-+ local_irq_restore(flags);
-+out:
-+ ub_check_null(page);
-+ page_ub(page) = ub;
-+ return 0;
-+
-+err:
-+ local_irq_restore(flags);
-+ ub_check_null(page);
-+ put_beancounter(ub);
-+ return -ENOMEM;
-+}
-+
-+void ub_page_uncharge(struct page *page, int order)
-+{
-+ struct user_beancounter *ub;
-+ unsigned long flags;
-+
-+ ub = page_ub(page);
-+ if (ub == NULL)
-+ return;
-+
-+ if (ub_check_magic(page, ub))
-+ return;
-+
-+ dec_pages_charged(ub, page, order);
-+ local_irq_save(flags);
-+ ub_kmemsize_uncharge(ub, CHARGE_ORDER(order));
-+ local_irq_restore(flags);
-+ put_beancounter(ub);
-+ page_ub(page) = NULL;
-+}
-+
-+/*
-+ * takes init_mm.page_table_lock
-+ * some outer lock to protect pages from vmalloced area must be held
-+ */
-+struct user_beancounter *vmalloc_ub(void *obj)
-+{
-+ struct page *pg;
-+
-+ spin_lock(&init_mm.page_table_lock);
-+ pg = follow_page_k((unsigned long)obj, 0);
-+ spin_unlock(&init_mm.page_table_lock);
-+ if (pg == NULL)
-+ return NULL;
-+
-+ return page_ub(pg);
-+}
-+
-+EXPORT_SYMBOL(vmalloc_ub);
-+
-+struct user_beancounter *mem_ub(void *obj)
-+{
-+ struct user_beancounter *ub;
-+
-+ if ((unsigned long)obj >= VMALLOC_START &&
-+ (unsigned long)obj < VMALLOC_END)
-+ ub = vmalloc_ub(obj);
-+ else
-+ ub = slab_ub(obj);
-+
-+ return ub;
-+}
-+
-+EXPORT_SYMBOL(mem_ub);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_misc.c linux-2.6.9-ve023stab030/kernel/ub/ub_misc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_misc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_misc.c 2006-10-11 19:08:00.000000000 +0400
-@@ -0,0 +1,402 @@
-+/*
-+ * kernel/ub/ub_misc.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/tty.h>
-+#include <linux/tty_driver.h>
-+#include <linux/signal.h>
-+#include <linux/slab.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/fs.h>
-+#include <linux/sched.h>
-+#include <linux/module.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+
-+#define UB_FILE_MINQUANT 3
-+#define UB_FILE_MAXQUANT 10
-+#define UB_FILE_INIQUANT 4
-+
-+static unsigned long ub_file_precharge(struct task_beancounter *task_bc,
-+ struct user_beancounter *ub, unsigned long *kmemsize);
-+
-+static inline unsigned long ub_file_kmemsize(unsigned long nr)
-+{
-+ return CHARGE_SIZE(kmem_cache_memusage(filp_cachep)) * nr;
-+}
-+
-+/*
-+ * Task staff
-+ */
-+
-+static void init_task_sub(struct task_struct *parent,
-+ struct task_struct *tsk,
-+ struct task_beancounter *old_bc)
-+{
-+ struct task_beancounter *new_bc;
-+ struct user_beancounter *sub;
-+
-+ new_bc = task_bc(tsk);
-+ sub = old_bc->fork_sub;
-+ new_bc->fork_sub = get_beancounter(sub);
-+ new_bc->task_fnode = NULL;
-+ new_bc->task_freserv = old_bc->task_freserv;
-+ old_bc->task_freserv = NULL;
-+ memset(&new_bc->task_data, 0, sizeof(new_bc->task_data));
-+ new_bc->pgfault_handle = 0;
-+ new_bc->pgfault_allot = 0;
-+}
-+
-+int ub_task_charge(struct task_struct *parent, struct task_struct *task)
-+{
-+ struct task_beancounter *old_bc;
-+ struct task_beancounter *new_bc;
-+ struct user_beancounter *ub, *pub;
-+ unsigned long file_nr, kmemsize;
-+ unsigned long flags;
-+
-+ old_bc = task_bc(parent);
-+ ub = old_bc->fork_sub;
-+ new_bc = task_bc(task);
-+ new_bc->task_ub = get_beancounter(ub);
-+ new_bc->exec_ub = get_beancounter(ub);
-+
-+ for (pub = ub; pub->parent != NULL; pub = pub->parent);
-+ spin_lock_irqsave(&pub->ub_lock, flags);
-+ if (unlikely(__charge_beancounter_locked(pub, UB_NUMPROC,
-+ 1, UB_HARD) < 0))
-+ goto out_numproc;
-+
-+ new_bc->file_precharged = 0;
-+ new_bc->file_quant = UB_FILE_INIQUANT;
-+ new_bc->file_count = 0;
-+ file_nr = ub_file_precharge(new_bc, pub, &kmemsize);
-+ spin_unlock_irqrestore(&pub->ub_lock, flags);
-+
-+ charge_beancounter_notop(ub, UB_NUMPROC, 1);
-+ if (likely(file_nr)) {
-+ charge_beancounter_notop(ub, UB_NUMFILE, file_nr);
-+ charge_beancounter_notop(ub, UB_KMEMSIZE, kmemsize);
-+ }
-+
-+ new_bc->kmem_precharged = 0;
-+ new_bc->dentry_alloc = 0;
-+ init_task_sub(parent, task, old_bc);
-+ return 0;
-+
-+out_numproc:
-+ spin_unlock_irqrestore(&pub->ub_lock, flags);
-+ __put_beancounter_batch(ub, 2);
-+ return -ENOMEM;
-+}
-+
-+extern atomic_t dbgpre;
-+
-+void ub_task_uncharge(struct task_struct *task)
-+{
-+ struct task_beancounter *task_bc;
-+ struct user_beancounter *pub;
-+ unsigned long file_nr, kmemsize;
-+ unsigned long flags;
-+
-+ task_bc = task_bc(task);
-+ for (pub = task_bc->task_ub; pub->parent != NULL;
-+ pub = pub->parent);
-+ spin_lock_irqsave(&pub->ub_lock, flags);
-+ __uncharge_beancounter_locked(pub, UB_NUMPROC, 1);
-+ file_nr = task_bc->file_precharged;
-+ if (likely(file_nr))
-+ __uncharge_beancounter_locked(pub,
-+ UB_NUMFILE, file_nr);
-+ task_bc->file_precharged = 0;
-+ kmemsize = task_bc->kmem_precharged;
-+ task_bc->kmem_precharged = 0;
-+ kmemsize += ub_file_kmemsize(file_nr);
-+ if (likely(kmemsize))
-+ __uncharge_beancounter_locked(pub,
-+ UB_KMEMSIZE, kmemsize);
-+ spin_unlock_irqrestore(&pub->ub_lock, flags);
-+
-+ uncharge_beancounter_notop(task_bc->task_ub, UB_NUMPROC, 1);
-+ if (likely(file_nr)) {
-+ uncharge_beancounter_notop(task_bc->task_ub,
-+ UB_NUMFILE, file_nr);
-+ __put_beancounter_batch(task_bc->task_ub, file_nr);
-+ }
-+ if (likely(kmemsize))
-+ uncharge_beancounter_notop(task_bc->task_ub,
-+ UB_KMEMSIZE, kmemsize);
-+
-+ put_beancounter(task_bc->exec_ub);
-+ put_beancounter(task_bc->task_ub);
-+ put_beancounter(task_bc->fork_sub);
-+ /* can't be freed elsewhere, failures possible in the middle of fork */
-+ if (task_bc->task_freserv != NULL)
-+ kfree(task_bc->task_freserv);
-+
-+ task_bc->exec_ub = (struct user_beancounter *)0xdeadbcbc;
-+ task_bc->task_ub = (struct user_beancounter *)0xdead100c;
-+}
-+
-+/*
-+ * Files and file locks.
-+ */
-+/*
-+ * For NUMFILE, we do not take a lock and call charge function
-+ * for every file. We try to charge in batches, keeping local reserve on
-+ * task. For experimental purposes, batch size is adaptive and depends
-+ * on numfile barrier, number of processes, and the history of successes and
-+ * failures of batch charges.
-+ *
-+ * Per-task fields have the following meaning
-+ * file_precharged number of files charged to beancounter in advance,
-+ * file_quant logarithm of batch size
-+ * file_count counter of charge successes, to reduce batch size
-+ * fluctuations.
-+ */
-+static unsigned long ub_file_precharge(struct task_beancounter *task_bc,
-+ struct user_beancounter *ub, unsigned long *kmemsize)
-+{
-+ unsigned long n, kmem;
-+
-+ n = 1UL << task_bc->file_quant;
-+ if (ub->ub_parms[UB_NUMPROC].held >
-+ (ub->ub_parms[UB_NUMFILE].barrier >>
-+ task_bc->file_quant))
-+ goto nopre;
-+ if (unlikely(__charge_beancounter_locked(ub, UB_NUMFILE, n, UB_HARD)))
-+ goto nopre;
-+ kmem = ub_file_kmemsize(n);
-+ if (unlikely(__charge_beancounter_locked(ub, UB_KMEMSIZE,
-+ kmem, UB_HARD)))
-+ goto nopre_kmem;
-+
-+ task_bc->file_precharged += n;
-+ get_beancounter_batch(task_bc->task_ub, n);
-+ task_bc->file_count++;
-+ if (task_bc->file_quant < UB_FILE_MAXQUANT &&
-+ task_bc->file_count >= task_bc->file_quant) {
-+ task_bc->file_quant++;
-+ task_bc->file_count = 0;
-+ }
-+ *kmemsize = kmem;
-+ return n;
-+
-+nopre_kmem:
-+ __uncharge_beancounter_locked(ub, UB_NUMFILE, n);
-+nopre:
-+ if (task_bc->file_quant > UB_FILE_MINQUANT)
-+ task_bc->file_quant--;
-+ task_bc->file_count = 0;
-+ return 0;
-+}
-+
-+int ub_file_charge(struct file *f)
-+{
-+ struct user_beancounter *ub, *pub;
-+ struct task_beancounter *task_bc;
-+ unsigned long file_nr, kmem;
-+ unsigned long flags;
-+ int err;
-+
-+ ub = get_exec_ub();
-+ task_bc = task_bc(current);
-+ if (unlikely(ub != task_bc->task_ub))
-+ goto just_charge;
-+
-+ if (likely(task_bc->file_precharged > 0)) {
-+ task_bc->file_precharged--;
-+ f->f_ub = ub;
-+ return 0;
-+ }
-+
-+ for (pub = ub; pub->parent != NULL; pub = pub->parent);
-+ spin_lock_irqsave(&pub->ub_lock, flags);
-+ file_nr = ub_file_precharge(task_bc, pub, &kmem);
-+ if (unlikely(!file_nr))
-+ goto last_try;
-+ spin_unlock_irqrestore(&pub->ub_lock, flags);
-+ charge_beancounter_notop(ub, UB_NUMFILE, file_nr);
-+ charge_beancounter_notop(ub, UB_KMEMSIZE, kmem);
-+ task_bc->file_precharged--;
-+ f->f_ub = ub;
-+ return 0;
-+
-+just_charge:
-+ for (pub = ub; pub->parent != NULL; pub = pub->parent);
-+ spin_lock_irqsave(&pub->ub_lock, flags);
-+last_try:
-+ kmem = ub_file_kmemsize(1);
-+ err = __charge_beancounter_locked(pub, UB_NUMFILE, 1, UB_HARD);
-+ if (likely(!err)) {
-+ err = __charge_beancounter_locked(pub, UB_KMEMSIZE,
-+ kmem, UB_HARD);
-+ if (unlikely(err))
-+ __uncharge_beancounter_locked(pub, UB_NUMFILE, 1);
-+ }
-+ spin_unlock_irqrestore(&pub->ub_lock, flags);
-+ if (likely(!err)) {
-+ charge_beancounter_notop(ub, UB_NUMFILE, 1);
-+ charge_beancounter_notop(ub, UB_KMEMSIZE, kmem);
-+ f->f_ub = get_beancounter(ub);
-+ }
-+ return err;
-+}
-+
-+void ub_file_uncharge(struct file *f)
-+{
-+ struct user_beancounter *ub, *pub;
-+ struct task_beancounter *task_bc;
-+ unsigned long nr;
-+
-+ ub = f->f_ub;
-+ task_bc = task_bc(current);
-+ if (likely(ub == task_bc->task_ub)) {
-+ task_bc->file_precharged++;
-+ for (pub = ub; pub->parent != NULL; pub = pub->parent);
-+ if (ub_barrier_farnr(pub, UB_NUMFILE))
-+ return;
-+ if (task_bc->file_precharged < (1UL << task_bc->file_quant))
-+ return;
-+ nr = task_bc->file_precharged
-+ - (1UL << (task_bc->file_quant - 1));
-+ task_bc->file_precharged -= nr;
-+ __put_beancounter_batch(ub, nr);
-+ uncharge_beancounter(ub, UB_NUMFILE, nr);
-+ uncharge_beancounter(ub, UB_KMEMSIZE, ub_file_kmemsize(nr));
-+ } else {
-+ uncharge_beancounter(ub, UB_NUMFILE, 1);
-+ uncharge_beancounter(ub, UB_KMEMSIZE, ub_file_kmemsize(1));
-+ put_beancounter(ub);
-+ }
-+}
-+
-+int ub_flock_charge(struct file_lock *fl, int hard)
-+{
-+ struct user_beancounter *ub;
-+ int err;
-+
-+ /* No need to get_beancounter here since it's already got in slab */
-+ ub = slab_ub(fl);
-+ if (ub == NULL)
-+ return 0;
-+
-+ err = charge_beancounter(ub, UB_NUMFLOCK, 1, hard ? UB_HARD : UB_SOFT);
-+ if (!err)
-+ fl->fl_charged = 1;
-+ return err;
-+}
-+
-+void ub_flock_uncharge(struct file_lock *fl)
-+{
-+ struct user_beancounter *ub;
-+
-+ /* Ub will be put in slab */
-+ ub = slab_ub(fl);
-+ if (ub == NULL || !fl->fl_charged)
-+ return;
-+
-+ uncharge_beancounter(ub, UB_NUMFLOCK, 1);
-+ fl->fl_charged = 0;
-+}
-+
-+/*
-+ * Signal handling
-+ */
-+
-+static int do_ub_siginfo_charge(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (__charge_beancounter_locked(ub, UB_KMEMSIZE, size, UB_HARD))
-+ goto out_kmem;
-+
-+ if (__charge_beancounter_locked(ub, UB_NUMSIGINFO, 1, UB_HARD))
-+ goto out_num;
-+
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return 0;
-+
-+out_num:
-+ __uncharge_beancounter_locked(ub, UB_KMEMSIZE, size);
-+out_kmem:
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return -ENOMEM;
-+}
-+
-+static void do_ub_siginfo_uncharge(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __uncharge_beancounter_locked(ub, UB_KMEMSIZE, size);
-+ __uncharge_beancounter_locked(ub, UB_NUMSIGINFO, 1);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+int ub_siginfo_charge(struct user_beancounter *ub, unsigned long size)
-+{
-+ struct user_beancounter *p, *q;
-+
-+ size = CHARGE_SIZE(size);
-+ for (p = ub; p != NULL; p = p->parent) {
-+ if (do_ub_siginfo_charge(p, size))
-+ goto unroll;
-+ }
-+ return 0;
-+
-+unroll:
-+ for (q = ub; q != p; q = q->parent)
-+ do_ub_siginfo_uncharge(q, size);
-+ return -ENOMEM;
-+}
-+EXPORT_SYMBOL(ub_siginfo_charge);
-+
-+void ub_siginfo_uncharge(struct user_beancounter *ub, unsigned long size)
-+{
-+ size = CHARGE_SIZE(size);
-+ for (; ub != NULL; ub = ub->parent)
-+ do_ub_siginfo_uncharge(ub, size);
-+}
-+
-+/*
-+ * PTYs
-+ */
-+
-+int ub_pty_charge(struct tty_struct *tty)
-+{
-+ struct user_beancounter *ub;
-+ int retval;
-+
-+ ub = tty_ub(tty);
-+ retval = 0;
-+ if (ub && tty->driver->subtype == PTY_TYPE_MASTER &&
-+ !test_bit(TTY_CHARGED, &tty->flags)) {
-+ retval = charge_beancounter(ub, UB_NUMPTY, 1, UB_HARD);
-+ if (!retval)
-+ set_bit(TTY_CHARGED, &tty->flags);
-+ }
-+ return retval;
-+}
-+
-+void ub_pty_uncharge(struct tty_struct *tty)
-+{
-+ struct user_beancounter *ub;
-+
-+ ub = tty_ub(tty);
-+ if (ub && tty->driver->subtype == PTY_TYPE_MASTER &&
-+ test_bit(TTY_CHARGED, &tty->flags)) {
-+ uncharge_beancounter(ub, UB_NUMPTY, 1);
-+ clear_bit(TTY_CHARGED, &tty->flags);
-+ }
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_net.c linux-2.6.9-ve023stab030/kernel/ub/ub_net.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_net.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_net.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,1081 @@
-+/*
-+ * linux/kernel/ub/ub_net.c
-+ *
-+ * Copyright (C) 1998-2004 Andrey V. Savochkin <saw@saw.sw.com.sg>
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * TODO:
-+ * - sizeof(struct inode) charge
-+ * = tcp_mem_schedule() feedback based on ub limits
-+ * + measures so that one socket won't exhaust all send buffers,
-+ * see bug in bugzilla
-+ * = sk->socket check for NULL in snd_wakeups
-+ * (tcp_write_space checks for NULL itself)
-+ * + in tcp_close(), orphaned socket abortion should be based on ubc
-+ * resources (same in tcp_out_of_resources)
-+ * Beancounter should also have separate orphaned socket counter...
-+ * + for rcv, in-order segment should be accepted
-+ * if only barrier is exceeded
-+ * = tcp_rmem_schedule() feedback based on ub limits
-+ * - repair forward_alloc mechanism for receive buffers
-+ * It's idea is that some buffer space is pre-charged so that receive fast
-+ * path doesn't need to take spinlocks and do other heavy stuff
-+ * + tcp_prune_queue actions based on ub limits
-+ * + window adjustments depending on available buffers for receive
-+ * - window adjustments depending on available buffers for send
-+ * + race around usewreserv
-+ * + avoid allocating new page for each tiny-gram, see letter from ANK
-+ * + rename ub_sock_lock
-+ * + sk->sleep wait queue probably can be used for all wakeups, and
-+ * sk->ub_wait is unnecessary
-+ * + for UNIX sockets, the current algorithm will lead to
-+ * UB_UNIX_MINBUF-sized messages only for non-blocking case
-+ * - charge for af_packet sockets
-+ * + all datagram sockets should be charged to NUMUNIXSOCK
-+ * - we do not charge for skb copies and clones staying in device queues
-+ * + live-lock if number of sockets is big and buffer limits are small
-+ * [diff-ubc-dbllim3]
-+ * - check that multiple readers/writers on the same socket won't cause fatal
-+ * consequences
-+ * - check allocation/charge orders
-+ * + There is potential problem with callback_lock. In *snd_wakeup we take
-+ * beancounter first, in sock_def_error_report - callback_lock first.
-+ * then beancounter. This is not a problem if callback_lock taken
-+ * readonly, but anyway...
-+ * - SKB_CHARGE_SIZE doesn't include the space wasted by slab allocator
-+ * General kernel problems:
-+ * - in tcp_sendmsg(), if allocation fails, non-blocking sockets with ASYNC
-+ * notification won't get signals
-+ * - datagram_poll looks racy
-+ *
-+ */
-+
-+#include <linux/net.h>
-+#include <linux/slab.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/gfp.h>
-+#include <linux/err.h>
-+#include <linux/socket.h>
-+#include <linux/module.h>
-+#include <linux/sched.h>
-+
-+#include <net/sock.h>
-+#include <net/tcp.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_net.h>
-+#include <ub/ub_debug.h>
-+
-+/* by some reason it is not used currently */
-+#define UB_SOCK_MAINTAIN_WMEMPRESSURE 0
-+
-+
-+/* Skb truesize definition. Bad place. Den */
-+
-+static inline int skb_chargesize_head(struct sk_buff *skb)
-+{
-+ return skb_charge_size(skb->end - skb->head +
-+ sizeof(struct skb_shared_info));
-+}
-+
-+int skb_charge_fullsize(struct sk_buff *skb)
-+{
-+ int chargesize;
-+ struct sk_buff *skbfrag;
-+
-+ chargesize = skb_chargesize_head(skb) +
-+ PAGE_SIZE * skb_shinfo(skb)->nr_frags;
-+ if (likely(skb_shinfo(skb)->frag_list == NULL))
-+ return chargesize;
-+ for (skbfrag = skb_shinfo(skb)->frag_list;
-+ skbfrag != NULL;
-+ skbfrag = skbfrag->next) {
-+ chargesize += skb_charge_fullsize(skbfrag);
-+ }
-+ return chargesize;
-+}
-+EXPORT_SYMBOL(skb_charge_fullsize);
-+
-+static int ub_sock_makewreserv_locked(struct sock *sk,
-+ int bufid, unsigned long size);
-+
-+int ub_too_many_orphans(struct sock *sk, int count)
-+{
-+ struct user_beancounter *ub;
-+
-+ if (sock_has_ubc(sk)) {
-+ for (ub = sock_bc(sk)->ub; ub->parent != NULL; ub = ub->parent);
-+ if (count >= ub->ub_parms[UB_NUMTCPSOCK].barrier >> 2)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * Queueing
-+ */
-+
-+static void ub_sock_snd_wakeup(struct user_beancounter *ub)
-+{
-+ struct list_head *p;
-+ struct sock *sk;
-+ struct sock_beancounter *skbc;
-+ struct socket *sock;
-+ unsigned long added;
-+
-+ while (!list_empty(&ub->ub_other_sk_list)) {
-+ p = ub->ub_other_sk_list.next;
-+ skbc = list_entry(p, struct sock_beancounter, ub_sock_list);
-+ sk = skbc_sock(skbc);
-+
-+ added = 0;
-+ sock = sk->sk_socket;
-+ if (sock == NULL) {
-+ /* sk being destroyed */
-+ list_del_init(&skbc->ub_sock_list);
-+ continue;
-+ }
-+
-+ ub_debug(UBD_NET_SLEEP,
-+ "Checking queue, waiting %lu, reserv %lu\n",
-+ skbc->ub_waitspc, skbc->poll_reserv);
-+ added = -skbc->poll_reserv;
-+ if (ub_sock_makewreserv_locked(sk, UB_OTHERSOCKBUF,
-+ skbc->ub_waitspc))
-+ break;
-+ added += skbc->poll_reserv;
-+
-+ list_del_init(&skbc->ub_sock_list);
-+
-+ /*
-+ * See comments in ub_tcp_snd_wakeup.
-+ * Locking note: both unix_write_space and
-+ * sock_def_write_space take callback_lock themselves.
-+ * We take it here just to be on the safe side and to
-+ * act the same way as ub_tcp_snd_wakeup does.
-+ */
-+ sock_hold(sk);
-+ read_lock(&sk->sk_callback_lock);
-+ spin_unlock(&ub->ub_lock);
-+
-+ sk->sk_write_space(sk);
-+ read_unlock(&sk->sk_callback_lock);
-+
-+ if (skbc->ub != ub && added)
-+ charge_beancounter_notop(skbc->ub,
-+ UB_OTHERSOCKBUF, added);
-+ sock_put(sk);
-+
-+ spin_lock(&ub->ub_lock);
-+ }
-+}
-+
-+static void ub_tcp_snd_wakeup(struct user_beancounter *ub)
-+{
-+ struct list_head *p;
-+ struct sock *sk;
-+ struct sock_beancounter *skbc;
-+ struct socket *sock;
-+ unsigned long added;
-+
-+ while (!list_empty(&ub->ub_tcp_sk_list)) {
-+ p = ub->ub_tcp_sk_list.next;
-+ skbc = list_entry(p, struct sock_beancounter, ub_sock_list);
-+ sk = skbc_sock(skbc);
-+
-+ added = 0;
-+ sock = sk->sk_socket;
-+ if (sock == NULL) {
-+ /* sk being destroyed */
-+ list_del_init(&skbc->ub_sock_list);
-+ continue;
-+ }
-+
-+ ub_debug(UBD_NET_SLEEP,
-+ "Checking queue, waiting %lu, reserv %lu\n",
-+ skbc->ub_waitspc, skbc->poll_reserv);
-+ added = -skbc->poll_reserv;
-+ if (ub_sock_makewreserv_locked(sk, UB_TCPSNDBUF,
-+ skbc->ub_waitspc))
-+ break;
-+ added += skbc->poll_reserv;
-+
-+ list_del_init(&skbc->ub_sock_list);
-+
-+ /*
-+ * Send async notifications and wake up.
-+ * Locking note: we get callback_lock here because
-+ * tcp_write_space is over-optimistic about calling context
-+ * (socket lock is presumed). So we get the lock here although
-+ * it belongs to the callback.
-+ */
-+ sock_hold(sk);
-+ read_lock(&sk->sk_callback_lock);
-+ spin_unlock(&ub->ub_lock);
-+
-+ sk->sk_write_space(sk);
-+ read_unlock(&sk->sk_callback_lock);
-+
-+ if (skbc->ub != ub && added)
-+ charge_beancounter_notop(skbc->ub, UB_TCPSNDBUF, added);
-+ sock_put(sk);
-+
-+ spin_lock(&ub->ub_lock);
-+ }
-+}
-+
-+void ub_sock_snd_queue_add(struct sock *sk, int res, unsigned long size)
-+{
-+ unsigned long flags;
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+ unsigned long added_reserv;
-+
-+ if (!sock_has_ubc(sk))
-+ return;
-+
-+ skbc = sock_bc(sk);
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub_debug(UBD_NET_SLEEP, "attempt to charge for %lu\n", size);
-+ added_reserv = -skbc->poll_reserv;
-+ if (!ub_sock_makewreserv_locked(sk, res, size)) {
-+ /*
-+ * It looks a bit hackish, but it is compatible with both
-+ * wait_for_xx_ubspace and poll.
-+ * This __set_current_state is equivalent to a wakeup event
-+ * right after spin_unlock_irqrestore.
-+ */
-+ __set_current_state(TASK_RUNNING);
-+ added_reserv += skbc->poll_reserv;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ if (added_reserv)
-+ charge_beancounter_notop(skbc->ub, res, added_reserv);
-+ return;
-+ }
-+
-+ ub_debug(UBD_NET_SLEEP, "Adding sk to queue\n");
-+ skbc->ub_waitspc = size;
-+ if (!list_empty(&skbc->ub_sock_list)) {
-+ ub_debug(UBD_NET_SOCKET,
-+ "re-adding socket to beancounter %p.\n", ub);
-+ goto out;
-+ }
-+
-+ switch (res) {
-+ case UB_TCPSNDBUF:
-+ list_add_tail(&skbc->ub_sock_list,
-+ &ub->ub_tcp_sk_list);
-+ break;
-+ case UB_OTHERSOCKBUF:
-+ list_add_tail(&skbc->ub_sock_list,
-+ &ub->ub_other_sk_list);
-+ break;
-+ default:
-+ BUG();
-+ }
-+out:
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+long ub_sock_wait_for_space(struct sock *sk, long timeo, unsigned long size)
-+{
-+ DECLARE_WAITQUEUE(wait, current);
-+
-+ add_wait_queue(sk->sk_sleep, &wait);
-+ for (;;) {
-+ if (signal_pending(current))
-+ break;
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ if (!ub_sock_make_wreserv(sk, UB_OTHERSOCKBUF, size))
-+ break;
-+
-+ if (sk->sk_shutdown & SEND_SHUTDOWN)
-+ break;
-+ if (sk->sk_err)
-+ break;
-+ ub_sock_snd_queue_add(sk, UB_OTHERSOCKBUF, size);
-+ timeo = schedule_timeout(timeo);
-+ }
-+ __set_current_state(TASK_RUNNING);
-+ remove_wait_queue(sk->sk_sleep, &wait);
-+ return timeo;
-+}
-+
-+void ub_sock_sndqueuedel(struct sock *sk)
-+{
-+ struct user_beancounter *ub;
-+ struct sock_beancounter *skbc;
-+ unsigned long flags;
-+
-+ if (!sock_has_ubc(sk))
-+ return;
-+ skbc = sock_bc(sk);
-+
-+ /* race with write_space callback of other socket */
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ list_del_init(&skbc->ub_sock_list);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+/*
-+ * Helpers
-+ */
-+
-+static inline void __ub_skb_set_charge(struct sk_buff *skb, struct sock *sk,
-+ unsigned long size, int resource)
-+{
-+ skb_bc(skb)->ub = sock_bc(sk)->ub;
-+ skb_bc(skb)->charged = size;
-+ skb_bc(skb)->resource = resource;
-+}
-+
-+void ub_skb_set_charge(struct sk_buff *skb, struct sock *sk,
-+ unsigned long size, int resource)
-+{
-+ if (!sock_has_ubc(sk))
-+ return;
-+
-+ if (sock_bc(sk)->ub == NULL)
-+ BUG();
-+
-+ __ub_skb_set_charge(skb, sk, size, resource);
-+
-+ /* Ugly. Ugly. Skb in sk writequeue can live without ref to sk */
-+ if (skb->sk == NULL)
-+ skb->sk = sk;
-+}
-+
-+static inline void ub_skb_set_uncharge(struct sk_buff *skb)
-+{
-+ skb_bc(skb)->ub = NULL;
-+ skb_bc(skb)->charged = 0;
-+ skb_bc(skb)->resource = 0;
-+}
-+
-+static void ub_update_rmem_thres(struct sock_beancounter *skub)
-+{
-+ struct user_beancounter *ub;
-+
-+ if (skub && skub->ub) {
-+ for (ub = skub->ub; ub->parent != NULL; ub = ub->parent);
-+ ub->ub_rmem_thres = ub->ub_parms[UB_TCPRCVBUF].barrier /
-+ (ub->ub_parms[UB_NUMTCPSOCK].held + 1);
-+ }
-+}
-+
-+static inline void ub_sock_wcharge_dec(struct sock *sk,
-+ unsigned long chargesize)
-+{
-+ /* The check sk->sk_family != PF_NETLINK is made as the skb is
-+ * queued to the kernel end of socket while changed to the user one.
-+ * Den */
-+ if (unlikely(sock_bc(sk)->ub_wcharged) && sk->sk_family != PF_NETLINK) {
-+ if (sock_bc(sk)->ub_wcharged > chargesize)
-+ sock_bc(sk)->ub_wcharged -= chargesize;
-+ else
-+ sock_bc(sk)->ub_wcharged = 0;
-+ }
-+}
-+
-+/*
-+ * Charge socket number
-+ */
-+
-+static inline void sk_alloc_beancounter(struct sock *sk)
-+{
-+ struct sock_beancounter *skbc;
-+
-+ skbc = sock_bc(sk);
-+ memset(skbc, 0, sizeof(struct sock_beancounter));
-+}
-+
-+static inline void sk_free_beancounter(struct sock *sk)
-+{
-+}
-+
-+static int __sock_charge(struct sock *sk, int res)
-+{
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *cub, *ub;
-+ unsigned long added_reserv, added_forw;
-+ unsigned long flags;
-+
-+ cub = get_exec_ub();
-+ if (unlikely(cub == NULL))
-+ return 0;
-+
-+ sk_alloc_beancounter(sk);
-+ skbc = sock_bc(sk);
-+ INIT_LIST_HEAD(&skbc->ub_sock_list);
-+
-+ for (ub = cub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (unlikely(__charge_beancounter_locked(ub, res, 1, UB_HARD) < 0))
-+ goto out_limit;
-+
-+ added_reserv = 0;
-+ added_forw = 0;
-+ if (res == UB_NUMTCPSOCK) {
-+ added_reserv = skb_charge_size(MAX_TCP_HEADER +
-+ 1500 - sizeof(struct iphdr) -
-+ sizeof(struct tcphdr));
-+ added_reserv *= 4;
-+ ub->ub_parms[UB_TCPSNDBUF].held += added_reserv;
-+ if (!ub_barrier_farsz(ub, UB_TCPSNDBUF)) {
-+ ub->ub_parms[UB_TCPSNDBUF].held -= added_reserv;
-+ added_reserv = 0;
-+ }
-+ skbc->poll_reserv = added_reserv;
-+
-+ added_forw = SK_STREAM_MEM_QUANTUM * 4;
-+ ub->ub_parms[UB_TCPRCVBUF].held += added_forw;
-+ if (!ub_barrier_farsz(ub, UB_TCPRCVBUF)) {
-+ ub->ub_parms[UB_TCPRCVBUF].held -= added_forw;
-+ added_forw = 0;
-+ }
-+ skbc->forw_space = added_forw;
-+ }
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ charge_beancounter_notop(cub, res, 1);
-+ if (added_reserv)
-+ charge_beancounter_notop(cub, UB_TCPSNDBUF, added_reserv);
-+ if (added_forw)
-+ charge_beancounter_notop(cub, UB_TCPRCVBUF, added_forw);
-+
-+ skbc->ub = get_beancounter(cub);
-+ return 0;
-+
-+out_limit:
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ sk_free_beancounter(sk);
-+ return -ENOMEM;
-+}
-+
-+int ub_tcp_sock_charge(struct sock *sk)
-+{
-+ int ret;
-+
-+ ret = __sock_charge(sk, UB_NUMTCPSOCK);
-+ ub_update_rmem_thres(sock_bc(sk));
-+
-+ return ret;
-+}
-+
-+int ub_other_sock_charge(struct sock *sk)
-+{
-+ return __sock_charge(sk, UB_NUMOTHERSOCK);
-+}
-+
-+EXPORT_SYMBOL(ub_other_sock_charge);
-+
-+int ub_sock_charge(struct sock *sk, int family, int type)
-+{
-+ return (IS_TCP_SOCK(family, type) ?
-+ ub_tcp_sock_charge(sk) : ub_other_sock_charge(sk));
-+}
-+
-+/*
-+ * Uncharge socket number
-+ */
-+
-+void ub_sock_uncharge(struct sock *sk)
-+{
-+ int is_tcp_sock;
-+ unsigned long flags;
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+ unsigned long reserv, forw;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return;
-+
-+ is_tcp_sock = IS_TCP_SOCK(sk->sk_family, sk->sk_type);
-+ skbc = sock_bc(sk);
-+ ub_debug(UBD_NET_SOCKET, "Calling ub_sock_uncharge on %p\n", sk);
-+
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (!list_empty(&skbc->ub_sock_list)) {
-+ ub_debug(UBD_NET_SOCKET,
-+ "ub_sock_uncharge: removing from ub(%p) queue.\n",
-+ skbc);
-+ list_del_init(&skbc->ub_sock_list);
-+ }
-+
-+ reserv = skbc->poll_reserv;
-+ forw = skbc->forw_space;
-+ __uncharge_beancounter_locked(ub,
-+ (is_tcp_sock ? UB_TCPSNDBUF : UB_OTHERSOCKBUF),
-+ reserv);
-+ if (forw)
-+ __uncharge_beancounter_locked(ub,
-+ (is_tcp_sock ? UB_TCPRCVBUF : UB_DGRAMRCVBUF),
-+ forw);
-+ __uncharge_beancounter_locked(ub,
-+ (is_tcp_sock ? UB_NUMTCPSOCK : UB_NUMOTHERSOCK), 1);
-+
-+ ub_sock_wcharge_dec(sk, reserv);
-+ if (unlikely(skbc->ub_wcharged))
-+ printk(KERN_WARNING
-+ "ub_sock_uncharge: wch=%lu for ub %p (%d).\n",
-+ skbc->ub_wcharged, skbc->ub, skbc->ub->ub_uid);
-+ skbc->poll_reserv = 0;
-+ skbc->forw_space = 0;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ uncharge_beancounter_notop(skbc->ub,
-+ (is_tcp_sock ? UB_TCPSNDBUF : UB_OTHERSOCKBUF),
-+ reserv);
-+ if (forw)
-+ uncharge_beancounter_notop(skbc->ub,
-+ (is_tcp_sock ? UB_TCPRCVBUF : UB_DGRAMRCVBUF),
-+ forw);
-+ uncharge_beancounter_notop(skbc->ub,
-+ (is_tcp_sock ? UB_NUMTCPSOCK : UB_NUMOTHERSOCK), 1);
-+
-+ put_beancounter(skbc->ub);
-+ sk_free_beancounter(sk);
-+}
-+
-+/*
-+ * Special case for netlink_dump - (un)charges precalculated size
-+ */
-+
-+int ub_nlrcvbuf_charge(struct sk_buff *skb, struct sock *sk)
-+{
-+ int ret;
-+ unsigned long chargesize;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+
-+ chargesize = skb_charge_fullsize(skb);
-+ ret = charge_beancounter(sock_bc(sk)->ub,
-+ UB_DGRAMRCVBUF, chargesize, UB_HARD);
-+ if (ret < 0)
-+ return ret;
-+ ub_skb_set_charge(skb, sk, chargesize, UB_DGRAMRCVBUF);
-+ return ret;
-+}
-+
-+/*
-+ * Poll reserve accounting
-+ *
-+ * This is the core of socket buffer management (along with queueing/wakeup
-+ * functions. The rest of buffer accounting either call these functions, or
-+ * repeat parts of their logic for some simpler cases.
-+ */
-+
-+static int ub_sock_makewreserv_locked(struct sock *sk,
-+ int bufid, unsigned long size)
-+{
-+ unsigned long wcharge_added;
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+
-+ skbc = sock_bc(sk);
-+ if (skbc->poll_reserv >= size) /* no work to be done */
-+ goto out;
-+
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ ub->ub_parms[bufid].held += size - skbc->poll_reserv;
-+
-+ wcharge_added = 0;
-+ /*
-+ * Logic:
-+ * 1) when used memory hits barrier, we set wmem_pressure;
-+ * wmem_pressure is reset under barrier/2;
-+ * between barrier/2 and barrier we limit per-socket buffer growth;
-+ * 2) each socket is guaranteed to get (limit-barrier)/maxsockets
-+ * calculated on the base of memory eaten after the barrier is hit
-+ */
-+ skbc = sock_bc(sk);
-+#if UB_SOCK_MAINTAIN_WMEMPRESSURE
-+ if (!ub_hfbarrier_hit(ub, bufid)) {
-+ if (ub->ub_wmem_pressure)
-+ ub_debug(UBD_NET_SEND, "makewres: pressure -> 0 "
-+ "sk %p sz %lu pr %lu hd %lu wc %lu sb %d.\n",
-+ sk, size, skbc->poll_reserv,
-+ ub->ub_parms[bufid].held,
-+ skbc->ub_wcharged, sk->sk_sndbuf);
-+ ub->ub_wmem_pressure = 0;
-+ }
-+#endif
-+ if (ub_barrier_hit(ub, bufid)) {
-+#if UB_SOCK_MAINTAIN_WMEMPRESSURE
-+ if (!ub->ub_wmem_pressure)
-+ ub_debug(UBD_NET_SEND, "makewres: pressure -> 1 "
-+ "sk %p sz %lu pr %lu hd %lu wc %lu sb %d.\n",
-+ sk, size, skbc->poll_reserv,
-+ ub->ub_parms[bufid].held,
-+ skbc->ub_wcharged, sk->sk_sndbuf);
-+ ub->ub_wmem_pressure = 1;
-+#endif
-+ if (sk->sk_family == PF_NETLINK)
-+ goto unroll;
-+ wcharge_added = size - skbc->poll_reserv;
-+ skbc->ub_wcharged += wcharge_added;
-+ if (skbc->ub_wcharged * ub->ub_parms[bid2sid(bufid)].limit +
-+ ub->ub_parms[bufid].barrier >
-+ ub->ub_parms[bufid].limit)
-+ goto unroll_wch;
-+ }
-+ if (ub->ub_parms[bufid].held > ub->ub_parms[bufid].limit)
-+ goto unroll;
-+
-+ ub_adjust_maxheld(ub, bufid);
-+ skbc->poll_reserv = size;
-+out:
-+ return 0;
-+
-+unroll_wch:
-+ skbc->ub_wcharged -= wcharge_added;
-+unroll:
-+ ub_debug(UBD_NET_SEND,
-+ "makewres: deny "
-+ "sk %p sz %lu pr %lu hd %lu wc %lu sb %d.\n",
-+ sk, size, skbc->poll_reserv, ub->ub_parms[bufid].held,
-+ skbc->ub_wcharged, sk->sk_sndbuf);
-+ ub->ub_parms[bufid].failcnt++;
-+ ub->ub_parms[bufid].held -= size - skbc->poll_reserv;
-+ return -ENOMEM;
-+}
-+
-+int ub_sock_make_wreserv(struct sock *sk, int bufid, unsigned long size)
-+{
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+ unsigned long flags;
-+ unsigned long added_reserv;
-+ int err;
-+
-+ skbc = sock_bc(sk);
-+
-+ /*
-+ * This function provides that there is sufficient reserve upon return
-+ * only if sk has only one user. We can check poll_reserv without
-+ * serialization and avoid locking if the reserve already exists.
-+ */
-+ if (unlikely(!sock_has_ubc(sk)) || likely(skbc->poll_reserv >= size))
-+ return 0;
-+
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ added_reserv = -skbc->poll_reserv;
-+ err = ub_sock_makewreserv_locked(sk, bufid, size);
-+ added_reserv += skbc->poll_reserv;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ if (added_reserv)
-+ charge_beancounter_notop(skbc->ub, bufid, added_reserv);
-+
-+ return err;
-+}
-+
-+int ub_sock_get_wreserv(struct sock *sk, int bufid, unsigned long size)
-+{
-+ struct sock_beancounter *skbc;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+
-+ /* optimize for the case if socket has sufficient reserve */
-+ ub_sock_make_wreserv(sk, bufid, size);
-+ skbc = sock_bc(sk);
-+ if (likely(skbc->poll_reserv >= size)) {
-+ skbc->poll_reserv -= size;
-+ return 0;
-+ }
-+ return -ENOMEM;
-+}
-+
-+void ub_sock_ret_wreserv(struct sock *sk, int bufid,
-+ unsigned long size, unsigned long ressize)
-+{
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+ unsigned long extra;
-+ unsigned long flags;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return;
-+
-+ skbc = sock_bc(sk);
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ /* check if the reserve can be kept */
-+ if (ub_barrier_farsz(ub, bufid)) {
-+ skbc->poll_reserv += size;
-+ return;
-+ }
-+
-+ extra = 0;
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ skbc->poll_reserv += size;
-+ if (skbc->poll_reserv > ressize) {
-+ extra = skbc->poll_reserv - ressize;
-+ ub_sock_wcharge_dec(sk, extra);
-+ skbc->poll_reserv = ressize;
-+
-+ __uncharge_beancounter_locked(ub, bufid, extra);
-+ if (bufid == UB_TCPSNDBUF)
-+ ub_tcp_snd_wakeup(ub);
-+ else
-+ ub_sock_snd_wakeup(ub);
-+ }
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ if (extra)
-+ uncharge_beancounter_notop(skbc->ub, bufid, extra);
-+}
-+
-+/*
-+ * UB_DGRAMRCVBUF
-+ */
-+
-+int ub_sockrcvbuf_charge(struct sock *sk, struct sk_buff *skb)
-+{
-+ unsigned long chargesize;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+
-+ chargesize = skb_charge_fullsize(skb);
-+ if (charge_beancounter(sock_bc(sk)->ub, UB_DGRAMRCVBUF,
-+ chargesize, UB_HARD))
-+ return -ENOMEM;
-+
-+ ub_skb_set_charge(skb, sk, chargesize, UB_DGRAMRCVBUF);
-+ return 0;
-+}
-+
-+EXPORT_SYMBOL(ub_sockrcvbuf_charge);
-+
-+static void ub_sockrcvbuf_uncharge(struct sk_buff *skb)
-+{
-+ uncharge_beancounter(skb_bc(skb)->ub, UB_DGRAMRCVBUF,
-+ skb_bc(skb)->charged);
-+ ub_skb_set_uncharge(skb);
-+}
-+
-+/*
-+ * UB_TCPRCVBUF
-+ */
-+
-+int ub_sock_tcp_chargerecv(struct sock *sk, struct sk_buff *skb,
-+ enum ub_severity strict)
-+{
-+ int retval;
-+ unsigned long flags;
-+ struct user_beancounter *ub;
-+ struct sock_beancounter *skbc;
-+ unsigned long chargesize;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+ skbc = sock_bc(sk);
-+
-+ chargesize = skb_charge_fullsize(skb);
-+ if (likely(skbc->forw_space >= chargesize)) {
-+ skbc->forw_space -= chargesize;
-+ __ub_skb_set_charge(skb, sk, chargesize, UB_TCPRCVBUF);
-+ return 0;
-+ }
-+
-+ /*
-+ * Memory pressure reactions:
-+ * 1) set UB_RMEM_KEEP (clearing UB_RMEM_EXPAND)
-+ * 2) set UB_RMEM_SHRINK and tcp_clamp_window()
-+ * tcp_collapse_queues() if rmem_alloc > rcvbuf
-+ * 3) drop OFO, tcp_purge_ofo()
-+ * 4) drop all.
-+ * Currently, we do #2 and #3 at once (which means that current
-+ * collapsing of OFO queue in tcp_collapse_queues() is a waste of time,
-+ * for example...)
-+ * On memory pressure we jump from #0 to #3, and when the pressure
-+ * subsides, to #1.
-+ */
-+ retval = 0;
-+ for (ub = sock_bc(sk)->ub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_parms[UB_TCPRCVBUF].held += chargesize;
-+ if (ub->ub_parms[UB_TCPRCVBUF].held >
-+ ub->ub_parms[UB_TCPRCVBUF].barrier &&
-+ strict != UB_FORCE)
-+ goto excess;
-+ ub_adjust_maxheld(ub, UB_TCPRCVBUF);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+out:
-+ if (retval == 0) {
-+ charge_beancounter_notop(sock_bc(sk)->ub, UB_TCPRCVBUF,
-+ chargesize);
-+ ub_skb_set_charge(skb, sk, chargesize, UB_TCPRCVBUF);
-+ }
-+ return retval;
-+
-+excess:
-+ ub->ub_rmem_pressure = UB_RMEM_SHRINK;
-+ if (strict == UB_HARD)
-+ retval = -ENOMEM;
-+ if (ub->ub_parms[UB_TCPRCVBUF].held > ub->ub_parms[UB_TCPRCVBUF].limit)
-+ retval = -ENOMEM;
-+ /*
-+ * We try to leave numsock*maxadvmss as a reserve for sockets not
-+ * queueing any data yet (if the difference between the barrier and the
-+ * limit is enough for this reserve).
-+ */
-+ if (ub->ub_parms[UB_TCPRCVBUF].held +
-+ ub->ub_parms[UB_NUMTCPSOCK].limit * ub->ub_maxadvmss
-+ > ub->ub_parms[UB_TCPRCVBUF].limit &&
-+ atomic_read(&sk->sk_rmem_alloc))
-+ retval = -ENOMEM;
-+ if (retval) {
-+ ub->ub_parms[UB_TCPRCVBUF].held -= chargesize;
-+ ub->ub_parms[UB_TCPRCVBUF].failcnt++;
-+ }
-+ ub_adjust_maxheld(ub, UB_TCPRCVBUF);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ goto out;
-+}
-+EXPORT_SYMBOL(ub_sock_tcp_chargerecv);
-+
-+static void ub_tcprcvbuf_uncharge(struct sk_buff *skb)
-+{
-+ unsigned long flags;
-+ unsigned long held, bar;
-+ int prev_pres;
-+ struct user_beancounter *ub;
-+
-+ for (ub = skb_bc(skb)->ub; ub->parent != NULL; ub = ub->parent);
-+ if (ub_barrier_farsz(ub, UB_TCPRCVBUF)) {
-+ sock_bc(skb->sk)->forw_space += skb_bc(skb)->charged;
-+ ub_skb_set_uncharge(skb);
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (ub->ub_parms[UB_TCPRCVBUF].held < skb_bc(skb)->charged) {
-+ printk(KERN_ERR "Uncharging %d for tcprcvbuf of %p with %lu\n",
-+ skb_bc(skb)->charged,
-+ ub, ub->ub_parms[UB_TCPRCVBUF].held);
-+ /* ass-saving bung */
-+ skb_bc(skb)->charged = ub->ub_parms[UB_TCPRCVBUF].held;
-+ }
-+ ub->ub_parms[UB_TCPRCVBUF].held -= skb_bc(skb)->charged;
-+ held = ub->ub_parms[UB_TCPRCVBUF].held;
-+ bar = ub->ub_parms[UB_TCPRCVBUF].barrier;
-+ prev_pres = ub->ub_rmem_pressure;
-+ if (held <= bar - (bar >> 2))
-+ ub->ub_rmem_pressure = UB_RMEM_EXPAND;
-+ else if (held <= bar)
-+ ub->ub_rmem_pressure = UB_RMEM_KEEP;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ uncharge_beancounter_notop(skb_bc(skb)->ub, UB_TCPRCVBUF,
-+ skb_bc(skb)->charged);
-+ ub_skb_set_uncharge(skb);
-+}
-+EXPORT_SYMBOL(ub_tcprcvbuf_charge_forced);
-+
-+
-+/*
-+ * UB_OTHERSOCKBUF and UB_TCPSNDBUF
-+ */
-+
-+static void ub_socksndbuf_uncharge(struct sk_buff *skb)
-+{
-+ unsigned long flags;
-+ struct user_beancounter *ub, *cub;
-+ unsigned long chargesize;
-+
-+ cub = skb_bc(skb)->ub;
-+ for (ub = cub; ub->parent != NULL; ub = ub->parent);
-+ chargesize = skb_bc(skb)->charged;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __uncharge_beancounter_locked(ub, UB_OTHERSOCKBUF, chargesize);
-+ if (skb->sk != NULL && sock_has_ubc(skb->sk))
-+ ub_sock_wcharge_dec(skb->sk, chargesize);
-+ ub_sock_snd_wakeup(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ uncharge_beancounter_notop(cub, UB_OTHERSOCKBUF, chargesize);
-+ ub_skb_set_uncharge(skb);
-+}
-+
-+/* expected to be called under socket lock */
-+static void ub_tcpsndbuf_uncharge(struct sk_buff *skb)
-+{
-+ /*
-+ * ub_sock_ret_wreserv call is abused here, we just want to uncharge
-+ * skb size. However, to reduce duplication of the code doing
-+ * ub_hfbarrier_hit check, ub_wcharged reduction, and wakeup we call
-+ * a function that already does all of this. 2006/04/27 SAW
-+ */
-+ ub_sock_ret_wreserv(skb->sk, UB_TCPSNDBUF, skb_bc(skb)->charged,
-+ sock_bc(skb->sk)->poll_reserv);
-+ ub_skb_set_uncharge(skb);
-+}
-+
-+void ub_skb_uncharge(struct sk_buff *skb)
-+{
-+ switch (skb_bc(skb)->resource) {
-+ case UB_TCPSNDBUF:
-+ ub_tcpsndbuf_uncharge(skb);
-+ break;
-+ case UB_TCPRCVBUF:
-+ ub_tcprcvbuf_uncharge(skb);
-+ break;
-+ case UB_DGRAMRCVBUF:
-+ ub_sockrcvbuf_uncharge(skb);
-+ break;
-+ case UB_OTHERSOCKBUF:
-+ ub_socksndbuf_uncharge(skb);
-+ break;
-+ }
-+}
-+
-+EXPORT_SYMBOL(ub_skb_uncharge); /* due to skb_orphan()/conntracks */
-+
-+/*
-+ * TCP send buffers accouting. Paged part
-+ */
-+
-+int ub_sock_tcp_chargepage(struct sock *sk)
-+{
-+ struct sock_beancounter *skbc;
-+ unsigned long extra;
-+ int err;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+
-+ skbc = sock_bc(sk);
-+ ub_sock_make_wreserv(sk, UB_TCPSNDBUF, PAGE_SIZE);
-+ if (likely(skbc->poll_reserv >= PAGE_SIZE)) {
-+ skbc->poll_reserv -= PAGE_SIZE;
-+ return 0;
-+ }
-+
-+ /*
-+ * Ok, full page is not available.
-+ * However, this function must succeed if poll previously indicated
-+ * that write is possible. We better make a forced charge here
-+ * than reserve a whole page in poll.
-+ */
-+ err = ub_sock_make_wreserv(sk, UB_TCPSNDBUF, SOCK_MIN_UBCSPACE);
-+ if (unlikely(err < 0))
-+ goto out;
-+ if (skbc->poll_reserv < PAGE_SIZE) {
-+ extra = PAGE_SIZE - skbc->poll_reserv;
-+ err = charge_beancounter(skbc->ub, UB_TCPSNDBUF, extra,
-+ UB_FORCE);
-+ if (err < 0)
-+ goto out;
-+ skbc->poll_reserv += extra;
-+ }
-+ skbc->poll_reserv -= PAGE_SIZE;
-+ return 0;
-+
-+out:
-+ return err;
-+}
-+
-+void ub_sock_tcp_detachpage(struct sock *sk)
-+{
-+ struct sk_buff *skb;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return;
-+
-+ /* The page is just detached from socket. The last skb in queue
-+ with paged part holds referrence to it */
-+ skb = skb_peek_tail(&sk->sk_write_queue);
-+ if (skb == NULL) {
-+ /* If the queue is empty - all data is sent and page is about
-+ to be freed */
-+ ub_sock_ret_wreserv(sk, UB_TCPSNDBUF, PAGE_SIZE,
-+ sock_bc(sk)->poll_reserv);
-+ } else {
-+ /* Last skb is a good aproximation for a last skb with
-+ paged part */
-+ skb_bc(skb)->charged += PAGE_SIZE;
-+ }
-+}
-+
-+/*
-+ * TCPSNDBUF charge functions below are called in the following cases:
-+ * - sending of SYN, SYN-ACK, FIN, the latter charge is forced by
-+ * some technical reasons in TCP code;
-+ * - fragmentation of TCP packets.
-+ * These functions are allowed but not required to use poll_reserv.
-+ * Originally, these functions didn't do that, since it didn't make
-+ * any sense. Now, since poll_reserv now has a function of general reserve,
-+ * they use it.
-+ */
-+int ub_sock_tcp_chargesend(struct sock *sk, struct sk_buff *skb,
-+ enum ub_severity strict)
-+{
-+ int ret;
-+ unsigned long chargesize;
-+ struct sock_beancounter *skbc;
-+ struct user_beancounter *ub;
-+ unsigned long flags;
-+
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return 0;
-+
-+ skbc = sock_bc(sk);
-+ chargesize = skb_charge_fullsize(skb);
-+ if (likely(skbc->poll_reserv >= chargesize)) {
-+ skbc->poll_reserv -= chargesize;
-+ __ub_skb_set_charge(skb, sk, chargesize, UB_TCPSNDBUF);
-+ /* XXX hack, see ub_skb_set_charge */
-+ skb->sk = sk;
-+ return 0;
-+ }
-+
-+ for (ub = skbc->ub; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ret = __charge_beancounter_locked(ub, UB_TCPSNDBUF,
-+ chargesize, strict);
-+ /*
-+ * Note: this check is not equivalent of the corresponding check
-+ * in makewreserv. It's similar in spirit, but an equivalent check
-+ * would be too long and complicated here.
-+ */
-+ if (!ret && ub_barrier_hit(ub, UB_TCPSNDBUF))
-+ skbc->ub_wcharged += chargesize;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ if (likely(!ret)) {
-+ charge_beancounter_notop(skbc->ub, UB_TCPSNDBUF, chargesize);
-+ ub_skb_set_charge(skb, sk, chargesize, UB_TCPSNDBUF);
-+ }
-+ return ret;
-+}
-+EXPORT_SYMBOL(ub_sock_tcp_chargesend);
-+
-+void ub_sock_tcp_unchargesend(struct sock *sk, unsigned long size)
-+{
-+ if (unlikely(!sock_has_ubc(sk)))
-+ return;
-+ /* see ub_tcpsndbuf_uncharge */
-+ ub_sock_ret_wreserv(sk, UB_TCPSNDBUF, size, sock_bc(sk)->poll_reserv);
-+}
-+EXPORT_SYMBOL(ub_tcpsndbuf_charge_forced);
-+
-+/*
-+ * Initialization
-+ */
-+
-+int __init skbc_cache_init(void)
-+{
-+ return 0;
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_oom.c linux-2.6.9-ve023stab030/kernel/ub/ub_oom.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_oom.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_oom.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,93 @@
-+/*
-+ * kernel/ub/ub_oom.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/spinlock.h>
-+#include <linux/mm.h>
-+#include <linux/swap.h>
-+
-+#include <asm/page.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_misc.h>
-+#include <ub/ub_hash.h>
-+
-+static inline long ub_current_overdraft(struct user_beancounter *ub)
-+{
-+ return ub->ub_parms[UB_OOMGUARPAGES].held +
-+ ((ub->ub_parms[UB_KMEMSIZE].held
-+ + ub->ub_parms[UB_TCPSNDBUF].held
-+ + ub->ub_parms[UB_TCPRCVBUF].held
-+ + ub->ub_parms[UB_OTHERSOCKBUF].held
-+ + ub->ub_parms[UB_DGRAMRCVBUF].held)
-+ >> PAGE_SHIFT) - ub->ub_parms[UB_OOMGUARPAGES].barrier;
-+}
-+
-+/*
-+ * Select an user_beancounter to find task inside it to be killed.
-+ * Select the beancounter with the biggest excess of resource usage
-+ * to kill a process belonging to that beancounter later, or returns
-+ * NULL if there are no beancounters with such excess.
-+ */
-+
-+struct user_beancounter *ub_select_worst(long *ub_maxover)
-+{
-+ struct user_beancounter *ub, *walkp;
-+ unsigned long flags;
-+ int i;
-+
-+ *ub_maxover = 0;
-+ ub = NULL;
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+
-+ for_each_beancounter(i, walkp) {
-+ long ub_overdraft;
-+
-+ if (walkp->parent != NULL)
-+ continue;
-+ if (walkp->ub_oom_noproc)
-+ continue;
-+ ub_overdraft = ub_current_overdraft(walkp);
-+ if (ub_overdraft > *ub_maxover) {
-+ ub = walkp;
-+ *ub_maxover = ub_overdraft;
-+ }
-+ }
-+ get_beancounter(ub);
-+ if(ub)
-+ ub->ub_oom_noproc = 1;
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+
-+ return ub;
-+}
-+
-+void ub_oomkill_task(struct mm_struct * mm, struct user_beancounter *ub,
-+ long maxover)
-+{
-+ static struct ub_rate_info ri = { 5, 60*HZ };
-+
-+ /* increment is serialized with oom_generation_lock */
-+ mm_ub(mm)->ub_parms[UB_OOMGUARPAGES].failcnt++;
-+
-+ if (ub_ratelimit(&ri))
-+ show_mem();
-+}
-+
-+void ub_clear_oom(void)
-+{
-+ unsigned long flags;
-+ int i;
-+ struct user_beancounter *walkp;
-+
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ for_each_beancounter(i, walkp)
-+ walkp->ub_oom_noproc = 0;
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_page_bc.c linux-2.6.9-ve023stab030/kernel/ub/ub_page_bc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_page_bc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_page_bc.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,452 @@
-+/*
-+ * kernel/ub/ub_page_bc.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/spinlock.h>
-+#include <linux/slab.h>
-+#include <linux/mm.h>
-+#include <linux/gfp.h>
-+#include <linux/vmalloc.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_hash.h>
-+#include <ub/ub_vmpages.h>
-+#include <ub/ub_page.h>
-+
-+static kmem_cache_t *pb_cachep;
-+static spinlock_t pb_lock = SPIN_LOCK_UNLOCKED;
-+static struct page_beancounter **pb_hash_table;
-+static unsigned int pb_hash_mask;
-+
-+/*
-+ * Auxiliary staff
-+ */
-+
-+static inline struct page_beancounter *next_page_pb(struct page_beancounter *p)
-+{
-+ return list_entry(p->page_list.next, struct page_beancounter,
-+ page_list);
-+}
-+
-+static inline struct page_beancounter *prev_page_pb(struct page_beancounter *p)
-+{
-+ return list_entry(p->page_list.prev, struct page_beancounter,
-+ page_list);
-+}
-+
-+/*
-+ * Held pages manipulation
-+ */
-+static inline void set_held_pages(struct user_beancounter *bc)
-+{
-+ /* all three depend on ub_held_pages */
-+ __ub_update_physpages(bc);
-+ __ub_update_oomguarpages(bc);
-+ __ub_update_privvm(bc);
-+}
-+
-+static inline void do_dec_held_pages(struct user_beancounter *ub, int value)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_held_pages -= value;
-+ set_held_pages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+static void dec_held_pages(struct user_beancounter *ub, int value)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_dec_held_pages(ub, value);
-+}
-+
-+static inline void do_inc_held_pages(struct user_beancounter *ub, int value)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_held_pages += value;
-+ set_held_pages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+static void inc_held_pages(struct user_beancounter *ub, int value)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_inc_held_pages(ub, value);
-+}
-+
-+/*
-+ * Alloc - free
-+ */
-+
-+inline int pb_alloc(struct page_beancounter **pbc)
-+{
-+ *pbc = kmem_cache_alloc(pb_cachep, GFP_KERNEL);
-+ if (*pbc != NULL)
-+ (*pbc)->pb_magic = PB_MAGIC;
-+ return (*pbc == NULL);
-+}
-+
-+inline void pb_free(struct page_beancounter **pb)
-+{
-+ if (*pb != NULL) {
-+ kmem_cache_free(pb_cachep, *pb);
-+ *pb = NULL;
-+ }
-+}
-+
-+void pb_free_list(struct page_beancounter **p_pb)
-+{
-+ struct page_beancounter *list = *p_pb, *pb;
-+ while (list) {
-+ pb = list;
-+ list = list->next_hash;
-+ pb_free(&pb);
-+ }
-+ *p_pb = NULL;
-+}
-+
-+/*
-+ * head -> <new objs> -> <old objs> -> ...
-+ */
-+static int __alloc_list(struct page_beancounter **head, int num)
-+{
-+ struct page_beancounter *pb;
-+
-+ while (num > 0) {
-+ if (pb_alloc(&pb))
-+ return -1;
-+ pb->next_hash = *head;
-+ *head = pb;
-+ num--;
-+ }
-+
-+ return num;
-+}
-+
-+/*
-+ * Ensure that the list contains at least num elements.
-+ * p_pb points to an initialized list, may be of the zero length.
-+ *
-+ * mm->page_table_lock should be held
-+ */
-+int pb_alloc_list(struct page_beancounter **p_pb, int num,
-+ struct mm_struct *mm)
-+{
-+ struct page_beancounter *list;
-+
-+ for (list = *p_pb; list != NULL && num; list = list->next_hash, num--);
-+ if (!num)
-+ return 0;
-+
-+ spin_unlock(&mm->page_table_lock);
-+ /*
-+ * *p_pb(after) *p_pb (before)
-+ * \ \
-+ * <new objs> -...-> <old objs> -> ...
-+ */
-+ if (__alloc_list(p_pb, num) < 0)
-+ goto nomem;
-+ spin_lock(&mm->page_table_lock);
-+ return 0;
-+
-+nomem:
-+ spin_lock(&mm->page_table_lock);
-+ pb_free_list(p_pb);
-+ return -ENOMEM;
-+}
-+
-+/*
-+ * Hash routines
-+ */
-+
-+static inline int pb_hash(struct user_beancounter *ub, struct page *page)
-+{
-+ return (page_to_pfn(page) + (ub->ub_uid << 10)) & pb_hash_mask;
-+}
-+
-+/* pb_lock should be held */
-+static inline void insert_pb(struct page_beancounter *p, struct page *page,
-+ struct user_beancounter *ub, int hash)
-+{
-+ p->page = page;
-+ p->ub = get_beancounter(ub);
-+ p->next_hash = pb_hash_table[hash];
-+ pb_hash_table[hash] = p;
-+}
-+
-+/*
-+ * Heart
-+ */
-+
-+int pb_reserve_all(struct page_beancounter **pbs)
-+{
-+ int i, need_alloc;
-+ unsigned long flags;
-+ struct user_beancounter *ub;
-+
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ need_alloc = 0;
-+ for_each_beancounter(i, ub)
-+ need_alloc++;
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+
-+ if (!__alloc_list(pbs, need_alloc))
-+ return 0;
-+
-+ pb_free_list(pbs);
-+ return -ENOMEM;
-+}
-+
-+static inline int pb_check_magic(struct page *page)
-+{
-+ struct page_beancounter *pb;
-+ int i, pbs_found;
-+ struct page_beancounter **q;
-+
-+ pb = page_pbc(page);
-+ if (likely(pb == NULL || pb->pb_magic == PB_MAGIC))
-+ return 0;
-+
-+ page_pbc(page) = NULL;
-+ printk(KERN_ERR "UBC: BUG: fixing bad page PBs for %p\n", page);
-+ printk(KERN_ERR " flags: 0x%0*lx mapping: %p mapcount: %d count: %d\n",
-+ (int)(2*sizeof(page_flags_t)), (unsigned long)page->flags,
-+ page->mapping, page_mapcount(page), page_count(page));
-+ printk(KERN_ERR " PB is %p magic %lu\n", pb, pb->pb_magic);
-+ dump_stack();
-+
-+ pbs_found = 0;
-+ for (i = 0; i < pb_hash_mask + 1; i++) {
-+ q = &pb_hash_table[i];
-+ while (1) {
-+ pb = *q;
-+ if (pb == NULL)
-+ break;
-+
-+ if (pb->page == page) {
-+ printk(KERN_ERR " Leak PB %p for UB %p\n",
-+ pb, pb->ub);
-+ *q = pb->next_hash;
-+ pbs_found++;
-+ }
-+ q = &pb->next_hash;
-+ }
-+ }
-+
-+ printk(KERN_ERR " removed %d PBs from hash\n", pbs_found);
-+ return -1;
-+}
-+
-+int pb_add_ref(struct page *page, struct user_beancounter *bc,
-+ struct page_beancounter **p_pb)
-+{
-+ int hash;
-+ struct page_beancounter *p;
-+ int shift;
-+ struct page_beancounter *head;
-+
-+ if (bc == NULL)
-+ return 0;
-+ if (!PageAnon(page) && is_shmem_mapping(page->mapping))
-+ return 0;
-+
-+ hash = pb_hash(bc, page);
-+
-+ spin_lock(&pb_lock);
-+ for (p = pb_hash_table[hash];
-+ p != NULL && (p->page != page || p->ub != bc);
-+ p = p->next_hash);
-+ if (p != NULL) {
-+ /*
-+ * This page is already associated with this beancounter,
-+ * increment the usage counter.
-+ */
-+ PB_COUNT_INC(p->refcount);
-+ spin_unlock(&pb_lock);
-+ return 0;
-+ }
-+
-+ p = *p_pb;
-+ if (p == NULL) {
-+ spin_unlock(&pb_lock);
-+ return -1;
-+ }
-+
-+ if (pb_check_magic(page)) {
-+ spin_unlock(&pb_lock);
-+ return 0;
-+ }
-+
-+ *p_pb = NULL;
-+ insert_pb(p, page, bc, hash);
-+ head = page_pbc(page);
-+
-+ if (head != NULL) {
-+ /*
-+ * Move the first element to the end of the list.
-+ * List head (pb_head) is set to the next entry.
-+ * Note that this code works even if head is the only element
-+ * on the list (because it's cyclic).
-+ */
-+ page_pbc(page) = next_page_pb(head);
-+ PB_SHIFT_INC(head->refcount);
-+ shift = PB_SHIFT_GET(head->refcount);
-+ /*
-+ * Update user beancounter, the share of head has been changed.
-+ * Note that the shift counter is taken after increment.
-+ */
-+ dec_held_pages(head->ub, UB_PAGE_WEIGHT >> shift);
-+ /* add the new page beancounter to the end of the list */
-+ list_add_tail(&p->page_list, &page_pbc(page)->page_list);
-+ } else {
-+ page_pbc(page) = p;
-+ shift = 0;
-+ INIT_LIST_HEAD(&p->page_list);
-+ }
-+
-+ p->refcount = PB_REFCOUNT_MAKE(shift, 1);
-+ spin_unlock(&pb_lock);
-+
-+ /* update user beancounter for the new page beancounter */
-+ inc_held_pages(bc, UB_PAGE_WEIGHT >> shift);
-+ return 0;
-+}
-+
-+void pb_remove_ref(struct page *page, struct user_beancounter *bc)
-+{
-+ int hash;
-+ struct page_beancounter *p, **q;
-+ int shift, shiftt;
-+
-+ if (bc == NULL)
-+ return;
-+ if (!PageAnon(page) && is_shmem_mapping(page->mapping))
-+ return;
-+
-+ hash = pb_hash(bc, page);
-+
-+ spin_lock(&pb_lock);
-+ if (pb_check_magic(page))
-+ goto out_unlock;
-+
-+ for (q = pb_hash_table + hash, p = *q;
-+ p != NULL && (p->page != page || p->ub != bc);
-+ q = &p->next_hash, p = *q);
-+ if (p == NULL)
-+ goto out_unlock;
-+
-+ PB_COUNT_DEC(p->refcount);
-+ if (PB_COUNT_GET(p->refcount))
-+ /*
-+ * More references from the same user beancounter exist.
-+ * Nothing needs to be done.
-+ */
-+ goto out_unlock;
-+
-+ /* remove from the hash list */
-+ *q = p->next_hash;
-+
-+ shift = PB_SHIFT_GET(p->refcount);
-+
-+ dec_held_pages(p->ub, UB_PAGE_WEIGHT >> shift);
-+
-+ if (page_pbc(page) == p) {
-+ if (list_empty(&p->page_list))
-+ goto out_free;
-+ page_pbc(page) = next_page_pb(p);
-+ }
-+ list_del(&p->page_list);
-+ put_beancounter(p->ub);
-+ pb_free(&p);
-+
-+ /* Now balance the list. Move the tail and adjust its shift counter. */
-+ p = prev_page_pb(page_pbc(page));
-+ shiftt = PB_SHIFT_GET(p->refcount);
-+ page_pbc(page) = p;
-+ PB_SHIFT_DEC(p->refcount);
-+
-+ inc_held_pages(p->ub, UB_PAGE_WEIGHT >> shiftt);
-+
-+ /*
-+ * If the shift counter of the moved beancounter is different from the
-+ * removed one's, repeat the procedure for one more tail beancounter
-+ */
-+ if (shiftt > shift) {
-+ p = prev_page_pb(page_pbc(page));
-+ page_pbc(page) = p;
-+ PB_SHIFT_DEC(p->refcount);
-+ inc_held_pages(p->ub, UB_PAGE_WEIGHT >> shiftt);
-+ }
-+ spin_unlock(&pb_lock);
-+ return;
-+
-+out_free:
-+ page_pbc(page) = NULL;
-+ put_beancounter(p->ub);
-+ pb_free(&p);
-+out_unlock:
-+ spin_unlock(&pb_lock);
-+ return;
-+}
-+
-+void pb_add_list_ref(struct page *page, struct user_beancounter *bc,
-+ struct page_beancounter **p_pb)
-+{
-+ struct page_beancounter *list, *pb;
-+
-+ pb = *p_pb;
-+ if (pb == NULL) {
-+ /* Typical case due to caller constraints */
-+ if (pb_add_ref(page, bc, &pb))
-+ BUG();
-+ return;
-+ }
-+
-+ list = pb->next_hash;
-+ if (pb_add_ref(page, bc, &pb))
-+ BUG();
-+ if (pb != NULL) {
-+ pb->next_hash = list;
-+ list = pb;
-+ }
-+ *p_pb = list;
-+}
-+
-+struct user_beancounter *pb_grab_page_ub(struct page *page)
-+{
-+ struct page_beancounter *pb;
-+ struct user_beancounter *ub;
-+
-+ spin_lock(&pb_lock);
-+ pb = page_pbc(page);
-+ ub = (pb == NULL ? ERR_PTR(-EINVAL) :
-+ get_beancounter(pb->ub));
-+ spin_unlock(&pb_lock);
-+ return ub;
-+}
-+
-+void __init page_beancounters_init(void)
-+{
-+ unsigned long hash_size;
-+
-+ pb_cachep = kmem_cache_create("page_beancounter",
-+ sizeof(struct page_beancounter), 0,
-+ SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL, NULL);
-+ hash_size = num_physpages >> 2;
-+ for (pb_hash_mask = 1;
-+ (hash_size & pb_hash_mask) != hash_size;
-+ pb_hash_mask = (pb_hash_mask << 1) + 1);
-+ hash_size = pb_hash_mask + 1;
-+ printk(KERN_INFO "Page beancounter hash is %lu entries.\n", hash_size);
-+ pb_hash_table = vmalloc(hash_size * sizeof(struct page_beancounter *));
-+ memset(pb_hash_table, 0, hash_size * sizeof(struct page_beancounter *));
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_pages.c linux-2.6.9-ve023stab030/kernel/ub/ub_pages.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_pages.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_pages.c 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,483 @@
-+/*
-+ * kernel/ub/ub_pages.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/mm.h>
-+#include <linux/highmem.h>
-+#include <linux/virtinfo.h>
-+#include <linux/module.h>
-+
-+#include <asm/page.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-+
-+void fastcall __ub_update_physpages(struct user_beancounter *ub)
-+{
-+ ub->ub_parms[UB_PHYSPAGES].held = ub->ub_tmpfs_respages
-+ + (ub->ub_held_pages >> UB_PAGE_WEIGHT_SHIFT);
-+ ub_adjust_maxheld(ub, UB_PHYSPAGES);
-+}
-+
-+void fastcall __ub_update_oomguarpages(struct user_beancounter *ub)
-+{
-+ ub->ub_parms[UB_OOMGUARPAGES].held =
-+ ub->ub_parms[UB_PHYSPAGES].held + ub->ub_swap_pages;
-+ ub_adjust_maxheld(ub, UB_OOMGUARPAGES);
-+}
-+
-+void fastcall __ub_update_privvm(struct user_beancounter *ub)
-+{
-+ ub->ub_parms[UB_PRIVVMPAGES].held =
-+ (ub->ub_held_pages >> UB_PAGE_WEIGHT_SHIFT)
-+ + ub->ub_unused_privvmpages
-+ + ub->ub_parms[UB_SHMPAGES].held;
-+ ub_adjust_maxheld(ub, UB_PRIVVMPAGES);
-+}
-+
-+static inline unsigned long pages_in_pte(pte_t *pte)
-+{
-+ struct page *pg;
-+
-+ if (!pte_present(*pte))
-+ return 0;
-+
-+ pg = pte_page(*pte);
-+ if (!pfn_valid(page_to_pfn(pg)))
-+ return 0;
-+ if (PageReserved(pg))
-+ return 0;
-+ return 1;
-+}
-+
-+static inline unsigned long pages_in_pmd(pmd_t *pmd,
-+ unsigned long start, unsigned long end)
-+{
-+ unsigned long pages, pmd_end, address;
-+ pte_t *pte;
-+
-+ pages = 0;
-+ if (pmd_none(*pmd))
-+ goto out;
-+ if (pmd_bad(*pmd)) {
-+ pmd_ERROR(*pmd);
-+ pmd_clear(pmd);
-+ goto out;
-+ }
-+
-+ pte = pte_offset_map(pmd, start);
-+ pmd_end = (start + PMD_SIZE) & PMD_MASK;
-+ if (pmd_end && (end > pmd_end))
-+ end = pmd_end;
-+
-+ address = start;
-+ do {
-+ pages += pages_in_pte(pte);
-+ address += PAGE_SIZE;
-+ pte++;
-+ } while (address && (address < end));
-+ pte_unmap(pte-1);
-+out:
-+ return pages;
-+}
-+
-+static inline unsigned long pages_in_pgd(pgd_t *pgd,
-+ unsigned long start, unsigned long end)
-+{
-+ unsigned long pages, pgd_end, address;
-+ pmd_t *pmd;
-+
-+ pages = 0;
-+ if (pgd_none(*pgd))
-+ goto out;
-+ if (pgd_bad(*pgd)) {
-+ pgd_ERROR(*pgd);
-+ pgd_clear(pgd);
-+ goto out;
-+ }
-+
-+ pmd = pmd_offset(pgd, start);
-+ pgd_end = (start + PGDIR_SIZE) & PGDIR_MASK;
-+ if (pgd_end && (end > pgd_end))
-+ end = pgd_end;
-+
-+ address = start;
-+ do {
-+ pages += pages_in_pmd(pmd, address, end);
-+ address = (address + PMD_SIZE) & PMD_MASK;
-+ pmd++;
-+ } while (address && (address < end));
-+out:
-+ return pages;
-+}
-+
-+/*
-+ * Calculate number of pages presenting in the address space within single
-+ * vm_area. mm->page_table_lock must be already held.
-+ */
-+unsigned long pages_in_vma_range(struct vm_area_struct *vma,
-+ unsigned long start, unsigned long end)
-+{
-+ unsigned long address, pages;
-+ pgd_t *pgd;
-+
-+ pages = 0;
-+ address = start;
-+ pgd = pgd_offset(vma->vm_mm, start);
-+ do {
-+ pages += pages_in_pgd(pgd, address, end);
-+ address = (address + PGDIR_SIZE) & PGDIR_MASK;
-+ pgd++;
-+ } while (address && (address < end));
-+
-+ return pages;
-+}
-+
-+int ub_unused_privvm_inc(struct user_beancounter *ub, long size,
-+ struct vm_area_struct *vma)
-+{
-+ unsigned long flags;
-+
-+ if (ub == NULL || !VM_UB_PRIVATE(vma->vm_flags, vma->vm_file))
-+ return 0;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_unused_privvmpages += size;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ return 0;
-+}
-+
-+static void __unused_privvm_dec_locked(struct user_beancounter *ub,
-+ long size)
-+{
-+ /* catch possible overflow */
-+ if (ub->ub_unused_privvmpages < size) {
-+ uncharge_warn(ub, UB_UNUSEDPRIVVM,
-+ size, ub->ub_unused_privvmpages);
-+ size = ub->ub_unused_privvmpages;
-+ }
-+ ub->ub_unused_privvmpages -= size;
-+ __ub_update_privvm(ub);
-+}
-+
-+void __ub_unused_privvm_dec(struct user_beancounter *ub, long size)
-+{
-+ unsigned long flags;
-+
-+ if (ub == NULL)
-+ return;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __unused_privvm_dec_locked(ub, size);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+void ub_unused_privvm_dec(struct user_beancounter *ub, long size,
-+ struct vm_area_struct *vma)
-+{
-+ if (VM_UB_PRIVATE(vma->vm_flags, vma->vm_file))
-+ __ub_unused_privvm_dec(ub, size);
-+}
-+
-+static inline int __charge_privvm_locked(struct user_beancounter *ub,
-+ unsigned long s, enum ub_severity strict)
-+{
-+ if (__charge_beancounter_locked(ub, UB_PRIVVMPAGES, s, strict) < 0)
-+ return -ENOMEM;
-+
-+ ub->ub_unused_privvmpages += s;
-+ return 0;
-+}
-+
-+int ub_privvm_charge(struct user_beancounter *ub, unsigned long vm_flags,
-+ struct file *vm_file, unsigned long size)
-+{
-+ int retval;
-+ unsigned long flags;
-+
-+ if (ub == NULL || !VM_UB_PRIVATE(vm_flags, vm_file))
-+ return 0;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ retval = __charge_privvm_locked(ub, size >> PAGE_SHIFT, UB_SOFT);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return retval;
-+}
-+
-+void ub_privvm_uncharge(struct user_beancounter *ub, unsigned long vm_flags,
-+ struct file *vm_file, unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ if (ub == NULL || !VM_UB_PRIVATE(vm_flags, vm_file))
-+ return;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __unused_privvm_dec_locked(ub, size >> PAGE_SHIFT);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+int ub_protected_charge(struct user_beancounter *ub, unsigned long size,
-+ unsigned long newflags, struct vm_area_struct *vma)
-+{
-+ unsigned long flags;
-+ struct file *file;
-+
-+ if (ub == NULL)
-+ return PRIVVM_NO_CHARGE;
-+
-+ flags = vma->vm_flags;
-+ if (!((newflags ^ flags) & VM_WRITE))
-+ return PRIVVM_NO_CHARGE;
-+
-+ file = vma->vm_file;
-+ if (!VM_UB_PRIVATE(newflags | VM_WRITE, file))
-+ return PRIVVM_NO_CHARGE;
-+
-+ if (flags & VM_WRITE)
-+ return PRIVVM_TO_SHARED;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (__charge_privvm_locked(ub, size, UB_SOFT) < 0)
-+ goto err;
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return PRIVVM_TO_PRIVATE;
-+
-+err:
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return PRIVVM_ERROR;
-+}
-+
-+int ub_locked_mem_charge(struct user_beancounter *ub, long size)
-+{
-+ if (ub == NULL)
-+ return 0;
-+
-+ return charge_beancounter(ub, UB_LOCKEDPAGES,
-+ size >> PAGE_SHIFT, UB_HARD);
-+}
-+
-+void ub_locked_mem_uncharge(struct user_beancounter *ub, long size)
-+{
-+ if (ub == NULL)
-+ return;
-+
-+ uncharge_beancounter(ub, UB_LOCKEDPAGES, size >> PAGE_SHIFT);
-+}
-+
-+int ub_shmpages_charge(struct user_beancounter *ub, unsigned long size)
-+{
-+ int ret;
-+ unsigned long flags;
-+
-+ ret = 0;
-+ if (ub == NULL)
-+ return 0;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ret = __charge_beancounter_locked(ub, UB_SHMPAGES, size, UB_HARD);
-+ if (ret == 0)
-+ __ub_update_privvm(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ return ret;
-+}
-+
-+void ub_shmpages_uncharge(struct user_beancounter *ub, unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ if (ub == NULL)
-+ return;
-+
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __uncharge_beancounter_locked(ub, UB_SHMPAGES, size);
-+ __ub_update_privvm(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+int ub_memory_charge(struct user_beancounter *ub, unsigned long size,
-+ unsigned vm_flags, struct file *vm_file, int sv)
-+{
-+ struct user_beancounter *ubl;
-+ unsigned long flags;
-+
-+ if (ub == NULL)
-+ return 0;
-+
-+ size >>= PAGE_SHIFT;
-+
-+ if (size > UB_MAXVALUE)
-+ return -EINVAL;
-+
-+ BUG_ON(sv != UB_SOFT && sv != UB_HARD);
-+
-+ if ((vm_flags & VM_LOCKED) &&
-+ charge_beancounter(ub, UB_LOCKEDPAGES, size, sv))
-+ goto out_err;
-+ if (VM_UB_PRIVATE(vm_flags, vm_file)) {
-+ for (ubl = ub; ubl->parent != NULL; ubl = ubl->parent);
-+ spin_lock_irqsave(&ubl->ub_lock, flags);
-+ if (__charge_privvm_locked(ubl, size, sv))
-+ goto out_private;
-+ spin_unlock_irqrestore(&ubl->ub_lock, flags);
-+ }
-+ return 0;
-+
-+out_private:
-+ spin_unlock_irqrestore(&ubl->ub_lock, flags);
-+ if (vm_flags & VM_LOCKED)
-+ uncharge_beancounter(ub, UB_LOCKEDPAGES, size);
-+out_err:
-+ return -ENOMEM;
-+}
-+
-+void ub_memory_uncharge(struct user_beancounter *ub, unsigned long size,
-+ unsigned vm_flags, struct file *vm_file)
-+{
-+ unsigned long flags;
-+
-+ if (ub == NULL)
-+ return;
-+
-+ size >>= PAGE_SHIFT;
-+
-+ if (vm_flags & VM_LOCKED)
-+ uncharge_beancounter(ub, UB_LOCKEDPAGES, size);
-+ if (VM_UB_PRIVATE(vm_flags, vm_file)) {
-+ for (; ub->parent != NULL; ub = ub->parent);
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ __unused_privvm_dec_locked(ub, size);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+ }
-+}
-+
-+static inline void do_ub_tmpfs_respages_inc(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_tmpfs_respages += size;
-+ __ub_update_physpages(ub);
-+ __ub_update_oomguarpages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+void ub_tmpfs_respages_inc(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_ub_tmpfs_respages_inc(ub, size);
-+}
-+
-+static inline void do_ub_tmpfs_respages_dec(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ /* catch possible overflow */
-+ if (ub->ub_tmpfs_respages < size) {
-+ uncharge_warn(ub, UB_TMPFSPAGES,
-+ size, ub->ub_tmpfs_respages);
-+ size = ub->ub_tmpfs_respages;
-+ }
-+ ub->ub_tmpfs_respages -= size;
-+ /* update values what is the most interesting */
-+ __ub_update_physpages(ub);
-+ __ub_update_oomguarpages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+void ub_tmpfs_respages_dec(struct user_beancounter *ub,
-+ unsigned long size)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_ub_tmpfs_respages_dec(ub, size);
-+}
-+
-+#ifdef CONFIG_USER_SWAP_ACCOUNTING
-+static inline void do_ub_swapentry_inc(struct user_beancounter *ub)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_swap_pages++;
-+ __ub_update_oomguarpages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+void ub_swapentry_inc(struct user_beancounter *ub)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_ub_swapentry_inc(ub);
-+}
-+EXPORT_SYMBOL(ub_swapentry_inc);
-+
-+static inline void do_ub_swapentry_dec(struct user_beancounter *ub)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ if (ub->ub_swap_pages < 1)
-+ uncharge_warn(ub, UB_SWAPPAGES, 1, ub->ub_swap_pages);
-+ else
-+ ub->ub_swap_pages -= 1;
-+ __ub_update_oomguarpages(ub);
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+}
-+
-+void ub_swapentry_dec(struct user_beancounter *ub)
-+{
-+ for (; ub != NULL; ub = ub->parent)
-+ do_ub_swapentry_dec(ub);
-+}
-+#endif
-+
-+static int vmguar_enough_memory(struct vnotifier_block *self,
-+ unsigned long event, void *arg, int old_ret)
-+{
-+ struct user_beancounter *ub;
-+
-+ if (event != VIRTINFO_ENOUGHMEM)
-+ return old_ret;
-+
-+ for (ub = mm_ub(current->mm); ub->parent != NULL; ub = ub->parent);
-+ if (ub->ub_parms[UB_PRIVVMPAGES].held >
-+ ub->ub_parms[UB_VMGUARPAGES].barrier)
-+ return old_ret;
-+
-+ return NOTIFY_OK;
-+}
-+
-+static struct vnotifier_block vmguar_notifier_block = {
-+ .notifier_call = vmguar_enough_memory
-+};
-+
-+static int __init init_vmguar_notifier(void)
-+{
-+ virtinfo_notifier_register(VITYPE_GENERAL, &vmguar_notifier_block);
-+ return 0;
-+}
-+
-+static void __exit fini_vmguar_notifier(void)
-+{
-+ virtinfo_notifier_unregister(VITYPE_GENERAL, &vmguar_notifier_block);
-+}
-+
-+module_init(init_vmguar_notifier);
-+module_exit(fini_vmguar_notifier);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_proc.c linux-2.6.9-ve023stab030/kernel/ub/ub_proc.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_proc.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_proc.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,380 @@
-+/*
-+ * linux/fs/proc/proc_ub.c
-+ *
-+ * Copyright (C) 1998-2000 Andrey V. Savochkin <saw@saw.sw.com.sg>
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ * TODO:
-+ *
-+ * Changes:
-+ */
-+
-+#include <linux/errno.h>
-+#include <linux/sched.h>
-+#include <linux/kernel.h>
-+#include <linux/mm.h>
-+#include <linux/proc_fs.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_hash.h>
-+#include <ub/ub_debug.h>
-+
-+#include <asm/page.h>
-+#include <asm/uaccess.h>
-+
-+/*
-+ * we have 8 format strings depending on:
-+ * 1. BITS_PER_LONG
-+ * 2. CONFIG_UBC_KEEP_UNUSED
-+ * 3. resource number (see out_proc_beancounter)
-+ */
-+
-+#ifdef CONFIG_UBC_KEEP_UNUSED
-+#define REF_FORMAT "%5.5s %4i: %-12s "
-+#define UID_HEAD_STR "uid ref"
-+#else
-+#define REF_FORMAT "%10.10s: %-12s "
-+#define UID_HEAD_STR "uid"
-+#endif
-+#define REF2_FORMAT "%10s %-12s "
-+
-+#if BITS_PER_LONG == 32
-+#define RES_FORMAT "%10lu %10lu %10lu %10lu %10lu"
-+#define HEAD_FORMAT "%10s %10s %10s %10s %10s"
-+#define UB_PROC_LINE_TEXT (10+2+12+1+10+1+10+1+10+1+10+1+10)
-+#else
-+#define RES_FORMAT "%20lu %20lu %20lu %20lu %20lu"
-+#define HEAD_FORMAT "%20s %20s %20s %20s %20s"
-+#define UB_PROC_LINE_TEXT (10+2+12+1+20+1+20+1+20+1+20+1+20)
-+#endif
-+
-+#define UB_PROC_LINE_LEN (UB_PROC_LINE_TEXT + 1)
-+
-+static void out_proc_version(char *buf)
-+{
-+ int len;
-+
-+ len = sprintf(buf, "Version: 2.5");
-+ memset(buf + len, ' ', UB_PROC_LINE_TEXT - len);
-+ buf[UB_PROC_LINE_TEXT] = '\n';
-+}
-+
-+static void out_proc_head(char *buf)
-+{
-+ sprintf(buf, REF2_FORMAT HEAD_FORMAT,
-+ UID_HEAD_STR, "resource", "held", "maxheld",
-+ "barrier", "limit", "failcnt");
-+ buf[UB_PROC_LINE_TEXT] = '\n';
-+}
-+
-+static void out_proc_beancounter(char *buf, struct user_beancounter *ub, int r)
-+{
-+ if (r == 0) {
-+ char tmpbuf[64];
-+ print_ub_uid(ub, tmpbuf, sizeof(tmpbuf));
-+ sprintf(buf, REF_FORMAT RES_FORMAT,
-+ tmpbuf,
-+#ifdef CONFIG_UBC_KEEP_UNUSED
-+ atomic_read(&ub->ub_refcount),
-+#endif
-+ ub_rnames[r], ub->ub_parms[r].held,
-+ ub->ub_parms[r].maxheld, ub->ub_parms[r].barrier,
-+ ub->ub_parms[r].limit, ub->ub_parms[r].failcnt);
-+ } else
-+ sprintf(buf, REF2_FORMAT RES_FORMAT,
-+ "", ub_rnames[r],
-+ ub->ub_parms[r].held, ub->ub_parms[r].maxheld,
-+ ub->ub_parms[r].barrier, ub->ub_parms[r].limit,
-+ ub->ub_parms[r].failcnt);
-+
-+ buf[UB_PROC_LINE_TEXT] = '\n';
-+}
-+
-+static int ub_accessible(struct user_beancounter *ub,
-+ struct user_beancounter *exec_ub,
-+ struct file *file)
-+{
-+ struct user_beancounter *p, *q;
-+
-+ for (p = exec_ub; p->parent != NULL; p = p->parent);
-+ for (q = ub; q->parent != NULL; q = q->parent);
-+ if (p != get_ub0() && q != p)
-+ return 0;
-+ if (ub->parent == NULL)
-+ return 1;
-+ return file->private_data == NULL ? 0 : 1;
-+}
-+
-+static ssize_t ub_proc_read(struct file *file, char *usrbuf, size_t len,
-+ loff_t *poff)
-+{
-+ ssize_t retval;
-+ char *buf;
-+ unsigned long flags;
-+ int i, resource;
-+ struct ub_hash_slot *slot;
-+ struct user_beancounter *ub;
-+ struct user_beancounter *exec_ub = get_exec_ub();
-+ loff_t n, off;
-+ int rem, produced, job, tocopy;
-+ const int is_capable =
-+ (capable(CAP_DAC_OVERRIDE) || capable(CAP_DAC_READ_SEARCH));
-+
-+ retval = -ENOBUFS;
-+ buf = (char *)__get_free_page(GFP_KERNEL);
-+ if (buf == NULL)
-+ goto out;
-+
-+ retval = 0;
-+ if (!is_capable)
-+ goto out_free;
-+
-+ off = *poff;
-+ if (off < 0) /* can't happen, just in case */
-+ goto inval;
-+
-+again:
-+ i = 0;
-+ slot = ub_hash;
-+ n = off; /* The amount of data tp skip */
-+ produced = 0;
-+ if (n < (UB_PROC_LINE_LEN * 2)) {
-+ if (n < UB_PROC_LINE_LEN) {
-+ out_proc_version(buf);
-+ produced += UB_PROC_LINE_LEN;
-+ n += UB_PROC_LINE_LEN;
-+ }
-+ out_proc_head(buf + produced);
-+ produced += UB_PROC_LINE_LEN;
-+ n += UB_PROC_LINE_LEN;
-+ }
-+ n -= (2 * UB_PROC_LINE_LEN);
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ while (1) {
-+ for (ub = slot->ubh_beans;
-+ ub != NULL && n >= (UB_RESOURCES * UB_PROC_LINE_LEN);
-+ ub = ub->ub_next)
-+ if (is_capable && ub_accessible(ub, exec_ub, file))
-+ n -= (UB_RESOURCES * UB_PROC_LINE_LEN);
-+ if (ub != NULL || ++i >= UB_HASH_SIZE)
-+ break;
-+ ++slot;
-+ }
-+ rem = n; /* the amount of the data in the buffer to skip */
-+ job = PAGE_SIZE - UB_PROC_LINE_LEN + 1; /* end of buffer data */
-+ if (len < job - rem)
-+ job = rem + len;
-+ while (ub != NULL && produced < job) {
-+ if (is_capable && ub_accessible(ub, exec_ub, file))
-+ for (resource = 0;
-+ produced < job && resource < UB_RESOURCES;
-+ resource++, produced += UB_PROC_LINE_LEN)
-+ {
-+ out_proc_beancounter(buf + produced,
-+ ub, resource);
-+ }
-+ if (produced >= job)
-+ break;
-+ /* Find the next beancounter to produce more data. */
-+ ub = ub->ub_next;
-+ while (ub == NULL && ++i < UB_HASH_SIZE) {
-+ ++slot;
-+ ub = slot->ubh_beans;
-+ }
-+ }
-+
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ ub_debug(UBD_ALLOC, KERN_DEBUG "UB_PROC: produced %d, job %d, rem %d\n",
-+ produced, job, rem);
-+
-+ /*
-+ * Temporary buffer `buf' contains `produced' bytes.
-+ * Extract no more than `len' bytes at offset `rem'.
-+ */
-+ if (produced <= rem)
-+ goto out_free;
-+ tocopy = produced - rem;
-+ if (len < tocopy)
-+ tocopy = len;
-+ if (!tocopy)
-+ goto out_free;
-+ if (copy_to_user(usrbuf, buf + rem, tocopy))
-+ goto fault;
-+ off += tocopy; /* can't overflow */
-+ *poff = off;
-+ len -= tocopy;
-+ retval += tocopy;
-+ if (!len)
-+ goto out_free;
-+ usrbuf += tocopy;
-+ goto again;
-+
-+fault:
-+ retval = -EFAULT;
-+out_free:
-+ free_page((unsigned long)buf);
-+out:
-+ return retval;
-+
-+inval:
-+ retval = -EINVAL;
-+ goto out_free;
-+}
-+
-+static int ub_proc_open(struct inode *inode, struct file *file)
-+{
-+ file->private_data = strcmp(file->f_dentry->d_name.name,
-+ "user_beancounters") ?
-+ (void *)-1 : NULL;
-+ return 0;
-+}
-+
-+static struct file_operations ub_file_operations = {
-+ .read = &ub_proc_read,
-+ .open = &ub_proc_open
-+};
-+
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+#include <linux/seq_file.h>
-+#include <linux/kmem_cache.h>
-+
-+static void *ubd_start(struct seq_file *m, loff_t *pos)
-+{
-+ loff_t n = *pos;
-+ struct user_beancounter *ub;
-+ long slot;
-+
-+ spin_lock_irq(&ub_hash_lock);
-+ for (slot = 0; slot < UB_HASH_SIZE; slot++)
-+ for (ub = ub_hash[slot].ubh_beans; ub; ub = ub->ub_next) {
-+ if (n == 0) {
-+ m->private = (void *)slot;
-+ return (void *)ub;
-+ }
-+ n--;
-+ }
-+ return NULL;
-+}
-+
-+static void *ubd_next(struct seq_file *m, void *p, loff_t *pos)
-+{
-+ struct user_beancounter *ub;
-+ long slot;
-+
-+ ub = (struct user_beancounter *)p;
-+ slot = (long)m->private;
-+
-+ ++*pos;
-+ ub = ub->ub_next;
-+ while (1) {
-+ for (; ub; ub = ub->ub_next) {
-+ m->private = (void *)slot;
-+ return (void *)ub;
-+ }
-+ slot++;
-+ if (slot == UB_HASH_SIZE)
-+ break;
-+ ub = ub_hash[slot].ubh_beans;
-+ }
-+ return NULL;
-+}
-+
-+static void ubd_stop(struct seq_file *m, void *p)
-+{
-+ spin_unlock_irq(&ub_hash_lock);
-+}
-+
-+#define PROC_LINE_FMT "\t%-17s\t%5lu\t%5lu\n"
-+
-+static int ubd_show(struct seq_file *m, void *p)
-+{
-+ struct user_beancounter *ub;
-+ struct ub_cache_counter *cc;
-+ long pages, vmpages;
-+ int i;
-+ char id[64];
-+
-+ ub = (struct user_beancounter *)p;
-+ print_ub_uid(ub, id, sizeof(id));
-+ seq_printf(m, "%s:\n", id);
-+
-+ pages = vmpages = 0;
-+ for (i = 0; i < NR_CPUS; i++) {
-+ pages += ub->ub_pages_charged[i];
-+ vmpages += ub->ub_vmalloc_charged[i];
-+ }
-+ if (pages < 0)
-+ pages = 0;
-+ if (vmpages < 0)
-+ vmpages = 0;
-+ seq_printf(m, PROC_LINE_FMT, "pages", pages, PAGE_SIZE);
-+ seq_printf(m, PROC_LINE_FMT, "vmalloced", vmpages, PAGE_SIZE);
-+
-+ seq_printf(m, PROC_LINE_FMT, ub_rnames[UB_UNUSEDPRIVVM],
-+ ub->ub_unused_privvmpages, PAGE_SIZE);
-+ seq_printf(m, PROC_LINE_FMT, ub_rnames[UB_TMPFSPAGES],
-+ ub->ub_tmpfs_respages, PAGE_SIZE);
-+ seq_printf(m, PROC_LINE_FMT, ub_rnames[UB_SWAPPAGES],
-+ ub->ub_swap_pages, PAGE_SIZE);
-+ /* interrupts are disabled by locking ub_hash_lock */
-+ spin_lock(&cc_lock);
-+ list_for_each_entry (cc, &ub->ub_cclist, ulist) {
-+ kmem_cache_t *cachep;
-+
-+ cachep = cc->cachep;
-+ seq_printf(m, PROC_LINE_FMT,
-+ cachep->name,
-+ cc->counter,
-+ (unsigned long)cachep->objuse);
-+ }
-+ spin_unlock(&cc_lock);
-+ return 0;
-+}
-+
-+static struct seq_operations kmemdebug_op = {
-+ .start = ubd_start,
-+ .next = ubd_next,
-+ .stop = ubd_stop,
-+ .show = ubd_show,
-+};
-+
-+static int kmem_debug_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &kmemdebug_op);
-+}
-+
-+static struct file_operations kmem_debug_ops = {
-+ .open = kmem_debug_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
-+};
-+#endif
-+
-+void __init beancounter_proc_init(void)
-+{
-+ struct proc_dir_entry *entry;
-+
-+ entry = create_proc_entry("user_beancounters", S_IRUGO, NULL);
-+ if (entry)
-+ entry->proc_fops = &ub_file_operations;
-+ else
-+ panic("Can't create /proc/user_beancounters entry!\n");
-+
-+ entry = create_proc_entry("user_beancounters_sub", S_IRUGO, NULL);
-+ if (entry)
-+ entry->proc_fops = &ub_file_operations;
-+ else
-+ panic("Can't create /proc/user_beancounters2 entry!\n");
-+
-+#ifdef CONFIG_UBC_DEBUG_KMEM
-+ entry = create_proc_entry("user_beancounters_debug", S_IRUGO, NULL);
-+ if (entry)
-+ entry->proc_fops = &kmem_debug_ops;
-+ else
-+ panic("Can't create /proc/user_beancounters_debug entry!\n");
-+#endif
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_stat.c linux-2.6.9-ve023stab030/kernel/ub/ub_stat.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_stat.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_stat.c 2006-10-11 19:07:56.000000000 +0400
-@@ -0,0 +1,465 @@
-+/*
-+ * kernel/ub/ub_stat.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/timer.h>
-+#include <linux/sched.h>
-+#include <linux/init.h>
-+#include <linux/jiffies.h>
-+#include <linux/list.h>
-+#include <linux/errno.h>
-+#include <linux/suspend.h>
-+
-+#include <asm/uaccess.h>
-+#include <asm/param.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_hash.h>
-+#include <ub/ub_stat.h>
-+
-+static spinlock_t ubs_notify_lock = SPIN_LOCK_UNLOCKED;
-+static LIST_HEAD(ubs_notify_list);
-+static long ubs_min_interval;
-+static ubstattime_t ubs_start_time, ubs_end_time;
-+static struct timer_list ubs_timer;
-+
-+static int ubstat_get_list(void *buf, long size)
-+{
-+ int retval;
-+ unsigned long flags;
-+ int slotnr;
-+ struct ub_hash_slot *slot;
-+ struct user_beancounter *ub, *last_ub;
-+ long *page, *ptr, *end;
-+ int len;
-+
-+ page = (long *)__get_free_page(GFP_KERNEL);
-+ if (page == NULL)
-+ return -ENOMEM;
-+
-+ retval = 0;
-+ slotnr = 0;
-+ slot = ub_hash;
-+ last_ub = NULL;
-+ while (1) {
-+ ptr = page;
-+ end = page + PAGE_SIZE / sizeof(*ptr);
-+
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ if (last_ub == NULL)
-+ ub = slot->ubh_beans;
-+ else
-+ ub = last_ub->ub_next;
-+ while (1) {
-+ for (; ub != NULL; ub = ub->ub_next) {
-+ if (ub->parent != NULL)
-+ continue;
-+ *ptr++ = ub->ub_uid;
-+ if (ptr == end)
-+ break;
-+ }
-+ if (ptr == end)
-+ break;
-+ ++slot;
-+ if (++slotnr >= UB_HASH_SIZE)
-+ break;
-+ ub = slot->ubh_beans;
-+ }
-+ if (ptr == page)
-+ goto out_unlock;
-+ if (ub != NULL)
-+ get_beancounter(ub);
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+
-+ if (last_ub != NULL)
-+ put_beancounter(last_ub);
-+ last_ub = ub; /* last visited beancounter in the slot */
-+
-+ len = min_t(long, (ptr - page) * sizeof(*ptr), size);
-+ if (copy_to_user(buf, page, len)) {
-+ retval = -EFAULT;
-+ break;
-+ }
-+ retval += len;
-+ if (len < PAGE_SIZE)
-+ break;
-+ buf += len;
-+ size -= len;
-+ }
-+out:
-+ if (last_ub != NULL)
-+ put_beancounter(last_ub);
-+ free_page((unsigned long)page);
-+ return retval;
-+
-+out_unlock:
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+ goto out;
-+}
-+
-+static int ubstat_gettime(void *buf, long size)
-+{
-+ ubgettime_t data;
-+ int retval;
-+
-+ spin_lock(&ubs_notify_lock);
-+ data.start_time = ubs_start_time;
-+ data.end_time = ubs_end_time;
-+ data.cur_time = ubs_start_time + (jiffies - ubs_start_time * HZ) / HZ;
-+ spin_unlock(&ubs_notify_lock);
-+
-+ retval = min_t(long, sizeof(data), size);
-+ if (copy_to_user(buf, &data, retval))
-+ retval = -EFAULT;
-+ return retval;
-+}
-+
-+static int ubstat_do_read_one(struct user_beancounter *ub, int res, void *kbuf)
-+{
-+ struct {
-+ ubstattime_t start_time;
-+ ubstattime_t end_time;
-+ ubstatparm_t param[1];
-+ } *data;
-+
-+ data = kbuf;
-+ data->start_time = ubs_start_time;
-+ data->end_time = ubs_end_time;
-+
-+ data->param[0].maxheld = ub->ub_store[res].maxheld;
-+ data->param[0].failcnt = ub->ub_store[res].failcnt;
-+
-+ return sizeof(*data);
-+}
-+
-+static int ubstat_do_read_all(struct user_beancounter *ub, void *kbuf, int size)
-+{
-+ int wrote;
-+ struct {
-+ ubstattime_t start_time;
-+ ubstattime_t end_time;
-+ ubstatparm_t param[UB_RESOURCES];
-+ } *data;
-+ int resource;
-+
-+ data = kbuf;
-+ data->start_time = ubs_start_time;
-+ data->end_time = ubs_end_time;
-+ wrote = sizeof(data->start_time) + sizeof(data->end_time);
-+
-+ for (resource = 0; resource < UB_RESOURCES; resource++) {
-+ if (size < wrote + sizeof(data->param[resource]))
-+ break;
-+ data->param[resource].maxheld = ub->ub_store[resource].maxheld;
-+ data->param[resource].failcnt = ub->ub_store[resource].failcnt;
-+ wrote += sizeof(data->param[resource]);
-+ }
-+
-+ return wrote;
-+}
-+
-+static int ubstat_do_read_full(struct user_beancounter *ub, void *kbuf,
-+ int size)
-+{
-+ int wrote;
-+ struct {
-+ ubstattime_t start_time;
-+ ubstattime_t end_time;
-+ ubstatparmf_t param[UB_RESOURCES];
-+ } *data;
-+ int resource;
-+
-+ data = kbuf;
-+ data->start_time = ubs_start_time;
-+ data->end_time = ubs_end_time;
-+ wrote = sizeof(data->start_time) + sizeof(data->end_time);
-+
-+ for (resource = 0; resource < UB_RESOURCES; resource++) {
-+ if (size < wrote + sizeof(data->param[resource]))
-+ break;
-+ /* The beginning of ubstatparmf_t matches struct ubparm. */
-+ memcpy(&data->param[resource], &ub->ub_store[resource],
-+ sizeof(ub->ub_store[resource]));
-+ data->param[resource].__unused1 = 0;
-+ data->param[resource].__unused2 = 0;
-+ wrote += sizeof(data->param[resource]);
-+ }
-+ return wrote;
-+}
-+
-+static int ubstat_get_stat(struct user_beancounter *ub, long cmd,
-+ void *buf, long size)
-+{
-+ void *kbuf;
-+ int retval;
-+
-+ kbuf = (void *)__get_free_page(GFP_KERNEL);
-+ if (kbuf == NULL)
-+ return -ENOMEM;
-+
-+ spin_lock(&ubs_notify_lock);
-+ switch (UBSTAT_CMD(cmd)) {
-+ case UBSTAT_READ_ONE:
-+ retval = -EINVAL;
-+ if (UBSTAT_PARMID(cmd) >= UB_RESOURCES)
-+ break;
-+ retval = ubstat_do_read_one(ub,
-+ UBSTAT_PARMID(cmd), kbuf);
-+ break;
-+ case UBSTAT_READ_ALL:
-+ retval = ubstat_do_read_all(ub, kbuf, PAGE_SIZE);
-+ break;
-+ case UBSTAT_READ_FULL:
-+ retval = ubstat_do_read_full(ub, kbuf, PAGE_SIZE);
-+ break;
-+ default:
-+ retval = -EINVAL;
-+ }
-+ spin_unlock(&ubs_notify_lock);
-+
-+ if (retval > 0) {
-+ retval = min_t(long, retval, size);
-+ if (copy_to_user(buf, kbuf, retval))
-+ retval = -EFAULT;
-+ }
-+
-+ free_page((unsigned long)kbuf);
-+ return retval;
-+}
-+
-+static int ubstat_handle_notifrq(ubnotifrq_t *req)
-+{
-+ int retval;
-+ struct ub_stat_notify *new_notify;
-+ struct list_head *entry;
-+ struct task_struct *tsk_to_free;
-+
-+ new_notify = kmalloc(sizeof(new_notify), GFP_KERNEL);
-+ if (new_notify == NULL)
-+ return -ENOMEM;
-+
-+ tsk_to_free = NULL;
-+ INIT_LIST_HEAD(&new_notify->list);
-+
-+ spin_lock(&ubs_notify_lock);
-+ list_for_each(entry, &ubs_notify_list) {
-+ struct ub_stat_notify *notify;
-+
-+ notify = list_entry(entry, struct ub_stat_notify, list);
-+ if (notify->task == current) {
-+ kfree(new_notify);
-+ new_notify = notify;
-+ break;
-+ }
-+ }
-+
-+ retval = -EINVAL;
-+ if (req->maxinterval < 1)
-+ goto out_unlock;
-+ if (req->maxinterval > TIME_MAX_SEC)
-+ req->maxinterval = TIME_MAX_SEC;
-+ if (req->maxinterval < ubs_min_interval) {
-+ unsigned long dif;
-+
-+ ubs_min_interval = req->maxinterval;
-+ dif = (ubs_timer.expires - jiffies + HZ - 1) / HZ;
-+ if (dif > req->maxinterval)
-+ mod_timer(&ubs_timer,
-+ ubs_timer.expires -
-+ (dif - req->maxinterval) * HZ);
-+ }
-+
-+ if (entry != &ubs_notify_list) {
-+ list_del(&new_notify->list);
-+ tsk_to_free = new_notify->task;
-+ }
-+ if (req->signum) {
-+ new_notify->task = current;
-+ get_task_struct(new_notify->task);
-+ new_notify->signum = req->signum;
-+ list_add(&new_notify->list, &ubs_notify_list);
-+ } else
-+ kfree(new_notify);
-+ retval = 0;
-+out_unlock:
-+ spin_unlock(&ubs_notify_lock);
-+ if (tsk_to_free != NULL)
-+ put_task_struct(tsk_to_free);
-+ return retval;
-+}
-+
-+/*
-+ * former sys_ubstat
-+ */
-+long do_ubstat(int func, unsigned long arg1, unsigned long arg2, void *buf,
-+ long size)
-+{
-+ int retval;
-+ struct user_beancounter *ub;
-+
-+ if (func == UBSTAT_UBPARMNUM)
-+ return UB_RESOURCES;
-+ if (func == UBSTAT_UBLIST)
-+ return ubstat_get_list(buf, size);
-+ if (!(capable(CAP_DAC_OVERRIDE) || capable(CAP_DAC_READ_SEARCH)))
-+ return -EPERM;
-+
-+ if (func == UBSTAT_GETTIME) {
-+ retval = ubstat_gettime(buf, size);
-+ goto notify;
-+ }
-+
-+ ub = get_exec_ub();
-+ if (ub != NULL && ub->ub_uid == arg1)
-+ get_beancounter(ub);
-+ else /* FIXME must be if (ve_is_super) */
-+ ub = get_beancounter_byuid(arg1, 0);
-+
-+ if (ub == NULL)
-+ return -ESRCH;
-+
-+ retval = ubstat_get_stat(ub, func, buf, size);
-+ put_beancounter(ub);
-+notify:
-+ /* Handle request for notification */
-+ if (retval >= 0) {
-+ ubnotifrq_t notifrq;
-+ int err;
-+
-+ err = -EFAULT;
-+ if (!copy_from_user(&notifrq, (void *)arg2, sizeof(notifrq)))
-+ err = ubstat_handle_notifrq(&notifrq);
-+ if (err)
-+ retval = err;
-+ }
-+
-+ return retval;
-+}
-+
-+static void ubstat_save_onestat(struct user_beancounter *ub)
-+{
-+ int resource;
-+
-+ /* called with local irq disabled */
-+ spin_lock(&ub->ub_lock);
-+ for (resource = 0; resource < UB_RESOURCES; resource++) {
-+ memcpy(&ub->ub_store[resource], &ub->ub_parms[resource],
-+ sizeof(struct ubparm));
-+ ub->ub_parms[resource].minheld =
-+ ub->ub_parms[resource].maxheld =
-+ ub->ub_parms[resource].held;
-+ }
-+ spin_unlock(&ub->ub_lock);
-+}
-+
-+static void ubstat_save_statistics(void)
-+{
-+ unsigned long flags;
-+ int i;
-+ struct user_beancounter *ub;
-+
-+ spin_lock_irqsave(&ub_hash_lock, flags);
-+ for_each_beancounter(i, ub)
-+ ubstat_save_onestat(ub);
-+ spin_unlock_irqrestore(&ub_hash_lock, flags);
-+}
-+
-+static void ubstatd_timeout(unsigned long __data)
-+{
-+ struct task_struct *p;
-+
-+ p = (struct task_struct *) __data;
-+ wake_up_process(p);
-+}
-+
-+/*
-+ * Safe wrapper for send_sig. It prevents a race with release_task
-+ * for sighand.
-+ * Should be called under tasklist_lock.
-+ */
-+static void task_send_sig(struct ub_stat_notify *notify)
-+{
-+ if (likely(notify->task->sighand != NULL))
-+ send_sig(notify->signum, notify->task, 1);
-+}
-+
-+static inline void do_notifies(void)
-+{
-+ LIST_HEAD(notif_free_list);
-+ struct ub_stat_notify *notify;
-+ struct ub_stat_notify *tmp;
-+
-+ spin_lock(&ubs_notify_lock);
-+ ubs_start_time = ubs_end_time;
-+ /*
-+ * the expression below relies on time being unsigned long and
-+ * arithmetic promotion rules
-+ */
-+ ubs_end_time += (ubs_timer.expires - ubs_start_time * HZ) / HZ;
-+ mod_timer(&ubs_timer, ubs_timer.expires + ubs_min_interval * HZ);
-+ ubs_min_interval = TIME_MAX_SEC;
-+ /* save statistics accumulated for the interval */
-+ ubstat_save_statistics();
-+ /* send signals */
-+ read_lock(&tasklist_lock);
-+ while (!list_empty(&ubs_notify_list)) {
-+ notify = list_entry(ubs_notify_list.next,
-+ struct ub_stat_notify, list);
-+ task_send_sig(notify);
-+ list_del(&notify->list);
-+ list_add(&notify->list, &notif_free_list);
-+ }
-+ read_unlock(&tasklist_lock);
-+ spin_unlock(&ubs_notify_lock);
-+
-+ list_for_each_entry_safe(notify, tmp, &notif_free_list, list) {
-+ put_task_struct(notify->task);
-+ kfree(notify);
-+ }
-+}
-+
-+/*
-+ * Kernel thread
-+ */
-+static int ubstatd(void *unused)
-+{
-+ /* daemonize call will take care of signals */
-+ daemonize("ubstatd");
-+
-+ ubs_timer.data = (unsigned long)current;
-+ ubs_timer.function = ubstatd_timeout;
-+ add_timer(&ubs_timer);
-+
-+ while (1) {
-+ set_task_state(current, TASK_INTERRUPTIBLE);
-+ if (time_after(ubs_timer.expires, jiffies)) {
-+ schedule();
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-+ continue;
-+ }
-+
-+ __set_task_state(current, TASK_RUNNING);
-+ do_notifies();
-+ }
-+}
-+
-+static int __init ubstatd_init(void)
-+{
-+ init_timer(&ubs_timer);
-+ ubs_timer.expires = TIME_MAX_JIF;
-+ ubs_min_interval = TIME_MAX_SEC;
-+ ubs_start_time = ubs_end_time = 0;
-+
-+ kernel_thread(ubstatd, NULL, 0);
-+ return 0;
-+}
-+
-+module_init(ubstatd_init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_sys.c linux-2.6.9-ve023stab030/kernel/ub/ub_sys.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ub/ub_sys.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ub/ub_sys.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,168 @@
-+/*
-+ * kernel/ub/ub_sys.c
-+ *
-+ * Copyright (C) 2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/virtinfo.h>
-+#include <asm/uaccess.h>
-+
-+#include <ub/beancounter.h>
-+
-+#ifndef CONFIG_USER_RESOURCE
-+asmlinkage long sys_getluid(void)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage long sys_setluid(uid_t uid)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage long sys_setublimit(uid_t uid, unsigned long resource,
-+ unsigned long *limits)
-+{
-+ return -ENOSYS;
-+}
-+
-+asmlinkage long sys_ubstat(int func, unsigned long arg1, unsigned long arg2,
-+ void *buf, long size)
-+{
-+ return -ENOSYS;
-+}
-+#else /* CONFIG_USER_RESOURCE */
-+
-+/*
-+ * The (rather boring) getluid syscall
-+ */
-+asmlinkage long sys_getluid(void)
-+{
-+ struct user_beancounter *ub;
-+
-+ ub = get_exec_ub();
-+ if (ub == NULL)
-+ return -EINVAL;
-+
-+ return ub->ub_uid;
-+}
-+
-+/*
-+ * The setluid syscall
-+ */
-+asmlinkage long sys_setluid(uid_t uid)
-+{
-+ struct user_beancounter *ub;
-+ struct task_beancounter *task_bc;
-+ int error;
-+
-+ task_bc = task_bc(current);
-+
-+ /* You may not disown a setluid */
-+ error = -EINVAL;
-+ if (uid == (uid_t)-1)
-+ goto out;
-+
-+ /* You may only set an ub as root */
-+ error = -EPERM;
-+ if (!capable(CAP_SETUID))
-+ goto out;
-+
-+ /*
-+ * The ub once set is irrevocable to all
-+ * unless it's set from ve0.
-+ */
-+ if (!ve_is_super(get_exec_env()))
-+ goto out;
-+
-+ /* Ok - set up a beancounter entry for this user */
-+ error = -ENOBUFS;
-+ ub = get_beancounter_byuid(uid, 1);
-+ if (ub == NULL)
-+ goto out;
-+
-+ ub_debug(UBD_ALLOC | UBD_LIMIT, "setluid, bean %p (count %d) "
-+ "for %.20s pid %d\n",
-+ ub, atomic_read(&ub->ub_refcount),
-+ current->comm, current->pid);
-+ /* install bc */
-+ error = virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_NEWUBC, ub);
-+ if (!(error & NOTIFY_FAIL)) {
-+ put_beancounter(task_bc->exec_ub);
-+ task_bc->exec_ub = ub;
-+ if (!(error & NOTIFY_OK)) {
-+ put_beancounter(task_bc->fork_sub);
-+ task_bc->fork_sub = get_beancounter(ub);
-+ }
-+ error = 0;
-+ } else
-+ error = -ENOBUFS;
-+out:
-+ return error;
-+}
-+
-+/*
-+ * The setbeanlimit syscall
-+ */
-+asmlinkage long sys_setublimit(uid_t uid, unsigned long resource,
-+ unsigned long *limits)
-+{
-+ int error;
-+ unsigned long flags;
-+ struct user_beancounter *ub;
-+ unsigned long new_limits[2];
-+
-+ error = -EPERM;
-+ if(!capable(CAP_SYS_RESOURCE))
-+ goto out;
-+
-+ if (!ve_is_super(get_exec_env()))
-+ goto out;
-+
-+ error = -EINVAL;
-+ if (resource >= UB_RESOURCES)
-+ goto out;
-+
-+ error = -EFAULT;
-+ if (copy_from_user(&new_limits, limits, sizeof(new_limits)))
-+ goto out;
-+
-+ error = -EINVAL;
-+ if (new_limits[0] > UB_MAXVALUE || new_limits[1] > UB_MAXVALUE)
-+ goto out;
-+
-+ error = -ENOENT;
-+ ub = get_beancounter_byuid(uid, 0);
-+ if (ub == NULL) {
-+ ub_debug(UBD_LIMIT, "No login bc for uid %d\n", uid);
-+ goto out;
-+ }
-+
-+ spin_lock_irqsave(&ub->ub_lock, flags);
-+ ub->ub_parms[resource].barrier = new_limits[0];
-+ ub->ub_parms[resource].limit = new_limits[1];
-+ spin_unlock_irqrestore(&ub->ub_lock, flags);
-+
-+ put_beancounter(ub);
-+
-+ error = 0;
-+out:
-+ return error;
-+}
-+
-+extern long do_ubstat(int func, unsigned long arg1, unsigned long arg2,
-+ void *buf, long size);
-+asmlinkage long sys_ubstat(int func, unsigned long arg1, unsigned long arg2,
-+ void *buf, long size)
-+{
-+ if (!ve_is_super(get_exec_env()))
-+ return -EPERM;
-+
-+ return do_ubstat(func, arg1, arg2, buf, size);
-+}
-+#endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/user.c linux-2.6.9-ve023stab030/kernel/user.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/user.c 2006-10-11 18:29:45.000000000 +0400
-+++ linux-2.6.9-ve023stab030/kernel/user.c 2006-10-11 19:07:59.000000000 +0400
-@@ -13,6 +13,7 @@
- #include <linux/slab.h>
- #include <linux/bitops.h>
- #include <linux/key.h>
-+#include <linux/module.h>
-
- /*
- * UID task count cache, to get fast user lookup in "alloc_uid"
-@@ -22,7 +23,20 @@
- #define UIDHASH_SZ (1 << UIDHASH_BITS)
- #define UIDHASH_MASK (UIDHASH_SZ - 1)
- #define __uidhashfn(uid) (((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)
--#define uidhashentry(uid) (uidhash_table + __uidhashfn((uid)))
-+#define __uidhashentry(uid) (uidhash_table + __uidhashfn((uid)))
-+
-+#ifdef CONFIG_VE
-+#define UIDHASH_MASK_VE (UIDHASH_SZ_VE - 1)
-+#define __uidhashfn_ve(uid) (((uid >> UIDHASH_BITS_VE) ^ uid) & \
-+ UIDHASH_MASK_VE)
-+#define __uidhashentry_ve(uid, envid) ((envid)->uidhash_table + \
-+ __uidhashfn_ve(uid))
-+#define uidhashentry_ve(uid) (ve_is_super(get_exec_env()) ? \
-+ __uidhashentry(uid) : \
-+ __uidhashentry_ve(uid, get_exec_env()))
-+#else
-+#define uidhashentry_ve(uid) __uidhashentry(uid)
-+#endif
-
- static kmem_cache_t *uid_cachep;
- static struct list_head uidhash_table[UIDHASH_SZ];
-@@ -83,7 +97,7 @@ struct user_struct *find_user(uid_t uid)
- struct user_struct *ret;
-
- spin_lock(&uidhash_lock);
-- ret = uid_hash_find(uid, uidhashentry(uid));
-+ ret = uid_hash_find(uid, uidhashentry_ve(uid));
- spin_unlock(&uidhash_lock);
- return ret;
- }
-@@ -98,10 +112,11 @@ void free_uid(struct user_struct *up)
- spin_unlock(&uidhash_lock);
- }
- }
-+EXPORT_SYMBOL(free_uid);
-
- struct user_struct * alloc_uid(uid_t uid)
- {
-- struct list_head *hashent = uidhashentry(uid);
-+ struct list_head *hashent = uidhashentry_ve(uid);
- struct user_struct *up;
-
- spin_lock(&uidhash_lock);
-@@ -147,6 +162,7 @@ struct user_struct * alloc_uid(uid_t uid
- }
- return up;
- }
-+EXPORT_SYMBOL(alloc_uid);
-
- void switch_uid(struct user_struct *new_user)
- {
-@@ -165,6 +181,7 @@ void switch_uid(struct user_struct *new_
- free_uid(old_user);
- suid_keys(current);
- }
-+EXPORT_SYMBOL(switch_uid);
-
-
- static int __init uid_cache_init(void)
-@@ -172,14 +189,14 @@ static int __init uid_cache_init(void)
- int n;
-
- uid_cachep = kmem_cache_create("uid_cache", sizeof(struct user_struct),
-- 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-+ 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_UBC, NULL, NULL);
-
- for(n = 0; n < UIDHASH_SZ; ++n)
- INIT_LIST_HEAD(uidhash_table + n);
-
- /* Insert the root user immediately (init already runs as root) */
- spin_lock(&uidhash_lock);
-- uid_hash_insert(&root_user, uidhashentry(0));
-+ uid_hash_insert(&root_user, __uidhashentry(0));
- spin_unlock(&uidhash_lock);
-
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/ve.c linux-2.6.9-ve023stab030/kernel/ve.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/ve.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/ve.c 2006-10-11 19:07:59.000000000 +0400
-@@ -0,0 +1,195 @@
-+/*
-+ * linux/kernel/ve.c
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+/*
-+ * 've.c' helper file performing VE sub-system initialization
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/delay.h>
-+#include <linux/capability.h>
-+#include <linux/ve.h>
-+#include <linux/smp_lock.h>
-+#include <linux/init.h>
-+
-+#include <linux/errno.h>
-+#include <linux/unistd.h>
-+#include <linux/slab.h>
-+#include <linux/sys.h>
-+#include <linux/kdev_t.h>
-+#include <linux/termios.h>
-+#include <linux/tty_driver.h>
-+#include <linux/netdevice.h>
-+#include <linux/utsname.h>
-+#include <linux/proc_fs.h>
-+#include <linux/kernel_stat.h>
-+#include <linux/module.h>
-+#include <linux/rcupdate.h>
-+#include <linux/ve_proto.h>
-+#include <linux/ve_owner.h>
-+
-+#include <linux/nfcalls.h>
-+#include <net/tcp.h>
-+
-+unsigned long vz_rstamp = 0x37e0f59d;
-+EXPORT_SYMBOL(vz_rstamp);
-+
-+#ifdef CONFIG_MODULES
-+struct module no_module = { .state = MODULE_STATE_GOING };
-+EXPORT_SYMBOL(no_module);
-+#endif
-+
-+#ifdef CONFIG_VE
-+
-+DCL_VE_OWNER(SKB, SLAB, struct sk_buff, owner_env, , (noinline, regparm(1)))
-+DCL_VE_OWNER(SK, SLAB, struct sock, sk_owner_env, , (noinline, regparm(1)))
-+DCL_VE_OWNER(TW, SLAB, struct tcp_tw_bucket, tw_owner_env, , (noinline, regparm(1)))
-+DCL_VE_OWNER(FILP, GENERIC, struct file, owner_env, inline, (always_inline))
-+DCL_VE_OWNER(FSTYPE, MODULE, struct file_system_type, owner_env, , ())
-+
-+#if defined(CONFIG_VE_IPTABLES)
-+INIT_KSYM_MODULE(ip_tables);
-+INIT_KSYM_MODULE(iptable_filter);
-+INIT_KSYM_MODULE(iptable_mangle);
-+INIT_KSYM_MODULE(ipt_limit);
-+INIT_KSYM_MODULE(ipt_multiport);
-+INIT_KSYM_MODULE(ipt_tos);
-+INIT_KSYM_MODULE(ipt_TOS);
-+INIT_KSYM_MODULE(ipt_REJECT);
-+INIT_KSYM_MODULE(ipt_TCPMSS);
-+INIT_KSYM_MODULE(ipt_tcpmss);
-+INIT_KSYM_MODULE(ipt_ttl);
-+INIT_KSYM_MODULE(ipt_LOG);
-+INIT_KSYM_MODULE(ipt_length);
-+INIT_KSYM_MODULE(ip_conntrack);
-+INIT_KSYM_MODULE(ip_conntrack_ftp);
-+INIT_KSYM_MODULE(ip_conntrack_irc);
-+INIT_KSYM_MODULE(ipt_conntrack);
-+INIT_KSYM_MODULE(ipt_state);
-+INIT_KSYM_MODULE(ipt_helper);
-+INIT_KSYM_MODULE(iptable_nat);
-+INIT_KSYM_MODULE(ip_nat_ftp);
-+INIT_KSYM_MODULE(ip_nat_irc);
-+INIT_KSYM_MODULE(ipt_REDIRECT);
-+INIT_KSYM_MODULE(ipt_owner);
-+
-+INIT_KSYM_CALL(int, init_netfilter, (void));
-+INIT_KSYM_CALL(int, init_iptables, (void));
-+INIT_KSYM_CALL(int, init_iptable_filter, (void));
-+INIT_KSYM_CALL(int, init_iptable_mangle, (void));
-+INIT_KSYM_CALL(int, init_iptable_limit, (void));
-+INIT_KSYM_CALL(int, init_iptable_multiport, (void));
-+INIT_KSYM_CALL(int, init_iptable_tos, (void));
-+INIT_KSYM_CALL(int, init_iptable_TOS, (void));
-+INIT_KSYM_CALL(int, init_iptable_REJECT, (void));
-+INIT_KSYM_CALL(int, init_iptable_TCPMSS, (void));
-+INIT_KSYM_CALL(int, init_iptable_tcpmss, (void));
-+INIT_KSYM_CALL(int, init_iptable_ttl, (void));
-+INIT_KSYM_CALL(int, init_iptable_LOG, (void));
-+INIT_KSYM_CALL(int, init_iptable_length, (void));
-+INIT_KSYM_CALL(int, init_iptable_conntrack, (void));
-+INIT_KSYM_CALL(int, init_iptable_ftp, (void));
-+INIT_KSYM_CALL(int, init_iptable_irc, (void));
-+INIT_KSYM_CALL(int, init_iptable_conntrack_match, (void));
-+INIT_KSYM_CALL(int, init_iptable_state, (void));
-+INIT_KSYM_CALL(int, init_iptable_helper, (void));
-+INIT_KSYM_CALL(int, init_iptable_nat, (void));
-+INIT_KSYM_CALL(int, init_iptable_nat_ftp, (void));
-+INIT_KSYM_CALL(int, init_iptable_nat_irc, (void));
-+INIT_KSYM_CALL(int, init_iptable_REDIRECT, (void));
-+INIT_KSYM_CALL(int, init_iptable_owner, (void));
-+INIT_KSYM_CALL(void, fini_iptable_owner, (void));
-+INIT_KSYM_CALL(void, fini_iptable_nat_irc, (void));
-+INIT_KSYM_CALL(void, fini_iptable_nat_ftp, (void));
-+INIT_KSYM_CALL(void, fini_iptable_nat, (void));
-+INIT_KSYM_CALL(void, fini_iptable_helper, (void));
-+INIT_KSYM_CALL(void, fini_iptable_state, (void));
-+INIT_KSYM_CALL(void, fini_iptable_conntrack_match, (void));
-+INIT_KSYM_CALL(void, fini_iptable_irc, (void));
-+INIT_KSYM_CALL(void, fini_iptable_ftp, (void));
-+INIT_KSYM_CALL(void, fini_iptable_conntrack, (void));
-+INIT_KSYM_CALL(void, fini_iptable_length, (void));
-+INIT_KSYM_CALL(void, fini_iptable_LOG, (void));
-+INIT_KSYM_CALL(void, fini_iptable_ttl, (void));
-+INIT_KSYM_CALL(void, fini_iptable_tcpmss, (void));
-+INIT_KSYM_CALL(void, fini_iptable_TCPMSS, (void));
-+INIT_KSYM_CALL(void, fini_iptable_REJECT, (void));
-+INIT_KSYM_CALL(void, fini_iptable_TOS, (void));
-+INIT_KSYM_CALL(void, fini_iptable_tos, (void));
-+INIT_KSYM_CALL(void, fini_iptable_multiport, (void));
-+INIT_KSYM_CALL(void, fini_iptable_limit, (void));
-+INIT_KSYM_CALL(void, fini_iptable_filter, (void));
-+INIT_KSYM_CALL(void, fini_iptable_mangle, (void));
-+INIT_KSYM_CALL(void, fini_iptables, (void));
-+INIT_KSYM_CALL(void, fini_netfilter, (void));
-+INIT_KSYM_CALL(void, fini_iptable_REDIRECT, (void));
-+
-+INIT_KSYM_CALL(void, ipt_flush_table, (struct ipt_table *table));
-+#endif
-+
-+#if defined(CONFIG_VE_CALLS_MODULE) || defined(CONFIG_VE_CALLS)
-+INIT_KSYM_MODULE(vzmon);
-+INIT_KSYM_CALL(int, real_get_device_perms_ve,
-+ (int dev_type, dev_t dev, int access_mode));
-+INIT_KSYM_CALL(void, real_do_env_cleanup, (struct ve_struct *env));
-+INIT_KSYM_CALL(void, real_do_env_free, (struct ve_struct *env));
-+INIT_KSYM_CALL(void, real_update_load_avg_ve, (void));
-+
-+int get_device_perms_ve(int dev_type, dev_t dev, int access_mode)
-+{
-+ return KSYMSAFECALL(int, vzmon, real_get_device_perms_ve,
-+ (dev_type, dev, access_mode));
-+}
-+EXPORT_SYMBOL(get_device_perms_ve);
-+
-+void do_env_cleanup(struct ve_struct *env)
-+{
-+ KSYMSAFECALL_VOID(vzmon, real_do_env_cleanup, (env));
-+}
-+
-+void do_env_free(struct ve_struct *env)
-+{
-+ KSYMSAFECALL_VOID(vzmon, real_do_env_free, (env));
-+}
-+EXPORT_SYMBOL(do_env_free);
-+
-+void do_update_load_avg_ve(void)
-+{
-+ KSYMSAFECALL_VOID(vzmon, real_update_load_avg_ve, ());
-+}
-+#endif
-+
-+extern struct ipv4_devconf ipv4_devconf;
-+extern struct ipv4_devconf *get_ipv4_devconf_dflt_addr(void);
-+
-+#if defined(CONFIG_VE_ETHDEV) || defined(CONFIG_VE_ETHDEV_MODULE)
-+INIT_KSYM_MODULE(vzethdev);
-+INIT_KSYM_CALL(int, veth_open, (struct net_device *dev));
-+#endif
-+
-+struct ve_struct ve0 = {
-+ .utsname = &system_utsname,
-+ .vetask_lh = LIST_HEAD_INIT(ve0.vetask_lh),
-+ .start_jiffies = INITIAL_JIFFIES,
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ ._net_dev_tail = &ve0._net_dev_base,
-+ .ifindex = -1,
-+#endif
-+#ifdef CONFIG_SYSCTL
-+ ._sysctl_local_port_range = { 1024, 4999 },
-+ ._tcp_port_rover = 1024 - 1,
-+#endif
-+ ._simple_dev_list = LIST_HEAD_INIT(ve0._simple_dev_list),
-+ .is_running = 1,
-+};
-+
-+EXPORT_SYMBOL(ve0);
-+
-+#endif /* CONFIG_VE */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/vecalls.c linux-2.6.9-ve023stab030/kernel/vecalls.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/vecalls.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/vecalls.c 2006-10-11 19:08:01.000000000 +0400
-@@ -0,0 +1,3425 @@
-+/*
-+ * linux/kernel/vecalls.c
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ */
-+
-+/*
-+ * 'vecalls.c' is file with basic VE support. It provides basic primities
-+ * along with initialization script
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/delay.h>
-+#include <linux/capability.h>
-+#include <linux/ve.h>
-+#include <linux/smp_lock.h>
-+#include <linux/init.h>
-+#include <linux/list.h>
-+#include <linux/ve_owner.h>
-+#include <linux/errno.h>
-+#include <linux/unistd.h>
-+#include <linux/slab.h>
-+#include <linux/vmalloc.h>
-+#include <linux/sys.h>
-+#include <linux/fs.h>
-+#include <linux/namespace.h>
-+#include <linux/termios.h>
-+#include <linux/tty_driver.h>
-+#include <linux/netdevice.h>
-+#include <linux/wait.h>
-+#include <linux/inetdevice.h>
-+#include <linux/utsname.h>
-+#include <linux/sysctl.h>
-+#include <linux/proc_fs.h>
-+#include <linux/seq_file.h>
-+#include <linux/kernel_stat.h>
-+#include <linux/module.h>
-+#include <linux/suspend.h>
-+#include <linux/rcupdate.h>
-+#include <linux/in.h>
-+#include <linux/major.h>
-+#include <linux/kdev_t.h>
-+#include <linux/idr.h>
-+#include <linux/inetdevice.h>
-+#include <net/pkt_sched.h>
-+#include <linux/divert.h>
-+#include <ub/beancounter.h>
-+
-+#include <net/route.h>
-+#include <net/ip_fib.h>
-+#include <net/arp.h>
-+
-+#include <linux/ve_proto.h>
-+#include <linux/venet.h>
-+#include <linux/vzctl.h>
-+#include <linux/vzcalluser.h>
-+#ifdef CONFIG_FAIRSCHED
-+#include <linux/fairsched.h>
-+#endif
-+
-+#include <linux/nfcalls.h>
-+#include <linux/virtinfo.h>
-+
-+struct ve_struct *ve_list_head = NULL;
-+int nr_ve = 1; /* One VE always exists. Compatibility with vestat */
-+rwlock_t ve_list_guard = RW_LOCK_UNLOCKED;
-+static rwlock_t devperms_hash_guard = RW_LOCK_UNLOCKED;
-+
-+extern int glob_virt_pids;
-+
-+static int do_env_enter(struct ve_struct *ve, unsigned int flags);
-+int real_env_create(envid_t veid, unsigned flags, u32 class_id,
-+ env_create_param_t *data, int datalen);
-+static void do_clean_devperms(envid_t veid);
-+static int alloc_ve_tty_drivers(struct ve_struct* ve);
-+static void free_ve_tty_drivers(struct ve_struct* ve);
-+static int register_ve_tty_drivers(struct ve_struct* ve);
-+static void unregister_ve_tty_drivers(struct ve_struct* ve);
-+static int init_ve_tty_drivers(struct ve_struct *);
-+static void fini_ve_tty_drivers(struct ve_struct *);
-+static void clear_termios(struct tty_driver* driver );
-+static void ve_mapped_devs_cleanup(struct ve_struct *ve);
-+
-+static int ve_get_cpu_stat(envid_t veid, struct vz_cpu_stat *buf);
-+
-+static void vecalls_exit(void);
-+
-+struct ve_struct *__find_ve_by_id(envid_t veid)
-+{
-+ struct ve_struct *ve;
-+ for (ve = ve_list_head;
-+ ve != NULL && ve->veid != veid;
-+ ve = ve->next);
-+ return ve;
-+}
-+
-+struct ve_struct *get_ve_by_id(envid_t veid)
-+{
-+ struct ve_struct *ve;
-+ read_lock(&ve_list_guard);
-+ ve = __find_ve_by_id(veid);
-+ get_ve(ve);
-+ read_unlock(&ve_list_guard);
-+ return ve;
-+}
-+
-+/*
-+ * real_put_ve() MUST be used instead of put_ve() inside vecalls.
-+ */
-+void real_do_env_free(struct ve_struct *ve);
-+static inline void real_put_ve(struct ve_struct *ve)
-+{
-+ if (ve && atomic_dec_and_test(&ve->counter)) {
-+ if (atomic_read(&ve->pcounter) > 0)
-+ BUG();
-+ if (ve->is_running)
-+ BUG();
-+ real_do_env_free(ve);
-+ }
-+}
-+
-+extern struct file_system_type devpts_fs_type;
-+extern struct file_system_type sysfs_fs_type;
-+extern struct file_system_type tmpfs_fs_type;
-+extern struct file_system_type proc_fs_type;
-+
-+extern spinlock_t task_capability_lock;
-+extern void ve_ipc_free(struct ve_struct * ve);
-+extern void ip_fragment_cleanup(struct ve_struct *ve);
-+
-+static int ve_get_cpu_stat(envid_t veid, struct vz_cpu_stat *buf)
-+{
-+ struct ve_struct *ve;
-+ struct vz_cpu_stat *vstat;
-+ int retval;
-+ int i, cpu;
-+ unsigned long tmp;
-+
-+ if (!ve_is_super(get_exec_env()) && (veid != get_exec_env()->veid))
-+ return -EPERM;
-+ if (veid == 0)
-+ return -ESRCH;
-+
-+ vstat = kmalloc(sizeof(*vstat), GFP_KERNEL);
-+ if (!vstat)
-+ return -ENOMEM;
-+ memset(vstat, 0, sizeof(*vstat));
-+
-+ retval = -ESRCH;
-+ read_lock(&ve_list_guard);
-+ ve = __find_ve_by_id(veid);
-+ if (ve == NULL)
-+ goto out_unlock;
-+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
-+ vstat->user_jif += VE_CPU_STATS(ve, cpu)->user;
-+ vstat->nice_jif += VE_CPU_STATS(ve, cpu)->nice;
-+ vstat->system_jif += VE_CPU_STATS(ve, cpu)->system;
-+ vstat->idle_clk += ve_sched_get_idle_time(ve, cpu);
-+ }
-+ vstat->uptime_clk = get_cycles() - ve->start_cycles;
-+ vstat->uptime_jif = jiffies - (unsigned long)ve->start_jiffies;
-+ for (i = 0; i < 3; i++) {
-+ tmp = ve->avenrun[i] + (FIXED_1/200);
-+ vstat->avenrun[i].val_int = LOAD_INT(tmp);
-+ vstat->avenrun[i].val_frac = LOAD_FRAC(tmp);
-+ }
-+ read_unlock(&ve_list_guard);
-+
-+ retval = 0;
-+ if (copy_to_user(buf, vstat, sizeof(*vstat)))
-+ retval = -EFAULT;
-+out_free:
-+ kfree(vstat);
-+ return retval;
-+
-+out_unlock:
-+ read_unlock(&ve_list_guard);
-+ goto out_free;
-+}
-+
-+/**********************************************************************
-+ * Devices permissions routines,
-+ * character and block devices separately
-+ **********************************************************************/
-+
-+/* Rules applied in the following order:
-+ MAJOR!=0, MINOR!=0
-+ MAJOR!=0, MINOR==0
-+ MAJOR==0, MINOR==0
-+*/
-+struct devperms_struct
-+{
-+ dev_t dev; /* device id */
-+ unsigned char mask;
-+ unsigned type;
-+ envid_t veid;
-+
-+ struct devperms_struct *devhash_next;
-+ struct devperms_struct **devhash_pprev;
-+};
-+
-+static struct devperms_struct original_perms[] =
-+{{
-+ MKDEV(0,0), /*device*/
-+ S_IROTH | S_IWOTH,
-+ S_IFCHR, /*type*/
-+ 0, /*veid*/
-+ NULL, NULL
-+},
-+{
-+ MKDEV(0,0), /*device*/
-+ S_IXGRP | S_IROTH | S_IWOTH,
-+ S_IFBLK, /*type*/
-+ 0, /*veid*/
-+ NULL, NULL
-+}};
-+
-+static struct devperms_struct default_major_perms[] = {
-+ {MKDEV(UNIX98_PTY_MASTER_MAJOR, 0), S_IROTH | S_IWOTH, S_IFCHR},
-+ {MKDEV(UNIX98_PTY_SLAVE_MAJOR, 0), S_IROTH | S_IWOTH, S_IFCHR},
-+ {MKDEV(PTY_MASTER_MAJOR, 0), S_IROTH | S_IWOTH, S_IFCHR},
-+ {MKDEV(PTY_SLAVE_MAJOR, 0), S_IROTH | S_IWOTH, S_IFCHR},
-+};
-+static struct devperms_struct default_minor_perms[] = {
-+ {MKDEV(MEM_MAJOR, 3), S_IROTH | S_IWOTH, S_IFCHR}, /* null */
-+ {MKDEV(MEM_MAJOR, 5), S_IROTH | S_IWOTH, S_IFCHR}, /* zero */
-+ {MKDEV(MEM_MAJOR, 7), S_IROTH | S_IWOTH, S_IFCHR}, /* full */
-+ {MKDEV(TTYAUX_MAJOR, 0), S_IROTH | S_IWOTH, S_IFCHR},/* tty */
-+ {MKDEV(TTYAUX_MAJOR, 2), S_IROTH | S_IWOTH, S_IFCHR},/* ptmx */
-+ {MKDEV(MEM_MAJOR, 8), S_IROTH, S_IFCHR}, /* random */
-+ {MKDEV(MEM_MAJOR, 9), S_IROTH, S_IFCHR}, /* urandom */
-+};
-+
-+static struct devperms_struct default_deny_perms = {
-+ MKDEV(0, 0), 0, S_IFCHR
-+};
-+
-+static inline struct devperms_struct *find_default_devperms(int type,
-+ dev_t dev)
-+{
-+ int i;
-+
-+ /* XXX all defaults perms are S_IFCHR */
-+ if (type != S_IFCHR)
-+ return &default_deny_perms;
-+
-+ for (i = 0;
-+ i < sizeof(default_minor_perms)/sizeof(struct devperms_struct);
-+ i++)
-+ if (MAJOR(dev) == MAJOR(default_minor_perms[i].dev) &&
-+ MINOR(dev) == MINOR(default_minor_perms[i].dev))
-+ return &default_minor_perms[i];
-+ for (i = 0;
-+ i < sizeof(default_major_perms)/sizeof(struct devperms_struct);
-+ i++)
-+ if (MAJOR(dev) == MAJOR(default_major_perms[i].dev))
-+ return &default_major_perms[i];
-+
-+ return &default_deny_perms;
-+}
-+
-+#define DEVPERMS_HASH_SZ 512
-+struct devperms_struct *devperms_hash[DEVPERMS_HASH_SZ];
-+
-+#define devperms_hashfn(id,dev) \
-+ ( (id << 5) ^ (id >> 5) ^ (MAJOR(dev)) ^ MINOR(dev) ) & \
-+ (DEVPERMS_HASH_SZ - 1)
-+
-+static inline void hash_devperms(struct devperms_struct *p)
-+{
-+ struct devperms_struct **htable =
-+ &devperms_hash[devperms_hashfn(p->veid,p->dev)];
-+
-+ if ((p->devhash_next = *htable) != NULL)
-+ (*htable)->devhash_pprev = &p->devhash_next;
-+ *htable = p;
-+ p->devhash_pprev = htable;
-+}
-+
-+static inline void unhash_devperms(struct devperms_struct *p)
-+{
-+ if (p->devhash_next)
-+ p->devhash_next->devhash_pprev = p->devhash_pprev;
-+ *p->devhash_pprev = p->devhash_next;
-+}
-+
-+static int __init init_devperms_hash(void)
-+{
-+ write_lock_irq(&devperms_hash_guard);
-+ memset(devperms_hash, 0, sizeof(devperms_hash));
-+ hash_devperms(original_perms);
-+ hash_devperms(original_perms+1);
-+ write_unlock_irq(&devperms_hash_guard);
-+ return 0;
-+}
-+
-+static inline void fini_devperms_hash(void)
-+{
-+}
-+
-+static inline struct devperms_struct *find_devperms(envid_t veid,
-+ int type,
-+ dev_t dev)
-+{
-+ struct devperms_struct *p, **htable =
-+ &devperms_hash[devperms_hashfn(veid,dev)];
-+
-+ for (p = *htable; p && !(p->type==type &&
-+ MAJOR(dev)==MAJOR(p->dev) &&
-+ MINOR(dev)==MINOR(p->dev) &&
-+ p->veid==veid);
-+ p = p->devhash_next)
-+ ;
-+ return p;
-+}
-+
-+
-+static void do_clean_devperms(envid_t veid)
-+{
-+ int i;
-+ struct devperms_struct* ve;
-+
-+ write_lock_irq(&devperms_hash_guard);
-+ for (i = 0; i < DEVPERMS_HASH_SZ; i++)
-+ for (ve = devperms_hash[i]; ve;) {
-+ struct devperms_struct *next = ve->devhash_next;
-+ if (ve->veid == veid) {
-+ unhash_devperms(ve);
-+ kfree(ve);
-+ }
-+
-+ ve = next;
-+ }
-+ write_unlock_irq(&devperms_hash_guard);
-+}
-+
-+/*
-+ * Mode is a mask of
-+ * FMODE_READ for read access (configurable by S_IROTH)
-+ * FMODE_WRITE for write access (configurable by S_IWOTH)
-+ * FMODE_QUOTACTL for quotactl access (configurable by S_IXGRP)
-+ */
-+int real_get_device_perms_ve(int dev_type, dev_t dev, int access_mode)
-+{
-+ struct devperms_struct *perms;
-+ struct ve_struct *ve;
-+ envid_t veid;
-+
-+ perms = NULL;
-+ ve = get_exec_env();
-+ veid = ve->veid;
-+
-+ read_lock(&devperms_hash_guard);
-+
-+ perms = find_devperms(veid, dev_type|VE_USE_MINOR, dev);
-+ if (perms)
-+ goto end;
-+
-+ perms = find_devperms(veid, dev_type|VE_USE_MAJOR, MKDEV(MAJOR(dev),0));
-+ if (perms)
-+ goto end;
-+
-+ perms = find_devperms(veid, dev_type, MKDEV(0,0));
-+ if (perms)
-+ goto end;
-+
-+ perms = find_default_devperms(dev_type, dev);
-+
-+end:
-+ read_unlock(&devperms_hash_guard);
-+
-+ access_mode = "\000\004\002\006\010\014\012\016"[access_mode];
-+ return perms ?
-+ (((perms->mask & access_mode) == access_mode) ? 0 : -EACCES) :
-+ -ENODEV;
-+}
-+
-+int do_setdevperms(envid_t veid, unsigned type, dev_t dev, unsigned mask)
-+{
-+ struct devperms_struct *perms;
-+
-+ write_lock_irq(&devperms_hash_guard);
-+ perms = find_devperms(veid, type, dev);
-+ if (!perms) {
-+ struct devperms_struct *perms_new;
-+ write_unlock_irq(&devperms_hash_guard);
-+
-+ perms_new = kmalloc(sizeof(struct devperms_struct), GFP_KERNEL);
-+ if (!perms_new)
-+ return -ENOMEM;
-+
-+ write_lock_irq(&devperms_hash_guard);
-+ perms = find_devperms(veid, type, dev);
-+ if (perms) {
-+ kfree(perms_new);
-+ perms_new = perms;
-+ }
-+
-+ switch (type & VE_USE_MASK) {
-+ case 0:
-+ dev = 0;
-+ break;
-+ case VE_USE_MAJOR:
-+ dev = MKDEV(MAJOR(dev),0);
-+ break;
-+ }
-+
-+ perms_new->veid = veid;
-+ perms_new->dev = dev;
-+ perms_new->type = type;
-+ perms_new->mask = mask & S_IALLUGO;
-+ hash_devperms(perms_new);
-+ } else
-+ perms->mask = mask & S_IALLUGO;
-+ write_unlock_irq(&devperms_hash_guard);
-+ return 0;
-+}
-+EXPORT_SYMBOL(do_setdevperms);
-+
-+int real_setdevperms(envid_t veid, unsigned type, dev_t dev, unsigned mask)
-+{
-+ struct ve_struct *ve;
-+ int err;
-+
-+ if (!capable(CAP_SETVEID) || veid == 0)
-+ return -EPERM;
-+
-+ if ((ve = get_ve_by_id(veid)) == NULL)
-+ return -ESRCH;
-+
-+ down_read(&ve->op_sem);
-+ err = -ESRCH;
-+ if (ve->is_running)
-+ err = do_setdevperms(veid, type, dev, mask);
-+ up_read(&ve->op_sem);
-+ real_put_ve(ve);
-+ return err;
-+}
-+
-+void real_update_load_avg_ve(void)
-+{
-+ struct ve_struct *ve;
-+ unsigned long nr_active;
-+
-+ read_lock(&ve_list_guard);
-+ for (ve = ve_list_head; ve != NULL; ve = ve->next) {
-+ nr_active = nr_running_ve(ve) + nr_uninterruptible_ve(ve);
-+ nr_active *= FIXED_1;
-+ CALC_LOAD(ve->avenrun[0], EXP_1, nr_active);
-+ CALC_LOAD(ve->avenrun[1], EXP_5, nr_active);
-+ CALC_LOAD(ve->avenrun[2], EXP_15, nr_active);
-+ }
-+ read_unlock(&ve_list_guard);
-+}
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * FS-related helpers to VE start/stop
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+/*
-+ * DEVPTS needs a virtualization: each environment should see each own list of
-+ * pseudo-terminals.
-+ * To implement it we need to have separate devpts superblocks for each
-+ * VE, and each VE should mount its own one.
-+ * Thus, separate vfsmount structures are required.
-+ * To minimize intrusion into vfsmount lookup code, separate file_system_type
-+ * structures are created.
-+ *
-+ * In addition to this, patch fo character device itself is required, as file
-+ * system itself is used only for MINOR/MAJOR lookup.
-+ */
-+static int register_ve_fs_type(struct ve_struct *ve,
-+ struct file_system_type *template,
-+ struct file_system_type **p_fs_type, struct vfsmount **p_mnt)
-+{
-+ struct vfsmount *mnt;
-+ struct file_system_type *local_fs_type;
-+ int ret;
-+
-+ VZTRACE("register_ve_fs_type(\"%s\")\n", template->name);
-+
-+ local_fs_type = kmalloc(sizeof(*local_fs_type) + sizeof(void *),
-+ GFP_KERNEL);
-+ if (local_fs_type == NULL)
-+ return -ENOMEM;
-+
-+ memset(local_fs_type, 0, sizeof(*local_fs_type));
-+ local_fs_type->name = template->name;
-+ local_fs_type->fs_flags = template->fs_flags;
-+ local_fs_type->get_sb = template->get_sb;
-+ local_fs_type->kill_sb = template->kill_sb;
-+ local_fs_type->owner = template->owner;
-+ /*
-+ * 1. we do not have refcounter on fstype
-+ * 2. fstype holds reference to ve using get_ve()/put_ve().
-+ * so we free fstype when freeing ve and we are sure it's ok to free it
-+ */
-+ SET_VE_OWNER_FSTYPE(local_fs_type, ve);
-+ get_filesystem(local_fs_type); /* get_ve() inside */
-+
-+ ret = register_filesystem(local_fs_type); /* does not get */
-+ if (ret)
-+ goto reg_err;
-+
-+ mnt = kern_mount(local_fs_type);
-+ if (IS_ERR(mnt))
-+ goto mnt_err;
-+
-+ /* Usage counters after succesful execution kern_mount:
-+ * local_fs_type - +1 (get_fs_type,get_sb_single,put_filesystem)
-+ * mnt - +1 == 1 (alloc_vfsmnt)
-+ */
-+
-+ *p_fs_type = local_fs_type;
-+ *p_mnt = mnt;
-+ return 0;
-+
-+mnt_err:
-+ ret = PTR_ERR(mnt);
-+ unregister_filesystem(local_fs_type); /* does not put */
-+
-+reg_err:
-+ put_filesystem(local_fs_type);
-+ kfree(local_fs_type);
-+ printk(KERN_DEBUG
-+ "register_ve_fs_type(\"%s\") err=%d\n", template->name, ret);
-+ return ret;
-+}
-+
-+static void umount_ve_fs_type(struct file_system_type *local_fs_type)
-+{
-+ struct vfsmount *mnt;
-+ struct list_head *p, *q;
-+ LIST_HEAD(kill);
-+
-+ down_write(&current->namespace->sem);
-+ spin_lock(&vfsmount_lock);
-+ list_for_each_safe(p, q, &current->namespace->list) {
-+ mnt = list_entry(p, struct vfsmount, mnt_list);
-+ if (mnt->mnt_sb->s_type != local_fs_type)
-+ continue;
-+ list_del(p);
-+ list_add(p, &kill);
-+ }
-+
-+ while (!list_empty(&kill)) {
-+ mnt = list_entry(kill.next, struct vfsmount, mnt_list);
-+ umount_tree(mnt);
-+ }
-+ spin_unlock(&vfsmount_lock);
-+ up_write(&current->namespace->sem);
-+}
-+
-+static void unregister_ve_fs_type(struct file_system_type *local_fs_type,
-+ struct vfsmount *local_fs_mount)
-+{
-+ if (local_fs_mount == NULL ||
-+ local_fs_type == NULL) {
-+ if (local_fs_mount != NULL ||
-+ local_fs_type != NULL)
-+ BUG();
-+ return;
-+ }
-+
-+ VZTRACE("unregister_ve_fs_type(\"%s\")\n", local_fs_type->name);
-+
-+ unregister_filesystem(local_fs_type);
-+ umount_ve_fs_type(local_fs_type);
-+ kern_umount(local_fs_mount); /* alias to mntput, drop our ref */
-+ put_filesystem(local_fs_type);
-+}
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * FS-related helpers to VE start/stop
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+#ifdef CONFIG_SYSCTL
-+static ctl_table ve_sysctl_tables[] = {
-+ /* kernel */
-+ {
-+ .ctl_name = CTL_KERN,
-+ .procname = "kernel",
-+ .mode = 0555,
-+ .child = &ve_sysctl_tables[2],
-+ },
-+ { .ctl_name = 0 },
-+ /* kernel/[vars] */
-+ {
-+ .ctl_name = KERN_NODENAME,
-+ .procname = "hostname",
-+ .maxlen = 64,
-+ .mode = 0644,
-+ .proc_handler = &proc_doutsstring,
-+ .strategy = &sysctl_string,
-+ },
-+ {
-+ .ctl_name = KERN_DOMAINNAME,
-+ .procname = "domainname",
-+ .maxlen = 64,
-+ .mode = 0644,
-+ .proc_handler = &proc_doutsstring,
-+ .strategy = &sysctl_string,
-+ },
-+ {
-+ .ctl_name = KERN_SHMMAX,
-+ .procname = "shmmax",
-+ .maxlen = sizeof(size_t),
-+ .mode = 0644,
-+ .proc_handler = &proc_doulongvec_minmax,
-+ },
-+ {
-+ .ctl_name = KERN_SHMALL,
-+ .procname = "shmall",
-+ .maxlen = sizeof(size_t),
-+ .mode = 0644,
-+ .proc_handler = &proc_doulongvec_minmax,
-+ },
-+ {
-+ .ctl_name = KERN_SHMMNI,
-+ .procname = "shmmni",
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = KERN_MSGMAX,
-+ .procname = "msgmax",
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = KERN_MSGMNI,
-+ .procname = "msgmni",
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = KERN_MSGMNB,
-+ .procname = "msgmnb",
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = KERN_SEM,
-+ .procname = "sem",
-+ .maxlen = 4 * sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
-+ { .ctl_name = 0, }
-+};
-+
-+static int register_ve_sysctltables(struct ve_struct *ve)
-+{
-+ struct ctl_table_header *header;
-+ ctl_table *root, *table;
-+
-+ VZTRACE("register_ve_sysctltables\n");
-+
-+ root = clone_sysctl_template(ve_sysctl_tables,
-+ sizeof(ve_sysctl_tables) / sizeof(ctl_table));
-+ if (root == NULL)
-+ goto out;
-+
-+ table = root->child;
-+ table[0].data = &ve->utsname->nodename;
-+ table[1].data = &ve->utsname->domainname;
-+ table[2].data = &ve->_shm_ctlmax;
-+ table[3].data = &ve->_shm_ctlall;
-+ table[4].data = &ve->_shm_ctlmni;
-+ table[5].data = &ve->_msg_ctlmax;
-+ table[6].data = &ve->_msg_ctlmni;
-+ table[7].data = &ve->_msg_ctlmnb;
-+ table[8].data = &ve->_sem_ctls[0];
-+
-+ /* insert at head to override kern entries */
-+ header = register_sysctl_table(root, 1);
-+ if (header == NULL)
-+ goto out_free;
-+
-+ ve->kern_header = header;
-+ ve->kern_table = root;
-+ return 0;
-+
-+out_free:
-+ free_sysctl_clone(root);
-+out:
-+ return -ENOMEM;
-+}
-+
-+static inline void unregister_ve_sysctltables(struct ve_struct *ve)
-+{
-+ unregister_sysctl_table(ve->kern_header);
-+}
-+
-+static inline void free_ve_sysctltables(struct ve_struct *ve)
-+{
-+ free_sysctl_clone(ve->kern_table);
-+}
-+#endif
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * VE start: subsystems
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#include <net/ip.h>
-+#include <net/tcp.h>
-+#include <net/udp.h>
-+#include <net/icmp.h>
-+
-+extern struct new_utsname virt_utsname;
-+
-+static int init_ve_utsname(struct ve_struct *ve)
-+{
-+ ve->utsname = kmalloc(sizeof(*ve->utsname), GFP_KERNEL);
-+ if (ve->utsname == NULL)
-+ return -ENOMEM;
-+
-+ down_read(&uts_sem); /* protect the source */
-+ memcpy(ve->utsname, &system_utsname, sizeof(*ve->utsname));
-+ memcpy(ve->utsname->release, virt_utsname.release,
-+ sizeof(virt_utsname.release));
-+ up_read(&uts_sem);
-+
-+ return 0;
-+}
-+
-+static void free_ve_utsname(struct ve_struct *ve)
-+{
-+ kfree(ve->utsname);
-+ ve->utsname = NULL;
-+}
-+
-+static int init_fini_ve_mibs(struct ve_struct *ve, int fini)
-+{
-+ if (fini)
-+ goto fini;
-+ if (!(ve->_net_statistics[0] = alloc_percpu(struct linux_mib)))
-+ goto out1;
-+ if (!(ve->_net_statistics[1] = alloc_percpu(struct linux_mib)))
-+ goto out2;
-+ if (!(ve->_ip_statistics[0] = alloc_percpu(struct ipstats_mib)))
-+ goto out3;
-+ if (!(ve->_ip_statistics[1] = alloc_percpu(struct ipstats_mib)))
-+ goto out4;
-+ if (!(ve->_icmp_statistics[0] = alloc_percpu(struct icmp_mib)))
-+ goto out5;
-+ if (!(ve->_icmp_statistics[1] = alloc_percpu(struct icmp_mib)))
-+ goto out6;
-+ if (!(ve->_tcp_statistics[0] = alloc_percpu(struct tcp_mib)))
-+ goto out7;
-+ if (!(ve->_tcp_statistics[1] = alloc_percpu(struct tcp_mib)))
-+ goto out8;
-+ if (!(ve->_udp_statistics[0] = alloc_percpu(struct udp_mib)))
-+ goto out9;
-+ if (!(ve->_udp_statistics[1] = alloc_percpu(struct udp_mib)))
-+ goto out10;
-+ return 0;
-+fini:
-+ free_percpu(ve->_udp_statistics[1]);
-+out10:
-+ free_percpu(ve->_udp_statistics[0]);
-+out9:
-+ free_percpu(ve->_tcp_statistics[1]);
-+out8:
-+ free_percpu(ve->_tcp_statistics[0]);
-+out7:
-+ free_percpu(ve->_icmp_statistics[1]);
-+out6:
-+ free_percpu(ve->_icmp_statistics[0]);
-+out5:
-+ free_percpu(ve->_ip_statistics[1]);
-+out4:
-+ free_percpu(ve->_ip_statistics[0]);
-+out3:
-+ free_percpu(ve->_net_statistics[1]);
-+out2:
-+ free_percpu(ve->_net_statistics[0]);
-+out1:
-+ return -ENOMEM;
-+}
-+
-+static inline int init_ve_mibs(struct ve_struct *ve)
-+{
-+ return init_fini_ve_mibs(ve, 0);
-+}
-+
-+static inline void fini_ve_mibs(struct ve_struct *ve)
-+{
-+ (void)init_fini_ve_mibs(ve, 1);
-+}
-+
-+extern struct net_device templ_loopback_dev;
-+static void veloop_setup(struct net_device *dev)
-+{
-+ int padded;
-+ padded = dev->padded;
-+ memcpy(dev, &templ_loopback_dev, sizeof(struct net_device));
-+ dev->padded = padded;
-+}
-+
-+static int init_ve_netdev(void)
-+{
-+ struct ve_struct *ve;
-+ struct net_device_stats *stats;
-+ int err;
-+
-+ ve = get_exec_env();
-+ INIT_HLIST_HEAD(&ve->_net_dev_head);
-+ ve->_net_dev_base = NULL;
-+ ve->_net_dev_tail = &ve->_net_dev_base;
-+
-+ err = -ENOMEM;
-+ ve->_loopback_dev = alloc_netdev(0, templ_loopback_dev.name,
-+ veloop_setup);
-+ if (ve->_loopback_dev == NULL)
-+ goto out;
-+
-+ ve->_loopback_stats = kmalloc(sizeof(struct net_device_stats)*NR_CPUS,
-+ GFP_KERNEL);
-+ if (ve->_loopback_stats == NULL)
-+ goto out_free_netdev;
-+ if (loopback_dev.get_stats != NULL) {
-+ stats = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
-+ if (stats != NULL) {
-+ memset(stats, 0, sizeof(struct net_device_stats));
-+ ve->_loopback_dev->priv = stats;
-+ ve->_loopback_dev->get_stats = loopback_dev.get_stats;
-+ ve->_loopback_dev->destructor = loopback_dev.destructor;
-+ }
-+ }
-+ err = register_netdev(ve->_loopback_dev);
-+ if (err)
-+ goto out_free_stats;
-+ return 0;
-+
-+out_free_stats:
-+ if (ve->_loopback_dev->priv != NULL)
-+ kfree(ve->_loopback_dev->priv);
-+ kfree(ve->_loopback_stats);
-+out_free_netdev:
-+ free_netdev(ve->_loopback_dev);
-+out:
-+ return err;
-+}
-+
-+static void fini_ve_netdev(void)
-+{
-+ struct ve_struct *ve;
-+ struct net_device *dev;
-+
-+ ve = get_exec_env();
-+ while (1) {
-+ rtnl_lock();
-+ /*
-+ * loopback is special, it can be referenced in fib's,
-+ * so it must be freed the last. Doing so is
-+ * sufficient to guarantee absence of such references.
-+ */
-+ if (dev_base == ve->_loopback_dev)
-+ dev = dev_base->next;
-+ else
-+ dev = dev_base;
-+ if (dev == NULL)
-+ break;
-+ unregister_netdevice(dev);
-+ rtnl_unlock();
-+ free_netdev(dev);
-+ }
-+ unregister_netdevice(ve->_loopback_dev);
-+ rtnl_unlock();
-+ free_netdev(ve->_loopback_dev);
-+ ve->_loopback_dev = NULL;
-+}
-+#else
-+#define init_ve_mibs(ve) (0)
-+#define fini_ve_mibs(ve) do { } while (0)
-+#define init_ve_netdev() (0)
-+#define fini_ve_netdev() do { } while (0)
-+#endif
-+
-+static int prepare_proc_root(struct ve_struct *ve)
-+{
-+ struct proc_dir_entry *de;
-+
-+ de = kmalloc(sizeof(struct proc_dir_entry) + 6, GFP_KERNEL);
-+ if (de == NULL)
-+ return -ENOMEM;
-+ memset(de, 0, sizeof(struct proc_dir_entry));
-+ memcpy(de + 1, "/proc", 6);
-+ de->name = (char *)(de + 1);
-+ de->namelen = 5;
-+ de->mode = S_IFDIR | S_IRUGO | S_IXUGO;
-+ de->nlink = 2;
-+ atomic_set(&de->count, 1);
-+
-+ ve->proc_root = de;
-+ return 0;
-+}
-+
-+#ifdef CONFIG_PROC_FS
-+static int init_ve_proc(struct ve_struct *ve)
-+{
-+ int err;
-+ struct proc_dir_entry *de;
-+
-+ err = prepare_proc_root(ve);
-+ if (err)
-+ goto out_root;
-+
-+ err = register_ve_fs_type(ve, &proc_fs_type,
-+ &ve->proc_fstype, &ve->proc_mnt);
-+ if (err)
-+ goto out_reg;
-+
-+ /* create /proc/vz in VE local proc tree */
-+ err = -ENOMEM;
-+ de = create_proc_entry("vz", S_IFDIR|S_IRUGO|S_IXUGO, NULL);
-+ if (!de)
-+ goto out_vz;
-+
-+#ifdef CONFIG_VE_IPTABLES
-+ de = proc_mkdir("net", NULL);
-+ if (!de)
-+ goto out_net;
-+#endif
-+ return 0;
-+
-+#ifdef CONFIG_VE_IPTABLES
-+out_net:
-+ remove_proc_entry("vz", NULL);
-+#endif
-+out_vz:
-+ unregister_ve_fs_type(ve->proc_fstype, ve->proc_mnt);
-+ ve->proc_mnt = NULL;
-+out_reg:
-+ /* proc_fstype and proc_root are freed in real_put_ve -> free_ve_proc */
-+ ;
-+out_root:
-+ return err;
-+}
-+
-+static void fini_ve_proc(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_VE_IPTABLES
-+ remove_proc_entry("net", NULL);
-+#endif
-+ remove_proc_entry("vz", NULL);
-+ unregister_ve_fs_type(ve->proc_fstype, ve->proc_mnt);
-+ ve->proc_mnt = NULL;
-+}
-+
-+static void free_ve_proc(struct ve_struct *ve)
-+{
-+ /* proc filesystem frees proc_dir_entries on remove_proc_entry() only,
-+ so we check that everything was removed and not lost */
-+ if (ve->proc_root && ve->proc_root->subdir) {
-+ struct proc_dir_entry *p = ve->proc_root;
-+ printk(KERN_WARNING "VPS: %d: proc entry /proc", ve->veid);
-+ while ((p = p->subdir) != NULL)
-+ printk("/%s", p->name);
-+ printk(" is not removed!\n");
-+ }
-+
-+ kfree(ve->proc_root);
-+ kfree(ve->proc_fstype);
-+
-+ ve->proc_fstype = NULL;
-+ ve->proc_root = NULL;
-+}
-+#else
-+#define init_ve_proc(ve) (0)
-+#define fini_ve_proc(ve) do { } while (0)
-+#define free_ve_proc(ve) do { } while (0)
-+#endif
-+
-+#ifdef CONFIG_SYSCTL
-+static int init_ve_sysctl(struct ve_struct *ve)
-+{
-+ int err;
-+
-+#ifdef CONFIG_PROC_FS
-+ err = -ENOMEM;
-+ ve->proc_sys_root = proc_mkdir("sys", 0);
-+ if (ve->proc_sys_root == NULL)
-+ goto out_proc;
-+#endif
-+ INIT_LIST_HEAD(&ve->sysctl_lh);
-+ err = register_ve_sysctltables(ve);
-+ if (err)
-+ goto out_reg;
-+
-+ err = devinet_sysctl_init(ve);
-+ if (err)
-+ goto out_dev;
-+
-+ return 0;
-+
-+out_dev:
-+ unregister_ve_sysctltables(ve);
-+ free_ve_sysctltables(ve);
-+out_reg:
-+#ifdef CONFIG_PROC_FS
-+ remove_proc_entry("sys", NULL);
-+out_proc:
-+#endif
-+ return err;
-+}
-+
-+static void fini_ve_sysctl(struct ve_struct *ve)
-+{
-+ devinet_sysctl_fini(ve);
-+ unregister_ve_sysctltables(ve);
-+ remove_proc_entry("sys", NULL);
-+}
-+
-+static void free_ve_sysctl(struct ve_struct *ve)
-+{
-+ devinet_sysctl_free(ve);
-+ free_ve_sysctltables(ve);
-+}
-+#else
-+#define init_ve_sysctl(ve) (0)
-+#define fini_ve_sysctl(ve) do { } while (0)
-+#define free_ve_sysctl(ve) do { } while (0)
-+#endif
-+
-+#ifdef CONFIG_UNIX98_PTYS
-+#include <linux/devpts_fs.h>
-+
-+static int init_ve_devpts(struct ve_struct *ve)
-+{
-+ int err;
-+
-+ err = -ENOMEM;
-+ ve->devpts_config = kmalloc(sizeof(struct devpts_config), GFP_KERNEL);
-+ if (ve->devpts_config == NULL)
-+ goto out;
-+ memset(ve->devpts_config, 0, sizeof(struct devpts_config));
-+ ve->devpts_config->mode = 0600;
-+ err = register_ve_fs_type(ve, &devpts_fs_type,
-+ &ve->devpts_fstype, &ve->devpts_mnt);
-+ if (err) {
-+ kfree(ve->devpts_config);
-+ ve->devpts_config = NULL;
-+ }
-+out:
-+ return err;
-+}
-+
-+static void fini_ve_devpts(struct ve_struct *ve)
-+{
-+ unregister_ve_fs_type(ve->devpts_fstype, ve->devpts_mnt);
-+ /* devpts_fstype is freed in real_put_ve -> free_ve_filesystems */
-+ ve->devpts_mnt = NULL;
-+ kfree(ve->devpts_config);
-+ ve->devpts_config = NULL;
-+}
-+#else
-+#define init_ve_devpts(ve) (0)
-+#define fini_ve_devpts(ve) do { } while (0)
-+#endif
-+
-+static int init_ve_shmem(struct ve_struct *ve)
-+{
-+ return register_ve_fs_type(ve,
-+ &tmpfs_fs_type,
-+ &ve->shmem_fstype,
-+ &ve->shmem_mnt);
-+}
-+
-+static void fini_ve_shmem(struct ve_struct *ve)
-+{
-+ unregister_ve_fs_type(ve->shmem_fstype, ve->shmem_mnt);
-+ /* shmem_fstype is freed in real_put_ve -> free_ve_filesystems */
-+ ve->shmem_mnt = NULL;
-+}
-+
-+static inline int init_ve_sysfs_root(struct ve_struct *ve)
-+{
-+ struct sysfs_dirent *sysfs_root;
-+
-+ sysfs_root = kmalloc(sizeof(struct sysfs_dirent), GFP_KERNEL);
-+ if (sysfs_root == NULL)
-+ return -ENOMEM;
-+
-+ memset(sysfs_root, 0, sizeof(struct sysfs_dirent));
-+ INIT_LIST_HEAD(&sysfs_root->s_sibling);
-+ INIT_LIST_HEAD(&sysfs_root->s_children);
-+ sysfs_root->s_type = SYSFS_ROOT;
-+ ve->sysfs_root = sysfs_root;
-+ return 0;
-+}
-+
-+static int init_ve_sysfs(struct ve_struct *ve)
-+{
-+ struct subsystem *subsys;
-+ struct class *nc;
-+ int err;
-+ extern struct subsystem class_obj_subsys;
-+ extern struct subsystem class_subsys;
-+ extern struct class net_class;
-+
-+#ifdef CONFIG_SYSFS
-+ err = 0;
-+ if (ve->features & VE_FEATURE_SYSFS) {
-+ err = init_ve_sysfs_root(ve);
-+ if (err != 0)
-+ goto out;
-+ err = register_ve_fs_type(ve,
-+ &sysfs_fs_type,
-+ &ve->sysfs_fstype,
-+ &ve->sysfs_mnt);
-+ }
-+ if (err != 0)
-+ goto out_fs_type;
-+#endif
-+ err = -ENOMEM;
-+ subsys = kmalloc(sizeof(*subsys), GFP_KERNEL);
-+ if (subsys == NULL)
-+ goto out_class_obj;
-+ /* ick, this is ugly, the things we go through to keep from showing up
-+ * in sysfs... */
-+ memset(subsys, 0, sizeof(*subsys));
-+ memcpy(&subsys->kset.kobj.name, &class_obj_subsys.kset.kobj.name,
-+ sizeof(subsys->kset.kobj.name));
-+ subsys->kset.ktype = class_obj_subsys.kset.ktype;
-+ subsys->kset.hotplug_ops = class_obj_subsys.kset.hotplug_ops;
-+ subsystem_init(subsys);
-+ if (!subsys->kset.subsys)
-+ subsys->kset.subsys = subsys;
-+ ve->class_obj_subsys = subsys;
-+
-+ err = -ENOMEM;
-+ subsys = kmalloc(sizeof(*subsys), GFP_KERNEL);
-+ if (subsys == NULL)
-+ goto out_class_subsys;
-+ /* ick, this is ugly, the things we go through to keep from showing up
-+ * in sysfs... */
-+ memset(subsys, 0, sizeof(*subsys));
-+ memcpy(&subsys->kset.kobj.name, &class_subsys.kset.kobj.name,
-+ sizeof(subsys->kset.kobj.name));
-+ subsys->kset.ktype = class_subsys.kset.ktype;
-+ subsys->kset.hotplug_ops = class_subsys.kset.hotplug_ops;
-+ ve->class_subsys = subsys;
-+ err = subsystem_register(subsys);
-+ if (err != 0)
-+ goto out_register;
-+
-+ err = -ENOMEM;
-+ nc = kmalloc(sizeof(*nc), GFP_KERNEL);
-+ if (nc == NULL)
-+ goto out_nc;
-+ memset(nc, 0, sizeof(*nc));
-+ nc->name = net_class.name;
-+ nc->release = net_class.release;
-+ nc->hotplug = net_class.hotplug;
-+ err = class_register(nc);
-+ if (err != 0)
-+ goto out_class_register;
-+ ve->net_class = nc;
-+
-+ ve->tty_class = init_ve_tty_class();
-+ if (IS_ERR(ve->tty_class)) {
-+ err = PTR_ERR(ve->tty_class);
-+ ve->tty_class = NULL;
-+ goto out_tty_class_register;
-+ }
-+
-+ return err;
-+
-+out_tty_class_register:
-+ class_unregister(ve->net_class);
-+ ve->net_class = NULL;
-+out_class_register:
-+ kfree(nc);
-+out_nc:
-+ subsystem_unregister(subsys);
-+out_register:
-+ kfree(ve->class_subsys);
-+ ve->class_subsys = NULL;
-+out_class_subsys:
-+ kfree(ve->class_obj_subsys);
-+ ve->class_obj_subsys = NULL;
-+out_class_obj:
-+#ifdef CONFIG_SYSFS
-+ unregister_ve_fs_type(ve->sysfs_fstype, ve->sysfs_mnt);
-+ /* sysfs_fstype is freed in real_put_ve -> free_ve_filesystems */
-+out_fs_type:
-+ kfree(ve->sysfs_root);
-+ ve->sysfs_root = NULL;
-+out:
-+#endif
-+ return err;
-+}
-+
-+static void fini_ve_sysfs(struct ve_struct *ve)
-+{
-+ fini_ve_tty_class(ve->tty_class);
-+ class_unregister(ve->net_class);
-+ subsystem_unregister(ve->class_subsys);
-+
-+ kfree(ve->net_class);
-+ kfree(ve->class_subsys);
-+ kfree(ve->class_obj_subsys);
-+
-+ ve->net_class = NULL;
-+ ve->class_subsys = NULL;
-+ ve->class_obj_subsys = NULL;
-+#ifdef CONFIG_SYSFS
-+ unregister_ve_fs_type(ve->sysfs_fstype, ve->sysfs_mnt);
-+ ve->sysfs_mnt = NULL;
-+ kfree(ve->sysfs_root);
-+ ve->sysfs_root = NULL;
-+ /* sysfs_fstype is freed in real_put_ve -> free_ve_filesystems */
-+#endif
-+}
-+
-+static void free_ve_filesystems(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_SYSFS
-+ kfree(ve->sysfs_fstype);
-+ ve->sysfs_fstype = NULL;
-+#endif
-+ kfree(ve->shmem_fstype);
-+ ve->shmem_fstype = NULL;
-+
-+ kfree(ve->devpts_fstype);
-+ ve->devpts_fstype = NULL;
-+
-+ free_ve_proc(ve);
-+}
-+
-+static int init_printk(struct ve_struct *ve)
-+{
-+ struct ve_prep_printk {
-+ wait_queue_head_t log_wait;
-+ unsigned long log_start;
-+ unsigned long log_end;
-+ unsigned long logged_chars;
-+ } *tmp;
-+
-+ tmp = kmalloc(sizeof(struct ve_prep_printk), GFP_KERNEL);
-+ if (!tmp)
-+ return -ENOMEM;
-+ memset(tmp, 0, sizeof(struct ve_prep_printk));
-+ init_waitqueue_head(&tmp->log_wait);
-+ ve->_log_wait = &tmp->log_wait;
-+ ve->_log_start = &tmp->log_start;
-+ ve->_log_end = &tmp->log_end;
-+ ve->_logged_chars = &tmp->logged_chars;
-+ /* ve->log_buf will be initialized later by ve_log_init() */
-+ return 0;
-+}
-+
-+static void fini_printk(struct ve_struct *ve)
-+{
-+ /*
-+ * there is no spinlock protection here because nobody can use
-+ * log_buf at the moments when this code is called.
-+ */
-+ kfree(ve->log_buf);
-+ kfree(ve->_log_wait);
-+}
-+
-+static void fini_venet(struct ve_struct *ve)
-+{
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ tcp_v4_kill_ve_sockets(ve);
-+#endif
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ ve_mapped_devs_cleanup(ve);
-+#endif
-+}
-+
-+static int init_ve_sched(struct ve_struct *ve, unsigned int vcpus)
-+{
-+#ifdef CONFIG_FAIRSCHED
-+ int err;
-+
-+ /*
-+ * We refuse to switch to an already existing node since nodes
-+ * keep a pointer to their ve_struct...
-+ */
-+ err = sys_fairsched_mknod(0, 1, ve->veid);
-+ if (err < 0) {
-+ printk(KERN_WARNING "Can't create fairsched node %d\n",
-+ ve->veid);
-+ return err;
-+ }
-+ err = sys_fairsched_vcpus(ve->veid, vcpus);
-+ if (err) {
-+ printk(KERN_WARNING "Can't set fairsched vcpus on node %d\n",
-+ ve->veid);
-+ goto cleanup;
-+ }
-+ err = sys_fairsched_mvpr(current->pid, ve->veid);
-+ if (err) {
-+ printk(KERN_WARNING "Can't switch to fairsched node %d\n",
-+ ve->veid);
-+ goto cleanup;
-+ }
-+#endif
-+ ve_sched_attach(ve);
-+ return 0;
-+
-+#ifdef CONFIG_FAIRSCHED
-+cleanup:
-+ if (sys_fairsched_rmnod(ve->veid))
-+ printk(KERN_ERR "Can't clean fairsched node %d\n",
-+ ve->veid);
-+ return err;
-+#endif
-+}
-+
-+static void fini_ve_sched(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_FAIRSCHED
-+ if (task_vsched_id(current) == ve->veid)
-+ if (sys_fairsched_mvpr(current->pid, fairsched_init_node.id))
-+ printk(KERN_WARNING "Can't leave fairsched node %d\n",
-+ ve->veid);
-+ if (sys_fairsched_rmnod(ve->veid))
-+ printk(KERN_ERR "Can't remove fairsched node %d\n",
-+ ve->veid);
-+#endif
-+}
-+
-+static int init_ve_struct(struct ve_struct *ve, envid_t veid,
-+ u32 class_id, env_create_param_t *data,
-+ struct task_struct *init_tsk)
-+{
-+ int n;
-+
-+ memset(ve, 0, sizeof(*ve));
-+ (void)get_ve(ve);
-+ ve->veid = veid;
-+ ve->class_id = class_id;
-+ ve->init_entry = init_tsk;
-+ ve->features = data->feature_mask;
-+ INIT_LIST_HEAD(&ve->vetask_lh);
-+ INIT_LIST_HEAD(&ve->_simple_dev_list);
-+ init_rwsem(&ve->op_sem);
-+ ve->ifindex = -1;
-+
-+ for(n = 0; n < UIDHASH_SZ_VE; ++n)
-+ INIT_LIST_HEAD(&ve->uidhash_table[n]);
-+
-+ ve->start_timespec = ve->init_entry->start_time;
-+ /* The value is wrong, but it is never compared to process
-+ * start times */
-+ ve->start_jiffies = get_jiffies_64();
-+ ve->start_cycles = get_cycles();
-+ ve->virt_pids = glob_virt_pids;
-+
-+ return 0;
-+}
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * /proc/meminfo virtualization
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+static int ve_set_meminfo(envid_t veid, unsigned long val)
-+{
-+ struct ve_struct *ve;
-+
-+ ve = get_ve_by_id(veid);
-+ if (!ve)
-+ return -ESRCH;
-+
-+ ve->meminfo_val = val;
-+ real_put_ve(ve);
-+ return 0;
-+}
-+
-+static int init_ve_meminfo(struct ve_struct *ve)
-+{
-+ ve->meminfo_val = 0;
-+ return 0;
-+}
-+
-+static inline void fini_ve_meminfo(struct ve_struct *ve)
-+{
-+}
-+
-+static void set_ve_root(struct ve_struct *ve, struct task_struct *tsk)
-+{
-+ read_lock(&tsk->fs->lock);
-+ ve->fs_rootmnt = tsk->fs->rootmnt;
-+ ve->fs_root = tsk->fs->root;
-+ read_unlock(&tsk->fs->lock);
-+ mark_tree_virtual(ve->fs_rootmnt, ve->fs_root);
-+}
-+
-+static void set_ve_caps(struct ve_struct *ve, struct task_struct *tsk)
-+{
-+ /* required for real_setdevperms from register_ve_<fs> above */
-+ memcpy(&ve->cap_default, &tsk->cap_effective, sizeof(kernel_cap_t));
-+ cap_lower(ve->cap_default, CAP_SETVEID);
-+}
-+
-+static int ve_list_add(struct ve_struct *ve)
-+{
-+ write_lock_irq(&ve_list_guard);
-+ if (__find_ve_by_id(ve->veid) != NULL)
-+ goto err_exists;
-+
-+ ve->prev = NULL;
-+ ve->next = ve_list_head;
-+ if (ve_list_head)
-+ ve_list_head->prev = ve;
-+ ve_list_head = ve;
-+ nr_ve++;
-+ write_unlock_irq(&ve_list_guard);
-+ return 0;
-+
-+err_exists:
-+ write_unlock_irq(&ve_list_guard);
-+ return -EEXIST;
-+}
-+
-+static void ve_list_del(struct ve_struct *ve)
-+{
-+ write_lock_irq(&ve_list_guard);
-+ if (ve->prev)
-+ ve->prev->next = ve->next;
-+ else
-+ ve_list_head = ve->next;
-+ if (ve->next)
-+ ve->next->prev = ve->prev;
-+ nr_ve--;
-+ write_unlock_irq(&ve_list_guard);
-+}
-+
-+static void set_task_ve_caps(struct task_struct *tsk, struct ve_struct *ve)
-+{
-+ spin_lock(&task_capability_lock);
-+ cap_mask(tsk->cap_effective, ve->cap_default);
-+ cap_mask(tsk->cap_inheritable, ve->cap_default);
-+ cap_mask(tsk->cap_permitted, ve->cap_default);
-+ spin_unlock(&task_capability_lock);
-+}
-+
-+static void move_task(struct task_struct *tsk, struct ve_struct *new,
-+ struct ve_struct *old)
-+{
-+ /* this probihibts ptracing of task entered to VPS from host system */
-+ tsk->mm->vps_dumpable = 0;
-+ /* setup capabilities before enter */
-+ set_task_ve_caps(tsk, new);
-+
-+ write_lock_irq(&tasklist_lock);
-+ VE_TASK_INFO(tsk)->owner_env = new;
-+ VE_TASK_INFO(tsk)->exec_env = new;
-+ REMOVE_VE_LINKS(tsk);
-+ SET_VE_LINKS(tsk);
-+
-+ atomic_dec(&old->pcounter);
-+ atomic_inc(&new->pcounter);
-+ real_put_ve(old);
-+ get_ve(new);
-+ write_unlock_irq(&tasklist_lock);
-+}
-+
-+#if (defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)) && \
-+ defined(CONFIG_NETFILTER) && defined(CONFIG_VE_IPTABLES)
-+extern int init_netfilter(void);
-+extern void fini_netfilter(void);
-+#define init_ve_netfilter() init_netfilter()
-+#define fini_ve_netfilter() fini_netfilter()
-+#else
-+#define init_ve_netfilter() (0)
-+#define fini_ve_netfilter() do { } while (0)
-+#endif
-+
-+#define KSYMIPTINIT(mask, ve, full_mask, mod, name, args) \
-+({ \
-+ int ret = 0; \
-+ if (VE_IPT_CMP(mask, full_mask) && \
-+ VE_IPT_CMP((ve)->_iptables_modules, \
-+ full_mask & ~(full_mask##_MOD))) { \
-+ ret = KSYMERRCALL(1, mod, name, args); \
-+ if (ret == 0) \
-+ (ve)->_iptables_modules |= \
-+ full_mask##_MOD; \
-+ if (ret == 1) \
-+ ret = 0; \
-+ } \
-+ ret; \
-+})
-+
-+#define KSYMIPTFINI(mask, full_mask, mod, name, args) \
-+({ \
-+ if (VE_IPT_CMP(mask, full_mask##_MOD)) \
-+ KSYMSAFECALL_VOID(mod, name, args); \
-+})
-+
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static int do_ve_iptables(struct ve_struct *ve, __u64 init_mask,
-+ int init_or_cleanup)
-+{
-+ int err;
-+
-+ err = 0;
-+ if (!init_or_cleanup)
-+ goto cleanup;
-+
-+ /* init part */
-+#if defined(CONFIG_IP_NF_IPTABLES) || \
-+ defined(CONFIG_IP_NF_IPTABLES_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_IPTABLES,
-+ ip_tables, init_iptables, ());
-+ if (err < 0)
-+ goto err_iptables;
-+#endif
-+#if defined(CONFIG_IP_NF_CONNTRACK) || \
-+ defined(CONFIG_IP_NF_CONNTRACK_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_CONNTRACK,
-+ ip_conntrack, init_iptable_conntrack, ());
-+ if (err < 0)
-+ goto err_iptable_conntrack;
-+#endif
-+#if defined(CONFIG_IP_NF_FTP) || \
-+ defined(CONFIG_IP_NF_FTP_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_CONNTRACK_FTP,
-+ ip_conntrack_ftp, init_iptable_ftp, ());
-+ if (err < 0)
-+ goto err_iptable_ftp;
-+#endif
-+#if defined(CONFIG_IP_NF_IRC) || \
-+ defined(CONFIG_IP_NF_IRC_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_CONNTRACK_IRC,
-+ ip_conntrack_irc, init_iptable_irc, ());
-+ if (err < 0)
-+ goto err_iptable_irc;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_CONNTRACK) || \
-+ defined(CONFIG_IP_NF_MATCH_CONNTRACK_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_CONNTRACK,
-+ ipt_conntrack, init_iptable_conntrack_match, ());
-+ if (err < 0)
-+ goto err_iptable_conntrack_match;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_STATE) || \
-+ defined(CONFIG_IP_NF_MATCH_STATE_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_STATE,
-+ ipt_state, init_iptable_state, ());
-+ if (err < 0)
-+ goto err_iptable_state;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_HELPER) || \
-+ defined(CONFIG_IP_NF_MATCH_HELPER_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_HELPER,
-+ ipt_helper, init_iptable_helper, ());
-+ if (err < 0)
-+ goto err_iptable_helper;
-+#endif
-+#if defined(CONFIG_IP_NF_NAT) || \
-+ defined(CONFIG_IP_NF_NAT_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_NAT,
-+ iptable_nat, init_iptable_nat, ());
-+ if (err < 0)
-+ goto err_iptable_nat;
-+#endif
-+#if defined(CONFIG_IP_NF_NAT_FTP) || \
-+ defined(CONFIG_IP_NF_NAT_FTP_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_NAT_FTP,
-+ ip_nat_ftp, init_iptable_nat_ftp, ());
-+ if (err < 0)
-+ goto err_iptable_nat_ftp;
-+#endif
-+#if defined(CONFIG_IP_NF_NAT_IRC) || \
-+ defined(CONFIG_IP_NF_NAT_IRC_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_NAT_IRC,
-+ ip_nat_irc, init_iptable_nat_irc, ());
-+ if (err < 0)
-+ goto err_iptable_nat_irc;
-+#endif
-+#if defined(CONFIG_IP_NF_FILTER) || \
-+ defined(CONFIG_IP_NF_FILTER_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_FILTER,
-+ iptable_filter, init_iptable_filter, ());
-+ if (err < 0)
-+ goto err_iptable_filter;
-+#endif
-+#if defined(CONFIG_IP_NF_MANGLE) || \
-+ defined(CONFIG_IP_NF_MANGLE_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MANGLE,
-+ iptable_mangle, init_iptable_mangle, ());
-+ if (err < 0)
-+ goto err_iptable_mangle;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_LIMIT) || \
-+ defined(CONFIG_IP_NF_MATCH_LIMIT_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_LIMIT,
-+ ipt_limit, init_iptable_limit, ());
-+ if (err < 0)
-+ goto err_iptable_limit;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_MULTIPORT) || \
-+ defined(CONFIG_IP_NF_MATCH_MULTIPORT_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_MULTIPORT,
-+ ipt_multiport, init_iptable_multiport, ());
-+ if (err < 0)
-+ goto err_iptable_multiport;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TOS) || \
-+ defined(CONFIG_IP_NF_MATCH_TOS_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_TOS,
-+ ipt_tos, init_iptable_tos, ());
-+ if (err < 0)
-+ goto err_iptable_tos;
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_TOS) || \
-+ defined(CONFIG_IP_NF_TARGET_TOS_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_TARGET_TOS,
-+ ipt_TOS, init_iptable_TOS, ());
-+ if (err < 0)
-+ goto err_iptable_TOS;
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_REJECT) || \
-+ defined(CONFIG_IP_NF_TARGET_REJECT_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_TARGET_REJECT,
-+ ipt_REJECT, init_iptable_REJECT, ());
-+ if (err < 0)
-+ goto err_iptable_REJECT;
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_TCPMSS) || \
-+ defined(CONFIG_IP_NF_TARGET_TCPMSS_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_TARGET_TCPMSS,
-+ ipt_TCPMSS, init_iptable_TCPMSS, ());
-+ if (err < 0)
-+ goto err_iptable_TCPMSS;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TCPMSS) || \
-+ defined(CONFIG_IP_NF_MATCH_TCPMSS_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_TCPMSS,
-+ ipt_tcpmss, init_iptable_tcpmss, ());
-+ if (err < 0)
-+ goto err_iptable_tcpmss;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TTL) || \
-+ defined(CONFIG_IP_NF_MATCH_TTL_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_TTL,
-+ ipt_ttl, init_iptable_ttl, ());
-+ if (err < 0)
-+ goto err_iptable_ttl;
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_LOG) || \
-+ defined(CONFIG_IP_NF_TARGET_LOG_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_TARGET_LOG,
-+ ipt_LOG, init_iptable_LOG, ());
-+ if (err < 0)
-+ goto err_iptable_LOG;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_LENGTH) || \
-+ defined(CONFIG_IP_NF_MATCH_LENGTH_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_LENGTH,
-+ ipt_length, init_iptable_length, ());
-+ if (err < 0)
-+ goto err_iptable_length;
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_REDIRECT) || \
-+ defined(CONFIG_IP_NF_TARGET_REDIRECT_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_TARGET_REDIRECT,
-+ ipt_REDIRECT, init_iptable_REDIRECT, ());
-+ if (err < 0)
-+ goto err_iptable_REDIRECT;
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_OWNER) || \
-+ defined(CONFIG_IP_NF_MATCH_OWNER_MODULE)
-+ err = KSYMIPTINIT(init_mask, ve, VE_IP_MATCH_OWNER,
-+ ipt_owner, init_iptable_owner, ());
-+ if (err < 0)
-+ goto err_iptable_owner;
-+#endif
-+ return 0;
-+
-+/* ------------------------------------------------------------------------- */
-+
-+cleanup:
-+#if defined(CONFIG_IP_NF_MATCH_OWNER) || \
-+ defined(CONFIG_IP_NF_MATCH_OWNER_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_OWNER,
-+ ipt_owner, fini_iptable_owner, ());
-+err_iptable_owner:
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_REDIRECT) || \
-+ defined(CONFIG_IP_NF_TARGET_REDIRECT_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_TARGET_REDIRECT,
-+ ipt_REDIRECT, fini_iptable_REDIRECT, ());
-+err_iptable_REDIRECT:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_LENGTH) || \
-+ defined(CONFIG_IP_NF_MATCH_LENGTH_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_LENGTH,
-+ ipt_length, fini_iptable_length, ());
-+err_iptable_length:
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_LOG) || \
-+ defined(CONFIG_IP_NF_TARGET_LOG_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_TARGET_LOG,
-+ ipt_LOG, fini_iptable_LOG, ());
-+err_iptable_LOG:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TTL) || \
-+ defined(CONFIG_IP_NF_MATCH_TTL_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_TTL,
-+ ipt_ttl, fini_iptable_ttl, ());
-+err_iptable_ttl:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TCPMSS) || \
-+ defined(CONFIG_IP_NF_MATCH_TCPMSS_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_TCPMSS,
-+ ipt_tcpmss, fini_iptable_tcpmss, ());
-+err_iptable_tcpmss:
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_TCPMSS) || \
-+ defined(CONFIG_IP_NF_TARGET_TCPMSS_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_TARGET_TCPMSS,
-+ ipt_TCPMSS, fini_iptable_TCPMSS, ());
-+err_iptable_TCPMSS:
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_REJECT) || \
-+ defined(CONFIG_IP_NF_TARGET_REJECT_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_TARGET_REJECT,
-+ ipt_REJECT, fini_iptable_REJECT, ());
-+err_iptable_REJECT:
-+#endif
-+#if defined(CONFIG_IP_NF_TARGET_TOS) || \
-+ defined(CONFIG_IP_NF_TARGET_TOS_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_TARGET_TOS,
-+ ipt_TOS, fini_iptable_TOS, ());
-+err_iptable_TOS:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_TOS) || \
-+ defined(CONFIG_IP_NF_MATCH_TOS_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_TOS,
-+ ipt_tos, fini_iptable_tos, ());
-+err_iptable_tos:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_MULTIPORT) || \
-+ defined(CONFIG_IP_NF_MATCH_MULTIPORT_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_MULTIPORT,
-+ ipt_multiport, fini_iptable_multiport, ());
-+err_iptable_multiport:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_LIMIT) || \
-+ defined(CONFIG_IP_NF_MATCH_LIMIT_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_LIMIT,
-+ ipt_limit, fini_iptable_limit, ());
-+err_iptable_limit:
-+#endif
-+#if defined(CONFIG_IP_NF_MANGLE) || \
-+ defined(CONFIG_IP_NF_MANGLE_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MANGLE,
-+ iptable_mangle, fini_iptable_mangle, ());
-+err_iptable_mangle:
-+#endif
-+#if defined(CONFIG_IP_NF_FILTER) || \
-+ defined(CONFIG_IP_NF_FILTER_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_FILTER,
-+ iptable_filter, fini_iptable_filter, ());
-+err_iptable_filter:
-+#endif
-+#if defined(CONFIG_IP_NF_NAT_IRC) || \
-+ defined(CONFIG_IP_NF_NAT_IRC_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_NAT_IRC,
-+ ip_nat_irc, fini_iptable_nat_irc, ());
-+err_iptable_nat_irc:
-+#endif
-+#if defined(CONFIG_IP_NF_NAT_FTP) || \
-+ defined(CONFIG_IP_NF_NAT_FTP_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_NAT_FTP,
-+ ip_nat_ftp, fini_iptable_nat_ftp, ());
-+err_iptable_nat_ftp:
-+#endif
-+#if defined(CONFIG_IP_NF_NAT) || \
-+ defined(CONFIG_IP_NF_NAT_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_NAT,
-+ iptable_nat, fini_iptable_nat, ());
-+err_iptable_nat:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_HELPER) || \
-+ defined(CONFIG_IP_NF_MATCH_HELPER_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_HELPER,
-+ ipt_helper, fini_iptable_helper, ());
-+err_iptable_helper:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_STATE) || \
-+ defined(CONFIG_IP_NF_MATCH_STATE_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_STATE,
-+ ipt_state, fini_iptable_state, ());
-+err_iptable_state:
-+#endif
-+#if defined(CONFIG_IP_NF_MATCH_CONNTRACK) || \
-+ defined(CONFIG_IP_NF_MATCH_CONNTRACK_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MATCH_CONNTRACK,
-+ ipt_conntrack, fini_iptable_conntrack_match, ());
-+err_iptable_conntrack_match:
-+#endif
-+#if defined(CONFIG_IP_NF_IRC) || \
-+ defined(CONFIG_IP_NF_IRC_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_CONNTRACK_IRC,
-+ ip_conntrack_irc, fini_iptable_irc, ());
-+err_iptable_irc:
-+#endif
-+#if defined(CONFIG_IP_NF_FTP) || \
-+ defined(CONFIG_IP_NF_FTP_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_CONNTRACK_FTP,
-+ ip_conntrack_ftp, fini_iptable_ftp, ());
-+err_iptable_ftp:
-+#endif
-+#if defined(CONFIG_IP_NF_CONNTRACK) || \
-+ defined(CONFIG_IP_NF_CONNTRACK_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_CONNTRACK,
-+ ip_conntrack, fini_iptable_conntrack, ());
-+err_iptable_conntrack:
-+#endif
-+#if defined(CONFIG_IP_NF_IPTABLES) || \
-+ defined(CONFIG_IP_NF_IPTABLES_MODULE)
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_IPTABLES,
-+ ip_tables, fini_iptables, ());
-+err_iptables:
-+#endif
-+ ve->_iptables_modules = 0;
-+
-+ return err;
-+}
-+#else
-+#define do_ve_iptables(ve, initmask, init) (0)
-+#endif
-+
-+static inline int init_ve_iptables(struct ve_struct *ve, __u64 init_mask)
-+{
-+ return do_ve_iptables(ve, init_mask, 1);
-+}
-+
-+static inline void fini_ve_iptables(struct ve_struct *ve, __u64 init_mask)
-+{
-+ (void)do_ve_iptables(ve, init_mask, 0);
-+}
-+
-+static void flush_ve_iptables(struct ve_struct *ve)
-+{
-+ /*
-+ * flush all rule tables first,
-+ * this helps us to avoid refs to freed objs
-+ */
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_MANGLE, ip_tables,
-+ ipt_flush_table, (ve->_ipt_mangle_table));
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_FILTER, ip_tables,
-+ ipt_flush_table, (ve->_ve_ipt_filter_pf));
-+ KSYMIPTFINI(ve->_iptables_modules, VE_IP_NAT, ip_tables,
-+ ipt_flush_table, (ve->_ip_conntrack->_ip_nat_table));
-+}
-+
-+static struct list_head ve_hooks[VE_MAX_HOOKS];
-+static DECLARE_RWSEM(ve_hook_sem);
-+
-+int ve_hook_register(struct ve_hook *vh)
-+{
-+ struct list_head *lh;
-+ struct ve_hook *tmp;
-+
-+ down_write(&ve_hook_sem);
-+ list_for_each(lh, &ve_hooks[vh->hooknum]) {
-+ tmp = list_entry(lh, struct ve_hook, list);
-+ if (vh->priority < tmp->priority)
-+ break;
-+ }
-+ list_add_tail(&vh->list, lh);
-+ up_write(&ve_hook_sem);
-+ return 0;
-+}
-+EXPORT_SYMBOL(ve_hook_register);
-+
-+void ve_hook_unregister(struct ve_hook *vh)
-+{
-+ down_write(&ve_hook_sem);
-+ list_del(&vh->list);
-+ up_write(&ve_hook_sem);
-+}
-+EXPORT_SYMBOL(ve_hook_unregister);
-+
-+static int ve_hook_iterate(unsigned int hooknum, void *data)
-+{
-+ struct ve_hook *vh;
-+ int err;
-+
-+ err = 0;
-+ down_read(&ve_hook_sem);
-+ list_for_each_entry(vh, &ve_hooks[hooknum], list) {
-+ if (!try_module_get(vh->owner))
-+ continue;
-+ err = vh->hook(hooknum, data);
-+ module_put(vh->owner);
-+ if (err)
-+ break;
-+ }
-+
-+ if (err) {
-+ list_for_each_entry_continue_reverse(vh,
-+ &ve_hooks[hooknum], list) {
-+ if (!try_module_get(vh->owner))
-+ continue;
-+ if (vh->undo)
-+ vh->undo(hooknum, data);
-+ module_put(vh->owner);
-+ }
-+ }
-+ up_read(&ve_hook_sem);
-+ return err;
-+}
-+
-+static void ve_hook_iterate_cleanup(unsigned int hooknum, void *data)
-+{
-+ struct ve_hook *vh;
-+
-+ down_read(&ve_hook_sem);
-+ list_for_each_entry_reverse(vh, &ve_hooks[hooknum], list) {
-+ if (!try_module_get(vh->owner))
-+ continue;
-+ (void)vh->hook(hooknum, data);
-+ module_put(vh->owner);
-+ }
-+ up_read(&ve_hook_sem);
-+}
-+
-+static int do_env_create(envid_t veid, unsigned int flags, u32 class_id,
-+ env_create_param_t *data, int datalen)
-+{
-+ struct task_struct *tsk;
-+ struct ve_struct *old;
-+ struct ve_struct *old_exec;
-+ struct ve_struct *ve;
-+ __u64 init_mask;
-+ int err;
-+
-+ tsk = current;
-+ old = VE_TASK_INFO(tsk)->owner_env;
-+
-+ if (!thread_group_leader(tsk))
-+ return -EINVAL;
-+
-+ if (tsk->signal->tty) {
-+ printk("ERR: VE init has controlling terminal\n");
-+ return -EINVAL;
-+ }
-+ if (tsk->signal->pgrp != tsk->pid || tsk->signal->session != tsk->pid) {
-+ int may_setsid;
-+ read_lock(&tasklist_lock);
-+ may_setsid = (find_pid(PIDTYPE_PGID, tsk->pid) == NULL);
-+ read_unlock(&tasklist_lock);
-+ if (!may_setsid) {
-+ printk("ERR: VE init is process group leader\n");
-+ return -EINVAL;
-+ }
-+ }
-+
-+
-+ VZTRACE("%s: veid=%d classid=%d pid=%d\n",
-+ __FUNCTION__, veid, class_id, current->pid);
-+
-+ err = -ENOMEM;
-+ ve = kmalloc(sizeof(struct ve_struct), GFP_KERNEL);
-+ if (ve == NULL)
-+ goto err_struct;
-+
-+ init_ve_struct(ve, veid, class_id, data, tsk);
-+ __module_get(THIS_MODULE);
-+ down_write(&ve->op_sem);
-+ if (flags & VE_LOCK)
-+ ve->is_locked = 1;
-+ if ((err = ve_list_add(ve)) < 0)
-+ goto err_exist;
-+
-+ /* this should be done before context switching */
-+ if ((err = init_printk(ve)) < 0)
-+ goto err_log_wait;
-+
-+ old_exec = set_exec_env(ve);
-+
-+ if ((err = init_ve_sched(ve, data->total_vcpus)) < 0)
-+ goto err_sched;
-+
-+ /* move user to VE */
-+ if ((err = set_user(0, 0)) < 0)
-+ goto err_set_user;
-+
-+ set_ve_root(ve, tsk);
-+
-+ if ((err = init_ve_utsname(ve)))
-+ goto err_utsname;
-+
-+ if ((err = init_ve_mibs(ve)))
-+ goto err_mibs;
-+
-+ if ((err = init_ve_proc(ve)))
-+ goto err_proc;
-+
-+ if ((err = init_ve_sysctl(ve)))
-+ goto err_sysctl;
-+
-+ if ((err = init_ve_sysfs(ve)))
-+ goto err_sysfs;
-+
-+ if ((err = ve_arp_init(ve)) < 0)
-+ goto err_dev;
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+ if ((err = ve_ndisc_init(ve)) < 0)
-+ goto err_dev;
-+#endif
-+
-+ if ((err = init_ve_netdev()))
-+ goto err_dev;
-+
-+ if ((err = init_ve_tty_drivers(ve)) < 0)
-+ goto err_tty;
-+
-+ if ((err = init_ve_shmem(ve)))
-+ goto err_shmem;
-+
-+ if ((err = init_ve_devpts(ve)))
-+ goto err_devpts;
-+
-+ if((err = init_ve_meminfo(ve)))
-+ goto err_meminf;
-+
-+ /* init SYSV IPC variables */
-+ if ((err = init_ve_ipc(ve)) < 0)
-+ goto err_ipc;
-+
-+ set_ve_caps(ve, tsk);
-+
-+ /* It is safe to initialize netfilter here as routing initialization and
-+ interface setup will be done below. This means that NO skb can be
-+ passed inside. Den */
-+ /* iptables ve initialization for non ve0;
-+ ve0 init is in module_init */
-+ if ((err = init_ve_netfilter()) < 0)
-+ goto err_netfilter;
-+
-+ init_mask = data ? data->iptables_mask : VE_IP_DEFAULT;
-+ if ((err = init_ve_iptables(ve, init_mask)) < 0)
-+ goto err_iptables;
-+
-+ if ((err = init_ve_route(ve)) < 0)
-+ goto err_route;
-+
-+ if ((err = alloc_vpid(tsk->pid, 1)) < 0)
-+ goto err_vpid;
-+
-+ if ((err = ve_hook_iterate(VE_HOOK_INIT, (void *)ve)) < 0)
-+ goto err_ve_hook;
-+
-+ /* finally: set vpids and move inside */
-+ move_task(tsk, ve, old);
-+
-+ set_virt_pid(tsk, 1);
-+ set_virt_tgid(tsk, 1);
-+
-+ set_special_pids(tsk->pid, tsk->pid);
-+ current->signal->tty_old_pgrp = 0;
-+ set_virt_pgid(tsk, 1);
-+ set_virt_sid(tsk, 1);
-+
-+ ve->is_running = 1;
-+ up_write(&ve->op_sem);
-+
-+ printk(KERN_INFO "VPS: %d: started\n", veid);
-+ return veid;
-+
-+err_ve_hook:
-+ free_vpid(1, ve);
-+err_vpid:
-+ fini_venet(ve);
-+ fini_ve_route(ve);
-+err_route:
-+ fini_ve_iptables(ve, init_mask);
-+err_iptables:
-+ fini_ve_netfilter();
-+err_netfilter:
-+ fini_ve_ipc(ve);
-+err_ipc:
-+ fini_ve_meminfo(ve);
-+err_meminf:
-+ fini_ve_devpts(ve);
-+err_devpts:
-+ fini_ve_shmem(ve);
-+err_shmem:
-+ fini_ve_tty_drivers(ve);
-+err_tty:
-+ fini_ve_netdev();
-+err_dev:
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+ ve_ndisc_fini(ve);
-+#endif
-+ ve_arp_fini(ve);
-+ fini_ve_sysfs(ve);
-+err_sysfs:
-+ fini_ve_sysctl(ve);
-+err_sysctl:
-+ fini_ve_proc(ve);
-+err_proc:
-+ do_clean_devperms(ve->veid); /* register procfs adds devperms */
-+ fini_ve_mibs(ve);
-+err_mibs:
-+ /* free_ve_utsname() is called inside real_put_ve() */ ;
-+err_utsname:
-+ /* It is safe to restore current->envid here because
-+ * ve_fairsched_detach does not use current->envid. */
-+ /* Really fairsched code uses current->envid in sys_fairsched_mknod
-+ * only. It is correct if sys_fairsched_mknod is called from
-+ * userspace. If sys_fairsched_mknod is called from
-+ * ve_fairsched_attach, then node->envid and node->parent_node->envid
-+ * are explicitly set to valid value after the call. */
-+ /* FIXME */
-+ VE_TASK_INFO(tsk)->owner_env = old;
-+ VE_TASK_INFO(tsk)->exec_env = old_exec;
-+ /* move user back */
-+ if (set_user(0, 0) < 0)
-+ printk(KERN_WARNING"Can't restore UID\n");
-+
-+err_set_user:
-+ fini_ve_sched(ve);
-+err_sched:
-+ (void)set_exec_env(old_exec);
-+
-+ /* we can jump here having incorrect envid */
-+ VE_TASK_INFO(tsk)->owner_env = old;
-+ fini_printk(ve);
-+err_log_wait:
-+ ve_list_del(ve);
-+ up_write(&ve->op_sem);
-+
-+ real_put_ve(ve);
-+err_struct:
-+ printk(KERN_INFO "VPS: %d: failed to start with err=%d\n", veid, err);
-+ return err;
-+
-+err_exist:
-+ kfree(ve);
-+ goto err_struct;
-+}
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * VE start/stop callbacks
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+int real_env_create(envid_t veid, unsigned flags, u32 class_id,
-+ env_create_param_t *data, int datalen)
-+{
-+ int status;
-+ struct ve_struct *ve;
-+
-+ if (!flags) {
-+ status = get_exec_env()->veid;
-+ goto out;
-+ }
-+
-+ status = -EPERM;
-+ if (!capable(CAP_SETVEID))
-+ goto out;
-+
-+ status = -EINVAL;
-+ if ((flags & VE_TEST) && (flags & (VE_ENTER|VE_CREATE)))
-+ goto out;
-+
-+ status = -EINVAL;
-+ ve = get_ve_by_id(veid);
-+ if (ve) {
-+ if (flags & VE_TEST) {
-+ status = 0;
-+ goto out_put;
-+ }
-+ if (flags & VE_EXCLUSIVE) {
-+ status = -EACCES;
-+ goto out_put;
-+ }
-+ if (flags & VE_CREATE) {
-+ flags &= ~VE_CREATE;
-+ flags |= VE_ENTER;
-+ }
-+ } else {
-+ if (flags & (VE_TEST|VE_ENTER)) {
-+ status = -ESRCH;
-+ goto out;
-+ }
-+ }
-+
-+ if (flags & VE_CREATE) {
-+ status = do_env_create(veid, flags, class_id, data, datalen);
-+ goto out;
-+ } else if (flags & VE_ENTER)
-+ status = do_env_enter(ve, flags);
-+
-+ /* else: returning EINVAL */
-+
-+out_put:
-+ real_put_ve(ve);
-+out:
-+ return status;
-+}
-+
-+static int do_env_enter(struct ve_struct *ve, unsigned int flags)
-+{
-+ struct task_struct *tsk = current;
-+ int err;
-+
-+ VZTRACE("%s: veid=%d\n", __FUNCTION__, ve->veid);
-+
-+ err = -EBUSY;
-+ down_read(&ve->op_sem);
-+ if (!ve->is_running)
-+ goto out_up;
-+ if (ve->is_locked && !(flags & VE_SKIPLOCK))
-+ goto out_up;
-+
-+#ifdef CONFIG_FAIRSCHED
-+ err = sys_fairsched_mvpr(current->pid, ve->veid);
-+ if (err)
-+ goto out_up;
-+#endif
-+
-+ ve_sched_attach(ve);
-+ move_task(current, ve, VE_TASK_INFO(tsk)->owner_env);
-+ err = VE_TASK_INFO(tsk)->owner_env->veid;
-+
-+out_up:
-+ up_read(&ve->op_sem);
-+ return err;
-+}
-+
-+static void env_cleanup(struct ve_struct *ve)
-+{
-+ struct ve_struct *old_ve;
-+
-+ VZTRACE("real_do_env_cleanup\n");
-+
-+ down_read(&ve->op_sem);
-+ old_ve = set_exec_env(ve);
-+
-+ ve_hook_iterate_cleanup(VE_HOOK_FINI, (void *)ve);
-+
-+ fini_venet(ve);
-+
-+ /* no new packets in flight beyond this point */
-+ synchronize_net();
-+ /* skb hold dst_entry, and in turn lies in the ip fragment queue */
-+ ip_fragment_cleanup(ve);
-+
-+ fini_ve_netdev();
-+ fini_ve_route(ve);
-+ ve_arp_fini(ve);
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+ ve_ndisc_fini(ve);
-+#endif
-+
-+ /* kill iptables */
-+ /* No skb belonging to VE can exist at this point as unregister_netdev
-+ is an operation awaiting until ALL skb's gone */
-+ flush_ve_iptables(ve);
-+ fini_ve_iptables(ve, ve->_iptables_modules);
-+ fini_ve_netfilter();
-+
-+ ve_ipc_cleanup();
-+
-+ fini_ve_sched(ve);
-+ do_clean_devperms(ve->veid);
-+
-+ fini_ve_devpts(ve);
-+ fini_ve_shmem(ve);
-+ fini_ve_sysfs(ve);
-+ unregister_ve_tty_drivers(ve);
-+ fini_ve_sysctl(ve);
-+ fini_ve_proc(ve);
-+ fini_ve_meminfo(ve);
-+
-+ fini_ve_mibs(ve);
-+
-+ (void)set_exec_env(old_ve);
-+ fini_printk(ve); /* no printk can happen in ve context anymore */
-+
-+ ve_list_del(ve);
-+ up_read(&ve->op_sem);
-+
-+ real_put_ve(ve);
-+}
-+
-+static struct list_head ve_cleanup_list;
-+static spinlock_t ve_cleanup_lock;
-+
-+static DECLARE_COMPLETION(vzmond_complete);
-+static struct task_struct *vzmond_thread;
-+static volatile int stop_vzmond;
-+
-+void real_do_env_cleanup(struct ve_struct *ve)
-+{
-+ spin_lock(&ve_cleanup_lock);
-+ list_add_tail(&ve->cleanup_list, &ve_cleanup_list);
-+ spin_unlock(&ve_cleanup_lock);
-+ wake_up_process(vzmond_thread);
-+}
-+
-+static int vzmond_helper(void *arg)
-+{
-+ char name[18];
-+ struct ve_struct *ve;
-+
-+ ve = (struct ve_struct *)arg;
-+ snprintf(name, sizeof(name), "vzmond/%d", ve->veid);
-+ daemonize(name);
-+ env_cleanup(ve);
-+ module_put_and_exit(0);
-+}
-+
-+static void do_pending_env_cleanups(void)
-+{
-+ int err;
-+ struct ve_struct *ve;
-+
-+ spin_lock(&ve_cleanup_lock);
-+ while (1) {
-+ if (list_empty(&ve_cleanup_list) || need_resched())
-+ break;
-+
-+ ve = list_first_entry(&ve_cleanup_list, struct ve_struct,
-+ cleanup_list);
-+ list_del(&ve->cleanup_list);
-+ spin_unlock(&ve_cleanup_lock);
-+
-+ __module_get(THIS_MODULE);
-+ err = kernel_thread(vzmond_helper, (void *)ve, 0);
-+ if (err < 0) {
-+ env_cleanup(ve);
-+ module_put(THIS_MODULE);
-+ }
-+
-+ spin_lock(&ve_cleanup_lock);
-+ }
-+ spin_unlock(&ve_cleanup_lock);
-+}
-+
-+static inline int have_pending_cleanups(void)
-+{
-+ return !list_empty(&ve_cleanup_list);
-+}
-+
-+static int vzmond(void *arg)
-+{
-+ daemonize("vzmond");
-+ vzmond_thread = current;
-+ set_current_state(TASK_INTERRUPTIBLE);
-+
-+ while (!stop_vzmond || have_pending_cleanups()) {
-+ schedule();
-+ if (signal_pending(current))
-+ flush_signals(current);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-+
-+ do_pending_env_cleanups();
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ if (have_pending_cleanups())
-+ __set_current_state(TASK_RUNNING);
-+ }
-+
-+ __set_task_state(current, TASK_RUNNING);
-+ complete_and_exit(&vzmond_complete, 0);
-+}
-+
-+static int __init init_vzmond(void)
-+{
-+ INIT_LIST_HEAD(&ve_cleanup_list);
-+ spin_lock_init(&ve_cleanup_lock);
-+ stop_vzmond = 0;
-+ return kernel_thread(vzmond, NULL, 0);
-+}
-+
-+static void fini_vzmond(void)
-+{
-+ stop_vzmond = 1;
-+ wake_up_process(vzmond_thread);
-+ wait_for_completion(&vzmond_complete);
-+ WARN_ON(!list_empty(&ve_cleanup_list));
-+}
-+
-+void real_do_env_free(struct ve_struct *ve)
-+{
-+ VZTRACE("real_do_env_free\n");
-+
-+ ve_ipc_free(ve); /* free SYSV IPC resources */
-+ free_ve_tty_drivers(ve);
-+ free_ve_utsname(ve);
-+ free_ve_sysctl(ve); /* free per ve sysctl data */
-+ free_ve_filesystems(ve);
-+ printk(KERN_INFO "VPS: %d: stopped\n", VEID(ve));
-+ kfree(ve);
-+
-+ module_put(THIS_MODULE);
-+}
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * VE TTY handling
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+DCL_VE_OWNER(TTYDRV, TAIL_SOFT, struct tty_driver, owner_env, , ())
-+
-+static struct tty_driver *alloc_ve_tty_driver(struct tty_driver *base,
-+ struct ve_struct *ve)
-+{
-+ size_t size;
-+ struct tty_driver *driver;
-+
-+ driver = kmalloc(sizeof(struct tty_driver), GFP_KERNEL);
-+ if (!driver)
-+ goto out;
-+
-+ memcpy(driver, base, sizeof(struct tty_driver));
-+
-+ driver->driver_state = NULL;
-+
-+ size = base->num * 3 * sizeof(void *);
-+ if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM)) {
-+ void **p;
-+ p = kmalloc(size, GFP_KERNEL);
-+ if (!p)
-+ goto out_free;
-+ memset(p, 0, size);
-+ driver->ttys = (struct tty_struct **)p;
-+ driver->termios = (struct termios **)(p + driver->num);
-+ driver->termios_locked = (struct termios **)(p + driver->num * 2);
-+ } else {
-+ driver->ttys = NULL;
-+ driver->termios = NULL;
-+ driver->termios_locked = NULL;
-+ }
-+
-+ SET_VE_OWNER_TTYDRV(driver, ve);
-+ driver->flags |= TTY_DRIVER_INSTALLED;
-+
-+ return driver;
-+
-+out_free:
-+ kfree(driver);
-+out:
-+ return NULL;
-+}
-+
-+static void free_ve_tty_driver(struct tty_driver *driver)
-+{
-+ if (!driver)
-+ return;
-+
-+ clear_termios(driver);
-+ kfree(driver->ttys);
-+ kfree(driver);
-+}
-+
-+static int alloc_ve_tty_drivers(struct ve_struct* ve)
-+{
-+#ifdef CONFIG_LEGACY_PTYS
-+ extern struct tty_driver *get_pty_driver(void);
-+ extern struct tty_driver *get_pty_slave_driver(void);
-+
-+ /* Traditional BSD devices */
-+ ve->pty_driver = alloc_ve_tty_driver(get_pty_driver(), ve);
-+ if (!ve->pty_driver)
-+ goto out_mem;
-+
-+ ve->pty_slave_driver = alloc_ve_tty_driver(
-+ get_pty_slave_driver(), ve);
-+ if (!ve->pty_slave_driver)
-+ goto out_mem;
-+
-+ ve->pty_driver->other = ve->pty_slave_driver;
-+ ve->pty_slave_driver->other = ve->pty_driver;
-+#endif
-+
-+#ifdef CONFIG_UNIX98_PTYS
-+ ve->ptm_driver = alloc_ve_tty_driver(ptm_driver, ve);
-+ if (!ve->ptm_driver)
-+ goto out_mem;
-+
-+ ve->pts_driver = alloc_ve_tty_driver(pts_driver, ve);
-+ if (!ve->pts_driver)
-+ goto out_mem;
-+
-+ ve->ptm_driver->other = ve->pts_driver;
-+ ve->pts_driver->other = ve->ptm_driver;
-+
-+ ve->allocated_ptys = kmalloc(sizeof(*ve->allocated_ptys), GFP_KERNEL);
-+ if (!ve->allocated_ptys)
-+ goto out_mem;
-+ idr_init(ve->allocated_ptys);
-+#endif
-+ return 0;
-+
-+out_mem:
-+ free_ve_tty_drivers(ve);
-+ return -ENOMEM;
-+}
-+
-+static void free_ve_tty_drivers(struct ve_struct* ve)
-+{
-+#ifdef CONFIG_LEGACY_PTYS
-+ free_ve_tty_driver(ve->pty_driver);
-+ free_ve_tty_driver(ve->pty_slave_driver);
-+ ve->pty_driver = ve->pty_slave_driver = NULL;
-+#endif
-+#ifdef CONFIG_UNIX98_PTYS
-+ free_ve_tty_driver(ve->ptm_driver);
-+ free_ve_tty_driver(ve->pts_driver);
-+ kfree(ve->allocated_ptys);
-+ ve->ptm_driver = ve->pts_driver = NULL;
-+ ve->allocated_ptys = NULL;
-+#endif
-+}
-+
-+static inline void __register_tty_driver(struct tty_driver *driver)
-+{
-+ list_add(&driver->tty_drivers, &tty_drivers);
-+}
-+
-+static inline void __unregister_tty_driver(struct tty_driver *driver)
-+{
-+ if (!driver)
-+ return;
-+ list_del(&driver->tty_drivers);
-+}
-+
-+static int register_ve_tty_drivers(struct ve_struct* ve)
-+{
-+ write_lock_irq(&tty_driver_guard);
-+#ifdef CONFIG_UNIX98_PTYS
-+ __register_tty_driver(ve->ptm_driver);
-+ __register_tty_driver(ve->pts_driver);
-+#endif
-+#ifdef CONFIG_LEGACY_PTYS
-+ __register_tty_driver(ve->pty_driver);
-+ __register_tty_driver(ve->pty_slave_driver);
-+#endif
-+ write_unlock_irq(&tty_driver_guard);
-+
-+ return 0;
-+}
-+
-+static void unregister_ve_tty_drivers(struct ve_struct* ve)
-+{
-+ VZTRACE("unregister_ve_tty_drivers\n");
-+
-+ write_lock_irq(&tty_driver_guard);
-+ __unregister_tty_driver(ve->pty_driver);
-+ __unregister_tty_driver(ve->pty_slave_driver);
-+#ifdef CONFIG_UNIX98_PTYS
-+ __unregister_tty_driver(ve->ptm_driver);
-+ __unregister_tty_driver(ve->pts_driver);
-+#endif
-+ write_unlock_irq(&tty_driver_guard);
-+}
-+
-+static int init_ve_tty_drivers(struct ve_struct *ve)
-+{
-+ int err;
-+
-+ if ((err = alloc_ve_tty_drivers(ve)))
-+ goto err_ttyalloc;
-+ if ((err = register_ve_tty_drivers(ve)))
-+ goto err_ttyreg;
-+ return 0;
-+
-+err_ttyreg:
-+ free_ve_tty_drivers(ve);
-+err_ttyalloc:
-+ return err;
-+}
-+
-+static void fini_ve_tty_drivers(struct ve_struct *ve)
-+{
-+ unregister_ve_tty_drivers(ve);
-+ free_ve_tty_drivers(ve);
-+}
-+
-+/*
-+ * Free the termios and termios_locked structures because
-+ * we don't want to get memory leaks when modular tty
-+ * drivers are removed from the kernel.
-+ */
-+static void clear_termios(struct tty_driver *driver)
-+{
-+ int i;
-+ struct termios *tp;
-+
-+ if (driver->termios == NULL)
-+ return;
-+ for (i = 0; i < driver->num; i++) {
-+ tp = driver->termios[i];
-+ if (tp) {
-+ driver->termios[i] = NULL;
-+ kfree(tp);
-+ }
-+ tp = driver->termios_locked[i];
-+ if (tp) {
-+ driver->termios_locked[i] = NULL;
-+ kfree(tp);
-+ }
-+ }
-+}
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * Pieces of VE network
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#include <asm/uaccess.h>
-+#include <net/sock.h>
-+#include <linux/netlink.h>
-+#include <linux/rtnetlink.h>
-+#include <net/route.h>
-+#include <net/ip_fib.h>
-+#endif
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static void ve_del_ip_addrs(struct net_device *dev)
-+{
-+ struct in_device *in_dev;
-+
-+ in_dev = in_dev_get(dev);
-+ if (in_dev == NULL)
-+ return;
-+
-+ while (in_dev->ifa_list != NULL) {
-+ inet_del_ifa(in_dev, &in_dev->ifa_list, 1);
-+ }
-+ in_dev_put(in_dev);
-+}
-+
-+static int ve_netdev_cleanup(struct net_device *dev, int to_ve)
-+{
-+ int err;
-+
-+ err = 0;
-+ ve_del_ip_addrs(dev);
-+ if ((dev->flags & IFF_UP) != 0)
-+ err = dev_close(dev);
-+ synchronize_net();
-+ dev_shutdown(dev);
-+ dev_mc_discard(dev);
-+ free_divert_blk(dev);
-+ synchronize_net();
-+ return err;
-+}
-+
-+static void __ve_dev_move(struct net_device *dev, struct ve_struct *ve_src,
-+ struct ve_struct *ve_dst, struct user_beancounter *exec_ub)
-+{
-+ struct net_device **dp, *d;
-+ struct user_beancounter *ub;
-+ struct ve_struct *exec_ve;
-+
-+ for (d = ve_src->_net_dev_base, dp = NULL; d != NULL;
-+ dp = &d->next, d = d->next) {
-+ if (d == dev) {
-+ hlist_del(&dev->name_hlist);
-+ hlist_del(&dev->index_hlist);
-+ if (ve_src->_net_dev_tail == &dev->next)
-+ ve_src->_net_dev_tail = dp;
-+ if (dp)
-+ *dp = dev->next;
-+ dev->next = NULL;
-+ break;
-+ }
-+ }
-+
-+ *ve_dst->_net_dev_tail = dev;
-+ ve_dst->_net_dev_tail = &dev->next;
-+ hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name, ve_dst));
-+ hlist_add_head(&dev->index_hlist, dev_index_hash(dev->ifindex, ve_dst));
-+ dev->owner_env = ve_dst;
-+
-+ ub = netdev_bc(dev)->exec_ub;
-+ netdev_bc(dev)->exec_ub = get_beancounter(exec_ub);
-+ put_beancounter(ub);
-+
-+ write_unlock_bh(&dev_base_lock);
-+ exec_ve = set_exec_env(ve_src);
-+ netdevice_notify(NETDEV_UNREGISTER, dev);
-+ (void)set_exec_env(ve_dst);
-+ netdevice_notify(NETDEV_REGISTER, dev);
-+ (void)set_exec_env(exec_ve);
-+ write_lock_bh(&dev_base_lock);
-+}
-+
-+static int ve_dev_add(envid_t veid, char *dev_name)
-+{
-+ int err;
-+ struct net_device *dev;
-+ struct ve_struct *ve;
-+ struct hlist_node *p;
-+
-+ dev = NULL;
-+ err = -ESRCH;
-+
-+ ve = get_ve_by_id(veid);
-+ if (ve == NULL)
-+ goto out;
-+
-+ rtnl_lock();
-+
-+ read_lock(&dev_base_lock);
-+ hlist_for_each(p, dev_name_hash(dev_name, get_ve0())) {
-+ struct net_device *d = hlist_entry(p, struct net_device,
-+ name_hlist);
-+ if (strncmp(d->name, dev_name, IFNAMSIZ) == 0) {
-+ dev = d;
-+ break;
-+ }
-+ }
-+ read_unlock(&dev_base_lock);
-+ if (dev == NULL)
-+ goto out_unlock;
-+
-+ err = -EPERM;
-+ if (!ve_is_dev_movable(dev))
-+ goto out_unlock;
-+
-+ err = -EINVAL;
-+ if (dev->flags & (IFF_SLAVE|IFF_MASTER))
-+ goto out_unlock;
-+
-+ ve_netdev_cleanup(dev, 1);
-+
-+ write_lock_bh(&dev_base_lock);
-+ __ve_dev_move(dev, get_ve0(), ve, get_exec_ub());
-+ write_unlock_bh(&dev_base_lock);
-+
-+ err = 0;
-+
-+out_unlock:
-+ rtnl_unlock();
-+ real_put_ve(ve);
-+
-+ if (dev == NULL)
-+ printk(KERN_WARNING "Device %s not found\n", dev_name);
-+
-+out:
-+ return err;
-+}
-+
-+static int ve_dev_del(envid_t veid, char *dev_name)
-+{
-+ int err;
-+ struct net_device *dev;
-+ struct ve_struct *ve, *old_exec;
-+ struct hlist_node *p;
-+
-+ dev = NULL;
-+ err = -ESRCH;
-+
-+ ve = get_ve_by_id(veid);
-+ if (ve == NULL)
-+ goto out;
-+
-+ rtnl_lock();
-+
-+ read_lock(&dev_base_lock);
-+ hlist_for_each(p, dev_name_hash(dev_name, ve)) {
-+ struct net_device *d = hlist_entry(p, struct net_device,
-+ name_hlist);
-+ if (strncmp(d->name, dev_name, IFNAMSIZ) == 0) {
-+ dev = d;
-+ break;
-+ }
-+ }
-+ read_unlock(&dev_base_lock);
-+ if (dev == NULL)
-+ goto out_unlock;
-+
-+ err = -EPERM;
-+ if (!ve_is_dev_movable(dev))
-+ goto out_unlock;
-+
-+ old_exec = set_exec_env(ve);
-+ ve_netdev_cleanup(dev, 0);
-+ (void)set_exec_env(old_exec);
-+
-+ write_lock_bh(&dev_base_lock);
-+ __ve_dev_move(dev, ve, get_ve0(), netdev_bc(dev)->owner_ub);
-+ write_unlock_bh(&dev_base_lock);
-+
-+ err = 0;
-+
-+out_unlock:
-+ rtnl_unlock();
-+ real_put_ve(ve);
-+
-+ if (dev == NULL)
-+ printk(KERN_WARNING "Device %s not found\n", dev_name);
-+
-+out:
-+ return err;
-+}
-+
-+int real_ve_dev_map(envid_t veid, int op, char *dev_name)
-+{
-+ int err;
-+ err = -EPERM;
-+ if (!capable(CAP_SETVEID))
-+ goto out;
-+ switch (op)
-+ {
-+ case VE_NETDEV_ADD:
-+ err = ve_dev_add(veid, dev_name);
-+ break;
-+ case VE_NETDEV_DEL:
-+ err = ve_dev_del(veid, dev_name);
-+ break;
-+ default:
-+ err = -EINVAL;
-+ break;
-+ }
-+out:
-+ return err;
-+}
-+
-+static void ve_mapped_devs_cleanup(struct ve_struct *ve)
-+{
-+ struct net_device *dev;
-+
-+ rtnl_lock();
-+ write_lock_bh(&dev_base_lock);
-+restart:
-+ for (dev = ve->_net_dev_base; dev != NULL; dev = dev->next)
-+ {
-+ if ((dev->features & NETIF_F_VENET) ||
-+ (dev == ve->_loopback_dev)) /* Skip loopback dev */
-+ continue;
-+ write_unlock_bh(&dev_base_lock);
-+ ve_netdev_cleanup(dev, 0);
-+ write_lock_bh(&dev_base_lock);
-+ __ve_dev_move(dev, ve, get_ve0(), netdev_bc(dev)->owner_ub);
-+ goto restart;
-+ }
-+ write_unlock_bh(&dev_base_lock);
-+ rtnl_unlock();
-+}
-+#endif
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * VE information via /proc
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+#ifdef CONFIG_PROC_FS
-+static int devperms_seq_show(struct seq_file *m, void *v)
-+{
-+ struct devperms_struct *dp;
-+ char dev_s[32], type_c;
-+ unsigned use, type;
-+ dev_t dev;
-+
-+ dp = (struct devperms_struct *)v;
-+ if (dp == (struct devperms_struct *)1L) {
-+ seq_printf(m, "Version: 2.7\n");
-+ return 0;
-+ }
-+
-+ use = dp->type & VE_USE_MASK;
-+ type = dp->type & S_IFMT;
-+ dev = dp->dev;
-+
-+ if ((use | VE_USE_MINOR) == use)
-+ snprintf(dev_s, sizeof(dev_s), "%d:%d", MAJOR(dev), MINOR(dev));
-+ else if ((use | VE_USE_MAJOR) == use)
-+ snprintf(dev_s, sizeof(dev_s), "%d:*", MAJOR(dp->dev));
-+ else
-+ snprintf(dev_s, sizeof(dev_s), "*:*");
-+
-+ if (type == S_IFCHR)
-+ type_c = 'c';
-+ else if (type == S_IFBLK)
-+ type_c = 'b';
-+ else
-+ type_c = '?';
-+
-+ seq_printf(m, "%10u %c %03o %s\n", dp->veid, type_c, dp->mask, dev_s);
-+ return 0;
-+}
-+
-+static void *devperms_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ loff_t cpos;
-+ long slot;
-+ struct devperms_struct *dp;
-+
-+ cpos = *pos;
-+ read_lock(&devperms_hash_guard);
-+ if (cpos-- == 0)
-+ return (void *)1L;
-+
-+ for (slot = 0; slot < DEVPERMS_HASH_SZ; slot++)
-+ for (dp = devperms_hash[slot]; dp; dp = dp->devhash_next)
-+ if (cpos-- == 0) {
-+ m->private = (void *)slot;
-+ return dp;
-+ }
-+ return NULL;
-+}
-+
-+static void *devperms_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ long slot;
-+ struct devperms_struct *dp;
-+
-+ dp = (struct devperms_struct *)v;
-+
-+ if (dp == (struct devperms_struct *)1L)
-+ slot = 0;
-+ else if (dp->devhash_next == NULL)
-+ slot = (long)m->private + 1;
-+ else {
-+ (*pos)++;
-+ return dp->devhash_next;
-+ }
-+
-+ for (; slot < DEVPERMS_HASH_SZ; slot++)
-+ if (devperms_hash[slot]) {
-+ (*pos)++;
-+ m->private = (void *)slot;
-+ return devperms_hash[slot];
-+ }
-+ return NULL;
-+}
-+
-+static void devperms_seq_stop(struct seq_file *m, void *v)
-+{
-+ read_unlock(&devperms_hash_guard);
-+}
-+
-+static struct seq_operations devperms_seq_op = {
-+ .start = devperms_seq_start,
-+ .next = devperms_seq_next,
-+ .stop = devperms_seq_stop,
-+ .show = devperms_seq_show,
-+};
-+
-+static int devperms_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &devperms_seq_op);
-+}
-+
-+static struct file_operations proc_devperms_ops = {
-+ .open = devperms_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
-+};
-+
-+#if BITS_PER_LONG == 32
-+#define VESTAT_LINE_WIDTH (6 * 11 + 6 * 21)
-+#define VESTAT_LINE_FMT "%10u %10lu %10lu %10lu %10Lu %20Lu %20Lu %20Lu %20Lu %20Lu %20Lu %10lu\n"
-+#define VESTAT_HEAD_FMT "%10s %10s %10s %10s %10s %20s %20s %20s %20s %20s %20s %10s\n"
-+#else
-+#define VESTAT_LINE_WIDTH (12 * 21)
-+#define VESTAT_LINE_FMT "%20u %20lu %20lu %20lu %20Lu %20Lu %20Lu %20Lu %20Lu %20Lu %20Lu %20lu\n"
-+#define VESTAT_HEAD_FMT "%20s %20s %20s %20s %20s %20s %20s %20s %20s %20s %20s %20s\n"
-+#endif
-+
-+static int vestat_seq_show(struct seq_file *m, void *v)
-+{
-+ struct ve_struct *ve = (struct ve_struct *)v;
-+ struct ve_struct *curve;
-+ int cpu;
-+ unsigned long user_ve, nice_ve, system_ve;
-+ unsigned long long uptime;
-+ cycles_t uptime_cycles, idle_time, strv_time, used;
-+
-+ curve = get_exec_env();
-+ if (ve == ve_list_head ||
-+ (!ve_is_super(curve) && ve == curve)) {
-+ /* print header */
-+ seq_printf(m, "%-*s\n",
-+ VESTAT_LINE_WIDTH - 1,
-+ "Version: 2.2");
-+ seq_printf(m, VESTAT_HEAD_FMT, "VEID",
-+ "user", "nice", "system",
-+ "uptime", "idle",
-+ "strv", "uptime", "used",
-+ "maxlat", "totlat", "numsched");
-+ }
-+
-+ if (ve == get_ve0())
-+ return 0;
-+
-+ user_ve = nice_ve = system_ve = 0;
-+ idle_time = strv_time = used = 0;
-+
-+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
-+ user_ve += VE_CPU_STATS(ve, cpu)->user;
-+ nice_ve += VE_CPU_STATS(ve, cpu)->nice;
-+ system_ve += VE_CPU_STATS(ve, cpu)->system;
-+ used += VE_CPU_STATS(ve, cpu)->used_time;
-+ idle_time += ve_sched_get_idle_time(ve, cpu);
-+ }
-+ uptime_cycles = get_cycles() - ve->start_cycles;
-+ uptime = get_jiffies_64() - ve->start_jiffies;
-+
-+ seq_printf(m, VESTAT_LINE_FMT, ve->veid,
-+ user_ve, nice_ve, system_ve,
-+ uptime, idle_time,
-+ strv_time, uptime_cycles, used,
-+ ve->sched_lat_ve.last.maxlat,
-+ ve->sched_lat_ve.last.totlat,
-+ ve->sched_lat_ve.last.count);
-+ return 0;
-+}
-+
-+static void *ve_seq_start(struct seq_file *m, loff_t *pos)
-+{
-+ struct ve_struct *ve, *curve;
-+ loff_t l;
-+
-+ curve = get_exec_env();
-+ read_lock(&ve_list_guard);
-+ if (!ve_is_super(curve)) {
-+ if (*pos != 0)
-+ return NULL;
-+ return curve;
-+ }
-+ for (ve = ve_list_head, l = *pos;
-+ ve != NULL && l > 0;
-+ ve = ve->next, l--);
-+ return ve;
-+}
-+
-+static void *ve_seq_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+ struct ve_struct *ve = (struct ve_struct *)v;
-+
-+ if (!ve_is_super(get_exec_env()))
-+ return NULL;
-+ (*pos)++;
-+ return ve->next;
-+}
-+
-+static void ve_seq_stop(struct seq_file *m, void *v)
-+{
-+ read_unlock(&ve_list_guard);
-+}
-+
-+static struct seq_operations vestat_seq_op = {
-+ start: ve_seq_start,
-+ next: ve_seq_next,
-+ stop: ve_seq_stop,
-+ show: vestat_seq_show
-+};
-+
-+static int vestat_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &vestat_seq_op);
-+}
-+
-+static struct file_operations proc_vestat_operations = {
-+ open: vestat_open,
-+ read: seq_read,
-+ llseek: seq_lseek,
-+ release: seq_release
-+};
-+
-+static inline unsigned long ve_used_mem(struct user_beancounter *ub)
-+{
-+ return ub->ub_parms[UB_OOMGUARPAGES].held;
-+}
-+
-+static inline void ve_mi_replace(struct meminfo *mi)
-+{
-+ struct user_beancounter *ub;
-+ unsigned long meminfo_val;
-+ unsigned long nodettram;
-+ unsigned long usedmem;
-+
-+ meminfo_val = get_exec_env()->meminfo_val;
-+
-+ if (!meminfo_val)
-+ return; /* No virtualization */
-+
-+ nodettram = mi->si.totalram;
-+ ub = current->mm->mm_ub;
-+ usedmem = ve_used_mem(ub);
-+
-+ memset(mi, 0, sizeof(*mi));
-+
-+ mi->si.totalram = (meminfo_val > nodettram) ?
-+ nodettram : meminfo_val;
-+ mi->si.freeram = (mi->si.totalram > usedmem) ?
-+ (mi->si.totalram - usedmem) : 0;
-+}
-+
-+static int meminfo_call(struct vnotifier_block *self,
-+ unsigned long event, void *arg, int old_ret)
-+{
-+ if (event != VIRTINFO_MEMINFO)
-+ return old_ret;
-+
-+ ve_mi_replace((struct meminfo *)arg);
-+
-+ return NOTIFY_OK;
-+}
-+
-+
-+static struct vnotifier_block meminfo_notifier_block = {
-+ .notifier_call = meminfo_call
-+};
-+
-+static int __init init_vecalls_proc(void)
-+{
-+ struct proc_dir_entry *de;
-+
-+ de = create_proc_glob_entry("vz/vestat",
-+ S_IFREG|S_IRUSR, NULL);
-+ if (de == NULL) {
-+ /* create "vz" subdirectory, if not exist */
-+ (void) create_proc_glob_entry("vz",
-+ S_IFDIR|S_IRUGO|S_IXUGO, NULL);
-+ de = create_proc_glob_entry("vz/vestat",
-+ S_IFREG|S_IRUSR, NULL);
-+ }
-+ if (de)
-+ de->proc_fops = &proc_vestat_operations;
-+ else
-+ printk(KERN_WARNING
-+ "VZMON: can't make vestat proc entry\n");
-+
-+ de = create_proc_entry("vz/devperms", S_IFREG | S_IRUSR, NULL);
-+ if (de)
-+ de->proc_fops = &proc_devperms_ops;
-+ else
-+ printk(KERN_WARNING
-+ "VZMON: can't make devperms proc entry\n");
-+
-+ virtinfo_notifier_register(VITYPE_GENERAL, &meminfo_notifier_block);
-+
-+ return 0;
-+}
-+
-+static void fini_vecalls_proc(void)
-+{
-+ remove_proc_entry("vz/devperms", NULL);
-+ remove_proc_entry("vz/vestat", NULL);
-+ virtinfo_notifier_unregister(VITYPE_GENERAL, &meminfo_notifier_block);
-+}
-+#else
-+#define init_vecalls_proc() (0)
-+#define fini_vecalls_proc() do { } while (0)
-+#endif /* CONFIG_PROC_FS */
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * User ctl
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+int vzcalls_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-+static struct vzioctlinfo vzcalls = {
-+ type: VZCTLTYPE,
-+ func: vzcalls_ioctl,
-+ owner: THIS_MODULE,
-+};
-+
-+int vzcalls_ioctl(struct inode *ino, struct file *file, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ int err;
-+
-+ err = -ENOTTY;
-+ switch(cmd) {
-+ case VZCTL_MARK_ENV_TO_DOWN: {
-+ /* Compatibility issue */
-+ err = 0;
-+ }
-+ break;
-+ case VZCTL_SETDEVPERMS: {
-+ /* Device type was mistakenly declared as dev_t
-+ * in the old user-kernel interface.
-+ * That's wrong, dev_t is a kernel internal type.
-+ * I use `unsigned' not having anything better in mind.
-+ * 2001/08/11 SAW */
-+ struct vzctl_setdevperms s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = real_setdevperms(s.veid, s.type,
-+ new_decode_dev(s.dev), s.mask);
-+ }
-+ break;
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ case VZCTL_VE_NETDEV: {
-+ struct vzctl_ve_netdev d;
-+ char *s;
-+ err = -EFAULT;
-+ if (copy_from_user(&d, (void *)arg, sizeof(d)))
-+ break;
-+ err = -ENOMEM;
-+ s = kmalloc(IFNAMSIZ+1, GFP_KERNEL);
-+ if (s == NULL)
-+ break;
-+ strncpy_from_user(s, d.dev_name, IFNAMSIZ);
-+ s[IFNAMSIZ] = 0;
-+ err = real_ve_dev_map(d.veid, d.op, s);
-+ kfree(s);
-+ }
-+ break;
-+#endif
-+ case VZCTL_ENV_CREATE: {
-+ struct vzctl_env_create s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = real_env_create(s.veid, s.flags, s.class_id,
-+ NULL, 0);
-+ }
-+ break;
-+ case VZCTL_ENV_CREATE_DATA: {
-+ struct vzctl_env_create_data s;
-+ env_create_param_t *data;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err=-EINVAL;
-+ if (s.datalen < VZCTL_ENV_CREATE_DATA_MINLEN ||
-+ s.datalen > VZCTL_ENV_CREATE_DATA_MAXLEN ||
-+ s.data == 0)
-+ break;
-+ err = -ENOMEM;
-+ data = kmalloc(sizeof(*data), GFP_KERNEL);
-+ if (!data)
-+ break;
-+ memset(data, 0, sizeof(*data));
-+ err = -EFAULT;
-+ if (copy_from_user(data, (void *)s.data, s.datalen))
-+ goto free_data;
-+ err = real_env_create(s.veid, s.flags, s.class_id,
-+ data, s.datalen);
-+free_data:
-+ kfree(data);
-+ }
-+ break;
-+ case VZCTL_GET_CPU_STAT: {
-+ struct vzctl_cpustatctl s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = ve_get_cpu_stat(s.veid, s.cpustat);
-+ }
-+ break;
-+ case VZCTL_VE_MEMINFO: {
-+ struct vzctl_ve_meminfo s;
-+ err = -EFAULT;
-+ if (copy_from_user(&s, (void *)arg, sizeof(s)))
-+ break;
-+ err = ve_set_meminfo(s.veid, s.val);
-+ }
-+ break;
-+ }
-+ return err;
-+}
-+EXPORT_SYMBOL(real_env_create);
-+
-+
-+/**********************************************************************
-+ **********************************************************************
-+ *
-+ * Init/exit stuff
-+ *
-+ **********************************************************************
-+ **********************************************************************/
-+
-+#ifdef CONFIG_VE_CALLS_MODULE
-+static int __init init_vecalls_symbols(void)
-+{
-+ KSYMRESOLVE(real_get_device_perms_ve);
-+ KSYMRESOLVE(real_do_env_cleanup);
-+ KSYMRESOLVE(real_do_env_free);
-+ KSYMRESOLVE(real_update_load_avg_ve);
-+ KSYMMODRESOLVE(vzmon);
-+ return 0;
-+}
-+
-+static void fini_vecalls_symbols(void)
-+{
-+ KSYMMODUNRESOLVE(vzmon);
-+ KSYMUNRESOLVE(real_get_device_perms_ve);
-+ KSYMUNRESOLVE(real_do_env_cleanup);
-+ KSYMUNRESOLVE(real_do_env_free);
-+ KSYMUNRESOLVE(real_update_load_avg_ve);
-+}
-+#else
-+#define init_vecalls_symbols() (0)
-+#define fini_vecalls_symbols() do { } while (0)
-+#endif
-+
-+static inline __init int init_vecalls_ioctls(void)
-+{
-+ vzioctl_register(&vzcalls);
-+ return 0;
-+}
-+
-+static inline void fini_vecalls_ioctls(void)
-+{
-+ vzioctl_unregister(&vzcalls);
-+}
-+
-+static int __init vecalls_init(void)
-+{
-+ int err;
-+ int i;
-+
-+ ve_list_head = get_ve0();
-+ init_rwsem(&get_ve0()->op_sem);
-+
-+ err = init_vzmond();
-+ if (err < 0)
-+ goto out_vzmond;
-+
-+ err = init_devperms_hash();
-+ if (err < 0)
-+ goto out_perms;
-+
-+ err = init_vecalls_symbols();
-+ if (err < 0)
-+ goto out_sym;
-+
-+ err = init_vecalls_proc();
-+ if (err < 0)
-+ goto out_proc;
-+
-+ err = init_vecalls_ioctls();
-+ if (err < 0)
-+ goto out_ioctls;
-+
-+ for (i = 0; i < VE_MAX_HOOKS; i++)
-+ INIT_LIST_HEAD(&ve_hooks[i]);
-+
-+ return 0;
-+
-+out_ioctls:
-+ fini_vecalls_proc();
-+out_proc:
-+ fini_vecalls_symbols();
-+out_sym:
-+ fini_devperms_hash();
-+out_perms:
-+ fini_vzmond();
-+out_vzmond:
-+ return err;
-+}
-+
-+static void vecalls_exit(void)
-+{
-+ fini_vecalls_ioctls();
-+ fini_vecalls_proc();
-+ fini_vecalls_symbols();
-+ fini_devperms_hash();
-+ fini_vzmond();
-+}
-+
-+EXPORT_SYMBOL(get_ve_by_id);
-+EXPORT_SYMBOL(__find_ve_by_id);
-+EXPORT_SYMBOL(ve_list_guard);
-+EXPORT_SYMBOL(ve_list_head);
-+EXPORT_SYMBOL(nr_ve);
-+
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Virtuozzo Control");
-+MODULE_LICENSE("GPL v2");
-+
-+module_init(vecalls_init)
-+module_exit(vecalls_exit)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/veowner.c linux-2.6.9-ve023stab030/kernel/veowner.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/veowner.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/veowner.c 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,301 @@
-+/*
-+ * kernel/veowner.c
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/ve.h>
-+#include <linux/ve_owner.h>
-+#include <linux/ve_proto.h>
-+#include <linux/ipc.h>
-+#include <linux/fs.h>
-+#include <linux/proc_fs.h>
-+#include <linux/file.h>
-+#include <linux/mm.h>
-+#include <linux/delay.h>
-+#include <linux/vmalloc.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/list.h>
-+#include <asm/system.h>
-+#include <asm/io.h>
-+
-+#include <net/tcp.h>
-+
-+void prepare_ve0_process(struct task_struct *tsk)
-+{
-+ set_virt_pid(tsk, tsk->pid);
-+ set_virt_tgid(tsk, tsk->tgid);
-+ if (tsk->signal) {
-+ set_virt_pgid(tsk, tsk->signal->pgrp);
-+ set_virt_sid(tsk, tsk->signal->session);
-+ }
-+ VE_TASK_INFO(tsk)->exec_env = get_ve0();
-+ VE_TASK_INFO(tsk)->owner_env = get_ve0();
-+ VE_TASK_INFO(tsk)->sleep_time = 0;
-+ VE_TASK_INFO(tsk)->wakeup_stamp = 0;
-+ VE_TASK_INFO(tsk)->sched_time = 0;
-+ seqcount_init(&VE_TASK_INFO(tsk)->wakeup_lock);
-+
-+ if (tsk->pid) {
-+ SET_VE_LINKS(tsk);
-+ atomic_inc(&get_ve0()->pcounter);
-+ }
-+}
-+
-+void prepare_ve0_loopback(void)
-+{
-+ get_ve0()->_loopback_dev = &loopback_dev;
-+}
-+
-+/*
-+ * ------------------------------------------------------------------------
-+ * proc entries
-+ * ------------------------------------------------------------------------
-+ */
-+
-+static void proc_move(struct proc_dir_entry *ddir,
-+ struct proc_dir_entry *sdir,
-+ const char *name)
-+{
-+ struct proc_dir_entry **p, *q;
-+ int len;
-+
-+ len = strlen(name);
-+ for (p = &sdir->subdir, q = *p; q != NULL; p = &q->next, q = *p)
-+ if (proc_match(len, name, q))
-+ break;
-+ if (q == NULL)
-+ return;
-+ *p = q->next;
-+ q->parent = ddir;
-+ q->next = ddir->subdir;
-+ ddir->subdir = q;
-+}
-+static void prepare_proc_misc(void)
-+{
-+ static char *table[] = {
-+ "loadavg",
-+ "uptime",
-+ "meminfo",
-+ "version",
-+ "stat",
-+ "filesystems",
-+ "locks",
-+ "swaps",
-+ "mounts",
-+ "cpuinfo",
-+ "net",
-+ "sysvipc",
-+ "sys",
-+ "fs",
-+ "vz",
-+ "user_beancounters",
-+ "cmdline",
-+ "vmstat",
-+ "modules",
-+ "kmsg",
-+ NULL,
-+ };
-+ char **p;
-+
-+ for (p = table; *p != NULL; p++)
-+ proc_move(&proc_root, ve0.proc_root, *p);
-+}
-+int prepare_proc(void)
-+{
-+ struct ve_struct *envid;
-+ struct proc_dir_entry *de;
-+ struct proc_dir_entry *ve_root;
-+
-+ envid = set_exec_env(&ve0);
-+ ve_root = ve0.proc_root->subdir;
-+ /* move the whole tree to be visible in VE0 only */
-+ ve0.proc_root->subdir = proc_root.subdir;
-+ for (de = ve0.proc_root->subdir; de->next != NULL; de = de->next)
-+ de->parent = ve0.proc_root;
-+ de->parent = ve0.proc_root;
-+ de->next = ve_root;
-+
-+ /* move back into the global scope some specific entries */
-+ proc_root.subdir = NULL;
-+ prepare_proc_misc();
-+ proc_mkdir("net", 0);
-+ proc_mkdir("net/stat", 0);
-+ proc_mkdir("vz", 0);
-+#ifdef CONFIG_SYSVIPC
-+ proc_mkdir("sysvipc", 0);
-+#endif
-+ proc_root_fs = proc_mkdir("fs", 0);
-+ /* XXX proc_tty_init(); */
-+
-+ /* XXX process inodes */
-+
-+ (void)set_exec_env(envid);
-+
-+ (void)create_proc_glob_entry("vz", S_IFDIR|S_IRUGO|S_IXUGO, NULL);
-+ return 0;
-+}
-+
-+static struct proc_dir_entry ve0_proc_root = {
-+ .name = "/proc",
-+ .namelen = 5,
-+ .mode = S_IFDIR | S_IRUGO | S_IXUGO,
-+ .nlink = 2
-+};
-+
-+void prepare_ve0_proc_root(void)
-+{
-+ ve0.proc_root = &ve0_proc_root;
-+}
-+
-+/*
-+ * ------------------------------------------------------------------------
-+ * Virtualized sysctl
-+ * ------------------------------------------------------------------------
-+ */
-+
-+static int semmin[4] = { 1, 1, 1, 1 };
-+static int semmax[4] = { 8000, INT_MAX, 1000, IPCMNI };
-+static ctl_table kern_table[] = {
-+ {KERN_NODENAME, "hostname", system_utsname.nodename, 64,
-+ 0644, NULL, &proc_doutsstring, &sysctl_string},
-+ {KERN_DOMAINNAME, "domainname", system_utsname.domainname, 64,
-+ 0644, NULL, &proc_doutsstring, &sysctl_string},
-+#ifdef CONFIG_SYSVIPC
-+#define get_ve0_field(fname) &ve0._##fname
-+ {KERN_SHMMAX, "shmmax", get_ve0_field(shm_ctlmax), sizeof (size_t),
-+ 0644, NULL, &proc_doulongvec_minmax },
-+ {KERN_SHMALL, "shmall", get_ve0_field(shm_ctlall), sizeof (size_t),
-+ 0644, NULL, &proc_doulongvec_minmax },
-+ {KERN_SHMMNI, "shmmni", get_ve0_field(shm_ctlmni), sizeof (int),
-+ 0644, NULL, &proc_dointvec_minmax, NULL,
-+ NULL, &semmin[0], &semmax[3] },
-+ {KERN_MSGMAX, "msgmax", get_ve0_field(msg_ctlmax), sizeof (int),
-+ 0644, NULL, &proc_dointvec },
-+ {KERN_MSGMNI, "msgmni", get_ve0_field(msg_ctlmni), sizeof (int),
-+ 0644, NULL, &proc_dointvec_minmax, NULL,
-+ NULL, &semmin[0], &semmax[3] },
-+ {KERN_MSGMNB, "msgmnb", get_ve0_field(msg_ctlmnb), sizeof (int),
-+ 0644, NULL, &proc_dointvec },
-+ {KERN_SEM, "sem", get_ve0_field(sem_ctls), 4*sizeof (int),
-+ 0644, NULL, &proc_dointvec },
-+#endif
-+ {0}
-+};
-+static ctl_table root_table[] = {
-+ {CTL_KERN, "kernel", NULL, 0, 0555, kern_table},
-+ {0}
-+};
-+extern int ip_rt_src_check;
-+extern int ve_area_access_check;
-+static ctl_table ipv4_route_table[] = {
-+ {
-+ ctl_name: NET_IPV4_ROUTE_SRC_CHECK,
-+ procname: "src_check",
-+ data: &ip_rt_src_check,
-+ maxlen: sizeof(int),
-+ mode: 0644,
-+ proc_handler: &proc_dointvec,
-+ },
-+ { 0 }
-+};
-+static ctl_table ipv4_table[] = {
-+ {NET_IPV4_ROUTE, "route", NULL, 0, 0555, ipv4_route_table},
-+ { 0 }
-+};
-+static ctl_table net_table[] = {
-+ {NET_IPV4, "ipv4", NULL, 0, 0555, ipv4_table},
-+ { 0 }
-+};
-+static ctl_table fs_table[] = {
-+ {
-+ ctl_name: 226,
-+ procname: "ve-area-access-check",
-+ data: &ve_area_access_check,
-+ maxlen: sizeof(int),
-+ mode: 0644,
-+ proc_handler: &proc_dointvec,
-+ },
-+ { 0 }
-+};
-+static ctl_table root_table2[] = {
-+ {CTL_NET, "net", NULL, 0, 0555, net_table},
-+ {CTL_FS, "fs", NULL, 0, 0555, fs_table},
-+ { 0 }
-+};
-+int prepare_sysctl(void)
-+{
-+ struct ve_struct *envid;
-+
-+ envid = set_exec_env(&ve0);
-+ ve0.kern_header = register_sysctl_table(root_table, 1);
-+ register_sysctl_table(root_table2, 0);
-+ (void)set_exec_env(envid);
-+ return 0;
-+}
-+
-+void prepare_ve0_sysctl(void)
-+{
-+ INIT_LIST_HEAD(&ve0.sysctl_lh);
-+#ifdef CONFIG_SYSCTL
-+ ve0.proc_sys_root = proc_mkdir("sys", 0);
-+#endif
-+}
-+
-+/*
-+ * ------------------------------------------------------------------------
-+ * XXX init_ve_system
-+ * ------------------------------------------------------------------------
-+ */
-+
-+extern struct ipv4_devconf *get_ipv4_devconf_dflt_addr(void);
-+
-+void init_ve_system(void)
-+{
-+ struct task_struct *init_entry, *p, *tsk;
-+ struct ve_struct *ptr;
-+ unsigned long flags;
-+ int i;
-+
-+ ptr = get_ve0();
-+ (void)get_ve(ptr);
-+ atomic_set(&ptr->pcounter, 1);
-+
-+ /* Don't forget about idle tasks */
-+ write_lock_irqsave(&tasklist_lock, flags);
-+ for (i = 0; i < NR_CPUS; i++) {
-+ tsk = idle_task(i);
-+ if (tsk == NULL)
-+ continue;
-+
-+ prepare_ve0_process(tsk);
-+ }
-+ do_each_thread_all(p, tsk) {
-+ prepare_ve0_process(tsk);
-+ } while_each_thread_all(p, tsk);
-+ write_unlock_irqrestore(&tasklist_lock, flags);
-+
-+ init_entry = child_reaper;
-+ ptr->init_entry = init_entry;
-+ /* XXX: why? */
-+ cap_set_full(ptr->cap_default);
-+
-+ ptr->_ipv4_devconf = &ipv4_devconf;
-+ ptr->_ipv4_devconf_dflt = get_ipv4_devconf_dflt_addr();
-+
-+ read_lock(&init_entry->fs->lock);
-+ ptr->fs_rootmnt = init_entry->fs->rootmnt;
-+ ptr->fs_root = init_entry->fs->root;
-+ read_unlock(&init_entry->fs->lock);
-+
-+ /* common prepares */
-+ prepare_proc();
-+ prepare_sysctl();
-+ prepare_ipc();
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/vzdev.c linux-2.6.9-ve023stab030/kernel/vzdev.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/vzdev.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/vzdev.c 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,97 @@
-+/*
-+ * kernel/vzdev.c
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/fs.h>
-+#include <linux/list.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/vzctl.h>
-+#include <linux/slab.h>
-+#include <linux/vmalloc.h>
-+#include <linux/vzcalluser.h>
-+#include <asm/uaccess.h>
-+#include <asm/pgalloc.h>
-+
-+#define VZCTL_MAJOR 126
-+#define VZCTL_NAME "vzctl"
-+
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Virtuozzo Interface");
-+MODULE_LICENSE("GPL v2");
-+
-+static LIST_HEAD(ioctls);
-+static spinlock_t ioctl_lock = SPIN_LOCK_UNLOCKED;
-+
-+int vzctl_ioctl(struct inode *ino, struct file *file, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ int err;
-+ struct list_head *p;
-+ struct vzioctlinfo *inf;
-+
-+ err = -ENOTTY;
-+ spin_lock(&ioctl_lock);
-+ list_for_each(p, &ioctls) {
-+ inf = list_entry(p, struct vzioctlinfo, list);
-+ if (inf->type != _IOC_TYPE(cmd))
-+ continue;
-+
-+ err = try_module_get(inf->owner) ? 0 : -EBUSY;
-+ spin_unlock(&ioctl_lock);
-+ if (!err) {
-+ err = (*inf->func)(ino, file, cmd, arg);
-+ module_put(inf->owner);
-+ }
-+ return err;
-+ }
-+ spin_unlock(&ioctl_lock);
-+ return err;
-+}
-+
-+void vzioctl_register(struct vzioctlinfo *inf)
-+{
-+ spin_lock(&ioctl_lock);
-+ list_add(&inf->list, &ioctls);
-+ spin_unlock(&ioctl_lock);
-+}
-+
-+void vzioctl_unregister(struct vzioctlinfo *inf)
-+{
-+ spin_lock(&ioctl_lock);
-+ list_del_init(&inf->list);
-+ spin_unlock(&ioctl_lock);
-+}
-+
-+EXPORT_SYMBOL(vzioctl_register);
-+EXPORT_SYMBOL(vzioctl_unregister);
-+
-+/*
-+ * Init/exit stuff.
-+ */
-+static struct file_operations vzctl_fops = {
-+ .owner = THIS_MODULE,
-+ .ioctl = vzctl_ioctl,
-+};
-+
-+static void __exit vzctl_exit(void)
-+{
-+ unregister_chrdev(VZCTL_MAJOR, VZCTL_NAME);
-+}
-+
-+static int __init vzctl_init(void)
-+{
-+ int ret;
-+
-+ ret = register_chrdev(VZCTL_MAJOR, VZCTL_NAME, &vzctl_fops);
-+ return ret;
-+}
-+
-+module_init(vzctl_init)
-+module_exit(vzctl_exit);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/kernel/vzwdog.c linux-2.6.9-ve023stab030/kernel/vzwdog.c
---- linux-2.6.9-42.0.3.EL.orig/kernel/vzwdog.c 1970-01-01 03:00:00.000000000 +0300
-+++ linux-2.6.9-ve023stab030/kernel/vzwdog.c 2006-10-11 19:07:57.000000000 +0400
-@@ -0,0 +1,302 @@
-+/*
-+ * kernel/vzwdog.c
-+ *
-+ * Copyright (C) 2000-2005 SWsoft
-+ * All rights reserved.
-+ *
-+ * Licensing governed by "linux/COPYING.SWsoft" file.
-+ *
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/fs.h>
-+#include <linux/list.h>
-+#include <linux/ctype.h>
-+#include <linux/kobject.h>
-+#include <linux/genhd.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/kernel_stat.h>
-+#include <linux/smp_lock.h>
-+#include <linux/errno.h>
-+#include <linux/suspend.h>
-+#include <linux/ve.h>
-+#include <linux/vzstat.h>
-+#include <asm/uaccess.h>
-+
-+/* Staff regading kernel thread polling VE validity */
-+static int sleep_timeout = 60;
-+static pid_t wdog_thread_pid;
-+static int wdog_thread_continue = 1;
-+static DECLARE_COMPLETION(license_thread_exited);
-+
-+extern void show_mem(void);
-+extern struct ve_struct *ve_list_head;
-+
-+static struct file *intr_file;
-+static char page[PAGE_SIZE];
-+
-+static void parse_irq_list(int len)
-+{
-+ int i, k, skip;
-+ for (i = 0; i < len; ) {
-+ k = i;
-+ while (i < len && page[i] != '\n' && page[i] != ':')
-+ i++;
-+ skip = 0;
-+ if (i < len && page[i] != '\n') {
-+ i++; /* skip ':' */
-+ while (i < len && (page[i] == ' ' || page[i] == '0'))
-+ i++;
-+ skip = (i < len && (page[i] < '0' || page[i] > '9'));
-+ while (i < len && page[i] != '\n')
-+ i++;
-+ }
-+ if (!skip)
-+ printk("%.*s\n", i - k, page + k);
-+ if (i < len)
-+ i++; /* skip '\n' */
-+ }
-+}
-+
-+extern loff_t vfs_llseek(struct file *file, loff_t, int);
-+extern ssize_t vfs_read(struct file *file, char __user *, size_t, loff_t *);
-+extern struct file *filp_open(const char *filename, int flags, int mode);
-+extern int filp_close(struct file *filp, fl_owner_t id);
-+static void show_irq_list(void)
-+{
-+ mm_segment_t fs;
-+ int r;
-+
-+ fs = get_fs();
-+ set_fs(KERNEL_DS);
-+ vfs_llseek(intr_file, 0, 0);
-+ r = vfs_read(intr_file, page, sizeof(page), &intr_file->f_pos);
-+ set_fs(fs);
-+
-+ if (r > 0)
-+ parse_irq_list(r);
-+}
-+
-+static void show_alloc_latency(void)
-+{
-+ static const char *alloc_descr[KSTAT_ALLOCSTAT_NR] = {
-+ "A0",
-+ "L0",
-+ "H0",
-+ "L1",
-+ "H1"
-+ };
-+ int i;
-+
-+ printk("lat: ");
-+ for (i = 0; i < KSTAT_ALLOCSTAT_NR; i++) {
-+ struct kstat_lat_struct *p;
-+ cycles_t maxlat, avg0, avg1, avg2;
-+
-+ p = &kstat_glob.alloc_lat[i];
-+ spin_lock_irq(&kstat_glb_lock);
-+ maxlat = p->last.maxlat;
-+ avg0 = p->avg[0];
-+ avg1 = p->avg[1];
-+ avg2 = p->avg[2];
-+ spin_unlock_irq(&kstat_glb_lock);
-+
-+ printk("%s %Lu (%Lu %Lu %Lu)",
-+ alloc_descr[i],
-+ maxlat,
-+ avg0,
-+ avg1,
-+ avg2);
-+ }
-+ printk("\n");
-+}
-+
-+static void show_schedule_latency(void)
-+{
-+ struct kstat_lat_pcpu_struct *p;
-+ cycles_t maxlat, totlat, avg0, avg1, avg2;
-+ unsigned long count;
-+
-+ p = &kstat_glob.sched_lat;
-+ spin_lock_irq(&kstat_glb_lock);
-+ maxlat = p->last.maxlat;
-+ totlat = p->last.totlat;
-+ count = p->last.count;
-+ avg0 = p->avg[0];
-+ avg1 = p->avg[1];
-+ avg2 = p->avg[2];
-+ spin_unlock_irq(&kstat_glb_lock);
-+
-+ printk("sched lat: %Lu/%Lu/%lu (%Lu %Lu %Lu)\n",
-+ maxlat,
-+ totlat,
-+ count,
-+ avg0,
-+ avg1,
-+ avg2);
-+}
-+
-+static void show_header(void)
-+{
-+ struct timeval tv;
-+
-+ do_gettimeofday(&tv);
-+ preempt_disable();
-+ printk("*** VZWDOG 1.14: time %lu.%06lu uptime %Lu CPU %d ***\n",
-+ tv.tv_sec, tv.tv_usec,
-+ get_jiffies_64(), smp_processor_id());
-+#if 0
-+ printk("*** cycles_per_jiffy %lu jiffies_per_second %u ***\n",
-+ cycles_per_jiffy, HZ);
-+#endif
-+ preempt_enable();
-+}
-+
-+static void show_pgdatinfo(void)
-+{
-+ pg_data_t *pgdat;
-+
-+ printk("pgdat:");
-+ for_each_pgdat(pgdat) {
-+ printk(" %d: %lu,%lu,%lu,%p",
-+ pgdat->node_id,
-+ pgdat->node_start_pfn,
-+ pgdat->node_present_pages,
-+ pgdat->node_spanned_pages,
-+ pgdat->node_mem_map);
-+ }
-+ printk("\n");
-+}
-+
-+extern struct subsystem *get_block_subsys(void);
-+static void show_diskio(void)
-+{
-+ struct gendisk *gd;
-+ struct subsystem *block_subsys;
-+ char buf[BDEVNAME_SIZE];
-+
-+ printk("disk_io: ");
-+
-+ block_subsys = get_block_subsys();
-+ down_read(&block_subsys->rwsem);
-+ list_for_each_entry(gd, &block_subsys->kset.list, kobj.entry) {
-+ char *name;
-+ name = disk_name(gd, 0, buf);
-+ if ((strlen(name) > 4) && (strncmp(name, "loop", 4) == 0) &&
-+ isdigit(name[4]))
-+ continue;
-+ if ((strlen(name) > 3) && (strncmp(name, "ram", 3) == 0) &&
-+ isdigit(name[3]))
-+ continue;
-+ printk("(%u,%u) %s r(%u %u %u) w(%u %u %u)\n",
-+ gd->major, gd->first_minor,
-+ name,
-+ disk_stat_read(gd, reads),
-+ disk_stat_read(gd, read_sectors),
-+ disk_stat_read(gd, read_merges),
-+ disk_stat_read(gd, writes),
-+ disk_stat_read(gd, write_sectors),
-+ disk_stat_read(gd, write_merges));
-+ }
-+ up_read(&block_subsys->rwsem);
-+
-+ printk("\n");
-+}
-+
-+static void show_nrprocs(void)
-+{
-+ unsigned long _nr_running, _nr_sleeping,
-+ _nr_unint, _nr_zombie, _nr_dead, _nr_stopped;
-+
-+ _nr_running = nr_running();
-+ _nr_unint = nr_uninterruptible();
-+ _nr_sleeping = nr_sleeping();
-+ _nr_zombie = nr_zombie;
-+ _nr_dead = nr_dead;
-+ _nr_stopped = nr_stopped();
-+
-+ printk("VEnum: %d, proc R %lu, S %lu, D %lu, "
-+ "Z %lu, X %lu, T %lu (tot %d)\n",
-+ nr_ve, _nr_running, _nr_sleeping, _nr_unint,
-+ _nr_zombie, _nr_dead, _nr_stopped, nr_threads);
-+}
-+
-+static void wdog_print(void)
-+{
-+ show_header();
-+ show_irq_list();
-+ show_pgdatinfo();
-+ show_mem();
-+ show_diskio();
-+ show_schedule_latency();
-+ show_alloc_latency();
-+ show_nrprocs();
-+}
-+
-+static int wdog_loop(void* data)
-+{
-+ struct task_struct *tsk = current;
-+ DECLARE_WAIT_QUEUE_HEAD(thread_wait_queue);
-+
-+ /*
-+ * This thread doesn't need any user-level access,
-+ * so get rid of all our resources
-+ */
-+ daemonize("wdogd");
-+
-+ spin_lock_irq(&tsk->sighand->siglock);
-+ sigfillset(&tsk->blocked);
-+ sigdelset(&tsk->blocked, SIGHUP);
-+ recalc_sigpending();
-+ spin_unlock_irq(&tsk->sighand->siglock);
-+
-+ while (wdog_thread_continue) {
-+ wdog_print();
-+ interruptible_sleep_on_timeout(&thread_wait_queue,
-+ sleep_timeout*HZ);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-+ /* clear all signals */
-+ if (signal_pending(tsk))
-+ flush_signals(tsk);
-+ }
-+
-+ complete_and_exit(&license_thread_exited, 0);
-+}
-+
-+static int __init wdog_init(void)
-+{
-+ struct file *file;
-+
-+ file = filp_open("/proc/interrupts", 0, 0);
-+ if (IS_ERR(file))
-+ return PTR_ERR(file);
-+ intr_file = file;
-+
-+ wdog_thread_pid = kernel_thread(wdog_loop, NULL, 0);
-+ if (wdog_thread_pid < 0) {
-+ filp_close(intr_file, NULL);
-+ return wdog_thread_pid;
-+ }
-+ return 0;
-+}
-+
-+static void __exit wdog_exit(void)
-+{
-+ wdog_thread_continue = 0;
-+ if (wdog_thread_pid > 0) {
-+ kill_proc(wdog_thread_pid, SIGHUP, 1);
-+ wait_for_completion(&license_thread_exited);
-+ }
-+ filp_close(intr_file, NULL);
-+}
-+
-+module_param(sleep_timeout, int, 0666);
-+MODULE_AUTHOR("SWsoft <info@sw-soft.com>");
-+MODULE_DESCRIPTION("Virtuozzo WDOG");
-+MODULE_LICENSE("GPL v2");
-+
-+module_init(wdog_init)
-+module_exit(wdog_exit)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/lib/Kconfig.debug linux-2.6.9-ve023stab030/lib/Kconfig.debug
---- linux-2.6.9-42.0.3.EL.orig/lib/Kconfig.debug 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/lib/Kconfig.debug 2006-10-11 19:07:55.000000000 +0400
-@@ -20,6 +20,14 @@ config MAGIC_SYSRQ
- keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
- unless you really know what this hack does.
-
-+config SYSRQ_DEBUG
-+ bool "Debugging via sysrq keys"
-+ depends on MAGIC_SYSRQ
-+ help
-+ Say Y if you want to extend functionality of magic key. It will
-+ provide you with some debugging facilities such as dumping and
-+ writing memory, resolving symbols and some other.
-+
- config MAGIC_SYSRQ
- bool "Magic SysRq key"
- depends on DEBUG_KERNEL && (H8300 || M68KNOMMU || V850)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/lib/bust_spinlocks.c linux-2.6.9-ve023stab030/lib/bust_spinlocks.c
---- linux-2.6.9-42.0.3.EL.orig/lib/bust_spinlocks.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/lib/bust_spinlocks.c 2006-10-11 19:08:00.000000000 +0400
-@@ -13,27 +13,20 @@
- #include <linux/tty.h>
- #include <linux/wait.h>
- #include <linux/vt_kern.h>
--
-+#include <linux/console.h>
-
- void bust_spinlocks(int yes)
- {
-+ if (printk_no_wake)
-+ return;
-+
- if (yes) {
- oops_in_progress = 1;
- } else {
-- int loglevel_save = console_loglevel;
- #ifdef CONFIG_VT
- unblank_screen();
- #endif
- oops_in_progress = 0;
-- /*
-- * OK, the message is on the console. Now we call printk()
-- * without oops_in_progress set so that printk() will give klogd
-- * and the blanked console a poke. Hold onto your hats...
-- */
-- console_loglevel = 15; /* NMI oopser may have shut the console up */
-- printk(" ");
-- console_loglevel = loglevel_save;
-+ wake_up_klogd();
- }
- }
--
--
-diff -uprN linux-2.6.9-42.0.3.EL.orig/lib/idr.c linux-2.6.9-ve023stab030/lib/idr.c
---- linux-2.6.9-42.0.3.EL.orig/lib/idr.c 2006-10-11 18:29:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/lib/idr.c 2006-10-11 19:07:55.000000000 +0400
-@@ -51,15 +51,21 @@ static struct idr_layer *alloc_layer(str
- return(p);
- }
-
-+/* only called when idp->lock is held */
-+static void __free_layer(struct idr *idp, struct idr_layer *p)
-+{
-+ p->ary[0] = idp->id_free;
-+ idp->id_free = p;
-+ idp->id_free_cnt++;
-+}
-+
- static void free_layer(struct idr *idp, struct idr_layer *p)
- {
- /*
- * Depends on the return element being zeroed.
- */
- spin_lock(&idp->lock);
-- p->ary[0] = idp->id_free;
-- idp->id_free = p;
-- idp->id_free_cnt++;
-+ __free_layer(idp, p);
- spin_unlock(&idp->lock);
- }
-
-@@ -187,12 +193,14 @@ build_up:
- * The allocation failed. If we built part of
- * the structure tear it down.
- */
-+ spin_lock(&idp->lock);
- for (new = p; p && p != idp->top; new = p) {
- p = p->ary[0];
- new->ary[0] = NULL;
- new->bitmap = new->count = 0;
-- free_layer(idp, new);
-+ __free_layer(idp, new);
- }
-+ spin_unlock(&idp->lock);
- return -1;
- }
- new->ary[0] = p;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/lib/inflate.c linux-2.6.9-ve023stab030/lib/inflate.c
---- linux-2.6.9-42.0.3.EL.orig/lib/inflate.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/lib/inflate.c 2006-10-11 19:07:55.000000000 +0400
-@@ -322,7 +322,7 @@ DEBG("huft1 ");
- {
- *t = (struct huft *)NULL;
- *m = 0;
-- return 0;
-+ return 2;
- }
-
- DEBG("huft2 ");
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/filemap.c linux-2.6.9-ve023stab030/mm/filemap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/filemap.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/filemap.c 2006-10-11 19:07:57.000000000 +0400
-@@ -130,20 +130,6 @@ void remove_from_page_cache(struct page
- spin_unlock_irq(&mapping->tree_lock);
- }
-
--static inline int sync_page(struct page *page)
--{
-- struct address_space *mapping;
--
-- /*
-- * FIXME, fercrissake. What is this barrier here for?
-- */
-- smp_mb();
-- mapping = page_mapping(page);
-- if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
-- return mapping->a_ops->sync_page(page);
-- return 0;
--}
--
- /**
- * filemap_fdatawrite_range - start writeback against all of a mapping's
- * dirty pages that lie within the byte offsets <start, end>
-@@ -955,6 +941,8 @@ int file_read_actor(read_descriptor_t *d
- if (size > count)
- size = count;
-
-+ left = size;
-+#ifndef CONFIG_X86_UACCESS_INDIRECT
- /*
- * Faults on the destination of a read are common, so do it before
- * taking the kmap.
-@@ -964,20 +952,21 @@ int file_read_actor(read_descriptor_t *d
- left = __copy_to_user_inatomic(desc->arg.buf,
- kaddr + offset, size);
- kunmap_atomic(kaddr, KM_USER0);
-- if (left == 0)
-- goto success;
- }
-+#endif
-
-- /* Do it the slow way */
-- kaddr = kmap(page);
-- left = __copy_to_user(desc->arg.buf, kaddr + offset, size);
-- kunmap(page);
--
-- if (left) {
-- size -= left;
-- desc->error = -EFAULT;
-+ if (left != 0) {
-+ /* Do it the slow way */
-+ kaddr = kmap(page);
-+ left = __copy_to_user(desc->arg.buf, kaddr + offset, size);
-+ kunmap(page);
-+
-+ if (left) {
-+ size -= left;
-+ desc->error = -EFAULT;
-+ }
- }
--success:
-+
- desc->count = count - size;
- desc->written += size;
- desc->arg.buf += size;
-@@ -1758,9 +1747,13 @@ filemap_copy_from_user(struct page *page
- char *kaddr;
- int left;
-
-+#ifndef CONFIG_X86_UACCESS_INDIRECT
- kaddr = kmap_atomic(page, KM_USER0);
- left = __copy_from_user_inatomic(kaddr + offset, buf, bytes);
- kunmap_atomic(kaddr, KM_USER0);
-+#else
-+ left = bytes;
-+#endif
-
- if (left != 0) {
- /* Do it the slow way */
-@@ -1811,10 +1804,14 @@ filemap_copy_from_user_iovec(struct page
- char *kaddr;
- size_t copied;
-
-+#ifndef CONFIG_X86_UACCESS_INDIRECT
- kaddr = kmap_atomic(page, KM_USER0);
- copied = __filemap_copy_from_user_iovec(kaddr + offset, iov,
- base, bytes);
- kunmap_atomic(kaddr, KM_USER0);
-+#else
-+ copied = 0;
-+#endif
- if (copied != bytes) {
- kaddr = kmap(page);
- copied = __filemap_copy_from_user_iovec(kaddr + offset, iov,
-@@ -1830,7 +1827,7 @@ filemap_set_next_iovec(const struct iove
- const struct iovec *iov = *iovp;
- size_t base = *basep;
-
-- while (bytes) {
-+ do {
- int copy = min(bytes, iov->iov_len - base);
-
- bytes -= copy;
-@@ -1839,7 +1836,7 @@ filemap_set_next_iovec(const struct iove
- iov++;
- base = 0;
- }
-- }
-+ } while (bytes);
- *iovp = iov;
- *basep = base;
- }
-@@ -2006,8 +2003,16 @@ generic_file_buffered_write(struct kiocb
- offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
- index = pos >> PAGE_CACHE_SHIFT;
- bytes = PAGE_CACHE_SIZE - offset;
-- if (bytes > count)
-- bytes = count;
-+
-+ /* Limit the size of the copy to the caller's write size */
-+ bytes = min(bytes, count);
-+
-+ /*
-+ * Limit the size of the copy to that of the current segment,
-+ * because fault_in_pages_readable() doesn't know how to walk
-+ * segments.
-+ */
-+ bytes = min(bytes, cur_iov->iov_len - iov_base);
-
- /*
- * Bring in the user page that we will copy from _first_.
-@@ -2025,6 +2030,12 @@ generic_file_buffered_write(struct kiocb
- break;
- }
-
-+ if (unlikely(bytes == 0)) {
-+ status = 0;
-+ copied = 0;
-+ goto zero_length_segment;
-+ }
-+
- status = a_ops->prepare_write(file, page, offset, offset+bytes);
- if (unlikely(status)) {
- loff_t isize = i_size_read(inode);
-@@ -2046,7 +2057,8 @@ generic_file_buffered_write(struct kiocb
- cur_iov, iov_base, bytes);
- flush_dcache_page(page);
- status = a_ops->commit_write(file, page, offset, offset+bytes);
-- if (likely(copied > 0)) {
-+zero_length_segment:
-+ if (likely(copied >= 0)) {
- if (!status)
- status = copied;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/fremap.c linux-2.6.9-ve023stab030/mm/fremap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/fremap.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/fremap.c 2006-10-11 19:07:59.000000000 +0400
-@@ -19,6 +19,8 @@
- #include <asm/cacheflush.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_vmpages.h>
-+
- static inline void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep)
- {
-@@ -37,8 +39,11 @@ static inline void zap_pte(struct mm_str
- if (pte_dirty(pte))
- set_page_dirty(page);
- page_remove_rmap(page);
-+ pb_remove_ref(page, mm_ub(mm));
- page_cache_release(page);
- mm->rss--;
-+ vma->vm_rss--;
-+ ub_unused_privvm_inc(mm_ub(mm), 1, vma);
- }
- }
- } else {
-@@ -62,7 +67,10 @@ int install_page(struct mm_struct *mm, s
- pgd_t *pgd;
- pmd_t *pmd;
- pte_t pte_val;
-+ struct page_beancounter *pbc;
-
-+ if (pb_alloc(&pbc))
-+ goto err_pb;
- pgd = pgd_offset(mm, addr);
- spin_lock(&mm->page_table_lock);
-
-@@ -79,14 +87,19 @@ int install_page(struct mm_struct *mm, s
- * caller about it.
- */
- err = -EINVAL;
-- inode = vma->vm_file->f_mapping->host;
-- size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-- if (!page->mapping || page->index >= size)
-- goto err_unlock;
-+ if (vma->vm_file) {
-+ inode = vma->vm_file->f_mapping->host;
-+ size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-+ if (!page->mapping || page->index >= size)
-+ goto err_unlock;
-+ }
-
- zap_pte(mm, vma, addr, pte);
-
- mm->rss++;
-+ vma->vm_rss++;
-+ pb_add_ref(page, mm_ub(mm), &pbc);
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
- flush_icache_page(vma, page);
- set_pte(pte, mk_pte(page, prot));
- page_add_file_rmap(page);
-@@ -97,6 +110,8 @@ int install_page(struct mm_struct *mm, s
- err = 0;
- err_unlock:
- spin_unlock(&mm->page_table_lock);
-+ pb_free(&pbc);
-+err_pb:
- return err;
- }
- EXPORT_SYMBOL(install_page);
-@@ -242,4 +257,4 @@ asmlinkage long sys_remap_file_pages(uns
-
- return err;
- }
--
-+EXPORT_SYMBOL(sys_remap_file_pages);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/memory.c linux-2.6.9-ve023stab030/mm/memory.c
---- linux-2.6.9-42.0.3.EL.orig/mm/memory.c 2006-10-11 18:29:42.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/memory.c 2006-10-11 19:08:00.000000000 +0400
-@@ -40,6 +40,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/mman.h>
-+#include <linux/virtinfo.h>
- #include <linux/swap.h>
- #include <linux/highmem.h>
- #include <linux/pagemap.h>
-@@ -56,6 +57,9 @@
- #include <linux/swapops.h>
- #include <linux/elf.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-+
- #ifndef CONFIG_DISCONTIGMEM
- /* use the per-pgdat data instead for discontigmem - mbligh */
- unsigned long max_mapnr;
-@@ -184,6 +188,7 @@ pte_t fastcall * pte_alloc_map(struct mm
- out:
- return pte_offset_map(pmd, address);
- }
-+EXPORT_SYMBOL(pte_alloc_map);
-
- pte_t fastcall * pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsigned long address)
- {
-@@ -211,6 +216,8 @@ out:
- }
- #define PTE_TABLE_MASK ((PTRS_PER_PTE-1) * sizeof(pte_t))
- #define PMD_TABLE_MASK ((PTRS_PER_PMD-1) * sizeof(pmd_t))
-+#define pb_list_size(addr) \
-+ (PTRS_PER_PTE - ((addr >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
-
- /*
- * copy one vm_area from one task to the other. Assumes the page tables
-@@ -223,13 +230,15 @@ out:
- * dst->page_table_lock is held on entry and exit,
- * but may be dropped within pmd_alloc() and pte_alloc_map().
- */
--int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
-- struct vm_area_struct *vma)
-+int __copy_page_range(struct vm_area_struct *vma, struct mm_struct *src,
-+ unsigned long address, size_t size)
- {
-+ struct mm_struct *dst = vma->vm_mm;
- pgd_t * src_pgd, * dst_pgd;
-- unsigned long address = vma->vm_start;
-- unsigned long end = vma->vm_end;
-+ unsigned long end = address + size;
- unsigned long cow;
-+ struct page_beancounter *pbc;
-+ int need_pbc;
-
- /*
- * Don't copy ptes where a page fault will fill them correctly.
-@@ -248,6 +257,8 @@ int copy_page_range(struct mm_struct *ds
- cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
- src_pgd = pgd_offset(src, address)-1;
- dst_pgd = pgd_offset(dst, address)-1;
-+ pbc = NULL;
-+ need_pbc = (mm_ub(dst) != mm_ub(src));
-
- for (;;) {
- pmd_t * src_pmd, * dst_pmd;
-@@ -289,6 +300,10 @@ skip_copy_pte_range:
- goto cont_copy_pmd_range;
- }
-
-+ if (need_pbc &&
-+ pb_alloc_list(&pbc, pb_list_size(address), dst))
-+ goto nomem;
-+
- dst_pte = pte_alloc_map(dst, dst_pmd, address);
- if (!dst_pte)
- goto nomem;
-@@ -345,6 +360,9 @@ skip_copy_pte_range:
- dst->rss++;
- if (PageAnon(page))
- dst->anon_rss++;
-+ vma->vm_rss++;
-+ ub_unused_privvm_dec(mm_ub(dst), 1, vma);
-+ pb_add_list_ref(page, mm_ub(dst), &pbc);
- set_pte(dst_pte, pte);
- page_dup_rmap(page);
- cont_copy_pte_range_noset:
-@@ -369,10 +387,21 @@ cont_copy_pmd_range:
- out_unlock:
- spin_unlock(&src->page_table_lock);
- out:
-+ pb_free_list(&pbc);
- return 0;
- nomem:
-+ pb_free_list(&pbc);
- return -ENOMEM;
- }
-+EXPORT_SYMBOL(__copy_page_range);
-+
-+int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
-+ struct vm_area_struct *vma)
-+{
-+ if (vma->vm_mm != dst)
-+ BUG();
-+ return __copy_page_range(vma, src, vma->vm_start, vma->vm_end-vma->vm_start);
-+}
-
- static void zap_pte_range(struct mmu_gather *tlb,
- pmd_t *pmd, unsigned long address,
-@@ -441,6 +470,7 @@ static void zap_pte_range(struct mmu_gat
- mark_page_accessed(page);
- tlb->freed++;
- page_remove_rmap(page);
-+ pb_remove_ref(page, mm_ub(tlb->mm));
- tlb_remove_page(tlb, page);
- continue;
- }
-@@ -483,20 +513,63 @@ static void zap_pmd_range(struct mmu_gat
- } while (address && (address < end));
- }
-
-+static void warn_bad_zap(struct vm_area_struct *vma, unsigned long freed)
-+{
-+#ifdef CONFIG_USER_RESOURCE
-+ static struct ub_rate_info ri = {
-+ .burst = 10,
-+ .interval = 40 * HZ,
-+ };
-+ struct user_beancounter *ub;
-+ char ubuid[64] = "No UB";
-+
-+ if (!ub_ratelimit(&ri))
-+ return;
-+
-+ ub = mm_ub(vma->vm_mm);
-+ if (ub)
-+ print_ub_uid(ub, ubuid, sizeof(ubuid));
-+
-+#else
-+ const char ubuid[] = "0";
-+#endif
-+
-+ printk(KERN_WARNING
-+ "%s vm_rss: process pid %d comm %.20s flags %lx, "
-+ "vma %p %08lx-%08lx %p rss %lu freed %lu\n flags %lx, "
-+ "ub %s\n",
-+ vma->vm_rss > freed ? "Positive" : "Negative",
-+ current->pid, current->comm, current->flags,
-+ vma, vma->vm_start, vma->vm_end, vma->vm_file,
-+ vma->vm_rss, freed, vma->vm_flags, ubuid);
-+ dump_stack();
-+}
-+
- static void unmap_page_range(struct mmu_gather *tlb,
- struct vm_area_struct *vma, unsigned long address,
- unsigned long end, struct zap_details *details)
- {
-+ unsigned long freed;
- pgd_t * dir;
-
- BUG_ON(address >= end);
- dir = pgd_offset(vma->vm_mm, address);
- tlb_start_vma(tlb, vma);
-+ freed = tlb->freed;
- do {
- zap_pmd_range(tlb, dir, address, end - address, details);
- address = (address + PGDIR_SIZE) & PGDIR_MASK;
- dir++;
- } while (address && (address < end));
-+ freed = tlb->freed - freed;
-+ if (freed) {
-+ ub_unused_privvm_inc(mm_ub(tlb->mm), freed, vma);
-+ if (vma->vm_rss < freed) {
-+ warn_bad_zap(vma, freed);
-+ freed = vma->vm_rss;
-+ }
-+ vma->vm_rss -= freed;
-+ }
- tlb_end_vma(tlb, vma);
- }
-
-@@ -624,6 +697,7 @@ void zap_page_range(struct vm_area_struc
- unsigned long nr_accounted = 0;
-
- if (is_vm_hugetlb_page(vma)) {
-+ /* ub acct is performed in unmap_hugepage_range */
- zap_hugepage_range(vma, address, size);
- return;
- }
-@@ -632,6 +706,8 @@ void zap_page_range(struct vm_area_struc
- spin_lock(&mm->page_table_lock);
- tlb = tlb_gather_mmu(mm, 0);
- unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details);
-+ if (vma->vm_rss && address == vma->vm_start && end == vma->vm_end)
-+ warn_bad_zap(vma, 0);
- tlb_finish_mmu(tlb, address, end);
- spin_unlock(&mm->page_table_lock);
- }
-@@ -640,23 +716,15 @@ void zap_page_range(struct vm_area_struc
- * Do a quick page-table lookup for a single page.
- * mm->page_table_lock must be held.
- */
--struct page *
--follow_page(struct mm_struct *mm, unsigned long address, int write)
-+static struct page *
-+pgd_follow_page(struct mm_struct *mm, pgd_t *pgd, unsigned long address,
-+ int write)
- {
-- pgd_t *pgd;
- pmd_t *pmd;
- pte_t *ptep, pte;
- unsigned long pfn;
- struct page *page;
-
-- page = follow_huge_addr(mm, address, write);
-- if (! IS_ERR(page))
-- return page;
--
-- pgd = pgd_offset(mm, address);
-- if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-- goto out;
--
- pmd = pmd_offset(pgd, address);
- if (pmd_none(*pmd))
- goto out;
-@@ -689,6 +757,40 @@ out:
- }
-
- struct page *
-+follow_page(struct mm_struct *mm, unsigned long address, int write)
-+{
-+ pgd_t *pgd;
-+ struct page *page;
-+
-+ page = follow_huge_addr(mm, address, write);
-+ if (! IS_ERR(page))
-+ return page;
-+
-+ pgd = pgd_offset(mm, address);
-+ if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-+ return NULL;
-+
-+ return pgd_follow_page(mm, pgd, address, write);
-+}
-+
-+struct page *
-+follow_page_k(unsigned long address, int write)
-+{
-+ pgd_t *pgd;
-+ struct page *page;
-+
-+ page = follow_huge_addr(&init_mm, address, write);
-+ if (! IS_ERR(page))
-+ return page;
-+
-+ pgd = pgd_offset_k(address);
-+ if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-+ return NULL;
-+
-+ return pgd_follow_page(&init_mm, pgd, address, write);
-+}
-+
-+struct page *
- follow_page_pte(struct mm_struct *mm, unsigned long address, int write,
- pte_t *page_pte)
- {
-@@ -1152,6 +1254,7 @@ static int do_wp_page(struct mm_struct *
- unsigned long address, pte_t *page_table, pmd_t *pmd, pte_t pte)
- {
- struct page *old_page, *new_page;
-+ struct page_beancounter *pbc;
- unsigned long pfn = pte_pfn(pte);
- pte_t entry;
-
-@@ -1181,6 +1284,7 @@ static int do_wp_page(struct mm_struct *
- #endif
- entry = maybe_mkwrite(pte_mkyoung(pte_mkdirty(pte)),
- vma);
-+ clear_bit(PG_checkpointed, &old_page->flags);
- ptep_set_access_flags(vma, address, page_table, entry, 1);
- update_mmu_cache(vma, address, entry);
- lazy_mmu_prot_update(entry);
-@@ -1198,6 +1302,9 @@ static int do_wp_page(struct mm_struct *
- page_cache_get(old_page);
- spin_unlock(&mm->page_table_lock);
-
-+ if (pb_alloc(&pbc))
-+ goto out;
-+
- if (unlikely(anon_vma_prepare(vma)))
- goto no_new_page;
- new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
-@@ -1213,10 +1320,16 @@ static int do_wp_page(struct mm_struct *
- if (likely(pte_same(*page_table, pte))) {
- if (PageAnon(old_page))
- mm->anon_rss--;
-- if (PageReserved(old_page))
-+ if (PageReserved(old_page)) {
- ++mm->rss;
-- else
-+ ++vma->vm_rss;
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
-+ } else {
- page_remove_rmap(old_page);
-+ pb_remove_ref(old_page, mm_ub(mm));
-+ }
-+
-+ pb_add_ref(new_page, mm_ub(mm), &pbc);
- break_cow(vma, new_page, address, page_table);
- lru_cache_add_active(new_page);
- page_add_anon_rmap(new_page, vma, address);
-@@ -1231,6 +1344,8 @@ static int do_wp_page(struct mm_struct *
- return VM_FAULT_MINOR;
-
- no_new_page:
-+ pb_free(&pbc);
-+out:
- page_cache_release(old_page);
- return VM_FAULT_OOM;
- }
-@@ -1440,12 +1555,21 @@ static int do_swap_page(struct mm_struct
- pte_t *page_table, pmd_t *pmd, pte_t orig_pte, int write_access)
- {
- struct page *page;
-+ struct page_beancounter *pbc;
- swp_entry_t entry = pte_to_swp_entry(orig_pte);
- pte_t pte;
-- int ret = VM_FAULT_MINOR;
-+ int ret;
-+ cycles_t start;
-
- pte_unmap(page_table);
- spin_unlock(&mm->page_table_lock);
-+ start = get_cycles();
-+ pbc = NULL;
-+ ret = VM_FAULT_OOM;
-+ if (pb_alloc(&pbc))
-+ goto out_nopbc;
-+
-+ ret = VM_FAULT_MINOR;
- page = lookup_swap_cache(entry);
- if (!page) {
- swapin_readahead(entry, address, vma);
-@@ -1482,21 +1606,25 @@ static int do_swap_page(struct mm_struct
- spin_lock(&mm->page_table_lock);
- page_table = pte_offset_map(pmd, address);
- if (unlikely(!pte_same(*page_table, orig_pte))) {
-- pte_unmap(page_table);
-- spin_unlock(&mm->page_table_lock);
-- unlock_page(page);
-- page_cache_release(page);
- ret = VM_FAULT_MINOR;
-- goto out;
-+ goto out_nomap;
-+ }
-+
-+ if (unlikely(!PageUptodate(page))) {
-+ ret = VM_FAULT_SIGBUS;
-+ goto out_nomap;
- }
-
- /* The page isn't present yet, go ahead with the fault. */
-
- swap_free(entry);
-- if (vm_swap_full())
-- remove_exclusive_swap_page(page);
-+ try_to_remove_exclusive_swap_page(page);
-
- mm->rss++;
-+ vma->vm_rss++;
-+ mm_ub(mm)->ub_perfstat[smp_processor_id()].swapin++;
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
-+ pb_add_ref(page, mm_ub(mm), &pbc);
- pte = mk_pte(page, vma->vm_page_prot);
- if (write_access && can_share_swap_page(page)) {
- pte = maybe_mkwrite(pte_mkdirty(pte), vma);
-@@ -1521,7 +1649,19 @@ static int do_swap_page(struct mm_struct
- pte_unmap(page_table);
- spin_unlock(&mm->page_table_lock);
- out:
-+ pb_free(&pbc);
-+ spin_lock_irq(&kstat_glb_lock);
-+ KSTAT_LAT_ADD(&kstat_glob.swap_in, get_cycles() - start);
-+ spin_unlock_irq(&kstat_glb_lock);
-+out_nopbc:
- return ret;
-+
-+out_nomap:
-+ pte_unmap(page_table);
-+ spin_unlock(&mm->page_table_lock);
-+ unlock_page(page);
-+ page_cache_release(page);
-+ goto out;
- }
-
- /*
-@@ -1536,16 +1676,20 @@ do_anonymous_page(struct mm_struct *mm,
- {
- pte_t entry;
- struct page * page = ZERO_PAGE(addr);
-+ struct page_beancounter *pbc;
-
- /* Read-only mapping of ZERO_PAGE. */
- entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot));
-
- /* ..except if it's a write access */
-+ pbc = NULL;
- if (write_access) {
- /* Allocate our own private page. */
- pte_unmap(page_table);
- spin_unlock(&mm->page_table_lock);
-
-+ if (pb_alloc(&pbc))
-+ goto no_mem;
- if (unlikely(anon_vma_prepare(vma)))
- goto no_mem;
- page = alloc_page_vma(GFP_HIGHUSER, vma, addr);
-@@ -1563,6 +1707,9 @@ do_anonymous_page(struct mm_struct *mm,
- goto out;
- }
- mm->rss++;
-+ vma->vm_rss++;
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
-+ pb_add_ref(page, mm_ub(mm), &pbc);
- entry = maybe_mkwrite(pte_mkdirty(mk_pte(page,
- vma->vm_page_prot)),
- vma);
-@@ -1579,8 +1726,10 @@ do_anonymous_page(struct mm_struct *mm,
- lazy_mmu_prot_update(entry);
- spin_unlock(&mm->page_table_lock);
- out:
-+ pb_free(&pbc);
- return VM_FAULT_MINOR;
- no_mem:
-+ pb_free(&pbc);
- return VM_FAULT_OOM;
- }
-
-@@ -1601,6 +1750,7 @@ do_no_page(struct mm_struct *mm, struct
- unsigned long address, int write_access, pte_t *page_table, pmd_t *pmd)
- {
- struct page * new_page;
-+ struct page_beancounter *pbc;
- struct address_space *mapping = NULL;
- pte_t entry;
- int sequence = 0;
-@@ -1613,6 +1763,9 @@ do_no_page(struct mm_struct *mm, struct
- pte_unmap(page_table);
- spin_unlock(&mm->page_table_lock);
-
-+ if (pb_alloc(&pbc))
-+ return VM_FAULT_OOM;
-+
- if (vma->vm_file) {
- mapping = vma->vm_file->f_mapping;
- sequence = atomic_read(&mapping->truncate_count);
-@@ -1622,10 +1775,14 @@ retry:
- new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, &ret);
-
- /* no page was available -- either SIGBUS or OOM */
-- if (new_page == NOPAGE_SIGBUS)
-+ if (new_page == NOPAGE_SIGBUS) {
-+ pb_free(&pbc);
- return VM_FAULT_SIGBUS;
-- if (new_page == NOPAGE_OOM)
-+ }
-+ if (new_page == NOPAGE_OOM) {
-+ pb_free(&pbc);
- return VM_FAULT_OOM;
-+ }
-
- /*
- * Should we do an early C-O-W break?
-@@ -1671,8 +1828,12 @@ retry:
- */
- /* Only go through if we didn't race with anybody else... */
- if (pte_none(*page_table)) {
-- if (!PageReserved(new_page))
-+ if (!PageReserved(new_page)) {
- ++mm->rss;
-+ ++vma->vm_rss;
-+ ub_unused_privvm_dec(mm_ub(mm), 1, vma);
-+ pb_add_ref(new_page, mm_ub(mm), &pbc);
-+ }
- flush_icache_page(vma, new_page);
- entry = mk_pte(new_page, vma->vm_page_prot);
- if (write_access)
-@@ -1697,6 +1858,7 @@ retry:
- lazy_mmu_prot_update(entry);
- spin_unlock(&mm->page_table_lock);
- out:
-+ pb_free(&pbc);
- return ret;
- oom:
- page_cache_release(new_page);
-@@ -1804,6 +1966,28 @@ int handle_mm_fault(struct mm_struct *mm
- pgd_t *pgd;
- pmd_t *pmd;
-
-+#ifdef CONFIG_VZ_GENCALLS
-+ do {
-+ int ret;
-+#ifdef CONFIG_USER_RESOURCE
-+ struct task_beancounter *tbc;
-+
-+ tbc = task_bc(current);
-+ if (!test_bit(UB_AFLAG_NOTIF_PAGEIN, &mm_ub(mm)->ub_aflags) &&
-+ tbc->pgfault_allot) {
-+ tbc->pgfault_allot--;
-+ break; /* skip notifier */
-+ }
-+#endif
-+ ret = virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_PAGEIN,
-+ (void *)1);
-+ if (ret & NOTIFY_FAIL)
-+ return VM_FAULT_SIGBUS;
-+ if (ret & NOTIFY_OK)
-+ return VM_FAULT_MINOR; /* retry */
-+ } while (0);
-+#endif
-+
- __set_current_state(TASK_RUNNING);
- pgd = pgd_offset(mm, address);
-
-@@ -1827,6 +2011,7 @@ int handle_mm_fault(struct mm_struct *mm
- spin_unlock(&mm->page_table_lock);
- return VM_FAULT_OOM;
- }
-+EXPORT_SYMBOL(handle_mm_fault);
-
- /*
- * Allocate page middle directory.
-@@ -1859,6 +2044,7 @@ pmd_t fastcall *__pmd_alloc(struct mm_st
- out:
- return pmd_offset(pgd, address);
- }
-+EXPORT_SYMBOL(__pmd_alloc);
-
- int make_pages_present(unsigned long addr, unsigned long end)
- {
-@@ -1880,6 +2066,7 @@ int make_pages_present(unsigned long add
- return ret;
- return ret == len ? 0 : -1;
- }
-+EXPORT_SYMBOL(make_pages_present);
-
- /*
- * Map a vmalloc()-space virtual address to the physical page.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mempolicy.c linux-2.6.9-ve023stab030/mm/mempolicy.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mempolicy.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mempolicy.c 2006-10-11 19:07:55.000000000 +0400
-@@ -136,6 +136,8 @@ static int get_nodes(unsigned long *node
- bitmap_zero(nodes, MAX_NUMNODES);
- if (maxnode == 0 || !nmask)
- return 0;
-+ if (maxnode > PAGE_SIZE*8 /*BITS_PER_BYTE*/)
-+ return -EINVAL;
-
- nlongs = BITS_TO_LONGS(maxnode);
- if ((maxnode % BITS_PER_LONG) == 0)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mempool.c linux-2.6.9-ve023stab030/mm/mempool.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mempool.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mempool.c 2006-10-11 19:07:56.000000000 +0400
-@@ -10,6 +10,7 @@
-
- #include <linux/mm.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/module.h>
- #include <linux/mempool.h>
- #include <linux/blkdev.h>
-@@ -72,6 +73,9 @@ mempool_t * mempool_create(int min_nr, m
- pool->alloc = alloc_fn;
- pool->free = free_fn;
-
-+ if (alloc_fn == mempool_alloc_slab)
-+ kmem_mark_nocharge((kmem_cache_t *)pool_data);
-+
- /*
- * First pre-allocate the guaranteed number of buffers.
- */
-@@ -112,6 +116,7 @@ int mempool_resize(mempool_t *pool, int
- unsigned long flags;
-
- BUG_ON(new_min_nr <= 0);
-+ gfp_mask &= ~__GFP_UBC;
-
- spin_lock_irqsave(&pool->lock, flags);
- if (new_min_nr < pool->min_nr) {
-@@ -194,6 +199,9 @@ void * mempool_alloc(mempool_t *pool, in
- DEFINE_WAIT(wait);
- int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
-
-+ gfp_mask &= ~__GFP_UBC;
-+ gfp_nowait &= ~__GFP_UBC;
-+
- might_sleep_if(gfp_mask & __GFP_WAIT);
- repeat_alloc:
- element = pool->alloc(gfp_nowait|__GFP_NOWARN, pool->pool_data);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mlock.c linux-2.6.9-ve023stab030/mm/mlock.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mlock.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mlock.c 2006-10-11 19:07:59.000000000 +0400
-@@ -8,6 +8,9 @@
- #include <linux/mman.h>
- #include <linux/mm.h>
-
-+#include <ub/ub_vmpages.h>
-+#include <linux/module.h>
-+
-
- static int mlock_fixup(struct vm_area_struct * vma,
- unsigned long start, unsigned long end, unsigned int newflags)
-@@ -19,17 +22,23 @@ static int mlock_fixup(struct vm_area_st
- if (newflags == vma->vm_flags)
- goto out;
-
-+ if (newflags & VM_LOCKED) {
-+ ret = ub_locked_mem_charge(mm_ub(mm), end - start);
-+ if (ret < 0)
-+ goto out;
-+ }
-+
- if (start != vma->vm_start) {
- if (split_vma(mm, vma, start, 1)) {
- ret = -EAGAIN;
-- goto out;
-+ goto out_uncharge;
- }
- }
-
- if (end != vma->vm_end) {
- if (split_vma(mm, vma, end, 0)) {
- ret = -EAGAIN;
-- goto out;
-+ goto out_uncharge;
- }
- }
-
-@@ -48,9 +57,17 @@ static int mlock_fixup(struct vm_area_st
- pages = -pages;
- if (!(newflags & VM_IO))
- ret = make_pages_present(start, end);
-+ } else {
-+ /* uncharge this memory, since it was unlocked */
-+ ub_locked_mem_uncharge(mm_ub(mm), end - start);
- }
-
- vma->vm_mm->locked_vm -= pages;
-+ return ret;
-+
-+out_uncharge:
-+ if (newflags & VM_LOCKED)
-+ ub_locked_mem_uncharge(mm_ub(mm), end - start);
- out:
- return ret;
- }
-@@ -125,6 +142,7 @@ asmlinkage long sys_mlock(unsigned long
- up_write(&current->mm->mmap_sem);
- return error;
- }
-+EXPORT_SYMBOL(sys_mlock);
-
- asmlinkage long sys_munlock(unsigned long start, size_t len)
- {
-@@ -137,6 +155,7 @@ asmlinkage long sys_munlock(unsigned lon
- up_write(&current->mm->mmap_sem);
- return ret;
- }
-+EXPORT_SYMBOL(sys_munlock);
-
- static int do_mlockall(int flags)
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mmap.c linux-2.6.9-ve023stab030/mm/mmap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mmap.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mmap.c 2006-10-11 19:07:59.000000000 +0400
-@@ -29,6 +29,8 @@
- #include <asm/cacheflush.h>
- #include <asm/tlb.h>
-
-+#include <ub/ub_vmpages.h>
-+
- /*
- * WARNING: the debugging will use recursive algorithms so never enable this
- * unless you know what you are doing.
-@@ -96,6 +98,8 @@ static void remove_vm_struct(struct vm_a
- struct file *file = vma->vm_file;
-
- might_sleep();
-+ ub_memory_uncharge(mm_ub(vma->vm_mm), vma->vm_end - vma->vm_start,
-+ vma->vm_flags, vma->vm_file);
- if (file) {
- struct address_space *mapping = file->f_mapping;
- spin_lock(&mapping->i_mmap_lock);
-@@ -111,6 +115,7 @@ static void remove_vm_struct(struct vm_a
- kmem_cache_free(vm_area_cachep, vma);
- }
-
-+static unsigned long __do_brk(unsigned long, unsigned long, int);
- /*
- * sys_brk() for the most part doesn't need the global kernel
- * lock, except when an application is doing something nasty
-@@ -150,7 +155,7 @@ asmlinkage unsigned long sys_brk(unsigne
- goto out;
-
- /* Ok, looks good - let it rip. */
-- if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk)
-+ if (__do_brk(oldbrk, newbrk-oldbrk, UB_HARD) != oldbrk)
- goto out;
- set_brk:
- mm->brk = brk;
-@@ -613,6 +618,7 @@ struct vm_area_struct *vma_merge(struct
- {
- pgoff_t pglen = (end - addr) >> PAGE_SHIFT;
- struct vm_area_struct *area, *next;
-+ unsigned long extra_rss;
-
- /*
- * We later require that vma->vm_flags == vm_flags,
-@@ -626,8 +632,12 @@ struct vm_area_struct *vma_merge(struct
- else
- next = mm->mmap;
- area = next;
-- if (next && next->vm_end == end) /* cases 6, 7, 8 */
-+ extra_rss = 0;
-+ spin_lock(&mm->page_table_lock);
-+ if (next && next->vm_end == end) { /* cases 6, 7, 8 */
- next = next->vm_next;
-+ extra_rss = area->vm_rss; /* asterix below */
-+ }
-
- /*
- * Can it merge with the predecessor?
-@@ -646,11 +656,28 @@ struct vm_area_struct *vma_merge(struct
- is_mergeable_anon_vma(prev->anon_vma,
- next->anon_vma)) {
- /* cases 1, 6 */
-+ /* case 1 : prev->vm_rss += next->vm_rss
-+ * case 6*: prev->vm_rss += area->vm_rss + next->vm_rss
-+ */
-+ prev->vm_rss += next->vm_rss + extra_rss;
-+ spin_unlock(&mm->page_table_lock);
- vma_adjust(prev, prev->vm_start,
- next->vm_end, prev->vm_pgoff, NULL);
-- } else /* cases 2, 5, 7 */
-+ } else { /* cases 2, 5, 7 */
-+ /* case 2 : nothing
-+ * case 5 : prev->vm_rss += pages_in(addr, end)
-+ * next->vm_rss -= pages_in(addr, end)
-+ * case 7*: prev->vm_rss += area->vm_rss
-+ */
-+ if (next && addr == next->vm_start) { /* case 5 */
-+ extra_rss = pages_in_vma_range(next, addr, end);
-+ next->vm_rss -= extra_rss;
-+ }
-+ prev->vm_rss += extra_rss;
-+ spin_unlock(&mm->page_table_lock);
- vma_adjust(prev, prev->vm_start,
- end, prev->vm_pgoff, NULL);
-+ }
- if (prev->vm_flags & VM_EXEC)
- arch_add_exec_range(mm, prev->vm_end);
- return prev;
-@@ -663,15 +690,29 @@ struct vm_area_struct *vma_merge(struct
- mpol_equal(policy, vma_policy(next)) &&
- can_vma_merge_before(next, vm_flags,
- anon_vma, file, pgoff+pglen)) {
-- if (prev && addr < prev->vm_end) /* case 4 */
-+ if (prev && addr < prev->vm_end) { /* case 4 */
-+ /* case 4 : prev->vm_rss -= pages_in(addr, end)
-+ * next->vm_rss += pages_in(addr, end)
-+ */
-+ extra_rss = pages_in_vma_range(prev, addr, end);
-+ prev->vm_rss -= extra_rss;
-+ next->vm_rss += extra_rss;
-+ spin_unlock(&mm->page_table_lock);
- vma_adjust(prev, prev->vm_start,
- addr, prev->vm_pgoff, NULL);
-- else /* cases 3, 8 */
-+ } else { /* cases 3, 8 */
-+ /* case 3 : nothing
-+ * case 8*: next->vm_rss += area->vm_rss
-+ */
-+ next->vm_rss += extra_rss;
-+ spin_unlock(&mm->page_table_lock);
- vma_adjust(area, addr, next->vm_end,
- next->vm_pgoff - pglen, NULL);
-+ }
- return area;
- }
-
-+ spin_unlock(&mm->page_table_lock);
- return NULL;
- }
-
-@@ -816,6 +857,11 @@ unsigned long do_mmap_pgoff(struct file
- if (!len || len > TASK_SIZE)
- return -EINVAL;
-
-+#ifdef ARCH_HAS_MMAP_CHECK
-+ if (arch_mmap_check(addr, len))
-+ return -EINVAL;
-+#endif
-+
- /* offset overflow? */
- if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
- return -EINVAL;
-@@ -824,6 +870,12 @@ unsigned long do_mmap_pgoff(struct file
- if (mm->map_count > sysctl_max_map_count)
- return -ENOMEM;
-
-+ if (file && (prot & PROT_EXEC)) {
-+ error = check_area_execute_ve(file->f_dentry, file->f_vfsmnt);
-+ if (error)
-+ return error;
-+ }
-+
- /* Obtain the address to map to. we verify (or select) it and ensure
- * that it represents a valid section of the address space.
- */
-@@ -938,6 +990,11 @@ munmap_back:
- }
- }
-
-+ error = -ENOMEM;
-+ if (ub_memory_charge(mm_ub(mm), len, vm_flags, file,
-+ (flags & MAP_EXECPRIO ? UB_SOFT : UB_HARD)))
-+ goto uncharge_error;
-+
- /*
- * Can we just expand an old private anonymous mapping?
- * The VM_SHARED test is necessary because shmem_zero_setup
-@@ -953,7 +1010,8 @@ munmap_back:
- * specific mapper. the address has already been validated, but
- * not unmapped, but the maps are removed from the list.
- */
-- vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-+ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL |
-+ (flags & MAP_EXECPRIO ? __GFP_SOFT_UBC : 0));
- if (!vma) {
- error = -ENOMEM;
- goto unacct_error;
-@@ -964,6 +1022,7 @@ munmap_back:
- vma->vm_start = addr;
- vma->vm_end = addr + len;
- vma->vm_flags = vm_flags;
-+ vma->vm_rss = 0;
- vma->vm_page_prot = protection_map[vm_flags & 0x0f];
- vma->vm_pgoff = pgoff;
-
-@@ -1046,6 +1105,8 @@ unmap_and_free_vma:
- free_vma:
- kmem_cache_free(vm_area_cachep, vma);
- unacct_error:
-+ ub_memory_uncharge(mm_ub(mm), len, vm_flags, file);
-+uncharge_error:
- if (charged)
- vm_unacct_memory(charged);
- return error;
-@@ -1464,18 +1525,18 @@ int expand_stack(struct vm_area_struct *
-
- if (over_stack_limit(address - vma->vm_start) ||
- ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) >
-- current->rlim[RLIMIT_AS].rlim_cur) {
-- anon_vma_unlock(vma);
-- vm_unacct_memory(grow);
-- return -ENOMEM;
-- }
-+ current->rlim[RLIMIT_AS].rlim_cur)
-+ goto out_nomem;
-+
- if ((vma->vm_flags & VM_LOCKED) && !capable(CAP_IPC_LOCK) &&
- ((vma->vm_mm->locked_vm + grow) << PAGE_SHIFT) >
-- current->rlim[RLIMIT_MEMLOCK].rlim_cur) {
-- anon_vma_unlock(vma);
-- vm_unacct_memory(grow);
-- return -ENOMEM;
-- }
-+ current->rlim[RLIMIT_MEMLOCK].rlim_cur)
-+ goto out_nomem;
-+
-+ if (ub_memory_charge(mm_ub(vma->vm_mm), address - vma->vm_end,
-+ vma->vm_flags, vma->vm_file, UB_SOFT))
-+ goto out_nomem;
-+
- vma->vm_end = address;
- vma->vm_mm->total_vm += grow;
- if (vma->vm_flags & VM_LOCKED)
-@@ -1483,6 +1544,11 @@ int expand_stack(struct vm_area_struct *
- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
- anon_vma_unlock(vma);
- return 0;
-+
-+out_nomem:
-+ anon_vma_unlock(vma);
-+ vm_unacct_memory(grow);
-+ return -ENOMEM;
- }
-
- struct vm_area_struct *
-@@ -1538,18 +1604,18 @@ int expand_stack(struct vm_area_struct *
-
- if (over_stack_limit(vma->vm_end - address) ||
- ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) >
-- current->rlim[RLIMIT_AS].rlim_cur) {
-- anon_vma_unlock(vma);
-- vm_unacct_memory(grow);
-- return -ENOMEM;
-- }
-+ current->rlim[RLIMIT_AS].rlim_cur)
-+ goto out_nomem;
-+
- if ((vma->vm_flags & VM_LOCKED) && !capable(CAP_IPC_LOCK) &&
- ((vma->vm_mm->locked_vm + grow) << PAGE_SHIFT) >
-- current->rlim[RLIMIT_MEMLOCK].rlim_cur) {
-- anon_vma_unlock(vma);
-- vm_unacct_memory(grow);
-- return -ENOMEM;
-- }
-+ current->rlim[RLIMIT_MEMLOCK].rlim_cur)
-+ goto out_nomem;
-+
-+ if (ub_memory_charge(mm_ub(vma->vm_mm), vma->vm_start - address,
-+ vma->vm_flags, vma->vm_file, UB_SOFT))
-+ goto out_nomem;
-+
- vma->vm_start = address;
- vma->vm_pgoff -= grow;
- vma->vm_mm->total_vm += grow;
-@@ -1558,6 +1624,11 @@ int expand_stack(struct vm_area_struct *
- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
- anon_vma_unlock(vma);
- return 0;
-+
-+out_nomem:
-+ anon_vma_unlock(vma);
-+ vm_unacct_memory(grow);
-+ return -ENOMEM;
- }
-
- struct vm_area_struct *
-@@ -1782,8 +1853,14 @@ int split_vma(struct mm_struct * mm, str
- } else
- vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
-
-+ spin_lock(&mm->page_table_lock);
-+ new->vm_rss = pages_in_vma(new);
-+ vma->vm_rss = pages_in_vma(vma);
-+ spin_unlock(&mm->page_table_lock);
-+
- return 0;
- }
-+EXPORT_SYMBOL(split_vma);
-
- /* Munmap is split into 2 main parts -- this part which finds
- * what needs doing, and the areas themselves, which do the
-@@ -1874,7 +1951,7 @@ asmlinkage long sys_munmap(unsigned long
- * anonymous maps. eventually we may be able to do some
- * brk-specific accounting here.
- */
--unsigned long do_brk(unsigned long addr, unsigned long len)
-+static unsigned long __do_brk(unsigned long addr, unsigned long len, int lowpri)
- {
- struct mm_struct * mm = current->mm;
- struct vm_area_struct * vma, * prev;
-@@ -1886,6 +1963,11 @@ unsigned long do_brk(unsigned long addr,
- if (!len)
- return addr;
-
-+#ifdef ARCH_HAS_MMAP_CHECK
-+ if (arch_mmap_check(addr, len))
-+ return -EINVAL;
-+#endif
-+
- if ((addr + len) > TASK_SIZE || (addr + len) < addr)
- return -EINVAL;
-
-@@ -1925,6 +2007,10 @@ unsigned long do_brk(unsigned long addr,
-
- flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
-
-+ if (ub_memory_charge(mm_ub(mm), len, flags, NULL, lowpri))
-+ goto out_unacct;
-+
-+
- /* Can we just expand an old private anonymous mapping? */
- if (vma_merge(mm, prev, addr, addr + len, flags,
- NULL, NULL, pgoff, NULL))
-@@ -1933,8 +2019,11 @@ unsigned long do_brk(unsigned long addr,
- /*
- * create a vma struct for an anonymous mapping
- */
-- vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-+ vma = kmem_cache_alloc(vm_area_cachep,
-+ SLAB_KERNEL | (lowpri ? 0 : __GFP_SOFT_UBC));
- if (!vma) {
-+ ub_memory_uncharge(mm_ub(mm), len, flags, NULL);
-+out_unacct:
- vm_unacct_memory(len >> PAGE_SHIFT);
- return -ENOMEM;
- }
-@@ -1945,6 +2034,7 @@ unsigned long do_brk(unsigned long addr,
- vma->vm_end = addr + len;
- vma->vm_pgoff = pgoff;
- vma->vm_flags = flags;
-+ vma->vm_rss = 0;
- vma->vm_page_prot = protection_map[flags & 0x0f];
- vma_link(mm, vma, prev, rb_link, rb_parent);
- out:
-@@ -1956,6 +2046,11 @@ out:
- return addr;
- }
-
-+unsigned long do_brk(unsigned long addr, unsigned long len)
-+{
-+ return __do_brk(addr, len, UB_SOFT);
-+}
-+
- EXPORT_SYMBOL(do_brk);
-
- /* locking version of do_brk. */
-@@ -1964,7 +2059,7 @@ unsigned long do_brk_locked(unsigned lon
- unsigned long ret;
-
- down_write(&current->mm->mmap_sem);
-- ret = do_brk(addr, len);
-+ ret = __do_brk(addr, len, UB_SOFT);
- up_write(&current->mm->mmap_sem);
-
- return ret;
-@@ -2090,6 +2185,7 @@ struct vm_area_struct *copy_vma(struct v
- new_vma->vm_start = addr;
- new_vma->vm_end = addr + len;
- new_vma->vm_pgoff = pgoff;
-+ new_vma->vm_rss = 0;
- if (new_vma->vm_file)
- get_file(new_vma->vm_file);
- if (new_vma->vm_ops && new_vma->vm_ops->open)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mprotect.c linux-2.6.9-ve023stab030/mm/mprotect.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mprotect.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mprotect.c 2006-10-11 19:07:59.000000000 +0400
-@@ -18,6 +18,7 @@
- #include <linux/security.h>
- #include <linux/mempolicy.h>
- #include <linux/personality.h>
-+#include <linux/module.h>
-
- #include <asm/uaccess.h>
- #include <asm/pgtable.h>
-@@ -25,6 +26,8 @@
- #include <asm/cacheflush.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_vmpages.h>
-+
- static inline void
- change_pte_range(pmd_t *pmd, unsigned long address,
- unsigned long size, pgprot_t newprot)
-@@ -116,6 +119,8 @@ mprotect_fixup(struct vm_area_struct *vm
- {
- struct mm_struct * mm = vma->vm_mm;
- unsigned long charged = 0, old_end = vma->vm_end;
-+ unsigned long vma_rss;
-+ int prot_dir;
- pgprot_t newprot;
- unsigned int oldflags;
- pgoff_t pgoff;
-@@ -126,6 +131,17 @@ mprotect_fixup(struct vm_area_struct *vm
- return 0;
- }
-
-+ spin_lock(&mm->page_table_lock);
-+ vma_rss = pages_in_vma_range(vma, start, end);
-+ spin_unlock(&mm->page_table_lock);
-+ charged = ((end - start) >> PAGE_SHIFT);
-+
-+ prot_dir = ub_protected_charge(mm_ub(mm), charged - vma_rss,
-+ newflags, vma);
-+ error = -ENOMEM;
-+ if (prot_dir == PRIVVM_ERROR)
-+ goto fail_nocharge;
-+
- /*
- * If we make a private mapping writable we increase our commit;
- * but (without finer accounting) cannot reduce our commit if we
-@@ -136,9 +152,8 @@ mprotect_fixup(struct vm_area_struct *vm
- */
- if (newflags & VM_WRITE) {
- if (!(vma->vm_flags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) {
-- charged = (end - start) >> PAGE_SHIFT;
- if (security_vm_enough_memory(charged))
-- return -ENOMEM;
-+ goto fail_noacct;
- newflags |= VM_ACCOUNT;
- }
- }
-@@ -185,11 +200,17 @@ success:
- if (oldflags & VM_EXEC)
- arch_remove_exec_range(current->mm, old_end);
- change_protection(vma, start, end, newprot);
-+ if (prot_dir == PRIVVM_TO_SHARED)
-+ __ub_unused_privvm_dec(mm_ub(mm), charged - vma_rss);
- vm_stat_account(vma);
- return 0;
-
- fail:
- vm_unacct_memory(charged);
-+fail_noacct:
-+ if (prot_dir == PRIVVM_TO_PRIVATE)
-+ __ub_unused_privvm_dec(mm_ub(mm), charged - vma_rss);
-+fail_nocharge:
- return error;
- }
-
-@@ -294,3 +315,4 @@ out:
- up_write(&current->mm->mmap_sem);
- return error;
- }
-+EXPORT_SYMBOL(sys_mprotect);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/mremap.c linux-2.6.9-ve023stab030/mm/mremap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/mremap.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/mremap.c 2006-10-11 19:07:56.000000000 +0400
-@@ -21,6 +21,8 @@
- #include <asm/cacheflush.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_vmpages.h>
-+
- static pte_t *get_one_pte_map_nested(struct mm_struct *mm, unsigned long addr)
- {
- pgd_t *pgd;
-@@ -81,6 +83,7 @@ static inline pte_t *alloc_one_pte_map(s
-
- static int
- move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
-+ struct vm_area_struct *new_vma,
- unsigned long new_addr)
- {
- struct address_space *mapping = NULL;
-@@ -129,6 +132,8 @@ move_one_page(struct vm_area_struct *vma
- pte_t pte;
- pte = ptep_clear_flush(vma, old_addr, src);
- set_pte(dst, pte);
-+ vma->vm_rss--;
-+ new_vma->vm_rss++;
- } else
- error = -ENOMEM;
- pte_unmap_nested(src);
-@@ -143,6 +148,7 @@ move_one_page(struct vm_area_struct *vma
- }
-
- static unsigned long move_page_tables(struct vm_area_struct *vma,
-+ struct vm_area_struct *new_vma,
- unsigned long new_addr, unsigned long old_addr,
- unsigned long len)
- {
-@@ -156,7 +162,8 @@ static unsigned long move_page_tables(st
- * only a few pages.. This also makes error recovery easier.
- */
- for (offset = 0; offset < len; offset += PAGE_SIZE) {
-- if (move_one_page(vma, old_addr+offset, new_addr+offset) < 0)
-+ if (move_one_page(vma, old_addr+offset,
-+ new_vma, new_addr+offset) < 0)
- break;
- cond_resched();
- }
-@@ -175,26 +182,29 @@ static unsigned long move_vma(struct vm_
- unsigned long excess = 0;
- int split = 0;
-
-+ if (ub_memory_charge(mm_ub(mm), new_len, vma->vm_flags,
-+ vma->vm_file, UB_HARD))
-+ return -ENOMEM;
- /*
- * We'd prefer to avoid failure later on in do_munmap:
- * which may split one vma into three before unmapping.
- */
- if (mm->map_count >= sysctl_max_map_count - 3)
-- return -ENOMEM;
-+ goto out_nomem;
-
- new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT);
- new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff);
- if (!new_vma)
-- return -ENOMEM;
-+ goto out_nomem;
-
-- moved_len = move_page_tables(vma, new_addr, old_addr, old_len);
-+ moved_len = move_page_tables(vma, new_vma, new_addr, old_addr, old_len);
- if (moved_len < old_len) {
- /*
- * On error, move entries back from new area to old,
- * which will succeed since page tables still there,
- * and then proceed to unmap new area instead of old.
- */
-- move_page_tables(new_vma, old_addr, new_addr, moved_len);
-+ move_page_tables(new_vma, vma, old_addr, new_addr, moved_len);
- vma = new_vma;
- old_len = new_len;
- old_addr = new_addr;
-@@ -232,7 +242,12 @@ static unsigned long move_vma(struct vm_
- new_addr + new_len);
- }
-
-- return new_addr;
-+ if (new_addr != -ENOMEM)
-+ return new_addr;
-+
-+out_nomem:
-+ ub_memory_uncharge(mm_ub(mm), new_len, vma->vm_flags, vma->vm_file);
-+ return -ENOMEM;
- }
-
- /*
-@@ -357,6 +372,12 @@ unsigned long do_mremap(unsigned long ad
- if (max_addr - addr >= new_len) {
- int pages = (new_len - old_len) >> PAGE_SHIFT;
-
-+ ret = ub_memory_charge(mm_ub(vma->vm_mm),
-+ new_len - old_len, vma->vm_flags,
-+ vma->vm_file, UB_HARD);
-+ if (ret != 0)
-+ goto out;
-+
- vma_adjust(vma, vma->vm_start,
- addr + new_len, vma->vm_pgoff, NULL);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/oom_kill.c linux-2.6.9-ve023stab030/mm/oom_kill.c
---- linux-2.6.9-42.0.3.EL.orig/mm/oom_kill.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/oom_kill.c 2006-10-11 19:08:02.000000000 +0400
-@@ -15,11 +15,23 @@
- * kernel subsystems and hints as to where to find out what things do.
- */
-
-+#include <linux/bitops.h>
- #include <linux/mm.h>
- #include <linux/sched.h>
-+#include <linux/virtinfo.h>
-+#include <linux/module.h>
- #include <linux/swap.h>
- #include <linux/timex.h>
- #include <linux/jiffies.h>
-+#include <linux/slab.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+
-+spinlock_t oom_generation_lock = SPIN_LOCK_UNLOCKED;
-+static DECLARE_WAIT_QUEUE_HEAD(oom_waitqh);
-+int oom_kill_counter;
-+int oom_generation;
-
- int oom_kill_enabled = 1;
-
-@@ -51,7 +63,7 @@ static unsigned long badness(struct task
- if (!p->mm)
- return 0;
-
-- if (p->flags & PF_MEMDIE)
-+ if (test_tsk_thread_flag(p, TIF_MEMDIE))
- return 0;
- /*
- * The memory size of the process is the basis for the badness.
-@@ -113,25 +125,50 @@ static unsigned long badness(struct task
- *
- * (not docbooked, we don't want this one cluttering up the manual)
- */
--static struct task_struct * select_bad_process(void)
-+static struct task_struct * select_bad_process(struct user_beancounter *ub)
- {
-+ unsigned long points;
- unsigned long maxpoints = 0;
- struct task_struct *g, *p;
- struct task_struct *chosen = NULL;
- struct timespec uptime;
-+ struct user_beancounter *mub;
-
- do_posix_clock_monotonic_gettime(&uptime);
-- do_each_thread(g, p)
-- if (p->pid) {
-- unsigned long points = badness(p, uptime.tv_sec);
-- if (points > maxpoints) {
-- chosen = p;
-- maxpoints = points;
-- }
-- if (p->flags & PF_SWAPOFF)
-- return p;
-+ do_each_thread_all(g, p) {
-+ if (!p->pid)
-+ continue;
-+ if (!p->mm)
-+ continue;
-+
-+#if 0
-+ /*
-+ * swapoff check.
-+ * Pro: do not let opportunistic swapoff kill the whole system;
-+ * if the system enter OOM state, better stop swapoff.
-+ * Contra: essential services must survive without swap
-+ * (otherwise, the system is grossly misconfigured),
-+ * and disabling swapoff completely, with cryptic diagnostic
-+ * "interrupted system call", looks like a bad idea.
-+ * 2006/02/28 SAW
-+ */
-+ if (!test_tsk_thread_flag(p, TIF_MEMDIE) &&
-+ (p->flags & PF_SWAPOFF))
-+ return p;
-+#endif
-+
-+ for (mub = mm_ub(p->mm); mub != NULL; mub = mub->parent)
-+ if (mub == ub)
-+ break;
-+ if (mub != ub) /* wrong beancounter */
-+ continue;
-+
-+ points = badness(p, uptime.tv_sec);
-+ if (points > maxpoints) {
-+ chosen = p;
-+ maxpoints = points;
- }
-- while_each_thread(g, p);
-+ } while_each_thread_all(g, p);
- return chosen;
- }
-
-@@ -150,15 +187,25 @@ static void __oom_kill_task(task_t *p)
- return;
- }
- task_unlock(p);
-- printk(KERN_ERR "Out of Memory: Killed process %d (%s).\n", p->pid, p->comm);
-+ printk(KERN_ERR "Out of Memory: Killing process %d (%.20s), flags=%lx, "
-+ "mm=%p gen=%d count=%d.\n",
-+ p->pid, p->comm, p->flags, p->mm,
-+ oom_generation, oom_kill_counter + 1);
-
- /*
- * We give our sacrificial lamb high priority and access to
- * all the memory it needs. That way it should be able to
- * exit() and clear out its resources quickly...
-- */
-- p->time_slice = HZ;
-- p->flags |= PF_MEMALLOC | PF_MEMDIE;
-+ *
-+ * This code used to be a mainstream bug.
-+ * It won't work for p != current. 20060607 SAW
-+ */
-+ if (p == current)
-+ p->time_slice = HZ;
-+ set_tsk_thread_flag(p, TIF_MEMDIE);
-+
-+ /* oom_generation_lock must be held */
-+ oom_kill_counter++;
-
- /* This process has hardware access, be more careful. */
- if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO)) {
-@@ -168,28 +215,86 @@ static void __oom_kill_task(task_t *p)
- }
- }
-
--static struct mm_struct *oom_kill_task(task_t *p)
-+/**
-+ * oom_kill - do a complete job of killing a process
-+ *
-+ * Returns TRUE if selected process is unkillable.
-+ * Called with oom_generation_lock and tasklist_lock held, drops them.
-+ */
-+static int oom_kill(struct task_struct *p,
-+ struct user_beancounter *ub, long ub_maxover)
- {
-- struct mm_struct *mm = get_task_mm(p);
-- if (!mm || mm == &init_mm)
-- return NULL;
-+ struct mm_struct *mm;
-+ struct task_struct *g, *q;
-+ uid_t ub_uid;
-+ int suicide;
-+
-+ mm = get_task_mm(p);
-+ if (mm == &init_mm) {
-+ mmput(mm);
-+ mm = NULL;
-+ }
-+ if (mm == NULL)
-+ return -1;
-+
-+ /*
-+ * The following message showing mm, its size, and free space
-+ * should be printed regardless of CONFIG_USER_RESOURCE.
-+ */
-+ ub_uid = (ub ? ub->ub_uid : -1);
-+ printk(KERN_INFO"MM to kill %p (UB=%d, UBover=%ld, VM=%lu, free=%u).\n",
-+ mm, ub_uid, ub_maxover,
-+ mm->total_vm, nr_free_pages());
-+
-+ /*
-+ * kill all processes that share the ->mm (i.e. all threads),
-+ * but are in a different thread group
-+ */
-+ suicide = 0;
- __oom_kill_task(p);
-- return mm;
--}
-+ if (p == current)
-+ suicide = 1;
-+ do_each_thread_all(g, q) {
-+ if (q->mm == mm && q->tgid != p->tgid) {
-+ __oom_kill_task(q);
-+ if (q == current)
-+ suicide = 1;
-+ }
-+ } while_each_thread_all(g, q);
-+ read_unlock(&tasklist_lock);
-
-+ wake_up_all(&oom_waitqh);
-+ spin_unlock(&oom_generation_lock);
-+ ub_oomkill_task(mm, ub, ub_maxover); /* nonblocking but long */
-+ mmput(mm);
-+
-+ /*
-+ * Make kswapd go out of the way, so "p" has a good chance of
-+ * killing itself before someone else gets the chance to ask
-+ * for more memory.
-+ */
-+ if (!suicide)
-+ yield();
-+
-+ return 0;
-+}
-
- /**
-- * oom_kill - kill the "best" process when we run out of memory
-+ * oom_select_and_kill - kill the "best" process when we run out of memory
- *
- * If we run out of memory, we have the choice between either
- * killing a random task (bad), letting the system crash (worse)
- * OR try to be smart about which process to kill. Note that we
- * don't have to be perfect here, we just have to be good.
-+ *
-+ * Called with oom_generation_lock held, drops it.
- */
--static void oom_kill(void)
-+static void oom_select_and_kill(void)
- {
-- struct mm_struct *mm;
-- struct task_struct *g, *p, *q;
-+ struct user_beancounter *ub;
-+ struct task_struct *p;
-+ long ub_maxover;
-+ int r;
-
- /* print the memory stats whenever we OOM kill */
- show_mem();
-@@ -199,111 +304,143 @@ static void oom_kill(void)
- return;
- }
-
-+ ub_clear_oom();
-+
- read_lock(&tasklist_lock);
- retry:
-- p = select_bad_process();
-+ ub = ub_select_worst(&ub_maxover);
-+ p = select_bad_process(ub);
-
- /* Found nothing?!?! Either we hang forever, or we panic. */
- if (!p) {
-- show_free_areas();
-- panic("Out of memory and no killable processes...\n");
-- }
-+ if (!ub) {
-+ show_slab_info();
-+ show_free_areas();
-+ panic("Out of memory and no killable processes...\n");
-+ }
-
-- mm = oom_kill_task(p);
-- if (!mm)
-+ put_beancounter(ub);
- goto retry;
-- /*
-- * kill all processes that share the ->mm (i.e. all threads),
-- * but are in a different thread group
-- */
-- do_each_thread(g, q)
-- if (q->mm == mm && q->tgid != p->tgid)
-- __oom_kill_task(q);
-- while_each_thread(g, q);
-- if (!p->mm)
-- printk(KERN_INFO "Fixed up OOM kill of mm-less task\n");
-- read_unlock(&tasklist_lock);
-- mmput(mm);
-+ }
-
-- /*
-- * Make kswapd go out of the way, so "p" has a good chance of
-- * killing itself before someone else gets the chance to ask
-- * for more memory.
-- */
-- yield();
-- return;
-+ r = oom_kill(p, ub, ub_maxover);
-+ put_beancounter(ub);
-+ if (r)
-+ goto retry;
- }
-
--/**
-- * out_of_memory - is the system out of memory?
-+/*
-+ * Called with oom_generation_lock held, drops it.
- */
--void out_of_memory(int gfp_mask)
-+void oom_select_and_kill_sc(struct user_beancounter *scope)
- {
-- /*
-- * oom_lock protects out_of_memory()'s static variables.
-- * It's a global lock; this is not performance-critical.
-- */
-- static spinlock_t oom_lock = SPIN_LOCK_UNLOCKED;
-- static unsigned long first, last, count, lastkill;
-- unsigned long now, since;
--
-- spin_lock(&oom_lock);
-- now = jiffies;
-- since = now - last;
-- last = now;
-+ struct user_beancounter *ub;
-+ struct task_struct *p;
-+ struct mm_struct *mm;
-
-- /*
-- * If it's been a long time since last failure,
-- * we're not oom.
-- */
-- if (since > 5*HZ)
-- goto reset;
-+ ub_clear_oom();
-+ ub = get_beancounter(scope);
-
-- /*
-- * If we haven't tried for at least one second,
-- * we're not really oom.
-- */
-- since = now - first;
-- if (since < HZ)
-- goto out_unlock;
-+ read_lock(&tasklist_lock);
-+retry:
-+ p = select_bad_process(ub);
-+ if (!p) {
-+ read_unlock(&tasklist_lock);
-+ return;
-+ }
-
-- /*
-- * If we have gotten only a few failures,
-- * we're not really oom.
-- */
-- if (++count < 10)
-- goto out_unlock;
-+ if (oom_kill(p, ub, 0))
-+ goto retry;
-
-- /*
-- * If we just killed a process, wait a while
-- * to give that task a chance to exit. This
-- * avoids killing multiple processes needlessly.
-- */
-- since = now - lastkill;
-- if (since < HZ*5)
-+ put_beancounter(ub);
-+}
-+
-+static void do_out_of_memory(struct oom_freeing_stat *stat)
-+{
-+ spin_lock(&oom_generation_lock);
-+ if (oom_generation != stat->oom_generation)
-+ /* OOM-killed process has exited */
-+ goto out_unlock;
-+ if (test_tsk_thread_flag(current, TIF_MEMDIE))
-+ /* We have been killed. Move out faster */
- goto out_unlock;
-
-- /*
-- * Ok, really out of memory. Kill something.
-- */
-- lastkill = now;
-+ if (oom_kill_counter) {
-+ long timeout;
-
-- printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
-+ /* OOM in progress */
-
-- /* oom_kill() sleeps */
-- spin_unlock(&oom_lock);
-- oom_kill();
-- spin_lock(&oom_lock);
-+ DECLARE_WAITQUEUE(wait, current);
-+ add_wait_queue(&oom_waitqh, &wait);
-
--reset:
-- /*
-- * We dropped the lock above, so check to be sure the variable
-- * first only ever increases to prevent false OOM's.
-- */
-- if (time_after(now, first))
-- first = now;
-- count = 0;
-+ timeout = 5*HZ;
-+ do {
-+ __set_current_state(TASK_UNINTERRUPTIBLE);
-+ if (test_tsk_thread_flag(current, TIF_MEMDIE)) {
-+ __set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&oom_waitqh, &wait);
-+ /* We have been killed. Move out faster */
-+ goto out_unlock;
-+ }
-+ spin_unlock(&oom_generation_lock);
-+
-+ timeout = schedule_timeout(timeout);
-+
-+ spin_lock(&oom_generation_lock);
-+ } while (timeout > 0);
-+
-+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&oom_waitqh, &wait);
-+
-+ if (oom_generation != stat->oom_generation)
-+ goto out_unlock;
-+
-+ /*
-+ * Some process is stuck exiting.
-+ * No choice other than to kill something else.
-+ */
-+ }
-+ oom_select_and_kill();
-+ return;
-
- out_unlock:
-- spin_unlock(&oom_lock);
-+ spin_unlock(&oom_generation_lock);
-+}
-+
-+void do_out_of_memory_sc(struct user_beancounter *ub)
-+{
-+ spin_lock(&oom_generation_lock);
-+ oom_select_and_kill_sc(ub);
-+}
-+EXPORT_SYMBOL(do_out_of_memory_sc);
-+
-+/**
-+ * out_of_memory - is the system out of memory?
-+ */
-+void out_of_memory(struct oom_freeing_stat *stat, int gfp_mask)
-+{
-+ if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_OUTOFMEM, stat)
-+ & (NOTIFY_OK | NOTIFY_FAIL))
-+ return;
-+
-+ if (nr_swap_pages > 0) {
-+ /* some pages have been freed */
-+ if (stat->freed)
-+ return;
-+ /* some IO was started */
-+ if (stat->written)
-+ return;
-+ /* some pages have been swapped out, ref. counter removed */
-+ if (stat->swapped)
-+ return;
-+ /* some slabs were shrinked */
-+ if (stat->slabs)
-+ return;
-+ }
-+
-+ if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_OUTOFMEM, stat)
-+ & (NOTIFY_OK | NOTIFY_FAIL))
-+ return;
-+
-+ do_out_of_memory(stat);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/page_alloc.c linux-2.6.9-ve023stab030/mm/page_alloc.c
---- linux-2.6.9-42.0.3.EL.orig/mm/page_alloc.c 2006-10-11 18:29:49.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/page_alloc.c 2006-10-11 19:08:02.000000000 +0400
-@@ -31,9 +31,12 @@
- #include <linux/topology.h>
- #include <linux/sysctl.h>
- #include <linux/cpu.h>
-+#include <linux/kernel_stat.h>
-
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_mem.h>
-+
- DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
- struct pglist_data *pgdat_list;
- unsigned long totalram_pages;
-@@ -42,7 +45,9 @@ long nr_swap_pages;
- int percpu_pagelist_fraction;
- int numnodes = 1;
- int sysctl_lower_zone_protection = 0;
-+int alloc_fail_warn = 0;
-
-+EXPORT_SYMBOL(pgdat_list);
- EXPORT_SYMBOL(totalram_pages);
- EXPORT_SYMBOL(nr_swap_pages);
-
-@@ -289,6 +294,7 @@ void __free_pages_ok(struct page *page,
- free_pages_check(__FUNCTION__, page + i);
- list_add(&page->lru, &list);
- kernel_map_pages(page, 1<<order, 0);
-+ ub_page_uncharge(page, order);
- free_pages_bulk(page_zone(page), 1, &list, order);
- }
-
-@@ -361,7 +367,7 @@ static void prep_new_page(struct page *p
-
- page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
- 1 << PG_referenced | 1 << PG_arch_1 |
-- 1 << PG_checked | 1 << PG_mappedtodisk);
-+ 1 << PG_checked | 1 << PG_mappedtodisk | 1 << PG_checkpointed);
- page->private = 0;
- set_page_refs(page, order);
- }
-@@ -520,6 +526,7 @@ static void fastcall free_hot_cold_page(
- page->mapping = NULL;
- free_pages_check(__FUNCTION__, page);
- pcp = &zone->pageset[get_cpu()].pcp[cold];
-+ ub_page_uncharge(page, 0);
- local_irq_save(flags);
- if (pcp->count >= pcp->high)
- pcp->count -= free_pages_bulk(zone, pcp->batch, &pcp->list, 0);
-@@ -585,6 +592,26 @@ buffered_rmqueue(struct zone *zone, int
- return page;
- }
-
-+static void __alloc_collect_stats(unsigned int gfp_mask,
-+ unsigned int order, struct page *page, cycles_t time)
-+{
-+ int ind;
-+ unsigned long flags;
-+
-+ time = get_cycles() - time;
-+ if (!(gfp_mask & __GFP_WAIT))
-+ ind = 0;
-+ else if (!(gfp_mask & __GFP_HIGHMEM))
-+ ind = (order > 0 ? 2 : 1);
-+ else
-+ ind = (order > 0 ? 4 : 3);
-+ spin_lock_irqsave(&kstat_glb_lock, flags);
-+ KSTAT_LAT_ADD(&kstat_glob.alloc_lat[ind], time);
-+ if (!page)
-+ kstat_glob.alloc_fails[ind]++;
-+ spin_unlock_irqrestore(&kstat_glb_lock, flags);
-+}
-+
- /*
- * This is the 'heart' of the zoned buddy allocator.
- *
-@@ -615,6 +642,7 @@ __alloc_pages(unsigned int gfp_mask, uns
- int alloc_type;
- int do_retry;
- int can_try_harder;
-+ cycles_t start_time;
-
- might_sleep_if(wait);
-
-@@ -632,6 +660,7 @@ __alloc_pages(unsigned int gfp_mask, uns
- return NULL;
- }
-
-+ start_time = get_cycles();
- alloc_type = zone_idx(zones[0]);
-
- /* Go through the zonelist once, looking for a zone with enough free */
-@@ -670,13 +699,18 @@ __alloc_pages(unsigned int gfp_mask, uns
- }
-
- /* This allocation should allow future memory freeing. */
-- if ((p->flags & (PF_MEMALLOC | PF_MEMDIE)) && !in_interrupt()) {
-+ if (((p->flags & PF_MEMALLOC) || test_tsk_thread_flag(p, TIF_MEMDIE)) &&
-+ !in_interrupt()) {
- /* go through the zonelist yet again, ignoring mins */
- for (i = 0; (z = zones[i]) != NULL; i++) {
- page = buffered_rmqueue(z, order, gfp_mask);
- if (page)
- goto got_pg;
- }
-+ if (gfp_mask & __GFP_NOFAIL) {
-+ blk_congestion_wait(WRITE, HZ/50);
-+ goto rebalance;
-+ }
- goto nopage;
- }
-
-@@ -732,17 +766,26 @@ rebalance:
- }
-
- nopage:
-- if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit()) {
-+ if (alloc_fail_warn && !(gfp_mask & __GFP_NOWARN)
-+ && printk_ratelimit()) {
- printk(KERN_WARNING "%s: page allocation failure."
- " order:%d, mode:0x%x\n",
- p->comm, order, gfp_mask);
- dump_stack();
- show_mem();
- }
-+ __alloc_collect_stats(gfp_mask, order, NULL, start_time);
- return NULL;
- got_pg:
- zone_statistics(zonelist, z);
- kernel_map_pages(page, 1 << order, 1);
-+ __alloc_collect_stats(gfp_mask, order, page, start_time);
-+
-+ if (ub_page_charge(page, order, gfp_mask)) {
-+ __free_pages(page, order);
-+ page = NULL;
-+ }
-+
- return page;
- }
-
-@@ -890,6 +933,30 @@ unsigned int nr_free_highpages (void)
- }
- #endif
-
-+unsigned int nr_lowmem_pages(void)
-+{
-+ pg_data_t *pgdat;
-+ unsigned int pages = 0;
-+
-+ for_each_pgdat(pgdat)
-+ pages += pgdat->node_zones[ZONE_NORMAL].present_pages;
-+
-+ return pages;
-+}
-+EXPORT_SYMBOL(nr_lowmem_pages);
-+
-+
-+unsigned int nr_free_lowpages (void)
-+{
-+ pg_data_t *pgdat;
-+ unsigned int pages = 0;
-+
-+ for_each_pgdat(pgdat)
-+ pages += pgdat->node_zones[ZONE_NORMAL].free_pages;
-+
-+ return pages;
-+}
-+
- #ifdef CONFIG_NUMA
- static void show_node(struct zone *zone)
- {
-@@ -1129,7 +1196,7 @@ void show_free_areas(void)
-
- for_each_zone(zone) {
- struct list_head *elem;
-- unsigned long nr, flags, order, total = 0;
-+ unsigned long nr[MAX_ORDER], flags, order, total = 0;
-
- show_node(zone);
- printk("%s: ", zone->name);
-@@ -1138,15 +1205,16 @@ void show_free_areas(void)
- continue;
- }
-
-+ spin_lock_irqsave(&zone->lock, flags);
- for (order = 0; order < MAX_ORDER; order++) {
-- nr = 0;
-- spin_lock_irqsave(&zone->lock, flags);
-+ nr[order] = 0;
- list_for_each(elem, &zone->free_area[order].free_list)
-- ++nr;
-- spin_unlock_irqrestore(&zone->lock, flags);
-- total += nr << order;
-- printk("%lu*%lukB ", nr, K(1UL) << order);
-+ ++nr[order];
-+ total += nr[order] << order;
- }
-+ spin_unlock_irqrestore(&zone->lock, flags);
-+ for (order = 0; order < MAX_ORDER; order++)
-+ printk("%lu*%lukB ", nr[order], K(1UL) << order);
- printk("= %lukB\n", K(total));
- }
-
-@@ -1777,7 +1845,10 @@ static void *vmstat_start(struct seq_fil
- m->private = ps;
- if (!ps)
- return ERR_PTR(-ENOMEM);
-- get_full_page_state(ps);
-+ if (ve_is_super(get_exec_env()))
-+ get_full_page_state(ps);
-+ else
-+ memset(ps, 0, sizeof(*ps));
- ps->pgpgin /= 2; /* sectors -> kbytes */
- ps->pgpgout /= 2;
- return (unsigned long *)ps + *pos;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/pdflush.c linux-2.6.9-ve023stab030/mm/pdflush.c
---- linux-2.6.9-42.0.3.EL.orig/mm/pdflush.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/pdflush.c 2006-10-11 19:07:55.000000000 +0400
-@@ -106,8 +106,8 @@ static int __pdflush(struct pdflush_work
- spin_unlock_irq(&pdflush_lock);
-
- schedule();
-- if (current->flags & PF_FREEZE) {
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE)) {
-+ refrigerator();
- spin_lock_irq(&pdflush_lock);
- continue;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/rmap.c linux-2.6.9-ve023stab030/mm/rmap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/rmap.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/rmap.c 2006-10-11 19:07:59.000000000 +0400
-@@ -52,9 +52,12 @@
- #include <linux/init.h>
- #include <linux/rmap.h>
- #include <linux/rcupdate.h>
-+#include <linux/module.h>
-
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_vmpages.h>
-+
- //#define RMAP_DEBUG /* can be enabled only for debugging */
-
- kmem_cache_t *anon_vma_cachep;
-@@ -116,6 +119,7 @@ int anon_vma_prepare(struct vm_area_stru
- }
- return 0;
- }
-+EXPORT_SYMBOL(anon_vma_prepare);
-
- void __anon_vma_merge(struct vm_area_struct *vma, struct vm_area_struct *next)
- {
-@@ -151,6 +155,7 @@ void anon_vma_link(struct vm_area_struct
- spin_unlock(&anon_vma->lock);
- }
- }
-+EXPORT_SYMBOL(anon_vma_link);
-
- void anon_vma_unlink(struct vm_area_struct *vma)
- {
-@@ -186,7 +191,8 @@ static void anon_vma_ctor(void *data, km
- void __init anon_vma_init(void)
- {
- anon_vma_cachep = kmem_cache_create("anon_vma", sizeof(struct anon_vma),
-- 0, SLAB_DESTROY_BY_RCU|SLAB_PANIC, anon_vma_ctor, NULL);
-+ 0, SLAB_DESTROY_BY_RCU|SLAB_PANIC|SLAB_UBC,
-+ anon_vma_ctor, NULL);
- }
-
- /*
-@@ -488,6 +494,10 @@ void page_remove_rmap(struct page *page)
- */
- if (page_test_and_clear_dirty(page))
- set_page_dirty(page);
-+ /* Well, when a page is unmapped, we cannot keep PG_checkpointed flag,
-+ * it is not accessible via process VM and we have no way to
-+ * reset its state */
-+ clear_bit(PG_checkpointed, &(page)->flags);
- dec_page_state(nr_mapped);
- }
- }
-@@ -587,6 +597,10 @@ static int try_to_unmap_one(struct page
- }
-
- mm->rss--;
-+ vma->vm_rss--;
-+ mm_ub(mm)->ub_perfstat[smp_processor_id()].unmap++;
-+ ub_unused_privvm_inc(mm_ub(mm), 1, vma);
-+ pb_remove_ref(page, mm_ub(mm));
- page_remove_rmap(page);
- page_cache_release(page);
-
-@@ -632,6 +646,7 @@ static void try_to_unmap_cluster(unsigne
- unsigned long address;
- unsigned long end;
- unsigned long pfn;
-+ unsigned long old_rss;
-
- /*
- * We need the page_table_lock to protect us from page faults,
-@@ -654,6 +669,7 @@ static void try_to_unmap_cluster(unsigne
- if (!pmd_present(*pmd))
- goto out_unlock;
-
-+ old_rss = mm->rss;
- for (original_pte = pte = pte_offset_map(pmd, address);
- address < end; pte++, address += PAGE_SIZE) {
-
-@@ -685,10 +701,15 @@ static void try_to_unmap_cluster(unsigne
- set_page_dirty(page);
-
- page_remove_rmap(page);
-- page_cache_release(page);
- mm->rss--;
-+ vma->vm_rss--;
-+ mm_ub(mm)->ub_perfstat[smp_processor_id()].unmap++;
-+ pb_remove_ref(page, mm_ub(mm));
-+ page_cache_release(page);
- (*mapcount)--;
- }
-+ if (old_rss > mm->rss)
-+ ub_unused_privvm_inc(mm_ub(mm), old_rss - mm->rss, vma);
-
- pte_unmap(original_pte);
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/shmem.c linux-2.6.9-ve023stab030/mm/shmem.c
---- linux-2.6.9-42.0.3.EL.orig/mm/shmem.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/shmem.c 2006-10-11 19:07:59.000000000 +0400
-@@ -50,6 +50,9 @@
- #include <asm/div64.h>
- #include <asm/pgtable.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_vmpages.h>
-+
- /* This magic number is used in glibc for posix shared memory */
- #define TMPFS_MAGIC 0x01021994
-
-@@ -212,7 +215,7 @@ static void shmem_free_block(struct inod
- *
- * It has to be called with the spinlock held.
- */
--static void shmem_recalc_inode(struct inode *inode)
-+static void shmem_recalc_inode(struct inode *inode, unsigned long swp_freed)
- {
- struct shmem_inode_info *info = SHMEM_I(inode);
- long freed;
-@@ -222,6 +225,9 @@ static void shmem_recalc_inode(struct in
- struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
- info->alloced -= freed;
- shmem_unacct_blocks(info->flags, freed);
-+ if (freed > swp_freed)
-+ ub_tmpfs_respages_dec(shm_info_ub(info),
-+ freed - swp_freed);
- if (sbinfo) {
- spin_lock(&sbinfo->stat_lock);
- sbinfo->free_blocks += freed;
-@@ -331,6 +337,11 @@ static void shmem_swp_set(struct shmem_i
- info->swapped += incdec;
- if ((unsigned long)(entry - info->i_direct) >= SHMEM_NR_DIRECT)
- kmap_atomic_to_page(entry)->nr_swapped += incdec;
-+
-+ if (incdec == 1)
-+ ub_tmpfs_respages_dec(shm_info_ub(info), 1);
-+ else
-+ ub_tmpfs_respages_inc(shm_info_ub(info), 1);
- }
-
- /*
-@@ -347,14 +358,24 @@ static swp_entry_t *shmem_swp_alloc(stru
- struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
- struct page *page = NULL;
- swp_entry_t *entry;
-+ unsigned long ub_val;
-
- if (sgp != SGP_WRITE &&
- ((loff_t) index << PAGE_CACHE_SHIFT) >= i_size_read(inode))
- return ERR_PTR(-EINVAL);
-
-+ ub_val = 0;
-+ if (info->next_index <= index) {
-+ ub_val = index + 1 - info->next_index;
-+ if (ub_shmpages_charge(shm_info_ub(info), ub_val))
-+ return ERR_PTR(-ENOSPC);
-+ }
-+
- while (!(entry = shmem_swp_entry(info, index, &page))) {
-- if (sgp == SGP_READ)
-- return shmem_swp_map(ZERO_PAGE(0));
-+ if (sgp == SGP_READ) {
-+ entry = shmem_swp_map(ZERO_PAGE(0));
-+ goto out;
-+ }
- /*
- * Test free_blocks against 1 not 0, since we have 1 data
- * page (and perhaps indirect index pages) yet to allocate:
-@@ -364,7 +385,8 @@ static swp_entry_t *shmem_swp_alloc(stru
- spin_lock(&sbinfo->stat_lock);
- if (sbinfo->free_blocks <= 1) {
- spin_unlock(&sbinfo->stat_lock);
-- return ERR_PTR(-ENOSPC);
-+ entry = ERR_PTR(-ENOSPC);
-+ goto out;
- }
- sbinfo->free_blocks--;
- inode->i_blocks += BLOCKS_PER_PAGE;
-@@ -372,7 +394,8 @@ static swp_entry_t *shmem_swp_alloc(stru
- }
-
- spin_unlock(&info->lock);
-- page = shmem_dir_alloc(mapping_gfp_mask(inode->i_mapping));
-+ page = shmem_dir_alloc(mapping_gfp_mask(inode->i_mapping) |
-+ __GFP_UBC);
- if (page) {
- clear_highpage(page);
- page->nr_swapped = 0;
-@@ -380,25 +403,36 @@ static swp_entry_t *shmem_swp_alloc(stru
- spin_lock(&info->lock);
-
- if (!page) {
-- shmem_free_block(inode);
-- return ERR_PTR(-ENOMEM);
-+ entry = ERR_PTR(-ENOMEM);
-+ goto out_block;
- }
- if (sgp != SGP_WRITE &&
- ((loff_t) index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) {
- entry = ERR_PTR(-EINVAL);
-- break;
-+ goto out_page;
- }
-- if (info->next_index <= index)
-+ if (info->next_index <= index) {
-+ ub_val = 0;
- info->next_index = index + 1;
-+ }
- }
- if (page) {
- /* another task gave its page, or truncated the file */
- shmem_free_block(inode);
- shmem_dir_free(page);
- }
-- if (info->next_index <= index && !IS_ERR(entry))
-+ if (info->next_index <= index)
- info->next_index = index + 1;
- return entry;
-+
-+out_page:
-+ shmem_dir_free(page);
-+out_block:
-+ shmem_free_block(inode);
-+out:
-+ if (ub_val)
-+ ub_shmpages_uncharge(shm_info_ub(info), ub_val);
-+ return entry;
- }
-
- /*
-@@ -435,13 +469,16 @@ static void shmem_truncate(struct inode
- swp_entry_t *ptr;
- int offset;
- int freed;
-+ unsigned long swp_freed;
-
-+ swp_freed = 0;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME;
- idx = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
- if (idx >= info->next_index)
- return;
-
- spin_lock(&info->lock);
-+ ub_shmpages_uncharge(shm_info_ub(info), info->next_index - idx);
- info->flags |= SHMEM_TRUNCATE;
- limit = info->next_index;
- info->next_index = idx;
-@@ -450,7 +487,9 @@ static void shmem_truncate(struct inode
- size = limit;
- if (size > SHMEM_NR_DIRECT)
- size = SHMEM_NR_DIRECT;
-- info->swapped -= shmem_free_swp(ptr+idx, ptr+size);
-+ freed = shmem_free_swp(ptr+idx, ptr+size);
-+ swp_freed += freed;
-+ info->swapped -= freed;
- }
- if (!info->i_indirect)
- goto done2;
-@@ -520,6 +559,7 @@ static void shmem_truncate(struct inode
- shmem_swp_unmap(ptr);
- info->swapped -= freed;
- subdir->nr_swapped -= freed;
-+ swp_freed += freed;
- BUG_ON(subdir->nr_swapped > offset);
- }
- if (offset)
-@@ -556,7 +596,7 @@ done2:
- spin_lock(&info->lock);
- }
- info->flags &= ~SHMEM_TRUNCATE;
-- shmem_recalc_inode(inode);
-+ shmem_recalc_inode(inode, swp_freed);
- spin_unlock(&info->lock);
- }
-
-@@ -625,6 +665,8 @@ static void shmem_delete_inode(struct in
- sbinfo->free_inodes++;
- spin_unlock(&sbinfo->stat_lock);
- }
-+ put_beancounter(shm_info_ub(info));
-+ shm_info_ub(info) = NULL;
- clear_inode(inode);
- }
-
-@@ -769,12 +811,11 @@ static int shmem_writepage(struct page *
- info = SHMEM_I(inode);
- if (info->flags & VM_LOCKED)
- goto redirty;
-- swap = get_swap_page();
-+ swap = get_swap_page(shm_info_ub(info));
- if (!swap.val)
- goto redirty;
-
- spin_lock(&info->lock);
-- shmem_recalc_inode(inode);
- if (index >= info->next_index) {
- BUG_ON(!(info->flags & SHMEM_TRUNCATE));
- goto unlock;
-@@ -913,7 +954,6 @@ repeat:
- goto failed;
-
- spin_lock(&info->lock);
-- shmem_recalc_inode(inode);
- entry = shmem_swp_alloc(info, idx, sgp);
- if (IS_ERR(entry)) {
- spin_unlock(&info->lock);
-@@ -1082,6 +1122,7 @@ repeat:
- clear_highpage(filepage);
- flush_dcache_page(filepage);
- SetPageUptodate(filepage);
-+ ub_tmpfs_respages_inc(shm_info_ub(info), 1);
- }
- done:
- if (*pagep != filepage) {
-@@ -1179,28 +1220,6 @@ shmem_get_policy(struct vm_area_struct *
- }
- #endif
-
--int shmem_lock(struct file *file, int lock, struct user_struct *user)
--{
-- struct inode *inode = file->f_dentry->d_inode;
-- struct shmem_inode_info *info = SHMEM_I(inode);
-- int retval = -ENOMEM;
--
-- spin_lock(&info->lock);
-- if (lock && !(info->flags & VM_LOCKED)) {
-- if (!user_shm_lock(inode->i_size, user))
-- goto out_nomem;
-- info->flags |= VM_LOCKED;
-- }
-- if (!lock && (info->flags & VM_LOCKED) && user) {
-- user_shm_unlock(inode->i_size, user);
-- info->flags &= ~VM_LOCKED;
-- }
-- retval = 0;
--out_nomem:
-- spin_unlock(&info->lock);
-- return retval;
--}
--
- static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
- {
- file_accessed(file);
-@@ -1237,6 +1256,7 @@ shmem_get_inode(struct super_block *sb,
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
- info = SHMEM_I(inode);
- memset(info, 0, (char *)inode - (char *)info);
-+ shm_info_ub(info) = get_beancounter(get_exec_ub());
- spin_lock_init(&info->lock);
- INIT_LIST_HEAD(&info->swaplist);
-
-@@ -1365,6 +1385,7 @@ shmem_file_write(struct file *file, cons
- break;
-
- left = bytes;
-+#ifndef CONFIG_X86_UACCESS_INDIRECT
- if (PageHighMem(page)) {
- volatile unsigned char dummy;
- __get_user(dummy, buf);
-@@ -1375,6 +1396,7 @@ shmem_file_write(struct file *file, cons
- buf, bytes);
- kunmap_atomic(kaddr, KM_USER0);
- }
-+#endif
- if (left) {
- kaddr = kmap(page);
- left = __copy_from_user(kaddr + offset, buf, bytes);
-@@ -2137,20 +2159,42 @@ static struct xattr_handler *shmem_xattr
-
- #endif /* CONFIG_TMPFS_XATTR */
-
-+int is_shmem_mapping(struct address_space *map)
-+{
-+ return (map != NULL && map->a_ops == &shmem_aops);
-+}
-+
- static struct super_block *shmem_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name, void *data)
- {
- return get_sb_nodev(fs_type, flags, data, shmem_fill_super);
- }
-
--static struct file_system_type tmpfs_fs_type = {
-+struct file_system_type tmpfs_fs_type = {
- .owner = THIS_MODULE,
- .name = "tmpfs",
- .get_sb = shmem_get_sb,
- .kill_sb = kill_litter_super,
- };
-+
-+EXPORT_SYMBOL(tmpfs_fs_type);
-+
- static struct vfsmount *shm_mnt;
-
-+#ifndef CONFIG_VE
-+#define visible_shm_mnt shm_mnt
-+#else
-+#define visible_shm_mnt (get_exec_env()->shmem_mnt)
-+#endif
-+
-+void prepare_shmmnt(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->shmem_mnt = shm_mnt;
-+ shm_mnt = (struct vfsmount *)0x10111213;
-+#endif
-+}
-+
- static int __init init_tmpfs(void)
- {
- int error;
-@@ -2167,13 +2211,14 @@ static int __init init_tmpfs(void)
- #ifdef CONFIG_TMPFS
- devfs_mk_dir("shm");
- #endif
-- shm_mnt = do_kern_mount(tmpfs_fs_type.name, MS_NOUSER,
-+ shm_mnt = do_kern_mount(&tmpfs_fs_type, MS_NOUSER,
- tmpfs_fs_type.name, NULL);
- if (IS_ERR(shm_mnt)) {
- error = PTR_ERR(shm_mnt);
- printk(KERN_ERR "Could not kern_mount tmpfs\n");
- goto out1;
- }
-+ prepare_shmmnt();
- return 0;
-
- out1:
-@@ -2186,6 +2231,32 @@ out3:
- }
- module_init(init_tmpfs)
-
-+static inline int shm_charge_ahead(struct inode *inode)
-+{
-+ struct shmem_inode_info *info = SHMEM_I(inode);
-+ unsigned long idx;
-+ swp_entry_t *entry;
-+
-+ if (!inode->i_size)
-+ return 0;
-+ idx = (inode->i_size - 1) >> PAGE_CACHE_SHIFT;
-+ /*
-+ * Just touch info to allocate space for entry and
-+ * make all UBC checks
-+ */
-+ spin_lock(&info->lock);
-+ entry = shmem_swp_alloc(info, idx, SGP_CACHE);
-+ if (IS_ERR(entry))
-+ goto err;
-+ shmem_swp_unmap(entry);
-+ spin_unlock(&info->lock);
-+ return 0;
-+
-+err:
-+ spin_unlock(&info->lock);
-+ return PTR_ERR(entry);
-+}
-+
- /*
- * shmem_file_setup - get an unlinked file living in tmpfs
- *
-@@ -2201,8 +2272,8 @@ struct file *shmem_file_setup(char *name
- struct dentry *dentry, *root;
- struct qstr this;
-
-- if (IS_ERR(shm_mnt))
-- return (void *)shm_mnt;
-+ if (IS_ERR(visible_shm_mnt))
-+ return (void *)visible_shm_mnt;
-
- if (size < 0 || size > SHMEM_MAX_BYTES)
- return ERR_PTR(-EINVAL);
-@@ -2214,7 +2285,7 @@ struct file *shmem_file_setup(char *name
- this.name = name;
- this.len = strlen(name);
- this.hash = 0; /* will go */
-- root = shm_mnt->mnt_root;
-+ root = visible_shm_mnt->mnt_root;
- dentry = d_alloc(root, &this);
- if (!dentry)
- goto put_memory;
-@@ -2233,7 +2304,10 @@ struct file *shmem_file_setup(char *name
- d_instantiate(dentry, inode);
- inode->i_size = size;
- inode->i_nlink = 0; /* It is unlinked */
-- file->f_vfsmnt = mntget(shm_mnt);
-+ error = shm_charge_ahead(inode);
-+ if (error)
-+ goto close_file;
-+ file->f_vfsmnt = mntget(visible_shm_mnt);
- file->f_dentry = dentry;
- file->f_mapping = inode->i_mapping;
- file->f_op = &shmem_file_operations;
-@@ -2248,6 +2322,7 @@ put_memory:
- shmem_unacct_size(flags, size);
- return ERR_PTR(error);
- }
-+EXPORT_SYMBOL(shmem_file_setup);
-
- /*
- * shmem_zero_setup - setup a shared anonymous mapping
-@@ -2265,6 +2340,8 @@ int shmem_zero_setup(struct vm_area_stru
-
- if (vma->vm_file)
- fput(vma->vm_file);
-+ else if (vma->vm_flags & VM_WRITE) /* should match VM_UB_PRIVATE */
-+ __ub_unused_privvm_dec(mm_ub(vma->vm_mm), size >> PAGE_SHIFT);
- vma->vm_file = file;
- vma->vm_ops = &shmem_vm_ops;
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/slab.c linux-2.6.9-ve023stab030/mm/slab.c
---- linux-2.6.9-42.0.3.EL.orig/mm/slab.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/slab.c 2006-10-11 19:08:01.000000000 +0400
-@@ -92,33 +92,22 @@
- #include <linux/sysctl.h>
- #include <linux/module.h>
- #include <linux/rcupdate.h>
-+#include <linux/kmem_slab.h>
-+#include <linux/kmem_cache.h>
-+#include <linux/kernel_stat.h>
-+#include <linux/ve_owner.h>
-
- #include <asm/uaccess.h>
- #include <asm/cacheflush.h>
- #include <asm/tlbflush.h>
- #include <asm/page.h>
-
--/*
-- * DEBUG - 1 for kmem_cache_create() to honour; SLAB_DEBUG_INITIAL,
-- * SLAB_RED_ZONE & SLAB_POISON.
-- * 0 for faster, smaller code (especially in the critical paths).
-- *
-- * STATS - 1 to collect stats for /proc/slabinfo.
-- * 0 for faster, smaller code (especially in the critical paths).
-- *
-- * FORCED_DEBUG - 1 enables SLAB_RED_ZONE and SLAB_POISON (if possible)
-- */
--
--#ifdef CONFIG_DEBUG_SLAB
--#define DEBUG 1
--#define STATS 1
--#define FORCED_DEBUG 1
--#else
--#define DEBUG 0
--#define STATS 0
--#define FORCED_DEBUG 0
--#endif
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-
-+#define DEBUG SLAB_DEBUG
-+#define STATS SLAB_STATS
-+#define FORCED_DEBUG SLAB_FORCED_DEBUG
-
- /* Shouldn't this be in a header file somewhere? */
- #define BYTES_PER_WORD sizeof(void *)
-@@ -142,202 +131,21 @@
- SLAB_NO_REAP | SLAB_CACHE_DMA | \
- SLAB_MUST_HWCACHE_ALIGN | SLAB_STORE_USER | \
- SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \
-+ SLAB_UBC | SLAB_NO_CHARGE | \
- SLAB_DESTROY_BY_RCU)
- #else
- # define CREATE_MASK (SLAB_HWCACHE_ALIGN | SLAB_NO_REAP | \
- SLAB_CACHE_DMA | SLAB_MUST_HWCACHE_ALIGN | \
- SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \
-+ SLAB_UBC | SLAB_NO_CHARGE | \
- SLAB_DESTROY_BY_RCU)
- #endif
-
--/*
-- * kmem_bufctl_t:
-- *
-- * Bufctl's are used for linking objs within a slab
-- * linked offsets.
-- *
-- * This implementation relies on "struct page" for locating the cache &
-- * slab an object belongs to.
-- * This allows the bufctl structure to be small (one int), but limits
-- * the number of objects a slab (not a cache) can contain when off-slab
-- * bufctls are used. The limit is the size of the largest general cache
-- * that does not use off-slab slabs.
-- * For 32bit archs with 4 kB pages, is this 56.
-- * This is not serious, as it is only for large objects, when it is unwise
-- * to have too many per slab.
-- * Note: This limit can be raised by introducing a general cache whose size
-- * is less than 512 (PAGE_SIZE<<3), but greater than 256.
-- */
--
--#define BUFCTL_END (((kmem_bufctl_t)(~0U))-0)
--#define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1)
--#define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2)
--
- /* Max number of objs-per-slab for caches which use off-slab slabs.
- * Needed to avoid a possible looping condition in cache_grow().
- */
- static unsigned long offslab_limit;
-
--/*
-- * struct slab
-- *
-- * Manages the objs in a slab. Placed either at the beginning of mem allocated
-- * for a slab, or allocated from an general cache.
-- * Slabs are chained into three list: fully used, partial, fully free slabs.
-- */
--struct slab {
-- struct list_head list;
-- unsigned long colouroff;
-- void *s_mem; /* including colour offset */
-- unsigned int inuse; /* num of objs active in slab */
-- kmem_bufctl_t free;
--};
--
--/*
-- * struct slab_rcu
-- *
-- * slab_destroy on a SLAB_DESTROY_BY_RCU cache uses this structure to
-- * arrange for kmem_freepages to be called via RCU. This is useful if
-- * we need to approach a kernel structure obliquely, from its address
-- * obtained without the usual locking. We can lock the structure to
-- * stabilize it and check it's still at the given address, only if we
-- * can be sure that the memory has not been meanwhile reused for some
-- * other kind of object (which our subsystem's lock might corrupt).
-- *
-- * rcu_read_lock before reading the address, then rcu_read_unlock after
-- * taking the spinlock within the structure expected at that address.
-- *
-- * We assume struct slab_rcu can overlay struct slab when destroying.
-- */
--struct slab_rcu {
-- struct rcu_head head;
-- kmem_cache_t *cachep;
-- void *addr;
--};
--
--/*
-- * struct array_cache
-- *
-- * Per cpu structures
-- * Purpose:
-- * - LIFO ordering, to hand out cache-warm objects from _alloc
-- * - reduce the number of linked list operations
-- * - reduce spinlock operations
-- *
-- * The limit is stored in the per-cpu structure to reduce the data cache
-- * footprint.
-- *
-- */
--struct array_cache {
-- unsigned int avail;
-- unsigned int limit;
-- unsigned int batchcount;
-- unsigned int touched;
--};
--
--/* bootstrap: The caches do not work without cpuarrays anymore,
-- * but the cpuarrays are allocated from the generic caches...
-- */
--#define BOOT_CPUCACHE_ENTRIES 1
--struct arraycache_init {
-- struct array_cache cache;
-- void * entries[BOOT_CPUCACHE_ENTRIES];
--};
--
--/*
-- * The slab lists of all objects.
-- * Hopefully reduce the internal fragmentation
-- * NUMA: The spinlock could be moved from the kmem_cache_t
-- * into this structure, too. Figure out what causes
-- * fewer cross-node spinlock operations.
-- */
--struct kmem_list3 {
-- struct list_head slabs_partial; /* partial list first, better asm code */
-- struct list_head slabs_full;
-- struct list_head slabs_free;
-- unsigned long free_objects;
-- int free_touched;
-- unsigned long next_reap;
-- struct array_cache *shared;
--};
--
--#define LIST3_INIT(parent) \
-- { \
-- .slabs_full = LIST_HEAD_INIT(parent.slabs_full), \
-- .slabs_partial = LIST_HEAD_INIT(parent.slabs_partial), \
-- .slabs_free = LIST_HEAD_INIT(parent.slabs_free) \
-- }
--#define list3_data(cachep) \
-- (&(cachep)->lists)
--
--/* NUMA: per-node */
--#define list3_data_ptr(cachep, ptr) \
-- list3_data(cachep)
--
--/*
-- * kmem_cache_t
-- *
-- * manages a cache.
-- */
--
--struct kmem_cache_s {
--/* 1) per-cpu data, touched during every alloc/free */
-- struct array_cache *array[NR_CPUS];
-- unsigned int batchcount;
-- unsigned int limit;
--/* 2) touched by every alloc & free from the backend */
-- struct kmem_list3 lists;
-- /* NUMA: kmem_3list_t *nodelists[MAX_NUMNODES] */
-- unsigned int objsize;
-- unsigned int flags; /* constant flags */
-- unsigned int num; /* # of objs per slab */
-- unsigned int free_limit; /* upper limit of objects in the lists */
-- spinlock_t spinlock;
--
--/* 3) cache_grow/shrink */
-- /* order of pgs per slab (2^n) */
-- unsigned int gfporder;
--
-- /* force GFP flags, e.g. GFP_DMA */
-- unsigned int gfpflags;
--
-- size_t colour; /* cache colouring range */
-- unsigned int colour_off; /* colour offset */
-- unsigned int colour_next; /* cache colouring */
-- kmem_cache_t *slabp_cache;
-- unsigned int slab_size;
-- unsigned int dflags; /* dynamic flags */
--
-- /* constructor func */
-- void (*ctor)(void *, kmem_cache_t *, unsigned long);
--
-- /* de-constructor func */
-- void (*dtor)(void *, kmem_cache_t *, unsigned long);
--
--/* 4) cache creation/removal */
-- const char *name;
-- struct list_head next;
--
--/* 5) statistics */
--#if STATS
-- unsigned long num_active;
-- unsigned long num_allocations;
-- unsigned long high_mark;
-- unsigned long grown;
-- unsigned long reaped;
-- unsigned long errors;
-- unsigned long max_freeable;
-- atomic_t allochit;
-- atomic_t allocmiss;
-- atomic_t freehit;
-- atomic_t freemiss;
--#endif
--#if DEBUG
-- int dbghead;
-- int reallen;
--#endif
--};
--
- #define CFLGS_OFF_SLAB (0x80000000UL)
- #define OFF_SLAB(x) ((x)->flags & CFLGS_OFF_SLAB)
-
-@@ -351,12 +159,13 @@ struct kmem_cache_s {
- #define REAPTIMEOUT_CPUC (2*HZ)
- #define REAPTIMEOUT_LIST3 (4*HZ)
-
-+#define STATS_INC_GROWN(x) ((x)->grown++)
-+#define STATS_INC_REAPED(x) ((x)->reaped++)
-+#define STATS_INC_SHRUNK(x) ((x)->shrunk++)
- #if STATS
- #define STATS_INC_ACTIVE(x) ((x)->num_active++)
- #define STATS_DEC_ACTIVE(x) ((x)->num_active--)
- #define STATS_INC_ALLOCED(x) ((x)->num_allocations++)
--#define STATS_INC_GROWN(x) ((x)->grown++)
--#define STATS_INC_REAPED(x) ((x)->reaped++)
- #define STATS_SET_HIGH(x) do { if ((x)->num_active > (x)->high_mark) \
- (x)->high_mark = (x)->num_active; \
- } while (0)
-@@ -374,8 +183,6 @@ struct kmem_cache_s {
- #define STATS_INC_ACTIVE(x) do { } while (0)
- #define STATS_DEC_ACTIVE(x) do { } while (0)
- #define STATS_INC_ALLOCED(x) do { } while (0)
--#define STATS_INC_GROWN(x) do { } while (0)
--#define STATS_INC_REAPED(x) do { } while (0)
- #define STATS_SET_HIGH(x) do { } while (0)
- #define STATS_INC_ERR(x) do { } while (0)
- #define STATS_SET_FREEABLE(x, i) \
-@@ -472,19 +279,12 @@ static void **dbg_userword(kmem_cache_t
- #define BREAK_GFP_ORDER_LO 0
- static int slab_break_gfp_order = BREAK_GFP_ORDER_LO;
-
--/* Macros for storing/retrieving the cachep and or slab from the
-- * global 'mem_map'. These are used to find the slab an obj belongs to.
-- * With kfree(), these are used to find the cache which an obj belongs to.
-- */
--#define SET_PAGE_CACHE(pg,x) ((pg)->lru.next = (struct list_head *)(x))
--#define GET_PAGE_CACHE(pg) ((kmem_cache_t *)(pg)->lru.next)
--#define SET_PAGE_SLAB(pg,x) ((pg)->lru.prev = (struct list_head *)(x))
--#define GET_PAGE_SLAB(pg) ((struct slab *)(pg)->lru.prev)
--
- /* These are the default caches for kmalloc. Custom caches can have other sizes. */
- struct cache_sizes malloc_sizes[] = {
- #define CACHE(x) { .cs_size = (x) },
- #include <linux/kmalloc_sizes.h>
-+ { 0, },
-+#include <linux/kmalloc_sizes.h>
- { 0, }
- #undef CACHE
- };
-@@ -500,10 +300,17 @@ struct cache_names {
- static struct cache_names __initdata cache_names[] = {
- #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
- #include <linux/kmalloc_sizes.h>
-+ { NULL, },
-+#undef CACHE
-+#define CACHE(x) { .name = "size-" #x "(UBC)", .name_dma = "size-" #x "(DMA,UBC)" },
-+#include <linux/kmalloc_sizes.h>
- { NULL, }
- #undef CACHE
- };
-
-+int malloc_cache_num;
-+EXPORT_SYMBOL(malloc_cache_num);
-+
- static struct arraycache_init initarray_cache __initdata =
- { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
- static struct arraycache_init initarray_generic =
-@@ -525,6 +332,7 @@ static kmem_cache_t cache_cache = {
-
- /* Guard access to the cache-chain. */
- static struct semaphore cache_chain_sem;
-+static spinlock_t cache_chain_lock;
- static struct list_head cache_chain;
-
- /*
-@@ -566,6 +374,8 @@ static kmem_cache_t * kmem_find_general_
- {
- struct cache_sizes *csizep = malloc_sizes;
-
-+ if (gfpflags & __GFP_UBC)
-+ csizep += malloc_cache_num;
- /* This function could be moved to the header file, and
- * made inline so consumers can quickly determine what
- * cache pointer they require.
-@@ -586,13 +396,24 @@ static void cache_estimate (unsigned lon
- size_t wastage = PAGE_SIZE<<gfporder;
- size_t extra = 0;
- size_t base = 0;
-+ size_t ub_align, ub_extra;
-+
-+ ub_align = 1;
-+ ub_extra = 0;
-
- if (!(flags & CFLGS_OFF_SLAB)) {
- base = sizeof(struct slab);
- extra = sizeof(kmem_bufctl_t);
-+#ifdef CONFIG_USER_RESOURCE
-+ if (flags & SLAB_UBC) {
-+ ub_extra = sizeof(void *);
-+ ub_align = sizeof(void *);
-+ }
-+#endif
- }
- i = 0;
-- while (i*size + ALIGN(base+i*extra, align) <= wastage)
-+ while (i * size + ALIGN(ALIGN(base + i * extra, ub_align) +
-+ i * ub_extra, align) <= wastage)
- i++;
- if (i > 0)
- i--;
-@@ -601,8 +422,8 @@ static void cache_estimate (unsigned lon
- i = SLAB_LIMIT;
-
- *num = i;
-- wastage -= i*size;
-- wastage -= ALIGN(base+i*extra, align);
-+ wastage -= i * size + ALIGN(ALIGN(base + i * extra, ub_align) +
-+ i * ub_extra, align);
- *left_over = wastage;
- }
-
-@@ -724,6 +545,7 @@ void __init kmem_cache_init(void)
- size_t left_over;
- struct cache_sizes *sizes;
- struct cache_names *names;
-+ int i;
-
- /*
- * Fragmentation resistance on low memory - only use bigger
-@@ -751,6 +573,7 @@ void __init kmem_cache_init(void)
-
- /* 1) create the cache_cache */
- init_MUTEX(&cache_chain_sem);
-+ spin_lock_init(&cache_chain_lock);
- INIT_LIST_HEAD(&cache_chain);
- list_add(&cache_cache.next, &cache_chain);
- cache_cache.colour_off = cache_line_size();
-@@ -771,7 +594,7 @@ void __init kmem_cache_init(void)
- /* 2+3) create the kmalloc caches */
- sizes = malloc_sizes;
- names = cache_names;
--
-+ for (i = 0; i < 2; i++) {
- while (sizes->cs_size) {
- /* For performance, all the general caches are L1 aligned.
- * This should be particularly beneficial on SMP boxes, as it
-@@ -780,22 +603,28 @@ void __init kmem_cache_init(void)
- * allow tighter packing of the smaller caches. */
- sizes->cs_cachep = kmem_cache_create(names->name,
- sizes->cs_size, ARCH_KMALLOC_MINALIGN,
-- (ARCH_KMALLOC_FLAGS | SLAB_PANIC), NULL, NULL);
-+ (ARCH_KMALLOC_FLAGS | SLAB_PANIC |
-+ (i ? SLAB_UBC : 0) | SLAB_NO_CHARGE),
-+ NULL, NULL);
-
- /* Inc off-slab bufctl limit until the ceiling is hit. */
-- if (!(OFF_SLAB(sizes->cs_cachep))) {
-- offslab_limit = sizes->cs_size-sizeof(struct slab);
-- offslab_limit /= sizeof(kmem_bufctl_t);
-- }
-+ if (!(OFF_SLAB(sizes->cs_cachep)))
-+ offslab_limit = sizes->cs_size;
-
- sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
- sizes->cs_size, ARCH_KMALLOC_MINALIGN,
-- (ARCH_KMALLOC_FLAGS | SLAB_CACHE_DMA | SLAB_PANIC),
-+ (ARCH_KMALLOC_FLAGS | SLAB_CACHE_DMA | SLAB_PANIC |
-+ (i ? SLAB_UBC : 0) | SLAB_NO_CHARGE),
- NULL, NULL);
-
- sizes++;
- names++;
- }
-+ sizes++;
-+ names++;
-+ if (!i)
-+ malloc_cache_num = sizes - malloc_sizes;
-+ }
- /* 4) Replace the bootstrap head arrays */
- {
- void * ptr;
-@@ -1169,7 +998,7 @@ kmem_cache_create (const char *name, siz
- unsigned long flags, void (*ctor)(void*, kmem_cache_t *, unsigned long),
- void (*dtor)(void*, kmem_cache_t *, unsigned long))
- {
-- size_t left_over, slab_size;
-+ size_t left_over, slab_size, ub_size, ub_align;
- kmem_cache_t *cachep = NULL;
-
- /*
-@@ -1309,6 +1138,7 @@ kmem_cache_create (const char *name, siz
- */
- do {
- unsigned int break_flag = 0;
-+ unsigned long off_slab_size;
- cal_wastage:
- cache_estimate(cachep->gfporder, size, align, flags,
- &left_over, &cachep->num);
-@@ -1318,12 +1148,22 @@ cal_wastage:
- break;
- if (!cachep->num)
- goto next;
-- if (flags & CFLGS_OFF_SLAB &&
-- cachep->num > offslab_limit) {
-+ if (flags & CFLGS_OFF_SLAB) {
-+ off_slab_size = sizeof(struct slab) +
-+ cachep->num * sizeof(kmem_bufctl_t);
-+#ifdef CONFIG_USER_RESOURCE
-+ if (flags & SLAB_UBC)
-+ off_slab_size = ALIGN(off_slab_size,
-+ sizeof(void *)) +
-+ cachep->num * sizeof(void *);
-+#endif
-+
- /* This num of objs will cause problems. */
-- cachep->gfporder--;
-- break_flag++;
-- goto cal_wastage;
-+ if (off_slab_size > offslab_limit) {
-+ cachep->gfporder--;
-+ break_flag++;
-+ goto cal_wastage;
-+ }
- }
-
- /*
-@@ -1346,8 +1186,19 @@ next:
- cachep = NULL;
- goto opps;
- }
-- slab_size = ALIGN(cachep->num*sizeof(kmem_bufctl_t)
-- + sizeof(struct slab), align);
-+
-+ ub_size = 0;
-+ ub_align = 1;
-+#ifdef CONFIG_USER_RESOURCE
-+ if (flags & SLAB_UBC) {
-+ ub_size = sizeof(void *);
-+ ub_align = sizeof(void *);
-+ }
-+#endif
-+
-+ slab_size = ALIGN(ALIGN(cachep->num * sizeof(kmem_bufctl_t) +
-+ sizeof(struct slab), ub_align) +
-+ cachep->num * ub_size, align);
-
- /*
- * If the slab has been placed off-slab, and we have enough space then
-@@ -1360,7 +1211,9 @@ next:
-
- if (flags & CFLGS_OFF_SLAB) {
- /* really off slab. No need for manual alignment */
-- slab_size = cachep->num*sizeof(kmem_bufctl_t)+sizeof(struct slab);
-+ slab_size = ALIGN(cachep->num * sizeof(kmem_bufctl_t) +
-+ sizeof(struct slab), ub_align) +
-+ cachep->num * ub_size;
- }
-
- cachep->colour_off = cache_line_size();
-@@ -1457,9 +1310,21 @@ next:
- }
-
- /* cache setup completed, link it into the list */
-+ spin_lock(&cache_chain_lock);
- list_add(&cachep->next, &cache_chain);
-+ spin_unlock(&cache_chain_lock);
- up(&cache_chain_sem);
- unlock_cpu_hotplug();
-+
-+#ifdef CONFIG_USER_RESOURCE
-+ cachep->objuse = ((PAGE_SIZE << cachep->gfporder) + cachep->num - 1) /
-+ cachep->num;
-+ if (OFF_SLAB(cachep))
-+ cachep->objuse +=
-+ (cachep->slabp_cache->objuse + cachep->num - 1)
-+ / cachep->num;
-+#endif
-+
- opps:
- if (!cachep && (flags & SLAB_PANIC))
- panic("kmem_cache_create(): failed to create slab `%s'\n",
-@@ -1561,6 +1426,7 @@ static int __cache_shrink(kmem_cache_t *
- BUG();
- #endif
- list_del(&slabp->list);
-+ STATS_INC_SHRUNK(cachep);
-
- cachep->lists.free_objects -= cachep->num;
- spin_unlock_irq(&cachep->spinlock);
-@@ -1622,13 +1488,17 @@ int kmem_cache_destroy (kmem_cache_t * c
- /*
- * the chain is never empty, cache_cache is never destroyed
- */
-+ spin_lock(&cache_chain_lock);
- list_del(&cachep->next);
-+ spin_unlock(&cache_chain_lock);
- up(&cache_chain_sem);
-
- if (__cache_shrink(cachep)) {
- slab_error(cachep, "Can't free all objects");
- down(&cache_chain_sem);
-+ spin_lock(&cache_chain_lock);
- list_add(&cachep->next,&cache_chain);
-+ spin_unlock(&cache_chain_lock);
- up(&cache_chain_sem);
- unlock_cpu_hotplug();
- return 1;
-@@ -1646,6 +1516,7 @@ int kmem_cache_destroy (kmem_cache_t * c
- /* NUMA: free the list3 structures */
- kfree(cachep->lists.shared);
- cachep->lists.shared = NULL;
-+ ub_kmemcache_free(cachep);
- kmem_cache_free(&cache_cache, cachep);
-
- unlock_cpu_hotplug();
-@@ -1660,28 +1531,30 @@ static struct slab* alloc_slabmgmt (kmem
- void *objp, int colour_off, int local_flags)
- {
- struct slab *slabp;
--
-+
- if (OFF_SLAB(cachep)) {
- /* Slab management obj is off-slab. */
-- slabp = kmem_cache_alloc(cachep->slabp_cache, local_flags);
-+ slabp = kmem_cache_alloc(cachep->slabp_cache,
-+ local_flags & (~__GFP_UBC));
- if (!slabp)
- return NULL;
- } else {
- slabp = objp+colour_off;
- colour_off += cachep->slab_size;
- }
-+
- slabp->inuse = 0;
- slabp->colouroff = colour_off;
- slabp->s_mem = objp+colour_off;
-
-+#ifdef CONFIG_USER_RESOURCE
-+ if (cachep->flags & SLAB_UBC)
-+ memset(slab_ubcs(cachep, slabp), 0, cachep->num *
-+ sizeof(struct user_beancounter *));
-+#endif
- return slabp;
- }
-
--static inline kmem_bufctl_t *slab_bufctl(struct slab *slabp)
--{
-- return (kmem_bufctl_t *)(slabp+1);
--}
--
- static void cache_init_objs (kmem_cache_t * cachep,
- struct slab * slabp, unsigned long ctor_flags)
- {
-@@ -1809,7 +1682,7 @@ static int cache_grow (kmem_cache_t * ca
-
-
- /* Get mem for the objs. */
-- if (!(objp = kmem_getpages(cachep, flags, -1)))
-+ if (!(objp = kmem_getpages(cachep, flags & (~__GFP_UBC), -1)))
- goto failed;
-
- /* Get slab management. */
-@@ -2112,6 +1985,16 @@ cache_alloc_debugcheck_after(kmem_cache_
- #define cache_alloc_debugcheck_after(a,b,objp,d) (objp)
- #endif
-
-+static inline int should_charge(kmem_cache_t *cachep, int flags, void *objp)
-+{
-+ if (objp == NULL)
-+ return 0;
-+ if (!(cachep->flags & SLAB_UBC))
-+ return 0;
-+ if ((cachep->flags & SLAB_NO_CHARGE) && !(flags & __GFP_UBC))
-+ return 0;
-+ return 1;
-+}
-
- static inline void * __cache_alloc (kmem_cache_t *cachep, int flags)
- {
-@@ -2131,9 +2014,19 @@ static inline void * __cache_alloc (kmem
- STATS_INC_ALLOCMISS(cachep);
- objp = cache_alloc_refill(cachep, flags);
- }
-+ if (should_charge(cachep, flags, objp) &&
-+ ub_slab_charge(objp, flags) < 0)
-+ goto out_err;
- local_irq_restore(save_flags);
-+
- objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0));
- return objp;
-+
-+out_err:
-+ local_irq_restore(save_flags);
-+ objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0));
-+ kmem_cache_free(cachep, objp);
-+ return NULL;
- }
-
- /*
-@@ -2175,6 +2068,7 @@ static void free_block(kmem_cache_t *cac
- /* fixup slab chains */
- if (slabp->inuse == 0) {
- if (cachep->lists.free_objects > cachep->free_limit) {
-+ STATS_INC_SHRUNK(cachep);
- cachep->lists.free_objects -= cachep->num;
- slab_destroy(cachep, slabp);
- } else {
-@@ -2192,6 +2086,17 @@ static void free_block(kmem_cache_t *cac
- }
- }
-
-+void kmem_cache_free_block(kmem_cache_t *cachep, void **objpp, int nr_objects)
-+{
-+ unsigned long flags;
-+
-+ if (!nr_objects)
-+ return;
-+ spin_lock_irqsave(&cachep->spinlock, flags);
-+ free_block(cachep, objpp, nr_objects);
-+ spin_unlock_irqrestore(&cachep->spinlock, flags);
-+}
-+
- static void cache_flusharray (kmem_cache_t* cachep, struct array_cache *ac)
- {
- int batchcount;
-@@ -2256,6 +2161,9 @@ static inline void __cache_free (kmem_ca
- check_irq_off();
- objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
-
-+ if (cachep->flags & SLAB_UBC)
-+ ub_slab_uncharge(objp);
-+
- if (likely(ac->avail < ac->limit)) {
- STATS_INC_FREEHIT(cachep);
- ac_entry(ac)[ac->avail++] = objp;
-@@ -2424,6 +2332,8 @@ void * __kmalloc (size_t size, int flags
- {
- struct cache_sizes *csizep = malloc_sizes;
-
-+ if (flags & __GFP_UBC)
-+ csizep += malloc_cache_num;
- for (; csizep->cs_size; csizep++) {
- if (size > csizep->cs_size)
- continue;
-@@ -2583,6 +2493,7 @@ free_percpu(const void *objp)
- continue;
- kfree(p->ptrs[i]);
- }
-+ kfree(p);
- }
-
- EXPORT_SYMBOL(free_percpu);
-@@ -2761,6 +2672,7 @@ static void cache_reap(void *unused)
- return;
- }
-
-+ {KSTAT_PERF_ENTER(cache_reap)
- list_for_each(walk, &cache_chain) {
- kmem_cache_t *searchp;
- struct list_head* p;
-@@ -2819,10 +2731,68 @@ next:
- }
- check_irq_on();
- up(&cache_chain_sem);
-+ KSTAT_PERF_LEAVE(cache_reap)}
- /* Setup the next iteration */
- schedule_delayed_work(&__get_cpu_var(reap_work), REAPTIMEOUT_CPUC + smp_processor_id());
- }
-
-+#define SHOW_TOP_SLABS 7
-+
-+static unsigned long get_cache_size(kmem_cache_t *cachep)
-+{
-+ unsigned long flags;
-+ unsigned long slabs;
-+ struct slab *slabp;
-+
-+ slabs = 0;
-+
-+ spin_lock_irqsave(&cachep->spinlock, flags);
-+ list_for_each_entry(slabp, &cachep->lists.slabs_full, list)
-+ slabs++;
-+ list_for_each_entry(slabp, &cachep->lists.slabs_partial, list)
-+ slabs++;
-+ list_for_each_entry(slabp, &cachep->lists.slabs_free, list)
-+ slabs++;
-+ spin_unlock_irqrestore(&cachep->spinlock, flags);
-+
-+ return slabs * (PAGE_SIZE << cachep->gfporder) +
-+ (OFF_SLAB(cachep) ? cachep->slabp_cache->objsize * slabs : 0);
-+}
-+
-+void show_slab_info(void)
-+{
-+ int i, j;
-+ unsigned long size;
-+ kmem_cache_t *ptr;
-+ unsigned long sizes[SHOW_TOP_SLABS];
-+ kmem_cache_t *top[SHOW_TOP_SLABS];
-+
-+ memset(top, 0, sizeof(top));
-+ memset(sizes, 0, sizeof(sizes));
-+
-+ printk("Top %d caches:\n", SHOW_TOP_SLABS);
-+ spin_lock(&cache_chain_lock);
-+ list_for_each_entry(ptr, &cache_chain, next) {
-+ size = get_cache_size(ptr);
-+
-+ j = 0;
-+ for (i = 1; i < SHOW_TOP_SLABS; i++)
-+ if (sizes[i] < sizes[j])
-+ j = i;
-+
-+ if (size > sizes[j]) {
-+ sizes[j] = size;
-+ top[j] = ptr;
-+ }
-+ }
-+
-+ for (i = 0; i < SHOW_TOP_SLABS; i++)
-+ if (top[i])
-+ printk(" %-21s: size %10lu objsize %10u\n", top[i]->name,
-+ sizes[i], top[i]->objsize);
-+ spin_unlock(&cache_chain_lock);
-+}
-+
- #ifdef CONFIG_PROC_FS
-
- static void *s_start(struct seq_file *m, loff_t *pos)
-@@ -2845,7 +2815,7 @@ static void *s_start(struct seq_file *m,
- seq_puts(m, " : tunables <batchcount> <limit> <sharedfactor>");
- seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
- #if STATS
-- seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <freelimit>");
-+ seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <freelimit> <shrunk>");
- seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
- #endif
- seq_putc(m, '\n');
-@@ -2919,7 +2889,7 @@ static int s_show(struct seq_file *m, vo
- if (error)
- printk(KERN_ERR "slab: cache %s error: %s\n", name, error);
-
-- seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
-+ seq_printf(m, "%-21s %6lu %6lu %6u %4u %4d",
- name, active_objs, num_objs, cachep->objsize,
- cachep->num, (1<<cachep->gfporder));
- seq_printf(m, " : tunables %4u %4u %4u",
-@@ -2933,13 +2903,14 @@ static int s_show(struct seq_file *m, vo
- unsigned long allocs = cachep->num_allocations;
- unsigned long grown = cachep->grown;
- unsigned long reaped = cachep->reaped;
-+ unsigned long shrunk = cachep->shrunk;
- unsigned long errors = cachep->errors;
- unsigned long max_freeable = cachep->max_freeable;
- unsigned long free_limit = cachep->free_limit;
-
-- seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu %4lu %4lu %4lu",
-+ seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu %4lu %4lu %4lu %5lu",
- allocs, high, grown, reaped, errors,
-- max_freeable, free_limit);
-+ max_freeable, free_limit, shrunk);
- }
- /* cpu stats */
- {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/swap.c linux-2.6.9-ve023stab030/mm/swap.c
---- linux-2.6.9-42.0.3.EL.orig/mm/swap.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/swap.c 2006-10-11 19:07:59.000000000 +0400
-@@ -158,6 +158,7 @@ void fastcall lru_cache_add_active(struc
- __pagevec_lru_add_active(pvec);
- put_cpu_var(lru_add_active_pvecs);
- }
-+EXPORT_SYMBOL(lru_cache_add_active);
-
- void lru_add_drain(void)
- {
-@@ -170,6 +171,7 @@ void lru_add_drain(void)
- __pagevec_lru_add_active(pvec);
- put_cpu_var(lru_add_pvecs);
- }
-+EXPORT_SYMBOL(lru_add_drain);
-
- /*
- * This path almost never happens for VM activity - pages are normally
-@@ -351,7 +353,9 @@ void pagevec_strip(struct pagevec *pvec)
- struct page *page = pvec->pages[i];
-
- if (PagePrivate(page) && !TestSetPageLocked(page)) {
-- try_to_release_page(page, 0);
-+ /* need to recheck after lock */
-+ if (page_has_buffers(page))
-+ try_to_release_page(page, 0);
- unlock_page(page);
- }
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/swap_state.c linux-2.6.9-ve023stab030/mm/swap_state.c
---- linux-2.6.9-42.0.3.EL.orig/mm/swap_state.c 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/swap_state.c 2006-10-11 19:07:59.000000000 +0400
-@@ -14,9 +14,15 @@
- #include <linux/pagemap.h>
- #include <linux/buffer_head.h>
- #include <linux/backing-dev.h>
-+#include <linux/kernel_stat.h>
-
- #include <asm/pgtable.h>
-
-+#include <ub/beancounter.h>
-+#include <ub/ub_mem.h>
-+#include <ub/ub_page.h>
-+#include <ub/ub_vmpages.h>
-+
- /*
- * swapper_space is a fiction, retained to simplify the path through
- * vmscan's shrink_list, to make sync_page look nicer, and to allow
-@@ -42,23 +48,20 @@ struct address_space swapper_space = {
- };
- EXPORT_SYMBOL(swapper_space);
-
-+/* can't remove variable swap_cache_info due to dynamic kernel */
- #define INC_CACHE_INFO(x) do { swap_cache_info.x++; } while (0)
-
--static struct {
-- unsigned long add_total;
-- unsigned long del_total;
-- unsigned long find_success;
-- unsigned long find_total;
-- unsigned long noent_race;
-- unsigned long exist_race;
--} swap_cache_info;
-+struct swap_cache_info_struct swap_cache_info;
-+EXPORT_SYMBOL(swap_cache_info);
-
- void show_swap_cache_info(void)
- {
-- printk("Swap cache: add %lu, delete %lu, find %lu/%lu, race %lu+%lu\n",
-+ printk("Swap cache: add %lu, delete %lu, find %lu/%lu, "
-+ "race %lu+%lu+%lu\n",
- swap_cache_info.add_total, swap_cache_info.del_total,
- swap_cache_info.find_success, swap_cache_info.find_total,
-- swap_cache_info.noent_race, swap_cache_info.exist_race);
-+ swap_cache_info.noent_race, swap_cache_info.exist_race,
-+ swap_cache_info.remove_race);
- }
-
- /*
-@@ -90,8 +93,9 @@ static int __add_to_swap_cache(struct pa
- }
- return error;
- }
-+EXPORT_SYMBOL(__add_to_swap_cache);
-
--static int add_to_swap_cache(struct page *page, swp_entry_t entry)
-+int add_to_swap_cache(struct page *page, swp_entry_t entry)
- {
- int error;
-
-@@ -112,6 +116,7 @@ static int add_to_swap_cache(struct page
- INC_CACHE_INFO(add_total);
- return 0;
- }
-+EXPORT_SYMBOL(add_to_swap_cache);
-
- /*
- * This must be called only on pages that have
-@@ -148,7 +153,14 @@ int add_to_swap(struct page * page)
- BUG();
-
- for (;;) {
-- entry = get_swap_page();
-+ struct user_beancounter *ub;
-+
-+ ub = pb_grab_page_ub(page);
-+ if (IS_ERR(ub))
-+ return 0;
-+
-+ entry = get_swap_page(ub);
-+ put_beancounter(ub);
- if (!entry.val)
- return 0;
-
-@@ -194,6 +206,7 @@ int add_to_swap(struct page * page)
- }
- }
- }
-+EXPORT_SYMBOL(add_to_swap);
-
- /*
- * This must be called only on pages that have
-@@ -264,10 +277,13 @@ int move_from_swap_cache(struct page *pa
- */
- static inline void free_swap_cache(struct page *page)
- {
-- if (PageSwapCache(page) && !TestSetPageLocked(page)) {
-+ if (!PageSwapCache(page))
-+ return;
-+ if (!TestSetPageLocked(page)) {
- remove_exclusive_swap_page(page);
- unlock_page(page);
-- }
-+ } else
-+ INC_CACHE_INFO(remove_race);
- }
-
- /*
-@@ -323,6 +339,7 @@ struct page * lookup_swap_cache(swp_entr
- INC_CACHE_INFO(find_total);
- return page;
- }
-+EXPORT_SYMBOL(lookup_swap_cache);
-
- /*
- * Locate a page of swap in physical memory, reserving swap cache space
-@@ -385,3 +402,4 @@ struct page *read_swap_cache_async(swp_e
- page_cache_release(new_page);
- return found_page;
- }
-+EXPORT_SYMBOL(read_swap_cache_async);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/swapfile.c linux-2.6.9-ve023stab030/mm/swapfile.c
---- linux-2.6.9-42.0.3.EL.orig/mm/swapfile.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/swapfile.c 2006-10-11 19:07:59.000000000 +0400
-@@ -30,11 +30,14 @@
- #include <asm/tlbflush.h>
- #include <linux/swapops.h>
-
-+#include <ub/ub_vmpages.h>
-+
- spinlock_t swaplock = SPIN_LOCK_UNLOCKED;
- unsigned int nr_swapfiles;
- long total_swap_pages;
- static int swap_overflow;
-
-+EXPORT_SYMBOL(swaplock);
- EXPORT_SYMBOL(total_swap_pages);
-
- static const char Bad_file[] = "Bad swap file entry ";
-@@ -48,6 +51,9 @@ struct swap_info_struct swap_info[MAX_SW
-
- static DECLARE_MUTEX(swapon_sem);
-
-+EXPORT_SYMBOL(swap_list);
-+EXPORT_SYMBOL(swap_info);
-+
- /*
- * We need this because the bdev->unplug_fn can sleep and we cannot
- * hold swap_list_lock while calling the unplug_fn. And swap_list_lock
-@@ -147,7 +153,7 @@ static inline int scan_swap_map(struct s
- return 0;
- }
-
--swp_entry_t get_swap_page(void)
-+swp_entry_t get_swap_page(struct user_beancounter *ub)
- {
- struct swap_info_struct * p;
- unsigned long offset;
-@@ -164,7 +170,7 @@ swp_entry_t get_swap_page(void)
-
- while (1) {
- p = &swap_info[type];
-- if ((p->flags & SWP_ACTIVE) == SWP_ACTIVE) {
-+ if ((p->flags & (SWP_ACTIVE|SWP_READONLY)) == SWP_ACTIVE) {
- swap_device_lock(p);
- offset = scan_swap_map(p);
- swap_device_unlock(p);
-@@ -177,6 +183,12 @@ swp_entry_t get_swap_page(void)
- } else {
- swap_list.next = type;
- }
-+#if CONFIG_USER_SWAP_ACCOUNTING
-+ if (p->owner_map[offset] != NULL)
-+ BUG();
-+ ub_swapentry_inc(ub);
-+ p->owner_map[offset] = get_beancounter(ub);
-+#endif
- goto out;
- }
- }
-@@ -194,6 +206,7 @@ out:
- swap_list_unlock();
- return entry;
- }
-+EXPORT_SYMBOL(get_swap_page);
-
- static struct swap_info_struct * swap_info_get(swp_entry_t entry)
- {
-@@ -248,6 +261,11 @@ static int swap_entry_free(struct swap_i
- count--;
- p->swap_map[offset] = count;
- if (!count) {
-+#if CONFIG_USER_SWAP_ACCOUNTING
-+ ub_swapentry_dec(p->owner_map[offset]);
-+ put_beancounter(p->owner_map[offset]);
-+ p->owner_map[offset] = NULL;
-+#endif
- if (offset < p->lowest_bit)
- p->lowest_bit = offset;
- if (offset > p->highest_bit)
-@@ -273,6 +291,7 @@ void swap_free(swp_entry_t entry)
- swap_info_put(p);
- }
- }
-+EXPORT_SYMBOL(swap_free);
-
- /*
- * Check if we're the only user of a swap page,
-@@ -288,7 +307,8 @@ static int exclusive_swap_page(struct pa
- p = swap_info_get(entry);
- if (p) {
- /* Is the only swap cache user the cache itself? */
-- if (p->swap_map[swp_offset(entry)] == 1) {
-+ if ((p->flags & (SWP_ACTIVE|SWP_READONLY)) == SWP_ACTIVE &&
-+ p->swap_map[swp_offset(entry)] == 1) {
- /* Recheck the page count with the swapcache lock held.. */
- spin_lock_irq(&swapper_space.tree_lock);
- if (page_count(page) == 2)
-@@ -379,6 +399,54 @@ int remove_exclusive_swap_page(struct pa
- return retval;
- }
-
-+int try_to_remove_exclusive_swap_page(struct page *page)
-+{
-+ int retval;
-+ struct swap_info_struct * p;
-+ swp_entry_t entry;
-+
-+ BUG_ON(PagePrivate(page));
-+ BUG_ON(!PageLocked(page));
-+
-+ if (!PageSwapCache(page))
-+ return 0;
-+ if (PageWriteback(page))
-+ return 0;
-+ if (page_count(page) != 2) /* 2: us + cache */
-+ return 0;
-+
-+ entry.val = page->private;
-+ p = swap_info_get(entry);
-+ if (!p)
-+ return 0;
-+ if (!vm_swap_full() &&
-+ (p->flags & (SWP_ACTIVE|SWP_READONLY)) == SWP_ACTIVE) {
-+ swap_info_put(p);
-+ return 0;
-+ }
-+
-+ /* Is the only swap cache user the cache itself? */
-+ retval = 0;
-+ if (p->swap_map[swp_offset(entry)] == 1) {
-+ /* Recheck the page count with the swapcache lock held.. */
-+ spin_lock_irq(&swapper_space.tree_lock);
-+ if ((page_count(page) == 2) && !PageWriteback(page)) {
-+ __delete_from_swap_cache(page);
-+ SetPageDirty(page);
-+ retval = 1;
-+ }
-+ spin_unlock_irq(&swapper_space.tree_lock);
-+ }
-+ swap_info_put(p);
-+
-+ if (retval) {
-+ swap_free(entry);
-+ page_cache_release(page);
-+ }
-+
-+ return retval;
-+}
-+
- /*
- * Free the swap entry like above, but also try to
- * free the page cache entry if it is the last user.
-@@ -415,6 +483,7 @@ void free_swap_and_cache(swp_entry_t ent
- page_cache_release(page);
- }
- }
-+EXPORT_SYMBOL(free_swap_and_cache);
-
- /*
- * The swap entry has been read in advance, and we return 1 to indicate
-@@ -428,9 +497,12 @@ void free_swap_and_cache(swp_entry_t ent
- /* vma->vm_mm->page_table_lock is held */
- static void
- unuse_pte(struct vm_area_struct *vma, unsigned long address, pte_t *dir,
-- swp_entry_t entry, struct page *page)
-+ swp_entry_t entry, struct page *page, struct page_beancounter **ppbs)
- {
- vma->vm_mm->rss++;
-+ vma->vm_rss++;
-+ ub_unused_privvm_dec(mm_ub(vma->vm_mm), 1, vma);
-+ pb_add_list_ref(page, mm_ub(vma->vm_mm), ppbs);
- get_page(page);
- set_pte(dir, pte_mkold(mk_pte(page, vma->vm_page_prot)));
- page_add_anon_rmap(page, vma, address);
-@@ -440,7 +512,7 @@ unuse_pte(struct vm_area_struct *vma, un
- /* vma->vm_mm->page_table_lock is held */
- static unsigned long unuse_pmd(struct vm_area_struct * vma, pmd_t *dir,
- unsigned long address, unsigned long size, unsigned long offset,
-- swp_entry_t entry, struct page *page)
-+ swp_entry_t entry, struct page *page, struct page_beancounter **ppbs)
- {
- pte_t * pte;
- unsigned long end;
-@@ -465,7 +537,8 @@ static unsigned long unuse_pmd(struct vm
- * Test inline before going to call unuse_pte.
- */
- if (unlikely(pte_same(*pte, swp_pte))) {
-- unuse_pte(vma, offset + address, pte, entry, page);
-+ unuse_pte(vma, offset + address, pte, entry, page,
-+ ppbs);
- pte_unmap(pte);
-
- /*
-@@ -486,8 +559,8 @@ static unsigned long unuse_pmd(struct vm
-
- /* vma->vm_mm->page_table_lock is held */
- static unsigned long unuse_pgd(struct vm_area_struct * vma, pgd_t *dir,
-- unsigned long address, unsigned long size,
-- swp_entry_t entry, struct page *page)
-+ unsigned long address, unsigned long size, swp_entry_t entry,
-+ struct page *page, struct page_beancounter **ppbs)
- {
- pmd_t * pmd;
- unsigned long offset, end;
-@@ -510,7 +583,7 @@ static unsigned long unuse_pgd(struct vm
- BUG();
- do {
- foundaddr = unuse_pmd(vma, pmd, address, end - address,
-- offset, entry, page);
-+ offset, entry, page, ppbs);
- if (foundaddr)
- return foundaddr;
- address = (address + PMD_SIZE) & PMD_MASK;
-@@ -521,7 +594,7 @@ static unsigned long unuse_pgd(struct vm
-
- /* vma->vm_mm->page_table_lock is held */
- static unsigned long unuse_vma(struct vm_area_struct * vma,
-- swp_entry_t entry, struct page *page)
-+ swp_entry_t entry, struct page *page, struct page_beancounter **ppbs)
- {
- pgd_t *pgdir;
- unsigned long start, end;
-@@ -540,7 +613,7 @@ static unsigned long unuse_vma(struct vm
- pgdir = pgd_offset(vma->vm_mm, start);
- do {
- foundaddr = unuse_pgd(vma, pgdir, start, end - start,
-- entry, page);
-+ entry, page, ppbs);
- if (foundaddr)
- return foundaddr;
- start = (start + PGDIR_SIZE) & PGDIR_MASK;
-@@ -550,7 +623,8 @@ static unsigned long unuse_vma(struct vm
- }
-
- static int unuse_process(struct mm_struct * mm,
-- swp_entry_t entry, struct page* page)
-+ swp_entry_t entry, struct page* page,
-+ struct page_beancounter **ppbs)
- {
- struct vm_area_struct* vma;
- unsigned long foundaddr = 0;
-@@ -570,7 +644,7 @@ static int unuse_process(struct mm_struc
- spin_lock(&mm->page_table_lock);
- for (vma = mm->mmap; vma; vma = vma->vm_next) {
- if (vma->anon_vma) {
-- foundaddr = unuse_vma(vma, entry, page);
-+ foundaddr = unuse_vma(vma, entry, page, ppbs);
- if (foundaddr)
- break;
- }
-@@ -638,6 +712,7 @@ static int try_to_unuse(unsigned int typ
- int retval = 0;
- int reset_overflow = 0;
- int shmem;
-+ struct page_beancounter *pb_list;
-
- /*
- * When searching mms for an entry, a good strategy is to
-@@ -696,6 +771,13 @@ static int try_to_unuse(unsigned int typ
- break;
- }
-
-+ pb_list = NULL;
-+ if (pb_reserve_all(&pb_list)) {
-+ page_cache_release(page);
-+ retval = -ENOMEM;
-+ break;
-+ }
-+
- /*
- * Don't hold on to start_mm if it looks like exiting.
- */
-@@ -718,6 +800,20 @@ static int try_to_unuse(unsigned int typ
- lock_page(page);
- wait_on_page_writeback(page);
-
-+ /* If read failed we cannot map not-uptodate page to
-+ * user space. Actually, we are in serious troubles,
-+ * we do not even know what process to kill. So, the only
-+ * variant remains: to stop swapoff() and allow someone
-+ * to kill processes to zap invalid pages.
-+ */
-+ if (unlikely(!PageUptodate(page))) {
-+ pb_free_list(&pb_list);
-+ unlock_page(page);
-+ page_cache_release(page);
-+ retval = -EIO;
-+ break;
-+ }
-+
- /*
- * Remove all references to entry, without blocking.
- * Whenever we reach init_mm, there's no address space
-@@ -729,8 +825,10 @@ static int try_to_unuse(unsigned int typ
- if (start_mm == &init_mm)
- shmem = shmem_unuse(entry, page);
- else
-- retval = unuse_process(start_mm, entry, page);
-+ retval = unuse_process(start_mm, entry, page,
-+ &pb_list);
- }
-+
- if (*swap_map > 1) {
- int set_start_mm = (*swap_map >= swcount);
- struct list_head *p = &start_mm->mmlist;
-@@ -758,7 +856,8 @@ static int try_to_unuse(unsigned int typ
- set_start_mm = 1;
- shmem = shmem_unuse(entry, page);
- } else
-- retval = unuse_process(mm, entry, page);
-+ retval = unuse_process(mm, entry, page,
-+ &pb_list);
- if (set_start_mm && *swap_map < swcount) {
- mmput(new_start_mm);
- atomic_inc(&mm->mm_users);
-@@ -772,6 +871,8 @@ static int try_to_unuse(unsigned int typ
- mmput(start_mm);
- start_mm = new_start_mm;
- }
-+
-+ pb_free_list(&pb_list);
- if (retval) {
- unlock_page(page);
- page_cache_release(page);
-@@ -1087,6 +1188,7 @@ asmlinkage long sys_swapoff(const char _
- {
- struct swap_info_struct * p = NULL;
- unsigned short *swap_map;
-+ struct user_beancounter **owner_map;
- struct file *swap_file, *victim;
- struct address_space *mapping;
- struct inode *inode;
-@@ -1094,6 +1196,10 @@ asmlinkage long sys_swapoff(const char _
- int i, type, prev;
- int err;
-
-+ /* VE admin check is just to be on the safe side, the admin may affect
-+ * swaps only if he has access to special, i.e. if he has been granted
-+ * access to the block device or if the swap file is in the area
-+ * visible to him. */
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
-@@ -1177,12 +1283,15 @@ asmlinkage long sys_swapoff(const char _
- p->max = 0;
- swap_map = p->swap_map;
- p->swap_map = NULL;
-+ owner_map = p->owner_map;
-+ p->owner_map = NULL;
- p->flags = 0;
- destroy_swap_extents(p);
- swap_device_unlock(p);
- swap_list_unlock();
- up(&swapon_sem);
- vfree(swap_map);
-+ vfree(owner_map);
- inode = mapping->host;
- if (S_ISBLK(inode->i_mode)) {
- struct block_device *bdev = I_BDEV(inode);
-@@ -1201,6 +1310,7 @@ out_dput:
- out:
- return err;
- }
-+EXPORT_SYMBOL(sys_swapoff);
-
- #ifdef CONFIG_PROC_FS
- /* iterator */
-@@ -1319,6 +1429,7 @@ asmlinkage long sys_swapon(const char __
- struct page *page = NULL;
- struct inode *inode = NULL;
- int did_down = 0;
-+ struct user_beancounter **owner_map;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-@@ -1356,6 +1467,7 @@ asmlinkage long sys_swapon(const char __
- p->highest_bit = 0;
- p->cluster_nr = 0;
- p->inuse_pages = 0;
-+ p->owner_map = NULL;
- p->sdev_lock = SPIN_LOCK_UNLOCKED;
- p->next = -1;
- if (swap_flags & SWAP_FLAG_PREFER) {
-@@ -1522,6 +1634,15 @@ asmlinkage long sys_swapon(const char __
- error = -EINVAL;
- goto bad_swap;
- }
-+#if CONFIG_USER_SWAP_ACCOUNTING
-+ p->owner_map = vmalloc(maxpages * sizeof(struct user_beancounter *));
-+ if (!p->owner_map) {
-+ error = -ENOMEM;
-+ goto bad_swap;
-+ }
-+ memset(p->owner_map, 0,
-+ maxpages * sizeof(struct user_beancounter *));
-+#endif
- p->swap_map[0] = SWAP_MAP_BAD;
- p->max = maxpages;
- p->pages = nr_good_pages;
-@@ -1534,6 +1655,8 @@ asmlinkage long sys_swapon(const char __
- swap_list_lock();
- swap_device_lock(p);
- p->flags = SWP_ACTIVE;
-+ if (swap_flags & SWAP_FLAG_READONLY)
-+ p->flags |= SWP_READONLY;
- nr_swap_pages += nr_good_pages;
- total_swap_pages += nr_good_pages;
- printk(KERN_INFO "Adding %dk swap on %s. Priority:%d extents:%d\n",
-@@ -1567,6 +1690,7 @@ bad_swap:
- bad_swap_2:
- swap_list_lock();
- swap_map = p->swap_map;
-+ owner_map = p->owner_map;
- p->swap_file = NULL;
- p->swap_map = NULL;
- p->flags = 0;
-@@ -1576,6 +1700,8 @@ bad_swap_2:
- destroy_swap_extents(p);
- if (swap_map)
- vfree(swap_map);
-+ if (owner_map)
-+ vfree(owner_map);
- if (swap_file)
- filp_close(swap_file, NULL);
- out:
-@@ -1592,6 +1718,7 @@ out:
- }
- return error;
- }
-+EXPORT_SYMBOL(sys_swapon);
-
- void si_swapinfo(struct sysinfo *val)
- {
-@@ -1648,6 +1775,7 @@ bad_file:
- printk(KERN_ERR "swap_dup: %s%08lx\n", Bad_file, entry.val);
- goto out;
- }
-+EXPORT_SYMBOL(swap_duplicate);
-
- struct swap_info_struct *
- get_swap_info_struct(unsigned type)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/vmalloc.c linux-2.6.9-ve023stab030/mm/vmalloc.c
---- linux-2.6.9-42.0.3.EL.orig/mm/vmalloc.c 2006-10-11 18:29:42.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/vmalloc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -19,6 +19,7 @@
- #include <asm/uaccess.h>
- #include <asm/tlbflush.h>
-
-+#include <ub/ub_debug.h>
-
- rwlock_t vmlist_lock = RW_LOCK_UNLOCKED;
- struct vm_struct *vmlist;
-@@ -267,6 +268,66 @@ struct vm_struct *get_vm_area(unsigned l
- return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END);
- }
-
-+struct vm_struct * get_vm_area_best(unsigned long size, unsigned long flags)
-+{
-+ unsigned long addr, best_addr, delta, best_delta;
-+ struct vm_struct **p, **best_p, *tmp, *area;
-+
-+ area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
-+ if (!area)
-+ return NULL;
-+
-+ size += PAGE_SIZE; /* one-page gap at the end */
-+ addr = VMALLOC_START;
-+ best_addr = 0UL;
-+ best_p = NULL;
-+ best_delta = PAGE_ALIGN(VMALLOC_END) - VMALLOC_START;
-+
-+ write_lock(&vmlist_lock);
-+ for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
-+ if ((size + addr) < addr)
-+ break;
-+ delta = (unsigned long) tmp->addr - (size + addr);
-+ if (delta < best_delta) {
-+ best_delta = delta;
-+ best_addr = addr;
-+ best_p = p;
-+ }
-+ addr = tmp->size + (unsigned long) tmp->addr;
-+ if (addr > VMALLOC_END-size)
-+ break;
-+ }
-+
-+ if (!tmp) {
-+ /* check free area after list end */
-+ delta = (unsigned long) PAGE_ALIGN(VMALLOC_END) - (size + addr);
-+ if (delta < best_delta) {
-+ best_delta = delta;
-+ best_addr = addr;
-+ best_p = p;
-+ }
-+ }
-+ if (best_addr) {
-+ area->flags = flags;
-+ /* allocate at the end of this area */
-+ area->addr = (void *)(best_addr + best_delta);
-+ area->size = size;
-+ area->next = *best_p;
-+ area->pages = NULL;
-+ area->nr_pages = 0;
-+ area->phys_addr = 0;
-+ *best_p = area;
-+ /* check like in __vunmap */
-+ WARN_ON((PAGE_SIZE - 1) & (unsigned long)area->addr);
-+ } else {
-+ kfree(area);
-+ area = NULL;
-+ }
-+ write_unlock(&vmlist_lock);
-+
-+ return area;
-+}
-+
- /**
- * remove_vm_area - find and remove a contingous kernel virtual area
- *
-@@ -319,6 +380,7 @@ void __vunmap(void *addr, int deallocate
- if (deallocate_pages) {
- int i;
-
-+ dec_vmalloc_charged(area);
- for (i = 0; i < area->nr_pages; i++) {
- if (unlikely(!area->pages[i]))
- BUG();
-@@ -414,17 +476,20 @@ EXPORT_SYMBOL(vmap);
- * allocator with @gfp_mask flags. Map them into contiguous
- * kernel virtual space, using a pagetable protection of @prot.
- */
--void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot)
-+void *____vmalloc(unsigned long size, int gfp_mask, pgprot_t prot, int best)
- {
- struct vm_struct *area;
- struct page **pages;
-- unsigned int nr_pages, array_size, i;
-+ unsigned int nr_pages, array_size, i, j;
-
- size = PAGE_ALIGN(size);
- if (!size || (size >> PAGE_SHIFT) > num_physpages)
- return NULL;
-
-- area = get_vm_area(size, VM_ALLOC);
-+ if (best)
-+ area = get_vm_area_best(size, VM_ALLOC);
-+ else
-+ area = get_vm_area(size, VM_ALLOC);
- if (!area)
- return NULL;
-
-@@ -437,31 +502,41 @@ void *__vmalloc(unsigned long size, int
- else
- pages = kmalloc(array_size, (gfp_mask & ~__GFP_HIGHMEM));
- area->pages = pages;
-- if (!area->pages) {
-- remove_vm_area(area->addr);
-- kfree(area);
-- return NULL;
-- }
-+ if (!area->pages)
-+ goto fail_area;
- memset(area->pages, 0, array_size);
-
- for (i = 0; i < area->nr_pages; i++) {
- area->pages[i] = alloc_page(gfp_mask);
-- if (unlikely(!area->pages[i])) {
-- /* Successfully allocated i pages, free them in __vunmap() */
-- area->nr_pages = i;
-+ if (unlikely(!area->pages[i]))
- goto fail;
-- }
- }
-
- if (map_vm_area(area, prot, &pages))
- goto fail;
-+
-+ inc_vmalloc_charged(area, gfp_mask);
- return area->addr;
-
- fail:
-- vfree(area->addr);
-+ for (j = 0; j < i; j++)
-+ __free_page(area->pages[j]);
-+ if (array_size > PAGE_SIZE)
-+ vfree(area->pages);
-+ else
-+ kfree(area->pages);
-+fail_area:
-+ remove_vm_area(area->addr);
-+ kfree(area);
-+
- return NULL;
- }
-
-+void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot)
-+{
-+ return ____vmalloc(size, gfp_mask, prot, 0);
-+}
-+
- EXPORT_SYMBOL(__vmalloc);
-
- /**
-@@ -482,6 +557,20 @@ void *vmalloc(unsigned long size)
-
- EXPORT_SYMBOL(vmalloc);
-
-+void *vmalloc_best(unsigned long size)
-+{
-+ return ____vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL, 1);
-+}
-+
-+EXPORT_SYMBOL(vmalloc_best);
-+
-+void *ub_vmalloc_best(unsigned long size)
-+{
-+ return ____vmalloc(size, GFP_KERNEL_UBC | __GFP_HIGHMEM, PAGE_KERNEL, 1);
-+}
-+
-+EXPORT_SYMBOL(ub_vmalloc_best);
-+
- /**
- * vmalloc_exec - allocate virtually contiguous, executable memory
- *
-@@ -593,3 +682,37 @@ finished:
- read_unlock(&vmlist_lock);
- return buf - buf_start;
- }
-+
-+void vprintstat(void)
-+{
-+ struct vm_struct *p, *last_p = NULL;
-+ unsigned long addr, size, free_size, max_free_size;
-+ int num;
-+
-+ addr = VMALLOC_START;
-+ size = max_free_size = 0;
-+ num = 0;
-+
-+ read_lock(&vmlist_lock);
-+ for (p = vmlist; p; p = p->next) {
-+ free_size = (unsigned long)p->addr - addr;
-+ if (free_size > max_free_size)
-+ max_free_size = free_size;
-+ addr = (unsigned long)p->addr + p->size;
-+ size += p->size;
-+ ++num;
-+ last_p = p;
-+ }
-+ if (last_p) {
-+ free_size = VMALLOC_END -
-+ ((unsigned long)last_p->addr + last_p->size);
-+ if (free_size > max_free_size)
-+ max_free_size = free_size;
-+ }
-+ read_unlock(&vmlist_lock);
-+
-+ printk("VMALLOC Used: %luKB Total: %luKB Entries: %d\n"
-+ " Max_Free: %luKB Start: %lx End: %lx\n",
-+ size/1024, (VMALLOC_END - VMALLOC_START)/1024, num,
-+ max_free_size/1024, VMALLOC_START, VMALLOC_END);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/mm/vmscan.c linux-2.6.9-ve023stab030/mm/vmscan.c
---- linux-2.6.9-42.0.3.EL.orig/mm/vmscan.c 2006-10-11 18:29:41.000000000 +0400
-+++ linux-2.6.9-ve023stab030/mm/vmscan.c 2006-10-11 19:07:57.000000000 +0400
-@@ -39,6 +39,8 @@
-
- #include <linux/swapops.h>
-
-+#include <ub/ub_mem.h>
-+
- /* possible outcome of pageout() */
- typedef enum {
- /* failed to write page out, page is locked */
-@@ -78,6 +80,8 @@ struct scan_control {
- unsigned int gfp_mask;
-
- int may_writepage;
-+
-+ struct oom_freeing_stat oom_stat;
- };
-
- /*
-@@ -180,10 +184,11 @@ EXPORT_SYMBOL(remove_shrinker);
- * are eligible for the caller's allocation attempt. It is used for balancing
- * slab reclaim versus page reclaim.
- */
--static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
-+static int shrink_slab(struct scan_control *sc, unsigned int gfp_mask,
- unsigned long lru_pages)
- {
- struct shrinker *shrinker;
-+ unsigned long scanned;
-
- if (scanned == 0)
- scanned = SWAP_CLUSTER_MAX;
-@@ -191,6 +196,7 @@ static int shrink_slab(unsigned long sca
- if (!down_read_trylock(&shrinker_rwsem))
- return 0;
-
-+ scanned = sc->nr_scanned;
- list_for_each_entry(shrinker, &shrinker_list, list) {
- unsigned long long delta;
- unsigned long total_scan;
-@@ -212,6 +218,7 @@ static int shrink_slab(unsigned long sca
- shrink_ret = (*shrinker->shrinker)(this_scan, gfp_mask);
- if (shrink_ret == -1)
- break;
-+ sc->oom_stat.slabs += shrink_ret;
- mod_page_state(slabs_scanned, this_scan);
- total_scan -= this_scan;
-
-@@ -397,6 +404,7 @@ static int shrink_list(struct list_head
- if (PageAnon(page) && !PageSwapCache(page)) {
- if (!add_to_swap(page))
- goto activate_locked;
-+ sc->oom_stat.swapped++;
- }
- #endif /* CONFIG_SWAP */
-
-@@ -437,6 +445,7 @@ static int shrink_list(struct list_head
- case PAGE_ACTIVATE:
- goto activate_locked;
- case PAGE_SUCCESS:
-+ sc->oom_stat.written++;
- if (PageWriteback(page) || PageDirty(page))
- goto keep;
- /*
-@@ -596,6 +605,7 @@ static void shrink_cache(struct zone *zo
- else
- mod_page_state_zone(zone, pgscan_direct, nr_scan);
- nr_freed = shrink_list(&page_list, sc);
-+ sc->oom_stat.freed += nr_freed;
- if (current_is_kswapd())
- mod_page_state(kswapd_steal, nr_freed);
- mod_page_state_zone(zone, pgsteal, nr_freed);
-@@ -660,6 +670,7 @@ refill_inactive_zone(struct zone *zone,
- long distress;
- long swap_tendency;
-
-+ KSTAT_PERF_ENTER(refill_inact)
- lru_add_drain();
- pgmoved = 0;
- spin_lock_irq(&zone->lru_lock);
-@@ -788,6 +799,8 @@ refill_inactive_zone(struct zone *zone,
-
- mod_page_state_zone(zone, pgrefill, pgscanned);
- mod_page_state(pgdeactivate, pgdeactivate);
-+
-+ KSTAT_PERF_LEAVE(refill_inact);
- }
-
- /*
-@@ -918,6 +931,10 @@ int try_to_free_pages(struct zone **zone
- unsigned long lru_pages = 0;
- int i;
-
-+ KSTAT_PERF_ENTER(ttfp);
-+
-+ memset(&sc.oom_stat, 0, sizeof(struct oom_freeing_stat));
-+ sc.oom_stat.oom_generation = oom_generation;
- sc.gfp_mask = gfp_mask;
- sc.may_writepage = 0;
-
-@@ -937,7 +954,7 @@ int try_to_free_pages(struct zone **zone
- sc.nr_congested = 0;
- sc.priority = priority;
- shrink_caches(zones, &sc);
-- shrink_slab(sc.nr_scanned, gfp_mask, lru_pages);
-+ shrink_slab(&sc, gfp_mask, lru_pages);
- if (reclaim_state) {
- sc.nr_reclaimed += reclaim_state->reclaimed_slab;
- reclaim_state->reclaimed_slab = 0;
-@@ -968,10 +985,11 @@ int try_to_free_pages(struct zone **zone
- if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY) &&
- !total_reclaimed && sc.nr_congested < SWAP_CLUSTER_MAX &&
- free_below_min(zones))
-- out_of_memory(gfp_mask);
-+ out_of_memory(&sc.oom_stat, gfp_mask);
- out:
- for (i = 0; zones[i] != 0; i++)
- zones[i]->prev_priority = zones[i]->temp_priority;
-+ KSTAT_PERF_LEAVE(ttfp);
- return ret;
- }
-
-@@ -1093,7 +1111,7 @@ scan:
- sc.priority = priority;
- shrink_zone(zone, &sc);
- reclaim_state->reclaimed_slab = 0;
-- shrink_slab(sc.nr_scanned, GFP_KERNEL, lru_pages);
-+ shrink_slab(&sc, GFP_KERNEL, lru_pages);
- sc.nr_reclaimed += reclaim_state->reclaimed_slab;
- total_reclaimed += sc.nr_reclaimed;
- total_scanned += sc.nr_scanned;
-@@ -1189,8 +1207,8 @@ static int kswapd(void *p)
- tsk->flags |= PF_MEMALLOC|PF_KSWAPD;
-
- for ( ; ; ) {
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
- prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
- schedule();
- finish_wait(&pgdat->kswapd_wait, &wait);
-@@ -1272,7 +1290,7 @@ static int __init kswapd_init(void)
- swap_setup();
- for_each_pgdat(pgdat)
- pgdat->kswapd
-- = find_task_by_pid(kernel_thread(kswapd, pgdat, CLONE_KERNEL));
-+ = find_task_by_pid_all(kernel_thread(kswapd, pgdat, CLONE_KERNEL));
- total_memory = nr_free_pagecache_pages();
- hotcpu_notifier(cpu_callback, 0);
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/bridge/br_stp_if.c linux-2.6.9-ve023stab030/net/bridge/br_stp_if.c
---- linux-2.6.9-42.0.3.EL.orig/net/bridge/br_stp_if.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/bridge/br_stp_if.c 2006-10-11 19:07:55.000000000 +0400
-@@ -64,7 +64,7 @@ void br_stp_disable_bridge(struct net_br
- {
- struct net_bridge_port *p;
-
-- spin_lock(&br->lock);
-+ spin_lock_bh(&br->lock);
- list_for_each_entry(p, &br->port_list, list) {
- if (p->state != BR_STATE_DISABLED)
- br_stp_disable_port(p);
-@@ -73,7 +73,7 @@ void br_stp_disable_bridge(struct net_br
-
- br->topology_change = 0;
- br->topology_change_detected = 0;
-- spin_unlock(&br->lock);
-+ spin_unlock_bh(&br->lock);
-
- del_timer_sync(&br->hello_timer);
- del_timer_sync(&br->topology_change_timer);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/compat.c linux-2.6.9-ve023stab030/net/compat.c
---- linux-2.6.9-42.0.3.EL.orig/net/compat.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/compat.c 2006-10-11 19:08:01.000000000 +0400
-@@ -308,107 +308,6 @@ void scm_detach_fds_compat(struct msghdr
- }
-
- /*
-- * For now, we assume that the compatibility and native version
-- * of struct ipt_entry are the same - sfr. FIXME
-- */
--struct compat_ipt_replace {
-- char name[IPT_TABLE_MAXNAMELEN];
-- u32 valid_hooks;
-- u32 num_entries;
-- u32 size;
-- u32 hook_entry[NF_IP_NUMHOOKS];
-- u32 underflow[NF_IP_NUMHOOKS];
-- u32 num_counters;
-- compat_uptr_t counters; /* struct ipt_counters * */
-- struct ipt_entry entries[0];
--};
--
--static int do_netfilter_replace(int fd, int level, int optname,
-- char __user *optval, int optlen)
--{
-- struct compat_ipt_replace __user *urepl;
-- struct ipt_replace __user *repl_nat;
-- char name[IPT_TABLE_MAXNAMELEN];
-- u32 origsize, tmp32, num_counters;
-- unsigned int repl_nat_size;
-- int ret;
-- int i;
-- compat_uptr_t ucntrs;
--
-- urepl = (struct compat_ipt_replace __user *)optval;
-- if (get_user(origsize, &urepl->size))
-- return -EFAULT;
--
-- /* Hack: Causes ipchains to give correct error msg --RR */
-- if (optlen != sizeof(*urepl) + origsize)
-- return -ENOPROTOOPT;
--
-- /* XXX Assumes that size of ipt_entry is the same both in
-- * native and compat environments.
-- */
-- repl_nat_size = sizeof(*repl_nat) + origsize;
-- repl_nat = compat_alloc_user_space(repl_nat_size);
--
-- ret = -EFAULT;
-- if (put_user(origsize, &repl_nat->size))
-- goto out;
--
-- if (!access_ok(VERIFY_READ, urepl, optlen) ||
-- !access_ok(VERIFY_WRITE, repl_nat, optlen))
-- goto out;
--
-- if (__copy_from_user(name, urepl->name, sizeof(urepl->name)) ||
-- __copy_to_user(repl_nat->name, name, sizeof(repl_nat->name)))
-- goto out;
--
-- if (__get_user(tmp32, &urepl->valid_hooks) ||
-- __put_user(tmp32, &repl_nat->valid_hooks))
-- goto out;
--
-- if (__get_user(tmp32, &urepl->num_entries) ||
-- __put_user(tmp32, &repl_nat->num_entries))
-- goto out;
--
-- if (__get_user(num_counters, &urepl->num_counters) ||
-- __put_user(num_counters, &repl_nat->num_counters))
-- goto out;
--
-- if (__get_user(ucntrs, &urepl->counters) ||
-- __put_user(compat_ptr(ucntrs), &repl_nat->counters))
-- goto out;
--
-- if (__copy_in_user(&repl_nat->entries[0],
-- &urepl->entries[0],
-- origsize))
-- goto out;
--
-- for (i = 0; i < NF_IP_NUMHOOKS; i++) {
-- if (__get_user(tmp32, &urepl->hook_entry[i]) ||
-- __put_user(tmp32, &repl_nat->hook_entry[i]) ||
-- __get_user(tmp32, &urepl->underflow[i]) ||
-- __put_user(tmp32, &repl_nat->underflow[i]))
-- goto out;
-- }
--
-- /*
-- * Since struct ipt_counters just contains two u_int64_t members
-- * we can just do the access_ok check here and pass the (converted)
-- * pointer into the standard syscall. We hope that the pointer is
-- * not misaligned ...
-- */
-- if (!access_ok(VERIFY_WRITE, compat_ptr(ucntrs),
-- num_counters * sizeof(struct ipt_counters)))
-- goto out;
--
--
-- ret = sys_setsockopt(fd, level, optname,
-- (char __user *)repl_nat, repl_nat_size);
--
--out:
-- return ret;
--}
--
--/*
- * A struct sock_filter is architecture independent.
- */
- struct compat_sock_fprog {
-@@ -460,10 +359,6 @@ static int do_set_sock_timeout(int fd, i
- asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
- char __user *optval, int optlen)
- {
-- /* SO_SET_REPLACE seems to be the same in all levels */
-- if (optname == IPT_SO_SET_REPLACE)
-- return do_netfilter_replace(fd, level, optname,
-- optval, optlen);
- if (level == SOL_SOCKET && optname == SO_ATTACH_FILTER)
- return do_set_attach_filter(fd, level, optname,
- optval, optlen);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/datagram.c linux-2.6.9-ve023stab030/net/core/datagram.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/datagram.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/datagram.c 2006-10-11 19:07:56.000000000 +0400
-@@ -54,6 +54,8 @@
- #include <net/sock.h>
- #include <net/checksum.h>
-
-+#include <ub/ub_net.h>
-+
-
- /*
- * Is a socket 'connection oriented' ?
-@@ -454,6 +456,7 @@ unsigned int datagram_poll(struct file *
- {
- struct sock *sk = sock->sk;
- unsigned int mask;
-+ int no_ubc_space;
-
- poll_wait(file, sk->sk_sleep, wait);
- mask = 0;
-@@ -461,8 +464,14 @@ unsigned int datagram_poll(struct file *
- /* exceptional events? */
- if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
- mask |= POLLERR;
-- if (sk->sk_shutdown == SHUTDOWN_MASK)
-+ if (sk->sk_shutdown == SHUTDOWN_MASK) {
-+ no_ubc_space = 0;
- mask |= POLLHUP;
-+ } else {
-+ no_ubc_space = ub_sock_makewres_other(sk, SOCK_MIN_UBCSPACE_CH);
-+ if (no_ubc_space)
-+ ub_sock_sndqueueadd_other(sk, SOCK_MIN_UBCSPACE_CH);
-+ }
-
- /* readable? */
- if (!skb_queue_empty(&sk->sk_receive_queue) ||
-@@ -479,7 +488,7 @@ unsigned int datagram_poll(struct file *
- }
-
- /* writable? */
-- if (sock_writeable(sk))
-+ if (!no_ubc_space && sock_writeable(sk))
- mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
- else
- set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/dev.c linux-2.6.9-ve023stab030/net/core/dev.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/dev.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/dev.c 2006-10-11 19:07:57.000000000 +0400
-@@ -113,6 +113,7 @@
- #include <net/iw_handler.h>
- #endif /* CONFIG_NET_RADIO */
- #include <asm/current.h>
-+#include <ub/beancounter.h>
-
- /* This define, if set, will randomly drop a packet when congestion
- * is more than moderate. It helps fairness in the multi-interface
-@@ -182,25 +183,40 @@ static struct timer_list samp_timer = TI
- * unregister_netdevice(), which must be called with the rtnl
- * semaphore held.
- */
-+#if defined(CONFIG_VE)
-+#define dev_tail (get_exec_env()->_net_dev_tail)
-+#else
- struct net_device *dev_base;
- struct net_device **dev_tail = &dev_base;
--rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
--
- EXPORT_SYMBOL(dev_base);
-+#endif
-+
-+rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
- EXPORT_SYMBOL(dev_base_lock);
-
-+#ifdef CONFIG_VE
-+#define MAX_UNMOVABLE_NETDEVICES (8*4096)
-+static uint8_t unmovable_ifindex_list[MAX_UNMOVABLE_NETDEVICES/8];
-+static LIST_HEAD(dev_global_list);
-+#endif
-+
- #define NETDEV_HASHBITS 8
- static struct hlist_head dev_name_head[1<<NETDEV_HASHBITS];
- static struct hlist_head dev_index_head[1<<NETDEV_HASHBITS];
-
--static inline struct hlist_head *dev_name_hash(const char *name)
-+struct hlist_head *dev_name_hash(const char *name, struct ve_struct *env)
- {
-- unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
-+ unsigned hash;
-+ if (!ve_is_super(env))
-+ return visible_dev_head(env);
-+ hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
- return &dev_name_head[hash & ((1<<NETDEV_HASHBITS)-1)];
- }
-
--static inline struct hlist_head *dev_index_hash(int ifindex)
-+struct hlist_head *dev_index_hash(int ifindex, struct ve_struct *env)
- {
-+ if (!ve_is_super(env))
-+ return visible_dev_index_head(env);
- return &dev_index_head[ifindex & ((1<<NETDEV_HASHBITS)-1)];
- }
-
-@@ -488,7 +504,7 @@ struct net_device *__dev_get_by_name(con
- {
- struct hlist_node *p;
-
-- hlist_for_each(p, dev_name_hash(name)) {
-+ hlist_for_each(p, dev_name_hash(name, get_exec_env())) {
- struct net_device *dev
- = hlist_entry(p, struct net_device, name_hlist);
- if (!strncmp(dev->name, name, IFNAMSIZ))
-@@ -521,6 +537,28 @@ struct net_device *dev_get_by_name(const
- }
-
- /**
-+ * __dev_global_get_by_name - find a device by its name in dev_global_list
-+ * @name: name to find
-+ *
-+ * Find an interface by name. Must be called under RTNL semaphore
-+ * If the name is found a pointer to the device
-+ * is returned. If the name is not found then %NULL is returned. The
-+ * reference counters are not incremented so the caller must be
-+ * careful with locks.
-+ */
-+
-+struct net_device *__dev_global_get_by_name(const char *name)
-+{
-+ struct net_device *dev;
-+ /* It's called relatively rarely */
-+ list_for_each_entry(dev, &dev_global_list, dev_global_list_entry) {
-+ if (strncmp(dev->name, name, IFNAMSIZ) == 0)
-+ return dev;
-+ }
-+ return NULL;
-+}
-+
-+/**
- * __dev_get_by_index - find a device by its ifindex
- * @ifindex: index of device
- *
-@@ -535,7 +573,7 @@ struct net_device *__dev_get_by_index(in
- {
- struct hlist_node *p;
-
-- hlist_for_each(p, dev_index_hash(ifindex)) {
-+ hlist_for_each(p, dev_index_hash(ifindex, get_exec_env())) {
- struct net_device *dev
- = hlist_entry(p, struct net_device, index_hlist);
- if (dev->ifindex == ifindex)
-@@ -664,6 +702,23 @@ int dev_valid_name(const char *name)
- * of the unit assigned or a negative errno code.
- */
-
-+static inline void __dev_check_name(const char *dev_name, const char *name,
-+ long *inuse, const int max_netdevices)
-+{
-+ int i = 0;
-+ char buf[IFNAMSIZ];
-+
-+ if (!sscanf(dev_name, name, &i))
-+ return;
-+ if (i < 0 || i >= max_netdevices)
-+ return;
-+
-+ /* avoid cases where sscanf is not exact inverse of printf */
-+ snprintf(buf, sizeof(buf), name, i);
-+ if (!strncmp(buf, dev_name, IFNAMSIZ))
-+ set_bit(i, inuse);
-+}
-+
- int dev_alloc_name(struct net_device *dev, const char *name)
- {
- int i = 0;
-@@ -688,16 +743,18 @@ int dev_alloc_name(struct net_device *de
- if (!inuse)
- return -ENOMEM;
-
-- for (d = dev_base; d; d = d->next) {
-- if (!sscanf(d->name, name, &i))
-- continue;
-- if (i < 0 || i >= max_netdevices)
-- continue;
--
-- /* avoid cases where sscanf is not exact inverse of printf */
-- snprintf(buf, sizeof(buf), name, i);
-- if (!strncmp(buf, d->name, IFNAMSIZ))
-- set_bit(i, inuse);
-+ if (ve_is_super(get_exec_env())) {
-+ list_for_each_entry(d, &dev_global_list,
-+ dev_global_list_entry) {
-+ __dev_check_name(d->name, name, inuse,
-+ max_netdevices);
-+ }
-+ }
-+ else {
-+ for (d = dev_base; d; d = d->next) {
-+ __dev_check_name(d->name, name, inuse,
-+ max_netdevices);
-+ }
- }
-
- i = find_first_zero_bit(inuse, max_netdevices);
-@@ -705,7 +762,11 @@ int dev_alloc_name(struct net_device *de
- }
-
- snprintf(buf, sizeof(buf), name, i);
-- if (!__dev_get_by_name(buf)) {
-+ if (ve_is_super(get_exec_env()))
-+ d = __dev_global_get_by_name(buf);
-+ else
-+ d = __dev_get_by_name(buf);
-+ if (d == NULL) {
- strlcpy(dev->name, buf, IFNAMSIZ);
- return i;
- }
-@@ -738,13 +799,15 @@ int dev_change_name(struct net_device *d
- if (!dev_valid_name(newname))
- return -EINVAL;
-
-+ /* Rename of devices in VE is prohibited by CAP_NET_ADMIN */
-+
- if (strchr(newname, '%')) {
- err = dev_alloc_name(dev, newname);
- if (err < 0)
- return err;
- strcpy(newname, dev->name);
- }
-- else if (__dev_get_by_name(newname))
-+ else if (__dev_global_get_by_name(newname))
- return -EEXIST;
- else
- strlcpy(dev->name, newname, IFNAMSIZ);
-@@ -752,7 +815,8 @@ int dev_change_name(struct net_device *d
- err = class_device_rename(&dev->class_dev, dev->name);
- if (!err) {
- hlist_del(&dev->name_hlist);
-- hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
-+ hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name,
-+ get_exec_env()));
- notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
- }
-
-@@ -1252,6 +1316,34 @@ int dev_queue_xmit(struct sk_buff *skb)
- skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
- #endif
- if (q->enqueue) {
-+#if 0
-+ /*
-+ * XXX this code is broken:
-+ * 1) it is activated for normal devices in VE0,
-+ * 2) it doesn't use API functions like ub_skb_set_charge,
-+ * 3) it isn't allowed to charge skb as UB_OTHERSOCKBUF
-+ * if its socket is TCP.
-+ */
-+ struct user_beancounter *ub;
-+
-+ ub = netdev_bc(dev)->exec_ub;
-+ /* the skb CAN be already charged if it transmitted via
-+ * something like bonding device */
-+ if (ub && (skb_bc(skb)->resource == 0)) {
-+ unsigned long chargesize;
-+ chargesize = skb_charge_fullsize(skb);
-+ if (charge_beancounter(ub, UB_OTHERSOCKBUF,
-+ chargesize, UB_SOFT)) {
-+ rcu_read_unlock();
-+ rc = -ENOMEM;
-+ goto out_kfree_skb;
-+ }
-+ skb_bc(skb)->ub = ub;
-+ skb_bc(skb)->charged = chargesize;
-+ skb_bc(skb)->resource = UB_OTHERSOCKBUF;
-+ }
-+#endif
-+
- /* Grab device queue */
- spin_lock(&dev->queue_lock);
-
-@@ -1297,7 +1389,6 @@ int dev_queue_xmit(struct sk_buff *skb)
- if (net_ratelimit())
- printk(KERN_CRIT "Virtual device %s asks to "
- "queue packet!\n", dev->name);
-- goto out_enetdown;
- } else {
- /* Recursion is detected! It is possible,
- * unfortunately */
-@@ -1306,10 +1397,13 @@ int dev_queue_xmit(struct sk_buff *skb)
- "%s, fix it urgently!\n", dev->name);
- }
- }
--out_enetdown:
-+
- rc = -ENETDOWN;
-+ local_bh_enable();
-+
- out_kfree_skb:
- kfree_skb(skb);
-+ return rc;
- out:
- local_bh_enable();
- return rc;
-@@ -1616,6 +1710,7 @@ int netif_receive_skb(struct sk_buff *sk
- struct net_device *orig_dev;
- int ret = NET_RX_DROP;
- unsigned short type;
-+ struct ve_struct *old_env;
-
- #ifdef CONFIG_NETPOLL
- if (skb->dev->poll && netpoll_rx(skb))
-@@ -1638,6 +1733,15 @@ int netif_receive_skb(struct sk_buff *sk
- skb->h.raw = skb->nh.raw = skb->data;
- skb->mac_len = skb->nh.raw - skb->mac.raw;
-
-+ /*
-+ * Skb might be alloced in another VE context, than its device works.
-+ * So, set the correct owner_env.
-+ */
-+ skb->owner_env = skb->dev->owner_env;
-+ BUG_ON(skb->owner_env == NULL);
-+
-+ old_env = set_exec_env(VE_OWNER_SKB(skb));
-+
- pt_prev = NULL;
-
- rcu_read_lock();
-@@ -1703,6 +1807,7 @@ ncls:
-
- out:
- rcu_read_unlock();
-+ (void)set_exec_env(old_env);
- return ret;
- }
-
-@@ -2088,7 +2193,8 @@ static int __init dev_proc_init(void)
-
- if (!proc_net_fops_create("dev", S_IRUGO, &dev_seq_fops))
- goto out;
-- if (!proc_net_fops_create("softnet_stat", S_IRUGO, &softnet_seq_fops))
-+ if (!__proc_net_fops_create("net/softnet_stat", S_IRUGO,
-+ &softnet_seq_fops, NULL))
- goto out_dev;
- if (wireless_proc_init())
- goto out_softnet;
-@@ -2096,7 +2202,7 @@ static int __init dev_proc_init(void)
- out:
- return rc;
- out_softnet:
-- proc_net_remove("softnet_stat");
-+ __proc_net_remove("net/softnet_stat");
- out_dev:
- proc_net_remove("dev");
- goto out;
-@@ -2162,9 +2268,12 @@ void dev_set_promiscuity(struct net_devi
- dev->flags |= IFF_PROMISC;
- if ((dev->promiscuity += inc) == 0)
- dev->flags &= ~IFF_PROMISC;
-+ /* Promiscous mode on these devices does not mean anything */
-+ if (dev->flags & (IFF_LOOPBACK|IFF_POINTOPOINT))
-+ return;
- if (dev->flags ^ old_flags) {
- dev_mc_upload(dev);
-- printk(KERN_INFO "device %s %s promiscuous mode\n",
-+ ve_printk(VE_LOG, KERN_INFO "device %s %s promiscuous mode\n",
- dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
- "left");
- }
-@@ -2570,9 +2679,18 @@ int dev_ioctl(unsigned int cmd, void __u
- * - require strict serialization.
- * - do not return a value
- */
-+ case SIOCSIFMTU:
-+ if (!capable(CAP_NET_ADMIN) &&
-+ !capable(CAP_VE_NET_ADMIN))
-+ return -EPERM;
-+ dev_load(ifr.ifr_name);
-+ rtnl_lock();
-+ ret = dev_ifsioc(&ifr, cmd);
-+ rtnl_unlock();
-+ return ret;
-+
- case SIOCSIFFLAGS:
- case SIOCSIFMETRIC:
-- case SIOCSIFMTU:
- case SIOCSIFMAP:
- case SIOCSIFHWADDR:
- case SIOCSIFSLAVE:
-@@ -2649,25 +2767,75 @@ int dev_ioctl(unsigned int cmd, void __u
- }
- }
-
--
- /**
- * dev_new_index - allocate an ifindex
- *
- * Returns a suitable unique value for a new device interface
-- * number. The caller must hold the rtnl semaphore or the
-+ * number. The caller must hold the rtnl semaphore or the
- * dev_base_lock to be sure it remains unique.
-+ *
-+ * Note: dev->name must be valid on entrance
- */
--static int dev_new_index(void)
-+static int dev_ve_new_index(void)
- {
-- static int ifindex;
-+#ifdef CONFIG_VE
-+ int *ifindex = &get_exec_env()->ifindex;
-+ int delta = 2;
-+#else
-+ static int s_ifindex;
-+ int *ifindex = &s_ifindex;
-+ int delta = 1;
-+#endif
- for (;;) {
-- if (++ifindex <= 0)
-- ifindex = 1;
-- if (!__dev_get_by_index(ifindex))
-- return ifindex;
-+ *ifindex += delta;
-+ if (*ifindex <= 0)
-+ *ifindex = 1;
-+ if (!__dev_get_by_index(*ifindex))
-+ return *ifindex;
- }
- }
-
-+static int dev_glb_new_index(void)
-+{
-+#ifdef CONFIG_VE
-+ int i;
-+
-+ i = find_first_zero_bit((long*)unmovable_ifindex_list,
-+ MAX_UNMOVABLE_NETDEVICES);
-+
-+ if (i == MAX_UNMOVABLE_NETDEVICES)
-+ return -EMFILE;
-+
-+ __set_bit(i, (long*)unmovable_ifindex_list);
-+ return (i + 1) * 2;
-+#endif
-+}
-+
-+static void dev_glb_free_index(struct net_device *dev)
-+{
-+#ifdef CONFIG_VE
-+ int bit;
-+
-+ bit = dev->ifindex / 2 - 1;
-+ BUG_ON(bit >= MAX_UNMOVABLE_NETDEVICES);
-+ __clear_bit(bit, (long*)unmovable_ifindex_list);
-+#endif
-+}
-+
-+int dev_new_index(struct net_device *dev)
-+{
-+ if (ve_is_super(get_exec_env()) && ve_is_dev_movable(dev))
-+ return dev_glb_new_index();
-+
-+ return dev_ve_new_index();
-+}
-+
-+void dev_free_index(struct net_device *dev)
-+{
-+ if ((dev->ifindex % 2) == 0)
-+ dev_glb_free_index(dev);
-+}
-+
- static int dev_boot_phase = 1;
-
- /* Delayed registration/unregisteration */
-@@ -2681,6 +2849,12 @@ static inline void net_set_todo(struct n
- spin_unlock(&net_todo_list_lock);
- }
-
-+void netdevice_notify(int event, struct net_device *dev)
-+{
-+ notifier_call_chain(&netdev_chain, event, dev);
-+}
-+EXPORT_SYMBOL(netdevice_notify);
-+
- /**
- * register_netdevice - register a network device
- * @dev: device to register
-@@ -2711,6 +2885,10 @@ int register_netdevice(struct net_device
- /* When net_device's are persistent, this will be fatal. */
- BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
-
-+ ret = -EPERM;
-+ if (!ve_is_super(get_exec_env()) && ve_is_dev_movable(dev))
-+ goto out;
-+
- spin_lock_init(&dev->queue_lock);
- spin_lock_init(&dev->xmit_lock);
- dev->xmit_lock_owner = -1;
-@@ -2730,27 +2908,32 @@ int register_netdevice(struct net_device
- if (ret) {
- if (ret > 0)
- ret = -EIO;
-- goto out_err;
-+ goto out_free_div;
- }
- }
-
- if (!dev_valid_name(dev->name)) {
- ret = -EINVAL;
-- goto out_err;
-+ goto out_free_div;
-+ }
-+
-+ dev->ifindex = dev_new_index(dev);
-+ if (dev->ifindex < 0) {
-+ ret = dev->ifindex;
-+ goto out_free_div;
- }
-
-- dev->ifindex = dev_new_index();
- if (dev->iflink == -1)
- dev->iflink = dev->ifindex;
-
- /* Check for existence of name */
-- head = dev_name_hash(dev->name);
-+ head = dev_name_hash(dev->name, get_exec_env());
- hlist_for_each(p, head) {
- struct net_device *d
- = hlist_entry(p, struct net_device, name_hlist);
- if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
- ret = -EEXIST;
-- goto out_err;
-+ goto out_free_ind;
- }
- }
-
-@@ -2780,12 +2963,18 @@ int register_netdevice(struct net_device
- set_bit(__LINK_STATE_PRESENT, &dev->state);
-
- dev->next = NULL;
-+ dev->owner_env = get_exec_env();
-+ netdev_bc(dev)->owner_ub = get_beancounter(get_exec_ub());
-+ netdev_bc(dev)->exec_ub = get_beancounter(get_exec_ub());
- dev_init_scheduler(dev);
-+ if (ve_is_super(get_exec_env()))
-+ list_add_tail(&dev->dev_global_list_entry, &dev_global_list);
- write_lock_bh(&dev_base_lock);
- *dev_tail = dev;
- dev_tail = &dev->next;
- hlist_add_head(&dev->name_hlist, head);
-- hlist_add_head(&dev->index_hlist, dev_index_hash(dev->ifindex));
-+ hlist_add_head(&dev->index_hlist, dev_index_hash(dev->ifindex,
-+ get_exec_env()));
- dev_hold(dev);
- dev->reg_state = NETREG_REGISTERING;
- write_unlock_bh(&dev_base_lock);
-@@ -2799,7 +2988,9 @@ int register_netdevice(struct net_device
-
- out:
- return ret;
--out_err:
-+out_free_ind:
-+ dev_free_index(dev);
-+out_free_div:
- free_divert_blk(dev);
- goto out;
- }
-@@ -2839,7 +3030,7 @@ static void netdev_wait_allrefs(struct n
- linkwatch_run_queue();
- }
-
-- rtnl_shunlock();
-+ __rtnl_shunlock();
-
- rebroadcast_time = jiffies;
- }
-@@ -2883,6 +3074,7 @@ void netdev_run_todo(void)
- {
- struct list_head list = LIST_HEAD_INIT(list);
- int err;
-+ struct ve_struct *current_env;
-
-
- /* Need to guard against multiple cpu's getting out of order. */
-@@ -2901,22 +3093,30 @@ void netdev_run_todo(void)
- list_splice_init(&net_todo_list, &list);
- spin_unlock(&net_todo_list_lock);
-
-+ current_env = get_exec_env();
- while (!list_empty(&list)) {
- struct net_device *dev
- = list_entry(list.next, struct net_device, todo_list);
- list_del(&dev->todo_list);
-
-+ (void)set_exec_env(dev->owner_env);
- switch(dev->reg_state) {
- case NETREG_REGISTERING:
- err = netdev_register_sysfs(dev);
-- if (err)
-+ if (err) {
- printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
- dev->name, err);
-+ dev->reg_state = NETREG_REGISTER_ERR;
-+ break;
-+ }
- dev->reg_state = NETREG_REGISTERED;
- break;
-
- case NETREG_UNREGISTERING:
- netdev_unregister_sysfs(dev);
-+ /* fall through */
-+
-+ case NETREG_REGISTER_ERR:
- dev->reg_state = NETREG_UNREGISTERED;
-
- netdev_wait_allrefs(dev);
-@@ -2927,6 +3127,10 @@ void netdev_run_todo(void)
- BUG_TRAP(!dev->ip6_ptr);
- BUG_TRAP(!dev->dn_ptr);
-
-+ put_beancounter(netdev_bc(dev)->exec_ub);
-+ put_beancounter(netdev_bc(dev)->owner_ub);
-+ netdev_bc(dev)->exec_ub = NULL;
-+ netdev_bc(dev)->owner_ub = NULL;
-
- /* It must be the very last action,
- * after this 'dev' may point to freed up memory.
-@@ -2941,6 +3145,7 @@ void netdev_run_todo(void)
- break;
- }
- }
-+ (void)set_exec_env(current_env);
-
- out:
- up(&net_todo_run_mutex);
-@@ -3007,7 +3212,8 @@ int unregister_netdevice(struct net_devi
- return -ENODEV;
- }
-
-- BUG_ON(dev->reg_state != NETREG_REGISTERED);
-+ BUG_ON(dev->reg_state != NETREG_REGISTERED &&
-+ dev->reg_state != NETREG_REGISTER_ERR);
-
- /* If device is running, close it first. */
- if (dev->flags & IFF_UP)
-@@ -3023,6 +3229,8 @@ int unregister_netdevice(struct net_devi
- dev_tail = dp;
- *dp = d->next;
- write_unlock_bh(&dev_base_lock);
-+ if (ve_is_super(get_exec_env()))
-+ list_del(&dev->dev_global_list_entry);
- break;
- }
- }
-@@ -3032,7 +3240,8 @@ int unregister_netdevice(struct net_devi
- return -ENODEV;
- }
-
-- dev->reg_state = NETREG_UNREGISTERING;
-+ if (dev->reg_state != NETREG_REGISTER_ERR)
-+ dev->reg_state = NETREG_UNREGISTERING;
-
- synchronize_net();
-
-@@ -3056,6 +3265,8 @@ int unregister_netdevice(struct net_devi
- /* Notifier chain MUST detach us from master device. */
- BUG_TRAP(!dev->master);
-
-+ dev_free_index(dev);
-+
- free_divert_blk(dev);
-
- /* Finish processing unregister after unlock */
-@@ -3201,6 +3412,9 @@ EXPORT_SYMBOL(dev_get_by_flags);
- EXPORT_SYMBOL(dev_get_by_index);
- EXPORT_SYMBOL(dev_get_by_name);
- EXPORT_SYMBOL(dev_ioctl);
-+EXPORT_SYMBOL(dev_new_index);
-+EXPORT_SYMBOL(dev_name_hash);
-+EXPORT_SYMBOL(dev_index_hash);
- EXPORT_SYMBOL(dev_open);
- EXPORT_SYMBOL(dev_queue_xmit);
- EXPORT_SYMBOL(dev_remove_pack);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/dev_mcast.c linux-2.6.9-ve023stab030/net/core/dev_mcast.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/dev_mcast.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/dev_mcast.c 2006-10-11 19:07:57.000000000 +0400
-@@ -297,3 +297,4 @@ void __init dev_mcast_init(void)
- EXPORT_SYMBOL(dev_mc_add);
- EXPORT_SYMBOL(dev_mc_delete);
- EXPORT_SYMBOL(dev_mc_upload);
-+EXPORT_SYMBOL(dev_mc_discard);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/dst.c linux-2.6.9-ve023stab030/net/core/dst.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/dst.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/dst.c 2006-10-11 19:07:57.000000000 +0400
-@@ -45,6 +45,7 @@ static struct timer_list dst_gc_timer =
- static void dst_run_gc(unsigned long dummy)
- {
- int delayed = 0;
-+ int work_performed;
- struct dst_entry * dst, **dstp;
-
- if (!spin_trylock(&dst_lock)) {
-@@ -52,9 +53,9 @@ static void dst_run_gc(unsigned long dum
- return;
- }
-
--
- del_timer(&dst_gc_timer);
- dstp = &dst_garbage_list;
-+ work_performed = 0;
- while ((dst = *dstp) != NULL) {
- if (atomic_read(&dst->__refcnt)) {
- dstp = &dst->next;
-@@ -62,6 +63,7 @@ static void dst_run_gc(unsigned long dum
- continue;
- }
- *dstp = dst->next;
-+ work_performed = 1;
-
- dst = dst_destroy(dst);
- if (dst) {
-@@ -86,15 +88,19 @@ static void dst_run_gc(unsigned long dum
- dst_gc_timer_inc = DST_GC_MAX;
- goto out;
- }
-- if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX)
-- dst_gc_timer_expires = DST_GC_MAX;
-- dst_gc_timer_inc += DST_GC_INC;
-- dst_gc_timer.expires = jiffies + dst_gc_timer_expires;
-+ if (!work_performed) {
-+ if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX)
-+ dst_gc_timer_expires = DST_GC_MAX;
-+ dst_gc_timer_inc += DST_GC_INC;
-+ } else {
-+ dst_gc_timer_inc = DST_GC_INC;
-+ dst_gc_timer_expires = DST_GC_MIN;
-+ }
- #if RT_CACHE_DEBUG >= 2
- printk("dst_total: %d/%d %ld\n",
- atomic_read(&dst_total), delayed, dst_gc_timer_expires);
- #endif
-- add_timer(&dst_gc_timer);
-+ mod_timer(&dst_gc_timer, jiffies + dst_gc_timer_expires);
-
- out:
- spin_unlock(&dst_lock);
-@@ -229,13 +235,13 @@ static void dst_ifdown(struct dst_entry
-
- do {
- if (unregister) {
-- dst->dev = &loopback_dev;
-- dev_hold(&loopback_dev);
-+ dst->dev = &visible_loopback_dev;
-+ dev_hold(&visible_loopback_dev);
- dev_put(dev);
- if (dst->neighbour && dst->neighbour->dev == dev) {
-- dst->neighbour->dev = &loopback_dev;
-+ dst->neighbour->dev = &visible_loopback_dev;
- dev_put(dev);
-- dev_hold(&loopback_dev);
-+ dev_hold(&visible_loopback_dev);
- }
- }
-
-@@ -253,12 +259,15 @@ static int dst_dev_event(struct notifier
- switch (event) {
- case NETDEV_UNREGISTER:
- case NETDEV_DOWN:
-- spin_lock_bh(&dst_lock);
-+ local_bh_disable();
-+ dst_run_gc(0);
-+ spin_lock(&dst_lock);
- for (dst = dst_garbage_list; dst; dst = dst->next) {
- if (dst->dev == dev)
- dst_ifdown(dst, event != NETDEV_DOWN);
- }
-- spin_unlock_bh(&dst_lock);
-+ spin_unlock(&dst_lock);
-+ local_bh_enable();
- break;
- }
- return NOTIFY_DONE;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/dv.c linux-2.6.9-ve023stab030/net/core/dv.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/dv.c 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/dv.c 2006-10-11 19:07:57.000000000 +0400
-@@ -93,6 +93,8 @@ void free_divert_blk(struct net_device *
- }
- }
-
-+EXPORT_SYMBOL(free_divert_blk);
-+
- /*
- * Adds a tcp/udp (source or dest) port to an array
- */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/filter.c linux-2.6.9-ve023stab030/net/core/filter.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/filter.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/filter.c 2006-10-11 19:07:56.000000000 +0400
-@@ -418,7 +418,7 @@ int sk_attach_filter(struct sock_fprog *
- if (fprog->filter == NULL || fprog->len > BPF_MAXINSNS)
- return -EINVAL;
-
-- fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL);
-+ fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL_UBC);
- if (!fp)
- return -ENOMEM;
- if (copy_from_user(fp->insns, fprog->filter, fsize)) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/neighbour.c linux-2.6.9-ve023stab030/net/core/neighbour.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/neighbour.c 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/neighbour.c 2006-10-11 19:07:57.000000000 +0400
-@@ -32,6 +32,7 @@
- #include <net/sock.h>
- #include <linux/rtnetlink.h>
- #include <linux/random.h>
-+#include <ub/beancounter.h>
-
- #define NEIGH_DEBUG 1
-
-@@ -257,6 +258,7 @@ static struct neighbour *neigh_alloc(str
- int entries;
-
- entries = atomic_inc_return(&tbl->entries) - 1;
-+ n = ERR_PTR(-ENOBUFS);
- if (entries >= tbl->gc_thresh3 ||
- (entries >= tbl->gc_thresh2 &&
- time_after(now, tbl->last_flush + 5 * HZ))) {
-@@ -267,7 +269,7 @@ static struct neighbour *neigh_alloc(str
-
- n = kmem_cache_alloc(tbl->kmem_cachep, SLAB_ATOMIC);
- if (!n)
-- goto out_entries;
-+ goto out_nomem;
-
- memset(n, 0, tbl->entry_size);
-
-@@ -289,6 +291,8 @@ static struct neighbour *neigh_alloc(str
- out:
- return n;
-
-+out_nomem:
-+ n = ERR_PTR(-ENOMEM);
- out_entries:
- atomic_dec(&tbl->entries);
- goto out;
-@@ -404,12 +408,11 @@ struct neighbour *neigh_create(struct ne
- u32 hash_val;
- int key_len = tbl->key_len;
- int error;
-- struct neighbour *n1, *rc, *n = neigh_alloc(tbl);
-+ struct neighbour *n1, *rc, *n;
-
-- if (!n) {
-- rc = ERR_PTR(-ENOBUFS);
-+ rc = n = neigh_alloc(tbl);
-+ if (IS_ERR(n))
- goto out;
-- }
-
- memcpy(n->primary_key, pkey, key_len);
- n->dev = dev;
-@@ -656,6 +659,8 @@ static void neigh_periodic_timer(unsigne
- struct neigh_table *tbl = (struct neigh_table *)arg;
- struct neighbour *n, **np;
- unsigned long expire, now = jiffies;
-+ struct ve_struct *env = set_exec_env(tbl->owner_env);
-+ struct user_beancounter *ub = set_exec_ub(tbl->owner_ub);
-
- NEIGH_CACHE_STAT_INC(tbl, periodic_gc_runs);
-
-@@ -717,6 +722,8 @@ next_elt:
- mod_timer(&tbl->gc_timer, now + expire);
-
- write_unlock(&tbl->lock);
-+ set_exec_ub(ub);
-+ set_exec_env(env);
- }
-
- static __inline__ int neigh_max_probes(struct neighbour *n)
-@@ -736,6 +743,11 @@ static void neigh_timer_handler(unsigned
- struct neighbour *neigh = (struct neighbour *)arg;
- unsigned state;
- int notify = 0;
-+ struct ve_struct *env;
-+ struct user_beancounter *ub;
-+
-+ env = set_exec_env(neigh->dev->owner_env);
-+ ub = set_exec_ub(netdev_bc(neigh->dev)->exec_ub);
-
- write_lock(&neigh->lock);
-
-@@ -808,11 +820,10 @@ static void neigh_timer_handler(unsigned
- }
-
- if (neigh->nud_state & NUD_IN_TIMER) {
-- neigh_hold(neigh);
- if (time_before(next, jiffies + HZ/2))
- next = jiffies + HZ/2;
-- neigh->timer.expires = next;
-- add_timer(&neigh->timer);
-+ if (!mod_timer(&neigh->timer, next))
-+ neigh_hold(neigh);
- }
- if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) {
- struct sk_buff *skb = skb_peek(&neigh->arp_queue);
-@@ -834,6 +845,8 @@ out:
- neigh_app_notify(neigh);
- #endif
- neigh_release(neigh);
-+ (void)set_exec_ub(ub);
-+ set_exec_env(env);
- }
-
- int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
-@@ -1213,6 +1226,9 @@ static void neigh_proxy_process(unsigned
- unsigned long now = jiffies;
- struct sk_buff *skb;
-
-+ struct ve_struct *env = set_exec_env(tbl->owner_env);
-+ struct user_beancounter *ub = set_exec_ub(tbl->owner_ub);
-+
- spin_lock(&tbl->proxy_queue.lock);
-
- skb = tbl->proxy_queue.next;
-@@ -1224,6 +1240,7 @@ static void neigh_proxy_process(unsigned
- skb = skb->next;
- if (tdif <= 0) {
- struct net_device *dev = back->dev;
-+
- __skb_unlink(back, &tbl->proxy_queue);
- if (tbl->proxy_redo && netif_running(dev))
- tbl->proxy_redo(back);
-@@ -1238,6 +1255,8 @@ static void neigh_proxy_process(unsigned
- if (sched_next)
- mod_timer(&tbl->proxy_timer, jiffies + sched_next);
- spin_unlock(&tbl->proxy_queue.lock);
-+ (void)set_exec_ub(ub);
-+ (void)set_exec_env(env);
- }
-
- void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
-@@ -1326,12 +1345,15 @@ void neigh_parms_destroy(struct neigh_pa
- }
-
-
--void neigh_table_init(struct neigh_table *tbl)
-+int neigh_table_init(struct neigh_table *tbl)
- {
- unsigned long now = jiffies;
- unsigned long phsize;
-
- atomic_set(&tbl->parms.refcnt, 1);
-+ atomic_set(&tbl->entries, 0);
-+ tbl->hash_chain_gc = 0;
-+ tbl->parms.next = NULL;
- INIT_RCU_HEAD(&tbl->parms.rcu_head);
- tbl->parms.reachable_time =
- neigh_rand_reach_time(tbl->parms.base_reachable_time);
-@@ -1339,22 +1361,30 @@ void neigh_table_init(struct neigh_table
- if (!tbl->kmem_cachep)
- tbl->kmem_cachep = kmem_cache_create(tbl->id,
- tbl->entry_size,
-- 0, SLAB_HWCACHE_ALIGN,
-+ 0, SLAB_HWCACHE_ALIGN | SLAB_UBC,
- NULL, NULL);
-
- if (!tbl->kmem_cachep)
-- panic("cannot create neighbour cache");
-+ return -ENOMEM;
-+
-+ tbl->owner_env = get_ve(get_exec_env());
-+ tbl->owner_ub = get_beancounter(get_exec_ub());
-
- tbl->stats = alloc_percpu(struct neigh_statistics);
- if (!tbl->stats)
-- panic("cannot create neighbour cache statistics");
-+ return -ENOMEM;
-
- #ifdef CONFIG_PROC_FS
-- tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat);
-- if (!tbl->pde)
-- panic("cannot create neighbour proc dir entry");
-- tbl->pde->proc_fops = &neigh_stat_seq_fops;
-- tbl->pde->data = tbl;
-+ if (ve_is_super(get_exec_env())) {
-+ char name[strlen(tbl->id) + sizeof("net/stat/")];
-+ strcpy(name, "net/stat/");
-+ strcat(name, tbl->id);
-+ tbl->pde = create_proc_glob_entry(name, S_IRUGO, NULL);
-+ if (tbl->pde) {
-+ tbl->pde->proc_fops = &neigh_stat_seq_fops;
-+ tbl->pde->data = tbl;
-+ }
-+ }
- #endif
-
- tbl->hash_mask = 1;
-@@ -1364,7 +1394,7 @@ void neigh_table_init(struct neigh_table
- tbl->phash_buckets = kmalloc(phsize, GFP_KERNEL);
-
- if (!tbl->hash_buckets || !tbl->phash_buckets)
-- panic("cannot allocate neighbour cache hashes");
-+ goto nomem;
-
- memset(tbl->phash_buckets, 0, phsize);
-
-@@ -1388,6 +1418,24 @@ void neigh_table_init(struct neigh_table
- tbl->next = neigh_tables;
- neigh_tables = tbl;
- write_unlock(&neigh_tbl_lock);
-+ return 0;
-+
-+nomem:
-+ if (tbl->hash_buckets) {
-+ neigh_hash_free(tbl->hash_buckets, tbl->hash_mask + 1);
-+ tbl->hash_buckets = NULL;
-+ }
-+ if (tbl->phash_buckets) {
-+ kfree(tbl->phash_buckets);
-+ tbl->phash_buckets = NULL;
-+ }
-+ if (tbl->stats) {
-+ free_percpu(tbl->stats);
-+ tbl->stats = NULL;
-+ }
-+ put_beancounter(tbl->owner_ub);
-+ put_ve(tbl->owner_env);
-+ return -ENOMEM;
- }
-
- int neigh_table_clear(struct neigh_table *tbl)
-@@ -1401,6 +1449,15 @@ int neigh_table_clear(struct neigh_table
- neigh_ifdown(tbl, NULL);
- if (atomic_read(&tbl->entries))
- printk(KERN_CRIT "neighbour leakage\n");
-+#ifdef CONFIG_PROC_FS
-+ if (ve_is_super(get_exec_env())) {
-+ char name[strlen(tbl->id) + sizeof("net/stat/")];
-+ strcpy(name, "net/stat/");
-+ strcat(name, tbl->id);
-+ remove_proc_glob_entry(name, NULL);
-+ }
-+#endif
-+
- write_lock(&neigh_tbl_lock);
- for (tp = &neigh_tables; *tp; tp = &(*tp)->next) {
- if (*tp == tbl) {
-@@ -1416,6 +1473,12 @@ int neigh_table_clear(struct neigh_table
- kfree(tbl->phash_buckets);
- tbl->phash_buckets = NULL;
-
-+ free_percpu(tbl->stats);
-+ tbl->stats = NULL;
-+
-+ put_beancounter(tbl->owner_ub);
-+ put_ve(tbl->owner_env);
-+
- return 0;
- }
-
-@@ -1437,6 +1500,8 @@ int neigh_delete(struct sk_buff *skb, st
-
- if (tbl->family != ndm->ndm_family)
- continue;
-+ if (!ve_accessible_strict(tbl->owner_env, get_exec_env()))
-+ continue;
- read_unlock(&neigh_tbl_lock);
-
- err = -EINVAL;
-@@ -1490,6 +1555,8 @@ int neigh_add(struct sk_buff *skb, struc
-
- if (tbl->family != ndm->ndm_family)
- continue;
-+ if (!ve_accessible_strict(tbl->owner_env, get_exec_env()))
-+ continue;
- read_unlock(&neigh_tbl_lock);
-
- err = -EINVAL;
-@@ -1631,6 +1698,8 @@ int neigh_dump_info(struct sk_buff *skb,
- s_t = cb->args[0];
-
- for (tbl = neigh_tables, t = 0; tbl; tbl = tbl->next, t++) {
-+ if (!ve_accessible_strict(tbl->owner_env, get_exec_env()))
-+ continue;
- if (t < s_t || (family && tbl->family != family))
- continue;
- if (t > s_t)
-@@ -2204,11 +2273,12 @@ int neigh_sysctl_register(struct net_dev
- int p_id, int pdev_id, char *p_name,
- proc_handler *handler)
- {
-- struct neigh_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL);
-+ struct neigh_sysctl_table *t;
- const char *dev_name_source = NULL;
- char *dev_name = NULL;
- int err = 0;
-
-+ t = kmalloc(sizeof(*t), GFP_KERNEL);
- if (!t)
- return -ENOBUFS;
- memcpy(t, &neigh_sysctl_template, sizeof(*t));
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/net-sysfs.c linux-2.6.9-ve023stab030/net/core/net-sysfs.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/net-sysfs.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/net-sysfs.c 2006-10-11 19:07:57.000000000 +0400
-@@ -370,18 +370,26 @@ static void netdev_release(struct class_
- struct net_device *dev
- = container_of(cd, struct net_device, class_dev);
-
-- BUG_ON(dev->reg_state != NETREG_RELEASED);
-+ BUG_ON(dev->reg_state != NETREG_RELEASED &&
-+ dev->reg_state != NETREG_REGISTERING);
-
- kfree((char *)dev - dev->padded);
- }
-
--static struct class net_class = {
-+struct class net_class = {
- .name = "net",
- .release = netdev_release,
- #ifdef CONFIG_HOTPLUG
- .hotplug = netdev_hotplug,
- #endif
- };
-+EXPORT_SYMBOL(net_class);
-+
-+#ifndef CONFIG_VE
-+#define visible_net_class net_class
-+#else
-+#define visible_net_class (*get_exec_env()->net_class)
-+#endif
-
- void netdev_unregister_sysfs(struct net_device * net)
- {
-@@ -406,7 +414,7 @@ int netdev_register_sysfs(struct net_dev
- struct class_device_attribute *attr;
- int ret;
-
-- class_dev->class = &net_class;
-+ class_dev->class = &visible_net_class;
- class_dev->class_data = net;
-
- strlcpy(class_dev->class_id, net->name, BUS_ID_SIZE);
-@@ -439,12 +447,21 @@ out_cleanup:
- out_unreg:
- printk(KERN_WARNING "%s: sysfs attribute registration failed %d\n",
- net->name, ret);
-- class_device_unregister(class_dev);
-+ /* put is called in free_netdev() */
-+ class_device_del(class_dev);
- out:
- return ret;
- }
-
-+void prepare_sysfs_netdev(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->net_class = &net_class;
-+#endif
-+}
-+
- int netdev_sysfs_init(void)
- {
-+ prepare_sysfs_netdev();
- return class_register(&net_class);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/netfilter.c linux-2.6.9-ve023stab030/net/core/netfilter.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/netfilter.c 2004-10-19 01:54:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/netfilter.c 2006-10-11 19:07:57.000000000 +0400
-@@ -49,6 +49,13 @@ struct list_head nf_hooks[NPROTO][NF_MAX
- static LIST_HEAD(nf_sockopts);
- static spinlock_t nf_hook_lock = SPIN_LOCK_UNLOCKED;
-
-+#ifdef CONFIG_VE_IPTABLES
-+#define ve_nf_hooks \
-+ ((struct list_head (*)[NF_MAX_HOOKS])(get_exec_env()->_nf_hooks))
-+#else
-+#define ve_nf_hooks nf_hooks
-+#endif
-+
- /*
- * A queue handler may be registered for each protocol. Each is protected by
- * long term mutex. The handler must provide an an outfn() to accept packets
-@@ -65,7 +72,7 @@ int nf_register_hook(struct nf_hook_ops
- struct list_head *i;
-
- spin_lock_bh(&nf_hook_lock);
-- list_for_each(i, &nf_hooks[reg->pf][reg->hooknum]) {
-+ list_for_each(i, &ve_nf_hooks[reg->pf][reg->hooknum]) {
- if (reg->priority < ((struct nf_hook_ops *)i)->priority)
- break;
- }
-@@ -76,6 +83,32 @@ int nf_register_hook(struct nf_hook_ops
- return 0;
- }
-
-+int visible_nf_register_hook(struct nf_hook_ops *reg)
-+{
-+ int ret = 0;
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ struct nf_hook_ops *tmp;
-+ ret = -ENOMEM;
-+ tmp = kmalloc(sizeof(struct nf_hook_ops), GFP_KERNEL);
-+ if (!tmp)
-+ goto nomem;
-+ memcpy(tmp, reg, sizeof(struct nf_hook_ops));
-+ reg = tmp;
-+ }
-+
-+ ret = nf_register_hook(reg);
-+ if (ret)
-+ goto out;
-+
-+ return 0;
-+out:
-+ if (!ve_is_super(get_exec_env()))
-+ kfree(reg);
-+nomem:
-+ return ret;
-+}
-+
- void nf_unregister_hook(struct nf_hook_ops *reg)
- {
- spin_lock_bh(&nf_hook_lock);
-@@ -85,6 +118,28 @@ void nf_unregister_hook(struct nf_hook_o
- synchronize_net();
- }
-
-+int visible_nf_unregister_hook(struct nf_hook_ops *reg)
-+{
-+ struct nf_hook_ops *i;
-+
-+ spin_lock_bh(&nf_hook_lock);
-+ list_for_each_entry(i, &ve_nf_hooks[reg->pf][reg->hooknum], list) {
-+ if (reg->hook == i->hook) {
-+ reg = i;
-+ break;
-+ }
-+ }
-+ spin_unlock_bh(&nf_hook_lock);
-+ if (reg != i)
-+ return -ENOENT;
-+
-+ nf_unregister_hook(reg);
-+
-+ if (!ve_is_super(get_exec_env()))
-+ kfree(reg);
-+ return 0;
-+}
-+
- /* Do exclusive ranges overlap? */
- static inline int overlap(int min1, int max1, int min2, int max2)
- {
-@@ -292,6 +347,12 @@ static int nf_sockopt(struct sock *sk, i
- struct nf_sockopt_ops *ops;
- int ret;
-
-+#ifdef CONFIG_VE_IPTABLES
-+ if (!get_exec_env()->_nf_hooks ||
-+ !get_exec_env()->_ipt_standard_target)
-+ return -ENOPROTOOPT;
-+#endif
-+
- if (down_interruptible(&nf_sockopt_mutex) != 0)
- return -EINTR;
-
-@@ -515,9 +576,9 @@ int nf_hook_slow(int pf, unsigned int ho
- skb->nf_debug |= (1 << hook);
- #endif
-
-- elem = &nf_hooks[pf][hook];
-+ elem = &ve_nf_hooks[pf][hook];
- next_hook:
-- verdict = nf_iterate(&nf_hooks[pf][hook], &skb, hook, indev,
-+ verdict = nf_iterate(&ve_nf_hooks[pf][hook], &skb, hook, indev,
- outdev, &elem, okfn, hook_thresh);
- if (verdict == NF_QUEUE) {
- NFDEBUG("nf_hook: Verdict = QUEUE.\n");
-@@ -563,12 +624,12 @@ void nf_reinject(struct sk_buff *skb, st
- /* Drop reference to owner of hook which queued us. */
- module_put(info->elem->owner);
-
-- list_for_each_rcu(i, &nf_hooks[info->pf][info->hook]) {
-+ list_for_each_rcu(i, &ve_nf_hooks[info->pf][info->hook]) {
- if (i == elem)
- break;
- }
-
-- if (elem == &nf_hooks[info->pf][info->hook]) {
-+ if (elem == &ve_nf_hooks[info->pf][info->hook]) {
- /* The module which sent it to userspace is gone. */
- NFDEBUG("%s: module disappeared, dropping packet.\n",
- __FUNCTION__);
-@@ -583,7 +644,7 @@ void nf_reinject(struct sk_buff *skb, st
-
- if (verdict == NF_ACCEPT) {
- next_hook:
-- verdict = nf_iterate(&nf_hooks[info->pf][info->hook],
-+ verdict = nf_iterate(&ve_nf_hooks[info->pf][info->hook],
- &skb, info->hook,
- info->indev, info->outdev, &elem,
- info->okfn, INT_MIN);
-@@ -808,26 +869,69 @@ EXPORT_SYMBOL(nf_log_packet);
- with it. */
- void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
-
--void __init netfilter_init(void)
-+void init_nf_hooks(struct list_head (*nh)[NF_MAX_HOOKS])
- {
- int i, h;
-
- for (i = 0; i < NPROTO; i++) {
- for (h = 0; h < NF_MAX_HOOKS; h++)
-- INIT_LIST_HEAD(&nf_hooks[i][h]);
-+ INIT_LIST_HEAD(&nh[i][h]);
- }
- }
-
-+int init_netfilter(void)
-+{
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *envid;
-+
-+ envid = get_exec_env();
-+ envid->_nf_hooks = kmalloc(sizeof(nf_hooks), GFP_KERNEL);
-+ if (envid->_nf_hooks == NULL)
-+ return -ENOMEM;
-+
-+ /* FIXME: charge ubc */
-+
-+ init_nf_hooks(envid->_nf_hooks);
-+ return 0;
-+#else
-+ init_nf_hooks(nf_hooks);
-+ return 0;
-+#endif
-+}
-+
-+#ifdef CONFIG_VE_IPTABLES
-+void fini_netfilter(void)
-+{
-+ struct ve_struct *envid;
-+
-+ envid = get_exec_env();
-+ if (envid->_nf_hooks != NULL)
-+ kfree(envid->_nf_hooks);
-+ envid->_nf_hooks = NULL;
-+
-+ /* FIXME: uncharge ubc */
-+}
-+#endif
-+
-+void __init netfilter_init(void)
-+{
-+ init_netfilter();
-+}
-+
- EXPORT_SYMBOL(ip_ct_attach);
- EXPORT_SYMBOL(ip_route_me_harder);
- EXPORT_SYMBOL(nf_getsockopt);
- EXPORT_SYMBOL(nf_hook_slow);
- EXPORT_SYMBOL(nf_hooks);
- EXPORT_SYMBOL(nf_register_hook);
-+EXPORT_SYMBOL(visible_nf_register_hook);
- EXPORT_SYMBOL(nf_register_queue_handler);
- EXPORT_SYMBOL(nf_register_sockopt);
- EXPORT_SYMBOL(nf_reinject);
- EXPORT_SYMBOL(nf_setsockopt);
- EXPORT_SYMBOL(nf_unregister_hook);
-+EXPORT_SYMBOL(visible_nf_unregister_hook);
- EXPORT_SYMBOL(nf_unregister_queue_handler);
- EXPORT_SYMBOL(nf_unregister_sockopt);
-+EXPORT_SYMBOL(init_netfilter);
-+EXPORT_SYMBOL(fini_netfilter);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/rtnetlink.c linux-2.6.9-ve023stab030/net/core/rtnetlink.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/rtnetlink.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/rtnetlink.c 2006-10-11 19:07:57.000000000 +0400
-@@ -399,6 +399,8 @@ static int rtnetlink_dump_all(struct sk_
- if (rtnetlink_links[idx] == NULL ||
- rtnetlink_links[idx][type].dumpit == NULL)
- continue;
-+ if (vz_security_proto_check(idx, 0, 0))
-+ continue;
- if (idx > s_idx)
- memset(&cb->args[0], 0, sizeof(cb->args));
- if (rtnetlink_links[idx][type].dumpit(skb, cb))
-@@ -471,7 +473,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, s
- return 0;
-
- family = ((struct rtgenmsg*)NLMSG_DATA(nlh))->rtgen_family;
-- if (family >= NPROTO) {
-+ if (family >= NPROTO || vz_security_proto_check(family, 0, 0)) {
- *errp = -EAFNOSUPPORT;
- return -1;
- }
-@@ -597,7 +599,13 @@ static void rtnetlink_rcv(struct sock *s
- return;
-
- while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
-- if (rtnetlink_rcv_skb(skb)) {
-+ int ret;
-+ struct ve_struct *old_env;
-+
-+ old_env = set_exec_env(VE_OWNER_SKB(skb));
-+ ret = rtnetlink_rcv_skb(skb);
-+ (void)set_exec_env(old_env);
-+ if (ret) {
- if (skb->len)
- skb_queue_head(&sk->sk_receive_queue,
- skb);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/scm.c linux-2.6.9-ve023stab030/net/core/scm.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/scm.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/scm.c 2006-10-11 19:07:57.000000000 +0400
-@@ -34,6 +34,7 @@
- #include <net/compat.h>
- #include <net/scm.h>
-
-+#include <ub/ub_mem.h>
-
- /*
- * Only allow a user to send credentials, that they could set with
-@@ -42,7 +43,9 @@
-
- static __inline__ int scm_check_creds(struct ucred *creds)
- {
-- if ((creds->pid == current->tgid || capable(CAP_SYS_ADMIN)) &&
-+ if ((creds->pid == virt_tgid(current) ||
-+ creds->pid == current->tgid ||
-+ capable(CAP_VE_SYS_ADMIN)) &&
- ((creds->uid == current->uid || creds->uid == current->euid ||
- creds->uid == current->suid) || capable(CAP_SETUID)) &&
- ((creds->gid == current->gid || creds->gid == current->egid ||
-@@ -69,7 +72,7 @@ static int scm_fp_copy(struct cmsghdr *c
-
- if (!fpl)
- {
-- fpl = kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);
-+ fpl = ub_kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);
- if (!fpl)
- return -ENOMEM;
- *fplp = fpl;
-@@ -275,7 +278,7 @@ struct scm_fp_list *scm_fp_dup(struct sc
- if (!fpl)
- return NULL;
-
-- new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL);
-+ new_fpl = ub_kmalloc(sizeof(*fpl), GFP_KERNEL);
- if (new_fpl) {
- for (i=fpl->count-1; i>=0; i--)
- get_file(fpl->fp[i]);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/skbuff.c linux-2.6.9-ve023stab030/net/core/skbuff.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/skbuff.c 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/skbuff.c 2006-10-11 19:07:57.000000000 +0400
-@@ -48,6 +48,7 @@
- #include <linux/in.h>
- #include <linux/inet.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/netdevice.h>
- #ifdef CONFIG_NET_CLS_ACT
- #include <net/pkt_sched.h>
-@@ -68,6 +69,8 @@
- #include <asm/uaccess.h>
- #include <asm/system.h>
-
-+#include <ub/ub_net.h>
-+
- static kmem_cache_t *skbuff_head_cache;
-
- /*
-@@ -136,6 +139,9 @@ struct sk_buff *alloc_skb(unsigned int s
- if (!skb)
- goto out;
-
-+ if (ub_skb_alloc_bc(skb, gfp_mask))
-+ goto nobc;
-+
- /* Get the DATA. Size must match skb_add_mtu(). */
- size = SKB_DATA_ALIGN(size);
- data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
-@@ -149,6 +155,7 @@ struct sk_buff *alloc_skb(unsigned int s
- skb->data = data;
- skb->tail = data;
- skb->end = data + size;
-+ SET_VE_OWNER_SKB(skb, get_exec_env());
-
- atomic_set(&(skb_shinfo(skb)->dataref), 1);
- skb_shinfo(skb)->nr_frags = 0;
-@@ -158,6 +165,8 @@ struct sk_buff *alloc_skb(unsigned int s
- out:
- return skb;
- nodata:
-+ ub_skb_free_bc(skb);
-+nobc:
- kmem_cache_free(skbuff_head_cache, skb);
- skb = NULL;
- goto out;
-@@ -208,6 +217,7 @@ void skb_release_data(struct sk_buff *sk
- void kfree_skbmem(struct sk_buff *skb)
- {
- skb_release_data(skb);
-+ ub_skb_free_bc(skb);
- kmem_cache_free(skbuff_head_cache, skb);
- }
-
-@@ -232,6 +242,7 @@ void __kfree_skb(struct sk_buff *skb)
- #ifdef CONFIG_XFRM
- secpath_put(skb->sp);
- #endif
-+ ub_skb_uncharge(skb);
- if(skb->destructor) {
- if (in_irq())
- printk(KERN_WARNING "Warning: kfree_skb on "
-@@ -277,6 +288,11 @@ struct sk_buff *skb_clone(struct sk_buff
- if (!n)
- return NULL;
-
-+ if (ub_skb_alloc_bc(n, gfp_mask)) {
-+ kmem_cache_free(skbuff_head_cache, n);
-+ return NULL;
-+ }
-+
- #define C(x) n->x = skb->x
-
- n->next = n->prev = NULL;
-@@ -305,6 +321,7 @@ struct sk_buff *skb_clone(struct sk_buff
- C(priority);
- C(protocol);
- C(security);
-+ SET_VE_OWNER_SKB(n, VE_OWNER_SKB(skb));
- n->destructor = NULL;
- #ifdef CONFIG_NETFILTER
- C(nfmark);
-@@ -373,6 +390,7 @@ static void copy_skb_header(struct sk_bu
- new->stamp = old->stamp;
- new->destructor = NULL;
- new->security = old->security;
-+ SET_VE_OWNER_SKB(new, VE_OWNER_SKB((struct sk_buff *)old));
- #ifdef CONFIG_NETFILTER
- new->nfmark = old->nfmark;
- new->nfcache = old->nfcache;
-@@ -1434,6 +1452,7 @@ void __init skb_init(void)
- NULL, NULL);
- if (!skbuff_head_cache)
- panic("cannot create skbuff cache");
-+ skbuff_head_cache->flags |= CFLGS_ENVIDS;
- }
-
- EXPORT_SYMBOL(___pskb_trim);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/sock.c linux-2.6.9-ve023stab030/net/core/sock.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/sock.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/sock.c 2006-10-11 19:07:57.000000000 +0400
-@@ -106,6 +106,7 @@
- #include <linux/net.h>
- #include <linux/mm.h>
- #include <linux/slab.h>
-+#include <linux/kmem_cache.h>
- #include <linux/interrupt.h>
- #include <linux/poll.h>
- #include <linux/tcp.h>
-@@ -121,6 +122,9 @@
- #include <net/xfrm.h>
- #include <linux/ipsec.h>
-
-+#include <ub/ub_net.h>
-+#include <ub/beancounter.h>
-+
- #include <linux/filter.h>
-
- #ifdef CONFIG_INET
-@@ -169,7 +173,7 @@ static void sock_warn_obsolete_bsdism(co
- static char warncomm[16];
- if (strcmp(warncomm, current->comm) && warned < 5) {
- strcpy(warncomm, current->comm);
-- printk(KERN_WARNING "process `%s' is using obsolete "
-+ ve_printk(VE_LOG, KERN_WARNING "process `%s' is using obsolete "
- "%s SO_BSDCOMPAT\n", warncomm, name);
- warned++;
- }
-@@ -630,6 +634,7 @@ struct sock *sk_alloc(int family, int pr
- zero_it == 1 ? sizeof(struct sock) : zero_it);
- sk->sk_family = family;
- sock_lock_init(sk);
-+ SET_VE_OWNER_SK(sk, get_exec_env());
- }
- sk->sk_slab = slab;
-
-@@ -662,6 +667,7 @@ void sk_free(struct sock *sk)
- __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
-
- security_sk_free(sk);
-+ ub_sock_uncharge(sk);
- kmem_cache_free(sk->sk_slab, sk);
- module_put(owner);
- }
-@@ -672,6 +678,7 @@ void __init sk_init(void)
- SLAB_HWCACHE_ALIGN, NULL, NULL);
- if (!sk_cachep)
- printk(KERN_CRIT "sk_init: Cannot create sock SLAB cache!");
-+ sk_cachep->flags |= CFLGS_ENVIDS;
-
- if (num_physpages <= 4096) {
- sysctl_wmem_max = 32767;
-@@ -828,6 +835,7 @@ static long sock_wait_for_wmem(struct so
- struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
- unsigned long data_len, int noblock, int *errcode)
- {
-+#if 0
- struct sk_buff *skb;
- unsigned int gfp_mask;
- long timeo;
-@@ -904,13 +912,87 @@ interrupted:
- err = sock_intr_errno(timeo);
- failure:
- *errcode = err;
-+#endif
-+ return NULL;
-+}
-+
-+struct sk_buff *sock_alloc_send_skb2(struct sock *sk, unsigned long size,
-+ unsigned long size2, int noblock,
-+ int *errcode)
-+{
-+ struct sk_buff *skb;
-+ unsigned int gfp_mask;
-+ long timeo;
-+ int err;
-+
-+ gfp_mask = sk->sk_allocation;
-+ if (gfp_mask & __GFP_WAIT)
-+ gfp_mask |= __GFP_REPEAT;
-+
-+ timeo = sock_sndtimeo(sk, noblock);
-+ while (1) {
-+ err = sock_error(sk);
-+ if (err != 0)
-+ goto failure;
-+
-+ err = -EPIPE;
-+ if (sk->sk_shutdown & SEND_SHUTDOWN)
-+ goto failure;
-+
-+ if (ub_sock_getwres_other(sk, skb_charge_size(size))) {
-+ if (size2 < size) {
-+ size = size2;
-+ continue;
-+ }
-+ set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
-+ err = -EAGAIN;
-+ if (!timeo)
-+ goto failure;
-+ if (signal_pending(current))
-+ goto interrupted;
-+ timeo = ub_sock_wait_for_space(sk, timeo,
-+ skb_charge_size(size));
-+ continue;
-+ }
-+
-+ if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
-+ skb = alloc_skb(size, sk->sk_allocation);
-+ if (skb)
-+ /* Full success... */
-+ break;
-+ ub_sock_retwres_other(sk, skb_charge_size(size),
-+ SOCK_MIN_UBCSPACE_CH);
-+ err = -ENOBUFS;
-+ goto failure;
-+ }
-+ ub_sock_retwres_other(sk,
-+ skb_charge_size(size),
-+ SOCK_MIN_UBCSPACE_CH);
-+ set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
-+ set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
-+ err = -EAGAIN;
-+ if (!timeo)
-+ goto failure;
-+ if (signal_pending(current))
-+ goto interrupted;
-+ timeo = sock_wait_for_wmem(sk, timeo);
-+ }
-+
-+ ub_skb_set_charge(skb, sk, skb_charge_size(size), UB_OTHERSOCKBUF);
-+ skb_set_owner_w(skb, sk);
-+ return skb;
-+
-+interrupted:
-+ err = sock_intr_errno(timeo);
-+failure:
-+ *errcode = err;
- return NULL;
- }
-
- struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
- int noblock, int *errcode)
- {
-- return sock_alloc_send_pskb(sk, size, 0, noblock, errcode);
-+ return sock_alloc_send_skb2(sk, size, size, noblock, errcode);
- }
-
- static void __lock_sock(struct sock *sk)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/stream.c linux-2.6.9-ve023stab030/net/core/stream.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/stream.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/stream.c 2006-10-11 19:07:56.000000000 +0400
-@@ -109,8 +109,10 @@ EXPORT_SYMBOL(sk_stream_wait_close);
- * sk_stream_wait_memory - Wait for more memory for a socket
- * @sk - socket to wait for memory
- * @timeo_p - for how long
-+ * @amount - amount of memory to wait for (in UB space!)
- */
--int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
-+int __sk_stream_wait_memory(struct sock *sk, long *timeo_p,
-+ unsigned long amount)
- {
- int err = 0;
- long vm_wait = 0;
-@@ -132,14 +134,19 @@ int sk_stream_wait_memory(struct sock *s
- if (signal_pending(current))
- goto do_interrupted;
- clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
-- if (sk_stream_memory_free(sk) && !vm_wait)
-- break;
-+ if (amount == 0) {
-+ if (sk_stream_memory_free(sk) && !vm_wait)
-+ break;
-+ } else
-+ ub_sock_sndqueueadd_tcp(sk, amount);
-
- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
- sk->sk_write_pending++;
- sk_wait_event(sk, &current_timeo, sk_stream_memory_free(sk) &&
- vm_wait);
- sk->sk_write_pending--;
-+ if (amount > 0)
-+ ub_sock_sndqueuedel(sk);
-
- if (vm_wait) {
- vm_wait -= current_timeo;
-@@ -166,6 +173,10 @@ do_interrupted:
- goto out;
- }
-
-+int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
-+{
-+ return __sk_stream_wait_memory(sk, timeo_p, 0);
-+}
- EXPORT_SYMBOL(sk_stream_wait_memory);
-
- void sk_stream_rfree(struct sk_buff *skb)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/core/utils.c linux-2.6.9-ve023stab030/net/core/utils.c
---- linux-2.6.9-42.0.3.EL.orig/net/core/utils.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/core/utils.c 2006-10-11 19:07:55.000000000 +0400
-@@ -166,7 +166,7 @@ void * __init net_alloc_hash(const char
- /* allow the kernel cmdline to have a say */
- if (!numentries) {
- /* round applicable memory size up to nearest megabyte */
-- numentries = nr_all_pages;
-+ numentries = nr_kernel_pages;
- numentries += (1UL << (20 - PAGE_SHIFT)) - 1;
- numentries >>= 20 - PAGE_SHIFT;
- numentries <<= 20 - PAGE_SHIFT;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/af_inet.c linux-2.6.9-ve023stab030/net/ipv4/af_inet.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/af_inet.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/af_inet.c 2006-10-11 19:07:57.000000000 +0400
-@@ -113,6 +113,8 @@
- #include <linux/mroute.h>
- #endif
-
-+#include <ub/ub_net.h>
-+
- DEFINE_SNMP_STAT(struct linux_mib, net_statistics);
-
- #ifdef INET_REFCNT_DEBUG
-@@ -287,6 +289,13 @@ static int inet_create(struct socket *so
- if (sk == NULL)
- goto out;
-
-+ err = -ENOBUFS;
-+ if (ub_sock_charge(sk, PF_INET, sock->type))
-+ goto out_sk_free;
-+ /* if charge was successful, sock_init_data() MUST be called to
-+ * set sk->sk_type. otherwise sk will be uncharged to wrong resource
-+ */
-+
- err = 0;
- sk->sk_prot = answer_prot;
- sk->sk_no_check = answer_no_check;
-@@ -344,6 +353,8 @@ static int inet_create(struct socket *so
- }
- out:
- return err;
-+out_sk_free:
-+ sk_free(sk);
- out_rcu_unlock:
- rcu_read_unlock();
- goto out;
-@@ -361,6 +372,9 @@ int inet_release(struct socket *sock)
-
- if (sk) {
- long timeout;
-+ struct ve_struct *saved_env;
-+
-+ saved_env = set_exec_env(VE_OWNER_SK(sk));
-
- /* Applications forget to leave groups before exiting */
- ip_mc_drop_socket(sk);
-@@ -378,6 +392,8 @@ int inet_release(struct socket *sock)
- timeout = sk->sk_lingertime;
- sock->sk = NULL;
- sk->sk_prot->close(sk, timeout);
-+
-+ set_exec_env(saved_env);
- }
- return 0;
- }
-@@ -965,20 +981,20 @@ static struct net_protocol icmp_protocol
-
- static int __init init_ipv4_mibs(void)
- {
-- net_statistics[0] = alloc_percpu(struct linux_mib);
-- net_statistics[1] = alloc_percpu(struct linux_mib);
-- ip_statistics[0] = alloc_percpu(struct ipstats_mib);
-- ip_statistics[1] = alloc_percpu(struct ipstats_mib);
-- icmp_statistics[0] = alloc_percpu(struct icmp_mib);
-- icmp_statistics[1] = alloc_percpu(struct icmp_mib);
-- tcp_statistics[0] = alloc_percpu(struct tcp_mib);
-- tcp_statistics[1] = alloc_percpu(struct tcp_mib);
-- udp_statistics[0] = alloc_percpu(struct udp_mib);
-- udp_statistics[1] = alloc_percpu(struct udp_mib);
-+ ve_net_statistics[0] = alloc_percpu(struct linux_mib);
-+ ve_net_statistics[1] = alloc_percpu(struct linux_mib);
-+ ve_ip_statistics[0] = alloc_percpu(struct ipstats_mib);
-+ ve_ip_statistics[1] = alloc_percpu(struct ipstats_mib);
-+ ve_icmp_statistics[0] = alloc_percpu(struct icmp_mib);
-+ ve_icmp_statistics[1] = alloc_percpu(struct icmp_mib);
-+ ve_tcp_statistics[0] = alloc_percpu(struct tcp_mib);
-+ ve_tcp_statistics[1] = alloc_percpu(struct tcp_mib);
-+ ve_udp_statistics[0] = alloc_percpu(struct udp_mib);
-+ ve_udp_statistics[1] = alloc_percpu(struct udp_mib);
- if (!
-- (net_statistics[0] && net_statistics[1] && ip_statistics[0]
-- && ip_statistics[1] && tcp_statistics[0] && tcp_statistics[1]
-- && udp_statistics[0] && udp_statistics[1]))
-+ (ve_net_statistics[0] && ve_net_statistics[1] && ve_ip_statistics[0]
-+ && ve_ip_statistics[1] && ve_tcp_statistics[0] && ve_tcp_statistics[1]
-+ && ve_udp_statistics[0] && ve_udp_statistics[1]))
- return -ENOMEM;
-
- (void) tcp_mib_init();
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/arp.c linux-2.6.9-ve023stab030/net/ipv4/arp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/arp.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/arp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -173,7 +173,7 @@ struct neigh_ops arp_broken_ops = {
- .queue_xmit = dev_queue_xmit,
- };
-
--struct neigh_table arp_tbl = {
-+struct neigh_table global_arp_tbl = {
- .family = AF_INET,
- .entry_size = sizeof(struct neighbour) + 4,
- .key_len = 4,
-@@ -182,7 +182,7 @@ struct neigh_table arp_tbl = {
- .proxy_redo = parp_redo,
- .id = "arp_cache",
- .parms = {
-- .tbl = &arp_tbl,
-+ .tbl = &global_arp_tbl,
- .base_reachable_time = 30 * HZ,
- .retrans_time = 1 * HZ,
- .gc_staletime = 60 * HZ,
-@@ -982,7 +982,7 @@ int arp_req_set(struct arpreq *r, struct
- return 0;
- }
- if (dev == NULL) {
-- ipv4_devconf.proxy_arp = 1;
-+ ve_ipv4_devconf.proxy_arp = 1;
- return 0;
- }
- if (__in_dev_get(dev)) {
-@@ -1088,7 +1088,7 @@ int arp_req_delete(struct arpreq *r, str
- return pneigh_delete(&arp_tbl, &ip, dev);
- if (mask == 0) {
- if (dev == NULL) {
-- ipv4_devconf.proxy_arp = 0;
-+ ve_ipv4_devconf.proxy_arp = 0;
- return 0;
- }
- if (__in_dev_get(dev)) {
-@@ -1234,7 +1234,9 @@ static int arp_proc_init(void);
-
- void __init arp_init(void)
- {
-- neigh_table_init(&arp_tbl);
-+ get_ve0()->ve_arp_tbl = &global_arp_tbl;
-+ if (neigh_table_init(&arp_tbl))
-+ panic("cannot initialize ARP tables\n");
-
- dev_add_pack(&arp_packet_type);
- arp_proc_init();
-@@ -1366,8 +1368,9 @@ static int arp_seq_open(struct inode *in
- {
- struct seq_file *seq;
- int rc = -ENOMEM;
-- struct neigh_seq_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
--
-+ struct neigh_seq_state *s;
-+
-+ s = kmalloc(sizeof(*s), GFP_KERNEL);
- if (!s)
- goto out;
-
-@@ -1415,8 +1418,55 @@ EXPORT_SYMBOL(arp_rcv);
- EXPORT_SYMBOL(arp_create);
- EXPORT_SYMBOL(arp_xmit);
- EXPORT_SYMBOL(arp_send);
--EXPORT_SYMBOL(arp_tbl);
-+EXPORT_SYMBOL(global_arp_tbl);
-
- #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
- EXPORT_SYMBOL(clip_tbl_hook);
- #endif
-+
-+int ve_arp_init(struct ve_struct *ve)
-+{
-+ struct ve_struct *old_env;
-+ int err;
-+
-+ ve->ve_arp_tbl = kmalloc(sizeof(struct neigh_table), GFP_KERNEL);
-+ if (ve->ve_arp_tbl == NULL) {
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+
-+ *(ve->ve_arp_tbl) = global_arp_tbl;
-+ ve->ve_arp_tbl->parms.tbl = ve->ve_arp_tbl;
-+ old_env = set_exec_env(ve);
-+ err = neigh_table_init(ve->ve_arp_tbl);
-+ if (err)
-+ goto out_free;
-+#ifdef CONFIG_SYSCTL
-+ neigh_sysctl_register(NULL, &arp_tbl.parms, NET_IPV4,
-+ NET_IPV4_NEIGH, "ipv4", NULL);
-+#endif
-+ set_exec_env(old_env);
-+ err = 0;
-+
-+out:
-+ return err;
-+
-+out_free:
-+ kfree(ve->ve_arp_tbl);
-+ ve->ve_arp_tbl = NULL;
-+ goto out;
-+}
-+EXPORT_SYMBOL(ve_arp_init);
-+
-+void ve_arp_fini(struct ve_struct *ve)
-+{
-+ if (ve->ve_arp_tbl) {
-+#ifdef CONFIG_SYSCTL
-+ neigh_sysctl_unregister(&ve->ve_arp_tbl->parms);
-+#endif
-+ neigh_table_clear(ve->ve_arp_tbl);
-+ kfree(ve->ve_arp_tbl);
-+ ve->ve_arp_tbl = NULL;
-+ }
-+}
-+EXPORT_SYMBOL(ve_arp_fini);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/devinet.c linux-2.6.9-ve023stab030/net/ipv4/devinet.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/devinet.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/devinet.c 2006-10-11 19:07:59.000000000 +0400
-@@ -77,10 +77,21 @@ static struct ipv4_devconf ipv4_devconf_
- .accept_source_route = 1,
- };
-
-+struct ipv4_devconf *get_ipv4_devconf_dflt_addr(void)
-+{
-+ return &ipv4_devconf_dflt;
-+}
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ve_ipv4_devconf_dflt (*(get_exec_env()->_ipv4_devconf_dflt))
-+#else
-+#define ve_ipv4_devconf_dflt ipv4_devconf_dflt
-+#endif
-+
- static void rtmsg_ifa(int event, struct in_ifaddr *);
-
- static struct notifier_block *inetaddr_chain;
--static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
-+void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
- int destroy);
- #ifdef CONFIG_SYSCTL
- static void devinet_sysctl_register(struct in_device *in_dev,
-@@ -90,7 +101,7 @@ static void devinet_sysctl_unregister(st
-
- /* Locks all the inet devices. */
-
--static struct in_ifaddr *inet_alloc_ifa(void)
-+struct in_ifaddr *inet_alloc_ifa(void)
- {
- struct in_ifaddr *ifa = kmalloc(sizeof(*ifa), GFP_KERNEL);
-
-@@ -101,6 +112,7 @@ static struct in_ifaddr *inet_alloc_ifa(
-
- return ifa;
- }
-+EXPORT_SYMBOL(inet_alloc_ifa);
-
- static void inet_rcu_free_ifa(struct rcu_head *head)
- {
-@@ -174,6 +186,7 @@ out_kfree:
- in_dev = NULL;
- goto out;
- }
-+EXPORT_SYMBOL(inetdev_init);
-
- static void in_dev_rcu_put(struct rcu_head *head)
- {
-@@ -228,7 +241,7 @@ int inet_addr_onlink(struct in_device *i
- return 0;
- }
-
--static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
-+void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
- int destroy)
- {
- struct in_ifaddr *ifa1 = *ifap;
-@@ -281,7 +294,7 @@ static void inet_del_ifa(struct in_devic
- }
- }
-
--static int inet_insert_ifa(struct in_ifaddr *ifa)
-+int inet_insert_ifa(struct in_ifaddr *ifa)
- {
- struct in_device *in_dev = ifa->ifa_dev;
- struct in_ifaddr *ifa1, **ifap, **last_primary;
-@@ -331,6 +344,7 @@ static int inet_insert_ifa(struct in_ifa
-
- return 0;
- }
-+EXPORT_SYMBOL(inet_insert_ifa);
-
- static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
- {
-@@ -539,7 +553,7 @@ int devinet_ioctl(unsigned int cmd, void
-
- case SIOCSIFFLAGS:
- ret = -EACCES;
-- if (!capable(CAP_NET_ADMIN))
-+ if (!capable(CAP_VE_NET_ADMIN))
- goto out;
- break;
- case SIOCSIFADDR: /* Set interface address (and family) */
-@@ -547,7 +561,7 @@ int devinet_ioctl(unsigned int cmd, void
- case SIOCSIFDSTADDR: /* Set the destination address */
- case SIOCSIFNETMASK: /* Set the netmask for the interface */
- ret = -EACCES;
-- if (!capable(CAP_NET_ADMIN))
-+ if (!capable(CAP_VE_NET_ADMIN))
- goto out;
- ret = -EINVAL;
- if (sin->sin_family != AF_INET)
-@@ -955,7 +969,7 @@ static int inetdev_event(struct notifier
- case NETDEV_UP:
- if (dev->mtu < 68)
- break;
-- if (dev == &loopback_dev) {
-+ if (dev == &visible_loopback_dev) {
- struct in_ifaddr *ifa;
- if ((ifa = inet_alloc_ifa()) != NULL) {
- ifa->ifa_local =
-@@ -1118,10 +1132,10 @@ static struct rtnetlink_link inet_rtnetl
- void inet_forward_change(void)
- {
- struct net_device *dev;
-- int on = ipv4_devconf.forwarding;
-+ int on = ve_ipv4_devconf.forwarding;
-
-- ipv4_devconf.accept_redirects = !on;
-- ipv4_devconf_dflt.forwarding = on;
-+ ve_ipv4_devconf.accept_redirects = !on;
-+ ve_ipv4_devconf_dflt.forwarding = on;
-
- read_lock(&dev_base_lock);
- for (dev = dev_base; dev; dev = dev->next) {
-@@ -1146,9 +1160,9 @@ static int devinet_sysctl_forward(ctl_ta
- int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
-
- if (write && *valp != val) {
-- if (valp == &ipv4_devconf.forwarding)
-+ if (valp == &ve_ipv4_devconf.forwarding)
- inet_forward_change();
-- else if (valp != &ipv4_devconf_dflt.forwarding)
-+ else if (valp != &ve_ipv4_devconf_dflt.forwarding)
- rt_cache_flush(0);
- }
-
-@@ -1410,28 +1424,21 @@ static struct devinet_sysctl_table {
- },
- };
-
--static void devinet_sysctl_register(struct in_device *in_dev,
-- struct ipv4_devconf *p)
-+static struct devinet_sysctl_table *__devinet_sysctl_register(char *dev_name,
-+ int ifindex, struct ipv4_devconf *p)
- {
- int i;
-- struct net_device *dev = in_dev ? in_dev->dev : NULL;
-- struct devinet_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL);
-- char *dev_name = NULL;
-+ struct devinet_sysctl_table *t;
-
-+ t = kmalloc(sizeof(*t), GFP_KERNEL);
- if (!t)
-- return;
-+ goto out;
-+
- memcpy(t, &devinet_sysctl, sizeof(*t));
- for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
- t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
- t->devinet_vars[i].de = NULL;
-- }
--
-- if (dev) {
-- dev_name = dev->name;
-- t->devinet_dev[0].ctl_name = dev->ifindex;
-- } else {
-- dev_name = "default";
-- t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT;
-+ t->devinet_vars[i].owner_env = get_exec_env();
- }
-
- /*
-@@ -1441,8 +1448,9 @@ static void devinet_sysctl_register(stru
- */
- dev_name = net_sysctl_strdup(dev_name);
- if (!dev_name)
-- goto free;
-+ goto out_free_table;
-
-+ t->devinet_dev[0].ctl_name = ifindex;
- t->devinet_dev[0].procname = dev_name;
- t->devinet_dev[0].child = t->devinet_vars;
- t->devinet_dev[0].de = NULL;
-@@ -1455,17 +1463,38 @@ static void devinet_sysctl_register(stru
-
- t->sysctl_header = register_sysctl_table(t->devinet_root_dir, 0);
- if (!t->sysctl_header)
-- goto free_procname;
-+ goto out_free_procname;
-
-- p->sysctl = t;
-- return;
-+ return t;
-
- /* error path */
-- free_procname:
-+out_free_procname:
- kfree(dev_name);
-- free:
-+out_free_table:
- kfree(t);
-- return;
-+out:
-+ printk(KERN_DEBUG "Can't register net/ipv4/conf sysctls.\n");
-+ return NULL;
-+}
-+
-+static void devinet_sysctl_register(struct in_device *in_dev,
-+ struct ipv4_devconf *p)
-+{
-+ struct net_device *dev;
-+ char *dev_name;
-+ int ifindex;
-+
-+ dev = in_dev ? in_dev->dev : NULL;
-+
-+ if (dev) {
-+ dev_name = dev->name;
-+ ifindex = dev->ifindex;
-+ } else {
-+ dev_name = "default";
-+ ifindex = NET_PROTO_CONF_DEFAULT;
-+ }
-+
-+ p->sysctl = __devinet_sysctl_register(dev_name, ifindex, p);
- }
-
- static void devinet_sysctl_unregister(struct ipv4_devconf *p)
-@@ -1478,7 +1507,206 @@ static void devinet_sysctl_unregister(st
- kfree(t);
- }
- }
-+
-+extern int visible_ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos);
-+extern int visible_ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen,
-+ void *oldval, size_t *oldlenp,
-+ void *newval, size_t newlen,
-+ void **context);
-+
-+extern void *get_flush_delay_addr(void);
-+extern int visible_ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos);
-+extern int visible_ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
-+ int __user *name,
-+ int nlen,
-+ void __user *oldval,
-+ size_t __user *oldlenp,
-+ void __user *newval,
-+ size_t newlen,
-+ void **context);
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static ctl_table net_sysctl_tables[] = {
-+ /* 0: net */
-+ {
-+ .ctl_name = CTL_NET,
-+ .procname = "net",
-+ .mode = 0555,
-+ .child = &net_sysctl_tables[2],
-+ },
-+ { .ctl_name = 0, },
-+ /* 2: net/ipv4 */
-+ {
-+ .ctl_name = NET_IPV4,
-+ .procname = "ipv4",
-+ .mode = 0555,
-+ .child = &net_sysctl_tables[4],
-+ },
-+ { .ctl_name = 0, },
-+ /* 4, 5, 6: net/ipv4/[vars] */
-+ {
-+ .ctl_name = NET_IPV4_FORWARD,
-+ .procname = "ip_forward",
-+ .data = &ipv4_devconf.forwarding,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &visible_ipv4_sysctl_forward,
-+ .strategy = &visible_ipv4_sysctl_forward_strategy,
-+ },
-+ {
-+ .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
-+ .procname = "ip_local_port_range",
-+ .data = get_ve0()->_sysctl_local_port_range,
-+ .maxlen = sizeof(get_ve0()->_sysctl_local_port_range),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec_minmax,
-+ .strategy = &sysctl_intvec,
-+ .extra1 = ip_local_port_range_min,
-+ .extra2 = ip_local_port_range_max
-+ },
-+ {
-+ .ctl_name = NET_IPV4_ROUTE,
-+ .procname = "route",
-+ .maxlen = 0,
-+ .mode = 0555,
-+ .child = &net_sysctl_tables[8],
-+ },
-+ { .ctl_name = 0 },
-+ /* 8: net/ipv4/route/flush */
-+ {
-+ .ctl_name = NET_IPV4_ROUTE_FLUSH,
-+ .procname = "flush",
-+ .data = NULL, /* set up below */
-+ .maxlen = sizeof(int),
-+ .mode = 0200,
-+ .proc_handler = &visible_ipv4_sysctl_rtcache_flush,
-+ .strategy = &visible_ipv4_sysctl_rtcache_flush_strategy,
-+ },
-+ { .ctl_name = 0 },
-+};
-+
-+static int ip_forward_sysctl_register(struct ve_struct *ve,
-+ struct ipv4_devconf *p)
-+{
-+ struct ctl_table_header *hdr;
-+ ctl_table *root;
-+
-+ root = clone_sysctl_template(net_sysctl_tables,
-+ sizeof(net_sysctl_tables) / sizeof(ctl_table));
-+ if (root == NULL)
-+ goto out;
-+
-+ root[4].data = &p->forwarding;
-+ root[8].data = get_flush_delay_addr();
-+
-+ root[5].data = ve->_sysctl_local_port_range;
-+ memcpy(ve->_sysctl_local_port_range,
-+ get_ve0()->_sysctl_local_port_range,
-+ sizeof(ve->_sysctl_local_port_range));
-+ ve->_tcp_port_rover = ve->_sysctl_local_port_range[0] - 1;
-+
-+ hdr = register_sysctl_table(root, 1);
-+ if (hdr == NULL)
-+ goto out_free;
-+
-+ ve->forward_header = hdr;
-+ ve->forward_table = root;
-+ return 0;
-+
-+out_free:
-+ free_sysctl_clone(root);
-+out:
-+ return -ENOMEM;
-+}
-+
-+static inline void ip_forward_sysctl_unregister(struct ve_struct *ve)
-+{
-+ unregister_sysctl_table(ve->forward_header);
-+ ve->forward_header = NULL;
-+}
-+
-+static inline void ip_forward_sysctl_free(struct ve_struct *ve)
-+{
-+ free_sysctl_clone(ve->forward_table);
-+ ve->forward_table = NULL;
-+}
-+#endif
-+#endif
-+
-+int devinet_sysctl_init(struct ve_struct *ve)
-+{
-+ int err = 0;
-+#ifdef CONFIG_SYSCTL
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ struct ipv4_devconf *conf, *conf_def;
-+
-+ err = -ENOMEM;
-+
-+ conf = kmalloc(sizeof(*conf), GFP_KERNEL);
-+ if (!conf)
-+ goto err1;
-+
-+ memcpy(conf, &ipv4_devconf, sizeof(*conf));
-+ conf->sysctl = __devinet_sysctl_register("all",
-+ NET_PROTO_CONF_ALL, conf);
-+ if (!conf->sysctl)
-+ goto err2;
-+
-+ conf_def = kmalloc(sizeof(*conf_def), GFP_KERNEL);
-+ if (!conf_def)
-+ goto err3;
-+
-+ memcpy(conf_def, &ipv4_devconf_dflt, sizeof(*conf_def));
-+ conf_def->sysctl = __devinet_sysctl_register("default",
-+ NET_PROTO_CONF_DEFAULT, conf_def);
-+ if (!conf_def->sysctl)
-+ goto err4;
-+
-+ err = ip_forward_sysctl_register(ve, conf);
-+ if (err)
-+ goto err5;
-+
-+ ve->_ipv4_devconf = conf;
-+ ve->_ipv4_devconf_dflt = conf_def;
-+ return 0;
-+
-+err5:
-+ devinet_sysctl_unregister(conf_def);
-+err4:
-+ kfree(conf_def);
-+err3:
-+ devinet_sysctl_unregister(conf);
-+err2:
-+ kfree(conf);
-+err1:
-+#endif
-+#endif
-+ return err;
-+}
-+
-+void devinet_sysctl_fini(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_SYSCTL
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ ip_forward_sysctl_unregister(ve);
-+ devinet_sysctl_unregister(ve->_ipv4_devconf);
-+ devinet_sysctl_unregister(ve->_ipv4_devconf_dflt);
-+#endif
-+#endif
-+}
-+
-+void devinet_sysctl_free(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_SYSCTL
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ ip_forward_sysctl_free(ve);
-+ kfree(ve->_ipv4_devconf);
-+ kfree(ve->_ipv4_devconf_dflt);
- #endif
-+#endif
-+}
-
- void __init devinet_init(void)
- {
-@@ -1488,13 +1716,18 @@ void __init devinet_init(void)
- #ifdef CONFIG_SYSCTL
- devinet_sysctl.sysctl_header =
- register_sysctl_table(devinet_sysctl.devinet_root_dir, 0);
-- devinet_sysctl_register(NULL, &ipv4_devconf_dflt);
-+ __devinet_sysctl_register("default", NET_PROTO_CONF_DEFAULT,
-+ &ipv4_devconf_dflt);
- #endif
- }
-
- EXPORT_SYMBOL(devinet_ioctl);
- EXPORT_SYMBOL(in_dev_finish_destroy);
- EXPORT_SYMBOL(inet_select_addr);
-+EXPORT_SYMBOL(inet_del_ifa);
- EXPORT_SYMBOL(inetdev_by_index);
-+EXPORT_SYMBOL(devinet_sysctl_init);
-+EXPORT_SYMBOL(devinet_sysctl_fini);
-+EXPORT_SYMBOL(devinet_sysctl_free);
- EXPORT_SYMBOL(register_inetaddr_notifier);
- EXPORT_SYMBOL(unregister_inetaddr_notifier);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_frontend.c linux-2.6.9-ve023stab030/net/ipv4/fib_frontend.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_frontend.c 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/fib_frontend.c 2006-10-11 19:07:57.000000000 +0400
-@@ -51,14 +51,46 @@
-
- #define RT_TABLE_MIN RT_TABLE_MAIN
-
-+#undef ip_fib_local_table
-+#undef ip_fib_main_table
- struct fib_table *ip_fib_local_table;
- struct fib_table *ip_fib_main_table;
-+void prepare_fib_tables(void)
-+{
-+#ifdef CONFIG_VE
-+ get_ve0()->_local_table = ip_fib_local_table;
-+ ip_fib_local_table = (struct fib_table *)0x12345678;
-+ get_ve0()->_main_table = ip_fib_main_table;
-+ ip_fib_main_table = (struct fib_table *)0x12345678;
-+#endif
-+}
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define ip_fib_local_table get_exec_env()->_local_table
-+#define ip_fib_main_table get_exec_env()->_main_table
-+#endif
-
- #else
-
- #define RT_TABLE_MIN 1
-
-+#undef fib_tables
- struct fib_table *fib_tables[RT_TABLE_MAX+1];
-+void prepare_fib_tables(void)
-+{
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ int i;
-+
-+ BUG_ON(sizeof(fib_tables) !=
-+ sizeof(((struct ve_struct *)0)->_fib_tables));
-+ memcpy(get_ve0()->_fib_tables, fib_tables, sizeof(fib_tables));
-+ for (i = 0; i <= RT_TABLE_MAX; i++)
-+ fib_tables[i] = (void *)0x12366678;
-+#endif
-+}
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define fib_tables get_exec_env()->_fib_tables
-+#endif
-
- struct fib_table *__fib_new_table(int id)
- {
-@@ -248,7 +280,7 @@ int ip_rt_ioctl(unsigned int cmd, void _
- switch (cmd) {
- case SIOCADDRT: /* Add a route */
- case SIOCDELRT: /* Delete a route */
-- if (!capable(CAP_NET_ADMIN))
-+ if (!capable(CAP_VE_NET_ADMIN))
- return -EPERM;
- if (copy_from_user(&r, arg, sizeof(struct rtentry)))
- return -EFAULT;
-@@ -595,6 +627,7 @@ struct notifier_block fib_netdev_notifie
-
- void __init ip_fib_init(void)
- {
-+ prepare_fib_tables();
- #ifndef CONFIG_IP_MULTIPLE_TABLES
- ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
- ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_hash.c linux-2.6.9-ve023stab030/net/ipv4/fib_hash.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_hash.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/fib_hash.c 2006-10-11 19:07:57.000000000 +0400
-@@ -35,6 +35,7 @@
- #include <linux/skbuff.h>
- #include <linux/netlink.h>
- #include <linux/init.h>
-+#include <linux/ve.h>
-
- #include <net/ip.h>
- #include <net/protocol.h>
-@@ -72,11 +73,6 @@ struct fn_zone {
- * can be cheaper than memory lookup, so that FZ_* macros are used.
- */
-
--struct fn_hash {
-- struct fn_zone *fn_zones[33];
-- struct fn_zone *fn_zone_list;
--};
--
- static inline u32 fn_hash(u32 key, struct fn_zone *fz)
- {
- u32 h = ntohl(key)>>(32 - fz->fz_order);
-@@ -655,7 +651,7 @@ fn_hash_delete(struct fib_table *tb, str
- return -ESRCH;
- }
-
--static int fn_flush_list(struct fn_zone *fz, int idx)
-+static int fn_flush_list(struct fn_zone *fz, int idx, int destroy)
- {
- struct hlist_head *head = &fz->fz_hash[idx];
- struct hlist_node *node, *n;
-@@ -670,7 +666,9 @@ static int fn_flush_list(struct fn_zone
- list_for_each_entry_safe(fa, fa_node, &f->fn_alias, fa_list) {
- struct fib_info *fi = fa->fa_info;
-
-- if (fi && (fi->fib_flags&RTNH_F_DEAD)) {
-+ if (fi == NULL)
-+ continue;
-+ if (destroy || (fi->fib_flags&RTNH_F_DEAD)) {
- write_lock_bh(&fib_hash_lock);
- list_del(&fa->fa_list);
- if (list_empty(&f->fn_alias)) {
-@@ -691,7 +689,7 @@ static int fn_flush_list(struct fn_zone
- return found;
- }
-
--static int fn_hash_flush(struct fib_table *tb)
-+static int __fn_hash_flush(struct fib_table *tb, int destroy)
- {
- struct fn_hash *table = (struct fn_hash *) tb->tb_data;
- struct fn_zone *fz;
-@@ -701,11 +699,97 @@ static int fn_hash_flush(struct fib_tabl
- int i;
-
- for (i = fz->fz_divisor - 1; i >= 0; i--)
-- found += fn_flush_list(fz, i);
-+ found += fn_flush_list(fz, i, destroy);
- }
- return found;
- }
-
-+static int fn_hash_flush(struct fib_table *tb)
-+{
-+ return __fn_hash_flush(tb, 0);
-+}
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static void fn_free_zones(struct fib_table *tb)
-+{
-+ struct fn_hash *table = (struct fn_hash *) tb->tb_data;
-+ struct fn_zone *fz;
-+
-+ while ((fz = table->fn_zone_list) != NULL) {
-+ table->fn_zone_list = fz->fz_next;
-+ fz_hash_free(fz->fz_hash, fz->fz_divisor);
-+ kfree(fz);
-+ }
-+}
-+
-+void fib_hash_destroy(struct fib_table *tb)
-+{
-+ __fn_hash_flush(tb, 1);
-+ fn_free_zones(tb);
-+ kfree(tb);
-+}
-+
-+/*
-+ * Initialization of virtualized networking subsystem.
-+ */
-+int init_ve_route(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_IP_MULTIPLE_TABLES
-+ if (fib_rules_create())
-+ return -ENOMEM;
-+ ve->_fib_tables[RT_TABLE_LOCAL] = fib_hash_init(RT_TABLE_LOCAL);
-+ if (!ve->_fib_tables[RT_TABLE_LOCAL])
-+ goto out_destroy;
-+ ve->_fib_tables[RT_TABLE_MAIN] = fib_hash_init(RT_TABLE_MAIN);
-+ if (!ve->_fib_tables[RT_TABLE_MAIN])
-+ goto out_destroy_local;
-+
-+ return 0;
-+
-+out_destroy_local:
-+ fib_hash_destroy(ve->_fib_tables[RT_TABLE_LOCAL]);
-+out_destroy:
-+ fib_rules_destroy();
-+ ve->_local_rule = NULL;
-+ return -ENOMEM;
-+#else
-+ ve->_local_table = fib_hash_init(RT_TABLE_LOCAL);
-+ if (!ve->_local_table)
-+ return -ENOMEM;
-+ ve->_main_table = fib_hash_init(RT_TABLE_MAIN);
-+ if (!ve->_main_table) {
-+ fib_hash_destroy(ve->_local_table);
-+ return -ENOMEM;
-+ }
-+ return 0;
-+#endif
-+}
-+
-+void fini_ve_route(struct ve_struct *ve)
-+{
-+#ifdef CONFIG_IP_MULTIPLE_TABLES
-+ int i;
-+ for (i=0; i<RT_TABLE_MAX+1; i++)
-+ {
-+ if (!ve->_fib_tables[i])
-+ continue;
-+ fib_hash_destroy(ve->_fib_tables[i]);
-+ }
-+ fib_rules_destroy();
-+ ve->_local_rule = NULL;
-+#else
-+ fib_hash_destroy(ve->_local_table);
-+ fib_hash_destroy(ve->_main_table);
-+#endif
-+ fib_hash_free(ve->_fib_info_hash, ve->_fib_hash_size);
-+ fib_hash_free(ve->_fib_info_laddrhash, ve->_fib_hash_size);
-+ ve->_fib_info_hash = ve->_fib_info_laddrhash = NULL;
-+}
-+
-+EXPORT_SYMBOL(init_ve_route);
-+EXPORT_SYMBOL(fini_ve_route);
-+#endif
-+
-
- static inline int
- fn_hash_dump_bucket(struct sk_buff *skb, struct netlink_callback *cb,
-@@ -823,7 +907,7 @@ static void rtmsg_fib(int event, struct
- netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
- }
-
--#ifdef CONFIG_IP_MULTIPLE_TABLES
-+#if defined(CONFIG_IP_MULTIPLE_TABLES) || defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
- struct fib_table * fib_hash_init(int id)
- #else
- struct fib_table * __init fib_hash_init(int id)
-@@ -1126,6 +1210,6 @@ int __init fib_proc_init(void)
-
- void __init fib_proc_exit(void)
- {
-- proc_net_remove("route");
-+ remove_proc_glob_entry("net/route", NULL);
- }
- #endif /* CONFIG_PROC_FS */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_lookup.h linux-2.6.9-ve023stab030/net/ipv4/fib_lookup.h
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_lookup.h 2004-10-19 01:53:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/fib_lookup.h 2006-10-11 19:07:57.000000000 +0400
-@@ -30,5 +30,6 @@ extern int fib_nh_match(struct rtmsg *r,
- extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
- u8 tb_id, u8 type, u8 scope, void *dst,
- int dst_len, u8 tos, struct fib_info *fi);
-+void fib_hash_free(struct hlist_head *hash, int bytes);
-
- #endif /* _FIB_LOOKUP_H */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_rules.c linux-2.6.9-ve023stab030/net/ipv4/fib_rules.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_rules.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/fib_rules.c 2006-10-11 19:07:57.000000000 +0400
-@@ -38,6 +38,7 @@
- #include <linux/proc_fs.h>
- #include <linux/skbuff.h>
- #include <linux/netlink.h>
-+#include <linux/rtnetlink.h>
- #include <linux/init.h>
-
- #include <net/ip.h>
-@@ -98,9 +99,93 @@ static struct fib_rule local_rule = {
- .r_action = RTN_UNICAST,
- };
-
--static struct fib_rule *fib_rules = &local_rule;
- static rwlock_t fib_rules_lock = RW_LOCK_UNLOCKED;
-
-+void __init prepare_fib_rules(void)
-+{
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ get_ve0()->_local_rule = &local_rule;
-+ get_ve0()->_fib_rules = &local_rule;
-+#endif
-+}
-+
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define local_rule (*(get_exec_env()->_local_rule))
-+#define fib_rules (get_exec_env()->_fib_rules)
-+#else
-+static struct fib_rule *fib_rules = &local_rule;
-+#endif
-+
-+#if defined(CONFIG_VE_CALLS) || defined(CONFIG_VE_CALLS_MODULE)
-+int fib_rules_create()
-+{
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ struct fib_rule *default_rule, *main_rule, *loc_rule;
-+
-+ default_rule = kmalloc(sizeof(struct fib_rule), GFP_KERNEL);
-+ if (default_rule == NULL)
-+ goto out_def;
-+ memset(default_rule, 0, sizeof(struct fib_rule));
-+ atomic_set(&default_rule->r_clntref, 1);
-+ default_rule->r_preference = 0x7FFF;
-+ default_rule->r_table = RT_TABLE_DEFAULT;
-+ default_rule->r_action = RTN_UNICAST;
-+
-+ main_rule = kmalloc(sizeof(struct fib_rule), GFP_KERNEL);
-+ if (main_rule == NULL)
-+ goto out_main;
-+ memset(main_rule, 0, sizeof(struct fib_rule));
-+ atomic_set(&main_rule->r_clntref, 1);
-+ main_rule->r_preference = 0x7FFE;
-+ main_rule->r_table = RT_TABLE_MAIN;
-+ main_rule->r_action = RTN_UNICAST;
-+ main_rule->r_next = default_rule;
-+
-+ loc_rule = kmalloc(sizeof(struct fib_rule), GFP_KERNEL);
-+ if (loc_rule == NULL)
-+ goto out_loc;
-+ memset(loc_rule, 0, sizeof(struct fib_rule));
-+ atomic_set(&loc_rule->r_clntref, 1);
-+ loc_rule->r_preference = 0;
-+ loc_rule->r_table = RT_TABLE_LOCAL;
-+ loc_rule->r_action = RTN_UNICAST;
-+ loc_rule->r_next = main_rule;
-+
-+ get_exec_env()->_local_rule = loc_rule;
-+ get_exec_env()->_fib_rules = loc_rule;
-+
-+ return 0;
-+
-+out_loc:
-+ kfree(main_rule);
-+out_main:
-+ kfree(default_rule);
-+out_def:
-+ return -1;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+void fib_rules_destroy()
-+{
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+ struct fib_rule *r;
-+
-+ rtnl_lock();
-+ write_lock_bh(&fib_rules_lock);
-+ while(fib_rules != NULL) {
-+ r = fib_rules;
-+ fib_rules = fib_rules->r_next;
-+ r->r_dead = 1;
-+ fib_rule_put(r);
-+ }
-+ write_unlock_bh(&fib_rules_lock);
-+ rtnl_unlock();
-+#endif
-+}
-+#endif
-+
- int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
- {
- struct rtattr **rta = arg;
-@@ -440,5 +525,6 @@ int inet_dump_rules(struct sk_buff *skb,
-
- void __init fib_rules_init(void)
- {
-+ prepare_fib_rules();
- register_netdevice_notifier(&fib_rules_notifier);
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_semantics.c linux-2.6.9-ve023stab030/net/ipv4/fib_semantics.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/fib_semantics.c 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/fib_semantics.c 2006-10-11 19:07:57.000000000 +0400
-@@ -32,6 +32,7 @@
- #include <linux/netdevice.h>
- #include <linux/if_arp.h>
- #include <linux/proc_fs.h>
-+#include <linux/ve.h>
- #include <linux/skbuff.h>
- #include <linux/netlink.h>
- #include <linux/init.h>
-@@ -48,10 +49,18 @@
- #define FSprintk(a...)
-
- static rwlock_t fib_info_lock = RW_LOCK_UNLOCKED;
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+#define fib_info_hash (get_exec_env()->_fib_info_hash)
-+#define fib_info_laddrhash (get_exec_env()->_fib_info_laddrhash)
-+#define fib_hash_size (get_exec_env()->_fib_hash_size)
-+#define fib_info_cnt (get_exec_env()->_fib_info_cnt)
-+#else
- static struct hlist_head *fib_info_hash;
- static struct hlist_head *fib_info_laddrhash;
- static unsigned int fib_hash_size;
- static unsigned int fib_info_cnt;
-+#endif
-+
-
- #define DEVINDEX_HASHBITS 8
- #define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
-@@ -232,13 +241,15 @@ static struct fib_info *fib_find_info(co
- return NULL;
- }
-
--static inline unsigned int fib_devindex_hashfn(unsigned int val)
-+static inline unsigned int fib_devindex_hashfn(unsigned int val,
-+ envid_t veid)
- {
- unsigned int mask = DEVINDEX_HASHSIZE - 1;
-
- return (val ^
- (val >> DEVINDEX_HASHBITS) ^
-- (val >> (DEVINDEX_HASHBITS * 2))) & mask;
-+ (val >> (DEVINDEX_HASHBITS * 2)) ^
-+ (veid ^ (veid >> 16))) & mask;
- }
-
- /* Check, that the gateway is already configured.
-@@ -254,7 +265,7 @@ int ip_fib_check_default(u32 gw, struct
-
- read_lock(&fib_info_lock);
-
-- hash = fib_devindex_hashfn(dev->ifindex);
-+ hash = fib_devindex_hashfn(dev->ifindex, VEID(dev->owner_env));
- head = &fib_info_devhash[hash];
- hlist_for_each_entry(nh, node, head, nh_hash) {
- if (nh->nh_dev == dev &&
-@@ -509,7 +520,7 @@ static struct hlist_head *fib_hash_alloc
- __get_free_pages(GFP_KERNEL, get_order(bytes));
- }
-
--static void fib_hash_free(struct hlist_head *hash, int bytes)
-+void fib_hash_free(struct hlist_head *hash, int bytes)
- {
- if (!hash)
- return;
-@@ -524,10 +535,13 @@ static void fib_hash_move(struct hlist_h
- struct hlist_head *new_laddrhash,
- unsigned int new_size)
- {
-+ struct hlist_head *old_info_hash, *old_laddrhash;
- unsigned int old_size = fib_hash_size;
-- unsigned int i;
-+ unsigned int i, bytes;
-
- write_lock(&fib_info_lock);
-+ old_info_hash = fib_info_hash;
-+ old_laddrhash = fib_info_laddrhash;
- fib_hash_size = new_size;
-
- for (i = 0; i < old_size; i++) {
-@@ -567,6 +581,10 @@ static void fib_hash_move(struct hlist_h
- fib_info_laddrhash = new_laddrhash;
-
- write_unlock(&fib_info_lock);
-+
-+ bytes = old_size * sizeof(struct hlist_head *);
-+ fib_hash_free(old_info_hash, bytes);
-+ fib_hash_free(old_laddrhash, bytes);
- }
-
- struct fib_info *
-@@ -743,7 +761,8 @@ link_it:
-
- if (!nh->nh_dev)
- continue;
-- hash = fib_devindex_hashfn(nh->nh_dev->ifindex);
-+ hash = fib_devindex_hashfn(nh->nh_dev->ifindex,
-+ VEID(nh->nh_dev->owner_env));
- head = &fib_info_devhash[hash];
- hlist_add_head(&nh->nh_hash, head);
- } endfor_nexthops(fi)
-@@ -1083,7 +1102,8 @@ int fib_sync_down(u32 local, struct net_
-
- if (dev) {
- struct fib_info *prev_fi = NULL;
-- unsigned int hash = fib_devindex_hashfn(dev->ifindex);
-+ unsigned int hash = fib_devindex_hashfn(dev->ifindex,
-+ VEID(dev->owner_env));
- struct hlist_head *head = &fib_info_devhash[hash];
- struct hlist_node *node;
- struct fib_nh *nh;
-@@ -1148,7 +1168,7 @@ int fib_sync_up(struct net_device *dev)
- return 0;
-
- prev_fi = NULL;
-- hash = fib_devindex_hashfn(dev->ifindex);
-+ hash = fib_devindex_hashfn(dev->ifindex, VEID(dev->owner_env));
- head = &fib_info_devhash[hash];
- ret = 0;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/igmp.c linux-2.6.9-ve023stab030/net/ipv4/igmp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/igmp.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/igmp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -680,15 +680,18 @@ static int igmp_send_report(struct in_de
- static void igmp_gq_timer_expire(unsigned long data)
- {
- struct in_device *in_dev = (struct in_device *)data;
-+ struct ve_struct *old_env = set_exec_env(in_dev->dev->owner_env);
-
- in_dev->mr_gq_running = 0;
- igmpv3_send_report(in_dev, NULL);
- __in_dev_put(in_dev);
-+ set_exec_env(old_env);
- }
-
- static void igmp_ifc_timer_expire(unsigned long data)
- {
- struct in_device *in_dev = (struct in_device *)data;
-+ struct ve_struct *old_env = set_exec_env(in_dev->dev->owner_env);
-
- igmpv3_send_cr(in_dev);
- if (in_dev->mr_ifc_count) {
-@@ -696,6 +699,7 @@ static void igmp_ifc_timer_expire(unsign
- igmp_ifc_start_timer(in_dev, IGMP_Unsolicited_Report_Interval);
- }
- __in_dev_put(in_dev);
-+ set_exec_env(old_env);
- }
-
- static void igmp_ifc_event(struct in_device *in_dev)
-@@ -712,6 +716,7 @@ static void igmp_timer_expire(unsigned l
- {
- struct ip_mc_list *im=(struct ip_mc_list *)data;
- struct in_device *in_dev = im->interface;
-+ struct ve_struct *old_env = set_exec_env(in_dev->dev->owner_env);
-
- spin_lock(&im->lock);
- im->tm_running=0;
-@@ -731,6 +736,7 @@ static void igmp_timer_expire(unsigned l
- igmp_send_report(in_dev, im, IGMPV3_HOST_MEMBERSHIP_REPORT);
-
- ip_ma_put(im);
-+ set_exec_env(old_env);
- }
-
- static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
-@@ -2143,6 +2149,8 @@ static inline struct ip_mc_list *igmp_mc
- state->dev;
- state->dev = state->dev->next) {
- struct in_device *in_dev;
-+ if (unlikely(!ve_accessible_strict(state->dev->owner_env, get_exec_env())))
-+ continue;
- in_dev = in_dev_get(state->dev);
- if (!in_dev)
- continue;
-@@ -2172,6 +2180,8 @@ static struct ip_mc_list *igmp_mc_get_ne
- state->in_dev = NULL;
- break;
- }
-+ if (unlikely(!ve_accessible_strict(state->dev->owner_env, get_exec_env())))
-+ continue;
- state->in_dev = in_dev_get(state->dev);
- if (!state->in_dev)
- continue;
-@@ -2302,10 +2312,13 @@ static inline struct ip_sf_list *igmp_mc
- struct ip_mc_list *im = NULL;
- struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
-
-- for (state->dev = dev_base, state->idev = NULL, state->im = NULL;
-+ for (state->dev = dev_base,
-+ state->idev = NULL, state->im = NULL;
- state->dev;
- state->dev = state->dev->next) {
- struct in_device *idev;
-+ if (unlikely(!ve_accessible_strict(state->dev->owner_env, get_exec_env())))
-+ continue;
- idev = in_dev_get(state->dev);
- if (unlikely(idev == NULL))
- continue;
-@@ -2345,6 +2358,8 @@ static struct ip_sf_list *igmp_mcf_get_n
- state->idev = NULL;
- goto out;
- }
-+ if (unlikely(!ve_accessible_strict(state->dev->owner_env, get_exec_env())))
-+ continue;
- state->idev = in_dev_get(state->dev);
- if (!state->idev)
- continue;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_forward.c linux-2.6.9-ve023stab030/net/ipv4/ip_forward.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_forward.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ip_forward.c 2006-10-11 19:07:57.000000000 +0400
-@@ -91,6 +91,23 @@ int ip_forward(struct sk_buff *skb)
- if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
- goto sr_failed;
-
-+ /*
-+ * We try to optimize forwarding of VE packets:
-+ * do not decrement TTL (and so save skb_cow)
-+ * during forwarding of outgoing pkts from VE.
-+ * For incoming pkts we still do ttl decr,
-+ * since such skb is not cloned and does not require
-+ * actual cow. So, there is at least one place
-+ * in pkts path with mandatory ttl decr, that is
-+ * sufficient to prevent routing loops.
-+ */
-+ if (
-+#ifdef CONFIG_IP_ROUTE_NAT
-+ (rt->rt_flags & RTCF_NAT) == 0 && /* no NAT mangling expected */
-+#endif /* and */
-+ (skb->dev->features & NETIF_F_VENET)) /* src is VENET device */
-+ goto no_ttl_decr;
-+
- /* We are about to mangle packet. Copy it! */
- if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev)+rt->u.dst.header_len))
- goto drop;
-@@ -99,6 +116,8 @@ int ip_forward(struct sk_buff *skb)
- /* Decrease ttl after skb cow done */
- ip_decrease_ttl(iph);
-
-+no_ttl_decr:
-+
- /*
- * We now generate an ICMP HOST REDIRECT giving the route
- * we calculated.
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_fragment.c linux-2.6.9-ve023stab030/net/ipv4/ip_fragment.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_fragment.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ip_fragment.c 2006-10-11 19:07:57.000000000 +0400
-@@ -42,6 +42,7 @@
- #include <linux/udp.h>
- #include <linux/inet.h>
- #include <linux/netfilter_ipv4.h>
-+#include <linux/ve_owner.h>
-
- /* NOTE. Logic of IP defragmentation is parallel to corresponding IPv6
- * code now. If you change something here, _PLEASE_ update ipv6/reassembly.c
-@@ -92,8 +93,12 @@ struct ipq {
- struct ipq **pprev;
- int iif;
- struct timeval stamp;
-+ struct ve_struct *owner_env;
- };
-
-+DCL_VE_OWNER_PROTO(IPQ, TAIL_SOFT, struct ipq, owner_env, inline, (always_inline))
-+DCL_VE_OWNER(IPQ, TAIL_SOFT, struct ipq, owner_env, inline, (always_inline))
-+
- /* Hash table. */
-
- #define IPQ_HASHSZ 64
-@@ -105,6 +110,20 @@ static u32 ipfrag_hash_rnd;
- static LIST_HEAD(ipq_lru_list);
- int ip_frag_nqueues = 0;
-
-+void prepare_ipq(void)
-+{
-+ struct ipq *qp;
-+ unsigned int hash;
-+
-+ write_lock(&ipfrag_lock);
-+ for (hash = 0; hash < IPQ_HASHSZ; hash++) {
-+ for(qp = ipq_hash[hash]; qp; qp = qp->next) {
-+ SET_VE_OWNER_IPQ(qp, get_ve0());
-+ }
-+ }
-+ write_unlock(&ipfrag_lock);
-+}
-+
- static __inline__ void __ipq_unlink(struct ipq *qp)
- {
- if(qp->next)
-@@ -188,7 +207,8 @@ static __inline__ void frag_free_queue(s
-
- static __inline__ struct ipq *frag_alloc_queue(void)
- {
-- struct ipq *qp = kmalloc(sizeof(struct ipq), GFP_ATOMIC);
-+ struct ipq *qp = kmalloc(sizeof(struct ipq) + sizeof(void *),
-+ GFP_ATOMIC);
-
- if(!qp)
- return NULL;
-@@ -281,6 +301,9 @@ static void ip_evictor(void)
- static void ip_expire(unsigned long arg)
- {
- struct ipq *qp = (struct ipq *) arg;
-+ struct ve_struct *envid;
-+
-+ envid = set_exec_env(VE_OWNER_IPQ(qp));
-
- spin_lock(&qp->lock);
-
-@@ -303,6 +326,8 @@ static void ip_expire(unsigned long arg)
- out:
- spin_unlock(&qp->lock);
- ipq_put(qp, NULL);
-+
-+ (void)set_exec_env(envid);
- }
-
- /* Creation primitives. */
-@@ -322,7 +347,8 @@ static struct ipq *ip_frag_intern(unsign
- qp->saddr == qp_in->saddr &&
- qp->daddr == qp_in->daddr &&
- qp->protocol == qp_in->protocol &&
-- qp->user == qp_in->user) {
-+ qp->user == qp_in->user &&
-+ qp->owner_env == get_exec_env()) {
- atomic_inc(&qp->refcnt);
- write_unlock(&ipfrag_lock);
- qp_in->last_in |= COMPLETE;
-@@ -374,6 +400,8 @@ static struct ipq *ip_frag_create(unsign
- qp->lock = SPIN_LOCK_UNLOCKED;
- atomic_set(&qp->refcnt, 1);
-
-+ SET_VE_OWNER_IPQ(qp, get_exec_env());
-+
- return ip_frag_intern(hash, qp);
-
- out_nomem:
-@@ -399,7 +427,8 @@ static inline struct ipq *ip_find(struct
- qp->saddr == saddr &&
- qp->daddr == daddr &&
- qp->protocol == protocol &&
-- qp->user == user) {
-+ qp->user == user &&
-+ qp->owner_env == get_exec_env()) {
- atomic_inc(&qp->refcnt);
- read_unlock(&ipfrag_lock);
- return qp;
-@@ -667,6 +696,9 @@ struct sk_buff *ip_defrag(struct sk_buff
- qp->meat == qp->len)
- ret = ip_frag_reasm(qp, dev);
-
-+ if (ret)
-+ SET_VE_OWNER_SKB(ret, VE_OWNER_SKB(skb));
-+
- spin_unlock(&qp->lock);
- ipq_put(qp, NULL);
- return ret;
-@@ -700,6 +732,48 @@ void ip_defrag_user_id_free(int user)
- }
- EXPORT_SYMBOL(ip_defrag_user_id_free);
-
-+#ifdef CONFIG_VE
-+/* XXX */
-+void ip_fragment_cleanup(struct ve_struct *envid)
-+{
-+ int i, progress;
-+
-+ /* All operations with fragment queues are performed from NET_RX/TX
-+ * soft interrupts or from timer context. --Den */
-+ local_bh_disable();
-+ do {
-+ progress = 0;
-+ for (i = 0; i < IPQ_HASHSZ; i++) {
-+ struct ipq *qp;
-+ if (ipq_hash[i] == NULL)
-+ continue;
-+inner_restart:
-+ read_lock(&ipfrag_lock);
-+ for (qp = ipq_hash[i]; qp; qp = qp->next) {
-+ if (!ve_accessible_strict(
-+ VE_OWNER_IPQ(qp),
-+ envid))
-+ continue;
-+ atomic_inc(&qp->refcnt);
-+ read_unlock(&ipfrag_lock);
-+
-+ spin_lock(&qp->lock);
-+ if (!(qp->last_in&COMPLETE))
-+ ipq_kill(qp);
-+ spin_unlock(&qp->lock);
-+
-+ ipq_put(qp, NULL);
-+ progress = 1;
-+ goto inner_restart;
-+ }
-+ read_unlock(&ipfrag_lock);
-+ }
-+ } while(progress);
-+ local_bh_enable();
-+}
-+EXPORT_SYMBOL(ip_fragment_cleanup);
-+#endif
-+
- void ipfrag_init(void)
- {
- ipfrag_hash_rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_output.c linux-2.6.9-ve023stab030/net/ipv4/ip_output.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ip_output.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ip_output.c 2006-10-11 19:07:58.000000000 +0400
-@@ -1267,13 +1267,14 @@ void ip_send_reply(struct sock *sk, stru
- char data[40];
- } replyopts;
- struct ipcm_cookie ipc;
-- u32 daddr;
-+ u32 saddr, daddr;
- struct rtable *rt = (struct rtable*)skb->dst;
-
- if (ip_options_echo(&replyopts.opt, skb))
- return;
-
-- daddr = ipc.addr = rt->rt_src;
-+ saddr = skb->nh.iph->daddr;
-+ daddr = ipc.addr = skb->nh.iph->saddr;
- ipc.opt = NULL;
-
- if (replyopts.opt.optlen) {
-@@ -1286,7 +1287,7 @@ void ip_send_reply(struct sock *sk, stru
- {
- struct flowi fl = { .nl_u = { .ip4_u =
- { .daddr = daddr,
-- .saddr = rt->rt_spec_dst,
-+ .saddr = saddr,
- .tos = RT_TOS(skb->nh.iph->tos) } },
- /* Not quite clean, but right. */
- .uli_u = { .ports =
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipmr.c linux-2.6.9-ve023stab030/net/ipv4/ipmr.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipmr.c 2004-10-19 01:54:08.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ipmr.c 2006-10-11 19:07:57.000000000 +0400
-@@ -828,7 +828,7 @@ static void mrtsock_destruct(struct sock
- {
- rtnl_lock();
- if (sk == mroute_socket) {
-- ipv4_devconf.mc_forwarding--;
-+ ve_ipv4_devconf.mc_forwarding--;
-
- write_lock_bh(&mrt_lock);
- mroute_socket=NULL;
-@@ -879,7 +879,7 @@ int ip_mroute_setsockopt(struct sock *sk
- mroute_socket=sk;
- write_unlock_bh(&mrt_lock);
-
-- ipv4_devconf.mc_forwarding++;
-+ ve_ipv4_devconf.mc_forwarding++;
- }
- rtnl_unlock();
- return ret;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipvs/ip_vs_conn.c linux-2.6.9-ve023stab030/net/ipv4/ipvs/ip_vs_conn.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipvs/ip_vs_conn.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ipvs/ip_vs_conn.c 2006-10-11 19:07:56.000000000 +0400
-@@ -859,7 +859,8 @@ int ip_vs_conn_init(void)
- /* Allocate ip_vs_conn slab cache */
- ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn",
- sizeof(struct ip_vs_conn), 0,
-- SLAB_HWCACHE_ALIGN, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN | SLAB_UBC,
-+ NULL, NULL);
- if (!ip_vs_conn_cachep) {
- vfree(ip_vs_conn_tab);
- return -ENOMEM;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipvs/ip_vs_core.c linux-2.6.9-ve023stab030/net/ipv4/ipvs/ip_vs_core.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/ipvs/ip_vs_core.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/ipvs/ip_vs_core.c 2006-10-11 19:07:57.000000000 +0400
-@@ -980,6 +980,10 @@ ip_vs_in(unsigned int hooknum, struct sk
- * Big tappo: only PACKET_HOST (neither loopback nor mcasts)
- * ... don't know why 1st test DOES NOT include 2nd (?)
- */
-+ /*
-+ * VZ: the question above is right.
-+ * The second test is superfluous.
-+ */
- if (unlikely(skb->pkt_type != PACKET_HOST
- || skb->dev == &loopback_dev || skb->sk)) {
- IP_VS_DBG(12, "packet type=%d proto=%d daddr=%d.%d.%d.%d ignored\n",
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_core.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_core.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_core.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_core.c 2006-10-11 19:07:59.000000000 +0400
-@@ -48,6 +48,7 @@
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
- #include <linux/netfilter_ipv4/ip_conntrack_core.h>
- #include <linux/netfilter_ipv4/listhelp.h>
-+#include <ub/ub_mem.h>
-
- #define IP_CONNTRACK_VERSION "2.1"
-
-@@ -64,10 +65,25 @@ DECLARE_RWLOCK(ip_conntrack_expect_tuple
- atomic_t ip_conntrack_count = ATOMIC_INIT(0);
- EXPORT_SYMBOL(ip_conntrack_count);
-
-+#ifdef CONFIG_VE_IPTABLES
-+#define ve_ip_conntrack_helpers \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_helpers)
-+#define ve_ip_conntrack_max \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_max)
-+#define ve_ip_conntrack_count \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_count)
-+#else
- void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack) = NULL;
- LIST_HEAD(ip_conntrack_expect_list);
- struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
- static LIST_HEAD(helpers);
-+struct list_head *ip_conntrack_hash;
-+#define ve_ip_conntrack_count ip_conntrack_count
-+#define ve_ip_conntrack_helpers helpers
-+#define ve_ip_conntrack_max ip_conntrack_max
-+#define ve_ip_conntrack_unconfirmed unconfirmed
-+#endif
-+
- unsigned int ip_conntrack_htable_size = 0;
- int ip_conntrack_max;
- struct list_head *ip_conntrack_hash;
-@@ -121,6 +137,28 @@ ip_ct_get_tuple(const struct iphdr *iph,
- return protocol->pkt_to_tuple(skb, dataoff, tuple);
- }
-
-+#ifdef CONFIG_VE_IPTABLES
-+/* this function gives us an ability to safely restore
-+ * connection in case of failure */
-+void ip_conntrack_hash_insert(struct ip_conntrack *ct)
-+{
-+ u_int32_t hash, repl_hash;
-+
-+ if (!ip_conntrack_hash_rnd_initted) {
-+ get_random_bytes(&ip_conntrack_hash_rnd, 4);
-+ ip_conntrack_hash_rnd_initted = 1;
-+ }
-+
-+ hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
-+ repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
-+ list_add(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list,
-+ &ve_ip_conntrack_hash[hash]);
-+ list_add(&ct->tuplehash[IP_CT_DIR_REPLY].list,
-+ &ve_ip_conntrack_hash[repl_hash]);
-+}
-+EXPORT_SYMBOL(ip_conntrack_hash_insert);
-+#endif
-+
- int
- ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
- const struct ip_conntrack_tuple *orig,
-@@ -170,7 +208,7 @@ __ip_ct_expect_find(const struct ip_conn
- {
- MUST_BE_READ_LOCKED(&ip_conntrack_lock);
- MUST_BE_READ_LOCKED(&ip_conntrack_expect_tuple_lock);
-- return LIST_FIND(&ip_conntrack_expect_list, expect_cmp,
-+ return LIST_FIND(&ve_ip_conntrack_expect_list, expect_cmp,
- struct ip_conntrack_expect *, tuple);
- }
-
-@@ -253,7 +291,7 @@ static void remove_expectations(struct i
- continue;
- }
-
-- IP_NF_ASSERT(list_inlist(&ip_conntrack_expect_list, exp));
-+ IP_NF_ASSERT(list_inlist(&ve_ip_conntrack_expect_list, exp));
- IP_NF_ASSERT(exp->expectant == ct);
-
- /* delete expectation from global and private lists */
-@@ -271,8 +309,10 @@ clean_from_lists(struct ip_conntrack *ct
-
- ho = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
- hr = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
-- LIST_DELETE(&ip_conntrack_hash[ho], &ct->tuplehash[IP_CT_DIR_ORIGINAL]);
-- LIST_DELETE(&ip_conntrack_hash[hr], &ct->tuplehash[IP_CT_DIR_REPLY]);
-+ LIST_DELETE(&VE_OWNER_CT(ct)->_ip_conntrack->_ip_conntrack_hash[ho],
-+ &ct->tuplehash[IP_CT_DIR_ORIGINAL]);
-+ LIST_DELETE(&VE_OWNER_CT(ct)->_ip_conntrack->_ip_conntrack_hash[hr],
-+ &ct->tuplehash[IP_CT_DIR_REPLY]);
-
- /* Destroy all un-established, pending expectations */
- remove_expectations(ct, 1);
-@@ -283,6 +323,11 @@ destroy_conntrack(struct nf_conntrack *n
- {
- struct ip_conntrack *ct = (struct ip_conntrack *)nfct, *master = NULL;
- struct ip_conntrack_protocol *proto;
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *old;
-+
-+ old = set_exec_env(VE_OWNER_CT(ct));
-+#endif
-
- DEBUGP("destroy_conntrack(%p)\n", ct);
- IP_NF_ASSERT(atomic_read(&nfct->use) == 0);
-@@ -295,8 +340,8 @@ destroy_conntrack(struct nf_conntrack *n
- if (proto && proto->destroy)
- proto->destroy(ct);
-
-- if (ip_conntrack_destroyed)
-- ip_conntrack_destroyed(ct);
-+ if (ve_ip_conntrack_destroyed)
-+ ve_ip_conntrack_destroyed(ct);
-
- WRITE_LOCK(&ip_conntrack_lock);
- /* Make sure don't leave any orphaned expectations lying around */
-@@ -320,8 +365,11 @@ destroy_conntrack(struct nf_conntrack *n
-
- DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct);
- kmem_cache_free(ip_conntrack_cachep, ct);
-- atomic_dec(&ip_conntrack_count);
-+ atomic_dec(&ve_ip_conntrack_count);
- CONNTRACK_STAT_INC(delete);
-+#ifdef CONFIG_VE_IPTABLES
-+ (void)set_exec_env(old);
-+#endif
- }
-
- static void death_by_timeout(unsigned long ul_conntrack)
-@@ -356,7 +404,7 @@ __ip_conntrack_find(const struct ip_conn
- unsigned int cpu = smp_processor_id();
-
- MUST_BE_READ_LOCKED(&ip_conntrack_lock);
-- list_for_each_entry(h, &ip_conntrack_hash[hash], list) {
-+ list_for_each_entry(h, &ve_ip_conntrack_hash[hash], list) {
- if (conntrack_tuple_cmp(h, tuple, ignored_conntrack)) {
- per_cpu(ip_conntrack_stat, cpu).found++;
- return h;
-@@ -417,17 +465,17 @@ __ip_conntrack_confirm(struct sk_buff *s
- /* See if there's one in the list already, including reverse:
- NAT could have grabbed it without realizing, since we're
- not in the hash. If there is, we lost race. */
-- if (!LIST_FIND(&ip_conntrack_hash[hash],
-+ if (!LIST_FIND(&ve_ip_conntrack_hash[hash],
- conntrack_tuple_cmp,
- struct ip_conntrack_tuple_hash *,
- &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, NULL)
-- && !LIST_FIND(&ip_conntrack_hash[repl_hash],
-+ && !LIST_FIND(&ve_ip_conntrack_hash[repl_hash],
- conntrack_tuple_cmp,
- struct ip_conntrack_tuple_hash *,
- &ct->tuplehash[IP_CT_DIR_REPLY].tuple, NULL)) {
-- list_prepend(&ip_conntrack_hash[hash],
-+ list_prepend(&ve_ip_conntrack_hash[hash],
- &ct->tuplehash[IP_CT_DIR_ORIGINAL]);
-- list_prepend(&ip_conntrack_hash[repl_hash],
-+ list_prepend(&ve_ip_conntrack_hash[repl_hash],
- &ct->tuplehash[IP_CT_DIR_REPLY]);
- /* Timer relative to confirmation time, not original
- setting time, otherwise we'd get timer wrap in
-@@ -500,11 +548,42 @@ static inline int helper_cmp(const struc
-
- struct ip_conntrack_helper *ip_ct_find_helper(const struct ip_conntrack_tuple *tuple)
- {
-- return LIST_FIND(&helpers, helper_cmp,
-+ return LIST_FIND(&ve_ip_conntrack_helpers, helper_cmp,
- struct ip_conntrack_helper *,
- tuple);
- }
-
-+struct ip_conntrack *
-+ip_conntrack_alloc(struct user_beancounter *ub)
-+{
-+ struct ip_conntrack *conntrack;
-+ struct user_beancounter *old_ub;
-+
-+ old_ub = set_exec_ub(ub);
-+ conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC);
-+ if (!conntrack) {
-+ DEBUGP("Can't allocate conntrack.\n");
-+ return ERR_PTR(-ENOMEM);
-+ }
-+ (void)set_exec_ub(old_ub);
-+
-+ memset(conntrack, 0, sizeof(*conntrack));
-+ atomic_set(&conntrack->ct_general.use, 1);
-+ conntrack->ct_general.destroy = destroy_conntrack;
-+
-+ /* Don't set timer yet: wait for confirmation */
-+ init_timer(&conntrack->timeout);
-+ conntrack->timeout.data = (unsigned long)conntrack;
-+ conntrack->timeout.function = death_by_timeout;
-+#ifdef CONFIG_VE_IPTABLES
-+ SET_VE_OWNER_CT(conntrack, get_exec_env());
-+#endif
-+
-+ INIT_LIST_HEAD(&conntrack->sibling_list);
-+ return conntrack;
-+}
-+EXPORT_SYMBOL(ip_conntrack_alloc);
-+
- /* Allocate a new conntrack: we return -ENOMEM if classification
- failed due to stress. Otherwise it really is unclassifiable. */
- static struct ip_conntrack_tuple_hash *
-@@ -516,6 +595,7 @@ init_conntrack(const struct ip_conntrack
- struct ip_conntrack_tuple repl_tuple;
- size_t hash;
- struct ip_conntrack_expect *expected;
-+ struct user_beancounter *ub;
-
- if (!ip_conntrack_hash_rnd_initted) {
- get_random_bytes(&ip_conntrack_hash_rnd, 4);
-@@ -524,14 +604,14 @@ init_conntrack(const struct ip_conntrack
-
- hash = hash_conntrack(tuple);
-
-- if (ip_conntrack_max
-- && atomic_read(&ip_conntrack_count) >= ip_conntrack_max) {
-+ if (ve_ip_conntrack_max
-+ && atomic_read(&ve_ip_conntrack_count) >= ve_ip_conntrack_max) {
- /* Try dropping from this hash chain. */
-- if (!early_drop(&ip_conntrack_hash[hash])) {
-+ if (!early_drop(&ve_ip_conntrack_hash[hash])) {
- if (net_ratelimit())
-- printk(KERN_WARNING
-- "ip_conntrack: table full, dropping"
-- " packet.\n");
-+ ve_printk(VE_LOG_BOTH, KERN_WARNING
-+ "ip_conntrack: VPS %d: table full, dropping"
-+ " packet.\n", VEID(get_exec_env()));
- return ERR_PTR(-ENOMEM);
- }
- }
-@@ -541,15 +621,19 @@ init_conntrack(const struct ip_conntrack
- return NULL;
- }
-
-- conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC);
-- if (!conntrack) {
-- DEBUGP("Can't allocate conntrack.\n");
-- return ERR_PTR(-ENOMEM);
-- }
-+#ifdef CONFIG_USER_RESOURCE
-+ if (skb->dev != NULL) /* received skb */
-+ ub = netdev_bc(skb->dev)->exec_ub;
-+ else if (skb->sk != NULL) /* sent skb */
-+ ub = sock_bc(skb->sk)->ub;
-+ else
-+#endif
-+ ub = NULL;
-+
-+ conntrack = ip_conntrack_alloc(ub);
-+ if (conntrack == NULL || IS_ERR(conntrack))
-+ return (struct ip_conntrack_tuple_hash *)conntrack;
-
-- memset(conntrack, 0, sizeof(*conntrack));
-- atomic_set(&conntrack->ct_general.use, 1);
-- conntrack->ct_general.destroy = destroy_conntrack;
- conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *tuple;
- conntrack->tuplehash[IP_CT_DIR_ORIGINAL].ctrack = conntrack;
- conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = repl_tuple;
-@@ -558,17 +642,11 @@ init_conntrack(const struct ip_conntrack
- kmem_cache_free(ip_conntrack_cachep, conntrack);
- return NULL;
- }
-- /* Don't set timer yet: wait for confirmation */
-- init_timer(&conntrack->timeout);
-- conntrack->timeout.data = (unsigned long)conntrack;
-- conntrack->timeout.function = death_by_timeout;
--
-- INIT_LIST_HEAD(&conntrack->sibling_list);
-
- WRITE_LOCK(&ip_conntrack_lock);
- /* Need finding and deleting of expected ONLY if we win race */
- READ_LOCK(&ip_conntrack_expect_tuple_lock);
-- expected = LIST_FIND(&ip_conntrack_expect_list, expect_cmp,
-+ expected = LIST_FIND(&ve_ip_conntrack_expect_list, expect_cmp,
- struct ip_conntrack_expect *, tuple);
- READ_UNLOCK(&ip_conntrack_expect_tuple_lock);
-
-@@ -595,12 +673,12 @@ init_conntrack(const struct ip_conntrack
- __set_bit(IPS_EXPECTED_BIT, &conntrack->status);
- conntrack->master = expected;
- expected->sibling = conntrack;
-- LIST_DELETE(&ip_conntrack_expect_list, expected);
-+ LIST_DELETE(&ve_ip_conntrack_expect_list, expected);
- expected->expectant->expecting--;
- nf_conntrack_get(&master_ct(conntrack)->ct_general);
-
- /* this is a braindead... --pablo */
-- atomic_inc(&ip_conntrack_count);
-+ atomic_inc(&ve_ip_conntrack_count);
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- if (expected->expectfn)
-@@ -615,7 +693,7 @@ init_conntrack(const struct ip_conntrack
- CONNTRACK_STAT_INC(new);
- }
-
--end: atomic_inc(&ip_conntrack_count);
-+end: atomic_inc(&ve_ip_conntrack_count);
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- ret: return &conntrack->tuplehash[IP_CT_DIR_ORIGINAL];
-@@ -845,7 +923,7 @@ ip_conntrack_expect_alloc(void)
- return new;
- }
-
--static void
-+void
- ip_conntrack_expect_insert(struct ip_conntrack_expect *new,
- struct ip_conntrack *related_to)
- {
-@@ -856,7 +934,7 @@ ip_conntrack_expect_insert(struct ip_con
- /* add to expected list for this connection */
- list_add_tail(&new->expected_list, &related_to->sibling_list);
- /* add to global list of expectations */
-- list_prepend(&ip_conntrack_expect_list, &new->list);
-+ list_prepend(&ve_ip_conntrack_expect_list, &new->list);
- /* add and start timer if required */
- if (related_to->helper->timeout) {
- init_timer(&new->timeout);
-@@ -868,6 +946,7 @@ ip_conntrack_expect_insert(struct ip_con
- }
- related_to->expecting++;
- }
-+EXPORT_SYMBOL(ip_conntrack_expect_insert);
-
- /* Add a related connection. */
- int ip_conntrack_expect_related(struct ip_conntrack_expect *expect,
-@@ -884,7 +963,7 @@ int ip_conntrack_expect_related(struct i
- DEBUGP("tuple: "); DUMP_TUPLE(&expect->tuple);
- DEBUGP("mask: "); DUMP_TUPLE(&expect->mask);
-
-- old = LIST_FIND(&ip_conntrack_expect_list, resent_expect,
-+ old = LIST_FIND(&ve_ip_conntrack_expect_list, resent_expect,
- struct ip_conntrack_expect *, &expect->tuple,
- &expect->mask);
- if (old) {
-@@ -951,7 +1030,7 @@ int ip_conntrack_expect_related(struct i
- */
- unexpect_related(old);
- ret = -EPERM;
-- } else if (LIST_FIND(&ip_conntrack_expect_list, expect_clash,
-+ } else if (LIST_FIND(&ve_ip_conntrack_expect_list, expect_clash,
- struct ip_conntrack_expect *, &expect->tuple,
- &expect->mask)) {
- WRITE_UNLOCK(&ip_conntrack_lock);
-@@ -987,7 +1066,7 @@ int ip_conntrack_change_expect(struct ip
- /* Never seen before */
- DEBUGP("change expect: never seen before\n");
- if (!ip_ct_tuple_equal(&expect->tuple, newtuple)
-- && LIST_FIND(&ip_conntrack_expect_list, expect_clash,
-+ && LIST_FIND(&ve_ip_conntrack_expect_list, expect_clash,
- struct ip_conntrack_expect *, newtuple, &expect->mask)) {
- /* Force NAT to find an unused tuple */
- ret = -1;
-@@ -1037,8 +1116,22 @@ int ip_conntrack_alter_reply(struct ip_c
-
- int ip_conntrack_helper_register(struct ip_conntrack_helper *me)
- {
-+ if (!ve_is_super(get_exec_env())) {
-+ struct ip_conntrack_helper *tmp;
-+ struct module *mod = me->me;
-+
-+ __module_get(mod);
-+ tmp = kmalloc(sizeof(struct ip_conntrack_helper), GFP_KERNEL);
-+ if (!tmp) {
-+ module_put(mod);
-+ return -ENOMEM;
-+ }
-+ memcpy(tmp, me, sizeof(struct ip_conntrack_helper));
-+ me = tmp;
-+ }
-+
- WRITE_LOCK(&ip_conntrack_lock);
-- list_prepend(&helpers, me);
-+ list_prepend(&ve_ip_conntrack_helpers, me);
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- return 0;
-@@ -1059,19 +1152,38 @@ static inline int unhelp(struct ip_connt
- void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
- {
- unsigned int i;
-+ struct ip_conntrack_helper *h;
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ READ_LOCK(&ip_conntrack_lock);
-+ list_for_each_entry(h, &ve_ip_conntrack_helpers, list) {
-+ if (h->name == me->name) {
-+ me = h;
-+ break;
-+ }
-+ }
-+ READ_UNLOCK(&ip_conntrack_lock);
-+ if (me != h)
-+ return;
-+ }
-
- /* Need write lock here, to delete helper. */
- WRITE_LOCK(&ip_conntrack_lock);
-- LIST_DELETE(&helpers, me);
-+ LIST_DELETE(&ve_ip_conntrack_helpers, me);
-
- /* Get rid of expecteds, set helpers to NULL. */
- for (i = 0; i < ip_conntrack_htable_size; i++)
-- LIST_FIND_W(&ip_conntrack_hash[i], unhelp,
-+ LIST_FIND_W(&ve_ip_conntrack_hash[i], unhelp,
- struct ip_conntrack_tuple_hash *, me);
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- /* Someone could be still looking at the helper in a bh. */
- synchronize_net();
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ module_put(me->me);
-+ kfree(me);
-+ }
- }
-
- static inline void ct_add_counters(struct ip_conntrack *ct,
-@@ -1186,7 +1298,7 @@ get_next_corpse(int (*kill)(const struct
-
- READ_LOCK(&ip_conntrack_lock);
- for (; !h && *bucket < ip_conntrack_htable_size; (*bucket)++) {
-- h = LIST_FIND(&ip_conntrack_hash[*bucket], do_kill,
-+ h = LIST_FIND(&ve_ip_conntrack_hash[*bucket], do_kill,
- struct ip_conntrack_tuple_hash *, kill, data);
- }
- if (h)
-@@ -1224,6 +1336,11 @@ getorigdst(struct sock *sk, int optval,
- struct ip_conntrack_tuple_hash *h;
- struct ip_conntrack_tuple tuple;
-
-+#ifdef CONFIG_VE_IPTABLES
-+ if (!get_exec_env()->_ip_conntrack)
-+ return -ENOPROTOOPT;
-+#endif
-+
- IP_CT_TUPLE_U_BLANK(&tuple);
- tuple.src.ip = inet->rcv_saddr;
- tuple.src.u.tcp.port = inet->sport;
-@@ -1252,6 +1369,7 @@ getorigdst(struct sock *sk, int optval,
- .tuple.dst.u.tcp.port;
- sin.sin_addr.s_addr = h->ctrack->tuplehash[IP_CT_DIR_ORIGINAL]
- .tuple.dst.ip;
-+ memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
-
- memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
-
-@@ -1281,11 +1399,17 @@ static int kill_all(const struct ip_conn
- return 1;
- }
-
-+static void ip_conntrack_cache_free(void)
-+{
-+ kmem_cache_destroy(ip_conntrack_expect_cachep);
-+ kmem_cache_destroy(ip_conntrack_cachep);
-+ nf_unregister_sockopt(&so_getorigdst);
-+}
-+
- /* Mishearing the voices in his head, our hero wonders how he's
- supposed to kill the mall. */
- void ip_conntrack_cleanup(void)
- {
-- ip_ct_attach = NULL;
- /* This makes sure all current packets have passed through
- netfilter framework. Roll on, two-stage module
- delete... */
-@@ -1293,23 +1417,32 @@ void ip_conntrack_cleanup(void)
-
- i_see_dead_people:
- ip_ct_selective_cleanup(kill_all, NULL);
-- if (atomic_read(&ip_conntrack_count) != 0) {
-+ if (atomic_read(&ve_ip_conntrack_count) != 0) {
- schedule();
- goto i_see_dead_people;
- }
-
-- kmem_cache_destroy(ip_conntrack_cachep);
-- kmem_cache_destroy(ip_conntrack_expect_cachep);
-- vfree(ip_conntrack_hash);
-- nf_unregister_sockopt(&so_getorigdst);
-+ if (ve_is_super(get_exec_env())) {
-+ ip_ct_attach = NULL;
-+ ip_conntrack_cache_free();
-+ }
-+ vfree(ve_ip_conntrack_hash);
-+ ve_ip_conntrack_hash = NULL;
-+ INIT_LIST_HEAD(&ve_ip_conntrack_expect_list);
-+ INIT_LIST_HEAD(&ve_ip_conntrack_helpers);
-+#ifdef CONFIG_VE_IPTABLES
-+ kfree(ve_ip_ct_protos);
-+ ve_ip_ct_protos = NULL;
-+ kfree(get_exec_env()->_ip_conntrack);
-+ get_exec_env()->_ip_conntrack = NULL;
-+#endif
- }
-
- static int hashsize;
- module_param(hashsize, int, 0400);
-
--int __init ip_conntrack_init(void)
-+static int ip_conntrack_cache_create(void)
- {
-- unsigned int i;
- int ret;
-
- /* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB
-@@ -1325,72 +1458,130 @@ int __init ip_conntrack_init(void)
- if (ip_conntrack_htable_size < 16)
- ip_conntrack_htable_size = 16;
- }
-- ip_conntrack_max = 8 * ip_conntrack_htable_size;
-+ ve_ip_conntrack_max = 8 * ip_conntrack_htable_size;
-
- printk("ip_conntrack version %s (%u buckets, %d max)"
- " - %Zd bytes per conntrack\n", IP_CONNTRACK_VERSION,
-- ip_conntrack_htable_size, ip_conntrack_max,
-+ ip_conntrack_htable_size, ve_ip_conntrack_max,
- sizeof(struct ip_conntrack));
-
- ret = nf_register_sockopt(&so_getorigdst);
- if (ret != 0) {
- printk(KERN_ERR "Unable to register netfilter socket option\n");
-- return ret;
-- }
--
-- ip_conntrack_hash = vmalloc(sizeof(struct list_head)
-- * ip_conntrack_htable_size);
-- if (!ip_conntrack_hash) {
-- printk(KERN_ERR "Unable to create ip_conntrack_hash\n");
-- goto err_unreg_sockopt;
-+ goto out_sockopt;
- }
-
-+ ret = -ENOMEM;
- ip_conntrack_cachep = kmem_cache_create("ip_conntrack",
- sizeof(struct ip_conntrack), 0,
-- SLAB_HWCACHE_ALIGN, NULL, NULL);
-+ SLAB_HWCACHE_ALIGN | SLAB_UBC,
-+ NULL, NULL);
- if (!ip_conntrack_cachep) {
- printk(KERN_ERR "Unable to create ip_conntrack slab cache\n");
-- goto err_free_hash;
-+ goto err_unreg_sockopt;
- }
-
- ip_conntrack_expect_cachep = kmem_cache_create("ip_conntrack_expect",
- sizeof(struct ip_conntrack_expect),
-- 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-+ 0, SLAB_HWCACHE_ALIGN | SLAB_UBC,
-+ NULL, NULL);
- if (!ip_conntrack_expect_cachep) {
- printk(KERN_ERR "Unable to create ip_expect slab cache\n");
- goto err_free_conntrack_slab;
- }
-
-+ return 0;
-+
-+err_free_conntrack_slab:
-+ kmem_cache_destroy(ip_conntrack_cachep);
-+err_unreg_sockopt:
-+ nf_unregister_sockopt(&so_getorigdst);
-+out_sockopt:
-+ return ret;
-+}
-+
-+int ip_conntrack_init(void)
-+{
-+ struct ve_struct *env;
-+ unsigned int i;
-+ int ret;
-+
-+ env = get_exec_env();
-+#ifdef CONFIG_VE_IPTABLES
-+ ret = -ENOMEM;
-+ env->_ip_conntrack =
-+ kmalloc(sizeof(struct ve_ip_conntrack), GFP_KERNEL);
-+ if (!env->_ip_conntrack)
-+ goto out;
-+ memset(env->_ip_conntrack, 0, sizeof(struct ve_ip_conntrack));
-+ if (ve_is_super(env)) {
-+ ret = ip_conntrack_cache_create();
-+ if (ret)
-+ goto cache_fail;
-+ } else
-+ ve_ip_conntrack_max = 8 * ip_conntrack_htable_size;
-+#else /* CONFIG_VE_IPTABLES */
-+ ret = ip_conntrack_cache_create();
-+ if (ret)
-+ goto out;
-+#endif
-+
-+ ret = -ENOMEM;
-+ ve_ip_conntrack_hash = vmalloc(sizeof(struct list_head)
-+ * ip_conntrack_htable_size);
-+ if (!ve_ip_conntrack_hash) {
-+ printk(KERN_ERR "Unable to create ip_conntrack_hash\n");
-+ goto err_free_cache;
-+ }
-+
-+#ifdef CONFIG_VE_IPTABLES
-+ ve_ip_ct_protos = (struct ip_conntrack_protocol **)
-+ ub_kmalloc(sizeof(void *)*MAX_IP_CT_PROTO, GFP_KERNEL);
-+ if (!ve_ip_ct_protos)
-+ goto err_free_hash;
-+#endif
- /* Don't NEED lock here, but good form anyway. */
- WRITE_LOCK(&ip_conntrack_lock);
- for (i = 0; i < MAX_IP_CT_PROTO; i++)
-- ip_ct_protos[i] = &ip_conntrack_generic_protocol;
-+ ve_ip_ct_protos[i] = &ip_conntrack_generic_protocol;
- /* Sew in builtin protocols. */
-- ip_ct_protos[IPPROTO_TCP] = &ip_conntrack_protocol_tcp;
-- ip_ct_protos[IPPROTO_UDP] = &ip_conntrack_protocol_udp;
-- ip_ct_protos[IPPROTO_ICMP] = &ip_conntrack_protocol_icmp;
-+ ve_ip_ct_protos[IPPROTO_TCP] = &ip_conntrack_protocol_tcp;
-+ ve_ip_ct_protos[IPPROTO_UDP] = &ip_conntrack_protocol_udp;
-+ ve_ip_ct_protos[IPPROTO_ICMP] = &ip_conntrack_protocol_icmp;
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- for (i = 0; i < ip_conntrack_htable_size; i++)
-- INIT_LIST_HEAD(&ip_conntrack_hash[i]);
-+ INIT_LIST_HEAD(&ve_ip_conntrack_hash[i]);
-
-- /* For use by ipt_REJECT */
-- ip_ct_attach = ip_conntrack_attach;
-+ INIT_LIST_HEAD(&ve_ip_conntrack_expect_list);
-+ INIT_LIST_HEAD(&ve_ip_conntrack_helpers);
-
-- /* Set up fake conntrack:
-- - to never be deleted, not in any hashes */
-- atomic_set(&ip_conntrack_untracked.ct_general.use, 1);
-- /* - and look it like as a confirmed connection */
-- set_bit(IPS_CONFIRMED_BIT, &ip_conntrack_untracked.status);
-+ if (ve_is_super(env)) {
-+ /* For use by ipt_REJECT */
-+ ip_ct_attach = ip_conntrack_attach;
-+
-+ /* Set up fake conntrack:
-+ - to never be deleted, not in any hashes */
-+ atomic_set(&ip_conntrack_untracked.ct_general.use, 1);
-+ /* - and look it like as a confirmed connection */
-+ set_bit(IPS_CONFIRMED_BIT, &ip_conntrack_untracked.status);
-+ }
-
-- return ret;
-+ return 0;
-
--err_free_conntrack_slab:
-- kmem_cache_destroy(ip_conntrack_cachep);
-+#ifdef CONFIG_VE_IPTABLES
- err_free_hash:
-- vfree(ip_conntrack_hash);
--err_unreg_sockopt:
-- nf_unregister_sockopt(&so_getorigdst);
--
-- return -ENOMEM;
-+#endif
-+ vfree(ve_ip_conntrack_hash);
-+ ve_ip_conntrack_hash = NULL;
-+err_free_cache:
-+ if (ve_is_super(env))
-+ ip_conntrack_cache_free();
-+#ifdef CONFIG_VE_IPTABLES
-+cache_fail:
-+ kfree(env->_ip_conntrack);
-+ env->_ip_conntrack = NULL;
-+#endif
-+out:
-+ return ret;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_ftp.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_ftp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_ftp.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_ftp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -15,6 +15,7 @@
- #include <linux/ctype.h>
- #include <net/checksum.h>
- #include <net/tcp.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/lockhelp.h>
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
-@@ -411,10 +412,10 @@ static int help(struct sk_buff *skb,
- static struct ip_conntrack_helper ftp[MAX_PORTS];
- static char ftp_names[MAX_PORTS][10];
-
--/* Not __exit: called from init() */
--static void fini(void)
-+void fini_iptable_ftp(void)
- {
- int i;
-+
- for (i = 0; i < ports_c; i++) {
- DEBUGP("ip_ct_ftp: unregistering helper for port %d\n",
- ports[i]);
-@@ -422,6 +423,31 @@ static void fini(void)
- }
- }
-
-+int init_iptable_ftp(void)
-+{
-+ int i, ret;
-+
-+ for (i = 0; i < ports_c; i++) {
-+ DEBUGP("ip_ct_ftp: registering helper for port %d\n",
-+ ports[i]);
-+ ret = ip_conntrack_helper_register(&ftp[i]);
-+ if (ret) {
-+ fini_iptable_ftp();
-+ return ret;
-+ }
-+ }
-+ return 0;
-+}
-+
-+/* Not __exit: called from init() */
-+static void fini(void)
-+{
-+ KSYMMODUNRESOLVE(ip_conntrack_ftp);
-+ KSYMUNRESOLVE(init_iptable_ftp);
-+ KSYMUNRESOLVE(fini_iptable_ftp);
-+ fini_iptable_ftp();
-+}
-+
- static int __init init(void)
- {
- int i, ret;
-@@ -447,16 +473,15 @@ static int __init init(void)
- else
- sprintf(tmpname, "ftp-%d", ports[i]);
- ftp[i].name = tmpname;
--
-- DEBUGP("ip_ct_ftp: registering helper for port %d\n",
-- ports[i]);
-- ret = ip_conntrack_helper_register(&ftp[i]);
--
-- if (ret) {
-- fini();
-- return ret;
-- }
- }
-+
-+ ret = init_iptable_ftp();
-+ if (ret)
-+ return ret;
-+
-+ KSYMRESOLVE(init_iptable_ftp);
-+ KSYMRESOLVE(fini_iptable_ftp);
-+ KSYMMODRESOLVE(ip_conntrack_ftp);
- return 0;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_irc.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_irc.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_irc.c 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_irc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -28,6 +28,7 @@
- #include <linux/ip.h>
- #include <net/checksum.h>
- #include <net/tcp.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/lockhelp.h>
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
-@@ -239,7 +240,33 @@ static int help(struct sk_buff *skb,
- static struct ip_conntrack_helper irc_helpers[MAX_PORTS];
- static char irc_names[MAX_PORTS][10];
-
--static void fini(void);
-+void fini_iptable_irc(void)
-+{
-+ int i;
-+
-+ for (i = 0; i < ports_c; i++) {
-+ DEBUGP("unregistering port %d\n",
-+ ports[i]);
-+ ip_conntrack_helper_unregister(&irc_helpers[i]);
-+ }
-+}
-+
-+int init_iptable_irc(void)
-+{
-+ int i, ret;
-+
-+ for (i = 0; i < ports_c; i++) {
-+ DEBUGP("port #%d: %d\n", i, ports[i]);
-+ ret = ip_conntrack_helper_register(&irc_helpers[i]);
-+ if (ret) {
-+ printk("ip_conntrack_irc: ERROR registering port %d\n",
-+ ports[i]);
-+ fini_iptable_irc();
-+ return ret;
-+ }
-+ }
-+ return 0;
-+}
-
- static int __init init(void)
- {
-@@ -278,18 +305,15 @@ static int __init init(void)
- else
- sprintf(tmpname, "irc-%d", i);
- hlpr->name = tmpname;
--
-- DEBUGP("port #%d: %d\n", i, ports[i]);
--
-- ret = ip_conntrack_helper_register(hlpr);
--
-- if (ret) {
-- printk("ip_conntrack_irc: ERROR registering port %d\n",
-- ports[i]);
-- fini();
-- return -EBUSY;
-- }
- }
-+
-+ ret = init_iptable_irc();
-+ if (ret)
-+ return ret;
-+
-+ KSYMRESOLVE(init_iptable_irc);
-+ KSYMRESOLVE(fini_iptable_irc);
-+ KSYMMODRESOLVE(ip_conntrack_irc);
- return 0;
- }
-
-@@ -297,12 +321,10 @@ static int __init init(void)
- * it is needed by the init function */
- static void fini(void)
- {
-- int i;
-- for (i = 0; i < ports_c; i++) {
-- DEBUGP("unregistering port %d\n",
-- ports[i]);
-- ip_conntrack_helper_unregister(&irc_helpers[i]);
-- }
-+ KSYMMODUNRESOLVE(ip_conntrack_irc);
-+ KSYMUNRESOLVE(init_iptable_irc);
-+ KSYMUNRESOLVE(fini_iptable_irc);
-+ fini_iptable_irc();
- }
-
- PROVIDES_CONNTRACK(irc);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_generic.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_generic.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_generic.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_generic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -52,7 +52,7 @@ static int packet(struct ip_conntrack *c
- const struct sk_buff *skb,
- enum ip_conntrack_info ctinfo)
- {
-- ip_ct_refresh_acct(conntrack, ctinfo, skb, ip_ct_generic_timeout);
-+ ip_ct_refresh_acct(conntrack, ctinfo, skb, ve_ip_ct_generic_timeout);
- return NF_ACCEPT;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_icmp.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_icmp.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_icmp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -102,7 +102,7 @@ static int icmp_packet(struct ip_conntra
- ct->timeout.function((unsigned long)ct);
- } else {
- atomic_inc(&ct->proto.icmp.count);
-- ip_ct_refresh_acct(ct, ctinfo, skb, ip_ct_icmp_timeout);
-+ ip_ct_refresh_acct(ct, ctinfo, skb, ve_ip_ct_icmp_timeout);
- }
-
- return NF_ACCEPT;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_tcp.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2004-10-19 01:55:29.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -100,7 +100,7 @@ unsigned long ip_ct_tcp_timeout_close =
- to ~13-30min depending on RTO. */
- unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS;
-
--static unsigned long * tcp_timeouts[]
-+unsigned long * tcp_timeouts[]
- = { NULL, /* TCP_CONNTRACK_NONE */
- &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */
- &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
-@@ -692,7 +692,7 @@ static int tcp_in_window(struct ip_ct_tc
- : "SEQ is under the lower bound (retransmitted already ACKed data)"
- : "SEQ is over the upper bound (over the window of the receiver)");
-
-- res = ip_ct_tcp_be_liberal && !tcph->rst;
-+ res = ve_ip_ct_tcp_be_liberal && !tcph->rst;
- }
-
- DEBUGP("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u "
-@@ -939,9 +939,11 @@ static int tcp_packet(struct ip_conntrac
- old_state, new_state);
-
- conntrack->proto.tcp.state = new_state;
-- timeout = conntrack->proto.tcp.retrans >= ip_ct_tcp_max_retrans
-- && *tcp_timeouts[new_state] > ip_ct_tcp_timeout_max_retrans
-- ? ip_ct_tcp_timeout_max_retrans : *tcp_timeouts[new_state];
-+ timeout = conntrack->proto.tcp.retrans >= ve_ip_ct_tcp_max_retrans &&
-+ ve_ip_ct_tcp_timeouts[new_state] >
-+ ve_ip_ct_tcp_timeout_max_retrans
-+ ? ve_ip_ct_tcp_timeout_max_retrans :
-+ ve_ip_ct_tcp_timeouts[new_state];
- WRITE_UNLOCK(&tcp_lock);
-
- if (!test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) {
-@@ -1011,7 +1013,7 @@ static int tcp_new(struct ip_conntrack *
- conntrack->proto.tcp.seen[1].flags = 0;
- conntrack->proto.tcp.seen[0].loose =
- conntrack->proto.tcp.seen[1].loose = 0;
-- } else if (ip_ct_tcp_loose == 0) {
-+ } else if (ve_ip_ct_tcp_loose == 0) {
- /* Don't try to pick up connections. */
- return 0;
- } else {
-@@ -1035,7 +1037,7 @@ static int tcp_new(struct ip_conntrack *
- conntrack->proto.tcp.seen[0].flags =
- conntrack->proto.tcp.seen[1].flags = IP_CT_TCP_FLAG_SACK_PERM;
- conntrack->proto.tcp.seen[0].loose =
-- conntrack->proto.tcp.seen[1].loose = ip_ct_tcp_loose;
-+ conntrack->proto.tcp.seen[1].loose = ve_ip_ct_tcp_loose;
- }
-
- conntrack->proto.tcp.seen[1].td_end = 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_udp.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_udp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -71,11 +71,11 @@ static int udp_packet(struct ip_conntrac
- stream. Extend timeout. */
- if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) {
- ip_ct_refresh_acct(conntrack, ctinfo, skb,
-- ip_ct_udp_timeout_stream);
-+ ve_ip_ct_udp_timeout_stream);
- /* Also, more likely to be important, and not a probe */
- set_bit(IPS_ASSURED_BIT, &conntrack->status);
- } else
-- ip_ct_refresh_acct(conntrack, ctinfo, skb, ip_ct_udp_timeout);
-+ ip_ct_refresh_acct(conntrack, ctinfo, skb, ve_ip_ct_udp_timeout);
-
- return NF_ACCEPT;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_standalone.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_standalone.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_conntrack_standalone.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_conntrack_standalone.c 2006-10-11 19:07:57.000000000 +0400
-@@ -27,6 +27,8 @@
- #endif
- #include <net/checksum.h>
- #include <net/ip.h>
-+#include <linux/nfcalls.h>
-+#include <linux/stringify.h>
-
- #define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_conntrack_lock)
- #define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_conntrack_lock)
-@@ -45,9 +47,31 @@
-
- MODULE_LICENSE("GPL");
-
-+int ip_conntrack_disable_ve0 = 0;
-+module_param(ip_conntrack_disable_ve0, int, 0440);
-+
- extern atomic_t ip_conntrack_count;
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ip_conntrack_count \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_count)
-+#else
-+#define ve_ip_conntrack_count ip_conntrack_count
-+#endif
- DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat);
-
-+/* Prior to 2.6.15, we had a ip_conntrack_enable_ve0 param. */
-+static int warn_set(const char *val, struct kernel_param *kp)
-+{
-+ printk(KERN_INFO __stringify(KBUILD_MODNAME)
-+ " : parameter ip_conntrack_enable_ve0 is obsoleted. In kernel"
-+ " >= 2.6.15 connection tracking on hardware node is enabled by "
-+ "default, use ip_conntrack_disable_ve0=1 parameter to "
-+ "disable.\n");
-+ return 0;
-+}
-+module_param_call(ip_conntrack_enable_ve0, warn_set, NULL, NULL, 0);
-+
- static int kill_proto(const struct ip_conntrack *i, void *data)
- {
- return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum ==
-@@ -80,7 +104,7 @@ static void *ct_seq_start(struct seq_fil
- {
- if (*pos >= ip_conntrack_htable_size)
- return NULL;
-- return &ip_conntrack_hash[*pos];
-+ return &ve_ip_conntrack_hash[*pos];
- }
-
- static void ct_seq_stop(struct seq_file *s, void *v)
-@@ -92,7 +116,7 @@ static void *ct_seq_next(struct seq_file
- (*pos)++;
- if (*pos >= ip_conntrack_htable_size)
- return NULL;
-- return &ip_conntrack_hash[*pos];
-+ return &ve_ip_conntrack_hash[*pos];
- }
-
- /* return 0 on success, 1 in case of error */
-@@ -189,7 +213,7 @@ static struct file_operations ct_file_op
- /* expects */
- static void *exp_seq_start(struct seq_file *s, loff_t *pos)
- {
-- struct list_head *e = &ip_conntrack_expect_list;
-+ struct list_head *e = &ve_ip_conntrack_expect_list;
- loff_t i;
-
- /* strange seq_file api calls stop even if we fail,
-@@ -202,7 +226,7 @@ static void *exp_seq_start(struct seq_fi
-
- for (i = 0; i <= *pos; i++) {
- e = e->next;
-- if (e == &ip_conntrack_expect_list)
-+ if (e == &ve_ip_conntrack_expect_list)
- return NULL;
- }
- return e;
-@@ -214,7 +238,7 @@ static void *exp_seq_next(struct seq_fil
-
- e = e->next;
-
-- if (e == &ip_conntrack_expect_list)
-+ if (e == &ve_ip_conntrack_expect_list)
- return NULL;
-
- return e;
-@@ -301,7 +325,7 @@ static void ct_cpu_seq_stop(struct seq_f
-
- static int ct_cpu_seq_show(struct seq_file *seq, void *v)
- {
-- unsigned int nr_conntracks = atomic_read(&ip_conntrack_count);
-+ unsigned int nr_conntracks = atomic_read(&ve_ip_conntrack_count);
- struct ip_conntrack_stat *st = v;
-
- if (v == SEQ_START_TOKEN) {
-@@ -483,6 +507,28 @@ static struct nf_hook_ops ip_conntrack_l
-
- /* From ip_conntrack_core.c */
- extern int ip_conntrack_max;
-+#ifdef CONFIG_VE_IPTABLES
-+#define ve_ip_conntrack_max \
-+ (get_exec_env()->_ip_conntrack->_ip_conntrack_max)
-+#define ve_ip_ct_sysctl_header \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_sysctl_header)
-+#define ve_ip_ct_net_table \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_net_table)
-+#define ve_ip_ct_ipv4_table \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_ipv4_table)
-+#define ve_ip_ct_netfilter_table \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_netfilter_table)
-+#define ve_ip_ct_sysctl_table \
-+ (get_exec_env()->_ip_conntrack->_ip_ct_sysctl_table)
-+#else
-+#define ve_ip_conntrack_max ip_conntrack_max
-+static struct ctl_table_header *ip_ct_sysctl_header;
-+#define ve_ip_ct_sysctl_header ip_ct_sysctl_header
-+#define ve_ip_ct_net_table ip_ct_net_table
-+#define ve_ip_ct_ipv4_table ip_ct_ipv4_table
-+#define ve_ip_ct_netfilter_table ip_ct_netfilter_table
-+#define ve_ip_ct_sysctl_table ip_ct_sysctl_table
-+#endif
- extern unsigned int ip_conntrack_htable_size;
-
- /* From ip_conntrack_proto_tcp.c */
-@@ -513,8 +559,6 @@ extern unsigned long ip_ct_generic_timeo
- static int log_invalid_proto_min = 0;
- static int log_invalid_proto_max = 255;
-
--static struct ctl_table_header *ip_ct_sysctl_header;
--
- static ctl_table ip_ct_sysctl_table[] = {
- {
- .ctl_name = NET_IPV4_NF_CONNTRACK_MAX,
-@@ -723,6 +767,112 @@ static ctl_table ip_ct_net_table[] = {
- };
-
- EXPORT_SYMBOL(ip_ct_log_invalid);
-+
-+#ifdef CONFIG_VE_IPTABLES
-+static void ip_conntrack_sysctl_cleanup(void)
-+{
-+ if (!ve_is_super(get_exec_env())) {
-+ kfree(ve_ip_ct_net_table);
-+ kfree(ve_ip_ct_ipv4_table);
-+ kfree(ve_ip_ct_netfilter_table);
-+ kfree(ve_ip_ct_sysctl_table);
-+ }
-+ ve_ip_ct_net_table = NULL;
-+ ve_ip_ct_ipv4_table = NULL;
-+ ve_ip_ct_netfilter_table = NULL;
-+ ve_ip_ct_sysctl_table = NULL;
-+}
-+
-+#define ALLOC_ENVCTL(field,k,label) \
-+ if ( !(field = kmalloc(k*sizeof(ctl_table), GFP_KERNEL)) ) \
-+ goto label;
-+static int ip_conntrack_sysctl_init(void)
-+{
-+ int i, ret = 0;
-+
-+ ret = -ENOMEM;
-+ if (ve_is_super(get_exec_env())) {
-+ ve_ip_ct_net_table = ip_ct_net_table;
-+ ve_ip_ct_ipv4_table = ip_ct_ipv4_table;
-+ ve_ip_ct_netfilter_table = ip_ct_netfilter_table;
-+ ve_ip_ct_sysctl_table = ip_ct_sysctl_table;
-+ } else {
-+ /* allocate structures in ve_struct */
-+ ALLOC_ENVCTL(ve_ip_ct_net_table, 2, out);
-+ ALLOC_ENVCTL(ve_ip_ct_ipv4_table, 2, nomem_1);
-+ ALLOC_ENVCTL(ve_ip_ct_netfilter_table, 3, nomem_2);
-+ ALLOC_ENVCTL(ve_ip_ct_sysctl_table, 21, nomem_3);
-+
-+ memcpy(ve_ip_ct_net_table, ip_ct_net_table,
-+ 2*sizeof(ctl_table));
-+ memcpy(ve_ip_ct_ipv4_table, ip_ct_ipv4_table,
-+ 2*sizeof(ctl_table));
-+ memcpy(ve_ip_ct_netfilter_table, ip_ct_netfilter_table,
-+ 3*sizeof(ctl_table));
-+ memcpy(ve_ip_ct_sysctl_table, ip_ct_sysctl_table,
-+ 21*sizeof(ctl_table));
-+
-+ ve_ip_ct_net_table[0].child = ve_ip_ct_ipv4_table;
-+ ve_ip_ct_ipv4_table[0].child = ve_ip_ct_netfilter_table;
-+ ve_ip_ct_netfilter_table[0].child = ve_ip_ct_sysctl_table;
-+ }
-+ ve_ip_ct_sysctl_table[0].data = &ve_ip_conntrack_max;
-+ ve_ip_ct_netfilter_table[1].data = &ve_ip_conntrack_max;
-+ ve_ip_ct_sysctl_table[1].data = &ve_ip_conntrack_count;
-+ /* skip ve_ip_ct_sysctl_table[2].data as it is read-only and common
-+ * for all environments */
-+ ve_ip_ct_tcp_timeouts[1] = ip_ct_tcp_timeout_syn_sent;
-+ ve_ip_ct_sysctl_table[3].data = &ve_ip_ct_tcp_timeouts[1];
-+ ve_ip_ct_tcp_timeouts[2] = ip_ct_tcp_timeout_syn_recv;
-+ ve_ip_ct_sysctl_table[4].data = &ve_ip_ct_tcp_timeouts[2];
-+ ve_ip_ct_tcp_timeouts[3] = ip_ct_tcp_timeout_established;
-+ ve_ip_ct_sysctl_table[5].data = &ve_ip_ct_tcp_timeouts[3];
-+ ve_ip_ct_tcp_timeouts[4] = ip_ct_tcp_timeout_fin_wait;
-+ ve_ip_ct_sysctl_table[6].data = &ve_ip_ct_tcp_timeouts[4];
-+ ve_ip_ct_tcp_timeouts[5] = ip_ct_tcp_timeout_close_wait;
-+ ve_ip_ct_sysctl_table[7].data = &ve_ip_ct_tcp_timeouts[5];
-+ ve_ip_ct_tcp_timeouts[6] = ip_ct_tcp_timeout_last_ack;
-+ ve_ip_ct_sysctl_table[8].data = &ve_ip_ct_tcp_timeouts[6];
-+ ve_ip_ct_tcp_timeouts[7] = ip_ct_tcp_timeout_time_wait;
-+ ve_ip_ct_sysctl_table[9].data = &ve_ip_ct_tcp_timeouts[7];
-+ ve_ip_ct_tcp_timeouts[8] = ip_ct_tcp_timeout_close;
-+ ve_ip_ct_sysctl_table[10].data = &ve_ip_ct_tcp_timeouts[8];
-+ ve_ip_ct_udp_timeout = ip_ct_udp_timeout;
-+ ve_ip_ct_sysctl_table[11].data = &ve_ip_ct_udp_timeout;
-+ ve_ip_ct_udp_timeout_stream = ip_ct_udp_timeout_stream;
-+ ve_ip_ct_sysctl_table[12].data = &ve_ip_ct_udp_timeout_stream;
-+ ve_ip_ct_icmp_timeout = ip_ct_icmp_timeout;
-+ ve_ip_ct_sysctl_table[13].data = &ve_ip_ct_icmp_timeout;
-+ ve_ip_ct_generic_timeout = ip_ct_generic_timeout;
-+ ve_ip_ct_sysctl_table[14].data = &ve_ip_ct_generic_timeout;
-+ ve_ip_ct_log_invalid = ip_ct_log_invalid;
-+ ve_ip_ct_sysctl_table[15].data = &ve_ip_ct_log_invalid;
-+ ve_ip_ct_tcp_timeout_max_retrans = ip_ct_tcp_timeout_max_retrans;
-+ ve_ip_ct_sysctl_table[16].data = &ve_ip_ct_tcp_timeout_max_retrans;
-+ ve_ip_ct_tcp_loose = ip_ct_tcp_loose;
-+ ve_ip_ct_sysctl_table[17].data = &ve_ip_ct_tcp_loose;
-+ ve_ip_ct_tcp_be_liberal = ip_ct_tcp_be_liberal;
-+ ve_ip_ct_sysctl_table[18].data = &ve_ip_ct_tcp_be_liberal;
-+ ve_ip_ct_tcp_max_retrans = ip_ct_tcp_max_retrans;
-+ ve_ip_ct_sysctl_table[19].data = &ve_ip_ct_tcp_max_retrans;
-+ for (i = 0; i < 20; i++)
-+ ve_ip_ct_sysctl_table[i].owner_env = get_exec_env();
-+ ve_ip_ct_netfilter_table[1].owner_env = get_exec_env();
-+ return 0;
-+
-+nomem_3:
-+ kfree(ve_ip_ct_netfilter_table);
-+ ve_ip_ct_netfilter_table = NULL;
-+nomem_2:
-+ kfree(ve_ip_ct_ipv4_table);
-+ ve_ip_ct_ipv4_table = NULL;
-+nomem_1:
-+ kfree(ve_ip_ct_net_table);
-+ ve_ip_ct_net_table = NULL;
-+out:
-+ return ret;
-+}
-+#endif /*CONFIG_VE*/
- #endif /* CONFIG_SYSCTL */
-
- static int init_or_cleanup(int init)
-@@ -734,92 +884,120 @@ static int init_or_cleanup(int init)
-
- if (!init) goto cleanup;
-
-+ ret = -ENOENT;
-+ if (!ve_is_super(get_exec_env()))
-+ __module_get(THIS_MODULE);
-+
- ret = ip_conntrack_init();
- if (ret < 0)
-- goto cleanup_nothing;
-+ goto cleanup_unget;
-+
-+ if (ve_is_super(get_exec_env()) && ip_conntrack_disable_ve0)
-+ return 0;
-
- #ifdef CONFIG_PROC_FS
-- proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops);
-+ ret = -ENOENT;
-+ proc = __proc_net_fops_create("net/ip_conntrack", 0440, &ct_file_ops,
-+ NULL);
- if (!proc) goto cleanup_init;
-
-- proc_exp = proc_net_fops_create("ip_conntrack_expect", 0440,
-- &exp_file_ops);
-+ proc_exp = __proc_net_fops_create("net/ip_conntrack_expect", 0440,
-+ &exp_file_ops, NULL);
- if (!proc_exp) goto cleanup_proc;
-
-- proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, proc_net_stat);
-- if (!proc_stat)
-- goto cleanup_proc_exp;
-+ if (ve_is_super(get_exec_env())) {
-+ proc_stat = create_proc_entry("net/stat/ip_conntrack", S_IRUGO,
-+ NULL);
-+ if (!proc_stat)
-+ goto cleanup_proc_exp;
-
-- proc_stat->proc_fops = &ct_cpu_seq_fops;
-- proc_stat->owner = THIS_MODULE;
-+ proc_stat->proc_fops = &ct_cpu_seq_fops;
-+ proc_stat->owner = THIS_MODULE;
-+ }
- #endif
-
-- ret = nf_register_hook(&ip_conntrack_defrag_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_defrag_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register pre-routing defrag hook.\n");
- goto cleanup_proc_stat;
- }
-- ret = nf_register_hook(&ip_conntrack_defrag_local_out_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_defrag_local_out_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register local_out defrag hook.\n");
- goto cleanup_defragops;
- }
-- ret = nf_register_hook(&ip_conntrack_in_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_in_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register pre-routing hook.\n");
- goto cleanup_defraglocalops;
- }
-- ret = nf_register_hook(&ip_conntrack_local_out_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_local_out_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register local out hook.\n");
- goto cleanup_inops;
- }
-- ret = nf_register_hook(&ip_conntrack_out_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_out_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register post-routing hook.\n");
- goto cleanup_inandlocalops;
- }
-- ret = nf_register_hook(&ip_conntrack_local_in_ops);
-+ ret = visible_nf_register_hook(&ip_conntrack_local_in_ops);
- if (ret < 0) {
- printk("ip_conntrack: can't register local in hook.\n");
- goto cleanup_inoutandlocalops;
- }
- #ifdef CONFIG_SYSCTL
-- ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0);
-- if (ip_ct_sysctl_header == NULL) {
-+#ifdef CONFIG_VE_IPTABLES
-+ ret = ip_conntrack_sysctl_init();
-+ if (ret < 0)
-+ goto cleanup_sysctl;
-+#endif
-+ ret = -ENOMEM;
-+ ve_ip_ct_sysctl_header = register_sysctl_table(ve_ip_ct_net_table, 0);
-+ if (ve_ip_ct_sysctl_header == NULL) {
- printk("ip_conntrack: can't register to sysctl.\n");
-- goto cleanup;
-+ goto cleanup_sysctl2;
- }
- #endif
-
-- return ret;
-+ return 0;
-
- cleanup:
-+ if (ve_is_super(get_exec_env()) && ip_conntrack_disable_ve0)
-+ goto cleanup_init;
- #ifdef CONFIG_SYSCTL
-- unregister_sysctl_table(ip_ct_sysctl_header);
-+ unregister_sysctl_table(ve_ip_ct_sysctl_header);
-+ cleanup_sysctl2:
-+#ifdef CONFIG_VE_IPTABLES
-+ ip_conntrack_sysctl_cleanup();
-+ cleanup_sysctl:
-+#endif
- #endif
-- nf_unregister_hook(&ip_conntrack_local_in_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_local_in_ops);
- cleanup_inoutandlocalops:
-- nf_unregister_hook(&ip_conntrack_out_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_out_ops);
- cleanup_inandlocalops:
-- nf_unregister_hook(&ip_conntrack_local_out_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_local_out_ops);
- cleanup_inops:
-- nf_unregister_hook(&ip_conntrack_in_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_in_ops);
- cleanup_defraglocalops:
-- nf_unregister_hook(&ip_conntrack_defrag_local_out_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_defrag_local_out_ops);
- cleanup_defragops:
-- nf_unregister_hook(&ip_conntrack_defrag_ops);
-+ visible_nf_unregister_hook(&ip_conntrack_defrag_ops);
- cleanup_proc_stat:
- #ifdef CONFIG_PROC_FS
-- remove_proc_entry("ip_conntrack", proc_net_stat);
-+ if (ve_is_super(get_exec_env()))
-+ remove_proc_entry("net/stat/ip_conntrack", NULL);
- cleanup_proc_exp:
-- proc_net_remove("ip_conntrack_expect");
-+ __proc_net_remove("net/ip_conntrack_expect");
- cleanup_proc:
-- proc_net_remove("ip_conntrack");
-- cleanup_init:
-+ __proc_net_remove("net/ip_conntrack");
- #endif /* CONFIG_PROC_FS */
-+ cleanup_init:
- ip_conntrack_cleanup();
-- cleanup_nothing:
-+ cleanup_unget:
-+ if (!ve_is_super(get_exec_env()))
-+ module_put(THIS_MODULE);
- return ret;
- }
-
-@@ -830,11 +1008,11 @@ int ip_conntrack_protocol_register(struc
- int ret = 0;
-
- WRITE_LOCK(&ip_conntrack_lock);
-- if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) {
-+ if (ve_ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) {
- ret = -EBUSY;
- goto out;
- }
-- ip_ct_protos[proto->proto] = proto;
-+ ve_ip_ct_protos[proto->proto] = proto;
- out:
- WRITE_UNLOCK(&ip_conntrack_lock);
- return ret;
-@@ -843,7 +1021,7 @@ int ip_conntrack_protocol_register(struc
- void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto)
- {
- WRITE_LOCK(&ip_conntrack_lock);
-- ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol;
-+ ve_ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol;
- WRITE_UNLOCK(&ip_conntrack_lock);
-
- /* Somebody could be still looking at the proto in bh. */
-@@ -853,17 +1031,39 @@ void ip_conntrack_protocol_unregister(st
- ip_ct_selective_cleanup(kill_proto, &proto->proto);
- }
-
--static int __init init(void)
-+int init_iptable_conntrack(void)
- {
- return init_or_cleanup(1);
- }
-
--static void __exit fini(void)
-+void fini_iptable_conntrack(void)
- {
- init_or_cleanup(0);
- }
-
--module_init(init);
-+static int __init init(void)
-+{
-+ int err;
-+
-+ err = init_iptable_conntrack();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_conntrack);
-+ KSYMRESOLVE(fini_iptable_conntrack);
-+ KSYMMODRESOLVE(ip_conntrack);
-+ return 0;
-+}
-+
-+static void __exit fini(void)
-+{
-+ KSYMMODUNRESOLVE(ip_conntrack);
-+ KSYMUNRESOLVE(init_iptable_conntrack);
-+ KSYMUNRESOLVE(fini_iptable_conntrack);
-+ fini_iptable_conntrack();
-+}
-+
-+subsys_initcall(init);
- module_exit(fini);
-
- /* Some modules need us, but don't depend directly on any symbol.
-@@ -872,17 +1072,22 @@ void need_ip_conntrack(void)
- {
- }
-
-+EXPORT_SYMBOL(ip_conntrack_disable_ve0);
- EXPORT_SYMBOL(ip_conntrack_protocol_register);
- EXPORT_SYMBOL(ip_conntrack_protocol_unregister);
- EXPORT_SYMBOL(invert_tuplepr);
- EXPORT_SYMBOL(ip_conntrack_alter_reply);
-+#ifndef CONFIG_VE_IPTABLES
- EXPORT_SYMBOL(ip_conntrack_destroyed);
-+#endif
- EXPORT_SYMBOL(need_ip_conntrack);
- EXPORT_SYMBOL(ip_conntrack_helper_register);
- EXPORT_SYMBOL(ip_conntrack_helper_unregister);
- EXPORT_SYMBOL(ip_ct_selective_cleanup);
- EXPORT_SYMBOL(ip_ct_refresh_acct);
-+#ifndef CONFIG_VE_IPTABLES
- EXPORT_SYMBOL(ip_ct_protos);
-+#endif
- EXPORT_SYMBOL(ip_ct_find_proto);
- EXPORT_SYMBOL(ip_ct_find_helper);
- EXPORT_SYMBOL(ip_conntrack_expect_alloc);
-@@ -894,9 +1099,11 @@ EXPORT_SYMBOL_GPL(ip_conntrack_expect_pu
- EXPORT_SYMBOL(ip_conntrack_tuple_taken);
- EXPORT_SYMBOL(ip_ct_gather_frags);
- EXPORT_SYMBOL(ip_conntrack_htable_size);
-+#ifndef CONFIG_VE_IPTABLES
- EXPORT_SYMBOL(ip_conntrack_expect_list);
--EXPORT_SYMBOL(ip_conntrack_lock);
- EXPORT_SYMBOL(ip_conntrack_hash);
-+#endif
-+EXPORT_SYMBOL(ip_conntrack_lock);
- EXPORT_SYMBOL(ip_conntrack_untracked);
- EXPORT_SYMBOL_GPL(ip_conntrack_find_get);
- EXPORT_SYMBOL_GPL(ip_conntrack_put);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_core.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_core.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_core.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_core.c 2006-10-11 19:07:59.000000000 +0400
-@@ -34,6 +34,8 @@
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
- #include <linux/netfilter_ipv4/listhelp.h>
-
-+#include <ub/ub_mem.h>
-+
- #if 0
- #define DEBUGP printk
- #else
-@@ -46,9 +48,20 @@ DECLARE_RWLOCK_EXTERN(ip_conntrack_lock)
- /* Calculated at init based on memory size */
- static unsigned int ip_nat_htable_size;
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_bysource \
-+ (get_exec_env()->_ip_conntrack->_ip_nat_bysource)
-+#define ve_byipsproto \
-+ (get_exec_env()->_ip_conntrack->_ip_nat_bysource + ip_nat_htable_size)
-+#else
- static struct list_head *bysource;
- static struct list_head *byipsproto;
-+#define ve_bysource bysource
-+#define ve_byipsproto byipsproto
-+
- struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO];
-+#endif
-
-
- /* We keep extra hashes for each conntrack, for fast searching. */
-@@ -173,7 +186,7 @@ find_appropriate_src(const struct ip_con
- struct ip_conntrack *ct;
-
- MUST_BE_READ_LOCKED(&ip_nat_lock);
-- list_for_each_entry(ct, &bysource[h], nat.info.bysource)
-+ list_for_each_entry(ct, &ve_bysource[h], nat.info.bysource)
- if (src_cmp(ct, tuple, mr))
- return &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src;
- return NULL;
-@@ -227,7 +240,7 @@ count_maps(u_int32_t src, u_int32_t dst,
-
- MUST_BE_READ_LOCKED(&ip_nat_lock);
- h = hash_by_ipsproto(src, dst, protonum);
-- list_for_each_entry(ct, &byipsproto[h], nat.info.byipsproto)
-+ list_for_each_entry(ct, &ve_byipsproto[h], nat.info.byipsproto)
- fake_cmp(ct, src, dst, protonum, &score, conntrack);
-
- return score;
-@@ -643,8 +656,8 @@ void replace_in_hashes(struct ip_conntra
- .tuple.dst.protonum);
-
- MUST_BE_WRITE_LOCKED(&ip_nat_lock);
-- list_move(&info->bysource, &bysource[srchash]);
-- list_move(&info->byipsproto, &byipsproto[ipsprotohash]);
-+ list_move(&info->bysource, &ve_bysource[srchash]);
-+ list_move(&info->byipsproto, &ve_byipsproto[ipsprotohash]);
- }
-
- void place_in_hashes(struct ip_conntrack *conntrack,
-@@ -666,8 +679,8 @@ void place_in_hashes(struct ip_conntrack
- .tuple.dst.protonum);
-
- MUST_BE_WRITE_LOCKED(&ip_nat_lock);
-- list_add(&info->bysource, &bysource[srchash]);
-- list_add(&info->byipsproto, &byipsproto[ipsprotohash]);
-+ list_add(&info->bysource, &ve_bysource[srchash]);
-+ list_add(&info->byipsproto, &ve_byipsproto[ipsprotohash]);
- }
-
- /* Returns true if succeeded. */
-@@ -937,43 +950,60 @@ icmp_reply_translation(struct sk_buff **
- return 0;
- }
-
--int __init ip_nat_init(void)
-+int ip_nat_init(void)
- {
-+ int ret;
- size_t i;
-
- /* Leave them the same for the moment. */
-- ip_nat_htable_size = ip_conntrack_htable_size;
-+ if (ve_is_super(get_exec_env()))
-+ ip_nat_htable_size = ip_conntrack_htable_size;
-
- /* One vmalloc for both hash tables */
-- bysource = vmalloc(sizeof(struct list_head) * ip_nat_htable_size*2);
-- if (!bysource) {
-- return -ENOMEM;
-- }
-- byipsproto = bysource + ip_nat_htable_size;
-+ ret = -ENOMEM;
-+ ve_bysource = ub_vmalloc(sizeof(struct list_head) * ip_nat_htable_size*2);
-+ if (!ve_bysource)
-+ goto err;
-+
-+#ifdef CONFIG_VE_IPTABLES
-+ ve_ip_nat_protos = (struct ip_nat_protocol **)
-+ ub_kmalloc(sizeof(void *)*MAX_IP_NAT_PROTO, GFP_KERNEL);
-+ if (!ve_ip_nat_protos)
-+ goto protos_fail;
-+#endif
-
-- /* Sew in builtin protocols. */
- WRITE_LOCK(&ip_nat_lock);
-+ init_ip_nat_helpers();
- for (i = 0; i < MAX_IP_NAT_PROTO; i++)
-- ip_nat_protos[i] = &ip_nat_unknown_protocol;
-- ip_nat_protos[IPPROTO_TCP] = &ip_nat_protocol_tcp;
-- ip_nat_protos[IPPROTO_UDP] = &ip_nat_protocol_udp;
-- ip_nat_protos[IPPROTO_ICMP] = &ip_nat_protocol_icmp;
-+ ve_ip_nat_protos[i] = &ip_nat_unknown_protocol;
-+ /* Sew in builtin protocols. */
-+ ve_ip_nat_protos[IPPROTO_TCP] = &ip_nat_protocol_tcp;
-+ ve_ip_nat_protos[IPPROTO_UDP] = &ip_nat_protocol_udp;
-+ ve_ip_nat_protos[IPPROTO_ICMP] = &ip_nat_protocol_icmp;
- WRITE_UNLOCK(&ip_nat_lock);
-
-+ if (ve_is_super(get_exec_env()))
-+ /* Initialize fake conntrack so that NAT will skip it */
-+ ip_conntrack_untracked.nat.info.initialized |=
-+ (1 << IP_NAT_MANIP_SRC) | (1 << IP_NAT_MANIP_DST);
-+
- for (i = 0; i < ip_nat_htable_size; i++) {
-- INIT_LIST_HEAD(&bysource[i]);
-- INIT_LIST_HEAD(&byipsproto[i]);
-+ INIT_LIST_HEAD(&ve_bysource[i]);
-+ INIT_LIST_HEAD(&ve_byipsproto[i]);
- }
-
- /* FIXME: Man, this is a hack. <SIGH> */
-- IP_NF_ASSERT(ip_conntrack_destroyed == NULL);
-- ip_conntrack_destroyed = &ip_nat_cleanup_conntrack;
-+ IP_NF_ASSERT(ve_ip_conntrack_destroyed == NULL);
-+ ve_ip_conntrack_destroyed = &ip_nat_cleanup_conntrack;
-
-- /* Initialize fake conntrack so that NAT will skip it */
-- ip_conntrack_untracked.nat.info.initialized |=
-- (1 << IP_NAT_MANIP_SRC) | (1 << IP_NAT_MANIP_DST);
--
- return 0;
-+
-+#ifdef CONFIG_VE_IPTABLES
-+protos_fail:
-+ vfree(ve_bysource);
-+#endif
-+err:
-+ return ret;
- }
-
- /* Clear NAT section of all conntracks, in case we're loaded again. */
-@@ -987,6 +1017,11 @@ static int clean_nat(const struct ip_con
- void ip_nat_cleanup(void)
- {
- ip_ct_selective_cleanup(&clean_nat, NULL);
-- ip_conntrack_destroyed = NULL;
-- vfree(bysource);
-+ ve_ip_conntrack_destroyed = NULL;
-+ vfree(ve_bysource);
-+ ve_bysource = NULL;
-+#ifdef CONFIG_VE_IPTABLES
-+ kfree(ve_ip_nat_protos);
-+ ve_ip_nat_protos = NULL;
-+#endif
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_ftp.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_ftp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_ftp.c 2004-10-19 01:54:38.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_ftp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -19,6 +19,7 @@
- #include <linux/netfilter_ipv4/ip_nat_rule.h>
- #include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
-+#include <linux/nfcalls.h>
-
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
-@@ -280,17 +281,42 @@ static unsigned int help(struct ip_connt
- static struct ip_nat_helper ftp[MAX_PORTS];
- static char ftp_names[MAX_PORTS][10];
-
--/* Not __exit: called from init() */
--static void fini(void)
-+void fini_iptable_nat_ftp(void)
- {
- int i;
-
- for (i = 0; i < ports_c; i++) {
- DEBUGP("ip_nat_ftp: unregistering port %d\n", ports[i]);
-- ip_nat_helper_unregister(&ftp[i]);
-+ visible_ip_nat_helper_unregister(&ftp[i]);
- }
- }
-
-+int init_iptable_nat_ftp(void)
-+{
-+ int i, ret = 0;
-+
-+ for (i = 0; i < ports_c; i++) {
-+ DEBUGP("ip_nat_ftp: Trying to register for port %d\n",
-+ ports[i]);
-+ ret = visible_ip_nat_helper_register(&ftp[i]);
-+ if (ret) {
-+ printk("ip_nat_ftp: error registering "
-+ "helper for port %d\n", ports[i]);
-+ fini_iptable_nat_ftp();
-+ return ret;
-+ }
-+ }
-+ return 0;
-+}
-+/* Not __exit: called from init() */
-+static void fini(void)
-+{
-+ KSYMMODUNRESOLVE(ip_nat_ftp);
-+ KSYMUNRESOLVE(init_iptable_nat_ftp);
-+ KSYMUNRESOLVE(fini_iptable_nat_ftp);
-+ fini_iptable_nat_ftp();
-+}
-+
- static int __init init(void)
- {
- int i, ret = 0;
-@@ -318,7 +344,7 @@ static int __init init(void)
-
- DEBUGP("ip_nat_ftp: Trying to register for port %d\n",
- ports[i]);
-- ret = ip_nat_helper_register(&ftp[i]);
-+ ret = visible_ip_nat_helper_register(&ftp[i]);
-
- if (ret) {
- printk("ip_nat_ftp: error registering "
-@@ -328,6 +354,9 @@ static int __init init(void)
- }
- }
-
-+ KSYMRESOLVE(init_iptable_nat_ftp);
-+ KSYMRESOLVE(fini_iptable_nat_ftp);
-+ KSYMMODRESOLVE(ip_nat_ftp);
- return ret;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_helper.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_helper.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_helper.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_helper.c 2006-10-11 19:07:59.000000000 +0400
-@@ -47,7 +47,13 @@
- #define DUMP_OFFSET(x)
- #endif
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_helpers (get_exec_env()->_ip_conntrack->_ip_nat_helpers)
-+#else
- static LIST_HEAD(helpers);
-+#define ve_helpers helpers
-+#endif
- DECLARE_LOCK(ip_nat_seqofs_lock);
-
- /* Setup TCP sequence correction given this change at this sequence */
-@@ -416,10 +422,10 @@ int ip_nat_helper_register(struct ip_nat
- int ret = 0;
-
- WRITE_LOCK(&ip_nat_lock);
-- if (LIST_FIND(&helpers, helper_cmp, struct ip_nat_helper *,&me->tuple))
-+ if (LIST_FIND(&ve_helpers, helper_cmp, struct ip_nat_helper *,&me->tuple))
- ret = -EBUSY;
- else
-- list_prepend(&helpers, me);
-+ list_prepend(&ve_helpers, me);
- WRITE_UNLOCK(&ip_nat_lock);
-
- return ret;
-@@ -428,7 +434,7 @@ int ip_nat_helper_register(struct ip_nat
- struct ip_nat_helper *
- __ip_nat_find_helper(const struct ip_conntrack_tuple *tuple)
- {
-- return LIST_FIND(&helpers, helper_cmp, struct ip_nat_helper *, tuple);
-+ return LIST_FIND(&ve_helpers, helper_cmp, struct ip_nat_helper *, tuple);
- }
-
- struct ip_nat_helper *
-@@ -446,21 +452,15 @@ ip_nat_find_helper(const struct ip_connt
- static int
- kill_helper(const struct ip_conntrack *i, void *helper)
- {
-- int ret;
--
-- READ_LOCK(&ip_nat_lock);
-- ret = (i->nat.info.helper == helper);
-- READ_UNLOCK(&ip_nat_lock);
--
-- return ret;
-+ return i->nat.info.helper == helper;
- }
-
- void ip_nat_helper_unregister(struct ip_nat_helper *me)
- {
- WRITE_LOCK(&ip_nat_lock);
- /* Autoloading conntrack helper might have failed */
-- if (LIST_FIND(&helpers, helper_cmp, struct ip_nat_helper *,&me->tuple)) {
-- LIST_DELETE(&helpers, me);
-+ if (LIST_FIND(&ve_helpers, helper_cmp, struct ip_nat_helper *,&me->tuple)) {
-+ LIST_DELETE(&ve_helpers, me);
- }
- WRITE_UNLOCK(&ip_nat_lock);
-
-@@ -476,3 +476,82 @@ void ip_nat_helper_unregister(struct ip_
- worse. --RR */
- ip_ct_selective_cleanup(kill_helper, me);
- }
-+
-+int visible_ip_nat_helper_register(struct ip_nat_helper *me)
-+{
-+ int ret;
-+ struct module *mod = me->me;
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ struct ip_nat_helper *tmp;
-+ __module_get(mod);
-+ ret = -ENOMEM;
-+ tmp = kmalloc(sizeof(struct ip_nat_helper), GFP_KERNEL);
-+ if (!tmp)
-+ goto nomem;
-+ memcpy(tmp, me, sizeof(struct ip_nat_helper));
-+ me = tmp;
-+ }
-+
-+ ret = ip_nat_helper_register(me);
-+ if (ret)
-+ goto out;
-+
-+ return 0;
-+out:
-+ if (!ve_is_super(get_exec_env())) {
-+ kfree(me);
-+nomem:
-+ module_put(mod);
-+ }
-+ return ret;
-+}
-+
-+void visible_ip_nat_helper_unregister(struct ip_nat_helper *me)
-+{
-+ struct ip_nat_helper *i;
-+
-+ READ_LOCK(&ip_nat_lock);
-+ list_for_each_entry(i, &ve_helpers, list) {
-+ if (i->name == me->name) {
-+ me = i;
-+ break;
-+ }
-+ }
-+ READ_UNLOCK(&ip_nat_lock);
-+ if (me != i)
-+ return;
-+
-+ ip_nat_helper_unregister(me);
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ module_put(me->me);
-+ kfree(me);
-+ }
-+}
-+
-+/* this function gives us an ability to safely restore
-+ * connection in case of failure */
-+int ip_nat_install_conntrack(struct ip_conntrack *conntrack, int helper)
-+{
-+ int ret = 0;
-+
-+ WRITE_LOCK(&ip_nat_lock);
-+ if (helper) {
-+ conntrack->nat.info.helper = LIST_FIND(&ve_helpers, helper_cmp,
-+ struct ip_nat_helper *,
-+ &conntrack->tuplehash[1].tuple);
-+ if (conntrack->nat.info.helper == NULL)
-+ ret = -EINVAL;
-+ }
-+ if (!ret)
-+ place_in_hashes(conntrack, &conntrack->nat.info);
-+ WRITE_UNLOCK(&ip_nat_lock);
-+ return ret;
-+}
-+EXPORT_SYMBOL(ip_nat_install_conntrack);
-+
-+void init_ip_nat_helpers(void)
-+{
-+ INIT_LIST_HEAD(&ve_helpers);
-+}
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_irc.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_irc.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_irc.c 2004-10-19 01:55:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_irc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -28,6 +28,7 @@
- #include <linux/netfilter_ipv4/ip_conntrack_irc.h>
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
- #include <linux/moduleparam.h>
-+#include <linux/nfcalls.h>
-
- #if 0
- #define DEBUGP printk
-@@ -200,19 +201,49 @@ static unsigned int help(struct ip_connt
- static struct ip_nat_helper ip_nat_irc_helpers[MAX_PORTS];
- static char irc_names[MAX_PORTS][10];
-
--/* This function is intentionally _NOT_ defined as __exit, because
-- * it is needed by init() */
--static void fini(void)
-+void fini_iptable_nat_irc(void)
- {
- int i;
-
- for (i = 0; i < ports_c; i++) {
- DEBUGP("ip_nat_irc: unregistering helper for port %d\n",
- ports[i]);
-- ip_nat_helper_unregister(&ip_nat_irc_helpers[i]);
-+ visible_ip_nat_helper_unregister(&ip_nat_irc_helpers[i]);
- }
- }
-
-+int init_iptable_nat_irc(void)
-+{
-+ int ret = 0;
-+ int i;
-+ struct ip_nat_helper *hlpr;
-+
-+ for (i = 0; i < ports_c; i++) {
-+ hlpr = &ip_nat_irc_helpers[i];
-+ DEBUGP
-+ ("ip_nat_irc: Trying to register helper for port %d: name %s\n",
-+ ports[i], hlpr->name);
-+ ret = visible_ip_nat_helper_register(hlpr);
-+ if (ret) {
-+ printk
-+ ("ip_nat_irc: error registering helper for port %d\n",
-+ ports[i]);
-+ fini_iptable_nat_irc();
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+/* This function is intentionally _NOT_ defined as __exit, because
-+ * it is needed by init() */
-+static void fini(void)
-+{
-+ KSYMMODUNRESOLVE(ip_nat_irc);
-+ KSYMUNRESOLVE(init_iptable_nat_irc);
-+ KSYMUNRESOLVE(fini_iptable_nat_irc);
-+ fini_iptable_nat_irc();
-+}
-+
- static int __init init(void)
- {
- int ret = 0;
-@@ -244,7 +275,7 @@ static int __init init(void)
- DEBUGP
- ("ip_nat_irc: Trying to register helper for port %d: name %s\n",
- ports[i], hlpr->name);
-- ret = ip_nat_helper_register(hlpr);
-+ ret = visible_ip_nat_helper_register(hlpr);
-
- if (ret) {
- printk
-@@ -254,6 +285,10 @@ static int __init init(void)
- return 1;
- }
- }
-+
-+ KSYMRESOLVE(init_iptable_nat_irc);
-+ KSYMRESOLVE(fini_iptable_nat_irc);
-+ KSYMMODRESOLVE(ip_nat_irc);
- return ret;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_rule.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_rule.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_rule.c 2004-10-19 01:53:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_rule.c 2006-10-11 19:08:01.000000000 +0400
-@@ -27,6 +27,8 @@
- #include <linux/netfilter_ipv4/ip_nat_rule.h>
- #include <linux/netfilter_ipv4/listhelp.h>
-
-+#include <ub/ub_mem.h>
-+
- #if 0
- #define DEBUGP printk
- #else
-@@ -35,6 +37,14 @@
-
- #define NAT_VALID_HOOKS ((1<<NF_IP_PRE_ROUTING) | (1<<NF_IP_POST_ROUTING) | (1<<NF_IP_LOCAL_OUT))
-
-+#ifdef CONFIG_VE_IPTABLES
-+#define ve_nat_table (get_exec_env()->_ip_conntrack->_ip_nat_table)
-+#define ve_initial_table (get_exec_env()->_ip_conntrack->_ip_nat_initial_table)
-+#else
-+#define ve_nat_table &nat_table
-+#define ve_initial_table &nat_initial_table
-+#endif
-+
- /* Standard entry. */
- struct ipt_standard
- {
-@@ -54,12 +64,12 @@ struct ipt_error
- struct ipt_error_target target;
- };
-
--static struct
-+static struct ipt_nat_initial_table
- {
- struct ipt_replace repl;
- struct ipt_standard entries[3];
- struct ipt_error term;
--} nat_initial_table __initdata
-+} nat_initial_table
- = { { "nat", NAT_VALID_HOOKS, 4,
- sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
- { [NF_IP_PRE_ROUTING] = 0,
-@@ -242,6 +252,93 @@ static int ipt_dnat_checkentry(const cha
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat_to_user(void *target, void **dstptr,
-+ int *size, int off)
-+{
-+ struct ipt_entry_target *pt;
-+ struct ip_nat_multi_range *pinfo;
-+ struct compat_ip_nat_multi_range info;
-+ u_int16_t tsize;
-+
-+ pt = (struct ipt_entry_target *)target;
-+ tsize = pt->u.user.target_size;
-+ if (__copy_to_user(*dstptr, pt, sizeof(struct ipt_entry_target)))
-+ return -EFAULT;
-+ pinfo = (struct ip_nat_multi_range *)pt->data;
-+ memset(&info, 0, sizeof(struct compat_ip_nat_multi_range));
-+ info.rangesize = pinfo->rangesize;
-+ info.range[0].flags = pinfo->range[0].flags;
-+ info.range[0].min_ip = pinfo->range[0].min_ip;
-+ info.range[0].max_ip = pinfo->range[0].max_ip;
-+ info.range[0].min = pinfo->range[0].min;
-+ info.range[0].max = pinfo->range[0].max;
-+ if (__copy_to_user(*dstptr + sizeof(struct ipt_entry_target),
-+ &info, sizeof(struct compat_ip_nat_multi_range)))
-+ return -EFAULT;
-+ tsize -= off;
-+ if (put_user(tsize, (u_int16_t *)*dstptr))
-+ return -EFAULT;
-+ *size -= off;
-+ *dstptr += tsize;
-+ return 0;
-+}
-+
-+static int compat_from_user(void *target, void **dstptr,
-+ int *size, int off)
-+{
-+ struct compat_ipt_entry_target *pt;
-+ struct ipt_entry_target *dstpt;
-+ struct compat_ip_nat_multi_range *pinfo;
-+ struct ip_nat_multi_range info;
-+ u_int16_t tsize;
-+
-+ pt = (struct compat_ipt_entry_target *)target;
-+ dstpt = (struct ipt_entry_target *)*dstptr;
-+ tsize = pt->u.user.target_size;
-+ memcpy(*dstptr, pt, sizeof(struct compat_ipt_entry_target));
-+ pinfo = (struct compat_ip_nat_multi_range *)pt->data;
-+ memset(&info, 0, sizeof(struct ip_nat_multi_range));
-+ info.rangesize = pinfo->rangesize;
-+ info.range[0].flags = pinfo->range[0].flags;
-+ info.range[0].min_ip = pinfo->range[0].min_ip;
-+ info.range[0].max_ip = pinfo->range[0].max_ip;
-+ info.range[0].min = pinfo->range[0].min;
-+ info.range[0].max = pinfo->range[0].max;
-+ memcpy(*dstptr + sizeof(struct compat_ipt_entry_target),
-+ &info, sizeof(struct ip_nat_multi_range));
-+ tsize += off;
-+ dstpt->u.user.target_size = tsize;
-+ *size += off;
-+ *dstptr += tsize;
-+ return 0;
-+}
-+
-+static int compat(void *target, void **dstptr, int *size, int convert)
-+{
-+ int ret, off;
-+
-+ off = IPT_ALIGN(sizeof(struct ip_nat_multi_range)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct compat_ip_nat_multi_range));
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ ret = compat_to_user(target, dstptr, size, off);
-+ break;
-+ case COMPAT_FROM_USER:
-+ ret = compat_from_user(target, dstptr, size, off);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ ret = 0;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+#endif
-+
- inline unsigned int
- alloc_null_binding(struct ip_conntrack *conntrack,
- struct ip_nat_info *info,
-@@ -272,7 +369,7 @@ int ip_nat_rule_find(struct sk_buff **ps
- {
- int ret;
-
-- ret = ipt_do_table(pskb, hooknum, in, out, &nat_table, NULL);
-+ ret = ipt_do_table(pskb, hooknum, in, out, ve_nat_table, NULL);
-
- if (ret == NF_ACCEPT) {
- if (!(info->initialized & (1 << HOOK2MANIP(hooknum))))
-@@ -286,42 +383,89 @@ static struct ipt_target ipt_snat_reg =
- .name = "SNAT",
- .target = ipt_snat_target,
- .checkentry = ipt_snat_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- };
-
- static struct ipt_target ipt_dnat_reg = {
- .name = "DNAT",
- .target = ipt_dnat_target,
- .checkentry = ipt_dnat_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- };
-
--int __init ip_nat_rule_init(void)
-+int ip_nat_rule_init(void)
- {
- int ret;
-
-- ret = ipt_register_table(&nat_table);
-+#ifdef CONFIG_VE_IPTABLES
-+ if (ve_is_super(get_exec_env())) {
-+ ve_nat_table = &nat_table;
-+ ve_initial_table = &nat_initial_table;
-+ } else {
-+ /* allocate structures in ve_struct */
-+ ret = -ENOMEM;
-+ ve_initial_table =
-+ ub_kmalloc(sizeof(nat_initial_table), GFP_KERNEL);
-+ if (!ve_initial_table)
-+ goto nomem_initial;
-+ ve_nat_table = ub_kmalloc(sizeof(nat_table), GFP_KERNEL);
-+ if (!ve_nat_table)
-+ goto nomem_table;
-+
-+ memcpy(ve_initial_table, &nat_initial_table,
-+ sizeof(nat_initial_table));
-+ memcpy(ve_nat_table, &nat_table,
-+ sizeof(nat_table));
-+ ve_nat_table->table = &ve_initial_table->repl;
-+ }
-+#endif
-+ ret = ipt_register_table(ve_nat_table);
- if (ret != 0)
-- return ret;
-- ret = ipt_register_target(&ipt_snat_reg);
-+ goto out;
-+ ret = visible_ipt_register_target(&ipt_snat_reg);
- if (ret != 0)
- goto unregister_table;
-
-- ret = ipt_register_target(&ipt_dnat_reg);
-+ ret = visible_ipt_register_target(&ipt_dnat_reg);
- if (ret != 0)
- goto unregister_snat;
-
- return ret;
-
-- unregister_snat:
-- ipt_unregister_target(&ipt_snat_reg);
-- unregister_table:
-- ipt_unregister_table(&nat_table);
--
-+unregister_snat:
-+ visible_ipt_unregister_target(&ipt_snat_reg);
-+unregister_table:
-+ ipt_unregister_table(ve_nat_table);
-+out:
-+#ifdef CONFIG_VE_IPTABLES
-+ if (!ve_is_super(get_exec_env()))
-+ kfree(ve_nat_table);
-+ ve_nat_table = NULL;
-+nomem_table:
-+ if (!ve_is_super(get_exec_env()))
-+ kfree(ve_initial_table);
-+ ve_initial_table = NULL;
-+nomem_initial:
-+#endif
- return ret;
- }
-
- void ip_nat_rule_cleanup(void)
- {
-- ipt_unregister_target(&ipt_dnat_reg);
-- ipt_unregister_target(&ipt_snat_reg);
-- ipt_unregister_table(&nat_table);
-+ ipt_unregister_table(ve_nat_table);
-+ visible_ipt_unregister_target(&ipt_dnat_reg);
-+ visible_ipt_unregister_target(&ipt_snat_reg);
-+
-+#ifdef CONFIG_VE
-+ if (!ve_is_super(get_exec_env())) {
-+ kfree(ve_initial_table);
-+ kfree(ve_nat_table);
-+ }
-+ ve_initial_table = NULL;
-+ ve_nat_table = NULL;
-+#endif
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_standalone.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_standalone.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_nat_standalone.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_nat_standalone.c 2006-10-11 19:07:57.000000000 +0400
-@@ -43,6 +43,8 @@
- #include <linux/netfilter_ipv4/ip_conntrack_core.h>
- #include <linux/netfilter_ipv4/listhelp.h>
-
-+#include <linux/nfcalls.h>
-+
- #if 0
- #define DEBUGP printk
- #else
-@@ -285,11 +287,11 @@ int ip_nat_protocol_register(struct ip_n
- int ret = 0;
-
- WRITE_LOCK(&ip_nat_lock);
-- if (ip_nat_protos[proto->protonum] != &ip_nat_unknown_protocol) {
-+ if (ve_ip_nat_protos[proto->protonum] != &ip_nat_unknown_protocol) {
- ret = -EBUSY;
- goto out;
- }
-- ip_nat_protos[proto->protonum] = proto;
-+ ve_ip_nat_protos[proto->protonum] = proto;
- out:
- WRITE_UNLOCK(&ip_nat_lock);
- return ret;
-@@ -299,7 +301,7 @@ int ip_nat_protocol_register(struct ip_n
- void ip_nat_protocol_unregister(struct ip_nat_protocol *proto)
- {
- WRITE_LOCK(&ip_nat_lock);
-- ip_nat_protos[proto->protonum] = &ip_nat_unknown_protocol;
-+ ve_ip_nat_protos[proto->protonum] = &ip_nat_unknown_protocol;
- WRITE_UNLOCK(&ip_nat_lock);
-
- /* Someone could be still looking at the proto in a bh. */
-@@ -312,6 +314,9 @@ static int init_or_cleanup(int init)
-
- need_ip_conntrack();
-
-+ if (!ve_is_super(get_exec_env()))
-+ __module_get(THIS_MODULE);
-+
- if (!init) goto cleanup;
-
- ret = ip_nat_rule_init();
-@@ -324,62 +329,95 @@ static int init_or_cleanup(int init)
- printk("ip_nat_init: can't setup rules.\n");
- goto cleanup_rule_init;
- }
-- ret = nf_register_hook(&ip_nat_in_ops);
-+
-+ if (ve_is_super(get_exec_env()) && ip_conntrack_disable_ve0)
-+ return 0;
-+
-+ ret = visible_nf_register_hook(&ip_nat_in_ops);
- if (ret < 0) {
- printk("ip_nat_init: can't register in hook.\n");
- goto cleanup_nat;
- }
-- ret = nf_register_hook(&ip_nat_out_ops);
-+ ret = visible_nf_register_hook(&ip_nat_out_ops);
- if (ret < 0) {
- printk("ip_nat_init: can't register out hook.\n");
- goto cleanup_inops;
- }
- #ifdef CONFIG_IP_NF_NAT_LOCAL
-- ret = nf_register_hook(&ip_nat_local_out_ops);
-+ ret = visible_nf_register_hook(&ip_nat_local_out_ops);
- if (ret < 0) {
- printk("ip_nat_init: can't register local out hook.\n");
- goto cleanup_outops;
- }
-- ret = nf_register_hook(&ip_nat_local_in_ops);
-+ ret = visible_nf_register_hook(&ip_nat_local_in_ops);
- if (ret < 0) {
- printk("ip_nat_init: can't register local in hook.\n");
- goto cleanup_localoutops;
- }
- #endif
-- return ret;
-+ return 0;
-
- cleanup:
-+ if (ve_is_super(get_exec_env()) && ip_conntrack_disable_ve0)
-+ goto cleanup_nat;
- #ifdef CONFIG_IP_NF_NAT_LOCAL
-- nf_unregister_hook(&ip_nat_local_in_ops);
-+ visible_nf_unregister_hook(&ip_nat_local_in_ops);
- cleanup_localoutops:
-- nf_unregister_hook(&ip_nat_local_out_ops);
-+ visible_nf_unregister_hook(&ip_nat_local_out_ops);
- cleanup_outops:
- #endif
-- nf_unregister_hook(&ip_nat_out_ops);
-+ visible_nf_unregister_hook(&ip_nat_out_ops);
- cleanup_inops:
-- nf_unregister_hook(&ip_nat_in_ops);
-+ visible_nf_unregister_hook(&ip_nat_in_ops);
- cleanup_nat:
- ip_nat_cleanup();
- cleanup_rule_init:
- ip_nat_rule_cleanup();
- cleanup_nothing:
-+ if (!ve_is_super(get_exec_env()))
-+ module_put(THIS_MODULE);
- MUST_BE_READ_WRITE_UNLOCKED(&ip_nat_lock);
- return ret;
- }
-
--static int __init init(void)
-+int init_iptable_nat(void)
- {
- return init_or_cleanup(1);
- }
-
--static void __exit fini(void)
-+void fini_iptable_nat(void)
- {
- init_or_cleanup(0);
- }
-
--module_init(init);
-+static int __init init(void)
-+{
-+ int err;
-+
-+ err = init_iptable_nat();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_nat);
-+ KSYMRESOLVE(fini_iptable_nat);
-+ KSYMMODRESOLVE(iptable_nat);
-+ return 0;
-+}
-+
-+static void __exit fini(void)
-+{
-+ KSYMMODUNRESOLVE(iptable_nat);
-+ KSYMUNRESOLVE(init_iptable_nat);
-+ KSYMUNRESOLVE(fini_iptable_nat);
-+ fini_iptable_nat();
-+}
-+
-+fs_initcall(init);
- module_exit(fini);
-
-+EXPORT_SYMBOL(visible_ip_nat_helper_register);
-+EXPORT_SYMBOL(visible_ip_nat_helper_unregister);
-+
- EXPORT_SYMBOL(ip_nat_setup_info);
- EXPORT_SYMBOL(ip_nat_protocol_register);
- EXPORT_SYMBOL(ip_nat_protocol_unregister);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_queue.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_queue.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_queue.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_queue.c 2006-10-11 19:07:57.000000000 +0400
-@@ -542,7 +542,14 @@ ipq_rcv_sk(struct sock *sk, int len)
- return;
-
- while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
-+#ifdef CONFIG_VE
-+ struct ve_struct *env;
-+ env = set_exec_env(VE_OWNER_SKB(skb));
-+#endif
- ipq_rcv_skb(skb);
-+#ifdef CONFIG_VE
-+ (void)set_exec_env(env);
-+#endif
- kfree_skb(skb);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_tables.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_tables.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ip_tables.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ip_tables.c 2006-10-11 19:08:01.000000000 +0400
-@@ -23,12 +23,20 @@
- #include <linux/udp.h>
- #include <linux/icmp.h>
- #include <net/ip.h>
-+#include <net/compat.h>
- #include <asm/uaccess.h>
- #include <asm/semaphore.h>
- #include <linux/proc_fs.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ip_tables.h>
-
-+#include <ub/ub_mem.h>
-+
-+#ifdef CONFIG_USER_RESOURCE
-+#include <ub/beancounter.h>
-+#endif
-+
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
- MODULE_DESCRIPTION("IPv4 packet filter");
-@@ -88,7 +96,7 @@ static DECLARE_MUTEX(ipt_mutex);
- struct ipt_table_info
- {
- /* Size per table */
-- unsigned int size;
-+ unsigned int size, alloc_size;
- /* Number of entries: FIXME. --RR */
- unsigned int number;
- /* Initial number of entries. Needed for module usage count */
-@@ -101,13 +109,59 @@ struct ipt_table_info
- /* ipt_entry tables: one per CPU */
- char entries[0] ____cacheline_aligned;
- #ifndef __GENKSYMS__
-- char *tblentries[NR_CPUS];
-+ unsigned char *tblentries[NR_CPUS];
- #endif
- };
-
- static LIST_HEAD(ipt_target);
- static LIST_HEAD(ipt_match);
- static LIST_HEAD(ipt_tables);
-+
-+#ifdef CONFIG_VE_IPTABLES
-+/* include ve.h and define get_exec_env */
-+#include <linux/sched.h>
-+
-+int init_iptables(void);
-+
-+#define ve_ipt_target (*(get_exec_env()->_ipt_target))
-+#define ve_ipt_match (*(get_exec_env()->_ipt_match))
-+#define ve_ipt_tables (*(get_exec_env()->_ipt_tables))
-+#define ve_ipt_standard_target (*(get_exec_env()->_ipt_standard_target))
-+#define ve_ipt_error_target (*(get_exec_env()->_ipt_error_target))
-+#define ve_tcp_matchstruct (*(get_exec_env()->_tcp_matchstruct))
-+#define ve_udp_matchstruct (*(get_exec_env()->_udp_matchstruct))
-+#define ve_icmp_matchstruct (*(get_exec_env()->_icmp_matchstruct))
-+
-+
-+#ifdef CONFIG_USER_RESOURCE
-+#define UB_NUMIPTENT 23
-+static int charge_iptables(struct user_beancounter *ub, unsigned long size)
-+{
-+ if (ub == NULL)
-+ return 0;
-+ return charge_beancounter(ub, UB_NUMIPTENT, size, 1);
-+}
-+static void uncharge_iptables(struct user_beancounter *ub, unsigned long size)
-+{
-+ if (ub == NULL)
-+ return;
-+ uncharge_beancounter(ub, UB_NUMIPTENT, size);
-+}
-+#endif /* CONFIG_USER_RESOURCE */
-+
-+#else /* CONFIG_VE_IPTABLES */
-+
-+#define ve_ipt_target ipt_target
-+#define ve_ipt_match ipt_match
-+#define ve_ipt_tables ipt_tables
-+#define ve_ipt_standard_target ipt_standard_target
-+#define ve_ipt_error_target ipt_error_target
-+#define ve_tcp_matchstruct tcp_matchstruct
-+#define ve_udp_matchstruct udp_matchstruct
-+#define ve_icmp_matchstruct icmp_matchstruct
-+
-+#endif /* CONFIG_VE_IPTABLES */
-+
- #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
-
- #if 0
-@@ -116,6 +170,8 @@ static LIST_HEAD(ipt_tables);
- #define up(x) do { printk("UP:%u:" #x "\n", __LINE__); up(x); } while(0)
- #endif
-
-+#define ipt_table_info_ub(info) (mem_ub(info))
-+
- /* Returns whether matches rule or not. */
- static inline int
- ip_packet_match(const struct iphdr *ip,
-@@ -303,7 +359,7 @@ ipt_do_table(struct sk_buff **pskb,
- do {
- IP_NF_ASSERT(e);
- IP_NF_ASSERT(back);
-- (*pskb)->nfcache |= e->nfcache;
-+ (*pskb)->nfcache |= e->nfcache & NFC_IPT_MASK;
- if (ip_packet_match(ip, indev, outdev, &e->ip, offset)) {
- struct ipt_entry_target *t;
-
-@@ -410,9 +466,9 @@ find_inlist_lock_noload(struct list_head
-
- #if 0
- duprintf("find_inlist: searching for `%s' in %s.\n",
-- name, head == &ipt_target ? "ipt_target"
-- : head == &ipt_match ? "ipt_match"
-- : head == &ipt_tables ? "ipt_tables" : "UNKNOWN");
-+ name, head == &ve_ipt_target ? "ipt_target"
-+ : head == &ve_ipt_match ? "ipt_match"
-+ : head == &ve_ipt_tables ? "ipt_tables" : "UNKNOWN");
- #endif
-
- *error = down_interruptible(mutex);
-@@ -453,19 +509,19 @@ find_inlist_lock(struct list_head *head,
- static inline struct ipt_table *
- ipt_find_table_lock(const char *name, int *error, struct semaphore *mutex)
- {
-- return find_inlist_lock(&ipt_tables, name, "iptable_", error, mutex);
-+ return find_inlist_lock(&ve_ipt_tables, name, "iptable_", error, mutex);
- }
-
- static inline struct ipt_match *
- find_match_lock(const char *name, int *error, struct semaphore *mutex)
- {
-- return find_inlist_lock(&ipt_match, name, "ipt_", error, mutex);
-+ return find_inlist_lock(&ve_ipt_match, name, "ipt_", error, mutex);
- }
-
- static struct ipt_target *
- ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex)
- {
-- return find_inlist_lock(&ipt_target, name, "ipt_", error, mutex);
-+ return find_inlist_lock(&ve_ipt_target, name, "ipt_", error, mutex);
- }
-
- /* All zeroes == unconditional rule. */
-@@ -487,7 +543,7 @@ static int
- mark_source_chains(struct ipt_table_info *newinfo, unsigned int valid_hooks)
- {
- unsigned int hook;
-- char *entry0 = newinfo->tblentries[0];
-+ unsigned char *entry0 = newinfo->tblentries[0];
-
- /* No recursion; use packet counter to save back ptrs (reset
- to 0 as we leave), and comefrom to save source hook bitmask */
-@@ -507,7 +563,7 @@ mark_source_chains(struct ipt_table_info
- = (void *)ipt_get_target(e);
-
- if (e->comefrom & (1 << NF_IP_NUMHOOKS)) {
-- printk("iptables: loop hook %u pos %u %08X.\n",
-+ ve_printk(VE_LOG, "iptables: loop hook %u pos %u %08X.\n",
- hook, pos, e->comefrom);
- return 0;
- }
-@@ -577,7 +633,6 @@ mark_source_chains(struct ipt_table_info
- }
- return 1;
- }
--
- static inline int
- cleanup_match(struct ipt_entry_match *m, unsigned int *i)
- {
-@@ -601,7 +656,7 @@ standard_check(const struct ipt_entry_ta
- if (t->u.target_size
- != IPT_ALIGN(sizeof(struct ipt_standard_target))) {
- duprintf("standard_check: target size %u != %u\n",
-- t->u.target_size,
-+ t->u.target_size, (unsigned int)
- IPT_ALIGN(sizeof(struct ipt_standard_target)));
- return 0;
- }
-@@ -625,6 +680,24 @@ static inline int
- check_match(struct ipt_entry_match *m,
- const char *name,
- const struct ipt_ip *ip,
-+ unsigned int hookmask)
-+{
-+ if (m->u.kernel.match->checkentry
-+ && !m->u.kernel.match->checkentry(name, ip, m->data,
-+ m->u.match_size - sizeof(*m),
-+ hookmask)) {
-+ duprintf("check_match: check failed for `%s'.\n",
-+ m->u.kernel.match->name);
-+ return -EINVAL;
-+ }
-+
-+ return 0;
-+}
-+
-+static inline int
-+find_check_match(struct ipt_entry_match *m,
-+ const char *name,
-+ const struct ipt_ip *ip,
- unsigned int hookmask,
- unsigned int *i)
- {
-@@ -633,7 +706,7 @@ check_match(struct ipt_entry_match *m,
-
- match = find_match_lock(m->u.user.name, &ret, &ipt_mutex);
- if (!match) {
-- duprintf("check_match: `%s' not found\n", m->u.user.name);
-+ duprintf("find_check_match: `%s' not found\n", m->u.user.name);
- return ret;
- }
- if (!try_module_get(match->me)) {
-@@ -643,24 +716,57 @@ check_match(struct ipt_entry_match *m,
- m->u.kernel.match = match;
- up(&ipt_mutex);
-
-- if (m->u.kernel.match->checkentry
-- && !m->u.kernel.match->checkentry(name, ip, m->data,
-- m->u.match_size - sizeof(*m),
-- hookmask)) {
-- module_put(m->u.kernel.match->me);
-- duprintf("ip_tables: check failed for `%s'.\n",
-- m->u.kernel.match->name);
-+ (*i)++;
-+ return check_match(m, name, ip, hookmask);
-+}
-+
-+static struct ipt_target ipt_standard_target;
-+
-+static inline int
-+check_target(struct ipt_entry *e, const char *name, unsigned int size)
-+{
-+ struct ipt_entry_target *t;
-+
-+ t = ipt_get_target(e);
-+ if (t->u.kernel.target == &ve_ipt_standard_target) {
-+ if (!standard_check(t, size))
-+ return -EINVAL;
-+ } else if (t->u.kernel.target->checkentry
-+ && !t->u.kernel.target->checkentry(name, e, t->data,
-+ t->u.target_size
-+ - sizeof(*t),
-+ e->comefrom)) {
-+ duprintf("check_target: check failed for `%s'.\n",
-+ t->u.kernel.target->name);
- return -EINVAL;
- }
-
-- (*i)++;
- return 0;
- }
-
--static struct ipt_target ipt_standard_target;
-+static inline int
-+check_entry(struct ipt_entry *e, const char *name)
-+{
-+ struct ipt_entry_target *t;
-+
-+ if (!ip_checkentry(&e->ip)) {
-+ duprintf("check_entry: ip check failed %p %s.\n", e, name);
-+ return -EINVAL;
-+ }
-+
-+ if (e->target_offset + sizeof(struct ipt_entry_target) >
-+ e->next_offset)
-+ return -EINVAL;
-+
-+ t = ipt_get_target(e);
-+ if (e->target_offset + t->u.target_size > e->next_offset)
-+ return -EINVAL;
-+
-+ return 0;
-+}
-
- static inline int
--check_entry(struct ipt_entry *e, const char *name, unsigned int size,
-+find_check_entry(struct ipt_entry *e, const char *name, unsigned int size,
- unsigned int *i)
- {
- struct ipt_entry_target *t;
-@@ -668,20 +774,22 @@ check_entry(struct ipt_entry *e, const c
- int ret;
- unsigned int j;
-
-- if (!ip_checkentry(&e->ip)) {
-- duprintf("ip_tables: ip check failed %p %s.\n", e, name);
-- return -EINVAL;
-- }
-+ ret = check_entry(e, name);
-+ if (ret != 0)
-+ return ret;
-
- j = 0;
-- ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, e->comefrom, &j);
-+ ret = IPT_MATCH_ITERATE(e, find_check_match, name, &e->ip, e->comefrom, &j);
- if (ret != 0)
- goto cleanup_matches;
-
- t = ipt_get_target(e);
-+ ret = -EINVAL;
-+ if (e->target_offset + t->u.target_size > e->next_offset)
-+ goto cleanup_matches;
- target = ipt_find_target_lock(t->u.user.name, &ret, &ipt_mutex);
- if (!target) {
-- duprintf("check_entry: `%s' not found\n", t->u.user.name);
-+ duprintf("find_check_entry: `%s' not found\n", t->u.user.name);
- goto cleanup_matches;
- }
- if (!try_module_get(target->me)) {
-@@ -692,26 +800,14 @@ check_entry(struct ipt_entry *e, const c
- t->u.kernel.target = target;
- up(&ipt_mutex);
-
-- if (t->u.kernel.target == &ipt_standard_target) {
-- if (!standard_check(t, size)) {
-- ret = -EINVAL;
-- goto cleanup_matches;
-- }
-- } else if (t->u.kernel.target->checkentry
-- && !t->u.kernel.target->checkentry(name, e, t->data,
-- t->u.target_size
-- - sizeof(*t),
-- e->comefrom)) {
-- module_put(t->u.kernel.target->me);
-- duprintf("ip_tables: check failed for `%s'.\n",
-- t->u.kernel.target->name);
-- ret = -EINVAL;
-- goto cleanup_matches;
-- }
--
-+ ret = check_target(e, name, size);
-+ if (ret)
-+ goto put_target;
- (*i)++;
- return 0;
-
-+ put_target:
-+ module_put(target->me);
- cleanup_matches:
- IPT_MATCH_ITERATE(e, cleanup_match, &j);
- return ret;
-@@ -791,7 +887,7 @@ translate_table(const char *name,
- {
- unsigned int i;
- int ret;
-- char *entry0 = newinfo->tblentries[0];
-+ unsigned char *entry0 = newinfo->tblentries[0];
-
- newinfo->size = size;
- newinfo->number = number;
-@@ -837,19 +933,16 @@ translate_table(const char *name,
- }
- }
-
-- if (!mark_source_chains(newinfo, valid_hooks))
-- return -ELOOP;
--
- /* Finally, each sanity check must pass */
- i = 0;
- ret = IPT_ENTRY_ITERATE(entry0, newinfo->size,
-- check_entry, name, size, &i);
-+ find_check_entry, name, size, &i);
-+ if (ret != 0)
-+ goto cleanup;
-
-- if (ret != 0) {
-- IPT_ENTRY_ITERATE(entry0, newinfo->size,
-- cleanup_entry, &i);
-- return ret;
-- }
-+ ret = -ELOOP;
-+ if (!mark_source_chains(newinfo, valid_hooks))
-+ goto cleanup;
-
- /* And one copy for every other CPU */
- for_each_cpu(i) {
-@@ -857,9 +950,74 @@ translate_table(const char *name,
- memcpy(newinfo->tblentries[i], entry0, newinfo->size);
- }
-
-+ return 0;
-+
-+cleanup:
-+ IPT_ENTRY_ITERATE(entry0, newinfo->size,
-+ cleanup_entry, &i);
- return ret;
- }
-
-+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_USER_RESOURCE)
-+static int charge_replace_table(struct ipt_table_info *oldinfo,
-+ struct ipt_table_info *newinfo)
-+{
-+ struct user_beancounter *old_ub, *new_ub;
-+ int old_number, new_number;
-+
-+ old_ub = ipt_table_info_ub(oldinfo);
-+ new_ub = ipt_table_info_ub(newinfo);
-+ old_number = oldinfo->number;
-+ new_number = newinfo->number;
-+
-+ /* XXX: I don't understand the code below and am not sure that it does
-+ * something reasonable. 2002/04/26 SAW */
-+ if (old_ub == new_ub) {
-+ int charge;
-+ /* charge only differences in entries */
-+ charge = new_number - old_number;
-+ if (charge > 0) {
-+ if (charge_iptables(old_ub, charge))
-+ return -1;
-+ } else
-+ uncharge_iptables(old_ub, -charge);
-+ } else {
-+ /* different contexts; do charge current and uncharge old */
-+ if (charge_iptables(new_ub, new_number))
-+ return -1;
-+ uncharge_iptables(old_ub, old_number);
-+ }
-+ return 0;
-+}
-+#endif
-+
-+static int setup_table(struct ipt_table *table, struct ipt_table_info *info)
-+{
-+#ifdef CONFIG_NETFILTER_DEBUG
-+ {
-+ struct ipt_entry *table_base;
-+ unsigned int i;
-+
-+ for_each_cpu(i) {
-+ table_base = (struct ipt_entry *)info->tblentries[i];
-+ table_base->comefrom = 0xdead57ac;
-+ }
-+ }
-+#endif
-+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_USER_RESOURCE)
-+ {
-+ struct user_beancounter *ub;
-+
-+ ub = ipt_table_info_ub(info);
-+ if (charge_iptables(ub, info->number))
-+ return -ENOMEM;
-+ }
-+#endif
-+ table->private = info;
-+ info->initial_entries = 0;
-+ return 0;
-+}
-+
- static struct ipt_table_info *
- replace_table(struct ipt_table *table,
- unsigned int num_counters,
-@@ -892,6 +1050,16 @@ replace_table(struct ipt_table *table,
- return NULL;
- }
- oldinfo = table->private;
-+
-+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_USER_RESOURCE)
-+ if (charge_replace_table(oldinfo, newinfo)) {
-+ oldinfo = NULL;
-+ write_unlock_bh(&table->lock);
-+ *error = -ENOMEM;
-+ return NULL;
-+ }
-+#endif
-+
- table->private = newinfo;
- newinfo->initial_entries = oldinfo->initial_entries;
- write_unlock_bh(&table->lock);
-@@ -928,24 +1096,19 @@ get_counters(const struct ipt_table_info
- }
- }
-
--static int
--copy_entries_to_user(unsigned int total_size,
-- struct ipt_table *table,
-- void __user *userptr)
-+static inline struct ipt_counters * alloc_counters(struct ipt_table *table)
- {
-- unsigned int off, num, countersize;
-- struct ipt_entry *e;
- struct ipt_counters *counters;
-- int ret = 0;
-+ unsigned int countersize;
-
- /* We need atomic snapshot of counters: rest doesn't change
- (other than comefrom, which userspace doesn't care
- about). */
- countersize = sizeof(struct ipt_counters) * table->private->number;
-- counters = vmalloc(countersize);
-+ counters = vmalloc_best(countersize);
-
- if (counters == NULL)
-- return -ENOMEM;
-+ return ERR_PTR(-ENOMEM);
-
- /* First, sum counters... */
- memset(counters, 0, countersize);
-@@ -953,6 +1116,23 @@ copy_entries_to_user(unsigned int total_
- get_counters(table->private, counters);
- write_unlock_bh(&table->lock);
-
-+ return counters;
-+}
-+
-+static int
-+copy_entries_to_user(unsigned int total_size,
-+ struct ipt_table *table,
-+ void __user *userptr)
-+{
-+ unsigned int off, num;
-+ struct ipt_entry *e;
-+ struct ipt_counters *counters;
-+ int ret = 0;
-+
-+ counters = alloc_counters(table);
-+ if (IS_ERR(counters))
-+ return PTR_ERR(counters);
-+
- /* ... then copy entire thing from CPU 0... */
- if (copy_to_user(userptr, table->private->tblentries[0],
- total_size) != 0) {
-@@ -1008,264 +1188,1252 @@ copy_entries_to_user(unsigned int total_
- return ret;
- }
-
--static int
--get_entries(const struct ipt_get_entries *entries,
-- struct ipt_get_entries __user *uptr)
--{
-- int ret;
-- struct ipt_table *t;
-+#ifdef CONFIG_COMPAT
-+static DECLARE_MUTEX(compat_ipt_mutex);
-
-- t = ipt_find_table_lock(entries->name, &ret, &ipt_mutex);
-- if (t) {
-- duprintf("t->private->number = %u\n",
-- t->private->number);
-- if (entries->size == t->private->size)
-- ret = copy_entries_to_user(t->private->size,
-- t, uptr->entrytable);
-- else {
-- duprintf("get_entries: I've got %u not %u!\n",
-- t->private->size,
-- entries->size);
-- ret = -EINVAL;
-- }
-- up(&ipt_mutex);
-- } else
-- duprintf("get_entries: Can't find %s!\n",
-- entries->name);
-+struct compat_delta {
-+ struct compat_delta *next;
-+ u_int16_t offset;
-+ short delta;
-+};
-
-- return ret;
--}
-+static struct compat_delta *compat_offsets = NULL;
-
--void ipt_free_table_info(struct ipt_table_info *info)
-+static int compat_add_offset(u_int16_t offset, short delta)
- {
-- int cpu;
-- for_each_cpu(cpu) {
-- if (info->size <= PAGE_SIZE)
-- kfree(info->tblentries[cpu]);
-- else
-- vfree(info->tblentries[cpu]);
-+ struct compat_delta *tmp;
-+
-+ tmp = kmalloc(sizeof(struct compat_delta), GFP_KERNEL);
-+ if (!tmp)
-+ return -ENOMEM;
-+ tmp->offset = offset;
-+ tmp->delta = delta;
-+ if (compat_offsets) {
-+ tmp->next = compat_offsets->next;
-+ compat_offsets->next = tmp;
-+ } else {
-+ compat_offsets = tmp;
-+ tmp->next = NULL;
- }
-- kfree(info);
-+ return 0;
- }
-
--struct ipt_table_info *ipt_alloc_table_info(unsigned int size)
-+static void compat_flush_offsets(void)
- {
-- struct ipt_table_info *newinfo;
-- unsigned int cpu;
--
-- /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
-- if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > num_physpages)
-- return NULL;
--
-- /* kzalloc the main struct */
-- newinfo = kzalloc(sizeof(struct ipt_table_info), GFP_KERNEL);
-- if (!newinfo)
-- return NULL;
-+ struct compat_delta *tmp, *next;
-
-- newinfo->size = size;
--
-- /* allocate the table for each CPU */
-- for_each_cpu(cpu) {
-- if (size <= PAGE_SIZE)
-- newinfo->tblentries[cpu] = kmalloc(size, GFP_KERNEL);
-- else
-- newinfo->tblentries[cpu] = vmalloc(size);
--
-- if (newinfo->tblentries[cpu] == NULL) {
-- ipt_free_table_info(newinfo);
-- return NULL;
-+ if (compat_offsets) {
-+ for(tmp = compat_offsets; tmp; tmp = next) {
-+ next = tmp->next;
-+ kfree(tmp);
- }
-+ compat_offsets = NULL;
- }
--
-- return newinfo;
- }
-
--static int
--do_replace(void __user *user, unsigned int len)
-+static short compat_calc_jump(u_int16_t offset)
- {
-- int ret;
-- struct ipt_replace tmp;
-- struct ipt_table *t;
-- struct ipt_table_info *newinfo, *oldinfo;
-- struct ipt_counters *counters;
-+ struct compat_delta *tmp;
-+ short delta;
-
-- if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
-- return -EFAULT;
-+ for(tmp = compat_offsets, delta = 0; tmp; tmp = tmp->next)
-+ if (tmp->offset < offset)
-+ delta += tmp->delta;
-+ return delta;
-+}
-
-- /* Hack: Causes ipchains to give correct error msg --RR */
-- if (len != sizeof(tmp) + tmp.size)
-- return -ENOPROTOOPT;
-+struct compat_ipt_standard_target
-+{
-+ struct compat_ipt_entry_target target;
-+ compat_int_t verdict;
-+};
-
-- /* overflow check */
-- if (tmp.size >= (INT_MAX - sizeof(struct ipt_table_info)) / NR_CPUS -
-- SMP_CACHE_BYTES)
-- return -ENOMEM;
-- if (tmp.num_counters >= INT_MAX / sizeof(struct ipt_counters))
-- return -ENOMEM;
-+#define IPT_ST_OFFSET (sizeof(struct ipt_standard_target) - \
-+ sizeof(struct compat_ipt_standard_target))
-
-- newinfo = ipt_alloc_table_info(tmp.size);
-- if (!newinfo)
-- return -ENOMEM;
-+struct ipt_standard
-+{
-+ struct ipt_entry entry;
-+ struct ipt_standard_target target;
-+};
-
-- if (copy_from_user(newinfo->tblentries[0], user + sizeof(tmp),
-- tmp.size) != 0) {
-- ret = -EFAULT;
-- goto free_newinfo;
-- }
-+struct compat_ipt_standard
-+{
-+ struct compat_ipt_entry entry;
-+ struct compat_ipt_standard_target target;
-+};
-
-- counters = vmalloc(tmp.num_counters * sizeof(struct ipt_counters));
-- if (!counters) {
-- ret = -ENOMEM;
-- goto free_newinfo;
-+static int compat_ipt_standard_fn(void *target,
-+ void **dstptr, int *size, int convert)
-+{
-+ struct compat_ipt_standard_target compat_st, *pcompat_st;
-+ struct ipt_standard_target st, *pst;
-+ int ret;
-+
-+ ret = 0;
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ pst = (struct ipt_standard_target *)target;
-+ memcpy(&compat_st.target, &pst->target,
-+ sizeof(struct ipt_entry_target));
-+ compat_st.verdict = pst->verdict;
-+ if (compat_st.verdict > 0)
-+ compat_st.verdict -=
-+ compat_calc_jump(compat_st.verdict);
-+ compat_st.target.u.user.target_size =
-+ sizeof(struct compat_ipt_standard_target);
-+ if (__copy_to_user(*dstptr, &compat_st,
-+ sizeof(struct compat_ipt_standard_target)))
-+ ret = -EFAULT;
-+ *size -= IPT_ST_OFFSET;
-+ *dstptr += sizeof(struct compat_ipt_standard_target);
-+ break;
-+ case COMPAT_FROM_USER:
-+ pcompat_st =
-+ (struct compat_ipt_standard_target *)target;
-+ memcpy(&st.target, &pcompat_st->target,
-+ sizeof(struct ipt_entry_target));
-+ st.verdict = pcompat_st->verdict;
-+ if (st.verdict > 0)
-+ st.verdict += compat_calc_jump(st.verdict);
-+ st.target.u.user.target_size =
-+ sizeof(struct ipt_standard_target);
-+ memcpy(*dstptr, &st,
-+ sizeof(struct ipt_standard_target));
-+ *size += IPT_ST_OFFSET;
-+ *dstptr += sizeof(struct ipt_standard_target);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += IPT_ST_OFFSET;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
- }
-- memset(counters, 0, tmp.num_counters * sizeof(struct ipt_counters));
-+ return ret;
-+}
-
-- ret = translate_table(tmp.name, tmp.valid_hooks,
-- newinfo, tmp.size, tmp.num_entries,
-- tmp.hook_entry, tmp.underflow);
-- if (ret != 0)
-- goto free_newinfo_counters;
-+int ipt_target_align_compat(void *target, void **dstptr,
-+ int *size, int off, int convert)
-+{
-+ struct compat_ipt_entry_target *pcompat;
-+ struct ipt_entry_target *pt;
-+ u_int16_t tsize;
-+ int ret;
-
-- duprintf("ip_tables: Translated table\n");
-+ ret = 0;
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ pt = (struct ipt_entry_target *)target;
-+ tsize = pt->u.user.target_size;
-+ if (__copy_to_user(*dstptr, pt, tsize)) {
-+ ret = -EFAULT;
-+ break;
-+ }
-+ tsize -= off;
-+ if (put_user(tsize, (u_int16_t *)*dstptr))
-+ ret = -EFAULT;
-+ *size -= off;
-+ *dstptr += tsize;
-+ break;
-+ case COMPAT_FROM_USER:
-+ pcompat = (struct compat_ipt_entry_target *)target;
-+ pt = (struct ipt_entry_target *)*dstptr;
-+ tsize = pcompat->u.user.target_size;
-+ memcpy(pt, pcompat, tsize);
-+ tsize += off;
-+ pt->u.user.target_size = tsize;
-+ *size += off;
-+ *dstptr += tsize;
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+
-+int ipt_match_align_compat(void *match, void **dstptr,
-+ int *size, int off, int convert)
-+{
-+ struct compat_ipt_entry_match *pcompat_m;
-+ struct ipt_entry_match *pm;
-+ u_int16_t msize;
-+ int ret;
-+
-+ ret = 0;
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ pm = (struct ipt_entry_match *)match;
-+ msize = pm->u.user.match_size;
-+ if (__copy_to_user(*dstptr, pm, msize)) {
-+ ret = -EFAULT;
-+ break;
-+ }
-+ msize -= off;
-+ if (put_user(msize, (u_int16_t *)*dstptr))
-+ ret = -EFAULT;
-+ *size -= off;
-+ *dstptr += msize;
-+ break;
-+ case COMPAT_FROM_USER:
-+ pcompat_m = (struct compat_ipt_entry_match *)match;
-+ pm = (struct ipt_entry_match *)*dstptr;
-+ msize = pcompat_m->u.user.match_size;
-+ memcpy(pm, pcompat_m, msize);
-+ msize += off;
-+ pm->u.user.match_size = msize;
-+ *size += off;
-+ *dstptr += msize;
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+
-+static int tcp_compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_tcp)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_tcp));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+
-+static int udp_compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_udp)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_udp));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+
-+static int icmp_compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_icmp)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_icmp));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+
-+static inline int
-+compat_calc_match(struct ipt_entry_match *m, int * size)
-+{
-+ if (m->u.kernel.match->compat)
-+ m->u.kernel.match->compat(m, NULL, size, COMPAT_CALC_SIZE);
-+ return 0;
-+}
-+
-+static int compat_calc_entry(struct ipt_entry *e,
-+ struct ipt_table_info *info, struct ipt_table_info *newinfo)
-+{
-+ struct ipt_entry_target *t;
-+ u_int16_t entry_offset;
-+ int off, i, ret;
-+
-+ off = 0;
-+ entry_offset = (void *)e - (void *)info->tblentries[0];
-+ IPT_MATCH_ITERATE(e, compat_calc_match, &off);
-+ t = ipt_get_target(e);
-+ if (t->u.kernel.target->compat)
-+ t->u.kernel.target->compat(t, NULL, &off, COMPAT_CALC_SIZE);
-+ newinfo->size -= off;
-+ ret = compat_add_offset(entry_offset, off);
-+ if (ret)
-+ return ret;
-+
-+ for (i = 0; i< NF_IP_NUMHOOKS; i++) {
-+ if (info->hook_entry[i] && (e < (struct ipt_entry *)
-+ (info->tblentries[0] + info->hook_entry[i])))
-+ newinfo->hook_entry[i] -= off;
-+ if (info->underflow[i] && (e < (struct ipt_entry *)
-+ (info->tblentries[0] + info->underflow[i])))
-+ newinfo->underflow[i] -= off;
-+ }
-+ return 0;
-+}
-+
-+static int compat_table_info(struct ipt_table_info *info,
-+ struct ipt_table_info *newinfo)
-+{
-+ int i;
-+
-+ if (!newinfo || !info)
-+ return -EINVAL;
-+
-+ memset(newinfo, 0, sizeof(struct ipt_table_info));
-+ newinfo->size = info->size;
-+ for (i = 0; i < NF_IP_NUMHOOKS; i++) {
-+ newinfo->hook_entry[i] = info->hook_entry[i];
-+ newinfo->underflow[i] = info->underflow[i];
-+ }
-+ return IPT_ENTRY_ITERATE(info->tblentries[0],
-+ info->size, compat_calc_entry, info, newinfo);
-+}
-+#endif
-+
-+static int get_info(void __user *user, int *len)
-+{
-+ char name[IPT_TABLE_MAXNAMELEN];
-+ struct ipt_table *t;
-+ int ret, size;
-+
-+#ifdef CONFIG_COMPAT
-+ if (is_current_32bits())
-+ size = sizeof(struct compat_ipt_getinfo);
-+ else
-+#endif
-+ size = sizeof(struct ipt_getinfo);
-+
-+ if (*len != size) {
-+ duprintf("length %u != %u\n", *len,
-+ (unsigned int)sizeof(struct ipt_getinfo));
-+ return -EINVAL;
-+ }
-+
-+ if (copy_from_user(name, user, sizeof(name)) != 0)
-+ return -EFAULT;
-+
-+ name[IPT_TABLE_MAXNAMELEN-1] = '\0';
-+#ifdef CONFIG_COMPAT
-+ down(&compat_ipt_mutex);
-+#endif
-+ t = ipt_find_table_lock(name, &ret, &ipt_mutex);
-+ if (t) {
-+ struct ipt_getinfo info;
-+#ifdef CONFIG_COMPAT
-+ struct compat_ipt_getinfo compat_info;
-+#endif
-+ void *pinfo;
-+
-+#ifdef CONFIG_COMPAT
-+ if (is_current_32bits()) {
-+ struct ipt_table_info t_info;
-+ ret = compat_table_info(t->private, &t_info);
-+ compat_flush_offsets();
-+ memcpy(compat_info.hook_entry, t_info.hook_entry,
-+ sizeof(compat_info.hook_entry));
-+ memcpy(compat_info.underflow, t_info.underflow,
-+ sizeof(compat_info.underflow));
-+ compat_info.valid_hooks = t->valid_hooks;
-+ compat_info.num_entries = t->private->number;
-+ compat_info.size = t_info.size;
-+ strcpy(compat_info.name, name);
-+ pinfo = (void *)&compat_info;
-+ } else
-+#endif
-+ {
-+ info.valid_hooks = t->valid_hooks;
-+ memcpy(info.hook_entry, t->private->hook_entry,
-+ sizeof(info.hook_entry));
-+ memcpy(info.underflow, t->private->underflow,
-+ sizeof(info.underflow));
-+ info.num_entries = t->private->number;
-+ info.size = t->private->size;
-+ strcpy(info.name, name);
-+ pinfo = (void *)&info;
-+ }
-+
-+ if (copy_to_user(user, pinfo, *len) != 0)
-+ ret = -EFAULT;
-+ else
-+ ret = 0;
-+
-+ up(&ipt_mutex);
-+ }
-+#ifdef CONFIG_COMPAT
-+ up(&compat_ipt_mutex);
-+#endif
-+ return ret;
-+}
-+
-+static int
-+get_entries(struct ipt_get_entries __user *uptr, int *len)
-+{
-+ int ret;
-+ struct ipt_get_entries get;
-+ struct ipt_table *t;
-+
-+ if (*len < sizeof(get)) {
-+ duprintf("get_entries: %u < %d\n", *len,
-+ (unsigned int)sizeof(get));
-+ return -EINVAL;
-+ }
-+
-+ if (copy_from_user(&get, uptr, sizeof(get)) != 0)
-+ return -EFAULT;
-+
-+ if (*len != sizeof(struct ipt_get_entries) + get.size) {
-+ duprintf("get_entries: %u != %u\n", *len,
-+ (unsigned int)(sizeof(struct ipt_get_entries) +
-+ get.size));
-+ return -EINVAL;
-+ }
-+
-+ t = ipt_find_table_lock(get.name, &ret, &ipt_mutex);
-+ if (t) {
-+ duprintf("t->private->number = %u\n",
-+ t->private->number);
-+ if (get.size == t->private->size)
-+ ret = copy_entries_to_user(t->private->size,
-+ t, uptr->entrytable);
-+ else {
-+ duprintf("get_entries: I've got %u not %u!\n",
-+ t->private->size,
-+ get.size);
-+ ret = -EINVAL;
-+ }
-+ up(&ipt_mutex);
-+ } else
-+ duprintf("get_entries: Can't find %s!\n",
-+ get.name);
-+
-+ return ret;
-+}
-+
-+void ipt_free_table_info(struct ipt_table_info *info)
-+{
-+ int cpu;
-+ for_each_cpu(cpu) {
-+ if (info->alloc_size <= PAGE_SIZE)
-+ kfree(info->tblentries[cpu]);
-+ else
-+ vfree(info->tblentries[cpu]);
-+ }
-+ kfree(info);
-+}
-+
-+struct ipt_table_info *ipt_alloc_table_info(unsigned int size)
-+{
-+ struct ipt_table_info *newinfo;
-+ unsigned int cpu;
-+
-+ /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
-+ if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > num_physpages)
-+ return NULL;
-+
-+ /* kzalloc the main struct */
-+ newinfo = kzalloc(sizeof(struct ipt_table_info), GFP_KERNEL_UBC);
-+ if (!newinfo)
-+ return NULL;
-+
-+ newinfo->size = newinfo->alloc_size = size;
-+
-+ /* allocate the table for each CPU */
-+ for_each_cpu(cpu) {
-+ if (size <= PAGE_SIZE)
-+ newinfo->tblentries[cpu] = ub_kmalloc(size, GFP_KERNEL);
-+ else
-+ newinfo->tblentries[cpu] = ub_vmalloc(size);
-+
-+ if (newinfo->tblentries[cpu] == NULL) {
-+ ipt_free_table_info(newinfo);
-+ return NULL;
-+ }
-+ }
-+
-+ return newinfo;
-+}
-+
-+static int
-+__do_replace(const char *name, unsigned int valid_hooks,
-+ struct ipt_table_info *newinfo, unsigned int size,
-+ unsigned int num_counters, void __user *counters_ptr)
-+{
-+ int ret;
-+ struct ipt_table *t;
-+ struct ipt_table_info *oldinfo;
-+ struct ipt_counters *counters;
-+
-+ counters = ub_vmalloc_best(num_counters *
-+ sizeof(struct ipt_counters));
-+ if (!counters) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+ memset(counters, 0, num_counters * sizeof(struct ipt_counters));
-
-- t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
-+ t = ipt_find_table_lock(name, &ret, &ipt_mutex);
- if (!t)
- goto free_newinfo_counters_untrans;
-
- /* You lied! */
-- if (tmp.valid_hooks != t->valid_hooks) {
-+ if (valid_hooks != t->valid_hooks) {
- duprintf("Valid hook crap: %08X vs %08X\n",
-- tmp.valid_hooks, t->valid_hooks);
-+ valid_hooks, t->valid_hooks);
- ret = -EINVAL;
- goto free_newinfo_counters_untrans_unlock;
- }
-
-- /* Get a reference in advance, we're not allowed fail later */
-- if (!try_module_get(t->me)) {
-- ret = -EBUSY;
-- goto free_newinfo_counters_untrans_unlock;
-- }
-+ /* Get a reference in advance, we're not allowed fail later */
-+ if (!try_module_get(t->me)) {
-+ ret = -EBUSY;
-+ goto free_newinfo_counters_untrans_unlock;
-+ }
-+
-+ oldinfo = replace_table(t, num_counters, newinfo, &ret);
-+ if (!oldinfo)
-+ goto put_module;
-+
-+ /* Update module usage count based on number of rules */
-+ duprintf("__do_replace: oldnum=%u, initnum=%u, newnum=%u\n",
-+ oldinfo->number, oldinfo->initial_entries, newinfo->number);
-+ if ((oldinfo->number > oldinfo->initial_entries) ||
-+ (newinfo->number <= oldinfo->initial_entries))
-+ module_put(t->me);
-+ if ((oldinfo->number > oldinfo->initial_entries) &&
-+ (newinfo->number <= oldinfo->initial_entries))
-+ module_put(t->me);
-+
-+ /* Get the old counters. */
-+ get_counters(oldinfo, counters);
-+ /* Decrease module usage counts and free resource */
-+ IPT_ENTRY_ITERATE(oldinfo->tblentries[0], oldinfo->size,
-+ cleanup_entry,NULL);
-+ ipt_free_table_info(oldinfo);
-+ /* Silent error: too late now. */
-+ copy_to_user(counters_ptr, counters,
-+ sizeof(struct ipt_counters) * num_counters);
-+ vfree(counters);
-+ up(&ipt_mutex);
-+ return 0;
-+ put_module:
-+ module_put(t->me);
-+ free_newinfo_counters_untrans_unlock:
-+ up(&ipt_mutex);
-+ free_newinfo_counters_untrans:
-+ vfree(counters);
-+ out:
-+ return ret;
-+}
-+
-+static int
-+do_replace(void __user *user, unsigned int len)
-+{
-+ int ret;
-+ struct ipt_replace tmp;
-+ struct ipt_table_info *newinfo;
-+
-+ if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
-+ return -EFAULT;
-+
-+ /* Hack: Causes ipchains to give correct error msg --RR */
-+ if (len != sizeof(tmp) + tmp.size)
-+ return -ENOPROTOOPT;
-+
-+ /* overflow check */
-+ if (tmp.size >= (INT_MAX - sizeof(struct ipt_table_info)) / NR_CPUS -
-+ SMP_CACHE_BYTES)
-+ return -ENOMEM;
-+ if (tmp.num_counters >= INT_MAX / sizeof(struct ipt_counters))
-+ return -ENOMEM;
-+
-+ newinfo = ipt_alloc_table_info(tmp.size);
-+ if (!newinfo)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(newinfo->tblentries[0], user + sizeof(tmp),
-+ tmp.size) != 0) {
-+ ret = -EFAULT;
-+ goto free_newinfo;
-+ }
-+
-+ ret = translate_table(tmp.name, tmp.valid_hooks,
-+ newinfo, tmp.size, tmp.num_entries,
-+ tmp.hook_entry, tmp.underflow);
-+ if (ret != 0)
-+ goto free_newinfo;
-+
-+ duprintf("ip_tables: Translated table\n");
-+
-+ ret = __do_replace(tmp.name, tmp.valid_hooks,
-+ newinfo, tmp.size, tmp.num_counters,
-+ tmp.counters);
-+ if (ret)
-+ goto free_newinfo_untrans;
-+ return 0;
-+
-+ free_newinfo_untrans:
-+ IPT_ENTRY_ITERATE(newinfo->tblentries[0], newinfo->size,
-+ cleanup_entry,NULL);
-+ free_newinfo:
-+ ipt_free_table_info(newinfo);
-+ return ret;
-+}
-+
-+/* We're lazy, and add to the first CPU; overflow works its fey magic
-+ * and everything is OK. */
-+static inline int
-+add_counter_to_entry(struct ipt_entry *e,
-+ const struct ipt_counters addme[],
-+ unsigned int *i)
-+{
-+#if 0
-+ duprintf("add_counter: Entry %u %lu/%lu + %lu/%lu\n",
-+ *i,
-+ (long unsigned int)e->counters.pcnt,
-+ (long unsigned int)e->counters.bcnt,
-+ (long unsigned int)addme[*i].pcnt,
-+ (long unsigned int)addme[*i].bcnt);
-+#endif
-+
-+ ADD_COUNTER(e->counters, addme[*i].bcnt, addme[*i].pcnt);
-+
-+ (*i)++;
-+ return 0;
-+}
-+
-+static int
-+do_add_counters(void __user *user, unsigned int len)
-+{
-+ unsigned int i;
-+ struct ipt_counters_info tmp;
-+ void *ptmp;
-+ struct ipt_table *t;
-+ unsigned int num_counters;
-+ char *name;
-+ struct ipt_counters *paddc;
-+ int ret, size;
-+#ifdef CONFIG_COMPAT
-+ struct compat_ipt_counters_info compat_tmp;
-+
-+ if (is_current_32bits()) {
-+ ptmp = &compat_tmp;
-+ size = sizeof(struct compat_ipt_counters_info);
-+ } else
-+#endif
-+ {
-+ ptmp = &tmp;
-+ size = sizeof(struct ipt_counters_info);
-+ }
-+
-+ if (copy_from_user(ptmp, user, size) != 0)
-+ return -EFAULT;
-+
-+#ifdef CONFIG_COMPAT
-+ if (is_current_32bits()) {
-+ num_counters = compat_tmp.num_counters;
-+ name = compat_tmp.name;
-+ } else
-+#endif
-+ {
-+ num_counters = tmp.num_counters;
-+ name = tmp.name;
-+ }
-+
-+ if (len != size + num_counters * sizeof(struct ipt_counters))
-+ return -EINVAL;
-+
-+ paddc = ub_vmalloc_best(len - size);
-+ if (!paddc)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(paddc, user + size, len - size) != 0) {
-+ ret = -EFAULT;
-+ goto free;
-+ }
-+
-+ t = ipt_find_table_lock(name, &ret, &ipt_mutex);
-+ if (!t)
-+ goto free;
-+
-+ write_lock_bh(&t->lock);
-+ if (t->private->number != num_counters) {
-+ ret = -EINVAL;
-+ goto unlock_up_free;
-+ }
-+
-+ i = 0;
-+ IPT_ENTRY_ITERATE(t->private->tblentries[0],
-+ t->private->size,
-+ add_counter_to_entry,
-+ paddc,
-+ &i);
-+ unlock_up_free:
-+ write_unlock_bh(&t->lock);
-+ up(&ipt_mutex);
-+ free:
-+ vfree(paddc);
-+
-+ return ret;
-+}
-+
-+#ifdef CONFIG_COMPAT
-+struct compat_ipt_replace {
-+ char name[IPT_TABLE_MAXNAMELEN];
-+ u32 valid_hooks;
-+ u32 num_entries;
-+ u32 size;
-+ u32 hook_entry[NF_IP_NUMHOOKS];
-+ u32 underflow[NF_IP_NUMHOOKS];
-+ u32 num_counters;
-+ compat_uptr_t counters; /* struct ipt_counters * */
-+ struct compat_ipt_entry entries[0];
-+};
-+
-+static inline int compat_copy_match_to_user(struct ipt_entry_match *m,
-+ void __user **dstptr, compat_uint_t *size)
-+{
-+ if (m->u.kernel.match->compat)
-+ m->u.kernel.match->compat(m, dstptr, (int *)size,
-+ COMPAT_TO_USER);
-+ else {
-+ if (__copy_to_user(*dstptr, m, m->u.match_size))
-+ return -EFAULT;
-+ *dstptr += m->u.match_size;
-+ }
-+ return 0;
-+}
-+
-+static int compat_copy_entry_to_user(struct ipt_entry *e,
-+ void __user **dstptr, compat_uint_t *size)
-+{
-+ struct ipt_entry_target __user *t;
-+ struct compat_ipt_entry __user *ce;
-+ u_int16_t target_offset, next_offset;
-+ compat_uint_t origsize;
-+ int ret;
-+
-+ ret = -EFAULT;
-+ origsize = *size;
-+ ce = (struct compat_ipt_entry __user *)*dstptr;
-+ if (__copy_to_user(ce, e, sizeof(struct ipt_entry)))
-+ goto out;
-+
-+ *dstptr += sizeof(struct compat_ipt_entry);
-+ ret = IPT_MATCH_ITERATE(e, compat_copy_match_to_user, dstptr, size);
-+ target_offset = e->target_offset - (origsize - *size);
-+ if (ret)
-+ goto out;
-+ t = ipt_get_target(e);
-+ if (t->u.kernel.target->compat) {
-+ ret = t->u.kernel.target->compat(t,
-+ dstptr, (int *)size, COMPAT_TO_USER);
-+ if (ret)
-+ goto out;
-+ } else {
-+ ret = -EFAULT;
-+ if (__copy_to_user(*dstptr, t, t->u.target_size))
-+ goto out;
-+ *dstptr += t->u.target_size;
-+ }
-+ ret = -EFAULT;
-+ next_offset = e->next_offset - (origsize - *size);
-+ if (__put_user(target_offset, &ce->target_offset))
-+ goto out;
-+ if (__put_user(next_offset, &ce->next_offset))
-+ goto out;
-+ return 0;
-+out:
-+ return ret;
-+}
-+
-+static inline int
-+compat_check_calc_match(struct ipt_entry_match *m,
-+ const char *name,
-+ const struct ipt_ip *ip,
-+ unsigned int hookmask,
-+ int *size, unsigned int *i)
-+{
-+ int ret;
-+ struct ipt_match *match;
-+
-+ match = find_match_lock(m->u.user.name, &ret, &ipt_mutex);
-+ if (!match) {
-+ duprintf("compat_check_calc_match: `%s' not found\n",
-+ m->u.user.name);
-+ return ret;
-+ }
-+ if (!try_module_get(match->me)) {
-+ up(&ipt_mutex);
-+ return -ENOENT;
-+ }
-+ m->u.kernel.match = match;
-+ up(&ipt_mutex);
-+
-+ if (m->u.kernel.match->compat)
-+ m->u.kernel.match->compat(m, NULL, size, COMPAT_CALC_SIZE);
-+
-+ (*i)++;
-+ return 0;
-+}
-+
-+static inline int
-+check_compat_entry_size_and_hooks(struct ipt_entry *e,
-+ struct ipt_table_info *newinfo,
-+ unsigned char *base,
-+ unsigned char *limit,
-+ unsigned int *hook_entries,
-+ unsigned int *underflows,
-+ unsigned int *i,
-+ const char *name)
-+{
-+ struct ipt_entry_target *t;
-+ struct ipt_target *target;
-+ u_int16_t entry_offset;
-+ int ret, off, h;
-+ unsigned int j;
-+
-+ duprintf("check_compat_entry_size_and_hooks %p\n", e);
-+ if ((unsigned long)e % __alignof__(struct compat_ipt_entry) != 0
-+ || (unsigned char *)e + sizeof(struct compat_ipt_entry) >= limit) {
-+ duprintf("Bad offset %p, limit = %p\n", e, limit);
-+ return -EINVAL;
-+ }
-+
-+ if (e->next_offset < sizeof(struct compat_ipt_entry) +
-+ sizeof(struct compat_ipt_entry_target)) {
-+ duprintf("checking: element %p size %u\n",
-+ e, e->next_offset);
-+ return -EINVAL;
-+ }
-+
-+ ret = check_entry(e, name);
-+ if (ret != 0)
-+ return ret;
-+
-+ off = 0;
-+ entry_offset = (void *)e - (void *)base;
-+ j = 0;
-+ ret = IPT_MATCH_ITERATE(e, compat_check_calc_match, name, &e->ip,
-+ e->comefrom, &off, &j);
-+ if (ret != 0)
-+ goto out;
-+
-+ t = ipt_get_target(e);
-+ target = ipt_find_target_lock(t->u.user.name, &ret, &ipt_mutex);
-+ if (!target) {
-+ duprintf("check_compat_entry_size_and_hooks: `%s'"
-+ " not found\n", t->u.user.name);
-+ goto out;
-+ }
-+ if (!try_module_get(target->me)) {
-+ up(&ipt_mutex);
-+ ret = -ENOENT;
-+ goto out;
-+ }
-+ t->u.kernel.target = target;
-+ up(&ipt_mutex);
-+
-+ if (t->u.kernel.target->compat)
-+ t->u.kernel.target->compat(t, NULL, &off, COMPAT_CALC_SIZE);
-+ newinfo->size += off;
-+ ret = compat_add_offset(entry_offset, off);
-+ if (ret)
-+ goto out_put;
-+
-+ /* Check hooks & underflows */
-+ for (h = 0; h < NF_IP_NUMHOOKS; h++) {
-+ if ((unsigned char *)e - base == hook_entries[h])
-+ newinfo->hook_entry[h] = hook_entries[h];
-+ if ((unsigned char *)e - base == underflows[h])
-+ newinfo->underflow[h] = underflows[h];
-+ }
-+
-+ /* Clear counters and comefrom */
-+ e->counters = ((struct ipt_counters) { 0, 0 });
-+ e->comefrom = 0;
-+
-+ (*i)++;
-+ return 0;
-+out_put:
-+ module_put(target->me);
-+out:
-+ IPT_MATCH_ITERATE(e, cleanup_match, &j);
-+ return ret;
-+}
-+
-+static inline int compat_copy_match_from_user(struct ipt_entry_match *m,
-+ void **dstptr, compat_uint_t *size, const char *name,
-+ const struct ipt_ip *ip, unsigned int hookmask)
-+{
-+ struct ipt_entry_match *dm;
-+
-+ dm = (struct ipt_entry_match *)*dstptr;
-+ if (m->u.kernel.match->compat)
-+ m->u.kernel.match->compat(m, dstptr, (int *)size,
-+ COMPAT_FROM_USER);
-+ else {
-+ memcpy(*dstptr, m, m->u.match_size);
-+ *dstptr += m->u.match_size;
-+ }
-+
-+ return check_match(dm, name, ip, hookmask);
-+}
-+
-+static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
-+ unsigned int *size, const char *name,
-+ struct ipt_table_info *newinfo, unsigned char *base)
-+{
-+ struct ipt_entry_target *t;
-+ struct ipt_entry *de;
-+ unsigned int origsize;
-+ int ret, h;
-+
-+ origsize = *size;
-+ de = (struct ipt_entry *)*dstptr;
-+ memcpy(de, e, sizeof(struct ipt_entry));
-+
-+ *dstptr += sizeof(struct compat_ipt_entry);
-+ ret = IPT_MATCH_ITERATE(e, compat_copy_match_from_user, dstptr, size,
-+ name, &de->ip, de->comefrom);
-+ if (ret)
-+ goto cleanup_matches;
-+ de->target_offset = e->target_offset - (origsize - *size);
-+ t = ipt_get_target(e);
-+ if (t->u.kernel.target->compat)
-+ t->u.kernel.target->compat(t,
-+ dstptr, (int *)size, COMPAT_FROM_USER);
-+ else {
-+ memcpy(*dstptr, t, t->u.target_size);
-+ *dstptr += t->u.target_size;
-+ }
-+
-+ de->next_offset = e->next_offset - (origsize - *size);
-+ for (h = 0; h < NF_IP_NUMHOOKS; h++) {
-+ if ((unsigned char *)de - base < newinfo->hook_entry[h])
-+ newinfo->hook_entry[h] -= origsize - *size;
-+ if ((unsigned char *)de - base < newinfo->underflow[h])
-+ newinfo->underflow[h] -= origsize - *size;
-+ }
-+
-+ ret = check_target(de, name, *size);
-+ if (ret)
-+ goto cleanup_matches;
-+ return 0;
-+
-+cleanup_matches:
-+ IPT_MATCH_ITERATE(e, cleanup_match, NULL);
-+ return ret;
-+}
-+
-+static int
-+translate_compat_table(const char *name,
-+ unsigned int valid_hooks,
-+ struct ipt_table_info **pinfo,
-+ unsigned int total_size,
-+ unsigned int number,
-+ unsigned int *hook_entries,
-+ unsigned int *underflows)
-+{
-+ unsigned int i, j;
-+ struct ipt_table_info *newinfo, *info;
-+ void *pos, *entry;
-+ unsigned int size;
-+ int ret;
-+
-+ info = *pinfo;
-+ info->size = total_size;
-+ info->number = number;
-+
-+ /* Init all hooks to impossible value. */
-+ for (i = 0; i < NF_IP_NUMHOOKS; i++) {
-+ info->hook_entry[i] = 0xFFFFFFFF;
-+ info->underflow[i] = 0xFFFFFFFF;
-+ }
-+
-+ duprintf("translate_compat_table: size %u\n", info->size);
-+ i = 0;
-+ down(&compat_ipt_mutex);
-+ /* Walk through entries, checking offsets. */
-+ ret = IPT_ENTRY_ITERATE(info->tblentries[0], total_size,
-+ check_compat_entry_size_and_hooks,
-+ info, info->tblentries[0],
-+ info->tblentries[0] + total_size,
-+ hook_entries, underflows, &i, name);
-+ if (ret != 0)
-+ goto out_unlock;
-+
-+ ret = -EINVAL;
-+ if (i != number) {
-+ duprintf("translate_compat_table: %u not %u entries\n",
-+ i, number);
-+ goto out_unlock;
-+ }
-+
-+ /* Check hooks all assigned */
-+ for (j = 0; j < NF_IP_NUMHOOKS; j++) {
-+ /* Only hooks which are valid */
-+ if (!(valid_hooks & (1 << j)))
-+ continue;
-+ if (info->hook_entry[j] == 0xFFFFFFFF) {
-+ duprintf("Invalid hook entry %u %u\n",
-+ j, hook_entries[j]);
-+ goto out_unlock;
-+ }
-+ if (info->underflow[j] == 0xFFFFFFFF) {
-+ duprintf("Invalid underflow %u %u\n",
-+ j, underflows[j]);
-+ goto out_unlock;
-+ }
-+ }
-+
-+ ret = -ENOMEM;
-+ newinfo = ipt_alloc_table_info(info->size);
-+ if (!newinfo)
-+ goto out_unlock;
-+
-+ newinfo->number = info->number;
-+ for (j = 0; j < NF_IP_NUMHOOKS; j++) {
-+ newinfo->hook_entry[j] = info->hook_entry[j];
-+ newinfo->underflow[j] = info->underflow[j];
-+ }
-+
-+ pos = entry = newinfo->tblentries[0];
-+ size = total_size;
-+ ret = IPT_ENTRY_ITERATE(info->tblentries[0], total_size,
-+ compat_copy_entry_from_user, &pos, &size,
-+ name, newinfo, entry);
-+ compat_flush_offsets();
-+ up(&compat_ipt_mutex);
-+ if (ret)
-+ goto free_newinfo;
-+
-+ ret = -ELOOP;
-+ if (!mark_source_chains(newinfo, valid_hooks))
-+ goto free_newinfo;
-+
-+ /* And one copy for every other CPU */
-+ for_each_cpu(i) {
-+ if (newinfo->tblentries[i] && newinfo->tblentries[i] != entry)
-+ memcpy(newinfo->tblentries[i], entry, newinfo->size);
-+ }
-+
-+ *pinfo = newinfo;
-+ ipt_free_table_info(info);
-+ return 0;
-+
-+free_newinfo:
-+ IPT_ENTRY_ITERATE(info->tblentries[0], total_size,
-+ cleanup_entry, &i);
-+ ipt_free_table_info(newinfo);
-+out:
-+ return ret;
-+out_unlock:
-+ IPT_ENTRY_ITERATE(info->tblentries[0], total_size,
-+ cleanup_entry, &i);
-+ compat_flush_offsets();
-+ up(&compat_ipt_mutex);
-+ goto out;
-+}
-+
-+static int
-+compat_do_replace(void __user *user, unsigned int len)
-+{
-+ int ret;
-+ struct compat_ipt_replace tmp;
-+ struct ipt_table_info *newinfo;
-+
-+ if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
-+ return -EFAULT;
-+
-+ /* Hack: Causes ipchains to give correct error msg --RR */
-+ if (len != sizeof(tmp) + tmp.size)
-+ return -ENOPROTOOPT;
-+
-+ /* overflow check */
-+ if (tmp.num_counters >= INT_MAX / sizeof(struct ipt_counters))
-+ return -ENOMEM;
-+
-+ /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
-+ if ((SMP_ALIGN(tmp.size) >> PAGE_SHIFT) + 2 > num_physpages)
-+ return -ENOMEM;
-
-+ newinfo = ipt_alloc_table_info(tmp.size);
-+ if (!newinfo)
-+ return -ENOMEM;
-
-- oldinfo = replace_table(t, tmp.num_counters, newinfo, &ret);
-- if (!oldinfo)
-- goto put_module;
-+ if (copy_from_user(newinfo->tblentries[0], user + sizeof(tmp), tmp.size) != 0) {
-+ ret = -EFAULT;
-+ goto free_newinfo;
-+ }
-
-- /* Update module usage count based on number of rules */
-- duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n",
-- oldinfo->number, oldinfo->initial_entries, newinfo->number);
-- if ((oldinfo->number > oldinfo->initial_entries) ||
-- (newinfo->number <= oldinfo->initial_entries))
-- module_put(t->me);
-- if ((oldinfo->number > oldinfo->initial_entries) &&
-- (newinfo->number <= oldinfo->initial_entries))
-- module_put(t->me);
-+ ret = translate_compat_table(tmp.name, tmp.valid_hooks,
-+ &newinfo, tmp.size, tmp.num_entries,
-+ tmp.hook_entry, tmp.underflow);
-+ if (ret != 0)
-+ goto free_newinfo;
-
-- /* Get the old counters. */
-- get_counters(oldinfo, counters);
-- /* Decrease module usage counts and free resource */
-- IPT_ENTRY_ITERATE(oldinfo->tblentries[0], oldinfo->size,
-- cleanup_entry,NULL);
-- ipt_free_table_info(oldinfo);
-- /* Silent error: too late now. */
-- copy_to_user(tmp.counters, counters,
-- sizeof(struct ipt_counters) * tmp.num_counters);
-- vfree(counters);
-- up(&ipt_mutex);
-+ duprintf("compat_do_replace: Translated table\n");
-+
-+ ret = __do_replace(tmp.name, tmp.valid_hooks,
-+ newinfo, tmp.size, tmp.num_counters,
-+ compat_ptr(tmp.counters));
-+ if (ret)
-+ goto free_newinfo_untrans;
- return 0;
-
-- put_module:
-- module_put(t->me);
-- free_newinfo_counters_untrans_unlock:
-- up(&ipt_mutex);
-- free_newinfo_counters_untrans:
-- IPT_ENTRY_ITERATE(newinfo->tblentries[0], newinfo->size,
-- cleanup_entry,NULL);
-- free_newinfo_counters:
-- vfree(counters);
-+ free_newinfo_untrans:
-+ IPT_ENTRY_ITERATE(newinfo->tblentries[0], newinfo->size, cleanup_entry,NULL);
- free_newinfo:
- ipt_free_table_info(newinfo);
- return ret;
- }
-
--/* We're lazy, and add to the first CPU; overflow works its fey magic
-- * and everything is OK. */
--static inline int
--add_counter_to_entry(struct ipt_entry *e,
-- const struct ipt_counters addme[],
-- unsigned int *i)
-+struct compat_ipt_get_entries
- {
--#if 0
-- duprintf("add_counter: Entry %u %lu/%lu + %lu/%lu\n",
-- *i,
-- (long unsigned int)e->counters.pcnt,
-- (long unsigned int)e->counters.bcnt,
-- (long unsigned int)addme[*i].pcnt,
-- (long unsigned int)addme[*i].bcnt);
--#endif
-+ char name[IPT_TABLE_MAXNAMELEN];
-+ compat_uint_t size;
-+ struct compat_ipt_entry entrytable[0];
-+};
-
-- ADD_COUNTER(e->counters, addme[*i].bcnt, addme[*i].pcnt);
-+static int compat_copy_entries_to_user(unsigned int total_size,
-+ struct ipt_table *table, void __user *userptr)
-+{
-+ unsigned int off, num;
-+ struct compat_ipt_entry e;
-+ struct ipt_counters *counters;
-+ void __user *pos;
-+ unsigned int size;
-+ int ret = 0;
-
-- (*i)++;
-- return 0;
-+ counters = alloc_counters(table);
-+ if (IS_ERR(counters))
-+ return PTR_ERR(counters);
-+
-+ /* ... then copy entire thing from CPU 0... */
-+ pos = userptr;
-+ size = total_size;
-+ ret = IPT_ENTRY_ITERATE(table->private->tblentries[0],
-+ total_size, compat_copy_entry_to_user, &pos, &size);
-+
-+ /* ... then go back and fix counters and names */
-+ for (off = 0, num = 0; off < size; off += e.next_offset, num++) {
-+ unsigned int i;
-+ struct ipt_entry_match m;
-+ struct ipt_entry_target t;
-+
-+ ret = -EFAULT;
-+ if (copy_from_user(&e, userptr + off,
-+ sizeof(struct compat_ipt_entry)))
-+ goto free_counters;
-+ if (copy_to_user(userptr + off +
-+ offsetof(struct compat_ipt_entry, counters),
-+ &counters[num], sizeof(counters[num])))
-+ goto free_counters;
-+
-+ for (i = sizeof(struct compat_ipt_entry);
-+ i < e.target_offset; i += m.u.match_size) {
-+ if (copy_from_user(&m, userptr + off + i,
-+ sizeof(struct ipt_entry_match)))
-+ goto free_counters;
-+ if (copy_to_user(userptr + off + i +
-+ offsetof(struct ipt_entry_match, u.user.name),
-+ m.u.kernel.match->name,
-+ strlen(m.u.kernel.match->name) + 1))
-+ goto free_counters;
-+ }
-+
-+ if (copy_from_user(&t, userptr + off + e.target_offset,
-+ sizeof(struct ipt_entry_target)))
-+ goto free_counters;
-+ if (copy_to_user(userptr + off + e.target_offset +
-+ offsetof(struct ipt_entry_target, u.user.name),
-+ t.u.kernel.target->name,
-+ strlen(t.u.kernel.target->name) + 1))
-+ goto free_counters;
-+ }
-+ ret = 0;
-+free_counters:
-+ vfree(counters);
-+ return ret;
- }
-
- static int
--do_add_counters(void __user *user, unsigned int len)
-+compat_get_entries(struct compat_ipt_get_entries __user *uptr, int *len)
- {
-- unsigned int i;
-- struct ipt_counters_info tmp, *paddc;
-- struct ipt_table *t;
- int ret;
-+ struct compat_ipt_get_entries get;
-+ struct ipt_table *t;
-
-- if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
-- return -EFAULT;
-
-- if (len != sizeof(tmp) + tmp.num_counters*sizeof(struct ipt_counters))
-+ if (*len < sizeof(get)) {
-+ duprintf("compat_get_entries: %u < %u\n",
-+ *len, (unsigned int)sizeof(get));
- return -EINVAL;
-+ }
-
-- paddc = vmalloc(len);
-- if (!paddc)
-- return -ENOMEM;
-+ if (copy_from_user(&get, uptr, sizeof(get)) != 0)
-+ return -EFAULT;
-
-- if (copy_from_user(paddc, user, len) != 0) {
-- ret = -EFAULT;
-- goto free;
-+ if (*len != sizeof(struct compat_ipt_get_entries) + get.size) {
-+ duprintf("compat_get_entries: %u != %u\n", *len,
-+ (unsigned int)(sizeof(struct compat_ipt_get_entries) +
-+ get.size));
-+ return -EINVAL;
- }
-
-- t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
-- if (!t)
-- goto free;
-+ down(&compat_ipt_mutex);
-+ t = ipt_find_table_lock(get.name, &ret, &ipt_mutex);
-+ if (t) {
-+ struct ipt_table_info info;
-+ duprintf("t->private->number = %u\n",
-+ t->private->number);
-+ ret = compat_table_info(t->private, &info);
-+ if (!ret && get.size == info.size) {
-+ ret = compat_copy_entries_to_user(t->private->size,
-+ t, uptr->entrytable);
-+ } else if (!ret) {
-+ duprintf("compat_get_entries: I've got %u not %u!\n",
-+ t->private->size,
-+ get.size);
-+ ret = -EINVAL;
-+ }
-+ compat_flush_offsets();
-+ up(&ipt_mutex);
-+ } else
-+ duprintf("compat_get_entries: Can't find %s!\n",
-+ get.name);
-+ up(&compat_ipt_mutex);
-+ return ret;
-+}
-
-- write_lock_bh(&t->lock);
-- if (t->private->number != tmp.num_counters) {
-+static int
-+compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
-+{
-+ int ret;
-+
-+ switch (cmd) {
-+ case IPT_SO_GET_INFO:
-+ ret = get_info(user, len);
-+ break;
-+ case IPT_SO_GET_ENTRIES:
-+ ret = compat_get_entries(user, len);
-+ break;
-+ default:
-+ duprintf("compat_do_ipt_get_ctl: unknown request %i\n", cmd);
- ret = -EINVAL;
-- goto unlock_up_free;
- }
--
-- i = 0;
-- IPT_ENTRY_ITERATE(t->private->tblentries[0],
-- t->private->size,
-- add_counter_to_entry,
-- paddc->counters,
-- &i);
-- unlock_up_free:
-- write_unlock_bh(&t->lock);
-- up(&ipt_mutex);
-- free:
-- vfree(paddc);
--
- return ret;
- }
-+#endif
-
- static int
- do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
- {
- int ret;
-
-- if (!capable(CAP_NET_ADMIN))
-+ if (!capable(CAP_VE_NET_ADMIN))
- return -EPERM;
-
-+#ifdef CONFIG_COMPAT
-+ if (is_current_32bits() && (cmd == IPT_SO_SET_REPLACE))
-+ return compat_do_replace(user, len);
-+#endif
-+
- switch (cmd) {
- case IPT_SO_SET_REPLACE:
- ret = do_replace(user, len);
-@@ -1288,65 +2456,22 @@ do_ipt_get_ctl(struct sock *sk, int cmd,
- {
- int ret;
-
-- if (!capable(CAP_NET_ADMIN))
-+ if (!capable(CAP_VE_NET_ADMIN))
- return -EPERM;
-
-- switch (cmd) {
-- case IPT_SO_GET_INFO: {
-- char name[IPT_TABLE_MAXNAMELEN];
-- struct ipt_table *t;
--
-- if (*len != sizeof(struct ipt_getinfo)) {
-- duprintf("length %u != %u\n", *len,
-- sizeof(struct ipt_getinfo));
-- ret = -EINVAL;
-- break;
-- }
--
-- if (copy_from_user(name, user, sizeof(name)) != 0) {
-- ret = -EFAULT;
-- break;
-- }
-- name[IPT_TABLE_MAXNAMELEN-1] = '\0';
-- t = ipt_find_table_lock(name, &ret, &ipt_mutex);
-- if (t) {
-- struct ipt_getinfo info;
--
-- info.valid_hooks = t->valid_hooks;
-- memcpy(info.hook_entry, t->private->hook_entry,
-- sizeof(info.hook_entry));
-- memcpy(info.underflow, t->private->underflow,
-- sizeof(info.underflow));
-- info.num_entries = t->private->number;
-- info.size = t->private->size;
-- strcpy(info.name, name);
--
-- if (copy_to_user(user, &info, *len) != 0)
-- ret = -EFAULT;
-- else
-- ret = 0;
--
-- up(&ipt_mutex);
-- }
-- }
-- break;
-+#ifdef CONFIG_COMPAT
-+ if (is_current_32bits())
-+ return compat_do_ipt_get_ctl(sk, cmd, user, len);
-+#endif
-
-- case IPT_SO_GET_ENTRIES: {
-- struct ipt_get_entries get;
-+ switch (cmd) {
-+ case IPT_SO_GET_INFO:
-+ ret = get_info(user, len);
-+ break;
-
-- if (*len < sizeof(get)) {
-- duprintf("get_entries: %u < %u\n", *len, sizeof(get));
-- ret = -EINVAL;
-- } else if (copy_from_user(&get, user, sizeof(get)) != 0) {
-- ret = -EFAULT;
-- } else if (*len != sizeof(struct ipt_get_entries) + get.size) {
-- duprintf("get_entries: %u != %u\n", *len,
-- sizeof(struct ipt_get_entries) + get.size);
-- ret = -EINVAL;
-- } else
-- ret = get_entries(&get, user);
-+ case IPT_SO_GET_ENTRIES:
-+ ret = get_entries(user, len);
- break;
-- }
-
- default:
- duprintf("do_ipt_get_ctl: unknown request %i\n", cmd);
-@@ -1366,7 +2491,7 @@ ipt_register_target(struct ipt_target *t
- if (ret != 0)
- return ret;
-
-- if (!list_named_insert(&ipt_target, target)) {
-+ if (!list_named_insert(&ve_ipt_target, target)) {
- duprintf("ipt_register_target: `%s' already in list!\n",
- target->name);
- ret = -EINVAL;
-@@ -1375,12 +2500,60 @@ ipt_register_target(struct ipt_target *t
- return ret;
- }
-
-+int
-+visible_ipt_register_target(struct ipt_target *target)
-+{
-+ int ret;
-+ struct module *mod = target->me;
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ struct ipt_target *tmp;
-+ __module_get(mod);
-+ ret = -ENOMEM;
-+ tmp = kmalloc(sizeof(struct ipt_target), GFP_KERNEL);
-+ if (!tmp)
-+ goto nomem;
-+ memcpy(tmp, target, sizeof(struct ipt_target));
-+ target = tmp;
-+ }
-+
-+ ret = ipt_register_target(target);
-+ if (ret)
-+ goto out;
-+
-+ return 0;
-+out:
-+ if (!ve_is_super(get_exec_env())) {
-+ kfree(target);
-+nomem:
-+ module_put(mod);
-+ }
-+ return ret;
-+}
-+
- void
- ipt_unregister_target(struct ipt_target *target)
- {
- down(&ipt_mutex);
-- LIST_DELETE(&ipt_target, target);
-+ LIST_DELETE(&ve_ipt_target, target);
-+ up(&ipt_mutex);
-+}
-+
-+void
-+visible_ipt_unregister_target(struct ipt_target *target)
-+{
-+ down(&ipt_mutex);
-+ target = list_named_find(&ve_ipt_target, target->name);
- up(&ipt_mutex);
-+ if (!target)
-+ return;
-+
-+ ipt_unregister_target(target);
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ module_put(target->me);
-+ kfree(target);
-+ }
- }
-
- int
-@@ -1392,13 +2565,43 @@ ipt_register_match(struct ipt_match *mat
- if (ret != 0)
- return ret;
-
-- if (!list_named_insert(&ipt_match, match)) {
-+ if (!list_named_insert(&ve_ipt_match, match)) {
- duprintf("ipt_register_match: `%s' already in list!\n",
- match->name);
- ret = -EINVAL;
- }
- up(&ipt_mutex);
-+ return ret;
-+}
-+
-+int
-+visible_ipt_register_match(struct ipt_match *match)
-+{
-+ int ret;
-+ struct module *mod = match->me;
-
-+ if (!ve_is_super(get_exec_env())) {
-+ struct ipt_match *tmp;
-+ __module_get(mod);
-+ ret = -ENOMEM;
-+ tmp = kmalloc(sizeof(struct ipt_match), GFP_KERNEL);
-+ if (!tmp)
-+ goto nomem;
-+ memcpy(tmp, match, sizeof(struct ipt_match));
-+ match = tmp;
-+ }
-+
-+ ret = ipt_register_match(match);
-+ if (ret)
-+ goto out;
-+
-+ return 0;
-+out:
-+ if (!ve_is_super(get_exec_env())) {
-+ kfree(match);
-+nomem:
-+ module_put(mod);
-+ }
- return ret;
- }
-
-@@ -1406,7 +2609,38 @@ void
- ipt_unregister_match(struct ipt_match *match)
- {
- down(&ipt_mutex);
-- LIST_DELETE(&ipt_match, match);
-+ LIST_DELETE(&ve_ipt_match, match);
-+ up(&ipt_mutex);
-+}
-+
-+void
-+visible_ipt_unregister_match(struct ipt_match *match)
-+{
-+ down(&ipt_mutex);
-+ match = list_named_find(&ve_ipt_match, match->name);
-+ up(&ipt_mutex);
-+ if (!match)
-+ return;
-+
-+ ipt_unregister_match(match);
-+
-+ if (!ve_is_super(get_exec_env())) {
-+ module_put(match->me);
-+ kfree(match);
-+ }
-+}
-+
-+void ipt_flush_table(struct ipt_table *table)
-+{
-+ if (table == NULL)
-+ return;
-+
-+ down(&ipt_mutex);
-+ IPT_ENTRY_ITERATE(table->private->tblentries[smp_processor_id()],
-+ table->private->size, cleanup_entry, NULL);
-+ if (table->private->number > table->private->initial_entries)
-+ module_put(table->me);
-+ table->private->size = 0;
- up(&ipt_mutex);
- }
-
-@@ -1414,12 +2648,11 @@ int ipt_register_table(struct ipt_table
- {
- int ret;
- struct ipt_table_info *newinfo;
-- static struct ipt_table_info bootstrap
-- = { 0, 0, 0, { 0 }, { 0 }, { } };
-
-+ ret = -ENOMEM;
- newinfo = ipt_alloc_table_info(table->table->size);
- if (!newinfo)
-- return -ENOMEM;
-+ goto out;
-
- memcpy(newinfo->tblentries[0], table->table->entries, table->table->size);
-
-@@ -1428,52 +2661,54 @@ int ipt_register_table(struct ipt_table
- table->table->num_entries,
- table->table->hook_entry,
- table->table->underflow);
-- if (ret != 0) {
-- ipt_free_table_info(newinfo);
-- return ret;
-- }
-+ if (ret != 0)
-+ goto out_free;
-
- ret = down_interruptible(&ipt_mutex);
-- if (ret != 0) {
-- ipt_free_table_info(newinfo);
-- return ret;
-- }
-+ if (ret != 0)
-+ goto out_free;
-
- /* Don't autoload: we'd eat our tail... */
-- if (list_named_find(&ipt_tables, table->name)) {
-- ret = -EEXIST;
-- goto free_unlock;
-- }
-+ ret = -EEXIST;
-+ if (list_named_find(&ve_ipt_tables, table->name))
-+ goto out_free_unlock;
-
-- /* Simplifies replace_table code. */
-- table->private = &bootstrap;
-- if (!replace_table(table, 0, newinfo, &ret))
-- goto free_unlock;
-+ table->lock = RW_LOCK_UNLOCKED;
-+ ret = setup_table(table, newinfo);
-+ if (ret)
-+ goto out_free_unlock;
-
- duprintf("table->private->number = %u\n",
- table->private->number);
--
-+
- /* save number of initial entries */
- table->private->initial_entries = table->private->number;
-
-- table->lock = RW_LOCK_UNLOCKED;
-- list_prepend(&ipt_tables, table);
-+ list_prepend(&ve_ipt_tables, table);
-
-- unlock:
- up(&ipt_mutex);
-- return ret;
-+ return 0;
-
-- free_unlock:
-+out_free_unlock:
-+ up(&ipt_mutex);
-+out_free:
- ipt_free_table_info(newinfo);
-- goto unlock;
-+out:
-+ return ret;
- }
-
- void ipt_unregister_table(struct ipt_table *table)
- {
- down(&ipt_mutex);
-- LIST_DELETE(&ipt_tables, table);
-+ LIST_DELETE(&ve_ipt_tables, table);
- up(&ipt_mutex);
-
-+ /* size to uncharge taken from ipt_register_table */
-+#if defined(CONFIG_VE_IPTABLES) && defined(CONFIG_USER_RESOURCE)
-+ uncharge_iptables(ipt_table_info_ub(table->private),
-+ table->private->number);
-+#endif
-+
- /* Decrease module usage counts and free resources */
- IPT_ENTRY_ITERATE(table->private->tblentries[0], table->private->size,
- cleanup_entry, NULL);
-@@ -1655,8 +2890,8 @@ udp_checkentry(const char *tablename,
- return 0;
- }
- if (matchinfosize != IPT_ALIGN(sizeof(struct ipt_udp))) {
-- duprintf("ipt_udp: matchsize %u != %u\n",
-- matchinfosize, IPT_ALIGN(sizeof(struct ipt_udp)));
-+ duprintf("ipt_udp: matchsize %u != %u\n", matchinfosize,
-+ (unsigned int)IPT_ALIGN(sizeof(struct ipt_udp)));
- return 0;
- }
- if (udpinfo->invflags & ~IPT_UDP_INV_MASK) {
-@@ -1731,6 +2966,9 @@ icmp_checkentry(const char *tablename,
- /* The built-in targets: standard (NULL) and error. */
- static struct ipt_target ipt_standard_target = {
- .name = IPT_STANDARD_TARGET,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat_ipt_standard_fn,
-+#endif
- };
-
- static struct ipt_target ipt_error_target = {
-@@ -1752,18 +2990,27 @@ static struct ipt_match tcp_matchstruct
- .name = "tcp",
- .match = &tcp_match,
- .checkentry = &tcp_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &tcp_compat,
-+#endif
- };
-
- static struct ipt_match udp_matchstruct = {
- .name = "udp",
- .match = &udp_match,
- .checkentry = &udp_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &udp_compat,
-+#endif
- };
-
- static struct ipt_match icmp_matchstruct = {
- .name = "icmp",
- .match = &icmp_match,
- .checkentry = &icmp_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &icmp_compat,
-+#endif
- };
-
- #ifdef CONFIG_PROC_FS
-@@ -1789,7 +3036,7 @@ static inline int print_target(const str
- off_t start_offset, char *buffer, int length,
- off_t *pos, unsigned int *count)
- {
-- if (t == &ipt_standard_target || t == &ipt_error_target)
-+ if (t == &ve_ipt_standard_target || t == &ve_ipt_error_target)
- return 0;
- return print_name((char *)t, start_offset, buffer, length, pos, count);
- }
-@@ -1799,10 +3046,16 @@ static int ipt_get_tables(char *buffer,
- off_t pos = 0;
- unsigned int count = 0;
-
-+#ifdef CONFIG_VE_IPTABLES
-+ /* if we don't initialized for current VE exiting */
-+ if (&ve_ipt_standard_target == NULL)
-+ return 0;
-+#endif
-+
- if (down_interruptible(&ipt_mutex) != 0)
- return 0;
-
-- LIST_FIND(&ipt_tables, print_name, void *,
-+ LIST_FIND(&ve_ipt_tables, print_name, void *,
- offset, buffer, length, &pos, &count);
-
- up(&ipt_mutex);
-@@ -1817,10 +3070,15 @@ static int ipt_get_targets(char *buffer,
- off_t pos = 0;
- unsigned int count = 0;
-
-+#ifdef CONFIG_VE_IPTABLES
-+ /* if we don't initialized for current VE exiting */
-+ if (&ve_ipt_standard_target == NULL)
-+ return 0;
-+#endif
- if (down_interruptible(&ipt_mutex) != 0)
- return 0;
-
-- LIST_FIND(&ipt_target, print_target, struct ipt_target *,
-+ LIST_FIND(&ve_ipt_target, print_target, struct ipt_target *,
- offset, buffer, length, &pos, &count);
-
- up(&ipt_mutex);
-@@ -1834,10 +3092,15 @@ static int ipt_get_matches(char *buffer,
- off_t pos = 0;
- unsigned int count = 0;
-
-+#ifdef CONFIG_VE_IPTABLES
-+ /* if we don't initialized for current VE exiting */
-+ if (&ve_ipt_standard_target == NULL)
-+ return 0;
-+#endif
- if (down_interruptible(&ipt_mutex) != 0)
- return 0;
-
-- LIST_FIND(&ipt_match, print_name, void *,
-+ LIST_FIND(&ve_ipt_match, print_name, void *,
- offset, buffer, length, &pos, &count);
-
- up(&ipt_mutex);
-@@ -1853,6 +3116,7 @@ static struct { char *name; get_info_t *
- { NULL, NULL} };
- #endif /*CONFIG_PROC_FS*/
-
-+void fini_iptables(void);
- static int __init init(void)
- {
- int ret;
-@@ -1893,11 +3157,132 @@ static int __init init(void)
- #endif
-
- printk("ip_tables: (C) 2000-2002 Netfilter core team\n");
-+
-+#if defined(CONFIG_VE_IPTABLES)
-+ /* init ve0 */
-+ ret = init_iptables();
-+ if (ret == 0) {
-+ KSYMRESOLVE(init_iptables);
-+ KSYMRESOLVE(fini_iptables);
-+ KSYMRESOLVE(ipt_flush_table);
-+ KSYMMODRESOLVE(ip_tables);
-+ }
-+#else
-+ ret = 0;
-+#endif
-+ return ret;
-+}
-+
-+#ifdef CONFIG_VE_IPTABLES
-+/* alloc helper */
-+#define ALLOC_ENVF(field,label) \
-+ if ( !(envid->field = kmalloc(sizeof(*(envid->field)), GFP_KERNEL)) ) \
-+ goto label;
-+int init_iptables(void)
-+{
-+ struct ve_struct *envid;
-+
-+ envid = get_exec_env();
-+
-+ if (ve_is_super(envid)) {
-+ envid->_ipt_target = &ipt_target;
-+ envid->_ipt_match = &ipt_match;
-+ envid->_ipt_tables = &ipt_tables;
-+
-+ envid->_ipt_standard_target = &ipt_standard_target;
-+ envid->_ipt_error_target = &ipt_error_target;
-+ envid->_tcp_matchstruct = &tcp_matchstruct;
-+ envid->_udp_matchstruct = &udp_matchstruct;
-+ envid->_icmp_matchstruct = &icmp_matchstruct;
-+ } else {
-+ /* allocate structures in ve_struct */
-+ ALLOC_ENVF(_ipt_target,nomem0);
-+ ALLOC_ENVF(_ipt_match,nomem1);
-+ ALLOC_ENVF(_ipt_tables,nomem2);
-+ ALLOC_ENVF(_ipt_standard_target,nomem3);
-+ ALLOC_ENVF(_ipt_error_target,nomem4);
-+ ALLOC_ENVF(_tcp_matchstruct,nomem5);
-+ ALLOC_ENVF(_udp_matchstruct,nomem6);
-+ ALLOC_ENVF(_icmp_matchstruct,nomem7);
-+
-+ /* FIXME: charge ubc */
-+ INIT_LIST_HEAD(envid->_ipt_target);
-+ INIT_LIST_HEAD(envid->_ipt_match);
-+ INIT_LIST_HEAD(envid->_ipt_tables);
-+
-+ memcpy(envid->_ipt_standard_target, &ipt_standard_target,
-+ sizeof(ipt_standard_target));
-+ memcpy(envid->_ipt_error_target, &ipt_error_target,
-+ sizeof(ipt_error_target));
-+ memcpy(envid->_tcp_matchstruct, &tcp_matchstruct,
-+ sizeof(tcp_matchstruct));
-+ memcpy(envid->_udp_matchstruct, &udp_matchstruct,
-+ sizeof(udp_matchstruct));
-+ memcpy(envid->_icmp_matchstruct, &icmp_matchstruct,
-+ sizeof(icmp_matchstruct));
-+
-+ down(&ipt_mutex);
-+ list_append(envid->_ipt_target, envid->_ipt_standard_target);
-+ list_append(envid->_ipt_target, envid->_ipt_error_target);
-+ list_append(envid->_ipt_match, envid->_tcp_matchstruct);
-+ list_append(envid->_ipt_match, envid->_udp_matchstruct);
-+ list_append(envid->_ipt_match, envid->_icmp_matchstruct);
-+ up(&ipt_mutex);
-+ }
-+
- return 0;
-+
-+nomem7:
-+ kfree(envid->_udp_matchstruct); envid->_udp_matchstruct = NULL;
-+nomem6:
-+ kfree(envid->_tcp_matchstruct); envid->_tcp_matchstruct = NULL;
-+nomem5:
-+ kfree(envid->_ipt_error_target); envid->_ipt_error_target = NULL;
-+nomem4:
-+ kfree(envid->_ipt_standard_target); envid->_ipt_standard_target = NULL;
-+nomem3:
-+ kfree(envid->_ipt_tables); envid->_ipt_tables = NULL;
-+nomem2:
-+ kfree(envid->_ipt_match); envid->_ipt_match = NULL;
-+nomem1:
-+ kfree(envid->_ipt_target); envid->_ipt_target = NULL;
-+nomem0:
-+ return -ENOMEM;
-+}
-+
-+void fini_iptables(void)
-+{
-+ /* some cleanup */
-+ struct ve_struct *envid = get_exec_env();
-+
-+ if (envid->_ipt_tables != NULL && !ve_is_super(envid)) {
-+ kfree(envid->_ipt_tables);
-+ kfree(envid->_ipt_target);
-+ kfree(envid->_ipt_match);
-+ kfree(envid->_ipt_standard_target);
-+ kfree(envid->_ipt_error_target);
-+ kfree(envid->_tcp_matchstruct);
-+ kfree(envid->_udp_matchstruct);
-+ kfree(envid->_icmp_matchstruct);
-+ }
-+
-+ envid->_ipt_tables = NULL;
-+ envid->_ipt_target = NULL;
-+ envid->_ipt_match = NULL;
-+ envid->_ipt_standard_target = NULL;
-+ envid->_ipt_error_target = NULL;
-+ envid->_tcp_matchstruct = NULL;
-+ envid->_udp_matchstruct = NULL;
-+ envid->_icmp_matchstruct = NULL;
- }
-+#endif
-
- static void __exit fini(void)
- {
-+ KSYMMODUNRESOLVE(ip_tables);
-+ KSYMUNRESOLVE(init_iptables);
-+ KSYMUNRESOLVE(fini_iptables);
-+ KSYMUNRESOLVE(ipt_flush_table);
- nf_unregister_sockopt(&ipt_sockopts);
- #ifdef CONFIG_PROC_FS
- {
-@@ -1906,15 +3291,27 @@ static void __exit fini(void)
- proc_net_remove(ipt_proc_entry[i].name);
- }
- #endif
-+#ifdef CONFIG_VE_IPTABLES
-+ fini_iptables();
-+#endif
- }
-
-+EXPORT_SYMBOL(ipt_flush_table);
- EXPORT_SYMBOL(ipt_register_table);
- EXPORT_SYMBOL(ipt_unregister_table);
- EXPORT_SYMBOL(ipt_register_match);
- EXPORT_SYMBOL(ipt_unregister_match);
- EXPORT_SYMBOL(ipt_do_table);
-+EXPORT_SYMBOL(visible_ipt_register_match);
-+EXPORT_SYMBOL(visible_ipt_unregister_match);
- EXPORT_SYMBOL(ipt_register_target);
- EXPORT_SYMBOL(ipt_unregister_target);
-+EXPORT_SYMBOL(visible_ipt_register_target);
-+EXPORT_SYMBOL(visible_ipt_unregister_target);
-+#ifdef CONFIG_COMPAT
-+EXPORT_SYMBOL(ipt_match_align_compat);
-+EXPORT_SYMBOL(ipt_target_align_compat);
-+#endif
-
--module_init(init);
-+subsys_initcall(init);
- module_exit(fini);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_CLASSIFY.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_CLASSIFY.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_CLASSIFY.c 2004-10-19 01:53:05.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_CLASSIFY.c 2006-10-11 19:07:57.000000000 +0400
-@@ -48,7 +48,8 @@ checkentry(const char *tablename,
- unsigned int hook_mask)
- {
- if (targinfosize != IPT_ALIGN(sizeof(struct ipt_classify_target_info))){
-- printk(KERN_ERR "CLASSIFY: invalid size (%u != %Zu).\n",
-+ ve_printk(VE_LOG, KERN_ERR
-+ "CLASSIFY: invalid size (%u != %Zu).\n",
- targinfosize,
- IPT_ALIGN(sizeof(struct ipt_classify_target_info)));
- return 0;
-@@ -56,13 +57,14 @@ checkentry(const char *tablename,
-
- if (hook_mask & ~((1 << NF_IP_LOCAL_OUT) | (1 << NF_IP_FORWARD) |
- (1 << NF_IP_POST_ROUTING))) {
-- printk(KERN_ERR "CLASSIFY: only valid in LOCAL_OUT, FORWARD "
-+ ve_printk(VE_LOG, KERN_ERR
-+ "CLASSIFY: only valid in LOCAL_OUT, FORWARD "
- "and POST_ROUTING.\n");
- return 0;
- }
-
- if (strcmp(tablename, "mangle") != 0) {
-- printk(KERN_ERR "CLASSIFY: can only be called from "
-+ ve_printk(VE_LOG, KERN_ERR "CLASSIFY: can only be called from "
- "\"mangle\" table, not \"%s\".\n",
- tablename);
- return 0;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_LOG.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_LOG.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_LOG.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_LOG.c 2006-10-11 19:08:01.000000000 +0400
-@@ -18,6 +18,7 @@
- #include <net/udp.h>
- #include <net/tcp.h>
- #include <net/route.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -49,32 +50,32 @@ static void dump_packet(const struct ipt
-
- ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
- if (ih == NULL) {
-- printk("TRUNCATED");
-+ ve_printk(VE_LOG, "TRUNCATED");
- return;
- }
-
- /* Important fields:
- * TOS, len, DF/MF, fragment offset, TTL, src, dst, options. */
- /* Max length: 40 "SRC=255.255.255.255 DST=255.255.255.255 " */
-- printk("SRC=%u.%u.%u.%u DST=%u.%u.%u.%u ",
-+ ve_printk(VE_LOG, "SRC=%u.%u.%u.%u DST=%u.%u.%u.%u ",
- NIPQUAD(ih->saddr), NIPQUAD(ih->daddr));
-
- /* Max length: 46 "LEN=65535 TOS=0xFF PREC=0xFF TTL=255 ID=65535 " */
-- printk("LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ",
-+ ve_printk(VE_LOG, "LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ",
- ntohs(ih->tot_len), ih->tos & IPTOS_TOS_MASK,
- ih->tos & IPTOS_PREC_MASK, ih->ttl, ntohs(ih->id));
-
- /* Max length: 6 "CE DF MF " */
- if (ntohs(ih->frag_off) & IP_CE)
-- printk("CE ");
-+ ve_printk(VE_LOG, "CE ");
- if (ntohs(ih->frag_off) & IP_DF)
-- printk("DF ");
-+ ve_printk(VE_LOG, "DF ");
- if (ntohs(ih->frag_off) & IP_MF)
-- printk("MF ");
-+ ve_printk(VE_LOG, "MF ");
-
- /* Max length: 11 "FRAG:65535 " */
- if (ntohs(ih->frag_off) & IP_OFFSET)
-- printk("FRAG:%u ", ntohs(ih->frag_off) & IP_OFFSET);
-+ ve_printk(VE_LOG, "FRAG:%u ", ntohs(ih->frag_off) & IP_OFFSET);
-
- if ((info->logflags & IPT_LOG_IPOPT)
- && ih->ihl * 4 > sizeof(struct iphdr)) {
-@@ -85,15 +86,15 @@ static void dump_packet(const struct ipt
- op = skb_header_pointer(skb, iphoff+sizeof(_iph),
- optsize, _opt);
- if (op == NULL) {
-- printk("TRUNCATED");
-+ ve_printk(VE_LOG, "TRUNCATED");
- return;
- }
-
- /* Max length: 127 "OPT (" 15*4*2chars ") " */
-- printk("OPT (");
-+ ve_printk(VE_LOG, "OPT (");
- for (i = 0; i < optsize; i++)
-- printk("%02X", op[i]);
-- printk(") ");
-+ ve_printk(VE_LOG, "%02X", op[i]);
-+ ve_printk(VE_LOG, ") ");
- }
-
- switch (ih->protocol) {
-@@ -101,7 +102,7 @@ static void dump_packet(const struct ipt
- struct tcphdr _tcph, *th;
-
- /* Max length: 10 "PROTO=TCP " */
-- printk("PROTO=TCP ");
-+ ve_printk(VE_LOG, "PROTO=TCP ");
-
- if (ntohs(ih->frag_off) & IP_OFFSET)
- break;
-@@ -110,41 +111,41 @@ static void dump_packet(const struct ipt
- th = skb_header_pointer(skb, iphoff + ih->ihl * 4,
- sizeof(_tcph), &_tcph);
- if (th == NULL) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-
- /* Max length: 20 "SPT=65535 DPT=65535 " */
-- printk("SPT=%u DPT=%u ",
-+ ve_printk(VE_LOG, "SPT=%u DPT=%u ",
- ntohs(th->source), ntohs(th->dest));
- /* Max length: 30 "SEQ=4294967295 ACK=4294967295 " */
- if (info->logflags & IPT_LOG_TCPSEQ)
-- printk("SEQ=%u ACK=%u ",
-+ ve_printk(VE_LOG, "SEQ=%u ACK=%u ",
- ntohl(th->seq), ntohl(th->ack_seq));
- /* Max length: 13 "WINDOW=65535 " */
-- printk("WINDOW=%u ", ntohs(th->window));
-+ ve_printk(VE_LOG, "WINDOW=%u ", ntohs(th->window));
- /* Max length: 9 "RES=0x3F " */
-- printk("RES=0x%02x ", (u8)(ntohl(tcp_flag_word(th) & TCP_RESERVED_BITS) >> 22));
-+ ve_printk(VE_LOG, "RES=0x%02x ", (u8)(ntohl(tcp_flag_word(th) & TCP_RESERVED_BITS) >> 22));
- /* Max length: 32 "CWR ECE URG ACK PSH RST SYN FIN " */
- if (th->cwr)
-- printk("CWR ");
-+ ve_printk(VE_LOG, "CWR ");
- if (th->ece)
-- printk("ECE ");
-+ ve_printk(VE_LOG, "ECE ");
- if (th->urg)
-- printk("URG ");
-+ ve_printk(VE_LOG, "URG ");
- if (th->ack)
-- printk("ACK ");
-+ ve_printk(VE_LOG, "ACK ");
- if (th->psh)
-- printk("PSH ");
-+ ve_printk(VE_LOG, "PSH ");
- if (th->rst)
-- printk("RST ");
-+ ve_printk(VE_LOG, "RST ");
- if (th->syn)
-- printk("SYN ");
-+ ve_printk(VE_LOG, "SYN ");
- if (th->fin)
-- printk("FIN ");
-+ ve_printk(VE_LOG, "FIN ");
- /* Max length: 11 "URGP=65535 " */
-- printk("URGP=%u ", ntohs(th->urg_ptr));
-+ ve_printk(VE_LOG, "URGP=%u ", ntohs(th->urg_ptr));
-
- if ((info->logflags & IPT_LOG_TCPOPT)
- && th->doff * 4 > sizeof(struct tcphdr)) {
-@@ -157,15 +158,15 @@ static void dump_packet(const struct ipt
- iphoff+ih->ihl*4+sizeof(_tcph),
- optsize, _opt);
- if (op == NULL) {
-- printk("TRUNCATED");
-+ ve_printk(VE_LOG, "TRUNCATED");
- return;
- }
-
- /* Max length: 127 "OPT (" 15*4*2chars ") " */
-- printk("OPT (");
-+ ve_printk(VE_LOG, "OPT (");
- for (i = 0; i < optsize; i++)
-- printk("%02X", op[i]);
-- printk(") ");
-+ ve_printk(VE_LOG, "%02X", op[i]);
-+ ve_printk(VE_LOG, ") ");
- }
- break;
- }
-@@ -173,7 +174,7 @@ static void dump_packet(const struct ipt
- struct udphdr _udph, *uh;
-
- /* Max length: 10 "PROTO=UDP " */
-- printk("PROTO=UDP ");
-+ ve_printk(VE_LOG, "PROTO=UDP ");
-
- if (ntohs(ih->frag_off) & IP_OFFSET)
- break;
-@@ -182,13 +183,13 @@ static void dump_packet(const struct ipt
- uh = skb_header_pointer(skb, iphoff+ih->ihl*4,
- sizeof(_udph), &_udph);
- if (uh == NULL) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-
- /* Max length: 20 "SPT=65535 DPT=65535 " */
-- printk("SPT=%u DPT=%u LEN=%u ",
-+ ve_printk(VE_LOG, "SPT=%u DPT=%u LEN=%u ",
- ntohs(uh->source), ntohs(uh->dest),
- ntohs(uh->len));
- break;
-@@ -214,7 +215,7 @@ static void dump_packet(const struct ipt
- [ICMP_ADDRESSREPLY] = 12 };
-
- /* Max length: 11 "PROTO=ICMP " */
-- printk("PROTO=ICMP ");
-+ ve_printk(VE_LOG, "PROTO=ICMP ");
-
- if (ntohs(ih->frag_off) & IP_OFFSET)
- break;
-@@ -223,19 +224,19 @@ static void dump_packet(const struct ipt
- ich = skb_header_pointer(skb, iphoff + ih->ihl * 4,
- sizeof(_icmph), &_icmph);
- if (ich == NULL) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-
- /* Max length: 18 "TYPE=255 CODE=255 " */
-- printk("TYPE=%u CODE=%u ", ich->type, ich->code);
-+ ve_printk(VE_LOG, "TYPE=%u CODE=%u ", ich->type, ich->code);
-
- /* Max length: 25 "INCOMPLETE [65535 bytes] " */
- if (ich->type <= NR_ICMP_TYPES
- && required_len[ich->type]
- && skb->len-iphoff-ih->ihl*4 < required_len[ich->type]) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-@@ -244,19 +245,19 @@ static void dump_packet(const struct ipt
- case ICMP_ECHOREPLY:
- case ICMP_ECHO:
- /* Max length: 19 "ID=65535 SEQ=65535 " */
-- printk("ID=%u SEQ=%u ",
-+ ve_printk(VE_LOG, "ID=%u SEQ=%u ",
- ntohs(ich->un.echo.id),
- ntohs(ich->un.echo.sequence));
- break;
-
- case ICMP_PARAMETERPROB:
- /* Max length: 14 "PARAMETER=255 " */
-- printk("PARAMETER=%u ",
-+ ve_printk(VE_LOG, "PARAMETER=%u ",
- ntohl(ich->un.gateway) >> 24);
- break;
- case ICMP_REDIRECT:
- /* Max length: 24 "GATEWAY=255.255.255.255 " */
-- printk("GATEWAY=%u.%u.%u.%u ",
-+ ve_printk(VE_LOG, "GATEWAY=%u.%u.%u.%u ",
- NIPQUAD(ich->un.gateway));
- /* Fall through */
- case ICMP_DEST_UNREACH:
-@@ -264,16 +265,16 @@ static void dump_packet(const struct ipt
- case ICMP_TIME_EXCEEDED:
- /* Max length: 3+maxlen */
- if (!iphoff) { /* Only recurse once. */
-- printk("[");
-+ ve_printk(VE_LOG, "[");
- dump_packet(info, skb,
- iphoff + ih->ihl*4+sizeof(_icmph));
-- printk("] ");
-+ ve_printk(VE_LOG, "] ");
- }
-
- /* Max length: 10 "MTU=65535 " */
- if (ich->type == ICMP_DEST_UNREACH
- && ich->code == ICMP_FRAG_NEEDED)
-- printk("MTU=%u ", ntohs(ich->un.frag.mtu));
-+ ve_printk(VE_LOG, "MTU=%u ", ntohs(ich->un.frag.mtu));
- }
- break;
- }
-@@ -285,26 +286,26 @@ static void dump_packet(const struct ipt
- break;
-
- /* Max length: 9 "PROTO=AH " */
-- printk("PROTO=AH ");
-+ ve_printk(VE_LOG, "PROTO=AH ");
-
- /* Max length: 25 "INCOMPLETE [65535 bytes] " */
- ah = skb_header_pointer(skb, iphoff+ih->ihl*4,
- sizeof(_ahdr), &_ahdr);
- if (ah == NULL) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-
- /* Length: 15 "SPI=0xF1234567 " */
-- printk("SPI=0x%x ", ntohl(ah->spi));
-+ ve_printk(VE_LOG, "SPI=0x%x ", ntohl(ah->spi));
- break;
- }
- case IPPROTO_ESP: {
- struct ip_esp_hdr _esph, *eh;
-
- /* Max length: 10 "PROTO=ESP " */
-- printk("PROTO=ESP ");
-+ ve_printk(VE_LOG, "PROTO=ESP ");
-
- if (ntohs(ih->frag_off) & IP_OFFSET)
- break;
-@@ -313,18 +314,18 @@ static void dump_packet(const struct ipt
- eh = skb_header_pointer(skb, iphoff+ih->ihl*4,
- sizeof(_esph), &_esph);
- if (eh == NULL) {
-- printk("INCOMPLETE [%u bytes] ",
-+ ve_printk(VE_LOG, "INCOMPLETE [%u bytes] ",
- skb->len - iphoff - ih->ihl*4);
- break;
- }
-
- /* Length: 15 "SPI=0xF1234567 " */
-- printk("SPI=0x%x ", ntohl(eh->spi));
-+ ve_printk(VE_LOG, "SPI=0x%x ", ntohl(eh->spi));
- break;
- }
- /* Max length: 10 "PROTO 255 " */
- default:
-- printk("PROTO=%u ", ih->protocol);
-+ ve_printk(VE_LOG, "PROTO=%u ", ih->protocol);
- }
-
- /* Proto Max log string length */
-@@ -351,8 +352,8 @@ ipt_log_packet(unsigned int hooknum,
- const char *prefix)
- {
- spin_lock_bh(&log_lock);
-- printk(level_string);
-- printk("%sIN=%s OUT=%s ",
-+ ve_printk(VE_LOG, level_string);
-+ ve_printk(VE_LOG, "%sIN=%s OUT=%s ",
- prefix == NULL ? loginfo->prefix : prefix,
- in ? in->name : "",
- out ? out->name : "");
-@@ -362,29 +363,29 @@ ipt_log_packet(unsigned int hooknum,
- struct net_device *physoutdev = skb->nf_bridge->physoutdev;
-
- if (physindev && in != physindev)
-- printk("PHYSIN=%s ", physindev->name);
-+ ve_printk(VE_LOG, "PHYSIN=%s ", physindev->name);
- if (physoutdev && out != physoutdev)
-- printk("PHYSOUT=%s ", physoutdev->name);
-+ ve_printk(VE_LOG, "PHYSOUT=%s ", physoutdev->name);
- }
- #endif
-
- if (in && !out) {
- /* MAC logging for input chain only. */
-- printk("MAC=");
-+ ve_printk(VE_LOG, "MAC=");
- if (skb->dev && skb->dev->hard_header_len
- && skb->mac.raw != (void*)skb->nh.iph) {
- int i;
- unsigned char *p = skb->mac.raw;
- for (i = 0; i < skb->dev->hard_header_len; i++,p++)
-- printk("%02x%c", *p,
-+ ve_printk(VE_LOG, "%02x%c", *p,
- i==skb->dev->hard_header_len - 1
- ? ' ':':');
- } else
-- printk(" ");
-+ ve_printk(VE_LOG, " ");
- }
-
- dump_packet(loginfo, skb, 0);
-- printk("\n");
-+ ve_printk(VE_LOG, "\n");
- spin_unlock_bh(&log_lock);
- }
-
-@@ -449,28 +450,62 @@ static int ipt_log_checkentry(const char
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int ipt_log_compat(void *target,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_log_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_log_info));
-+ return ipt_target_align_compat(target, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_target ipt_log_reg = {
- .name = "LOG",
- .target = ipt_log_target,
- .checkentry = ipt_log_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = ipt_log_compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_LOG(void)
-+{
-+ return visible_ipt_register_target(&ipt_log_reg);
-+}
-+
-+void fini_iptable_LOG(void)
-+{
-+ visible_ipt_unregister_target(&ipt_log_reg);
-+}
-+
- static int __init init(void)
- {
-- if (ipt_register_target(&ipt_log_reg))
-- return -EINVAL;
-+ int err;
-+
-+ err = init_iptable_LOG();
-+ if (err < 0)
-+ return err;
- if (nflog)
- nf_log_register(PF_INET, &ipt_logfn);
--
-+
-+ KSYMRESOLVE(init_iptable_LOG);
-+ KSYMRESOLVE(fini_iptable_LOG);
-+ KSYMMODRESOLVE(ipt_LOG);
- return 0;
- }
-
- static void __exit fini(void)
- {
-+ KSYMMODUNRESOLVE(ipt_LOG);
-+ KSYMUNRESOLVE(init_iptable_LOG);
-+ KSYMUNRESOLVE(fini_iptable_LOG);
- if (nflog)
- nf_log_unregister(PF_INET, &ipt_logfn);
-- ipt_unregister_target(&ipt_log_reg);
-+ fini_iptable_LOG();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_MARK.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_MARK.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_MARK.c 2004-10-19 01:54:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_MARK.c 2006-10-11 19:07:57.000000000 +0400
-@@ -44,14 +44,15 @@ checkentry(const char *tablename,
- unsigned int hook_mask)
- {
- if (targinfosize != IPT_ALIGN(sizeof(struct ipt_mark_target_info))) {
-- printk(KERN_WARNING "MARK: targinfosize %u != %Zu\n",
-+ ve_printk(VE_LOG, KERN_WARNING "MARK: targinfosize %u != %Zu\n",
- targinfosize,
- IPT_ALIGN(sizeof(struct ipt_mark_target_info)));
- return 0;
- }
-
- if (strcmp(tablename, "mangle") != 0) {
-- printk(KERN_WARNING "MARK: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
-+ ve_printk(VE_LOG, KERN_WARNING "MARK: can only be called from "
-+ "\"mangle\" table, not \"%s\"\n", tablename);
- return 0;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_MASQUERADE.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_MASQUERADE.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_MASQUERADE.c 2004-10-19 01:54:37.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_MASQUERADE.c 2006-10-11 19:07:57.000000000 +0400
-@@ -140,6 +140,7 @@ masquerade_target(struct sk_buff **pskb,
- return ip_nat_setup_info(ct, &newrange, hooknum);
- }
-
-+#if 0
- static inline int
- device_cmp(const struct ip_conntrack *i, void *_ina)
- {
-@@ -173,6 +174,7 @@ static int masq_inet_event(struct notifi
- static struct notifier_block masq_inet_notifier = {
- .notifier_call = masq_inet_event,
- };
-+#endif
-
- static struct ipt_target masquerade = {
- .name = "MASQUERADE",
-@@ -187,9 +189,13 @@ static int __init init(void)
-
- ret = ipt_register_target(&masquerade);
-
-+#if 0
-+/* This notifier is unnecessary and may
-+ lead to oops in virtual environments */
- if (ret == 0)
- /* Register IP address change reports */
- register_inetaddr_notifier(&masq_inet_notifier);
-+#endif
-
- return ret;
- }
-@@ -197,7 +203,7 @@ static int __init init(void)
- static void __exit fini(void)
- {
- ipt_unregister_target(&masquerade);
-- unregister_inetaddr_notifier(&masq_inet_notifier);
-+/* unregister_inetaddr_notifier(&masq_inet_notifier); */
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_REDIRECT.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_REDIRECT.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_REDIRECT.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_REDIRECT.c 2006-10-11 19:07:57.000000000 +0400
-@@ -17,6 +17,7 @@
- #include <linux/inetdevice.h>
- #include <net/protocol.h>
- #include <net/checksum.h>
-+#include <linux/nfcalls.h>
- #include <linux/netfilter_ipv4.h>
- #include <linux/netfilter_ipv4/ip_nat_rule.h>
-
-@@ -25,7 +26,7 @@ MODULE_AUTHOR("Netfilter Core Team <core
- MODULE_DESCRIPTION("iptables REDIRECT target module");
-
- #if 0
--#define DEBUGP printk
-+#define DEBUGP ve_printk
- #else
- #define DEBUGP(format, args...)
- #endif
-@@ -88,14 +89,18 @@ redirect_target(struct sk_buff **pskb,
- newdst = htonl(0x7F000001);
- else {
- struct in_device *indev;
-+ struct in_ifaddr *ifa;
-
- /* Device might not have an associated in_device. */
- indev = (struct in_device *)(*pskb)->dev->ip_ptr;
- if (indev == NULL || indev->ifa_list == NULL)
- return NF_DROP;
-
-+ ifa = indev->ifa_list;
-+ if (IN_LOOPBACK(ntohl(ifa->ifa_local)) && ifa->ifa_next)
-+ ifa = ifa->ifa_next;
- /* Grab first address on interface. */
-- newdst = indev->ifa_list->ifa_local;
-+ newdst = ifa->ifa_local;
- }
-
- /* Transfer from original range. */
-@@ -115,14 +120,36 @@ static struct ipt_target redirect_reg =
- .me = THIS_MODULE,
- };
-
-+int init_iptable_REDIRECT(void)
-+{
-+ return visible_ipt_register_target(&redirect_reg);
-+}
-+
-+void fini_iptable_REDIRECT(void)
-+{
-+ visible_ipt_unregister_target(&redirect_reg);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_target(&redirect_reg);
-+ int err;
-+
-+ err = init_iptable_REDIRECT();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_REDIRECT);
-+ KSYMRESOLVE(fini_iptable_REDIRECT);
-+ KSYMMODRESOLVE(ipt_REDIRECT);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_target(&redirect_reg);
-+ KSYMMODUNRESOLVE(ipt_REDIRECT);
-+ KSYMUNRESOLVE(init_iptable_REDIRECT);
-+ KSYMUNRESOLVE(fini_iptable_REDIRECT);
-+ fini_iptable_REDIRECT();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_REJECT.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_REJECT.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_REJECT.c 2004-10-19 01:54:55.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_REJECT.c 2006-10-11 19:08:01.000000000 +0400
-@@ -22,6 +22,7 @@
- #include <net/ip.h>
- #include <net/tcp.h>
- #include <net/route.h>
-+#include <linux/nfcalls.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_REJECT.h>
- #ifdef CONFIG_BRIDGE_NETFILTER
-@@ -441,7 +442,7 @@ static int check(const char *tablename,
- }
-
- if (rejinfo->with == IPT_ICMP_ECHOREPLY) {
-- printk("REJECT: ECHOREPLY no longer supported.\n");
-+ ve_printk(VE_LOG, "REJECT: ECHOREPLY no longer supported.\n");
- return 0;
- } else if (rejinfo->with == IPT_TCP_RESET) {
- /* Must specify that it's a TCP packet */
-@@ -455,21 +456,58 @@ static int check(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *target,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_reject_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_reject_info));
-+ return ipt_target_align_compat(target, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_target ipt_reject_reg = {
- .name = "REJECT",
- .target = reject,
- .checkentry = check,
-+#ifdef CONFIG_COMPAT
-+ .compat = compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_REJECT(void)
-+{
-+ return visible_ipt_register_target(&ipt_reject_reg);
-+}
-+
-+void fini_iptable_REJECT(void)
-+{
-+ visible_ipt_unregister_target(&ipt_reject_reg);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_target(&ipt_reject_reg);
-+ int err;
-+
-+ err = init_iptable_REJECT();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_REJECT);
-+ KSYMRESOLVE(fini_iptable_REJECT);
-+ KSYMMODRESOLVE(ipt_REJECT);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_target(&ipt_reject_reg);
-+ KSYMMODUNRESOLVE(ipt_REJECT);
-+ KSYMUNRESOLVE(init_iptable_REJECT);
-+ KSYMUNRESOLVE(fini_iptable_REJECT);
-+ fini_iptable_REJECT();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_TCPMSS.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_TCPMSS.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_TCPMSS.c 2004-10-19 01:54:25.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_TCPMSS.c 2006-10-11 19:08:01.000000000 +0400
-@@ -13,6 +13,7 @@
-
- #include <linux/ip.h>
- #include <net/tcp.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_TCPMSS.h>
-@@ -228,7 +229,8 @@ ipt_tcpmss_checkentry(const char *tablen
- ((hook_mask & ~((1 << NF_IP_FORWARD)
- | (1 << NF_IP_LOCAL_OUT)
- | (1 << NF_IP_POST_ROUTING))) != 0)) {
-- printk("TCPMSS: path-MTU clamping only supported in FORWARD, OUTPUT and POSTROUTING hooks\n");
-+ ve_printk(VE_LOG, "TCPMSS: path-MTU clamping only supported in "
-+ "FORWARD, OUTPUT and POSTROUTING hooks\n");
- return 0;
- }
-
-@@ -237,25 +239,62 @@ ipt_tcpmss_checkentry(const char *tablen
- && IPT_MATCH_ITERATE(e, find_syn_match))
- return 1;
-
-- printk("TCPMSS: Only works on TCP SYN packets\n");
-+ ve_printk(VE_LOG, "TCPMSS: Only works on TCP SYN packets\n");
- return 0;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int ipt_tcpmss_compat(void *target,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_tcpmss_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_tcpmss_info));
-+ return ipt_target_align_compat(target, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_target ipt_tcpmss_reg = {
- .name = "TCPMSS",
- .target = ipt_tcpmss_target,
- .checkentry = ipt_tcpmss_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = ipt_tcpmss_compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_TCPMSS(void)
-+{
-+ return visible_ipt_register_target(&ipt_tcpmss_reg);
-+}
-+
-+void fini_iptable_TCPMSS(void)
-+{
-+ visible_ipt_unregister_target(&ipt_tcpmss_reg);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_target(&ipt_tcpmss_reg);
-+ int err;
-+
-+ err = init_iptable_TCPMSS();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_TCPMSS);
-+ KSYMRESOLVE(fini_iptable_TCPMSS);
-+ KSYMMODRESOLVE(ipt_TCPMSS);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_target(&ipt_tcpmss_reg);
-+ KSYMMODUNRESOLVE(ipt_TCPMSS);
-+ KSYMUNRESOLVE(init_iptable_TCPMSS);
-+ KSYMUNRESOLVE(fini_iptable_TCPMSS);
-+ fini_iptable_TCPMSS();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_TOS.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_TOS.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_TOS.c 2004-10-19 01:53:09.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_TOS.c 2006-10-11 19:08:01.000000000 +0400
-@@ -15,6 +15,7 @@
-
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_TOS.h>
-+#include <linux/nfcalls.h>
-
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
-@@ -61,14 +62,15 @@ checkentry(const char *tablename,
- const u_int8_t tos = ((struct ipt_tos_target_info *)targinfo)->tos;
-
- if (targinfosize != IPT_ALIGN(sizeof(struct ipt_tos_target_info))) {
-- printk(KERN_WARNING "TOS: targinfosize %u != %Zu\n",
-+ ve_printk(VE_LOG, KERN_WARNING "TOS: targinfosize %u != %Zu\n",
- targinfosize,
- IPT_ALIGN(sizeof(struct ipt_tos_target_info)));
- return 0;
- }
-
- if (strcmp(tablename, "mangle") != 0) {
-- printk(KERN_WARNING "TOS: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
-+ ve_printk(VE_LOG, KERN_WARNING "TOS: can only be called from "
-+ "\"mangle\" table, not \"%s\"\n", tablename);
- return 0;
- }
-
-@@ -77,28 +79,65 @@ checkentry(const char *tablename,
- && tos != IPTOS_RELIABILITY
- && tos != IPTOS_MINCOST
- && tos != IPTOS_NORMALSVC) {
-- printk(KERN_WARNING "TOS: bad tos value %#x\n", tos);
-+ ve_printk(VE_LOG, KERN_WARNING "TOS: bad tos value %#x\n", tos);
- return 0;
- }
-
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *target,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_tos_target_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_tos_target_info));
-+ return ipt_target_align_compat(target, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_target ipt_tos_reg = {
- .name = "TOS",
- .target = target,
- .checkentry = checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_TOS(void)
-+{
-+ return visible_ipt_register_target(&ipt_tos_reg);
-+}
-+
-+void fini_iptable_TOS(void)
-+{
-+ visible_ipt_unregister_target(&ipt_tos_reg);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_target(&ipt_tos_reg);
-+ int err;
-+
-+ err = init_iptable_TOS();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_TOS);
-+ KSYMRESOLVE(fini_iptable_TOS);
-+ KSYMMODRESOLVE(ipt_TOS);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_target(&ipt_tos_reg);
-+ KSYMMODUNRESOLVE(ipt_TOS);
-+ KSYMUNRESOLVE(init_iptable_TOS);
-+ KSYMUNRESOLVE(fini_iptable_TOS);
-+ fini_iptable_TOS();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_ULOG.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_ULOG.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_ULOG.c 2004-10-19 01:53:46.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_ULOG.c 2006-10-11 19:07:57.000000000 +0400
-@@ -129,6 +129,9 @@ static void ulog_send(unsigned int nlgro
- /* timer function to flush queue in flushtimeout time */
- static void ulog_timer(unsigned long data)
- {
-+#ifdef CONFIG_VE
-+#error timer context should be evaluated
-+#endif
- DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n");
-
- /* lock to protect against somebody modifying our structure
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_conntrack.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_conntrack.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_conntrack.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_conntrack.c 2006-10-11 19:08:01.000000000 +0400
-@@ -114,10 +114,112 @@ static int check(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat_to_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct ipt_entry_match *pm;
-+ struct ipt_conntrack_info *pinfo;
-+ struct compat_ipt_conntrack_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct ipt_entry_match *)match;
-+ msize = pm->u.user.match_size;
-+ if (__copy_to_user(*dstptr, pm, sizeof(struct ipt_entry_match)))
-+ return -EFAULT;
-+ pinfo = (struct ipt_conntrack_info *)pm->data;
-+ memset(&info, 0, sizeof(struct compat_ipt_conntrack_info));
-+ info.statemask = pinfo->statemask;
-+ info.statusmask = pinfo->statusmask;
-+ memcpy(info.tuple, pinfo->tuple, IP_CT_DIR_MAX *
-+ sizeof(struct ip_conntrack_tuple));
-+ memcpy(info.sipmsk, pinfo->sipmsk,
-+ IP_CT_DIR_MAX * sizeof(struct in_addr));
-+ memcpy(info.dipmsk, pinfo->dipmsk,
-+ IP_CT_DIR_MAX * sizeof(struct in_addr));
-+ info.expires_min = pinfo->expires_min;
-+ info.expires_max = pinfo->expires_max;
-+ info.flags = pinfo->flags;
-+ info.invflags = pinfo->invflags;
-+ if (__copy_to_user(*dstptr + sizeof(struct ipt_entry_match),
-+ &info, sizeof(struct compat_ipt_conntrack_info)))
-+ return -EFAULT;
-+ msize -= off;
-+ if (put_user(msize, (u_int16_t *)*dstptr))
-+ return -EFAULT;
-+ *size -= off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat_from_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct compat_ipt_entry_match *pm;
-+ struct ipt_entry_match *dstpm;
-+ struct compat_ipt_conntrack_info *pinfo;
-+ struct ipt_conntrack_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct compat_ipt_entry_match *)match;
-+ dstpm = (struct ipt_entry_match *)*dstptr;
-+ msize = pm->u.user.match_size;
-+ memcpy(*dstptr, pm, sizeof(struct compat_ipt_entry_match));
-+ pinfo = (struct compat_ipt_conntrack_info *)pm->data;
-+ memset(&info, 0, sizeof(struct ipt_conntrack_info));
-+ info.statemask = pinfo->statemask;
-+ info.statusmask = pinfo->statusmask;
-+ memcpy(info.tuple, pinfo->tuple, IP_CT_DIR_MAX *
-+ sizeof(struct ip_conntrack_tuple));
-+ memcpy(info.sipmsk, pinfo->sipmsk,
-+ IP_CT_DIR_MAX * sizeof(struct in_addr));
-+ memcpy(info.dipmsk, pinfo->dipmsk,
-+ IP_CT_DIR_MAX * sizeof(struct in_addr));
-+ info.expires_min = pinfo->expires_min;
-+ info.expires_max = pinfo->expires_max;
-+ info.flags = pinfo->flags;
-+ info.invflags = pinfo->invflags;
-+ memcpy(*dstptr + sizeof(struct compat_ipt_entry_match),
-+ &info, sizeof(struct ipt_conntrack_info));
-+ msize += off;
-+ dstpm->u.user.match_size = msize;
-+ *size += off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat(void *match, void **dstptr, int *size, int convert)
-+{
-+ int ret, off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_conntrack_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct compat_ipt_conntrack_info));
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ ret = compat_to_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_FROM_USER:
-+ ret = compat_from_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ ret = 0;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+#endif
-+
- static struct ipt_match conntrack_match = {
- .name = "conntrack",
- .match = &match,
- .checkentry = &check,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_helper.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_helper.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_helper.c 2004-10-19 01:55:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_helper.c 2006-10-11 19:08:01.000000000 +0400
-@@ -18,6 +18,7 @@
- #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_helper.h>
-+#include <linux/nfcalls.h>
-
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Martin Josefsson <gandalf@netfilter.org>");
-@@ -98,22 +99,126 @@ static int check(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat_to_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct ipt_entry_match *pm;
-+ struct ipt_helper_info *pinfo;
-+ struct compat_ipt_helper_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct ipt_entry_match *)match;
-+ msize = pm->u.user.match_size;
-+ if (__copy_to_user(*dstptr, pm, sizeof(struct ipt_entry_match)))
-+ return -EFAULT;
-+ pinfo = (struct ipt_helper_info *)pm->data;
-+ memset(&info, 0, sizeof(struct compat_ipt_helper_info));
-+ info.invert = pinfo->invert;
-+ memcpy(info.name, pinfo->name, 30);
-+ if (__copy_to_user(*dstptr + sizeof(struct ipt_entry_match),
-+ &info, sizeof(struct compat_ipt_helper_info)))
-+ return -EFAULT;
-+ msize -= off;
-+ if (put_user(msize, (u_int16_t *)*dstptr))
-+ return -EFAULT;
-+ *size -= off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat_from_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct compat_ipt_entry_match *pm;
-+ struct ipt_entry_match *dstpm;
-+ struct compat_ipt_helper_info *pinfo;
-+ struct ipt_helper_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct compat_ipt_entry_match *)match;
-+ dstpm = (struct ipt_entry_match *)*dstptr;
-+ msize = pm->u.user.match_size;
-+ memcpy(*dstptr, pm, sizeof(struct compat_ipt_entry_match));
-+ pinfo = (struct compat_ipt_helper_info *)pm->data;
-+ memset(&info, 0, sizeof(struct ipt_helper_info));
-+ info.invert = pinfo->invert;
-+ memcpy(info.name, pinfo->name, 30);
-+ memcpy(*dstptr + sizeof(struct compat_ipt_entry_match),
-+ &info, sizeof(struct ipt_helper_info));
-+ msize += off;
-+ dstpm->u.user.match_size = msize;
-+ *size += off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat(void *match, void **dstptr, int *size, int convert)
-+{
-+ int ret, off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_helper_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct compat_ipt_helper_info));
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ ret = compat_to_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_FROM_USER:
-+ ret = compat_from_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ ret = 0;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+#endif
-+
- static struct ipt_match helper_match = {
- .name = "helper",
- .match = &match,
- .checkentry = &check,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_helper(void)
-+{
-+ return visible_ipt_register_match(&helper_match);
-+}
-+
-+void fini_iptable_helper(void)
-+{
-+ visible_ipt_unregister_match(&helper_match);
-+}
-+
- static int __init init(void)
- {
- need_ip_conntrack();
-- return ipt_register_match(&helper_match);
-+ int err;
-+
-+ err = init_iptable_helper();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_helper);
-+ KSYMRESOLVE(fini_iptable_helper);
-+ KSYMMODRESOLVE(ipt_helper);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&helper_match);
-+ KSYMMODUNRESOLVE(ipt_helper);
-+ KSYMUNRESOLVE(init_iptable_helper);
-+ KSYMUNRESOLVE(fini_iptable_helper);
-+ fini_iptable_helper();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_length.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_length.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_length.c 2004-10-19 01:54:40.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_length.c 2006-10-11 19:08:01.000000000 +0400
-@@ -8,6 +8,7 @@
-
- #include <linux/module.h>
- #include <linux/skbuff.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_length.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -43,21 +44,58 @@ checkentry(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_length_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_length_info));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_match length_match = {
- .name = "length",
- .match = &match,
- .checkentry = &checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_length(void)
-+{
-+ return visible_ipt_register_match(&length_match);
-+}
-+
-+void fini_iptable_length(void)
-+{
-+ visible_ipt_unregister_match(&length_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&length_match);
-+ int err;
-+
-+ err = init_iptable_length();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_length);
-+ KSYMRESOLVE(fini_iptable_length);
-+ KSYMMODRESOLVE(ipt_length);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&length_match);
-+ KSYMMODUNRESOLVE(ipt_length);
-+ KSYMUNRESOLVE(init_iptable_length);
-+ KSYMUNRESOLVE(fini_iptable_length);
-+ fini_iptable_length();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_limit.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_limit.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_limit.c 2004-10-19 01:53:09.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_limit.c 2006-10-11 19:08:01.000000000 +0400
-@@ -17,6 +17,7 @@
- #include <linux/skbuff.h>
- #include <linux/spinlock.h>
- #include <linux/interrupt.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_limit.h>
-@@ -25,6 +26,13 @@ MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Herve Eychenne <rv@wallfire.org>");
- MODULE_DESCRIPTION("iptables rate limit match");
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_ipt_limit_reg (*(get_exec_env()->_ipt_limit_reg))
-+#else
-+#define ve_ipt_limit_reg ipt_limit_reg
-+#endif
-+
- /* The algorithm used is the Simple Token Bucket Filter (TBF)
- * see net/sched/sch_tbf.c in the linux source tree
- */
-@@ -116,7 +124,7 @@ ipt_limit_checkentry(const char *tablena
- /* Check for overflow. */
- if (r->burst == 0
- || user2credits(r->avg * r->burst) < user2credits(r->avg)) {
-- printk("Overflow in ipt_limit, try lower: %u/%u\n",
-+ ve_printk(VE_LOG, "Overflow in ipt_limit, try lower: %u/%u\n",
- r->avg, r->burst);
- return 0;
- }
-@@ -134,23 +142,128 @@ ipt_limit_checkentry(const char *tablena
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int ipt_limit_compat_to_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct ipt_entry_match *pm;
-+ struct ipt_rateinfo *pinfo;
-+ struct compat_ipt_rateinfo rinfo;
-+ u_int16_t msize;
-+
-+ pm = (struct ipt_entry_match *)match;
-+ msize = pm->u.user.match_size;
-+ if (__copy_to_user(*dstptr, pm, sizeof(struct ipt_entry_match)))
-+ return -EFAULT;
-+ pinfo = (struct ipt_rateinfo *)pm->data;
-+ memset(&rinfo, 0, sizeof(struct compat_ipt_rateinfo));
-+ rinfo.avg = pinfo->avg;
-+ rinfo.burst = pinfo->burst;
-+ if (__copy_to_user(*dstptr + sizeof(struct ipt_entry_match),
-+ &rinfo, sizeof(struct compat_ipt_rateinfo)))
-+ return -EFAULT;
-+ msize -= off;
-+ if (put_user(msize, (u_int16_t *)*dstptr))
-+ return -EFAULT;
-+ *size -= off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int ipt_limit_compat_from_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct compat_ipt_entry_match *pm;
-+ struct ipt_entry_match *dstpm;
-+ struct compat_ipt_rateinfo *pinfo;
-+ struct ipt_rateinfo rinfo;
-+ u_int16_t msize;
-+
-+ pm = (struct compat_ipt_entry_match *)match;
-+ dstpm = (struct ipt_entry_match *)*dstptr;
-+ msize = pm->u.user.match_size;
-+ memcpy(*dstptr, pm, sizeof(struct compat_ipt_entry_match));
-+ pinfo = (struct compat_ipt_rateinfo *)pm->data;
-+ memset(&rinfo, 0, sizeof(struct ipt_rateinfo));
-+ rinfo.avg = pinfo->avg;
-+ rinfo.burst = pinfo->burst;
-+ memcpy(*dstptr + sizeof(struct compat_ipt_entry_match),
-+ &rinfo, sizeof(struct ipt_rateinfo));
-+ msize += off;
-+ dstpm->u.user.match_size = msize;
-+ *size += off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int ipt_limit_compat(void *match, void **dstptr,
-+ int *size, int convert)
-+{
-+ int ret, off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_rateinfo)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct compat_ipt_rateinfo));
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ ret = ipt_limit_compat_to_user(match,
-+ dstptr, size, off);
-+ break;
-+ case COMPAT_FROM_USER:
-+ ret = ipt_limit_compat_from_user(match,
-+ dstptr, size, off);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ ret = 0;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+#endif
-+
- static struct ipt_match ipt_limit_reg = {
- .name = "limit",
- .match = ipt_limit_match,
- .checkentry = ipt_limit_checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = ipt_limit_compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_limit(void)
-+{
-+ return visible_ipt_register_match(&ipt_limit_reg);
-+}
-+
-+void fini_iptable_limit(void)
-+{
-+ visible_ipt_unregister_match(&ipt_limit_reg);
-+}
-+
- static int __init init(void)
- {
-- if (ipt_register_match(&ipt_limit_reg))
-- return -EINVAL;
-+ int err;
-+
-+ err = init_iptable_limit();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_limit);
-+ KSYMRESOLVE(fini_iptable_limit);
-+ KSYMMODRESOLVE(ipt_limit);
- return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&ipt_limit_reg);
-+ KSYMMODUNRESOLVE(ipt_limit);
-+ KSYMUNRESOLVE(init_iptable_limit);
-+ KSYMUNRESOLVE(fini_iptable_limit);
-+ fini_iptable_limit();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_mac.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_mac.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_mac.c 2004-10-19 01:53:13.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_mac.c 2006-10-11 19:07:57.000000000 +0400
-@@ -48,7 +48,8 @@ ipt_mac_checkentry(const char *tablename
- if (hook_mask
- & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN)
- | (1 << NF_IP_FORWARD))) {
-- printk("ipt_mac: only valid for PRE_ROUTING, LOCAL_IN or FORWARD.\n");
-+ ve_printk(VE_LOG, "ipt_mac: only valid for PRE_ROUTING, "
-+ "LOCAL_IN or FORWARD.\n");
- return 0;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_multiport.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_multiport.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_multiport.c 2004-10-19 01:53:23.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_multiport.c 2006-10-11 19:08:01.000000000 +0400
-@@ -13,6 +13,7 @@
- #include <linux/types.h>
- #include <linux/udp.h>
- #include <linux/skbuff.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_multiport.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -21,6 +22,13 @@ MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
- MODULE_DESCRIPTION("iptables multiple port match module");
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_multiport_match (*(get_exec_env()->_multiport_match))
-+#else
-+#define ve_multiport_match multiport_match
-+#endif
-+
- #if 0
- #define duprintf(format, args...) printk(format , ## args)
- #else
-@@ -103,21 +111,58 @@ checkentry(const char *tablename,
- && multiinfo->count <= IPT_MULTI_PORTS;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_multiport)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_multiport));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_match multiport_match = {
- .name = "multiport",
- .match = &match,
- .checkentry = &checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_multiport(void)
-+{
-+ return visible_ipt_register_match(&multiport_match);
-+}
-+
-+void fini_iptable_multiport(void)
-+{
-+ visible_ipt_unregister_match(&multiport_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&multiport_match);
-+ int err;
-+
-+ err = init_iptable_multiport();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_multiport);
-+ KSYMRESOLVE(fini_iptable_multiport);
-+ KSYMMODRESOLVE(ipt_multiport);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&multiport_match);
-+ KSYMMODUNRESOLVE(ipt_multiport);
-+ KSYMUNRESOLVE(init_iptable_multiport);
-+ KSYMUNRESOLVE(fini_iptable_multiport);
-+ fini_iptable_multiport();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_owner.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_owner.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_owner.c 2004-10-19 01:55:24.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_owner.c 2006-10-11 19:07:57.000000000 +0400
-@@ -12,6 +12,7 @@
- #include <linux/skbuff.h>
- #include <linux/file.h>
- #include <net/sock.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_owner.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -23,12 +24,13 @@ MODULE_DESCRIPTION("iptables owner match
- static int
- match_comm(const struct sk_buff *skb, const char *comm)
- {
-+#ifndef CONFIG_VE
- struct task_struct *g, *p;
- struct files_struct *files;
- int i;
-
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_ve(g, p) {
- if(strncmp(p->comm, comm, sizeof(p->comm)))
- continue;
-
-@@ -48,20 +50,22 @@ match_comm(const struct sk_buff *skb, co
- spin_unlock(&files->file_lock);
- }
- task_unlock(p);
-- } while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- read_unlock(&tasklist_lock);
-+#endif
- return 0;
- }
-
- static int
- match_pid(const struct sk_buff *skb, pid_t pid)
- {
-+#ifndef CONFIG_VE
- struct task_struct *p;
- struct files_struct *files;
- int i;
-
- read_lock(&tasklist_lock);
-- p = find_task_by_pid(pid);
-+ p = find_task_by_pid_ve(pid);
- if (!p)
- goto out;
- task_lock(p);
-@@ -82,18 +86,20 @@ match_pid(const struct sk_buff *skb, pid
- task_unlock(p);
- out:
- read_unlock(&tasklist_lock);
-+#endif
- return 0;
- }
-
- static int
- match_sid(const struct sk_buff *skb, pid_t sid)
- {
-+#ifndef CONFIG_VE
- struct task_struct *g, *p;
- struct file *file = skb->sk->sk_socket->file;
- int i, found=0;
-
- read_lock(&tasklist_lock);
-- do_each_thread(g, p) {
-+ do_each_thread_ve(g, p) {
- struct files_struct *files;
- if (p->signal->session != sid)
- continue;
-@@ -113,11 +119,14 @@ match_sid(const struct sk_buff *skb, pid
- task_unlock(p);
- if (found)
- goto out;
-- } while_each_thread(g, p);
-+ } while_each_thread_ve(g, p);
- out:
- read_unlock(&tasklist_lock);
-
- return found;
-+#else
-+ return 0;
-+#endif
- }
-
- static int
-@@ -203,14 +212,36 @@ static struct ipt_match owner_match = {
- .me = THIS_MODULE,
- };
-
-+static int init_iptable_owner(void)
-+{
-+ return visible_ipt_register_match(&owner_match);
-+}
-+
-+static void fini_iptable_owner(void)
-+{
-+ visible_ipt_unregister_match(&owner_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&owner_match);
-+ int err;
-+
-+ err = init_iptable_owner();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_owner);
-+ KSYMRESOLVE(fini_iptable_owner);
-+ KSYMMODRESOLVE(ipt_owner);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&owner_match);
-+ KSYMMODUNRESOLVE(ipt_owner);
-+ KSYMUNRESOLVE(init_iptable_owner);
-+ KSYMUNRESOLVE(fini_iptable_owner);
-+ fini_iptable_owner();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_state.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_state.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_state.c 2004-10-19 01:55:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_state.c 2006-10-11 19:08:01.000000000 +0400
-@@ -10,6 +10,7 @@
-
- #include <linux/module.h>
- #include <linux/skbuff.h>
-+#include <linux/nfcalls.h>
- #include <linux/netfilter_ipv4/ip_conntrack.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
- #include <linux/netfilter_ipv4/ipt_state.h>
-@@ -52,22 +53,124 @@ static int check(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat_to_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct ipt_entry_match *pm;
-+ struct ipt_state_info *pinfo;
-+ struct compat_ipt_state_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct ipt_entry_match *)match;
-+ msize = pm->u.user.match_size;
-+ if (__copy_to_user(*dstptr, pm, sizeof(struct ipt_entry_match)))
-+ return -EFAULT;
-+ pinfo = (struct ipt_state_info *)pm->data;
-+ memset(&info, 0, sizeof(struct compat_ipt_state_info));
-+ info.statemask = pinfo->statemask;
-+ if (__copy_to_user(*dstptr + sizeof(struct ipt_entry_match),
-+ &info, sizeof(struct compat_ipt_state_info)))
-+ return -EFAULT;
-+ msize -= off;
-+ if (put_user(msize, (u_int16_t *)*dstptr))
-+ return -EFAULT;
-+ *size -= off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat_from_user(void *match, void **dstptr,
-+ int *size, int off)
-+{
-+ struct compat_ipt_entry_match *pm;
-+ struct ipt_entry_match *dstpm;
-+ struct compat_ipt_state_info *pinfo;
-+ struct ipt_state_info info;
-+ u_int16_t msize;
-+
-+ pm = (struct compat_ipt_entry_match *)match;
-+ dstpm = (struct ipt_entry_match *)*dstptr;
-+ msize = pm->u.user.match_size;
-+ memcpy(*dstptr, pm, sizeof(struct compat_ipt_entry_match));
-+ pinfo = (struct compat_ipt_state_info *)pm->data;
-+ memset(&info, 0, sizeof(struct ipt_state_info));
-+ info.statemask = pinfo->statemask;
-+ memcpy(*dstptr + sizeof(struct compat_ipt_entry_match),
-+ &info, sizeof(struct ipt_state_info));
-+ msize += off;
-+ dstpm->u.user.match_size = msize;
-+ *size += off;
-+ *dstptr += msize;
-+ return 0;
-+}
-+
-+static int compat(void *match, void **dstptr, int *size, int convert)
-+{
-+ int ret, off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_state_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct compat_ipt_state_info));
-+ switch (convert) {
-+ case COMPAT_TO_USER:
-+ ret = compat_to_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_FROM_USER:
-+ ret = compat_from_user(match, dstptr, size, off);
-+ break;
-+ case COMPAT_CALC_SIZE:
-+ *size += off;
-+ ret = 0;
-+ break;
-+ default:
-+ ret = -ENOPROTOOPT;
-+ break;
-+ }
-+ return ret;
-+}
-+#endif
-+
- static struct ipt_match state_match = {
- .name = "state",
- .match = &match,
- .checkentry = &check,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_state(void)
-+{
-+ return visible_ipt_register_match(&state_match);
-+}
-+
-+void fini_iptable_state(void)
-+{
-+ visible_ipt_unregister_match(&state_match);
-+}
-+
- static int __init init(void)
- {
-+ int err;
-+
- need_ip_conntrack();
-- return ipt_register_match(&state_match);
-+ err = init_iptable_state();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_state);
-+ KSYMRESOLVE(fini_iptable_state);
-+ KSYMMODRESOLVE(ipt_state);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&state_match);
-+ KSYMMODUNRESOLVE(ipt_state);
-+ KSYMUNRESOLVE(init_iptable_state);
-+ KSYMUNRESOLVE(fini_iptable_state);
-+ fini_iptable_state();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_tcpmss.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_tcpmss.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_tcpmss.c 2004-10-19 01:53:21.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_tcpmss.c 2006-10-11 19:08:01.000000000 +0400
-@@ -10,6 +10,7 @@
- #include <linux/module.h>
- #include <linux/skbuff.h>
- #include <net/tcp.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_tcpmss.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -111,28 +112,65 @@ checkentry(const char *tablename,
-
- /* Must specify -p tcp */
- if (ip->proto != IPPROTO_TCP || (ip->invflags & IPT_INV_PROTO)) {
-- printk("tcpmss: Only works on TCP packets\n");
-+ ve_printk(VE_LOG, "tcpmss: Only works on TCP packets\n");
- return 0;
- }
-
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_tcpmss_match_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_tcpmss_match_info));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_match tcpmss_match = {
- .name = "tcpmss",
- .match = &match,
- .checkentry = &checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_tcpmss(void)
-+{
-+ return visible_ipt_register_match(&tcpmss_match);
-+}
-+
-+void fini_iptable_tcpmss(void)
-+{
-+ visible_ipt_unregister_match(&tcpmss_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&tcpmss_match);
-+ int err;
-+
-+ err = init_iptable_tcpmss();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_tcpmss);
-+ KSYMRESOLVE(fini_iptable_tcpmss);
-+ KSYMMODRESOLVE(ipt_tcpmss);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&tcpmss_match);
-+ KSYMMODUNRESOLVE(ipt_tcpmss);
-+ KSYMUNRESOLVE(init_iptable_tcpmss);
-+ KSYMUNRESOLVE(fini_iptable_tcpmss);
-+ fini_iptable_tcpmss();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_tos.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_tos.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_tos.c 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_tos.c 2006-10-11 19:08:01.000000000 +0400
-@@ -10,6 +10,7 @@
-
- #include <linux/module.h>
- #include <linux/skbuff.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_tos.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -17,6 +18,13 @@
- MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION("iptables TOS match module");
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_tos_match (*(get_exec_env()->_tos_match))
-+#else
-+#define ve_tos_match tos_match
-+#endif
-+
- static int
- match(const struct sk_buff *skb,
- const struct net_device *in,
-@@ -43,21 +51,58 @@ checkentry(const char *tablename,
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_tos_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_tos_info));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_match tos_match = {
- .name = "tos",
- .match = &match,
- .checkentry = &checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_tos(void)
-+{
-+ return visible_ipt_register_match(&tos_match);
-+}
-+
-+void fini_iptable_tos(void)
-+{
-+ visible_ipt_unregister_match(&tos_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&tos_match);
-+ int err;
-+
-+ err = init_iptable_tos();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_tos);
-+ KSYMRESOLVE(fini_iptable_tos);
-+ KSYMMODRESOLVE(ipt_tos);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&tos_match);
-+ KSYMMODUNRESOLVE(ipt_tos);
-+ KSYMUNRESOLVE(init_iptable_tos);
-+ KSYMUNRESOLVE(fini_iptable_tos);
-+ fini_iptable_tos();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_ttl.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_ttl.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/ipt_ttl.c 2004-10-19 01:55:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/ipt_ttl.c 2006-10-11 19:08:01.000000000 +0400
-@@ -11,6 +11,7 @@
-
- #include <linux/module.h>
- #include <linux/skbuff.h>
-+#include <linux/nfcalls.h>
-
- #include <linux/netfilter_ipv4/ipt_ttl.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-@@ -57,22 +58,58 @@ static int checkentry(const char *tablen
- return 1;
- }
-
-+#ifdef CONFIG_COMPAT
-+static int compat(void *match,
-+ void **dstptr, int *size, int convert)
-+{
-+ int off;
-+
-+ off = IPT_ALIGN(sizeof(struct ipt_ttl_info)) -
-+ COMPAT_IPT_ALIGN(sizeof(struct ipt_ttl_info));
-+ return ipt_match_align_compat(match, dstptr, size, off, convert);
-+}
-+#endif
-+
- static struct ipt_match ttl_match = {
- .name = "ttl",
- .match = &match,
- .checkentry = &checkentry,
-+#ifdef CONFIG_COMPAT
-+ .compat = &compat,
-+#endif
- .me = THIS_MODULE,
- };
-
-+int init_iptable_ttl(void)
-+{
-+ return visible_ipt_register_match(&ttl_match);
-+}
-+
-+void fini_iptable_ttl(void)
-+{
-+ visible_ipt_unregister_match(&ttl_match);
-+}
-+
- static int __init init(void)
- {
-- return ipt_register_match(&ttl_match);
-+ int err;
-+
-+ err = init_iptable_ttl();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_ttl);
-+ KSYMRESOLVE(fini_iptable_ttl);
-+ KSYMMODRESOLVE(ipt_ttl);
-+ return 0;
- }
-
- static void __exit fini(void)
- {
-- ipt_unregister_match(&ttl_match);
--
-+ KSYMMODUNRESOLVE(ipt_ttl);
-+ KSYMUNRESOLVE(init_iptable_ttl);
-+ KSYMUNRESOLVE(fini_iptable_ttl);
-+ fini_iptable_ttl();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/iptable_filter.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/iptable_filter.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/iptable_filter.c 2004-10-19 01:53:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/iptable_filter.c 2006-10-11 19:07:57.000000000 +0400
-@@ -12,12 +12,23 @@
-
- #include <linux/module.h>
- #include <linux/moduleparam.h>
-+#include <linux/nfcalls.h>
- #include <linux/netfilter_ipv4/ip_tables.h>
-+#include <ub/ub_mem.h>
-
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
- MODULE_DESCRIPTION("iptables filter table");
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_packet_filter (*(get_exec_env()->_ve_ipt_filter_pf))
-+#define ve_ipt_ops (get_exec_env()->_ve_ipt_filter_io)
-+#else
-+#define ve_packet_filter packet_filter
-+#define ve_ipt_ops ipt_ops
-+#endif
-+
- #define FILTER_VALID_HOOKS ((1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) | (1 << NF_IP_LOCAL_OUT))
-
- /* Standard entry. */
-@@ -39,12 +50,12 @@ struct ipt_error
- struct ipt_error_target target;
- };
-
--static struct
-+static struct ipt_filter_initial_table
- {
- struct ipt_replace repl;
- struct ipt_standard entries[3];
- struct ipt_error term;
--} initial_table __initdata
-+} initial_table
- = { { "filter", FILTER_VALID_HOOKS, 4,
- sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
- { [NF_IP_LOCAL_IN] = 0,
-@@ -109,7 +120,7 @@ ipt_hook(unsigned int hook,
- const struct net_device *out,
- int (*okfn)(struct sk_buff *))
- {
-- return ipt_do_table(pskb, hook, in, out, &packet_filter, NULL);
-+ return ipt_do_table(pskb, hook, in, out, &ve_packet_filter, NULL);
- }
-
- static unsigned int
-@@ -127,7 +138,7 @@ ipt_local_out_hook(unsigned int hook,
- return NF_ACCEPT;
- }
-
-- return ipt_do_table(pskb, hook, in, out, &packet_filter, NULL);
-+ return ipt_do_table(pskb, hook, in, out, &ve_packet_filter, NULL);
- }
-
- static struct nf_hook_ops ipt_ops[] = {
-@@ -158,56 +169,161 @@ static struct nf_hook_ops ipt_ops[] = {
- static int forward = NF_ACCEPT;
- module_param(forward, bool, 0000);
-
--static int __init init(void)
-+#ifdef CONFIG_VE_IPTABLES
-+static void init_ve0_iptable_filter(struct ve_struct *envid)
-+{
-+ envid->_ipt_filter_initial_table = &initial_table;
-+ envid->_ve_ipt_filter_pf = &packet_filter;
-+ envid->_ve_ipt_filter_io = ipt_ops;
-+}
-+#endif
-+
-+int init_iptable_filter(void)
- {
- int ret;
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *envid;
-
-- if (forward < 0 || forward > NF_MAX_VERDICT) {
-- printk("iptables forward must be 0 or 1\n");
-- return -EINVAL;
-- }
-+ envid = get_exec_env();
-
-- /* Entry 1 is the FORWARD hook */
-- initial_table.entries[1].target.verdict = -forward - 1;
-+ if (ve_is_super(envid)) {
-+ init_ve0_iptable_filter(envid);
-+ } else {
-+ __module_get(THIS_MODULE);
-+ ret = -ENOMEM;
-+ envid->_ipt_filter_initial_table =
-+ ub_kmalloc(sizeof(initial_table), GFP_KERNEL);
-+ if (!envid->_ipt_filter_initial_table)
-+ goto nomem_1;
-+ envid->_ve_ipt_filter_pf =
-+ ub_kmalloc(sizeof(packet_filter), GFP_KERNEL);
-+ if (!envid->_ve_ipt_filter_pf)
-+ goto nomem_2;
-+ envid->_ve_ipt_filter_io =
-+ ub_kmalloc(sizeof(ipt_ops), GFP_KERNEL);
-+ if (!envid->_ve_ipt_filter_io)
-+ goto nomem_3;
-+
-+ /*
-+ * Note: in general, it isn't safe to copy the static table
-+ * used for VE0, since that table is already registered
-+ * and now has some run-time information.
-+ * However, inspection of ip_tables.c shows that the only
-+ * dynamically changed fields `list' and `private' are
-+ * given new values in ipt_register_table() without looking
-+ * at the old values. 2004/06/01 SAW
-+ */
-+ memcpy(envid->_ipt_filter_initial_table, &initial_table,
-+ sizeof(initial_table));
-+ memcpy(envid->_ve_ipt_filter_pf, &packet_filter,
-+ sizeof(packet_filter));
-+ memcpy(envid->_ve_ipt_filter_io, &ipt_ops[0], sizeof(ipt_ops));
-+
-+ envid->_ve_ipt_filter_pf->table =
-+ &envid->_ipt_filter_initial_table->repl;
-+ }
-+#endif
-
- /* Register table */
-- ret = ipt_register_table(&packet_filter);
-+ ret = ipt_register_table(&ve_packet_filter);
- if (ret < 0)
-- return ret;
-+ goto nomem_4;
-
- /* Register hooks */
-- ret = nf_register_hook(&ipt_ops[0]);
-+ ret = nf_register_hook(&ve_ipt_ops[0]);
- if (ret < 0)
- goto cleanup_table;
-
-- ret = nf_register_hook(&ipt_ops[1]);
-+ ret = nf_register_hook(&ve_ipt_ops[1]);
- if (ret < 0)
- goto cleanup_hook0;
-
-- ret = nf_register_hook(&ipt_ops[2]);
-+ ret = nf_register_hook(&ve_ipt_ops[2]);
- if (ret < 0)
- goto cleanup_hook1;
-
- return ret;
-
- cleanup_hook1:
-- nf_unregister_hook(&ipt_ops[1]);
-+ nf_unregister_hook(&ve_ipt_ops[1]);
- cleanup_hook0:
-- nf_unregister_hook(&ipt_ops[0]);
-+ nf_unregister_hook(&ve_ipt_ops[0]);
- cleanup_table:
-- ipt_unregister_table(&packet_filter);
--
-+ ipt_unregister_table(&ve_packet_filter);
-+ nomem_4:
-+#ifdef CONFIG_VE_IPTABLES
-+ if (!ve_is_super(envid))
-+ kfree(envid->_ve_ipt_filter_io);
-+ envid->_ve_ipt_filter_io = NULL;
-+ nomem_3:
-+ if (!ve_is_super(envid))
-+ kfree(envid->_ve_ipt_filter_pf);
-+ envid->_ve_ipt_filter_pf = NULL;
-+ nomem_2:
-+ if (!ve_is_super(envid))
-+ kfree(envid->_ipt_filter_initial_table);
-+ envid->_ipt_filter_initial_table = NULL;
-+ nomem_1:
-+ if (!ve_is_super(envid))
-+ module_put(THIS_MODULE);
-+#endif
- return ret;
- }
-
--static void __exit fini(void)
-+void fini_iptable_filter(void)
- {
- unsigned int i;
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *envid;
-+#endif
-
- for (i = 0; i < sizeof(ipt_ops)/sizeof(struct nf_hook_ops); i++)
-- nf_unregister_hook(&ipt_ops[i]);
-+ nf_unregister_hook(&ve_ipt_ops[i]);
-+
-+ ipt_unregister_table(&ve_packet_filter);
-+
-+#ifdef CONFIG_VE_IPTABLES
-+ envid = get_exec_env();
-+ if (envid->_ipt_filter_initial_table != NULL && !ve_is_super(envid)) {
-+ kfree(envid->_ipt_filter_initial_table);
-+ kfree(envid->_ve_ipt_filter_pf);
-+ kfree(envid->_ve_ipt_filter_io);
-+ module_put(THIS_MODULE);
-+ }
-+ envid->_ipt_filter_initial_table = NULL;
-+ envid->_ve_ipt_filter_pf = NULL;
-+ envid->_ve_ipt_filter_io = NULL;
-+#endif
-+}
-+
-+static int __init init(void)
-+{
-+ int err;
-
-- ipt_unregister_table(&packet_filter);
-+ if (forward < 0 || forward > NF_MAX_VERDICT) {
-+ printk("iptables forward must be 0 or 1\n");
-+ return -EINVAL;
-+ }
-+
-+ /* Entry 1 is the FORWARD hook */
-+ initial_table.entries[1].target.verdict = -forward - 1;
-+
-+ err = init_iptable_filter();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_filter);
-+ KSYMRESOLVE(fini_iptable_filter);
-+ KSYMMODRESOLVE(iptable_filter);
-+ return 0;
-+}
-+
-+static void __exit fini(void)
-+{
-+ KSYMMODUNRESOLVE(iptable_filter);
-+ KSYMUNRESOLVE(init_iptable_filter);
-+ KSYMUNRESOLVE(fini_iptable_filter);
-+ fini_iptable_filter();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/iptable_mangle.c linux-2.6.9-ve023stab030/net/ipv4/netfilter/iptable_mangle.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/netfilter/iptable_mangle.c 2004-10-19 01:55:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/netfilter/iptable_mangle.c 2006-10-11 19:07:57.000000000 +0400
-@@ -17,6 +17,7 @@
- #include <linux/skbuff.h>
- #include <net/sock.h>
- #include <net/route.h>
-+#include <linux/nfcalls.h>
- #include <linux/ip.h>
-
- MODULE_LICENSE("GPL");
-@@ -54,7 +55,7 @@ static struct
- struct ipt_replace repl;
- struct ipt_standard entries[5];
- struct ipt_error term;
--} initial_table __initdata
-+} initial_table
- = { { "mangle", MANGLE_VALID_HOOKS, 6,
- sizeof(struct ipt_standard) * 5 + sizeof(struct ipt_error),
- { [NF_IP_PRE_ROUTING] = 0,
-@@ -131,6 +132,13 @@ static struct ipt_table packet_mangler =
- .me = THIS_MODULE,
- };
-
-+#ifdef CONFIG_VE_IPTABLES
-+#include <linux/sched.h>
-+#define ve_packet_mangler (*(get_exec_env()->_ipt_mangle_table))
-+#else
-+#define ve_packet_mangler packet_mangler
-+#endif
-+
- /* The work comes in here from netfilter.c. */
- static unsigned int
- ipt_route_hook(unsigned int hook,
-@@ -139,7 +147,7 @@ ipt_route_hook(unsigned int hook,
- const struct net_device *out,
- int (*okfn)(struct sk_buff *))
- {
-- return ipt_do_table(pskb, hook, in, out, &packet_mangler, NULL);
-+ return ipt_do_table(pskb, hook, in, out, &ve_packet_mangler, NULL);
- }
-
- static unsigned int
-@@ -168,7 +176,8 @@ ipt_local_hook(unsigned int hook,
- daddr = (*pskb)->nh.iph->daddr;
- tos = (*pskb)->nh.iph->tos;
-
-- ret = ipt_do_table(pskb, hook, in, out, &packet_mangler, NULL);
-+ ret = ipt_do_table(pskb, hook, in, out, &ve_packet_mangler, NULL);
-+
- /* Reroute for ANY change. */
- if (ret != NF_DROP && ret != NF_STOLEN && ret != NF_QUEUE
- && ((*pskb)->nh.iph->saddr != saddr
-@@ -220,12 +229,12 @@ static struct nf_hook_ops ipt_ops[] = {
- },
- };
-
--static int __init init(void)
-+static int mangle_init(struct ipt_table *packet_mangler, struct nf_hook_ops ipt_ops[])
- {
- int ret;
-
- /* Register table */
-- ret = ipt_register_table(&packet_mangler);
-+ ret = ipt_register_table(packet_mangler);
- if (ret < 0)
- return ret;
-
-@@ -261,19 +270,117 @@ static int __init init(void)
- cleanup_hook0:
- nf_unregister_hook(&ipt_ops[0]);
- cleanup_table:
-- ipt_unregister_table(&packet_mangler);
-+ ipt_unregister_table(packet_mangler);
-
- return ret;
- }
-
--static void __exit fini(void)
-+static void mangle_fini(struct ipt_table *packet_mangler, struct nf_hook_ops ipt_ops[])
- {
- unsigned int i;
-
-- for (i = 0; i < sizeof(ipt_ops)/sizeof(struct nf_hook_ops); i++)
-+ for (i = 0; i < 5; i++)
- nf_unregister_hook(&ipt_ops[i]);
-
-- ipt_unregister_table(&packet_mangler);
-+ ipt_unregister_table(packet_mangler);
-+}
-+
-+int init_iptable_mangle(void)
-+{
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *envid;
-+ struct ipt_table *table;
-+ struct nf_hook_ops *hooks;
-+ int err;
-+
-+ envid = get_exec_env();
-+ if (ve_is_super(envid)) {
-+ table = &packet_mangler;
-+ hooks = ipt_ops;
-+ } else {
-+ __module_get(THIS_MODULE);
-+ err = -ENOMEM;
-+ table = kmalloc(sizeof(packet_mangler), GFP_KERNEL);
-+ if (table == NULL)
-+ goto nomem_1;
-+ hooks = kmalloc(sizeof(ipt_ops), GFP_KERNEL);
-+ if (hooks == NULL)
-+ goto nomem_2;
-+
-+ memcpy(table, &packet_mangler, sizeof(packet_mangler));
-+ memcpy(hooks, ipt_ops, sizeof(ipt_ops));
-+ }
-+ envid->_ipt_mangle_hooks = hooks;
-+ envid->_ipt_mangle_table = table;
-+
-+ err = mangle_init(table, hooks);
-+ if (err)
-+ goto err_minit;
-+
-+ return 0;
-+
-+err_minit:
-+ envid->_ipt_mangle_table = NULL;
-+ envid->_ipt_mangle_hooks = NULL;
-+ if (!ve_is_super(envid))
-+ kfree(hooks);
-+nomem_2:
-+ if (!ve_is_super(envid)) {
-+ kfree(table);
-+nomem_1:
-+ module_put(THIS_MODULE);
-+ }
-+ return err;
-+#else
-+ return mangle_init(&packet_mangler, ipt_ops);
-+#endif
-+}
-+
-+void fini_iptable_mangle(void)
-+{
-+#ifdef CONFIG_VE_IPTABLES
-+ struct ve_struct *envid;
-+ struct ipt_table *table;
-+ struct nf_hook_ops *hooks;
-+
-+ envid = get_exec_env();
-+ table = envid->_ipt_mangle_table;
-+ hooks = envid->_ipt_mangle_hooks;
-+ if (table == NULL)
-+ return;
-+ mangle_fini(table, hooks);
-+ envid->_ipt_mangle_table = NULL;
-+ envid->_ipt_mangle_hooks = NULL;
-+ if (!ve_is_super(envid)) {
-+ kfree(hooks);
-+ kfree(table);
-+ module_put(THIS_MODULE);
-+ }
-+#else
-+ mangle_fini(&packet_mangler, ipt_ops);
-+#endif
-+}
-+
-+static int __init init(void)
-+{
-+ int err;
-+
-+ err = init_iptable_mangle();
-+ if (err < 0)
-+ return err;
-+
-+ KSYMRESOLVE(init_iptable_mangle);
-+ KSYMRESOLVE(fini_iptable_mangle);
-+ KSYMMODRESOLVE(iptable_mangle);
-+ return 0;
-+}
-+
-+static void __exit fini(void)
-+{
-+ KSYMMODUNRESOLVE(iptable_mangle);
-+ KSYMUNRESOLVE(init_iptable_mangle);
-+ KSYMUNRESOLVE(fini_iptable_mangle);
-+ fini_iptable_mangle();
- }
-
- module_init(init);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/proc.c linux-2.6.9-ve023stab030/net/ipv4/proc.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/proc.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/proc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -262,11 +262,12 @@ static int snmp_seq_show(struct seq_file
- seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
-
- seq_printf(seq, "\nIp: %d %d",
-- ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);
-+ ve_ipv4_devconf.forwarding ? 1 : 2,
-+ sysctl_ip_default_ttl);
-
- for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
-- fold_field((void **) ip_statistics,
-+ fold_field((void **) ve_ip_statistics,
- snmp4_ipstats_list[i].entry));
-
- seq_puts(seq, "\nIcmp:");
-@@ -276,7 +277,7 @@ static int snmp_seq_show(struct seq_file
- seq_puts(seq, "\nIcmp:");
- for (i = 0; snmp4_icmp_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
-- fold_field((void **) icmp_statistics,
-+ fold_field((void **) ve_icmp_statistics,
- snmp4_icmp_list[i].entry));
-
- seq_puts(seq, "\nTcp:");
-@@ -288,11 +289,11 @@ static int snmp_seq_show(struct seq_file
- /* MaxConn field is signed, RFC 2012 */
- if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
- seq_printf(seq, " %ld",
-- fold_field((void **) tcp_statistics,
-+ fold_field((void **) ve_tcp_statistics,
- snmp4_tcp_list[i].entry));
- else
- seq_printf(seq, " %lu",
-- fold_field((void **) tcp_statistics,
-+ fold_field((void **) ve_tcp_statistics,
- snmp4_tcp_list[i].entry));
- }
-
-@@ -303,7 +304,7 @@ static int snmp_seq_show(struct seq_file
- seq_puts(seq, "\nUdp:");
- for (i = 0; snmp4_udp_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
-- fold_field((void **) udp_statistics,
-+ fold_field((void **) ve_udp_statistics,
- snmp4_udp_list[i].entry));
-
- seq_putc(seq, '\n');
-@@ -337,7 +338,7 @@ static int netstat_seq_show(struct seq_f
- seq_puts(seq, "\nTcpExt:");
- for (i = 0; snmp4_net_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
-- fold_field((void **) net_statistics,
-+ fold_field((void **) ve_net_statistics,
- snmp4_net_list[i].entry));
-
- seq_putc(seq, '\n');
-@@ -367,7 +368,8 @@ int __init ip_misc_proc_init(void)
- if (!proc_net_fops_create("snmp", S_IRUGO, &snmp_seq_fops))
- goto out_snmp;
-
-- if (!proc_net_fops_create("sockstat", S_IRUGO, &sockstat_seq_fops))
-+ if (!__proc_net_fops_create("net/sockstat", S_IRUGO,
-+ &sockstat_seq_fops, NULL))
- goto out_sockstat;
- out:
- return rc;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/raw.c linux-2.6.9-ve023stab030/net/ipv4/raw.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/raw.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/raw.c 2006-10-11 19:07:57.000000000 +0400
-@@ -114,7 +114,8 @@ struct sock *__raw_v4_lookup(struct sock
- if (inet->num == num &&
- !(inet->daddr && inet->daddr != raddr) &&
- !(inet->rcv_saddr && inet->rcv_saddr != laddr) &&
-- !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
-+ !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) &&
-+ ve_accessible_strict(VE_OWNER_SK(sk), get_exec_env()))
- goto found; /* gotcha */
- }
- sk = NULL;
-@@ -738,8 +739,12 @@ static struct sock *raw_get_first(struct
- struct hlist_node *node;
-
- sk_for_each(sk, node, &raw_v4_htable[state->bucket])
-- if (sk->sk_family == PF_INET)
-+ if (sk->sk_family == PF_INET) {
-+ if (!ve_accessible(VE_OWNER_SK(sk),
-+ get_exec_env()))
-+ continue;
- goto found;
-+ }
- }
- sk = NULL;
- found:
-@@ -753,8 +758,14 @@ static struct sock *raw_get_next(struct
- do {
- sk = sk_next(sk);
- try_again:
-- ;
-- } while (sk && sk->sk_family != PF_INET);
-+ if (!sk)
-+ break;
-+ if (sk->sk_family != PF_INET)
-+ continue;
-+ if (ve_accessible(VE_OWNER_SK(sk),
-+ get_exec_env()))
-+ break;
-+ } while (1);
-
- if (!sk && ++state->bucket < RAWV4_HTABLE_SIZE) {
- sk = sk_head(&raw_v4_htable[state->bucket]);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/route.c linux-2.6.9-ve023stab030/net/ipv4/route.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/route.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/route.c 2006-10-11 19:07:57.000000000 +0400
-@@ -92,6 +92,7 @@
- #include <linux/jhash.h>
- #include <linux/rcupdate.h>
- #include <linux/times.h>
-+#include <linux/kmem_cache.h>
- #include <net/protocol.h>
- #include <net/ip.h>
- #include <net/route.h>
-@@ -110,6 +111,8 @@
-
- #define RT_GC_TIMEOUT (300*HZ)
-
-+int ip_rt_src_check = 1;
-+
- int ip_rt_min_delay = 2 * HZ;
- int ip_rt_max_delay = 10 * HZ;
- int ip_rt_max_size;
-@@ -250,11 +253,28 @@ static unsigned int rt_hash_code(u32 dad
- & rt_hash_mask);
- }
-
-+void prepare_rt_cache(void)
-+{
-+#ifdef CONFIG_VE
-+ struct rtable *r;
-+ int i;
-+
-+ for (i = rt_hash_mask; i >= 0; i--) {
-+ spin_lock_bh(rt_hash_lock_addr(i));
-+ for (r = rt_hash_table[i].chain; r; r = r->u.rt_next) {
-+ r->fl.owner_env = get_ve0();
-+ }
-+ spin_unlock_bh(rt_hash_lock_addr(i));
-+ }
-+#endif
-+}
-+
- #ifdef CONFIG_PROC_FS
- struct rt_cache_iter_state {
- int bucket;
- };
-
-+static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r);
- static struct rtable *rt_cache_get_first(struct seq_file *seq)
- {
- struct rtable *r = NULL;
-@@ -267,6 +287,8 @@ static struct rtable *rt_cache_get_first
- break;
- rcu_read_unlock_bh();
- }
-+ if (r && !ve_accessible_strict(r->fl.owner_env, get_exec_env()))
-+ r = rt_cache_get_next(seq, r);
- return r;
- }
-
-@@ -274,6 +296,7 @@ static struct rtable *rt_cache_get_next(
- {
- struct rt_cache_iter_state *st = rcu_dereference(seq->private);
-
-+loop:
- r = r->u.rt_next;
- while (!r) {
- rcu_read_unlock_bh();
-@@ -282,6 +305,8 @@ static struct rtable *rt_cache_get_next(
- rcu_read_lock_bh();
- r = rt_hash_table[st->bucket].chain;
- }
-+ if (r && !ve_accessible_strict(r->fl.owner_env, get_exec_env()))
-+ goto loop;
- return r;
- }
-
-@@ -591,26 +616,106 @@ static void rt_check_expire(unsigned lon
- mod_timer(&rt_periodic_timer, now + ip_rt_gc_interval);
- }
-
-+typedef unsigned long rt_flush_gen_t;
-+
-+#ifdef CONFIG_VE
-+
-+static rt_flush_gen_t rt_flush_gen;
-+
-+/* called under rt_flush_lock */
-+static void set_rt_flush_required(struct ve_struct *env)
-+{
-+ /*
-+ * If the global generation rt_flush_gen is equal to G, then
-+ * the pass considering entries labelled by G is yet to come.
-+ */
-+ env->rt_flush_required = rt_flush_gen;
-+}
-+
-+static spinlock_t rt_flush_lock;
-+static rt_flush_gen_t reset_rt_flush_required(void)
-+{
-+ rt_flush_gen_t g;
-+
-+ spin_lock_bh(&rt_flush_lock);
-+ g = rt_flush_gen++;
-+ spin_unlock_bh(&rt_flush_lock);
-+ return g;
-+}
-+
-+static int check_rt_flush_required(struct ve_struct *env, rt_flush_gen_t gen)
-+{
-+ /* can be checked without the lock */
-+ return env->rt_flush_required >= gen;
-+}
-+
-+#else
-+
-+static void set_rt_flush_required(struct ve_struct *env)
-+{
-+}
-+
-+static rt_flush_gen_t reset_rt_flush_required(void)
-+{
-+ return 0;
-+}
-+
-+#endif
-+
- /* This can run from both BH and non-BH contexts, the latter
- * in the case of a forced flush event.
- */
- static void rt_run_flush(unsigned long dummy)
- {
- int i;
-- struct rtable *rth, *next;
-+ struct rtable * rth, * next;
-+ struct rtable * tail;
-+ rt_flush_gen_t gen;
-
- rt_deadline = 0;
-
- get_random_bytes(&rt_hash_rnd, 4);
-
-+ gen = reset_rt_flush_required();
-+
- for (i = rt_hash_mask; i >= 0; i--) {
-+#ifdef CONFIG_VE
-+ struct rtable ** prev, * p;
-+
- spin_lock_bh(rt_hash_lock_addr(i));
- rth = rt_hash_table[i].chain;
-+
-+ /* defer releasing the head of the list after spin_unlock */
-+ for (tail = rth; tail; tail = tail->u.rt_next)
-+ if (!check_rt_flush_required(tail->fl.owner_env, gen))
-+ break;
-+ if (rth != tail)
-+ rt_hash_table[i].chain = tail;
-+
-+ /* call rt_free on entries after the tail requiring flush */
-+ prev = &rt_hash_table[i].chain;
-+ for (p = *prev; p; p = next) {
-+ next = p->u.rt_next;
-+ if (!check_rt_flush_required(p->fl.owner_env, gen)) {
-+ prev = &p->u.rt_next;
-+ } else {
-+ *prev = next;
-+ rt_free(p);
-+ }
-+ }
-+
-+#else
-+ spin_lock_bh(rt_hash_lock_addr(i));
-+ rth = rt_hash_table[i].chain;
-+
- if (rth)
- rt_hash_table[i].chain = NULL;
-+ tail = NULL;
-+
-+#endif
- spin_unlock_bh(rt_hash_lock_addr(i));
-
-- for (; rth; rth = next) {
-+ for (; rth != tail; rth = next) {
- next = rth->u.rt_next;
- rt_free(rth);
- }
-@@ -646,6 +751,8 @@ void rt_cache_flush(int delay)
- delay = tmo;
- }
-
-+ set_rt_flush_required(get_exec_env());
-+
- if (delay <= 0) {
- spin_unlock_bh(&rt_flush_lock);
- rt_run_flush(0);
-@@ -661,9 +768,30 @@ void rt_cache_flush(int delay)
-
- static void rt_secret_rebuild(unsigned long dummy)
- {
-+ int i;
-+ struct rtable *rth, *next;
- unsigned long now = jiffies;
-
-- rt_cache_flush(0);
-+ spin_lock_bh(&rt_flush_lock);
-+ del_timer(&rt_flush_timer);
-+ spin_unlock_bh(&rt_flush_lock);
-+
-+ rt_deadline = 0;
-+ get_random_bytes(&rt_hash_rnd, 4);
-+
-+ for (i = rt_hash_mask; i >= 0; i--) {
-+ spin_lock_bh(rt_hash_lock_addr(i));
-+ rth = rt_hash_table[i].chain;
-+ if (rth)
-+ rt_hash_table[i].chain = NULL;
-+ spin_unlock_bh(rt_hash_lock_addr(i));
-+
-+ for (; rth; rth = next) {
-+ next = rth->u.rt_next;
-+ rt_free(rth);
-+ }
-+ }
-+
- mod_timer(&rt_secret_timer, now + ip_rt_secret_interval);
- }
-
-@@ -805,7 +933,8 @@ static inline int compare_keys(struct fl
- {
- return memcmp(&fl1->nl_u.ip4_u, &fl2->nl_u.ip4_u, sizeof(fl1->nl_u.ip4_u)) == 0 &&
- fl1->oif == fl2->oif &&
-- fl1->iif == fl2->iif;
-+ fl1->iif == fl2->iif &&
-+ ve_accessible_strict(fl1->owner_env, fl2->owner_env);
- }
-
- static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
-@@ -889,6 +1018,8 @@ restart:
- if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) {
- int err = arp_bind_neighbour(&rt->u.dst);
- if (err) {
-+ struct dst_entry *dst;
-+
- spin_unlock_bh(rt_hash_lock_addr(hash));
-
- if (err != -ENOBUFS) {
-@@ -911,8 +1042,14 @@ restart:
- goto restart;
- }
-
-- if (net_ratelimit())
-- printk(KERN_WARNING "Neighbour table overflow.\n");
-+ if (net_ratelimit()) {
-+ dst = &rt->u.dst;
-+ printk(KERN_WARNING "Neighbour table overflow "
-+ "(env %u, dev %s, hop %08x)\n",
-+ VEID(get_exec_env()),
-+ dst->dev ? dst->dev->name : "(no)",
-+ ((struct rtable *)dst)->rt_gateway);
-+ }
- rt_drop(rt);
- return -ENOBUFS;
- }
-@@ -1017,7 +1154,9 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
- struct rtable *rth, **rthp;
- u32 skeys[2] = { saddr, 0 };
- int ikeys[2] = { dev->ifindex, 0 };
-+ struct ve_struct *ve;
-
-+ ve = get_exec_env();
- tos &= IPTOS_RT_MASK;
-
- if (!in_dev)
-@@ -1053,6 +1192,10 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
- rth->fl.fl4_src != skeys[i] ||
- rth->fl.fl4_tos != tos ||
- rth->fl.oif != ikeys[k] ||
-+#ifdef CONFIG_VE
-+ !ve_accessible_strict(rth->fl.owner_env,
-+ ve) ||
-+#endif
- rth->fl.iif != 0) {
- rthp = &rth->u.rt_next;
- continue;
-@@ -1091,6 +1234,9 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
- rt->u.dst.neighbour = NULL;
- rt->u.dst.hh = NULL;
- rt->u.dst.xfrm = NULL;
-+#ifdef CONFIG_VE
-+ rt->fl.owner_env = ve;
-+#endif
-
- rt->rt_flags |= RTCF_REDIRECTED;
-
-@@ -1532,6 +1678,9 @@ static int ip_route_input_mc(struct sk_b
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark= skb->nfmark;
- #endif
-+#ifdef CONFIG_VE
-+ rth->fl.owner_env = get_exec_env();
-+#endif
- rth->fl.fl4_src = saddr;
- rth->rt_src = saddr;
- #ifdef CONFIG_NET_CLS_ROUTE
-@@ -1539,7 +1688,7 @@ static int ip_route_input_mc(struct sk_b
- #endif
- rth->rt_iif =
- rth->fl.iif = dev->ifindex;
-- rth->u.dst.dev = &loopback_dev;
-+ rth->u.dst.dev = &visible_loopback_dev;
- dev_hold(rth->u.dst.dev);
- rth->idev = in_dev_get(rth->u.dst.dev);
- rth->fl.oif = 0;
-@@ -1649,7 +1798,7 @@ static int ip_route_input_slow(struct sk
- if (res.type == RTN_LOCAL) {
- int result;
- result = fib_validate_source(saddr, daddr, tos,
-- loopback_dev.ifindex,
-+ visible_loopback_dev.ifindex,
- dev, &spec_dst, &itag);
- if (result < 0)
- goto martian_source;
-@@ -1713,6 +1862,9 @@ static int ip_route_input_slow(struct sk
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark= skb->nfmark;
- #endif
-+#ifdef CONFIG_VE
-+ rth->fl.owner_env = get_exec_env();
-+#endif
- rth->fl.fl4_src = saddr;
- rth->rt_src = saddr;
- rth->rt_gateway = daddr;
-@@ -1776,6 +1928,9 @@ local_input:
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark= skb->nfmark;
- #endif
-+#ifdef CONFIG_VE
-+ rth->fl.owner_env = get_exec_env();
-+#endif
- rth->fl.fl4_src = saddr;
- rth->rt_src = saddr;
- #ifdef CONFIG_NET_CLS_ROUTE
-@@ -1783,7 +1938,7 @@ local_input:
- #endif
- rth->rt_iif =
- rth->fl.iif = dev->ifindex;
-- rth->u.dst.dev = &loopback_dev;
-+ rth->u.dst.dev = &visible_loopback_dev;
- dev_hold(rth->u.dst.dev);
- rth->idev = in_dev_get(rth->u.dst.dev);
- rth->rt_gateway = daddr;
-@@ -1871,6 +2026,9 @@ int ip_route_input(struct sk_buff *skb,
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark == skb->nfmark &&
- #endif
-+#ifdef CONFIG_VE
-+ rth->fl.owner_env == get_exec_env() &&
-+#endif
- rth->fl.fl4_tos == tos) {
- rth->u.dst.lastuse = jiffies;
- dst_hold(&rth->u.dst);
-@@ -1936,7 +2094,7 @@ static int ip_route_output_slow(struct r
- .fwmark = oldflp->fl4_fwmark
- #endif
- } },
-- .iif = loopback_dev.ifindex,
-+ .iif = visible_loopback_dev.ifindex,
- .oif = oldflp->oif };
- struct fib_result res;
- unsigned flags = 0;
-@@ -1959,10 +2117,13 @@ static int ip_route_output_slow(struct r
- ZERONET(oldflp->fl4_src))
- goto out;
-
-- /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
-- dev_out = ip_dev_find(oldflp->fl4_src);
-- if (dev_out == NULL)
-- goto out;
-+ if (ip_rt_src_check) {
-+ /* It is equivalent to
-+ inet_addr_type(saddr) == RTN_LOCAL */
-+ dev_out = ip_dev_find(oldflp->fl4_src);
-+ if (dev_out == NULL)
-+ goto out;
-+ }
-
- /* I removed check for oif == dev_out->oif here.
- It was wrong for two reasons:
-@@ -1989,6 +2150,12 @@ static int ip_route_output_slow(struct r
- Luckily, this hack is good workaround.
- */
-
-+ if (dev_out == NULL) {
-+ dev_out = ip_dev_find(oldflp->fl4_src);
-+ if (dev_out == NULL)
-+ goto out;
-+ }
-+
- fl.oif = dev_out->ifindex;
- goto make_route;
- }
-@@ -2028,9 +2195,9 @@ static int ip_route_output_slow(struct r
- fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK);
- if (dev_out)
- dev_put(dev_out);
-- dev_out = &loopback_dev;
-+ dev_out = &visible_loopback_dev;
- dev_hold(dev_out);
-- fl.oif = loopback_dev.ifindex;
-+ fl.oif = visible_loopback_dev.ifindex;
- res.type = RTN_LOCAL;
- flags |= RTCF_LOCAL;
- goto make_route;
-@@ -2075,7 +2242,7 @@ static int ip_route_output_slow(struct r
- fl.fl4_src = fl.fl4_dst;
- if (dev_out)
- dev_put(dev_out);
-- dev_out = &loopback_dev;
-+ dev_out = &visible_loopback_dev;
- dev_hold(dev_out);
- fl.oif = dev_out->ifindex;
- if (res.fi)
-@@ -2157,6 +2324,9 @@ make_route:
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark= oldflp->fl4_fwmark;
- #endif
-+#ifdef CONFIG_VE
-+ rth->fl.owner_env = get_exec_env();
-+#endif
- rth->rt_dst = fl.fl4_dst;
- rth->rt_src = fl.fl4_src;
- rth->rt_iif = oldflp->oif ? : dev_out->ifindex;
-@@ -2232,6 +2402,7 @@ int __ip_route_output_key(struct rtable
- #ifdef CONFIG_IP_ROUTE_FWMARK
- rth->fl.fl4_fwmark == flp->fl4_fwmark &&
- #endif
-+ ve_accessible_strict(rth->fl.owner_env, get_exec_env()) &&
- !((rth->fl.fl4_tos ^ flp->fl4_tos) &
- (IPTOS_RT_MASK | RTO_ONLINK))) {
- rth->u.dst.lastuse = jiffies;
-@@ -2341,7 +2512,7 @@ static int rt_fill_info(struct sk_buff *
- u32 dst = rt->rt_dst;
-
- if (MULTICAST(dst) && !LOCAL_MCAST(dst) &&
-- ipv4_devconf.mc_forwarding) {
-+ ve_ipv4_devconf.mc_forwarding) {
- int err = ipmr_get_route(skb, r, nowait);
- if (err <= 0) {
- if (!nowait) {
-@@ -2494,6 +2665,11 @@ void ip_rt_multicast_event(struct in_dev
- #ifdef CONFIG_SYSCTL
- static int flush_delay;
-
-+void *get_flush_delay_addr(void)
-+{
-+ return &flush_delay;
-+}
-+
- static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
- struct file *filp, void __user *buffer,
- size_t *lenp, loff_t *ppos)
-@@ -2507,6 +2683,13 @@ static int ipv4_sysctl_rtcache_flush(ctl
- return -EINVAL;
- }
-
-+int visible_ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
-+ struct file *filp, void __user *buffer,
-+ size_t *lenp, loff_t *ppos)
-+{
-+ return ipv4_sysctl_rtcache_flush(ctl, write, filp, buffer, lenp, ppos);
-+}
-+
- static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
- int __user *name,
- int nlen,
-@@ -2525,6 +2708,19 @@ static int ipv4_sysctl_rtcache_flush_str
- return 0;
- }
-
-+int visible_ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
-+ int __user *name,
-+ int nlen,
-+ void __user *oldval,
-+ size_t __user *oldlenp,
-+ void __user *newval,
-+ size_t newlen,
-+ void **context)
-+{
-+ return ipv4_sysctl_rtcache_flush_strategy(table, name, nlen, oldval,
-+ oldlenp, newval, newlen, context);
-+}
-+
- ctl_table ipv4_route_table[] = {
- {
- .ctl_name = NET_IPV4_ROUTE_FLUSH,
-@@ -2747,6 +2943,7 @@ __setup("rhash_entries=", set_rhash_entr
- int __init ip_rt_init(void)
- {
- int rc = 0;
-+ int scale;
-
- rt_hash_rnd = (int) ((num_physpages ^ (num_physpages>>8)) ^
- (jiffies ^ (jiffies >> 7)));
-@@ -2772,10 +2969,16 @@ int __init ip_rt_init(void)
- if (!ipv4_dst_ops.kmem_cachep)
- panic("IP: failed to allocate ip_dst_cache\n");
-
-+ scale = num_physpages > 128 * 1024 ? 15 : 17;
-+#if defined(CONFIG_DEBUG_SLAB) && defined(CONFIG_DEBUG_PAGEALLOC)
-+ scale += long_log2(ipv4_dst_ops.kmem_cachep->objsize /
-+ sizeof(struct rtable));
-+#endif
-+
- rt_hash_table = net_alloc_hash("IP route cache",
- sizeof(struct rt_hash_bucket),
- rhash_entries,
-- (num_physpages >= 128 * 1024) ? 15 : 17,
-+ scale,
- &rt_hash_log,
- &rt_hash_mask,
- 0);
-@@ -2824,7 +3027,7 @@ int __init ip_rt_init(void)
- rtstat_pde->proc_fops = &rt_cpu_seq_fops;
- }
- #ifdef CONFIG_NET_CLS_ROUTE
-- create_proc_read_entry("rt_acct", 0, proc_net, ip_rt_acct_read, NULL);
-+ create_proc_read_entry("net/rt_acct", 0, NULL, ip_rt_acct_read, NULL);
- #endif
- #endif
- #ifdef CONFIG_XFRM
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/sysctl_net_ipv4.c linux-2.6.9-ve023stab030/net/ipv4/sysctl_net_ipv4.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/sysctl_net_ipv4.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/sysctl_net_ipv4.c 2006-10-11 19:07:57.000000000 +0400
-@@ -49,10 +49,12 @@ extern int inet_peer_maxttl;
- extern int inet_peer_gc_mintime;
- extern int inet_peer_gc_maxtime;
-
-+int sysctl_tcp_use_sg = 1;
-+
- #ifdef CONFIG_SYSCTL
- static int tcp_retr1_max = 255;
--static int ip_local_port_range_min[] = { 1, 1 };
--static int ip_local_port_range_max[] = { 65535, 65535 };
-+int ip_local_port_range_min[] = { 1, 1 };
-+int ip_local_port_range_max[] = { 65535, 65535 };
- #endif
-
- struct ipv4_config ipv4_config;
-@@ -65,17 +67,23 @@ static
- int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
-- int val = ipv4_devconf.forwarding;
-+ int val = ve_ipv4_devconf.forwarding;
- int ret;
-
- ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
-
-- if (write && ipv4_devconf.forwarding != val)
-+ if (write && ve_ipv4_devconf.forwarding != val)
- inet_forward_change();
-
- return ret;
- }
-
-+int visible_ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ return ipv4_sysctl_forward(ctl, write, filp, buffer, lenp, ppos);
-+}
-+
- static int ipv4_sysctl_forward_strategy(ctl_table *table,
- int __user *name, int nlen,
- void __user *oldval, size_t __user *oldlenp,
-@@ -118,6 +126,16 @@ static int ipv4_sysctl_forward_strategy(
- return 1;
- }
-
-+int visible_ipv4_sysctl_forward_strategy(ctl_table *table,
-+ int __user *name, int nlen,
-+ void __user *oldval, size_t __user *oldlenp,
-+ void __user *newval, size_t newlen,
-+ void **context)
-+{
-+ return ipv4_sysctl_forward_strategy(table, name, nlen,
-+ oldval, oldlenp, newval, newlen, context);
-+}
-+
- ctl_table ipv4_table[] = {
- {
- .ctl_name = NET_IPV4_TCP_TIMESTAMPS,
-@@ -226,6 +244,22 @@ ctl_table ipv4_table[] = {
- .proc_handler = &proc_dointvec
- },
- {
-+ .ctl_name = NET_TCP_MAX_TW_KMEM_FRACTION,
-+ .procname = "tcp_max_tw_kmem_fraction",
-+ .data = &sysctl_tcp_max_tw_kmem_fraction,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
-+ {
-+ .ctl_name = NET_TCP_MAX_TW_BUCKETS_VE,
-+ .procname = "tcp_max_tw_buckets_ve",
-+ .data = &sysctl_tcp_max_tw_buckets_ve,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec
-+ },
-+ {
- .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
- .procname = "ipfrag_high_thresh",
- .data = &sysctl_ipfrag_high_thresh,
-@@ -364,8 +398,8 @@ ctl_table ipv4_table[] = {
- {
- .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
- .procname = "ip_local_port_range",
-- .data = &sysctl_local_port_range,
-- .maxlen = sizeof(sysctl_local_port_range),
-+ .data = get_ve0()->_sysctl_local_port_range,
-+ .maxlen = sizeof(get_ve0()->_sysctl_local_port_range),
- .mode = 0644,
- .proc_handler = &proc_dointvec_minmax,
- .strategy = &sysctl_intvec,
-@@ -699,6 +733,14 @@ ctl_table ipv4_table[] = {
- .mode = 0644,
- .proc_handler = &proc_dointvec,
- },
-+ {
-+ .ctl_name = NET_TCP_USE_SG,
-+ .procname = "tcp_use_sg",
-+ .data = &sysctl_tcp_use_sg,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
- { .ctl_name = 0 }
- };
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp.c linux-2.6.9-ve023stab030/net/ipv4/tcp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp.c 2006-10-11 19:07:59.000000000 +0400
-@@ -248,6 +248,7 @@
- */
-
- #include <linux/config.h>
-+#include <linux/kmem_cache.h>
- #include <linux/module.h>
- #include <linux/types.h>
- #include <linux/fcntl.h>
-@@ -262,6 +263,9 @@
- #include <net/xfrm.h>
- #include <net/ip.h>
-
-+#include <ub/ub_orphan.h>
-+#include <ub/ub_net.h>
-+#include <ub/ub_tcp.h>
-
- #include <asm/uaccess.h>
- #include <asm/ioctls.h>
-@@ -275,6 +279,7 @@ kmem_cache_t *tcp_bucket_cachep;
- kmem_cache_t *tcp_timewait_cachep;
-
- atomic_t tcp_orphan_count = ATOMIC_INIT(0);
-+EXPORT_SYMBOL(tcp_orphan_count);
-
- int sysctl_tcp_mem[3];
- int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
-@@ -331,6 +336,7 @@ unsigned int tcp_poll(struct file *file,
- unsigned int mask;
- struct sock *sk = sock->sk;
- struct tcp_opt *tp = tcp_sk(sk);
-+ int check_send_space;
-
- poll_wait(file, sk->sk_sleep, wait);
- if (sk->sk_state == TCP_LISTEN)
-@@ -345,6 +351,21 @@ unsigned int tcp_poll(struct file *file,
- if (sk->sk_err)
- mask = POLLERR;
-
-+ check_send_space = 1;
-+#ifdef CONFIG_USER_RESOURCE
-+ if (!(sk->sk_shutdown & SEND_SHUTDOWN) && sock_has_ubc(sk)) {
-+ unsigned long size;
-+ size = MAX_TCP_HEADER + tp->mss_cache;
-+ if (size > SOCK_MIN_UBCSPACE)
-+ size = SOCK_MIN_UBCSPACE;
-+ size = skb_charge_size(size);
-+ if (ub_sock_makewres_tcp(sk, size)) {
-+ check_send_space = 0;
-+ ub_sock_sndqueueadd_tcp(sk, size);
-+ }
-+ }
-+#endif
-+
- /*
- * POLLHUP is certainly not done right. But poll() doesn't
- * have a notion of HUP in just one direction, and for a
-@@ -388,7 +409,7 @@ unsigned int tcp_poll(struct file *file,
- sock_flag(sk, SOCK_URGINLINE) || !tp->urg_data))
- mask |= POLLIN | POLLRDNORM;
-
-- if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
-+ if (check_send_space && !(sk->sk_shutdown & SEND_SHUTDOWN)) {
- if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
- mask |= POLLOUT | POLLWRNORM;
- } else { /* send SIGIO later */
-@@ -564,7 +585,7 @@ static void tcp_listen_stop (struct sock
-
- sock_orphan(child);
-
-- atomic_inc(&tcp_orphan_count);
-+ tcp_inc_orphan_count(child);
-
- tcp_destroy_sock(child);
-
-@@ -657,16 +678,23 @@ static ssize_t do_tcp_sendpages(struct s
- int copy, i, can_coalesce;
- int offset = poffset % PAGE_SIZE;
- int size = min_t(size_t, psize, PAGE_SIZE - offset);
-+ unsigned long chargesize = 0;
-
- if (!sk->sk_send_head || (copy = mss_now - skb->len) <= 0) {
- new_segment:
-+ chargesize = 0;
- if (!sk_stream_memory_free(sk))
- goto wait_for_sndbuf;
-
-+ chargesize = skb_charge_size(MAX_TCP_HEADER +
-+ tp->mss_cache);
-+ if (ub_sock_getwres_tcp(sk, chargesize) < 0)
-+ goto wait_for_ubspace;
- skb = sk_stream_alloc_pskb(sk, 0, 0,
- sk->sk_allocation);
- if (!skb)
- goto wait_for_memory;
-+ ub_skb_set_charge(skb, sk, chargesize, UB_TCPSNDBUF);
-
- skb_entail(sk, tp, skb);
- copy = mss_now;
-@@ -723,10 +751,15 @@ new_segment:
- wait_for_sndbuf:
- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
- wait_for_memory:
-+ ub_sock_retwres_tcp(sk, chargesize,
-+ skb_charge_size(MAX_TCP_HEADER + tp->mss_cache));
-+ chargesize = 0;
-+wait_for_ubspace:
- if (copied)
- tcp_push(sk, tp, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
-
-- if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)
-+ err = __sk_stream_wait_memory(sk, &timeo, chargesize);
-+ if (err != 0)
- goto do_error;
-
- mss_now = tcp_current_mss(sk, !(flags&MSG_OOB));
-@@ -766,9 +799,6 @@ ssize_t tcp_sendpage(struct socket *sock
- return res;
- }
-
--#define TCP_PAGE(sk) (sk->sk_sndmsg_page)
--#define TCP_OFF(sk) (sk->sk_sndmsg_off)
--
- static inline int select_size(struct sock *sk, struct tcp_opt *tp)
- {
- int tmp = tp->mss_cache_std;
-@@ -822,6 +852,7 @@ int tcp_sendmsg(struct kiocb *iocb, stru
- while (--iovlen >= 0) {
- int seglen = iov->iov_len;
- unsigned char __user *from = iov->iov_base;
-+ unsigned long chargesize = 0;
-
- iov++;
-
-@@ -832,18 +863,26 @@ int tcp_sendmsg(struct kiocb *iocb, stru
-
- if (!sk->sk_send_head ||
- (copy = mss_now - skb->len) <= 0) {
-+ unsigned long size;
-
- new_segment:
- /* Allocate new segment. If the interface is SG,
- * allocate skb fitting to single page.
- */
-+ chargesize = 0;
- if (!sk_stream_memory_free(sk))
- goto wait_for_sndbuf;
--
-- skb = sk_stream_alloc_pskb(sk, select_size(sk, tp),
-- 0, sk->sk_allocation);
-+ size = select_size(sk, tp);
-+ chargesize = skb_charge_size(MAX_TCP_HEADER +
-+ size);
-+ if (ub_sock_getwres_tcp(sk, chargesize) < 0)
-+ goto wait_for_ubspace;
-+ skb = sk_stream_alloc_pskb(sk, size, 0,
-+ sk->sk_allocation);
- if (!skb)
- goto wait_for_memory;
-+ ub_skb_set_charge(skb, sk, chargesize,
-+ UB_TCPSNDBUF);
-
- /*
- * Check whether we can use HW checksum.
-@@ -896,11 +935,15 @@ new_segment:
- ~(L1_CACHE_BYTES - 1);
- if (off == PAGE_SIZE) {
- put_page(page);
-+ ub_sock_tcp_detachpage(sk);
- TCP_PAGE(sk) = page = NULL;
- }
- }
-
- if (!page) {
-+ chargesize = PAGE_SIZE;
-+ if (ub_sock_tcp_chargepage(sk) < 0)
-+ goto wait_for_ubspace;
- /* Allocate new cache page. */
- if (!(page = sk_stream_alloc_page(sk)))
- goto wait_for_memory;
-@@ -936,7 +979,8 @@ new_segment:
- } else if (off + copy < PAGE_SIZE) {
- get_page(page);
- TCP_PAGE(sk) = page;
-- }
-+ } else
-+ ub_sock_tcp_detachpage(sk);
- }
-
- TCP_OFF(sk) = off + copy;
-@@ -967,10 +1011,15 @@ new_segment:
- wait_for_sndbuf:
- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
- wait_for_memory:
-+ ub_sock_retwres_tcp(sk, chargesize,
-+ skb_charge_size(MAX_TCP_HEADER+tp->mss_cache));
-+ chargesize = 0;
-+wait_for_ubspace:
- if (copied)
- tcp_push(sk, tp, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
-
-- if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)
-+ err = __sk_stream_wait_memory(sk, &timeo, chargesize);
-+ if (err != 0)
- goto do_error;
-
- mss_now = tcp_current_mss(sk, !(flags&MSG_OOB));
-@@ -1067,7 +1116,18 @@ void cleanup_rbuf(struct sock *sk, int c
- #if TCP_DEBUG
- struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
-
-- BUG_TRAP(!skb || before(tp->copied_seq, TCP_SKB_CB(skb)->end_seq));
-+ if (!(skb==NULL || before(tp->copied_seq, TCP_SKB_CB(skb)->end_seq))) {
-+ printk("KERNEL: assertion: skb==NULL || "
-+ "before(tp->copied_seq, skb->end_seq)\n");
-+ printk("VE%u pid %d comm %.16s\n",
-+ (get_exec_env() ? VEID(get_exec_env()) : 0),
-+ current->pid, current->comm);
-+ printk("copied=%d, copied_seq=%d, rcv_nxt=%d\n", copied,
-+ tp->copied_seq, tp->rcv_nxt);
-+ printk("skb->len=%d, skb->seq=%d, skb->end_seq=%d\n",
-+ skb->len, TCP_SKB_CB(skb)->seq,
-+ TCP_SKB_CB(skb)->end_seq);
-+ }
- #endif
-
- if (tcp_ack_scheduled(tp)) {
-@@ -1290,7 +1350,22 @@ int tcp_recvmsg(struct kiocb *iocb, stru
- goto found_ok_skb;
- if (skb->h.th->fin)
- goto found_fin_ok;
-- BUG_TRAP(flags & MSG_PEEK);
-+ if (!(flags & MSG_PEEK)) {
-+ printk("KERNEL: assertion: flags&MSG_PEEK\n");
-+ printk("VE%u pid %d comm %.16s\n",
-+ (get_exec_env() ?
-+ VEID(get_exec_env()) : 0),
-+ current->pid, current->comm);
-+ printk("flags=0x%x, len=%d, copied_seq=%d, "
-+ "rcv_nxt=%d\n", flags, len,
-+ tp->copied_seq, tp->rcv_nxt);
-+ printk("skb->len=%d, *seq=%d, skb->seq=%d, "
-+ "skb->end_seq=%d, offset=%d\n",
-+ skb->len, *seq,
-+ TCP_SKB_CB(skb)->seq,
-+ TCP_SKB_CB(skb)->end_seq,
-+ offset);
-+ }
- skb = skb->next;
- } while (skb != (struct sk_buff *)&sk->sk_receive_queue);
-
-@@ -1353,8 +1428,18 @@ int tcp_recvmsg(struct kiocb *iocb, stru
-
- tp->ucopy.len = len;
-
-- BUG_TRAP(tp->copied_seq == tp->rcv_nxt ||
-- (flags & (MSG_PEEK | MSG_TRUNC)));
-+ if (!(tp->copied_seq == tp->rcv_nxt ||
-+ (flags&(MSG_PEEK|MSG_TRUNC)))) {
-+ printk("KERNEL: assertion: tp->copied_seq == "
-+ "tp->rcv_nxt || ...\n");
-+ printk("VE%u pid %d comm %.16s\n",
-+ (get_exec_env() ?
-+ VEID(get_exec_env()) : 0),
-+ current->pid, current->comm);
-+ printk("flags=0x%x, len=%d, copied_seq=%d, "
-+ "rcv_nxt=%d\n", flags, len,
-+ tp->copied_seq, tp->rcv_nxt);
-+ }
-
- /* Ugly... If prequeue is not empty, we have to
- * process it before releasing socket, otherwise
-@@ -1615,7 +1700,7 @@ void tcp_destroy_sock(struct sock *sk)
- }
- #endif
-
-- atomic_dec(&tcp_orphan_count);
-+ tcp_dec_orphan_count(sk);
- sock_put(sk);
- }
-
-@@ -1739,7 +1824,7 @@ adjudge_to_death:
- if (tmo > TCP_TIMEWAIT_LEN) {
- tcp_reset_keepalive_timer(sk, tcp_fin_time(tp));
- } else {
-- atomic_inc(&tcp_orphan_count);
-+ tcp_inc_orphan_count(sk);
- tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
- goto out;
- }
-@@ -1747,9 +1832,7 @@ adjudge_to_death:
- }
- if (sk->sk_state != TCP_CLOSE) {
- sk_stream_mem_reclaim(sk);
-- if (atomic_read(&tcp_orphan_count) > sysctl_tcp_max_orphans ||
-- (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
-- atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
-+ if (tcp_too_many_orphans(sk, tcp_get_orphan_count(sk))) {
- if (net_ratelimit())
- printk(KERN_INFO "TCP: too many of orphaned "
- "sockets\n");
-@@ -1758,7 +1841,7 @@ adjudge_to_death:
- NET_INC_STATS_BH(LINUX_MIB_TCPABORTONMEMORY);
- }
- }
-- atomic_inc(&tcp_orphan_count);
-+ tcp_inc_orphan_count(sk);
-
- if (sk->sk_state == TCP_CLOSE)
- tcp_destroy_sock(sk);
-@@ -1824,12 +1907,13 @@ int tcp_disconnect(struct sock *sk, int
- tcp_set_pcount(&tp->packets_out, 0);
- tp->snd_ssthresh = 0x7fffffff;
- tp->snd_cwnd_cnt = 0;
-+ tp->advmss = 65535;
- tcp_set_ca_state(tp, TCP_CA_Open);
- tcp_clear_retrans(tp);
- tcp_delack_init(tp);
- sk->sk_send_head = NULL;
-- tp->saw_tstamp = 0;
-- tcp_sack_reset(tp);
-+ tp->rx_opt.saw_tstamp = 0;
-+ tcp_sack_reset(&tp->rx_opt);
- __sk_dst_reset(sk);
-
- BUG_TRAP(!inet->num || tp->bind_hash);
-@@ -1968,7 +2052,7 @@ int tcp_setsockopt(struct sock *sk, int
- err = -EINVAL;
- break;
- }
-- tp->user_mss = val;
-+ tp->rx_opt.user_mss = val;
- break;
-
- case TCP_NODELAY:
-@@ -2126,7 +2210,7 @@ int tcp_getsockopt(struct sock *sk, int
- case TCP_MAXSEG:
- val = tp->mss_cache_std;
- if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)))
-- val = tp->user_mss;
-+ val = tp->rx_opt.user_mss;
- break;
- case TCP_NODELAY:
- val = !!(tp->nonagle&TCP_NAGLE_OFF);
-@@ -2190,6 +2274,7 @@ int tcp_getsockopt(struct sock *sk, int
-
- extern void __skb_cb_too_small_for_tcp(int, int);
- extern void tcpdiag_init(void);
-+extern unsigned int nr_free_lowpages(void);
-
- static __initdata unsigned long thash_entries;
- static int __init set_thash_entries(char *str)
-@@ -2213,24 +2298,26 @@ void __init tcp_init(void)
-
- tcp_openreq_cachep = kmem_cache_create("tcp_open_request",
- sizeof(struct open_request),
-- 0, SLAB_HWCACHE_ALIGN,
-+ 0, SLAB_HWCACHE_ALIGN | SLAB_UBC,
- NULL, NULL);
- if (!tcp_openreq_cachep)
- panic("tcp_init: Cannot alloc open_request cache.");
-
- tcp_bucket_cachep = kmem_cache_create("tcp_bind_bucket",
- sizeof(struct tcp_bind_bucket),
-- 0, SLAB_HWCACHE_ALIGN,
-+ 0, SLAB_HWCACHE_ALIGN | SLAB_UBC,
- NULL, NULL);
- if (!tcp_bucket_cachep)
- panic("tcp_init: Cannot alloc tcp_bind_bucket cache.");
-
- tcp_timewait_cachep = kmem_cache_create("tcp_tw_bucket",
- sizeof(struct tcp_tw_bucket),
-- 0, SLAB_HWCACHE_ALIGN,
-+ 0,
-+ SLAB_HWCACHE_ALIGN | SLAB_UBC,
- NULL, NULL);
- if (!tcp_timewait_cachep)
- panic("tcp_init: Cannot alloc tcp_tw_bucket cache.");
-+ tcp_timewait_cachep->flags |= CFLGS_ENVIDS;
-
- /* Size and allocate the main established and bind bucket
- * hash tables.
-@@ -2287,10 +2374,19 @@ void __init tcp_init(void)
- }
- tcp_port_rover = sysctl_local_port_range[0] - 1;
-
-+ goal = nr_free_lowpages() / 6;
-+ while (order >= 3 && (1536<<order) > goal)
-+ order--;
-+
- sysctl_tcp_mem[0] = 768 << order;
- sysctl_tcp_mem[1] = 1024 << order;
- sysctl_tcp_mem[2] = 1536 << order;
-
-+ if (sysctl_tcp_mem[2] - sysctl_tcp_mem[1] > 4096)
-+ sysctl_tcp_mem[1] = sysctl_tcp_mem[2] - 4096;
-+ if (sysctl_tcp_mem[1] - sysctl_tcp_mem[0] > 4096)
-+ sysctl_tcp_mem[0] = sysctl_tcp_mem[1] - 4096;
-+
- if (order < 3) {
- sysctl_tcp_wmem[2] = 64 * 1024;
- sysctl_tcp_rmem[0] = PAGE_SIZE;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_diag.c linux-2.6.9-ve023stab030/net/ipv4/tcp_diag.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_diag.c 2004-10-19 01:53:06.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_diag.c 2006-10-11 19:07:57.000000000 +0400
-@@ -55,14 +55,14 @@ void tcp_get_info(struct sock *sk, struc
- info->tcpi_probes = tp->probes_out;
- info->tcpi_backoff = tp->backoff;
-
-- if (tp->tstamp_ok)
-+ if (tp->rx_opt.tstamp_ok)
- info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
-- if (tp->sack_ok)
-+ if (tp->rx_opt.sack_ok)
- info->tcpi_options |= TCPI_OPT_SACK;
-- if (tp->wscale_ok) {
-+ if (tp->rx_opt.wscale_ok) {
- info->tcpi_options |= TCPI_OPT_WSCALE;
-- info->tcpi_snd_wscale = tp->snd_wscale;
-- info->tcpi_rcv_wscale = tp->rcv_wscale;
-+ info->tcpi_snd_wscale = tp->rx_opt.snd_wscale;
-+ info->tcpi_rcv_wscale = tp->rx_opt.rcv_wscale;
- }
-
- if (tp->ecn_flags&TCP_ECN_OK)
-@@ -261,7 +261,7 @@ static int tcpdiag_get_exact(struct sk_b
- return -EINVAL;
- }
-
-- if (sk == NULL)
-+ if (sk == NULL || !ve_accessible(VE_OWNER_SK(sk), get_exec_env()))
- return -ENOENT;
-
- err = -ESTALE;
-@@ -473,6 +473,9 @@ static int tcpdiag_dump(struct sk_buff *
- int s_i, s_num;
- struct tcpdiagreq *r = NLMSG_DATA(cb->nlh);
- struct rtattr *bc = NULL;
-+ struct ve_struct *ve;
-+
-+ ve = get_exec_env();
-
- if (cb->nlh->nlmsg_len > 4+NLMSG_SPACE(sizeof(struct tcpdiagreq)))
- bc = (struct rtattr*)(r+1);
-@@ -494,6 +497,9 @@ static int tcpdiag_dump(struct sk_buff *
- num = 0;
- sk_for_each(sk, node, &tcp_listening_hash[i]) {
- struct inet_opt *inet = inet_sk(sk);
-+
-+ if (!ve_accessible(VE_OWNER_SK(sk), ve))
-+ continue;
- if (num < s_num)
- goto next_listen;
- if (!(r->tcpdiag_states&TCPF_LISTEN) ||
-@@ -537,6 +543,8 @@ skip_listen_ht:
- sk_for_each(sk, node, &head->chain) {
- struct inet_opt *inet = inet_sk(sk);
-
-+ if (!ve_accessible(VE_OWNER_SK(sk), ve))
-+ continue;
- if (num < s_num)
- goto next_normal;
- if (!(r->tcpdiag_states & (1 << sk->sk_state)))
-@@ -562,7 +570,11 @@ next_normal:
- sk_for_each(sk, node,
- &tcp_ehash[i + tcp_ehash_size].chain) {
- struct inet_opt *inet = inet_sk(sk);
-+ struct tcp_tw_bucket *tw;
-
-+ tw = (struct tcp_tw_bucket*)sk;
-+ if (!ve_accessible_veid(TW_VEID(tw), VEID(ve)))
-+ continue;
- if (num < s_num)
- goto next_dying;
- if (r->id.tcpdiag_sport != inet->sport &&
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_input.c linux-2.6.9-ve023stab030/net/ipv4/tcp_input.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_input.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_input.c 2006-10-11 19:07:56.000000000 +0400
-@@ -72,6 +72,8 @@
- #include <net/inet_common.h>
- #include <linux/ipsec.h>
-
-+#include <ub/ub_tcp.h>
-+
- int sysctl_tcp_timestamps = 1;
- int sysctl_tcp_window_scaling = 1;
- int sysctl_tcp_sack = 1;
-@@ -119,9 +121,9 @@ int sysctl_tcp_bic_beta = 819; /* = 819
- #define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE)
- #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
-
--#define IsReno(tp) ((tp)->sack_ok == 0)
--#define IsFack(tp) ((tp)->sack_ok & 2)
--#define IsDSack(tp) ((tp)->sack_ok & 4)
-+#define IsReno(tp) ((tp)->rx_opt.sack_ok == 0)
-+#define IsFack(tp) ((tp)->rx_opt.sack_ok & 2)
-+#define IsDSack(tp) ((tp)->rx_opt.sack_ok & 4)
-
- #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH)
-
-@@ -204,7 +206,7 @@ static __inline__ int tcp_in_quickack_mo
-
- static void tcp_fixup_sndbuf(struct sock *sk)
- {
-- int sndmem = tcp_sk(sk)->mss_clamp + MAX_TCP_HEADER + 16 +
-+ int sndmem = tcp_sk(sk)->rx_opt.mss_clamp + MAX_TCP_HEADER + 16 +
- sizeof(struct sk_buff);
-
- if (sk->sk_sndbuf < 3 * sndmem)
-@@ -260,7 +262,7 @@ tcp_grow_window(struct sock *sk, struct
- /* Check #1 */
- if (tp->rcv_ssthresh < tp->window_clamp &&
- (int)tp->rcv_ssthresh < tcp_space(sk) &&
-- !tcp_memory_pressure) {
-+ ub_tcp_rmem_allows_expand(sk)) {
- int incr;
-
- /* Check #2. Increase window, if skb with such overhead
-@@ -329,6 +331,8 @@ static void tcp_init_buffer_space(struct
-
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp);
- tp->snd_cwnd_stamp = tcp_time_stamp;
-+
-+ ub_tcp_update_maxadvmss(sk);
- }
-
- static void init_bictcp(struct tcp_opt *tp)
-@@ -359,7 +363,7 @@ static void tcp_clamp_window(struct sock
- if (ofo_win) {
- if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] &&
- !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
-- !tcp_memory_pressure &&
-+ !ub_tcp_memory_pressure(sk) &&
- atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0])
- sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc),
- sysctl_tcp_rmem[2]);
-@@ -439,10 +443,10 @@ new_measure:
-
- static inline void tcp_rcv_rtt_measure_ts(struct tcp_opt *tp, struct sk_buff *skb)
- {
-- if (tp->rcv_tsecr &&
-+ if (tp->rx_opt.rcv_tsecr &&
- (TCP_SKB_CB(skb)->end_seq -
- TCP_SKB_CB(skb)->seq >= tp->ack.rcv_mss))
-- tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_tsecr, 0);
-+ tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rx_opt.rcv_tsecr, 0);
- }
-
- /*
-@@ -832,7 +836,7 @@ static void tcp_init_metrics(struct sock
- }
- if (dst_metric(dst, RTAX_REORDERING) &&
- tp->reordering != dst_metric(dst, RTAX_REORDERING)) {
-- tp->sack_ok &= ~2;
-+ tp->rx_opt.sack_ok &= ~2;
- tp->reordering = dst_metric(dst, RTAX_REORDERING);
- }
-
-@@ -866,7 +870,7 @@ static void tcp_init_metrics(struct sock
- }
- tcp_set_rto(tp);
- tcp_bound_rto(tp);
-- if (tp->rto < TCP_TIMEOUT_INIT && !tp->saw_tstamp)
-+ if (tp->rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp)
- goto reset;
- tp->snd_cwnd = tcp_init_cwnd(tp, dst);
- tp->snd_cwnd_stamp = tcp_time_stamp;
-@@ -877,7 +881,7 @@ reset:
- * supported, TCP will fail to recalculate correct
- * rtt, if initial rto is too small. FORGET ALL AND RESET!
- */
-- if (!tp->saw_tstamp && tp->srtt) {
-+ if (!tp->rx_opt.saw_tstamp && tp->srtt) {
- tp->srtt = 0;
- tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT;
- tp->rto = TCP_TIMEOUT_INIT;
-@@ -900,14 +904,14 @@ static void tcp_update_reordering(struct
- NET_INC_STATS_BH(LINUX_MIB_TCPSACKREORDER);
- #if FASTRETRANS_DEBUG > 1
- printk(KERN_DEBUG "Disorder%d %d %u f%u s%u rr%d\n",
-- tp->sack_ok, tp->ca_state,
-+ tp->rx_opt.sack_ok, tp->ca_state,
- tp->reordering,
- tcp_get_pcount(&tp->fackets_out),
- tcp_get_pcount(&tp->sacked_out),
- tp->undo_marker ? tp->undo_retrans : 0);
- #endif
- /* Disable FACK yet. */
-- tp->sack_ok &= ~2;
-+ tp->rx_opt.sack_ok &= ~2;
- }
- }
-
-@@ -997,13 +1001,13 @@ tcp_sacktag_write_queue(struct sock *sk,
-
- if (before(start_seq, ack)) {
- dup_sack = 1;
-- tp->sack_ok |= 4;
-+ tp->rx_opt.sack_ok |= 4;
- NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
- } else if (num_sacks > 1 &&
- !after(end_seq, ntohl(sp[1].end_seq)) &&
- !before(start_seq, ntohl(sp[1].start_seq))) {
- dup_sack = 1;
-- tp->sack_ok |= 4;
-+ tp->rx_opt.sack_ok |= 4;
- NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
- }
-
-@@ -1639,8 +1643,8 @@ static void tcp_cwnd_down(struct tcp_opt
- static __inline__ int tcp_packet_delayed(struct tcp_opt *tp)
- {
- return !tp->retrans_stamp ||
-- (tp->saw_tstamp && tp->rcv_tsecr &&
-- (__s32)(tp->rcv_tsecr - tp->retrans_stamp) < 0);
-+ (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
-+ (__s32)(tp->rx_opt.rcv_tsecr - tp->retrans_stamp) < 0);
- }
-
- /* Undo procedures. */
-@@ -1993,7 +1997,7 @@ static void tcp_ack_saw_tstamp(struct tc
- * answer arrives rto becomes 120 seconds! If at least one of segments
- * in window is lost... Voila. --ANK (010210)
- */
-- seq_rtt = tcp_time_stamp - tp->rcv_tsecr;
-+ seq_rtt = tcp_time_stamp - tp->rx_opt.rcv_tsecr;
- tcp_rtt_estimator(tp, seq_rtt);
- tcp_set_rto(tp);
- tp->backoff = 0;
-@@ -2024,7 +2028,7 @@ static __inline__ void
- tcp_ack_update_rtt(struct tcp_opt *tp, int flag, s32 seq_rtt)
- {
- /* Note that peer MAY send zero echo. In this case it is ignored. (rfc1323) */
-- if (tp->saw_tstamp && tp->rcv_tsecr)
-+ if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
- tcp_ack_saw_tstamp(tp, flag);
- else if (seq_rtt >= 0)
- tcp_ack_no_tstamp(tp, seq_rtt, flag);
-@@ -2502,7 +2506,7 @@ static int tcp_clean_rtx_queue(struct so
- BUG_TRAP((int)tcp_get_pcount(&tp->sacked_out) >= 0);
- BUG_TRAP((int)tcp_get_pcount(&tp->lost_out) >= 0);
- BUG_TRAP((int)tcp_get_pcount(&tp->retrans_out) >= 0);
-- if (!tcp_get_pcount(&tp->packets_out) && tp->sack_ok) {
-+ if (!tcp_get_pcount(&tp->packets_out) && tp->rx_opt.sack_ok) {
- if (tcp_get_pcount(&tp->lost_out)) {
- printk(KERN_DEBUG "Leak l=%u %d\n",
- tcp_get_pcount(&tp->lost_out),
-@@ -2581,7 +2585,7 @@ static int tcp_ack_update_window(struct
- u32 nwin = ntohs(skb->h.th->window);
-
- if (likely(!skb->h.th->syn))
-- nwin <<= tp->snd_wscale;
-+ nwin <<= tp->rx_opt.snd_wscale;
-
- if (tcp_may_update_window(tp, ack, ack_seq, nwin)) {
- flag |= FLAG_WIN_UPDATE;
-@@ -2989,14 +2993,15 @@ uninteresting_ack:
- * But, this can also be called on packets in the established flow when
- * the fast version below fails.
- */
--void tcp_parse_options(struct sk_buff *skb, struct tcp_opt *tp, int estab)
-+void tcp_parse_options(struct sk_buff *skb,
-+ struct tcp_options_received *opt_rx, int estab)
- {
- unsigned char *ptr;
- struct tcphdr *th = skb->h.th;
- int length=(th->doff*4)-sizeof(struct tcphdr);
-
- ptr = (unsigned char *)(th + 1);
-- tp->saw_tstamp = 0;
-+ opt_rx->saw_tstamp = 0;
-
- while(length>0) {
- int opcode=*ptr++;
-@@ -3019,41 +3024,41 @@ void tcp_parse_options(struct sk_buff *s
- if(opsize==TCPOLEN_MSS && th->syn && !estab) {
- u16 in_mss = ntohs(*(__u16 *)ptr);
- if (in_mss) {
-- if (tp->user_mss && tp->user_mss < in_mss)
-- in_mss = tp->user_mss;
-- tp->mss_clamp = in_mss;
-+ if (opt_rx->user_mss && opt_rx->user_mss < in_mss)
-+ in_mss = opt_rx->user_mss;
-+ opt_rx->mss_clamp = in_mss;
- }
- }
- break;
- case TCPOPT_WINDOW:
- if(opsize==TCPOLEN_WINDOW && th->syn && !estab)
- if (sysctl_tcp_window_scaling) {
-- tp->wscale_ok = 1;
-- tp->snd_wscale = *(__u8 *)ptr;
-- if(tp->snd_wscale > 14) {
-+ opt_rx->wscale_ok = 1;
-+ opt_rx->snd_wscale = *(__u8 *)ptr;
-+ if(opt_rx->snd_wscale > 14) {
- if(net_ratelimit())
- printk("tcp_parse_options: Illegal window "
- "scaling value %d >14 received.",
-- tp->snd_wscale);
-- tp->snd_wscale = 14;
-+ opt_rx->snd_wscale);
-+ opt_rx->snd_wscale = 14;
- }
- }
- break;
- case TCPOPT_TIMESTAMP:
- if(opsize==TCPOLEN_TIMESTAMP) {
-- if ((estab && tp->tstamp_ok) ||
-+ if ((estab && opt_rx->tstamp_ok) ||
- (!estab && sysctl_tcp_timestamps)) {
-- tp->saw_tstamp = 1;
-- tp->rcv_tsval = ntohl(*(__u32 *)ptr);
-- tp->rcv_tsecr = ntohl(*(__u32 *)(ptr+4));
-+ opt_rx->saw_tstamp = 1;
-+ opt_rx->rcv_tsval = ntohl(*(__u32 *)ptr);
-+ opt_rx->rcv_tsecr = ntohl(*(__u32 *)(ptr+4));
- }
- }
- break;
- case TCPOPT_SACK_PERM:
- if(opsize==TCPOLEN_SACK_PERM && th->syn && !estab) {
- if (sysctl_tcp_sack) {
-- tp->sack_ok = 1;
-- tcp_sack_reset(tp);
-+ opt_rx->sack_ok = 1;
-+ tcp_sack_reset(opt_rx);
- }
- }
- break;
-@@ -3061,7 +3066,7 @@ void tcp_parse_options(struct sk_buff *s
- case TCPOPT_SACK:
- if((opsize >= (TCPOLEN_SACK_BASE + TCPOLEN_SACK_PERBLOCK)) &&
- !((opsize - TCPOLEN_SACK_BASE) % TCPOLEN_SACK_PERBLOCK) &&
-- tp->sack_ok) {
-+ opt_rx->sack_ok) {
- TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th;
- }
- };
-@@ -3077,36 +3082,36 @@ void tcp_parse_options(struct sk_buff *s
- static __inline__ int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, struct tcp_opt *tp)
- {
- if (th->doff == sizeof(struct tcphdr)>>2) {
-- tp->saw_tstamp = 0;
-+ tp->rx_opt.saw_tstamp = 0;
- return 0;
-- } else if (tp->tstamp_ok &&
-+ } else if (tp->rx_opt.tstamp_ok &&
- th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) {
- __u32 *ptr = (__u32 *)(th + 1);
- if (*ptr == ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
-- tp->saw_tstamp = 1;
-+ tp->rx_opt.saw_tstamp = 1;
- ++ptr;
-- tp->rcv_tsval = ntohl(*ptr);
-+ tp->rx_opt.rcv_tsval = ntohl(*ptr);
- ++ptr;
-- tp->rcv_tsecr = ntohl(*ptr);
-+ tp->rx_opt.rcv_tsecr = ntohl(*ptr);
- return 1;
- }
- }
-- tcp_parse_options(skb, tp, 1);
-+ tcp_parse_options(skb, &tp->rx_opt, 1);
- return 1;
- }
-
- static __inline__ void
- tcp_store_ts_recent(struct tcp_opt *tp)
- {
-- tp->ts_recent = tp->rcv_tsval;
-- tp->ts_recent_stamp = xtime.tv_sec;
-+ tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
-+ tp->rx_opt.ts_recent_stamp = xtime.tv_sec;
- }
-
- static __inline__ void
- tcp_replace_ts_recent(struct tcp_opt *tp, u32 seq)
- {
-- if (tp->saw_tstamp && !after(seq, tp->rcv_wup)) {
-+ if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) {
- /* PAWS bug workaround wrt. ACK frames, the PAWS discard
- * extra check below makes sure this can only happen
- * for pure ACK frames. -DaveM
-@@ -3114,8 +3119,8 @@ tcp_replace_ts_recent(struct tcp_opt *tp
- * Not only, also it occurs for expired timestamps.
- */
-
-- if((s32)(tp->rcv_tsval - tp->ts_recent) >= 0 ||
-- xtime.tv_sec >= tp->ts_recent_stamp + TCP_PAWS_24DAYS)
-+ if((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) >= 0 ||
-+ xtime.tv_sec >= tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS)
- tcp_store_ts_recent(tp);
- }
- }
-@@ -3156,16 +3161,16 @@ static int tcp_disordered_ack(struct tcp
- ack == tp->snd_una &&
-
- /* 3. ... and does not update window. */
-- !tcp_may_update_window(tp, ack, seq, ntohs(th->window)<<tp->snd_wscale) &&
-+ !tcp_may_update_window(tp, ack, seq, ntohs(th->window)<<tp->rx_opt.snd_wscale) &&
-
- /* 4. ... and sits in replay window. */
-- (s32)(tp->ts_recent - tp->rcv_tsval) <= (tp->rto*1024)/HZ);
-+ (s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) <= (tp->rto*1024)/HZ);
- }
-
- static __inline__ int tcp_paws_discard(struct tcp_opt *tp, struct sk_buff *skb)
- {
-- return ((s32)(tp->ts_recent - tp->rcv_tsval) > TCP_PAWS_WINDOW &&
-- xtime.tv_sec < tp->ts_recent_stamp + TCP_PAWS_24DAYS &&
-+ return ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) > TCP_PAWS_WINDOW &&
-+ xtime.tv_sec < tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS &&
- !tcp_disordered_ack(tp, skb));
- }
-
-@@ -3278,8 +3283,8 @@ static void tcp_fin(struct sk_buff *skb,
- * Probably, we should reset in this case. For now drop them.
- */
- __skb_queue_purge(&tp->out_of_order_queue);
-- if (tp->sack_ok)
-- tcp_sack_reset(tp);
-+ if (tp->rx_opt.sack_ok)
-+ tcp_sack_reset(&tp->rx_opt);
- sk_stream_mem_reclaim(sk);
-
- if (!sock_flag(sk, SOCK_DEAD)) {
-@@ -3309,22 +3314,22 @@ tcp_sack_extend(struct tcp_sack_block *s
-
- static __inline__ void tcp_dsack_set(struct tcp_opt *tp, u32 seq, u32 end_seq)
- {
-- if (tp->sack_ok && sysctl_tcp_dsack) {
-+ if (tp->rx_opt.sack_ok && sysctl_tcp_dsack) {
- if (before(seq, tp->rcv_nxt))
- NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOLDSENT);
- else
- NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFOSENT);
-
-- tp->dsack = 1;
-+ tp->rx_opt.dsack = 1;
- tp->duplicate_sack[0].start_seq = seq;
- tp->duplicate_sack[0].end_seq = end_seq;
-- tp->eff_sacks = min(tp->num_sacks+1, 4-tp->tstamp_ok);
-+ tp->rx_opt.eff_sacks = min(tp->rx_opt.num_sacks+1, 4-tp->rx_opt.tstamp_ok);
- }
- }
-
- static __inline__ void tcp_dsack_extend(struct tcp_opt *tp, u32 seq, u32 end_seq)
- {
-- if (!tp->dsack)
-+ if (!tp->rx_opt.dsack)
- tcp_dsack_set(tp, seq, end_seq);
- else
- tcp_sack_extend(tp->duplicate_sack, seq, end_seq);
-@@ -3339,7 +3344,7 @@ static void tcp_send_dupack(struct sock
- NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOST);
- tcp_enter_quickack_mode(tp);
-
-- if (tp->sack_ok && sysctl_tcp_dsack) {
-+ if (tp->rx_opt.sack_ok && sysctl_tcp_dsack) {
- u32 end_seq = TCP_SKB_CB(skb)->end_seq;
-
- if (after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))
-@@ -3363,16 +3368,16 @@ static void tcp_sack_maybe_coalesce(stru
- /* See if the recent change to the first SACK eats into
- * or hits the sequence space of other SACK blocks, if so coalesce.
- */
-- for (this_sack = 1; this_sack < tp->num_sacks; ) {
-+ for (this_sack = 1; this_sack < tp->rx_opt.num_sacks; ) {
- if (tcp_sack_extend(sp, swalk->start_seq, swalk->end_seq)) {
- int i;
-
- /* Zap SWALK, by moving every further SACK up by one slot.
- * Decrease num_sacks.
- */
-- tp->num_sacks--;
-- tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
-- for(i=this_sack; i < tp->num_sacks; i++)
-+ tp->rx_opt.num_sacks--;
-+ tp->rx_opt.eff_sacks = min(tp->rx_opt.num_sacks + tp->rx_opt.dsack, 4 - tp->rx_opt.tstamp_ok);
-+ for(i=this_sack; i < tp->rx_opt.num_sacks; i++)
- sp[i] = sp[i+1];
- continue;
- }
-@@ -3397,7 +3402,7 @@ static void tcp_sack_new_ofo_skb(struct
- {
- struct tcp_opt *tp = tcp_sk(sk);
- struct tcp_sack_block *sp = &tp->selective_acks[0];
-- int cur_sacks = tp->num_sacks;
-+ int cur_sacks = tp->rx_opt.num_sacks;
- int this_sack;
-
- if (!cur_sacks)
-@@ -3422,7 +3427,7 @@ static void tcp_sack_new_ofo_skb(struct
- */
- if (this_sack >= 4) {
- this_sack--;
-- tp->num_sacks--;
-+ tp->rx_opt.num_sacks--;
- sp--;
- }
- for(; this_sack > 0; this_sack--, sp--)
-@@ -3432,8 +3437,8 @@ new_sack:
- /* Build the new head SACK, and we're done. */
- sp->start_seq = seq;
- sp->end_seq = end_seq;
-- tp->num_sacks++;
-- tp->eff_sacks = min(tp->num_sacks + tp->dsack, 4 - tp->tstamp_ok);
-+ tp->rx_opt.num_sacks++;
-+ tp->rx_opt.eff_sacks = min(tp->rx_opt.num_sacks + tp->rx_opt.dsack, 4 - tp->rx_opt.tstamp_ok);
- }
-
- /* RCV.NXT advances, some SACKs should be eaten. */
-@@ -3441,13 +3446,13 @@ new_sack:
- static void tcp_sack_remove(struct tcp_opt *tp)
- {
- struct tcp_sack_block *sp = &tp->selective_acks[0];
-- int num_sacks = tp->num_sacks;
-+ int num_sacks = tp->rx_opt.num_sacks;
- int this_sack;
-
- /* Empty ofo queue, hence, all the SACKs are eaten. Clear. */
- if (skb_queue_len(&tp->out_of_order_queue) == 0) {
-- tp->num_sacks = 0;
-- tp->eff_sacks = tp->dsack;
-+ tp->rx_opt.num_sacks = 0;
-+ tp->rx_opt.eff_sacks = tp->rx_opt.dsack;
- return;
- }
-
-@@ -3468,9 +3473,9 @@ static void tcp_sack_remove(struct tcp_o
- this_sack++;
- sp++;
- }
-- if (num_sacks != tp->num_sacks) {
-- tp->num_sacks = num_sacks;
-- tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
-+ if (num_sacks != tp->rx_opt.num_sacks) {
-+ tp->rx_opt.num_sacks = num_sacks;
-+ tp->rx_opt.eff_sacks = min(tp->rx_opt.num_sacks + tp->rx_opt.dsack, 4 - tp->rx_opt.tstamp_ok);
- }
- }
-
-@@ -3528,10 +3533,10 @@ static void tcp_data_queue(struct sock *
-
- TCP_ECN_accept_cwr(tp, skb);
-
-- if (tp->dsack) {
-- tp->dsack = 0;
-- tp->eff_sacks = min_t(unsigned int, tp->num_sacks,
-- 4 - tp->tstamp_ok);
-+ if (tp->rx_opt.dsack) {
-+ tp->rx_opt.dsack = 0;
-+ tp->rx_opt.eff_sacks = min_t(unsigned int, tp->rx_opt.num_sacks,
-+ 4 - tp->rx_opt.tstamp_ok);
- }
-
- /* Queue data for delivery to the user.
-@@ -3568,7 +3573,7 @@ queue_and_out:
- !sk_stream_rmem_schedule(sk, skb))) {
- if (tcp_prune_queue(sk) < 0 ||
- !sk_stream_rmem_schedule(sk, skb))
-- goto drop;
-+ goto drop_part;
- }
- sk_stream_set_owner_r(skb, sk);
- __skb_queue_tail(&sk->sk_receive_queue, skb);
-@@ -3589,7 +3594,7 @@ queue_and_out:
- tp->ack.pingpong = 0;
- }
-
-- if (tp->num_sacks)
-+ if (tp->rx_opt.num_sacks)
- tcp_sack_remove(tp);
-
- tcp_fast_path_check(sk, tp);
-@@ -3612,6 +3617,12 @@ out_of_window:
- drop:
- __kfree_skb(skb);
- return;
-+
-+drop_part:
-+ if (after(tp->copied_seq, tp->rcv_nxt))
-+ tp->rcv_nxt = tp->copied_seq;
-+ __kfree_skb(skb);
-+ return;
- }
-
- /* Out of window. F.e. zero window probe. */
-@@ -3656,10 +3667,10 @@ drop:
-
- if (!skb_peek(&tp->out_of_order_queue)) {
- /* Initial out of order segment, build 1 SACK. */
-- if (tp->sack_ok) {
-- tp->num_sacks = 1;
-- tp->dsack = 0;
-- tp->eff_sacks = 1;
-+ if (tp->rx_opt.sack_ok) {
-+ tp->rx_opt.num_sacks = 1;
-+ tp->rx_opt.dsack = 0;
-+ tp->rx_opt.eff_sacks = 1;
- tp->selective_acks[0].start_seq = TCP_SKB_CB(skb)->seq;
- tp->selective_acks[0].end_seq =
- TCP_SKB_CB(skb)->end_seq;
-@@ -3673,7 +3684,7 @@ drop:
- if (seq == TCP_SKB_CB(skb1)->end_seq) {
- __skb_append(skb1, skb);
-
-- if (!tp->num_sacks ||
-+ if (!tp->rx_opt.num_sacks ||
- tp->selective_acks[0].end_seq != seq)
- goto add_sack;
-
-@@ -3721,7 +3732,7 @@ drop:
- }
-
- add_sack:
-- if (tp->sack_ok)
-+ if (tp->rx_opt.sack_ok)
- tcp_sack_new_ofo_skb(sk, seq, end_seq);
- }
- }
-@@ -3783,6 +3794,10 @@ tcp_collapse(struct sock *sk, struct sk_
- nskb = alloc_skb(copy+header, GFP_ATOMIC);
- if (!nskb)
- return;
-+ if (ub_tcprcvbuf_charge_forced(skb->sk, nskb) < 0) {
-+ kfree_skb(nskb);
-+ return;
-+ }
- skb_reserve(nskb, header);
- memcpy(nskb->head, skb->head, header);
- nskb->nh.raw = nskb->head + (skb->nh.raw-skb->head);
-@@ -3878,7 +3893,7 @@ static int tcp_prune_queue(struct sock *
-
- if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
- tcp_clamp_window(sk, tp);
-- else if (tcp_memory_pressure)
-+ else if (ub_tcp_memory_pressure(sk))
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U * tp->advmss);
-
- tcp_collapse_ofo_queue(sk);
-@@ -3904,8 +3919,8 @@ static int tcp_prune_queue(struct sock *
- * is in a sad state like this, we care only about integrity
- * of the connection not performance.
- */
-- if (tp->sack_ok)
-- tcp_sack_reset(tp);
-+ if (tp->rx_opt.sack_ok)
-+ tcp_sack_reset(&tp->rx_opt);
- sk_stream_mem_reclaim(sk);
- }
-
-@@ -3960,7 +3975,7 @@ static void tcp_new_space(struct sock *s
- !(sk->sk_userlocks & SOCK_SNDBUF_LOCK) &&
- !tcp_memory_pressure &&
- atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) {
-- int sndmem = max_t(u32, tp->mss_clamp, tp->mss_cache_std) +
-+ int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache_std) +
- MAX_TCP_HEADER + 16 + sizeof(struct sk_buff),
- demanded = max_t(unsigned int, tp->snd_cwnd,
- tp->reordering + 1);
-@@ -4227,7 +4242,7 @@ int tcp_rcv_established(struct sock *sk,
- * We do checksum and copy also but from device to kernel.
- */
-
-- tp->saw_tstamp = 0;
-+ tp->rx_opt.saw_tstamp = 0;
-
- /* pred_flags is 0xS?10 << 16 + snd_wnd
- * if header_predition is to be made
-@@ -4256,14 +4271,14 @@ int tcp_rcv_established(struct sock *sk,
- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP))
- goto slow_path;
-
-- tp->saw_tstamp = 1;
-+ tp->rx_opt.saw_tstamp = 1;
- ++ptr;
-- tp->rcv_tsval = ntohl(*ptr);
-+ tp->rx_opt.rcv_tsval = ntohl(*ptr);
- ++ptr;
-- tp->rcv_tsecr = ntohl(*ptr);
-+ tp->rx_opt.rcv_tsecr = ntohl(*ptr);
-
- /* If PAWS failed, check it more carefully in slow path */
-- if ((s32)(tp->rcv_tsval - tp->ts_recent) < 0)
-+ if ((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) < 0)
- goto slow_path;
-
- /* DO NOT update ts_recent here, if checksum fails
-@@ -4343,6 +4358,10 @@ int tcp_rcv_established(struct sock *sk,
-
- if ((int)skb->truesize > sk->sk_forward_alloc)
- goto step5;
-+ /* This is OK not to try to free memory here.
-+ * Do this below on slow path. Den */
-+ if (ub_tcprcvbuf_charge(sk, skb) < 0)
-+ goto step5;
-
- NET_INC_STATS_BH(LINUX_MIB_TCPHPHITS);
-
-@@ -4389,7 +4408,7 @@ slow_path:
- /*
- * RFC1323: H1. Apply PAWS check first.
- */
-- if (tcp_fast_parse_options(skb, th, tp) && tp->saw_tstamp &&
-+ if (tcp_fast_parse_options(skb, th, tp) && tp->rx_opt.saw_tstamp &&
- tcp_paws_discard(tp, skb)) {
- if (!th->rst) {
- NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
-@@ -4461,9 +4480,9 @@ static int tcp_rcv_synsent_state_process
- struct tcphdr *th, unsigned len)
- {
- struct tcp_opt *tp = tcp_sk(sk);
-- int saved_clamp = tp->mss_clamp;
-+ int saved_clamp = tp->rx_opt.mss_clamp;
-
-- tcp_parse_options(skb, tp, 0);
-+ tcp_parse_options(skb, &tp->rx_opt, 0);
-
- if (th->ack) {
- /* rfc793:
-@@ -4480,8 +4499,8 @@ static int tcp_rcv_synsent_state_process
- if (TCP_SKB_CB(skb)->ack_seq != tp->snd_nxt)
- goto reset_and_undo;
-
-- if (tp->saw_tstamp && tp->rcv_tsecr &&
-- !between(tp->rcv_tsecr, tp->retrans_stamp,
-+ if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
-+ !between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp,
- tcp_time_stamp)) {
- NET_INC_STATS_BH(LINUX_MIB_PAWSACTIVEREJECTED);
- goto reset_and_undo;
-@@ -4536,13 +4555,13 @@ static int tcp_rcv_synsent_state_process
- tp->snd_wnd = ntohs(th->window);
- tcp_init_wl(tp, TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(skb)->seq);
-
-- if (!tp->wscale_ok) {
-- tp->snd_wscale = tp->rcv_wscale = 0;
-+ if (!tp->rx_opt.wscale_ok) {
-+ tp->rx_opt.snd_wscale = tp->rx_opt.rcv_wscale = 0;
- tp->window_clamp = min(tp->window_clamp, 65535U);
- }
-
-- if (tp->saw_tstamp) {
-- tp->tstamp_ok = 1;
-+ if (tp->rx_opt.saw_tstamp) {
-+ tp->rx_opt.tstamp_ok = 1;
- tp->tcp_header_len =
- sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
- tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
-@@ -4551,8 +4570,8 @@ static int tcp_rcv_synsent_state_process
- tp->tcp_header_len = sizeof(struct tcphdr);
- }
-
-- if (tp->sack_ok && sysctl_tcp_fack)
-- tp->sack_ok |= 2;
-+ if (tp->rx_opt.sack_ok && sysctl_tcp_fack)
-+ tp->rx_opt.sack_ok |= 2;
-
- tcp_sync_mss(sk, tp->pmtu_cookie);
- tcp_initialize_rcv_mss(sk);
-@@ -4579,7 +4598,7 @@ static int tcp_rcv_synsent_state_process
- if (sock_flag(sk, SOCK_KEEPOPEN))
- tcp_reset_keepalive_timer(sk, keepalive_time_when(tp));
-
-- if (!tp->snd_wscale)
-+ if (!tp->rx_opt.snd_wscale)
- __tcp_fast_path_on(tp, tp->snd_wnd);
- else
- tp->pred_flags = 0;
-@@ -4626,7 +4645,7 @@ discard:
- }
-
- /* PAWS check. */
-- if (tp->ts_recent_stamp && tp->saw_tstamp && tcp_paws_check(tp, 0))
-+ if (tp->rx_opt.ts_recent_stamp && tp->rx_opt.saw_tstamp && tcp_paws_check(&tp->rx_opt, 0))
- goto discard_and_undo;
-
- if (th->syn) {
-@@ -4636,8 +4655,8 @@ discard:
- */
- tcp_set_state(sk, TCP_SYN_RECV);
-
-- if (tp->saw_tstamp) {
-- tp->tstamp_ok = 1;
-+ if (tp->rx_opt.saw_tstamp) {
-+ tp->rx_opt.tstamp_ok = 1;
- tcp_store_ts_recent(tp);
- tp->tcp_header_len =
- sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
-@@ -4684,13 +4703,13 @@ discard:
- */
-
- discard_and_undo:
-- tcp_clear_options(tp);
-- tp->mss_clamp = saved_clamp;
-+ tcp_clear_options(&tp->rx_opt);
-+ tp->rx_opt.mss_clamp = saved_clamp;
- goto discard;
-
- reset_and_undo:
-- tcp_clear_options(tp);
-- tp->mss_clamp = saved_clamp;
-+ tcp_clear_options(&tp->rx_opt);
-+ tp->rx_opt.mss_clamp = saved_clamp;
- return 1;
- }
-
-@@ -4708,7 +4727,7 @@ int tcp_rcv_state_process(struct sock *s
- struct tcp_opt *tp = tcp_sk(sk);
- int queued = 0;
-
-- tp->saw_tstamp = 0;
-+ tp->rx_opt.saw_tstamp = 0;
-
- switch (sk->sk_state) {
- case TCP_CLOSE:
-@@ -4763,7 +4782,7 @@ int tcp_rcv_state_process(struct sock *s
- return 0;
- }
-
-- if (tcp_fast_parse_options(skb, th, tp) && tp->saw_tstamp &&
-+ if (tcp_fast_parse_options(skb, th, tp) && tp->rx_opt.saw_tstamp &&
- tcp_paws_discard(tp, skb)) {
- if (!th->rst) {
- NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
-@@ -4823,7 +4842,7 @@ int tcp_rcv_state_process(struct sock *s
-
- tp->snd_una = TCP_SKB_CB(skb)->ack_seq;
- tp->snd_wnd = ntohs(th->window) <<
-- tp->snd_wscale;
-+ tp->rx_opt.snd_wscale;
- tcp_init_wl(tp, TCP_SKB_CB(skb)->ack_seq,
- TCP_SKB_CB(skb)->seq);
-
-@@ -4831,11 +4850,11 @@ int tcp_rcv_state_process(struct sock *s
- * and does not calculate rtt.
- * Fix it at least with timestamps.
- */
-- if (tp->saw_tstamp && tp->rcv_tsecr &&
-+ if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
- !tp->srtt)
- tcp_ack_saw_tstamp(tp, 0);
-
-- if (tp->tstamp_ok)
-+ if (tp->rx_opt.tstamp_ok)
- tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
-
- /* Make sure socket is routed, for
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_ipv4.c linux-2.6.9-ve023stab030/net/ipv4/tcp_ipv4.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_ipv4.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_ipv4.c 2006-10-11 19:07:59.000000000 +0400
-@@ -69,12 +69,16 @@
- #include <net/inet_common.h>
- #include <net/xfrm.h>
-
-+#include <ub/ub_tcp.h>
-+
- #include <linux/inet.h>
- #include <linux/ipv6.h>
- #include <linux/stddef.h>
- #include <linux/proc_fs.h>
- #include <linux/seq_file.h>
-
-+#include <linux/ve_owner.h>
-+
- extern int sysctl_ip_dynaddr;
- int sysctl_tcp_tw_reuse;
- int sysctl_tcp_low_latency;
-@@ -101,13 +105,16 @@ struct tcp_hashinfo __cacheline_aligned
- * For high-usage systems, use sysctl to change this to
- * 32768-61000
- */
--int sysctl_local_port_range[2] = { 1024, 4999 };
--int tcp_port_rover = 1024 - 1;
-+#ifndef CONFIG_VE
-+int _sysctl_local_port_range[2] = { 1024, 4999 };
-+int _tcp_port_rover = 1024 - 1;
-+#endif
-
- static __inline__ int tcp_hashfn(__u32 laddr, __u16 lport,
-- __u32 faddr, __u16 fport)
-+ __u32 faddr, __u16 fport,
-+ envid_t veid)
- {
-- int h = (laddr ^ lport) ^ (faddr ^ fport);
-+ int h = (laddr ^ lport) ^ (faddr ^ fport) ^ (veid ^ (veid >> 16));
- h ^= h >> 16;
- h ^= h >> 8;
- return h & (tcp_ehash_size - 1);
-@@ -120,15 +127,20 @@ static __inline__ int tcp_sk_hashfn(stru
- __u16 lport = inet->num;
- __u32 faddr = inet->daddr;
- __u16 fport = inet->dport;
-+ envid_t veid = VEID(VE_OWNER_SK(sk));
-
-- return tcp_hashfn(laddr, lport, faddr, fport);
-+ return tcp_hashfn(laddr, lport, faddr, fport, veid);
- }
-
-+DCL_VE_OWNER(TB, GENERIC, struct tcp_bind_bucket, owner_env,
-+ inline, (always_inline))
-+
- /* Allocate and initialize a new TCP local port bind bucket.
- * The bindhash mutex for snum's hash chain must be held here.
- */
- struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
-- unsigned short snum)
-+ unsigned short snum,
-+ struct ve_struct *env)
- {
- struct tcp_bind_bucket *tb = kmem_cache_alloc(tcp_bucket_cachep,
- SLAB_ATOMIC);
-@@ -136,6 +148,7 @@ struct tcp_bind_bucket *tcp_bucket_creat
- tb->port = snum;
- tb->fastreuse = 0;
- INIT_HLIST_HEAD(&tb->owners);
-+ SET_VE_OWNER_TB(tb, env);
- hlist_add_head(&tb->node, &head->chain);
- }
- return tb;
-@@ -153,10 +166,11 @@ void tcp_bucket_destroy(struct tcp_bind_
- /* Caller must disable local BH processing. */
- static __inline__ void __tcp_inherit_port(struct sock *sk, struct sock *child)
- {
-- struct tcp_bind_hashbucket *head =
-- &tcp_bhash[tcp_bhashfn(inet_sk(child)->num)];
-+ struct tcp_bind_hashbucket *head;
- struct tcp_bind_bucket *tb;
-
-+ head = &tcp_bhash[tcp_bhashfn(inet_sk(child)->num,
-+ VEID(VE_OWNER_SK(child)))];
- spin_lock(&head->lock);
- tb = tcp_sk(sk)->bind_hash;
- sk_add_bind_node(child, &tb->owners);
-@@ -212,8 +226,10 @@ static int tcp_v4_get_port(struct sock *
- struct tcp_bind_hashbucket *head;
- struct hlist_node *node;
- struct tcp_bind_bucket *tb;
-+ struct ve_struct *env;
- int ret;
-
-+ env = VE_OWNER_SK(sk);
- local_bh_disable();
- if (!snum) {
- int low = sysctl_local_port_range[0];
-@@ -227,10 +243,11 @@ static int tcp_v4_get_port(struct sock *
- rover++;
- if (rover < low || rover > high)
- rover = low;
-- head = &tcp_bhash[tcp_bhashfn(rover)];
-+ head = &tcp_bhash[tcp_bhashfn(rover, VEID(env))];
- spin_lock(&head->lock);
- tb_for_each(tb, node, &head->chain)
-- if (tb->port == rover)
-+ if (tb->port == rover &&
-+ ve_accessible_strict(VE_OWNER_TB(tb), env))
- goto next;
- break;
- next:
-@@ -249,10 +266,11 @@ static int tcp_v4_get_port(struct sock *
- */
- snum = rover;
- } else {
-- head = &tcp_bhash[tcp_bhashfn(snum)];
-+ head = &tcp_bhash[tcp_bhashfn(snum, VEID(env))];
- spin_lock(&head->lock);
- tb_for_each(tb, node, &head->chain)
-- if (tb->port == snum)
-+ if (tb->port == snum &&
-+ ve_accessible_strict(VE_OWNER_TB(tb), env))
- goto tb_found;
- }
- tb = NULL;
-@@ -272,7 +290,7 @@ tb_found:
- }
- tb_not_found:
- ret = 1;
-- if (!tb && (tb = tcp_bucket_create(head, snum)) == NULL)
-+ if (!tb && (tb = tcp_bucket_create(head, snum, env)) == NULL)
- goto fail_unlock;
- if (hlist_empty(&tb->owners)) {
- if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
-@@ -301,9 +319,10 @@ fail:
- static void __tcp_put_port(struct sock *sk)
- {
- struct inet_opt *inet = inet_sk(sk);
-- struct tcp_bind_hashbucket *head = &tcp_bhash[tcp_bhashfn(inet->num)];
-+ struct tcp_bind_hashbucket *head;
- struct tcp_bind_bucket *tb;
-
-+ head = &tcp_bhash[tcp_bhashfn(inet->num, VEID(VE_OWNER_SK(sk)))];
- spin_lock(&head->lock);
- tb = tcp_sk(sk)->bind_hash;
- __sk_del_bind_node(sk);
-@@ -412,7 +431,8 @@ void tcp_unhash(struct sock *sk)
- * during the search since they can never be otherwise.
- */
- static struct sock *__tcp_v4_lookup_listener(struct hlist_head *head, u32 daddr,
-- unsigned short hnum, int dif)
-+ unsigned short hnum, int dif,
-+ struct ve_struct *env)
- {
- struct sock *result = NULL, *sk;
- struct hlist_node *node;
-@@ -422,7 +442,9 @@ static struct sock *__tcp_v4_lookup_list
- sk_for_each(sk, node, head) {
- struct inet_opt *inet = inet_sk(sk);
-
-- if (inet->num == hnum && !ipv6_only_sock(sk)) {
-+ if (inet->num == hnum &&
-+ ve_accessible_strict(VE_OWNER_SK(sk), env) &&
-+ !ipv6_only_sock(sk)) {
- __u32 rcv_saddr = inet->rcv_saddr;
-
- score = (sk->sk_family == PF_INET ? 1 : 0);
-@@ -453,18 +475,21 @@ inline struct sock *tcp_v4_lookup_listen
- {
- struct sock *sk = NULL;
- struct hlist_head *head;
-+ struct ve_struct *env;
-
-+ env = get_exec_env();
- read_lock(&tcp_lhash_lock);
-- head = &tcp_listening_hash[tcp_lhashfn(hnum)];
-+ head = &tcp_listening_hash[tcp_lhashfn(hnum, VEID(env))];
- if (!hlist_empty(head)) {
- struct inet_opt *inet = inet_sk((sk = __sk_head(head)));
-
- if (inet->num == hnum && !sk->sk_node.next &&
-+ ve_accessible_strict(VE_OWNER_SK(sk), env) &&
- (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
- (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
- !sk->sk_bound_dev_if)
- goto sherry_cache;
-- sk = __tcp_v4_lookup_listener(head, daddr, hnum, dif);
-+ sk = __tcp_v4_lookup_listener(head, daddr, hnum, dif, env);
- }
- if (sk) {
- sherry_cache:
-@@ -492,17 +517,22 @@ static inline struct sock *__tcp_v4_look
- /* Optimize here for direct hit, only listening connections can
- * have wildcards anyways.
- */
-- int hash = tcp_hashfn(daddr, hnum, saddr, sport);
-+ int hash;
-+ struct ve_struct *env;
-+
-+ env = get_exec_env();
-+ hash = tcp_hashfn(daddr, hnum, saddr, sport, VEID(env));
- head = &tcp_ehash[hash];
- read_lock(&head->lock);
- sk_for_each(sk, node, &head->chain) {
-- if (TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif))
-+ if (TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif, env))
- goto hit; /* You sunk my battleship! */
- }
-
- /* Must check for a TIME_WAIT'er before going to listener hash. */
- sk_for_each(sk, node, &(head + tcp_ehash_size)->chain) {
-- if (TCP_IPV4_TW_MATCH(sk, acookie, saddr, daddr, ports, dif))
-+ if (TCP_IPV4_TW_MATCH(sk, acookie, saddr, daddr,
-+ ports, dif, env))
- goto hit;
- }
- sk = NULL;
-@@ -553,11 +583,16 @@ static int __tcp_v4_check_established(st
- int dif = sk->sk_bound_dev_if;
- TCP_V4_ADDR_COOKIE(acookie, saddr, daddr)
- __u32 ports = TCP_COMBINED_PORTS(inet->dport, lport);
-- int hash = tcp_hashfn(daddr, lport, saddr, inet->dport);
-- struct tcp_ehash_bucket *head = &tcp_ehash[hash];
-+ int hash;
-+ struct tcp_ehash_bucket *head;
- struct sock *sk2;
- struct hlist_node *node;
- struct tcp_tw_bucket *tw;
-+ struct ve_struct *env;
-+
-+ env = VE_OWNER_SK(sk);
-+ hash = tcp_hashfn(daddr, lport, saddr, inet->dport, VEID(env));
-+ head = &tcp_ehash[hash];
-
- write_lock(&head->lock);
-
-@@ -565,7 +600,8 @@ static int __tcp_v4_check_established(st
- sk_for_each(sk2, node, &(head + tcp_ehash_size)->chain) {
- tw = (struct tcp_tw_bucket *)sk2;
-
-- if (TCP_IPV4_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) {
-+ if (TCP_IPV4_TW_MATCH(sk2, acookie, saddr, daddr,
-+ ports, dif, env)) {
- struct tcp_opt *tp = tcp_sk(sk);
-
- /* With PAWS, it is safe from the viewpoint
-@@ -589,8 +625,8 @@ static int __tcp_v4_check_established(st
- if ((tp->write_seq =
- tw->tw_snd_nxt + 65535 + 2) == 0)
- tp->write_seq = 1;
-- tp->ts_recent = tw->tw_ts_recent;
-- tp->ts_recent_stamp = tw->tw_ts_recent_stamp;
-+ tp->rx_opt.ts_recent = tw->tw_ts_recent;
-+ tp->rx_opt.ts_recent_stamp = tw->tw_ts_recent_stamp;
- sock_hold(sk2);
- goto unique;
- } else
-@@ -601,7 +637,7 @@ static int __tcp_v4_check_established(st
-
- /* And established part... */
- sk_for_each(sk2, node, &head->chain) {
-- if (TCP_IPV4_MATCH(sk2, acookie, saddr, daddr, ports, dif))
-+ if (TCP_IPV4_MATCH(sk2, acookie, saddr, daddr, ports, dif, env))
- goto not_unique;
- }
-
-@@ -643,7 +679,9 @@ static int tcp_v4_hash_connect(struct so
- struct tcp_bind_hashbucket *head;
- struct tcp_bind_bucket *tb;
- int ret;
-+ struct ve_struct *env;
-
-+ env = VE_OWNER_SK(sk);
- if (!snum) {
- int rover;
- int low = sysctl_local_port_range[0];
-@@ -674,7 +712,7 @@ static int tcp_v4_hash_connect(struct so
- rover++;
- if ((rover < low) || (rover > high))
- rover = low;
-- head = &tcp_bhash[tcp_bhashfn(rover)];
-+ head = &tcp_bhash[tcp_bhashfn(rover, VEID(env))];
- spin_lock(&head->lock);
-
- /* Does not bother with rcv_saddr checks,
-@@ -682,7 +720,9 @@ static int tcp_v4_hash_connect(struct so
- * unique enough.
- */
- tb_for_each(tb, node, &head->chain) {
-- if (tb->port == rover) {
-+ if (tb->port == rover &&
-+ ve_accessible_strict(VE_OWNER_TB(tb), env))
-+ {
- BUG_TRAP(!hlist_empty(&tb->owners));
- if (tb->fastreuse >= 0)
- goto next_port;
-@@ -694,7 +734,7 @@ static int tcp_v4_hash_connect(struct so
- }
- }
-
-- tb = tcp_bucket_create(head, rover);
-+ tb = tcp_bucket_create(head, rover, env);
- if (!tb) {
- spin_unlock(&head->lock);
- break;
-@@ -733,7 +773,7 @@ ok:
- goto out;
- }
-
-- head = &tcp_bhash[tcp_bhashfn(snum)];
-+ head = &tcp_bhash[tcp_bhashfn(snum, VEID(env))];
- tb = tcp_sk(sk)->bind_hash;
- spin_lock_bh(&head->lock);
- if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) {
-@@ -793,25 +833,25 @@ int tcp_v4_connect(struct sock *sk, stru
- inet->saddr = rt->rt_src;
- inet->rcv_saddr = inet->saddr;
-
-- if (tp->ts_recent_stamp && inet->daddr != daddr) {
-+ if (tp->rx_opt.ts_recent_stamp && inet->daddr != daddr) {
- /* Reset inherited state */
-- tp->ts_recent = 0;
-- tp->ts_recent_stamp = 0;
-- tp->write_seq = 0;
-+ tp->rx_opt.ts_recent = 0;
-+ tp->rx_opt.ts_recent_stamp = 0;
-+ tp->write_seq = 0;
- }
-
- if (sysctl_tcp_tw_recycle &&
-- !tp->ts_recent_stamp && rt->rt_dst == daddr) {
-+ !tp->rx_opt.ts_recent_stamp && rt->rt_dst == daddr) {
- struct inet_peer *peer = rt_get_peer(rt);
-
- /* VJ's idea. We save last timestamp seen from
- * the destination in peer table, when entering state TIME-WAIT
-- * and initialize ts_recent from it, when trying new connection.
-+ * and initialize rx_opt.ts_recent from it, when trying new connection.
- */
-
- if (peer && peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtime.tv_sec) {
-- tp->ts_recent_stamp = peer->tcp_ts_stamp;
-- tp->ts_recent = peer->tcp_ts;
-+ tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp;
-+ tp->rx_opt.ts_recent = peer->tcp_ts;
- }
- }
-
-@@ -822,7 +862,7 @@ int tcp_v4_connect(struct sock *sk, stru
- if (inet->opt)
- tp->ext_header_len = inet->opt->optlen;
-
-- tp->mss_clamp = 536;
-+ tp->rx_opt.mss_clamp = 536;
-
- /* Socket identity is still unknown (sport may be zero).
- * However we set state to SYN-SENT and not releasing socket
-@@ -1257,9 +1297,8 @@ static void tcp_v4_timewait_ack(struct s
- struct tcp_tw_bucket *tw = (struct tcp_tw_bucket *)sk;
-
- tcp_v4_send_ack(skb, tw->tw_snd_nxt, tw->tw_rcv_nxt,
-- tw->tw_rcv_wnd >> tw->tw_rcv_wscale, tw->tw_ts_recent);
--
-- tcp_tw_put(tw);
-+ tw->tw_rcv_wnd >> (tw->tw_rcv_wscale & TW_WSCALE_MASK),
-+ tw->tw_ts_recent);
- }
-
- static void tcp_v4_or_send_ack(struct sk_buff *skb, struct open_request *req)
-@@ -1400,10 +1439,11 @@ struct or_calltable or_ipv4 = {
- .destructor = tcp_v4_or_free,
- .send_reset = tcp_v4_send_reset,
- };
-+EXPORT_SYMBOL(or_ipv4);
-
- int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
- {
-- struct tcp_opt tp;
-+ struct tcp_options_received tmp_opt;
- struct open_request *req;
- __u32 saddr = skb->nh.iph->saddr;
- __u32 daddr = skb->nh.iph->daddr;
-@@ -1445,29 +1485,29 @@ int tcp_v4_conn_request(struct sock *sk,
- if (!req)
- goto drop;
-
-- tcp_clear_options(&tp);
-- tp.mss_clamp = 536;
-- tp.user_mss = tcp_sk(sk)->user_mss;
-+ tcp_clear_options(&tmp_opt);
-+ tmp_opt.mss_clamp = 536;
-+ tmp_opt.user_mss = tcp_sk(sk)->rx_opt.user_mss;
-
-- tcp_parse_options(skb, &tp, 0);
-+ tcp_parse_options(skb, &tmp_opt, 0);
-
- if (want_cookie) {
-- tcp_clear_options(&tp);
-- tp.saw_tstamp = 0;
-+ tcp_clear_options(&tmp_opt);
-+ tmp_opt.saw_tstamp = 0;
- }
-
-- if (tp.saw_tstamp && !tp.rcv_tsval) {
-+ if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
- /* Some OSes (unknown ones, but I see them on web server, which
- * contains information interesting only for windows'
- * users) do not send their stamp in SYN. It is easy case.
- * We simply do not advertise TS support.
- */
-- tp.saw_tstamp = 0;
-- tp.tstamp_ok = 0;
-+ tmp_opt.saw_tstamp = 0;
-+ tmp_opt.tstamp_ok = 0;
- }
-- tp.tstamp_ok = tp.saw_tstamp;
-+ tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
-
-- tcp_openreq_init(req, &tp, skb);
-+ tcp_openreq_init(req, &tmp_opt, skb);
-
- req->af.v4_req.loc_addr = daddr;
- req->af.v4_req.rmt_addr = saddr;
-@@ -1493,7 +1533,7 @@ int tcp_v4_conn_request(struct sock *sk,
- * timewait bucket, so that all the necessary checks
- * are made in the function processing timewait state.
- */
-- if (tp.saw_tstamp &&
-+ if (tmp_opt.saw_tstamp &&
- sysctl_tcp_tw_recycle &&
- (dst = tcp_v4_route_req(sk, req)) != NULL &&
- (peer = rt_get_peer((struct rtable *)dst)) != NULL &&
-@@ -1680,12 +1720,15 @@ static int tcp_v4_checksum_init(struct s
- */
- int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
- {
-+ struct user_beancounter *ub;
-+
-+ ub = set_sk_exec_ub(sk);
- if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
- TCP_CHECK_TIMER(sk);
- if (tcp_rcv_established(sk, skb, skb->h.th, skb->len))
- goto reset;
- TCP_CHECK_TIMER(sk);
-- return 0;
-+ goto restore_context;
- }
-
- if (skb->len < (skb->h.th->doff << 2) || tcp_checksum_complete(skb))
-@@ -1699,7 +1742,7 @@ int tcp_v4_do_rcv(struct sock *sk, struc
- if (nsk != sk) {
- if (tcp_child_process(sk, nsk, skb))
- goto reset;
-- return 0;
-+ goto restore_context;
- }
- }
-
-@@ -1707,6 +1750,9 @@ int tcp_v4_do_rcv(struct sock *sk, struc
- if (tcp_rcv_state_process(sk, skb, skb->h.th, skb->len))
- goto reset;
- TCP_CHECK_TIMER(sk);
-+
-+restore_context:
-+ (void)set_exec_ub(ub);
- return 0;
-
- reset:
-@@ -1718,7 +1764,7 @@ discard:
- * might be destroyed here. This current version compiles correctly,
- * but you have been warned.
- */
-- return 0;
-+ goto restore_context;
-
- csum_err:
- TCP_INC_STATS_BH(TCP_MIB_INERRS);
-@@ -1831,13 +1877,17 @@ do_time_wait:
- tcp_tw_put((struct tcp_tw_bucket *) sk);
- goto discard_it;
- }
-+ spin_lock(&((struct tcp_tw_bucket *)sk)->tw_lock);
- switch (tcp_timewait_state_process((struct tcp_tw_bucket *)sk,
- skb, th, skb->len)) {
- case TCP_TW_SYN: {
-- struct sock *sk2 = tcp_v4_lookup_listener(skb->nh.iph->daddr,
-+ struct sock *sk2;
-+
-+ sk2 = tcp_v4_lookup_listener(skb->nh.iph->daddr,
- ntohs(th->dest),
- tcp_v4_iif(skb));
- if (sk2) {
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
- tcp_tw_deschedule((struct tcp_tw_bucket *)sk);
- tcp_tw_put((struct tcp_tw_bucket *)sk);
- sk = sk2;
-@@ -1849,9 +1899,13 @@ do_time_wait:
- tcp_v4_timewait_ack(sk, skb);
- break;
- case TCP_TW_RST:
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
-+ tcp_tw_put((struct tcp_tw_bucket *)sk);
- goto no_tcp_socket;
- case TCP_TW_SUCCESS:;
- }
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
-+ tcp_tw_put((struct tcp_tw_bucket *)sk);
- goto discard_it;
- }
-
-@@ -1997,11 +2051,11 @@ int tcp_v4_remember_stamp(struct sock *s
- }
-
- if (peer) {
-- if ((s32)(peer->tcp_ts - tp->ts_recent) <= 0 ||
-+ if ((s32)(peer->tcp_ts - tp->rx_opt.ts_recent) <= 0 ||
- (peer->tcp_ts_stamp + TCP_PAWS_MSL < xtime.tv_sec &&
-- peer->tcp_ts_stamp <= tp->ts_recent_stamp)) {
-- peer->tcp_ts_stamp = tp->ts_recent_stamp;
-- peer->tcp_ts = tp->ts_recent;
-+ peer->tcp_ts_stamp <= tp->rx_opt.ts_recent_stamp)) {
-+ peer->tcp_ts_stamp = tp->rx_opt.ts_recent_stamp;
-+ peer->tcp_ts = tp->rx_opt.ts_recent;
- }
- if (release_it)
- inet_putpeer(peer);
-@@ -2073,6 +2127,8 @@ static int tcp_v4_init_sock(struct sock
- tp->snd_cwnd_clamp = ~0;
- tp->mss_cache_std = tp->mss_cache = 536;
-
-+ tp->advmss = 65535; /* max value */
-+
- tp->reordering = sysctl_tcp_reordering;
-
- sk->sk_state = TCP_CLOSE;
-@@ -2113,6 +2169,8 @@ int tcp_v4_destroy_sock(struct sock *sk)
- * If sendmsg cached page exists, toss it.
- */
- if (sk->sk_sndmsg_page) {
-+ /* queue is empty, uncharge */
-+ ub_sock_tcp_detachpage(sk);
- __free_page(sk->sk_sndmsg_page);
- sk->sk_sndmsg_page = NULL;
- }
-@@ -2127,16 +2185,34 @@ EXPORT_SYMBOL(tcp_v4_destroy_sock);
- #ifdef CONFIG_PROC_FS
- /* Proc filesystem TCP sock list dumping. */
-
--static inline struct tcp_tw_bucket *tw_head(struct hlist_head *head)
-+static inline struct tcp_tw_bucket *tw_head(struct hlist_head *head,
-+ envid_t veid)
- {
-- return hlist_empty(head) ? NULL :
-- list_entry(head->first, struct tcp_tw_bucket, tw_node);
-+ struct tcp_tw_bucket *tw;
-+ struct hlist_node *pos;
-+
-+ if (hlist_empty(head))
-+ return NULL;
-+ hlist_for_each_entry(tw, pos, head, tw_node) {
-+ if (!ve_accessible_veid(TW_VEID(tw), veid))
-+ continue;
-+ return tw;
-+ }
-+ return NULL;
- }
-
--static inline struct tcp_tw_bucket *tw_next(struct tcp_tw_bucket *tw)
-+static inline struct tcp_tw_bucket *tw_next(struct tcp_tw_bucket *tw,
-+ envid_t veid)
- {
-- return tw->tw_node.next ?
-- hlist_entry(tw->tw_node.next, typeof(*tw), tw_node) : NULL;
-+ while (1) {
-+ if (tw->tw_node.next == NULL)
-+ return NULL;
-+ tw = hlist_entry(tw->tw_node.next, typeof(*tw), tw_node);
-+ if (!ve_accessible_veid(TW_VEID(tw), veid))
-+ continue;
-+ return tw;
-+ }
-+ return NULL; /* make compiler happy */
- }
-
- static void *listening_get_next(struct seq_file *seq, void *cur)
-@@ -2145,7 +2221,9 @@ static void *listening_get_next(struct s
- struct hlist_node *node;
- struct sock *sk = cur;
- struct tcp_iter_state* st = seq->private;
-+ struct ve_struct *ve;
-
-+ ve = get_exec_env();
- if (!sk) {
- st->bucket = 0;
- sk = sk_head(&tcp_listening_hash[0]);
-@@ -2185,6 +2263,8 @@ get_req:
- }
- get_sk:
- sk_for_each_from(sk, node) {
-+ if (!ve_accessible(VE_OWNER_SK(sk), ve))
-+ continue;
- if (sk->sk_family == st->family) {
- cur = sk;
- goto out;
-@@ -2225,7 +2305,9 @@ static void *established_get_first(struc
- {
- struct tcp_iter_state* st = seq->private;
- void *rc = NULL;
-+ struct ve_struct *ve;
-
-+ ve = get_exec_env();
- for (st->bucket = 0; st->bucket < tcp_ehash_size; ++st->bucket) {
- struct sock *sk;
- struct hlist_node *node;
-@@ -2233,6 +2315,8 @@ static void *established_get_first(struc
-
- read_lock(&tcp_ehash[st->bucket].lock);
- sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) {
-+ if (!ve_accessible(VE_OWNER_SK(sk), ve))
-+ continue;
- if (sk->sk_family != st->family) {
- continue;
- }
-@@ -2242,6 +2326,8 @@ static void *established_get_first(struc
- st->state = TCP_SEQ_STATE_TIME_WAIT;
- tw_for_each(tw, node,
- &tcp_ehash[st->bucket + tcp_ehash_size].chain) {
-+ if (!ve_accessible_veid(TW_VEID(tw), VEID(ve)))
-+ continue;
- if (tw->tw_family != st->family) {
- continue;
- }
-@@ -2261,16 +2347,17 @@ static void *established_get_next(struct
- struct tcp_tw_bucket *tw;
- struct hlist_node *node;
- struct tcp_iter_state* st = seq->private;
-+ struct ve_struct *ve;
-
-+ ve = get_exec_env();
- ++st->num;
-
- if (st->state == TCP_SEQ_STATE_TIME_WAIT) {
- tw = cur;
-- tw = tw_next(tw);
-+ tw = tw_next(tw, VEID(ve));
- get_tw:
-- while (tw && tw->tw_family != st->family) {
-- tw = tw_next(tw);
-- }
-+ while (tw && tw->tw_family != st->family)
-+ tw = tw_next(tw, VEID(ve));
- if (tw) {
- cur = tw;
- goto out;
-@@ -2288,12 +2375,14 @@ get_tw:
- sk = sk_next(sk);
-
- sk_for_each_from(sk, node) {
-+ if (!ve_accessible(VE_OWNER_SK(sk), ve))
-+ continue;
- if (sk->sk_family == st->family)
- goto found;
- }
-
- st->state = TCP_SEQ_STATE_TIME_WAIT;
-- tw = tw_head(&tcp_ehash[st->bucket + tcp_ehash_size].chain);
-+ tw = tw_head(&tcp_ehash[st->bucket + tcp_ehash_size].chain, VEID(ve));
- goto get_tw;
- found:
- cur = sk;
-@@ -2640,13 +2729,91 @@ void __init tcp_v4_init(struct net_proto
- tcp_socket->sk->sk_prot->unhash(tcp_socket->sk);
- }
-
-+#if defined(CONFIG_VE_NETDEV) || defined(CONFIG_VE_NETDEV_MODULE)
-+static void tcp_kill_ve_onesk(struct sock *sk)
-+{
-+ struct tcp_opt *tp = tcp_sk(sk);
-+
-+ /* Check the assumed state of the socket. */
-+ if (!sock_flag(sk, SOCK_DEAD)) {
-+ static int printed;
-+invalid:
-+ if (!printed)
-+ printk(KERN_DEBUG "Killing sk: dead %d, state %d, "
-+ "wrseq %u unseq %u, wrqu %d.\n",
-+ sock_flag(sk, SOCK_DEAD), sk->sk_state,
-+ tp->write_seq, tp->snd_una,
-+ !skb_queue_empty(&sk->sk_write_queue));
-+ printed = 1;
-+ return;
-+ }
-+
-+ tcp_send_active_reset(sk, GFP_ATOMIC);
-+ switch (sk->sk_state) {
-+ case TCP_FIN_WAIT1:
-+ case TCP_CLOSING:
-+ /* In these 2 states the peer may want us to retransmit
-+ * some data and/or FIN. Entering "resetting mode"
-+ * instead.
-+ */
-+ tcp_time_wait(sk, TCP_CLOSE, 0);
-+ break;
-+ case TCP_FIN_WAIT2:
-+ /* By some reason the socket may stay in this state
-+ * without turning into a TW bucket. Fix it.
-+ */
-+ tcp_time_wait(sk, TCP_FIN_WAIT2, 0);
-+ break;
-+ case TCP_LAST_ACK:
-+ /* Just jump into CLOSED state. */
-+ tcp_done(sk);
-+ break;
-+ default:
-+ /* The socket must be already close()d. */
-+ goto invalid;
-+ }
-+}
-+
-+void tcp_v4_kill_ve_sockets(struct ve_struct *envid)
-+{
-+ struct tcp_ehash_bucket *head;
-+ int i;
-+
-+ /* alive */
-+ local_bh_disable();
-+ head = tcp_ehash;
-+ for (i = 0; i < tcp_ehash_size; i++) {
-+ struct sock *sk;
-+ struct hlist_node *node;
-+more_work:
-+ write_lock(&head[i].lock);
-+ sk_for_each(sk, node, &head[i].chain) {
-+ if (ve_accessible_strict(VE_OWNER_SK(sk), envid)) {
-+ sock_hold(sk);
-+ write_unlock(&head[i].lock);
-+
-+ bh_lock_sock(sk);
-+ /* sk might have disappeared from the hash before
-+ * we got the lock */
-+ if (sk->sk_state != TCP_CLOSE)
-+ tcp_kill_ve_onesk(sk);
-+ bh_unlock_sock(sk);
-+ sock_put(sk);
-+ goto more_work;
-+ }
-+ }
-+ write_unlock(&head[i].lock);
-+ }
-+ local_bh_enable();
-+}
-+#endif
-+
- EXPORT_SYMBOL(ipv4_specific);
- EXPORT_SYMBOL(tcp_bind_hash);
- EXPORT_SYMBOL(tcp_bucket_create);
- EXPORT_SYMBOL(tcp_hashinfo);
- EXPORT_SYMBOL(tcp_inherit_port);
- EXPORT_SYMBOL(tcp_listen_wlock);
--EXPORT_SYMBOL(tcp_port_rover);
- EXPORT_SYMBOL(tcp_prot);
- EXPORT_SYMBOL(tcp_put_port);
- EXPORT_SYMBOL(tcp_unhash);
-@@ -2658,13 +2825,17 @@ EXPORT_SYMBOL(tcp_v4_rebuild_header);
- EXPORT_SYMBOL(tcp_v4_remember_stamp);
- EXPORT_SYMBOL(tcp_v4_send_check);
- EXPORT_SYMBOL(tcp_v4_syn_recv_sock);
-+EXPORT_SYMBOL(tcp_v4_kill_ve_sockets);
-
- #ifdef CONFIG_PROC_FS
- EXPORT_SYMBOL(tcp_proc_register);
- EXPORT_SYMBOL(tcp_proc_unregister);
- #endif
- #ifdef CONFIG_SYSCTL
--EXPORT_SYMBOL(sysctl_local_port_range);
-+#ifndef CONFIG_VE
-+EXPORT_SYMBOL(_sysctl_local_port_range);
-+EXPORT_SYMBOL(_tcp_port_rover);
-+#endif
- EXPORT_SYMBOL(sysctl_max_syn_backlog);
- EXPORT_SYMBOL(sysctl_tcp_low_latency);
- #endif
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_minisocks.c linux-2.6.9-ve023stab030/net/ipv4/tcp_minisocks.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_minisocks.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_minisocks.c 2006-10-11 19:07:58.000000000 +0400
-@@ -29,6 +29,9 @@
- #include <net/inet_common.h>
- #include <net/xfrm.h>
-
-+#include <ub/ub_net.h>
-+#include <ub/ub_orphan.h>
-+
- #ifdef CONFIG_SYSCTL
- #define SYNC_INIT 0 /* let the user enable it */
- #else
-@@ -37,6 +40,8 @@
-
- int sysctl_tcp_tw_recycle;
- int sysctl_tcp_max_tw_buckets = NR_FILE*2;
-+int sysctl_tcp_max_tw_kmem_fraction = 128;
-+int sysctl_tcp_max_tw_buckets_ve = 1024;
-
- int sysctl_tcp_syncookies = SYNC_INIT;
- int sysctl_tcp_abort_on_overflow;
-@@ -74,7 +79,7 @@ static void tcp_timewait_kill(struct tcp
- write_unlock(&ehead->lock);
-
- /* Disassociate with bind bucket. */
-- bhead = &tcp_bhash[tcp_bhashfn(tw->tw_num)];
-+ bhead = &tcp_bhash[tcp_bhashfn(tw->tw_num, TW_VEID(tw))];
- spin_lock(&bhead->lock);
- tb = tw->tw_tb;
- __hlist_del(&tw->tw_bind_node);
-@@ -123,17 +128,17 @@ enum tcp_tw_status
- tcp_timewait_state_process(struct tcp_tw_bucket *tw, struct sk_buff *skb,
- struct tcphdr *th, unsigned len)
- {
-- struct tcp_opt tp;
-+ struct tcp_options_received tmp_opt;
- int paws_reject = 0;
-
-- tp.saw_tstamp = 0;
-+ tmp_opt.saw_tstamp = 0;
- if (th->doff > (sizeof(struct tcphdr) >> 2) && tw->tw_ts_recent_stamp) {
-- tcp_parse_options(skb, &tp, 0);
-+ tcp_parse_options(skb, &tmp_opt, 0);
-
-- if (tp.saw_tstamp) {
-- tp.ts_recent = tw->tw_ts_recent;
-- tp.ts_recent_stamp = tw->tw_ts_recent_stamp;
-- paws_reject = tcp_paws_check(&tp, th->rst);
-+ if (tmp_opt.saw_tstamp) {
-+ tmp_opt.ts_recent = tw->tw_ts_recent;
-+ tmp_opt.ts_recent_stamp = tw->tw_ts_recent_stamp;
-+ paws_reject = tcp_paws_check(&tmp_opt, th->rst);
- }
- }
-
-@@ -150,33 +155,28 @@ tcp_timewait_state_process(struct tcp_tw
- if (th->rst)
- goto kill;
-
-- if (th->syn && !before(TCP_SKB_CB(skb)->seq, tw->tw_rcv_nxt))
-- goto kill_with_rst;
-+ if (th->syn && !before(TCP_SKB_CB(skb)->seq, tw->tw_rcv_nxt)) {
-+ tw->tw_substate = TCP_CLOSE;
-+ tcp_tw_schedule(tw, TCP_TIMEWAIT_LEN);
-+ return TCP_TW_RST;
-+ }
-
- /* Dup ACK? */
- if (!after(TCP_SKB_CB(skb)->end_seq, tw->tw_rcv_nxt) ||
-- TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) {
-- tcp_tw_put(tw);
-+ TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq)
- return TCP_TW_SUCCESS;
-- }
-
-- /* New data or FIN. If new data arrive after half-duplex close,
-- * reset.
-- */
-- if (!th->fin ||
-- TCP_SKB_CB(skb)->end_seq != tw->tw_rcv_nxt + 1) {
--kill_with_rst:
-- tcp_tw_deschedule(tw);
-- tcp_tw_put(tw);
-- return TCP_TW_RST;
-- }
--
-- /* FIN arrived, enter true time-wait state. */
-- tw->tw_substate = TCP_TIME_WAIT;
-- tw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq;
-- if (tp.saw_tstamp) {
-+ /* New data or FIN. */
-+ if (th->fin && TCP_SKB_CB(skb)->end_seq == tw->tw_rcv_nxt + 1) {
-+ /* FIN arrived, enter true time-wait state. */
-+ tw->tw_substate = TCP_TIME_WAIT;
-+ tw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq;
-+ } else
-+ /* If new data arrive after half-duplex close, reset. */
-+ tw->tw_substate = TCP_CLOSE;
-+ if (tmp_opt.saw_tstamp) {
- tw->tw_ts_recent_stamp = xtime.tv_sec;
-- tw->tw_ts_recent = tp.rcv_tsval;
-+ tw->tw_ts_recent = tmp_opt.rcv_tsval;
- }
-
- /* I am shamed, but failed to make it more elegant.
-@@ -190,7 +190,9 @@ kill_with_rst:
- tcp_tw_schedule(tw, tw->tw_timeout);
- else
- tcp_tw_schedule(tw, TCP_TIMEWAIT_LEN);
-- return TCP_TW_ACK;
-+
-+ return (tw->tw_substate == TCP_TIME_WAIT) ?
-+ TCP_TW_ACK : TCP_TW_RST;
- }
-
- /*
-@@ -223,18 +225,16 @@ kill_with_rst:
- if (sysctl_tcp_rfc1337 == 0) {
- kill:
- tcp_tw_deschedule(tw);
-- tcp_tw_put(tw);
- return TCP_TW_SUCCESS;
- }
- }
- tcp_tw_schedule(tw, TCP_TIMEWAIT_LEN);
-
-- if (tp.saw_tstamp) {
-- tw->tw_ts_recent = tp.rcv_tsval;
-+ if (tmp_opt.saw_tstamp) {
-+ tw->tw_ts_recent = tmp_opt.rcv_tsval;
- tw->tw_ts_recent_stamp = xtime.tv_sec;
- }
-
-- tcp_tw_put(tw);
- return TCP_TW_SUCCESS;
- }
-
-@@ -257,7 +257,7 @@ kill:
-
- if (th->syn && !th->rst && !th->ack && !paws_reject &&
- (after(TCP_SKB_CB(skb)->seq, tw->tw_rcv_nxt) ||
-- (tp.saw_tstamp && (s32)(tw->tw_ts_recent - tp.rcv_tsval) < 0))) {
-+ (tmp_opt.saw_tstamp && (s32)(tw->tw_ts_recent - tmp_opt.rcv_tsval) < 0))) {
- u32 isn = tw->tw_snd_nxt + 65535 + 2;
- if (isn == 0)
- isn++;
-@@ -268,7 +268,7 @@ kill:
- if (paws_reject)
- NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
-
-- if(!th->rst) {
-+ if (!th->rst) {
- /* In this case we must reset the TIMEWAIT timer.
- *
- * If it is ACKless SYN it may be both old duplicate
-@@ -278,12 +278,9 @@ kill:
- if (paws_reject || th->ack)
- tcp_tw_schedule(tw, TCP_TIMEWAIT_LEN);
-
-- /* Send ACK. Note, we do not put the bucket,
-- * it will be released by caller.
-- */
-- return TCP_TW_ACK;
-+ return (tw->tw_substate == TCP_TIME_WAIT) ?
-+ TCP_TW_ACK : TCP_TW_RST;
- }
-- tcp_tw_put(tw);
- return TCP_TW_SUCCESS;
- }
-
-@@ -301,7 +298,8 @@ static void __tcp_tw_hashdance(struct so
- Note, that any socket with inet_sk(sk)->num != 0 MUST be bound in
- binding cache, even if it is closed.
- */
-- bhead = &tcp_bhash[tcp_bhashfn(inet_sk(sk)->num)];
-+ bhead = &tcp_bhash[tcp_bhashfn(inet_sk(sk)->num,
-+ VEID(VE_OWNER_SK(sk)))];
- spin_lock(&bhead->lock);
- tw->tw_tb = tcp_sk(sk)->bind_hash;
- BUG_TRAP(tcp_sk(sk)->bind_hash);
-@@ -329,12 +327,15 @@ void tcp_time_wait(struct sock *sk, int
- struct tcp_tw_bucket *tw = NULL;
- struct tcp_opt *tp = tcp_sk(sk);
- int recycle_ok = 0;
-+ struct user_beancounter *ub;
-
-- if (sysctl_tcp_tw_recycle && tp->ts_recent_stamp)
-+ if (sysctl_tcp_tw_recycle && tp->rx_opt.ts_recent_stamp)
- recycle_ok = tp->af_specific->remember_stamp(sk);
-
-- if (tcp_tw_count < sysctl_tcp_max_tw_buckets)
-+ ub = set_sk_exec_ub(sk);
-+ if (tcp_tw_count < sysctl_tcp_max_tw_buckets && ub_check_tw_count(sk))
- tw = kmem_cache_alloc(tcp_timewait_cachep, SLAB_ATOMIC);
-+ (void)set_exec_ub(ub);
-
- if(tw != NULL) {
- struct inet_opt *inet = inet_sk(sk);
-@@ -351,16 +352,19 @@ void tcp_time_wait(struct sock *sk, int
- tw->tw_dport = inet->dport;
- tw->tw_family = sk->sk_family;
- tw->tw_reuse = sk->sk_reuse;
-- tw->tw_rcv_wscale = tp->rcv_wscale;
-+ tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale;
-+ if (sk->sk_user_data != NULL)
-+ tw->tw_rcv_wscale |= TW_WSCALE_SPEC;
- atomic_set(&tw->tw_refcnt, 1);
-
- tw->tw_hashent = sk->sk_hashent;
- tw->tw_rcv_nxt = tp->rcv_nxt;
- tw->tw_snd_nxt = tp->snd_nxt;
- tw->tw_rcv_wnd = tcp_receive_window(tp);
-- tw->tw_ts_recent = tp->ts_recent;
-- tw->tw_ts_recent_stamp = tp->ts_recent_stamp;
-+ tw->tw_ts_recent = tp->rx_opt.ts_recent;
-+ tw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
- tw_dead_node_init(tw);
-+ spin_lock_init(&tw->tw_lock);
-
- #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- if (tw->tw_family == PF_INET6) {
-@@ -375,6 +379,8 @@ void tcp_time_wait(struct sock *sk, int
- tw->tw_v6_ipv6only = 0;
- }
- #endif
-+ SET_TW_VEID(tw, VEID(VE_OWNER_SK(sk)));
-+
- /* Linkage updates. */
- __tcp_tw_hashdance(sk, tw);
-
-@@ -401,7 +407,8 @@ void tcp_time_wait(struct sock *sk, int
- printk(KERN_INFO "TCP: time wait bucket table overflow\n");
- }
-
-- tcp_update_metrics(sk);
-+ if (state != TCP_CLOSE)
-+ tcp_update_metrics(sk);
- tcp_done(sk);
- }
-
-@@ -442,6 +449,7 @@ static int tcp_do_twkill_work(int slot,
- rescan:
- tw_for_each_inmate(tw, node, &tcp_tw_death_row[slot]) {
- __tw_del_dead_node(tw);
-+ ub_dec_tw_count(tw);
- spin_unlock(&tw_death_lock);
- tcp_timewait_kill(tw);
- tcp_tw_put(tw);
-@@ -534,6 +542,7 @@ void tcp_tw_deschedule(struct tcp_tw_buc
- {
- spin_lock(&tw_death_lock);
- if (tw_del_dead_node(tw)) {
-+ ub_dec_tw_count(tw);
- tcp_tw_put(tw);
- if (--tcp_tw_count == 0)
- del_timer(&tcp_tw_timer);
-@@ -585,9 +594,10 @@ void tcp_tw_schedule(struct tcp_tw_bucke
- spin_lock(&tw_death_lock);
-
- /* Unlink it, if it was scheduled */
-- if (tw_del_dead_node(tw))
-+ if (tw_del_dead_node(tw)) {
- tcp_tw_count--;
-- else
-+ ub_dec_tw_count(tw);
-+ } else
- atomic_inc(&tw->tw_refcnt);
-
- if (slot >= TCP_TW_RECYCLE_SLOTS) {
-@@ -620,6 +630,7 @@ void tcp_tw_schedule(struct tcp_tw_bucke
-
- hlist_add_head(&tw->tw_death_node, list);
-
-+ ub_inc_tw_count(tw);
- if (tcp_tw_count++ == 0)
- mod_timer(&tcp_tw_timer, jiffies+TCP_TWKILL_PERIOD);
- spin_unlock(&tw_death_lock);
-@@ -649,6 +660,7 @@ void tcp_twcal_tick(unsigned long dummy)
- &tcp_twcal_row[slot]) {
- __tw_del_dead_node(tw);
- tcp_timewait_kill(tw);
-+ ub_dec_tw_count(tw);
- tcp_tw_put(tw);
- killed++;
- }
-@@ -694,6 +706,7 @@ struct sock *tcp_create_openreq_child(st
- struct sk_filter *filter;
-
- memcpy(newsk, sk, sizeof(struct tcp_sock));
-+
- newsk->sk_state = TCP_SYN_RECV;
-
- /* SANITY */
-@@ -703,6 +716,7 @@ struct sock *tcp_create_openreq_child(st
- /* Clone the TCP header template */
- inet_sk(newsk)->dport = req->rmt_port;
-
-+ SET_VE_OWNER_SK(newsk, VE_OWNER_SK(sk));
- sock_lock_init(newsk);
- bh_lock_sock(newsk);
-
-@@ -729,9 +743,14 @@ struct sock *tcp_create_openreq_child(st
- if (sk->sk_create_child)
- sk->sk_create_child(sk, newsk);
-
-+ if (ub_tcp_sock_charge(newsk) < 0)
-+ goto out_sk_free;
-+
- if (unlikely(xfrm_sk_clone_policy(newsk))) {
- /* It is still raw copy of parent, so invalidate
- * destructor and make plain sk_free() */
-+out_sk_free:
-+ sock_reset_flag(newsk, SOCK_TIMESTAMP);
- newsk->sk_destruct = NULL;
- sk_free(newsk);
- return NULL;
-@@ -781,13 +800,13 @@ struct sock *tcp_create_openreq_child(st
- newtp->pushed_seq = newtp->write_seq;
- newtp->copied_seq = req->rcv_isn + 1;
-
-- newtp->saw_tstamp = 0;
-+ newtp->rx_opt.saw_tstamp = 0;
-
-- newtp->dsack = 0;
-- newtp->eff_sacks = 0;
-+ newtp->rx_opt.dsack = 0;
-+ newtp->rx_opt.eff_sacks = 0;
-
- newtp->probes_out = 0;
-- newtp->num_sacks = 0;
-+ newtp->rx_opt.num_sacks = 0;
- newtp->urg_data = 0;
- newtp->listen_opt = NULL;
- newtp->accept_queue = newtp->accept_queue_tail = NULL;
-@@ -810,36 +829,36 @@ struct sock *tcp_create_openreq_child(st
- newsk->sk_sleep = NULL;
- newsk->sk_owner = NULL;
-
-- newtp->tstamp_ok = req->tstamp_ok;
-- if((newtp->sack_ok = req->sack_ok) != 0) {
-+ newtp->rx_opt.tstamp_ok = req->tstamp_ok;
-+ if((newtp->rx_opt.sack_ok = req->sack_ok) != 0) {
- if (sysctl_tcp_fack)
-- newtp->sack_ok |= 2;
-+ newtp->rx_opt.sack_ok |= 2;
- }
- newtp->window_clamp = req->window_clamp;
- newtp->rcv_ssthresh = req->rcv_wnd;
- newtp->rcv_wnd = req->rcv_wnd;
-- newtp->wscale_ok = req->wscale_ok;
-- if (newtp->wscale_ok) {
-- newtp->snd_wscale = req->snd_wscale;
-- newtp->rcv_wscale = req->rcv_wscale;
-+ newtp->rx_opt.wscale_ok = req->wscale_ok;
-+ if (newtp->rx_opt.wscale_ok) {
-+ newtp->rx_opt.snd_wscale = req->snd_wscale;
-+ newtp->rx_opt.rcv_wscale = req->rcv_wscale;
- } else {
-- newtp->snd_wscale = newtp->rcv_wscale = 0;
-+ newtp->rx_opt.snd_wscale = newtp->rx_opt.rcv_wscale = 0;
- newtp->window_clamp = min(newtp->window_clamp, 65535U);
- }
-- newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->snd_wscale;
-+ newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->rx_opt.snd_wscale;
- newtp->max_window = newtp->snd_wnd;
-
-- if (newtp->tstamp_ok) {
-- newtp->ts_recent = req->ts_recent;
-- newtp->ts_recent_stamp = xtime.tv_sec;
-+ if (newtp->rx_opt.tstamp_ok) {
-+ newtp->rx_opt.ts_recent = req->ts_recent;
-+ newtp->rx_opt.ts_recent_stamp = xtime.tv_sec;
- newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
- } else {
-- newtp->ts_recent_stamp = 0;
-+ newtp->rx_opt.ts_recent_stamp = 0;
- newtp->tcp_header_len = sizeof(struct tcphdr);
- }
- if (skb->len >= TCP_MIN_RCVMSS+newtp->tcp_header_len)
- newtp->ack.last_seg_size = skb->len-newtp->tcp_header_len;
-- newtp->mss_clamp = req->mss;
-+ newtp->rx_opt.mss_clamp = req->mss;
- TCP_ECN_openreq_child(newtp, req);
- if (newtp->ecn_flags&TCP_ECN_OK)
- newsk->sk_no_largesend = 1;
-@@ -864,21 +883,21 @@ struct sock *tcp_check_req(struct sock *
- struct tcp_opt *tp = tcp_sk(sk);
- u32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK);
- int paws_reject = 0;
-- struct tcp_opt ttp;
-+ struct tcp_options_received tmp_opt;
- struct sock *child;
-
-- ttp.saw_tstamp = 0;
-+ tmp_opt.saw_tstamp = 0;
- if (th->doff > (sizeof(struct tcphdr)>>2)) {
-- tcp_parse_options(skb, &ttp, 0);
-+ tcp_parse_options(skb, &tmp_opt, 0);
-
-- if (ttp.saw_tstamp) {
-- ttp.ts_recent = req->ts_recent;
-+ if (tmp_opt.saw_tstamp) {
-+ tmp_opt.ts_recent = req->ts_recent;
- /* We do not store true stamp, but it is not required,
- * it can be estimated (approximately)
- * from another data.
- */
-- ttp.ts_recent_stamp = xtime.tv_sec - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans);
-- paws_reject = tcp_paws_check(&ttp, th->rst);
-+ tmp_opt.ts_recent_stamp = xtime.tv_sec - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans);
-+ paws_reject = tcp_paws_check(&tmp_opt, th->rst);
- }
- }
-
-@@ -983,63 +1002,63 @@ struct sock *tcp_check_req(struct sock *
-
- /* In sequence, PAWS is OK. */
-
-- if (ttp.saw_tstamp && !after(TCP_SKB_CB(skb)->seq, req->rcv_isn+1))
-- req->ts_recent = ttp.rcv_tsval;
-+ if (tmp_opt.saw_tstamp && !after(TCP_SKB_CB(skb)->seq, req->rcv_isn+1))
-+ req->ts_recent = tmp_opt.rcv_tsval;
-
-- if (TCP_SKB_CB(skb)->seq == req->rcv_isn) {
-- /* Truncate SYN, it is out of window starting
-- at req->rcv_isn+1. */
-- flg &= ~TCP_FLAG_SYN;
-- }
-+ if (TCP_SKB_CB(skb)->seq == req->rcv_isn) {
-+ /* Truncate SYN, it is out of window starting
-+ at req->rcv_isn+1. */
-+ flg &= ~TCP_FLAG_SYN;
-+ }
-
-- /* RFC793: "second check the RST bit" and
-- * "fourth, check the SYN bit"
-- */
-- if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN))
-- goto embryonic_reset;
-+ /* RFC793: "second check the RST bit" and
-+ * "fourth, check the SYN bit"
-+ */
-+ if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN))
-+ goto embryonic_reset;
-
-- /* ACK sequence verified above, just make sure ACK is
-- * set. If ACK not set, just silently drop the packet.
-- */
-- if (!(flg & TCP_FLAG_ACK))
-- return NULL;
-+ /* ACK sequence verified above, just make sure ACK is
-+ * set. If ACK not set, just silently drop the packet.
-+ */
-+ if (!(flg & TCP_FLAG_ACK))
-+ return NULL;
-
-- /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */
-- if (tp->defer_accept && TCP_SKB_CB(skb)->end_seq == req->rcv_isn+1) {
-- req->acked = 1;
-- return NULL;
-- }
-+ /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */
-+ if (tp->defer_accept && TCP_SKB_CB(skb)->end_seq == req->rcv_isn+1) {
-+ req->acked = 1;
-+ return NULL;
-+ }
-
-- /* OK, ACK is valid, create big socket and
-- * feed this segment to it. It will repeat all
-- * the tests. THIS SEGMENT MUST MOVE SOCKET TO
-- * ESTABLISHED STATE. If it will be dropped after
-- * socket is created, wait for troubles.
-- */
-- child = tp->af_specific->syn_recv_sock(sk, skb, req, NULL);
-- if (child == NULL)
-- goto listen_overflow;
--
-- sk_set_owner(child, sk->sk_owner);
-- tcp_synq_unlink(tp, req, prev);
-- tcp_synq_removed(sk, req);
--
-- tcp_acceptq_queue(sk, req, child);
-- return child;
--
--listen_overflow:
-- if (!sysctl_tcp_abort_on_overflow) {
-- req->acked = 1;
-- return NULL;
-- }
-+ /* OK, ACK is valid, create big socket and
-+ * feed this segment to it. It will repeat all
-+ * the tests. THIS SEGMENT MUST MOVE SOCKET TO
-+ * ESTABLISHED STATE. If it will be dropped after
-+ * socket is created, wait for troubles.
-+ */
-+ child = tp->af_specific->syn_recv_sock(sk, skb, req, NULL);
-+ if (child == NULL)
-+ goto listen_overflow;
-+
-+ sk_set_owner(child, sk->sk_owner);
-+ tcp_synq_unlink(tp, req, prev);
-+ tcp_synq_removed(sk, req);
-+
-+ tcp_acceptq_queue(sk, req, child);
-+ return child;
-+
-+ listen_overflow:
-+ if (!sysctl_tcp_abort_on_overflow) {
-+ req->acked = 1;
-+ return NULL;
-+ }
-
--embryonic_reset:
-- NET_INC_STATS_BH(LINUX_MIB_EMBRYONICRSTS);
-- if (!(flg & TCP_FLAG_RST))
-- req->class->send_reset(skb);
-+ embryonic_reset:
-+ NET_INC_STATS_BH(LINUX_MIB_EMBRYONICRSTS);
-+ if (!(flg & TCP_FLAG_RST))
-+ req->class->send_reset(skb);
-
-- tcp_synq_drop(sk, req, prev);
-- return NULL;
-+ tcp_synq_drop(sk, req, prev);
-+ return NULL;
- }
-
- /*
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_output.c linux-2.6.9-ve023stab030/net/ipv4/tcp_output.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_output.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_output.c 2006-10-11 19:07:58.000000000 +0400
-@@ -42,6 +42,9 @@
- #include <linux/module.h>
- #include <linux/smp_lock.h>
-
-+#include <ub/ub_net.h>
-+#include <ub/ub_tcp.h>
-+
- /* People can turn this off for buggy TCP's found in printers etc. */
- int sysctl_tcp_retrans_collapse = 1;
-
-@@ -236,13 +239,13 @@ static __inline__ u16 tcp_select_window(
- /* Make sure we do not exceed the maximum possible
- * scaled window.
- */
-- if (!tp->rcv_wscale)
-+ if (!tp->rx_opt.rcv_wscale)
- new_win = min(new_win, MAX_TCP_WINDOW);
- else
-- new_win = min(new_win, (65535U << tp->rcv_wscale));
-+ new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale));
-
- /* RFC1323 scaling applied */
-- new_win >>= tp->rcv_wscale;
-+ new_win >>= tp->rx_opt.rcv_wscale;
-
- /* If we advertise zero window, disable fast path. */
- if (new_win == 0)
-@@ -252,6 +255,13 @@ static __inline__ u16 tcp_select_window(
- }
-
-
-+static int skb_header_size(struct sock *sk, int tcp_hlen)
-+{
-+ struct ip_options *opt = inet_sk(sk)->opt;
-+ return tcp_hlen + sizeof(struct iphdr) +
-+ (opt ? opt->optlen : 0) + ETH_HLEN /* For hard header */;
-+}
-+
- /* This routine actually transmits TCP packets queued in by
- * tcp_do_sendmsg(). This is used by both the initial
- * transmission and possible later retransmissions.
-@@ -270,6 +280,7 @@ static int tcp_transmit_skb(struct sock
- struct tcp_opt *tp = tcp_sk(sk);
- struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);
- int tcp_header_size = tp->tcp_header_len;
-+ int header_size;
- struct tcphdr *th;
- int sysctl_flags;
- int err;
-@@ -296,14 +307,28 @@ static int tcp_transmit_skb(struct sock
- if(!(sysctl_flags & SYSCTL_FLAG_TSTAMPS))
- tcp_header_size += TCPOLEN_SACKPERM_ALIGNED;
- }
-- } else if (tp->eff_sacks) {
-+ } else if (tp->rx_opt.eff_sacks) {
- /* A SACK is 2 pad bytes, a 2 byte header, plus
- * 2 32-bit sequence numbers for each SACK block.
- */
- tcp_header_size += (TCPOLEN_SACK_BASE_ALIGNED +
-- (tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
-+ (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK));
- }
--
-+
-+ /* Unfortunately, we can have skb from outside world here
-+ * with size insufficient for header. It is impossible to make
-+ * guess when we queue skb, so the decision should be made
-+ * here. Den
-+ */
-+ header_size = skb_header_size(sk, tcp_header_size);
-+ if (skb->data - header_size < skb->head) {
-+ int delta = header_size - skb_headroom(skb);
-+ err = pskb_expand_head(skb, SKB_DATA_ALIGN(delta),
-+ 0, GFP_ATOMIC);
-+ if (err)
-+ return err;
-+ }
-+
- /*
- * If the connection is idle and we are restarting,
- * then we don't want to do any Vegas calculations
-@@ -349,9 +374,9 @@ static int tcp_transmit_skb(struct sock
- (sysctl_flags & SYSCTL_FLAG_TSTAMPS),
- (sysctl_flags & SYSCTL_FLAG_SACK),
- (sysctl_flags & SYSCTL_FLAG_WSCALE),
-- tp->rcv_wscale,
-+ tp->rx_opt.rcv_wscale,
- tcb->when,
-- tp->ts_recent);
-+ tp->rx_opt.ts_recent);
- } else {
- tcp_build_and_update_options((__u32 *)(th + 1),
- tp, tcb->when);
-@@ -466,15 +491,23 @@ static int tcp_fragment(struct sock *sk,
- if (nsize < 0)
- nsize = 0;
-
-- if (skb_cloned(skb) &&
-- skb_is_nonlinear(skb) &&
-- pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
-- return -ENOMEM;
-+ if (skb_cloned(skb) && skb_is_nonlinear(skb)) {
-+ unsigned long chargesize;
-+ chargesize = skb_bc(skb)->charged;
-+ if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
-+ return -ENOMEM;
-+ ub_sock_tcp_unchargesend(sk, chargesize);
-+ ub_tcpsndbuf_charge_forced(sk, skb);
-+ }
-
- /* Get a new skb... force flag on. */
- buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC);
- if (buff == NULL)
- return -ENOMEM; /* We'll just try again later. */
-+ if (ub_tcpsndbuf_charge(sk, buff) < 0) {
-+ kfree_skb(buff);
-+ return -ENOMEM;
-+ }
- sk_charge_skb(sk, buff);
-
- /* Correct the sequence numbers. */
-@@ -600,10 +633,10 @@ int tcp_trim_head(struct sock *sk, struc
-
- /* This function synchronize snd mss to current pmtu/exthdr set.
-
-- tp->user_mss is mss set by user by TCP_MAXSEG. It does NOT counts
-+ tp->rx_opt.user_mss is mss set by user by TCP_MAXSEG. It does NOT counts
- for TCP options, but includes only bare TCP header.
-
-- tp->mss_clamp is mss negotiated at connection setup.
-+ tp->rx_opt.mss_clamp is mss negotiated at connection setup.
- It is minumum of user_mss and mss received with SYN.
- It also does not include TCP options.
-
-@@ -612,7 +645,7 @@ int tcp_trim_head(struct sock *sk, struc
- tp->mss_cache is current effective sending mss, including
- all tcp options except for SACKs. It is evaluated,
- taking into account current pmtu, but never exceeds
-- tp->mss_clamp.
-+ tp->rx_opt.mss_clamp.
-
- NOTE1. rfc1122 clearly states that advertised MSS
- DOES NOT include either tcp or ip options.
-@@ -636,8 +669,8 @@ unsigned int tcp_sync_mss(struct sock *s
- mss_now = pmtu - tp->af_specific->net_header_len - sizeof(struct tcphdr);
-
- /* Clamp it (mss_clamp does not include tcp options) */
-- if (mss_now > tp->mss_clamp)
-- mss_now = tp->mss_clamp;
-+ if (mss_now > tp->rx_opt.mss_clamp)
-+ mss_now = tp->rx_opt.mss_clamp;
-
- /* Now subtract optional transport overhead */
- mss_now -= tp->ext_header_len + tp->ext2_header_len;
-@@ -716,9 +749,9 @@ unsigned int tcp_current_mss(struct sock
- mss_now = tp->mss_cache;
- }
-
-- if (tp->eff_sacks)
-+ if (tp->rx_opt.eff_sacks)
- mss_now -= (TCPOLEN_SACK_BASE_ALIGNED +
-- (tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
-+ (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK));
- return mss_now;
- }
- EXPORT_SYMBOL_GPL(tcp_current_mss);
-@@ -854,7 +887,7 @@ u32 __tcp_select_window(struct sock *sk)
- if (free_space < full_space/2) {
- tp->ack.quick = 0;
-
-- if (tcp_memory_pressure)
-+ if (ub_tcp_shrink_rcvbuf(sk))
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U*tp->advmss);
-
- if (free_space < mss)
-@@ -868,16 +901,16 @@ u32 __tcp_select_window(struct sock *sk)
- * scaled window will not line up with the MSS boundary anyway.
- */
- window = tp->rcv_wnd;
-- if (tp->rcv_wscale) {
-+ if (tp->rx_opt.rcv_wscale) {
- window = free_space;
-
- /* Advertise enough space so that it won't get scaled away.
- * Import case: prevent zero window announcement if
- * 1<<rcv_wscale > mss.
- */
-- if (((window >> tp->rcv_wscale) << tp->rcv_wscale) != window)
-- window = (((window >> tp->rcv_wscale) + 1)
-- << tp->rcv_wscale);
-+ if (((window >> tp->rx_opt.rcv_wscale) << tp->rx_opt.rcv_wscale) != window)
-+ window = (((window >> tp->rx_opt.rcv_wscale) + 1)
-+ << tp->rx_opt.rcv_wscale);
- } else {
- /* Get the largest window that is a nice multiple of mss.
- * Window clamp already applied above.
-@@ -955,7 +988,7 @@ static void tcp_retrans_try_collapse(str
- tcp_dec_pcount(&tp->left_out, next_skb);
- }
- /* Reno case is special. Sigh... */
-- if (!tp->sack_ok && tcp_get_pcount(&tp->sacked_out)) {
-+ if (!tp->rx_opt.sack_ok && tcp_get_pcount(&tp->sacked_out)) {
- tcp_dec_pcount_approx(&tp->sacked_out, next_skb);
- tcp_dec_pcount(&tp->left_out, next_skb);
- }
-@@ -1075,6 +1108,7 @@ int tcp_retransmit_skb(struct sock *sk,
- (skb->next != sk->sk_send_head) &&
- (skb->next != (struct sk_buff *)&sk->sk_write_queue) &&
- (skb_shinfo(skb)->nr_frags == 0 && skb_shinfo(skb->next)->nr_frags == 0) &&
-+ (tcp_skb_pcount(skb) == 1 && tcp_skb_pcount(skb->next) == 1) &&
- (sysctl_tcp_retrans_collapse != 0))
- tcp_retrans_try_collapse(sk, skb, cur_mss);
-
-@@ -1190,7 +1224,7 @@ void tcp_xmit_retransmit_queue(struct so
- return;
-
- /* No forward retransmissions in Reno are possible. */
-- if (!tp->sack_ok)
-+ if (!tp->rx_opt.sack_ok)
- return;
-
- /* Yeah, we have to make difficult choice between forward transmission
-@@ -1260,6 +1294,7 @@ void tcp_send_fin(struct sock *sk)
- break;
- yield();
- }
-+ ub_tcpsndbuf_charge_forced(sk, skb);
-
- /* Reserve space for headers and prepare control bits. */
- skb_reserve(skb, MAX_TCP_HEADER);
-@@ -1329,6 +1364,10 @@ int tcp_send_synack(struct sock *sk)
- struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
- if (nskb == NULL)
- return -ENOMEM;
-+ if (ub_tcpsndbuf_charge(sk, skb) < 0) {
-+ kfree_skb(nskb);
-+ return -ENOMEM;
-+ }
- __skb_unlink(skb, &sk->sk_write_queue);
- __skb_queue_head(&sk->sk_write_queue, nskb);
- sk_stream_free_skb(sk, skb);
-@@ -1429,23 +1468,38 @@ static inline void tcp_connect_init(stru
- (sysctl_tcp_timestamps ? TCPOLEN_TSTAMP_ALIGNED : 0);
-
- /* If user gave his TCP_MAXSEG, record it to clamp */
-- if (tp->user_mss)
-- tp->mss_clamp = tp->user_mss;
-+ if (tp->rx_opt.user_mss)
-+ tp->rx_opt.mss_clamp = tp->rx_opt.user_mss;
- tp->max_window = 0;
- tcp_sync_mss(sk, dst_pmtu(dst));
-
-+ if (tp->advmss == 0 || dst_metric(dst, RTAX_ADVMSS) == 0) {
-+ printk("Oops in connect_init! tp->advmss=%d, dst->advmss=%d\n",
-+ tp->advmss, dst_metric(dst, RTAX_ADVMSS));
-+ printk("dst: pmtu=%u, advmss=%u\n",
-+ dst_metric(dst, RTAX_MTU),
-+ dst_metric(dst, RTAX_ADVMSS));
-+ printk("sk->state=%d, tp: ack.rcv_mss=%d, mss_cache=%d, "
-+ "advmss=%d, user_mss=%d\n",
-+ sk->sk_state, tp->ack.rcv_mss, tp->mss_cache,
-+ tp->advmss, tp->rx_opt.user_mss);
-+ }
-+
- if (!tp->window_clamp)
- tp->window_clamp = dst_metric(dst, RTAX_WINDOW);
-- tp->advmss = dst_metric(dst, RTAX_ADVMSS);
-+ if (dst_metric(dst, RTAX_ADVMSS) < tp->advmss)
-+ tp->advmss = dst_metric(dst, RTAX_ADVMSS);
-+ if (tp->advmss == 0)
-+ tp->advmss = 1460;
- tcp_initialize_rcv_mss(sk);
- tcp_ca_init(tp);
-
- tcp_select_initial_window(tcp_full_space(sk),
-- tp->advmss - (tp->ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0),
-+ tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0),
- &tp->rcv_wnd,
- &tp->window_clamp,
- sysctl_tcp_window_scaling,
-- &tp->rcv_wscale);
-+ &tp->rx_opt.rcv_wscale);
-
- tp->rcv_ssthresh = tp->rcv_wnd;
-
-@@ -1477,6 +1531,10 @@ int tcp_connect(struct sock *sk)
- buff = alloc_skb(MAX_TCP_HEADER + 15, sk->sk_allocation);
- if (unlikely(buff == NULL))
- return -ENOBUFS;
-+ if (ub_tcpsndbuf_charge(sk, buff) < 0) {
-+ kfree_skb(buff);
-+ return -ENOBUFS;
-+ }
-
- /* Reserve space for headers. */
- skb_reserve(buff, MAX_TCP_HEADER);
-@@ -1728,3 +1786,4 @@ EXPORT_SYMBOL(tcp_make_synack);
- EXPORT_SYMBOL(tcp_simple_retransmit);
- EXPORT_SYMBOL(tcp_sync_mss);
- EXPORT_SYMBOL_GPL(tcp_write_xmit);
-+EXPORT_SYMBOL_GPL(tcp_transmit_skb);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_timer.c linux-2.6.9-ve023stab030/net/ipv4/tcp_timer.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/tcp_timer.c 2004-10-19 01:55:07.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/tcp_timer.c 2006-10-11 19:07:57.000000000 +0400
-@@ -22,6 +22,8 @@
-
- #include <linux/module.h>
- #include <net/tcp.h>
-+#include <ub/ub_orphan.h>
-+#include <ub/ub_tcp.h>
-
- int sysctl_tcp_syn_retries = TCP_SYN_RETRIES;
- int sysctl_tcp_synack_retries = TCP_SYNACK_RETRIES;
-@@ -100,7 +102,7 @@ static void tcp_write_err(struct sock *s
- static int tcp_out_of_resources(struct sock *sk, int do_reset)
- {
- struct tcp_opt *tp = tcp_sk(sk);
-- int orphans = atomic_read(&tcp_orphan_count);
-+ int orphans = tcp_get_orphan_count(sk);
-
- /* If peer does not open window for long time, or did not transmit
- * anything for long time, penalize it. */
-@@ -111,9 +113,7 @@ static int tcp_out_of_resources(struct s
- if (sk->sk_err_soft)
- orphans <<= 1;
-
-- if (orphans >= sysctl_tcp_max_orphans ||
-- (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
-- atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
-+ if (tcp_too_many_orphans(sk, orphans)) {
- if (net_ratelimit())
- printk(KERN_INFO "Out of socket memory\n");
-
-@@ -206,6 +206,7 @@ static int tcp_write_timeout(struct sock
- static void tcp_delack_timer(unsigned long data)
- {
- struct sock *sk = (struct sock*)data;
-+ struct ve_struct *env = set_exec_env(VE_OWNER_SK(sk));
- struct tcp_opt *tp = tcp_sk(sk);
-
- bh_lock_sock(sk);
-@@ -257,11 +258,12 @@ static void tcp_delack_timer(unsigned lo
- TCP_CHECK_TIMER(sk);
-
- out:
-- if (tcp_memory_pressure)
-+ if (ub_tcp_memory_pressure(sk))
- sk_stream_mem_reclaim(sk);
- out_unlock:
- bh_unlock_sock(sk);
- sock_put(sk);
-+ (void)set_exec_env(env);
- }
-
- static void tcp_probe_timer(struct sock *sk)
-@@ -315,6 +317,9 @@ static void tcp_probe_timer(struct sock
- static void tcp_retransmit_timer(struct sock *sk)
- {
- struct tcp_opt *tp = tcp_sk(sk);
-+ struct ve_struct *ve_old;
-+
-+ ve_old = set_exec_env(VE_OWNER_SK(sk));
-
- if (!tcp_get_pcount(&tp->packets_out))
- goto out;
-@@ -351,7 +356,7 @@ static void tcp_retransmit_timer(struct
-
- if (tp->retransmits == 0) {
- if (tp->ca_state == TCP_CA_Disorder || tp->ca_state == TCP_CA_Recovery) {
-- if (tp->sack_ok) {
-+ if (tp->rx_opt.sack_ok) {
- if (tp->ca_state == TCP_CA_Recovery)
- NET_INC_STATS_BH(LINUX_MIB_TCPSACKRECOVERYFAIL);
- else
-@@ -410,12 +415,14 @@ out_reset_timer:
- if (tp->retransmits > sysctl_tcp_retries1)
- __sk_dst_reset(sk);
-
--out:;
-+out:
-+ (void)set_exec_env(ve_old);
- }
-
- static void tcp_write_timer(unsigned long data)
- {
- struct sock *sk = (struct sock*)data;
-+ struct ve_struct *env = set_exec_env(VE_OWNER_SK(sk));
- struct tcp_opt *tp = tcp_sk(sk);
- int event;
-
-@@ -452,6 +459,7 @@ out:
- out_unlock:
- bh_unlock_sock(sk);
- sock_put(sk);
-+ (void)set_exec_env(env);
- }
-
- /*
-@@ -571,6 +579,7 @@ void tcp_set_keepalive(struct sock *sk,
- static void tcp_keepalive_timer (unsigned long data)
- {
- struct sock *sk = (struct sock *) data;
-+ struct ve_struct *env = set_exec_env(VE_OWNER_SK(sk));
- struct tcp_opt *tp = tcp_sk(sk);
- __u32 elapsed;
-
-@@ -645,6 +654,7 @@ death:
- out:
- bh_unlock_sock(sk);
- sock_put(sk);
-+ (void)set_exec_env(env);
- }
-
- EXPORT_SYMBOL(tcp_clear_xmit_timers);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv4/udp.c linux-2.6.9-ve023stab030/net/ipv4/udp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv4/udp.c 2004-10-19 01:53:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv4/udp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -125,7 +125,9 @@ static int udp_v4_get_port(struct sock *
- struct hlist_node *node;
- struct sock *sk2;
- struct inet_opt *inet = inet_sk(sk);
-+ struct ve_struct *env;
-
-+ env = VE_OWNER_SK(sk);
- write_lock_bh(&udp_hash_lock);
- if (snum == 0) {
- int best_size_so_far, best, result, i;
-@@ -139,7 +141,7 @@ static int udp_v4_get_port(struct sock *
- struct hlist_head *list;
- int size;
-
-- list = &udp_hash[result & (UDP_HTABLE_SIZE - 1)];
-+ list = &udp_hash[udp_hashfn(result, VEID(env))];
- if (hlist_empty(list)) {
- if (result > sysctl_local_port_range[1])
- result = sysctl_local_port_range[0] +
-@@ -161,7 +163,7 @@ static int udp_v4_get_port(struct sock *
- result = sysctl_local_port_range[0]
- + ((result - sysctl_local_port_range[0]) &
- (UDP_HTABLE_SIZE - 1));
-- if (!udp_lport_inuse(result))
-+ if (!udp_lport_inuse(result, env))
- break;
- }
- if (i >= (1 << 16) / UDP_HTABLE_SIZE)
-@@ -170,11 +172,12 @@ gotit:
- udp_port_rover = snum = result;
- } else {
- sk_for_each(sk2, node,
-- &udp_hash[snum & (UDP_HTABLE_SIZE - 1)]) {
-+ &udp_hash[udp_hashfn(snum, VEID(env))]) {
- struct inet_opt *inet2 = inet_sk(sk2);
-
- if (inet2->num == snum &&
- sk2 != sk &&
-+ ve_accessible_strict(VE_OWNER_SK(sk2), env) &&
- !ipv6_only_sock(sk2) &&
- (!sk2->sk_bound_dev_if ||
- !sk->sk_bound_dev_if ||
-@@ -188,7 +191,7 @@ gotit:
- }
- inet->num = snum;
- if (sk_unhashed(sk)) {
-- struct hlist_head *h = &udp_hash[snum & (UDP_HTABLE_SIZE - 1)];
-+ struct hlist_head *h = &udp_hash[udp_hashfn(snum, VEID(env))];
-
- sk_add_node(sk, h);
- sock_prot_inc_use(sk->sk_prot);
-@@ -225,11 +228,15 @@ struct sock *udp_v4_lookup_longway(u32 s
- struct hlist_node *node;
- unsigned short hnum = ntohs(dport);
- int badness = -1;
-+ struct ve_struct *env;
-
-- sk_for_each(sk, node, &udp_hash[hnum & (UDP_HTABLE_SIZE - 1)]) {
-+ env = get_exec_env();
-+ sk_for_each(sk, node, &udp_hash[udp_hashfn(hnum, VEID(env))]) {
- struct inet_opt *inet = inet_sk(sk);
-
-- if (inet->num == hnum && !ipv6_only_sock(sk)) {
-+ if (inet->num == hnum &&
-+ ve_accessible_strict(VE_OWNER_SK(sk), env) &&
-+ !ipv6_only_sock(sk)) {
- int score = (sk->sk_family == PF_INET ? 1 : 0);
- if (inet->rcv_saddr) {
- if (inet->rcv_saddr != daddr)
-@@ -1053,7 +1060,8 @@ static int udp_v4_mcast_deliver(struct s
- int dif;
-
- read_lock(&udp_hash_lock);
-- sk = sk_head(&udp_hash[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]);
-+ sk = sk_head(&udp_hash[udp_hashfn(ntohs(uh->dest),
-+ VEID(VE_OWNER_SKB(skb)))]);
- dif = skb->dev->ifindex;
- sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
- if (sk) {
-@@ -1330,10 +1338,14 @@ static struct sock *udp_get_first(struct
- {
- struct sock *sk;
- struct udp_iter_state *state = seq->private;
-+ struct ve_struct *env;
-
-+ env = get_exec_env();
- for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
- struct hlist_node *node;
- sk_for_each(sk, node, &udp_hash[state->bucket]) {
-+ if (!ve_accessible(VE_OWNER_SK(sk), env))
-+ continue;
- if (sk->sk_family == state->family)
- goto found;
- }
-@@ -1350,8 +1362,13 @@ static struct sock *udp_get_next(struct
- do {
- sk = sk_next(sk);
- try_again:
-- ;
-- } while (sk && sk->sk_family != state->family);
-+ if (!sk)
-+ break;
-+ if (sk->sk_family != state->family)
-+ continue;
-+ if (ve_accessible(VE_OWNER_SK(sk), get_exec_env()))
-+ break;
-+ } while (1);
-
- if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
- sk = sk_head(&udp_hash[state->bucket]);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv6/addrconf.c linux-2.6.9-ve023stab030/net/ipv6/addrconf.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv6/addrconf.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv6/addrconf.c 2006-10-11 19:07:57.000000000 +0400
-@@ -1968,6 +1968,10 @@ static int addrconf_notify(struct notifi
- struct net_device *dev = (struct net_device *) data;
- struct inet6_dev *idev = __in6_dev_get(dev);
-
-+ /* not virtualized yet */
-+ if (!ve_is_super(get_exec_env()))
-+ return NOTIFY_OK;
-+
- switch(event) {
- case NETDEV_UP:
- switch(dev->type) {
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv6/ndisc.c linux-2.6.9-ve023stab030/net/ipv6/ndisc.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv6/ndisc.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv6/ndisc.c 2006-10-11 19:07:57.000000000 +0400
-@@ -124,7 +124,7 @@ static struct neigh_ops ndisc_direct_ops
- .queue_xmit = dev_queue_xmit,
- };
-
--struct neigh_table nd_tbl = {
-+struct neigh_table global_nd_tbl = {
- .family = AF_INET6,
- .entry_size = sizeof(struct neighbour) + sizeof(struct in6_addr),
- .key_len = sizeof(struct in6_addr),
-@@ -135,7 +135,7 @@ struct neigh_table nd_tbl = {
- .proxy_redo = pndisc_redo,
- .id = "ndisc_cache",
- .parms = {
-- .tbl = &nd_tbl,
-+ .tbl = &global_nd_tbl,
- .base_reachable_time = 30 * HZ,
- .retrans_time = 1 * HZ,
- .gc_staletime = 60 * HZ,
-@@ -1473,7 +1473,9 @@ int __init ndisc_init(struct net_proto_f
- * Initialize the neighbour table
- */
-
-- neigh_table_init(&nd_tbl);
-+ get_ve0()->ve_nd_tbl = &global_nd_tbl;
-+ if (neigh_table_init(&nd_tbl))
-+ panic("cannot initialize IPv6 NDISC tables\n");
-
- #ifdef CONFIG_SYSCTL
- neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH,
-@@ -1493,3 +1495,50 @@ void ndisc_cleanup(void)
- sock_release(ndisc_socket);
- ndisc_socket = NULL; /* For safety. */
- }
-+
-+int ve_ndisc_init(struct ve_struct *ve)
-+{
-+ struct ve_struct *old_env;
-+ int err;
-+
-+ ve->ve_nd_tbl = kmalloc(sizeof(struct neigh_table), GFP_KERNEL);
-+ if (ve->ve_nd_tbl == NULL) {
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+
-+ *(ve->ve_nd_tbl) = global_nd_tbl;
-+ ve->ve_nd_tbl->parms.tbl = ve->ve_nd_tbl;
-+ old_env = set_exec_env(ve);
-+ err = neigh_table_init(ve->ve_nd_tbl);
-+ if (err)
-+ goto out_free;
-+#ifdef CONFIG_SYSCTL
-+ neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH,
-+ "ipv6", &ndisc_ifinfo_sysctl_change);
-+#endif
-+ set_exec_env(old_env);
-+ err = 0;
-+
-+out:
-+ return err;
-+
-+out_free:
-+ kfree(ve->ve_nd_tbl);
-+ ve->ve_nd_tbl = NULL;
-+ goto out;
-+}
-+EXPORT_SYMBOL(ve_ndisc_init);
-+
-+void ve_ndisc_fini(struct ve_struct *ve)
-+{
-+ if (ve->ve_nd_tbl) {
-+#ifdef CONFIG_SYSCTL
-+ neigh_sysctl_unregister(&ve->ve_nd_tbl->parms);
-+#endif
-+ neigh_table_clear(ve->ve_nd_tbl);
-+ kfree(ve->ve_nd_tbl);
-+ ve->ve_nd_tbl = NULL;
-+ }
-+}
-+EXPORT_SYMBOL(ve_ndisc_fini);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv6/netfilter/ip6t_owner.c linux-2.6.9-ve023stab030/net/ipv6/netfilter/ip6t_owner.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv6/netfilter/ip6t_owner.c 2004-10-19 01:55:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv6/netfilter/ip6t_owner.c 2006-10-11 19:07:57.000000000 +0400
-@@ -23,6 +23,7 @@ MODULE_LICENSE("GPL");
- static int
- match_pid(const struct sk_buff *skb, pid_t pid)
- {
-+#ifndef CONFIG_VE
- struct task_struct *p;
- struct files_struct *files;
- int i;
-@@ -48,12 +49,14 @@ match_pid(const struct sk_buff *skb, pid
- task_unlock(p);
- out:
- read_unlock(&tasklist_lock);
-+#endif
- return 0;
- }
-
- static int
- match_sid(const struct sk_buff *skb, pid_t sid)
- {
-+#ifndef CONFIG_VE
- struct task_struct *g, *p;
- struct file *file = skb->sk->sk_socket->file;
- int i, found=0;
-@@ -84,6 +87,9 @@ out:
- read_unlock(&tasklist_lock);
-
- return found;
-+#else
-+ return 0;
-+#endif
- }
-
- static int
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv6/tcp_ipv6.c linux-2.6.9-ve023stab030/net/ipv6/tcp_ipv6.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv6/tcp_ipv6.c 2004-10-19 01:54:32.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv6/tcp_ipv6.c 2006-10-11 19:07:57.000000000 +0400
-@@ -143,7 +143,7 @@ static int tcp_v6_get_port(struct sock *
- do { rover++;
- if ((rover < low) || (rover > high))
- rover = low;
-- head = &tcp_bhash[tcp_bhashfn(rover)];
-+ head = &tcp_bhash[tcp_bhashfn(rover, 0)];
- spin_lock(&head->lock);
- tb_for_each(tb, node, &head->chain)
- if (tb->port == rover)
-@@ -163,7 +163,7 @@ static int tcp_v6_get_port(struct sock *
- /* OK, here is the one we will use. */
- snum = rover;
- } else {
-- head = &tcp_bhash[tcp_bhashfn(snum)];
-+ head = &tcp_bhash[tcp_bhashfn(snum, 0)];
- spin_lock(&head->lock);
- tb_for_each(tb, node, &head->chain)
- if (tb->port == snum)
-@@ -184,7 +184,7 @@ tb_found:
- }
- tb_not_found:
- ret = 1;
-- if (!tb && (tb = tcp_bucket_create(head, snum)) == NULL)
-+ if (!tb && (tb = tcp_bucket_create(head, snum, NULL)) == NULL)
- goto fail_unlock;
- if (hlist_empty(&tb->owners)) {
- if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
-@@ -256,7 +256,7 @@ static struct sock *tcp_v6_lookup_listen
-
- hiscore=0;
- read_lock(&tcp_lhash_lock);
-- sk_for_each(sk, node, &tcp_listening_hash[tcp_lhashfn(hnum)]) {
-+ sk_for_each(sk, node, &tcp_listening_hash[tcp_lhashfn(hnum, 0)]) {
- if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) {
- struct ipv6_pinfo *np = inet6_sk(sk);
-
-@@ -471,8 +471,8 @@ static int tcp_v6_check_established(stru
- tp->write_seq = tw->tw_snd_nxt + 65535 + 2;
- if (!tp->write_seq)
- tp->write_seq = 1;
-- tp->ts_recent = tw->tw_ts_recent;
-- tp->ts_recent_stamp = tw->tw_ts_recent_stamp;
-+ tp->rx_opt.ts_recent = tw->tw_ts_recent;
-+ tp->rx_opt.ts_recent_stamp = tw->tw_ts_recent_stamp;
- sock_hold(sk2);
- goto unique;
- } else
-@@ -523,7 +523,7 @@ static int tcp_v6_hash_connect(struct so
- inet_sk(sk)->sport = htons(inet_sk(sk)->num);
- }
-
-- head = &tcp_bhash[tcp_bhashfn(inet_sk(sk)->num)];
-+ head = &tcp_bhash[tcp_bhashfn(inet_sk(sk)->num, 0)];
- tb = tb_head(head);
-
- spin_lock_bh(&head->lock);
-@@ -607,10 +607,10 @@ static int tcp_v6_connect(struct sock *s
- return -EINVAL;
- }
-
-- if (tp->ts_recent_stamp &&
-+ if (tp->rx_opt.ts_recent_stamp &&
- ipv6_addr_cmp(&np->daddr, &usin->sin6_addr)) {
-- tp->ts_recent = 0;
-- tp->ts_recent_stamp = 0;
-+ tp->rx_opt.ts_recent = 0;
-+ tp->rx_opt.ts_recent_stamp = 0;
- tp->write_seq = 0;
- }
-
-@@ -695,13 +695,15 @@ static int tcp_v6_connect(struct sock *s
- ip6_dst_store(sk, dst, NULL);
- sk->sk_route_caps = dst->dev->features &
- ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
-+ if (!sysctl_tcp_use_sg)
-+ sk->sk_route_caps &= ~NETIF_F_SG;
-
- tp->ext_header_len = 0;
- if (np->opt)
- tp->ext_header_len = np->opt->opt_flen + np->opt->opt_nflen;
- tp->ext2_header_len = dst->header_len;
-
-- tp->mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
-+ tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
-
- inet->dport = usin->sin6_port;
-
-@@ -1200,7 +1202,8 @@ static void tcp_v6_synq_add(struct sock
- static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
- {
- struct ipv6_pinfo *np = inet6_sk(sk);
-- struct tcp_opt tmptp, *tp = tcp_sk(sk);
-+ struct tcp_options_received tmp_opt;
-+ struct tcp_opt *tp = tcp_sk(sk);
- struct open_request *req = NULL;
- __u32 isn = TCP_SKB_CB(skb)->when;
-
-@@ -1226,14 +1229,14 @@ static int tcp_v6_conn_request(struct so
- if (req == NULL)
- goto drop;
-
-- tcp_clear_options(&tmptp);
-- tmptp.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
-- tmptp.user_mss = tp->user_mss;
-+ tcp_clear_options(&tmp_opt);
-+ tmp_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
-+ tmp_opt.user_mss = tp->rx_opt.user_mss;
-
-- tcp_parse_options(skb, &tmptp, 0);
-+ tcp_parse_options(skb, &tmp_opt, 0);
-
-- tmptp.tstamp_ok = tmptp.saw_tstamp;
-- tcp_openreq_init(req, &tmptp, skb);
-+ tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
-+ tcp_openreq_init(req, &tmp_opt, skb);
-
- req->class = &or_ipv6;
- ipv6_addr_copy(&req->af.v6_req.rmt_addr, &skb->nh.ipv6h->saddr);
-@@ -1386,6 +1389,8 @@ static struct sock * tcp_v6_syn_recv_soc
- ip6_dst_store(newsk, dst, NULL);
- newsk->sk_route_caps = dst->dev->features &
- ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
-+ if (!sysctl_tcp_use_sg)
-+ sk->sk_route_caps &= ~NETIF_F_SG;
-
- newtcp6sk = (struct tcp6_sock *)newsk;
- newtcp6sk->pinet6 = &newtcp6sk->inet6;
-@@ -1718,12 +1723,14 @@ do_time_wait:
- goto discard_it;
- }
-
-+ spin_lock(&((struct tcp_tw_bucket *)sk)->tw_lock);
- switch(tcp_timewait_state_process((struct tcp_tw_bucket *)sk,
- skb, th, skb->len)) {
- case TCP_TW_SYN:
- {
- struct sock *sk2;
-
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
- sk2 = tcp_v6_lookup_listener(&skb->nh.ipv6h->daddr, ntohs(th->dest), tcp_v6_iif(skb));
- if (sk2 != NULL) {
- tcp_tw_deschedule((struct tcp_tw_bucket *)sk);
-@@ -1737,9 +1744,13 @@ do_time_wait:
- tcp_v6_timewait_ack(sk, skb);
- break;
- case TCP_TW_RST:
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
-+ tcp_tw_put((struct tcp_tw_bucket *)sk);
- goto no_tcp_socket;
- case TCP_TW_SUCCESS:;
- }
-+ spin_unlock(&((struct tcp_tw_bucket *)sk)->tw_lock);
-+ tcp_tw_put((struct tcp_tw_bucket *)sk);
- goto discard_it;
- }
-
-@@ -1789,6 +1800,10 @@ static int tcp_v6_rebuild_header(struct
- ip6_dst_store(sk, dst, NULL);
- sk->sk_route_caps = dst->dev->features &
- ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
-+ if (!sysctl_tcp_use_sg)
-+ sk->sk_route_caps &= ~NETIF_F_SG;
-+ if (!sysctl_tcp_use_sg)
-+ sk->sk_route_caps &= ~NETIF_F_SG;
- tcp_sk(sk)->ext2_header_len = dst->header_len;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/ipv6/udp.c linux-2.6.9-ve023stab030/net/ipv6/udp.c
---- linux-2.6.9-42.0.3.EL.orig/net/ipv6/udp.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/ipv6/udp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -67,7 +67,9 @@ static int udp_v6_get_port(struct sock *
- {
- struct sock *sk2;
- struct hlist_node *node;
-+ struct ve_struct *env;
-
-+ env = VE_OWNER_SK(sk);
- write_lock_bh(&udp_hash_lock);
- if (snum == 0) {
- int best_size_so_far, best, result, i;
-@@ -81,7 +83,7 @@ static int udp_v6_get_port(struct sock *
- int size;
- struct hlist_head *list;
-
-- list = &udp_hash[result & (UDP_HTABLE_SIZE - 1)];
-+ list = &udp_hash[udp_hashfn(result, VEID(env))];
- if (hlist_empty(list)) {
- if (result > sysctl_local_port_range[1])
- result = sysctl_local_port_range[0] +
-@@ -103,7 +105,7 @@ static int udp_v6_get_port(struct sock *
- result = sysctl_local_port_range[0]
- + ((result - sysctl_local_port_range[0]) &
- (UDP_HTABLE_SIZE - 1));
-- if (!udp_lport_inuse(result))
-+ if (!udp_lport_inuse(result, env))
- break;
- }
- if (i >= (1 << 16) / UDP_HTABLE_SIZE)
-@@ -112,9 +114,10 @@ gotit:
- udp_port_rover = snum = result;
- } else {
- sk_for_each(sk2, node,
-- &udp_hash[snum & (UDP_HTABLE_SIZE - 1)]) {
-+ &udp_hash[udp_hashfn(snum, VEID(env))]) {
- if (inet_sk(sk2)->num == snum &&
- sk2 != sk &&
-+ ve_accessible_strict(VE_OWNER_SK(sk2), env) &&
- (!sk2->sk_bound_dev_if ||
- !sk->sk_bound_dev_if ||
- sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
-@@ -126,7 +129,7 @@ gotit:
-
- inet_sk(sk)->num = snum;
- if (sk_unhashed(sk)) {
-- sk_add_node(sk, &udp_hash[snum & (UDP_HTABLE_SIZE - 1)]);
-+ sk_add_node(sk, &udp_hash[udp_hashfn(snum, VEID(env))]);
- sock_prot_inc_use(sk->sk_prot);
- }
- write_unlock_bh(&udp_hash_lock);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/netlink/af_netlink.c linux-2.6.9-ve023stab030/net/netlink/af_netlink.c
---- linux-2.6.9-42.0.3.EL.orig/net/netlink/af_netlink.c 2006-10-11 18:29:44.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/netlink/af_netlink.c 2006-10-11 19:07:58.000000000 +0400
-@@ -53,6 +53,10 @@
- #include <linux/audit.h>
- #include <net/sock.h>
- #include <net/scm.h>
-+#include <linux/swap.h>
-+
-+#include <ub/beancounter.h>
-+#include <ub/ub_net.h>
-
- #define Nprintk(a...)
-
-@@ -60,20 +64,6 @@
- #define NL_EMULATE_DEV
- #endif
-
--struct netlink_opt
--{
-- u32 pid;
-- unsigned int groups;
-- u32 dst_pid;
-- unsigned int dst_groups;
-- unsigned long state;
-- int (*handler)(int unit, struct sk_buff *skb);
-- wait_queue_head_t wait;
-- struct netlink_callback *cb;
-- spinlock_t cb_lock;
-- void (*data_ready)(struct sock *sk, int bytes);
--};
--
- #define nlk_sk(__sk) ((struct netlink_opt *)(__sk)->sk_protinfo)
-
- struct nl_pid_hash {
-@@ -192,7 +182,10 @@ static __inline__ struct sock *netlink_l
- read_lock(&nl_table_lock);
- head = nl_pid_hashfn(hash, pid);
- sk_for_each(sk, node, head) {
-- if (nlk_sk(sk)->pid == pid) {
-+ /* VEs should find sockets, created by kernel */
-+ if ((nlk_sk(sk)->pid == pid) &&
-+ (!pid || ve_accessible_strict(VE_OWNER_SK(sk),
-+ get_exec_env()))){
- sock_hold(sk);
- goto found;
- }
-@@ -292,7 +285,9 @@ static int netlink_insert(struct sock *s
- head = nl_pid_hashfn(hash, pid);
- len = 0;
- sk_for_each(osk, node, head) {
-- if (nlk_sk(osk)->pid == pid)
-+ if ((nlk_sk(osk)->pid == pid) &&
-+ ve_accessible_strict(VE_OWNER_SK(osk),
-+ get_exec_env()))
- break;
- len++;
- }
-@@ -347,15 +342,16 @@ static int netlink_create(struct socket
- sk = sk_alloc(PF_NETLINK, GFP_KERNEL, 1, NULL);
- if (!sk)
- return -ENOMEM;
-+ if (ub_other_sock_charge(sk))
-+ goto out_free;
-
- sock_init_data(sock,sk);
- sk_set_owner(sk, THIS_MODULE);
-
- nlk = sk->sk_protinfo = kmalloc(sizeof(*nlk), GFP_KERNEL);
-- if (!nlk) {
-- sk_free(sk);
-- return -ENOMEM;
-- }
-+ if (!nlk)
-+ goto out_free;
-+
- memset(nlk, 0, sizeof(*nlk));
-
- spin_lock_init(&nlk->cb_lock);
-@@ -364,6 +360,10 @@ static int netlink_create(struct socket
-
- sk->sk_protocol = protocol;
- return 0;
-+
-+out_free:
-+ sk_free(sk);
-+ return -ENOMEM;
- }
-
- static int netlink_release(struct socket *sock)
-@@ -375,6 +375,7 @@ static int netlink_release(struct socket
- return 0;
-
- netlink_remove(sk);
-+ sock_orphan(sk);
- nlk = nlk_sk(sk);
-
- spin_lock(&nlk->cb_lock);
-@@ -382,14 +383,12 @@ static int netlink_release(struct socket
- nlk->cb->done(nlk->cb);
- netlink_destroy_callback(nlk->cb);
- nlk->cb = NULL;
-- __sock_put(sk);
- }
- spin_unlock(&nlk->cb_lock);
-
- /* OK. Socket is unlinked, and, therefore,
- no new packets will arrive */
-
-- sock_orphan(sk);
- sock->sk = NULL;
- wake_up_interruptible_all(&nlk->wait);
-
-@@ -414,7 +413,7 @@ static int netlink_autobind(struct socke
- struct hlist_head *head;
- struct sock *osk;
- struct hlist_node *node;
-- s32 pid = current->pid;
-+ s32 pid = virt_pid(current);
- int err;
- static s32 rover = -4097;
-
-@@ -423,7 +422,9 @@ retry:
- netlink_table_grab();
- head = nl_pid_hashfn(hash, pid);
- sk_for_each(osk, node, head) {
-- if (nlk_sk(osk)->pid == pid) {
-+ if ((nlk_sk(osk)->pid == pid) &&
-+ ve_accessible_strict(VE_OWNER_SK(osk),
-+ get_exec_env())){
- /* Bind collision, search negative pid values. */
- pid = rover--;
- if (rover > -4097)
-@@ -449,7 +450,7 @@ retry:
- static inline int netlink_capable(struct socket *sock, unsigned int flag)
- {
- return (nl_nonroot[sock->sk->sk_protocol] & flag) ||
-- capable(CAP_NET_ADMIN);
-+ capable(CAP_VE_NET_ADMIN);
- }
-
- static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
-@@ -600,7 +601,8 @@ struct sock *netlink_getsockbyfilp(struc
- * 0: continue
- * 1: repeat lookup - reference dropped while waiting for socket memory.
- */
--int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo)
-+int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-+ long timeo, struct sock *ssk)
- {
- struct netlink_opt *nlk;
-
-@@ -614,7 +616,7 @@ int netlink_attachskb(struct sock *sk, s
- test_bit(0, &nlk->state)) {
- DECLARE_WAITQUEUE(wait, current);
- if (!timeo) {
-- if (!nlk->pid)
-+ if (!ssk || nlk_sk(ssk)->pid == 0)
- netlink_overrun(sk);
- sock_put(sk);
- kfree_skb(skb);
-@@ -658,6 +660,11 @@ int netlink_sendskb(struct sock *sk, str
- return len;
- }
- #endif
-+ if (ub_sockrcvbuf_charge(sk, skb) < 0) {
-+ sock_put(sk);
-+ kfree_skb(skb);
-+ return -EACCES;
-+ }
-
- skb_queue_tail(&sk->sk_receive_queue, skb);
- sk->sk_data_ready(sk, len);
-@@ -703,7 +710,7 @@ retry:
- kfree_skb(skb);
- return PTR_ERR(sk);
- }
-- err = netlink_attachskb(sk, skb, nonblock, timeo);
-+ err = netlink_attachskb(sk, skb, nonblock, timeo, ssk);
- if (err == 1)
- goto retry;
- if (err)
-@@ -724,12 +731,16 @@ static __inline__ int netlink_broadcast_
- #endif
- if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
- !test_bit(0, &nlk->state)) {
-+ if (ub_sockrcvbuf_charge(sk, skb))
-+ goto out;
- skb_orphan(skb);
- skb_set_owner_r(skb, sk);
- skb_queue_tail(&sk->sk_receive_queue, skb);
- sk->sk_data_ready(sk, skb->len);
-+ /* do not uncharge as >= 0 is treated as success */
- return atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf;
- }
-+out:
- return -1;
- }
-
-@@ -756,6 +767,9 @@ static inline int do_one_broadcast(struc
- if (nlk->pid == p->pid || !(nlk->groups & p->group))
- goto out;
-
-+ if (!ve_accessible_strict(get_exec_env(), VE_OWNER_SK(sk)))
-+ goto out;
-+
- if (p->failure) {
- netlink_overrun(sk);
- goto out;
-@@ -847,6 +861,9 @@ static inline int do_one_set_err(struct
- if (nlk->pid == p->pid || !(nlk->groups & p->group))
- goto out;
-
-+ if (!ve_accessible_strict(get_exec_env(), VE_OWNER_SK(sk)))
-+ goto out;
-+
- sk->sk_err = p->code;
- sk->sk_error_report(sk);
- out:
-@@ -888,12 +905,17 @@ static int netlink_sendmsg(struct kiocb
- struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
- struct sock *sk = sock->sk;
- struct netlink_opt *nlk = nlk_sk(sk);
-- struct sockaddr_nl *addr=msg->msg_name;
-+ struct sockaddr_nl *addr = msg->msg_name;
- u32 dst_pid;
-- u32 dst_groups;
- struct sk_buff *skb;
- int err;
- struct scm_cookie scm;
-+ struct sock *dstsk;
-+ long timeo;
-+ int no_ubc, no_buf;
-+ unsigned long chargesize;
-+
-+ DECLARE_WAITQUEUE(wait, current);
-
- if (msg->msg_flags&MSG_OOB)
- return -EOPNOTSUPP;
-@@ -904,17 +926,16 @@ static int netlink_sendmsg(struct kiocb
- if (err < 0)
- return err;
-
-+ /* Broadcasts are disabled as it was in 2.4 with UBC. According to
-+ * ANK this is OK. Den */
- if (msg->msg_namelen) {
- if (addr->nl_family != AF_NETLINK)
- return -EINVAL;
- dst_pid = addr->nl_pid;
-- dst_groups = addr->nl_groups;
-- if (dst_groups && !netlink_capable(sock, NL_NONROOT_SEND))
-+ if (addr->nl_groups && !netlink_capable(sock, NL_NONROOT_SEND))
- return -EPERM;
-- } else {
-+ } else
- dst_pid = nlk->dst_pid;
-- dst_groups = nlk->dst_groups;
-- }
-
- if (!nlk->pid) {
- err = netlink_autobind(sock);
-@@ -927,13 +948,13 @@ static int netlink_sendmsg(struct kiocb
- goto out;
- err = -ENOBUFS;
- skb = alloc_skb(len, GFP_KERNEL);
-- if (skb==NULL)
-+ if (skb == NULL)
- goto out;
-
- NETLINK_CB(skb).pid = nlk->pid;
- NETLINK_CB(skb).groups = nlk->groups;
- NETLINK_CB(skb).dst_pid = dst_pid;
-- NETLINK_CB(skb).dst_groups = dst_groups;
-+ NETLINK_CB(skb).dst_groups = 0;
- NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context);
- memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
-
-@@ -944,25 +965,88 @@ static int netlink_sendmsg(struct kiocb
- */
-
- err = -EFAULT;
-- if (memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len)) {
-- kfree_skb(skb);
-- goto out;
-- }
-+ if (memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len))
-+ goto out_free;
-
- err = security_netlink_send(sk, skb);
-- if (err) {
-- kfree_skb(skb);
-- goto out;
-+ if (err)
-+ goto out_free;
-+
-+ timeo = sock_sndtimeo(sk, msg->msg_flags&MSG_DONTWAIT);
-+retry:
-+ dstsk = netlink_getsockbypid(sk, dst_pid);
-+ if (IS_ERR(dstsk)) {
-+ err = PTR_ERR(dstsk);
-+ goto out_free;
- }
-
-- if (dst_groups) {
-- atomic_inc(&skb->users);
-- netlink_broadcast(sk, skb, dst_pid, dst_groups, GFP_KERNEL);
-+ nlk = nlk_sk(dstsk);
-+#ifdef NL_EMULATE_DEV
-+ if (nlk->handler) {
-+ skb_orphan(skb);
-+ err = nlk->handler(dstsk->sk_protocol, skb);
-+ goto out_put;
- }
-- err = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);
-+#endif
-+
-+ /* BTW, it could be done once, before the retry loop */
-+ chargesize = skb_charge_fullsize(skb);
-+ no_ubc = ub_sock_getwres_other(sk, chargesize);
-+ no_buf = atomic_read(&dstsk->sk_rmem_alloc) > dstsk->sk_rcvbuf ||
-+ test_bit(0, &nlk->state);
-+ if (no_ubc || no_buf) {
-+ wait_queue_head_t *sleep;
-+
-+ if (!no_ubc)
-+ ub_sock_retwres_other(sk, chargesize,
-+ SOCK_MIN_UBCSPACE_CH);
-+ err = -EAGAIN;
-+ if (timeo == 0) {
-+ kfree_skb(skb);
-+ goto out_put;
-+ }
-+
-+ /* wake up comes to different queues */
-+ sleep = no_ubc ? sk->sk_sleep : &nlk->wait;
-+ __set_current_state(TASK_INTERRUPTIBLE);
-+ add_wait_queue(sleep, &wait);
-+
-+ /* this if can't be moved upper because ub_sock_snd_queue_add()
-+ * may change task state to TASK_RUNNING */
-+ if (no_ubc)
-+ ub_sock_sndqueueadd_other(sk, chargesize);
-+
-+ if ((atomic_read(&dstsk->sk_rmem_alloc) > dstsk->sk_rcvbuf ||
-+ test_bit(0, &nlk->state) || no_ubc) &&
-+ !sock_flag(dstsk, SOCK_DEAD))
-+ timeo = schedule_timeout(timeo);
-
-+ __set_current_state(TASK_RUNNING);
-+ remove_wait_queue(sleep, &wait);
-+ if (no_ubc)
-+ ub_sock_sndqueuedel(sk);
-+ sock_put(dstsk);
-+
-+ if (!signal_pending(current))
-+ goto retry;
-+ err = sock_intr_errno(timeo);
-+ goto out_free;
-+ }
-+
-+ skb_orphan(skb);
-+ skb_set_owner_r(skb, dstsk);
-+ ub_skb_set_charge(skb, sk, chargesize, UB_OTHERSOCKBUF);
-+ skb_queue_tail(&dstsk->sk_receive_queue, skb);
-+ dstsk->sk_data_ready(dstsk, len);
-+ err = len;
-+out_put:
-+ sock_put(dstsk);
- out:
- return err;
-+
-+out_free:
-+ kfree_skb(skb);
-+ return err;
- }
-
- static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
-@@ -1099,6 +1183,10 @@ static int netlink_dump(struct sock *sk)
- skb = sock_rmalloc(sk, NLMSG_GOODSIZE, 0, GFP_KERNEL);
- if (!skb)
- return -ENOBUFS;
-+ if (ub_nlrcvbuf_charge(skb, sk) < 0) {
-+ kfree_skb(skb);
-+ return -EACCES;
-+ }
-
- spin_lock(&nlk->cb_lock);
-
-@@ -1129,7 +1217,6 @@ static int netlink_dump(struct sock *sk)
- spin_unlock(&nlk->cb_lock);
-
- netlink_destroy_callback(cb);
-- sock_put(sk);
- return 0;
- }
-
-@@ -1159,9 +1246,9 @@ int netlink_dump_start(struct sock *ssk,
- return -ECONNREFUSED;
- }
- nlk = nlk_sk(sk);
-- /* A dump is in progress... */
-+ /* A dump or destruction is in progress... */
- spin_lock(&nlk->cb_lock);
-- if (nlk->cb) {
-+ if (nlk->cb || sock_flag(sk, SOCK_DEAD)) {
- spin_unlock(&nlk->cb_lock);
- netlink_destroy_callback(cb);
- sock_put(sk);
-@@ -1171,6 +1258,7 @@ int netlink_dump_start(struct sock *ssk,
- spin_unlock(&nlk->cb_lock);
-
- netlink_dump(sk);
-+ sock_put(sk);
- return 0;
- }
-
-@@ -1467,10 +1555,10 @@ enomem:
-
- memset(nl_table, 0, sizeof(*nl_table) * MAX_LINKS);
-
-- if (num_physpages >= (128 * 1024))
-- max = num_physpages >> (21 - PAGE_SHIFT);
-+ if (nr_lowmem_pages() >= (128 * 1024))
-+ max = nr_lowmem_pages() >> (21 - PAGE_SHIFT);
- else
-- max = num_physpages >> (23 - PAGE_SHIFT);
-+ max = nr_lowmem_pages() >> (23 - PAGE_SHIFT);
-
- order = get_bitmask_order(max) - 1 + PAGE_SHIFT;
- max = (1UL << order) / sizeof(struct hlist_head);
-@@ -1496,6 +1584,7 @@ enomem:
-
- sock_register(&netlink_family_ops);
- #ifdef CONFIG_PROC_FS
-+ /* FIXME: virtualize before give access from VEs */
- proc_net_fops_create("netlink", 0, &netlink_seq_fops);
- #endif
- /* The netlink device handler may be needed early. */
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/packet/af_packet.c linux-2.6.9-ve023stab030/net/packet/af_packet.c
---- linux-2.6.9-42.0.3.EL.orig/net/packet/af_packet.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/packet/af_packet.c 2006-10-11 19:07:57.000000000 +0400
-@@ -73,6 +73,8 @@
- #include <linux/module.h>
- #include <linux/init.h>
-
-+#include <ub/ub_net.h>
-+
- #ifdef CONFIG_INET
- #include <net/inet_common.h>
- #endif
-@@ -262,7 +264,8 @@ static int packet_rcv_spkt(struct sk_buf
- * so that this procedure is noop.
- */
-
-- if (skb->pkt_type == PACKET_LOOPBACK)
-+ if (skb->pkt_type == PACKET_LOOPBACK ||
-+ !ve_accessible(VE_OWNER_SKB(skb), VE_OWNER_SK(sk)))
- goto out;
-
- if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
-@@ -454,6 +457,9 @@ static int packet_rcv(struct sk_buff *sk
- sk = pt->af_packet_priv;
- po = pkt_sk(sk);
-
-+ if (!ve_accessible(VE_OWNER_SKB(skb), VE_OWNER_SK(sk)))
-+ goto drop;
-+
- skb->dev = dev;
-
- if (dev->hard_header) {
-@@ -513,6 +519,9 @@ static int packet_rcv(struct sk_buff *sk
- if (pskb_trim(skb, snaplen))
- goto drop_n_acct;
-
-+ if (ub_sockrcvbuf_charge(sk, skb))
-+ goto drop_n_acct;
-+
- skb_set_owner_r(skb, sk);
- skb->dev = NULL;
- dst_release(skb->dst);
-@@ -563,6 +572,9 @@ static int tpacket_rcv(struct sk_buff *s
- sk = pt->af_packet_priv;
- po = pkt_sk(sk);
-
-+ if (!ve_accessible(VE_OWNER_SKB(skb), VE_OWNER_SK(sk)))
-+ goto drop;
-+
- if (dev->hard_header) {
- if (sk->sk_type != SOCK_DGRAM)
- skb_push(skb, skb->data - skb->mac.raw);
-@@ -612,6 +624,12 @@ static int tpacket_rcv(struct sk_buff *s
- if (snaplen > skb->len-skb->data_len)
- snaplen = skb->len-skb->data_len;
-
-+ if (copy_skb &&
-+ ub_sockrcvbuf_charge(sk, copy_skb)) {
-+ spin_lock(&sk->sk_receive_queue.lock);
-+ goto ring_is_full;
-+ }
-+
- spin_lock(&sk->sk_receive_queue.lock);
- h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head);
-
-@@ -985,6 +1003,8 @@ static int packet_create(struct socket *
- sk = sk_alloc(PF_PACKET, GFP_KERNEL, 1, NULL);
- if (sk == NULL)
- goto out;
-+ if (ub_other_sock_charge(sk))
-+ goto out_free;
-
- sock->ops = &packet_ops;
- #ifdef CONFIG_SOCK_PACKET
-@@ -1404,11 +1424,16 @@ static int packet_notifier(struct notifi
- struct sock *sk;
- struct hlist_node *node;
- struct net_device *dev = (struct net_device*)data;
-+ struct ve_struct *ve;
-
-+ ve = get_exec_env();
- read_lock(&packet_sklist_lock);
- sk_for_each(sk, node, &packet_sklist) {
- struct packet_opt *po = pkt_sk(sk);
-
-+ if (!ve_accessible_strict(VE_OWNER_SK(sk), ve))
-+ continue;
-+
- switch (msg) {
- case NETDEV_UNREGISTER:
- #ifdef CONFIG_PACKET_MULTICAST
-@@ -1812,6 +1837,8 @@ static inline struct sock *packet_seq_id
- struct hlist_node *node;
-
- sk_for_each(s, node, &packet_sklist) {
-+ if (!ve_accessible(VE_OWNER_SK(s), get_exec_env()))
-+ continue;
- if (!off--)
- return s;
- }
-@@ -1827,9 +1854,13 @@ static void *packet_seq_start(struct seq
- static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
- {
- ++*pos;
-- return (v == SEQ_START_TOKEN)
-- ? sk_head(&packet_sklist)
-- : sk_next((struct sock*)v) ;
-+ do {
-+ v = (v == SEQ_START_TOKEN)
-+ ? sk_head(&packet_sklist)
-+ : sk_next((struct sock*)v);
-+ } while (v != NULL &&
-+ !ve_accessible(VE_OWNER_SK((struct sock*)v), get_exec_env()));
-+ return v;
- }
-
- static void packet_seq_stop(struct seq_file *seq, void *v)
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/rose/rose_route.c linux-2.6.9-ve023stab030/net/rose/rose_route.c
---- linux-2.6.9-42.0.3.EL.orig/net/rose/rose_route.c 2004-10-19 01:55:28.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/rose/rose_route.c 2006-10-11 19:07:55.000000000 +0400
-@@ -727,7 +727,8 @@ int rose_rt_ioctl(unsigned int cmd, void
- }
- if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
- return -EINVAL;
--
-+ if (rose_route.ndigis > 8) /* No more than 8 digipeats */
-+ return -EINVAL;
- err = rose_add_node(&rose_route, dev);
- dev_put(dev);
- return err;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sched/sch_api.c linux-2.6.9-ve023stab030/net/sched/sch_api.c
---- linux-2.6.9-42.0.3.EL.orig/net/sched/sch_api.c 2006-10-11 18:29:50.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sched/sch_api.c 2006-10-11 19:07:57.000000000 +0400
-@@ -196,10 +196,14 @@ struct Qdisc *qdisc_lookup(struct net_de
- {
- struct Qdisc *q;
-
-+ read_lock_bh(&qdisc_tree_lock);
- list_for_each_entry(q, &dev->qdisc_list, list) {
-- if (q->handle == handle)
-+ if (q->handle == handle) {
-+ read_unlock_bh(&qdisc_tree_lock);
- return q;
-+ }
- }
-+ read_unlock_bh(&qdisc_tree_lock);
- return NULL;
- }
-
-@@ -1191,7 +1195,7 @@ static int __init pktsched_init(void)
-
- register_qdisc(&pfifo_qdisc_ops);
- register_qdisc(&bfifo_qdisc_ops);
-- proc_net_fops_create("psched", 0, &psched_fops);
-+ __proc_net_fops_create("net/psched", 0, &psched_fops, NULL);
-
- return 0;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sched/sch_cbq.c linux-2.6.9-ve023stab030/net/sched/sch_cbq.c
---- linux-2.6.9-42.0.3.EL.orig/net/sched/sch_cbq.c 2004-10-19 01:53:13.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sched/sch_cbq.c 2006-10-11 19:07:55.000000000 +0400
-@@ -956,8 +956,8 @@ cbq_dequeue_prio(struct Qdisc *sch, int
-
- if (cl->deficit <= 0) {
- q->active[prio] = cl;
-- cl = cl->next_alive;
- cl->deficit += cl->quantum;
-+ cl = cl->next_alive;
- }
- return skb;
-
-@@ -1133,17 +1133,19 @@ static void cbq_normalize_quanta(struct
-
- for (h=0; h<16; h++) {
- for (cl = q->classes[h]; cl; cl = cl->next) {
-+ long mtu;
- /* BUGGGG... Beware! This expression suffer of
- arithmetic overflows!
- */
- if (cl->priority == prio) {
-- cl->quantum = (cl->weight*cl->allot*q->nclasses[prio])/
-- q->quanta[prio];
-- }
-- if (cl->quantum <= 0 || cl->quantum>32*cl->qdisc->dev->mtu) {
-- printk(KERN_WARNING "CBQ: class %08x has bad quantum==%ld, repaired.\n", cl->classid, cl->quantum);
-- cl->quantum = cl->qdisc->dev->mtu/2 + 1;
-+ cl->quantum = (cl->weight * cl->allot) /
-+ (q->quanta[prio] / q->nclasses[prio]);
- }
-+ mtu = cl->qdisc->dev->mtu;
-+ if (cl->quantum <= mtu/2)
-+ cl->quantum = mtu/2 + 1;
-+ else if (cl->quantum > 32*mtu)
-+ cl->quantum = 32*mtu;
- }
- }
- }
-@@ -1749,6 +1751,8 @@ static void cbq_destroy_class(struct Qdi
- {
- struct cbq_sched_data *q = qdisc_priv(sch);
-
-+ BUG_TRAP(!cl->filters);
-+
- cbq_destroy_filters(cl);
- qdisc_destroy(cl->q);
- qdisc_put_rtab(cl->R_tab);
-@@ -1769,6 +1773,14 @@ cbq_destroy(struct Qdisc* sch)
- #ifdef CONFIG_NET_CLS_POLICE
- q->rx_class = NULL;
- #endif
-+ /*
-+ * Filters must be destroyed first because we don't destroy the
-+ * classes from root to leafs which means that filters can still
-+ * be bound to classes which have been destroyed already. --TGR '04
-+ */
-+ for (h = 0; h < 16; h++)
-+ for (cl = q->classes[h]; cl; cl = cl->next)
-+ cbq_destroy_filters(cl);
-
- for (h = 0; h < 16; h++) {
- struct cbq_class *next;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sched/sch_generic.c linux-2.6.9-ve023stab030/net/sched/sch_generic.c
---- linux-2.6.9-42.0.3.EL.orig/net/sched/sch_generic.c 2006-10-11 18:29:36.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sched/sch_generic.c 2006-10-11 19:07:57.000000000 +0400
-@@ -97,6 +97,9 @@ int qdisc_restart(struct net_device *dev
-
- /* Dequeue packet */
- if ((skb = q->dequeue(q)) != NULL) {
-+ struct ve_struct *envid;
-+
-+ envid = set_exec_env(VE_OWNER_SKB(skb));
- unsigned nolock = (dev->features & NETIF_F_LLTX);
- /*
- * When the driver has LLTX set it does its own locking
-@@ -121,6 +124,7 @@ int qdisc_restart(struct net_device *dev
- kfree_skb(skb);
- if (net_ratelimit())
- printk(KERN_DEBUG "Dead loop on netdevice %s, fix it urgently!\n", dev->name);
-+ (void)set_exec_env(envid);
- return -1;
- }
- __get_cpu_var(netdev_rx_stat).cpu_collision++;
-@@ -146,6 +150,7 @@ int qdisc_restart(struct net_device *dev
- spin_unlock(&dev->xmit_lock);
- }
- spin_lock(&dev->queue_lock);
-+ (void)set_exec_env(envid);
- return -1;
- }
- if (ret == NETDEV_TX_LOCKED && nolock) {
-@@ -177,6 +182,7 @@ int qdisc_restart(struct net_device *dev
- requeue:
- q->ops->requeue(skb, q);
- netif_schedule(dev);
-+ (void)set_exec_env(envid);
- return 1;
- }
- return q->q.qlen;
-@@ -588,3 +594,4 @@ EXPORT_SYMBOL(qdisc_reset);
- EXPORT_SYMBOL(qdisc_restart);
- EXPORT_SYMBOL(qdisc_lock_tree);
- EXPORT_SYMBOL(qdisc_unlock_tree);
-+EXPORT_SYMBOL(dev_shutdown);
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sched/sch_teql.c linux-2.6.9-ve023stab030/net/sched/sch_teql.c
---- linux-2.6.9-42.0.3.EL.orig/net/sched/sch_teql.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sched/sch_teql.c 2006-10-11 19:07:57.000000000 +0400
-@@ -187,6 +187,9 @@ static int teql_qdisc_init(struct Qdisc
- struct teql_master *m = (struct teql_master*)sch->ops;
- struct teql_sched_data *q = qdisc_priv(sch);
-
-+ if (!capable(CAP_NET_ADMIN))
-+ return -EPERM;
-+
- if (dev->hard_header_len > m->dev->hard_header_len)
- return -EINVAL;
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/socket.c linux-2.6.9-ve023stab030/net/socket.c
---- linux-2.6.9-42.0.3.EL.orig/net/socket.c 2006-10-11 18:29:51.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/socket.c 2006-10-11 19:07:57.000000000 +0400
-@@ -83,6 +83,7 @@
- #include <linux/compat.h>
- #include <linux/kmod.h>
- #include <linux/audit.h>
-+#include <linux/in.h>
-
- #ifdef CONFIG_NET_RADIO
- #include <linux/wireless.h> /* Note : will define WIRELESS_EXT */
-@@ -1086,6 +1087,37 @@ int sock_wake_async(struct socket *sock,
- return 0;
- }
-
-+int vz_security_proto_check(int family, int type, int protocol)
-+{
-+#ifdef CONFIG_VE
-+ if (ve_is_super(get_exec_env()))
-+ return 0;
-+
-+ switch (family) {
-+ case PF_UNSPEC:
-+ case PF_PACKET:
-+ case PF_NETLINK:
-+ case PF_UNIX:
-+ break;
-+ case PF_INET:
-+ switch (protocol) {
-+ case IPPROTO_IP:
-+ case IPPROTO_ICMP:
-+ case IPPROTO_TCP:
-+ case IPPROTO_UDP:
-+ case IPPROTO_RAW:
-+ break;
-+ default:
-+ return -EAFNOSUPPORT;
-+ }
-+ break;
-+ default:
-+ return -EAFNOSUPPORT;
-+ }
-+#endif
-+ return 0;
-+}
-+
- static int __sock_create(int family, int type, int protocol, struct socket **res, int kern)
- {
- int i;
-@@ -1114,6 +1146,11 @@ static int __sock_create(int family, int
- family = PF_PACKET;
- }
-
-+ /* VZ compatibility layer */
-+ err = vz_security_proto_check(family, type, protocol);
-+ if (err < 0)
-+ return err;
-+
- err = security_socket_create(family, type, protocol, kern);
- if (err)
- return err;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sunrpc/clnt.c linux-2.6.9-ve023stab030/net/sunrpc/clnt.c
---- linux-2.6.9-42.0.3.EL.orig/net/sunrpc/clnt.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sunrpc/clnt.c 2006-10-11 19:07:57.000000000 +0400
-@@ -165,10 +165,10 @@ rpc_create_client(struct rpc_xprt *xprt,
- }
-
- /* save the nodename */
-- clnt->cl_nodelen = strlen(system_utsname.nodename);
-+ clnt->cl_nodelen = strlen(ve_utsname.nodename);
- if (clnt->cl_nodelen > UNX_MAXNODENAME)
- clnt->cl_nodelen = UNX_MAXNODENAME;
-- memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen);
-+ memcpy(clnt->cl_nodename, ve_utsname.nodename, clnt->cl_nodelen);
- return clnt;
-
- out_no_auth:
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sunrpc/sched.c linux-2.6.9-ve023stab030/net/sunrpc/sched.c
---- linux-2.6.9-42.0.3.EL.orig/net/sunrpc/sched.c 2004-10-19 01:54:31.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sunrpc/sched.c 2006-10-11 19:07:55.000000000 +0400
-@@ -1127,9 +1127,9 @@ rpciod(void *ptr)
- spin_lock_bh(&rpc_queue_lock);
- }
- __rpc_schedule();
-- if (current->flags & PF_FREEZE) {
-+ if (test_thread_flag(TIF_FREEZE)) {
- spin_unlock_bh(&rpc_queue_lock);
-- refrigerator(PF_FREEZE);
-+ refrigerator();
- spin_lock_bh(&rpc_queue_lock);
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sunrpc/svcsock.c linux-2.6.9-ve023stab030/net/sunrpc/svcsock.c
---- linux-2.6.9-42.0.3.EL.orig/net/sunrpc/svcsock.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sunrpc/svcsock.c 2006-10-11 19:07:58.000000000 +0400
-@@ -362,6 +362,9 @@ svc_sendto(struct svc_rqst *rqstp, struc
- size_t base = xdr->page_base;
- unsigned int pglen = xdr->page_len;
- unsigned int flags = MSG_MORE;
-+ struct ve_struct *old_env;
-+
-+ old_env = set_exec_env(get_ve0());
-
- slen = xdr->len;
-
-@@ -426,6 +429,8 @@ out:
- rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, xdr->len, len,
- rqstp->rq_addr.sin_addr.s_addr);
-
-+ (void)set_exec_env(old_env);
-+
- return len;
- }
-
-@@ -438,9 +443,12 @@ svc_recv_available(struct svc_sock *svsk
- mm_segment_t oldfs;
- struct socket *sock = svsk->sk_sock;
- int avail, err;
-+ struct ve_struct *old_env;
-
- oldfs = get_fs(); set_fs(KERNEL_DS);
-+ old_env = set_exec_env(get_ve0());
- err = sock->ops->ioctl(sock, TIOCINQ, (unsigned long) &avail);
-+ (void)set_exec_env(old_env);
- set_fs(oldfs);
-
- return (err >= 0)? avail : err;
-@@ -455,6 +463,7 @@ svc_recvfrom(struct svc_rqst *rqstp, str
- struct msghdr msg;
- struct socket *sock;
- int len, alen;
-+ struct ve_struct *old_env;
-
- rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
- sock = rqstp->rq_sock->sk_sock;
-@@ -466,7 +475,9 @@ svc_recvfrom(struct svc_rqst *rqstp, str
-
- msg.msg_flags = MSG_DONTWAIT;
-
-+ old_env = set_exec_env(get_ve0());
- len = kernel_recvmsg(sock, &msg, iov, nr, buflen, MSG_DONTWAIT);
-+ (void)set_exec_env(get_ve0());
-
- /* sock_recvmsg doesn't fill in the name/namelen, so we must..
- * possibly we should cache this in the svc_sock structure
-@@ -770,17 +781,19 @@ svc_tcp_accept(struct svc_sock *svsk)
- struct proto_ops *ops;
- struct svc_sock *newsvsk;
- int err, slen;
-+ struct ve_struct *old_env;
-
- dprintk("svc: tcp_accept %p sock %p\n", svsk, sock);
- if (!sock)
- return;
-
-+ old_env = set_exec_env(get_ve0());
- err = sock_create_lite(PF_INET, SOCK_STREAM, IPPROTO_TCP, &newsock);
- if (err) {
- if (err == -ENOMEM)
- printk(KERN_WARNING "%s: no more sockets!\n",
- serv->sv_name);
-- return;
-+ goto restore;
- }
-
- dprintk("svc: tcp_accept %p allocated\n", newsock);
-@@ -874,6 +887,8 @@ svc_tcp_accept(struct svc_sock *svsk)
-
- }
-
-+ (void)set_exec_env(old_env);
-+
- if (serv->sv_stats)
- serv->sv_stats->nettcpconn++;
-
-@@ -881,6 +896,8 @@ svc_tcp_accept(struct svc_sock *svsk)
-
- failed:
- sock_release(newsock);
-+restore:
-+ (void)set_exec_env(old_env);
- return;
- }
-
-@@ -1227,8 +1244,8 @@ svc_recv(struct svc_serv *serv, struct s
-
- schedule_timeout(timeout);
-
-- if (current->flags & PF_FREEZE)
-- refrigerator(PF_FREEZE);
-+ if (test_thread_flag(TIF_FREEZE))
-+ refrigerator();
-
- spin_lock_bh(&serv->sv_lock);
- remove_wait_queue(&rqstp->rq_wait, &wait);
-@@ -1397,6 +1414,7 @@ svc_create_socket(struct svc_serv *serv,
- struct socket *sock;
- int error;
- int type;
-+ struct ve_struct *old_env;
-
- dprintk("svc: svc_create_socket(%s, %d, %u.%u.%u.%u:%d)\n",
- serv->sv_program->pg_name, protocol,
-@@ -1410,8 +1428,10 @@ svc_create_socket(struct svc_serv *serv,
- }
- type = (protocol == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM;
-
-+ old_env = set_exec_env(get_ve0());
-+
- if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0)
-- return error;
-+ goto restore;
-
- if (sin != NULL) {
- if (type == SOCK_STREAM)
-@@ -1427,12 +1447,16 @@ svc_create_socket(struct svc_serv *serv,
- goto bummer;
- }
-
-- if ((svsk = svc_setup_socket(serv, sock, &error, 1)) != NULL)
-+ if ((svsk = svc_setup_socket(serv, sock, &error, 1)) != NULL) {
-+ (void)set_exec_env(old_env);
- return 0;
-+ }
-
- bummer:
- dprintk("svc: svc_create_socket error = %d\n", -error);
- sock_release(sock);
-+restore:
-+ (void)set_exec_env(old_env);
- return error;
- }
-
-@@ -1450,6 +1474,8 @@ svc_delete_socket(struct svc_sock *svsk)
- serv = svsk->sk_server;
- sk = svsk->sk_sk;
-
-+ /* XXX: serialization? */
-+ sk->sk_user_data = NULL;
- sk->sk_state_change = svsk->sk_ostate;
- sk->sk_data_ready = svsk->sk_odata;
- sk->sk_write_space = svsk->sk_owspace;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/sunrpc/xprt.c linux-2.6.9-ve023stab030/net/sunrpc/xprt.c
---- linux-2.6.9-42.0.3.EL.orig/net/sunrpc/xprt.c 2006-10-11 18:29:35.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/sunrpc/xprt.c 2006-10-11 19:07:57.000000000 +0400
-@@ -246,6 +246,7 @@ xprt_sendmsg(struct rpc_xprt *xprt, stru
- int addrlen = 0;
- unsigned int skip;
- int result;
-+ struct ve_struct *old_env;
-
- if (!sock)
- return -ENOTCONN;
-@@ -263,7 +264,9 @@ xprt_sendmsg(struct rpc_xprt *xprt, stru
- skip = req->rq_bytes_sent;
-
- clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
-+ old_env = set_exec_env(get_ve0());
- result = xdr_sendpages(sock, addr, addrlen, xdr, skip, MSG_DONTWAIT);
-+ (void)set_exec_env(old_env);
-
- dprintk("RPC: xprt_sendmsg(%d) = %d\n", xdr->len - skip, result);
-
-@@ -484,6 +487,7 @@ static void xprt_socket_connect(void *ar
- struct rpc_xprt *xprt = (struct rpc_xprt *)args;
- struct socket *sock = xprt->sock;
- int status = -EIO;
-+ struct ve_struct *old_env;
-
- if (xprt->shutdown || xprt->addr.sin_port == 0)
- goto out;
-@@ -508,8 +512,10 @@ static void xprt_socket_connect(void *ar
- /*
- * Tell the socket layer to start connecting...
- */
-+ old_env = set_exec_env(get_ve0());
- status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr,
- sizeof(xprt->addr), O_NONBLOCK);
-+ (void)set_exec_env(old_env);
- dprintk("RPC: %p connect status %d connected %d sock state %d\n",
- xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
- if (status < 0) {
-@@ -1529,13 +1535,16 @@ static inline int xprt_bindresvport(stru
- .sin_family = AF_INET,
- };
- int err, port;
-+ struct ve_struct *old_env;
-
- /* Were we already bound to a given port? Try to reuse it */
- port = xprt->port;
- do {
- myaddr.sin_port = htons(port);
-+ old_env = set_exec_env(get_ve0());
- err = sock->ops->bind(sock, (struct sockaddr *) &myaddr,
- sizeof(myaddr));
-+ (void)set_exec_env(old_env);
- if (err == 0) {
- xprt->port = port;
- return 0;
-@@ -1611,15 +1620,18 @@ static struct socket * xprt_create_socke
- {
- struct socket *sock;
- int type, err;
-+ struct ve_struct *old_env;
-
- dprintk("RPC: xprt_create_socket(%s %d)\n",
- (proto == IPPROTO_UDP)? "udp" : "tcp", proto);
-
- type = (proto == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM;
-
-+ old_env = set_exec_env(get_ve0());
-+
- if ((err = sock_create_kern(PF_INET, type, proto, &sock)) < 0) {
- printk("RPC: can't create socket (%d).\n", -err);
-- return NULL;
-+ goto out;
- }
-
- /* If the caller has the capability, bind to a reserved port */
-@@ -1628,10 +1640,13 @@ static struct socket * xprt_create_socke
- goto failed;
- }
-
-+ (void)set_exec_env(old_env);
- return sock;
-
- failed:
- sock_release(sock);
-+out:
-+ (void)set_exec_env(old_env);
- return NULL;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/tux/directory.c linux-2.6.9-ve023stab030/net/tux/directory.c
---- linux-2.6.9-42.0.3.EL.orig/net/tux/directory.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/tux/directory.c 2006-10-11 19:07:57.000000000 +0400
-@@ -162,11 +162,11 @@ static void do_dir_line (tux_req_t *req,
- if (!(mode & tux_mode_allowed))
- goto out_dput;
-
-- err = permission(inode, MAY_READ, NULL);
-+ err = permission(inode, MAY_READ, NULL, NULL);
- if (err)
- goto out_dput;
- if (dirp->d_type == DT_DIR) {
-- err = permission(inode, MAY_EXEC, NULL);
-+ err = permission(inode, MAY_EXEC, NULL, NULL);
- if (err)
- goto out_dput;
- }
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/tux/input.c linux-2.6.9-ve023stab030/net/tux/input.c
---- linux-2.6.9-42.0.3.EL.orig/net/tux/input.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/tux/input.c 2006-10-11 19:07:57.000000000 +0400
-@@ -106,7 +106,7 @@ int tux_permission (struct inode *inode)
- */
- if (!(mode & tux_mode_allowed))
- return -3;
-- err = permission(inode,MAY_READ,NULL);
-+ err = permission(inode,MAY_READ,NULL,NULL);
- return err;
- }
-
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/tux/proto_ftp.c linux-2.6.9-ve023stab030/net/tux/proto_ftp.c
---- linux-2.6.9-42.0.3.EL.orig/net/tux/proto_ftp.c 2006-10-11 18:29:30.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/tux/proto_ftp.c 2006-10-11 19:07:57.000000000 +0400
-@@ -761,7 +761,7 @@ void ftp_get_mdtm (tux_req_t *req, int c
- }
- goto out_err;
- }
-- err = permission(dentry->d_inode, MAY_READ, NULL);
-+ err = permission(dentry->d_inode, MAY_READ, NULL, NULL);
- if (err)
- goto out_err_put;
-
-@@ -872,7 +872,7 @@ static void ftp_chdir (tux_req_t *req, i
- }
- goto out_err;
- }
-- err = permission(dentry->d_inode, MAY_EXEC, NULL);
-+ err = permission(dentry->d_inode, MAY_EXEC, NULL, NULL);
- if (err)
- goto out_err_put;
- req->cwd_dentry = dentry;
-@@ -1122,7 +1122,7 @@ static void ftp_lookup_listfile (tux_req
- }
-
- if (S_ISDIR(dentry->d_inode->i_mode)) {
-- err = permission(dentry->d_inode, MAY_EXEC, NULL);
-+ err = permission(dentry->d_inode, MAY_EXEC, NULL, NULL);
- if (err) {
- Dprintk("Directory permission error: %d.\n", err);
- goto out_err_put;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/net/unix/af_unix.c linux-2.6.9-ve023stab030/net/unix/af_unix.c
---- linux-2.6.9-42.0.3.EL.orig/net/unix/af_unix.c 2006-10-11 18:29:22.000000000 +0400
-+++ linux-2.6.9-ve023stab030/net/unix/af_unix.c 2006-10-11 19:08:00.000000000 +0400
-@@ -119,6 +119,9 @@
- #include <net/checksum.h>
- #include <linux/security.h>
-
-+#include <ub/ub_net.h>
-+#include <ub/beancounter.h>
-+
- int sysctl_unix_max_dgram_qlen = 10;
-
- kmem_cache_t *unix_sk_cachep;
-@@ -242,6 +245,8 @@ static struct sock *__unix_find_socket_b
- sk_for_each(s, node, &unix_socket_table[hash ^ type]) {
- struct unix_sock *u = unix_sk(s);
-
-+ if (!ve_accessible(VE_OWNER_SK(s), get_exec_env()))
-+ continue;
- if (u->addr->len == len &&
- !memcmp(u->addr->name, sunname, len))
- goto found;
-@@ -446,7 +451,7 @@ static int unix_listen(struct socket *so
- sk->sk_max_ack_backlog = backlog;
- sk->sk_state = TCP_LISTEN;
- /* set credentials so connect can copy them */
-- sk->sk_peercred.pid = current->tgid;
-+ sk->sk_peercred.pid = virt_tgid(current);
- sk->sk_peercred.uid = current->euid;
- sk->sk_peercred.gid = current->egid;
- err = 0;
-@@ -555,6 +560,8 @@ static struct sock * unix_create1(struct
- unix_sk_cachep);
- if (!sk)
- goto out;
-+ if (ub_other_sock_charge(sk))
-+ goto out_sk_free;
-
- atomic_inc(&unix_nr_socks);
-
-@@ -574,6 +581,9 @@ static struct sock * unix_create1(struct
- unix_insert_socket(unix_sockets_unbound, sk);
- out:
- return sk;
-+out_sk_free:
-+ sk_free(sk);
-+ return NULL;
- }
-
- static int unix_create(struct socket *sock, int protocol)
-@@ -679,7 +689,7 @@ static struct sock *unix_find_other(stru
- err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
- if (err)
- goto fail;
-- err = permission(nd.dentry->d_inode,MAY_WRITE, &nd);
-+ err = permission(nd.dentry->d_inode, MAY_WRITE, &nd, NULL);
- if (err)
- goto put_fail;
-
-@@ -957,6 +967,7 @@ static int unix_stream_connect(struct so
- int st;
- int err;
- long timeo;
-+ unsigned long chargesize;
-
- err = unix_mkname(sunaddr, addr_len, &hash);
- if (err < 0)
-@@ -984,6 +995,10 @@ static int unix_stream_connect(struct so
- skb = sock_wmalloc(newsk, 1, 0, GFP_KERNEL);
- if (skb == NULL)
- goto out;
-+ chargesize = skb_charge_fullsize(skb);
-+ if (ub_sock_getwres_other(newsk, chargesize) < 0)
-+ goto out;
-+ ub_skb_set_charge(skb, newsk, chargesize, UB_OTHERSOCKBUF);
-
- restart:
- /* Find listening sock. */
-@@ -1067,7 +1082,7 @@ restart:
- unix_peer(newsk) = sk;
- newsk->sk_state = TCP_ESTABLISHED;
- newsk->sk_type = sk->sk_type;
-- newsk->sk_peercred.pid = current->tgid;
-+ newsk->sk_peercred.pid = virt_tgid(current);
- newsk->sk_peercred.uid = current->euid;
- newsk->sk_peercred.gid = current->egid;
- newu = unix_sk(newsk);
-@@ -1129,7 +1144,7 @@ static int unix_socketpair(struct socket
- sock_hold(skb);
- unix_peer(ska)=skb;
- unix_peer(skb)=ska;
-- ska->sk_peercred.pid = skb->sk_peercred.pid = current->tgid;
-+ ska->sk_peercred.pid = skb->sk_peercred.pid = virt_tgid(current);
- ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid;
- ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid;
-
-@@ -1233,7 +1248,7 @@ static void unix_detach_fds(struct scm_c
- unix_notinflight(scm->fp->fp[i]);
- }
-
--static void unix_destruct_fds(struct sk_buff *skb)
-+void unix_destruct_fds(struct sk_buff *skb)
- {
- struct scm_cookie scm;
- memset(&scm, 0, sizeof(scm));
-@@ -1244,6 +1259,7 @@ static void unix_destruct_fds(struct sk_
- scm_destroy(&scm);
- sock_wfree(skb);
- }
-+EXPORT_SYMBOL_GPL(unix_destruct_fds);
-
- static void unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
- {
-@@ -1454,6 +1470,16 @@ static int unix_stream_sendmsg(struct ki
-
- size=len-sent;
-
-+ if (msg->msg_flags & MSG_DONTWAIT)
-+ ub_sock_makewres_other(sk, skb_charge_size(size));
-+ if (sock_bc(sk) != NULL &&
-+ sock_bc(sk)->poll_reserv >=
-+ SOCK_MIN_UBCSPACE &&
-+ skb_charge_size(size) >
-+ sock_bc(sk)->poll_reserv)
-+ size = skb_charge_datalen(sock_bc(sk)->poll_reserv);
-+
-+
- /* Keep two messages in the pipe so it schedules better */
- if (size > sk->sk_sndbuf / 2 - 64)
- size = sk->sk_sndbuf / 2 - 64;
-@@ -1465,7 +1491,8 @@ static int unix_stream_sendmsg(struct ki
- * Grab a buffer
- */
-
-- skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err);
-+ skb = sock_alloc_send_skb2(sk, size, SOCK_MIN_UBCSPACE,
-+ msg->msg_flags&MSG_DONTWAIT, &err);
-
- if (skb==NULL)
- goto out_err;
-@@ -1886,6 +1913,7 @@ static unsigned int unix_poll(struct fil
- {
- struct sock *sk = sock->sk;
- unsigned int mask;
-+ int no_ub_res;
-
- poll_wait(file, sk->sk_sleep, wait);
- mask = 0;
-@@ -1896,6 +1924,10 @@ static unsigned int unix_poll(struct fil
- if (sk->sk_shutdown == SHUTDOWN_MASK)
- mask |= POLLHUP;
-
-+ no_ub_res = ub_sock_makewres_other(sk, SOCK_MIN_UBCSPACE_CH);
-+ if (no_ub_res)
-+ ub_sock_sndqueueadd_other(sk, SOCK_MIN_UBCSPACE_CH);
-+
- /* readable? */
- if (!skb_queue_empty(&sk->sk_receive_queue) ||
- (sk->sk_shutdown & RCV_SHUTDOWN))
-@@ -1909,7 +1941,7 @@ static unsigned int unix_poll(struct fil
- * we set writable also when the other side has shut down the
- * connection. This prevents stuck sockets.
- */
-- if (unix_writable(sk))
-+ if (!no_ub_res && unix_writable(sk))
- mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
-
- return mask;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/scripts/kconfig/mconf.c linux-2.6.9-ve023stab030/scripts/kconfig/mconf.c
---- linux-2.6.9-42.0.3.EL.orig/scripts/kconfig/mconf.c 2004-10-19 01:53:43.000000000 +0400
-+++ linux-2.6.9-ve023stab030/scripts/kconfig/mconf.c 2006-10-11 19:07:55.000000000 +0400
-@@ -89,7 +89,7 @@ static char *args[1024], **argptr = args
- static int indent;
- static struct termios ios_org;
- static int rows = 0, cols = 0;
--static struct menu *current_menu;
-+struct menu *current_menu;
- static int child_count;
- static int do_resize;
- static int single_menu_mode;
-diff -uprN linux-2.6.9-42.0.3.EL.orig/security/commoncap.c linux-2.6.9-ve023stab030/security/commoncap.c
---- linux-2.6.9-42.0.3.EL.orig/security/commoncap.c 2006-10-11 18:29:42.000000000 +0400
-+++ linux-2.6.9-ve023stab030/security/commoncap.c 2006-10-11 19:08:00.000000000 +0400
-@@ -17,6 +17,7 @@
- #include <linux/mman.h>
- #include <linux/pagemap.h>
- #include <linux/swap.h>
-+#include <linux/virtinfo.h>
- #include <linux/smp_lock.h>
- #include <linux/skbuff.h>
- #include <linux/netlink.h>
-@@ -174,7 +175,7 @@ int cap_inode_setxattr(struct dentry *de
- {
- if (!strncmp(name, XATTR_SECURITY_PREFIX,
- sizeof(XATTR_SECURITY_PREFIX) - 1) &&
-- !capable(CAP_SYS_ADMIN))
-+ !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_ADMIN))
- return -EPERM;
- return 0;
- }
-@@ -183,7 +184,7 @@ int cap_inode_removexattr(struct dentry
- {
- if (!strncmp(name, XATTR_SECURITY_PREFIX,
- sizeof(XATTR_SECURITY_PREFIX) - 1) &&
-- !capable(CAP_SYS_ADMIN))
-+ !capable(CAP_SYS_ADMIN) && !capable(CAP_VE_ADMIN))
- return -EPERM;
- return 0;
- }
-@@ -289,7 +290,7 @@ void cap_task_reparent_to_init (struct t
-
- int cap_syslog (int type)
- {
-- if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
-+ if ((type != 3 && type != 10) && !capable(CAP_VE_SYS_ADMIN))
- return -EPERM;
- return 0;
- }
-@@ -311,6 +312,18 @@ int cap_vm_enough_memory(long pages)
-
- vm_acct_memory(pages);
-
-+#ifdef CONFIG_USER_RESOURCE
-+ switch (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_ENOUGHMEM,
-+ (void *)pages)
-+ & (NOTIFY_OK | NOTIFY_FAIL)) {
-+ case NOTIFY_OK:
-+ return 0;
-+ case NOTIFY_FAIL:
-+ vm_unacct_memory(pages);
-+ return -ENOMEM;
-+ }
-+#endif
-+
- /*
- * Sometimes we want to use more memory than we have
- */
-diff -upr linux-2.6.9.orig/arch/i386/Kconfig linux-2.6.9-023test001/arch/i386/Kconfig
---- linux-2.6.9.orig/arch/i386/Kconfig 2006-06-07 16:33:26.000000000 +0400
-+++ linux-2.6.9-023test001/arch/i386/Kconfig 2006-06-07 16:53:22.000000000 +0400
-@@ -495,8 +495,9 @@ config HPET_TIMER
- Choose N to continue using the legacy 8254 timer.
-
- config HPET_EMULATE_RTC
-- bool "Provide RTC interrupt"
-+ bool
- depends on HPET_TIMER && RTC=y
-+ default y
-
- config SMP
- bool "Symmetric multi-processing support"
-@@ -541,6 +542,28 @@ config NR_CPUS
- This is purely to save memory - each supported CPU adds
- approximately eight kilobytes to the kernel image.
-
-+config FAIRSCHED
-+ bool "Fair CPU scheduler (EXPERIMENTAL)"
-+ default y
-+ help
-+ Config option for Fair CPU scheduler (fairsched).
-+ This option allows to group processes to scheduling nodes
-+ which receive CPU proportional to their weight.
-+ This is very important feature for process groups isolation and
-+ QoS management.
-+
-+ If unsure, say N.
-+
-+config SCHED_VCPU
-+ bool "VCPU scheduler support"
-+ depends on SMP || FAIRSCHED
-+ default FAIRSCHED
-+ help
-+ VCPU scheduler support adds additional layer of abstraction
-+ which allows to virtualize cpu notion and split physical cpus
-+ and virtual cpus. This support allows to use CPU fair scheduler,
-+ dynamically add/remove cpus to/from VPS and so on.
-+
- config SCHED_SMT
- bool "SMT (Hyperthreading) scheduler support"
- depends on SMP
-@@ -1257,12 +1284,18 @@ source "arch/i386/oprofile/Kconfig"
-
- source "arch/i386/Kconfig.debug"
-
-+menu "OpenVZ"
-+source "kernel/Kconfig.openvz"
-+endmenu
-+
- source "security/Kconfig"
-
- source "crypto/Kconfig"
-
- source "lib/Kconfig"
-
-+source "kernel/ub/Kconfig"
-+
- config X86_SMP
- bool
- depends on SMP && !X86_VOYAGER
-diff -upr linux-2.6.9.orig/arch/ia64/Kconfig linux-2.6.9-023test001/arch/ia64/Kconfig
---- linux-2.6.9.orig/arch/ia64/Kconfig 2006-06-07 16:33:26.000000000 +0400
-+++ linux-2.6.9-023test001/arch/ia64/Kconfig 2006-06-07 16:53:22.000000000 +0400
-@@ -268,6 +268,28 @@ config PREEMPT
- Say Y here if you are building a kernel for a desktop, embedded
- or real-time system. Say N if you are unsure.
-
-+config FAIRSCHED
-+ bool "Fair CPU scheduler (EXPERIMENTAL)"
-+ default y
-+ help
-+ Config option for Fair CPU scheduler (fairsched).
-+ This option allows to group processes to scheduling nodes
-+ which receive CPU proportional to their weight.
-+ This is very important feature for process groups isolation and
-+ QoS management.
-+
-+ If unsure, say N.
-+
-+config SCHED_VCPU
-+ bool "VCPU scheduler support"
-+ depends on SMP || FAIRSCHED
-+ default FAIRSCHED
-+ help
-+ VCPU scheduler support adds additional layer of abstraction
-+ which allows to virtualize cpu notion and split physical cpus
-+ and virtual cpus. This support allows to use CPU fair scheduler,
-+ dynamically add/remove cpus to/from VPS and so on.
-+
- config HAVE_DEC_LOCK
- bool
- depends on (SMP || PREEMPT)
-@@ -394,6 +420,12 @@ source "arch/ia64/oprofile/Kconfig"
-
- source "arch/ia64/Kconfig.debug"
-
-+menu "OpenVZ"
-+source "kernel/Kconfig.openvz"
-+endmenu
-+
- source "security/Kconfig"
-
- source "crypto/Kconfig"
-+
-+source "kernel/ub/Kconfig"
-diff -upr linux-2.6.9.orig/arch/x86_64/Kconfig linux-2.6.9-023test001/arch/x86_64/Kconfig
---- linux-2.6.9.orig/arch/x86_64/Kconfig 2006-06-07 16:33:26.000000000 +0400
-+++ linux-2.6.9-023test001/arch/x86_64/Kconfig 2006-06-07 16:53:22.000000000 +0400
-@@ -258,6 +258,28 @@ config PREEMPT
- Say Y here if you are feeling brave and building a kernel for a
- desktop, embedded or real-time system. Say N if you are unsure.
-
-+config FAIRSCHED
-+ bool "Fair CPU scheduler (EXPERIMENTAL)"
-+ default y
-+ help
-+ Config option for Fair CPU scheduler (fairsched).
-+ This option allows to group processes to scheduling nodes
-+ which receive CPU proportional to their weight.
-+ This is very important feature for process groups isolation and
-+ QoS management.
-+
-+ If unsure, say N.
-+
-+config SCHED_VCPU
-+ bool "VCPU scheduler support"
-+ depends on SMP || FAIRSCHED
-+ default FAIRSCHED
-+ help
-+ VCPU scheduler support adds additional layer of abstraction
-+ which allows to virtualize cpu notion and split physical cpus
-+ and virtual cpus. This support allows to use CPU fair scheduler,
-+ dynamically add/remove cpus to/from VPS and so on.
-+
- config SCHED_SMT
- bool "SMT (Hyperthreading) scheduler support"
- depends on SMP
-@@ -432,8 +458,14 @@ source "arch/x86_64/oprofile/Kconfig"
-
- source "arch/x86_64/Kconfig.debug"
-
-+menu "OpenVZ"
-+source "kernel/Kconfig.openvz"
-+endmenu
-+
- source "security/Kconfig"
-
- source "crypto/Kconfig"
-
- source "lib/Kconfig"
-+
-+source "kernel/ub/Kconfig"
-diff -upr linux-2.6.9.orig/fs/Kconfig linux-2.6.9-023test001/fs/Kconfig
---- linux-2.6.9.orig/fs/Kconfig 2006-06-07 16:33:26.000000000 +0400
-+++ linux-2.6.9-023test001/fs/Kconfig 2006-06-07 16:53:22.000000000 +0400
-@@ -417,6 +417,15 @@ config QUOTA
- with the quota tools. Probably the quota support is only useful for
- multi user systems. If unsure, say N.
-
-+config QUOTA_COMPAT
-+ bool "Compatibility with older quotactl interface"
-+ depends on QUOTA
-+ help
-+ This option enables compatibility layer for older version
-+ of quotactl interface with byte granularity (QUOTAON at 0x0100,
-+ GETQUOTA at 0x0D00). Interface versions older than that one and
-+ with block granularity are still not supported.
-+
- config QFMT_V1
- tristate "Old quota format support"
- depends on QUOTA
-@@ -433,6 +442,38 @@ config QFMT_V2
- need this functionality say Y here. Note that you will need recent
- quota utilities (>= 3.01) for new quota format with this kernel.
-
-+config SIM_FS
-+ tristate "VPS filesystem"
-+ depends on VZ_QUOTA
-+ default m
-+ help
-+ This file system is a part of Virtuozzo. It intoduces a fake
-+ superblock and blockdev to VE to hide real device and show
-+ statfs results taken from quota.
-+
-+config VZ_QUOTA
-+ tristate "Virtuozzo Disk Quota support"
-+ depends on QUOTA
-+ default m
-+ help
-+ Virtuozzo Disk Quota imposes disk quota on directories with their
-+ files and subdirectories in total. Such disk quota is used to
-+ account and limit disk usage by Virtuozzo VPS, but also may be used
-+ separately.
-+
-+config VZ_QUOTA_UNLOAD
-+ bool "Unloadable Virtuozzo Disk Quota module"
-+ depends on VZ_QUOTA=m
-+ default n
-+ help
-+ Make Virtuozzo Disk Quota module unloadable.
-+ Doesn't work reliably now.
-+
-+config VZ_QUOTA_UGID
-+ bool "Per-user and per-group quota in Virtuozzo quota partitions"
-+ depends on VZ_QUOTA!=n
-+ default y
-+
- config QUOTACTL
- bool
- depends on XFS_QUOTA || QUOTA
-diff -upr linux-2.6.9.orig/fs/Makefile linux-2.6.9-023test001/fs/Makefile
---- linux-2.6.9.orig/fs/Makefile 2006-05-15 14:17:42.000000000 +0400
-+++ linux-2.6.9-023test001/fs/Makefile 2006-06-07 16:53:22.000000000 +0400
-@@ -37,6 +37,12 @@ obj-$(CONFIG_QUOTA) += dquot.o
- obj-$(CONFIG_QFMT_V1) += quota_v1.o
- obj-$(CONFIG_QFMT_V2) += quota_v2.o
- obj-$(CONFIG_QUOTACTL) += quota.o
-+obj-$(CONFIG_VZ_QUOTA) += vzdquota.o
-+vzdquota-y += vzdquot.o vzdq_mgmt.o vzdq_ops.o vzdq_tree.o
-+vzdquota-$(CONFIG_VZ_QUOTA_UGID) += vzdq_ugid.o
-+vzdquota-$(CONFIG_VZ_QUOTA_UGID) += vzdq_file.o
-+
-+obj-$(CONFIG_SIM_FS) += simfs.o
-
- obj-$(CONFIG_PROC_FS) += proc/
- obj-y += partitions/
-diff -upr linux-2.6.9.orig/kernel/Makefile linux-2.6.9-023test001/kernel/Makefile
---- linux-2.6.9.orig/kernel/Makefile 2006-06-07 16:33:27.000000000 +0400
-+++ linux-2.6.9-023test001/kernel/Makefile 2006-06-07 16:53:22.000000000 +0400
-@@ -2,13 +2,23 @@
- # Makefile for the linux kernel.
- #
-
--obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
-+obj-y = sched.o fairsched.o \
-+ fork.o exec_domain.o panic.o printk.o profile.o \
- exit.o itimer.o time.o softirq.o resource.o \
- sysctl.o capability.o ptrace.o timer.o user.o \
- signal.o sys.o kmod.o workqueue.o pid.o \
- rcupdate.o intermodule.o extable.o params.o posix-timers.o \
- kthread.o dump.o
-
-+obj-$(CONFIG_VE) += ve.o
-+obj-y += ub/
-+obj-y += veowner.o
-+obj-$(CONFIG_VE_CALLS) += vzdev.o
-+obj-$(CONFIG_VZ_WDOG) += vzwdog.o
-+obj-$(CONFIG_VZ_CHECKPOINT) += cpt/
-+obj-$(CONFIG_VE_CALLS) += vzmon.o
-+vzmon-objs = vecalls.o
-+
- obj-$(CONFIG_FUTEX) += futex.o
- obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
- obj-$(CONFIG_SMP) += cpu.o spinlock.o
-diff -upr linux-2.6.9.orig/drivers/net/Makefile linux-2.6.9-023test001/drivers/net/Makefile
---- linux-2.6.9.orig/drivers/net/Makefile 2006-05-15 14:17:45.000000000 +0400
-+++ linux-2.6.9-023test001/drivers/net/Makefile 2006-06-07 16:53:22.000000000 +0400
-@@ -14,6 +14,12 @@ obj-$(CONFIG_GIANFAR) += gianfar_driver.
-
- gianfar_driver-objs := gianfar.o gianfar_ethtool.o gianfar_phy.o
-
-+obj-$(CONFIG_VE_NETDEV) += vznetdev.o
-+vznetdev-objs := open_vznet.o venet_core.o
-+
-+obj-$(CONFIG_VE_ETHDEV) += vzethdev.o
-+vzethdev-objs := veth.o
-+
- #
- # link order important here
- #
diff --git a/openvz-sources/023.030/5123_linux-2.6.8.1-drbd-0.7.19.patch b/openvz-sources/023.030/5123_linux-2.6.8.1-drbd-0.7.19.patch
deleted file mode 100644
index 88d5a38..0000000
--- a/openvz-sources/023.030/5123_linux-2.6.8.1-drbd-0.7.19.patch
+++ /dev/null
@@ -1,13391 +0,0 @@
---- ./drivers/block/Kconfig.drbd 2006-03-31 21:06:51.000000000 +0400
-+++ ./drivers/block/Kconfig 2006-03-31 21:07:01.000000000 +0400
-@@ -356,4 +356,6 @@ config ATA_OVER_ETH
-
- source "drivers/s390/block/Kconfig"
-
-+source "drivers/block/drbd/Kconfig"
-+
- endmenu
---- ./drivers/block/Makefile.drbd 2006-03-31 21:06:51.000000000 +0400
-+++ ./drivers/block/Makefile 2006-03-31 21:07:01.000000000 +0400
-@@ -36,6 +36,7 @@ obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o
- obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o
- obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o
- obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o
-+obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
-
- obj-$(CONFIG_BLK_DEV_UMEM) += umem.o
- obj-$(CONFIG_BLK_DEV_NBD) += nbd.o
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/Kconfig 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,34 @@
-+#
-+# DRBD device driver configuration
-+#
-+config BLK_DEV_DRBD
-+ tristate "DRBD Distributed replicated block device support"
-+ select INET
-+ select PROC_FS
-+ ---help---
-+ Drbd is a block device which is designed to build high availability
-+ clusters. This is done by mirroring a whole block device via (a
-+ dedicated) network. You could see it as a network RAID 1.
-+
-+ Each device (drbd provides more than one of these devices) has a
-+ state, which can be 'primary' or 'secondary'. On the node with the
-+ primary device the application is supposed to run and to access the
-+ device (/dev/drbdX). Every write is sent to the local 'lower level
-+ block device' and via network to the node with the device in
-+ 'secondary' state.
-+ The secondary device simply writes the data to its lower level block
-+ device. Reads are always carried out locally.
-+
-+ Drbd management is done through user-space tools.
-+
-+ Historically DRBD hijacked the NBD major number (43)
-+ and device nodes (/dev/nbX).
-+ We now have an officially assigned major number (147)
-+ and /dev/drbdX.
-+
-+ If for whatever weird reason you want to keep the old behaviour,
-+ you can give a "use_nbd_major" module parameter.
-+
-+ http://www.drbd.org/
-+
-+ If unsure, say N.
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/Makefile 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,7 @@
-+CFLAGS_drbd_sizeof_sanity_check.o = # -Wpadded # -Werror
-+
-+drbd-objs := drbd_sizeof_sanity_check.o \
-+ drbd_buildtag.o drbd_bitmap.o drbd_fs.o drbd_proc.o \
-+ drbd_worker.o drbd_receiver.o drbd_req.o drbd_actlog.o \
-+ lru_cache.o drbd_main.o
-+obj-$(CONFIG_BLK_DEV_DRBD) += drbd.o
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_actlog.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,991 @@
-+/*
-+-*- linux-c -*-
-+ drbd_actlog.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-+ authors.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/slab.h>
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+/* This is what I like so much about the linux kernel:
-+ * if you have a close look, you can almost always reuse code by someone else
-+ * ;)
-+ * this is mostly from drivers/md/md.c
-+ */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+STATIC int _drbd_md_sync_page_io(drbd_dev *mdev, struct page *page,
-+ sector_t sector, int rw, int size)
-+{
-+ struct buffer_head bh;
-+ struct completion event;
-+ int ok;
-+
-+ init_completion(&event);
-+ init_buffer(&bh, drbd_md_io_complete, &event);
-+ bh.b_rdev = mdev->md_bdev;
-+ bh.b_rsector = sector;
-+ bh.b_state = (1 << BH_Req) | (1 << BH_Mapped) | (1 << BH_Lock);
-+ bh.b_size = size;
-+ bh.b_page = page;
-+ bh.b_reqnext = NULL;
-+ bh.b_data = page_address(page);
-+ generic_make_request(rw, &bh);
-+
-+ run_task_queue(&tq_disk);
-+ wait_for_completion(&event);
-+
-+ ok = test_bit(BH_Uptodate, &bh.b_state);
-+
-+ return ok;
-+}
-+#else
-+STATIC int _drbd_md_sync_page_io(drbd_dev *mdev, struct page *page,
-+ sector_t sector, int rw, int size)
-+{
-+ struct bio *bio = bio_alloc(GFP_NOIO, 1);
-+ struct completion event;
-+ int ok;
-+
-+ bio->bi_bdev = mdev->md_bdev;
-+ bio->bi_sector = sector;
-+ bio_add_page(bio, page, size, 0);
-+ init_completion(&event);
-+ bio->bi_private = &event;
-+ bio->bi_end_io = drbd_md_io_complete;
-+
-+#ifdef BIO_RW_SYNC
-+ submit_bio(rw | (1 << BIO_RW_SYNC), bio);
-+#else
-+ submit_bio(rw, bio);
-+ drbd_blk_run_queue(bdev_get_queue(mdev->md_bdev));
-+#endif
-+ wait_for_completion(&event);
-+
-+ ok = test_bit(BIO_UPTODATE, &bio->bi_flags);
-+ bio_put(bio);
-+ return ok;
-+}
-+#endif
-+
-+int drbd_md_sync_page_io(drbd_dev *mdev, sector_t sector, int rw)
-+{
-+ int hardsect,mask,ok,offset=0;
-+ const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
-+ struct page *iop = mdev->md_io_page;
-+
-+ D_ASSERT(semaphore_is_locked(&mdev->md_io_mutex));
-+
-+ if (!mdev->md_bdev) {
-+ if (test_bit(DISKLESS,&mdev->flags)) return 0;
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ ERR("mdev->md_bdev==NULL\n");
-+ dump_stack();
-+ }
-+ return 0;
-+ }
-+
-+
-+ hardsect = drbd_get_hardsect(mdev->md_bdev);
-+
-+ // in case hardsect != 512 [ s390 only? ]
-+ if( hardsect != MD_HARDSECT ) {
-+ if(!mdev->md_io_tmpp) {
-+ struct page *page = alloc_page(GFP_NOIO);
-+ if(!page) return 0;
-+
-+ WARN("Meta data's bdev hardsect_size != %d\n",
-+ MD_HARDSECT);
-+ WARN("Workaround engaged (has performace impact).\n");
-+
-+ mdev->md_io_tmpp = page;
-+ }
-+
-+ mask = ( hardsect / MD_HARDSECT ) - 1;
-+ D_ASSERT( mask == 1 || mask == 3 || mask == 7 );
-+ D_ASSERT( hardsect == (mask+1) * MD_HARDSECT );
-+ offset = sector & mask;
-+ sector = sector & ~mask;
-+ iop = mdev->md_io_tmpp;
-+
-+ if (rw == WRITE) {
-+ void *p = page_address(mdev->md_io_page);
-+ void *hp = page_address(mdev->md_io_tmpp);
-+
-+ ok = _drbd_md_sync_page_io(mdev,iop,
-+ sector,READ,hardsect);
-+
-+ if (unlikely(!ok)) return 0;
-+
-+ memcpy(hp + offset*MD_HARDSECT , p, MD_HARDSECT);
-+ }
-+ }
-+
-+#if DUMP_MD >= 3
-+ INFO("%s [%d]:%s(,%llu,%s)\n",
-+ current->comm, current->pid, __func__,
-+ (unsigned long long)sector, rw ? "WRITE" : "READ");
-+#endif
-+
-+ if (sector < drbd_md_ss(mdev) ||
-+ sector > drbd_md_ss(mdev)+MD_BM_OFFSET+BM_SECT_TO_EXT(capacity)) {
-+ ALERT("%s [%d]:%s(,%llu,%s) out of range md access!\n",
-+ current->comm, current->pid, __func__,
-+ (unsigned long long)sector, rw ? "WRITE" : "READ");
-+ }
-+
-+ ok = _drbd_md_sync_page_io(mdev,iop,sector,rw,hardsect);
-+ if (unlikely(!ok)) {
-+ ERR("drbd_md_sync_page_io(,%llu,%s) failed!\n",
-+ (unsigned long long)sector,rw ? "WRITE" : "READ");
-+ }
-+
-+ if( hardsect != MD_HARDSECT && rw == READ ) {
-+ void *p = page_address(mdev->md_io_page);
-+ void *hp = page_address(mdev->md_io_tmpp);
-+
-+ memcpy(p, hp + offset*MD_HARDSECT, MD_HARDSECT);
-+ }
-+
-+ return ok;
-+}
-+
-+
-+struct __attribute__((packed)) al_transaction {
-+ u32 magic;
-+ u32 tr_number;
-+ // u32 tr_generation; //TODO
-+ struct __attribute__((packed)) {
-+ u32 pos;
-+ u32 extent; } updates[1 + AL_EXTENTS_PT];
-+ u32 xor_sum;
-+ // I do not believe that all storage medias can guarantee atomic
-+ // 512 byte write operations. When the journal is read, only
-+ // transactions with correct xor_sums are considered.
-+}; // sizeof() = 512 byte
-+
-+
-+struct update_odbm_work {
-+ struct drbd_work w;
-+ unsigned int enr;
-+};
-+
-+struct update_al_work {
-+ struct drbd_work w;
-+ struct lc_element * al_ext;
-+ struct completion event;
-+ unsigned int enr;
-+};
-+
-+STATIC int w_al_write_transaction(struct Drbd_Conf *, struct drbd_work *, int);
-+
-+static inline
-+struct lc_element* _al_get(struct Drbd_Conf *mdev, unsigned int enr)
-+{
-+ struct lc_element *al_ext;
-+ struct bm_extent *bm_ext;
-+ unsigned long al_flags=0;
-+
-+ spin_lock_irq(&mdev->al_lock);
-+ bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr/AL_EXT_PER_BM_SECT);
-+ if (unlikely(bm_ext!=NULL)) {
-+ if(test_bit(BME_NO_WRITES,&bm_ext->flags)) {
-+ spin_unlock_irq(&mdev->al_lock);
-+ //INFO("Delaying app write until sync read is done\n");
-+ return 0;
-+ }
-+ }
-+ al_ext = lc_get(mdev->act_log,enr);
-+ al_flags = mdev->act_log->flags;
-+ spin_unlock_irq(&mdev->al_lock);
-+
-+ /*
-+ if (!al_ext) {
-+ if (al_flags & LC_STARVING)
-+ WARN("Have to wait for LRU element (AL too small?)\n");
-+ if (al_flags & LC_DIRTY)
-+ WARN("Ongoing AL update (AL device too slow?)\n");
-+ }
-+ */
-+
-+ return al_ext;
-+}
-+
-+void drbd_al_begin_io(struct Drbd_Conf *mdev, sector_t sector)
-+{
-+ unsigned int enr = (sector >> (AL_EXTENT_SIZE_B-9));
-+ struct lc_element *al_ext;
-+ struct update_al_work al_work;
-+
-+ D_ASSERT(atomic_read(&mdev->local_cnt)>0);
-+ wait_event(mdev->al_wait, (al_ext = _al_get(mdev,enr)) );
-+
-+ if (al_ext->lc_number != enr) {
-+ // We have to do write an transaction to AL.
-+ unsigned int evicted;
-+
-+ evicted = al_ext->lc_number;
-+
-+ if(mdev->cstate < Connected && evicted != LC_FREE ) {
-+ drbd_bm_write_sect(mdev, evicted/AL_EXT_PER_BM_SECT );
-+ }
-+
-+ /* drbd_al_write_transaction(mdev,al_ext,enr);
-+ generic_make_request() are serialized on the
-+ current->bio_tail list now. Therefore we have
-+ to deligate writing something to AL to the
-+ worker thread. */
-+ init_completion(&al_work.event);
-+ al_work.al_ext = al_ext;
-+ al_work.enr = enr;
-+ al_work.w.cb = w_al_write_transaction;
-+ drbd_queue_work_front(mdev,&mdev->data.work,&al_work.w);
-+ wait_for_completion(&al_work.event);
-+
-+ mdev->al_writ_cnt++;
-+
-+ /*
-+ DUMPI(al_ext->lc_number);
-+ DUMPI(mdev->act_log->new_number);
-+ */
-+ spin_lock_irq(&mdev->al_lock);
-+ lc_changed(mdev->act_log,al_ext);
-+ spin_unlock_irq(&mdev->al_lock);
-+ wake_up(&mdev->al_wait);
-+ }
-+}
-+
-+void drbd_al_complete_io(struct Drbd_Conf *mdev, sector_t sector)
-+{
-+ unsigned int enr = (sector >> (AL_EXTENT_SIZE_B-9));
-+ struct lc_element *extent;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&mdev->al_lock,flags);
-+
-+ extent = lc_find(mdev->act_log,enr);
-+
-+ if(!extent) {
-+ spin_unlock_irqrestore(&mdev->al_lock,flags);
-+ ERR("al_complete_io() called on inactive extent %u\n",enr);
-+ return;
-+ }
-+
-+ if( lc_put(mdev->act_log,extent) == 0 ) {
-+ wake_up(&mdev->al_wait);
-+ }
-+
-+ spin_unlock_irqrestore(&mdev->al_lock,flags);
-+}
-+
-+STATIC int
-+w_al_write_transaction(struct Drbd_Conf *mdev, struct drbd_work *w, int unused)
-+{
-+ int i,n,mx;
-+ unsigned int extent_nr;
-+ struct al_transaction* buffer;
-+ sector_t sector;
-+ u32 xor_sum=0;
-+
-+ struct lc_element *updated = ((struct update_al_work*)w)->al_ext;
-+ unsigned int new_enr = ((struct update_al_work*)w)->enr;
-+
-+ down(&mdev->md_io_mutex); // protects md_io_buffer, al_tr_cycle, ...
-+ buffer = (struct al_transaction*)page_address(mdev->md_io_page);
-+
-+ buffer->magic = __constant_cpu_to_be32(DRBD_MAGIC);
-+ buffer->tr_number = cpu_to_be32(mdev->al_tr_number);
-+
-+ n = lc_index_of(mdev->act_log, updated);
-+
-+ buffer->updates[0].pos = cpu_to_be32(n);
-+ buffer->updates[0].extent = cpu_to_be32(new_enr);
-+
-+#if 0 /* Use this printf with the test_al.pl program */
-+ ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number,n,new_enr);
-+#endif
-+
-+ xor_sum ^= new_enr;
-+
-+ mx = min_t(int,AL_EXTENTS_PT,
-+ mdev->act_log->nr_elements - mdev->al_tr_cycle);
-+ for(i=0;i<mx;i++) {
-+ extent_nr = lc_entry(mdev->act_log,
-+ mdev->al_tr_cycle+i)->lc_number;
-+ buffer->updates[i+1].pos = cpu_to_be32(mdev->al_tr_cycle+i);
-+ buffer->updates[i+1].extent = cpu_to_be32(extent_nr);
-+ xor_sum ^= extent_nr;
-+ }
-+ for(;i<AL_EXTENTS_PT;i++) {
-+ buffer->updates[i+1].pos = __constant_cpu_to_be32(-1);
-+ buffer->updates[i+1].extent = __constant_cpu_to_be32(LC_FREE);
-+ xor_sum ^= LC_FREE;
-+ }
-+ mdev->al_tr_cycle += AL_EXTENTS_PT;
-+ if(mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle=0;
-+
-+ buffer->xor_sum = cpu_to_be32(xor_sum);
-+
-+
-+ sector = drbd_md_ss(mdev) + MD_AL_OFFSET + mdev->al_tr_pos ;
-+
-+ if(!drbd_md_sync_page_io(mdev,sector,WRITE)) {
-+ drbd_chk_io_error(mdev, 1);
-+ drbd_io_error(mdev);
-+ }
-+
-+ if( ++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements,AL_EXTENTS_PT) ) {
-+ mdev->al_tr_pos=0;
-+ }
-+ D_ASSERT(mdev->al_tr_pos < MD_AL_MAX_SIZE);
-+ mdev->al_tr_number++;
-+
-+ up(&mdev->md_io_mutex);
-+
-+ complete(&((struct update_al_work*)w)->event);
-+
-+ return 1;
-+}
-+
-+/**
-+ * drbd_al_read_tr: Reads a single transaction record form the
-+ * on disk activity log.
-+ * Returns -1 on IO error, 0 on checksum error and 1 if it is a valid
-+ * record.
-+ */
-+STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,
-+ struct al_transaction* b,
-+ int index)
-+{
-+ sector_t sector;
-+ int rv,i;
-+ u32 xor_sum=0;
-+
-+ sector = drbd_md_ss(mdev) + MD_AL_OFFSET + index;
-+
-+ if(!drbd_md_sync_page_io(mdev,sector,READ)) {
-+ drbd_chk_io_error(mdev, 1);
-+ drbd_io_error(mdev);
-+ return -1;
-+ }
-+
-+ rv = ( be32_to_cpu(b->magic) == DRBD_MAGIC );
-+
-+ for(i=0;i<AL_EXTENTS_PT+1;i++) {
-+ xor_sum ^= be32_to_cpu(b->updates[i].extent);
-+ }
-+ rv &= (xor_sum == be32_to_cpu(b->xor_sum));
-+
-+ return rv;
-+}
-+
-+/**
-+ * drbd_al_read_log: Restores the activity log from its on disk
-+ * representation. Returns 1 on success, returns 0 when
-+ * reading the log failed due to IO errors.
-+ */
-+int drbd_al_read_log(struct Drbd_Conf *mdev)
-+{
-+ struct al_transaction* buffer;
-+ int from=-1,to=-1,i,cnr, overflow=0,rv;
-+ u32 from_tnr=-1, to_tnr=0;
-+ int active_extents=0;
-+ int transactions=0;
-+ int mx;
-+
-+ mx = div_ceil(mdev->act_log->nr_elements,AL_EXTENTS_PT);
-+
-+ /* lock out all other meta data io for now,
-+ * and make sure the page is mapped.
-+ */
-+ down(&mdev->md_io_mutex);
-+ buffer = page_address(mdev->md_io_page);
-+
-+ // Find the valid transaction in the log
-+ for(i=0;i<=mx;i++) {
-+ rv = drbd_al_read_tr(mdev,buffer,i);
-+ if(rv == 0) continue;
-+ if(rv == -1) {
-+ up(&mdev->md_io_mutex);
-+ return 0;
-+ }
-+ cnr = be32_to_cpu(buffer->tr_number);
-+ // INFO("index %d valid tnr=%d\n",i,cnr);
-+
-+ if(cnr == -1) overflow=1;
-+
-+ if(cnr < from_tnr && !overflow) {
-+ from = i;
-+ from_tnr = cnr;
-+ }
-+ if(cnr > to_tnr) {
-+ to = i;
-+ to_tnr = cnr;
-+ }
-+ }
-+
-+ if(from == -1 || to == -1) {
-+ WARN("No usable activity log found.\n");
-+
-+ up(&mdev->md_io_mutex);
-+ return 1;
-+ }
-+
-+ // Read the valid transactions.
-+ // INFO("Reading from %d to %d.\n",from,to);
-+
-+ /* this should better be handled by a for loop, no?
-+ */
-+ i=from;
-+ while(1) {
-+ int j,pos;
-+ unsigned int extent_nr;
-+ unsigned int trn;
-+
-+ rv = drbd_al_read_tr(mdev,buffer,i);
-+ ERR_IF(rv == 0) goto cancel;
-+ if(rv == -1) {
-+ up(&mdev->md_io_mutex);
-+ return 0;
-+ }
-+
-+ trn=be32_to_cpu(buffer->tr_number);
-+
-+ spin_lock_irq(&mdev->al_lock);
-+
-+ /* This loop runs backwards because in the cyclic
-+ elements there might be an old version of the
-+ updated element (in slot 0). So the element in slot 0
-+ can overwrite old versions. */
-+ for(j=AL_EXTENTS_PT;j>=0;j--) {
-+ pos = be32_to_cpu(buffer->updates[j].pos);
-+ extent_nr = be32_to_cpu(buffer->updates[j].extent);
-+
-+ if(extent_nr == LC_FREE) continue;
-+
-+ //if(j<3) INFO("T%03d S%03d=E%06d\n",trn,pos,extent_nr);
-+ lc_set(mdev->act_log,extent_nr,pos);
-+ active_extents++;
-+ }
-+ spin_unlock_irq(&mdev->al_lock);
-+
-+ transactions++;
-+
-+ cancel:
-+ if( i == to) break;
-+ i++;
-+ if( i > mx ) i=0;
-+ }
-+
-+ mdev->al_tr_number = to_tnr+1;
-+ mdev->al_tr_pos = to;
-+ if( ++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements,AL_EXTENTS_PT) ) {
-+ mdev->al_tr_pos=0;
-+ }
-+
-+ /* ok, we are done with it */
-+ up(&mdev->md_io_mutex);
-+
-+ INFO("Found %d transactions (%d active extents) in activity log.\n",
-+ transactions,active_extents);
-+
-+ return 1;
-+}
-+
-+/**
-+ * drbd_al_to_on_disk_bm:
-+ * Writes the areas of the bitmap which are covered by the AL.
-+ * called when we detach (unconfigure) local storage,
-+ * or when we go from Primary to Secondary state.
-+ */
-+void drbd_al_to_on_disk_bm(struct Drbd_Conf *mdev)
-+{
-+ int i;
-+ unsigned int enr;
-+
-+ wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
-+
-+ i=inc_local_md_only(mdev);
-+ D_ASSERT( i ); // Assertions should not have side effects.
-+ // I do not want to have D_ASSERT( inc_local_md_only(mdev) );
-+
-+ for(i=0;i<mdev->act_log->nr_elements;i++) {
-+ enr = lc_entry(mdev->act_log,i)->lc_number;
-+ if(enr == LC_FREE) continue;
-+ /* TODO encapsulate and optimize within drbd_bitmap
-+ * currently, if we have al-extents 16..19 active,
-+ * sector 4 will be written four times! */
-+ drbd_bm_write_sect(mdev, enr/AL_EXT_PER_BM_SECT );
-+ }
-+
-+ lc_unlock(mdev->act_log);
-+ wake_up(&mdev->al_wait);
-+ dec_local(mdev);
-+}
-+
-+/**
-+ * drbd_al_apply_to_bm: Sets the bits in the bitmap that are described
-+ * by the active extents of the AL.
-+ */
-+void drbd_al_apply_to_bm(struct Drbd_Conf *mdev)
-+{
-+ unsigned int enr;
-+ unsigned long add=0;
-+ char ppb[10];
-+ int i;
-+
-+ wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
-+
-+ for(i=0;i<mdev->act_log->nr_elements;i++) {
-+ enr = lc_entry(mdev->act_log,i)->lc_number;
-+ if(enr == LC_FREE) continue;
-+ add += drbd_bm_ALe_set_all(mdev, enr);
-+ }
-+
-+ lc_unlock(mdev->act_log);
-+ wake_up(&mdev->al_wait);
-+
-+ INFO("Marked additional %s as out-of-sync based on AL.\n",
-+ ppsize(ppb,Bit2KB(add)));
-+}
-+
-+static inline int _try_lc_del(struct Drbd_Conf *mdev,struct lc_element *al_ext)
-+{
-+ int rv;
-+
-+ spin_lock_irq(&mdev->al_lock);
-+ rv = (al_ext->refcnt == 0);
-+ if(likely(rv)) lc_del(mdev->act_log,al_ext);
-+ spin_unlock_irq(&mdev->al_lock);
-+
-+ if(unlikely(!rv)) INFO("Waiting for extent in drbd_al_shrink()\n");
-+
-+ return rv;
-+}
-+
-+/**
-+ * drbd_al_shrink: Removes all active extents form the AL. (but does not
-+ * write any transactions)
-+ * You need to lock mdev->act_log with lc_try_lock() / lc_unlock()
-+ */
-+void drbd_al_shrink(struct Drbd_Conf *mdev)
-+{
-+ struct lc_element *al_ext;
-+ int i;
-+
-+ D_ASSERT( test_bit(__LC_DIRTY,&mdev->act_log->flags) );
-+
-+ for(i=0;i<mdev->act_log->nr_elements;i++) {
-+ al_ext = lc_entry(mdev->act_log,i);
-+ if(al_ext->lc_number == LC_FREE) continue;
-+ wait_event(mdev->al_wait, _try_lc_del(mdev,al_ext));
-+ }
-+
-+ wake_up(&mdev->al_wait);
-+}
-+
-+STATIC int w_update_odbm(drbd_dev *mdev, struct drbd_work *w, int unused)
-+{
-+ struct update_odbm_work *udw = (struct update_odbm_work*)w;
-+
-+ if( !inc_local_md_only(mdev) ) {
-+ if (DRBD_ratelimit(5*HZ,5))
-+ WARN("Can not update on disk bitmap, local IO disabled.\n");
-+ return 1;
-+ }
-+
-+ drbd_bm_write_sect(mdev, udw->enr );
-+ dec_local(mdev);
-+
-+ kfree(udw);
-+
-+ if(drbd_bm_total_weight(mdev) == 0 &&
-+ ( mdev->cstate == SyncSource || mdev->cstate == SyncTarget ||
-+ mdev->cstate == PausedSyncS || mdev->cstate == PausedSyncT ) ) {
-+ D_ASSERT( mdev->resync_work.cb == w_resync_inactive );
-+ drbd_bm_lock(mdev);
-+ drbd_resync_finished(mdev);
-+ drbd_bm_unlock(mdev);
-+ }
-+
-+ return 1;
-+}
-+
-+
-+/* ATTENTION. The AL's extents are 4MB each, while the extents in the *
-+ * resync LRU-cache are 16MB each. *
-+ *
-+ * TODO will be obsoleted once we have a caching lru of the on disk bitmap
-+ */
-+STATIC void drbd_try_clear_on_disk_bm(struct Drbd_Conf *mdev,sector_t sector,
-+ int cleared)
-+{
-+ struct list_head *le, *tmp;
-+ struct bm_extent* ext;
-+ struct update_odbm_work * udw;
-+
-+ unsigned int enr;
-+
-+ MUST_HOLD(&mdev->al_lock);
-+
-+ // I simply assume that a sector/size pair never crosses
-+ // a 16 MB extent border. (Currently this is true...)
-+ enr = BM_SECT_TO_EXT(sector);
-+
-+ ext = (struct bm_extent *) lc_get(mdev->resync,enr);
-+ if (ext) {
-+ if( ext->lce.lc_number == enr) {
-+ ext->rs_left -= cleared;
-+ if (ext->rs_left < 0) {
-+ ERR("BAD! sector=%lu enr=%u rs_left=%d cleared=%d\n",
-+ (unsigned long)sector,
-+ ext->lce.lc_number, ext->rs_left, cleared);
-+ // FIXME brrrgs. should never happen!
-+ _set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return;
-+ }
-+ } else {
-+ //WARN("Recounting sectors in %d (resync LRU too small?)\n", enr);
-+ // This element should be in the cache
-+ // since drbd_rs_begin_io() pulled it already in.
-+ int rs_left = drbd_bm_e_weight(mdev,enr);
-+ if (ext->flags != 0) {
-+ WARN("changing resync lce: %d[%u;%02lx]"
-+ " -> %d[%u;00]\n",
-+ ext->lce.lc_number, ext->rs_left,
-+ ext->flags, enr, rs_left);
-+ ext->flags = 0;
-+ }
-+ ext->rs_left = rs_left;
-+ lc_changed(mdev->resync,&ext->lce);
-+ }
-+ lc_put(mdev->resync,&ext->lce);
-+ // no race, we are within the al_lock!
-+ } else {
-+ ERR("lc_get() failed! locked=%d/%d flags=%lu\n",
-+ atomic_read(&mdev->resync_locked),
-+ mdev->resync->nr_elements,
-+ mdev->resync->flags);
-+ }
-+
-+ list_for_each_safe(le,tmp,&mdev->resync->lru) {
-+ ext=(struct bm_extent *)list_entry(le,struct lc_element,list);
-+ if(ext->rs_left == 0) {
-+ udw=kmalloc(sizeof(*udw),GFP_ATOMIC);
-+ if(!udw) {
-+ WARN("Could not kmalloc an udw\n");
-+ break;
-+ }
-+ udw->enr = ext->lce.lc_number;
-+ udw->w.cb = w_update_odbm;
-+ drbd_queue_work_front(mdev,&mdev->data.work,&udw->w);
-+ if (ext->flags != 0) {
-+ WARN("deleting resync lce: %d[%u;%02lx]\n",
-+ ext->lce.lc_number, ext->rs_left,
-+ ext->flags);
-+ ext->flags = 0;
-+ }
-+ lc_del(mdev->resync,&ext->lce);
-+ }
-+ }
-+}
-+
-+/* clear the bit corresponding to the piece of storage in question:
-+ * size byte of data starting from sector. Only clear a bits of the affected
-+ * one ore more _aligned_ BM_BLOCK_SIZE blocks.
-+ *
-+ * called by worker on SyncTarget and receiver on SyncSource.
-+ *
-+ */
-+void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
-+{
-+ /* Is called from worker and receiver context _only_ */
-+ unsigned long sbnr,ebnr,lbnr,bnr;
-+ unsigned long count = 0;
-+ sector_t esector, nr_sectors;
-+ int strange_state,wake_up=0;
-+
-+ strange_state = (mdev->cstate <= Connected) ||
-+ test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags);
-+ if (strange_state) {
-+ ERR("%s:%d: %s flags=0x%02lx\n", file , line ,
-+ cstate_to_name(mdev->cstate), mdev->flags);
-+ }
-+
-+ if (size <= 0 || (size & 0x1ff) != 0 || size > PAGE_SIZE) {
-+ ERR("drbd_set_in_sync: sector=%lu size=%d nonsense!\n",
-+ (unsigned long)sector,size);
-+ return;
-+ }
-+ nr_sectors = drbd_get_capacity(mdev->this_bdev);
-+ esector = sector + (size>>9) -1;
-+
-+ ERR_IF(sector >= nr_sectors) return;
-+ ERR_IF(esector >= nr_sectors) esector = (nr_sectors-1);
-+
-+ lbnr = BM_SECT_TO_BIT(nr_sectors-1);
-+
-+ /* we clear it (in sync).
-+ * round up start sector, round down end sector. we make sure we only
-+ * clear full, alligned, BM_BLOCK_SIZE (4K) blocks */
-+ if (unlikely(esector < BM_SECT_PER_BIT-1)) {
-+ return;
-+ } else if (unlikely(esector == (nr_sectors-1))) {
-+ ebnr = lbnr;
-+ } else {
-+ ebnr = BM_SECT_TO_BIT(esector - (BM_SECT_PER_BIT-1));
-+ }
-+ sbnr = BM_SECT_TO_BIT(sector + BM_SECT_PER_BIT-1);
-+
-+#ifdef DUMP_EACH_PACKET
-+ INFO("drbd_set_in_sync: sector=%lu size=%d sbnr=%lu ebnr=%lu\n",
-+ (unsigned long)sector, size, sbnr, ebnr);
-+#endif
-+
-+ if (sbnr > ebnr) return;
-+
-+ /*
-+ * ok, (capacity & 7) != 0 sometimes, but who cares...
-+ * we count rs_{total,left} in bits, not sectors.
-+ */
-+ spin_lock_irq(&mdev->al_lock);
-+ for(bnr=sbnr; bnr <= ebnr; bnr++) {
-+ if (drbd_bm_clear_bit(mdev,bnr)) count++;
-+ }
-+ if (count) {
-+ // we need the lock for drbd_try_clear_on_disk_bm
-+ if(jiffies - mdev->rs_mark_time > HZ*10) {
-+ /* should be roling marks, but we estimate only anyways. */
-+ if( mdev->rs_mark_left != drbd_bm_total_weight(mdev)) {
-+ mdev->rs_mark_time =jiffies;
-+ mdev->rs_mark_left =drbd_bm_total_weight(mdev);
-+ }
-+ }
-+ drbd_try_clear_on_disk_bm(mdev,sector,count);
-+ /* just wake_up unconditional now,
-+ * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
-+ wake_up=1;
-+ }
-+ spin_unlock_irq(&mdev->al_lock);
-+ if(wake_up) wake_up(&mdev->al_wait);
-+}
-+
-+/*
-+ * this is intended to set one request worth of data out of sync.
-+ * affects at least 1 bit, and at most 1+PAGE_SIZE/BM_BLOCK_SIZE bits.
-+ *
-+ * called by tl_clear and drbd_send_dblock (==drbd_make_request).
-+ * so this can be _any_ process.
-+ */
-+void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
-+{
-+ unsigned long sbnr,ebnr,lbnr,bnr;
-+ sector_t esector, nr_sectors;
-+ int strange_state;
-+
-+ strange_state = ( mdev->cstate > Connected ) ||
-+ ( mdev->cstate == Connected &&
-+ !(test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags)) );
-+ if (strange_state) {
-+ ERR("%s:%d: %s flags=0x%02lx\n", file , line ,
-+ cstate_to_name(mdev->cstate), mdev->flags);
-+ }
-+
-+ if (size <= 0 || (size & 0x1ff) != 0 || size > PAGE_SIZE) {
-+ ERR("sector: %lu, size: %d\n",(unsigned long)sector,size);
-+ return;
-+ }
-+
-+ nr_sectors = drbd_get_capacity(mdev->this_bdev);
-+ esector = sector + (size>>9) -1;
-+
-+ ERR_IF(sector >= nr_sectors) return;
-+ ERR_IF(esector >= nr_sectors) esector = (nr_sectors-1);
-+
-+ lbnr = BM_SECT_TO_BIT(nr_sectors-1);
-+
-+ /* we set it out of sync,
-+ * we do not need to round anything here */
-+ sbnr = BM_SECT_TO_BIT(sector);
-+ ebnr = BM_SECT_TO_BIT(esector);
-+
-+ /*
-+ * ok, (capacity & 7) != 0 sometimes, but who cares...
-+ * we count rs_{total,left} in bits, not sectors.
-+ */
-+ for(bnr=sbnr; bnr <= ebnr; bnr++) drbd_bm_set_bit(mdev,bnr);
-+}
-+
-+static inline
-+struct bm_extent* _bme_get(struct Drbd_Conf *mdev, unsigned int enr)
-+{
-+ struct bm_extent *bm_ext;
-+ int wakeup = 0;
-+ unsigned long rs_flags;
-+
-+ if(atomic_read(&mdev->resync_locked) > mdev->resync->nr_elements-3 ) {
-+ //WARN("bme_get() does not lock all elements\n");
-+ return 0;
-+ }
-+
-+ spin_lock_irq(&mdev->al_lock);
-+ bm_ext = (struct bm_extent*) lc_get(mdev->resync,enr);
-+ if (bm_ext) {
-+ if(bm_ext->lce.lc_number != enr) {
-+ bm_ext->rs_left = drbd_bm_e_weight(mdev,enr);
-+ lc_changed(mdev->resync,(struct lc_element*)bm_ext);
-+ wakeup = 1;
-+ }
-+ if(bm_ext->lce.refcnt == 1) atomic_inc(&mdev->resync_locked);
-+ set_bit(BME_NO_WRITES,&bm_ext->flags); // within the lock
-+ }
-+ rs_flags=mdev->resync->flags;
-+ spin_unlock_irq(&mdev->al_lock);
-+ if (wakeup) wake_up(&mdev->al_wait);
-+
-+ if(!bm_ext) {
-+ if (rs_flags & LC_STARVING) {
-+ WARN("Have to wait for element"
-+ " (resync LRU too small?)\n");
-+ }
-+ if (rs_flags & LC_DIRTY) {
-+ BUG(); // WARN("Ongoing RS update (???)\n");
-+ }
-+ }
-+
-+ return bm_ext;
-+}
-+
-+static inline int _is_in_al(drbd_dev* mdev, unsigned int enr)
-+{
-+ struct lc_element* al_ext;
-+ int rv=0;
-+
-+ spin_lock_irq(&mdev->al_lock);
-+ if(unlikely(enr == mdev->act_log->new_number)) rv=1;
-+ else {
-+ al_ext = lc_find(mdev->act_log,enr);
-+ if(al_ext) {
-+ if (al_ext->refcnt) rv=1;
-+ }
-+ }
-+ spin_unlock_irq(&mdev->al_lock);
-+
-+ /*
-+ if(unlikely(rv)) {
-+ INFO("Delaying sync read until app's write is done\n");
-+ }
-+ */
-+ return rv;
-+}
-+
-+/**
-+ * drbd_rs_begin_io: Gets an extent in the resync LRU cache and sets it
-+ * to BME_LOCKED.
-+ *
-+ * @sector: The sector number
-+ */
-+int drbd_rs_begin_io(drbd_dev* mdev, sector_t sector)
-+{
-+ unsigned int enr = BM_SECT_TO_EXT(sector);
-+ struct bm_extent* bm_ext;
-+ int i, sig;
-+
-+ sig = wait_event_interruptible( mdev->al_wait,
-+ (bm_ext = _bme_get(mdev,enr)) );
-+ if (sig) return 0;
-+
-+ if(test_bit(BME_LOCKED,&bm_ext->flags)) return 1;
-+
-+ for(i=0;i<AL_EXT_PER_BM_SECT;i++) {
-+ sig = wait_event_interruptible( mdev->al_wait,
-+ !_is_in_al(mdev,enr*AL_EXT_PER_BM_SECT+i) );
-+ if (sig) {
-+ spin_lock_irq(&mdev->al_lock);
-+ if( lc_put(mdev->resync,&bm_ext->lce) == 0 ) {
-+ clear_bit(BME_NO_WRITES,&bm_ext->flags);
-+ atomic_dec(&mdev->resync_locked);
-+ wake_up(&mdev->al_wait);
-+ }
-+ spin_unlock_irq(&mdev->al_lock);
-+ return 0;
-+ }
-+ }
-+
-+ set_bit(BME_LOCKED,&bm_ext->flags);
-+
-+ return 1;
-+}
-+
-+void drbd_rs_complete_io(drbd_dev* mdev, sector_t sector)
-+{
-+ unsigned int enr = BM_SECT_TO_EXT(sector);
-+ struct bm_extent* bm_ext;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&mdev->al_lock,flags);
-+ bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr);
-+ if(!bm_ext) {
-+ spin_unlock_irqrestore(&mdev->al_lock,flags);
-+ ERR("drbd_rs_complete_io() called, but extent not found\n");
-+ return;
-+ }
-+
-+ if( lc_put(mdev->resync,(struct lc_element *)bm_ext) == 0 ) {
-+ clear_bit(BME_LOCKED,&bm_ext->flags);
-+ clear_bit(BME_NO_WRITES,&bm_ext->flags);
-+ atomic_dec(&mdev->resync_locked);
-+ wake_up(&mdev->al_wait);
-+ }
-+
-+ spin_unlock_irqrestore(&mdev->al_lock,flags);
-+}
-+
-+/**
-+ * drbd_rs_cancel_all: Removes extents from the resync LRU. Even
-+ * if they are BME_LOCKED.
-+ */
-+void drbd_rs_cancel_all(drbd_dev* mdev)
-+{
-+ struct bm_extent* bm_ext;
-+ int i;
-+
-+ spin_lock_irq(&mdev->al_lock);
-+
-+ for(i=0;i<mdev->resync->nr_elements;i++) {
-+ bm_ext = (struct bm_extent*) lc_entry(mdev->resync,i);
-+ if(bm_ext->lce.lc_number == LC_FREE) continue;
-+ bm_ext->lce.refcnt = 0; // Rude but ok.
-+ bm_ext->rs_left = 0;
-+ clear_bit(BME_LOCKED,&bm_ext->flags);
-+ clear_bit(BME_NO_WRITES,&bm_ext->flags);
-+ lc_del(mdev->resync,&bm_ext->lce);
-+ }
-+ atomic_set(&mdev->resync_locked,0);
-+ spin_unlock_irq(&mdev->al_lock);
-+ wake_up(&mdev->al_wait);
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_bitmap.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,980 @@
-+/*
-+-*- linux-c -*-
-+ drbd_bitmap.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 2004, Lars Ellenberg <l.g.e@web.de>.
-+ main author.
-+
-+ Copyright (C) 2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ contributions.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
-+
-+#include <linux/bitops.h>
-+#include <linux/vmalloc.h>
-+#include <linux/string.h> // for memset
-+
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+/* special handling for ppc64 on 2.4 kernel -- find_next_bit is not exported
-+ * so we include it here (verbatim, from linux 2.4.21 sources) */
-+#if defined(__powerpc64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+
-+unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
-+{
-+ unsigned long *p = addr + (offset >> 6);
-+ unsigned long result = offset & ~63UL;
-+ unsigned long tmp;
-+
-+ if (offset >= size)
-+ return size;
-+ size -= result;
-+ offset &= 63UL;
-+ if (offset) {
-+ tmp = *(p++);
-+ tmp &= (~0UL << offset);
-+ if (size < 64)
-+ goto found_first;
-+ if (tmp)
-+ goto found_middle;
-+ size -= 64;
-+ result += 64;
-+ }
-+ while (size & ~63UL) {
-+ if ((tmp = *(p++)))
-+ goto found_middle;
-+ result += 64;
-+ size -= 64;
-+ }
-+ if (!size)
-+ return result;
-+ tmp = *p;
-+
-+found_first:
-+ tmp &= (~0UL >> (64 - size));
-+ if (tmp == 0UL) /* Are any bits set? */
-+ return result + size; /* Nope. */
-+found_middle:
-+ return result + __ffs(tmp);
-+}
-+#endif /* NEED_PPC64_WORKAROUND */
-+
-+/* OPAQUE outside this file!
-+ * interface defined in drbd_int.h
-+ *
-+ * unfortunately this currently means that this file is not
-+ * yet selfcontained, because it needs to know about how to receive
-+ * the bitmap from the peer via the data socket.
-+ * This is to be solved with some sort of
-+ * drbd_bm_copy(mdev,offset,size,unsigned long*) ...
-+
-+ * Note that since find_first_bit returns int, this implementation
-+ * "only" supports up to 1<<(32+12) == 16 TB... non issue, since
-+ * currently DRBD is limited to ca 3.8 TB storage anyways.
-+ *
-+ * we will eventually change the implementation to not allways hold the full
-+ * bitmap in memory, but only some 'lru_cache' of the on disk bitmap,
-+ * since vmalloc'ing mostly unused 128M is antisocial.
-+
-+ * THINK
-+ * I'm not yet sure whether this file should be bits only,
-+ * or wether I want it to do all the sector<->bit calculation in here.
-+ */
-+
-+/*
-+ * NOTE
-+ * Access to the *bm is protected by bm_lock.
-+ * It is safe to read the other members within the lock.
-+ *
-+ * drbd_bm_set_bit is called from bio_endio callbacks,
-+ * so there we need a spin_lock_irqsave.
-+ * Everywhere else we need a spin_lock_irq.
-+ *
-+ * FIXME
-+ * Actually you need to serialize all resize operations.
-+ * but then, resize is a drbd state change, and it should be serialized
-+ * already. Unfortunately it is not (yet), so two concurrent resizes, like
-+ * attach storage (drbdsetup) and receive the peers size (drbd receiver)
-+ * may eventually blow things up.
-+ * Therefore,
-+ * you may only change the other members when holding
-+ * the bm_change mutex _and_ the bm_lock.
-+ * thus reading them holding either is safe.
-+ * this is sort of overkill, but I rather do it right
-+ * than have two resize operations interfere somewhen.
-+ */
-+struct drbd_bitmap {
-+ unsigned long *bm;
-+ spinlock_t bm_lock;
-+ unsigned long bm_fo; // next offset for drbd_bm_find_next
-+ unsigned long bm_set; // nr of set bits; THINK maybe atomic_t ?
-+ unsigned long bm_bits;
-+ size_t bm_words;
-+ sector_t bm_dev_capacity;
-+ struct semaphore bm_change; // serializes resize operations
-+
-+ // { REMOVE
-+ unsigned long bm_flags; // currently debugging aid only
-+ unsigned long bm_line;
-+ char *bm_file;
-+ // }
-+};
-+
-+// { REMOVE once we serialize all state changes properly
-+#define D_BUG_ON(x) ERR_IF(x) { dump_stack(); }
-+#define BM_LOCKED 0
-+#if 0 // simply disabled for now...
-+#define MUST_NOT_BE_LOCKED() do { \
-+ if (test_bit(BM_LOCKED,&b->bm_flags)) { \
-+ if (DRBD_ratelimit(5*HZ,5)) { \
-+ ERR("%s:%d: bitmap is locked by %s:%lu\n", \
-+ __FILE__, __LINE__, b->bm_file,b->bm_line); \
-+ dump_stack(); \
-+ } \
-+ } \
-+} while (0)
-+#define MUST_BE_LOCKED() do { \
-+ if (!test_bit(BM_LOCKED,&b->bm_flags)) { \
-+ if (DRBD_ratelimit(5*HZ,5)) { \
-+ ERR("%s:%d: bitmap not locked!\n", \
-+ __FILE__, __LINE__); \
-+ dump_stack(); \
-+ } \
-+ } \
-+} while (0)
-+#else
-+#define MUST_NOT_BE_LOCKED() do {(void)b;} while (0)
-+#define MUST_BE_LOCKED() do {(void)b;} while (0)
-+#endif
-+void __drbd_bm_lock(drbd_dev *mdev, char* file, int line)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ spin_lock_irq(&b->bm_lock);
-+ if (!__test_and_set_bit(BM_LOCKED,&b->bm_flags)) {
-+ b->bm_file = file;
-+ b->bm_line = line;
-+ } else if (DRBD_ratelimit(5*HZ,5)) {
-+ ERR("%s:%d: bitmap already locked by %s:%lu\n",
-+ file, line, b->bm_file,b->bm_line);
-+ /*
-+ dump_stack();
-+ ERR("This is no oops, but debug stack trace only.\n");
-+ ERR("If you get this often, or in reproducable situations, "
-+ "notify <drbd-devel@linbit.com>\n");
-+ */
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+void drbd_bm_unlock(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ spin_lock_irq(&b->bm_lock);
-+ if (!__test_and_clear_bit(BM_LOCKED,&mdev->bitmap->bm_flags)) {
-+ ERR("bitmap not locked in bm_unlock\n");
-+ } else {
-+ /* FIXME if we got a "is already locked" previously,
-+ * we unlock here even though we actually MUST NOT do so... */
-+ b->bm_file = NULL;
-+ b->bm_line = -1;
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+#if 0
-+// has been very helpful to indicate that rs_total and rs_left have been
-+// used in a non-smp safe way...
-+#define BM_PARANOIA_CHECK() do { \
-+ D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC); \
-+ D_ASSERT(b->bm_dev_capacity == drbd_get_capacity(mdev->this_bdev)); \
-+ if ( (b->bm_set != mdev->rs_total) && \
-+ (b->bm_set != mdev->rs_left) ) { \
-+ if ( DRBD_ratelimit(5*HZ,5) ) { \
-+ ERR("%s:%d: ?? bm_set=%lu; rs_total=%lu, rs_left=%lu\n",\
-+ __FILE__ , __LINE__ , \
-+ b->bm_set, mdev->rs_total, mdev->rs_left ); \
-+ } \
-+ } \
-+} while (0)
-+#else
-+#define BM_PARANOIA_CHECK() do { \
-+ D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC); \
-+ D_ASSERT(b->bm_dev_capacity == drbd_get_capacity(mdev->this_bdev)); \
-+} while (0)
-+#endif
-+// }
-+
-+#if DUMP_MD >= 3
-+/* debugging aid */
-+STATIC void bm_end_info(drbd_dev *mdev, const char* where)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ size_t w = (b->bm_bits-1) >> LN2_BPL;
-+
-+ INFO("%s: bm_set=%lu\n", where, b->bm_set);
-+ INFO("bm[%d]=0x%lX\n", w, b->bm[w]);
-+ w++;
-+
-+ if ( w < b->bm_words ) {
-+ D_ASSERT(w == b->bm_words -1);
-+ INFO("bm[%d]=0x%lX\n",w,b->bm[w]);
-+ }
-+}
-+#else
-+#define bm_end_info(ignored...) ((void)(0))
-+#endif
-+
-+/* long word offset of _bitmap_ sector */
-+#define S2W(s) ((s)<<(BM_EXT_SIZE_B-BM_BLOCK_SIZE_B-LN2_BPL))
-+
-+/*
-+ * actually most functions herein should take a struct drbd_bitmap*, not a
-+ * drbd_dev*, but for the debug macros I like to have the mdev around
-+ * to be able to report device specific.
-+ */
-+
-+/* FIXME TODO sometimes I use "int offset" as index into the bitmap.
-+ * since we currently are LIMITED to (128<<11)-64-8 sectors of bitmap,
-+ * this is ok [as long as we dont run on a 24 bit arch :)].
-+ * But it is NOT strictly ok.
-+ */
-+
-+/*
-+ * called on driver init only. TODO call when a device is created.
-+ * allocates the drbd_bitmap, and stores it in mdev->bitmap.
-+ */
-+int drbd_bm_init(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ D_BUG_ON(b);
-+ b = kmalloc(sizeof(struct drbd_bitmap),GFP_KERNEL);
-+ if (!b)
-+ return -ENOMEM;
-+ memset(b,0,sizeof(*b));
-+ b->bm_lock = SPIN_LOCK_UNLOCKED;
-+ init_MUTEX(&b->bm_change);
-+ mdev->bitmap = b;
-+ return 0;
-+}
-+
-+sector_t drbd_bm_capacity(drbd_dev *mdev)
-+{
-+ ERR_IF(!mdev->bitmap) return 0;
-+ return mdev->bitmap->bm_dev_capacity;
-+}
-+
-+/* called on driver unload. TODO: call when a device is destroyed.
-+ */
-+void drbd_bm_cleanup(drbd_dev *mdev)
-+{
-+ ERR_IF (!mdev->bitmap) return;
-+ /* FIXME I think we should explicitly change the device size to zero
-+ * before this...
-+ *
-+ D_BUG_ON(mdev->bitmap->bm);
-+ */
-+ vfree(mdev->bitmap->bm);
-+ kfree(mdev->bitmap);
-+ mdev->bitmap = NULL;
-+}
-+
-+/*
-+ * since (b->bm_bits % BITS_PER_LONG) != 0,
-+ * this masks out the remaining bits.
-+ * Rerturns the number of bits cleared.
-+ */
-+STATIC int bm_clear_surplus(struct drbd_bitmap * b)
-+{
-+ const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
-+ size_t w = b->bm_bits >> LN2_BPL;
-+ int cleared=0;
-+
-+ if ( w < b->bm_words ) {
-+ cleared = hweight_long(b->bm[w] & ~mask);
-+ b->bm[w++] &= mask;
-+ }
-+
-+ if ( w < b->bm_words ) {
-+ cleared += hweight_long(b->bm[w]);
-+ b->bm[w++]=0;
-+ }
-+
-+ return cleared;
-+}
-+
-+STATIC void bm_set_surplus(struct drbd_bitmap * b)
-+{
-+ const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
-+ size_t w = b->bm_bits >> LN2_BPL;
-+
-+ if ( w < b->bm_words ) {
-+ b->bm[w++] |= ~mask;
-+ }
-+
-+ if ( w < b->bm_words ) {
-+ b->bm[w++] = ~(0UL);
-+ }
-+}
-+
-+STATIC unsigned long bm_count_bits(struct drbd_bitmap * b)
-+{
-+ unsigned long *bm = b->bm;
-+ unsigned long *ep = b->bm + b->bm_words;
-+ unsigned long bits = 0;
-+
-+ while ( bm < ep ) {
-+ bits += hweight_long(*bm++);
-+ }
-+
-+ return bits;
-+}
-+
-+#define BM_SECTORS_PER_BIT (BM_BLOCK_SIZE/512)
-+
-+/*
-+ * make sure the bitmap has enough room for the attached storage,
-+ * if neccessary, resize.
-+ * called whenever we may have changed the device size.
-+ * returns -ENOMEM if we could not allocate enough memory, 0 on success.
-+ * In case this is actually a resize, we copy the old bitmap into the new one.
-+ * Otherwise, the bitmap is initiallized to all bits set.
-+ */
-+int drbd_bm_resize(drbd_dev *mdev, sector_t capacity)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long bits, bytes, words, *nbm, *obm = 0;
-+ int err = 0, growing;
-+
-+ ERR_IF(!b) return -ENOMEM;
-+ MUST_BE_LOCKED();
-+
-+ ERR_IF (down_trylock(&b->bm_change)) {
-+ down(&b->bm_change);
-+ }
-+
-+ if (capacity == b->bm_dev_capacity)
-+ goto out;
-+
-+ if (capacity == 0) {
-+ spin_lock_irq(&b->bm_lock);
-+ obm = b->bm;
-+ b->bm = NULL;
-+ b->bm_fo =
-+ b->bm_set =
-+ b->bm_bits =
-+ b->bm_words =
-+ b->bm_dev_capacity = 0;
-+ spin_unlock_irq(&b->bm_lock);
-+ goto free_obm;
-+ } else {
-+ bits = ALIGN(capacity,BM_SECTORS_PER_BIT)
-+ >> (BM_BLOCK_SIZE_B-9);
-+
-+ /* if we would use
-+ words = ALIGN(bits,BITS_PER_LONG) >> LN2_BPL;
-+ a 32bit host could present the wrong number of words
-+ to a 64bit host.
-+ */
-+ words = ALIGN(bits,64) >> LN2_BPL;
-+
-+ D_ASSERT(bits < ((MD_RESERVED_SIZE<<1)-MD_BM_OFFSET)<<12 );
-+
-+ if ( words == b->bm_words ) {
-+ /* optimize: capacity has changed,
-+ * but only within one long word worth of bits.
-+ * just update the bm_dev_capacity and bm_bits members.
-+ */
-+ spin_lock_irq(&b->bm_lock);
-+ b->bm_bits = bits;
-+ b->bm_dev_capacity = capacity;
-+ b->bm_set -= bm_clear_surplus(b);
-+ bm_end_info(mdev, __FUNCTION__ );
-+ spin_unlock_irq(&b->bm_lock);
-+ goto out;
-+ } else {
-+ /* one extra long to catch off by one errors */
-+ bytes = (words+1)*sizeof(long);
-+ nbm = vmalloc(bytes);
-+ if (!nbm) {
-+ err = -ENOMEM;
-+ goto out;
-+ }
-+ }
-+ spin_lock_irq(&b->bm_lock);
-+ obm = b->bm;
-+ // brgs. move several MB within spinlock...
-+ if (obm) {
-+ bm_set_surplus(b);
-+ D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC);
-+ memcpy(nbm,obm,min_t(size_t,b->bm_words,words)*sizeof(long));
-+ }
-+ growing = words > b->bm_words;
-+ if (growing) { // set all newly allocated bits
-+ memset( nbm+b->bm_words, -1,
-+ (words - b->bm_words) * sizeof(long) );
-+ b->bm_set += bits - b->bm_bits;
-+ }
-+ nbm[words] = DRBD_MAGIC;
-+ b->bm = nbm;
-+ b->bm_bits = bits;
-+ b->bm_words = words;
-+ b->bm_dev_capacity = capacity;
-+ bm_clear_surplus(b);
-+ if( !growing ) b->bm_set = bm_count_bits(b);
-+ bm_end_info(mdev, __FUNCTION__ );
-+ spin_unlock_irq(&b->bm_lock);
-+ INFO("resync bitmap: bits=%lu words=%lu\n",bits,words);
-+ }
-+ free_obm:
-+ vfree(obm); // vfree(NULL) is noop
-+ out:
-+ up(&b->bm_change);
-+ return err;
-+}
-+
-+/* inherently racy:
-+ * if not protected by other means, return value may be out of date when
-+ * leaving this function...
-+ * we still need to lock it, since it is important that this returns
-+ * bm_set == 0 precisely.
-+ *
-+ * maybe bm_set should be atomic_t ?
-+ */
-+unsigned long drbd_bm_total_weight(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long s;
-+ unsigned long flags;
-+
-+ ERR_IF(!b) return 0;
-+ // MUST_BE_LOCKED(); well. yes. but ...
-+
-+ spin_lock_irqsave(&b->bm_lock,flags);
-+ s = b->bm_set;
-+ spin_unlock_irqrestore(&b->bm_lock,flags);
-+
-+ return s;
-+}
-+
-+size_t drbd_bm_words(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ ERR_IF(!b) return 0;
-+
-+ /* FIXME
-+ * actually yes. really. otherwise it could just change its size ...
-+ * but it triggers all the time...
-+ * MUST_BE_LOCKED();
-+ */
-+
-+ return b->bm_words;
-+}
-+
-+/* merge number words from buffer into the bitmap starting at offset.
-+ * buffer[i] is expected to be little endian unsigned long.
-+ */
-+void drbd_bm_merge_lel( drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer )
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long *bm;
-+ unsigned long word, bits;
-+ size_t n = number;
-+
-+ ERR_IF(!b) return;
-+ ERR_IF(!b->bm) return;
-+ D_BUG_ON(offset >= b->bm_words);
-+ D_BUG_ON(offset+number > b->bm_words);
-+ D_BUG_ON(number > PAGE_SIZE/sizeof(long));
-+
-+ MUST_BE_LOCKED();
-+
-+ spin_lock_irq(&b->bm_lock);
-+ // BM_PARANOIA_CHECK(); no.
-+ bm = b->bm + offset;
-+ while(n--) {
-+ bits = hweight_long(*bm);
-+ word = *bm | lel_to_cpu(*buffer++);
-+ *bm++ = word;
-+ b->bm_set += hweight_long(word) - bits;
-+ }
-+ /* with 32bit <-> 64bit cross-platform connect
-+ * this is only correct for current usage,
-+ * where we _know_ that we are 64 bit aligned,
-+ * and know that this function is used in this way, too...
-+ */
-+ if (offset+number == b->bm_words) {
-+ b->bm_set -= bm_clear_surplus(b);
-+ bm_end_info(mdev, __FUNCTION__ );
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+/* copy number words from buffer into the bitmap starting at offset.
-+ * buffer[i] is expected to be little endian unsigned long.
-+ */
-+void drbd_bm_set_lel( drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer )
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long *bm;
-+ unsigned long word, bits;
-+ size_t n = number;
-+
-+ ERR_IF(!b) return;
-+ ERR_IF(!b->bm) return;
-+ D_BUG_ON(offset >= b->bm_words);
-+ D_BUG_ON(offset+number > b->bm_words);
-+ D_BUG_ON(number > PAGE_SIZE/sizeof(long));
-+
-+ MUST_BE_LOCKED();
-+
-+ spin_lock_irq(&b->bm_lock);
-+ // BM_PARANOIA_CHECK(); no.
-+ bm = b->bm + offset;
-+ while(n--) {
-+ bits = hweight_long(*bm);
-+ word = lel_to_cpu(*buffer++);
-+ *bm++ = word;
-+ b->bm_set += hweight_long(word) - bits;
-+ }
-+ /* with 32bit <-> 64bit cross-platform connect
-+ * this is only correct for current usage,
-+ * where we _know_ that we are 64 bit aligned,
-+ * and know that this function is used in this way, too...
-+ */
-+ if (offset+number == b->bm_words) {
-+ b->bm_set -= bm_clear_surplus(b);
-+ bm_end_info(mdev, __FUNCTION__ );
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+/* copy number words from the bitmap starting at offset into the buffer.
-+ * buffer[i] will be little endian unsigned long.
-+ */
-+void drbd_bm_get_lel( drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer )
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long *bm;
-+
-+ ERR_IF(!b) return;
-+ ERR_IF(!b->bm) return;
-+ if ( (offset >= b->bm_words) ||
-+ (offset+number > b->bm_words) ||
-+ (number > PAGE_SIZE/sizeof(long)) ||
-+ (number <= 0) ) {
-+ // yes, there is "%z", but that gives compiler warnings...
-+ ERR("offset=%lu number=%lu bm_words=%lu\n",
-+ (unsigned long) offset,
-+ (unsigned long) number,
-+ (unsigned long) b->bm_words);
-+ return;
-+ }
-+
-+ // MUST_BE_LOCKED(); yes. but not neccessarily globally...
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ bm = b->bm + offset;
-+ while(number--) *buffer++ = cpu_to_lel(*bm++);
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+/* set all bits in the bitmap */
-+void drbd_bm_set_all(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ ERR_IF(!b) return;
-+ ERR_IF(!b->bm) return;
-+
-+ MUST_BE_LOCKED();
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ memset(b->bm,-1,b->bm_words*sizeof(long));
-+ bm_clear_surplus(b);
-+ b->bm_set = b->bm_bits;
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+/* read one sector of the on disk bitmap into memory.
-+ * on disk bitmap is little endian.
-+ * @enr is _sector_ offset from start of on disk bitmap (aka bm-extent nr).
-+ * returns 0 on success, -EIO on failure
-+ */
-+int drbd_bm_read_sect(drbd_dev *mdev,unsigned long enr)
-+{
-+ sector_t on_disk_sector = enr + drbd_md_ss(mdev) + MD_BM_OFFSET;
-+ int bm_words, num_words, offset, err = 0;
-+
-+ // MUST_BE_LOCKED(); not neccessarily global ...
-+
-+ down(&mdev->md_io_mutex);
-+ if(drbd_md_sync_page_io(mdev,on_disk_sector,READ)) {
-+ bm_words = drbd_bm_words(mdev);
-+ offset = S2W(enr); // word offset into bitmap
-+ num_words = min(S2W(1), bm_words - offset);
-+#if DUMP_MD >= 3
-+ INFO("read_sect: sector=%lu offset=%u num_words=%u\n",
-+ enr, offset, num_words);
-+#endif
-+ drbd_bm_set_lel( mdev, offset, num_words,
-+ page_address(mdev->md_io_page) );
-+ } else {
-+ int i;
-+ err = -EIO;
-+ ERR( "IO ERROR reading bitmap sector %lu "
-+ "(meta-disk sector %lu)\n",
-+ enr, (unsigned long)on_disk_sector );
-+ drbd_chk_io_error(mdev, 1);
-+ drbd_io_error(mdev);
-+ for (i = 0; i < AL_EXT_PER_BM_SECT; i++)
-+ drbd_bm_ALe_set_all(mdev,enr*AL_EXT_PER_BM_SECT+i);
-+ }
-+ up(&mdev->md_io_mutex);
-+ return err;
-+}
-+
-+/**
-+ * drbd_bm_read: Read the whole bitmap from its on disk location.
-+ */
-+void drbd_bm_read(struct Drbd_Conf *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ sector_t sector;
-+ int bm_words, num_sectors;
-+ char ppb[10];
-+
-+ MUST_BE_LOCKED();
-+
-+ bm_words = drbd_bm_words(mdev);
-+ num_sectors = (bm_words*sizeof(long) + 511) >> 9;
-+
-+ for (sector = 0; sector < num_sectors; sector++) {
-+ // FIXME do something on io error here?
-+ drbd_bm_read_sect(mdev,sector);
-+ }
-+
-+ INFO("%s marked out-of-sync by on disk bit-map.\n",
-+ ppsize(ppb,drbd_bm_total_weight(mdev) << (BM_BLOCK_SIZE_B-10)) );
-+}
-+
-+/**
-+ * drbd_bm_write_sect: Writes a 512 byte piece of the bitmap to its
-+ * on disk location. On disk bitmap is little endian.
-+ *
-+ * @enr: The _sector_ offset from the start of the bitmap.
-+ *
-+ */
-+int drbd_bm_write_sect(struct Drbd_Conf *mdev,unsigned long enr)
-+{
-+ sector_t on_disk_sector = enr + drbd_md_ss(mdev) + MD_BM_OFFSET;
-+ int bm_words, num_words, offset, err = 0;
-+
-+ // MUST_BE_LOCKED(); not neccessarily global...
-+
-+ down(&mdev->md_io_mutex);
-+ bm_words = drbd_bm_words(mdev);
-+ offset = S2W(enr); // word offset into bitmap
-+ num_words = min(S2W(1), bm_words - offset);
-+#if DUMP_MD >= 3
-+ INFO("write_sect: sector=%lu offset=%u num_words=%u\n",
-+ enr, offset, num_words);
-+#endif
-+ if (num_words < S2W(1)) {
-+ memset(page_address(mdev->md_io_page),0,MD_HARDSECT);
-+ }
-+ drbd_bm_get_lel( mdev, offset, num_words,
-+ page_address(mdev->md_io_page) );
-+ if (!drbd_md_sync_page_io(mdev,on_disk_sector,WRITE)) {
-+ int i;
-+ err = -EIO;
-+ ERR( "IO ERROR writing bitmap sector %lu "
-+ "(meta-disk sector %lu)\n",
-+ enr, (unsigned long)on_disk_sector );
-+ drbd_chk_io_error(mdev, 1);
-+ drbd_io_error(mdev);
-+ for (i = 0; i < AL_EXT_PER_BM_SECT; i++)
-+ drbd_bm_ALe_set_all(mdev,enr*AL_EXT_PER_BM_SECT+i);
-+ }
-+ mdev->bm_writ_cnt++;
-+ up(&mdev->md_io_mutex);
-+ return err;
-+}
-+
-+/**
-+ * drbd_bm_write: Write the whole bitmap to its on disk location.
-+ */
-+void drbd_bm_write(struct Drbd_Conf *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ sector_t sector;
-+ int bm_words, num_sectors;
-+
-+ MUST_BE_LOCKED();
-+
-+ bm_words = drbd_bm_words(mdev);
-+ num_sectors = (bm_words*sizeof(long) + 511) >> 9;
-+
-+ for (sector = 0; sector < num_sectors; sector++) {
-+ // FIXME do something on io error here?
-+ drbd_bm_write_sect(mdev,sector);
-+ }
-+
-+ INFO("%lu KB now marked out-of-sync by on disk bit-map.\n",
-+ drbd_bm_total_weight(mdev) << (BM_BLOCK_SIZE_B-10) );
-+}
-+
-+/* clear all bits in the bitmap */
-+void drbd_bm_clear_all(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ ERR_IF(!b) return;
-+ ERR_IF(!b->bm) return;
-+
-+ MUST_BE_LOCKED(); \
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ memset(b->bm,0,b->bm_words*sizeof(long));
-+ b->bm_set = 0;
-+ spin_unlock_irq(&b->bm_lock);
-+}
-+
-+void drbd_bm_reset_find(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ ERR_IF(!b) return;
-+
-+ MUST_BE_LOCKED();
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ b->bm_fo = 0;
-+ spin_unlock_irq(&b->bm_lock);
-+
-+}
-+
-+/* NOTE
-+ * find_first_bit returns int, we return unsigned long.
-+ * should not make much difference anyways, but ...
-+ * this returns a bit number, NOT a sector!
-+ */
-+unsigned long drbd_bm_find_next(drbd_dev *mdev)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long i = -1UL;
-+ ERR_IF(!b) return i;
-+ ERR_IF(!b->bm) return i;
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ if (b->bm_fo < b->bm_bits) {
-+ i = find_next_bit(b->bm,b->bm_bits,b->bm_fo);
-+ } else if (b->bm_fo > b->bm_bits) {
-+ ERR("bm_fo=%lu bm_bits=%lu\n",b->bm_fo, b->bm_bits);
-+ }
-+ if (i >= b->bm_bits) {
-+ i = -1UL;
-+ b->bm_fo = 0;
-+ } else {
-+ b->bm_fo = i+1;
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+ return i;
-+}
-+
-+int drbd_bm_rs_done(drbd_dev *mdev)
-+{
-+ return mdev->bitmap->bm_fo == 0;
-+}
-+
-+// THINK maybe the D_BUG_ON(i<0)s in set/clear/test should be not that strict?
-+
-+/* returns previous bit state
-+ * wants bitnr, NOT sector.
-+ */
-+int drbd_bm_set_bit(drbd_dev *mdev, const unsigned long bitnr)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ int i;
-+ ERR_IF(!b) return 1;
-+ ERR_IF(!b->bm) return 1;
-+
-+/*
-+ * only called from drbd_set_out_of_sync.
-+ * strange_state blubber is already in place there...
-+ strange_state = ( mdev->cstate > Connected ) ||
-+ ( mdev->cstate == Connected &&
-+ !(test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags)) );
-+ if (strange_state)
-+ ERR("%s in drbd_bm_set_bit\n", cstate_to_name(mdev->cstate));
-+*/
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ MUST_NOT_BE_LOCKED();
-+ ERR_IF (bitnr >= b->bm_bits) {
-+ ERR("bitnr=%lu bm_bits=%lu\n",bitnr, b->bm_bits);
-+ i = 0;
-+ } else {
-+ i = (0 != __test_and_set_bit(bitnr, b->bm));
-+ b->bm_set += !i;
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+ return i;
-+}
-+
-+/* returns previous bit state
-+ * wants bitnr, NOT sector.
-+ */
-+int drbd_bm_clear_bit(drbd_dev *mdev, const unsigned long bitnr)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long flags;
-+ int i;
-+ ERR_IF(!b) return 0;
-+ ERR_IF(!b->bm) return 0;
-+
-+ spin_lock_irqsave(&b->bm_lock,flags);
-+ BM_PARANOIA_CHECK();
-+ MUST_NOT_BE_LOCKED();
-+ ERR_IF (bitnr >= b->bm_bits) {
-+ ERR("bitnr=%lu bm_bits=%lu\n",bitnr, b->bm_bits);
-+ i = 0;
-+ } else {
-+ i = (0 != __test_and_clear_bit(bitnr, b->bm));
-+ b->bm_set -= i;
-+ }
-+ spin_unlock_irqrestore(&b->bm_lock,flags);
-+
-+ /* clearing bits should only take place when sync is in progress!
-+ * this is only called from drbd_set_in_sync.
-+ * strange_state blubber is already in place there ...
-+ if (i && mdev->cstate <= Connected)
-+ ERR("drbd_bm_clear_bit: cleared a bitnr=%lu while %s\n",
-+ bitnr, cstate_to_name(mdev->cstate));
-+ */
-+
-+ return i;
-+}
-+
-+/* returns bit state
-+ * wants bitnr, NOT sector.
-+ * inherently racy... area needs to be locked by means of {al,rs}_lru
-+ */
-+int drbd_bm_test_bit(drbd_dev *mdev, const unsigned long bitnr)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ int i;
-+ ERR_IF(!b) return 0;
-+ ERR_IF(!b->bm) return 0;
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ ERR_IF (bitnr >= b->bm_bits) {
-+ ERR("bitnr=%lu bm_bits=%lu\n",bitnr, b->bm_bits);
-+ i = 0;
-+ } else {
-+ i = test_bit(bitnr, b->bm);
-+ }
-+ spin_unlock_irq(&b->bm_lock);
-+ return i;
-+}
-+
-+/* inherently racy...
-+ * return value may be already out-of-date when this function returns.
-+ * but the general usage is that this is only use during a cstate when bits are
-+ * only cleared, not set, and typically only care for the case when the return
-+ * value is zero, or we already "locked" this "bitmap extent" by other means.
-+ *
-+ * enr is bm-extent number, since we chose to name one sector (512 bytes)
-+ * worth of the bitmap a "bitmap extent".
-+ *
-+ * TODO
-+ * I think since we use it like a reference count, we should use the real
-+ * reference count of some bitmap extent element from some lru instead...
-+ *
-+ */
-+int drbd_bm_e_weight(drbd_dev *mdev, unsigned long enr)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ int count, s, e;
-+ unsigned long flags;
-+
-+ ERR_IF(!b) return 0;
-+ ERR_IF(!b->bm) return 0;
-+ spin_lock_irqsave(&b->bm_lock,flags);
-+ BM_PARANOIA_CHECK();
-+
-+ s = S2W(enr);
-+ e = min((size_t)S2W(enr+1),b->bm_words);
-+ count = 0;
-+ if (s < b->bm_words) {
-+ const unsigned long* w = b->bm+s;
-+ int n = e-s;
-+ while (n--) count += hweight_long(*w++);
-+ } else {
-+ ERR("start offset (%d) too large in drbd_bm_e_weight\n", s);
-+ }
-+ spin_unlock_irqrestore(&b->bm_lock,flags);
-+#if DUMP_MD >= 3
-+ INFO("enr=%lu weight=%d e=%d s=%d\n", enr, count, e, s);
-+#endif
-+ return count;
-+}
-+
-+/* set all bits covered by the AL-extent al_enr */
-+unsigned long drbd_bm_ALe_set_all(drbd_dev *mdev, unsigned long al_enr)
-+{
-+ struct drbd_bitmap *b = mdev->bitmap;
-+ unsigned long weight;
-+ int count, s, e;
-+ ERR_IF(!b) return 0;
-+ ERR_IF(!b->bm) return 0;
-+
-+ MUST_BE_LOCKED();
-+
-+ spin_lock_irq(&b->bm_lock);
-+ BM_PARANOIA_CHECK();
-+ weight = b->bm_set;
-+
-+ s = al_enr * BM_WORDS_PER_AL_EXT;
-+ e = min_t(size_t, s + BM_WORDS_PER_AL_EXT, b->bm_words);
-+ count = 0;
-+ if (s < b->bm_words) {
-+ const unsigned long* w = b->bm+s;
-+ int n = e-s;
-+ while (n--) count += hweight_long(*w++);
-+ n = e-s;
-+ memset(b->bm+s,-1,n*sizeof(long));
-+ b->bm_set += n*BITS_PER_LONG - count;
-+ if (e == b->bm_words) {
-+ b->bm_set -= bm_clear_surplus(b);
-+ }
-+ } else {
-+ ERR("start offset (%d) too large in drbd_bm_ALe_set_all\n", s);
-+ }
-+ weight = b->bm_set - weight;
-+ spin_unlock_irq(&b->bm_lock);
-+ return weight;
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_buildtag.c 2006-06-21 17:15:45.000000000 +0400
-@@ -0,0 +1,6 @@
-+/* automatically generated. DO NOT EDIT. */
-+const char * drbd_buildtag(void)
-+{
-+ return "SVN Revision: 2093"
-+ " build by phil@mescal, 2006-03-06 15:04:12";
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_compat_types.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,324 @@
-+
-+// currently only abstraction layer to get all references to buffer_head
-+// and b_some_thing out of our .c files.
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+#include <linux/highmem.h>
-+
-+typedef struct buffer_head drbd_bio_t;
-+typedef unsigned long sector_t;
-+
-+#define NOT_IN_26(x...) x
-+#define ONLY_IN_26(x...)
-+
-+#if !defined(CONFIG_HIGHMEM) && !defined(bh_kmap)
-+#define bh_kmap(bh) ((bh)->b_data)
-+#define bh_kunmap(bh) do { } while (0)
-+#endif
-+
-+#ifndef list_for_each
-+#define list_for_each(pos, head) \
-+ for(pos = (head)->next; pos != (head); pos = pos->next)
-+#endif
-+
-+// RH 2.4.9 does not have min() / max()
-+#ifndef min
-+# define min(x,y) \
-+ ({ typeof(x) __x = (x); typeof(y) __y = (y); \
-+ (void)(&__x == &__y); \
-+ __x < __y ? __x: __y; })
-+#endif
-+
-+#ifndef max
-+# define max(x,y) \
-+ ({ typeof(x) __x = (x); typeof(y) __y = (y); \
-+ (void)(&__x == &__y); \
-+ __x > __y ? __x: __y; })
-+#endif
-+
-+#ifndef MODULE_LICENSE
-+# define MODULE_LICENSE(L)
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
-+#define min_t(type,x,y) \
-+ ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-+#define max_t(type,x,y) \
-+ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7)
-+#define completion semaphore
-+#define init_completion(A) init_MUTEX_LOCKED(A)
-+#define wait_for_completion(A) down(A)
-+#define complete(A) up(A)
-+#else
-+#include <linux/completion.h>
-+#endif
-+
-+/* note that if you use some verndor kernels like SuSE,
-+ * their 2.4.X variant probably already contain equivalent definitions.
-+ * you then have to disable this compat again...
-+ */
-+
-+#ifndef HAVE_FIND_NEXT_BIT /* { */
-+
-+#if defined(__i386__) || defined(__arch_um__)
-+/**
-+ * find_first_bit - find the first set bit in a memory region
-+ * @addr: The address to start the search at
-+ * @size: The maximum size to search
-+ *
-+ * Returns the bit-number of the first set bit, not the number of the byte
-+ * containing a bit.
-+ */
-+static __inline__ int find_first_bit(const unsigned long *addr, unsigned size)
-+{
-+ int d0, d1;
-+ int res;
-+
-+ /* This looks at memory. Mark it volatile to tell gcc not to move it around */
-+ __asm__ __volatile__(
-+ "xorl %%eax,%%eax\n\t"
-+ "repe; scasl\n\t"
-+ "jz 1f\n\t"
-+ "leal -4(%%edi),%%edi\n\t"
-+ "bsfl (%%edi),%%eax\n"
-+ "1:\tsubl %%ebx,%%edi\n\t"
-+ "shll $3,%%edi\n\t"
-+ "addl %%edi,%%eax"
-+ :"=a" (res), "=&c" (d0), "=&D" (d1)
-+ :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
-+ return res;
-+}
-+
-+/**
-+ * find_next_bit - find the first set bit in a memory region
-+ * @addr: The address to base the search on
-+ * @offset: The bitnumber to start searching at
-+ * @size: The maximum size to search
-+ */
-+
-+static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
-+{
-+ const unsigned long *p = addr + (offset >> 5);
-+ int set = 0, bit = offset & 31, res;
-+
-+ if (bit) {
-+ /*
-+ * Look for nonzero in the first 32 bits:
-+ */
-+ __asm__("bsfl %1,%0\n\t"
-+ "jne 1f\n\t"
-+ "movl $32, %0\n"
-+ "1:"
-+ : "=r" (set)
-+ : "r" (*p >> bit));
-+ if (set < (32 - bit))
-+ return set + offset;
-+ set = 32 - bit;
-+ p++;
-+ }
-+ /*
-+ * No set bit yet, search remaining full words for a bit
-+ */
-+ res = find_first_bit (p, size - 32 * (p - addr));
-+ return (offset + set + res);
-+}
-+
-+#elif defined(__x86_64__)
-+
-+static __inline__ int find_first_bit(const unsigned long * addr, unsigned size)
-+{
-+ int d0, d1;
-+ int res;
-+
-+ /* This looks at memory. Mark it volatile to tell gcc not to move it around */
-+ __asm__ __volatile__(
-+ "xorl %%eax,%%eax\n\t"
-+ "repe; scasl\n\t"
-+ "jz 1f\n\t"
-+ "leaq -4(%%rdi),%%rdi\n\t"
-+ "bsfl (%%rdi),%%eax\n"
-+ "1:\tsubq %%rbx,%%rdi\n\t"
-+ "shll $3,%%edi\n\t"
-+ "addl %%edi,%%eax"
-+ :"=a" (res), "=&c" (d0), "=&D" (d1)
-+ :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
-+ return res;
-+}
-+
-+static __inline__ int find_next_bit(const unsigned long * addr, int size, int offset)
-+{
-+ const unsigned long * p = addr + (offset >> 6);
-+ unsigned long set = 0, bit = offset & 63, res;
-+
-+ if (bit) {
-+ /*
-+ * Look for nonzero in the first 64 bits:
-+ */
-+ __asm__("bsfq %1,%0\n\t"
-+ "cmoveq %2,%0\n\t"
-+ : "=r" (set)
-+ : "r" (*p >> bit), "r" (64L));
-+ if (set < (64 - bit))
-+ return set + offset;
-+ set = 64 - bit;
-+ p++;
-+ }
-+ /*
-+ * No set bit yet, search remaining full words for a bit
-+ */
-+ res = find_first_bit (p, size - 64 * (p - addr));
-+ return (offset + set + res);
-+}
-+
-+#elif defined(__alpha__)
-+
-+#include <asm/compiler.h>
-+#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
-+# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
-+#else
-+# define __kernel_cmpbge(a, b) \
-+ ({ unsigned long __kir; \
-+ __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
-+ __kir; })
-+#endif
-+
-+static inline unsigned long __ffs(unsigned long word)
-+{
-+#if defined(__alpha_cix__) && defined(__alpha_fix__)
-+ /* Whee. EV67 can calculate it directly. */
-+ return __kernel_cttz(word);
-+#else
-+ unsigned long bits, qofs, bofs;
-+
-+ bits = __kernel_cmpbge(0, word);
-+ qofs = ffz_b(bits);
-+ bits = __kernel_extbl(word, qofs);
-+ bofs = ffz_b(~bits);
-+
-+ return qofs*8 + bofs;
-+#endif
-+}
-+
-+static inline unsigned long
-+find_next_bit(void * addr, unsigned long size, unsigned long offset)
-+{
-+ unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
-+ unsigned long result = offset & ~63UL;
-+ unsigned long tmp;
-+
-+ if (offset >= size)
-+ return size;
-+ size -= result;
-+ offset &= 63UL;
-+ if (offset) {
-+ tmp = *(p++);
-+ tmp &= ~0UL << offset;
-+ if (size < 64)
-+ goto found_first;
-+ if (tmp)
-+ goto found_middle;
-+ size -= 64;
-+ result += 64;
-+ }
-+ while (size & ~63UL) {
-+ if ((tmp = *(p++)))
-+ goto found_middle;
-+ result += 64;
-+ size -= 64;
-+ }
-+ if (!size)
-+ return result;
-+ tmp = *p;
-+ found_first:
-+ tmp &= ~0UL >> (64 - size);
-+ if (!tmp)
-+ return result + size;
-+ found_middle:
-+ return result + __ffs(tmp);
-+}
-+#elif defined(USE_GENERIC_FIND_NEXT_BIT)
-+
-+#if BITS_PER_LONG == 32
-+#define _xFFFF 31ul
-+#define _x10000 32
-+#define _xSHIFT 5
-+#elif BITS_PER_LONG == 64
-+#define _xFFFF 63ul
-+#define _x10000 64
-+#define _xSHIFT 6
-+#else
-+#error "Unexpected BITS_PER_LONG"
-+#endif
-+
-+/* slightly large to be inlined, but anyways... */
-+static inline unsigned long
-+find_next_bit(void * addr, unsigned long size, unsigned long offset)
-+{
-+ unsigned long * p = ((unsigned long *) addr) + (offset >> _xSHIFT);
-+ unsigned long result = offset & ~_xFFFF;
-+ unsigned long tmp;
-+
-+ if (offset >= size)
-+ return size;
-+ size -= result;
-+ offset &= _xFFFF;
-+ if (offset) {
-+ tmp = *(p++);
-+ tmp &= ~0UL << offset;
-+ if (size < _x10000)
-+ goto found_first;
-+ if (tmp)
-+ goto found_middle;
-+ size -= _x10000;
-+ result += _x10000;
-+ }
-+ while (size & ~_xFFFF) {
-+ if ((tmp = *(p++)))
-+ goto found_middle;
-+ result += _x10000;
-+ size -= _x10000;
-+ }
-+ if (!size)
-+ return result;
-+ tmp = *p;
-+ found_first:
-+ tmp &= ~0UL >> (_x10000 - size);
-+ if (!tmp)
-+ return result + size;
-+ found_middle: /* if this is reached, we know that (tmp != 0) */
-+ return result + generic_ffs(tmp)-1;
-+}
-+
-+#undef _xFFFF
-+#undef _x10000
-+#undef _xSHIFT
-+
-+#elif !defined(__powerpc64__) /* ppc64 is taken care of, see drbd_bitmap.c */
-+#warning "You probably need to copy find_next_bit() from a 2.6.x kernel."
-+#warning "Or enable low performance generic C-code"
-+#warning "(USE_GENERIC_FIND_NEXT_BIT in drbd_config.h)"
-+#endif
-+
-+#endif /* HAVE_FIND_NEXT_BIT } */
-+
-+#ifndef ALIGN
-+#define ALIGN(x,a) ( ((x) + (a)-1) &~ ((a)-1) )
-+#endif
-+
-+#ifndef BUG_ON
-+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-+#endif
-+
-+#else // LINUX 2.6
-+
-+typedef struct bio drbd_bio_t;
-+
-+#define SIGHAND_HACK
-+
-+#define NOT_IN_26(x...)
-+#define ONLY_IN_26(x...) x
-+
-+#endif
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_compat_wrappers.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,653 @@
-+// currently only abstraction layer to get all references to buffer_head
-+// and b_some_thing out of our .c files.
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+
-+#define __module_get __MOD_INC_USE_COUNT
-+#define module_put __MOD_DEC_USE_COUNT
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
-+/*
-+ * dump_stack() showed up in 2.4.20.
-+ * show_stack is arch-specific
-+ * The architecture-independent backtrace generator
-+ */
-+static inline void dump_stack(void)
-+{
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,18)
-+ // It seems that before 2.4.18 even show_stack is not available.
-+ show_stack(0);
-+#endif
-+}
-+#endif
-+
-+// b_end_io handlers
-+extern void drbd_md_io_complete (struct buffer_head *bh, int uptodate);
-+extern void enslaved_read_bi_end_io (struct buffer_head *bh, int uptodate);
-+extern void drbd_dio_end_sec (struct buffer_head *bh, int uptodate);
-+extern void drbd_dio_end (struct buffer_head *bh, int uptodate);
-+extern void drbd_read_bi_end_io (struct buffer_head *bh, int uptodate);
-+
-+/*
-+ * because in 2.6.x [sg]et_capacity operate on gendisk->capacity, which is in
-+ * units of 512 bytes sectors, these wrappers have a <<1 or >>1 where
-+ * appropriate.
-+ */
-+
-+static inline sector_t drbd_get_hardsect(kdev_t dev)
-+{
-+ return hardsect_size[MAJOR(dev)] ?
-+ hardsect_size[MAJOR(dev)][MINOR(dev)] : 512;
-+}
-+
-+/* Returns the number of 512 byte sectors of the device */
-+static inline sector_t drbd_get_capacity(kdev_t dev)
-+{
-+ return dev ? blk_size[MAJOR(dev)][MINOR(dev)]<<1 : 0;
-+}
-+
-+/* sets the number of 512 byte sectors of our virtual device */
-+static inline void drbd_set_my_capacity(drbd_dev *mdev, sector_t size)
-+{
-+ blk_size[MAJOR_NR][(int)(mdev - drbd_conf)] = (size>>1);
-+}
-+
-+//#warning "FIXME why don't we care for the return value?"
-+static inline void drbd_set_blocksize(drbd_dev *mdev, int blksize)
-+{
-+ set_blocksize(mdev->this_bdev, blksize);
-+ if (mdev->backing_bdev)
-+ set_blocksize(mdev->backing_bdev, blksize);
-+ else D_ASSERT(mdev->backing_bdev);
-+}
-+
-+static inline int drbd_sync_me(drbd_dev *mdev)
-+{
-+ return fsync_dev(mdev->this_bdev);
-+}
-+
-+#define drbd_bio_uptodate(bio) buffer_uptodate(bio)
-+
-+static inline void drbd_bio_IO_error(struct buffer_head *bh)
-+{
-+ buffer_IO_error(bh);
-+}
-+
-+static inline void drbd_bio_endio(struct buffer_head *bh, int uptodate)
-+{
-+ bh->b_end_io(bh,uptodate);
-+}
-+
-+static inline drbd_dev* drbd_req_get_mdev(struct drbd_request *req)
-+{
-+ return (drbd_dev*) req->private_bio.b_private;
-+}
-+
-+static inline sector_t drbd_req_get_sector(struct drbd_request *req)
-+{
-+ return req->private_bio.b_blocknr;
-+}
-+
-+static inline unsigned short drbd_req_get_size(struct drbd_request *req)
-+{
-+ return req->private_bio.b_size;
-+}
-+
-+static inline drbd_bio_t* drbd_req_private_bio(struct drbd_request *req)
-+{
-+ return &req->private_bio;
-+}
-+
-+static inline sector_t drbd_ee_get_sector(struct Tl_epoch_entry *ee)
-+{
-+ return ee->private_bio.b_blocknr;
-+}
-+
-+static inline unsigned short drbd_ee_get_size(struct Tl_epoch_entry *ee)
-+{
-+ return ee->private_bio.b_size;
-+}
-+
-+static inline char *drbd_bio_kmap(struct buffer_head *bh)
-+{
-+ return bh_kmap(bh);
-+}
-+
-+static inline void drbd_bio_kunmap(struct buffer_head *bh)
-+{
-+ bh_kunmap(bh);
-+}
-+
-+static inline void drbd_ee_init(struct Tl_epoch_entry *e,struct page *page)
-+{
-+ struct buffer_head * const bh = &e->private_bio;
-+ memset(e, 0, sizeof(*e));
-+
-+ // bh->b_list = BUF_LOCKED; // does it matter?
-+ bh->b_size = PAGE_SIZE;
-+ bh->b_this_page = bh;
-+ bh->b_state = (1 << BH_Mapped);
-+ init_waitqueue_head(&bh->b_wait);
-+ set_bh_page(bh,page,0);
-+ atomic_set(&bh->b_count, 1);
-+
-+ e->block_id = ID_VACANT;
-+}
-+
-+static inline void drbd_bio_set_pages_dirty(struct buffer_head *bh)
-+{
-+ set_bit(BH_Dirty, &bh->b_state);
-+}
-+
-+static inline void drbd_bio_set_end_io(struct buffer_head *bh, bh_end_io_t * h)
-+{
-+ bh->b_end_io = h;
-+}
-+
-+static inline void
-+drbd_ee_bh_prepare(drbd_dev *mdev, struct buffer_head *bh,
-+ sector_t sector, int size)
-+{
-+ D_ASSERT(mdev->backing_bdev);
-+
-+ bh->b_blocknr = sector; // We abuse b_blocknr here.
-+ bh->b_size = size;
-+ bh->b_rsector = sector;
-+ bh->b_rdev = mdev->backing_bdev;
-+ bh->b_private = mdev;
-+ bh->b_state = (1 << BH_Req)
-+ |(1 << BH_Mapped)
-+ |(1 << BH_Lock);
-+}
-+
-+static inline void
-+drbd_ee_prepare_write(drbd_dev *mdev, struct Tl_epoch_entry* e,
-+ sector_t sector, int size)
-+{
-+ struct buffer_head * const bh = &e->private_bio;
-+
-+ drbd_ee_bh_prepare(mdev,bh,sector,size);
-+ set_bit(BH_Uptodate,&bh->b_state);
-+ set_bit(BH_Dirty,&bh->b_state);
-+ bh->b_end_io = drbd_dio_end_sec;
-+}
-+
-+static inline void
-+drbd_ee_prepare_read(drbd_dev *mdev, struct Tl_epoch_entry* e,
-+ sector_t sector, int size)
-+{
-+ struct buffer_head * const bh = &e->private_bio;
-+
-+ drbd_ee_bh_prepare(mdev,bh,sector,size);
-+ bh->b_end_io = enslaved_read_bi_end_io;
-+}
-+
-+static inline void
-+drbd_bh_clone(struct buffer_head *bh, struct buffer_head *bh_src)
-+{
-+ memset(bh,0,sizeof(*bh));
-+ bh->b_list = bh_src->b_list; // BUF_LOCKED;
-+ bh->b_size = bh_src->b_size;
-+ bh->b_state = bh_src->b_state & ((1 << BH_PrivateStart)-1);
-+ bh->b_page = bh_src->b_page;
-+ bh->b_data = bh_src->b_data;
-+ bh->b_rsector = bh_src->b_rsector;
-+ bh->b_blocknr = bh_src->b_rsector; // We abuse b_blocknr here.
-+ bh->b_dev = bh_src->b_dev; // hint for LVM as to
-+ // which device to call fsync_dev
-+ // on for snapshots
-+ atomic_set(&bh->b_count, 1);
-+ init_waitqueue_head(&bh->b_wait);
-+ // other members stay NULL
-+}
-+
-+static inline void
-+drbd_req_prepare_write(drbd_dev *mdev, struct drbd_request *req)
-+{
-+ struct buffer_head * const bh = &req->private_bio;
-+ struct buffer_head * const bh_src = req->master_bio;
-+
-+ drbd_bh_clone(bh,bh_src);
-+ bh->b_rdev = mdev->backing_bdev;
-+ bh->b_private = mdev;
-+ bh->b_end_io = drbd_dio_end;
-+
-+ D_ASSERT(buffer_req(bh));
-+ D_ASSERT(buffer_locked(bh));
-+ D_ASSERT(buffer_mapped(bh));
-+ // D_ASSERT(buffer_dirty(bh)); // It is not true ?!?
-+ /* kupdated keeps submitting "non-uptodate" buffers.
-+ ERR_IF (!buffer_uptodate(bh)) {
-+ ERR("[%s/%d]: bh_src->b_state=%lx bh->b_state=%lx\n",
-+ current->comm, current->pid,
-+ bh_src->b_state, bh->b_state);
-+ };
-+ */
-+
-+ // FIXME should not be necessary;
-+ // remove if the assertions above do not trigger.
-+ bh->b_state = (1 << BH_Uptodate)
-+ |(1 << BH_Dirty)
-+ |(1 << BH_Lock)
-+ |(1 << BH_Req)
-+ |(1 << BH_Mapped) ;
-+
-+ req->rq_status = RQ_DRBD_NOTHING;
-+}
-+
-+static inline void
-+drbd_req_prepare_read(drbd_dev *mdev, struct drbd_request *req)
-+{
-+ struct buffer_head * const bh = &req->private_bio;
-+ struct buffer_head * const bh_src = req->master_bio;
-+
-+ drbd_bh_clone(bh,bh_src);
-+ bh->b_rdev = mdev->backing_bdev;
-+ bh->b_private = mdev;
-+ bh->b_end_io = drbd_read_bi_end_io;
-+
-+ D_ASSERT(buffer_req(bh));
-+ D_ASSERT(buffer_locked(bh));
-+ D_ASSERT(buffer_mapped(bh));
-+ D_ASSERT(!buffer_uptodate(bh));
-+
-+ // FIXME should not be necessary;
-+ // remove if the assertions above do not trigger.
-+ bh->b_state = (1 << BH_Lock)
-+ |(1 << BH_Req)
-+ |(1 << BH_Mapped) ;
-+
-+ req->rq_status = RQ_DRBD_NOTHING;
-+}
-+
-+static inline struct page* drbd_bio_get_page(struct buffer_head *bh)
-+{
-+ return bh->b_page;
-+}
-+
-+static inline void drbd_generic_make_request(int rw, struct buffer_head *bh)
-+{
-+ drbd_dev *mdev = drbd_conf -1 ;
-+
-+ if (!bh->b_rdev) {
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ printk(KERN_ERR "drbd_generic_make_request: bh->b_rdev == NULL\n");
-+ dump_stack();
-+ }
-+ drbd_bio_IO_error(bh);
-+ return;
-+ }
-+
-+ generic_make_request(rw, bh);
-+}
-+
-+static inline void drbd_kick_lo(drbd_dev *mdev)
-+{
-+ run_task_queue(&tq_disk);
-+}
-+
-+static inline void drbd_plug_device(drbd_dev *mdev)
-+{
-+ D_ASSERT(mdev->state == Primary);
-+ if (mdev->cstate < Connected)
-+ return;
-+ if (!test_and_set_bit(UNPLUG_QUEUED,&mdev->flags)) {
-+ /* if it could not be queued, clear our flag again, too */
-+ if (!queue_task(&mdev->write_hint_tq, &tq_disk))
-+ clear_bit(UNPLUG_QUEUED,&mdev->flags);
-+ }
-+}
-+
-+/* for increased performance,
-+ * we try to use zero copy network send whenever possible.
-+ *
-+ * maybe TODO:
-+ * find out whether we can use zero copy network recv, too, somehow.
-+ * we'd need to define some sk_read_actor_t, and then use
-+ * tcp_read_sock ...
-+ */
-+static inline int _drbd_send_zc_bio(drbd_dev *mdev, struct buffer_head *bh)
-+{
-+ struct page *page = bh->b_page;
-+ size_t size = bh->b_size;
-+
-+ return _drbd_send_page(mdev,page,bh_offset(bh),size);
-+}
-+
-+/* for proto A, we cannot use zero copy network send:
-+ * we don't want to "ack" a send when we put a reference to it on the socket,
-+ * but when it actually has reached the sendbuffer (so is likely to actually be
-+ * on the wire in a couple of jiffies).
-+ */
-+static inline int _drbd_send_bio(drbd_dev *mdev, struct buffer_head *bh)
-+{
-+ size_t size = bh->b_size;
-+ int ret;
-+
-+ ret = drbd_send(mdev, mdev->data.socket, bh_kmap(bh), size, 0);
-+ bh_kunmap(bh);
-+ return ret;
-+}
-+
-+#else
-+// LINUX_VERSION_CODE > 2,5,0
-+
-+#include <linux/buffer_head.h> // for fsync_bdev
-+
-+/* see get_sb_bdev and bd_claim */
-+extern char* drbd_sec_holder;
-+
-+// bi_end_io handlers
-+// int (bio_end_io_t) (struct bio *, unsigned int, int);
-+extern int drbd_md_io_complete (struct bio *bio, unsigned int bytes_done, int error);
-+extern int enslaved_read_bi_end_io (struct bio *bio, unsigned int bytes_done, int error);
-+extern int drbd_dio_end_sec (struct bio *bio, unsigned int bytes_done, int error);
-+extern int drbd_dio_end (struct bio *bio, unsigned int bytes_done, int error);
-+extern int drbd_read_bi_end_io (struct bio *bio, unsigned int bytes_done, int error);
-+
-+static inline sector_t drbd_get_hardsect(struct block_device *bdev)
-+{
-+ return bdev->bd_disk->queue->hardsect_size;
-+}
-+
-+/* Returns the number of 512 byte sectors of the device */
-+static inline sector_t drbd_get_capacity(struct block_device *bdev)
-+{
-+ return bdev ? bdev->bd_inode->i_size >> 9 : 0;
-+}
-+
-+/* sets the number of 512 byte sectors of our virtual device */
-+static inline void drbd_set_my_capacity(drbd_dev *mdev, sector_t size)
-+{
-+ set_capacity(mdev->vdisk,size);
-+ mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
-+}
-+
-+//#warning "FIXME why don't we care for the return value?"
-+static inline void drbd_set_blocksize(drbd_dev *mdev, int blksize)
-+{
-+ set_blocksize(mdev->this_bdev,blksize);
-+ if (mdev->backing_bdev) {
-+ set_blocksize(mdev->backing_bdev, blksize);
-+ } else {
-+ D_ASSERT(mdev->backing_bdev);
-+ // FIXME send some package over to the peer?
-+ }
-+}
-+
-+static inline int drbd_sync_me(drbd_dev *mdev)
-+{
-+ return fsync_bdev(mdev->this_bdev);
-+}
-+
-+#define drbd_bio_uptodate(bio) bio_flagged(bio,BIO_UPTODATE)
-+
-+static inline void drbd_bio_IO_error(struct bio *bio)
-+{
-+ bio_endio(bio,bio->bi_size,-EIO);
-+}
-+
-+static inline void drbd_bio_endio(struct bio *bio, int uptodate)
-+{
-+ bio_endio(bio,bio->bi_size,uptodate ? 0 : -EIO);
-+}
-+
-+static inline drbd_dev* drbd_req_get_mdev(struct drbd_request *req)
-+{
-+ return (drbd_dev*) req->mdev;
-+}
-+
-+static inline sector_t drbd_req_get_sector(struct drbd_request *req)
-+{
-+ return req->master_bio->bi_sector;
-+}
-+
-+static inline unsigned short drbd_req_get_size(struct drbd_request *req)
-+{
-+ drbd_dev* mdev = req->mdev;
-+ D_ASSERT(req->master_bio->bi_size);
-+ return req->master_bio->bi_size;
-+}
-+
-+static inline drbd_bio_t* drbd_req_private_bio(struct drbd_request *req)
-+{
-+ return req->private_bio;
-+}
-+
-+static inline sector_t drbd_ee_get_sector(struct Tl_epoch_entry *ee)
-+{
-+ return ee->ee_sector;
-+}
-+
-+static inline unsigned short drbd_ee_get_size(struct Tl_epoch_entry *ee)
-+{
-+ return ee->ee_size;
-+}
-+
-+#ifdef CONFIG_HIGHMEM
-+/*
-+ * I don't know why there is no bvec_kmap, only bvec_kmap_irq ...
-+ *
-+ * we do a sock_recvmsg into the target buffer,
-+ * so we obviously cannot use the bvec_kmap_irq variant. -lge
-+ *
-+ * Most likely it is only due to performance anyways:
-+ * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
-+ * no global lock is needed and because the kmap code must perform a global TLB
-+ * invalidation when the kmap pool wraps.
-+ *
-+ * However when holding an atomic kmap is is not legal to sleep, so atomic
-+ * kmaps are appropriate for short, tight code paths only.
-+ */
-+static inline char *drbd_bio_kmap(struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec(bio);
-+ unsigned long addr;
-+
-+ addr = (unsigned long) kmap(bvec->bv_page);
-+
-+ if (addr & ~PAGE_MASK)
-+ BUG();
-+
-+ return (char *) addr + bvec->bv_offset;
-+}
-+
-+static inline void drbd_bio_kunmap(struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec(bio);
-+
-+ kunmap(bvec->bv_page);
-+}
-+
-+#else
-+static inline char *drbd_bio_kmap(struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec(bio);
-+ return page_address(bvec->bv_page) + bvec->bv_offset;
-+}
-+static inline void drbd_bio_kunmap(struct bio *bio)
-+{
-+ // do nothing.
-+}
-+#endif
-+
-+static inline void drbd_ee_init(struct Tl_epoch_entry *e,struct page *page)
-+{
-+ struct bio * const bio = &e->private_bio;
-+ struct bio_vec * const vec = &e->ee_bvec;
-+
-+ memset(e, 0, sizeof(*e));
-+ bio_init(bio);
-+
-+ bio->bi_io_vec = vec;
-+ bio->bi_destructor = NULL;
-+ vec->bv_page = page;
-+ bio->bi_size = vec->bv_len = PAGE_SIZE;
-+ bio->bi_max_vecs = bio->bi_vcnt = 1;
-+ vec->bv_offset = 0;
-+
-+ e->block_id = ID_VACANT;
-+}
-+
-+static inline void drbd_bio_set_pages_dirty(struct bio *bio)
-+{
-+ bio_set_pages_dirty(bio);
-+}
-+
-+static inline void drbd_bio_set_end_io(struct bio *bio, bio_end_io_t * h)
-+{
-+ bio->bi_end_io = h;
-+}
-+
-+static inline void
-+drbd_ee_bio_prepare(drbd_dev *mdev, struct Tl_epoch_entry* e,
-+ sector_t sector, int size)
-+{
-+ struct bio * const bio = &e->private_bio;
-+ struct bio_vec * const vec = &e->ee_bvec;
-+ struct page * const page = vec->bv_page;
-+ D_ASSERT(mdev->backing_bdev);
-+
-+ /* Clear plate. */
-+ bio_init(bio);
-+
-+ bio->bi_io_vec = vec;
-+ bio->bi_destructor = NULL;
-+ vec->bv_page = page;
-+ vec->bv_offset = 0;
-+ bio->bi_max_vecs = bio->bi_vcnt = 1;
-+
-+ bio->bi_bdev = mdev->backing_bdev;
-+ bio->bi_private = mdev;
-+
-+ e->ee_sector = bio->bi_sector = sector;
-+ e->ee_size = bio->bi_size = bio->bi_io_vec->bv_len = size;
-+}
-+
-+static inline void
-+drbd_ee_prepare_write(drbd_dev *mdev, struct Tl_epoch_entry* e,
-+ sector_t sector, int size)
-+{
-+ drbd_ee_bio_prepare(mdev,e,sector,size);
-+ e->private_bio.bi_end_io = drbd_dio_end_sec;
-+}
-+
-+static inline void
-+drbd_ee_prepare_read(drbd_dev *mdev, struct Tl_epoch_entry* e,
-+ sector_t sector, int size)
-+{
-+ drbd_ee_bio_prepare(mdev,e,sector,size);
-+ e->private_bio.bi_end_io = enslaved_read_bi_end_io;
-+}
-+
-+static inline void
-+drbd_req_prepare_write(drbd_dev *mdev, struct drbd_request *req)
-+{
-+ struct bio *bio;
-+
-+ bio = req->private_bio = bio_clone(req->master_bio, GFP_NOIO );
-+ bio->bi_bdev = mdev->backing_bdev;
-+ bio->bi_private = req;
-+ bio->bi_end_io = drbd_dio_end;
-+ bio->bi_next = 0;
-+
-+ req->rq_status = RQ_DRBD_NOTHING;
-+ req->mdev = mdev;
-+}
-+
-+static inline void
-+drbd_req_prepare_read(drbd_dev *mdev, struct drbd_request *req)
-+{
-+ struct bio *bio;
-+
-+ bio = req->private_bio = bio_clone(req->master_bio, GFP_NOIO );
-+ bio->bi_bdev = mdev->backing_bdev;
-+ bio->bi_private = req;
-+ bio->bi_end_io = drbd_read_bi_end_io; // <- only difference
-+ bio->bi_next = 0;
-+
-+ req->rq_status = RQ_DRBD_NOTHING;
-+ req->mdev = mdev;
-+}
-+
-+static inline struct page* drbd_bio_get_page(struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec(bio);
-+ return bvec->bv_page;
-+}
-+
-+/*
-+ * used to submit our private bio
-+ */
-+static inline void drbd_generic_make_request(int rw, struct bio *bio)
-+{
-+ drbd_dev *mdev = drbd_conf -1; // for DRBD_ratelimit
-+ bio->bi_rw = rw; // on the receiver side, e->..rw was not yet defined.
-+
-+ if (!bio->bi_bdev) {
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ printk(KERN_ERR "drbd_generic_make_request: bio->bi_bdev == NULL\n");
-+ dump_stack();
-+ }
-+ drbd_bio_IO_error(bio);
-+ return;
-+ }
-+
-+ generic_make_request(bio);
-+}
-+
-+static inline void drbd_blk_run_queue(request_queue_t *q)
-+{
-+ if (q && q->unplug_fn)
-+ q->unplug_fn(q);
-+}
-+
-+static inline void drbd_kick_lo(drbd_dev *mdev)
-+{
-+ if (!mdev->backing_bdev) {
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ ERR("backing_bdev==NULL in drbd_kick_lo\n");
-+ dump_stack();
-+ }
-+ } else {
-+ drbd_blk_run_queue(bdev_get_queue(mdev->backing_bdev));
-+ }
-+}
-+
-+static inline void drbd_plug_device(drbd_dev *mdev)
-+{
-+ request_queue_t *q = bdev_get_queue(mdev->this_bdev);
-+
-+ spin_lock_irq(q->queue_lock);
-+
-+/* XXX the check on !blk_queue_plugged is redundant,
-+ * implicitly checked in blk_plug_device */
-+
-+ if(!blk_queue_plugged(q)) {
-+ blk_plug_device(q);
-+ del_timer(&q->unplug_timer);
-+ // unplugging should not happen automatically...
-+ }
-+ spin_unlock_irq(q->queue_lock);
-+}
-+
-+static inline int _drbd_send_zc_bio(drbd_dev *mdev, struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec_idx(bio, bio->bi_idx);
-+ return _drbd_send_page(mdev,bvec->bv_page,bvec->bv_offset,bvec->bv_len);
-+}
-+
-+static inline int _drbd_send_bio(drbd_dev *mdev, struct bio *bio)
-+{
-+ struct bio_vec *bvec = bio_iovec(bio);
-+ struct page *page = bvec->bv_page;
-+ size_t size = bvec->bv_len;
-+ int offset = bvec->bv_offset;
-+ int ret;
-+
-+ ret = drbd_send(mdev, mdev->data.socket, kmap(page) + offset, size, 0);
-+ kunmap(page);
-+ return ret;
-+}
-+
-+#endif
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_fs.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,1460 @@
-+/*
-+-*- linux-c -*-
-+ drbd_fs.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ Copyright (C) 2000, Fábio Olivé Leite <olive@conectiva.com.br>.
-+ Some sanity checks in IOCTL_SET_STATE.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+
-+#include <asm/uaccess.h>
-+#include <linux/in.h>
-+#include <linux/fs.h>
-+#include <linux/file.h>
-+#include <linux/slab.h>
-+#include <linux/utsname.h>
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+#include <linux/blkpg.h>
-+
-+ONLY_IN_26(
-+/* see get_sb_bdev and bd_claim */
-+char *drbd_sec_holder = "Secondary DRBD cannot be bd_claimed ;)";
-+char *drbd_m_holder = "Hands off! this is DRBD's meta data device.";
-+)
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+STATIC enum { NotMounted=0,MountedRO,MountedRW } drbd_is_mounted(int minor)
-+{
-+ struct super_block *sb;
-+
-+ sb = get_super(MKDEV(MAJOR_NR, minor));
-+ if(!sb) return NotMounted;
-+
-+ if(sb->s_flags & MS_RDONLY) {
-+ drop_super(sb);
-+ return MountedRO;
-+ }
-+
-+ drop_super(sb);
-+ return MountedRW;
-+}
-+#endif
-+
-+char* ppsize(char* buf, size_t size)
-+{
-+ // Needs 9 bytes at max.
-+ static char units[] = { 'K','M','G','T' };
-+ int base = 0;
-+ while (size >= 10000 ) {
-+ size = size >> 10;
-+ base++;
-+ }
-+ sprintf(buf,"%ld %cB",(long)size,units[base]);
-+
-+ return buf;
-+}
-+
-+/* Returns -ENOMEM if we could not allocate the bitmap
-+ *
-+ * currently *_size is in KB.
-+ *
-+ * FIXME
-+ * since this is done by drbd receiver as well as from drbdsetup,
-+ * this actually needs proper locking!
-+ * drbd_bm_resize already protects itself with a mutex.
-+ * but again, this is a state change, and thus should be serialized with other
-+ * state changes on a more general level already.
-+ */
-+int drbd_determin_dev_size(struct Drbd_Conf* mdev)
-+{
-+ sector_t pmdss; // previous meta data start sector
-+ sector_t la_size;
-+ sector_t size;
-+ char ppb[10];
-+
-+ int md_moved, la_size_changed;
-+ int rv=0;
-+
-+ wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
-+ pmdss = drbd_md_ss(mdev);
-+ la_size = mdev->la_size;
-+
-+ size = drbd_new_dev_size(mdev);
-+
-+ if( (drbd_get_capacity(mdev->this_bdev)>>1) != size ) {
-+ int err;
-+ err = drbd_bm_resize(mdev,size<<1); // wants sectors
-+ if (unlikely(err)) {
-+ /* currently there is only one error: ENOMEM! */
-+ size = drbd_bm_capacity(mdev)>>1;
-+ if (size == 0) {
-+ ERR("OUT OF MEMORY! Could not allocate bitmap! Set device size => 0\n");
-+ } else {
-+ /* FIXME this is problematic,
-+ * if we in fact are smaller now! */
-+ ERR("BM resizing failed. "
-+ "Leaving size unchanged at size = %lu KB\n",
-+ (unsigned long)size);
-+ }
-+ rv = err;
-+ }
-+ // racy, see comments above.
-+ drbd_set_my_capacity(mdev,size<<1);
-+ mdev->la_size = size;
-+ INFO("size = %s (%lu KB)\n",ppsize(ppb,size),
-+ (unsigned long)size);
-+ }
-+ if (rv < 0) goto out;
-+
-+ la_size_changed = (la_size != mdev->la_size);
-+ md_moved = pmdss != drbd_md_ss(mdev) /* && mdev->md_index == -1 */;
-+
-+ if ( md_moved ) {
-+ WARN("Moving meta-data.\n");
-+ D_ASSERT(mdev->md_index == -1);
-+ }
-+
-+ if ( la_size_changed || md_moved ) {
-+ if( inc_local_md_only(mdev)) {
-+ drbd_al_shrink(mdev); // All extents inactive.
-+ drbd_bm_write(mdev); // write bitmap
-+ // Write mdev->la_size to on disk.
-+ drbd_md_write(mdev);
-+ dec_local(mdev);
-+ }
-+ }
-+ out:
-+ lc_unlock(mdev->act_log);
-+
-+ return rv;
-+}
-+
-+/*
-+ * currently *_size is in KB.
-+ */
-+sector_t drbd_new_dev_size(struct Drbd_Conf* mdev)
-+{
-+ sector_t p_size = mdev->p_size; // partner's disk size.
-+ sector_t la_size = mdev->la_size; // last agreed size.
-+ sector_t m_size; // my size
-+ sector_t u_size = mdev->lo_usize; // size requested by user.
-+ sector_t size=0;
-+
-+ m_size = drbd_get_capacity(mdev->backing_bdev)>>1;
-+
-+ if (mdev->md_index == -1 && m_size) {// internal metadata
-+ D_ASSERT(m_size > MD_RESERVED_SIZE);
-+ m_size = drbd_md_ss(mdev)>>1;
-+ }
-+
-+ if(p_size && m_size) {
-+ size=min_t(sector_t,p_size,m_size);
-+ } else {
-+ if(la_size) {
-+ size=la_size;
-+ if(m_size && m_size < size) size=m_size;
-+ if(p_size && p_size < size) size=p_size;
-+ } else {
-+ if(m_size) size=m_size;
-+ if(p_size) size=p_size;
-+ }
-+ }
-+
-+ if(size == 0) {
-+ ERR("Both nodes diskless!\n");
-+ }
-+
-+ if(u_size) {
-+ if(u_size > size) {
-+ ERR("Requested disk size is too big (%lu > %lu)\n",
-+ (unsigned long)u_size, (unsigned long)size);
-+ } else {
-+ size = u_size;
-+ }
-+ }
-+
-+ return size;
-+}
-+
-+/* checks that the al lru is of requested size, and if neccessary tries to
-+ * allocate a new one. returns -EBUSY if current al lru is still used,
-+ * -ENOMEM when allocation failed, and 0 on success.
-+ */
-+STATIC int drbd_check_al_size(drbd_dev *mdev)
-+{
-+ struct lru_cache *n,*t;
-+ struct lc_element *e;
-+ unsigned int in_use;
-+ int i;
-+
-+ ERR_IF(mdev->sync_conf.al_extents < 7)
-+ mdev->sync_conf.al_extents = 127;
-+
-+ if ( mdev->act_log &&
-+ mdev->act_log->nr_elements == mdev->sync_conf.al_extents )
-+ return 0;
-+
-+ in_use = 0;
-+ t = mdev->act_log;
-+ n = lc_alloc(mdev->sync_conf.al_extents,
-+ sizeof(struct lc_element), mdev);
-+
-+ if (n==NULL) {
-+ ERR("Cannot allocate act_log lru!\n");
-+ return -ENOMEM;
-+ }
-+ spin_lock_irq(&mdev->al_lock);
-+ if (t) {
-+ for (i=0; i < t->nr_elements; i++) {
-+ e = lc_entry(t,i);
-+ if (e->refcnt)
-+ ERR("refcnt(%d)==%d\n",
-+ e->lc_number, e->refcnt);
-+ in_use += e->refcnt;
-+ }
-+ }
-+ if (!in_use) {
-+ mdev->act_log = n;
-+ }
-+ spin_unlock_irq(&mdev->al_lock);
-+ if (in_use) {
-+ ERR("Activity log still in use!\n");
-+ lc_free(n);
-+ return -EBUSY;
-+ } else {
-+ if (t) lc_free(t);
-+ }
-+ drbd_md_write(mdev);
-+ return 0;
-+}
-+
-+STATIC int drbd_detach_ioctl(drbd_dev *mdev);
-+
-+STATIC
-+int drbd_ioctl_set_disk(struct Drbd_Conf *mdev,
-+ struct ioctl_disk_config * arg)
-+{
-+ NOT_IN_26(int err;) // unused in 26 ?? cannot believe it ...
-+ int i, md_gc_valid, minor, mput=0, apply_al;
-+ enum ret_codes retcode;
-+ struct disk_config new_conf;
-+ struct file *filp = 0;
-+ struct file *filp2 = 0;
-+ struct inode *inode, *inode2;
-+ NOT_IN_26(kdev_t bdev, bdev2;)
-+ ONLY_IN_26(struct block_device *bdev, *bdev2;)
-+
-+ minor=(int)(mdev-drbd_conf);
-+
-+ /* if you want to reconfigure, please tear down first */
-+ smp_rmb();
-+ if (!test_bit(DISKLESS,&mdev->flags))
-+ return -EBUSY;
-+
-+ /* if this was "adding" a lo dev to a previously "diskless" node,
-+ * there still could be requests comming in right now. brrks.
-+ * if it was mounted, we had an open_cnt > 1,
-+ * so it would be BUSY anyways...
-+ */
-+ ERR_IF (mdev->state != Secondary)
-+ return -EBUSY;
-+
-+ if (mdev->open_cnt > 1)
-+ return -EBUSY;
-+
-+ if (copy_from_user(&new_conf, &arg->config,sizeof(struct disk_config)))
-+ return -EFAULT;
-+
-+ /* FIXME
-+ * I'd like to do it here, so I can just fail this ioctl with ENOMEM.
-+ * but drbd_md_read below might change the al_nr_extens again, so need
-+ * to do it there again anyways...
-+ * but then I already changed it all and cannot easily undo it..
-+ * for now, do it there, but then if it fails, rather panic than later
-+ * have a NULL pointer dereference.
-+ *
-+ i = drbd_check_al_size(mdev);
-+ if (i) return i;
-+ *
-+ */
-+
-+ if (mdev->cstate == Unconfigured) {
-+ // ioctl already has a refcnt
-+ __module_get(THIS_MODULE);
-+ mput = 1;
-+ } else {
-+ /* We currently cannot handle reattach while connected */
-+ return -EBUSY;
-+
-+ /* FIXME allow reattach while connected,
-+ * and allow it in Primary/Diskless state...
-+ * currently there are strange races leading to a distributed
-+ * deadlock in that case...
-+ */
-+ if ( mdev->cstate != StandAlone /* &&
-+ mdev->cstate != Connected */) {
-+ return -EBUSY;
-+ }
-+ }
-+
-+ if ( new_conf.meta_index < -1) {
-+ retcode=LDMDInvalid;
-+ goto fail_ioctl;
-+ }
-+
-+ filp = fget(new_conf.lower_device);
-+ if (!filp) {
-+ retcode=LDFDInvalid;
-+ goto fail_ioctl;
-+ }
-+
-+ inode = filp->f_dentry->d_inode;
-+
-+ if (!S_ISBLK(inode->i_mode)) {
-+ retcode=LDNoBlockDev;
-+ goto fail_ioctl;
-+ }
-+
-+ filp2 = fget(new_conf.meta_device);
-+
-+ if (!filp2) {
-+ retcode=MDFDInvalid;
-+ goto fail_ioctl;
-+ }
-+
-+ inode2 = filp2->f_dentry->d_inode;
-+
-+ if (!S_ISBLK(inode2->i_mode)) {
-+ retcode=MDNoBlockDev;
-+ goto fail_ioctl;
-+ }
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-+ bdev = inode->i_bdev;
-+ if (bd_claim(bdev, mdev)) {
-+ retcode=LDMounted;
-+ goto fail_ioctl;
-+ }
-+
-+ bdev2 = inode2->i_bdev;
-+ if (bd_claim(bdev2, new_conf.meta_index== - 1 ?
-+ (void *)mdev : (void*) drbd_m_holder )) {
-+ retcode=MDMounted;
-+ goto release_bdev_fail_ioctl;
-+ }
-+#else
-+ for(i=0;i<minor_count;i++) {
-+ if( i != minor &&
-+ inode->i_rdev == drbd_conf[i].backing_bdev) {
-+ retcode=LDAlreadyInUse;
-+ goto fail_ioctl;
-+ }
-+ }
-+
-+ if (drbd_is_mounted(inode->i_rdev)) {
-+ WARN("can not configure %d:%d, has active inodes!\n",
-+ MAJOR(inode->i_rdev), MINOR(inode->i_rdev));
-+ retcode=LDMounted;
-+ goto fail_ioctl;
-+ }
-+
-+ if ((err = blkdev_open(inode, filp))) {
-+ ERR("blkdev_open( %d:%d ,) returned %d\n",
-+ MAJOR(inode->i_rdev), MINOR(inode->i_rdev), err);
-+ retcode=LDOpenFailed;
-+ goto fail_ioctl;
-+ }
-+ bdev = inode->i_rdev;
-+
-+ if ((err = blkdev_open(inode2, filp2))) {
-+ ERR("blkdev_open( %d:%d ,) returned %d\n",
-+ MAJOR(inode->i_rdev), MINOR(inode->i_rdev), err);
-+ retcode=MDOpenFailed;
-+ goto release_bdev_fail_ioctl;
-+ }
-+ bdev2 = inode2->i_rdev;
-+#endif
-+
-+ if ( (bdev == bdev2) != (new_conf.meta_index == -1) ) {
-+ retcode=LDMDInvalid;
-+ goto release_bdev2_fail_ioctl;
-+ }
-+
-+ if ((drbd_get_capacity(bdev)>>1) < new_conf.disk_size) {
-+ retcode = LDDeviceTooSmall;
-+ goto release_bdev2_fail_ioctl;
-+ }
-+
-+ if (drbd_get_capacity(bdev) > DRBD_MAX_SECTORS) {
-+ retcode = LDDeviceTooLarge;
-+ goto release_bdev2_fail_ioctl;
-+ }
-+
-+ if ( new_conf.meta_index == -1 ) i = 1;
-+ else i = new_conf.meta_index+1;
-+
-+ /* for internal, we need to check agains <= (then we have a drbd with
-+ * zero size, but meta data...) to be on the safe side, I require 32MB
-+ * minimal data storage area for drbd with internal meta data (thats
-+ * 160 total). if someone wants to use that small devices, she can use
-+ * drbd 0.6 anyways...
-+ *
-+ * FIXME this is arbitrary and needs to be reconsidered as soon as we
-+ * move to flexible size meta data.
-+ */
-+ if( drbd_get_capacity(bdev2) < 2*MD_RESERVED_SIZE*i
-+ + (new_conf.meta_index == -1) ? (1<<16) : 0 )
-+ {
-+ retcode = MDDeviceTooSmall;
-+ goto release_bdev2_fail_ioctl;
-+ }
-+
-+ drbd_free_ll_dev(mdev);
-+
-+ mdev->md_bdev = bdev2;
-+ mdev->md_file = filp2;
-+ mdev->md_index = new_conf.meta_index;
-+
-+ mdev->backing_bdev = bdev;
-+ mdev->lo_file = filp;
-+ mdev->lo_usize = new_conf.disk_size;
-+ mdev->on_io_error = new_conf.on_io_error;
-+
-+ mdev->send_cnt = 0;
-+ mdev->recv_cnt = 0;
-+ mdev->read_cnt = 0;
-+ mdev->writ_cnt = 0;
-+
-+// FIXME unclutter the code again ;)
-+/*
-+ * Returns the minimum that is _not_ zero, unless both are zero.
-+ */
-+#define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
-+ONLY_IN_26({
-+ request_queue_t * const q = mdev->rq_queue;
-+ request_queue_t * const b = bdev->bd_disk->queue;
-+
-+ q->max_sectors = min_not_zero((unsigned short)(PAGE_SIZE >> 9), b->max_sectors);
-+ q->max_phys_segments = 1;
-+ q->max_hw_segments = 1;
-+ q->max_segment_size = min((unsigned)PAGE_SIZE,b->max_segment_size);
-+ q->hardsect_size = max((unsigned short)512,b->hardsect_size);
-+ q->seg_boundary_mask = PAGE_SIZE-1;
-+ D_ASSERT(q->hardsect_size <= PAGE_SIZE); // or we are really screwed ;-)
-+
-+ if( q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
-+ INFO("Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
-+ q->backing_dev_info.ra_pages,
-+ b->backing_dev_info.ra_pages);
-+ q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages;
-+ }
-+
-+})
-+#undef min_not_zero
-+
-+ clear_bit(SENT_DISK_FAILURE,&mdev->flags);
-+ set_bit(MD_IO_ALLOWED,&mdev->flags);
-+
-+/* FIXME I think inc_local_md_only within drbd_md_read is misplaced.
-+ * should go here, and the corresponding dec_local, too.
-+ */
-+
-+ md_gc_valid = drbd_md_read(mdev);
-+
-+/* FIXME if (md_gc_valid < 0) META DATA IO NOT POSSIBLE! */
-+
-+ /* If I am currently not Primary,
-+ * but meta data primary indicator is set,
-+ * I just now recover from a hard crash,
-+ * and have been Primary before that crash.
-+ *
-+ * Now, if I had no connection before that crash
-+ * (have been degraded Primary), chances are that
-+ * I won't find my peer now either.
-+ *
-+ * In that case, and _only_ in that case,
-+ * we use the degr-wfc-timeout instead of the default,
-+ * so we can automatically recover from a crash of a
-+ * degraded but active "cluster" after a certain timeout.
-+ */
-+ clear_bit(USE_DEGR_WFC_T,&mdev->flags);
-+ if ( mdev->state != Primary &&
-+ drbd_md_test_flag(mdev,MDF_PrimaryInd) &&
-+ !drbd_md_test_flag(mdev,MDF_ConnectedInd) ) {
-+ set_bit(USE_DEGR_WFC_T,&mdev->flags);
-+ }
-+
-+ drbd_bm_lock(mdev); // racy...
-+
-+ if(drbd_md_test_flag(mdev,MDF_Consistent) &&
-+ drbd_new_dev_size(mdev) < mdev->la_size ) {
-+ D_ASSERT(mdev->cstate == Unconfigured);
-+ D_ASSERT(mput == 1);
-+ /* Do not attach a too small disk.*/
-+ drbd_bm_unlock(mdev);
-+ ERR("Lower device smaller than last agreed size!\n");
-+ drbd_free_ll_dev(mdev);
-+ set_cstate(mdev,Unconfigured);
-+ retcode = LDDeviceTooSmall;
-+ module_put(THIS_MODULE);
-+ if (put_user(retcode, &arg->ret_code)) return -EFAULT;
-+ return -EINVAL;
-+ }
-+
-+ apply_al = drbd_md_test_flag(mdev,MDF_PrimaryInd);
-+ /* All tests on MDF_PrimaryInd and MDF_ConnectedInd must happen before
-+ this point, because determin_dev_size() might call drbd_md_write(),
-+ which in turn modifies these flags. Exceptions are where, we want
-+ to test the current state (drbd_md_compare(), drbd_send_param()). */
-+
-+ if (drbd_determin_dev_size(mdev) < 0) {
-+ /* could not allocate bitmap.
-+ * try to undo ... */
-+ D_ASSERT(mdev->cstate == Unconfigured);
-+ D_ASSERT(mput == 1);
-+
-+ drbd_bm_unlock(mdev);
-+
-+ /* from drbd_detach_ioctl */
-+ drbd_free_ll_dev(mdev);
-+
-+ set_cstate(mdev,Unconfigured);
-+ drbd_mdev_cleanup(mdev);
-+ module_put(THIS_MODULE);
-+ return -ENOMEM;
-+ }
-+
-+ if (md_gc_valid <= 0) {
-+ INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+ drbd_md_clear_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+ } else { // md_gc_valid > 0
-+ /* FIXME this still does not propagate io errors! */
-+ drbd_bm_read(mdev);
-+ }
-+
-+ i = drbd_check_al_size(mdev);
-+ if (i) {
-+ /* FIXME see the comment above.
-+ * if this fails I need to undo all changes,
-+ * go back into Unconfigured,
-+ * and fail the ioctl with ENOMEM...
-+ */
-+ // return i;
-+ drbd_panic("Cannot allocate act_log\n");
-+ }
-+
-+ if (md_gc_valid > 0) {
-+ i = drbd_al_read_log(mdev);
-+ if (apply_al && i) {
-+ drbd_al_apply_to_bm(mdev);
-+ drbd_al_to_on_disk_bm(mdev);
-+ }
-+ if(!i) {
-+ ERR("IO error on meta device while reading AL\n");
-+ drbd_free_ll_dev(mdev);
-+ set_cstate(mdev,Unconfigured);
-+ retcode = MDIOError;
-+ module_put(THIS_MODULE);
-+ if (put_user(retcode, &arg->ret_code)) return -EFAULT;
-+ return -EINVAL;
-+ }
-+ } /* else {
-+ FIXME wipe out on disk al!
-+ } */
-+
-+ drbd_set_blocksize(mdev,INITIAL_BLOCK_SIZE);
-+
-+ if(mdev->cstate == Unconfigured ) {
-+ drbd_thread_start(&mdev->worker);
-+ set_cstate(mdev,StandAlone);
-+ }
-+
-+
-+ clear_bit(DISKLESS,&mdev->flags);
-+ smp_wmb();
-+// FIXME EXPLAIN:
-+ clear_bit(MD_IO_ALLOWED,&mdev->flags);
-+
-+ /* FIXME currently only StandAlone here...
-+ * Connected is not possible, since
-+ * above we return -EBUSY in that case */
-+ D_ASSERT(mdev->cstate <= Connected);
-+ if(mdev->cstate == Connected ) {
-+ drbd_send_param(mdev,1);
-+ }
-+ drbd_bm_unlock(mdev);
-+
-+ return 0;
-+
-+ release_bdev2_fail_ioctl:
-+ NOT_IN_26(blkdev_put(filp2->f_dentry->d_inode->i_bdev,BDEV_FILE);)
-+ ONLY_IN_26(bd_release(bdev2);)
-+ release_bdev_fail_ioctl:
-+ NOT_IN_26(blkdev_put(filp->f_dentry->d_inode->i_bdev,BDEV_FILE);)
-+ ONLY_IN_26(bd_release(bdev);)
-+ fail_ioctl:
-+ if (mput) module_put(THIS_MODULE);
-+ if (filp) fput(filp);
-+ if (filp2) fput(filp2);
-+ if (put_user(retcode, &arg->ret_code)) return -EFAULT;
-+ return -EINVAL;
-+}
-+
-+STATIC
-+int drbd_ioctl_get_conf(struct Drbd_Conf *mdev, struct ioctl_get_config* arg)
-+{
-+ struct ioctl_get_config cn;
-+ memset(&cn,0,sizeof(cn));
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+ if (mdev->backing_bdev) {
-+ cn.lower_device_major = MAJOR(mdev->backing_bdev->bd_dev);
-+ cn.lower_device_minor = MINOR(mdev->backing_bdev->bd_dev);
-+ bdevname(mdev->backing_bdev,cn.lower_device_name);
-+ }
-+ if (mdev->md_bdev) {
-+ cn.meta_device_major = MAJOR(mdev->md_bdev->bd_dev);
-+ cn.meta_device_minor = MINOR(mdev->md_bdev->bd_dev);
-+ bdevname(mdev->md_bdev,cn.meta_device_name);
-+ }
-+#else
-+ cn.lower_device_major=MAJOR(mdev->backing_bdev);
-+ cn.lower_device_minor=MINOR(mdev->backing_bdev);
-+ cn.meta_device_major=MAJOR(mdev->md_bdev);
-+ cn.meta_device_minor=MINOR(mdev->md_bdev);
-+ if (mdev->backing_bdev) {
-+ strncpy(cn.lower_device_name,
-+ bdevname(mdev->backing_bdev), BDEVNAME_SIZE);
-+ }
-+ if (mdev->md_bdev) {
-+ strncpy(cn.meta_device_name,
-+ bdevname(mdev->md_bdev), BDEVNAME_SIZE);
-+ }
-+#endif
-+ cn.cstate=mdev->cstate;
-+ cn.state=mdev->state;
-+ cn.peer_state=mdev->o_state;
-+ cn.disk_size_user=mdev->lo_usize;
-+ cn.meta_index=mdev->md_index;
-+ cn.on_io_error=mdev->on_io_error;
-+ memcpy(&cn.nconf, &mdev->conf, sizeof(struct net_config));
-+ memcpy(&cn.sconf, &mdev->sync_conf, sizeof(struct syncer_config));
-+
-+ if (copy_to_user(arg,&cn,sizeof(struct ioctl_get_config)))
-+ return -EFAULT;
-+
-+ return 0;
-+}
-+
-+
-+STATIC
-+int drbd_ioctl_set_net(struct Drbd_Conf *mdev, struct ioctl_net_config * arg)
-+{
-+ int i,minor, mput=0;
-+ enum ret_codes retcode;
-+ struct net_config new_conf;
-+
-+ minor=(int)(mdev-drbd_conf);
-+
-+ // FIXME plausibility check
-+ if (copy_from_user(&new_conf, &arg->config,sizeof(struct net_config)))
-+ return -EFAULT;
-+
-+ if (mdev->cstate == Unconfigured) {
-+ // ioctl already has a refcnt
-+ __module_get(THIS_MODULE);
-+ mput = 1;
-+ }
-+
-+#define M_ADDR(A) (((struct sockaddr_in *)&A.my_addr)->sin_addr.s_addr)
-+#define M_PORT(A) (((struct sockaddr_in *)&A.my_addr)->sin_port)
-+#define O_ADDR(A) (((struct sockaddr_in *)&A.other_addr)->sin_addr.s_addr)
-+#define O_PORT(A) (((struct sockaddr_in *)&A.other_addr)->sin_port)
-+ for(i=0;i<minor_count;i++) {
-+ if( i!=minor && drbd_conf[i].cstate!=Unconfigured &&
-+ M_ADDR(new_conf) == M_ADDR(drbd_conf[i].conf) &&
-+ M_PORT(new_conf) == M_PORT(drbd_conf[i].conf) ) {
-+ retcode=LAAlreadyInUse;
-+ goto fail_ioctl;
-+ }
-+ if( i!=minor && drbd_conf[i].cstate!=Unconfigured &&
-+ O_ADDR(new_conf) == O_ADDR(drbd_conf[i].conf) &&
-+ O_PORT(new_conf) == O_PORT(drbd_conf[i].conf) ) {
-+ retcode=OAAlreadyInUse;
-+ goto fail_ioctl;
-+ }
-+ }
-+#undef M_ADDR
-+#undef M_PORT
-+#undef O_ADDR
-+#undef O_PORT
-+
-+ /* IMPROVE:
-+ We should warn the user if the LL_DEV is
-+ used already. E.g. some FS mounted on it.
-+ */
-+
-+ drbd_sync_me(mdev);
-+ drbd_thread_stop(&mdev->receiver);
-+ drbd_free_sock(mdev);
-+
-+ // TODO plausibility check ...
-+ memcpy(&mdev->conf,&new_conf,sizeof(struct net_config));
-+
-+#if 0
-+FIXME
-+ /* for the connection loss logic in drbd_recv
-+ * I _need_ the resulting timeo in jiffies to be
-+ * non-zero and different
-+ *
-+ * XXX maybe rather store the value scaled to jiffies?
-+ * Note: MAX_SCHEDULE_TIMEOUT/HZ*HZ != MAX_SCHEDULE_TIMEOUT
-+ * and HZ > 10; which is unlikely to change...
-+ * Thus, if interrupted by a signal,
-+ * sock_{send,recv}msg returns -EINTR,
-+ * if the timeout expires, -EAGAIN.
-+ */
-+ // unlikely: someone disabled the timeouts ...
-+ // just put some huge values in there.
-+ if (!mdev->conf.ping_int)
-+ mdev->conf.ping_int = MAX_SCHEDULE_TIMEOUT/HZ;
-+ if (!mdev->conf.timeout)
-+ mdev->conf.timeout = MAX_SCHEDULE_TIMEOUT/HZ*10;
-+ if (mdev->conf.ping_int*10 < mdev->conf.timeout)
-+ mdev->conf.timeout = mdev->conf.ping_int*10/6;
-+ if (mdev->conf.ping_int*10 == mdev->conf.timeout)
-+ mdev->conf.ping_int = mdev->conf.ping_int+1;
-+#endif
-+
-+ mdev->send_cnt = 0;
-+ mdev->recv_cnt = 0;
-+
-+ drbd_thread_start(&mdev->worker);
-+ set_cstate(mdev,Unconnected);
-+ drbd_thread_start(&mdev->receiver);
-+
-+ return 0;
-+
-+ fail_ioctl:
-+ if (mput) module_put(THIS_MODULE);
-+ if (put_user(retcode, &arg->ret_code)) return -EFAULT;
-+ return -EINVAL;
-+}
-+
-+int drbd_set_state(drbd_dev *mdev,Drbd_State newstate)
-+{
-+ int forced = 0;
-+ int dont_have_good_data;
-+ NOT_IN_26(int minor = mdev-drbd_conf;)
-+
-+ D_ASSERT(semaphore_is_locked(&mdev->device_mutex));
-+
-+ if ( (newstate & 0x3) == mdev->state ) return 0; /* nothing to do */
-+
-+ // exactly one of sec or pri. not both.
-+ if ( !((newstate ^ (newstate >> 1)) & 1) ) return -EINVAL;
-+
-+ if(mdev->cstate == Unconfigured)
-+ return -ENXIO;
-+
-+ if ( (newstate & Primary) && (mdev->o_state == Primary) )
-+ return -EACCES;
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ smp_rmb();
-+ if ( (newstate & Secondary) &&
-+ (test_bit(WRITER_PRESENT,&mdev->flags) ||
-+ drbd_is_mounted(minor) == MountedRW))
-+ return -EBUSY;
-+#else
-+ ERR_IF (mdev->this_bdev->bd_contains == 0) {
-+ // FIXME this masks a bug somewhere else!
-+ mdev->this_bdev->bd_contains = mdev->this_bdev;
-+ }
-+
-+ if ( newstate & Secondary ) {
-+ /* If I got here, I am Primary. I claim me for myself. If that
-+ * does not succeed, someone other has claimed me, so I cannot
-+ * become Secondary. */
-+ if (bd_claim(mdev->this_bdev,drbd_sec_holder))
-+ return -EBUSY;
-+ if (disable_bd_claim)
-+ bd_release(mdev->this_bdev);
-+ }
-+#endif
-+
-+
-+ /* I dont have access to good data anywhere, if:
-+ * ( I am diskless OR inconsistent )
-+ * AND
-+ * ( not connected, or partner has no consistent data either )
-+ */
-+ dont_have_good_data =
-+ ( test_bit(DISKLESS, &mdev->flags)
-+ || !drbd_md_test_flag(mdev,MDF_Consistent) )
-+ &&
-+ ( mdev->cstate < Connected
-+ || test_bit(PARTNER_DISKLESS, &mdev->flags)
-+ || !test_bit(PARTNER_CONSISTENT, &mdev->flags) );
-+
-+ if (newstate & Primary) {
-+ if ( test_bit(DISKLESS,&mdev->flags)
-+ && mdev->cstate < Connected ) {
-+ /* not even brute force can find data without disk.
-+ * FIXME choose a usefull Error,
-+ * and update drbsetup accordingly */
-+ return -EIO;
-+ } else if (dont_have_good_data) {
-+ /* ok, either we have a disk (which may be inconsistent)
-+ * or we have a connection */
-+ if (newstate & DontBlameDrbd) {
-+ forced = 1;
-+ /* make sure the Human count is increased if
-+ * we got here only because it was forced.
-+ * maybe we want to force a FullSync? */
-+ newstate |= Human;
-+ } else {
-+ return -EIO;
-+ }
-+ } else if (mdev->cstate >= Connected) {
-+ /* do NOT increase the Human count if we are connected,
-+ * and there is no reason for it. See
-+ * drbd_lk9.pdf middle of Page 7
-+ */
-+ newstate &= ~(Human|DontBlameDrbd);
-+ }
-+ }
-+
-+ drbd_sync_me(mdev);
-+
-+ /* Wait until nothing is on the fly :) */
-+ if ( wait_event_interruptible( mdev->cstate_wait,
-+ atomic_read(&mdev->ap_pending_cnt) == 0 ) ) {
-+ONLY_IN_26(
-+ if ( newstate & Secondary ) {
-+ D_ASSERT(mdev->this_bdev->bd_holder == drbd_sec_holder);
-+ bd_release(mdev->this_bdev);
-+ }
-+)
-+ return -EINTR;
-+ }
-+
-+ /* FIXME RACE here: if our direct user is not using bd_claim (i.e.
-+ * not a filesystem) since cstate might still be >= Connected, new
-+ * ap requests may come in and increase ap_pending_cnt again!
-+ * but that means someone is misusing DRBD...
-+ * */
-+
-+ if (forced) { /* this was --do-what-I-say ... */
-+ int i;
-+ // drbd_dump_md(mdev,0,0);
-+ for (i=HumanCnt; i < GEN_CNT_SIZE ; i++) {
-+ if (mdev->gen_cnt[i] != 1) {
-+ WARN("Forcefully set consistent! "
-+ "If this screws your data, don't blame DRBD!\n");
-+ break;
-+ }
-+ }
-+ drbd_md_set_flag(mdev,MDF_Consistent);
-+ }
-+ set_bit(MD_DIRTY,&mdev->flags); // we are changing state!
-+ INFO( "%s/%s --> %s/%s\n",
-+ nodestate_to_name(mdev->state),
-+ nodestate_to_name(mdev->o_state),
-+ nodestate_to_name(newstate & 0x03),
-+ nodestate_to_name(mdev->o_state) );
-+ mdev->state = (Drbd_State) newstate & 0x03;
-+ if(newstate & Primary) {
-+ NOT_IN_26( set_device_ro(MKDEV(MAJOR_NR, minor), FALSE ); )
-+
-+ONLY_IN_26(
-+ set_disk_ro(mdev->vdisk, FALSE );
-+ D_ASSERT(mdev->this_bdev->bd_holder == drbd_sec_holder);
-+ bd_release(mdev->this_bdev);
-+ mdev->this_bdev->bd_disk = mdev->vdisk;
-+)
-+
-+ if(test_bit(ON_PRI_INC_HUMAN,&mdev->flags)) {
-+ newstate |= Human;
-+ clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
-+ }
-+
-+ if(test_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags)) {
-+ newstate |= TimeoutExpired;
-+ clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-+ }
-+
-+ if(newstate & Human) {
-+ drbd_md_inc(mdev,HumanCnt);
-+ } else if(newstate & TimeoutExpired ) {
-+ drbd_md_inc(mdev,TimeoutCnt);
-+ } else {
-+ drbd_md_inc(mdev,
-+ mdev->cstate >= Connected ?
-+ ConnectedCnt : ArbitraryCnt);
-+ }
-+ } else {
-+ NOT_IN_26( set_device_ro(MKDEV(MAJOR_NR, minor), TRUE ); )
-+ ONLY_IN_26( set_disk_ro(mdev->vdisk, TRUE ); )
-+ }
-+
-+ if(!test_bit(DISKLESS,&mdev->flags) && (newstate & Secondary)) {
-+ drbd_al_to_on_disk_bm(mdev);
-+ }
-+ /* Primary indicator has changed in any case. */
-+ drbd_md_write(mdev);
-+
-+ if (mdev->cstate >= WFReportParams) {
-+ /* if this was forced, we should consider sync */
-+ drbd_send_param(mdev,forced);
-+ }
-+
-+ return 0;
-+}
-+
-+static int drbd_get_wait_time(long *tp, struct Drbd_Conf *mdev,
-+ struct ioctl_wait *arg)
-+{
-+ long time;
-+ struct ioctl_wait p;
-+
-+ if(copy_from_user(&p,arg,sizeof(p))) {
-+ return -EFAULT;
-+ }
-+
-+ if ( test_bit(USE_DEGR_WFC_T,&mdev->flags) ) {
-+ time=p.degr_wfc_timeout;
-+ if (time) WARN("using degr_wfc_timeout=%ld seconds\n", time);
-+ } else {
-+ time=p.wfc_timeout;
-+ }
-+
-+ time=time*HZ;
-+ if(time==0) time=MAX_SCHEDULE_TIMEOUT;
-+
-+ *tp=time;
-+
-+ return 0;
-+}
-+
-+STATIC int drbd_ioctl_set_syncer(struct Drbd_Conf *mdev,
-+ struct ioctl_syncer_config* arg)
-+{
-+ struct syncer_config sc;
-+ int err;
-+
-+ if(copy_from_user(&sc,&arg->config,sizeof(sc))) return -EFAULT;
-+
-+ sc.use_csums = 0; // TODO, NYI
-+ ERR_IF (sc.rate < 1) sc.rate = 1;
-+ ERR_IF (sc.skip & ~1) sc.skip = !!sc.skip;
-+ ERR_IF (sc.al_extents < 7) sc.al_extents = 127; // arbitrary minimum
-+#define AL_MAX ((MD_AL_MAX_SIZE-1) * AL_EXTENTS_PT)
-+ if(sc.al_extents > AL_MAX) {
-+ ERR("sc.al_extents > %d\n",AL_MAX);
-+ sc.al_extents = AL_MAX;
-+ }
-+#undef AL_MAX
-+
-+ mdev->sync_conf.rate = sc.rate;
-+ mdev->sync_conf.use_csums = sc.use_csums;
-+ mdev->sync_conf.skip = sc.skip;
-+ mdev->sync_conf.al_extents = sc.al_extents;
-+
-+ err = drbd_check_al_size(mdev);
-+ if (err) return err;
-+
-+ if (mdev->cstate > WFConnection)
-+ drbd_send_sync_param(mdev,&sc);
-+
-+ drbd_alter_sg(mdev, sc.group);
-+
-+ return 0;
-+}
-+
-+STATIC int drbd_detach_ioctl(drbd_dev *mdev)
-+{
-+ int would_discard_last_good_data;
-+ int interrupted;
-+
-+ // not during resync. no.
-+ if (mdev->cstate > Connected) return -EBUSY;
-+
-+ /* this was the last good data copy, if:
-+ * (I am Primary, and not connected ),
-+ * OR
-+ * (we are connected, and Peer has no good data himself)
-+ */
-+ would_discard_last_good_data =
-+ ( mdev->state == Primary && mdev->cstate < Connected )
-+ ||
-+ ( mdev->cstate >= Connected
-+ && ( test_bit(PARTNER_DISKLESS, &mdev->flags)
-+ || !test_bit(PARTNER_CONSISTENT, &mdev->flags) ) );
-+
-+ if ( would_discard_last_good_data ) {
-+ return -ENETRESET;
-+ }
-+ if (test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
-+ return -ENXIO;
-+ }
-+
-+ drbd_sync_me(mdev);
-+
-+ set_bit(DISKLESS,&mdev->flags);
-+ smp_wmb();
-+
-+ interrupted = wait_event_interruptible(mdev->cstate_wait,
-+ atomic_read(&mdev->local_cnt)==0);
-+ if ( interrupted ) {
-+ clear_bit(DISKLESS,&mdev->flags);
-+ return -EINTR;
-+ }
-+
-+ drbd_free_ll_dev(mdev);
-+
-+/* FIXME race with sync start
-+*/
-+ if (mdev->cstate == Connected) drbd_send_param(mdev,0);
-+/* FIXME
-+* if you detach while connected, you are *at least* inconsistent now,
-+* and should clear MDF_Consistent in metadata, and maybe even set the bitmap
-+* out of sync.
-+* since if you reattach, this might be a different lo dev, and then it needs
-+* to receive a sync!
-+*/
-+ if (mdev->cstate == StandAlone) {
-+ // maybe < Connected is better?
-+ set_cstate(mdev,Unconfigured);
-+ drbd_mdev_cleanup(mdev);
-+ module_put(THIS_MODULE);
-+ }
-+ return 0;
-+}
-+
-+#ifdef CONFIG_COMPAT
-+long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
-+{
-+ int ret;
-+ // lock_kernel(); Not needed, since we have mdev->device_mutex
-+ ret = drbd_ioctl(f->f_dentry->d_inode, f, cmd, arg);
-+ // unlock_kernel();
-+ return ret;
-+}
-+#endif
-+
-+int drbd_ioctl(struct inode *inode, struct file *file,
-+ unsigned int cmd, unsigned long arg)
-+{
-+ int minor,err=0;
-+ long time;
-+ struct Drbd_Conf *mdev;
-+ struct ioctl_wait* wp;
-+ONLY_IN_26(
-+ struct block_device *bdev = inode->i_bdev;
-+ struct gendisk *disk = bdev->bd_disk;
-+)
-+
-+ minor = MINOR(inode->i_rdev);
-+ if (minor >= minor_count) return -ENODEV;
-+ mdev = drbd_conf + minor;
-+
-+ D_ASSERT(MAJOR(inode->i_rdev) == MAJOR_NR);
-+
-+ /*
-+ * check whether we can permit this ioctl, and whether is makes sense.
-+ * we don't care for the BLK* ioctls, with 2.6 they never end up here.
-+ *
-+ * for non-sysadmins, we only allow GET_CONFIG (and GET_VERSION)
-+ * all other things need CAP_SYS_ADMIN.
-+ *
-+ * on an Unconfigured device, only configure requests make sense.
-+ * still we silently ignore requests to become secondary or to
-+ * unconfigure. other requests are invalid.
-+ *
-+ * I chose to have an additional switch statement for it
-+ * because I think this makes it more obvious.
-+ *
-+ * because we look at mdev->cstate, it should be inside the lock
-+ * (once we serialize cstate changes, it has to be...)
-+ *
-+ */
-+ if (!capable(CAP_SYS_ADMIN)
-+ && cmd != DRBD_IOCTL_GET_CONFIG
-+ && cmd != DRBD_IOCTL_GET_VERSION) {
-+ err = -EPERM;
-+ goto out_unlocked;
-+ }
-+
-+ if (mdev->cstate == Unconfigured) {
-+ switch (cmd) {
-+ default:
-+ /* oops, unknown IOCTL ?? */
-+ err = -EINVAL;
-+ goto out_unlocked;
-+
-+ case DRBD_IOCTL_GET_CONFIG:
-+ case DRBD_IOCTL_GET_VERSION:
-+ break; /* always allowed */
-+
-+ case DRBD_IOCTL_SET_DISK_CONFIG:
-+ case DRBD_IOCTL_SET_NET_CONFIG:
-+ break; /* no restriction here */
-+
-+ case DRBD_IOCTL_UNCONFIG_DISK:
-+ case DRBD_IOCTL_UNCONFIG_NET:
-+ /* no op, so "drbdadm down all" does not fail */
-+ err = 0;
-+ goto out_unlocked;
-+
-+ /* the rest of them don't make sense if Unconfigured.
-+ * still, set an Unconfigured device Secondary
-+ * is allowed, so "drbdadm down all" does not fail */
-+ case DRBD_IOCTL_SET_STATE:
-+ case DRBD_IOCTL_INVALIDATE:
-+ case DRBD_IOCTL_INVALIDATE_REM:
-+ case DRBD_IOCTL_SET_DISK_SIZE:
-+ case DRBD_IOCTL_SET_STATE_FLAGS:
-+ case DRBD_IOCTL_SET_SYNC_CONFIG:
-+ case DRBD_IOCTL_WAIT_CONNECT:
-+ case DRBD_IOCTL_WAIT_SYNC:
-+ err = (cmd == DRBD_IOCTL_SET_STATE && arg == Secondary)
-+ ? 0 : -ENXIO;
-+ goto out_unlocked;
-+ }
-+ }
-+
-+ if (unlikely(drbd_did_panic == DRBD_MAGIC))
-+ return -EBUSY;
-+
-+ if( (err=down_interruptible(&mdev->device_mutex)) ) return err;
-+ /*
-+ * please no 'return', use 'err = -ERRNO; goto out;'
-+ * we hold the device_mutex
-+ */
-+
-+ONLY_IN_26(
-+ D_ASSERT(bdev == mdev->this_bdev);
-+ D_ASSERT(disk == mdev->vdisk);
-+);
-+
-+ smp_rmb();
-+ switch (cmd) {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+/* see how sys_ioctl and blkdev_ioctl handle it in 2.6 .
-+ * If I understand correctly, only "private" ioctl end up here.
-+ */
-+ case BLKGETSIZE:
-+ err = put_user(drbd_get_capacity(mdev->this_bdev),(long *)arg);
-+ break;
-+
-+#ifdef BLKGETSIZE64
-+ case BLKGETSIZE64: /* see ./drivers/block/loop.c */
-+ err = put_user((u64)drbd_get_capacity(mdev->this_bdev)<<9,
-+ (u64*)arg);
-+ break;
-+#endif
-+
-+ case BLKROSET: // THINK do we want to intercept this one ?
-+ case BLKROGET:
-+ case BLKFLSBUF:
-+ case BLKSSZGET:
-+ case BLKBSZGET:
-+ case BLKBSZSET: // THINK do we want to intercept this one ?
-+ case BLKPG:
-+ err=blk_ioctl(inode->i_rdev, cmd, arg);
-+ break;
-+#endif
-+ case DRBD_IOCTL_GET_VERSION:
-+ err = put_user(API_VERSION, (int *) arg);
-+ break;
-+
-+ case DRBD_IOCTL_SET_STATE:
-+ if (arg & ~(Primary|Secondary|Human|TimeoutExpired|
-+ DontBlameDrbd) ) {
-+ err = -EINVAL;
-+ } else {
-+ err = drbd_set_state(mdev,arg);
-+ }
-+ break;
-+
-+ case DRBD_IOCTL_SET_STATE_FLAGS:
-+ if (arg & ~(Human|TimeoutExpired) ) {
-+ err = -EINVAL;
-+ } else {
-+ clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
-+ clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-+ if (arg == 0) break;
-+
-+ // XXX reduce race: don't set it,
-+ // if we have a connection.
-+ // this does not avoid the race completely, though.
-+ if (mdev->cstate > WFConnection) {
-+ WARN("race avoidance: did not set "
-+ "the state flags (%s), cstate=%s\n",
-+ arg == (Human|TimeoutExpired)
-+ ? "Human|TimeoutExpired"
-+ : arg == Human
-+ ? "Human"
-+ : "TimeoutExpired",
-+ cstate_to_name(mdev->cstate));
-+ break;
-+ }
-+
-+ if (arg & Human)
-+ set_bit(ON_PRI_INC_HUMAN,&mdev->flags);
-+ if (arg & TimeoutExpired)
-+ set_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-+ }
-+ break;
-+
-+ case DRBD_IOCTL_SET_DISK_CONFIG:
-+ err = drbd_ioctl_set_disk(mdev,(struct ioctl_disk_config*)arg);
-+ break;
-+
-+ case DRBD_IOCTL_SET_DISK_SIZE:
-+ if (mdev->cstate > Connected) {
-+ err = -EBUSY;
-+ break;
-+ }
-+ if ( mdev->state == Secondary && mdev->o_state == Secondary) {
-+ err = -EINPROGRESS;
-+ break;
-+ }
-+ err=0;
-+ mdev->lo_usize = (unsigned long)arg;
-+ drbd_bm_lock(mdev);
-+ drbd_determin_dev_size(mdev);
-+ drbd_md_write(mdev); // Write mdev->la_size to disk.
-+ drbd_bm_unlock(mdev);
-+ if (mdev->cstate == Connected) drbd_send_param(mdev,1);
-+ break;
-+
-+ case DRBD_IOCTL_SET_NET_CONFIG:
-+ err = drbd_ioctl_set_net(mdev,(struct ioctl_net_config*) arg);
-+ break;
-+
-+ case DRBD_IOCTL_SET_SYNC_CONFIG:
-+ err = drbd_ioctl_set_syncer(mdev,
-+ (struct ioctl_syncer_config*) arg);
-+ break;
-+
-+ case DRBD_IOCTL_GET_CONFIG:
-+ err = drbd_ioctl_get_conf(mdev,(struct ioctl_get_config*) arg);
-+ break;
-+
-+ case DRBD_IOCTL_UNCONFIG_NET:
-+ if ( mdev->cstate == Unconfigured) break;
-+ if ( ( mdev->state == Primary
-+ && test_bit(DISKLESS,&mdev->flags) )
-+ || ( mdev->o_state == Primary
-+ && !test_bit(PARTNER_CONSISTENT,&mdev->flags) ) )
-+ {
-+ err=-ENODATA;
-+ break;
-+ }
-+ /* FIXME what if fsync returns error */
-+ drbd_sync_me(mdev);
-+ set_bit(DO_NOT_INC_CONCNT,&mdev->flags);
-+ set_cstate(mdev,Unconnected);
-+ drbd_thread_stop(&mdev->receiver);
-+
-+ if (test_bit(DISKLESS,&mdev->flags)) {
-+ set_cstate(mdev,Unconfigured);
-+ drbd_mdev_cleanup(mdev);
-+ module_put(THIS_MODULE);
-+ } else set_cstate(mdev,StandAlone);
-+
-+ break;
-+
-+ case DRBD_IOCTL_UNCONFIG_DISK:
-+ if (mdev->cstate == Unconfigured) break;
-+ err = drbd_detach_ioctl(mdev);
-+ break;
-+
-+ case DRBD_IOCTL_WAIT_CONNECT:
-+ wp=(struct ioctl_wait*)arg;
-+ if( (err=drbd_get_wait_time(&time,mdev,wp)) ) break;
-+
-+ // We can drop the mutex, we do not touch anything in mdev.
-+ up(&mdev->device_mutex);
-+
-+ time = wait_event_interruptible_timeout(
-+ mdev->cstate_wait,
-+ mdev->cstate < Unconnected
-+ || mdev->cstate >= Connected,
-+ time );
-+ if (time < 0) {
-+ err = time;
-+ goto out_unlocked;
-+ }
-+ if (time == 0) {
-+ err = -ETIME;
-+ goto out_unlocked;
-+ }
-+ err=0; // no error
-+
-+ if(put_user(mdev->cstate>=Connected,&wp->ret_code))err=-EFAULT;
-+ goto out_unlocked;
-+
-+ case DRBD_IOCTL_WAIT_SYNC:
-+ wp=(struct ioctl_wait*)arg;
-+ if( (err=drbd_get_wait_time(&time,mdev,wp)) ) break;
-+
-+ up(&mdev->device_mutex);
-+
-+ do {
-+ time = wait_event_interruptible_timeout(
-+ mdev->cstate_wait,
-+ mdev->cstate == Connected
-+ || mdev->cstate < Unconnected,
-+ time );
-+
-+ if (time < 0 ) {
-+ err = time;
-+ goto out_unlocked;
-+ }
-+
-+ if (mdev->cstate > Connected) {
-+ time=MAX_SCHEDULE_TIMEOUT;
-+ }
-+
-+ if (time == 0) {
-+ err = -ETIME;
-+ goto out_unlocked;
-+ }
-+ } while ( mdev->cstate != Connected
-+ && mdev->cstate >= Unconnected );
-+
-+ err=0; // no error
-+
-+ if(put_user(mdev->cstate==Connected,&wp->ret_code))err=-EFAULT;
-+ goto out_unlocked;
-+
-+ case DRBD_IOCTL_INVALIDATE:
-+ /* TODO
-+ * differentiate between different error cases,
-+ * or report the current connection state and flags back
-+ * to userspace */
-+
-+ /* disallow "invalidation" of local replica
-+ * when currently in primary state (would be a Bad Idea),
-+ * or during a running sync (won't make any sense) */
-+ if( (mdev->state == Primary ||
-+ (mdev->cstate != Connected &&
-+ mdev->cstate != StandAlone)) ||
-+ test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
-+ err = -EINPROGRESS;
-+ break;
-+ }
-+
-+ drbd_md_set_flag(mdev,MDF_FullSync);
-+ drbd_md_clear_flag(mdev,MDF_Consistent);
-+ drbd_md_write(mdev);
-+
-+ if (mdev->cstate == Connected) {
-+ /* avoid races with set_in_sync
-+ * for successfull mirrored writes
-+ */
-+ set_cstate(mdev,WFBitMapT);
-+ wait_event(mdev->cstate_wait,
-+ atomic_read(&mdev->ap_bio_cnt)==0);
-+ }
-+
-+ drbd_bm_lock(mdev); // racy...
-+
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+
-+ drbd_md_clear_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+
-+ if (mdev->cstate >= Connected) {
-+ drbd_send_short_cmd(mdev,BecomeSyncSource);
-+ drbd_start_resync(mdev,SyncTarget);
-+ }
-+
-+ drbd_bm_unlock(mdev);
-+
-+ break;
-+
-+ case DRBD_IOCTL_INVALIDATE_REM:
-+ if( mdev->o_state == Primary ||
-+ mdev->cstate != Connected ||
-+ test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
-+ err = -EINPROGRESS;
-+ break;
-+ }
-+ if ( !drbd_md_test_flag(mdev,MDF_Consistent) ) {
-+ // FIXME use a more descriptive error number
-+ err = -EINVAL;
-+ break;
-+ }
-+
-+ drbd_md_set_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+
-+ /* avoid races with set_in_sync
-+ * for successfull mirrored writes
-+ */
-+ set_cstate(mdev,WFBitMapS);
-+ wait_event(mdev->cstate_wait,
-+ atomic_read(&mdev->ap_bio_cnt)==0);
-+
-+ drbd_bm_lock(mdev); // racy...
-+
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+
-+ drbd_md_clear_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+
-+ drbd_send_short_cmd(mdev,BecomeSyncTarget);
-+ drbd_start_resync(mdev,SyncSource);
-+
-+ drbd_bm_unlock(mdev);
-+
-+ break;
-+
-+ default:
-+ err = -EINVAL;
-+ }
-+ /* out: */
-+ up(&mdev->device_mutex);
-+ out_unlocked:
-+ return err;
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_int.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,1549 @@
-+/*
-+ drbd_int.h
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+*/
-+#include <linux/compiler.h>
-+#include <linux/types.h>
-+#include <linux/version.h>
-+#include <linux/list.h>
-+#include <linux/sched.h>
-+#include <linux/bitops.h>
-+#include <linux/slab.h>
-+
-+#include "lru_cache.h"
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
-+# define HAVE_KERNEL_SENDMSG 1
-+#else
-+# define HAVE_KERNEL_SENDMSG 0
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+#include "mempool.h"
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
-+static inline void __list_splice(struct list_head *list,
-+ struct list_head *head)
-+{
-+ struct list_head *first = list->next;
-+ struct list_head *last = list->prev;
-+ struct list_head *at = head->next;
-+
-+ first->prev = head;
-+ head->next = first;
-+
-+ last->next = at;
-+ at->prev = last;
-+}
-+static inline void list_splice_init(struct list_head *list,
-+ struct list_head *head)
-+{
-+ if (!list_empty(list)) {
-+ __list_splice(list, head);
-+ INIT_LIST_HEAD(list);
-+ }
-+}
-+#endif
-+
-+// module parameter, defined in drbd_main.c
-+extern int minor_count;
-+extern int disable_bd_claim;
-+extern int major_nr;
-+extern int use_nbd_major;
-+
-+// use_nbd_major ? "nbd" : "drbd";
-+extern char* drbd_devfs_name;
-+
-+#include <linux/major.h>
-+#ifdef DRBD_MAJOR
-+# warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+/*lge: this hack is to get rid of the compiler warnings about
-+ * 'do_nbd_request declared static but never defined'
-+ * whilst forcing blk.h defines on
-+ * though we probably do not need them, we do not use them...
-+ * would not work without LOCAL_END_REQUEST
-+ */
-+# define MAJOR_NR DRBD_MAJOR
-+# define DEVICE_ON(device)
-+# define DEVICE_OFF(device)
-+# define DEVICE_NR(device) (MINOR(device))
-+# define LOCAL_END_REQUEST
-+# include <linux/blk.h>
-+# define DRBD_MAJOR major_nr
-+#else
-+# include <linux/blkdev.h>
-+# include <linux/bio.h>
-+# define MAJOR_NR major_nr
-+#endif
-+
-+#undef DEVICE_NAME
-+#define DEVICE_NAME "drbd"
-+
-+// XXX do we need this?
-+#ifndef TRUE
-+#define TRUE 1
-+#endif
-+#ifndef FALSE
-+#define FALSE 0
-+#endif
-+
-+#define INITIAL_BLOCK_SIZE (1<<12) // 4K
-+
-+/* I don't remember why XCPU ...
-+ * This is used to wake the asender,
-+ * and to interrupt sending the sending task
-+ * on disconnect.
-+ */
-+#define DRBD_SIG SIGXCPU
-+
-+/* This is used to stop/restart our threads.
-+ * Cannot use SIGTERM nor SIGKILL, since these
-+ * are sent out by init on runlevel changes
-+ * I choose SIGHUP for now.
-+ *
-+ * FIXME btw, we should register some reboot notifier.
-+ */
-+#define DRBD_SIGKILL SIGHUP
-+
-+#define ID_SYNCER (-1LL)
-+#define ID_VACANT 0 // All EEs on the free list should have this value
-+ // freshly allocated EEs get !ID_VACANT (== 1)
-+ // so if it says "cannot dereference null
-+ // pointer at adress 0x00000001, it is most
-+ // probably one of these :(
-+
-+struct Drbd_Conf;
-+typedef struct Drbd_Conf drbd_dev;
-+
-+#ifdef DBG_ALL_SYMBOLS
-+# define STATIC
-+#else
-+# define STATIC static
-+#endif
-+
-+#ifdef PARANOIA
-+# define PARANOIA_BUG_ON(x) BUG_ON(x)
-+#else
-+# define PARANOIA_BUG_ON(x)
-+#endif
-+
-+/*
-+ * Some Message Macros
-+ *************************/
-+
-+// handy macro: DUMPP(somepointer)
-+#define DUMPP(A) ERR( #A " = %p in %s:%d\n", (A),__FILE__,__LINE__);
-+#define DUMPLU(A) ERR( #A " = %lu in %s:%d\n", (A),__FILE__,__LINE__);
-+#define DUMPLLU(A) ERR( #A " = %llu in %s:%d\n",(A),__FILE__,__LINE__);
-+#define DUMPLX(A) ERR( #A " = %lx in %s:%d\n", (A),__FILE__,__LINE__);
-+#define DUMPI(A) ERR( #A " = %d in %s:%d\n", (A),__FILE__,__LINE__);
-+
-+#define DUMPST(A) DUMPLLU((unsigned long long)(A))
-+
-+
-+// Info: do not remove the spaces around the "," before ##
-+// Otherwise this is not portable from gcc-2.95 to gcc-3.3
-+#define PRINTK(level,fmt,args...) \
-+ printk(level DEVICE_NAME "%d: " fmt, \
-+ (int)(mdev-drbd_conf) , ##args)
-+
-+#define ALERT(fmt,args...) PRINTK(KERN_ALERT, fmt , ##args)
-+#define ERR(fmt,args...) PRINTK(KERN_ERR, fmt , ##args)
-+#define WARN(fmt,args...) PRINTK(KERN_WARNING, fmt , ##args)
-+#define INFO(fmt,args...) PRINTK(KERN_INFO, fmt , ##args)
-+#define DBG(fmt,args...) PRINTK(KERN_DEBUG, fmt , ##args)
-+
-+/* see kernel/printk.c:printk_ratelimit
-+ * macro, so it is easy do have independend rate limits at different locations
-+ * "initializer element not constant ..." with kernel 2.4 :(
-+ * so I initialize toks to something large
-+ */
-+#define DRBD_ratelimit(ratelimit_jiffies,ratelimit_burst) \
-+({ \
-+ int __ret; \
-+ static unsigned long toks = 0x80000000UL; \
-+ static unsigned long last_msg; \
-+ static int missed; \
-+ unsigned long now = jiffies; \
-+ toks += now - last_msg; \
-+ last_msg = now; \
-+ if (toks > (ratelimit_burst * ratelimit_jiffies)) \
-+ toks = ratelimit_burst * ratelimit_jiffies; \
-+ if (toks >= ratelimit_jiffies) { \
-+ int lost = missed; \
-+ missed = 0; \
-+ toks -= ratelimit_jiffies; \
-+ if (lost) \
-+ WARN("%d messages suppressed in %s:%d.\n",\
-+ lost , __FILE__ , __LINE__ ); \
-+ __ret=1; \
-+ } else { \
-+ missed++; \
-+ __ret=0; \
-+ } \
-+ __ret; \
-+})
-+
-+
-+#ifdef DBG_ASSERTS
-+extern void drbd_assert_breakpoint(drbd_dev*, char *, char *, int );
-+# define D_ASSERT(exp) if (!(exp)) \
-+ drbd_assert_breakpoint(mdev,#exp,__FILE__,__LINE__)
-+#else
-+# define D_ASSERT(exp) if (!(exp)) \
-+ ERR("ASSERT( " #exp " ) in %s:%d\n", __FILE__,__LINE__)
-+#endif
-+#define ERR_IF(exp) if (({ \
-+ int _b = (exp)!=0; \
-+ if (_b) ERR("%s: (" #exp ") in %s:%d\n", __func__, __FILE__,__LINE__); \
-+ _b; \
-+ }))
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)
-+#include <linux/stringify.h>
-+#else
-+// RH 2.4.9 does not have linux/stringify.h
-+#define __stringify_1(x) #x
-+#define __stringify(x) __stringify_1(x)
-+#endif
-+
-+// integer division, round _UP_ to the next integer
-+#define div_ceil(A,B) ( (A)/(B) + ((A)%(B) ? 1 : 0) )
-+// usual integer division
-+#define div_floor(A,B) ( (A)/(B) )
-+
-+/*
-+ * Compatibility Section
-+ *************************/
-+
-+#include "drbd_compat_types.h"
-+
-+#ifdef SIGHAND_HACK
-+# define LOCK_SIGMASK(task,flags) spin_lock_irqsave(&task->sighand->siglock, flags)
-+# define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sighand->siglock, flags)
-+# define RECALC_SIGPENDING() recalc_sigpending();
-+#else
-+# define LOCK_SIGMASK(task,flags) spin_lock_irqsave(&task->sigmask_lock, flags)
-+# define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sigmask_lock, flags)
-+# define RECALC_SIGPENDING() recalc_sigpending(current);
-+#endif
-+
-+#if defined(DBG_SPINLOCKS) && defined(__SMP__)
-+# define MUST_HOLD(lock) if(!spin_is_locked(lock)) { ERR("Not holding lock! in %s\n", __FUNCTION__ ); }
-+#else
-+# define MUST_HOLD(lock)
-+#endif
-+
-+/*
-+ * our structs
-+ *************************/
-+
-+#ifndef typecheck
-+/*
-+ * Check at compile time that something is of a particular type.
-+ * Always evaluates to 1 so you may use it easily in comparisons.
-+ */
-+#define typecheck(type,x) \
-+({ type __dummy; \
-+ typeof(x) __dummy2; \
-+ (void)(&__dummy == &__dummy2); \
-+ 1; \
-+})
-+#endif
-+
-+#define SET_MAGIC(x) ((x)->magic = (long)(x) ^ DRBD_MAGIC)
-+#define VALID_POINTER(x) ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0)
-+#define INVALIDATE_MAGIC(x) (x->magic--)
-+
-+#define SET_MDEV_MAGIC(x) \
-+ ({ typecheck(struct Drbd_Conf*,x); \
-+ (x)->magic = (long)(x) ^ DRBD_MAGIC; })
-+#define IS_VALID_MDEV(x) \
-+ ( typecheck(struct Drbd_Conf*,x) && \
-+ ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0))
-+
-+/* these defines should go into blkdev.h
-+ (if it will be ever includet into linus' linux) */
-+#define RQ_DRBD_NOTHING 0x0001
-+#define RQ_DRBD_SENT 0x0010
-+#define RQ_DRBD_LOCAL 0x0020
-+#define RQ_DRBD_DONE 0x0030
-+#define RQ_DRBD_IN_TL 0x0040
-+
-+enum MetaDataFlags {
-+ __MDF_Consistent,
-+ __MDF_PrimaryInd,
-+ __MDF_ConnectedInd,
-+ __MDF_FullSync,
-+};
-+#define MDF_Consistent (1<<__MDF_Consistent)
-+#define MDF_PrimaryInd (1<<__MDF_PrimaryInd)
-+#define MDF_ConnectedInd (1<<__MDF_ConnectedInd)
-+#define MDF_FullSync (1<<__MDF_FullSync)
-+
-+/* drbd_meta-data.c (still in drbd_main.c) */
-+enum MetaDataIndex {
-+ Flags, /* Consistency flag,connected-ind,primary-ind */
-+ HumanCnt, /* human-intervention-count */
-+ TimeoutCnt, /* timout-count */
-+ ConnectedCnt, /* connected-count */
-+ ArbitraryCnt, /* arbitrary-count */
-+ GEN_CNT_SIZE // MUST BE LAST! (and Flags must stay first...)
-+};
-+
-+#define DRBD_MD_MAGIC (DRBD_MAGIC+3) // 3nd incarnation of the file format.
-+
-+#define DRBD_PANIC 2
-+/* do_panic alternatives:
-+ * 0: panic();
-+ * 1: machine_halt; SORRY, this DOES NOT WORK
-+ * 2: prink(EMERG ), plus flag to fail all eventual drbd IO, plus panic()
-+ */
-+
-+extern volatile int drbd_did_panic;
-+
-+#if DRBD_PANIC == 0
-+#define drbd_panic(fmt, args...) \
-+ panic(DEVICE_NAME "%d: " fmt, (int)(mdev-drbd_conf) , ##args)
-+#elif DRBD_PANIC == 1
-+#error "sorry , this does not work, please contribute"
-+#else
-+#define drbd_panic(fmt, args...) do { \
-+ printk(KERN_EMERG DEVICE_NAME "%d: " fmt, \
-+ (int)(mdev-drbd_conf) , ##args); \
-+ drbd_did_panic = DRBD_MAGIC; \
-+ smp_mb(); \
-+ panic(DEVICE_NAME "%d: " fmt, (int)(mdev-drbd_conf) , ##args); \
-+} while (0)
-+#endif
-+#undef DRBD_PANIC
-+
-+/***
-+ * on the wire
-+ *********************************************************************/
-+
-+typedef enum {
-+ Data,
-+ DataReply, // Response to DataRequest
-+ RSDataReply, // Response to RSDataRequest
-+ Barrier,
-+ ReportParams,
-+ ReportBitMap,
-+ BecomeSyncTarget,
-+ BecomeSyncSource,
-+ UnplugRemote, // Used at various times to hint the peer to hurry up
-+ DataRequest, // Used to ask for a data block
-+ RSDataRequest, // Used to ask for a data block
-+ SyncParam,
-+
-+ Ping, // These are sent on the meta socket...
-+ PingAck,
-+ RecvAck, // Used in protocol B
-+ WriteAck, // Used in protocol C
-+ NegAck, // Sent if local disk is unusable
-+ NegDReply, // Local disk is broken...
-+ NegRSDReply, // Local disk is broken...
-+ BarrierAck,
-+
-+ MAX_CMD,
-+ MayIgnore = 0x100, // Flag only to test if (cmd > MayIgnore) ...
-+ MAX_OPT_CMD,
-+
-+ HandShake = 0xfffe // FIXED for the next century!
-+} Drbd_Packet_Cmd;
-+
-+static inline const char* cmdname(Drbd_Packet_Cmd cmd)
-+{
-+ /* THINK may need to become several global tables
-+ * when we want to support more than
-+ * one PRO_VERSION */
-+ static const char *cmdnames[] = {
-+ [Data] = "Data",
-+ [DataReply] = "DataReply",
-+ [RSDataReply] = "RSDataReply",
-+ [Barrier] = "Barrier",
-+ [ReportParams] = "ReportParams",
-+ [ReportBitMap] = "ReportBitMap",
-+ [BecomeSyncTarget] = "BecomeSyncTarget",
-+ [BecomeSyncSource] = "BecomeSyncSource",
-+ [UnplugRemote] = "UnplugRemote",
-+ [DataRequest] = "DataRequest",
-+ [RSDataRequest] = "RSDataRequest",
-+ [SyncParam] = "SyncParam",
-+ [Ping] = "Ping",
-+ [PingAck] = "PingAck",
-+ [RecvAck] = "RecvAck",
-+ [WriteAck] = "WriteAck",
-+ [NegAck] = "NegAck",
-+ [NegDReply] = "NegDReply",
-+ [NegRSDReply] = "NegRSDReply",
-+ [BarrierAck] = "BarrierAck"
-+ };
-+
-+ if (cmd == HandShake) return "HandShake";
-+ if (Data > cmd || cmd >= MAX_CMD) return "Unknown";
-+ return cmdnames[cmd];
-+}
-+
-+
-+/* This is the layout for a packet on the wire.
-+ * The byteorder is the network byte order.
-+ * (except block_id and barrier fields.
-+ * these are pointers to local structs
-+ * and have no relevance for the partner,
-+ * which just echoes them as received.)
-+ *
-+ * NOTE that the payload starts at a long aligned offset,
-+ * regardless of 32 or 64 bit arch!
-+ */
-+typedef struct {
-+ u32 magic;
-+ u16 command;
-+ u16 length; // bytes of data after this header
-+ char payload[0];
-+} __attribute((packed)) Drbd_Header;
-+// 8 bytes. packet FIXED for the next century!
-+
-+/*
-+ * short commands, packets without payload, plain Drbd_Header:
-+ * Ping
-+ * PingAck
-+ * BecomeSyncTarget
-+ * BecomeSyncSource
-+ * UnplugRemote
-+ */
-+
-+/*
-+ * commands with out-of-struct payload:
-+ * ReportBitMap (no additional fields)
-+ * Data, DataReply (see Drbd_Data_Packet)
-+ */
-+typedef struct {
-+ Drbd_Header head;
-+ u64 sector; // 64 bits sector number
-+ u64 block_id; // Used in protocol B&C for the address of the req.
-+} __attribute((packed)) Drbd_Data_Packet;
-+
-+/*
-+ * commands which share a struct:
-+ * RecvAck (proto B), WriteAck (proto C) (see Drbd_BlockAck_Packet)
-+ * DataRequest, RSDataRequest (see Drbd_BlockRequest_Packet)
-+ */
-+typedef struct {
-+ Drbd_Header head;
-+ u64 sector;
-+ u64 block_id;
-+ u32 blksize;
-+ u32 pad; //make sure packet is a multiple of 8 Byte
-+} __attribute((packed)) Drbd_BlockAck_Packet;
-+
-+typedef struct {
-+ Drbd_Header head;
-+ u64 sector;
-+ u64 block_id;
-+ u32 blksize;
-+ u32 pad; //make sure packet is a multiple of 8 Byte
-+} __attribute((packed)) Drbd_BlockRequest_Packet;
-+
-+/*
-+ * commands with their own struct for additional fields:
-+ * HandShake
-+ * Barrier
-+ * BarrierAck
-+ * SyncParam
-+ * ReportParams
-+ */
-+
-+typedef struct {
-+ Drbd_Header head; // 8 bytes
-+ u32 protocol_version;
-+ u32 feature_flags;
-+
-+ /* should be more than enough for future enhancements
-+ * for now, feature_flags and the reserverd array shall be zero.
-+ */
-+
-+ u64 reserverd[8];
-+} __attribute((packed)) Drbd_HandShake_Packet;
-+// 80 bytes, FIXED for the next century
-+
-+typedef struct {
-+ Drbd_Header head;
-+ u32 barrier; // may be 0 or a barrier number
-+ u32 pad; //make sure packet is a multiple of 8 Byte
-+} __attribute((packed)) Drbd_Barrier_Packet;
-+
-+typedef struct {
-+ Drbd_Header head;
-+ u32 barrier;
-+ u32 set_size;
-+} __attribute((packed)) Drbd_BarrierAck_Packet;
-+
-+typedef struct {
-+ Drbd_Header head;
-+ u32 rate;
-+ u32 use_csums;
-+ u32 skip;
-+ u32 group;
-+} __attribute((packed)) Drbd_SyncParam_Packet;
-+
-+/* FIXME add more members here, until we introduce a new fixed size
-+ * protocol version handshake packet! */
-+typedef struct {
-+ Drbd_Header head;
-+ u64 p_size; // size of disk
-+ u64 u_size; // user requested size
-+ u32 state;
-+ u32 protocol;
-+ u32 version;
-+ u32 gen_cnt[GEN_CNT_SIZE];
-+ u32 sync_rate;
-+ u32 sync_use_csums;
-+ u32 skip_sync;
-+ u32 sync_group;
-+ u32 flags; // flags & 1 -> reply call drbd_send_param(mdev);
-+ u32 magic; //make sure packet is a multiple of 8 Byte
-+} __attribute((packed)) Drbd_Parameter_Packet;
-+
-+typedef struct {
-+ u64 size;
-+ u32 state;
-+ u32 blksize;
-+ u32 protocol;
-+ u32 version;
-+ u32 gen_cnt[5];
-+ u32 bit_map_gen[5];
-+} __attribute((packed)) Drbd06_Parameter_P;
-+
-+typedef union {
-+ Drbd_Header head;
-+ Drbd_HandShake_Packet HandShake;
-+ Drbd_Data_Packet Data;
-+ Drbd_BlockAck_Packet BlockAck;
-+ Drbd_Barrier_Packet Barrier;
-+ Drbd_BarrierAck_Packet BarrierAck;
-+ Drbd_SyncParam_Packet SyncParam;
-+ Drbd_Parameter_Packet Parameter;
-+ Drbd_BlockRequest_Packet BlockRequest;
-+} __attribute((packed)) Drbd_Polymorph_Packet;
-+
-+/**********************************************************************/
-+
-+typedef enum {
-+ None,
-+ Running,
-+ Exiting,
-+ Restarting
-+} Drbd_thread_state;
-+
-+struct Drbd_thread {
-+ spinlock_t t_lock;
-+ struct task_struct *task;
-+ struct completion startstop;
-+ Drbd_thread_state t_state;
-+ int (*function) (struct Drbd_thread *);
-+ drbd_dev *mdev;
-+};
-+
-+static inline Drbd_thread_state get_t_state(struct Drbd_thread *thi)
-+{
-+ /* THINK testing the t_state seems to be uncritical in all cases
-+ * (but thread_{start,stop}), so we can read it *without* the lock.
-+ * --lge */
-+
-+ smp_rmb();
-+ return (volatile int)thi->t_state;
-+}
-+
-+
-+/*
-+ * Having this as the first member of a struct provides sort of "inheritance".
-+ * "derived" structs can be "drbd_queue_work()"ed.
-+ * The callback should know and cast back to the descendant struct.
-+ * drbd_request and Tl_epoch_entry are descendants of drbd_work.
-+ */
-+struct drbd_work;
-+typedef int (*drbd_work_cb)(drbd_dev*, struct drbd_work*, int cancel);
-+struct drbd_work {
-+ struct list_head list;
-+ drbd_work_cb cb;
-+};
-+
-+/*
-+ * since we eventually don't want to "remap" any bhs, but allways need a
-+ * private bh, it may as well be part of the struct so we do not need to
-+ * allocate it separately. it is only used as a clone, and since we own it, we
-+ * can abuse certain fields of if for our own needs. and, since it is part of
-+ * the struct, we can use b_private for other things than the req, e.g. mdev,
-+ * since we get the request struct by means of the "container_of()" macro.
-+ * -lge
-+ */
-+
-+struct drbd_barrier;
-+struct drbd_request {
-+ struct drbd_work w;
-+ long magic;
-+ int rq_status;
-+ struct drbd_barrier *barrier; // The next barrier.
-+ drbd_bio_t *master_bio; // master bio pointer
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ drbd_bio_t private_bio; // private bio struct
-+#else
-+ struct bio *private_bio;
-+ drbd_dev *mdev;
-+#endif
-+};
-+
-+struct drbd_barrier {
-+ struct list_head requests; // requests before
-+ struct drbd_barrier *next; // pointer to the next barrier
-+ int br_number; // the barriers identifier.
-+ int n_req; // number of requests attached before this barrier
-+};
-+
-+typedef struct drbd_request drbd_request_t;
-+
-+/* These Tl_epoch_entries may be in one of 6 lists:
-+ free_ee .. free entries
-+ active_ee .. data packet being written
-+ sync_ee .. syncer block being written
-+ done_ee .. block written, need to send WriteAck
-+ read_ee .. [RS]DataRequest being read
-+*/
-+
-+/* Since whenever we allocate a Tl_epoch_entry, we allocated a buffer_head,
-+ * at the same time, we might as well put it as member into the struct.
-+ * Yes, we may "waste" a little memory since the unused EEs on the free_ee list
-+ * are somewhat larger. For 2.6, this will be a struct_bio, which is fairly
-+ * small, and since we adopt the amount dynamically anyways, this is not an
-+ * issue.
-+ *
-+ * TODO
-+ * I'd like to "drop" the free list altogether, since we use mempools, which
-+ * are designed for this. We probably would still need a private "page pool"
-+ * to do the "bio_add_page" from.
-+ * -lge
-+ */
-+struct Tl_epoch_entry {
-+ struct drbd_work w;
-+ drbd_bio_t private_bio; // private bio struct, NOT a pointer
-+ u64 block_id;
-+ long magic;
-+ ONLY_IN_26(unsigned int ee_size;)
-+ ONLY_IN_26(sector_t ee_sector;)
-+ // THINK: maybe we rather want bio_alloc(GFP_*,1)
-+ ONLY_IN_26(struct bio_vec ee_bvec;)
-+};
-+
-+/* flag bits */
-+enum {
-+ ISSUE_BARRIER, // next Data is preceeded by a Barrier
-+ SIGNAL_ASENDER, // whether asender wants to be interrupted
-+ SEND_PING, // whether asender should send a ping asap
-+ WRITER_PRESENT, // somebody opened us with write intent
-+ STOP_SYNC_TIMER, // tell timer to cancel itself
-+ DO_NOT_INC_CONCNT, // well, don't ...
-+ ON_PRI_INC_HUMAN, // When we become primary increase human-count
-+ ON_PRI_INC_TIMEOUTEX, // When " - " increase timeout-count
-+ UNPLUG_QUEUED, // only relevant with kernel 2.4
-+ UNPLUG_REMOTE, // whether sending a "UnplugRemote" makes sense
-+ DISKLESS, // no local disk
-+ PARTNER_DISKLESS, // partner has no storage
-+ PARTNER_CONSISTENT, // partner has consistent data
-+ PROCESS_EE_RUNNING, // eek!
-+ MD_IO_ALLOWED, // EXPLAIN
-+ SENT_DISK_FAILURE, // sending it once is enough
-+ MD_DIRTY, // current gen counts and flags not yet on disk
-+ SYNC_STARTED, // Needed to agree on the exact point in time..
-+ USE_DEGR_WFC_T, // Use degr-wfc-timeout instad of wfc-timeout.
-+};
-+
-+struct drbd_bitmap; // opaque for Drbd_Conf
-+
-+// TODO sort members for performance
-+// MAYBE group them further
-+
-+/* THINK maybe we actually want to use the default "event/%s" worker threads
-+ * or similar in linux 2.6, which uses per cpu data and threads.
-+ *
-+ * To be general, this might need a spin_lock member.
-+ * For now, please use the mdev->req_lock to protect list_head,
-+ * see drbd_queue_work below.
-+ */
-+struct drbd_work_queue {
-+ struct list_head q;
-+ struct semaphore s; // producers up it, worker down()s it
-+};
-+
-+/* If Philipp agrees, we remove the "mutex", and make_request will only
-+ * (throttle on "queue full" condition and) queue it to the worker thread...
-+ * which then is free to do whatever is needed, and has exclusive send access
-+ * to the data socket ...
-+ */
-+struct drbd_socket {
-+ struct drbd_work_queue work;
-+ struct semaphore mutex;
-+ struct socket *socket;
-+ Drbd_Polymorph_Packet sbuf; // this way we get our
-+ Drbd_Polymorph_Packet rbuf; // send/receive buffers off the stack
-+};
-+
-+struct Drbd_Conf {
-+#ifdef PARANOIA
-+ long magic;
-+#endif
-+ struct net_config conf;
-+ struct syncer_config sync_conf;
-+ enum io_error_handler on_io_error;
-+ struct semaphore device_mutex;
-+ struct drbd_socket data; // for data/barrier/cstate/parameter packets
-+ struct drbd_socket meta; // for ping/ack (metadata) packets
-+ volatile unsigned long last_received; // in jiffies, either socket
-+ volatile unsigned int ko_count;
-+ struct drbd_work resync_work,
-+ barrier_work,
-+ unplug_work;
-+ struct timer_list resync_timer;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ kdev_t backing_bdev; // backing device
-+ kdev_t this_bdev;
-+ kdev_t md_bdev; // device for meta-data.
-+#else
-+ struct block_device *backing_bdev;
-+ struct block_device *this_bdev;
-+ struct block_device *md_bdev;
-+ struct gendisk *vdisk;
-+ request_queue_t *rq_queue;
-+#endif
-+ // THINK is this the same in 2.6.x ??
-+ struct file *lo_file;
-+ struct file *md_file;
-+ int md_index;
-+ sector_t lo_usize; /* user provided size */
-+ sector_t p_size; /* partner's disk size */
-+ Drbd_State state;
-+ volatile Drbd_CState cstate;
-+ wait_queue_head_t cstate_wait; // TODO Rename into "misc_wait".
-+ Drbd_State o_state;
-+ sector_t la_size; // last agreed disk size
-+ unsigned int send_cnt;
-+ unsigned int recv_cnt;
-+ unsigned int read_cnt;
-+ unsigned int writ_cnt;
-+ unsigned int al_writ_cnt;
-+ unsigned int bm_writ_cnt;
-+ atomic_t ap_bio_cnt; // Requests we need to complete
-+ atomic_t ap_pending_cnt; // AP data packets on the wire, ack expected
-+ atomic_t rs_pending_cnt; // RS request/data packets on the wire
-+ atomic_t unacked_cnt; // Need to send replys for
-+ atomic_t local_cnt; // Waiting for local disk to signal completion
-+ spinlock_t req_lock;
-+ spinlock_t tl_lock;
-+ struct drbd_barrier* newest_barrier;
-+ struct drbd_barrier* oldest_barrier;
-+ unsigned long flags;
-+ struct task_struct *send_task; /* about pid calling drbd_send */
-+ spinlock_t send_task_lock;
-+ // sector_t rs_left; // blocks not up-to-date [unit BM_BLOCK_SIZE]
-+ // moved into bitmap->bm_set
-+ unsigned long rs_total; // blocks to sync in this run [unit BM_BLOCK_SIZE]
-+ unsigned long rs_start; // Syncer's start time [unit jiffies]
-+ unsigned long rs_paused; // cumulated time in PausedSyncX state [unit jiffies]
-+ unsigned long rs_mark_left;// block not up-to-date at mark [unit BM_BLOCK_SIZE]
-+ unsigned long rs_mark_time;// marks's time [unit jiffies]
-+ struct Drbd_thread receiver;
-+ struct Drbd_thread worker;
-+ struct Drbd_thread asender;
-+ struct drbd_bitmap* bitmap;
-+ struct lru_cache* resync; // Used to track operations of resync...
-+ atomic_t resync_locked; // Number of locked elements in resync LRU
-+ int open_cnt;
-+ u32 gen_cnt[GEN_CNT_SIZE];
-+ atomic_t epoch_size;
-+ spinlock_t ee_lock;
-+ struct list_head free_ee; // available
-+ struct list_head active_ee; // IO in progress
-+ struct list_head sync_ee; // IO in progress
-+ struct list_head done_ee; // send ack
-+ struct list_head read_ee; // IO in progress
-+ struct list_head net_ee; // zero-copy network send in progress
-+ spinlock_t pr_lock;
-+ struct list_head app_reads;
-+ struct list_head resync_reads;
-+ int ee_vacant;
-+ int ee_in_use;
-+ wait_queue_head_t ee_wait;
-+ NOT_IN_26(struct tq_struct write_hint_tq;)
-+ struct page *md_io_page; // one page buffer for md_io
-+ struct page *md_io_tmpp; // in case hardsect != 512 [ s390 only? ]
-+ struct semaphore md_io_mutex; // protects the md_io_buffer
-+ spinlock_t al_lock;
-+ wait_queue_head_t al_wait;
-+ struct lru_cache* act_log; // activity log
-+ unsigned int al_tr_number;
-+ int al_tr_cycle;
-+ int al_tr_pos; // position of the next transaction in the journal
-+};
-+
-+
-+/*
-+ * function declarations
-+ *************************/
-+
-+// drbd_main.c
-+extern void _set_cstate(drbd_dev* mdev,Drbd_CState cs);
-+extern void drbd_thread_start(struct Drbd_thread *thi);
-+extern void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait);
-+extern void drbd_free_resources(drbd_dev *mdev);
-+extern void tl_release(drbd_dev *mdev,unsigned int barrier_nr,
-+ unsigned int set_size);
-+extern void tl_clear(drbd_dev *mdev);
-+extern int tl_dependence(drbd_dev *mdev, drbd_request_t * item);
-+extern void drbd_free_sock(drbd_dev *mdev);
-+extern int drbd_send(drbd_dev *mdev, struct socket *sock,
-+ void* buf, size_t size, unsigned msg_flags);
-+extern int drbd_send_param(drbd_dev *mdev, int flags);
-+extern int _drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-+ Drbd_Packet_Cmd cmd, Drbd_Header *h,
-+ size_t size, unsigned msg_flags);
-+extern int drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-+ Drbd_Packet_Cmd cmd, Drbd_Header *h, size_t size);
-+extern int drbd_send_sync_param(drbd_dev *mdev, struct syncer_config *sc);
-+extern int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,
-+ u32 set_size);
-+extern int drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-+ struct Tl_epoch_entry *e);
-+extern int _drbd_send_page(drbd_dev *mdev, struct page *page,
-+ int offset, size_t size);
-+extern int drbd_send_block(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-+ struct Tl_epoch_entry *e);
-+extern int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req);
-+extern int _drbd_send_barrier(drbd_dev *mdev);
-+extern int drbd_send_drequest(drbd_dev *mdev, int cmd,
-+ sector_t sector,int size, u64 block_id);
-+extern int drbd_send_bitmap(drbd_dev *mdev);
-+extern int _drbd_send_bitmap(drbd_dev *mdev);
-+extern void drbd_free_ll_dev(drbd_dev *mdev);
-+extern int drbd_io_error(drbd_dev* mdev);
-+extern void drbd_mdev_cleanup(drbd_dev *mdev);
-+
-+// drbd_meta-data.c (still in drbd_main.c)
-+extern void drbd_md_write(drbd_dev *mdev);
-+extern int drbd_md_read(drbd_dev *mdev);
-+extern int drbd_md_compare(drbd_dev *mdev,Drbd_Parameter_Packet *partner);
-+extern void drbd_dump_md(drbd_dev *, Drbd_Parameter_Packet *, int );
-+// maybe define them below as inline?
-+extern void drbd_md_inc(drbd_dev *mdev, enum MetaDataIndex order);
-+extern void drbd_md_set_flag(drbd_dev *mdev, int flags);
-+extern void drbd_md_clear_flag(drbd_dev *mdev, int flags);
-+extern int drbd_md_test_flag(drbd_dev *mdev, int flag);
-+
-+/* Meta data layout
-+ We reserve a 128MB Block (4k aligned)
-+ * either at the end of the backing device
-+ * or on a seperate meta data device. */
-+
-+#define MD_RESERVED_SIZE ( 128LU * (1<<10) ) // 128 MB ( in units of kb )
-+// The following numbers are sectors
-+#define MD_GC_OFFSET 0
-+#define MD_AL_OFFSET 8 // 8 Sectors after start of meta area
-+#define MD_AL_MAX_SIZE 64 // = 32 kb LOG ~ 3776 extents ~ 14 GB Storage
-+#define MD_BM_OFFSET (MD_AL_OFFSET + MD_AL_MAX_SIZE) //Allows up to about 3.8TB
-+
-+#define MD_HARDSECT_B 9 // Since the smalles IO unit is usually 512 byte
-+#define MD_HARDSECT (1<<MD_HARDSECT_B)
-+
-+// activity log
-+#define AL_EXTENTS_PT ((MD_HARDSECT-12)/8-1) // 61 ; Extents per 512B sector
-+#define AL_EXTENT_SIZE_B 22 // One extent represents 4M Storage
-+#define AL_EXTENT_SIZE (1<<AL_EXTENT_SIZE_B)
-+
-+#if BITS_PER_LONG == 32
-+#define LN2_BPL 5
-+#define cpu_to_lel(A) cpu_to_le32(A)
-+#define lel_to_cpu(A) le32_to_cpu(A)
-+#elif BITS_PER_LONG == 64
-+#define LN2_BPL 6
-+#define cpu_to_lel(A) cpu_to_le64(A)
-+#define lel_to_cpu(A) le64_to_cpu(A)
-+#else
-+#error "LN2 of BITS_PER_LONG unknown!"
-+#endif
-+
-+// resync bitmap
-+// 16MB sized 'bitmap extent' to track syncer usage
-+struct bm_extent {
-+ struct lc_element lce;
-+ int rs_left; //number of bits set (out of sync) in this extent.
-+ unsigned long flags;
-+};
-+
-+#define BME_NO_WRITES 0 // bm_extent.flags: no more requests on this one!
-+#define BME_LOCKED 1 // bm_extent.flags: syncer active on this one.
-+
-+// drbd_bitmap.c
-+/*
-+ * We need to store one bit for a block.
-+ * Example: 1GB disk @ 4096 byte blocks ==> we need 32 KB bitmap.
-+ * Bit 0 ==> local node thinks this block is binary identical on both nodes
-+ * Bit 1 ==> local node thinks this block needs to be synced.
-+ */
-+
-+#define BM_BLOCK_SIZE_B 12 // 4k per bit
-+#define BM_BLOCK_SIZE (1<<BM_BLOCK_SIZE_B)
-+/* (9+3) : 512 bytes @ 8 bits; representing 16M storage
-+ * per sector of on disk bitmap */
-+#define BM_EXT_SIZE_B (BM_BLOCK_SIZE_B + MD_HARDSECT_B + 3 ) // = 24
-+#define BM_EXT_SIZE (1<<BM_EXT_SIZE_B)
-+
-+/* thus many _storage_ sectors are described by one bit */
-+#define BM_SECT_TO_BIT(x) ((x)>>(BM_BLOCK_SIZE_B-9))
-+#define BM_BIT_TO_SECT(x) ((sector_t)(x)<<(BM_BLOCK_SIZE_B-9))
-+#define BM_SECT_PER_BIT BM_BIT_TO_SECT(1)
-+
-+/* bit to represented kilo byte conversion */
-+#define Bit2KB(bits) ((bits)<<(BM_BLOCK_SIZE_B-10))
-+
-+/* in which _bitmap_ extent (resp. sector) the bit for a certain
-+ * _storage_ sector is located in */
-+#define BM_SECT_TO_EXT(x) ((x)>>(BM_EXT_SIZE_B-9))
-+
-+/* in one sector of the bitmap, we have this many activity_log extents. */
-+#define AL_EXT_PER_BM_SECT (1 << (BM_EXT_SIZE_B - AL_EXTENT_SIZE_B) )
-+#define BM_WORDS_PER_AL_EXT (1 << (AL_EXTENT_SIZE_B-BM_BLOCK_SIZE_B-LN2_BPL))
-+
-+
-+/* I want the packet to fit within one page
-+ * THINK maybe use a special bitmap header,
-+ * including offset and compression scheme and whatnot
-+ * Do not use PAGE_SIZE here! Use a architecture agnostic constant!
-+ */
-+#define BM_PACKET_WORDS ((4096-sizeof(Drbd_Header))/sizeof(long))
-+
-+/* the extent in "PER_EXTENT" below is an activity log extent
-+ * we need that many (long words/bytes) to store the bitmap
-+ * of one AL_EXTENT_SIZE chunk of storage.
-+ * we can store the bitmap for that many AL_EXTENTS within
-+ * one sector of the _on_disk_ bitmap:
-+ * bit 0 bit 37 bit 38 bit (512*8)-1
-+ * ...|........|........|.. // ..|........|
-+ * sect. 0 `296 `304 ^(512*8*8)-1
-+ *
-+#define BM_WORDS_PER_EXT ( (AL_EXT_SIZE/BM_BLOCK_SIZE) / BITS_PER_LONG )
-+#define BM_BYTES_PER_EXT ( (AL_EXT_SIZE/BM_BLOCK_SIZE) / 8 ) // 128
-+#define BM_EXT_PER_SECT ( 512 / BM_BYTES_PER_EXTENT ) // 4
-+ */
-+
-+#define DRBD_MAX_SECTORS_32 (0xffffffffLU)
-+#define DRBD_MAX_SECTORS_BM \
-+ ( (MD_RESERVED_SIZE*2LL - MD_BM_OFFSET) * (1LL<<(BM_EXT_SIZE_B-9)) )
-+#if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32
-+#define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM
-+#elif ( !defined(CONFIG_LBD) ) && ( BITS_PER_LONG == 32 )
-+#define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32
-+#else
-+#define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM
-+#endif
-+
-+extern int drbd_bm_init (drbd_dev *mdev);
-+extern int drbd_bm_resize (drbd_dev *mdev, sector_t sectors);
-+extern void drbd_bm_cleanup (drbd_dev *mdev);
-+extern void drbd_bm_set_all (drbd_dev *mdev);
-+extern void drbd_bm_clear_all (drbd_dev *mdev);
-+extern void drbd_bm_reset_find(drbd_dev *mdev);
-+extern int drbd_bm_set_bit (drbd_dev *mdev, unsigned long bitnr);
-+extern int drbd_bm_test_bit (drbd_dev *mdev, unsigned long bitnr);
-+extern int drbd_bm_clear_bit (drbd_dev *mdev, unsigned long bitnr);
-+extern int drbd_bm_e_weight (drbd_dev *mdev, unsigned long enr);
-+extern int drbd_bm_read_sect (drbd_dev *mdev, unsigned long enr);
-+extern int drbd_bm_write_sect(drbd_dev *mdev, unsigned long enr);
-+extern void drbd_bm_read (drbd_dev *mdev);
-+extern void drbd_bm_write (drbd_dev *mdev);
-+extern unsigned long drbd_bm_ALe_set_all (drbd_dev *mdev, unsigned long al_enr);
-+extern size_t drbd_bm_words (drbd_dev *mdev);
-+extern sector_t drbd_bm_capacity (drbd_dev *mdev);
-+extern unsigned long drbd_bm_find_next (drbd_dev *mdev);
-+extern unsigned long drbd_bm_total_weight(drbd_dev *mdev);
-+extern int drbd_bm_rs_done(drbd_dev *mdev);
-+// for receive_bitmap
-+extern void drbd_bm_merge_lel (drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer);
-+// for _drbd_send_bitmap and drbd_bm_write_sect
-+extern void drbd_bm_get_lel (drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer);
-+/*
-+ * only used by drbd_bm_read_sect
-+extern void drbd_bm_set_lel (drbd_dev *mdev, size_t offset, size_t number,
-+ unsigned long* buffer);
-+*/
-+
-+extern void __drbd_bm_lock (drbd_dev *mdev, char* file, int line);
-+extern void drbd_bm_unlock (drbd_dev *mdev);
-+#define drbd_bm_lock(mdev) __drbd_bm_lock(mdev, __FILE__, __LINE__ )
-+
-+
-+// drbd_main.c
-+extern drbd_dev *drbd_conf;
-+extern int minor_count;
-+extern kmem_cache_t *drbd_request_cache;
-+extern kmem_cache_t *drbd_ee_cache;
-+extern mempool_t *drbd_request_mempool;
-+
-+// drbd_req
-+#define ERF_NOTLD 2 /* do not call tl_dependence */
-+extern void drbd_end_req(drbd_request_t *, int, int, sector_t);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+extern int drbd_make_request_24(request_queue_t *q, int rw, struct buffer_head *bio);
-+#else
-+extern int drbd_make_request_26(request_queue_t *q, struct bio *bio);
-+#endif
-+extern int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req);
-+
-+// drbd_fs.c
-+extern char* ppsize(char* buf, size_t size);
-+extern int drbd_determin_dev_size(drbd_dev*);
-+extern sector_t drbd_new_dev_size(struct Drbd_Conf*);
-+extern int drbd_set_state(drbd_dev *mdev,Drbd_State newstate);
-+extern int drbd_ioctl(struct inode *inode, struct file *file,
-+ unsigned int cmd, unsigned long arg);
-+extern long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
-+
-+// drbd_worker.c
-+extern int drbd_worker(struct Drbd_thread *thi);
-+extern void drbd_alter_sg(drbd_dev *mdev, int ng);
-+extern void drbd_start_resync(drbd_dev *mdev, Drbd_CState side);
-+extern int drbd_resync_finished(drbd_dev *mdev);
-+// maybe rather drbd_main.c ?
-+extern int drbd_md_sync_page_io(drbd_dev *mdev, sector_t sector, int rw);
-+// worker callbacks
-+extern int w_is_app_read (drbd_dev *, struct drbd_work *, int);
-+extern int w_is_resync_read (drbd_dev *, struct drbd_work *, int);
-+extern int w_read_retry_remote (drbd_dev *, struct drbd_work *, int);
-+extern int w_e_end_data_req (drbd_dev *, struct drbd_work *, int);
-+extern int w_e_end_rsdata_req (drbd_dev *, struct drbd_work *, int);
-+extern int w_resync_inactive (drbd_dev *, struct drbd_work *, int);
-+extern int w_resume_next_sg (drbd_dev *, struct drbd_work *, int);
-+extern int w_io_error (drbd_dev *, struct drbd_work *, int);
-+extern int w_try_send_barrier (drbd_dev *, struct drbd_work *, int);
-+extern int w_send_write_hint (drbd_dev *, struct drbd_work *, int);
-+extern int w_make_resync_request (drbd_dev *, struct drbd_work *, int);
-+extern void resync_timer_fn(unsigned long data);
-+
-+// drbd_receiver.c
-+extern int drbd_release_ee(drbd_dev* mdev,struct list_head* list);
-+extern int drbd_init_ee(drbd_dev* mdev);
-+extern void drbd_put_ee(drbd_dev* mdev,struct Tl_epoch_entry *e);
-+extern struct Tl_epoch_entry* drbd_get_ee(drbd_dev* mdev);
-+extern void drbd_wait_ee(drbd_dev *mdev,struct list_head *head);
-+
-+// drbd_proc.c
-+extern struct proc_dir_entry *drbd_proc;
-+extern struct file_operations drbd_proc_fops;
-+extern const char* cstate_to_name(Drbd_CState s);
-+extern const char* nodestate_to_name(Drbd_State s);
-+
-+// drbd_actlog.c
-+extern void drbd_al_begin_io(struct Drbd_Conf *mdev, sector_t sector);
-+extern void drbd_al_complete_io(struct Drbd_Conf *mdev, sector_t sector);
-+extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
-+extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
-+extern void drbd_rs_cancel_all(drbd_dev* mdev);
-+extern int drbd_al_read_log(struct Drbd_Conf *mdev);
-+extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
-+#define drbd_set_in_sync(mdev,sector,size) \
-+ __drbd_set_in_sync(mdev,sector,size, __FILE__, __LINE__ )
-+extern void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
-+#define drbd_set_out_of_sync(mdev,sector,size) \
-+ __drbd_set_out_of_sync(mdev,sector,size, __FILE__, __LINE__ )
-+extern void drbd_al_apply_to_bm(struct Drbd_Conf *mdev);
-+extern void drbd_al_to_on_disk_bm(struct Drbd_Conf *mdev);
-+extern void drbd_al_shrink(struct Drbd_Conf *mdev);
-+
-+/*
-+ * event macros
-+ *************************/
-+
-+// sched.h does not have it with timeout, so here goes:
-+
-+#ifndef wait_event_interruptible_timeout
-+#define __wait_event_interruptible_timeout(wq, condition, ret) \
-+do { \
-+ wait_queue_t __wait; \
-+ init_waitqueue_entry(&__wait, current); \
-+ \
-+ add_wait_queue(&wq, &__wait); \
-+ for (;;) { \
-+ set_current_state(TASK_INTERRUPTIBLE); \
-+ if (condition) \
-+ break; \
-+ if (!signal_pending(current)) { \
-+ ret = schedule_timeout(ret); \
-+ if (!ret) \
-+ break; \
-+ continue; \
-+ } \
-+ ret = -EINTR; \
-+ break; \
-+ } \
-+ current->state = TASK_RUNNING; \
-+ remove_wait_queue(&wq, &__wait); \
-+} while (0)
-+
-+#define wait_event_interruptible_timeout(wq, condition, timeout) \
-+({ \
-+ long __ret = timeout; \
-+ if (!(condition)) \
-+ __wait_event_interruptible_timeout(wq, condition, __ret); \
-+ __ret; \
-+})
-+#endif
-+
-+/*
-+ * inline helper functions
-+ *************************/
-+
-+#include "drbd_compat_wrappers.h"
-+
-+static inline int drbd_disk_less_node_present(struct Drbd_Conf* mdev)
-+{
-+ sector_t p_size = mdev->p_size;
-+ sector_t m_size = drbd_get_capacity(mdev->backing_bdev);
-+
-+ return ! ( p_size && m_size ) ;
-+}
-+
-+static inline void
-+drbd_flush_signals(struct task_struct *t)
-+{
-+ NOT_IN_26(
-+ unsigned long flags;
-+ LOCK_SIGMASK(t,flags);
-+ )
-+
-+ flush_signals(t);
-+ NOT_IN_26(UNLOCK_SIGMASK(t,flags));
-+}
-+
-+static inline void set_cstate(drbd_dev* mdev,Drbd_CState ns)
-+{
-+ unsigned long flags;
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+ _set_cstate(mdev,ns);
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+}
-+
-+/**
-+ * drbd_chk_io_error: Handles the on_io_error setting, should be called from
-+ * all io completion handlers. See also drbd_io_error().
-+ */
-+static inline void drbd_chk_io_error(drbd_dev* mdev, int error)
-+{
-+ if (error) {
-+ switch(mdev->on_io_error) {
-+ case PassOn:
-+ ERR("Ignoring local IO error!\n");
-+ break;
-+ case Panic:
-+ set_bit(DISKLESS,&mdev->flags);
-+ smp_mb(); // but why is there smp_mb__after_clear_bit() ?
-+ drbd_panic("IO error on backing device!\n");
-+ break;
-+ case Detach:
-+ /*lge:
-+ * I still do not fully grasp when to set or clear
-+ * this flag... but I want to be able to at least
-+ * still _try_ and write the "I am inconsistent, and
-+ * need full sync" information to the MD. */
-+ set_bit(MD_IO_ALLOWED,&mdev->flags);
-+ drbd_md_set_flag(mdev,MDF_FullSync);
-+ drbd_md_clear_flag(mdev,MDF_Consistent);
-+ if (!test_and_set_bit(DISKLESS,&mdev->flags)) {
-+ smp_mb(); // Nack is sent in w_e handlers.
-+ ERR("Local IO failed. Detaching...\n");
-+ }
-+ break;
-+ }
-+ }
-+}
-+
-+static inline int semaphore_is_locked(struct semaphore* s)
-+{
-+ if(!down_trylock(s)) {
-+ up(s);
-+ return 0;
-+ }
-+ return 1;
-+}
-+/* Returns the start sector for metadata, aligned to 4K
-+ * which happens to be the capacity we announce for
-+ * our lower level device if it includes the meta data
-+ */
-+static inline sector_t drbd_md_ss(drbd_dev *mdev)
-+{
-+ if( mdev->md_index == -1 ) {
-+ if (!mdev->backing_bdev) {
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ ERR("mdev->backing_bdev==NULL\n");
-+ dump_stack();
-+ }
-+ return 0;
-+ }
-+ return ( (drbd_get_capacity(mdev->backing_bdev) & ~7L)
-+ - (MD_RESERVED_SIZE<<1) );
-+ } else {
-+ return 2 * MD_RESERVED_SIZE * mdev->md_index;
-+ }
-+}
-+
-+static inline void
-+_drbd_queue_work(struct drbd_work_queue *q, struct drbd_work *w)
-+{
-+ list_add_tail(&w->list,&q->q);
-+ up(&q->s);
-+}
-+
-+static inline void
-+_drbd_queue_work_front(struct drbd_work_queue *q, struct drbd_work *w)
-+{
-+ list_add(&w->list,&q->q);
-+ up(&q->s);
-+}
-+
-+static inline void
-+drbd_queue_work_front(drbd_dev *mdev, struct drbd_work_queue *q,
-+ struct drbd_work *w)
-+{
-+ unsigned long flags;
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+ list_add(&w->list,&q->q);
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+ up(&q->s);
-+}
-+
-+static inline void
-+drbd_queue_work(drbd_dev *mdev, struct drbd_work_queue *q,
-+ struct drbd_work *w)
-+{
-+ unsigned long flags;
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+ list_add_tail(&w->list,&q->q);
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+ up(&q->s);
-+}
-+
-+static inline void wake_asender(drbd_dev *mdev) {
-+ if(test_bit(SIGNAL_ASENDER, &mdev->flags)) {
-+ force_sig(DRBD_SIG, mdev->asender.task);
-+ }
-+}
-+
-+static inline void request_ping(drbd_dev *mdev) {
-+ set_bit(SEND_PING,&mdev->flags);
-+ wake_asender(mdev);
-+}
-+
-+static inline int drbd_send_short_cmd(drbd_dev *mdev, Drbd_Packet_Cmd cmd)
-+{
-+ Drbd_Header h;
-+ return drbd_send_cmd(mdev,mdev->data.socket,cmd,&h,sizeof(h));
-+}
-+
-+static inline int drbd_send_ping(drbd_dev *mdev)
-+{
-+ Drbd_Header h;
-+ return drbd_send_cmd(mdev,mdev->meta.socket,Ping,&h,sizeof(h));
-+}
-+
-+static inline int drbd_send_ping_ack(drbd_dev *mdev)
-+{
-+ Drbd_Header h;
-+ return drbd_send_cmd(mdev,mdev->meta.socket,PingAck,&h,sizeof(h));
-+}
-+
-+static inline void drbd_thread_stop(struct Drbd_thread *thi)
-+{
-+ _drbd_thread_stop(thi,FALSE,TRUE);
-+}
-+
-+static inline void drbd_thread_stop_nowait(struct Drbd_thread *thi)
-+{
-+ _drbd_thread_stop(thi,FALSE,FALSE);
-+}
-+
-+static inline void drbd_thread_restart_nowait(struct Drbd_thread *thi)
-+{
-+ _drbd_thread_stop(thi,TRUE,FALSE);
-+}
-+
-+static inline void inc_ap_pending(drbd_dev* mdev)
-+{
-+ atomic_inc(&mdev->ap_pending_cnt);
-+}
-+
-+#define ERR_IF_CNT_IS_NEGATIVE(which) \
-+ if(atomic_read(&mdev->which)<0) \
-+ ERR("in %s:%d: " #which " = %d < 0 !\n", \
-+ __func__ , __LINE__ , \
-+ atomic_read(&mdev->which))
-+
-+#define dec_ap_pending(mdev) \
-+ typecheck(drbd_dev*,mdev); \
-+ if(atomic_dec_and_test(&mdev->ap_pending_cnt)) \
-+ wake_up(&mdev->cstate_wait); \
-+ ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt)
-+
-+static inline void inc_rs_pending(drbd_dev* mdev)
-+{
-+ atomic_inc(&mdev->rs_pending_cnt);
-+}
-+
-+#define dec_rs_pending(mdev) \
-+ typecheck(drbd_dev*,mdev); \
-+ atomic_dec(&mdev->rs_pending_cnt); \
-+ ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt)
-+
-+static inline void inc_unacked(drbd_dev* mdev)
-+{
-+ atomic_inc(&mdev->unacked_cnt);
-+}
-+
-+#if 0 && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+/*
-+ * idea was to forcefully push the tcp stack whenever the
-+ * currently last pending packet is in the buffer.
-+ * should be benchmarked on some real box to see if it has any
-+ * effect on overall latency.
-+ */
-+
-+/* this only works with 2.6 kernels because of some conflicting defines
-+ * in header files included from net.tcp.h.
-+ */
-+
-+#include <net/tcp.h>
-+static inline void drbd_push_msock(drbd_dev* mdev)
-+{
-+ struct sock *sk;
-+ struct tcp_opt *tp;
-+ if (mdev->meta.socket == NULL) return;
-+ sk = mdev->meta.socket->sk;
-+ tp = tcp_sk(sk);
-+ lock_sock(sk);
-+ __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), TCP_NAGLE_PUSH);
-+ release_sock(sk);
-+}
-+
-+#define dec_unacked(mdev) \
-+ might_sleep(); \
-+ typecheck(drbd_dev*,mdev); \
-+ if (atomic_dec_and_test(&mdev->unacked_cnt)) \
-+ drbd_push_msock(mdev); \
-+ ERR_IF_CNT_IS_NEGATIVE(unacked_cnt);
-+
-+#define sub_unacked(mdev, n) \
-+ might_sleep(); \
-+ typecheck(drbd_dev*,mdev); \
-+ if (atomic_sub_and_test(n, &mdev->unacked_cnt)) \
-+ drbd_push_msock(mdev); \
-+ ERR_IF_CNT_IS_NEGATIVE(unacked_cnt);
-+#else
-+#define dec_unacked(mdev) \
-+ typecheck(drbd_dev*,mdev); \
-+ atomic_dec(&mdev->unacked_cnt); \
-+ ERR_IF_CNT_IS_NEGATIVE(unacked_cnt)
-+
-+#define sub_unacked(mdev, n) \
-+ typecheck(drbd_dev*,mdev); \
-+ atomic_sub(n, &mdev->unacked_cnt); \
-+ ERR_IF_CNT_IS_NEGATIVE(unacked_cnt)
-+#endif
-+
-+
-+/**
-+ * inc_local: Returns TRUE when local IO is possible. If it returns
-+ * TRUE you should call dec_local() after IO is completed.
-+ */
-+static inline int inc_local(drbd_dev* mdev)
-+{
-+ int io_allowed;
-+
-+ atomic_inc(&mdev->local_cnt);
-+ io_allowed = !test_bit(DISKLESS,&mdev->flags);
-+ if( !io_allowed ) {
-+ atomic_dec(&mdev->local_cnt);
-+ }
-+ return io_allowed;
-+}
-+
-+static inline int inc_local_md_only(drbd_dev* mdev)
-+{
-+ int io_allowed;
-+
-+ atomic_inc(&mdev->local_cnt);
-+ io_allowed = !test_bit(DISKLESS,&mdev->flags) ||
-+ test_bit(MD_IO_ALLOWED,&mdev->flags);
-+ if( !io_allowed ) {
-+ atomic_dec(&mdev->local_cnt);
-+ }
-+ return io_allowed;
-+}
-+
-+static inline void dec_local(drbd_dev* mdev)
-+{
-+ if(atomic_dec_and_test(&mdev->local_cnt) &&
-+ test_bit(DISKLESS,&mdev->flags) &&
-+ mdev->lo_file) {
-+ wake_up(&mdev->cstate_wait);
-+ }
-+
-+ D_ASSERT(atomic_read(&mdev->local_cnt)>=0);
-+}
-+
-+static inline void inc_ap_bio(drbd_dev* mdev)
-+{
-+ atomic_inc(&mdev->ap_bio_cnt);
-+}
-+
-+static inline void dec_ap_bio(drbd_dev* mdev)
-+{
-+ if(atomic_dec_and_test(&mdev->ap_bio_cnt))
-+ wake_up(&mdev->cstate_wait);
-+
-+ D_ASSERT(atomic_read(&mdev->ap_bio_cnt)>=0);
-+}
-+
-+#ifdef DUMP_EACH_PACKET
-+/*
-+ * enable to dump information about every packet exchange.
-+ */
-+#define INFOP(fmt, args...) \
-+ INFO("%s:%d: %s [%d] %s %s " fmt , \
-+ file, line, current->comm, current->pid, \
-+ sockname, recv?"<<<":">>>" \
-+ , ## args )
-+static inline void
-+dump_packet(drbd_dev *mdev, struct socket *sock,
-+ int recv, Drbd_Polymorph_Packet *p, char* file, int line)
-+{
-+ char *sockname = sock == mdev->meta.socket ? "meta" : "data";
-+ int cmd = (recv == 2) ? p->head.command : be16_to_cpu(p->head.command);
-+ switch (cmd) {
-+ case HandShake:
-+ INFOP("%s (%u)\n", be32_to_cpu(p->HandShake.protocol_version));
-+ break;
-+
-+ case Ping:
-+ case PingAck:
-+ case BecomeSyncTarget:
-+ case BecomeSyncSource:
-+ case UnplugRemote:
-+
-+ case SyncParam:
-+ case ReportParams:
-+ INFOP("%s\n", cmdname(cmd));
-+ break;
-+
-+ case ReportBitMap: /* don't report this */
-+ break;
-+
-+ case Data:
-+ case DataReply:
-+ case RSDataReply:
-+
-+ case RecvAck: /* yes I know. but it is the same layout */
-+ case WriteAck:
-+ case NegAck:
-+
-+ case DataRequest:
-+ case RSDataRequest:
-+ INFOP("%s (%lu,%llx)\n", cmdname(cmd),
-+ (long)be64_to_cpu(p->Data.sector), (long long)p->Data.block_id
-+ );
-+ break;
-+
-+ case Barrier:
-+ case BarrierAck:
-+ INFOP("%s (%u)\n", cmdname(cmd), p->Barrier.barrier);
-+ break;
-+
-+ default:
-+ INFOP("%s (%u)\n",cmdname(cmd), cmd);
-+ break;
-+ }
-+}
-+#else
-+#define dump_packet(ignored...) ((void)0)
-+#endif
-+
-+
-+#ifndef sector_div
-+# define sector_div(n, b)( \
-+{ \
-+ int _res; \
-+ _res = (n) % (b); \
-+ (n) /= (b); \
-+ _res; \
-+} \
-+)
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+// this is a direct copy from 2.6.6 include/linux/bitops.h
-+
-+static inline unsigned long generic_hweight64(u64 w)
-+{
-+#if BITS_PER_LONG < 64
-+ return generic_hweight32((unsigned int)(w >> 32)) +
-+ generic_hweight32((unsigned int)w);
-+#else
-+ u64 res;
-+ res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
-+ res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
-+ res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
-+ res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
-+ res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
-+ return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
-+#endif
-+}
-+
-+static inline unsigned long hweight_long(unsigned long w)
-+{
-+ return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
-+}
-+#endif
-+
-+static inline void drbd_suicide(void)
-+{
-+#ifdef TASK_ZOMBIE
-+ set_current_state(TASK_ZOMBIE);
-+#else
-+ current->exit_state = EXIT_ZOMBIE;
-+#endif
-+ schedule();
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_main.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,2236 @@
-+/*
-+-*- Linux-c -*-
-+ drbd.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ Copyright (C) 2000, Marcelo Tosatti <marcelo@conectiva.com.br>.
-+ Early 2.3.x work.
-+
-+ Copyright (C) 2001, Lelik P.Korchagin <lelik@price.ru>.
-+ Initial devfs support.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+#include <linux/version.h>
-+
-+#include <asm/uaccess.h>
-+#include <asm/types.h>
-+#include <net/sock.h>
-+#include <linux/smp_lock.h>
-+#include <linux/fs.h>
-+#include <linux/file.h>
-+#include <linux/proc_fs.h>
-+#include <linux/init.h>
-+#include <linux/mm.h>
-+#include <linux/drbd_config.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
-+#include <linux/mm_inline.h>
-+#endif
-+#include <linux/slab.h>
-+#include <linux/devfs_fs_kernel.h>
-+
-+#define __KERNEL_SYSCALLS__
-+#include <linux/unistd.h>
-+#include <linux/vmalloc.h>
-+
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+/* YES. We got an official device major from lanana
-+ */
-+#define LANANA_DRBD_MAJOR 147
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+# if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
-+extern int register_ioctl32_conversion(unsigned int cmd,
-+ int (*handler)(unsigned int,
-+ unsigned int,
-+ unsigned long,
-+ struct file *));
-+extern int unregister_ioctl32_conversion(unsigned int cmd);
-+extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
-+# endif
-+#else
-+# ifdef CONFIG_COMPAT
-+# if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
-+ /* FIXME on which thing could we test instead of the KERNEL_VERSION
-+ * again? register_ioctl32_conversion was deprecated in 2.6.10, got
-+ * "officially" deprecated somewhen in 2.6.12, and removed in 2.6.14.
-+ * so lets assume all vendor kernels did the transition. */
-+# define HAVE_COMPAT_IOCTL_MEMBER
-+# else
-+# include <linux/ioctl32.h>
-+# endif
-+# endif
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+static devfs_handle_t devfs_handle;
-+#endif
-+
-+int drbdd_init(struct Drbd_thread*);
-+int drbd_worker(struct Drbd_thread*);
-+int drbd_asender(struct Drbd_thread*);
-+
-+int drbd_init(void);
-+STATIC int drbd_open(struct inode *inode, struct file *file);
-+STATIC int drbd_close(struct inode *inode, struct file *file);
-+
-+#ifdef DEVICE_REQUEST
-+#undef DEVICE_REQUEST
-+#endif
-+#define DEVICE_REQUEST drbd_do_request
-+
-+MODULE_AUTHOR("Philipp Reisner <phil@linbit.com>, Lars Ellenberg <lars@linbit.com>");
-+MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
-+MODULE_LICENSE("GPL");
-+MODULE_PARM_DESC(use_nbd_major, "DEPRECATED! use nbd device major nr (43) "
-+ "instead of the default " __stringify(LANANA_DRBD_MAJOR) );
-+MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+MODULE_PARM(use_nbd_major,"i");
-+MODULE_PARM(minor_count,"i");
-+#else
-+#include <linux/moduleparam.h>
-+MODULE_PARM_DESC(disable_bd_claim, "DONT USE! disables block device claiming" );
-+/*
-+ * please somebody explain to me what the "perm" of the module_param
-+ * macro is good for (yes, permission for it in the "driverfs", but what
-+ * do we need to do for them to show up, to begin with?)
-+ * once I understand this, and the rest of the sysfs stuff, I probably
-+ * be able to understand how we can move from our ioctl interface to a
-+ * proper sysfs based one.
-+ * -- lge
-+ */
-+
-+/* thanks to these macros, if compiled into the kernel (not-module),
-+ * these become boot parameters: [-drbd.major_nr-], drbd.minor_count and
-+ * drbd.disable_io_hints
-+ */
-+module_param(use_nbd_major, bool,0);
-+module_param(minor_count, int,0);
-+module_param(disable_bd_claim,bool,0);
-+#endif
-+
-+// module parameter, defined
-+int use_nbd_major = 0;
-+int major_nr = LANANA_DRBD_MAJOR;
-+#ifdef MODULE
-+int minor_count = 2;
-+#else
-+int minor_count = 8;
-+#endif
-+int disable_bd_claim = 0;
-+
-+// devfs name
-+char* drbd_devfs_name = "drbd";
-+
-+
-+// global panic flag
-+volatile int drbd_did_panic = 0;
-+
-+/* in 2.6.x, our device mapping and config info contains our virtual gendisks
-+ * as member "struct gendisk *vdisk;"
-+ */
-+NOT_IN_26(
-+STATIC int *drbd_blocksizes;
-+STATIC int *drbd_sizes;
-+)
-+struct Drbd_Conf *drbd_conf;
-+kmem_cache_t *drbd_request_cache;
-+kmem_cache_t *drbd_ee_cache;
-+mempool_t *drbd_request_mempool;
-+
-+STATIC struct block_device_operations drbd_ops = {
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,10)
-+ .owner = THIS_MODULE,
-+#endif
-+ .open = drbd_open,
-+ .release = drbd_close,
-+ .ioctl = drbd_ioctl,
-+#ifdef HAVE_COMPAT_IOCTL_MEMBER
-+ .compat_ioctl = drbd_compat_ioctl,
-+#endif
-+};
-+
-+#define ARRY_SIZE(A) (sizeof(A)/sizeof(A[0]))
-+
-+/************************* The transfer log start */
-+STATIC int tl_init(drbd_dev *mdev)
-+{
-+ struct drbd_barrier *b;
-+
-+ b=kmalloc(sizeof(struct drbd_barrier),GFP_KERNEL);
-+ if(!b) return 0;
-+ INIT_LIST_HEAD(&b->requests);
-+ b->next=0;
-+ b->br_number=4711;
-+ b->n_req=0;
-+
-+ mdev->oldest_barrier = b;
-+ mdev->newest_barrier = b;
-+
-+ return 1;
-+}
-+
-+STATIC void tl_cleanup(drbd_dev *mdev)
-+{
-+ D_ASSERT(mdev->oldest_barrier == mdev->newest_barrier);
-+ kfree(mdev->oldest_barrier);
-+}
-+
-+STATIC void tl_add(drbd_dev *mdev, drbd_request_t * new_item)
-+{
-+ struct drbd_barrier *b;
-+
-+ spin_lock_irq(&mdev->tl_lock);
-+
-+ b=mdev->newest_barrier;
-+
-+ new_item->barrier = b;
-+ new_item->rq_status |= RQ_DRBD_IN_TL;
-+ list_add(&new_item->w.list,&b->requests);
-+
-+ if( b->n_req++ > mdev->conf.max_epoch_size ) {
-+ set_bit(ISSUE_BARRIER,&mdev->flags);
-+ }
-+
-+ spin_unlock_irq(&mdev->tl_lock);
-+}
-+
-+STATIC void tl_cancel(drbd_dev *mdev, drbd_request_t * item)
-+{
-+ struct drbd_barrier *b;
-+
-+ spin_lock_irq(&mdev->tl_lock);
-+
-+ b=item->barrier;
-+ b->n_req--;
-+
-+ list_del(&item->w.list);
-+ item->rq_status &= ~RQ_DRBD_IN_TL;
-+
-+ spin_unlock_irq(&mdev->tl_lock);
-+}
-+
-+STATIC unsigned int tl_add_barrier(drbd_dev *mdev)
-+{
-+ unsigned int bnr;
-+ static int barrier_nr_issue=1;
-+ struct drbd_barrier *b;
-+
-+ barrier_nr_issue++;
-+
-+ b=kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
-+ if(!b) {
-+ ERR("could not kmalloc() barrier\n");
-+ return 0;
-+ }
-+ INIT_LIST_HEAD(&b->requests);
-+ b->next=0;
-+ b->br_number=barrier_nr_issue;
-+ b->n_req=0;
-+
-+ spin_lock_irq(&mdev->tl_lock);
-+
-+ bnr = mdev->newest_barrier->br_number;
-+ mdev->newest_barrier->next = b;
-+ mdev->newest_barrier = b;
-+
-+ spin_unlock_irq(&mdev->tl_lock);
-+
-+ return bnr;
-+}
-+
-+void tl_release(drbd_dev *mdev,unsigned int barrier_nr,
-+ unsigned int set_size)
-+{
-+ struct drbd_barrier *b;
-+
-+ spin_lock_irq(&mdev->tl_lock);
-+
-+ b = mdev->oldest_barrier;
-+ mdev->oldest_barrier = b->next;
-+
-+ list_del(&b->requests);
-+ /* There could be requests on the list waiting for completion
-+ of the write to the local disk, to avoid corruptions of
-+ slab's data structures we have to remove the lists head */
-+
-+ spin_unlock_irq(&mdev->tl_lock);
-+
-+ D_ASSERT(b->br_number == barrier_nr);
-+ D_ASSERT(b->n_req == set_size);
-+
-+ kfree(b);
-+}
-+
-+/* tl_dependence reports if this sector was present in the current
-+ epoch.
-+ As side effect it clears also the pointer to the request if it
-+ was present in the transfert log. (Since tl_dependence indicates
-+ that IO is complete and that drbd_end_req() should not be called
-+ in case tl_clear has to be called due to interruption of the
-+ communication)
-+*/
-+/* bool */
-+int tl_dependence(drbd_dev *mdev, drbd_request_t * item)
-+{
-+ unsigned long flags;
-+ int r=TRUE;
-+
-+ spin_lock_irqsave(&mdev->tl_lock,flags);
-+
-+ r = ( item->barrier == mdev->newest_barrier );
-+ list_del(&item->w.list);
-+
-+ spin_unlock_irqrestore(&mdev->tl_lock,flags);
-+ return r;
-+}
-+
-+void tl_clear(drbd_dev *mdev)
-+{
-+ struct list_head *le,*tle;
-+ struct drbd_barrier *b,*f,*new_first;
-+ struct drbd_request *r;
-+ sector_t sector;
-+ unsigned int size;
-+
-+ new_first=kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
-+ if(!new_first) {
-+ ERR("could not kmalloc() barrier\n");
-+ }
-+
-+ /* FIXME if indeed we could not kmalloc, this will Oops!
-+ * can we somehow just recycle one of the existing barriers?
-+ */
-+ INIT_LIST_HEAD(&new_first->requests);
-+ new_first->next=0;
-+ new_first->br_number=4711;
-+ new_first->n_req=0;
-+
-+ spin_lock_irq(&mdev->tl_lock);
-+
-+ b=mdev->oldest_barrier;
-+ mdev->oldest_barrier = new_first;
-+ mdev->newest_barrier = new_first;
-+
-+ spin_unlock_irq(&mdev->tl_lock);
-+
-+ inc_ap_pending(mdev); // Since we count the old first as well...
-+
-+ while ( b ) {
-+ list_for_each_safe(le, tle, &b->requests) {
-+ r = list_entry(le, struct drbd_request,w.list);
-+ // bi_size and bi_sector are modified in bio_endio!
-+ sector = drbd_req_get_sector(r);
-+ size = drbd_req_get_size(r);
-+ if( !(r->rq_status & RQ_DRBD_SENT) ) {
-+ if(mdev->conf.wire_protocol != DRBD_PROT_A )
-+ dec_ap_pending(mdev);
-+ drbd_end_req(r,RQ_DRBD_SENT,ERF_NOTLD|1, sector);
-+ goto mark;
-+ }
-+ if(mdev->conf.wire_protocol != DRBD_PROT_C ) {
-+ mark:
-+ drbd_set_out_of_sync(mdev, sector, size);
-+ }
-+ }
-+ f=b;
-+ b=b->next;
-+ list_del(&f->requests);
-+ kfree(f);
-+ dec_ap_pending(mdev); // for the barrier
-+ }
-+}
-+
-+/**
-+ * drbd_io_error: Handles the on_io_error setting, should be called in the
-+ * unlikely(!drbd_bio_uptodate(e->bio)) case from kernel thread context.
-+ * See also drbd_chk_io_error
-+ *
-+ * NOTE: we set ourselves DISKLESS here.
-+ * But we try to write the "need full sync bit" here anyways. This is to make sure
-+ * that you get a resynchronisation of the full device the next time you
-+ * connect.
-+ */
-+int drbd_io_error(drbd_dev* mdev)
-+{
-+ int ok=1;
-+
-+ if(mdev->on_io_error != Panic && mdev->on_io_error != Detach) return 1;
-+ if(test_and_set_bit(SENT_DISK_FAILURE,&mdev->flags)) return 1;
-+
-+ D_ASSERT(test_bit(DISKLESS,&mdev->flags));
-+ ok = drbd_send_param(mdev,0);
-+ WARN("Notified peer that my disk is broken.\n");
-+
-+ D_ASSERT(drbd_md_test_flag(mdev,MDF_FullSync));
-+ D_ASSERT(!drbd_md_test_flag(mdev,MDF_Consistent));
-+ if (test_bit(MD_DIRTY,&mdev->flags)) {
-+ // try to get "inconsistent, need full sync" to MD
-+ drbd_md_write(mdev);
-+ }
-+
-+ if(mdev->cstate > Connected ) {
-+ WARN("Resync aborted.\n");
-+ set_cstate(mdev,Connected);
-+ mdev->rs_total = 0;
-+ }
-+ if ( wait_event_interruptible_timeout(mdev->cstate_wait,
-+ atomic_read(&mdev->local_cnt) == 0 , HZ ) <= 0) {
-+ WARN("Not releasing backing storage device.\n");
-+ /* FIXME if there *are* still references,
-+ * we should be here again soon enough.
-+ * but what if not?
-+ * we still should free our ll and md devices */
-+ } else {
-+ /* no race. since the DISKLESS bit is set first,
-+ * further references to local_cnt are shortlived,
-+ * and no real references on the device. */
-+ WARN("Releasing backing storage device.\n");
-+ drbd_free_ll_dev(mdev);
-+ mdev->la_size=0;
-+ }
-+
-+ return ok;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-+// daemonize was no global symbol before 2.4.14
-+/* in 2.4.6 is is prototyped as
-+ * void daemonize(const char *name, ...)
-+ * though, so maybe we want to do this for 2.4.x already, too.
-+ */
-+void daemonize(void)
-+{
-+ struct fs_struct *fs;
-+
-+ exit_mm(current);
-+
-+ current->session = 1;
-+ current->pgrp = 1;
-+ current->tty = NULL;
-+
-+ exit_fs(current); /* current->fs->count--; */
-+ fs = init_task.fs;
-+ current->fs = fs;
-+ atomic_inc(&fs->count);
-+ exit_files(current);
-+ current->files = init_task.files;
-+ atomic_inc(&current->files->count);
-+}
-+#endif
-+
-+STATIC void drbd_daemonize(void) {
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-+ daemonize("drbd_thread");
-+#else
-+ daemonize();
-+ // VERIFY what about blocking signals ?
-+ reparent_to_init();
-+#endif
-+}
-+
-+void _set_cstate(drbd_dev* mdev,Drbd_CState ns)
-+{
-+ Drbd_CState os;
-+
-+ os = mdev->cstate;
-+
-+#if DUMP_MD >= 2
-+ INFO("%s [%d]: cstate %s --> %s\n", current->comm, current->pid,
-+ cstate_to_name(os), cstate_to_name(ns) );
-+#endif
-+
-+ mdev->cstate = ns;
-+ smp_mb();
-+ wake_up(&mdev->cstate_wait);
-+
-+ /* THINK.
-+ * was:
-+ * if ( ( os==SyncSource || os==SyncTarget ) && ns <= Connected ) {
-+ */
-+ if ( ( os >= SyncSource ) && ns <= Connected ) {
-+ clear_bit(SYNC_STARTED,&mdev->flags);
-+ set_bit(STOP_SYNC_TIMER,&mdev->flags);
-+ mod_timer(&mdev->resync_timer,jiffies);
-+ }
-+ if(test_bit(MD_IO_ALLOWED,&mdev->flags) &&
-+ test_bit(DISKLESS,&mdev->flags) && ns < Connected) {
-+// FIXME EXPLAIN
-+ clear_bit(MD_IO_ALLOWED,&mdev->flags);
-+ }
-+}
-+
-+STATIC int drbd_thread_setup(void* arg)
-+{
-+ struct Drbd_thread *thi = (struct Drbd_thread *) arg;
-+ drbd_dev *mdev = thi->mdev;
-+ int retval;
-+
-+ drbd_daemonize();
-+ D_ASSERT(get_t_state(thi) == Running);
-+ D_ASSERT(thi->task == NULL);
-+ spin_lock(&thi->t_lock);
-+ thi->task = current;
-+ smp_mb();
-+ spin_unlock(&thi->t_lock);
-+ complete(&thi->startstop); // notify: thi->task is set.
-+
-+ retval = thi->function(thi);
-+
-+ spin_lock(&thi->t_lock);
-+ thi->task = 0;
-+ thi->t_state = Exiting;
-+ smp_mb();
-+ spin_unlock(&thi->t_lock);
-+
-+ // THINK maybe two different completions?
-+ complete(&thi->startstop); // notify: thi->task unset.
-+
-+ return retval;
-+}
-+
-+STATIC void drbd_thread_init(drbd_dev *mdev, struct Drbd_thread *thi,
-+ int (*func) (struct Drbd_thread *))
-+{
-+ thi->t_lock = SPIN_LOCK_UNLOCKED;
-+ thi->task = NULL;
-+ thi->t_state = None;
-+ init_completion(&thi->startstop);
-+
-+ thi->function = func;
-+ thi->mdev = mdev;
-+}
-+
-+void drbd_thread_start(struct Drbd_thread *thi)
-+{
-+ int pid;
-+ drbd_dev *mdev = thi->mdev;
-+
-+ spin_lock(&thi->t_lock);
-+
-+ /* INFO("%s [%d]: %s %d -> Running\n",
-+ current->comm, current->pid,
-+ thi == &mdev->receiver ? "receiver" :
-+ thi == &mdev->asender ? "asender" :
-+ thi == &mdev->worker ? "worker" : "NONSENSE",
-+ thi->t_state); */
-+
-+ if (thi->t_state == None) {
-+ D_ASSERT(thi->task == NULL);
-+ thi->t_state = Running;
-+ spin_unlock(&thi->t_lock);
-+
-+ pid = kernel_thread(drbd_thread_setup, (void *) thi, CLONE_FS);
-+ if (pid < 0) {
-+ ERR("Couldn't start thread (%d)\n", pid);
-+ return;
-+ }
-+ wait_for_completion(&thi->startstop); // waits until thi->task is set
-+ D_ASSERT(thi->task);
-+ D_ASSERT(get_t_state(thi) == Running);
-+ } else {
-+ spin_unlock(&thi->t_lock);
-+ }
-+}
-+
-+
-+void _drbd_thread_stop(struct Drbd_thread *thi, int restart,int wait)
-+{
-+ drbd_dev *mdev = thi->mdev;
-+ Drbd_thread_state ns = restart ? Restarting : Exiting;
-+
-+ spin_lock(&thi->t_lock);
-+
-+ /* INFO("%s [%d]: %s %d -> %d; %d\n",
-+ current->comm, current->pid,
-+ thi->task ? thi->task->comm : "NULL", thi->t_state, ns, wait); */
-+
-+
-+ if (thi->t_state == None) {
-+ spin_unlock(&thi->t_lock);
-+ return;
-+ }
-+
-+ if (thi->t_state != ns) {
-+ ERR_IF (thi->task == NULL) {
-+ spin_unlock(&thi->t_lock);
-+ return;
-+ }
-+
-+ if (ns == Restarting && thi->t_state == Exiting) {
-+ // Already Exiting. Cannot restart!
-+ spin_unlock(&thi->t_lock);
-+ return;
-+ }
-+
-+ thi->t_state = ns;
-+ smp_mb();
-+ if (thi->task != current)
-+ force_sig(DRBD_SIGKILL,thi->task);
-+ else
-+ D_ASSERT(!wait);
-+
-+ }
-+ spin_unlock(&thi->t_lock);
-+
-+ if (wait) {
-+ D_ASSERT(thi->t_state == Exiting);
-+ wait_for_completion(&thi->startstop);
-+ spin_lock(&thi->t_lock);
-+ thi->t_state = None;
-+ smp_mb();
-+ D_ASSERT(thi->task == NULL);
-+ spin_unlock(&thi->t_lock);
-+ }
-+}
-+
-+inline sigset_t drbd_block_all_signals(void)
-+{
-+ unsigned long flags;
-+ sigset_t oldset;
-+ LOCK_SIGMASK(current,flags);
-+ oldset = current->blocked;
-+ sigfillset(&current->blocked);
-+ RECALC_SIGPENDING();
-+ UNLOCK_SIGMASK(current,flags);
-+ return oldset;
-+}
-+
-+inline void restore_old_sigset(sigset_t oldset)
-+{
-+ unsigned long flags;
-+ LOCK_SIGMASK(current,flags);
-+ // _never_ propagate this to anywhere...
-+ sigdelset(&current->pending.signal, DRBD_SIG);
-+ current->blocked = oldset;
-+ RECALC_SIGPENDING();
-+ UNLOCK_SIGMASK(current,flags);
-+}
-+
-+int _drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-+ Drbd_Packet_Cmd cmd, Drbd_Header *h,
-+ size_t size, unsigned msg_flags)
-+{
-+ int sent,ok;
-+
-+ ERR_IF(!h) return FALSE;
-+ ERR_IF(!size) return FALSE;
-+
-+ h->magic = BE_DRBD_MAGIC;
-+ h->command = cpu_to_be16(cmd);
-+ h->length = cpu_to_be16(size-sizeof(Drbd_Header));
-+
-+ dump_packet(mdev,sock,0,(void*)h, __FILE__, __LINE__);
-+ sent = drbd_send(mdev,sock,h,size,msg_flags);
-+
-+ ok = ( sent == size );
-+ if(!ok) {
-+ ERR("short sent %s size=%d sent=%d\n",
-+ cmdname(cmd), (int)size, sent);
-+ }
-+ return ok;
-+}
-+
-+int drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-+ Drbd_Packet_Cmd cmd, Drbd_Header* h, size_t size)
-+{
-+ int ok;
-+ sigset_t old_blocked;
-+
-+ if (sock == mdev->data.socket) {
-+ down(&mdev->data.mutex);
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=current;
-+ spin_unlock(&mdev->send_task_lock);
-+ } else
-+ down(&mdev->meta.mutex);
-+
-+ old_blocked = drbd_block_all_signals();
-+ ok = _drbd_send_cmd(mdev,sock,cmd,h,size,0);
-+ restore_old_sigset(old_blocked);
-+
-+ if (sock == mdev->data.socket) {
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=NULL;
-+ spin_unlock(&mdev->send_task_lock);
-+ up(&mdev->data.mutex);
-+ } else
-+ up(&mdev->meta.mutex);
-+ return ok;
-+}
-+
-+int drbd_send_sync_param(drbd_dev *mdev, struct syncer_config *sc)
-+{
-+ Drbd_SyncParam_Packet p;
-+ int ok;
-+
-+ p.rate = cpu_to_be32(sc->rate);
-+ p.use_csums = cpu_to_be32(sc->use_csums);
-+ p.skip = cpu_to_be32(sc->skip);
-+ p.group = cpu_to_be32(sc->group);
-+
-+ ok = drbd_send_cmd(mdev,mdev->data.socket,SyncParam,(Drbd_Header*)&p,sizeof(p));
-+ if ( ok
-+ && (mdev->cstate == SkippedSyncS || mdev->cstate == SkippedSyncT)
-+ && !sc->skip )
-+ {
-+ /* FIXME EXPLAIN. I think this cannot work properly! -lge */
-+ set_cstate(mdev,WFReportParams);
-+ ok = drbd_send_param(mdev,0);
-+ }
-+ return ok;
-+}
-+
-+int drbd_send_param(drbd_dev *mdev, int flags)
-+{
-+ Drbd_Parameter_Packet p;
-+ int i, ok, have_disk;
-+ unsigned long m_size; // sector_t ??
-+
-+ have_disk=inc_local(mdev);
-+ if(have_disk) {
-+ D_ASSERT(mdev->backing_bdev);
-+ if (mdev->md_index == -1 ) m_size = drbd_md_ss(mdev)>>1;
-+ else m_size = drbd_get_capacity(mdev->backing_bdev)>>1;
-+ } else m_size = 0;
-+
-+ p.u_size = cpu_to_be64(mdev->lo_usize);
-+ p.p_size = cpu_to_be64(m_size);
-+
-+ p.state = cpu_to_be32(mdev->state);
-+ p.protocol = cpu_to_be32(mdev->conf.wire_protocol);
-+ p.version = cpu_to_be32(PRO_VERSION);
-+
-+ for (i = Flags; i < GEN_CNT_SIZE; i++) {
-+ p.gen_cnt[i] = cpu_to_be32(mdev->gen_cnt[i]);
-+ }
-+ p.sync_rate = cpu_to_be32(mdev->sync_conf.rate);
-+ p.sync_use_csums = cpu_to_be32(mdev->sync_conf.use_csums);
-+ p.skip_sync = cpu_to_be32(mdev->sync_conf.skip);
-+ p.sync_group = cpu_to_be32(mdev->sync_conf.group);
-+ p.flags = cpu_to_be32(flags);
-+ p.magic = BE_DRBD_MAGIC;
-+
-+ ok = drbd_send_cmd(mdev,mdev->data.socket,ReportParams,(Drbd_Header*)&p,sizeof(p));
-+ if (have_disk) dec_local(mdev);
-+ return ok;
-+}
-+
-+/* See the comment at receive_bitmap() */
-+int _drbd_send_bitmap(drbd_dev *mdev)
-+{
-+ int want;
-+ int ok=TRUE, bm_i=0;
-+ size_t bm_words, num_words;
-+ unsigned long *buffer;
-+ Drbd_Header *p;
-+
-+ ERR_IF(!mdev->bitmap) return FALSE;
-+
-+ bm_words = drbd_bm_words(mdev);
-+ p = vmalloc(PAGE_SIZE); // sleeps. cannot fail.
-+ buffer = (unsigned long*)p->payload;
-+
-+ if (drbd_md_test_flag(mdev,MDF_FullSync)) {
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+ if (unlikely(test_bit(DISKLESS,&mdev->flags))) {
-+ /* write_bm did fail! panic.
-+ * FIXME can we do something better than panic?
-+ */
-+ drbd_panic("Failed to write bitmap to disk\n!");
-+ ok = FALSE;
-+ goto out;
-+ }
-+ drbd_md_clear_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+ }
-+
-+ /*
-+ * maybe TODO use some simple compression scheme, nowadays there are
-+ * some such algorithms in the kernel anyways.
-+ */
-+ do {
-+ num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
-+ want = num_words * sizeof(long);
-+ if (want) {
-+ drbd_bm_get_lel(mdev, bm_i, num_words, buffer);
-+ }
-+ ok = _drbd_send_cmd(mdev,mdev->data.socket,ReportBitMap,
-+ p, sizeof(*p) + want, 0);
-+ bm_i += num_words;
-+ } while (ok && want);
-+
-+ out:
-+ vfree(p);
-+ return ok;
-+}
-+
-+int drbd_send_bitmap(drbd_dev *mdev)
-+{
-+ int ok;
-+ down(&mdev->data.mutex);
-+ ok=_drbd_send_bitmap(mdev);
-+ up(&mdev->data.mutex);
-+ return ok;
-+}
-+
-+int _drbd_send_barrier(drbd_dev *mdev)
-+{
-+ int ok;
-+ Drbd_Barrier_Packet p;
-+
-+ /* printk(KERN_DEBUG DEVICE_NAME": issuing a barrier\n"); */
-+ /* tl_add_barrier() must be called with the sock_mutex aquired */
-+ p.barrier=tl_add_barrier(mdev);
-+
-+ inc_ap_pending(mdev);
-+ ok = _drbd_send_cmd(mdev,mdev->data.socket,Barrier,(Drbd_Header*)&p,sizeof(p),0);
-+
-+// if (!ok) dec_ap_pending(mdev); // is done in tl_clear()
-+ return ok;
-+}
-+
-+int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,u32 set_size)
-+{
-+ int ok;
-+ Drbd_BarrierAck_Packet p;
-+
-+ p.barrier = barrier_nr;
-+ p.set_size = cpu_to_be32(set_size);
-+
-+ ok = drbd_send_cmd(mdev,mdev->meta.socket,BarrierAck,(Drbd_Header*)&p,sizeof(p));
-+ return ok;
-+}
-+
-+
-+int drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
-+{
-+ int ok;
-+ Drbd_BlockAck_Packet p;
-+
-+ p.sector = cpu_to_be64(drbd_ee_get_sector(e));
-+ p.block_id = e->block_id;
-+ p.blksize = cpu_to_be32(drbd_ee_get_size(e));
-+
-+ if (!mdev->meta.socket || mdev->cstate < Connected) return FALSE;
-+ ok = drbd_send_cmd(mdev,mdev->meta.socket,cmd,(Drbd_Header*)&p,sizeof(p));
-+ return ok;
-+}
-+
-+int drbd_send_drequest(drbd_dev *mdev, int cmd,
-+ sector_t sector,int size, u64 block_id)
-+{
-+ int ok;
-+ Drbd_BlockRequest_Packet p;
-+
-+ p.sector = cpu_to_be64(sector);
-+ p.block_id = block_id;
-+ p.blksize = cpu_to_be32(size);
-+
-+ ok = drbd_send_cmd(mdev,mdev->data.socket,cmd,(Drbd_Header*)&p,sizeof(p));
-+ return ok;
-+}
-+
-+/* called on sndtimeo
-+ * returns FALSE if we should retry,
-+ * TRUE if we think connection is dead
-+ */
-+STATIC int we_should_drop_the_connection(drbd_dev *mdev, struct socket *sock)
-+{
-+ int drop_it;
-+ // long elapsed = (long)(jiffies - mdev->last_received);
-+ // DUMPLU(elapsed); // elapsed ignored for now.
-+
-+ drop_it = mdev->meta.socket == sock
-+ || !mdev->asender.task
-+ || get_t_state(&mdev->asender) != Running
-+ || (volatile int)mdev->cstate < Connected;
-+
-+ if (drop_it)
-+ return TRUE;
-+
-+ drop_it = !--mdev->ko_count;
-+ if ( !drop_it ) {
-+ ERR("[%s/%d] sock_sendmsg time expired, ko = %u\n",
-+ current->comm, current->pid, mdev->ko_count);
-+ request_ping(mdev);
-+ }
-+
-+ return drop_it; /* && (mdev->state == Primary) */;
-+}
-+
-+/* The idea of sendpage seems to be to put some kind of reference
-+ to the page into the skb, and to hand it over to the NIC. In
-+ this process get_page() gets called.
-+
-+ As soon as the page was really sent over the network put_page()
-+ gets called by some part of the network layer. [ NIC driver? ]
-+
-+ [ get_page() / put_page() increment/decrement the count. If count
-+ reaches 0 the page will be freed. ]
-+
-+ This works nicely with pages from FSs.
-+ But this means that in protocol A we might signal IO completion too early !
-+
-+ In order not to corrupt data during a resync we must make sure
-+ that we do not reuse our own buffer pages (EEs) to early, therefore
-+ we have the net_ee list.
-+
-+ XFS seems to have problems, still, it submits pages with page_count == 0!
-+ As a workaround, we disable sendpage on pages with page_count == 0 or PageSlab.
-+*/
-+int _drbd_no_send_page(drbd_dev *mdev, struct page *page,
-+ int offset, size_t size)
-+{
-+ int ret;
-+ ret = drbd_send(mdev, mdev->data.socket, kmap(page) + offset, size, 0);
-+ kunmap(page);
-+ return ret;
-+}
-+
-+#ifdef DRBD_DISABLE_SENDPAGE
-+int _drbd_send_page(drbd_dev *mdev, struct page *page,
-+ int offset, size_t size)
-+{
-+ int sent,ok;
-+ int len = size;
-+
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=current;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ sent = _drbd_no_send_page(mdev, page, offset, size);
-+ if (likely(sent > 0)) len -= sent;
-+
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=NULL;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ ok = (len == 0);
-+ if (likely(ok))
-+ mdev->send_cnt += size>>9;
-+ return ok;
-+}
-+#else
-+int _drbd_send_page(drbd_dev *mdev, struct page *page,
-+ int offset, size_t size)
-+{
-+ mm_segment_t oldfs = get_fs();
-+ int sent,ok;
-+ int len = size;
-+
-+#ifdef SHOW_SENDPAGE_USAGE
-+ unsigned long now = jiffies;
-+ static unsigned long total = 0;
-+ static unsigned long fallback = 0;
-+ static unsigned long last_rep = 0;
-+
-+ /* report statistics every hour,
-+ * if we had at least one fallback.
-+ */
-+ ++total;
-+ if (fallback && time_before(last_rep+3600*HZ, now)) {
-+ last_rep = now;
-+ printk(KERN_INFO DEVICE_NAME
-+ ": sendpage() omitted: %lu/%lu\n", fallback, total);
-+ }
-+#endif
-+
-+
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=current;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ /* PARANOIA. if this ever triggers,
-+ * something in the layers above us is really kaputt.
-+ *one roundtrip later:
-+ * doh. it triggered. so XFS _IS_ really kaputt ...
-+ * oh well...
-+ */
-+ if ( (page_count(page) < 1) || PageSlab(page) ) {
-+ /* e.g. XFS meta- & log-data is in slab pages, which have a
-+ * page_count of 0 and/or have PageSlab() set...
-+ */
-+#ifdef SHOW_SENDPAGE_USAGE
-+ ++fallback;
-+#endif
-+ sent = _drbd_no_send_page(mdev, page, offset, size);
-+ if (likely(sent > 0)) len -= sent;
-+ goto out;
-+ }
-+
-+ set_fs(KERNEL_DS);
-+ do {
-+ sent = mdev->data.socket->ops->sendpage(mdev->data.socket,page,
-+ offset,len,
-+ MSG_NOSIGNAL);
-+ if (sent == -EAGAIN) {
-+ if (we_should_drop_the_connection(mdev,
-+ mdev->data.socket))
-+ break;
-+ else
-+ continue;
-+ }
-+ if (sent <= 0) {
-+ WARN("%s: size=%d len=%d sent=%d\n",
-+ __func__,(int)size,len,sent);
-+ break;
-+ }
-+ len -= sent;
-+ offset += sent;
-+ // FIXME test "last_received" ...
-+ } while(len > 0 /* THINK && mdev->cstate >= Connected*/);
-+ set_fs(oldfs);
-+
-+ out:
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=NULL;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ ok = (len == 0);
-+ if (likely(ok))
-+ mdev->send_cnt += size>>9;
-+ return ok;
-+}
-+#endif
-+
-+// Used to send write requests: bh->b_rsector !!
-+int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req)
-+{
-+ int ok=1;
-+ sigset_t old_blocked;
-+ Drbd_Data_Packet p;
-+
-+ ERR_IF(!req || !req->master_bio) return FALSE;
-+
-+ p.head.magic = BE_DRBD_MAGIC;
-+ p.head.command = cpu_to_be16(Data);
-+ p.head.length = cpu_to_be16( sizeof(p)-sizeof(Drbd_Header)
-+ + drbd_req_get_size(req) );
-+
-+ p.sector = cpu_to_be64(drbd_req_get_sector(req));
-+ p.block_id = (unsigned long)req;
-+
-+ /* About tl_add():
-+ 1. This must be within the semaphor,
-+ to ensure right order in tl_ data structure and to
-+ ensure right order of packets on the write
-+ 2. This must happen before sending, otherwise we might
-+ get in the BlockAck packet before we have it on the
-+ tl_ datastructure (=> We would want to remove it before it
-+ is there!)
-+ 3. Q: Why can we add it to tl_ even when drbd_send() might fail ?
-+ There could be a tl_cancel() to remove it within the semaphore!
-+ A: If drbd_send fails, we will loose the connection. Then
-+ tl_cear() will simulate a RQ_DRBD_SEND and set it out of sync
-+ for everything in the data structure.
-+ */
-+
-+ /* Still called directly by drbd_make_request,
-+ * so all sorts of processes may end up here.
-+ * They may be interrupted by DRBD_SIG in response to
-+ * ioctl or some other "connection lost" event.
-+ * This is not propagated.
-+ */
-+
-+ old_blocked = drbd_block_all_signals();
-+ down(&mdev->data.mutex);
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=current;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ if(test_and_clear_bit(ISSUE_BARRIER,&mdev->flags))
-+ ok = _drbd_send_barrier(mdev);
-+ if(ok) {
-+ tl_add(mdev,req);
-+ dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__);
-+ set_bit(UNPLUG_REMOTE,&mdev->flags);
-+ ok = sizeof(p) == drbd_send(mdev,mdev->data.socket,&p,sizeof(p),MSG_MORE);
-+ if(ok) {
-+ if(mdev->conf.wire_protocol == DRBD_PROT_A) {
-+ ok = _drbd_send_bio(mdev,drbd_req_private_bio(req));
-+ } else {
-+ ok = _drbd_send_zc_bio(mdev,drbd_req_private_bio(req));
-+ }
-+ }
-+ if(!ok) tl_cancel(mdev,req);
-+ }
-+ if (!ok) {
-+ drbd_set_out_of_sync(mdev,
-+ drbd_req_get_sector(req),
-+ drbd_req_get_size(req));
-+ drbd_end_req(req,RQ_DRBD_SENT,ERF_NOTLD|1,
-+ drbd_req_get_sector(req));
-+ }
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=NULL;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ up(&mdev->data.mutex);
-+ restore_old_sigset(old_blocked);
-+ return ok;
-+}
-+
-+int drbd_send_block(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-+ struct Tl_epoch_entry *e)
-+{
-+ int ok;
-+ sigset_t old_blocked;
-+ Drbd_Data_Packet p;
-+
-+ p.head.magic = BE_DRBD_MAGIC;
-+ p.head.command = cpu_to_be16(cmd);
-+ p.head.length = cpu_to_be16( sizeof(p)-sizeof(Drbd_Header)
-+ + drbd_ee_get_size(e) );
-+
-+ p.sector = cpu_to_be64(drbd_ee_get_sector(e));
-+ p.block_id = e->block_id;
-+
-+ /* Only called by our kernel thread.
-+ * This one may be interupted by DRBD_SIG and/or DRBD_SIGKILL
-+ * in response to ioctl or module unload.
-+ */
-+ old_blocked = drbd_block_all_signals();
-+ down(&mdev->data.mutex);
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=current;
-+ spin_unlock(&mdev->send_task_lock);
-+
-+ dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__);
-+ ok = sizeof(p) == drbd_send(mdev,mdev->data.socket,&p,sizeof(p),MSG_MORE);
-+ if (ok) ok = _drbd_send_zc_bio(mdev,&e->private_bio);
-+
-+ spin_lock(&mdev->send_task_lock);
-+ mdev->send_task=NULL;
-+ spin_unlock(&mdev->send_task_lock);
-+ up(&mdev->data.mutex);
-+ restore_old_sigset(old_blocked);
-+ return ok;
-+}
-+
-+/*
-+ drbd_send distinguishes two cases:
-+
-+ Packets sent via the data socket "sock"
-+ and packets sent via the meta data socket "msock"
-+
-+ sock msock
-+ -----------------+-------------------------+------------------------------
-+ timeout conf.timeout / 2 conf.timeout / 2
-+ timeout action send a ping via msock Abort communication
-+ and close all sockets
-+*/
-+
-+/*
-+ * you should have down()ed the appropriate [m]sock_mutex elsewhere!
-+ */
-+int drbd_send(drbd_dev *mdev, struct socket *sock,
-+ void* buf, size_t size, unsigned msg_flags)
-+{
-+#if !HAVE_KERNEL_SENDMSG
-+ mm_segment_t oldfs;
-+ struct iovec iov;
-+#else
-+ struct kvec iov;
-+#endif
-+ struct msghdr msg;
-+ int rv,sent=0;
-+
-+ if (!sock) return -1000;
-+ if ((volatile int)mdev->cstate < WFReportParams) return -1001;
-+
-+ // THINK if (signal_pending) return ... ?
-+
-+ iov.iov_base = buf;
-+ iov.iov_len = size;
-+
-+ msg.msg_name = 0;
-+ msg.msg_namelen = 0;
-+#if !HAVE_KERNEL_SENDMSG
-+ msg.msg_iov = &iov;
-+ msg.msg_iovlen = 1;
-+#endif
-+ msg.msg_control = NULL;
-+ msg.msg_controllen = 0;
-+ msg.msg_flags = msg_flags | MSG_NOSIGNAL;
-+
-+#if !HAVE_KERNEL_SENDMSG
-+ oldfs = get_fs();
-+ set_fs(KERNEL_DS);
-+#endif
-+
-+ if (sock == mdev->data.socket)
-+ mdev->ko_count = mdev->conf.ko_count;
-+ do {
-+ /* STRANGE
-+ * tcp_sendmsg does _not_ use its size parameter at all ?
-+ *
-+ * -EAGAIN on timeout, -EINTR on signal.
-+ */
-+/* THINK
-+ * do we need to block DRBD_SIG if sock == &meta.socket ??
-+ * otherwise wake_asender() might interrupt some send_*Ack !
-+ */
-+#if !HAVE_KERNEL_SENDMSG
-+ rv = sock_sendmsg(sock, &msg, iov.iov_len );
-+#else
-+ rv = kernel_sendmsg(sock, &msg, &iov, 1, size);
-+#endif
-+ if (rv == -EAGAIN) {
-+ if (we_should_drop_the_connection(mdev,sock))
-+ break;
-+ else
-+ continue;
-+ }
-+ D_ASSERT(rv != 0);
-+ if (rv == -EINTR ) {
-+#if 0
-+ /* FIXME this happens all the time.
-+ * we don't care for now!
-+ * eventually this should be sorted out be the proper
-+ * use of the SIGNAL_ASENDER bit... */
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ DBG("Got a signal in drbd_send(,%c,)!\n",
-+ sock == mdev->meta.socket ? 'm' : 's');
-+ // dump_stack();
-+ }
-+#endif
-+ drbd_flush_signals(current);
-+ rv = 0;
-+ }
-+ if (rv < 0) break;
-+ sent += rv;
-+ iov.iov_base += rv;
-+ iov.iov_len -= rv;
-+ } while(sent < size);
-+
-+#if !HAVE_KERNEL_SENDMSG
-+ set_fs(oldfs);
-+#endif
-+
-+ if (rv <= 0) {
-+ if (rv != -EAGAIN) {
-+ ERR("%s_sendmsg returned %d\n",
-+ sock == mdev->meta.socket ? "msock" : "sock",
-+ rv);
-+ set_cstate(mdev, BrokenPipe);
-+ } else
-+ set_cstate(mdev, Timeout);
-+ drbd_thread_restart_nowait(&mdev->receiver);
-+ }
-+
-+ return sent;
-+}
-+
-+STATIC int drbd_open(struct inode *inode, struct file *file)
-+{
-+ int minor;
-+
-+ minor = MINOR(inode->i_rdev);
-+ if(minor >= minor_count) return -ENODEV;
-+
-+ if (file->f_mode & FMODE_WRITE) {
-+ if( drbd_conf[minor].state == Secondary) {
-+ return -EROFS;
-+ }
-+ set_bit(WRITER_PRESENT, &drbd_conf[minor].flags);
-+ }
-+
-+ drbd_conf[minor].open_cnt++;
-+
-+ NOT_IN_26(MOD_INC_USE_COUNT;)
-+
-+ return 0;
-+}
-+
-+STATIC int drbd_close(struct inode *inode, struct file *file)
-+{
-+ /* do not use *file (May be NULL, in case of a unmount :-) */
-+ int minor;
-+
-+ minor = MINOR(inode->i_rdev);
-+ if(minor >= minor_count) return -ENODEV;
-+
-+ /*
-+ printk(KERN_ERR DEVICE_NAME ": close(inode=%p,file=%p)"
-+ "current=%p,minor=%d,wc=%d\n", inode, file, current, minor,
-+ inode->i_writecount);
-+ */
-+
-+ if (--drbd_conf[minor].open_cnt == 0) {
-+ clear_bit(WRITER_PRESENT, &drbd_conf[minor].flags);
-+ }
-+
-+ NOT_IN_26(MOD_DEC_USE_COUNT;)
-+
-+ return 0;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+STATIC void drbd_unplug_fn(void *data)
-+{
-+ struct Drbd_Conf* mdev = (drbd_dev*)data;
-+ spin_lock_irq(&mdev->req_lock);
-+ if (list_empty(&mdev->unplug_work.list))
-+ _drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
-+ spin_unlock_irq(&mdev->req_lock);
-+}
-+#else
-+
-+STATIC void drbd_unplug_fn(request_queue_t *q)
-+{
-+ drbd_dev *mdev = q->queuedata;
-+
-+ /* unplug FIRST */
-+ spin_lock_irq(q->queue_lock);
-+ blk_remove_plug(q);
-+ spin_unlock_irq(q->queue_lock);
-+
-+ /* only if connected */
-+ if (mdev->cstate >= Connected && !test_bit(PARTNER_DISKLESS,&mdev->flags)) {
-+ D_ASSERT(mdev->state == Primary);
-+ if (test_and_clear_bit(UNPLUG_REMOTE,&mdev->flags)) {
-+ spin_lock_irq(&mdev->req_lock);
-+ /* add to the front of the data.work queue,
-+ * unless already queued.
-+ * XXX this might be a good addition to drbd_queue_work
-+ * anyways, to detect "double queuing" ... */
-+ if (list_empty(&mdev->unplug_work.list))
-+ _drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
-+ spin_unlock_irq(&mdev->req_lock);
-+ }
-+ }
-+
-+ if(!test_bit(DISKLESS,&mdev->flags)) drbd_kick_lo(mdev);
-+}
-+#endif
-+
-+void drbd_set_defaults(drbd_dev *mdev)
-+{
-+ mdev->flags = 1<<DISKLESS;
-+
-+ mdev->sync_conf.rate = 250;
-+ mdev->sync_conf.al_extents = 127; // 512 MB active set
-+ mdev->state = Secondary;
-+ mdev->o_state = Unknown;
-+ mdev->cstate = Unconfigured;
-+}
-+
-+void drbd_init_set_defaults(drbd_dev *mdev)
-+{
-+ // the memset(,0,) did most of this
-+ // note: only assignments, no allocation in here
-+
-+#ifdef PARANOIA
-+ SET_MDEV_MAGIC(mdev);
-+#endif
-+
-+ drbd_set_defaults(mdev);
-+
-+ atomic_set(&mdev->ap_bio_cnt,0);
-+ atomic_set(&mdev->ap_pending_cnt,0);
-+ atomic_set(&mdev->rs_pending_cnt,0);
-+ atomic_set(&mdev->unacked_cnt,0);
-+ atomic_set(&mdev->local_cnt,0);
-+ atomic_set(&mdev->resync_locked,0);
-+
-+ init_MUTEX(&mdev->md_io_mutex);
-+ init_MUTEX(&mdev->data.mutex);
-+ init_MUTEX(&mdev->meta.mutex);
-+ sema_init(&mdev->data.work.s,0);
-+ sema_init(&mdev->meta.work.s,0);
-+
-+ mdev->al_lock = SPIN_LOCK_UNLOCKED;
-+ mdev->tl_lock = SPIN_LOCK_UNLOCKED;
-+ mdev->ee_lock = SPIN_LOCK_UNLOCKED;
-+ mdev->req_lock = SPIN_LOCK_UNLOCKED;
-+ mdev->pr_lock = SPIN_LOCK_UNLOCKED;
-+ mdev->send_task_lock = SPIN_LOCK_UNLOCKED;
-+
-+ INIT_LIST_HEAD(&mdev->free_ee);
-+ INIT_LIST_HEAD(&mdev->active_ee);
-+ INIT_LIST_HEAD(&mdev->sync_ee);
-+ INIT_LIST_HEAD(&mdev->done_ee);
-+ INIT_LIST_HEAD(&mdev->read_ee);
-+ INIT_LIST_HEAD(&mdev->net_ee);
-+ INIT_LIST_HEAD(&mdev->app_reads);
-+ INIT_LIST_HEAD(&mdev->resync_reads);
-+ INIT_LIST_HEAD(&mdev->data.work.q);
-+ INIT_LIST_HEAD(&mdev->meta.work.q);
-+ INIT_LIST_HEAD(&mdev->resync_work.list);
-+ INIT_LIST_HEAD(&mdev->barrier_work.list);
-+ INIT_LIST_HEAD(&mdev->unplug_work.list);
-+ mdev->resync_work.cb = w_resync_inactive;
-+ mdev->barrier_work.cb = w_try_send_barrier;
-+ mdev->unplug_work.cb = w_send_write_hint;
-+ init_timer(&mdev->resync_timer);
-+ mdev->resync_timer.function = resync_timer_fn;
-+ mdev->resync_timer.data = (unsigned long) mdev;
-+
-+ init_waitqueue_head(&mdev->cstate_wait);
-+ init_waitqueue_head(&mdev->ee_wait);
-+ init_waitqueue_head(&mdev->al_wait);
-+
-+ drbd_thread_init(mdev, &mdev->receiver, drbdd_init);
-+ drbd_thread_init(mdev, &mdev->worker, drbd_worker);
-+ drbd_thread_init(mdev, &mdev->asender, drbd_asender);
-+
-+NOT_IN_26(
-+ mdev->write_hint_tq.routine = &drbd_unplug_fn;
-+ mdev->write_hint_tq.data = mdev;
-+)
-+
-+#ifdef __arch_um__
-+ INFO("mdev = 0x%p\n",mdev);
-+#endif
-+}
-+
-+void drbd_mdev_cleanup(drbd_dev *mdev)
-+{
-+ /* I'd like to cleanup completely, and memset(,0,) it.
-+ * but I'd have to reinit it.
-+ * FIXME: do the right thing...
-+ */
-+
-+ /* list of things that may still
-+ * hold data of the previous config
-+
-+ * act_log ** re-initialized in set_disk
-+ * on_io_error
-+
-+ * al_tr_cycle ** re-initialized in ... FIXME??
-+ * al_tr_number
-+ * al_tr_pos
-+
-+ * backing_bdev ** re-initialized in drbd_free_ll_dev
-+ * lo_file
-+ * md_bdev
-+ * md_file
-+ * md_index
-+
-+ * ko_count ** re-initialized in set_net
-+
-+ * last_received ** currently ignored
-+
-+ * mbds_id ** re-initialized in ... FIXME??
-+
-+ * resync ** re-initialized in ... FIXME??
-+
-+ *** no re-init necessary (?) ***
-+ * md_io_page
-+ * this_bdev
-+
-+ * vdisk ?
-+
-+ * rq_queue ** FIXME ASSERT ??
-+ * newest_barrier
-+ * oldest_barrier
-+ */
-+
-+ drbd_thread_stop(&mdev->worker);
-+
-+ if ( mdev->ee_in_use != 0
-+ || mdev->ee_vacant != 32 /* EE_MININUM */
-+ || atomic_read(&mdev->epoch_size) != 0)
-+ ERR("ee_in_use:%d ee_vacant:%d epoch_size:%d\n",
-+ mdev->ee_in_use, mdev->ee_vacant, atomic_read(&mdev->epoch_size));
-+#define ZAP(x) memset(&x,0,sizeof(x))
-+ ZAP(mdev->conf);
-+ ZAP(mdev->sync_conf);
-+ // ZAP(mdev->data); Not yet!
-+ // ZAP(mdev->meta); Not yet!
-+ ZAP(mdev->gen_cnt);
-+#undef ZAP
-+ mdev->al_writ_cnt =
-+ mdev->bm_writ_cnt =
-+ mdev->read_cnt =
-+ mdev->recv_cnt =
-+ mdev->send_cnt =
-+ mdev->writ_cnt =
-+ mdev->la_size =
-+ mdev->lo_usize =
-+ mdev->p_size =
-+ mdev->rs_start =
-+ mdev->rs_total =
-+ mdev->rs_mark_left =
-+ mdev->rs_mark_time = 0;
-+ mdev->send_task = NULL;
-+ drbd_set_my_capacity(mdev,0);
-+ drbd_bm_resize(mdev,0);
-+
-+ // just in case
-+ drbd_free_resources(mdev);
-+
-+ /*
-+ * currently we drbd_init_ee only on module load, so
-+ * we may do drbd_release_ee only on module unload!
-+ * drbd_release_ee(&mdev->free_ee);
-+ * D_ASSERT(list_emptry(&mdev->free_ee));
-+ *
-+ */
-+ D_ASSERT(list_empty(&mdev->active_ee));
-+ D_ASSERT(list_empty(&mdev->sync_ee));
-+ D_ASSERT(list_empty(&mdev->done_ee));
-+ D_ASSERT(list_empty(&mdev->read_ee));
-+ D_ASSERT(list_empty(&mdev->net_ee));
-+ D_ASSERT(list_empty(&mdev->app_reads));
-+ D_ASSERT(list_empty(&mdev->resync_reads));
-+ D_ASSERT(list_empty(&mdev->data.work.q));
-+ D_ASSERT(list_empty(&mdev->meta.work.q));
-+ D_ASSERT(list_empty(&mdev->resync_work.list));
-+ D_ASSERT(list_empty(&mdev->barrier_work.list));
-+ D_ASSERT(list_empty(&mdev->unplug_work.list));
-+
-+ drbd_set_defaults(mdev);
-+}
-+
-+
-+void drbd_destroy_mempools(void)
-+{
-+ if (drbd_request_mempool)
-+ mempool_destroy(drbd_request_mempool);
-+ if (drbd_ee_cache && kmem_cache_destroy(drbd_ee_cache))
-+ printk(KERN_ERR DEVICE_NAME
-+ ": kmem_cache_destroy(drbd_ee_cache) FAILED\n");
-+ if (drbd_request_cache && kmem_cache_destroy(drbd_request_cache))
-+ printk(KERN_ERR DEVICE_NAME
-+ ": kmem_cache_destroy(drbd_request_cache) FAILED\n");
-+ // FIXME what can we do if we fail to destroy them?
-+
-+ drbd_request_mempool = NULL;
-+ drbd_ee_cache = NULL;
-+ drbd_request_cache = NULL;
-+
-+ return;
-+}
-+
-+int drbd_create_mempools(void)
-+{
-+ // prepare our caches and mempools
-+ drbd_request_mempool = NULL;
-+ drbd_ee_cache = NULL;
-+ drbd_request_cache = NULL;
-+
-+ // caches
-+ drbd_request_cache = kmem_cache_create(
-+ "drbd_req_cache", sizeof(drbd_request_t),
-+ 0, 0, NULL, NULL);
-+ if (drbd_request_cache == NULL)
-+ goto Enomem;
-+
-+ drbd_ee_cache = kmem_cache_create(
-+ "drbd_ee_cache", sizeof(struct Tl_epoch_entry),
-+ 0, 0, NULL, NULL);
-+ if (drbd_ee_cache == NULL)
-+ goto Enomem;
-+
-+ // mempools
-+ drbd_request_mempool = mempool_create(16, //TODO; reasonable value
-+ mempool_alloc_slab, mempool_free_slab, drbd_request_cache);
-+ if (drbd_request_mempool == NULL)
-+ goto Enomem;
-+
-+ return 0;
-+
-+ Enomem:
-+ drbd_destroy_mempools(); // in case we allocated some
-+ return -ENOMEM;
-+}
-+
-+static void __exit drbd_cleanup(void)
-+{
-+ int i, rr;
-+
-+ if (drbd_conf) {
-+ for (i = 0; i < minor_count; i++) {
-+ drbd_dev *mdev = drbd_conf + i;
-+
-+ if (mdev) {
-+ down(&mdev->device_mutex);
-+ drbd_set_state(mdev,Secondary);
-+ up(&mdev->device_mutex);
-+ drbd_sync_me(mdev);
-+ set_bit(DO_NOT_INC_CONCNT,&mdev->flags);
-+ drbd_thread_stop(&mdev->receiver);
-+ drbd_thread_stop(&mdev->worker);
-+ }
-+ }
-+
-+ if (drbd_proc)
-+ remove_proc_entry("drbd",&proc_root);
-+ i=minor_count;
-+ while (i--) {
-+ drbd_dev *mdev = drbd_conf+i;
-+ONLY_IN_26(
-+ struct gendisk **disk = &mdev->vdisk;
-+ request_queue_t **q = &mdev->rq_queue;
-+)
-+
-+ drbd_free_resources(mdev);
-+
-+ONLY_IN_26(
-+ if (*disk) {
-+ del_gendisk(*disk);
-+ put_disk(*disk);
-+ *disk = NULL;
-+ }
-+ if (*q) blk_put_queue(*q);
-+ *q = NULL;
-+
-+ if (mdev->this_bdev->bd_holder == drbd_sec_holder) {
-+ mdev->this_bdev->bd_contains = mdev->this_bdev;
-+ bd_release(mdev->this_bdev);
-+ }
-+ if (mdev->this_bdev) bdput(mdev->this_bdev);
-+)
-+
-+ tl_cleanup(mdev);
-+ if (mdev->bitmap) drbd_bm_cleanup(mdev);
-+ if (mdev->resync) lc_free(mdev->resync);
-+
-+ D_ASSERT(mdev->ee_in_use==0);
-+
-+ rr = drbd_release_ee(mdev,&mdev->free_ee);
-+ // INFO("%d EEs in free list found.\n",rr);
-+ // D_ASSERT(rr == 32);
-+
-+ rr = drbd_release_ee(mdev,&mdev->active_ee);
-+ if(rr) ERR("%d EEs in active list found!\n",rr);
-+
-+ rr = drbd_release_ee(mdev,&mdev->sync_ee);
-+ if(rr) ERR("%d EEs in sync list found!\n",rr);
-+
-+ rr = drbd_release_ee(mdev,&mdev->read_ee);
-+ if(rr) ERR("%d EEs in read list found!\n",rr);
-+
-+ rr = drbd_release_ee(mdev,&mdev->done_ee);
-+ if(rr) ERR("%d EEs in done list found!\n",rr);
-+
-+ rr = drbd_release_ee(mdev,&mdev->net_ee);
-+ if(rr) ERR("%d EEs in net list found!\n",rr);
-+
-+ ERR_IF (!list_empty(&mdev->data.work.q)) {
-+ struct list_head *lp;
-+ list_for_each(lp,&mdev->data.work.q) {
-+ DUMPP(lp);
-+ }
-+ };
-+ D_ASSERT(mdev->ee_vacant == 0);
-+
-+ if (mdev->md_io_page)
-+ __free_page(mdev->md_io_page);
-+
-+ if (mdev->md_io_tmpp)
-+ __free_page(mdev->md_io_tmpp);
-+
-+ if (mdev->act_log) lc_free(mdev->act_log);
-+ }
-+ drbd_destroy_mempools();
-+ }
-+
-+#ifndef HAVE_COMPAT_IOCTL_MEMBER
-+#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
-+ lock_kernel();
-+ unregister_ioctl32_conversion(DRBD_IOCTL_GET_VERSION);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_STATE);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_DISK_CONFIG);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_NET_CONFIG);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_NET);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_GET_CONFIG);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_INVALIDATE);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_INVALIDATE_REM);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_SYNC_CONFIG);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_DISK_SIZE);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_WAIT_CONNECT);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_WAIT_SYNC);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_DISK);
-+ unregister_ioctl32_conversion(DRBD_IOCTL_SET_STATE_FLAGS);
-+ unlock_kernel();
-+#endif
-+#endif
-+
-+NOT_IN_26(
-+ blksize_size[MAJOR_NR] = NULL;
-+ blk_size[MAJOR_NR] = NULL;
-+ // kfree(NULL) is noop
-+ kfree(drbd_blocksizes);
-+ kfree(drbd_sizes);
-+)
-+ kfree(drbd_conf);
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ devfs_unregister(devfs_handle);
-+#else
-+ devfs_remove(drbd_devfs_name);
-+#endif
-+
-+ if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0)
-+ printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
-+
-+ printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
-+}
-+
-+int sizeof_drbd_structs_sanity_check(void);
-+int __init drbd_init(void)
-+{
-+ int i,err;
-+
-+#if 0
-+#warning "DEBUGGING"
-+/* I am too lazy to calculate this by hand -lge
-+ */
-+#define SZO(x) printk(KERN_ERR "sizeof(" #x ") = %d\n", sizeof(x))
-+ SZO(struct Drbd_Conf);
-+ SZO(struct buffer_head);
-+ SZO(Drbd_Polymorph_Packet);
-+ SZO(struct drbd_socket);
-+ SZO(struct bm_extent);
-+ SZO(struct lc_element);
-+ SZO(struct semaphore);
-+ SZO(struct drbd_request);
-+ SZO(struct bio);
-+ SZO(wait_queue_head_t);
-+ SZO(spinlock_t);
-+ SZO(Drbd_Header);
-+ SZO(Drbd_HandShake_Packet);
-+ SZO(Drbd_Barrier_Packet);
-+ SZO(Drbd_BarrierAck_Packet);
-+ SZO(Drbd_SyncParam_Packet);
-+ SZO(Drbd_Parameter_Packet);
-+ SZO(Drbd06_Parameter_P);
-+ SZO(Drbd_Data_Packet);
-+ SZO(Drbd_BlockAck_Packet);
-+ printk(KERN_ERR "AL_EXTENTS_PT = %d\n",AL_EXTENTS_PT);
-+ printk(KERN_ERR "DRBD_MAX_SECTORS = %llu\n",DRBD_MAX_SECTORS);
-+ return -EBUSY;
-+#endif
-+
-+ if (sizeof(Drbd_HandShake_Packet) != 80) {
-+ printk(KERN_ERR DEVICE_NAME
-+ ": never change the size or layout of the HandShake packet.\n");
-+ return -EINVAL;
-+ }
-+ if (sizeof_drbd_structs_sanity_check()) {
-+ return -EINVAL;
-+ }
-+
-+ if (use_nbd_major) {
-+ major_nr = NBD_MAJOR;
-+ }
-+
-+ if (1 > minor_count||minor_count > 255) {
-+ printk(KERN_ERR DEVICE_NAME
-+ ": invalid minor_count (%d)\n",minor_count);
-+#ifdef MODULE
-+ return -EINVAL;
-+#else
-+ minor_count = 8;
-+#endif
-+ }
-+
-+ err = register_blkdev(MAJOR_NR, DEVICE_NAME
-+ NOT_IN_26(, &drbd_ops)
-+ );
-+ if (err) {
-+ printk(KERN_ERR DEVICE_NAME
-+ ": unable to register block device major %d\n",
-+ MAJOR_NR);
-+ return err;
-+ }
-+
-+ drbd_devfs_name = (major_nr == NBD_MAJOR) ? "nbd" : "drbd";
-+
-+ /*
-+ * allocate all necessary structs
-+ */
-+ err = -ENOMEM;
-+
-+ drbd_proc = NULL; // play safe for drbd_cleanup
-+ drbd_conf = kmalloc(sizeof(drbd_dev)*minor_count,GFP_KERNEL);
-+ if (likely(drbd_conf!=NULL))
-+ memset(drbd_conf,0,sizeof(drbd_dev)*minor_count);
-+ else goto Enomem;
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ drbd_sizes = kmalloc(sizeof(int)*minor_count,GFP_KERNEL);
-+ if (likely(drbd_sizes!=NULL))
-+ memset(drbd_sizes,0,sizeof(int)*minor_count);
-+ else goto Enomem;
-+ drbd_blocksizes = kmalloc(sizeof(int)*minor_count,GFP_KERNEL);
-+ if (unlikely(!drbd_blocksizes)) goto Enomem;
-+#else
-+
-+ devfs_mk_dir(drbd_devfs_name);
-+
-+ for (i = 0; i < minor_count; i++) {
-+ drbd_dev *mdev = drbd_conf + i;
-+ struct gendisk *disk;
-+ request_queue_t *q;
-+
-+ q = blk_alloc_queue(GFP_KERNEL);
-+ if (!q) goto Enomem;
-+ mdev->rq_queue = q;
-+ q->queuedata = mdev;
-+
-+ disk = alloc_disk(1);
-+ if (!disk) goto Enomem;
-+ mdev->vdisk = disk;
-+
-+ set_disk_ro( disk, TRUE );
-+
-+ disk->queue = q;
-+ disk->major = MAJOR_NR;
-+ disk->first_minor = i;
-+ disk->fops = &drbd_ops;
-+ sprintf(disk->disk_name, DEVICE_NAME "%d", i);
-+ sprintf(disk->devfs_name, "%s/%d", drbd_devfs_name, i);
-+ disk->private_data = mdev;
-+ add_disk(disk);
-+
-+ mdev->this_bdev = bdget(MKDEV(MAJOR_NR,i));
-+ // we have no partitions. we contain only ourselves.
-+ mdev->this_bdev->bd_contains = mdev->this_bdev;
-+ if (bd_claim(mdev->this_bdev,drbd_sec_holder)) {
-+ // Initial we are Secondary -> should claim myself.
-+ WARN("Could not bd_claim() myself.");
-+ } else if (disable_bd_claim) {
-+ bd_release(mdev->this_bdev);
-+ }
-+
-+ blk_queue_make_request(q,drbd_make_request_26);
-+ q->queue_lock = &mdev->req_lock; // needed since we use
-+ // plugging on a queue, that actually has no requests!
-+ q->unplug_fn = drbd_unplug_fn;
-+ }
-+#endif
-+
-+ if ((err = drbd_create_mempools()))
-+ goto Enomem;
-+
-+ for (i = 0; i < minor_count; i++) {
-+ drbd_dev *mdev = &drbd_conf[i];
-+ struct page *page = alloc_page(GFP_KERNEL);
-+
-+ drbd_init_set_defaults(mdev);
-+
-+NOT_IN_26(
-+ drbd_blocksizes[i] = INITIAL_BLOCK_SIZE;
-+ mdev->this_bdev = MKDEV(MAJOR_NR, i);
-+ set_device_ro( MKDEV(MAJOR_NR, i), TRUE );
-+)
-+
-+ if(!page) goto Enomem;
-+ mdev->md_io_page = page;
-+
-+ if (drbd_bm_init(mdev)) goto Enomem;
-+ // no need to lock access, we are still initializing the module.
-+ mdev->resync = lc_alloc(17, sizeof(struct bm_extent),mdev);
-+ if (!mdev->resync) goto Enomem;
-+ mdev->act_log = lc_alloc(mdev->sync_conf.al_extents,
-+ sizeof(struct lc_element), mdev);
-+ if (!mdev->act_log) goto Enomem;
-+
-+ init_MUTEX(&mdev->device_mutex);
-+ if (!tl_init(mdev)) goto Enomem;
-+ if (!drbd_init_ee(mdev)) goto Enomem;
-+ }
-+
-+#if CONFIG_PROC_FS
-+ /*
-+ * register with procfs
-+ */
-+ drbd_proc = create_proc_entry("drbd", S_IFREG | S_IRUGO , &proc_root);
-+
-+ if (!drbd_proc) {
-+ printk(KERN_ERR DEVICE_NAME": unable to register proc file\n");
-+ goto Enomem;
-+ }
-+
-+ drbd_proc->proc_fops = &drbd_proc_fops;
-+ drbd_proc->owner = THIS_MODULE;
-+#else
-+# error "Currently drbd depends on the proc file system (CONFIG_PROC_FS)"
-+#endif
-+NOT_IN_26(
-+ blksize_size[MAJOR_NR] = drbd_blocksizes;
-+ blk_size[MAJOR_NR] = drbd_sizes;
-+)
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ devfs_handle = devfs_mk_dir (NULL, drbd_devfs_name, NULL);
-+ devfs_register_series(devfs_handle, "%u", minor_count,
-+ DEVFS_FL_DEFAULT, MAJOR_NR, 0,
-+ S_IFBLK | S_IRUSR | S_IWUSR,
-+ &drbd_ops, NULL);
-+#endif
-+
-+ NOT_IN_26(blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR),drbd_make_request_24);)
-+
-+#ifndef HAVE_COMPAT_IOCTL_MEMBER
-+#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
-+ // tell the kernel that we think our ioctls are 64bit clean
-+ lock_kernel();
-+ register_ioctl32_conversion(DRBD_IOCTL_GET_VERSION,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_STATE,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_DISK_CONFIG,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_NET_CONFIG,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_NET,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_GET_CONFIG,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_INVALIDATE,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_INVALIDATE_REM,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_SYNC_CONFIG,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_DISK_SIZE,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_WAIT_CONNECT,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_WAIT_SYNC,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_DISK,NULL);
-+ register_ioctl32_conversion(DRBD_IOCTL_SET_STATE_FLAGS,NULL);
-+ unlock_kernel();
-+#endif
-+#endif
-+
-+ printk(KERN_INFO DEVICE_NAME ": initialised. "
-+ "Version: " REL_VERSION " (api:%d/proto:%d)\n",
-+ API_VERSION,PRO_VERSION);
-+ printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
-+ if (use_nbd_major) {
-+ printk(KERN_INFO DEVICE_NAME": hijacking NBD device major!\n");
-+ }
-+ printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", MAJOR_NR);
-+
-+ return 0; // Success!
-+
-+ Enomem:
-+ drbd_cleanup();
-+ if (err == -ENOMEM) // currently always the case
-+ printk(KERN_ERR DEVICE_NAME ": ran out of memory\n");
-+ else
-+ printk(KERN_ERR DEVICE_NAME ": initialization failure\n");
-+ return err;
-+}
-+
-+void drbd_free_ll_dev(drbd_dev *mdev)
-+{
-+ struct file *lo_file;
-+
-+ lo_file = mdev->lo_file;
-+ mdev->lo_file = 0;
-+ wmb();
-+
-+ if (lo_file) {
-+NOT_IN_26(
-+ blkdev_put(lo_file->f_dentry->d_inode->i_bdev,BDEV_FILE);
-+ blkdev_put(mdev->md_file->f_dentry->d_inode->i_bdev,BDEV_FILE);
-+)
-+ONLY_IN_26(
-+ bd_release(mdev->backing_bdev);
-+ bd_release(mdev->md_bdev);
-+)
-+ mdev->md_bdev =
-+ mdev->backing_bdev = 0;
-+
-+ fput(lo_file);
-+ fput(mdev->md_file);
-+ // mdev->lo_file = 0;
-+ mdev->md_file = 0;
-+ }
-+}
-+
-+void drbd_free_sock(drbd_dev *mdev)
-+{
-+ if (mdev->data.socket) {
-+ sock_release(mdev->data.socket);
-+ mdev->data.socket = 0;
-+ }
-+ if (mdev->meta.socket) {
-+ sock_release(mdev->meta.socket);
-+ mdev->meta.socket = 0;
-+ }
-+}
-+
-+
-+void drbd_free_resources(drbd_dev *mdev)
-+{
-+ drbd_free_sock(mdev);
-+ drbd_free_ll_dev(mdev);
-+}
-+
-+/*********************************/
-+/* meta data management */
-+
-+struct meta_data_on_disk {
-+ u64 la_size; // last agreed size.
-+ u32 gc[GEN_CNT_SIZE]; // generation counter
-+ u32 magic;
-+ u32 md_size;
-+ u32 al_offset; // offset to this block
-+ u32 al_nr_extents; // important for restoring the AL
-+ u32 bm_offset; // offset to the bitmap, from here
-+} __attribute((packed));
-+
-+/*
-+
-+FIXME md_io might fail unnoticed sometimes ...
-+
-+*/
-+void drbd_md_write(drbd_dev *mdev)
-+{
-+ struct meta_data_on_disk * buffer;
-+ u32 flags;
-+ sector_t sector;
-+ int i;
-+
-+ ERR_IF(!inc_local_md_only(mdev)) return;
-+
-+ down(&mdev->md_io_mutex);
-+ buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
-+ memset(buffer,0,512);
-+
-+ flags = mdev->gen_cnt[Flags] & ~(MDF_PrimaryInd|MDF_ConnectedInd);
-+ if (mdev->state == Primary) flags |= MDF_PrimaryInd;
-+ if (mdev->cstate >= WFReportParams) flags |= MDF_ConnectedInd;
-+ mdev->gen_cnt[Flags] = flags;
-+
-+ for (i = Flags; i < GEN_CNT_SIZE; i++)
-+ buffer->gc[i]=cpu_to_be32(mdev->gen_cnt[i]);
-+ buffer->la_size=cpu_to_be64(drbd_get_capacity(mdev->this_bdev)>>1);
-+ buffer->magic=cpu_to_be32(DRBD_MD_MAGIC);
-+
-+ buffer->md_size = __constant_cpu_to_be32(MD_RESERVED_SIZE);
-+ buffer->al_offset = __constant_cpu_to_be32(MD_AL_OFFSET);
-+ buffer->al_nr_extents = cpu_to_be32(mdev->act_log->nr_elements);
-+
-+ buffer->bm_offset = __constant_cpu_to_be32(MD_BM_OFFSET);
-+
-+ sector = drbd_md_ss(mdev) + MD_GC_OFFSET;
-+
-+#if 0
-+ /* FIXME sooner or later I'd like to use the MD_DIRTY flag everywhere,
-+ * so we can avoid unneccessary md writes.
-+ */
-+ ERR_IF (!test_bit(MD_DIRTY,&mdev->flags)) {
-+ dump_stack();
-+ }
-+#endif
-+
-+ if (drbd_md_sync_page_io(mdev,sector,WRITE)) {
-+ clear_bit(MD_DIRTY,&mdev->flags);
-+ } else {
-+ if (test_bit(DISKLESS,&mdev->flags)) {
-+ /* this was a try anyways ... */
-+ ERR("meta data update failed!\n");
-+ } else {
-+ /* If we cannot write our meta data,
-+ * but we are supposed to be able to,
-+ * tough!
-+ */
-+ drbd_panic("meta data update failed!\n");
-+ }
-+ }
-+
-+ // why is this here?? please EXPLAIN.
-+ mdev->la_size = drbd_get_capacity(mdev->this_bdev)>>1;
-+
-+ up(&mdev->md_io_mutex);
-+ dec_local(mdev);
-+}
-+
-+/*
-+ * return:
-+ * < 0 if we had an error (currently never ...)
-+ * = 0 if we need a FullSync because either the flag is set,
-+ * or the gen counts are invalid
-+ * > 0 if we could read valid gen counts,
-+ * and reading the bitmap and act log does make sense.
-+ */
-+int drbd_md_read(drbd_dev *mdev)
-+{
-+ struct meta_data_on_disk * buffer;
-+ sector_t sector;
-+ int i;
-+
-+ if(!inc_local_md_only(mdev)) return -1;
-+
-+ down(&mdev->md_io_mutex);
-+ buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
-+
-+ sector = drbd_md_ss(mdev) + MD_GC_OFFSET;
-+
-+/* FIXME different failure cases: IO error or invalid magic */
-+
-+ ERR_IF( ! drbd_md_sync_page_io(mdev,sector,READ) ) goto err;
-+
-+ if(be32_to_cpu(buffer->magic) != DRBD_MD_MAGIC) goto err;
-+
-+ for(i=Flags;i<=ArbitraryCnt;i++)
-+ mdev->gen_cnt[i]=be32_to_cpu(buffer->gc[i]);
-+ mdev->la_size = be64_to_cpu(buffer->la_size);
-+ mdev->sync_conf.al_extents = be32_to_cpu(buffer->al_nr_extents);
-+ if (mdev->sync_conf.al_extents < 7)
-+ mdev->sync_conf.al_extents = 127;
-+
-+ up(&mdev->md_io_mutex);
-+ dec_local(mdev);
-+
-+ return !drbd_md_test_flag(mdev,MDF_FullSync);
-+
-+ err:
-+ up(&mdev->md_io_mutex);
-+ dec_local(mdev);
-+
-+ INFO("Creating state block\n");
-+
-+ /* if we need to create a state block, we are
-+ * not consistent, and need a sync of the full device!
-+ * if one knows what he is doing, he can manipulate gcs by hand,
-+ * and avoid the initial full sync...
-+ * otherwise, one of us will have to be forced (--do-what-I-say)
-+ * to be primary, before anything is usable.
-+ */
-+ set_bit(MD_DIRTY,&mdev->flags);
-+ mdev->gen_cnt[Flags] = MDF_FullSync;
-+ for(i = HumanCnt; i < GEN_CNT_SIZE; i++) mdev->gen_cnt[i]=1;
-+
-+/* FIXME might have IO errors! */
-+ drbd_md_write(mdev);
-+
-+ return 0;
-+}
-+
-+#if DUMP_MD >= 1
-+#define MeGC(x) mdev->gen_cnt[x]
-+#define PeGC(x) be32_to_cpu(peer->gen_cnt[x])
-+
-+void drbd_dump_md(drbd_dev *mdev, Drbd_Parameter_Packet *peer, int verbose)
-+{
-+ INFO("I am(%c): %c:%08x:%08x:%08x:%08x:%c%c\n",
-+ mdev->state == Primary ? 'P':'S',
-+ MeGC(Flags) & MDF_Consistent ? '1' : '0',
-+ MeGC(HumanCnt),
-+ MeGC(TimeoutCnt),
-+ MeGC(ConnectedCnt),
-+ MeGC(ArbitraryCnt),
-+ MeGC(Flags) & MDF_PrimaryInd ? '1' : '0',
-+ MeGC(Flags) & MDF_ConnectedInd ? '1' : '0');
-+ if (peer) {
-+ INFO("Peer(%c): %c:%08x:%08x:%08x:%08x:%c%c\n",
-+ be32_to_cpu(peer->state) == Primary ? 'P':'S',
-+ PeGC(Flags) & MDF_Consistent ? '1' : '0',
-+ PeGC(HumanCnt),
-+ PeGC(TimeoutCnt),
-+ PeGC(ConnectedCnt),
-+ PeGC(ArbitraryCnt),
-+ PeGC(Flags) & MDF_PrimaryInd ? '1' : '0',
-+ PeGC(Flags) & MDF_ConnectedInd ? '1' : '0');
-+ } else {
-+ INFO("Peer Unknown.\n");
-+ }
-+ if (verbose) {
-+ /* TODO
-+ * dump activity log and bitmap summary,
-+ * and maybe other statistics
-+ */
-+ }
-+}
-+
-+#undef MeGC
-+#undef PeGC
-+#else
-+void drbd_dump_md(drbd_dev *mdev, Drbd_Parameter_Packet *peer, int verbose)
-+{ /* do nothing */ }
-+#endif
-+
-+// Returns 1 if I have the good bits,
-+// 0 if both are nice
-+// -1 if the partner has the good bits.
-+int drbd_md_compare(drbd_dev *mdev,Drbd_Parameter_Packet *partner)
-+{
-+ int i;
-+ u32 me,other;
-+
-+ /* FIXME
-+ * we should not only rely on the consistent bit, but at least check
-+ * whether the rest of the gencounts is plausible, to detect a previous
-+ * split brain situation, and refuse anything until we are told
-+ * otherwise!
-+ *
-+ * And we should refuse to become SyncSource if we are not consistent!
-+ *
-+ * though DRBD is not to blame for it,
-+ * someone eventually will try to blame it ...
-+ */
-+
-+ me=mdev->gen_cnt[Flags] & MDF_Consistent;
-+ other=be32_to_cpu(partner->gen_cnt[Flags]) & MDF_Consistent;
-+ if( me > other ) return 1;
-+ if( me < other ) return -1;
-+
-+ for(i=HumanCnt;i<=ArbitraryCnt;i++) {
-+ me=mdev->gen_cnt[i];
-+ other=be32_to_cpu(partner->gen_cnt[i]);
-+ if( me > other ) return 1;
-+ if( me < other ) return -1;
-+ }
-+
-+ me=mdev->gen_cnt[Flags] & MDF_PrimaryInd;
-+ other=be32_to_cpu(partner->gen_cnt[Flags]) & MDF_PrimaryInd;
-+ if( me > other ) return 1;
-+ if( me < other ) return -1;
-+
-+ return 0;
-+}
-+
-+/* THINK do these have to be protected by some lock ? */
-+void drbd_md_inc(drbd_dev *mdev, enum MetaDataIndex order)
-+{
-+ set_bit(MD_DIRTY,&mdev->flags);
-+ mdev->gen_cnt[order]++;
-+}
-+void drbd_md_set_flag(drbd_dev *mdev, int flag)
-+{
-+ if ( (mdev->gen_cnt[Flags] & flag) != flag) {
-+ set_bit(MD_DIRTY,&mdev->flags);
-+ mdev->gen_cnt[Flags] |= flag;
-+ }
-+}
-+void drbd_md_clear_flag(drbd_dev *mdev, int flag)
-+{
-+ if ( (mdev->gen_cnt[Flags] & flag) != 0 ) {
-+ set_bit(MD_DIRTY,&mdev->flags);
-+ mdev->gen_cnt[Flags] &= ~flag;
-+ }
-+}
-+int drbd_md_test_flag(drbd_dev *mdev, int flag)
-+{
-+ return ((mdev->gen_cnt[Flags] & flag) != 0);
-+}
-+
-+module_init(drbd_init)
-+module_exit(drbd_cleanup)
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_proc.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,294 @@
-+/*
-+-*- linux-c -*-
-+ drbd_proc.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+
-+#include <asm/uaccess.h>
-+#include <linux/fs.h>
-+#include <linux/file.h>
-+#include <linux/slab.h>
-+#include <linux/proc_fs.h>
-+#include <linux/seq_file.h>
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+STATIC int drbd_proc_open(struct inode *inode, struct file *file);
-+STATIC int drbd_seq_show(struct seq_file *seq, void *v);
-+
-+
-+struct proc_dir_entry *drbd_proc;
-+struct file_operations drbd_proc_fops = {
-+ .owner = THIS_MODULE,
-+ .open = drbd_proc_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
-+};
-+
-+// We ommit single_open and single_release, since that is only available
-+// after 2.4.23
-+static void *single_start(struct seq_file *p, loff_t *pos)
-+{
-+ return NULL + (*pos == 0);
-+}
-+
-+static void *single_next(struct seq_file *p, void *v, loff_t *pos)
-+{
-+ ++*pos;
-+ return NULL;
-+}
-+
-+static void single_stop(struct seq_file *p, void *v)
-+{
-+}
-+
-+struct seq_operations drbd_proc_seq_ops = {
-+ .start = single_start,
-+ .next = single_next,
-+ .stop = single_stop,
-+ .show = drbd_seq_show,
-+};
-+
-+/*lge
-+ * progress bars shamelessly adapted from driver/md/md.c
-+ * output looks like
-+ * [=====>..............] 33.5% (23456/123456)
-+ * finish: 2:20:20 speed: 6,345 (6,456) K/sec
-+ */
-+STATIC void drbd_syncer_progress(struct Drbd_Conf* mdev, struct seq_file *seq)
-+{
-+ unsigned long res , db, dt, dbdt, rt, rs_left;
-+
-+ /* the whole sector_div thingy was wrong (did overflow,
-+ * did not use correctly typed parameters), and is not even
-+ * neccessary as long as rs_total and drbd_bm_total_weight
-+ * are both unsigned long.
-+ *
-+ * this is to break it at compile time when we change that
-+ * (we may feel 4TB maximum storage per drbd is not enough)
-+ */
-+ typecheck(unsigned long, mdev->rs_total);
-+
-+ /* note: both rs_total and rs_left are in bits, i.e. in
-+ * units of BM_BLOCK_SIZE.
-+ * for the percentage, we don't care. */
-+
-+ rs_left = drbd_bm_total_weight(mdev);
-+ /* >> 10 to prevent overflow,
-+ * +1 to prevent division by zero */
-+ if (rs_left > mdev->rs_total) {
-+ /* doh. logic bug somewhere.
-+ * for now, just try to prevent in-kernel buffer overflow.
-+ */
-+ ERR("logic bug? rs_left=%lu > rs_total=%lu\n",
-+ rs_left, mdev->rs_total);
-+ res = 1000;
-+ } else {
-+ res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);
-+ }
-+ {
-+ int i, y = res/50, x = 20-y;
-+ seq_printf(seq, "\t[");
-+ for (i = 1; i < x; i++)
-+ seq_printf(seq, "=");
-+ seq_printf(seq, ">");
-+ for (i = 0; i < y; i++)
-+ seq_printf(seq, ".");
-+ seq_printf(seq, "] ");
-+ }
-+ res = 1000L - res;
-+ seq_printf(seq,"sync'ed:%3lu.%lu%% ", res / 10, res % 10);
-+ /* if more than 1 GB display in MB */
-+ if (mdev->rs_total > 0x100000L) {
-+ seq_printf(seq,"(%lu/%lu)M\n\t",
-+ (unsigned long) Bit2KB(rs_left) >> 10,
-+ (unsigned long) Bit2KB(mdev->rs_total) >> 10 );
-+ } else {
-+ seq_printf(seq,"(%lu/%lu)K\n\t",
-+ (unsigned long) Bit2KB(rs_left),
-+ (unsigned long) Bit2KB(mdev->rs_total) );
-+ }
-+
-+ /* see drivers/md/md.c
-+ * We do not want to overflow, so the order of operands and
-+ * the * 100 / 100 trick are important. We do a +1 to be
-+ * safe against division by zero. We only estimate anyway.
-+ *
-+ * dt: time from mark until now
-+ * db: blocks written from mark until now
-+ * rt: remaining time
-+ */
-+ dt = (jiffies - mdev->rs_mark_time) / HZ;
-+
-+ if (dt > 20) {
-+ /* if we made no update to rs_mark_time for too long,
-+ * we are stalled. show that. */
-+ seq_printf(seq, "stalled\n");
-+ return;
-+ }
-+
-+ if (!dt) dt++;
-+ db = mdev->rs_mark_left - rs_left;
-+ rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
-+
-+ seq_printf(seq, "finish: %lu:%02lu:%02lu",
-+ rt / 3600, (rt % 3600) / 60, rt % 60);
-+
-+ /* current speed average over (SYNC_MARKS * SYNC_MARK_STEP) jiffies */
-+ dbdt = Bit2KB(db/dt);
-+ if (dbdt > 1000)
-+ seq_printf(seq, " speed: %ld,%03ld",
-+ dbdt/1000,dbdt % 1000);
-+ else
-+ seq_printf(seq, " speed: %ld", dbdt);
-+
-+ /* mean speed since syncer started
-+ * we do account for PausedSync periods */
-+ dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-+ if (dt <= 0) dt=1;
-+ db = mdev->rs_total - rs_left;
-+ dbdt = Bit2KB(db/dt);
-+ if (dbdt > 1000)
-+ seq_printf(seq, " (%ld,%03ld)",
-+ dbdt/1000,dbdt % 1000);
-+ else
-+ seq_printf(seq, " (%ld)", dbdt);
-+
-+ seq_printf(seq," K/sec\n");
-+}
-+
-+const char* cstate_to_name(Drbd_CState s) {
-+ static const char *cstate_names[] = {
-+ [Unconfigured] = "Unconfigured",
-+ [StandAlone] = "StandAlone",
-+ [Unconnected] = "Unconnected",
-+ [Timeout] = "Timeout",
-+ [BrokenPipe] = "BrokenPipe",
-+ [NetworkFailure] = "NetworkFailure",
-+ [WFConnection] = "WFConnection",
-+ [WFReportParams] = "WFReportParams",
-+ [Connected] = "Connected",
-+ [SkippedSyncS] = "SkippedSyncS",
-+ [SkippedSyncT] = "SkippedSyncT",
-+ [WFBitMapS] = "WFBitMapS",
-+ [WFBitMapT] = "WFBitMapT",
-+ [SyncSource] = "SyncSource",
-+ [SyncTarget] = "SyncTarget",
-+ [PausedSyncS] = "PausedSyncS",
-+ [PausedSyncT] = "PausedSyncT",
-+ };
-+
-+ return s < Unconfigured ? "TO_SMALL" :
-+ s > PausedSyncT ? "TO_LARGE"
-+ : cstate_names[s];
-+}
-+
-+const char* nodestate_to_name(Drbd_State s) {
-+ static const char *state_names[] = {
-+ [Primary] = "Primary",
-+ [Secondary] = "Secondary",
-+ [Unknown] = "Unknown"
-+ };
-+
-+ return s < Unknown ? "TO_SMALL" :
-+ s > Secondary ? "TO_LARGE"
-+ : state_names[s];
-+}
-+
-+
-+STATIC int drbd_seq_show(struct seq_file *seq, void *v)
-+{
-+ int i;
-+ const char *sn;
-+
-+ seq_printf(seq, "version: " REL_VERSION " (api:%d/proto:%d)\n%s\n",
-+ API_VERSION,PRO_VERSION, drbd_buildtag());
-+
-+ /*
-+ cs .. connection state
-+ st .. node state (local/remote)
-+ ld .. local data consistentency
-+ ns .. network send
-+ nr .. network receive
-+ dw .. disk write
-+ dr .. disk read
-+ pe .. pending (waiting for ack)
-+ ua .. unack'd (still need to send ack)
-+ al .. access log write count
-+ */
-+
-+ for (i = 0; i < minor_count; i++) {
-+ sn = cstate_to_name(drbd_conf[i].cstate);
-+ if(drbd_conf[i].cstate == Connected) {
-+ if(test_bit(DISKLESS,&drbd_conf[i].flags))
-+ sn = "DiskLessClient";
-+ if(test_bit(PARTNER_DISKLESS,&drbd_conf[i].flags))
-+ sn = "ServerForDLess";
-+ }
-+ if ( drbd_conf[i].cstate == Unconfigured )
-+ seq_printf( seq, "%2d: cs:Unconfigured\n", i);
-+ else
-+ seq_printf( seq,
-+ "%2d: cs:%s st:%s/%s ld:%s\n"
-+ " ns:%u nr:%u dw:%u dr:%u al:%u bm:%u "
-+ "lo:%d pe:%d ua:%d ap:%d\n",
-+ i, sn,
-+ nodestate_to_name(drbd_conf[i].state),
-+ nodestate_to_name(drbd_conf[i].o_state),
-+ (drbd_conf[i].gen_cnt[Flags]
-+ & MDF_Consistent) ? "Consistent" : "Inconsistent",
-+ // FIXME partner consistent?
-+ drbd_conf[i].send_cnt/2,
-+ drbd_conf[i].recv_cnt/2,
-+ drbd_conf[i].writ_cnt/2,
-+ drbd_conf[i].read_cnt/2,
-+ drbd_conf[i].al_writ_cnt,
-+ drbd_conf[i].bm_writ_cnt,
-+ atomic_read(&drbd_conf[i].local_cnt),
-+ atomic_read(&drbd_conf[i].ap_pending_cnt) +
-+ atomic_read(&drbd_conf[i].rs_pending_cnt),
-+ atomic_read(&drbd_conf[i].unacked_cnt),
-+ atomic_read(&drbd_conf[i].ap_bio_cnt)
-+ );
-+
-+ if ( drbd_conf[i].cstate == SyncSource ||
-+ drbd_conf[i].cstate == SyncTarget )
-+ drbd_syncer_progress(drbd_conf+i,seq);
-+ }
-+
-+ return 0;
-+}
-+
-+STATIC int drbd_proc_open(struct inode *inode, struct file *file)
-+{
-+ return seq_open(file, &drbd_proc_seq_ops);
-+}
-+
-+/* PROC FS stuff end */
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_receiver.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,2414 @@
-+/*
-+-*- linux-c -*-
-+ drbd_receiver.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
-+
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+
-+#include <asm/uaccess.h>
-+#include <net/sock.h>
-+
-+#include <linux/tcp.h>
-+
-+#include <linux/version.h>
-+#include <linux/fs.h>
-+#include <linux/file.h>
-+#include <linux/in.h>
-+#include <linux/mm.h>
-+#include <linux/drbd_config.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
-+#include <linux/mm_inline.h>
-+#endif
-+#include <linux/slab.h>
-+#include <linux/smp_lock.h>
-+#include <linux/pkt_sched.h>
-+#define __KERNEL_SYSCALLS__
-+#include <linux/unistd.h>
-+#include <linux/vmalloc.h>
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+#define EE_MININUM 32 // @4k pages => 128 KByte
-+
-+#define is_syncer_blk(A,B) ((B)==ID_SYNCER)
-+
-+#if defined(__arch_um__) && !defined(HAVE_UML_TO_VIRT)
-+static inline void *to_virt(unsigned long phys)
-+{
-+ return((void *) uml_physmem + phys);
-+}
-+#endif
-+
-+#ifdef DBG_ASSERTS
-+void drbd_assert_breakpoint(drbd_dev *mdev, char *exp,
-+ char *file, int line)
-+{
-+ ERR("ASSERT( %s ) in %s:%d\n", exp, file, line);
-+}
-+#endif
-+
-+
-+#if 0
-+#define CHECK_LIST_LIMIT 1000
-+void check_list(drbd_dev *mdev,struct list_head *list,char *t)
-+{
-+ struct list_head *le,*la;
-+ int forward=0,backward=0;
-+
-+ le=list;
-+ do {
-+ la=le;
-+ le=le->next;
-+ if( le->prev != la ) {
-+ printk(KERN_ERR DEVICE_NAME
-+ "%d: %s list fucked.\n",
-+ (int)(mdev-drbd_conf),t);
-+ break;
-+ }
-+ if( forward++ > CHECK_LIST_LIMIT ) {
-+ printk(KERN_ERR DEVICE_NAME
-+ "%d: %s forward > 1000\n",
-+ (int)(mdev-drbd_conf),t);
-+ break;
-+ }
-+ } while(le != list);
-+
-+ le=list;
-+ do {
-+ la=le;
-+ le=le->prev;
-+ if( le->next != la ) {
-+ printk(KERN_ERR DEVICE_NAME
-+ "%d: %s list fucked.\n",
-+ (int)(mdev-drbd_conf),t);
-+ break;
-+ }
-+ if( backward++ > CHECK_LIST_LIMIT ) {
-+ printk(KERN_ERR DEVICE_NAME
-+ "%d: %s backward > 1000\n",
-+ (int)(mdev-drbd_conf),t);
-+ break;
-+ }
-+ } while(le != list);
-+
-+ if(forward != backward) {
-+ printk(KERN_ERR DEVICE_NAME "%d: forward=%d, backward=%d\n",
-+ (int)(mdev-drbd_conf),forward,backward);
-+ }
-+}
-+#endif
-+
-+#if 0
-+STATIC inline int is_syncer_blk(drbd_dev *mdev, u64 block_id)
-+{
-+ if ( block_id == ID_SYNCER ) return 1;
-+ /* Use this code if you are working with a VIA based mboard :) */
-+ if ( (long)block_id == (long)-1) {
-+ printk(KERN_ERR DEVICE_NAME
-+ "%d: strange block_id %lx%lx\n",(int)(mdev-drbd_conf),
-+ (unsigned long)(block_id>>32),
-+ (unsigned long)block_id);
-+ return 1;
-+ }
-+ return 0;
-+}
-+#endif //PARANOIA
-+
-+/*
-+You need to hold the ee_lock:
-+ drbd_free_ee()
-+ drbd_get_ee()
-+ drbd_put_ee()
-+ _drbd_process_ee()
-+
-+You must not have the ee_lock:
-+ _drbd_alloc_ee()
-+ drbd_alloc_ee()
-+ drbd_init_ee()
-+ drbd_release_ee()
-+ drbd_ee_fix_bhs()
-+ drbd_process_ee()
-+ drbd_clear_done_ee()
-+ drbd_wait_ee()
-+*/
-+
-+STATIC int _drbd_alloc_ee(drbd_dev *mdev,struct page* page,int mask)
-+{
-+ struct Tl_epoch_entry* e;
-+
-+ /* kmem_cache does not like to mix different memory types.
-+ * so even if we alloc'ed the page from HIGHMEM,
-+ * the ee comes from normal memory.
-+ */
-+ e = kmem_cache_alloc(drbd_ee_cache, mask & ~(__GFP_HIGHMEM));
-+ if( e == NULL ) return FALSE;
-+
-+ drbd_ee_init(e,page);
-+ spin_lock_irq(&mdev->ee_lock);
-+ list_add(&e->w.list,&mdev->free_ee);
-+ mdev->ee_vacant++;
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ return TRUE;
-+}
-+
-+/* bool */
-+STATIC int drbd_alloc_ee(drbd_dev *mdev,int mask)
-+{
-+ struct page *page;
-+
-+ page=alloc_page(mask);
-+ if(!page) return FALSE;
-+
-+ /* if we got the page, we really want the ee, too,
-+ * even for "GFP_TRY".
-+ * we may wait, but better not cause IO,
-+ * we might be in the IO path (of our peer).
-+ */
-+ if(!_drbd_alloc_ee(mdev,page,mask | GFP_NOIO)) {
-+ __free_page(page);
-+ return FALSE;
-+ }
-+
-+ return TRUE;
-+}
-+
-+STATIC struct page* drbd_free_ee(drbd_dev *mdev, struct list_head *list)
-+{
-+ struct list_head *le;
-+ struct Tl_epoch_entry* e;
-+ struct page* page;
-+
-+ MUST_HOLD(&mdev->ee_lock);
-+
-+ D_ASSERT(!list_empty(list));
-+ le = list->next;
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ list_del(le);
-+
-+ page = drbd_bio_get_page(&e->private_bio);
-+ONLY_IN_26(
-+ D_ASSERT(page == e->ee_bvec.bv_page);
-+ page = e->ee_bvec.bv_page;
-+)
-+ kmem_cache_free(drbd_ee_cache, e);
-+ mdev->ee_vacant--;
-+
-+ return page;
-+}
-+
-+int drbd_init_ee(drbd_dev *mdev)
-+{
-+ while(mdev->ee_vacant < EE_MININUM ) {
-+ if(!drbd_alloc_ee(mdev,GFP_USER)) {
-+ ERR("Failed to allocate %d EEs !\n",EE_MININUM);
-+ return 0;
-+ }
-+ }
-+ return 1;
-+}
-+
-+int drbd_release_ee(drbd_dev *mdev,struct list_head* list)
-+{
-+ int count=0;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ while(!list_empty(list)) {
-+ __free_page(drbd_free_ee(mdev,list));
-+ count++;
-+ }
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ return count;
-+}
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-+#define GFP_TRY ( __GFP_HIGHMEM | __GFP_NOWARN )
-+#else
-+#define GFP_TRY ( __GFP_HIGHMEM )
-+#endif
-+
-+STATIC int _drbd_process_ee(drbd_dev *mdev, int be_sleepy);
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+STATIC void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
-+{
-+ unsigned long flags;
-+
-+ wait->flags &= ~WQ_FLAG_EXCLUSIVE;
-+ spin_lock_irqsave(&q->lock, flags);
-+ if (list_empty(&wait->task_list))
-+ __add_wait_queue(q, wait);
-+ set_current_state(state);
-+ spin_unlock_irqrestore(&q->lock, flags);
-+}
-+
-+STATIC void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
-+{
-+ unsigned long flags;
-+
-+ __set_current_state(TASK_RUNNING);
-+
-+ spin_lock_irqsave(&q->lock, flags);
-+ list_del_init(&wait->task_list);
-+ spin_unlock_irqrestore(&q->lock, flags);
-+}
-+
-+#define DEFINE_WAIT(name) \
-+ wait_queue_t name = { \
-+ .task = current, \
-+ .task_list = { .next = &name.task_list, \
-+ .prev = &name.task_list, \
-+ }, \
-+ }
-+
-+#endif
-+
-+/**
-+ * drbd_get_ee: Returns an Tl_epoch_entry; might sleep. Fails only if
-+ * a signal comes in.
-+ */
-+struct Tl_epoch_entry* drbd_get_ee(drbd_dev *mdev)
-+{
-+ struct list_head *le;
-+ struct Tl_epoch_entry* e;
-+ DEFINE_WAIT(wait);
-+
-+ MUST_HOLD(&mdev->ee_lock);
-+
-+ if(mdev->ee_vacant == EE_MININUM / 2) {
-+ spin_unlock_irq(&mdev->ee_lock);
-+ drbd_kick_lo(mdev);
-+ spin_lock_irq(&mdev->ee_lock);
-+ }
-+
-+ if(list_empty(&mdev->free_ee)) _drbd_process_ee(mdev,1);
-+
-+ if(list_empty(&mdev->free_ee)) {
-+ for (;;) {
-+ prepare_to_wait(&mdev->ee_wait, &wait,
-+ TASK_INTERRUPTIBLE);
-+ if(!list_empty(&mdev->free_ee)) break;
-+ spin_unlock_irq(&mdev->ee_lock);
-+ if( ( mdev->ee_vacant+mdev->ee_in_use) <
-+ mdev->conf.max_buffers ) {
-+ if(drbd_alloc_ee(mdev,GFP_TRY)) {
-+ /* race race race
-+ * (currently harmless for drbd07, since drbd_get_ee is called by
-+ * receiver_thread only. solved with different implementation in
-+ * drbd-plus already.)
-+ */
-+ spin_lock_irq(&mdev->ee_lock);
-+ break;
-+ }
-+ }
-+ drbd_kick_lo(mdev);
-+ schedule();
-+ spin_lock_irq(&mdev->ee_lock);
-+ finish_wait(&mdev->ee_wait, &wait);
-+ if (signal_pending(current)) {
-+ WARN("drbd_get_ee interrupted!\n");
-+ return 0;
-+ }
-+ // finish wait is inside, so that we are TASK_RUNNING
-+ // in _drbd_process_ee (which might sleep by itself.)
-+ _drbd_process_ee(mdev,1);
-+ }
-+ finish_wait(&mdev->ee_wait, &wait);
-+ }
-+
-+ /* race race race */
-+ le=mdev->free_ee.next;
-+ list_del(le);
-+ mdev->ee_vacant--;
-+ mdev->ee_in_use++;
-+ e=list_entry(le, struct Tl_epoch_entry, w.list);
-+ONLY_IN_26(
-+ D_ASSERT(e->private_bio.bi_idx == 0);
-+ drbd_ee_init(e,e->ee_bvec.bv_page); // reinitialize
-+)
-+ e->block_id = !ID_VACANT;
-+ SET_MAGIC(e);
-+ return e;
-+}
-+
-+void drbd_put_ee(drbd_dev *mdev,struct Tl_epoch_entry *e)
-+{
-+ struct page* page;
-+
-+ MUST_HOLD(&mdev->ee_lock);
-+
-+ D_ASSERT(page_count(drbd_bio_get_page(&e->private_bio)) == 1);
-+
-+ mdev->ee_in_use--;
-+ mdev->ee_vacant++;
-+ e->block_id = ID_VACANT;
-+ INVALIDATE_MAGIC(e);
-+ list_add_tail(&e->w.list,&mdev->free_ee);
-+
-+ if((mdev->ee_vacant * 2 > mdev->ee_in_use ) &&
-+ ( mdev->ee_vacant + mdev->ee_in_use > EE_MININUM) ) {
-+ // FIXME cleanup: never returns NULL anymore
-+ page=drbd_free_ee(mdev,&mdev->free_ee);
-+ if( page ) __free_page(page);
-+ }
-+ if(mdev->ee_in_use == 0) {
-+ while( mdev->ee_vacant > EE_MININUM ) {
-+ __free_page(drbd_free_ee(mdev,&mdev->free_ee));
-+ }
-+ }
-+
-+ wake_up(&mdev->ee_wait);
-+}
-+
-+STATIC void reclaim_net_ee(drbd_dev *mdev)
-+{
-+ struct Tl_epoch_entry *e;
-+ struct list_head *le,*tle;
-+
-+ /* The EEs are always appended to the end of the list, since
-+ they are sent in order over the wire, they have to finish
-+ in order. As soon as we see the first not finished we can
-+ stop to examine the list... */
-+
-+ list_for_each_safe(le, tle, &mdev->net_ee) {
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ if( page_count(drbd_bio_get_page(&e->private_bio)) > 1 ) break;
-+ list_del(le);
-+ drbd_put_ee(mdev,e);
-+ }
-+}
-+
-+
-+/* It is important that the head list is really empty when returning,
-+ from this function. Note, this function is called from all three
-+ threads (receiver, worker and asender). To ensure this I only allow
-+ one thread at a time in the body of the function */
-+STATIC int _drbd_process_ee(drbd_dev *mdev, int be_sleepy)
-+{
-+ struct Tl_epoch_entry *e;
-+ struct list_head *head = &mdev->done_ee;
-+ struct list_head *le;
-+ int ok=1;
-+ int got_sig;
-+
-+ MUST_HOLD(&mdev->ee_lock);
-+
-+ reclaim_net_ee(mdev);
-+
-+ if( test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) ) {
-+ if(!be_sleepy) {
-+ return 3;
-+ }
-+ spin_unlock_irq(&mdev->ee_lock);
-+ got_sig = wait_event_interruptible(mdev->ee_wait,
-+ test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) == 0);
-+ spin_lock_irq(&mdev->ee_lock);
-+ if(got_sig) return 2;
-+ }
-+
-+ while(!list_empty(head)) {
-+ le = head->next;
-+ list_del(le);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ ok = ok && e->w.cb(mdev,&e->w,0);
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ }
-+
-+ clear_bit(PROCESS_EE_RUNNING,&mdev->flags);
-+ wake_up(&mdev->ee_wait);
-+
-+ return ok;
-+}
-+
-+STATIC int drbd_process_ee(drbd_dev *mdev, int be_sleepy)
-+{
-+ int rv;
-+ spin_lock_irq(&mdev->ee_lock);
-+ rv=_drbd_process_ee(mdev,be_sleepy);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ return rv;
-+}
-+
-+STATIC void drbd_clear_done_ee(drbd_dev *mdev)
-+{
-+ struct list_head *le;
-+ struct Tl_epoch_entry *e;
-+ int n = 0;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+
-+ reclaim_net_ee(mdev);
-+
-+ while(!list_empty(&mdev->done_ee)) {
-+ le = mdev->done_ee.next;
-+ list_del(le);
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ if(mdev->conf.wire_protocol == DRBD_PROT_C ||
-+ is_syncer_blk(mdev,e->block_id)) {
-+ ++n;
-+ }
-+ drbd_put_ee(mdev,e);
-+ }
-+
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ sub_unacked(mdev, n);
-+}
-+
-+
-+static inline int _wait_ee_cond(struct Drbd_Conf* mdev,struct list_head *head)
-+{
-+ int rv;
-+ spin_lock_irq(&mdev->ee_lock);
-+ rv = list_empty(head);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ if(!rv) drbd_kick_lo(mdev);
-+ return rv;
-+}
-+
-+void drbd_wait_ee(drbd_dev *mdev,struct list_head *head)
-+{
-+ wait_event(mdev->ee_wait,_wait_ee_cond(mdev,head));
-+}
-+
-+STATIC struct socket* drbd_accept(drbd_dev *mdev,struct socket* sock)
-+{
-+ struct socket *newsock;
-+ int err = 0;
-+
-+ err = sock->ops->listen(sock, 5);
-+ if (err)
-+ goto out;
-+
-+ if (sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &newsock))
-+ goto out;
-+
-+ newsock->type = sock->type;
-+ newsock->ops = sock->ops;
-+
-+ err = newsock->ops->accept(sock, newsock, 0);
-+ if (err < 0)
-+ goto out_release;
-+
-+ return newsock;
-+
-+ out_release:
-+ sock_release(newsock);
-+ out:
-+ if(err != -EAGAIN && err != -EINTR)
-+ ERR("accept failed! %d\n", err);
-+ return 0;
-+}
-+
-+STATIC int drbd_recv_short(drbd_dev *mdev, void *buf, size_t size)
-+{
-+ mm_segment_t oldfs;
-+ struct iovec iov;
-+ struct msghdr msg;
-+ int rv;
-+
-+ if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
-+ drbd_suicide();
-+ }
-+
-+ msg.msg_control = NULL;
-+ msg.msg_controllen = 0;
-+ msg.msg_iovlen = 1;
-+ msg.msg_iov = &iov;
-+ iov.iov_len = size;
-+ iov.iov_base = buf;
-+ msg.msg_name = NULL;
-+ msg.msg_namelen = 0;
-+ msg.msg_flags = MSG_WAITALL | MSG_NOSIGNAL;
-+
-+ oldfs = get_fs();
-+ set_fs(KERNEL_DS);
-+
-+ rv = sock_recvmsg(mdev->meta.socket, &msg, size, msg.msg_flags);
-+
-+ set_fs(oldfs);
-+
-+ return rv;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+# define SK_(x) x
-+#else
-+# define SK_(x) sk_ ## x
-+#endif
-+
-+int drbd_recv(drbd_dev *mdev,void *buf, size_t size)
-+{
-+ mm_segment_t oldfs;
-+ struct iovec iov;
-+ struct msghdr msg;
-+ int rv;
-+
-+ if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
-+ drbd_suicide();
-+ }
-+
-+ msg.msg_control = NULL;
-+ msg.msg_controllen = 0;
-+ msg.msg_iovlen = 1;
-+ msg.msg_iov = &iov;
-+ iov.iov_len = size;
-+ iov.iov_base = buf;
-+ msg.msg_name = NULL;
-+ msg.msg_namelen = 0;
-+ msg.msg_flags = MSG_WAITALL | MSG_NOSIGNAL;
-+
-+ oldfs = get_fs();
-+ set_fs(KERNEL_DS);
-+
-+ for(;;) {
-+ rv = sock_recvmsg(mdev->data.socket,&msg,size,msg.msg_flags);
-+ if (rv == size) break;
-+
-+ /* Note:
-+ * ECONNRESET other side closed the connection
-+ * ERESTARTSYS (on sock) we got a signal
-+ */
-+
-+ if (rv < 0) {
-+ if (rv == -ECONNRESET)
-+ INFO("sock was reset by peer\n");
-+ else if (rv != -ERESTARTSYS)
-+ ERR("sock_recvmsg returned %d\n",rv);
-+ break;
-+ } else if (rv == 0) {
-+ INFO("sock was shut down by peer\n");
-+ break;
-+ } else {
-+ /* signal came in, or peer/link went down,
-+ * after we read a partial message
-+ */
-+ // D_ASSERT(signal_pending(current));
-+ break;
-+ }
-+ };
-+
-+ set_fs(oldfs);
-+
-+ if(rv != size) {
-+ set_cstate(mdev,BrokenPipe);
-+ drbd_thread_restart_nowait(&mdev->receiver);
-+ }
-+
-+ return rv;
-+}
-+
-+STATIC struct socket *drbd_try_connect(drbd_dev *mdev)
-+{
-+ int err;
-+ struct socket *sock;
-+ struct sockaddr_in src_in;
-+
-+ err = sock_create(AF_INET, SOCK_STREAM, 0, &sock);
-+ if (err) {
-+ ERR("sock_creat(..)=%d\n", err);
-+ return NULL;
-+ }
-+
-+ sock->sk->SK_(rcvtimeo) =
-+ sock->sk->SK_(sndtimeo) = mdev->conf.try_connect_int*HZ;
-+
-+ /* explicitly bind to the configured IP as source IP
-+ for the outgoing connections.
-+ This is needed for multihomed hosts and to be
-+ able to use lo: interfaces for drbd.
-+ Make sure to use 0 as portnumber, so linux selects
-+ a free one dynamically.
-+ */
-+ memcpy (&src_in, &(mdev->conf.my_addr), sizeof(struct sockaddr_in));
-+ src_in.sin_port = 0;
-+
-+ err = sock->ops->bind(sock,
-+ (struct sockaddr * ) &src_in,
-+ sizeof (struct sockaddr_in));
-+ if (err) {
-+ ERR("Unable to bind source sock (%d)\n", err);
-+ sock_release(sock);
-+ sock = NULL;
-+ return sock;
-+ }
-+
-+ err = sock->ops->connect(sock,
-+ (struct sockaddr *) mdev->conf.other_addr,
-+ mdev->conf.other_addr_len, 0);
-+
-+ if (err) {
-+ sock_release(sock);
-+ sock = NULL;
-+ }
-+ return sock;
-+}
-+
-+STATIC struct socket *drbd_wait_for_connect(drbd_dev *mdev)
-+{
-+ int err;
-+ struct socket *sock,*sock2;
-+
-+ err = sock_create(AF_INET, SOCK_STREAM, 0, &sock2);
-+ if (err) {
-+ ERR("sock_creat(..)=%d\n", err);
-+ return NULL;
-+ }
-+
-+ sock2->sk->SK_(reuse) = 1; /* SO_REUSEADDR */
-+ sock2->sk->SK_(rcvtimeo) =
-+ sock2->sk->SK_(sndtimeo) = mdev->conf.try_connect_int*HZ;
-+
-+ err = sock2->ops->bind(sock2,
-+ (struct sockaddr *) mdev->conf.my_addr,
-+ mdev->conf.my_addr_len);
-+ if (err) {
-+ ERR("Unable to bind sock2 (%d)\n", err);
-+ sock_release(sock2);
-+ set_cstate(mdev,Unconnected);
-+ return 0;
-+ }
-+
-+ sock = drbd_accept(mdev,sock2);
-+ sock_release(sock2);
-+
-+ return sock;
-+}
-+
-+STATIC int drbd_do_handshake(drbd_dev *mdev);
-+
-+/*
-+ * return values:
-+ * 1 yess, we have a valid connection
-+ * 0 oops, did not work out, please try again
-+ * -1 peer talks different language,
-+ * no point in trying again, please go standalone.
-+ */
-+int drbd_connect(drbd_dev *mdev)
-+{
-+ struct socket *sock,*msock;
-+ int h;
-+
-+ D_ASSERT(mdev->cstate!=Unconfigured);
-+ D_ASSERT(!mdev->data.socket);
-+
-+ set_cstate(mdev,WFConnection);
-+
-+ /* Break out of unknown connect loops by random wait here. */
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(net_random() % ((mdev->conf.try_connect_int*HZ)/4));
-+
-+ while(1) {
-+ sock=drbd_try_connect(mdev);
-+ if(sock) {
-+ msock=drbd_wait_for_connect(mdev);
-+ if(msock) break;
-+ else sock_release(sock);
-+ } else {
-+ sock=drbd_wait_for_connect(mdev);
-+ if(sock) {
-+ int retry;
-+ for (retry=1; retry <= 10; retry++) {
-+ // give the other side time to call
-+ // bind() & listen()
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ / 10);
-+ msock=drbd_try_connect(mdev);
-+ if(msock) goto connected;
-+ ERR("msock try_connect %d\n",retry);
-+ }
-+ sock_release(sock);
-+ }
-+ }
-+ if(mdev->cstate==Unconnected) return -1;
-+ if(signal_pending(current)) {
-+ drbd_flush_signals(current);
-+ smp_rmb();
-+ if (get_t_state(&mdev->receiver) == Exiting)
-+ return -1;
-+ }
-+ }
-+
-+ connected:
-+
-+ msock->sk->SK_(reuse)=1; /* SO_REUSEADDR */
-+ sock->sk->SK_(reuse)=1; /* SO_REUSEADDR */
-+
-+ sock->sk->SK_(allocation) = GFP_NOIO;
-+ msock->sk->SK_(allocation) = GFP_NOIO;
-+
-+ sock->sk->SK_(priority)=TC_PRIO_BULK;
-+ NOT_IN_26(sock->sk->tp_pinfo.af_tcp.nonagle=0;)
-+ ONLY_IN_26( tcp_sk(sock->sk)->nonagle = 0;)
-+ // FIXME fold to limits. should be done in drbd_ioctl
-+ sock->sk->SK_(sndbuf) = mdev->conf.sndbuf_size;
-+ sock->sk->SK_(rcvbuf) = mdev->conf.sndbuf_size;
-+ /* NOT YET ...
-+ * sock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-+ * sock->sk->SK_(rcvtimeo) = MAX_SCHEDULE_TIMEOUT;
-+ * THINK HandShake timeout, hardcoded for now: */
-+ sock->sk->SK_(sndtimeo) =
-+ sock->sk->SK_(rcvtimeo) = 2*HZ;
-+ sock->sk->SK_(userlocks) |= SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK;
-+
-+ msock->sk->SK_(priority)=TC_PRIO_INTERACTIVE;
-+ NOT_IN_26(sock->sk->tp_pinfo.af_tcp.nonagle=1;)
-+ ONLY_IN_26(tcp_sk(sock->sk)->nonagle = 1;)
-+ msock->sk->SK_(sndbuf) = 2*32767;
-+ msock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-+ msock->sk->SK_(rcvtimeo) = mdev->conf.ping_int*HZ;
-+
-+ mdev->data.socket = sock;
-+ mdev->meta.socket = msock;
-+ mdev->last_received = jiffies;
-+
-+ set_cstate(mdev,WFReportParams);
-+ D_ASSERT(mdev->asender.task == NULL);
-+
-+ h = drbd_do_handshake(mdev);
-+ if (h <= 0) return h;
-+
-+ clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
-+ clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-+
-+ sock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-+ sock->sk->SK_(rcvtimeo) = MAX_SCHEDULE_TIMEOUT;
-+
-+ drbd_thread_start(&mdev->asender);
-+
-+ drbd_send_param(mdev,0);
-+ clear_bit(USE_DEGR_WFC_T,&mdev->flags);
-+
-+ return 1;
-+}
-+
-+STATIC int drbd_recv_header(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ int r;
-+
-+ r = drbd_recv(mdev,h,sizeof(*h));
-+
-+ if (unlikely( r != sizeof(*h) )) {
-+ ERR("short read expecting header on sock: r=%d\n",r);
-+ return FALSE;
-+ };
-+ h->command = be16_to_cpu(h->command);
-+ h->length = be16_to_cpu(h->length);
-+ if (unlikely( h->magic != BE_DRBD_MAGIC )) {
-+ ERR("magic?? m: 0x%lx c: %d l: %d\n",
-+ (long)be32_to_cpu(h->magic),
-+ h->command, h->length);
-+ return FALSE;
-+ }
-+ mdev->last_received = jiffies;
-+
-+ return TRUE;
-+}
-+
-+STATIC int receive_Barrier(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ int rv;
-+ int epoch_size;
-+ Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet*)h;
-+
-+ ERR_IF(mdev->state != Secondary) return FALSE;
-+ ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
-+
-+ rv = drbd_recv(mdev, h->payload, h->length);
-+ ERR_IF(rv != h->length) return FALSE;
-+
-+ inc_unacked(mdev);
-+
-+ // DBG("got Barrier\n");
-+
-+ if (mdev->conf.wire_protocol != DRBD_PROT_C)
-+ drbd_kick_lo(mdev);
-+
-+ drbd_wait_ee(mdev,&mdev->active_ee);
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ rv = _drbd_process_ee(mdev,1);
-+
-+ epoch_size=atomic_read(&mdev->epoch_size);
-+ atomic_set(&mdev->epoch_size,0);
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ rv &= drbd_send_b_ack(mdev, p->barrier, epoch_size);
-+ dec_unacked(mdev);
-+
-+ return rv;
-+}
-+
-+STATIC struct Tl_epoch_entry *
-+read_in_block(drbd_dev *mdev, int data_size)
-+{
-+ struct Tl_epoch_entry *e;
-+ drbd_bio_t *bio;
-+ int rr;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ e=drbd_get_ee(mdev);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ if(!e) return 0;
-+
-+ bio = &e->private_bio;
-+
-+ rr=drbd_recv(mdev, drbd_bio_kmap(bio), data_size);
-+ drbd_bio_kunmap(bio);
-+
-+ if ( rr != data_size) {
-+ NOT_IN_26(clear_bit(BH_Lock, &bio->b_state);)
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ WARN("short read receiving data block: read %d expected %d\n",
-+ rr, data_size);
-+ return 0;
-+ }
-+ mdev->recv_cnt+=data_size>>9;
-+
-+ return e;
-+}
-+
-+STATIC void receive_data_tail(drbd_dev *mdev,int data_size)
-+{
-+ /* kick lower level device, if we have more than (arbitrary number)
-+ * reference counts on it, which typically are locally submitted io
-+ * requests. don't use unacked_cnt, so we speed up proto A and B, too.
-+ *
-+ * XXX maybe: make that arbitrary number configurable.
-+ * for now, I choose 1/16 of max-epoch-size.
-+ */
-+ if (atomic_read(&mdev->local_cnt) >= (mdev->conf.max_epoch_size>>4) ) {
-+ drbd_kick_lo(mdev);
-+ }
-+ mdev->writ_cnt+=data_size>>9;
-+}
-+
-+STATIC int recv_dless_read(drbd_dev *mdev, drbd_request_t *req,
-+ sector_t sector, int data_size)
-+{
-+ drbd_bio_t *bio;
-+ int ok,rr;
-+
-+ bio = req->master_bio;
-+
-+ D_ASSERT( sector == drbd_req_get_sector(req) );
-+
-+ rr=drbd_recv(mdev,drbd_bio_kmap(bio),data_size);
-+ drbd_bio_kunmap(bio);
-+
-+ ok=(rr==data_size);
-+ drbd_bio_endio(bio,ok);
-+ dec_ap_bio(mdev);
-+
-+ dec_ap_pending(mdev);
-+ return ok;
-+}
-+
-+STATIC int e_end_resync_block(drbd_dev *mdev, struct drbd_work *w, int unused)
-+{
-+ struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
-+ sector_t sector = drbd_ee_get_sector(e);
-+ int ok;
-+
-+ drbd_rs_complete_io(mdev,sector); // before set_in_sync() !
-+ if (likely( drbd_bio_uptodate(&e->private_bio) )) {
-+ ok = !test_bit(DISKLESS,&mdev->flags) &&
-+ !test_bit(PARTNER_DISKLESS,&mdev->flags);
-+ if (likely( ok )) {
-+ drbd_set_in_sync(mdev, sector, drbd_ee_get_size(e));
-+ /* THINK maybe don't send ack either
-+ * when we are suddenly diskless?
-+ * Dropping it here should do no harm,
-+ * since peer has no structs referencing this.
-+ */
-+ }
-+ ok = drbd_send_ack(mdev,WriteAck,e);
-+ set_bit(SYNC_STARTED,&mdev->flags);
-+ } else {
-+ ok = drbd_send_ack(mdev,NegAck,e);
-+ ok&= drbd_io_error(mdev);
-+ }
-+ dec_unacked(mdev);
-+
-+ return ok;
-+}
-+
-+STATIC int recv_resync_read(drbd_dev *mdev,sector_t sector, int data_size)
-+{
-+ struct Tl_epoch_entry *e;
-+
-+ e = read_in_block(mdev,data_size);
-+ if(!e) return FALSE;
-+
-+ dec_rs_pending(mdev);
-+
-+ e->block_id = ID_SYNCER;
-+ if(!inc_local(mdev)) {
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Can not write resync data to local disk.\n");
-+ drbd_send_ack(mdev,NegAck,e);
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ return TRUE;
-+ }
-+
-+ drbd_ee_prepare_write(mdev,e,sector,data_size);
-+ e->w.cb = e_end_resync_block;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ list_add(&e->w.list,&mdev->sync_ee);
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ inc_unacked(mdev);
-+
-+ drbd_generic_make_request(WRITE,&e->private_bio);
-+
-+ receive_data_tail(mdev,data_size);
-+ return TRUE;
-+}
-+
-+STATIC int receive_DataReply(drbd_dev *mdev,Drbd_Header* h)
-+{
-+ drbd_request_t *req;
-+ sector_t sector;
-+ unsigned int header_size,data_size;
-+ int ok;
-+ Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
-+
-+ header_size = sizeof(*p) - sizeof(*h);
-+ data_size = h->length - header_size;
-+
-+ /* I expect a block to be a multiple of 512 byte, and
-+ * no more than 4K (PAGE_SIZE). is this too restrictive?
-+ */
-+ ERR_IF(data_size == 0) return FALSE;
-+ ERR_IF(data_size & 0x1ff) return FALSE;
-+ ERR_IF(data_size > PAGE_SIZE) return FALSE;
-+
-+ if (drbd_recv(mdev, h->payload, header_size) != header_size)
-+ return FALSE;
-+
-+ sector = be64_to_cpu(p->sector);
-+
-+ req = (drbd_request_t *)(long)p->block_id;
-+ D_ASSERT(req->w.cb == w_is_app_read);
-+
-+ spin_lock(&mdev->pr_lock);
-+ list_del(&req->w.list);
-+ spin_unlock(&mdev->pr_lock);
-+
-+ ok = recv_dless_read(mdev,req,sector,data_size);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+
-+ return ok;
-+}
-+
-+STATIC int receive_RSDataReply(drbd_dev *mdev,Drbd_Header* h)
-+{
-+ sector_t sector;
-+ unsigned int header_size,data_size;
-+ int ok;
-+ Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
-+
-+ header_size = sizeof(*p) - sizeof(*h);
-+ data_size = h->length - header_size;
-+
-+ /* I expect a block to be a multiple of 512 byte, and
-+ * no more than 4K (PAGE_SIZE). is this too restrictive?
-+ */
-+ ERR_IF(data_size == 0) return FALSE;
-+ ERR_IF(data_size & 0x1ff) return FALSE;
-+ ERR_IF(data_size > PAGE_SIZE) return FALSE;
-+
-+ if (drbd_recv(mdev, h->payload, header_size) != header_size)
-+ return FALSE;
-+
-+ sector = be64_to_cpu(p->sector);
-+ D_ASSERT(p->block_id == ID_SYNCER);
-+
-+ ok = recv_resync_read(mdev,sector,data_size);
-+
-+ return ok;
-+}
-+
-+STATIC int e_end_block(drbd_dev *mdev, struct drbd_work *w, int unused)
-+{
-+ struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
-+ sector_t sector = drbd_ee_get_sector(e);
-+ int ok=1;
-+
-+ atomic_inc(&mdev->epoch_size);
-+ if(mdev->conf.wire_protocol == DRBD_PROT_C) {
-+ if(likely(drbd_bio_uptodate(&e->private_bio))) {
-+ ok=drbd_send_ack(mdev,WriteAck,e);
-+ if (ok && test_bit(SYNC_STARTED,&mdev->flags) )
-+ drbd_set_in_sync(mdev,sector,drbd_ee_get_size(e));
-+ } else {
-+ ok = drbd_send_ack(mdev,NegAck,e);
-+ ok&= drbd_io_error(mdev);
-+ /* we expect it to be marked out of sync anyways...
-+ * maybe assert this?
-+ */
-+ }
-+ dec_unacked(mdev);
-+
-+ return ok;
-+ }
-+
-+ if(unlikely(!drbd_bio_uptodate(&e->private_bio))) {
-+ ok = drbd_io_error(mdev);
-+ }
-+
-+ return ok;
-+}
-+
-+// mirrored write
-+STATIC int receive_Data(drbd_dev *mdev,Drbd_Header* h)
-+{
-+ sector_t sector;
-+ struct Tl_epoch_entry *e;
-+ Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
-+ int header_size,data_size;
-+
-+ // FIXME merge this code dups into some helper function
-+ header_size = sizeof(*p) - sizeof(*h);
-+ data_size = h->length - header_size;
-+
-+ /* I expect a block to be a multiple of 512 byte, and
-+ * no more than 4K (PAGE_SIZE). is this too restrictive?
-+ */
-+ ERR_IF(data_size == 0) return FALSE;
-+ ERR_IF(data_size & 0x1ff) return FALSE;
-+ ERR_IF(data_size > PAGE_SIZE) return FALSE;
-+
-+ if (drbd_recv(mdev, h->payload, header_size) != header_size)
-+ return FALSE;
-+
-+ sector = be64_to_cpu(p->sector);
-+
-+ e = read_in_block(mdev,data_size);
-+ if (!e) return FALSE;
-+ e->block_id = p->block_id; // no meaning on this side, e* on partner
-+
-+ if(!inc_local(mdev)) {
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Can not write mirrored data block to local disk.\n");
-+ drbd_send_ack(mdev,NegAck,e);
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ return TRUE;
-+ }
-+
-+ drbd_ee_prepare_write(mdev, e, sector, data_size);
-+ e->w.cb = e_end_block;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ list_add(&e->w.list,&mdev->active_ee);
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ switch(mdev->conf.wire_protocol) {
-+ case DRBD_PROT_C:
-+ inc_unacked(mdev);
-+ break;
-+ case DRBD_PROT_B:
-+ drbd_send_ack(mdev, RecvAck, e);
-+ break;
-+ case DRBD_PROT_A:
-+ // nothing to do
-+ break;
-+ }
-+
-+ drbd_generic_make_request(WRITE,&e->private_bio);
-+
-+ receive_data_tail(mdev,data_size);
-+ return TRUE;
-+}
-+
-+STATIC int receive_DataRequest(drbd_dev *mdev,Drbd_Header *h)
-+{
-+ sector_t sector;
-+ const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
-+ struct Tl_epoch_entry *e;
-+ int size;
-+ Drbd_BlockRequest_Packet *p = (Drbd_BlockRequest_Packet*)h;
-+
-+ ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
-+
-+ if (drbd_recv(mdev, h->payload, h->length) != h->length)
-+ return FALSE;
-+
-+ sector = be64_to_cpu(p->sector);
-+ size = be32_to_cpu(p->blksize);
-+
-+ /*
-+ * handled by NegDReply below ...
-+ ERR_IF (test_bit(DISKLESS,&mdev->flags)) {
-+ return FALSE;
-+ ERR_IF ( (mdev->gen_cnt[Flags] & MDF_Consistent) == 0 )
-+ return FALSE;
-+ */
-+
-+ if (size <= 0 || (size & 0x1ff) != 0 || size > PAGE_SIZE) {
-+ ERR("%s:%d: sector: %lu, size: %d\n", __FILE__, __LINE__,
-+ (unsigned long)sector,size);
-+ return FALSE;
-+ }
-+ if ( sector + (size>>9) > capacity) {
-+ ERR("%s:%d: sector: %lu, size: %d\n", __FILE__, __LINE__,
-+ (unsigned long)sector,size);
-+ return FALSE;
-+ }
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ e=drbd_get_ee(mdev);
-+ if(!e) {
-+ spin_unlock_irq(&mdev->ee_lock);
-+ return FALSE;
-+ }
-+ e->block_id = p->block_id; // no meaning on this side, pr* on partner
-+ list_add(&e->w.list,&mdev->read_ee);
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ if(!inc_local(mdev) || (mdev->gen_cnt[Flags] & MDF_Consistent) == 0) {
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Can not satisfy peer's read request, no local data.\n");
-+ drbd_send_ack(mdev,NegDReply,e);
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ return TRUE;
-+ }
-+
-+ drbd_ee_prepare_read(mdev,e,sector,size);
-+
-+ switch (h->command) {
-+ case DataRequest:
-+ e->w.cb = w_e_end_data_req;
-+ break;
-+ case RSDataRequest:
-+ e->w.cb = w_e_end_rsdata_req;
-+ /* Eventually this should become asynchrously. Currently it
-+ * blocks the whole receiver just to delay the reading of a
-+ * resync data block.
-+ * the drbd_work_queue mechanism is made for this...
-+ */
-+ if (!drbd_rs_begin_io(mdev,sector)) {
-+ // we have been interrupted, probably connection lost!
-+ D_ASSERT(signal_pending(current));
-+ drbd_put_ee(mdev,e);
-+ return 0;
-+ }
-+ break;
-+ default:
-+ ERR("unexpected command (%s) in receive_DataRequest\n",
-+ cmdname(h->command));
-+ }
-+
-+ mdev->read_cnt += size >> 9;
-+ inc_unacked(mdev);
-+ drbd_generic_make_request(READ,&e->private_bio);
-+ if (atomic_read(&mdev->local_cnt) >= (mdev->conf.max_epoch_size>>4) ) {
-+ drbd_kick_lo(mdev);
-+ }
-+
-+
-+ return TRUE;
-+}
-+
-+STATIC int receive_SyncParam(drbd_dev *mdev,Drbd_Header *h)
-+{
-+ int ok = TRUE;
-+ Drbd_SyncParam_Packet *p = (Drbd_SyncParam_Packet*)h;
-+
-+ // FIXME move into helper
-+ ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
-+
-+ if (drbd_recv(mdev, h->payload, h->length) != h->length)
-+ return FALSE;
-+
-+ // XXX harmless race with ioctl ...
-+ mdev->sync_conf.rate = be32_to_cpu(p->rate);
-+ mdev->sync_conf.use_csums = be32_to_cpu(p->use_csums);
-+ mdev->sync_conf.skip = be32_to_cpu(p->skip);
-+ drbd_alter_sg(mdev, be32_to_cpu(p->group));
-+
-+ if ( (mdev->cstate == SkippedSyncS || mdev->cstate == SkippedSyncT)
-+ && !mdev->sync_conf.skip )
-+ {
-+ set_cstate(mdev,WFReportParams);
-+ ok = drbd_send_param(mdev,0);
-+ }
-+
-+ return ok;
-+}
-+
-+STATIC int drbd_sync_handshake(drbd_dev *mdev, Drbd_Parameter_Packet *p)
-+{
-+ int have_good,sync;
-+
-+ have_good = drbd_md_compare(mdev,p);
-+
-+ if(have_good==0) {
-+ if (drbd_md_test_flag(mdev,MDF_PrimaryInd)) {
-+ /* gen counts compare the same, but I have the
-+ * PrimaryIndicator set. so the peer has, too
-+ * (otherwise this would not compare the same).
-+ * so we had a split brain!
-+ *
-+ * FIXME maybe log MDF_SplitBran into metadata,
-+ * and refuse to do anything until told otherwise!
-+ *
-+ * for now: just go StandAlone.
-+ */
-+ ALERT("Split-Brain detected, dropping connection!\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+ sync=0;
-+ } else {
-+ sync=1;
-+ }
-+
-+ drbd_dump_md(mdev,p,0);
-+ // INFO("have_good=%d sync=%d\n", have_good, sync);
-+
-+ if (have_good > 0 && !drbd_md_test_flag(mdev,MDF_Consistent)) {
-+ /* doh. I cannot become SyncSource when I am inconsistent!
-+ */
-+ ERR("I shall become SyncSource, but I am inconsistent!\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+ if (have_good < 0 &&
-+ !(be32_to_cpu(p->gen_cnt[Flags]) & MDF_Consistent) ) {
-+ /* doh. Peer cannot become SyncSource when inconsistent
-+ */
-+ ERR("I shall become SyncTarget, but Peer is inconsistent!\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ if ( mdev->sync_conf.skip && sync ) {
-+ if (have_good == 1)
-+ set_cstate(mdev,SkippedSyncS);
-+ else // have_good == -1
-+ set_cstate(mdev,SkippedSyncT);
-+ return TRUE;
-+ }
-+
-+ if( sync ) {
-+ if(have_good == 1) {
-+ D_ASSERT(drbd_md_test_flag(mdev,MDF_Consistent));
-+ set_cstate(mdev,WFBitMapS);
-+ wait_event(mdev->cstate_wait,
-+ atomic_read(&mdev->ap_bio_cnt)==0);
-+ drbd_bm_lock(mdev); // {
-+ drbd_send_bitmap(mdev);
-+ drbd_bm_unlock(mdev); // }
-+ } else { // have_good == -1
-+ if ( (mdev->state == Primary) &&
-+ drbd_md_test_flag(mdev,MDF_Consistent) ) {
-+ /* FIXME
-+ * allow Primary become SyncTarget if it was
-+ * diskless, and now had a storage reattached.
-+ * only somewhere the MDF_Consistent flag is
-+ * set where it should not... I think.
-+ */
-+ ERR("Current Primary shall become sync TARGET!"
-+ " Aborting to prevent data corruption.\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+ drbd_md_clear_flag(mdev,MDF_Consistent);
-+ set_cstate(mdev,WFBitMapT);
-+ }
-+ } else {
-+ set_cstate(mdev,Connected);
-+ drbd_bm_lock(mdev); // {
-+ if(drbd_bm_total_weight(mdev)) {
-+ if (drbd_md_test_flag(mdev,MDF_Consistent)) {
-+ /* We are not going to do a resync but there
-+ are marks in the bitmap.
-+ (Could be from the AL, or someone used
-+ the write_gc.pl program)
-+ Clean the bitmap...
-+ */
-+ INFO("No resync -> clearing bit map.\n");
-+ drbd_bm_clear_all(mdev);
-+ drbd_bm_write(mdev);
-+ } else {
-+ WARN("I am inconsistent, but there is no sync? BOTH nodes inconsistent!\n");
-+ }
-+ }
-+ drbd_bm_unlock(mdev); // }
-+ }
-+
-+ if (have_good == -1) {
-+ /* Sync-Target has to adopt source's gen_cnt. */
-+ int i;
-+ for(i=HumanCnt;i<GEN_CNT_SIZE;i++) {
-+ mdev->gen_cnt[i]=be32_to_cpu(p->gen_cnt[i]);
-+ }
-+ }
-+ return TRUE;
-+}
-+
-+STATIC int receive_param(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ Drbd_Parameter_Packet *p = (Drbd_Parameter_Packet*)h;
-+ int consider_sync;
-+ int oo_state,i;
-+ sector_t p_size, p_usize, my_usize;
-+
-+ if (h->length != (sizeof(*p)-sizeof(*h))) {
-+ ERR("Incompatible packet size of Parameter packet!\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ if (drbd_recv(mdev, h->payload, h->length) != h->length)
-+ return FALSE;
-+
-+ if (p->magic != BE_DRBD_MAGIC) {
-+ ERR("invalid Parameter_Packet magic! Protocol version: me %d, peer %d\n",
-+ PRO_VERSION, be32_to_cpu(p->version));
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ if(be32_to_cpu(p->version)!=PRO_VERSION) {
-+ ERR("incompatible releases! Protocol version: me %d, peer %d\n",
-+ PRO_VERSION, be32_to_cpu(p->version));
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ oo_state = be32_to_cpu(p->state);
-+ if (oo_state != Primary && oo_state != Secondary) {
-+ ERR("unexpected peer state: 0x%x\n", oo_state);
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ if(be32_to_cpu(p->state) == Primary && mdev->state == Primary ) {
-+ ERR("incompatible states (both Primary!)\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ if(be32_to_cpu(p->protocol)!=mdev->conf.wire_protocol) {
-+ int peer_proto = be32_to_cpu(p->protocol);
-+ if (DRBD_PROT_A <= peer_proto && peer_proto <= DRBD_PROT_C) {
-+ ERR("incompatible communication protocols: "
-+ "me %c, peer %c\n",
-+ 'A'-1+mdev->conf.wire_protocol,
-+ 'A'-1+peer_proto);
-+ } else {
-+ ERR("incompatible communication protocols: "
-+ "me %c, peer [%d]\n",
-+ 'A'-1+mdev->conf.wire_protocol,
-+ peer_proto);
-+ }
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ p_size=be64_to_cpu(p->p_size);
-+
-+ if(p_size == 0 && test_bit(DISKLESS,&mdev->flags)) {
-+ /* FIXME maybe allow connection,
-+ * but refuse to become primary? */
-+ ERR("some backing storage is needed\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ return FALSE;
-+ }
-+
-+ drbd_bm_lock(mdev); // {
-+ mdev->p_size=p_size;
-+
-+ set_bit(MD_DIRTY,&mdev->flags); // we are changing state!
-+
-+ p_usize=be64_to_cpu(p->u_size);
-+ /*
-+ * you may get a flip-flop connection established/connection loss, in
-+ * case both really have different usize uppon first connect!
-+ * try to solve it thus:
-+ ***/
-+#define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
-+ if (mdev->cstate == WFReportParams) {
-+ /* this is first connect, or an otherwise expected param
-+ * exchange. choose the minimum */
-+ p_usize = min_not_zero(mdev->lo_usize, p_usize);
-+ } else {
-+ /* this was an "unexpected" param packet,
-+ * just do what the peer suggests */
-+ }
-+#undef min_not_zero
-+
-+ my_usize = mdev->lo_usize;
-+
-+ if( mdev->lo_usize > p_usize ) {
-+ mdev->lo_usize = p_usize;
-+ INFO("Peer sets u_size to %lu KB\n",
-+ (unsigned long)mdev->lo_usize);
-+ }
-+
-+ if( drbd_new_dev_size(mdev) <
-+ (drbd_get_capacity(mdev->this_bdev)>>1) &&
-+ mdev->gen_cnt[Flags] & MDF_Consistent ) {
-+ ERR("The peer's disk size is too small!\n");
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ mdev->lo_usize = my_usize;
-+ return FALSE;
-+ }
-+
-+ consider_sync = (mdev->cstate == WFReportParams);
-+ drbd_determin_dev_size(mdev);
-+ if(drbd_disk_less_node_present(mdev)) consider_sync=0;
-+ if(test_bit(DISKLESS, &mdev->flags)) consider_sync=0;
-+
-+ drbd_bm_unlock(mdev); // }
-+
-+ if(be32_to_cpu(p->flags)&1) {
-+ consider_sync=1;
-+ drbd_send_param(mdev,2);
-+ }
-+ if(be32_to_cpu(p->flags)&2) consider_sync=1;
-+
-+ // XXX harmless race with ioctl ...
-+ mdev->sync_conf.rate =
-+ max_t(int,mdev->sync_conf.rate, be32_to_cpu(p->sync_rate));
-+
-+ // if one of them wants to skip, both of them should skip.
-+ mdev->sync_conf.skip =
-+ mdev->sync_conf.skip != 0 || p->skip_sync != 0;
-+ mdev->sync_conf.group =
-+ min_t(int,mdev->sync_conf.group,be32_to_cpu(p->sync_group));
-+
-+ if(!p_size) {
-+ /* no point in trying to sync a diskless peer: */
-+ consider_sync = 0;
-+ if (!test_and_set_bit(PARTNER_DISKLESS, &mdev->flags)) {
-+ /* if we got here, we *do* have a disk.
-+ * but it may be inconsistent...
-+ * anyways, record that next time we need a full sync.
-+ */
-+ clear_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ drbd_md_set_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+ /* actually we'd need to bm_fill_bm(,-1); drbd_write_bm(mdev);
-+ * but this is not necessary _now_.
-+ * we have the MDF_FullSync bit on disk.
-+ * on the next _drbd_send_bitmap this will be done.
-+ */
-+ WARN("PARTNER DISKLESS\n");
-+ mdev->rs_total = 0;
-+ }
-+ if(mdev->cstate >= Connected ) {
-+ if(mdev->state == Primary) tl_clear(mdev);
-+ if(mdev->state == Primary ||
-+ be32_to_cpu(p->state) == Primary ) {
-+ drbd_md_inc(mdev,ConnectedCnt);
-+ }
-+ }
-+ if(mdev->cstate > Connected ) {
-+ WARN("Resync aborted.\n");
-+ set_cstate(mdev,Connected);
-+ }
-+ } else {
-+ if (test_and_clear_bit(PARTNER_DISKLESS, &mdev->flags)) {
-+ WARN("Partner no longer diskless\n");
-+ D_ASSERT(consider_sync);
-+ }
-+ }
-+
-+ if (be32_to_cpu(p->gen_cnt[Flags]) & MDF_Consistent) {
-+ set_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ } else {
-+ clear_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ }
-+
-+ if (mdev->cstate == WFReportParams) {
-+ INFO("Connection established.\n");
-+ }
-+
-+ if (consider_sync) {
-+ if (!drbd_sync_handshake(mdev,p)) return FALSE;
-+ }
-+
-+ if (mdev->cstate == WFReportParams) set_cstate(mdev,Connected);
-+
-+ oo_state = mdev->o_state;
-+ mdev->o_state = be32_to_cpu(p->state);
-+ if(oo_state == Secondary && mdev->o_state == Primary) {
-+ /* Secondary has to adopt primary's gen_cnt. */
-+ for(i=HumanCnt;i<GEN_CNT_SIZE;i++) {
-+ mdev->gen_cnt[i]=be32_to_cpu(p->gen_cnt[i]);
-+ }
-+ }
-+
-+ if (oo_state != mdev->o_state) {
-+ INFO( "%s/%s --> %s/%s\n",
-+ nodestate_to_name(mdev->state),
-+ nodestate_to_name(oo_state),
-+ nodestate_to_name(mdev->state),
-+ nodestate_to_name(mdev->o_state) );
-+ /* FIXME assertion for (gencounts do not diverge) */
-+ }
-+ drbd_md_write(mdev); // update connected indicator, la_size, ...
-+
-+ return TRUE;
-+}
-+
-+/* Since we are processing the bitfild from lower addresses to higher,
-+ it does not matter if the process it in 32 bit chunks or 64 bit
-+ chunks as long as it is little endian. (Understand it as byte stream,
-+ beginning with the lowest byte...) If we would use big endian
-+ we would need to process it from the highest address to the lowest,
-+ in order to be agnostic to the 32 vs 64 bits issue.
-+
-+ returns 0 on failure, 1 if we suceessfully received it. */
-+STATIC int receive_bitmap(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ size_t bm_words, bm_i, want, num_words;
-+ unsigned long *buffer;
-+ int ok=FALSE;
-+
-+ drbd_bm_lock(mdev); // {
-+
-+ bm_words = drbd_bm_words(mdev);
-+ bm_i = 0;
-+ buffer = vmalloc(BM_PACKET_WORDS*sizeof(long));
-+
-+ while (1) {
-+ num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
-+ want = num_words * sizeof(long);
-+ ERR_IF(want != h->length) goto out;
-+ if (want==0) break;
-+ if (drbd_recv(mdev, buffer, want) != want)
-+ goto out;
-+
-+ drbd_bm_merge_lel(mdev, bm_i, num_words, buffer);
-+ bm_i += num_words;
-+
-+ if (!drbd_recv_header(mdev,h))
-+ goto out;
-+ D_ASSERT(h->command == ReportBitMap);
-+ }
-+
-+ if (mdev->cstate == WFBitMapS) {
-+ drbd_start_resync(mdev,SyncSource);
-+ } else if (mdev->cstate == WFBitMapT) {
-+ ok = drbd_send_bitmap(mdev);
-+ if (!ok) goto out;
-+ drbd_start_resync(mdev,SyncTarget); // XXX cannot fail ???
-+ } else {
-+ ERR("unexpected cstate (%s) in receive_bitmap\n",
-+ cstate_to_name(mdev->cstate));
-+ }
-+
-+ // We just started resync. Now we can be sure that local disk IO is okay.
-+
-+ /* no, actually we can't. failures happen asynchronously, anytime.
-+ * we can never be sure. disk may have failed while we where busy shaking hands...
-+ */
-+/*
-+ * FIXME this should only be D_ASSERT here.
-+ * *doing* it here masks a logic bug elsewhere, I think.
-+ */
-+ D_ASSERT(!test_bit(PARTNER_DISKLESS,&mdev->flags));
-+ D_ASSERT(!test_bit(DISKLESS,&mdev->flags));
-+// EXPLAIN:
-+ clear_bit(MD_IO_ALLOWED,&mdev->flags);
-+
-+ ok=TRUE;
-+ out:
-+ drbd_bm_unlock(mdev); // }
-+ vfree(buffer);
-+ return ok;
-+}
-+
-+STATIC void drbd_fail_pending_reads(drbd_dev *mdev)
-+{
-+ struct list_head *le;
-+ drbd_bio_t *bio;
-+ LIST_HEAD(workset);
-+
-+ /*
-+ * Application READ requests
-+ */
-+ spin_lock(&mdev->pr_lock);
-+ list_splice_init(&mdev->app_reads,&workset);
-+ spin_unlock(&mdev->pr_lock);
-+
-+ while(!list_empty(&workset)) {
-+ drbd_request_t *req;
-+ le = workset.next;
-+ req = list_entry(le, drbd_request_t, w.list);
-+ list_del(le);
-+
-+ bio = req->master_bio;
-+
-+ drbd_bio_IO_error(bio);
-+ dec_ap_bio(mdev);
-+ dec_ap_pending(mdev);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+ }
-+}
-+
-+STATIC int receive_skip(drbd_dev *mdev,Drbd_Header *h)
-+{
-+ // TODO zero copy sink :)
-+ static char sink[128];
-+ int size,want,r;
-+
-+ WARN("skipping unknown optional packet type %d, l: %d!\n",
-+ h->command, h->length );
-+
-+ size = h->length;
-+ while (size > 0) {
-+ want = min_t(int,size,sizeof(sink));
-+ r = drbd_recv(mdev,sink,want);
-+ ERR_IF(r < 0) break;
-+ size -= r;
-+ }
-+ return (size == 0);
-+}
-+
-+STATIC int receive_BecomeSyncTarget(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ ERR_IF(!mdev->bitmap) return FALSE;
-+ ERR_IF(mdev->state != Secondary)
-+ return FALSE;
-+ ERR_IF(mdev->cstate != Connected)
-+ return FALSE;
-+ ERR_IF(test_bit(DISKLESS,&mdev->flags))
-+ return FALSE;
-+
-+ drbd_bm_lock(mdev);
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+ drbd_start_resync(mdev,SyncTarget);
-+ drbd_bm_unlock(mdev);
-+ return TRUE;
-+}
-+
-+STATIC int receive_BecomeSyncSource(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ ERR_IF(mdev->cstate != Connected)
-+ return FALSE;
-+ ERR_IF(test_bit(DISKLESS,&mdev->flags))
-+ return FALSE;
-+ ERR_IF(!drbd_md_test_flag(mdev,MDF_Consistent))
-+ return FALSE;
-+
-+ drbd_bm_lock(mdev);
-+ drbd_bm_set_all(mdev);
-+ drbd_bm_write(mdev);
-+ drbd_start_resync(mdev,SyncSource);
-+ drbd_bm_unlock(mdev);
-+ return TRUE;
-+}
-+
-+STATIC int receive_UnplugRemote(drbd_dev *mdev, Drbd_Header *h)
-+{
-+ if (!test_bit(DISKLESS,&mdev->flags)) drbd_kick_lo(mdev);
-+ return TRUE; // cannot fail.
-+}
-+
-+typedef int (*drbd_cmd_handler_f)(drbd_dev*,Drbd_Header*);
-+
-+static drbd_cmd_handler_f drbd_default_handler[] = {
-+ [Data] = receive_Data,
-+ [DataReply] = receive_DataReply,
-+ [RSDataReply] = receive_RSDataReply,
-+ [RecvAck] = NULL, //receive_RecvAck,
-+ [WriteAck] = NULL, //receive_WriteAck,
-+ [Barrier] = receive_Barrier,
-+ [BarrierAck] = NULL, //receive_BarrierAck,
-+ [ReportParams] = receive_param,
-+ [ReportBitMap] = receive_bitmap,
-+ [Ping] = NULL, //receive_Ping,
-+ [PingAck] = NULL, //receive_PingAck,
-+ [BecomeSyncTarget] = receive_BecomeSyncTarget,
-+ [BecomeSyncSource] = receive_BecomeSyncSource,
-+ [UnplugRemote] = receive_UnplugRemote,
-+ [DataRequest] = receive_DataRequest,
-+ [RSDataRequest] = receive_DataRequest, //receive_RSDataRequest,
-+ [SyncParam] = receive_SyncParam,
-+};
-+
-+static drbd_cmd_handler_f *drbd_cmd_handler = drbd_default_handler;
-+static drbd_cmd_handler_f *drbd_opt_cmd_handler = NULL;
-+
-+STATIC void drbdd(drbd_dev *mdev)
-+{
-+ drbd_cmd_handler_f handler;
-+ Drbd_Header *header = &mdev->data.rbuf.head;
-+
-+ for (;;) {
-+ if (!drbd_recv_header(mdev,header))
-+ break;
-+
-+ if (header->command < MAX_CMD)
-+ handler = drbd_cmd_handler[header->command];
-+ else if (MayIgnore < header->command && header->command < MAX_OPT_CMD)
-+ handler = drbd_opt_cmd_handler[header->command-MayIgnore];
-+ else if (header->command > MAX_OPT_CMD)
-+ handler = receive_skip;
-+ else
-+ handler = NULL;
-+
-+ if (unlikely(!handler)) {
-+ ERR("unknown packet type %d, l: %d!\n",
-+ header->command, header->length);
-+ break;
-+ }
-+ if (mdev->cstate == WFReportParams && header->command != ReportParams) {
-+ ERR("received %s packet while WFReportParams!?\n",
-+ cmdname(header->command));
-+ }
-+ if (unlikely(!handler(mdev,header))) {
-+ ERR("error receiving %s, l: %d!\n",
-+ cmdname(header->command), header->length);
-+ break;
-+ }
-+ dump_packet(mdev,mdev->data.socket,2,&mdev->data.rbuf, __FILE__, __LINE__);
-+ }
-+}
-+
-+STATIC void drbd_disconnect(drbd_dev *mdev)
-+{
-+ D_ASSERT(mdev->cstate < Connected);
-+ mdev->o_state = Unknown;
-+
-+ /* in case we have been syncing, and then we drop the connection,
-+ * we need to "w_resume_next_sg", which we try to achieve by
-+ * setting the STOP_SYNC_TIMER bit, and schedulung the timer for
-+ * immediate execution.
-+ * unfortunately we cannot be sure that the timer already triggered.
-+ *
-+ * so we del_timer_sync here, and check that bit.
-+ * if it is still set, we queue w_resume_next_sg anyways,
-+ * just to be sure.
-+ */
-+
-+ del_timer_sync(&mdev->resync_timer);
-+ spin_lock_irq(&mdev->req_lock);
-+ if (test_and_clear_bit(STOP_SYNC_TIMER,&mdev->flags)) {
-+ mdev->resync_work.cb = w_resume_next_sg;
-+ if (list_empty(&mdev->resync_work.list))
-+ _drbd_queue_work(&mdev->data.work,&mdev->resync_work);
-+ // else: already queued, we only need to release the lock.
-+ } else {
-+ D_ASSERT(mdev->resync_work.cb == w_resync_inactive);
-+ }
-+ spin_unlock_irq(&mdev->req_lock);
-+
-+
-+ drbd_thread_stop_nowait(&mdev->worker);
-+ drbd_thread_stop(&mdev->asender);
-+
-+ while(down_trylock(&mdev->data.mutex)) {
-+ struct task_struct *task;
-+ spin_lock(&mdev->send_task_lock);
-+ if((task=mdev->send_task)) {
-+ force_sig(DRBD_SIG, task);
-+ spin_unlock(&mdev->send_task_lock);
-+ down(&mdev->data.mutex);
-+ break;
-+ } else {
-+ spin_unlock(&mdev->send_task_lock);
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ / 10);
-+ }
-+ }
-+ /* By grabbing the sock_mutex we make sure that no one
-+ uses the socket right now. */
-+ drbd_free_sock(mdev);
-+ up(&mdev->data.mutex);
-+
-+ drbd_fail_pending_reads(mdev);
-+ drbd_thread_stop(&mdev->worker);
-+ drbd_rs_cancel_all(mdev);
-+
-+ // secondary
-+ drbd_wait_ee(mdev,&mdev->active_ee);
-+ drbd_wait_ee(mdev,&mdev->sync_ee);
-+ drbd_clear_done_ee(mdev);
-+
-+ // primary
-+ tl_clear(mdev);
-+ clear_bit(ISSUE_BARRIER,&mdev->flags);
-+ wait_event( mdev->cstate_wait, atomic_read(&mdev->ap_pending_cnt)==0 );
-+ D_ASSERT(mdev->oldest_barrier->n_req == 0);
-+
-+ // both
-+ clear_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ clear_bit(PARTNER_DISKLESS,&mdev->flags);
-+
-+ D_ASSERT(mdev->ee_in_use == 0);
-+ D_ASSERT(list_empty(&mdev->read_ee)); // done by termination of worker
-+ D_ASSERT(list_empty(&mdev->active_ee)); // done here
-+ D_ASSERT(list_empty(&mdev->sync_ee)); // done here
-+ D_ASSERT(list_empty(&mdev->done_ee)); // done here
-+
-+ atomic_set(&mdev->epoch_size,0);
-+ mdev->rs_total=0;
-+
-+ if(atomic_read(&mdev->unacked_cnt)) {
-+ ERR("unacked_cnt = %d\n",atomic_read(&mdev->unacked_cnt));
-+ atomic_set(&mdev->unacked_cnt,0);
-+ }
-+
-+ /* We do not have data structures that would allow us to
-+ get the rs_pending_cnt down to 0 again.
-+ * On SyncTarget we do not have any data structures describing
-+ the pending RSDataRequest's we have sent.
-+ * On SyncSource there is no data structure that tracks
-+ the RSDataReply blocks that we sent to the SyncTarget.
-+ And no, it is not the sum of the reference counts in the
-+ resync_LRU. The resync_LRU tracks the whole operation including
-+ the disk-IO, while the rs_pending_cnt only tracks the blocks
-+ on the fly. */
-+ atomic_set(&mdev->rs_pending_cnt,0);
-+
-+ if(atomic_read(&mdev->ap_pending_cnt)) {
-+ ERR("ap_pending_cnt = %d\n",atomic_read(&mdev->ap_pending_cnt));
-+ atomic_set(&mdev->ap_pending_cnt,0);
-+ }
-+
-+ wake_up(&mdev->cstate_wait);
-+
-+ if ( mdev->state == Primary &&
-+ ( test_bit(DISKLESS,&mdev->flags)
-+ || !drbd_md_test_flag(mdev,MDF_Consistent) ) ) {
-+ drbd_thread_stop_nowait(&mdev->receiver);
-+ drbd_panic("Sorry, I have no access to good data anymore.\n");
-+ return;
-+ }
-+
-+ if (get_t_state(&mdev->receiver) == Exiting) {
-+ if (test_bit(DISKLESS,&mdev->flags)) {
-+ // Secondary
-+ set_cstate(mdev,Unconfigured);
-+ drbd_mdev_cleanup(mdev);
-+ } else {
-+ set_cstate(mdev,StandAlone);
-+ drbd_thread_start(&mdev->worker);
-+ }
-+ } else {
-+ set_cstate(mdev,Unconnected);
-+ drbd_thread_start(&mdev->worker);
-+ }
-+
-+ if (mdev->state == Primary) {
-+ if(!test_bit(DO_NOT_INC_CONCNT,&mdev->flags))
-+ drbd_md_inc(mdev,ConnectedCnt);
-+ drbd_md_write(mdev);
-+ }
-+ clear_bit(DO_NOT_INC_CONCNT,&mdev->flags);
-+
-+ /* it may still be set, because some unplug was on the fly */
-+ NOT_IN_26(mdev->flags &= ~(1<<UNPLUG_QUEUED);)
-+
-+ INFO("Connection lost.\n");
-+}
-+
-+/*
-+ * we hereby assure that we always support the drbd dialects
-+ * PRO_VERSION and (PRO_VERSION -1), allowing for rolling upgrades
-+ *
-+ * feature flags and the reserved array should be enough room for future
-+ * enhancements of the handshake protocol, and possible plugins...
-+ *
-+ * for now, they are expected to be zero, but ignored.
-+ */
-+int drbd_send_handshake(drbd_dev *mdev)
-+{
-+ // ASSERT current == mdev->receiver ...
-+ Drbd_HandShake_Packet *p = &mdev->data.sbuf.HandShake;
-+ int ok;
-+
-+ if (down_interruptible(&mdev->data.mutex)) {
-+ ERR("interrupted during initial handshake\n");
-+ return 0; /* interrupted. not ok. */
-+ }
-+ memset(p,0,sizeof(*p));
-+ p->protocol_version = cpu_to_be32(PRO_VERSION);
-+ ok = _drbd_send_cmd( mdev, mdev->data.socket, HandShake,
-+ (Drbd_Header *)p, sizeof(*p), 0 );
-+ up(&mdev->data.mutex);
-+ return ok;
-+}
-+
-+/*
-+ * return values:
-+ * 1 yess, we have a valid connection
-+ * 0 oops, did not work out, please try again
-+ * -1 peer talks different language,
-+ * no point in trying again, please go standalone.
-+ */
-+STATIC int drbd_do_handshake(drbd_dev *mdev)
-+{
-+ // ASSERT current == mdev->receiver ...
-+ Drbd_HandShake_Packet *p = &mdev->data.rbuf.HandShake;
-+ const int expect = sizeof(Drbd_HandShake_Packet)-sizeof(Drbd_Header);
-+ int rv;
-+
-+ rv = drbd_send_handshake(mdev);
-+ if (!rv) goto break_c_loop;
-+
-+ rv = drbd_recv_header(mdev,&p->head);
-+ if (!rv) goto break_c_loop;
-+
-+ if (p->head.command == ReportParams) {
-+ ERR("expected HandShake packet, received ReportParams...\n");
-+ ERR("peer probaly runs some incompatible 0.7 -preX version\n");
-+ return -1;
-+ } else if (p->head.command != HandShake) {
-+ ERR( "expected HandShake packet, received: %s (0x%04x)\n",
-+ cmdname(p->head.command), p->head.command );
-+ return -1;
-+ }
-+
-+ if (p->head.length != expect) {
-+ ERR( "expected HandShake length: %u, received: %u\n",
-+ expect, p->head.length );
-+ return -1;
-+ }
-+
-+ rv = drbd_recv(mdev, &p->head.payload, expect);
-+
-+ if (rv != expect) {
-+ ERR("short read receiving handshake packet: l=%u\n", rv);
-+ return 0;
-+ }
-+
-+ dump_packet(mdev,mdev->data.socket,2,&mdev->data.rbuf, __FILE__, __LINE__);
-+
-+ p->protocol_version = be32_to_cpu(p->protocol_version);
-+
-+ if ( p->protocol_version == PRO_VERSION ||
-+ p->protocol_version == (PRO_VERSION+1) ) {
-+ if (p->protocol_version == (PRO_VERSION+1)) {
-+ WARN( "You should upgrade me! "
-+ "Peer wants protocol version: %u\n",
-+ p->protocol_version );
-+ }
-+ INFO( "Handshake successful: DRBD Network Protocol version %u\n",
-+ PRO_VERSION );
-+ } /* else if ( p->protocol_version == (PRO_VERSION-1) ) {
-+ // not yet; but next time :)
-+ INFO( "Handshake successful: DRBD Protocol version %u\n",
-+ (PRO_VERSION-1) );
-+ ... do some remapping of defaults and jump tables here ...
-+ } */ else {
-+ ERR( "incompatible DRBD dialects: "
-+ "I support %u, peer wants %u\n",
-+ PRO_VERSION, p->protocol_version );
-+ return -1;
-+ }
-+
-+ return 1;
-+
-+ break_c_loop:
-+ WARN( "My msock connect got accepted onto peer's sock!\n");
-+ /* In case a tcp connection set-up takes longer than
-+ connect-int, we might get into the situation that this
-+ node's msock gets connected to the peer's sock!
-+
-+ To break out of this endless loop behaviour, we need to
-+ wait unti the peer's msock connect tries are over. (1 Second)
-+
-+ Additionally we wait connect-int/2 to hit with our next
-+ connect try exactly in the peer's window of expectation. */
-+
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ + (mdev->conf.try_connect_int*HZ)/2);
-+
-+ return 0;
-+}
-+
-+int drbdd_init(struct Drbd_thread *thi)
-+{
-+ drbd_dev *mdev = thi->mdev;
-+ int minor = (int)(mdev-drbd_conf);
-+ int h;
-+
-+ sprintf(current->comm, "drbd%d_receiver", minor);
-+
-+ /* printk(KERN_INFO DEVICE_NAME ": receiver living/m=%d\n", minor); */
-+
-+ while (TRUE) {
-+ h = drbd_connect(mdev);
-+ if (h <= 0) {
-+ /* FIXME DISKLESS StandAlone
-+ * does not make much sense...
-+ * drbd_disconnect should set cstate properly...
-+ */
-+ drbd_disconnect(mdev);
-+ if (h == 0) {
-+ schedule_timeout(HZ);
-+ continue;
-+ }
-+
-+ WARN("Discarding network configuration.\n");
-+ set_cstate(mdev,StandAlone);
-+ break;
-+ }
-+ if (get_t_state(thi) == Exiting) break;
-+ drbdd(mdev);
-+ drbd_disconnect(mdev);
-+ if (get_t_state(thi) == Exiting) break;
-+ if(mdev->conf.on_disconnect == DropNetConf) {
-+ set_cstate(mdev,StandAlone);
-+ break;
-+ }
-+ else {
-+ if (signal_pending(current)) {
-+ drbd_flush_signals(current);
-+ }
-+ spin_lock(&thi->t_lock);
-+ D_ASSERT(thi->t_state == Restarting);
-+ thi->t_state = Running;
-+ spin_unlock(&thi->t_lock);
-+ }
-+ }
-+
-+ INFO("receiver terminated\n");
-+
-+ return 0;
-+}
-+
-+/* ********* acknowledge sender ******** */
-+
-+STATIC int got_Ping(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ return drbd_send_ping_ack(mdev);
-+
-+}
-+
-+STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ // restore idle timeout
-+ mdev->meta.socket->sk->SK_(rcvtimeo) = mdev->conf.ping_int*HZ;
-+
-+ return TRUE;
-+}
-+
-+STATIC int got_BlockAck(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ drbd_request_t *req;
-+ Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
-+ sector_t sector = be64_to_cpu(p->sector);
-+ int blksize = be32_to_cpu(p->blksize);
-+
-+ smp_rmb();
-+ if(likely(!test_bit(PARTNER_DISKLESS,&mdev->flags))) {
-+ // test_bit(PARTNER_DISKLESS,&mdev->flags)
-+ // This happens if one a few IO requests on the peer
-+ // failed, and some subsequest completed sucessfull
-+ // afterwards.
-+
-+ // But we killed everything out of the transferlog
-+ // as we got the news hat IO is broken on the peer.
-+
-+ if( is_syncer_blk(mdev,p->block_id)) {
-+ drbd_set_in_sync(mdev,sector,blksize);
-+ set_bit(SYNC_STARTED,&mdev->flags);
-+ } else {
-+ req=(drbd_request_t*)(long)p->block_id;
-+
-+ ERR_IF (!VALID_POINTER(req)) return FALSE;
-+
-+ drbd_end_req(req, RQ_DRBD_SENT, 1, sector);
-+
-+ if (test_bit(SYNC_STARTED,&mdev->flags) &&
-+ mdev->conf.wire_protocol == DRBD_PROT_C)
-+ drbd_set_in_sync(mdev,sector,blksize);
-+ }
-+ }
-+
-+ if(is_syncer_blk(mdev,p->block_id)) {
-+ dec_rs_pending(mdev);
-+ } else {
-+ D_ASSERT(mdev->conf.wire_protocol != DRBD_PROT_A);
-+ dec_ap_pending(mdev);
-+ }
-+ return TRUE;
-+}
-+
-+STATIC int got_NegAck(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
-+#if 0
-+ sector_t sector = be64_to_cpu(p->sector);
-+ int size = be32_to_cpu(p->blksize);
-+#endif
-+
-+ /* do nothing here.
-+ * we expect to get a "report param" on the data socket soon,
-+ * and will do the cleanup then and there.
-+ */
-+ if(is_syncer_blk(mdev,p->block_id)) {
-+ dec_rs_pending(mdev);
-+ }
-+#if 0
-+ else {
-+ D_ASSERT(bm_get_bit(mdev->mbds_id,sector,size));
-+ // tl_clear() must have set this out of sync!
-+ D_ASSERT(mdev->conf.wire_protocol != DRBD_PROT_A);
-+ dec_ap_pending(mdev,HERE);
-+ }
-+#endif
-+ if (DRBD_ratelimit(5*HZ,5))
-+ WARN("Got NegAck packet. Peer is in troubles?\n");
-+
-+ return TRUE;
-+}
-+
-+STATIC int got_NegDReply(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ /* drbd_request_t *req;
-+ * unused now */
-+ Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
-+
-+ if (is_syncer_blk(mdev,p->block_id)) {
-+ /* no resync data available. don't panic just yet ... */
-+ printk(KERN_EMERG DEVICE_NAME "%d: "
-+ "Got NegDReply for resync request. "
-+ "WE ARE LOST. We lost our up-to-date disk.\n",
-+ (int)(mdev-drbd_conf));
-+ return FALSE;
-+ } /* else { */
-+
-+#if 0
-+ /* hey, we panic anyways. so why bother? */
-+ req = (drbd_request_t *)(long)p->block_id;
-+ if (VALID_POINTER(req)) {
-+ D_ASSERT(req->w.cb == w_is_app_read);
-+
-+ spin_lock(&mdev->pr_lock);
-+ list_del(&req->w.list);
-+ spin_unlock(&mdev->pr_lock);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+ }
-+#endif
-+
-+ drbd_panic("Got NegDReply. WE ARE LOST. We lost our up-to-date disk.\n");
-+
-+ // THINK do we have other options, but panic?
-+ // what about bio_endio, in case we don't panic ??
-+
-+ return FALSE;
-+}
-+
-+STATIC int got_NegRSDReply(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ sector_t sector;
-+ Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
-+
-+ sector = be64_to_cpu(p->sector);
-+ D_ASSERT(p->block_id == ID_SYNCER);
-+
-+ drbd_rs_complete_io(mdev,sector);
-+
-+ drbd_panic("Got NegRSDReply. WE ARE LOST. We lost our up-to-date disk.\n");
-+
-+ // THINK do we have other options, but panic?
-+ // what about bio_endio, in case we don't panic ??
-+
-+ return TRUE;
-+}
-+
-+STATIC int got_BarrierAck(drbd_dev *mdev, Drbd_Header* h)
-+{
-+ Drbd_BarrierAck_Packet *p = (Drbd_BarrierAck_Packet*)h;
-+
-+ smp_rmb();
-+ if(unlikely(test_bit(PARTNER_DISKLESS,&mdev->flags))) return TRUE;
-+
-+ tl_release(mdev,p->barrier,be32_to_cpu(p->set_size));
-+ dec_ap_pending(mdev);
-+
-+ return TRUE;
-+}
-+
-+struct asender_cmd {
-+ size_t pkt_size;
-+ int (*process)(drbd_dev *mdev, Drbd_Header* h);
-+};
-+
-+int drbd_asender(struct Drbd_thread *thi)
-+{
-+ drbd_dev *mdev = thi->mdev;
-+ Drbd_Header *h = &mdev->meta.rbuf.head;
-+
-+ int rv,len;
-+ void *buf = h;
-+ int received = 0;
-+ int expect = sizeof(Drbd_Header);
-+ int cmd = -1;
-+
-+ static struct asender_cmd asender_tbl[] = {
-+ [Ping] ={ sizeof(Drbd_Header), got_Ping },
-+ [PingAck] ={ sizeof(Drbd_Header), got_PingAck },
-+ [RecvAck] ={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
-+ [WriteAck] ={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
-+ [NegAck] ={ sizeof(Drbd_BlockAck_Packet), got_NegAck },
-+ [NegDReply] ={ sizeof(Drbd_BlockAck_Packet), got_NegDReply },
-+ [NegRSDReply]={sizeof(Drbd_BlockAck_Packet), got_NegRSDReply},
-+ [BarrierAck]={ sizeof(Drbd_BarrierAck_Packet),got_BarrierAck },
-+ };
-+
-+ sprintf(current->comm, "drbd%d_asender", (int)(mdev-drbd_conf));
-+
-+ current->policy = SCHED_RR; /* Make this a realtime task! */
-+ current->rt_priority = 2; /* more important than all other tasks */
-+
-+ while (get_t_state(thi) == Running) {
-+ if (test_and_clear_bit(SEND_PING, &mdev->flags)) {
-+ ERR_IF(!drbd_send_ping(mdev)) goto err;
-+ // half ack timeout only,
-+ // since sendmsg waited the other half already
-+ mdev->meta.socket->sk->SK_(rcvtimeo) =
-+ mdev->conf.timeout*HZ/20;
-+ }
-+
-+ /* FIXME this *should* be below drbd_process_ee,
-+ * but that leads to some distributed deadlock :-(
-+ * this needs to be fixed properly, I'd vote for a separate
-+ * msock sender thread, but others will frown upon yet an other
-+ * kernel thread...
-+ * -- lge
-+ */
-+ set_bit(SIGNAL_ASENDER, &mdev->flags);
-+
-+ if (!drbd_process_ee(mdev,0)) goto err;
-+
-+ rv = drbd_recv_short(mdev,buf,expect-received);
-+ clear_bit(SIGNAL_ASENDER, &mdev->flags);
-+
-+ drbd_flush_signals(current);
-+
-+ /* Note:
-+ * -EINTR (on meta) we got a signal
-+ * -EAGAIN (on meta) rcvtimeo expired
-+ * -ECONNRESET other side closed the connection
-+ * -ERESTARTSYS (on data) we got a signal
-+ * rv < 0 other than above: unexpected error!
-+ * rv == expected: full header or command
-+ * rv < expected: "woken" by signal during receive
-+ * rv == 0 : "connection shut down by peer"
-+ */
-+ if (likely(rv > 0)) {
-+ received += rv;
-+ buf += rv;
-+ } else if (rv == 0) {
-+ ERR("meta connection shut down by peer.\n");
-+ goto err;
-+ } else if (rv == -EAGAIN) {
-+ if( mdev->meta.socket->sk->SK_(rcvtimeo) ==
-+ mdev->conf.timeout*HZ/20) {
-+ ERR("PingAck did not arrive in time.\n");
-+ goto err;
-+ }
-+ set_bit(SEND_PING,&mdev->flags);
-+ continue;
-+ } else if (rv == -EINTR) {
-+ continue;
-+ } else {
-+ ERR("sock_recvmsg returned %d\n", rv);
-+ goto err;
-+ }
-+
-+ if (received == expect && cmd == -1 ) {
-+ cmd = be16_to_cpu(h->command);
-+ len = be16_to_cpu(h->length);
-+ if (unlikely( h->magic != BE_DRBD_MAGIC )) {
-+ ERR("magic?? m: 0x%lx c: %d l: %d\n",
-+ (long)be32_to_cpu(h->magic),
-+ h->command, h->length);
-+ goto err;
-+ }
-+ expect = asender_tbl[cmd].pkt_size;
-+ ERR_IF(len != expect-sizeof(Drbd_Header)) {
-+ dump_packet(mdev,mdev->meta.socket,1,(void*)h, __FILE__, __LINE__);
-+ DUMPI(expect);
-+ }
-+ }
-+ if(received == expect) {
-+ D_ASSERT(cmd != -1);
-+ dump_packet(mdev,mdev->meta.socket,1,(void*)h, __FILE__, __LINE__);
-+ if(!asender_tbl[cmd].process(mdev,h)) goto err;
-+
-+ buf = h;
-+ received = 0;
-+ expect = sizeof(Drbd_Header);
-+ cmd = -1;
-+ }
-+ } //while
-+
-+ if(0) {
-+ err:
-+ clear_bit(SIGNAL_ASENDER, &mdev->flags);
-+ if (mdev->cstate >= Connected)
-+ set_cstate(mdev,NetworkFailure);
-+ drbd_thread_restart_nowait(&mdev->receiver);
-+ }
-+
-+ INFO("asender terminated\n");
-+
-+ return 0;
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_req.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,422 @@
-+/*
-+-*- linux-c -*-
-+ drbd_req.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-+ main contributor.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+
-+#include <linux/slab.h>
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+void drbd_end_req(drbd_request_t *req, int nextstate, int er_flags,
-+ sector_t rsector)
-+{
-+ /* This callback will be called in irq context by the IDE drivers,
-+ and in Softirqs/Tasklets/BH context by the SCSI drivers.
-+ This function is called by the receiver in kernel-thread context.
-+ Try to get the locking right :) */
-+
-+ struct Drbd_Conf* mdev = drbd_req_get_mdev(req);
-+ unsigned long flags=0;
-+ int uptodate;
-+
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+ PARANOIA_BUG_ON(drbd_req_get_sector(req) != rsector);
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+
-+ if(req->rq_status & nextstate) {
-+ ERR("request state error(%d)\n", req->rq_status);
-+ }
-+
-+ req->rq_status |= nextstate;
-+ req->rq_status &= er_flags | ~0x0001;
-+ if( (req->rq_status & RQ_DRBD_DONE) == RQ_DRBD_DONE ) goto end_it;
-+
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+
-+ return;
-+
-+/* We only report uptodate == TRUE if both operations (WRITE && SEND)
-+ reported uptodate == TRUE
-+ */
-+
-+ end_it:
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+
-+ if( req->rq_status & RQ_DRBD_IN_TL ) {
-+ if( ! ( er_flags & ERF_NOTLD ) ) {
-+ /*If this call is from tl_clear() we may not call
-+ tl_dependene, otherwhise we have a homegrown
-+ spinlock deadlock. */
-+ if(tl_dependence(mdev,req))
-+ set_bit(ISSUE_BARRIER,&mdev->flags);
-+ } else {
-+ list_del(&req->w.list); // we have the tl_lock...
-+ }
-+ }
-+
-+ uptodate = req->rq_status & 0x0001;
-+ if( !uptodate && mdev->on_io_error == Detach) {
-+ drbd_set_out_of_sync(mdev,rsector, drbd_req_get_size(req));
-+ // It should also be as out of sync on
-+ // the other side! See w_io_error()
-+
-+ drbd_bio_endio(req->master_bio,1);
-+ dec_ap_bio(mdev);
-+ // The assumption is that we wrote it on the peer.
-+
-+// FIXME proto A and diskless :)
-+
-+ req->w.cb = w_io_error;
-+ drbd_queue_work(mdev,&mdev->data.work,&req->w);
-+
-+ goto out;
-+
-+ }
-+
-+ drbd_bio_endio(req->master_bio,uptodate);
-+ dec_ap_bio(mdev);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+
-+ out:
-+ if (test_bit(ISSUE_BARRIER,&mdev->flags)) {
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+ if(list_empty(&mdev->barrier_work.list)) {
-+ _drbd_queue_work(&mdev->data.work,&mdev->barrier_work);
-+ }
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+ }
-+}
-+
-+int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req)
-+{
-+ int rv;
-+ drbd_bio_t *bio = req->master_bio;
-+
-+ req->w.cb = w_is_app_read;
-+ spin_lock(&mdev->pr_lock);
-+ list_add(&req->w.list,&mdev->app_reads);
-+ spin_unlock(&mdev->pr_lock);
-+ set_bit(UNPLUG_REMOTE,&mdev->flags);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ rv=drbd_send_drequest(mdev, DataRequest, bio->b_rsector, bio->b_size,
-+ (unsigned long)req);
-+#else
-+ rv=drbd_send_drequest(mdev, DataRequest, bio->bi_sector, bio->bi_size,
-+ (unsigned long)req);
-+#endif
-+ return rv;
-+}
-+
-+
-+/* we may do a local read if:
-+ * - we are consistent (of course),
-+ * - or we are generally inconsistent,
-+ * BUT we are still/already IN SYNC for this area.
-+ * since size may be up to PAGE_SIZE, but BM_BLOCK_SIZE may be smaller
-+ * than PAGE_SIZE, we may need to check several bits.
-+ */
-+STATIC int drbd_may_do_local_read(drbd_dev *mdev, sector_t sector, int size)
-+{
-+ unsigned long sbnr,ebnr,bnr;
-+ sector_t esector, nr_sectors;
-+
-+ if (drbd_md_test_flag(mdev,MDF_Consistent)) return 1;
-+
-+ nr_sectors = drbd_get_capacity(mdev->this_bdev);
-+ esector = sector + (size>>9) -1;
-+
-+ D_ASSERT(sector < nr_sectors);
-+ D_ASSERT(esector < nr_sectors);
-+
-+ sbnr = BM_SECT_TO_BIT(sector);
-+ ebnr = BM_SECT_TO_BIT(esector);
-+
-+ for (bnr = sbnr; bnr <= ebnr; bnr++) {
-+ if (drbd_bm_test_bit(mdev,bnr)) return 0;
-+ }
-+ return 1;
-+}
-+
-+STATIC int
-+drbd_make_request_common(drbd_dev *mdev, int rw, int size,
-+ sector_t sector, drbd_bio_t *bio)
-+{
-+ drbd_request_t *req;
-+ int local, remote;
-+
-+ if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ /*
-+ * If someone tries to mount on Secondary, and this is a 2.4 kernel,
-+ * it would lead to a readonly mounted, but not cache-coherent,
-+ * therefore dangerous, filesystem.
-+ * On 2.6 this is prevented by bd_claiming the device.
-+ * It is not that easy in 2.4.
-+ *
-+ * Because people continue to report they mount readonly, it does not
-+ * do what they expect, and their logs fill with messages and stuff.
-+ *
-+ * Since it just won't work, we just fail IO here.
-+ * [ ... until we implement some shared mode, and our users confirm by
-+ * configuration, that they handle cache coherency themselves ... ]
-+ */
-+ if (mdev->state != Primary &&
-+ ( !disable_bd_claim || rw == WRITE ) ) {
-+ if (DRBD_ratelimit(5*HZ,5)) {
-+ ERR("Not in Primary state, no %s requests allowed\n",
-+ disable_bd_claim ? "WRITE" : "IO");
-+ }
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ /*
-+ * Paranoia: we might have been primary, but sync target, or
-+ * even diskless, then lost the connection.
-+ * This should have been handled (panic? suspend?) somehwere
-+ * else. But maybe it was not, so check again here.
-+ * Caution: as long as we do not have a read/write lock on mdev,
-+ * to serialize state changes, this is racy, since we may lose
-+ * the connection *after* we test for the cstate.
-+ */
-+ if ( ( test_bit(DISKLESS,&mdev->flags)
-+ || !drbd_md_test_flag(mdev,MDF_Consistent)
-+ ) && mdev->cstate < Connected )
-+ {
-+ ERR("Sorry, I have no access to good data anymore.\n");
-+/*
-+ FIXME suspend, loop waiting on cstate wait? panic?
-+*/
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ /* allocate outside of all locks
-+ */
-+ req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
-+ if (!req) {
-+ /* only pass the error to the upper layers.
-+ * if user cannot handle io errors, thats not our business.
-+ */
-+ ERR("could not kmalloc() req\n");
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+ SET_MAGIC(req);
-+ req->master_bio = bio;
-+
-+ // XXX maybe merge both variants into one
-+ if (rw == WRITE) drbd_req_prepare_write(mdev,req);
-+ else drbd_req_prepare_read(mdev,req);
-+
-+ /* XXX req->w.cb = something; drbd_queue_work() ....
-+ * Not yet.
-+ */
-+
-+ // down_read(mdev->device_lock);
-+
-+ wait_event( mdev->cstate_wait,
-+ (volatile int)(mdev->cstate < WFBitMapS ||
-+ mdev->cstate > WFBitMapT) );
-+
-+ local = inc_local(mdev);
-+ NOT_IN_26( if (rw == READA) rw=READ );
-+ if (rw == READ || rw == READA) {
-+ if (local) {
-+ if (!drbd_may_do_local_read(mdev,sector,size)) {
-+ /* whe could kick the syncer to
-+ * sync this extent asap, wait for
-+ * it, then continue locally.
-+ * Or just issue the request remotely.
-+ */
-+ /* FIXME
-+ * I think we have a RACE here. We request
-+ * something from the peer, then later some
-+ * write starts ... and finished *before*
-+ * the answer to the read comes in, because
-+ * the ACK for the WRITE goes over
-+ * meta-socket ...
-+ * Maybe we need to properly lock reads
-+ * against the syncer, too. But if we have
-+ * some user issuing writes on an area that
-+ * he has pending reads on, _he_ is really
-+ * broke anyways, and would get "undefined
-+ * results" on _any_ io stack, even just the
-+ * local io stack.
-+ */
-+ local = 0;
-+ dec_local(mdev);
-+ }
-+ }
-+ remote = !local && test_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ } else {
-+ remote = 1;
-+ }
-+
-+ /* If we have a disk, but a READA request is mapped to remote,
-+ * we are Primary, Inconsistent, SyncTarget.
-+ * Just fail that READA request right here.
-+ *
-+ * THINK: maybe fail all READA when not local?
-+ * or make this configurable...
-+ * if network is slow, READA won't do any good.
-+ */
-+ if (rw == READA && !test_bit(DISKLESS,&mdev->flags) && !local) {
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ if (rw == WRITE && local)
-+ drbd_al_begin_io(mdev, sector);
-+
-+ remote = remote && (mdev->cstate >= Connected)
-+ && !test_bit(PARTNER_DISKLESS,&mdev->flags);
-+
-+ if (!(local || remote)) {
-+ ERR("IO ERROR: neither local nor remote disk\n");
-+ // FIXME PANIC ??
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ /* do this first, so I do not need to call drbd_end_req,
-+ * but can set the rq_status directly.
-+ */
-+ if (!local)
-+ req->rq_status |= RQ_DRBD_LOCAL;
-+ if (!remote)
-+ req->rq_status |= RQ_DRBD_SENT;
-+
-+ /* we need to plug ALWAYS since we possibly need to kick lo_dev */
-+ drbd_plug_device(mdev);
-+
-+ inc_ap_bio(mdev);
-+ if (remote) {
-+ /* either WRITE and Connected,
-+ * or READ, and no local disk,
-+ * or READ, but not in sync.
-+ */
-+ inc_ap_pending(mdev);
-+ if (rw == WRITE) {
-+ if (!drbd_send_dblock(mdev,req)) {
-+ if (mdev->cstate >= Connected)
-+ set_cstate(mdev,NetworkFailure);
-+ dec_ap_pending(mdev);
-+ drbd_thread_restart_nowait(&mdev->receiver);
-+ } else if(mdev->conf.wire_protocol == DRBD_PROT_A) {
-+ dec_ap_pending(mdev);
-+ drbd_end_req(req, RQ_DRBD_SENT, 1, sector);
-+ }
-+ } else {
-+ // this node is diskless ...
-+ drbd_read_remote(mdev,req);
-+ }
-+ }
-+
-+ if (local) {
-+ if (rw == WRITE) {
-+ if (!remote) drbd_set_out_of_sync(mdev,sector,size);
-+ } else {
-+ D_ASSERT(!remote);
-+ }
-+ /* FIXME
-+ * Should we add even local reads to some list, so
-+ * they can be grabbed and freed somewhen?
-+ *
-+ * They already have a reference count (sort of...)
-+ * on mdev via inc_local()
-+ */
-+ if(rw == WRITE) mdev->writ_cnt += size>>9;
-+ else mdev->read_cnt += size>>9;
-+
-+ // in 2.4.X, READA are submitted as READ.
-+ drbd_generic_make_request(rw,drbd_req_private_bio(req));
-+ }
-+
-+ // up_read(mdev->device_lock);
-+ return 0;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+int drbd_make_request_24(request_queue_t *q, int rw, struct buffer_head *bh)
-+{
-+ struct Drbd_Conf* mdev = drbd_conf + MINOR(bh->b_rdev);
-+ if (MINOR(bh->b_rdev) >= minor_count || mdev->cstate < StandAlone) {
-+ buffer_IO_error(bh);
-+ return 0;
-+ }
-+
-+ return drbd_make_request_common(mdev,rw,bh->b_size,bh->b_rsector,bh);
-+}
-+#else
-+int drbd_make_request_26(request_queue_t *q, struct bio *bio)
-+{
-+ unsigned int s_enr,e_enr;
-+ struct Drbd_Conf* mdev = (drbd_dev*) q->queuedata;
-+ if (mdev->cstate < StandAlone) {
-+ drbd_bio_IO_error(bio);
-+ return 0;
-+ }
-+
-+ /*
-+ * what we "blindly" assume:
-+ */
-+ D_ASSERT(bio->bi_size > 0);
-+ D_ASSERT( (bio->bi_size & 0x1ff) == 0);
-+ D_ASSERT(bio->bi_size <= PAGE_SIZE);
-+ D_ASSERT(bio->bi_vcnt == 1);
-+ D_ASSERT(bio->bi_idx == 0);
-+
-+ s_enr = bio->bi_sector >> (AL_EXTENT_SIZE_B-9);
-+ e_enr = (bio->bi_sector+(bio->bi_size>>9)-1) >> (AL_EXTENT_SIZE_B-9);
-+ D_ASSERT(e_enr >= s_enr);
-+
-+ if(unlikely(s_enr != e_enr)) {
-+ /* This bio crosses an AL_EXTENT boundary, so we have to
-+ * split it. [So far, only XFS is known to do this...]
-+ */
-+ struct bio_pair *bp;
-+ bp = bio_split(bio, bio_split_pool,
-+ (e_enr<<(AL_EXTENT_SIZE_B-9)) - bio->bi_sector);
-+ drbd_make_request_26(q,&bp->bio1);
-+ drbd_make_request_26(q,&bp->bio2);
-+ bio_pair_release(bp);
-+ return 0;
-+ }
-+
-+ return drbd_make_request_common(mdev,bio_rw(bio),bio->bi_size,
-+ bio->bi_sector,bio);
-+}
-+#endif
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_sizeof_sanity_check.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,24 @@
-+#include <linux/drbd.h>
-+#include <linux/kernel.h>
-+
-+#define SZO(type,size) \
-+ s = sizeof(type); \
-+ if (s != size) { \
-+ printk("<3>sizeof(" #type "): %d != %d\n", s, size); \
-+ err = -1; \
-+ }
-+
-+int sizeof_drbd_structs_sanity_check(void)
-+{
-+ int err = 0, s = 0;
-+ SZO(struct disk_config, 24)
-+ SZO(struct net_config, 304)
-+ SZO(struct syncer_config, 24)
-+ SZO(struct ioctl_disk_config, 32)
-+ SZO(struct ioctl_net_config, 312)
-+ SZO(struct ioctl_syncer_config, 32)
-+ SZO(struct ioctl_wait, 16)
-+ SZO(struct ioctl_get_config, 440)
-+ if (err) printk("<3>ioctls won't work, aborting\n");
-+ return err;
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/drbd_worker.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,985 @@
-+/*
-+-*- linux-c -*-
-+ drbd_worker.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-+ authors.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/module.h>
-+#include <linux/version.h>
-+
-+#include <linux/sched.h>
-+#include <linux/smp_lock.h>
-+#include <linux/wait.h>
-+#include <linux/mm.h>
-+#include <linux/drbd_config.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
-+#include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
-+#endif
-+#include <linux/slab.h>
-+
-+#include <linux/drbd.h>
-+#include "drbd_int.h"
-+
-+/* I choose to have all block layer end_io handlers defined here.
-+
-+ * For all these callbacks, note the follwing:
-+ * The callbacks will be called in irq context by the IDE drivers,
-+ * and in Softirqs/Tasklets/BH context by the SCSI drivers.
-+ * Try to get the locking right :)
-+ *
-+ */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+
-+/* used for synchronous meta data and bitmap IO
-+ * submitted by FIXME (I'd say worker only, but currently this is not true...)
-+ */
-+void drbd_md_io_complete(struct buffer_head *bh, int uptodate)
-+{
-+ if (uptodate)
-+ set_bit(BH_Uptodate, &bh->b_state);
-+
-+ complete((struct completion*)bh->b_private);
-+}
-+
-+/* reads on behalf of the partner,
-+ * "submitted" by the receiver
-+ */
-+void enslaved_read_bi_end_io(drbd_bio_t *bh, int uptodate)
-+{
-+ unsigned long flags=0;
-+ struct Tl_epoch_entry *e=NULL;
-+ struct Drbd_Conf* mdev;
-+
-+ mdev=bh->b_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ e = container_of(bh,struct Tl_epoch_entry,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(e));
-+ D_ASSERT(e->block_id != ID_VACANT);
-+
-+ spin_lock_irqsave(&mdev->ee_lock,flags);
-+
-+ mark_buffer_uptodate(bh, uptodate);
-+ clear_bit(BH_Lock, &bh->b_state);
-+ smp_mb__after_clear_bit();
-+
-+ list_del(&e->w.list);
-+ if(list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
-+ spin_unlock_irqrestore(&mdev->ee_lock,flags);
-+
-+ drbd_chk_io_error(mdev,!uptodate);
-+ drbd_queue_work(mdev,&mdev->data.work,&e->w);
-+ dec_local(mdev);
-+}
-+
-+/* writes on behalf of the partner, or resync writes,
-+ * "submitted" by the receiver.
-+ */
-+void drbd_dio_end_sec(struct buffer_head *bh, int uptodate)
-+{
-+ unsigned long flags=0;
-+ struct Tl_epoch_entry *e=NULL;
-+ struct Drbd_Conf* mdev;
-+
-+ mdev=bh->b_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ e = container_of(bh,struct Tl_epoch_entry,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(e));
-+ D_ASSERT(e->block_id != ID_VACANT);
-+
-+ spin_lock_irqsave(&mdev->ee_lock,flags);
-+
-+ mark_buffer_uptodate(bh, uptodate);
-+
-+ clear_bit(BH_Dirty, &bh->b_state);
-+ clear_bit(BH_Lock, &bh->b_state);
-+ smp_mb__after_clear_bit();
-+
-+ list_del(&e->w.list);
-+ list_add_tail(&e->w.list,&mdev->done_ee);
-+
-+ if (waitqueue_active(&mdev->ee_wait) &&
-+ (list_empty(&mdev->active_ee) ||
-+ list_empty(&mdev->sync_ee)))
-+ wake_up(&mdev->ee_wait);
-+
-+ spin_unlock_irqrestore(&mdev->ee_lock,flags);
-+
-+ drbd_chk_io_error(mdev,!uptodate);
-+ wake_asender(mdev);
-+ dec_local(mdev);
-+}
-+
-+/* writes on Primary comming from drbd_make_request
-+ */
-+void drbd_dio_end(struct buffer_head *bh, int uptodate)
-+{
-+ struct Drbd_Conf* mdev;
-+ drbd_request_t *req;
-+
-+ mdev = bh->b_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ req = container_of(bh,struct drbd_request,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(req));
-+
-+ drbd_chk_io_error(mdev,!uptodate);
-+ drbd_end_req(req, RQ_DRBD_LOCAL, uptodate, drbd_req_get_sector(req));
-+ drbd_al_complete_io(mdev,drbd_req_get_sector(req));
-+ dec_local(mdev);
-+}
-+
-+/* reads on Primary comming from drbd_make_request
-+ */
-+void drbd_read_bi_end_io(struct buffer_head *bh, int uptodate)
-+{
-+ struct Drbd_Conf* mdev;
-+ drbd_request_t *req;
-+
-+ mdev = bh->b_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ req = container_of(bh,struct drbd_request,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(req));
-+
-+ // no special case for READA here, in 2.4.X we submit them as READ.
-+ if (!uptodate) {
-+ // for the panic:
-+ drbd_chk_io_error(mdev,!uptodate); // handle panic and detach.
-+ if(mdev->on_io_error == PassOn) goto pass_on;
-+ // ok, if we survived this, retry:
-+ // FIXME sector ...
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("local read failed, retrying remotely\n");
-+ req->w.cb = w_read_retry_remote;
-+ drbd_queue_work(mdev,&mdev->data.work,&req->w);
-+ } else {
-+ pass_on:
-+ req->master_bio->b_end_io(req->master_bio,uptodate);
-+ dec_ap_bio(mdev);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+ }
-+ dec_local(mdev);
-+}
-+
-+#else
-+
-+/* used for synchronous meta data and bitmap IO
-+ * submitted by drbd_md_sync_page_io()
-+ */
-+int drbd_md_io_complete(struct bio *bio, unsigned int bytes_done, int error)
-+{
-+ if (bio->bi_size)
-+ return 1;
-+
-+ complete((struct completion*)bio->bi_private);
-+ return 0;
-+}
-+
-+/* reads on behalf of the partner,
-+ * "submitted" by the receiver
-+ */
-+int enslaved_read_bi_end_io(struct bio *bio, unsigned int bytes_done, int error)
-+{
-+ unsigned long flags=0;
-+ struct Tl_epoch_entry *e=NULL;
-+ struct Drbd_Conf* mdev;
-+
-+ mdev=bio->bi_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ /* we should be called via bio_endio, so this should never be the case
-+ * but "everyone else does it", and so do we ;) -lge
-+ */
-+ ERR_IF (bio->bi_size)
-+ return 1;
-+
-+ e = container_of(bio,struct Tl_epoch_entry,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(e));
-+ D_ASSERT(e->block_id != ID_VACANT);
-+
-+ spin_lock_irqsave(&mdev->ee_lock,flags);
-+ list_del(&e->w.list);
-+ if(list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
-+ spin_unlock_irqrestore(&mdev->ee_lock,flags);
-+
-+ drbd_chk_io_error(mdev,error);
-+ drbd_queue_work(mdev,&mdev->data.work,&e->w);
-+ dec_local(mdev);
-+ return 0;
-+}
-+
-+/* writes on behalf of the partner, or resync writes,
-+ * "submitted" by the receiver.
-+ */
-+int drbd_dio_end_sec(struct bio *bio, unsigned int bytes_done, int error)
-+{
-+ unsigned long flags=0;
-+ struct Tl_epoch_entry *e=NULL;
-+ struct Drbd_Conf* mdev;
-+
-+ mdev=bio->bi_private;
-+ PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-+
-+ // see above
-+ ERR_IF (bio->bi_size)
-+ return 1;
-+
-+ e = container_of(bio,struct Tl_epoch_entry,private_bio);
-+ PARANOIA_BUG_ON(!VALID_POINTER(e));
-+ D_ASSERT(e->block_id != ID_VACANT);
-+
-+ spin_lock_irqsave(&mdev->ee_lock,flags);
-+ list_del(&e->w.list);
-+ list_add_tail(&e->w.list,&mdev->done_ee);
-+
-+ if (waitqueue_active(&mdev->ee_wait) &&
-+ (list_empty(&mdev->active_ee) ||
-+ list_empty(&mdev->sync_ee)))
-+ wake_up(&mdev->ee_wait);
-+
-+ spin_unlock_irqrestore(&mdev->ee_lock,flags);
-+
-+ drbd_chk_io_error(mdev,error);
-+ wake_asender(mdev);
-+ dec_local(mdev);
-+ return 0;
-+}
-+
-+/* writes on Primary comming from drbd_make_request
-+ */
-+int drbd_dio_end(struct bio *bio, unsigned int bytes_done, int error)
-+{
-+ drbd_request_t *req=bio->bi_private;
-+ struct Drbd_Conf* mdev=req->mdev;
-+ sector_t rsector;
-+
-+ // see above
-+ ERR_IF (bio->bi_size)
-+ return 1;
-+
-+ drbd_chk_io_error(mdev,error);
-+ rsector = drbd_req_get_sector(req);
-+ // the bi_sector of the bio gets modified somewhere in drbd_end_req()!
-+ drbd_end_req(req, RQ_DRBD_LOCAL, (error == 0), rsector);
-+ drbd_al_complete_io(mdev,rsector);
-+ dec_local(mdev);
-+ bio_put(bio);
-+ return 0;
-+}
-+
-+/* reads on Primary comming from drbd_make_request
-+ */
-+int drbd_read_bi_end_io(struct bio *bio, unsigned int bytes_done, int error)
-+{
-+ drbd_request_t *req=bio->bi_private;
-+ struct Drbd_Conf* mdev=req->mdev;
-+
-+ // see above
-+ ERR_IF (bio->bi_size)
-+ return 1;
-+
-+ /* READAs may fail.
-+ * upper layers need to be able to handle that themselves */
-+ if (bio_rw(bio) == READA) goto pass_on;
-+ if (error) {
-+ drbd_chk_io_error(mdev,error); // handle panic and detach.
-+ if(mdev->on_io_error == PassOn) goto pass_on;
-+ // ok, if we survived this, retry:
-+ // FIXME sector ...
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("local read failed, retrying remotely\n");
-+ req->w.cb = w_read_retry_remote;
-+ drbd_queue_work(mdev,&mdev->data.work,&req->w);
-+ } else {
-+ pass_on:
-+ bio_endio(req->master_bio,req->master_bio->bi_size,error);
-+ dec_ap_bio(mdev);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+ }
-+
-+ bio_put(bio);
-+ dec_local(mdev);
-+ return 0;
-+}
-+#endif
-+
-+int w_io_error(drbd_dev* mdev, struct drbd_work* w,int cancel)
-+{
-+ drbd_request_t *req = (drbd_request_t*)w;
-+ int ok;
-+
-+ /* FIXME send a "set_out_of_sync" packet to the peer
-+ * in the PassOn case...
-+ * in the Detach (or Panic) case, we (try to) send
-+ * a "we are diskless" param packet anyways, and the peer
-+ * will then set the FullSync bit in the meta data ...
-+ */
-+ D_ASSERT(mdev->on_io_error != PassOn);
-+
-+ INVALIDATE_MAGIC(req);
-+ mempool_free(req,drbd_request_mempool);
-+
-+ if(unlikely(cancel)) return 1;
-+
-+ ok = drbd_io_error(mdev);
-+ if(unlikely(!ok)) ERR("Sending in w_io_error() failed\n");
-+ return ok;
-+}
-+
-+int w_read_retry_remote(drbd_dev* mdev, struct drbd_work* w,int cancel)
-+{
-+ drbd_request_t *req = (drbd_request_t*)w;
-+ int ok;
-+
-+ smp_rmb();
-+ if ( cancel ||
-+ mdev->cstate < Connected ||
-+ !test_bit(PARTNER_CONSISTENT,&mdev->flags) ) {
-+ drbd_panic("WE ARE LOST. Local IO failure, no peer.\n");
-+
-+ // does not make much sense, but anyways...
-+ drbd_bio_endio(req->master_bio,0);
-+ dec_ap_bio(mdev);
-+ mempool_free(req,drbd_request_mempool);
-+ return 1;
-+ }
-+
-+ // FIXME: what if partner was SyncTarget, and is out of sync for
-+ // this area ?? ... should be handled in the receiver.
-+
-+ ok = drbd_io_error(mdev);
-+ if(unlikely(!ok)) ERR("Sending in w_read_retry_remote() failed\n");
-+
-+ inc_ap_pending(mdev);
-+ ok = drbd_read_remote(mdev,req);
-+ if(unlikely(!ok)) {
-+ ERR("drbd_read_remote() failed\n");
-+ /* dec_ap_pending and bio_io_error are done in
-+ * drbd_fail_pending_reads
-+ */
-+ }
-+ return ok;
-+}
-+
-+int w_resync_inactive(drbd_dev *mdev, struct drbd_work *w, int cancel)
-+{
-+ ERR_IF(cancel) return 1;
-+ ERR("resync inactive, but callback triggered??\n");
-+ return 0;
-+}
-+
-+/* FIXME
-+ * not used any longer, they now use e_end_resync_block.
-+ * maybe remove again?
-+ */
-+int w_is_resync_read(drbd_dev *mdev, struct drbd_work *w, int unused)
-+{
-+ ERR("%s: Typecheck only, should never be called!\n", __FUNCTION__ );
-+ return 0;
-+}
-+
-+/* in case we need it. currently unused,
-+ * since should be assigned to "w_read_retry_remote"
-+ */
-+int w_is_app_read(drbd_dev *mdev, struct drbd_work *w, int unused)
-+{
-+ ERR("%s: Typecheck only, should never be called!\n", __FUNCTION__ );
-+ return 0;
-+}
-+
-+void resync_timer_fn(unsigned long data)
-+{
-+ unsigned long flags;
-+ drbd_dev* mdev = (drbd_dev*) data;
-+
-+ spin_lock_irqsave(&mdev->req_lock,flags);
-+
-+ if(likely(!test_and_clear_bit(STOP_SYNC_TIMER,&mdev->flags))) {
-+ mdev->resync_work.cb = w_make_resync_request;
-+ } else {
-+ mdev->resync_work.cb = w_resume_next_sg;
-+ }
-+
-+ if(list_empty(&mdev->resync_work.list)) {
-+ _drbd_queue_work(&mdev->data.work,&mdev->resync_work);
-+ } else INFO("Avoided requeue of resync_work\n");
-+
-+ spin_unlock_irqrestore(&mdev->req_lock,flags);
-+}
-+
-+#define SLEEP_TIME (HZ/10)
-+
-+int w_make_resync_request(drbd_dev* mdev, struct drbd_work* w,int cancel)
-+{
-+ unsigned long bit;
-+ sector_t sector;
-+ const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
-+ int number,i,size;
-+
-+ PARANOIA_BUG_ON(w != &mdev->resync_work);
-+
-+ if(unlikely(cancel)) return 1;
-+
-+ if(unlikely(mdev->cstate < Connected)) {
-+ ERR("Confused in w_make_resync_request()! cstate < Connected");
-+ return 0;
-+ }
-+
-+ if (mdev->cstate != SyncTarget) {
-+ ERR("%s in w_make_resync_request\n", cstate_to_name(mdev->cstate));
-+ }
-+
-+ number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
-+
-+ if (atomic_read(&mdev->rs_pending_cnt)>number) {
-+ goto requeue;
-+ }
-+ number -= atomic_read(&mdev->rs_pending_cnt);
-+
-+ for(i=0;i<number;i++) {
-+
-+ next_sector:
-+ size = BM_BLOCK_SIZE;
-+ bit = drbd_bm_find_next(mdev);
-+
-+ if (bit == -1UL) {
-+ /* FIXME either test_and_set some bit,
-+ * or make this the _only_ place that is allowed
-+ * to assign w_resync_inactive! */
-+ mdev->resync_work.cb = w_resync_inactive;
-+ return 1;
-+ }
-+
-+ sector = BM_BIT_TO_SECT(bit);
-+
-+ if(!drbd_rs_begin_io(mdev,sector)) {
-+ // we have been interrupted, probably connection lost!
-+ D_ASSERT(signal_pending(current));
-+ return 0;
-+ }
-+
-+ if(unlikely( drbd_bm_test_bit(mdev,bit) == 0 )) {
-+ //INFO("Block got synced while in drbd_rs_begin_io()\n");
-+ drbd_rs_complete_io(mdev,sector);
-+ goto next_sector;
-+ }
-+
-+ if (sector + (size>>9) > capacity) size = (capacity-sector)<<9;
-+ inc_rs_pending(mdev);
-+ if(!drbd_send_drequest(mdev,RSDataRequest,
-+ sector,size,ID_SYNCER)) {
-+ ERR("drbd_send_drequest() failed, aborting...");
-+ dec_rs_pending(mdev);
-+ return 0; // FAILED. worker will abort!
-+ }
-+ }
-+
-+ if(drbd_bm_rs_done(mdev)) {
-+ /* last syncer _request_ was sent,
-+ * but the RSDataReply not yet received. sync will end (and
-+ * next sync group will resume), as soon as we receive the last
-+ * resync data block, and the last bit is cleared.
-+ * until then resync "work" is "inactive" ...
-+ */
-+ mdev->resync_work.cb = w_resync_inactive;
-+ return 1;
-+ }
-+
-+ requeue:
-+ mod_timer(&mdev->resync_timer, jiffies + SLEEP_TIME);
-+ return 1;
-+}
-+
-+int drbd_resync_finished(drbd_dev* mdev)
-+{
-+ unsigned long db,dt,dbdt;
-+
-+ dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-+ if (dt <= 0) dt=1;
-+ db = mdev->rs_total;
-+ dbdt = Bit2KB(db/dt);
-+ mdev->rs_paused /= HZ;
-+ INFO("Resync done (total %lu sec; paused %lu sec; %lu K/sec)\n",
-+ dt + mdev->rs_paused, mdev->rs_paused, dbdt);
-+
-+ if (mdev->cstate == SyncTarget || mdev->cstate == PausedSyncT) {
-+ drbd_md_set_flag(mdev,MDF_Consistent);
-+ ERR_IF(drbd_md_test_flag(mdev,MDF_FullSync))
-+ drbd_md_clear_flag(mdev,MDF_FullSync);
-+ drbd_md_write(mdev);
-+ } else if (mdev->cstate == SyncSource || mdev->cstate == PausedSyncS) {
-+ set_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ } else {
-+ ERR("unexpected cstate (%s) in drbd_resync_finished\n",
-+ cstate_to_name(mdev->cstate));
-+ }
-+
-+ // assert that all bit-map parts are cleared.
-+ D_ASSERT(list_empty(&mdev->resync->lru));
-+ D_ASSERT(drbd_bm_total_weight(mdev) == 0);
-+ mdev->rs_total = 0;
-+ mdev->rs_paused = 0;
-+
-+ set_cstate(mdev,Connected);
-+
-+ return 1;
-+}
-+
-+int w_e_end_data_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
-+{
-+ struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
-+ int ok;
-+
-+ if(unlikely(cancel)) {
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ dec_unacked(mdev);
-+ return 1;
-+ }
-+
-+ if(likely(drbd_bio_uptodate(&e->private_bio))) {
-+ ok=drbd_send_block(mdev, DataReply, e);
-+ } else {
-+ ok=drbd_send_ack(mdev,NegDReply,e);
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Sending NegDReply. I guess it gets messy.\n");
-+ drbd_io_error(mdev);
-+ }
-+
-+ dec_unacked(mdev);
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ if( page_count(drbd_bio_get_page(&e->private_bio)) > 1 ) {
-+ /* This might happen if sendpage() has not finished */
-+ list_add_tail(&e->w.list,&mdev->net_ee);
-+ } else {
-+ drbd_put_ee(mdev,e);
-+ }
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ if(unlikely(!ok)) ERR("drbd_send_block() failed\n");
-+ return ok;
-+}
-+
-+int w_e_end_rsdata_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
-+{
-+ struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
-+ int ok;
-+
-+ if(unlikely(cancel)) {
-+ spin_lock_irq(&mdev->ee_lock);
-+ drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
-+ dec_unacked(mdev);
-+ return 1;
-+ }
-+
-+ drbd_rs_complete_io(mdev,drbd_ee_get_sector(e));
-+
-+ if(likely(drbd_bio_uptodate(&e->private_bio))) {
-+ if (likely( !test_bit(PARTNER_DISKLESS,&mdev->flags) )) {
-+ inc_rs_pending(mdev);
-+ ok=drbd_send_block(mdev, RSDataReply, e);
-+ } else {
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Not sending RSDataReply, partner DISKLESS!\n");
-+ ok=1;
-+ }
-+ } else {
-+ ok=drbd_send_ack(mdev,NegRSDReply,e);
-+ if (DRBD_ratelimit(5*HZ,5))
-+ ERR("Sending NegDReply. I guess it gets messy.\n");
-+ drbd_io_error(mdev);
-+ }
-+
-+ dec_unacked(mdev);
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ if( page_count(drbd_bio_get_page(&e->private_bio)) > 1 ) {
-+ /* This might happen if sendpage() has not finished */
-+ list_add_tail(&e->w.list,&mdev->net_ee);
-+ } else {
-+ drbd_put_ee(mdev,e);
-+ }
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ if(unlikely(!ok)) ERR("drbd_send_block() failed\n");
-+ return ok;
-+}
-+
-+int w_try_send_barrier(drbd_dev *mdev, struct drbd_work *w, int cancel)
-+{
-+ int ok=1;
-+
-+ if(unlikely(cancel)) return ok;
-+
-+ down(&mdev->data.mutex);
-+ if(test_and_clear_bit(ISSUE_BARRIER,&mdev->flags)) {
-+ ok = _drbd_send_barrier(mdev);
-+ }
-+ up(&mdev->data.mutex);
-+
-+ return ok;
-+}
-+
-+int w_send_write_hint(drbd_dev *mdev, struct drbd_work *w, int cancel)
-+{
-+ if (cancel) return 1;
-+ NOT_IN_26(clear_bit(UNPLUG_QUEUED,&mdev->flags));
-+ return drbd_send_short_cmd(mdev,UnplugRemote);
-+}
-+
-+STATIC void drbd_global_lock(void)
-+{
-+ int i;
-+
-+ local_irq_disable();
-+ for (i=0; i < minor_count; i++) {
-+ spin_lock(&drbd_conf[i].req_lock);
-+ }
-+}
-+
-+STATIC void drbd_global_unlock(void)
-+{
-+ int i;
-+
-+ for (i=0; i < minor_count; i++) {
-+ spin_unlock(&drbd_conf[i].req_lock);
-+ }
-+ local_irq_enable();
-+}
-+
-+STATIC void _drbd_rs_resume(drbd_dev *mdev)
-+{
-+ Drbd_CState ns;
-+
-+ ns = mdev->cstate - (PausedSyncS - SyncSource);
-+ D_ASSERT(ns == SyncSource || ns == SyncTarget);
-+
-+ INFO("Syncer continues.\n");
-+ mdev->rs_paused += (long)jiffies-(long)mdev->rs_mark_time;
-+ _set_cstate(mdev,ns);
-+
-+ if(mdev->cstate == SyncTarget) {
-+ ERR_IF(test_bit(STOP_SYNC_TIMER,&mdev->flags)) {
-+ unsigned long rs_left = drbd_bm_total_weight(mdev);
-+ clear_bit(STOP_SYNC_TIMER,&mdev->flags);
-+ if (rs_left == 0) {
-+ INFO("rs_left==0 in _drbd_rs_resume\n");
-+ } else {
-+ ERR("STOP_SYNC_TIMER was set in "
-+ "_drbd_rs_resume, but rs_left still %lu\n",
-+ rs_left);
-+ }
-+ }
-+ mod_timer(&mdev->resync_timer,jiffies);
-+ }
-+}
-+
-+
-+STATIC void _drbd_rs_pause(drbd_dev *mdev)
-+{
-+ Drbd_CState ns;
-+
-+ D_ASSERT(mdev->cstate == SyncSource || mdev->cstate == SyncTarget);
-+ ns = mdev->cstate + (PausedSyncS - SyncSource);
-+
-+ if(mdev->cstate == SyncTarget) set_bit(STOP_SYNC_TIMER,&mdev->flags);
-+
-+ mdev->rs_mark_time = jiffies;
-+ // mdev->rs_mark_left = drbd_bm_total_weight(mdev); // I don't care...
-+ _set_cstate(mdev,ns);
-+ INFO("Syncer waits for sync group.\n");
-+}
-+
-+STATIC int _drbd_pause_higher_sg(drbd_dev *mdev)
-+{
-+ drbd_dev *odev;
-+ int i,rv=0;
-+
-+ for (i=0; i < minor_count; i++) {
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group > mdev->sync_conf.group
-+ && ( odev->cstate == SyncSource ||
-+ odev->cstate == SyncTarget ) ) {
-+ _drbd_rs_pause(odev);
-+ rv = 1;
-+ }
-+ }
-+
-+ return rv;
-+}
-+
-+STATIC int _drbd_lower_sg_running(drbd_dev *mdev)
-+{
-+ drbd_dev *odev;
-+ int i,rv=0;
-+
-+ for (i=0; i < minor_count; i++) {
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group < mdev->sync_conf.group
-+ && ( odev->cstate == SyncSource ||
-+ odev->cstate == SyncTarget ) ) {
-+ rv = 1;
-+ }
-+ }
-+
-+ return rv;
-+}
-+
-+STATIC int _drbd_resume_lower_sg(drbd_dev *mdev)
-+{
-+ drbd_dev *odev;
-+ int i,rv=0;
-+
-+ for (i=0; i < minor_count; i++) {
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group < mdev->sync_conf.group
-+ && ( odev->cstate == PausedSyncS ||
-+ odev->cstate == PausedSyncT ) ) {
-+ _drbd_rs_resume(odev);
-+ rv = 1;
-+ }
-+ }
-+
-+ return rv;
-+}
-+
-+int w_resume_next_sg(drbd_dev* mdev, struct drbd_work* w, int unused)
-+{
-+ drbd_dev *odev;
-+ int i,ng=10000;
-+
-+ PARANOIA_BUG_ON(w != &mdev->resync_work);
-+
-+ drbd_global_lock();
-+
-+ for (i=0; i < minor_count; i++) {
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group <= mdev->sync_conf.group
-+ && ( odev->cstate == SyncSource ||
-+ odev->cstate == SyncTarget ) ) {
-+ goto out; // Sync on an other device in this group
-+ // or a lower group still runs.
-+ }
-+ }
-+
-+ for (i=0; i < minor_count; i++) { // find next sync group
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group > mdev->sync_conf.group
-+ && odev->sync_conf.group < ng &&
-+ (odev->cstate==PausedSyncS || odev->cstate==PausedSyncT)){
-+ ng = odev->sync_conf.group;
-+ }
-+ }
-+
-+ for (i=0; i < minor_count; i++) { // resume all devices in next group
-+ odev = drbd_conf + i;
-+ if ( odev->sync_conf.group == ng &&
-+ (odev->cstate==PausedSyncS || odev->cstate==PausedSyncT)){
-+ _drbd_rs_resume(odev);
-+ }
-+ }
-+
-+ out:
-+ drbd_global_unlock();
-+ w->cb = w_resync_inactive;
-+
-+ return 1;
-+}
-+
-+void drbd_alter_sg(drbd_dev *mdev, int ng)
-+{
-+ int c = 0, p = 0;
-+ int d = (ng - mdev->sync_conf.group);
-+
-+ drbd_global_lock();
-+ mdev->sync_conf.group = ng;
-+
-+ if( ( mdev->cstate == PausedSyncS ||
-+ mdev->cstate == PausedSyncT ) && ( d < 0 ) ) {
-+ if(_drbd_pause_higher_sg(mdev)) c=1;
-+ else if(!_drbd_lower_sg_running(mdev)) c=1;
-+ if(c) _drbd_rs_resume(mdev);
-+ }
-+
-+ if( ( mdev->cstate == SyncSource ||
-+ mdev->cstate == SyncTarget ) && ( d > 0 ) ) {
-+ if(_drbd_resume_lower_sg(mdev)) p=1;
-+ else if(_drbd_lower_sg_running(mdev)) p=1;
-+ if(p) _drbd_rs_pause(mdev);
-+ }
-+ drbd_global_unlock();
-+}
-+
-+void drbd_start_resync(drbd_dev *mdev, Drbd_CState side)
-+{
-+ if(side == SyncTarget) {
-+ drbd_md_clear_flag(mdev,MDF_Consistent);
-+ drbd_bm_reset_find(mdev);
-+ } else if (side == SyncSource) {
-+ clear_bit(PARTNER_CONSISTENT, &mdev->flags);
-+ /* If we are SyncSource we must be consistent.
-+ * FIXME this should be an assertion only,
-+ * otherwise it masks a logic bug somewhere else...
-+ */
-+ ERR_IF (!drbd_md_test_flag(mdev,MDF_Consistent)) {
-+ // FIXME this is actually a BUG()!
-+ drbd_md_set_flag(mdev,MDF_Consistent);
-+ }
-+ } else {
-+ ERR("Usage error in drbd_start_resync! (side == %s)\n",
-+ cstate_to_name(side));
-+ return;
-+ }
-+ drbd_md_write(mdev);
-+
-+ set_cstate(mdev,side);
-+ mdev->rs_total =
-+ mdev->rs_mark_left = drbd_bm_total_weight(mdev);
-+ mdev->rs_paused = 0;
-+ mdev->rs_start =
-+ mdev->rs_mark_time = jiffies;
-+
-+ INFO("Resync started as %s (need to sync %lu KB [%lu bits set]).\n",
-+ cstate_to_name(side),
-+ (unsigned long) mdev->rs_total << (BM_BLOCK_SIZE_B-10),
-+ (unsigned long) mdev->rs_total);
-+
-+ // FIXME: this was a PARANOIA_BUG_ON, but it triggered! ??
-+ if (mdev->resync_work.cb != w_resync_inactive) {
-+ if (mdev->resync_work.cb == w_make_resync_request)
-+ ERR("resync_work.cb == w_make_resync_request, should be w_resync_inactive\n");
-+ else if (mdev->resync_work.cb == w_resume_next_sg)
-+ ERR("resync_work.cb == w_resume_next_sg, should be w_resync_inactive\n");
-+ else
-+ ERR("resync_work.cb == %p ???, should be w_resync_inactive\n",
-+ mdev->resync_work.cb);
-+ return;
-+ }
-+
-+ if ( mdev->rs_total == 0 ) {
-+ drbd_resync_finished(mdev);
-+ return;
-+ }
-+
-+ drbd_global_lock();
-+ if (mdev->cstate == SyncTarget || mdev->cstate == SyncSource) {
-+ _drbd_pause_higher_sg(mdev);
-+ if(_drbd_lower_sg_running(mdev)) {
-+ _drbd_rs_pause(mdev);
-+ }
-+ } /* else:
-+ * thread of other mdev already paused us,
-+ * or something very strange happend to our cstate!
-+ * I really hate it that we can't have a consistent view of cstate.
-+ */
-+ drbd_global_unlock();
-+
-+ if (mdev->cstate == SyncTarget) {
-+ D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
-+ mod_timer(&mdev->resync_timer,jiffies);
-+ } else if (mdev->cstate == PausedSyncT) {
-+ D_ASSERT(test_bit(STOP_SYNC_TIMER,&mdev->flags));
-+ clear_bit(STOP_SYNC_TIMER,&mdev->flags);
-+ }
-+}
-+
-+int drbd_worker(struct Drbd_thread *thi)
-+{
-+ drbd_dev *mdev = thi->mdev;
-+ struct drbd_work *w = 0;
-+ LIST_HEAD(work_list);
-+ int intr,i;
-+
-+ sprintf(current->comm, "drbd%d_worker", (int)(mdev-drbd_conf));
-+
-+ for (;;) {
-+ intr = down_interruptible(&mdev->data.work.s);
-+
-+ if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
-+ drbd_suicide();
-+ }
-+
-+ if (intr) {
-+ D_ASSERT(intr == -EINTR);
-+ drbd_flush_signals(current);
-+ ERR_IF (get_t_state(thi) == Running)
-+ continue;
-+ break;
-+ }
-+
-+ if (get_t_state(thi) != Running) break;
-+ /* With this break, we have done an down() but not consumed
-+ the entry from the list. The cleanup code takes care of
-+ this... */
-+
-+ w = 0;
-+ spin_lock_irq(&mdev->req_lock);
-+ D_ASSERT(!list_empty(&mdev->data.work.q));
-+ w = list_entry(mdev->data.work.q.next,struct drbd_work,list);
-+ list_del_init(&w->list);
-+ spin_unlock_irq(&mdev->req_lock);
-+
-+ if(!w->cb(mdev,w, mdev->cstate < Connected )) {
-+ //WARN("worker: a callback failed! \n");
-+ if (mdev->cstate >= Connected)
-+ set_cstate(mdev,NetworkFailure);
-+ drbd_thread_restart_nowait(&mdev->receiver);
-+ }
-+ }
-+
-+ drbd_wait_ee(mdev,&mdev->read_ee);
-+
-+ i = 0;
-+ spin_lock_irq(&mdev->req_lock);
-+ again:
-+ list_splice_init(&mdev->data.work.q,&work_list);
-+ spin_unlock_irq(&mdev->req_lock);
-+
-+ while(!list_empty(&work_list)) {
-+ w = list_entry(work_list.next, struct drbd_work,list);
-+ list_del_init(&w->list);
-+ w->cb(mdev,w,1);
-+ i++;
-+ }
-+
-+ spin_lock_irq(&mdev->req_lock);
-+ ERR_IF(!list_empty(&mdev->data.work.q))
-+ goto again;
-+ sema_init(&mdev->data.work.s,0);
-+ spin_unlock_irq(&mdev->req_lock);
-+
-+ INFO("worker terminated\n");
-+
-+ return 0;
-+}
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/hlist.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,129 @@
-+#ifndef HLIST_HEAD_INIT
-+#ifndef HLIST_H
-+#define HLIST_H
-+
-+#ifdef REDHAT_HLIST_BACKPORT
-+#undef hlist_node
-+#undef hlist_head
-+#undef HLIST_HEAD
-+#undef INIT_HLIST_HEAD
-+#undef hlist_empty
-+#undef hlist_del_init
-+#undef hlist_entry
-+#undef hlist_add_head
-+#undef hlist_for_each
-+#undef hlist_for_each_safe
-+#endif
-+
-+// from linux-2.6.x linux/list.h
-+// I copied only the part which actually is used in lru_cache.h
-+
-+// ok, this is from linux/kernel.h
-+/**
-+ * container_of - cast a member of a structure out to the containing structure
-+ *
-+ * @ptr: the pointer to the member.
-+ * @type: the type of the container struct this is embedded in.
-+ * @member: the name of the member within the struct.
-+ *
-+ */
-+#define container_of(ptr, type, member) ({ \
-+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
-+ (type *)( (char *)__mptr - offsetof(type,member) );})
-+
-+/*
-+ * Double linked lists with a single pointer list head.
-+ * Mostly useful for hash tables where the two pointer list head is
-+ * too wasteful.
-+ * You lose the ability to access the tail in O(1).
-+ */
-+
-+struct hlist_node {
-+ struct hlist_node *next, **pprev;
-+};
-+
-+struct hlist_head {
-+ struct hlist_node *first;
-+};
-+
-+
-+#define HLIST_HEAD_INIT { .first = NULL }
-+#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
-+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
-+#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL)
-+
-+static __inline__ int hlist_unhashed(const struct hlist_node *h)
-+{
-+ return !h->pprev;
-+}
-+
-+static __inline__ int hlist_empty(const struct hlist_head *h)
-+{
-+ return !h->first;
-+}
-+
-+static __inline__ void __hlist_del(struct hlist_node *n)
-+{
-+ struct hlist_node *next = n->next;
-+ struct hlist_node **pprev = n->pprev;
-+ *pprev = next;
-+ if (next)
-+ next->pprev = pprev;
-+}
-+
-+#ifndef LIST_POISON1
-+#define LIST_POISON1 ((void *) 0x00100100)
-+#define LIST_POISON2 ((void *) 0x00200200)
-+#endif
-+
-+static __inline__ void hlist_del(struct hlist_node *n)
-+{
-+ __hlist_del(n);
-+ n->next = LIST_POISON1;
-+ n->pprev = LIST_POISON2;
-+}
-+
-+static __inline__ void hlist_del_init(struct hlist_node *n)
-+{
-+ if (n->pprev) {
-+ __hlist_del(n);
-+ INIT_HLIST_NODE(n);
-+ }
-+}
-+
-+static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
-+{
-+ struct hlist_node *first = h->first;
-+ n->next = first;
-+ if (first)
-+ first->pprev = &n->next;
-+ h->first = n;
-+ n->pprev = &h->first;
-+}
-+
-+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-+
-+/* Cannot easily do prefetch unfortunately */
-+#define hlist_for_each(pos, head) \
-+ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
-+ pos = pos->next)
-+
-+#define hlist_for_each_safe(pos, n, head) \
-+ for (pos = (head)->first; n = pos ? pos->next : 0, pos; \
-+ pos = n)
-+
-+/**
-+ * hlist_for_each_entry - iterate over list of given type
-+ * @tpos: the type * to use as a loop counter.
-+ * @pos: the &struct hlist_node to use as a loop counter.
-+ * @head: the head for your list.
-+ * @member: the name of the hlist_node within the struct.
-+ */
-+#define hlist_for_each_entry(tpos, pos, head, member) \
-+ for (pos = (head)->first; \
-+ pos && ({ prefetch(pos->next); 1;}) && \
-+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-+ pos = pos->next)
-+
-+#endif
-+#endif
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/lru_cache.c 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,289 @@
-+/*
-+-*- linux-c -*-
-+ lru_cache.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-+ authors.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+#include <linux/compiler.h> // for likely()
-+#include <linux/bitops.h>
-+#include <linux/vmalloc.h>
-+#include <linux/string.h> // for memset
-+#include "lru_cache.h"
-+
-+#define STATIC static
-+
-+// this is developers aid only!
-+#define PARANOIA_ENTRY() BUG_ON(test_and_set_bit(__LC_PARANOIA,&lc->flags))
-+#define PARANOIA_LEAVE() do { clear_bit(__LC_PARANOIA,&lc->flags); smp_mb__after_clear_bit(); } while (0)
-+#define RETURN(x...) do { PARANOIA_LEAVE(); return x ; } while (0)
-+
-+/**
-+ * lc_alloc: allocates memory for @e_count objects of @e_size bytes plus the
-+ * struct lru_cache, and the hash table slots.
-+ * returns pointer to a newly initialized lru_cache object with said parameters.
-+ */
-+struct lru_cache* lc_alloc(unsigned int e_count, size_t e_size,
-+ void *private_p)
-+{
-+ unsigned long bytes;
-+ struct lru_cache *lc;
-+ struct lc_element *e;
-+ int i;
-+
-+ BUG_ON(!e_count);
-+ e_size = max(sizeof(struct lc_element),e_size);
-+ bytes = e_size+sizeof(struct hlist_head);
-+ bytes *= e_count;
-+ bytes += sizeof(struct lru_cache);
-+ lc = vmalloc(bytes);
-+ memset(lc, 0, bytes);
-+ if (lc) {
-+ INIT_LIST_HEAD(&lc->in_use);
-+ INIT_LIST_HEAD(&lc->lru);
-+ INIT_LIST_HEAD(&lc->free);
-+ lc->element_size = e_size;
-+ lc->nr_elements = e_count;
-+ lc->new_number = -1;
-+ lc->lc_private = private_p;
-+ for(i=0;i<e_count;i++) {
-+ e = lc_entry(lc,i);
-+ e->lc_number = LC_FREE;
-+ list_add(&e->list,&lc->free);
-+ // memset(,0,) did the rest of init for us
-+ }
-+ }
-+ return lc;
-+}
-+
-+/**
-+ * lc_free: Frees memory allocated by lc_alloc.
-+ * @lc: The lru_cache object
-+ */
-+void lc_free(struct lru_cache* lc)
-+{
-+ vfree(lc);
-+}
-+
-+static unsigned int lc_hash_fn(struct lru_cache* lc, unsigned int enr)
-+{
-+ return enr % lc->nr_elements;
-+}
-+
-+
-+/**
-+ * lc_find: Returns the pointer to an element, if the element is present
-+ * in the hash table. In case it is not this function returns NULL.
-+ * @lc: The lru_cache object
-+ * @enr: element number
-+ */
-+struct lc_element* lc_find(struct lru_cache* lc, unsigned int enr)
-+{
-+ struct hlist_node *n;
-+ struct lc_element *e;
-+
-+ BUG_ON(!lc);
-+ BUG_ON(!lc->nr_elements);
-+ hlist_for_each_entry(e, n, lc->slot + lc_hash_fn(lc, enr), colision) {
-+ if (e->lc_number == enr) return e;
-+ }
-+ return NULL;
-+}
-+
-+STATIC struct lc_element * lc_evict(struct lru_cache* lc)
-+{
-+ struct list_head *n;
-+ struct lc_element *e;
-+
-+ if (list_empty(&lc->lru)) return 0;
-+
-+ n=lc->lru.prev;
-+ e=list_entry(n, struct lc_element,list);
-+
-+ list_del(&e->list);
-+ hlist_del(&e->colision);
-+ return e;
-+}
-+
-+/**
-+ * lc_del: Removes an element from the cache (and therefore adds the
-+ * element's storage to the free list)
-+ *
-+ * @lc: The lru_cache object
-+ * @e: The element to remove
-+ */
-+void lc_del(struct lru_cache* lc, struct lc_element *e)
-+{
-+ // FIXME what to do with refcnt != 0 ?
-+ PARANOIA_ENTRY();
-+ BUG_ON(e->refcnt);
-+ list_del(&e->list);
-+ hlist_del_init(&e->colision);
-+ e->lc_number = LC_FREE;
-+ e->refcnt = 0;
-+ list_add(&e->list,&lc->free);
-+ RETURN();
-+}
-+
-+STATIC struct lc_element* lc_get_unused_element(struct lru_cache* lc)
-+{
-+ struct list_head *n;
-+
-+ if (list_empty(&lc->free)) return lc_evict(lc);
-+
-+ n=lc->free.next;
-+ list_del(n);
-+ return list_entry(n, struct lc_element,list);
-+}
-+
-+STATIC int lc_unused_element_available(struct lru_cache* lc)
-+{
-+ if (!list_empty(&lc->free)) return 1; // something on the free list
-+ if (!list_empty(&lc->lru)) return 1; // something to evict
-+
-+ return 0;
-+}
-+
-+
-+/**
-+ * lc_get: Finds an element in the cache, increases its usage count,
-+ * "touches" and returns it.
-+ * In case the requested number is not present, it needs to be added to the
-+ * cache. Therefore it is possible that an other element becomes eviced from
-+ * the cache. In either case, the user is notified so he is able to e.g. keep
-+ * a persistent log of the cache changes, and therefore the objects in use.
-+ *
-+ * Return values:
-+ * NULL if the requested element number was not in the cache, and no unused
-+ * element could be recycled
-+ * pointer to the element with the REQUESTED element number
-+ * In this case, it can be used right away
-+ *
-+ * pointer to an UNUSED element with some different element number.
-+ * In this case, the cache is marked dirty, and the returned element
-+ * pointer is removed from the lru list and hash collision chains.
-+ * The user now should do whatever houskeeping is necessary. Then he
-+ * needs to call lc_element_changed(lc,element_pointer), to finish the
-+ * change.
-+ *
-+ * NOTE: The user needs to check the lc_number on EACH use, so he recognizes
-+ * any cache set change.
-+ *
-+ * @lc: The lru_cache object
-+ * @enr: element number
-+ */
-+struct lc_element* lc_get(struct lru_cache* lc, unsigned int enr)
-+{
-+ struct lc_element *e;
-+
-+ BUG_ON(!lc);
-+ BUG_ON(!lc->nr_elements);
-+
-+ PARANOIA_ENTRY();
-+ if ( lc->flags & LC_STARVING ) RETURN(NULL);
-+
-+ e = lc_find(lc, enr);
-+ if (e) {
-+ ++e->refcnt;
-+ list_move(&e->list,&lc->in_use); // Not evictable...
-+ RETURN(e);
-+ }
-+
-+ /* In case there is nothing available and we can not kick out
-+ * the LRU element, we have to wait ...
-+ */
-+ if(!lc_unused_element_available(lc)) {
-+ __set_bit(__LC_STARVING,&lc->flags);
-+ RETURN(NULL);
-+ }
-+
-+ /* it was not present in the cache, find an unused element,
-+ * which then is replaced.
-+ * we need to update the cache; serialize on lc->flags & LC_DIRTY
-+ */
-+ if (test_and_set_bit(__LC_DIRTY,&lc->flags)) RETURN(NULL);
-+
-+ e = lc_get_unused_element(lc);
-+ BUG_ON(!e);
-+
-+ clear_bit(__LC_STARVING,&lc->flags);
-+ BUG_ON(++e->refcnt != 1);
-+
-+ lc->changing_element = e;
-+ lc->new_number = enr;
-+
-+ RETURN(e);
-+}
-+
-+void lc_changed(struct lru_cache* lc, struct lc_element* e)
-+{
-+ PARANOIA_ENTRY();
-+ BUG_ON(e != lc->changing_element);
-+ e->lc_number = lc->new_number;
-+ list_add(&e->list,&lc->in_use);
-+ hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc, lc->new_number) );
-+ lc->changing_element = NULL;
-+ lc->new_number = -1;
-+ clear_bit(__LC_DIRTY,&lc->flags);
-+ smp_mb__after_clear_bit();
-+ PARANOIA_LEAVE();
-+}
-+
-+
-+unsigned int lc_put(struct lru_cache* lc, struct lc_element* e)
-+{
-+ BUG_ON(!lc);
-+ BUG_ON(!lc->nr_elements);
-+ BUG_ON(!e);
-+
-+ PARANOIA_ENTRY();
-+ BUG_ON(e->refcnt == 0);
-+ if ( --e->refcnt == 0) {
-+ list_move(&e->list,&lc->lru); // move it to the front of LRU.
-+ clear_bit(__LC_STARVING,&lc->flags);
-+ smp_mb__after_clear_bit();
-+ }
-+ RETURN(e->refcnt);
-+}
-+
-+
-+/**
-+ * lc_set: Sets an element in the cache. You might use this function to
-+ * setup the cache. It is expected that the elements are properly initialized.
-+ * @lc: The lru_cache object
-+ * @enr: element number
-+ * @index: The elements' position in the cache
-+ */
-+void lc_set(struct lru_cache* lc, unsigned int enr, int index)
-+{
-+ struct lc_element *e;
-+
-+ if ( index < 0 || index >= lc->nr_elements ) return;
-+
-+ e = lc_entry(lc,index);
-+ e->lc_number = enr;
-+
-+ hlist_del_init(&e->colision);
-+ hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc,enr) );
-+ list_move(&e->list, e->refcnt ? &lc->in_use : &lc->lru);
-+}
-+
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/lru_cache.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,144 @@
-+/*
-+-*- linux-c -*-
-+ lru_cache.c
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-+ main author.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+ */
-+
-+/*
-+ The lru_cache describes a big set of objects that are addressed
-+ by an index number (=lc_number). Only a small fraction of this set
-+ is present in the cache.
-+ (You set the size of the cache using lc_resize)
-+ Once created, the api consists of
-+ lc_find(,nr) -- finds the object with the given number, if present
-+ lc_get(,nr) -- finds the object and increases the usage count
-+ if not present, actions are taken to make sure that
-+ the cache is updated, the user is notified of this by a callback.
-+ Return value is NULL in this case.
-+ As soon as the user informs the cache that it has been updated,
-+ the next lc_get on that very object number will be successfull.
-+ lc_put(,lc_element*)
-+ -- decreases the usage count of this object, and returns the new value.
-+
-+ NOTE: It is the USERS responsibility to make sure that calls do not happen concurrently.
-+ */
-+
-+#ifndef LRU_CACHE_H
-+#define LRU_CACHE_H
-+
-+#include <linux/list.h>
-+#ifndef HLIST_HEAD_INIT
-+# include "hlist.h"
-+#endif
-+
-+#include <linux/version.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION (2,4,20)
-+static inline void list_move(struct list_head *list, struct list_head *head)
-+{
-+ __list_del(list->prev, list->next);
-+ list_add(list, head);
-+}
-+#endif
-+
-+#ifndef max
-+// For RH 2.4.9
-+# define max(x,y) \
-+ ({ typeof(x) __x = (x); typeof(y) __y = (y); \
-+ (void)(&__x == &__y); \
-+ __x > __y ? __x: __y; })
-+#endif
-+
-+#ifndef BUG_ON
-+ /* for ancient 2.4 kernels */
-+# define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-+#endif
-+
-+struct lc_element {
-+ struct hlist_node colision;
-+ struct list_head list; // LRU list or free list
-+ unsigned int refcnt;
-+ unsigned int lc_number;
-+};
-+
-+struct lru_cache {
-+ struct list_head lru;
-+ struct list_head free;
-+ struct list_head in_use;
-+ size_t element_size;
-+ unsigned int nr_elements;
-+ unsigned int new_number;
-+ unsigned long flags;
-+ struct lc_element *changing_element; // just for paranoia
-+
-+ void *lc_private;
-+
-+ struct hlist_head slot[0];
-+ // hash colision chains here, then element storage.
-+};
-+
-+
-+// flag-bits for lru_cache
-+enum {
-+ __LC_PARANOIA,
-+ __LC_DIRTY,
-+ __LC_STARVING,
-+};
-+#define LC_PARANOIA (1<<__LC_PARANOIA)
-+#define LC_DIRTY (1<<__LC_DIRTY)
-+#define LC_STARVING (1<<__LC_STARVING)
-+
-+extern struct lru_cache* lc_alloc(unsigned int e_count, size_t e_size,
-+ void *private_p);
-+extern void lc_free(struct lru_cache* lc);
-+extern void lc_set (struct lru_cache* lc, unsigned int enr, int index);
-+extern void lc_del (struct lru_cache* lc, struct lc_element *element);
-+
-+extern struct lc_element* lc_find(struct lru_cache* lc, unsigned int enr);
-+extern struct lc_element* lc_get (struct lru_cache* lc, unsigned int enr);
-+extern unsigned int lc_put (struct lru_cache* lc, struct lc_element* e);
-+extern void lc_changed(struct lru_cache* lc, struct lc_element* e);
-+
-+
-+/* This can be used to stop lc_get from changing the set of active elements.
-+ * Note that the reference counts and order on the lru list may still change.
-+ * returns true if we aquired the lock.
-+ */
-+static inline int lc_try_lock(struct lru_cache* lc)
-+{
-+ return !test_and_set_bit(__LC_DIRTY,&lc->flags);
-+}
-+
-+static inline void lc_unlock(struct lru_cache* lc)
-+{
-+ clear_bit(__LC_DIRTY,&lc->flags);
-+ smp_mb__after_clear_bit();
-+}
-+
-+#define LC_FREE (-1)
-+
-+#define lc_e_base(lc) ((char*) ( (lc)->slot + (lc)->nr_elements ) )
-+#define lc_entry(lc,i) ((struct lc_element*) \
-+ (lc_e_base(lc) + (i)*(lc)->element_size))
-+#define lc_index_of(lc,e) (((char*)(e) - lc_e_base(lc))/(lc)->element_size)
-+
-+#endif
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./drivers/block/drbd/mempool.h 2006-06-21 16:57:01.000000000 +0400
-@@ -0,0 +1,49 @@
-+/*
-+ * memory buffer pool support
-+ */
-+#ifndef _LINUX_MEMPOOL_H
-+#define _LINUX_MEMPOOL_H
-+
-+#include <linux/list.h>
-+#include <linux/wait.h>
-+
-+typedef void * (mempool_alloc_t)(int gfp_mask, void *pool_data);
-+typedef void (mempool_free_t)(void *element, void *pool_data);
-+
-+/*
-+ * A structure for linking multiple client objects into
-+ * a mempool_t
-+ */
-+typedef struct mempool_node_s {
-+ struct list_head list;
-+ void *element;
-+} mempool_node_t;
-+
-+/*
-+ * The elements list has full mempool_node_t's at ->next, and empty ones
-+ * at ->prev. Emptiness is signified by mempool_node_t.element == NULL.
-+ *
-+ * curr_nr refers to how many full mempool_node_t's are at ->elements.
-+ * We don't track the total number of mempool_node_t's at ->elements;
-+ * it is always equal to min_nr.
-+ */
-+typedef struct mempool_s {
-+ spinlock_t lock;
-+ int min_nr, curr_nr;
-+ struct list_head elements;
-+
-+ void *pool_data;
-+ mempool_alloc_t *alloc;
-+ mempool_free_t *free;
-+ wait_queue_head_t wait;
-+} mempool_t;
-+extern mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
-+ mempool_free_t *free_fn, void *pool_data);
-+extern void mempool_resize(mempool_t *pool, int new_min_nr, int gfp_mask);
-+extern void mempool_destroy(mempool_t *pool);
-+extern void * mempool_alloc(mempool_t *pool, int gfp_mask);
-+extern void mempool_free(void *element, mempool_t *pool);
-+extern void *mempool_alloc_slab(int gfp_mask, void *pool_data);
-+extern void mempool_free_slab(void *element, void *pool_data);
-+
-+#endif /* _LINUX_MEMPOOL_H */
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./include/linux/drbd.h 2006-06-21 16:58:59.000000000 +0400
-@@ -0,0 +1,247 @@
-+/*
-+ drbd.h
-+ Kernel module for 2.4.x/2.6.x Kernels
-+
-+ This file is part of drbd by Philipp Reisner.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+*/
-+#ifndef DRBD_H
-+#define DRBD_H
-+#include <linux/drbd_config.h>
-+
-+#include <asm/types.h>
-+
-+#ifdef __KERNEL__
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+#else
-+#include <sys/types.h>
-+#include <sys/ioctl.h>
-+#include <sys/wait.h>
-+#include <limits.h>
-+#endif
-+
-+#ifdef __KERNEL__
-+#define IN const
-+#define OUT
-+#define INOUT
-+#else
-+#define IN
-+#define OUT const
-+#define INOUT
-+#endif
-+
-+/*
-+ - Never forget to place bigger members before the smaller ones,
-+ to avoid unaligned placement of members on 64 bit architectures.
-+ - Never forget to add explicit _pad members to make sizeof(struct)
-+ divisible by 8.
-+*/
-+
-+#define MAX_SOCK_ADDR 128 /* 108 for Unix domain -
-+ 16 for IP, 16 for IPX,
-+ 24 for IPv6,
-+ about 80 for AX.25
-+ must be at least one bigger than
-+ the AF_UNIX size (see net/unix/af_unix.c
-+ :unix_mkname()).
-+ */
-+
-+enum io_error_handler {
-+ PassOn,
-+ Panic,
-+ Detach
-+};
-+
-+
-+struct disk_config {
-+ IN __u64 disk_size;
-+ IN int lower_device;
-+ IN enum io_error_handler on_io_error;
-+ IN int meta_device;
-+ IN int meta_index;
-+};
-+
-+enum disconnect_handler {
-+ Reconnect,
-+ DropNetConf,
-+ FreezeIO
-+};
-+
-+struct net_config {
-+ IN char my_addr[MAX_SOCK_ADDR];
-+ IN char other_addr[MAX_SOCK_ADDR];
-+ IN int my_addr_len;
-+ IN int other_addr_len;
-+ IN int timeout; // deci seconds
-+ IN int wire_protocol;
-+ IN int try_connect_int; /* seconds */
-+ IN int ping_int; /* seconds */
-+ IN int max_epoch_size;
-+ IN int max_buffers;
-+ IN int sndbuf_size; /* socket send buffer size */
-+ IN unsigned int ko_count;
-+ IN enum disconnect_handler on_disconnect;
-+ const int _pad;
-+};
-+
-+struct syncer_config {
-+ int rate; /* KB/sec */
-+ int use_csums; /* use checksum based syncing*/
-+ int skip;
-+ int group;
-+ int al_extents;
-+ const int _pad;
-+};
-+
-+/* KEEP the order, do not delete or insert!
-+ * Or change the API_VERSION, too. */
-+enum ret_codes {
-+ NoError=0,
-+ LAAlreadyInUse,
-+ OAAlreadyInUse,
-+ LDFDInvalid,
-+ MDFDInvalid,
-+ LDAlreadyInUse,
-+ LDNoBlockDev,
-+ MDNoBlockDev,
-+ LDOpenFailed,
-+ MDOpenFailed,
-+ LDDeviceTooSmall,
-+ MDDeviceTooSmall,
-+ LDNoConfig,
-+ LDMounted,
-+ MDMounted,
-+ LDMDInvalid,
-+ LDDeviceTooLarge,
-+ MDIOError
-+};
-+
-+struct ioctl_disk_config {
-+ struct disk_config config;
-+ OUT enum ret_codes ret_code;
-+ const int _pad;
-+};
-+
-+struct ioctl_net_config {
-+ struct net_config config;
-+ OUT enum ret_codes ret_code;
-+ const int _pad;
-+};
-+
-+struct ioctl_syncer_config {
-+ struct syncer_config config;
-+ OUT enum ret_codes ret_code;
-+ const int _pad;
-+};
-+
-+struct ioctl_wait {
-+ IN int wfc_timeout;
-+ IN int degr_wfc_timeout;
-+ OUT int ret_code;
-+ int _pad;
-+};
-+
-+#define DRBD_PROT_A 1
-+#define DRBD_PROT_B 2
-+#define DRBD_PROT_C 3
-+
-+typedef enum {
-+ Unknown=0,
-+ Primary=1, // role
-+ Secondary=2, // role
-+ Human=4, // flag for set_state
-+ TimeoutExpired=8, // flag for set_state
-+ DontBlameDrbd=16 // flag for set_state
-+} Drbd_State;
-+
-+/* The order of these constants is important.
-+ * The lower ones (<WFReportParams) indicate
-+ * that there is no socket!
-+ * >=WFReportParams ==> There is a socket
-+ *
-+ * THINK
-+ * Skipped should be < Connected,
-+ * so writes on a Primary after Skipped sync are not mirrored either ?
-+ */
-+typedef enum {
-+ Unconfigured,
-+ StandAlone,
-+ Unconnected,
-+ Timeout,
-+ BrokenPipe,
-+ NetworkFailure,
-+ WFConnection,
-+ WFReportParams, // we have a socket
-+ Connected, // we have introduced each other
-+ SkippedSyncS, // we should have synced, but user said no
-+ SkippedSyncT,
-+ WFBitMapS,
-+ WFBitMapT,
-+ SyncSource, // The distance between original state and pause
-+ SyncTarget, // state must be the same for source and target. (+2)
-+ PausedSyncS, // see _drbd_rs_resume() and _drbd_rs_pause()
-+ PausedSyncT, // is sync target, but higher priority groups first
-+} Drbd_CState;
-+
-+#ifndef BDEVNAME_SIZE
-+# define BDEVNAME_SIZE 32
-+#endif
-+
-+struct ioctl_get_config {
-+ OUT __u64 disk_size_user;
-+ OUT char lower_device_name[BDEVNAME_SIZE];
-+ OUT char meta_device_name[BDEVNAME_SIZE];
-+ struct net_config nconf;
-+ struct syncer_config sconf;
-+ OUT int lower_device_major;
-+ OUT int lower_device_minor;
-+ OUT enum io_error_handler on_io_error;
-+ OUT int meta_device_major;
-+ OUT int meta_device_minor;
-+ OUT int meta_index;
-+ OUT Drbd_CState cstate;
-+ OUT Drbd_State state;
-+ OUT Drbd_State peer_state;
-+ int _pad;
-+};
-+
-+#define DRBD_MAGIC 0x83740267
-+#define BE_DRBD_MAGIC __constant_cpu_to_be32(DRBD_MAGIC)
-+
-+/* 'D' already taken by s390 dasd driver.
-+ * maybe we want to change to something else, and register it officially?
-+ */
-+#define DRBD_IOCTL_LETTER 'D'
-+#define DRBD_IOCTL_GET_VERSION _IOR( DRBD_IOCTL_LETTER, 0x00, int )
-+#define DRBD_IOCTL_SET_STATE _IOW( DRBD_IOCTL_LETTER, 0x02, Drbd_State )
-+#define DRBD_IOCTL_SET_DISK_CONFIG _IOW( DRBD_IOCTL_LETTER, 0x06, struct ioctl_disk_config )
-+#define DRBD_IOCTL_SET_NET_CONFIG _IOW( DRBD_IOCTL_LETTER, 0x07, struct ioctl_net_config )
-+#define DRBD_IOCTL_UNCONFIG_NET _IO ( DRBD_IOCTL_LETTER, 0x08 )
-+#define DRBD_IOCTL_GET_CONFIG _IOW( DRBD_IOCTL_LETTER, 0x0A, struct ioctl_get_config )
-+#define DRBD_IOCTL_INVALIDATE _IO ( DRBD_IOCTL_LETTER, 0x0D )
-+#define DRBD_IOCTL_INVALIDATE_REM _IO ( DRBD_IOCTL_LETTER, 0x0E )
-+#define DRBD_IOCTL_SET_SYNC_CONFIG _IOW( DRBD_IOCTL_LETTER, 0x0F, struct ioctl_syncer_config )
-+#define DRBD_IOCTL_SET_DISK_SIZE _IOW( DRBD_IOCTL_LETTER, 0x10, unsigned int )
-+#define DRBD_IOCTL_WAIT_CONNECT _IOR( DRBD_IOCTL_LETTER, 0x11, struct ioctl_wait )
-+#define DRBD_IOCTL_WAIT_SYNC _IOR( DRBD_IOCTL_LETTER, 0x12, struct ioctl_wait )
-+#define DRBD_IOCTL_UNCONFIG_DISK _IO ( DRBD_IOCTL_LETTER, 0x13 )
-+#define DRBD_IOCTL_SET_STATE_FLAGS _IOW( DRBD_IOCTL_LETTER, 0x14, Drbd_State )
-+
-+
-+#endif
-+
---- /dev/null 2006-06-16 16:00:55.900357250 +0400
-+++ ./include/linux/drbd_config.h 2006-06-21 16:58:59.000000000 +0400
-@@ -0,0 +1,72 @@
-+/*
-+ drbd_config.h
-+ DRBD's compile time configuration.
-+
-+ drbd is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ drbd is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with drbd; see the file COPYING. If not, write to
-+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef DRBD_CONFIG_H
-+#define DRBD_CONFIG_H
-+
-+extern const char * drbd_buildtag(void);
-+
-+#define REL_VERSION "0.7.19"
-+#define API_VERSION 78
-+#define PRO_VERSION 74
-+
-+//#define DBG_ALL_SYMBOLS // no static functs, improves quality of OOPS traces
-+
-+//#define DBG_SPINLOCKS // enables MUST_HOLD macro (assertions for spinlocks)
-+//#define DBG_ASSERTS // drbd_assert_breakpoint() function
-+//#define DUMP_MD 1 // Dump metadata to syslog upon connect
-+#define DUMP_MD 2 // Dump even all cstate changes (I like it!)
-+//#define DUMP_MD 3 // Dump even all meta data access
-+ // (don't! unless we track down a bug...)
-+
-+//#define SIGHAND_HACK // Needed for RH 2.4.20 and later kernels.
-+//#define REDHAT_HLIST_BACKPORT // Makes DRBD work on RH9 kernels
-+
-+/* some redhat 2.4.X-Y.Z.whatever kernel flavours have an mm_inline.h,
-+ * which needs to be included explicitly. most 2.4.x kernels don't have that
-+ * header file at all. So uncomment for these, and ignore for all others.
-+ * in 2.6., it will be included anyways.
-+ */
-+//#define HAVE_MM_INLINE_H
-+
-+//Your 2.4 verndor kernel already defines find_next_bit()
-+//#define HAVE_FIND_NEXT_BIT
-+
-+//Your 2.4 kernel does not define find_next_bit(),
-+//and you are too lazy to "backport" it from 2.6 for your arch:
-+//#define USE_GENERIC_FIND_NEXT_BIT
-+
-+//#define PARANOIA // some extra checks
-+
-+// don't enable this, unless you can cope with gigabyte syslogs :)
-+//#define DUMP_EACH_PACKET
-+
-+// Dump every hour the usage / not usage of zero copy IO
-+//#define SHOW_SENDPAGE_USAGE
-+
-+// You can disable the use of the sendpage() call (= zero copy
-+// IO ) If you have the feeling that this might be the cause
-+// for troubles.
-+// #define DRBD_DISABLE_SENDPAGE
-+
-+// older, unpached kernel sources do not have it, so we added it in drbd_receiver.c
-+// but more recent kernels define it in arch/um/include/mem.h
-+#define HAVE_UML_TO_VIRT
-+
-+#endif
diff --git a/openvz-sources/023.030/5124_linux-2.6.8.1-drbd-0.7.19-0.7.20.patch b/openvz-sources/023.030/5124_linux-2.6.8.1-drbd-0.7.19-0.7.20.patch
deleted file mode 100644
index b2b7a9b..0000000
--- a/openvz-sources/023.030/5124_linux-2.6.8.1-drbd-0.7.19-0.7.20.patch
+++ /dev/null
@@ -1,1052 +0,0 @@
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_actlog.c 79.6.drbd/drivers/block/drbd/drbd_actlog.c
---- 79.6.orig/drivers/block/drbd/drbd_actlog.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_actlog.c 2006-07-06 16:23:06.000000000 +0400
-@@ -5,9 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-- authors.
-+ Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_bitmap.c 79.6.drbd/drivers/block/drbd/drbd_bitmap.c
---- 79.6.orig/drivers/block/drbd/drbd_bitmap.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_bitmap.c 2006-07-06 16:23:06.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 2004, Lars Ellenberg <l.g.e@web.de>.
-- main author.
--
-- Copyright (C) 2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- contributions.
-+ Copyright (C) 2004-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2004-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2004-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_buildtag.c 79.6.drbd/drivers/block/drbd/drbd_buildtag.c
---- 79.6.orig/drivers/block/drbd/drbd_buildtag.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_buildtag.c 2006-07-06 16:23:06.000000000 +0400
-@@ -1,6 +1,6 @@
- /* automatically generated. DO NOT EDIT. */
- const char * drbd_buildtag(void)
- {
-- return "SVN Revision: 2093"
-- " build by phil@mescal, 2006-03-06 15:04:12";
-+ return "SVN Revision: 2260"
-+ " build by phil@mescal, 2006-07-04 15:18:57";
- }
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_fs.c 79.6.drbd/drivers/block/drbd/drbd_fs.c
---- 79.6.orig/drivers/block/drbd/drbd_fs.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_fs.c 2006-07-06 16:23:06.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- Copyright (C) 2000, Fábio Olivé Leite <olive@conectiva.com.br>.
- Some sanity checks in IOCTL_SET_STATE.
-@@ -462,7 +460,7 @@ ONLY_IN_26({
- request_queue_t * const q = mdev->rq_queue;
- request_queue_t * const b = bdev->bd_disk->queue;
-
-- q->max_sectors = min_not_zero((unsigned short)(PAGE_SIZE >> 9), b->max_sectors);
-+ q->max_sectors = min_not_zero((typeof(q->max_sectors))(PAGE_SIZE >> 9), b->max_sectors);
- q->max_phys_segments = 1;
- q->max_hw_segments = 1;
- q->max_segment_size = min((unsigned)PAGE_SIZE,b->max_segment_size);
-@@ -530,6 +528,8 @@ ONLY_IN_26({
- }
-
- apply_al = drbd_md_test_flag(mdev,MDF_PrimaryInd);
-+ if(apply_al) set_bit(CRASHED_PRIMARY, &mdev->flags);
-+ else clear_bit(CRASHED_PRIMARY, &mdev->flags);
- /* All tests on MDF_PrimaryInd and MDF_ConnectedInd must happen before
- this point, because determin_dev_size() might call drbd_md_write(),
- which in turn modifies these flags. Exceptions are where, we want
-@@ -924,6 +924,7 @@ ONLY_IN_26(
- mdev->cstate >= Connected ?
- ConnectedCnt : ArbitraryCnt);
- }
-+ clear_bit(CRASHED_PRIMARY, &mdev->flags);
- } else {
- NOT_IN_26( set_device_ro(MKDEV(MAJOR_NR, minor), TRUE ); )
- ONLY_IN_26( set_disk_ro(mdev->vdisk, TRUE ); )
-@@ -1068,9 +1069,10 @@ STATIC int drbd_detach_ioctl(drbd_dev *m
- long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
- {
- int ret;
-- // lock_kernel(); Not needed, since we have mdev->device_mutex
- ret = drbd_ioctl(f->f_dentry->d_inode, f, cmd, arg);
-- // unlock_kernel();
-+ /* need to map "unknown" to ENOIOCTLCMD
-+ * to get the generic fallback path going */
-+ if (ret == -ENOTTY) ret = -ENOIOCTLCMD;
- return ret;
- }
- #endif
-@@ -1122,7 +1124,9 @@ ONLY_IN_26(
- switch (cmd) {
- default:
- /* oops, unknown IOCTL ?? */
-- err = -EINVAL;
-+ /* Sorry, 2.4 kernel will get "no such ioctl" for BLK* ioctls
-+ * on an unconfigured DRBD. I don't care right now. */
-+ err = -ENOTTY;
- goto out_unlocked;
-
- case DRBD_IOCTL_GET_CONFIG:
-@@ -1175,6 +1179,10 @@ ONLY_IN_26(
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- /* see how sys_ioctl and blkdev_ioctl handle it in 2.6 .
- * If I understand correctly, only "private" ioctl end up here.
-+ *
-+ * unless, of course, we are called by the compat_ioctl, in which case our
-+ * drbd_compat_ioctl wrapper will convert ENOTTY into ENOIOCTLCMD, which in
-+ * turn will cause the fallback path in the generic compat_sys_ioctl.
- */
- case BLKGETSIZE:
- err = put_user(drbd_get_capacity(mdev->this_bdev),(long *)arg);
-@@ -1451,7 +1459,7 @@ ONLY_IN_26(
- break;
-
- default:
-- err = -EINVAL;
-+ err = -ENOTTY;
- }
- /* out: */
- up(&mdev->device_mutex);
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_int.h 79.6.drbd/drivers/block/drbd/drbd_int.h
---- 79.6.orig/drivers/block/drbd/drbd_int.h 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_int.h 2006-07-06 16:23:06.000000000 +0400
-@@ -4,11 +4,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-@@ -683,6 +681,7 @@ enum {
- MD_DIRTY, // current gen counts and flags not yet on disk
- SYNC_STARTED, // Needed to agree on the exact point in time..
- USE_DEGR_WFC_T, // Use degr-wfc-timeout instad of wfc-timeout.
-+ CRASHED_PRIMARY // This node was a crashed primary
- };
-
- struct drbd_bitmap; // opaque for Drbd_Conf
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_main.c 79.6.drbd/drivers/block/drbd/drbd_main.c
---- 79.6.orig/drivers/block/drbd/drbd_main.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_main.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- Copyright (C) 2000, Marcelo Tosatti <marcelo@conectiva.com.br>.
- Early 2.3.x work.
-@@ -546,7 +544,7 @@ void drbd_thread_start(struct Drbd_threa
- D_ASSERT(thi->task == NULL);
- thi->t_state = Running;
- spin_unlock(&thi->t_lock);
--
-+ drbd_flush_signals(current); // otherw. may get -ERESTARTNOINTR
- pid = kernel_thread(drbd_thread_setup, (void *) thi, CLONE_FS);
- if (pid < 0) {
- ERR("Couldn't start thread (%d)\n", pid);
-@@ -1738,9 +1736,6 @@ int __init drbd_init(void)
- ": never change the size or layout of the HandShake packet.\n");
- return -EINVAL;
- }
-- if (sizeof_drbd_structs_sanity_check()) {
-- return -EINVAL;
-- }
-
- if (use_nbd_major) {
- major_nr = NBD_MAJOR;
-@@ -2014,7 +2009,8 @@ void drbd_md_write(drbd_dev *mdev)
- memset(buffer,0,512);
-
- flags = mdev->gen_cnt[Flags] & ~(MDF_PrimaryInd|MDF_ConnectedInd);
-- if (mdev->state == Primary) flags |= MDF_PrimaryInd;
-+ if (mdev->state == Primary ||
-+ test_bit(CRASHED_PRIMARY, &mdev->flags)) flags |= MDF_PrimaryInd;
- if (mdev->cstate >= WFReportParams) flags |= MDF_ConnectedInd;
- mdev->gen_cnt[Flags] = flags;
-
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_proc.c 79.6.drbd/drivers/block/drbd/drbd_proc.c
---- 79.6.orig/drivers/block/drbd/drbd_proc.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_proc.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_receiver.c 79.6.drbd/drivers/block/drbd/drbd_receiver.c
---- 79.6.orig/drivers/block/drbd/drbd_receiver.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_receiver.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-@@ -147,7 +145,6 @@ You need to hold the ee_lock:
- _drbd_process_ee()
-
- You must not have the ee_lock:
-- _drbd_alloc_ee()
- drbd_alloc_ee()
- drbd_init_ee()
- drbd_release_ee()
-@@ -157,89 +154,90 @@ You must not have the ee_lock:
- drbd_wait_ee()
- */
-
--STATIC int _drbd_alloc_ee(drbd_dev *mdev,struct page* page,int mask)
-+/*
-+ * gfp_mask is only used for the page allocation,
-+ * not for the kmem_cache_alloc, which is hardcoded to
-+ * basically GFP_NOIO, see below.
-+ *
-+ * THIS MUST NOT HOLD A LOCK
-+ */
-+struct Tl_epoch_entry*
-+drbd_try_alloc_ee(drbd_dev *mdev, int gfp_mask)
- {
- struct Tl_epoch_entry* e;
-+ struct page *page = alloc_page(gfp_mask);
-
-- /* kmem_cache does not like to mix different memory types.
-- * so even if we alloc'ed the page from HIGHMEM,
-- * the ee comes from normal memory.
-- */
-- e = kmem_cache_alloc(drbd_ee_cache, mask & ~(__GFP_HIGHMEM));
-- if( e == NULL ) return FALSE;
--
-- drbd_ee_init(e,page);
-- spin_lock_irq(&mdev->ee_lock);
-- list_add(&e->w.list,&mdev->free_ee);
-- mdev->ee_vacant++;
-- spin_unlock_irq(&mdev->ee_lock);
--
-- return TRUE;
--}
--
--/* bool */
--STATIC int drbd_alloc_ee(drbd_dev *mdev,int mask)
--{
-- struct page *page;
--
-- page=alloc_page(mask);
-- if(!page) return FALSE;
--
-+ if (!page) return NULL;
- /* if we got the page, we really want the ee, too,
- * even for "GFP_TRY".
- * we may wait, but better not cause IO,
- * we might be in the IO path (of our peer).
-+ *
-+ * kmem_cache does not like to mix different memory types.
-+ * so even if we alloc'ed the page from HIGHMEM,
-+ * the ee comes from normal memory.
- */
-- if(!_drbd_alloc_ee(mdev,page,mask | GFP_NOIO)) {
-- __free_page(page);
-- return FALSE;
-- }
-+ e = kmem_cache_alloc(drbd_ee_cache, (gfp_mask|GFP_NOIO) & ~(__GFP_HIGHMEM));
-
-- return TRUE;
-+ if (e) drbd_ee_init(e,page);
-+ else __free_page(page);
-+
-+ return e;
- }
-
--STATIC struct page* drbd_free_ee(drbd_dev *mdev, struct list_head *list)
-+/*
-+ * just free the ee and the associated page.
-+ * no accounting here, no list movement, nothing.
-+ */
-+void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry *e)
- {
-- struct list_head *le;
-- struct Tl_epoch_entry* e;
-- struct page* page;
--
-- MUST_HOLD(&mdev->ee_lock);
--
-- D_ASSERT(!list_empty(list));
-- le = list->next;
-- e = list_entry(le, struct Tl_epoch_entry, w.list);
-- list_del(le);
--
-- page = drbd_bio_get_page(&e->private_bio);
-+ struct page *page = drbd_bio_get_page(&e->private_bio);
- ONLY_IN_26(
- D_ASSERT(page == e->ee_bvec.bv_page);
-- page = e->ee_bvec.bv_page;
-+ page = e->ee_bvec.bv_page; /* just in case */
- )
-+ __free_page(page);
- kmem_cache_free(drbd_ee_cache, e);
-- mdev->ee_vacant--;
--
-- return page;
- }
-
-+/* XXX currently only called on module init.
-+ * actually we do not need to care about spinlocks.
-+ */
- int drbd_init_ee(drbd_dev *mdev)
- {
-- while(mdev->ee_vacant < EE_MININUM ) {
-- if(!drbd_alloc_ee(mdev,GFP_USER)) {
-+ LIST_HEAD(tmp);
-+ struct Tl_epoch_entry *e;
-+ int i;
-+
-+ for (i = 0; i < EE_MININUM; i++) {
-+ e = drbd_try_alloc_ee(mdev,GFP_HIGHUSER);
-+ if (!e) {
- ERR("Failed to allocate %d EEs !\n",EE_MININUM);
-- return 0;
-+ break;
- }
-+ list_add(&e->w.list,&tmp);
- }
-- return 1;
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+ list_splice(&tmp,&mdev->free_ee);
-+ mdev->ee_vacant += i;
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ return (i == EE_MININUM);
- }
-
- int drbd_release_ee(drbd_dev *mdev,struct list_head* list)
- {
- int count=0;
-+ struct Tl_epoch_entry *e;
-+ struct list_head *le, *tmp;
-
- spin_lock_irq(&mdev->ee_lock);
-- while(!list_empty(list)) {
-- __free_page(drbd_free_ee(mdev,list));
-+ list_for_each_safe(le,tmp,list) {
-+ list_del(le);
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ drbd_free_ee(mdev,e);
-+ mdev->ee_vacant--;
- count++;
- }
- spin_unlock_irq(&mdev->ee_lock);
-@@ -290,18 +288,22 @@ STATIC void finish_wait(wait_queue_head_
- #endif
-
- /**
-- * drbd_get_ee: Returns an Tl_epoch_entry; might sleep. Fails only if
-- * a signal comes in.
-+ * drbd_get_ee:
-+ * Returns an Tl_epoch_entry; might sleep. Fails only if a signal comes in.
-+ *
-+ * We do not do this straight forward, because we don't want to consume
-+ * too much memory: the upper bound is mdev->conf.max_buffers.
- */
- struct Tl_epoch_entry* drbd_get_ee(drbd_dev *mdev)
- {
- struct list_head *le;
-- struct Tl_epoch_entry* e;
-+ struct Tl_epoch_entry* e = NULL;
- DEFINE_WAIT(wait);
-
- MUST_HOLD(&mdev->ee_lock);
-
-- if(mdev->ee_vacant == EE_MININUM / 2) {
-+ if(mdev->ee_vacant == EE_MININUM / 2 &&
-+ (mdev->conf.unplug_watermark != mdev->conf.max_buffers) ) {
- spin_unlock_irq(&mdev->ee_lock);
- drbd_kick_lo(mdev);
- spin_lock_irq(&mdev->ee_lock);
-@@ -309,49 +311,50 @@ struct Tl_epoch_entry* drbd_get_ee(drbd_
-
- if(list_empty(&mdev->free_ee)) _drbd_process_ee(mdev,1);
-
-- if(list_empty(&mdev->free_ee)) {
-- for (;;) {
-- prepare_to_wait(&mdev->ee_wait, &wait,
-- TASK_INTERRUPTIBLE);
-- if(!list_empty(&mdev->free_ee)) break;
-+ while (list_empty(&mdev->free_ee)) {
-+ if( mdev->conf.max_buffers >
-+ mdev->ee_vacant + mdev->ee_in_use )
-+ {
- spin_unlock_irq(&mdev->ee_lock);
-- if( ( mdev->ee_vacant+mdev->ee_in_use) <
-- mdev->conf.max_buffers ) {
-- if(drbd_alloc_ee(mdev,GFP_TRY)) {
-- /* race race race
-- * (currently harmless for drbd07, since drbd_get_ee is called by
-- * receiver_thread only. solved with different implementation in
-- * drbd-plus already.)
-- */
-- spin_lock_irq(&mdev->ee_lock);
-- break;
-- }
-- }
-- drbd_kick_lo(mdev);
-- schedule();
-+ e = drbd_try_alloc_ee(mdev,GFP_TRY);
- spin_lock_irq(&mdev->ee_lock);
-- finish_wait(&mdev->ee_wait, &wait);
-- if (signal_pending(current)) {
-- WARN("drbd_get_ee interrupted!\n");
-- return 0;
-- }
-- // finish wait is inside, so that we are TASK_RUNNING
-- // in _drbd_process_ee (which might sleep by itself.)
-- _drbd_process_ee(mdev,1);
-+ if (e) goto got_new_ee;
-+ }
-+
-+ prepare_to_wait(&mdev->ee_wait, &wait, TASK_INTERRUPTIBLE);
-+ if (!list_empty(&mdev->free_ee)) break;
-+
-+ spin_unlock_irq(&mdev->ee_lock);
-+
-+ drbd_kick_lo(mdev);
-+ schedule();
-+
-+ // finish wait is inside, so that we are TASK_RUNNING
-+ // in _drbd_process_ee (which might sleep by itself.)
-+ finish_wait(&mdev->ee_wait, &wait);
-+
-+ spin_lock_irq(&mdev->ee_lock);
-+
-+ if (signal_pending(current)) {
-+ WARN("drbd_get_ee interrupted!\n");
-+ return NULL;
- }
-- finish_wait(&mdev->ee_wait, &wait);
-+
-+ _drbd_process_ee(mdev,1);
- }
-+ /* no-op when &wait has not been touched */
-+ finish_wait(&mdev->ee_wait, &wait);
-
-- /* race race race */
-- le=mdev->free_ee.next;
-+ le = mdev->free_ee.next;
- list_del(le);
- mdev->ee_vacant--;
-- mdev->ee_in_use++;
- e=list_entry(le, struct Tl_epoch_entry, w.list);
- ONLY_IN_26(
- D_ASSERT(e->private_bio.bi_idx == 0);
- drbd_ee_init(e,e->ee_bvec.bv_page); // reinitialize
- )
-+ got_new_ee:
-+ mdev->ee_in_use++;
- e->block_id = !ID_VACANT;
- SET_MAGIC(e);
- return e;
-@@ -359,27 +362,30 @@ ONLY_IN_26(
-
- void drbd_put_ee(drbd_dev *mdev,struct Tl_epoch_entry *e)
- {
-- struct page* page;
--
- MUST_HOLD(&mdev->ee_lock);
-
- D_ASSERT(page_count(drbd_bio_get_page(&e->private_bio)) == 1);
-
- mdev->ee_in_use--;
-- mdev->ee_vacant++;
- e->block_id = ID_VACANT;
- INVALIDATE_MAGIC(e);
-- list_add_tail(&e->w.list,&mdev->free_ee);
-
-- if((mdev->ee_vacant * 2 > mdev->ee_in_use ) &&
-- ( mdev->ee_vacant + mdev->ee_in_use > EE_MININUM) ) {
-- // FIXME cleanup: never returns NULL anymore
-- page=drbd_free_ee(mdev,&mdev->free_ee);
-- if( page ) __free_page(page);
-- }
-- if(mdev->ee_in_use == 0) {
-- while( mdev->ee_vacant > EE_MININUM ) {
-- __free_page(drbd_free_ee(mdev,&mdev->free_ee));
-+ if ( (mdev->ee_vacant * 2 > mdev->ee_in_use) &&
-+ (mdev->ee_vacant + mdev->ee_in_use > EE_MININUM) ) {
-+ drbd_free_ee(mdev,e);
-+ } else {
-+ list_add_tail(&e->w.list,&mdev->free_ee);
-+ mdev->ee_vacant++;
-+ }
-+ if (mdev->ee_in_use == 0) {
-+ struct Tl_epoch_entry *e;
-+ struct list_head *le, *tmp;
-+ list_for_each_safe(le,tmp,&mdev->free_ee) {
-+ if (mdev->ee_vacant <= EE_MININUM) break;
-+ list_del(le);
-+ e = list_entry(le, struct Tl_epoch_entry, w.list);
-+ drbd_free_ee(mdev,e);
-+ mdev->ee_vacant--;
- }
- }
-
-@@ -903,11 +909,8 @@ STATIC void receive_data_tail(drbd_dev *
- /* kick lower level device, if we have more than (arbitrary number)
- * reference counts on it, which typically are locally submitted io
- * requests. don't use unacked_cnt, so we speed up proto A and B, too.
-- *
-- * XXX maybe: make that arbitrary number configurable.
-- * for now, I choose 1/16 of max-epoch-size.
- */
-- if (atomic_read(&mdev->local_cnt) >= (mdev->conf.max_epoch_size>>4) ) {
-+ if (atomic_read(&mdev->local_cnt) >= mdev->conf.unplug_watermark ) {
- drbd_kick_lo(mdev);
- }
- mdev->writ_cnt+=data_size>>9;
-@@ -1229,7 +1232,9 @@ STATIC int receive_DataRequest(drbd_dev
- if (!drbd_rs_begin_io(mdev,sector)) {
- // we have been interrupted, probably connection lost!
- D_ASSERT(signal_pending(current));
-+ spin_lock_irq(&mdev->ee_lock);
- drbd_put_ee(mdev,e);
-+ spin_unlock_irq(&mdev->ee_lock);
- return 0;
- }
- break;
-@@ -1642,6 +1647,7 @@ STATIC int receive_bitmap(drbd_dev *mdev
- D_ASSERT(h->command == ReportBitMap);
- }
-
-+ clear_bit(CRASHED_PRIMARY, &mdev->flags); // md_write() is in drbd_start_resync.
- if (mdev->cstate == WFBitMapS) {
- drbd_start_resync(mdev,SyncSource);
- } else if (mdev->cstate == WFBitMapT) {
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_req.c 79.6.drbd/drivers/block/drbd/drbd_req.c
---- 79.6.orig/drivers/block/drbd/drbd_req.c 2006-07-06 16:14:23.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_req.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,11 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
--
-- Copyright (C) 2002-2004, Lars Ellenberg <l.g.e@web.de>.
-- main contributor.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_sizeof_sanity_check.c 79.6.drbd/drivers/block/drbd/drbd_sizeof_sanity_check.c
---- 79.6.orig/drivers/block/drbd/drbd_sizeof_sanity_check.c 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_sizeof_sanity_check.c 2006-07-06 16:23:07.000000000 +0400
-@@ -1,24 +1,17 @@
- #include <linux/drbd.h>
- #include <linux/kernel.h>
-
-+#define COMPILETIME_ASSERT(x) \
-+ switch(0) { case 0:; case (x):; }
- #define SZO(type,size) \
-- s = sizeof(type); \
-- if (s != size) { \
-- printk("<3>sizeof(" #type "): %d != %d\n", s, size); \
-- err = -1; \
-- }
-+void __assert_sizeof_ ##type ## _eq_ ##size(void) { COMPILETIME_ASSERT(sizeof(struct type) == (size)); } \
-+void __assert_sizeof_ ##type ## _modulo_8_eq_0(void) { COMPILETIME_ASSERT(sizeof(struct type) % 8 == 0); }
-
--int sizeof_drbd_structs_sanity_check(void)
--{
-- int err = 0, s = 0;
-- SZO(struct disk_config, 24)
-- SZO(struct net_config, 304)
-- SZO(struct syncer_config, 24)
-- SZO(struct ioctl_disk_config, 32)
-- SZO(struct ioctl_net_config, 312)
-- SZO(struct ioctl_syncer_config, 32)
-- SZO(struct ioctl_wait, 16)
-- SZO(struct ioctl_get_config, 440)
-- if (err) printk("<3>ioctls won't work, aborting\n");
-- return err;
--}
-+SZO(disk_config, 24)
-+SZO(net_config, 304)
-+SZO(syncer_config, 24)
-+SZO(ioctl_disk_config, 32)
-+SZO(ioctl_net_config, 312)
-+SZO(ioctl_syncer_config, 32)
-+SZO(ioctl_wait, 16)
-+SZO(ioctl_get_config, 440)
-diff -Nurap 79.6.orig/drivers/block/drbd/drbd_worker.c 79.6.drbd/drivers/block/drbd/drbd_worker.c
---- 79.6.orig/drivers/block/drbd/drbd_worker.c 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/drbd_worker.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,9 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-- authors.
-+ Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/lru_cache.c 79.6.drbd/drivers/block/drbd/lru_cache.c
---- 79.6.orig/drivers/block/drbd/lru_cache.c 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/lru_cache.c 2006-07-06 16:23:07.000000000 +0400
-@@ -5,9 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- Copyright (C) 2003-2004, Lars Ellenberg <l.g.e@web.de>.
-- authors.
-+ Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/lru_cache.h 79.6.drbd/drivers/block/drbd/lru_cache.h
---- 79.6.orig/drivers/block/drbd/lru_cache.h 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/drivers/block/drbd/lru_cache.h 2006-07-06 16:23:07.000000000 +0400
-@@ -5,8 +5,9 @@
-
- This file is part of drbd by Philipp Reisner.
-
-- Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner@linbit.com>.
-- main author.
-+ Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner@linbit.com>.
-+ Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg@linbit.com>.
-+ Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
-
- drbd is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
-diff -Nurap 79.6.orig/drivers/block/drbd/mempool-2.4.c 79.6.drbd/drivers/block/drbd/mempool-2.4.c
---- 79.6.orig/drivers/block/drbd/mempool-2.4.c 1970-01-01 03:00:00.000000000 +0300
-+++ 79.6.drbd/drivers/block/drbd/mempool-2.4.c 2006-07-06 16:23:07.000000000 +0400
-@@ -0,0 +1,335 @@
-+/*
-+ * linux/mm/mempool.c
-+ *
-+ * memory buffer pool support. Such pools are mostly used
-+ * for guaranteed, deadlock-free memory allocations during
-+ * extreme VM load.
-+ *
-+ * started by Ingo Molnar, Copyright (C) 2001
-+ * modified for inclusion with DRBD in 2003 by Philipp Reisner.
-+ */
-+
-+#include <linux/compiler.h>
-+#include <linux/mm.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include "mempool.h"
-+
-+#ifndef BUG_ON
-+# define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-+#endif
-+
-+/**
-+ * mempool_create - create a memory pool
-+ * @min_nr: the minimum number of elements guaranteed to be
-+ * allocated for this pool.
-+ * @alloc_fn: user-defined element-allocation function.
-+ * @free_fn: user-defined element-freeing function.
-+ * @pool_data: optional private data available to the user-defined functions.
-+ *
-+ * this function creates and allocates a guaranteed size, preallocated
-+ * memory pool. The pool can be used from the mempool_alloc and mempool_free
-+ * functions. This function might sleep. Both the alloc_fn() and the free_fn()
-+ * functions might sleep - as long as the mempool_alloc function is not called
-+ * from IRQ contexts.
-+ */
-+mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
-+ mempool_free_t *free_fn, void *pool_data)
-+{
-+ mempool_t *pool;
-+ int i;
-+
-+ BUG_ON(!alloc_fn);
-+ BUG_ON(!free_fn);
-+
-+ pool = kmalloc(sizeof(*pool), GFP_KERNEL);
-+ if (!pool)
-+ return NULL;
-+ memset(pool, 0, sizeof(*pool));
-+
-+ spin_lock_init(&pool->lock);
-+ pool->min_nr = min_nr;
-+ pool->pool_data = pool_data;
-+ INIT_LIST_HEAD(&pool->elements);
-+ init_waitqueue_head(&pool->wait);
-+ pool->alloc = alloc_fn;
-+ pool->free = free_fn;
-+
-+ /*
-+ * First pre-allocate the guaranteed number of buffers
-+ * and nodes for them.
-+ */
-+ for (i = 0; i < min_nr; i++) {
-+ void *element;
-+ mempool_node_t *node;
-+
-+ node = kmalloc(sizeof(*node), GFP_KERNEL);
-+ element = NULL;
-+ if (node)
-+ element = pool->alloc(GFP_KERNEL, pool->pool_data);
-+
-+ if (unlikely(!element)) {
-+ /*
-+ * Not enough memory - free the allocated ones
-+ * and return. `node' may be NULL here.
-+ */
-+ kfree(node);
-+ while (!list_empty(&pool->elements)) {
-+ node = list_entry(pool->elements.next,
-+ mempool_node_t, list);
-+ list_del(&node->list);
-+ pool->free(node->element, pool->pool_data);
-+ kfree(node);
-+ }
-+ kfree(pool);
-+ return NULL;
-+ }
-+ node->element = element;
-+ list_add(&node->list, &pool->elements);
-+ pool->curr_nr++;
-+ }
-+ return pool;
-+}
-+
-+/**
-+ * mempool_resize - resize an existing memory pool
-+ * @pool: pointer to the memory pool which was allocated via
-+ * mempool_create().
-+ * @new_min_nr: the new minimum number of elements guaranteed to be
-+ * allocated for this pool.
-+ * @gfp_mask: the usual allocation bitmask.
-+ *
-+ * This function shrinks/grows the pool. In the case of growing,
-+ * it cannot be guaranteed that the pool will be grown to the new
-+ * size immediately, but new mempool_free() calls will refill it.
-+ *
-+ * Note, the caller must guarantee that no mempool_destroy is called
-+ * while this function is running. mempool_alloc() & mempool_free()
-+ * might be called (eg. from IRQ contexts) while this function executes.
-+ */
-+void mempool_resize(mempool_t *pool, int new_min_nr, int gfp_mask)
-+{
-+ int delta;
-+ unsigned long flags;
-+
-+ if (new_min_nr <= 0)
-+ BUG();
-+
-+ spin_lock_irqsave(&pool->lock, flags);
-+ if (new_min_nr < pool->min_nr) {
-+ pool->min_nr = new_min_nr;
-+ /*
-+ * Free possible excess elements.
-+ */
-+ while (pool->curr_nr > pool->min_nr) {
-+ mempool_node_t *node;
-+
-+ if (list_empty(&pool->elements))
-+ BUG();
-+ node = list_entry(pool->elements.next,
-+ mempool_node_t, list);
-+ if (node->element == NULL)
-+ BUG();
-+ list_del(&node->list);
-+ pool->curr_nr--;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ pool->free(node->element, pool->pool_data);
-+ kfree(node);
-+ spin_lock_irqsave(&pool->lock, flags);
-+ }
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ return;
-+ }
-+ delta = new_min_nr - pool->min_nr;
-+ pool->min_nr = new_min_nr;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+
-+ /*
-+ * We refill the pool up to the new threshold - but we dont
-+ * (cannot) guarantee that the refill succeeds.
-+ */
-+ while (delta) {
-+ mempool_node_t *node;
-+
-+ node = kmalloc(sizeof(*node), gfp_mask);
-+ if (!node)
-+ break;
-+ node->element = pool->alloc(gfp_mask, pool->pool_data);
-+ if (!node->element) {
-+ kfree(node);
-+ break;
-+ }
-+ spin_lock_irqsave(&pool->lock, flags);
-+ list_add(&node->list, &pool->elements);
-+ pool->curr_nr++;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ delta--;
-+ }
-+ wake_up(&pool->wait);
-+}
-+
-+/**
-+ * mempool_destroy - deallocate a memory pool
-+ * @pool: pointer to the memory pool which was allocated via
-+ * mempool_create().
-+ *
-+ * this function only sleeps if the free_fn() function sleeps. The caller
-+ * has to guarantee that no mempool_alloc() nor mempool_free() happens in
-+ * this pool when calling this function.
-+ *
-+ * This function will go BUG() if there are outstanding elements in the
-+ * pool. The mempool client must put them all back before destroying the
-+ * mempool.
-+ */
-+void mempool_destroy(mempool_t *pool)
-+{
-+ if (!pool)
-+ return;
-+
-+ if (pool->curr_nr != pool->min_nr)
-+ printk(KERN_ERR "drbd: in %s(%p): curr_nr(%d) != min_nr(%d)\n",
-+ __func__,pool,pool->curr_nr,pool->min_nr);
-+ while (!list_empty(&pool->elements)) {
-+ mempool_node_t *node;
-+
-+ node = list_entry(pool->elements.prev,
-+ mempool_node_t, list);
-+ list_del(&node->list);
-+ if (node->element) {
-+ pool->curr_nr--;
-+ pool->free(node->element, pool->pool_data);
-+ }
-+ kfree(node);
-+ }
-+ if (pool->curr_nr)
-+ BUG();
-+ kfree(pool);
-+}
-+
-+/**
-+ * mempool_alloc - allocate an element from a specific memory pool
-+ * @pool: pointer to the memory pool which was allocated via
-+ * mempool_create().
-+ * @gfp_mask: the usual allocation bitmask.
-+ *
-+ * this function only sleeps if the alloc_fn function sleeps or
-+ * returns NULL. Note that due to preallocation, this function
-+ * *never* fails when called from process contexts. (it might
-+ * fail if called from an IRQ context.)
-+ */
-+void * mempool_alloc(mempool_t *pool, int gfp_mask)
-+{
-+ void *element;
-+ unsigned long flags;
-+ int curr_nr;
-+ DECLARE_WAITQUEUE(wait, current);
-+ int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
-+
-+repeat_alloc:
-+ element = pool->alloc(gfp_nowait, pool->pool_data);
-+ if (likely(element != NULL))
-+ return element;
-+
-+ /*
-+ * If the pool is less than 50% full then try harder
-+ * to allocate an element:
-+ */
-+ if ((gfp_mask != gfp_nowait) && (pool->curr_nr <= pool->min_nr/2)) {
-+ element = pool->alloc(gfp_mask, pool->pool_data);
-+ if (likely(element != NULL))
-+ return element;
-+ }
-+
-+ /*
-+ * Kick the VM at this point.
-+ */
-+ // wakeup_bdflush(); -- Modules can not do this; PRE
-+
-+ spin_lock_irqsave(&pool->lock, flags);
-+ if (likely(pool->curr_nr)) {
-+ mempool_node_t *node;
-+
-+ node = list_entry(pool->elements.next,
-+ mempool_node_t, list);
-+ list_del(&node->list);
-+ element = node->element;
-+ if (element == NULL)
-+ BUG();
-+ node->element = NULL;
-+ list_add_tail(&node->list, &pool->elements);
-+ pool->curr_nr--;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ return element;
-+ }
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+
-+ /* We must not sleep in the GFP_ATOMIC case */
-+ if (gfp_mask == gfp_nowait)
-+ return NULL;
-+
-+ run_task_queue(&tq_disk);
-+
-+ add_wait_queue_exclusive(&pool->wait, &wait);
-+ set_task_state(current, TASK_UNINTERRUPTIBLE);
-+
-+ spin_lock_irqsave(&pool->lock, flags);
-+ curr_nr = pool->curr_nr;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+
-+ if (!curr_nr)
-+ schedule();
-+
-+ current->state = TASK_RUNNING;
-+ remove_wait_queue(&pool->wait, &wait);
-+
-+ goto repeat_alloc;
-+}
-+
-+/**
-+ * mempool_free - return an element to the pool.
-+ * @element: pool element pointer.
-+ * @pool: pointer to the memory pool which was allocated via
-+ * mempool_create().
-+ *
-+ * this function only sleeps if the free_fn() function sleeps.
-+ */
-+void mempool_free(void *element, mempool_t *pool)
-+{
-+ unsigned long flags;
-+
-+ if (pool->curr_nr < pool->min_nr) {
-+ spin_lock_irqsave(&pool->lock, flags);
-+ if (pool->curr_nr < pool->min_nr) {
-+ mempool_node_t *node;
-+
-+ node = list_entry(pool->elements.prev,
-+ mempool_node_t, list);
-+ list_del(&node->list);
-+ if (node->element)
-+ BUG();
-+ node->element = element;
-+ list_add(&node->list, &pool->elements);
-+ pool->curr_nr++;
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ wake_up(&pool->wait);
-+ return;
-+ }
-+ spin_unlock_irqrestore(&pool->lock, flags);
-+ }
-+ pool->free(element, pool->pool_data);
-+}
-+
-+/*
-+ * A commonly used alloc and free fn.
-+ */
-+void *mempool_alloc_slab(int gfp_mask, void *pool_data)
-+{
-+ kmem_cache_t *mem = (kmem_cache_t *) pool_data;
-+ return kmem_cache_alloc(mem, gfp_mask);
-+}
-+
-+void mempool_free_slab(void *element, void *pool_data)
-+{
-+ kmem_cache_t *mem = (kmem_cache_t *) pool_data;
-+ kmem_cache_free(mem, element);
-+}
-diff -Nurap 79.6.orig/include/linux/drbd_config.h 79.6.drbd/include/linux/drbd_config.h
---- 79.6.orig/include/linux/drbd_config.h 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/include/linux/drbd_config.h 2006-07-06 16:23:07.000000000 +0400
-@@ -22,8 +22,8 @@
-
- extern const char * drbd_buildtag(void);
-
--#define REL_VERSION "0.7.19"
--#define API_VERSION 78
-+#define REL_VERSION "0.7.20"
-+#define API_VERSION 79
- #define PRO_VERSION 74
-
- //#define DBG_ALL_SYMBOLS // no static functs, improves quality of OOPS traces
-diff -Nurap 79.6.orig/include/linux/drbd.h 79.6.drbd/include/linux/drbd.h
---- 79.6.orig/include/linux/drbd.h 2006-07-06 16:14:24.000000000 +0400
-+++ 79.6.drbd/include/linux/drbd.h 2006-07-06 16:23:07.000000000 +0400
-@@ -93,10 +93,10 @@ struct net_config {
- IN int ping_int; /* seconds */
- IN int max_epoch_size;
- IN int max_buffers;
-+ IN int unplug_watermark;
- IN int sndbuf_size; /* socket send buffer size */
- IN unsigned int ko_count;
- IN enum disconnect_handler on_disconnect;
-- const int _pad;
- };
-
- struct syncer_config {
diff --git a/openvz-sources/023.030/5125_linux-2.6.9-e1000-7.2.7.patch b/openvz-sources/023.030/5125_linux-2.6.9-e1000-7.2.7.patch
deleted file mode 100644
index ef9e7a6..0000000
--- a/openvz-sources/023.030/5125_linux-2.6.9-e1000-7.2.7.patch
+++ /dev/null
@@ -1,12852 +0,0 @@
-diff -Nurap ./drivers/net/e1000.e1000/Makefile ./drivers/net/e1000/Makefile
---- ./drivers/net/e1000.e1000/Makefile 2004-10-19 01:53:07.000000000 +0400
-+++ ./drivers/net/e1000/Makefile 2006-08-31 14:59:51.000000000 +0400
-@@ -32,4 +32,4 @@
-
- obj-$(CONFIG_E1000) += e1000.o
-
--e1000-objs := e1000_main.o e1000_hw.o e1000_ethtool.o e1000_param.o
-+e1000-objs := e1000_main.o e1000_hw.o e1000_ethtool.o e1000_param.o kcompat.o
-diff -Nurap ./drivers/net/e1000.e1000/e1000.h ./drivers/net/e1000/e1000.h
---- ./drivers/net/e1000.e1000/e1000.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000.h 2006-08-31 14:59:50.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -53,7 +54,6 @@
- #include <linux/interrupt.h>
- #include <linux/string.h>
- #include <linux/pagemap.h>
--#include <linux/dma-mapping.h>
- #include <linux/bitops.h>
- #include <asm/io.h>
- #include <asm/irq.h>
-@@ -68,21 +68,26 @@
- #ifdef NETIF_F_TSO
- #include <net/checksum.h>
- #endif
--#include <linux/workqueue.h>
-+#ifdef SIOCGMIIPHY
- #include <linux/mii.h>
-+#endif
-+#ifdef SIOCETHTOOL
- #include <linux/ethtool.h>
-+#endif
-+#ifdef NETIF_F_HW_VLAN_TX
- #include <linux/if_vlan.h>
-+#endif
-
- #define BAR_0 0
- #define BAR_1 1
- #define BAR_5 5
-
-+#include "kcompat.h"
- #define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
- PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
-
- struct e1000_adapter;
-
--#include "e1000_compat.h"
- #include "e1000_hw.h"
-
- #ifdef DBG
-@@ -112,9 +117,14 @@ struct e1000_adapter;
- #define E1000_MIN_RXD 80
- #define E1000_MAX_82544_RXD 4096
-
-+/* this is the size past which hardware will drop packets when setting LPE=0 */
-+#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
-+
- /* Supported Rx Buffer Sizes */
- #define E1000_RXBUFFER_128 128 /* Used for packet split */
- #define E1000_RXBUFFER_256 256 /* Used for packet split */
-+#define E1000_RXBUFFER_512 512
-+#define E1000_RXBUFFER_1024 1024
- #define E1000_RXBUFFER_2048 2048
- #define E1000_RXBUFFER_4096 4096
- #define E1000_RXBUFFER_8192 8192
-@@ -142,6 +152,7 @@ struct e1000_adapter;
-
- #define AUTO_ALL_MODES 0
- #define E1000_EEPROM_82544_APM 0x0004
-+#define E1000_EEPROM_ICH8_APME 0x0004
- #define E1000_EEPROM_APME 0x0400
-
- #ifndef E1000_MASTER_SLAVE
-@@ -149,7 +160,9 @@ struct e1000_adapter;
- #define E1000_MASTER_SLAVE e1000_ms_hw_default
- #endif
-
-+#ifdef NETIF_F_HW_VLAN_TX
- #define E1000_MNG_VLAN_NONE -1
-+#endif
- /* Number of packet split data buffers (not including the header buffer) */
- #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
-
-@@ -237,13 +250,13 @@ struct e1000_adapter {
- struct timer_list tx_fifo_stall_timer;
- struct timer_list watchdog_timer;
- struct timer_list phy_info_timer;
-+#ifdef NETIF_F_HW_VLAN_TX
- struct vlan_group *vlgrp;
-- uint16_t mng_vlan_id;
-+ uint16_t mng_vlan_id;
-+#endif
- uint32_t bd_number;
- uint32_t rx_buffer_len;
-- uint32_t part_num;
- uint32_t wol;
-- uint32_t ksp3_port_a;
- uint32_t smartspeed;
- uint32_t en_mng_pt;
- uint16_t link_speed;
-@@ -253,12 +266,13 @@ struct e1000_adapter {
- spinlock_t tx_queue_lock;
- #endif
- atomic_t irq_sem;
-- struct work_struct watchdog_task;
- struct work_struct reset_task;
- uint8_t fc_autoneg;
-
-+#ifdef ETHTOOL_PHYS_ID
- struct timer_list blink_timer;
- unsigned long led_status;
-+#endif
-
- /* TX */
- struct e1000_tx_ring *tx_ring; /* One per active queue */
-@@ -324,10 +338,24 @@ struct e1000_adapter {
- struct e1000_phy_info phy_info;
- struct e1000_phy_stats phy_stats;
-
-+#ifdef ETHTOOL_TEST
- uint32_t test_icr;
- struct e1000_tx_ring test_tx_ring;
- struct e1000_rx_ring test_rx_ring;
-+#endif
-
-+#ifdef E1000_COUNT_ICR
-+ uint64_t icr_txdw;
-+ uint64_t icr_txqe;
-+ uint64_t icr_lsc;
-+ uint64_t icr_rxseq;
-+ uint64_t icr_rxdmt;
-+ uint64_t icr_rxo;
-+ uint64_t icr_rxt;
-+ uint64_t icr_mdac;
-+ uint64_t icr_rxcfg;
-+ uint64_t icr_gpi;
-+#endif
-
- uint32_t *config_space;
- int msg_enable;
-@@ -335,31 +363,17 @@ struct e1000_adapter {
- boolean_t have_msi;
- #endif
- /* to not mess up cache alignment, always add to the bottom */
-- boolean_t txb2b;
- #ifdef NETIF_F_TSO
- boolean_t tso_force;
- #endif
-+ boolean_t smart_power_down; /* phy smart power down */
-+ boolean_t quad_port_a;
-+ unsigned long flags;
-+ uint32_t eeprom_wol;
- };
-
--
--/* e1000_main.c */
--extern char e1000_driver_name[];
--extern char e1000_driver_version[];
--int e1000_up(struct e1000_adapter *adapter);
--void e1000_down(struct e1000_adapter *adapter);
--void e1000_reset(struct e1000_adapter *adapter);
--int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
--void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
--int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
--void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
--void e1000_update_stats(struct e1000_adapter *adapter);
--int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx);
--
--/* e1000_ethtool.c */
--void e1000_set_ethtool_ops(struct net_device *netdev);
--
--/* e1000_param.c */
--void e1000_check_options(struct e1000_adapter *adapter);
--
--
-+enum e1000_state_t {
-+ __E1000_DRIVER_TESTING,
-+ __E1000_RESETTING,
-+};
- #endif /* _E1000_H_ */
-diff -Nurap ./drivers/net/e1000.e1000/e1000_compat.h ./drivers/net/e1000/e1000_compat.h
---- ./drivers/net/e1000.e1000/e1000_compat.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_compat.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,18 +0,0 @@
--#ifndef __E1000_COMPAT_H__
--#define __E1000_COMPAT_H__
--
--#define skb_header_cloned(skb) 0
--
--typedef u32 pm_message_t;
--
--typedef int __bitwise pci_power_t;
--
--#define PCI_D0 ((pci_power_t __force) 0)
--#define PCI_D1 ((pci_power_t __force) 1)
--#define PCI_D2 ((pci_power_t __force) 2)
--#define PCI_D3hot ((pci_power_t __force) 3)
--#define PCI_D3cold ((pci_power_t __force) 4)
--
--#define pci_choose_state(pdev, state) (state)
--
--#endif /* __E1000_COMPAT_H__ */
-diff -Nurap ./drivers/net/e1000.e1000/e1000_ethtool.c ./drivers/net/e1000/e1000_ethtool.c
---- ./drivers/net/e1000.e1000/e1000_ethtool.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_ethtool.c 2006-08-31 14:59:49.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -30,8 +31,28 @@
-
- #include "e1000.h"
-
-+#ifdef SIOCETHTOOL
- #include <asm/uaccess.h>
-
-+extern char e1000_driver_name[];
-+extern char e1000_driver_version[];
-+
-+extern int e1000_up(struct e1000_adapter *adapter);
-+extern void e1000_down(struct e1000_adapter *adapter);
-+extern void e1000_reinit_locked(struct e1000_adapter *adapter);
-+extern void e1000_reset(struct e1000_adapter *adapter);
-+extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx);
-+extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
-+extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
-+extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
-+extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
-+extern void e1000_update_stats(struct e1000_adapter *adapter);
-+
-+#ifdef ETHTOOL_OPS_COMPAT
-+#include "kcompat_ethtool.c"
-+#endif
-+
-+#ifdef ETHTOOL_GSTATS
- struct e1000_stats {
- char stat_string[ETH_GSTRING_LEN];
- int sizeof_stat;
-@@ -80,18 +101,33 @@ static const struct e1000_stats e1000_gs
- { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) },
- { "rx_header_split", E1000_STAT(rx_hdr_split) },
- { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) },
-+#ifdef E1000_COUNT_ICR
-+ { "txdw", E1000_STAT(icr_txdw) },
-+ { "txqe", E1000_STAT(icr_txqe) },
-+ { "lsc", E1000_STAT(icr_lsc) },
-+ { "rxseq", E1000_STAT(icr_rxseq) },
-+ { "rxdmt", E1000_STAT(icr_rxdmt) },
-+ { "rxo", E1000_STAT(icr_rxo) },
-+ { "rxt", E1000_STAT(icr_rxt) },
-+ { "mdac", E1000_STAT(icr_mdac) },
-+ { "rxcfg", E1000_STAT(icr_rxcfg) },
-+ { "gpi", E1000_STAT(icr_gpi) },
-+#endif
- };
-
- #define E1000_QUEUE_STATS_LEN 0
- #define E1000_GLOBAL_STATS_LEN \
- sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats)
- #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN)
-+#endif /* ETHTOOL_GSTATS */
-+#ifdef ETHTOOL_TEST
- static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
- "Register test (offline)", "Eeprom test (offline)",
- "Interrupt test (offline)", "Loopback test (offline)",
- "Link test (on/offline)"
- };
- #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
-+#endif /* ETHTOOL_TEST */
-
- static int
- e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
-@@ -108,7 +144,8 @@ e1000_get_settings(struct net_device *ne
- SUPPORTED_1000baseT_Full|
- SUPPORTED_Autoneg |
- SUPPORTED_TP);
--
-+ if (hw->phy_type == e1000_phy_ife)
-+ ecmd->supported &= ~SUPPORTED_1000baseT_Full;
- ecmd->advertising = ADVERTISED_TP;
-
- if (hw->autoneg == 1) {
-@@ -181,6 +218,9 @@ e1000_set_settings(struct net_device *ne
- return -EINVAL;
- }
-
-+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
-+ msleep(1);
-+
- if (ecmd->autoneg == AUTONEG_ENABLE) {
- hw->autoneg = 1;
- if (hw->media_type == e1000_media_type_fiber)
-@@ -197,18 +237,20 @@ e1000_set_settings(struct net_device *ne
- ADVERTISED_TP;
- ecmd->advertising = hw->autoneg_advertised;
- } else
-- if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex))
-+ if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
- return -EINVAL;
-+ }
-
- /* reset the link */
-
- if (netif_running(adapter->netdev)) {
- e1000_down(adapter);
-- e1000_reset(adapter);
- e1000_up(adapter);
- } else
- e1000_reset(adapter);
-
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
- return 0;
- }
-
-@@ -238,9 +280,13 @@ e1000_set_pauseparam(struct net_device *
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
- struct e1000_hw *hw = &adapter->hw;
-+ int retval = 0;
-
- adapter->fc_autoneg = pause->autoneg;
-
-+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
-+ msleep(1);
-+
- if (pause->rx_pause && pause->tx_pause)
- hw->fc = e1000_fc_full;
- else if (pause->rx_pause && !pause->tx_pause)
-@@ -259,10 +305,11 @@ e1000_set_pauseparam(struct net_device *
- } else
- e1000_reset(adapter);
- } else
-- return ((hw->media_type == e1000_media_type_fiber) ?
-- e1000_setup_link(hw) : e1000_force_mac_fc(hw));
-+ retval = ((hw->media_type == e1000_media_type_fiber) ?
-+ e1000_setup_link(hw) : e1000_force_mac_fc(hw));
-
-- return 0;
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
-+ return retval;
- }
-
- static uint32_t
-@@ -278,10 +325,9 @@ e1000_set_rx_csum(struct net_device *net
- struct e1000_adapter *adapter = netdev_priv(netdev);
- adapter->rx_csum = data;
-
-- if (netif_running(netdev)) {
-- e1000_down(adapter);
-- e1000_up(adapter);
-- } else
-+ if (netif_running(netdev))
-+ e1000_reinit_locked(adapter);
-+ else
- e1000_reset(adapter);
- return 0;
- }
-@@ -417,12 +463,12 @@ e1000_get_regs(struct net_device *netdev
- regs_buff[23] = regs_buff[18]; /* mdix mode */
- e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0);
- } else {
-- e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
-+ e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
- regs_buff[13] = (uint32_t)phy_data; /* cable length */
- regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */
- regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */
- regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */
-- e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-+ e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
- regs_buff[17] = (uint32_t)phy_data; /* extended 10bt distance */
- regs_buff[18] = regs_buff[13]; /* cable polarity */
- regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */
-@@ -576,6 +622,7 @@ e1000_get_drvinfo(struct net_device *net
- case e1000_82572:
- case e1000_82573:
- case e1000_80003es2lan:
-+ case e1000_ich8lan:
- sprintf(firmware_version, "%d.%d-%d",
- (eeprom_data & 0xF000) >> 12,
- (eeprom_data & 0x0FF0) >> 4,
-@@ -630,6 +677,9 @@ e1000_set_ringparam(struct net_device *n
- tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues;
- rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues;
-
-+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
-+ msleep(1);
-+
- if (netif_running(adapter->netdev))
- e1000_down(adapter);
-
-@@ -690,9 +740,10 @@ e1000_set_ringparam(struct net_device *n
- adapter->rx_ring = rx_new;
- adapter->tx_ring = tx_new;
- if ((err = e1000_up(adapter)))
-- return err;
-+ goto err_setup;
- }
-
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
- return 0;
- err_setup_tx:
- e1000_free_all_rx_resources(adapter);
-@@ -700,6 +751,8 @@ err_setup_rx:
- adapter->rx_ring = rx_old;
- adapter->tx_ring = tx_old;
- e1000_up(adapter);
-+err_setup:
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
- return err;
- }
-
-@@ -745,7 +798,7 @@ e1000_reg_test(struct e1000_adapter *ada
- /* The status register is Read Only, so a write should fail.
- * Some bits that get toggled are ignored.
- */
-- switch (adapter->hw.mac_type) {
-+ switch (adapter->hw.mac_type) {
- /* there are several bits on newer hardware that are r/w */
- case e1000_82571:
- case e1000_82572:
-@@ -753,6 +806,7 @@ e1000_reg_test(struct e1000_adapter *ada
- toggle = 0x7FFFF3FF;
- break;
- case e1000_82573:
-+ case e1000_ich8lan:
- toggle = 0x7FFFF033;
- break;
- default:
-@@ -772,11 +826,12 @@ e1000_reg_test(struct e1000_adapter *ada
- }
- /* restore previous status */
- E1000_WRITE_REG(&adapter->hw, STATUS, before);
--
-- REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF);
-- REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF);
-- REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF);
-- REG_PATTERN_TEST(VET, 0x0000FFFF, 0xFFFFFFFF);
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
-+ REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF);
-+ REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF);
-+ REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF);
-+ REG_PATTERN_TEST(VET, 0x0000FFFF, 0xFFFFFFFF);
-+ }
- REG_PATTERN_TEST(RDTR, 0x0000FFFF, 0xFFFFFFFF);
- REG_PATTERN_TEST(RDBAH, 0xFFFFFFFF, 0xFFFFFFFF);
- REG_PATTERN_TEST(RDLEN, 0x000FFF80, 0x000FFFFF);
-@@ -789,20 +844,22 @@ e1000_reg_test(struct e1000_adapter *ada
- REG_PATTERN_TEST(TDLEN, 0x000FFF80, 0x000FFFFF);
-
- REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000);
-- REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB);
-+ before = (adapter->hw.mac_type == e1000_ich8lan ?
-+ 0x06C3B33E : 0x06DFB3FE);
-+ REG_SET_AND_CHECK(RCTL, before, 0x003FFFFB);
- REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000);
-
- if (adapter->hw.mac_type >= e1000_82543) {
-
-- REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF);
-+ REG_SET_AND_CHECK(RCTL, before, 0xFFFFFFFF);
- REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
-- REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF);
-+ if (adapter->hw.mac_type != e1000_ich8lan)
-+ REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF);
- REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
- REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF);
--
-- for (i = 0; i < E1000_RAR_ENTRIES; i++) {
-- REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF,
-- 0xFFFFFFFF);
-+ value = (adapter->hw.mac_type == e1000_ich8lan ?
-+ E1000_RAR_ENTRIES_ICH8LAN : E1000_RAR_ENTRIES);
-+ for (i = 0; i < value; i++) {
- REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF,
- 0xFFFFFFFF);
- }
-@@ -816,7 +873,9 @@ e1000_reg_test(struct e1000_adapter *ada
-
- }
-
-- for (i = 0; i < E1000_MC_TBL_SIZE; i++)
-+ value = (adapter->hw.mac_type == e1000_ich8lan ?
-+ E1000_MC_TBL_SIZE_ICH8LAN : E1000_MC_TBL_SIZE);
-+ for (i = 0; i < value; i++)
- REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF);
-
- *data = 0;
-@@ -864,19 +923,23 @@ static int
- e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
- {
- struct net_device *netdev = adapter->netdev;
-- uint32_t mask, i=0, shared_int = TRUE;
-- uint32_t irq = adapter->pdev->irq;
-+ uint32_t mask, i=0, shared_int = TRUE;
-+ uint32_t irq = adapter->pdev->irq;
-
- *data = 0;
-
-+ /* NOTE: we don't test MSI interrupts here, yet */
- /* Hook up test interrupt handler just for this test */
-- if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
-- shared_int = FALSE;
-- } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ,
-+ if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name,
-+ netdev))
-+ shared_int = FALSE;
-+ else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ,
- netdev->name, netdev)){
- *data = 1;
- return -1;
- }
-+ DPRINTK(HW, INFO, "testing %s interrupt\n",
-+ (shared_int ? "shared" : "unshared"));
-
- /* Disable all the interrupts */
- E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF);
-@@ -885,25 +948,27 @@ e1000_intr_test(struct e1000_adapter *ad
- /* Test each interrupt */
- for (; i < 10; i++) {
-
-+ if (adapter->hw.mac_type == e1000_ich8lan && i == 8)
-+ continue;
- /* Interrupt to test */
- mask = 1 << i;
-
-- if (!shared_int) {
-- /* Disable the interrupt to be reported in
-- * the cause register and then force the same
-- * interrupt and see if one gets posted. If
-- * an interrupt was posted to the bus, the
-- * test failed.
-- */
-- adapter->test_icr = 0;
-- E1000_WRITE_REG(&adapter->hw, IMC, mask);
-- E1000_WRITE_REG(&adapter->hw, ICS, mask);
-- msec_delay(10);
--
-- if (adapter->test_icr & mask) {
-- *data = 3;
-- break;
-- }
-+ if (!shared_int) {
-+ /* Disable the interrupt to be reported in
-+ * the cause register and then force the same
-+ * interrupt and see if one gets posted. If
-+ * an interrupt was posted to the bus, the
-+ * test failed.
-+ */
-+ adapter->test_icr = 0;
-+ E1000_WRITE_REG(&adapter->hw, IMC, mask);
-+ E1000_WRITE_REG(&adapter->hw, ICS, mask);
-+ msec_delay(10);
-+
-+ if (adapter->test_icr & mask) {
-+ *data = 3;
-+ break;
-+ }
- }
-
- /* Enable the interrupt to be reported in
-@@ -922,7 +987,7 @@ e1000_intr_test(struct e1000_adapter *ad
- break;
- }
-
-- if (!shared_int) {
-+ if (!shared_int) {
- /* Disable the other interrupts to be reported in
- * the cause register and then force the other
- * interrupts and see if any get posted. If
-@@ -1191,7 +1256,7 @@ e1000_nonintegrated_phy_loopback(struct
- e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8100);
-
- /* Wait for reset to complete. */
-- udelay(500);
-+ usec_delay(500);
-
- /* Have to setup TX_CLK and TX_CRS after software reset */
- e1000_phy_reset_clk_and_crs(adapter);
-@@ -1239,21 +1304,35 @@ e1000_integrated_phy_loopback(struct e10
- e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140);
- /* autoneg off */
- e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140);
-- } else if (adapter->hw.phy_type == e1000_phy_gg82563) {
-+ } else if (adapter->hw.phy_type == e1000_phy_gg82563)
- e1000_write_phy_reg(&adapter->hw,
- GG82563_PHY_KMRN_MODE_CTRL,
-- 0x1CE);
-- }
-- /* force 1000, set loopback */
-- e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140);
-+ 0x1CC);
-
-- /* Now set up the MAC to the same speed/duplex as the PHY. */
- ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL);
-- ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
-- ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
-- E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
-- E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
-- E1000_CTRL_FD); /* Force Duplex to FULL */
-+
-+ if (adapter->hw.phy_type == e1000_phy_ife) {
-+ /* force 100, set loopback */
-+ e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x6100);
-+
-+ /* Now set up the MAC to the same speed/duplex as the PHY. */
-+ ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
-+ ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
-+ E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
-+ E1000_CTRL_SPD_100 |/* Force Speed to 100 */
-+ E1000_CTRL_FD); /* Force Duplex to FULL */
-+ } else {
-+ /* force 1000, set loopback */
-+ e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140);
-+
-+ /* Now set up the MAC to the same speed/duplex as the PHY. */
-+ ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL);
-+ ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
-+ ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
-+ E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
-+ E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
-+ E1000_CTRL_FD); /* Force Duplex to FULL */
-+ }
-
- if (adapter->hw.media_type == e1000_media_type_copper &&
- adapter->hw.phy_type == e1000_phy_m88) {
-@@ -1274,7 +1353,7 @@ e1000_integrated_phy_loopback(struct e10
- if (adapter->hw.phy_type == e1000_phy_m88)
- e1000_phy_disable_receiver(adapter);
-
-- udelay(500);
-+ usec_delay(500);
-
- return 0;
- }
-@@ -1313,6 +1392,7 @@ e1000_set_phy_loopback(struct e1000_adap
- case e1000_82572:
- case e1000_82573:
- case e1000_80003es2lan:
-+ case e1000_ich8lan:
- return e1000_integrated_phy_loopback(adapter);
- break;
-
-@@ -1393,11 +1473,10 @@ e1000_loopback_cleanup(struct e1000_adap
- case e1000_82546_rev_3:
- default:
- hw->autoneg = TRUE;
-- if (hw->phy_type == e1000_phy_gg82563) {
-+ if (hw->phy_type == e1000_phy_gg82563)
- e1000_write_phy_reg(hw,
- GG82563_PHY_KMRN_MODE_CTRL,
- 0x180);
-- }
- e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg);
- if (phy_reg & MII_CR_LOOPBACK) {
- phy_reg &= ~MII_CR_LOOPBACK;
-@@ -1557,6 +1636,8 @@ e1000_diag_test_count(struct net_device
- return E1000_TEST_LEN;
- }
-
-+extern void e1000_power_up_phy(struct e1000_adapter *);
-+
- static void
- e1000_diag_test(struct net_device *netdev,
- struct ethtool_test *eth_test, uint64_t *data)
-@@ -1564,6 +1645,7 @@ e1000_diag_test(struct net_device *netde
- struct e1000_adapter *adapter = netdev_priv(netdev);
- boolean_t if_running = netif_running(netdev);
-
-+ set_bit(__E1000_DRIVER_TESTING, &adapter->flags);
- if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
- /* Offline tests */
-
-@@ -1572,13 +1654,16 @@ e1000_diag_test(struct net_device *netde
- uint8_t forced_speed_duplex = adapter->hw.forced_speed_duplex;
- uint8_t autoneg = adapter->hw.autoneg;
-
-+ DPRINTK(HW, INFO, "offline testing starting\n");
-+
- /* Link test performed before hardware reset so autoneg doesn't
- * interfere with test result */
- if (e1000_link_test(adapter, &data[4]))
- eth_test->flags |= ETH_TEST_FL_FAILED;
-
- if (if_running)
-- e1000_down(adapter);
-+ /* indicate we're in test mode */
-+ dev_close(netdev);
- else
- e1000_reset(adapter);
-
-@@ -1594,6 +1679,8 @@ e1000_diag_test(struct net_device *netde
- eth_test->flags |= ETH_TEST_FL_FAILED;
-
- e1000_reset(adapter);
-+ /* make sure the phy is powered up */
-+ e1000_power_up_phy(adapter);
- if (e1000_loopback_test(adapter, &data[3]))
- eth_test->flags |= ETH_TEST_FL_FAILED;
-
-@@ -1603,9 +1690,11 @@ e1000_diag_test(struct net_device *netde
- adapter->hw.autoneg = autoneg;
-
- e1000_reset(adapter);
-+ clear_bit(__E1000_DRIVER_TESTING, &adapter->flags);
- if (if_running)
-- e1000_up(adapter);
-+ dev_open(netdev);
- } else {
-+ DPRINTK(HW, INFO, "online testing starting\n");
- /* Online tests */
- if (e1000_link_test(adapter, &data[4]))
- eth_test->flags |= ETH_TEST_FL_FAILED;
-@@ -1615,18 +1704,18 @@ e1000_diag_test(struct net_device *netde
- data[1] = 0;
- data[2] = 0;
- data[3] = 0;
-+
-+ clear_bit(__E1000_DRIVER_TESTING, &adapter->flags);
- }
- msleep_interruptible(4 * 1000);
- }
-
--static void
--e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
-+static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
- {
-- struct e1000_adapter *adapter = netdev_priv(netdev);
- struct e1000_hw *hw = &adapter->hw;
-+ int retval = 1; /* fail by default */
-
-- switch (adapter->hw.device_id) {
-- case E1000_DEV_ID_82542:
-+ switch (hw->device_id) {
- case E1000_DEV_ID_82543GC_FIBER:
- case E1000_DEV_ID_82543GC_COPPER:
- case E1000_DEV_ID_82544EI_FIBER:
-@@ -1634,52 +1723,87 @@ e1000_get_wol(struct net_device *netdev,
- case E1000_DEV_ID_82545EM_FIBER:
- case E1000_DEV_ID_82545EM_COPPER:
- case E1000_DEV_ID_82546GB_QUAD_COPPER:
-+ case E1000_DEV_ID_82546GB_PCIE:
-+ /* these don't support WoL at all */
- wol->supported = 0;
-- wol->wolopts = 0;
-- return;
--
-- case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
-- /* device id 10B5 port-A supports wol */
-- if (!adapter->ksp3_port_a) {
-- wol->supported = 0;
-- return;
-- }
-- /* KSP3 does not suppport UCAST wake-ups for any interface */
-- wol->supported = WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
--
-- if (adapter->wol & E1000_WUFC_EX)
-- DPRINTK(DRV, ERR, "Interface does not support "
-- "directed (unicast) frame wake-up packets\n");
-- wol->wolopts = 0;
-- goto do_defaults;
--
-+ break;
- case E1000_DEV_ID_82546EB_FIBER:
- case E1000_DEV_ID_82546GB_FIBER:
- case E1000_DEV_ID_82571EB_FIBER:
-- /* Wake events only supported on port A for dual fiber */
-+ case E1000_DEV_ID_82571EB_SERDES:
-+ case E1000_DEV_ID_82571EB_COPPER:
-+ /* Wake events not supported on port B */
- if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) {
- wol->supported = 0;
-- wol->wolopts = 0;
-- return;
-+ break;
- }
-- /* Fall Through */
--
-+ /* return success for non excluded adapter ports */
-+ retval = 0;
-+ break;
-+ case E1000_DEV_ID_82571EB_QUAD_COPPER:
-+ case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
-+ /* quad port adapters only support WoL on port A */
-+ if (!adapter->quad_port_a) {
-+ wol->supported = 0;
-+ break;
-+ }
-+ /* return success for non excluded adapter ports */
-+ retval = 0;
-+ break;
- default:
-- wol->supported = WAKE_UCAST | WAKE_MCAST |
-- WAKE_BCAST | WAKE_MAGIC;
-- wol->wolopts = 0;
-+ /* dual port cards only support WoL on port A from now on
-+ * unless it was enabled in the eeprom for port B
-+ * so exclude FUNC_1 ports from having WoL enabled */
-+ if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1 &&
-+ !adapter->eeprom_wol) {
-+ wol->supported = 0;
-+ break;
-+ }
-
--do_defaults:
-- if (adapter->wol & E1000_WUFC_EX)
-- wol->wolopts |= WAKE_UCAST;
-- if (adapter->wol & E1000_WUFC_MC)
-- wol->wolopts |= WAKE_MCAST;
-- if (adapter->wol & E1000_WUFC_BC)
-- wol->wolopts |= WAKE_BCAST;
-- if (adapter->wol & E1000_WUFC_MAG)
-- wol->wolopts |= WAKE_MAGIC;
-+ retval = 0;
-+ }
-+
-+ return retval;
-+}
-+
-+static void
-+e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
-+{
-+ struct e1000_adapter *adapter = netdev_priv(netdev);
-+
-+ wol->supported = WAKE_UCAST | WAKE_MCAST |
-+ WAKE_BCAST | WAKE_MAGIC;
-+ wol->wolopts = 0;
-+
-+ /* this function will set ->supported = 0 and return 1 if wol is not
-+ * supported by this hardware */
-+ if (e1000_wol_exclusion(adapter, wol))
- return;
-+
-+ /* apply any specific unsupported masks here */
-+ switch (adapter->hw.device_id) {
-+ case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
-+ /* KSP3 does not suppport UCAST wake-ups */
-+ wol->supported &= ~WAKE_UCAST;
-+
-+ if (adapter->wol & E1000_WUFC_EX)
-+ DPRINTK(DRV, ERR, "Interface does not support "
-+ "directed (unicast) frame wake-up packets\n");
-+ break;
-+ default:
-+ break;
- }
-+
-+ if (adapter->wol & E1000_WUFC_EX)
-+ wol->wolopts |= WAKE_UCAST;
-+ if (adapter->wol & E1000_WUFC_MC)
-+ wol->wolopts |= WAKE_MCAST;
-+ if (adapter->wol & E1000_WUFC_BC)
-+ wol->wolopts |= WAKE_BCAST;
-+ if (adapter->wol & E1000_WUFC_MAG)
-+ wol->wolopts |= WAKE_MAGIC;
-+
-+ return;
- }
-
- static int
-@@ -1688,51 +1812,35 @@ e1000_set_wol(struct net_device *netdev,
- struct e1000_adapter *adapter = netdev_priv(netdev);
- struct e1000_hw *hw = &adapter->hw;
-
-- switch (adapter->hw.device_id) {
-- case E1000_DEV_ID_82542:
-- case E1000_DEV_ID_82543GC_FIBER:
-- case E1000_DEV_ID_82543GC_COPPER:
-- case E1000_DEV_ID_82544EI_FIBER:
-- case E1000_DEV_ID_82546EB_QUAD_COPPER:
-- case E1000_DEV_ID_82546GB_QUAD_COPPER:
-- case E1000_DEV_ID_82545EM_FIBER:
-- case E1000_DEV_ID_82545EM_COPPER:
-+ if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
-+ return -EOPNOTSUPP;
-+
-+ if (e1000_wol_exclusion(adapter, wol))
- return wol->wolopts ? -EOPNOTSUPP : 0;
-
-+ switch (hw->device_id) {
- case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
-- /* device id 10B5 port-A supports wol */
-- if (!adapter->ksp3_port_a)
-- return wol->wolopts ? -EOPNOTSUPP : 0;
--
- if (wol->wolopts & WAKE_UCAST) {
- DPRINTK(DRV, ERR, "Interface does not support "
- "directed (unicast) frame wake-up packets\n");
- return -EOPNOTSUPP;
- }
--
-- case E1000_DEV_ID_82546EB_FIBER:
-- case E1000_DEV_ID_82546GB_FIBER:
-- case E1000_DEV_ID_82571EB_FIBER:
-- /* Wake events only supported on port A for dual fiber */
-- if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
-- return wol->wolopts ? -EOPNOTSUPP : 0;
-- /* Fall Through */
--
-+ break;
- default:
-- if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
-- return -EOPNOTSUPP;
-+ break;
-+ }
-
-- adapter->wol = 0;
-+ /* these settings will always override what we currently have */
-+ adapter->wol = 0;
-
-- if (wol->wolopts & WAKE_UCAST)
-- adapter->wol |= E1000_WUFC_EX;
-- if (wol->wolopts & WAKE_MCAST)
-- adapter->wol |= E1000_WUFC_MC;
-- if (wol->wolopts & WAKE_BCAST)
-- adapter->wol |= E1000_WUFC_BC;
-- if (wol->wolopts & WAKE_MAGIC)
-- adapter->wol |= E1000_WUFC_MAG;
-- }
-+ if (wol->wolopts & WAKE_UCAST)
-+ adapter->wol |= E1000_WUFC_EX;
-+ if (wol->wolopts & WAKE_MCAST)
-+ adapter->wol |= E1000_WUFC_MC;
-+ if (wol->wolopts & WAKE_BCAST)
-+ adapter->wol |= E1000_WUFC_BC;
-+ if (wol->wolopts & WAKE_MAGIC)
-+ adapter->wol |= E1000_WUFC_MAG;
-
- return 0;
- }
-@@ -1774,21 +1882,18 @@ e1000_phys_id(struct net_device *netdev,
- mod_timer(&adapter->blink_timer, jiffies);
- msleep_interruptible(data * 1000);
- del_timer_sync(&adapter->blink_timer);
-- } else if (adapter->hw.mac_type < e1000_82573) {
-- E1000_WRITE_REG(&adapter->hw, LEDCTL,
-- (E1000_LEDCTL_LED2_BLINK_RATE |
-- E1000_LEDCTL_LED0_BLINK | E1000_LEDCTL_LED2_BLINK |
-- (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) |
-- (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED0_MODE_SHIFT) |
-- (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED1_MODE_SHIFT)));
-+ } else if (adapter->hw.phy_type == e1000_phy_ife) {
-+ if (!adapter->blink_timer.function) {
-+ init_timer(&adapter->blink_timer);
-+ adapter->blink_timer.function = e1000_led_blink_callback;
-+ adapter->blink_timer.data = (unsigned long) adapter;
-+ }
-+ mod_timer(&adapter->blink_timer, jiffies);
- msleep_interruptible(data * 1000);
-+ del_timer_sync(&adapter->blink_timer);
-+ e1000_write_phy_reg(&(adapter->hw), IFE_PHY_SPECIAL_CONTROL_LED, 0);
- } else {
-- E1000_WRITE_REG(&adapter->hw, LEDCTL,
-- (E1000_LEDCTL_LED2_BLINK_RATE |
-- E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK |
-- (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) |
-- (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) |
-- (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT)));
-+ e1000_blink_led_start(&adapter->hw);
- msleep_interruptible(data * 1000);
- }
-
-@@ -1803,10 +1908,8 @@ static int
- e1000_nway_reset(struct net_device *netdev)
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
-- if (netif_running(netdev)) {
-- e1000_down(adapter);
-- e1000_up(adapter);
-- }
-+ if (netif_running(netdev))
-+ e1000_reinit_locked(adapter);
- return 0;
- }
-
-@@ -1875,7 +1978,7 @@ static struct ethtool_ops e1000_ethtool_
- .set_pauseparam = e1000_set_pauseparam,
- .get_rx_csum = e1000_get_rx_csum,
- .set_rx_csum = e1000_set_rx_csum,
-- .get_tx_csum = e1000_get_tx_csum,
-+ .get_tx_csum = e1000_get_tx_csum,
- .set_tx_csum = e1000_set_tx_csum,
- .get_sg = ethtool_op_get_sg,
- .set_sg = ethtool_op_set_sg,
-@@ -1889,8 +1992,8 @@ static struct ethtool_ops e1000_ethtool_
- .phys_id = e1000_phys_id,
- .get_stats_count = e1000_get_stats_count,
- .get_ethtool_stats = e1000_get_ethtool_stats,
--#if 0 /* Not in RHEL4... */
-- .get_perm_addr = ethtool_op_get_perm_addr,
-+#ifdef ETHTOOL_GPERMADDR
-+ .get_perm_addr = ethtool_op_get_perm_addr,
- #endif
- };
-
-@@ -1898,3 +2001,4 @@ void e1000_set_ethtool_ops(struct net_de
- {
- SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops);
- }
-+#endif /* SIOCETHTOOL */
-diff -Nurap ./drivers/net/e1000.e1000/e1000_hw.c ./drivers/net/e1000/e1000_hw.c
---- ./drivers/net/e1000.e1000/e1000_hw.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_hw.c 2006-08-31 14:59:50.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -30,6 +31,7 @@
- * Shared functions for accessing and configuring the MAC
- */
-
-+
- #include "e1000_hw.h"
-
- static int32_t e1000_set_phy_type(struct e1000_hw *hw);
-@@ -68,39 +70,8 @@ static int32_t e1000_polarity_reversal_w
- static int32_t e1000_set_phy_mode(struct e1000_hw *hw);
- static int32_t e1000_host_if_read_cookie(struct e1000_hw *hw, uint8_t *buffer);
- static uint8_t e1000_calculate_mng_checksum(char *buffer, uint32_t length);
--static uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw);
--static int32_t e1000_check_downshift(struct e1000_hw *hw);
--static int32_t e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity);
--static void e1000_clear_hw_cntrs(struct e1000_hw *hw);
--static void e1000_clear_vfta(struct e1000_hw *hw);
--static int32_t e1000_commit_shadow_ram(struct e1000_hw *hw);
--static int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw,
-- boolean_t link_up);
--static int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);
--static int32_t e1000_detect_gig_phy(struct e1000_hw *hw);
--static int32_t e1000_get_auto_rd_done(struct e1000_hw *hw);
--static int32_t e1000_get_cable_length(struct e1000_hw *hw,
-- uint16_t *min_length,
-- uint16_t *max_length);
--static int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
--static int32_t e1000_get_phy_cfg_done(struct e1000_hw *hw);
--static int32_t e1000_id_led_init(struct e1000_hw * hw);
--static void e1000_init_rx_addrs(struct e1000_hw *hw);
--static boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
--static int32_t e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd);
--static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
--static int32_t e1000_read_eeprom_eerd(struct e1000_hw *hw, uint16_t offset,
-- uint16_t words, uint16_t *data);
--static int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active);
--static int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
--static int32_t e1000_wait_autoneg(struct e1000_hw *hw);
--
--static void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset,
-- uint32_t value);
--
--#define E1000_WRITE_REG_IO(a, reg, val) \
-- e1000_write_reg_io((a), E1000_##reg, val)
--static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw);
-+static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw,
-+ uint16_t duplex);
- static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
-
- /* IGP cable length table */
-@@ -137,10 +108,10 @@ e1000_set_phy_type(struct e1000_hw *hw)
- {
- DEBUGFUNC("e1000_set_phy_type");
-
-- if(hw->mac_type == e1000_undefined)
-+ if (hw->mac_type == e1000_undefined)
- return -E1000_ERR_PHY_TYPE;
-
-- switch(hw->phy_id) {
-+ switch (hw->phy_id) {
- case M88E1000_E_PHY_ID:
- case M88E1000_I_PHY_ID:
- case M88E1011_I_PHY_ID:
-@@ -148,13 +119,21 @@ e1000_set_phy_type(struct e1000_hw *hw)
- hw->phy_type = e1000_phy_m88;
- break;
- case IGP01E1000_I_PHY_ID:
-- if(hw->mac_type == e1000_82541 ||
-- hw->mac_type == e1000_82541_rev_2 ||
-- hw->mac_type == e1000_82547 ||
-- hw->mac_type == e1000_82547_rev_2) {
-+ if (hw->mac_type == e1000_82541 ||
-+ hw->mac_type == e1000_82541_rev_2 ||
-+ hw->mac_type == e1000_82547 ||
-+ hw->mac_type == e1000_82547_rev_2) {
- hw->phy_type = e1000_phy_igp;
- break;
- }
-+ case IGP03E1000_E_PHY_ID:
-+ hw->phy_type = e1000_phy_igp_3;
-+ break;
-+ case IFE_E_PHY_ID:
-+ case IFE_PLUS_E_PHY_ID:
-+ case IFE_C_E_PHY_ID:
-+ hw->phy_type = e1000_phy_ife;
-+ break;
- case GG82563_E_PHY_ID:
- if (hw->mac_type == e1000_80003es2lan) {
- hw->phy_type = e1000_phy_gg82563;
-@@ -170,6 +149,7 @@ e1000_set_phy_type(struct e1000_hw *hw)
- return E1000_SUCCESS;
- }
-
-+
- /******************************************************************************
- * IGP phy init script - initializes the GbE PHY
- *
-@@ -183,7 +163,7 @@ e1000_phy_init_script(struct e1000_hw *h
-
- DEBUGFUNC("e1000_phy_init_script");
-
-- if(hw->phy_init_script) {
-+ if (hw->phy_init_script) {
- msec_delay(20);
-
- /* Save off the current value of register 0x2F5B to be restored at
-@@ -199,7 +179,7 @@ e1000_phy_init_script(struct e1000_hw *h
-
- msec_delay(5);
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82541:
- case e1000_82547:
- e1000_write_phy_reg(hw, 0x1F95, 0x0001);
-@@ -236,22 +216,22 @@ e1000_phy_init_script(struct e1000_hw *h
- /* Now enable the transmitter */
- e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
-
-- if(hw->mac_type == e1000_82547) {
-+ if (hw->mac_type == e1000_82547) {
- uint16_t fused, fine, coarse;
-
- /* Move to analog registers page */
- e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused);
-
-- if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) {
-+ if (!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) {
- e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused);
-
- fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK;
- coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK;
-
-- if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) {
-+ if (coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) {
- coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10;
- fine -= IGP01E1000_ANALOG_FUSE_FINE_1;
-- } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH)
-+ } else if (coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH)
- fine -= IGP01E1000_ANALOG_FUSE_FINE_10;
-
- fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) |
-@@ -331,6 +311,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
- break;
- case E1000_DEV_ID_82541EI:
- case E1000_DEV_ID_82541EI_MOBILE:
-+ case E1000_DEV_ID_82541ER_LOM:
- hw->mac_type = e1000_82541;
- break;
- case E1000_DEV_ID_82541ER:
-@@ -340,6 +321,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
- hw->mac_type = e1000_82541_rev_2;
- break;
- case E1000_DEV_ID_82547EI:
-+ case E1000_DEV_ID_82547EI_MOBILE:
- hw->mac_type = e1000_82547;
- break;
- case E1000_DEV_ID_82547GI:
-@@ -348,11 +330,13 @@ e1000_set_mac_type(struct e1000_hw *hw)
- case E1000_DEV_ID_82571EB_COPPER:
- case E1000_DEV_ID_82571EB_FIBER:
- case E1000_DEV_ID_82571EB_SERDES:
-+ case E1000_DEV_ID_82571EB_QUAD_COPPER:
- hw->mac_type = e1000_82571;
- break;
- case E1000_DEV_ID_82572EI_COPPER:
- case E1000_DEV_ID_82572EI_FIBER:
- case E1000_DEV_ID_82572EI_SERDES:
-+ case E1000_DEV_ID_82572EI:
- hw->mac_type = e1000_82572;
- break;
- case E1000_DEV_ID_82573E:
-@@ -360,16 +344,29 @@ e1000_set_mac_type(struct e1000_hw *hw)
- case E1000_DEV_ID_82573L:
- hw->mac_type = e1000_82573;
- break;
-+ case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
-+ case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
- case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
- case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
- hw->mac_type = e1000_80003es2lan;
- break;
-+ case E1000_DEV_ID_ICH8_IGP_M_AMT:
-+ case E1000_DEV_ID_ICH8_IGP_AMT:
-+ case E1000_DEV_ID_ICH8_IGP_C:
-+ case E1000_DEV_ID_ICH8_IFE:
-+ case E1000_DEV_ID_ICH8_IGP_M:
-+ hw->mac_type = e1000_ich8lan;
-+ break;
- default:
- /* Should never have loaded on this device */
- return -E1000_ERR_MAC_TYPE;
- }
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
-+ case e1000_ich8lan:
-+ hw->swfwhw_semaphore_present = TRUE;
-+ hw->asf_firmware_present = TRUE;
-+ break;
- case e1000_80003es2lan:
- hw->swfw_sync_present = TRUE;
- /* fall through */
-@@ -403,7 +400,7 @@ e1000_set_media_type(struct e1000_hw *hw
-
- DEBUGFUNC("e1000_set_media_type");
-
-- if(hw->mac_type != e1000_82543) {
-+ if (hw->mac_type != e1000_82543) {
- /* tbi_compatibility is only valid on 82543 */
- hw->tbi_compatibility_en = FALSE;
- }
-@@ -422,6 +419,7 @@ e1000_set_media_type(struct e1000_hw *hw
- case e1000_82542_rev2_1:
- hw->media_type = e1000_media_type_fiber;
- break;
-+ case e1000_ich8lan:
- case e1000_82573:
- /* The STATUS_TBIMODE bit is reserved or reused for the this
- * device.
-@@ -462,16 +460,16 @@ e1000_reset_hw(struct e1000_hw *hw)
- DEBUGFUNC("e1000_reset_hw");
-
- /* For 82542 (rev 2.0), disable MWI before issuing a device reset */
-- if(hw->mac_type == e1000_82542_rev2_0) {
-+ if (hw->mac_type == e1000_82542_rev2_0) {
- DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
- e1000_pci_clear_mwi(hw);
- }
-
-- if(hw->bus_type == e1000_bus_type_pci_express) {
-+ if (hw->bus_type == e1000_bus_type_pci_express) {
- /* Prevent the PCI-E bus from sticking if there is no TLP connection
- * on the last TLP read/write transaction when MAC is reset.
- */
-- if(e1000_disable_pciex_master(hw) != E1000_SUCCESS) {
-+ if (e1000_disable_pciex_master(hw) != E1000_SUCCESS) {
- DEBUGOUT("PCI-E Master disable polling has failed.\n");
- }
- }
-@@ -499,14 +497,14 @@ e1000_reset_hw(struct e1000_hw *hw)
- ctrl = E1000_READ_REG(hw, CTRL);
-
- /* Must reset the PHY before resetting the MAC */
-- if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
-+ if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST));
- msec_delay(5);
- }
-
- /* Must acquire the MDIO ownership before MAC reset.
- * Ownership defaults to firmware after a reset. */
-- if(hw->mac_type == e1000_82573) {
-+ if (hw->mac_type == e1000_82573) {
- timeout = 10;
-
- extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL);
-@@ -516,14 +514,22 @@ e1000_reset_hw(struct e1000_hw *hw)
- E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl);
- extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL);
-
-- if(extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
-+ if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
- break;
- else
- extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
-
- msec_delay(2);
- timeout--;
-- } while(timeout);
-+ } while (timeout);
-+ }
-+
-+ /* Workaround for ICH8 bit corruption issue in FIFO memory */
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /* Set Tx and Rx buffer allocation to 8k apiece. */
-+ E1000_WRITE_REG(hw, PBA, E1000_PBA_8K);
-+ /* Set Packet Buffer Size to 16k. */
-+ E1000_WRITE_REG(hw, PBS, E1000_PBS_16K);
- }
-
- /* Issue a global reset to the MAC. This will reset the chip's
-@@ -533,7 +539,7 @@ e1000_reset_hw(struct e1000_hw *hw)
- */
- DEBUGOUT("Issuing a global reset to MAC\n");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82544:
- case e1000_82540:
- case e1000_82545:
-@@ -549,6 +555,20 @@ e1000_reset_hw(struct e1000_hw *hw)
- /* Reset is performed on a shadow of the control register */
- E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST));
- break;
-+ case e1000_ich8lan:
-+ if (!hw->phy_reset_disable &&
-+ e1000_check_phy_reset_block(hw) == E1000_SUCCESS) {
-+ /* e1000_ich8lan PHY HW reset requires MAC CORE reset
-+ * at the same time to make sure the interface between
-+ * MAC and the external PHY is reset.
-+ */
-+ ctrl |= E1000_CTRL_PHY_RST;
-+ }
-+
-+ e1000_get_software_flag(hw);
-+ E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST));
-+ msec_delay(5);
-+ break;
- default:
- E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST));
- break;
-@@ -558,13 +578,13 @@ e1000_reset_hw(struct e1000_hw *hw)
- * device. Later controllers reload the EEPROM automatically, so just wait
- * for reload to complete.
- */
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82542_rev2_0:
- case e1000_82542_rev2_1:
- case e1000_82543:
- case e1000_82544:
- /* Wait for reset to complete */
-- udelay(10);
-+ usec_delay(10);
- ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
- ctrl_ext |= E1000_CTRL_EXT_EE_RST;
- E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
-@@ -581,7 +601,7 @@ e1000_reset_hw(struct e1000_hw *hw)
- break;
- case e1000_82573:
- if (e1000_is_onboard_nvm_eeprom(hw) == FALSE) {
-- udelay(10);
-+ usec_delay(10);
- ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
- ctrl_ext |= E1000_CTRL_EXT_EE_RST;
- E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
-@@ -590,9 +610,10 @@ e1000_reset_hw(struct e1000_hw *hw)
- /* fall through */
- case e1000_82571:
- case e1000_82572:
-+ case e1000_ich8lan:
- case e1000_80003es2lan:
- ret_val = e1000_get_auto_rd_done(hw);
-- if(ret_val)
-+ if (ret_val)
- /* We don't want to continue accessing MAC registers. */
- return ret_val;
- break;
-@@ -603,13 +624,13 @@ e1000_reset_hw(struct e1000_hw *hw)
- }
-
- /* Disable HW ARPs on ASF enabled adapters */
-- if(hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) {
-+ if (hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) {
- manc = E1000_READ_REG(hw, MANC);
- manc &= ~(E1000_MANC_ARP_EN);
- E1000_WRITE_REG(hw, MANC, manc);
- }
-
-- if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
-+ if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- e1000_phy_init_script(hw);
-
- /* Configure activity LED after PHY reset */
-@@ -627,11 +648,17 @@ e1000_reset_hw(struct e1000_hw *hw)
- icr = E1000_READ_REG(hw, ICR);
-
- /* If MWI was previously enabled, reenable it. */
-- if(hw->mac_type == e1000_82542_rev2_0) {
-- if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
-+ if (hw->mac_type == e1000_82542_rev2_0) {
-+ if (hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
- e1000_pci_set_mwi(hw);
- }
-
-+ if (hw->mac_type == e1000_ich8lan) {
-+ uint32_t kab = E1000_READ_REG(hw, KABGTXD);
-+ kab |= E1000_KABGTXD_BGSQLBIAS;
-+ E1000_WRITE_REG(hw, KABGTXD, kab);
-+ }
-+
- return E1000_SUCCESS;
- }
-
-@@ -662,9 +689,19 @@ e1000_init_hw(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_init_hw");
-
-+ if (hw->mac_type == e1000_ich8lan) {
-+ reg_data = E1000_READ_REG(hw, TARC0);
-+ reg_data |= 0x30000000;
-+ E1000_WRITE_REG(hw, TARC0, reg_data);
-+
-+ reg_data = E1000_READ_REG(hw, STATUS);
-+ reg_data &= ~0x80000000;
-+ E1000_WRITE_REG(hw, STATUS, reg_data);
-+ }
-+
- /* Initialize Identification LED */
- ret_val = e1000_id_led_init(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Initializing Identification LED\n");
- return ret_val;
- }
-@@ -674,12 +711,15 @@ e1000_init_hw(struct e1000_hw *hw)
-
- /* Disabling VLAN filtering. */
- DEBUGOUT("Initializing the IEEE VLAN\n");
-- if (hw->mac_type < e1000_82545_rev_3)
-- E1000_WRITE_REG(hw, VET, 0);
-- e1000_clear_vfta(hw);
-+ /* VET hardcoded to standard value and VFTA removed in ICH8 LAN */
-+ if (hw->mac_type != e1000_ich8lan) {
-+ if (hw->mac_type < e1000_82545_rev_3)
-+ E1000_WRITE_REG(hw, VET, 0);
-+ e1000_clear_vfta(hw);
-+ }
-
- /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */
-- if(hw->mac_type == e1000_82542_rev2_0) {
-+ if (hw->mac_type == e1000_82542_rev2_0) {
- DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
- e1000_pci_clear_mwi(hw);
- E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST);
-@@ -693,37 +733,43 @@ e1000_init_hw(struct e1000_hw *hw)
- e1000_init_rx_addrs(hw);
-
- /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */
-- if(hw->mac_type == e1000_82542_rev2_0) {
-+ if (hw->mac_type == e1000_82542_rev2_0) {
- E1000_WRITE_REG(hw, RCTL, 0);
- E1000_WRITE_FLUSH(hw);
- msec_delay(1);
-- if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
-+ if (hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
- e1000_pci_set_mwi(hw);
- }
-
- /* Zero out the Multicast HASH table */
- DEBUGOUT("Zeroing the MTA\n");
- mta_size = E1000_MC_TBL_SIZE;
-- for(i = 0; i < mta_size; i++)
-+ if (hw->mac_type == e1000_ich8lan)
-+ mta_size = E1000_MC_TBL_SIZE_ICH8LAN;
-+ for (i = 0; i < mta_size; i++) {
- E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
-+ /* use write flush to prevent Memory Write Block (MWB) from
-+ * occuring when accessing our register space */
-+ E1000_WRITE_FLUSH(hw);
-+ }
-
- /* Set the PCI priority bit correctly in the CTRL register. This
- * determines if the adapter gives priority to receives, or if it
- * gives equal priority to transmits and receives. Valid only on
- * 82542 and 82543 silicon.
- */
-- if(hw->dma_fairness && hw->mac_type <= e1000_82543) {
-+ if (hw->dma_fairness && hw->mac_type <= e1000_82543) {
- ctrl = E1000_READ_REG(hw, CTRL);
- E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR);
- }
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82545_rev_3:
- case e1000_82546_rev_3:
- break;
- default:
- /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */
-- if(hw->bus_type == e1000_bus_type_pcix) {
-+ if (hw->bus_type == e1000_bus_type_pcix) {
- e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word);
- e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI,
- &pcix_stat_hi_word);
-@@ -731,9 +777,9 @@ e1000_init_hw(struct e1000_hw *hw)
- PCIX_COMMAND_MMRBC_SHIFT;
- stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
- PCIX_STATUS_HI_MMRBC_SHIFT;
-- if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
-+ if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
- stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
-- if(cmd_mmrbc > stat_mmrbc) {
-+ if (cmd_mmrbc > stat_mmrbc) {
- pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK;
- pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
- e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER,
-@@ -743,11 +789,15 @@ e1000_init_hw(struct e1000_hw *hw)
- break;
- }
-
-+ /* More time needed for PHY to initialize */
-+ if (hw->mac_type == e1000_ich8lan)
-+ msec_delay(15);
-+
- /* Call a subroutine to configure the link and setup flow control. */
- ret_val = e1000_setup_link(hw);
-
- /* Set the transmit descriptor write-back policy */
-- if(hw->mac_type > e1000_82544) {
-+ if (hw->mac_type > e1000_82544) {
- ctrl = E1000_READ_REG(hw, TXDCTL);
- ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB;
- switch (hw->mac_type) {
-@@ -756,6 +806,7 @@ e1000_init_hw(struct e1000_hw *hw)
- case e1000_82571:
- case e1000_82572:
- case e1000_82573:
-+ case e1000_ich8lan:
- case e1000_80003es2lan:
- ctrl |= E1000_TXDCTL_COUNT_DESC;
- break;
-@@ -764,7 +815,7 @@ e1000_init_hw(struct e1000_hw *hw)
- }
-
- if (hw->mac_type == e1000_82573) {
-- e1000_enable_tx_pkt_filtering(hw);
-+ e1000_enable_tx_pkt_filtering(hw);
- }
-
- switch (hw->mac_type) {
-@@ -794,16 +845,16 @@ e1000_init_hw(struct e1000_hw *hw)
- /* Fall through */
- case e1000_82571:
- case e1000_82572:
-+ case e1000_ich8lan:
- ctrl = E1000_READ_REG(hw, TXDCTL1);
- ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB;
-- if(hw->mac_type >= e1000_82571)
-+ if (hw->mac_type >= e1000_82571)
- ctrl |= E1000_TXDCTL_COUNT_DESC;
- E1000_WRITE_REG(hw, TXDCTL1, ctrl);
- break;
- }
-
-
--
- if (hw->mac_type == e1000_82573) {
- uint32_t gcr = E1000_READ_REG(hw, GCR);
- gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
-@@ -817,6 +868,11 @@ e1000_init_hw(struct e1000_hw *hw)
- */
- e1000_clear_hw_cntrs(hw);
-
-+ /* ICH8 No-snoop bits are opposite polarity.
-+ * Set to snoop by default after reset. */
-+ if (hw->mac_type == e1000_ich8lan)
-+ e1000_set_pci_ex_no_snoop(hw, PCI_EX_82566_SNOOP_ALL);
-+
- if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER ||
- hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) {
- ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
-@@ -842,10 +898,10 @@ e1000_adjust_serdes_amplitude(struct e10
-
- DEBUGFUNC("e1000_adjust_serdes_amplitude");
-
-- if(hw->media_type != e1000_media_type_internal_serdes)
-+ if (hw->media_type != e1000_media_type_internal_serdes)
- return E1000_SUCCESS;
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82545_rev_3:
- case e1000_82546_rev_3:
- break;
-@@ -858,11 +914,11 @@ e1000_adjust_serdes_amplitude(struct e10
- return ret_val;
- }
-
-- if(eeprom_data != EEPROM_RESERVED_WORD) {
-+ if (eeprom_data != EEPROM_RESERVED_WORD) {
- /* Adjust SERDES output amplitude only. */
-- eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK;
-+ eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-@@ -904,6 +960,7 @@ e1000_setup_link(struct e1000_hw *hw)
- */
- if (hw->fc == e1000_fc_default) {
- switch (hw->mac_type) {
-+ case e1000_ich8lan:
- case e1000_82573:
- hw->fc = e1000_fc_full;
- break;
-@@ -929,10 +986,10 @@ e1000_setup_link(struct e1000_hw *hw)
- * in case we get disconnected and then reconnected into a different
- * hub or switch with different Flow Control capabilities.
- */
-- if(hw->mac_type == e1000_82542_rev2_0)
-+ if (hw->mac_type == e1000_82542_rev2_0)
- hw->fc &= (~e1000_fc_tx_pause);
-
-- if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1))
-+ if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1))
- hw->fc &= (~e1000_fc_rx_pause);
-
- hw->original_fc = hw->fc;
-@@ -947,12 +1004,12 @@ e1000_setup_link(struct e1000_hw *hw)
- * or e1000_phy_setup() is called.
- */
- if (hw->mac_type == e1000_82543) {
-- ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG,
-- 1, &eeprom_data);
-- if (ret_val) {
-- DEBUGOUT("EEPROM Read Error\n");
-- return -E1000_ERR_EEPROM;
-- }
-+ ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG,
-+ 1, &eeprom_data);
-+ if (ret_val) {
-+ DEBUGOUT("EEPROM Read Error\n");
-+ return -E1000_ERR_EEPROM;
-+ }
- ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) <<
- SWDPIO__EXT_SHIFT);
- E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
-@@ -970,9 +1027,12 @@ e1000_setup_link(struct e1000_hw *hw)
- */
- DEBUGOUT("Initializing the Flow Control address, type and timer regs\n");
-
-- E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW);
-- E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH);
-- E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE);
-+ /* FCAL/H and FCT are hardcoded to standard values in e1000_ich8lan. */
-+ if (hw->mac_type != e1000_ich8lan) {
-+ E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE);
-+ E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH);
-+ E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW);
-+ }
-
- E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time);
-
-@@ -982,14 +1042,14 @@ e1000_setup_link(struct e1000_hw *hw)
- * ability to transmit pause frames in not enabled, then these
- * registers will be set to 0.
- */
-- if(!(hw->fc & e1000_fc_tx_pause)) {
-+ if (!(hw->fc & e1000_fc_tx_pause)) {
- E1000_WRITE_REG(hw, FCRTL, 0);
- E1000_WRITE_REG(hw, FCRTH, 0);
- } else {
- /* We need to set up the Receive Threshold high and low water marks
- * as well as (optionally) enabling the transmission of XON frames.
- */
-- if(hw->fc_send_xon) {
-+ if (hw->fc_send_xon) {
- E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE));
- E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water);
- } else {
-@@ -1036,11 +1096,11 @@ e1000_setup_fiber_serdes_link(struct e10
- * the EEPROM.
- */
- ctrl = E1000_READ_REG(hw, CTRL);
-- if(hw->media_type == e1000_media_type_fiber)
-+ if (hw->media_type == e1000_media_type_fiber)
- signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
-
- ret_val = e1000_adjust_serdes_amplitude(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Take the link out of reset */
-@@ -1048,7 +1108,7 @@ e1000_setup_fiber_serdes_link(struct e10
-
- /* Adjust VCO speed to improve BER performance */
- ret_val = e1000_set_vco_speed(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- e1000_config_collision_dist(hw);
-@@ -1119,15 +1179,15 @@ e1000_setup_fiber_serdes_link(struct e10
- * less than 500 milliseconds even if the other end is doing it in SW).
- * For internal serdes, we just assume a signal is present, then poll.
- */
-- if(hw->media_type == e1000_media_type_internal_serdes ||
-+ if (hw->media_type == e1000_media_type_internal_serdes ||
- (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) {
- DEBUGOUT("Looking for Link\n");
-- for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) {
-+ for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) {
- msec_delay(10);
- status = E1000_READ_REG(hw, STATUS);
-- if(status & E1000_STATUS_LU) break;
-+ if (status & E1000_STATUS_LU) break;
- }
-- if(i == (LINK_UP_TIMEOUT / 10)) {
-+ if (i == (LINK_UP_TIMEOUT / 10)) {
- DEBUGOUT("Never got a valid link from auto-neg!!!\n");
- hw->autoneg_failed = 1;
- /* AutoNeg failed to achieve a link, so we'll call
-@@ -1136,7 +1196,7 @@ e1000_setup_fiber_serdes_link(struct e10
- * non-autonegotiating link partners.
- */
- ret_val = e1000_check_for_link(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error while checking for link\n");
- return ret_val;
- }
-@@ -1170,7 +1230,7 @@ e1000_copper_link_preconfig(struct e1000
- * the PHY speed and duplex configuration is. In addition, we need to
- * perform a hardware reset on the PHY to take it out of reset.
- */
-- if(hw->mac_type > e1000_82543) {
-+ if (hw->mac_type > e1000_82543) {
- ctrl |= E1000_CTRL_SLU;
- ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
- E1000_WRITE_REG(hw, CTRL, ctrl);
-@@ -1178,13 +1238,13 @@ e1000_copper_link_preconfig(struct e1000
- ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU);
- E1000_WRITE_REG(hw, CTRL, ctrl);
- ret_val = e1000_phy_hw_reset(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
- /* Make sure we have a valid PHY */
- ret_val = e1000_detect_gig_phy(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error, did not detect valid phy.\n");
- return ret_val;
- }
-@@ -1192,19 +1252,19 @@ e1000_copper_link_preconfig(struct e1000
-
- /* Set PHY to class A mode (if necessary) */
- ret_val = e1000_set_phy_mode(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if((hw->mac_type == e1000_82545_rev_3) ||
-+ if ((hw->mac_type == e1000_82545_rev_3) ||
- (hw->mac_type == e1000_82546_rev_3)) {
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
- phy_data |= 0x00000008;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
- }
-
-- if(hw->mac_type <= e1000_82543 ||
-- hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 ||
-- hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2)
-+ if (hw->mac_type <= e1000_82543 ||
-+ hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 ||
-+ hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2)
- hw->phy_reset_disable = FALSE;
-
- return E1000_SUCCESS;
-@@ -1227,27 +1287,31 @@ e1000_copper_link_igp_setup(struct e1000
-
- if (hw->phy_reset_disable)
- return E1000_SUCCESS;
--
-+
- ret_val = e1000_phy_reset(hw);
- if (ret_val) {
- DEBUGOUT("Error Resetting the PHY\n");
- return ret_val;
- }
-
-- /* Wait 10ms for MAC to configure PHY from eeprom settings */
-+ /* Wait 15ms for MAC to configure PHY from eeprom settings */
- msec_delay(15);
--
-+ if (hw->mac_type != e1000_ich8lan) {
- /* Configure activity LED after PHY reset */
- led_ctrl = E1000_READ_REG(hw, LEDCTL);
- led_ctrl &= IGP_ACTIVITY_LED_MASK;
- led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
- E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
-+ }
-
-- /* disable lplu d3 during driver init */
-- ret_val = e1000_set_d3_lplu_state(hw, FALSE);
-- if (ret_val) {
-- DEBUGOUT("Error Disabling LPLU D3\n");
-- return ret_val;
-+ /* The NVM settings will configure LPLU in D3 for IGP2 and IGP3 PHYs */
-+ if (hw->phy_type == e1000_phy_igp) {
-+ /* disable lplu d3 during driver init */
-+ ret_val = e1000_set_d3_lplu_state(hw, FALSE);
-+ if (ret_val) {
-+ DEBUGOUT("Error Disabling LPLU D3\n");
-+ return ret_val;
-+ }
- }
-
- /* disable lplu d0 during driver init */
-@@ -1285,45 +1349,45 @@ e1000_copper_link_igp_setup(struct e1000
- }
- }
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* set auto-master slave resolution settings */
-- if(hw->autoneg) {
-+ if (hw->autoneg) {
- e1000_ms_type phy_ms_setting = hw->master_slave;
-
-- if(hw->ffe_config_state == e1000_ffe_config_active)
-+ if (hw->ffe_config_state == e1000_ffe_config_active)
- hw->ffe_config_state = e1000_ffe_config_enabled;
-
-- if(hw->dsp_config_state == e1000_dsp_config_activated)
-+ if (hw->dsp_config_state == e1000_dsp_config_activated)
- hw->dsp_config_state = e1000_dsp_config_enabled;
-
- /* when autonegotiation advertisment is only 1000Mbps then we
- * should disable SmartSpeed and enable Auto MasterSlave
- * resolution as hardware default. */
-- if(hw->autoneg_advertised == ADVERTISE_1000_FULL) {
-+ if (hw->autoneg_advertised == ADVERTISE_1000_FULL) {
- /* Disable SmartSpeed */
-- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data);
-- if(ret_val)
-+ ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
-+ &phy_data);
-+ if (ret_val)
- return ret_val;
- phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-- ret_val = e1000_write_phy_reg(hw,
-- IGP01E1000_PHY_PORT_CONFIG,
-- phy_data);
-- if(ret_val)
-+ ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
-+ phy_data);
-+ if (ret_val)
- return ret_val;
- /* Set auto Master/Slave resolution process */
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- phy_data &= ~CR_1000T_MS_ENABLE;
- ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* load defaults for future use */
-@@ -1347,7 +1411,7 @@ e1000_copper_link_igp_setup(struct e1000
- break;
- }
- ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-@@ -1368,12 +1432,12 @@ e1000_copper_link_ggp_setup(struct e1000
-
- DEBUGFUNC("e1000_copper_link_ggp_setup");
-
-- if(!hw->phy_reset_disable) {
--
-+ if (!hw->phy_reset_disable) {
-+
- /* Enable CRS on TX for half-duplex operation. */
- ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
-@@ -1382,7 +1446,7 @@ e1000_copper_link_ggp_setup(struct e1000
-
- ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Options:
-@@ -1393,7 +1457,7 @@ e1000_copper_link_ggp_setup(struct e1000
- * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
- */
- ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK;
-@@ -1418,11 +1482,11 @@ e1000_copper_link_ggp_setup(struct e1000
- * 1 - Enabled
- */
- phy_data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
-- if(hw->disable_polarity_correction == 1)
-+ if (hw->disable_polarity_correction == 1)
- phy_data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
- ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* SW Reset the PHY so all changes take effect */
-@@ -1477,11 +1541,10 @@ e1000_copper_link_ggp_setup(struct e1000
- if (ret_val)
- return ret_val;
-
-- /* Enable Pass False Carrier on the PHY */
-- phy_data |= GG82563_KMCR_PASS_FALSE_CARRIER;
--
-+ phy_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
- ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
- phy_data);
-+
- if (ret_val)
- return ret_val;
- }
-@@ -1516,12 +1579,12 @@ e1000_copper_link_mgp_setup(struct e1000
-
- DEBUGFUNC("e1000_copper_link_mgp_setup");
-
-- if(hw->phy_reset_disable)
-+ if (hw->phy_reset_disable)
- return E1000_SUCCESS;
--
-+
- /* Enable CRS on TX. This must be set for half-duplex operation. */
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
-@@ -1558,35 +1621,47 @@ e1000_copper_link_mgp_setup(struct e1000
- * 1 - Enabled
- */
- phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
-- if(hw->disable_polarity_correction == 1)
-+ if (hw->disable_polarity_correction == 1)
- phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
-- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-- if(ret_val)
-- return ret_val;
--
-- /* Force TX_CLK in the Extended PHY Specific Control Register
-- * to 25MHz clock.
-- */
-- ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-+ if (ret_val)
- return ret_val;
-
-- phy_data |= M88E1000_EPSCR_TX_CLK_25;
--
- if (hw->phy_revision < M88E1011_I_REV_4) {
-- /* Configure Master and Slave downshift values */
-- phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
-+ /* Force TX_CLK in the Extended PHY Specific Control Register
-+ * to 25MHz clock.
-+ */
-+ ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data |= M88E1000_EPSCR_TX_CLK_25;
-+
-+ if ((hw->phy_revision == E1000_REVISION_2) &&
-+ (hw->phy_id == M88E1111_I_PHY_ID)) {
-+ /* Vidalia Phy, set the downshift counter to 5x */
-+ phy_data &= ~(M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK);
-+ phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X;
-+ ret_val = e1000_write_phy_reg(hw,
-+ M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
-+ if (ret_val)
-+ return ret_val;
-+ } else {
-+ /* Configure Master and Slave downshift values */
-+ phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
- M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK);
-- phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
-+ phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
- M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
-- ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
-- if(ret_val)
-- return ret_val;
-+ ret_val = e1000_write_phy_reg(hw,
-+ M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
-+ if (ret_val)
-+ return ret_val;
-+ }
- }
-
- /* SW Reset the PHY so all changes take effect */
- ret_val = e1000_phy_reset(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Resetting the PHY\n");
- return ret_val;
- }
-@@ -1616,12 +1691,16 @@ e1000_copper_link_autoneg(struct e1000_h
- /* If autoneg_advertised is zero, we assume it was not defaulted
- * by the calling code so we set to advertise full capability.
- */
-- if(hw->autoneg_advertised == 0)
-+ if (hw->autoneg_advertised == 0)
- hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
-
-+ /* IFE phy only supports 10/100 */
-+ if (hw->phy_type == e1000_phy_ife)
-+ hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL;
-+
- DEBUGOUT("Reconfiguring auto-neg advertisement params\n");
- ret_val = e1000_phy_setup_autoneg(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Setting up Auto-Negotiation\n");
- return ret_val;
- }
-@@ -1631,20 +1710,20 @@ e1000_copper_link_autoneg(struct e1000_h
- * the Auto Neg Restart bit in the PHY control register.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
- ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Does the user want to wait for Auto-Neg to complete here, or
- * check at a later time (for example, callback routine).
- */
-- if(hw->wait_autoneg_complete) {
-+ if (hw->wait_autoneg_complete) {
- ret_val = e1000_wait_autoneg(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error while waiting for autoneg to complete\n");
- return ret_val;
- }
-@@ -1655,7 +1734,6 @@ e1000_copper_link_autoneg(struct e1000_h
- return E1000_SUCCESS;
- }
-
--
- /******************************************************************************
- * Config the MAC and the PHY after link is up.
- * 1) Set up the MAC to the current PHY speed/duplex
-@@ -1664,7 +1742,7 @@ e1000_copper_link_autoneg(struct e1000_h
- * collision distance in the Transmit Control Register.
- * 2) Set up flow control on the MAC to that established with
- * the link partner.
--* 3) Config DSP to improve Gigabit link quality for some PHY revisions.
-+* 3) Config DSP to improve Gigabit link quality for some PHY revisions.
- *
- * hw - Struct containing variables accessed by shared code
- ******************************************************************************/
-@@ -1673,31 +1751,31 @@ e1000_copper_link_postconfig(struct e100
- {
- int32_t ret_val;
- DEBUGFUNC("e1000_copper_link_postconfig");
--
-- if(hw->mac_type >= e1000_82544) {
-+
-+ if (hw->mac_type >= e1000_82544) {
- e1000_config_collision_dist(hw);
- } else {
- ret_val = e1000_config_mac_to_phy(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error configuring MAC to PHY settings\n");
- return ret_val;
- }
- }
- ret_val = e1000_config_fc_after_link_up(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Configuring Flow Control\n");
- return ret_val;
- }
-
- /* Config DSP to improve Giga link quality */
-- if(hw->phy_type == e1000_phy_igp) {
-+ if (hw->phy_type == e1000_phy_igp) {
- ret_val = e1000_config_dsp_after_link_change(hw, TRUE);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Configuring DSP after link up\n");
- return ret_val;
- }
- }
--
-+
- return E1000_SUCCESS;
- }
-
-@@ -1716,17 +1794,35 @@ e1000_setup_copper_link(struct e1000_hw
-
- DEBUGFUNC("e1000_setup_copper_link");
-
-+ switch (hw->mac_type) {
-+ case e1000_80003es2lan:
-+ case e1000_ich8lan:
-+ /* Set the mac to wait the maximum time between each
-+ * iteration and increase the max iterations when
-+ * polling the phy; this fixes erroneous timeouts at 10Mbps. */
-+ ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
-+ if (ret_val)
-+ return ret_val;
-+ ret_val = e1000_read_kmrn_reg(hw, GG82563_REG(0x34, 9), &reg_data);
-+ if (ret_val)
-+ return ret_val;
-+ reg_data |= 0x3F;
-+ ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
-+ if (ret_val)
-+ return ret_val;
-+ default:
-+ break;
-+ }
-+
- /* Check if it is a valid PHY and set PHY mode if necessary. */
- ret_val = e1000_copper_link_preconfig(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- switch (hw->mac_type) {
- case e1000_80003es2lan:
-- ret_val = e1000_read_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL,
-- &reg_data);
-- if (ret_val)
-- return ret_val;
-+ /* Kumeran registers are written-only */
-+ reg_data = E1000_KUMCTRLSTA_INB_CTRL_LINK_STATUS_TX_TIMEOUT_DEFAULT;
- reg_data |= E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING;
- ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL,
- reg_data);
-@@ -1738,32 +1834,33 @@ e1000_setup_copper_link(struct e1000_hw
- }
-
- if (hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2) {
- ret_val = e1000_copper_link_igp_setup(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else if (hw->phy_type == e1000_phy_m88) {
- ret_val = e1000_copper_link_mgp_setup(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else if (hw->phy_type == e1000_phy_gg82563) {
- ret_val = e1000_copper_link_ggp_setup(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-- if(hw->autoneg) {
-- /* Setup autoneg and flow control advertisement
-- * and perform autonegotiation */
-+ if (hw->autoneg) {
-+ /* Setup autoneg and flow control advertisement
-+ * and perform autonegotiation */
- ret_val = e1000_copper_link_autoneg(hw);
-- if(ret_val)
-- return ret_val;
-+ if (ret_val)
-+ return ret_val;
- } else {
- /* PHY will be set to 10H, 10F, 100H,or 100F
- * depending on value from forced_speed_duplex. */
- DEBUGOUT("Forcing speed and duplex\n");
- ret_val = e1000_phy_force_speed_duplex(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Forcing Speed and Duplex\n");
- return ret_val;
- }
-@@ -1772,24 +1869,24 @@ e1000_setup_copper_link(struct e1000_hw
- /* Check link status. Wait up to 100 microseconds for link to become
- * valid.
- */
-- for(i = 0; i < 10; i++) {
-+ for (i = 0; i < 10; i++) {
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(phy_data & MII_SR_LINK_STATUS) {
-+ if (phy_data & MII_SR_LINK_STATUS) {
- /* Config the MAC and PHY after link is up */
- ret_val = e1000_copper_link_postconfig(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
--
-+
- DEBUGOUT("Valid link established!!!\n");
- return E1000_SUCCESS;
- }
-- udelay(10);
-+ usec_delay(10);
- }
-
- DEBUGOUT("Unable to establish link!!!\n");
-@@ -1802,7 +1899,7 @@ e1000_setup_copper_link(struct e1000_hw
- * hw - Struct containing variables accessed by shared code
- ******************************************************************************/
- static int32_t
--e1000_configure_kmrn_for_10_100(struct e1000_hw *hw)
-+e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, uint16_t duplex)
- {
- int32_t ret_val = E1000_SUCCESS;
- uint32_t tipg;
-@@ -1822,6 +1919,18 @@ e1000_configure_kmrn_for_10_100(struct e
- tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_10_100;
- E1000_WRITE_REG(hw, TIPG, tipg);
-
-+ ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data);
-+
-+ if (ret_val)
-+ return ret_val;
-+
-+ if (duplex == HALF_DUPLEX)
-+ reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER;
-+ else
-+ reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
-+
-+ ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
-+
- return ret_val;
- }
-
-@@ -1846,6 +1955,14 @@ e1000_configure_kmrn_for_1000(struct e10
- tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000;
- E1000_WRITE_REG(hw, TIPG, tipg);
-
-+ ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data);
-+
-+ if (ret_val)
-+ return ret_val;
-+
-+ reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
-+ ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
-+
- return ret_val;
- }
-
-@@ -1865,13 +1982,16 @@ e1000_phy_setup_autoneg(struct e1000_hw
-
- /* Read the MII Auto-Neg Advertisement Register (Address 4). */
- ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- /* Read the MII 1000Base-T Control Register (Address 9). */
-- ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
-- if(ret_val)
-- return ret_val;
-+ if (hw->phy_type != e1000_phy_ife) {
-+ /* Read the MII 1000Base-T Control Register (Address 9). */
-+ ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
-+ if (ret_val)
-+ return ret_val;
-+ } else
-+ mii_1000t_ctrl_reg=0;
-
- /* Need to parse both autoneg_advertised and fc and set up
- * the appropriate PHY registers. First we will parse for
-@@ -1890,38 +2010,41 @@ e1000_phy_setup_autoneg(struct e1000_hw
- DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised);
-
- /* Do we want to advertise 10 Mb Half Duplex? */
-- if(hw->autoneg_advertised & ADVERTISE_10_HALF) {
-+ if (hw->autoneg_advertised & ADVERTISE_10_HALF) {
- DEBUGOUT("Advertise 10mb Half duplex\n");
- mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
- }
-
- /* Do we want to advertise 10 Mb Full Duplex? */
-- if(hw->autoneg_advertised & ADVERTISE_10_FULL) {
-+ if (hw->autoneg_advertised & ADVERTISE_10_FULL) {
- DEBUGOUT("Advertise 10mb Full duplex\n");
- mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
- }
-
- /* Do we want to advertise 100 Mb Half Duplex? */
-- if(hw->autoneg_advertised & ADVERTISE_100_HALF) {
-+ if (hw->autoneg_advertised & ADVERTISE_100_HALF) {
- DEBUGOUT("Advertise 100mb Half duplex\n");
- mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
- }
-
- /* Do we want to advertise 100 Mb Full Duplex? */
-- if(hw->autoneg_advertised & ADVERTISE_100_FULL) {
-+ if (hw->autoneg_advertised & ADVERTISE_100_FULL) {
- DEBUGOUT("Advertise 100mb Full duplex\n");
- mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
- }
-
- /* We do not allow the Phy to advertise 1000 Mb Half Duplex */
-- if(hw->autoneg_advertised & ADVERTISE_1000_HALF) {
-+ if (hw->autoneg_advertised & ADVERTISE_1000_HALF) {
- DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n");
- }
-
- /* Do we want to advertise 1000 Mb Full Duplex? */
-- if(hw->autoneg_advertised & ADVERTISE_1000_FULL) {
-+ if (hw->autoneg_advertised & ADVERTISE_1000_FULL) {
- DEBUGOUT("Advertise 1000mb Full duplex\n");
- mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
-+ if (hw->phy_type == e1000_phy_ife) {
-+ DEBUGOUT("e1000_phy_ife is a 10/100 PHY. Gigabit speed is not supported.\n");
-+ }
- }
-
- /* Check for a software override of the flow control settings, and
-@@ -1978,14 +2101,16 @@ e1000_phy_setup_autoneg(struct e1000_hw
- }
-
- ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
-
-- ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
-- if(ret_val)
-- return ret_val;
-+ if (hw->phy_type != e1000_phy_ife) {
-+ ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
-+ if (ret_val)
-+ return ret_val;
-+ }
-
- return E1000_SUCCESS;
- }
-@@ -2024,7 +2149,7 @@ e1000_phy_force_speed_duplex(struct e100
-
- /* Read the MII Control Register. */
- ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* We need to disable autoneg in order to force link and duplex. */
-@@ -2032,8 +2157,8 @@ e1000_phy_force_speed_duplex(struct e100
- mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN;
-
- /* Are we forcing Full or Half Duplex? */
-- if(hw->forced_speed_duplex == e1000_100_full ||
-- hw->forced_speed_duplex == e1000_10_full) {
-+ if (hw->forced_speed_duplex == e1000_100_full ||
-+ hw->forced_speed_duplex == e1000_10_full) {
- /* We want to force full duplex so we SET the full duplex bits in the
- * Device and MII Control Registers.
- */
-@@ -2050,7 +2175,7 @@ e1000_phy_force_speed_duplex(struct e100
- }
-
- /* Are we forcing 100Mbps??? */
-- if(hw->forced_speed_duplex == e1000_100_full ||
-+ if (hw->forced_speed_duplex == e1000_100_full ||
- hw->forced_speed_duplex == e1000_100_half) {
- /* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */
- ctrl |= E1000_CTRL_SPD_100;
-@@ -2073,7 +2198,7 @@ e1000_phy_force_speed_duplex(struct e100
- if ((hw->phy_type == e1000_phy_m88) ||
- (hw->phy_type == e1000_phy_gg82563)) {
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
-@@ -2081,35 +2206,47 @@ e1000_phy_force_speed_duplex(struct e100
- */
- phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data);
-
- /* Need to reset the PHY or these changes will be ignored */
- mii_ctrl_reg |= MII_CR_RESET;
-+ /* Disable MDI-X support for 10/100 */
-+ } else if (hw->phy_type == e1000_phy_ife) {
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data &= ~IFE_PMC_AUTO_MDIX;
-+ phy_data &= ~IFE_PMC_FORCE_MDIX;
-+
-+ ret_val = e1000_write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, phy_data);
-+ if (ret_val)
-+ return ret_val;
- } else {
- /* Clear Auto-Crossover to force MDI manually. IGP requires MDI
- * forced whenever speed or duplex are forced.
- */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX;
- phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
-
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
- /* Write back the modified PHY MII control register. */
- ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- udelay(1);
-+ usec_delay(1);
-
- /* The wait_autoneg_complete flag may be a little misleading here.
- * Since we are forcing speed and duplex, Auto-Neg is not enabled.
-@@ -2118,50 +2255,50 @@ e1000_phy_force_speed_duplex(struct e100
- * only if the user has set wait_autoneg_complete to 1, which is
- * the default.
- */
-- if(hw->wait_autoneg_complete) {
-+ if (hw->wait_autoneg_complete) {
- /* We will wait for autoneg to complete. */
- DEBUGOUT("Waiting for forced speed/duplex link.\n");
- mii_status_reg = 0;
-
- /* We will wait for autoneg to complete or 4.5 seconds to expire. */
-- for(i = PHY_FORCE_TIME; i > 0; i--) {
-+ for (i = PHY_FORCE_TIME; i > 0; i--) {
- /* Read the MII Status Register and wait for Auto-Neg Complete bit
- * to be set.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(mii_status_reg & MII_SR_LINK_STATUS) break;
-+ if (mii_status_reg & MII_SR_LINK_STATUS) break;
- msec_delay(100);
- }
-- if((i == 0) &&
-+ if ((i == 0) &&
- ((hw->phy_type == e1000_phy_m88) ||
- (hw->phy_type == e1000_phy_gg82563))) {
- /* We didn't get link. Reset the DSP and wait again for link. */
- ret_val = e1000_phy_reset_dsp(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error Resetting PHY DSP\n");
- return ret_val;
- }
- }
- /* This loop will early-out if the link condition has been met. */
-- for(i = PHY_FORCE_TIME; i > 0; i--) {
-- if(mii_status_reg & MII_SR_LINK_STATUS) break;
-+ for (i = PHY_FORCE_TIME; i > 0; i--) {
-+ if (mii_status_reg & MII_SR_LINK_STATUS) break;
- msec_delay(100);
- /* Read the MII Status Register and wait for Auto-Neg Complete bit
- * to be set.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
- }
-@@ -2172,32 +2309,31 @@ e1000_phy_force_speed_duplex(struct e100
- * defaults back to a 2.5MHz clock when the PHY is reset.
- */
- ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= M88E1000_EPSCR_TX_CLK_25;
- ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* In addition, because of the s/w reset above, we need to enable CRS on
- * TX. This must be set for both full and half duplex operation.
- */
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
-- (!hw->autoneg) &&
-- (hw->forced_speed_duplex == e1000_10_full ||
-- hw->forced_speed_duplex == e1000_10_half)) {
-+ if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
-+ (!hw->autoneg) && (hw->forced_speed_duplex == e1000_10_full ||
-+ hw->forced_speed_duplex == e1000_10_half)) {
- ret_val = e1000_polarity_reversal_workaround(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
- } else if (hw->phy_type == e1000_phy_gg82563) {
-@@ -2272,7 +2408,7 @@ e1000_config_mac_to_phy(struct e1000_hw
-
- DEBUGFUNC("e1000_config_mac_to_phy");
-
-- /* 82544 or newer MAC, Auto Speed Detection takes care of
-+ /* 82544 or newer MAC, Auto Speed Detection takes care of
- * MAC speed/duplex configuration.*/
- if (hw->mac_type >= e1000_82544)
- return E1000_SUCCESS;
-@@ -2288,12 +2424,12 @@ e1000_config_mac_to_phy(struct e1000_hw
- * registers depending on negotiated values.
- */
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(phy_data & M88E1000_PSSR_DPLX)
-+ if (phy_data & M88E1000_PSSR_DPLX)
- ctrl |= E1000_CTRL_FD;
-- else
-+ else
- ctrl &= ~E1000_CTRL_FD;
-
- e1000_config_collision_dist(hw);
-@@ -2301,9 +2437,9 @@ e1000_config_mac_to_phy(struct e1000_hw
- /* Set up speed in the Device Control register depending on
- * negotiated values.
- */
-- if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS)
-+ if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS)
- ctrl |= E1000_CTRL_SPD_1000;
-- else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS)
-+ else if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS)
- ctrl |= E1000_CTRL_SPD_100;
-
- /* Write the configured values back to the Device Control Reg. */
-@@ -2371,7 +2507,7 @@ e1000_force_mac_fc(struct e1000_hw *hw)
- }
-
- /* Disable TX Flow Control for 82542 (rev 2.0) */
-- if(hw->mac_type == e1000_82542_rev2_0)
-+ if (hw->mac_type == e1000_82542_rev2_0)
- ctrl &= (~E1000_CTRL_TFCE);
-
- E1000_WRITE_REG(hw, CTRL, ctrl);
-@@ -2389,7 +2525,7 @@ e1000_force_mac_fc(struct e1000_hw *hw)
- * based on the flow control negotiated by the PHY. In TBI mode, the TFCE
- * and RFCE bits will be automaticaly set to the negotiated flow control mode.
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_config_fc_after_link_up(struct e1000_hw *hw)
- {
- int32_t ret_val;
-@@ -2405,11 +2541,12 @@ e1000_config_fc_after_link_up(struct e10
- * so we had to force link. In this case, we need to force the
- * configuration of the MAC to match the "fc" parameter.
- */
-- if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) ||
-- ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed)) ||
-- ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) {
-+ if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) ||
-+ ((hw->media_type == e1000_media_type_internal_serdes) &&
-+ (hw->autoneg_failed)) ||
-+ ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) {
- ret_val = e1000_force_mac_fc(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error forcing flow control settings\n");
- return ret_val;
- }
-@@ -2420,19 +2557,19 @@ e1000_config_fc_after_link_up(struct e10
- * has completed, and if so, how the PHY and link partner has
- * flow control configured.
- */
-- if((hw->media_type == e1000_media_type_copper) && hw->autoneg) {
-+ if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) {
- /* Read the MII Status Register and check to see if AutoNeg
- * has completed. We read this twice because this reg has
- * some "sticky" (latched) bits.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) {
-+ if (mii_status_reg & MII_SR_AUTONEG_COMPLETE) {
- /* The AutoNeg process has completed, so we now need to
- * read both the Auto Negotiation Advertisement Register
- * (Address 4) and the Auto_Negotiation Base Page Ability
-@@ -2441,11 +2578,11 @@ e1000_config_fc_after_link_up(struct e10
- */
- ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV,
- &mii_nway_adv_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY,
- &mii_nway_lp_ability_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Two bits in the Auto Negotiation Advertisement Register
-@@ -2482,20 +2619,20 @@ e1000_config_fc_after_link_up(struct e10
- * 1 | DC | 1 | DC | e1000_fc_full
- *
- */
-- if((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-- (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
-+ if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-+ (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
- /* Now we need to check if the user selected RX ONLY
- * of pause frames. In this case, we had to advertise
- * FULL flow control because we could not advertise RX
- * ONLY. Hence, we must now check to see if we need to
- * turn OFF the TRANSMISSION of PAUSE frames.
- */
-- if(hw->original_fc == e1000_fc_full) {
-+ if (hw->original_fc == e1000_fc_full) {
- hw->fc = e1000_fc_full;
-- DEBUGOUT("Flow Control = FULL.\r\n");
-+ DEBUGOUT("Flow Control = FULL.\n");
- } else {
- hw->fc = e1000_fc_rx_pause;
-- DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
-+ DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
- }
- }
- /* For receiving PAUSE frames ONLY.
-@@ -2506,12 +2643,12 @@ e1000_config_fc_after_link_up(struct e10
- * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
- *
- */
-- else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-- (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-- (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-- (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
-+ else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-+ (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-+ (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-+ (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
- hw->fc = e1000_fc_tx_pause;
-- DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n");
-+ DEBUGOUT("Flow Control = TX PAUSE frames only.\n");
- }
- /* For transmitting PAUSE frames ONLY.
- *
-@@ -2521,12 +2658,12 @@ e1000_config_fc_after_link_up(struct e10
- * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
- *
- */
-- else if((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-- (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-- !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-- (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
-+ else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-+ (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-+ !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-+ (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
- hw->fc = e1000_fc_rx_pause;
-- DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
-+ DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
- }
- /* Per the IEEE spec, at this point flow control should be
- * disabled. However, we want to consider that we could
-@@ -2548,14 +2685,14 @@ e1000_config_fc_after_link_up(struct e10
- * be asked to delay transmission of packets than asking
- * our link partner to pause transmission of frames.
- */
-- else if((hw->original_fc == e1000_fc_none ||
-- hw->original_fc == e1000_fc_tx_pause) ||
-- hw->fc_strict_ieee) {
-+ else if ((hw->original_fc == e1000_fc_none ||
-+ hw->original_fc == e1000_fc_tx_pause) ||
-+ hw->fc_strict_ieee) {
- hw->fc = e1000_fc_none;
-- DEBUGOUT("Flow Control = NONE.\r\n");
-+ DEBUGOUT("Flow Control = NONE.\n");
- } else {
- hw->fc = e1000_fc_rx_pause;
-- DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
-+ DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
- }
-
- /* Now we need to do one last check... If we auto-
-@@ -2563,24 +2700,24 @@ e1000_config_fc_after_link_up(struct e10
- * enabled per IEEE 802.3 spec.
- */
- ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error getting link speed and duplex\n");
- return ret_val;
- }
-
-- if(duplex == HALF_DUPLEX)
-+ if (duplex == HALF_DUPLEX)
- hw->fc = e1000_fc_none;
-
- /* Now we call a subroutine to actually force the MAC
- * controller to use the correct flow control settings.
- */
- ret_val = e1000_force_mac_fc(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error forcing flow control settings\n");
- return ret_val;
- }
- } else {
-- DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n");
-+ DEBUGOUT("Copper PHY and Auto Neg has not completed.\n");
- }
- }
- return E1000_SUCCESS;
-@@ -2614,13 +2751,13 @@ e1000_check_for_link(struct e1000_hw *hw
- * set when the optics detect a signal. On older adapters, it will be
- * cleared when there is a signal. This applies to fiber media only.
- */
-- if((hw->media_type == e1000_media_type_fiber) ||
-- (hw->media_type == e1000_media_type_internal_serdes)) {
-+ if ((hw->media_type == e1000_media_type_fiber) ||
-+ (hw->media_type == e1000_media_type_internal_serdes)) {
- rxcw = E1000_READ_REG(hw, RXCW);
-
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
-- if(status & E1000_STATUS_LU)
-+ if (status & E1000_STATUS_LU)
- hw->get_link_status = FALSE;
- }
- }
-@@ -2631,20 +2768,20 @@ e1000_check_for_link(struct e1000_hw *hw
- * receive a Link Status Change interrupt or we have Rx Sequence
- * Errors.
- */
-- if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) {
-+ if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) {
- /* First we want to see if the MII Status Register reports
- * link. If so, then we want to get the current speed/duplex
- * of the PHY.
- * Read the register twice since the link bit is sticky.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(phy_data & MII_SR_LINK_STATUS) {
-+ if (phy_data & MII_SR_LINK_STATUS) {
- hw->get_link_status = FALSE;
- /* Check if there was DownShift, must be checked immediately after
- * link-up */
-@@ -2658,10 +2795,10 @@ e1000_check_for_link(struct e1000_hw *hw
- * happen due to the execution of this workaround.
- */
-
-- if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
-- (!hw->autoneg) &&
-- (hw->forced_speed_duplex == e1000_10_full ||
-- hw->forced_speed_duplex == e1000_10_half)) {
-+ if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
-+ (!hw->autoneg) &&
-+ (hw->forced_speed_duplex == e1000_10_full ||
-+ hw->forced_speed_duplex == e1000_10_half)) {
- E1000_WRITE_REG(hw, IMC, 0xffffffff);
- ret_val = e1000_polarity_reversal_workaround(hw);
- icr = E1000_READ_REG(hw, ICR);
-@@ -2678,7 +2815,7 @@ e1000_check_for_link(struct e1000_hw *hw
- /* If we are forcing speed/duplex, then we simply return since
- * we have already determined whether we have link or not.
- */
-- if(!hw->autoneg) return -E1000_ERR_CONFIG;
-+ if (!hw->autoneg) return -E1000_ERR_CONFIG;
-
- /* optimize the dsp settings for the igp phy */
- e1000_config_dsp_after_link_change(hw, TRUE);
-@@ -2691,11 +2828,11 @@ e1000_check_for_link(struct e1000_hw *hw
- * speed/duplex on the MAC to the current PHY speed/duplex
- * settings.
- */
-- if(hw->mac_type >= e1000_82544)
-+ if (hw->mac_type >= e1000_82544)
- e1000_config_collision_dist(hw);
- else {
- ret_val = e1000_config_mac_to_phy(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error configuring MAC to PHY settings\n");
- return ret_val;
- }
-@@ -2706,7 +2843,7 @@ e1000_check_for_link(struct e1000_hw *hw
- * have had to re-autoneg with a different link partner.
- */
- ret_val = e1000_config_fc_after_link_up(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error configuring flow control\n");
- return ret_val;
- }
-@@ -2718,14 +2855,18 @@ e1000_check_for_link(struct e1000_hw *hw
- * at gigabit speed, then TBI compatibility is not needed. If we are
- * at gigabit speed, we turn on TBI compatibility.
- */
-- if(hw->tbi_compatibility_en) {
-+ if (hw->tbi_compatibility_en) {
- uint16_t speed, duplex;
-- e1000_get_speed_and_duplex(hw, &speed, &duplex);
-- if(speed != SPEED_1000) {
-+ ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);
-+ if (ret_val) {
-+ DEBUGOUT("Error getting link speed and duplex\n");
-+ return ret_val;
-+ }
-+ if (speed != SPEED_1000) {
- /* If link speed is not set to gigabit speed, we do not need
- * to enable TBI compatibility.
- */
-- if(hw->tbi_compatibility_on) {
-+ if (hw->tbi_compatibility_on) {
- /* If we previously were in the mode, turn it off. */
- rctl = E1000_READ_REG(hw, RCTL);
- rctl &= ~E1000_RCTL_SBP;
-@@ -2738,7 +2879,7 @@ e1000_check_for_link(struct e1000_hw *hw
- * packets. Some frames have an additional byte on the end and
- * will look like CRC errors to to the hardware.
- */
-- if(!hw->tbi_compatibility_on) {
-+ if (!hw->tbi_compatibility_on) {
- hw->tbi_compatibility_on = TRUE;
- rctl = E1000_READ_REG(hw, RCTL);
- rctl |= E1000_RCTL_SBP;
-@@ -2754,16 +2895,16 @@ e1000_check_for_link(struct e1000_hw *hw
- * auto-negotiation time to complete, in case the cable was just plugged
- * in. The autoneg_failed flag does this.
- */
-- else if((((hw->media_type == e1000_media_type_fiber) &&
-+ else if ((((hw->media_type == e1000_media_type_fiber) &&
- ((ctrl & E1000_CTRL_SWDPIN1) == signal)) ||
-- (hw->media_type == e1000_media_type_internal_serdes)) &&
-- (!(status & E1000_STATUS_LU)) &&
-- (!(rxcw & E1000_RXCW_C))) {
-- if(hw->autoneg_failed == 0) {
-+ (hw->media_type == e1000_media_type_internal_serdes)) &&
-+ (!(status & E1000_STATUS_LU)) &&
-+ (!(rxcw & E1000_RXCW_C))) {
-+ if (hw->autoneg_failed == 0) {
- hw->autoneg_failed = 1;
- return 0;
- }
-- DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n");
-+ DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
-
- /* Disable auto-negotiation in the TXCW register */
- E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE));
-@@ -2775,7 +2916,7 @@ e1000_check_for_link(struct e1000_hw *hw
-
- /* Configure Flow Control after forcing link up. */
- ret_val = e1000_config_fc_after_link_up(hw);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error configuring flow control\n");
- return ret_val;
- }
-@@ -2785,10 +2926,10 @@ e1000_check_for_link(struct e1000_hw *hw
- * Device Control register in an attempt to auto-negotiate with our link
- * partner.
- */
-- else if(((hw->media_type == e1000_media_type_fiber) ||
-- (hw->media_type == e1000_media_type_internal_serdes)) &&
-- (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
-- DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n");
-+ else if (((hw->media_type == e1000_media_type_fiber) ||
-+ (hw->media_type == e1000_media_type_internal_serdes)) &&
-+ (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
-+ DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
- E1000_WRITE_REG(hw, TXCW, hw->txcw);
- E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU));
-
-@@ -2797,12 +2938,12 @@ e1000_check_for_link(struct e1000_hw *hw
- /* If we force link for non-auto-negotiation switch, check link status
- * based on MAC synchronization for internal serdes media type.
- */
-- else if((hw->media_type == e1000_media_type_internal_serdes) &&
-- !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) {
-+ else if ((hw->media_type == e1000_media_type_internal_serdes) &&
-+ !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) {
- /* SYNCH bit and IV bit are sticky. */
-- udelay(10);
-- if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) {
-- if(!(rxcw & E1000_RXCW_IV)) {
-+ usec_delay(10);
-+ if (E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) {
-+ if (!(rxcw & E1000_RXCW_IV)) {
- hw->serdes_link_down = FALSE;
- DEBUGOUT("SERDES: Link is up.\n");
- }
-@@ -2811,8 +2952,8 @@ e1000_check_for_link(struct e1000_hw *hw
- DEBUGOUT("SERDES: Link is down.\n");
- }
- }
-- if((hw->media_type == e1000_media_type_internal_serdes) &&
-- (E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) {
-+ if ((hw->media_type == e1000_media_type_internal_serdes) &&
-+ (E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) {
- hw->serdes_link_down = !(E1000_STATUS_LU & E1000_READ_REG(hw, STATUS));
- }
- return E1000_SUCCESS;
-@@ -2836,12 +2977,12 @@ e1000_get_speed_and_duplex(struct e1000_
-
- DEBUGFUNC("e1000_get_speed_and_duplex");
-
-- if(hw->mac_type >= e1000_82543) {
-+ if (hw->mac_type >= e1000_82543) {
- status = E1000_READ_REG(hw, STATUS);
-- if(status & E1000_STATUS_SPEED_1000) {
-+ if (status & E1000_STATUS_SPEED_1000) {
- *speed = SPEED_1000;
- DEBUGOUT("1000 Mbs, ");
-- } else if(status & E1000_STATUS_SPEED_100) {
-+ } else if (status & E1000_STATUS_SPEED_100) {
- *speed = SPEED_100;
- DEBUGOUT("100 Mbs, ");
- } else {
-@@ -2849,15 +2990,15 @@ e1000_get_speed_and_duplex(struct e1000_
- DEBUGOUT("10 Mbs, ");
- }
-
-- if(status & E1000_STATUS_FD) {
-+ if (status & E1000_STATUS_FD) {
- *duplex = FULL_DUPLEX;
-- DEBUGOUT("Full Duplex\r\n");
-+ DEBUGOUT("Full Duplex\n");
- } else {
- *duplex = HALF_DUPLEX;
-- DEBUGOUT(" Half Duplex\r\n");
-+ DEBUGOUT(" Half Duplex\n");
- }
- } else {
-- DEBUGOUT("1000 Mbs, Full Duplex\r\n");
-+ DEBUGOUT("1000 Mbs, Full Duplex\n");
- *speed = SPEED_1000;
- *duplex = FULL_DUPLEX;
- }
-@@ -2866,29 +3007,35 @@ e1000_get_speed_and_duplex(struct e1000_
- * if it is operating at half duplex. Here we set the duplex settings to
- * match the duplex in the link partner's capabilities.
- */
-- if(hw->phy_type == e1000_phy_igp && hw->speed_downgraded) {
-+ if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) {
- ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(!(phy_data & NWAY_ER_LP_NWAY_CAPS))
-+ if (!(phy_data & NWAY_ER_LP_NWAY_CAPS))
- *duplex = HALF_DUPLEX;
- else {
- ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-- if((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) ||
-+ if ((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) ||
- (*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS)))
- *duplex = HALF_DUPLEX;
- }
- }
-
-- if ((hw->mac_type == e1000_80003es2lan) &&
-+ if ((hw->mac_type == e1000_80003es2lan) &&
- (hw->media_type == e1000_media_type_copper)) {
- if (*speed == SPEED_1000)
- ret_val = e1000_configure_kmrn_for_1000(hw);
- else
-- ret_val = e1000_configure_kmrn_for_10_100(hw);
-+ ret_val = e1000_configure_kmrn_for_10_100(hw, *duplex);
-+ if (ret_val)
-+ return ret_val;
-+ }
-+
-+ if ((hw->phy_type == e1000_phy_igp_3) && (*speed == SPEED_1000)) {
-+ ret_val = e1000_kumeran_lock_loss_workaround(hw);
- if (ret_val)
- return ret_val;
- }
-@@ -2901,7 +3048,7 @@ e1000_get_speed_and_duplex(struct e1000_
- *
- * hw - Struct containing variables accessed by shared code
- ******************************************************************************/
--static int32_t
-+int32_t
- e1000_wait_autoneg(struct e1000_hw *hw)
- {
- int32_t ret_val;
-@@ -2912,17 +3059,17 @@ e1000_wait_autoneg(struct e1000_hw *hw)
- DEBUGOUT("Waiting for Auto-Neg to complete.\n");
-
- /* We will wait for autoneg to complete or 4.5 seconds to expire. */
-- for(i = PHY_AUTO_NEG_TIME; i > 0; i--) {
-+ for (i = PHY_AUTO_NEG_TIME; i > 0; i--) {
- /* Read the MII Status Register and wait for Auto-Neg
- * Complete bit to be set.
- */
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-- if(phy_data & MII_SR_AUTONEG_COMPLETE) {
-+ if (phy_data & MII_SR_AUTONEG_COMPLETE) {
- return E1000_SUCCESS;
- }
- msec_delay(100);
-@@ -2945,7 +3092,7 @@ e1000_raise_mdi_clk(struct e1000_hw *hw,
- */
- E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC));
- E1000_WRITE_FLUSH(hw);
-- udelay(10);
-+ usec_delay(10);
- }
-
- /******************************************************************************
-@@ -2963,7 +3110,7 @@ e1000_lower_mdi_clk(struct e1000_hw *hw,
- */
- E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC));
- E1000_WRITE_FLUSH(hw);
-- udelay(10);
-+ usec_delay(10);
- }
-
- /******************************************************************************
-@@ -2995,19 +3142,21 @@ e1000_shift_out_mdi_bits(struct e1000_hw
- /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */
- ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR);
-
-- while(mask) {
-+ while (mask) {
- /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and
- * then raising and lowering the Management Data Clock. A "0" is
- * shifted out to the PHY by setting the MDIO bit to "0" and then
- * raising and lowering the clock.
- */
-- if(data & mask) ctrl |= E1000_CTRL_MDIO;
-- else ctrl &= ~E1000_CTRL_MDIO;
-+ if (data & mask)
-+ ctrl |= E1000_CTRL_MDIO;
-+ else
-+ ctrl &= ~E1000_CTRL_MDIO;
-
- E1000_WRITE_REG(hw, CTRL, ctrl);
- E1000_WRITE_FLUSH(hw);
-
-- udelay(10);
-+ usec_delay(10);
-
- e1000_raise_mdi_clk(hw, &ctrl);
- e1000_lower_mdi_clk(hw, &ctrl);
-@@ -3053,12 +3202,13 @@ e1000_shift_in_mdi_bits(struct e1000_hw
- e1000_raise_mdi_clk(hw, &ctrl);
- e1000_lower_mdi_clk(hw, &ctrl);
-
-- for(data = 0, i = 0; i < 16; i++) {
-+ for (data = 0, i = 0; i < 16; i++) {
- data = data << 1;
- e1000_raise_mdi_clk(hw, &ctrl);
- ctrl = E1000_READ_REG(hw, CTRL);
- /* Check to see if we shifted in a "1". */
-- if(ctrl & E1000_CTRL_MDIO) data |= 1;
-+ if (ctrl & E1000_CTRL_MDIO)
-+ data |= 1;
- e1000_lower_mdi_clk(hw, &ctrl);
- }
-
-@@ -3078,10 +3228,13 @@ e1000_swfw_sync_acquire(struct e1000_hw
-
- DEBUGFUNC("e1000_swfw_sync_acquire");
-
-+ if (hw->swfwhw_semaphore_present)
-+ return e1000_get_software_flag(hw);
-+
- if (!hw->swfw_sync_present)
- return e1000_get_hw_eeprom_semaphore(hw);
-
-- while(timeout) {
-+ while (timeout) {
- if (e1000_get_hw_eeprom_semaphore(hw))
- return -E1000_ERR_SWFW_SYNC;
-
-@@ -3117,6 +3270,11 @@ e1000_swfw_sync_release(struct e1000_hw
-
- DEBUGFUNC("e1000_swfw_sync_release");
-
-+ if (hw->swfwhw_semaphore_present) {
-+ e1000_release_software_flag(hw);
-+ return;
-+ }
-+
- if (!hw->swfw_sync_present) {
- e1000_put_hw_eeprom_semaphore(hw);
- return;
-@@ -3159,12 +3317,13 @@ e1000_read_phy_reg(struct e1000_hw *hw,
- if (e1000_swfw_sync_acquire(hw, swfw))
- return -E1000_ERR_SWFW_SYNC;
-
-- if((hw->phy_type == e1000_phy_igp ||
-+ if ((hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2) &&
- (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
- ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
- (uint16_t)reg_addr);
-- if(ret_val) {
-+ if (ret_val) {
- e1000_swfw_sync_release(hw, swfw);
- return ret_val;
- }
-@@ -3209,12 +3368,12 @@ e1000_read_phy_reg_ex(struct e1000_hw *h
-
- DEBUGFUNC("e1000_read_phy_reg_ex");
-
-- if(reg_addr > MAX_PHY_REG_ADDRESS) {
-+ if (reg_addr > MAX_PHY_REG_ADDRESS) {
- DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
- return -E1000_ERR_PARAM;
- }
-
-- if(hw->mac_type > e1000_82543) {
-+ if (hw->mac_type > e1000_82543) {
- /* Set up Op-code, Phy Address, and register address in the MDI
- * Control register. The MAC will take care of interfacing with the
- * PHY to retrieve the desired data.
-@@ -3226,16 +3385,16 @@ e1000_read_phy_reg_ex(struct e1000_hw *h
- E1000_WRITE_REG(hw, MDIC, mdic);
-
- /* Poll the ready bit to see if the MDI read completed */
-- for(i = 0; i < 64; i++) {
-- udelay(50);
-+ for (i = 0; i < 64; i++) {
-+ usec_delay(50);
- mdic = E1000_READ_REG(hw, MDIC);
-- if(mdic & E1000_MDIC_READY) break;
-+ if (mdic & E1000_MDIC_READY) break;
- }
-- if(!(mdic & E1000_MDIC_READY)) {
-+ if (!(mdic & E1000_MDIC_READY)) {
- DEBUGOUT("MDI Read did not complete\n");
- return -E1000_ERR_PHY;
- }
-- if(mdic & E1000_MDIC_ERROR) {
-+ if (mdic & E1000_MDIC_ERROR) {
- DEBUGOUT("MDI Error\n");
- return -E1000_ERR_PHY;
- }
-@@ -3298,12 +3457,13 @@ e1000_write_phy_reg(struct e1000_hw *hw,
- if (e1000_swfw_sync_acquire(hw, swfw))
- return -E1000_ERR_SWFW_SYNC;
-
-- if((hw->phy_type == e1000_phy_igp ||
-+ if ((hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2) &&
- (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
- ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
- (uint16_t)reg_addr);
-- if(ret_val) {
-+ if (ret_val) {
- e1000_swfw_sync_release(hw, swfw);
- return ret_val;
- }
-@@ -3348,12 +3508,12 @@ e1000_write_phy_reg_ex(struct e1000_hw *
-
- DEBUGFUNC("e1000_write_phy_reg_ex");
-
-- if(reg_addr > MAX_PHY_REG_ADDRESS) {
-+ if (reg_addr > MAX_PHY_REG_ADDRESS) {
- DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
- return -E1000_ERR_PARAM;
- }
-
-- if(hw->mac_type > e1000_82543) {
-+ if (hw->mac_type > e1000_82543) {
- /* Set up Op-code, Phy Address, register address, and data intended
- * for the PHY register in the MDI Control register. The MAC will take
- * care of interfacing with the PHY to send the desired data.
-@@ -3366,12 +3526,12 @@ e1000_write_phy_reg_ex(struct e1000_hw *
- E1000_WRITE_REG(hw, MDIC, mdic);
-
- /* Poll the ready bit to see if the MDI read completed */
-- for(i = 0; i < 640; i++) {
-- udelay(5);
-+ for (i = 0; i < 641; i++) {
-+ usec_delay(5);
- mdic = E1000_READ_REG(hw, MDIC);
-- if(mdic & E1000_MDIC_READY) break;
-+ if (mdic & E1000_MDIC_READY) break;
- }
-- if(!(mdic & E1000_MDIC_READY)) {
-+ if (!(mdic & E1000_MDIC_READY)) {
- DEBUGOUT("MDI Write did not complete\n");
- return -E1000_ERR_PHY;
- }
-@@ -3423,7 +3583,7 @@ e1000_read_kmrn_reg(struct e1000_hw *hw,
- E1000_KUMCTRLSTA_OFFSET) |
- E1000_KUMCTRLSTA_REN;
- E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val);
-- udelay(2);
-+ usec_delay(2);
-
- /* Read the data returned */
- reg_val = E1000_READ_REG(hw, KUMCTRLSTA);
-@@ -3454,7 +3614,7 @@ e1000_write_kmrn_reg(struct e1000_hw *hw
- reg_val = ((reg_addr << E1000_KUMCTRLSTA_OFFSET_SHIFT) &
- E1000_KUMCTRLSTA_OFFSET) | data;
- E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val);
-- udelay(2);
-+ usec_delay(2);
-
- e1000_swfw_sync_release(hw, swfw);
- return E1000_SUCCESS;
-@@ -3483,7 +3643,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
-
- DEBUGOUT("Resetting Phy...\n");
-
-- if(hw->mac_type > e1000_82543) {
-+ if (hw->mac_type > e1000_82543) {
- if ((hw->mac_type == e1000_80003es2lan) &&
- (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) {
- swfw = E1000_SWFW_PHY1_SM;
-@@ -3496,24 +3656,24 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
- }
- /* Read the device control register and assert the E1000_CTRL_PHY_RST
- * bit. Then, take it out of reset.
-- * For pre-e1000_82571 hardware, we delay for 10ms between the assert
-+ * For pre-e1000_82571 hardware, we delay for 10ms between the assert
- * and deassert. For e1000_82571 hardware and later, we instead delay
- * for 50us between and 10ms after the deassertion.
- */
- ctrl = E1000_READ_REG(hw, CTRL);
- E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST);
- E1000_WRITE_FLUSH(hw);
--
-- if (hw->mac_type < e1000_82571)
-+
-+ if (hw->mac_type < e1000_82571)
- msec_delay(10);
- else
-- udelay(100);
--
-+ usec_delay(100);
-+
- E1000_WRITE_REG(hw, CTRL, ctrl);
- E1000_WRITE_FLUSH(hw);
--
-+
- if (hw->mac_type >= e1000_82571)
-- msec_delay(10);
-+ msec_delay_irq(10);
- e1000_swfw_sync_release(hw, swfw);
- } else {
- /* Read the Extended Device Control Register, assert the PHY_RESET_DIR
-@@ -3529,9 +3689,9 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
- E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
- E1000_WRITE_FLUSH(hw);
- }
-- udelay(150);
-+ usec_delay(150);
-
-- if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
-+ if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- /* Configure activity LED after PHY reset */
- led_ctrl = E1000_READ_REG(hw, LEDCTL);
- led_ctrl &= IGP_ACTIVITY_LED_MASK;
-@@ -3541,8 +3701,13 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
-
- /* Wait for FW to finish PHY configuration. */
- ret_val = e1000_get_phy_cfg_done(hw);
-+ if (ret_val != E1000_SUCCESS)
-+ return ret_val;
- e1000_release_software_semaphore(hw);
-
-+ if ((hw->mac_type == e1000_ich8lan) && (hw->phy_type == e1000_phy_igp_3))
-+ ret_val = e1000_init_lcd_from_nvm(hw);
-+
- return ret_val;
- }
-
-@@ -3571,57 +3736,168 @@ e1000_phy_reset(struct e1000_hw *hw)
- case e1000_82541_rev_2:
- case e1000_82571:
- case e1000_82572:
-+ case e1000_ich8lan:
- ret_val = e1000_phy_hw_reset(hw);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-+
- break;
- default:
- ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= MII_CR_RESET;
- ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- udelay(1);
-+ usec_delay(1);
- break;
- }
-
-- if(hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2)
-+ if (hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2)
- e1000_phy_init_script(hw);
-
- return E1000_SUCCESS;
- }
-
- /******************************************************************************
--* Probes the expected PHY address for known PHY IDs
-+* Work-around for 82566 power-down: on D3 entry-
-+* 1) disable gigabit link
-+* 2) write VR power-down enable
-+* 3) read it back
-+* if successful continue, else issue LCD reset and repeat
- *
--* hw - Struct containing variables accessed by shared code
-+* hw - struct containing variables accessed by shared code
- ******************************************************************************/
--static int32_t
--e1000_detect_gig_phy(struct e1000_hw *hw)
-+void
-+e1000_phy_powerdown_workaround(struct e1000_hw *hw)
- {
-- int32_t phy_init_status, ret_val;
-- uint16_t phy_id_high, phy_id_low;
-- boolean_t match = FALSE;
-+ int32_t reg;
-+ uint16_t phy_data;
-+ int32_t retry = 0;
-
-- DEBUGFUNC("e1000_detect_gig_phy");
-+ DEBUGFUNC("e1000_phy_powerdown_workaround");
-
-- /* The 82571 firmware may still be configuring the PHY. In this
-- * case, we cannot access the PHY until the configuration is done. So
-- * we explicitly set the PHY values. */
-- if(hw->mac_type == e1000_82571 ||
-- hw->mac_type == e1000_82572) {
-- hw->phy_id = IGP01E1000_I_PHY_ID;
-- hw->phy_type = e1000_phy_igp_2;
-- return E1000_SUCCESS;
-- }
-+ if (hw->phy_type != e1000_phy_igp_3)
-+ return;
-
-- /* ESB-2 PHY reads require e1000_phy_gg82563 to be set because of a work-
-- * around that forces PHY page 0 to be set or the reads fail. The rest of
-- * the code in this routine uses e1000_read_phy_reg to read the PHY ID.
-+ do {
-+ /* Disable link */
-+ reg = E1000_READ_REG(hw, PHY_CTRL);
-+ E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE |
-+ E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
-+
-+ /* Write VR power-down enable */
-+ e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data);
-+ e1000_write_phy_reg(hw, IGP3_VR_CTRL, phy_data |
-+ IGP3_VR_CTRL_MODE_SHUT);
-+
-+ /* Read it back and test */
-+ e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data);
-+ if ((phy_data & IGP3_VR_CTRL_MODE_SHUT) || retry)
-+ break;
-+
-+ /* Issue PHY reset and repeat at most one more time */
-+ reg = E1000_READ_REG(hw, CTRL);
-+ E1000_WRITE_REG(hw, CTRL, reg | E1000_CTRL_PHY_RST);
-+ retry++;
-+ } while (retry);
-+
-+ return;
-+
-+}
-+
-+/******************************************************************************
-+* Work-around for 82566 Kumeran PCS lock loss:
-+* On link status change (i.e. PCI reset, speed change) and link is up and
-+* speed is gigabit-
-+* 0) if workaround is optionally disabled do nothing
-+* 1) wait 1ms for Kumeran link to come up
-+* 2) check Kumeran Diagnostic register PCS lock loss bit
-+* 3) if not set the link is locked (all is good), otherwise...
-+* 4) reset the PHY
-+* 5) repeat up to 10 times
-+* Note: this is only called for IGP3 copper when speed is 1gb.
-+*
-+* hw - struct containing variables accessed by shared code
-+******************************************************************************/
-+int32_t
-+e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw)
-+{
-+ int32_t ret_val;
-+ int32_t reg;
-+ int32_t cnt;
-+ uint16_t phy_data;
-+
-+ if (hw->kmrn_lock_loss_workaround_disabled)
-+ return E1000_SUCCESS;
-+
-+ /* Make sure link is up before proceeding. If not just return.
-+ * Attempting this while link is negotiating fouled up link
-+ * stability */
-+ ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-+ ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-+
-+ if (phy_data & MII_SR_LINK_STATUS) {
-+ for (cnt = 0; cnt < 10; cnt++) {
-+ /* read once to clear */
-+ ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+ /* and again to get new status */
-+ ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ /* check for PCS lock */
-+ if (!(phy_data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS))
-+ return E1000_SUCCESS;
-+
-+ /* Issue PHY reset */
-+ e1000_phy_hw_reset(hw);
-+ msec_delay_irq(5);
-+ }
-+ /* Disable GigE link negotiation */
-+ reg = E1000_READ_REG(hw, PHY_CTRL);
-+ E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE |
-+ E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
-+
-+ /* unable to acquire PCS lock */
-+ return E1000_ERR_PHY;
-+ }
-+
-+ return E1000_SUCCESS;
-+}
-+
-+/******************************************************************************
-+* Probes the expected PHY address for known PHY IDs
-+*
-+* hw - Struct containing variables accessed by shared code
-+******************************************************************************/
-+int32_t
-+e1000_detect_gig_phy(struct e1000_hw *hw)
-+{
-+ int32_t phy_init_status, ret_val;
-+ uint16_t phy_id_high, phy_id_low;
-+ boolean_t match = FALSE;
-+
-+ DEBUGFUNC("e1000_detect_gig_phy");
-+
-+ /* The 82571 firmware may still be configuring the PHY. In this
-+ * case, we cannot access the PHY until the configuration is done. So
-+ * we explicitly set the PHY values. */
-+ if (hw->mac_type == e1000_82571 ||
-+ hw->mac_type == e1000_82572) {
-+ hw->phy_id = IGP01E1000_I_PHY_ID;
-+ hw->phy_type = e1000_phy_igp_2;
-+ return E1000_SUCCESS;
-+ }
-+
-+ /* ESB-2 PHY reads require e1000_phy_gg82563 to be set because of a work-
-+ * around that forces PHY page 0 to be set or the reads fail. The rest of
-+ * the code in this routine uses e1000_read_phy_reg to read the PHY ID.
- * So for ESB-2 we need to have this set so our reads won't fail. If the
- * attached PHY is not a e1000_phy_gg82563, the routines below will figure
- * this out as well. */
-@@ -3630,44 +3906,50 @@ e1000_detect_gig_phy(struct e1000_hw *hw
-
- /* Read the PHY ID Registers to identify which PHY is onboard. */
- ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->phy_id = (uint32_t) (phy_id_high << 16);
-- udelay(20);
-+ usec_delay(20);
- ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK);
- hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK;
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82543:
-- if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE;
-+ if (hw->phy_id == M88E1000_E_PHY_ID) match = TRUE;
- break;
- case e1000_82544:
-- if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE;
-+ if (hw->phy_id == M88E1000_I_PHY_ID) match = TRUE;
- break;
- case e1000_82540:
- case e1000_82545:
- case e1000_82545_rev_3:
- case e1000_82546:
- case e1000_82546_rev_3:
-- if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE;
-+ if (hw->phy_id == M88E1011_I_PHY_ID) match = TRUE;
- break;
- case e1000_82541:
- case e1000_82541_rev_2:
- case e1000_82547:
- case e1000_82547_rev_2:
-- if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE;
-+ if (hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE;
- break;
- case e1000_82573:
-- if(hw->phy_id == M88E1111_I_PHY_ID) match = TRUE;
-+ if (hw->phy_id == M88E1111_I_PHY_ID) match = TRUE;
- break;
- case e1000_80003es2lan:
- if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE;
- break;
-+ case e1000_ich8lan:
-+ if (hw->phy_id == IGP03E1000_E_PHY_ID) match = TRUE;
-+ if (hw->phy_id == IFE_E_PHY_ID) match = TRUE;
-+ if (hw->phy_id == IFE_PLUS_E_PHY_ID) match = TRUE;
-+ if (hw->phy_id == IFE_C_E_PHY_ID) match = TRUE;
-+ break;
- default:
- DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type);
- return -E1000_ERR_CONFIG;
-@@ -3696,14 +3978,14 @@ e1000_phy_reset_dsp(struct e1000_hw *hw)
- do {
- if (hw->phy_type != e1000_phy_gg82563) {
- ret_val = e1000_write_phy_reg(hw, 29, 0x001d);
-- if(ret_val) break;
-+ if (ret_val) break;
- }
- ret_val = e1000_write_phy_reg(hw, 30, 0x00c1);
-- if(ret_val) break;
-+ if (ret_val) break;
- ret_val = e1000_write_phy_reg(hw, 30, 0x0000);
-- if(ret_val) break;
-+ if (ret_val) break;
- ret_val = E1000_SUCCESS;
-- } while(0);
-+ } while (0);
-
- return ret_val;
- }
-@@ -3714,7 +3996,7 @@ e1000_phy_reset_dsp(struct e1000_hw *hw)
- * hw - Struct containing variables accessed by shared code
- * phy_info - PHY information structure
- ******************************************************************************/
--static int32_t
-+int32_t
- e1000_phy_igp_get_info(struct e1000_hw *hw,
- struct e1000_phy_info *phy_info)
- {
-@@ -3735,23 +4017,23 @@ e1000_phy_igp_get_info(struct e1000_hw *
-
- /* Check polarity status */
- ret_val = e1000_check_polarity(hw, &polarity);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->cable_polarity = polarity;
-
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >>
- IGP01E1000_PSSR_MDIX_SHIFT;
-
-- if((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
-+ if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
- IGP01E1000_PSSR_SPEED_1000MBPS) {
- /* Local/Remote Receiver Information are only valid at 1000 Mbps */
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >>
-@@ -3761,19 +4043,19 @@ e1000_phy_igp_get_info(struct e1000_hw *
-
- /* Get cable length */
- ret_val = e1000_get_cable_length(hw, &min_length, &max_length);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Translate to old method */
- average = (max_length + min_length) / 2;
-
-- if(average <= e1000_igp_cable_length_50)
-+ if (average <= e1000_igp_cable_length_50)
- phy_info->cable_length = e1000_cable_length_50;
-- else if(average <= e1000_igp_cable_length_80)
-+ else if (average <= e1000_igp_cable_length_80)
- phy_info->cable_length = e1000_cable_length_50_80;
-- else if(average <= e1000_igp_cable_length_110)
-+ else if (average <= e1000_igp_cable_length_110)
- phy_info->cable_length = e1000_cable_length_80_110;
-- else if(average <= e1000_igp_cable_length_140)
-+ else if (average <= e1000_igp_cable_length_140)
- phy_info->cable_length = e1000_cable_length_110_140;
- else
- phy_info->cable_length = e1000_cable_length_140;
-@@ -3783,12 +4065,59 @@ e1000_phy_igp_get_info(struct e1000_hw *
- }
-
- /******************************************************************************
-+* Get PHY information from various PHY registers for ife PHY only.
-+*
-+* hw - Struct containing variables accessed by shared code
-+* phy_info - PHY information structure
-+******************************************************************************/
-+int32_t
-+e1000_phy_ife_get_info(struct e1000_hw *hw,
-+ struct e1000_phy_info *phy_info)
-+{
-+ int32_t ret_val;
-+ uint16_t phy_data, polarity;
-+
-+ DEBUGFUNC("e1000_phy_ife_get_info");
-+
-+ phy_info->downshift = (e1000_downshift)hw->speed_downgraded;
-+ phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal;
-+
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+ phy_info->polarity_correction =
-+ (phy_data & IFE_PSC_AUTO_POLARITY_DISABLE) >>
-+ IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT;
-+
-+ if (phy_info->polarity_correction == e1000_polarity_reversal_enabled) {
-+ ret_val = e1000_check_polarity(hw, &polarity);
-+ if (ret_val)
-+ return ret_val;
-+ } else {
-+ /* Polarity is forced. */
-+ polarity = (phy_data & IFE_PSC_FORCE_POLARITY) >>
-+ IFE_PSC_FORCE_POLARITY_SHIFT;
-+ }
-+ phy_info->cable_polarity = polarity;
-+
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_info->mdix_mode =
-+ (phy_data & (IFE_PMC_AUTO_MDIX | IFE_PMC_FORCE_MDIX)) >>
-+ IFE_PMC_MDIX_MODE_SHIFT;
-+
-+ return E1000_SUCCESS;
-+}
-+
-+/******************************************************************************
- * Get PHY information from various PHY registers fot m88 PHY only.
- *
- * hw - Struct containing variables accessed by shared code
- * phy_info - PHY information structure
- ******************************************************************************/
--static int32_t
-+int32_t
- e1000_phy_m88_get_info(struct e1000_hw *hw,
- struct e1000_phy_info *phy_info)
- {
-@@ -3802,7 +4131,7 @@ e1000_phy_m88_get_info(struct e1000_hw *
- phy_info->downshift = (e1000_downshift)hw->speed_downgraded;
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->extended_10bt_distance =
-@@ -3814,12 +4143,12 @@ e1000_phy_m88_get_info(struct e1000_hw *
-
- /* Check polarity status */
- ret_val = e1000_check_polarity(hw, &polarity);
-- if(ret_val)
-- return ret_val;
-+ if (ret_val)
-+ return ret_val;
- phy_info->cable_polarity = polarity;
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >>
-@@ -3842,7 +4171,7 @@ e1000_phy_m88_get_info(struct e1000_hw *
- }
-
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >>
-@@ -3879,27 +4208,30 @@ e1000_phy_get_info(struct e1000_hw *hw,
- phy_info->local_rx = e1000_1000t_rx_status_undefined;
- phy_info->remote_rx = e1000_1000t_rx_status_undefined;
-
-- if(hw->media_type != e1000_media_type_copper) {
-+ if (hw->media_type != e1000_media_type_copper) {
- DEBUGOUT("PHY info is only valid for copper media\n");
- return -E1000_ERR_CONFIG;
- }
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) {
-+ if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) {
- DEBUGOUT("PHY info is only valid if link is up\n");
- return -E1000_ERR_CONFIG;
- }
-
-- if(hw->phy_type == e1000_phy_igp ||
-+ if (hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2)
- return e1000_phy_igp_get_info(hw, phy_info);
-+ else if (hw->phy_type == e1000_phy_ife)
-+ return e1000_phy_ife_get_info(hw, phy_info);
- else
- return e1000_phy_m88_get_info(hw, phy_info);
- }
-@@ -3909,7 +4241,7 @@ e1000_validate_mdi_setting(struct e1000_
- {
- DEBUGFUNC("e1000_validate_mdi_settings");
-
-- if(!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) {
-+ if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) {
- DEBUGOUT("Invalid MDI setting detected\n");
- hw->mdix = 1;
- return -E1000_ERR_CONFIG;
-@@ -3956,7 +4288,7 @@ e1000_init_eeprom_params(struct e1000_hw
- eeprom->type = e1000_eeprom_microwire;
- eeprom->opcode_bits = 3;
- eeprom->delay_usec = 50;
-- if(eecd & E1000_EECD_SIZE) {
-+ if (eecd & E1000_EECD_SIZE) {
- eeprom->word_size = 256;
- eeprom->address_bits = 8;
- } else {
-@@ -4024,7 +4356,7 @@ e1000_init_eeprom_params(struct e1000_hw
- }
- eeprom->use_eerd = TRUE;
- eeprom->use_eewr = TRUE;
-- if(e1000_is_onboard_nvm_eeprom(hw) == FALSE) {
-+ if (e1000_is_onboard_nvm_eeprom(hw) == FALSE) {
- eeprom->type = e1000_eeprom_flash;
- eeprom->word_size = 2048;
-
-@@ -4048,6 +4380,35 @@ e1000_init_eeprom_params(struct e1000_hw
- eeprom->use_eerd = TRUE;
- eeprom->use_eewr = FALSE;
- break;
-+ case e1000_ich8lan:
-+ {
-+ int32_t i = 0;
-+ uint32_t flash_size = E1000_READ_ICH8_REG(hw, ICH8_FLASH_GFPREG);
-+
-+ eeprom->type = e1000_eeprom_ich8;
-+ eeprom->use_eerd = FALSE;
-+ eeprom->use_eewr = FALSE;
-+ eeprom->word_size = E1000_SHADOW_RAM_WORDS;
-+
-+ /* Zero the shadow RAM structure. But don't load it from NVM
-+ * so as to save time for driver init */
-+ if (hw->eeprom_shadow_ram != NULL) {
-+ for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) {
-+ hw->eeprom_shadow_ram[i].modified = FALSE;
-+ hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF;
-+ }
-+ }
-+
-+ hw->flash_base_addr = (flash_size & ICH8_GFPREG_BASE_MASK) *
-+ ICH8_FLASH_SECTOR_SIZE;
-+
-+ hw->flash_bank_size = ((flash_size >> 16) & ICH8_GFPREG_BASE_MASK) + 1;
-+ hw->flash_bank_size -= (flash_size & ICH8_GFPREG_BASE_MASK);
-+ hw->flash_bank_size *= ICH8_FLASH_SECTOR_SIZE;
-+ hw->flash_bank_size /= 2 * sizeof(uint16_t);
-+
-+ break;
-+ }
- default:
- break;
- }
-@@ -4056,17 +4417,17 @@ e1000_init_eeprom_params(struct e1000_hw
- /* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to
- * 32KB (incremented by powers of 2).
- */
-- if(hw->mac_type <= e1000_82547_rev_2) {
-+ if (hw->mac_type <= e1000_82547_rev_2) {
- /* Set to default value for initial eeprom read. */
- eeprom->word_size = 64;
- ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- eeprom_size = (eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT;
- /* 256B eeprom size was not supported in earlier hardware, so we
- * bump eeprom_size up one to ensure that "1" (which maps to 256B)
- * is never the result used in the shifting logic below. */
-- if(eeprom_size)
-+ if (eeprom_size)
- eeprom_size++;
- } else {
- eeprom_size = (uint16_t)((eecd & E1000_EECD_SIZE_EX_MASK) >>
-@@ -4094,7 +4455,7 @@ e1000_raise_ee_clk(struct e1000_hw *hw,
- *eecd = *eecd | E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, *eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(hw->eeprom.delay_usec);
-+ usec_delay(hw->eeprom.delay_usec);
- }
-
- /******************************************************************************
-@@ -4113,7 +4474,7 @@ e1000_lower_ee_clk(struct e1000_hw *hw,
- *eecd = *eecd & ~E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, *eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(hw->eeprom.delay_usec);
-+ usec_delay(hw->eeprom.delay_usec);
- }
-
- /******************************************************************************
-@@ -4151,20 +4512,20 @@ e1000_shift_out_ee_bits(struct e1000_hw
- */
- eecd &= ~E1000_EECD_DI;
-
-- if(data & mask)
-+ if (data & mask)
- eecd |= E1000_EECD_DI;
-
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
-
- e1000_raise_ee_clk(hw, &eecd);
- e1000_lower_ee_clk(hw, &eecd);
-
- mask = mask >> 1;
-
-- } while(mask);
-+ } while (mask);
-
- /* We leave the "DI" bit set to "0" when we leave this routine. */
- eecd &= ~E1000_EECD_DI;
-@@ -4196,14 +4557,14 @@ e1000_shift_in_ee_bits(struct e1000_hw *
- eecd &= ~(E1000_EECD_DO | E1000_EECD_DI);
- data = 0;
-
-- for(i = 0; i < count; i++) {
-+ for (i = 0; i < count; i++) {
- data = data << 1;
- e1000_raise_ee_clk(hw, &eecd);
-
- eecd = E1000_READ_REG(hw, EECD);
-
- eecd &= ~(E1000_EECD_DI);
-- if(eecd & E1000_EECD_DO)
-+ if (eecd & E1000_EECD_DO)
- data |= 1;
-
- e1000_lower_ee_clk(hw, &eecd);
-@@ -4234,17 +4595,17 @@ e1000_acquire_eeprom(struct e1000_hw *hw
-
- if (hw->mac_type != e1000_82573) {
- /* Request EEPROM Access */
-- if(hw->mac_type > e1000_82544) {
-+ if (hw->mac_type > e1000_82544) {
- eecd |= E1000_EECD_REQ;
- E1000_WRITE_REG(hw, EECD, eecd);
- eecd = E1000_READ_REG(hw, EECD);
-- while((!(eecd & E1000_EECD_GNT)) &&
-+ while ((!(eecd & E1000_EECD_GNT)) &&
- (i < E1000_EEPROM_GRANT_ATTEMPTS)) {
- i++;
-- udelay(5);
-+ usec_delay(5);
- eecd = E1000_READ_REG(hw, EECD);
- }
-- if(!(eecd & E1000_EECD_GNT)) {
-+ if (!(eecd & E1000_EECD_GNT)) {
- eecd &= ~E1000_EECD_REQ;
- E1000_WRITE_REG(hw, EECD, eecd);
- DEBUGOUT("Could not acquire EEPROM grant\n");
-@@ -4268,7 +4629,7 @@ e1000_acquire_eeprom(struct e1000_hw *hw
- /* Clear SK and CS */
- eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
- E1000_WRITE_REG(hw, EECD, eecd);
-- udelay(1);
-+ usec_delay(1);
- }
-
- return E1000_SUCCESS;
-@@ -4287,39 +4648,39 @@ e1000_standby_eeprom(struct e1000_hw *hw
-
- eecd = E1000_READ_REG(hw, EECD);
-
-- if(eeprom->type == e1000_eeprom_microwire) {
-+ if (eeprom->type == e1000_eeprom_microwire) {
- eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
-
- /* Clock high */
- eecd |= E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
-
- /* Select EEPROM */
- eecd |= E1000_EECD_CS;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
-
- /* Clock low */
- eecd &= ~E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-- } else if(eeprom->type == e1000_eeprom_spi) {
-+ usec_delay(eeprom->delay_usec);
-+ } else if (eeprom->type == e1000_eeprom_spi) {
- /* Toggle CS to flush commands */
- eecd |= E1000_EECD_CS;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
- eecd &= ~E1000_EECD_CS;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(eeprom->delay_usec);
-+ usec_delay(eeprom->delay_usec);
- }
- }
-
-@@ -4343,8 +4704,8 @@ e1000_release_eeprom(struct e1000_hw *hw
-
- E1000_WRITE_REG(hw, EECD, eecd);
-
-- udelay(hw->eeprom.delay_usec);
-- } else if(hw->eeprom.type == e1000_eeprom_microwire) {
-+ usec_delay(hw->eeprom.delay_usec);
-+ } else if (hw->eeprom.type == e1000_eeprom_microwire) {
- /* cleanup eeprom */
-
- /* CS on Microwire is active-high */
-@@ -4356,17 +4717,17 @@ e1000_release_eeprom(struct e1000_hw *hw
- eecd |= E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(hw->eeprom.delay_usec);
-+ usec_delay(hw->eeprom.delay_usec);
-
- /* Falling edge of clock */
- eecd &= ~E1000_EECD_SK;
- E1000_WRITE_REG(hw, EECD, eecd);
- E1000_WRITE_FLUSH(hw);
-- udelay(hw->eeprom.delay_usec);
-+ usec_delay(hw->eeprom.delay_usec);
- }
-
- /* Stop requesting EEPROM access */
-- if(hw->mac_type > e1000_82544) {
-+ if (hw->mac_type > e1000_82544) {
- eecd &= ~E1000_EECD_REQ;
- E1000_WRITE_REG(hw, EECD, eecd);
- }
-@@ -4400,16 +4761,16 @@ e1000_spi_eeprom_ready(struct e1000_hw *
- if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI))
- break;
-
-- udelay(5);
-+ usec_delay(5);
- retry_count += 5;
-
- e1000_standby_eeprom(hw);
-- } while(retry_count < EEPROM_MAX_RETRY_SPI);
-+ } while (retry_count < EEPROM_MAX_RETRY_SPI);
-
- /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and
- * only 0-5mSec on 5V devices)
- */
-- if(retry_count >= EEPROM_MAX_RETRY_SPI) {
-+ if (retry_count >= EEPROM_MAX_RETRY_SPI) {
- DEBUGOUT("SPI EEPROM Status error\n");
- return -E1000_ERR_EEPROM;
- }
-@@ -4440,7 +4801,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
- /* A check for invalid values: offset too large, too many words, and not
- * enough words.
- */
-- if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
-+ if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
- (words == 0)) {
- DEBUGOUT("\"words\" parameter out of bounds\n");
- return -E1000_ERR_EEPROM;
-@@ -4448,7 +4809,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
-
- /* FLASH reads without acquiring the semaphore are safe */
- if (e1000_is_onboard_nvm_eeprom(hw) == TRUE &&
-- hw->eeprom.use_eerd == FALSE) {
-+ hw->eeprom.use_eerd == FALSE) {
- switch (hw->mac_type) {
- case e1000_80003es2lan:
- break;
-@@ -4468,11 +4829,14 @@ e1000_read_eeprom(struct e1000_hw *hw,
- return ret_val;
- }
-
-- if(eeprom->type == e1000_eeprom_spi) {
-+ if (eeprom->type == e1000_eeprom_ich8)
-+ return e1000_read_eeprom_ich8(hw, offset, words, data);
-+
-+ if (eeprom->type == e1000_eeprom_spi) {
- uint16_t word_in;
- uint8_t read_opcode = EEPROM_READ_OPCODE_SPI;
-
-- if(e1000_spi_eeprom_ready(hw)) {
-+ if (e1000_spi_eeprom_ready(hw)) {
- e1000_release_eeprom(hw);
- return -E1000_ERR_EEPROM;
- }
-@@ -4480,7 +4844,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
- e1000_standby_eeprom(hw);
-
- /* Some SPI eeproms use the 8th address bit embedded in the opcode */
-- if((eeprom->address_bits == 8) && (offset >= 128))
-+ if ((eeprom->address_bits == 8) && (offset >= 128))
- read_opcode |= EEPROM_A8_OPCODE_SPI;
-
- /* Send the READ command (opcode + addr) */
-@@ -4496,7 +4860,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
- word_in = e1000_shift_in_ee_bits(hw, 16);
- data[i] = (word_in >> 8) | (word_in << 8);
- }
-- } else if(eeprom->type == e1000_eeprom_microwire) {
-+ } else if (eeprom->type == e1000_eeprom_microwire) {
- for (i = 0; i < words; i++) {
- /* Send the READ command (opcode + addr) */
- e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE,
-@@ -4525,7 +4889,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
- * data - word read from the EEPROM
- * words - number of words to read
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_read_eeprom_eerd(struct e1000_hw *hw,
- uint16_t offset,
- uint16_t words,
-@@ -4540,14 +4904,14 @@ e1000_read_eeprom_eerd(struct e1000_hw *
-
- E1000_WRITE_REG(hw, EERD, eerd);
- error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ);
--
-- if(error) {
-+
-+ if (error) {
- break;
- }
- data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA);
--
-+
- }
--
-+
- return error;
- }
-
-@@ -4559,7 +4923,7 @@ e1000_read_eeprom_eerd(struct e1000_hw *
- * data - word read from the EEPROM
- * words - number of words to read
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_write_eeprom_eewr(struct e1000_hw *hw,
- uint16_t offset,
- uint16_t words,
-@@ -4573,24 +4937,24 @@ e1000_write_eeprom_eewr(struct e1000_hw
- return -E1000_ERR_SWFW_SYNC;
-
- for (i = 0; i < words; i++) {
-- register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) |
-- ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) |
-+ register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) |
-+ ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) |
- E1000_EEPROM_RW_REG_START;
-
- error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE);
-- if(error) {
-+ if (error) {
- break;
-- }
-+ }
-
- E1000_WRITE_REG(hw, EEWR, register_value);
--
-+
- error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE);
--
-- if(error) {
-+
-+ if (error) {
- break;
-- }
-+ }
- }
--
-+
- e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM);
- return error;
- }
-@@ -4600,24 +4964,24 @@ e1000_write_eeprom_eewr(struct e1000_hw
- *
- * hw - Struct containing variables accessed by shared code
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd)
- {
- uint32_t attempts = 100000;
- uint32_t i, reg = 0;
- int32_t done = E1000_ERR_EEPROM;
-
-- for(i = 0; i < attempts; i++) {
-- if(eerd == E1000_EEPROM_POLL_READ)
-+ for (i = 0; i < attempts; i++) {
-+ if (eerd == E1000_EEPROM_POLL_READ)
- reg = E1000_READ_REG(hw, EERD);
-- else
-+ else
- reg = E1000_READ_REG(hw, EEWR);
-
-- if(reg & E1000_EEPROM_RW_REG_DONE) {
-+ if (reg & E1000_EEPROM_RW_REG_DONE) {
- done = E1000_SUCCESS;
- break;
- }
-- udelay(5);
-+ usec_delay(5);
- }
-
- return done;
-@@ -4628,21 +4992,24 @@ e1000_poll_eerd_eewr_done(struct e1000_h
- *
- * hw - Struct containing variables accessed by shared code
- ****************************************************************************/
--static boolean_t
-+boolean_t
- e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)
- {
- uint32_t eecd = 0;
-
- DEBUGFUNC("e1000_is_onboard_nvm_eeprom");
-
-- if(hw->mac_type == e1000_82573) {
-+ if (hw->mac_type == e1000_ich8lan)
-+ return FALSE;
-+
-+ if (hw->mac_type == e1000_82573) {
- eecd = E1000_READ_REG(hw, EECD);
-
- /* Isolate bits 15 & 16 */
- eecd = ((eecd >> 15) & 0x03);
-
- /* If both bits are set, device is Flash type */
-- if(eecd == 0x03) {
-+ if (eecd == 0x03) {
- return FALSE;
- }
- }
-@@ -4685,15 +5052,29 @@ e1000_validate_eeprom_checksum(struct e1
- }
- }
-
-- for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
-- if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /* Drivers must allocate the shadow ram structure for the
-+ * EEPROM checksum to be updated. Otherwise, this bit as well
-+ * as the checksum must both be set correctly for this
-+ * validation to pass.
-+ */
-+ e1000_read_eeprom(hw, 0x19, 1, &eeprom_data);
-+ if ((eeprom_data & 0x40) == 0) {
-+ eeprom_data |= 0x40;
-+ e1000_write_eeprom(hw, 0x19, 1, &eeprom_data);
-+ e1000_update_eeprom_checksum(hw);
-+ }
-+ }
-+
-+ for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
-+ if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
- checksum += eeprom_data;
- }
-
-- if(checksum == (uint16_t) EEPROM_SUM)
-+ if (checksum == (uint16_t) EEPROM_SUM)
- return E1000_SUCCESS;
- else {
- DEBUGOUT("EEPROM Checksum Invalid\n");
-@@ -4712,24 +5093,33 @@ e1000_validate_eeprom_checksum(struct e1
- int32_t
- e1000_update_eeprom_checksum(struct e1000_hw *hw)
- {
-+ uint32_t ctrl_ext;
- uint16_t checksum = 0;
- uint16_t i, eeprom_data;
-
- DEBUGFUNC("e1000_update_eeprom_checksum");
-
-- for(i = 0; i < EEPROM_CHECKSUM_REG; i++) {
-- if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
-+ for (i = 0; i < EEPROM_CHECKSUM_REG; i++) {
-+ if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
- checksum += eeprom_data;
- }
- checksum = (uint16_t) EEPROM_SUM - checksum;
-- if(e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) {
-+ if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) {
- DEBUGOUT("EEPROM Write Error\n");
- return -E1000_ERR_EEPROM;
- } else if (hw->eeprom.type == e1000_eeprom_flash) {
- e1000_commit_shadow_ram(hw);
-+ } else if (hw->eeprom.type == e1000_eeprom_ich8) {
-+ e1000_commit_shadow_ram(hw);
-+ /* Reload the EEPROM, or else modifications will not appear
-+ * until after next adapter reset. */
-+ ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
-+ ctrl_ext |= E1000_CTRL_EXT_EE_RST;
-+ E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
-+ msec_delay(10);
- }
- return E1000_SUCCESS;
- }
-@@ -4759,21 +5149,24 @@ e1000_write_eeprom(struct e1000_hw *hw,
- /* A check for invalid values: offset too large, too many words, and not
- * enough words.
- */
-- if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
-+ if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
- (words == 0)) {
- DEBUGOUT("\"words\" parameter out of bounds\n");
- return -E1000_ERR_EEPROM;
- }
-
- /* 82573 writes only through eewr */
-- if(eeprom->use_eewr == TRUE)
-+ if (eeprom->use_eewr == TRUE)
- return e1000_write_eeprom_eewr(hw, offset, words, data);
-
-+ if (eeprom->type == e1000_eeprom_ich8)
-+ return e1000_write_eeprom_ich8(hw, offset, words, data);
-+
- /* Prepare the EEPROM for writing */
- if (e1000_acquire_eeprom(hw) != E1000_SUCCESS)
- return -E1000_ERR_EEPROM;
-
-- if(eeprom->type == e1000_eeprom_microwire) {
-+ if (eeprom->type == e1000_eeprom_microwire) {
- status = e1000_write_eeprom_microwire(hw, offset, words, data);
- } else {
- status = e1000_write_eeprom_spi(hw, offset, words, data);
-@@ -4809,7 +5202,7 @@ e1000_write_eeprom_spi(struct e1000_hw *
- while (widx < words) {
- uint8_t write_opcode = EEPROM_WRITE_OPCODE_SPI;
-
-- if(e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM;
-+ if (e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM;
-
- e1000_standby_eeprom(hw);
-
-@@ -4820,7 +5213,7 @@ e1000_write_eeprom_spi(struct e1000_hw *
- e1000_standby_eeprom(hw);
-
- /* Some SPI eeproms use the 8th address bit embedded in the opcode */
-- if((eeprom->address_bits == 8) && (offset >= 128))
-+ if ((eeprom->address_bits == 8) && (offset >= 128))
- write_opcode |= EEPROM_A8_OPCODE_SPI;
-
- /* Send the Write command (8-bit opcode + addr) */
-@@ -4842,7 +5235,7 @@ e1000_write_eeprom_spi(struct e1000_hw *
- * operation, while the smaller eeproms are capable of an 8-byte
- * PAGE WRITE operation. Break the inner loop to pass new address
- */
-- if((((offset + widx)*2) % eeprom->page_size) == 0) {
-+ if ((((offset + widx)*2) % eeprom->page_size) == 0) {
- e1000_standby_eeprom(hw);
- break;
- }
-@@ -4908,12 +5301,12 @@ e1000_write_eeprom_microwire(struct e100
- * signal that the command has been completed by raising the DO signal.
- * If DO does not go high in 10 milliseconds, then error out.
- */
-- for(i = 0; i < 200; i++) {
-+ for (i = 0; i < 200; i++) {
- eecd = E1000_READ_REG(hw, EECD);
-- if(eecd & E1000_EECD_DO) break;
-- udelay(50);
-+ if (eecd & E1000_EECD_DO) break;
-+ usec_delay(50);
- }
-- if(i == 200) {
-+ if (i == 200) {
- DEBUGOUT("EEPROM Write did not complete\n");
- return -E1000_ERR_EEPROM;
- }
-@@ -4948,7 +5341,7 @@ e1000_write_eeprom_microwire(struct e100
- * data - word read from the EEPROM
- * words - number of words to read
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_commit_shadow_ram(struct e1000_hw *hw)
- {
- uint32_t attempts = 100000;
-@@ -4956,17 +5349,23 @@ e1000_commit_shadow_ram(struct e1000_hw
- uint32_t flop = 0;
- uint32_t i = 0;
- int32_t error = E1000_SUCCESS;
--
-- /* The flop register will be used to determine if flash type is STM */
-- flop = E1000_READ_REG(hw, FLOP);
-+ uint32_t old_bank_offset = 0;
-+ uint32_t new_bank_offset = 0;
-+ uint32_t sector_retries = 0;
-+ uint8_t low_byte = 0;
-+ uint8_t high_byte = 0;
-+ uint8_t temp_byte = 0;
-+ boolean_t sector_write_failed = FALSE;
-
- if (hw->mac_type == e1000_82573) {
-+ /* The flop register will be used to determine if flash type is STM */
-+ flop = E1000_READ_REG(hw, FLOP);
- for (i=0; i < attempts; i++) {
- eecd = E1000_READ_REG(hw, EECD);
- if ((eecd & E1000_EECD_FLUPD) == 0) {
- break;
- }
-- udelay(5);
-+ usec_delay(5);
- }
-
- if (i == attempts) {
-@@ -4986,7 +5385,7 @@ e1000_commit_shadow_ram(struct e1000_hw
- if ((eecd & E1000_EECD_FLUPD) == 0) {
- break;
- }
-- udelay(5);
-+ usec_delay(5);
- }
-
- if (i == attempts) {
-@@ -4994,6 +5393,106 @@ e1000_commit_shadow_ram(struct e1000_hw
- }
- }
-
-+ if (hw->mac_type == e1000_ich8lan && hw->eeprom_shadow_ram != NULL) {
-+ /* We're writing to the opposite bank so if we're on bank 1,
-+ * write to bank 0 etc. We also need to erase the segment that
-+ * is going to be written */
-+ if (!(E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL)) {
-+ new_bank_offset = hw->flash_bank_size * 2;
-+ old_bank_offset = 0;
-+ e1000_erase_ich8_4k_segment(hw, 1);
-+ } else {
-+ old_bank_offset = hw->flash_bank_size * 2;
-+ new_bank_offset = 0;
-+ e1000_erase_ich8_4k_segment(hw, 0);
-+ }
-+
-+ do {
-+ sector_write_failed = FALSE;
-+ /* Loop for every byte in the shadow RAM,
-+ * which is in units of words. */
-+ for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) {
-+ /* Determine whether to write the value stored
-+ * in the other NVM bank or a modified value stored
-+ * in the shadow RAM */
-+ if (hw->eeprom_shadow_ram[i].modified == TRUE) {
-+ low_byte = (uint8_t)hw->eeprom_shadow_ram[i].eeprom_word;
-+ e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset,
-+ &temp_byte);
-+ usec_delay(100);
-+ error = e1000_verify_write_ich8_byte(hw,
-+ (i << 1) + new_bank_offset,
-+ low_byte);
-+ if (error != E1000_SUCCESS)
-+ sector_write_failed = TRUE;
-+ high_byte =
-+ (uint8_t)(hw->eeprom_shadow_ram[i].eeprom_word >> 8);
-+ e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1,
-+ &temp_byte);
-+ usec_delay(100);
-+ } else {
-+ e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset,
-+ &low_byte);
-+ usec_delay(100);
-+ error = e1000_verify_write_ich8_byte(hw,
-+ (i << 1) + new_bank_offset, low_byte);
-+ if (error != E1000_SUCCESS)
-+ sector_write_failed = TRUE;
-+ e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1,
-+ &high_byte);
-+ }
-+
-+ /* If the word is 0x13, then make sure the signature bits
-+ * (15:14) are 11b until the commit has completed.
-+ * This will allow us to write 10b which indicates the
-+ * signature is valid. We want to do this after the write
-+ * has completed so that we don't mark the segment valid
-+ * while the write is still in progress */
-+ if (i == E1000_ICH8_NVM_SIG_WORD)
-+ high_byte = E1000_ICH8_NVM_SIG_MASK | high_byte;
-+
-+ error = e1000_verify_write_ich8_byte(hw,
-+ (i << 1) + new_bank_offset + 1, high_byte);
-+ if (error != E1000_SUCCESS)
-+ sector_write_failed = TRUE;
-+
-+ if (sector_write_failed == FALSE) {
-+ /* Clear the now not used entry in the cache */
-+ hw->eeprom_shadow_ram[i].modified = FALSE;
-+ hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF;
-+ }
-+ }
-+
-+ /* Don't bother writing the segment valid bits if sector
-+ * programming failed. */
-+ if (sector_write_failed == FALSE) {
-+ /* Finally validate the new segment by setting bit 15:14
-+ * to 10b in word 0x13 , this can be done without an
-+ * erase as well since these bits are 11 to start with
-+ * and we need to change bit 14 to 0b */
-+ e1000_read_ich8_byte(hw,
-+ E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset,
-+ &high_byte);
-+ high_byte &= 0xBF;
-+ error = e1000_verify_write_ich8_byte(hw,
-+ E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset,
-+ high_byte);
-+ if (error != E1000_SUCCESS)
-+ sector_write_failed = TRUE;
-+
-+ /* And invalidate the previously valid segment by setting
-+ * its signature word (0x13) high_byte to 0b. This can be
-+ * done without an erase because flash erase sets all bits
-+ * to 1's. We can write 1's to 0's without an erase */
-+ error = e1000_verify_write_ich8_byte(hw,
-+ E1000_ICH8_NVM_SIG_WORD * 2 + 1 + old_bank_offset,
-+ 0);
-+ if (error != E1000_SUCCESS)
-+ sector_write_failed = TRUE;
-+ }
-+ } while (++sector_retries < 10 && sector_write_failed == TRUE);
-+ }
-+
- return error;
- }
-
-@@ -5013,7 +5512,7 @@ e1000_read_part_num(struct e1000_hw *hw,
- DEBUGFUNC("e1000_read_part_num");
-
- /* Get word 0 from EEPROM */
-- if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
-+ if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
-@@ -5021,7 +5520,7 @@ e1000_read_part_num(struct e1000_hw *hw,
- *part_num = (uint32_t) (eeprom_data << 16);
-
- /* Get word 1 from EEPROM */
-- if(e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) {
-+ if (e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
-@@ -5045,9 +5544,9 @@ e1000_read_mac_addr(struct e1000_hw * hw
-
- DEBUGFUNC("e1000_read_mac_addr");
-
-- for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
-+ for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
- offset = i >> 1;
-- if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
-+ if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
-@@ -5062,12 +5561,12 @@ e1000_read_mac_addr(struct e1000_hw * hw
- case e1000_82546_rev_3:
- case e1000_82571:
- case e1000_80003es2lan:
-- if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
-+ if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
- hw->perm_mac_addr[5] ^= 0x01;
- break;
- }
-
-- for(i = 0; i < NODE_ADDRESS_SIZE; i++)
-+ for (i = 0; i < NODE_ADDRESS_SIZE; i++)
- hw->mac_addr[i] = hw->perm_mac_addr[i];
- return E1000_SUCCESS;
- }
-@@ -5081,7 +5580,7 @@ e1000_read_mac_addr(struct e1000_hw * hw
- * of the receive addresss registers. Clears the multicast table. Assumes
- * the receiver is in reset when the routine is called.
- *****************************************************************************/
--static void
-+void
- e1000_init_rx_addrs(struct e1000_hw *hw)
- {
- uint32_t i;
-@@ -5101,15 +5600,19 @@ e1000_init_rx_addrs(struct e1000_hw *hw)
- * the other port. */
- if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE))
- rar_num -= 1;
-+ if (hw->mac_type == e1000_ich8lan)
-+ rar_num = E1000_RAR_ENTRIES_ICH8LAN;
-+
- /* Zero out the other 15 receive addresses. */
- DEBUGOUT("Clearing RAR[1-15]\n");
-- for(i = 1; i < rar_num; i++) {
-+ for (i = 1; i < rar_num; i++) {
- E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
-+ E1000_WRITE_FLUSH(hw);
- }
- }
-
--#if 0
- /******************************************************************************
- * Updates the MAC's list of multicast addresses.
- *
-@@ -5135,7 +5638,7 @@ e1000_mc_addr_list_update(struct e1000_h
- uint32_t i;
- uint32_t num_rar_entry;
- uint32_t num_mta_entry;
--
-+
- DEBUGFUNC("e1000_mc_addr_list_update");
-
- /* Set the new number of MC addresses that we are being requested to use. */
-@@ -5144,26 +5647,33 @@ e1000_mc_addr_list_update(struct e1000_h
- /* Clear RAR[1-15] */
- DEBUGOUT(" Clearing RAR[1-15]\n");
- num_rar_entry = E1000_RAR_ENTRIES;
-+ if (hw->mac_type == e1000_ich8lan)
-+ num_rar_entry = E1000_RAR_ENTRIES_ICH8LAN;
- /* Reserve a spot for the Locally Administered Address to work around
- * an 82571 issue in which a reset on one port will reload the MAC on
- * the other port. */
- if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE))
- num_rar_entry -= 1;
-
-- for(i = rar_used_count; i < num_rar_entry; i++) {
-+ for (i = rar_used_count; i < num_rar_entry; i++) {
- E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
-+ E1000_WRITE_FLUSH(hw);
- }
-
- /* Clear the MTA */
- DEBUGOUT(" Clearing MTA\n");
- num_mta_entry = E1000_NUM_MTA_REGISTERS;
-- for(i = 0; i < num_mta_entry; i++) {
-+ if (hw->mac_type == e1000_ich8lan)
-+ num_mta_entry = E1000_NUM_MTA_REGISTERS_ICH8LAN;
-+ for (i = 0; i < num_mta_entry; i++) {
- E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
-+ E1000_WRITE_FLUSH(hw);
- }
-
- /* Add the new addresses */
-- for(i = 0; i < mc_addr_count; i++) {
-+ for (i = 0; i < mc_addr_count; i++) {
- DEBUGOUT(" Adding the multicast addresses:\n");
- DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i,
- mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad)],
-@@ -5193,7 +5703,6 @@ e1000_mc_addr_list_update(struct e1000_h
- }
- DEBUGOUT("MC Update Complete\n");
- }
--#endif /* 0 */
-
- /******************************************************************************
- * Hashes an address to determine its location in the multicast table
-@@ -5216,24 +5725,46 @@ e1000_hash_mc_addr(struct e1000_hw *hw,
- * LSB MSB
- */
- case 0:
-- /* [47:36] i.e. 0x563 for above example address */
-- hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4));
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /* [47:38] i.e. 0x158 for above example address */
-+ hash_value = ((mc_addr[4] >> 6) | (((uint16_t) mc_addr[5]) << 2));
-+ } else {
-+ /* [47:36] i.e. 0x563 for above example address */
-+ hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4));
-+ }
- break;
- case 1:
-- /* [46:35] i.e. 0xAC6 for above example address */
-- hash_value = ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5));
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /* [46:37] i.e. 0x2B1 for above example address */
-+ hash_value = ((mc_addr[4] >> 5) | (((uint16_t) mc_addr[5]) << 3));
-+ } else {
-+ /* [46:35] i.e. 0xAC6 for above example address */
-+ hash_value = ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5));
-+ }
- break;
- case 2:
-- /* [45:34] i.e. 0x5D8 for above example address */
-- hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6));
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /*[45:36] i.e. 0x163 for above example address */
-+ hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4));
-+ } else {
-+ /* [45:34] i.e. 0x5D8 for above example address */
-+ hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6));
-+ }
- break;
- case 3:
-- /* [43:32] i.e. 0x634 for above example address */
-- hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8));
-+ if (hw->mac_type == e1000_ich8lan) {
-+ /* [43:34] i.e. 0x18D for above example address */
-+ hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6));
-+ } else {
-+ /* [43:32] i.e. 0x634 for above example address */
-+ hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8));
-+ }
- break;
- }
-
- hash_value &= 0xFFF;
-+ if (hw->mac_type == e1000_ich8lan)
-+ hash_value &= 0x3FF;
-
- return hash_value;
- }
-@@ -5261,6 +5792,8 @@ e1000_mta_set(struct e1000_hw *hw,
- * register are determined by the lower 5 bits of the value.
- */
- hash_reg = (hash_value >> 5) & 0x7F;
-+ if (hw->mac_type == e1000_ich8lan)
-+ hash_reg &= 0x1F;
- hash_bit = hash_value & 0x1F;
-
- mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg);
-@@ -5271,12 +5804,15 @@ e1000_mta_set(struct e1000_hw *hw,
- * in the MTA, save off the previous entry before writing and
- * restore the old value after writing.
- */
-- if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) {
-+ if ((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) {
- temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1));
- E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp);
-+ E1000_WRITE_FLUSH(hw);
- } else {
- E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta);
-+ E1000_WRITE_FLUSH(hw);
- }
- }
-
-@@ -5333,7 +5869,9 @@ e1000_rar_set(struct e1000_hw *hw,
- }
-
- E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high);
-+ E1000_WRITE_FLUSH(hw);
- }
-
- /******************************************************************************
-@@ -5350,12 +5888,18 @@ e1000_write_vfta(struct e1000_hw *hw,
- {
- uint32_t temp;
-
-- if((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) {
-+ if (hw->mac_type == e1000_ich8lan)
-+ return;
-+
-+ if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) {
- temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1));
- E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp);
-+ E1000_WRITE_FLUSH(hw);
- } else {
- E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
-+ E1000_WRITE_FLUSH(hw);
- }
- }
-
-@@ -5364,7 +5908,7 @@ e1000_write_vfta(struct e1000_hw *hw,
- *
- * hw - Struct containing variables accessed by shared code
- *****************************************************************************/
--static void
-+void
- e1000_clear_vfta(struct e1000_hw *hw)
- {
- uint32_t offset;
-@@ -5372,6 +5916,9 @@ e1000_clear_vfta(struct e1000_hw *hw)
- uint32_t vfta_offset = 0;
- uint32_t vfta_bit_in_reg = 0;
-
-+ if (hw->mac_type == e1000_ich8lan)
-+ return;
-+
- if (hw->mac_type == e1000_82573) {
- if (hw->mng_cookie.vlan_id != 0) {
- /* The VFTA is a 4096b bit-field, each identifying a single VLAN
-@@ -5391,10 +5938,11 @@ e1000_clear_vfta(struct e1000_hw *hw)
- * manageability unit */
- vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
- E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
-+ E1000_WRITE_FLUSH(hw);
- }
- }
-
--static int32_t
-+int32_t
- e1000_id_led_init(struct e1000_hw * hw)
- {
- uint32_t ledctl;
-@@ -5406,7 +5954,7 @@ e1000_id_led_init(struct e1000_hw * hw)
-
- DEBUGFUNC("e1000_id_led_init");
-
-- if(hw->mac_type < e1000_82540) {
-+ if (hw->mac_type < e1000_82540) {
- /* Nothing to do */
- return E1000_SUCCESS;
- }
-@@ -5416,15 +5964,24 @@ e1000_id_led_init(struct e1000_hw * hw)
- hw->ledctl_mode1 = hw->ledctl_default;
- hw->ledctl_mode2 = hw->ledctl_default;
-
-- if(e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) {
-+ if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
- return -E1000_ERR_EEPROM;
- }
-- if((eeprom_data== ID_LED_RESERVED_0000) ||
-- (eeprom_data == ID_LED_RESERVED_FFFF)) eeprom_data = ID_LED_DEFAULT;
-- for(i = 0; i < 4; i++) {
-+
-+ if ((hw->mac_type == e1000_82573) &&
-+ (eeprom_data == ID_LED_RESERVED_82573))
-+ eeprom_data = ID_LED_DEFAULT_82573;
-+ else if ((eeprom_data == ID_LED_RESERVED_0000) ||
-+ (eeprom_data == ID_LED_RESERVED_FFFF)) {
-+ if (hw->mac_type == e1000_ich8lan)
-+ eeprom_data = ID_LED_DEFAULT_ICH8LAN;
-+ else
-+ eeprom_data = ID_LED_DEFAULT;
-+ }
-+ for (i = 0; i < 4; i++) {
- temp = (eeprom_data >> (i << 2)) & led_mask;
-- switch(temp) {
-+ switch (temp) {
- case ID_LED_ON1_DEF2:
- case ID_LED_ON1_ON2:
- case ID_LED_ON1_OFF2:
-@@ -5441,7 +5998,7 @@ e1000_id_led_init(struct e1000_hw * hw)
- /* Do nothing */
- break;
- }
-- switch(temp) {
-+ switch (temp) {
- case ID_LED_DEF1_ON2:
- case ID_LED_ON1_ON2:
- case ID_LED_OFF1_ON2:
-@@ -5475,7 +6032,7 @@ e1000_setup_led(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_setup_led");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82542_rev2_0:
- case e1000_82542_rev2_1:
- case e1000_82543:
-@@ -5489,16 +6046,16 @@ e1000_setup_led(struct e1000_hw *hw)
- /* Turn off PHY Smart Power Down (if enabled) */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO,
- &hw->phy_spd_default);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO,
- (uint16_t)(hw->phy_spd_default &
- ~IGP01E1000_GMII_SPD));
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- /* Fall Through */
- default:
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- ledctl = E1000_READ_REG(hw, LEDCTL);
- /* Save current LEDCTL settings */
- hw->ledctl_default = ledctl;
-@@ -5509,7 +6066,7 @@ e1000_setup_led(struct e1000_hw *hw)
- ledctl |= (E1000_LEDCTL_MODE_LED_OFF <<
- E1000_LEDCTL_LED0_MODE_SHIFT);
- E1000_WRITE_REG(hw, LEDCTL, ledctl);
-- } else if(hw->media_type == e1000_media_type_copper)
-+ } else if (hw->media_type == e1000_media_type_copper)
- E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1);
- break;
- }
-@@ -5517,6 +6074,45 @@ e1000_setup_led(struct e1000_hw *hw)
- return E1000_SUCCESS;
- }
-
-+
-+/******************************************************************************
-+ * Used on 82571 and later Si that has LED blink bits.
-+ * Callers must use their own timer and should have already called
-+ * e1000_id_led_init()
-+ * Call e1000_cleanup led() to stop blinking
-+ *
-+ * hw - Struct containing variables accessed by shared code
-+ *****************************************************************************/
-+int32_t
-+e1000_blink_led_start(struct e1000_hw *hw)
-+{
-+ int16_t i;
-+ uint32_t ledctl_blink = 0;
-+
-+ DEBUGFUNC("e1000_id_led_blink_on");
-+
-+ if (hw->mac_type < e1000_82571) {
-+ /* Nothing to do */
-+ return E1000_SUCCESS;
-+ }
-+ if (hw->media_type == e1000_media_type_fiber) {
-+ /* always blink LED0 for PCI-E fiber */
-+ ledctl_blink = E1000_LEDCTL_LED0_BLINK |
-+ (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT);
-+ } else {
-+ /* set the blink bit for each LED that's "on" (0x0E) in ledctl_mode2 */
-+ ledctl_blink = hw->ledctl_mode2;
-+ for (i=0; i < 4; i++)
-+ if (((hw->ledctl_mode2 >> (i * 8)) & 0xFF) ==
-+ E1000_LEDCTL_MODE_LED_ON)
-+ ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << (i * 8));
-+ }
-+
-+ E1000_WRITE_REG(hw, LEDCTL, ledctl_blink);
-+
-+ return E1000_SUCCESS;
-+}
-+
- /******************************************************************************
- * Restores the saved state of the SW controlable LED.
- *
-@@ -5529,7 +6125,7 @@ e1000_cleanup_led(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_cleanup_led");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82542_rev2_0:
- case e1000_82542_rev2_1:
- case e1000_82543:
-@@ -5543,10 +6139,14 @@ e1000_cleanup_led(struct e1000_hw *hw)
- /* Turn on PHY Smart Power Down (if previously enabled) */
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO,
- hw->phy_spd_default);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- /* Fall Through */
- default:
-+ if (hw->phy_type == e1000_phy_ife) {
-+ e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
-+ break;
-+ }
- /* Restore LEDCTL settings */
- E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default);
- break;
-@@ -5567,7 +6167,7 @@ e1000_led_on(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_led_on");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82542_rev2_0:
- case e1000_82542_rev2_1:
- case e1000_82543:
-@@ -5576,7 +6176,7 @@ e1000_led_on(struct e1000_hw *hw)
- ctrl |= E1000_CTRL_SWDPIO0;
- break;
- case e1000_82544:
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- /* Set SW Defineable Pin 0 to turn on the LED */
- ctrl |= E1000_CTRL_SWDPIN0;
- ctrl |= E1000_CTRL_SWDPIO0;
-@@ -5587,11 +6187,14 @@ e1000_led_on(struct e1000_hw *hw)
- }
- break;
- default:
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- /* Clear SW Defineable Pin 0 to turn on the LED */
- ctrl &= ~E1000_CTRL_SWDPIN0;
- ctrl |= E1000_CTRL_SWDPIO0;
-- } else if(hw->media_type == e1000_media_type_copper) {
-+ } else if (hw->phy_type == e1000_phy_ife) {
-+ e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED,
-+ (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON));
-+ } else if (hw->media_type == e1000_media_type_copper) {
- E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2);
- return E1000_SUCCESS;
- }
-@@ -5615,7 +6218,7 @@ e1000_led_off(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_led_off");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82542_rev2_0:
- case e1000_82542_rev2_1:
- case e1000_82543:
-@@ -5624,7 +6227,7 @@ e1000_led_off(struct e1000_hw *hw)
- ctrl |= E1000_CTRL_SWDPIO0;
- break;
- case e1000_82544:
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- /* Clear SW Defineable Pin 0 to turn off the LED */
- ctrl &= ~E1000_CTRL_SWDPIN0;
- ctrl |= E1000_CTRL_SWDPIO0;
-@@ -5635,11 +6238,14 @@ e1000_led_off(struct e1000_hw *hw)
- }
- break;
- default:
-- if(hw->media_type == e1000_media_type_fiber) {
-+ if (hw->media_type == e1000_media_type_fiber) {
- /* Set SW Defineable Pin 0 to turn off the LED */
- ctrl |= E1000_CTRL_SWDPIN0;
- ctrl |= E1000_CTRL_SWDPIO0;
-- } else if(hw->media_type == e1000_media_type_copper) {
-+ } else if (hw->phy_type == e1000_phy_ife) {
-+ e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED,
-+ (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF));
-+ } else if (hw->media_type == e1000_media_type_copper) {
- E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1);
- return E1000_SUCCESS;
- }
-@@ -5656,7 +6262,7 @@ e1000_led_off(struct e1000_hw *hw)
- *
- * hw - Struct containing variables accessed by shared code
- *****************************************************************************/
--static void
-+void
- e1000_clear_hw_cntrs(struct e1000_hw *hw)
- {
- volatile uint32_t temp;
-@@ -5677,12 +6283,16 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw
- temp = E1000_READ_REG(hw, XOFFRXC);
- temp = E1000_READ_REG(hw, XOFFTXC);
- temp = E1000_READ_REG(hw, FCRUC);
-+
-+ if (hw->mac_type != e1000_ich8lan) {
- temp = E1000_READ_REG(hw, PRC64);
- temp = E1000_READ_REG(hw, PRC127);
- temp = E1000_READ_REG(hw, PRC255);
- temp = E1000_READ_REG(hw, PRC511);
- temp = E1000_READ_REG(hw, PRC1023);
- temp = E1000_READ_REG(hw, PRC1522);
-+ }
-+
- temp = E1000_READ_REG(hw, GPRC);
- temp = E1000_READ_REG(hw, BPRC);
- temp = E1000_READ_REG(hw, MPRC);
-@@ -5702,16 +6312,20 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw
- temp = E1000_READ_REG(hw, TOTH);
- temp = E1000_READ_REG(hw, TPR);
- temp = E1000_READ_REG(hw, TPT);
-+
-+ if (hw->mac_type != e1000_ich8lan) {
- temp = E1000_READ_REG(hw, PTC64);
- temp = E1000_READ_REG(hw, PTC127);
- temp = E1000_READ_REG(hw, PTC255);
- temp = E1000_READ_REG(hw, PTC511);
- temp = E1000_READ_REG(hw, PTC1023);
- temp = E1000_READ_REG(hw, PTC1522);
-+ }
-+
- temp = E1000_READ_REG(hw, MPTC);
- temp = E1000_READ_REG(hw, BPTC);
-
-- if(hw->mac_type < e1000_82543) return;
-+ if (hw->mac_type < e1000_82543) return;
-
- temp = E1000_READ_REG(hw, ALGNERRC);
- temp = E1000_READ_REG(hw, RXERRC);
-@@ -5720,16 +6334,19 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw
- temp = E1000_READ_REG(hw, TSCTC);
- temp = E1000_READ_REG(hw, TSCTFC);
-
-- if(hw->mac_type <= e1000_82544) return;
-+ if (hw->mac_type <= e1000_82544) return;
-
- temp = E1000_READ_REG(hw, MGTPRC);
- temp = E1000_READ_REG(hw, MGTPDC);
- temp = E1000_READ_REG(hw, MGTPTC);
-
-- if(hw->mac_type <= e1000_82547_rev_2) return;
-+ if (hw->mac_type <= e1000_82547_rev_2) return;
-
- temp = E1000_READ_REG(hw, IAC);
- temp = E1000_READ_REG(hw, ICRXOC);
-+
-+ if (hw->mac_type == e1000_ich8lan) return;
-+
- temp = E1000_READ_REG(hw, ICRXPTC);
- temp = E1000_READ_REG(hw, ICRXATC);
- temp = E1000_READ_REG(hw, ICTXPTC);
-@@ -5754,8 +6371,8 @@ e1000_reset_adaptive(struct e1000_hw *hw
- {
- DEBUGFUNC("e1000_reset_adaptive");
-
-- if(hw->adaptive_ifs) {
-- if(!hw->ifs_params_forced) {
-+ if (hw->adaptive_ifs) {
-+ if (!hw->ifs_params_forced) {
- hw->current_ifs_val = 0;
- hw->ifs_min_val = IFS_MIN;
- hw->ifs_max_val = IFS_MAX;
-@@ -5782,12 +6399,12 @@ e1000_update_adaptive(struct e1000_hw *h
- {
- DEBUGFUNC("e1000_update_adaptive");
-
-- if(hw->adaptive_ifs) {
-- if((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) {
-- if(hw->tx_packet_delta > MIN_NUM_XMITS) {
-+ if (hw->adaptive_ifs) {
-+ if ((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) {
-+ if (hw->tx_packet_delta > MIN_NUM_XMITS) {
- hw->in_ifs_mode = TRUE;
-- if(hw->current_ifs_val < hw->ifs_max_val) {
-- if(hw->current_ifs_val == 0)
-+ if (hw->current_ifs_val < hw->ifs_max_val) {
-+ if (hw->current_ifs_val == 0)
- hw->current_ifs_val = hw->ifs_min_val;
- else
- hw->current_ifs_val += hw->ifs_step_size;
-@@ -5795,7 +6412,7 @@ e1000_update_adaptive(struct e1000_hw *h
- }
- }
- } else {
-- if(hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) {
-+ if (hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) {
- hw->current_ifs_val = 0;
- hw->in_ifs_mode = FALSE;
- E1000_WRITE_REG(hw, AIT, 0);
-@@ -5842,46 +6459,46 @@ e1000_tbi_adjust_stats(struct e1000_hw *
- * This could be simplified if all environments supported
- * 64-bit integers.
- */
-- if(carry_bit && ((stats->gorcl & 0x80000000) == 0))
-+ if (carry_bit && ((stats->gorcl & 0x80000000) == 0))
- stats->gorch++;
- /* Is this a broadcast or multicast? Check broadcast first,
- * since the test for a multicast frame will test positive on
- * a broadcast frame.
- */
-- if((mac_addr[0] == (uint8_t) 0xff) && (mac_addr[1] == (uint8_t) 0xff))
-+ if ((mac_addr[0] == (uint8_t) 0xff) && (mac_addr[1] == (uint8_t) 0xff))
- /* Broadcast packet */
- stats->bprc++;
-- else if(*mac_addr & 0x01)
-+ else if (*mac_addr & 0x01)
- /* Multicast packet */
- stats->mprc++;
-
-- if(frame_len == hw->max_frame_size) {
-+ if (frame_len == hw->max_frame_size) {
- /* In this case, the hardware has overcounted the number of
- * oversize frames.
- */
-- if(stats->roc > 0)
-+ if (stats->roc > 0)
- stats->roc--;
- }
-
- /* Adjust the bin counters when the extra byte put the frame in the
- * wrong bin. Remember that the frame_len was adjusted above.
- */
-- if(frame_len == 64) {
-+ if (frame_len == 64) {
- stats->prc64++;
- stats->prc127--;
-- } else if(frame_len == 127) {
-+ } else if (frame_len == 127) {
- stats->prc127++;
- stats->prc255--;
-- } else if(frame_len == 255) {
-+ } else if (frame_len == 255) {
- stats->prc255++;
- stats->prc511--;
-- } else if(frame_len == 511) {
-+ } else if (frame_len == 511) {
- stats->prc511++;
- stats->prc1023--;
-- } else if(frame_len == 1023) {
-+ } else if (frame_len == 1023) {
- stats->prc1023++;
- stats->prc1522--;
-- } else if(frame_len == 1522) {
-+ } else if (frame_len == 1522) {
- stats->prc1522++;
- }
- }
-@@ -5910,6 +6527,7 @@ e1000_get_bus_info(struct e1000_hw *hw)
- hw->bus_width = e1000_bus_width_pciex_1;
- break;
- case e1000_82571:
-+ case e1000_ich8lan:
- case e1000_80003es2lan:
- hw->bus_type = e1000_bus_type_pci_express;
- hw->bus_speed = e1000_bus_speed_2500;
-@@ -5920,10 +6538,10 @@ e1000_get_bus_info(struct e1000_hw *hw)
- hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ?
- e1000_bus_type_pcix : e1000_bus_type_pci;
-
-- if(hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) {
-+ if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) {
- hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ?
- e1000_bus_speed_66 : e1000_bus_speed_120;
-- } else if(hw->bus_type == e1000_bus_type_pci) {
-+ } else if (hw->bus_type == e1000_bus_type_pci) {
- hw->bus_speed = (status & E1000_STATUS_PCI66) ?
- e1000_bus_speed_66 : e1000_bus_speed_33;
- } else {
-@@ -5947,8 +6565,6 @@ e1000_get_bus_info(struct e1000_hw *hw)
- break;
- }
- }
--
--#if 0
- /******************************************************************************
- * Reads a value from one of the devices registers using port I/O (as opposed
- * memory mapped I/O). Only 82544 and newer devices support port I/O.
-@@ -5966,7 +6582,6 @@ e1000_read_reg_io(struct e1000_hw *hw,
- e1000_io_write(hw, io_addr, offset);
- return e1000_io_read(hw, io_data);
- }
--#endif /* 0 */
-
- /******************************************************************************
- * Writes a value to one of the devices registers using port I/O (as opposed to
-@@ -5976,7 +6591,7 @@ e1000_read_reg_io(struct e1000_hw *hw,
- * offset - offset to write to
- * value - value to write
- *****************************************************************************/
--static void
-+void
- e1000_write_reg_io(struct e1000_hw *hw,
- uint32_t offset,
- uint32_t value)
-@@ -6004,15 +6619,13 @@ e1000_write_reg_io(struct e1000_hw *hw,
- * register to the minimum and maximum range.
- * For IGP phy's, the function calculates the range by the AGC registers.
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_get_cable_length(struct e1000_hw *hw,
- uint16_t *min_length,
- uint16_t *max_length)
- {
- int32_t ret_val;
- uint16_t agc_value = 0;
-- uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE;
-- uint16_t max_agc = 0;
- uint16_t i, phy_data;
- uint16_t cable_length;
-
-@@ -6021,11 +6634,11 @@ e1000_get_cable_length(struct e1000_hw *
- *min_length = *max_length = 0;
-
- /* Use old method for Phy older than IGP */
-- if(hw->phy_type == e1000_phy_m88) {
-+ if (hw->phy_type == e1000_phy_m88) {
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
- M88E1000_PSSR_CABLE_LENGTH_SHIFT;
-@@ -6084,36 +6697,38 @@ e1000_get_cable_length(struct e1000_hw *
- return -E1000_ERR_PHY;
- break;
- }
-- } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */
-+ } else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */
-+ uint16_t cur_agc_value;
-+ uint16_t min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE;
- uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] =
- {IGP01E1000_PHY_AGC_A,
- IGP01E1000_PHY_AGC_B,
- IGP01E1000_PHY_AGC_C,
- IGP01E1000_PHY_AGC_D};
- /* Read the AGC registers for all channels */
-- for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
-+ for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
-
- ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- cur_agc = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT;
-+ cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT;
-
-- /* Array bound check. */
-- if((cur_agc >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) ||
-- (cur_agc == 0))
-+ /* Value bound check. */
-+ if ((cur_agc_value >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) ||
-+ (cur_agc_value == 0))
- return -E1000_ERR_PHY;
-
-- agc_value += cur_agc;
-+ agc_value += cur_agc_value;
-
- /* Update minimal AGC value. */
-- if(min_agc > cur_agc)
-- min_agc = cur_agc;
-+ if (min_agc_value > cur_agc_value)
-+ min_agc_value = cur_agc_value;
- }
-
- /* Remove the minimal AGC result for length < 50m */
-- if(agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) {
-- agc_value -= min_agc;
-+ if (agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) {
-+ agc_value -= min_agc_value;
-
- /* Get the average length of the remaining 3 channels */
- agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1);
-@@ -6129,7 +6744,10 @@ e1000_get_cable_length(struct e1000_hw *
- IGP01E1000_AGC_RANGE) : 0;
- *max_length = e1000_igp_cable_length_table[agc_value] +
- IGP01E1000_AGC_RANGE;
-- } else if (hw->phy_type == e1000_phy_igp_2) {
-+ } else if (hw->phy_type == e1000_phy_igp_2 ||
-+ hw->phy_type == e1000_phy_igp_3) {
-+ uint16_t cur_agc_index, max_agc_index = 0;
-+ uint16_t min_agc_index = IGP02E1000_AGC_LENGTH_TABLE_SIZE - 1;
- uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] =
- {IGP02E1000_PHY_AGC_A,
- IGP02E1000_PHY_AGC_B,
-@@ -6141,22 +6759,30 @@ e1000_get_cable_length(struct e1000_hw *
- if (ret_val)
- return ret_val;
-
-- /* Getting bits 15:9, which represent the combination of course and
-+ /* Getting bits 15:9, which represent the combination of course and
- * fine gain values. The result is a number that can be put into
- * the lookup table to obtain the approximate cable length. */
-- cur_agc = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
-- IGP02E1000_AGC_LENGTH_MASK;
-+ cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
-+ IGP02E1000_AGC_LENGTH_MASK;
-+
-+ /* Array index bound check. */
-+ if ((cur_agc_index >= IGP02E1000_AGC_LENGTH_TABLE_SIZE) ||
-+ (cur_agc_index == 0))
-+ return -E1000_ERR_PHY;
-
- /* Remove min & max AGC values from calculation. */
-- if (e1000_igp_2_cable_length_table[min_agc] > e1000_igp_2_cable_length_table[cur_agc])
-- min_agc = cur_agc;
-- if (e1000_igp_2_cable_length_table[max_agc] < e1000_igp_2_cable_length_table[cur_agc])
-- max_agc = cur_agc;
-+ if (e1000_igp_2_cable_length_table[min_agc_index] >
-+ e1000_igp_2_cable_length_table[cur_agc_index])
-+ min_agc_index = cur_agc_index;
-+ if (e1000_igp_2_cable_length_table[max_agc_index] <
-+ e1000_igp_2_cable_length_table[cur_agc_index])
-+ max_agc_index = cur_agc_index;
-
-- agc_value += e1000_igp_2_cable_length_table[cur_agc];
-+ agc_value += e1000_igp_2_cable_length_table[cur_agc_index];
- }
-
-- agc_value -= (e1000_igp_2_cable_length_table[min_agc] + e1000_igp_2_cable_length_table[max_agc]);
-+ agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] +
-+ e1000_igp_2_cable_length_table[max_agc_index]);
- agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2);
-
- /* Calculate cable length with the error range of +/- 10 meters. */
-@@ -6184,7 +6810,7 @@ e1000_get_cable_length(struct e1000_hw *
- * return 0. If the link speed is 1000 Mbps the polarity status is in the
- * IGP01E1000_PHY_PCS_INIT_REG.
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_check_polarity(struct e1000_hw *hw,
- uint16_t *polarity)
- {
-@@ -6198,27 +6824,28 @@ e1000_check_polarity(struct e1000_hw *hw
- /* return the Polarity bit in the Status register. */
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >>
- M88E1000_PSSR_REV_POLARITY_SHIFT;
-- } else if(hw->phy_type == e1000_phy_igp ||
-+ } else if (hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2) {
- /* Read the Status register to check the speed */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to
- * find the polarity status */
-- if((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
-+ if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
- IGP01E1000_PSSR_SPEED_1000MBPS) {
-
- /* Read the GIG initialization PCS register (0x00B4) */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Check the polarity bits */
-@@ -6228,6 +6855,13 @@ e1000_check_polarity(struct e1000_hw *hw
- * 100 Mbps this bit is always 0) */
- *polarity = phy_data & IGP01E1000_PSSR_POLARITY_REVERSED;
- }
-+ } else if (hw->phy_type == e1000_phy_ife) {
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_EXTENDED_STATUS_CONTROL,
-+ &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+ *polarity = (phy_data & IFE_PESC_POLARITY_REVERSED) >>
-+ IFE_PESC_POLARITY_REVERSED_SHIFT;
- }
- return E1000_SUCCESS;
- }
-@@ -6240,14 +6874,14 @@ e1000_check_polarity(struct e1000_hw *hw
- * 1 - Downshift ocured.
- *
- * returns: - E1000_ERR_XXX
-- * E1000_SUCCESS
-+ * E1000_SUCCESS
- *
- * For phy's older then IGP, this function reads the Downshift bit in the Phy
- * Specific Status register. For IGP phy's, it reads the Downgrade bit in the
- * Link Health register. In IGP this bit is latched high, so the driver must
- * read it immediately after link is established.
- *****************************************************************************/
--static int32_t
-+int32_t
- e1000_check_downshift(struct e1000_hw *hw)
- {
- int32_t ret_val;
-@@ -6255,11 +6889,12 @@ e1000_check_downshift(struct e1000_hw *h
-
- DEBUGFUNC("e1000_check_downshift");
-
-- if(hw->phy_type == e1000_phy_igp ||
-+ if (hw->phy_type == e1000_phy_igp ||
-+ hw->phy_type == e1000_phy_igp_3 ||
- hw->phy_type == e1000_phy_igp_2) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0;
-@@ -6267,11 +6902,14 @@ e1000_check_downshift(struct e1000_hw *h
- (hw->phy_type == e1000_phy_gg82563)) {
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >>
- M88E1000_PSSR_DOWNSHIFT_SHIFT;
-+ } else if (hw->phy_type == e1000_phy_ife) {
-+ /* e1000_phy_ife supports 10/100 speed only */
-+ hw->speed_downgraded = FALSE;
- }
-
- return E1000_SUCCESS;
-@@ -6289,7 +6927,7 @@ e1000_check_downshift(struct e1000_hw *h
- *
- ****************************************************************************/
-
--static int32_t
-+int32_t
- e1000_config_dsp_after_link_change(struct e1000_hw *hw,
- boolean_t link_up)
- {
-@@ -6304,40 +6942,42 @@ e1000_config_dsp_after_link_change(struc
-
- DEBUGFUNC("e1000_config_dsp_after_link_change");
-
-- if(hw->phy_type != e1000_phy_igp)
-+ if (hw->phy_type != e1000_phy_igp)
- return E1000_SUCCESS;
-
-- if(link_up) {
-+ if (link_up) {
- ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);
-- if(ret_val) {
-+ if (ret_val) {
- DEBUGOUT("Error getting link speed and duplex\n");
- return ret_val;
- }
-
-- if(speed == SPEED_1000) {
-+ if (speed == SPEED_1000) {
-
-- e1000_get_cable_length(hw, &min_length, &max_length);
-+ ret_val = e1000_get_cable_length(hw, &min_length, &max_length);
-+ if (ret_val)
-+ return ret_val;
-
-- if((hw->dsp_config_state == e1000_dsp_config_enabled) &&
-+ if ((hw->dsp_config_state == e1000_dsp_config_enabled) &&
- min_length >= e1000_igp_cable_length_50) {
-
-- for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
-+ for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
- ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i],
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX;
-
- ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i],
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
- hw->dsp_config_state = e1000_dsp_config_activated;
- }
-
-- if((hw->ffe_config_state == e1000_ffe_config_enabled) &&
-+ if ((hw->ffe_config_state == e1000_ffe_config_enabled) &&
- (min_length < e1000_igp_cable_length_50)) {
-
- uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20;
-@@ -6346,70 +6986,70 @@ e1000_config_dsp_after_link_change(struc
- /* clear previous idle error counts */
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- for(i = 0; i < ffe_idle_err_timeout; i++) {
-- udelay(1000);
-+ for (i = 0; i < ffe_idle_err_timeout; i++) {
-+ usec_delay(1000);
- ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT);
-- if(idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) {
-+ if (idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) {
- hw->ffe_config_state = e1000_ffe_config_active;
-
- ret_val = e1000_write_phy_reg(hw,
- IGP01E1000_PHY_DSP_FFE,
- IGP01E1000_PHY_DSP_FFE_CM_CP);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- break;
- }
-
-- if(idle_errs)
-+ if (idle_errs)
- ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100;
- }
- }
- }
- } else {
-- if(hw->dsp_config_state == e1000_dsp_config_activated) {
-+ if (hw->dsp_config_state == e1000_dsp_config_activated) {
- /* Save off the current value of register 0x2F5B to be restored at
- * the end of the routines. */
- ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Disable the PHY transmitter */
- ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- msec_delay_irq(20);
-
- ret_val = e1000_write_phy_reg(hw, 0x0000,
- IGP01E1000_IEEE_FORCE_GIGA);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-- for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
-+ for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {
- ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX;
- phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS;
-
- ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
- ret_val = e1000_write_phy_reg(hw, 0x0000,
- IGP01E1000_IEEE_RESTART_AUTONEG);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- msec_delay_irq(20);
-@@ -6417,40 +7057,40 @@ e1000_config_dsp_after_link_change(struc
- /* Now enable the transmitter */
- ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->dsp_config_state = e1000_dsp_config_enabled;
- }
-
-- if(hw->ffe_config_state == e1000_ffe_config_active) {
-+ if (hw->ffe_config_state == e1000_ffe_config_active) {
- /* Save off the current value of register 0x2F5B to be restored at
- * the end of the routines. */
- ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Disable the PHY transmitter */
- ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- msec_delay_irq(20);
-
- ret_val = e1000_write_phy_reg(hw, 0x0000,
- IGP01E1000_IEEE_FORCE_GIGA);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE,
- IGP01E1000_PHY_DSP_FFE_DEFAULT);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_write_phy_reg(hw, 0x0000,
- IGP01E1000_IEEE_RESTART_AUTONEG);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- msec_delay_irq(20);
-@@ -6458,7 +7098,7 @@ e1000_config_dsp_after_link_change(struc
- /* Now enable the transmitter */
- ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
-
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->ffe_config_state = e1000_ffe_config_enabled;
-@@ -6483,20 +7123,20 @@ e1000_set_phy_mode(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_set_phy_mode");
-
-- if((hw->mac_type == e1000_82545_rev_3) &&
-- (hw->media_type == e1000_media_type_copper)) {
-+ if ((hw->mac_type == e1000_82545_rev_3) &&
-+ (hw->media_type == e1000_media_type_copper)) {
- ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, &eeprom_data);
-- if(ret_val) {
-+ if (ret_val) {
- return ret_val;
- }
-
-- if((eeprom_data != EEPROM_RESERVED_WORD) &&
-- (eeprom_data & EEPROM_PHY_CLASS_A)) {
-+ if ((eeprom_data != EEPROM_RESERVED_WORD) &&
-+ (eeprom_data & EEPROM_PHY_CLASS_A)) {
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x000B);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x8104);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- hw->phy_reset_disable = FALSE;
-@@ -6520,43 +7160,55 @@ e1000_set_phy_mode(struct e1000_hw *hw)
- *
- ****************************************************************************/
-
--static int32_t
-+int32_t
- e1000_set_d3_lplu_state(struct e1000_hw *hw,
- boolean_t active)
- {
-+ uint32_t phy_ctrl = 0;
- int32_t ret_val;
- uint16_t phy_data;
- DEBUGFUNC("e1000_set_d3_lplu_state");
-
-- if(hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2)
-+ if (hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2
-+ && hw->phy_type != e1000_phy_igp_3)
- return E1000_SUCCESS;
-
- /* During driver activity LPLU should not be used or it will attain link
- * from the lowest speeds starting from 10Mbps. The capability is used for
- * Dx transitions and states */
-- if(hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) {
-+ if (hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-+ } else if (hw->mac_type == e1000_ich8lan) {
-+ /* MAC writes into PHY register based on the state transition
-+ * and start auto-negotiation. SW driver can overwrite the settings
-+ * in CSR PHY power control E1000_PHY_CTRL register. */
-+ phy_ctrl = E1000_READ_REG(hw, PHY_CTRL);
- } else {
- ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-- if(!active) {
-- if(hw->mac_type == e1000_82541_rev_2 ||
-- hw->mac_type == e1000_82547_rev_2) {
-+ if (!active) {
-+ if (hw->mac_type == e1000_82541_rev_2 ||
-+ hw->mac_type == e1000_82547_rev_2) {
- phy_data &= ~IGP01E1000_GMII_FLEX_SPD;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else {
-+ if (hw->mac_type == e1000_ich8lan) {
-+ phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU;
-+ E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl);
-+ } else {
- phy_data &= ~IGP02E1000_PM_D3_LPLU;
- ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
- phy_data);
- if (ret_val)
- return ret_val;
-+ }
- }
-
- /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during
-@@ -6566,13 +7218,13 @@ e1000_set_d3_lplu_state(struct e1000_hw
- if (hw->smart_speed == e1000_smart_speed_on) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else if (hw->smart_speed == e1000_smart_speed_off) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
-@@ -6583,36 +7235,41 @@ e1000_set_d3_lplu_state(struct e1000_hw
- phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-- } else if((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) ||
-- (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) ||
-- (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) {
-+ } else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) ||
-+ (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) ||
-+ (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) {
-
-- if(hw->mac_type == e1000_82541_rev_2 ||
-- hw->mac_type == e1000_82547_rev_2) {
-+ if (hw->mac_type == e1000_82541_rev_2 ||
-+ hw->mac_type == e1000_82547_rev_2) {
- phy_data |= IGP01E1000_GMII_FLEX_SPD;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else {
-+ if (hw->mac_type == e1000_ich8lan) {
-+ phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU;
-+ E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl);
-+ } else {
- phy_data |= IGP02E1000_PM_D3_LPLU;
- ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
- phy_data);
- if (ret_val)
- return ret_val;
-+ }
- }
-
- /* When LPLU is enabled we should disable SmartSpeed */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- }
-@@ -6633,26 +7290,36 @@ e1000_set_d3_lplu_state(struct e1000_hw
- *
- ****************************************************************************/
-
--static int32_t
-+int32_t
- e1000_set_d0_lplu_state(struct e1000_hw *hw,
- boolean_t active)
- {
-+ uint32_t phy_ctrl = 0;
- int32_t ret_val;
- uint16_t phy_data;
- DEBUGFUNC("e1000_set_d0_lplu_state");
-
-- if(hw->mac_type <= e1000_82547_rev_2)
-+ if (hw->mac_type <= e1000_82547_rev_2)
- return E1000_SUCCESS;
-
-+ if (hw->mac_type == e1000_ich8lan) {
-+ phy_ctrl = E1000_READ_REG(hw, PHY_CTRL);
-+ } else {
- ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-+ }
-
- if (!active) {
-+ if (hw->mac_type == e1000_ich8lan) {
-+ phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU;
-+ E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl);
-+ } else {
- phy_data &= ~IGP02E1000_PM_D0_LPLU;
- ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
- if (ret_val)
- return ret_val;
-+ }
-
- /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during
- * Dx states where the power conservation is most important. During
-@@ -6661,13 +7328,13 @@ e1000_set_d0_lplu_state(struct e1000_hw
- if (hw->smart_speed == e1000_smart_speed_on) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- } else if (hw->smart_speed == e1000_smart_speed_off) {
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
-@@ -6678,26 +7345,31 @@ e1000_set_d0_lplu_state(struct e1000_hw
- phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
- phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- }
-
-
- } else {
--
-- phy_data |= IGP02E1000_PM_D0_LPLU;
-+
-+ if (hw->mac_type == e1000_ich8lan) {
-+ phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU;
-+ E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl);
-+ } else {
-+ phy_data |= IGP02E1000_PM_D0_LPLU;
- ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
- if (ret_val)
- return ret_val;
-+ }
-
- /* When LPLU is enabled we should disable SmartSpeed */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- }
-@@ -6718,7 +7390,7 @@ e1000_set_vco_speed(struct e1000_hw *hw)
-
- DEBUGFUNC("e1000_set_vco_speed");
-
-- switch(hw->mac_type) {
-+ switch (hw->mac_type) {
- case e1000_82545_rev_3:
- case e1000_82546_rev_3:
- break;
-@@ -6729,39 +7401,39 @@ e1000_set_vco_speed(struct e1000_hw *hw)
- /* Set PHY register 30, page 5, bit 8 to 0 */
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data &= ~M88E1000_PHY_VCO_REG_BIT8;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* Set PHY register 30, page 4, bit 11 to 1 */
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- phy_data |= M88E1000_PHY_VCO_REG_BIT11;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- return E1000_SUCCESS;
-@@ -6777,7 +7449,7 @@ int32_t
- e1000_host_if_read_cookie(struct e1000_hw * hw, uint8_t *buffer)
- {
- uint8_t i;
-- uint32_t offset = E1000_MNG_DHCP_COOKIE_OFFSET;
-+ uint32_t offset = E1000_MNG_DHCP_COOKIE_OFFSET;
- uint8_t length = E1000_MNG_DHCP_COOKIE_LENGTH;
-
- length = (length >> 2);
-@@ -6796,11 +7468,11 @@ e1000_host_if_read_cookie(struct e1000_h
- * and also checks whether the previous command is completed.
- * It busy waits in case of previous command is not completed.
- *
-- * returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or
-+ * returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or
- * timeout
- * - E1000_SUCCESS for success.
- ****************************************************************************/
--static int32_t
-+int32_t
- e1000_mng_enable_host_if(struct e1000_hw * hw)
- {
- uint32_t hicr;
-@@ -6820,7 +7492,7 @@ e1000_mng_enable_host_if(struct e1000_hw
- msec_delay_irq(1);
- }
-
-- if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
-+ if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
- DEBUGOUT("Previous command timeout failed .\n");
- return -E1000_ERR_HOST_INTERFACE_COMMAND;
- }
-@@ -6834,13 +7506,13 @@ e1000_mng_enable_host_if(struct e1000_hw
- *
- * returns - E1000_SUCCESS for success.
- ****************************************************************************/
--static int32_t
-+int32_t
- e1000_mng_host_if_write(struct e1000_hw * hw, uint8_t *buffer,
- uint16_t length, uint16_t offset, uint8_t *sum)
- {
- uint8_t *tmp;
- uint8_t *bufptr = buffer;
-- uint32_t data;
-+ uint32_t data = 0;
- uint16_t remaining, i, j, prev_bytes;
-
- /* sum = only sum of the data and it is not checksum */
-@@ -6902,7 +7574,7 @@ e1000_mng_host_if_write(struct e1000_hw
- *
- * returns - E1000_SUCCESS for success.
- ****************************************************************************/
--static int32_t
-+int32_t
- e1000_mng_write_cmd_header(struct e1000_hw * hw,
- struct e1000_host_mng_command_header * hdr)
- {
-@@ -6920,15 +7592,17 @@ e1000_mng_write_cmd_header(struct e1000_
-
- buffer = (uint8_t *) hdr;
- i = length;
-- while(i--)
-+ while (i--)
- sum += buffer[i];
-
- hdr->checksum = 0 - sum;
-
- length >>= 2;
- /* The device driver writes the relevant command block into the ram area. */
-- for (i = 0; i < length; i++)
-+ for (i = 0; i < length; i++) {
- E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((uint32_t *) hdr + i));
-+ E1000_WRITE_FLUSH(hw);
-+ }
-
- return E1000_SUCCESS;
- }
-@@ -6940,9 +7614,8 @@ e1000_mng_write_cmd_header(struct e1000_
- *
- * returns - E1000_SUCCESS for success.
- ****************************************************************************/
--static int32_t
--e1000_mng_write_commit(
-- struct e1000_hw * hw)
-+int32_t
-+e1000_mng_write_commit(struct e1000_hw * hw)
- {
- uint32_t hicr;
-
-@@ -6960,15 +7633,18 @@ e1000_mng_write_commit(
- * returns - TRUE when the mode is IAMT or FALSE.
- ****************************************************************************/
- boolean_t
--e1000_check_mng_mode(
-- struct e1000_hw *hw)
-+e1000_check_mng_mode(struct e1000_hw *hw)
- {
- uint32_t fwsm;
-
- fwsm = E1000_READ_REG(hw, FWSM);
-
-- if((fwsm & E1000_FWSM_MODE_MASK) ==
-- (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT))
-+ if (hw->mac_type == e1000_ich8lan) {
-+ if ((fwsm & E1000_FWSM_MODE_MASK) ==
-+ (E1000_MNG_ICH_IAMT_MODE << E1000_FWSM_MODE_SHIFT))
-+ return TRUE;
-+ } else if ((fwsm & E1000_FWSM_MODE_MASK) ==
-+ (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT))
- return TRUE;
-
- return FALSE;
-@@ -7111,31 +7787,31 @@ e1000_polarity_reversal_workaround(struc
- /* Disable the transmitter on the PHY */
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* This loop will early-out if the NO link condition has been met. */
-- for(i = PHY_FORCE_TIME; i > 0; i--) {
-+ for (i = PHY_FORCE_TIME; i > 0; i--) {
- /* Read the MII Status Register and wait for Link Status bit
- * to be clear.
- */
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break;
-+ if ((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break;
- msec_delay_irq(100);
- }
-
-@@ -7145,40 +7821,40 @@ e1000_polarity_reversal_workaround(struc
- /* Now we will re-enable th transmitter on the PHY */
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- msec_delay_irq(50);
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- msec_delay_irq(50);
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
- msec_delay_irq(50);
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- /* This loop will early-out if the link condition has been met. */
-- for(i = PHY_FORCE_TIME; i > 0; i--) {
-+ for (i = PHY_FORCE_TIME; i > 0; i--) {
- /* Read the MII Status Register and wait for Link Status bit
- * to be set.
- */
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
- ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
-- if(ret_val)
-+ if (ret_val)
- return ret_val;
-
-- if(mii_status_reg & MII_SR_LINK_STATUS) break;
-+ if (mii_status_reg & MII_SR_LINK_STATUS) break;
- msec_delay_irq(100);
- }
- return E1000_SUCCESS;
-@@ -7193,7 +7869,7 @@ e1000_polarity_reversal_workaround(struc
- * returns: - none.
- *
- ***************************************************************************/
--static void
-+void
- e1000_set_pci_express_master_disable(struct e1000_hw *hw)
- {
- uint32_t ctrl;
-@@ -7208,7 +7884,6 @@ e1000_set_pci_express_master_disable(str
- E1000_WRITE_REG(hw, CTRL, ctrl);
- }
-
--#if 0
- /***************************************************************************
- *
- * Enables PCI-Express master access.
-@@ -7232,7 +7907,6 @@ e1000_enable_pciex_master(struct e1000_h
- ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE;
- E1000_WRITE_REG(hw, CTRL, ctrl);
- }
--#endif /* 0 */
-
- /*******************************************************************************
- *
-@@ -7257,15 +7931,15 @@ e1000_disable_pciex_master(struct e1000_
-
- e1000_set_pci_express_master_disable(hw);
-
-- while(timeout) {
-- if(!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE))
-+ while (timeout) {
-+ if (!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE))
- break;
- else
-- udelay(100);
-+ usec_delay(100);
- timeout--;
- }
-
-- if(!timeout) {
-+ if (!timeout) {
- DEBUGOUT("Master requests are pending.\n");
- return -E1000_ERR_MASTER_REQUESTS_PENDING;
- }
-@@ -7283,7 +7957,7 @@ e1000_disable_pciex_master(struct e1000_
- * E1000_SUCCESS at any other case.
- *
- ******************************************************************************/
--static int32_t
-+int32_t
- e1000_get_auto_rd_done(struct e1000_hw *hw)
- {
- int32_t timeout = AUTO_READ_DONE_TIMEOUT;
-@@ -7298,13 +7972,15 @@ e1000_get_auto_rd_done(struct e1000_hw *
- case e1000_82572:
- case e1000_82573:
- case e1000_80003es2lan:
-- while(timeout) {
-- if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break;
-+ case e1000_ich8lan:
-+ while (timeout) {
-+ if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD)
-+ break;
- else msec_delay(1);
- timeout--;
- }
-
-- if(!timeout) {
-+ if (!timeout) {
- DEBUGOUT("Auto read by HW from EEPROM has not completed.\n");
- return -E1000_ERR_RESET;
- }
-@@ -7329,7 +8005,7 @@ e1000_get_auto_rd_done(struct e1000_hw *
- * E1000_SUCCESS at any other case.
- *
- ***************************************************************************/
--static int32_t
-+int32_t
- e1000_get_phy_cfg_done(struct e1000_hw *hw)
- {
- int32_t timeout = PHY_CFG_TIMEOUT;
-@@ -7339,7 +8015,7 @@ e1000_get_phy_cfg_done(struct e1000_hw *
-
- switch (hw->mac_type) {
- default:
-- msec_delay(10);
-+ msec_delay_irq(10);
- break;
- case e1000_80003es2lan:
- /* Separate *_CFG_DONE_* bit for each port */
-@@ -7377,7 +8053,7 @@ e1000_get_phy_cfg_done(struct e1000_hw *
- * E1000_SUCCESS at any other case.
- *
- ***************************************************************************/
--static int32_t
-+int32_t
- e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw)
- {
- int32_t timeout;
-@@ -7385,7 +8061,7 @@ e1000_get_hw_eeprom_semaphore(struct e10
-
- DEBUGFUNC("e1000_get_hw_eeprom_semaphore");
-
-- if(!hw->eeprom_semaphore_present)
-+ if (!hw->eeprom_semaphore_present)
- return E1000_SUCCESS;
-
- if (hw->mac_type == e1000_80003es2lan) {
-@@ -7396,20 +8072,20 @@ e1000_get_hw_eeprom_semaphore(struct e10
-
- /* Get the FW semaphore. */
- timeout = hw->eeprom.word_size + 1;
-- while(timeout) {
-+ while (timeout) {
- swsm = E1000_READ_REG(hw, SWSM);
- swsm |= E1000_SWSM_SWESMBI;
- E1000_WRITE_REG(hw, SWSM, swsm);
- /* if we managed to set the bit we got the semaphore. */
- swsm = E1000_READ_REG(hw, SWSM);
-- if(swsm & E1000_SWSM_SWESMBI)
-+ if (swsm & E1000_SWSM_SWESMBI)
- break;
-
-- udelay(50);
-+ usec_delay(50);
- timeout--;
- }
-
-- if(!timeout) {
-+ if (!timeout) {
- /* Release semaphores */
- e1000_put_hw_eeprom_semaphore(hw);
- DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n");
-@@ -7427,14 +8103,14 @@ e1000_get_hw_eeprom_semaphore(struct e10
- * returns: - None.
- *
- ***************************************************************************/
--static void
-+void
- e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)
- {
- uint32_t swsm;
-
- DEBUGFUNC("e1000_put_hw_eeprom_semaphore");
-
-- if(!hw->eeprom_semaphore_present)
-+ if (!hw->eeprom_semaphore_present)
- return;
-
- swsm = E1000_READ_REG(hw, SWSM);
-@@ -7467,16 +8143,16 @@ e1000_get_software_semaphore(struct e100
- if (hw->mac_type != e1000_80003es2lan)
- return E1000_SUCCESS;
-
-- while(timeout) {
-+ while (timeout) {
- swsm = E1000_READ_REG(hw, SWSM);
- /* If SMBI bit cleared, it is now set and we hold the semaphore */
-- if(!(swsm & E1000_SWSM_SMBI))
-+ if (!(swsm & E1000_SWSM_SMBI))
- break;
- msec_delay_irq(1);
- timeout--;
- }
-
-- if(!timeout) {
-+ if (!timeout) {
- DEBUGOUT("Driver can't access device - SMBI bit is set.\n");
- return -E1000_ERR_RESET;
- }
-@@ -7522,6 +8198,13 @@ int32_t
- e1000_check_phy_reset_block(struct e1000_hw *hw)
- {
- uint32_t manc = 0;
-+ uint32_t fwsm = 0;
-+
-+ if (hw->mac_type == e1000_ich8lan) {
-+ fwsm = E1000_READ_REG(hw, FWSM);
-+ return (fwsm & E1000_FWSM_RSPCIPHY) ? E1000_SUCCESS
-+ : E1000_BLK_PHY_RESET;
-+ }
-
- if (hw->mac_type > e1000_82547_rev_2)
- manc = E1000_READ_REG(hw, MANC);
-@@ -7529,7 +8212,7 @@ e1000_check_phy_reset_block(struct e1000
- E1000_BLK_PHY_RESET : E1000_SUCCESS;
- }
-
--static uint8_t
-+uint8_t
- e1000_arc_subsystem_valid(struct e1000_hw *hw)
- {
- uint32_t fwsm;
-@@ -7545,9 +8228,11 @@ e1000_arc_subsystem_valid(struct e1000_h
- case e1000_82573:
- case e1000_80003es2lan:
- fwsm = E1000_READ_REG(hw, FWSM);
-- if((fwsm & E1000_FWSM_MODE_MASK) != 0)
-+ if ((fwsm & E1000_FWSM_MODE_MASK) != 0)
- return TRUE;
- break;
-+ case e1000_ich8lan:
-+ return TRUE;
- default:
- break;
- }
-@@ -7555,4 +8240,854 @@ e1000_arc_subsystem_valid(struct e1000_h
- }
-
-
-+/******************************************************************************
-+ * Configure PCI-Ex no-snoop
-+ *
-+ * hw - Struct containing variables accessed by shared code.
-+ * no_snoop - Bitmap of no-snoop events.
-+ *
-+ * returns: E1000_SUCCESS
-+ *
-+ *****************************************************************************/
-+int32_t
-+e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop)
-+{
-+ uint32_t gcr_reg = 0;
-+
-+ DEBUGFUNC("e1000_set_pci_ex_no_snoop");
-+
-+ if (hw->bus_type == e1000_bus_type_unknown)
-+ e1000_get_bus_info(hw);
-+
-+ if (hw->bus_type != e1000_bus_type_pci_express)
-+ return E1000_SUCCESS;
-+
-+ if (no_snoop) {
-+ gcr_reg = E1000_READ_REG(hw, GCR);
-+ gcr_reg &= ~(PCI_EX_NO_SNOOP_ALL);
-+ gcr_reg |= no_snoop;
-+ E1000_WRITE_REG(hw, GCR, gcr_reg);
-+ }
-+ if (hw->mac_type == e1000_ich8lan) {
-+ uint32_t ctrl_ext;
-+
-+ E1000_WRITE_REG(hw, GCR, PCI_EX_82566_SNOOP_ALL);
-+
-+ ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
-+ ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
-+ E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
-+ }
-+
-+ return E1000_SUCCESS;
-+}
-+
-+/***************************************************************************
-+ *
-+ * Get software semaphore FLAG bit (SWFLAG).
-+ * SWFLAG is used to synchronize the access to all shared resource between
-+ * SW, FW and HW.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *
-+ ***************************************************************************/
-+int32_t
-+e1000_get_software_flag(struct e1000_hw *hw)
-+{
-+ int32_t timeout = PHY_CFG_TIMEOUT;
-+ uint32_t extcnf_ctrl;
-+
-+ DEBUGFUNC("e1000_get_software_flag");
-+
-+ if (hw->mac_type == e1000_ich8lan) {
-+ while (timeout) {
-+ extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL);
-+ extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
-+ E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl);
-+
-+ extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL);
-+ if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
-+ break;
-+ msec_delay_irq(1);
-+ timeout--;
-+ }
-+
-+ if (!timeout) {
-+ DEBUGOUT("FW or HW locks the resource too long.\n");
-+ return -E1000_ERR_CONFIG;
-+ }
-+ }
-+
-+ return E1000_SUCCESS;
-+}
-+
-+/***************************************************************************
-+ *
-+ * Release software semaphore FLAG bit (SWFLAG).
-+ * SWFLAG is used to synchronize the access to all shared resource between
-+ * SW, FW and HW.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *
-+ ***************************************************************************/
-+void
-+e1000_release_software_flag(struct e1000_hw *hw)
-+{
-+ uint32_t extcnf_ctrl;
-+
-+ DEBUGFUNC("e1000_release_software_flag");
-+
-+ if (hw->mac_type == e1000_ich8lan) {
-+ extcnf_ctrl= E1000_READ_REG(hw, EXTCNF_CTRL);
-+ extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
-+ E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl);
-+ }
-+
-+ return;
-+}
-+
-+/***************************************************************************
-+ *
-+ * Disable dynamic power down mode in ife PHY.
-+ * It can be used to workaround band-gap problem.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *
-+ ***************************************************************************/
-+int32_t
-+e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw)
-+{
-+ uint16_t phy_data;
-+ int32_t ret_val = E1000_SUCCESS;
-+
-+ DEBUGFUNC("e1000_ife_disable_dynamic_power_down");
-+
-+ if (hw->phy_type == e1000_phy_ife) {
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data |= IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN;
-+ ret_val = e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, phy_data);
-+ }
-+
-+ return ret_val;
-+}
-+
-+/***************************************************************************
-+ *
-+ * Enable dynamic power down mode in ife PHY.
-+ * It can be used to workaround band-gap problem.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *
-+ ***************************************************************************/
-+int32_t
-+e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw)
-+{
-+ uint16_t phy_data;
-+ int32_t ret_val = E1000_SUCCESS;
-+
-+ DEBUGFUNC("e1000_ife_enable_dynamic_power_down");
-+
-+ if (hw->phy_type == e1000_phy_ife) {
-+ ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data &= ~IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN;
-+ ret_val = e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, phy_data);
-+ }
-+
-+ return ret_val;
-+}
-+
-+/******************************************************************************
-+ * Reads a 16 bit word or words from the EEPROM using the ICH8's flash access
-+ * register.
-+ *
-+ * hw - Struct containing variables accessed by shared code
-+ * offset - offset of word in the EEPROM to read
-+ * data - word read from the EEPROM
-+ * words - number of words to read
-+ *****************************************************************************/
-+int32_t
-+e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words,
-+ uint16_t *data)
-+{
-+ int32_t error = E1000_SUCCESS;
-+ uint32_t flash_bank = 0;
-+ uint32_t act_offset = 0;
-+ uint32_t bank_offset = 0;
-+ uint16_t word = 0;
-+ uint16_t i = 0;
-+
-+ /* We need to know which is the valid flash bank. In the event
-+ * that we didn't allocate eeprom_shadow_ram, we may not be
-+ * managing flash_bank. So it cannot be trusted and needs
-+ * to be updated with each read.
-+ */
-+ /* Value of bit 22 corresponds to the flash bank we're on. */
-+ flash_bank = (E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL) ? 1 : 0;
-+
-+ /* Adjust offset appropriately if we're on bank 1 - adjust for word size */
-+ bank_offset = flash_bank * (hw->flash_bank_size * 2);
-+
-+ error = e1000_get_software_flag(hw);
-+ if (error != E1000_SUCCESS)
-+ return error;
-+
-+ for (i = 0; i < words; i++) {
-+ if (hw->eeprom_shadow_ram != NULL &&
-+ hw->eeprom_shadow_ram[offset+i].modified == TRUE) {
-+ data[i] = hw->eeprom_shadow_ram[offset+i].eeprom_word;
-+ } else {
-+ /* The NVM part needs a byte offset, hence * 2 */
-+ act_offset = bank_offset + ((offset + i) * 2);
-+ error = e1000_read_ich8_word(hw, act_offset, &word);
-+ if (error != E1000_SUCCESS)
-+ break;
-+ data[i] = word;
-+ }
-+ }
-+
-+ e1000_release_software_flag(hw);
-+
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * Writes a 16 bit word or words to the EEPROM using the ICH8's flash access
-+ * register. Actually, writes are written to the shadow ram cache in the hw
-+ * structure hw->e1000_shadow_ram. e1000_commit_shadow_ram flushes this to
-+ * the NVM, which occurs when the NVM checksum is updated.
-+ *
-+ * hw - Struct containing variables accessed by shared code
-+ * offset - offset of word in the EEPROM to write
-+ * words - number of words to write
-+ * data - words to write to the EEPROM
-+ *****************************************************************************/
-+int32_t
-+e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words,
-+ uint16_t *data)
-+{
-+ uint32_t i = 0;
-+ int32_t error = E1000_SUCCESS;
-+
-+ error = e1000_get_software_flag(hw);
-+ if (error != E1000_SUCCESS)
-+ return error;
-+
-+ /* A driver can write to the NVM only if it has eeprom_shadow_ram
-+ * allocated. Subsequent reads to the modified words are read from
-+ * this cached structure as well. Writes will only go into this
-+ * cached structure unless it's followed by a call to
-+ * e1000_update_eeprom_checksum() where it will commit the changes
-+ * and clear the "modified" field.
-+ */
-+ if (hw->eeprom_shadow_ram != NULL) {
-+ for (i = 0; i < words; i++) {
-+ if ((offset + i) < E1000_SHADOW_RAM_WORDS) {
-+ hw->eeprom_shadow_ram[offset+i].modified = TRUE;
-+ hw->eeprom_shadow_ram[offset+i].eeprom_word = data[i];
-+ } else {
-+ error = -E1000_ERR_EEPROM;
-+ break;
-+ }
-+ }
-+ } else {
-+ /* Drivers have the option to not allocate eeprom_shadow_ram as long
-+ * as they don't perform any NVM writes. An attempt in doing so
-+ * will result in this error.
-+ */
-+ error = -E1000_ERR_EEPROM;
-+ }
-+
-+ e1000_release_software_flag(hw);
-+
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * This function does initial flash setup so that a new read/write/erase cycle
-+ * can be started.
-+ *
-+ * hw - The pointer to the hw structure
-+ ****************************************************************************/
-+int32_t
-+e1000_ich8_cycle_init(struct e1000_hw *hw)
-+{
-+ union ich8_hws_flash_status hsfsts;
-+ int32_t error = E1000_ERR_EEPROM;
-+ int32_t i = 0;
-+
-+ DEBUGFUNC("e1000_ich8_cycle_init");
-+
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+
-+ /* May be check the Flash Des Valid bit in Hw status */
-+ if (hsfsts.hsf_status.fldesvalid == 0) {
-+ DEBUGOUT("Flash descriptor invalid. SW Sequencing must be used.");
-+ return error;
-+ }
-+
-+ /* Clear FCERR in Hw status by writing 1 */
-+ /* Clear DAEL in Hw status by writing a 1 */
-+ hsfsts.hsf_status.flcerr = 1;
-+ hsfsts.hsf_status.dael = 1;
-+
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval);
-+
-+ /* Either we should have a hardware SPI cycle in progress bit to check
-+ * against, in order to start a new cycle or FDONE bit should be changed
-+ * in the hardware so that it is 1 after harware reset, which can then be
-+ * used as an indication whether a cycle is in progress or has been
-+ * completed .. we should also have some software semaphore mechanism to
-+ * guard FDONE or the cycle in progress bit so that two threads access to
-+ * those bits can be sequentiallized or a way so that 2 threads dont
-+ * start the cycle at the same time */
-+
-+ if (hsfsts.hsf_status.flcinprog == 0) {
-+ /* There is no cycle running at present, so we can start a cycle */
-+ /* Begin by setting Flash Cycle Done. */
-+ hsfsts.hsf_status.flcdone = 1;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval);
-+ error = E1000_SUCCESS;
-+ } else {
-+ /* otherwise poll for sometime so the current cycle has a chance
-+ * to end before giving up. */
-+ for (i = 0; i < ICH8_FLASH_COMMAND_TIMEOUT; i++) {
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+ if (hsfsts.hsf_status.flcinprog == 0) {
-+ error = E1000_SUCCESS;
-+ break;
-+ }
-+ usec_delay(1);
-+ }
-+ if (error == E1000_SUCCESS) {
-+ /* Successful in waiting for previous cycle to timeout,
-+ * now set the Flash Cycle Done. */
-+ hsfsts.hsf_status.flcdone = 1;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval);
-+ } else {
-+ DEBUGOUT("Flash controller busy, cannot get access");
-+ }
-+ }
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * This function starts a flash cycle and waits for its completion
-+ *
-+ * hw - The pointer to the hw structure
-+ ****************************************************************************/
-+int32_t
-+e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout)
-+{
-+ union ich8_hws_flash_ctrl hsflctl;
-+ union ich8_hws_flash_status hsfsts;
-+ int32_t error = E1000_ERR_EEPROM;
-+ uint32_t i = 0;
-+
-+ /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
-+ hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL);
-+ hsflctl.hsf_ctrl.flcgo = 1;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval);
-+
-+ /* wait till FDONE bit is set to 1 */
-+ do {
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+ if (hsfsts.hsf_status.flcdone == 1)
-+ break;
-+ usec_delay(1);
-+ i++;
-+ } while (i < timeout);
-+ if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0) {
-+ error = E1000_SUCCESS;
-+ }
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * Reads a byte or word from the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - The pointer to the hw structure
-+ * index - The index of the byte or word to read.
-+ * size - Size of data to read, 1=byte 2=word
-+ * data - Pointer to the word to store the value read.
-+ *****************************************************************************/
-+int32_t
-+e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
-+ uint32_t size, uint16_t* data)
-+{
-+ union ich8_hws_flash_status hsfsts;
-+ union ich8_hws_flash_ctrl hsflctl;
-+ uint32_t flash_linear_address;
-+ uint32_t flash_data = 0;
-+ int32_t error = -E1000_ERR_EEPROM;
-+ int32_t count = 0;
-+
-+ DEBUGFUNC("e1000_read_ich8_data");
-+
-+ if (size < 1 || size > 2 || data == 0x0 ||
-+ index > ICH8_FLASH_LINEAR_ADDR_MASK)
-+ return error;
-+
-+ flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) +
-+ hw->flash_base_addr;
-+
-+ do {
-+ usec_delay(1);
-+ /* Steps */
-+ error = e1000_ich8_cycle_init(hw);
-+ if (error != E1000_SUCCESS)
-+ break;
-+
-+ hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL);
-+ /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
-+ hsflctl.hsf_ctrl.fldbcount = size - 1;
-+ hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_READ;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval);
-+
-+ /* Write the last 24 bits of index into Flash Linear address field in
-+ * Flash Address */
-+ /* TODO: TBD maybe check the index against the size of flash */
-+
-+ E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address);
-+
-+ error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT);
-+
-+ /* Check if FCERR is set to 1, if set to 1, clear it and try the whole
-+ * sequence a few more times, else read in (shift in) the Flash Data0,
-+ * the order is least significant byte first msb to lsb */
-+ if (error == E1000_SUCCESS) {
-+ flash_data = E1000_READ_ICH8_REG(hw, ICH8_FLASH_FDATA0);
-+ if (size == 1) {
-+ *data = (uint8_t)(flash_data & 0x000000FF);
-+ } else if (size == 2) {
-+ *data = (uint16_t)(flash_data & 0x0000FFFF);
-+ }
-+ break;
-+ } else {
-+ /* If we've gotten here, then things are probably completely hosed,
-+ * but if the error condition is detected, it won't hurt to give
-+ * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times.
-+ */
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+ if (hsfsts.hsf_status.flcerr == 1) {
-+ /* Repeat for some time before giving up. */
-+ continue;
-+ } else if (hsfsts.hsf_status.flcdone == 0) {
-+ DEBUGOUT("Timeout error - flash cycle did not complete.");
-+ break;
-+ }
-+ }
-+ } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT);
-+
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * Writes One /two bytes to the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - The pointer to the hw structure
-+ * index - The index of the byte/word to read.
-+ * size - Size of data to read, 1=byte 2=word
-+ * data - The byte(s) to write to the NVM.
-+ *****************************************************************************/
-+int32_t
-+e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size,
-+ uint16_t data)
-+{
-+ union ich8_hws_flash_status hsfsts;
-+ union ich8_hws_flash_ctrl hsflctl;
-+ uint32_t flash_linear_address;
-+ uint32_t flash_data = 0;
-+ int32_t error = -E1000_ERR_EEPROM;
-+ int32_t count = 0;
-+
-+ DEBUGFUNC("e1000_write_ich8_data");
-+
-+ if (size < 1 || size > 2 || data > size * 0xff ||
-+ index > ICH8_FLASH_LINEAR_ADDR_MASK)
-+ return error;
-+
-+ flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) +
-+ hw->flash_base_addr;
-+
-+ do {
-+ usec_delay(1);
-+ /* Steps */
-+ error = e1000_ich8_cycle_init(hw);
-+ if (error != E1000_SUCCESS)
-+ break;
-+
-+ hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL);
-+ /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
-+ hsflctl.hsf_ctrl.fldbcount = size -1;
-+ hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_WRITE;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval);
-+
-+ /* Write the last 24 bits of index into Flash Linear address field in
-+ * Flash Address */
-+ E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address);
-+
-+ if (size == 1)
-+ flash_data = (uint32_t)data & 0x00FF;
-+ else
-+ flash_data = (uint32_t)data;
-+
-+ E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FDATA0, flash_data);
-+
-+ /* check if FCERR is set to 1 , if set to 1, clear it and try the whole
-+ * sequence a few more times else done */
-+ error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT);
-+ if (error == E1000_SUCCESS) {
-+ break;
-+ } else {
-+ /* If we're here, then things are most likely completely hosed,
-+ * but if the error condition is detected, it won't hurt to give
-+ * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times.
-+ */
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+ if (hsfsts.hsf_status.flcerr == 1) {
-+ /* Repeat for some time before giving up. */
-+ continue;
-+ } else if (hsfsts.hsf_status.flcdone == 0) {
-+ DEBUGOUT("Timeout error - flash cycle did not complete.");
-+ break;
-+ }
-+ }
-+ } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT);
-+
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * Reads a single byte from the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * index - The index of the byte to read.
-+ * data - Pointer to a byte to store the value read.
-+ *****************************************************************************/
-+int32_t
-+e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t* data)
-+{
-+ int32_t status = E1000_SUCCESS;
-+ uint16_t word = 0;
-+
-+ status = e1000_read_ich8_data(hw, index, 1, &word);
-+ if (status == E1000_SUCCESS) {
-+ *data = (uint8_t)word;
-+ }
-+
-+ return status;
-+}
-+
-+/******************************************************************************
-+ * Writes a single byte to the NVM using the ICH8 flash access registers.
-+ * Performs verification by reading back the value and then going through
-+ * a retry algorithm before giving up.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * index - The index of the byte to write.
-+ * byte - The byte to write to the NVM.
-+ *****************************************************************************/
-+int32_t
-+e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t byte)
-+{
-+ int32_t error = E1000_SUCCESS;
-+ int32_t program_retries;
-+ uint8_t temp_byte;
-+
-+ e1000_write_ich8_byte(hw, index, byte);
-+ usec_delay(100);
-+
-+ for (program_retries = 0; program_retries < 100; program_retries++) {
-+ e1000_read_ich8_byte(hw, index, &temp_byte);
-+ if (temp_byte == byte)
-+ break;
-+ usec_delay(10);
-+ e1000_write_ich8_byte(hw, index, byte);
-+ usec_delay(100);
-+ }
-+ if (program_retries == 100)
-+ error = E1000_ERR_EEPROM;
-+
-+ return error;
-+}
-+
-+/******************************************************************************
-+ * Writes a single byte to the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * index - The index of the byte to read.
-+ * data - The byte to write to the NVM.
-+ *****************************************************************************/
-+int32_t
-+e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t data)
-+{
-+ int32_t status = E1000_SUCCESS;
-+ uint16_t word = (uint16_t)data;
-+
-+ status = e1000_write_ich8_data(hw, index, 1, word);
-+
-+ return status;
-+}
-+
-+/******************************************************************************
-+ * Reads a word from the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * index - The starting byte index of the word to read.
-+ * data - Pointer to a word to store the value read.
-+ *****************************************************************************/
-+int32_t
-+e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data)
-+{
-+ int32_t status = E1000_SUCCESS;
-+ status = e1000_read_ich8_data(hw, index, 2, data);
-+ return status;
-+}
-+
-+/******************************************************************************
-+ * Writes a word to the NVM using the ICH8 flash access registers.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * index - The starting byte index of the word to read.
-+ * data - The word to write to the NVM.
-+ *****************************************************************************/
-+int32_t
-+e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data)
-+{
-+ int32_t status = E1000_SUCCESS;
-+ status = e1000_write_ich8_data(hw, index, 2, data);
-+ return status;
-+}
-+
-+/******************************************************************************
-+ * Erases the bank specified. Each bank is a 4k block. Segments are 0 based.
-+ * segment N is 4096 * N + flash_reg_addr.
-+ *
-+ * hw - pointer to e1000_hw structure
-+ * segment - 0 for first segment, 1 for second segment, etc.
-+ *****************************************************************************/
-+int32_t
-+e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment)
-+{
-+ union ich8_hws_flash_status hsfsts;
-+ union ich8_hws_flash_ctrl hsflctl;
-+ uint32_t flash_linear_address;
-+ int32_t count = 0;
-+ int32_t error = E1000_ERR_EEPROM;
-+ int32_t iteration, seg_size;
-+ int32_t sector_size;
-+ int32_t j = 0;
-+ int32_t error_flag = 0;
-+
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+
-+ /* Determine HW Sector size: Read BERASE bits of Hw flash Status register */
-+ /* 00: The Hw sector is 256 bytes, hence we need to erase 16
-+ * consecutive sectors. The start index for the nth Hw sector can be
-+ * calculated as = segment * 4096 + n * 256
-+ * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector.
-+ * The start index for the nth Hw sector can be calculated
-+ * as = segment * 4096
-+ * 10: Error condition
-+ * 11: The Hw sector size is much bigger than the size asked to
-+ * erase...error condition */
-+ if (hsfsts.hsf_status.berasesz == 0x0) {
-+ /* Hw sector size 256 */
-+ sector_size = seg_size = ICH8_FLASH_SEG_SIZE_256;
-+ iteration = ICH8_FLASH_SECTOR_SIZE / ICH8_FLASH_SEG_SIZE_256;
-+ } else if (hsfsts.hsf_status.berasesz == 0x1) {
-+ sector_size = seg_size = ICH8_FLASH_SEG_SIZE_4K;
-+ iteration = 1;
-+ } else if (hsfsts.hsf_status.berasesz == 0x3) {
-+ sector_size = seg_size = ICH8_FLASH_SEG_SIZE_64K;
-+ iteration = 1;
-+ } else {
-+ return error;
-+ }
-+
-+ for (j = 0; j < iteration ; j++) {
-+ do {
-+ count++;
-+ /* Steps */
-+ error = e1000_ich8_cycle_init(hw);
-+ if (error != E1000_SUCCESS) {
-+ error_flag = 1;
-+ break;
-+ }
-+
-+ /* Write a value 11 (block Erase) in Flash Cycle field in Hw flash
-+ * Control */
-+ hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL);
-+ hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_ERASE;
-+ E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval);
-+
-+ /* Write the last 24 bits of an index within the block into Flash
-+ * Linear address field in Flash Address. This probably needs to
-+ * be calculated here based off the on-chip segment size and the
-+ * software segment size assumed (4K) */
-+ /* TBD */
-+ flash_linear_address = segment * sector_size + j * seg_size;
-+ flash_linear_address &= ICH8_FLASH_LINEAR_ADDR_MASK;
-+ flash_linear_address += hw->flash_base_addr;
-+
-+ E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address);
-+
-+ error = e1000_ich8_flash_cycle(hw, 1000000);
-+ /* Check if FCERR is set to 1. If 1, clear it and try the whole
-+ * sequence a few more times else Done */
-+ if (error == E1000_SUCCESS) {
-+ break;
-+ } else {
-+ hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS);
-+ if (hsfsts.hsf_status.flcerr == 1) {
-+ /* repeat for some time before giving up */
-+ continue;
-+ } else if (hsfsts.hsf_status.flcdone == 0) {
-+ error_flag = 1;
-+ break;
-+ }
-+ }
-+ } while ((count < ICH8_FLASH_CYCLE_REPEAT_COUNT) && !error_flag);
-+ if (error_flag == 1)
-+ break;
-+ }
-+ if (error_flag != 1)
-+ error = E1000_SUCCESS;
-+ return error;
-+}
-+
-+/******************************************************************************
-+ *
-+ * Reverse duplex setting without breaking the link.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *
-+ *****************************************************************************/
-+int32_t
-+e1000_duplex_reversal(struct e1000_hw *hw)
-+{
-+ int32_t ret_val;
-+ uint16_t phy_data;
-+
-+ if (hw->phy_type != e1000_phy_igp_3)
-+ return E1000_SUCCESS;
-+
-+ ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data ^= MII_CR_FULL_DUPLEX;
-+
-+ ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ ret_val = e1000_read_phy_reg(hw, IGP3E1000_PHY_MISC_CTRL, &phy_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ phy_data |= IGP3_PHY_MISC_DUPLEX_MANUAL_SET;
-+ ret_val = e1000_write_phy_reg(hw, IGP3E1000_PHY_MISC_CTRL, phy_data);
-+
-+ return ret_val;
-+}
-+
-+int32_t
-+e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw,
-+ uint32_t cnf_base_addr, uint32_t cnf_size)
-+{
-+ uint32_t ret_val = E1000_SUCCESS;
-+ uint16_t word_addr, reg_data, reg_addr;
-+ uint16_t i;
-+
-+ /* cnf_base_addr is in DWORD */
-+ word_addr = (uint16_t)(cnf_base_addr << 1);
-+
-+ /* cnf_size is returned in size of dwords */
-+ for (i = 0; i < cnf_size; i++) {
-+ ret_val = e1000_read_eeprom(hw, (word_addr + i*2), 1, &reg_data);
-+ if (ret_val)
-+ return ret_val;
-+
-+ ret_val = e1000_read_eeprom(hw, (word_addr + i*2 + 1), 1, &reg_addr);
-+ if (ret_val)
-+ return ret_val;
-+
-+ ret_val = e1000_get_software_flag(hw);
-+ if (ret_val != E1000_SUCCESS)
-+ return ret_val;
-+
-+ ret_val = e1000_write_phy_reg_ex(hw, (uint32_t)reg_addr, reg_data);
-+
-+ e1000_release_software_flag(hw);
-+ }
-+
-+ return ret_val;
-+}
-+
-+
-+/******************************************************************************
-+ * This function initializes the PHY from the NVM on ICH8 platforms. This
-+ * is needed due to an issue where the NVM configuration is not properly
-+ * autoloaded after power transitions. Therefore, after each PHY reset, we
-+ * will load the configuration data out of the NVM manually.
-+ *
-+ * hw: Struct containing variables accessed by shared code
-+ *****************************************************************************/
-+int32_t
-+e1000_init_lcd_from_nvm(struct e1000_hw *hw)
-+{
-+ uint32_t reg_data, cnf_base_addr, cnf_size, ret_val, loop;
-+
-+ if (hw->phy_type != e1000_phy_igp_3)
-+ return E1000_SUCCESS;
-+
-+ /* Check if SW needs configure the PHY */
-+ reg_data = E1000_READ_REG(hw, FEXTNVM);
-+ if (!(reg_data & FEXTNVM_SW_CONFIG))
-+ return E1000_SUCCESS;
-+
-+ /* Wait for basic configuration completes before proceeding*/
-+ loop = 0;
-+ do {
-+ reg_data = E1000_READ_REG(hw, STATUS) & E1000_STATUS_LAN_INIT_DONE;
-+ usec_delay(100);
-+ loop++;
-+ } while ((!reg_data) && (loop < 50));
-+
-+ /* Clear the Init Done bit for the next init event */
-+ reg_data = E1000_READ_REG(hw, STATUS);
-+ reg_data &= ~E1000_STATUS_LAN_INIT_DONE;
-+ E1000_WRITE_REG(hw, STATUS, reg_data);
-+
-+ /* Make sure HW does not configure LCD from PHY extended configuration
-+ before SW configuration */
-+ reg_data = E1000_READ_REG(hw, EXTCNF_CTRL);
-+ if ((reg_data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) == 0x0000) {
-+ reg_data = E1000_READ_REG(hw, EXTCNF_SIZE);
-+ cnf_size = reg_data & E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH;
-+ cnf_size >>= 16;
-+ if (cnf_size) {
-+ reg_data = E1000_READ_REG(hw, EXTCNF_CTRL);
-+ cnf_base_addr = reg_data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER;
-+ /* cnf_base_addr is in DWORD */
-+ cnf_base_addr >>= 16;
-+
-+ /* Configure LCD from extended configuration region. */
-+ ret_val = e1000_init_lcd_from_nvm_config_region(hw, cnf_base_addr,
-+ cnf_size);
-+ if (ret_val)
-+ return ret_val;
-+ }
-+ }
-+
-+ return E1000_SUCCESS;
-+}
-+
-+
-
-diff -Nurap ./drivers/net/e1000.e1000/e1000_hw.h ./drivers/net/e1000/e1000_hw.h
---- ./drivers/net/e1000.e1000/e1000_hw.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_hw.h 2006-08-31 14:59:51.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -61,6 +62,7 @@ typedef enum {
- e1000_82572,
- e1000_82573,
- e1000_80003es2lan,
-+ e1000_ich8lan,
- e1000_num_macs
- } e1000_mac_type;
-
-@@ -69,6 +71,7 @@ typedef enum {
- e1000_eeprom_spi,
- e1000_eeprom_microwire,
- e1000_eeprom_flash,
-+ e1000_eeprom_ich8,
- e1000_eeprom_none, /* No NVM support */
- e1000_num_eeprom_types
- } e1000_eeprom_type;
-@@ -97,6 +100,11 @@ typedef enum {
- e1000_fc_default = 0xFF
- } e1000_fc_type;
-
-+struct e1000_shadow_ram {
-+ uint16_t eeprom_word;
-+ boolean_t modified;
-+};
-+
- /* PCI bus types */
- typedef enum {
- e1000_bus_type_unknown = 0,
-@@ -217,6 +225,8 @@ typedef enum {
- e1000_phy_igp,
- e1000_phy_igp_2,
- e1000_phy_gg82563,
-+ e1000_phy_igp_3,
-+ e1000_phy_ife,
- e1000_phy_undefined = 0xFF
- } e1000_phy_type;
-
-@@ -296,6 +306,7 @@ typedef enum {
- /* Initialization */
- int32_t e1000_reset_hw(struct e1000_hw *hw);
- int32_t e1000_init_hw(struct e1000_hw *hw);
-+int32_t e1000_id_led_init(struct e1000_hw * hw);
- int32_t e1000_set_mac_type(struct e1000_hw *hw);
- void e1000_set_media_type(struct e1000_hw *hw);
-
-@@ -303,8 +314,10 @@ void e1000_set_media_type(struct e1000_h
- int32_t e1000_setup_link(struct e1000_hw *hw);
- int32_t e1000_phy_setup_autoneg(struct e1000_hw *hw);
- void e1000_config_collision_dist(struct e1000_hw *hw);
-+int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);
- int32_t e1000_check_for_link(struct e1000_hw *hw);
- int32_t e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex);
-+int32_t e1000_wait_autoneg(struct e1000_hw *hw);
- int32_t e1000_force_mac_fc(struct e1000_hw *hw);
-
- /* PHY */
-@@ -312,13 +325,28 @@ int32_t e1000_read_phy_reg(struct e1000_
- int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data);
- int32_t e1000_phy_hw_reset(struct e1000_hw *hw);
- int32_t e1000_phy_reset(struct e1000_hw *hw);
-+void e1000_phy_powerdown_workaround(struct e1000_hw *hw);
-+int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw);
-+int32_t e1000_duplex_reversal(struct e1000_hw *hw);
-+int32_t e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, uint32_t cnf_base_addr, uint32_t cnf_size);
-+int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw);
-+int32_t e1000_detect_gig_phy(struct e1000_hw *hw);
- int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-+int32_t e1000_phy_m88_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-+int32_t e1000_phy_igp_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-+int32_t e1000_get_cable_length(struct e1000_hw *hw, uint16_t *min_length, uint16_t *max_length);
-+int32_t e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity);
-+int32_t e1000_check_downshift(struct e1000_hw *hw);
- int32_t e1000_validate_mdi_setting(struct e1000_hw *hw);
- int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data);
- int32_t e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data);
-
- /* EEPROM Functions */
- int32_t e1000_init_eeprom_params(struct e1000_hw *hw);
-+boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
-+int32_t e1000_read_eeprom_eerd(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
-+int32_t e1000_write_eeprom_eewr(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
-+int32_t e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd);
-
- /* MNG HOST IF functions */
- uint32_t e1000_enable_mng_pass_thru(struct e1000_hw *hw);
-@@ -327,9 +355,10 @@ uint32_t e1000_enable_mng_pass_thru(stru
- #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 /* Host Interface data length */
-
- #define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 /* Time in ms to process MNG command */
--#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */
--#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */
--#define E1000_MNG_IAMT_MODE 0x3
-+#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */
-+#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */
-+#define E1000_MNG_IAMT_MODE 0x3
-+#define E1000_MNG_ICH_IAMT_MODE 0x2
- #define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */
-
- #define E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT 0x1 /* DHCP parsing enabled */
-@@ -350,7 +379,7 @@ struct e1000_host_mng_command_info {
- struct e1000_host_mng_command_header command_header; /* Command Head/Command Result Head has 4 bytes */
- uint8_t command_data[E1000_HI_MAX_MNG_DATA_LENGTH]; /* Command data can length 0..0x658*/
- };
--#ifdef __BIG_ENDIAN
-+#ifdef E1000_BIG_ENDIAN
- struct e1000_host_mng_dhcp_cookie{
- uint32_t signature;
- uint16_t vlan_id;
-@@ -374,10 +403,17 @@ struct e1000_host_mng_dhcp_cookie{
- };
- #endif
-
--int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer,
-- uint16_t length);
-+int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer,
-+ uint16_t length);
- boolean_t e1000_check_mng_mode(struct e1000_hw *hw);
- boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
-+int32_t e1000_mng_enable_host_if(struct e1000_hw *hw);
-+int32_t e1000_mng_host_if_write(struct e1000_hw *hw, uint8_t *buffer,
-+ uint16_t length, uint16_t offset, uint8_t *sum);
-+int32_t e1000_mng_write_cmd_header(struct e1000_hw* hw,
-+ struct e1000_host_mng_command_header* hdr);
-+
-+int32_t e1000_mng_write_commit(struct e1000_hw *hw);
-
- int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data);
- int32_t e1000_validate_eeprom_checksum(struct e1000_hw *hw);
-@@ -387,23 +423,29 @@ int32_t e1000_read_part_num(struct e1000
- int32_t e1000_read_mac_addr(struct e1000_hw * hw);
- int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);
- void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask);
-+void e1000_release_software_flag(struct e1000_hw *hw);
-+int32_t e1000_get_software_flag(struct e1000_hw *hw);
-
- /* Filters (multicast, vlan, receive) */
-+void e1000_init_rx_addrs(struct e1000_hw *hw);
- void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count);
- uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);
- void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);
- void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);
- void e1000_write_vfta(struct e1000_hw *hw, uint32_t offset, uint32_t value);
-+void e1000_clear_vfta(struct e1000_hw *hw);
-
- /* LED functions */
- int32_t e1000_setup_led(struct e1000_hw *hw);
- int32_t e1000_cleanup_led(struct e1000_hw *hw);
- int32_t e1000_led_on(struct e1000_hw *hw);
- int32_t e1000_led_off(struct e1000_hw *hw);
-+int32_t e1000_blink_led_start(struct e1000_hw *hw);
-
- /* Adaptive IFS Functions */
-
- /* Everything else */
-+void e1000_clear_hw_cntrs(struct e1000_hw *hw);
- void e1000_reset_adaptive(struct e1000_hw *hw);
- void e1000_update_adaptive(struct e1000_hw *hw);
- void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, uint32_t frame_len, uint8_t * mac_addr);
-@@ -416,11 +458,54 @@ void e1000_write_pci_cfg(struct e1000_hw
- uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port);
- uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset);
- void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);
-+void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value);
-+int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw, boolean_t link_up);
-+int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
-+int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active);
-+void e1000_set_pci_express_master_disable(struct e1000_hw *hw);
- void e1000_enable_pciex_master(struct e1000_hw *hw);
- int32_t e1000_disable_pciex_master(struct e1000_hw *hw);
-+int32_t e1000_get_auto_rd_done(struct e1000_hw *hw);
-+int32_t e1000_get_phy_cfg_done(struct e1000_hw *hw);
- int32_t e1000_get_software_semaphore(struct e1000_hw *hw);
- void e1000_release_software_semaphore(struct e1000_hw *hw);
- int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
-+int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
-+void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
-+int32_t e1000_commit_shadow_ram(struct e1000_hw *hw);
-+uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw);
-+int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop);
-+
-+int32_t e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index,
-+ uint8_t *data);
-+int32_t e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index,
-+ uint8_t byte);
-+int32_t e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index,
-+ uint8_t byte);
-+int32_t e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index,
-+ uint16_t *data);
-+int32_t e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index,
-+ uint16_t word);
-+int32_t e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
-+ uint32_t size, uint16_t *data);
-+int32_t e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index,
-+ uint32_t size, uint16_t data);
-+int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset,
-+ uint16_t words, uint16_t *data);
-+int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset,
-+ uint16_t words, uint16_t *data);
-+int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment);
-+int32_t e1000_ich8_cycle_init(struct e1000_hw *hw);
-+int32_t e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout);
-+int32_t e1000_phy_ife_get_info(struct e1000_hw *hw,
-+ struct e1000_phy_info *phy_info);
-+int32_t e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw);
-+int32_t e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw);
-+
-+#define E1000_READ_REG_IO(a, reg) \
-+ e1000_read_reg_io((a), E1000_##reg)
-+#define E1000_WRITE_REG_IO(a, reg, val) \
-+ e1000_write_reg_io((a), E1000_##reg, val)
-
- /* PCI Device IDs */
- #define E1000_DEV_ID_82542 0x1000
-@@ -445,6 +530,7 @@ int32_t e1000_check_phy_reset_block(stru
- #define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D
- #define E1000_DEV_ID_82541EI 0x1013
- #define E1000_DEV_ID_82541EI_MOBILE 0x1018
-+#define E1000_DEV_ID_82541ER_LOM 0x1014
- #define E1000_DEV_ID_82541ER 0x1078
- #define E1000_DEV_ID_82547GI 0x1075
- #define E1000_DEV_ID_82541GI 0x1076
-@@ -456,18 +542,29 @@ int32_t e1000_check_phy_reset_block(stru
- #define E1000_DEV_ID_82546GB_PCIE 0x108A
- #define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099
- #define E1000_DEV_ID_82547EI 0x1019
-+#define E1000_DEV_ID_82547EI_MOBILE 0x101A
- #define E1000_DEV_ID_82571EB_COPPER 0x105E
- #define E1000_DEV_ID_82571EB_FIBER 0x105F
- #define E1000_DEV_ID_82571EB_SERDES 0x1060
-+#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
- #define E1000_DEV_ID_82572EI_COPPER 0x107D
- #define E1000_DEV_ID_82572EI_FIBER 0x107E
- #define E1000_DEV_ID_82572EI_SERDES 0x107F
-+#define E1000_DEV_ID_82572EI 0x10B9
- #define E1000_DEV_ID_82573E 0x108B
- #define E1000_DEV_ID_82573E_IAMT 0x108C
- #define E1000_DEV_ID_82573L 0x109A
- #define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5
- #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
- #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
-+#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA
-+#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB
-+
-+#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049
-+#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A
-+#define E1000_DEV_ID_ICH8_IGP_C 0x104B
-+#define E1000_DEV_ID_ICH8_IFE 0x104C
-+#define E1000_DEV_ID_ICH8_IGP_M 0x104D
-
-
- #define NODE_ADDRESS_SIZE 6
-@@ -503,7 +600,7 @@ int32_t e1000_check_phy_reset_block(stru
-
-
- /* 802.1q VLAN Packet Sizes */
--#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */
-+#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */
-
- /* Ethertype field values */
- #define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */
-@@ -538,6 +635,14 @@ int32_t e1000_check_phy_reset_block(stru
- E1000_IMS_RXSEQ | \
- E1000_IMS_LSC)
-
-+/* Additional interrupts need to be handled for e1000_ich8lan:
-+ DSW = The FW changed the status of the DISSW bit in FWSM
-+ PHYINT = The LAN connected device generates an interrupt
-+ EPRST = Manageability reset event */
-+#define IMS_ICH8LAN_ENABLE_MASK (\
-+ E1000_IMS_DSW | \
-+ E1000_IMS_PHYINT | \
-+ E1000_IMS_EPRST)
-
- /* Number of high/low register pairs in the RAR. The RAR (Receive Address
- * Registers) holds the directed and multicast addresses that we monitor. We
-@@ -545,6 +650,7 @@ int32_t e1000_check_phy_reset_block(stru
- * E1000_RAR_ENTRIES - 1 multicast addresses.
- */
- #define E1000_RAR_ENTRIES 15
-+#define E1000_RAR_ENTRIES_ICH8LAN 7
-
- #define MIN_NUMBER_OF_DESCRIPTORS 8
- #define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8
-@@ -668,6 +774,7 @@ union e1000_rx_desc_packet_split {
- E1000_RXDEXT_STATERR_CXE | \
- E1000_RXDEXT_STATERR_RXE)
-
-+
- /* Transmit Descriptor */
- struct e1000_tx_desc {
- uint64_t buffer_addr; /* Address of the descriptor's data buffer */
-@@ -766,6 +873,9 @@ struct e1000_data_desc {
- #define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */
- #define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */
-
-+#define E1000_NUM_UNICAST_ICH8LAN 7
-+#define E1000_MC_TBL_SIZE_ICH8LAN 32
-+
-
- /* Receive Address Register */
- struct e1000_rar {
-@@ -775,6 +885,7 @@ struct e1000_rar {
-
- /* Number of entries in the Multicast Table Array (MTA). */
- #define E1000_NUM_MTA_REGISTERS 128
-+#define E1000_NUM_MTA_REGISTERS_ICH8LAN 32
-
- /* IPv4 Address Table Entry */
- struct e1000_ipv4_at_entry {
-@@ -785,6 +896,7 @@ struct e1000_ipv4_at_entry {
- /* Four wakeup IP addresses are supported */
- #define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4
- #define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX
-+#define E1000_IP4AT_SIZE_ICH8LAN 3
- #define E1000_IP6AT_SIZE 1
-
- /* IPv6 Address Table Entry */
-@@ -843,6 +955,7 @@ struct e1000_ffvt_entry {
- #define E1000_FLA 0x0001C /* Flash Access - RW */
- #define E1000_MDIC 0x00020 /* MDI Control - RW */
- #define E1000_SCTL 0x00024 /* SerDes Control - RW */
-+#define E1000_FEXTNVM 0x00028 /* Future Extended NVM register */
- #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */
- #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */
- #define E1000_FCT 0x00030 /* Flow Control Type - RW */
-@@ -871,6 +984,8 @@ struct e1000_ffvt_entry {
- #define E1000_LEDCTL 0x00E00 /* LED Control - RW */
- #define E1000_EXTCNF_CTRL 0x00F00 /* Extended Configuration Control */
- #define E1000_EXTCNF_SIZE 0x00F08 /* Extended Configuration Size */
-+#define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */
-+#define FEXTNVM_SW_CONFIG 0x0001
- #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
- #define E1000_PBS 0x01008 /* Packet Buffer Size */
- #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
-@@ -898,11 +1013,13 @@ struct e1000_ffvt_entry {
- #define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */
- #define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */
- #define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */
--#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */
-+#define E1000_RXDCTL 0x02828 /* RX Descriptor Control queue 0 - RW */
-+#define E1000_RXDCTL1 0x02928 /* RX Descriptor Control queue 1 - RW */
- #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */
- #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */
- #define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */
- #define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */
-+#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */
- #define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */
- #define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */
- #define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */
-@@ -1049,6 +1166,7 @@ struct e1000_ffvt_entry {
- #define E1000_82542_FLA E1000_FLA
- #define E1000_82542_MDIC E1000_MDIC
- #define E1000_82542_SCTL E1000_SCTL
-+#define E1000_82542_FEXTNVM E1000_FEXTNVM
- #define E1000_82542_FCAL E1000_FCAL
- #define E1000_82542_FCAH E1000_FCAH
- #define E1000_82542_FCT E1000_FCT
-@@ -1072,6 +1190,19 @@ struct e1000_ffvt_entry {
- #define E1000_82542_RDLEN0 E1000_82542_RDLEN
- #define E1000_82542_RDH0 E1000_82542_RDH
- #define E1000_82542_RDT0 E1000_82542_RDT
-+#define E1000_82542_SRRCTL(_n) (0x280C + ((_n) << 8)) /* Split and Replication
-+ * RX Control - RW */
-+#define E1000_82542_DCA_RXCTRL(_n) (0x02814 + ((_n) << 8))
-+#define E1000_82542_RDBAH3 0x02B04 /* RX Desc Base High Queue 3 - RW */
-+#define E1000_82542_RDBAL3 0x02B00 /* RX Desc Low Queue 3 - RW */
-+#define E1000_82542_RDLEN3 0x02B08 /* RX Desc Length Queue 3 - RW */
-+#define E1000_82542_RDH3 0x02B10 /* RX Desc Head Queue 3 - RW */
-+#define E1000_82542_RDT3 0x02B18 /* RX Desc Tail Queue 3 - RW */
-+#define E1000_82542_RDBAL2 0x02A00 /* RX Desc Base Low Queue 2 - RW */
-+#define E1000_82542_RDBAH2 0x02A04 /* RX Desc Base High Queue 2 - RW */
-+#define E1000_82542_RDLEN2 0x02A08 /* RX Desc Length Queue 2 - RW */
-+#define E1000_82542_RDH2 0x02A10 /* RX Desc Head Queue 2 - RW */
-+#define E1000_82542_RDT2 0x02A18 /* RX Desc Tail Queue 2 - RW */
- #define E1000_82542_RDTR1 0x00130
- #define E1000_82542_RDBAL1 0x00138
- #define E1000_82542_RDBAH1 0x0013C
-@@ -1109,11 +1240,14 @@ struct e1000_ffvt_entry {
- #define E1000_82542_FLOP E1000_FLOP
- #define E1000_82542_EXTCNF_CTRL E1000_EXTCNF_CTRL
- #define E1000_82542_EXTCNF_SIZE E1000_EXTCNF_SIZE
-+#define E1000_82542_PHY_CTRL E1000_PHY_CTRL
- #define E1000_82542_ERT E1000_ERT
- #define E1000_82542_RXDCTL E1000_RXDCTL
-+#define E1000_82542_RXDCTL1 E1000_RXDCTL1
- #define E1000_82542_RADV E1000_RADV
- #define E1000_82542_RSRPD E1000_RSRPD
- #define E1000_82542_TXDMAC E1000_TXDMAC
-+#define E1000_82542_KABGTXD E1000_KABGTXD
- #define E1000_82542_TDFHS E1000_TDFHS
- #define E1000_82542_TDFTS E1000_TDFTS
- #define E1000_82542_TDFPC E1000_TDFPC
-@@ -1309,13 +1443,16 @@ struct e1000_hw_stats {
-
- /* Structure containing variables used by the shared code (e1000_hw.c) */
- struct e1000_hw {
-- uint8_t __iomem *hw_addr;
-+ uint8_t *hw_addr;
- uint8_t *flash_address;
- e1000_mac_type mac_type;
- e1000_phy_type phy_type;
- uint32_t phy_init_script;
- e1000_media_type media_type;
- void *back;
-+ struct e1000_shadow_ram *eeprom_shadow_ram;
-+ uint32_t flash_bank_size;
-+ uint32_t flash_base_addr;
- e1000_fc_type fc;
- e1000_bus_speed bus_speed;
- e1000_bus_width bus_width;
-@@ -1327,6 +1464,7 @@ struct e1000_hw {
- uint32_t asf_firmware_present;
- uint32_t eeprom_semaphore_present;
- uint32_t swfw_sync_present;
-+ uint32_t swfwhw_semaphore_present;
- unsigned long io_base;
- uint32_t phy_id;
- uint32_t phy_revision;
-@@ -1386,6 +1524,7 @@ struct e1000_hw {
- boolean_t in_ifs_mode;
- boolean_t mng_reg_access_disabled;
- boolean_t leave_av_bit_off;
-+ boolean_t kmrn_lock_loss_workaround_disabled;
- };
-
-
-@@ -1434,6 +1573,7 @@ struct e1000_hw {
- #define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */
- #define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
- #define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */
-+#define E1000_CTRL_SW2FW_INT 0x02000000 /* Initiate an interrupt to manageability engine */
-
- /* Device Status */
- #define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
-@@ -1448,6 +1588,8 @@ struct e1000_hw {
- #define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */
- #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
- #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
-+#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion
-+ by EEPROM/Flash */
- #define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */
- #define E1000_STATUS_DOCK_CI 0x00000800 /* Change in Dock/Undock state. Clear on write '0'. */
- #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */
-@@ -1505,6 +1647,10 @@ struct e1000_hw {
- #define E1000_STM_OPCODE 0xDB00
- #define E1000_HICR_FW_RESET 0xC0
-
-+#define E1000_SHADOW_RAM_WORDS 2048
-+#define E1000_ICH8_NVM_SIG_WORD 0x13
-+#define E1000_ICH8_NVM_SIG_MASK 0xC0
-+
- /* EEPROM Read */
- #define E1000_EERD_START 0x00000001 /* Start Read */
- #define E1000_EERD_DONE 0x00000010 /* Read Done */
-@@ -1550,7 +1696,6 @@ struct e1000_hw {
- #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000
- #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000
- #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000
--#define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */
- #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */
- #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
- #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
-@@ -1590,12 +1735,31 @@ struct e1000_hw {
- #define E1000_KUMCTRLSTA_FIFO_CTRL_TX_BYPASS 0x00000800
-
- /* In-Band Control */
-+#define E1000_KUMCTRLSTA_INB_CTRL_LINK_STATUS_TX_TIMEOUT_DEFAULT 0x00000500
- #define E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING 0x00000010
-
- /* Half-Duplex Control */
- #define E1000_KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x00000004
- #define E1000_KUMCTRLSTA_HD_CTRL_1000_DEFAULT 0x00000000
-
-+#define E1000_KUMCTRLSTA_OFFSET_K0S_CTRL 0x0000001E
-+
-+#define E1000_KUMCTRLSTA_DIAG_FELPBK 0x2000
-+#define E1000_KUMCTRLSTA_DIAG_NELPBK 0x1000
-+
-+#define E1000_KUMCTRLSTA_K0S_100_EN 0x2000
-+#define E1000_KUMCTRLSTA_K0S_GBE_EN 0x1000
-+#define E1000_KUMCTRLSTA_K0S_ENTRY_LATENCY_MASK 0x0003
-+
-+#define E1000_KABGTXD_BGSQLBIAS 0x00050000
-+
-+#define E1000_PHY_CTRL_SPD_EN 0x00000001
-+#define E1000_PHY_CTRL_D0A_LPLU 0x00000002
-+#define E1000_PHY_CTRL_NOND0A_LPLU 0x00000004
-+#define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008
-+#define E1000_PHY_CTRL_GBE_DISABLE 0x00000040
-+#define E1000_PHY_CTRL_B2B_EN 0x00000080
-+
- /* LED Control */
- #define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F
- #define E1000_LEDCTL_LED0_MODE_SHIFT 0
-@@ -1665,6 +1829,9 @@ struct e1000_hw {
- #define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* queue 1 Rx descriptor FIFO parity error */
- #define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* queue 1 Tx descriptor FIFO parity error */
- #define E1000_ICR_ALL_PARITY 0x03F00000 /* all parity error bits */
-+#define E1000_ICR_DSW 0x00000020 /* FW changed the status of DISSW bit in the FWSM */
-+#define E1000_ICR_PHYINT 0x00001000 /* LAN connected device generates an interrupt */
-+#define E1000_ICR_EPRST 0x00100000 /* ME handware reset occurs */
-
- /* Interrupt Cause Set */
- #define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
-@@ -1691,6 +1858,9 @@ struct e1000_hw {
- #define E1000_ICS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */
- #define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */
- #define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */
-+#define E1000_ICS_DSW E1000_ICR_DSW
-+#define E1000_ICS_PHYINT E1000_ICR_PHYINT
-+#define E1000_ICS_EPRST E1000_ICR_EPRST
-
- /* Interrupt Mask Set */
- #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
-@@ -1717,6 +1887,9 @@ struct e1000_hw {
- #define E1000_IMS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */
- #define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */
- #define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */
-+#define E1000_IMS_DSW E1000_ICR_DSW
-+#define E1000_IMS_PHYINT E1000_ICR_PHYINT
-+#define E1000_IMS_EPRST E1000_ICR_EPRST
-
- /* Interrupt Mask Clear */
- #define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */
-@@ -1743,6 +1916,9 @@ struct e1000_hw {
- #define E1000_IMC_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */
- #define E1000_IMC_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */
- #define E1000_IMC_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */
-+#define E1000_IMC_DSW E1000_ICR_DSW
-+#define E1000_IMC_PHYINT E1000_ICR_PHYINT
-+#define E1000_IMC_EPRST E1000_ICR_EPRST
-
- /* Receive Control */
- #define E1000_RCTL_RST 0x00000001 /* Software reset */
-@@ -1801,7 +1977,7 @@ struct e1000_hw {
- * value2 = [0..64512], default=4096
- * value3 = [0..64512], default=0
- */
--
-+
- #define E1000_PSRCTL_BSIZE0_MASK 0x0000007F
- #define E1000_PSRCTL_BSIZE1_MASK 0x00003F00
- #define E1000_PSRCTL_BSIZE2_MASK 0x003F0000
-@@ -1917,9 +2093,10 @@ struct e1000_hw {
- #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000
- #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000
- #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000
--#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00040000
-+#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000
- #define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000
- #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000
-+#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000
-
- /* Definitions for power management and wakeup registers */
- /* Wake Up Control */
-@@ -1987,7 +2164,7 @@ struct e1000_hw {
- #define E1000_MANC_EN_IP_ADDR_FILTER 0x00400000 /* Enable IP address
- * filtering */
- #define E1000_MANC_EN_XSUM_FILTER 0x00800000 /* Enable checksum filtering */
--#define E1000_MANC_BR_EN 0x01000000 /* Enable broadcast filtering */
-+#define E1000_MANC_BR_EN 0x01000000 /* Enable broadcast filtering */
- #define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */
- #define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */
- #define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */
-@@ -2009,6 +2186,15 @@ struct e1000_hw {
- #define E1000_FWSM_MODE_SHIFT 1
- #define E1000_FWSM_FW_VALID 0x00008000 /* FW established a valid mode */
-
-+#define E1000_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI reset */
-+#define E1000_FWSM_DISSW 0x10000000 /* FW disable SW Write Access */
-+#define E1000_FWSM_SKUSEL_MASK 0x60000000 /* LAN SKU select */
-+#define E1000_FWSM_SKUEL_SHIFT 29
-+#define E1000_FWSM_SKUSEL_EMB 0x0 /* Embedded SKU */
-+#define E1000_FWSM_SKUSEL_CONS 0x1 /* Consumer SKU */
-+#define E1000_FWSM_SKUSEL_PERF_100 0x2 /* Perf & Corp 10/100 SKU */
-+#define E1000_FWSM_SKUSEL_PERF_GBE 0x3 /* Perf & Copr GbE SKU */
-+
- /* FFLT Debug Register */
- #define E1000_FFLT_DBG_INVC 0x00100000 /* Invalid /C/ code handling */
-
-@@ -2064,7 +2250,7 @@ struct e1000_host_command_info {
-
- #define E1000_MDALIGN 4096
-
--/* PCI-Ex registers */
-+/* PCI-Ex registers*/
-
- /* PCI-Ex Control Register */
- #define E1000_GCR_RXD_NO_SNOOP 0x00000001
-@@ -2081,6 +2267,8 @@ struct e1000_host_command_info {
- E1000_GCR_TXDSCW_NO_SNOOP | \
- E1000_GCR_TXDSCR_NO_SNOOP)
-
-+#define PCI_EX_82566_SNOOP_ALL PCI_EX_NO_SNOOP_ALL
-+
- #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
- /* Function Active and Power State to MNG */
- #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003
-@@ -2114,7 +2302,7 @@ struct e1000_host_command_info {
- #define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */
-
- /* EEPROM Commands - SPI */
--#define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */
-+#define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */
- #define EEPROM_READ_OPCODE_SPI 0x03 /* EEPROM read opcode */
- #define EEPROM_WRITE_OPCODE_SPI 0x02 /* EEPROM write opcode */
- #define EEPROM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */
-@@ -2139,8 +2327,10 @@ struct e1000_host_command_info {
- #define EEPROM_PHY_CLASS_WORD 0x0007
- #define EEPROM_INIT_CONTROL1_REG 0x000A
- #define EEPROM_INIT_CONTROL2_REG 0x000F
-+#define EEPROM_SWDEF_PINS_CTRL_PORT_1 0x0010
- #define EEPROM_INIT_CONTROL3_PORT_B 0x0014
- #define EEPROM_INIT_3GIO_3 0x001A
-+#define EEPROM_SWDEF_PINS_CTRL_PORT_0 0x0020
- #define EEPROM_INIT_CONTROL3_PORT_A 0x0024
- #define EEPROM_CFG 0x0012
- #define EEPROM_FLASH_VERSION 0x0032
-@@ -2152,10 +2342,16 @@ struct e1000_host_command_info {
- /* Word definitions for ID LED Settings */
- #define ID_LED_RESERVED_0000 0x0000
- #define ID_LED_RESERVED_FFFF 0xFFFF
-+#define ID_LED_RESERVED_82573 0xF746
-+#define ID_LED_DEFAULT_82573 0x1811
- #define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \
- (ID_LED_OFF1_OFF2 << 8) | \
- (ID_LED_DEF1_DEF2 << 4) | \
- (ID_LED_DEF1_DEF2))
-+#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
-+ (ID_LED_DEF1_OFF2 << 8) | \
-+ (ID_LED_DEF1_ON2 << 4) | \
-+ (ID_LED_DEF1_DEF2))
- #define ID_LED_DEF1_DEF2 0x1
- #define ID_LED_DEF1_ON2 0x2
- #define ID_LED_DEF1_OFF2 0x3
-@@ -2190,6 +2386,11 @@ struct e1000_host_command_info {
- #define EEPROM_WORD0F_ASM_DIR 0x2000
- #define EEPROM_WORD0F_ANE 0x0800
- #define EEPROM_WORD0F_SWPDIO_EXT 0x00F0
-+#define EEPROM_WORD0F_LPLU 0x0001
-+
-+/* Mask bits for fields in Word 0x10/0x20 of the EEPROM */
-+#define EEPROM_WORD1020_GIGA_DISABLE 0x0010
-+#define EEPROM_WORD1020_GIGA_DISABLE_NON_D0A 0x0008
-
- /* Mask bits for fields in Word 0x1a of the EEPROM */
- #define EEPROM_WORD1A_ASPM_MASK 0x000C
-@@ -2264,23 +2465,29 @@ struct e1000_host_command_info {
- #define E1000_EXTCNF_CTRL_D_UD_OWNER 0x00000010
- #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020
- #define E1000_EXTCNF_CTRL_MDIO_HW_OWNERSHIP 0x00000040
--#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER 0x1FFF0000
-+#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER 0x0FFF0000
-
- #define E1000_EXTCNF_SIZE_EXT_PHY_LENGTH 0x000000FF
- #define E1000_EXTCNF_SIZE_EXT_DOCK_LENGTH 0x0000FF00
- #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH 0x00FF0000
-+#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001
-+#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020
-
- /* PBA constants */
-+#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */
- #define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */
- #define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */
- #define E1000_PBA_22K 0x0016
- #define E1000_PBA_24K 0x0018
- #define E1000_PBA_30K 0x001E
- #define E1000_PBA_32K 0x0020
-+#define E1000_PBA_34K 0x0022
- #define E1000_PBA_38K 0x0026
- #define E1000_PBA_40K 0x0028
- #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */
-
-+#define E1000_PBS_16K E1000_PBA_16K
-+
- /* Flow Control Constants */
- #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
- #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
-@@ -2335,7 +2542,7 @@ struct e1000_host_command_info {
- /* Number of milliseconds we wait for Eeprom auto read bit done after MAC reset */
- #define AUTO_READ_DONE_TIMEOUT 10
- /* Number of milliseconds we wait for PHY configuration done after MAC reset */
--#define PHY_CFG_TIMEOUT 40
-+#define PHY_CFG_TIMEOUT 100
-
- #define E1000_TX_BUFFER_SIZE ((uint32_t)1514)
-
-@@ -2763,6 +2970,17 @@ struct e1000_host_command_info {
- #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */
- #define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */
-
-+/* M88EC018 Rev 2 specific DownShift settings */
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X 0x0000
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X 0x0200
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X 0x0400
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X 0x0600
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X 0x0A00
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X 0x0C00
-+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X 0x0E00
-+
- /* IGP01E1000 Specific Port Config Register - R/W */
- #define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010
- #define IGP01E1000_PSCFR_PRE_EN 0x0020
-@@ -2942,10 +3160,10 @@ struct e1000_host_command_info {
-
- /* DSP Distance Register (Page 5, Register 26) */
- #define GG82563_DSPD_CABLE_LENGTH 0x0007 /* 0 = <50M;
-- 1 = 50-80M;
-- 2 = 80-110M;
-- 3 = 110-140M;
-- 4 = >140M */
-+ 1 = 50-80M;
-+ 2 = 80-110M;
-+ 3 = 110-140M;
-+ 4 = >140M */
-
- /* Kumeran Mode Control Register (Page 193, Register 16) */
- #define GG82563_KMCR_PHY_LEDS_EN 0x0020 /* 1=PHY LEDs, 0=Kumeran Inband LEDs */
-@@ -2989,6 +3207,221 @@ struct e1000_host_command_info {
- #define L1LXT971A_PHY_ID 0x001378E0
- #define GG82563_E_PHY_ID 0x01410CA0
-
-+
-+/* Bits...
-+ * 15-5: page
-+ * 4-0: register offset
-+ */
-+#define PHY_PAGE_SHIFT 5
-+#define PHY_REG(page, reg) \
-+ (((page) << PHY_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS))
-+
-+#define IGP3_PHY_PORT_CTRL \
-+ PHY_REG(769, 17) /* Port General Configuration */
-+#define IGP3_PHY_RATE_ADAPT_CTRL \
-+ PHY_REG(769, 25) /* Rate Adapter Control Register */
-+
-+#define IGP3_KMRN_FIFO_CTRL_STATS \
-+ PHY_REG(770, 16) /* KMRN FIFO's control/status register */
-+#define IGP3_KMRN_POWER_MNG_CTRL \
-+ PHY_REG(770, 17) /* KMRN Power Management Control Register */
-+#define IGP3_KMRN_INBAND_CTRL \
-+ PHY_REG(770, 18) /* KMRN Inband Control Register */
-+#define IGP3_KMRN_DIAG \
-+ PHY_REG(770, 19) /* KMRN Diagnostic register */
-+#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002 /* RX PCS is not synced */
-+#define IGP3_KMRN_ACK_TIMEOUT \
-+ PHY_REG(770, 20) /* KMRN Acknowledge Timeouts register */
-+
-+#define IGP3_VR_CTRL \
-+ PHY_REG(776, 18) /* Voltage regulator control register */
-+#define IGP3_VR_CTRL_MODE_SHUT 0x0200 /* Enter powerdown, shutdown VRs */
-+
-+#define IGP3_CAPABILITY \
-+ PHY_REG(776, 19) /* IGP3 Capability Register */
-+
-+/* Capabilities for SKU Control */
-+#define IGP3_CAP_INITIATE_TEAM 0x0001 /* Able to initiate a team */
-+#define IGP3_CAP_WFM 0x0002 /* Support WoL and PXE */
-+#define IGP3_CAP_ASF 0x0004 /* Support ASF */
-+#define IGP3_CAP_LPLU 0x0008 /* Support Low Power Link Up */
-+#define IGP3_CAP_DC_AUTO_SPEED 0x0010 /* Support AC/DC Auto Link Speed */
-+#define IGP3_CAP_SPD 0x0020 /* Support Smart Power Down */
-+#define IGP3_CAP_MULT_QUEUE 0x0040 /* Support 2 tx & 2 rx queues */
-+#define IGP3_CAP_RSS 0x0080 /* Support RSS */
-+#define IGP3_CAP_8021PQ 0x0100 /* Support 802.1Q & 802.1p */
-+#define IGP3_CAP_AMT_CB 0x0200 /* Support active manageability and circuit breaker */
-+
-+#define IGP3_PPC_JORDAN_EN 0x0001
-+#define IGP3_PPC_JORDAN_GIGA_SPEED 0x0002
-+
-+#define IGP3_KMRN_PMC_EE_IDLE_LINK_DIS 0x0001
-+#define IGP3_KMRN_PMC_K0S_ENTRY_LATENCY_MASK 0x001E
-+#define IGP3_KMRN_PMC_K0S_MODE1_EN_GIGA 0x0020
-+#define IGP3_KMRN_PMC_K0S_MODE1_EN_100 0x0040
-+
-+#define IGP3E1000_PHY_MISC_CTRL 0x1B /* Misc. Ctrl register */
-+#define IGP3_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Duplex Manual Set */
-+
-+#define IGP3_KMRN_EXT_CTRL PHY_REG(770, 18)
-+#define IGP3_KMRN_EC_DIS_INBAND 0x0080
-+
-+#define IGP03E1000_E_PHY_ID 0x02A80390
-+#define IFE_E_PHY_ID 0x02A80330 /* 10/100 PHY */
-+#define IFE_PLUS_E_PHY_ID 0x02A80320
-+#define IFE_C_E_PHY_ID 0x02A80310
-+
-+#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 /* 100BaseTx Extended Status, Control and Address */
-+#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY special control register */
-+#define IFE_PHY_RCV_FALSE_CARRIER 0x13 /* 100BaseTx Receive False Carrier Counter */
-+#define IFE_PHY_RCV_DISCONNECT 0x14 /* 100BaseTx Receive Disconnet Counter */
-+#define IFE_PHY_RCV_ERROT_FRAME 0x15 /* 100BaseTx Receive Error Frame Counter */
-+#define IFE_PHY_RCV_SYMBOL_ERR 0x16 /* Receive Symbol Error Counter */
-+#define IFE_PHY_PREM_EOF_ERR 0x17 /* 100BaseTx Receive Premature End Of Frame Error Counter */
-+#define IFE_PHY_RCV_EOF_ERR 0x18 /* 10BaseT Receive End Of Frame Error Counter */
-+#define IFE_PHY_TX_JABBER_DETECT 0x19 /* 10BaseT Transmit Jabber Detect Counter */
-+#define IFE_PHY_EQUALIZER 0x1A /* PHY Equalizer Control and Status */
-+#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY special control and LED configuration */
-+#define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control register */
-+#define IFE_PHY_HWI_CONTROL 0x1D /* Hardware Integrity Control (HWI) */
-+
-+#define IFE_PESC_REDUCED_POWER_DOWN_DISABLE 0x2000 /* Defaut 1 = Disable auto reduced power down */
-+#define IFE_PESC_100BTX_POWER_DOWN 0x0400 /* Indicates the power state of 100BASE-TX */
-+#define IFE_PESC_10BTX_POWER_DOWN 0x0200 /* Indicates the power state of 10BASE-T */
-+#define IFE_PESC_POLARITY_REVERSED 0x0100 /* Indicates 10BASE-T polarity */
-+#define IFE_PESC_PHY_ADDR_MASK 0x007C /* Bit 6:2 for sampled PHY address */
-+#define IFE_PESC_SPEED 0x0002 /* Auto-negotiation speed result 1=100Mbs, 0=10Mbs */
-+#define IFE_PESC_DUPLEX 0x0001 /* Auto-negotiation duplex result 1=Full, 0=Half */
-+#define IFE_PESC_POLARITY_REVERSED_SHIFT 8
-+
-+#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100 /* 1 = Dyanmic Power Down disabled */
-+#define IFE_PSC_FORCE_POLARITY 0x0020 /* 1=Reversed Polarity, 0=Normal */
-+#define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010 /* 1=Auto Polarity Disabled, 0=Enabled */
-+#define IFE_PSC_JABBER_FUNC_DISABLE 0x0001 /* 1=Jabber Disabled, 0=Normal Jabber Operation */
-+#define IFE_PSC_FORCE_POLARITY_SHIFT 5
-+#define IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT 4
-+
-+#define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable MDI/MDI-X feature, default 0=disabled */
-+#define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDIX-X, 0=force MDI */
-+#define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */
-+#define IFE_PMC_AUTO_MDIX_COMPLETE 0x0010 /* Resolution algorthm is completed */
-+#define IFE_PMC_MDIX_MODE_SHIFT 6
-+#define IFE_PHC_MDIX_RESET_ALL_MASK 0x0000 /* Disable auto MDI-X */
-+
-+#define IFE_PHC_HWI_ENABLE 0x8000 /* Enable the HWI feature */
-+#define IFE_PHC_ABILITY_CHECK 0x4000 /* 1= Test Passed, 0=failed */
-+#define IFE_PHC_TEST_EXEC 0x2000 /* PHY launch test pulses on the wire */
-+#define IFE_PHC_HIGHZ 0x0200 /* 1 = Open Circuit */
-+#define IFE_PHC_LOWZ 0x0400 /* 1 = Short Circuit */
-+#define IFE_PHC_LOW_HIGH_Z_MASK 0x0600 /* Mask for indication type of problem on the line */
-+#define IFE_PHC_DISTANCE_MASK 0x01FF /* Mask for distance to the cable problem, in 80cm granularity */
-+#define IFE_PHC_RESET_ALL_MASK 0x0000 /* Disable HWI */
-+#define IFE_PSCL_PROBE_MODE 0x0020 /* LED Probe mode */
-+#define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */
-+#define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */
-+
-+#define ICH8_FLASH_COMMAND_TIMEOUT 500 /* 500 ms , should be adjusted */
-+#define ICH8_FLASH_CYCLE_REPEAT_COUNT 10 /* 10 cycles , should be adjusted */
-+#define ICH8_FLASH_SEG_SIZE_256 256
-+#define ICH8_FLASH_SEG_SIZE_4K 4096
-+#define ICH8_FLASH_SEG_SIZE_64K 65536
-+
-+#define ICH8_CYCLE_READ 0x0
-+#define ICH8_CYCLE_RESERVED 0x1
-+#define ICH8_CYCLE_WRITE 0x2
-+#define ICH8_CYCLE_ERASE 0x3
-+
-+#define ICH8_FLASH_GFPREG 0x0000
-+#define ICH8_FLASH_HSFSTS 0x0004
-+#define ICH8_FLASH_HSFCTL 0x0006
-+#define ICH8_FLASH_FADDR 0x0008
-+#define ICH8_FLASH_FDATA0 0x0010
-+#define ICH8_FLASH_FRACC 0x0050
-+#define ICH8_FLASH_FREG0 0x0054
-+#define ICH8_FLASH_FREG1 0x0058
-+#define ICH8_FLASH_FREG2 0x005C
-+#define ICH8_FLASH_FREG3 0x0060
-+#define ICH8_FLASH_FPR0 0x0074
-+#define ICH8_FLASH_FPR1 0x0078
-+#define ICH8_FLASH_SSFSTS 0x0090
-+#define ICH8_FLASH_SSFCTL 0x0092
-+#define ICH8_FLASH_PREOP 0x0094
-+#define ICH8_FLASH_OPTYPE 0x0096
-+#define ICH8_FLASH_OPMENU 0x0098
-+
-+#define ICH8_FLASH_REG_MAPSIZE 0x00A0
-+#define ICH8_FLASH_SECTOR_SIZE 4096
-+#define ICH8_GFPREG_BASE_MASK 0x1FFF
-+#define ICH8_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
-+
-+/* ICH8 GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
-+/* Offset 04h HSFSTS */
-+union ich8_hws_flash_status {
-+ struct ich8_hsfsts {
-+#ifdef E1000_BIG_ENDIAN
-+ uint16_t reserved2 :6;
-+ uint16_t fldesvalid :1;
-+ uint16_t flockdn :1;
-+ uint16_t flcdone :1;
-+ uint16_t flcerr :1;
-+ uint16_t dael :1;
-+ uint16_t berasesz :2;
-+ uint16_t flcinprog :1;
-+ uint16_t reserved1 :2;
-+#else
-+ uint16_t flcdone :1; /* bit 0 Flash Cycle Done */
-+ uint16_t flcerr :1; /* bit 1 Flash Cycle Error */
-+ uint16_t dael :1; /* bit 2 Direct Access error Log */
-+ uint16_t berasesz :2; /* bit 4:3 Block/Sector Erase Size */
-+ uint16_t flcinprog :1; /* bit 5 flash SPI cycle in Progress */
-+ uint16_t reserved1 :2; /* bit 13:6 Reserved */
-+ uint16_t reserved2 :6; /* bit 13:6 Reserved */
-+ uint16_t fldesvalid :1; /* bit 14 Flash Descriptor Valid */
-+ uint16_t flockdn :1; /* bit 15 Flash Configuration Lock-Down */
-+#endif
-+ } hsf_status;
-+ uint16_t regval;
-+};
-+
-+/* ICH8 GbE Flash Hardware Sequencing Flash control Register bit breakdown */
-+/* Offset 06h FLCTL */
-+union ich8_hws_flash_ctrl {
-+ struct ich8_hsflctl {
-+#ifdef E1000_BIG_ENDIAN
-+ uint16_t fldbcount :2;
-+ uint16_t flockdn :6;
-+ uint16_t flcgo :1;
-+ uint16_t flcycle :2;
-+ uint16_t reserved :5;
-+#else
-+ uint16_t flcgo :1; /* 0 Flash Cycle Go */
-+ uint16_t flcycle :2; /* 2:1 Flash Cycle */
-+ uint16_t reserved :5; /* 7:3 Reserved */
-+ uint16_t fldbcount :2; /* 9:8 Flash Data Byte Count */
-+ uint16_t flockdn :6; /* 15:10 Reserved */
-+#endif
-+ } hsf_ctrl;
-+ uint16_t regval;
-+};
-+
-+/* ICH8 Flash Region Access Permissions */
-+union ich8_hws_flash_regacc {
-+ struct ich8_flracc {
-+#ifdef E1000_BIG_ENDIAN
-+ uint32_t gmwag :8;
-+ uint32_t gmrag :8;
-+ uint32_t grwa :8;
-+ uint32_t grra :8;
-+#else
-+ uint32_t grra :8; /* 0:7 GbE region Read Access */
-+ uint32_t grwa :8; /* 8:15 GbE region Write Access */
-+ uint32_t gmrag :8; /* 23:16 GbE Master Read Access Grant */
-+ uint32_t gmwag :8; /* 31:24 GbE Master Write Access Grant */
-+#endif
-+ } hsf_flregacc;
-+ uint16_t regval;
-+};
-+
- /* Miscellaneous PHY bit definitions. */
- #define PHY_PREAMBLE 0xFFFFFFFF
- #define PHY_SOF 0x01
-diff -Nurap ./drivers/net/e1000.e1000/e1000_main.c ./drivers/net/e1000/e1000_main.c
---- ./drivers/net/e1000.e1000/e1000_main.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_main.c 2006-08-31 14:59:51.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -29,10 +30,18 @@
- #include "e1000.h"
-
- /* Change Log
-+ * 7.0.36 10-Mar-2006
-+ * o fixups for compilation issues on older kernels
-+ * 7.0.35 3-Mar-2006
-+ * 7.0.34
-+ * o Major performance fixes by understanding relationship of rx_buffer_len
-+ * to window size growth. _ps and legacy receive paths changed
-+ * o merge with kernel changes
-+ * o legacy receive path went back to single descriptor model for jumbos
- * 7.0.33 3-Feb-2006
- * o Added another fix for the pass false carrier bit
- * 7.0.32 24-Jan-2006
-- * o Need to rebuild with noew version number for the pass false carrier
-+ * o Need to rebuild with noew version number for the pass false carrier
- * fix in e1000_hw.c
- * 7.0.30 18-Jan-2006
- * o fixup for tso workaround to disable it for pci-x
-@@ -46,8 +55,6 @@
- * 7.0.24 12/9/2005
- * o New hardware support for the Gigabit NIC embedded in the south bridge
- * o Fixes to the recycling logic (skb->tail) from IBM LTC
-- * 6.3.9 12/16/2005
-- * o incorporate fix for recycled skbs from IBM LTC
- * 6.3.7 11/18/2005
- * o Honor eeprom setting for enabling/disabling Wake On Lan
- * 6.3.5 11/17/2005
-@@ -55,14 +62,14 @@
- * 6.3.4 11/8/05
- * o Patch from Jesper Juhl to remove redundant NULL checks for kfree
- * 6.3.2 9/20/05
-- * o Render logic that sets/resets DRV_LOAD as inline functions to
-+ * o Render logic that sets/resets DRV_LOAD as inline functions to
- * avoid code replication. If f/w is AMT then set DRV_LOAD only when
- * network interface is open.
- * o Handle DRV_LOAD set/reset in cases where AMT uses VLANs.
- * o Adjust PBA partioning for Jumbo frames using MTU size and not
- * rx_buffer_len
- * 6.3.1 9/19/05
-- * o Use adapter->tx_timeout_factor in Tx Hung Detect logic
-+ * o Use adapter->tx_timeout_factor in Tx Hung Detect logic
- * (e1000_clean_tx_irq)
- * o Support for 8086:10B5 device (Quad Port)
- */
-@@ -74,9 +81,9 @@ static char e1000_driver_string[] = "Int
- #else
- #define DRIVERNAPI "-NAPI"
- #endif
--#define DRV_VERSION "7.0.33-k2"DRIVERNAPI
-+#define DRV_VERSION "7.2.7"DRIVERNAPI
- char e1000_driver_version[] = DRV_VERSION;
--static char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
-+static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
-
- /* e1000_pci_tbl - PCI Device ID Table
- *
-@@ -86,7 +93,6 @@ static char e1000_copyright[] = "Copyrig
- * {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
- */
- static struct pci_device_id e1000_pci_tbl[] = {
-- INTEL_E1000_ETHERNET_DEVICE(0x1000),
- INTEL_E1000_ETHERNET_DEVICE(0x1001),
- INTEL_E1000_ETHERNET_DEVICE(0x1004),
- INTEL_E1000_ETHERNET_DEVICE(0x1008),
-@@ -111,6 +117,11 @@ static struct pci_device_id e1000_pci_tb
- INTEL_E1000_ETHERNET_DEVICE(0x1026),
- INTEL_E1000_ETHERNET_DEVICE(0x1027),
- INTEL_E1000_ETHERNET_DEVICE(0x1028),
-+ INTEL_E1000_ETHERNET_DEVICE(0x1049),
-+ INTEL_E1000_ETHERNET_DEVICE(0x104A),
-+ INTEL_E1000_ETHERNET_DEVICE(0x104B),
-+ INTEL_E1000_ETHERNET_DEVICE(0x104C),
-+ INTEL_E1000_ETHERNET_DEVICE(0x104D),
- INTEL_E1000_ETHERNET_DEVICE(0x105E),
- INTEL_E1000_ETHERNET_DEVICE(0x105F),
- INTEL_E1000_ETHERNET_DEVICE(0x1060),
-@@ -132,24 +143,35 @@ static struct pci_device_id e1000_pci_tb
- INTEL_E1000_ETHERNET_DEVICE(0x1098),
- INTEL_E1000_ETHERNET_DEVICE(0x1099),
- INTEL_E1000_ETHERNET_DEVICE(0x109A),
-+ INTEL_E1000_ETHERNET_DEVICE(0x10A4),
- INTEL_E1000_ETHERNET_DEVICE(0x10B5),
- INTEL_E1000_ETHERNET_DEVICE(0x10B9),
-+ INTEL_E1000_ETHERNET_DEVICE(0x10BA),
-+ INTEL_E1000_ETHERNET_DEVICE(0x10BB),
- /* required last entry */
- {0,}
- };
-
- MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
-
-+int e1000_up(struct e1000_adapter *adapter);
-+void e1000_down(struct e1000_adapter *adapter);
-+void e1000_reinit_locked(struct e1000_adapter *adapter);
-+void e1000_reset(struct e1000_adapter *adapter);
-+int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx);
-+int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
-+int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
-+void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
-+void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
- static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
-- struct e1000_tx_ring *txdr);
-+ struct e1000_tx_ring *txdr);
- static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
-- struct e1000_rx_ring *rxdr);
-+ struct e1000_rx_ring *rxdr);
- static void e1000_free_tx_resources(struct e1000_adapter *adapter,
-- struct e1000_tx_ring *tx_ring);
-+ struct e1000_tx_ring *tx_ring);
- static void e1000_free_rx_resources(struct e1000_adapter *adapter,
-- struct e1000_rx_ring *rx_ring);
--
--/* Local Function Prototypes */
-+ struct e1000_rx_ring *rx_ring);
-+void e1000_update_stats(struct e1000_adapter *adapter);
-
- static int e1000_init_module(void);
- static void e1000_exit_module(void);
-@@ -171,7 +193,6 @@ static void e1000_clean_rx_ring(struct e
- static void e1000_set_multi(struct net_device *netdev);
- static void e1000_update_phy_info(unsigned long data);
- static void e1000_watchdog(unsigned long data);
--static void e1000_watchdog_task(struct e1000_adapter *adapter);
- static void e1000_82547_tx_fifo_stall(unsigned long data);
- static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
- static struct net_device_stats * e1000_get_stats(struct net_device *netdev);
-@@ -201,23 +222,31 @@ static void e1000_alloc_rx_buffers_ps(st
- struct e1000_rx_ring *rx_ring,
- int cleaned_count);
- static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
-+#ifdef SIOCGMIIPHY
- static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
- int cmd);
-+#endif
-+void e1000_set_ethtool_ops(struct net_device *netdev);
-+#ifdef ETHTOOL_OPS_COMPAT
-+extern int ethtool_ioctl(struct ifreq *ifr);
-+#endif
- static void e1000_enter_82542_rst(struct e1000_adapter *adapter);
- static void e1000_leave_82542_rst(struct e1000_adapter *adapter);
- static void e1000_tx_timeout(struct net_device *dev);
- static void e1000_reset_task(struct net_device *dev);
- static void e1000_smartspeed(struct e1000_adapter *adapter);
--static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
-- struct sk_buff *skb);
-+static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
-+ struct sk_buff *skb);
-
-+#ifdef NETIF_F_HW_VLAN_TX
- static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
- static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
- static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
- static void e1000_restore_vlan(struct e1000_adapter *adapter);
-+#endif
-
--#ifdef CONFIG_PM
- static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
-+#ifdef CONFIG_PM
- static int e1000_resume(struct pci_dev *pdev);
- #endif
-
-@@ -226,6 +255,20 @@ static int e1000_resume(struct pci_dev *
- static void e1000_netpoll (struct net_device *netdev);
- #endif
-
-+#ifdef USE_DRIVER_SHUTDOWN_HANDLER
-+static void e1000_shutdown(struct pci_dev *pdev);
-+#else
-+static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
-+static struct notifier_block e1000_notifier_reboot = {
-+ .notifier_call = e1000_notify_reboot,
-+ .next = NULL,
-+ .priority = 0
-+};
-+#endif
-+
-+/* Exported from other modules */
-+
-+extern void e1000_check_options(struct e1000_adapter *adapter);
-
- static struct pci_driver e1000_driver = {
- .name = e1000_driver_name,
-@@ -235,7 +278,10 @@ static struct pci_driver e1000_driver =
- /* Power Managment Hooks */
- #ifdef CONFIG_PM
- .suspend = e1000_suspend,
-- .resume = e1000_resume
-+ .resume = e1000_resume,
-+#endif
-+#ifdef USE_DRIVER_SHUTDOWN_HANDLER
-+ .shutdown = e1000_shutdown
- #endif
- };
-
-@@ -265,7 +311,11 @@ e1000_init_module(void)
- printk(KERN_INFO "%s\n", e1000_copyright);
-
- ret = pci_module_init(&e1000_driver);
--
-+#ifndef USE_DRIVER_SHUTDOWN_HANDLER
-+ if (ret >= 0) {
-+ register_reboot_notifier(&e1000_notifier_reboot);
-+ }
-+#endif
- return ret;
- }
-
-@@ -281,17 +331,58 @@ module_init(e1000_init_module);
- static void __exit
- e1000_exit_module(void)
- {
-+#ifndef USE_DRIVER_SHUTDOWN_HANDLER
-+ unregister_reboot_notifier(&e1000_notifier_reboot);
-+#endif
- pci_unregister_driver(&e1000_driver);
- }
-
- module_exit(e1000_exit_module);
-
-+static int e1000_request_irq(struct e1000_adapter *adapter)
-+{
-+ struct net_device *netdev = adapter->netdev;
-+ int flags, err = 0;
-+
-+ flags = SA_SHIRQ | SA_SAMPLE_RANDOM;
-+#ifdef CONFIG_PCI_MSI
-+ if (adapter->hw.mac_type > e1000_82547_rev_2) {
-+ adapter->have_msi = TRUE;
-+ if ((err = pci_enable_msi(adapter->pdev))) {
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate MSI interrupt Error: %d\n", err);
-+ adapter->have_msi = FALSE;
-+ }
-+ }
-+ if (adapter->have_msi)
-+ flags &= ~SA_SHIRQ;
-+#endif
-+ if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags,
-+ netdev->name, netdev)))
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate interrupt Error: %d\n", err);
-+
-+ return err;
-+}
-+
-+static void e1000_free_irq(struct e1000_adapter *adapter)
-+{
-+ struct net_device *netdev = adapter->netdev;
-+
-+ free_irq(adapter->pdev->irq, netdev);
-+
-+#ifdef CONFIG_PCI_MSI
-+ if (adapter->have_msi)
-+ pci_disable_msi(adapter->pdev);
-+#endif
-+}
-+
- /**
- * e1000_irq_disable - Mask off interrupt generation on the NIC
- * @adapter: board private structure
- **/
-
--static inline void
-+static void
- e1000_irq_disable(struct e1000_adapter *adapter)
- {
- atomic_inc(&adapter->irq_sem);
-@@ -305,7 +396,7 @@ e1000_irq_disable(struct e1000_adapter *
- * @adapter: board private structure
- **/
-
--static inline void
-+static void
- e1000_irq_enable(struct e1000_adapter *adapter)
- {
- if (likely(atomic_dec_and_test(&adapter->irq_sem))) {
-@@ -313,6 +404,7 @@ e1000_irq_enable(struct e1000_adapter *a
- E1000_WRITE_FLUSH(&adapter->hw);
- }
- }
-+#ifdef NETIF_F_HW_VLAN_TX
-
- static void
- e1000_update_mng_vlan(struct e1000_adapter *adapter)
-@@ -337,6 +429,7 @@ e1000_update_mng_vlan(struct e1000_adapt
- adapter->mng_vlan_id = vid;
- }
- }
-+#endif
-
- /**
- * e1000_release_hw_control - release control of the h/w to f/w
-@@ -346,19 +439,21 @@ e1000_update_mng_vlan(struct e1000_adapt
- * For ASF and Pass Through versions of f/w this means that the
- * driver is no longer loaded. For AMT version (only with 82573) i
- * of the f/w this means that the netowrk i/f is closed.
-- *
-+ *
- **/
-
--static inline void
-+static void
- e1000_release_hw_control(struct e1000_adapter *adapter)
- {
- uint32_t ctrl_ext;
- uint32_t swsm;
-+ uint32_t extcnf;
-
- /* Let firmware taken over control of h/w */
- switch (adapter->hw.mac_type) {
- case e1000_82571:
- case e1000_82572:
-+ case e1000_80003es2lan:
- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
- ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
-@@ -367,6 +462,11 @@ e1000_release_hw_control(struct e1000_ad
- swsm = E1000_READ_REG(&adapter->hw, SWSM);
- E1000_WRITE_REG(&adapter->hw, SWSM,
- swsm & ~E1000_SWSM_DRV_LOAD);
-+ case e1000_ich8lan:
-+ extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT);
-+ E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
-+ extcnf & ~E1000_CTRL_EXT_DRV_LOAD);
-+ break;
- default:
- break;
- }
-@@ -377,21 +477,23 @@ e1000_release_hw_control(struct e1000_ad
- * @adapter: address of board private structure
- *
- * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit.
-- * For ASF and Pass Through versions of f/w this means that
-- * the driver is loaded. For AMT version (only with 82573)
-+ * For ASF and Pass Through versions of f/w this means that
-+ * the driver is loaded. For AMT version (only with 82573)
- * of the f/w this means that the netowrk i/f is open.
-- *
-+ *
- **/
-
--static inline void
-+static void
- e1000_get_hw_control(struct e1000_adapter *adapter)
- {
- uint32_t ctrl_ext;
- uint32_t swsm;
-+ uint32_t extcnf;
- /* Let firmware know the driver has taken over */
- switch (adapter->hw.mac_type) {
- case e1000_82571:
- case e1000_82572:
-+ case e1000_80003es2lan:
- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
- ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
-@@ -401,6 +503,11 @@ e1000_get_hw_control(struct e1000_adapte
- E1000_WRITE_REG(&adapter->hw, SWSM,
- swsm | E1000_SWSM_DRV_LOAD);
- break;
-+ case e1000_ich8lan:
-+ extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL);
-+ E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL,
-+ extcnf | E1000_EXTCNF_CTRL_SWFLAG);
-+ break;
- default:
- break;
- }
-@@ -410,21 +517,15 @@ int
- e1000_up(struct e1000_adapter *adapter)
- {
- struct net_device *netdev = adapter->netdev;
-- int i, err;
-+ int i;
-
- /* hardware has been reset, we need to reload some things */
-
-- /* Reset the PHY if it was previously powered down */
-- if (adapter->hw.media_type == e1000_media_type_copper) {
-- uint16_t mii_reg;
-- e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-- if (mii_reg & MII_CR_POWER_DOWN)
-- e1000_phy_reset(&adapter->hw);
-- }
--
- e1000_set_multi(netdev);
-
-+#ifdef NETIF_F_HW_VLAN_TX
- e1000_restore_vlan(adapter);
-+#endif
-
- e1000_configure_tx(adapter);
- e1000_setup_rctl(adapter);
-@@ -438,24 +539,6 @@ e1000_up(struct e1000_adapter *adapter)
- E1000_DESC_UNUSED(ring));
- }
-
--#ifdef CONFIG_PCI_MSI
-- if (adapter->hw.mac_type > e1000_82547_rev_2) {
-- adapter->have_msi = TRUE;
-- if ((err = pci_enable_msi(adapter->pdev))) {
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate MSI interrupt Error: %d\n", err);
-- adapter->have_msi = FALSE;
-- }
-- }
--#endif
-- if ((err = request_irq(adapter->pdev->irq, &e1000_intr,
-- SA_SHIRQ | SA_SAMPLE_RANDOM,
-- netdev->name, netdev))) {
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate interrupt Error: %d\n", err);
-- return err;
-- }
--
- adapter->tx_queue_len = netdev->tx_queue_len;
-
- mod_timer(&adapter->watchdog_timer, jiffies);
-@@ -468,21 +551,60 @@ e1000_up(struct e1000_adapter *adapter)
- return 0;
- }
-
-+/**
-+ * e1000_power_up_phy - restore link in case the phy was powered down
-+ * @adapter: address of board private structure
-+ *
-+ * The phy may be powered down to save power and turn off link when the
-+ * driver is unloaded and wake on lan is not enabled (among others)
-+ * *** this routine MUST be followed by a call to e1000_reset ***
-+ *
-+ **/
-+
-+void e1000_power_up_phy(struct e1000_adapter *adapter)
-+{
-+ uint16_t mii_reg = 0;
-+
-+ /* Just clear the power down bit to wake the phy back up */
-+ if (adapter->hw.media_type == e1000_media_type_copper) {
-+ /* according to the manual, the phy will retain its
-+ * settings across a power-down/up cycle */
-+ e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-+ mii_reg &= ~MII_CR_POWER_DOWN;
-+ e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
-+ }
-+}
-+
-+static void e1000_power_down_phy(struct e1000_adapter *adapter)
-+{
-+ boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) &&
-+ e1000_check_mng_mode(&adapter->hw);
-+ /* Power down the PHY so no link is implied when interface is down *
-+ * The PHY cannot be powered down if any of the following is TRUE *
-+ * (a) WoL is enabled
-+ * (b) AMT is active
-+ * (c) SoL/IDER session is active */
-+ if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 &&
-+ adapter->hw.mac_type != e1000_ich8lan &&
-+ adapter->hw.media_type == e1000_media_type_copper &&
-+ !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) &&
-+ !mng_mode_enabled &&
-+ !e1000_check_phy_reset_block(&adapter->hw)) {
-+ uint16_t mii_reg = 0;
-+ e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-+ mii_reg |= MII_CR_POWER_DOWN;
-+ e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
-+ mdelay(1);
-+ }
-+}
-+
- void
- e1000_down(struct e1000_adapter *adapter)
- {
- struct net_device *netdev = adapter->netdev;
-- boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) &&
-- e1000_check_mng_mode(&adapter->hw);
-
- e1000_irq_disable(adapter);
-
-- free_irq(adapter->pdev->irq, netdev);
--#ifdef CONFIG_PCI_MSI
-- if (adapter->hw.mac_type > e1000_82547_rev_2 &&
-- adapter->have_msi == TRUE)
-- pci_disable_msi(adapter->pdev);
--#endif
- del_timer_sync(&adapter->tx_fifo_stall_timer);
- del_timer_sync(&adapter->watchdog_timer);
- del_timer_sync(&adapter->phy_info_timer);
-@@ -499,23 +621,17 @@ e1000_down(struct e1000_adapter *adapter
- e1000_reset(adapter);
- e1000_clean_all_tx_rings(adapter);
- e1000_clean_all_rx_rings(adapter);
-+}
-
-- /* Power down the PHY so no link is implied when interface is down *
-- * The PHY cannot be powered down if any of the following is TRUE *
-- * (a) WoL is enabled
-- * (b) AMT is active
-- * (c) SoL/IDER session is active */
-- if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 &&
-- adapter->hw.media_type == e1000_media_type_copper &&
-- !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) &&
-- !mng_mode_enabled &&
-- !e1000_check_phy_reset_block(&adapter->hw)) {
-- uint16_t mii_reg;
-- e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-- mii_reg |= MII_CR_POWER_DOWN;
-- e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
-- mdelay(1);
-- }
-+void
-+e1000_reinit_locked(struct e1000_adapter *adapter)
-+{
-+ WARN_ON(in_interrupt());
-+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
-+ msleep(1);
-+ e1000_down(adapter);
-+ e1000_up(adapter);
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
- }
-
- void
-@@ -541,6 +657,9 @@ e1000_reset(struct e1000_adapter *adapte
- case e1000_82573:
- pba = E1000_PBA_12K;
- break;
-+ case e1000_ich8lan:
-+ pba = E1000_PBA_8K;
-+ break;
- default:
- pba = E1000_PBA_48K;
- break;
-@@ -565,6 +684,12 @@ e1000_reset(struct e1000_adapter *adapte
- /* Set the FC high water mark to 90% of the FIFO size.
- * Required to clear last 3 LSB */
- fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8;
-+ /* We can't use 90% on small FIFOs because the remainder
-+ * would be less than 1 full frame. In this case, we size
-+ * it to allow at least a full frame above the high water
-+ * mark. */
-+ if (pba < E1000_PBA_16K)
-+ fc_high_water_mark = (pba * 1024) - 1600;
-
- adapter->hw.fc_high_water = fc_high_water_mark;
- adapter->hw.fc_low_water = fc_high_water_mark - 8;
-@@ -581,12 +706,31 @@ e1000_reset(struct e1000_adapter *adapte
- E1000_WRITE_REG(&adapter->hw, WUC, 0);
- if (e1000_init_hw(&adapter->hw))
- DPRINTK(PROBE, ERR, "Hardware Error\n");
-+#ifdef NETIF_F_HW_VLAN_TX
- e1000_update_mng_vlan(adapter);
-+#endif
- /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
- E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
-
- e1000_reset_adaptive(&adapter->hw);
- e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
-+
-+ if (!adapter->smart_power_down &&
-+ (adapter->hw.mac_type == e1000_82571 ||
-+ adapter->hw.mac_type == e1000_82572)) {
-+ uint16_t phy_data = 0;
-+ /* speed up time to link by disabling smart power down, ignore
-+ * the return value of this function because there is nothing
-+ * different we would do if it failed */
-+ e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
-+ &phy_data);
-+ phy_data &= ~IGP02E1000_PM_SPD;
-+ e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
-+ phy_data);
-+ }
-+
-+ if (adapter->hw.mac_type < e1000_ich8lan)
-+ /* FIXME: this code is duplicate and wrong for PCI Express */
- if (adapter->en_mng_pt) {
- manc = E1000_READ_REG(&adapter->hw, MANC);
- manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
-@@ -613,19 +757,22 @@ e1000_probe(struct pci_dev *pdev,
- struct net_device *netdev;
- struct e1000_adapter *adapter;
- unsigned long mmio_start, mmio_len;
-+ unsigned long flash_start, flash_len;
-
- static int cards_found = 0;
-- static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */
-+ static int global_quad_port_a = 0; /* global ksp3 port a indication */
- int i, err, pci_using_dac;
-- uint16_t eeprom_data;
-+ uint16_t eeprom_data = 0;
- uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
- if ((err = pci_enable_device(pdev)))
- return err;
-
-- if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
-+ if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) &&
-+ !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) {
- pci_using_dac = 1;
- } else {
-- if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
-+ if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) &&
-+ (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
- E1000_ERR("No usable DMA configuration, aborting\n");
- return err;
- }
-@@ -680,15 +827,19 @@ e1000_probe(struct pci_dev *pdev,
- netdev->change_mtu = &e1000_change_mtu;
- netdev->do_ioctl = &e1000_ioctl;
- e1000_set_ethtool_ops(netdev);
-+#ifdef HAVE_TX_TIMEOUT
- netdev->tx_timeout = &e1000_tx_timeout;
- netdev->watchdog_timeo = 5 * HZ;
-+#endif
- #ifdef CONFIG_E1000_NAPI
- netdev->poll = &e1000_clean;
- netdev->weight = 64;
- #endif
-+#ifdef NETIF_F_HW_VLAN_TX
- netdev->vlan_rx_register = e1000_vlan_rx_register;
- netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid;
- netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
-+#endif
- #ifdef CONFIG_NET_POLL_CONTROLLER
- netdev->poll_controller = e1000_netpoll;
- #endif
-@@ -705,24 +856,35 @@ e1000_probe(struct pci_dev *pdev,
- if ((err = e1000_sw_init(adapter)))
- goto err_sw_init;
-
-+ /* Flash BAR mapping must happen after e1000_sw_init
-+ * because it depends on mac_type */
-+ if ((adapter->hw.mac_type == e1000_ich8lan) &&
-+ (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
-+ flash_start = pci_resource_start(pdev, 1);
-+ flash_len = pci_resource_len(pdev, 1);
-+ adapter->hw.flash_address = ioremap(flash_start, flash_len);
-+ if (!adapter->hw.flash_address) {
-+ err = -EIO;
-+ goto err_flashmap;
-+ }
-+ }
-+
- if ((err = e1000_check_phy_reset_block(&adapter->hw)))
- DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
-
-- /* if ksp3, indicate if it's port a being setup */
-- if (pdev->device == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 &&
-- e1000_ksp3_port_a == 0)
-- adapter->ksp3_port_a = 1;
-- e1000_ksp3_port_a++;
-- /* Reset for multiple KP3 adapters */
-- if (e1000_ksp3_port_a == 4)
-- e1000_ksp3_port_a = 0;
--
-+#ifdef MAX_SKB_FRAGS
- if (adapter->hw.mac_type >= e1000_82543) {
-+#ifdef NETIF_F_HW_VLAN_TX
- netdev->features = NETIF_F_SG |
- NETIF_F_HW_CSUM |
- NETIF_F_HW_VLAN_TX |
- NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_FILTER;
-+ if (adapter->hw.mac_type == e1000_ich8lan)
-+ netdev->features &= ~NETIF_F_HW_VLAN_FILTER;
-+#else
-+ netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM;
-+#endif
- }
-
- #ifdef NETIF_F_TSO
-@@ -738,11 +900,20 @@ e1000_probe(struct pci_dev *pdev,
- if (pci_using_dac)
- netdev->features |= NETIF_F_HIGHDMA;
-
-- /* hard_start_xmit is safe against parallel locking */
-- netdev->features |= NETIF_F_LLTX;
--
-+#endif
-+#ifdef NETIF_F_LLTX
-+ netdev->features |= NETIF_F_LLTX;
-+#endif
-+
- adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw);
-
-+ /* initialize eeprom parameters */
-+
-+ if (e1000_init_eeprom_params(&adapter->hw)) {
-+ E1000_ERR("EEPROM initialization failed\n");
-+ return -EIO;
-+ }
-+
- /* before reading the EEPROM, reset the controller to
- * put the device in a known good starting state */
-
-@@ -761,18 +932,18 @@ e1000_probe(struct pci_dev *pdev,
- if (e1000_read_mac_addr(&adapter->hw))
- DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
- memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
--#if 0 /* Not in RHEL4... */
-+#ifdef ETHTOOL_GPERMADDR
- memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
--#endif
-
-+ if (!is_valid_ether_addr(netdev->perm_addr)) {
-+#else
- if (!is_valid_ether_addr(netdev->dev_addr)) {
-+#endif
- DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
- err = -EIO;
- goto err_eeprom;
- }
-
-- e1000_read_part_num(&adapter->hw, &(adapter->part_num));
--
- e1000_get_bus_info(&adapter->hw);
-
- init_timer(&adapter->tx_fifo_stall_timer);
-@@ -783,9 +954,6 @@ e1000_probe(struct pci_dev *pdev,
- adapter->watchdog_timer.function = &e1000_watchdog;
- adapter->watchdog_timer.data = (unsigned long) adapter;
-
-- INIT_WORK(&adapter->watchdog_task,
-- (void (*)(void *))e1000_watchdog_task, adapter);
--
- init_timer(&adapter->phy_info_timer);
- adapter->phy_info_timer.function = &e1000_update_phy_info;
- adapter->phy_info_timer.data = (unsigned long) adapter;
-@@ -815,6 +983,11 @@ e1000_probe(struct pci_dev *pdev,
- EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
- eeprom_apme_mask = E1000_EEPROM_82544_APM;
- break;
-+ case e1000_ich8lan:
-+ e1000_read_eeprom(&adapter->hw,
-+ EEPROM_INIT_CONTROL1_REG, 1, &eeprom_data);
-+ eeprom_apme_mask = E1000_EEPROM_ICH8_APME;
-+ break;
- case e1000_82546:
- case e1000_82546_rev_3:
- case e1000_82571:
-@@ -831,7 +1004,38 @@ e1000_probe(struct pci_dev *pdev,
- break;
- }
- if (eeprom_data & eeprom_apme_mask)
-- adapter->wol |= E1000_WUFC_MAG;
-+ adapter->eeprom_wol |= E1000_WUFC_MAG;
-+
-+ /* now that we have the eeprom settings, apply the special cases
-+ * where the eeprom may be wrong or the board simply won't support
-+ * wake on lan on a particular port */
-+ switch (pdev->device) {
-+ case E1000_DEV_ID_82546GB_PCIE:
-+ adapter->eeprom_wol = 0;
-+ break;
-+ case E1000_DEV_ID_82546EB_FIBER:
-+ case E1000_DEV_ID_82546GB_FIBER:
-+ case E1000_DEV_ID_82571EB_FIBER:
-+ /* Wake events only supported on port A for dual fiber
-+ * regardless of eeprom setting */
-+ if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
-+ adapter->eeprom_wol = 0;
-+ break;
-+ case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
-+ case E1000_DEV_ID_82571EB_QUAD_COPPER:
-+ /* if quad port adapter, disable WoL on all but port A */
-+ if (global_quad_port_a != 0)
-+ adapter->eeprom_wol = 0;
-+ else
-+ adapter->quad_port_a = 1;
-+ /* Reset for multiple quad port adapters */
-+ if (++global_quad_port_a == 4)
-+ global_quad_port_a = 0;
-+ break;
-+ }
-+
-+ /* initialize the wol settings based on the eeprom settings */
-+ adapter->wol = adapter->eeprom_wol;
-
- /* print bus type/speed/width info */
- {
-@@ -874,6 +1078,9 @@ e1000_probe(struct pci_dev *pdev,
- return 0;
-
- err_register:
-+ if (adapter->hw.flash_address)
-+ iounmap(adapter->hw.flash_address);
-+err_flashmap:
- err_sw_init:
- err_eeprom:
- iounmap(adapter->hw.hw_addr);
-@@ -907,6 +1114,7 @@ e1000_remove(struct pci_dev *pdev)
- flush_scheduled_work();
-
- if (adapter->hw.mac_type >= e1000_82540 &&
-+ adapter->hw.mac_type != e1000_ich8lan &&
- adapter->hw.media_type == e1000_media_type_copper) {
- manc = E1000_READ_REG(&adapter->hw, MANC);
- if (manc & E1000_MANC_SMBUS_EN) {
-@@ -922,7 +1130,7 @@ e1000_remove(struct pci_dev *pdev)
- unregister_netdev(netdev);
- #ifdef CONFIG_E1000_NAPI
- for (i = 0; i < adapter->num_rx_queues; i++)
-- __dev_put(&adapter->polling_netdev[i]);
-+ dev_put(&adapter->polling_netdev[i]);
- #endif
-
- if (!e1000_check_phy_reset_block(&adapter->hw))
-@@ -935,6 +1143,8 @@ e1000_remove(struct pci_dev *pdev)
- #endif
-
- iounmap(adapter->hw.hw_addr);
-+ if (adapter->hw.flash_address)
-+ iounmap(adapter->hw.flash_address);
- pci_release_regions(pdev);
-
- free_netdev(netdev);
-@@ -972,8 +1182,8 @@ e1000_sw_init(struct e1000_adapter *adap
-
- pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
-
-- adapter->rx_buffer_len = E1000_RXBUFFER_2048;
-- adapter->rx_ps_bsize0 = E1000_RXBUFFER_256;
-+ adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
-+ adapter->rx_ps_bsize0 = E1000_RXBUFFER_128;
- hw->max_frame_size = netdev->mtu +
- ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
- hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
-@@ -985,13 +1195,6 @@ e1000_sw_init(struct e1000_adapter *adap
- return -EIO;
- }
-
-- /* initialize eeprom parameters */
--
-- if (e1000_init_eeprom_params(hw)) {
-- E1000_ERR("EEPROM initialization failed\n");
-- return -EIO;
-- }
--
- switch (hw->mac_type) {
- default:
- break;
-@@ -1103,6 +1306,10 @@ e1000_open(struct net_device *netdev)
- struct e1000_adapter *adapter = netdev_priv(netdev);
- int err;
-
-+ /* disallow open during test */
-+ if (test_bit(__E1000_DRIVER_TESTING, &adapter->flags))
-+ return -EBUSY;
-+
- /* allocate transmit descriptors */
-
- if ((err = e1000_setup_all_tx_resources(adapter)))
-@@ -1113,13 +1320,21 @@ e1000_open(struct net_device *netdev)
- if ((err = e1000_setup_all_rx_resources(adapter)))
- goto err_setup_rx;
-
-+ err = e1000_request_irq(adapter);
-+ if (err)
-+ goto err_up;
-+
-+ e1000_power_up_phy(adapter);
-+
- if ((err = e1000_up(adapter)))
- goto err_up;
-+#ifdef NETIF_F_HW_VLAN_TX
- adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
- if ((adapter->hw.mng_cookie.status &
- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
- e1000_update_mng_vlan(adapter);
- }
-+#endif
-
- /* If AMT is enabled, let the firmware know that the network
- * interface is now open */
-@@ -1156,15 +1371,20 @@ e1000_close(struct net_device *netdev)
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
-
-+ WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
- e1000_down(adapter);
-+ e1000_power_down_phy(adapter);
-+ e1000_free_irq(adapter);
-
- e1000_free_all_tx_resources(adapter);
- e1000_free_all_rx_resources(adapter);
-
-+#ifdef NETIF_F_HW_VLAN_TX
- if ((adapter->hw.mng_cookie.status &
- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
- e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
- }
-+#endif
-
- /* If AMT is enabled, let the firmware know that the network
- * interface is now closed */
-@@ -1181,7 +1401,7 @@ e1000_close(struct net_device *netdev)
- * @start: address of beginning of memory
- * @len: length of memory
- **/
--static inline boolean_t
-+static boolean_t
- e1000_check_64k_bound(struct e1000_adapter *adapter,
- void *start, unsigned long len)
- {
-@@ -1214,7 +1434,6 @@ e1000_setup_tx_resources(struct e1000_ad
- int size;
-
- size = sizeof(struct e1000_buffer) * txdr->count;
--
- txdr->buffer_info = vmalloc(size);
- if (!txdr->buffer_info) {
- DPRINTK(PROBE, ERR,
-@@ -1327,11 +1546,11 @@ e1000_configure_tx(struct e1000_adapter
- tdba = adapter->tx_ring[0].dma;
- tdlen = adapter->tx_ring[0].count *
- sizeof(struct e1000_tx_desc);
-- E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
-- E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
- E1000_WRITE_REG(hw, TDLEN, tdlen);
-- E1000_WRITE_REG(hw, TDH, 0);
-+ E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
-+ E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
- E1000_WRITE_REG(hw, TDT, 0);
-+ E1000_WRITE_REG(hw, TDH, 0);
- adapter->tx_ring[0].tdh = E1000_TDH;
- adapter->tx_ring[0].tdt = E1000_TDT;
- break;
-@@ -1583,8 +1802,11 @@ e1000_setup_rctl(struct e1000_adapter *a
- E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
- (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
-
-+ /* disable the stripping of CRC because it breaks
-+ * BMC firmware connected over SMBUS
- if (adapter->hw.mac_type > e1000_82543)
- rctl |= E1000_RCTL_SECRC;
-+ */
-
- if (adapter->hw.tbi_compatibility_on == 1)
- rctl |= E1000_RCTL_SBP;
-@@ -1597,14 +1819,21 @@ e1000_setup_rctl(struct e1000_adapter *a
- rctl |= E1000_RCTL_LPE;
-
- /* Setup buffer sizes */
-- if (adapter->hw.mac_type >= e1000_82571) {
-- /* We can now specify buffers in 1K increments.
-- * BSIZE and BSEX are ignored in this case. */
-- rctl |= adapter->rx_buffer_len << 0x11;
-- } else {
-- rctl &= ~E1000_RCTL_SZ_4096;
-- rctl |= E1000_RCTL_BSEX;
-- switch (adapter->rx_buffer_len) {
-+ rctl &= ~E1000_RCTL_SZ_4096;
-+ rctl |= E1000_RCTL_BSEX;
-+ switch (adapter->rx_buffer_len) {
-+ case E1000_RXBUFFER_256:
-+ rctl |= E1000_RCTL_SZ_256;
-+ rctl &= ~E1000_RCTL_BSEX;
-+ break;
-+ case E1000_RXBUFFER_512:
-+ rctl |= E1000_RCTL_SZ_512;
-+ rctl &= ~E1000_RCTL_BSEX;
-+ break;
-+ case E1000_RXBUFFER_1024:
-+ rctl |= E1000_RCTL_SZ_1024;
-+ rctl &= ~E1000_RCTL_BSEX;
-+ break;
- case E1000_RXBUFFER_2048:
- default:
- rctl |= E1000_RCTL_SZ_2048;
-@@ -1619,7 +1848,6 @@ e1000_setup_rctl(struct e1000_adapter *a
- case E1000_RXBUFFER_16384:
- rctl |= E1000_RCTL_SZ_16384;
- break;
-- }
- }
-
- #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
-@@ -1645,7 +1873,9 @@ e1000_setup_rctl(struct e1000_adapter *a
- rfctl |= E1000_RFCTL_IPV6_DIS;
- E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
-
-- rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
-+ /* disable the stripping of CRC because it breaks
-+ * BMC firmware connected over SMBUS */
-+ rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */;
-
- psrctl |= adapter->rx_ps_bsize0 >>
- E1000_PSRCTL_BSIZE0_SHIFT;
-@@ -1713,7 +1943,7 @@ e1000_configure_rx(struct e1000_adapter
- if (hw->mac_type >= e1000_82571) {
- ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
- /* Reset delay timers after every interrupt */
-- ctrl_ext |= E1000_CTRL_EXT_CANC;
-+ ctrl_ext |= E1000_CTRL_EXT_INT_TIMER_CLR;
- #ifdef CONFIG_E1000_NAPI
- /* Auto-Mask interrupts upon ICR read. */
- ctrl_ext |= E1000_CTRL_EXT_IAME;
-@@ -1729,11 +1959,11 @@ e1000_configure_rx(struct e1000_adapter
- case 1:
- default:
- rdba = adapter->rx_ring[0].dma;
-- E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
-- E1000_WRITE_REG(hw, RDBAH, (rdba >> 32));
- E1000_WRITE_REG(hw, RDLEN, rdlen);
-- E1000_WRITE_REG(hw, RDH, 0);
-+ E1000_WRITE_REG(hw, RDBAH, (rdba >> 32));
-+ E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
- E1000_WRITE_REG(hw, RDT, 0);
-+ E1000_WRITE_REG(hw, RDH, 0);
- adapter->rx_ring[0].rdh = E1000_RDH;
- adapter->rx_ring[0].rdt = E1000_RDT;
- break;
-@@ -1758,8 +1988,6 @@ e1000_configure_rx(struct e1000_adapter
- E1000_WRITE_REG(hw, RXCSUM, rxcsum);
- }
-
-- if (hw->mac_type == e1000_82573)
-- E1000_WRITE_REG(hw, ERT, 0x0100);
-
- /* Enable Receives */
- E1000_WRITE_REG(hw, RCTL, rctl);
-@@ -1805,7 +2033,7 @@ e1000_free_all_tx_resources(struct e1000
- e1000_free_tx_resources(adapter, &adapter->tx_ring[i]);
- }
-
--static inline void
-+static void
- e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter,
- struct e1000_buffer *buffer_info)
- {
-@@ -2100,6 +2328,12 @@ e1000_set_multi(struct net_device *netde
- uint32_t rctl;
- uint32_t hash_value;
- int i, rar_entries = E1000_RAR_ENTRIES;
-+ int mta_reg_count = (hw->mac_type == e1000_ich8lan) ?
-+ E1000_NUM_MTA_REGISTERS_ICH8LAN :
-+ E1000_NUM_MTA_REGISTERS;
-+
-+ if (adapter->hw.mac_type == e1000_ich8lan)
-+ rar_entries = E1000_RAR_ENTRIES_ICH8LAN;
-
- /* reserve RAR[14] for LAA over-write work-around */
- if (adapter->hw.mac_type == e1000_82571)
-@@ -2138,14 +2372,18 @@ e1000_set_multi(struct net_device *netde
- mc_ptr = mc_ptr->next;
- } else {
- E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0);
-+ E1000_WRITE_FLUSH(hw);
- E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0);
-+ E1000_WRITE_FLUSH(hw);
- }
- }
-
- /* clear the old settings from the multicast hash table */
-
-- for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++)
-+ for (i = 0; i < mta_reg_count; i++) {
- E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
-+ E1000_WRITE_FLUSH(hw);
-+ }
-
- /* load any remaining addresses into the hash table */
-
-@@ -2218,23 +2456,25 @@ static void
- e1000_watchdog(unsigned long data)
- {
- struct e1000_adapter *adapter = (struct e1000_adapter *) data;
--
-- /* Do the rest outside of interrupt context */
-- schedule_work(&adapter->watchdog_task);
--}
--
--static void
--e1000_watchdog_task(struct e1000_adapter *adapter)
--{
- struct net_device *netdev = adapter->netdev;
- struct e1000_tx_ring *txdr = adapter->tx_ring;
- uint32_t link, tctl;
-+ int32_t ret_val;
-
-- e1000_check_for_link(&adapter->hw);
-+ ret_val = e1000_check_for_link(&adapter->hw);
-+ if ((ret_val == E1000_ERR_PHY) &&
-+ (adapter->hw.phy_type == e1000_phy_igp_3) &&
-+ (E1000_READ_REG(&adapter->hw, CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) {
-+ /* See e1000_kumeran_lock_loss_workaround() */
-+ DPRINTK(LINK, INFO,
-+ "Gigabit has been disabled, downgrading speed\n");
-+ }
- if (adapter->hw.mac_type == e1000_82573) {
- e1000_enable_tx_pkt_filtering(&adapter->hw);
-+#ifdef NETIF_F_HW_VLAN_TX
- if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
- e1000_update_mng_vlan(adapter);
-+#endif
- }
-
- if ((adapter->hw.media_type == e1000_media_type_internal_serdes) &&
-@@ -2245,6 +2485,7 @@ e1000_watchdog_task(struct e1000_adapter
-
- if (link) {
- if (!netif_carrier_ok(netdev)) {
-+ boolean_t txb2b = 1;
- e1000_get_speed_and_duplex(&adapter->hw,
- &adapter->link_speed,
- &adapter->link_duplex);
-@@ -2258,30 +2499,29 @@ e1000_watchdog_task(struct e1000_adapter
- * and adjust the timeout factor */
- netdev->tx_queue_len = adapter->tx_queue_len;
- adapter->tx_timeout_factor = 1;
-- adapter->txb2b = 1;
- switch (adapter->link_speed) {
- case SPEED_10:
-- adapter->txb2b = 0;
-+ txb2b = 0;
- netdev->tx_queue_len = 10;
- adapter->tx_timeout_factor = 8;
- break;
- case SPEED_100:
-- adapter->txb2b = 0;
-+ txb2b = 0;
- netdev->tx_queue_len = 100;
- /* maybe add some timeout factor ? */
- break;
- }
-
-- if ((adapter->hw.mac_type == e1000_82571 ||
-+ if ((adapter->hw.mac_type == e1000_82571 ||
- adapter->hw.mac_type == e1000_82572) &&
-- adapter->txb2b == 0) {
-+ txb2b == 0) {
- #define SPEED_MODE_BIT (1 << 21)
- uint32_t tarc0;
- tarc0 = E1000_READ_REG(&adapter->hw, TARC0);
- tarc0 &= ~SPEED_MODE_BIT;
- E1000_WRITE_REG(&adapter->hw, TARC0, tarc0);
- }
--
-+
- #ifdef NETIF_F_TSO
- /* disable TSO for pcie and 10/100 speeds, to avoid
- * some hardware issues */
-@@ -2329,10 +2569,9 @@ e1000_watchdog_task(struct e1000_adapter
- * disable receives in the ISR and
- * reset device here in the watchdog
- */
-- if (adapter->hw.mac_type == e1000_80003es2lan) {
-+ if (adapter->hw.mac_type == e1000_80003es2lan)
- /* reset device */
- schedule_work(&adapter->reset_task);
-- }
- }
-
- e1000_smartspeed(adapter);
-@@ -2398,7 +2637,7 @@ e1000_watchdog_task(struct e1000_adapter
- #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000
- #define E1000_TX_FLAGS_VLAN_SHIFT 16
-
--static inline int
-+static int
- e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
- struct sk_buff *skb)
- {
-@@ -2420,7 +2659,7 @@ e1000_tso(struct e1000_adapter *adapter,
-
- hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
- mss = skb_shinfo(skb)->tso_size;
-- if (skb->protocol == ntohs(ETH_P_IP)) {
-+ if (skb->protocol == htons(ETH_P_IP)) {
- skb->nh.iph->tot_len = 0;
- skb->nh.iph->check = 0;
- skb->h.th->check =
-@@ -2478,7 +2717,7 @@ e1000_tso(struct e1000_adapter *adapter,
- return FALSE;
- }
-
--static inline boolean_t
-+static boolean_t
- e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
- struct sk_buff *skb)
- {
-@@ -2514,7 +2753,7 @@ e1000_tx_csum(struct e1000_adapter *adap
- #define E1000_MAX_TXD_PWR 12
- #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR)
-
--static inline int
-+static int
- e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
- struct sk_buff *skb, unsigned int first, unsigned int max_per_txd,
- unsigned int nr_frags, unsigned int mss)
-@@ -2522,8 +2761,10 @@ e1000_tx_map(struct e1000_adapter *adapt
- struct e1000_buffer *buffer_info;
- unsigned int len = skb->len;
- unsigned int offset = 0, size, count = 0, i;
-+#ifdef MAX_SKB_FRAGS
- unsigned int f;
- len -= skb->data_len;
-+#endif
-
- i = tx_ring->next_to_use;
-
-@@ -2576,6 +2817,7 @@ e1000_tx_map(struct e1000_adapter *adapt
- if (unlikely(++i == tx_ring->count)) i = 0;
- }
-
-+#ifdef MAX_SKB_FRAGS
- for (f = 0; f < nr_frags; f++) {
- struct skb_frag_struct *frag;
-
-@@ -2615,6 +2857,7 @@ e1000_tx_map(struct e1000_adapter *adapt
- if (unlikely(++i == tx_ring->count)) i = 0;
- }
- }
-+#endif
-
- i = (i == 0) ? tx_ring->count - 1 : i - 1;
- tx_ring->buffer_info[i].skb = skb;
-@@ -2623,7 +2866,7 @@ e1000_tx_map(struct e1000_adapter *adapt
- return count;
- }
-
--static inline void
-+static void
- e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
- int tx_flags, int count)
- {
-@@ -2687,7 +2930,7 @@ e1000_tx_queue(struct e1000_adapter *ada
- #define E1000_FIFO_HDR 0x10
- #define E1000_82547_PAD_LEN 0x3E0
-
--static inline int
-+static int
- e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb)
- {
- uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
-@@ -2714,17 +2957,19 @@ no_fifo_stall_required:
- }
-
- #define MINIMUM_DHCP_PACKET_SIZE 282
--static inline int
-+static int
- e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb)
- {
- struct e1000_hw *hw = &adapter->hw;
- uint16_t length, offset;
-+#ifdef NETIF_F_HW_VLAN_TX
- if (vlan_tx_tag_present(skb)) {
- if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) &&
- ( adapter->hw.mng_cookie.status &
- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) )
- return 0;
- }
-+#endif
- if (skb->len > MINIMUM_DHCP_PACKET_SIZE) {
- struct ethhdr *eth = (struct ethhdr *) skb->data;
- if ((htons(ETH_P_IP) == eth->h_proto)) {
-@@ -2762,10 +3007,16 @@ e1000_xmit_frame(struct sk_buff *skb, st
- unsigned int nr_frags = 0;
- unsigned int mss = 0;
- int count = 0;
-- int tso;
-+ int tso;
-+#ifdef MAX_SKB_FRAGS
- unsigned int f;
- len -= skb->data_len;
-+#endif
-
-+ /* This goes back to the question of how to logically map a tx queue
-+ * to a flow. Right now, performance is impacted slightly negatively
-+ * if using multiple tx queues. If the stack breaks away from a
-+ * single qdisc implementation, we can look at this again. */
- tx_ring = adapter->tx_ring;
-
- if (unlikely(skb->len <= 0)) {
-@@ -2775,7 +3026,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
-
- #ifdef NETIF_F_TSO
- mss = skb_shinfo(skb)->tso_size;
-- /* The controller does a simple calculation to
-+ /* The controller does a simple calculation to
- * make sure there is enough room in the FIFO before
- * initiating the DMA for each buffer. The calc is:
- * 4 = ceil(buffer len/mss). To make sure we don't
-@@ -2796,9 +3047,10 @@ e1000_xmit_frame(struct sk_buff *skb, st
- case e1000_82571:
- case e1000_82572:
- case e1000_82573:
-+ case e1000_ich8lan:
- pull_size = min((unsigned int)4, skb->data_len);
- if (!__pskb_pull_tail(skb, pull_size)) {
-- printk(KERN_ERR
-+ DPRINTK(DRV, ERR,
- "__pskb_pull_tail failed.\n");
- dev_kfree_skb_any(skb);
- return NETDEV_TX_OK;
-@@ -2840,6 +3092,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
- (len > 2015)))
- count++;
-
-+#ifdef MAX_SKB_FRAGS
- nr_frags = skb_shinfo(skb)->nr_frags;
- for (f = 0; f < nr_frags; f++)
- count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size,
-@@ -2847,17 +3100,22 @@ e1000_xmit_frame(struct sk_buff *skb, st
- if (adapter->pcix_82544)
- count += nr_frags;
-
-+#endif
-
- if (adapter->hw.tx_pkt_filtering &&
- (adapter->hw.mac_type == e1000_82573))
- e1000_transfer_dhcp_info(adapter, skb);
-
-+#ifdef NETIF_F_LLTX
- local_irq_save(flags);
- if (!spin_trylock(&tx_ring->tx_lock)) {
- /* Collision - tell upper layer to requeue */
- local_irq_restore(flags);
- return NETDEV_TX_LOCKED;
- }
-+#else
-+ spin_lock_irqsave(&tx_ring->tx_lock, flags);
-+#endif
-
- /* need: count + 2 desc gap to keep tail from touching
- * head, otherwise try next time */
-@@ -2876,17 +3134,25 @@ e1000_xmit_frame(struct sk_buff *skb, st
- }
- }
-
-+#ifndef NETIF_F_LLTX
-+ spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
-+
-+#endif
-+#ifdef NETIF_F_HW_VLAN_TX
- if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
- tx_flags |= E1000_TX_FLAGS_VLAN;
- tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
- }
-+#endif
-
- first = tx_ring->next_to_use;
-
- tso = e1000_tso(adapter, tx_ring, skb);
- if (tso < 0) {
- dev_kfree_skb_any(skb);
-+#ifdef NETIF_F_LLTX
- spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
-+#endif
- return NETDEV_TX_OK;
- }
-
-@@ -2899,7 +3165,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
- /* Old method was to assume IPv4 packet by default if TSO was enabled.
- * 82571 hardware supports TSO capabilities for IPv6 as well...
- * no longer assume, we must. */
-- if (likely(skb->protocol == ntohs(ETH_P_IP)))
-+ if (likely(skb->protocol == htons(ETH_P_IP)))
- tx_flags |= E1000_TX_FLAGS_IPV4;
-
- e1000_tx_queue(adapter, tx_ring, tx_flags,
-@@ -2908,11 +3174,13 @@ e1000_xmit_frame(struct sk_buff *skb, st
-
- netdev->trans_start = jiffies;
-
-+#ifdef NETIF_F_LLTX
- /* Make sure there is space in the ring for the next send. */
- if (unlikely(E1000_DESC_UNUSED(tx_ring) < MAX_SKB_FRAGS + 2))
- netif_stop_queue(netdev);
-
- spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
-+#endif
- return NETDEV_TX_OK;
- }
-
-@@ -2936,8 +3204,7 @@ e1000_reset_task(struct net_device *netd
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
-
-- e1000_down(adapter);
-- e1000_up(adapter);
-+ e1000_reinit_locked(adapter);
- }
-
- /**
-@@ -2980,8 +3247,8 @@ e1000_change_mtu(struct net_device *netd
-
- /* Adapter-specific max frame size limits. */
- switch (adapter->hw.mac_type) {
-- case e1000_82542_rev2_0:
-- case e1000_82542_rev2_1:
-+ case e1000_undefined ... e1000_82542_rev2_1:
-+ case e1000_ich8lan:
- if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
- DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n");
- return -EINVAL;
-@@ -3015,34 +3282,36 @@ e1000_change_mtu(struct net_device *netd
- break;
- }
-
--
-- if (adapter->hw.mac_type > e1000_82547_rev_2) {
-- adapter->rx_buffer_len = max_frame;
-- E1000_ROUNDUP(adapter->rx_buffer_len, 1024);
-- } else {
-- if(unlikely((adapter->hw.mac_type < e1000_82543) &&
-- (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE))) {
-- DPRINTK(PROBE, ERR, "Jumbo Frames not supported "
-- "on 82542\n");
-- return -EINVAL;
-- } else {
-- if(max_frame <= E1000_RXBUFFER_2048)
-- adapter->rx_buffer_len = E1000_RXBUFFER_2048;
-- else if(max_frame <= E1000_RXBUFFER_4096)
-- adapter->rx_buffer_len = E1000_RXBUFFER_4096;
-- else if(max_frame <= E1000_RXBUFFER_8192)
-- adapter->rx_buffer_len = E1000_RXBUFFER_8192;
-- else if(max_frame <= E1000_RXBUFFER_16384)
-- adapter->rx_buffer_len = E1000_RXBUFFER_16384;
-- }
-- }
-+ /* NOTE: dev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
-+ * means we reserve 2 more, this pushes us to allocate from the next
-+ * larger slab size
-+ * i.e. RXBUFFER_2048 --> size-4096 slab */
-+
-+ if (max_frame <= E1000_RXBUFFER_256)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_256;
-+ else if (max_frame <= E1000_RXBUFFER_512)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_512;
-+ else if (max_frame <= E1000_RXBUFFER_1024)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_1024;
-+ else if (max_frame <= E1000_RXBUFFER_2048)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_2048;
-+ else if (max_frame <= E1000_RXBUFFER_4096)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_4096;
-+ else if (max_frame <= E1000_RXBUFFER_8192)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_8192;
-+ else if (max_frame <= E1000_RXBUFFER_16384)
-+ adapter->rx_buffer_len = E1000_RXBUFFER_16384;
-+
-+ /* adjust allocation if LPE protects us, and we aren't using SBP */
-+ if (!adapter->hw.tbi_compatibility_on &&
-+ ((max_frame == MAXIMUM_ETHERNET_FRAME_SIZE) ||
-+ (max_frame == MAXIMUM_ETHERNET_VLAN_SIZE)))
-+ adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
-
- netdev->mtu = new_mtu;
-
-- if (netif_running(netdev)) {
-- e1000_down(adapter);
-- e1000_up(adapter);
-- }
-+ if (netif_running(netdev))
-+ e1000_reinit_locked(adapter);
-
- adapter->hw.max_frame_size = max_frame;
-
-@@ -3077,12 +3346,15 @@ e1000_update_stats(struct e1000_adapter
- adapter->stats.bprc += E1000_READ_REG(hw, BPRC);
- adapter->stats.mprc += E1000_READ_REG(hw, MPRC);
- adapter->stats.roc += E1000_READ_REG(hw, ROC);
-+
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
- adapter->stats.prc64 += E1000_READ_REG(hw, PRC64);
- adapter->stats.prc127 += E1000_READ_REG(hw, PRC127);
- adapter->stats.prc255 += E1000_READ_REG(hw, PRC255);
- adapter->stats.prc511 += E1000_READ_REG(hw, PRC511);
- adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023);
- adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522);
-+ }
-
- adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS);
- adapter->stats.mpc += E1000_READ_REG(hw, MPC);
-@@ -3110,12 +3382,16 @@ e1000_update_stats(struct e1000_adapter
- adapter->stats.totl += E1000_READ_REG(hw, TOTL);
- adapter->stats.toth += E1000_READ_REG(hw, TOTH);
- adapter->stats.tpr += E1000_READ_REG(hw, TPR);
-+
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
- adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64);
- adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127);
- adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255);
- adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511);
- adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023);
- adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522);
-+ }
-+
- adapter->stats.mptc += E1000_READ_REG(hw, MPTC);
- adapter->stats.bptc += E1000_READ_REG(hw, BPTC);
-
-@@ -3137,6 +3413,8 @@ e1000_update_stats(struct e1000_adapter
- if (hw->mac_type > e1000_82547_rev_2) {
- adapter->stats.iac += E1000_READ_REG(hw, IAC);
- adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
-+
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
- adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
- adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC);
- adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC);
-@@ -3144,6 +3422,7 @@ e1000_update_stats(struct e1000_adapter
- adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC);
- adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC);
- adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC);
-+ }
- }
-
- /* Fill out the OS statistics structure */
-@@ -3163,7 +3442,6 @@ e1000_update_stats(struct e1000_adapter
- adapter->stats.crcerrs + adapter->stats.algnerrc +
- adapter->stats.ruc + adapter->stats.roc +
- adapter->stats.cexterr;
-- adapter->net_stats.rx_dropped = 0;
- adapter->net_stats.rx_length_errors = adapter->stats.ruc +
- adapter->stats.roc;
- adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
-@@ -3205,9 +3483,8 @@ e1000_update_stats(struct e1000_adapter
- * @pt_regs: CPU registers structure
- **/
-
--
- static irqreturn_t
--__e1000_intr(int irq, void *data, struct pt_regs *regs, int netpoll_op)
-+e1000_intr(int irq, void *data, struct pt_regs *regs)
- {
- struct net_device *netdev = data;
- struct e1000_adapter *adapter = netdev_priv(netdev);
-@@ -3216,7 +3493,6 @@ __e1000_intr(int irq, void *data, struct
- #ifndef CONFIG_E1000_NAPI
- int i;
- #else
-- struct net_device *dev_to_sched;
- /* Interrupt Auto-Mask...upon reading ICR,
- * interrupts are masked. No need for the
- * IMC write, but it does mean we should
-@@ -3255,22 +3531,8 @@ __e1000_intr(int irq, void *data, struct
- E1000_WRITE_REG(hw, IMC, ~0);
- E1000_WRITE_FLUSH(hw);
- }
--
-- /*
-- * netpoll operations, in the interests of efficiency
-- * only do napi polling on the device passed to the
-- * poll_controller. Therefore, if we are preforming
-- * a netpoll operation, then we can't schedule a receive
-- * to one of the dummy net devices that exist for sole
-- * purpose of spreading out rx schedules
-- */
-- if (unlikely(netpoll_op))
-- dev_to_sched = netdev;
-- else
-- dev_to_sched = &adapter->polling_netdev[0];
--
-- if (likely(netif_rx_schedule_prep(dev_to_sched)))
-- __netif_rx_schedule(dev_to_sched);
-+ if (likely(netif_rx_schedule_prep(netdev)))
-+ __netif_rx_schedule(netdev);
- else
- e1000_irq_enable(adapter);
- #else
-@@ -3298,17 +3560,31 @@ __e1000_intr(int irq, void *data, struct
- e1000_irq_enable(adapter);
-
- #endif
-+#ifdef E1000_COUNT_ICR
-+ adapter->icr_txdw += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_txqe += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_lsc += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_rxseq += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_rxdmt += icr & 0x01;
-+ icr >>= 2;
-+ adapter->icr_rxo += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_rxt += icr & 0x01;
-+ icr >>= 2;
-+ adapter->icr_mdac += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_rxcfg += icr & 0x01;
-+ icr >>= 1;
-+ adapter->icr_gpi += icr & 0x01;
-+#endif
-
- return IRQ_HANDLED;
- }
-
--static irqreturn_t
--e1000_intr(int irq, void *data, struct pt_regs *regs)
--{
-- return __e1000_intr(irq, data, regs, 0);
--}
--
--
- #ifdef CONFIG_E1000_NAPI
- /**
- * e1000_clean - NAPI Rx polling callback
-@@ -3320,49 +3596,26 @@ e1000_clean(struct net_device *poll_dev,
- {
- struct e1000_adapter *adapter;
- int work_to_do = min(*budget, poll_dev->quota);
-- int tx_cleaned = 0, i = 0, work_done = 0;
-+ int tx_cleaned = 0, work_done = 0;
-
- /* Must NOT use netdev_priv macro here. */
- adapter = poll_dev->priv;
-
- /* Keep link state information with original netdev */
-- if (!netif_carrier_ok(adapter->netdev))
-+ if (!netif_carrier_ok(poll_dev))
- goto quit_polling;
-
-- /*
-- * only search for a matching polling_netdev in the event
-- * that this isn't a real registered net_device
-- * A real net device can be passed in here in the event
-- * that netdump has been activated (this comes through
-- * netpoll_poll_dev). We detect this by virtue of the
-- * fact that each polling_netdev->priv points to the private
-- * data of its parent (registered) netdev. So if:
-- * poll_dev->priv == netdev_priv(poll_dev), its a real device
-- * otherwise its a polling_netdev.
-- */
-- if (likely(adapter != netdev_priv(poll_dev))) {
-- while (poll_dev != &adapter->polling_netdev[i]) {
-- i++;
-- if (unlikely(i == adapter->num_rx_queues))
-- BUG();
-- }
--
-+ /* e1000_clean is called per-cpu. This lock protects
-+ * tx_ring[0] from being cleaned by multiple cpus
-+ * simultaneously. A failure obtaining the lock means
-+ * tx_ring[0] is currently being cleaned anyway. */
-+ if (spin_trylock(&adapter->tx_queue_lock)) {
-+ tx_cleaned = e1000_clean_tx_irq(adapter,
-+ &adapter->tx_ring[0]);
-+ spin_unlock(&adapter->tx_queue_lock);
- }
-
-- if (likely(adapter->num_tx_queues == 1)) {
-- /* e1000_clean is called per-cpu. This lock protects
-- * tx_ring[0] from being cleaned by multiple cpus
-- * simultaneously. A failure obtaining the lock means
-- * tx_ring[0] is currently being cleaned anyway. */
-- if (spin_trylock(&adapter->tx_queue_lock)) {
-- tx_cleaned = e1000_clean_tx_irq(adapter,
-- &adapter->tx_ring[0]);
-- spin_unlock(&adapter->tx_queue_lock);
-- }
-- } else
-- tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]);
--
-- adapter->clean_rx(adapter, &adapter->rx_ring[i],
-+ adapter->clean_rx(adapter, &adapter->rx_ring[0],
- &work_done, work_to_do);
-
- *budget -= work_done;
-@@ -3370,7 +3623,7 @@ e1000_clean(struct net_device *poll_dev,
-
- /* If no Tx and not enough Rx work done, exit the polling mode */
- if ((!tx_cleaned && (work_done == 0)) ||
-- !netif_running(adapter->netdev)) {
-+ !netif_running(poll_dev)) {
- quit_polling:
- netif_rx_complete(poll_dev);
- e1000_irq_enable(adapter);
-@@ -3427,13 +3680,15 @@ e1000_clean_tx_irq(struct e1000_adapter
-
- tx_ring->next_to_clean = i;
-
-- spin_lock(&tx_ring->tx_lock);
--
-+#define TX_WAKE_THRESHOLD 32
- if (unlikely(cleaned && netif_queue_stopped(netdev) &&
-- netif_carrier_ok(netdev)))
-- netif_wake_queue(netdev);
--
-- spin_unlock(&tx_ring->tx_lock);
-+ netif_carrier_ok(netdev))) {
-+ spin_lock(&tx_ring->tx_lock);
-+ if (netif_queue_stopped(netdev) &&
-+ (E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))
-+ netif_wake_queue(netdev);
-+ spin_unlock(&tx_ring->tx_lock);
-+ }
-
- if (adapter->detect_tx_hung) {
- /* Detect a transmit hang in hardware, this serializes the
-@@ -3481,7 +3736,7 @@ e1000_clean_tx_irq(struct e1000_adapter
- * @sk_buff: socket buffer with received data
- **/
-
--static inline void
-+static void
- e1000_rx_checksum(struct e1000_adapter *adapter,
- uint32_t status_err, uint32_t csum,
- struct sk_buff *skb)
-@@ -3557,6 +3812,7 @@ e1000_clean_rx_irq(struct e1000_adapter
- while (rx_desc->status & E1000_RXD_STAT_DD) {
- struct sk_buff *skb, *next_skb;
- u8 status;
-+
- #ifdef CONFIG_E1000_NAPI
- if (*work_done >= work_to_do)
- break;
-@@ -3585,11 +3841,15 @@ e1000_clean_rx_irq(struct e1000_adapter
-
- length = le16_to_cpu(rx_desc->length);
-
-+ /* adjust length to remove Ethernet CRC */
-+ length -= 4;
-+
- if (unlikely(!(status & E1000_RXD_STAT_EOP))) {
- /* All receives must fit into a single buffer */
- E1000_DBG("%s: Receive packet consumed multiple"
- " buffers\n", netdev->name);
-- dev_kfree_skb_irq(skb);
-+ /* recycle */
-+ buffer_info->skb = skb;
- goto next_desc;
- }
-
-@@ -3605,7 +3865,8 @@ e1000_clean_rx_irq(struct e1000_adapter
- flags);
- length--;
- } else {
-- dev_kfree_skb_irq(skb);
-+ /* recycle */
-+ buffer_info->skb = skb;
- goto next_desc;
- }
- }
-@@ -3641,6 +3902,7 @@ e1000_clean_rx_irq(struct e1000_adapter
-
- skb->protocol = eth_type_trans(skb, netdev);
- #ifdef CONFIG_E1000_NAPI
-+#ifdef NETIF_F_HW_VLAN_TX
- if (unlikely(adapter->vlgrp &&
- (status & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
-@@ -3649,7 +3911,11 @@ e1000_clean_rx_irq(struct e1000_adapter
- } else {
- netif_receive_skb(skb);
- }
-+#else
-+ netif_receive_skb(skb);
-+#endif
- #else /* CONFIG_E1000_NAPI */
-+#ifdef NETIF_F_HW_VLAN_TX
- if (unlikely(adapter->vlgrp &&
- (status & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_rx(skb, adapter->vlgrp,
-@@ -3658,6 +3924,9 @@ e1000_clean_rx_irq(struct e1000_adapter
- } else {
- netif_rx(skb);
- }
-+#else
-+ netif_rx(skb);
-+#endif
- #endif /* CONFIG_E1000_NAPI */
- netdev->last_rx = jiffies;
-
-@@ -3713,9 +3982,9 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
- i = rx_ring->next_to_clean;
- rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
- staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
-+ buffer_info = &rx_ring->buffer_info[i];
-
- while (staterr & E1000_RXD_STAT_DD) {
-- buffer_info = &rx_ring->buffer_info[i];
- ps_page = &rx_ring->ps_page[i];
- ps_page_dma = &rx_ring->ps_page_dma[i];
- #ifdef CONFIG_E1000_NAPI
-@@ -3773,9 +4042,9 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
-
- /* page alloc/put takes too long and effects small packet
- * throughput, so unsplit small packets and save the alloc/put*/
-- if (l1 && ((length + l1) < E1000_CB_LENGTH)) {
-+ if (l1 && ((length + l1) <= adapter->rx_ps_bsize0)) {
- u8 *vaddr;
-- /* there is no documentation about how to call
-+ /* there is no documentation about how to call
- * kmap_atomic, so we can't hold the mapping
- * very long */
- pci_dma_sync_single_for_cpu(pdev,
-@@ -3789,12 +4058,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
- pci_dma_sync_single_for_device(pdev,
- ps_page_dma->ps_page_dma[0],
- PAGE_SIZE, PCI_DMA_FROMDEVICE);
-+ /* remove the CRC */
-+ l1 -= 4;
- skb_put(skb, l1);
-- length += l1;
- goto copydone;
- } /* if */
- }
--
-+
- for (j = 0; j < adapter->rx_ps_pages; j++) {
- if (!(length= le16_to_cpu(rx_desc->wb.upper.length[j])))
- break;
-@@ -3806,8 +4076,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
- ps_page->ps_page[j] = NULL;
- skb->len += length;
- skb->data_len += length;
-+ skb->truesize += length;
- }
-
-+ /* strip the ethernet crc, problem is we're using pages now so
-+ * this whole operation can get a little cpu intensive */
-+ pskb_trim(skb, skb->len - 4);
-+
- copydone:
- e1000_rx_checksum(adapter, staterr,
- le16_to_cpu(rx_desc->wb.lower.hi_dword.csum_ip.csum), skb);
-@@ -3817,6 +4092,7 @@ copydone:
- cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
- adapter->rx_hdr_split++;
- #ifdef CONFIG_E1000_NAPI
-+#ifdef NETIF_F_HW_VLAN_TX
- if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
- le16_to_cpu(rx_desc->wb.middle.vlan) &
-@@ -3824,7 +4100,11 @@ copydone:
- } else {
- netif_receive_skb(skb);
- }
-+#else
-+ netif_receive_skb(skb);
-+#endif
- #else /* CONFIG_E1000_NAPI */
-+#ifdef NETIF_F_HW_VLAN_TX
- if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_rx(skb, adapter->vlgrp,
- le16_to_cpu(rx_desc->wb.middle.vlan) &
-@@ -3832,6 +4112,9 @@ copydone:
- } else {
- netif_rx(skb);
- }
-+#else
-+ netif_rx(skb);
-+#endif
- #endif /* CONFIG_E1000_NAPI */
- netdev->last_rx = jiffies;
-
-@@ -4138,15 +4421,22 @@ static int
- e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
- {
- switch (cmd) {
-+#ifdef SIOCGMIIPHY
- case SIOCGMIIPHY:
- case SIOCGMIIREG:
- case SIOCSMIIREG:
- return e1000_mii_ioctl(netdev, ifr, cmd);
-+#endif
-+#ifdef ETHTOOL_OPS_COMPAT
-+ case SIOCETHTOOL:
-+ return ethtool_ioctl(ifr);
-+#endif
- default:
- return -EOPNOTSUPP;
- }
- }
-
-+#ifdef SIOCGMIIPHY
- /**
- * e1000_mii_ioctl -
- * @netdev:
-@@ -4159,9 +4449,6 @@ e1000_mii_ioctl(struct net_device *netde
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
- struct mii_ioctl_data *data = if_mii(ifr);
-- int retval;
-- uint16_t mii_reg;
-- uint16_t spddplx;
- unsigned long flags;
-
- if (adapter->hw.media_type != e1000_media_type_copper)
-@@ -4183,88 +4470,27 @@ e1000_mii_ioctl(struct net_device *netde
- spin_unlock_irqrestore(&adapter->stats_lock, flags);
- break;
- case SIOCSMIIREG:
-- if (!capable(CAP_NET_ADMIN))
-- return -EPERM;
-- if (data->reg_num & ~(0x1F))
-- return -EFAULT;
-- mii_reg = data->val_in;
-- spin_lock_irqsave(&adapter->stats_lock, flags);
-- if (e1000_write_phy_reg(&adapter->hw, data->reg_num,
-- mii_reg)) {
-- spin_unlock_irqrestore(&adapter->stats_lock, flags);
-- return -EIO;
-- }
-- if (adapter->hw.phy_type == e1000_media_type_copper) {
-- switch (data->reg_num) {
-- case PHY_CTRL:
-- if (mii_reg & MII_CR_POWER_DOWN)
-- break;
-- if (mii_reg & MII_CR_AUTO_NEG_EN) {
-- adapter->hw.autoneg = 1;
-- adapter->hw.autoneg_advertised = 0x2F;
-- } else {
-- if (mii_reg & 0x40)
-- spddplx = SPEED_1000;
-- else if (mii_reg & 0x2000)
-- spddplx = SPEED_100;
-- else
-- spddplx = SPEED_10;
-- spddplx += (mii_reg & 0x100)
-- ? DUPLEX_FULL :
-- DUPLEX_HALF;
-- retval = e1000_set_spd_dplx(adapter,
-- spddplx);
-- if (retval) {
-- spin_unlock_irqrestore(
-- &adapter->stats_lock,
-- flags);
-- return retval;
-- }
-- }
-- if (netif_running(adapter->netdev)) {
-- e1000_down(adapter);
-- e1000_up(adapter);
-- } else
-- e1000_reset(adapter);
-- break;
-- case M88E1000_PHY_SPEC_CTRL:
-- case M88E1000_EXT_PHY_SPEC_CTRL:
-- if (e1000_phy_reset(&adapter->hw)) {
-- spin_unlock_irqrestore(
-- &adapter->stats_lock, flags);
-- return -EIO;
-- }
-- break;
-- }
-- } else {
-- switch (data->reg_num) {
-- case PHY_CTRL:
-- if (mii_reg & MII_CR_POWER_DOWN)
-- break;
-- if (netif_running(adapter->netdev)) {
-- e1000_down(adapter);
-- e1000_up(adapter);
-- } else
-- e1000_reset(adapter);
-- break;
-- }
-- }
-- spin_unlock_irqrestore(&adapter->stats_lock, flags);
-- break;
- default:
- return -EOPNOTSUPP;
- }
- return E1000_SUCCESS;
- }
-+#endif
-
- void
- e1000_pci_set_mwi(struct e1000_hw *hw)
- {
- struct e1000_adapter *adapter = hw->back;
-+#ifdef HAVE_PCI_SET_MWI
- int ret_val = pci_set_mwi(adapter->pdev);
-
- if (ret_val)
- DPRINTK(PROBE, ERR, "Error in setting MWI\n");
-+#else
-+ pci_write_config_word(adapter->pdev, PCI_COMMAND,
-+ adapter->hw.pci_cmd_word |
-+ PCI_COMMAND_INVALIDATE);
-+#endif
- }
-
- void
-@@ -4272,7 +4498,13 @@ e1000_pci_clear_mwi(struct e1000_hw *hw)
- {
- struct e1000_adapter *adapter = hw->back;
-
-+#ifdef HAVE_PCI_SET_MWI
- pci_clear_mwi(adapter->pdev);
-+#else
-+ pci_write_config_word(adapter->pdev, PCI_COMMAND,
-+ adapter->hw.pci_cmd_word &
-+ ~PCI_COMMAND_INVALIDATE);
-+#endif
- }
-
- void
-@@ -4303,6 +4535,7 @@ e1000_io_write(struct e1000_hw *hw, unsi
- outl(value, port);
- }
-
-+#ifdef NETIF_F_HW_VLAN_TX
- static void
- e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
- {
-@@ -4318,18 +4551,21 @@ e1000_vlan_rx_register(struct net_device
- ctrl |= E1000_CTRL_VME;
- E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
-
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
- /* enable VLAN receive filtering */
- rctl = E1000_READ_REG(&adapter->hw, RCTL);
- rctl |= E1000_RCTL_VFE;
- rctl &= ~E1000_RCTL_CFIEN;
- E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
- e1000_update_mng_vlan(adapter);
-+ }
- } else {
- /* disable VLAN tag insert/strip */
- ctrl = E1000_READ_REG(&adapter->hw, CTRL);
- ctrl &= ~E1000_CTRL_VME;
- E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
-
-+ if (adapter->hw.mac_type != e1000_ich8lan) {
- /* disable VLAN filtering */
- rctl = E1000_READ_REG(&adapter->hw, RCTL);
- rctl &= ~E1000_RCTL_VFE;
-@@ -4338,6 +4574,7 @@ e1000_vlan_rx_register(struct net_device
- e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
- adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
- }
-+ }
- }
-
- e1000_irq_enable(adapter);
-@@ -4402,6 +4639,7 @@ e1000_restore_vlan(struct e1000_adapter
- }
- }
- }
-+#endif
-
- int
- e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
-@@ -4492,6 +4730,26 @@ e1000_pci_restore_state(struct e1000_ada
- }
- #endif /* CONFIG_PM */
-
-+#ifndef USE_DRIVER_SHUTDOWN_HANDLER
-+/* only want to do this for 2.4 kernels? */
-+static int
-+e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
-+{
-+ struct pci_dev *pdev = NULL;
-+
-+ switch (event) {
-+ case SYS_DOWN:
-+ case SYS_HALT:
-+ case SYS_POWER_OFF:
-+ while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
-+ if (pci_dev_driver(pdev) == &e1000_driver)
-+ e1000_suspend(pdev, PMSG_SUSPEND);
-+ }
-+ }
-+ return NOTIFY_DONE;
-+}
-+#endif
-+
- static int
- e1000_suspend(struct pci_dev *pdev, pm_message_t state)
- {
-@@ -4499,12 +4757,16 @@ e1000_suspend(struct pci_dev *pdev, pm_m
- struct e1000_adapter *adapter = netdev_priv(netdev);
- uint32_t ctrl, ctrl_ext, rctl, manc, status;
- uint32_t wufc = adapter->wol;
-+#ifdef CONFIG_PM
- int retval = 0;
-+#endif
-
- netif_device_detach(netdev);
-
-- if (netif_running(netdev))
-+ if (netif_running(netdev)) {
-+ WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
- e1000_down(adapter);
-+ }
-
- #ifdef CONFIG_PM
- /* Implement our own version of pci_save_state(pdev) because pci-
-@@ -4523,7 +4785,7 @@ e1000_suspend(struct pci_dev *pdev, pm_m
- e1000_set_multi(netdev);
-
- /* turn on all-multi mode if wake on multicast is enabled */
-- if (adapter->wol & E1000_WUFC_MC) {
-+ if (wufc & E1000_WUFC_MC) {
- rctl = E1000_READ_REG(&adapter->hw, RCTL);
- rctl |= E1000_RCTL_MPE;
- E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
-@@ -4553,74 +4815,64 @@ e1000_suspend(struct pci_dev *pdev, pm_m
-
- E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN);
- E1000_WRITE_REG(&adapter->hw, WUFC, wufc);
-- retval = pci_enable_wake(pdev, PCI_D3hot, 1);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
-- retval = pci_enable_wake(pdev, PCI_D3cold, 1);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
-+ pci_enable_wake(pdev, PCI_D3hot, 1);
-+ pci_enable_wake(pdev, PCI_D3cold, 1);
- } else {
- E1000_WRITE_REG(&adapter->hw, WUC, 0);
- E1000_WRITE_REG(&adapter->hw, WUFC, 0);
-- retval = pci_enable_wake(pdev, PCI_D3hot, 0);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
-- retval = pci_enable_wake(pdev, PCI_D3cold, 0);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
-+ pci_enable_wake(pdev, PCI_D3hot, 0);
-+ pci_enable_wake(pdev, PCI_D3cold, 0);
- }
-
-+ /* FIXME: this code is incorrect for PCI Express */
- if (adapter->hw.mac_type >= e1000_82540 &&
-+ adapter->hw.mac_type != e1000_ich8lan &&
- adapter->hw.media_type == e1000_media_type_copper) {
- manc = E1000_READ_REG(&adapter->hw, MANC);
- if (manc & E1000_MANC_SMBUS_EN) {
- manc |= E1000_MANC_ARP_EN;
- E1000_WRITE_REG(&adapter->hw, MANC, manc);
-- retval = pci_enable_wake(pdev, PCI_D3hot, 1);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
-- retval = pci_enable_wake(pdev, PCI_D3cold, 1);
-- if (retval)
-- DPRINTK(PROBE, ERR,
-- "Error enabling D3 cold wake\n");
-+ pci_enable_wake(pdev, PCI_D3hot, 1);
-+ pci_enable_wake(pdev, PCI_D3cold, 1);
- }
- }
-
-+ if (adapter->hw.phy_type == e1000_phy_igp_3)
-+ e1000_phy_powerdown_workaround(&adapter->hw);
-+
- /* Release control of h/w to f/w. If f/w is AMT enabled, this
- * would have already happened in close and is redundant. */
- e1000_release_hw_control(adapter);
-
- pci_disable_device(pdev);
-
-- retval = pci_set_power_state(pdev, pci_choose_state(pdev, state));
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error in setting power state\n");
-+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
-
- return 0;
- }
-
-+#ifdef USE_DRIVER_SHUTDOWN_HANDLER
-+static void e1000_shutdown(struct pci_dev *pdev)
-+{
-+ e1000_suspend(pdev, PMSG_SUSPEND);
-+}
-+#endif
-+
- #ifdef CONFIG_PM
- static int
- e1000_resume(struct pci_dev *pdev)
- {
- struct net_device *netdev = pci_get_drvdata(pdev);
- struct e1000_adapter *adapter = netdev_priv(netdev);
-- int retval;
- uint32_t manc, ret_val;
-
-- retval = pci_set_power_state(pdev, PCI_D0);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error in setting power state\n");
-+ pci_set_power_state(pdev, PCI_D0);
- e1000_pci_restore_state(adapter);
- ret_val = pci_enable_device(pdev);
- pci_set_master(pdev);
-
-- retval = pci_enable_wake(pdev, PCI_D3hot, 0);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
-- retval = pci_enable_wake(pdev, PCI_D3cold, 0);
-- if (retval)
-- DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
-+ pci_enable_wake(pdev, PCI_D3hot, 0);
-+ pci_enable_wake(pdev, PCI_D3cold, 0);
-
- e1000_reset(adapter);
- E1000_WRITE_REG(&adapter->hw, WUS, ~0);
-@@ -4630,7 +4882,9 @@ e1000_resume(struct pci_dev *pdev)
-
- netif_device_attach(netdev);
-
-+ /* FIXME: this code is incorrect for PCI Express */
- if (adapter->hw.mac_type >= e1000_82540 &&
-+ adapter->hw.mac_type != e1000_ich8lan &&
- adapter->hw.media_type == e1000_media_type_copper) {
- manc = E1000_READ_REG(&adapter->hw, MANC);
- manc &= ~(E1000_MANC_ARP_EN);
-@@ -4658,8 +4912,9 @@ static void
- e1000_netpoll(struct net_device *netdev)
- {
- struct e1000_adapter *adapter = netdev_priv(netdev);
-+
- disable_irq(adapter->pdev->irq);
-- __e1000_intr(adapter->pdev->irq, netdev, NULL, 1);
-+ e1000_intr(adapter->pdev->irq, netdev, NULL);
- e1000_clean_tx_irq(adapter, adapter->tx_ring);
- #ifndef CONFIG_E1000_NAPI
- adapter->clean_rx(adapter, adapter->rx_ring);
-diff -Nurap ./drivers/net/e1000.e1000/e1000_osdep.h ./drivers/net/e1000/e1000_osdep.h
---- ./drivers/net/e1000.e1000/e1000_osdep.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_osdep.h 2006-08-31 14:59:51.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -40,7 +41,9 @@
- #include <asm/io.h>
- #include <linux/interrupt.h>
- #include <linux/sched.h>
-+#include "kcompat.h"
-
-+#define usec_delay(x) udelay(x)
- #ifndef msec_delay
- #define msec_delay(x) do { if(in_interrupt()) { \
- /* Don't mdelay in interrupt context! */ \
-@@ -82,6 +85,9 @@ typedef enum {
- #define DEBUGOUT3 DEBUGOUT2
- #define DEBUGOUT7 DEBUGOUT3
-
-+#ifdef __BIG_ENDIAN
-+#define E1000_BIG_ENDIAN __BIG_ENDIAN
-+#endif
-
- #define E1000_WRITE_REG(a, reg, value) ( \
- writel((value), ((a)->hw_addr + \
-@@ -126,4 +132,17 @@ typedef enum {
-
- #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS)
-
-+#define E1000_WRITE_ICH8_REG(a, reg, value) ( \
-+ writel((value), ((a)->flash_address + reg)))
-+
-+#define E1000_READ_ICH8_REG(a, reg) ( \
-+ readl((a)->flash_address + reg))
-+
-+#define E1000_WRITE_ICH8_REG16(a, reg, value) ( \
-+ writew((value), ((a)->flash_address + reg)))
-+
-+#define E1000_READ_ICH8_REG16(a, reg) ( \
-+ readw((a)->flash_address + reg))
-+
-+
- #endif /* _E1000_OSDEP_H_ */
-diff -Nurap ./drivers/net/e1000.e1000/e1000_param.c ./drivers/net/e1000/e1000_param.c
---- ./drivers/net/e1000.e1000/e1000_param.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/e1000/e1000_param.c 2006-08-31 14:59:51.000000000 +0400
-@@ -1,7 +1,7 @@
- /*******************************************************************************
-
-
-- Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
-@@ -22,6 +22,7 @@
-
- Contact Information:
- Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
- *******************************************************************************/
-@@ -44,11 +45,28 @@
- */
-
- #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
-+#ifndef module_param_array
-+/* Module Parameters are always initialized to -1, so that the driver
-+ * can tell the difference between no user specified value or the
-+ * user asking for the default value.
-+ * The true default values are loaded in when e1000_check_options is called.
-+ *
-+ * This is a GCC extension to ANSI C.
-+ * See the item "Labeled Elements in Initializers" in the section
-+ * "Extensions to the C Language Family" of the GCC documentation.
-+ */
-+
-+#define E1000_PARAM(X, desc) \
-+ static const int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
-+ MODULE_PARM(X, "1-" __MODULE_STRING(E1000_MAX_NIC) "i"); \
-+ MODULE_PARM_DESC(X, desc);
-+#else
- #define E1000_PARAM(X, desc) \
- static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
- static int num_##X = 0; \
-- module_param_array_named(X, X, int, num_##X, 0); \
-+ module_param_array_named(X, X, int, &num_##X, 0); \
- MODULE_PARM_DESC(X, desc);
-+#endif
-
- /* Transmit Descriptor Count
- *
-@@ -182,6 +200,24 @@ E1000_PARAM(RxAbsIntDelay, "Receive Abso
-
- E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
-
-+/* Enable Smart Power Down of the PHY
-+ *
-+ * Valid Range: 0, 1
-+ *
-+ * Default Value: 0 (disabled)
-+ */
-+
-+E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
-+
-+/* Enable Kumeran Lock Loss workaround
-+ *
-+ * Valid Range: 0, 1
-+ *
-+ * Default Value: 1 (enabled)
-+ */
-+
-+E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
-+
- #define AUTONEG_ADV_DEFAULT 0x2F
- #define AUTONEG_ADV_MASK 0x2F
- #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
-@@ -295,6 +331,9 @@ e1000_check_options(struct e1000_adapter
- DPRINTK(PROBE, NOTICE,
- "Warning: no configuration for board #%i\n", bd);
- DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
-+#ifndef module_param_array
-+ bd = E1000_MAX_NIC;
-+#endif
- }
-
- { /* Transmit Descriptor Count */
-@@ -312,14 +351,18 @@ e1000_check_options(struct e1000_adapter
- opt.arg.r.max = mac_type < e1000_82544 ?
- E1000_MAX_TXD : E1000_MAX_82544_TXD;
-
-+#ifdef module_param_array
- if (num_TxDescriptors > bd) {
-+#endif
- tx_ring->count = TxDescriptors[bd];
- e1000_validate_option(&tx_ring->count, &opt, adapter);
- E1000_ROUNDUP(tx_ring->count,
- REQ_TX_DESCRIPTOR_MULTIPLE);
-+#ifdef module_param_array
- } else {
- tx_ring->count = opt.def;
- }
-+#endif
- for (i = 0; i < adapter->num_tx_queues; i++)
- tx_ring[i].count = tx_ring->count;
- }
-@@ -338,14 +381,18 @@ e1000_check_options(struct e1000_adapter
- opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
- E1000_MAX_82544_RXD;
-
-+#ifdef module_param_array
- if (num_RxDescriptors > bd) {
-+#endif
- rx_ring->count = RxDescriptors[bd];
- e1000_validate_option(&rx_ring->count, &opt, adapter);
- E1000_ROUNDUP(rx_ring->count,
- REQ_RX_DESCRIPTOR_MULTIPLE);
-+#ifdef module_param_array
- } else {
- rx_ring->count = opt.def;
- }
-+#endif
- for (i = 0; i < adapter->num_rx_queues; i++)
- rx_ring[i].count = rx_ring->count;
- }
-@@ -357,13 +404,17 @@ e1000_check_options(struct e1000_adapter
- .def = OPTION_ENABLED
- };
-
-+#ifdef module_param_array
- if (num_XsumRX > bd) {
-+#endif
- int rx_csum = XsumRX[bd];
- e1000_validate_option(&rx_csum, &opt, adapter);
- adapter->rx_csum = rx_csum;
-+#ifdef module_param_array
- } else {
- adapter->rx_csum = opt.def;
- }
-+#endif
- }
- { /* Flow Control */
-
-@@ -383,13 +434,17 @@ e1000_check_options(struct e1000_adapter
- .p = fc_list }}
- };
-
-+#ifdef module_param_array
- if (num_FlowControl > bd) {
-+#endif
- int fc = FlowControl[bd];
- e1000_validate_option(&fc, &opt, adapter);
- adapter->hw.fc = adapter->hw.original_fc = fc;
-+#ifdef module_param_array
- } else {
- adapter->hw.fc = adapter->hw.original_fc = opt.def;
- }
-+#endif
- }
- { /* Transmit Interrupt Delay */
- struct e1000_option opt = {
-@@ -401,13 +456,17 @@ e1000_check_options(struct e1000_adapter
- .max = MAX_TXDELAY }}
- };
-
-+#ifdef module_param_array
- if (num_TxIntDelay > bd) {
-+#endif
- adapter->tx_int_delay = TxIntDelay[bd];
- e1000_validate_option(&adapter->tx_int_delay, &opt,
- adapter);
-+#ifdef module_param_array
- } else {
- adapter->tx_int_delay = opt.def;
- }
-+#endif
- }
- { /* Transmit Absolute Interrupt Delay */
- struct e1000_option opt = {
-@@ -419,13 +478,17 @@ e1000_check_options(struct e1000_adapter
- .max = MAX_TXABSDELAY }}
- };
-
-+#ifdef module_param_array
- if (num_TxAbsIntDelay > bd) {
-+#endif
- adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
- e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
- adapter);
-+#ifdef module_param_array
- } else {
- adapter->tx_abs_int_delay = opt.def;
- }
-+#endif
- }
- { /* Receive Interrupt Delay */
- struct e1000_option opt = {
-@@ -437,13 +500,17 @@ e1000_check_options(struct e1000_adapter
- .max = MAX_RXDELAY }}
- };
-
-+#ifdef module_param_array
- if (num_RxIntDelay > bd) {
-+#endif
- adapter->rx_int_delay = RxIntDelay[bd];
- e1000_validate_option(&adapter->rx_int_delay, &opt,
- adapter);
-+#ifdef module_param_array
- } else {
- adapter->rx_int_delay = opt.def;
- }
-+#endif
- }
- { /* Receive Absolute Interrupt Delay */
- struct e1000_option opt = {
-@@ -455,13 +522,17 @@ e1000_check_options(struct e1000_adapter
- .max = MAX_RXABSDELAY }}
- };
-
-+#ifdef module_param_array
- if (num_RxAbsIntDelay > bd) {
-+#endif
- adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
- e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
- adapter);
-+#ifdef module_param_array
- } else {
- adapter->rx_abs_int_delay = opt.def;
- }
-+#endif
- }
- { /* Interrupt Throttling Rate */
- struct e1000_option opt = {
-@@ -473,7 +544,9 @@ e1000_check_options(struct e1000_adapter
- .max = MAX_ITR }}
- };
-
-+#ifdef module_param_array
- if (num_InterruptThrottleRate > bd) {
-+#endif
- adapter->itr = InterruptThrottleRate[bd];
- switch (adapter->itr) {
- case 0:
-@@ -489,9 +562,51 @@ e1000_check_options(struct e1000_adapter
- adapter);
- break;
- }
-+#ifdef module_param_array
- } else {
- adapter->itr = opt.def;
- }
-+#endif
-+ }
-+ { /* Smart Power Down */
-+ struct e1000_option opt = {
-+ .type = enable_option,
-+ .name = "PHY Smart Power Down",
-+ .err = "defaulting to Disabled",
-+ .def = OPTION_DISABLED
-+ };
-+
-+#ifdef module_param_array
-+ if (num_SmartPowerDownEnable > bd) {
-+#endif
-+ int spd = SmartPowerDownEnable[bd];
-+ e1000_validate_option(&spd, &opt, adapter);
-+ adapter->smart_power_down = spd;
-+#ifdef module_param_array
-+ } else {
-+ adapter->smart_power_down = opt.def;
-+ }
-+#endif
-+ }
-+ { /* Kumeran Lock Loss Workaround */
-+ struct e1000_option opt = {
-+ .type = enable_option,
-+ .name = "Kumeran Lock Loss Workaround",
-+ .err = "defaulting to Enabled",
-+ .def = OPTION_ENABLED
-+ };
-+
-+#ifdef module_param_array
-+ if (num_KumeranLockLoss > bd) {
-+#endif
-+ int kmrn_lock_loss = KumeranLockLoss[bd];
-+ e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
-+ adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
-+#ifdef module_param_array
-+ } else {
-+ adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
-+ }
-+#endif
- }
-
- switch (adapter->hw.media_type) {
-@@ -518,17 +633,30 @@ static void __devinit
- e1000_check_fiber_options(struct e1000_adapter *adapter)
- {
- int bd = adapter->bd_number;
-+#ifndef module_param_array
-+ bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
-+ if ((Speed[bd] != OPTION_UNSET)) {
-+#else
- if (num_Speed > bd) {
-+#endif
- DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
- "parameter ignored\n");
- }
-
-+#ifndef module_param_array
-+ if ((Duplex[bd] != OPTION_UNSET)) {
-+#else
- if (num_Duplex > bd) {
-+#endif
- DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
- "parameter ignored\n");
- }
-
-+#ifndef module_param_array
-+ if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
-+#else
- if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
-+#endif
- DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
- "not valid for fiber adapters, "
- "parameter ignored\n");
-@@ -547,6 +675,9 @@ e1000_check_copper_options(struct e1000_
- {
- int speed, dplx, an;
- int bd = adapter->bd_number;
-+#ifndef module_param_array
-+ bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
-+#endif
-
- { /* Speed */
- struct e1000_opt_list speed_list[] = {{ 0, "" },
-@@ -563,12 +694,16 @@ e1000_check_copper_options(struct e1000_
- .p = speed_list }}
- };
-
-+#ifdef module_param_array
- if (num_Speed > bd) {
-+#endif
- speed = Speed[bd];
- e1000_validate_option(&speed, &opt, adapter);
-+#ifdef module_param_array
- } else {
- speed = opt.def;
- }
-+#endif
- }
- { /* Duplex */
- struct e1000_opt_list dplx_list[] = {{ 0, "" },
-@@ -590,15 +725,23 @@ e1000_check_copper_options(struct e1000_
- "Speed/Duplex/AutoNeg parameter ignored.\n");
- return;
- }
-+#ifdef module_param_array
- if (num_Duplex > bd) {
-+#endif
- dplx = Duplex[bd];
- e1000_validate_option(&dplx, &opt, adapter);
-+#ifdef module_param_array
- } else {
- dplx = opt.def;
- }
-+#endif
- }
-
-+#ifdef module_param_array
- if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
-+#else
-+ if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
-+#endif
- DPRINTK(PROBE, INFO,
- "AutoNeg specified along with Speed or Duplex, "
- "parameter ignored\n");
-@@ -647,19 +790,27 @@ e1000_check_copper_options(struct e1000_
- .p = an_list }}
- };
-
-+#ifdef module_param_array
- if (num_AutoNeg > bd) {
-+#endif
- an = AutoNeg[bd];
- e1000_validate_option(&an, &opt, adapter);
-+#ifdef module_param_array
- } else {
- an = opt.def;
- }
-+#endif
- adapter->hw.autoneg_advertised = an;
- }
-
- switch (speed + dplx) {
- case 0:
- adapter->hw.autoneg = adapter->fc_autoneg = 1;
-+#ifdef module_param_array
- if ((num_Speed > bd) && (speed != 0 || dplx != 0))
-+#else
-+ if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
-+#endif
- DPRINTK(PROBE, INFO,
- "Speed and duplex autonegotiation enabled\n");
- break;
-diff -Nurap ./drivers/net/e1000.e1000/kcompat.c ./drivers/net/e1000/kcompat.c
---- ./drivers/net/e1000.e1000/kcompat.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/e1000/kcompat.c 2006-08-31 14:59:51.000000000 +0400
-@@ -0,0 +1,183 @@
-+/*******************************************************************************
-+
-+
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the Free
-+ Software Foundation; either version 2 of the License, or (at your option)
-+ any later version.
-+
-+ This program is distributed in the hope that it will be useful, but WITHOUT
-+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ more details.
-+
-+ You should have received a copy of the GNU General Public License along with
-+ this program; if not, write to the Free Software Foundation, Inc., 59
-+ Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+ The full GNU General Public License is included in this distribution in the
-+ file called LICENSE.
-+
-+ Contact Information:
-+ Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
-+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-+
-+*******************************************************************************/
-+
-+#include "kcompat.h"
-+
-+/*****************************************************************************/
-+/* 2.4.13 => 2.4.3 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,13) )
-+
-+/**************************************/
-+/* PCI DMA MAPPING */
-+
-+#if defined(CONFIG_HIGHMEM)
-+
-+#ifndef PCI_DRAM_OFFSET
-+#define PCI_DRAM_OFFSET 0
-+#endif
-+
-+u64 _kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset, size_t size, int direction)
-+{
-+ return (((u64)(page - mem_map) << PAGE_SHIFT) + offset + PCI_DRAM_OFFSET);
-+}
-+
-+#else /* CONFIG_HIGHMEM */
-+
-+u64 _kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset, size_t size, int direction)
-+{
-+ return pci_map_single(dev, (void *)page_address(page) + offset, size, direction);
-+}
-+
-+#endif /* CONFIG_HIGHMEM */
-+
-+void _kc_pci_unmap_page(struct pci_dev *dev, u64 dma_addr, size_t size, int direction)
-+{
-+ return pci_unmap_single(dev, dma_addr, size, direction);
-+}
-+
-+#endif /* 2.4.13 => 2.4.3 */
-+
-+
-+/*****************************************************************************/
-+/* 2.4.3 => 2.4.0 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) )
-+
-+/**************************************/
-+/* PCI DRIVER API */
-+
-+int _kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
-+{
-+ if (!pci_dma_supported(dev, mask))
-+ return -EIO;
-+ dev->dma_mask = mask;
-+ return 0;
-+}
-+
-+int _kc_pci_request_regions(struct pci_dev *dev, char *res_name)
-+{
-+ int i;
-+
-+ for (i = 0; i < 6; i++) {
-+ if (pci_resource_len(dev, i) == 0)
-+ continue;
-+
-+ if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
-+ if (!request_region(pci_resource_start(dev, i), pci_resource_len(dev, i), res_name)) {
-+ pci_release_regions(dev);
-+ return -EBUSY;
-+ }
-+ } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
-+ if (!request_mem_region(pci_resource_start(dev, i), pci_resource_len(dev, i), res_name)) {
-+ pci_release_regions(dev);
-+ return -EBUSY;
-+ }
-+ }
-+ }
-+ return 0;
-+}
-+
-+void _kc_pci_release_regions(struct pci_dev *dev)
-+{
-+ int i;
-+
-+ for (i = 0; i < 6; i++) {
-+ if (pci_resource_len(dev, i) == 0)
-+ continue;
-+
-+ if (pci_resource_flags(dev, i) & IORESOURCE_IO)
-+ release_region(pci_resource_start(dev, i), pci_resource_len(dev, i));
-+
-+ else if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
-+ release_mem_region(pci_resource_start(dev, i), pci_resource_len(dev, i));
-+ }
-+}
-+
-+/**************************************/
-+/* NETWORK DRIVER API */
-+
-+struct net_device * _kc_alloc_etherdev(int sizeof_priv)
-+{
-+ struct net_device *dev;
-+ int alloc_size;
-+
-+ alloc_size = sizeof (*dev) + sizeof_priv + IFNAMSIZ + 31;
-+
-+ dev = kmalloc(alloc_size, GFP_KERNEL);
-+
-+ if (!dev) return NULL;
-+
-+ memset(dev, 0, alloc_size);
-+
-+ if (sizeof_priv)
-+ dev->priv = (void *) (((unsigned long)(dev + 1) + 31) & ~31);
-+
-+ dev->name[0] = '\0';
-+
-+ ether_setup(dev);
-+
-+ return dev;
-+}
-+
-+int _kc_is_valid_ether_addr(u8 *addr)
-+{
-+ const char zaddr[6] = {0,};
-+
-+ return !(addr[0]&1) && memcmp( addr, zaddr, 6);
-+}
-+
-+#endif /* 2.4.3 => 2.4.0 */
-+
-+
-+/*****************************************************************************/
-+/* 2.4.6 => 2.4.3 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) )
-+
-+int _kc_pci_set_power_state(struct pci_dev *dev, int state)
-+{ return 0; }
-+int _kc_pci_save_state(struct pci_dev *dev, u32 *buffer)
-+{ return 0; }
-+int _kc_pci_restore_state(struct pci_dev *pdev, u32 *buffer)
-+{ return 0; }
-+int _kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable)
-+{ return 0; }
-+
-+#endif /* 2.4.6 => 2.4.3 */
-+
-+/*****************************************************************************/
-+/* 2.6.0 => 2.4.6 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
-+void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size)
-+{
-+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-+ frag->page = page;
-+ frag->page_offset = off;
-+ frag->size = size;
-+ skb_shinfo(skb)->nr_frags = i + 1;
-+}
-+#endif /* 2.6.0 => 2.4.6 */
-diff -Nurap ./drivers/net/e1000.e1000/kcompat.h ./drivers/net/e1000/kcompat.h
---- ./drivers/net/e1000.e1000/kcompat.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/e1000/kcompat.h 2006-08-31 14:59:51.000000000 +0400
-@@ -0,0 +1,802 @@
-+/*******************************************************************************
-+
-+
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the Free
-+ Software Foundation; either version 2 of the License, or (at your option)
-+ any later version.
-+
-+ This program is distributed in the hope that it will be useful, but WITHOUT
-+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ more details.
-+
-+ You should have received a copy of the GNU General Public License along with
-+ this program; if not, write to the Free Software Foundation, Inc., 59
-+ Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+ The full GNU General Public License is included in this distribution in the
-+ file called LICENSE.
-+
-+ Contact Information:
-+ Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
-+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-+
-+*******************************************************************************/
-+
-+#ifndef _KCOMPAT_H_
-+#define _KCOMPAT_H_
-+
-+#include <linux/version.h>
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/module.h>
-+#include <linux/pci.h>
-+#include <linux/netdevice.h>
-+#include <linux/ioport.h>
-+#include <linux/slab.h>
-+#include <linux/pagemap.h>
-+#include <linux/list.h>
-+#include <linux/sched.h>
-+#include <asm/io.h>
-+
-+#ifndef IRQ_HANDLED
-+#define irqreturn_t void
-+#define IRQ_HANDLED
-+#define IRQ_NONE
-+#endif
-+
-+#ifndef SET_NETDEV_DEV
-+#define SET_NETDEV_DEV(net, pdev)
-+#endif
-+
-+#ifndef HAVE_FREE_NETDEV
-+#define free_netdev(x) kfree(x)
-+#endif
-+
-+#ifdef HAVE_POLL_CONTROLLER
-+#define CONFIG_NET_POLL_CONTROLLER
-+#endif
-+
-+#ifdef E1000_NAPI
-+#undef CONFIG_E1000_NAPI
-+#define CONFIG_E1000_NAPI
-+#endif
-+
-+#ifdef E1000_NO_NAPI
-+#undef CONFIG_E1000_NAPI
-+#endif
-+
-+#ifdef DISABLE_PACKET_SPLIT
-+#undef CONFIG_E1000_DISABLE_PACKET_SPLIT
-+#define CONFIG_E1000_DISABLE_PACKET_SPLIT
-+#endif
-+
-+#ifdef DISABLE_PCI_MSI
-+#undef CONFIG_PCI_MSI
-+#endif
-+
-+#ifdef DISABLE_PM
-+#undef CONFIG_PM
-+#endif
-+
-+#ifdef DISABLE_NET_POLL_CONTROLLER
-+#undef CONFIG_NET_POLL_CONTROLLER
-+#endif
-+
-+#ifndef module_param
-+#define module_param(v,t,p) MODULE_PARM(v, "i");
-+#endif
-+
-+#ifndef DMA_64BIT_MASK
-+#define DMA_64BIT_MASK 0xffffffffffffffffULL
-+#endif
-+
-+#ifndef DMA_32BIT_MASK
-+#define DMA_32BIT_MASK 0x00000000ffffffffULL
-+#endif
-+
-+/*****************************************************************************/
-+#ifndef unlikely
-+#define unlikely(_x) _x
-+#define likely(_x) _x
-+#endif
-+/*****************************************************************************/
-+
-+#ifndef PCI_DEVICE
-+#define PCI_DEVICE(vend,dev) \
-+ .vendor = (vend), .device = (dev), \
-+ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
-+#endif
-+
-+/*****************************************************************************/
-+/* Installations with ethtool version without eeprom, adapter id, or statistics
-+ * support */
-+#ifndef ETHTOOL_GSTATS
-+#define ETHTOOL_GSTATS 0x1d
-+#undef ethtool_drvinfo
-+#define ethtool_drvinfo k_ethtool_drvinfo
-+struct k_ethtool_drvinfo {
-+ uint32_t cmd;
-+ char driver[32];
-+ char version[32];
-+ char fw_version[32];
-+ char bus_info[32];
-+ char reserved1[32];
-+ char reserved2[16];
-+ uint32_t n_stats;
-+ uint32_t testinfo_len;
-+ uint32_t eedump_len;
-+ uint32_t regdump_len;
-+};
-+
-+struct ethtool_stats {
-+ uint32_t cmd;
-+ uint32_t n_stats;
-+ uint64_t data[0];
-+};
-+
-+#ifndef ETHTOOL_PHYS_ID
-+#define ETHTOOL_PHYS_ID 0x1c
-+#ifndef ETHTOOL_GSTRINGS
-+#define ETHTOOL_GSTRINGS 0x1b
-+enum ethtool_stringset {
-+ ETH_SS_TEST = 0,
-+ ETH_SS_STATS,
-+};
-+struct ethtool_gstrings {
-+ u32 cmd; /* ETHTOOL_GSTRINGS */
-+ u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
-+ u32 len; /* number of strings in the string set */
-+ u8 data[0];
-+};
-+#ifndef ETHTOOL_TEST
-+#define ETHTOOL_TEST 0x1a
-+enum ethtool_test_flags {
-+ ETH_TEST_FL_OFFLINE = (1 << 0),
-+ ETH_TEST_FL_FAILED = (1 << 1),
-+};
-+struct ethtool_test {
-+ uint32_t cmd;
-+ uint32_t flags;
-+ uint32_t reserved;
-+ uint32_t len;
-+ uint64_t data[0];
-+};
-+#ifndef ETHTOOL_GEEPROM
-+#define ETHTOOL_GEEPROM 0xb
-+#undef ETHTOOL_GREGS
-+struct ethtool_eeprom {
-+ uint32_t cmd;
-+ uint32_t magic;
-+ uint32_t offset;
-+ uint32_t len;
-+ uint8_t data[0];
-+};
-+
-+struct ethtool_value {
-+ uint32_t cmd;
-+ uint32_t data;
-+};
-+
-+#ifndef ETHTOOL_GLINK
-+#define ETHTOOL_GLINK 0xa
-+#endif /* Ethtool version without link support */
-+#endif /* Ethtool version without eeprom support */
-+#endif /* Ethtool version without test support */
-+#endif /* Ethtool version without strings support */
-+#endif /* Ethtool version wihtout adapter id support */
-+#endif /* Ethtool version without statistics support */
-+
-+#ifndef ETHTOOL_GREGS
-+#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers */
-+#define ethtool_regs _kc_ethtool_regs
-+/* for passing big chunks of data */
-+struct _kc_ethtool_regs {
-+ u32 cmd;
-+ u32 version; /* driver-specific, indicates different chips/revs */
-+ u32 len; /* bytes */
-+ u8 data[0];
-+};
-+#endif
-+#ifndef ETHTOOL_GMSGLVL
-+#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
-+#endif
-+#ifndef ETHTOOL_SMSGLVL
-+#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */
-+#endif
-+#ifndef ETHTOOL_NWAY_RST
-+#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv */
-+#endif
-+#ifndef ETHTOOL_GLINK
-+#define ETHTOOL_GLINK 0x0000000a /* Get link status */
-+#endif
-+#ifndef ETHTOOL_GEEPROM
-+#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
-+#endif
-+#ifndef ETHTOOL_SEEPROM
-+#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data */
-+#endif
-+#ifndef ETHTOOL_GCOALESCE
-+#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
-+/* for configuring coalescing parameters of chip */
-+#define ethtool_coalesce _kc_ethtool_coalesce
-+struct _kc_ethtool_coalesce {
-+ u32 cmd; /* ETHTOOL_{G,S}COALESCE */
-+
-+ /* How many usecs to delay an RX interrupt after
-+ * a packet arrives. If 0, only rx_max_coalesced_frames
-+ * is used.
-+ */
-+ u32 rx_coalesce_usecs;
-+
-+ /* How many packets to delay an RX interrupt after
-+ * a packet arrives. If 0, only rx_coalesce_usecs is
-+ * used. It is illegal to set both usecs and max frames
-+ * to zero as this would cause RX interrupts to never be
-+ * generated.
-+ */
-+ u32 rx_max_coalesced_frames;
-+
-+ /* Same as above two parameters, except that these values
-+ * apply while an IRQ is being serviced by the host. Not
-+ * all cards support this feature and the values are ignored
-+ * in that case.
-+ */
-+ u32 rx_coalesce_usecs_irq;
-+ u32 rx_max_coalesced_frames_irq;
-+
-+ /* How many usecs to delay a TX interrupt after
-+ * a packet is sent. If 0, only tx_max_coalesced_frames
-+ * is used.
-+ */
-+ u32 tx_coalesce_usecs;
-+
-+ /* How many packets to delay a TX interrupt after
-+ * a packet is sent. If 0, only tx_coalesce_usecs is
-+ * used. It is illegal to set both usecs and max frames
-+ * to zero as this would cause TX interrupts to never be
-+ * generated.
-+ */
-+ u32 tx_max_coalesced_frames;
-+
-+ /* Same as above two parameters, except that these values
-+ * apply while an IRQ is being serviced by the host. Not
-+ * all cards support this feature and the values are ignored
-+ * in that case.
-+ */
-+ u32 tx_coalesce_usecs_irq;
-+ u32 tx_max_coalesced_frames_irq;
-+
-+ /* How many usecs to delay in-memory statistics
-+ * block updates. Some drivers do not have an in-memory
-+ * statistic block, and in such cases this value is ignored.
-+ * This value must not be zero.
-+ */
-+ u32 stats_block_coalesce_usecs;
-+
-+ /* Adaptive RX/TX coalescing is an algorithm implemented by
-+ * some drivers to improve latency under low packet rates and
-+ * improve throughput under high packet rates. Some drivers
-+ * only implement one of RX or TX adaptive coalescing. Anything
-+ * not implemented by the driver causes these values to be
-+ * silently ignored.
-+ */
-+ u32 use_adaptive_rx_coalesce;
-+ u32 use_adaptive_tx_coalesce;
-+
-+ /* When the packet rate (measured in packets per second)
-+ * is below pkt_rate_low, the {rx,tx}_*_low parameters are
-+ * used.
-+ */
-+ u32 pkt_rate_low;
-+ u32 rx_coalesce_usecs_low;
-+ u32 rx_max_coalesced_frames_low;
-+ u32 tx_coalesce_usecs_low;
-+ u32 tx_max_coalesced_frames_low;
-+
-+ /* When the packet rate is below pkt_rate_high but above
-+ * pkt_rate_low (both measured in packets per second) the
-+ * normal {rx,tx}_* coalescing parameters are used.
-+ */
-+
-+ /* When the packet rate is (measured in packets per second)
-+ * is above pkt_rate_high, the {rx,tx}_*_high parameters are
-+ * used.
-+ */
-+ u32 pkt_rate_high;
-+ u32 rx_coalesce_usecs_high;
-+ u32 rx_max_coalesced_frames_high;
-+ u32 tx_coalesce_usecs_high;
-+ u32 tx_max_coalesced_frames_high;
-+
-+ /* How often to do adaptive coalescing packet rate sampling,
-+ * measured in seconds. Must not be zero.
-+ */
-+ u32 rate_sample_interval;
-+};
-+#endif
-+#ifndef ETHTOOL_SCOALESCE
-+#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
-+#endif
-+#ifndef ETHTOOL_GRINGPARAM
-+#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
-+/* for configuring RX/TX ring parameters */
-+#define ethtool_ringparam _kc_ethtool_ringparam
-+struct _kc_ethtool_ringparam {
-+ u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
-+
-+ /* Read only attributes. These indicate the maximum number
-+ * of pending RX/TX ring entries the driver will allow the
-+ * user to set.
-+ */
-+ u32 rx_max_pending;
-+ u32 rx_mini_max_pending;
-+ u32 rx_jumbo_max_pending;
-+ u32 tx_max_pending;
-+
-+ /* Values changeable by the user. The valid values are
-+ * in the range 1 to the "*_max_pending" counterpart above.
-+ */
-+ u32 rx_pending;
-+ u32 rx_mini_pending;
-+ u32 rx_jumbo_pending;
-+ u32 tx_pending;
-+};
-+#endif
-+#ifndef ETHTOOL_SRINGPARAM
-+#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */
-+#endif
-+#ifndef ETHTOOL_GPAUSEPARAM
-+#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
-+/* for configuring link flow control parameters */
-+#define ethtool_pauseparam _kc_ethtool_pauseparam
-+struct _kc_ethtool_pauseparam {
-+ u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
-+
-+ /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
-+ * being true) the user may set 'autonet' here non-zero to have the
-+ * pause parameters be auto-negotiated too. In such a case, the
-+ * {rx,tx}_pause values below determine what capabilities are
-+ * advertised.
-+ *
-+ * If 'autoneg' is zero or the link is not being auto-negotiated,
-+ * then {rx,tx}_pause force the driver to use/not-use pause
-+ * flow control.
-+ */
-+ u32 autoneg;
-+ u32 rx_pause;
-+ u32 tx_pause;
-+};
-+#endif
-+#ifndef ETHTOOL_SPAUSEPARAM
-+#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
-+#endif
-+#ifndef ETHTOOL_GRXCSUM
-+#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_SRXCSUM
-+#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_GTXCSUM
-+#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_STXCSUM
-+#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_GSG
-+#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
-+ * (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_SSG
-+#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
-+ * (ethtool_value). */
-+#endif
-+#ifndef ETHTOOL_TEST
-+#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */
-+#endif
-+#ifndef ETHTOOL_GSTRINGS
-+#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
-+#endif
-+#ifndef ETHTOOL_PHYS_ID
-+#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
-+#endif
-+#ifndef ETHTOOL_GSTATS
-+#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
-+#endif
-+#ifndef ETHTOOL_GTSO
-+#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
-+#endif
-+#ifndef ETHTOOL_STSO
-+#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
-+#endif
-+
-+/*****************************************************************************/
-+/* 2.4.3 => 2.4.0 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) )
-+
-+/**************************************/
-+/* PCI DRIVER API */
-+
-+#ifndef pci_set_dma_mask
-+#define pci_set_dma_mask _kc_pci_set_dma_mask
-+extern int _kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask);
-+#endif
-+
-+#ifndef pci_request_regions
-+#define pci_request_regions _kc_pci_request_regions
-+extern int _kc_pci_request_regions(struct pci_dev *pdev, char *res_name);
-+#endif
-+
-+#ifndef pci_release_regions
-+#define pci_release_regions _kc_pci_release_regions
-+extern void _kc_pci_release_regions(struct pci_dev *pdev);
-+#endif
-+
-+/**************************************/
-+/* NETWORK DRIVER API */
-+
-+#ifndef alloc_etherdev
-+#define alloc_etherdev _kc_alloc_etherdev
-+extern struct net_device * _kc_alloc_etherdev(int sizeof_priv);
-+#endif
-+
-+#ifndef is_valid_ether_addr
-+#define is_valid_ether_addr _kc_is_valid_ether_addr
-+extern int _kc_is_valid_ether_addr(u8 *addr);
-+#endif
-+
-+/**************************************/
-+/* MISCELLANEOUS */
-+
-+#ifndef INIT_TQUEUE
-+#define INIT_TQUEUE(_tq, _routine, _data) \
-+ do { \
-+ INIT_LIST_HEAD(&(_tq)->list); \
-+ (_tq)->sync = 0; \
-+ (_tq)->routine = _routine; \
-+ (_tq)->data = _data; \
-+ } while (0)
-+#endif
-+
-+#endif /* 2.4.3 => 2.4.0 */
-+
-+/*****************************************************************************/
-+/* 2.4.6 => 2.4.3 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) )
-+
-+#ifndef pci_set_power_state
-+#define pci_set_power_state _kc_pci_set_power_state
-+extern int _kc_pci_set_power_state(struct pci_dev *dev, int state);
-+#endif
-+
-+#ifndef pci_save_state
-+#define pci_save_state _kc_pci_save_state
-+extern int _kc_pci_save_state(struct pci_dev *dev, u32 *buffer);
-+#endif
-+
-+#ifndef pci_restore_state
-+#define pci_restore_state _kc_pci_restore_state
-+extern int _kc_pci_restore_state(struct pci_dev *pdev, u32 *buffer);
-+#endif
-+
-+#ifndef pci_enable_wake
-+#define pci_enable_wake _kc_pci_enable_wake
-+extern int _kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable);
-+#endif
-+
-+/* PCI PM entry point syntax changed, so don't support suspend/resume */
-+#undef CONFIG_PM
-+
-+#endif /* 2.4.6 => 2.4.3 */
-+
-+/*****************************************************************************/
-+/* 2.4.10 => 2.4.6 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) )
-+
-+/**************************************/
-+/* MODULE API */
-+
-+#ifndef MODULE_LICENSE
-+ #define MODULE_LICENSE(X)
-+#endif
-+
-+/**************************************/
-+/* OTHER */
-+
-+#define prefetch(x)
-+
-+#undef min
-+#define min(x,y) ({ \
-+ const typeof(x) _x = (x); \
-+ const typeof(y) _y = (y); \
-+ (void) (&_x == &_y); \
-+ _x < _y ? _x : _y; })
-+
-+#undef max
-+#define max(x,y) ({ \
-+ const typeof(x) _x = (x); \
-+ const typeof(y) _y = (y); \
-+ (void) (&_x == &_y); \
-+ _x > _y ? _x : _y; })
-+
-+#endif /* 2.4.10 -> 2.4.6 */
-+
-+
-+/*****************************************************************************/
-+/* 2.4.13 => 2.4.10 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,13) )
-+
-+/**************************************/
-+/* PCI DMA MAPPING */
-+
-+#ifndef virt_to_page
-+ #define virt_to_page(v) (mem_map + (virt_to_phys(v) >> PAGE_SHIFT))
-+#endif
-+
-+#ifndef pci_map_page
-+#define pci_map_page _kc_pci_map_page
-+extern u64 _kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset, size_t size, int direction);
-+#endif
-+
-+#ifndef pci_unmap_page
-+#define pci_unmap_page _kc_pci_unmap_page
-+extern void _kc_pci_unmap_page(struct pci_dev *dev, u64 dma_addr, size_t size, int direction);
-+#endif
-+
-+/* pci_set_dma_mask takes dma_addr_t, which is only 32-bits prior to 2.4.13 */
-+
-+#undef DMA_32BIT_MASK
-+#define DMA_32BIT_MASK 0xffffffff
-+#undef DMA_64BIT_MASK
-+#define DMA_64BIT_MASK 0xffffffff
-+
-+#endif /* 2.4.13 => 2.4.10 */
-+
-+/*****************************************************************************/
-+/* 2.4.17 => 2.4.12 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17) )
-+
-+#ifndef __devexit_p
-+ #define __devexit_p(x) &(x)
-+#endif
-+
-+#endif /* 2.4.17 => 2.4.13 */
-+
-+/*****************************************************************************/
-+/* 2.4.22 => 2.4.17 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) )
-+#define pci_name(x) ((x)->slot_name)
-+#endif
-+
-+/*****************************************************************************/
-+/* 2.4.23 => 2.4.22 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) )
-+#ifdef CONFIG_E1000_NAPI
-+#ifndef netif_poll_disable
-+#define netif_poll_disable(x) _kc_netif_poll_disable(x)
-+static inline void _kc_netif_poll_disable(struct net_device *netdev)
-+{
-+ while (test_and_set_bit(__LINK_STATE_RX_SCHED, &netdev->state)) {
-+ /* No hurry */
-+ current->state = TASK_INTERRUPTIBLE;
-+ schedule_timeout(1);
-+ }
-+}
-+#endif
-+#ifndef netif_poll_enable
-+#define netif_poll_enable(x) _kc_netif_poll_enable(x)
-+static inline void _kc_netif_poll_enable(struct net_device *netdev)
-+{
-+ clear_bit(__LINK_STATE_RX_SCHED, &netdev->state);
-+}
-+#endif
-+#endif
-+#endif
-+
-+/*****************************************************************************/
-+/* 2.5.28 => 2.4.23 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
-+
-+static inline void _kc_synchronize_irq() { synchronize_irq(); }
-+#undef synchronize_irq
-+#define synchronize_irq(X) _kc_synchronize_irq()
-+
-+#include <linux/tqueue.h>
-+#define work_struct tq_struct
-+#define INIT_WORK INIT_TQUEUE
-+#define schedule_work schedule_task
-+#define flush_scheduled_work flush_scheduled_tasks
-+
-+#endif /* 2.5.28 => 2.4.17 */
-+
-+/*****************************************************************************/
-+/* 2.6.0 => 2.5.28 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
-+#define MODULE_INFO(version, _version)
-+#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
-+#define CONFIG_E1000_DISABLE_PACKET_SPLIT 1
-+
-+#define pci_set_consistent_dma_mask(dev,mask) 1
-+#endif
-+
-+#undef dev_put
-+#define dev_put(dev) __dev_put(dev)
-+
-+#ifndef skb_fill_page_desc
-+#define skb_fill_page_desc _kc_skb_fill_page_desc
-+extern void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size);
-+#endif
-+#endif /* 2.6.0 => 2.5.28 */
-+
-+/*****************************************************************************/
-+/* 2.6.4 => 2.6.0 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) )
-+#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
-+#endif /* 2.6.4 => 2.6.0 */
-+
-+/*****************************************************************************/
-+/* 2.6.5 => 2.6.0 */
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) )
-+#define pci_dma_sync_single_for_cpu pci_dma_sync_single
-+#define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu
-+#endif /* 2.6.5 => 2.6.0 */
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25) || \
-+ ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) )
-+#define ETHTOOL_OPS_COMPAT
-+#endif
-+
-+#ifndef HAVE_NETIF_MSG
-+#define HAVE_NETIF_MSG 1
-+enum {
-+ NETIF_MSG_DRV = 0x0001,
-+ NETIF_MSG_PROBE = 0x0002,
-+ NETIF_MSG_LINK = 0x0004,
-+ NETIF_MSG_TIMER = 0x0008,
-+ NETIF_MSG_IFDOWN = 0x0010,
-+ NETIF_MSG_IFUP = 0x0020,
-+ NETIF_MSG_RX_ERR = 0x0040,
-+ NETIF_MSG_TX_ERR = 0x0080,
-+ NETIF_MSG_TX_QUEUED = 0x0100,
-+ NETIF_MSG_INTR = 0x0200,
-+ NETIF_MSG_TX_DONE = 0x0400,
-+ NETIF_MSG_RX_STATUS = 0x0800,
-+ NETIF_MSG_PKTDATA = 0x1000,
-+ NETIF_MSG_HW = 0x2000,
-+ NETIF_MSG_WOL = 0x4000,
-+};
-+#endif /* ! HAVE_NETIF_MSG */
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) )
-+#undef if_mii
-+#define if_mii _kc_if_mii
-+static inline struct mii_ioctl_data *_kc_if_mii(struct ifreq *rq)
-+{
-+ return (struct mii_ioctl_data *) &rq->ifr_ifru;
-+}
-+#endif /* < 2.6.7 */
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) )
-+#define msleep(x) do { set_current_state(TASK_UNINTERRUPTIBLE); \
-+ schedule_timeout((x * HZ)/1000 + 2); \
-+ } while (0)
-+#endif
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) )
-+#define msleep_interruptible(x) do {set_current_state(TASK_INTERRUPTIBLE); \
-+ schedule_timeout((x * HZ)/1000); \
-+ } while (0)
-+#endif
-+
-+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) )
-+#ifdef pci_save_state
-+#undef pci_save_state
-+#endif
-+#define pci_save_state(X) { \
-+ int i; \
-+ if (adapter->pci_state) { \
-+ for (i = 0; i < 16; i++) { \
-+ pci_read_config_dword((X), \
-+ i * 4, \
-+ &adapter->pci_state[i]); \
-+ } \
-+ } \
-+}
-+
-+#ifdef pci_restore_state
-+#undef pci_restore_state
-+#endif
-+#define pci_restore_state(X) { \
-+ int i; \
-+ if (adapter->pci_state) { \
-+ for (i = 0; i < 16; i++) { \
-+ pci_write_config_dword((X), \
-+ i * 4, \
-+ adapter->pci_state[i]); \
-+ } \
-+ } else { \
-+ for (i = 0; i < 6; i++) { \
-+ pci_write_config_dword((X), \
-+ PCI_BASE_ADDRESS_0 + (i * 4), \
-+ (X)->resource[i].start); \
-+ } \
-+ pci_write_config_byte((X), PCI_INTERRUPT_LINE, (X)->irq); \
-+ } \
-+}
-+#endif /* 2.4.6 <= x < 2.6.10 */
-+
-+#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \
-+ (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \
-+ ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) )))
-+#define netdev_priv(x) x->priv
-+#endif
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) )
-+#ifdef module_param_array_named
-+#undef module_param_array_named
-+#define module_param_array_named(name, array, type, nump, perm) \
-+ static struct kparam_array __param_arr_##name \
-+ = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type, \
-+ sizeof(array[0]), array }; \
-+ module_param_call(name, param_array_set, param_array_get, \
-+ &__param_arr_##name, perm)
-+#endif /* module_param_array_named */
-+
-+#endif /* < 2.6.10 */
-+
-+#ifndef NET_IP_ALIGN
-+#define NET_IP_ALIGN 2
-+#endif
-+
-+#ifndef NETDEV_TX_OK
-+#define NETDEV_TX_OK 0 /* driver took care of the packet */
-+#endif
-+
-+#ifndef NETDEV_TX_BUSY
-+#define NETDEV_TX_BUSY 1 /* driver tx path was busy */
-+#endif
-+
-+#ifndef NETDEV_TX_LOCKED
-+#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
-+#endif
-+
-+/* if we do not have the infrastructure to detect if skb_header is cloned *
-+ * just return false in all cases */
-+#ifndef SKB_DATAREF_SHIFT
-+#define skb_header_cloned(x) 0
-+#endif /* SKB_DATAREF_SHIFT not defined */
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) )
-+#define PCI_D0 0
-+#define PCI_D1 1
-+#define PCI_D2 2
-+#define PCI_D3hot 3
-+#define PCI_D3cold 4
-+#define pci_choose_state(pdev,state) state
-+#define PMSG_SUSPEND 3
-+#endif
-+
-+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) )
-+#define pm_message_t u32
-+#endif
-+
-+#ifndef WARN_ON
-+#define WARN_ON(x)
-+#endif
-+
-+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) )
-+#define USE_DRIVER_SHUTDOWN_HANDLER
-+#endif
-+
-+#ifndef SA_PROBEIRQ
-+#define SA_PROBEIRQ 0
-+#endif
-+
-+#endif /* _KCOMPAT_H_ */
-+
-diff -Nurap ./drivers/net/e1000.e1000/kcompat_ethtool.c ./drivers/net/e1000/kcompat_ethtool.c
---- ./drivers/net/e1000.e1000/kcompat_ethtool.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/e1000/kcompat_ethtool.c 2006-08-31 14:59:51.000000000 +0400
-@@ -0,0 +1,851 @@
-+/*******************************************************************************
-+
-+
-+ Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the Free
-+ Software Foundation; either version 2 of the License, or (at your option)
-+ any later version.
-+
-+ This program is distributed in the hope that it will be useful, but WITHOUT
-+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ more details.
-+
-+ You should have received a copy of the GNU General Public License along with
-+ this program; if not, write to the Free Software Foundation, Inc., 59
-+ Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+ The full GNU General Public License is included in this distribution in the
-+ file called LICENSE.
-+
-+ Contact Information:
-+ Linux NICS <linux.nics@intel.com>
-+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
-+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-+
-+*******************************************************************************/
-+
-+/*
-+ * net/core/ethtool.c - Ethtool ioctl handler
-+ * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
-+ *
-+ * This file is where we call all the ethtool_ops commands to get
-+ * the information ethtool needs. We fall back to calling do_ioctl()
-+ * for drivers which haven't been converted to ethtool_ops yet.
-+ *
-+ * It's GPL, stupid.
-+ *
-+ * Modification by sfeldma@pobox.com to work as backward compat
-+ * solution for pre-ethtool_ops kernels.
-+ * - copied struct ethtool_ops from ethtool.h
-+ * - defined SET_ETHTOOL_OPS
-+ * - put in some #ifndef NETIF_F_xxx wrappers
-+ * - changes refs to dev->ethtool_ops to ethtool_ops
-+ * - changed dev_ethtool to ethtool_ioctl
-+ * - remove EXPORT_SYMBOL()s
-+ * - added _kc_ prefix in built-in ethtool_op_xxx ops.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/ethtool.h>
-+#include <linux/netdevice.h>
-+#include <asm/uaccess.h>
-+
-+#ifndef ETH_GSTRING_LEN
-+#define ETH_GSTRING_LEN 32
-+#endif
-+
-+#undef ethtool_ops
-+#define ethtool_ops _kc_ethtool_ops
-+
-+struct _kc_ethtool_ops {
-+ int (*get_settings)(struct net_device *, struct ethtool_cmd *);
-+ int (*set_settings)(struct net_device *, struct ethtool_cmd *);
-+ void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
-+ int (*get_regs_len)(struct net_device *);
-+ void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
-+ void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
-+ int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
-+ u32 (*get_msglevel)(struct net_device *);
-+ void (*set_msglevel)(struct net_device *, u32);
-+ int (*nway_reset)(struct net_device *);
-+ u32 (*get_link)(struct net_device *);
-+ int (*get_eeprom_len)(struct net_device *);
-+ int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
-+ int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
-+ int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
-+ int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
-+ void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
-+ int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
-+ void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
-+ int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
-+ u32 (*get_rx_csum)(struct net_device *);
-+ int (*set_rx_csum)(struct net_device *, u32);
-+ u32 (*get_tx_csum)(struct net_device *);
-+ int (*set_tx_csum)(struct net_device *, u32);
-+ u32 (*get_sg)(struct net_device *);
-+ int (*set_sg)(struct net_device *, u32);
-+ u32 (*get_tso)(struct net_device *);
-+ int (*set_tso)(struct net_device *, u32);
-+ int (*self_test_count)(struct net_device *);
-+ void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
-+ void (*get_strings)(struct net_device *, u32 stringset, u8 *);
-+ int (*phys_id)(struct net_device *, u32);
-+ int (*get_stats_count)(struct net_device *);
-+ void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
-+} *ethtool_ops = NULL;
-+
-+#undef SET_ETHTOOL_OPS
-+#define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops))
-+
-+/*
-+ * Some useful ethtool_ops methods that're device independent.
-+ * If we find that all drivers want to do the same thing here,
-+ * we can turn these into dev_() function calls.
-+ */
-+
-+#undef ethtool_op_get_link
-+#define ethtool_op_get_link _kc_ethtool_op_get_link
-+uint32_t _kc_ethtool_op_get_link(struct net_device *dev)
-+{
-+ return netif_carrier_ok(dev) ? 1 : 0;
-+}
-+
-+#undef ethtool_op_get_tx_csum
-+#define ethtool_op_get_tx_csum _kc_ethtool_op_get_tx_csum
-+uint32_t _kc_ethtool_op_get_tx_csum(struct net_device *dev)
-+{
-+#ifdef NETIF_F_IP_CSUM
-+ return (dev->features & NETIF_F_IP_CSUM) != 0;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+#undef ethtool_op_set_tx_csum
-+#define ethtool_op_set_tx_csum _kc_ethtool_op_set_tx_csum
-+int _kc_ethtool_op_set_tx_csum(struct net_device *dev, uint32_t data)
-+{
-+#ifdef NETIF_F_IP_CSUM
-+ if (data)
-+ dev->features |= NETIF_F_IP_CSUM;
-+ else
-+ dev->features &= ~NETIF_F_IP_CSUM;
-+#endif
-+
-+ return 0;
-+}
-+
-+#undef ethtool_op_get_sg
-+#define ethtool_op_get_sg _kc_ethtool_op_get_sg
-+uint32_t _kc_ethtool_op_get_sg(struct net_device *dev)
-+{
-+#ifdef NETIF_F_SG
-+ return (dev->features & NETIF_F_SG) != 0;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+#undef ethtool_op_set_sg
-+#define ethtool_op_set_sg _kc_ethtool_op_set_sg
-+int _kc_ethtool_op_set_sg(struct net_device *dev, uint32_t data)
-+{
-+#ifdef NETIF_F_SG
-+ if (data)
-+ dev->features |= NETIF_F_SG;
-+ else
-+ dev->features &= ~NETIF_F_SG;
-+#endif
-+
-+ return 0;
-+}
-+
-+#undef ethtool_op_get_tso
-+#define ethtool_op_get_tso _kc_ethtool_op_get_tso
-+uint32_t _kc_ethtool_op_get_tso(struct net_device *dev)
-+{
-+#ifdef NETIF_F_TSO
-+ return (dev->features & NETIF_F_TSO) != 0;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+#undef ethtool_op_set_tso
-+#define ethtool_op_set_tso _kc_ethtool_op_set_tso
-+int _kc_ethtool_op_set_tso(struct net_device *dev, uint32_t data)
-+{
-+#ifdef NETIF_F_TSO
-+ if (data)
-+ dev->features |= NETIF_F_TSO;
-+ else
-+ dev->features &= ~NETIF_F_TSO;
-+#endif
-+
-+ return 0;
-+}
-+
-+/* Handlers for each ethtool command */
-+
-+static int ethtool_get_settings(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_cmd cmd = { ETHTOOL_GSET };
-+ int err;
-+
-+ if (!ethtool_ops->get_settings)
-+ return -EOPNOTSUPP;
-+
-+ err = ethtool_ops->get_settings(dev, &cmd);
-+ if (err < 0)
-+ return err;
-+
-+ if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_settings(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_cmd cmd;
-+
-+ if (!ethtool_ops->set_settings)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_settings(dev, &cmd);
-+}
-+
-+static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_drvinfo info;
-+ struct ethtool_ops *ops = ethtool_ops;
-+
-+ if (!ops->get_drvinfo)
-+ return -EOPNOTSUPP;
-+
-+ memset(&info, 0, sizeof(info));
-+ info.cmd = ETHTOOL_GDRVINFO;
-+ ops->get_drvinfo(dev, &info);
-+
-+ if (ops->self_test_count)
-+ info.testinfo_len = ops->self_test_count(dev);
-+ if (ops->get_stats_count)
-+ info.n_stats = ops->get_stats_count(dev);
-+ if (ops->get_regs_len)
-+ info.regdump_len = ops->get_regs_len(dev);
-+ if (ops->get_eeprom_len)
-+ info.eedump_len = ops->get_eeprom_len(dev);
-+
-+ if (copy_to_user(useraddr, &info, sizeof(info)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_get_regs(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_regs regs;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ void *regbuf;
-+ int reglen, ret;
-+
-+ if (!ops->get_regs || !ops->get_regs_len)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&regs, useraddr, sizeof(regs)))
-+ return -EFAULT;
-+
-+ reglen = ops->get_regs_len(dev);
-+ if (regs.len > reglen)
-+ regs.len = reglen;
-+
-+ regbuf = kmalloc(reglen, GFP_USER);
-+ if (!regbuf)
-+ return -ENOMEM;
-+
-+ ops->get_regs(dev, &regs, regbuf);
-+
-+ ret = -EFAULT;
-+ if (copy_to_user(useraddr, &regs, sizeof(regs)))
-+ goto out;
-+ useraddr += offsetof(struct ethtool_regs, data);
-+ if (copy_to_user(useraddr, regbuf, reglen))
-+ goto out;
-+ ret = 0;
-+
-+out:
-+ kfree(regbuf);
-+ return ret;
-+}
-+
-+static int ethtool_get_wol(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
-+
-+ if (!ethtool_ops->get_wol)
-+ return -EOPNOTSUPP;
-+
-+ ethtool_ops->get_wol(dev, &wol);
-+
-+ if (copy_to_user(useraddr, &wol, sizeof(wol)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_wol(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_wolinfo wol;
-+
-+ if (!ethtool_ops->set_wol)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&wol, useraddr, sizeof(wol)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_wol(dev, &wol);
-+}
-+
-+static int ethtool_get_msglevel(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GMSGLVL };
-+
-+ if (!ethtool_ops->get_msglevel)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_msglevel(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_msglevel(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata;
-+
-+ if (!ethtool_ops->set_msglevel)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
-+ return -EFAULT;
-+
-+ ethtool_ops->set_msglevel(dev, edata.data);
-+ return 0;
-+}
-+
-+static int ethtool_nway_reset(struct net_device *dev)
-+{
-+ if (!ethtool_ops->nway_reset)
-+ return -EOPNOTSUPP;
-+
-+ return ethtool_ops->nway_reset(dev);
-+}
-+
-+static int ethtool_get_link(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GLINK };
-+
-+ if (!ethtool_ops->get_link)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_link(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_eeprom eeprom;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ uint8_t *data;
-+ int ret;
-+
-+ if (!ops->get_eeprom || !ops->get_eeprom_len)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
-+ return -EFAULT;
-+
-+ /* Check for wrap and zero */
-+ if (eeprom.offset + eeprom.len <= eeprom.offset)
-+ return -EINVAL;
-+
-+ /* Check for exceeding total eeprom len */
-+ if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
-+ return -EINVAL;
-+
-+ data = kmalloc(eeprom.len, GFP_USER);
-+ if (!data)
-+ return -ENOMEM;
-+
-+ ret = -EFAULT;
-+ if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
-+ goto out;
-+
-+ ret = ops->get_eeprom(dev, &eeprom, data);
-+ if (ret)
-+ goto out;
-+
-+ ret = -EFAULT;
-+ if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
-+ goto out;
-+ if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
-+ goto out;
-+ ret = 0;
-+
-+out:
-+ kfree(data);
-+ return ret;
-+}
-+
-+static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_eeprom eeprom;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ uint8_t *data;
-+ int ret;
-+
-+ if (!ops->set_eeprom || !ops->get_eeprom_len)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
-+ return -EFAULT;
-+
-+ /* Check for wrap and zero */
-+ if (eeprom.offset + eeprom.len <= eeprom.offset)
-+ return -EINVAL;
-+
-+ /* Check for exceeding total eeprom len */
-+ if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
-+ return -EINVAL;
-+
-+ data = kmalloc(eeprom.len, GFP_USER);
-+ if (!data)
-+ return -ENOMEM;
-+
-+ ret = -EFAULT;
-+ if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
-+ goto out;
-+
-+ ret = ops->set_eeprom(dev, &eeprom, data);
-+ if (ret)
-+ goto out;
-+
-+ if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
-+ ret = -EFAULT;
-+
-+out:
-+ kfree(data);
-+ return ret;
-+}
-+
-+static int ethtool_get_coalesce(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE };
-+
-+ if (!ethtool_ops->get_coalesce)
-+ return -EOPNOTSUPP;
-+
-+ ethtool_ops->get_coalesce(dev, &coalesce);
-+
-+ if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_coalesce(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_coalesce coalesce;
-+
-+ if (!ethtool_ops->get_coalesce)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_coalesce(dev, &coalesce);
-+}
-+
-+static int ethtool_get_ringparam(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM };
-+
-+ if (!ethtool_ops->get_ringparam)
-+ return -EOPNOTSUPP;
-+
-+ ethtool_ops->get_ringparam(dev, &ringparam);
-+
-+ if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_ringparam(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_ringparam ringparam;
-+
-+ if (!ethtool_ops->get_ringparam)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_ringparam(dev, &ringparam);
-+}
-+
-+static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
-+
-+ if (!ethtool_ops->get_pauseparam)
-+ return -EOPNOTSUPP;
-+
-+ ethtool_ops->get_pauseparam(dev, &pauseparam);
-+
-+ if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_pauseparam pauseparam;
-+
-+ if (!ethtool_ops->get_pauseparam)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_pauseparam(dev, &pauseparam);
-+}
-+
-+static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GRXCSUM };
-+
-+ if (!ethtool_ops->get_rx_csum)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_rx_csum(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata;
-+
-+ if (!ethtool_ops->set_rx_csum)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
-+ return -EFAULT;
-+
-+ ethtool_ops->set_rx_csum(dev, edata.data);
-+ return 0;
-+}
-+
-+static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GTXCSUM };
-+
-+ if (!ethtool_ops->get_tx_csum)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_tx_csum(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata;
-+
-+ if (!ethtool_ops->set_tx_csum)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_tx_csum(dev, edata.data);
-+}
-+
-+static int ethtool_get_sg(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GSG };
-+
-+ if (!ethtool_ops->get_sg)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_sg(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_sg(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata;
-+
-+ if (!ethtool_ops->set_sg)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_sg(dev, edata.data);
-+}
-+
-+static int ethtool_get_tso(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata = { ETHTOOL_GTSO };
-+
-+ if (!ethtool_ops->get_tso)
-+ return -EOPNOTSUPP;
-+
-+ edata.data = ethtool_ops->get_tso(dev);
-+
-+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+}
-+
-+static int ethtool_set_tso(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_value edata;
-+
-+ if (!ethtool_ops->set_tso)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->set_tso(dev, edata.data);
-+}
-+
-+static int ethtool_self_test(struct net_device *dev, char *useraddr)
-+{
-+ struct ethtool_test test;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ u64 *data;
-+ int ret;
-+
-+ if (!ops->self_test || !ops->self_test_count)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&test, useraddr, sizeof(test)))
-+ return -EFAULT;
-+
-+ test.len = ops->self_test_count(dev);
-+ data = kmalloc(test.len * sizeof(u64), GFP_USER);
-+ if (!data)
-+ return -ENOMEM;
-+
-+ ops->self_test(dev, &test, data);
-+
-+ ret = -EFAULT;
-+ if (copy_to_user(useraddr, &test, sizeof(test)))
-+ goto out;
-+ useraddr += sizeof(test);
-+ if (copy_to_user(useraddr, data, test.len * sizeof(u64)))
-+ goto out;
-+ ret = 0;
-+
-+out:
-+ kfree(data);
-+ return ret;
-+}
-+
-+static int ethtool_get_strings(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_gstrings gstrings;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ uint8_t *data;
-+ int ret;
-+
-+ if (!ops->get_strings)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
-+ return -EFAULT;
-+
-+ switch (gstrings.string_set) {
-+ case ETH_SS_TEST:
-+ if (!ops->self_test_count)
-+ return -EOPNOTSUPP;
-+ gstrings.len = ops->self_test_count(dev);
-+ break;
-+ case ETH_SS_STATS:
-+ if (!ops->get_stats_count)
-+ return -EOPNOTSUPP;
-+ gstrings.len = ops->get_stats_count(dev);
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
-+ if (!data)
-+ return -ENOMEM;
-+
-+ ops->get_strings(dev, gstrings.string_set, data);
-+
-+ ret = -EFAULT;
-+ if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
-+ goto out;
-+ useraddr += sizeof(gstrings);
-+ if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
-+ goto out;
-+ ret = 0;
-+
-+out:
-+ kfree(data);
-+ return ret;
-+}
-+
-+static int ethtool_phys_id(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_value id;
-+
-+ if (!ethtool_ops->phys_id)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&id, useraddr, sizeof(id)))
-+ return -EFAULT;
-+
-+ return ethtool_ops->phys_id(dev, id.data);
-+}
-+
-+static int ethtool_get_stats(struct net_device *dev, void *useraddr)
-+{
-+ struct ethtool_stats stats;
-+ struct ethtool_ops *ops = ethtool_ops;
-+ u64 *data;
-+ int ret;
-+
-+ if (!ops->get_ethtool_stats || !ops->get_stats_count)
-+ return -EOPNOTSUPP;
-+
-+ if (copy_from_user(&stats, useraddr, sizeof(stats)))
-+ return -EFAULT;
-+
-+ stats.n_stats = ops->get_stats_count(dev);
-+ data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER);
-+ if (!data)
-+ return -ENOMEM;
-+
-+ ops->get_ethtool_stats(dev, &stats, data);
-+
-+ ret = -EFAULT;
-+ if (copy_to_user(useraddr, &stats, sizeof(stats)))
-+ goto out;
-+ useraddr += sizeof(stats);
-+ if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
-+ goto out;
-+ ret = 0;
-+
-+out:
-+ kfree(data);
-+ return ret;
-+}
-+
-+/* The main entry point in this file. Called from net/core/dev.c */
-+
-+#define ETHTOOL_OPS_COMPAT
-+int ethtool_ioctl(struct ifreq *ifr)
-+{
-+ struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
-+ void *useraddr = (void *) ifr->ifr_data;
-+ uint32_t ethcmd;
-+
-+ /*
-+ * XXX: This can be pushed down into the ethtool_* handlers that
-+ * need it. Keep existing behaviour for the moment.
-+ */
-+ if (!dev || !netif_device_present(dev))
-+ return -ENODEV;
-+
-+ if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
-+ return -EFAULT;
-+
-+ switch (ethcmd) {
-+ case ETHTOOL_GSET:
-+ return ethtool_get_settings(dev, useraddr);
-+ case ETHTOOL_SSET:
-+ return ethtool_set_settings(dev, useraddr);
-+ case ETHTOOL_GDRVINFO:
-+ return ethtool_get_drvinfo(dev, useraddr);
-+ case ETHTOOL_GREGS:
-+ return ethtool_get_regs(dev, useraddr);
-+ case ETHTOOL_GWOL:
-+ return ethtool_get_wol(dev, useraddr);
-+ case ETHTOOL_SWOL:
-+ return ethtool_set_wol(dev, useraddr);
-+ case ETHTOOL_GMSGLVL:
-+ return ethtool_get_msglevel(dev, useraddr);
-+ case ETHTOOL_SMSGLVL:
-+ return ethtool_set_msglevel(dev, useraddr);
-+ case ETHTOOL_NWAY_RST:
-+ return ethtool_nway_reset(dev);
-+ case ETHTOOL_GLINK:
-+ return ethtool_get_link(dev, useraddr);
-+ case ETHTOOL_GEEPROM:
-+ return ethtool_get_eeprom(dev, useraddr);
-+ case ETHTOOL_SEEPROM:
-+ return ethtool_set_eeprom(dev, useraddr);
-+ case ETHTOOL_GCOALESCE:
-+ return ethtool_get_coalesce(dev, useraddr);
-+ case ETHTOOL_SCOALESCE:
-+ return ethtool_set_coalesce(dev, useraddr);
-+ case ETHTOOL_GRINGPARAM:
-+ return ethtool_get_ringparam(dev, useraddr);
-+ case ETHTOOL_SRINGPARAM:
-+ return ethtool_set_ringparam(dev, useraddr);
-+ case ETHTOOL_GPAUSEPARAM:
-+ return ethtool_get_pauseparam(dev, useraddr);
-+ case ETHTOOL_SPAUSEPARAM:
-+ return ethtool_set_pauseparam(dev, useraddr);
-+ case ETHTOOL_GRXCSUM:
-+ return ethtool_get_rx_csum(dev, useraddr);
-+ case ETHTOOL_SRXCSUM:
-+ return ethtool_set_rx_csum(dev, useraddr);
-+ case ETHTOOL_GTXCSUM:
-+ return ethtool_get_tx_csum(dev, useraddr);
-+ case ETHTOOL_STXCSUM:
-+ return ethtool_set_tx_csum(dev, useraddr);
-+ case ETHTOOL_GSG:
-+ return ethtool_get_sg(dev, useraddr);
-+ case ETHTOOL_SSG:
-+ return ethtool_set_sg(dev, useraddr);
-+ case ETHTOOL_GTSO:
-+ return ethtool_get_tso(dev, useraddr);
-+ case ETHTOOL_STSO:
-+ return ethtool_set_tso(dev, useraddr);
-+ case ETHTOOL_TEST:
-+ return ethtool_self_test(dev, useraddr);
-+ case ETHTOOL_GSTRINGS:
-+ return ethtool_get_strings(dev, useraddr);
-+ case ETHTOOL_PHYS_ID:
-+ return ethtool_phys_id(dev, useraddr);
-+ case ETHTOOL_GSTATS:
-+ return ethtool_get_stats(dev, useraddr);
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+
-+ return -EOPNOTSUPP;
-+}
diff --git a/openvz-sources/023.030/5126_linux-2.6.9-r8169-2.2.patch-1.patch b/openvz-sources/023.030/5126_linux-2.6.9-r8169-2.2.patch-1.patch
deleted file mode 100644
index 7d96281..0000000
--- a/openvz-sources/023.030/5126_linux-2.6.9-r8169-2.2.patch-1.patch
+++ /dev/null
@@ -1,3485 +0,0 @@
---- ./drivers/net/Kconfig.r8169 2006-09-08 10:52:02.000000000 +0400
-+++ ./drivers/net/Kconfig 2006-09-08 10:57:53.000000000 +0400
-@@ -2032,23 +2032,6 @@ config R8169
- To compile this driver as a module, choose M here: the module
- will be called r8169. This is recommended.
-
--config R8169_NAPI
-- bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)"
-- depends on R8169 && EXPERIMENTAL
-- help
-- NAPI is a new driver API designed to reduce CPU and interrupt load
-- when the driver is receiving lots of packets from the card. It is
-- still somewhat experimental and thus not yet enabled by default.
--
-- If your estimated Rx load is 10kpps or more, or if the card will be
-- deployed on potentially unfriendly networks (e.g. in a firewall),
-- then say Y here.
--
-- See <file:Documentation/networking/NAPI_HOWTO.txt> for more
-- information.
--
-- If in doubt, say N.
--
- config SKGE
- tristate "New SysKonnect GigaEthernet support (EXPERIMENTAL)"
- depends on PCI && EXPERIMENTAL
---- ./drivers/net/r8169.c.r8169 2006-09-07 19:10:41.000000000 +0400
-+++ ./drivers/net/r8169.c 2006-09-07 19:10:53.000000000 +0400
-@@ -1,81 +1,104 @@
- /*
- =========================================================================
-- r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver for Linux kernel 2.4.x.
-+ r8169.c: A RealTek RTL8169s/8110s Gigabit Ethernet driver for Linux kernel 2.4.x.
- --------------------------------------------------------------------
-
- History:
- Feb 4 2002 - created initially by ShuChen <shuchen@realtek.com.tw>.
- May 20 2002 - Add link status force-mode and TBI mode support.
- =========================================================================
-- 1. [DEPRECATED: use ethtool instead] The media can be forced in 5 modes.
-- Command: 'insmod r8169 media = SET_MEDIA'
-- Ex: 'insmod r8169 media = 0x04' will force PHY to operate in 100Mpbs Half-duplex.
--
-- SET_MEDIA can be:
-- _10_Half = 0x01
-- _10_Full = 0x02
-- _100_Half = 0x04
-- _100_Full = 0x08
-- _1000_Full = 0x10
--
-- 2. Support TBI mode.
--=========================================================================
--VERSION 1.1 <2002/10/4>
-+
-+RTL8169_VERSION "1.1" <2002/10/4>
-
- The bit4:0 of MII register 4 is called "selector field", and have to be
- 00001b to indicate support of IEEE std 802.3 during NWay process of
-- exchanging Link Code Word (FLP).
--
--VERSION 1.2 <2002/11/30>
--
-- - Large style cleanup
-- - Use ether_crc in stock kernel (linux/crc32.h)
-- - Copy mc_filter setup code from 8139cp
-- (includes an optimization, and avoids set_bit use)
-+ exchanging Link Code Word (FLP).
-
-+RTL8169_VERSION "1.2" <2003/6/17>
-+ Update driver module name.
-+ Modify ISR.
-+ Add chip mcfg.
-+
-+RTL8169_VERSION "1.3" <2003/6/20>
-+ Add chip pcfg.
-+ Add priv->phy_timer_t, rtl8169_phy_timer_t_handler()
-+ Add rtl8169_hw_PHY_config()
-+ Add rtl8169_hw_PHY_reset()
-+
-+RTL8169_VERSION "1.4" <2003/7/14>
-+ Add tx_bytes, rx_bytes.
-+
-+RTL8169_VERSION "1.5" <2003/7/18>
-+ Set 0x0000 to PHY at offset 0x0b.
-+ Modify chip mcfg, pcfg
-+ Force media for multiple card.
-+RTL8169_VERSION "1.6" <2003/8/25>
-+ Modify receive data buffer.
-+
-+RTL8169_VERSION "1.7" <2003/9/18>
-+ Add Jumbo Frame support.
-+
-+RTL8169_VERSION "1.8" <2003/10/21>
-+ Performance and CPU Utilizaion Enhancement.
-+
-+RTL8169_VERSION "1.9" <2003/12/29>
-+ Enable Tx/Rx flow control.
-+
-+RTL8169_VERSION "2.0" <2004/03/26>
-+ Beta version.
-+ Support for linux 2.6.x
-+
-+RTL8169_VERSION "2.1" <2004/07/05>
-+ Modify parameters.
-+
-+RTL8169_VERSION "2.2" <2004/08/09>
-+ Add.pci_dma_sync_single.
-+ Add pci_alloc_consistent()/pci_free_consistent().
-+ Revise parameters.
-+ Recognize our interrupt for linux 2.6.x.
- */
-
-+
- #include <linux/module.h>
- #include <linux/pci.h>
- #include <linux/netdevice.h>
- #include <linux/etherdevice.h>
- #include <linux/delay.h>
--#include <linux/ethtool.h>
--#include <linux/mii.h>
--#include <linux/crc32.h>
-+#include <linux/version.h>
-+
-+#include <linux/timer.h>
- #include <linux/init.h>
--#include <linux/dma-mapping.h>
-
--#include <asm/io.h>
-
--#define RTL8169_VERSION "1.2"
--#define MODULENAME "r8169"
-+#define RTL8169_VERSION "2.2"
-+#define MODULENAME "RTL8169s/8110s"
- #define RTL8169_DRIVER_NAME MODULENAME " Gigabit Ethernet driver " RTL8169_VERSION
- #define PFX MODULENAME ": "
-
-+
-+#undef RTL8169_DEBUG
-+#undef RTL8169_JUMBO_FRAME_SUPPORT
-+#undef RTL8169_HW_FLOW_CONTROL_SUPPORT
-+
-+
-+#undef RTL8169_IOCTL_SUPPORT
-+#undef RTL8169_DYNAMIC_CONTROL
-+#define RTL8169_USE_IO
-+
-+
- #ifdef RTL8169_DEBUG
--#define assert(expr) \
-- if(!(expr)) { \
-- printk( "Assertion failed! %s,%s,%s,line=%d\n", \
-- #expr,__FILE__,__FUNCTION__,__LINE__); \
-- }
--#define dprintk(fmt, args...) do { printk(PFX fmt, ## args) } while (0)
-+ #define assert(expr) \
-+ if(!(expr)) { printk( "Assertion failed! %s,%s,%s,line=%d\n", #expr,__FILE__,__FUNCTION__,__LINE__); }
-+ #define DBG_PRINT( fmt, args...) printk("r8169: " fmt, ## args);
- #else
--#define assert(expr) do {} while (0)
--#define dprintk(fmt, args...) do {} while (0)
--#endif /* RTL8169_DEBUG */
--
--#ifdef CONFIG_R8169_NAPI
--#define rtl8169_rx_skb netif_receive_skb
--#define rtl8169_rx_quota(count, quota) min(count, quota)
--#else
--#define rtl8169_rx_skb netif_rx
--#define rtl8169_rx_quota(count, quota) count
--#endif
-+ #define assert(expr) do {} while (0)
-+ #define DBG_PRINT( fmt, args...) ;
-+#endif // end of #ifdef RTL8169_DEBUG
-+
-
- /* media options */
- #define MAX_UNITS 8
--static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
-+static int media[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-
- /* Maximum events (Rx packets, etc.) to handle at each interrupt. */
- static int max_interrupt_work = 20;
-@@ -85,150 +108,158 @@ static int max_interrupt_work = 20;
- static int multicast_filter_limit = 32;
-
- /* MAC address length*/
--#define MAC_ADDR_LEN 6
-+#define MAC_ADDR_LEN 6
-+
-+#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
-+#define RX_DMA_BURST 7 /* Maximum PCI burst, '6' is 1024 */
-+#define TX_DMA_BURST 7 /* Maximum PCI burst, '6' is 1024 */
-+#define ETTh 0x3F /* 0x3F means NO threshold */
-
--/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/
--#define MAX_ETH_FRAME_SIZE 1536
-+#define ETH_HDR_LEN 14
-+#define DEFAULT_MTU 1500
-+#define DEFAULT_RX_BUF_LEN 1536
-
--#define TX_FIFO_THRESH 256 /* In bytes */
-
--#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
--#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
--#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
--#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */
--#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */
--#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
--
--#define R8169_NAPI_WEIGHT 64
--#define NUM_TX_DESC 64 /* Number of Tx descriptor registers */
--#define NUM_RX_DESC 256 /* Number of Rx descriptor registers */
--#define RX_BUF_SIZE 1536 /* Rx Buffer size */
--#define R8169_TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc))
--#define R8169_RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc))
--
--#define RTL_MIN_IO_SIZE 0x80
--#define RTL8169_TX_TIMEOUT (6*HZ)
--#define RTL8169_PHY_TIMEOUT (10*HZ)
-+#ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+#define MAX_JUMBO_FRAME_MTU ( 10000 )
-+#define MAX_RX_SKBDATA_SIZE ( MAX_JUMBO_FRAME_MTU + ETH_HDR_LEN )
-+#else
-+#define MAX_RX_SKBDATA_SIZE 1600
-+#endif //end #ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+
-+
-+#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
-+
-+//#define NUM_TX_DESC 64 /* Number of Tx descriptor registers*/
-+//#define NUM_RX_DESC 64 /* Number of Rx descriptor registers*/
-+#define NUM_TX_DESC 1024 /* Number of Tx descriptor registers*/
-+#define NUM_RX_DESC 1024 /* Number of Rx descriptor registers*/
-
-+#define RTL_MIN_IO_SIZE 0x80
-+#define TX_TIMEOUT (6*HZ)
-+#define RTL8169_TIMER_EXPIRE_TIME 100 //100
-+
-+
-+#ifdef RTL8169_USE_IO
-+#define RTL_W8(reg, val8) outb ((val8), ioaddr + (reg))
-+#define RTL_W16(reg, val16) outw ((val16), ioaddr + (reg))
-+#define RTL_W32(reg, val32) outl ((val32), ioaddr + (reg))
-+#define RTL_R8(reg) inb (ioaddr + (reg))
-+#define RTL_R16(reg) inw (ioaddr + (reg))
-+#define RTL_R32(reg) ((unsigned long) inl (ioaddr + (reg)))
-+#else
- /* write/read MMIO register */
--#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
--#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
--#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
--#define RTL_R8(reg) readb (ioaddr + (reg))
--#define RTL_R16(reg) readw (ioaddr + (reg))
--#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
--
--enum mac_version {
-- RTL_GIGA_MAC_VER_B = 0x00,
-- /* RTL_GIGA_MAC_VER_C = 0x03, */
-- RTL_GIGA_MAC_VER_D = 0x01,
-- RTL_GIGA_MAC_VER_E = 0x02
--};
-+#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
-+#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
-+#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
-+#define RTL_R8(reg) readb (ioaddr + (reg))
-+#define RTL_R16(reg) readw (ioaddr + (reg))
-+#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
-+#endif
-
--enum phy_version {
-- RTL_GIGA_PHY_VER_C = 0x03, /* PHY Reg 0x03 bit0-3 == 0x0000 */
-- RTL_GIGA_PHY_VER_D = 0x04, /* PHY Reg 0x03 bit0-3 == 0x0000 */
-- RTL_GIGA_PHY_VER_E = 0x05, /* PHY Reg 0x03 bit0-3 == 0x0000 */
-- RTL_GIGA_PHY_VER_F = 0x06, /* PHY Reg 0x03 bit0-3 == 0x0001 */
-- RTL_GIGA_PHY_VER_G = 0x07, /* PHY Reg 0x03 bit0-3 == 0x0002 */
--};
-+#define MCFG_METHOD_1 0x01
-+#define MCFG_METHOD_2 0x02
-+#define MCFG_METHOD_3 0x03
-+#define MCFG_METHOD_4 0x04
-+
-+#define PCFG_METHOD_1 0x01 //PHY Reg 0x03 bit0-3 == 0x0000
-+#define PCFG_METHOD_2 0x02 //PHY Reg 0x03 bit0-3 == 0x0001
-+#define PCFG_METHOD_3 0x03 //PHY Reg 0x03 bit0-3 == 0x0002
-
-
--#define _R(NAME,MAC,MASK) \
-- { .name = NAME, .mac_version = MAC, .RxConfigMask = MASK }
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+#include "r8169_callback.h"
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-+
-
- const static struct {
- const char *name;
-- u8 mac_version;
-- u32 RxConfigMask; /* Clears the bits supported by this chip */
-+ u8 mcfg; /* depend on RTL8169 docs */
-+ u32 RxConfigMask; /* should clear the bits supported by this chip */
- } rtl_chip_info[] = {
-- _R("RTL8169", RTL_GIGA_MAC_VER_B, 0xff7e1880),
-- _R("RTL8169s/8110s", RTL_GIGA_MAC_VER_D, 0xff7e1880),
-- _R("RTL8169s/8110s", RTL_GIGA_MAC_VER_E, 0xff7e1880)
-+ { "RTL8169", MCFG_METHOD_1, 0xff7e1880 },
-+ { "RTL8169s/8110s", MCFG_METHOD_2, 0xff7e1880 },
-+ { "RTL8169s/8110s", MCFG_METHOD_3, 0xff7e1880 },
- };
--#undef _R
-
--static struct pci_device_id rtl8169_pci_tbl[] = {
-- {0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-+
-+static struct pci_device_id rtl8169_pci_tbl[] __devinitdata = {
-+ { 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
- {0,},
- };
-
--MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);
-
--static int rx_copybreak = 200;
--static int use_dac;
-+MODULE_DEVICE_TABLE (pci, rtl8169_pci_tbl);
-+
-
- enum RTL8169_registers {
-- MAC0 = 0, /* Ethernet hardware address. */
-- MAR0 = 8, /* Multicast filter. */
-- TxDescStartAddrLow = 0x20,
-- TxDescStartAddrHigh = 0x24,
-- TxHDescStartAddrLow = 0x28,
-- TxHDescStartAddrHigh = 0x2c,
-- FLASH = 0x30,
-- ERSR = 0x36,
-- ChipCmd = 0x37,
-- TxPoll = 0x38,
-+ MAC0 = 0x0,
-+ MAR0 = 0x8,
-+ TxDescStartAddr = 0x20,
-+ TxHDescStartAddr= 0x28,
-+ FLASH = 0x30,
-+ ERSR = 0x36,
-+ ChipCmd = 0x37,
-+ TxPoll = 0x38,
- IntrMask = 0x3C,
- IntrStatus = 0x3E,
- TxConfig = 0x40,
- RxConfig = 0x44,
- RxMissed = 0x4C,
- Cfg9346 = 0x50,
-- Config0 = 0x51,
-- Config1 = 0x52,
-- Config2 = 0x53,
-- Config3 = 0x54,
-- Config4 = 0x55,
-- Config5 = 0x56,
-+ Config0 = 0x51,
-+ Config1 = 0x52,
-+ Config2 = 0x53,
-+ Config3 = 0x54,
-+ Config4 = 0x55,
-+ Config5 = 0x56,
- MultiIntr = 0x5C,
-- PHYAR = 0x60,
-- TBICSR = 0x64,
-+ PHYAR = 0x60,
-+ TBICSR = 0x64,
- TBI_ANAR = 0x68,
- TBI_LPAR = 0x6A,
- PHYstatus = 0x6C,
- RxMaxSize = 0xDA,
- CPlusCmd = 0xE0,
-- RxDescAddrLow = 0xE4,
-- RxDescAddrHigh = 0xE8,
-- EarlyTxThres = 0xEC,
-- FuncEvent = 0xF0,
-- FuncEventMask = 0xF4,
-- FuncPresetState = 0xF8,
-- FuncForceEvent = 0xFC,
-+ RxDescStartAddr = 0xE4,
-+ ETThReg = 0xEC,
-+ FuncEvent = 0xF0,
-+ FuncEventMask = 0xF4,
-+ FuncPresetState = 0xF8,
-+ FuncForceEvent = 0xFC,
- };
-
- enum RTL8169_register_content {
-- /*InterruptStatusBits */
-- SYSErr = 0x8000,
-- PCSTimeout = 0x4000,
-- SWInt = 0x0100,
-- TxDescUnavail = 0x80,
-- RxFIFOOver = 0x40,
-- LinkChg = 0x20,
-- RxOverflow = 0x10,
-- TxErr = 0x08,
-- TxOK = 0x04,
-- RxErr = 0x02,
-- RxOK = 0x01,
-+ /*InterruptStatusBits*/
-+ SYSErr = 0x8000,
-+ PCSTimeout = 0x4000,
-+ SWInt = 0x0100,
-+ TxDescUnavail = 0x80,
-+ RxFIFOOver = 0x40,
-+ LinkChg = 0x20,
-+ RxOverflow = 0x10,
-+ TxErr = 0x08,
-+ TxOK = 0x04,
-+ RxErr = 0x02,
-+ RxOK = 0x01,
-
-- /*RxStatusDesc */
-+ /*RxStatusDesc*/
- RxRES = 0x00200000,
- RxCRC = 0x00080000,
-- RxRUNT = 0x00100000,
-+ RxRUNT= 0x00100000,
- RxRWT = 0x00400000,
-
-- /*ChipCmdBits */
-+ /*ChipCmdBits*/
- CmdReset = 0x10,
- CmdRxEnb = 0x08,
- CmdTxEnb = 0x04,
- RxBufEmpty = 0x01,
-
-- /*Cfg9346Bits */
-+ /*Cfg9346Bits*/
- Cfg9346_Lock = 0x00,
- Cfg9346_Unlock = 0xC0,
-
-- /*rx_mode_bits */
-+ /*rx_mode_bits*/
- AcceptErr = 0x20,
- AcceptRunt = 0x10,
- AcceptBroadcast = 0x08,
-@@ -236,1743 +267,1689 @@ enum RTL8169_register_content {
- AcceptMyPhys = 0x02,
- AcceptAllPhys = 0x01,
-
-- /*RxConfigBits */
-+ /*RxConfigBits*/
- RxCfgFIFOShift = 13,
- RxCfgDMAShift = 8,
-
-- /*TxConfigBits */
-+ /*TxConfigBits*/
- TxInterFrameGapShift = 24,
-- TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */
-+ TxDMAShift = 8,
-
-- /* TBICSR p.28 */
-- TBIReset = 0x80000000,
-- TBILoopback = 0x40000000,
-- TBINwEnable = 0x20000000,
-- TBINwRestart = 0x10000000,
-- TBILinkOk = 0x02000000,
-- TBINwComplete = 0x01000000,
--
-- /* CPlusCmd p.31 */
-- RxVlan = (1 << 6),
-- RxChkSum = (1 << 5),
-- PCIDAC = (1 << 4),
-- PCIMulRW = (1 << 3),
--
-- /*rtl8169_PHYstatus */
-- TBI_Enable = 0x80,
-- TxFlowCtrl = 0x40,
-- RxFlowCtrl = 0x20,
-- _1000bpsF = 0x10,
-- _100bps = 0x08,
-- _10bps = 0x04,
-- LinkStatus = 0x02,
-- FullDup = 0x01,
-+ /*rtl8169_PHYstatus*/
-+ TBI_Enable = 0x80,
-+ TxFlowCtrl = 0x40,
-+ RxFlowCtrl = 0x20,
-+ _1000bpsF = 0x10,
-+ _100bps = 0x08,
-+ _10bps = 0x04,
-+ LinkStatus = 0x02,
-+ FullDup = 0x01,
-
-- /*GIGABIT_PHY_registers */
-+ /*GIGABIT_PHY_registers*/
- PHY_CTRL_REG = 0,
- PHY_STAT_REG = 1,
- PHY_AUTO_NEGO_REG = 4,
- PHY_1000_CTRL_REG = 9,
-
-- /*GIGABIT_PHY_REG_BIT */
-- PHY_Restart_Auto_Nego = 0x0200,
-- PHY_Enable_Auto_Nego = 0x1000,
-+ /*GIGABIT_PHY_REG_BIT*/
-+ PHY_Restart_Auto_Nego = 0x0200,
-+ PHY_Enable_Auto_Nego = 0x1000,
-
- //PHY_STAT_REG = 1;
-- PHY_Auto_Neco_Comp = 0x0020,
-+ PHY_Auto_Neco_Comp = 0x0020,
-
- //PHY_AUTO_NEGO_REG = 4;
-- PHY_Cap_10_Half = 0x0020,
-- PHY_Cap_10_Full = 0x0040,
-- PHY_Cap_100_Half = 0x0080,
-- PHY_Cap_100_Full = 0x0100,
-+ PHY_Cap_10_Half = 0x0020,
-+ PHY_Cap_10_Full = 0x0040,
-+ PHY_Cap_100_Half = 0x0080,
-+ PHY_Cap_100_Full = 0x0100,
-
- //PHY_1000_CTRL_REG = 9;
-- PHY_Cap_1000_Full = 0x0200,
-+ PHY_Cap_1000_Full = 0x0200,
-+ PHY_Cap_1000_Half = 0x0100,
-+
-+ PHY_Cap_PAUSE = 0x0400,
-+ PHY_Cap_ASYM_PAUSE = 0x0800,
-
-- PHY_Cap_Null = 0x0,
-+ PHY_Cap_Null = 0x0,
-
- /*_MediaType*/
-- _10_Half = 0x01,
-- _10_Full = 0x02,
-- _100_Half = 0x04,
-- _100_Full = 0x08,
-- _1000_Full = 0x10,
-+ _10_Half = 0x01,
-+ _10_Full = 0x02,
-+ _100_Half = 0x04,
-+ _100_Full = 0x08,
-+ _1000_Full = 0x10,
-
- /*_TBICSRBit*/
-- TBILinkOK = 0x02000000,
-+ TBILinkOK = 0x02000000,
- };
-
-+
-+
- enum _DescStatusBit {
-- OWNbit = 0x80000000,
-- EORbit = 0x40000000,
-- FSbit = 0x20000000,
-- LSbit = 0x10000000,
-+ OWNbit = 0x80000000,
-+ EORbit = 0x40000000,
-+ FSbit = 0x20000000,
-+ LSbit = 0x10000000,
- };
-
--#define RsvdMask 0x3fffc000
-
- struct TxDesc {
-- u32 status;
-- u32 vlan_tag;
-- u64 addr;
-+ u32 status;
-+ u32 vlan_tag;
-+ u32 buf_addr;
-+ u32 buf_Haddr;
- };
-
- struct RxDesc {
-- u32 status;
-- u32 vlan_tag;
-- u64 addr;
-+ u32 status;
-+ u32 vlan_tag;
-+ u32 buf_addr;
-+ u32 buf_Haddr;
- };
-
-+
-+typedef struct timer_list rt_timer_t;
-+
-+
- struct rtl8169_private {
-- void *mmio_addr; /* memory map physical address */
-- struct pci_dev *pci_dev; /* Index of PCI device */
-- struct net_device_stats stats; /* statistics of net device */
-- spinlock_t lock; /* spin lock flag */
-+ unsigned long ioaddr; /* memory map physical address*/
-+ struct pci_dev *pci_dev; /* Index of PCI device */
-+ struct net_device_stats stats; /* statistics of net device */
-+ spinlock_t lock; /* spin lock flag */
- int chipset;
-- int mac_version;
-- int phy_version;
-- u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
-- u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
-- u32 dirty_rx;
-- u32 dirty_tx;
-- struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */
-- struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */
-- dma_addr_t TxPhyAddr;
-- dma_addr_t RxPhyAddr;
-- struct sk_buff *Rx_skbuff[NUM_RX_DESC]; /* Rx data buffers */
-- struct sk_buff *Tx_skbuff[NUM_TX_DESC]; /* Tx data buffers */
-- struct timer_list timer;
-- u16 cp_cmd;
-- u16 intr_mask;
-- int phy_auto_nego_reg;
-- int phy_1000_ctrl_reg;
--
-- int (*set_speed)(struct net_device *, u8 autoneg, u16 speed, u8 duplex);
-- void (*get_settings)(struct net_device *, struct ethtool_cmd *);
-- void (*phy_reset_enable)(void *);
-- unsigned int (*phy_reset_pending)(void *);
-- unsigned int (*link_ok)(void *);
-+ int mcfg;
-+ int pcfg;
-+ rt_timer_t r8169_timer;
-+ unsigned long expire_time;
-+
-+ unsigned long phy_link_down_cnt;
-+ unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
-+ unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
-+ unsigned long dirty_tx;
-+ struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
-+ struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
-+ struct sk_buff *Tx_skbuff[NUM_TX_DESC];/* Index of Transmit data buffer */
-+ struct sk_buff *Rx_skbuff[NUM_RX_DESC];/* Receive data buffer */
-+ unsigned char drvinit_fail;
-+
-+ dma_addr_t txdesc_array_dma_addr[NUM_TX_DESC];
-+ dma_addr_t rxdesc_array_dma_addr[NUM_RX_DESC];
-+ dma_addr_t rx_skbuff_dma_addr[NUM_RX_DESC];
-+
-+ void *txdesc_space;
-+ dma_addr_t txdesc_phy_dma_addr;
-+ int sizeof_txdesc_space;
-+
-+ void *rxdesc_space;
-+ dma_addr_t rxdesc_phy_dma_addr;
-+ int sizeof_rxdesc_space;
-+
-+ int curr_mtu_size;
-+ int tx_pkt_len;
-+ int rx_pkt_len;
-+
-+ int hw_rx_pkt_len;
-+
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+ struct r8169_cb_t rt;
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-+
-+ unsigned char linkstatus;
- };
-
--MODULE_AUTHOR("Realtek");
--MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");
--MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "i");
--MODULE_PARM(rx_copybreak, "i");
--MODULE_PARM(use_dac, "i");
--MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");
-+
-+MODULE_AUTHOR ("Realtek");
-+MODULE_DESCRIPTION ("RealTek RTL-8169 Gigabit Ethernet driver");
-+MODULE_PARM (media, "1-" __MODULE_STRING(MAX_UNITS) "i");
- MODULE_LICENSE("GPL");
--MODULE_VERSION(RTL8169_VERSION);
-
--static int rtl8169_open(struct net_device *dev);
--static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev);
--static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance,
-- struct pt_regs *regs);
--static int rtl8169_init_ring(struct net_device *dev);
--static void rtl8169_hw_start(struct net_device *dev);
--static int rtl8169_close(struct net_device *dev);
--static void rtl8169_set_rx_mode(struct net_device *dev);
--static void rtl8169_tx_timeout(struct net_device *dev);
--static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev);
--#ifdef CONFIG_R8169_NAPI
--static int rtl8169_poll(struct net_device *dev, int *budget);
--#endif
-
--static const u16 rtl8169_intr_mask =
-- SYSErr | LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK;
--static const u16 rtl8169_napi_event =
-- RxOK | RxOverflow | RxFIFOOver | TxOK | TxErr;
--static const unsigned int rtl8169_rx_config =
-- (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
--
--#define PHY_Cap_10_Half_Or_Less PHY_Cap_10_Half
--#define PHY_Cap_10_Full_Or_Less PHY_Cap_10_Full | PHY_Cap_10_Half_Or_Less
--#define PHY_Cap_100_Half_Or_Less PHY_Cap_100_Half | PHY_Cap_10_Full_Or_Less
--#define PHY_Cap_100_Full_Or_Less PHY_Cap_100_Full | PHY_Cap_100_Half_Or_Less
-+static int rtl8169_open (struct net_device *dev);
-+static int rtl8169_start_xmit (struct sk_buff *skb, struct net_device *dev);
-
--static void mdio_write(void *ioaddr, int RegAddr, int value)
--{
-- int i;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+typedef int irqreturn_t;
-+#define IRQ_NONE 0
-+#define IRQ_HANDLED 1
-+static void rtl8169_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
-+#else
-+static irqreturn_t rtl8169_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
-+#endif
-
-- RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
-- udelay(1000);
-+static void rtl8169_init_ring (struct net_device *dev);
-+static void rtl8169_hw_start (struct net_device *dev);
-+static int rtl8169_close (struct net_device *dev);
-+static inline u32 ether_crc (int length, unsigned char *data);
-+static void rtl8169_set_rx_mode (struct net_device *dev);
-+static void rtl8169_tx_timeout (struct net_device *dev);
-+static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev);
-
-- for (i = 2000; i > 0; i--) {
-- // Check if the RTL8169 has completed writing to the specified MII register
-- if (!(RTL_R32(PHYAR) & 0x80000000))
-- break;
-- udelay(100);
-- }
-+#ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+static int rtl8169_change_mtu(struct net_device *dev, int new_mtu);
-+#endif //end #ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+
-+static void rtl8169_hw_PHY_config (struct net_device *dev);
-+static void rtl8169_hw_PHY_reset(struct net_device *dev);
-+static const u16 rtl8169_intr_mask = LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK ;
-+static const unsigned int rtl8169_rx_config = (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift) | 0x0000000E;
-+
-+
-+#define RTL8169_WRITE_GMII_REG_BIT( ioaddr, reg, bitnum, bitval )\
-+{ \
-+ int val; \
-+ if( bitval == 1 ){ val = ( RTL8169_READ_GMII_REG( ioaddr, reg ) | (bitval<<bitnum) ) & 0xffff ; } \
-+ else{ val = ( RTL8169_READ_GMII_REG( ioaddr, reg ) & (~(0x0001<<bitnum)) ) & 0xffff ; } \
-+ RTL8169_WRITE_GMII_REG( ioaddr, reg, val ); \
- }
-
--static int mdio_read(void *ioaddr, int RegAddr)
--{
-- int i, value = -1;
--
-- RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
-- udelay(1000);
--
-- for (i = 2000; i > 0; i--) {
-- // Check if the RTL8169 has completed retrieving data from the specified MII register
-- if (RTL_R32(PHYAR) & 0x80000000) {
-- value = (int) (RTL_R32(PHYAR) & 0xFFFF);
-- break;
-- }
-- udelay(100);
-- }
-- return value;
--}
-
--static unsigned int rtl8169_tbi_reset_pending(void *ioaddr)
--{
-- return RTL_R32(TBICSR) & TBIReset;
--}
-
--static unsigned int rtl8169_xmii_reset_pending(void *ioaddr)
--{
-- return mdio_read(ioaddr, 0) & 0x8000;
--}
-+#ifdef RTL8169_DEBUG
-+unsigned alloc_rxskb_cnt = 0;
-+#define RTL8169_ALLOC_RXSKB(bufsize) dev_alloc_skb(bufsize); alloc_rxskb_cnt ++ ;
-+#define RTL8169_FREE_RXSKB(skb) kfree_skb(skb); alloc_rxskb_cnt -- ;
-+#define RTL8169_NETIF_RX(skb) netif_rx(skb); alloc_rxskb_cnt -- ;
-+#else
-+#define RTL8169_ALLOC_RXSKB(bufsize) dev_alloc_skb(bufsize);
-+#define RTL8169_FREE_RXSKB(skb) kfree_skb(skb);
-+#define RTL8169_NETIF_RX(skb) netif_rx(skb);
-+#endif //end #ifdef RTL8169_DEBUG
-
--static unsigned int rtl8169_tbi_link_ok(void *ioaddr)
--{
-- return RTL_R32(TBICSR) & TBILinkOk;
--}
-
--static unsigned int rtl8169_xmii_link_ok(void *ioaddr)
--{
-- return RTL_R8(PHYstatus) & LinkStatus;
--}
-
--static void rtl8169_tbi_reset_enable(void *ioaddr)
--{
-- RTL_W32(TBICSR, RTL_R32(TBICSR) | TBIReset);
--}
-
--static void rtl8169_xmii_reset_enable(void *ioaddr)
--{
-- unsigned int val;
-
-- val = (mdio_read(ioaddr, PHY_CTRL_REG) | 0x8000) & 0xffff;
-- mdio_write(ioaddr, PHY_CTRL_REG, val);
--}
-
--static void rtl8169_check_link_status(struct net_device *dev,
-- struct rtl8169_private *tp, void *ioaddr)
-+//=================================================================
-+// PHYAR
-+// bit Symbol
-+// 31 Flag
-+// 30-21 reserved
-+// 20-16 5-bit GMII/MII register address
-+// 15-0 16-bit GMII/MII register data
-+//=================================================================
-+void RTL8169_WRITE_GMII_REG( unsigned long ioaddr, int RegAddr, int value )
- {
-- unsigned long flags;
-+ int i;
-
-- spin_lock_irqsave(&tp->lock, flags);
-- if (tp->link_ok(ioaddr)) {
-- netif_carrier_on(dev);
-- printk(KERN_INFO PFX "%s: link up\n", dev->name);
-- } else
-- netif_carrier_off(dev);
-- spin_unlock_irqrestore(&tp->lock, flags);
--}
--
--static void rtl8169_link_option(int idx, u8 *autoneg, u16 *speed, u8 *duplex)
--{
-- struct {
-- u16 speed;
-- u8 duplex;
-- u8 autoneg;
-- u8 media;
-- } link_settings[] = {
-- { SPEED_10, DUPLEX_HALF, AUTONEG_DISABLE, _10_Half },
-- { SPEED_10, DUPLEX_FULL, AUTONEG_DISABLE, _10_Full },
-- { SPEED_100, DUPLEX_HALF, AUTONEG_DISABLE, _100_Half },
-- { SPEED_100, DUPLEX_FULL, AUTONEG_DISABLE, _100_Full },
-- { SPEED_1000, DUPLEX_FULL, AUTONEG_DISABLE, _1000_Full },
-- /* Make TBI happy */
-- { SPEED_1000, DUPLEX_FULL, AUTONEG_ENABLE, 0xff }
-- }, *p;
-- unsigned char option;
--
-- option = ((idx < MAX_UNITS) && (idx >= 0)) ? media[idx] : 0xff;
--
-- if ((option != 0xff) && !idx)
-- printk(KERN_WARNING PFX "media option is deprecated.\n");
-+ RTL_W32 ( PHYAR, 0x80000000 | (RegAddr&0xFF)<<16 | value);
-+ udelay(1000);
-
-- for (p = link_settings; p->media != 0xff; p++) {
-- if (p->media == option)
-+ for( i = 2000; i > 0 ; i -- ){
-+ // Check if the RTL8169 has completed writing to the specified MII register
-+ if( ! (RTL_R32(PHYAR)&0x80000000) ){
- break;
-- }
-- *autoneg = p->autoneg;
-- *speed = p->speed;
-- *duplex = p->duplex;
--}
--
--static void rtl8169_get_drvinfo(struct net_device *dev,
-- struct ethtool_drvinfo *info)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
--
-- strcpy(info->driver, RTL8169_DRIVER_NAME);
-- strcpy(info->version, RTL8169_VERSION );
-- strcpy(info->bus_info, pci_name(tp->pci_dev));
-+ }
-+ else{
-+ udelay(100);
-+ }// end of if( ! (RTL_R32(PHYAR)&0x80000000) )
-+ }// end of for() loop
- }
--
--static int rtl8169_set_speed_tbi(struct net_device *dev,
-- u8 autoneg, u16 speed, u8 duplex)
-+//=================================================================
-+int RTL8169_READ_GMII_REG( unsigned long ioaddr, int RegAddr )
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- int ret = 0;
-- u32 reg;
-+ int i, value = -1;
-
-- reg = RTL_R32(TBICSR);
-- if ((autoneg == AUTONEG_DISABLE) && (speed == SPEED_1000) &&
-- (duplex == DUPLEX_FULL)) {
-- RTL_W32(TBICSR, reg & ~(TBINwEnable | TBINwRestart));
-- } else if (autoneg == AUTONEG_ENABLE)
-- RTL_W32(TBICSR, reg | TBINwEnable | TBINwRestart);
-- else {
-- printk(KERN_WARNING PFX
-- "%s: incorrect speed setting refused in TBI mode\n",
-- dev->name);
-- ret = -EOPNOTSUPP;
-- }
-+ RTL_W32 ( PHYAR, 0x0 | (RegAddr&0xFF)<<16 );
-+ udelay(1000);
-
-- return ret;
-+ for( i = 2000; i > 0 ; i -- ){
-+ // Check if the RTL8169 has completed retrieving data from the specified MII register
-+ if( RTL_R32(PHYAR) & 0x80000000 ){
-+ value = (int)( RTL_R32(PHYAR)&0xFFFF );
-+ break;
-+ }
-+ else{
-+ udelay(100);
-+ }// end of if( RTL_R32(PHYAR) & 0x80000000 )
-+ }// end of for() loop
-+ return value;
- }
-
--static int rtl8169_set_speed_xmii(struct net_device *dev,
-- u8 autoneg, u16 speed, u8 duplex)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- int auto_nego, giga_ctrl;
-
-- auto_nego = mdio_read(ioaddr, PHY_AUTO_NEGO_REG);
-- auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_10_Full |
-- PHY_Cap_100_Half | PHY_Cap_100_Full);
-- giga_ctrl = mdio_read(ioaddr, PHY_1000_CTRL_REG);
-- giga_ctrl &= ~(PHY_Cap_1000_Full | PHY_Cap_Null);
-+#ifdef RTL8169_IOCTL_SUPPORT
-+#include "r8169_ioctl.c"
-+#endif //end #ifdef RTL8169_IOCTL_SUPPORT
-
-- if (autoneg == AUTONEG_ENABLE) {
-- auto_nego |= (PHY_Cap_10_Half | PHY_Cap_10_Full |
-- PHY_Cap_100_Half | PHY_Cap_100_Full);
-- giga_ctrl |= PHY_Cap_1000_Full;
-- } else {
-- if (speed == SPEED_10)
-- auto_nego |= PHY_Cap_10_Half | PHY_Cap_10_Full;
-- else if (speed == SPEED_100)
-- auto_nego |= PHY_Cap_100_Half | PHY_Cap_100_Full;
-- else if (speed == SPEED_1000)
-- giga_ctrl |= PHY_Cap_1000_Full;
--
-- if (duplex == DUPLEX_HALF)
-- auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full);
-- }
--
-- tp->phy_auto_nego_reg = auto_nego;
-- tp->phy_1000_ctrl_reg = giga_ctrl;
--
-- mdio_write(ioaddr, PHY_AUTO_NEGO_REG, auto_nego);
-- mdio_write(ioaddr, PHY_1000_CTRL_REG, giga_ctrl);
-- mdio_write(ioaddr, PHY_CTRL_REG, PHY_Enable_Auto_Nego |
-- PHY_Restart_Auto_Nego);
-- return 0;
--}
-
--static int rtl8169_set_speed(struct net_device *dev,
-- u8 autoneg, u16 speed, u8 duplex)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- int ret;
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+#include "r8169_callback.c"
-+#endif
-
-- ret = tp->set_speed(dev, autoneg, speed, duplex);
-
-- if (netif_running(dev) && (tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full))
-- mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT);
-
-- return ret;
-+#define rtl8169_request_timer( timer, timer_expires, timer_func, timer_data ) \
-+{ \
-+ init_timer(timer); \
-+ timer->expires = (unsigned long)(jiffies + timer_expires); \
-+ timer->data = (unsigned long)(timer_data); \
-+ timer->function = (void *)(timer_func); \
-+ add_timer(timer); \
-+ DBG_PRINT("request_timer at 0x%08lx\n", (unsigned long)timer); \
- }
-
--static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- unsigned long flags;
-- int ret;
--
-- spin_lock_irqsave(&tp->lock, flags);
-- ret = rtl8169_set_speed(dev, cmd->autoneg, cmd->speed, cmd->duplex);
-- spin_unlock_irqrestore(&tp->lock, flags);
--
-- return ret;
-+#define rtl8169_delete_timer( del_timer_t ) \
-+{ \
-+ del_timer(del_timer_t); \
-+ DBG_PRINT("delete_timer at 0x%08lx\n", (unsigned long)del_timer_t); \
- }
-
--static void rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- u32 status;
--
-- cmd->supported =
-- SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | SUPPORTED_FIBRE;
-- cmd->port = PORT_FIBRE;
-- cmd->transceiver = XCVR_INTERNAL;
--
-- status = RTL_R32(TBICSR);
-- cmd->advertising = (status & TBINwEnable) ? ADVERTISED_Autoneg : 0;
-- cmd->autoneg = !!(status & TBINwEnable);
--
-- cmd->speed = SPEED_1000;
-- cmd->duplex = DUPLEX_FULL; /* Always set */
-+#define rtl8169_mod_timer( timer, timer_expires ) \
-+{ \
-+ mod_timer( timer, jiffies + timer_expires ); \
- }
-
--static void rtl8169_gset_xmii(struct net_device *dev, struct ethtool_cmd *cmd)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- u8 status;
--
-- cmd->supported = SUPPORTED_10baseT_Half |
-- SUPPORTED_10baseT_Full |
-- SUPPORTED_100baseT_Half |
-- SUPPORTED_100baseT_Full |
-- SUPPORTED_1000baseT_Full |
-- SUPPORTED_Autoneg |
-- SUPPORTED_TP;
-
-- cmd->autoneg = 1;
-- cmd->advertising = ADVERTISED_TP | ADVERTISED_Autoneg;
-
-- if (tp->phy_auto_nego_reg & PHY_Cap_10_Half)
-- cmd->advertising |= ADVERTISED_10baseT_Half;
-- if (tp->phy_auto_nego_reg & PHY_Cap_10_Full)
-- cmd->advertising |= ADVERTISED_10baseT_Full;
-- if (tp->phy_auto_nego_reg & PHY_Cap_100_Half)
-- cmd->advertising |= ADVERTISED_100baseT_Half;
-- if (tp->phy_auto_nego_reg & PHY_Cap_100_Full)
-- cmd->advertising |= ADVERTISED_100baseT_Full;
-- if (tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full)
-- cmd->advertising |= ADVERTISED_1000baseT_Full;
-
-- status = RTL_R8(PHYstatus);
--
-- if (status & _1000bpsF)
-- cmd->speed = SPEED_1000;
-- else if (status & _100bps)
-- cmd->speed = SPEED_100;
-- else if (status & _10bps)
-- cmd->speed = SPEED_10;
--
-- cmd->duplex = ((status & _1000bpsF) || (status & FullDup)) ?
-- DUPLEX_FULL : DUPLEX_HALF;
--}
--
--static int rtl8169_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-+//======================================================================================================
-+//======================================================================================================
-+void rtl8169_phy_timer_t_handler( void *timer_data )
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- unsigned long flags;
--
-- spin_lock_irqsave(&tp->lock, flags);
--
-- tp->get_settings(dev, cmd);
--
-- spin_unlock_irqrestore(&tp->lock, flags);
-- return 0;
--}
-+ struct net_device *dev = (struct net_device *)timer_data;
-+ struct rtl8169_private *priv = (struct rtl8169_private *) (dev->priv);
-+ unsigned long ioaddr = priv->ioaddr;
-
-+ assert( priv->mcfg > MCFG_METHOD_1 );
-+ assert( priv->pcfg < PCFG_METHOD_3 );
-
--static struct ethtool_ops rtl8169_ethtool_ops = {
-- .get_drvinfo = rtl8169_get_drvinfo,
-- .get_link = ethtool_op_get_link,
-- .get_settings = rtl8169_get_settings,
-- .set_settings = rtl8169_set_settings,
--};
--
--static void rtl8169_write_gmii_reg_bit(void *ioaddr, int reg, int bitnum,
-- int bitval)
--{
-- int val;
-+ if( RTL_R8(PHYstatus) & LinkStatus ){
-+ priv->phy_link_down_cnt = 0 ;
-+ }
-+ else{
-+ priv->phy_link_down_cnt ++ ;
-+ if( priv->phy_link_down_cnt >= 12 ){
-+ // If link on 1000, perform phy reset.
-+ if( RTL8169_READ_GMII_REG( ioaddr, PHY_1000_CTRL_REG ) & PHY_Cap_1000_Full )
-+ {
-+ DBG_PRINT("rtl8169_hw_PHY_reset\n");
-+ rtl8169_hw_PHY_reset( dev );
-+ }
-
-- val = mdio_read(ioaddr, reg);
-- val = (bitval == 1) ?
-- val | (bitval << bitnum) : val & ~(0x0001 << bitnum);
-- mdio_write(ioaddr, reg, val & 0xffff);
--}
--
--static void rtl8169_get_mac_version(struct rtl8169_private *tp, void *ioaddr)
--{
-- const struct {
-- u32 mask;
-- int mac_version;
-- } mac_info[] = {
-- { 0x1 << 26, RTL_GIGA_MAC_VER_E },
-- { 0x1 << 23, RTL_GIGA_MAC_VER_D },
-- { 0x00000000, RTL_GIGA_MAC_VER_B } /* Catch-all */
-- }, *p = mac_info;
-- u32 reg;
--
-- reg = RTL_R32(TxConfig) & 0x7c800000;
-- while ((reg & p->mask) != p->mask)
-- p++;
-- tp->mac_version = p->mac_version;
--}
--
--static void rtl8169_print_mac_version(struct rtl8169_private *tp)
--{
-- struct {
-- int version;
-- char *msg;
-- } mac_print[] = {
-- { RTL_GIGA_MAC_VER_E, "RTL_GIGA_MAC_VER_E" },
-- { RTL_GIGA_MAC_VER_D, "RTL_GIGA_MAC_VER_D" },
-- { RTL_GIGA_MAC_VER_B, "RTL_GIGA_MAC_VER_B" },
-- { 0, NULL }
-- }, *p;
--
-- for (p = mac_print; p->msg; p++) {
-- if (tp->mac_version == p->version) {
-- dprintk("mac_version == %s (%04d)\n", p->msg,
-- p->version);
-- return;
-- }
-- }
-- dprintk("mac_version == Unknown\n");
--}
--
--static void rtl8169_get_phy_version(struct rtl8169_private *tp, void *ioaddr)
--{
-- const struct {
-- u16 mask;
-- u16 set;
-- int phy_version;
-- } phy_info[] = {
-- { 0x000f, 0x0002, RTL_GIGA_PHY_VER_G },
-- { 0x000f, 0x0001, RTL_GIGA_PHY_VER_F },
-- { 0x000f, 0x0000, RTL_GIGA_PHY_VER_E },
-- { 0x0000, 0x0000, RTL_GIGA_PHY_VER_D } /* Catch-all */
-- }, *p = phy_info;
-- u16 reg;
--
-- reg = mdio_read(ioaddr, 3) & 0xffff;
-- while ((reg & p->mask) != p->set)
-- p++;
-- tp->phy_version = p->phy_version;
--}
--
--static void rtl8169_print_phy_version(struct rtl8169_private *tp)
--{
-- struct {
-- int version;
-- char *msg;
-- u32 reg;
-- } phy_print[] = {
-- { RTL_GIGA_PHY_VER_G, "RTL_GIGA_PHY_VER_G", 0x0002 },
-- { RTL_GIGA_PHY_VER_F, "RTL_GIGA_PHY_VER_F", 0x0001 },
-- { RTL_GIGA_PHY_VER_E, "RTL_GIGA_PHY_VER_E", 0x0000 },
-- { RTL_GIGA_PHY_VER_D, "RTL_GIGA_PHY_VER_D", 0x0000 },
-- { 0, NULL, 0x0000 }
-- }, *p;
--
-- for (p = phy_print; p->msg; p++) {
-- if (tp->phy_version == p->version) {
-- dprintk("phy_version == %s (%04x)\n", p->msg, p->reg);
-- return;
-- }
-- }
-- dprintk("phy_version == Unknown\n");
--}
--
--static void rtl8169_hw_phy_config(struct net_device *dev)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- struct {
-- u16 regs[5]; /* Beware of bit-sign propagation */
-- } phy_magic[5] = { {
-- { 0x0000, //w 4 15 12 0
-- 0x00a1, //w 3 15 0 00a1
-- 0x0008, //w 2 15 0 0008
-- 0x1020, //w 1 15 0 1020
-- 0x1000 } },{ //w 0 15 0 1000
-- { 0x7000, //w 4 15 12 7
-- 0xff41, //w 3 15 0 ff41
-- 0xde60, //w 2 15 0 de60
-- 0x0140, //w 1 15 0 0140
-- 0x0077 } },{ //w 0 15 0 0077
-- { 0xa000, //w 4 15 12 a
-- 0xdf01, //w 3 15 0 df01
-- 0xdf20, //w 2 15 0 df20
-- 0xff95, //w 1 15 0 ff95
-- 0xfa00 } },{ //w 0 15 0 fa00
-- { 0xb000, //w 4 15 12 b
-- 0xff41, //w 3 15 0 ff41
-- 0xde20, //w 2 15 0 de20
-- 0x0140, //w 1 15 0 0140
-- 0x00bb } },{ //w 0 15 0 00bb
-- { 0xf000, //w 4 15 12 f
-- 0xdf01, //w 3 15 0 df01
-- 0xdf20, //w 2 15 0 df20
-- 0xff95, //w 1 15 0 ff95
-- 0xbf00 } //w 0 15 0 bf00
-+ priv->phy_link_down_cnt = 0 ;
- }
-- }, *p = phy_magic;
-- int i;
--
-- rtl8169_print_mac_version(tp);
-- rtl8169_print_phy_version(tp);
--
-- if (tp->mac_version <= RTL_GIGA_MAC_VER_B)
-- return;
-- if (tp->phy_version >= RTL_GIGA_PHY_VER_F)
-- return;
--
-- dprintk("MAC version != 0 && PHY version == 0 or 1\n");
-- dprintk("Do final_reg2.cfg\n");
--
-- /* Shazam ! */
--
-- // phy config for RTL8169s mac_version C chip
-- mdio_write(ioaddr, 31, 0x0001); //w 31 2 0 1
-- mdio_write(ioaddr, 21, 0x1000); //w 21 15 0 1000
-- mdio_write(ioaddr, 24, 0x65c7); //w 24 15 0 65c7
-- rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0); //w 4 11 11 0
--
-- for (i = 0; i < ARRAY_SIZE(phy_magic); i++, p++) {
-- int val, pos = 4;
--
-- val = (mdio_read(ioaddr, pos) & 0x0fff) | (p->regs[0] & 0xffff);
-- mdio_write(ioaddr, pos, val);
-- while (--pos >= 0)
-- mdio_write(ioaddr, pos, p->regs[4 - pos] & 0xffff);
-- rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 1); //w 4 11 11 1
-- rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0); //w 4 11 11 0
- }
-- mdio_write(ioaddr, 31, 0x0000); //w 31 2 0 0
--}
-
--static void rtl8169_phy_timer(unsigned long __opaque)
--{
-- struct net_device *dev = (struct net_device *)__opaque;
-- struct rtl8169_private *tp = netdev_priv(dev);
-- struct timer_list *timer = &tp->timer;
-- void *ioaddr = tp->mmio_addr;
-- unsigned long timeout = RTL8169_PHY_TIMEOUT;
-+ //---------------------------------------------------------------------------
-+ //mod_timer is a more efficient way to update the expire field of an active timer.
-+ //---------------------------------------------------------------------------
-+// rtl8169_mod_timer( (&priv->phy_timer_t), 100 );
-+}
-
-- assert(tp->mac_version > RTL_GIGA_MAC_VER_B);
-- assert(tp->phy_version < RTL_GIGA_PHY_VER_G);
-
-- if (!(tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full))
-- return;
-
-- spin_lock_irq(&tp->lock);
-+//======================================================================================================
-+//======================================================================================================
-+void rtl8169_timer_handler( void *timer_data )
-+{
-+ struct net_device *dev = (struct net_device *)timer_data;
-+ struct rtl8169_private *priv = (struct rtl8169_private *) (dev->priv);
-
-- if (tp->phy_reset_pending(ioaddr)) {
-- /*
-- * A busy loop could burn quite a few cycles on nowadays CPU.
-- * Let's delay the execution of the timer for a few ticks.
-- */
-- timeout = HZ/10;
-- goto out_mod_timer;
-+ if( (priv->mcfg > MCFG_METHOD_1) && (priv->pcfg < PCFG_METHOD_3) ){
-+ DBG_PRINT("FIX PCS -> rtl8169_phy_timer_t_handler\n");
-+ priv->phy_link_down_cnt = 0;
-+ rtl8169_phy_timer_t_handler( timer_data );
- }
-
-- if (tp->link_ok(ioaddr))
-- goto out_unlock;
--
-- printk(KERN_WARNING PFX "%s: PHY reset until link up\n", dev->name);
-
-- tp->phy_reset_enable(ioaddr);
--
--out_mod_timer:
-- mod_timer(timer, jiffies + timeout);
--out_unlock:
-- spin_unlock_irq(&tp->lock);
--}
--
--static inline void rtl8169_delete_timer(struct net_device *dev)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- struct timer_list *timer = &tp->timer;
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+ {
-+ struct r8169_cb_t *rt = &(priv->rt);
-+ if( priv->linkstatus == _1000_Full ){
-+ r8169_callback(rt);
-+ }
-+ }
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-
-- if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
-- (tp->phy_version >= RTL_GIGA_PHY_VER_G))
-- return;
-
-- del_timer_sync(timer);
-+ rtl8169_mod_timer( (&priv->r8169_timer), priv->expire_time );
- }
-
--static inline void rtl8169_request_timer(struct net_device *dev)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- struct timer_list *timer = &tp->timer;
--
-- if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
-- (tp->phy_version >= RTL_GIGA_PHY_VER_G))
-- return;
-
-- init_timer(timer);
-- timer->expires = jiffies + RTL8169_PHY_TIMEOUT;
-- timer->data = (unsigned long)(dev);
-- timer->function = rtl8169_phy_timer;
-- add_timer(timer);
--}
-
--static int __devinit
--rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
-- void **ioaddr_out)
-+//======================================================================================================
-+//======================================================================================================
-+static int __devinit rtl8169_init_board ( struct pci_dev *pdev, struct net_device **dev_out, unsigned long *ioaddr_out)
- {
-- void *ioaddr = NULL;
-+ unsigned long ioaddr = 0;
- struct net_device *dev;
-- struct rtl8169_private *tp;
-+ struct rtl8169_private *priv;
-+ int rc, i;
- unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
-- int rc, i, acpi_idle_state = 0, pm_cap;
-
-
-- assert(pdev != NULL);
-- assert(ioaddr_out != NULL);
-+ assert (pdev != NULL);
-+ assert (ioaddr_out != NULL);
-
-- *ioaddr_out = NULL;
-+ *ioaddr_out = 0;
- *dev_out = NULL;
-
-- // dev zeroed in alloc_etherdev
-- dev = alloc_etherdev(sizeof (*tp));
-+ // dev zeroed in init_etherdev
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ dev = init_etherdev (NULL, sizeof (*priv));
-+#else
-+ dev = alloc_etherdev (sizeof (*priv));
-+#endif
-+
- if (dev == NULL) {
-- printk(KERN_ERR PFX "unable to alloc new ethernet\n");
-+ printk (KERN_ERR PFX "unable to alloc new ethernet\n");
- return -ENOMEM;
- }
-
- SET_MODULE_OWNER(dev);
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
- SET_NETDEV_DEV(dev, &pdev->dev);
-- tp = dev->priv;
-+#endif
-+
-+ priv = dev->priv;
-
- // enable device (incl. PCI PM wakeup and hotplug setup)
-- rc = pci_enable_device(pdev);
-- if (rc) {
-- printk(KERN_ERR PFX "%s: enable failure\n", pdev->slot_name);
-+ rc = pci_enable_device (pdev);
-+ if (rc)
- goto err_out;
-- }
--
-- /* save power state before pci_enable_device overwrites it */
-- pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
-- if (pm_cap) {
-- u16 pwr_command;
--
-- pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command);
-- acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK;
-- } else {
-- printk(KERN_ERR PFX
-- "Cannot find PowerManagement capability, aborting.\n");
-- goto err_out_free_res;
-- }
-
-- mmio_start = pci_resource_start(pdev, 1);
-- mmio_end = pci_resource_end(pdev, 1);
-- mmio_flags = pci_resource_flags(pdev, 1);
-- mmio_len = pci_resource_len(pdev, 1);
-+ mmio_start = pci_resource_start (pdev, 1);
-+ mmio_end = pci_resource_end (pdev, 1);
-+ mmio_flags = pci_resource_flags (pdev, 1);
-+ mmio_len = pci_resource_len (pdev, 1);
-
- // make sure PCI base addr 1 is MMIO
- if (!(mmio_flags & IORESOURCE_MEM)) {
-- printk(KERN_ERR PFX
-- "region #1 not an MMIO resource, aborting\n");
-+ printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n");
- rc = -ENODEV;
-- goto err_out_disable;
-+ goto err_out;
- }
-+
- // check for weird/broken PCI region reporting
-- if (mmio_len < RTL_MIN_IO_SIZE) {
-- printk(KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
-+ if ( mmio_len < RTL_MIN_IO_SIZE ) {
-+ printk (KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
- rc = -ENODEV;
-- goto err_out_disable;
-+ goto err_out;
- }
-
-- rc = pci_request_regions(pdev, MODULENAME);
-- if (rc) {
-- printk(KERN_ERR PFX "%s: could not request regions.\n",
-- pdev->slot_name);
-- goto err_out_disable;
-- }
--
-- tp->cp_cmd = PCIMulRW | RxChkSum;
--
-- if ((sizeof(dma_addr_t) > 4) &&
-- !pci_set_dma_mask(pdev, DMA_64BIT_MASK) && use_dac)
-- tp->cp_cmd |= PCIDAC;
-- else {
-- rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-- if (rc < 0) {
-- printk(KERN_ERR PFX "DMA configuration failed.\n");
-- goto err_out_free_res;
-- }
-- }
-
-+ rc = pci_request_regions (pdev, dev->name);
-+ if (rc)
-+ goto err_out;
-
- // enable PCI bus-mastering
-- pci_set_master(pdev);
-+ pci_set_master (pdev);
-
-- // ioremap MMIO region
-- ioaddr = ioremap(mmio_start, mmio_len);
-- if (ioaddr == NULL) {
-- printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");
-+#ifdef RTL8169_USE_IO
-+ ioaddr = pci_resource_start(pdev, 0);
-+#else
-+ // ioremap MMIO region
-+ ioaddr = (unsigned long)ioremap (mmio_start, mmio_len);
-+ if (ioaddr == 0) {
-+ printk (KERN_ERR PFX "cannot remap MMIO, aborting\n");
- rc = -EIO;
- goto err_out_free_res;
- }
-+#endif
-
-- // Soft reset the chip.
-- RTL_W8(ChipCmd, CmdReset);
-+ // Soft reset the chip.
-+ RTL_W8 ( ChipCmd, CmdReset);
-
- // Check that the chip has finished the reset.
-- for (i = 1000; i > 0; i--) {
-- if ((RTL_R8(ChipCmd) & CmdReset) == 0)
-+ for (i = 1000; i > 0; i--){
-+ if ( (RTL_R8(ChipCmd) & CmdReset) == 0){
- break;
-- udelay(10);
-+ }
-+ else{
-+ udelay (10);
-+ }
- }
-
-- // Identify chip attached to board
-- rtl8169_get_mac_version(tp, ioaddr);
-- rtl8169_get_phy_version(tp, ioaddr);
--
-- rtl8169_print_mac_version(tp);
-- rtl8169_print_phy_version(tp);
-+ // identify config method
-+ {
-+ unsigned long val32 = (RTL_R32(TxConfig)&0x7c800000);
-
-- for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) {
-- if (tp->mac_version == rtl_chip_info[i].mac_version)
-- break;
-+ if( val32 == (0x1<<28) ){
-+ priv->mcfg = MCFG_METHOD_4;
-+ }
-+ else if( val32 == (0x1<<26) ){
-+ priv->mcfg = MCFG_METHOD_3;
-+ }
-+ else if( val32 == (0x1<<23) ){
-+ priv->mcfg = MCFG_METHOD_2;
-+ }
-+ else if( val32 == 0x00000000 ){
-+ priv->mcfg = MCFG_METHOD_1;
-+ }
-+ else{
-+ priv->mcfg = MCFG_METHOD_1;
-+ }
- }
-- if (i < 0) {
-- /* Unknown chip: assume array element #0, original RTL-8169 */
-- printk(KERN_DEBUG PFX
-- "PCI device %s: unknown chip version, assuming %s\n",
-- pci_name(pdev), rtl_chip_info[0].name);
-- i++;
-+ {
-+ unsigned char val8 = (unsigned char)(RTL8169_READ_GMII_REG(ioaddr,3)&0x000f);
-+ if( val8 == 0x00 ){
-+ priv->pcfg = PCFG_METHOD_1;
-+ }
-+ else if( val8 == 0x01 ){
-+ priv->pcfg = PCFG_METHOD_2;
-+ }
-+ else if( val8 == 0x02 ){
-+ priv->pcfg = PCFG_METHOD_3;
-+ }
-+ else{
-+ priv->pcfg = PCFG_METHOD_3;
-+ }
-+ }
-+
-+
-+ for (i = ARRAY_SIZE (rtl_chip_info) - 1; i >= 0; i--){
-+ if (priv->mcfg == rtl_chip_info[i].mcfg) {
-+ priv->chipset = i;
-+ goto match;
-+ }
- }
-- tp->chipset = i;
-
-+ //if unknown chip, assume array element #0, original RTL-8169 in this case
-+ printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8169\n", pdev->slot_name);
-+ priv->chipset = 0;
-+
-+match:
- *ioaddr_out = ioaddr;
- *dev_out = dev;
- return 0;
-
-+#ifndef RTL8169_USE_IO
- err_out_free_res:
-- pci_release_regions(pdev);
--
--err_out_disable:
-- pci_disable_device(pdev);
-+ pci_release_regions (pdev);
-+#endif
-
- err_out:
-- free_netdev(dev);
-+ unregister_netdev (dev);
-+ kfree (dev);
- return rc;
- }
-
--static int __devinit
--rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static int __devinit rtl8169_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
- {
- struct net_device *dev = NULL;
-- struct rtl8169_private *tp = NULL;
-- void *ioaddr = NULL;
-+ struct rtl8169_private *priv = NULL;
-+ unsigned long ioaddr = 0;
- static int board_idx = -1;
-- static int printed_version = 0;
-- u8 autoneg, duplex;
-- u16 speed;
-- int i, rc;
-+ int i;
-+ int option = -1, Cap10_100 = 0, Cap1000 = 0;
-
-- assert(pdev != NULL);
-- assert(ent != NULL);
-+
-+ assert (pdev != NULL);
-+ assert (ent != NULL);
-
- board_idx++;
-
-- if (!printed_version) {
-- printk(KERN_INFO RTL8169_DRIVER_NAME " loaded\n");
-- printed_version = 1;
-+
-+ i = rtl8169_init_board (pdev, &dev, &ioaddr);
-+ if (i < 0) {
-+ return i;
- }
-
-- rc = rtl8169_init_board(pdev, &dev, &ioaddr);
-- if (rc)
-- return rc;
-+ priv = dev->priv;
-
-- tp = dev->priv;
-- assert(ioaddr != NULL);
-- assert(dev != NULL);
-- assert(tp != NULL);
--
-- if (RTL_R8(PHYstatus) & TBI_Enable) {
-- tp->set_speed = rtl8169_set_speed_tbi;
-- tp->get_settings = rtl8169_gset_tbi;
-- tp->phy_reset_enable = rtl8169_tbi_reset_enable;
-- tp->phy_reset_pending = rtl8169_tbi_reset_pending;
-- tp->link_ok = rtl8169_tbi_link_ok;
-+ assert (ioaddr != NULL);
-+ assert (dev != NULL);
-+ assert (priv != NULL);
-
-- tp->phy_1000_ctrl_reg = PHY_Cap_1000_Full; /* Implied by TBI */
-- } else {
-- tp->set_speed = rtl8169_set_speed_xmii;
-- tp->get_settings = rtl8169_gset_xmii;
-- tp->phy_reset_enable = rtl8169_xmii_reset_enable;
-- tp->phy_reset_pending = rtl8169_xmii_reset_pending;
-- tp->link_ok = rtl8169_xmii_link_ok;
-- }
--
-- // Get MAC address. FIXME: read EEPROM
-- for (i = 0; i < MAC_ADDR_LEN; i++)
-- dev->dev_addr[i] = RTL_R8(MAC0 + i);
--
-- dev->open = rtl8169_open;
-- dev->hard_start_xmit = rtl8169_start_xmit;
-- dev->get_stats = rtl8169_get_stats;
-- dev->ethtool_ops = &rtl8169_ethtool_ops;
-- dev->stop = rtl8169_close;
-- dev->tx_timeout = rtl8169_tx_timeout;
-+ // Get MAC address //
-+ for (i = 0; i < MAC_ADDR_LEN ; i++){
-+ dev->dev_addr[i] = RTL_R8( MAC0 + i );
-+ }
-+
-+ dev->open = rtl8169_open;
-+ dev->hard_start_xmit = rtl8169_start_xmit;
-+ dev->get_stats = rtl8169_get_stats;
-+ dev->stop = rtl8169_close;
-+ dev->tx_timeout = rtl8169_tx_timeout;
- dev->set_multicast_list = rtl8169_set_rx_mode;
-- dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
-- dev->irq = pdev->irq;
-- dev->base_addr = (unsigned long) ioaddr;
--#ifdef CONFIG_R8169_NAPI
-- dev->poll = rtl8169_poll;
-- dev->weight = R8169_NAPI_WEIGHT;
-- printk(KERN_INFO PFX "NAPI enabled\n");
--#endif
-- tp->intr_mask = 0xffff;
-- tp->pci_dev = pdev;
-- tp->mmio_addr = ioaddr;
--
-- spin_lock_init(&tp->lock);
--
-- rc = register_netdev(dev);
-- if (rc) {
-- iounmap(ioaddr);
-- pci_release_regions(pdev);
-- pci_disable_device(pdev);
-- free_netdev(dev);
-- return rc;
-- }
--
-- printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n", dev->name,
-- rtl_chip_info[tp->chipset].name);
--
-- pci_set_drvdata(pdev, dev);
--
-- printk(KERN_INFO "%s: %s at 0x%lx, "
-- "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
-- "IRQ %d\n",
-- dev->name,
-- rtl_chip_info[ent->driver_data].name,
-- dev->base_addr,
-- dev->dev_addr[0], dev->dev_addr[1],
-- dev->dev_addr[2], dev->dev_addr[3],
-- dev->dev_addr[4], dev->dev_addr[5], dev->irq);
-+ dev->watchdog_timeo = TX_TIMEOUT;
-+ dev->irq = pdev->irq;
-+ dev->base_addr = (unsigned long) ioaddr;
-+
-+#ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+ dev->change_mtu = rtl8169_change_mtu;
-+#endif //end #ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+
-+#ifdef RTL8169_IOCTL_SUPPORT
-+ dev->do_ioctl = rtl8169_ioctl;
-+#endif //end #ifdef RTL8169_IOCTL_SUPPORT
-+
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+ priv->rt.dev = dev;
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-+
-+ priv = dev->priv; // private data //
-+ priv->pci_dev = pdev;
-+ priv->ioaddr = ioaddr;
-+
-+//#ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+ priv->curr_mtu_size = dev->mtu;
-+ priv->tx_pkt_len = dev->mtu + ETH_HDR_LEN;
-+ priv->rx_pkt_len = dev->mtu + ETH_HDR_LEN;
-+ priv->hw_rx_pkt_len = priv->rx_pkt_len + 8;
-+//#endif //end #ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+
-+ DBG_PRINT("-------------------------- \n");
-+ DBG_PRINT("dev->mtu = %d \n", dev->mtu);
-+ DBG_PRINT("priv->curr_mtu_size = %d \n", priv->curr_mtu_size);
-+ DBG_PRINT("priv->tx_pkt_len = %d \n", priv->tx_pkt_len);
-+ DBG_PRINT("priv->rx_pkt_len = %d \n", priv->rx_pkt_len);
-+ DBG_PRINT("priv->hw_rx_pkt_len = %d \n", priv->hw_rx_pkt_len);
-+ DBG_PRINT("-------------------------- \n");
-+
-+ spin_lock_init (&priv->lock);
-+
-+ register_netdev (dev);
-+
-+ pci_set_drvdata(pdev, dev); // pdev->driver_data = data;
-+
-+
-+ printk (KERN_DEBUG "%s: Identified chip type is '%s'.\n",dev->name,rtl_chip_info[priv->chipset].name);
-+ printk (KERN_INFO "%s: %s at 0x%lx, "
-+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
-+ "IRQ %d\n",
-+ dev->name,
-+ RTL8169_DRIVER_NAME,
-+ dev->base_addr,
-+ dev->dev_addr[0], dev->dev_addr[1],
-+ dev->dev_addr[2], dev->dev_addr[3],
-+ dev->dev_addr[4], dev->dev_addr[5],
-+ dev->irq);
-
-- rtl8169_hw_phy_config(dev);
-
-- dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-- RTL_W8(0x82, 0x01);
-+ // Config PHY
-+ rtl8169_hw_PHY_config(dev);
-
-- if (tp->mac_version < RTL_GIGA_MAC_VER_E) {
-- dprintk("Set PCI Latency=0x40\n");
-+ DBG_PRINT("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-+ RTL_W8( 0x82, 0x01 );
-+
-+ if( priv->mcfg < MCFG_METHOD_3 ){
-+ DBG_PRINT("Set PCI Latency=0x40\n");
- pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
- }
-
-- if (tp->mac_version == RTL_GIGA_MAC_VER_D) {
-- dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-- RTL_W8(0x82, 0x01);
-- dprintk("Set PHY Reg 0x0bh = 0x00h\n");
-- mdio_write(ioaddr, 0x0b, 0x0000); //w 0x0b 15 0 0
-- }
-+ if( priv->mcfg == MCFG_METHOD_2 ){
-+ DBG_PRINT("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-+ RTL_W8( 0x82, 0x01 );
-+ DBG_PRINT("Set PHY Reg 0x0bh = 0x00h\n");
-+ RTL8169_WRITE_GMII_REG( ioaddr, 0x0b, 0x0000 ); //w 0x0b 15 0 0
-+ }
-+
-+ // if TBI is not endbled
-+ if( !(RTL_R8(PHYstatus) & TBI_Enable) ){
-+ int val = RTL8169_READ_GMII_REG( ioaddr, PHY_AUTO_NEGO_REG );
-+
-+#ifdef RTL8169_HW_FLOW_CONTROL_SUPPORT
-+ val |= PHY_Cap_PAUSE | PHY_Cap_ASYM_PAUSE ;
-+#endif //end #define RTL8169_HW_FLOW_CONTROL_SUPPORT
-+
-+ option = (board_idx >= MAX_UNITS) ? 0 : media[board_idx];
-+ // Force RTL8169 in 10/100/1000 Full/Half mode.
-+ if( option > 0 ){
-+ printk(KERN_INFO "%s: Force-mode Enabled. \n", dev->name);
-+ Cap10_100 = 0;
-+ Cap1000 = 0;
-+ switch( option ){
-+ case _10_Half:
-+ Cap10_100 = PHY_Cap_10_Half;
-+ Cap1000 = PHY_Cap_Null;
-+ break;
-+ case _10_Full:
-+ Cap10_100 = PHY_Cap_10_Full | PHY_Cap_10_Half;
-+ Cap1000 = PHY_Cap_Null;
-+ break;
-+ case _100_Half:
-+ Cap10_100 = PHY_Cap_100_Half | PHY_Cap_10_Full | PHY_Cap_10_Half;
-+ Cap1000 = PHY_Cap_Null;
-+ break;
-+ case _100_Full:
-+ Cap10_100 = PHY_Cap_100_Full | PHY_Cap_100_Half | PHY_Cap_10_Full | PHY_Cap_10_Half;
-+ Cap1000 = PHY_Cap_Null;
-+ break;
-+ case _1000_Full:
-+ Cap10_100 = PHY_Cap_100_Full | PHY_Cap_100_Half | PHY_Cap_10_Full | PHY_Cap_10_Half;
-+ Cap1000 = PHY_Cap_1000_Full;
-+ break;
-+ default:
-+ break;
-+ }
-+ RTL8169_WRITE_GMII_REG( ioaddr, PHY_AUTO_NEGO_REG, Cap10_100 | ( val&0xC1F ) ); //leave PHY_AUTO_NEGO_REG bit4:0 unchanged
-+ RTL8169_WRITE_GMII_REG( ioaddr, PHY_1000_CTRL_REG, Cap1000 );
-+ }
-+ else{
-+ printk(KERN_INFO "%s: Auto-negotiation Enabled.\n", dev->name);
-
-- rtl8169_link_option(board_idx, &autoneg, &speed, &duplex);
-+ // enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged
-+ RTL8169_WRITE_GMII_REG( ioaddr, PHY_AUTO_NEGO_REG,
-+ PHY_Cap_10_Half | PHY_Cap_10_Full | PHY_Cap_100_Half | PHY_Cap_100_Full | ( val&0xC1F ) );
-+
-+ // enable 1000 Full Mode
-+// RTL8169_WRITE_GMII_REG( ioaddr, PHY_1000_CTRL_REG, PHY_Cap_1000_Full );
-+ RTL8169_WRITE_GMII_REG( ioaddr, PHY_1000_CTRL_REG, PHY_Cap_1000_Full | PHY_Cap_1000_Half); //rtl8168
-+
-+ }// end of if( option > 0 )
-
-- rtl8169_set_speed(dev, autoneg, speed, duplex);
--
-- if (RTL_R8(PHYstatus) & TBI_Enable)
-- printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
-+ // Enable auto-negotiation and restart auto-nigotiation
-+ RTL8169_WRITE_GMII_REG( ioaddr, PHY_CTRL_REG, PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego );
-+ udelay(100);
-+
-+ // wait for auto-negotiation process
-+ for( i = 10000; i > 0; i-- ){
-+ //check if auto-negotiation complete
-+ if( RTL8169_READ_GMII_REG(ioaddr, PHY_STAT_REG) & PHY_Auto_Neco_Comp ){
-+ udelay(100);
-+ option = RTL_R8(PHYstatus);
-+ if( option & _1000bpsF ){
-+ printk(KERN_INFO "%s: 1000Mbps Full-duplex operation.\n", dev->name);
-+ }
-+ else{
-+ printk(KERN_INFO "%s: %sMbps %s-duplex operation.\n", dev->name,
-+ (option & _100bps) ? "100" : "10", (option & FullDup) ? "Full" : "Half" );
-+ }
-+ break;
-+ }
-+ else{
-+ udelay(100);
-+ }// end of if( RTL8169_READ_GMII_REG(ioaddr, 1) & 0x20 )
-+ }// end for-loop to wait for auto-negotiation process
-+
-+ option = RTL_R8(PHYstatus);
-+ if( option & _1000bpsF ){
-+ priv->linkstatus = _1000_Full;
-+ }
-+ else{
-+ if(option & _100bps){
-+ priv->linkstatus = (option & FullDup) ? _100_Full : _100_Half;
-+ }
-+ else{
-+ priv->linkstatus = (option & FullDup) ? _10_Full : _10_Half;
-+ }
-+ }
-+ DBG_PRINT("priv->linkstatus = 0x%02x\n", priv->linkstatus);
-+
-+ }// end of TBI is not enabled
-+ else{
-+ udelay(100);
-+ DBG_PRINT("1000Mbps Full-duplex operation, TBI Link %s!\n",(RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed" );
-+
-+ }// end of TBI is not enabled
-
- return 0;
- }
-
--static void __devexit
--rtl8169_remove_one(struct pci_dev *pdev)
--{
-- struct net_device *dev = pci_get_drvdata(pdev);
-- struct rtl8169_private *tp = netdev_priv(dev);
-
-- assert(dev != NULL);
-- assert(tp != NULL);
-
-- unregister_netdev(dev);
-- iounmap(tp->mmio_addr);
-- pci_release_regions(pdev);
--
-- pci_disable_device(pdev);
-- free_netdev(dev);
-- pci_set_drvdata(pdev, NULL);
--}
-
--#ifdef CONFIG_PM
-
--static int rtl8169_suspend(struct pci_dev *pdev, u32 state)
--{
-- struct net_device *dev = pci_get_drvdata(pdev);
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- unsigned long flags;
-
-- if (!netif_running(dev))
-- return 0;
--
-- netif_device_detach(dev);
-- netif_stop_queue(dev);
-- spin_lock_irqsave(&tp->lock, flags);
--
-- /* Disable interrupts, stop Rx and Tx */
-- RTL_W16(IntrMask, 0);
-- RTL_W8(ChipCmd, 0);
--
-- /* Update the error counts. */
-- tp->stats.rx_missed_errors += RTL_R32(RxMissed);
-- RTL_W32(RxMissed, 0);
-- spin_unlock_irqrestore(&tp->lock, flags);
--
-- return 0;
--}
-
--static int rtl8169_resume(struct pci_dev *pdev)
-+//======================================================================================================
-+static void __devexit rtl8169_remove_one (struct pci_dev *pdev)
- {
- struct net_device *dev = pci_get_drvdata(pdev);
-
-- if (!netif_running(dev))
-- return 0;
-+ assert (dev != NULL);
-+ assert (priv != NULL);
-
-- netif_device_attach(dev);
-- rtl8169_hw_start(dev);
-+ unregister_netdev (dev);
-
-- return 0;
--}
--
--#endif /* CONFIG_PM */
-+#ifdef RTL8169_USE_IO
-+#else
-+ iounmap ((void *)(dev->base_addr));
-+#endif
-+ pci_release_regions (pdev);
-
--static int
--rtl8169_open(struct net_device *dev)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- struct pci_dev *pdev = tp->pci_dev;
-- int retval;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ kfree (dev);
-+#else
-+ free_netdev(dev);
-+#endif
-
-- retval =
-- request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev);
-- if (retval < 0)
-- goto out;
--
-- retval = -ENOMEM;
--
-- /*
-- * Rx and Tx desscriptors needs 256 bytes alignment.
-- * pci_alloc_consistent provides more.
-- */
-- tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES,
-- &tp->TxPhyAddr);
-- if (!tp->TxDescArray)
-- goto err_free_irq;
--
-- tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES,
-- &tp->RxPhyAddr);
-- if (!tp->RxDescArray)
-- goto err_free_tx;
--
-- retval = rtl8169_init_ring(dev);
-- if (retval < 0)
-- goto err_free_rx;
--
-- rtl8169_hw_start(dev);
--
-- rtl8169_request_timer(dev);
--
-- rtl8169_check_link_status(dev, tp, tp->mmio_addr);
--out:
-- return retval;
--
--err_free_rx:
-- pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
-- tp->RxPhyAddr);
--err_free_tx:
-- pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray,
-- tp->TxPhyAddr);
--err_free_irq:
-- free_irq(dev->irq, dev);
-- goto out;
-+ pci_set_drvdata (pdev, NULL);
- }
-
--static void
--rtl8169_hw_start(struct net_device *dev)
--{
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- u32 i;
-
-- /* Soft reset the chip. */
-- RTL_W8(ChipCmd, CmdReset);
-
-- /* Check that the chip has finished the reset. */
-- for (i = 1000; i > 0; i--) {
-- if ((RTL_R8(ChipCmd) & CmdReset) == 0)
-- break;
-- udelay(10);
-- }
-
-- RTL_W8(Cfg9346, Cfg9346_Unlock);
-- RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
-- RTL_W8(EarlyTxThres, EarlyTxThld);
-
-- // For gigabit rtl8169
-- RTL_W16(RxMaxSize, RxPacketMaxSize);
-
-- // Set Rx Config register
-- i = rtl8169_rx_config |
-- (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask);
-- RTL_W32(RxConfig, i);
-
-- /* Set DMA burst size and Interframe Gap Time */
-- RTL_W32(TxConfig,
-- (TX_DMA_BURST << TxDMAShift) | (InterFrameGap <<
-- TxInterFrameGapShift));
-- tp->cp_cmd |= RTL_R16(CPlusCmd);
-- RTL_W16(CPlusCmd, tp->cp_cmd);
-+//======================================================================================================
-+static int rtl8169_open (struct net_device *dev)
-+{
-+ struct rtl8169_private *priv = dev->priv;
-+ struct pci_dev *pdev = priv->pci_dev;
-+ int retval;
-+// u8 diff;
-+// u32 TxPhyAddr, RxPhyAddr;
-+
-
-- if (tp->mac_version == RTL_GIGA_MAC_VER_D) {
-- dprintk(KERN_INFO PFX "Set MAC Reg C+CR Offset 0xE0. "
-- "Bit-3 and bit-14 MUST be 1\n");
-- tp->cp_cmd |= (1 << 14) | PCIMulRW;
-- RTL_W16(CPlusCmd, tp->cp_cmd);
-+ if( priv->drvinit_fail == 1 ){
-+ printk("%s: Gigabit driver open failed.\n", dev->name );
-+ return -ENOMEM;
- }
-
-- tp->cur_rx = 0;
-+ retval = request_irq (dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev);
-+ if (retval) {
-+ return retval;
-+ }
-
-- RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK));
-- RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32));
-- RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK));
-- RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32));
-- RTL_W8(Cfg9346, Cfg9346_Lock);
-- udelay(10);
-+ //2004-05-11
-+ // Allocate tx/rx descriptor space
-+ priv->sizeof_txdesc_space = NUM_TX_DESC * sizeof(struct TxDesc)+256;
-+ priv->txdesc_space = pci_alloc_consistent( pdev, priv->sizeof_txdesc_space, &priv->txdesc_phy_dma_addr );
-+ if( priv->txdesc_space == NULL ){
-+ printk("%s: Gigabit driver alloc txdesc_space failed.\n", dev->name );
-+ return -ENOMEM;
-+ }
-+ priv->sizeof_rxdesc_space = NUM_RX_DESC * sizeof(struct RxDesc)+256;
-+ priv->rxdesc_space = pci_alloc_consistent( pdev, priv->sizeof_rxdesc_space, &priv->rxdesc_phy_dma_addr );
-+ if( priv->rxdesc_space == NULL ){
-+ printk("%s: Gigabit driver alloc rxdesc_space failed.\n", dev->name );
-+ return -ENOMEM;
-+ }
-
-- RTL_W32(RxMissed, 0);
-+ if(priv->txdesc_phy_dma_addr & 0xff){
-+ printk("%s: Gigabit driver txdesc_phy_dma_addr is not 256-bytes-aligned.\n", dev->name );
-+ }
-+ if(priv->rxdesc_phy_dma_addr & 0xff){
-+ printk("%s: Gigabit driver rxdesc_phy_dma_addr is not 256-bytes-aligned.\n", dev->name );
-+ }
-+ // Set tx/rx descriptor space
-+ priv->TxDescArray = (struct TxDesc *)priv->txdesc_space;
-+ priv->RxDescArray = (struct RxDesc *)priv->rxdesc_space;
-+
-+ {
-+ int i;
-+ struct sk_buff *skb = NULL;
-+
-+ for(i=0;i<NUM_RX_DESC;i++){
-+ skb = RTL8169_ALLOC_RXSKB(MAX_RX_SKBDATA_SIZE);
-+ if( skb != NULL ) {
-+ skb_reserve (skb, 2); // 16 byte align the IP fields. //
-+ priv->Rx_skbuff[i] = skb;
-+ }
-+ else{
-+ printk("%s: Gigabit driver failed to allocate skbuff.\n", dev->name);
-+ priv->drvinit_fail = 1;
-+ }
-+ }
-+ }
-
-- rtl8169_set_rx_mode(dev);
-
-- /* no early-rx interrupts */
-- RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000);
-+ //////////////////////////////////////////////////////////////////////////////
-+ rtl8169_init_ring (dev);
-+ rtl8169_hw_start (dev);
-
-- /* Enable all known interrupts by setting the interrupt mask. */
-- RTL_W16(IntrMask, rtl8169_intr_mask);
-
-- netif_start_queue(dev);
--}
-+ // ------------------------------------------------------
-+ DBG_PRINT("FIX PCS -> rtl8169_request_timer\n");
-+ priv->expire_time = RTL8169_TIMER_EXPIRE_TIME;
-+ rtl8169_request_timer( (&priv->r8169_timer), priv->expire_time, rtl8169_timer_handler, ((void *)dev) ); //in open()
-
--static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
--{
-- desc->addr = 0x0badbadbadbadbadull;
-- desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
--}
-
--static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
-- struct RxDesc *desc)
--{
-- pci_unmap_single(pdev, le64_to_cpu(desc->addr), RX_BUF_SIZE,
-- PCI_DMA_FROMDEVICE);
-- dev_kfree_skb(*sk_buff);
-- *sk_buff = NULL;
-- rtl8169_make_unusable_by_asic(desc);
--}
-+ DBG_PRINT("%s: %s() alloc_rxskb_cnt = %d\n", dev->name, __FUNCTION__, alloc_rxskb_cnt );
-
--static inline void rtl8169_return_to_asic(struct RxDesc *desc)
--{
-- desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
--}
-+ return 0;
-
--static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
--{
-- desc->addr = cpu_to_le64(mapping);
-- desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
--}
-+}//end of rtl8169_open (struct net_device *dev)
-
--static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
-- struct sk_buff **sk_buff, struct RxDesc *desc)
--{
-- struct sk_buff *skb;
-- dma_addr_t mapping;
-- int ret = 0;
-
-- skb = dev_alloc_skb(RX_BUF_SIZE);
-- if (!skb)
-- goto err_out;
-
-- skb->dev = dev;
-- skb_reserve(skb, 2);
-- *sk_buff = skb;
-
-- mapping = pci_map_single(pdev, skb->tail, RX_BUF_SIZE,
-- PCI_DMA_FROMDEVICE);
-
-- rtl8169_give_to_asic(desc, mapping);
-
--out:
-- return ret;
-
--err_out:
-- ret = -ENOMEM;
-- rtl8169_make_unusable_by_asic(desc);
-- goto out;
--}
-
--static void rtl8169_rx_clear(struct rtl8169_private *tp)
-+//======================================================================================================
-+static void rtl8169_hw_PHY_reset(struct net_device *dev)
- {
-- int i;
-+ int val, phy_reset_expiretime = 50;
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
-+
-+ DBG_PRINT("%s: Reset RTL8169s PHY\n", dev->name);
-
-- for (i = 0; i < NUM_RX_DESC; i++) {
-- if (tp->Rx_skbuff[i]) {
-- rtl8169_free_rx_skb(tp->pci_dev, tp->Rx_skbuff + i,
-- tp->RxDescArray + i);
-+ val = ( RTL8169_READ_GMII_REG( ioaddr, 0 ) | 0x8000 ) & 0xffff;
-+ RTL8169_WRITE_GMII_REG( ioaddr, 0, val );
-+
-+ do //waiting for phy reset
-+ {
-+ if( RTL8169_READ_GMII_REG( ioaddr, 0 ) & 0x8000 ){
-+ phy_reset_expiretime --;
-+ udelay(100);
- }
-- }
-+ else{
-+ break;
-+ }
-+ }while( phy_reset_expiretime >= 0 );
-+
-+ assert( phy_reset_expiretime > 0 );
- }
-
--static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
-- u32 start, u32 end)
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_hw_PHY_config (struct net_device *dev)
- {
-- u32 cur;
--
-- for (cur = start; end - cur > 0; cur++) {
-- int ret, i = cur % NUM_RX_DESC;
-+ struct rtl8169_private *priv = dev->priv;
-+ void *ioaddr = (void*)priv->ioaddr;
-
-- if (tp->Rx_skbuff[i])
-- continue;
--
-- ret = rtl8169_alloc_rx_skb(tp->pci_dev, dev, tp->Rx_skbuff + i,
-- tp->RxDescArray + i);
-- if (ret < 0)
-- break;
-+ DBG_PRINT("priv->mcfg=%d, priv->pcfg=%d\n",priv->mcfg,priv->pcfg);
-+
-+ if( priv->mcfg == MCFG_METHOD_4 ){
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0001 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1b, 0x841e );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x0e, 0x7bfb );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x09, 0x273a );
-+
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0002 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x90D0 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0000 );
-+ }else if((priv->mcfg == MCFG_METHOD_2)||(priv->mcfg == MCFG_METHOD_3)){
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0001 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x15, 0x1000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x18, 0x65C7 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0x00A1 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0x0008 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x1020 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x1000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0800 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xFF41 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDE60 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x0077 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7800 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xDF01 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDF20 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0xFF95 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xFA00 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA800 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xFF41 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDE20 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x00BB );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB800 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xDF01 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDF20 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0xFF95 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xBF00 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF800 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0000 );
-+ RTL8169_WRITE_GMII_REG( (unsigned long)ioaddr, 0x0B, 0x0000 );
-+ }
-+ else{
-+ DBG_PRINT("priv->mcfg=%d. Discard hw PHY config.\n",priv->mcfg);
- }
-- return cur - start;
- }
-
--static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc)
--{
-- desc->status |= cpu_to_le32(EORbit);
--}
-
--static int rtl8169_init_ring(struct net_device *dev)
-+
-+
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_hw_start (struct net_device *dev)
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
-+ u32 i;
-
-- tp->cur_rx = tp->dirty_rx = 0;
-- tp->cur_tx = tp->dirty_tx = 0;
-- memset(tp->TxDescArray, 0x0, NUM_TX_DESC * sizeof (struct TxDesc));
-- memset(tp->RxDescArray, 0x0, NUM_RX_DESC * sizeof (struct RxDesc));
-
-- memset(tp->Tx_skbuff, 0x0, NUM_TX_DESC * sizeof(struct sk_buff *));
-- memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
-+ /* Soft reset the chip. */
-+ RTL_W8 ( ChipCmd, CmdReset);
-
-- if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC)
-- goto err_out;
-+ /* Check that the chip has finished the reset. */
-+ for (i = 1000; i > 0; i--){
-+ if ((RTL_R8( ChipCmd ) & CmdReset) == 0) break;
-+ else udelay (10);
-+ }
-
-- rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
-+ RTL_W8 ( Cfg9346, Cfg9346_Unlock);
-+ RTL_W8 ( ChipCmd, CmdTxEnb | CmdRxEnb);
-+ RTL_W8 ( ETThReg, ETTh);
-
-- return 0;
-+ // For gigabit rtl8169
-+ RTL_W16 ( RxMaxSize, (unsigned short)priv->hw_rx_pkt_len );
-
--err_out:
-- rtl8169_rx_clear(tp);
-- return -ENOMEM;
--}
-+ // Set Rx Config register
-+ i = rtl8169_rx_config | ( RTL_R32( RxConfig ) & rtl_chip_info[priv->chipset].RxConfigMask);
-+ RTL_W32 ( RxConfig, i);
-+
-+
-+ /* Set DMA burst size and Interframe Gap Time */
-+ RTL_W32 ( TxConfig, (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << TxInterFrameGapShift) );
-+
-+
-+
-+ RTL_W16( CPlusCmd, RTL_R16(CPlusCmd) );
-
--static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
-- struct TxDesc *desc)
-+ if( priv->mcfg == MCFG_METHOD_2 ||
-+ priv->mcfg == MCFG_METHOD_3)
-+ {
-+ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<14)|(1<<3)) );
-+ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14\n");
-+ }
-+ else
-+ {
-+ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<3)) );
-+ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3.\n");
-+ }
-+
-+ {
-+ //RTL_W16(0xE2, 0x1517);
-+ //RTL_W16(0xE2, 0x152a);
-+ //RTL_W16(0xE2, 0x282a);
-+ RTL_W16(0xE2, 0x0000);
-+ }
-+
-+ priv->cur_rx = 0;
-+
-+ RTL_W32 ( TxDescStartAddr, priv->txdesc_phy_dma_addr);
-+ RTL_W32 ( TxDescStartAddr + 4, 0x00);
-+ RTL_W32 ( RxDescStartAddr, priv->rxdesc_phy_dma_addr);
-+ RTL_W32 ( RxDescStartAddr + 4, 0x00);
-+
-+ RTL_W8 ( Cfg9346, Cfg9346_Lock );
-+ udelay (10);
-+
-+ RTL_W32 ( RxMissed, 0 );
-+
-+ rtl8169_set_rx_mode (dev);
-+
-+ RTL_W16 ( MultiIntr, RTL_R16(MultiIntr) & 0xF000);
-+
-+ RTL_W16 ( IntrMask, rtl8169_intr_mask);
-+
-+ netif_start_queue (dev);
-+
-+}//end of rtl8169_hw_start (struct net_device *dev)
-+
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_init_ring (struct net_device *dev)
- {
-- u32 len = sk_buff[0]->len;
-+ struct rtl8169_private *priv = dev->priv;
-+ struct pci_dev *pdev = priv->pci_dev;
-+ int i;
-+ struct sk_buff *skb;
-+
-+
-+ priv->cur_rx = 0;
-+ priv->cur_tx = 0;
-+ priv->dirty_tx = 0;
-+ memset(priv->TxDescArray, 0x0, NUM_TX_DESC*sizeof(struct TxDesc));
-+ memset(priv->RxDescArray, 0x0, NUM_RX_DESC*sizeof(struct RxDesc));
-
-- pci_unmap_single(pdev, le64_to_cpu(desc->addr),
-- len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE);
-- desc->addr = 0x00;
-- *sk_buff = NULL;
-+
-+ for (i=0 ; i<NUM_TX_DESC ; i++){
-+ priv->Tx_skbuff[i]=NULL;
-+ priv->txdesc_array_dma_addr[i] = pci_map_single(pdev, &priv->TxDescArray[i], sizeof(struct TxDesc), PCI_DMA_TODEVICE);
-+ }
-+
-+ for (i=0; i <NUM_RX_DESC; i++) {
-+ if(i==(NUM_RX_DESC-1)){
-+ priv->RxDescArray[i].status = cpu_to_le32((OWNbit | EORbit) | (unsigned long)priv->hw_rx_pkt_len);
-+ }
-+ else{
-+ priv->RxDescArray[i].status = cpu_to_le32(OWNbit | (unsigned long)priv->hw_rx_pkt_len);
-+ }
-+
-+ {//-----------------------------------------------------------------------
-+ skb = priv->Rx_skbuff[i];
-+ priv->rx_skbuff_dma_addr[i] = pci_map_single(pdev, skb->data, MAX_RX_SKBDATA_SIZE, PCI_DMA_FROMDEVICE);
-+
-+ if( skb != NULL ){
-+ priv->RxDescArray[i].buf_addr = cpu_to_le32(priv->rx_skbuff_dma_addr[i]);
-+ priv->RxDescArray[i].buf_Haddr = 0;
-+ }
-+ else{
-+ DBG_PRINT("%s: %s() Rx_skbuff == NULL\n", dev->name, __FUNCTION__);
-+ priv->drvinit_fail = 1;
-+ }
-+ }//-----------------------------------------------------------------------
-+ priv->rxdesc_array_dma_addr[i] = pci_map_single(pdev, &priv->RxDescArray[i], sizeof(struct RxDesc), PCI_DMA_TODEVICE);
-+ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[i], sizeof(struct RxDesc), PCI_DMA_TODEVICE);
-+ }
- }
-
--static void
--rtl8169_tx_clear(struct rtl8169_private *tp)
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_tx_clear (struct rtl8169_private *priv)
- {
- int i;
-
-- tp->cur_tx = 0;
-- for (i = 0; i < NUM_TX_DESC; i++) {
-- struct sk_buff *skb = tp->Tx_skbuff[i];
--
-- if (skb) {
-- rtl8169_unmap_tx_skb(tp->pci_dev, tp->Tx_skbuff + i,
-- tp->TxDescArray + i);
-- dev_kfree_skb(skb);
-- tp->stats.tx_dropped++;
-+ priv->cur_tx = 0;
-+ for ( i = 0 ; i < NUM_TX_DESC ; i++ ){
-+ if ( priv->Tx_skbuff[i] != NULL ) {
-+ dev_kfree_skb ( priv->Tx_skbuff[i] );
-+ priv->Tx_skbuff[i] = NULL;
-+ priv->stats.tx_dropped++;
- }
- }
- }
-
--static void
--rtl8169_tx_timeout(struct net_device *dev)
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_tx_timeout (struct net_device *dev)
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
- u8 tmp8;
-
-- printk(KERN_INFO "%s: TX Timeout\n", dev->name);
- /* disable Tx, if not already */
-- tmp8 = RTL_R8(ChipCmd);
-- if (tmp8 & CmdTxEnb)
-- RTL_W8(ChipCmd, tmp8 & ~CmdTxEnb);
-+ tmp8 = RTL_R8( ChipCmd );
-+ if (tmp8 & CmdTxEnb){
-+ RTL_W8 ( ChipCmd, tmp8 & ~CmdTxEnb);
-+ }
-
- /* Disable interrupts by clearing the interrupt mask. */
-- RTL_W16(IntrMask, 0x0000);
-+ RTL_W16 ( IntrMask, 0x0000);
-
- /* Stop a shared interrupt from scavenging while we are. */
-- spin_lock_irq(&tp->lock);
-- rtl8169_tx_clear(tp);
-- spin_unlock_irq(&tp->lock);
-+ spin_lock_irq (&priv->lock);
-+ rtl8169_tx_clear (priv);
-+ spin_unlock_irq (&priv->lock);
-+
-
-- /* ...and finally, reset everything */
-- rtl8169_hw_start(dev);
-+ rtl8169_hw_start (dev);
-
-- netif_wake_queue(dev);
-+ netif_wake_queue (dev);
- }
-
--static int
--rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev)
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static int rtl8169_start_xmit (struct sk_buff *skb, struct net_device *dev)
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- unsigned int entry = tp->cur_tx % NUM_TX_DESC;
-- u32 len = skb->len;
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
-+ struct pci_dev *pdev = priv->pci_dev;
-+ int entry = priv->cur_tx % NUM_TX_DESC;
-+ int buf_len = 60;
-+ dma_addr_t txbuf_dma_addr;
-
-- if (unlikely(skb->len < ETH_ZLEN)) {
-- skb = skb_padto(skb, ETH_ZLEN);
-- if (!skb)
-- goto err_update_stats;
-- len = ETH_ZLEN;
-- }
--
-- if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
-- dma_addr_t mapping;
-- u32 status;
--
-- mapping = pci_map_single(tp->pci_dev, skb->data, len,
-- PCI_DMA_TODEVICE);
--
-- tp->Tx_skbuff[entry] = skb;
-- tp->TxDescArray[entry].addr = cpu_to_le64(mapping);
--
-- /* anti gcc 2.95.3 bugware */
-- status = OWNbit | FSbit | LSbit | len |
-- (EORbit * !((entry + 1) % NUM_TX_DESC));
-- tp->TxDescArray[entry].status = cpu_to_le32(status);
--
-- RTL_W8(TxPoll, 0x40); //set polling bit
-+ spin_lock_irq (&priv->lock);
-
-- dev->trans_start = jiffies;
-+ if( (le32_to_cpu(priv->TxDescArray[entry].status) & OWNbit)==0 ){
-
-- tp->cur_tx++;
-- smp_wmb();
-- } else
-- goto err_drop;
-+ priv->Tx_skbuff[entry] = skb;
-+ txbuf_dma_addr = pci_map_single(pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
-+
-+ priv->TxDescArray[entry].buf_addr = cpu_to_le32(txbuf_dma_addr);
-+ DBG_PRINT("%s: TX pkt_size = %d\n", __FUNCTION__, skb->len);
-+ if( skb->len <= priv->tx_pkt_len ){
-+ buf_len = skb->len;
-+ }
-+ else{
-+ printk("%s: Error -- Tx packet size(%d) > mtu(%d)+14\n", dev->name, skb->len, dev->mtu);
-+ buf_len = priv->tx_pkt_len;
-+ }
-
-- if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) {
-- u32 dirty = tp->dirty_tx;
--
-- netif_stop_queue(dev);
-- smp_rmb();
-- if (dirty != tp->dirty_tx)
-- netif_wake_queue(dev);
-- }
-+ if( entry != (NUM_TX_DESC-1) ){
-+ priv->TxDescArray[entry].status = cpu_to_le32((OWNbit | FSbit | LSbit) | buf_len);
-+ }
-+ else{
-+ priv->TxDescArray[entry].status = cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) | buf_len);
-+ }
-
--out:
-- return 0;
-+ pci_dma_sync_single(pdev, priv->txdesc_array_dma_addr[entry], sizeof(struct TxDesc), PCI_DMA_TODEVICE);
-
--err_drop:
-- dev_kfree_skb(skb);
--err_update_stats:
-- tp->stats.tx_dropped++;
-- goto out;
--}
--
--static void
--rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
-- void *ioaddr)
--{
-- unsigned int dirty_tx, tx_left;
--
-- assert(dev != NULL);
-- assert(tp != NULL);
-- assert(ioaddr != NULL);
--
-- dirty_tx = tp->dirty_tx;
-- smp_rmb();
-- tx_left = tp->cur_tx - dirty_tx;
--
-- while (tx_left > 0) {
-- unsigned int entry = dirty_tx % NUM_TX_DESC;
-- struct sk_buff *skb = tp->Tx_skbuff[entry];
-- u32 status;
--
-- rmb();
-- status = le32_to_cpu(tp->TxDescArray[entry].status);
-- if (status & OWNbit)
-- break;
-+ RTL_W8 ( TxPoll, 0x40); //set polling bit
-
-- /* FIXME: is it really accurate for TxErr ? */
-- tp->stats.tx_bytes += skb->len >= ETH_ZLEN ?
-- skb->len : ETH_ZLEN;
-- tp->stats.tx_packets++;
-- rtl8169_unmap_tx_skb(tp->pci_dev, tp->Tx_skbuff + entry,
-- tp->TxDescArray + entry);
-- dev_kfree_skb_irq(skb);
-- tp->Tx_skbuff[entry] = NULL;
-- dirty_tx++;
-- tx_left--;
-- }
-+ dev->trans_start = jiffies;
-
-- if (tp->dirty_tx != dirty_tx) {
-- tp->dirty_tx = dirty_tx;
-- smp_wmb();
-- if (netif_queue_stopped(dev))
-- netif_wake_queue(dev);
-+ priv->stats.tx_bytes += ( (skb->len > ETH_ZLEN) ? skb->len : ETH_ZLEN);
-+ priv->cur_tx++;
-+ }//end of if( (priv->TxDescArray[entry].status & 0x80000000)==0 )
-+
-+ spin_unlock_irq (&priv->lock);
-+
-+ if ( (priv->cur_tx - NUM_TX_DESC) == priv->dirty_tx ){
-+ netif_stop_queue (dev);
-+ }
-+ else{
-+ if (netif_queue_stopped (dev)){
-+ netif_wake_queue (dev);
-+ }
- }
-+
-+ return 0;
- }
-
--static inline int rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
-- struct RxDesc *desc,
-- struct net_device *dev)
--{
-- int ret = -1;
-
-- if (pkt_size < rx_copybreak) {
-- struct sk_buff *skb;
-
-- skb = dev_alloc_skb(pkt_size + 2);
-- if (skb) {
-- skb->dev = dev;
-- skb_reserve(skb, 2);
-- eth_copy_and_sum(skb, sk_buff[0]->tail, pkt_size, 0);
-- *sk_buff = skb;
-- rtl8169_return_to_asic(desc);
-- ret = 0;
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_tx_interrupt (struct net_device *dev, struct rtl8169_private *priv, unsigned long ioaddr)
-+{
-+ unsigned long dirty_tx, tx_left=0;
-+ int entry = priv->cur_tx % NUM_TX_DESC;
-+ int txloop_cnt = 0;
-+
-+ assert (dev != NULL);
-+ assert (priv != NULL);
-+ assert (ioaddr != NULL);
-+
-+
-+ dirty_tx = priv->dirty_tx;
-+ tx_left = priv->cur_tx - dirty_tx;
-+
-+ while( (tx_left > 0) && (txloop_cnt < max_interrupt_work) ){
-+ if( (le32_to_cpu(priv->TxDescArray[entry].status) & OWNbit) == 0 ){
-+
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+ r8169_callback_tx(&(priv->rt), 1, priv->Tx_skbuff[dirty_tx % NUM_TX_DESC]->len);
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-+
-+ dev_kfree_skb_irq( priv->Tx_skbuff[dirty_tx % NUM_TX_DESC] );
-+ priv->Tx_skbuff[dirty_tx % NUM_TX_DESC] = NULL;
-+ priv->stats.tx_packets++;
-+ dirty_tx++;
-+ tx_left--;
-+ entry++;
- }
-+ txloop_cnt ++;
-+ }
-+
-+ if (priv->dirty_tx != dirty_tx) {
-+ priv->dirty_tx = dirty_tx;
-+ if (netif_queue_stopped (dev))
-+ netif_wake_queue (dev);
- }
-- return ret;
- }
-
--static int
--rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
-- void *ioaddr)
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_rx_interrupt (struct net_device *dev, struct rtl8169_private *priv, unsigned long ioaddr)
- {
-- unsigned int cur_rx, rx_left, count;
-- int delta;
-+ struct pci_dev *pdev = priv->pci_dev;
-+ int cur_rx;
-+ int pkt_size = 0 ;
-+ int rxdesc_cnt = 0;
-+ int ret;
-+ struct sk_buff *n_skb = NULL;
-+ struct sk_buff *cur_skb;
-+ struct sk_buff *rx_skb;
-+ struct RxDesc *rxdesc;
-
-- assert(dev != NULL);
-- assert(tp != NULL);
-- assert(ioaddr != NULL);
-+ assert (dev != NULL);
-+ assert (priv != NULL);
-+ assert (ioaddr != NULL);
-
-- cur_rx = tp->cur_rx;
-- rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx;
-- rx_left = rtl8169_rx_quota(rx_left, (u32) dev->quota);
-
-- while (rx_left > 0) {
-- unsigned int entry = cur_rx % NUM_RX_DESC;
-- u32 status;
-+ cur_rx = priv->cur_rx;
-
-- rmb();
-- status = le32_to_cpu(tp->RxDescArray[entry].status);
-+ rxdesc = &priv->RxDescArray[cur_rx];
-+ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
-
-- if (status & OWNbit)
-- break;
-- if (status & RxRES) {
-+ while ( ((le32_to_cpu(rxdesc->status) & OWNbit)== 0) && (rxdesc_cnt < max_interrupt_work) ){
-+
-+ rxdesc_cnt++;
-+
-+ if( le32_to_cpu(rxdesc->status) & RxRES ){
- printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
-- tp->stats.rx_errors++;
-- if (status & (RxRWT | RxRUNT))
-- tp->stats.rx_length_errors++;
-- if (status & RxCRC)
-- tp->stats.rx_crc_errors++;
-- } else {
-- struct RxDesc *desc = tp->RxDescArray + entry;
-- struct sk_buff *skb = tp->Rx_skbuff[entry];
-- int pkt_size = (status & 0x00001FFF) - 4;
-- void (*pci_action)(struct pci_dev *, dma_addr_t,
-- size_t, int) = pci_dma_sync_single_for_device;
--
--
-- pci_dma_sync_single_for_cpu(tp->pci_dev,
-- le64_to_cpu(desc->addr), RX_BUF_SIZE,
-- PCI_DMA_FROMDEVICE);
--
-- if (rtl8169_try_rx_copy(&skb, pkt_size, desc, dev)) {
-- pci_action = pci_unmap_single;
-- tp->Rx_skbuff[entry] = NULL;
-+ priv->stats.rx_errors++;
-+ if ( le32_to_cpu(rxdesc->status) & (RxRWT|RxRUNT) )
-+ priv->stats.rx_length_errors++;
-+ if ( le32_to_cpu(rxdesc->status) & RxCRC)
-+ priv->stats.rx_crc_errors++;
-+ }
-+ else{
-+ pkt_size=(int)(le32_to_cpu(rxdesc->status) & 0x00001FFF)-4;
-+
-+ if( pkt_size > priv->rx_pkt_len ){
-+ printk("%s: Error -- Rx packet size(%d) > mtu(%d)+14\n", dev->name, pkt_size, dev->mtu);
-+ pkt_size = priv->rx_pkt_len;
- }
-
-- pci_action(tp->pci_dev, le64_to_cpu(desc->addr),
-- RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
-+ DBG_PRINT("%s: RX pkt_size = %d\n", __FUNCTION__, pkt_size);
-+
-+ {// -----------------------------------------------------
-+ rx_skb = priv->Rx_skbuff[cur_rx];
-+ n_skb = RTL8169_ALLOC_RXSKB(MAX_RX_SKBDATA_SIZE);
-+ if( n_skb != NULL ) {
-+ skb_reserve (n_skb, 2); // 16 byte align the IP fields. //
-+
-+ // Indicate rx_skb
-+ if( rx_skb != NULL ){
-+ rx_skb->dev = dev;
-+ pci_dma_sync_single(pdev, priv->rx_skbuff_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
-+
-+ skb_put ( rx_skb, pkt_size );
-+ rx_skb->protocol = eth_type_trans ( rx_skb, dev );
-+ ret = RTL8169_NETIF_RX (rx_skb);
-+
-+// dev->last_rx = jiffies;
-+ priv->stats.rx_bytes += pkt_size;
-+ priv->stats.rx_packets++;
-+
-+#ifdef RTL8169_DYNAMIC_CONTROL
-+ r8169_callback_rx( &(priv->rt), 1, pkt_size);
-+#endif //end #ifdef RTL8169_DYNAMIC_CONTROL
-+
-+ }//end if( rx_skb != NULL )
-+
-+ priv->Rx_skbuff[cur_rx] = n_skb;
-+ }
-+ else{
-+ DBG_PRINT("%s: Allocate n_skb failed!\n",__FUNCTION__ );
-+ priv->Rx_skbuff[cur_rx] = rx_skb;
-+ }
-
-- skb_put(skb, pkt_size);
-- skb->protocol = eth_type_trans(skb, dev);
-- rtl8169_rx_skb(skb);
--
-- dev->last_rx = jiffies;
-- tp->stats.rx_bytes += pkt_size;
-- tp->stats.rx_packets++;
-- }
--
-- cur_rx++;
-- rx_left--;
-- }
-
-- count = cur_rx - tp->cur_rx;
-- tp->cur_rx = cur_rx;
-+ // Update rx descriptor
-+ if( cur_rx == (NUM_RX_DESC-1) ){
-+ priv->RxDescArray[cur_rx].status = cpu_to_le32((OWNbit | EORbit) | (unsigned long)priv->hw_rx_pkt_len);
-+ }
-+ else{
-+ priv->RxDescArray[cur_rx].status = cpu_to_le32(OWNbit | (unsigned long)priv->hw_rx_pkt_len);
-+ }
-
-- delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx);
-- if (delta < 0) {
-- printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name);
-- delta = 0;
-- }
-- tp->dirty_rx += delta;
--
-- /*
-- * FIXME: until there is periodic timer to try and refill the ring,
-- * a temporary shortage may definitely kill the Rx process.
-- * - disable the asic to try and avoid an overflow and kick it again
-- * after refill ?
-- * - how do others driver handle this condition (Uh oh...).
-- */
-- if (tp->dirty_rx + NUM_RX_DESC == tp->cur_rx)
-- printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name);
-+ cur_skb = priv->Rx_skbuff[cur_rx];
-
-- return count;
-+ if( cur_skb != NULL ){
-+ priv->rx_skbuff_dma_addr[cur_rx] = pci_map_single(pdev, cur_skb->data, MAX_RX_SKBDATA_SIZE, PCI_DMA_FROMDEVICE);
-+ rxdesc->buf_addr = cpu_to_le32(priv->rx_skbuff_dma_addr[cur_rx]);
-+ }
-+ else{
-+ DBG_PRINT("%s: %s() cur_skb == NULL\n", dev->name, __FUNCTION__);
-+ }
-+
-+ }//------------------------------------------------------------
-+
-+ }// end of if( priv->RxDescArray[cur_rx].status & RxRES )
-+
-+ cur_rx = (cur_rx +1) % NUM_RX_DESC;
-+ rxdesc = &priv->RxDescArray[cur_rx];
-+ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
-+
-+ }// end of while ( (priv->RxDescArray[cur_rx].status & 0x80000000)== 0)
-+
-+ if( rxdesc_cnt >= max_interrupt_work ){
-+ DBG_PRINT("%s: Too much work at Rx interrupt.\n", dev->name);
-+ }
-+
-+ priv->cur_rx = cur_rx;
- }
-
-+
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
- /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */
--static irqreturn_t
--rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+static void rtl8169_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
-+#else
-+static irqreturn_t rtl8169_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
-+#endif
- {
- struct net_device *dev = (struct net_device *) dev_instance;
-- struct rtl8169_private *tp = netdev_priv(dev);
-+ struct rtl8169_private *priv = dev->priv;
- int boguscnt = max_interrupt_work;
-- void *ioaddr = tp->mmio_addr;
-+ unsigned long ioaddr = priv->ioaddr;
- int status = 0;
-- int handled = 0;
-+ irqreturn_t interrupt_handled = IRQ_NONE;
-+
-+ RTL_W16 ( IntrMask, 0x0000);
-
- do {
- status = RTL_R16(IntrStatus);
-
-- /* hotplug/major error/no more work/shared irq */
-- if ((status == 0xFFFF) || !status)
-+ if (status == 0xFFFF)
- break;
-
-- handled = 1;
-
-- status &= tp->intr_mask;
-- RTL_W16(IntrStatus,
-- (status & RxFIFOOver) ? (status | RxOverflow) : status);
-+ RTL_W16( IntrStatus, status );
-
-- if (!(status & rtl8169_intr_mask))
-- break;
-
-- if (unlikely(status & SYSErr)) {
-- printk(KERN_ERR PFX "%s: PCI error (status: 0x%04x)."
-- " Device disabled.\n", dev->name, status);
-- RTL_W8(ChipCmd, 0x00);
-- RTL_W16(IntrMask, 0x0000);
-- RTL_R16(IntrMask);
-+ if ( (status & rtl8169_intr_mask ) == 0 )
- break;
-- }
-+ else
-+ interrupt_handled = IRQ_HANDLED;
-
-- if (status & LinkChg)
-- rtl8169_check_link_status(dev, tp, ioaddr);
-
--#ifdef CONFIG_R8169_NAPI
-- RTL_W16(IntrMask, rtl8169_intr_mask & ~rtl8169_napi_event);
-- tp->intr_mask = ~rtl8169_napi_event;
--
-- if (likely(netif_rx_schedule_prep(dev)))
-- __netif_rx_schedule(dev);
-- else {
-- printk(KERN_INFO "%s: interrupt %x taken in poll\n",
-- dev->name, status);
-- }
-- break;
--#else
-- // Rx interrupt
-- if (status & (RxOK | RxOverflow | RxFIFOOver)) {
-- rtl8169_rx_interrupt(dev, tp, ioaddr);
-- }
-+ // Rx interrupt
-+// if (status & (RxOK | RxErr /* | LinkChg | RxOverflow | RxFIFOOver*/)){
-+ rtl8169_rx_interrupt (dev, priv, ioaddr);
-+// }
-+
- // Tx interrupt
-- if (status & (TxOK | TxErr))
-- rtl8169_tx_interrupt(dev, tp, ioaddr);
--#endif
-+// if (status & (TxOK | TxErr)) {
-+ spin_lock (&priv->lock);
-+ rtl8169_tx_interrupt (dev, priv, ioaddr);
-+ spin_unlock (&priv->lock);
-+// }
-
- boguscnt--;
- } while (boguscnt > 0);
-
- if (boguscnt <= 0) {
-- printk(KERN_WARNING "%s: Too much work at interrupt!\n",
-- dev->name);
-- /* Clear all interrupt sources. */
-- RTL_W16(IntrStatus, 0xffff);
-+ DBG_PRINT("%s: Too much work at interrupt!\n", dev->name);
-+ RTL_W16( IntrStatus, 0xffff); // Clear all interrupt sources
- }
-- return IRQ_RETVAL(handled);
-+
-+ RTL_W16 ( IntrMask, rtl8169_intr_mask);
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-+ return interrupt_handled;
-+#endif
- }
-
--#ifdef CONFIG_R8169_NAPI
--static int rtl8169_poll(struct net_device *dev, int *budget)
--{
-- unsigned int work_done, work_to_do = min(*budget, dev->quota);
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-
-- work_done = rtl8169_rx_interrupt(dev, tp, ioaddr);
-- rtl8169_tx_interrupt(dev, tp, ioaddr);
-
-- *budget -= work_done;
-- dev->quota -= work_done;
-
-- if ((work_done < work_to_do) || !netif_running(dev)) {
-- netif_rx_complete(dev);
-- tp->intr_mask = 0xffff;
-- /*
-- * 20040426: the barrier is not strictly required but the
-- * behavior of the irq handler could be less predictable
-- * without it. Btw, the lack of flush for the posted pci
-- * write is safe - FR
-- */
-- smp_wmb();
-- RTL_W16(IntrMask, rtl8169_intr_mask);
-- }
-
-- return (work_done >= work_to_do);
--}
--#endif
-
--static int
--rtl8169_close(struct net_device *dev)
-+
-+//======================================================================================================
-+static int rtl8169_close (struct net_device *dev)
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- struct pci_dev *pdev = tp->pci_dev;
-- void *ioaddr = tp->mmio_addr;
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
-+ int i;
-
-- netif_stop_queue(dev);
-+ // -----------------------------------------
-+ rtl8169_delete_timer( &(priv->r8169_timer) );
-
-- rtl8169_delete_timer(dev);
-
-- spin_lock_irq(&tp->lock);
-+ netif_stop_queue (dev);
-
-- /* Stop the chip's Tx and Rx DMA processes. */
-- RTL_W8(ChipCmd, 0x00);
-+ spin_lock_irq (&priv->lock);
-+
-+ /* Stop the chip's Tx and Rx processes. */
-+ RTL_W8 ( ChipCmd, 0x00);
-
- /* Disable interrupts by clearing the interrupt mask. */
-- RTL_W16(IntrMask, 0x0000);
-+ RTL_W16 ( IntrMask, 0x0000);
-
- /* Update the error counts. */
-- tp->stats.rx_missed_errors += RTL_R32(RxMissed);
-- RTL_W32(RxMissed, 0);
--
-- spin_unlock_irq(&tp->lock);
-+ priv->stats.rx_missed_errors += RTL_R32(RxMissed);
-+ RTL_W32( RxMissed, 0);
-
-- synchronize_irq(dev->irq);
-- free_irq(dev->irq, dev);
-+ spin_unlock_irq (&priv->lock);
-
-- rtl8169_tx_clear(tp);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ synchronize_irq ();
-+#else
-+ synchronize_irq (dev->irq);
-+#endif
-+ free_irq (dev->irq, dev);
-
-- rtl8169_rx_clear(tp);
-+ rtl8169_tx_clear (priv);
-+
-+ //2004-05-11
-+ if(priv->txdesc_space != NULL){
-+ pci_free_consistent(
-+ priv->pci_dev,
-+ priv->sizeof_txdesc_space,
-+ priv->txdesc_space,
-+ priv->txdesc_phy_dma_addr
-+ );
-+ priv->txdesc_space = NULL;
-+ }
-+
-+ if(priv->rxdesc_space != NULL){
-+ pci_free_consistent(
-+ priv->pci_dev,
-+ priv->sizeof_rxdesc_space,
-+ priv->rxdesc_space,
-+ priv->rxdesc_phy_dma_addr
-+ );
-+ priv->rxdesc_space = NULL;
-+ }
-+
-+ priv->TxDescArray = NULL;
-+ priv->RxDescArray = NULL;
-+
-+ {//-----------------------------------------------------------------------------
-+ for(i=0;i<NUM_RX_DESC;i++){
-+ if( priv->Rx_skbuff[i] != NULL ) {
-+ RTL8169_FREE_RXSKB ( priv->Rx_skbuff[i] );
-+ }
-+ }
-+ }//-----------------------------------------------------------------------------
-
-- pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
-- tp->RxPhyAddr);
-- pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray,
-- tp->TxPhyAddr);
-- tp->TxDescArray = NULL;
-- tp->RxDescArray = NULL;
-+ DBG_PRINT("%s: %s() alloc_rxskb_cnt = %d\n", dev->name, __FUNCTION__, alloc_rxskb_cnt );
-
- return 0;
- }
-
--static void
--rtl8169_set_rx_mode(struct net_device *dev)
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static unsigned const ethernet_polynomial = 0x04c11db7U;
-+static inline u32 ether_crc (int length, unsigned char *data)
-+{
-+ int crc = -1;
-+
-+ while (--length >= 0) {
-+ unsigned char current_octet = *data++;
-+ int bit;
-+ for (bit = 0; bit < 8; bit++, current_octet >>= 1)
-+ crc = (crc << 1) ^ ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0);
-+ }
-+
-+ return crc;
-+}
-+
-+
-+
-+
-+
-+
-+
-+
-+//======================================================================================================
-+static void rtl8169_set_rx_mode (struct net_device *dev)
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
- unsigned long flags;
- u32 mc_filter[2]; /* Multicast hash filter */
- int i, rx_mode;
-- u32 tmp = 0;
-+ u32 tmp=0;
-+
-
- if (dev->flags & IFF_PROMISC) {
- /* Unconditionally log net taps. */
-- printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n",
-- dev->name);
-- rx_mode =
-- AcceptBroadcast | AcceptMulticast | AcceptMyPhys |
-- AcceptAllPhys;
-+ printk (KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
-+ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys;
- mc_filter[1] = mc_filter[0] = 0xffffffff;
-- } else if ((dev->mc_count > multicast_filter_limit)
-- || (dev->flags & IFF_ALLMULTI)) {
-+ } else if ((dev->mc_count > multicast_filter_limit) || (dev->flags & IFF_ALLMULTI)) {
- /* Too many to filter perfectly -- accept all multicasts. */
- rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
- mc_filter[1] = mc_filter[0] = 0xffffffff;
- } else {
- struct dev_mc_list *mclist;
-- rx_mode = AcceptBroadcast | AcceptMyPhys;
-+ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
- mc_filter[1] = mc_filter[0] = 0;
-- for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-- i++, mclist = mclist->next) {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-+ for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; i++, mclist = mclist->next)
-+ {
-+ set_bit (ether_crc (ETH_ALEN, mclist->dmi_addr) >> 26, mc_filter);
-+ }
-+#else
-+ for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; i++, mclist = mclist->next)
-+ {
- int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
-+
- mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
- rx_mode |= AcceptMulticast;
- }
-+#endif
- }
-
-- spin_lock_irqsave(&tp->lock, flags);
-+ spin_lock_irqsave (&priv->lock, flags);
-+
-+ tmp = rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) & rtl_chip_info[priv->chipset].RxConfigMask);
-+
-+ RTL_W32 ( RxConfig, tmp);
-+ RTL_W32 ( MAR0 + 0, mc_filter[0]);
-+ RTL_W32 ( MAR0 + 4, mc_filter[1]);
-+
-+ spin_unlock_irqrestore (&priv->lock, flags);
-+
-+}//end of rtl8169_set_rx_mode (struct net_device *dev)
-+
-+
-+
-
-- tmp = rtl8169_rx_config | rx_mode |
-- (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask);
-
-- RTL_W32(RxConfig, tmp);
-- RTL_W32(MAR0 + 0, mc_filter[0]);
-- RTL_W32(MAR0 + 4, mc_filter[1]);
-
-- spin_unlock_irqrestore(&tp->lock, flags);
--}
-
--/**
-- * rtl8169_get_stats - Get rtl8169 read/write statistics
-- * @dev: The Ethernet Device to get statistics for
-- *
-- * Get TX/RX statistics for rtl8169
-- */
--static struct net_device_stats *rtl8169_get_stats(struct net_device *dev)
-+//================================================================================
-+struct net_device_stats *rtl8169_get_stats(struct net_device *dev)
-+
- {
-- struct rtl8169_private *tp = netdev_priv(dev);
-- void *ioaddr = tp->mmio_addr;
-- unsigned long flags;
-+ struct rtl8169_private *priv = dev->priv;
-
-- if (netif_running(dev)) {
-- spin_lock_irqsave(&tp->lock, flags);
-- tp->stats.rx_missed_errors += RTL_R32(RxMissed);
-- RTL_W32(RxMissed, 0);
-- spin_unlock_irqrestore(&tp->lock, flags);
-- }
--
-- return &tp->stats;
-+ return &priv->stats;
- }
-
-+
-+
-+
-+
-+
-+
-+
-+//================================================================================
- static struct pci_driver rtl8169_pci_driver = {
-- .name = MODULENAME,
-- .id_table = rtl8169_pci_tbl,
-- .probe = rtl8169_init_one,
-- .remove = __devexit_p(rtl8169_remove_one),
--#ifdef CONFIG_PM
-- .suspend = rtl8169_suspend,
-- .resume = rtl8169_resume,
--#endif
-+ name: MODULENAME,
-+ id_table: rtl8169_pci_tbl,
-+ probe: rtl8169_init_one,
-+ remove: rtl8169_remove_one,
-+ suspend: NULL,
-+ resume: NULL,
- };
-
--static int __init
--rtl8169_init_module(void)
-+
-+
-+
-+
-+//======================================================================================================
-+static int __init rtl8169_init_module (void)
- {
-- return pci_module_init(&rtl8169_pci_driver);
-+ return pci_module_init (&rtl8169_pci_driver); // pci_register_driver (drv)
- }
-
--static void __exit
--rtl8169_cleanup_module(void)
-+
-+
-+
-+//======================================================================================================
-+static void __exit rtl8169_cleanup_module (void)
-+{
-+ pci_unregister_driver (&rtl8169_pci_driver);
-+}
-+
-+
-+#ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
- {
-- pci_unregister_driver(&rtl8169_pci_driver);
-+ struct rtl8169_private *priv = dev->priv;
-+ unsigned long ioaddr = priv->ioaddr;
-+
-+ if( new_mtu > MAX_JUMBO_FRAME_MTU ){
-+ printk("%s: Error -- new_mtu(%d) > MAX_JUMBO_FRAME_MTU(%d).\n", dev->name, new_mtu, MAX_JUMBO_FRAME_MTU);
-+ return -1;
-+ }
-+
-+ dev->mtu = new_mtu;
-+
-+ priv->curr_mtu_size = new_mtu;
-+ priv->tx_pkt_len = new_mtu + ETH_HDR_LEN;
-+ priv->rx_pkt_len = new_mtu + ETH_HDR_LEN;
-+ priv->hw_rx_pkt_len = priv->rx_pkt_len + 8;
-+
-+ RTL_W8 ( Cfg9346, Cfg9346_Unlock);
-+ RTL_W16 ( RxMaxSize, (unsigned short)priv->hw_rx_pkt_len );
-+ RTL_W8 ( Cfg9346, Cfg9346_Lock);
-+
-+ DBG_PRINT("-------------------------- \n");
-+ DBG_PRINT("dev->mtu = %d \n", dev->mtu);
-+ DBG_PRINT("priv->curr_mtu_size = %d \n", priv->curr_mtu_size);
-+ DBG_PRINT("priv->rx_pkt_len = %d \n", priv->rx_pkt_len);
-+ DBG_PRINT("priv->tx_pkt_len = %d \n", priv->tx_pkt_len);
-+ DBG_PRINT("RTL_W16( RxMaxSize, %d )\n", priv->hw_rx_pkt_len);
-+ DBG_PRINT("-------------------------- \n");
-+
-+ rtl8169_close (dev);
-+ rtl8169_open (dev);
-+
-+ return 0;
- }
-+#endif //end #ifdef RTL8169_JUMBO_FRAME_SUPPORT
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-
-+//======================================================================================================
- module_init(rtl8169_init_module);
- module_exit(rtl8169_cleanup_module);
diff --git a/openvz-sources/023.030/5127_linux-2.6.9-sk98lin-8.31.2.3.patch b/openvz-sources/023.030/5127_linux-2.6.9-sk98lin-8.31.2.3.patch
deleted file mode 100644
index 1eb0190..0000000
--- a/openvz-sources/023.030/5127_linux-2.6.9-sk98lin-8.31.2.3.patch
+++ /dev/null
@@ -1,42467 +0,0 @@
---- ./Documentation/networking/sk98lin.txt.sk98 2004-10-19 01:54:38.000000000 +0400
-+++ ./Documentation/networking/sk98lin.txt 2006-09-08 11:01:19.000000000 +0400
-@@ -1,38 +1,56 @@
--(C)Copyright 1999-2004 Marvell(R).
--All rights reserved
--===========================================================================
-+(C)Copyright 1999-2006 Marvell(R).
-+All rights reserved.
-+================================================================================
-
--sk98lin.txt created 13-Feb-2004
-+sk98lin.txt created 18-Jan-2006
-
--Readme File for sk98lin v6.23
--Marvell Yukon/SysKonnect SK-98xx Gigabit Ethernet Adapter family driver for LINUX
-+Readme File for sk98lin v8.31.2.3
-+Marvell Yukon/SysKonnect SK-98xx Gigabit Ethernet Adapter driver for LINUX
-
- This file contains
- 1 Overview
-- 2 Required Files
-- 3 Installation
-- 3.1 Driver Installation
-- 3.2 Inclusion of adapter at system start
-- 4 Driver Parameters
-- 4.1 Per-Port Parameters
-- 4.2 Adapter Parameters
-- 5 Large Frame Support
-- 6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
-- 7 Troubleshooting
-+ 2 Supported Functions
-+ 3 Required Files
-+ 4 Installation
-+ 4.1 Driver Installation
-+ 4.2 Inclusion of adapter at system start
-+ 5 Driver Parameters
-+ 5.1 Per-Port Parameters
-+ 5.2 Adapter Parameters
-+ 6 Ethtool Support
-+ 7 Large Frame Support
-+ 8 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
-+ 9 Wake on Lan support
-+10 Troubleshooting
-
--===========================================================================
-+================================================================================
-
-
- 1 Overview
- ===========
-
--The sk98lin driver supports the Marvell Yukon and SysKonnect
--SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter on Linux. It has
--been tested with Linux on Intel/x86 machines.
-+The sk98lin driver supports the Marvell Yukon, Yukon EC/FE, Yukon 2
-+and SysKonnect SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter on Linux.
-+It has been tested with Linux on Intel/x86, x86_64 and IA64 machines.
- ***
-
-+2 Supported Functions
-+======================
-+
-+The following functions are supported by the driver:
-
--2 Required Files
-+ NOTE 1: The hardware support depends on the used card
-+
-+ - RX/TX HW Checksum
-+ - Hardware interrupt moderation (static/dynamic)
-+ - Transmit poll
-+ - Zerocopy/Scatter-Gather
-+ - Ethtool support
-+ - Wake on Lan (Magic Packet only) (From suspend and APM only)
-+ - DualNet
-+
-+
-+3 Required Files
- =================
-
- The linux kernel source.
-@@ -40,16 +58,14 @@ No additional files required.
- ***
-
-
--3 Installation
-+4 Installation
- ===============
-
- It is recommended to download the latest version of the driver from the
--SysKonnect web site www.syskonnect.com. If you have downloaded the latest
--driver, the Linux kernel has to be patched before the driver can be
--installed. For details on how to patch a Linux kernel, refer to the
--patch.txt file.
-+SysKonnect web site www.syskonnect.com. For details on Installation
-+Instructions for sk98lin Driver, please refer to the README.txt file.
-
--3.1 Driver Installation
-+4.1 Driver Installation
- ------------------------
-
- The following steps describe the actions that are required to install
-@@ -110,13 +126,13 @@ To load the module manually, proceed as
-
- NOTE 1: If you have more than one Marvell Yukon or SysKonnect SK-98xx
- adapter installed, the adapters will be listed as 'eth0',
-- 'eth1', 'eth2', etc.
-- For each adapter, repeat steps 3 and 4 below.
-+ 'eth1', 'eth2', etc.
-+ For each adapter, repeat steps 3 and 4 below.
-
- NOTE 2: If you have other Ethernet adapters installed, your Marvell
- Yukon or SysKonnect SK-98xx adapter will be mapped to the
-- next available number, e.g. 'eth1'. The mapping is executed
-- automatically.
-+ next available number, e.g. 'eth1'. The mapping is executed
-+ automatically.
- The module installation message (displayed either in a system
- log file or on the console) prints a line for each adapter
- found containing the corresponding 'ethX'.
-@@ -153,7 +169,7 @@ To stop and unload the driver modules, p
- 1. Execute the command "ifconfig eth0 down".
- 2. Execute the command "rmmod sk98lin".
-
--3.2 Inclusion of adapter at system start
-+4.2 Inclusion of adapter at system start
- -----------------------------------------
-
- Since a large number of different Linux distributions are
-@@ -165,7 +181,8 @@ Refer to the distribution's manual for i
-
- ***
-
--4 Driver Parameters
-+
-+5 Driver Parameters
- ====================
-
- Parameters can be set at the command line after the module has been
-@@ -174,7 +191,7 @@ In some distributions, the configuration
- to the driver module.
-
- If you use the kernel module loader, you can set driver parameters
--in the file /etc/modprobe.conf (or /etc/modules.conf in 2.4 or earlier).
-+in the file /etc/modules.conf (or old name: /etc/conf.modules).
- To set the driver parameters in this file, proceed as follows:
-
- 1. Insert a line of the form :
-@@ -208,7 +225,7 @@ NOTE: The number of adapters that can be
- more adapters, adjust this and recompile.
-
-
--4.1 Per-Port Parameters
-+5.1 Per-Port Parameters
- ------------------------
-
- These settings are available for each port on the adapter.
-@@ -282,7 +299,7 @@ establishment. If this fails, a port can
- with this parameter.
-
-
--4.2 Adapter Parameters
-+5.2 Adapter Parameters
- -----------------------
-
- Connection Type (SK-98xx V2.0 copper adapters only)
-@@ -379,7 +396,6 @@ second) seems to be meaningful, but the
- is tremendous. On the other hand, selecting a very short moderation time might
- compensate the use of any moderation being applied.
-
--
- Preferred Port
- --------------
- Parameter: PrefPort
-@@ -394,7 +410,7 @@ RLMT Mode (Redundant Link Management Tec
- ------------------------------------------------
- Parameter: RlmtMode
- Values: CheckLinkState,CheckLocalPort, CheckSeg, DualNet
--Default: CheckLinkState
-+Default: CheckLinkState (DualNet on dual port adapters)
-
- RLMT monitors the status of the port. If the link of the active port
- fails, RLMT switches immediately to the standby link. The virtual link is
-@@ -429,10 +445,94 @@ NOTE: RLMT modes CLP and CLPSS are desig
- where a network path between the ports on one adapter exists.
- Moreover, they are not designed to work where adapters are connected
- back-to-back.
-+
-+LowLatency
-+----------
-+Parameter: LowLatency
-+Values: On, Off
-+Default: Off
-+
-+This is used to reduce the packet latency time of the adapter. Setting the
-+LowLatency parameter to 'On' forces the adapter to pass any received packet
-+immediately to upper network layers and to send out any transmit packet as
-+fast as possible.
-+
-+NOTE 1: The system load increases if LowLatency is set to 'On' and a lot
-+ of data packets are transmitted and received.
-+
-+NOTE 2: This parameter is only used on adapters which are based on
-+ PCI Express compatible chipsets.
- ***
-
-
--5 Large Frame Support
-+6 Ethtool Support
-+==================
-+
-+The sk98lin driver provides built-in ethtool support. The ethtool
-+can be used to display or modify interface specific configurations.
-+
-+Ethtool commands are invoked using a single parameter which reflects
-+the requested ethtool command plus an optional number of parameters
-+which belong to the desired command.
-+
-+It is not the intention of this section to explain the ethtool command
-+line tool and all its options. For further information refer to the
-+manpage of the ethtool. This sections describes only the sk98lin
-+driver supported ethtool commands.
-+
-+Pause Parameters
-+----------------
-+Query command: -a
-+Set command: -A [autoneg on|off] [rx on|off] [tx on|off]
-+Sample: ethtool -A eth0 rx off tx off
-+
-+Coalescing Parameters
-+---------------------
-+Query command: -c
-+Set command: -C [sample-interval I]
-+ [rx-usecs N] [tx-usecs N]
-+ [rx-usecs-low N] [tx-usecs-low N]
-+ [rx-usecs-high N] [tx-usecs-high N]
-+Parameter: I = Length of sample interval, in seconds
-+ (supported values range from 1...10)
-+ N = Length of coalescing interval, in microseconds
-+ (supported values range from 25...33,333)
-+Sample: ethtool -C eth2 rx-usecs 500 tx-usecs 500
-+
-+NOTE: The sk98lin driver does not support different settings
-+ for the rx and tx interrupt coalescing parameters.
-+
-+Driver Information
-+------------------
-+Query command: -i
-+Sample: ethtool -i eth1
-+
-+Checksumming Parameters
-+-----------------------
-+Query command: -k
-+Set command: -K [rx on|off] [tx on|off] [sg on|off]
-+Sample: ethtool -K eth0 sg off
-+
-+Locate NIC Command
-+------------------
-+Query command: -p [N]
-+Parameter: N = Amount of time to perform locate NIC command, in seconds
-+Sample: ethtool -p 10 eth1
-+
-+Driver-specific Statistics
-+--------------------------
-+Query command: -S
-+Sample: ethtool -S eth0
-+
-+Setting Parameters
-+------------------
-+Set command: -s [speed 10|100|1000] [duplex half|full]
-+ [autoneg on|off] [wol gd]
-+Sample: ethtool -s eth2 wol d
-+***
-+
-+
-+7 Large Frame Support
- ======================
-
- The driver supports large frames (also called jumbo frames). Using large
-@@ -444,10 +544,10 @@ command:
- ifconfig eth0 mtu 9000
- This will only work if you have two adapters connected back-to-back
- or if you use a switch that supports large frames. When using a switch,
--it should be configured to allow large frames and auto-negotiation should
--be set to OFF. The setting must be configured on all adapters that can be
--reached by the large frames. If one adapter is not set to receive large
--frames, it will simply drop them.
-+it should be configured to allow large frames. The setting must be
-+configured on all adapters that can be reached by the large frames.
-+If one adapter is not set to receive large frames, it will simply drop
-+them.
-
- You can switch back to the standard ethernet frame size by executing the
- following command:
-@@ -459,7 +559,7 @@ in /etc/rc.d/rc2.d).
- ***
-
-
--6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
-+8 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
- ==================================================================
-
- The Marvell Yukon/SysKonnect Linux drivers are able to support VLAN and
-@@ -477,8 +577,21 @@ NOTE: Configuring Link Aggregation on a
- cause problems when unloading the driver.
-
-
--7 Troubleshooting
--==================
-+9 Wake on Lan support
-+======================
-+
-+The sk98lin driver supports wake up from suspend mode with MagicPacket
-+on APM systems. Wake on Lan support is enabled by default. To disable it
-+please use the ethtool.
-+
-+NOTE 1: APM support has to be enabled in BIOS and in the kernel.
-+
-+NOTE 2: Refer to the kernel documentation for additional requirements
-+ regarding APM support.
-+
-+
-+10 Troubleshooting
-+===================
-
- If any problems occur during the installation process, check the
- following list:
---- ./drivers/net/Kconfig.sk98 2006-09-08 10:55:56.000000000 +0400
-+++ ./drivers/net/Kconfig 2006-09-08 10:57:53.000000000 +0400
-@@ -2063,6 +2063,22 @@ config SK98LIN
- by this driver:
- - 3Com 3C940 Gigabit LOM Ethernet Adapter
- - 3Com 3C941 Gigabit LOM Ethernet Adapter
-+ - 88E8021 Marvell 1000 Mbit PCI-X, single Port Copper
-+ - 88E8021 Marvell 1000 Mbit PCI-X, single Port Fiber LX
-+ - 88E8021 Marvell 1000 Mbit PCI-X, single Port Fiber SX
-+ - 88E8022 Marvell 1000 Mbit PCI-X, dual Port Copper
-+ - 88E8022 Marvell 1000 Mbit PCI-X, dual Port Copper (Gateway)
-+ - 88E8022 Marvell 1000 Mbit PCI-X, dual Port Fiber LX
-+ - 88E8022 Marvell 1000 Mbit PCI-X, dual Port Fiber SX
-+ - 88E8061 Marvell 1000 Mbit PCI-E, single Port Copper
-+ - 88E8061 Marvell 1000 Mbit PCI-E, single Port Fiber LX
-+ - 88E8061 Marvell 1000 Mbit PCI-E, single Port Fiber SX
-+ - 88E8062 Marvell 1000 Mbit PCI-E, dual Port Copper
-+ - 88E8062 Marvell 1000 Mbit PCI-E, dual Port Copper (Gateway)
-+ - 88E8062 Marvell 1000 Mbit PCI-E, dual Port Fiber LX
-+ - 88E8062 Marvell 1000 Mbit PCI-E, dual Port Fiber SX
-+ - Abocom EFE3K - 10/100 Ethernet Expresscard
-+ - Abocom EGE5K - Giga Ethernet Expresscard
- - Allied Telesyn AT-2970LX Gigabit Ethernet Adapter
- - Allied Telesyn AT-2970LX/2SC Gigabit Ethernet Adapter
- - Allied Telesyn AT-2970SX Gigabit Ethernet Adapter
-@@ -2073,31 +2089,81 @@ config SK98LIN
- - Allied Telesyn AT-2971T Gigabit Ethernet Adapter
- - Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45
- - DGE-530T Gigabit Ethernet Adapter
-+ - DGE-560T Gigabit Ethernet Adapter
- - EG1032 v2 Instant Gigabit Network Adapter
- - EG1064 v2 Instant Gigabit Network Adapter
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Albatron)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Asus)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (ECS)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Epox)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Foxconn)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Gigabyte)
-- - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Iwill)
-- - Marvell 88E8050 Gigabit LOM Ethernet Adapter (Intel)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Abit)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Albatron)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Asus)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Chaintech)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (ECS)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Epox)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Foxconn)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Gigabyte)
-+ - Marvell 88E8001 Gigabit Ethernet Controller (Iwill)
-+ - Marvell 88E8035 Fast Ethernet Controller (LGE)
-+ - Marvell 88E8035 Fast Ethernet Controller (Toshiba)
-+ - Marvell 88E8036 Fast Ethernet Controller (Arima)
-+ - Marvell 88E8036 Fast Ethernet Controller (Compal)
-+ - Marvell 88E8036 Fast Ethernet Controller (Inventec)
-+ - Marvell 88E8036 Fast Ethernet Controller (LGE)
-+ - Marvell 88E8036 Fast Ethernet Controller (Mitac)
-+ - Marvell 88E8036 Fast Ethernet Controller (Panasonic)
-+ - Marvell 88E8036 Fast Ethernet Controller (Quanta)
-+ - Marvell 88E8036 Fast Ethernet Controller (Toshiba)
-+ - Marvell 88E8036 Fast Ethernet Controller (Wistron)
-+ - Marvell 88E8050 Gigabit Ethernet Controller (Gateway)
-+ - Marvell 88E8050 Gigabit Ethernet Controller (Intel)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (ASRock)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (Aopen)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (Asus)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (Gateway)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (Gigabyte)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (MSI)
-+ - Marvell 88E8052 Gigabit Ethernet Controller (Wistron)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (ASRock)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Albatron)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Aopen)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Arima)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Asus)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Chaintech)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Clevo)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Compal)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (DFI)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (ECS)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Epox)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Gigabyte)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Inventec)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (LGE)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (MSI)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Mitac)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Panasonic)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Quanta)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (SOYO)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Toshiba)
-+ - Marvell 88E8053 Gigabit Ethernet Controller (Trigem)
-+ - Marvell RDK-8001
- - Marvell RDK-8001 Adapter
- - Marvell RDK-8002 Adapter
-+ - Marvell RDK-8003
- - Marvell RDK-8003 Adapter
- - Marvell RDK-8004 Adapter
- - Marvell RDK-8006 Adapter
- - Marvell RDK-8007 Adapter
- - Marvell RDK-8008 Adapter
- - Marvell RDK-8009 Adapter
-- - Marvell RDK-8010 Adapter
-+ - Marvell RDK-8010
- - Marvell RDK-8011 Adapter
- - Marvell RDK-8012 Adapter
-- - Marvell RDK-8052 Adapter
-- - Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (32 bit)
-- - Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (64 bit)
-+ - Marvell RDK-8035
-+ - Marvell RDK-8036
-+ - Marvell RDK-8052
-+ - Marvell RDK-8053
-+ - Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Controller (32 bit)
-+ - Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Controller (64 bit)
-+ - Marvell Yukon-EC Ultra, no ASF (Battery Power Service Support)
-+ - Marvell Yukon-FE Fast Ethernet, Reduced Battery Power Service Support)
- - N-Way PCI-Bus Giga-Card 1000/100/10Mbps(L)
- - SK-9521 10/100/1000Base-T Adapter
- - SK-9521 V2.0 10/100/1000Base-T Adapter
-@@ -2117,6 +2183,14 @@ config SK98LIN
- - SK-9871 Gigabit Ethernet Server Adapter (SK-NET GE-ZX)
- - SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter
- - SK-9872 Gigabit Ethernet Server Adapter (SK-NET GE-ZX dual link)
-+ - SK-9S21 Server Adapter
-+ - SK-9S22 Server Adapter
-+ - SK-9S24 Server Adapter
-+ - SK-9S34 Server Adapter
-+ - SK-9S81 Server Adapter
-+ - SK-9S82 Server Adapter
-+ - SK-9S91 Server Adapter
-+ - SK-9S92 Server Adapter
- - SMC EZ Card 1000 (SMC9452TXV.2)
-
- The adapters support Jumbo Frames.
-@@ -2130,8 +2204,15 @@ config SK98LIN
-
- If you want to compile this driver as a module ( = code which can be
- inserted in and removed from the running kernel whenever you want),
-- say M here and read Documentation/kbuild/modules.txt. The module will
-- be called sk98lin. This is recommended.
-+ say M here and read Documentation/modules.txt. This is recommended.
-+ The module will be called sk98lin. This is recommended.
-+
-+config SK98LIN_NAPI
-+ bool "Use Rx polling (NAPI)"
-+ depends on SK98LIN
-+ help
-+ NAPI is a new driver API designed to reduce CPU and interrupt load
-+ when the driver is receiving lots of packets from the card.
-
- config VIA_VELOCITY
- tristate "VIA Velocity support"
-diff -Nurap ./drivers/net/sk98lin.sk98/Makefile ./drivers/net/sk98lin/Makefile
---- ./drivers/net/sk98lin.sk98/Makefile 2004-10-19 01:53:05.000000000 +0400
-+++ ./drivers/net/sk98lin/Makefile 2006-08-31 14:59:52.000000000 +0400
-@@ -1,6 +1,59 @@
-+#******************************************************************************
- #
--# Makefile for the SysKonnect SK-98xx device driver.
-+# Name: skge.c
-+# Project: GEnesis, PCI Gigabit Ethernet Adapter
-+# Version: $Revision: 1.9.2.1 $
-+# Date: $Date: 2005/04/11 09:01:18 $
-+# Purpose: The main driver source module
- #
-+#******************************************************************************
-+
-+#******************************************************************************
-+#
-+# (C)Copyright 1998-2002 SysKonnect GmbH.
-+# (C)Copyright 2002-2005 Marvell.
-+#
-+# Makefile for Marvell Yukon chipset and SysKonnect Gigabit Ethernet
-+# Server Adapter driver. (Kernel 2.6)
-+#
-+# Author: Mirko Lindner (mlindner@syskonnect.de)
-+# Ralph Roesler (rroesler@syskonnect.de)
-+#
-+# Address all question to: linux@syskonnect.de
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# The information in this file is provided "AS IS" without warranty.
-+#
-+#******************************************************************************
-+
-+#******************************************************************************
-+#
-+# History:
-+#
-+# $Log: Makefile2.6,v $
-+# Revision 1.9.2.1 2005/04/11 09:01:18 mlindner
-+# Fix: Copyright year changed
-+#
-+# Revision 1.9 2004/07/13 15:54:50 rroesler
-+# Add: file skethtool.c
-+# Fix: corrected header regarding copyright
-+# Fix: minor typos corrected
-+#
-+# Revision 1.8 2004/06/08 08:39:38 mlindner
-+# Fix: Add CONFIG_SK98LIN_ZEROCOPY as default
-+#
-+# Revision 1.7 2004/06/03 16:06:56 mlindner
-+# Fix: Added compile flag SK_DIAG_SUPPORT
-+#
-+# Revision 1.6 2004/06/02 08:02:59 mlindner
-+# Add: Changed header information and inserted a GPL statement
-+#
-+#
-+#******************************************************************************
-
-
- #
-@@ -13,13 +66,16 @@
- obj-$(CONFIG_SK98LIN) += sk98lin.o
- sk98lin-objs := \
- skge.o \
-+ sky2.o \
-+ skethtool.o \
-+ sky2le.o \
- skdim.o \
- skaddr.o \
- skgehwt.o \
- skgeinit.o \
- skgepnmi.o \
- skgesirq.o \
-- ski2c.o \
-+ sktwsi.o \
- sklm80.o \
- skqueue.o \
- skrlmt.o \
-@@ -76,13 +132,11 @@ endif
- # SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources
- # SK_DBGCAT_DRV_EVENT 0x08000000 driver events
-
--EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_DIAG_SUPPORT -DSK_USE_CSUM -DGENESIS -DYUKON $(DBGDEF) $(SKPARAM)
-+EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_USE_CSUM -DSK_DIAG_SUPPORT \
-+ -DGENESIS -DYUKON -DYUK2 -DCONFIG_SK98LIN_ZEROCOPY \
-+ $(DBGDEF) $(SKPARAM)
-
- clean:
- rm -f core *.o *.a *.s
-
-
--
--
--
--
-diff -Nurap ./drivers/net/sk98lin.sk98/h/lm80.h ./drivers/net/sk98lin/h/lm80.h
---- ./drivers/net/sk98lin.sk98/h/lm80.h 2004-10-19 01:55:06.000000000 +0400
-+++ ./drivers/net/sk98lin/h/lm80.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: lm80.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.6 $
-- * Date: $Date: 2003/05/13 17:26:52 $
-+ * Version: $Revision: 2.2 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Contains all defines for the LM80 Chip
- * (National Semiconductor).
- *
-@@ -11,6 +11,7 @@
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
- * (C)Copyright 2002-2003 Marvell.
- *
-@@ -20,6 +21,7 @@
- * (at your option) any later version.
- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skaddr.h ./drivers/net/sk98lin/h/skaddr.h
---- ./drivers/net/sk98lin.sk98/h/skaddr.h 2004-10-19 01:54:30.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skaddr.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skaddr.h
- * Project: Gigabit Ethernet Adapters, ADDR-Modul
-- * Version: $Revision: 1.29 $
-- * Date: $Date: 2003/05/13 16:57:24 $
-+ * Version: $Revision: 2.1 $
-+ * Date: $Date: 2003/10/27 14:16:07 $
- * Purpose: Header file for Address Management (MC, UC, Prom).
- *
- ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skcsum.h ./drivers/net/sk98lin/h/skcsum.h
---- ./drivers/net/sk98lin.sk98/h/skcsum.h 2004-10-19 01:53:10.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skcsum.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skcsum.h
- * Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx)
-- * Version: $Revision: 1.10 $
-- * Date: $Date: 2003/08/20 13:59:57 $
-+ * Version: $Revision: 2.2 $
-+ * Date: $Date: 2003/12/29 15:37:26 $
- * Purpose: Store/verify Internet checksum in send/receive packets.
- *
- ******************************************************************************/
-@@ -157,9 +157,7 @@ typedef struct s_CsProtocolStatistics {
- typedef struct s_Csum {
- /* Enabled receive SK_PROTO_XXX bit flags. */
- unsigned ReceiveFlags[SK_MAX_NETS];
--#ifdef TX_CSUM
- unsigned TransmitFlags[SK_MAX_NETS];
--#endif /* TX_CSUM */
-
- /* The protocol statistics structure; one per supported protocol. */
- SKCS_PROTO_STATS ProtoStats[SK_MAX_NETS][SKCS_NUM_PROTOCOLS];
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skdebug.h ./drivers/net/sk98lin/h/skdebug.h
---- ./drivers/net/sk98lin.sk98/h/skdebug.h 2004-10-19 01:54:26.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skdebug.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skdebug.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.14 $
-- * Date: $Date: 2003/05/13 17:26:00 $
-+ * Version: $Revision: 2.4 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: SK specific DEBUG support
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -28,9 +29,9 @@
- #ifdef DEBUG
- #ifndef SK_DBG_MSG
- #define SK_DBG_MSG(pAC,comp,cat,arg) \
-- if ( ((comp) & SK_DBG_CHKMOD(pAC)) && \
-- ((cat) & SK_DBG_CHKCAT(pAC)) ) { \
-- SK_DBG_PRINTF arg ; \
-+ if ( ((comp) & SK_DBG_CHKMOD(pAC)) && \
-+ ((cat) & SK_DBG_CHKCAT(pAC)) ) { \
-+ SK_DBG_PRINTF arg; \
- }
- #endif
- #else
-@@ -58,6 +59,13 @@
- #define SK_DBGMOD_ADDR 0x00000080L /* ADDR module */
- #define SK_DBGMOD_PECP 0x00000100L /* PECP module */
- #define SK_DBGMOD_POWM 0x00000200L /* Power Management module */
-+#ifdef SK_ASF
-+#define SK_DBGMOD_ASF 0x00000400L /* ASF module */
-+#endif
-+#ifdef SK_LBFO
-+#define SK_DBGMOD_LACP 0x00000800L /* link aggregation control protocol */
-+#define SK_DBGMOD_FD 0x00001000L /* frame distributor (link aggregation) */
-+#endif /* SK_LBFO */
-
- /* Debug events */
-
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skdrv1st.h ./drivers/net/sk98lin/h/skdrv1st.h
---- ./drivers/net/sk98lin.sk98/h/skdrv1st.h 2004-10-19 01:53:06.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skdrv1st.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skdrv1st.h
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.4 $
-- * Date: $Date: 2003/11/12 14:28:14 $
-+ * Version: $Revision: 1.5.2.6 $
-+ * Date: $Date: 2005/08/09 07:14:29 $
- * Purpose: First header file for driver and all other modules
- *
- ******************************************************************************/
-@@ -11,7 +11,7 @@
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -22,20 +22,6 @@
- *
- ******************************************************************************/
-
--/******************************************************************************
-- *
-- * Description:
-- *
-- * This is the first include file of the driver, which includes all
-- * neccessary system header files and some of the GEnesis header files.
-- * It also defines some basic items.
-- *
-- * Include File Hierarchy:
-- *
-- * see skge.c
-- *
-- ******************************************************************************/
--
- #ifndef __INC_SKDRV1ST_H
- #define __INC_SKDRV1ST_H
-
-@@ -58,6 +44,9 @@ typedef struct s_AC SK_AC;
-
- #define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
-
-+#define SK_STRNCMP(s1,s2,len) strncmp(s1,s2,len)
-+#define SK_STRCPY(dest,src) strcpy(dest,src)
-+
- #include <linux/types.h>
- #include <linux/kernel.h>
- #include <linux/string.h>
-@@ -78,11 +67,7 @@ typedef struct s_AC SK_AC;
- #include <net/checksum.h>
-
- #define SK_CS_CALCULATE_CHECKSUM
--#ifndef CONFIG_X86_64
--#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
--#else
--#define SkCsCalculateChecksum(p,l) ((~ip_fast_csum(p, l)) & 0xffff)
--#endif
-+#define SkCsCalculateChecksum(p,l) (~csum_fold(csum_partial(p, l, 0)))
-
- #include "h/sktypes.h"
- #include "h/skerror.h"
-@@ -90,10 +75,15 @@ typedef struct s_AC SK_AC;
- #include "h/lm80.h"
- #include "h/xmac_ii.h"
-
-+#ifndef SK_BMU_RX_WM_PEX
-+#define SK_BMU_RX_WM_PEX 0x80
-+#endif
-+
- #ifdef __LITTLE_ENDIAN
- #define SK_LITTLE_ENDIAN
- #else
- #define SK_BIG_ENDIAN
-+#define SK_USE_REV_DESC
- #endif
-
- #define SK_NET_DEVICE net_device
-@@ -188,3 +178,8 @@ extern void SkErrorLog(SK_AC*, int, int,
-
- #endif
-
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skdrv2nd.h ./drivers/net/sk98lin/h/skdrv2nd.h
---- ./drivers/net/sk98lin.sk98/h/skdrv2nd.h 2004-10-19 01:55:29.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skdrv2nd.h 2006-08-31 14:59:51.000000000 +0400
-@@ -1,17 +1,17 @@
- /******************************************************************************
- *
-- * Name: skdrv2nd.h
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.10 $
-- * Date: $Date: 2003/12/11 16:04:45 $
-- * Purpose: Second header file for driver and all other modules
-+ * Name: skdrv2nd.h
-+ * Project: GEnesis, PCI Gigabit Ethernet Adapter
-+ * Version: $Revision: 1.29.2.28 $
-+ * Date: $Date: 2005/11/14 15:22:08 $
-+ * Purpose: Second header file for driver and all other modules
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -42,10 +42,11 @@
- #include "h/skqueue.h"
- #include "h/skgehwt.h"
- #include "h/sktimer.h"
--#include "h/ski2c.h"
-+#include "h/sktwsi.h"
- #include "h/skgepnmi.h"
- #include "h/skvpd.h"
- #include "h/skgehw.h"
-+#include "h/sky2le.h"
- #include "h/skgeinit.h"
- #include "h/skaddr.h"
- #include "h/skgesirq.h"
-@@ -53,104 +54,191 @@
- #include "h/skrlmt.h"
- #include "h/skgedrv.h"
-
-+/* Defines for the poll cotroller */
-+#define SK_NETDUMP_POLL
-
--extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);
--extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);
--extern SK_U64 SkOsGetTime(SK_AC*);
--extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
--extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
--extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
--extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);
--extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
--extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
--extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
--
--#ifdef SK_DIAG_SUPPORT
--extern int SkDrvEnterDiagMode(SK_AC *pAc);
--extern int SkDrvLeaveDiagMode(SK_AC *pAc);
-+#ifdef SK_NETDUMP_POLL
-+#ifdef HAVE_POLL_CONTROLLER
-+#define SK_POLL_CONTROLLER
-+#define CONFIG_SK98LIN_NAPI
-+#elif CONFIG_NET_POLL_CONTROLLER
-+#define SK_POLL_CONTROLLER
-+#define CONFIG_SK98LIN_NAPI
- #endif
-+#endif
-+
-+
-+/******************************************************************************
-+ *
-+ * Generic driver defines
-+ *
-+ ******************************************************************************/
-+
-+#define USE_TIST_FOR_RESET /* Use timestamp for reset */
-+#define Y2_RECOVERY /* use specific recovery yukon2 functions */
-+#define Y2_LE_CHECK /* activate check for LE order */
-+#define Y2_SYNC_CHECK /* activate check for receiver in sync */
-+#define SK_YUKON2 /* Enable Yukon2 dual net support */
-+#define USE_SK_TX_CHECKSUM /* use the tx hw checksum driver functionality */
-+#define USE_SK_RX_CHECKSUM /* use the rx hw checksum driver functionality */
-+#define USE_SK_TSO_FEATURE /* use TCP segmentation offload if possible */
-+#define SK_COPY_THRESHOLD 50 /* threshold for copying small RX frames;
-+ * 0 avoids copying, 9001 copies all */
-+#define SK_MAX_CARD_PARAM 16 /* number of adapters that can be configured via
-+ * command line params */
-+//#define USE_TX_COMPLETE /* use of a transmit complete interrupt */
-+#define Y2_RX_CHECK /* RX Check timestamp */
-+
-+/*
-+ * use those defines for a compile-in version of the driver instead
-+ * of command line parameters
-+ */
-+// #define LINK_SPEED_A {"Auto",}
-+// #define LINK_SPEED_B {"Auto",}
-+// #define AUTO_NEG_A {"Sense",}
-+// #define AUTO_NEG_B {"Sense"}
-+// #define DUP_CAP_A {"Both",}
-+// #define DUP_CAP_B {"Both",}
-+// #define FLOW_CTRL_A {"SymOrRem",}
-+// #define FLOW_CTRL_B {"SymOrRem",}
-+// #define ROLE_A {"Auto",}
-+// #define ROLE_B {"Auto",}
-+// #define PREF_PORT {"A",}
-+// #define CON_TYPE {"Auto",}
-+// #define RLMT_MODE {"CheckLinkState",}
-+
-+#ifdef Y2_RECOVERY
-+#define CHECK_TRANSMIT_TIMEOUT
-+#define Y2_RESYNC_WATERMARK 1000000L
-+#endif
-+
-+
-+/******************************************************************************
-+ *
-+ * Generic ISR defines
-+ *
-+ ******************************************************************************/
-+
-+#define SkIsrRetVar irqreturn_t
-+#define SkIsrRetNone IRQ_NONE
-+#define SkIsrRetHandled IRQ_HANDLED
-+
-+#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb)
-+#define DEV_KFREE_SKB_IRQ(skb) dev_kfree_skb_irq(skb)
-+#define DEV_KFREE_SKB_ANY(skb) dev_kfree_skb_any(skb)
-+
-+/******************************************************************************
-+ *
-+ * Global function prototypes
-+ *
-+ ******************************************************************************/
-+
-+extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);
-+extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);
-+extern SK_U64 SkOsGetTime(SK_AC*);
-+extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
-+extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
-+extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
-+extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);
-+extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
-+extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
-+extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
-+extern int SkDrvEnterDiagMode(SK_AC *pAc);
-+extern int SkDrvLeaveDiagMode(SK_AC *pAc);
-+
-+/******************************************************************************
-+ *
-+ * Linux specific RLMT buffer structure (SK_MBUF typedef in skdrv1st)!
-+ *
-+ ******************************************************************************/
-
- struct s_DrvRlmtMbuf {
-- SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
-- SK_U8 *pData; /* Data buffer (virtually contig.). */
-- unsigned Size; /* Data buffer size. */
-- unsigned Length; /* Length of packet (<= Size). */
-- SK_U32 PortIdx; /* Receiving/transmitting port. */
-+ SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
-+ SK_U8 *pData; /* Data buffer (virtually contig.). */
-+ unsigned Size; /* Data buffer size. */
-+ unsigned Length; /* Length of packet (<= Size). */
-+ SK_U32 PortIdx; /* Receiving/transmitting port. */
- #ifdef SK_RLMT_MBUF_PRIVATE
-- SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */
--#endif /* SK_RLMT_MBUF_PRIVATE */
-- struct sk_buff *pOs; /* Pointer to message block */
-+ SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */
-+#endif
-+ struct sk_buff *pOs; /* Pointer to message block */
- };
-
-+/******************************************************************************
-+ *
-+ * Linux specific TIME defines
-+ *
-+ ******************************************************************************/
-
--/*
-- * Time macros
-- */
- #if SK_TICKS_PER_SEC == 100
- #define SK_PNMI_HUNDREDS_SEC(t) (t)
- #else
--#define SK_PNMI_HUNDREDS_SEC(t) ((((unsigned long)t) * 100) / \
-- (SK_TICKS_PER_SEC))
-+#define SK_PNMI_HUNDREDS_SEC(t) ((((unsigned long)t)*100)/(SK_TICKS_PER_SEC))
- #endif
-
--/*
-- * New SkOsGetTime
-- */
- #define SkOsGetTimeCurrent(pAC, pUsec) {\
-+ static struct timeval prev_t; \
- struct timeval t;\
- do_gettimeofday(&t);\
-- *pUsec = ((((t.tv_sec) * 1000000L)+t.tv_usec)/10000);\
-+ if (prev_t.tv_sec == t.tv_sec) { \
-+ if (prev_t.tv_usec > t.tv_usec) { \
-+ t.tv_usec = prev_t.tv_usec; \
-+ } else { \
-+ prev_t.tv_usec = t.tv_usec; \
-+ } \
-+ } else { \
-+ prev_t = t; \
-+ } \
-+ *pUsec = ((t.tv_sec*100L)+(t.tv_usec/10000));\
- }
-
-+/******************************************************************************
-+ *
-+ * Linux specific IOCTL defines and typedefs
-+ *
-+ ******************************************************************************/
-
--/*
-- * ioctl definitions
-- */
--#define SK_IOCTL_BASE (SIOCDEVPRIVATE)
--#define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0)
--#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
--#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
--#define SK_IOCTL_GEN (SK_IOCTL_BASE + 3)
--#define SK_IOCTL_DIAG (SK_IOCTL_BASE + 4)
--
--typedef struct s_IOCTL SK_GE_IOCTL;
-+#define SK_IOCTL_BASE (SIOCDEVPRIVATE)
-+#define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0)
-+#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
-+#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
-+#define SK_IOCTL_GEN (SK_IOCTL_BASE + 3)
-+#define SK_IOCTL_DIAG (SK_IOCTL_BASE + 4)
-
-+typedef struct s_IOCTL SK_GE_IOCTL;
- struct s_IOCTL {
- char __user * pData;
- unsigned int Len;
- };
-
-+/******************************************************************************
-+ *
-+ * Generic sizes and length definitions
-+ *
-+ ******************************************************************************/
-
--/*
-- * define sizes of descriptor rings in bytes
-- */
--
--#define TX_RING_SIZE (8*1024)
--#define RX_RING_SIZE (24*1024)
--
--/*
-- * Buffer size for ethernet packets
-- */
--#define ETH_BUF_SIZE 1540
--#define ETH_MAX_MTU 1514
--#define ETH_MIN_MTU 60
--#define ETH_MULTICAST_BIT 0x01
--#define SK_JUMBO_MTU 9000
--
--/*
-- * transmit priority selects the queue: LOW=asynchron, HIGH=synchron
-- */
--#define TX_PRIO_LOW 0
--#define TX_PRIO_HIGH 1
-+#define TX_RING_SIZE (24*1024) /* GEnesis/Yukon */
-+#define RX_RING_SIZE (24*1024) /* GEnesis/Yukon */
-+#define RX_MAX_NBR_BUFFERS 128 /* Yukon-EC/-II */
-+#define TX_MAX_NBR_BUFFERS 128 /* Yukon-EC/-II */
-+#define MAXIMUM_LOW_ADDRESS 0xFFFFFFFF /* Max. low address */
-+
-+#define ETH_BUF_SIZE 1560 /* multiples of 8 bytes */
-+#define ETH_MAX_MTU 1514
-+#define ETH_MIN_MTU 60
-+#define ETH_MULTICAST_BIT 0x01
-+#define SK_JUMBO_MTU 9000
-+
-+#define TX_PRIO_LOW 0 /* asynchronous queue */
-+#define TX_PRIO_HIGH 1 /* synchronous queue */
-+#define DESCR_ALIGN 64 /* alignment of Rx/Tx descriptors */
-
--/*
-- * alignment of rx/tx descriptors
-- */
--#define DESCR_ALIGN 64
-+/******************************************************************************
-+ *
-+ * PNMI related definitions
-+ *
-+ ******************************************************************************/
-
--/*
-- * definitions for pnmi. TODO
-- */
- #define SK_DRIVER_RESET(pAC, IoC) 0
- #define SK_DRIVER_SENDEVENT(pAC, IoC) 0
- #define SK_DRIVER_SELFTEST(pAC, IoC) 0
-@@ -159,20 +247,16 @@ struct s_IOCTL {
- #define SK_DRIVER_SET_MTU(pAc,IoC,i,v) 0
- #define SK_DRIVER_PRESET_MTU(pAc,IoC,i,v) 0
-
--/*
--** Interim definition of SK_DRV_TIMER placed in this file until
--** common modules have boon finallized
--*/
--#define SK_DRV_TIMER 11
--#define SK_DRV_MODERATION_TIMER 1
--#define SK_DRV_MODERATION_TIMER_LENGTH 1000000 /* 1 second */
--#define SK_DRV_RX_CLEANUP_TIMER 2
--#define SK_DRV_RX_CLEANUP_TIMER_LENGTH 1000000 /* 100 millisecs */
-
--/*
--** Definitions regarding transmitting frames
--** any calculating any checksum.
--*/
-+/******************************************************************************
-+ *
-+ * Various offsets and sizes
-+ *
-+ ******************************************************************************/
-+
-+#define SK_DRV_MODERATION_TIMER 1 /* id */
-+#define SK_DRV_MODERATION_TIMER_LENGTH 1 /* 1 second */
-+
- #define C_LEN_ETHERMAC_HEADER_DEST_ADDR 6
- #define C_LEN_ETHERMAC_HEADER_SRC_ADDR 6
- #define C_LEN_ETHERMAC_HEADER_LENTYPE 2
-@@ -198,114 +282,445 @@ struct s_IOCTL {
- #define C_PROTO_ID_UDP 17 /* refer to RFC 790 or Stevens' */
- #define C_PROTO_ID_TCP 6 /* TCP/IP illustrated for details */
-
--/* TX and RX descriptors *****************************************************/
-+/******************************************************************************
-+ *
-+ * Tx and Rx descriptor definitions
-+ *
-+ ******************************************************************************/
-
- typedef struct s_RxD RXD; /* the receive descriptor */
--
- struct s_RxD {
-- volatile SK_U32 RBControl; /* Receive Buffer Control */
-- SK_U32 VNextRxd; /* Next receive descriptor,low dword */
-- SK_U32 VDataLow; /* Receive buffer Addr, low dword */
-- SK_U32 VDataHigh; /* Receive buffer Addr, high dword */
-- SK_U32 FrameStat; /* Receive Frame Status word */
-- SK_U32 TimeStamp; /* Time stamp from XMAC */
-- SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */
-- SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */
-- RXD *pNextRxd; /* Pointer to next Rxd */
-- struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
-+ volatile SK_U32 RBControl; /* Receive Buffer Control */
-+ SK_U32 VNextRxd; /* Next receive descriptor,low dword */
-+ SK_U32 VDataLow; /* Receive buffer Addr, low dword */
-+ SK_U32 VDataHigh; /* Receive buffer Addr, high dword */
-+ SK_U32 FrameStat; /* Receive Frame Status word */
-+ SK_U32 TimeStamp; /* Time stamp from XMAC */
-+ SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */
-+ SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */
-+ RXD *pNextRxd; /* Pointer to next Rxd */
-+ struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
- };
-
- typedef struct s_TxD TXD; /* the transmit descriptor */
--
- struct s_TxD {
-- volatile SK_U32 TBControl; /* Transmit Buffer Control */
-- SK_U32 VNextTxd; /* Next transmit descriptor,low dword */
-- SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */
-- SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */
-- SK_U32 FrameStat; /* Transmit Frame Status Word */
-- SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */
-- SK_U16 TcpSumSt; /* TCP Sum Start */
-- SK_U16 TcpSumWr; /* TCP Sum Write */
-- SK_U32 TcpReserved; /* not used */
-- TXD *pNextTxd; /* Pointer to next Txd */
-- struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
-+ volatile SK_U32 TBControl; /* Transmit Buffer Control */
-+ SK_U32 VNextTxd; /* Next transmit descriptor,low dword */
-+ SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */
-+ SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */
-+ SK_U32 FrameStat; /* Transmit Frame Status Word */
-+ SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */
-+ SK_U16 TcpSumSt; /* TCP Sum Start */
-+ SK_U16 TcpSumWr; /* TCP Sum Write */
-+ SK_U32 TcpReserved; /* not used */
-+ TXD *pNextTxd; /* Pointer to next Txd */
-+ struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
-+};
-+
-+/******************************************************************************
-+ *
-+ * Generic Yukon-II defines
-+ *
-+ ******************************************************************************/
-+
-+#define LE_SIZE sizeof(SK_HWLE)
-+#define MAX_NUM_FRAGS (MAX_SKB_FRAGS + 1)
-+#define MIN_LEN_OF_LE_TAB 128
-+#define MAX_LEN_OF_LE_TAB 4096
-+#define MAX_UNUSED_RX_LE_WORKING 8
-+#ifdef MAX_FRAG_OVERHEAD
-+#undef MAX_FRAG_OVERHEAD
-+#define MAX_FRAG_OVERHEAD 4
-+#endif
-+// as we have a maximum of 16 physical fragments,
-+// maximum 1 ADDR64 per physical fragment
-+// maximum 4 LEs for VLAN, Csum, LargeSend, Packet
-+#define MIN_LE_FREE_REQUIRED ((16*2) + 4)
-+#define IS_GMAC(pAc) (!pAc->GIni.GIGenesis)
-+#ifdef USE_SYNC_TX_QUEUE
-+#define TXS_MAX_LE 256
-+#else /* !USE_SYNC_TX_QUEUE */
-+#define TXS_MAX_LE 0
-+#endif
-+
-+#define ETHER_MAC_HDR_LEN (6+6+2) // MAC SRC ADDR, MAC DST ADDR, TYPE
-+#define IP_HDR_LEN 20
-+#define TCP_CSUM_OFFS 0x10
-+#define UDP_CSUM_OFFS 0x06
-+#define TXA_MAX_LE 256
-+#define RX_MAX_LE 256
-+#define ST_MAX_LE (SK_MAX_MACS)*((3*RX_MAX_LE)+(TXA_MAX_LE)+(TXS_MAX_LE))
-+
-+#if (defined (Y2_RECOVERY) || defined (Y2_LE_CHECK))
-+/* event for recovery from tx hang or rx out of sync */
-+#define SK_DRV_RECOVER 17
-+#endif
-+/******************************************************************************
-+ *
-+ * Structures specific for Yukon-II
-+ *
-+ ******************************************************************************/
-+
-+typedef struct s_frag SK_FRAG;
-+struct s_frag {
-+ SK_FRAG *pNext;
-+ char *pVirt;
-+ SK_U64 pPhys;
-+ unsigned int FragLen;
- };
-
--/* Used interrupt bits in the interrupts source register *********************/
-+typedef struct s_packet SK_PACKET;
-+struct s_packet {
-+ /* Common infos: */
-+ SK_PACKET *pNext; /* pointer for packet queues */
-+ unsigned int PacketLen; /* length of packet */
-+ unsigned int NumFrags; /* nbr of fragments (for Rx always 1) */
-+ SK_FRAG *pFrag; /* fragment list */
-+ SK_FRAG FragArray[MAX_NUM_FRAGS]; /* TX fragment array */
-+ unsigned int NextLE; /* next LE to use for the next packet */
-+
-+ /* Private infos: */
-+ struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
-+};
-+
-+typedef struct s_queue SK_PKT_QUEUE;
-+struct s_queue {
-+ SK_PACKET *pHead;
-+ SK_PACKET *pTail;
-+ spinlock_t QueueLock; /* serialize packet accesses */
-+};
-+
-+/*******************************************************************************
-+ *
-+ * Macros specific for Yukon-II queues
-+ *
-+ ******************************************************************************/
-+
-+#define IS_Q_EMPTY(pQueue) ((pQueue)->pHead != NULL) ? SK_FALSE : SK_TRUE
-+#define IS_Q_LOCKED(pQueue) spin_is_locked(&((pQueue)->QueueLock))
-+
-+#define PLAIN_POP_FIRST_PKT_FROM_QUEUE(pQueue, pPacket) { \
-+ if ((pQueue)->pHead != NULL) { \
-+ (pPacket) = (pQueue)->pHead; \
-+ (pQueue)->pHead = (pPacket)->pNext; \
-+ if ((pQueue)->pHead == NULL) { \
-+ (pQueue)->pTail = NULL; \
-+ } \
-+ (pPacket)->pNext = NULL; \
-+ } else { \
-+ (pPacket) = NULL; \
-+ } \
-+}
-+
-+#define PLAIN_PUSH_PKT_AS_FIRST_IN_QUEUE(pQueue, pPacket) { \
-+ if ((pQueue)->pHead != NULL) { \
-+ (pPacket)->pNext = (pQueue)->pHead; \
-+ } else { \
-+ (pPacket)->pNext = NULL; \
-+ (pQueue)->pTail = (pPacket); \
-+ } \
-+ (pQueue)->pHead = (pPacket); \
-+}
-+
-+#define PLAIN_PUSH_PKT_AS_LAST_IN_QUEUE(pQueue, pPacket) { \
-+ (pPacket)->pNext = NULL; \
-+ if ((pQueue)->pTail != NULL) { \
-+ (pQueue)->pTail->pNext = (pPacket); \
-+ } else { \
-+ (pQueue)->pHead = (pPacket); \
-+ } \
-+ (pQueue)->pTail = (pPacket); \
-+}
-+
-+#define PLAIN_PUSH_MULTIPLE_PKT_AS_LAST_IN_QUEUE(pQueue,pPktGrpStart,pPktGrpEnd) { \
-+ if ((pPktGrpStart) != NULL) { \
-+ if ((pQueue)->pTail != NULL) { \
-+ (pQueue)->pTail->pNext = (pPktGrpStart); \
-+ } else { \
-+ (pQueue)->pHead = (pPktGrpStart); \
-+ } \
-+ (pQueue)->pTail = (pPktGrpEnd); \
-+ } \
-+}
-+
-+/* Required: 'Flags' */
-+#define POP_FIRST_PKT_FROM_QUEUE(pQueue, pPacket) { \
-+ spin_lock_irqsave(&((pQueue)->QueueLock), Flags); \
-+ if ((pQueue)->pHead != NULL) { \
-+ (pPacket) = (pQueue)->pHead; \
-+ (pQueue)->pHead = (pPacket)->pNext; \
-+ if ((pQueue)->pHead == NULL) { \
-+ (pQueue)->pTail = NULL; \
-+ } \
-+ (pPacket)->pNext = NULL; \
-+ } else { \
-+ (pPacket) = NULL; \
-+ } \
-+ spin_unlock_irqrestore(&((pQueue)->QueueLock), Flags); \
-+}
-+
-+/* Required: 'Flags' */
-+#define PUSH_PKT_AS_FIRST_IN_QUEUE(pQueue, pPacket) { \
-+ spin_lock_irqsave(&(pQueue)->QueueLock, Flags); \
-+ if ((pQueue)->pHead != NULL) { \
-+ (pPacket)->pNext = (pQueue)->pHead; \
-+ } else { \
-+ (pPacket)->pNext = NULL; \
-+ (pQueue)->pTail = (pPacket); \
-+ } \
-+ (pQueue)->pHead = (pPacket); \
-+ spin_unlock_irqrestore(&(pQueue)->QueueLock, Flags); \
-+}
-+
-+/* Required: 'Flags' */
-+#define PUSH_PKT_AS_LAST_IN_QUEUE(pQueue, pPacket) { \
-+ (pPacket)->pNext = NULL; \
-+ spin_lock_irqsave(&(pQueue)->QueueLock, Flags); \
-+ if ((pQueue)->pTail != NULL) { \
-+ (pQueue)->pTail->pNext = (pPacket); \
-+ } else { \
-+ (pQueue)->pHead = (pPacket); \
-+ } \
-+ (pQueue)->pTail = (pPacket); \
-+ spin_unlock_irqrestore(&(pQueue)->QueueLock, Flags); \
-+}
-+
-+/* Required: 'Flags' */
-+#define PUSH_MULTIPLE_PKT_AS_LAST_IN_QUEUE(pQueue,pPktGrpStart,pPktGrpEnd) { \
-+ if ((pPktGrpStart) != NULL) { \
-+ spin_lock_irqsave(&(pQueue)->QueueLock, Flags); \
-+ if ((pQueue)->pTail != NULL) { \
-+ (pQueue)->pTail->pNext = (pPktGrpStart); \
-+ } else { \
-+ (pQueue)->pHead = (pPktGrpStart); \
-+ } \
-+ (pQueue)->pTail = (pPktGrpEnd); \
-+ spin_unlock_irqrestore(&(pQueue)->QueueLock, Flags); \
-+ } \
-+}
-+
-+/*
-+ *Check if the low address (32 bit) is near the 4G limit or over it.
-+ * Set the high address to a wrong value.
-+ * Doing so we force to write the ADDR64 LE.
-+ */
-+#define CHECK_LOW_ADDRESS( _HighAddress, _LowAddress , _Length) { \
-+ if ((~0-_LowAddress) <_Length) { \
-+ _HighAddress= MAXIMUM_LOW_ADDRESS; \
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, \
-+ ("High Address must be set for HW. LowAddr = %d Length = %d\n", \
-+ _LowAddress, _Length)); \
-+ } \
-+}
-+
-+/*******************************************************************************
-+ *
-+ * Macros specific for Yukon-II queues (tist)
-+ *
-+ ******************************************************************************/
-+
-+#ifdef USE_TIST_FOR_RESET
-+/* port is fully operational */
-+#define SK_PSTATE_NOT_WAITING_FOR_TIST 0
-+/* port in reset until any tist LE */
-+#define SK_PSTATE_WAITING_FOR_ANY_TIST BIT_0
-+/* port in reset until timer reaches pAC->MinTistLo */
-+#define SK_PSTATE_WAITING_FOR_SPECIFIC_TIST BIT_1
-+#define SK_PSTATE_PORT_SHIFT 4
-+#define SK_PSTATE_PORT_MASK ((1 << SK_PSTATE_PORT_SHIFT) - 1)
-+
-+/* use this + Port to build OP_MOD_TXINDEX_NO_PORT_A|B */
-+#define OP_MOD_TXINDEX 0x71
-+/* opcode for a TX_INDEX LE in which Port A has to be ignored */
-+#define OP_MOD_TXINDEX_NO_PORT_A 0x71
-+/* opcode for a TX_INDEX LE in which Port B has to be ignored */
-+#define OP_MOD_TXINDEX_NO_PORT_B 0x72
-+/* opcode for LE to be ignored because port is still in reset */
-+#define OP_MOD_LE 0x7F
-+
-+/* set tist wait mode Bit for port */
-+#define SK_SET_WAIT_BIT_FOR_PORT(pAC, Bit, Port) \
-+ { \
-+ (pAC)->AdapterResetState |= ((Bit) << (SK_PSTATE_PORT_SHIFT * Port)); \
-+ }
-+
-+/* reset tist waiting for specified port */
-+#define SK_CLR_STATE_FOR_PORT(pAC, Port) \
-+ { \
-+ (pAC)->AdapterResetState &= \
-+ ~(SK_PSTATE_PORT_MASK << (SK_PSTATE_PORT_SHIFT * Port)); \
-+ }
-+
-+/* return SK_TRUE when port is in reset waiting for tist */
-+#define SK_PORT_WAITING_FOR_TIST(pAC, Port) \
-+ ((((pAC)->AdapterResetState >> (SK_PSTATE_PORT_SHIFT * Port)) & \
-+ SK_PSTATE_PORT_MASK) != SK_PSTATE_NOT_WAITING_FOR_TIST)
-+
-+/* return SK_TRUE when port is in reset waiting for any tist */
-+#define SK_PORT_WAITING_FOR_ANY_TIST(pAC, Port) \
-+ ((((pAC)->AdapterResetState >> (SK_PSTATE_PORT_SHIFT * Port)) & \
-+ SK_PSTATE_WAITING_FOR_ANY_TIST) == SK_PSTATE_WAITING_FOR_ANY_TIST)
-+
-+/* return SK_TRUE when port is in reset waiting for a specific tist */
-+#define SK_PORT_WAITING_FOR_SPECIFIC_TIST(pAC, Port) \
-+ ((((pAC)->AdapterResetState >> (SK_PSTATE_PORT_SHIFT * Port)) & \
-+ SK_PSTATE_WAITING_FOR_SPECIFIC_TIST) == \
-+ SK_PSTATE_WAITING_FOR_SPECIFIC_TIST)
-+
-+/* return whether adapter is expecting a tist LE */
-+#define SK_ADAPTER_WAITING_FOR_TIST(pAC) ((pAC)->AdapterResetState != 0)
-+
-+/* enable timestamp timer and force creation of tist LEs */
-+#define Y2_ENABLE_TIST(IoC) \
-+ SK_OUT8(IoC, GMAC_TI_ST_CTRL, (SK_U8) GMT_ST_START)
-+
-+/* disable timestamp timer and stop creation of tist LEs */
-+#define Y2_DISABLE_TIST(IoC) \
-+ SK_OUT8(IoC, GMAC_TI_ST_CTRL, (SK_U8) GMT_ST_STOP)
-+
-+/* get current value of timestamp timer */
-+#define Y2_GET_TIST_LOW_VAL(IoC, pVal) \
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, pVal)
-
--#define DRIVER_IRQS ((IS_IRQ_SW) | \
-- (IS_R1_F) |(IS_R2_F) | \
-- (IS_XS1_F) |(IS_XA1_F) | \
-- (IS_XS2_F) |(IS_XA2_F))
--
--#define SPECIAL_IRQS ((IS_HW_ERR) |(IS_I2C_READY) | \
-- (IS_EXT_REG) |(IS_TIMINT) | \
-- (IS_PA_TO_RX1) |(IS_PA_TO_RX2) | \
-- (IS_PA_TO_TX1) |(IS_PA_TO_TX2) | \
-- (IS_MAC1) |(IS_LNK_SYNC_M1)| \
-- (IS_MAC2) |(IS_LNK_SYNC_M2)| \
-- (IS_R1_C) |(IS_R2_C) | \
-- (IS_XS1_C) |(IS_XA1_C) | \
-- (IS_XS2_C) |(IS_XA2_C))
--
--#define IRQ_MASK ((IS_IRQ_SW) | \
-- (IS_R1_B) |(IS_R1_F) |(IS_R2_B) |(IS_R2_F) | \
-- (IS_XS1_B) |(IS_XS1_F) |(IS_XA1_B)|(IS_XA1_F)| \
-- (IS_XS2_B) |(IS_XS2_F) |(IS_XA2_B)|(IS_XA2_F)| \
-- (IS_HW_ERR) |(IS_I2C_READY)| \
-- (IS_EXT_REG) |(IS_TIMINT) | \
-- (IS_PA_TO_RX1) |(IS_PA_TO_RX2)| \
-- (IS_PA_TO_TX1) |(IS_PA_TO_TX2)| \
-- (IS_MAC1) |(IS_MAC2) | \
-- (IS_R1_C) |(IS_R2_C) | \
-- (IS_XS1_C) |(IS_XA1_C) | \
-- (IS_XS2_C) |(IS_XA2_C))
-+#endif
-
--#define IRQ_HWE_MASK (IS_ERR_MSK) /* enable all HW irqs */
-+
-+/*******************************************************************************
-+ *
-+ * Used interrupt bits in the interrupts source register
-+ *
-+ ******************************************************************************/
-+
-+#define DRIVER_IRQS ((IS_IRQ_SW) | \
-+ (IS_R1_F) | (IS_R2_F) | \
-+ (IS_XS1_F) | (IS_XA1_F) | \
-+ (IS_XS2_F) | (IS_XA2_F))
-+
-+#define TX_COMPL_IRQS ((IS_XS1_B) | (IS_XS1_F) | \
-+ (IS_XA1_B) | (IS_XA1_F) | \
-+ (IS_XS2_B) | (IS_XS2_F) | \
-+ (IS_XA2_B) | (IS_XA2_F))
-+
-+#define NAPI_DRV_IRQS ((IS_R1_F) | (IS_R2_F) | \
-+ (IS_XS1_F) | (IS_XA1_F)| \
-+ (IS_XS2_F) | (IS_XA2_F))
-+
-+#define Y2_DRIVER_IRQS ((Y2_IS_STAT_BMU) | (Y2_IS_IRQ_SW) | (Y2_IS_POLL_CHK))
-+
-+#define SPECIAL_IRQS ((IS_HW_ERR) |(IS_I2C_READY) | \
-+ (IS_EXT_REG) |(IS_TIMINT) | \
-+ (IS_PA_TO_RX1) |(IS_PA_TO_RX2) | \
-+ (IS_PA_TO_TX1) |(IS_PA_TO_TX2) | \
-+ (IS_MAC1) |(IS_LNK_SYNC_M1)| \
-+ (IS_MAC2) |(IS_LNK_SYNC_M2)| \
-+ (IS_R1_C) |(IS_R2_C) | \
-+ (IS_XS1_C) |(IS_XA1_C) | \
-+ (IS_XS2_C) |(IS_XA2_C))
-+
-+#define Y2_SPECIAL_IRQS ((Y2_IS_HW_ERR) |(Y2_IS_ASF) | \
-+ (Y2_IS_TWSI_RDY) |(Y2_IS_TIMINT) | \
-+ (Y2_IS_IRQ_PHY2) |(Y2_IS_IRQ_MAC2) | \
-+ (Y2_IS_CHK_RX2) |(Y2_IS_CHK_TXS2) | \
-+ (Y2_IS_CHK_TXA2) |(Y2_IS_IRQ_PHY1) | \
-+ (Y2_IS_IRQ_MAC1) |(Y2_IS_CHK_RX1) | \
-+ (Y2_IS_CHK_TXS1) |(Y2_IS_CHK_TXA1))
-+
-+#define IRQ_MASK ((IS_IRQ_SW) | \
-+ (IS_R1_F) |(IS_R2_F) | \
-+ (IS_XS1_F) |(IS_XA1_F) | \
-+ (IS_XS2_F) |(IS_XA2_F) | \
-+ (IS_HW_ERR) |(IS_I2C_READY)| \
-+ (IS_EXT_REG) |(IS_TIMINT) | \
-+ (IS_PA_TO_RX1) |(IS_PA_TO_RX2)| \
-+ (IS_PA_TO_TX1) |(IS_PA_TO_TX2)| \
-+ (IS_MAC1) |(IS_MAC2) | \
-+ (IS_R1_C) |(IS_R2_C) | \
-+ (IS_XS1_C) |(IS_XA1_C) | \
-+ (IS_XS2_C) |(IS_XA2_C))
-+
-+#define Y2_IRQ_MASK ((Y2_DRIVER_IRQS) | (Y2_SPECIAL_IRQS))
-+
-+#define IRQ_HWE_MASK (IS_ERR_MSK) /* enable all HW irqs */
-+#define Y2_IRQ_HWE_MASK (Y2_HWE_ALL_MSK) /* enable all HW irqs */
-
- typedef struct s_DevNet DEV_NET;
-
- struct s_DevNet {
-- struct proc_dir_entry *proc;
-- int PortNr;
-- int NetNr;
-- int Mtu;
-- int Up;
-- SK_AC *pAC;
-+ struct proc_dir_entry *proc;
-+ int PortNr;
-+ int NetNr;
-+ char InitialDevName[20];
-+ SK_BOOL NetConsoleMode;
-+#ifdef Y2_RECOVERY
-+ struct timer_list KernelTimer; /* Kernel timer struct */
-+ int TransmitTimeoutTimer; /* Transmit timer */
-+ SK_BOOL TimerExpired; /* Transmit timer */
-+ SK_BOOL InRecover; /* Recover flag */
-+#ifdef Y2_RX_CHECK
-+ SK_U32 PreviousMACFifoRP; /* Backup of the FRP */
-+ SK_U32 PreviousMACFifoRLev; /* Backup of the FRL */
-+ SK_U32 PreviousRXFifoRP; /* Backup of the RX FRP */
-+ SK_U8 PreviousRXFifoRLev; /* Backup of the RX FRL */
-+ SK_U32 LastJiffies; /* Backup of the jiffies*/
-+#endif
-+#endif
-+ SK_AC *pAC;
- };
-
--typedef struct s_TxPort TX_PORT;
-+/*******************************************************************************
-+ *
-+ * Rx/Tx Port structures
-+ *
-+ ******************************************************************************/
-
--struct s_TxPort {
-- /* the transmit descriptor rings */
-- caddr_t pTxDescrRing; /* descriptor area memory */
-- SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */
-- TXD *pTxdRingHead; /* Head of Tx rings */
-- TXD *pTxdRingTail; /* Tail of Tx rings */
-- TXD *pTxdRingPrev; /* descriptor sent previously */
-- int TxdRingFree; /* # of free entrys */
-- spinlock_t TxDesRingLock; /* serialize descriptor accesses */
-- caddr_t HwAddr; /* bmu registers address */
-- int PortIndex; /* index number of port (0 or 1) */
-+typedef struct s_TxPort TX_PORT;
-+struct s_TxPort { /* the transmit descriptor rings */
-+ caddr_t pTxDescrRing; /* descriptor area memory */
-+ SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */
-+ TXD *pTxdRingHead; /* Head of Tx rings */
-+ TXD *pTxdRingTail; /* Tail of Tx rings */
-+ TXD *pTxdRingPrev; /* descriptor sent previously */
-+ int TxdRingPrevFree;/* previously # of free entrys */
-+ int TxdRingFree; /* # of free entrys */
-+ spinlock_t TxDesRingLock; /* serialize descriptor accesses */
-+ caddr_t HwAddr; /* bmu registers address */
-+ int PortIndex; /* index number of port (0 or 1) */
-+ SK_PACKET *TransmitPacketTable;
-+ SK_LE_TABLE TxALET; /* tx (async) list element table */
-+ SK_LE_TABLE TxSLET; /* tx (sync) list element table */
-+ SK_PKT_QUEUE TxQ_free;
-+ SK_PKT_QUEUE TxAQ_waiting;
-+ SK_PKT_QUEUE TxSQ_waiting;
-+ SK_PKT_QUEUE TxAQ_working;
-+ SK_PKT_QUEUE TxSQ_working;
-+ unsigned LastDone;
- };
-
--typedef struct s_RxPort RX_PORT;
--
--struct s_RxPort {
-- /* the receive descriptor rings */
-- caddr_t pRxDescrRing; /* descriptor area memory */
-- SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */
-- RXD *pRxdRingHead; /* Head of Rx rings */
-- RXD *pRxdRingTail; /* Tail of Rx rings */
-- RXD *pRxdRingPrev; /* descriptor given to BMU previously */
-- int RxdRingFree; /* # of free entrys */
-- spinlock_t RxDesRingLock; /* serialize descriptor accesses */
-- int RxFillLimit; /* limit for buffers in ring */
-- caddr_t HwAddr; /* bmu registers address */
-- int PortIndex; /* index number of port (0 or 1) */
-+typedef struct s_RxPort RX_PORT;
-+struct s_RxPort { /* the receive descriptor rings */
-+ caddr_t pRxDescrRing; /* descriptor area memory */
-+ SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */
-+ RXD *pRxdRingHead; /* Head of Rx rings */
-+ RXD *pRxdRingTail; /* Tail of Rx rings */
-+ RXD *pRxdRingPrev; /* descr given to BMU previously */
-+ int RxdRingFree; /* # of free entrys */
-+ spinlock_t RxDesRingLock; /* serialize descriptor accesses */
-+ int RxFillLimit; /* limit for buffers in ring */
-+ caddr_t HwAddr; /* bmu registers address */
-+ int PortIndex; /* index number of port (0 or 1) */
-+ SK_BOOL UseRxCsum; /* use Rx checksumming (yes/no) */
-+ SK_PACKET *ReceivePacketTable;
-+ SK_LE_TABLE RxLET; /* rx list element table */
-+ SK_PKT_QUEUE RxQ_working;
-+ SK_PKT_QUEUE RxQ_waiting;
-+ int RxBufSize;
- };
-
--/* Definitions needed for interrupt moderation *******************************/
-+/*******************************************************************************
-+ *
-+ * Interrupt masks used in combination with interrupt moderation
-+ *
-+ ******************************************************************************/
-
- #define IRQ_EOF_AS_TX ((IS_XA1_F) | (IS_XA2_F))
- #define IRQ_EOF_SY_TX ((IS_XS1_F) | (IS_XS2_F))
-@@ -317,139 +732,151 @@ struct s_RxPort {
- #define IRQ_MASK_SP_TX ((SPECIAL_IRQS) | (IRQ_MASK_TX_ONLY))
- #define IRQ_MASK_RX_TX_SP ((SPECIAL_IRQS) | (IRQ_MASK_TX_RX))
-
--#define C_INT_MOD_NONE 1
--#define C_INT_MOD_STATIC 2
--#define C_INT_MOD_DYNAMIC 4
--
--#define C_CLK_FREQ_GENESIS 53215000 /* shorter: 53.125 MHz */
--#define C_CLK_FREQ_YUKON 78215000 /* shorter: 78.125 MHz */
--
--#define C_INTS_PER_SEC_DEFAULT 2000
--#define C_INT_MOD_ENABLE_PERCENTAGE 50 /* if higher 50% enable */
--#define C_INT_MOD_DISABLE_PERCENTAGE 50 /* if lower 50% disable */
--#define C_INT_MOD_IPS_LOWER_RANGE 30
--#define C_INT_MOD_IPS_UPPER_RANGE 40000
--
--
--typedef struct s_DynIrqModInfo DIM_INFO;
--struct s_DynIrqModInfo {
-- unsigned long PrevTimeVal;
-- unsigned int PrevSysLoad;
-- unsigned int PrevUsedTime;
-- unsigned int PrevTotalTime;
-- int PrevUsedDescrRatio;
-- int NbrProcessedDescr;
-- SK_U64 PrevPort0RxIntrCts;
-- SK_U64 PrevPort1RxIntrCts;
-- SK_U64 PrevPort0TxIntrCts;
-- SK_U64 PrevPort1TxIntrCts;
-- SK_BOOL ModJustEnabled; /* Moderation just enabled yes/no */
--
-- int MaxModIntsPerSec; /* Moderation Threshold */
-- int MaxModIntsPerSecUpperLimit; /* Upper limit for DIM */
-- int MaxModIntsPerSecLowerLimit; /* Lower limit for DIM */
--
-- long MaskIrqModeration; /* ModIrqType (eg. 'TxRx') */
-- SK_BOOL DisplayStats; /* Stats yes/no */
-- SK_BOOL AutoSizing; /* Resize DIM-timer on/off */
-- int IntModTypeSelect; /* EnableIntMod (eg. 'dynamic') */
-+#define IRQ_MASK_Y2_TX_ONLY (Y2_IS_STAT_BMU)
-+#define IRQ_MASK_Y2_RX_ONLY (Y2_IS_STAT_BMU)
-+#define IRQ_MASK_Y2_SP_ONLY (SPECIAL_IRQS)
-+#define IRQ_MASK_Y2_TX_RX ((IRQ_MASK_TX_ONLY)| (IRQ_MASK_RX_ONLY))
-+#define IRQ_MASK_Y2_SP_RX ((SPECIAL_IRQS) | (IRQ_MASK_RX_ONLY))
-+#define IRQ_MASK_Y2_SP_TX ((SPECIAL_IRQS) | (IRQ_MASK_TX_ONLY))
-+#define IRQ_MASK_Y2_RX_TX_SP ((SPECIAL_IRQS) | (IRQ_MASK_TX_RX))
-
-- SK_TIMER ModTimer; /* just some timer */
--};
-+/*******************************************************************************
-+ *
-+ * Defines and typedefs regarding interrupt moderation
-+ *
-+ ******************************************************************************/
-
--typedef struct s_PerStrm PER_STRM;
-+#define C_INT_MOD_NONE 1
-+#define C_INT_MOD_STATIC 2
-+#define C_INT_MOD_DYNAMIC 4
-+
-+#define C_CLK_FREQ_GENESIS 53215000 /* or: 53.125 MHz */
-+#define C_CLK_FREQ_YUKON 78215000 /* or: 78.125 MHz */
-+#define C_CLK_FREQ_YUKON_EC 125000000 /* or: 125.000 MHz */
-+
-+#define C_Y2_INTS_PER_SEC_DEFAULT 5000
-+#define C_INTS_PER_SEC_DEFAULT 2000
-+#define C_INT_MOD_IPS_LOWER_RANGE 30 /* in IRQs/second */
-+#define C_INT_MOD_IPS_UPPER_RANGE 40000 /* in IRQs/second */
-+
-+typedef struct s_DynIrqModInfo {
-+ SK_U64 PrevPort0RxIntrCts;
-+ SK_U64 PrevPort1RxIntrCts;
-+ SK_U64 PrevPort0TxIntrCts;
-+ SK_U64 PrevPort1TxIntrCts;
-+ SK_U64 PrevPort0StatusLeIntrCts;
-+ SK_U64 PrevPort1StatusLeIntrCts;
-+ int MaxModIntsPerSec; /* Moderation Threshold */
-+ int MaxModIntsPerSecUpperLimit; /* Upper limit for DIM */
-+ int MaxModIntsPerSecLowerLimit; /* Lower limit for DIM */
-+ long MaskIrqModeration; /* IRQ Mask (eg. 'TxRx') */
-+ int IntModTypeSelect; /* Type (eg. 'dynamic') */
-+ int DynIrqModSampleInterval; /* expressed in seconds! */
-+ SK_TIMER ModTimer; /* Timer for dynamic mod. */
-+} DIM_INFO;
-
--#define SK_ALLOC_IRQ 0x00000001
-+/*******************************************************************************
-+ *
-+ * Defines and typedefs regarding wake-on-lan
-+ *
-+ ******************************************************************************/
-+
-+typedef struct s_WakeOnLanInfo {
-+ SK_U32 SupportedWolOptions; /* e.g. WAKE_PHY... */
-+ SK_U32 ConfiguredWolOptions; /* e.g. WAKE_PHY... */
-+} WOL_INFO;
-
--#ifdef SK_DIAG_SUPPORT
-+#define SK_ALLOC_IRQ 0x00000001
- #define DIAG_ACTIVE 1
- #define DIAG_NOTACTIVE 0
--#endif
-
- /****************************************************************************
-+ *
- * Per board structure / Adapter Context structure:
-- * Allocated within attach(9e) and freed within detach(9e).
-- * Contains all 'per device' necessary handles, flags, locks etc.:
-- */
-+ * Contains all 'per device' necessary handles, flags, locks etc.:
-+ *
-+ ******************************************************************************/
-+
- struct s_AC {
-- SK_GEINIT GIni; /* GE init struct */
-- SK_PNMI Pnmi; /* PNMI data struct */
-- SK_VPD vpd; /* vpd data struct */
-- SK_QUEUE Event; /* Event queue */
-- SK_HWT Hwt; /* Hardware Timer control struct */
-- SK_TIMCTRL Tim; /* Software Timer control struct */
-- SK_I2C I2c; /* I2C relevant data structure */
-- SK_ADDR Addr; /* for Address module */
-- SK_CSUM Csum; /* for checksum module */
-- SK_RLMT Rlmt; /* for rlmt module */
-- spinlock_t SlowPathLock; /* Normal IRQ lock */
-- SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */
-- int RlmtMode; /* link check mode to set */
-- int RlmtNets; /* Number of nets */
--
-- SK_IOC IoBase; /* register set of adapter */
-- int BoardLevel; /* level of active hw init (0-2) */
-- char DeviceStr[80]; /* adapter string from vpd */
-- SK_U32 AllocFlag; /* flag allocation of resources */
-- struct pci_dev *PciDev; /* for access to pci config space */
-- SK_U32 PciDevId; /* pci device id */
-- struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
-- char Name[30]; /* driver name */
-- struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */
-- int RxBufSize; /* length of receive buffers */
-- struct net_device_stats stats; /* linux 'netstat -i' statistics */
-- int Index; /* internal board index number */
--
-- /* adapter RAM sizes for queues of active port */
-- int RxQueueSize; /* memory used for receive queue */
-- int TxSQueueSize; /* memory used for sync. tx queue */
-- int TxAQueueSize; /* memory used for async. tx queue */
--
-- int PromiscCount; /* promiscuous mode counter */
-- int AllMultiCount; /* allmulticast mode counter */
-- int MulticCount; /* number of different MC */
-- /* addresses for this board */
-- /* (may be more than HW can)*/
--
-- int HWRevision; /* Hardware revision */
-- int ActivePort; /* the active XMAC port */
-- int MaxPorts; /* number of activated ports */
-- int TxDescrPerRing; /* # of descriptors per tx ring */
-- int RxDescrPerRing; /* # of descriptors per rx ring */
--
-- caddr_t pDescrMem; /* Pointer to the descriptor area */
-- dma_addr_t pDescrMemDMA; /* PCI DMA address of area */
--
-- /* the port structures with descriptor rings */
-- TX_PORT TxPort[SK_MAX_MACS][2];
-- RX_PORT RxPort[SK_MAX_MACS];
--
-- unsigned int CsOfs1; /* for checksum calculation */
-- unsigned int CsOfs2; /* for checksum calculation */
-- SK_U32 CsOfs; /* for checksum calculation */
--
-- SK_BOOL CheckQueue; /* check event queue soon */
-- SK_TIMER DrvCleanupTimer;/* to check for pending descriptors */
-- DIM_INFO DynIrqModInfo; /* all data related to DIM */
--
-- /* Only for tests */
-- int PortUp;
-- int PortDown;
-- int ChipsetType; /* Chipset family type
-- * 0 == Genesis family support
-- * 1 == Yukon family support
-- */
--#ifdef SK_DIAG_SUPPORT
-- SK_U32 DiagModeActive; /* is diag active? */
-- SK_BOOL DiagFlowCtrl; /* for control purposes */
-- SK_PNMI_STRUCT_DATA PnmiBackup; /* backup structure for all Pnmi-Data */
-- SK_BOOL WasIfUp[SK_MAX_MACS]; /* for OpenClose while
-- * DIAG is busy with NIC
-- */
-+ SK_GEINIT GIni; /* GE init struct */
-+ SK_PNMI Pnmi; /* PNMI data struct */
-+ SK_VPD vpd; /* vpd data struct */
-+ SK_QUEUE Event; /* Event queue */
-+ SK_HWT Hwt; /* Hardware Timer ctrl struct */
-+ SK_TIMCTRL Tim; /* Software Timer ctrl struct */
-+ SK_I2C I2c; /* I2C relevant data structure*/
-+ SK_ADDR Addr; /* for Address module */
-+ SK_CSUM Csum; /* for checksum module */
-+ SK_RLMT Rlmt; /* for rlmt module */
-+ spinlock_t SlowPathLock; /* Normal IRQ lock */
-+ spinlock_t InitLock; /* Init lock */
-+ spinlock_t TxQueueLock; /* TX Queue lock */
-+ SK_PNMI_STRUCT_DATA PnmiStruct; /* struct for all Pnmi-Data */
-+ int RlmtMode; /* link check mode to set */
-+ int RlmtNets; /* Number of nets */
-+ SK_IOC IoBase; /* register set of adapter */
-+ int BoardLevel; /* level of hw init (0-2) */
-+ char DeviceStr[80]; /* adapter string from vpd */
-+ SK_U32 AllocFlag; /* alloc flag of resources */
-+ struct pci_dev *PciDev; /* for access to pci cfg space*/
-+ SK_U32 PciDevId; /* pci device id */
-+ struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
-+ char Name[30]; /* driver name */
-+ struct SK_NET_DEVICE *Next; /* link all devs for cleanup */
-+ struct net_device_stats stats; /* linux 'netstat -i' stats */
-+ int Index; /* internal board idx number */
-+ int RxQueueSize; /* memory used for RX queue */
-+ int TxSQueueSize; /* memory used for TXS queue */
-+ int TxAQueueSize; /* memory used for TXA queue */
-+ int PromiscCount; /* promiscuous mode counter */
-+ int AllMultiCount; /* allmulticast mode counter */
-+ int MulticCount; /* number of MC addresses used*/
-+ int HWRevision; /* Hardware revision */
-+ int ActivePort; /* the active XMAC port */
-+ int MaxPorts; /* number of activated ports */
-+ int TxDescrPerRing;/* # of descriptors TX ring */
-+ int RxDescrPerRing;/* # of descriptors RX ring */
-+ caddr_t pDescrMem; /* Ptr to the descriptor area */
-+ dma_addr_t pDescrMemDMA; /* PCI DMA address of area */
-+ SK_U32 PciState[16]; /* PCI state */
-+ TX_PORT TxPort[SK_MAX_MACS][2];
-+ RX_PORT RxPort[SK_MAX_MACS];
-+ SK_LE_TABLE StatusLETable;
-+ unsigned SizeOfAlignedLETables;
-+ spinlock_t SetPutIndexLock;
-+ int MaxUnusedRxLeWorking;
-+ unsigned int CsOfs1; /* for checksum calculation */
-+ unsigned int CsOfs2; /* for checksum calculation */
-+ SK_U32 CsOfs; /* for checksum calculation */
-+ SK_BOOL CheckQueue; /* check event queue soon */
-+ DIM_INFO DynIrqModInfo; /* all data related to IntMod */
-+ WOL_INFO WolInfo; /* all info regarding WOL */
-+ int ChipsetType; /* 0=GENESIS; 1=Yukon */
-+ SK_BOOL LowLatency; /* LowLatency optimization on?*/
-+ SK_U32 DiagModeActive;/* is diag active? */
-+ SK_BOOL DiagFlowCtrl; /* for control purposes */
-+ SK_PNMI_STRUCT_DATA PnmiBackup; /* backup structure for PNMI */
-+ SK_BOOL WasIfUp[SK_MAX_MACS];
-+#ifdef USE_TIST_FOR_RESET
-+ int AdapterResetState;
-+ SK_U32 MinTistLo;
-+ SK_U32 MinTistHi;
-+#endif
-+#ifdef Y2_RECOVERY
-+ int LastPort; /* port for curr. handled rx */
-+ int LastOpc; /* last rx LEs opcode */
-+#endif
-+#ifdef Y2_SYNC_CHECK
-+ unsigned long FramesWithoutSyncCheck; /* since last check */
- #endif
--
- };
-
-
--#endif /* __INC_SKDRV2ND_H */
-
-+#endif
-+
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skerror.h ./drivers/net/sk98lin/h/skerror.h
---- ./drivers/net/sk98lin.sk98/h/skerror.h 2004-10-19 01:54:08.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skerror.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skerror.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.7 $
-- * Date: $Date: 2003/05/13 17:25:13 $
-+ * Version: $Revision: 2.3 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: SK specific Error log support
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2004 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -36,7 +37,6 @@
- #define SK_ERRCL_HW (1L<<4) /* Hardware Failure */
- #define SK_ERRCL_COMM (1L<<5) /* Communication error */
-
--
- /*
- * Define Error Code Bases
- */
-@@ -49,7 +49,9 @@
- #define SK_ERRBASE_I2C 700 /* Base Error number for I2C module */
- #define SK_ERRBASE_QUEUE 800 /* Base Error number for Scheduler */
- #define SK_ERRBASE_ADDR 900 /* Base Error number for Address module */
--#define SK_ERRBASE_PECP 1000 /* Base Error number for PECP */
-+#define SK_ERRBASE_PECP 1000 /* Base Error number for PECP */
- #define SK_ERRBASE_DRV 1100 /* Base Error number for Driver */
-+#define SK_ERRBASE_ASF 1200 /* Base Error number for ASF */
-
- #endif /* _INC_SKERROR_H_ */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgedrv.h ./drivers/net/sk98lin/h/skgedrv.h
---- ./drivers/net/sk98lin.sk98/h/skgedrv.h 2004-10-19 01:54:37.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgedrv.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgedrv.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.10 $
-- * Date: $Date: 2003/07/04 12:25:01 $
-+ * Version: $Revision: 2.3 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Interface with the driver
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -33,7 +34,7 @@
- * In case of the driver we put the definition of the events here.
- */
- #define SK_DRV_PORT_RESET 1 /* The port needs to be reset */
--#define SK_DRV_NET_UP 2 /* The net is operational */
-+#define SK_DRV_NET_UP 2 /* The net is operational */
- #define SK_DRV_NET_DOWN 3 /* The net is down */
- #define SK_DRV_SWITCH_SOFT 4 /* Ports switch with both links connected */
- #define SK_DRV_SWITCH_HARD 5 /* Port switch due to link failure */
-@@ -44,8 +45,9 @@
- #define SK_DRV_POWER_DOWN 10 /* Power down mode */
- #define SK_DRV_TIMER 11 /* Timer for free use */
- #ifdef SK_NO_RLMT
--#define SK_DRV_LINK_UP 12 /* Link Up event for driver */
-+#define SK_DRV_LINK_UP 12 /* Link Up event for driver */
- #define SK_DRV_LINK_DOWN 13 /* Link Down event for driver */
- #endif
- #define SK_DRV_DOWNSHIFT_DET 14 /* Downshift 4-Pair / 2-Pair (YUKON only) */
-+#define SK_DRV_RX_OVERFLOW 15 /* Receive Overflow */
- #endif /* __INC_SKGEDRV_H_ */
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgehw.h ./drivers/net/sk98lin/h/skgehw.h
---- ./drivers/net/sk98lin.sk98/h/skgehw.h 2004-10-19 01:55:28.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgehw.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgehw.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.56 $
-- * Date: $Date: 2003/09/23 09:01:00 $
-+ * Version: $Revision: 2.62 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product Family
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -114,6 +115,16 @@ extern "C" {
- #define SHIFT1(x) ((x) << 1)
- #define SHIFT0(x) ((x) << 0)
-
-+/* Macro for arbitrary alignment of a given pointer */
-+#define ALIGN_ADDR( ADDRESS, GRANULARITY ) { \
-+ SK_UPTR addr = (SK_UPTR)(ADDRESS); \
-+ if (addr & ((GRANULARITY)-1)) { \
-+ addr += (GRANULARITY); \
-+ addr &= ~(SK_UPTR)((GRANULARITY)-1); \
-+ ADDRESS = (void *)addr; \
-+ }\
-+}
-+
- /*
- * Configuration Space header
- * Since this module is used for different OS', those may be
-@@ -132,34 +143,81 @@ extern "C" {
- #define PCI_BIST 0x0f /* 8 bit Built-in selftest */
- #define PCI_BASE_1ST 0x10 /* 32 bit 1st Base address */
- #define PCI_BASE_2ND 0x14 /* 32 bit 2nd Base address */
-- /* Byte 0x18..0x2b: reserved */
-+ /* Bytes 0x18..0x2b: reserved */
- #define PCI_SUB_VID 0x2c /* 16 bit Subsystem Vendor ID */
- #define PCI_SUB_ID 0x2e /* 16 bit Subsystem ID */
- #define PCI_BASE_ROM 0x30 /* 32 bit Expansion ROM Base Address */
--#define PCI_CAP_PTR 0x34 /* 8 bit Capabilities Ptr */
-- /* Byte 0x35..0x3b: reserved */
-+#define PCI_CAP_PTR 0x34 /* 8 bit Capabilities Pointer */
-+ /* Bytes 0x35..0x3b: reserved */
- #define PCI_IRQ_LINE 0x3c /* 8 bit Interrupt Line */
- #define PCI_IRQ_PIN 0x3d /* 8 bit Interrupt Pin */
- #define PCI_MIN_GNT 0x3e /* 8 bit Min_Gnt */
- #define PCI_MAX_LAT 0x3f /* 8 bit Max_Lat */
- /* Device Dependent Region */
--#define PCI_OUR_REG_1 0x40 /* 32 bit Our Register 1 */
--#define PCI_OUR_REG_2 0x44 /* 32 bit Our Register 2 */
-+#define PCI_OUR_REG_1 0x40 /* 32 bit Our Register 1 */
-+#define PCI_OUR_REG_2 0x44 /* 32 bit Our Register 2 */
- /* Power Management Region */
--#define PCI_PM_CAP_ID 0x48 /* 8 bit Power Management Cap. ID */
--#define PCI_PM_NITEM 0x49 /* 8 bit Next Item Ptr */
--#define PCI_PM_CAP_REG 0x4a /* 16 bit Power Management Capabilities */
--#define PCI_PM_CTL_STS 0x4c /* 16 bit Power Manag. Control/Status */
-+#define PCI_PM_CAP_ID 0x48 /* 8 bit Power Management Cap. ID */
-+#define PCI_PM_NITEM 0x49 /* 8 bit PM Next Item Pointer */
-+#define PCI_PM_CAP_REG 0x4a /* 16 bit Power Management Capabilities */
-+#define PCI_PM_CTL_STS 0x4c /* 16 bit Power Manag. Control/Status */
- /* Byte 0x4e: reserved */
--#define PCI_PM_DAT_REG 0x4f /* 8 bit Power Manag. Data Register */
-+#define PCI_PM_DAT_REG 0x4f /* 8 bit Power Manag. Data Register */
- /* VPD Region */
--#define PCI_VPD_CAP_ID 0x50 /* 8 bit VPD Cap. ID */
--#define PCI_VPD_NITEM 0x51 /* 8 bit Next Item Ptr */
--#define PCI_VPD_ADR_REG 0x52 /* 16 bit VPD Address Register */
--#define PCI_VPD_DAT_REG 0x54 /* 32 bit VPD Data Register */
-- /* Byte 0x58..0x59: reserved */
--#define PCI_SER_LD_CTRL 0x5a /* 16 bit SEEPROM Loader Ctrl (YUKON only) */
-- /* Byte 0x5c..0xff: reserved */
-+#define PCI_VPD_CAP_ID 0x50 /* 8 bit VPD Cap. ID */
-+#define PCI_VPD_NITEM 0x51 /* 8 bit VPD Next Item Pointer */
-+#define PCI_VPD_ADR_REG 0x52 /* 16 bit VPD Address Register */
-+#define PCI_VPD_DAT_REG 0x54 /* 32 bit VPD Data Register */
-+ /* Bytes 0x58..0x59: reserved */
-+#define PCI_SER_LD_CTRL 0x5a /* 16 bit SEEPROM Loader Ctrl (YUKON only) */
-+ /* Bytes 0x5c..0xfc: used by Yukon-2 */
-+#define PCI_MSI_CAP_ID 0x5c /* 8 bit MSI Capability ID Register */
-+#define PCI_MSI_NITEM 0x5d /* 8 bit MSI Next Item Pointer */
-+#define PCI_MSI_CTRL 0x5e /* 16 bit MSI Message Control */
-+#define PCI_MSI_ADR_LO 0x60 /* 32 bit MSI Message Address (Lower) */
-+#define PCI_MSI_ADR_HI 0x64 /* 32 bit MSI Message Address (Upper) */
-+#define PCI_MSI_DATA 0x68 /* 16 bit MSI Message Data */
-+ /* Bytes 0x6a..0x6b: reserved */
-+#define PCI_X_CAP_ID 0x6c /* 8 bit PCI-X Capability ID Register */
-+#define PCI_X_NITEM 0x6d /* 8 bit PCI-X Next Item Pointer */
-+#define PCI_X_COMMAND 0x6e /* 16 bit PCI-X Command */
-+#define PCI_X_PE_STAT 0x70 /* 32 bit PCI-X / PE Status */
-+#define PCI_CAL_CTRL 0x74 /* 16 bit PCI Calibration Control Register */
-+#define PCI_CAL_STAT 0x76 /* 16 bit PCI Calibration Status Register */
-+#define PCI_DISC_CNT 0x78 /* 16 bit PCI Discard Counter */
-+#define PCI_RETRY_CNT 0x7a /* 8 bit PCI Retry Counter */
-+ /* Byte 0x7b: reserved */
-+#define PCI_OUR_STATUS 0x7c /* 32 bit Adapter Status Register */
-+#define PCI_OUR_REG_3 0x80 /* 32 bit Our Register 3 (Yukon-ECU only) */
-+#define PCI_OUR_REG_4 0x84 /* 32 bit Our Register 4 (Yukon-ECU only) */
-+#define PCI_OUR_REG_5 0x88 /* 32 bit Our Register 5 (Yukon-ECU only) */
-+ /* Bytes 0x8c..0xdf: reserved */
-+
-+/* PCI Express Capability */
-+#define PEX_CAP_ID 0xe0 /* 8 bit PEX Capability ID */
-+#define PEX_NITEM 0xe1 /* 8 bit PEX Next Item Pointer */
-+#define PEX_CAP_REG 0xe2 /* 16 bit PEX Capability Register */
-+#define PEX_DEV_CAP 0xe4 /* 32 bit PEX Device Capabilities */
-+#define PEX_DEV_CTRL 0xe8 /* 16 bit PEX Device Control */
-+#define PEX_DEV_STAT 0xea /* 16 bit PEX Device Status */
-+#define PEX_LNK_CAP 0xec /* 32 bit PEX Link Capabilities */
-+#define PEX_LNK_CTRL 0xf0 /* 16 bit PEX Link Control */
-+#define PEX_LNK_STAT 0xf2 /* 16 bit PEX Link Status */
-+ /* Bytes 0xf4..0xff: reserved */
-+
-+/* PCI Express Extended Capabilities */
-+#define PEX_ADV_ERR_REP 0x100 /* 32 bit PEX Advanced Error Reporting */
-+#define PEX_UNC_ERR_STAT 0x104 /* 32 bit PEX Uncorr. Errors Status */
-+#define PEX_UNC_ERR_MASK 0x108 /* 32 bit PEX Uncorr. Errors Mask */
-+#define PEX_UNC_ERR_SEV 0x10c /* 32 bit PEX Uncorr. Errors Severity */
-+#define PEX_COR_ERR_STAT 0x110 /* 32 bit PEX Correc. Errors Status */
-+#define PEX_COR_ERR_MASK 0x114 /* 32 bit PEX Correc. Errors Mask */
-+#define PEX_ADV_ERR_CAP_C 0x118 /* 32 bit PEX Advanced Error Cap./Ctrl */
-+#define PEX_HEADER_LOG 0x11c /* 4x32 bit PEX Header Log Register */
-+
-+/* PCI Express Ack Timer for 1x Link */
-+#define PEX_ACK_LAT_TOX1 0x228 /* 16 bit PEX Ack Latency Timeout x1 */
-+#define PEX_ACK_RPLY_TOX1 0x22a /* 16 bit PEX Ack Reply Timeout val x1 */
-
- /*
- * I2C Address (PCI Config)
-@@ -180,13 +238,13 @@ extern "C" {
- #define PCI_ADSTEP BIT_7S /* Address Stepping */
- #define PCI_PERREN BIT_6S /* Parity Report Response enable */
- #define PCI_VGA_SNOOP BIT_5S /* VGA palette snoop */
--#define PCI_MWIEN BIT_4S /* Memory write an inv cycl ena */
-+#define PCI_MWIEN BIT_4S /* Memory write an inv cycl enable */
- #define PCI_SCYCEN BIT_3S /* Special Cycle enable */
- #define PCI_BMEN BIT_2S /* Bus Master enable */
- #define PCI_MEMEN BIT_1S /* Memory Space Access enable */
- #define PCI_IOEN BIT_0S /* I/O Space Access enable */
-
--#define PCI_COMMAND_VAL (PCI_FBTEN | PCI_SERREN | PCI_PERREN | PCI_MWIEN |\
-+#define PCI_COMMAND_VAL (PCI_INT_DIS | PCI_SERREN | PCI_PERREN | \
- PCI_BMEN | PCI_MEMEN | PCI_IOEN)
-
- /* PCI_STATUS 16 bit Status */
-@@ -220,7 +278,7 @@ extern "C" {
-
- /* PCI_HEADER_T 8 bit Header Type */
- #define PCI_HD_MF_DEV BIT_7S /* 0= single, 1= multi-func dev */
--#define PCI_HD_TYPE 0x7f /* Bit 6..0: Header Layout 0= normal */
-+#define PCI_HD_TYPE 0x7f /* Bit 6..0: Header Layout (0=normal) */
-
- /* PCI_BIST 8 bit Built-in selftest */
- /* Built-in Self test not supported (optional) */
-@@ -229,33 +287,42 @@ extern "C" {
- #define PCI_MEMSIZE 0x4000L /* use 16 kB Memory Base */
- #define PCI_MEMBASE_MSK 0xffffc000L /* Bit 31..14: Memory Base Address */
- #define PCI_MEMSIZE_MSK 0x00003ff0L /* Bit 13.. 4: Memory Size Req. */
--#define PCI_PREFEN BIT_3 /* Prefetchable */
--#define PCI_MEM_TYP (3L<<2) /* Bit 2.. 1: Memory Type */
-+#define PCI_PREFEN BIT_3 /* Prefetch enable */
-+#define PCI_MEM_TYP_MSK (3L<<1) /* Bit 2.. 1: Memory Type Mask */
-+#define PCI_MEMSPACE BIT_0 /* Memory Space Indicator */
-+
- #define PCI_MEM32BIT (0L<<1) /* Base addr anywhere in 32 Bit range */
- #define PCI_MEM1M (1L<<1) /* Base addr below 1 MegaByte */
- #define PCI_MEM64BIT (2L<<1) /* Base addr anywhere in 64 Bit range */
--#define PCI_MEMSPACE BIT_0 /* Memory Space Indicator */
-
- /* PCI_BASE_2ND 32 bit 2nd Base address */
- #define PCI_IOBASE 0xffffff00L /* Bit 31.. 8: I/O Base address */
- #define PCI_IOSIZE 0x000000fcL /* Bit 7.. 2: I/O Size Requirements */
-- /* Bit 1: reserved */
-+ /* Bit 1: reserved */
- #define PCI_IOSPACE BIT_0 /* I/O Space Indicator */
-
- /* PCI_BASE_ROM 32 bit Expansion ROM Base Address */
- #define PCI_ROMBASE_MSK 0xfffe0000L /* Bit 31..17: ROM Base address */
- #define PCI_ROMBASE_SIZ (0x1cL<<14) /* Bit 16..14: Treat as Base or Size */
- #define PCI_ROMSIZE (0x38L<<11) /* Bit 13..11: ROM Size Requirements */
-- /* Bit 10.. 1: reserved */
-+ /* Bit 10.. 1: reserved */
- #define PCI_ROMEN BIT_0 /* Address Decode enable */
-
- /* Device Dependent Region */
- /* PCI_OUR_REG_1 32 bit Our Register 1 */
-- /* Bit 31..29: reserved */
-+ /* Bit 31..29: reserved */
- #define PCI_PHY_COMA BIT_28 /* Set PHY to Coma Mode (YUKON only) */
- #define PCI_TEST_CAL BIT_27 /* Test PCI buffer calib. (YUKON only) */
- #define PCI_EN_CAL BIT_26 /* Enable PCI buffer calib. (YUKON only) */
- #define PCI_VIO BIT_25 /* PCI I/O Voltage, 0 = 3.3V, 1 = 5V */
-+/* Yukon-2 */
-+#define PCI_Y2_PIG_ENA BIT_31 /* Enable Plug-in-Go (YUKON-2) */
-+#define PCI_Y2_DLL_DIS BIT_30 /* Disable PCI DLL (YUKON-2) */
-+#define PCI_Y2_PHY2_COMA BIT_29 /* Set PHY 2 to Coma Mode (YUKON-2) */
-+#define PCI_Y2_PHY1_COMA BIT_28 /* Set PHY 1 to Coma Mode (YUKON-2) */
-+#define PCI_Y2_PHY2_POWD BIT_27 /* Set PHY 2 to Power Down (YUKON-2) */
-+#define PCI_Y2_PHY1_POWD BIT_26 /* Set PHY 1 to Power Down (YUKON-2) */
-+ /* Bit 25: reserved */
- #define PCI_DIS_BOOT BIT_24 /* Disable BOOT via ROM */
- #define PCI_EN_IO BIT_23 /* Mapping to I/O space */
- #define PCI_EN_FPROM BIT_22 /* Enable FLASH mapping to memory */
-@@ -266,9 +333,10 @@ extern "C" {
- #define PCI_PAGE_32K (1L<<20) /* 32 k pages */
- #define PCI_PAGE_64K (2L<<20) /* 64 k pages */
- #define PCI_PAGE_128K (3L<<20) /* 128 k pages */
-- /* Bit 19: reserved */
--#define PCI_PAGEREG (7L<<16) /* Bit 18..16: Page Register */
-+ /* Bit 19: reserved */
-+#define PCI_PAGEREG (7L<<16) /* Bit 18..16: Page Register */
- #define PCI_NOTAR BIT_15 /* No turnaround cycle */
-+#define PCI_PEX_LEGNAT BIT_15 /* PEX PM legacy/native mode (YUKON-2) */
- #define PCI_FORCE_BE BIT_14 /* Assert all BEs on MR */
- #define PCI_DIS_MRL BIT_13 /* Disable Mem Read Line */
- #define PCI_DIS_MRM BIT_12 /* Disable Mem Read Multiple */
-@@ -278,13 +346,21 @@ extern "C" {
- #define PCI_DIS_PCI_CLK BIT_8 /* Disable PCI clock driving */
- #define PCI_SKEW_DAS (0xfL<<4) /* Bit 7.. 4: Skew Ctrl, DAS Ext */
- #define PCI_SKEW_BASE 0xfL /* Bit 3.. 0: Skew Ctrl, Base */
-+#define PCI_CLS_OPT BIT_3 /* Cache Line Size opt. PCI-X (YUKON-2) */
-
-+/* Yukon-EC Ultra only */
-+ /* Bit 14..10: reserved */
-+#define PCI_PHY_LNK_TIM_MSK (3L<<8) /* Bit 9.. 8: GPHY Link Trigger Timer */
-+#define PCI_ENA_L1_EVENT BIT_7 /* Enable PEX L1 Event */
-+#define PCI_ENA_GPHY_LNK BIT_6 /* Enable PEX L1 on GPHY Link down */
-+#define PCI_FORCE_PEX_L1 BIT_5 /* Force to PEX L1 */
-+ /* Bit 4.. 0: reserved */
-
- /* PCI_OUR_REG_2 32 bit Our Register 2 */
- #define PCI_VPD_WR_THR (0xffL<<24) /* Bit 31..24: VPD Write Threshold */
- #define PCI_DEV_SEL (0x7fL<<17) /* Bit 23..17: EEPROM Device Select */
- #define PCI_VPD_ROM_SZ (7L<<14) /* Bit 16..14: VPD ROM Size */
-- /* Bit 13..12: reserved */
-+ /* Bit 13..12: reserved */
- #define PCI_PATCH_DIR (0xfL<<8) /* Bit 11.. 8: Ext Patches dir 3..0 */
- #define PCI_PATCH_DIR_3 BIT_11
- #define PCI_PATCH_DIR_2 BIT_10
-@@ -296,22 +372,21 @@ extern "C" {
- #define PCI_EXT_PATCH_1 BIT_5
- #define PCI_EXT_PATCH_0 BIT_4
- #define PCI_EN_DUMMY_RD BIT_3 /* Enable Dummy Read */
--#define PCI_REV_DESC BIT_2 /* Reverse Desc. Bytes */
-- /* Bit 1: reserved */
-+#define PCI_REV_DESC BIT_2 /* Reverse Descriptor Bytes */
-+ /* Bit 1: reserved */
- #define PCI_USEDATA64 BIT_0 /* Use 64Bit Data bus ext */
-
--
--/* Power Management Region */
-+/* Power Management (PM) Region */
- /* PCI_PM_CAP_REG 16 bit Power Management Capabilities */
--#define PCI_PME_SUP_MSK (0x1f<<11) /* Bit 15..11: PM Event Support Mask */
--#define PCI_PME_D3C_SUP BIT_15S /* PME from D3cold Support (if Vaux) */
-+#define PCI_PME_SUP_MSK (0x1f<<11) /* Bit 15..11: PM Event (PME) Supp. Mask */
-+#define PCI_PME_D3C_SUP BIT_15S /* PME from D3cold Support (if VAUX) */
- #define PCI_PME_D3H_SUP BIT_14S /* PME from D3hot Support */
- #define PCI_PME_D2_SUP BIT_13S /* PME from D2 Support */
- #define PCI_PME_D1_SUP BIT_12S /* PME from D1 Support */
- #define PCI_PME_D0_SUP BIT_11S /* PME from D0 Support */
- #define PCI_PM_D2_SUP BIT_10S /* D2 Support in 33 MHz mode */
- #define PCI_PM_D1_SUP BIT_9S /* D1 Support */
-- /* Bit 8.. 6: reserved */
-+ /* Bit 8.. 6: reserved */
- #define PCI_PM_DSI BIT_5S /* Device Specific Initialization */
- #define PCI_PM_APS BIT_4S /* Auxialiary Power Source */
- #define PCI_PME_CLOCK BIT_3S /* PM Event Clock */
-@@ -322,7 +397,7 @@ extern "C" {
- #define PCI_PM_DAT_SCL (3<<13) /* Bit 14..13: Data Reg. scaling factor */
- #define PCI_PM_DAT_SEL (0xf<<9) /* Bit 12.. 9: PM data selector field */
- #define PCI_PME_EN BIT_8S /* Enable PME# generation (YUKON only) */
-- /* Bit 7.. 2: reserved */
-+ /* Bit 7.. 2: reserved */
- #define PCI_PM_STATE_MSK 3 /* Bit 1.. 0: Power Management State */
-
- #define PCI_PM_STATE_D0 0 /* D0: Operational (default) */
-@@ -333,7 +408,144 @@ extern "C" {
- /* VPD Region */
- /* PCI_VPD_ADR_REG 16 bit VPD Address Register */
- #define PCI_VPD_FLAG BIT_15S /* starts VPD rd/wr cycle */
--#define PCI_VPD_ADR_MSK 0x7fffL /* Bit 14.. 0: VPD address mask */
-+#define PCI_VPD_ADR_MSK 0x7fffL /* Bit 14.. 0: VPD Address Mask */
-+
-+/* PCI_OUR_STATUS 32 bit Adapter Status Register (Yukon-2) */
-+#define PCI_OS_PCI64B BIT_31 /* Conventional PCI 64 bits Bus */
-+#define PCI_OS_PCIX BIT_30 /* PCI-X Bus */
-+#define PCI_OS_MODE_MSK (3L<<28) /* Bit 29..28: PCI-X Bus Mode Mask */
-+#define PCI_OS_PCI66M BIT_27 /* PCI 66 MHz Bus */
-+#define PCI_OS_PCI_X BIT_26 /* PCI/PCI-X Bus (0 = PEX) */
-+#define PCI_OS_DLLE_MSK (3L<<24) /* Bit 25..24: DLL Status Indication */
-+#define PCI_OS_DLLR_MSK (0xfL<<20) /* Bit 23..20: DLL Row Counters Values */
-+#define PCI_OS_DLLC_MSK (0xfL<<16) /* Bit 19..16: DLL Col. Counters Values */
-+ /* Bit 15.. 8: reserved */
-+
-+#define PCI_OS_SPEED(val) ((val & PCI_OS_MODE_MSK) >> 28) /* PCI-X Speed */
-+/* possible values for the speed field of the register */
-+#define PCI_OS_SPD_PCI 0 /* PCI Conventional Bus */
-+#define PCI_OS_SPD_X66 1 /* PCI-X 66MHz Bus */
-+#define PCI_OS_SPD_X100 2 /* PCI-X 100MHz Bus */
-+#define PCI_OS_SPD_X133 3 /* PCI-X 133MHz Bus */
-+
-+/* PCI_OUR_REG_3 32 bit Our Register 3 (Yukon-ECU only) */
-+ /* Bit 31..18: reserved */
-+#define P_CLK_COR_REGS_D0_DIS BIT_17 /* Disable Clock Core Regs in D0 */
-+#define P_CLK_PCI_REGS_D0_DIS BIT_16 /* Disable Clock PCI Regs in D0 */
-+#define P_CLK_COR_YTB_ARB_DIS BIT_15 /* Disable Clock YTB Arbiter */
-+#define P_CLK_MAC_LNK1_D3_DIS BIT_14 /* Disable Clock MAC Link1 in D3 */
-+#define P_CLK_COR_LNK1_D0_DIS BIT_13 /* Disable Clock Core Link1 in D0 */
-+#define P_CLK_MAC_LNK1_D0_DIS BIT_12 /* Disable Clock MAC Link1 in D0 */
-+#define P_CLK_COR_LNK1_D3_DIS BIT_11 /* Disable Clock Core Link1 in D3 */
-+#define P_CLK_PCI_MST_ARB_DIS BIT_10 /* Disable Clock PCI Master Arb. */
-+#define P_CLK_COR_REGS_D3_DIS BIT_9 /* Disable Clock Core Regs in D3 */
-+#define P_CLK_PCI_REGS_D3_DIS BIT_8 /* Disable Clock PCI Regs in D3 */
-+#define P_CLK_REF_LNK1_GM_DIS BIT_7 /* Disable Clock Ref. Link1 GMAC */
-+#define P_CLK_COR_LNK1_GM_DIS BIT_6 /* Disable Clock Core Link1 GMAC */
-+#define P_CLK_PCI_COMMON_DIS BIT_5 /* Disable Clock PCI Common */
-+#define P_CLK_COR_COMMON_DIS BIT_4 /* Disable Clock Core Common */
-+#define P_CLK_PCI_LNK1_BMU_DIS BIT_3 /* Disable Clock PCI Link1 BMU */
-+#define P_CLK_COR_LNK1_BMU_DIS BIT_2 /* Disable Clock Core Link1 BMU */
-+#define P_CLK_PCI_LNK1_BIU_DIS BIT_1 /* Disable Clock PCI Link1 BIU */
-+#define P_CLK_COR_LNK1_BIU_DIS BIT_0 /* Disable Clock Core Link1 BIU */
-+
-+/* PCI_OUR_REG_4 32 bit Our Register 4 (Yukon-ECU only) */
-+#define P_PEX_LTSSM_STAT_MSK (0x7fL<<25) /* Bit 31..25: PEX LTSSM Mask */
-+ /* (Link Training & Status State Machine) */
-+ /* Bit 24: reserved */
-+#define P_TIMER_VALUE_MSK (0xffL<<16) /* Bit 23..16: Timer Value Mask */
-+#define P_FORCE_ASPM_REQUEST BIT_15 /* Force ASPM Request (A1 only) */
-+ /* (Active State Power Management) */
-+ /* Bit 14..12: Force ASPM on Event */
-+#define P_ASPM_GPHY_LINK_DOWN BIT_14 /* GPHY Link Down (A1 only) */
-+#define P_ASPM_INT_FIFO_EMPTY BIT_13 /* Internal FIFO Empty (A1 only) */
-+#define P_ASPM_CLKRUN_REQUEST BIT_12 /* CLKRUN Request (A1 only) */
-+ /* Bit 11.. 4: reserved */
-+#define P_ASPM_FORCE_CLKREQ_ENA BIT_4 /* Force CLKREQ Enable (A1b only) */
-+#define P_ASPM_CLKREQ_PAD_CTL BIT_3 /* CLKREQ PAD Control (A1 only) */
-+#define P_ASPM_A1_MODE_SELECT BIT_2 /* A1 Mode Select (A1 only) */
-+#define P_CLK_GATE_PEX_UNIT_ENA BIT_1 /* Enable Gate PEX Unit Clock */
-+#define P_CLK_GATE_ROOT_COR_ENA BIT_0 /* Enable Gate Root Core Clock */
-+
-+#define P_PEX_LTSSM_STAT(x) (SHIFT25(x) & P_PEX_LTSSM_STAT_MSK)
-+#define P_PEX_LTSSM_L1_STAT 0x34
-+#define P_PEX_LTSSM_DET_STAT 0x01
-+
-+#define P_ASPM_CONTROL_MSK (P_FORCE_ASPM_REQUEST | P_ASPM_GPHY_LINK_DOWN | \
-+ P_ASPM_CLKRUN_REQUEST | P_ASPM_INT_FIFO_EMPTY)
-+
-+/* PCI_OUR_REG_5 32 bit Our Register 5 (Yukon-ECU only) */
-+ /* Bit 31..27: reserved */
-+ /* Bit 26..16: Release Clock on Event */
-+#define P_REL_PCIE_RST_DE_ASS BIT_26 /* PCIe Reset De-Asserted */
-+#define P_REL_GPHY_REC_PACKET BIT_25 /* GPHY Received Packet */
-+#define P_REL_INT_FIFO_N_EMPTY BIT_24 /* Internal FIFO Not Empty */
-+#define P_REL_MAIN_PWR_AVAIL BIT_23 /* Main Power Available */
-+#define P_REL_CLKRUN_REQ_REL BIT_22 /* CLKRUN Request Release */
-+#define P_REL_PCIE_RESET_ASS BIT_21 /* PCIe Reset Asserted */
-+#define P_REL_PME_ASSERTED BIT_20 /* PME Asserted */
-+#define P_REL_PCIE_EXIT_L1_ST BIT_19 /* PCIe Exit L1 State */
-+#define P_REL_LOADER_NOT_FIN BIT_18 /* EPROM Loader Not Finished */
-+#define P_REL_PCIE_RX_EX_IDLE BIT_17 /* PCIe Rx Exit Electrical Idle State */
-+#define P_REL_GPHY_LINK_UP BIT_16 /* GPHY Link Up */
-+ /* Bit 15..11: reserved */
-+ /* Bit 10.. 0: Mask for Gate Clock */
-+#define P_GAT_PCIE_RST_DE_ASS BIT_10 /* PCIe Reset De-Asserted */
-+#define P_GAT_GPHY_N_REC_PACKET BIT_9 /* GPHY Not Received Packet */
-+#define P_GAT_INT_FIFO_EMPTY BIT_8 /* Internal FIFO Empty */
-+#define P_GAT_MAIN_PWR_N_AVAIL BIT_7 /* Main Power Not Available */
-+#define P_GAT_CLKRUN_REQ_REL BIT_6 /* CLKRUN Not Requested */
-+#define P_GAT_PCIE_RESET_ASS BIT_5 /* PCIe Reset Asserted */
-+#define P_GAT_PME_DE_ASSERTED BIT_4 /* PME De-Asserted */
-+#define P_GAT_PCIE_ENTER_L1_ST BIT_3 /* PCIe Enter L1 State */
-+#define P_GAT_LOADER_FINISHED BIT_2 /* EPROM Loader Finished */
-+#define P_GAT_PCIE_RX_EL_IDLE BIT_1 /* PCIe Rx Electrical Idle State */
-+#define P_GAT_GPHY_LINK_DOWN BIT_0 /* GPHY Link Down */
-+
-+/* PEX_DEV_CTRL 16 bit PEX Device Control (Yukon-2) */
-+ /* Bit 15 reserved */
-+#define PEX_DC_MAX_RRS_MSK (7<<12) /* Bit 14..12: Max. Read Request Size */
-+#define PEX_DC_EN_NO_SNOOP BIT_11S /* Enable No Snoop */
-+#define PEX_DC_EN_AUX_POW BIT_10S /* Enable AUX Power */
-+#define PEX_DC_EN_PHANTOM BIT_9S /* Enable Phantom Functions */
-+#define PEX_DC_EN_EXT_TAG BIT_8S /* Enable Extended Tag Field */
-+#define PEX_DC_MAX_PLS_MSK (7<<5) /* Bit 7.. 5: Max. Payload Size Mask */
-+#define PEX_DC_EN_REL_ORD BIT_4S /* Enable Relaxed Ordering */
-+#define PEX_DC_EN_UNS_RQ_RP BIT_3S /* Enable Unsupported Request Reporting */
-+#define PEX_DC_EN_FAT_ER_RP BIT_2S /* Enable Fatal Error Reporting */
-+#define PEX_DC_EN_NFA_ER_RP BIT_1S /* Enable Non-Fatal Error Reporting */
-+#define PEX_DC_EN_COR_ER_RP BIT_0S /* Enable Correctable Error Reporting */
-+
-+#define PEX_DC_MAX_RD_RQ_SIZE(x) (SHIFT12(x) & PEX_DC_MAX_RRS_MSK)
-+
-+/* PEX_LNK_CTRL 16 bit PEX Link Control (Yukon-2) */
-+#define PEX_LC_CLK_PM_ENA BIT_8S /* Enable Clock Power Management (CLKREQ) */
-+
-+/* PEX_LNK_STAT 16 bit PEX Link Status (Yukon-2) */
-+ /* Bit 15..13 reserved */
-+#define PEX_LS_SLOT_CLK_CFG BIT_12S /* Slot Clock Config */
-+#define PEX_LS_LINK_TRAIN BIT_11S /* Link Training */
-+#define PEX_LS_TRAIN_ERROR BIT_10S /* Training Error */
-+#define PEX_LS_LINK_WI_MSK (0x3f<<4) /* Bit 9.. 4: Neg. Link Width Mask */
-+#define PEX_LS_LINK_SP_MSK 0x0f /* Bit 3.. 0: Link Speed Mask */
-+
-+/* PEX_UNC_ERR_STAT 16 bit PEX Uncorrectable Errors Status (Yukon-2) */
-+ /* Bit 31..21 reserved */
-+#define PEX_UNSUP_REQ BIT_20 /* Unsupported Request Error */
-+ /* ECRC Error (not supported) */
-+#define PEX_MALFOR_TLP BIT_18 /* Malformed TLP */
-+ /* Receiver Overflow (not supported) */
-+#define PEX_UNEXP_COMP BIT_16 /* Unexpected Completion */
-+ /* Completer Abort (not supported) */
-+#define PEX_COMP_TO BIT_14 /* Completion Timeout */
-+#define PEX_FLOW_CTRL_P BIT_13 /* Flow Control Protocol Error */
-+#define PEX_POIS_TLP BIT_12 /* Poisoned TLP */
-+ /* Bit 11.. 5: reserved */
-+#define PEX_DATA_LINK_P BIT_4 /* Data Link Protocol Error */
-+ /* Bit 3.. 1: reserved */
-+ /* Training Error (not supported) */
-+
-+#define PEX_FATAL_ERRORS (PEX_MALFOR_TLP | PEX_FLOW_CTRL_P | PEX_DATA_LINK_P)
-
- /* Control Register File (Address Map) */
-
-@@ -349,8 +561,14 @@ extern "C" {
- #define B0_IMSK 0x000c /* 32 bit Interrupt Mask Register */
- #define B0_HWE_ISRC 0x0010 /* 32 bit HW Error Interrupt Src Reg */
- #define B0_HWE_IMSK 0x0014 /* 32 bit HW Error Interrupt Mask Reg */
--#define B0_SP_ISRC 0x0018 /* 32 bit Special Interrupt Source Reg */
-- /* 0x001c: reserved */
-+#define B0_SP_ISRC 0x0018 /* 32 bit Special Interrupt Source Reg 1 */
-+
-+/* Special ISR registers (Yukon-2 only) */
-+#define B0_Y2_SP_ISRC2 0x001c /* 32 bit Special Interrupt Source Reg 2 */
-+#define B0_Y2_SP_ISRC3 0x0020 /* 32 bit Special Interrupt Source Reg 3 */
-+#define B0_Y2_SP_EISR 0x0024 /* 32 bit Enter ISR Reg */
-+#define B0_Y2_SP_LISR 0x0028 /* 32 bit Leave ISR Reg */
-+#define B0_Y2_SP_ICR 0x002c /* 32 bit Interrupt Control Reg */
-
- /* B0 XMAC 1 registers (GENESIS only) */
- #define B0_XM1_IMSK 0x0020 /* 16 bit r/w XMAC 1 Interrupt Mask Register*/
-@@ -372,7 +590,7 @@ extern "C" {
- #define B0_XM2_PHY_DATA 0x0054 /* 16 bit r/w XMAC 2 PHY Data Register */
- /* 0x0056 - 0x005f: reserved */
-
--/* BMU Control Status Registers */
-+/* BMU Control Status Registers (Yukon and Genesis) */
- #define B0_R1_CSR 0x0060 /* 32 bit BMU Ctrl/Stat Rx Queue 1 */
- #define B0_R2_CSR 0x0064 /* 32 bit BMU Ctrl/Stat Rx Queue 2 */
- #define B0_XS1_CSR 0x0068 /* 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
-@@ -390,7 +608,7 @@ extern "C" {
- /*
- * Bank 2
- */
--/* NA reg = 48 bit Network Address Register, 3x16 or 8x8 bit readable */
-+/* NA reg = 48 bit Network Address Register, 3x16 or 6x8 bit readable */
- #define B2_MAC_1 0x0100 /* NA reg MAC Address 1 */
- /* 0x0106 - 0x0107: reserved */
- #define B2_MAC_2 0x0108 /* NA reg MAC Address 2 */
-@@ -400,14 +618,23 @@ extern "C" {
- #define B2_CONN_TYP 0x0118 /* 8 bit Connector type */
- #define B2_PMD_TYP 0x0119 /* 8 bit PMD type */
- #define B2_MAC_CFG 0x011a /* 8 bit MAC Configuration / Chip Revision */
--#define B2_CHIP_ID 0x011b /* 8 bit Chip Identification Number */
-- /* Eprom registers are currently of no use */
-+#define B2_CHIP_ID 0x011b /* 8 bit Chip Identification Number */
-+ /* Eprom registers */
- #define B2_E_0 0x011c /* 8 bit EPROM Byte 0 (ext. SRAM size */
-+/* Yukon and Genesis */
- #define B2_E_1 0x011d /* 8 bit EPROM Byte 1 (PHY type) */
- #define B2_E_2 0x011e /* 8 bit EPROM Byte 2 */
-+/* Yukon-2 */
-+#define B2_Y2_CLK_GATE 0x011d /* 8 bit Clock Gating (Yukon-2) */
-+#define B2_Y2_HW_RES 0x011e /* 8 bit HW Resources (Yukon-2) */
-+
- #define B2_E_3 0x011f /* 8 bit EPROM Byte 3 */
-+
-+/* Yukon and Genesis */
- #define B2_FAR 0x0120 /* 32 bit Flash-Prom Addr Reg/Cnt */
- #define B2_FDP 0x0124 /* 8 bit Flash-Prom Data Port */
-+/* Yukon-2 */
-+#define B2_Y2_CLK_CTRL 0x0120 /* 32 bit Core Clock Frequency Control */
- /* 0x0125 - 0x0127: reserved */
- #define B2_LD_CTRL 0x0128 /* 8 bit EPROM loader control register */
- #define B2_LD_TEST 0x0129 /* 8 bit EPROM loader test register */
-@@ -439,6 +666,10 @@ extern "C" {
- #define B2_BSC_CTRL 0x0178 /* 8 bit Blink Source Counter Control */
- #define B2_BSC_STAT 0x0179 /* 8 bit Blink Source Counter Status */
- #define B2_BSC_TST 0x017a /* 16 bit Blink Source Counter Test Reg */
-+
-+/* Yukon-2 */
-+#define Y2_PEX_PHY_DATA 0x0170 /* 16 bit PEX PHY Data Register */
-+#define Y2_PEX_PHY_ADDR 0x0172 /* 16 bit PEX PHY Address Register */
- /* 0x017c - 0x017f: reserved */
-
- /*
-@@ -448,9 +679,14 @@ extern "C" {
- #define B3_RAM_ADDR 0x0180 /* 32 bit RAM Address, to read or write */
- #define B3_RAM_DATA_LO 0x0184 /* 32 bit RAM Data Word (low dWord) */
- #define B3_RAM_DATA_HI 0x0188 /* 32 bit RAM Data Word (high dWord) */
-+#define B3_RAM_PARITY 0x018c /* 8 bit RAM Parity (Yukon-ECU A1) */
-+
-+#define SELECT_RAM_BUFFER(rb, addr) (addr | (rb << 6)) /* Yukon-2 only */
-+
- /* 0x018c - 0x018f: reserved */
-
- /* RAM Interface Registers */
-+/* Yukon-2: use SELECT_RAM_BUFFER() to access the RAM buffer */
- /*
- * The HW-Spec. calls this registers Timeout Value 0..11. But this names are
- * not usable in SW. Please notice these are NOT real timeouts, these are
-@@ -517,8 +753,8 @@ extern "C" {
- /* 0x01ea - 0x01eb: reserved */
- #define B3_PA_TOVAL_TX2 0x01ec /* 16 bit Timeout Val Tx Path MAC 2 */
- /* 0x01ee - 0x01ef: reserved */
--#define B3_PA_CTRL 0x01f0 /* 16 bit Packet Arbiter Ctrl Register */
--#define B3_PA_TEST 0x01f2 /* 16 bit Packet Arbiter Test Register */
-+#define B3_PA_CTRL 0x01f0 /* 16 bit Packet Arbiter Ctrl Register */
-+#define B3_PA_TEST 0x01f2 /* 16 bit Packet Arbiter Test Register */
- /* 0x01f4 - 0x01ff: reserved */
-
- /*
-@@ -532,7 +768,16 @@ extern "C" {
- #define TXA_CTRL 0x0210 /* 8 bit Tx Arbiter Control Register */
- #define TXA_TEST 0x0211 /* 8 bit Tx Arbiter Test Register */
- #define TXA_STAT 0x0212 /* 8 bit Tx Arbiter Status Register */
-- /* 0x0213 - 0x027f: reserved */
-+ /* 0x0213 - 0x021f: reserved */
-+
-+ /* RSS key registers for Yukon-2 Family */
-+#define B4_RSS_KEY 0x0220 /* 4x32 bit RSS Key register (Yukon-2) */
-+ /* RSS key register offsets */
-+#define KEY_IDX_0 0 /* offset for location of KEY 0 */
-+#define KEY_IDX_1 4 /* offset for location of KEY 1 */
-+#define KEY_IDX_2 8 /* offset for location of KEY 2 */
-+#define KEY_IDX_3 12 /* offset for location of KEY 3 */
-+
- /* 0x0280 - 0x0292: MAC 2 */
- /* 0x0213 - 0x027f: reserved */
-
-@@ -556,10 +801,10 @@ extern "C" {
-
- /* Queue Register Offsets, use Q_ADDR() to access */
- #define Q_D 0x00 /* 8*32 bit Current Descriptor */
--#define Q_DA_L 0x20 /* 32 bit Current Descriptor Address Low dWord */
--#define Q_DA_H 0x24 /* 32 bit Current Descriptor Address High dWord */
--#define Q_AC_L 0x28 /* 32 bit Current Address Counter Low dWord */
--#define Q_AC_H 0x2c /* 32 bit Current Address Counter High dWord */
-+#define Q_DA_L 0x20 /* 32 bit Current Descriptor Address Low DWord */
-+#define Q_DA_H 0x24 /* 32 bit Current Descriptor Address High DWord */
-+#define Q_AC_L 0x28 /* 32 bit Current Address Counter Low DWord */
-+#define Q_AC_H 0x2c /* 32 bit Current Address Counter High DWord */
- #define Q_BC 0x30 /* 32 bit Current Byte Counter */
- #define Q_CSR 0x34 /* 32 bit BMU Control/Status Register */
- #define Q_F 0x38 /* 32 bit Flag Register */
-@@ -570,8 +815,56 @@ extern "C" {
- #define Q_T1_SV 0x3f /* 8 bit Test Register 1 Supervisor SM */
- #define Q_T2 0x40 /* 32 bit Test Register 2 */
- #define Q_T3 0x44 /* 32 bit Test Register 3 */
-+
-+/* Yukon-2 */
-+#define Q_DONE 0x24 /* 16 bit Done Index */
-+
-+#define Q_WM 0x40 /* 16 bit FIFO Watermark */
-+#define Q_AL 0x42 /* 8 bit FIFO Alignment */
-+ /* 0x43: reserved */
-+/* RX Queue */
-+#define Q_RX_RSP 0x44 /* 16 bit FIFO Read Shadow Pointer */
-+#define Q_RX_RSL 0x46 /* 8 bit FIFO Read Shadow Level */
-+ /* 0x47: reserved */
-+#define Q_RX_RP 0x48 /* 8 bit FIFO Read Pointer */
-+ /* 0x49: reserved */
-+#define Q_RX_RL 0x4a /* 8 bit FIFO Read Level */
-+ /* 0x4b: reserved */
-+#define Q_RX_WP 0x4c /* 8 bit FIFO Write Pointer */
-+#define Q_RX_WSP 0x4d /* 8 bit FIFO Write Shadow Pointer */
-+#define Q_RX_WL 0x4e /* 8 bit FIFO Write Level */
-+#define Q_RX_WSL 0x4f /* 8 bit FIFO Write Shadow Level */
-+/* TX Queue */
-+#define Q_TX_WSP 0x44 /* 16 bit FIFO Write Shadow Pointer */
-+#define Q_TX_WSL 0x46 /* 8 bit FIFO Write Shadow Level */
-+ /* 0x47: reserved */
-+#define Q_TX_WP 0x48 /* 8 bit FIFO Write Pointer */
-+ /* 0x49: reserved */
-+#define Q_TX_WL 0x4a /* 8 bit FIFO Write Level */
-+ /* 0x4b: reserved */
-+#define Q_TX_RP 0x4c /* 8 bit FIFO Read Pointer */
-+ /* 0x4d: reserved */
-+#define Q_TX_RL 0x4e /* 8 bit FIFO Read Level */
-+ /* 0x4f: reserved */
-+
- /* 0x48 - 0x7f: reserved */
-
-+/* Queue Prefetch Unit Offsets, use Y2_PREF_Q_ADDR() to address (Yukon-2 only)*/
-+#define Y2_B8_PREF_REGS 0x0450
-+
-+#define PREF_UNIT_CTRL_REG 0x00 /* 32 bit Prefetch Control register */
-+#define PREF_UNIT_LAST_IDX_REG 0x04 /* 16 bit Last Index */
-+#define PREF_UNIT_ADDR_LOW_REG 0x08 /* 32 bit List start addr, low part */
-+#define PREF_UNIT_ADDR_HI_REG 0x0c /* 32 bit List start addr, high part*/
-+#define PREF_UNIT_GET_IDX_REG 0x10 /* 16 bit Get Index */
-+#define PREF_UNIT_PUT_IDX_REG 0x14 /* 16 bit Put Index */
-+#define PREF_UNIT_FIFO_WP_REG 0x20 /* 8 bit FIFO write pointer */
-+#define PREF_UNIT_FIFO_RP_REG 0x24 /* 8 bit FIFO read pointer */
-+#define PREF_UNIT_FIFO_WM_REG 0x28 /* 8 bit FIFO watermark */
-+#define PREF_UNIT_FIFO_LEV_REG 0x2c /* 8 bit FIFO level */
-+
-+#define PREF_UNIT_MASK_IDX 0x0fff
-+
- /*
- * Bank 16 - 23
- */
-@@ -583,17 +876,17 @@ extern "C" {
- #define RB_END 0x04 /* 32 bit RAM Buffer End Address */
- #define RB_WP 0x08 /* 32 bit RAM Buffer Write Pointer */
- #define RB_RP 0x0c /* 32 bit RAM Buffer Read Pointer */
--#define RB_RX_UTPP 0x10 /* 32 bit Rx Upper Threshold, Pause Pack */
--#define RB_RX_LTPP 0x14 /* 32 bit Rx Lower Threshold, Pause Pack */
-+#define RB_RX_UTPP 0x10 /* 32 bit Rx Upper Threshold, Pause Packet */
-+#define RB_RX_LTPP 0x14 /* 32 bit Rx Lower Threshold, Pause Packet */
- #define RB_RX_UTHP 0x18 /* 32 bit Rx Upper Threshold, High Prio */
- #define RB_RX_LTHP 0x1c /* 32 bit Rx Lower Threshold, High Prio */
- /* 0x10 - 0x1f: reserved at Tx RAM Buffer Registers */
- #define RB_PC 0x20 /* 32 bit RAM Buffer Packet Counter */
- #define RB_LEV 0x24 /* 32 bit RAM Buffer Level Register */
--#define RB_CTRL 0x28 /* 8 bit RAM Buffer Control Register */
-+#define RB_CTRL 0x28 /* 32 bit RAM Buffer Control Register */
- #define RB_TST1 0x29 /* 8 bit RAM Buffer Test Register 1 */
--#define RB_TST2 0x2A /* 8 bit RAM Buffer Test Register 2 */
-- /* 0x2c - 0x7f: reserved */
-+#define RB_TST2 0x2a /* 8 bit RAM Buffer Test Register 2 */
-+ /* 0x2b - 0x7f: reserved */
-
- /*
- * Bank 24
-@@ -603,7 +896,7 @@ extern "C" {
- * use MR_ADDR() to access
- */
- #define RX_MFF_EA 0x0c00 /* 32 bit Receive MAC FIFO End Address */
--#define RX_MFF_WP 0x0c04 /* 32 bit Receive MAC FIFO Write Pointer */
-+#define RX_MFF_WP 0x0c04 /* 32 bit Receive MAC FIFO Write Pointer */
- /* 0x0c08 - 0x0c0b: reserved */
- #define RX_MFF_RP 0x0c0c /* 32 bit Receive MAC FIFO Read Pointer */
- #define RX_MFF_PC 0x0c10 /* 32 bit Receive MAC FIFO Packet Cnt */
-@@ -628,20 +921,23 @@ extern "C" {
- #define LNK_LED_REG 0x0c3c /* 8 bit Link LED Register */
- /* 0x0c3d - 0x0c3f: reserved */
-
--/* Receive GMAC FIFO (YUKON only), use MR_ADDR() to access */
-+/* Receive GMAC FIFO (YUKON and Yukon-2), use MR_ADDR() to access */
- #define RX_GMF_EA 0x0c40 /* 32 bit Rx GMAC FIFO End Address */
- #define RX_GMF_AF_THR 0x0c44 /* 32 bit Rx GMAC FIFO Almost Full Thresh. */
- #define RX_GMF_CTRL_T 0x0c48 /* 32 bit Rx GMAC FIFO Control/Test */
- #define RX_GMF_FL_MSK 0x0c4c /* 32 bit Rx GMAC FIFO Flush Mask */
- #define RX_GMF_FL_THR 0x0c50 /* 32 bit Rx GMAC FIFO Flush Threshold */
-- /* 0x0c54 - 0x0c5f: reserved */
--#define RX_GMF_WP 0x0c60 /* 32 bit Rx GMAC FIFO Write Pointer */
-+#define RX_GMF_TR_THR 0x0c54 /* 32 bit Rx Truncation Threshold (Yukon-2) */
-+#define RX_GMF_UP_THR 0x0c58 /* 16 bit Rx Upper Pause Thr (Yukon-EC_U) */
-+#define RX_GMF_LP_THR 0x0c5a /* 16 bit Rx Lower Pause Thr (Yukon-EC_U) */
-+#define RX_GMF_VLAN 0x0c5c /* 32 bit Rx VLAN Type Register (Yukon-2) */
-+#define RX_GMF_WP 0x0c60 /* 32 bit Rx GMAC FIFO Write Pointer */
- /* 0x0c64 - 0x0c67: reserved */
--#define RX_GMF_WLEV 0x0c68 /* 32 bit Rx GMAC FIFO Write Level */
-+#define RX_GMF_WLEV 0x0c68 /* 32 bit Rx GMAC FIFO Write Level */
- /* 0x0c6c - 0x0c6f: reserved */
--#define RX_GMF_RP 0x0c70 /* 32 bit Rx GMAC FIFO Read Pointer */
-+#define RX_GMF_RP 0x0c70 /* 32 bit Rx GMAC FIFO Read Pointer */
- /* 0x0c74 - 0x0c77: reserved */
--#define RX_GMF_RLEV 0x0c78 /* 32 bit Rx GMAC FIFO Read Level */
-+#define RX_GMF_RLEV 0x0c78 /* 32 bit Rx GMAC FIFO Read Level */
- /* 0x0c7c - 0x0c7f: reserved */
-
- /*
-@@ -658,7 +954,7 @@ extern "C" {
- * use MR_ADDR() to access
- */
- #define TX_MFF_EA 0x0d00 /* 32 bit Transmit MAC FIFO End Address */
--#define TX_MFF_WP 0x0d04 /* 32 bit Transmit MAC FIFO WR Pointer */
-+#define TX_MFF_WP 0x0d04 /* 32 bit Transmit MAC FIFO WR Pointer */
- #define TX_MFF_WSP 0x0d08 /* 32 bit Transmit MAC FIFO WR Shadow Ptr */
- #define TX_MFF_RP 0x0d0c /* 32 bit Transmit MAC FIFO RD Pointer */
- #define TX_MFF_PC 0x0d10 /* 32 bit Transmit MAC FIFO Packet Cnt */
-@@ -676,18 +972,19 @@ extern "C" {
- #define TX_LED_TST 0x0d29 /* 8 bit Transmit LED Cnt Test Reg */
- /* 0x0d2a - 0x0d3f: reserved */
-
--/* Transmit GMAC FIFO (YUKON only), use MR_ADDR() to access */
-+/* Transmit GMAC FIFO (YUKON and Yukon-2), use MR_ADDR() to access */
- #define TX_GMF_EA 0x0d40 /* 32 bit Tx GMAC FIFO End Address */
--#define TX_GMF_AE_THR 0x0d44 /* 32 bit Tx GMAC FIFO Almost Empty Thresh.*/
-+#define TX_GMF_AE_THR 0x0d44 /* 32 bit Tx GMAC FIFO Almost Empty Thresh. */
- #define TX_GMF_CTRL_T 0x0d48 /* 32 bit Tx GMAC FIFO Control/Test */
-- /* 0x0d4c - 0x0d5f: reserved */
--#define TX_GMF_WP 0x0d60 /* 32 bit Tx GMAC FIFO Write Pointer */
--#define TX_GMF_WSP 0x0d64 /* 32 bit Tx GMAC FIFO Write Shadow Ptr. */
--#define TX_GMF_WLEV 0x0d68 /* 32 bit Tx GMAC FIFO Write Level */
-+ /* 0x0d4c - 0x0d5b: reserved */
-+#define TX_GMF_VLAN 0x0d5c /* 32 bit Tx VLAN Type Register (Yukon-2) */
-+#define TX_GMF_WP 0x0d60 /* 32 bit Tx GMAC FIFO Write Pointer */
-+#define TX_GMF_WSP 0x0d64 /* 32 bit Tx GMAC FIFO Write Shadow Pointer */
-+#define TX_GMF_WLEV 0x0d68 /* 32 bit Tx GMAC FIFO Write Level */
- /* 0x0d6c - 0x0d6f: reserved */
--#define TX_GMF_RP 0x0d70 /* 32 bit Tx GMAC FIFO Read Pointer */
--#define TX_GMF_RSTP 0x0d74 /* 32 bit Tx GMAC FIFO Restart Pointer */
--#define TX_GMF_RLEV 0x0d78 /* 32 bit Tx GMAC FIFO Read Level */
-+#define TX_GMF_RP 0x0d70 /* 32 bit Tx GMAC FIFO Read Pointer */
-+#define TX_GMF_RSTP 0x0d74 /* 32 bit Tx GMAC FIFO Restart Pointer */
-+#define TX_GMF_RLEV 0x0d78 /* 32 bit Tx GMAC FIFO Read Level */
- /* 0x0d7c - 0x0d7f: reserved */
-
- /*
-@@ -713,12 +1010,84 @@ extern "C" {
- #define GMAC_TI_ST_CTRL 0x0e18 /* 8 bit Time Stamp Timer Ctrl Reg */
- /* 0x0e19: reserved */
- #define GMAC_TI_ST_TST 0x0e1a /* 8 bit Time Stamp Timer Test Reg */
-- /* 0x0e1b - 0x0e7f: reserved */
-+ /* 0x0e1b - 0x0e1f: reserved */
-+
-+/* Polling Unit Registers (Yukon-2 only) */
-+#define POLL_CTRL 0x0e20 /* 32 bit Polling Unit Control Reg */
-+#define POLL_LAST_IDX 0x0e24 /* 16 bit Polling Unit List Last Index */
-+ /* 0x0e26 - 0x0e27: reserved */
-+#define POLL_LIST_ADDR_LO 0x0e28 /* 32 bit Poll. List Start Addr (low) */
-+#define POLL_LIST_ADDR_HI 0x0e2c /* 32 bit Poll. List Start Addr (high) */
-+ /* 0x0e30 - 0x0e3f: reserved */
-+
-+/* ASF Subsystem Registers (Yukon-2 only) */
-+#define B28_Y2_SMB_CONFIG 0x0e40 /* 32 bit ASF SMBus Config Register */
-+#define B28_Y2_SMB_CSD_REG 0x0e44 /* 32 bit ASF SMB Control/Status/Data */
-+ /* 0x0e48 - 0x0e5f: reserved */
-+#define B28_Y2_ASF_IRQ_V_BASE 0x0e60 /* 32 bit ASF IRQ Vector Base */
-+ /* 0x0e64 - 0x0e67: reserved */
-+#define B28_Y2_ASF_STAT_CMD 0x0e68 /* 32 bit ASF Status and Command Reg */
-+#define B28_Y2_ASF_HOST_COM 0x0e6c /* 32 bit ASF Host Communication Reg */
-+#define B28_Y2_DATA_REG_1 0x0e70 /* 32 bit ASF/Host Data Register 1 */
-+#define B28_Y2_DATA_REG_2 0x0e74 /* 32 bit ASF/Host Data Register 2 */
-+#define B28_Y2_DATA_REG_3 0x0e78 /* 32 bit ASF/Host Data Register 3 */
-+#define B28_Y2_DATA_REG_4 0x0e7c /* 32 bit ASF/Host Data Register 4 */
-
- /*
- * Bank 29
- */
-- /* 0x0e80 - 0x0efc: reserved */
-+
-+/* Status BMU Registers (Yukon-2 only)*/
-+#define STAT_CTRL 0x0e80 /* 32 bit Status BMU Control Reg */
-+#define STAT_LAST_IDX 0x0e84 /* 16 bit Status BMU Last Index */
-+ /* 0x0e85 - 0x0e86: reserved */
-+#define STAT_LIST_ADDR_LO 0x0e88 /* 32 bit Status List Start Addr (low) */
-+#define STAT_LIST_ADDR_HI 0x0e8c /* 32 bit Status List Start Addr (high) */
-+#define STAT_TXA1_RIDX 0x0e90 /* 16 bit Status TxA1 Report Index Reg */
-+#define STAT_TXS1_RIDX 0x0e92 /* 16 bit Status TxS1 Report Index Reg */
-+#define STAT_TXA2_RIDX 0x0e94 /* 16 bit Status TxA2 Report Index Reg */
-+#define STAT_TXS2_RIDX 0x0e96 /* 16 bit Status TxS2 Report Index Reg */
-+#define STAT_TX_IDX_TH 0x0e98 /* 16 bit Status Tx Index Threshold Reg */
-+ /* 0x0e9a - 0x0e9b: reserved */
-+#define STAT_PUT_IDX 0x0e9c /* 16 bit Status Put Index Reg */
-+ /* 0x0e9e - 0x0e9f: reserved */
-+
-+/* FIFO Control/Status Registers (Yukon-2 only) */
-+#define STAT_FIFO_WP 0x0ea0 /* 8 bit Status FIFO Write Pointer Reg */
-+ /* 0x0ea1 - 0x0ea3: reserved */
-+#define STAT_FIFO_RP 0x0ea4 /* 8 bit Status FIFO Read Pointer Reg */
-+ /* 0x0ea5: reserved */
-+#define STAT_FIFO_RSP 0x0ea6 /* 8 bit Status FIFO Read Shadow Ptr */
-+ /* 0x0ea7: reserved */
-+#define STAT_FIFO_LEVEL 0x0ea8 /* 8 bit Status FIFO Level Reg */
-+ /* 0x0ea9: reserved */
-+#define STAT_FIFO_SHLVL 0x0eaa /* 8 bit Status FIFO Shadow Level Reg */
-+ /* 0x0eab: reserved */
-+#define STAT_FIFO_WM 0x0eac /* 8 bit Status FIFO Watermark Reg */
-+#define STAT_FIFO_ISR_WM 0x0ead /* 8 bit Status FIFO ISR Watermark Reg */
-+ /* 0x0eae - 0x0eaf: reserved */
-+
-+/* Level and ISR Timer Registers (Yukon-2 only) */
-+#define STAT_LEV_TIMER_INI 0x0eb0 /* 32 bit Level Timer Init. Value Reg */
-+#define STAT_LEV_TIMER_CNT 0x0eb4 /* 32 bit Level Timer Counter Reg */
-+#define STAT_LEV_TIMER_CTRL 0x0eb8 /* 8 bit Level Timer Control Reg */
-+#define STAT_LEV_TIMER_TEST 0x0eb9 /* 8 bit Level Timer Test Reg */
-+ /* 0x0eba - 0x0ebf: reserved */
-+#define STAT_TX_TIMER_INI 0x0ec0 /* 32 bit Tx Timer Init. Value Reg */
-+#define STAT_TX_TIMER_CNT 0x0ec4 /* 32 bit Tx Timer Counter Reg */
-+#define STAT_TX_TIMER_CTRL 0x0ec8 /* 8 bit Tx Timer Control Reg */
-+#define STAT_TX_TIMER_TEST 0x0ec9 /* 8 bit Tx Timer Test Reg */
-+ /* 0x0eca - 0x0ecf: reserved */
-+#define STAT_ISR_TIMER_INI 0x0ed0 /* 32 bit ISR Timer Init. Value Reg */
-+#define STAT_ISR_TIMER_CNT 0x0ed4 /* 32 bit ISR Timer Counter Reg */
-+#define STAT_ISR_TIMER_CTRL 0x0ed8 /* 8 bit ISR Timer Control Reg */
-+#define STAT_ISR_TIMER_TEST 0x0ed9 /* 8 bit ISR Timer Test Reg */
-+ /* 0x0eda - 0x0eff: reserved */
-+
-+#define ST_LAST_IDX_MASK 0x007f /* Last Index Mask */
-+#define ST_TXRP_IDX_MASK 0x0fff /* Tx Report Index Mask */
-+#define ST_TXTH_IDX_MASK 0x0fff /* Tx Threshold Index Mask */
-+#define ST_WM_IDX_MASK 0x3f /* FIFO Watermark Index Mask */
-
- /*
- * Bank 30
-@@ -742,11 +1111,9 @@ extern "C" {
- #define WOL_MATCH_RES 0x0f23 /* 8 bit WOL Match Result Reg */
- #define WOL_MAC_ADDR_LO 0x0f24 /* 32 bit WOL MAC Address Low */
- #define WOL_MAC_ADDR_HI 0x0f28 /* 16 bit WOL MAC Address High */
--#define WOL_PATT_RPTR 0x0f2c /* 8 bit WOL Pattern Read Ptr */
--
--/* use this macro to access above registers */
--#define WOL_REG(Reg) ((Reg) + (pAC->GIni.GIWolOffs))
--
-+#define WOL_PATT_PME 0x0f2a /* 8 bit WOL PME Match Enable (Yukon-2) */
-+#define WOL_PATT_ASFM 0x0f2b /* 8 bit WOL ASF Match Enable (Yukon-2) */
-+#define WOL_PATT_RPTR 0x0f2c /* 8 bit WOL Pattern Read Pointer */
-
- /* WOL Pattern Length Registers (YUKON only) */
-
-@@ -764,11 +1131,22 @@ extern "C" {
- */
- /* 0x0f80 - 0x0fff: reserved */
-
-+/* WOL registers link 2 */
-+
-+/* use this macro to access WOL registers */
-+#define WOL_REG(Port, Reg) ((Reg) + ((Port)*0x80) + (pAC->GIni.GIWolOffs))
-+
- /*
- * Bank 32 - 33
- */
- #define WOL_PATT_RAM_1 0x1000 /* WOL Pattern RAM Link 1 */
-+#define WOL_PATT_RAM_2 0x1400 /* WOL Pattern RAM Link 2 */
-+
-+/* use this macro to retrieve the pattern ram base address */
-+#define WOL_PATT_RAM_BASE(Port) (WOL_PATT_RAM_1 + (Port)*0x400)
-
-+/* offset to configuration space on Yukon-2 */
-+#define Y2_CFG_SPC 0x1c00
- /*
- * Bank 0x22 - 0x3f
- */
-@@ -800,13 +1178,27 @@ extern "C" {
- */
- /* B0_RAP 8 bit Register Address Port */
- /* Bit 7: reserved */
--#define RAP_RAP 0x3f /* Bit 6..0: 0 = block 0,..,6f = block 6f */
-+#define RAP_MSK 0x7f /* Bit 6..0: 0 = block 0,..,6f = block 6f */
-+
-+/* B0_CTST 24 bit Control/Status register */
-+ /* Bit 23..18: reserved */
-+#define Y2_VMAIN_AVAIL BIT_17 /* VMAIN available (YUKON-2 only) */
-+#define Y2_VAUX_AVAIL BIT_16 /* VAUX available (YUKON-2 only) */
-+#define Y2_HW_WOL_ON BIT_15S /* HW WOL On (Yukon-EC Ultra A1 only) */
-+#define Y2_HW_WOL_OFF BIT_14S /* HW WOL Off (Yukon-EC Ultra A1 only) */
-+#define Y2_ASF_ENABLE BIT_13S /* ASF Unit Enable (YUKON-2 only) */
-+#define Y2_ASF_DISABLE BIT_12S /* ASF Unit Disable (YUKON-2 only) */
-+#define Y2_CLK_RUN_ENA BIT_11S /* CLK_RUN Enable (YUKON-2 only) */
-+#define Y2_CLK_RUN_DIS BIT_10S /* CLK_RUN Disable (YUKON-2 only) */
-+#define Y2_LED_STAT_ON BIT_9S /* Status LED On (YUKON-2 only) */
-+#define Y2_LED_STAT_OFF BIT_8S /* Status LED Off (YUKON-2 only) */
-+ /* Bit 7.. 0: same as below */
-
- /* B0_CTST 16 bit Control/Status register */
- /* Bit 15..14: reserved */
--#define CS_CLK_RUN_HOT BIT_13S /* CLK_RUN hot m. (YUKON-Lite only) */
--#define CS_CLK_RUN_RST BIT_12S /* CLK_RUN reset (YUKON-Lite only) */
--#define CS_CLK_RUN_ENA BIT_11S /* CLK_RUN enable (YUKON-Lite only) */
-+#define CS_CLK_RUN_HOT BIT_13S /* CLK_RUN Hot m. (YUKON-Lite only) */
-+#define CS_CLK_RUN_RST BIT_12S /* CLK_RUN Reset (YUKON-Lite only) */
-+#define CS_CLK_RUN_ENA BIT_11S /* CLK_RUN Enable (YUKON-Lite only) */
- #define CS_VAUX_AVAIL BIT_10S /* VAUX available (YUKON only) */
- #define CS_BUS_CLOCK BIT_9S /* Bus Clock 0/1 = 33/66 MHz */
- #define CS_BUS_SLOT_SZ BIT_8S /* Slot Size 0/1 = 32/64 bit slot */
-@@ -814,26 +1206,27 @@ extern "C" {
- #define CS_CL_SW_IRQ BIT_6S /* Clear IRQ SW Request */
- #define CS_STOP_DONE BIT_5S /* Stop Master is finished */
- #define CS_STOP_MAST BIT_4S /* Command Bit to stop the master */
--#define CS_MRST_CLR BIT_3S /* Clear Master reset */
--#define CS_MRST_SET BIT_2S /* Set Master reset */
--#define CS_RST_CLR BIT_1S /* Clear Software reset */
--#define CS_RST_SET BIT_0S /* Set Software reset */
-+#define CS_MRST_CLR BIT_3S /* Clear Master Reset */
-+#define CS_MRST_SET BIT_2S /* Set Master Reset */
-+#define CS_RST_CLR BIT_1S /* Clear Software Reset */
-+#define CS_RST_SET BIT_0S /* Set Software Reset */
-
--/* B0_LED 8 Bit LED register */
-+/* B0_LED 8 Bit LED register (GENESIS only)*/
- /* Bit 7.. 2: reserved */
--#define LED_STAT_ON BIT_1S /* Status LED on */
--#define LED_STAT_OFF BIT_0S /* Status LED off */
-+#define LED_STAT_ON BIT_1S /* Status LED On */
-+#define LED_STAT_OFF BIT_0S /* Status LED Off */
-
- /* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */
- #define PC_VAUX_ENA BIT_7 /* Switch VAUX Enable */
--#define PC_VAUX_DIS BIT_6 /* Switch VAUX Disable */
--#define PC_VCC_ENA BIT_5 /* Switch VCC Enable */
--#define PC_VCC_DIS BIT_4 /* Switch VCC Disable */
--#define PC_VAUX_ON BIT_3 /* Switch VAUX On */
--#define PC_VAUX_OFF BIT_2 /* Switch VAUX Off */
--#define PC_VCC_ON BIT_1 /* Switch VCC On */
--#define PC_VCC_OFF BIT_0 /* Switch VCC Off */
-+#define PC_VAUX_DIS BIT_6 /* Switch VAUX Disable */
-+#define PC_VCC_ENA BIT_5 /* Switch VCC Enable */
-+#define PC_VCC_DIS BIT_4 /* Switch VCC Disable */
-+#define PC_VAUX_ON BIT_3 /* Switch VAUX On */
-+#define PC_VAUX_OFF BIT_2 /* Switch VAUX Off */
-+#define PC_VCC_ON BIT_1 /* Switch VCC On */
-+#define PC_VCC_OFF BIT_0 /* Switch VCC Off */
-
-+/* Yukon and Genesis */
- /* B0_ISRC 32 bit Interrupt Source Register */
- /* B0_IMSK 32 bit Interrupt Mask Register */
- /* B0_SP_ISRC 32 bit Special Interrupt Source Reg */
-@@ -879,12 +1272,51 @@ extern "C" {
- #define IS_XA2_F BIT_1 /* Q_XA2 End of Frame */
- #define IS_XA2_C BIT_0 /* Q_XA2 Encoding Error */
-
-+/* Yukon-2 */
-+/* B0_ISRC 32 bit Interrupt Source Register */
-+/* B0_IMSK 32 bit Interrupt Mask Register */
-+/* B0_SP_ISRC 32 bit Special Interrupt Source Reg */
-+/* B2_IRQM_MSK 32 bit IRQ Moderation Mask */
-+/* B0_Y2_SP_ISRC2 32 bit Special Interrupt Source Reg 2 */
-+/* B0_Y2_SP_ISRC3 32 bit Special Interrupt Source Reg 3 */
-+/* B0_Y2_SP_EISR 32 bit Enter ISR Reg */
-+/* B0_Y2_SP_LISR 32 bit Leave ISR Reg */
-+#define Y2_IS_PORT_MASK(Port, Mask) ((Mask) << (Port*8))
-+#define Y2_IS_HW_ERR BIT_31 /* Interrupt HW Error */
-+#define Y2_IS_STAT_BMU BIT_30 /* Status BMU Interrupt */
-+#define Y2_IS_ASF BIT_29 /* ASF subsystem Interrupt */
-+ /* Bit 28: reserved */
-+#define Y2_IS_POLL_CHK BIT_27 /* Check IRQ from polling unit */
-+#define Y2_IS_TWSI_RDY BIT_26 /* IRQ on end of TWSI Tx */
-+#define Y2_IS_IRQ_SW BIT_25 /* SW forced IRQ */
-+#define Y2_IS_TIMINT BIT_24 /* IRQ from Timer */
-+ /* Bit 23..16 reserved */
-+ /* Link 2 Interrupts */
-+#define Y2_IS_IRQ_PHY2 BIT_12 /* Interrupt from PHY 2 */
-+#define Y2_IS_IRQ_MAC2 BIT_11 /* Interrupt from MAC 2 */
-+#define Y2_IS_CHK_RX2 BIT_10 /* Descriptor error Rx 2 */
-+#define Y2_IS_CHK_TXS2 BIT_9 /* Descriptor error TXS 2 */
-+#define Y2_IS_CHK_TXA2 BIT_8 /* Descriptor error TXA 2 */
-+ /* Bit 7.. 5 reserved */
-+ /* Link 1 interrupts */
-+#define Y2_IS_IRQ_PHY1 BIT_4 /* Interrupt from PHY 1 */
-+#define Y2_IS_IRQ_MAC1 BIT_3 /* Interrupt from MAC 1 */
-+#define Y2_IS_CHK_RX1 BIT_2 /* Descriptor error Rx 1 */
-+#define Y2_IS_CHK_TXS1 BIT_1 /* Descriptor error TXS 1 */
-+#define Y2_IS_CHK_TXA1 BIT_0 /* Descriptor error TXA 1 */
-+
-+#define Y2_IS_L1_MASK 0x0000001fUL /* IRQ Mask for port 1 */
-+
-+#define Y2_IS_L2_MASK 0x00001f00UL /* IRQ Mask for port 2 */
-+
-+#define Y2_IS_ALL_MSK 0xef001f1fUL /* All Interrupt bits */
-
-+/* Yukon and Genesis */
- /* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */
- /* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */
- /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
- #define IS_ERR_MSK 0x00000fffL /* All Error bits */
-- /* Bit 31..14: reserved */
-+ /* Bit 31..14: reserved */
- #define IS_IRQ_TIST_OV BIT_13 /* Time Stamp Timer Overflow (YUKON only) */
- #define IS_IRQ_SENSOR BIT_12 /* IRQ from Sensor (YUKON only) */
- #define IS_IRQ_MST_ERR BIT_11 /* IRQ master error detected */
-@@ -900,6 +1332,43 @@ extern "C" {
- #define IS_R1_PAR_ERR BIT_1 /* Queue R1 Parity Error */
- #define IS_R2_PAR_ERR BIT_0 /* Queue R2 Parity Error */
-
-+/* Yukon-2 */
-+/* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */
-+/* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */
-+/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
-+ /* Bit: 31..30 reserved */
-+#define Y2_IS_TIST_OV BIT_29 /* Time Stamp Timer overflow interrupt */
-+#define Y2_IS_SENSOR BIT_28 /* Sensor interrupt */
-+#define Y2_IS_MST_ERR BIT_27 /* Master error interrupt */
-+#define Y2_IS_IRQ_STAT BIT_26 /* Status exception interrupt */
-+#define Y2_IS_PCI_EXP BIT_25 /* PCI-Express interrupt */
-+#define Y2_IS_PCI_NEXP BIT_24 /* Bus Abort detected */
-+ /* Bit: 23..14 reserved */
-+ /* Link 2 */
-+#define Y2_IS_PAR_RD2 BIT_13 /* Read RAM parity error interrupt */
-+#define Y2_IS_PAR_WR2 BIT_12 /* Write RAM parity error interrupt */
-+#define Y2_IS_PAR_MAC2 BIT_11 /* MAC hardware fault interrupt */
-+#define Y2_IS_PAR_RX2 BIT_10 /* Parity Error Rx Queue 2 */
-+#define Y2_IS_TCP_TXS2 BIT_9 /* TCP length mismatch sync Tx queue IRQ */
-+#define Y2_IS_TCP_TXA2 BIT_8 /* TCP length mismatch async Tx queue IRQ */
-+ /* Bit: 9.. 6 reserved */
-+ /* Link 1 */
-+#define Y2_IS_PAR_RD1 BIT_5 /* Read RAM parity error interrupt */
-+#define Y2_IS_PAR_WR1 BIT_4 /* Write RAM parity error interrupt */
-+#define Y2_IS_PAR_MAC1 BIT_3 /* MAC hardware fault interrupt */
-+#define Y2_IS_PAR_RX1 BIT_2 /* Parity Error Rx Queue 1 */
-+#define Y2_IS_TCP_TXS1 BIT_1 /* TCP length mismatch sync Tx queue IRQ */
-+#define Y2_IS_TCP_TXA1 BIT_0 /* TCP length mismatch async Tx queue IRQ */
-+
-+#define Y2_HWE_L1_MASK (Y2_IS_PAR_RD1 | Y2_IS_PAR_WR1 | Y2_IS_PAR_MAC1 |\
-+ Y2_IS_PAR_RX1 | Y2_IS_TCP_TXS1| Y2_IS_TCP_TXA1)
-+#define Y2_HWE_L2_MASK (Y2_IS_PAR_RD2 | Y2_IS_PAR_WR2 | Y2_IS_PAR_MAC2 |\
-+ Y2_IS_PAR_RX2 | Y2_IS_TCP_TXS2| Y2_IS_TCP_TXA2)
-+
-+#define Y2_HWE_ALL_MSK (Y2_IS_TIST_OV | /* Y2_IS_SENSOR | */ Y2_IS_MST_ERR |\
-+ Y2_IS_IRQ_STAT | Y2_IS_PCI_EXP |\
-+ Y2_HWE_L1_MASK | Y2_HWE_L2_MASK)
-+
- /* B2_CONN_TYP 8 bit Connector type */
- /* B2_PMD_TYP 8 bit PMD type */
- /* Values of connector and PMD type comply to SysKonnect internal std */
-@@ -908,19 +1377,74 @@ extern "C" {
- #define CFG_CHIP_R_MSK (0xf<<4) /* Bit 7.. 4: Chip Revision */
- /* Bit 3.. 2: reserved */
- #define CFG_DIS_M2_CLK BIT_1S /* Disable Clock for 2nd MAC */
--#define CFG_SNG_MAC BIT_0S /* MAC Config: 0=2 MACs / 1=1 MAC*/
-+#define CFG_SNG_MAC BIT_0S /* MAC Config: 0 = 2 MACs; 1 = 1 MAC */
-
--/* B2_CHIP_ID 8 bit Chip Identification Number */
-+/* B2_CHIP_ID 8 bit Chip Identification Number */
- #define CHIP_ID_GENESIS 0x0a /* Chip ID for GENESIS */
- #define CHIP_ID_YUKON 0xb0 /* Chip ID for YUKON */
- #define CHIP_ID_YUKON_LITE 0xb1 /* Chip ID for YUKON-Lite (Rev. A1-A3) */
- #define CHIP_ID_YUKON_LP 0xb2 /* Chip ID for YUKON-LP */
-+#define CHIP_ID_YUKON_XL 0xb3 /* Chip ID for YUKON-2 XL */
-+#define CHIP_ID_YUKON_EC_U 0xb4 /* Chip ID for YUKON-2 EC Ultra */
-+#define CHIP_ID_YUKON_EC 0xb6 /* Chip ID for YUKON-2 EC */
-+#define CHIP_ID_YUKON_FE 0xb7 /* Chip ID for YUKON-2 FE */
-
- #define CHIP_REV_YU_LITE_A1 3 /* Chip Rev. for YUKON-Lite A1,A2 */
- #define CHIP_REV_YU_LITE_A3 7 /* Chip Rev. for YUKON-Lite A3 */
-
-+#define CHIP_REV_YU_XL_A0 0 /* Chip Rev. for Yukon-2 A0 */
-+#define CHIP_REV_YU_XL_A1 1 /* Chip Rev. for Yukon-2 A1 */
-+#define CHIP_REV_YU_XL_A2 2 /* Chip Rev. for Yukon-2 A2 */
-+#define CHIP_REV_YU_XL_A3 3 /* Chip Rev. for Yukon-2 A3 */
-+
-+#define CHIP_REV_YU_EC_A1 0 /* Chip Rev. for Yukon-EC A0,A1 */
-+#define CHIP_REV_YU_EC_A2 1 /* Chip Rev. for Yukon-EC A2 */
-+#define CHIP_REV_YU_EC_A3 2 /* Chip Rev. for Yukon-EC A3 */
-+
-+#define CHIP_REV_YU_EC_U_A0 1 /* Chip Rev. for Yukon-EC Ultra A0 */
-+#define CHIP_REV_YU_EC_U_A1 2 /* Chip Rev. for Yukon-EC Ultra A1 */
-+
-+/* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
-+#define Y2_STATUS_LNK2_INAC BIT_7S /* Status Link 2 inactiv (0 = activ) */
-+#define Y2_CLK_GAT_LNK2_DIS BIT_6S /* Disable PHY clock for Link 2 */
-+#define Y2_COR_CLK_LNK2_DIS BIT_5S /* Disable Core clock Link 2 */
-+#define Y2_PCI_CLK_LNK2_DIS BIT_4S /* Disable PCI clock Link 2 */
-+#define Y2_STATUS_LNK1_INAC BIT_3S /* Status Link 1 inactiv (0 = activ) */
-+#define Y2_CLK_GAT_LNK1_DIS BIT_2S /* Disable PHY clock for Link 1 */
-+#define Y2_COR_CLK_LNK1_DIS BIT_1S /* Disable Core clock Link 1 */
-+#define Y2_PCI_CLK_LNK1_DIS BIT_0S /* Disable PCI clock Link 1 */
-+
-+/* B2_Y2_HW_RES 8 bit HW Resources (Yukon-2 only) */
-+ /* Bit 7.. 5: reserved */
-+#define CFG_LED_MODE_MSK (7<<2) /* Bit 4.. 2: LED Mode Mask */
-+#define CFG_LINK_2_AVAIL BIT_1S /* Link 2 available */
-+#define CFG_LINK_1_AVAIL BIT_0S /* Link 1 available */
-+
-+#define CFG_LED_MODE(x) (((x) & CFG_LED_MODE_MSK) >> 2)
-+#define CFG_DUAL_MAC_MSK (CFG_LINK_2_AVAIL | CFG_LINK_1_AVAIL)
-+
-+#define CFG_LED_SING_ACT_LNK 0 /* Single LED ACT/LNK mode */
-+#define CFG_LED_DUAL_ACT_LNK 1 /* Dual LED ACT/LNK mode */
-+
-+/* B2_E_3 8 bit lower 4 bits used for HW self test result */
-+#define B2_E3_RES_MASK 0x0f
-+
- /* B2_FAR 32 bit Flash-Prom Addr Reg/Cnt */
--#define FAR_ADDR 0x1ffffL /* Bit 16.. 0: FPROM Address mask */
-+#define FAR_ADDR 0x1ffffL /* Bit 16.. 0: FPROM Address Mask */
-+
-+/* B2_Y2_CLK_CTRL 32 bit Core Clock Frequency Control Register (Yukon-2/EC) */
-+ /* Bit 31..24: reserved */
-+/* Yukon-EC/FE */
-+#define Y2_CLK_DIV_VAL_MSK (0xffL<<16) /* Bit 23..16: Clock Divisor Value */
-+#define Y2_CLK_DIV_VAL(x) (SHIFT16(x) & Y2_CLK_DIV_VAL_MSK)
-+/* Yukon-2 */
-+#define Y2_CLK_DIV_VAL2_MSK (7L<<21) /* Bit 23..21: Clock Divisor Value */
-+#define Y2_CLK_SELECT2_MSK (0x1fL<<16) /* Bit 20..16: Clock Select */
-+#define Y2_CLK_DIV_VAL_2(x) (SHIFT21(x) & Y2_CLK_DIV_VAL2_MSK)
-+#define Y2_CLK_SEL_VAL_2(x) (SHIFT16(x) & Y2_CLK_SELECT2_MSK)
-+ /* Bit 15.. 2: reserved */
-+#define Y2_CLK_DIV_ENA BIT_1S /* Enable Core Clock Division */
-+#define Y2_CLK_DIV_DIS BIT_0S /* Disable Core Clock Division */
-
- /* B2_LD_CTRL 8 bit EPROM loader control register */
- /* Bits are currently reserved */
-@@ -960,9 +1484,6 @@ extern "C" {
- #define DPT_START BIT_1S /* Start Descriptor Poll Timer */
- #define DPT_STOP BIT_0S /* Stop Descriptor Poll Timer */
-
--/* B2_E_3 8 bit lower 4 bits used for HW self test result */
--#define B2_E3_RES_MASK 0x0f
--
- /* B2_TST_CTRL1 8 bit Test Control Register 1 */
- #define TST_FRC_DPERR_MR BIT_7S /* force DATAPERR on MST RD */
- #define TST_FRC_DPERR_MW BIT_6S /* force DATAPERR on MST WR */
-@@ -975,14 +1496,14 @@ extern "C" {
-
- /* B2_TST_CTRL2 8 bit Test Control Register 2 */
- /* Bit 7.. 4: reserved */
-- /* force the following error on the next master read/write */
-+ /* force the following error on the next master read/write */
- #define TST_FRC_DPERR_MR64 BIT_3S /* DataPERR RD 64 */
- #define TST_FRC_DPERR_MW64 BIT_2S /* DataPERR WR 64 */
- #define TST_FRC_APERR_1M64 BIT_1S /* AddrPERR on 1. phase */
- #define TST_FRC_APERR_2M64 BIT_0S /* AddrPERR on 2. phase */
-
- /* B2_GP_IO 32 bit General Purpose I/O Register */
-- /* Bit 31..26: reserved */
-+ /* Bit 31..26: reserved */
- #define GP_DIR_9 BIT_25 /* IO_9 direct, 0=In/1=Out */
- #define GP_DIR_8 BIT_24 /* IO_8 direct, 0=In/1=Out */
- #define GP_DIR_7 BIT_23 /* IO_7 direct, 0=In/1=Out */
-@@ -1009,15 +1530,15 @@ extern "C" {
- #define I2C_FLAG BIT_31 /* Start read/write if WR */
- #define I2C_ADDR (0x7fffL<<16) /* Bit 30..16: Addr to be RD/WR */
- #define I2C_DEV_SEL (0x7fL<<9) /* Bit 15.. 9: I2C Device Select */
-- /* Bit 8.. 5: reserved */
-+ /* Bit 8.. 5: reserved */
- #define I2C_BURST_LEN BIT_4 /* Burst Len, 1/4 bytes */
--#define I2C_DEV_SIZE (7<<1) /* Bit 3.. 1: I2C Device Size */
--#define I2C_025K_DEV (0<<1) /* 0: 256 Bytes or smal. */
--#define I2C_05K_DEV (1<<1) /* 1: 512 Bytes */
--#define I2C_1K_DEV (2<<1) /* 2: 1024 Bytes */
--#define I2C_2K_DEV (3<<1) /* 3: 2048 Bytes */
--#define I2C_4K_DEV (4<<1) /* 4: 4096 Bytes */
--#define I2C_8K_DEV (5<<1) /* 5: 8192 Bytes */
-+#define I2C_DEV_SIZE (7<<1) /* Bit 3.. 1: I2C Device Size */
-+#define I2C_025K_DEV (0<<1) /* 0: 256 Bytes or smaller */
-+#define I2C_05K_DEV (1<<1) /* 1: 512 Bytes */
-+#define I2C_1K_DEV (2<<1) /* 2: 1024 Bytes */
-+#define I2C_2K_DEV (3<<1) /* 3: 2048 Bytes */
-+#define I2C_4K_DEV (4<<1) /* 4: 4096 Bytes */
-+#define I2C_8K_DEV (5<<1) /* 5: 8192 Bytes */
- #define I2C_16K_DEV (6<<1) /* 6: 16384 Bytes */
- #define I2C_32K_DEV (7<<1) /* 7: 32768 Bytes */
- #define I2C_STOP BIT_0 /* Interrupt I2C transfer */
-@@ -1026,16 +1547,14 @@ extern "C" {
- /* Bit 31.. 1 reserved */
- #define I2C_CLR_IRQ BIT_0 /* Clear I2C IRQ */
-
--/* B2_I2C_SW 32 bit (8 bit access) I2C HW SW Port Register */
-+/* B2_I2C_SW 32 bit (8 bit access) I2C SW Port Register */
- /* Bit 7.. 3: reserved */
- #define I2C_DATA_DIR BIT_2S /* direction of I2C_DATA */
--#define I2C_DATA BIT_1S /* I2C Data Port */
--#define I2C_CLK BIT_0S /* I2C Clock Port */
-+#define I2C_DATA BIT_1S /* I2C Data Port */
-+#define I2C_CLK BIT_0S /* I2C Clock Port */
-
--/*
-- * I2C Address
-- */
--#define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address, (Volt and Temp)*/
-+/* I2C Address */
-+#define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address (Volt and Temp) */
-
-
- /* B2_BSC_CTRL 8 bit Blink Source Counter Control */
-@@ -1052,16 +1571,20 @@ extern "C" {
- #define BSC_T_OFF BIT_1S /* Test mode off */
- #define BSC_T_STEP BIT_0S /* Test step */
-
-+/* Y2_PEX_PHY_ADDR/DATA PEX PHY address and data reg (Yukon-2 only) */
-+#define PEX_RD_ACCESS BIT_31 /* Access Mode Read = 1, Write = 0 */
-+#define PEX_DB_ACCESS BIT_30 /* Access to debug register */
-+
-
- /* B3_RAM_ADDR 32 bit RAM Address, to read or write */
- /* Bit 31..19: reserved */
- #define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */
-
- /* RAM Interface Registers */
--/* B3_RI_CTRL 16 bit RAM Iface Control Register */
-+/* B3_RI_CTRL 16 bit RAM Interface Control Register */
- /* Bit 15..10: reserved */
--#define RI_CLR_RD_PERR BIT_9S /* Clear IRQ RAM Read Parity Err */
--#define RI_CLR_WR_PERR BIT_8S /* Clear IRQ RAM Write Parity Err*/
-+#define RI_CLR_RD_PERR BIT_9S /* Clear IRQ RAM Read Parity Err */
-+#define RI_CLR_WR_PERR BIT_8S /* Clear IRQ RAM Write Parity Err */
- /* Bit 7.. 2: reserved */
- #define RI_RST_CLR BIT_1S /* Clear RAM Interface Reset */
- #define RI_RST_SET BIT_0S /* Set RAM Interface Reset */
-@@ -1171,7 +1694,7 @@ extern "C" {
- /* Bit 31..16: reserved */
- #define BC_MAX 0xffff /* Bit 15.. 0: Byte counter */
-
--/* BMU Control Status Registers */
-+/* BMU Control / Status Registers (Yukon and Genesis) */
- /* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */
- /* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */
- /* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
-@@ -1212,13 +1735,48 @@ extern "C" {
- CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
- CSR_TRANS_RUN)
-
-+/* Rx BMU Control / Status Registers (Yukon-2) */
-+#define BMU_IDLE BIT_31 /* BMU Idle State */
-+#define BMU_RX_TCP_PKT BIT_30 /* Rx TCP Packet (when RSS Hash enabled) */
-+#define BMU_RX_IP_PKT BIT_29 /* Rx IP Packet (when RSS Hash enabled) */
-+ /* Bit 28..16: reserved */
-+#define BMU_ENA_RX_RSS_HASH BIT_15 /* Enable Rx RSS Hash */
-+#define BMU_DIS_RX_RSS_HASH BIT_14 /* Disable Rx RSS Hash */
-+#define BMU_ENA_RX_CHKSUM BIT_13 /* Enable Rx TCP/IP Checksum Check */
-+#define BMU_DIS_RX_CHKSUM BIT_12 /* Disable Rx TCP/IP Checksum Check */
-+#define BMU_CLR_IRQ_PAR BIT_11 /* Clear IRQ on Parity errors (Rx) */
-+#define BMU_CLR_IRQ_TCP BIT_11 /* Clear IRQ on TCP segmen. error (Tx) */
-+#define BMU_CLR_IRQ_CHK BIT_10 /* Clear IRQ Check */
-+#define BMU_STOP BIT_9 /* Stop Rx/Tx Queue */
-+#define BMU_START BIT_8 /* Start Rx/Tx Queue */
-+#define BMU_FIFO_OP_ON BIT_7 /* FIFO Operational On */
-+#define BMU_FIFO_OP_OFF BIT_6 /* FIFO Operational Off */
-+#define BMU_FIFO_ENA BIT_5 /* Enable FIFO */
-+#define BMU_FIFO_RST BIT_4 /* Reset FIFO */
-+#define BMU_OP_ON BIT_3 /* BMU Operational On */
-+#define BMU_OP_OFF BIT_2 /* BMU Operational Off */
-+#define BMU_RST_CLR BIT_1 /* Clear BMU Reset (Enable) */
-+#define BMU_RST_SET BIT_0 /* Set BMU Reset */
-+
-+#define BMU_CLR_RESET (BMU_FIFO_RST | BMU_OP_OFF | BMU_RST_CLR)
-+#define BMU_OPER_INIT (BMU_CLR_IRQ_PAR | BMU_CLR_IRQ_CHK | BMU_START | \
-+ BMU_FIFO_ENA | BMU_OP_ON)
-+
-+/* Tx BMU Control / Status Registers (Yukon-2) */
-+ /* Bit 31: same as for Rx */
-+ /* Bit 30..14: reserved */
-+#define BMU_TX_IPIDINCR_ON BIT_13 /* Enable IP ID Increment */
-+#define BMU_TX_IPIDINCR_OFF BIT_12 /* Disable IP ID Increment */
-+#define BMU_TX_CLR_IRQ_TCP BIT_11 /* Clear IRQ on TCP segm. length mism. */
-+ /* Bit 10..0: same as for Rx */
-+
- /* Q_F 32 bit Flag Register */
- /* Bit 31..28: reserved */
- #define F_ALM_FULL BIT_27 /* Rx FIFO: almost full */
- #define F_EMPTY BIT_27 /* Tx FIFO: empty flag */
- #define F_FIFO_EOF BIT_26 /* Tag (EOF Flag) bit in FIFO */
- #define F_WM_REACHED BIT_25 /* Watermark reached */
-- /* reserved */
-+#define F_M_RX_RAM_DIS BIT_24 /* MAC Rx RAM Read Port disable */
- #define F_FIFO_LEVEL (0x1fL<<16) /* Bit 23..16: # of Qwords in FIFO */
- /* Bit 15..11: reserved */
- #define F_WATER_MARK 0x0007ffL /* Bit 10.. 0: Watermark */
-@@ -1260,6 +1818,13 @@ extern "C" {
- /* Bit 3: reserved */
- #define T3_VRAM_MSK 7 /* Bit 2.. 0: Virtual RAM Buffer Address */
-
-+/* Queue Prefetch Unit Offsets, use Y2_PREF_Q_ADDR() to address (Yukon-2 only)*/
-+/* PREF_UNIT_CTRL_REG 32 bit Prefetch Control register */
-+#define PREF_UNIT_OP_ON BIT_3 /* prefetch unit operational */
-+#define PREF_UNIT_OP_OFF BIT_2 /* prefetch unit not operational */
-+#define PREF_UNIT_RST_CLR BIT_1 /* Clear Prefetch Unit Reset */
-+#define PREF_UNIT_RST_SET BIT_0 /* Set Prefetch Unit Reset */
-+
- /* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */
- /* RB_START 32 bit RAM Buffer Start Address */
- /* RB_END 32 bit RAM Buffer End Address */
-@@ -1275,24 +1840,24 @@ extern "C" {
- #define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */
-
- /* RB_TST2 8 bit RAM Buffer Test Register 2 */
-- /* Bit 7.. 4: reserved */
--#define RB_PC_DEC BIT_3S /* Packet Counter Decrem */
-+ /* Bit 7.. 4: reserved */
-+#define RB_PC_DEC BIT_3S /* Packet Counter Decrement */
- #define RB_PC_T_ON BIT_2S /* Packet Counter Test On */
--#define RB_PC_T_OFF BIT_1S /* Packet Counter Tst Off */
--#define RB_PC_INC BIT_0S /* Packet Counter Increm */
-+#define RB_PC_T_OFF BIT_1S /* Packet Counter Test Off */
-+#define RB_PC_INC BIT_0S /* Packet Counter Increment */
-
- /* RB_TST1 8 bit RAM Buffer Test Register 1 */
- /* Bit 7: reserved */
- #define RB_WP_T_ON BIT_6S /* Write Pointer Test On */
- #define RB_WP_T_OFF BIT_5S /* Write Pointer Test Off */
--#define RB_WP_INC BIT_4S /* Write Pointer Increm */
-+#define RB_WP_INC BIT_4S /* Write Pointer Increment */
- /* Bit 3: reserved */
- #define RB_RP_T_ON BIT_2S /* Read Pointer Test On */
- #define RB_RP_T_OFF BIT_1S /* Read Pointer Test Off */
--#define RB_RP_DEC BIT_0S /* Read Pointer Decrement */
-+#define RB_RP_INC BIT_0S /* Read Pointer Increment */
-
- /* RB_CTRL 8 bit RAM Buffer Control Register */
-- /* Bit 7.. 6: reserved */
-+ /* Bit 7.. 6: reserved */
- #define RB_ENA_STFWD BIT_5S /* Enable Store & Forward */
- #define RB_DIS_STFWD BIT_4S /* Disable Store & Forward */
- #define RB_ENA_OP_MD BIT_3S /* Enable Operation Mode */
-@@ -1300,16 +1865,31 @@ extern "C" {
- #define RB_RST_CLR BIT_1S /* Clear RAM Buf STM Reset */
- #define RB_RST_SET BIT_0S /* Set RAM Buf STM Reset */
-
-+/* Yukon-2 */
-+ /* Bit 31..20: reserved */
-+#define RB_CNT_DOWN BIT_19 /* Packet Counter Decrement */
-+#define RB_CNT_TST_ON BIT_18 /* Packet Counter Test On */
-+#define RB_CNT_TST_OFF BIT_17 /* Packet Counter Test Off */
-+#define RB_CNT_UP BIT_16 /* Packet Counter Increment */
-+ /* Bit 15: reserved */
-+#define RB_WP_TST_ON BIT_14 /* Write Pointer Test On */
-+#define RB_WP_TST_OFF BIT_13 /* Write Pointer Test Off */
-+#define RB_WP_UP BIT_12 /* Write Pointer Increment */
-+ /* Bit 11: reserved */
-+#define RB_RP_TST_ON BIT_10 /* Read Pointer Test On */
-+#define RB_RP_TST_OFF BIT_9 /* Read Pointer Test Off */
-+#define RB_RP_UP BIT_8 /* Read Pointer Increment */
-+
-
- /* Receive and Transmit MAC FIFO Registers (GENESIS only) */
-
- /* RX_MFF_EA 32 bit Receive MAC FIFO End Address */
--/* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */
-+/* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */
- /* RX_MFF_RP 32 bit Receive MAC FIFO Read Pointer */
- /* RX_MFF_PC 32 bit Receive MAC FIFO Packet Counter */
- /* RX_MFF_LEV 32 bit Receive MAC FIFO Level */
- /* TX_MFF_EA 32 bit Transmit MAC FIFO End Address */
--/* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer */
-+/* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer */
- /* TX_MFF_WSP 32 bit Transmit MAC FIFO WR Shadow Pointer */
- /* TX_MFF_RP 32 bit Transmit MAC FIFO Read Pointer */
- /* TX_MFF_PC 32 bit Transmit MAC FIFO Packet Cnt */
-@@ -1359,9 +1939,9 @@ extern "C" {
- /* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */
- /* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */
- /* Bit 7: reserved */
--#define MFF_WSP_T_ON BIT_6S /* Tx: Write Shadow Ptr TestOn */
--#define MFF_WSP_T_OFF BIT_5S /* Tx: Write Shadow Ptr TstOff */
--#define MFF_WSP_INC BIT_4S /* Tx: Write Shadow Ptr Increment */
-+#define MFF_WSP_T_ON BIT_6S /* Tx: Write Shadow Pointer Test On */
-+#define MFF_WSP_T_OFF BIT_5S /* Tx: Write Shadow Pointer Test Off */
-+#define MFF_WSP_INC BIT_4S /* Tx: Write Shadow Pointer Increment */
- #define MFF_PC_DEC BIT_3S /* Packet Counter Decrement */
- #define MFF_PC_T_ON BIT_2S /* Packet Counter Test On */
- #define MFF_PC_T_OFF BIT_1S /* Packet Counter Test Off */
-@@ -1372,7 +1952,7 @@ extern "C" {
- /* Bit 7: reserved */
- #define MFF_WP_T_ON BIT_6S /* Write Pointer Test On */
- #define MFF_WP_T_OFF BIT_5S /* Write Pointer Test Off */
--#define MFF_WP_INC BIT_4S /* Write Pointer Increm */
-+#define MFF_WP_INC BIT_4S /* Write Pointer Increment */
- /* Bit 3: reserved */
- #define MFF_RP_T_ON BIT_2S /* Read Pointer Test On */
- #define MFF_RP_T_OFF BIT_1S /* Read Pointer Test Off */
-@@ -1391,12 +1971,16 @@ extern "C" {
-
- /* RX_LED_CTRL 8 bit Receive LED Cnt Control Reg */
- /* TX_LED_CTRL 8 bit Transmit LED Cnt Control Reg */
-+ /* Bit 7.. 3: reserved */
-+#define LED_START BIT_2S /* Start Counter */
-+#define LED_STOP BIT_1S /* Stop Counter */
-+#define LED_STATE BIT_0S /* Rx/Tx: LED State, 1=LED On */
-+
- /* LNK_SYNC_CTRL 8 bit Link Sync Cnt Control Register */
- /* Bit 7.. 3: reserved */
--#define LED_START BIT_2S /* Start Timer */
--#define LED_STOP BIT_1S /* Stop Timer */
--#define LED_STATE BIT_0S /* Rx/Tx: LED State, 1=LED on */
--#define LED_CLR_IRQ BIT_0S /* Lnk: Clear Link IRQ */
-+#define LNK_START BIT_2S /* Start Counter */
-+#define LNK_STOP BIT_1S /* Stop Counter */
-+#define LNK_CLR_IRQ BIT_0S /* Clear Link IRQ */
-
- /* RX_LED_TST 8 bit Receive LED Cnt Test Register */
- /* TX_LED_TST 8 bit Transmit LED Cnt Test Register */
-@@ -1407,86 +1991,142 @@ extern "C" {
- #define LED_T_STEP BIT_0S /* LED Counter Step */
-
- /* LNK_LED_REG 8 bit Link LED Register */
-- /* Bit 7.. 6: reserved */
-+ /* Bit 7.. 6: reserved */
- #define LED_BLK_ON BIT_5S /* Link LED Blinking On */
- #define LED_BLK_OFF BIT_4S /* Link LED Blinking Off */
- #define LED_SYNC_ON BIT_3S /* Use Sync Wire to switch LED */
- #define LED_SYNC_OFF BIT_2S /* Disable Sync Wire Input */
--#define LED_ON BIT_1S /* switch LED on */
--#define LED_OFF BIT_0S /* switch LED off */
-+#define LED_ON BIT_1S /* Switch LED On */
-+#define LED_OFF BIT_0S /* Switch LED Off */
-
- /* Receive and Transmit GMAC FIFO Registers (YUKON only) */
-
- /* RX_GMF_EA 32 bit Rx GMAC FIFO End Address */
- /* RX_GMF_AF_THR 32 bit Rx GMAC FIFO Almost Full Thresh. */
--/* RX_GMF_WP 32 bit Rx GMAC FIFO Write Pointer */
--/* RX_GMF_WLEV 32 bit Rx GMAC FIFO Write Level */
--/* RX_GMF_RP 32 bit Rx GMAC FIFO Read Pointer */
--/* RX_GMF_RLEV 32 bit Rx GMAC FIFO Read Level */
-+/* RX_GMF_WP 32 bit Rx GMAC FIFO Write Pointer */
-+/* RX_GMF_WLEV 32 bit Rx GMAC FIFO Write Level */
-+/* RX_GMF_RP 32 bit Rx GMAC FIFO Read Pointer */
-+/* RX_GMF_RLEV 32 bit Rx GMAC FIFO Read Level */
- /* TX_GMF_EA 32 bit Tx GMAC FIFO End Address */
- /* TX_GMF_AE_THR 32 bit Tx GMAC FIFO Almost Empty Thresh.*/
--/* TX_GMF_WP 32 bit Tx GMAC FIFO Write Pointer */
--/* TX_GMF_WSP 32 bit Tx GMAC FIFO Write Shadow Ptr. */
--/* TX_GMF_WLEV 32 bit Tx GMAC FIFO Write Level */
--/* TX_GMF_RP 32 bit Tx GMAC FIFO Read Pointer */
--/* TX_GMF_RSTP 32 bit Tx GMAC FIFO Restart Pointer */
--/* TX_GMF_RLEV 32 bit Tx GMAC FIFO Read Level */
-+/* TX_GMF_WP 32 bit Tx GMAC FIFO Write Pointer */
-+/* TX_GMF_WSP 32 bit Tx GMAC FIFO Write Shadow Pointer */
-+/* TX_GMF_WLEV 32 bit Tx GMAC FIFO Write Level */
-+/* TX_GMF_RP 32 bit Tx GMAC FIFO Read Pointer */
-+/* TX_GMF_RSTP 32 bit Tx GMAC FIFO Restart Pointer */
-+/* TX_GMF_RLEV 32 bit Tx GMAC FIFO Read Level */
-
- /* RX_GMF_CTRL_T 32 bit Rx GMAC FIFO Control/Test */
-- /* Bits 31..15: reserved */
--#define GMF_WP_TST_ON BIT_14 /* Write Pointer Test On */
--#define GMF_WP_TST_OFF BIT_13 /* Write Pointer Test Off */
--#define GMF_WP_STEP BIT_12 /* Write Pointer Step/Increment */
-+ /* Bit 31..28 reserved */
-+#define RX_TRUNC_ON BIT_27 /* Enable Packet Truncation */
-+#define RX_TRUNC_OFF BIT_26 /* Disable Packet Truncation */
-+#define RX_VLAN_STRIP_ON BIT_25 /* Enable VLAN Stripping */
-+#define RX_VLAN_STRIP_OFF BIT_24 /* Disable VLAN Stripping */
-+ /* Bit 23..15 reserved */
-+#define GMF_WP_TST_ON BIT_14 /* Write Pointer Test On */
-+#define GMF_WP_TST_OFF BIT_13 /* Write Pointer Test Off */
-+#define GMF_WP_STEP BIT_12 /* Write Pointer Step/Increment */
- /* Bit 11: reserved */
--#define GMF_RP_TST_ON BIT_10 /* Read Pointer Test On */
--#define GMF_RP_TST_OFF BIT_9 /* Read Pointer Test Off */
--#define GMF_RP_STEP BIT_8 /* Read Pointer Step/Increment */
--#define GMF_RX_F_FL_ON BIT_7 /* Rx FIFO Flush Mode On */
--#define GMF_RX_F_FL_OFF BIT_6 /* Rx FIFO Flush Mode Off */
--#define GMF_CLI_RX_FO BIT_5 /* Clear IRQ Rx FIFO Overrun */
--#define GMF_CLI_RX_FC BIT_4 /* Clear IRQ Rx Frame Complete */
--#define GMF_OPER_ON BIT_3 /* Operational Mode On */
--#define GMF_OPER_OFF BIT_2 /* Operational Mode Off */
--#define GMF_RST_CLR BIT_1 /* Clear GMAC FIFO Reset */
--#define GMF_RST_SET BIT_0 /* Set GMAC FIFO Reset */
--
--/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */
-- /* Bits 31..19: reserved */
--#define GMF_WSP_TST_ON BIT_18 /* Write Shadow Pointer Test On */
--#define GMF_WSP_TST_OFF BIT_17 /* Write Shadow Pointer Test Off */
--#define GMF_WSP_STEP BIT_16 /* Write Shadow Pointer Step/Increment */
-- /* Bits 15..7: same as for RX_GMF_CTRL_T */
--#define GMF_CLI_TX_FU BIT_6 /* Clear IRQ Tx FIFO Underrun */
--#define GMF_CLI_TX_FC BIT_5 /* Clear IRQ Tx Frame Complete */
--#define GMF_CLI_TX_PE BIT_4 /* Clear IRQ Tx Parity Error */
-+#define GMF_RP_TST_ON BIT_10 /* Read Pointer Test On */
-+#define GMF_RP_TST_OFF BIT_9 /* Read Pointer Test Off */
-+#define GMF_RP_STEP BIT_8 /* Read Pointer Step/Increment */
-+#define GMF_RX_F_FL_ON BIT_7 /* Rx FIFO Flush Mode On */
-+#define GMF_RX_F_FL_OFF BIT_6 /* Rx FIFO Flush Mode Off */
-+#define GMF_CLI_RX_FO BIT_5 /* Clear IRQ Rx FIFO Overrun */
-+#define GMF_CLI_RX_FC BIT_4 /* Clear IRQ Rx Frame Complete */
-+#define GMF_OPER_ON BIT_3 /* Operational Mode On */
-+#define GMF_OPER_OFF BIT_2 /* Operational Mode Off */
-+#define GMF_RST_CLR BIT_1 /* Clear GMAC FIFO Reset */
-+#define GMF_RST_SET BIT_0 /* Set GMAC FIFO Reset */
-+
-+/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test (YUKON and Yukon-2) */
-+#define TX_STFW_DIS BIT_31 /* Disable Store & Forward (Yukon-EC Ultra) */
-+#define TX_STFW_ENA BIT_30 /* Enable Store & Forward (Yukon-EC Ultra) */
-+ /* Bits 29..26: reserved */
-+#define TX_VLAN_TAG_ON BIT_25 /* Enable VLAN tagging */
-+#define TX_VLAN_TAG_OFF BIT_24 /* Disable VLAN tagging */
-+#define TX_PCI_JUM_ENA BIT_23 /* Enable PCI Jumbo Mode (Yukon-EC Ultra) */
-+#define TX_PCI_JUM_DIS BIT_22 /* Disable PCI Jumbo Mode (Yukon-EC Ultra) */
-+ /* Bits 21..19: reserved */
-+#define GMF_WSP_TST_ON BIT_18 /* Write Shadow Pointer Test On */
-+#define GMF_WSP_TST_OFF BIT_17 /* Write Shadow Pointer Test Off */
-+#define GMF_WSP_STEP BIT_16 /* Write Shadow Pointer Step/Increment */
-+ /* Bits 15..8: same as for RX_GMF_CTRL_T */
-+ /* Bit 7: reserved */
-+#define GMF_CLI_TX_FU BIT_6 /* Clear IRQ Tx FIFO Underrun */
-+#define GMF_CLI_TX_FC BIT_5 /* Clear IRQ Tx Frame Complete */
-+#define GMF_CLI_TX_PE BIT_4 /* Clear IRQ Tx Parity Error */
- /* Bits 3..0: same as for RX_GMF_CTRL_T */
-
- #define GMF_RX_CTRL_DEF (GMF_OPER_ON | GMF_RX_F_FL_ON)
- #define GMF_TX_CTRL_DEF GMF_OPER_ON
-
-+#define RX_GMF_AF_THR_MIN 0x0c /* Rx GMAC FIFO Almost Full Thresh. min. */
- #define RX_GMF_FL_THR_DEF 0x0a /* Rx GMAC FIFO Flush Threshold default */
-
- /* GMAC_TI_ST_CTRL 8 bit Time Stamp Timer Ctrl Reg (YUKON only) */
-- /* Bit 7.. 3: reserved */
--#define GMT_ST_START BIT_2S /* Start Time Stamp Timer */
--#define GMT_ST_STOP BIT_1S /* Stop Time Stamp Timer */
--#define GMT_ST_CLR_IRQ BIT_0S /* Clear Time Stamp Timer IRQ */
--
-+ /* Bit 7.. 3: reserved */
-+#define GMT_ST_START BIT_2S /* Start Time Stamp Timer */
-+#define GMT_ST_STOP BIT_1S /* Stop Time Stamp Timer */
-+#define GMT_ST_CLR_IRQ BIT_0S /* Clear Time Stamp Timer IRQ */
-+
-+/* POLL_CTRL 32 bit Polling Unit control register (Yukon-2 only) */
-+ /* Bit 31.. 6: reserved */
-+#define PC_CLR_IRQ_CHK BIT_5 /* Clear IRQ Check */
-+#define PC_POLL_RQ BIT_4 /* Poll Request Start */
-+#define PC_POLL_OP_ON BIT_3 /* Operational Mode On */
-+#define PC_POLL_OP_OFF BIT_2 /* Operational Mode Off */
-+#define PC_POLL_RST_CLR BIT_1 /* Clear Polling Unit Reset (Enable) */
-+#define PC_POLL_RST_SET BIT_0 /* Set Polling Unit Reset */
-+
-+
-+/* The bit definition of the following registers is still missing! */
-+/* B28_Y2_SMB_CONFIG 32 bit ASF SMBus Config Register */
-+/* B28_Y2_SMB_CSD_REG 32 bit ASF SMB Control/Status/Data */
-+/* B28_Y2_ASF_IRQ_V_BASE 32 bit ASF IRQ Vector Base */
-+
-+/* B28_Y2_ASF_STAT_CMD 32 bit ASF Status and Command Reg */
-+/* This register is used by the host driver software */
-+ /* Bit 31.. 5 reserved */
-+#define Y2_ASF_OS_PRES BIT_4S /* ASF operation system present */
-+#define Y2_ASF_RESET BIT_3S /* ASF system in reset state */
-+#define Y2_ASF_RUNNING BIT_2S /* ASF system operational */
-+#define Y2_ASF_CLR_HSTI BIT_1S /* Clear ASF IRQ */
-+#define Y2_ASF_IRQ BIT_0S /* Issue an IRQ to ASF system */
-+
-+#define Y2_ASF_UC_STATE (3<<2) /* ASF uC State */
-+#define Y2_ASF_CLK_HALT 0 /* ASF system clock stopped */
-+
-+/* B28_Y2_ASF_HOST_COM 32 bit ASF Host Communication Reg */
-+/* This register is used by the ASF firmware */
-+ /* Bit 31.. 2 reserved */
-+#define Y2_ASF_CLR_ASFI BIT_1 /* Clear host IRQ */
-+#define Y2_ASF_HOST_IRQ BIT_0 /* Issue an IRQ to HOST system */
-+
-+
-+/* STAT_CTRL 32 bit Status BMU control register (Yukon-2 only) */
-+ /* Bit 7.. 5: reserved */
-+#define SC_STAT_CLR_IRQ BIT_4 /* Status Burst IRQ clear */
-+#define SC_STAT_OP_ON BIT_3 /* Operational Mode On */
-+#define SC_STAT_OP_OFF BIT_2 /* Operational Mode Off */
-+#define SC_STAT_RST_CLR BIT_1 /* Clear Status Unit Reset (Enable) */
-+#define SC_STAT_RST_SET BIT_0 /* Set Status Unit Reset */
-+
- /* GMAC_CTRL 32 bit GMAC Control Reg (YUKON only) */
- /* Bits 31.. 8: reserved */
--#define GMC_H_BURST_ON BIT_7 /* Half Duplex Burst Mode On */
--#define GMC_H_BURST_OFF BIT_6 /* Half Duplex Burst Mode Off */
--#define GMC_F_LOOPB_ON BIT_5 /* FIFO Loopback On */
--#define GMC_F_LOOPB_OFF BIT_4 /* FIFO Loopback Off */
--#define GMC_PAUSE_ON BIT_3 /* Pause On */
--#define GMC_PAUSE_OFF BIT_2 /* Pause Off */
--#define GMC_RST_CLR BIT_1 /* Clear GMAC Reset */
--#define GMC_RST_SET BIT_0 /* Set GMAC Reset */
-+#define GMC_H_BURST_ON BIT_7 /* Half Duplex Burst Mode On */
-+#define GMC_H_BURST_OFF BIT_6 /* Half Duplex Burst Mode Off */
-+#define GMC_F_LOOPB_ON BIT_5 /* FIFO Loopback On */
-+#define GMC_F_LOOPB_OFF BIT_4 /* FIFO Loopback Off */
-+#define GMC_PAUSE_ON BIT_3 /* Pause On */
-+#define GMC_PAUSE_OFF BIT_2 /* Pause Off */
-+#define GMC_RST_CLR BIT_1 /* Clear GMAC Reset */
-+#define GMC_RST_SET BIT_0 /* Set GMAC Reset */
-
- /* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */
- /* Bits 31..29: reserved */
- #define GPC_SEL_BDT BIT_28 /* Select Bi-Dir. Transfer for MDC/MDIO */
--#define GPC_INT_POL_HI BIT_27 /* IRQ Polarity is Active HIGH */
-+#define GPC_INT_POL BIT_27 /* IRQ Polarity is Active Low */
- #define GPC_75_OHM BIT_26 /* Use 75 Ohm Termination instead of 50 */
- #define GPC_DIS_FC BIT_25 /* Disable Automatic Fiber/Copper Detection */
- #define GPC_DIS_SLEEP BIT_24 /* Disable Energy Detect */
-@@ -1510,6 +2150,13 @@ extern "C" {
- #define GPC_RST_CLR BIT_1 /* Clear GPHY Reset */
- #define GPC_RST_SET BIT_0 /* Set GPHY Reset */
-
-+/* Yukon-EC Ultra only */
-+#define GPC_PD_125M_CLK_OFF BIT_5 /* Disable Power Down Clock 125 MHz */
-+#define GPC_PD_125M_CLK_ON BIT_4 /* Enable Power Down Clock 125 MHz */
-+#define GPC_DPLL_RST_SET BIT_3 /* Set GPHY's DPLL Reset */
-+#define GPC_DPLL_RST_CLR BIT_2 /* Clear GPHY's DPLL Reset */
-+ /* (DPLL = Digital Phase Lock Loop) */
-+
- #define GPC_HWCFG_GMII_COP (GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | \
- GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
-
-@@ -1540,14 +2187,14 @@ extern "C" {
-
- /* GMAC_IRQ_SRC 8 bit GMAC Interrupt Source Reg (YUKON only) */
- /* GMAC_IRQ_MSK 8 bit GMAC Interrupt Mask Reg (YUKON only) */
--#define GM_IS_TX_CO_OV BIT_5 /* Transmit Counter Overflow IRQ */
--#define GM_IS_RX_CO_OV BIT_4 /* Receive Counter Overflow IRQ */
--#define GM_IS_TX_FF_UR BIT_3 /* Transmit FIFO Underrun */
--#define GM_IS_TX_COMPL BIT_2 /* Frame Transmission Complete */
--#define GM_IS_RX_FF_OR BIT_1 /* Receive FIFO Overrun */
--#define GM_IS_RX_COMPL BIT_0 /* Frame Reception Complete */
-+#define GM_IS_RX_CO_OV BIT_5S /* Receive Counter Overflow IRQ */
-+#define GM_IS_TX_CO_OV BIT_4S /* Transmit Counter Overflow IRQ */
-+#define GM_IS_TX_FF_UR BIT_3S /* Transmit FIFO Underrun */
-+#define GM_IS_TX_COMPL BIT_2S /* Frame Transmission Complete */
-+#define GM_IS_RX_FF_OR BIT_1S /* Receive FIFO Overrun */
-+#define GM_IS_RX_COMPL BIT_0S /* Frame Reception Complete */
-
--#define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | \
-+#define GMAC_DEF_MSK (GM_IS_RX_CO_OV | GM_IS_TX_CO_OV | \
- GM_IS_TX_FF_UR)
-
- /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
-@@ -1579,15 +2226,19 @@ extern "C" {
-
- #define WOL_CTL_DEFAULT \
- (WOL_CTL_DIS_PME_ON_LINK_CHG | \
-- WOL_CTL_DIS_PME_ON_PATTERN | \
-- WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
-- WOL_CTL_DIS_LINK_CHG_UNIT | \
-- WOL_CTL_DIS_PATTERN_UNIT | \
-- WOL_CTL_DIS_MAGIC_PKT_UNIT)
-+ WOL_CTL_DIS_PME_ON_PATTERN | \
-+ WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
-+ WOL_CTL_DIS_LINK_CHG_UNIT | \
-+ WOL_CTL_DIS_PATTERN_UNIT | \
-+ WOL_CTL_DIS_MAGIC_PKT_UNIT)
-
- /* WOL_MATCH_CTL 8 bit WOL Match Control Reg */
- #define WOL_CTL_PATT_ENA(x) (BIT_0 << (x))
-
-+/* WOL_PATT_PME 8 bit WOL PME Match Enable (Yukon-2) */
-+#define WOL_PATT_FORCE_PME BIT_7 /* Generates a PME */
-+#define WOL_PATT_MATCH_PME_ALL 0x7f
-+
- #define SK_NUM_WOL_PATTERN 7
- #define SK_PATTERN_PER_WORD 4
- #define SK_BITMASK_PATTERN 7
-@@ -1597,26 +2248,28 @@ extern "C" {
- #define WOL_LENGTH_SHIFT 8
-
-
-+/* typedefs ******************************************************************/
-+
- /* Receive and Transmit Descriptors ******************************************/
-
- /* Transmit Descriptor struct */
- typedef struct s_HwTxd {
- SK_U32 volatile TxCtrl; /* Transmit Buffer Control Field */
- SK_U32 TxNext; /* Physical Address Pointer to the next TxD */
-- SK_U32 TxAdrLo; /* Physical Tx Buffer Address lower dword */
-- SK_U32 TxAdrHi; /* Physical Tx Buffer Address upper dword */
-+ SK_U32 TxAdrLo; /* Physical Tx Buffer Address lower DWord */
-+ SK_U32 TxAdrHi; /* Physical Tx Buffer Address upper DWord */
- SK_U32 TxStat; /* Transmit Frame Status Word */
--#ifndef SK_USE_REV_DESC
-+#ifndef SK_USE_REV_DESC
- SK_U16 TxTcpOffs; /* TCP Checksum Calculation Start Value */
- SK_U16 TxRes1; /* 16 bit reserved field */
- SK_U16 TxTcpWp; /* TCP Checksum Write Position */
- SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
--#else /* SK_USE_REV_DESC */
-+#else /* SK_USE_REV_DESC */
- SK_U16 TxRes1; /* 16 bit reserved field */
- SK_U16 TxTcpOffs; /* TCP Checksum Calculation Start Value */
- SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
- SK_U16 TxTcpWp; /* TCP Checksum Write Position */
--#endif /* SK_USE_REV_DESC */
-+#endif /* SK_USE_REV_DESC */
- SK_U32 TxRes2; /* 32 bit reserved field */
- } SK_HWTXD;
-
-@@ -1624,33 +2277,266 @@ typedef struct s_HwTxd {
- typedef struct s_HwRxd {
- SK_U32 volatile RxCtrl; /* Receive Buffer Control Field */
- SK_U32 RxNext; /* Physical Address Pointer to the next RxD */
-- SK_U32 RxAdrLo; /* Physical Rx Buffer Address lower dword */
-- SK_U32 RxAdrHi; /* Physical Rx Buffer Address upper dword */
-+ SK_U32 RxAdrLo; /* Physical Rx Buffer Address lower DWord */
-+ SK_U32 RxAdrHi; /* Physical Rx Buffer Address upper DWord */
- SK_U32 RxStat; /* Receive Frame Status Word */
- SK_U32 RxTiSt; /* Receive Time Stamp (from XMAC on GENESIS) */
--#ifndef SK_USE_REV_DESC
-- SK_U16 RxTcpSum1; /* TCP Checksum 1 */
-- SK_U16 RxTcpSum2; /* TCP Checksum 2 */
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 RxTcpSum1; /* Rx TCP Checksum 1 */
-+ SK_U16 RxTcpSum2; /* Rx TCP Checksum 2 */
- SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
- SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
--#else /* SK_USE_REV_DESC */
-- SK_U16 RxTcpSum2; /* TCP Checksum 2 */
-- SK_U16 RxTcpSum1; /* TCP Checksum 1 */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 RxTcpSum2; /* Rx TCP Checksum 2 */
-+ SK_U16 RxTcpSum1; /* Rx TCP Checksum 1 */
- SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
- SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
--#endif /* SK_USE_REV_DESC */
-+#endif /* SK_USE_REV_DESC */
- } SK_HWRXD;
-
- /*
- * Drivers which use the reverse descriptor feature (PCI_OUR_REG_2)
- * should set the define SK_USE_REV_DESC.
-- * Structures are 'normaly' not endianess dependent. But in
-- * this case the SK_U16 fields are bound to bit positions inside the
-- * descriptor. RxTcpSum1 e.g. must start at bit 0 within the 6.th DWord.
-+ * Structures are 'normally' not endianess dependent. But in this case
-+ * the SK_U16 fields are bound to bit positions inside the descriptor.
-+ * RxTcpSum1 e.g. must start at bit 0 within the 7.th DWord.
- * The bit positions inside a DWord are of course endianess dependent and
-- * swaps if the DWord is swapped by the hardware.
-+ * swap if the DWord is swapped by the hardware.
- */
-
-+/* YUKON-2 descriptors ******************************************************/
-+
-+typedef struct _TxChksum {
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 TxTcpWp; /* TCP Checksum Write Position */
-+ SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
-+ SK_U16 TxTcpWp; /* TCP Checksum Write Position */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWTXCS;
-+
-+typedef struct _LargeSend {
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 Length; /* Large Send Segment Length */
-+ SK_U16 Reserved; /* reserved */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 Reserved; /* reserved */
-+ SK_U16 Length; /* Large Send Segment Length */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWTXLS;
-+
-+typedef union u_HwTxBuf {
-+ SK_U16 BufLen; /* Tx Buffer Length */
-+ SK_U16 VlanTag; /* VLAN Tag */
-+ SK_U16 InitCsum; /* Init. Checksum */
-+} SK_HWTXBUF;
-+
-+/* Tx List Element structure */
-+typedef struct s_HwLeTx {
-+ union {
-+ SK_U32 BufAddr; /* Tx LE Buffer Address high/low */
-+ SK_HWTXCS ChkSum; /* Tx LE TCP Checksum parameters */
-+ SK_HWTXLS LargeSend;/* Large Send length */
-+ } TxUn;
-+#ifndef SK_USE_REV_DESC
-+ SK_HWTXBUF Send;
-+ SK_U8 ControlFlags; /* Tx LE Control field or Lock Number */
-+ SK_U8 Opcode; /* Tx LE Opcode field */
-+#else /* SK_USE_REV_DESC */
-+ SK_U8 Opcode; /* Tx LE Opcode field */
-+ SK_U8 ControlFlags; /* Tx LE Control field or Lock Number */
-+ SK_HWTXBUF Send;
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWLETX;
-+
-+typedef struct _RxChkSum{
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
-+ SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
-+ SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWRXCS;
-+
-+/* Rx List Element structure */
-+typedef struct s_HwLeRx {
-+ union {
-+ SK_U32 BufAddr; /* Rx LE Buffer Address high/low */
-+ SK_HWRXCS ChkSum; /* Rx LE TCP Checksum parameters */
-+ } RxUn;
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 BufferLength; /* Rx LE Buffer Length field */
-+ SK_U8 ControlFlags; /* Rx LE Control field */
-+ SK_U8 Opcode; /* Rx LE Opcode field */
-+#else /* SK_USE_REV_DESC */
-+ SK_U8 Opcode; /* Rx LE Opcode field */
-+ SK_U8 ControlFlags; /* Rx LE Control field */
-+ SK_U16 BufferLength; /* Rx LE Buffer Length field */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWLERX;
-+
-+typedef struct s_StRxTCPChkSum {
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 RxTCPSum1; /* Rx TCP Checksum 1 */
-+ SK_U16 RxTCPSum2; /* Rx TCP Checksum 2 */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 RxTCPSum2; /* Rx TCP Checksum 2 */
-+ SK_U16 RxTCPSum1; /* Rx TCP Checksum 1 */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWSTCS;
-+
-+typedef struct s_StRxRssFlags {
-+#ifndef SK_USE_REV_DESC
-+ SK_U8 FlagField; /* contains TCP and IP flags */
-+ SK_U8 reserved; /* reserved */
-+#else /* SK_USE_REV_DESC */
-+ SK_U8 reserved; /* reserved */
-+ SK_U8 FlagField; /* contains TCP and IP flags */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWSTRSS;
-+
-+/* bit definition of RSS LE bit 32/33 (SK_HWSTRSS.FlagField) */
-+ /* bit 7..2 reserved */
-+#define RSS_TCP_FLAG BIT_1S /* RSS value related to TCP area */
-+#define RSS_IP_FLAG BIT_0S /* RSS value related to IP area */
-+/* StRxRssValue is valid if at least RSS_IP_FLAG is set */
-+/* For protocol errors or other protocols an empty RSS LE is generated */
-+
-+typedef union u_HwStBuf {
-+ SK_U16 BufLen; /* Rx Buffer Length */
-+ SK_U16 VlanTag; /* VLAN Tag */
-+ SK_U16 StTxStatHi; /* Tx Queue Status (high) */
-+ SK_HWSTRSS Rss; /* Flag Field for TCP and IP protocol */
-+} SK_HWSTBUF;
-+
-+/* Status List Element structure */
-+typedef struct s_HwLeSt {
-+ union {
-+ SK_U32 StRxStatWord; /* Rx Status Dword */
-+ SK_U32 StRxTimeStamp; /* Rx Timestamp */
-+ SK_HWSTCS StRxTCPCSum; /* Rx TCP Checksum */
-+ SK_U32 StTxStatLow; /* Tx Queue Status (low) */
-+ SK_U32 StRxRssValue; /* Rx RSS value */
-+ } StUn;
-+#ifndef SK_USE_REV_DESC
-+ SK_HWSTBUF Stat;
-+ SK_U8 Link; /* Status LE Link field */
-+ SK_U8 Opcode; /* Status LE Opcode field */
-+#else /* SK_USE_REV_DESC */
-+ SK_U8 Opcode; /* Status LE Opcode field */
-+ SK_U8 Link; /* Status LE Link field */
-+ SK_HWSTBUF Stat;
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWLEST;
-+
-+/* Special Action List Element */
-+typedef struct s_HwLeSa {
-+#ifndef SK_USE_REV_DESC
-+ SK_U16 TxAIdxVld; /* Special Action LE TxA Put Index field */
-+ SK_U16 TxSIdxVld; /* Special Action LE TxS Put Index field */
-+ SK_U16 RxIdxVld; /* Special Action LE Rx Put Index field */
-+ SK_U8 Link; /* Special Action LE Link field */
-+ SK_U8 Opcode; /* Special Action LE Opcode field */
-+#else /* SK_USE_REV_DESC */
-+ SK_U16 TxSIdxVld; /* Special Action LE TxS Put Index field */
-+ SK_U16 TxAIdxVld; /* Special Action LE TxA Put Index field */
-+ SK_U8 Opcode; /* Special Action LE Opcode field */
-+ SK_U8 Link; /* Special Action LE Link field */
-+ SK_U16 RxIdxVld; /* Special Action LE Rx Put Index field */
-+#endif /* SK_USE_REV_DESC */
-+} SK_HWLESA;
-+
-+/* Common List Element union */
-+typedef union u_HwLeTxRxSt {
-+ /* Transmit List Element Structure */
-+ SK_HWLETX Tx;
-+ /* Receive List Element Structure */
-+ SK_HWLERX Rx;
-+ /* Status List Element Structure */
-+ SK_HWLEST St;
-+ /* Special Action List Element Structure */
-+ SK_HWLESA Sa;
-+ /* Full List Element */
-+ SK_U64 Full;
-+} SK_HWLE;
-+
-+/* mask and shift value to get Tx async queue status for port 1 */
-+#define STLE_TXA1_MSKL 0x00000fff
-+#define STLE_TXA1_SHIFTL 0
-+
-+/* mask and shift value to get Tx sync queue status for port 1 */
-+#define STLE_TXS1_MSKL 0x00fff000
-+#define STLE_TXS1_SHIFTL 12
-+
-+/* mask and shift value to get Tx async queue status for port 2 */
-+#define STLE_TXA2_MSKL 0xff000000
-+#define STLE_TXA2_SHIFTL 24
-+#define STLE_TXA2_MSKH 0x000f
-+/* this one shifts up */
-+#define STLE_TXA2_SHIFTH 8
-+
-+/* mask and shift value to get Tx sync queue status for port 2 */
-+#define STLE_TXS2_MSKL 0x00000000
-+#define STLE_TXS2_SHIFTL 0
-+#define STLE_TXS2_MSKH 0xfff0
-+#define STLE_TXS2_SHIFTH 4
-+
-+/* YUKON-2 bit values */
-+#define HW_OWNER BIT_7
-+#define SW_OWNER 0
-+
-+#define PU_PUTIDX_VALID BIT_12
-+
-+/* YUKON-2 Control flags */
-+#define UDPTCP BIT_0S
-+#define CALSUM BIT_1S
-+#define WR_SUM BIT_2S
-+#define INIT_SUM BIT_3S
-+#define LOCK_SUM BIT_4S
-+#define INS_VLAN BIT_5S
-+#define FRC_STAT BIT_6S
-+#define EOP BIT_7S
-+
-+#define TX_LOCK BIT_8S
-+#define BUF_SEND BIT_9S
-+#define PACKET_SEND BIT_10S
-+
-+#define NO_WARNING BIT_14S
-+#define NO_UPDATE BIT_15S
-+
-+/* YUKON-2 Rx/Tx opcodes defines */
-+#define OP_TCPWRITE 0x11
-+#define OP_TCPSTART 0x12
-+#define OP_TCPINIT 0x14
-+#define OP_TCPLCK 0x18
-+#define OP_TCPCHKSUM OP_TCPSTART
-+#define OP_TCPIS (OP_TCPINIT | OP_TCPSTART)
-+#define OP_TCPLW (OP_TCPLCK | OP_TCPWRITE)
-+#define OP_TCPLSW (OP_TCPLCK | OP_TCPSTART | OP_TCPWRITE)
-+#define OP_TCPLISW (OP_TCPLCK | OP_TCPINIT | OP_TCPSTART | OP_TCPWRITE)
-+#define OP_ADDR64 0x21
-+#define OP_VLAN 0x22
-+#define OP_ADDR64VLAN (OP_ADDR64 | OP_VLAN)
-+#define OP_LRGLEN 0x24
-+#define OP_LRGLENVLAN (OP_LRGLEN | OP_VLAN)
-+#define OP_BUFFER 0x40
-+#define OP_PACKET 0x41
-+#define OP_LARGESEND 0x43
-+
-+/* YUKON-2 STATUS opcodes defines */
-+#define OP_RXSTAT 0x60
-+#define OP_RXTIMESTAMP 0x61
-+#define OP_RXVLAN 0x62
-+#define OP_RXCHKS 0x64
-+#define OP_RXCHKSVLAN (OP_RXCHKS | OP_RXVLAN)
-+#define OP_RXTIMEVLAN (OP_RXTIMESTAMP | OP_RXVLAN)
-+#define OP_RSS_HASH 0x65
-+#define OP_TXINDEXLE 0x68
-+
-+/* YUKON-2 SPECIAL opcodes defines */
-+#define OP_PUTIDX 0x70
-
- /* Descriptor Bit Definition */
- /* TxCtrl Transmit Buffer Control Field */
-@@ -1685,6 +2571,10 @@ typedef struct s_HwRxd {
-
- /* macros ********************************************************************/
-
-+/* Macro for accessing the key registers */
-+#define RSS_KEY_ADDR(Port, KeyIndex) \
-+ ((B4_RSS_KEY | ( ((Port) == 0) ? 0 : 0x80)) + (KeyIndex))
-+
- /* Receive and Transmit Queues */
- #define Q_R1 0x0000 /* Receive Queue 1 */
- #define Q_R2 0x0080 /* Receive Queue 2 */
-@@ -1693,6 +2583,10 @@ typedef struct s_HwRxd {
- #define Q_XS2 0x0300 /* Synchronous Transmit Queue 2 */
- #define Q_XA2 0x0380 /* Asynchronous Transmit Queue 2 */
-
-+#define Q_ASF_R1 0x100 /* ASF Rx Queue 1 */
-+#define Q_ASF_R2 0x180 /* ASF Rx Queue 2 */
-+#define Q_ASF_T1 0x140 /* ASF Tx Queue 1 */
-+#define Q_ASF_T2 0x1c0 /* ASF Tx Queue 2 */
- /*
- * Macro Q_ADDR()
- *
-@@ -1704,11 +2598,27 @@ typedef struct s_HwRxd {
- * Offs Queue register offset.
- * Values: Q_D, Q_DA_L ... Q_T2, Q_T3
- *
-- * usage SK_IN32(pAC, Q_ADDR(Q_R2, Q_BC), pVal)
-+ * usage SK_IN32(IoC, Q_ADDR(Q_R2, Q_BC), pVal)
- */
- #define Q_ADDR(Queue, Offs) (B8_Q_REGS + (Queue) + (Offs))
-
- /*
-+ * Macro Y2_PREF_Q_ADDR()
-+ *
-+ * Use this macro to access the Prefetch Units of the receive and
-+ * transmit queues of Yukon-2.
-+ *
-+ * para:
-+ * Queue Queue to access.
-+ * Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, Q_XA2,
-+ * Offs Queue register offset.
-+ * Values: PREF_UNIT_CTRL_REG ... PREF_UNIT_FIFO_LEV_REG
-+ *
-+ * usage SK_IN16(IoC, Y2_Q_ADDR(Q_R2, PREF_UNIT_GET_IDX_REG), pVal)
-+ */
-+#define Y2_PREF_Q_ADDR(Queue, Offs) (Y2_B8_PREF_REGS + (Queue) + (Offs))
-+
-+/*
- * Macro RB_ADDR()
- *
- * Use this macro to access the RAM Buffer Registers.
-@@ -1719,14 +2629,14 @@ typedef struct s_HwRxd {
- * Offs Queue register offset.
- * Values: RB_START, RB_END ... RB_LEV, RB_CTRL
- *
-- * usage SK_IN32(pAC, RB_ADDR(Q_R2, RB_RP), pVal)
-+ * usage SK_IN32(IoC, RB_ADDR(Q_R2, RB_RP), pVal)
- */
- #define RB_ADDR(Queue, Offs) (B16_RAM_REGS + (Queue) + (Offs))
-
-
- /* MAC Related Registers */
--#define MAC_1 0 /* belongs to the port near the slot */
--#define MAC_2 1 /* belongs to the port far away from the slot */
-+#define MAC_1 0 /* 1st port */
-+#define MAC_2 1 /* 2nd port */
-
- /*
- * Macro MR_ADDR()
-@@ -1740,19 +2650,10 @@ typedef struct s_HwRxd {
- * Values: RX_MFF_EA, RX_MFF_WP ... LNK_LED_REG,
- * TX_MFF_EA, TX_MFF_WP ... TX_LED_TST
- *
-- * usage SK_IN32(pAC, MR_ADDR(MAC_1, TX_MFF_EA), pVal)
-+ * usage SK_IN32(IoC, MR_ADDR(MAC_1, TX_MFF_EA), pVal)
- */
- #define MR_ADDR(Mac, Offs) (((Mac) << 7) + (Offs))
-
--#ifdef SK_LITTLE_ENDIAN
--#define XM_WORD_LO 0
--#define XM_WORD_HI 1
--#else /* !SK_LITTLE_ENDIAN */
--#define XM_WORD_LO 1
--#define XM_WORD_HI 0
--#endif /* !SK_LITTLE_ENDIAN */
--
--
- /*
- * macros to access the XMAC (GENESIS only)
- *
-@@ -1777,22 +2678,31 @@ typedef struct s_HwRxd {
- #define XMA(Mac, Reg) \
- ((BASE_XMAC_1 + (Mac) * (BASE_XMAC_2 - BASE_XMAC_1)) | ((Reg) << 1))
-
--#define XM_IN16(IoC, Mac, Reg, pVal) \
-- SK_IN16((IoC), XMA((Mac), (Reg)), (pVal))
-+#define XM_IN16(IoC, Mac, Reg, pVal) \
-+ SK_IN16(IoC, XMA(Mac, Reg), pVal)
-+
-+#define XM_OUT16(IoC, Mac, Reg, Val) \
-+ SK_OUT16(IoC, XMA(Mac, Reg), Val)
-+
-+#ifdef SK_LITTLE_ENDIAN
-
--#define XM_OUT16(IoC, Mac, Reg, Val) \
-- SK_OUT16((IoC), XMA((Mac), (Reg)), (Val))
-+#define XM_IN32(IoC, Mac, Reg, pVal) { \
-+ SK_IN16(IoC, XMA(Mac, Reg), (SK_U16 SK_FAR *)(pVal)); \
-+ SK_IN16(IoC, XMA(Mac, (Reg) + 2), (SK_U16 SK_FAR *)(pVal) + 1); \
-+}
-+
-+#else /* !SK_LITTLE_ENDIAN */
-
--#define XM_IN32(IoC, Mac, Reg, pVal) { \
-- SK_IN16((IoC), XMA((Mac), (Reg)), \
-- (SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_LO]); \
-- SK_IN16((IoC), XMA((Mac), (Reg+2)), \
-- (SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_HI]); \
-+#define XM_IN32(IoC, Mac, Reg, pVal) { \
-+ SK_IN16(IoC, XMA(Mac, Reg), (SK_U16 SK_FAR *)(pVal) + 1); \
-+ SK_IN16(IoC, XMA(Mac, (Reg) + 2), (SK_U16 SK_FAR *)(pVal)); \
- }
-
-+#endif /* !SK_LITTLE_ENDIAN */
-+
- #define XM_OUT32(IoC, Mac, Reg, Val) { \
-- SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL)); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16)(((Val) >> 16) & 0xffffL));\
-+ SK_OUT16(IoC, XMA(Mac, Reg), (SK_U16)((Val) & 0xffffL)); \
-+ SK_OUT16(IoC, XMA(Mac, (Reg) + 2), (SK_U16)(((Val) >> 16) & 0xffffL)); \
- }
-
- /* Remember: we are always writing to / reading from LITTLE ENDIAN memory */
-@@ -1802,13 +2712,13 @@ typedef struct s_HwRxd {
- SK_U8 *pByte; \
- pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
- SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \
-- pByte[0] = (SK_U8)(Word & 0x00ff); \
-+ pByte[0] = (SK_U8)(Word & 0x00ff); \
- pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \
-- pByte[2] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), XMA((Mac), (Reg) + 2), &Word); \
-+ pByte[2] = (SK_U8)(Word & 0x00ff); \
- pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \
-- pByte[4] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), XMA((Mac), (Reg) + 4), &Word); \
-+ pByte[4] = (SK_U8)(Word & 0x00ff); \
- pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
- }
-
-@@ -1818,10 +2728,10 @@ typedef struct s_HwRxd {
- SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \
- (((SK_U16)(pByte[0]) & 0x00ff) | \
- (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \
-+ SK_OUT16((IoC), XMA((Mac), (Reg) + 2), (SK_U16) \
- (((SK_U16)(pByte[2]) & 0x00ff) | \
- (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \
-+ SK_OUT16((IoC), XMA((Mac), (Reg) + 4), (SK_U16) \
- (((SK_U16)(pByte[4]) & 0x00ff) | \
- (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
- }
-@@ -1831,16 +2741,16 @@ typedef struct s_HwRxd {
- SK_U8 SK_FAR *pByte; \
- pByte = (SK_U8 SK_FAR *)&((SK_U8 SK_FAR *)(pVal))[0]; \
- SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \
-- pByte[0] = (SK_U8)(Word & 0x00ff); \
-+ pByte[0] = (SK_U8)(Word & 0x00ff); \
- pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \
-- pByte[2] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), XMA((Mac), (Reg) + 2), &Word); \
-+ pByte[2] = (SK_U8)(Word & 0x00ff); \
- pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \
-- pByte[4] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), XMA((Mac), (Reg) + 4), &Word); \
-+ pByte[4] = (SK_U8)(Word & 0x00ff); \
- pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), XMA((Mac), (Reg+6)), &Word); \
-- pByte[6] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), XMA((Mac), (Reg) + 6), &Word); \
-+ pByte[6] = (SK_U8)(Word & 0x00ff); \
- pByte[7] = (SK_U8)((Word >> 8) & 0x00ff); \
- }
-
-@@ -1850,13 +2760,13 @@ typedef struct s_HwRxd {
- SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \
- (((SK_U16)(pByte[0]) & 0x00ff)| \
- (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \
-+ SK_OUT16((IoC), XMA((Mac), (Reg) + 2), (SK_U16) \
- (((SK_U16)(pByte[2]) & 0x00ff)| \
- (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \
-+ SK_OUT16((IoC), XMA((Mac), (Reg) + 4), (SK_U16) \
- (((SK_U16)(pByte[4]) & 0x00ff)| \
- (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), XMA((Mac), (Reg+6)), (SK_U16) \
-+ SK_OUT16((IoC), XMA((Mac), (Reg) + 6), (SK_U16) \
- (((SK_U16)(pByte[6]) & 0x00ff)| \
- (((SK_U16)(pByte[7]) << 8) & 0xff00))); \
- }
-@@ -1866,7 +2776,7 @@ typedef struct s_HwRxd {
- *
- * GM_IN16(), to read a 16 bit register (e.g. GM_GP_STAT)
- * GM_OUT16(), to write a 16 bit register (e.g. GM_GP_CTRL)
-- * GM_IN32(), to read a 32 bit register (e.g. GM_)
-+ * GM_IN32(), to read a 32 bit register (e.g. GM_RXF_UC_OK)
- * GM_OUT32(), to write a 32 bit register (e.g. GM_)
- * GM_INADDR(), to read a network address register (e.g. GM_SRC_ADDR_1L)
- * GM_OUTADDR(), to write a network address register (e.g. GM_SRC_ADDR_2L)
-@@ -1885,22 +2795,31 @@ typedef struct s_HwRxd {
- #define GMA(Mac, Reg) \
- ((BASE_GMAC_1 + (Mac) * (BASE_GMAC_2 - BASE_GMAC_1)) | (Reg))
-
--#define GM_IN16(IoC, Mac, Reg, pVal) \
-- SK_IN16((IoC), GMA((Mac), (Reg)), (pVal))
-+#define GM_IN16(IoC, Mac, Reg, pVal) \
-+ SK_IN16(IoC, GMA(Mac, Reg), pVal)
-+
-+#define GM_OUT16(IoC, Mac, Reg, Val) \
-+ SK_OUT16(IoC, GMA(Mac, Reg), Val)
-+
-+#ifdef SK_LITTLE_ENDIAN
-+
-+#define GM_IN32(IoC, Mac, Reg, pVal) { \
-+ SK_IN16(IoC, GMA(Mac, Reg), (SK_U16 SK_FAR *)(pVal)); \
-+ SK_IN16((IoC), GMA(Mac, (Reg) + 4), (SK_U16 SK_FAR *)(pVal) + 1); \
-+}
-
--#define GM_OUT16(IoC, Mac, Reg, Val) \
-- SK_OUT16((IoC), GMA((Mac), (Reg)), (Val))
-+#else /* !SK_LITTLE_ENDIAN */
-
--#define GM_IN32(IoC, Mac, Reg, pVal) { \
-- SK_IN16((IoC), GMA((Mac), (Reg)), \
-- (SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_LO]); \
-- SK_IN16((IoC), GMA((Mac), (Reg+4)), \
-- (SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_HI]); \
-+#define GM_IN32(IoC, Mac, Reg, pVal) { \
-+ SK_IN16(IoC, GMA(Mac, Reg), (SK_U16 SK_FAR *)(pVal) + 1); \
-+ SK_IN16(IoC, GMA(Mac, (Reg) + 4), (SK_U16 SK_FAR *)(pVal)); \
- }
-
-+#endif /* !SK_LITTLE_ENDIAN */
-+
- #define GM_OUT32(IoC, Mac, Reg, Val) { \
-- SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL)); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16)(((Val) >> 16) & 0xffffL));\
-+ SK_OUT16(IoC, GMA(Mac, Reg), (SK_U16)((Val) & 0xffffL)); \
-+ SK_OUT16(IoC, GMA(Mac, (Reg) + 4), (SK_U16)(((Val) >> 16) & 0xffffL)); \
- }
-
- #define GM_INADDR(IoC, Mac, Reg, pVal) { \
-@@ -1908,13 +2827,13 @@ typedef struct s_HwRxd {
- SK_U8 *pByte; \
- pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
- SK_IN16((IoC), GMA((Mac), (Reg)), &Word); \
-- pByte[0] = (SK_U8)(Word & 0x00ff); \
-+ pByte[0] = (SK_U8)(Word & 0x00ff); \
- pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word); \
-- pByte[2] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), GMA((Mac), (Reg) + 4), &Word); \
-+ pByte[2] = (SK_U8)(Word & 0x00ff); \
- pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word); \
-- pByte[4] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), GMA((Mac), (Reg) + 8), &Word); \
-+ pByte[4] = (SK_U8)(Word & 0x00ff); \
- pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
- }
-
-@@ -1924,10 +2843,10 @@ typedef struct s_HwRxd {
- SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16) \
- (((SK_U16)(pByte[0]) & 0x00ff) | \
- (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16) \
-+ SK_OUT16((IoC), GMA((Mac), (Reg) + 4), (SK_U16) \
- (((SK_U16)(pByte[2]) & 0x00ff) | \
- (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16) \
-+ SK_OUT16((IoC), GMA((Mac), (Reg) + 8), (SK_U16) \
- (((SK_U16)(pByte[4]) & 0x00ff) | \
- (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
- }
-@@ -1937,16 +2856,16 @@ typedef struct s_HwRxd {
- SK_U8 *pByte; \
- pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
- SK_IN16((IoC), GMA((Mac), (Reg)), &Word); \
-- pByte[0] = (SK_U8)(Word & 0x00ff); \
-+ pByte[0] = (SK_U8)(Word & 0x00ff); \
- pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word); \
-- pByte[2] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), GMA((Mac), (Reg) + 4), &Word); \
-+ pByte[2] = (SK_U8)(Word & 0x00ff); \
- pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word); \
-- pByte[4] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), GMA((Mac), (Reg) + 8), &Word); \
-+ pByte[4] = (SK_U8)(Word & 0x00ff); \
- pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
-- SK_IN16((IoC), GMA((Mac), (Reg+12)), &Word); \
-- pByte[6] = (SK_U8)(Word & 0x00ff); \
-+ SK_IN16((IoC), GMA((Mac), (Reg) + 12), &Word); \
-+ pByte[6] = (SK_U8)(Word & 0x00ff); \
- pByte[7] = (SK_U8)((Word >> 8) & 0x00ff); \
- }
-
-@@ -1956,13 +2875,13 @@ typedef struct s_HwRxd {
- SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16) \
- (((SK_U16)(pByte[0]) & 0x00ff)| \
- (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16) \
-+ SK_OUT16((IoC), GMA((Mac), (Reg) + 4), (SK_U16) \
- (((SK_U16)(pByte[2]) & 0x00ff)| \
- (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16) \
-+ SK_OUT16((IoC), GMA((Mac), (Reg) + 8), (SK_U16) \
- (((SK_U16)(pByte[4]) & 0x00ff)| \
- (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
-- SK_OUT16((IoC), GMA((Mac), (Reg+12)), (SK_U16) \
-+ SK_OUT16((IoC), GMA((Mac), (Reg) + 12), (SK_U16) \
- (((SK_U16)(pByte[6]) & 0x00ff)| \
- (((SK_U16)(pByte[7]) << 8) & 0xff00))); \
- }
-@@ -1980,8 +2899,8 @@ typedef struct s_HwRxd {
- #define SK_PHY_BCOM 1 /* Broadcom BCM5400 */
- #define SK_PHY_LONE 2 /* Level One LXT1000 */
- #define SK_PHY_NAT 3 /* National DP83891 */
--#define SK_PHY_MARV_COPPER 4 /* Marvell 88E1011S */
--#define SK_PHY_MARV_FIBER 5 /* Marvell 88E1011S working on fiber */
-+#define SK_PHY_MARV_COPPER 4 /* Marvell 88E1040S */
-+#define SK_PHY_MARV_FIBER 5 /* Marvell 88E1040S working on fiber */
-
- /*
- * PHY addresses (bits 12..8 of PHY address reg)
-@@ -2010,30 +2929,30 @@ typedef struct s_HwRxd {
- *
- * usage: PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value);
- * Warning: a PHY_READ on an uninitialized PHY (PHY still in reset) never
-- * comes back. This is checked in DEBUG mode.
-+ * comes back. This is checked in DEBUG mode.
- */
- #ifndef DEBUG
- #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \
-- SK_U16 Mmu; \
-+ SK_U16 Mmu; \
- \
- XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
- XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
- if ((pPort)->PhyType != SK_PHY_XMAC) { \
-- do { \
-+ do { \
- XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
- } while ((Mmu & XM_MMU_PHY_RDY) == 0); \
- XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
-- } \
-+ } \
- }
- #else
- #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \
-- SK_U16 Mmu; \
-+ SK_U16 Mmu; \
- int __i = 0; \
- \
- XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
- XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
- if ((pPort)->PhyType != SK_PHY_XMAC) { \
-- do { \
-+ do { \
- XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
- __i++; \
- if (__i > 100000) { \
-@@ -2044,7 +2963,7 @@ typedef struct s_HwRxd {
- } \
- } while ((Mmu & XM_MMU_PHY_RDY) == 0); \
- XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
-- } \
-+ } \
- }
- #endif /* DEBUG */
-
-@@ -2052,17 +2971,17 @@ typedef struct s_HwRxd {
- SK_U16 Mmu; \
- \
- if ((pPort)->PhyType != SK_PHY_XMAC) { \
-- do { \
-+ do { \
- XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
- } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \
-- } \
-+ } \
- XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
- XM_OUT16((IoC), (Mac), XM_PHY_DATA, (Val)); \
- if ((pPort)->PhyType != SK_PHY_XMAC) { \
-- do { \
-+ do { \
- XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
- } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \
-- } \
-+ } \
- }
-
- /*
-@@ -2071,12 +2990,14 @@ typedef struct s_HwRxd {
- * Use this macro to access PCI config register from the I/O space.
- *
- * para:
-+ * pAC Pointer to adapter context
- * Addr PCI configuration register to access.
- * Values: PCI_VENDOR_ID ... PCI_VPD_ADR_REG,
- *
-- * usage SK_IN16(pAC, PCI_C(PCI_VENDOR_ID), pVal);
-+ * usage SK_IN16(IoC, PCI_C(pAC, PCI_VENDOR_ID), pVal);
- */
--#define PCI_C(Addr) (B7_CFG_SPC + (Addr)) /* PCI Config Space */
-+#define PCI_C(p, Addr) \
-+ (((CHIP_ID_YUKON_2(p)) ? Y2_CFG_SPC : B7_CFG_SPC) + (Addr))
-
- /*
- * Macro SK_HW_ADDR(Base, Addr)
-@@ -2088,7 +3009,7 @@ typedef struct s_HwRxd {
- * Addr Address offset
- *
- * usage: May be used in SK_INxx and SK_OUTxx macros
-- * #define SK_IN8(pAC, Addr, pVal) ...\
-+ * #define SK_IN8(IoC, Addr, pVal) ...\
- * *pVal = (SK_U8)inp(SK_HW_ADDR(pAC->Hw.Iop, Addr)))
- */
- #ifdef SK_MEM_MAPPED_IO
-@@ -2107,20 +3028,31 @@ typedef struct s_HwRxd {
- * para:
- * pAC Pointer to adapter context struct
- * IoC I/O context needed for SK I/O macros
-- * Port Port number
-+ * Port Port number
- * Mode Mode to set for this LED
- */
- #define SK_HWAC_LINK_LED(pAC, IoC, Port, Mode) \
- SK_OUT8(IoC, MR_ADDR(Port, LNK_LED_REG), Mode);
-
-+#define SK_SET_GP_IO(IoC, Bit) { \
-+ SK_U32 DWord; \
-+ SK_IN32(IoC, B2_GP_IO, &DWord); \
-+ DWord |= ((GP_DIR_0 | GP_IO_0) << (Bit));\
-+ SK_OUT32(IoC, B2_GP_IO, DWord); \
-+}
-
--/* typedefs *******************************************************************/
--
-+#define SK_CLR_GP_IO(IoC, Bit) { \
-+ SK_U32 DWord; \
-+ SK_IN32(IoC, B2_GP_IO, &DWord); \
-+ DWord &= ~((GP_DIR_0 | GP_IO_0) << (Bit));\
-+ SK_OUT32(IoC, B2_GP_IO, DWord); \
-+}
-
--/* function prototypes ********************************************************/
-+#define SK_GE_PCI_FIFO_SIZE 1600 /* PCI FIFO Size */
-
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
-
- #endif /* __INC_SKGEHW_H */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgehwt.h ./drivers/net/sk98lin/h/skgehwt.h
---- ./drivers/net/sk98lin.sk98/h/skgehwt.h 2004-10-19 01:53:51.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgehwt.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skhwt.h
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.7 $
-- * Date: $Date: 2003/09/16 12:55:08 $
-+ * Version: $Revision: 2.1 $
-+ * Date: $Date: 2003/10/27 14:16:09 $
- * Purpose: Defines for the hardware timer functions
- *
- ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgei2c.h ./drivers/net/sk98lin/h/skgei2c.h
---- ./drivers/net/sk98lin.sk98/h/skgei2c.h 2004-10-19 01:54:40.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgei2c.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,210 +0,0 @@
--/******************************************************************************
-- *
-- * Name: skgei2c.h
-- * Project: Gigabit Ethernet Adapters, TWSI-Module
-- * Version: $Revision: 1.25 $
-- * Date: $Date: 2003/10/20 09:06:05 $
-- * Purpose: Special defines for TWSI
-- *
-- ******************************************************************************/
--
--/******************************************************************************
-- *
-- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * The information in this file is provided "AS IS" without warranty.
-- *
-- ******************************************************************************/
--
--/*
-- * SKGEI2C.H contains all SK-98xx specific defines for the TWSI handling
-- */
--
--#ifndef _INC_SKGEI2C_H_
--#define _INC_SKGEI2C_H_
--
--/*
-- * Macros to access the B2_I2C_CTRL
-- */
--#define SK_I2C_CTL(IoC, flag, dev, dev_size, reg, burst) \
-- SK_OUT32(IoC, B2_I2C_CTRL,\
-- (flag ? 0x80000000UL : 0x0L) | \
-- (((SK_U32)reg << 16) & I2C_ADDR) | \
-- (((SK_U32)dev << 9) & I2C_DEV_SEL) | \
-- (dev_size & I2C_DEV_SIZE) | \
-- ((burst << 4) & I2C_BURST_LEN))
--
--#define SK_I2C_STOP(IoC) { \
-- SK_U32 I2cCtrl; \
-- SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
-- SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
--}
--
--#define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
--
--/*
-- * Macros to access the TWSI SW Registers
-- */
--#define SK_I2C_SET_BIT(IoC, SetBits) { \
-- SK_U8 OrgBits; \
-- SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
-- SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
--}
--
--#define SK_I2C_CLR_BIT(IoC, ClrBits) { \
-- SK_U8 OrgBits; \
-- SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
-- SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
--}
--
--#define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
--
--/*
-- * define the possible sensor states
-- */
--#define SK_SEN_IDLE 0 /* Idle: sensor not read */
--#define SK_SEN_VALUE 1 /* Value Read cycle */
--#define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
--
--/*
-- * Conversion factor to convert read Voltage sensor to milli Volt
-- * Conversion factor to convert read Temperature sensor to 10th degree Celsius
-- */
--#define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
--#define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
--#define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for ext. val. */
--
--/*
-- * formula: counter = (22500*60)/(rpm * divisor * pulses/2)
-- * assuming: 6500rpm, 4 pulses, divisor 1
-- */
--#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
--
--/*
-- * Define sensor management data
-- * Maximum is reached on Genesis copper dual port and Yukon-64
-- * Board specific maximum is in pAC->I2c.MaxSens
-- */
--#define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
--#define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
--
--/*
-- * To watch the state machine (SM) use the timer in two ways
-- * instead of one as hitherto
-- */
--#define SK_TIMER_WATCH_SM 0 /* Watch the SM to finish in a spec. time */
--#define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
--
--/*
-- * Defines for the individual thresholds
-- */
--
--/* Temperature sensor */
--#define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
--#define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
--#define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
--#define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
--
--/* VCC which should be 5 V */
--#define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
--#define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
--#define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
--#define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
--
--/*
-- * VIO may be 5 V or 3.3 V. Initialization takes two parts:
-- * 1. Initialize lowest lower limit and highest higher limit.
-- * 2. After the first value is read correct the upper or the lower limit to
-- * the appropriate C constant.
-- *
-- * Warning limits are +-5% of the exepected voltage.
-- * Error limits are +-10% of the expected voltage.
-- */
--
--/* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
--
--#define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
--#define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
-- /* 5000 mVolt */
--#define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
--#define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
--
--#define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
--
--/* correction values for the second pass */
--#define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
--#define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
-- /* 3300 mVolt */
--#define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
--#define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
--
--/*
-- * VDD voltage
-- */
--#define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
--#define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
--#define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
--#define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
--
--/*
-- * PHY PLL 3V3 voltage
-- */
--#define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
--#define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
--#define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
--#define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
--
--/*
-- * VAUX (YUKON only)
-- */
--#define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
--#define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
--#define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
--#define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
--#define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
--#define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
--
--/*
-- * PHY 2V5 voltage
-- */
--#define SK_SEN_PHY_2V5_HIGH_ERR 2750 /* Voltage PHY High Err Threshold */
--#define SK_SEN_PHY_2V5_HIGH_WARN 2640 /* Voltage PHY High Warn Threshold */
--#define SK_SEN_PHY_2V5_LOW_WARN 2376 /* Voltage PHY Low Warn Threshold */
--#define SK_SEN_PHY_2V5_LOW_ERR 2222 /* Voltage PHY Low Err Threshold */
--
--/*
-- * ASIC Core 1V5 voltage (YUKON only)
-- */
--#define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
--#define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
--#define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
--#define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
--
--/*
-- * FAN 1 speed
-- */
--/* assuming: 6500rpm +-15%, 4 pulses,
-- * warning at: 80 %
-- * error at: 70 %
-- * no upper limit
-- */
--#define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
--#define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
--#define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
--#define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
--
--/*
-- * Some Voltages need dynamic thresholds
-- */
--#define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
--#define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
--#define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
--
--extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
--#endif /* n_INC_SKGEI2C_H */
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgeinit.h ./drivers/net/sk98lin/h/skgeinit.h
---- ./drivers/net/sk98lin.sk98/h/skgeinit.h 2004-10-19 01:54:40.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgeinit.h 2006-08-31 14:59:51.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgeinit.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.83 $
-- * Date: $Date: 2003/09/16 14:07:37 $
-+ * Version: $Revision: 2.48 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Structures and prototypes for the GE Init Module
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -60,14 +61,17 @@ extern "C" {
- #define SK_XMIT_DUR 0x002faf08UL /* 50 ms */
- #define SK_BLK_DUR 0x01dcd650UL /* 500 ms */
-
--#define SK_DPOLL_DEF 0x00ee6b28UL /* 250 ms at 62.5 MHz */
-+#define SK_DPOLL_DEF 0x00ee6b28UL /* 250 ms at 62.5 MHz (Genesis) */
-+#define SK_DPOLL_DEF_Y2 0x0000124fUL /* 75 us (Yukon-2) */
-
- #define SK_DPOLL_MAX 0x00ffffffUL /* 268 ms at 62.5 MHz */
-- /* 215 ms at 78.12 MHz */
-+ /* 215 ms at 78.12 MHz (Yukon) */
-
- #define SK_FACT_62 100 /* is given in percent */
--#define SK_FACT_53 85 /* on GENESIS: 53.12 MHz */
-+#define SK_FACT_53 85 /* on GENESIS: 53.12 MHz */
- #define SK_FACT_78 125 /* on YUKON: 78.12 MHz */
-+#define SK_FACT_100 161 /* on YUKON-FE: 100 MHz */
-+#define SK_FACT_125 202 /* on YUKON-EC: 125 MHz */
-
- /* Timeout values */
- #define SK_MAC_TO_53 72 /* MAC arbiter timeout */
-@@ -82,11 +86,23 @@ extern "C" {
- #define SK_RB_LLPP_S (10 * 1024) /* Lower Level for small Queues */
- #define SK_RB_LLPP_B (16 * 1024) /* Lower Level for big Queues */
-
-+/* Threshold values for Yukon-EC Ultra */
-+#define SK_ECU_ULPP 0x0080 /* Upper Pause Threshold (multiples of 8) */
-+#define SK_ECU_LLPP 0x0060 /* Lower Pause Threshold (multiples of 8) */
-+#define SK_ECU_AE_THR 0x0180 /* Almost Empty Threshold */
-+#define SK_ECU_TXFF_LEV 0x01a0 /* Tx BMU FIFO Level */
-+
- #ifndef SK_BMU_RX_WM
--#define SK_BMU_RX_WM 0x600 /* BMU Rx Watermark */
-+#define SK_BMU_RX_WM 0x600 /* BMU Rx Watermark */
- #endif
-+
- #ifndef SK_BMU_TX_WM
--#define SK_BMU_TX_WM 0x600 /* BMU Tx Watermark */
-+#define SK_BMU_TX_WM 0x600 /* BMU Tx Watermark */
-+#endif
-+
-+/* performance sensitive drivers should set this define to 0x80 */
-+#ifndef SK_BMU_RX_WM_PEX
-+#define SK_BMU_RX_WM_PEX 0x600 /* BMU Rx Watermark for PEX */
- #endif
-
- /* XMAC II Rx High Watermark */
-@@ -98,37 +114,31 @@ extern "C" {
- #define SK_XM_THR_MULL 0x01fb /* .. for multiple link usage */
- #define SK_XM_THR_JUMBO 0x03fc /* .. for jumbo frame usage */
-
--/* values for GIPortUsage */
-+/* values for PortUsage */
- #define SK_RED_LINK 1 /* redundant link usage */
- #define SK_MUL_LINK 2 /* multiple link usage */
- #define SK_JUMBO_LINK 3 /* driver uses jumbo frames */
-
- /* Minimum RAM Buffer Rx Queue Size */
--#define SK_MIN_RXQ_SIZE 16 /* 16 kB */
-+#define SK_MIN_RXQ_SIZE (((pAC)->GIni.GIYukon2) ? 10 : 16) /* 10/16 kB */
-
- /* Minimum RAM Buffer Tx Queue Size */
--#define SK_MIN_TXQ_SIZE 16 /* 16 kB */
-+#define SK_MIN_TXQ_SIZE (((pAC)->GIni.GIYukon2) ? 10 : 16) /* 10/16 kB */
-
--/* Queue Size units */
--#define QZ_UNITS 0x7
-+/* Queue Size units (Genesis/Yukon) */
-+#define QZ_UNITS 7
- #define QZ_STEP 8
-
-+/* Queue Size units (Yukon-2) */
-+#define QZ_STEP_Y2 1
-+
- /* Percentage of queue size from whole memory */
- /* 80 % for receive */
--#define RAM_QUOTA_RX 80L
--/* 0% for sync transfer */
--#define RAM_QUOTA_SYNC 0L
-+#define RAM_QUOTA_RX 80
-+/* 0 % for sync transfer */
-+#define RAM_QUOTA_SYNC 0
- /* the rest (20%) is taken for async transfer */
-
--/* Get the rounded queue size in Bytes in 8k steps */
--#define ROUND_QUEUE_SIZE(SizeInBytes) \
-- ((((unsigned long) (SizeInBytes) + (QZ_STEP*1024L)-1) / 1024) & \
-- ~(QZ_STEP-1))
--
--/* Get the rounded queue size in KBytes in 8k steps */
--#define ROUND_QUEUE_SIZE_KB(Kilobytes) \
-- ROUND_QUEUE_SIZE((Kilobytes) * 1024L)
--
- /* Types of RAM Buffer Queues */
- #define SK_RX_SRAM_Q 1 /* small receive queue */
- #define SK_RX_BRAM_Q 2 /* big receive queue */
-@@ -167,11 +177,11 @@ extern "C" {
-
-
- /* Link Speed Capabilities */
--#define SK_LSPEED_CAP_AUTO (1<<0) /* Automatic resolution */
--#define SK_LSPEED_CAP_10MBPS (1<<1) /* 10 Mbps */
--#define SK_LSPEED_CAP_100MBPS (1<<2) /* 100 Mbps */
--#define SK_LSPEED_CAP_1000MBPS (1<<3) /* 1000 Mbps */
--#define SK_LSPEED_CAP_INDETERMINATED (1<<4) /* indeterminated */
-+#define SK_LSPEED_CAP_AUTO BIT_0S /* Automatic resolution */
-+#define SK_LSPEED_CAP_10MBPS BIT_1S /* 10 Mbps */
-+#define SK_LSPEED_CAP_100MBPS BIT_2S /* 100 Mbps */
-+#define SK_LSPEED_CAP_1000MBPS BIT_3S /* 1000 Mbps */
-+#define SK_LSPEED_CAP_INDETERMINATED BIT_4S /* indeterminated */
-
- /* Link Speed Parameter */
- #define SK_LSPEED_AUTO 1 /* Automatic resolution */
-@@ -189,11 +199,11 @@ extern "C" {
-
-
- /* Link Capability Parameter */
--#define SK_LMODE_CAP_HALF (1<<0) /* Half Duplex Mode */
--#define SK_LMODE_CAP_FULL (1<<1) /* Full Duplex Mode */
--#define SK_LMODE_CAP_AUTOHALF (1<<2) /* AutoHalf Duplex Mode */
--#define SK_LMODE_CAP_AUTOFULL (1<<3) /* AutoFull Duplex Mode */
--#define SK_LMODE_CAP_INDETERMINATED (1<<4) /* indeterminated */
-+#define SK_LMODE_CAP_HALF BIT_0S /* Half Duplex Mode */
-+#define SK_LMODE_CAP_FULL BIT_1S /* Full Duplex Mode */
-+#define SK_LMODE_CAP_AUTOHALF BIT_2S /* AutoHalf Duplex Mode */
-+#define SK_LMODE_CAP_AUTOFULL BIT_3S /* AutoFull Duplex Mode */
-+#define SK_LMODE_CAP_INDETERMINATED BIT_4S /* indeterminated */
-
- /* Link Mode Current State */
- #define SK_LMODE_STAT_UNKNOWN 1 /* Unknown Duplex Mode */
-@@ -220,10 +230,10 @@ extern "C" {
- #define SK_FLOW_STAT_INDETERMINATED 5 /* indeterminated */
-
- /* Master/Slave Mode Capabilities */
--#define SK_MS_CAP_AUTO (1<<0) /* Automatic resolution */
--#define SK_MS_CAP_MASTER (1<<1) /* This station is master */
--#define SK_MS_CAP_SLAVE (1<<2) /* This station is slave */
--#define SK_MS_CAP_INDETERMINATED (1<<3) /* indeterminated */
-+#define SK_MS_CAP_AUTO BIT_0S /* Automatic resolution */
-+#define SK_MS_CAP_MASTER BIT_1S /* This station is master */
-+#define SK_MS_CAP_SLAVE BIT_2S /* This station is slave */
-+#define SK_MS_CAP_INDETERMINATED BIT_3S /* indeterminated */
-
- /* Set Master/Slave Mode Parameter (and capabilities) */
- #define SK_MS_MODE_AUTO 1 /* Automatic resolution */
-@@ -238,25 +248,25 @@ extern "C" {
- #define SK_MS_STAT_FAULT 4 /* M/S resolution failed */
- #define SK_MS_STAT_INDETERMINATED 5 /* indeterminated */
-
--/* parameter 'Mode' when calling SkXmSetRxCmd() */
--#define SK_STRIP_FCS_ON (1<<0) /* Enable FCS stripping of Rx frames */
--#define SK_STRIP_FCS_OFF (1<<1) /* Disable FCS stripping of Rx frames */
--#define SK_STRIP_PAD_ON (1<<2) /* Enable pad byte stripping of Rx fr */
--#define SK_STRIP_PAD_OFF (1<<3) /* Disable pad byte stripping of Rx fr */
--#define SK_LENERR_OK_ON (1<<4) /* Don't chk fr for in range len error */
--#define SK_LENERR_OK_OFF (1<<5) /* Check frames for in range len error */
--#define SK_BIG_PK_OK_ON (1<<6) /* Don't set Rx Error bit for big frames */
--#define SK_BIG_PK_OK_OFF (1<<7) /* Set Rx Error bit for big frames */
--#define SK_SELF_RX_ON (1<<8) /* Enable Rx of own packets */
--#define SK_SELF_RX_OFF (1<<9) /* Disable Rx of own packets */
-+/* parameter 'Mode' when calling SkMacSetRxCmd() */
-+#define SK_STRIP_FCS_ON BIT_0S /* Enable FCS stripping of Rx frames */
-+#define SK_STRIP_FCS_OFF BIT_1S /* Disable FCS stripping of Rx frames */
-+#define SK_STRIP_PAD_ON BIT_2S /* Enable pad byte stripping of Rx fr */
-+#define SK_STRIP_PAD_OFF BIT_3S /* Disable pad byte stripping of Rx fr */
-+#define SK_LENERR_OK_ON BIT_4S /* Don't chk fr for in range len error */
-+#define SK_LENERR_OK_OFF BIT_5S /* Check frames for in range len error */
-+#define SK_BIG_PK_OK_ON BIT_6S /* Don't set Rx Error bit for big frames */
-+#define SK_BIG_PK_OK_OFF BIT_7S /* Set Rx Error bit for big frames */
-+#define SK_SELF_RX_ON BIT_8S /* Enable Rx of own packets */
-+#define SK_SELF_RX_OFF BIT_9S /* Disable Rx of own packets */
-
- /* parameter 'Para' when calling SkMacSetRxTxEn() */
--#define SK_MAC_LOOPB_ON (1<<0) /* Enable MAC Loopback Mode */
--#define SK_MAC_LOOPB_OFF (1<<1) /* Disable MAC Loopback Mode */
--#define SK_PHY_LOOPB_ON (1<<2) /* Enable PHY Loopback Mode */
--#define SK_PHY_LOOPB_OFF (1<<3) /* Disable PHY Loopback Mode */
--#define SK_PHY_FULLD_ON (1<<4) /* Enable GMII Full Duplex */
--#define SK_PHY_FULLD_OFF (1<<5) /* Disable GMII Full Duplex */
-+#define SK_MAC_LOOPB_ON BIT_0S /* Enable MAC Loopback Mode */
-+#define SK_MAC_LOOPB_OFF BIT_1S /* Disable MAC Loopback Mode */
-+#define SK_PHY_LOOPB_ON BIT_2S /* Enable PHY Loopback Mode */
-+#define SK_PHY_LOOPB_OFF BIT_3S /* Disable PHY Loopback Mode */
-+#define SK_PHY_FULLD_ON BIT_4S /* Enable GMII Full Duplex */
-+#define SK_PHY_FULLD_OFF BIT_5S /* Disable GMII Full Duplex */
-
- /* States of PState */
- #define SK_PRT_RESET 0 /* the port is reset */
-@@ -266,18 +276,24 @@ extern "C" {
-
- /* PHY power down modes */
- #define PHY_PM_OPERATIONAL_MODE 0 /* PHY operational mode */
--#define PHY_PM_DEEP_SLEEP 1 /* coma mode --> minimal power */
-+#define PHY_PM_DEEP_SLEEP 1 /* Coma mode --> minimal power */
- #define PHY_PM_IEEE_POWER_DOWN 2 /* IEEE 22.2.4.1.5 compl. power down */
--#define PHY_PM_ENERGY_DETECT 3 /* energy detect */
--#define PHY_PM_ENERGY_DETECT_PLUS 4 /* energy detect plus */
-+#define PHY_PM_ENERGY_DETECT 3 /* Energy detect */
-+#define PHY_PM_ENERGY_DETECT_PLUS 4 /* Energy detect plus */
-+
-+/* PCI Bus Types */
-+#define SK_PCI_BUS BIT_0S /* normal PCI bus */
-+#define SK_PCIX_BUS BIT_1S /* PCI-X bus */
-+#define SK_PEX_BUS BIT_2S /* PCI-Express bus */
-
- /* Default receive frame limit for Workaround of XMAC Errata */
- #define SK_DEF_RX_WA_LIM SK_CONSTU64(100)
-
- /* values for GILedBlinkCtrl (LED Blink Control) */
--#define SK_ACT_LED_BLINK (1<<0) /* Active LED blinking */
--#define SK_DUP_LED_NORMAL (1<<1) /* Duplex LED normal */
--#define SK_LED_LINK100_ON (1<<2) /* Link 100M LED on */
-+#define SK_ACT_LED_BLINK BIT_0S /* Active LED blinking */
-+#define SK_DUP_LED_NORMAL BIT_1S /* Duplex LED normal */
-+#define SK_LED_LINK100_ON BIT_2S /* Link 100M LED on */
-+#define SK_DUAL_LED_ACT_LNK BIT_3S /* Dual LED ACT/LNK configuration */
-
- /* Link Partner Status */
- #define SK_LIPA_UNKNOWN 0 /* Link partner is in unknown state */
-@@ -290,18 +306,173 @@ extern "C" {
- /* Max. Auto-neg. timeouts before link detection in sense mode is reset */
- #define SK_MAX_ANEG_TO 10 /* Max. 10 times the sense mode is reset */
-
-+
-+/******************************************************************************
-+ *
-+ * HW_FEATURE() macro
-+ */
-+
-+/* DWORD 0: Features */
-+#define HWF_CLK_GATING_ENABLE 0x02000000UL /* Enable Clock Gating */
-+#define HWF_RED_CORE_CLK_SUP 0x01000000UL /* Reduced Core Clock supp. */
-+#define HWF_SYNC_TX_SUP 0x00800000UL /* Synch. Tx Queue available */
-+#define HWF_SINGLE_PORT_DEVICE 0x00400000UL /* Device has only one LAN IF */
-+#define HWF_JUMBO_FRAMES_SUP 0x00200000UL /* Jumbo Frames supported */
-+#define HWF_TX_TCP_CSUM_SUP 0x00100000UL /* TCP Tx checksum supported */
-+#define HWF_TX_UDP_CSUM_SUP 0x00080000UL /* UDP Tx checksum supported */
-+#define HWF_RX_CSUM_SUP 0x00040000UL /* RX checksum supported */
-+#define HWF_TCP_SEGM_SUP 0x00020000UL /* TCP segmentation supported */
-+#define HWF_RSS_HASH_SUP 0x00010000UL /* RSS Hash supported */
-+#define HWF_PORT_VLAN_SUP 0x00008000UL /* VLAN can be config per port*/
-+#define HWF_ROLE_PARAM_SUP 0x00004000UL /* Role parameter supported */
-+#define HWF_LOW_PMODE_SUP 0x00002000UL /* Low Power Mode supported */
-+#define HWF_ENERGIE_DEMO_SUP 0x00001000UL /* Energy Detect mode supp. */
-+#define HWF_SPEED1000_SUP 0x00000800UL /* Line Speed 1000 supported */
-+#define HWF_SPEED100_SUP 0x00000400UL /* Line Speed 100 supported */
-+#define HWF_SPEED10_SUP 0x00000200UL /* Line Speed 10 supported */
-+#define HWF_AUTONEGSENSE_SUP 0x00000100UL /* Autoneg Sense supported */
-+#define HWF_PHY_LOOPB_MD_SUP 0x00000080UL /* PHY loopback mode supp. */
-+#define HWF_ASF_SUP 0x00000040UL /* ASF support possible */
-+#define HWF_QS_STEPS_1KB 0x00000020UL /* The Rx/Tx queues can be */
-+ /* configured with 1 kB res. */
-+#define HWF_OWN_RAM_PER_PORT 0x00000010UL /* Each port has a separate */
-+ /* RAM buffer */
-+#define HWF_MIN_LED_IF 0x00000008UL /* Minimal LED interface */
-+ /* (e.g. for Yukon-EC) */
-+#define HWF_LIST_ELEMENTS_USED 0x00000004UL /* HW uses list elements */
-+ /* (otherwise desc. are used) */
-+#define HWF_GMAC_INSIDE 0x00000002UL /* Device contains GMAC */
-+#define HWF_TWSI_PRESENT 0x00000001UL /* TWSI sensor bus present */
-+
-+/*-RMV- DWORD 1: Deviations */
-+#define HWF_WA_DEV_4200 0x10200000UL /*-RMV- 4.200 (D3 Blue Screen)*/
-+#define HWF_WA_DEV_4185CS 0x10100000UL /*-RMV- 4.185 (ECU 100 CS cal)*/
-+#define HWF_WA_DEV_4185 0x10080000UL /*-RMV- 4.185 (ECU Tx h check)*/
-+#define HWF_WA_DEV_4167 0x10040000UL /*-RMV- 4.167 (Rx OvSize Hang)*/
-+#define HWF_WA_DEV_4152 0x10020000UL /*-RMV- 4.152 (RSS issue) */
-+#define HWF_WA_DEV_4115 0x10010000UL /*-RMV- 4.115 (Rx MAC FIFO) */
-+#define HWF_WA_DEV_4109 0x10008000UL /*-RMV- 4.109 (BIU hang) */
-+#define HWF_WA_DEV_483 0x10004000UL /*-RMV- 4.83 (Rx TCP wrong) */
-+#define HWF_WA_DEV_479 0x10002000UL /*-RMV- 4.79 (Rx BMU hang II) */
-+#define HWF_WA_DEV_472 0x10001000UL /*-RMV- 4.72 (GPHY2 MDC clk) */
-+#define HWF_WA_DEV_463 0x10000800UL /*-RMV- 4.63 (Rx BMU hang I) */
-+#define HWF_WA_DEV_427 0x10000400UL /*-RMV- 4.27 (Tx Done Rep) */
-+#define HWF_WA_DEV_42 0x10000200UL /*-RMV- 4.2 (pref unit burst) */
-+#define HWF_WA_DEV_46 0x10000100UL /*-RMV- 4.6 (CPU crash II) */
-+#define HWF_WA_DEV_43_418 0x10000080UL /*-RMV- 4.3 & 4.18 (PCI unexp */
-+ /*-RMV- compl&Stat BMU deadl) */
-+#define HWF_WA_DEV_420 0x10000040UL /*-RMV- 4.20 (Status BMU ov) */
-+#define HWF_WA_DEV_423 0x10000020UL /*-RMV- 4.23 (TCP Segm Hang) */
-+#define HWF_WA_DEV_424 0x10000010UL /*-RMV- 4.24 (MAC reg overwr) */
-+#define HWF_WA_DEV_425 0x10000008UL /*-RMV- 4.25 (Magic packet */
-+ /*-RMV- with odd offset) */
-+#define HWF_WA_DEV_428 0x10000004UL /*-RMV- 4.28 (Poll-U &BigEndi)*/
-+#define HWF_WA_FIFO_FLUSH_YLA0 0x10000002UL /*-RMV- dis Rx GMAC FIFO Flush*/
-+ /*-RMV- for Yu-L Rev. A0 only */
-+#define HWF_WA_COMA_MODE 0x10000001UL /*-RMV- Coma Mode WA req */
-+
-+/* DWORD 2: still unused */
-+/* DWORD 3: still unused */
-+
-+
-+/*
-+ * HW_FEATURE() - returns whether the feature is serviced or not
-+ */
-+#define HW_FEATURE(pAC, ReqFeature) \
-+ (((pAC)->GIni.HwF.Features[((ReqFeature) & 0x30000000UL) >> 28] &\
-+ ((ReqFeature) & 0x0fffffffUL)) != 0)
-+
-+#define HW_FEAT_LIST 0
-+#define HW_DEV_LIST 1
-+
-+#define SET_HW_FEATURE_MASK(pAC, List, OffMaskValue, OnMaskValue) { \
-+ if ((List) == HW_FEAT_LIST || (List) == HW_DEV_LIST) { \
-+ (pAC)->GIni.HwF.OffMask[List] = (OffMaskValue); \
-+ (pAC)->GIni.HwF.OnMask[List] = (OnMaskValue); \
-+ } \
-+}
-+
-+/* driver access macros for GIni structure ***********************************/
-+
-+#define CHIP_ID_YUKON_2(pAC) ((pAC)->GIni.GIYukon2)
-+
-+#define HW_SYNC_TX_SUPPORTED(pAC) \
-+ ((pAC)->GIni.GIChipId != CHIP_ID_YUKON_EC && \
-+ (pAC)->GIni.GIChipId != CHIP_ID_YUKON_FE && \
-+ (pAC)->GIni.GIChipId != CHIP_ID_YUKON_EC_U)
-+
-+#define HW_MS_TO_TICKS(pAC, MsTime) \
-+ ((MsTime) * (62500L/100) * (pAC)->GIni.GIHstClkFact)
-+
-+#ifdef XXX
-+/* still under construction */
-+#define HW_IS_SINGLE_PORT(pAC) ((pAC)->GIni.GIMacsFound == 1)
-+#define HW_NUMBER_OF_PORTS(pAC) ((pAC)->GIni.GIMacsFound)
-+
-+#define HW_TX_UDP_CSUM_SUPPORTED(pAC) \
-+ ((((pAC)->GIni.GIChipId >= CHIP_ID_YUKON) && ((pAC)->GIni.GIChipRev != 0))
-+
-+#define HW_DEFAULT_LINESPEED(pAC) \
-+ ((!(pAC)->GIni.GIGenesis && (pAC)->GIni.GICopperType) ? \
-+ SK_LSPEED_AUTO : SK_LSPEED_1000MBPS)
-+
-+#define HW_ROLE_PARAM_SUPPORTED(pAC) ((pAC)->GIni.GICopperType)
-+
-+#define HW_SPEED1000_SUPPORTED(pAC, Port) \
-+ ((pAC)->GIni.GP[Port].PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS)
-+
-+#define HW_SPEED100_SUPPORTED(pAC, Port) \
-+ ((pAC)->GIni.GP[Port].PLinkSpeedCap & SK_LSPEED_CAP_100MBPS)
-+
-+#define HW_SPEED10_SUPPORTED(pAC, Port) \
-+ ((pAC)->GIni.GP[Port].PLinkSpeedCap & SK_LSPEED_CAP_10MBPS)
-+
-+#define HW_AUTONEGSENSE_SUPPORTED(pAC) ((pAC)->GIni.GP[0].PhyType==SK_PHY_XMAC)
-+
-+#define HW_FREQ_TO_CARD_TICKS(pAC, AdapterClkSpeed, Freq) \
-+ (((AdapterClkSpeed / 100) * (pAC)->GIni.GIHstClkFact) / Freq)
-+
-+#define HW_IS_LINK_UP(pAC, Port) ((pAC)->GIni.GP[Port].PHWLinkUp)
-+#define HW_LINK_SPEED_USED(pAC, Port) ((pAC)->GIni.GP[Port].PLinkSpeedUsed)
-+#define HW_RAM_SIZE(pAC) ((pAC)->GIni.GIRamSize)
-+
-+#define HW_PHY_LP_MODE_SUPPORTED(pAC) (pAC0->???
-+#define HW_ASF_ACTIVE(pAC) ???
-+#define RAWIO_OUT32(pAC, pAC->RegIrqMask, pAC->GIni.GIValIrqMask)...
-+
-+/* macro to check whether Tx checksum is supported */
-+#define HW_TX_CSUM_SUPPORTED(pAC) ((pAC)->GIni.GIChipId != CHIP_ID_GENESIS)
-+
-+BMU_UDP_CHECK : BMU_TCP_CHECK;
-+
-+/* macro for - Own Bit mirrored to DWORD7 (Yukon LP receive descriptor) */
-+#endif /* 0 */
-+
-+
- /* structures *****************************************************************/
-
- /*
-+ * HW Feature structure
-+ */
-+typedef struct s_HwFeatures {
-+ SK_U32 Features[4]; /* Feature list */
-+ SK_U32 OffMask[4]; /* Off Mask */
-+ SK_U32 OnMask[4]; /* On Mask */
-+} SK_HW_FEATURES;
-+
-+/*
- * MAC specific functions
- */
- typedef struct s_GeMacFunc {
-- int (*pFnMacUpdateStats)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
-- int (*pFnMacStatistic)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
-- SK_U16 StatAddr, SK_U32 SK_FAR *pVal);
-- int (*pFnMacResetCounter)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
-- int (*pFnMacOverflow)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
-- SK_U16 IStatus, SK_U64 SK_FAR *pVal);
-+ int (*pFnMacUpdateStats)(SK_AC *, SK_IOC, unsigned int);
-+ int (*pFnMacStatistic)(SK_AC *, SK_IOC, unsigned int, SK_U16, SK_U32 SK_FAR *);
-+ int (*pFnMacResetCounter)(SK_AC *, SK_IOC, unsigned int);
-+ int (*pFnMacOverflow)(SK_AC *, SK_IOC, unsigned int, SK_U16, SK_U64 SK_FAR *);
-+ void (*pSkGeSirqIsr)(SK_AC *, SK_IOC, SK_U32);
-+#ifdef SK_DIAG
-+ int (*pFnMacPhyRead)(SK_AC *, SK_IOC, int, int, SK_U16 SK_FAR *);
-+ int (*pFnMacPhyWrite)(SK_AC *, SK_IOC, int, int, SK_U16);
-+#endif /* SK_DIAG */
- } SK_GEMACFUNC;
-
- /*
-@@ -311,7 +482,7 @@ typedef struct s_GePort {
- #ifndef SK_DIAG
- SK_TIMER PWaTimer; /* Workaround Timer */
- SK_TIMER HalfDupChkTimer;
--#endif /* SK_DIAG */
-+#endif /* !SK_DIAG */
- SK_U32 PPrevShorts; /* Previous Short Counter checking */
- SK_U32 PPrevFcs; /* Previous FCS Error Counter checking */
- SK_U64 PPrevRx; /* Previous RxOk Counter checking */
-@@ -335,6 +506,7 @@ typedef struct s_GePort {
- int PXaQOff; /* Asynchronous Tx Queue Address Offset */
- int PhyType; /* PHY used on this port */
- int PState; /* Port status (reset, stop, init, run) */
-+ int PPortUsage; /* Driver Port Usage */
- SK_U16 PhyId1; /* PHY Id1 on this port */
- SK_U16 PhyAddr; /* MDIO/MDC PHY address */
- SK_U16 PIsave; /* Saved Interrupt status word */
-@@ -367,7 +539,10 @@ typedef struct s_GePort {
- int PMacJamLen; /* MAC Jam length */
- int PMacJamIpgVal; /* MAC Jam IPG */
- int PMacJamIpgData; /* MAC IPG Jam to Data */
-+ int PMacBackOffLim; /* MAC Back-off Limit */
-+ int PMacDataBlind; /* MAC Data Blinder */
- int PMacIpgData; /* MAC Data IPG */
-+ SK_U16 PMacAddr[3]; /* MAC address */
- SK_BOOL PMacLimit4; /* reset collision counter and backoff algorithm */
- } SK_GEPORT;
-
-@@ -379,27 +554,37 @@ typedef struct s_GeInit {
- int GIChipId; /* Chip Identification Number */
- int GIChipRev; /* Chip Revision Number */
- SK_U8 GIPciHwRev; /* PCI HW Revision Number */
-+ SK_U8 GIPciBus; /* PCI Bus Type (PCI / PCI-X / PCI-Express) */
-+ SK_U8 GIPciMode; /* PCI / PCI-X Mode @ Clock */
-+ SK_U8 GIPexWidth; /* PCI-Express Negotiated Link Width */
- SK_BOOL GIGenesis; /* Genesis adapter ? */
-- SK_BOOL GIYukon; /* YUKON-A1/Bx chip */
-+ SK_BOOL GIYukon; /* YUKON family (1 and 2) */
- SK_BOOL GIYukonLite; /* YUKON-Lite chip */
-+ SK_BOOL GIYukon2; /* YUKON-2 chip (-XL, -EC or -FE) */
-+ SK_U8 GIConTyp; /* Connector Type */
-+ SK_U8 GIPmdTyp; /* PMD Type */
- SK_BOOL GICopperType; /* Copper Type adapter ? */
- SK_BOOL GIPciSlot64; /* 64-bit PCI Slot */
- SK_BOOL GIPciClock66; /* 66 MHz PCI Clock */
- SK_BOOL GIVauxAvail; /* VAUX available (YUKON) */
- SK_BOOL GIYukon32Bit; /* 32-Bit YUKON adapter */
-+ SK_BOOL GIAsfEnabled; /* ASF subsystem enabled */
-+ SK_BOOL GIAsfRunning; /* ASF subsystem running */
- SK_U16 GILedBlinkCtrl; /* LED Blink Control */
- int GIMacsFound; /* Number of MACs found on this adapter */
- int GIMacType; /* MAC Type used on this adapter */
-- int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */
-- int GIPortUsage; /* Driver Port Usage */
-+ int GIChipCap; /* Adapter's Capabilities */
-+ int GIHstClkFact; /* Host Clock Factor (HstClk / 62.5 * 100) */
- int GILevel; /* Initialization Level completed */
- int GIRamSize; /* The RAM size of the adapter in kB */
- int GIWolOffs; /* WOL Register Offset (HW-Bug in Rev. A) */
- SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */
- SK_U32 GIPollTimerVal; /* Descr. Poll Timer Init Val (HstClk ticks) */
- SK_U32 GIValIrqMask; /* Value for Interrupt Mask */
-+ SK_U32 GIValHwIrqMask; /* Value for Interrupt Mask */
- SK_U32 GITimeStampCnt; /* Time Stamp High Counter (YUKON only) */
- SK_GEPORT GP[SK_MAX_MACS];/* Port Dependent Information */
-+ SK_HW_FEATURES HwF; /* HW Features struct */
- SK_GEMACFUNC GIFunc; /* MAC depedent functions */
- } SK_GEINIT;
-
-@@ -417,7 +602,7 @@ typedef struct s_GeInit {
- #define SKERR_HWI_E005 (SKERR_HWI_E004+1)
- #define SKERR_HWI_E005MSG "SkGeInitPort(): cannot init running ports"
- #define SKERR_HWI_E006 (SKERR_HWI_E005+1)
--#define SKERR_HWI_E006MSG "SkGeMacInit(): PState does not match HW state"
-+#define SKERR_HWI_E006MSG "SkGeInit() called with illegal Chip Id"
- #define SKERR_HWI_E007 (SKERR_HWI_E006+1)
- #define SKERR_HWI_E007MSG "SkXmInitDupMd() called with invalid Dup Mode"
- #define SKERR_HWI_E008 (SKERR_HWI_E007+1)
-@@ -433,11 +618,11 @@ typedef struct s_GeInit {
- #define SKERR_HWI_E013 (SKERR_HWI_E012+1)
- #define SKERR_HWI_E013MSG "SkGeInitPort(): cfg changed for running queue"
- #define SKERR_HWI_E014 (SKERR_HWI_E013+1)
--#define SKERR_HWI_E014MSG "SkGeInitPort(): unknown GIPortUsage specified"
-+#define SKERR_HWI_E014MSG "SkGeInitPort(): unknown PortUsage specified"
- #define SKERR_HWI_E015 (SKERR_HWI_E014+1)
--#define SKERR_HWI_E015MSG "Illegal Link mode parameter"
-+#define SKERR_HWI_E015MSG "Illegal Link Mode parameter"
- #define SKERR_HWI_E016 (SKERR_HWI_E015+1)
--#define SKERR_HWI_E016MSG "Illegal Flow control mode parameter"
-+#define SKERR_HWI_E016MSG "Illegal Flow Control Mode parameter"
- #define SKERR_HWI_E017 (SKERR_HWI_E016+1)
- #define SKERR_HWI_E017MSG "Illegal value specified for GIPollTimerVal"
- #define SKERR_HWI_E018 (SKERR_HWI_E017+1)
-@@ -447,9 +632,9 @@ typedef struct s_GeInit {
- #define SKERR_HWI_E020 (SKERR_HWI_E019+1)
- #define SKERR_HWI_E020MSG "Illegal Master/Slave parameter"
- #define SKERR_HWI_E021 (SKERR_HWI_E020+1)
--#define SKERR_HWI_E021MSG "MacUpdateStats(): cannot update statistic counter"
--#define SKERR_HWI_E022 (SKERR_HWI_E021+1)
--#define SKERR_HWI_E022MSG "MacStatistic(): illegal statistic base address"
-+#define SKERR_HWI_E021MSG "MacUpdateStats(): cannot update statistic counter"
-+#define SKERR_HWI_E022 (SKERR_HWI_E021+1)
-+#define SKERR_HWI_E022MSG "MacStatistic(): illegal statistic base address"
- #define SKERR_HWI_E023 (SKERR_HWI_E022+1)
- #define SKERR_HWI_E023MSG "SkGeInitPort(): Transmit Queue Size too small"
- #define SKERR_HWI_E024 (SKERR_HWI_E023+1)
-@@ -464,6 +649,24 @@ typedef struct s_GeInit {
- /*
- * public functions in skgeinit.c
- */
-+extern void SkGePortVlan(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ int Port,
-+ SK_BOOL Enable);
-+
-+extern void SkGeRxRss(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ int Port,
-+ SK_BOOL Enable);
-+
-+extern void SkGeRxCsum(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ int Port,
-+ SK_BOOL Enable);
-+
- extern void SkGePollRxD(
- SK_AC *pAC,
- SK_IOC IoC,
-@@ -528,9 +731,14 @@ extern void SkGeInitRamIface(
-
- extern int SkGeInitAssignRamToQueues(
- SK_AC *pAC,
-- int ActivePort,
-+ int Port,
- SK_BOOL DualNet);
-
-+extern int SkYuk2RestartRxBmu(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ int Port);
-+
- /*
- * public functions in skxmac2.c
- */
-@@ -601,13 +809,13 @@ extern void SkMacAutoNegLipaPhy(
- int Port,
- SK_U16 IStatus);
-
--extern void SkMacSetRxTxEn(
-+extern void SkMacSetRxTxEn(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port,
- int Para);
-
--extern int SkMacRxTxEnable(
-+extern int SkMacRxTxEnable(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port);
-@@ -624,28 +832,28 @@ extern void SkMacHashing(
- int Port,
- SK_BOOL Enable);
-
--extern void SkXmPhyRead(
-+extern int SkXmPhyRead(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port,
- int Addr,
- SK_U16 SK_FAR *pVal);
-
--extern void SkXmPhyWrite(
-+extern int SkXmPhyWrite(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port,
- int Addr,
- SK_U16 Val);
-
--extern void SkGmPhyRead(
-+extern int SkGmPhyRead(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port,
- int Addr,
- SK_U16 SK_FAR *pVal);
-
--extern void SkGmPhyWrite(
-+extern int SkGmPhyWrite(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port,
-@@ -713,7 +921,7 @@ extern int SkXmOverflowStatus(
- SK_AC *pAC,
- SK_IOC IoC,
- unsigned int Port,
-- SK_U16 IStatus,
-+ SK_U16 IStatus,
- SK_U64 SK_FAR *pStatus);
-
- extern int SkGmOverflowStatus(
-@@ -729,6 +937,7 @@ extern int SkGmCableDiagStatus(
- int Port,
- SK_BOOL StartTest);
-
-+#ifdef SK_PHY_LP_MODE
- extern int SkGmEnterLowPowerMode(
- SK_AC *pAC,
- SK_IOC IoC,
-@@ -739,6 +948,7 @@ extern int SkGmLeaveLowPowerMode(
- SK_AC *pAC,
- SK_IOC IoC,
- int Port);
-+#endif /* SK_PHY_LP_MODE */
-
- #ifdef SK_DIAG
- extern void SkGePhyRead(
-@@ -794,31 +1004,35 @@ extern int SkGeInitPort();
- extern void SkGeXmitLED();
- extern void SkGeInitRamIface();
- extern int SkGeInitAssignRamToQueues();
-+extern void SkGePortVlan();
-+extern void SkGeRxCsum();
-+extern void SkGeRxRss();
-+extern int SkYuk2RestartRxBmu();
-
- /*
- * public functions in skxmac2.c
- */
--extern void SkMacRxTxDisable();
-+extern void SkMacRxTxDisable();
- extern void SkMacSoftRst();
- extern void SkMacHardRst();
- extern void SkMacClearRst();
--extern void SkMacInitPhy();
--extern int SkMacRxTxEnable();
--extern void SkMacPromiscMode();
--extern void SkMacHashing();
--extern void SkMacIrqDisable();
-+extern void SkMacInitPhy();
-+extern int SkMacRxTxEnable();
-+extern void SkMacPromiscMode();
-+extern void SkMacHashing();
-+extern void SkMacIrqDisable();
- extern void SkMacFlushTxFifo();
- extern void SkMacFlushRxFifo();
- extern void SkMacIrq();
- extern int SkMacAutoNegDone();
- extern void SkMacAutoNegLipaPhy();
--extern void SkMacSetRxTxEn();
-+extern void SkMacSetRxTxEn();
- extern void SkXmInitMac();
--extern void SkXmPhyRead();
--extern void SkXmPhyWrite();
-+extern int SkXmPhyRead();
-+extern int SkXmPhyWrite();
- extern void SkGmInitMac();
--extern void SkGmPhyRead();
--extern void SkGmPhyWrite();
-+extern int SkGmPhyRead();
-+extern int SkGmPhyWrite();
- extern void SkXmClrExactAddr();
- extern void SkXmInitDupMd();
- extern void SkXmInitPauseMd();
-@@ -832,8 +1046,10 @@ extern int SkGmResetCounter();
- extern int SkXmOverflowStatus();
- extern int SkGmOverflowStatus();
- extern int SkGmCableDiagStatus();
-+#ifdef SK_PHY_LP_MODE
- extern int SkGmEnterLowPowerMode();
- extern int SkGmLeaveLowPowerMode();
-+#endif /* SK_PHY_LP_MODE */
-
- #ifdef SK_DIAG
- extern void SkGePhyRead();
-@@ -844,10 +1060,11 @@ extern void SkMacTimeStamp();
- extern void SkXmSendCont();
- #endif /* SK_DIAG */
-
--#endif /* SK_KR_PROTO */
-+#endif /* SK_KR_PROTO */
-
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
-
- #endif /* __INC_SKGEINIT_H_ */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgepnm2.h ./drivers/net/sk98lin/h/skgepnm2.h
---- ./drivers/net/sk98lin.sk98/h/skgepnm2.h 2004-10-19 01:54:38.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgepnm2.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skgepnm2.h
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.36 $
-- * Date: $Date: 2003/05/23 12:45:13 $
-+ * Version: $Revision: 2.4 $
-+ * Date: $Date: 2005/05/03 06:42:43 $
- * Purpose: Defines for Private Network Management Interface
- *
- ****************************************************************************/
-@@ -28,8 +28,13 @@
- /*
- * General definitions
- */
--#define SK_PNMI_CHIPSET_XMAC 1 /* XMAC11800FP */
--#define SK_PNMI_CHIPSET_YUKON 2 /* YUKON */
-+#define SK_PNMI_CHIPSET_XMAC 1 /* XMAC11800FP */
-+#define SK_PNMI_CHIPSET_YUKON 2 /* YUKON */
-+#define SK_PNMI_CHIPSET_YUKON_LITE 3 /* YUKON-Lite (Rev. A1-A3) */
-+#define SK_PNMI_CHIPSET_YUKON_LP 4 /* YUKON-LP */
-+#define SK_PNMI_CHIPSET_YUKON_XL 5 /* YUKON-2 XL */
-+#define SK_PNMI_CHIPSET_YUKON_EC 6 /* YUKON-2 EC */
-+#define SK_PNMI_CHIPSET_YUKON_FE 7 /* YUKON-2 FE */
-
- #define SK_PNMI_BUS_PCI 1 /* PCI bus*/
-
-@@ -70,9 +75,9 @@
- /*
- * VCT internal status values
- */
--#define SK_PNMI_VCT_PENDING 32
--#define SK_PNMI_VCT_TEST_DONE 64
--#define SK_PNMI_VCT_LINK 128
-+#define SK_PNMI_VCT_PENDING 0x20
-+#define SK_PNMI_VCT_TEST_DONE 0x40
-+#define SK_PNMI_VCT_LINK 0x80
-
- /*
- * Internal table definitions
-@@ -323,7 +328,7 @@ typedef struct s_PnmiStatAddr {
- vSt, \
- pAC->Pnmi.MacUpdatedFlag, \
- pAC->Pnmi.RlmtUpdatedFlag, \
-- pAC->Pnmi.SirqUpdatedFlag))}}
-+ pAC->Pnmi.SirqUpdatedFlag));}}
-
- #else /* !DEBUG */
-
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgepnmi.h ./drivers/net/sk98lin/h/skgepnmi.h
---- ./drivers/net/sk98lin.sk98/h/skgepnmi.h 2004-10-19 01:53:13.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgepnmi.h 2006-08-31 14:59:52.000000000 +0400
-@@ -1,9 +1,9 @@
- /*****************************************************************************
- *
- * Name: skgepnmi.h
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.62 $
-- * Date: $Date: 2003/08/15 12:31:52 $
-+ * Project: Gigabit Ethernet Adapters, PNMI-Module
-+ * Version: $Revision: 2.11 $
-+ * Date: $Date: 2005/08/09 09:02:12 $
- * Purpose: Defines for Private Network Management Interface
- *
- ****************************************************************************/
-@@ -31,7 +31,7 @@
- #include "h/sktypes.h"
- #include "h/skerror.h"
- #include "h/sktimer.h"
--#include "h/ski2c.h"
-+#include "h/sktwsi.h"
- #include "h/skaddr.h"
- #include "h/skrlmt.h"
- #include "h/skvpd.h"
-@@ -41,7 +41,6 @@
- */
- #define SK_PNMI_MDB_VERSION 0x00030001 /* 3.1 */
-
--
- /*
- * Event definitions
- */
-@@ -54,16 +53,13 @@
- #define SK_PNMI_EVT_UTILIZATION_TIMER 7 /* Timer event for Utiliza. */
- #define SK_PNMI_EVT_CLEAR_COUNTER 8 /* Clear statistic counters */
- #define SK_PNMI_EVT_XMAC_RESET 9 /* XMAC will be reset */
--
- #define SK_PNMI_EVT_RLMT_PORT_UP 10 /* Port came logically up */
- #define SK_PNMI_EVT_RLMT_PORT_DOWN 11 /* Port went logically down */
- #define SK_PNMI_EVT_RLMT_SEGMENTATION 13 /* Two SP root bridges found */
- #define SK_PNMI_EVT_RLMT_ACTIVE_DOWN 14 /* Port went logically down */
- #define SK_PNMI_EVT_RLMT_ACTIVE_UP 15 /* Port came logically up */
--#define SK_PNMI_EVT_RLMT_SET_NETS 16 /* 1. Parameter is number of nets
-- 1 = single net; 2 = dual net */
--#define SK_PNMI_EVT_VCT_RESET 17 /* VCT port reset timer event started with SET. */
--
-+#define SK_PNMI_EVT_RLMT_SET_NETS 16 /* Number of nets (1 or 2). */
-+#define SK_PNMI_EVT_VCT_RESET 17 /* VCT port reset timer event started with SET. */
-
- /*
- * Return values
-@@ -78,7 +74,6 @@
- #define SK_PNMI_ERR_UNKNOWN_NET 7
- #define SK_PNMI_ERR_NOT_SUPPORTED 10
-
--
- /*
- * Return values of driver reset function SK_DRIVER_RESET() and
- * driver event function SK_DRIVER_EVENT()
-@@ -86,19 +81,17 @@
- #define SK_PNMI_ERR_OK 0
- #define SK_PNMI_ERR_FAIL 1
-
--
- /*
- * Return values of driver test function SK_DRIVER_SELFTEST()
- */
- #define SK_PNMI_TST_UNKNOWN (1 << 0)
--#define SK_PNMI_TST_TRANCEIVER (1 << 1)
-+#define SK_PNMI_TST_TRANCEIVER (1 << 1)
- #define SK_PNMI_TST_ASIC (1 << 2)
- #define SK_PNMI_TST_SENSOR (1 << 3)
--#define SK_PNMI_TST_POWERMGMT (1 << 4)
-+#define SK_PNMI_TST_POWERMGMT (1 << 4)
- #define SK_PNMI_TST_PCI (1 << 5)
- #define SK_PNMI_TST_MAC (1 << 6)
-
--
- /*
- * RLMT specific definitions
- */
-@@ -223,7 +216,17 @@
- #define OID_SKGE_RLMT_PORT_NUMBER 0xFF010141
- #define OID_SKGE_RLMT_PORT_ACTIVE 0xFF010142
- #define OID_SKGE_RLMT_PORT_PREFERRED 0xFF010143
--#define OID_SKGE_INTERMEDIATE_SUPPORT 0xFF010160
-+
-+#define OID_SKGE_RLMT_MONITOR_NUMBER 0xFF010150
-+#define OID_SKGE_RLMT_MONITOR_INDEX 0xFF010151
-+#define OID_SKGE_RLMT_MONITOR_ADDR 0xFF010152
-+#define OID_SKGE_RLMT_MONITOR_ERRS 0xFF010153
-+#define OID_SKGE_RLMT_MONITOR_TIMESTAMP 0xFF010154
-+#define OID_SKGE_RLMT_MONITOR_ADMIN 0xFF010155
-+
-+#define OID_SKGE_INTERMEDIATE_SUPPORT 0xFF010160
-+#define OID_SKGE_SET_TEAM_MAC_ADDRESS 0xFF010161
-+#define OID_SKGE_DEVICE_INFORMATION 0xFF010162
-
- #define OID_SKGE_SPEED_CAP 0xFF010170
- #define OID_SKGE_SPEED_MODE 0xFF010171
-@@ -322,13 +325,6 @@
- #define OID_SKGE_RLMT_TX_SP_REQ_CTS 0xFF020168
- #define OID_SKGE_RLMT_RX_SP_CTS 0xFF020169
-
--#define OID_SKGE_RLMT_MONITOR_NUMBER 0xFF010150
--#define OID_SKGE_RLMT_MONITOR_INDEX 0xFF010151
--#define OID_SKGE_RLMT_MONITOR_ADDR 0xFF010152
--#define OID_SKGE_RLMT_MONITOR_ERRS 0xFF010153
--#define OID_SKGE_RLMT_MONITOR_TIMESTAMP 0xFF010154
--#define OID_SKGE_RLMT_MONITOR_ADMIN 0xFF010155
--
- #define OID_SKGE_TX_SW_QUEUE_LEN 0xFF020170
- #define OID_SKGE_TX_SW_QUEUE_MAX 0xFF020171
- #define OID_SKGE_TX_RETRY 0xFF020172
-@@ -352,6 +348,7 @@
- #define OID_SKGE_VCT_GET 0xFF020200
- #define OID_SKGE_VCT_SET 0xFF020201
- #define OID_SKGE_VCT_STATUS 0xFF020202
-+#define OID_SKGE_VCT_CAPABILITIES 0xFF020203
-
- #ifdef SK_DIAG_SUPPORT
- /* Defines for driver DIAG mode. */
-@@ -367,22 +364,79 @@
- #define OID_SKGE_PHY_TYPE 0xFF020215
- #define OID_SKGE_PHY_LP_MODE 0xFF020216
-
-+/*
-+ * Added for new DualNet IM driver V2
-+ * these OIDs should later be in pnmi.h
-+ */
-+#define OID_SKGE_MAC_COUNT 0xFF020217
-+#define OID_SKGE_DUALNET_MODE 0xFF020218
-+#define OID_SKGE_SET_TAGHEADER 0xFF020219
-+
-+#ifdef SK_ASF
-+/* Defines for ASF */
-+#define OID_SKGE_ASF 0xFF02021a
-+#define OID_SKGE_ASF_STORE_CONFIG 0xFF02021b
-+#define OID_SKGE_ASF_ENA 0xFF02021c
-+#define OID_SKGE_ASF_RETRANS 0xFF02021d
-+#define OID_SKGE_ASF_RETRANS_INT 0xFF02021e
-+#define OID_SKGE_ASF_HB_ENA 0xFF02021f
-+#define OID_SKGE_ASF_HB_INT 0xFF020220
-+#define OID_SKGE_ASF_WD_ENA 0xFF020221
-+#define OID_SKGE_ASF_WD_TIME 0xFF020222
-+#define OID_SKGE_ASF_IP_SOURCE 0xFF020223
-+#define OID_SKGE_ASF_MAC_SOURCE 0xFF020224
-+#define OID_SKGE_ASF_IP_DEST 0xFF020225
-+#define OID_SKGE_ASF_MAC_DEST 0xFF020226
-+#define OID_SKGE_ASF_COMMUNITY_NAME 0xFF020227
-+#define OID_SKGE_ASF_RSP_ENA 0xFF020228
-+#define OID_SKGE_ASF_RETRANS_COUNT_MIN 0xFF020229
-+#define OID_SKGE_ASF_RETRANS_COUNT_MAX 0xFF02022a
-+#define OID_SKGE_ASF_RETRANS_INT_MIN 0xFF02022b
-+#define OID_SKGE_ASF_RETRANS_INT_MAX 0xFF02022c
-+#define OID_SKGE_ASF_HB_INT_MIN 0xFF02022d
-+#define OID_SKGE_ASF_HB_INT_MAX 0xFF02022e
-+#define OID_SKGE_ASF_WD_TIME_MIN 0xFF02022f
-+#define OID_SKGE_ASF_WD_TIME_MAX 0xFF020230
-+#define OID_SKGE_ASF_HB_CAP 0xFF020231
-+#define OID_SKGE_ASF_WD_TIMER_RES 0xFF020232
-+#define OID_SKGE_ASF_GUID 0xFF020233
-+#define OID_SKGE_ASF_KEY_OP 0xFF020234
-+#define OID_SKGE_ASF_KEY_ADM 0xFF020235
-+#define OID_SKGE_ASF_KEY_GEN 0xFF020236
-+#define OID_SKGE_ASF_CAP 0xFF020237
-+#define OID_SKGE_ASF_PAR_1 0xFF020238
-+#define OID_SKGE_ASF_OVERALL_OID 0xFF020239
-+#endif /* SK_ASF */
-+
-+
-+// Defined for yukon2 path only
-+#define OID_SKGE_UPPER_MINIPORT 0xFF02023D
-+
-+
-+#ifdef SK_ASF
-+/* Defines for ASF */
-+#define OID_SKGE_ASF_FWVER_OID 0xFF020240
-+#define OID_SKGE_ASF_ACPI_OID 0xFF020241
-+#define OID_SKGE_ASF_SMBUS_OID 0xFF020242
-+#endif /* SK_ASF */
-+
-+
- /* VCT struct to store a backup copy of VCT data after a port reset. */
- typedef struct s_PnmiVct {
- SK_U8 VctStatus;
-- SK_U8 PCableLen;
-- SK_U32 PMdiPairLen[4];
-- SK_U8 PMdiPairSts[4];
-+ SK_U8 CableLen;
-+ SK_U32 MdiPairLen[4];
-+ SK_U8 MdiPairSts[4];
- } SK_PNMI_VCT;
-
-
- /* VCT status values (to be given to CPA via OID_SKGE_VCT_STATUS). */
--#define SK_PNMI_VCT_NONE 0
--#define SK_PNMI_VCT_OLD_VCT_DATA 1
--#define SK_PNMI_VCT_NEW_VCT_DATA 2
--#define SK_PNMI_VCT_OLD_DSP_DATA 4
--#define SK_PNMI_VCT_NEW_DSP_DATA 8
--#define SK_PNMI_VCT_RUNNING 16
-+#define SK_PNMI_VCT_NONE 0x00
-+#define SK_PNMI_VCT_OLD_VCT_DATA 0x01
-+#define SK_PNMI_VCT_NEW_VCT_DATA 0x02
-+#define SK_PNMI_VCT_OLD_DSP_DATA 0x04
-+#define SK_PNMI_VCT_NEW_DSP_DATA 0x08
-+#define SK_PNMI_VCT_RUNNING 0x10
-
-
- /* VCT cable test status. */
-@@ -390,7 +444,12 @@ typedef struct s_PnmiVct {
- #define SK_PNMI_VCT_SHORT_CABLE 1
- #define SK_PNMI_VCT_OPEN_CABLE 2
- #define SK_PNMI_VCT_TEST_FAIL 3
--#define SK_PNMI_VCT_IMPEDANCE_MISMATCH 4
-+#define SK_PNMI_VCT_IMPEDANCE_MISMATCH 4
-+#define SK_PNMI_VCT_NOT_PRESENT 5
-+
-+/* VCT capabilities (needed for OID_SKGE_VCT_CAPABILITIES. */
-+#define SK_PNMI_VCT_SUPPORTED 1
-+#define SK_PNMI_VCT_NOT_SUPPORTED 0
-
- #define OID_SKGE_TRAP_SEN_WAR_LOW 500
- #define OID_SKGE_TRAP_SEN_WAR_UPP 501
-@@ -419,7 +478,6 @@ typedef struct s_PnmiVct {
- #define SK_SET_FULL_MIB 5
- #define SK_PRESET_FULL_MIB 6
-
--
- /*
- * Define error numbers and messages for syslog
- */
-@@ -452,7 +510,7 @@ typedef struct s_PnmiVct {
- #define SK_PNMI_ERR014 (SK_ERRBASE_PNMI + 14)
- #define SK_PNMI_ERR014MSG "Vpd: Cannot read VPD keys"
- #define SK_PNMI_ERR015 (SK_ERRBASE_PNMI + 15)
--#define SK_PNMI_ERR015MSG "Vpd: Internal array for VPD keys to small"
-+#define SK_PNMI_ERR015MSG "Vpd: Internal array for VPD keys too small"
- #define SK_PNMI_ERR016 (SK_ERRBASE_PNMI + 16)
- #define SK_PNMI_ERR016MSG "Vpd: Key string too long"
- #define SK_PNMI_ERR017 (SK_ERRBASE_PNMI + 17)
-@@ -494,9 +552,9 @@ typedef struct s_PnmiVct {
- #define SK_PNMI_ERR036 (SK_ERRBASE_PNMI + 36)
- #define SK_PNMI_ERR036MSG ""
- #define SK_PNMI_ERR037 (SK_ERRBASE_PNMI + 37)
--#define SK_PNMI_ERR037MSG "Rlmt: SK_RLMT_MODE_CHANGE event return not 0"
-+#define SK_PNMI_ERR037MSG "Rlmt: SK_RLMT_MODE_CHANGE event returned not 0"
- #define SK_PNMI_ERR038 (SK_ERRBASE_PNMI + 38)
--#define SK_PNMI_ERR038MSG "Rlmt: SK_RLMT_PREFPORT_CHANGE event return not 0"
-+#define SK_PNMI_ERR038MSG "Rlmt: SK_RLMT_PREFPORT_CHANGE event returned not 0"
- #define SK_PNMI_ERR039 (SK_ERRBASE_PNMI + 39)
- #define SK_PNMI_ERR039MSG "RlmtStat: Unknown OID"
- #define SK_PNMI_ERR040 (SK_ERRBASE_PNMI + 40)
-@@ -514,9 +572,9 @@ typedef struct s_PnmiVct {
- #define SK_PNMI_ERR046 (SK_ERRBASE_PNMI + 46)
- #define SK_PNMI_ERR046MSG "Monitor: Unknown OID"
- #define SK_PNMI_ERR047 (SK_ERRBASE_PNMI + 47)
--#define SK_PNMI_ERR047MSG "SirqUpdate: Event function returns not 0"
-+#define SK_PNMI_ERR047MSG "SirqUpdate: Event function returned not 0"
- #define SK_PNMI_ERR048 (SK_ERRBASE_PNMI + 48)
--#define SK_PNMI_ERR048MSG "RlmtUpdate: Event function returns not 0"
-+#define SK_PNMI_ERR048MSG "RlmtUpdate: Event function returned not 0"
- #define SK_PNMI_ERR049 (SK_ERRBASE_PNMI + 49)
- #define SK_PNMI_ERR049MSG "SkPnmiInit: Invalid size of 'CounterOffset' struct!!"
- #define SK_PNMI_ERR050 (SK_ERRBASE_PNMI + 50)
-@@ -826,23 +884,25 @@ typedef struct s_PnmiStrucData {
- } SK_PNMI_STRUCT_DATA;
-
- #define SK_PNMI_STRUCT_SIZE (sizeof(SK_PNMI_STRUCT_DATA))
-+
-+/* The ReturnStatus field must be located before VpdFreeBytes! */
- #define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)(SK_UPTR)\
- &(((SK_PNMI_STRUCT_DATA *)0)->VpdFreeBytes))
-- /*
-- * ReturnStatus field
-- * must be located
-- * before VpdFreeBytes
-- */
-
- /*
- * Various definitions
- */
-+#define SK_PNMI_EVT_TIMER_CHECK 28125000L /* 28125 ms */
-+
-+#define SK_PNMI_VCT_TIMER_CHECK 4000000L /* 4 sec. */
-+
- #define SK_PNMI_MAX_PROTOS 3
-
--#define SK_PNMI_CNT_NO 66 /* Must have the value of the enum
-- * SK_PNMI_MAX_IDX. Define SK_PNMI_CHECK
-- * for check while init phase 1
-- */
-+/*
-+ * SK_PNMI_CNT_NO must have the value of the enum SK_PNMI_MAX_IDX.
-+ * Define SK_PNMI_CHECK to check this during init level SK_INIT_IO.
-+ */
-+#define SK_PNMI_CNT_NO 66
-
- /*
- * Estimate data structure
-@@ -856,14 +916,6 @@ typedef struct s_PnmiEstimate {
-
-
- /*
-- * VCT timer data structure
-- */
--typedef struct s_VctTimer {
-- SK_TIMER VctTimer;
--} SK_PNMI_VCT_TIMER;
--
--
--/*
- * PNMI specific adapter context structure
- */
- typedef struct s_PnmiPort {
-@@ -933,12 +985,13 @@ typedef struct s_PnmiData {
- unsigned int TrapQueueEnd;
- unsigned int TrapBufPad;
- unsigned int TrapUnique;
-- SK_U8 VctStatus[SK_MAX_MACS];
-- SK_PNMI_VCT VctBackup[SK_MAX_MACS];
-- SK_PNMI_VCT_TIMER VctTimeout[SK_MAX_MACS];
-+ SK_U8 VctStatus[SK_MAX_MACS];
-+ SK_PNMI_VCT VctBackup[SK_MAX_MACS];
-+ SK_TIMER VctTimeout[SK_MAX_MACS];
- #ifdef SK_DIAG_SUPPORT
- SK_U32 DiagAttached;
- #endif /* SK_DIAG_SUPPORT */
-+ SK_BOOL VpdKeyReadError;
- } SK_PNMI;
-
-
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgesirq.h ./drivers/net/sk98lin/h/skgesirq.h
---- ./drivers/net/sk98lin.sk98/h/skgesirq.h 2004-10-19 01:55:17.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skgesirq.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgesirq.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.30 $
-- * Date: $Date: 2003/07/04 12:34:13 $
-- * Purpose: SK specific Gigabit Ethernet special IRQ functions
-+ * Version: $Revision: 2.5 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
-+ * Purpose: Gigabit Ethernet special IRQ functions
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -26,9 +27,9 @@
- #define _INC_SKGESIRQ_H_
-
- /* Define return codes of SkGePortCheckUp and CheckShort */
--#define SK_HW_PS_NONE 0 /* No action needed */
--#define SK_HW_PS_RESTART 1 /* Restart needed */
--#define SK_HW_PS_LINK 2 /* Link Up actions needed */
-+#define SK_HW_PS_NONE 0 /* No action needed */
-+#define SK_HW_PS_RESTART 1 /* Restart needed */
-+#define SK_HW_PS_LINK 2 /* Link Up actions needed */
-
- /*
- * Define the Event the special IRQ/INI module can handle
-@@ -44,10 +45,10 @@
- #define SK_HWEV_SET_SPEED 9 /* Set Link Speed by PNMI */
- #define SK_HWEV_HALFDUP_CHK 10 /* Half Duplex Hangup Workaround */
-
--#define SK_WA_ACT_TIME (5000000UL) /* 5 sec */
--#define SK_WA_INA_TIME (100000UL) /* 100 msec */
-+#define SK_WA_ACT_TIME 1000000UL /* 1000 msec (1 sec) */
-+#define SK_WA_INA_TIME 100000UL /* 100 msec */
-
--#define SK_HALFDUP_CHK_TIME (10000UL) /* 10 msec */
-+#define SK_HALFDUP_CHK_TIME 10000UL /* 10 msec */
-
- /*
- * Define the error numbers and messages
-@@ -75,9 +76,9 @@
- #define SKERR_SIRQ_E011 (SKERR_SIRQ_E010+1)
- #define SKERR_SIRQ_E011MSG "CHECK failure XA2"
- #define SKERR_SIRQ_E012 (SKERR_SIRQ_E011+1)
--#define SKERR_SIRQ_E012MSG "unexpected IRQ Master error"
-+#define SKERR_SIRQ_E012MSG "Unexpected IRQ Master error"
- #define SKERR_SIRQ_E013 (SKERR_SIRQ_E012+1)
--#define SKERR_SIRQ_E013MSG "unexpected IRQ Status error"
-+#define SKERR_SIRQ_E013MSG "Unexpected IRQ Status error"
- #define SKERR_SIRQ_E014 (SKERR_SIRQ_E013+1)
- #define SKERR_SIRQ_E014MSG "Parity error on RAM (read)"
- #define SKERR_SIRQ_E015 (SKERR_SIRQ_E014+1)
-@@ -102,10 +103,35 @@
- #define SKERR_SIRQ_E024MSG "FIFO overflow error"
- #define SKERR_SIRQ_E025 (SKERR_SIRQ_E024+1)
- #define SKERR_SIRQ_E025MSG "2 Pair Downshift detected"
-+#define SKERR_SIRQ_E026 (SKERR_SIRQ_E025+1)
-+#define SKERR_SIRQ_E026MSG "Uncorrectable PCI Express error"
-+#define SKERR_SIRQ_E027 (SKERR_SIRQ_E026+1)
-+#define SKERR_SIRQ_E027MSG "PCI Bus Abort detected"
-+#define SKERR_SIRQ_E028 (SKERR_SIRQ_E027+1)
-+#define SKERR_SIRQ_E028MSG "Parity error on RAM 1 (read)"
-+#define SKERR_SIRQ_E029 (SKERR_SIRQ_E028+1)
-+#define SKERR_SIRQ_E029MSG "Parity error on RAM 1 (write)"
-+#define SKERR_SIRQ_E030 (SKERR_SIRQ_E029+1)
-+#define SKERR_SIRQ_E030MSG "Parity error on RAM 2 (read)"
-+#define SKERR_SIRQ_E031 (SKERR_SIRQ_E030+1)
-+#define SKERR_SIRQ_E031MSG "Parity error on RAM 2 (write)"
-+#define SKERR_SIRQ_E032 (SKERR_SIRQ_E031+1)
-+#define SKERR_SIRQ_E032MSG "TCP segmentation error async. queue 1"
-+#define SKERR_SIRQ_E033 (SKERR_SIRQ_E032+1)
-+#define SKERR_SIRQ_E033MSG "TCP segmentation error sync. queue 1"
-+#define SKERR_SIRQ_E034 (SKERR_SIRQ_E033+1)
-+#define SKERR_SIRQ_E034MSG "TCP segmentation error async. queue 2"
-+#define SKERR_SIRQ_E035 (SKERR_SIRQ_E034+1)
-+#define SKERR_SIRQ_E035MSG "TCP segmentation error sync. queue 2"
-+#define SKERR_SIRQ_E036 (SKERR_SIRQ_E035+1)
-+#define SKERR_SIRQ_E036MSG "CHECK failure polling unit"
-
- extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus);
- extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
- extern void SkHWLinkUp(SK_AC *pAC, SK_IOC IoC, int Port);
- extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port);
-+extern void SkGeYuSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus);
-+extern void SkYuk2SirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus);
-
- #endif /* _INC_SKGESIRQ_H_ */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skgetwsi.h ./drivers/net/sk98lin/h/skgetwsi.h
---- ./drivers/net/sk98lin.sk98/h/skgetwsi.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/h/skgetwsi.h 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,241 @@
-+/******************************************************************************
-+ *
-+ * Name: skgetwsi.h
-+ * Project: Gigabit Ethernet Adapters, TWSI-Module
-+ * Version: $Revision: 1.7 $
-+ * Date: $Date: 2004/12/20 14:48:51 $
-+ * Purpose: Special defines for TWSI
-+ *
-+ ******************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * (C)Copyright 1998-2002 SysKonnect.
-+ * (C)Copyright 2002-2004 Marvell.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ * The information in this file is provided "AS IS" without warranty.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * SKGETWSI.H contains all SK-98xx specific defines for the TWSI handling
-+ */
-+
-+#ifndef _INC_SKGETWSI_H_
-+#define _INC_SKGETWSI_H_
-+
-+/*
-+ * Macros to access the B2_I2C_CTRL
-+ */
-+#define SK_I2C_CTL(IoC, flag, dev, dev_size, reg, burst) \
-+ SK_OUT32(IoC, B2_I2C_CTRL,\
-+ (flag ? 0x80000000UL : 0x0L) | \
-+ (((SK_U32)reg << 16) & I2C_ADDR) | \
-+ (((SK_U32)dev << 9) & I2C_DEV_SEL) | \
-+ (dev_size & I2C_DEV_SIZE) | \
-+ ((burst << 4) & I2C_BURST_LEN))
-+
-+#define SK_I2C_STOP(IoC) { \
-+ SK_U32 I2cCtrl; \
-+ SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
-+ SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
-+}
-+
-+#define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
-+
-+/*
-+ * Macros to access the TWSI SW Registers
-+ */
-+#define SK_I2C_SET_BIT(IoC, SetBits) { \
-+ SK_U8 OrgBits; \
-+ SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
-+ SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
-+}
-+
-+#define SK_I2C_CLR_BIT(IoC, ClrBits) { \
-+ SK_U8 OrgBits; \
-+ SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
-+ SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
-+}
-+
-+#define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
-+
-+/*
-+ * define the possible sensor states
-+ */
-+#define SK_SEN_IDLE 0 /* Idle: sensor not read */
-+#define SK_SEN_VALUE 1 /* Value Read cycle */
-+#define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
-+
-+/*
-+ * Conversion factor to convert read Voltage sensor to milli Volt
-+ * Conversion factor to convert read Temperature sensor to 10th degree Celsius
-+ */
-+#define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
-+#define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
-+#define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for ext. val. */
-+
-+/*
-+ * formula: counter = (22500*60)/(rpm * divisor * pulses/2)
-+ * assuming: 6500rpm, 4 pulses, divisor 1
-+ */
-+#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
-+
-+/*
-+ * Define sensor management data
-+ * Maximum is reached on Genesis copper dual port and Yukon-64
-+ * Board specific maximum is in pAC->I2c.MaxSens
-+ */
-+#define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
-+#define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
-+
-+/*
-+ * To watch the state machine (SM) use the timer in two ways
-+ * instead of one as hitherto
-+ */
-+#define SK_TIMER_WATCH_SM 0 /* Watch the SM to finish in a spec. time */
-+#define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
-+
-+/*
-+ * Defines for the individual thresholds
-+ */
-+
-+#define C_PLUS_20 120 / 100
-+#define C_PLUS_15 115 / 100
-+#define C_PLUS_10 110 / 100
-+#define C_PLUS_5 105 / 100
-+#define C_MINUS_5 95 / 100
-+#define C_MINUS_10 90 / 100
-+#define C_MINUS_15 85 / 100
-+
-+/* Temperature sensor */
-+#define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
-+#define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
-+#define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
-+#define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
-+
-+/* VCC which should be 5 V */
-+#define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
-+#define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
-+#define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
-+#define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
-+
-+/*
-+ * VIO may be 5 V or 3.3 V. Initialization takes two parts:
-+ * 1. Initialize lowest lower limit and highest higher limit.
-+ * 2. After the first value is read correct the upper or the lower limit to
-+ * the appropriate C constant.
-+ *
-+ * Warning limits are +-5% of the exepected voltage.
-+ * Error limits are +-10% of the expected voltage.
-+ */
-+
-+/* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
-+
-+#define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
-+#define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
-+ /* 5000 mVolt */
-+#define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
-+#define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
-+
-+#define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
-+
-+/* correction values for the second pass */
-+#define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
-+#define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
-+ /* 3300 mVolt */
-+#define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
-+#define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
-+
-+/*
-+ * VDD voltage
-+ */
-+#define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
-+#define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
-+#define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
-+#define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
-+
-+/*
-+ * PHY PLL 3V3 voltage
-+ */
-+#define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
-+#define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
-+#define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
-+#define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
-+
-+/*
-+ * VAUX (YUKON only)
-+ */
-+#define SK_SEN_VAUX_3V3_VAL 3300 /* Voltage VAUX 3.3 Volt */
-+
-+#define SK_SEN_VAUX_3V3_HIGH_ERR (SK_I32)(SK_SEN_VAUX_3V3_VAL * C_PLUS_10)
-+#define SK_SEN_VAUX_3V3_HIGH_WARN (SK_I32)(SK_SEN_VAUX_3V3_VAL * C_PLUS_5)
-+#define SK_SEN_VAUX_3V3_LOW_WARN (SK_I32)(SK_SEN_VAUX_3V3_VAL * C_MINUS_5)
-+#define SK_SEN_VAUX_3V3_LOW_ERR (SK_I32)(SK_SEN_VAUX_3V3_VAL * C_MINUS_10)
-+
-+#define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
-+
-+/*
-+ * PHY 2V5 voltage
-+ */
-+#define SK_SEN_PHY_2V5_VAL 2500 /* Voltage PHY 2.5 Volt */
-+
-+#define SK_SEN_PHY_2V5_HIGH_ERR (SK_I32)(SK_SEN_PHY_2V5_VAL * C_PLUS_10)
-+#define SK_SEN_PHY_2V5_HIGH_WARN (SK_I32)(SK_SEN_PHY_2V5_VAL * C_PLUS_5)
-+#define SK_SEN_PHY_2V5_LOW_WARN (SK_I32)(SK_SEN_PHY_2V5_VAL * C_MINUS_5)
-+#define SK_SEN_PHY_2V5_LOW_ERR (SK_I32)(SK_SEN_PHY_2V5_VAL * C_MINUS_10)
-+
-+/*
-+ * ASIC Core 1V5 voltage (YUKON only)
-+ */
-+#define SK_SEN_CORE_1V5_VAL 1500 /* Voltage ASIC Core 1.5 Volt */
-+
-+#define SK_SEN_CORE_1V5_HIGH_ERR (SK_I32)(SK_SEN_CORE_1V5_VAL * C_PLUS_10)
-+#define SK_SEN_CORE_1V5_HIGH_WARN (SK_I32)(SK_SEN_CORE_1V5_VAL * C_PLUS_5)
-+#define SK_SEN_CORE_1V5_LOW_WARN (SK_I32)(SK_SEN_CORE_1V5_VAL * C_MINUS_5)
-+#define SK_SEN_CORE_1V5_LOW_ERR (SK_I32)(SK_SEN_CORE_1V5_VAL * C_MINUS_10)
-+
-+/*
-+ * ASIC Core 1V2 (1V3) voltage (YUKON-2 only)
-+ */
-+#define SK_SEN_CORE_1V2_VAL 1200 /* Voltage ASIC Core 1.2 Volt */
-+
-+#define SK_SEN_CORE_1V2_HIGH_ERR (SK_I32)(SK_SEN_CORE_1V2_VAL * C_PLUS_20)
-+#define SK_SEN_CORE_1V2_HIGH_WARN (SK_I32)(SK_SEN_CORE_1V2_VAL * C_PLUS_15)
-+#define SK_SEN_CORE_1V2_LOW_WARN (SK_I32)(SK_SEN_CORE_1V2_VAL * C_MINUS_5)
-+#define SK_SEN_CORE_1V2_LOW_ERR (SK_I32)(SK_SEN_CORE_1V2_VAL * C_MINUS_10)
-+
-+#define SK_SEN_CORE_1V3_VAL 1300 /* Voltage ASIC Core 1.3 Volt */
-+
-+#define SK_SEN_CORE_1V3_HIGH_ERR (SK_I32)(SK_SEN_CORE_1V3_VAL * C_PLUS_15)
-+#define SK_SEN_CORE_1V3_HIGH_WARN (SK_I32)(SK_SEN_CORE_1V3_VAL * C_PLUS_10)
-+#define SK_SEN_CORE_1V3_LOW_WARN (SK_I32)(SK_SEN_CORE_1V3_VAL * C_MINUS_5)
-+#define SK_SEN_CORE_1V3_LOW_ERR (SK_I32)(SK_SEN_CORE_1V3_VAL * C_MINUS_10)
-+
-+/*
-+ * FAN 1 speed
-+ */
-+/* assuming: 6500rpm +-15%, 4 pulses,
-+ * warning at: 80 %
-+ * error at: 70 %
-+ * no upper limit
-+ */
-+#define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
-+#define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
-+#define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
-+#define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
-+
-+/*
-+ * Some Voltages need dynamic thresholds
-+ */
-+#define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
-+#define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
-+#define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
-+
-+extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
-+#endif /* n_INC_SKGETWSI_H */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/ski2c.h ./drivers/net/sk98lin/h/ski2c.h
---- ./drivers/net/sk98lin.sk98/h/ski2c.h 2004-10-19 01:53:45.000000000 +0400
-+++ ./drivers/net/sk98lin/h/ski2c.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,177 +0,0 @@
--/******************************************************************************
-- *
-- * Name: ski2c.h
-- * Project: Gigabit Ethernet Adapters, TWSI-Module
-- * Version: $Revision: 1.35 $
-- * Date: $Date: 2003/10/20 09:06:30 $
-- * Purpose: Defines to access Voltage and Temperature Sensor
-- *
-- ******************************************************************************/
--
--/******************************************************************************
-- *
-- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * The information in this file is provided "AS IS" without warranty.
-- *
-- ******************************************************************************/
--
--/*
-- * SKI2C.H contains all I2C specific defines
-- */
--
--#ifndef _SKI2C_H_
--#define _SKI2C_H_
--
--typedef struct s_Sensor SK_SENSOR;
--
--#include "h/skgei2c.h"
--
--/*
-- * Define the I2C events.
-- */
--#define SK_I2CEV_IRQ 1 /* IRQ happened Event */
--#define SK_I2CEV_TIM 2 /* Timeout event */
--#define SK_I2CEV_CLEAR 3 /* Clear MIB Values */
--
--/*
-- * Define READ and WRITE Constants.
-- */
--#define I2C_READ 0
--#define I2C_WRITE 1
--#define I2C_BURST 1
--#define I2C_SINGLE 0
--
--#define SKERR_I2C_E001 (SK_ERRBASE_I2C+0)
--#define SKERR_I2C_E001MSG "Sensor index unknown"
--#define SKERR_I2C_E002 (SKERR_I2C_E001+1)
--#define SKERR_I2C_E002MSG "TWSI: transfer does not complete"
--#define SKERR_I2C_E003 (SKERR_I2C_E002+1)
--#define SKERR_I2C_E003MSG "LM80: NAK on device send"
--#define SKERR_I2C_E004 (SKERR_I2C_E003+1)
--#define SKERR_I2C_E004MSG "LM80: NAK on register send"
--#define SKERR_I2C_E005 (SKERR_I2C_E004+1)
--#define SKERR_I2C_E005MSG "LM80: NAK on device (2) send"
--#define SKERR_I2C_E006 (SKERR_I2C_E005+1)
--#define SKERR_I2C_E006MSG "Unknown event"
--#define SKERR_I2C_E007 (SKERR_I2C_E006+1)
--#define SKERR_I2C_E007MSG "LM80 read out of state"
--#define SKERR_I2C_E008 (SKERR_I2C_E007+1)
--#define SKERR_I2C_E008MSG "Unexpected sensor read completed"
--#define SKERR_I2C_E009 (SKERR_I2C_E008+1)
--#define SKERR_I2C_E009MSG "WARNING: temperature sensor out of range"
--#define SKERR_I2C_E010 (SKERR_I2C_E009+1)
--#define SKERR_I2C_E010MSG "WARNING: voltage sensor out of range"
--#define SKERR_I2C_E011 (SKERR_I2C_E010+1)
--#define SKERR_I2C_E011MSG "ERROR: temperature sensor out of range"
--#define SKERR_I2C_E012 (SKERR_I2C_E011+1)
--#define SKERR_I2C_E012MSG "ERROR: voltage sensor out of range"
--#define SKERR_I2C_E013 (SKERR_I2C_E012+1)
--#define SKERR_I2C_E013MSG "ERROR: couldn't init sensor"
--#define SKERR_I2C_E014 (SKERR_I2C_E013+1)
--#define SKERR_I2C_E014MSG "WARNING: fan sensor out of range"
--#define SKERR_I2C_E015 (SKERR_I2C_E014+1)
--#define SKERR_I2C_E015MSG "ERROR: fan sensor out of range"
--#define SKERR_I2C_E016 (SKERR_I2C_E015+1)
--#define SKERR_I2C_E016MSG "TWSI: active transfer does not complete"
--
--/*
-- * Define Timeout values
-- */
--#define SK_I2C_TIM_LONG 2000000L /* 2 seconds */
--#define SK_I2C_TIM_SHORT 100000L /* 100 milliseconds */
--#define SK_I2C_TIM_WATCH 1000000L /* 1 second */
--
--/*
-- * Define trap and error log hold times
-- */
--#ifndef SK_SEN_ERR_TR_HOLD
--#define SK_SEN_ERR_TR_HOLD (4*SK_TICKS_PER_SEC)
--#endif
--#ifndef SK_SEN_ERR_LOG_HOLD
--#define SK_SEN_ERR_LOG_HOLD (60*SK_TICKS_PER_SEC)
--#endif
--#ifndef SK_SEN_WARN_TR_HOLD
--#define SK_SEN_WARN_TR_HOLD (15*SK_TICKS_PER_SEC)
--#endif
--#ifndef SK_SEN_WARN_LOG_HOLD
--#define SK_SEN_WARN_LOG_HOLD (15*60*SK_TICKS_PER_SEC)
--#endif
--
--/*
-- * Defines for SenType
-- */
--#define SK_SEN_UNKNOWN 0
--#define SK_SEN_TEMP 1
--#define SK_SEN_VOLT 2
--#define SK_SEN_FAN 3
--
--/*
-- * Define for the SenErrorFlag
-- */
--#define SK_SEN_ERR_NOT_PRESENT 0 /* Error Flag: Sensor not present */
--#define SK_SEN_ERR_OK 1 /* Error Flag: O.K. */
--#define SK_SEN_ERR_WARN 2 /* Error Flag: Warning */
--#define SK_SEN_ERR_ERR 3 /* Error Flag: Error */
--#define SK_SEN_ERR_FAULTY 4 /* Error Flag: Faulty */
--
--/*
-- * Define the Sensor struct
-- */
--struct s_Sensor {
-- char *SenDesc; /* Description */
-- int SenType; /* Voltage or Temperature */
-- SK_I32 SenValue; /* Current value of the sensor */
-- SK_I32 SenThreErrHigh; /* High error Threshhold of this sensor */
-- SK_I32 SenThreWarnHigh; /* High warning Threshhold of this sensor */
-- SK_I32 SenThreErrLow; /* Lower error Threshold of the sensor */
-- SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */
-- int SenErrFlag; /* Sensor indicated an error */
-- SK_BOOL SenInit; /* Is sensor initialized ? */
-- SK_U64 SenErrCts; /* Error trap counter */
-- SK_U64 SenWarnCts; /* Warning trap counter */
-- SK_U64 SenBegErrTS; /* Begin error timestamp */
-- SK_U64 SenBegWarnTS; /* Begin warning timestamp */
-- SK_U64 SenLastErrTrapTS; /* Last error trap timestamp */
-- SK_U64 SenLastErrLogTS; /* Last error log timestamp */
-- SK_U64 SenLastWarnTrapTS; /* Last warning trap timestamp */
-- SK_U64 SenLastWarnLogTS; /* Last warning log timestamp */
-- int SenState; /* Sensor State (see HW specific include) */
-- int (*SenRead)(SK_AC *pAC, SK_IOC IoC, struct s_Sensor *pSen);
-- /* Sensors read function */
-- SK_U16 SenReg; /* Register Address for this sensor */
-- SK_U8 SenDev; /* Device Selection for this sensor */
--};
--
--typedef struct s_I2c {
-- SK_SENSOR SenTable[SK_MAX_SENSORS]; /* Sensor Table */
-- int CurrSens; /* Which sensor is currently queried */
-- int MaxSens; /* Max. number of sensors */
-- int TimerMode; /* Use the timer also to watch the state machine */
-- int InitLevel; /* Initialized Level */
--#ifndef SK_DIAG
-- int DummyReads; /* Number of non-checked dummy reads */
-- SK_TIMER SenTimer; /* Sensors timer */
--#endif /* !SK_DIAG */
--} SK_I2C;
--
--extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level);
--extern int SkI2cWrite(SK_AC *pAC, SK_IOC IoC, SK_U32 Data, int Dev, int Size,
-- int Reg, int Burst);
--extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
--#ifdef SK_DIAG
--extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg,
-- int Burst);
--#else /* !SK_DIAG */
--extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
--extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC);
--extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC);
--#endif /* !SK_DIAG */
--#endif /* n_SKI2C_H */
--
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skqueue.h ./drivers/net/sk98lin/h/skqueue.h
---- ./drivers/net/sk98lin.sk98/h/skqueue.h 2004-10-19 01:55:29.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skqueue.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skqueue.h
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.16 $
-- * Date: $Date: 2003/09/16 12:50:32 $
-+ * Version: $Revision: 2.3 $
-+ * Date: $Date: 2004/05/14 13:39:15 $
- * Purpose: Defines for the Event queue
- *
- ******************************************************************************/
-@@ -45,6 +45,9 @@
- #define SKGE_RSF 11 /* RSF Aggregation Event Class */
- #define SKGE_MARKER 12 /* MARKER Aggregation Event Class */
- #define SKGE_FD 13 /* FD Distributor Event Class */
-+#ifdef SK_ASF
-+#define SKGE_ASF 14 /* ASF Event Class */
-+#endif
-
- /*
- * define event queue as circular buffer
-@@ -90,5 +93,11 @@ extern int SkEventDispatcher(SK_AC *pAC,
- #define SKERR_Q_E001MSG "Event queue overflow"
- #define SKERR_Q_E002 (SKERR_Q_E001+1)
- #define SKERR_Q_E002MSG "Undefined event class"
-+#define SKERR_Q_E003 (SKERR_Q_E001+2)
-+#define SKERR_Q_E003MSG "Event queued in Init Level 0"
-+#define SKERR_Q_E004 (SKERR_Q_E001+3)
-+#define SKERR_Q_E004MSG "Error Reported from Event Fuction (Queue Blocked)"
-+#define SKERR_Q_E005 (SKERR_Q_E001+4)
-+#define SKERR_Q_E005MSG "Event scheduler called in Init Level 0 or 1"
- #endif /* _SKQUEUE_H_ */
-
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skrlmt.h ./drivers/net/sk98lin/h/skrlmt.h
---- ./drivers/net/sk98lin.sk98/h/skrlmt.h 2004-10-19 01:55:36.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skrlmt.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skrlmt.h
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.37 $
-- * Date: $Date: 2003/04/15 09:43:43 $
-+ * Version: $Revision: 2.1 $
-+ * Date: $Date: 2003/10/27 14:16:09 $
- * Purpose: Header file for Redundant Link ManagemenT.
- *
- ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/sktimer.h ./drivers/net/sk98lin/h/sktimer.h
---- ./drivers/net/sk98lin.sk98/h/sktimer.h 2004-10-19 01:53:35.000000000 +0400
-+++ ./drivers/net/sk98lin/h/sktimer.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: sktimer.h
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.11 $
-- * Date: $Date: 2003/09/16 12:58:18 $
-+ * Version: $Revision: 2.1 $
-+ * Date: $Date: 2003/10/27 14:16:09 $
- * Purpose: Defines for the timer functions
- *
- ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/sktwsi.h ./drivers/net/sk98lin/h/sktwsi.h
---- ./drivers/net/sk98lin.sk98/h/sktwsi.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/h/sktwsi.h 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,177 @@
-+/******************************************************************************
-+ *
-+ * Name: sktwsi.h
-+ * Project: Gigabit Ethernet Adapters, TWSI-Module
-+ * Version: $Revision: 1.1 $
-+ * Date: $Date: 2003/12/19 14:02:56 $
-+ * Purpose: Defines to access Voltage and Temperature Sensor
-+ *
-+ ******************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * (C)Copyright 1998-2002 SysKonnect.
-+ * (C)Copyright 2002-2003 Marvell.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * The information in this file is provided "AS IS" without warranty.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * SKTWSI.H contains all TWSI specific defines
-+ */
-+
-+#ifndef _SKTWSI_H_
-+#define _SKTWSI_H_
-+
-+typedef struct s_Sensor SK_SENSOR;
-+
-+#include "h/skgetwsi.h"
-+
-+/*
-+ * Define the TWSI events.
-+ */
-+#define SK_I2CEV_IRQ 1 /* IRQ happened Event */
-+#define SK_I2CEV_TIM 2 /* Timeout event */
-+#define SK_I2CEV_CLEAR 3 /* Clear MIB Values */
-+
-+/*
-+ * Define READ and WRITE Constants.
-+ */
-+#define I2C_READ 0
-+#define I2C_WRITE 1
-+#define I2C_BURST 1
-+#define I2C_SINGLE 0
-+
-+#define SKERR_I2C_E001 (SK_ERRBASE_I2C+0)
-+#define SKERR_I2C_E001MSG "Sensor index unknown"
-+#define SKERR_I2C_E002 (SKERR_I2C_E001+1)
-+#define SKERR_I2C_E002MSG "TWSI: transfer does not complete"
-+#define SKERR_I2C_E003 (SKERR_I2C_E002+1)
-+#define SKERR_I2C_E003MSG "LM80: NAK on device send"
-+#define SKERR_I2C_E004 (SKERR_I2C_E003+1)
-+#define SKERR_I2C_E004MSG "LM80: NAK on register send"
-+#define SKERR_I2C_E005 (SKERR_I2C_E004+1)
-+#define SKERR_I2C_E005MSG "LM80: NAK on device (2) send"
-+#define SKERR_I2C_E006 (SKERR_I2C_E005+1)
-+#define SKERR_I2C_E006MSG "Unknown event"
-+#define SKERR_I2C_E007 (SKERR_I2C_E006+1)
-+#define SKERR_I2C_E007MSG "LM80 read out of state"
-+#define SKERR_I2C_E008 (SKERR_I2C_E007+1)
-+#define SKERR_I2C_E008MSG "Unexpected sensor read completed"
-+#define SKERR_I2C_E009 (SKERR_I2C_E008+1)
-+#define SKERR_I2C_E009MSG "WARNING: temperature sensor out of range"
-+#define SKERR_I2C_E010 (SKERR_I2C_E009+1)
-+#define SKERR_I2C_E010MSG "WARNING: voltage sensor out of range"
-+#define SKERR_I2C_E011 (SKERR_I2C_E010+1)
-+#define SKERR_I2C_E011MSG "ERROR: temperature sensor out of range"
-+#define SKERR_I2C_E012 (SKERR_I2C_E011+1)
-+#define SKERR_I2C_E012MSG "ERROR: voltage sensor out of range"
-+#define SKERR_I2C_E013 (SKERR_I2C_E012+1)
-+#define SKERR_I2C_E013MSG "ERROR: couldn't init sensor"
-+#define SKERR_I2C_E014 (SKERR_I2C_E013+1)
-+#define SKERR_I2C_E014MSG "WARNING: fan sensor out of range"
-+#define SKERR_I2C_E015 (SKERR_I2C_E014+1)
-+#define SKERR_I2C_E015MSG "ERROR: fan sensor out of range"
-+#define SKERR_I2C_E016 (SKERR_I2C_E015+1)
-+#define SKERR_I2C_E016MSG "TWSI: active transfer does not complete"
-+
-+/*
-+ * Define Timeout values
-+ */
-+#define SK_I2C_TIM_LONG 2000000L /* 2 seconds */
-+#define SK_I2C_TIM_SHORT 100000L /* 100 milliseconds */
-+#define SK_I2C_TIM_WATCH 1000000L /* 1 second */
-+
-+/*
-+ * Define trap and error log hold times
-+ */
-+#ifndef SK_SEN_ERR_TR_HOLD
-+#define SK_SEN_ERR_TR_HOLD (4*SK_TICKS_PER_SEC)
-+#endif
-+#ifndef SK_SEN_ERR_LOG_HOLD
-+#define SK_SEN_ERR_LOG_HOLD (60*SK_TICKS_PER_SEC)
-+#endif
-+#ifndef SK_SEN_WARN_TR_HOLD
-+#define SK_SEN_WARN_TR_HOLD (15*SK_TICKS_PER_SEC)
-+#endif
-+#ifndef SK_SEN_WARN_LOG_HOLD
-+#define SK_SEN_WARN_LOG_HOLD (15*60*SK_TICKS_PER_SEC)
-+#endif
-+
-+/*
-+ * Defines for SenType
-+ */
-+#define SK_SEN_UNKNOWN 0
-+#define SK_SEN_TEMP 1
-+#define SK_SEN_VOLT 2
-+#define SK_SEN_FAN 3
-+
-+/*
-+ * Define for the SenErrorFlag
-+ */
-+#define SK_SEN_ERR_NOT_PRESENT 0 /* Error Flag: Sensor not present */
-+#define SK_SEN_ERR_OK 1 /* Error Flag: O.K. */
-+#define SK_SEN_ERR_WARN 2 /* Error Flag: Warning */
-+#define SK_SEN_ERR_ERR 3 /* Error Flag: Error */
-+#define SK_SEN_ERR_FAULTY 4 /* Error Flag: Faulty */
-+
-+/*
-+ * Define the Sensor struct
-+ */
-+struct s_Sensor {
-+ char *SenDesc; /* Description */
-+ int SenType; /* Voltage or Temperature */
-+ SK_I32 SenValue; /* Current value of the sensor */
-+ SK_I32 SenThreErrHigh; /* High error Threshhold of this sensor */
-+ SK_I32 SenThreWarnHigh; /* High warning Threshhold of this sensor */
-+ SK_I32 SenThreErrLow; /* Lower error Threshold of the sensor */
-+ SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */
-+ int SenErrFlag; /* Sensor indicated an error */
-+ SK_BOOL SenInit; /* Is sensor initialized ? */
-+ SK_U64 SenErrCts; /* Error trap counter */
-+ SK_U64 SenWarnCts; /* Warning trap counter */
-+ SK_U64 SenBegErrTS; /* Begin error timestamp */
-+ SK_U64 SenBegWarnTS; /* Begin warning timestamp */
-+ SK_U64 SenLastErrTrapTS; /* Last error trap timestamp */
-+ SK_U64 SenLastErrLogTS; /* Last error log timestamp */
-+ SK_U64 SenLastWarnTrapTS; /* Last warning trap timestamp */
-+ SK_U64 SenLastWarnLogTS; /* Last warning log timestamp */
-+ int SenState; /* Sensor State (see HW specific include) */
-+ int (*SenRead)(SK_AC *pAC, SK_IOC IoC, struct s_Sensor *pSen);
-+ /* Sensors read function */
-+ SK_U16 SenReg; /* Register Address for this sensor */
-+ SK_U8 SenDev; /* Device Selection for this sensor */
-+};
-+
-+typedef struct s_I2c {
-+ SK_SENSOR SenTable[SK_MAX_SENSORS]; /* Sensor Table */
-+ int CurrSens; /* Which sensor is currently queried */
-+ int MaxSens; /* Max. number of sensors */
-+ int TimerMode; /* Use the timer also to watch the state machine */
-+ int InitLevel; /* Initialized Level */
-+#ifndef SK_DIAG
-+ int DummyReads; /* Number of non-checked dummy reads */
-+ SK_TIMER SenTimer; /* Sensors timer */
-+#endif /* !SK_DIAG */
-+} SK_I2C;
-+
-+extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level);
-+extern int SkI2cWrite(SK_AC *pAC, SK_IOC IoC, SK_U32 Data, int Dev, int Size,
-+ int Reg, int Burst);
-+extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
-+#ifdef SK_DIAG
-+extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg,
-+ int Burst);
-+#else /* !SK_DIAG */
-+extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
-+extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC);
-+extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC);
-+#endif /* !SK_DIAG */
-+#endif /* n_SKTWSI_H */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/sktypes.h ./drivers/net/sk98lin/h/sktypes.h
---- ./drivers/net/sk98lin.sk98/h/sktypes.h 2004-10-19 01:55:35.000000000 +0400
-+++ ./drivers/net/sk98lin/h/sktypes.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: sktypes.h
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.2 $
-- * Date: $Date: 2003/10/07 08:16:51 $
-+ * Version: $Revision: 1.2.2.1 $
-+ * Date: $Date: 2005/04/11 09:00:53 $
- * Purpose: Define data types for Linux
- *
- ******************************************************************************/
-@@ -11,7 +11,7 @@
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -22,48 +22,28 @@
- *
- ******************************************************************************/
-
--/******************************************************************************
-- *
-- * Description:
-- *
-- * In this file, all data types that are needed by the common modules
-- * are mapped to Linux data types.
-- *
-- *
-- * Include File Hierarchy:
-- *
-- *
-- ******************************************************************************/
--
- #ifndef __INC_SKTYPES_H
- #define __INC_SKTYPES_H
-
--
--/* defines *******************************************************************/
--
--/*
-- * Data types with a specific size. 'I' = signed, 'U' = unsigned.
-- */
--#define SK_I8 s8
--#define SK_U8 u8
--#define SK_I16 s16
--#define SK_U16 u16
--#define SK_I32 s32
--#define SK_U32 u32
--#define SK_I64 s64
--#define SK_U64 u64
--
--#define SK_UPTR ulong /* casting pointer <-> integral */
--
--/*
--* Boolean type.
--*/
--#define SK_BOOL SK_U8
--#define SK_FALSE 0
--#define SK_TRUE (!SK_FALSE)
--
--/* typedefs *******************************************************************/
--
--/* function prototypes ********************************************************/
-+#define SK_I8 s8 /* 8 bits (1 byte) signed */
-+#define SK_U8 u8 /* 8 bits (1 byte) unsigned */
-+#define SK_I16 s16 /* 16 bits (2 bytes) signed */
-+#define SK_U16 u16 /* 16 bits (2 bytes) unsigned */
-+#define SK_I32 s32 /* 32 bits (4 bytes) signed */
-+#define SK_U32 u32 /* 32 bits (4 bytes) unsigned */
-+#define SK_I64 s64 /* 64 bits (8 bytes) signed */
-+#define SK_U64 u64 /* 64 bits (8 bytes) unsigned */
-+
-+#define SK_UPTR ulong /* casting pointer <-> integral */
-+
-+#define SK_BOOL SK_U8
-+#define SK_FALSE 0
-+#define SK_TRUE (!SK_FALSE)
-
- #endif /* __INC_SKTYPES_H */
-+
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skversion.h ./drivers/net/sk98lin/h/skversion.h
---- ./drivers/net/sk98lin.sk98/h/skversion.h 2004-10-19 01:54:32.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skversion.h 2006-08-31 14:59:52.000000000 +0400
-@@ -1,17 +1,17 @@
- /******************************************************************************
- *
-- * Name: version.h
-+ * Name: skversion.h
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.5 $
-- * Date: $Date: 2003/10/07 08:16:51 $
-- * Purpose: SK specific Error log support
-+ * Version: $Revision: 1.3.2.1 $
-+ * Date: $Date: 2005/04/11 09:00:53 $
-+ * Purpose: specific version strings and numbers
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -22,17 +22,15 @@
- *
- ******************************************************************************/
-
--#ifdef lint
--static const char SysKonnectFileId[] = "@(#) (C) SysKonnect GmbH.";
--static const char SysKonnectBuildNumber[] =
-- "@(#)SK-BUILD: 6.23 PL: 01";
--#endif /* !defined(lint) */
--
--#define BOOT_STRING "sk98lin: Network Device Driver v6.23\n" \
-- "(C)Copyright 1999-2004 Marvell(R)."
--
--#define VER_STRING "6.23"
--#define DRIVER_FILE_NAME "sk98lin"
--#define DRIVER_REL_DATE "Feb-13-2004"
--
-+#define BOOT_STRING "sk98lin: Network Device Driver v8.31.2.3\n" \
-+ "(C)Copyright 1999-2006 Marvell(R)."
-+#define VER_STRING "8.31.2.3"
-+#define PATCHLEVEL "02"
-+#define DRIVER_FILE_NAME "sk98lin"
-+#define DRIVER_REL_DATE "Jan-18-2006"
-
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/h/skvpd.h ./drivers/net/sk98lin/h/skvpd.h
---- ./drivers/net/sk98lin.sk98/h/skvpd.h 2004-10-19 01:53:46.000000000 +0400
-+++ ./drivers/net/sk98lin/h/skvpd.h 2006-08-31 14:59:52.000000000 +0400
-@@ -1,22 +1,22 @@
- /******************************************************************************
- *
- * Name: skvpd.h
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.15 $
-- * Date: $Date: 2003/01/13 10:39:38 $
-+ * Project: Gigabit Ethernet Adapters, VPD-Module
-+ * Version: $Revision: 2.6 $
-+ * Date: $Date: 2004/11/09 15:18:00 $
- * Purpose: Defines and Macros for VPD handling
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-- * (C)Copyright 1998-2003 SysKonnect GmbH.
-+ * (C)Copyright 1998-2002 SysKonnect.
-+ * (C)Copyright 2002-2004 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
- *
- ******************************************************************************/
-@@ -31,7 +31,7 @@
- /*
- * Define Resource Type Identifiers and VPD keywords
- */
--#define RES_ID 0x82 /* Resource Type ID String (Product Name) */
-+#define RES_ID 0x82 /* Resource Type ID String (Product Name) */
- #define RES_VPD_R 0x90 /* start of VPD read only area */
- #define RES_VPD_W 0x91 /* start of VPD read/write area */
- #define RES_END 0x78 /* Resource Type End Tag */
-@@ -40,14 +40,16 @@
- #define VPD_NAME "Name" /* Product Name, VPD name of RES_ID */
- #endif /* VPD_NAME */
- #define VPD_PN "PN" /* Adapter Part Number */
--#define VPD_EC "EC" /* Adapter Engineering Level */
-+#define VPD_EC "EC" /* Adapter Engineering Level */
- #define VPD_MN "MN" /* Manufacture ID */
- #define VPD_SN "SN" /* Serial Number */
- #define VPD_CP "CP" /* Extended Capability */
- #define VPD_RV "RV" /* Checksum and Reserved */
--#define VPD_YA "YA" /* Asset Tag Identifier */
-+#define VPD_YA "YA" /* Asset Tag Identifier */
- #define VPD_VL "VL" /* First Error Log Message (SK specific) */
- #define VPD_VF "VF" /* Second Error Log Message (SK specific) */
-+#define VPD_VB "VB" /* Boot Agent ROM Configuration (SK specific) */
-+#define VPD_VE "VE" /* EFI UNDI Configuration (SK specific) */
- #define VPD_RW "RW" /* Remaining Read / Write Area */
-
- /* 'type' values for vpd_setup_para() */
-@@ -55,7 +57,7 @@
- #define VPD_RW_KEY 2 /* RW keys are "Yx", "Vx", and "RW" */
-
- /* 'op' values for vpd_setup_para() */
--#define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */
-+#define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */
- #define OWR_KEY 2 /* overwrite key if already exists */
-
- /*
-@@ -64,18 +66,18 @@
-
- #define VPD_DEV_ID_GENESIS 0x4300
-
--#define VPD_SIZE_YUKON 256
--#define VPD_SIZE_GENESIS 512
--#define VPD_SIZE 512
-+#define VPD_SIZE_YUKON 256
-+#define VPD_SIZE_GENESIS 512
-+#define VPD_SIZE 512
- #define VPD_READ 0x0000
- #define VPD_WRITE 0x8000
-
- #define VPD_STOP(pAC,IoC) VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG,VPD_WRITE)
-
--#define VPD_GET_RES_LEN(p) ((unsigned int) \
-- (* (SK_U8 *)&(p)[1]) |\
-- ((* (SK_U8 *)&(p)[2]) << 8))
--#define VPD_GET_VPD_LEN(p) ((unsigned int)(* (SK_U8 *)&(p)[2]))
-+#define VPD_GET_RES_LEN(p) ((unsigned int)\
-+ (*(SK_U8 *)&(p)[1]) |\
-+ ((*(SK_U8 *)&(p)[2]) << 8))
-+#define VPD_GET_VPD_LEN(p) ((unsigned int)(*(SK_U8 *)&(p)[2]))
- #define VPD_GET_VAL(p) ((char *)&(p)[3])
-
- #define VPD_MAX_LEN 50
-@@ -126,7 +128,7 @@ typedef struct s_vpd_key {
- /*
- * System specific VPD macros
- */
--#ifndef SKDIAG
-+#ifndef SK_DIAG
- #ifndef VPD_DO_IO
- #define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val)
- #define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val)
-@@ -135,61 +137,61 @@ typedef struct s_vpd_key {
- #define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal)
- #define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal)
- #else /* VPD_DO_IO */
--#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val)
--#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val)
--#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(Addr),Val)
--#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal)
--#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal)
--#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal)
-+#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(pAC,Addr),Val)
-+#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(pAC,Addr),Val)
-+#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(pAC,Addr),Val)
-+#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(pAC,Addr),pVal)
-+#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(pAC,Addr),pVal)
-+#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(pAC,Addr),pVal)
- #endif /* VPD_DO_IO */
--#else /* SKDIAG */
-+#else /* SK_DIAG */
- #define VPD_OUT8(pAC,Ioc,Addr,Val) { \
- if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciWriteCfgByte(pAC,Addr,Val); \
- else \
-- SK_OUT8(pAC,PCI_C(Addr),Val); \
-+ SK_OUT8(pAC,PCI_C(pAC,Addr),Val); \
- }
- #define VPD_OUT16(pAC,Ioc,Addr,Val) { \
- if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciWriteCfgWord(pAC,Addr,Val); \
- else \
-- SK_OUT16(pAC,PCI_C(Addr),Val); \
-+ SK_OUT16(pAC,PCI_C(pAC,Addr),Val); \
- }
- #define VPD_OUT32(pAC,Ioc,Addr,Val) { \
- if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciWriteCfgDWord(pAC,Addr,Val); \
- else \
-- SK_OUT32(pAC,PCI_C(Addr),Val); \
-+ SK_OUT32(pAC,PCI_C(pAC,Addr),Val); \
- }
- #define VPD_IN8(pAC,Ioc,Addr,pVal) { \
-- if ((pAC)->DgT.DgUseCfgCycle) \
-+ if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciReadCfgByte(pAC,Addr,pVal); \
- else \
-- SK_IN8(pAC,PCI_C(Addr),pVal); \
-+ SK_IN8(pAC,PCI_C(pAC,Addr),pVal); \
- }
- #define VPD_IN16(pAC,Ioc,Addr,pVal) { \
-- if ((pAC)->DgT.DgUseCfgCycle) \
-+ if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciReadCfgWord(pAC,Addr,pVal); \
- else \
-- SK_IN16(pAC,PCI_C(Addr),pVal); \
-+ SK_IN16(pAC,PCI_C(pAC,Addr),pVal); \
- }
- #define VPD_IN32(pAC,Ioc,Addr,pVal) { \
- if ((pAC)->DgT.DgUseCfgCycle) \
- SkPciReadCfgDWord(pAC,Addr,pVal); \
- else \
-- SK_IN32(pAC,PCI_C(Addr),pVal); \
-+ SK_IN32(pAC,PCI_C(pAC,Addr),pVal); \
- }
--#endif /* nSKDIAG */
-+#endif /* SK_DIAG */
-
- /* function prototypes ********************************************************/
-
- #ifndef SK_KR_PROTO
--#ifdef SKDIAG
-+#ifdef SK_DIAG
- extern SK_U32 VpdReadDWord(
- SK_AC *pAC,
- SK_IOC IoC,
- int addr);
--#endif /* SKDIAG */
-+#endif /* SK_DIAG */
-
- extern int VpdSetupPara(
- SK_AC *pAC,
-@@ -240,7 +242,12 @@ extern void VpdErrLog(
- SK_IOC IoC,
- char *msg);
-
--#ifdef SKDIAG
-+int VpdInit(
-+ SK_AC *pAC,
-+ SK_IOC IoC);
-+
-+#if defined(SK_DIAG) || defined(SK_ASF)
-+
- extern int VpdReadBlock(
- SK_AC *pAC,
- SK_IOC IoC,
-@@ -254,7 +261,9 @@ extern int VpdWriteBlock(
- char *buf,
- int addr,
- int len);
--#endif /* SKDIAG */
-+
-+#endif /* SK_DIAG || SK_ASF */
-+
- #else /* SK_KR_PROTO */
- extern SK_U32 VpdReadDWord();
- extern int VpdSetupPara();
-@@ -269,3 +278,4 @@ extern void VpdErrLog();
- #endif /* SK_KR_PROTO */
-
- #endif /* __INC_SKVPD_H_ */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/sky2le.h ./drivers/net/sk98lin/h/sky2le.h
---- ./drivers/net/sk98lin.sk98/h/sky2le.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/h/sky2le.h 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,893 @@
-+/******************************************************************************
-+ *
-+ * Name: sky2le.h
-+ * Project: Gigabit Ethernet Adapters, Common Modules
-+ * Version: $Revision: 1.10 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
-+ * Purpose: Common list element definitions and access macros.
-+ *
-+ ******************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * LICENSE:
-+ * (C)Copyright 2003-2004 Marvell
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
-+ *
-+ ******************************************************************************/
-+
-+#ifndef __INC_SKY2LE_H
-+#define __INC_SKY2LE_H
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif /* __cplusplus */
-+
-+/* defines ********************************************************************/
-+
-+#define MIN_LEN_OF_LE_TAB 128
-+#define MAX_LEN_OF_LE_TAB 4096
-+#ifdef USE_POLLING_UNIT
-+#define NUM_LE_POLLING_UNIT 2
-+#endif
-+#define MAX_FRAG_OVERHEAD 10
-+
-+/* Macro for aligning a given value */
-+#define SK_ALIGN_SIZE(Value, Alignment, AlignedVal) { \
-+ (AlignedVal) = (((Value) + (Alignment) - 1) & (~((Alignment) - 1)));\
-+}
-+
-+/******************************************************************************
-+ *
-+ * LE2DWord() - Converts the given Little Endian value to machine order value
-+ *
-+ * Description:
-+ * This function converts the Little Endian value received as an argument to
-+ * the machine order value.
-+ *
-+ * Returns:
-+ * The converted value
-+ *
-+ */
-+
-+#ifdef SK_LITTLE_ENDIAN
-+
-+#ifndef SK_USE_REV_DESC
-+#define LE2DWord(value) (value)
-+#else /* SK_USE_REV_DESC */
-+#define LE2DWord(value) \
-+ ((((value)<<24L) & 0xff000000L) + \
-+ (((value)<< 8L) & 0x00ff0000L) + \
-+ (((value)>> 8L) & 0x0000ff00L) + \
-+ (((value)>>24L) & 0x000000ffL))
-+#endif /* SK_USE_REV_DESC */
-+
-+#else /* !SK_LITTLE_ENDIAN */
-+
-+#ifndef SK_USE_REV_DESC
-+#define LE2DWord(value) \
-+ ((((value)<<24L) & 0xff000000L) + \
-+ (((value)<< 8L) & 0x00ff0000L) + \
-+ (((value)>> 8L) & 0x0000ff00L) + \
-+ (((value)>>24L) & 0x000000ffL))
-+#else /* SK_USE_REV_DESC */
-+#define LE2DWord(value) (value)
-+#endif /* SK_USE_REV_DESC */
-+
-+#endif /* !SK_LITTLE_ENDIAN */
-+
-+/******************************************************************************
-+ *
-+ * DWord2LE() - Converts the given value to a Little Endian value
-+ *
-+ * Description:
-+ * This function converts the value received as an argument to a Little Endian
-+ * value on Big Endian machines. If the machine running the code is Little
-+ * Endian, then no conversion is done.
-+ *
-+ * Returns:
-+ * The converted value
-+ *
-+ */
-+
-+#ifdef SK_LITTLE_ENDIAN
-+
-+#ifndef SK_USE_REV_DESC
-+#define DWord2LE(value) (value)
-+#else /* SK_USE_REV_DESC */
-+#define DWord2LE(value) \
-+ ((((value)<<24L) & 0xff000000L) + \
-+ (((value)<< 8L) & 0x00ff0000L) + \
-+ (((value)>> 8L) & 0x0000ff00L) + \
-+ (((value)>>24L) & 0x000000ffL))
-+#endif /* SK_USE_REV_DESC */
-+
-+#else /* !SK_LITTLE_ENDIAN */
-+
-+#ifndef SK_USE_REV_DESC
-+#define DWord2LE(value) \
-+ ((((value)<<24L) & 0xff000000L) + \
-+ (((value)<< 8L) & 0x00ff0000L) + \
-+ (((value)>> 8L) & 0x0000ff00L) + \
-+ (((value)>>24L) & 0x000000ffL))
-+#else /* SK_USE_REV_DESC */
-+#define DWord2LE(value) (value)
-+#endif /* SK_USE_REV_DESC */
-+#endif /* !SK_LITTLE_ENDIAN */
-+
-+/******************************************************************************
-+ *
-+ * LE2Word() - Converts the given Little Endian value to machine order value
-+ *
-+ * Description:
-+ * This function converts the Little Endian value received as an argument to
-+ * the machine order value.
-+ *
-+ * Returns:
-+ * The converted value
-+ *
-+ */
-+
-+#ifdef SK_LITTLE_ENDIAN
-+#ifndef SK_USE_REV_DESC
-+#define LE2Word(value) (value)
-+#else /* SK_USE_REV_DESC */
-+#define LE2Word(value) \
-+ ((((value)<< 8L) & 0xff00) + \
-+ (((value)>> 8L) & 0x00ff))
-+#endif /* SK_USE_REV_DESC */
-+
-+#else /* !SK_LITTLE_ENDIAN */
-+#ifndef SK_USE_REV_DESC
-+#define LE2Word(value) \
-+ ((((value)<< 8L) & 0xff00) + \
-+ (((value)>> 8L) & 0x00ff))
-+#else /* SK_USE_REV_DESC */
-+#define LE2Word(value) (value)
-+#endif /* SK_USE_REV_DESC */
-+#endif /* !SK_LITTLE_ENDIAN */
-+
-+/******************************************************************************
-+ *
-+ * Word2LE() - Converts the given value to a Little Endian value
-+ *
-+ * Description:
-+ * This function converts the value received as an argument to a Little Endian
-+ * value on Big Endian machines. If the machine running the code is Little
-+ * Endian, then no conversion is done.
-+ *
-+ * Returns:
-+ * The converted value
-+ *
-+ */
-+
-+#ifdef SK_LITTLE_ENDIAN
-+#ifndef SK_USE_REV_DESC
-+#define Word2LE(value) (value)
-+#else /* SK_USE_REV_DESC */
-+#define Word2LE(value) \
-+ ((((value)<< 8L) & 0xff00) + \
-+ (((value)>> 8L) & 0x00ff))
-+#endif /* SK_USE_REV_DESC */
-+
-+#else /* !SK_LITTLE_ENDIAN */
-+#ifndef SK_USE_REV_DESC
-+#define Word2LE(value) \
-+ ((((value)<< 8L) & 0xff00) + \
-+ (((value)>> 8L) & 0x00ff))
-+#else /* SK_USE_REV_DESC */
-+#define Word2LE(value) (value)
-+#endif /* SK_USE_REV_DESC */
-+#endif /* !SK_LITTLE_ENDIAN */
-+
-+/******************************************************************************
-+ *
-+ * Transmit list element macros
-+ *
-+ */
-+
-+#define TXLE_SET_ADDR(pLE, Addr) \
-+ ((pLE)->Tx.TxUn.BufAddr = DWord2LE(Addr))
-+#define TXLE_SET_LSLEN(pLE, Len) \
-+ ((pLE)->Tx.TxUn.LargeSend.Length = Word2LE(Len))
-+#define TXLE_SET_STACS(pLE, Start) \
-+ ((pLE)->Tx.TxUn.ChkSum.TxTcpSp = Word2LE(Start))
-+#define TXLE_SET_WRICS(pLE, Write) \
-+ ((pLE)->Tx.TxUn.ChkSum.TxTcpWp = Word2LE(Write))
-+#define TXLE_SET_INICS(pLE, Ini) ((pLE)->Tx.Send.InitCsum = Word2LE(Ini))
-+#define TXLE_SET_LEN(pLE, Len) ((pLE)->Tx.Send.BufLen = Word2LE(Len))
-+#define TXLE_SET_VLAN(pLE, Vlan) ((pLE)->Tx.Send.VlanTag = Word2LE(Vlan))
-+#define TXLE_SET_LCKCS(pLE, Lock) ((pLE)->Tx.ControlFlags = (Lock))
-+#define TXLE_SET_CTRL(pLE, Ctrl) ((pLE)->Tx.ControlFlags = (Ctrl))
-+#define TXLE_SET_OPC(pLE, Opc) ((pLE)->Tx.Opcode = (Opc))
-+
-+#define TXLE_GET_ADDR(pLE) LE2DWord((pLE)->Tx.TxUn.BufAddr)
-+#define TXLE_GET_LSLEN(pLE) LE2Word((pLE)->Tx.TxUn.LargeSend.Length)
-+#define TXLE_GET_STACS(pLE) LE2Word((pLE)->Tx.TxUn.ChkSum.TxTcpSp)
-+#define TXLE_GET_WRICS(pLE) LE2Word((pLE)->Tx.TxUn.ChkSum.TxTcpWp)
-+#define TXLE_GET_INICS(pLE) LE2Word((pLE)->Tx.Send.InitCsum)
-+#define TXLE_GET_LEN(pLE) LE2Word((pLE)->Tx.Send.BufLen)
-+#define TXLE_GET_VLAN(pLE) LE2Word((pLE)->Tx.Send.VlanTag)
-+#define TXLE_GET_LCKCS(pLE) ((pLE)->Tx.ControlFlags)
-+#define TXLE_GET_CTRL(pLE) ((pLE)->Tx.ControlFlags)
-+#define TXLE_GET_OPC(pLE) ((pLE)->Tx.Opcode)
-+
-+/******************************************************************************
-+ *
-+ * Receive list element macros
-+ *
-+ */
-+
-+#define RXLE_SET_ADDR(pLE, Addr) \
-+ ((pLE)->Rx.RxUn.BufAddr = (SK_U32) DWord2LE(Addr))
-+#define RXLE_SET_STACS2(pLE, Offs) \
-+ ((pLE)->Rx.RxUn.ChkSum.RxTcpSp2 = Word2LE(Offs))
-+#define RXLE_SET_STACS1(pLE, Offs) \
-+ ((pLE)->Rx.RxUn.ChkSum.RxTcpSp1 = Word2LE(Offs))
-+#define RXLE_SET_LEN(pLE, Len) ((pLE)->Rx.BufferLength = Word2LE(Len))
-+#define RXLE_SET_CTRL(pLE, Ctrl) ((pLE)->Rx.ControlFlags = (Ctrl))
-+#define RXLE_SET_OPC(pLE, Opc) ((pLE)->Rx.Opcode = (Opc))
-+
-+#define RXLE_GET_ADDR(pLE) LE2DWord((pLE)->Rx.RxUn.BufAddr)
-+#define RXLE_GET_STACS2(pLE) LE2Word((pLE)->Rx.RxUn.ChkSum.RxTcpSp2)
-+#define RXLE_GET_STACS1(pLE) LE2Word((pLE)->Rx.RxUn.ChkSum.RxTcpSp1)
-+#define RXLE_GET_LEN(pLE) LE2Word((pLE)->Rx.BufferLength)
-+#define RXLE_GET_CTRL(pLE) ((pLE)->Rx.ControlFlags)
-+#define RXLE_GET_OPC(pLE) ((pLE)->Rx.Opcode)
-+
-+/******************************************************************************
-+ *
-+ * Status list element macros
-+ *
-+ */
-+
-+#define STLE_SET_OPC(pLE, Opc) ((pLE)->St.Opcode = (Opc))
-+
-+#define STLE_GET_FRSTATUS(pLE) LE2DWord((pLE)->St.StUn.StRxStatWord)
-+#define STLE_GET_TIST(pLE) LE2DWord((pLE)->St.StUn.StRxTimeStamp)
-+#define STLE_GET_TCP1(pLE) LE2Word((pLE)->St.StUn.StRxTCPCSum.RxTCPSum1)
-+#define STLE_GET_TCP2(pLE) LE2Word((pLE)->St.StUn.StRxTCPCSum.RxTCPSum2)
-+#define STLE_GET_LEN(pLE) LE2Word((pLE)->St.Stat.BufLen)
-+#define STLE_GET_VLAN(pLE) LE2Word((pLE)->St.Stat.VlanTag)
-+#define STLE_GET_LINK(pLE) ((pLE)->St.Link)
-+#define STLE_GET_OPC(pLE) ((pLE)->St.Opcode)
-+#define STLE_GET_DONE_IDX(pLE,LowVal,HighVal) { \
-+ (LowVal) = LE2DWord((pLE)->St.StUn.StTxStatLow); \
-+ (HighVal) = LE2Word((pLE)->St.Stat.StTxStatHi); \
-+}
-+
-+#define STLE_GET_RSS(pLE) LE2DWord((pLE)->St.StUn.StRxRssValue)
-+#define STLE_GET_IPBIT(pLE) ((pLE)->St.Stat.Rss.FlagField & RSS_IP_FLAG)
-+#define STLE_GET_TCPBIT(pLE) ((pLE)->St.Stat.Rss.FlagField & RSS_TCP_FLAG)
-+
-+
-+/* I always take both values as a paramter to avoid typos */
-+#define STLE_GET_DONE_IDX_TXA1(LowVal,HighVal) \
-+ (((LowVal) & STLE_TXA1_MSKL) >> STLE_TXA1_SHIFTL)
-+#define STLE_GET_DONE_IDX_TXS1(LowVal,HighVal) \
-+ ((LowVal & STLE_TXS1_MSKL) >> STLE_TXS1_SHIFTL)
-+#define STLE_GET_DONE_IDX_TXA2(LowVal,HighVal) \
-+ (((LowVal & STLE_TXA2_MSKL) >> STLE_TXA2_SHIFTL) + \
-+ ((HighVal & STLE_TXA2_MSKH) << STLE_TXA2_SHIFTH))
-+#define STLE_GET_DONE_IDX_TXS2(LowVal,HighVal) \
-+ ((HighVal & STLE_TXS2_MSKH) >> STLE_TXS2_SHIFTH)
-+
-+
-+#define SK_Y2_RXSTAT_CHECK_PKT(Len, RxStat, IsOk) { \
-+ (IsOk) = (((RxStat) & GMR_FS_RX_OK) != 0) && \
-+ (((RxStat) & GMR_FS_ANY_ERR) == 0); \
-+ \
-+ if ((IsOk) && ((SK_U16)(((RxStat) & GMR_FS_LEN_MSK) >> \
-+ GMR_FS_LEN_SHIFT) != (Len))) { \
-+ /* length in MAC status differs from length in LE */\
-+ (IsOk) = SK_FALSE; \
-+ } \
-+}
-+
-+
-+/******************************************************************************
-+ *
-+ * Polling unit list element macros
-+ *
-+ * NOTE: the Idx must be <= 0xfff and PU_PUTIDX_VALID makes them valid
-+ *
-+ */
-+
-+#ifdef USE_POLLING_UNIT
-+
-+#define POLE_SET_OPC(pLE, Opc) ((pLE)->Sa.Opcode = (Opc))
-+#define POLE_SET_LINK(pLE, Port) ((pLE)->Sa.Link = (Port))
-+#define POLE_SET_RXIDX(pLE, Idx) ((pLE)->Sa.RxIdxVld = Word2LE(Idx))
-+#define POLE_SET_TXAIDX(pLE, Idx) ((pLE)->Sa.TxAIdxVld = Word2LE(Idx))
-+#define POLE_SET_TXSIDX(pLE, Idx) ((pLE)->Sa.TxSIdxVld = Word2LE(Idx))
-+
-+#define POLE_GET_OPC(pLE) ((pLE)->Sa.Opcode)
-+#define POLE_GET_LINK(pLE) ((pLE)->Sa.Link)
-+#define POLE_GET_RXIDX(pLE) LE2Word((pLE)->Sa.RxIdxVld)
-+#define POLE_GET_TXAIDX(pLE) LE2Word((pLE)->Sa.TxAIdxVld)
-+#define POLE_GET_TXSIDX(pLE) LE2Word((pLE)->Sa.TxSIdxVld)
-+
-+#endif /* USE_POLLING_UNIT */
-+
-+/******************************************************************************
-+ *
-+ * Debug macros for list elements
-+ *
-+ */
-+
-+#ifdef DEBUG
-+
-+#define SK_DBG_DUMP_RX_LE(pLE) { \
-+ SK_U8 Opcode; \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=== RX_LIST_ELEMENT @addr: %p cont: %02x %02x %02x %02x %02x %02x %02x %02x\n", \
-+ pLE, ((SK_U8 *) pLE)[0], ((SK_U8 *) pLE)[1], ((SK_U8 *) pLE)[2],\
-+ ((SK_U8 *) pLE)[3], ((SK_U8 *) pLE)[4], ((SK_U8 *) pLE)[5], \
-+ ((SK_U8 *) pLE)[6], ((SK_U8 *) pLE)[7])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (16bit) %04x %04x %04x %04x\n", \
-+ ((SK_U16 *) pLE)[0], ((SK_U16 *) pLE)[1], ((SK_U16 *) pLE)[2], \
-+ ((SK_U16 *) pLE)[3])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (32bit) %08x %08x\n", \
-+ ((SK_U32 *) pLE)[0], ((SK_U32 *) pLE)[1])); \
-+ Opcode = RXLE_GET_OPC(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOwn belongs to %s\n", ((Opcode & HW_OWNER) == HW_OWNER) ? \
-+ "Hardware" : "Software")); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOpc: 0x%x ",Opcode)); \
-+ switch (Opcode & (~HW_OWNER)) { \
-+ case OP_BUFFER: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_BUFFER\n")); \
-+ break; \
-+ case OP_PACKET: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_PACKET\n")); \
-+ break; \
-+ case OP_ADDR64: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_ADDR64\n")); \
-+ break; \
-+ case OP_TCPSTART: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPPAR\n")); \
-+ break; \
-+ case SW_OWNER: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunused LE\n")); \
-+ break; \
-+ default: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunknown Opcode!!!\n")); \
-+ break; \
-+ } \
-+ if ((Opcode & OP_BUFFER) == OP_BUFFER) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tControl: 0x%x\n", RXLE_GET_CTRL(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tBufLen: 0x%x\n", RXLE_GET_LEN(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tLowAddr: 0x%x\n", RXLE_GET_ADDR(pLE))); \
-+ } \
-+ if ((Opcode & OP_ADDR64) == OP_ADDR64) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tHighAddr: 0x%x\n", RXLE_GET_ADDR(pLE))); \
-+ } \
-+ if ((Opcode & OP_TCPSTART) == OP_TCPSTART) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Start 1 : 0x%x\n", RXLE_GET_STACS1(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Start 2 : 0x%x\n", RXLE_GET_STACS2(pLE))); \
-+ } \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=====================\n")); \
-+}
-+
-+#define SK_DBG_DUMP_TX_LE(pLE) { \
-+ SK_U8 Opcode; \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=== TX_LIST_ELEMENT @addr: %p cont: %02x %02x %02x %02x %02x %02x %02x %02x\n", \
-+ pLE, ((SK_U8 *) pLE)[0], ((SK_U8 *) pLE)[1], ((SK_U8 *) pLE)[2],\
-+ ((SK_U8 *) pLE)[3], ((SK_U8 *) pLE)[4], ((SK_U8 *) pLE)[5], \
-+ ((SK_U8 *) pLE)[6], ((SK_U8 *) pLE)[7])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (16bit) %04x %04x %04x %04x\n", \
-+ ((SK_U16 *) pLE)[0], ((SK_U16 *) pLE)[1], ((SK_U16 *) pLE)[2], \
-+ ((SK_U16 *) pLE)[3])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (32bit) %08x %08x\n", \
-+ ((SK_U32 *) pLE)[0], ((SK_U32 *) pLE)[1])); \
-+ Opcode = TXLE_GET_OPC(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOwn belongs to %s\n", ((Opcode & HW_OWNER) == HW_OWNER) ? \
-+ "Hardware" : "Software")); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOpc: 0x%x ",Opcode)); \
-+ switch (Opcode & (~HW_OWNER)) { \
-+ case OP_TCPCHKSUM: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPCHKSUM\n")); \
-+ break; \
-+ case OP_TCPIS: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPIS\n")); \
-+ break; \
-+ case OP_TCPLCK: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPLCK\n")); \
-+ break; \
-+ case OP_TCPLW: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPLW\n")); \
-+ break; \
-+ case OP_TCPLSW: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPLSW\n")); \
-+ break; \
-+ case OP_TCPLISW: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TCPLISW\n")); \
-+ break; \
-+ case OP_ADDR64: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_ADDR64\n")); \
-+ break; \
-+ case OP_VLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_VLAN\n")); \
-+ break; \
-+ case OP_ADDR64VLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_ADDR64VLAN\n")); \
-+ break; \
-+ case OP_LRGLEN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_LRGLEN\n")); \
-+ break; \
-+ case OP_LRGLENVLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_LRGLENVLAN\n")); \
-+ break; \
-+ case OP_BUFFER: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_BUFFER\n")); \
-+ break; \
-+ case OP_PACKET: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_PACKET\n")); \
-+ break; \
-+ case OP_LARGESEND: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_LARGESEND\n")); \
-+ break; \
-+ case SW_OWNER: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunused LE\n")); \
-+ break; \
-+ default: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunknown Opcode!!!\n")); \
-+ break; \
-+ } \
-+ if ((Opcode & OP_BUFFER) == OP_BUFFER) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tControl: 0x%x\n", TXLE_GET_CTRL(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tBufLen: 0x%x\n", TXLE_GET_LEN(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tLowAddr: 0x%x\n", TXLE_GET_ADDR(pLE))); \
-+ } \
-+ if ((Opcode & OP_ADDR64) == OP_ADDR64) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tHighAddr: 0x%x\n", TXLE_GET_ADDR(pLE))); \
-+ } \
-+ if ((Opcode & OP_VLAN) == OP_VLAN) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tVLAN Id: 0x%x\n", TXLE_GET_VLAN(pLE))); \
-+ } \
-+ if ((Opcode & OP_LRGLEN) == OP_LRGLEN) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tLarge send length: 0x%x\n", TXLE_GET_LSLEN(pLE))); \
-+ } \
-+ if ((Opcode &(~HW_OWNER)) <= OP_ADDR64) { \
-+ if ((Opcode & OP_TCPWRITE) == OP_TCPWRITE) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Write: 0x%x\n", TXLE_GET_WRICS(pLE))); \
-+ } \
-+ if ((Opcode & OP_TCPSTART) == OP_TCPSTART) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Start: 0x%x\n", TXLE_GET_STACS(pLE))); \
-+ } \
-+ if ((Opcode & OP_TCPINIT) == OP_TCPINIT) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Init: 0x%x\n", TXLE_GET_INICS(pLE))); \
-+ } \
-+ if ((Opcode & OP_TCPLCK) == OP_TCPLCK) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP Sum Lock: 0x%x\n", TXLE_GET_LCKCS(pLE))); \
-+ } \
-+ } \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=====================\n")); \
-+}
-+
-+#define SK_DBG_DUMP_ST_LE(pLE) { \
-+ SK_U8 Opcode; \
-+ SK_U16 HighVal; \
-+ SK_U32 LowVal; \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=== ST_LIST_ELEMENT @addr: %p contains: %02x %02x %02x %02x %02x %02x %02x %02x\n",\
-+ pLE, ((SK_U8 *) pLE)[0], ((SK_U8 *) pLE)[1], ((SK_U8 *) pLE)[2],\
-+ ((SK_U8 *) pLE)[3], ((SK_U8 *) pLE)[4], ((SK_U8 *) pLE)[5], \
-+ ((SK_U8 *) pLE)[6], ((SK_U8 *) pLE)[7])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (16bit) %04x %04x %04x %04x\n", \
-+ ((SK_U16 *) pLE)[0], ((SK_U16 *) pLE)[1], ((SK_U16 *) pLE)[2], \
-+ ((SK_U16 *) pLE)[3])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (32bit) %08x %08x\n", \
-+ ((SK_U32 *) pLE)[0], ((SK_U32 *) pLE)[1])); \
-+ Opcode = STLE_GET_OPC(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOwn belongs to %s\n", ((Opcode & HW_OWNER) == SW_OWNER) ? \
-+ "Hardware" : "Software")); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOpc: 0x%x", Opcode)); \
-+ Opcode &= (~HW_OWNER); \
-+ switch (Opcode) { \
-+ case OP_RXSTAT: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXSTAT\n")); \
-+ break; \
-+ case OP_RXTIMESTAMP: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXTIMESTAMP\n")); \
-+ break; \
-+ case OP_RXVLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXVLAN\n")); \
-+ break; \
-+ case OP_RXCHKS: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXCHKS\n")); \
-+ break; \
-+ case OP_RXCHKSVLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXCHKSVLAN\n")); \
-+ break; \
-+ case OP_RXTIMEVLAN: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RXTIMEVLAN\n")); \
-+ break; \
-+ case OP_RSS_HASH: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_RSS_HASH\n")); \
-+ break; \
-+ case OP_TXINDEXLE: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_TXINDEXLE\n")); \
-+ break; \
-+ case HW_OWNER: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunused LE\n")); \
-+ break; \
-+ default: \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunknown status list element!!!\n")); \
-+ break; \
-+ } \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tPort: %c\n", 'A' + STLE_GET_LINK(pLE))); \
-+ if (Opcode == OP_RXSTAT) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tFrameLen: 0x%x\n", STLE_GET_LEN(pLE))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tFrameStat: 0x%x\n", STLE_GET_FRSTATUS(pLE))); \
-+ } \
-+ if ((Opcode & OP_RXVLAN) == OP_RXVLAN) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tVLAN Id: 0x%x\n", STLE_GET_VLAN(pLE))); \
-+ } \
-+ if ((Opcode & OP_RXTIMESTAMP) == OP_RXTIMESTAMP) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTimestamp: 0x%x\n", STLE_GET_TIST(pLE))); \
-+ } \
-+ if ((Opcode & OP_RXCHKS) == OP_RXCHKS) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTCP: 0x%x 0x%x\n", STLE_GET_TCP1(pLE), \
-+ STLE_GET_TCP2(pLE))); \
-+ } \
-+ if (Opcode == OP_TXINDEXLE) { \
-+ STLE_GET_DONE_IDX(pLE, LowVal, HighVal); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTx Index TxA1: 0x%x\n", \
-+ STLE_GET_DONE_IDX_TXA1(LowVal,HighVal))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTx Index TxS1: 0x%x\n", \
-+ STLE_GET_DONE_IDX_TXS1(LowVal,HighVal))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTx Index TxA2: 0x%x\n", \
-+ STLE_GET_DONE_IDX_TXA2(LowVal,HighVal))); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTx Index TxS2: 0x%x\n", \
-+ STLE_GET_DONE_IDX_TXS2(LowVal,HighVal))); \
-+ } \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=====================\n")); \
-+}
-+
-+#ifdef USE_POLLING_UNIT
-+#define SK_DBG_DUMP_PO_LE(pLE) { \
-+ SK_U8 Opcode; \
-+ SK_U16 Idx; \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=== PO_LIST_ELEMENT @addr: %p cont: %02x %02x %02x %02x %02x %02x %02x %02x\n", \
-+ pLE, ((SK_U8 *) pLE)[0], ((SK_U8 *) pLE)[1], ((SK_U8 *) pLE)[2],\
-+ ((SK_U8 *) pLE)[3], ((SK_U8 *) pLE)[4], ((SK_U8 *) pLE)[5], \
-+ ((SK_U8 *) pLE)[6], ((SK_U8 *) pLE)[7])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (16bit) %04x %04x %04x %04x\n", \
-+ ((SK_U16 *) pLE)[0], ((SK_U16 *) pLE)[1], ((SK_U16 *) pLE)[2], \
-+ ((SK_U16 *) pLE)[3])); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\t (32bit) %08x %08x\n", \
-+ ((SK_U32 *) pLE)[0], ((SK_U32 *) pLE)[1])); \
-+ Opcode = POLE_GET_OPC(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOwn belongs to %s\n", ((Opcode & HW_OWNER) == HW_OWNER) ? \
-+ "Hardware" : "Software")); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOpc: 0x%x ",Opcode)); \
-+ if ((Opcode & ~HW_OWNER) == OP_PUTIDX) { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tOP_PUTIDX\n")); \
-+ } \
-+ else { \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tunknown Opcode!!!\n")); \
-+ } \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tPort %c\n", 'A' + POLE_GET_LINK(pLE))); \
-+ Idx = POLE_GET_TXAIDX(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTxA Index is 0x%X and %svalid\n", Idx, \
-+ (Idx & PU_PUTIDX_VALID) ? "" : "not ")); \
-+ Idx = POLE_GET_TXSIDX(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tTxS Index is 0x%X and %svalid\n", Idx, \
-+ (Idx & PU_PUTIDX_VALID) ? "" : "not ")); \
-+ Idx = POLE_GET_RXIDX(pLE); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("\tRx Index is 0x%X and %svalid\n", Idx, \
-+ (Idx & PU_PUTIDX_VALID) ? "" : "not ")); \
-+ SK_DBG_MSG(pAc, SK_DBGMOD_HWM, SK_DBGCAT_INIT, \
-+ ("=====================\n")); \
-+}
-+#endif /* USE_POLLING_UNIT */
-+
-+#else /* !DEBUG */
-+
-+#define SK_DBG_DUMP_RX_LE(pLE)
-+#define SK_DBG_DUMP_TX_LE(pLE)
-+#define SK_DBG_DUMP_ST_LE(pLE)
-+#define SK_DBG_DUMP_PO_LE(pLE)
-+
-+#endif /* !DEBUG */
-+
-+/******************************************************************************
-+ *
-+ * Macros for listelement tables
-+ *
-+ *
-+ */
-+
-+#define LE_SIZE sizeof(SK_HWLE)
-+#define LE_TAB_SIZE(NumElements) ((NumElements) * LE_SIZE)
-+
-+/* Number of unused list elements in table
-+ * this macro always returns the number of free listelements - 1
-+ * this way we want to guarantee that always one LE remains unused
-+ */
-+#define NUM_FREE_LE_IN_TABLE(pTable) \
-+ ( ((pTable)->Put >= (pTable)->Done) ? \
-+ (NUM_LE_IN_TABLE(pTable) - (pTable)->Put + (pTable)->Done - 1) :\
-+ ((pTable)->Done - (pTable)->Put - 1) )
-+
-+/* total number of list elements in table */
-+#define NUM_LE_IN_TABLE(pTable) ((pTable)->Num)
-+
-+/* get next unused Rx list element */
-+#define GET_RX_LE(pLE, pTable) { \
-+ pLE = &(pTable)->pLETab[(pTable)->Put]; \
-+ (pTable)->Put = ((pTable)->Put + 1) & (NUM_LE_IN_TABLE(pTable) - 1);\
-+}
-+
-+/* get next unused Tx list element */
-+#define GET_TX_LE(pLE, pTable) GET_RX_LE(pLE, pTable)
-+
-+/* get next status list element expected to be finished by hw */
-+#define GET_ST_LE(pLE, pTable) { \
-+ pLE = &(pTable)->pLETab[(pTable)->Done]; \
-+ (pTable)->Done = ((pTable)->Done +1) & (NUM_LE_IN_TABLE(pTable) - 1);\
-+}
-+
-+#ifdef USE_POLLING_UNIT
-+/* get next polling unit list element for port */
-+#define GET_PO_LE(pLE, pTable, Port) { \
-+ pLE = &(pTable)->pLETab[(Port)]; \
-+}
-+#endif /* USE_POLLING_UNIT */
-+
-+#define GET_PUT_IDX(pTable) ((pTable)->Put)
-+
-+#define UPDATE_HWPUT_IDX(pTable) {(pTable)->HwPut = (pTable)->Put; }
-+
-+/*
-+ * get own bit of next status LE
-+ * if the result is != 0 there has been at least one status LE finished
-+ */
-+#define OWN_OF_FIRST_LE(pTable) \
-+ (STLE_GET_OPC(&(pTable)->pLETab[(pTable)->Done]) & HW_OWNER)
-+
-+#define SET_DONE_INDEX(pTable, Idx) (pTable)->Done = (Idx);
-+
-+#define GET_DONE_INDEX(pTable) ((pTable)->Done)
-+
-+#ifdef SAFE_BUT_SLOW
-+
-+/* check own bit of LE before current done idx */
-+#define CHECK_STLE_OVERFLOW(pTable, IsOk) { \
-+ unsigned i; \
-+ if ((i = (pTable)->Done) == 0) { \
-+ i = NUM_LE_IN_TABLE(pTable); \
-+ } \
-+ else { \
-+ i = i - 1; \
-+ } \
-+ if (STLE_GET_OPC(&(pTable)->pLETab[i]) == HW_OWNER) { \
-+ (IsOk) = SK_TRUE; \
-+ } \
-+ else { \
-+ (IsOk) = SK_FALSE; \
-+ } \
-+ }
-+
-+
-+/*
-+ * for Yukon-2 the hardware is not polling the list elements, so it
-+ * is not necessary to change the own-bit of Rx or Tx LEs before
-+ * reusing them
-+ * but it might make debugging easier if one simply can see whether
-+ * a LE has been worked on
-+ */
-+
-+#define CLEAR_LE_OWN(pTable, Idx) \
-+ STLE_SET_OPC(&(pTable)->pLETab[(Idx)], SW_OWNER)
-+
-+/*
-+ * clear all own bits starting from old done index up to the LE before
-+ * the new done index
-+ */
-+#define CLEAR_LE_OWN_FROM_DONE_TO(pTable, To) { \
-+ int i; \
-+ i = (pTable)->Done; \
-+ while (i != To) { \
-+ CLEAR_LE_OWN(pTable, i); \
-+ i = (i + 1) & (NUM_LE_IN_TABLE(pTable) - 1); \
-+ } \
-+ }
-+
-+#else /* !SAFE_BUT_SLOW */
-+
-+#define CHECK_STLE_OVERFLOW(pTable, IsOk)
-+#define CLEAR_LE_OWN(pTable, Idx)
-+#define CLEAR_LE_OWN_FROM_DONE_TO(pTable, To)
-+
-+#endif /* !SAFE_BUT_SLOW */
-+
-+
-+/* typedefs *******************************************************************/
-+
-+typedef struct s_LetRxTx {
-+ SK_U16 VlanId; /* VLAN Id given down last time */
-+ SK_U16 TcpWp; /* TCP Checksum Write Position */
-+ SK_U16 TcpSp1; /* TCP Checksum Calculation Start Position 1 */
-+ SK_U16 TcpSp2; /* TCP Checksum Calculation Start Position 2 */
-+ SK_U16 MssValue; /* Maximum Segment Size */
-+ SK_U16 Reserved1; /* reserved word for furture extensions */
-+ SK_U16 Reserved2; /* reserved word for furture extensions */
-+ SK_U16 Reserved3; /* reserved word for furture extensions */
-+} SK_LET_RX_TX;
-+
-+typedef struct s_LetStat {
-+ SK_U32 RxTimeStamp; /* Receive Timestamp */
-+ SK_U32 RssHashValue; /* RSS Hash Value */
-+ SK_BOOL RssIsIp; /* RSS Hash Value: IP packet detected */
-+ SK_BOOL RssIsTcp; /* RSS Hash Value: IP+TCP packet detected */
-+ SK_U16 VlanId; /* VLAN Id given received by Status BMU */
-+ SK_U16 TcpSum1; /* TCP checksum 1 (status BMU) */
-+ SK_U16 TcpSum2; /* TCP checksum 2 (status BMU) */
-+} SK_LET_STAT;
-+
-+typedef union s_LetBmuSpec {
-+ SK_LET_RX_TX RxTx; /* Rx/Tx BMU specific variables */
-+ SK_LET_STAT Stat; /* Status BMU specific variables */
-+} SK_LET_BMU_S;
-+
-+typedef struct s_le_table {
-+ /* all LE's between Done and HWPut are owned by the hardware */
-+ /* all LE's between Put and Done can be used from Software */
-+ /* all LE's between HWPut and Put are currently processed in DriverSend */
-+ unsigned Done; /* done index - consumed from HW and available */
-+ unsigned Put; /* put index - to be given to hardware */
-+ unsigned HwPut; /* put index actually given to hardware */
-+ unsigned Num; /* total number of list elements */
-+ SK_HWLE *pLETab; /* virtual address of list element table */
-+ SK_U32 pPhyLETABLow; /* physical address of list element table */
-+ SK_U32 pPhyLETABHigh; /* physical address of list element table */
-+ /* values to remember in order to save some LEs */
-+ SK_U32 BufHighAddr; /* high addr given down last time */
-+ SK_LET_BMU_S Bmu; /* contains BMU specific information */
-+ SK_U32 private; /* driver private variable free usable */
-+ SK_U16 TcpInitCsum; /* Init. Checksum */
-+} SK_LE_TABLE;
-+
-+/* function prototypes ********************************************************/
-+
-+#ifndef SK_KR_PROTO
-+
-+/*
-+ * public functions in sky2le.c
-+ */
-+extern void SkGeY2SetPutIndex(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ SK_U32 StartAddrPrefetchUnit,
-+ SK_LE_TABLE *pLETab);
-+
-+extern void SkGeY2InitPrefetchUnit(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ unsigned int Queue,
-+ SK_LE_TABLE *pLETab);
-+
-+extern void SkGeY2InitStatBmu(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ SK_LE_TABLE *pLETab);
-+
-+extern void SkGeY2InitPollUnit(
-+ SK_AC *pAC,
-+ SK_IOC IoC,
-+ SK_LE_TABLE *pLETab);
-+
-+extern void SkGeY2InitSingleLETable(
-+ SK_AC *pAC,
-+ SK_LE_TABLE *pLETab,
-+ unsigned int NumLE,
-+ void *pVMem,
-+ SK_U32 PMemLowAddr,
-+ SK_U32 PMemHighAddr);
-+
-+#else /* SK_KR_PROTO */
-+extern void SkGeY2SetPutIndex();
-+extern void SkGeY2InitPrefetchUnit();
-+extern void SkGeY2InitStatBmu();
-+extern void SkGeY2InitPollUnit();
-+extern void SkGeY2InitSingleLETable();
-+#endif /* SK_KR_PROTO */
-+
-+#ifdef __cplusplus
-+}
-+#endif /* __cplusplus */
-+
-+#endif /* __INC_SKY2LE_H */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/h/xmac_ii.h ./drivers/net/sk98lin/h/xmac_ii.h
---- ./drivers/net/sk98lin.sk98/h/xmac_ii.h 2004-10-19 01:54:55.000000000 +0400
-+++ ./drivers/net/sk98lin/h/xmac_ii.h 2006-08-31 14:59:52.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: xmac_ii.h
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.52 $
-- * Date: $Date: 2003/10/02 16:35:50 $
-+ * Version: $Revision: 2.14 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Defines and Macros for Gigabit Ethernet Controller
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -371,18 +372,18 @@ extern "C" {
- /* Bit 16..6: reserved */
- #define XM_SC_SNP_RXC (1<<5) /* Bit 5: (sc) Snap Rx Counters */
- #define XM_SC_SNP_TXC (1<<4) /* Bit 4: (sc) Snap Tx Counters */
--#define XM_SC_CP_RXC (1<<3) /* Bit 3: Copy Rx Counters Continuously */
-+#define XM_SC_CP_RXC (1<<3) /* Bit 3: Copy Rx Counters Continuously */
- #define XM_SC_CP_TXC (1<<2) /* Bit 2: Copy Tx Counters Continuously */
- #define XM_SC_CLR_RXC (1<<1) /* Bit 1: (sc) Clear Rx Counters */
--#define XM_SC_CLR_TXC (1<<0) /* Bit 0: (sc) Clear Tx Counters */
-+#define XM_SC_CLR_TXC (1<<0) /* Bit 0: (sc) Clear Tx Counters */
-
-
- /* XM_RX_CNT_EV 32 bit r/o Rx Counter Event Register */
- /* XM_RX_EV_MSK 32 bit r/w Rx Counter Event Mask */
--#define XMR_MAX_SZ_OV (1UL<<31) /* Bit 31: 1024-MaxSize Rx Cnt Ov*/
--#define XMR_1023B_OV (1L<<30) /* Bit 30: 512-1023Byte Rx Cnt Ov*/
--#define XMR_511B_OV (1L<<29) /* Bit 29: 256-511 Byte Rx Cnt Ov*/
--#define XMR_255B_OV (1L<<28) /* Bit 28: 128-255 Byte Rx Cnt Ov*/
-+#define XMR_MAX_SZ_OV (1UL<<31) /* Bit 31: 1024-MaxSize Rx Cnt Ov */
-+#define XMR_1023B_OV (1L<<30) /* Bit 30: 512-1023Byte Rx Cnt Ov */
-+#define XMR_511B_OV (1L<<29) /* Bit 29: 256-511 Byte Rx Cnt Ov */
-+#define XMR_255B_OV (1L<<28) /* Bit 28: 128-255 Byte Rx Cnt Ov */
- #define XMR_127B_OV (1L<<27) /* Bit 27: 65-127 Byte Rx Cnt Ov */
- #define XMR_64B_OV (1L<<26) /* Bit 26: 64 Byte Rx Cnt Ov */
- #define XMR_UTIL_OV (1L<<25) /* Bit 25: Rx Util Cnt Overflow */
-@@ -390,9 +391,9 @@ extern "C" {
- #define XMR_CEX_ERR_OV (1L<<23) /* Bit 23: CEXT Err Cnt Ov */
- /* Bit 22: reserved */
- #define XMR_FCS_ERR_OV (1L<<21) /* Bit 21: Rx FCS Error Cnt Ov */
--#define XMR_LNG_ERR_OV (1L<<20) /* Bit 20: Rx too Long Err Cnt Ov*/
-+#define XMR_LNG_ERR_OV (1L<<20) /* Bit 20: Rx too Long Err Cnt Ov */
- #define XMR_RUNT_OV (1L<<19) /* Bit 19: Runt Event Cnt Ov */
--#define XMR_SHT_ERR_OV (1L<<18) /* Bit 18: Rx Short Ev Err Cnt Ov*/
-+#define XMR_SHT_ERR_OV (1L<<18) /* Bit 18: Rx Short Ev Err Cnt Ov */
- #define XMR_SYM_ERR_OV (1L<<17) /* Bit 17: Rx Sym Err Cnt Ov */
- /* Bit 16: reserved */
- #define XMR_CAR_ERR_OV (1L<<15) /* Bit 15: Rx Carr Ev Err Cnt Ov */
-@@ -401,57 +402,57 @@ extern "C" {
- #define XMR_FRA_ERR_OV (1L<<12) /* Bit 12: Rx Framing Err Cnt Ov */
- #define XMR_FMISS_OV (1L<<11) /* Bit 11: Rx Missed Ev Cnt Ov */
- #define XMR_BURST (1L<<10) /* Bit 10: Rx Burst Event Cnt Ov */
--#define XMR_INV_MOC (1L<<9) /* Bit 9: Rx with inv. MAC OC Ov*/
-+#define XMR_INV_MOC (1L<<9) /* Bit 9: Rx with inv. MAC OC Ov */
- #define XMR_INV_MP (1L<<8) /* Bit 8: Rx inv Pause Frame Ov */
- #define XMR_MCTRL_OV (1L<<7) /* Bit 7: Rx MAC Ctrl-F Cnt Ov */
--#define XMR_MPAUSE_OV (1L<<6) /* Bit 6: Rx Pause MAC Ctrl-F Ov*/
--#define XMR_UC_OK_OV (1L<<5) /* Bit 5: Rx Unicast Frame CntOv*/
-+#define XMR_MPAUSE_OV (1L<<6) /* Bit 6: Rx Pause MAC Ctrl-F Ov */
-+#define XMR_UC_OK_OV (1L<<5) /* Bit 5: Rx Unicast Frame Cnt Ov */
- #define XMR_MC_OK_OV (1L<<4) /* Bit 4: Rx Multicast Cnt Ov */
- #define XMR_BC_OK_OV (1L<<3) /* Bit 3: Rx Broadcast Cnt Ov */
--#define XMR_OK_LO_OV (1L<<2) /* Bit 2: Octets Rx OK Low CntOv*/
--#define XMR_OK_HI_OV (1L<<1) /* Bit 1: Octets Rx OK Hi Cnt Ov*/
--#define XMR_OK_OV (1L<<0) /* Bit 0: Frames Received Ok Ov */
-+#define XMR_OK_LO_OV (1L<<2) /* Bit 2: Octets Rx OK Low Cnt Ov */
-+#define XMR_OK_HI_OV (1L<<1) /* Bit 1: Octets Rx OK High Cnt Ov */
-+#define XMR_OK_OV (1L<<0) /* Bit 0: Frames Received OK Ov */
-
- #define XMR_DEF_MSK (XMR_OK_LO_OV | XMR_OK_HI_OV)
-
- /* XM_TX_CNT_EV 32 bit r/o Tx Counter Event Register */
- /* XM_TX_EV_MSK 32 bit r/w Tx Counter Event Mask */
- /* Bit 31..26: reserved */
--#define XMT_MAX_SZ_OV (1L<<25) /* Bit 25: 1024-MaxSize Tx Cnt Ov*/
--#define XMT_1023B_OV (1L<<24) /* Bit 24: 512-1023Byte Tx Cnt Ov*/
--#define XMT_511B_OV (1L<<23) /* Bit 23: 256-511 Byte Tx Cnt Ov*/
--#define XMT_255B_OV (1L<<22) /* Bit 22: 128-255 Byte Tx Cnt Ov*/
-+#define XMT_MAX_SZ_OV (1L<<25) /* Bit 25: 1024-MaxSize Tx Cnt Ov */
-+#define XMT_1023B_OV (1L<<24) /* Bit 24: 512-1023Byte Tx Cnt Ov */
-+#define XMT_511B_OV (1L<<23) /* Bit 23: 256-511 Byte Tx Cnt Ov */
-+#define XMT_255B_OV (1L<<22) /* Bit 22: 128-255 Byte Tx Cnt Ov */
- #define XMT_127B_OV (1L<<21) /* Bit 21: 65-127 Byte Tx Cnt Ov */
- #define XMT_64B_OV (1L<<20) /* Bit 20: 64 Byte Tx Cnt Ov */
- #define XMT_UTIL_OV (1L<<19) /* Bit 19: Tx Util Cnt Overflow */
- #define XMT_UTIL_UR (1L<<18) /* Bit 18: Tx Util Cnt Underrun */
--#define XMT_CS_ERR_OV (1L<<17) /* Bit 17: Tx Carr Sen Err Cnt Ov*/
-+#define XMT_CS_ERR_OV (1L<<17) /* Bit 17: Tx Carr Sen Err Cnt Ov */
- #define XMT_FIFO_UR_OV (1L<<16) /* Bit 16: Tx FIFO Ur Ev Cnt Ov */
- #define XMT_EX_DEF_OV (1L<<15) /* Bit 15: Tx Ex Deferall Cnt Ov */
- #define XMT_DEF (1L<<14) /* Bit 14: Tx Deferred Cnt Ov */
- #define XMT_LAT_COL_OV (1L<<13) /* Bit 13: Tx Late Col Cnt Ov */
--#define XMT_ABO_COL_OV (1L<<12) /* Bit 12: Tx abo dueto Ex Col Ov*/
-+#define XMT_ABO_COL_OV (1L<<12) /* Bit 12: Tx abo dueto Ex Col Ov */
- #define XMT_MUL_COL_OV (1L<<11) /* Bit 11: Tx Mult Col Cnt Ov */
- #define XMT_SNG_COL (1L<<10) /* Bit 10: Tx Single Col Cnt Ov */
--#define XMT_MCTRL_OV (1L<<9) /* Bit 9: Tx MAC Ctrl Counter Ov*/
--#define XMT_MPAUSE (1L<<8) /* Bit 8: Tx Pause MAC Ctrl-F Ov*/
-+#define XMT_MCTRL_OV (1L<<9) /* Bit 9: Tx MAC Ctrl Counter Ov */
-+#define XMT_MPAUSE (1L<<8) /* Bit 8: Tx Pause MAC Ctrl-F Ov */
- #define XMT_BURST (1L<<7) /* Bit 7: Tx Burst Event Cnt Ov */
- #define XMT_LONG (1L<<6) /* Bit 6: Tx Long Frame Cnt Ov */
- #define XMT_UC_OK_OV (1L<<5) /* Bit 5: Tx Unicast Cnt Ov */
- #define XMT_MC_OK_OV (1L<<4) /* Bit 4: Tx Multicast Cnt Ov */
- #define XMT_BC_OK_OV (1L<<3) /* Bit 3: Tx Broadcast Cnt Ov */
--#define XMT_OK_LO_OV (1L<<2) /* Bit 2: Octets Tx OK Low CntOv*/
--#define XMT_OK_HI_OV (1L<<1) /* Bit 1: Octets Tx OK Hi Cnt Ov*/
--#define XMT_OK_OV (1L<<0) /* Bit 0: Frames Tx Ok Ov */
-+#define XMT_OK_LO_OV (1L<<2) /* Bit 2: Octets Tx OK Low Cnt Ov */
-+#define XMT_OK_HI_OV (1L<<1) /* Bit 1: Octets Tx OK High Cnt Ov */
-+#define XMT_OK_OV (1L<<0) /* Bit 0: Frames Tx OK Ov */
-
- #define XMT_DEF_MSK (XMT_OK_LO_OV | XMT_OK_HI_OV)
-
- /*
- * Receive Frame Status Encoding
- */
--#define XMR_FS_LEN (0x3fffUL<<18) /* Bit 31..18: Rx Frame Length */
--#define XMR_FS_2L_VLAN (1L<<17) /* Bit 17: tagged wh 2Lev VLAN ID*/
--#define XMR_FS_1L_VLAN (1L<<16) /* Bit 16: tagged wh 1Lev VLAN ID*/
-+#define XMR_FS_LEN_MSK (0x3fffUL<<18) /* Bit 31..18: Rx Frame Length */
-+#define XMR_FS_2L_VLAN (1L<<17) /* Bit 17: Tagged wh 2Lev VLAN ID */
-+#define XMR_FS_1L_VLAN (1L<<16) /* Bit 16: Tagged wh 1Lev VLAN ID */
- #define XMR_FS_BC (1L<<15) /* Bit 15: Broadcast Frame */
- #define XMR_FS_MC (1L<<14) /* Bit 14: Multicast Frame */
- #define XMR_FS_UC (1L<<13) /* Bit 13: Unicast Frame */
-@@ -469,6 +470,8 @@ extern "C" {
- #define XMR_FS_ERR (1L<<1) /* Bit 1: Frame Error */
- #define XMR_FS_MCTRL (1L<<0) /* Bit 0: MAC Control Packet */
-
-+#define XMR_FS_LEN_SHIFT 18
-+
- /*
- * XMR_FS_ERR will be set if
- * XMR_FS_FCS_ERR, XMR_FS_LNG_ERR, XMR_FS_RUNT,
-@@ -488,7 +491,7 @@ extern "C" {
- #define PHY_XMAC_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
- #define PHY_XMAC_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
- #define PHY_XMAC_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
--#define PHY_XMAC_AUNE_LP 0x05 /* 16 bit r/o Link Partner Abi Reg */
-+#define PHY_XMAC_AUNE_LP 0x05 /* 16 bit r/o Link Partner Ability Reg */
- #define PHY_XMAC_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
- #define PHY_XMAC_NEPG 0x07 /* 16 bit r/w Next Page Register */
- #define PHY_XMAC_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
-@@ -510,7 +513,7 @@ extern "C" {
- #define PHY_BCOM_NEPG 0x07 /* 16 bit r/w Next Page Register */
- #define PHY_BCOM_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
- /* Broadcom-specific registers */
--#define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
-+#define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */
- #define PHY_BCOM_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
- /* 0x0b - 0x0e: reserved */
- #define PHY_BCOM_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
-@@ -541,24 +544,32 @@ extern "C" {
- #define PHY_MARV_NEPG 0x07 /* 16 bit r/w Next Page Register */
- #define PHY_MARV_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
- /* Marvel-specific registers */
--#define PHY_MARV_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
-+#define PHY_MARV_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */
- #define PHY_MARV_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
- /* 0x0b - 0x0e: reserved */
- #define PHY_MARV_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
--#define PHY_MARV_PHY_CTRL 0x10 /* 16 bit r/w PHY Specific Ctrl Reg */
--#define PHY_MARV_PHY_STAT 0x11 /* 16 bit r/o PHY Specific Stat Reg */
-+#define PHY_MARV_PHY_CTRL 0x10 /* 16 bit r/w PHY Specific Control Reg */
-+#define PHY_MARV_PHY_STAT 0x11 /* 16 bit r/o PHY Specific Status Reg */
- #define PHY_MARV_INT_MASK 0x12 /* 16 bit r/w Interrupt Mask Reg */
- #define PHY_MARV_INT_STAT 0x13 /* 16 bit r/o Interrupt Status Reg */
- #define PHY_MARV_EXT_CTRL 0x14 /* 16 bit r/w Ext. PHY Specific Ctrl */
- #define PHY_MARV_RXE_CNT 0x15 /* 16 bit r/w Receive Error Counter */
- #define PHY_MARV_EXT_ADR 0x16 /* 16 bit r/w Ext. Ad. for Cable Diag. */
-- /* 0x17: reserved */
-+#define PHY_MARV_PORT_IRQ 0x17 /* 16 bit r/o Port 0 IRQ (88E1111 only) */
- #define PHY_MARV_LED_CTRL 0x18 /* 16 bit r/w LED Control Reg */
- #define PHY_MARV_LED_OVER 0x19 /* 16 bit r/w Manual LED Override Reg */
- #define PHY_MARV_EXT_CTRL_2 0x1a /* 16 bit r/w Ext. PHY Specific Ctrl 2 */
- #define PHY_MARV_EXT_P_STAT 0x1b /* 16 bit r/w Ext. PHY Spec. Stat Reg */
- #define PHY_MARV_CABLE_DIAG 0x1c /* 16 bit r/o Cable Diagnostic Reg */
-- /* 0x1d - 0x1f: reserved */
-+#define PHY_MARV_PAGE_ADDR 0x1d /* 16 bit r/w Extended Page Address Reg */
-+#define PHY_MARV_PAGE_DATA 0x1e /* 16 bit r/w Extended Page Data Reg */
-+
-+/* for 10/100 Fast Ethernet PHY (88E3082 only) */
-+#define PHY_MARV_FE_LED_PAR 0x16 /* 16 bit r/w LED Parallel Select Reg. */
-+#define PHY_MARV_FE_LED_SER 0x17 /* 16 bit r/w LED Stream Select S. LED */
-+#define PHY_MARV_FE_VCT_TX 0x1a /* 16 bit r/w VCT Reg. for TXP/N Pins */
-+#define PHY_MARV_FE_VCT_RX 0x1b /* 16 bit r/o VCT Reg. for RXP/N Pins */
-+#define PHY_MARV_FE_SPEC_2 0x1c /* 16 bit r/w Specific Control Reg. 2 */
-
- /*----------------------------------------------------------------------------*/
- /*
-@@ -574,9 +585,9 @@ extern "C" {
- #define PHY_LONE_NEPG 0x07 /* 16 bit r/w Next Page Register */
- #define PHY_LONE_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
- /* Level One-specific registers */
--#define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg*/
-+#define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */
- #define PHY_LONE_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
-- /* 0x0b -0x0e: reserved */
-+ /* 0x0b - 0x0e: reserved */
- #define PHY_LONE_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
- #define PHY_LONE_PORT_CFG 0x10 /* 16 bit r/w Port Configuration Reg*/
- #define PHY_LONE_Q_STAT 0x11 /* 16 bit r/o Quick Status Reg */
-@@ -585,7 +596,7 @@ extern "C" {
- #define PHY_LONE_LED_CFG 0x14 /* 16 bit r/w LED Configuration Reg */
- #define PHY_LONE_PORT_CTRL 0x15 /* 16 bit r/w Port Control Reg */
- #define PHY_LONE_CIM 0x16 /* 16 bit r/o CIM Reg */
-- /* 0x17 -0x1c: reserved */
-+ /* 0x17 - 0x1c: reserved */
-
- /*----------------------------------------------------------------------------*/
- /*
-@@ -603,14 +614,14 @@ extern "C" {
- /* National-specific registers */
- #define PHY_NAT_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */
- #define PHY_NAT_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
-- /* 0x0b -0x0e: reserved */
-+ /* 0x0b - 0x0e: reserved */
- #define PHY_NAT_EXT_STAT 0x0f /* 16 bit r/o Extended Status Register */
- #define PHY_NAT_EXT_CTRL1 0x10 /* 16 bit r/o Extended Control Reg1 */
- #define PHY_NAT_Q_STAT1 0x11 /* 16 bit r/o Quick Status Reg1 */
- #define PHY_NAT_10B_OP 0x12 /* 16 bit r/o 10Base-T Operations Reg */
- #define PHY_NAT_EXT_CTRL2 0x13 /* 16 bit r/o Extended Control Reg1 */
- #define PHY_NAT_Q_STAT2 0x14 /* 16 bit r/o Quick Status Reg2 */
-- /* 0x15 -0x18: reserved */
-+ /* 0x15 - 0x18: reserved */
- #define PHY_NAT_PHY_ADDR 0x19 /* 16 bit r/o PHY Address Register */
-
-
-@@ -618,7 +629,7 @@ extern "C" {
-
- /*
- * PHY bit definitions
-- * Bits defined as PHY_X_..., PHY_B_..., PHY_L_... or PHY_N_... are
-+ * Bits defined as PHY_X_..., PHY_B_..., PHY_L_..., PHY_N_... or PHY_M_... are
- * XMAC/Broadcom/LevelOne/National/Marvell-specific.
- * All other are general.
- */
-@@ -629,14 +640,14 @@ extern "C" {
- /***** PHY_LONE_CTRL 16 bit r/w PHY Control Register *****/
- #define PHY_CT_RESET (1<<15) /* Bit 15: (sc) clear all PHY related regs */
- #define PHY_CT_LOOP (1<<14) /* Bit 14: enable Loopback over PHY */
--#define PHY_CT_SPS_LSB (1<<13) /* Bit 13: (BC,L1) Speed select, lower bit */
-+#define PHY_CT_SPS_LSB (1<<13) /* Bit 13: Speed select, lower bit */
- #define PHY_CT_ANE (1<<12) /* Bit 12: Auto-Negotiation Enabled */
--#define PHY_CT_PDOWN (1<<11) /* Bit 11: (BC,L1) Power Down Mode */
--#define PHY_CT_ISOL (1<<10) /* Bit 10: (BC,L1) Isolate Mode */
--#define PHY_CT_RE_CFG (1<<9) /* Bit 9: (sc) Restart Auto-Negotiation */
-+#define PHY_CT_PDOWN (1<<11) /* Bit 11: Power Down Mode */
-+#define PHY_CT_ISOL (1<<10) /* Bit 10: Isolate Mode */
-+#define PHY_CT_RE_CFG (1<<9) /* Bit 9: (sc) Restart Auto-Negotiation */
- #define PHY_CT_DUP_MD (1<<8) /* Bit 8: Duplex Mode */
--#define PHY_CT_COL_TST (1<<7) /* Bit 7: (BC,L1) Collision Test enabled */
--#define PHY_CT_SPS_MSB (1<<6) /* Bit 6: (BC,L1) Speed select, upper bit */
-+#define PHY_CT_COL_TST (1<<7) /* Bit 7: Collision Test enabled */
-+#define PHY_CT_SPS_MSB (1<<6) /* Bit 6: Speed select, upper bit */
- /* Bit 5..0: reserved */
-
- #define PHY_CT_SP1000 PHY_CT_SPS_MSB /* enable speed of 1000 Mbps */
-@@ -649,25 +660,25 @@ extern "C" {
- /***** PHY_MARV_STAT 16 bit r/w PHY Status Register *****/
- /***** PHY_LONE_STAT 16 bit r/w PHY Status Register *****/
- /* Bit 15..9: reserved */
-- /* (BC/L1) 100/10 Mbps cap bits ignored*/
-+ /* (BC/L1) 100/10 Mbps cap bits ignored */
- #define PHY_ST_EXT_ST (1<<8) /* Bit 8: Extended Status Present */
- /* Bit 7: reserved */
--#define PHY_ST_PRE_SUP (1<<6) /* Bit 6: (BC/L1) preamble suppression */
-+#define PHY_ST_PRE_SUP (1<<6) /* Bit 6: Preamble Suppression */
- #define PHY_ST_AN_OVER (1<<5) /* Bit 5: Auto-Negotiation Over */
- #define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occured */
- #define PHY_ST_AN_CAP (1<<3) /* Bit 3: Auto-Negotiation Capability */
- #define PHY_ST_LSYNC (1<<2) /* Bit 2: Link Synchronized */
--#define PHY_ST_JAB_DET (1<<1) /* Bit 1: (BC/L1) Jabber Detected */
-+#define PHY_ST_JAB_DET (1<<1) /* Bit 1: Jabber Detected */
- #define PHY_ST_EXT_REG (1<<0) /* Bit 0: Extended Register available */
-
-
--/***** PHY_XMAC_ID1 16 bit r/o PHY ID1 Register */
--/***** PHY_BCOM_ID1 16 bit r/o PHY ID1 Register */
--/***** PHY_MARV_ID1 16 bit r/o PHY ID1 Register */
--/***** PHY_LONE_ID1 16 bit r/o PHY ID1 Register */
-+/***** PHY_XMAC_ID1 16 bit r/o PHY ID1 Register */
-+/***** PHY_BCOM_ID1 16 bit r/o PHY ID1 Register */
-+/***** PHY_MARV_ID1 16 bit r/o PHY ID1 Register */
-+/***** PHY_LONE_ID1 16 bit r/o PHY ID1 Register */
- #define PHY_I1_OUI_MSK (0x3f<<10) /* Bit 15..10: Organization Unique ID */
- #define PHY_I1_MOD_NUM (0x3f<<4) /* Bit 9.. 4: Model Number */
--#define PHY_I1_REV_MSK 0x0f /* Bit 3.. 0: Revision Number */
-+#define PHY_I1_REV_MSK 0xf /* Bit 3.. 0: Revision Number */
-
- /* different Broadcom PHY Ids */
- #define PHY_BCOM_ID1_A1 0x6041
-@@ -675,11 +686,21 @@ extern "C" {
- #define PHY_BCOM_ID1_C0 0x6044
- #define PHY_BCOM_ID1_C5 0x6047
-
-+/* different Marvell PHY Ids */
-+#define PHY_MARV_ID0_VAL 0x0141 /* Marvell Unique Identifier */
-+
-+#define PHY_MARV_ID1_B0 0x0C23 /* Yukon (PHY 88E1040 Rev.C0) */
-+#define PHY_MARV_ID1_B2 0x0C25 /* Yukon-Plus (PHY 88E1040 Rev.D0) */
-+#define PHY_MARV_ID1_C2 0x0CC2 /* Yukon-EC (PHY 88E1111 Rev.B1) */
-+#define PHY_MARV_ID1_Y2 0x0C91 /* Yukon-XL (PHY 88E1112 Rev.B0) */
-+#define PHY_MARV_ID1_FE 0x0C83 /* Yukon-FE (PHY 88E3082 Rev.A1) */
-+#define PHY_MARV_ID1_ECU 0x0CB0 /* Yukon-ECU (PHY 88E1149 Rev.B2?) */
-+
-
- /***** PHY_XMAC_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
- /***** PHY_XMAC_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
- #define PHY_AN_NXT_PG (1<<15) /* Bit 15: Request Next Page */
--#define PHY_X_AN_ACK (1<<14) /* Bit 14: (ro) Acknowledge Received */
-+#define PHY_X_AN_ACK (1<<14) /* Bit 14: (ro) Acknowledge Received */
- #define PHY_X_AN_RFB (3<<12) /* Bit 13..12: Remote Fault Bits */
- /* Bit 11.. 9: reserved */
- #define PHY_X_AN_PAUSE (3<<7) /* Bit 8.. 7: Pause Bits */
-@@ -827,7 +848,7 @@ extern "C" {
- #define PHY_B_PEC_BY_MLT3 (1<<8) /* Bit 8: Bypass MLT3 Encoder */
- #define PHY_B_PEC_BY_RXA (1<<7) /* Bit 7: Bypass Rx Alignm. */
- #define PHY_B_PEC_RES_SCR (1<<6) /* Bit 6: Reset Scrambler */
--#define PHY_B_PEC_EN_LTR (1<<5) /* Bit 5: Ena LED Traffic Mode */
-+#define PHY_B_PEC_EN_LTR (1<<5) /* Bit 5: Enable LED Traffic Mode */
- #define PHY_B_PEC_LED_ON (1<<4) /* Bit 4: Force LED's on */
- #define PHY_B_PEC_LED_OFF (1<<3) /* Bit 3: Force LED's off */
- #define PHY_B_PEC_EX_IPG (1<<2) /* Bit 2: Extend Tx IPG Mode */
-@@ -981,7 +1002,7 @@ extern "C" {
- #define PHY_L_QS_DUP_MOD (1<<9) /* Bit 9: Full/Half Duplex */
- #define PHY_L_QS_AN (1<<8) /* Bit 8: AutoNeg is On */
- #define PHY_L_QS_AN_C (1<<7) /* Bit 7: AN is Complete */
--#define PHY_L_QS_LLE (7<<4) /* Bit 6: Line Length Estim. */
-+#define PHY_L_QS_LLE (7<<4) /* Bit 6..4: Line Length Estim. */
- #define PHY_L_QS_PAUSE (1<<3) /* Bit 3: LP advertised Pause */
- #define PHY_L_QS_AS_PAUSE (1<<2) /* Bit 2: LP adv. asym. Pause */
- #define PHY_L_QS_ISOLATE (1<<1) /* Bit 1: CIM Isolated */
-@@ -1029,9 +1050,8 @@ extern "C" {
- /* Bit 9..0: not described */
-
- /***** PHY_LONE_CIM 16 bit r/o CIM Reg *****/
--#define PHY_L_CIM_ISOL (255<<8)/* Bit 15..8: Isolate Count */
--#define PHY_L_CIM_FALSE_CAR (255<<0)/* Bit 7..0: False Carrier Count */
--
-+#define PHY_L_CIM_ISOL (0xff<<8) /* Bit 15..8: Isolate Count */
-+#define PHY_L_CIM_FALSE_CAR 0xff /* Bit 7..0: False Carrier Count */
-
- /*
- * Pause Bits (PHY_L_AN_ASP and PHY_L_AN_PC) encoding
-@@ -1041,7 +1061,6 @@ extern "C" {
- #define PHY_L_P_ASYM_MD (2<<10) /* Bit 11..10: asymmetric Pause Mode */
- #define PHY_L_P_BOTH_MD (3<<10) /* Bit 11..10: both Pause Mode */
-
--
- /*
- * National-Specific
- */
-@@ -1086,22 +1105,24 @@ extern "C" {
- */
- /***** PHY_MARV_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
- /***** PHY_MARV_AUNE_LP 16 bit r/w Link Part Ability Reg *****/
--#define PHY_M_AN_NXT_PG BIT_15 /* Request Next Page */
--#define PHY_M_AN_ACK BIT_14 /* (ro) Acknowledge Received */
--#define PHY_M_AN_RF BIT_13 /* Remote Fault */
-- /* Bit 12: reserved */
--#define PHY_M_AN_ASP BIT_11 /* Asymmetric Pause */
--#define PHY_M_AN_PC BIT_10 /* MAC Pause implemented */
--#define PHY_M_AN_100_FD BIT_8 /* Advertise 100Base-TX Full Duplex */
--#define PHY_M_AN_100_HD BIT_7 /* Advertise 100Base-TX Half Duplex */
--#define PHY_M_AN_10_FD BIT_6 /* Advertise 10Base-TX Full Duplex */
--#define PHY_M_AN_10_HD BIT_5 /* Advertise 10Base-TX Half Duplex */
--
--/* special defines for FIBER (88E1011S only) */
--#define PHY_M_AN_ASP_X BIT_8 /* Asymmetric Pause */
--#define PHY_M_AN_PC_X BIT_7 /* MAC Pause implemented */
--#define PHY_M_AN_1000X_AHD BIT_6 /* Advertise 10000Base-X Half Duplex */
--#define PHY_M_AN_1000X_AFD BIT_5 /* Advertise 10000Base-X Full Duplex */
-+#define PHY_M_AN_NXT_PG BIT_15S /* Request Next Page */
-+#define PHY_M_AN_ACK BIT_14S /* (ro) Acknowledge Received */
-+#define PHY_M_AN_RF BIT_13S /* Remote Fault */
-+ /* Bit 12: reserved */
-+#define PHY_M_AN_ASP BIT_11S /* Asymmetric Pause */
-+#define PHY_M_AN_PC BIT_10S /* MAC Pause implemented */
-+#define PHY_M_AN_100_T4 BIT_9S /* Not cap. 100Base-T4 (always 0) */
-+#define PHY_M_AN_100_FD BIT_8S /* Advertise 100Base-TX Full Duplex */
-+#define PHY_M_AN_100_HD BIT_7S /* Advertise 100Base-TX Half Duplex */
-+#define PHY_M_AN_10_FD BIT_6S /* Advertise 10Base-TX Full Duplex */
-+#define PHY_M_AN_10_HD BIT_5S /* Advertise 10Base-TX Half Duplex */
-+#define PHY_M_AN_SEL_MSK (0x1f<<4) /* Bit 4.. 0: Selector Field Mask */
-+
-+/* special defines for FIBER (88E1040S only) */
-+#define PHY_M_AN_ASP_X BIT_8S /* Asymmetric Pause */
-+#define PHY_M_AN_PC_X BIT_7S /* MAC Pause implemented */
-+#define PHY_M_AN_1000X_AHD BIT_6S /* Advertise 10000Base-X Half Duplex */
-+#define PHY_M_AN_1000X_AFD BIT_5S /* Advertise 10000Base-X Full Duplex */
-
- /* Pause Bits (PHY_M_AN_ASP_X and PHY_M_AN_PC_X) encoding */
- #define PHY_M_P_NO_PAUSE_X (0<<7) /* Bit 8.. 7: no Pause Mode */
-@@ -1111,105 +1132,167 @@ extern "C" {
-
- /***** PHY_MARV_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
- #define PHY_M_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */
--#define PHY_M_1000C_MSE (1<<12) /* Bit 12: Manual Master/Slave Enable */
--#define PHY_M_1000C_MSC (1<<11) /* Bit 11: M/S Configuration (1=Master) */
--#define PHY_M_1000C_MPD (1<<10) /* Bit 10: Multi-Port Device */
--#define PHY_M_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */
--#define PHY_M_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */
-+#define PHY_M_1000C_MSE BIT_12S /* Manual Master/Slave Enable */
-+#define PHY_M_1000C_MSC BIT_11S /* M/S Configuration (1=Master) */
-+#define PHY_M_1000C_MPD BIT_10S /* Multi-Port Device */
-+#define PHY_M_1000C_AFD BIT_9S /* Advertise Full Duplex */
-+#define PHY_M_1000C_AHD BIT_8S /* Advertise Half Duplex */
- /* Bit 7..0: reserved */
-
- /***** PHY_MARV_PHY_CTRL 16 bit r/w PHY Specific Ctrl Reg *****/
--#define PHY_M_PC_TX_FFD_MSK (3<<14) /* Bit 15..14: Tx FIFO Depth Mask */
--#define PHY_M_PC_RX_FFD_MSK (3<<12) /* Bit 13..12: Rx FIFO Depth Mask */
--#define PHY_M_PC_ASS_CRS_TX (1<<11) /* Bit 11: Assert CRS on Transmit */
--#define PHY_M_PC_FL_GOOD (1<<10) /* Bit 10: Force Link Good */
--#define PHY_M_PC_EN_DET_MSK (3<<8) /* Bit 9.. 8: Energy Detect Mask */
--#define PHY_M_PC_ENA_EXT_D (1<<7) /* Bit 7: Enable Ext. Distance (10BT) */
--#define PHY_M_PC_MDIX_MSK (3<<5) /* Bit 6.. 5: MDI/MDIX Config. Mask */
--#define PHY_M_PC_DIS_125CLK (1<<4) /* Bit 4: Disable 125 CLK */
--#define PHY_M_PC_MAC_POW_UP (1<<3) /* Bit 3: MAC Power up */
--#define PHY_M_PC_SQE_T_ENA (1<<2) /* Bit 2: SQE Test Enabled */
--#define PHY_M_PC_POL_R_DIS (1<<1) /* Bit 1: Polarity Reversal Disabled */
--#define PHY_M_PC_DIS_JABBER (1<<0) /* Bit 0: Disable Jabber */
-+#define PHY_M_PC_TX_FFD_MSK (3<<14) /* Bit 15..14: Tx FIFO Depth Mask */
-+#define PHY_M_PC_RX_FFD_MSK (3<<12) /* Bit 13..12: Rx FIFO Depth Mask */
-+#define PHY_M_PC_ASS_CRS_TX BIT_11S /* Assert CRS on Transmit */
-+#define PHY_M_PC_FL_GOOD BIT_10S /* Force Link Good */
-+#define PHY_M_PC_EN_DET_MSK (3<<8) /* Bit 9.. 8: Energy Detect Mask */
-+#define PHY_M_PC_ENA_EXT_D BIT_7S /* Enable Ext. Distance (10BT) */
-+#define PHY_M_PC_MDIX_MSK (3<<5) /* Bit 6.. 5: MDI/MDIX Config. Mask */
-+#define PHY_M_PC_DIS_125CLK BIT_4S /* Disable 125 CLK */
-+#define PHY_M_PC_MAC_POW_UP BIT_3S /* MAC Power up */
-+#define PHY_M_PC_SQE_T_ENA BIT_2S /* SQE Test Enabled */
-+#define PHY_M_PC_POL_R_DIS BIT_1S /* Polarity Reversal Disabled */
-+#define PHY_M_PC_DIS_JABBER BIT_0S /* Disable Jabber */
-
- #define PHY_M_PC_EN_DET SHIFT8(2) /* Energy Detect (Mode 1) */
- #define PHY_M_PC_EN_DET_PLUS SHIFT8(3) /* Energy Detect Plus (Mode 2) */
-
--#define PHY_M_PC_MDI_XMODE(x) SHIFT5(x)
--#define PHY_M_PC_MAN_MDI 0 /* 00 = Manual MDI configuration */
-+#define PHY_M_PC_MDI_XMODE(x) (SHIFT5(x) & PHY_M_PC_MDIX_MSK)
-+
-+#define PHY_M_PC_MAN_MDI 0 /* 00 = Manual MDI configuration */
- #define PHY_M_PC_MAN_MDIX 1 /* 01 = Manual MDIX configuration */
- #define PHY_M_PC_ENA_AUTO 3 /* 11 = Enable Automatic Crossover */
-
-+/* for Yukon-2/-EC Ultra Gigabit Ethernet PHY (88E1112/88E1149 only) */
-+#define PHY_M_PC_DIS_LINK_P BIT_15S /* Disable Link Pulses */
-+#define PHY_M_PC_DSC_MSK (7<<12) /* Bit 14..12: Downshift Counter */
-+#define PHY_M_PC_DOWN_S_ENA BIT_11S /* Downshift Enable */
-+ /* !!! Errata in spec. (1 = disable) */
-+
-+#define PHY_M_PC_DSC(x) (SHIFT12(x) & PHY_M_PC_DSC_MSK)
-+ /* 000=1x; 001=2x; 010=3x; 011=4x */
-+ /* 100=5x; 101=6x; 110=7x; 111=8x */
-+
-+/* for Yukon-EC Ultra Gigabit Ethernet PHY (88E1149 only) */
-+ /* Bit 4: reserved */
-+#define PHY_M_PC_COP_TX_DIS BIT_3S /* Copper Transmitter Disable */
-+#define PHY_M_PC_POW_D_ENA BIT_2S /* Power Down Enable */
-+
-+/* for 10/100 Fast Ethernet PHY (88E3082 only) */
-+#define PHY_M_PC_ENA_DTE_DT BIT_15S /* Enable Data Terminal Equ. (DTE) Detect */
-+#define PHY_M_PC_ENA_ENE_DT BIT_14S /* Enable Energy Detect (sense & pulse) */
-+#define PHY_M_PC_DIS_NLP_CK BIT_13S /* Disable Normal Link Puls (NLP) Check */
-+#define PHY_M_PC_ENA_LIP_NP BIT_12S /* Enable Link Partner Next Page Reg. */
-+#define PHY_M_PC_DIS_NLP_GN BIT_11S /* Disable Normal Link Puls Generation */
-+
-+#define PHY_M_PC_DIS_SCRAMB BIT_9S /* Disable Scrambler */
-+#define PHY_M_PC_DIS_FEFI BIT_8S /* Disable Far End Fault Indic. (FEFI) */
-+
-+#define PHY_M_PC_SH_TP_SEL BIT_6S /* Shielded Twisted Pair Select */
-+#define PHY_M_PC_RX_FD_MSK (3<<2) /* Bit 3.. 2: Rx FIFO Depth Mask */
-+
- /***** PHY_MARV_PHY_STAT 16 bit r/o PHY Specific Status Reg *****/
--#define PHY_M_PS_SPEED_MSK (3<<14) /* Bit 15..14: Speed Mask */
--#define PHY_M_PS_SPEED_1000 (1<<15) /* 10 = 1000 Mbps */
--#define PHY_M_PS_SPEED_100 (1<<14) /* 01 = 100 Mbps */
--#define PHY_M_PS_SPEED_10 0 /* 00 = 10 Mbps */
--#define PHY_M_PS_FULL_DUP (1<<13) /* Bit 13: Full Duplex */
--#define PHY_M_PS_PAGE_REC (1<<12) /* Bit 12: Page Received */
--#define PHY_M_PS_SPDUP_RES (1<<11) /* Bit 11: Speed & Duplex Resolved */
--#define PHY_M_PS_LINK_UP (1<<10) /* Bit 10: Link Up */
--#define PHY_M_PS_CABLE_MSK (3<<7) /* Bit 9.. 7: Cable Length Mask */
--#define PHY_M_PS_MDI_X_STAT (1<<6) /* Bit 6: MDI Crossover Stat (1=MDIX) */
--#define PHY_M_PS_DOWNS_STAT (1<<5) /* Bit 5: Downshift Status (1=downsh.) */
--#define PHY_M_PS_ENDET_STAT (1<<4) /* Bit 4: Energy Detect Status (1=act) */
--#define PHY_M_PS_TX_P_EN (1<<3) /* Bit 3: Tx Pause Enabled */
--#define PHY_M_PS_RX_P_EN (1<<2) /* Bit 2: Rx Pause Enabled */
--#define PHY_M_PS_POL_REV (1<<1) /* Bit 1: Polarity Reversed */
--#define PHY_M_PC_JABBER (1<<0) /* Bit 0: Jabber */
-+#define PHY_M_PS_SPEED_MSK (3<<14) /* Bit 15..14: Speed Mask */
-+#define PHY_M_PS_SPEED_1000 BIT_15S /* 10 = 1000 Mbps */
-+#define PHY_M_PS_SPEED_100 BIT_14S /* 01 = 100 Mbps */
-+#define PHY_M_PS_SPEED_10 0 /* 00 = 10 Mbps */
-+#define PHY_M_PS_FULL_DUP BIT_13S /* Full Duplex */
-+#define PHY_M_PS_PAGE_REC BIT_12S /* Page Received */
-+#define PHY_M_PS_SPDUP_RES BIT_11S /* Speed & Duplex Resolved */
-+#define PHY_M_PS_LINK_UP BIT_10S /* Link Up */
-+#define PHY_M_PS_CABLE_MSK (7<<7) /* Bit 9.. 7: Cable Length Mask */
-+#define PHY_M_PS_MDI_X_STAT BIT_6S /* MDI Crossover Stat (1=MDIX) */
-+#define PHY_M_PS_DOWNS_STAT BIT_5S /* Downshift Status (1=downsh.) */
-+#define PHY_M_PS_ENDET_STAT BIT_4S /* Energy Detect Status (1=act) */
-+#define PHY_M_PS_TX_P_EN BIT_3S /* Tx Pause Enabled */
-+#define PHY_M_PS_RX_P_EN BIT_2S /* Rx Pause Enabled */
-+#define PHY_M_PS_POL_REV BIT_1S /* Polarity Reversed */
-+#define PHY_M_PS_JABBER BIT_0S /* Jabber */
-
- #define PHY_M_PS_PAUSE_MSK (PHY_M_PS_TX_P_EN | PHY_M_PS_RX_P_EN)
-
-+/* for 10/100 Fast Ethernet PHY (88E3082 only) */
-+#define PHY_M_PS_DTE_DETECT BIT_15S /* Data Terminal Equipment (DTE) Detected */
-+#define PHY_M_PS_RES_SPEED BIT_14S /* Resolved Speed (1=100 Mbps, 0=10 Mbps */
-+
- /***** PHY_MARV_INT_MASK 16 bit r/w Interrupt Mask Reg *****/
- /***** PHY_MARV_INT_STAT 16 bit r/o Interrupt Status Reg *****/
--#define PHY_M_IS_AN_ERROR (1<<15) /* Bit 15: Auto-Negotiation Error */
--#define PHY_M_IS_LSP_CHANGE (1<<14) /* Bit 14: Link Speed Changed */
--#define PHY_M_IS_DUP_CHANGE (1<<13) /* Bit 13: Duplex Mode Changed */
--#define PHY_M_IS_AN_PR (1<<12) /* Bit 12: Page Received */
--#define PHY_M_IS_AN_COMPL (1<<11) /* Bit 11: Auto-Negotiation Completed */
--#define PHY_M_IS_LST_CHANGE (1<<10) /* Bit 10: Link Status Changed */
--#define PHY_M_IS_SYMB_ERROR (1<<9) /* Bit 9: Symbol Error */
--#define PHY_M_IS_FALSE_CARR (1<<8) /* Bit 8: False Carrier */
--#define PHY_M_IS_FIFO_ERROR (1<<7) /* Bit 7: FIFO Overflow/Underrun Error */
--#define PHY_M_IS_MDI_CHANGE (1<<6) /* Bit 6: MDI Crossover Changed */
--#define PHY_M_IS_DOWNSH_DET (1<<5) /* Bit 5: Downshift Detected */
--#define PHY_M_IS_END_CHANGE (1<<4) /* Bit 4: Energy Detect Changed */
-- /* Bit 3..2: reserved */
--#define PHY_M_IS_POL_CHANGE (1<<1) /* Bit 1: Polarity Changed */
--#define PHY_M_IS_JABBER (1<<0) /* Bit 0: Jabber */
-+#define PHY_M_IS_AN_ERROR BIT_15S /* Auto-Negotiation Error */
-+#define PHY_M_IS_LSP_CHANGE BIT_14S /* Link Speed Changed */
-+#define PHY_M_IS_DUP_CHANGE BIT_13S /* Duplex Mode Changed */
-+#define PHY_M_IS_AN_PR BIT_12S /* Page Received */
-+#define PHY_M_IS_AN_COMPL BIT_11S /* Auto-Negotiation Completed */
-+#define PHY_M_IS_LST_CHANGE BIT_10S /* Link Status Changed */
-+#define PHY_M_IS_SYMB_ERROR BIT_9S /* Symbol Error */
-+#define PHY_M_IS_FALSE_CARR BIT_8S /* False Carrier */
-+#define PHY_M_IS_FIFO_ERROR BIT_7S /* FIFO Overflow/Underrun Error */
-+#define PHY_M_IS_MDI_CHANGE BIT_6S /* MDI Crossover Changed */
-+#define PHY_M_IS_DOWNSH_DET BIT_5S /* Downshift Detected */
-+#define PHY_M_IS_END_CHANGE BIT_4S /* Energy Detect Changed */
-+ /* Bit 3: reserved */
-+#define PHY_M_IS_DTE_CHANGE BIT_2S /* DTE Power Det. Status Changed */
-+ /* (88E1111 only) */
-+#define PHY_M_IS_POL_CHANGE BIT_1S /* Polarity Changed */
-+#define PHY_M_IS_JABBER BIT_0S /* Jabber */
-
- #define PHY_M_DEF_MSK (PHY_M_IS_AN_ERROR | PHY_M_IS_AN_PR | \
- PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR)
-
- /***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/
--#define PHY_M_EC_M_DSC_MSK (3<<10) /* Bit 11..10: Master downshift counter */
--#define PHY_M_EC_S_DSC_MSK (3<<8) /* Bit 9.. 8: Slave downshift counter */
-+#define PHY_M_EC_ENA_BC_EXT BIT_15S /* Enable Block Carr. Ext. (88E1111 only) */
-+#define PHY_M_EC_ENA_LIN_LB BIT_14S /* Enable Line Loopback (88E1111 only) */
-+ /* Bit 13: reserved */
-+#define PHY_M_EC_DIS_LINK_P BIT_12S /* Disable Link Pulses (88E1111 only) */
-+#define PHY_M_EC_M_DSC_MSK (3<<10) /* Bit 11..10: Master Downshift Counter */
-+ /* (88E1040 Rev.C0 only) */
-+#define PHY_M_EC_S_DSC_MSK (3<<8) /* Bit 9.. 8: Slave Downshift Counter */
-+ /* (88E1040 Rev.C0 only) */
-+#define PHY_M_EC_DSC_MSK_2 (7<<9) /* Bit 11.. 9: Downshift Counter */
-+ /* (88E1040 Rev.D0 and higher) */
-+#define PHY_M_EC_DOWN_S_ENA BIT_8S /* Downshift Enable (88E1040 Rev.D0 and */
-+ /* 88E1111 !!! Errata in spec. (1=dis.) */
-+#define PHY_M_EC_RX_TIM_CT BIT_7S /* RGMII Rx Timing Control*/
- #define PHY_M_EC_MAC_S_MSK (7<<4) /* Bit 6.. 4: Def. MAC interface speed */
--#define PHY_M_EC_FIB_AN_ENA (1<<3) /* Bit 3: Fiber Auto-Neg. Enable */
--
--#define PHY_M_EC_M_DSC(x) SHIFT10(x) /* 00=1x; 01=2x; 10=3x; 11=4x */
--#define PHY_M_EC_S_DSC(x) SHIFT8(x) /* 00=dis; 01=1x; 10=2x; 11=3x */
--#define PHY_M_EC_MAC_S(x) SHIFT4(x) /* 01X=0; 110=2.5; 111=25 (MHz) */
--
-+#define PHY_M_EC_FIB_AN_ENA BIT_3S /* Fiber Auto-Neg. Enable 88E1040S only) */
-+#define PHY_M_EC_DTE_D_ENA BIT_2S /* DTE Detect Enable (88E1111 only) */
-+#define PHY_M_EC_TX_TIM_CT BIT_1S /* RGMII Tx Timing Control */
-+#define PHY_M_EC_TRANS_DIS BIT_0S /* Transmitter Disable (88E1111 only) */
-+
-+#define PHY_M_EC_M_DSC(x) (SHIFT10(x) & PHY_M_EC_M_DSC_MSK)
-+ /* 00=1x; 01=2x; 10=3x; 11=4x */
-+#define PHY_M_EC_S_DSC(x) (SHIFT8(x) & PHY_M_EC_S_DSC_MSK)
-+ /* 00=dis; 01=1x; 10=2x; 11=3x */
-+#define PHY_M_EC_MAC_S(x) (SHIFT4(x) & PHY_M_EC_MAC_S_MSK)
-+ /* 01X=0; 110=2.5; 111=25 (MHz) */
-+
-+#define PHY_M_EC_DSC_2(x) (SHIFT9(x) & PHY_M_EC_DSC_MSK_2)
-+ /* 000=1x; 001=2x; 010=3x; 011=4x */
-+ /* 100=5x; 101=6x; 110=7x; 111=8x */
- #define MAC_TX_CLK_0_MHZ 2
- #define MAC_TX_CLK_2_5_MHZ 6
- #define MAC_TX_CLK_25_MHZ 7
-
- /***** PHY_MARV_LED_CTRL 16 bit r/w LED Control Reg *****/
--#define PHY_M_LEDC_DIS_LED (1<<15) /* Bit 15: Disable LED */
--#define PHY_M_LEDC_PULS_MSK (7<<12) /* Bit 14..12: Pulse Stretch Mask */
--#define PHY_M_LEDC_F_INT (1<<11) /* Bit 11: Force Interrupt */
--#define PHY_M_LEDC_BL_R_MSK (7<<8) /* Bit 10.. 8: Blink Rate Mask */
-- /* Bit 7.. 5: reserved */
--#define PHY_M_LEDC_LINK_MSK (3<<3) /* Bit 4.. 3: Link Control Mask */
--#define PHY_M_LEDC_DP_CTRL (1<<2) /* Bit 2: Duplex Control */
--#define PHY_M_LEDC_RX_CTRL (1<<1) /* Bit 1: Rx activity / Link */
--#define PHY_M_LEDC_TX_CTRL (1<<0) /* Bit 0: Tx activity / Link */
-+#define PHY_M_LEDC_DIS_LED BIT_15S /* Disable LED */
-+#define PHY_M_LEDC_PULS_MSK (7<<12) /* Bit 14..12: Pulse Stretch Mask */
-+#define PHY_M_LEDC_F_INT BIT_11S /* Force Interrupt */
-+#define PHY_M_LEDC_BL_R_MSK (7<<8) /* Bit 10.. 8: Blink Rate Mask */
-+#define PHY_M_LEDC_DP_C_LSB BIT_7S /* Duplex Control (LSB, 88E1111 only) */
-+#define PHY_M_LEDC_TX_C_LSB BIT_6S /* Tx Control (LSB, 88E1111 only) */
-+#define PHY_M_LEDC_LK_C_MSK (7<<3) /* Bit 5.. 3: Link Control Mask */
-+ /* (88E1111 only) */
-+ /* Bit 7.. 5: reserved (88E1040 only) */
-+#define PHY_M_LEDC_LINK_MSK (3<<3) /* Bit 4.. 3: Link Control Mask */
-+ /* (88E1040 only) */
-+#define PHY_M_LEDC_DP_CTRL BIT_2S /* Duplex Control */
-+#define PHY_M_LEDC_DP_C_MSB BIT_2S /* Duplex Control (MSB, 88E1111 only) */
-+#define PHY_M_LEDC_RX_CTRL BIT_1S /* Rx Activity / Link */
-+#define PHY_M_LEDC_TX_CTRL BIT_0S /* Tx Activity / Link */
-+#define PHY_M_LEDC_TX_C_MSB BIT_0S /* Tx Control (MSB, 88E1111 only) */
-
--#define PHY_M_LED_PULS_DUR(x) SHIFT12(x) /* Pulse Stretch Duration */
-+#define PHY_M_LED_PULS_DUR(x) (SHIFT12(x) & PHY_M_LEDC_PULS_MSK)
-
--#define PULS_NO_STR 0 /* no pulse stretching */
--#define PULS_21MS 1 /* 21 ms to 42 ms */
-+#define PULS_NO_STR 0 /* no pulse stretching */
-+#define PULS_21MS 1 /* 21 ms to 42 ms */
- #define PULS_42MS 2 /* 42 ms to 84 ms */
- #define PULS_84MS 3 /* 84 ms to 170 ms */
- #define PULS_170MS 4 /* 170 ms to 340 ms */
-@@ -1217,7 +1300,7 @@ extern "C" {
- #define PULS_670MS 6 /* 670 ms to 1.3 s */
- #define PULS_1300MS 7 /* 1.3 s to 2.7 s */
-
--#define PHY_M_LED_BLINK_RT(x) SHIFT8(x) /* Blink Rate */
-+#define PHY_M_LED_BLINK_RT(x) (SHIFT8(x) & PHY_M_LEDC_BL_R_MSK)
-
- #define BLINK_42MS 0 /* 42 ms */
- #define BLINK_84MS 1 /* 84 ms */
-@@ -1227,6 +1310,8 @@ extern "C" {
- /* values 5 - 7: reserved */
-
- /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/
-+#define PHY_M_LED_MO_SGMII(x) SHIFT14(x) /* Bit 15..14: SGMII AN Timer */
-+ /* Bit 13..12: reserved */
- #define PHY_M_LED_MO_DUP(x) SHIFT10(x) /* Bit 11..10: Duplex */
- #define PHY_M_LED_MO_10(x) SHIFT8(x) /* Bit 9.. 8: Link 10 */
- #define PHY_M_LED_MO_100(x) SHIFT6(x) /* Bit 7.. 6: Link 100 */
-@@ -1240,30 +1325,35 @@ extern "C" {
- #define MO_LED_ON 3
-
- /***** PHY_MARV_EXT_CTRL_2 16 bit r/w Ext. PHY Specific Ctrl 2 *****/
-- /* Bit 15.. 7: reserved */
--#define PHY_M_EC2_FI_IMPED (1<<6) /* Bit 6: Fiber Input Impedance */
--#define PHY_M_EC2_FO_IMPED (1<<5) /* Bit 5: Fiber Output Impedance */
--#define PHY_M_EC2_FO_M_CLK (1<<4) /* Bit 4: Fiber Mode Clock Enable */
--#define PHY_M_EC2_FO_BOOST (1<<3) /* Bit 3: Fiber Output Boost */
-+ /* Bit 15.. 7: reserved */
-+#define PHY_M_EC2_FI_IMPED BIT_6S /* Fiber Input Impedance */
-+#define PHY_M_EC2_FO_IMPED BIT_5S /* Fiber Output Impedance */
-+#define PHY_M_EC2_FO_M_CLK BIT_4S /* Fiber Mode Clock Enable */
-+#define PHY_M_EC2_FO_BOOST BIT_3S /* Fiber Output Boost */
- #define PHY_M_EC2_FO_AM_MSK 7 /* Bit 2.. 0: Fiber Output Amplitude */
-
--/***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/
--#define PHY_M_FC_AUTO_SEL (1<<15) /* Bit 15: Fiber/Copper Auto Sel. dis. */
--#define PHY_M_FC_AN_REG_ACC (1<<14) /* Bit 14: Fiber/Copper Autoneg. reg acc */
--#define PHY_M_FC_RESULUTION (1<<13) /* Bit 13: Fiber/Copper Resulution */
--#define PHY_M_SER_IF_AN_BP (1<<12) /* Bit 12: Ser IF autoneg. bypass enable */
--#define PHY_M_SER_IF_BP_ST (1<<11) /* Bit 11: Ser IF autoneg. bypass status */
--#define PHY_M_IRQ_POLARITY (1<<10) /* Bit 10: IRQ polarity */
-- /* Bit 9..4: reserved */
--#define PHY_M_UNDOC1 (1<< 7) /* undocumented bit !! */
--#define PHY_M_MODE_MASK (0xf<<0)/* Bit 3..0: copy of HWCFG MODE[3:0] */
--
-+/***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/
-+#define PHY_M_FC_AUTO_SEL BIT_15S /* Fiber/Copper Auto Sel. Dis. */
-+#define PHY_M_FC_AN_REG_ACC BIT_14S /* Fiber/Copper AN Reg. Access */
-+#define PHY_M_FC_RESOLUTION BIT_13S /* Fiber/Copper Resolution */
-+#define PHY_M_SER_IF_AN_BP BIT_12S /* Ser. IF AN Bypass Enable */
-+#define PHY_M_SER_IF_BP_ST BIT_11S /* Ser. IF AN Bypass Status */
-+#define PHY_M_IRQ_POLARITY BIT_10S /* IRQ polarity */
-+#define PHY_M_DIS_AUT_MED BIT_9S /* Disable Aut. Medium Reg. Selection */
-+ /* (88E1111 only) */
-+ /* Bit 9.. 4: reserved (88E1040 only) */
-+#define PHY_M_UNDOC1 BIT_7S /* undocumented bit !! */
-+#define PHY_M_DTE_POW_STAT BIT_4S /* DTE Power Status (88E1111 only) */
-+#define PHY_M_MODE_MASK 0xf /* Bit 3.. 0: copy of HWCFG MODE[3:0] */
-
- /***** PHY_MARV_CABLE_DIAG 16 bit r/o Cable Diagnostic Reg *****/
--#define PHY_M_CABD_ENA_TEST (1<<15) /* Bit 15: Enable Test */
--#define PHY_M_CABD_STAT_MSK (3<<13) /* Bit 14..13: Status */
-- /* Bit 12.. 8: reserved */
--#define PHY_M_CABD_DIST_MSK 0xff /* Bit 7.. 0: Distance */
-+#define PHY_M_CABD_ENA_TEST BIT_15S /* Enable Test (Page 0) */
-+#define PHY_M_CABD_DIS_WAIT BIT_15S /* Disable Waiting Period (Page 1) */
-+ /* (88E1111 only) */
-+#define PHY_M_CABD_STAT_MSK (3<<13) /* Bit 14..13: Status Mask */
-+#define PHY_M_CABD_AMPL_MSK (0x1f<<8) /* Bit 12.. 8: Amplitude Mask */
-+ /* (88E1111 only) */
-+#define PHY_M_CABD_DIST_MSK 0xff /* Bit 7.. 0: Distance Mask */
-
- /* values for Cable Diagnostic Status (11=fail; 00=OK; 10=open; 01=short) */
- #define CABD_STAT_NORMAL 0
-@@ -1271,6 +1361,79 @@ extern "C" {
- #define CABD_STAT_OPEN 2
- #define CABD_STAT_FAIL 3
-
-+/* for 10/100 Fast Ethernet PHY (88E3082 only) */
-+/***** PHY_MARV_FE_LED_PAR 16 bit r/w LED Parallel Select Reg. *****/
-+ /* Bit 15..12: reserved (used internally) */
-+#define PHY_M_FELP_LED2_MSK (0xf<<8) /* Bit 11.. 8: LED2 Mask (LINK) */
-+#define PHY_M_FELP_LED1_MSK (0xf<<4) /* Bit 7.. 4: LED1 Mask (ACT) */
-+#define PHY_M_FELP_LED0_MSK 0xf /* Bit 3.. 0: LED0 Mask (SPEED) */
-+
-+#define PHY_M_FELP_LED2_CTRL(x) (SHIFT8(x) & PHY_M_FELP_LED2_MSK)
-+#define PHY_M_FELP_LED1_CTRL(x) (SHIFT4(x) & PHY_M_FELP_LED1_MSK)
-+#define PHY_M_FELP_LED0_CTRL(x) (SHIFT0(x) & PHY_M_FELP_LED0_MSK)
-+
-+#define LED_PAR_CTRL_COLX 0x00
-+#define LED_PAR_CTRL_ERROR 0x01
-+#define LED_PAR_CTRL_DUPLEX 0x02
-+#define LED_PAR_CTRL_DP_COL 0x03
-+#define LED_PAR_CTRL_SPEED 0x04
-+#define LED_PAR_CTRL_LINK 0x05
-+#define LED_PAR_CTRL_TX 0x06
-+#define LED_PAR_CTRL_RX 0x07
-+#define LED_PAR_CTRL_ACT 0x08
-+#define LED_PAR_CTRL_LNK_RX 0x09
-+#define LED_PAR_CTRL_LNK_AC 0x0a
-+#define LED_PAR_CTRL_ACT_BL 0x0b
-+#define LED_PAR_CTRL_TX_BL 0x0c
-+#define LED_PAR_CTRL_RX_BL 0x0d
-+#define LED_PAR_CTRL_COL_BL 0x0e
-+#define LED_PAR_CTRL_INACT 0x0f
-+
-+/***** PHY_MARV_FE_SPEC_2 16 bit r/w Specific Control Reg. 2 *****/
-+#define PHY_M_FESC_DIS_WAIT BIT_2S /* Disable TDR Waiting Period */
-+#define PHY_M_FESC_ENA_MCLK BIT_1S /* Enable MAC Rx Clock in sleep mode */
-+#define PHY_M_FESC_SEL_CL_A BIT_0S /* Select Class A driver (100B-TX) */
-+
-+/* for Yukon-2 Gigabit Ethernet PHY (88E1112 only) */
-+/***** PHY_MARV_PHY_CTRL (page 1) 16 bit r/w Fiber Specific Ctrl *****/
-+#define PHY_M_FIB_FORCE_LNK BIT_10S /* Force Link Good */
-+#define PHY_M_FIB_SIGD_POL BIT_9S /* SIGDET Polarity */
-+#define PHY_M_FIB_TX_DIS BIT_3S /* Transmitter Disable */
-+
-+/***** PHY_MARV_PHY_CTRL (page 2) 16 bit r/w MAC Specific Ctrl *****/
-+#define PHY_M_MAC_MD_MSK (7<<7) /* Bit 9.. 7: Mode Select Mask */
-+#define PHY_M_MAC_GMIF_PUP BIT_3S /* GMII Power Up (88E1149 only) */
-+
-+#define PHY_M_MAC_MD_AUTO 3 /* Auto Copper/1000Base-X */
-+#define PHY_M_MAC_MD_COPPER 5 /* Copper only */
-+#define PHY_M_MAC_MD_1000BX 7 /* 1000Base-X only */
-+#define PHY_M_MAC_MODE_SEL(x) (SHIFT7(x) & PHY_M_MAC_MD_MSK)
-+
-+/***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/
-+#define PHY_M_LEDC_LOS_MSK (0xf<<12) /* Bit 15..12: LOS LED Ctrl. Mask */
-+#define PHY_M_LEDC_INIT_MSK (0xf<<8) /* Bit 11.. 8: INIT LED Ctrl. Mask */
-+#define PHY_M_LEDC_STA1_MSK (0xf<<4) /* Bit 7.. 4: STAT1 LED Ctrl. Mask */
-+#define PHY_M_LEDC_STA0_MSK 0xf /* Bit 3.. 0: STAT0 LED Ctrl. Mask */
-+
-+#define PHY_M_LEDC_LOS_CTRL(x) (SHIFT12(x) & PHY_M_LEDC_LOS_MSK)
-+#define PHY_M_LEDC_INIT_CTRL(x) (SHIFT8(x) & PHY_M_LEDC_INIT_MSK)
-+#define PHY_M_LEDC_STA1_CTRL(x) (SHIFT4(x) & PHY_M_LEDC_STA1_MSK)
-+#define PHY_M_LEDC_STA0_CTRL(x) (SHIFT0(x) & PHY_M_LEDC_STA0_MSK)
-+
-+/***** PHY_MARV_PHY_STAT (page 3) 16 bit r/w Polarity Control Reg. *****/
-+#define PHY_M_POLC_LS1M_MSK (0xf<<12) /* Bit 15..12: LOS,STAT1 Mix % Mask */
-+#define PHY_M_POLC_IS0M_MSK (0xf<<8) /* Bit 11.. 8: INIT,STAT0 Mix % Mask */
-+#define PHY_M_POLC_LOS_MSK (0x3<<6) /* Bit 7.. 6: LOS Pol. Ctrl. Mask */
-+#define PHY_M_POLC_INIT_MSK (0x3<<4) /* Bit 5.. 4: INIT Pol. Ctrl. Mask */
-+#define PHY_M_POLC_STA1_MSK (0x3<<2) /* Bit 3.. 2: STAT1 Pol. Ctrl. Mask */
-+#define PHY_M_POLC_STA0_MSK 0x3 /* Bit 1.. 0: STAT0 Pol. Ctrl. Mask */
-+
-+#define PHY_M_POLC_LS1_P_MIX(x) (SHIFT12(x) & PHY_M_POLC_LS1M_MSK)
-+#define PHY_M_POLC_IS0_P_MIX(x) (SHIFT8(x) & PHY_M_POLC_IS0M_MSK)
-+#define PHY_M_POLC_LOS_CTRL(x) (SHIFT6(x) & PHY_M_POLC_LOS_MSK)
-+#define PHY_M_POLC_INIT_CTRL(x) (SHIFT4(x) & PHY_M_POLC_INIT_MSK)
-+#define PHY_M_POLC_STA1_CTRL(x) (SHIFT2(x) & PHY_M_POLC_STA1_MSK)
-+#define PHY_M_POLC_STA0_CTRL(x) (SHIFT0(x) & PHY_M_POLC_STA0_MSK)
-
- /*
- * GMAC registers
-@@ -1431,141 +1594,159 @@ extern "C" {
- */
-
- /* GM_GP_STAT 16 bit r/o General Purpose Status Register */
--#define GM_GPSR_SPEED (1<<15) /* Bit 15: Port Speed (1 = 100 Mbps) */
--#define GM_GPSR_DUPLEX (1<<14) /* Bit 14: Duplex Mode (1 = Full) */
--#define GM_GPSR_FC_TX_DIS (1<<13) /* Bit 13: Tx Flow-Control Mode Disabled */
--#define GM_GPSR_LINK_UP (1<<12) /* Bit 12: Link Up Status */
--#define GM_GPSR_PAUSE (1<<11) /* Bit 11: Pause State */
--#define GM_GPSR_TX_ACTIVE (1<<10) /* Bit 10: Tx in Progress */
--#define GM_GPSR_EXC_COL (1<<9) /* Bit 9: Excessive Collisions Occured */
--#define GM_GPSR_LAT_COL (1<<8) /* Bit 8: Late Collisions Occured */
-- /* Bit 7..6: reserved */
--#define GM_GPSR_PHY_ST_CH (1<<5) /* Bit 5: PHY Status Change */
--#define GM_GPSR_GIG_SPEED (1<<4) /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */
--#define GM_GPSR_PART_MODE (1<<3) /* Bit 3: Partition mode */
--#define GM_GPSR_FC_RX_DIS (1<<2) /* Bit 2: Rx Flow-Control Mode Disabled */
--#define GM_GPSR_PROM_EN (1<<1) /* Bit 1: Promiscuous Mode Enabled */
-- /* Bit 0: reserved */
--
-+#define GM_GPSR_SPEED BIT_15S /* Port Speed (1 = 100 Mbps) */
-+#define GM_GPSR_DUPLEX BIT_14S /* Duplex Mode (1 = Full) */
-+#define GM_GPSR_FC_TX_DIS BIT_13S /* Tx Flow-Control Mode Disabled */
-+#define GM_GPSR_LINK_UP BIT_12S /* Link Up Status */
-+#define GM_GPSR_PAUSE BIT_11S /* Pause State */
-+#define GM_GPSR_TX_ACTIVE BIT_10S /* Tx in Progress */
-+#define GM_GPSR_EXC_COL BIT_9S /* Excessive Collisions Occured */
-+#define GM_GPSR_LAT_COL BIT_8S /* Late Collisions Occured */
-+ /* Bit 7.. 6: reserved */
-+#define GM_GPSR_PHY_ST_CH BIT_5S /* PHY Status Change */
-+#define GM_GPSR_GIG_SPEED BIT_4S /* Gigabit Speed (1 = 1000 Mbps) */
-+#define GM_GPSR_PART_MODE BIT_3S /* Partition mode */
-+#define GM_GPSR_FC_RX_DIS BIT_2S /* Rx Flow-Control Mode Disabled */
-+ /* Bit 2.. 0: reserved */
-+
- /* GM_GP_CTRL 16 bit r/w General Purpose Control Register */
-- /* Bit 15: reserved */
--#define GM_GPCR_PROM_ENA (1<<14) /* Bit 14: Enable Promiscuous Mode */
--#define GM_GPCR_FC_TX_DIS (1<<13) /* Bit 13: Disable Tx Flow-Control Mode */
--#define GM_GPCR_TX_ENA (1<<12) /* Bit 12: Enable Transmit */
--#define GM_GPCR_RX_ENA (1<<11) /* Bit 11: Enable Receive */
--#define GM_GPCR_BURST_ENA (1<<10) /* Bit 10: Enable Burst Mode */
--#define GM_GPCR_LOOP_ENA (1<<9) /* Bit 9: Enable MAC Loopback Mode */
--#define GM_GPCR_PART_ENA (1<<8) /* Bit 8: Enable Partition Mode */
--#define GM_GPCR_GIGS_ENA (1<<7) /* Bit 7: Gigabit Speed (1000 Mbps) */
--#define GM_GPCR_FL_PASS (1<<6) /* Bit 6: Force Link Pass */
--#define GM_GPCR_DUP_FULL (1<<5) /* Bit 5: Full Duplex Mode */
--#define GM_GPCR_FC_RX_DIS (1<<4) /* Bit 4: Disable Rx Flow-Control Mode */
--#define GM_GPCR_SPEED_100 (1<<3) /* Bit 3: Port Speed 100 Mbps */
--#define GM_GPCR_AU_DUP_DIS (1<<2) /* Bit 2: Disable Auto-Update Duplex */
--#define GM_GPCR_AU_FCT_DIS (1<<1) /* Bit 1: Disable Auto-Update Flow-C. */
--#define GM_GPCR_AU_SPD_DIS (1<<0) /* Bit 0: Disable Auto-Update Speed */
-+#define GM_GPCR_RMII_PH_ENA BIT_15S /* Enable RMII for PHY (Yukon-FE only) */
-+#define GM_GPCR_RMII_LB_ENA BIT_14S /* Enable RMII Loopback (Yukon-FE only) */
-+#define GM_GPCR_FC_TX_DIS BIT_13S /* Disable Tx Flow-Control Mode */
-+#define GM_GPCR_TX_ENA BIT_12S /* Enable Transmit */
-+#define GM_GPCR_RX_ENA BIT_11S /* Enable Receive */
-+ /* Bit 10: reserved */
-+#define GM_GPCR_LOOP_ENA BIT_9S /* Enable MAC Loopback Mode */
-+#define GM_GPCR_PART_ENA BIT_8S /* Enable Partition Mode */
-+#define GM_GPCR_GIGS_ENA BIT_7S /* Gigabit Speed (1000 Mbps) */
-+#define GM_GPCR_FL_PASS BIT_6S /* Force Link Pass */
-+#define GM_GPCR_DUP_FULL BIT_5S /* Full Duplex Mode */
-+#define GM_GPCR_FC_RX_DIS BIT_4S /* Disable Rx Flow-Control Mode */
-+#define GM_GPCR_SPEED_100 BIT_3S /* Port Speed 100 Mbps */
-+#define GM_GPCR_AU_DUP_DIS BIT_2S /* Disable Auto-Update Duplex */
-+#define GM_GPCR_AU_FCT_DIS BIT_1S /* Disable Auto-Update Flow-C. */
-+#define GM_GPCR_AU_SPD_DIS BIT_0S /* Disable Auto-Update Speed */
-
- #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
- #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS |\
- GM_GPCR_AU_SPD_DIS)
--
-+
- /* GM_TX_CTRL 16 bit r/w Transmit Control Register */
--#define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */
--#define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */
--#define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */
--#define GM_TXCR_COL_THR_MSK (1<<10) /* Bit 12..10: Collision Threshold */
-+#define GM_TXCR_FORCE_JAM BIT_15S /* Force Jam / Flow-Control */
-+#define GM_TXCR_CRC_DIS BIT_14S /* Disable insertion of CRC */
-+#define GM_TXCR_PAD_DIS BIT_13S /* Disable padding of packets */
-+#define GM_TXCR_COL_THR_MSK (7<<10) /* Bit 12..10: Collision Threshold Mask */
-+ /* Bit 9.. 8: reserved */
-+#define GM_TXCR_PAD_PAT_MSK 0xff /* Bit 7.. 0: Padding Pattern Mask */
-+ /* (Yukon-2 only) */
-
- #define TX_COL_THR(x) (SHIFT10(x) & GM_TXCR_COL_THR_MSK)
-
- #define TX_COL_DEF 0x04
--
-+
- /* GM_RX_CTRL 16 bit r/w Receive Control Register */
--#define GM_RXCR_UCF_ENA (1<<15) /* Bit 15: Enable Unicast filtering */
--#define GM_RXCR_MCF_ENA (1<<14) /* Bit 14: Enable Multicast filtering */
--#define GM_RXCR_CRC_DIS (1<<13) /* Bit 13: Remove 4-byte CRC */
--#define GM_RXCR_PASS_FC (1<<12) /* Bit 12: Pass FC packets to FIFO */
--
-+#define GM_RXCR_UCF_ENA BIT_15S /* Enable Unicast filtering */
-+#define GM_RXCR_MCF_ENA BIT_14S /* Enable Multicast filtering */
-+#define GM_RXCR_CRC_DIS BIT_13S /* Remove 4-byte CRC */
-+#define GM_RXCR_PASS_FC BIT_12S /* Pass FC packets to FIFO (Yukon-1 only) */
-+ /* Bit 11.. 0: reserved */
-+
- /* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */
--#define GM_TXPA_JAMLEN_MSK (0x03<<14) /* Bit 15..14: Jam Length */
--#define GM_TXPA_JAMIPG_MSK (0x1f<<9) /* Bit 13..9: Jam IPG */
--#define GM_TXPA_JAMDAT_MSK (0x1f<<4) /* Bit 8..4: IPG Jam to Data */
-- /* Bit 3..0: reserved */
-+#define GM_TXPA_JAMLEN_MSK (3<<14) /* Bit 15..14: Jam Length Mask */
-+#define GM_TXPA_JAMIPG_MSK (0x1f<<9) /* Bit 13.. 9: Jam IPG Mask */
-+#define GM_TXPA_JAMDAT_MSK (0x1f<<4) /* Bit 8.. 4: IPG Jam to Data Mask */
-+#define GM_TXPA_BO_LIM_MSK 0x0f /* Bit 3.. 0: Backoff Limit Mask */
-+ /* (Yukon-2 only) */
-
- #define TX_JAM_LEN_VAL(x) (SHIFT14(x) & GM_TXPA_JAMLEN_MSK)
- #define TX_JAM_IPG_VAL(x) (SHIFT9(x) & GM_TXPA_JAMIPG_MSK)
- #define TX_IPG_JAM_DATA(x) (SHIFT4(x) & GM_TXPA_JAMDAT_MSK)
-+#define TX_BACK_OFF_LIM(x) ((x) & GM_TXPA_BO_LIM_MSK)
-
- #define TX_JAM_LEN_DEF 0x03
- #define TX_JAM_IPG_DEF 0x0b
- #define TX_IPG_JAM_DEF 0x1c
-+#define TX_BOF_LIM_DEF 0x04
-
- /* GM_SERIAL_MODE 16 bit r/w Serial Mode Register */
--#define GM_SMOD_DATABL_MSK (0x1f<<11) /* Bit 15..11: Data Blinder (r/o) */
--#define GM_SMOD_LIMIT_4 (1<<10) /* Bit 10: 4 consecutive Tx trials */
--#define GM_SMOD_VLAN_ENA (1<<9) /* Bit 9: Enable VLAN (Max. Frame Len) */
--#define GM_SMOD_JUMBO_ENA (1<<8) /* Bit 8: Enable Jumbo (Max. Frame Len) */
-- /* Bit 7..5: reserved */
--#define GM_SMOD_IPG_MSK 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */
--
-+#define GM_SMOD_DATABL_MSK (0x1f<<11) /* Bit 15..11: Data Blinder */
-+ /* r/o on Yukon, r/w on Yukon-EC */
-+#define GM_SMOD_LIMIT_4 BIT_10S /* 4 consecutive Tx trials */
-+#define GM_SMOD_VLAN_ENA BIT_9S /* Enable VLAN (Max. Frame Len) */
-+#define GM_SMOD_JUMBO_ENA BIT_8S /* Enable Jumbo (Max. Frame Len) */
-+ /* Bit 7.. 5: reserved */
-+#define GM_SMOD_IPG_MSK 0x1f /* Bit 4.. 0: Inter-Packet Gap (IPG) */
-+
- #define DATA_BLIND_VAL(x) (SHIFT11(x) & GM_SMOD_DATABL_MSK)
--#define DATA_BLIND_DEF 0x04
-+#define IPG_DATA_VAL(x) ((x) & GM_SMOD_IPG_MSK)
-
--#define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
-+#define DATA_BLIND_DEF 0x04
- #define IPG_DATA_DEF 0x1e
-
- /* GM_SMI_CTRL 16 bit r/w SMI Control Register */
- #define GM_SMI_CT_PHY_A_MSK (0x1f<<11) /* Bit 15..11: PHY Device Address */
- #define GM_SMI_CT_REG_A_MSK (0x1f<<6) /* Bit 10.. 6: PHY Register Address */
--#define GM_SMI_CT_OP_RD (1<<5) /* Bit 5: OpCode Read (0=Write)*/
--#define GM_SMI_CT_RD_VAL (1<<4) /* Bit 4: Read Valid (Read completed) */
--#define GM_SMI_CT_BUSY (1<<3) /* Bit 3: Busy (Operation in progress) */
-- /* Bit 2..0: reserved */
--
-+#define GM_SMI_CT_OP_RD BIT_5S /* OpCode Read (0=Write)*/
-+#define GM_SMI_CT_RD_VAL BIT_4S /* Read Valid (Read completed) */
-+#define GM_SMI_CT_BUSY BIT_3S /* Busy (Operation in progress) */
-+ /* Bit 2.. 0: reserved */
-+
- #define GM_SMI_CT_PHY_AD(x) (SHIFT11(x) & GM_SMI_CT_PHY_A_MSK)
- #define GM_SMI_CT_REG_AD(x) (SHIFT6(x) & GM_SMI_CT_REG_A_MSK)
-
-- /* GM_PHY_ADDR 16 bit r/w GPHY Address Register */
-- /* Bit 15..6: reserved */
--#define GM_PAR_MIB_CLR (1<<5) /* Bit 5: Set MIB Clear Counter Mode */
--#define GM_PAR_MIB_TST (1<<4) /* Bit 4: MIB Load Counter (Test Mode) */
-- /* Bit 3..0: reserved */
--
-+/* GM_PHY_ADDR 16 bit r/w GPHY Address Register */
-+ /* Bit 15.. 6: reserved */
-+#define GM_PAR_MIB_CLR BIT_5S /* Set MIB Clear Counter Mode */
-+#define GM_PAR_MIB_TST BIT_4S /* MIB Load Counter (Test Mode) */
-+ /* Bit 3.. 0: reserved */
-+
- /* Receive Frame Status Encoding */
--#define GMR_FS_LEN (0xffffUL<<16) /* Bit 31..16: Rx Frame Length */
-+#define GMR_FS_LEN_MSK (0xffffUL<<16) /* Bit 31..16: Rx Frame Length */
- /* Bit 15..14: reserved */
--#define GMR_FS_VLAN (1L<<13) /* Bit 13: VLAN Packet */
--#define GMR_FS_JABBER (1L<<12) /* Bit 12: Jabber Packet */
--#define GMR_FS_UN_SIZE (1L<<11) /* Bit 11: Undersize Packet */
--#define GMR_FS_MC (1L<<10) /* Bit 10: Multicast Packet */
--#define GMR_FS_BC (1L<<9) /* Bit 9: Broadcast Packet */
--#define GMR_FS_RX_OK (1L<<8) /* Bit 8: Receive OK (Good Packet) */
--#define GMR_FS_GOOD_FC (1L<<7) /* Bit 7: Good Flow-Control Packet */
--#define GMR_FS_BAD_FC (1L<<6) /* Bit 6: Bad Flow-Control Packet */
--#define GMR_FS_MII_ERR (1L<<5) /* Bit 5: MII Error */
--#define GMR_FS_LONG_ERR (1L<<4) /* Bit 4: Too Long Packet */
--#define GMR_FS_FRAGMENT (1L<<3) /* Bit 3: Fragment */
-+#define GMR_FS_VLAN BIT_13 /* VLAN Packet */
-+#define GMR_FS_JABBER BIT_12 /* Jabber Packet */
-+#define GMR_FS_UN_SIZE BIT_11 /* Undersize Packet */
-+#define GMR_FS_MC BIT_10 /* Multicast Packet */
-+#define GMR_FS_BC BIT_9 /* Broadcast Packet */
-+#define GMR_FS_RX_OK BIT_8 /* Receive OK (Good Packet) */
-+#define GMR_FS_GOOD_FC BIT_7 /* Good Flow-Control Packet */
-+#define GMR_FS_BAD_FC BIT_6 /* Bad Flow-Control Packet */
-+#define GMR_FS_MII_ERR BIT_5 /* MII Error */
-+#define GMR_FS_LONG_ERR BIT_4 /* Too Long Packet */
-+#define GMR_FS_FRAGMENT BIT_3 /* Fragment */
- /* Bit 2: reserved */
--#define GMR_FS_CRC_ERR (1L<<1) /* Bit 1: CRC Error */
--#define GMR_FS_RX_FF_OV (1L<<0) /* Bit 0: Rx FIFO Overflow */
-+#define GMR_FS_CRC_ERR BIT_1 /* CRC Error */
-+#define GMR_FS_RX_FF_OV BIT_0 /* Rx FIFO Overflow */
-+
-+#define GMR_FS_LEN_SHIFT 16
-
- /*
- * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR)
- */
--#define GMR_FS_ANY_ERR (GMR_FS_CRC_ERR | \
-- GMR_FS_LONG_ERR | \
-+#ifdef SK_DIAG
-+#define GMR_FS_ANY_ERR ( \
-+ GMR_FS_RX_FF_OV | \
-+ GMR_FS_CRC_ERR | \
-+ GMR_FS_FRAGMENT | \
- GMR_FS_MII_ERR | \
- GMR_FS_BAD_FC | \
- GMR_FS_GOOD_FC | \
- GMR_FS_JABBER)
--
--/* Rx GMAC FIFO Flush Mask (default) */
--#define RX_FF_FL_DEF_MSK (GMR_FS_CRC_ERR | \
-+#else
-+#define GMR_FS_ANY_ERR ( \
- GMR_FS_RX_FF_OV | \
-+ GMR_FS_CRC_ERR | \
-+ GMR_FS_FRAGMENT | \
-+ GMR_FS_LONG_ERR | \
- GMR_FS_MII_ERR | \
- GMR_FS_BAD_FC | \
- GMR_FS_GOOD_FC | \
- GMR_FS_UN_SIZE | \
- GMR_FS_JABBER)
-+#endif
-+
-+/* Rx GMAC FIFO Flush Mask (default) */
-+#define RX_FF_FL_DEF_MSK GMR_FS_ANY_ERR
-
- /* typedefs *******************************************************************/
-
-@@ -1577,3 +1758,4 @@ extern "C" {
- #endif /* __cplusplus */
-
- #endif /* __INC_XMAC_H */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/skaddr.c ./drivers/net/sk98lin/skaddr.c
---- ./drivers/net/sk98lin.sk98/skaddr.c 2004-10-19 01:54:32.000000000 +0400
-+++ ./drivers/net/sk98lin/skaddr.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skaddr.c
- * Project: Gigabit Ethernet Adapters, ADDR-Module
-- * Version: $Revision: 1.52 $
-- * Date: $Date: 2003/06/02 13:46:15 $
-+ * Version: $Revision: 2.8 $
-+ * Date: $Date: 2005/07/21 12:01:30 $
- * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode.
- *
- ******************************************************************************/
-@@ -11,7 +11,7 @@
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -44,7 +44,7 @@
-
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skaddr.c,v 1.52 2003/06/02 13:46:15 tschilli Exp $ (C) Marvell.";
-+ "@(#) $Id: skaddr.c,v 2.8 2005/07/21 12:01:30 tschilli Exp $ (C) Marvell.";
- #endif /* DEBUG ||!LINT || !SK_SLIM */
-
- #define __SKADDR_C
-@@ -58,11 +58,10 @@ extern "C" {
-
- /* defines ********************************************************************/
-
--
- #define XMAC_POLY 0xEDB88320UL /* CRC32-Poly - XMAC: Little Endian */
- #define GMAC_POLY 0x04C11DB7L /* CRC16-Poly - GMAC: Little Endian */
- #define HASH_BITS 6 /* #bits in hash */
--#define SK_MC_BIT 0x01
-+#define SK_MC_BIT 0x01
-
- /* Error numbers and messages. */
-
-@@ -79,7 +78,7 @@ extern "C" {
-
- /* 64-bit hash values with all bits set. */
-
--SK_U16 OnesHash[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
-+SK_U16 OnesHash[4] = {0xffff, 0xffff, 0xffff, 0xffff};
-
- /* local variables ************************************************************/
-
-@@ -136,13 +135,12 @@ int Level) /* initialization level */
-
- switch (Level) {
- case SK_INIT_DATA:
-- SK_MEMSET((char *) &pAC->Addr, (SK_U8) 0,
-- (SK_U16) sizeof(SK_ADDR));
-+ SK_MEMSET((char *)&pAC->Addr, (SK_U8)0, (SK_U16)sizeof(SK_ADDR));
-
- for (i = 0; i < SK_MAX_MACS; i++) {
- pAPort = &pAC->Addr.Port[i];
- pAPort->PromMode = SK_PROM_MODE_NONE;
--
-+
- pAPort->FirstExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT;
- pAPort->FirstExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV;
- pAPort->NextExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT;
-@@ -159,7 +157,7 @@ int Level) /* initialization level */
- /* pAC->Addr.InitDone = SK_INIT_DATA; */
- break;
-
-- case SK_INIT_IO:
-+ case SK_INIT_IO:
- #ifndef SK_NO_RLMT
- for (i = 0; i < SK_MAX_NETS; i++) {
- pAC->Addr.Net[i].ActivePort = pAC->Rlmt.Net[i].ActivePort;
-@@ -173,7 +171,7 @@ int Level) /* initialization level */
- }
- }
- #endif /* DEBUG */
--
-+
- /* Read permanent logical MAC address from Control Register File. */
- for (j = 0; j < SK_MAC_ADDR_LEN; j++) {
- InAddr = (SK_U8 *) &pAC->Addr.Net[0].PermanentMacAddress.a[j];
-@@ -191,11 +189,11 @@ int Level) /* initialization level */
- pAC->Addr.Port[pAC->Addr.Net[0].ActivePort].Exact[0] =
- pAC->Addr.Net[0].CurrentMacAddress;
- #if SK_MAX_NETS > 1
-- /* Set logical MAC address for net 2 to (log | 3). */
-+ /* Set logical MAC address for net 2 to. */
- if (!pAC->Addr.Net[1].CurrentMacAddressSet) {
- pAC->Addr.Net[1].PermanentMacAddress =
- pAC->Addr.Net[0].PermanentMacAddress;
-- pAC->Addr.Net[1].PermanentMacAddress.a[5] |= 3;
-+ pAC->Addr.Net[1].PermanentMacAddress.a[5] += 1;
- /* Set the current logical MAC address to the permanent one. */
- pAC->Addr.Net[1].CurrentMacAddress =
- pAC->Addr.Net[1].PermanentMacAddress;
-@@ -213,8 +211,8 @@ int Level) /* initialization level */
- pAC->Addr.Net[i].PermanentMacAddress.a[2],
- pAC->Addr.Net[i].PermanentMacAddress.a[3],
- pAC->Addr.Net[i].PermanentMacAddress.a[4],
-- pAC->Addr.Net[i].PermanentMacAddress.a[5]))
--
-+ pAC->Addr.Net[i].PermanentMacAddress.a[5]));
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_INIT,
- ("Logical MAC Address (Net%d): %02X %02X %02X %02X %02X %02X\n",
- i,
-@@ -223,7 +221,7 @@ int Level) /* initialization level */
- pAC->Addr.Net[i].CurrentMacAddress.a[2],
- pAC->Addr.Net[i].CurrentMacAddress.a[3],
- pAC->Addr.Net[i].CurrentMacAddress.a[4],
-- pAC->Addr.Net[i].CurrentMacAddress.a[5]))
-+ pAC->Addr.Net[i].CurrentMacAddress.a[5]));
- }
- #endif /* DEBUG */
-
-@@ -266,8 +264,8 @@ int Level) /* initialization level */
- pAPort->PermanentMacAddress.a[2],
- pAPort->PermanentMacAddress.a[3],
- pAPort->PermanentMacAddress.a[4],
-- pAPort->PermanentMacAddress.a[5]))
--
-+ pAPort->PermanentMacAddress.a[5]));
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_INIT,
- ("SkAddrInit: Physical MAC Address: %02X %02X %02X %02X %02X %02X\n",
- pAPort->CurrentMacAddress.a[0],
-@@ -275,7 +273,7 @@ int Level) /* initialization level */
- pAPort->CurrentMacAddress.a[2],
- pAPort->CurrentMacAddress.a[3],
- pAPort->CurrentMacAddress.a[4],
-- pAPort->CurrentMacAddress.a[5]))
-+ pAPort->CurrentMacAddress.a[5]));
- #endif /* DEBUG */
- }
- /* pAC->Addr.InitDone = SK_INIT_IO; */
-@@ -299,7 +297,7 @@ int Level) /* initialization level */
- }
-
- return (SK_ADDR_SUCCESS);
--
-+
- } /* SkAddrInit */
-
- #ifndef SK_SLIM
-@@ -333,16 +331,20 @@ SK_U32 PortNumber, /* Index of affected
- int Flags) /* permanent/non-perm, sw-only */
- {
- int ReturnCode;
--
-+
- if (PortNumber >= (SK_U32) pAC->GIni.GIMacsFound) {
- return (SK_ADDR_ILLEGAL_PORT);
- }
--
-+
- if (pAC->GIni.GIGenesis) {
-+#ifdef GENESIS
- ReturnCode = SkAddrXmacMcClear(pAC, IoC, PortNumber, Flags);
-+#endif
- }
- else {
-+#ifdef YUKON
- ReturnCode = SkAddrGmacMcClear(pAC, IoC, PortNumber, Flags);
-+#endif
- }
-
- return (ReturnCode);
-@@ -352,7 +354,7 @@ int Flags) /* permanent/non-perm, sw-o
- #endif /* !SK_SLIM */
-
- #ifndef SK_SLIM
--
-+#ifdef GENESIS
- /******************************************************************************
- *
- * SkAddrXmacMcClear - clear the multicast table
-@@ -402,13 +404,13 @@ int Flags) /* permanent/non-perm, sw-o
- }
-
- return (SK_ADDR_SUCCESS);
--
--} /* SkAddrXmacMcClear */
-
-+} /* SkAddrXmacMcClear */
-+#endif /* GENESIS */
- #endif /* !SK_SLIM */
-
- #ifndef SK_SLIM
--
-+#ifdef YUKON
- /******************************************************************************
- *
- * SkAddrGmacMcClear - clear the multicast table
-@@ -447,38 +449,37 @@ int Flags) /* permanent/non-perm, sw-o
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[4],
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[5],
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[6],
-- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[7]))
-+ pAC->Addr.Port[PortNumber].InexactFilter.Bytes[7]));
- #endif /* DEBUG */
-
- /* Clear InexactFilter */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] = 0;
- }
--
-+
- if (Flags & SK_ADDR_PERMANENT) { /* permanent => RLMT */
--
-+
- /* Copy DRV bits to InexactFilter. */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] |=
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[i];
--
-+
- /* Clear InexactRlmtFilter. */
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[i] = 0;
--
-- }
-+ }
- }
- else { /* not permanent => DRV */
--
-+
- /* Copy RLMT bits to InexactFilter. */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] |=
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[i];
--
-+
- /* Clear InexactDrvFilter. */
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[i] = 0;
- }
- }
--
-+
- #ifdef DEBUG
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("GMAC InexactFilter (cleared): %02X %02X %02X %02X %02X %02X %02X %02X\n",
-@@ -489,19 +490,20 @@ int Flags) /* permanent/non-perm, sw-o
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[4],
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[5],
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[6],
-- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[7]))
-+ pAC->Addr.Port[PortNumber].InexactFilter.Bytes[7]));
- #endif /* DEBUG */
--
-+
- if (!(Flags & SK_MC_SW_ONLY)) {
- (void) SkAddrGmacMcUpdate(pAC, IoC, PortNumber);
- }
--
-+
- return (SK_ADDR_SUCCESS);
-
- } /* SkAddrGmacMcClear */
-+#endif /* YUKON */
-
- #ifndef SK_ADDR_CHEAT
--
-+#ifdef GENESIS
- /******************************************************************************
- *
- * SkXmacMcHash - hash multicast address
-@@ -538,8 +540,9 @@ unsigned char *pMc) /* Multicast address
- return (Crc & ((1 << HASH_BITS) - 1));
-
- } /* SkXmacMcHash */
-+#endif /* GENESIS */
-
--
-+#ifdef YUKON
- /******************************************************************************
- *
- * SkGmacMcHash - hash multicast address
-@@ -570,7 +573,7 @@ unsigned char *pMc) /* Multicast address
- for (Byte = 0; Byte < 6; Byte++) {
- /* Get next byte. */
- Data = (SK_U32) pMc[Byte];
--
-+
- /* Change bit order in byte. */
- TmpData = Data;
- for (Bit = 0; Bit < 8; Bit++) {
-@@ -582,7 +585,7 @@ unsigned char *pMc) /* Multicast address
- }
- TmpData >>= 1;
- }
--
-+
- Crc ^= (Data << 24);
- for (Bit = 0; Bit < 8; Bit++) {
- if (Crc & 0x80000000) {
-@@ -593,11 +596,11 @@ unsigned char *pMc) /* Multicast address
- }
- }
- }
--
-+
- return (Crc & ((1 << HASH_BITS) - 1));
-
- } /* SkGmacMcHash */
--
-+#endif /* YUKON */
- #endif /* !SK_ADDR_CHEAT */
-
- /******************************************************************************
-@@ -632,23 +635,27 @@ SK_MAC_ADDR *pMc, /* multicast address
- int Flags) /* permanent/non-permanent */
- {
- int ReturnCode;
--
-+
- if (PortNumber >= (SK_U32) pAC->GIni.GIMacsFound) {
- return (SK_ADDR_ILLEGAL_PORT);
- }
--
-+
- if (pAC->GIni.GIGenesis) {
-+#ifdef GENESIS
- ReturnCode = SkAddrXmacMcAdd(pAC, IoC, PortNumber, pMc, Flags);
-+#endif
- }
- else {
-+#ifdef YUKON
- ReturnCode = SkAddrGmacMcAdd(pAC, IoC, PortNumber, pMc, Flags);
-+#endif
- }
-
- return (ReturnCode);
-
- } /* SkAddrMcAdd */
-
--
-+#ifdef GENESIS
- /******************************************************************************
- *
- * SkAddrXmacMcAdd - add a multicast address to a port
-@@ -693,7 +700,7 @@ int Flags) /* permanent/non-permanent
- return (SK_MC_RLMT_OVERFLOW);
- }
- #endif /* DEBUG */
--
-+
- if (pAC->Addr.Port[PortNumber].NextExactMatchRlmt >
- SK_ADDR_LAST_MATCH_RLMT) {
- return (SK_MC_RLMT_OVERFLOW);
-@@ -714,7 +721,7 @@ int Flags) /* permanent/non-permanent
- return (SK_MC_RLMT_OVERFLOW);
- }
- #endif /* DEBUG */
--
-+
- if (pAC->Addr.Port[PortNumber].NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) {
-
- /* Set exact match entry. */
-@@ -758,8 +765,9 @@ int Flags) /* permanent/non-permanent
- }
-
- } /* SkAddrXmacMcAdd */
-+#endif /* GENESIS */
-
--
-+#ifdef YUKON
- /******************************************************************************
- *
- * SkAddrGmacMcAdd - add a multicast address to a port
-@@ -789,28 +797,29 @@ int Flags) /* permanent/non-permanent
- #ifndef SK_ADDR_CHEAT
- SK_U32 HashBit;
- #endif /* !defined(SK_ADDR_CHEAT) */
--
-+
- if (!(pMc->a[0] & SK_MC_BIT)) {
- /* Hashing only possible with multicast addresses */
- return (SK_MC_ILLEGAL_ADDRESS);
- }
--
-+
- #ifndef SK_ADDR_CHEAT
--
-+
- /* Compute hash value of address. */
- HashBit = SkGmacMcHash(&pMc->a[0]);
--
-+
- if (Flags & SK_ADDR_PERMANENT) { /* permanent => RLMT */
--
-+
- /* Add bit to InexactRlmtFilter. */
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[HashBit / 8] |=
- 1 << (HashBit % 8);
--
-+
- /* Copy bit to InexactFilter. */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] |=
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[i];
- }
-+
- #ifdef DEBUG
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("GMAC InexactRlmtFilter: %02X %02X %02X %02X %02X %02X %02X %02X\n",
-@@ -821,20 +830,21 @@ int Flags) /* permanent/non-permanent
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[4],
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[5],
- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[6],
-- pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[7]))
-+ pAC->Addr.Port[PortNumber].InexactRlmtFilter.Bytes[7]));
- #endif /* DEBUG */
- }
- else { /* not permanent => DRV */
--
-+
- /* Add bit to InexactDrvFilter. */
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[HashBit / 8] |=
- 1 << (HashBit % 8);
--
-+
- /* Copy bit to InexactFilter. */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] |=
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[i];
- }
-+
- #ifdef DEBUG
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("GMAC InexactDrvFilter: %02X %02X %02X %02X %02X %02X %02X %02X\n",
-@@ -845,22 +855,22 @@ int Flags) /* permanent/non-permanent
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[4],
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[5],
- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[6],
-- pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[7]))
-+ pAC->Addr.Port[PortNumber].InexactDrvFilter.Bytes[7]));
- #endif /* DEBUG */
- }
--
-+
- #else /* SK_ADDR_CHEAT */
--
-+
- /* Set all bits in InexactFilter. */
- for (i = 0; i < 8; i++) {
- pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i] = 0xFF;
- }
- #endif /* SK_ADDR_CHEAT */
--
-+
- return (SK_MC_FILTERING_INEXACT);
--
--} /* SkAddrGmacMcAdd */
-
-+} /* SkAddrGmacMcAdd */
-+#endif /* YUKON */
- #endif /* !SK_SLIM */
-
- /******************************************************************************
-@@ -892,7 +902,8 @@ SK_AC *pAC, /* adapter context */
- SK_IOC IoC, /* I/O context */
- SK_U32 PortNumber) /* Port Number */
- {
-- int ReturnCode = 0;
-+ int ReturnCode = SK_ADDR_ILLEGAL_PORT;
-+
- #if (!defined(SK_SLIM) || defined(DEBUG))
- if (PortNumber >= (SK_U32) pAC->GIni.GIMacsFound) {
- return (SK_ADDR_ILLEGAL_PORT);
-@@ -948,13 +959,13 @@ SK_U32 PortNumber) /* Port Number */
- SK_ADDR_PORT *pAPort;
-
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
-- ("SkAddrXmacMcUpdate on Port %u.\n", PortNumber))
--
-+ ("SkAddrXmacMcUpdate on Port %u.\n", PortNumber));
-+
- pAPort = &pAC->Addr.Port[PortNumber];
-
- #ifdef DEBUG
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
-- ("Next0 on Port %d: %d\n", PortNumber, Next0[PortNumber]))
-+ ("Next0 on Port %d: %d\n", PortNumber, Next0[PortNumber]));
- #endif /* DEBUG */
-
- /* Start with 0 to also program the logical MAC address. */
-@@ -966,7 +977,7 @@ SK_U32 PortNumber) /* Port Number */
-
- /* Clear other permanent exact match addresses on XMAC */
- if (pAPort->NextExactMatchRlmt <= SK_ADDR_LAST_MATCH_RLMT) {
--
-+
- SkXmClrExactAddr(pAC, IoC, PortNumber, pAPort->NextExactMatchRlmt,
- SK_ADDR_LAST_MATCH_RLMT);
- }
-@@ -978,7 +989,7 @@ SK_U32 PortNumber) /* Port Number */
-
- /* Clear other non-permanent exact match addresses on XMAC */
- if (pAPort->NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) {
--
-+
- SkXmClrExactAddr(pAC, IoC, PortNumber, pAPort->NextExactMatchDrv,
- SK_ADDR_LAST_MATCH_DRV);
- }
-@@ -988,18 +999,18 @@ SK_U32 PortNumber) /* Port Number */
- }
-
- if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) {
--
-+
- /* Set all bits in 64-bit hash register. */
- XM_OUTHASH(IoC, PortNumber, XM_HSM, &OnesHash);
--
-+
- /* Enable Hashing */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
- else if (Inexact != 0) {
--
-+
- /* Set 64-bit hash register to InexactFilter. */
- XM_OUTHASH(IoC, PortNumber, XM_HSM, &pAPort->InexactFilter.Bytes[0]);
--
-+
- /* Enable Hashing */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
-@@ -1014,7 +1025,7 @@ SK_U32 PortNumber) /* Port Number */
-
- /* Set port's current physical MAC address. */
- OutAddr = (SK_U16 *) &pAPort->CurrentMacAddress.a[0];
--
-+
- XM_OUTADDR(IoC, PortNumber, XM_SA, OutAddr);
-
- #ifdef xDEBUG
-@@ -1024,9 +1035,9 @@ SK_U32 PortNumber) /* Port Number */
-
- /* Get exact match address i from port PortNumber. */
- InAddr = (SK_U16 *) &InAddr8[0];
--
-+
- XM_INADDR(IoC, PortNumber, XM_EXM(i), InAddr);
--
-+
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("SkAddrXmacMcUpdate: MC address %d on Port %u: ",
- "%02x %02x %02x %02x %02x %02x -- %02x %02x %02x %02x %02x %02x\n",
-@@ -1043,7 +1054,7 @@ SK_U32 PortNumber) /* Port Number */
- pAPort->Exact[i].a[2],
- pAPort->Exact[i].a[3],
- pAPort->Exact[i].a[4],
-- pAPort->Exact[i].a[5]))
-+ pAPort->Exact[i].a[5]));
- }
- #endif /* DEBUG */
-
-@@ -1054,7 +1065,7 @@ SK_U32 PortNumber) /* Port Number */
- else {
- return (SK_MC_FILTERING_INEXACT);
- }
--
-+
- } /* SkAddrXmacMcUpdate */
-
- #endif /* GENESIS */
-@@ -1095,37 +1106,37 @@ SK_U32 PortNumber) /* Port Number */
- SK_ADDR_PORT *pAPort;
-
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
-- ("SkAddrGmacMcUpdate on Port %u.\n", PortNumber))
--
-+ ("SkAddrGmacMcUpdate on Port %u.\n", PortNumber));
-+
- pAPort = &pAC->Addr.Port[PortNumber];
-
- #ifdef DEBUG
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
-- ("Next0 on Port %d: %d\n", PortNumber, Next0[PortNumber]))
-+ ("Next0 on Port %d: %d\n", PortNumber, Next0[PortNumber]));
- #endif /* DEBUG */
--
-+
- #ifndef SK_SLIM
- for (Inexact = 0, i = 0; i < 8; i++) {
- Inexact |= pAPort->InexactFilter.Bytes[i];
- }
--
-+
- /* Set 64-bit hash register to InexactFilter. */
- GM_OUTHASH(IoC, PortNumber, GM_MC_ADDR_H1,
- &pAPort->InexactFilter.Bytes[0]);
--
-- if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) {
--
-+
-+ if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) {
-+
- /* Set all bits in 64-bit hash register. */
- GM_OUTHASH(IoC, PortNumber, GM_MC_ADDR_H1, &OnesHash);
--
-+
- /* Enable Hashing */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
-- else {
-+ else {
- /* Enable Hashing. */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
--
-+
- if (pAPort->PromMode != SK_PROM_MODE_NONE) {
- (void) SkAddrGmacPromiscuousChange(pAC, IoC, PortNumber, pAPort->PromMode);
- }
-@@ -1136,19 +1147,19 @@ SK_U32 PortNumber) /* Port Number */
-
- /* Enable Hashing */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
--
-+
- (void) SkAddrGmacPromiscuousChange(pAC, IoC, PortNumber, pAPort->PromMode);
--
-+
- #endif /* SK_SLIM */
--
-+
- /* Set port's current physical MAC address. */
- OutAddr = (SK_U16 *) &pAPort->CurrentMacAddress.a[0];
- GM_OUTADDR(IoC, PortNumber, GM_SRC_ADDR_1L, OutAddr);
--
-+
- /* Set port's current logical MAC address. */
- OutAddr = (SK_U16 *) &pAPort->Exact[0].a[0];
- GM_OUTADDR(IoC, PortNumber, GM_SRC_ADDR_2L, OutAddr);
--
-+
- #ifdef DEBUG
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("SkAddrGmacMcUpdate: Permanent Physical MAC Address: %02X %02X %02X %02X %02X %02X\n",
-@@ -1157,8 +1168,8 @@ SK_U32 PortNumber) /* Port Number */
- pAPort->Exact[0].a[2],
- pAPort->Exact[0].a[3],
- pAPort->Exact[0].a[4],
-- pAPort->Exact[0].a[5]))
--
-+ pAPort->Exact[0].a[5]));
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("SkAddrGmacMcUpdate: Physical MAC Address: %02X %02X %02X %02X %02X %02X\n",
- pAPort->CurrentMacAddress.a[0],
-@@ -1166,9 +1177,9 @@ SK_U32 PortNumber) /* Port Number */
- pAPort->CurrentMacAddress.a[2],
- pAPort->CurrentMacAddress.a[3],
- pAPort->CurrentMacAddress.a[4],
-- pAPort->CurrentMacAddress.a[5]))
-+ pAPort->CurrentMacAddress.a[5]));
- #endif /* DEBUG */
--
-+
- #ifndef SK_SLIM
- /* Determine return value. */
- if (Inexact == 0 && pAPort->PromMode == 0) {
-@@ -1180,7 +1191,7 @@ SK_U32 PortNumber) /* Port Number */
- #else /* SK_SLIM */
- return (SK_MC_FILTERING_INEXACT);
- #endif /* SK_SLIM */
--
-+
- } /* SkAddrGmacMcUpdate */
-
- #endif /* YUKON */
-@@ -1275,26 +1286,46 @@ int Flags) /* logical/physical MAC
- (void) SkAddrMcUpdate(pAC, IoC, PortNumber);
- }
- else if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical MAC address. */
-- if (SK_ADDR_EQUAL(pNewAddr->a,
-- pAC->Addr.Net[NetNumber].CurrentMacAddress.a)) {
-- return (SK_ADDR_DUPLICATE_ADDRESS);
-- }
--
- for (i = 0; i < (SK_U32) pAC->GIni.GIMacsFound; i++) {
- if (!pAC->Addr.Port[i].CurrentMacAddressSet) {
- return (SK_ADDR_TOO_EARLY);
- }
-+ }
-
-+ /*
-+ * In dual net mode it should be possible to set all MAC
-+ * addresses independently. Therefore the equality checks
-+ * against the locical address of the same port and the
-+ * physical address of the other port are suppressed here.
-+ */
-+#ifndef SK_NO_RLMT
-+ if (pAC->Rlmt.NumNets == 1) {
-+#endif /* SK_NO_RLMT */
- if (SK_ADDR_EQUAL(pNewAddr->a,
-- pAC->Addr.Port[i].CurrentMacAddress.a)) {
-- if (i == PortNumber) {
-- return (SK_ADDR_SUCCESS);
-- }
-- else {
-- return (SK_ADDR_DUPLICATE_ADDRESS);
-+ pAC->Addr.Net[NetNumber].CurrentMacAddress.a)) {
-+ return (SK_ADDR_DUPLICATE_ADDRESS);
-+ }
-+
-+ for (i = 0; i < (SK_U32) pAC->GIni.GIMacsFound; i++) {
-+ if (SK_ADDR_EQUAL(pNewAddr->a,
-+ pAC->Addr.Port[i].CurrentMacAddress.a)) {
-+ if (i == PortNumber) {
-+ return (SK_ADDR_SUCCESS);
-+ }
-+ else {
-+ return (SK_ADDR_DUPLICATE_ADDRESS);
-+ }
- }
- }
-+#ifndef SK_NO_RLMT
- }
-+ else {
-+ if (SK_ADDR_EQUAL(pNewAddr->a,
-+ pAC->Addr.Port[PortNumber].CurrentMacAddress.a)) {
-+ return (SK_ADDR_SUCCESS);
-+ }
-+ }
-+#endif /* SK_NO_RLMT */
-
- pAC->Addr.Port[PortNumber].PreviousMacAddress =
- pAC->Addr.Port[PortNumber].CurrentMacAddress;
-@@ -1325,18 +1356,32 @@ int Flags) /* logical/physical MAC
- pAC->Addr.Net[NetNumber].CurrentMacAddress.a)) {
- return (SK_ADDR_SUCCESS);
- }
--
-+
- for (i = 0; i < (SK_U32) pAC->GIni.GIMacsFound; i++) {
- if (!pAC->Addr.Port[i].CurrentMacAddressSet) {
- return (SK_ADDR_TOO_EARLY);
- }
-+ }
-
-- if (SK_ADDR_EQUAL(pNewAddr->a,
-- pAC->Addr.Port[i].CurrentMacAddress.a)) {
-- return (SK_ADDR_DUPLICATE_ADDRESS);
-+ /*
-+ * In dual net mode on Yukon-2 adapters the physical address
-+ * of port 0 and the logical address of port 1 are equal - in
-+ * this case the equality check of the physical address leads
-+ * to an error and is suppressed here.
-+ */
-+#ifndef SK_NO_RLMT
-+ if (pAC->Rlmt.NumNets == 1) {
-+#endif /* SK_NO_RLMT */
-+ for (i = 0; i < (SK_U32) pAC->GIni.GIMacsFound; i++) {
-+ if (SK_ADDR_EQUAL(pNewAddr->a,
-+ pAC->Addr.Port[i].CurrentMacAddress.a)) {
-+ return (SK_ADDR_DUPLICATE_ADDRESS);
-+ }
- }
-+#ifndef SK_NO_RLMT
- }
--
-+#endif /* SK_NO_RLMT */
-+
- /*
- * In case that the physical and the logical MAC addresses are equal
- * we must also change the physical MAC address here.
-@@ -1345,11 +1390,11 @@ int Flags) /* logical/physical MAC
- */
- if (SK_ADDR_EQUAL(pAC->Addr.Port[PortNumber].CurrentMacAddress.a,
- pAC->Addr.Port[PortNumber].Exact[0].a)) {
--
-+
- pAC->Addr.Port[PortNumber].PreviousMacAddress =
- pAC->Addr.Port[PortNumber].CurrentMacAddress;
- pAC->Addr.Port[PortNumber].CurrentMacAddress = *pNewAddr;
--
-+
- #ifndef SK_NO_RLMT
- /* Report address change to RLMT. */
- Para.Para32[0] = PortNumber;
-@@ -1357,7 +1402,7 @@ int Flags) /* logical/physical MAC
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_PORT_ADDR, Para);
- #endif /* !SK_NO_RLMT */
- }
--
-+
- #ifndef SK_NO_RLMT
- /* Set PortNumber to number of net's active port. */
- PortNumber = pAC->Rlmt.Net[NetNumber].
-@@ -1373,8 +1418,8 @@ int Flags) /* logical/physical MAC
- pAC->Addr.Net[NetNumber].PermanentMacAddress.a[2],
- pAC->Addr.Net[NetNumber].PermanentMacAddress.a[3],
- pAC->Addr.Net[NetNumber].PermanentMacAddress.a[4],
-- pAC->Addr.Net[NetNumber].PermanentMacAddress.a[5]))
--
-+ pAC->Addr.Net[NetNumber].PermanentMacAddress.a[5]));
-+
- SK_DBG_MSG(pAC,SK_DBGMOD_ADDR, SK_DBGCAT_CTRL,
- ("SkAddrOverride: New logical MAC Address: %02X %02X %02X %02X %02X %02X\n",
- pAC->Addr.Net[NetNumber].CurrentMacAddress.a[0],
-@@ -1382,17 +1427,16 @@ int Flags) /* logical/physical MAC
- pAC->Addr.Net[NetNumber].CurrentMacAddress.a[2],
- pAC->Addr.Net[NetNumber].CurrentMacAddress.a[3],
- pAC->Addr.Net[NetNumber].CurrentMacAddress.a[4],
-- pAC->Addr.Net[NetNumber].CurrentMacAddress.a[5]))
-+ pAC->Addr.Net[NetNumber].CurrentMacAddress.a[5]));
- #endif /* DEBUG */
-
-- /* Write address to first exact match entry of active port. */
-- (void) SkAddrMcUpdate(pAC, IoC, PortNumber);
-+ /* Write address to first exact match entry of active port. */
-+ (void)SkAddrMcUpdate(pAC, IoC, PortNumber);
- }
-
- return (SK_ADDR_SUCCESS);
--
--} /* SkAddrOverride */
-
-+} /* SkAddrOverride */
-
- #endif /* SK_NO_MAO */
-
-@@ -1424,7 +1468,8 @@ SK_IOC IoC, /* I/O context */
- SK_U32 PortNumber, /* port whose promiscuous mode changes */
- int NewPromMode) /* new promiscuous mode */
- {
-- int ReturnCode = 0;
-+ int ReturnCode = SK_ADDR_ILLEGAL_PORT;
-+
- #if (!defined(SK_SLIM) || defined(DEBUG))
- if (PortNumber >= (SK_U32) pAC->GIni.GIMacsFound) {
- return (SK_ADDR_ILLEGAL_PORT);
-@@ -1489,17 +1534,18 @@ int NewPromMode) /* new promiscuous mod
- /* Promiscuous mode! */
- CurPromMode |= SK_PROM_MODE_LLC;
- }
--
-+
- for (Inexact = 0xFF, i = 0; i < 8; i++) {
- Inexact &= pAC->Addr.Port[PortNumber].InexactFilter.Bytes[i];
- }
-+
- if (Inexact == 0xFF) {
- CurPromMode |= (pAC->Addr.Port[PortNumber].PromMode & SK_PROM_MODE_ALL_MC);
- }
- else {
- /* Get InexactModeBit (bit XM_MD_ENA_HASH in mode register) */
- XM_IN16(IoC, PortNumber, XM_MODE, &LoMode);
--
-+
- InexactModeBit = (LoMode & XM_MD_ENA_HASH) != 0;
-
- /* Read 64-bit hash register from XMAC */
-@@ -1522,7 +1568,7 @@ int NewPromMode) /* new promiscuous mod
-
- if ((NewPromMode & SK_PROM_MODE_ALL_MC) &&
- !(CurPromMode & SK_PROM_MODE_ALL_MC)) { /* All MC. */
--
-+
- /* Set all bits in 64-bit hash register. */
- XM_OUTHASH(IoC, PortNumber, XM_HSM, &OnesHash);
-
-@@ -1558,9 +1604,9 @@ int NewPromMode) /* new promiscuous mod
- /* Clear Promiscuous Mode */
- SkMacPromiscMode(pAC, IoC, (int) PortNumber, SK_FALSE);
- }
--
-+
- return (SK_ADDR_SUCCESS);
--
-+
- } /* SkAddrXmacPromiscuousChange */
-
- #endif /* GENESIS */
-@@ -1607,22 +1653,25 @@ int NewPromMode) /* new promiscuous mod
- CurPromMode |= (pAC->Addr.Port[PortNumber].PromMode & SK_PROM_MODE_ALL_MC);
- }
-
-+ /* dummy read after GM_IN16() */
-+ SK_IN16(IoC, B0_RAP, &ReceiveControl);
-+
- pAC->Addr.Port[PortNumber].PromMode = NewPromMode;
-
- if (NewPromMode == CurPromMode) {
- return (SK_ADDR_SUCCESS);
- }
--
-+
- if ((NewPromMode & SK_PROM_MODE_ALL_MC) &&
- !(CurPromMode & SK_PROM_MODE_ALL_MC)) { /* All MC */
--
-+
- /* Set all bits in 64-bit hash register. */
- GM_OUTHASH(IoC, PortNumber, GM_MC_ADDR_H1, &OnesHash);
--
-+
- /* Enable Hashing */
- SkMacHashing(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
--
-+
- if ((CurPromMode & SK_PROM_MODE_ALL_MC) &&
- !(NewPromMode & SK_PROM_MODE_ALL_MC)) { /* Norm. MC */
-
-@@ -1636,19 +1685,19 @@ int NewPromMode) /* new promiscuous mod
-
- if ((NewPromMode & SK_PROM_MODE_LLC) &&
- !(CurPromMode & SK_PROM_MODE_LLC)) { /* Prom. LLC */
--
-+
- /* Set the MAC to Promiscuous Mode. */
- SkMacPromiscMode(pAC, IoC, (int) PortNumber, SK_TRUE);
- }
- else if ((CurPromMode & SK_PROM_MODE_LLC) &&
- !(NewPromMode & SK_PROM_MODE_LLC)) { /* Norm. LLC */
--
-+
- /* Clear Promiscuous Mode. */
- SkMacPromiscMode(pAC, IoC, (int) PortNumber, SK_FALSE);
- }
-
- return (SK_ADDR_SUCCESS);
--
-+
- } /* SkAddrGmacPromiscuousChange */
-
- #endif /* YUKON */
-@@ -1720,33 +1769,33 @@ SK_U32 ToPortNumber) /* Port2 Index */
- pAC->Addr.Port[ToPortNumber].InexactFilter.Bytes[i];
- pAC->Addr.Port[ToPortNumber].InexactFilter.Bytes[i] = Byte;
- }
--
-+
- i = pAC->Addr.Port[FromPortNumber].PromMode;
- pAC->Addr.Port[FromPortNumber].PromMode = pAC->Addr.Port[ToPortNumber].PromMode;
- pAC->Addr.Port[ToPortNumber].PromMode = i;
--
-+
- if (pAC->GIni.GIGenesis) {
- DWord = pAC->Addr.Port[FromPortNumber].FirstExactMatchRlmt;
- pAC->Addr.Port[FromPortNumber].FirstExactMatchRlmt =
- pAC->Addr.Port[ToPortNumber].FirstExactMatchRlmt;
- pAC->Addr.Port[ToPortNumber].FirstExactMatchRlmt = DWord;
--
-+
- DWord = pAC->Addr.Port[FromPortNumber].NextExactMatchRlmt;
- pAC->Addr.Port[FromPortNumber].NextExactMatchRlmt =
- pAC->Addr.Port[ToPortNumber].NextExactMatchRlmt;
- pAC->Addr.Port[ToPortNumber].NextExactMatchRlmt = DWord;
--
-+
- DWord = pAC->Addr.Port[FromPortNumber].FirstExactMatchDrv;
- pAC->Addr.Port[FromPortNumber].FirstExactMatchDrv =
- pAC->Addr.Port[ToPortNumber].FirstExactMatchDrv;
- pAC->Addr.Port[ToPortNumber].FirstExactMatchDrv = DWord;
--
-+
- DWord = pAC->Addr.Port[FromPortNumber].NextExactMatchDrv;
- pAC->Addr.Port[FromPortNumber].NextExactMatchDrv =
- pAC->Addr.Port[ToPortNumber].NextExactMatchDrv;
- pAC->Addr.Port[ToPortNumber].NextExactMatchDrv = DWord;
- }
--
-+
- /* CAUTION: Solution works if only ports of one adapter are in use. */
- for (i = 0; (SK_U32) i < pAC->Rlmt.Net[pAC->Rlmt.Port[ToPortNumber].
- Net->NetNumber].NumPorts; i++) {
-@@ -1757,12 +1806,12 @@ SK_U32 ToPortNumber) /* Port2 Index */
- /* 20001207 RA: Was "ToPortNumber;". */
- }
- }
--
-+
- (void) SkAddrMcUpdate(pAC, IoC, FromPortNumber);
- (void) SkAddrMcUpdate(pAC, IoC, ToPortNumber);
-
- return (SK_ADDR_SUCCESS);
--
-+
- } /* SkAddrSwap */
-
- #endif /* !SK_SLIM */
-diff -Nurap ./drivers/net/sk98lin.sk98/skcsum.c ./drivers/net/sk98lin/skcsum.c
---- ./drivers/net/sk98lin.sk98/skcsum.c 2004-10-19 01:53:07.000000000 +0400
-+++ ./drivers/net/sk98lin/skcsum.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skcsum.c
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.12 $
-- * Date: $Date: 2003/08/20 13:55:53 $
-+ * Version: $Revision: 2.1 $
-+ * Date: $Date: 2003/10/27 14:16:08 $
- * Purpose: Store/verify Internet checksum in send/receive packets.
- *
- ******************************************************************************/
-@@ -25,7 +25,7 @@
-
- #ifndef lint
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skcsum.c,v 1.12 2003/08/20 13:55:53 mschmid Exp $ (C) SysKonnect.";
-+ "@(#) $Id: skcsum.c,v 2.1 2003/10/27 14:16:08 amock Exp $ (C) SysKonnect.";
- #endif /* !lint */
-
- /******************************************************************************
-diff -Nurap ./drivers/net/sk98lin.sk98/skdim.c ./drivers/net/sk98lin/skdim.c
---- ./drivers/net/sk98lin.sk98/skdim.c 2004-10-19 01:53:45.000000000 +0400
-+++ ./drivers/net/sk98lin/skdim.c 2006-08-31 14:59:52.000000000 +0400
-@@ -1,17 +1,25 @@
- /******************************************************************************
- *
-- * Name: skdim.c
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.5 $
-- * Date: $Date: 2003/11/28 12:55:40 $
-- * Purpose: All functions to maintain interrupt moderation
-+ * Name: skdim.c
-+ * Project: GEnesis, PCI Gigabit Ethernet Adapter
-+ * Version: $Revision: 1.5.2.2 $
-+ * Date: $Date: 2005/05/23 13:47:33 $
-+ * Purpose: All functions regardig interrupt moderation
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
-+ *
-+ * Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
-+ * Server Adapters.
-+ *
-+ * Author: Ralph Roesler (rroesler@syskonnect.de)
-+ * Mirko Lindner (mlindner@syskonnect.de)
-+ *
-+ * Address all question to: linux@syskonnect.de
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -20,723 +28,367 @@
- *
- * The information in this file is provided "AS IS" without warranty.
- *
-- ******************************************************************************/
-+ *****************************************************************************/
-
--/******************************************************************************
-- *
-- * Description:
-- *
-- * This module is intended to manage the dynamic interrupt moderation on both
-- * GEnesis and Yukon adapters.
-- *
-- * Include File Hierarchy:
-- *
-- * "skdrv1st.h"
-- * "skdrv2nd.h"
-- *
-- ******************************************************************************/
--
--#ifndef lint
--static const char SysKonnectFileId[] =
-- "@(#) $Id: skdim.c,v 1.5 2003/11/28 12:55:40 rroesler Exp $ (C) SysKonnect.";
--#endif
--
--#define __SKADDR_C
--
--#ifdef __cplusplus
--#error C++ is not yet supported.
--extern "C" {
--#endif
--
--/*******************************************************************************
--**
--** Includes
--**
--*******************************************************************************/
--
--#ifndef __INC_SKDRV1ST_H
- #include "h/skdrv1st.h"
--#endif
--
--#ifndef __INC_SKDRV2ND_H
- #include "h/skdrv2nd.h"
--#endif
-
--#include <linux/kernel_stat.h>
--
--/*******************************************************************************
--**
--** Defines
--**
--*******************************************************************************/
--
--/*******************************************************************************
--**
--** Typedefs
--**
--*******************************************************************************/
-+/******************************************************************************
-+ *
-+ * Local Function Prototypes
-+ *
-+ *****************************************************************************/
-
--/*******************************************************************************
--**
--** Local function prototypes
--**
--*******************************************************************************/
--
--static unsigned int GetCurrentSystemLoad(SK_AC *pAC);
--static SK_U64 GetIsrCalls(SK_AC *pAC);
--static SK_BOOL IsIntModEnabled(SK_AC *pAC);
--static void SetCurrIntCtr(SK_AC *pAC);
--static void EnableIntMod(SK_AC *pAC);
--static void DisableIntMod(SK_AC *pAC);
--static void ResizeDimTimerDuration(SK_AC *pAC);
--static void DisplaySelectedModerationType(SK_AC *pAC);
--static void DisplaySelectedModerationMask(SK_AC *pAC);
--static void DisplayDescrRatio(SK_AC *pAC);
-+static SK_U64 getIsrCalls(SK_AC *pAC);
-+static SK_BOOL isIntModEnabled(SK_AC *pAC);
-+static void setCurrIntCtr(SK_AC *pAC);
-+static void enableIntMod(SK_AC *pAC);
-+static void disableIntMod(SK_AC *pAC);
-
--/*******************************************************************************
--**
--** Global variables
--**
--*******************************************************************************/
-+#define M_DIMINFO pAC->DynIrqModInfo
-
--/*******************************************************************************
--**
--** Local variables
--**
--*******************************************************************************/
-+/******************************************************************************
-+ *
-+ * Global Functions
-+ *
-+ *****************************************************************************/
-
--/*******************************************************************************
--**
--** Global functions
--**
--*******************************************************************************/
-+/*****************************************************************************
-+ *
-+ * SkDimModerate - Moderates the IRQs depending on the current needs
-+ *
-+ * Description:
-+ * Moderation of IRQs depends on the number of occurred IRQs with
-+ * respect to the previous moderation cycle.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+void SkDimModerate(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_U64 IsrCalls = getIsrCalls(pAC);
-+
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==> SkDimModerate\n"));
-+
-+ if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-+ if (isIntModEnabled(pAC)) {
-+ if (IsrCalls < M_DIMINFO.MaxModIntsPerSecLowerLimit) {
-+ disableIntMod(pAC);
-+ }
-+ } else {
-+ if (IsrCalls > M_DIMINFO.MaxModIntsPerSecUpperLimit) {
-+ enableIntMod(pAC);
-+ }
-+ }
-+ }
-+ setCurrIntCtr(pAC);
-
--/*******************************************************************************
--** Function : SkDimModerate
--** Description : Called in every ISR to check if moderation is to be applied
--** or not for the current number of interrupts
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : void (!)
--** Notes : -
--*******************************************************************************/
--
--void
--SkDimModerate(SK_AC *pAC) {
-- unsigned int CurrSysLoad = 0; /* expressed in percent */
-- unsigned int LoadIncrease = 0; /* expressed in percent */
-- SK_U64 ThresholdInts = 0;
-- SK_U64 IsrCallsPerSec = 0;
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("<== SkDimModerate\n"));
-+}
-
--#define M_DIMINFO pAC->DynIrqModInfo
-+/*****************************************************************************
-+ *
-+ * SkDimStartModerationTimer - Starts the moderation timer
-+ *
-+ * Description:
-+ * Dynamic interrupt moderation is regularly checked using the
-+ * so-called moderation timer. This timer is started with this function.
-+ *
-+ * Returns: N/A
-+ */
-+void SkDimStartModerationTimer(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_EVPARA EventParam; /* Event struct for timer event */
-+
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("==> SkDimStartModerationTimer\n"));
-
-- if (!IsIntModEnabled(pAC)) {
-- if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-- CurrSysLoad = GetCurrentSystemLoad(pAC);
-- if (CurrSysLoad > 75) {
-- /*
-- ** More than 75% total system load! Enable the moderation
-- ** to shield the system against too many interrupts.
-- */
-- EnableIntMod(pAC);
-- } else if (CurrSysLoad > M_DIMINFO.PrevSysLoad) {
-- LoadIncrease = (CurrSysLoad - M_DIMINFO.PrevSysLoad);
-- if (LoadIncrease > ((M_DIMINFO.PrevSysLoad *
-- C_INT_MOD_ENABLE_PERCENTAGE) / 100)) {
-- if (CurrSysLoad > 10) {
-- /*
-- ** More than 50% increase with respect to the
-- ** previous load of the system. Most likely this
-- ** is due to our ISR-proc...
-- */
-- EnableIntMod(pAC);
-- }
-- }
-- } else {
-- /*
-- ** Neither too much system load at all nor too much increase
-- ** with respect to the previous system load. Hence, we can leave
-- ** the ISR-handling like it is without enabling moderation.
-- */
-- }
-- M_DIMINFO.PrevSysLoad = CurrSysLoad;
-- }
-- } else {
-- if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-- ThresholdInts = ((M_DIMINFO.MaxModIntsPerSec *
-- C_INT_MOD_DISABLE_PERCENTAGE) / 100);
-- IsrCallsPerSec = GetIsrCalls(pAC);
-- if (IsrCallsPerSec <= ThresholdInts) {
-- /*
-- ** The number of interrupts within the last second is
-- ** lower than the disable_percentage of the desried
-- ** maxrate. Therefore we can disable the moderation.
-- */
-- DisableIntMod(pAC);
-- M_DIMINFO.MaxModIntsPerSec =
-- (M_DIMINFO.MaxModIntsPerSecUpperLimit +
-- M_DIMINFO.MaxModIntsPerSecLowerLimit) / 2;
-- } else {
-- /*
-- ** The number of interrupts per sec is the same as expected.
-- ** Evalulate the descriptor-ratio. If it has changed, a resize
-- ** in the moderation timer might be usefull
-- */
-- if (M_DIMINFO.AutoSizing) {
-- ResizeDimTimerDuration(pAC);
-- }
-- }
-- }
-- }
--
-- /*
-- ** Some information to the log...
-- */
-- if (M_DIMINFO.DisplayStats) {
-- DisplaySelectedModerationType(pAC);
-- DisplaySelectedModerationMask(pAC);
-- DisplayDescrRatio(pAC);
-- }
-+ if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-+ SK_MEMSET((char *) &EventParam, 0, sizeof(EventParam));
-+ EventParam.Para32[0] = SK_DRV_MODERATION_TIMER;
-+ SkTimerStart(pAC, pAC->IoBase,
-+ &pAC->DynIrqModInfo.ModTimer,
-+ pAC->DynIrqModInfo.DynIrqModSampleInterval * 1000000,
-+ SKGE_DRV, SK_DRV_TIMER, EventParam);
-+ }
-
-- M_DIMINFO.NbrProcessedDescr = 0;
-- SetCurrIntCtr(pAC);
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== SkDimStartModerationTimer\n"));
- }
-
--/*******************************************************************************
--** Function : SkDimStartModerationTimer
--** Description : Starts the audit-timer for the dynamic interrupt moderation
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : void (!)
--** Notes : -
--*******************************************************************************/
--
--void
--SkDimStartModerationTimer(SK_AC *pAC) {
-- SK_EVPARA EventParam; /* Event struct for timer event */
--
-- SK_MEMSET((char *) &EventParam, 0, sizeof(EventParam));
-- EventParam.Para32[0] = SK_DRV_MODERATION_TIMER;
-- SkTimerStart(pAC, pAC->IoBase, &pAC->DynIrqModInfo.ModTimer,
-- SK_DRV_MODERATION_TIMER_LENGTH,
-- SKGE_DRV, SK_DRV_TIMER, EventParam);
--}
-+/*****************************************************************************
-+ *
-+ * SkDimEnableModerationIfNeeded - Enables or disables any moderationtype
-+ *
-+ * Description:
-+ * This function effectively initializes the IRQ moderation of a network
-+ * adapter. Depending on the configuration, this might be either static
-+ * or dynamic. If no moderation is configured, this function will do
-+ * nothing.
-+ *
-+ * Returns: N/A
-+ */
-+void SkDimEnableModerationIfNeeded(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("==> SkDimEnableModerationIfNeeded\n"));
-+
-+ if (M_DIMINFO.IntModTypeSelect != C_INT_MOD_NONE) {
-+ if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_STATIC) {
-+ enableIntMod(pAC);
-+ } else { /* must be C_INT_MOD_DYNAMIC */
-+ SkDimStartModerationTimer(pAC);
-+ }
-+ }
-
--/*******************************************************************************
--** Function : SkDimEnableModerationIfNeeded
--** Description : Either enables or disables moderation
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : void (!)
--** Notes : This function is called when a particular adapter is opened
--** There is no Disable function, because when all interrupts
--** might be disable, the moderation timer has no meaning at all
--******************************************************************************/
--
--void
--SkDimEnableModerationIfNeeded(SK_AC *pAC) {
--
-- if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_STATIC) {
-- EnableIntMod(pAC); /* notification print in this function */
-- } else if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-- SkDimStartModerationTimer(pAC);
-- if (M_DIMINFO.DisplayStats) {
-- printk("Dynamic moderation has been enabled\n");
-- }
-- } else {
-- if (M_DIMINFO.DisplayStats) {
-- printk("No moderation has been enabled\n");
-- }
-- }
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== SkDimEnableModerationIfNeeded\n"));
- }
-
--/*******************************************************************************
--** Function : SkDimDisplayModerationSettings
--** Description : Displays the current settings regaring interrupt moderation
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : void (!)
--** Notes : -
--*******************************************************************************/
--
--void
--SkDimDisplayModerationSettings(SK_AC *pAC) {
-- DisplaySelectedModerationType(pAC);
-- DisplaySelectedModerationMask(pAC);
--}
-+/*****************************************************************************
-+ *
-+ * SkDimDisableModeration - disables moderation if it is enabled
-+ *
-+ * Description:
-+ * Disabling of the moderation requires that is enabled already.
-+ *
-+ * Returns: N/A
-+ */
-+void SkDimDisableModeration(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int CurrentModeration) /* type of current moderation */
-+{
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("==> SkDimDisableModeration\n"));
-+
-+ if (M_DIMINFO.IntModTypeSelect != C_INT_MOD_NONE) {
-+ if (CurrentModeration == C_INT_MOD_STATIC) {
-+ disableIntMod(pAC);
-+ } else { /* must be C_INT_MOD_DYNAMIC */
-+ SkTimerStop(pAC, pAC->IoBase, &M_DIMINFO.ModTimer);
-+ disableIntMod(pAC);
-+ }
-+ }
-
--/*******************************************************************************
--**
--** Local functions
--**
--*******************************************************************************/
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== SkDimDisableModeration\n"));
-+}
-
--/*******************************************************************************
--** Function : GetCurrentSystemLoad
--** Description : Retrieves the current system load of the system. This load
--** is evaluated for all processors within the system.
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : unsigned int: load expressed in percentage
--** Notes : The possible range being returned is from 0 up to 100.
--** Whereas 0 means 'no load at all' and 100 'system fully loaded'
--** It is impossible to determine what actually causes the system
--** to be in 100%, but maybe that is due to too much interrupts.
--*******************************************************************************/
--
--static unsigned int
--GetCurrentSystemLoad(SK_AC *pAC) {
-- unsigned long jif = jiffies;
-- unsigned int UserTime = 0;
-- unsigned int SystemTime = 0;
-- unsigned int NiceTime = 0;
-- unsigned int IdleTime = 0;
-- unsigned int TotalTime = 0;
-- unsigned int UsedTime = 0;
-- unsigned int SystemLoad = 0;
-+/******************************************************************************
-+ *
-+ * Local Functions
-+ *
-+ *****************************************************************************/
-
-- /* unsigned int NbrCpu = 0; */
-+/*****************************************************************************
-+ *
-+ * getIsrCalls - evaluate the number of IRQs handled in mod interval
-+ *
-+ * Description:
-+ * Depending on the selected moderation mask, this function will return
-+ * the number of interrupts handled in the previous moderation interval.
-+ * This evaluated number is based on the current number of interrupts
-+ * stored in PNMI-context and the previous stored interrupts.
-+ *
-+ * Returns:
-+ * the number of IRQs handled
-+ */
-+static SK_U64 getIsrCalls(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_U64 RxPort0IntDiff = 0, RxPort1IntDiff = 0;
-+ SK_U64 TxPort0IntDiff = 0, TxPort1IntDiff = 0;
-+ SK_U64 StatusPort0IntDiff = 0, StatusPort1IntDiff = 0;
-+
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==>getIsrCalls\n"));
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if ((M_DIMINFO.MaskIrqModeration == IRQ_MASK_TX_ONLY) ||
-+ (M_DIMINFO.MaskIrqModeration == IRQ_MASK_SP_TX)) {
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ TxPort1IntDiff =
-+ pAC->Pnmi.Port[1].TxIntrCts -
-+ M_DIMINFO.PrevPort1TxIntrCts;
-+ }
-+ TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
-+ M_DIMINFO.PrevPort0TxIntrCts;
-+ } else if ((M_DIMINFO.MaskIrqModeration == IRQ_MASK_RX_ONLY) ||
-+ (M_DIMINFO.MaskIrqModeration == IRQ_MASK_SP_RX)) {
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ RxPort1IntDiff =
-+ pAC->Pnmi.Port[1].RxIntrCts -
-+ M_DIMINFO.PrevPort1RxIntrCts;
-+ }
-+ RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
-+ M_DIMINFO.PrevPort0RxIntrCts;
-+ } else {
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ RxPort1IntDiff =
-+ pAC->Pnmi.Port[1].RxIntrCts -
-+ M_DIMINFO.PrevPort1RxIntrCts;
-+ TxPort1IntDiff =
-+ pAC->Pnmi.Port[1].TxIntrCts -
-+ M_DIMINFO.PrevPort1TxIntrCts;
-+ }
-+ RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
-+ M_DIMINFO.PrevPort0RxIntrCts;
-+ TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
-+ M_DIMINFO.PrevPort0TxIntrCts;
-+ }
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("==>getIsrCalls (!CHIP_ID_YUKON_2)\n"));
-+ return (RxPort0IntDiff + RxPort1IntDiff +
-+ TxPort0IntDiff + TxPort1IntDiff);
-+ }
-
- /*
-- ** The following lines have been commented out, because
-- ** from kernel 2.5.44 onwards, the kernel-owned structure
-- **
-- ** struct kernel_stat kstat
-- **
-- ** is not marked as an exported symbol in the file
-+ ** We have a Yukon2 compliant chipset if we come up to here
- **
-- ** kernel/ksyms.c
-- **
-- ** As a consequence, using this driver as KLM is not possible
-- ** and any access of the structure kernel_stat via the
-- ** dedicated macros kstat_cpu(i).cpustat.xxx is to be avoided.
-- **
-- ** The kstat-information might be added again in future
-- ** versions of the 2.5.xx kernel, but for the time being,
-- ** number of interrupts will serve as indication how much
-- ** load we currently have...
-- **
-- ** for (NbrCpu = 0; NbrCpu < num_online_cpus(); NbrCpu++) {
-- ** UserTime = UserTime + kstat_cpu(NbrCpu).cpustat.user;
-- ** NiceTime = NiceTime + kstat_cpu(NbrCpu).cpustat.nice;
-- ** SystemTime = SystemTime + kstat_cpu(NbrCpu).cpustat.system;
-- ** }
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ StatusPort1IntDiff = pAC->Pnmi.Port[1].StatusLeIntrCts -
-+ M_DIMINFO.PrevPort1StatusIntrCts;
-+ }
-+ StatusPort0IntDiff = pAC->Pnmi.Port[0].StatusLeIntrCts -
-+ M_DIMINFO.PrevPort0StatusIntrCts;
- */
-- SK_U64 ThresholdInts = 0;
-- SK_U64 IsrCallsPerSec = 0;
--
-- ThresholdInts = ((M_DIMINFO.MaxModIntsPerSec *
-- C_INT_MOD_ENABLE_PERCENTAGE) + 100);
-- IsrCallsPerSec = GetIsrCalls(pAC);
-- if (IsrCallsPerSec >= ThresholdInts) {
-- /*
-- ** We do not know how much the real CPU-load is!
-- ** Return 80% as a default in order to activate DIM
-- */
-- SystemLoad = 80;
-- return (SystemLoad);
-- }
--
-- UsedTime = UserTime + NiceTime + SystemTime;
--
-- IdleTime = jif * num_online_cpus() - UsedTime;
-- TotalTime = UsedTime + IdleTime;
--
-- SystemLoad = ( 100 * (UsedTime - M_DIMINFO.PrevUsedTime) ) /
-- (TotalTime - M_DIMINFO.PrevTotalTime);
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("==>getIsrCalls (CHIP_ID_YUKON_2)\n"));
-+ return (StatusPort0IntDiff + StatusPort1IntDiff);
-+}
-
-- if (M_DIMINFO.DisplayStats) {
-- printk("Current system load is: %u\n", SystemLoad);
-+/*****************************************************************************
-+ *
-+ * setCurrIntCtr - stores the current number of interrupts
-+ *
-+ * Description:
-+ * Stores the current number of occurred interrupts in the adapter
-+ * context. This is needed to evaluate the umber of interrupts within
-+ * the moderation interval.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void setCurrIntCtr(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==>setCurrIntCtr\n"));
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ M_DIMINFO.PrevPort1RxIntrCts = pAC->Pnmi.Port[1].RxIntrCts;
-+ M_DIMINFO.PrevPort1TxIntrCts = pAC->Pnmi.Port[1].TxIntrCts;
-+ }
-+ M_DIMINFO.PrevPort0RxIntrCts = pAC->Pnmi.Port[0].RxIntrCts;
-+ M_DIMINFO.PrevPort0TxIntrCts = pAC->Pnmi.Port[0].TxIntrCts;
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== setCurrIntCtr (!CHIP_ID_YUKON_2)\n"));
-+ return;
- }
-
-- M_DIMINFO.PrevTotalTime = TotalTime;
-- M_DIMINFO.PrevUsedTime = UsedTime;
--
-- return (SystemLoad);
-+ /*
-+ ** We have a Yukon2 compliant chipset if we come up to here
-+ **
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ M_DIMINFO.PrevPort1StatusIntrCts = pAC->Pnmi.Port[1].StatusLeIntrCts;
-+ }
-+ M_DIMINFO.PrevPort0StatusIntrCts = pAC->Pnmi.Port[0].StatusLeIntrCts;
-+ */
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== setCurrIntCtr (CHIP_ID_YUKON_2)\n"));
- }
-
--/*******************************************************************************
--** Function : GetIsrCalls
--** Description : Depending on the selected moderation mask, this function will
--** return the number of interrupts handled in the previous time-
--** frame. This evaluated number is based on the current number
--** of interrupts stored in PNMI-context and the previous stored
--** interrupts.
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : int: the number of interrupts being executed in the last
--** timeframe
--** Notes : It makes only sense to call this function, when dynamic
--** interrupt moderation is applied
--*******************************************************************************/
--
--static SK_U64
--GetIsrCalls(SK_AC *pAC) {
-- SK_U64 RxPort0IntDiff = 0;
-- SK_U64 RxPort1IntDiff = 0;
-- SK_U64 TxPort0IntDiff = 0;
-- SK_U64 TxPort1IntDiff = 0;
--
-- if (pAC->DynIrqModInfo.MaskIrqModeration == IRQ_MASK_TX_ONLY) {
-- if (pAC->GIni.GIMacsFound == 2) {
-- TxPort1IntDiff = pAC->Pnmi.Port[1].TxIntrCts -
-- pAC->DynIrqModInfo.PrevPort1TxIntrCts;
-- }
-- TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
-- pAC->DynIrqModInfo.PrevPort0TxIntrCts;
-- } else if (pAC->DynIrqModInfo.MaskIrqModeration == IRQ_MASK_RX_ONLY) {
-- if (pAC->GIni.GIMacsFound == 2) {
-- RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort1RxIntrCts;
-- }
-- RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort0RxIntrCts;
-- } else {
-- if (pAC->GIni.GIMacsFound == 2) {
-- RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort1RxIntrCts;
-- TxPort1IntDiff = pAC->Pnmi.Port[1].TxIntrCts -
-- pAC->DynIrqModInfo.PrevPort1TxIntrCts;
-- }
-- RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort0RxIntrCts;
-- TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
-- pAC->DynIrqModInfo.PrevPort0TxIntrCts;
-- }
--
-- return (RxPort0IntDiff + RxPort1IntDiff + TxPort0IntDiff + TxPort1IntDiff);
-+/*****************************************************************************
-+ *
-+ * isIntModEnabled - returns the current state of interrupt moderation
-+ *
-+ * Description:
-+ * This function retrieves the current value of the interrupt moderation
-+ * command register. Its content determines whether any moderation is
-+ * running or not.
-+ *
-+ * Returns:
-+ * SK_TRUE : IRQ moderation is currently active
-+ * SK_FALSE: No IRQ moderation is active
-+ */
-+static SK_BOOL isIntModEnabled(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ unsigned long CtrCmd;
-+
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==>isIntModEnabled\n"));
-+
-+ SK_IN32(pAC->IoBase, B2_IRQM_CTRL, &CtrCmd);
-+ if ((CtrCmd & TIM_START) == TIM_START) {
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== isIntModEnabled (SK_TRUE)\n"));
-+ return SK_TRUE;
-+ }
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,
-+ ("<== isIntModEnabled (SK_FALSE)\n"));
-+ return SK_FALSE;
- }
-
--/*******************************************************************************
--** Function : GetRxCalls
--** Description : This function will return the number of times a receive inter-
--** rupt was processed. This is needed to evaluate any resizing
--** factor.
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : SK_U64: the number of RX-ints being processed
--** Notes : It makes only sense to call this function, when dynamic
--** interrupt moderation is applied
--*******************************************************************************/
--
--static SK_U64
--GetRxCalls(SK_AC *pAC) {
-- SK_U64 RxPort0IntDiff = 0;
-- SK_U64 RxPort1IntDiff = 0;
--
-- if (pAC->GIni.GIMacsFound == 2) {
-- RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort1RxIntrCts;
-- }
-- RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
-- pAC->DynIrqModInfo.PrevPort0RxIntrCts;
--
-- return (RxPort0IntDiff + RxPort1IntDiff);
--}
-+/*****************************************************************************
-+ *
-+ * enableIntMod - enables the interrupt moderation
-+ *
-+ * Description:
-+ * Enabling the interrupt moderation is done by putting the desired
-+ * moderation interval in the B2_IRQM_INI register, specifying the
-+ * desired maks in the B2_IRQM_MSK register and finally starting the
-+ * IRQ moderation timer using the B2_IRQM_CTRL register.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void enableIntMod(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ unsigned long ModBase;
-+
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==> enableIntMod\n"));
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
-+ ModBase = C_CLK_FREQ_GENESIS / M_DIMINFO.MaxModIntsPerSec;
-+ } else if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) {
-+ ModBase = C_CLK_FREQ_YUKON_EC / M_DIMINFO.MaxModIntsPerSec;
-+ } else {
-+ ModBase = C_CLK_FREQ_YUKON / M_DIMINFO.MaxModIntsPerSec;
-+ }
-
--/*******************************************************************************
--** Function : SetCurrIntCtr
--** Description : Will store the current number orf occured interrupts in the
--** adapter context. This is needed to evaluated the number of
--** interrupts within a current timeframe.
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : void (!)
--** Notes : -
--*******************************************************************************/
--
--static void
--SetCurrIntCtr(SK_AC *pAC) {
-- if (pAC->GIni.GIMacsFound == 2) {
-- pAC->DynIrqModInfo.PrevPort1RxIntrCts = pAC->Pnmi.Port[1].RxIntrCts;
-- pAC->DynIrqModInfo.PrevPort1TxIntrCts = pAC->Pnmi.Port[1].TxIntrCts;
-- }
-- pAC->DynIrqModInfo.PrevPort0RxIntrCts = pAC->Pnmi.Port[0].RxIntrCts;
-- pAC->DynIrqModInfo.PrevPort0TxIntrCts = pAC->Pnmi.Port[0].TxIntrCts;
--}
-+ SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase);
-+ SK_OUT32(pAC->IoBase, B2_IRQM_MSK, M_DIMINFO.MaskIrqModeration);
-+ SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START);
-
--/*******************************************************************************
--** Function : IsIntModEnabled()
--** Description : Retrieves the current value of the interrupts moderation
--** command register. Its content determines whether any
--** moderation is running or not.
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : SK_TRUE : if mod timer running
--** SK_FALSE : if no moderation is being performed
--** Notes : -
--*******************************************************************************/
--
--static SK_BOOL
--IsIntModEnabled(SK_AC *pAC) {
-- unsigned long CtrCmd;
--
-- SK_IN32(pAC->IoBase, B2_IRQM_CTRL, &CtrCmd);
-- if ((CtrCmd & TIM_START) == TIM_START) {
-- return SK_TRUE;
-- } else {
-- return SK_FALSE;
-- }
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("<== enableIntMod\n"));
- }
-
--/*******************************************************************************
--** Function : EnableIntMod()
--** Description : Enables the interrupt moderation using the values stored in
--** in the pAC->DynIntMod data structure
--** Programmer : Ralph Roesler
--** Last Modified: 22-mar-03
--** Returns : -
--** Notes : -
--*******************************************************************************/
--
--static void
--EnableIntMod(SK_AC *pAC) {
-- unsigned long ModBase;
--
-- if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
-- ModBase = C_CLK_FREQ_GENESIS / pAC->DynIrqModInfo.MaxModIntsPerSec;
-- } else {
-- ModBase = C_CLK_FREQ_YUKON / pAC->DynIrqModInfo.MaxModIntsPerSec;
-- }
--
-- SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase);
-- SK_OUT32(pAC->IoBase, B2_IRQM_MSK, pAC->DynIrqModInfo.MaskIrqModeration);
-- SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START);
-- if (M_DIMINFO.DisplayStats) {
-- printk("Enabled interrupt moderation (%i ints/sec)\n",
-- M_DIMINFO.MaxModIntsPerSec);
-- }
--}
-+/*****************************************************************************
-+ *
-+ * disableIntMod - disables the interrupt moderation
-+ *
-+ * Description:
-+ * Disabling the interrupt moderation is done by stopping the
-+ * IRQ moderation timer using the B2_IRQM_CTRL register.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void disableIntMod(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("==> disableIntMod\n"));
-
--/*******************************************************************************
--** Function : DisableIntMod()
--** Description : Disbles the interrupt moderation independent of what inter-
--** rupts are running or not
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : -
--** Notes : -
--*******************************************************************************/
--
--static void
--DisableIntMod(SK_AC *pAC) {
--
-- SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_STOP);
-- if (M_DIMINFO.DisplayStats) {
-- printk("Disabled interrupt moderation\n");
-- }
--}
-+ SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_STOP);
-
--/*******************************************************************************
--** Function : ResizeDimTimerDuration();
--** Description : Checks the current used descriptor ratio and resizes the
--** duration timer (longer/smaller) if possible.
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : -
--** Notes : There are both maximum and minimum timer duration value.
--** This function assumes that interrupt moderation is already
--** enabled!
--*******************************************************************************/
--
--static void
--ResizeDimTimerDuration(SK_AC *pAC) {
-- SK_BOOL IncreaseTimerDuration;
-- int TotalMaxNbrDescr;
-- int UsedDescrRatio;
-- int RatioDiffAbs;
-- int RatioDiffRel;
-- int NewMaxModIntsPerSec;
-- int ModAdjValue;
-- long ModBase;
--
-- /*
-- ** Check first if we are allowed to perform any modification
-- */
-- if (IsIntModEnabled(pAC)) {
-- if (M_DIMINFO.IntModTypeSelect != C_INT_MOD_DYNAMIC) {
-- return;
-- } else {
-- if (M_DIMINFO.ModJustEnabled) {
-- M_DIMINFO.ModJustEnabled = SK_FALSE;
-- return;
-- }
-- }
-- }
--
-- /*
-- ** If we got until here, we have to evaluate the amount of the
-- ** descriptor ratio change...
-- */
-- TotalMaxNbrDescr = pAC->RxDescrPerRing * GetRxCalls(pAC);
-- UsedDescrRatio = (M_DIMINFO.NbrProcessedDescr * 100) / TotalMaxNbrDescr;
--
-- if (UsedDescrRatio > M_DIMINFO.PrevUsedDescrRatio) {
-- RatioDiffAbs = (UsedDescrRatio - M_DIMINFO.PrevUsedDescrRatio);
-- RatioDiffRel = (RatioDiffAbs * 100) / UsedDescrRatio;
-- M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
-- IncreaseTimerDuration = SK_FALSE; /* in other words: DECREASE */
-- } else if (UsedDescrRatio < M_DIMINFO.PrevUsedDescrRatio) {
-- RatioDiffAbs = (M_DIMINFO.PrevUsedDescrRatio - UsedDescrRatio);
-- RatioDiffRel = (RatioDiffAbs * 100) / M_DIMINFO.PrevUsedDescrRatio;
-- M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
-- IncreaseTimerDuration = SK_TRUE; /* in other words: INCREASE */
-- } else {
-- RatioDiffAbs = (M_DIMINFO.PrevUsedDescrRatio - UsedDescrRatio);
-- RatioDiffRel = (RatioDiffAbs * 100) / M_DIMINFO.PrevUsedDescrRatio;
-- M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
-- IncreaseTimerDuration = SK_TRUE; /* in other words: INCREASE */
-- }
--
-- /*
-- ** Now we can determine the change in percent
-- */
-- if ((RatioDiffRel >= 0) && (RatioDiffRel <= 5) ) {
-- ModAdjValue = 1; /* 1% change - maybe some other value in future */
-- } else if ((RatioDiffRel > 5) && (RatioDiffRel <= 10) ) {
-- ModAdjValue = 1; /* 1% change - maybe some other value in future */
-- } else if ((RatioDiffRel > 10) && (RatioDiffRel <= 15) ) {
-- ModAdjValue = 1; /* 1% change - maybe some other value in future */
-- } else {
-- ModAdjValue = 1; /* 1% change - maybe some other value in future */
-- }
--
-- if (IncreaseTimerDuration) {
-- NewMaxModIntsPerSec = M_DIMINFO.MaxModIntsPerSec +
-- (M_DIMINFO.MaxModIntsPerSec * ModAdjValue) / 100;
-- } else {
-- NewMaxModIntsPerSec = M_DIMINFO.MaxModIntsPerSec -
-- (M_DIMINFO.MaxModIntsPerSec * ModAdjValue) / 100;
-- }
--
-- /*
-- ** Check if we exceed boundaries...
-- */
-- if ( (NewMaxModIntsPerSec > M_DIMINFO.MaxModIntsPerSecUpperLimit) ||
-- (NewMaxModIntsPerSec < M_DIMINFO.MaxModIntsPerSecLowerLimit)) {
-- if (M_DIMINFO.DisplayStats) {
-- printk("Cannot change ModTim from %i to %i ints/sec\n",
-- M_DIMINFO.MaxModIntsPerSec, NewMaxModIntsPerSec);
-- }
-- return;
-- } else {
-- if (M_DIMINFO.DisplayStats) {
-- printk("Resized ModTim from %i to %i ints/sec\n",
-- M_DIMINFO.MaxModIntsPerSec, NewMaxModIntsPerSec);
-- }
-- }
--
-- M_DIMINFO.MaxModIntsPerSec = NewMaxModIntsPerSec;
--
-- if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
-- ModBase = C_CLK_FREQ_GENESIS / pAC->DynIrqModInfo.MaxModIntsPerSec;
-- } else {
-- ModBase = C_CLK_FREQ_YUKON / pAC->DynIrqModInfo.MaxModIntsPerSec;
-- }
--
-- /*
-- ** We do not need to touch any other registers
-- */
-- SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase);
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_MSG,("<== disableIntMod\n"));
- }
-
- /*******************************************************************************
--** Function : DisplaySelectedModerationType()
--** Description : Displays what type of moderation we have
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : void!
--** Notes : -
--*******************************************************************************/
--
--static void
--DisplaySelectedModerationType(SK_AC *pAC) {
--
-- if (pAC->DynIrqModInfo.DisplayStats) {
-- if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) {
-- printk("Static int moderation runs with %i INTS/sec\n",
-- pAC->DynIrqModInfo.MaxModIntsPerSec);
-- } else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-- if (IsIntModEnabled(pAC)) {
-- printk("Dynamic int moderation runs with %i INTS/sec\n",
-- pAC->DynIrqModInfo.MaxModIntsPerSec);
-- } else {
-- printk("Dynamic int moderation currently not applied\n");
-- }
-- } else {
-- printk("No interrupt moderation selected!\n");
-- }
-- }
--}
--
--/*******************************************************************************
--** Function : DisplaySelectedModerationMask()
--** Description : Displays what interrupts are moderated
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : void!
--** Notes : -
--*******************************************************************************/
--
--static void
--DisplaySelectedModerationMask(SK_AC *pAC) {
--
-- if (pAC->DynIrqModInfo.DisplayStats) {
-- if (pAC->DynIrqModInfo.IntModTypeSelect != C_INT_MOD_NONE) {
-- switch (pAC->DynIrqModInfo.MaskIrqModeration) {
-- case IRQ_MASK_TX_ONLY:
-- printk("Only Tx-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_RX_ONLY:
-- printk("Only Rx-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_SP_ONLY:
-- printk("Only special-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_TX_RX:
-- printk("Tx- and Rx-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_SP_RX:
-- printk("Special- and Rx-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_SP_TX:
-- printk("Special- and Tx-interrupts are moderated\n");
-- break;
-- case IRQ_MASK_RX_TX_SP:
-- printk("All Rx-, Tx and special-interrupts are moderated\n");
-- break;
-- default:
-- printk("Don't know what is moderated\n");
-- break;
-- }
-- } else {
-- printk("No specific interrupts masked for moderation\n");
-- }
-- }
--}
--
--/*******************************************************************************
--** Function : DisplayDescrRatio
--** Description : Like the name states...
--** Programmer : Ralph Roesler
--** Last Modified: 23-mar-03
--** Returns : void!
--** Notes : -
--*******************************************************************************/
--
--static void
--DisplayDescrRatio(SK_AC *pAC) {
-- int TotalMaxNbrDescr = 0;
--
-- if (pAC->DynIrqModInfo.DisplayStats) {
-- TotalMaxNbrDescr = pAC->RxDescrPerRing * GetRxCalls(pAC);
-- printk("Ratio descriptors: %i/%i\n",
-- M_DIMINFO.NbrProcessedDescr, TotalMaxNbrDescr);
-- }
--}
--
--/*******************************************************************************
--**
--** End of file
--**
--*******************************************************************************/
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/skethtool.c ./drivers/net/sk98lin/skethtool.c
---- ./drivers/net/sk98lin.sk98/skethtool.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/skethtool.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,1356 @@
-+/******************************************************************************
-+ *
-+ * Name: skethtool.c
-+ * Project: GEnesis, PCI Gigabit Ethernet Adapter
-+ * Version: $Revision: 1.3.2.11 $
-+ * Date: $Date: 2005/10/27 12:42:34 $
-+ * Purpose: All functions regarding ethtool handling
-+ *
-+ ******************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * (C)Copyright 1998-2002 SysKonnect GmbH.
-+ * (C)Copyright 2002-2005 Marvell.
-+ *
-+ * Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
-+ * Server Adapters.
-+ *
-+ * Author: Ralph Roesler (rroesler@syskonnect.de)
-+ * Mirko Lindner (mlindner@syskonnect.de)
-+ *
-+ * Address all question to: linux@syskonnect.de
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * The information in this file is provided "AS IS" without warranty.
-+ *
-+ *****************************************************************************/
-+
-+#include "h/skdrv1st.h"
-+#include "h/skdrv2nd.h"
-+#include "h/skversion.h"
-+#include <linux/ethtool.h>
-+#include <linux/module.h>
-+#include <linux/timer.h>
-+
-+/******************************************************************************
-+ *
-+ * External Functions and Data
-+ *
-+ *****************************************************************************/
-+
-+extern void SkDimDisableModeration(SK_AC *pAC, int CurrentModeration);
-+extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
-+
-+/******************************************************************************
-+ *
-+ * Defines
-+ *
-+ *****************************************************************************/
-+
-+#ifndef ETHT_STATSTRING_LEN
-+#define ETHT_STATSTRING_LEN 32
-+#endif
-+
-+#define SK98LIN_STAT(m) sizeof(((SK_AC *)0)->m),offsetof(SK_AC, m)
-+
-+#define SUPP_COPPER_ALL (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
-+ SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
-+ SUPPORTED_1000baseT_Half| SUPPORTED_1000baseT_Full| \
-+ SUPPORTED_TP)
-+
-+#define ADV_COPPER_ALL (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \
-+ ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | \
-+ ADVERTISED_1000baseT_Half| ADVERTISED_1000baseT_Full| \
-+ ADVERTISED_TP)
-+
-+#define SUPP_FIBRE_ALL (SUPPORTED_1000baseT_Full | \
-+ SUPPORTED_FIBRE | \
-+ SUPPORTED_Autoneg)
-+
-+#define ADV_FIBRE_ALL (ADVERTISED_1000baseT_Full | \
-+ ADVERTISED_FIBRE | \
-+ ADVERTISED_Autoneg)
-+
-+/******************************************************************************
-+ *
-+ * Local Function Prototypes
-+ *
-+ *****************************************************************************/
-+
-+#ifdef ETHTOOL_GSET
-+static void getSettings(SK_AC *pAC, int port, struct ethtool_cmd *ecmd);
-+#endif
-+#ifdef ETHTOOL_SSET
-+static int setSettings(SK_AC *pAC, int port, struct ethtool_cmd *ecmd);
-+#endif
-+#ifdef ETHTOOL_GPAUSEPARAM
-+static void getPauseParams(SK_AC *pAC, int port, struct ethtool_pauseparam *epause);
-+#endif
-+#ifdef ETHTOOL_SPAUSEPARAM
-+static int setPauseParams(SK_AC *pAC, int port, struct ethtool_pauseparam *epause);
-+#endif
-+#ifdef ETHTOOL_GDRVINFO
-+static void getDriverInfo(SK_AC *pAC, int port, struct ethtool_drvinfo *edrvinfo);
-+#endif
-+#ifdef ETHTOOL_PHYS_ID
-+static int startLocateNIC(SK_AC *pAC, int port, struct ethtool_value *blinkSecs);
-+static void toggleLeds(unsigned long ptr);
-+#endif
-+#ifdef ETHTOOL_GCOALESCE
-+static void getModerationParams(SK_AC *pAC, int port, struct ethtool_coalesce *ecoalesc);
-+#endif
-+#ifdef ETHTOOL_SCOALESCE
-+static int setModerationParams(SK_AC *pAC, int port, struct ethtool_coalesce *ecoalesc);
-+#endif
-+#ifdef ETHTOOL_GWOL
-+static void getWOLsettings(SK_AC *pAC, int port, struct ethtool_wolinfo *ewol);
-+#endif
-+#ifdef ETHTOOL_SWOL
-+static int setWOLsettings(SK_AC *pAC, int port, struct ethtool_wolinfo *ewol);
-+#endif
-+
-+static int getPortNumber(struct net_device *netdev, struct ifreq *ifr);
-+
-+/******************************************************************************
-+ *
-+ * Local Variables
-+ *
-+ *****************************************************************************/
-+
-+struct sk98lin_stats {
-+ char stat_string[ETHT_STATSTRING_LEN];
-+ int sizeof_stat;
-+ int stat_offset;
-+};
-+
-+static struct sk98lin_stats sk98lin_etht_stats_port0[] = {
-+ { "rx_packets" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxOkCts) },
-+ { "tx_packets" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxOkCts) },
-+ { "rx_bytes" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxOctetsOkCts) },
-+ { "tx_bytes" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxOctetsOkCts) },
-+ { "rx_errors" , SK98LIN_STAT(PnmiStruct.InErrorsCts) },
-+ { "tx_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxSingleCollisionCts) },
-+ { "rx_dropped" , SK98LIN_STAT(PnmiStruct.RxNoBufCts) },
-+ { "tx_dropped" , SK98LIN_STAT(PnmiStruct.TxNoBufCts) },
-+ { "multicasts" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxMulticastOkCts) },
-+ { "collisions" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxSingleCollisionCts) },
-+ { "rx_length_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxRuntCts) },
-+ { "rx_buffer_overflow_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxFifoOverflowCts) },
-+ { "rx_crc_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxFcsCts) },
-+ { "rx_frame_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxFramingCts) },
-+ { "rx_too_short_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxShortsCts) },
-+ { "rx_too_long_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxTooLongCts) },
-+ { "rx_carrier_extension_errors", SK98LIN_STAT(PnmiStruct.Stat[0].StatRxCextCts) },
-+ { "rx_symbol_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxSymbolCts) },
-+ { "rx_llc_mac_size_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxIRLengthCts) },
-+ { "rx_carrier_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxCarrierCts) },
-+ { "rx_jabber_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxJabberCts) },
-+ { "rx_missed_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatRxMissedCts) },
-+ { "tx_abort_collision_errors" , SK98LIN_STAT(stats.tx_aborted_errors) },
-+ { "tx_carrier_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxCarrierCts) },
-+ { "tx_buffer_underrun_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxFifoUnderrunCts) },
-+ { "tx_heartbeat_errors" , SK98LIN_STAT(PnmiStruct.Stat[0].StatTxCarrierCts) } ,
-+ { "tx_window_errors" , SK98LIN_STAT(stats.tx_window_errors) }
-+};
-+
-+static struct sk98lin_stats sk98lin_etht_stats_port1[] = {
-+ { "rx_packets" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxOkCts) },
-+ { "tx_packets" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxOkCts) },
-+ { "rx_bytes" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxOctetsOkCts) },
-+ { "tx_bytes" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxOctetsOkCts) },
-+ { "rx_errors" , SK98LIN_STAT(PnmiStruct.InErrorsCts) },
-+ { "tx_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxSingleCollisionCts) },
-+ { "rx_dropped" , SK98LIN_STAT(PnmiStruct.RxNoBufCts) },
-+ { "tx_dropped" , SK98LIN_STAT(PnmiStruct.TxNoBufCts) },
-+ { "multicasts" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxMulticastOkCts) },
-+ { "collisions" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxSingleCollisionCts) },
-+ { "rx_length_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxRuntCts) },
-+ { "rx_buffer_overflow_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxFifoOverflowCts) },
-+ { "rx_crc_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxFcsCts) },
-+ { "rx_frame_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxFramingCts) },
-+ { "rx_too_short_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxShortsCts) },
-+ { "rx_too_long_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxTooLongCts) },
-+ { "rx_carrier_extension_errors", SK98LIN_STAT(PnmiStruct.Stat[1].StatRxCextCts) },
-+ { "rx_symbol_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxSymbolCts) },
-+ { "rx_llc_mac_size_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxIRLengthCts) },
-+ { "rx_carrier_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxCarrierCts) },
-+ { "rx_jabber_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxJabberCts) },
-+ { "rx_missed_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatRxMissedCts) },
-+ { "tx_abort_collision_errors" , SK98LIN_STAT(stats.tx_aborted_errors) },
-+ { "tx_carrier_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxCarrierCts) },
-+ { "tx_buffer_underrun_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxFifoUnderrunCts) },
-+ { "tx_heartbeat_errors" , SK98LIN_STAT(PnmiStruct.Stat[1].StatTxCarrierCts) } ,
-+ { "tx_window_errors" , SK98LIN_STAT(stats.tx_window_errors) }
-+};
-+
-+#define SK98LIN_STATS_LEN sizeof(sk98lin_etht_stats_port0) / sizeof(struct sk98lin_stats)
-+
-+static int nbrBlinkQuarterSeconds;
-+static int currentPortIndex;
-+static SK_BOOL isLocateNICrunning = SK_FALSE;
-+static SK_BOOL isDualNetCard = SK_FALSE;
-+static SK_BOOL doSwitchLEDsOn = SK_FALSE;
-+static SK_BOOL boardWasDown[2] = { SK_FALSE, SK_FALSE };
-+static struct timer_list locateNICtimer;
-+
-+/******************************************************************************
-+ *
-+ * Global Functions
-+ *
-+ *****************************************************************************/
-+
-+/*****************************************************************************
-+ *
-+ * SkEthIoctl - IOCTL entry point for all ethtool queries
-+ *
-+ * Description:
-+ * Any IOCTL request that has to deal with the ethtool command tool is
-+ * dispatched via this function.
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error
-+ * !=0: the return value is the error code of the failure
-+ */
-+int SkEthIoctl(
-+struct net_device *netdev, /* the pointer to netdev structure */
-+struct ifreq *ifr) /* what interface the request refers to? */
-+{
-+ DEV_NET *pNet = (DEV_NET*) netdev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ void *pAddr = ifr->ifr_data;
-+ int port = getPortNumber(netdev, ifr);
-+ SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
-+ SK_U32 Size = sizeof(SK_PNMI_STRUCT_DATA);
-+ SK_U32 cmd;
-+ struct sk98lin_stats *sk98lin_etht_stats =
-+ (port == 0) ? sk98lin_etht_stats_port0 : sk98lin_etht_stats_port1;
-+
-+ if (get_user(cmd, (uint32_t *) pAddr)) {
-+ return -EFAULT;
-+ }
-+
-+ switch(cmd) {
-+#ifdef ETHTOOL_GSET
-+ case ETHTOOL_GSET: {
-+ struct ethtool_cmd ecmd = { ETHTOOL_GSET };
-+ getSettings(pAC, port, &ecmd);
-+ if(copy_to_user(pAddr, &ecmd, sizeof(ecmd))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+ break;
-+#endif
-+#ifdef ETHTOOL_SSET
-+ case ETHTOOL_SSET: {
-+ struct ethtool_cmd ecmd;
-+ if(copy_from_user(&ecmd, pAddr, sizeof(ecmd))) {
-+ return -EFAULT;
-+ }
-+ return setSettings(pAC, port, &ecmd);
-+ }
-+ break;
-+#endif
-+#ifdef ETHTOOL_GLINK
-+ case ETHTOOL_GLINK: {
-+ struct ethtool_value edata = { ETHTOOL_GLINK };
-+ edata.data = netif_carrier_ok(netdev);
-+ if (copy_to_user(pAddr, &edata, sizeof(edata)))
-+ return -EFAULT;
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_GDRVINFO
-+ case ETHTOOL_GDRVINFO: {
-+ struct ethtool_drvinfo drvinfo = { ETHTOOL_GDRVINFO };
-+ getDriverInfo(pAC, port, &drvinfo);
-+ if(copy_to_user(pAddr, &drvinfo, sizeof(drvinfo))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+ break;
-+#endif
-+#ifdef ETHTOOL_GSTRINGS
-+ case ETHTOOL_GSTRINGS: {
-+ struct ethtool_gstrings gstrings = { ETHTOOL_GSTRINGS };
-+ char *strings = NULL;
-+ int err = 0;
-+ if(copy_from_user(&gstrings, pAddr, sizeof(gstrings))) {
-+ return -EFAULT;
-+ }
-+ switch(gstrings.string_set) {
-+#ifdef ETHTOOL_GSTATS
-+ case ETH_SS_STATS: {
-+ int i;
-+ gstrings.len = SK98LIN_STATS_LEN;
-+ if ((strings = kmalloc(SK98LIN_STATS_LEN*ETHT_STATSTRING_LEN,GFP_KERNEL)) == NULL) {
-+ return -ENOMEM;
-+ }
-+ for(i=0; i < SK98LIN_STATS_LEN; i++) {
-+ memcpy(&strings[i * ETHT_STATSTRING_LEN],
-+ &(sk98lin_etht_stats[i].stat_string),
-+ ETHT_STATSTRING_LEN);
-+ }
-+ }
-+ break;
-+#endif
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+ if(copy_to_user(pAddr, &gstrings, sizeof(gstrings))) {
-+ err = -EFAULT;
-+ }
-+ pAddr = (void *) ((unsigned long int) pAddr + offsetof(struct ethtool_gstrings, data));
-+ if(!err && copy_to_user(pAddr, strings, gstrings.len * ETH_GSTRING_LEN)) {
-+ err = -EFAULT;
-+ }
-+ kfree(strings);
-+ return err;
-+ }
-+#endif
-+#ifdef ETHTOOL_GSTATS
-+ case ETHTOOL_GSTATS: {
-+ struct {
-+ struct ethtool_stats eth_stats;
-+ uint64_t data[SK98LIN_STATS_LEN];
-+ } stats = { {ETHTOOL_GSTATS, SK98LIN_STATS_LEN} };
-+ int i;
-+
-+ if (netif_running(pAC->dev[port])) {
-+ SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, port);
-+ }
-+ for(i = 0; i < SK98LIN_STATS_LEN; i++) {
-+ if (netif_running(pAC->dev[port])) {
-+ stats.data[i] = (sk98lin_etht_stats[i].sizeof_stat ==
-+ sizeof(uint64_t)) ?
-+ *(uint64_t *)((char *)pAC +
-+ sk98lin_etht_stats[i].stat_offset) :
-+ *(uint32_t *)((char *)pAC +
-+ sk98lin_etht_stats[i].stat_offset);
-+ } else {
-+ stats.data[i] = (sk98lin_etht_stats[i].sizeof_stat ==
-+ sizeof(uint64_t)) ? (uint64_t) 0 : (uint32_t) 0;
-+ }
-+ }
-+ if(copy_to_user(pAddr, &stats, sizeof(stats))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_PHYS_ID
-+ case ETHTOOL_PHYS_ID: {
-+ struct ethtool_value blinkSecs;
-+ if(copy_from_user(&blinkSecs, pAddr, sizeof(blinkSecs))) {
-+ return -EFAULT;
-+ }
-+ return startLocateNIC(pAC, port, &blinkSecs);
-+ }
-+#endif
-+#ifdef ETHTOOL_GPAUSEPARAM
-+ case ETHTOOL_GPAUSEPARAM: {
-+ struct ethtool_pauseparam epause = { ETHTOOL_GPAUSEPARAM };
-+ getPauseParams(pAC, port, &epause);
-+ if(copy_to_user(pAddr, &epause, sizeof(epause))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_SPAUSEPARAM
-+ case ETHTOOL_SPAUSEPARAM: {
-+ struct ethtool_pauseparam epause;
-+ if(copy_from_user(&epause, pAddr, sizeof(epause))) {
-+ return -EFAULT;
-+ }
-+ return setPauseParams(pAC, port, &epause);
-+ }
-+#endif
-+#ifdef ETHTOOL_GSG
-+ case ETHTOOL_GSG: {
-+ struct ethtool_value edata = { ETHTOOL_GSG };
-+ edata.data = (netdev->features & NETIF_F_SG) != 0;
-+ if (copy_to_user(pAddr, &edata, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_SSG
-+ case ETHTOOL_SSG: {
-+ struct ethtool_value edata;
-+ if (copy_from_user(&edata, pAddr, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ if (pAC->ChipsetType) { /* Don't handle if Genesis */
-+ if (edata.data) {
-+ netdev->features |= NETIF_F_SG;
-+ } else {
-+ netdev->features &= ~NETIF_F_SG;
-+ }
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_GRXCSUM
-+ case ETHTOOL_GRXCSUM: {
-+ struct ethtool_value edata = { ETHTOOL_GRXCSUM };
-+ edata.data = pAC->RxPort[port].UseRxCsum;
-+ if (copy_to_user(pAddr, &edata, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_SRXCSUM
-+ case ETHTOOL_SRXCSUM: {
-+ struct ethtool_value edata;
-+ if (copy_from_user(&edata, pAddr, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ pAC->RxPort[port].UseRxCsum = edata.data;
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_GTXCSUM
-+ case ETHTOOL_GTXCSUM: {
-+ struct ethtool_value edata = { ETHTOOL_GTXCSUM };
-+ edata.data = ((netdev->features & NETIF_F_IP_CSUM) != 0);
-+ if (copy_to_user(pAddr, &edata, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_STXCSUM
-+ case ETHTOOL_STXCSUM: {
-+ struct ethtool_value edata;
-+ if (copy_from_user(&edata, pAddr, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ if (pAC->ChipsetType) { /* Don't handle if Genesis */
-+ if (edata.data) {
-+ netdev->features |= NETIF_F_IP_CSUM;
-+ } else {
-+ netdev->features &= ~NETIF_F_IP_CSUM;
-+ }
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_NWAY_RST
-+ case ETHTOOL_NWAY_RST: {
-+ if(netif_running(netdev)) {
-+ (*netdev->stop)(netdev);
-+ (*netdev->open)(netdev);
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef NETIF_F_TSO
-+#ifdef ETHTOOL_GTSO
-+ case ETHTOOL_GTSO: {
-+ struct ethtool_value edata = { ETHTOOL_GTSO };
-+ edata.data = (netdev->features & NETIF_F_TSO) != 0;
-+ if (copy_to_user(pAddr, &edata, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_STSO
-+ case ETHTOOL_STSO: {
-+ struct ethtool_value edata;
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (copy_from_user(&edata, pAddr, sizeof(edata))) {
-+ return -EFAULT;
-+ }
-+ if (edata.data) {
-+ netdev->features |= NETIF_F_TSO;
-+ } else {
-+ netdev->features &= ~NETIF_F_TSO;
-+ }
-+ return 0;
-+ }
-+ return -EOPNOTSUPP;
-+ }
-+#endif
-+#endif
-+#ifdef ETHTOOL_GCOALESCE
-+ case ETHTOOL_GCOALESCE: {
-+ struct ethtool_coalesce ecoalesc = { ETHTOOL_GCOALESCE };
-+ getModerationParams(pAC, port, &ecoalesc);
-+ if(copy_to_user(pAddr, &ecoalesc, sizeof(ecoalesc))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_SCOALESCE
-+ case ETHTOOL_SCOALESCE: {
-+ struct ethtool_coalesce ecoalesc;
-+ if(copy_from_user(&ecoalesc, pAddr, sizeof(ecoalesc))) {
-+ return -EFAULT;
-+ }
-+ return setModerationParams(pAC, port, &ecoalesc);
-+ }
-+#endif
-+#ifdef ETHTOOL_GWOL
-+ case ETHTOOL_GWOL: {
-+ struct ethtool_wolinfo ewol = { ETHTOOL_GWOL };
-+ getWOLsettings(pAC, port, &ewol);
-+ if(copy_to_user(pAddr, &ewol, sizeof(ewol))) {
-+ return -EFAULT;
-+ }
-+ return 0;
-+ }
-+#endif
-+#ifdef ETHTOOL_SWOL
-+ case ETHTOOL_SWOL: {
-+ struct ethtool_wolinfo ewol;
-+ if(copy_from_user(&ewol, pAddr, sizeof(ewol))) {
-+ return -EFAULT;
-+ }
-+ return setWOLsettings(pAC, port, &ewol);
-+ }
-+#endif
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+} /* SkEthIoctl() */
-+
-+/******************************************************************************
-+ *
-+ * Local Functions
-+ *
-+ *****************************************************************************/
-+
-+#ifdef ETHTOOL_GSET
-+/*****************************************************************************
-+ *
-+ * getSettings - retrieves the current settings of the selected adapter
-+ *
-+ * Description:
-+ * The current configuration of the selected adapter is returned.
-+ * This configuration involves a)speed, b)duplex and c)autoneg plus
-+ * a number of other variables.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void getSettings(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_cmd *ecmd) /* mandatory command structure for results */
-+{
-+ SK_GEPORT *pPort = &pAC->GIni.GP[port];
-+
-+ static int DuplexAutoNegConfMap[9][3]= {
-+ { -1 , -1 , -1 },
-+ { 0 , -1 , -1 },
-+ { SK_LMODE_HALF , DUPLEX_HALF, AUTONEG_DISABLE },
-+ { SK_LMODE_FULL , DUPLEX_FULL, AUTONEG_DISABLE },
-+ { SK_LMODE_AUTOHALF , DUPLEX_HALF, AUTONEG_ENABLE },
-+ { SK_LMODE_AUTOFULL , DUPLEX_FULL, AUTONEG_ENABLE },
-+ { SK_LMODE_AUTOBOTH , DUPLEX_FULL, AUTONEG_ENABLE },
-+ { SK_LMODE_AUTOSENSE , -1 , -1 },
-+ { SK_LMODE_INDETERMINATED, -1 , -1 }
-+ };
-+
-+ static int SpeedConfMap[6][2] = {
-+ { 0 , -1 },
-+ { SK_LSPEED_AUTO , -1 },
-+ { SK_LSPEED_10MBPS , SPEED_10 },
-+ { SK_LSPEED_100MBPS , SPEED_100 },
-+ { SK_LSPEED_1000MBPS , SPEED_1000 },
-+ { SK_LSPEED_INDETERMINATED, -1 }
-+ };
-+
-+ static int AdvSpeedMap[6][2] = {
-+ { 0 , -1 },
-+ { SK_LSPEED_AUTO , -1 },
-+ { SK_LSPEED_10MBPS , ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full },
-+ { SK_LSPEED_100MBPS , ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full },
-+ { SK_LSPEED_1000MBPS , ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full},
-+ { SK_LSPEED_INDETERMINATED, -1 }
-+ };
-+
-+ ecmd->phy_address = port;
-+ ecmd->speed = SpeedConfMap[pPort->PLinkSpeedUsed][1];
-+ ecmd->duplex = DuplexAutoNegConfMap[pPort->PLinkModeStatus][1];
-+ ecmd->autoneg = DuplexAutoNegConfMap[pPort->PLinkModeStatus][2];
-+ ecmd->transceiver = XCVR_INTERNAL;
-+
-+ if (pAC->GIni.GICopperType) {
-+ ecmd->port = PORT_TP;
-+ ecmd->supported = (SUPP_COPPER_ALL|SUPPORTED_Autoneg);
-+ if (pAC->GIni.GIGenesis) {
-+ ecmd->supported &= ~(SUPPORTED_10baseT_Half);
-+ ecmd->supported &= ~(SUPPORTED_10baseT_Full);
-+ ecmd->supported &= ~(SUPPORTED_100baseT_Half);
-+ ecmd->supported &= ~(SUPPORTED_100baseT_Full);
-+ } else {
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-+ ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
-+ }
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+ ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
-+ ecmd->supported &= ~(SUPPORTED_1000baseT_Full);
-+ }
-+ }
-+ if (pAC->GIni.GP[0].PLinkSpeed != SK_LSPEED_AUTO) {
-+ ecmd->advertising = AdvSpeedMap[pPort->PLinkSpeed][1];
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-+ ecmd->advertising &= ~(SUPPORTED_1000baseT_Half);
-+ }
-+ } else {
-+ ecmd->advertising = ecmd->supported;
-+ }
-+ if (ecmd->autoneg == AUTONEG_ENABLE) {
-+ ecmd->advertising |= ADVERTISED_Autoneg;
-+ } else {
-+ ecmd->advertising = ADVERTISED_TP;
-+ }
-+ } else {
-+ ecmd->port = PORT_FIBRE;
-+ ecmd->supported = (SUPP_FIBRE_ALL);
-+ ecmd->advertising = (ADV_FIBRE_ALL);
-+ }
-+}
-+#endif
-+
-+#ifdef ETHTOOL_SSET
-+/*****************************************************************************
-+ *
-+ * setSettings - configures the settings of a selected adapter
-+ *
-+ * Description:
-+ * Possible settings that may be altered are a)speed, b)duplex or
-+ * c)autonegotiation.
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error
-+ * !=0: the return value is the error code of the failure
-+ */
-+static int setSettings(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_cmd *ecmd) /* command structure containing settings */
-+{
-+ DEV_NET *pNet = (DEV_NET *) pAC->dev[port]->priv;
-+ SK_U32 Instance;
-+ char Buf[4];
-+ unsigned int Len = 1;
-+ int Ret;
-+
-+ if (port == 0) {
-+ Instance = (pAC->RlmtNets == 2) ? 1 : 2;
-+ } else {
-+ Instance = (pAC->RlmtNets == 2) ? 2 : 3;
-+ }
-+
-+ if (((ecmd->autoneg == AUTONEG_DISABLE) || (ecmd->autoneg == AUTONEG_ENABLE)) &&
-+ ((ecmd->duplex == DUPLEX_FULL) || (ecmd->duplex == DUPLEX_HALF))) {
-+ if (ecmd->autoneg == AUTONEG_DISABLE) {
-+ if (ecmd->duplex == DUPLEX_FULL) {
-+ *Buf = (char) SK_LMODE_FULL;
-+ } else {
-+ *Buf = (char) SK_LMODE_HALF;
-+ }
-+ } else {
-+ if (ecmd->duplex == DUPLEX_FULL) {
-+ *Buf = (char) SK_LMODE_AUTOFULL;
-+ } else {
-+ *Buf = (char) SK_LMODE_AUTOHALF;
-+ }
-+ }
-+
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_LINK_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+
-+ if (Ret != SK_PNMI_ERR_OK) {
-+ return -EINVAL;
-+ }
-+ } else if (ecmd->autoneg == AUTONEG_ENABLE) {
-+ /* Set default values */
-+ *Buf = (char) SK_LMODE_AUTOFULL;
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_LINK_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+ }
-+
-+ if ((ecmd->speed == SPEED_1000) ||
-+ (ecmd->speed == SPEED_100) ||
-+ (ecmd->speed == SPEED_10)) {
-+ if (ecmd->autoneg == AUTONEG_ENABLE) {
-+ *Buf = (char) SK_LSPEED_AUTO;
-+ } else if (ecmd->speed == SPEED_1000) {
-+ *Buf = (char) SK_LSPEED_1000MBPS;
-+ } else if (ecmd->speed == SPEED_100) {
-+ *Buf = (char) SK_LSPEED_100MBPS;
-+ } else {
-+ *Buf = (char) SK_LSPEED_10MBPS;
-+ }
-+
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+
-+ if (Ret != SK_PNMI_ERR_OK) {
-+ return -EINVAL;
-+ }
-+ } else if (ecmd->autoneg == AUTONEG_ENABLE) {
-+ *Buf = (char) SK_LSPEED_AUTO;
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+ } else {
-+ return -EINVAL;
-+ }
-+
-+ return 0;
-+}
-+#endif
-+
-+#ifdef ETHTOOL_GPAUSEPARAM
-+/*****************************************************************************
-+ *
-+ * getPauseParams - retrieves the pause parameters
-+ *
-+ * Description:
-+ * All current pause parameters of a selected adapter are placed
-+ * in the passed ethtool_pauseparam structure and are returned.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void getPauseParams(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_pauseparam *epause) /* pause parameter struct for result */
-+{
-+ SK_GEPORT *pPort = &pAC->GIni.GP[port];
-+
-+ epause->rx_pause = 0;
-+ epause->tx_pause = 0;
-+
-+ if (pPort->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND) {
-+ epause->tx_pause = 1;
-+ }
-+ if ((pPort->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC) ||
-+ (pPort->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM)) {
-+ epause->tx_pause = 1;
-+ epause->rx_pause = 1;
-+ }
-+
-+ if ((epause->rx_pause == 0) && (epause->tx_pause == 0)) {
-+ epause->autoneg = SK_FALSE;
-+ } else {
-+ epause->autoneg = SK_TRUE;
-+ }
-+}
-+#endif
-+
-+#ifdef ETHTOOL_SPAUSEPARAM
-+/*****************************************************************************
-+ *
-+ * setPauseParams - configures the pause parameters of an adapter
-+ *
-+ * Description:
-+ * This function sets the Rx or Tx pause parameters
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error
-+ * !=0: the return value is the error code of the failure
-+ */
-+static int setPauseParams(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_pauseparam *epause) /* pause parameter struct with params */
-+{
-+ SK_GEPORT *pPort = &pAC->GIni.GP[port];
-+ DEV_NET *pNet = (DEV_NET *) pAC->dev[port]->priv;
-+ int PrevSpeedVal = pPort->PLinkSpeedUsed;
-+
-+ SK_U32 Instance;
-+ char Buf[4];
-+ int Ret;
-+ SK_BOOL prevAutonegValue = SK_TRUE;
-+ int prevTxPause = 0;
-+ int prevRxPause = 0;
-+ unsigned int Len = 1;
-+
-+ if (port == 0) {
-+ Instance = (pAC->RlmtNets == 2) ? 1 : 2;
-+ } else {
-+ Instance = (pAC->RlmtNets == 2) ? 2 : 3;
-+ }
-+
-+ /*
-+ ** we have to determine the current settings to see if
-+ ** the operator requested any modification of the flow
-+ ** control parameters...
-+ */
-+ if (pPort->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND) {
-+ prevTxPause = 1;
-+ }
-+ if ((pPort->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC) ||
-+ (pPort->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM)) {
-+ prevTxPause = 1;
-+ prevRxPause = 1;
-+ }
-+
-+ if ((prevRxPause == 0) && (prevTxPause == 0)) {
-+ prevAutonegValue = SK_FALSE;
-+ }
-+
-+
-+ /*
-+ ** perform modifications regarding the changes
-+ ** requested by the operator
-+ */
-+ if (epause->autoneg != prevAutonegValue) {
-+ if (epause->autoneg == AUTONEG_DISABLE) {
-+ *Buf = (char) SK_FLOW_MODE_NONE;
-+ } else {
-+ *Buf = (char) SK_FLOW_MODE_SYMMETRIC;
-+ }
-+ } else {
-+ if(epause->rx_pause && epause->tx_pause) {
-+ *Buf = (char) SK_FLOW_MODE_SYMMETRIC;
-+ } else if (epause->rx_pause && !epause->tx_pause) {
-+ *Buf = (char) SK_FLOW_MODE_SYM_OR_REM;
-+ } else if(!epause->rx_pause && epause->tx_pause) {
-+ *Buf = (char) SK_FLOW_MODE_LOC_SEND;
-+ } else {
-+ *Buf = (char) SK_FLOW_MODE_NONE;
-+ }
-+ }
-+
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_FLOWCTRL_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+
-+ if (Ret != SK_PNMI_ERR_OK) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
-+ ("ethtool (sk98lin): error changing rx/tx pause (%i)\n", Ret));
-+ } else {
-+ Len = 1; /* set buffer length to correct value */
-+ }
-+
-+ /*
-+ ** It may be that autoneg has been disabled! Therefore
-+ ** set the speed to the previously used value...
-+ */
-+ *Buf = (char) PrevSpeedVal;
-+
-+ Ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
-+ &Buf, &Len, Instance, pNet->NetNr);
-+
-+ if (Ret != SK_PNMI_ERR_OK) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
-+ ("ethtool (sk98lin): error setting speed (%i)\n", Ret));
-+ }
-+ return 0;
-+}
-+#endif
-+
-+#ifdef ETHTOOL_GCOALESCE
-+/*****************************************************************************
-+ *
-+ * getModerationParams - retrieves the IRQ moderation settings
-+ *
-+ * Description:
-+ * All current IRQ moderation settings of a selected adapter are placed
-+ * in the passed ethtool_coalesce structure and are returned.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void getModerationParams(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_coalesce *ecoalesc) /* IRQ moderation struct for results */
-+{
-+ DIM_INFO *Info = &pAC->DynIrqModInfo;
-+ SK_BOOL UseTxIrqModeration = SK_FALSE;
-+ SK_BOOL UseRxIrqModeration = SK_FALSE;
-+
-+ if (Info->IntModTypeSelect != C_INT_MOD_NONE) {
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ UseRxIrqModeration = SK_TRUE;
-+ UseTxIrqModeration = SK_TRUE;
-+ } else {
-+ if ((Info->MaskIrqModeration == IRQ_MASK_RX_ONLY) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_SP_RX) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_RX_TX_SP)) {
-+ UseRxIrqModeration = SK_TRUE;
-+ }
-+ if ((Info->MaskIrqModeration == IRQ_MASK_TX_ONLY) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_SP_TX) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_RX_TX_SP)) {
-+ UseTxIrqModeration = SK_TRUE;
-+ }
-+ }
-+
-+ if (UseRxIrqModeration) {
-+ ecoalesc->rx_coalesce_usecs = 1000000 / Info->MaxModIntsPerSec;
-+ }
-+ if (UseTxIrqModeration) {
-+ ecoalesc->tx_coalesce_usecs = 1000000 / Info->MaxModIntsPerSec;
-+ }
-+ if (Info->IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-+ ecoalesc->rate_sample_interval = Info->DynIrqModSampleInterval;
-+ if (UseRxIrqModeration) {
-+ ecoalesc->use_adaptive_rx_coalesce = 1;
-+ ecoalesc->rx_coalesce_usecs_low =
-+ 1000000 / Info->MaxModIntsPerSecLowerLimit;
-+ ecoalesc->rx_coalesce_usecs_high =
-+ 1000000 / Info->MaxModIntsPerSecUpperLimit;
-+ }
-+ if (UseTxIrqModeration) {
-+ ecoalesc->use_adaptive_tx_coalesce = 1;
-+ ecoalesc->tx_coalesce_usecs_low =
-+ 1000000 / Info->MaxModIntsPerSecLowerLimit;
-+ ecoalesc->tx_coalesce_usecs_high =
-+ 1000000 / Info->MaxModIntsPerSecUpperLimit;
-+ }
-+ }
-+ }
-+}
-+#endif
-+
-+#ifdef ETHTOOL_SCOALESCE
-+/*****************************************************************************
-+ *
-+ * setModerationParams - configures the IRQ moderation of an adapter
-+ *
-+ * Description:
-+ * Depending on the desired IRQ moderation parameters, either a) static,
-+ * b) dynamic or c) no moderation is configured.
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error
-+ * !=0: the return value is the error code of the failure
-+ *
-+ * Notes:
-+ * The supported timeframe for the coalesced interrupts ranges from
-+ * 33.333us (30 IntsPerSec) down to 25us (40.000 IntsPerSec).
-+ * Any requested value that is not in this range will abort the request!
-+ */
-+static int setModerationParams(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_coalesce *ecoalesc) /* IRQ moderation struct with params */
-+{
-+ DIM_INFO *Info = &pAC->DynIrqModInfo;
-+ int PrevModeration = Info->IntModTypeSelect;
-+
-+ Info->IntModTypeSelect = C_INT_MOD_NONE; /* initial default */
-+
-+ if ((ecoalesc->rx_coalesce_usecs) || (ecoalesc->tx_coalesce_usecs)) {
-+ if (ecoalesc->rx_coalesce_usecs) {
-+ if ((ecoalesc->rx_coalesce_usecs < 25) ||
-+ (ecoalesc->rx_coalesce_usecs > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (ecoalesc->tx_coalesce_usecs) {
-+ if ((ecoalesc->tx_coalesce_usecs < 25) ||
-+ (ecoalesc->tx_coalesce_usecs > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if ((Info->MaskIrqModeration == IRQ_MASK_SP_RX) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_SP_TX) ||
-+ (Info->MaskIrqModeration == IRQ_MASK_RX_TX_SP)) {
-+ Info->MaskIrqModeration = IRQ_MASK_SP_ONLY;
-+ }
-+ }
-+ Info->IntModTypeSelect = C_INT_MOD_STATIC;
-+ if (ecoalesc->rx_coalesce_usecs) {
-+ Info->MaxModIntsPerSec =
-+ 1000000 / ecoalesc->rx_coalesce_usecs;
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (Info->MaskIrqModeration == IRQ_MASK_TX_ONLY) {
-+ Info->MaskIrqModeration = IRQ_MASK_TX_RX;
-+ }
-+ if (Info->MaskIrqModeration == IRQ_MASK_SP_ONLY) {
-+ Info->MaskIrqModeration = IRQ_MASK_SP_RX;
-+ }
-+ if (Info->MaskIrqModeration == IRQ_MASK_SP_TX) {
-+ Info->MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-+ }
-+ } else {
-+ Info->MaskIrqModeration = Y2_IRQ_MASK;
-+ }
-+ }
-+ if (ecoalesc->tx_coalesce_usecs) {
-+ Info->MaxModIntsPerSec =
-+ 1000000 / ecoalesc->tx_coalesce_usecs;
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (Info->MaskIrqModeration == IRQ_MASK_RX_ONLY) {
-+ Info->MaskIrqModeration = IRQ_MASK_TX_RX;
-+ }
-+ if (Info->MaskIrqModeration == IRQ_MASK_SP_ONLY) {
-+ Info->MaskIrqModeration = IRQ_MASK_SP_TX;
-+ }
-+ if (Info->MaskIrqModeration == IRQ_MASK_SP_RX) {
-+ Info->MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-+ }
-+ } else {
-+ Info->MaskIrqModeration = Y2_IRQ_MASK;
-+ }
-+ }
-+ }
-+ if ((ecoalesc->rate_sample_interval) ||
-+ (ecoalesc->rx_coalesce_usecs_low) ||
-+ (ecoalesc->tx_coalesce_usecs_low) ||
-+ (ecoalesc->rx_coalesce_usecs_high)||
-+ (ecoalesc->tx_coalesce_usecs_high)) {
-+ if (ecoalesc->rate_sample_interval) {
-+ if ((ecoalesc->rate_sample_interval < 1) ||
-+ (ecoalesc->rate_sample_interval > 10)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (ecoalesc->rx_coalesce_usecs_low) {
-+ if ((ecoalesc->rx_coalesce_usecs_low < 25) ||
-+ (ecoalesc->rx_coalesce_usecs_low > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (ecoalesc->rx_coalesce_usecs_high) {
-+ if ((ecoalesc->rx_coalesce_usecs_high < 25) ||
-+ (ecoalesc->rx_coalesce_usecs_high > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (ecoalesc->tx_coalesce_usecs_low) {
-+ if ((ecoalesc->tx_coalesce_usecs_low < 25) ||
-+ (ecoalesc->tx_coalesce_usecs_low > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+ if (ecoalesc->tx_coalesce_usecs_high) {
-+ if ((ecoalesc->tx_coalesce_usecs_high < 25) ||
-+ (ecoalesc->tx_coalesce_usecs_high > 33333)) {
-+ return -EINVAL;
-+ }
-+ }
-+
-+ Info->IntModTypeSelect = C_INT_MOD_DYNAMIC;
-+ if (ecoalesc->rate_sample_interval) {
-+ Info->DynIrqModSampleInterval =
-+ ecoalesc->rate_sample_interval;
-+ }
-+ if (ecoalesc->rx_coalesce_usecs_low) {
-+ Info->MaxModIntsPerSecLowerLimit =
-+ 1000000 / ecoalesc->rx_coalesce_usecs_low;
-+ }
-+ if (ecoalesc->tx_coalesce_usecs_low) {
-+ Info->MaxModIntsPerSecLowerLimit =
-+ 1000000 / ecoalesc->tx_coalesce_usecs_low;
-+ }
-+ if (ecoalesc->rx_coalesce_usecs_high) {
-+ Info->MaxModIntsPerSecUpperLimit =
-+ 1000000 / ecoalesc->rx_coalesce_usecs_high;
-+ }
-+ if (ecoalesc->tx_coalesce_usecs_high) {
-+ Info->MaxModIntsPerSecUpperLimit =
-+ 1000000 / ecoalesc->tx_coalesce_usecs_high;
-+ }
-+ }
-+
-+ if ((PrevModeration == C_INT_MOD_NONE) &&
-+ (Info->IntModTypeSelect != C_INT_MOD_NONE)) {
-+ SkDimEnableModerationIfNeeded(pAC);
-+ }
-+ if (PrevModeration != C_INT_MOD_NONE) {
-+ SkDimDisableModeration(pAC, PrevModeration);
-+ if (Info->IntModTypeSelect != C_INT_MOD_NONE) {
-+ SkDimEnableModerationIfNeeded(pAC);
-+ }
-+ }
-+
-+ return 0;
-+}
-+#endif
-+
-+#ifdef ETHTOOL_GWOL
-+/*****************************************************************************
-+ *
-+ * getWOLsettings - retrieves the WOL settings of the selected adapter
-+ *
-+ * Description:
-+ * All current WOL settings of a selected adapter are placed in the
-+ * passed ethtool_wolinfo structure and are returned to the caller.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void getWOLsettings(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_wolinfo *ewol) /* mandatory WOL structure for results */
-+{
-+ ewol->supported = pAC->WolInfo.SupportedWolOptions;
-+ ewol->wolopts = pAC->WolInfo.ConfiguredWolOptions;
-+
-+ return;
-+}
-+#endif
-+
-+#ifdef ETHTOOL_SWOL
-+/*****************************************************************************
-+ *
-+ * setWOLsettings - configures the WOL settings of a selected adapter
-+ *
-+ * Description:
-+ * The WOL settings of a selected adapter are configured regarding
-+ * the parameters in the passed ethtool_wolinfo structure.
-+ * Note that currently only wake on magic packet is supported!
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error
-+ * !=0: the return value is the error code of the failure
-+ */
-+static int setWOLsettings(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_wolinfo *ewol) /* WOL structure containing settings */
-+{
-+ if (((ewol->wolopts & WAKE_MAGIC) == WAKE_MAGIC) || (ewol->wolopts == 0)) {
-+ pAC->WolInfo.ConfiguredWolOptions = ewol->wolopts;
-+ return 0;
-+ }
-+ return -EFAULT;
-+}
-+#endif
-+
-+#ifdef ETHTOOL_GDRVINFO
-+/*****************************************************************************
-+ *
-+ * getDriverInfo - returns generic driver and adapter information
-+ *
-+ * Description:
-+ * Generic driver information is returned via this function, such as
-+ * the name of the driver, its version and and firmware version.
-+ * In addition to this, the location of the selected adapter is
-+ * returned as a bus info string (e.g. '01:05.0').
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void getDriverInfo(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_drvinfo *edrvinfo) /* mandatory info structure for results */
-+{
-+ char versionString[32];
-+
-+ snprintf(versionString, 32, "%s (%s)", VER_STRING, PATCHLEVEL);
-+ strncpy(edrvinfo->driver, DRIVER_FILE_NAME , 32);
-+ strncpy(edrvinfo->version, versionString , 32);
-+ strncpy(edrvinfo->fw_version, "N/A", 32);
-+ strncpy(edrvinfo->bus_info, pci_name(pAC->PciDev), 32);
-+
-+#ifdef ETHTOOL_GSTATS
-+ edrvinfo->n_stats = SK98LIN_STATS_LEN;
-+#endif
-+}
-+#endif
-+
-+#ifdef ETHTOOL_PHYS_ID
-+/*****************************************************************************
-+ *
-+ * startLocateNIC - start the locate NIC feature of the elected adapter
-+ *
-+ * Description:
-+ * This function is used if the user want to locate a particular NIC.
-+ * All LEDs are regularly switched on and off, so the NIC can easily
-+ * be identified.
-+ *
-+ * Returns:
-+ * ==0: everything fine, no error, locateNIC test was started
-+ * !=0: one locateNIC test runs already
-+ *
-+ */
-+static int startLocateNIC(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int port, /* the port of the selected adapter */
-+struct ethtool_value *blinkSecs) /* how long the LEDs should blink in seconds */
-+{
-+ struct SK_NET_DEVICE *pDev = pAC->dev[port];
-+ int OtherPort = (port) ? 0 : 1;
-+ struct SK_NET_DEVICE *pOtherDev = pAC->dev[OtherPort];
-+
-+ if (isLocateNICrunning) {
-+ return -EFAULT;
-+ }
-+ isLocateNICrunning = SK_TRUE;
-+ currentPortIndex = port;
-+ isDualNetCard = (pDev != pOtherDev) ? SK_TRUE : SK_FALSE;
-+
-+ if (netif_running(pAC->dev[port])) {
-+ boardWasDown[0] = SK_FALSE;
-+ } else {
-+ (*pDev->open)(pDev);
-+ boardWasDown[0] = SK_TRUE;
-+ }
-+
-+ if (isDualNetCard) {
-+ if (netif_running(pAC->dev[OtherPort])) {
-+ boardWasDown[1] = SK_FALSE;
-+ } else {
-+ (*pOtherDev->open)(pOtherDev);
-+ boardWasDown[1] = SK_TRUE;
-+ }
-+ }
-+
-+ if ((blinkSecs->data < 1) || (blinkSecs->data > 30)) {
-+ blinkSecs->data = 3; /* three seconds default */
-+ }
-+ nbrBlinkQuarterSeconds = 4*blinkSecs->data;
-+
-+ init_timer(&locateNICtimer);
-+ locateNICtimer.function = toggleLeds;
-+ locateNICtimer.data = (unsigned long) pAC;
-+ locateNICtimer.expires = jiffies + HZ; /* initially 1sec */
-+ add_timer(&locateNICtimer);
-+
-+ return 0;
-+}
-+
-+/*****************************************************************************
-+ *
-+ * toggleLeds - Changes the LED state of an adapter
-+ *
-+ * Description:
-+ * This function changes the current state of all LEDs of an adapter so
-+ * that it can be located by a user. If the requested time interval for
-+ * this test has elapsed, this function cleans up everything that was
-+ * temporarily setup during the locate NIC test. This involves of course
-+ * also closing or opening any adapter so that the initial board state
-+ * is recovered.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void toggleLeds(
-+unsigned long ptr) /* holds the pointer to adapter control context */
-+{
-+ SK_AC *pAC = (SK_AC *) ptr;
-+ int port = currentPortIndex;
-+ SK_IOC IoC = pAC->IoBase;
-+ struct SK_NET_DEVICE *pDev = pAC->dev[port];
-+ int OtherPort = (port) ? 0 : 1;
-+ struct SK_NET_DEVICE *pOtherDev = pAC->dev[OtherPort];
-+
-+ SK_U16 YukLedOn = (PHY_M_LED_MO_DUP(MO_LED_ON) |
-+ PHY_M_LED_MO_10(MO_LED_ON) |
-+ PHY_M_LED_MO_100(MO_LED_ON) |
-+ PHY_M_LED_MO_1000(MO_LED_ON) |
-+ PHY_M_LED_MO_RX(MO_LED_ON));
-+ SK_U16 YukLedOff = (PHY_M_LED_MO_DUP(MO_LED_OFF) |
-+ PHY_M_LED_MO_10(MO_LED_OFF) |
-+ PHY_M_LED_MO_100(MO_LED_OFF) |
-+ PHY_M_LED_MO_1000(MO_LED_OFF) |
-+ PHY_M_LED_MO_RX(MO_LED_OFF));
-+
-+ nbrBlinkQuarterSeconds--;
-+ if (nbrBlinkQuarterSeconds <= 0) {
-+ (*pDev->stop)(pDev);
-+ if (isDualNetCard) {
-+ (*pOtherDev->stop)(pOtherDev);
-+ }
-+
-+ if (!boardWasDown[0]) {
-+ (*pDev->open)(pDev);
-+ }
-+ if (isDualNetCard) {
-+ (*pOtherDev->open)(pOtherDev);
-+ }
-+ isDualNetCard = SK_FALSE;
-+ isLocateNICrunning = SK_FALSE;
-+ return;
-+ }
-+
-+ doSwitchLEDsOn = (doSwitchLEDsOn) ? SK_FALSE : SK_TRUE;
-+ if (doSwitchLEDsOn) {
-+ if (pAC->GIni.GIGenesis) {
-+ SK_OUT8(IoC,MR_ADDR(port,LNK_LED_REG),(SK_U8)SK_LNK_ON);
-+ SkGeYellowLED(pAC,IoC,LED_ON >> 1);
-+ SkGeXmitLED(pAC,IoC,MR_ADDR(port,RX_LED_INI),SK_LED_TST);
-+ if (pAC->GIni.GP[port].PhyType == SK_PHY_BCOM) {
-+ SkXmPhyWrite(pAC,IoC,port,PHY_BCOM_P_EXT_CTRL,PHY_B_PEC_LED_ON);
-+ } else if (pAC->GIni.GP[port].PhyType == SK_PHY_LONE) {
-+ SkXmPhyWrite(pAC,IoC,port,PHY_LONE_LED_CFG,0x0800);
-+ } else {
-+ SkGeXmitLED(pAC,IoC,MR_ADDR(port,TX_LED_INI),SK_LED_TST);
-+ }
-+ } else {
-+ SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_CTRL,0);
-+ SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_OVER,YukLedOn);
-+ }
-+ } else {
-+ if (pAC->GIni.GIGenesis) {
-+ SK_OUT8(IoC,MR_ADDR(port,LNK_LED_REG),(SK_U8)SK_LNK_OFF);
-+ SkGeYellowLED(pAC,IoC,LED_OFF >> 1);
-+ SkGeXmitLED(pAC,IoC,MR_ADDR(port,RX_LED_INI),SK_LED_DIS);
-+ if (pAC->GIni.GP[port].PhyType == SK_PHY_BCOM) {
-+ SkXmPhyWrite(pAC,IoC,port,PHY_BCOM_P_EXT_CTRL,PHY_B_PEC_LED_OFF);
-+ } else if (pAC->GIni.GP[port].PhyType == SK_PHY_LONE) {
-+ SkXmPhyWrite(pAC,IoC,port,PHY_LONE_LED_CFG,PHY_L_LC_LEDT);
-+ } else {
-+ SkGeXmitLED(pAC,IoC,MR_ADDR(port,TX_LED_INI),SK_LED_DIS);
-+ }
-+ } else {
-+ SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_CTRL,0);
-+ SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_OVER,YukLedOff);
-+ }
-+ }
-+
-+ locateNICtimer.function = toggleLeds;
-+ locateNICtimer.data = (unsigned long) pAC;
-+ locateNICtimer.expires = jiffies + (HZ/4); /* 250ms */
-+ add_timer(&locateNICtimer);
-+}
-+#endif
-+
-+/*****************************************************************************
-+ *
-+ * getPortNumber - evaluates the port number of an interface
-+ *
-+ * Description:
-+ * It may be that the current interface refers to one which is located
-+ * on a dual net adapter. Hence, this function will return the correct
-+ * port for further use.
-+ *
-+ * Returns:
-+ * the port number that corresponds to the selected adapter
-+ *
-+ */
-+static int getPortNumber(
-+struct net_device *netdev, /* the pointer to netdev structure */
-+struct ifreq *ifr) /* what interface the request refers to? */
-+{
-+ DEV_NET *pNet = (DEV_NET*) netdev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+
-+ if (pAC->dev[1] != pAC->dev[0]) {
-+ if (!strcmp(pAC->dev[1]->name, ifr->ifr_name)) {
-+ return 1; /* port index 1 */
-+ }
-+ }
-+ return 0;
-+}
-+
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/skge.c ./drivers/net/sk98lin/skge.c
---- ./drivers/net/sk98lin.sk98/skge.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/sk98lin/skge.c 2006-08-31 14:59:52.000000000 +0400
-@@ -1,32 +1,26 @@
- /******************************************************************************
- *
-- * Name: skge.c
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.45 $
-- * Date: $Date: 2004/02/12 14:41:02 $
-- * Purpose: The main driver source module
-+ * Name: skge.c
-+ * Project: GEnesis, PCI Gigabit Ethernet Adapter
-+ * Version: $Revision: 1.60.2.68 $
-+ * Date: $Date: 2005/11/14 15:22:08 $
-+ * Purpose: The main driver source module
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * Driver for Marvell Yukon chipset and SysKonnect Gigabit Ethernet
- * Server Adapters.
- *
-- * Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and
-- * SysKonnects GEnesis Solaris driver
-- * Author: Christoph Goos (cgoos@syskonnect.de)
-- * Mirko Lindner (mlindner@syskonnect.de)
-+ * Author: Mirko Lindner (mlindner@syskonnect.de)
-+ * Ralph Roesler (rroesler@syskonnect.de)
- *
- * Address all question to: linux@syskonnect.de
- *
-- * The technical manual for the adapters is available from SysKonnect's
-- * web pages: www.syskonnect.com
-- * Goto "Support" and search Knowledge Base for "manual".
-- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
-@@ -38,71 +32,33 @@
-
- /******************************************************************************
- *
-- * Possible compiler options (#define xxx / -Dxxx):
-- *
-- * debugging can be enable by changing SK_DEBUG_CHKMOD and
-- * SK_DEBUG_CHKCAT in makefile (described there).
-- *
-- ******************************************************************************/
--
--/******************************************************************************
-- *
- * Description:
- *
-- * This is the main module of the Linux GE driver.
-- *
-- * All source files except skge.c, skdrv1st.h, skdrv2nd.h and sktypes.h
-- * are part of SysKonnect's COMMON MODULES for the SK-98xx adapters.
-- * Those are used for drivers on multiple OS', so some thing may seem
-- * unnecessary complicated on Linux. Please do not try to 'clean up'
-- * them without VERY good reasons, because this will make it more
-- * difficult to keep the Linux driver in synchronisation with the
-- * other versions.
-- *
-- * Include file hierarchy:
-- *
-- * <linux/module.h>
-- *
-- * "h/skdrv1st.h"
-- * <linux/types.h>
-- * <linux/kernel.h>
-- * <linux/string.h>
-- * <linux/errno.h>
-- * <linux/ioport.h>
-- * <linux/slab.h>
-- * <linux/interrupt.h>
-- * <linux/pci.h>
-- * <asm/byteorder.h>
-- * <asm/bitops.h>
-- * <asm/io.h>
-- * <linux/netdevice.h>
-- * <linux/etherdevice.h>
-- * <linux/skbuff.h>
-- * those three depending on kernel version used:
-- * <linux/bios32.h>
-- * <linux/init.h>
-- * <asm/uaccess.h>
-- * <net/checksum.h>
-- *
-- * "h/skerror.h"
-- * "h/skdebug.h"
-- * "h/sktypes.h"
-- * "h/lm80.h"
-- * "h/xmac_ii.h"
-- *
-- * "h/skdrv2nd.h"
-- * "h/skqueue.h"
-- * "h/skgehwt.h"
-- * "h/sktimer.h"
-- * "h/ski2c.h"
-- * "h/skgepnmi.h"
-- * "h/skvpd.h"
-- * "h/skgehw.h"
-- * "h/skgeinit.h"
-- * "h/skaddr.h"
-- * "h/skgesirq.h"
-- * "h/skcsum.h"
-- * "h/skrlmt.h"
-+ * All source files in this sk98lin directory except of the sk98lin
-+ * Linux specific files
-+ *
-+ * - skdim.c
-+ * - skethtool.c
-+ * - skge.c
-+ * - skproc.c
-+ * - sky2.c
-+ * - Makefile
-+ * - h/skdrv1st.h
-+ * - h/skdrv2nd.h
-+ * - h/sktypes.h
-+ * - h/skversion.h
-+ *
-+ * are part of SysKonnect's common modules for the SK-9xxx adapters.
-+ *
-+ * Those common module files which are not Linux specific are used to
-+ * build drivers on different OS' (e.g. Windows, MAC OS) so that those
-+ * drivers are based on the same set of files
-+ *
-+ * At a first glance, this seems to complicate things unnescessarily on
-+ * Linux, but please do not try to 'clean up' them without VERY good
-+ * reasons, because this will make it more difficult to keep the sk98lin
-+ * driver for Linux in synchronisation with the other drivers running on
-+ * other operating systems.
- *
- ******************************************************************************/
-
-@@ -110,11 +66,19 @@
-
- #include <linux/module.h>
- #include <linux/init.h>
-+#include <linux/ethtool.h>
-+
-+#ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-+#endif
-
- #include "h/skdrv1st.h"
- #include "h/skdrv2nd.h"
-
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+#include <linux/moduleparam.h>
-+#endif
-+
- /*******************************************************************************
- *
- * Defines
-@@ -124,62 +88,14 @@
- /* for debuging on x86 only */
- /* #define BREAKPOINT() asm(" int $3"); */
-
--/* use the transmit hw checksum driver functionality */
--#define USE_SK_TX_CHECKSUM
--
--/* use the receive hw checksum driver functionality */
--#define USE_SK_RX_CHECKSUM
--
--/* use the scatter-gather functionality with sendfile() */
--#define SK_ZEROCOPY
--
--/* use of a transmit complete interrupt */
--#define USE_TX_COMPLETE
--
--/*
-- * threshold for copying small receive frames
-- * set to 0 to avoid copying, set to 9001 to copy all frames
-- */
--#define SK_COPY_THRESHOLD 50
--
--/* number of adapters that can be configured via command line params */
--#define SK_MAX_CARD_PARAM 16
--
--
--
--/*
-- * use those defines for a compile-in version of the driver instead
-- * of command line parameters
-- */
--// #define LINK_SPEED_A {"Auto", }
--// #define LINK_SPEED_B {"Auto", }
--// #define AUTO_NEG_A {"Sense", }
--// #define AUTO_NEG_B {"Sense", }
--// #define DUP_CAP_A {"Both", }
--// #define DUP_CAP_B {"Both", }
--// #define FLOW_CTRL_A {"SymOrRem", }
--// #define FLOW_CTRL_B {"SymOrRem", }
--// #define ROLE_A {"Auto", }
--// #define ROLE_B {"Auto", }
--// #define PREF_PORT {"A", }
--// #define CON_TYPE {"Auto", }
--// #define RLMT_MODE {"CheckLinkState", }
--
--#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb)
--#define DEV_KFREE_SKB_IRQ(skb) dev_kfree_skb_irq(skb)
--#define DEV_KFREE_SKB_ANY(skb) dev_kfree_skb_any(skb)
--
-
- /* Set blink mode*/
- #define OEM_CONFIG_VALUE ( SK_ACT_LED_BLINK | \
- SK_DUP_LED_NORMAL | \
- SK_LED_LINK100_ON)
-
--
--/* Isr return value */
--#define SkIsrRetVar irqreturn_t
--#define SkIsrRetNone IRQ_NONE
--#define SkIsrRetHandled IRQ_HANDLED
-+#define CLEAR_AND_START_RX(Port) SK_OUT8(pAC->IoBase, RxQueueAddr[(Port)]+Q_CSR, CSR_START | CSR_IRQ_CL_F)
-+#define CLEAR_TX_IRQ(Port,Prio) SK_OUT8(pAC->IoBase, TxQueueAddr[(Port)][(Prio)]+Q_CSR, CSR_IRQ_CL_F)
-
-
- /*******************************************************************************
-@@ -188,12 +104,25 @@
- *
- ******************************************************************************/
-
-+static int __devinit sk98lin_init_device(struct pci_dev *pdev, const struct pci_device_id *ent);
-+static void sk98lin_remove_device(struct pci_dev *pdev);
-+#ifdef CONFIG_PM
-+static int sk98lin_suspend(struct pci_dev *pdev, u32 state);
-+static int sk98lin_resume(struct pci_dev *pdev);
-+static void SkEnableWOMagicPacket(SK_AC *pAC, SK_IOC IoC, SK_MAC_ADDR MacAddr);
-+#endif
-+#ifdef Y2_RECOVERY
-+static void SkGeHandleKernelTimer(unsigned long ptr);
-+void SkGeCheckTimer(DEV_NET *pNet);
-+static SK_BOOL CheckRXCounters(DEV_NET *pNet);
-+static void CheckRxPath(DEV_NET *pNet);
-+#endif
- static void FreeResources(struct SK_NET_DEVICE *dev);
- static int SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC);
- static SK_BOOL BoardAllocMem(SK_AC *pAC);
- static void BoardFreeMem(SK_AC *pAC);
- static void BoardInitMem(SK_AC *pAC);
--static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, SK_BOOL);
-+static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, int*, SK_BOOL);
- static SkIsrRetVar SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs);
- static SkIsrRetVar SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs);
- static int SkGeOpen(struct SK_NET_DEVICE *dev);
-@@ -209,24 +138,37 @@ static int XmitFrame(SK_AC*, TX_PORT*, s
- static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*);
- static void FillRxRing(SK_AC*, RX_PORT*);
- static SK_BOOL FillRxDescriptor(SK_AC*, RX_PORT*);
-+#ifdef CONFIG_SK98LIN_NAPI
-+static int SkGePoll(struct net_device *dev, int *budget);
-+static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL, int*, int);
-+#else
- static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL);
--static void ClearAndStartRx(SK_AC*, int);
--static void ClearTxIrq(SK_AC*, int, int);
-+#endif
-+#ifdef SK_POLL_CONTROLLER
-+static void SkGeNetPoll(struct SK_NET_DEVICE *dev);
-+#endif
- static void ClearRxRing(SK_AC*, RX_PORT*);
- static void ClearTxRing(SK_AC*, TX_PORT*);
- static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int new_mtu);
- static void PortReInitBmu(SK_AC*, int);
- static int SkGeIocMib(DEV_NET*, unsigned int, int);
- static int SkGeInitPCI(SK_AC *pAC);
--static void StartDrvCleanupTimer(SK_AC *pAC);
--static void StopDrvCleanupTimer(SK_AC *pAC);
--static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*);
--
--#ifdef SK_DIAG_SUPPORT
- static SK_U32 ParseDeviceNbrFromSlotName(const char *SlotName);
- static int SkDrvInitAdapter(SK_AC *pAC, int devNbr);
- static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
--#endif
-+extern void SkLocalEventQueue( SK_AC *pAC,
-+ SK_U32 Class,
-+ SK_U32 Event,
-+ SK_U32 Param1,
-+ SK_U32 Param2,
-+ SK_BOOL Flag);
-+extern void SkLocalEventQueue64( SK_AC *pAC,
-+ SK_U32 Class,
-+ SK_U32 Event,
-+ SK_U64 Param,
-+ SK_BOOL Flag);
-+
-+static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*);
-
- /*******************************************************************************
- *
-@@ -234,17 +176,34 @@ static int SkDrvDeInitAdapter(SK_AC
- *
- ******************************************************************************/
-
--#ifdef CONFIG_PROC_FS
--static const char SK_Root_Dir_entry[] = "sk98lin";
--static struct proc_dir_entry *pSkRootDir;
--extern struct file_operations sk_proc_fops;
-+extern SK_BOOL SkY2AllocateResources(SK_AC *pAC);
-+extern void SkY2FreeResources(SK_AC *pAC);
-+extern void SkY2AllocateRxBuffers(SK_AC *pAC,SK_IOC IoC,int Port);
-+extern void SkY2FreeRxBuffers(SK_AC *pAC,SK_IOC IoC,int Port);
-+extern void SkY2FreeTxBuffers(SK_AC *pAC,SK_IOC IoC,int Port);
-+extern SkIsrRetVar SkY2Isr(int irq,void *dev_id,struct pt_regs *ptregs);
-+extern int SkY2Xmit(struct sk_buff *skb,struct SK_NET_DEVICE *dev);
-+extern void SkY2PortStop(SK_AC *pAC,SK_IOC IoC,int Port,int Dir,int RstMode);
-+extern void SkY2PortStart(SK_AC *pAC,SK_IOC IoC,int Port);
-+extern int SkY2RlmtSend(SK_AC *pAC,int PortNr,struct sk_buff *pMessage);
-+extern void SkY2RestartStatusUnit(SK_AC *pAC);
-+extern void FillReceiveTableYukon2(SK_AC *pAC,SK_IOC IoC,int Port);
-+#ifdef CONFIG_SK98LIN_NAPI
-+extern int SkY2Poll(struct net_device *dev, int *budget);
- #endif
-
- extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
--extern void SkDimDisplayModerationSettings(SK_AC *pAC);
- extern void SkDimStartModerationTimer(SK_AC *pAC);
- extern void SkDimModerate(SK_AC *pAC);
-
-+extern int SkEthIoctl(struct net_device *netdev, struct ifreq *ifr);
-+
-+#ifdef CONFIG_PROC_FS
-+static const char SK_Root_Dir_entry[] = "sk98lin";
-+static struct proc_dir_entry *pSkRootDir;
-+extern struct file_operations sk_proc_fops;
-+#endif
-+
- #ifdef DEBUG
- static void DumpMsg(struct sk_buff*, char*);
- static void DumpData(char*, int);
-@@ -252,12 +211,436 @@ static void DumpLong(char*, int);
- #endif
-
- /* global variables *********************************************************/
-+static const char *BootString = BOOT_STRING;
- struct SK_NET_DEVICE *SkGeRootDev = NULL;
- static SK_BOOL DoPrintInterfaceChange = SK_TRUE;
-
- /* local variables **********************************************************/
- static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}};
- static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
-+static int sk98lin_max_boards_found = 0;
-+
-+#ifdef CONFIG_PROC_FS
-+static struct proc_dir_entry *pSkRootDir;
-+#endif
-+
-+
-+
-+static struct pci_device_id sk98lin_pci_tbl[] __devinitdata = {
-+/* { pci_vendor_id, pci_device_id, * SAMPLE ENTRY! *
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, */
-+ { 0x10b7, 0x1700, /* 3Com (10b7), Gigabit Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x10b7, 0x80eb, /* 3Com (10b7), 3Com 3C940B Gigabit LOM Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1148, 0x4300, /* SysKonnect (1148), SK-98xx Gigabit Ethernet Server Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1148, 0x4320, /* SysKonnect (1148), SK-98xx V2.0 Gigabit Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1148, 0x9000, /* SysKonnect (1148), SK-9Sxx 10/100/1000Base-T Server Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1148, 0x9E00, /* SysKonnect (1148), SK-9Exx 10/100/1000Base-T Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1186, 0x4b00, /* D-Link (1186), Gigabit Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1186, 0x4b01, /* D-Link (1186), Gigabit Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1186, 0x4c00, /* D-Link (1186), Gigabit Ethernet Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4320, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4340, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4341, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4342, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4343, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4344, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4345, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4346, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4347, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4350, /* Marvell (11ab), Fast Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4351, /* Marvell (11ab), Fast Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4352, /* Marvell (11ab), Fast Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4360, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4361, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4362, /* Marvell (11ab), Gigabit Ethernet Controller */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x4363, /* Marvell (11ab), Marvell */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x11ab, 0x5005, /* Marvell (11ab), Belkin */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1371, 0x434e, /* CNet (1371), GigaCard Network Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1737, 0x1032, /* Linksys (1737), Gigabit Network Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0x1737, 0x1064, /* Linksys (1737), Gigabit Network Adapter */
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { 0, }
-+};
-+
-+MODULE_DEVICE_TABLE(pci, sk98lin_pci_tbl);
-+
-+static struct pci_driver sk98lin_driver = {
-+ .name = DRIVER_FILE_NAME,
-+ .id_table = sk98lin_pci_tbl,
-+ .probe = sk98lin_init_device,
-+ .remove = __devexit_p(sk98lin_remove_device),
-+#ifdef CONFIG_PM
-+ .suspend = sk98lin_suspend,
-+ .resume = sk98lin_resume
-+#endif
-+};
-+
-+
-+/*****************************************************************************
-+ *
-+ * sk98lin_init_device - initialize the adapter
-+ *
-+ * Description:
-+ * This function initializes the adapter. Resources for
-+ * the adapter are allocated and the adapter is brought into Init 1
-+ * state.
-+ *
-+ * Returns:
-+ * 0, if everything is ok
-+ * !=0, on error
-+ */
-+static int __devinit sk98lin_init_device(struct pci_dev *pdev,
-+ const struct pci_device_id *ent)
-+
-+{
-+ static SK_BOOL sk98lin_boot_string = SK_FALSE;
-+ static SK_BOOL sk98lin_proc_entry = SK_FALSE;
-+ static int sk98lin_boards_found = 0;
-+ SK_AC *pAC;
-+ DEV_NET *pNet = NULL;
-+ struct SK_NET_DEVICE *dev = NULL;
-+ int retval;
-+#ifdef CONFIG_PROC_FS
-+ struct proc_dir_entry *pProcFile;
-+#endif
-+ int pci_using_dac;
-+
-+ retval = pci_enable_device(pdev);
-+ if (retval) {
-+ printk(KERN_ERR "Cannot enable PCI device, "
-+ "aborting.\n");
-+ return retval;
-+ }
-+
-+ dev = NULL;
-+ pNet = NULL;
-+
-+
-+ /* INSERT * We have to find the power-management capabilities */
-+ /* Find power-management capability. */
-+
-+ pci_using_dac = 0; /* Set 32 bit DMA per default */
-+ /* Configure DMA attributes. */
-+ retval = pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL);
-+ if (!retval) {
-+ pci_using_dac = 1;
-+ } else {
-+ retval = pci_set_dma_mask(pdev, (u64) 0xffffffff);
-+ if (retval) {
-+ printk(KERN_ERR "No usable DMA configuration, "
-+ "aborting.\n");
-+ return retval;
-+ }
-+ }
-+
-+
-+ if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) {
-+ printk(KERN_ERR "Unable to allocate etherdev "
-+ "structure!\n");
-+ return -ENODEV;
-+ }
-+
-+ pNet = dev->priv;
-+ pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
-+ if (pNet->pAC == NULL){
-+ free_netdev(dev);
-+ printk(KERN_ERR "Unable to allocate adapter "
-+ "structure!\n");
-+ return -ENODEV;
-+ }
-+
-+
-+ /* Print message */
-+ if (!sk98lin_boot_string) {
-+ /* set display flag to TRUE so that */
-+ /* we only display this string ONCE */
-+ sk98lin_boot_string = SK_TRUE;
-+ printk("%s\n", BootString);
-+ }
-+
-+ memset(pNet->pAC, 0, sizeof(SK_AC));
-+ pAC = pNet->pAC;
-+ pAC->PciDev = pdev;
-+ pAC->PciDevId = pdev->device;
-+ pAC->dev[0] = dev;
-+ pAC->dev[1] = dev;
-+ sprintf(pAC->Name, "SysKonnect SK-98xx");
-+ pAC->CheckQueue = SK_FALSE;
-+
-+ dev->irq = pdev->irq;
-+ retval = SkGeInitPCI(pAC);
-+ if (retval) {
-+ printk("SKGE: PCI setup failed: %i\n", retval);
-+ free_netdev(dev);
-+ return -ENODEV;
-+ }
-+
-+ SET_MODULE_OWNER(dev);
-+
-+ dev->open = &SkGeOpen;
-+ dev->stop = &SkGeClose;
-+ dev->get_stats = &SkGeStats;
-+ dev->set_multicast_list = &SkGeSetRxMode;
-+ dev->set_mac_address = &SkGeSetMacAddr;
-+ dev->do_ioctl = &SkGeIoctl;
-+ dev->change_mtu = &SkGeChangeMtu;
-+ dev->flags &= ~IFF_RUNNING;
-+#ifdef SK_POLL_CONTROLLER
-+ dev->poll_controller = SkGeNetPoll;
-+#endif
-+ SET_NETDEV_DEV(dev, &pdev->dev);
-+
-+ pAC->Index = sk98lin_boards_found;
-+
-+ if (SkGeBoardInit(dev, pAC)) {
-+ free_netdev(dev);
-+ return -ENODEV;
-+ } else {
-+ ProductStr(pAC);
-+ }
-+
-+ if (pci_using_dac)
-+ dev->features |= NETIF_F_HIGHDMA;
-+
-+ /* shifter to later moment in time... */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ dev->hard_start_xmit = &SkY2Xmit;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ dev->poll = &SkY2Poll;
-+ dev->weight = 64;
-+#endif
-+ } else {
-+ dev->hard_start_xmit = &SkGeXmit;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ dev->poll = &SkGePoll;
-+ dev->weight = 64;
-+#endif
-+ }
-+
-+#ifdef NETIF_F_TSO
-+#ifdef USE_SK_TSO_FEATURE
-+ if ((CHIP_ID_YUKON_2(pAC)) &&
-+ (pAC->GIni.GIChipId != CHIP_ID_YUKON_EC_U)) {
-+ dev->features |= NETIF_F_TSO;
-+ }
-+#endif
-+#endif
-+#ifdef CONFIG_SK98LIN_ZEROCOPY
-+ if (pAC->GIni.GIChipId != CHIP_ID_GENESIS)
-+ dev->features |= NETIF_F_SG;
-+#endif
-+#ifdef USE_SK_TX_CHECKSUM
-+ if (pAC->GIni.GIChipId != CHIP_ID_GENESIS)
-+ dev->features |= NETIF_F_IP_CSUM;
-+#endif
-+#ifdef USE_SK_RX_CHECKSUM
-+ pAC->RxPort[0].UseRxCsum = SK_TRUE;
-+ if (pAC->GIni.GIMacsFound == 2 ) {
-+ pAC->RxPort[1].UseRxCsum = SK_TRUE;
-+ }
-+#endif
-+
-+ /* Save the hardware revision */
-+ pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) +
-+ (pAC->GIni.GIPciHwRev & 0x0F);
-+
-+ /* Set driver globals */
-+ pAC->Pnmi.pDriverFileName = DRIVER_FILE_NAME;
-+ pAC->Pnmi.pDriverReleaseDate = DRIVER_REL_DATE;
-+
-+ SK_MEMSET(&(pAC->PnmiBackup), 0, sizeof(SK_PNMI_STRUCT_DATA));
-+ SK_MEMCPY(&(pAC->PnmiBackup), &(pAC->PnmiStruct),
-+ sizeof(SK_PNMI_STRUCT_DATA));
-+
-+ /* Register net device */
-+ retval = register_netdev(dev);
-+ if (retval) {
-+ printk(KERN_ERR "SKGE: Could not register device.\n");
-+ FreeResources(dev);
-+ free_netdev(dev);
-+ return retval;
-+ }
-+
-+ /* Save initial device name */
-+ strcpy(pNet->InitialDevName, dev->name);
-+
-+ /* Set network to off */
-+ netif_stop_queue(dev);
-+ netif_carrier_off(dev);
-+
-+ /* Print adapter specific string from vpd and config settings */
-+ printk("%s: %s\n", pNet->InitialDevName, pAC->DeviceStr);
-+ printk(" PrefPort:%c RlmtMode:%s\n",
-+ 'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber,
-+ (pAC->RlmtMode==0) ? "Check Link State" :
-+ ((pAC->RlmtMode==1) ? "Check Link State" :
-+ ((pAC->RlmtMode==3) ? "Check Local Port" :
-+ ((pAC->RlmtMode==7) ? "Check Segmentation" :
-+ ((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error")))));
-+
-+ SkGeYellowLED(pAC, pAC->IoBase, 1);
-+
-+ memcpy((caddr_t) &dev->dev_addr,
-+ (caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6);
-+
-+ /* First adapter... Create proc and print message */
-+#ifdef CONFIG_PROC_FS
-+ if (!sk98lin_proc_entry) {
-+ sk98lin_proc_entry = SK_TRUE;
-+ SK_MEMCPY(&SK_Root_Dir_entry, BootString,
-+ sizeof(SK_Root_Dir_entry) - 1);
-+
-+ /*Create proc (directory)*/
-+ if(!pSkRootDir) {
-+ pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
-+ if (!pSkRootDir) {
-+ printk(KERN_WARNING "%s: Unable to create /proc/net/%s",
-+ dev->name, SK_Root_Dir_entry);
-+ } else {
-+ pSkRootDir->owner = THIS_MODULE;
-+ }
-+ }
-+ }
-+
-+ /* Create proc file */
-+ if (pSkRootDir &&
-+ (pProcFile = create_proc_entry(pNet->InitialDevName, S_IRUGO,
-+ pSkRootDir))) {
-+ pProcFile->proc_fops = &sk_proc_fops;
-+ pProcFile->data = dev;
-+ }
-+
-+#endif
-+
-+ pNet->PortNr = 0;
-+ pNet->NetNr = 0;
-+
-+ sk98lin_boards_found++;
-+ pci_set_drvdata(pdev, dev);
-+
-+ /* More then one port found */
-+ if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-+ if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) {
-+ printk(KERN_ERR "Unable to allocate etherdev "
-+ "structure!\n");
-+ return -ENODEV;
-+ }
-+
-+ pAC->dev[1] = dev;
-+ pNet = dev->priv;
-+ pNet->PortNr = 1;
-+ pNet->NetNr = 1;
-+ pNet->pAC = pAC;
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ dev->hard_start_xmit = &SkY2Xmit;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ dev->poll = &SkY2Poll;
-+ dev->weight = 64;
-+#endif
-+ } else {
-+ dev->hard_start_xmit = &SkGeXmit;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ dev->poll = &SkGePoll;
-+ dev->weight = 64;
-+#endif
-+ }
-+ dev->open = &SkGeOpen;
-+ dev->stop = &SkGeClose;
-+ dev->get_stats = &SkGeStats;
-+ dev->set_multicast_list = &SkGeSetRxMode;
-+ dev->set_mac_address = &SkGeSetMacAddr;
-+ dev->do_ioctl = &SkGeIoctl;
-+ dev->change_mtu = &SkGeChangeMtu;
-+ dev->flags &= ~IFF_RUNNING;
-+#ifdef SK_POLL_CONTROLLER
-+ dev->poll_controller = SkGeNetPoll;
-+#endif
-+
-+#ifdef NETIF_F_TSO
-+#ifdef USE_SK_TSO_FEATURE
-+ if ((CHIP_ID_YUKON_2(pAC)) &&
-+ (pAC->GIni.GIChipId != CHIP_ID_YUKON_EC_U)) {
-+ dev->features |= NETIF_F_TSO;
-+ }
-+#endif
-+#endif
-+#ifdef CONFIG_SK98LIN_ZEROCOPY
-+ /* Don't handle if Genesis chipset */
-+ if (pAC->GIni.GIChipId != CHIP_ID_GENESIS)
-+ dev->features |= NETIF_F_SG;
-+#endif
-+#ifdef USE_SK_TX_CHECKSUM
-+ /* Don't handle if Genesis chipset */
-+ if (pAC->GIni.GIChipId != CHIP_ID_GENESIS)
-+ dev->features |= NETIF_F_IP_CSUM;
-+#endif
-+
-+ if (register_netdev(dev)) {
-+ printk(KERN_ERR "SKGE: Could not register device.\n");
-+ free_netdev(dev);
-+ pAC->dev[1] = pAC->dev[0];
-+ } else {
-+
-+ /* Save initial device name */
-+ strcpy(pNet->InitialDevName, dev->name);
-+
-+ /* Set network to off */
-+ netif_stop_queue(dev);
-+ netif_carrier_off(dev);
-+
-+
-+#ifdef CONFIG_PROC_FS
-+ if (pSkRootDir
-+ && (pProcFile = create_proc_entry(pNet->InitialDevName,
-+ S_IRUGO, pSkRootDir))) {
-+ pProcFile->proc_fops = &sk_proc_fops;
-+ pProcFile->data = dev;
-+ }
-+#endif
-+
-+ memcpy((caddr_t) &dev->dev_addr,
-+ (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6);
-+
-+ printk("%s: %s\n", pNet->InitialDevName, pAC->DeviceStr);
-+ printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
-+ }
-+ }
-+
-+ pAC->Index = sk98lin_boards_found;
-+ sk98lin_max_boards_found = sk98lin_boards_found;
-+ return 0;
-+}
-+
-+
-
- /*****************************************************************************
- *
-@@ -282,7 +665,7 @@ int SkGeInitPCI(SK_AC *pAC)
- dev->mem_start = pci_resource_start (pdev, 0);
- pci_set_master(pdev);
-
-- if (pci_request_regions(pdev, pAC->Name) != 0) {
-+ if (pci_request_regions(pdev, DRIVER_FILE_NAME) != 0) {
- retval = 2;
- goto out_disable;
- }
-@@ -319,6 +702,455 @@ int SkGeInitPCI(SK_AC *pAC)
- return retval;
- }
-
-+#ifdef Y2_RECOVERY
-+/*****************************************************************************
-+ *
-+ * SkGeHandleKernelTimer - Handle the kernel timer requests
-+ *
-+ * Description:
-+ * If the requested time interval for the timer has elapsed,
-+ * this function checks the link state.
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static void SkGeHandleKernelTimer(
-+unsigned long ptr) /* holds the pointer to adapter control context */
-+{
-+ DEV_NET *pNet = (DEV_NET*) ptr;
-+ SkGeCheckTimer(pNet);
-+}
-+
-+/*****************************************************************************
-+ *
-+ * sk98lin_check_timer - Resume the the card
-+ *
-+ * Description:
-+ * This function checks the kernel timer
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+void SkGeCheckTimer(
-+DEV_NET *pNet) /* holds the pointer to adapter control context */
-+{
-+ SK_AC *pAC = pNet->pAC;
-+ SK_BOOL StartTimer = SK_TRUE;
-+
-+ if (pNet->InRecover)
-+ return;
-+ if (pNet->TimerExpired)
-+ return;
-+ pNet->TimerExpired = SK_TRUE;
-+
-+#define TXPORT pAC->TxPort[pNet->PortNr][TX_PRIO_LOW]
-+#define RXPORT pAC->RxPort[pNet->PortNr]
-+
-+ if ( (CHIP_ID_YUKON_2(pAC)) &&
-+ (netif_running(pAC->dev[pNet->PortNr]))) {
-+
-+#ifdef Y2_RX_CHECK
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_4167)) {
-+ /* Checks the RX path */
-+ CheckRxPath(pNet);
-+ }
-+#endif
-+
-+ /* Checkthe transmitter */
-+ if (!(IS_Q_EMPTY(&TXPORT.TxAQ_working))) {
-+ if (TXPORT.LastDone != TXPORT.TxALET.Done) {
-+ TXPORT.LastDone = TXPORT.TxALET.Done;
-+ pNet->TransmitTimeoutTimer = 0;
-+ } else {
-+ pNet->TransmitTimeoutTimer++;
-+ if (pNet->TransmitTimeoutTimer >= 10) {
-+ pNet->TransmitTimeoutTimer = 0;
-+#ifdef CHECK_TRANSMIT_TIMEOUT
-+ StartTimer = SK_FALSE;
-+ SkLocalEventQueue(pAC, SKGE_DRV,
-+ SK_DRV_RECOVER,pNet->PortNr,-1,SK_FALSE);
-+#endif
-+ }
-+ }
-+ }
-+
-+#ifdef CHECK_TRANSMIT_TIMEOUT
-+// if (!timer_pending(&pNet->KernelTimer)) {
-+ pNet->KernelTimer.expires = jiffies + (HZ/4); /* 100ms */
-+ add_timer(&pNet->KernelTimer);
-+ pNet->TimerExpired = SK_FALSE;
-+// }
-+#endif
-+ }
-+}
-+
-+
-+/*****************************************************************************
-+*
-+* CheckRXCounters - Checks the the statistics for RX path hang
-+*
-+* Description:
-+* This function is called periodical by a timer.
-+*
-+* Notes:
-+*
-+* Function Parameters:
-+*
-+* Returns:
-+* Traffic status
-+*
-+*/
-+static SK_BOOL CheckRXCounters(
-+DEV_NET *pNet) /* holds the pointer to adapter control context */
-+{
-+ SK_AC *pAC = pNet->pAC;
-+ SK_BOOL bStatus = SK_FALSE;
-+
-+ /* Variable used to store the MAC RX FIFO RP, RPLev*/
-+ SK_U32 MACFifoRP = 0;
-+ SK_U32 MACFifoRLev = 0;
-+
-+ /* Variable used to store the PCI RX FIFO RP, RPLev*/
-+ SK_U32 RXFifoRP = 0;
-+ SK_U8 RXFifoRLev = 0;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> CheckRXCounters()\n"));
-+
-+ /*Check if statistic counters hangs*/
-+ if (pNet->LastJiffies == pAC->dev[pNet->PortNr]->last_rx) {
-+ /* Now read the values of read pointer/level from MAC RX FIFO again */
-+ SK_IN32(pAC->IoBase, MR_ADDR(pNet->PortNr, RX_GMF_RP), &MACFifoRP);
-+ SK_IN32(pAC->IoBase, MR_ADDR(pNet->PortNr, RX_GMF_RLEV), &MACFifoRLev);
-+
-+ /* Now read the values of read pointer/level from RX FIFO again */
-+ SK_IN8(pAC->IoBase, Q_ADDR(pAC->GIni.GP[pNet->PortNr].PRxQOff, Q_RX_RP), &RXFifoRP);
-+ SK_IN8(pAC->IoBase, Q_ADDR(pAC->GIni.GP[pNet->PortNr].PRxQOff, Q_RX_RL), &RXFifoRLev);
-+
-+ /* Check if the MAC RX hang */
-+ if ((MACFifoRP == pNet->PreviousMACFifoRP) &&
-+ (pNet->PreviousMACFifoRP != 0) &&
-+ (MACFifoRLev >= pNet->PreviousMACFifoRLev)){
-+ bStatus = SK_TRUE;
-+ }
-+
-+ /* Check if the PCI RX hang */
-+ if ((RXFifoRP == pNet->PreviousRXFifoRP) &&
-+ (pNet->PreviousRXFifoRP != 0) &&
-+ (RXFifoRLev >= pNet->PreviousRXFifoRLev)){
-+ /*Set the flag to indicate that the RX FIFO hangs*/
-+ bStatus = SK_TRUE;
-+ }
-+ }
-+
-+ /* Store now the values of counters for next check */
-+ pNet->LastJiffies = pAC->dev[pNet->PortNr]->last_rx;
-+
-+ /* Store the values of read pointer/level from MAC RX FIFO for next test */
-+ pNet->PreviousMACFifoRP = MACFifoRP;
-+ pNet->PreviousMACFifoRLev = MACFifoRLev;
-+
-+ /* Store the values of read pointer/level from RX FIFO for next test */
-+ pNet->PreviousRXFifoRP = RXFifoRP;
-+ pNet->PreviousRXFifoRLev = RXFifoRLev;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== CheckRXCounters()\n"));
-+
-+ return bStatus;
-+}
-+
-+/*****************************************************************************
-+*
-+* CheckRxPath - Checks if the RX path
-+*
-+* Description:
-+* This function is called periodical by a timer.
-+*
-+* Notes:
-+*
-+* Function Parameters:
-+*
-+* Returns:
-+* None.
-+*
-+*/
-+static void CheckRxPath(
-+DEV_NET *pNet) /* holds the pointer to adapter control context */
-+{
-+ unsigned long Flags; /* for the spin locks */
-+ /* Initialize the pAC structure.*/
-+ SK_AC *pAC = pNet->pAC;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> CheckRxPath()\n"));
-+
-+ /*If the statistics are not changed then could be an RX problem */
-+ if (CheckRXCounters(pNet)){
-+ /*
-+ * First we try the simple solution by resetting the Level Timer
-+ */
-+
-+ /* Stop Level Timer of Status BMU */
-+ SK_OUT8(pAC->IoBase, STAT_LEV_TIMER_CTRL, TIM_STOP);
-+
-+ /* Start Level Timer of Status BMU */
-+ SK_OUT8(pAC->IoBase, STAT_LEV_TIMER_CTRL, TIM_START);
-+
-+ if (!CheckRXCounters(pNet)) {
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ SkLocalEventQueue(pAC, SKGE_DRV,
-+ SK_DRV_RECOVER,pNet->PortNr,-1,SK_TRUE);
-+
-+ /* Reset the fifo counters */
-+ pNet->PreviousMACFifoRP = 0;
-+ pNet->PreviousMACFifoRLev = 0;
-+ pNet->PreviousRXFifoRP = 0;
-+ pNet->PreviousRXFifoRLev = 0;
-+
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== CheckRxPath()\n"));
-+}
-+
-+
-+
-+#endif
-+
-+
-+#ifdef CONFIG_PM
-+/*****************************************************************************
-+ *
-+ * sk98lin_resume - Resume the the card
-+ *
-+ * Description:
-+ * This function resumes the card into the D0 state
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static int sk98lin_resume(
-+struct pci_dev *pdev) /* the device that is to resume */
-+{
-+ struct net_device *dev = pci_get_drvdata(pdev);
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ SK_U16 PmCtlSts;
-+
-+ /* Set the power state to D0 */
-+ pci_set_power_state(pdev, 0);
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+ pci_restore_state(pdev);
-+#else
-+ pci_restore_state(pdev, pAC->PciState);
-+#endif
-+
-+ /* Set the adapter power state to D0 */
-+ SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts);
-+ PmCtlSts &= ~(PCI_PM_STATE_D3); /* reset all DState bits */
-+ PmCtlSts |= PCI_PM_STATE_D0;
-+ SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PmCtlSts);
-+
-+ /* Reinit the adapter and start the port again */
-+ pAC->BoardLevel = SK_INIT_DATA;
-+ SkDrvLeaveDiagMode(pAC);
-+
-+ netif_device_attach(dev);
-+ netif_start_queue(dev);
-+ return 0;
-+}
-+
-+/*****************************************************************************
-+ *
-+ * sk98lin_suspend - Suspend the card
-+ *
-+ * Description:
-+ * This function suspends the card into a defined state
-+ *
-+ * Returns: N/A
-+ *
-+ */
-+static int sk98lin_suspend(
-+struct pci_dev *pdev, /* pointer to the device that is to suspend */
-+u32 state) /* what power state is desired by Linux? */
-+{
-+ struct net_device *dev = pci_get_drvdata(pdev);
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ SK_U16 PciPMControlStatus;
-+ SK_U16 PciPMCapabilities;
-+ SK_MAC_ADDR MacAddr;
-+ int i;
-+
-+ /* GEnesis and first yukon revs do not support power management */
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-+ if (pAC->GIni.GIChipRev == 0) {
-+ return 0; /* power management not supported */
-+ }
-+ }
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
-+ return 0; /* not supported for this chipset */
-+ }
-+
-+ if (pAC->WolInfo.ConfiguredWolOptions == 0) {
-+ return 0; /* WOL possible, but disabled via ethtool */
-+ }
-+
-+ if(netif_running(dev)) {
-+ netif_stop_queue(dev); /* stop device if running */
-+ }
-+
-+ netif_device_detach(dev);
-+
-+ /* read the PM control/status register from the PCI config space */
-+ SK_IN16(pAC->IoBase, PCI_C(pAC, PCI_PM_CTL_STS), &PciPMControlStatus);
-+
-+ /* read the power management capabilities from the config space */
-+ SK_IN16(pAC->IoBase, PCI_C(pAC, PCI_PM_CAP_REG), &PciPMCapabilities);
-+
-+ /* Enable WakeUp with Magic Packet - get MAC address from adapter */
-+ for (i = 0; i < SK_MAC_ADDR_LEN; i++) {
-+ /* virtual address: will be used for data */
-+ SK_IN8(pAC->IoBase, (B2_MAC_1 + i), &MacAddr.a[i]);
-+ }
-+
-+ SkDrvEnterDiagMode(pAC);
-+ SkEnableWOMagicPacket(pAC, pAC->IoBase, MacAddr);
-+
-+ pci_enable_wake(pdev, 3, 1);
-+ pci_enable_wake(pdev, 4, 1); /* 4 == D3 cold */
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+ pci_save_state(pdev);
-+#else
-+ pci_save_state(pdev, pAC->PciState);
-+#endif
-+ pci_set_power_state(pdev, state); /* set the state */
-+
-+ return 0;
-+}
-+
-+
-+/******************************************************************************
-+ *
-+ * SkEnableWOMagicPacket - Enable Wake on Magic Packet on the adapter
-+ *
-+ * Context:
-+ * init, pageable
-+ * the adapter should be de-initialized before calling this function
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+
-+static void SkEnableWOMagicPacket(
-+SK_AC *pAC, /* Adapter Control Context */
-+SK_IOC IoC, /* I/O control context */
-+SK_MAC_ADDR MacAddr) /* MacAddr expected in magic packet */
-+{
-+ SK_U16 Word;
-+ SK_U32 DWord;
-+ int i;
-+ int HwPortIndex;
-+ int Port = 0;
-+
-+ /* use Port 0 as long as we do not have any dual port cards which support WOL */
-+ HwPortIndex = 0;
-+ DWord = 0;
-+
-+ SK_OUT16(IoC, 0x0004, 0x0002); /* clear S/W Reset */
-+ SK_OUT16(IoC, 0x0f10, 0x0002); /* clear Link Reset */
-+
-+ /*
-+ * PHY Configuration:
-+ * Autonegotioation is enalbed, advertise 10 HD, 10 FD,
-+ * 100 HD, and 100 FD.
-+ */
-+ if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE)) {
-+
-+ SK_OUT16(IoC, 0x0004, 0x0800); /* enable CLK_RUN */
-+ SK_OUT8(IoC, 0x0007, 0xa9); /* enable VAUX */
-+
-+ /* WA code for COMA mode */
-+ /* Only for yukon plus based chipsets rev A3 */
-+ if (pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
-+ SK_IN32(IoC, B2_GP_IO, &DWord);
-+ DWord |= GP_DIR_9; /* set to output */
-+ DWord &= ~GP_IO_9; /* clear PHY reset (active high) */
-+ SK_OUT32(IoC, B2_GP_IO, DWord); /* clear PHY reset */
-+ }
-+
-+ if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON)) {
-+ SK_OUT32(IoC, 0x0f04, 0x01f04001); /* set PHY reset */
-+ SK_OUT32(IoC, 0x0f04, 0x01f04002); /* clear PHY reset */
-+ } else {
-+ SK_OUT8(IoC, 0x0f04, 0x02); /* clear PHY reset */
-+ }
-+
-+ SK_OUT8(IoC, 0x0f00, 0x02); /* clear MAC reset */
-+ SkGmPhyWrite(pAC, IoC, Port, 4, 0x01e1); /* advertise 10/100 HD/FD */
-+ SkGmPhyWrite(pAC, IoC, Port, 9, 0x0000); /* do not advertise 1000 HD/FD */
-+ SkGmPhyWrite(pAC, IoC, Port, 00, 0xB300); /* 100 MBit, disable Autoneg */
-+ } else if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+ SK_OUT8(IoC, 0x0007, 0xa9); /* enable VAUX */
-+ SK_OUT8(IoC, 0x0f04, 0x02); /* clear PHY reset */
-+ SK_OUT8(IoC, 0x0f00, 0x02); /* clear MAC reset */
-+ SkGmPhyWrite(pAC, IoC, Port, 16, 0x0130); /* Enable Automatic Crossover */
-+ SkGmPhyWrite(pAC, IoC, Port, 00, 0xB300); /* 100 MBit, disable Autoneg */
-+ }
-+
-+
-+ /*
-+ * MAC Configuration:
-+ * Set the MAC to 100 HD and enable the auto update features
-+ * for Speed, Flow Control and Duplex Mode.
-+ * If autonegotiation completes successfully the
-+ * MAC takes the link parameters from the PHY.
-+ * If the link partner doesn't support autonegotiation
-+ * the MAC can receive magic packets if the link partner
-+ * uses 100 HD.
-+ */
-+ SK_OUT16(IoC, 0x2804, 0x3832);
-+
-+
-+ /*
-+ * Set Up Magic Packet parameters
-+ */
-+ for (i = 0; i < 6; i+=2) { /* set up magic packet MAC address */
-+ SK_IN16(IoC, 0x100 + i, &Word);
-+ SK_OUT16(IoC, 0xf24 + i, Word);
-+ }
-+
-+ SK_OUT16(IoC, 0x0f20, 0x0208); /* enable PME on magic packet */
-+ /* and on wake up frame */
-+
-+ /*
-+ * Set up PME generation
-+ */
-+ /* set PME legacy mode */
-+ /* Only for PCI express based chipsets */
-+ if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE)) {
-+ SkPciReadCfgDWord(pAC, 0x40, &DWord);
-+ DWord |= 0x8000;
-+ SkPciWriteCfgDWord(pAC, 0x40, DWord);
-+ }
-+
-+ /* clear PME status and switch adapter to DState */
-+ SkPciReadCfgWord(pAC, 0x4c, &Word);
-+ Word |= 0x103;
-+ SkPciWriteCfgWord(pAC, 0x4c, Word);
-+} /* SkEnableWOMagicPacket */
-+#endif
-+
-
- /*****************************************************************************
- *
-@@ -349,36 +1181,19 @@ SK_AC *pAC;
- }
- if (pAC->IoBase) {
- iounmap(pAC->IoBase);
-- }
-- if (pAC->pDescrMem) {
-- BoardFreeMem(pAC);
-- }
-- }
--
--} /* FreeResources */
--
--MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>");
--MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver");
--MODULE_LICENSE("GPL");
--MODULE_PARM(Speed_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(Speed_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(ConType, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--/* used for interrupt moderation */
--MODULE_PARM(IntsPerSec, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i");
--MODULE_PARM(Moderation, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(Stats, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(ModerationMask, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
--MODULE_PARM(AutoSizing, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+ }
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2FreeResources(pAC);
-+ } else {
-+ BoardFreeMem(pAC);
-+ }
-+ }
-+
-+} /* FreeResources */
-+
-+MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>");
-+MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver");
-+MODULE_LICENSE("GPL");
-
-
- #ifdef LINK_SPEED_A
-@@ -462,8 +1277,137 @@ static char *RlmtMode[SK_MAX_CARD_PARAM]
- static int IntsPerSec[SK_MAX_CARD_PARAM];
- static char *Moderation[SK_MAX_CARD_PARAM];
- static char *ModerationMask[SK_MAX_CARD_PARAM];
--static char *AutoSizing[SK_MAX_CARD_PARAM];
--static char *Stats[SK_MAX_CARD_PARAM];
-+
-+static char *LowLatency[SK_MAX_CARD_PARAM];
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
-+module_param_array(Speed_A, charp, NULL, 0);
-+module_param_array(Speed_B, charp, NULL, 0);
-+module_param_array(AutoNeg_A, charp, NULL, 0);
-+module_param_array(AutoNeg_B, charp, NULL, 0);
-+module_param_array(DupCap_A, charp, NULL, 0);
-+module_param_array(DupCap_B, charp, NULL, 0);
-+module_param_array(FlowCtrl_A, charp, NULL, 0);
-+module_param_array(FlowCtrl_B, charp, NULL, 0);
-+module_param_array(Role_A, charp, NULL, 0);
-+module_param_array(Role_B, charp, NULL, 0);
-+module_param_array(ConType, charp, NULL, 0);
-+module_param_array(PrefPort, charp, NULL, 0);
-+module_param_array(RlmtMode, charp, NULL, 0);
-+/* used for interrupt moderation */
-+module_param_array(IntsPerSec, int, NULL, 0);
-+module_param_array(Moderation, charp, NULL, 0);
-+module_param_array(ModerationMask, charp, NULL, 0);
-+module_param_array(LowLatency, charp, NULL, 0);
-+#else
-+MODULE_PARM(Speed_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(Speed_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(ConType, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(IntsPerSec, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i");
-+MODULE_PARM(Moderation, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(ModerationMask, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+MODULE_PARM(LowLatency, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-+#endif
-+
-+
-+/*****************************************************************************
-+ *
-+ * sk98lin_remove_device - device deinit function
-+ *
-+ * Description:
-+ * Disable adapter if it is still running, free resources,
-+ * free device struct.
-+ *
-+ * Returns: N/A
-+ */
-+
-+static void sk98lin_remove_device(struct pci_dev *pdev)
-+{
-+DEV_NET *pNet;
-+SK_AC *pAC;
-+struct SK_NET_DEVICE *next;
-+unsigned long Flags;
-+struct net_device *dev = pci_get_drvdata(pdev);
-+
-+
-+ /* Device not available. Return. */
-+ if (!dev)
-+ return;
-+
-+ pNet = (DEV_NET*) dev->priv;
-+ pAC = pNet->pAC;
-+ next = pAC->Next;
-+
-+ netif_stop_queue(dev);
-+ SkGeYellowLED(pAC, pAC->IoBase, 0);
-+
-+ if(pAC->BoardLevel == SK_INIT_RUN) {
-+ /* board is still alive */
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP,
-+ 0, -1, SK_FALSE);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP,
-+ 1, -1, SK_TRUE);
-+
-+ /* disable interrupts */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-+ SkGeDeInit(pAC, pAC->IoBase);
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+ pAC->BoardLevel = SK_INIT_DATA;
-+ /* We do NOT check here, if IRQ was pending, of course*/
-+ }
-+
-+ if(pAC->BoardLevel == SK_INIT_IO) {
-+ /* board is still alive */
-+ SkGeDeInit(pAC, pAC->IoBase);
-+ pAC->BoardLevel = SK_INIT_DATA;
-+ }
-+
-+ if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){
-+ unregister_netdev(pAC->dev[1]);
-+ free_netdev(pAC->dev[1]);
-+ }
-+
-+ FreeResources(dev);
-+
-+#ifdef CONFIG_PROC_FS
-+ /* Remove the sk98lin procfs device entries */
-+ if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){
-+ remove_proc_entry(pAC->dev[1]->name, pSkRootDir);
-+ }
-+ remove_proc_entry(pNet->InitialDevName, pSkRootDir);
-+#endif
-+
-+ dev->get_stats = NULL;
-+ /*
-+ * otherwise unregister_netdev calls get_stats with
-+ * invalid IO ... :-(
-+ */
-+ unregister_netdev(dev);
-+ free_netdev(dev);
-+ kfree(pAC);
-+ sk98lin_max_boards_found--;
-+
-+#ifdef CONFIG_PROC_FS
-+ /* Remove all Proc entries if last device */
-+ if (sk98lin_max_boards_found == 0) {
-+ /* clear proc-dir */
-+ remove_proc_entry(pSkRootDir->name, proc_net);
-+ }
-+#endif
-+
-+}
-+
-
- /*****************************************************************************
- *
-@@ -501,7 +1445,11 @@ SK_BOOL DualNet;
- spin_lock_init(&pAC->TxPort[i][0].TxDesRingLock);
- spin_lock_init(&pAC->RxPort[i].RxDesRingLock);
- }
-+
-+ spin_lock_init(&pAC->InitLock); /* Init lock */
- spin_lock_init(&pAC->SlowPathLock);
-+ spin_lock_init(&pAC->TxQueueLock); /* for Yukon2 chipsets */
-+ spin_lock_init(&pAC->SetPutIndexLock); /* for Yukon2 chipsets */
-
- /* level 0 init common modules here */
-
-@@ -520,15 +1468,13 @@ SK_BOOL DualNet;
- SkTimerInit(pAC, pAC->IoBase, SK_INIT_DATA);
-
- pAC->BoardLevel = SK_INIT_DATA;
-- pAC->RxBufSize = ETH_BUF_SIZE;
-+ pAC->RxPort[0].RxBufSize = ETH_BUF_SIZE;
-+ pAC->RxPort[1].RxBufSize = ETH_BUF_SIZE;
-
- SK_PNMI_SET_DRIVER_DESCR(pAC, DescrString);
- SK_PNMI_SET_DRIVER_VER(pAC, VerStr);
-
-- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
--
- /* level 1 init common modules here (HW init) */
-- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) {
- printk("sk98lin: HWInit (1) failed.\n");
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-@@ -540,51 +1486,93 @@ SK_BOOL DualNet;
- SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO);
- SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO);
- SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO);
-+#ifdef Y2_RECOVERY
-+ /* mark entries invalid */
-+ pAC->LastPort = 3;
-+ pAC->LastOpc = 0xFF;
-+#endif
-
- /* Set chipset type support */
-- pAC->ChipsetType = 0;
- if ((pAC->GIni.GIChipId == CHIP_ID_YUKON) ||
-- (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE)) {
-- pAC->ChipsetType = 1;
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_LP)) {
-+ pAC->ChipsetType = 1; /* Yukon chipset (descriptor logic) */
-+ } else if (CHIP_ID_YUKON_2(pAC)) {
-+ pAC->ChipsetType = 2; /* Yukon2 chipset (list logic) */
-+ } else {
-+ pAC->ChipsetType = 0; /* Genesis chipset (descriptor logic) */
-+ }
-+
-+ /* wake on lan support */
-+ pAC->WolInfo.SupportedWolOptions = 0;
-+#if defined (ETHTOOL_GWOL) && defined (ETHTOOL_SWOL)
-+ if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) {
-+ pAC->WolInfo.SupportedWolOptions = WAKE_MAGIC;
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-+ if (pAC->GIni.GIChipRev == 0) {
-+ pAC->WolInfo.SupportedWolOptions = 0;
-+ }
-+ }
- }
-+#endif
-+ pAC->WolInfo.ConfiguredWolOptions = pAC->WolInfo.SupportedWolOptions;
-
- GetConfiguration(pAC);
- if (pAC->RlmtNets == 2) {
-- pAC->GIni.GIPortUsage = SK_MUL_LINK;
-+ pAC->GIni.GP[0].PPortUsage = SK_MUL_LINK;
-+ pAC->GIni.GP[1].PPortUsage = SK_MUL_LINK;
- }
-
- pAC->BoardLevel = SK_INIT_IO;
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-
-- if (pAC->GIni.GIMacsFound == 2) {
-- Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
-- } else if (pAC->GIni.GIMacsFound == 1) {
-- Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ,
-- pAC->Name, dev);
-- } else {
-- printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
-- pAC->GIni.GIMacsFound);
-- return -EAGAIN;
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, dev->name, dev);
-+ } else if (pAC->GIni.GIMacsFound == 1) {
-+ Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, dev->name, dev);
-+ } else {
-+ printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
-+ pAC->GIni.GIMacsFound);
-+ return -EAGAIN;
-+ }
-+ }
-+ else {
-+ Ret = request_irq(dev->irq, SkY2Isr, SA_SHIRQ, dev->name, dev);
- }
-
- if (Ret) {
- printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n",
-- dev->irq);
-+ dev->irq);
- return -EAGAIN;
- }
- pAC->AllocFlag |= SK_ALLOC_IRQ;
-
-- /* Alloc memory for this board (Mem for RxD/TxD) : */
-- if(!BoardAllocMem(pAC)) {
-- printk("No memory for descriptor rings.\n");
-- return(-EAGAIN);
-+ /*
-+ ** Alloc descriptor/LETable memory for this board (both RxD/TxD)
-+ */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (!SkY2AllocateResources(pAC)) {
-+ printk("No memory for Yukon2 settings\n");
-+ return(-EAGAIN);
-+ }
-+ } else {
-+ if(!BoardAllocMem(pAC)) {
-+ printk("No memory for descriptor rings.\n");
-+ return(-EAGAIN);
-+ }
- }
-
-+#ifdef SK_USE_CSUM
- SkCsSetReceiveFlags(pAC,
- SKCS_PROTO_IP | SKCS_PROTO_TCP | SKCS_PROTO_UDP,
- &pAC->CsOfs1, &pAC->CsOfs2, 0);
- pAC->CsOfs = (pAC->CsOfs2 << 16) | pAC->CsOfs1;
-+#endif
-
-+ /*
-+ ** Function BoardInitMem() for Yukon dependent settings...
-+ */
- BoardInitMem(pAC);
- /* tschilling: New common function with minimum size check. */
- DualNet = SK_FALSE;
-@@ -596,7 +1584,12 @@ SK_BOOL DualNet;
- pAC,
- pAC->ActivePort,
- DualNet)) {
-- BoardFreeMem(pAC);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2FreeResources(pAC);
-+ } else {
-+ BoardFreeMem(pAC);
-+ }
-+
- printk("sk98lin: SkGeInitAssignRamToQueues failed.\n");
- return(-EAGAIN);
- }
-@@ -696,16 +1689,20 @@ size_t AllocLength; /* length of comple
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("BoardFreeMem\n"));
-+
-+ if (pAC->pDescrMem) {
-+
- #if (BITS_PER_LONG == 32)
-- AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + 8;
-+ AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + 8;
- #else
-- AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound
-- + RX_RING_SIZE + 8;
-+ AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound
-+ + RX_RING_SIZE + 8;
- #endif
-
-- pci_free_consistent(pAC->PciDev, AllocLength,
-+ pci_free_consistent(pAC->PciDev, AllocLength,
- pAC->pDescrMem, pAC->pDescrMemDMA);
-- pAC->pDescrMem = NULL;
-+ pAC->pDescrMem = NULL;
-+ }
- } /* BoardFreeMem */
-
-
-@@ -714,7 +1711,7 @@ size_t AllocLength; /* length of comple
- * BoardInitMem - initiate the descriptor rings
- *
- * Description:
-- * This function sets the descriptor rings up in memory.
-+ * This function sets the descriptor rings or LETables up in memory.
- * The adapter is initialized with the descriptor start addresses.
- *
- * Returns: N/A
-@@ -729,34 +1726,37 @@ int TxDescrSize; /* the size of a tx des
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("BoardInitMem\n"));
-
-- RxDescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN;
-- pAC->RxDescrPerRing = RX_RING_SIZE / RxDescrSize;
-- TxDescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN;
-- pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize;
-+ if (!pAC->GIni.GIYukon2) {
-+ RxDescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN;
-+ pAC->RxDescrPerRing = RX_RING_SIZE / RxDescrSize;
-+ TxDescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN;
-+ pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize;
-
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- SetupRing(
-- pAC,
-- pAC->TxPort[i][0].pTxDescrRing,
-- pAC->TxPort[i][0].VTxDescrRing,
-- (RXD**)&pAC->TxPort[i][0].pTxdRingHead,
-- (RXD**)&pAC->TxPort[i][0].pTxdRingTail,
-- (RXD**)&pAC->TxPort[i][0].pTxdRingPrev,
-- &pAC->TxPort[i][0].TxdRingFree,
-- SK_TRUE);
-- SetupRing(
-- pAC,
-- pAC->RxPort[i].pRxDescrRing,
-- pAC->RxPort[i].VRxDescrRing,
-- &pAC->RxPort[i].pRxdRingHead,
-- &pAC->RxPort[i].pRxdRingTail,
-- &pAC->RxPort[i].pRxdRingPrev,
-- &pAC->RxPort[i].RxdRingFree,
-- SK_FALSE);
-+ for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-+ SetupRing(
-+ pAC,
-+ pAC->TxPort[i][0].pTxDescrRing,
-+ pAC->TxPort[i][0].VTxDescrRing,
-+ (RXD**)&pAC->TxPort[i][0].pTxdRingHead,
-+ (RXD**)&pAC->TxPort[i][0].pTxdRingTail,
-+ (RXD**)&pAC->TxPort[i][0].pTxdRingPrev,
-+ &pAC->TxPort[i][0].TxdRingFree,
-+ &pAC->TxPort[i][0].TxdRingPrevFree,
-+ SK_TRUE);
-+ SetupRing(
-+ pAC,
-+ pAC->RxPort[i].pRxDescrRing,
-+ pAC->RxPort[i].VRxDescrRing,
-+ &pAC->RxPort[i].pRxdRingHead,
-+ &pAC->RxPort[i].pRxdRingTail,
-+ &pAC->RxPort[i].pRxdRingPrev,
-+ &pAC->RxPort[i].RxdRingFree,
-+ &pAC->RxPort[i].RxdRingFree,
-+ SK_FALSE);
-+ }
- }
- } /* BoardInitMem */
-
--
- /*****************************************************************************
- *
- * SetupRing - create one descriptor ring
-@@ -776,6 +1776,7 @@ RXD **ppRingHead, /* address where the
- RXD **ppRingTail, /* address where the tail should be written */
- RXD **ppRingPrev, /* address where the tail should be written */
- int *pRingFree, /* address where the # of free descr. goes */
-+int *pRingPrevFree, /* address where the # of free descr. goes */
- SK_BOOL IsTx) /* flag: is this a tx ring */
- {
- int i; /* loop counter */
-@@ -818,11 +1819,12 @@ uintptr_t VNextDescr; /* the virtual bus
- }
- pPrevDescr->pNextRxd = (RXD*) pMemArea;
- pPrevDescr->VNextRxd = VMemArea;
-- pDescr = (RXD*) pMemArea;
-- *ppRingHead = (RXD*) pMemArea;
-- *ppRingTail = *ppRingHead;
-- *ppRingPrev = pPrevDescr;
-- *pRingFree = DescrNum;
-+ pDescr = (RXD*) pMemArea;
-+ *ppRingHead = (RXD*) pMemArea;
-+ *ppRingTail = *ppRingHead;
-+ *ppRingPrev = pPrevDescr;
-+ *pRingFree = DescrNum;
-+ *pRingPrevFree = DescrNum;
- } /* SetupRing */
-
-
-@@ -894,10 +1896,28 @@ SK_U32 IntSrc; /* interrupts source re
- * Check and process if its our interrupt
- */
- SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc);
-- if (IntSrc == 0) {
-+ if ((IntSrc == 0) && (!pNet->NetConsoleMode)) {
- return SkIsrRetNone;
- }
-
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (netif_rx_schedule_prep(dev)) {
-+ pAC->GIni.GIValIrqMask &= ~(NAPI_DRV_IRQS);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ __netif_rx_schedule(dev);
-+ }
-+
-+#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-+ if (IntSrc & IS_XA1_F) {
-+ CLEAR_TX_IRQ(0, TX_PRIO_LOW);
-+ }
-+ if (IntSrc & IS_XA2_F) {
-+ CLEAR_TX_IRQ(1, TX_PRIO_LOW);
-+ }
-+#endif
-+
-+
-+#else
- while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) {
- #if 0 /* software irq currently not used */
- if (IntSrc & IS_IRQ_SW) {
-@@ -911,6 +1931,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF RX1 IRQ\n"));
- ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE);
-+ CLEAR_AND_START_RX(0);
- SK_PNMI_CNT_RX_INTR(pAC, 0);
- }
- if (IntSrc & IS_R2_F) {
-@@ -918,6 +1939,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF RX2 IRQ\n"));
- ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE);
-+ CLEAR_AND_START_RX(1);
- SK_PNMI_CNT_RX_INTR(pAC, 1);
- }
- #ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-@@ -925,6 +1947,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF AS TX1 IRQ\n"));
-+ CLEAR_TX_IRQ(0, TX_PRIO_LOW);
- SK_PNMI_CNT_TX_INTR(pAC, 0);
- spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock);
- FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]);
-@@ -934,6 +1957,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF AS TX2 IRQ\n"));
-+ CLEAR_TX_IRQ(1, TX_PRIO_LOW);
- SK_PNMI_CNT_TX_INTR(pAC, 1);
- spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock);
- FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]);
-@@ -944,38 +1968,28 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF SY TX1 IRQ\n"));
-+ CLEAR_TX_IRQ(0, TX_PRIO_HIGH);
- SK_PNMI_CNT_TX_INTR(pAC, 1);
- spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock);
- FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH);
- spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock);
-- ClearTxIrq(pAC, 0, TX_PRIO_HIGH);
- }
- if (IntSrc & IS_XS2_F) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF SY TX2 IRQ\n"));
-+ CLEAR_TX_IRQ(1, TX_PRIO_HIGH);
- SK_PNMI_CNT_TX_INTR(pAC, 1);
- spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock);
- FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH);
- spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock);
-- ClearTxIrq(pAC, 1, TX_PRIO_HIGH);
- }
- #endif
- #endif
-
-- /* do all IO at once */
-- if (IntSrc & IS_R1_F)
-- ClearAndStartRx(pAC, 0);
-- if (IntSrc & IS_R2_F)
-- ClearAndStartRx(pAC, 1);
--#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-- if (IntSrc & IS_XA1_F)
-- ClearTxIrq(pAC, 0, TX_PRIO_LOW);
-- if (IntSrc & IS_XA2_F)
-- ClearTxIrq(pAC, 1, TX_PRIO_LOW);
--#endif
- SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc);
- } /* while (IntSrc & IRQ_MASK != 0) */
-+#endif
-
- IntSrc &= pAC->GIni.GIValIrqMask;
- if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) {
-@@ -989,18 +2003,12 @@ SK_U32 IntSrc; /* interrupts source re
- SkEventDispatcher(pAC, pAC->IoBase);
- spin_unlock(&pAC->SlowPathLock);
- }
-- /*
-- * do it all again is case we cleared an interrupt that
-- * came in after handling the ring (OUTs may be delayed
-- * in hardware buffers, but are through after IN)
-- *
-- * rroesler: has been commented out and shifted to
-- * SkGeDrvEvent(), because it is timer
-- * guarded now
-- *
-+
-+#ifndef CONFIG_SK98LIN_NAPI
-+ /* Handle interrupts */
- ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE);
- ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE);
-- */
-+#endif
-
- if (pAC->CheckQueue) {
- pAC->CheckQueue = SK_FALSE;
-@@ -1043,10 +2051,25 @@ SK_U32 IntSrc; /* interrupts source re
- * Check and process if its our interrupt
- */
- SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc);
-- if (IntSrc == 0) {
-+ if ((IntSrc == 0) && (!pNet->NetConsoleMode)) {
- return SkIsrRetNone;
- }
-
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (netif_rx_schedule_prep(dev)) {
-+ CLEAR_AND_START_RX(0);
-+ CLEAR_TX_IRQ(0, TX_PRIO_LOW);
-+ pAC->GIni.GIValIrqMask &= ~(NAPI_DRV_IRQS);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ __netif_rx_schedule(dev);
-+ }
-+
-+#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-+ if (IntSrc & IS_XA1_F) {
-+ CLEAR_TX_IRQ(0, TX_PRIO_LOW);
-+ }
-+#endif
-+#else
- while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) {
- #if 0 /* software irq currently not used */
- if (IntSrc & IS_IRQ_SW) {
-@@ -1060,6 +2083,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF RX1 IRQ\n"));
- ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE);
-+ CLEAR_AND_START_RX(0);
- SK_PNMI_CNT_RX_INTR(pAC, 0);
- }
- #ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-@@ -1067,6 +2091,7 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF AS TX1 IRQ\n"));
-+ CLEAR_TX_IRQ(0, TX_PRIO_LOW);
- SK_PNMI_CNT_TX_INTR(pAC, 0);
- spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock);
- FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]);
-@@ -1077,24 +2102,18 @@ SK_U32 IntSrc; /* interrupts source re
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_INT_SRC,
- ("EOF SY TX1 IRQ\n"));
-+ CLEAR_TX_IRQ(0, TX_PRIO_HIGH);
- SK_PNMI_CNT_TX_INTR(pAC, 0);
- spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock);
- FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH);
- spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock);
-- ClearTxIrq(pAC, 0, TX_PRIO_HIGH);
- }
- #endif
- #endif
-
-- /* do all IO at once */
-- if (IntSrc & IS_R1_F)
-- ClearAndStartRx(pAC, 0);
--#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */
-- if (IntSrc & IS_XA1_F)
-- ClearTxIrq(pAC, 0, TX_PRIO_LOW);
--#endif
- SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc);
- } /* while (IntSrc & IRQ_MASK != 0) */
-+#endif
-
- IntSrc &= pAC->GIni.GIValIrqMask;
- if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) {
-@@ -1108,17 +2127,10 @@ SK_U32 IntSrc; /* interrupts source re
- SkEventDispatcher(pAC, pAC->IoBase);
- spin_unlock(&pAC->SlowPathLock);
- }
-- /*
-- * do it all again is case we cleared an interrupt that
-- * came in after handling the ring (OUTs may be delayed
-- * in hardware buffers, but are through after IN)
-- *
-- * rroesler: has been commented out and shifted to
-- * SkGeDrvEvent(), because it is timer
-- * guarded now
-- *
-+
-+#ifndef CONFIG_SK98LIN_NAPI
- ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE);
-- */
-+#endif
-
- /* IRQ is processed - Enable IRQs again*/
- SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-@@ -1126,7 +2138,6 @@ SK_U32 IntSrc; /* interrupts source re
- return SkIsrRetHandled;
- } /* SkGeIsrOnePort */
-
--
- /****************************************************************************
- *
- * SkGeOpen - handle start of initialized adapter
-@@ -1144,27 +2155,23 @@ SK_U32 IntSrc; /* interrupts source re
- * != 0 on error
- */
- static int SkGeOpen(
--struct SK_NET_DEVICE *dev)
-+struct SK_NET_DEVICE *dev) /* the device that is to be opened */
- {
-- DEV_NET *pNet;
-- SK_AC *pAC;
-- unsigned long Flags; /* for spin lock */
-- int i;
-- SK_EVPARA EvPara; /* an event parameter union */
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ unsigned long Flags; /* for the spin locks */
-+ unsigned long InitFlags; /* for the spin locks */
-+ int CurrMac; /* loop ctr for ports */
-
-- pNet = (DEV_NET*) dev->priv;
-- pAC = pNet->pAC;
--
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC));
-+ spin_lock_irqsave(&pAC->InitLock, InitFlags);
-
--#ifdef SK_DIAG_SUPPORT
- if (pAC->DiagModeActive == DIAG_ACTIVE) {
- if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
- return (-1); /* still in use by diag; deny actions */
- }
- }
--#endif
-
- if (!try_module_get(THIS_MODULE)) {
- return (-1); /* increase of usage count not possible */
-@@ -1188,6 +2195,11 @@ struct SK_NET_DEVICE *dev)
- SkRlmtInit (pAC, pAC->IoBase, SK_INIT_IO);
- SkTimerInit (pAC, pAC->IoBase, SK_INIT_IO);
- pAC->BoardLevel = SK_INIT_IO;
-+#ifdef Y2_RECOVERY
-+ /* mark entries invalid */
-+ pAC->LastPort = 3;
-+ pAC->LastOpc = 0xFF;
-+#endif
- }
-
- if (pAC->BoardLevel != SK_INIT_RUN) {
-@@ -1206,45 +2218,62 @@ struct SK_NET_DEVICE *dev)
- pAC->BoardLevel = SK_INIT_RUN;
- }
-
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- /* Enable transmit descriptor polling. */
-- SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE);
-- FillRxRing(pAC, &pAC->RxPort[i]);
-+ for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) {
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* Enable transmit descriptor polling. */
-+ SkGePollTxD(pAC, pAC->IoBase, CurrMac, SK_TRUE);
-+ FillRxRing(pAC, &pAC->RxPort[CurrMac]);
-+ SkMacRxTxEnable(pAC, pAC->IoBase, pNet->PortNr);
-+ }
- }
-- SkGeYellowLED(pAC, pAC->IoBase, 1);
-
-- StartDrvCleanupTimer(pAC);
-+ SkGeYellowLED(pAC, pAC->IoBase, 1);
- SkDimEnableModerationIfNeeded(pAC);
-- SkDimDisplayModerationSettings(pAC);
-
-- pAC->GIni.GIValIrqMask &= IRQ_MASK;
--
-- /* enable Interrupts */
-- SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-- SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /*
-+ ** Has been setup already at SkGeInit(SK_INIT_IO),
-+ ** but additional masking added for Genesis & Yukon
-+ ** chipsets -> modify it...
-+ */
-+ pAC->GIni.GIValIrqMask &= IRQ_MASK;
-+#ifndef USE_TX_COMPLETE
-+ pAC->GIni.GIValIrqMask &= ~(TX_COMPL_IRQS);
-+#endif
-+ }
-
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-
- if ((pAC->RlmtMode != 0) && (pAC->MaxPorts == 0)) {
-- EvPara.Para32[0] = pAC->RlmtNets;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS,
-- EvPara);
-- EvPara.Para32[0] = pAC->RlmtMode;
-- EvPara.Para32[1] = 0;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_MODE_CHANGE,
-- EvPara);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS,
-+ pAC->RlmtNets, -1, SK_FALSE);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_MODE_CHANGE,
-+ pAC->RlmtMode, 0, SK_FALSE);
- }
-
-- EvPara.Para32[0] = pNet->NetNr;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
-- SkEventDispatcher(pAC, pAC->IoBase);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START,
-+ pNet->NetNr, -1, SK_TRUE);
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-
-- pAC->MaxPorts++;
-- pNet->Up = 1;
-+#ifdef Y2_RECOVERY
-+ pNet->TimerExpired = SK_FALSE;
-+ pNet->InRecover = SK_FALSE;
-+ pNet->NetConsoleMode = SK_FALSE;
-+
-+ /* Initialize the kernel timer */
-+ init_timer(&pNet->KernelTimer);
-+ pNet->KernelTimer.function = SkGeHandleKernelTimer;
-+ pNet->KernelTimer.data = (unsigned long) pNet;
-+ pNet->KernelTimer.expires = jiffies + (HZ/4); /* initially 250ms */
-+ add_timer(&pNet->KernelTimer);
-+#endif
-+
-+ /* enable Interrupts */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK);
-
-+ pAC->MaxPorts++;
-+ spin_unlock_irqrestore(&pAC->InitLock, InitFlags);
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeOpen suceeded\n"));
-@@ -1265,24 +2294,28 @@ struct SK_NET_DEVICE *dev)
- * error code - on error
- */
- static int SkGeClose(
--struct SK_NET_DEVICE *dev)
-+struct SK_NET_DEVICE *dev) /* the device that is to be closed */
- {
-- DEV_NET *pNet;
-- DEV_NET *newPtrNet;
-- SK_AC *pAC;
--
-- unsigned long Flags; /* for spin lock */
-- int i;
-- int PortIdx;
-- SK_EVPARA EvPara;
--
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ DEV_NET *newPtrNet;
-+ unsigned long Flags; /* for the spin locks */
-+ unsigned long InitFlags; /* for the spin locks */
-+ int CurrMac; /* loop ctr for the current MAC */
-+ int PortIdx;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ int WorkToDo = 1; /* min(*budget, dev->quota); */
-+ int WorkDone = 0;
-+#endif
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeClose: pAC=0x%lX ", (unsigned long)pAC));
-+ spin_lock_irqsave(&pAC->InitLock, InitFlags);
-
-- pNet = (DEV_NET*) dev->priv;
-- pAC = pNet->pAC;
-+#ifdef Y2_RECOVERY
-+ pNet->InRecover = SK_TRUE;
-+ del_timer(&pNet->KernelTimer);
-+#endif
-
--#ifdef SK_DIAG_SUPPORT
- if (pAC->DiagModeActive == DIAG_ACTIVE) {
- if (pAC->DiagFlowCtrl == SK_FALSE) {
- module_put(THIS_MODULE);
-@@ -1302,7 +2335,6 @@ struct SK_NET_DEVICE *dev)
- pAC->DiagFlowCtrl = SK_FALSE;
- }
- }
--#endif
-
- netif_stop_queue(dev);
-
-@@ -1311,8 +2343,6 @@ struct SK_NET_DEVICE *dev)
- else
- PortIdx = pNet->NetNr;
-
-- StopDrvCleanupTimer(pAC);
--
- /*
- * Clear multicast table, promiscuous mode ....
- */
-@@ -1324,46 +2354,101 @@ struct SK_NET_DEVICE *dev)
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- /* disable interrupts */
- SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-- EvPara.Para32[0] = pNet->NetNr;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- SkEventDispatcher(pAC, pAC->IoBase);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP,
-+ pNet->NetNr, -1, SK_TRUE);
- SK_OUT32(pAC->IoBase, B0_IMSK, 0);
- /* stop the hardware */
-- SkGeDeInit(pAC, pAC->IoBase);
-- pAC->BoardLevel = SK_INIT_DATA;
-+
-+
-+ if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 1)) {
-+ /* RLMT check link state mode */
-+ for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) {
-+ if (CHIP_ID_YUKON_2(pAC))
-+ SkY2PortStop( pAC,
-+ pAC->IoBase,
-+ CurrMac,
-+ SK_STOP_ALL,
-+ SK_HARD_RST);
-+ else
-+ SkGeStopPort( pAC,
-+ pAC->IoBase,
-+ CurrMac,
-+ SK_STOP_ALL,
-+ SK_HARD_RST);
-+ } /* for */
-+ } else {
-+ /* Single link or single port */
-+ if (CHIP_ID_YUKON_2(pAC))
-+ SkY2PortStop( pAC,
-+ pAC->IoBase,
-+ PortIdx,
-+ SK_STOP_ALL,
-+ SK_HARD_RST);
-+ else
-+ SkGeStopPort( pAC,
-+ pAC->IoBase,
-+ PortIdx,
-+ SK_STOP_ALL,
-+ SK_HARD_RST);
-+ }
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
- } else {
--
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-- EvPara.Para32[0] = pNet->NetNr;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- SkPnmiEvent(pAC, pAC->IoBase, SK_PNMI_EVT_XMAC_RESET, EvPara);
-- SkEventDispatcher(pAC, pAC->IoBase);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP,
-+ pNet->NetNr, -1, SK_FALSE);
-+ SkLocalEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET,
-+ pNet->NetNr, -1, SK_TRUE);
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-
- /* Stop port */
- spin_lock_irqsave(&pAC->TxPort[pNet->PortNr]
- [TX_PRIO_LOW].TxDesRingLock, Flags);
-- SkGeStopPort(pAC, pAC->IoBase, pNet->PortNr,
-- SK_STOP_ALL, SK_HARD_RST);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStop(pAC, pAC->IoBase, pNet->PortNr,
-+ SK_STOP_ALL, SK_HARD_RST);
-+ }
-+ else {
-+ SkGeStopPort(pAC, pAC->IoBase, pNet->PortNr,
-+ SK_STOP_ALL, SK_HARD_RST);
-+ }
- spin_unlock_irqrestore(&pAC->TxPort[pNet->PortNr]
- [TX_PRIO_LOW].TxDesRingLock, Flags);
- }
-
- if (pAC->RlmtNets == 1) {
- /* clear all descriptor rings */
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE);
-- ClearRxRing(pAC, &pAC->RxPort[i]);
-- ClearTxRing(pAC, &pAC->TxPort[i][TX_PRIO_LOW]);
-+ for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) {
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC,&pAC->RxPort[CurrMac],
-+ SK_TRUE,&WorkDone,WorkToDo);
-+#else
-+ ReceiveIrq(pAC,&pAC->RxPort[CurrMac],SK_TRUE);
-+#endif
-+ ClearRxRing(pAC, &pAC->RxPort[CurrMac]);
-+ ClearTxRing(pAC, &pAC->TxPort[CurrMac][TX_PRIO_LOW]);
-+ } else {
-+ SkY2FreeRxBuffers(pAC, pAC->IoBase, CurrMac);
-+ SkY2FreeTxBuffers(pAC, pAC->IoBase, CurrMac);
-+ }
- }
- } else {
- /* clear port descriptor rings */
-- ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE);
-- ClearRxRing(pAC, &pAC->RxPort[pNet->PortNr]);
-- ClearTxRing(pAC, &pAC->TxPort[pNet->PortNr][TX_PRIO_LOW]);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE, &WorkDone, WorkToDo);
-+#else
-+ ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE);
-+#endif
-+ ClearRxRing(pAC, &pAC->RxPort[pNet->PortNr]);
-+ ClearTxRing(pAC, &pAC->TxPort[pNet->PortNr][TX_PRIO_LOW]);
-+ }
-+ else {
-+ SkY2FreeRxBuffers(pAC, pAC->IoBase, pNet->PortNr);
-+ SkY2FreeTxBuffers(pAC, pAC->IoBase, pNet->PortNr);
-+ }
- }
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
-@@ -1374,9 +2459,13 @@ struct SK_NET_DEVICE *dev)
- sizeof(SK_PNMI_STRUCT_DATA));
-
- pAC->MaxPorts--;
-- pNet->Up = 0;
--
- module_put(THIS_MODULE);
-+
-+#ifdef Y2_RECOVERY
-+ pNet->InRecover = SK_FALSE;
-+#endif
-+ spin_unlock_irqrestore(&pAC->InitLock, InitFlags);
-+
- return (0);
- } /* SkGeClose */
-
-@@ -1433,20 +2522,112 @@ int Rc; /* return code of XmitFrame */
- skb);
- }
-
-- /* Transmitter out of resources? */
-- if (Rc <= 0) {
-- netif_stop_queue(dev);
-+ /* Transmitter out of resources? */
-+#ifdef USE_TX_COMPLETE
-+ if (Rc <= 0) {
-+ netif_stop_queue(dev);
-+ }
-+#endif
-+
-+ /* If not taken, give buffer ownership back to the
-+ * queueing layer.
-+ */
-+ if (Rc < 0)
-+ return (1);
-+
-+ dev->trans_start = jiffies;
-+ return (0);
-+} /* SkGeXmit */
-+
-+#ifdef CONFIG_SK98LIN_NAPI
-+/*****************************************************************************
-+ *
-+ * SkGePoll - NAPI Rx polling callback for GEnesis and Yukon chipsets
-+ *
-+ * Description:
-+ * Called by the Linux system in case NAPI polling is activated
-+ *
-+ * Returns:
-+ * The number of work data still to be handled
-+ */
-+static int SkGePoll(struct net_device *dev, int *budget)
-+{
-+ SK_AC *pAC = ((DEV_NET*)(dev->priv))->pAC; /* pointer to adapter context */
-+ int WorkToDo = min(*budget, dev->quota);
-+ int WorkDone = 0;
-+ unsigned long Flags;
-+
-+
-+ if (pAC->dev[0] != pAC->dev[1]) {
-+ spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock);
-+ FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]);
-+ spin_unlock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock);
-+
-+ ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE, &WorkDone, WorkToDo);
-+ CLEAR_AND_START_RX(1);
-+ }
-+ spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock);
-+ FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]);
-+ spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock);
-+
-+ ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE, &WorkDone, WorkToDo);
-+ CLEAR_AND_START_RX(0);
-+
-+ *budget -= WorkDone;
-+ dev->quota -= WorkDone;
-+
-+ if(WorkDone < WorkToDo) {
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ netif_rx_complete(dev);
-+ pAC->GIni.GIValIrqMask |= (NAPI_DRV_IRQS);
-+#ifndef USE_TX_COMPLETE
-+ pAC->GIni.GIValIrqMask &= ~(TX_COMPL_IRQS);
-+#endif
-+ /* enable interrupts again */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
- }
-+ return (WorkDone >= WorkToDo);
-+} /* SkGePoll */
-+#endif
-
-- /* If not taken, give buffer ownership back to the
-- * queueing layer.
-- */
-- if (Rc < 0)
-- return (1);
-+#ifdef SK_POLL_CONTROLLER
-+/*****************************************************************************
-+ *
-+ * SkGeNetPoll - Polling "interrupt"
-+ *
-+ * Description:
-+ * Polling 'interrupt' - used by things like netconsole and netdump
-+ * to send skbs without having to re-enable interrupts.
-+ * It's not called while the interrupt routine is executing.
-+ */
-+static void SkGeNetPoll(
-+struct SK_NET_DEVICE *dev)
-+{
-+DEV_NET *pNet;
-+SK_AC *pAC;
-
-- dev->trans_start = jiffies;
-- return (0);
--} /* SkGeXmit */
-+ pNet = (DEV_NET*) dev->priv;
-+ pAC = pNet->pAC;
-+ pNet->NetConsoleMode = SK_TRUE;
-+
-+ /* Prevent any reconfiguration while handling
-+ the 'interrupt' */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* Handle the GENESIS Isr */
-+ if (pAC->GIni.GIMacsFound == 2)
-+ SkGeIsr(dev->irq, dev, NULL);
-+ else
-+ SkGeIsrOnePort(dev->irq, dev, NULL);
-+ } else {
-+ /* Handle the Yukon2 Isr */
-+ SkY2Isr(dev->irq, dev, NULL);
-+ }
-+
-+}
-+#endif
-
-
- /*****************************************************************************
-@@ -1472,7 +2653,7 @@ int Rc; /* return code of XmitFrame */
- * < 0 - on failure: other problems ( -> return failure to upper layers)
- */
- static int XmitFrame(
--SK_AC *pAC, /* pointer to adapter context */
-+SK_AC *pAC, /* pointer to adapter context */
- TX_PORT *pTxPort, /* pointer to struct of port to send to */
- struct sk_buff *pMessage) /* pointer to send-message */
- {
-@@ -1488,11 +2669,14 @@ struct sk_buff *pMessage) /* pointer to
-
- spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags);
- #ifndef USE_TX_COMPLETE
-- FreeTxDescriptors(pAC, pTxPort);
-+ if ((pTxPort->TxdRingPrevFree - pTxPort->TxdRingFree) > 6) {
-+ FreeTxDescriptors(pAC, pTxPort);
-+ pTxPort->TxdRingPrevFree = pTxPort->TxdRingFree;
-+ }
- #endif
- if (pTxPort->TxdRingFree == 0) {
- /*
-- ** no enough free descriptors in ring at the moment.
-+ ** not enough free descriptors in ring at the moment.
- ** Maybe free'ing some old one help?
- */
- FreeTxDescriptors(pAC, pTxPort);
-@@ -1578,7 +2762,7 @@ struct sk_buff *pMessage) /* pointer to
- BMU_IRQ_EOF |
- #endif
- pMessage->len;
-- } else {
-+ } else {
- pTxd->TBControl = BMU_OWN | BMU_STF | BMU_CHECK |
- BMU_SW | BMU_EOF |
- #ifdef USE_TX_COMPLETE
-@@ -1914,7 +3098,7 @@ RXD *pRxd; /* the rxd to fill */
- SK_U16 Length; /* data fragment length */
- SK_U64 PhysAddr; /* physical address of a rx buffer */
-
-- pMsgBlock = alloc_skb(pAC->RxBufSize, GFP_ATOMIC);
-+ pMsgBlock = alloc_skb(pRxPort->RxBufSize, GFP_ATOMIC);
- if (pMsgBlock == NULL) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_ENTRY,
-@@ -1928,12 +3112,12 @@ SK_U64 PhysAddr; /* physical address of
- pRxd = pRxPort->pRxdRingTail;
- pRxPort->pRxdRingTail = pRxd->pNextRxd;
- pRxPort->RxdRingFree--;
-- Length = pAC->RxBufSize;
-+ Length = pRxPort->RxBufSize;
- PhysAddr = (SK_U64) pci_map_page(pAC->PciDev,
- virt_to_page(pMsgBlock->data),
- ((unsigned long) pMsgBlock->data &
- ~PAGE_MASK),
-- pAC->RxBufSize - 2,
-+ pRxPort->RxBufSize - 2,
- PCI_DMA_FROMDEVICE);
-
- pRxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff);
-@@ -1973,7 +3157,7 @@ SK_U16 Length; /* data fragment length
- pRxd = pRxPort->pRxdRingTail;
- pRxPort->pRxdRingTail = pRxd->pNextRxd;
- pRxPort->RxdRingFree--;
-- Length = pAC->RxBufSize;
-+ Length = pRxPort->RxBufSize;
-
- pRxd->VDataLow = PhysLow;
- pRxd->VDataHigh = PhysHigh;
-@@ -1998,33 +3182,40 @@ SK_U16 Length; /* data fragment length
- * Returns: N/A
- */
- static void ReceiveIrq(
-- SK_AC *pAC, /* pointer to adapter context */
-- RX_PORT *pRxPort, /* pointer to receive port struct */
-- SK_BOOL SlowPathLock) /* indicates if SlowPathLock is needed */
--{
--RXD *pRxd; /* pointer to receive descriptors */
--SK_U32 Control; /* control field of descriptor */
--struct sk_buff *pMsg; /* pointer to message holding frame */
--struct sk_buff *pNewMsg; /* pointer to a new message for copying frame */
--int FrameLength; /* total length of received frame */
--int IpFrameLength;
--SK_MBUF *pRlmtMbuf; /* ptr to a buffer for giving a frame to rlmt */
--SK_EVPARA EvPara; /* an event parameter union */
--unsigned long Flags; /* for spin lock */
--int PortIndex = pRxPort->PortIndex;
--unsigned int Offset;
--unsigned int NumBytes;
--unsigned int ForRlmt;
--SK_BOOL IsBc;
--SK_BOOL IsMc;
--SK_BOOL IsBadFrame; /* Bad frame */
--
--SK_U32 FrameStat;
--unsigned short Csum1;
--unsigned short Csum2;
--unsigned short Type;
--int Result;
--SK_U64 PhysAddr;
-+#ifdef CONFIG_SK98LIN_NAPI
-+SK_AC *pAC, /* pointer to adapter context */
-+RX_PORT *pRxPort, /* pointer to receive port struct */
-+SK_BOOL SlowPathLock, /* indicates if SlowPathLock is needed */
-+int *WorkDone,
-+int WorkToDo)
-+#else
-+SK_AC *pAC, /* pointer to adapter context */
-+RX_PORT *pRxPort, /* pointer to receive port struct */
-+SK_BOOL SlowPathLock) /* indicates if SlowPathLock is needed */
-+#endif
-+{
-+ RXD *pRxd; /* pointer to receive descriptors */
-+ struct sk_buff *pMsg; /* pointer to message holding frame */
-+ struct sk_buff *pNewMsg; /* pointer to new message for frame copy */
-+ SK_MBUF *pRlmtMbuf; /* ptr to buffer for giving frame to RLMT */
-+ SK_EVPARA EvPara; /* an event parameter union */
-+ SK_U32 Control; /* control field of descriptor */
-+ unsigned long Flags; /* for spin lock handling */
-+ int PortIndex = pRxPort->PortIndex;
-+ int FrameLength; /* total length of received frame */
-+ int IpFrameLength; /* IP length of the received frame */
-+ unsigned int Offset;
-+ unsigned int NumBytes;
-+ unsigned int RlmtNotifier;
-+ SK_BOOL IsBc; /* we received a broadcast packet */
-+ SK_BOOL IsMc; /* we received a multicast packet */
-+ SK_BOOL IsBadFrame; /* the frame received is bad! */
-+ SK_U32 FrameStat;
-+ unsigned short Csum1;
-+ unsigned short Csum2;
-+ unsigned short Type;
-+ int Result;
-+ SK_U64 PhysAddr;
-
- rx_start:
- /* do forever; exit if BMU_OWN found */
-@@ -2046,6 +3237,13 @@ rx_start:
-
- Control = pRxd->RBControl;
-
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (*WorkDone >= WorkToDo) {
-+ break;
-+ }
-+ (*WorkDone)++;
-+#endif
-+
- /* check if this descriptor is ready */
- if ((Control & BMU_OWN) != 0) {
- /* this descriptor is not yet ready */
-@@ -2054,11 +3252,10 @@ rx_start:
- FillRxRing(pAC, pRxPort);
- return;
- }
-- pAC->DynIrqModInfo.NbrProcessedDescr++;
-
- /* get length of frame and check it */
- FrameLength = Control & BMU_BBC;
-- if (FrameLength > pAC->RxBufSize) {
-+ if (FrameLength > pRxPort->RxBufSize) {
- goto rx_failed;
- }
-
-@@ -2073,8 +3270,8 @@ rx_start:
- FrameStat = pRxd->FrameStat;
-
- /* check for frame length mismatch */
--#define XMR_FS_LEN_SHIFT 18
--#define GMR_FS_LEN_SHIFT 16
-+#define XMR_FS_LEN_SHIFT 18
-+#define GMR_FS_LEN_SHIFT 16
- if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
- if (FrameLength != (SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT)) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-@@ -2084,8 +3281,7 @@ rx_start:
- (SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT)));
- goto rx_failed;
- }
-- }
-- else {
-+ } else {
- if (FrameLength != (SK_U32) (FrameStat >> GMR_FS_LEN_SHIFT)) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_RX_PROGRESS,
-@@ -2118,9 +3314,6 @@ rx_start:
- /* DumpMsg(pMsg, "Rx"); */
-
- if ((Control & BMU_STAT_VAL) != BMU_STAT_VAL || (IsBadFrame)) {
--#if 0
-- (FrameStat & (XMR_FS_ANY_ERR | XMR_FS_2L_VLAN)) != 0) {
--#endif
- /* there is a receive error in this frame */
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
- SK_DBGCAT_DRV_RX_PROGRESS,
-@@ -2128,6 +3321,20 @@ rx_start:
- "Control: %x\nRxStat: %x\n",
- Control, FrameStat));
-
-+ PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32;
-+ PhysAddr |= (SK_U64) pRxd->VDataLow;
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
-+ pci_dma_sync_single(pAC->PciDev,
-+ (dma_addr_t) PhysAddr,
-+ FrameLength,
-+ PCI_DMA_FROMDEVICE);
-+#else
-+ pci_dma_sync_single_for_cpu(pAC->PciDev,
-+ (dma_addr_t) PhysAddr,
-+ FrameLength,
-+ PCI_DMA_FROMDEVICE);
-+#endif
- ReQueueRxBuffer(pAC, pRxPort, pMsg,
- pRxd->VDataHigh, pRxd->VDataLow);
-
-@@ -2147,150 +3354,107 @@ rx_start:
- skb_put(pNewMsg, FrameLength);
- PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32;
- PhysAddr |= (SK_U64) pRxd->VDataLow;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
-+ pci_dma_sync_single(pAC->PciDev,
-+ (dma_addr_t) PhysAddr,
-+ FrameLength,
-+ PCI_DMA_FROMDEVICE);
-+#else
-+ pci_dma_sync_single_for_device(pAC->PciDev,
-+ (dma_addr_t) PhysAddr,
-+ FrameLength,
-+ PCI_DMA_FROMDEVICE);
-+#endif
-
-- pci_dma_sync_single_for_cpu(pAC->PciDev,
-- (dma_addr_t) PhysAddr,
-- FrameLength,
-- PCI_DMA_FROMDEVICE);
- eth_copy_and_sum(pNewMsg, pMsg->data,
- FrameLength, 0);
-- pci_dma_sync_single_for_device(pAC->PciDev,
-- (dma_addr_t) PhysAddr,
-- FrameLength,
-- PCI_DMA_FROMDEVICE);
- ReQueueRxBuffer(pAC, pRxPort, pMsg,
- pRxd->VDataHigh, pRxd->VDataLow);
-
- pMsg = pNewMsg;
-
-- }
-- else {
-+ } else {
- /*
- * if large frame, or SKB allocation failed, pass
- * the SKB directly to the networking
- */
--
- PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32;
- PhysAddr |= (SK_U64) pRxd->VDataLow;
-
- /* release the DMA mapping */
- pci_unmap_single(pAC->PciDev,
- PhysAddr,
-- pAC->RxBufSize - 2,
-+ pRxPort->RxBufSize - 2,
- PCI_DMA_FROMDEVICE);
-+ skb_put(pMsg, FrameLength); /* set message len */
-+ pMsg->ip_summed = CHECKSUM_NONE; /* initial default */
-
-- /* set length in message */
-- skb_put(pMsg, FrameLength);
-- /* hardware checksum */
-- Type = ntohs(*((short*)&pMsg->data[12]));
--
--#ifdef USE_SK_RX_CHECKSUM
-- if (Type == 0x800) {
-- Csum1=le16_to_cpu(pRxd->TcpSums & 0xffff);
-- Csum2=le16_to_cpu((pRxd->TcpSums >> 16) & 0xffff);
-- IpFrameLength = (int) ntohs((unsigned short)
-- ((unsigned short *) pMsg->data)[8]);
--
-- /*
-- * Test: If frame is padded, a check is not possible!
-- * Frame not padded? Length difference must be 14 (0xe)!
-- */
-- if ((FrameLength - IpFrameLength) != 0xe) {
-- /* Frame padded => TCP offload not possible! */
-- pMsg->ip_summed = CHECKSUM_NONE;
-- } else {
-- /* Frame not padded => TCP offload! */
-- if ((((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) &&
-- (pAC->GIni.GIChipId == CHIP_ID_GENESIS)) ||
-- (pAC->ChipsetType)) {
-- Result = SkCsGetReceiveInfo(pAC,
-- &pMsg->data[14],
-- Csum1, Csum2, pRxPort->PortIndex);
-- if (Result ==
-- SKCS_STATUS_IP_FRAGMENT ||
-- Result ==
-- SKCS_STATUS_IP_CSUM_OK ||
-- Result ==
-- SKCS_STATUS_TCP_CSUM_OK ||
-- Result ==
-- SKCS_STATUS_UDP_CSUM_OK) {
-- pMsg->ip_summed =
-- CHECKSUM_UNNECESSARY;
-- }
-- else if (Result ==
-- SKCS_STATUS_TCP_CSUM_ERROR ||
-- Result ==
-- SKCS_STATUS_UDP_CSUM_ERROR ||
-- Result ==
-- SKCS_STATUS_IP_CSUM_ERROR_UDP ||
-- Result ==
-- SKCS_STATUS_IP_CSUM_ERROR_TCP ||
-- Result ==
-- SKCS_STATUS_IP_CSUM_ERROR ) {
-- /* HW Checksum error */
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-- SK_DBGCAT_DRV_RX_PROGRESS,
-- ("skge: CRC error. Frame dropped!\n"));
-- goto rx_failed;
-- } else {
-- pMsg->ip_summed =
-- CHECKSUM_NONE;
-- }
-- }/* checksumControl calculation valid */
-- } /* Frame length check */
-- } /* IP frame */
--#else
-- pMsg->ip_summed = CHECKSUM_NONE;
--#endif
-+ if (pRxPort->UseRxCsum) {
-+ Type = ntohs(*((short*)&pMsg->data[12]));
-+ if (Type == 0x800) {
-+ IpFrameLength = (int) ntohs((unsigned short)
-+ ((unsigned short *) pMsg->data)[8]);
-+ if ((FrameLength - IpFrameLength) == 0xe) {
-+ Csum1=le16_to_cpu(pRxd->TcpSums & 0xffff);
-+ Csum2=le16_to_cpu((pRxd->TcpSums >> 16) & 0xffff);
-+ if ((((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) &&
-+ (pAC->GIni.GIChipId == CHIP_ID_GENESIS)) ||
-+ (pAC->ChipsetType)) {
-+ Result = SkCsGetReceiveInfo(pAC, &pMsg->data[14],
-+ Csum1, Csum2, PortIndex);
-+ if ((Result == SKCS_STATUS_IP_FRAGMENT) ||
-+ (Result == SKCS_STATUS_IP_CSUM_OK) ||
-+ (Result == SKCS_STATUS_TCP_CSUM_OK) ||
-+ (Result == SKCS_STATUS_UDP_CSUM_OK)) {
-+ pMsg->ip_summed = CHECKSUM_UNNECESSARY;
-+ } else if ((Result == SKCS_STATUS_TCP_CSUM_ERROR) ||
-+ (Result == SKCS_STATUS_UDP_CSUM_ERROR) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR_UDP) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR_TCP) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR)) {
-+ /* HW Checksum error */
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("skge: CRC error. Frame dropped!\n"));
-+ goto rx_failed;
-+ } else {
-+ pMsg->ip_summed = CHECKSUM_NONE;
-+ }
-+ }/* checksumControl calculation valid */
-+ } /* Frame length check */
-+ } /* IP frame */
-+ } /* pRxPort->UseRxCsum */
- } /* frame > SK_COPY_TRESHOLD */
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V"));
-- ForRlmt = SK_RLMT_RX_PROTOCOL;
--#if 0
-- IsBc = (FrameStat & XMR_FS_BC)==XMR_FS_BC;
--#endif
-+ RlmtNotifier = SK_RLMT_RX_PROTOCOL;
- SK_RLMT_PRE_LOOKAHEAD(pAC, PortIndex, FrameLength,
-- IsBc, &Offset, &NumBytes);
-+ IsBc, &Offset, &NumBytes);
- if (NumBytes != 0) {
--#if 0
-- IsMc = (FrameStat & XMR_FS_MC)==XMR_FS_MC;
--#endif
-- SK_RLMT_LOOKAHEAD(pAC, PortIndex,
-- &pMsg->data[Offset],
-- IsBc, IsMc, &ForRlmt);
-+ SK_RLMT_LOOKAHEAD(pAC,PortIndex,&pMsg->data[Offset],
-+ IsBc,IsMc,&RlmtNotifier);
- }
-- if (ForRlmt == SK_RLMT_RX_PROTOCOL) {
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("W"));
-+ if (RlmtNotifier == SK_RLMT_RX_PROTOCOL) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("W"));
- /* send up only frames from active port */
-- if ((PortIndex == pAC->ActivePort) ||
-- (pAC->RlmtNets == 2)) {
-- /* frame for upper layer */
-+ if ((PortIndex == pAC->ActivePort)||(pAC->RlmtNets == 2)) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("U"));
- #ifdef xDEBUG
- DumpMsg(pMsg, "Rx");
- #endif
-- SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,
-- FrameLength, pRxPort->PortIndex);
--
-- pMsg->dev = pAC->dev[pRxPort->PortIndex];
-- pMsg->protocol = eth_type_trans(pMsg,
-- pAC->dev[pRxPort->PortIndex]);
-- netif_rx(pMsg);
-- pAC->dev[pRxPort->PortIndex]->last_rx = jiffies;
-- }
-- else {
-- /* drop frame */
-+ SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,FrameLength,PortIndex);
-+ pMsg->dev = pAC->dev[PortIndex];
-+ pMsg->protocol = eth_type_trans(pMsg,pAC->dev[PortIndex]);
-+ netif_rx(pMsg); /* frame for upper layer */
-+ pAC->dev[PortIndex]->last_rx = jiffies;
-+ } else {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-- SK_DBGCAT_DRV_RX_PROGRESS,
-- ("D"));
-- DEV_KFREE_SKB(pMsg);
-+ SK_DBGCAT_DRV_RX_PROGRESS,("D"));
-+ DEV_KFREE_SKB(pMsg); /* drop frame */
- }
--
-- } /* if not for rlmt */
-- else {
-- /* packet for rlmt */
-+ } else { /* packet for RLMT stack */
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-- SK_DBGCAT_DRV_RX_PROGRESS, ("R"));
-+ SK_DBGCAT_DRV_RX_PROGRESS,("R"));
- pRlmtMbuf = SkDrvAllocRlmtMbuf(pAC,
- pAC->IoBase, FrameLength);
- if (pRlmtMbuf != NULL) {
-@@ -2318,32 +3482,22 @@ rx_start:
- }
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-- SK_DBGCAT_DRV_RX_PROGRESS,
-- ("Q"));
-+ SK_DBGCAT_DRV_RX_PROGRESS,("Q"));
- }
-- if ((pAC->dev[pRxPort->PortIndex]->flags &
-- (IFF_PROMISC | IFF_ALLMULTI)) != 0 ||
-- (ForRlmt & SK_RLMT_RX_PROTOCOL) ==
-- SK_RLMT_RX_PROTOCOL) {
-- pMsg->dev = pAC->dev[pRxPort->PortIndex];
-- pMsg->protocol = eth_type_trans(pMsg,
-- pAC->dev[pRxPort->PortIndex]);
-+ if ((pAC->dev[PortIndex]->flags & (IFF_PROMISC | IFF_ALLMULTI)) ||
-+ (RlmtNotifier & SK_RLMT_RX_PROTOCOL)) {
-+ pMsg->dev = pAC->dev[PortIndex];
-+ pMsg->protocol = eth_type_trans(pMsg,pAC->dev[PortIndex]);
- netif_rx(pMsg);
-- pAC->dev[pRxPort->PortIndex]->last_rx = jiffies;
-- }
-- else {
-+ pAC->dev[PortIndex]->last_rx = jiffies;
-+ } else {
- DEV_KFREE_SKB(pMsg);
- }
--
-- } /* if packet for rlmt */
-+ } /* if packet for RLMT stack */
- } /* for ... scanning the RXD ring */
-
- /* RXD ring is empty -> fill and restart */
- FillRxRing(pAC, pRxPort);
-- /* do not start if called from Close */
-- if (pAC->BoardLevel > SK_INIT_DATA) {
-- ClearAndStartRx(pAC, PortIndex);
-- }
- return;
-
- rx_failed:
-@@ -2357,7 +3511,7 @@ rx_failed:
- PhysAddr |= (SK_U64) pRxd->VDataLow;
- pci_unmap_page(pAC->PciDev,
- PhysAddr,
-- pAC->RxBufSize - 2,
-+ pRxPort->RxBufSize - 2,
- PCI_DMA_FROMDEVICE);
- DEV_KFREE_SKB_IRQ(pRxd->pMBuf);
- pRxd->pMBuf = NULL;
-@@ -2367,49 +3521,6 @@ rx_failed:
-
- } /* ReceiveIrq */
-
--
--/*****************************************************************************
-- *
-- * ClearAndStartRx - give a start receive command to BMU, clear IRQ
-- *
-- * Description:
-- * This function sends a start command and a clear interrupt
-- * command for one receive queue to the BMU.
-- *
-- * Returns: N/A
-- * none
-- */
--static void ClearAndStartRx(
--SK_AC *pAC, /* pointer to the adapter context */
--int PortIndex) /* index of the receive port (XMAC) */
--{
-- SK_OUT8(pAC->IoBase,
-- RxQueueAddr[PortIndex]+Q_CSR,
-- CSR_START | CSR_IRQ_CL_F);
--} /* ClearAndStartRx */
--
--
--/*****************************************************************************
-- *
-- * ClearTxIrq - give a clear transmit IRQ command to BMU
-- *
-- * Description:
-- * This function sends a clear tx IRQ command for one
-- * transmit queue to the BMU.
-- *
-- * Returns: N/A
-- */
--static void ClearTxIrq(
--SK_AC *pAC, /* pointer to the adapter context */
--int PortIndex, /* index of the transmit port (XMAC) */
--int Prio) /* priority or normal queue */
--{
-- SK_OUT8(pAC->IoBase,
-- TxQueueAddr[PortIndex][Prio]+Q_CSR,
-- CSR_IRQ_CL_F);
--} /* ClearTxIrq */
--
--
- /*****************************************************************************
- *
- * ClearRxRing - remove all buffers from the receive ring
-@@ -2440,7 +3551,7 @@ SK_U64 PhysAddr;
- PhysAddr |= (SK_U64) pRxd->VDataLow;
- pci_unmap_page(pAC->PciDev,
- PhysAddr,
-- pAC->RxBufSize - 2,
-+ pRxPort->RxBufSize - 2,
- PCI_DMA_FROMDEVICE);
- DEV_KFREE_SKB(pRxd->pMBuf);
- pRxd->pMBuf = NULL;
-@@ -2500,29 +3611,30 @@ static int SkGeSetMacAddr(struct SK_NET_
-
- DEV_NET *pNet = (DEV_NET*) dev->priv;
- SK_AC *pAC = pNet->pAC;
-+int Ret;
-
- struct sockaddr *addr = p;
- unsigned long Flags;
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeSetMacAddr starts now...\n"));
-- if(netif_running(dev))
-- return -EBUSY;
-
- memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
-
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-
- if (pAC->RlmtNets == 2)
-- SkAddrOverride(pAC, pAC->IoBase, pNet->NetNr,
-+ Ret = SkAddrOverride(pAC, pAC->IoBase, pNet->NetNr,
- (SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS);
- else
-- SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort,
-+ Ret = SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort,
- (SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS);
--
--
-
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+
-+ if (Ret != SK_ADDR_OVERRIDE_SUCCESS)
-+ return -EBUSY;
-+
- return 0;
- } /* SkGeSetMacAddr */
-
-@@ -2604,6 +3716,45 @@ unsigned long Flags;
-
- /*****************************************************************************
- *
-+ * SkSetMtuBufferSize - set the MTU buffer to another value
-+ *
-+ * Description:
-+ * This function sets the new buffers and is called whenever the MTU
-+ * size is changed
-+ *
-+ * Returns:
-+ * N/A
-+ */
-+
-+static void SkSetMtuBufferSize(
-+SK_AC *pAC, /* pointer to adapter context */
-+int PortNr, /* Port number */
-+int Mtu) /* pointer to tx prt struct */
-+{
-+ pAC->RxPort[PortNr].RxBufSize = Mtu + 32;
-+
-+ /* RxBufSize must be a multiple of 8 */
-+ while (pAC->RxPort[PortNr].RxBufSize % 8) {
-+ pAC->RxPort[PortNr].RxBufSize =
-+ pAC->RxPort[PortNr].RxBufSize + 1;
-+ }
-+
-+ if (Mtu > 1500) {
-+ pAC->GIni.GP[PortNr].PPortUsage = SK_JUMBO_LINK;
-+ } else {
-+ if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-+ pAC->GIni.GP[PortNr].PPortUsage = SK_MUL_LINK;
-+ } else {
-+ pAC->GIni.GP[PortNr].PPortUsage = SK_RED_LINK;
-+ }
-+ }
-+
-+ return;
-+}
-+
-+
-+/*****************************************************************************
-+ *
- * SkGeChangeMtu - set the MTU to another value
- *
- * Description:
-@@ -2617,12 +3768,13 @@ unsigned long Flags;
- */
- static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu)
- {
--DEV_NET *pNet;
--DEV_NET *pOtherNet;
--SK_AC *pAC;
--unsigned long Flags;
--int i;
--SK_EVPARA EvPara;
-+DEV_NET *pNet;
-+SK_AC *pAC;
-+unsigned long Flags;
-+#ifdef CONFIG_SK98LIN_NAPI
-+int WorkToDo = 1; // min(*budget, dev->quota);
-+int WorkDone = 0;
-+#endif
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeChangeMtu starts now...\n"));
-@@ -2630,15 +3782,18 @@ SK_EVPARA EvPara;
- pNet = (DEV_NET*) dev->priv;
- pAC = pNet->pAC;
-
-+ /* MTU size outside the spec */
- if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) {
- return -EINVAL;
- }
-
-- if(pAC->BoardLevel != SK_INIT_RUN) {
-+ /* MTU > 1500 on yukon ulra not allowed */
-+ if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U)
-+ && (NewMtu > 1500)){
- return -EINVAL;
- }
-
--#ifdef SK_DIAG_SUPPORT
-+ /* Diag access active */
- if (pAC->DiagModeActive == DIAG_ACTIVE) {
- if (pAC->DiagFlowCtrl == SK_FALSE) {
- return -1; /* still in use, deny any actions of MTU */
-@@ -2646,200 +3801,74 @@ SK_EVPARA EvPara;
- pAC->DiagFlowCtrl = SK_FALSE;
- }
- }
--#endif
--
-- pNet->Mtu = NewMtu;
-- pOtherNet = (DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv;
-- if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) {
-- return(0);
-- }
-
-- pAC->RxBufSize = NewMtu + 32;
- dev->mtu = NewMtu;
-+ SkSetMtuBufferSize(pAC, pNet->PortNr, NewMtu);
-
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
-- ("New MTU: %d\n", NewMtu));
-+ if(!netif_running(dev)) {
-+ /* Preset MTU size if device not ready/running */
-+ return 0;
-+ }
-
-- /*
-- ** Prevent any reconfiguration while changing the MTU
-- ** by disabling any interrupts
-- */
-+ /* Prevent any reconfiguration while changing the MTU
-+ by disabling any interrupts */
- SK_OUT32(pAC->IoBase, B0_IMSK, 0);
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-
-- /*
-- ** Notify RLMT that any ports are to be stopped
-- */
-- EvPara.Para32[0] = 0;
-- EvPara.Para32[1] = -1;
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- EvPara.Para32[0] = 1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- } else {
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- }
--
-- /*
-- ** After calling the SkEventDispatcher(), RLMT is aware about
-- ** the stopped ports -> configuration can take place!
-- */
-- SkEventDispatcher(pAC, pAC->IoBase);
--
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- spin_lock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock);
-- netif_stop_queue(pAC->dev[i]);
-+ /* Notify RLMT that the port has to be stopped */
-+ netif_stop_queue(dev);
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP,
-+ pNet->PortNr, -1, SK_TRUE);
-+ spin_lock(&pAC->TxPort[pNet->PortNr][TX_PRIO_LOW].TxDesRingLock);
-
-- }
-
-- /*
-- ** Depending on the desired MTU size change, a different number of
-- ** RX buffers need to be allocated
-- */
-- if (NewMtu > 1500) {
-- /*
-- ** Use less rx buffers
-- */
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing -
-- (pAC->RxDescrPerRing / 4);
-- } else {
-- if (i == pAC->ActivePort) {
-- pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing -
-- (pAC->RxDescrPerRing / 4);
-- } else {
-- pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing -
-- (pAC->RxDescrPerRing / 10);
-- }
-- }
-- }
-+ /* Change RxFillLimit to 1 */
-+ if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-+ pAC->RxPort[pNet->PortNr].RxFillLimit = 1;
- } else {
-- /*
-- ** Use the normal amount of rx buffers
-- */
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- pAC->RxPort[i].RxFillLimit = 1;
-- } else {
-- if (i == pAC->ActivePort) {
-- pAC->RxPort[i].RxFillLimit = 1;
-- } else {
-- pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing -
-- (pAC->RxDescrPerRing / 4);
-- }
-- }
-- }
-+ pAC->RxPort[1 - pNet->PortNr].RxFillLimit = 1;
-+ pAC->RxPort[pNet->PortNr].RxFillLimit = pAC->RxDescrPerRing -
-+ (pAC->RxDescrPerRing / 4);
- }
--
-- SkGeDeInit(pAC, pAC->IoBase);
-
-- /*
-- ** enable/disable hardware support for long frames
-- */
-- if (NewMtu > 1500) {
--// pAC->JumboActivated = SK_TRUE; /* is never set back !!! */
-- pAC->GIni.GIPortUsage = SK_JUMBO_LINK;
-+ /* clear and reinit the rx rings here, because of new MTU size */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStop(pAC, pAC->IoBase, pNet->PortNr, SK_STOP_ALL, SK_SOFT_RST);
-+ SkY2AllocateRxBuffers(pAC, pAC->IoBase, pNet->PortNr);
-+ SkY2PortStart(pAC, pAC->IoBase, pNet->PortNr);
- } else {
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- pAC->GIni.GIPortUsage = SK_MUL_LINK;
-- } else {
-- pAC->GIni.GIPortUsage = SK_RED_LINK;
-- }
-- }
-+// SkGeStopPort(pAC, pAC->IoBase, pNet->PortNr, SK_STOP_ALL, SK_SOFT_RST);
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE, &WorkDone, WorkToDo);
-+#else
-+ ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE);
-+#endif
-+ ClearRxRing(pAC, &pAC->RxPort[pNet->PortNr]);
-+ FillRxRing(pAC, &pAC->RxPort[pNet->PortNr]);
-
-- SkGeInit( pAC, pAC->IoBase, SK_INIT_IO);
-- SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO);
-- SkEventInit(pAC, pAC->IoBase, SK_INIT_IO);
-- SkPnmiInit( pAC, pAC->IoBase, SK_INIT_IO);
-- SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO);
-- SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO);
-- SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO);
--
-- /*
-- ** tschilling:
-- ** Speed and others are set back to default in level 1 init!
-- */
-- GetConfiguration(pAC);
--
-- SkGeInit( pAC, pAC->IoBase, SK_INIT_RUN);
-- SkI2cInit( pAC, pAC->IoBase, SK_INIT_RUN);
-- SkEventInit(pAC, pAC->IoBase, SK_INIT_RUN);
-- SkPnmiInit( pAC, pAC->IoBase, SK_INIT_RUN);
-- SkAddrInit( pAC, pAC->IoBase, SK_INIT_RUN);
-- SkRlmtInit( pAC, pAC->IoBase, SK_INIT_RUN);
-- SkTimerInit(pAC, pAC->IoBase, SK_INIT_RUN);
-+ /* Enable transmit descriptor polling */
-+ SkGePollTxD(pAC, pAC->IoBase, pNet->PortNr, SK_TRUE);
-+ FillRxRing(pAC, &pAC->RxPort[pNet->PortNr]);
-+ }
-
-- /*
-- ** clear and reinit the rx rings here
-- */
-- for (i=0; i<pAC->GIni.GIMacsFound; i++) {
-- ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE);
-- ClearRxRing(pAC, &pAC->RxPort[i]);
-- FillRxRing(pAC, &pAC->RxPort[i]);
-+ netif_start_queue(pAC->dev[pNet->PortNr]);
-
-- /*
-- ** Enable transmit descriptor polling
-- */
-- SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE);
-- FillRxRing(pAC, &pAC->RxPort[i]);
-- };
-+ spin_unlock(&pAC->TxPort[pNet->PortNr][TX_PRIO_LOW].TxDesRingLock);
-
-- SkGeYellowLED(pAC, pAC->IoBase, 1);
-- SkDimEnableModerationIfNeeded(pAC);
-- SkDimDisplayModerationSettings(pAC);
-
-- netif_start_queue(pAC->dev[pNet->PortNr]);
-- for (i=pAC->GIni.GIMacsFound-1; i>=0; i--) {
-- spin_unlock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock);
-- }
-+ /* Notify RLMT about the changing and restarting one (or more) ports */
-+ SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START,
-+ pNet->PortNr, -1, SK_TRUE);
-
-- /*
-- ** Enable Interrupts again
-- */
-+ /* Enable Interrupts again */
- SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
- SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK);
-
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
-- SkEventDispatcher(pAC, pAC->IoBase);
--
-- /*
-- ** Notify RLMT about the changing and restarting one (or more) ports
-- */
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- EvPara.Para32[0] = pAC->RlmtNets;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, EvPara);
-- EvPara.Para32[0] = pNet->PortNr;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
--
-- if (pOtherNet->Up) {
-- EvPara.Para32[0] = pOtherNet->PortNr;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
-- }
-- } else {
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
-- }
--
-- SkEventDispatcher(pAC, pAC->IoBase);
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
--
-- /*
-- ** While testing this driver with latest kernel 2.5 (2.5.70), it
-- ** seems as if upper layers have a problem to handle a successful
-- ** return value of '0'. If such a zero is returned, the complete
-- ** system hangs for several minutes (!), which is in acceptable.
-- **
-- ** Currently it is not clear, what the exact reason for this problem
-- ** is. The implemented workaround for 2.5 is to return the desired
-- ** new MTU size if all needed changes for the new MTU size where
-- ** performed. In kernels 2.2 and 2.4, a zero value is returned,
-- ** which indicates the successful change of the mtu-size.
-- */
-- return NewMtu;
-+ return 0;
-
--} /* SkGeChangeMtu */
-+}
-
-
- /*****************************************************************************
-@@ -2855,75 +3884,67 @@ SK_EVPARA EvPara;
- */
- static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev)
- {
--DEV_NET *pNet = (DEV_NET*) dev->priv;
--SK_AC *pAC = pNet->pAC;
--SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */
--SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */
--SK_PNMI_CONF *pPnmiConf; /* pointer to virtual link config. */
--unsigned int Size; /* size of pnmi struct */
--unsigned long Flags; /* for spin lock */
--
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
-- ("SkGeStats starts now...\n"));
-- pPnmiStruct = &pAC->PnmiStruct;
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ unsigned long LateCollisions, ExcessiveCollisions, RxTooLong;
-+ unsigned long Flags; /* for spin lock */
-+ SK_U32 MaxNumOidEntries, Oid, Len;
-+ char Buf[8];
-+ struct {
-+ SK_U32 Oid;
-+ unsigned long *pVar;
-+ } Vars[] = {
-+ { OID_SKGE_STAT_TX_LATE_COL, &LateCollisions },
-+ { OID_SKGE_STAT_TX_EXCESS_COL, &ExcessiveCollisions },
-+ { OID_SKGE_STAT_RX_TOO_LONG, &RxTooLong },
-+ { OID_SKGE_STAT_RX, &pAC->stats.rx_packets },
-+ { OID_SKGE_STAT_TX, &pAC->stats.tx_packets },
-+ { OID_SKGE_STAT_RX_OCTETS, &pAC->stats.rx_bytes },
-+ { OID_SKGE_STAT_TX_OCTETS, &pAC->stats.tx_bytes },
-+ { OID_SKGE_RX_NO_BUF_CTS, &pAC->stats.rx_dropped },
-+ { OID_SKGE_TX_NO_BUF_CTS, &pAC->stats.tx_dropped },
-+ { OID_SKGE_STAT_RX_MULTICAST, &pAC->stats.multicast },
-+ { OID_SKGE_STAT_RX_RUNT, &pAC->stats.rx_length_errors },
-+ { OID_SKGE_STAT_RX_FCS, &pAC->stats.rx_crc_errors },
-+ { OID_SKGE_STAT_RX_FRAMING, &pAC->stats.rx_frame_errors },
-+ { OID_SKGE_STAT_RX_OVERFLOW, &pAC->stats.rx_over_errors },
-+ { OID_SKGE_STAT_RX_MISSED, &pAC->stats.rx_missed_errors },
-+ { OID_SKGE_STAT_TX_CARRIER, &pAC->stats.tx_carrier_errors },
-+ { OID_SKGE_STAT_TX_UNDERRUN, &pAC->stats.tx_fifo_errors },
-+ };
-+
-+ if ((pAC->DiagModeActive == DIAG_NOTACTIVE) &&
-+ (pAC->BoardLevel == SK_INIT_RUN)) {
-+ memset(&pAC->stats, 0x00, sizeof(pAC->stats)); /* clean first */
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-
--#ifdef SK_DIAG_SUPPORT
-- if ((pAC->DiagModeActive == DIAG_NOTACTIVE) &&
-- (pAC->BoardLevel == SK_INIT_RUN)) {
--#endif
-- SK_MEMSET(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA));
-- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-- Size = SK_PNMI_STRUCT_SIZE;
-- SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr);
-- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
--#ifdef SK_DIAG_SUPPORT
-- }
--#endif
-+ MaxNumOidEntries = sizeof(Vars) / sizeof(Vars[0]);
-+ for (Oid = 0; Oid < MaxNumOidEntries; Oid++) {
-+ if (SkPnmiGetVar(pAC,pAC->IoBase, Vars[Oid].Oid,
-+ &Buf, &Len, 1, pNet->NetNr) != SK_PNMI_ERR_OK) {
-+ memset(Buf, 0x00, sizeof(Buf));
-+ }
-+ *Vars[Oid].pVar = (unsigned long) (*((SK_U64 *) Buf));
-+ }
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-
-- pPnmiStat = &pPnmiStruct->Stat[0];
-- pPnmiConf = &pPnmiStruct->Conf[0];
-+ pAC->stats.collisions = LateCollisions + ExcessiveCollisions;
-+ pAC->stats.tx_errors = pAC->stats.tx_carrier_errors +
-+ pAC->stats.tx_fifo_errors;
-+ pAC->stats.rx_errors = pAC->stats.rx_length_errors +
-+ pAC->stats.rx_crc_errors +
-+ pAC->stats.rx_frame_errors +
-+ pAC->stats.rx_over_errors +
-+ pAC->stats.rx_missed_errors;
-
-- pAC->stats.rx_packets = (SK_U32) pPnmiStruct->RxDeliveredCts & 0xFFFFFFFF;
-- pAC->stats.tx_packets = (SK_U32) pPnmiStat->StatTxOkCts & 0xFFFFFFFF;
-- pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts;
-- pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts;
--
-- if (pNet->Mtu <= 1500) {
-- pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF;
-- } else {
-- pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts -
-- pPnmiStat->StatRxTooLongCts) & 0xFFFFFFFF);
-+ if (dev->mtu > 1500) {
-+ pAC->stats.rx_errors = pAC->stats.rx_errors - RxTooLong;
-+ }
- }
-
--
-- if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && pAC->HWRevision < 12)
-- pAC->stats.rx_errors = pAC->stats.rx_errors - pPnmiStat->StatRxShortsCts;
--
-- pAC->stats.tx_errors = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF;
-- pAC->stats.rx_dropped = (SK_U32) pPnmiStruct->RxNoBufCts & 0xFFFFFFFF;
-- pAC->stats.tx_dropped = (SK_U32) pPnmiStruct->TxNoBufCts & 0xFFFFFFFF;
-- pAC->stats.multicast = (SK_U32) pPnmiStat->StatRxMulticastOkCts & 0xFFFFFFFF;
-- pAC->stats.collisions = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF;
--
-- /* detailed rx_errors: */
-- pAC->stats.rx_length_errors = (SK_U32) pPnmiStat->StatRxRuntCts & 0xFFFFFFFF;
-- pAC->stats.rx_over_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF;
-- pAC->stats.rx_crc_errors = (SK_U32) pPnmiStat->StatRxFcsCts & 0xFFFFFFFF;
-- pAC->stats.rx_frame_errors = (SK_U32) pPnmiStat->StatRxFramingCts & 0xFFFFFFFF;
-- pAC->stats.rx_fifo_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF;
-- pAC->stats.rx_missed_errors = (SK_U32) pPnmiStat->StatRxMissedCts & 0xFFFFFFFF;
--
-- /* detailed tx_errors */
-- pAC->stats.tx_aborted_errors = (SK_U32) 0;
-- pAC->stats.tx_carrier_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF;
-- pAC->stats.tx_fifo_errors = (SK_U32) pPnmiStat->StatTxFifoUnderrunCts & 0xFFFFFFFF;
-- pAC->stats.tx_heartbeat_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF;
-- pAC->stats.tx_window_errors = (SK_U32) 0;
--
- return(&pAC->stats);
- } /* SkGeStats */
-
--
- /*****************************************************************************
- *
- * SkGeIoctl - IO-control function
-@@ -2937,32 +3958,35 @@ unsigned long Flags; /* for spin lock
- * 0, if everything is ok
- * !=0, on error
- */
--static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd)
--{
--DEV_NET *pNet;
--SK_AC *pAC;
--void *pMemBuf;
--struct pci_dev *pdev = NULL;
--SK_GE_IOCTL Ioctl;
--unsigned int Err = 0;
--int Size = 0;
--int Ret = 0;
--unsigned int Length = 0;
--int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32);
-+static int SkGeIoctl(
-+struct SK_NET_DEVICE *dev, /* the device the IOCTL is to be performed on */
-+struct ifreq *rq, /* additional request structure containing data */
-+int cmd) /* requested IOCTL command number */
-+{
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ struct pci_dev *pdev = NULL;
-+ void *pMemBuf;
-+ SK_GE_IOCTL Ioctl;
-+ unsigned long Flags; /* for spin lock */
-+ unsigned int Err = 0;
-+ unsigned int Length = 0;
-+ int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32);
-+ int Size = 0;
-+ int Ret = 0;
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeIoctl starts now...\n"));
-
-- pNet = (DEV_NET*) dev->priv;
-- pAC = pNet->pAC;
--
- if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) {
- return -EFAULT;
- }
-
- switch(cmd) {
-- case SK_IOCTL_SETMIB:
-- case SK_IOCTL_PRESETMIB:
-+ case SIOCETHTOOL:
-+ return SkEthIoctl(dev, rq);
-+ case SK_IOCTL_SETMIB: /* FALL THRU */
-+ case SK_IOCTL_PRESETMIB: /* FALL THRU (if capable!) */
- if (!capable(CAP_NET_ADMIN)) return -EPERM;
- case SK_IOCTL_GETMIB:
- if(copy_from_user(&pAC->PnmiStruct, Ioctl.pData,
-@@ -2989,6 +4013,7 @@ int HeaderLength = sizeof(SK_U32) + siz
- if (NULL == (pMemBuf = kmalloc(Length, GFP_KERNEL))) {
- return -ENOMEM;
- }
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- if(copy_from_user(pMemBuf, Ioctl.pData, Length)) {
- Err = -EFAULT;
- goto fault_gen;
-@@ -3007,10 +4032,10 @@ int HeaderLength = sizeof(SK_U32) + siz
- goto fault_gen;
- }
- fault_gen:
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
- kfree(pMemBuf); /* cleanup everything */
- break;
--#ifdef SK_DIAG_SUPPORT
-- case SK_IOCTL_DIAG:
-+ case SK_IOCTL_DIAG:
- if (!capable(CAP_NET_ADMIN)) return -EPERM;
- if (Ioctl.Len < (sizeof(pAC->PnmiStruct) + HeaderLength)) {
- Length = Ioctl.Len;
-@@ -3034,7 +4059,7 @@ fault_gen:
- */
- * ((SK_U32 *)pMemBuf) = 0;
- * ((SK_U32 *)pMemBuf + 1) = pdev->bus->number;
-- * ((SK_U32 *)pMemBuf + 2) = ParseDeviceNbrFromSlotName(pdev->slot_name);
-+ * ((SK_U32 *)pMemBuf + 2) = ParseDeviceNbrFromSlotName(pci_name(pdev));
- if(copy_to_user(Ioctl.pData, pMemBuf, Length) ) {
- Err = -EFAULT;
- goto fault_diag;
-@@ -3047,7 +4072,6 @@ fault_gen:
- fault_diag:
- kfree(pMemBuf); /* cleanup everything */
- break;
--#endif
- default:
- Err = -EOPNOTSUPP;
- }
-@@ -3079,12 +4103,12 @@ DEV_NET *pNet, /* pointer to the adapte
- unsigned int Size, /* length of ioctl data */
- int mode) /* flag for set/preset */
- {
--unsigned long Flags; /* for spin lock */
--SK_AC *pAC;
-+ SK_AC *pAC = pNet->pAC;
-+ unsigned long Flags; /* for spin lock */
-
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
- ("SkGeIocMib starts now...\n"));
-- pAC = pNet->pAC;
-+
- /* access MIB */
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- switch(mode) {
-@@ -3127,17 +4151,18 @@ SK_AC *pAC) /* pointer to the adapter co
- SK_I32 Port; /* preferred port */
- SK_BOOL AutoSet;
- SK_BOOL DupSet;
--int LinkSpeed = SK_LSPEED_AUTO; /* Link speed */
--int AutoNeg = 1; /* autoneg off (0) or on (1) */
--int DuplexCap = 0; /* 0=both,1=full,2=half */
--int FlowCtrl = SK_FLOW_MODE_SYM_OR_REM; /* FlowControl */
--int MSMode = SK_MS_MODE_AUTO; /* master/slave mode */
--
--SK_BOOL IsConTypeDefined = SK_TRUE;
--SK_BOOL IsLinkSpeedDefined = SK_TRUE;
--SK_BOOL IsFlowCtrlDefined = SK_TRUE;
--SK_BOOL IsRoleDefined = SK_TRUE;
--SK_BOOL IsModeDefined = SK_TRUE;
-+int LinkSpeed = SK_LSPEED_AUTO; /* Link speed */
-+int AutoNeg = 1; /* autoneg off (0) or on (1) */
-+int DuplexCap = 0; /* 0=both,1=full,2=half */
-+int FlowCtrl = SK_FLOW_MODE_SYM_OR_REM; /* FlowControl */
-+int MSMode = SK_MS_MODE_AUTO; /* master/slave mode */
-+int IrqModMaskOffset = 6; /* all ints moderated=default */
-+
-+SK_BOOL IsConTypeDefined = SK_TRUE;
-+SK_BOOL IsLinkSpeedDefined = SK_TRUE;
-+SK_BOOL IsFlowCtrlDefined = SK_TRUE;
-+SK_BOOL IsRoleDefined = SK_TRUE;
-+SK_BOOL IsModeDefined = SK_TRUE;
- /*
- * The two parameters AutoNeg. and DuplexCap. map to one configuration
- * parameter. The mapping is described by this table:
-@@ -3155,6 +4180,15 @@ int Capabilities[3][3] =
- {SK_LMODE_AUTOBOTH , SK_LMODE_AUTOFULL , SK_LMODE_AUTOHALF },
- {SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE} };
-
-+SK_U32 IrqModMask[7][2] =
-+ { { IRQ_MASK_RX_ONLY , Y2_DRIVER_IRQS },
-+ { IRQ_MASK_TX_ONLY , Y2_DRIVER_IRQS },
-+ { IRQ_MASK_SP_ONLY , Y2_SPECIAL_IRQS },
-+ { IRQ_MASK_SP_RX , Y2_IRQ_MASK },
-+ { IRQ_MASK_TX_RX , Y2_DRIVER_IRQS },
-+ { IRQ_MASK_SP_TX , Y2_IRQ_MASK },
-+ { IRQ_MASK_RX_TX_SP, Y2_IRQ_MASK } };
-+
- #define DC_BOTH 0
- #define DC_FULL 1
- #define DC_HALF 2
-@@ -3194,7 +4228,7 @@ int Capabilities[3][3] =
- **
- ** This ConType parameter is used for all ports of the adapter!
- */
-- if ( (ConType != NULL) &&
-+ if ( (ConType != NULL) &&
- (pAC->Index < SK_MAX_CARD_PARAM) &&
- (ConType[pAC->Index] != NULL) ) {
-
-@@ -3220,40 +4254,40 @@ int Capabilities[3][3] =
- M_CurrPort.PMSMode = SK_MS_MODE_AUTO;
- M_CurrPort.PLinkSpeed = SK_LSPEED_AUTO;
- }
-- } else if (strcmp(ConType[pAC->Index],"100FD")==0) {
-+ } else if (strcmp(ConType[pAC->Index],"100FD")==0) {
- for (Port = 0; Port < SK_MAX_MACS; Port++) {
- M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL];
- M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE;
- M_CurrPort.PMSMode = SK_MS_MODE_AUTO;
- M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS;
- }
-- } else if (strcmp(ConType[pAC->Index],"100HD")==0) {
-+ } else if (strcmp(ConType[pAC->Index],"100HD")==0) {
- for (Port = 0; Port < SK_MAX_MACS; Port++) {
- M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF];
- M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE;
- M_CurrPort.PMSMode = SK_MS_MODE_AUTO;
- M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS;
- }
-- } else if (strcmp(ConType[pAC->Index],"10FD")==0) {
-+ } else if (strcmp(ConType[pAC->Index],"10FD")==0) {
- for (Port = 0; Port < SK_MAX_MACS; Port++) {
- M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL];
- M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE;
- M_CurrPort.PMSMode = SK_MS_MODE_AUTO;
- M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS;
- }
-- } else if (strcmp(ConType[pAC->Index],"10HD")==0) {
-+ } else if (strcmp(ConType[pAC->Index],"10HD")==0) {
- for (Port = 0; Port < SK_MAX_MACS; Port++) {
- M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF];
- M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE;
- M_CurrPort.PMSMode = SK_MS_MODE_AUTO;
- M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS;
- }
-- } else {
-+ } else {
- printk("sk98lin: Illegal value \"%s\" for ConType\n",
- ConType[pAC->Index]);
- IsConTypeDefined = SK_FALSE; /* Wrong ConType defined */
- }
-- } else {
-+ } else {
- IsConTypeDefined = SK_FALSE; /* No ConType defined */
- }
-
-@@ -3272,14 +4306,30 @@ int Capabilities[3][3] =
- } else if (strcmp(Speed_A[pAC->Index],"100")==0) {
- LinkSpeed = SK_LSPEED_100MBPS;
- } else if (strcmp(Speed_A[pAC->Index],"1000")==0) {
-- LinkSpeed = SK_LSPEED_1000MBPS;
-+ if ((pAC->PciDev->vendor == 0x11ab ) &&
-+ (pAC->PciDev->device == 0x4350)) {
-+ LinkSpeed = SK_LSPEED_100MBPS;
-+ printk("sk98lin: Illegal value \"%s\" for Speed_A.\n"
-+ "Gigabit speed not possible with this chip revision!",
-+ Speed_A[pAC->Index]);
-+ } else {
-+ LinkSpeed = SK_LSPEED_1000MBPS;
-+ }
- } else {
- printk("sk98lin: Illegal value \"%s\" for Speed_A\n",
- Speed_A[pAC->Index]);
- IsLinkSpeedDefined = SK_FALSE;
- }
- } else {
-- IsLinkSpeedDefined = SK_FALSE;
-+ if ((pAC->PciDev->vendor == 0x11ab ) &&
-+ (pAC->PciDev->device == 0x4350)) {
-+ /* Gigabit speed not supported
-+ * Swith to speed 100
-+ */
-+ LinkSpeed = SK_LSPEED_100MBPS;
-+ } else {
-+ IsLinkSpeedDefined = SK_FALSE;
-+ }
- }
-
- /*
-@@ -3374,9 +4424,6 @@ int Capabilities[3][3] =
- }
-
- if (!AutoSet && DupSet) {
-- printk("sk98lin: Port A: Duplex setting not"
-- " possible in\n default AutoNegotiation mode"
-- " (Sense).\n Using AutoNegotiation On\n");
- AutoNeg = AN_ON;
- }
-
-@@ -3404,7 +4451,7 @@ int Capabilities[3][3] =
- FlowCtrl = SK_FLOW_MODE_NONE;
- } else {
- printk("sk98lin: Illegal value \"%s\" for FlowCtrl_A\n",
-- FlowCtrl_A[pAC->Index]);
-+ FlowCtrl_A[pAC->Index]);
- IsFlowCtrlDefined = SK_FALSE;
- }
- } else {
-@@ -3496,7 +4543,7 @@ int Capabilities[3][3] =
- ** Decide whether to set new config value if somethig valid has
- ** been received.
- */
-- if (IsLinkSpeedDefined) {
-+ if (IsLinkSpeedDefined) {
- pAC->GIni.GP[1].PLinkSpeed = LinkSpeed;
- }
-
-@@ -3572,9 +4619,6 @@ int Capabilities[3][3] =
- }
-
- if (!AutoSet && DupSet) {
-- printk("sk98lin: Port B: Duplex setting not"
-- " possible in\n default AutoNegotiation mode"
-- " (Sense).\n Using AutoNegotiation On\n");
- AutoNeg = AN_ON;
- }
-
-@@ -3687,11 +4731,15 @@ int Capabilities[3][3] =
- }
-
- pAC->RlmtNets = 1;
-+ pAC->RlmtMode = 0;
-
- if (RlmtMode != NULL && pAC->Index<SK_MAX_CARD_PARAM &&
- RlmtMode[pAC->Index] != NULL) {
- if (strcmp(RlmtMode[pAC->Index], "") == 0) {
-- pAC->RlmtMode = 0;
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ pAC->RlmtMode = SK_RLMT_CHECK_LINK;
-+ pAC->RlmtNets = 2;
-+ }
- } else if (strcmp(RlmtMode[pAC->Index], "CheckLinkState") == 0) {
- pAC->RlmtMode = SK_RLMT_CHECK_LINK;
- } else if (strcmp(RlmtMode[pAC->Index], "CheckLocalPort") == 0) {
-@@ -3712,12 +4760,37 @@ int Capabilities[3][3] =
- pAC->RlmtMode = 0;
- }
- } else {
-- pAC->RlmtMode = 0;
-+ if (pAC->GIni.GIMacsFound == 2) {
-+ pAC->RlmtMode = SK_RLMT_CHECK_LINK;
-+ pAC->RlmtNets = 2;
-+ }
- }
--
-+
-+#ifdef SK_YUKON2
-+ /*
-+ ** use dualnet config per default
-+ *
-+ pAC->RlmtMode = SK_RLMT_CHECK_LINK;
-+ pAC->RlmtNets = 2;
-+ */
-+#endif
-+
-+
-+ /*
-+ ** Check the LowLatance parameters
-+ */
-+ pAC->LowLatency = SK_FALSE;
-+ if (LowLatency[pAC->Index] != NULL) {
-+ if (strcmp(LowLatency[pAC->Index], "On") == 0) {
-+ pAC->LowLatency = SK_TRUE;
-+ }
-+ }
-+
-+
- /*
- ** Check the interrupt moderation parameters
- */
-+ pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
- if (Moderation[pAC->Index] != NULL) {
- if (strcmp(Moderation[pAC->Index], "") == 0) {
- pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
-@@ -3731,70 +4804,49 @@ int Capabilities[3][3] =
- printk("sk98lin: Illegal value \"%s\" for Moderation.\n"
- " Disable interrupt moderation.\n",
- Moderation[pAC->Index]);
-- pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
-- }
-- } else {
-- pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
-- }
--
-- if (Stats[pAC->Index] != NULL) {
-- if (strcmp(Stats[pAC->Index], "Yes") == 0) {
-- pAC->DynIrqModInfo.DisplayStats = SK_TRUE;
-- } else {
-- pAC->DynIrqModInfo.DisplayStats = SK_FALSE;
- }
- } else {
-- pAC->DynIrqModInfo.DisplayStats = SK_FALSE;
-+/* Set interrupt moderation if wished */
-+#ifdef CONFIG_SK98LIN_STATINT
-+ pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_STATIC;
-+#endif
- }
-
- if (ModerationMask[pAC->Index] != NULL) {
- if (strcmp(ModerationMask[pAC->Index], "Rx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY;
-+ IrqModMaskOffset = 0;
- } else if (strcmp(ModerationMask[pAC->Index], "Tx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_ONLY;
-+ IrqModMaskOffset = 1;
- } else if (strcmp(ModerationMask[pAC->Index], "Sp") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_ONLY;
-+ IrqModMaskOffset = 2;
- } else if (strcmp(ModerationMask[pAC->Index], "RxSp") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX;
-+ IrqModMaskOffset = 3;
- } else if (strcmp(ModerationMask[pAC->Index], "SpRx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX;
-+ IrqModMaskOffset = 3;
- } else if (strcmp(ModerationMask[pAC->Index], "RxTx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
-+ IrqModMaskOffset = 4;
- } else if (strcmp(ModerationMask[pAC->Index], "TxRx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
-+ IrqModMaskOffset = 4;
- } else if (strcmp(ModerationMask[pAC->Index], "TxSp") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX;
-+ IrqModMaskOffset = 5;
- } else if (strcmp(ModerationMask[pAC->Index], "SpTx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX;
-- } else if (strcmp(ModerationMask[pAC->Index], "RxTxSp") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else if (strcmp(ModerationMask[pAC->Index], "RxSpTx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else if (strcmp(ModerationMask[pAC->Index], "TxRxSp") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else if (strcmp(ModerationMask[pAC->Index], "TxSpRx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else if (strcmp(ModerationMask[pAC->Index], "SpTxRx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else if (strcmp(ModerationMask[pAC->Index], "SpRxTx") == 0) {
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
-- } else { /* some rubbish */
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY;
-- }
-- } else { /* operator has stated nothing */
-- pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
-- }
--
-- if (AutoSizing[pAC->Index] != NULL) {
-- if (strcmp(AutoSizing[pAC->Index], "On") == 0) {
-- pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
-- } else {
-- pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
-+ IrqModMaskOffset = 5;
-+ } else { /* some rubbish stated */
-+ // IrqModMaskOffset = 6; ->has been initialized
-+ // already at the begin of this function...
- }
-- } else { /* operator has stated nothing */
-- pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
-+ }
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ pAC->DynIrqModInfo.MaskIrqModeration = IrqModMask[IrqModMaskOffset][0];
-+ } else {
-+ pAC->DynIrqModInfo.MaskIrqModeration = IrqModMask[IrqModMaskOffset][1];
- }
-
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT;
-+ } else {
-+ pAC->DynIrqModInfo.MaxModIntsPerSec = C_Y2_INTS_PER_SEC_DEFAULT;
-+ }
- if (IntsPerSec[pAC->Index] != 0) {
- if ((IntsPerSec[pAC->Index]< C_INT_MOD_IPS_LOWER_RANGE) ||
- (IntsPerSec[pAC->Index] > C_INT_MOD_IPS_UPPER_RANGE)) {
-@@ -3803,28 +4855,25 @@ int Capabilities[3][3] =
- IntsPerSec[pAC->Index],
- C_INT_MOD_IPS_LOWER_RANGE,
- C_INT_MOD_IPS_UPPER_RANGE,
-- C_INTS_PER_SEC_DEFAULT);
-- pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT;
-+ pAC->DynIrqModInfo.MaxModIntsPerSec);
- } else {
- pAC->DynIrqModInfo.MaxModIntsPerSec = IntsPerSec[pAC->Index];
- }
-- } else {
-- pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT;
-- }
-+ }
-
- /*
- ** Evaluate upper and lower moderation threshold
- */
- pAC->DynIrqModInfo.MaxModIntsPerSecUpperLimit =
- pAC->DynIrqModInfo.MaxModIntsPerSec +
-- (pAC->DynIrqModInfo.MaxModIntsPerSec / 2);
-+ (pAC->DynIrqModInfo.MaxModIntsPerSec / 5);
-
- pAC->DynIrqModInfo.MaxModIntsPerSecLowerLimit =
- pAC->DynIrqModInfo.MaxModIntsPerSec -
-- (pAC->DynIrqModInfo.MaxModIntsPerSec / 2);
--
-- pAC->DynIrqModInfo.PrevTimeVal = jiffies; /* initial value */
-+ (pAC->DynIrqModInfo.MaxModIntsPerSec / 5);
-
-+ pAC->DynIrqModInfo.DynIrqModSampleInterval =
-+ SK_DRV_MODERATION_TIMER_LENGTH;
-
- } /* GetConfiguration */
-
-@@ -3839,66 +4888,22 @@ int Capabilities[3][3] =
- *
- * Returns: N/A
- */
--static void ProductStr(
--SK_AC *pAC /* pointer to adapter context */
--)
--{
--int StrLen = 80; /* length of the string, defined in SK_AC */
--char Keyword[] = VPD_NAME; /* vpd productname identifier */
--int ReturnCode; /* return code from vpd_read */
--unsigned long Flags;
-+static void ProductStr(SK_AC *pAC)
-+{
-+ char Default[] = "Generic Marvell Yukon chipset Ethernet device";
-+ char Key[] = VPD_NAME; /* VPD productname key */
-+ int StrLen = 80; /* stringlen */
-+ unsigned long Flags;
-
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-- ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr,
-- &StrLen);
-- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-- if (ReturnCode != 0) {
-- /* there was an error reading the vpd data */
-+ if (VpdRead(pAC, pAC->IoBase, Key, pAC->DeviceStr, &StrLen)) {
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR,
- ("Error reading VPD data: %d\n", ReturnCode));
-- pAC->DeviceStr[0] = '\0';
-+ strcpy(pAC->DeviceStr, Default);
- }
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
- } /* ProductStr */
-
--/*****************************************************************************
-- *
-- * StartDrvCleanupTimer - Start timer to check for descriptors which
-- * might be placed in descriptor ring, but
-- * havent been handled up to now
-- *
-- * Description:
-- * This function requests a HW-timer fo the Yukon card. The actions to
-- * perform when this timer expires, are located in the SkDrvEvent().
-- *
-- * Returns: N/A
-- */
--static void
--StartDrvCleanupTimer(SK_AC *pAC) {
-- SK_EVPARA EventParam; /* Event struct for timer event */
--
-- SK_MEMSET((char *) &EventParam, 0, sizeof(EventParam));
-- EventParam.Para32[0] = SK_DRV_RX_CLEANUP_TIMER;
-- SkTimerStart(pAC, pAC->IoBase, &pAC->DrvCleanupTimer,
-- SK_DRV_RX_CLEANUP_TIMER_LENGTH,
-- SKGE_DRV, SK_DRV_TIMER, EventParam);
--}
--
--/*****************************************************************************
-- *
-- * StopDrvCleanupTimer - Stop timer to check for descriptors
-- *
-- * Description:
-- * This function requests a HW-timer fo the Yukon card. The actions to
-- * perform when this timer expires, are located in the SkDrvEvent().
-- *
-- * Returns: N/A
-- */
--static void
--StopDrvCleanupTimer(SK_AC *pAC) {
-- SkTimerStop(pAC, pAC->IoBase, &pAC->DrvCleanupTimer);
-- SK_MEMSET((char *) &pAC->DrvCleanupTimer, 0, sizeof(SK_TIMER));
--}
--
- /****************************************************************************/
- /* functions for common modules *********************************************/
- /****************************************************************************/
-@@ -3987,7 +4992,9 @@ SK_MBUF *pNextMbuf;
- SK_U64 SkOsGetTime(SK_AC *pAC)
- {
- SK_U64 PrivateJiffies;
-+
- SkOsGetTimeCurrent(pAC, &PrivateJiffies);
-+
- return PrivateJiffies;
- } /* SkOsGetTime */
-
-@@ -4142,29 +5149,27 @@ SK_U8 Val) /* pointer to store the read
- *
- */
- int SkDrvEvent(
--SK_AC *pAC, /* pointer to adapter context */
--SK_IOC IoC, /* io-context */
--SK_U32 Event, /* event-id */
--SK_EVPARA Param) /* event-parameter */
--{
--SK_MBUF *pRlmtMbuf; /* pointer to a rlmt-mbuf structure */
--struct sk_buff *pMsg; /* pointer to a message block */
--int FromPort; /* the port from which we switch away */
--int ToPort; /* the port we switch to */
--SK_EVPARA NewPara; /* parameter for further events */
--int Stat;
--unsigned long Flags;
--SK_BOOL DualNet;
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_IOC IoC, /* IO control context */
-+SK_U32 Event, /* event-id */
-+SK_EVPARA Param) /* event-parameter */
-+{
-+ SK_MBUF *pRlmtMbuf; /* pointer to a rlmt-mbuf structure */
-+ struct sk_buff *pMsg; /* pointer to a message block */
-+ SK_BOOL DualNet;
-+ SK_U32 Reason;
-+ unsigned long Flags;
-+ unsigned long InitFlags;
-+ int FromPort; /* the port from which we switch away */
-+ int ToPort; /* the port we switch to */
-+ int Stat;
-+ DEV_NET *pNet = NULL;
-+#ifdef CONFIG_SK98LIN_NAPI
-+ int WorkToDo = 1; /* min(*budget, dev->quota); */
-+ int WorkDone = 0;
-+#endif
-
- switch (Event) {
-- case SK_DRV_ADAP_FAIL:
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-- ("ADAPTER FAIL EVENT\n"));
-- printk("%s: Adapter failed.\n", pAC->dev[0]->name);
-- /* disable interrupts */
-- SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-- /* cgoos */
-- break;
- case SK_DRV_PORT_FAIL:
- FromPort = Param.Para32[0];
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-@@ -4174,219 +5179,296 @@ SK_BOOL DualNet;
- } else {
- printk("%s: Port B failed.\n", pAC->dev[1]->name);
- }
-- /* cgoos */
- break;
-- case SK_DRV_PORT_RESET: /* SK_U32 PortIdx */
-- /* action list 4 */
-+ case SK_DRV_PORT_RESET:
- FromPort = Param.Para32[0];
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
- ("PORT RESET EVENT, Port: %d ", FromPort));
-- NewPara.Para64 = FromPort;
-- SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara);
-+ SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET,
-+ FromPort, SK_FALSE);
- spin_lock_irqsave(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
--
-- SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST);
-+ } else {
-+ SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST);
-+ }
- pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING;
- spin_unlock_irqrestore(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
-
-- /* clear rx ring from received frames */
-- ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE);
--
-- ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo);
-+#else
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE);
-+#endif
-+ ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]);
-+ }
- spin_lock_irqsave(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
--
-- /* tschilling: Handling of return value inserted. */
-- if (SkGeInitPort(pAC, IoC, FromPort)) {
-- if (FromPort == 0) {
-- printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name);
-+
-+#ifdef USE_TIST_FOR_RESET
-+ if (pAC->GIni.GIYukon2) {
-+#ifdef Y2_RECOVERY
-+ /* for Yukon II we want to have tist enabled all the time */
-+ if (!SK_ADAPTER_WAITING_FOR_TIST(pAC)) {
-+ Y2_ENABLE_TIST(pAC->IoBase);
-+ }
-+#else
-+ /* make sure that we do not accept any status LEs from now on */
-+ if (SK_ADAPTER_WAITING_FOR_TIST(pAC)) {
-+#endif
-+ /* port already waiting for tist */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Port %c is now waiting for specific Tist\n",
-+ 'A' + FromPort));
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_SPECIFIC_TIST,
-+ FromPort);
-+ /* get current timestamp */
-+ Y2_GET_TIST_LOW_VAL(pAC->IoBase, &pAC->MinTistLo);
-+ pAC->MinTistHi = pAC->GIni.GITimeStampCnt;
-+#ifndef Y2_RECOVERY
- } else {
-- printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name);
-+ /* nobody is waiting yet */
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_ANY_TIST,
-+ FromPort);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Port %c is now waiting for any Tist (0x%X)\n",
-+ 'A' + FromPort, pAC->AdapterResetState));
-+ /* start tist */
-+ Y2_ENABLE_TIST(pAC-IoBase);
-+ }
-+#endif
-+ }
-+#endif
-+
-+#ifdef Y2_LE_CHECK
-+ /* mark entries invalid */
-+ pAC->LastPort = 3;
-+ pAC->LastOpc = 0xFF;
-+#endif
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStart(pAC, IoC, FromPort);
-+ } else {
-+ /* tschilling: Handling of return value inserted. */
-+ if (SkGeInitPort(pAC, IoC, FromPort)) {
-+ if (FromPort == 0) {
-+ printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name);
-+ } else {
-+ printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name);
-+ }
- }
-+ SkAddrMcUpdate(pAC,IoC, FromPort);
-+ PortReInitBmu(pAC, FromPort);
-+ SkGePollTxD(pAC, IoC, FromPort, SK_TRUE);
-+ CLEAR_AND_START_RX(FromPort);
- }
-- SkAddrMcUpdate(pAC,IoC, FromPort);
-- PortReInitBmu(pAC, FromPort);
-- SkGePollTxD(pAC, IoC, FromPort, SK_TRUE);
-- ClearAndStartRx(pAC, FromPort);
- spin_unlock_irqrestore(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
- break;
-- case SK_DRV_NET_UP: /* SK_U32 PortIdx */
-- /* action list 5 */
-+ case SK_DRV_NET_UP:
-+ spin_lock_irqsave(&pAC->InitLock, InitFlags);
- FromPort = Param.Para32[0];
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-- ("NET UP EVENT, Port: %d ", Param.Para32[0]));
-- /* Mac update */
-- SkAddrMcUpdate(pAC,IoC, FromPort);
--
-+ ("NET UP EVENT, Port: %d ", FromPort));
-+ SkAddrMcUpdate(pAC,IoC, FromPort); /* Mac update */
- if (DoPrintInterfaceChange) {
-- printk("%s: network connection up using"
-- " port %c\n", pAC->dev[Param.Para32[0]]->name, 'A'+Param.Para32[0]);
-+ printk("%s: network connection up using port %c\n",
-+ pAC->dev[FromPort]->name, 'A'+FromPort);
-
-- /* tschilling: Values changed according to LinkSpeedUsed. */
-- Stat = pAC->GIni.GP[FromPort].PLinkSpeedUsed;
-- if (Stat == SK_LSPEED_STAT_10MBPS) {
-- printk(" speed: 10\n");
-- } else if (Stat == SK_LSPEED_STAT_100MBPS) {
-- printk(" speed: 100\n");
-- } else if (Stat == SK_LSPEED_STAT_1000MBPS) {
-- printk(" speed: 1000\n");
-- } else {
-- printk(" speed: unknown\n");
-- }
-+ /* tschilling: Values changed according to LinkSpeedUsed. */
-+ Stat = pAC->GIni.GP[FromPort].PLinkSpeedUsed;
-+ if (Stat == SK_LSPEED_STAT_10MBPS) {
-+ printk(" speed: 10\n");
-+ } else if (Stat == SK_LSPEED_STAT_100MBPS) {
-+ printk(" speed: 100\n");
-+ } else if (Stat == SK_LSPEED_STAT_1000MBPS) {
-+ printk(" speed: 1000\n");
-+ } else {
-+ printk(" speed: unknown\n");
-+ }
-
-+ Stat = pAC->GIni.GP[FromPort].PLinkModeStatus;
-+ if ((Stat == SK_LMODE_STAT_AUTOHALF) ||
-+ (Stat == SK_LMODE_STAT_AUTOFULL)) {
-+ printk(" autonegotiation: yes\n");
-+ } else {
-+ printk(" autonegotiation: no\n");
-+ }
-
-- Stat = pAC->GIni.GP[FromPort].PLinkModeStatus;
-- if (Stat == SK_LMODE_STAT_AUTOHALF ||
-- Stat == SK_LMODE_STAT_AUTOFULL) {
-- printk(" autonegotiation: yes\n");
-- }
-- else {
-- printk(" autonegotiation: no\n");
-- }
-- if (Stat == SK_LMODE_STAT_AUTOHALF ||
-- Stat == SK_LMODE_STAT_HALF) {
-- printk(" duplex mode: half\n");
-- }
-- else {
-- printk(" duplex mode: full\n");
-- }
-- Stat = pAC->GIni.GP[FromPort].PFlowCtrlStatus;
-- if (Stat == SK_FLOW_STAT_REM_SEND ) {
-- printk(" flowctrl: remote send\n");
-- }
-- else if (Stat == SK_FLOW_STAT_LOC_SEND ){
-- printk(" flowctrl: local send\n");
-- }
-- else if (Stat == SK_FLOW_STAT_SYMMETRIC ){
-- printk(" flowctrl: symmetric\n");
-- }
-- else {
-- printk(" flowctrl: none\n");
-- }
--
-- /* tschilling: Check against CopperType now. */
-- if ((pAC->GIni.GICopperType == SK_TRUE) &&
-- (pAC->GIni.GP[FromPort].PLinkSpeedUsed ==
-- SK_LSPEED_STAT_1000MBPS)) {
-- Stat = pAC->GIni.GP[FromPort].PMSStatus;
-- if (Stat == SK_MS_STAT_MASTER ) {
-- printk(" role: master\n");
-+ if ((Stat == SK_LMODE_STAT_AUTOHALF) ||
-+ (Stat == SK_LMODE_STAT_HALF)) {
-+ printk(" duplex mode: half\n");
-+ } else {
-+ printk(" duplex mode: full\n");
- }
-- else if (Stat == SK_MS_STAT_SLAVE ) {
-- printk(" role: slave\n");
-+
-+ Stat = pAC->GIni.GP[FromPort].PFlowCtrlStatus;
-+ if (Stat == SK_FLOW_STAT_REM_SEND ) {
-+ printk(" flowctrl: remote send\n");
-+ } else if (Stat == SK_FLOW_STAT_LOC_SEND ) {
-+ printk(" flowctrl: local send\n");
-+ } else if (Stat == SK_FLOW_STAT_SYMMETRIC ) {
-+ printk(" flowctrl: symmetric\n");
-+ } else {
-+ printk(" flowctrl: none\n");
- }
-- else {
-- printk(" role: ???\n");
-+
-+ /* tschilling: Check against CopperType now. */
-+ if ((pAC->GIni.GICopperType == SK_TRUE) &&
-+ (pAC->GIni.GP[FromPort].PLinkSpeedUsed ==
-+ SK_LSPEED_STAT_1000MBPS)) {
-+ Stat = pAC->GIni.GP[FromPort].PMSStatus;
-+ if (Stat == SK_MS_STAT_MASTER ) {
-+ printk(" role: master\n");
-+ } else if (Stat == SK_MS_STAT_SLAVE ) {
-+ printk(" role: slave\n");
-+ } else {
-+ printk(" role: ???\n");
-+ }
- }
-- }
-
-- /*
-- Display dim (dynamic interrupt moderation)
-- informations
-- */
-- if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC)
-- printk(" irq moderation: static (%d ints/sec)\n",
-+ /* Display interrupt moderation informations */
-+ if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) {
-+ printk(" irq moderation: static (%d ints/sec)\n",
- pAC->DynIrqModInfo.MaxModIntsPerSec);
-- else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC)
-- printk(" irq moderation: dynamic (%d ints/sec)\n",
-+ } else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-+ printk(" irq moderation: dynamic (%d ints/sec)\n",
- pAC->DynIrqModInfo.MaxModIntsPerSec);
-- else
-- printk(" irq moderation: disabled\n");
-+ } else {
-+ printk(" irq moderation: disabled\n");
-+ }
-+
-+#ifdef NETIF_F_TSO
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (pAC->dev[FromPort]->features & NETIF_F_TSO) {
-+ printk(" tcp offload: enabled\n");
-+ } else {
-+ printk(" tcp offload: disabled\n");
-+ }
-+ }
-+#endif
-
-+ if (pAC->dev[FromPort]->features & NETIF_F_SG) {
-+ printk(" scatter-gather: enabled\n");
-+ } else {
-+ printk(" scatter-gather: disabled\n");
-+ }
-
--#ifdef SK_ZEROCOPY
-- if (pAC->ChipsetType)
--#ifdef USE_SK_TX_CHECKSUM
-- printk(" scatter-gather: enabled\n");
--#else
-- printk(" tx-checksum: disabled\n");
--#endif
-- else
-- printk(" scatter-gather: disabled\n");
--#else
-- printk(" scatter-gather: disabled\n");
--#endif
-+ if (pAC->dev[FromPort]->features & NETIF_F_IP_CSUM) {
-+ printk(" tx-checksum: enabled\n");
-+ } else {
-+ printk(" tx-checksum: disabled\n");
-+ }
-
--#ifndef USE_SK_RX_CHECKSUM
-- printk(" rx-checksum: disabled\n");
-+ if (pAC->RxPort[FromPort].UseRxCsum) {
-+ printk(" rx-checksum: enabled\n");
-+ } else {
-+ printk(" rx-checksum: disabled\n");
-+ }
-+#ifdef CONFIG_SK98LIN_NAPI
-+ printk(" rx-polling: enabled\n");
- #endif
--
-+ if (pAC->LowLatency) {
-+ printk(" low latency: enabled\n");
-+ }
- } else {
-- DoPrintInterfaceChange = SK_TRUE;
-- }
-+ DoPrintInterfaceChange = SK_TRUE;
-+ }
-
-- if ((Param.Para32[0] != pAC->ActivePort) &&
-- (pAC->RlmtNets == 1)) {
-- NewPara.Para32[0] = pAC->ActivePort;
-- NewPara.Para32[1] = Param.Para32[0];
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_INTERN,
-- NewPara);
-+ if ((FromPort != pAC->ActivePort)&&(pAC->RlmtNets == 1)) {
-+ SkLocalEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_INTERN,
-+ pAC->ActivePort, FromPort, SK_FALSE);
- }
-
- /* Inform the world that link protocol is up. */
-- pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING;
--
-+ netif_wake_queue(pAC->dev[FromPort]);
-+ netif_carrier_on(pAC->dev[FromPort]);
-+ pAC->dev[FromPort]->flags |= IFF_RUNNING;
-+ spin_unlock_irqrestore(&pAC->InitLock, InitFlags);
- break;
-- case SK_DRV_NET_DOWN: /* SK_U32 Reason */
-- /* action list 7 */
-+ case SK_DRV_NET_DOWN:
-+ Reason = Param.Para32[0];
-+ FromPort = Param.Para32[1];
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
- ("NET DOWN EVENT "));
-+
-+ /* Stop queue and carrier */
-+ netif_stop_queue(pAC->dev[FromPort]);
-+ netif_carrier_off(pAC->dev[FromPort]);
-+
-+ /* Print link change */
- if (DoPrintInterfaceChange) {
-- printk("%s: network connection down\n",
-- pAC->dev[Param.Para32[1]]->name);
-+ if (pAC->dev[FromPort]->flags & IFF_RUNNING) {
-+ printk("%s: network connection down\n",
-+ pAC->dev[FromPort]->name);
-+ }
- } else {
- DoPrintInterfaceChange = SK_TRUE;
- }
-- pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING;
-+ pAC->dev[FromPort]->flags &= ~IFF_RUNNING;
- break;
-- case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-- ("PORT SWITCH HARD "));
-- case SK_DRV_SWITCH_SOFT: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
-- /* action list 6 */
-- printk("%s: switching to port %c\n", pAC->dev[0]->name,
-- 'A'+Param.Para32[1]);
-- case SK_DRV_SWITCH_INTERN: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
-+ case SK_DRV_SWITCH_HARD: /* FALL THRU */
-+ case SK_DRV_SWITCH_SOFT: /* FALL THRU */
-+ case SK_DRV_SWITCH_INTERN:
- FromPort = Param.Para32[0];
-- ToPort = Param.Para32[1];
-+ ToPort = Param.Para32[1];
-+ printk("%s: switching from port %c to port %c\n",
-+ pAC->dev[0]->name, 'A'+FromPort, 'A'+ToPort);
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
- ("PORT SWITCH EVENT, From: %d To: %d (Pref %d) ",
- FromPort, ToPort, pAC->Rlmt.Net[0].PrefPort));
-- NewPara.Para64 = FromPort;
-- SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara);
-- NewPara.Para64 = ToPort;
-- SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara);
-+ SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET,
-+ FromPort, SK_FALSE);
-+ SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET,
-+ ToPort, SK_FALSE);
- spin_lock_irqsave(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
- spin_lock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock);
-- SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST);
-- SkGeStopPort(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST);
-+ SkY2PortStop(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST);
-+ }
-+ else {
-+ SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST);
-+ SkGeStopPort(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST);
-+ }
- spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock);
- spin_unlock_irqrestore(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
-
-- ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); /* clears rx ring */
-- ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE); /* clears rx ring */
-
-- ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]);
-- ClearTxRing(pAC, &pAC->TxPort[ToPort][TX_PRIO_LOW]);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo);
-+ ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE, &WorkDone, WorkToDo);
-+#else
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); /* clears rx ring */
-+ ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE); /* clears rx ring */
-+#endif
-+ ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]);
-+ ClearTxRing(pAC, &pAC->TxPort[ToPort][TX_PRIO_LOW]);
-+ }
-+
- spin_lock_irqsave(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
- spin_lock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock);
- pAC->ActivePort = ToPort;
--#if 0
-- SetQueueSizes(pAC);
--#else
-+
- /* tschilling: New common function with minimum size check. */
- DualNet = SK_FALSE;
- if (pAC->RlmtNets == 2) {
-@@ -4404,76 +5486,318 @@ SK_BOOL DualNet;
- printk("SkGeInitAssignRamToQueues failed.\n");
- break;
- }
--#endif
-- /* tschilling: Handling of return values inserted. */
-- if (SkGeInitPort(pAC, IoC, FromPort) ||
-- SkGeInitPort(pAC, IoC, ToPort)) {
-- printk("%s: SkGeInitPort failed.\n", pAC->dev[0]->name);
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* tschilling: Handling of return values inserted. */
-+ if (SkGeInitPort(pAC, IoC, FromPort) ||
-+ SkGeInitPort(pAC, IoC, ToPort)) {
-+ printk("%s: SkGeInitPort failed.\n", pAC->dev[0]->name);
-+ }
- }
-- if (Event == SK_DRV_SWITCH_SOFT) {
-- SkMacRxTxEnable(pAC, IoC, FromPort);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (Event == SK_DRV_SWITCH_SOFT) {
-+ SkMacRxTxEnable(pAC, IoC, FromPort);
-+ }
-+ SkMacRxTxEnable(pAC, IoC, ToPort);
- }
-- SkMacRxTxEnable(pAC, IoC, ToPort);
-+
- SkAddrSwap(pAC, IoC, FromPort, ToPort);
- SkAddrMcUpdate(pAC, IoC, FromPort);
- SkAddrMcUpdate(pAC, IoC, ToPort);
-- PortReInitBmu(pAC, FromPort);
-- PortReInitBmu(pAC, ToPort);
-- SkGePollTxD(pAC, IoC, FromPort, SK_TRUE);
-- SkGePollTxD(pAC, IoC, ToPort, SK_TRUE);
-- ClearAndStartRx(pAC, FromPort);
-- ClearAndStartRx(pAC, ToPort);
-+
-+#ifdef USE_TIST_FOR_RESET
-+ if (pAC->GIni.GIYukon2) {
-+ /* make sure that we do not accept any status LEs from now on */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("both Ports now waiting for specific Tist\n"));
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_ANY_TIST,
-+ 0);
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_ANY_TIST,
-+ 1);
-+
-+ /* start tist */
-+ Y2_ENABLE_TIST(pAC->IoBase);
-+ }
-+#endif
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ PortReInitBmu(pAC, FromPort);
-+ PortReInitBmu(pAC, ToPort);
-+ SkGePollTxD(pAC, IoC, FromPort, SK_TRUE);
-+ SkGePollTxD(pAC, IoC, ToPort, SK_TRUE);
-+ CLEAR_AND_START_RX(FromPort);
-+ CLEAR_AND_START_RX(ToPort);
-+ } else {
-+ SkY2PortStart(pAC, IoC, FromPort);
-+ SkY2PortStart(pAC, IoC, ToPort);
-+#ifdef SK_YUKON2
-+ /* in yukon-II always port 0 has to be started first */
-+ // SkY2PortStart(pAC, IoC, 0);
-+ // SkY2PortStart(pAC, IoC, 1);
-+#endif
-+ }
- spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock);
- spin_unlock_irqrestore(
- &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
- Flags);
- break;
- case SK_DRV_RLMT_SEND: /* SK_MBUF *pMb */
-- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-- ("RLS "));
-+ SK_DBG_MSG(NULL,SK_DBGMOD_DRV,SK_DBGCAT_DRV_EVENT,("RLS "));
- pRlmtMbuf = (SK_MBUF*) Param.pParaPtr;
- pMsg = (struct sk_buff*) pRlmtMbuf->pOs;
- skb_put(pMsg, pRlmtMbuf->Length);
-- if (XmitFrame(pAC, &pAC->TxPort[pRlmtMbuf->PortIdx][TX_PRIO_LOW],
-- pMsg) < 0)
--
-- DEV_KFREE_SKB_ANY(pMsg);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ if (XmitFrame(pAC, &pAC->TxPort[pRlmtMbuf->PortIdx][TX_PRIO_LOW],
-+ pMsg) < 0) {
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ }
-+ } else {
-+ if (SkY2RlmtSend(pAC, pRlmtMbuf->PortIdx, pMsg) < 0) {
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ }
-+ }
- break;
- case SK_DRV_TIMER:
- if (Param.Para32[0] == SK_DRV_MODERATION_TIMER) {
-- /*
-- ** expiration of the moderation timer implies that
-- ** dynamic moderation is to be applied
-- */
-+ /* check what IRQs are to be moderated */
- SkDimStartModerationTimer(pAC);
- SkDimModerate(pAC);
-- if (pAC->DynIrqModInfo.DisplayStats) {
-- SkDimDisplayModerationSettings(pAC);
-- }
-- } else if (Param.Para32[0] == SK_DRV_RX_CLEANUP_TIMER) {
-- /*
-- ** check if we need to check for descriptors which
-- ** haven't been handled the last millisecs
-- */
-- StartDrvCleanupTimer(pAC);
-- if (pAC->GIni.GIMacsFound == 2) {
-- ReceiveIrq(pAC, &pAC->RxPort[1], SK_FALSE);
-- }
-- ReceiveIrq(pAC, &pAC->RxPort[0], SK_FALSE);
- } else {
- printk("Expiration of unknown timer\n");
- }
- break;
-+ case SK_DRV_ADAP_FAIL:
-+#if (!defined (Y2_RECOVERY) && !defined (Y2_LE_CHECK))
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-+ ("ADAPTER FAIL EVENT\n"));
-+ printk("%s: Adapter failed.\n", pAC->dev[0]->name);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, 0); /* disable interrupts */
-+ break;
-+#endif
-+
-+#if (defined (Y2_RECOVERY) || defined (Y2_LE_CHECK))
-+ case SK_DRV_RECOVER:
-+ spin_lock_irqsave(&pAC->InitLock, InitFlags);
-+ pNet = (DEV_NET *) pAC->dev[Param.Para32[0]]->priv;
-+
-+ /* Recover already in progress */
-+ if (pNet->InRecover) {
-+ break;
-+ }
-+
-+ netif_stop_queue(pAC->dev[Param.Para32[0]]); /* stop device if running */
-+ pNet->InRecover = SK_TRUE;
-+
-+ FromPort = Param.Para32[0];
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
-+ ("PORT RESET EVENT, Port: %d ", FromPort));
-+
-+ /* Disable interrupts */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-+ SK_OUT32(pAC->IoBase, B0_HWE_IMSK, 0);
-+
-+ SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET,
-+ FromPort, SK_FALSE);
-+ spin_lock_irqsave(
-+ &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
-+ Flags);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST);
-+ } else {
-+ SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST);
-+ }
-+ pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING;
-+ spin_unlock_irqrestore(
-+ &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
-+ Flags);
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+#ifdef CONFIG_SK98LIN_NAPI
-+ WorkToDo = 1;
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo);
-+#else
-+ ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE);
-+#endif
-+ ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]);
-+ }
-+ spin_lock_irqsave(
-+ &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
-+ Flags);
-+
-+#ifdef USE_TIST_FOR_RESET
-+ if (pAC->GIni.GIYukon2) {
-+#if 0
-+ /* make sure that we do not accept any status LEs from now on */
-+ Y2_ENABLE_TIST(pAC->IoBase);
-+
-+ /* get current timestamp */
-+ Y2_GET_TIST_LOW_VAL(pAC->IoBase, &pAC->MinTistLo);
-+ pAC->MinTistHi = pAC->GIni.GITimeStampCnt;
-+
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_SPECIFIC_TIST,
-+ FromPort);
-+#endif
-+ SK_SET_WAIT_BIT_FOR_PORT(
-+ pAC,
-+ SK_PSTATE_WAITING_FOR_ANY_TIST,
-+ FromPort);
-+
-+ /* start tist */
-+ Y2_ENABLE_TIST(pAC->IoBase);
-+ }
-+#endif
-+
-+ /* Restart Receive BMU on Yukon-2 */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_4167)) {
-+ SkYuk2RestartRxBmu(pAC, IoC, FromPort);
-+ }
-+
-+#ifdef Y2_LE_CHECK
-+ /* mark entries invalid */
-+ pAC->LastPort = 3;
-+ pAC->LastOpc = 0xFF;
-+#endif
-+
-+#endif
-+ /* Restart ports but do not initialize PHY. */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SkY2PortStart(pAC, IoC, FromPort);
-+ } else {
-+ /* tschilling: Handling of return value inserted. */
-+ if (SkGeInitPort(pAC, IoC, FromPort)) {
-+ if (FromPort == 0) {
-+ printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name);
-+ } else {
-+ printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name);
-+ }
-+ }
-+ SkAddrMcUpdate(pAC,IoC, FromPort);
-+ PortReInitBmu(pAC, FromPort);
-+ SkGePollTxD(pAC, IoC, FromPort, SK_TRUE);
-+ CLEAR_AND_START_RX(FromPort);
-+ }
-+ spin_unlock_irqrestore(
-+ &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
-+ Flags);
-+
-+ /* Map any waiting RX buffers to HW */
-+ FillReceiveTableYukon2(pAC, pAC->IoBase, FromPort);
-+
-+ pNet->InRecover = SK_FALSE;
-+ /* enable Interrupts */
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK);
-+ netif_wake_queue(pAC->dev[FromPort]);
-+ spin_unlock_irqrestore(&pAC->InitLock, InitFlags);
-+ break;
- default:
- break;
- }
- SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
- ("END EVENT "));
--
-+
- return (0);
- } /* SkDrvEvent */
-
-
-+/******************************************************************************
-+ *
-+ * SkLocalEventQueue() - add event to queue
-+ *
-+ * Description:
-+ * This function adds an event to the event queue and run the
-+ * SkEventDispatcher. At least Init Level 1 is required to queue events,
-+ * but will be scheduled add Init Level 2.
-+ *
-+ * returns:
-+ * nothing
-+ */
-+void SkLocalEventQueue(
-+SK_AC *pAC, /* Adapters context */
-+SK_U32 Class, /* Event Class */
-+SK_U32 Event, /* Event to be queued */
-+SK_U32 Param1, /* Event parameter 1 */
-+SK_U32 Param2, /* Event parameter 2 */
-+SK_BOOL Dispatcher) /* Dispatcher flag:
-+ * TRUE == Call SkEventDispatcher
-+ * FALSE == Don't execute SkEventDispatcher
-+ */
-+{
-+ SK_EVPARA EvPara;
-+ EvPara.Para32[0] = Param1;
-+ EvPara.Para32[1] = Param2;
-+
-+
-+ if (Class == SKGE_PNMI) {
-+ SkPnmiEvent( pAC,
-+ pAC->IoBase,
-+ Event,
-+ EvPara);
-+ } else {
-+ SkEventQueue( pAC,
-+ Class,
-+ Event,
-+ EvPara);
-+ }
-+
-+ /* Run the dispatcher */
-+ if (Dispatcher) {
-+ SkEventDispatcher(pAC, pAC->IoBase);
-+ }
-+
-+}
-+
-+/******************************************************************************
-+ *
-+ * SkLocalEventQueue64() - add event to queue (64bit version)
-+ *
-+ * Description:
-+ * This function adds an event to the event queue and run the
-+ * SkEventDispatcher. At least Init Level 1 is required to queue events,
-+ * but will be scheduled add Init Level 2.
-+ *
-+ * returns:
-+ * nothing
-+ */
-+void SkLocalEventQueue64(
-+SK_AC *pAC, /* Adapters context */
-+SK_U32 Class, /* Event Class */
-+SK_U32 Event, /* Event to be queued */
-+SK_U64 Param, /* Event parameter */
-+SK_BOOL Dispatcher) /* Dispatcher flag:
-+ * TRUE == Call SkEventDispatcher
-+ * FALSE == Don't execute SkEventDispatcher
-+ */
-+{
-+ SK_EVPARA EvPara;
-+ EvPara.Para64 = Param;
-+
-+
-+ if (Class == SKGE_PNMI) {
-+ SkPnmiEvent( pAC,
-+ pAC->IoBase,
-+ Event,
-+ EvPara);
-+ } else {
-+ SkEventQueue( pAC,
-+ Class,
-+ Event,
-+ EvPara);
-+ }
-+
-+ /* Run the dispatcher */
-+ if (Dispatcher) {
-+ SkEventDispatcher(pAC, pAC->IoBase);
-+ }
-+
-+}
-+
-+
- /*****************************************************************************
- *
- * SkErrorLog - log errors
-@@ -4523,8 +5847,6 @@ char ClassStr[80];
-
- } /* SkErrorLog */
-
--#ifdef SK_DIAG_SUPPORT
--
- /*****************************************************************************
- *
- * SkDrvEnterDiagMode - handles DIAG attach request
-@@ -4550,7 +5872,7 @@ SK_AC *pAc) /* pointer to adapter co
-
- pAC->DiagModeActive = DIAG_ACTIVE;
- if (pAC->BoardLevel > SK_INIT_DATA) {
-- if (pNet->Up) {
-+ if (netif_running(pAC->dev[0])) {
- pAC->WasIfUp[0] = SK_TRUE;
- pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
- DoPrintInterfaceChange = SK_FALSE;
-@@ -4558,9 +5880,10 @@ SK_AC *pAc) /* pointer to adapter co
- } else {
- pAC->WasIfUp[0] = SK_FALSE;
- }
-+
- if (pNet != (DEV_NET *) pAc->dev[1]->priv) {
- pNet = (DEV_NET *) pAc->dev[1]->priv;
-- if (pNet->Up) {
-+ if (netif_running(pAC->dev[1])) {
- pAC->WasIfUp[1] = SK_TRUE;
- pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
- DoPrintInterfaceChange = SK_FALSE;
-@@ -4592,16 +5915,16 @@ SK_AC *pAc) /* pointer to adapter co
- sizeof(SK_PNMI_STRUCT_DATA));
- pAc->DiagModeActive = DIAG_NOTACTIVE;
- pAc->Pnmi.DiagAttached = SK_DIAG_IDLE;
-- if (pAc->WasIfUp[0] == SK_TRUE) {
-- pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
-+ if (pAc->WasIfUp[0] == SK_TRUE) {
-+ pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
- DoPrintInterfaceChange = SK_FALSE;
-- SkDrvInitAdapter(pAc, 0); /* first device */
-- }
-- if (pAc->WasIfUp[1] == SK_TRUE) {
-- pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
-+ SkDrvInitAdapter(pAc, 0); /* first device */
-+ }
-+ if (pAc->WasIfUp[1] == SK_TRUE) {
-+ pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
- DoPrintInterfaceChange = SK_FALSE;
-- SkDrvInitAdapter(pAc, 1); /* second device */
-- }
-+ SkDrvInitAdapter(pAc, 1); /* second device */
-+ }
- return(0);
- }
-
-@@ -4746,14 +6069,25 @@ int devNbr) /* what device is to be
-
- } /* SkDrvInitAdapter */
-
--#endif
-+static int __init sk98lin_init(void)
-+{
-+ return pci_module_init(&sk98lin_driver);
-+}
-+
-+static void __exit sk98lin_cleanup(void)
-+{
-+ pci_unregister_driver(&sk98lin_driver);
-+}
-+
-+module_init(sk98lin_init);
-+module_exit(sk98lin_cleanup);
-+
-
- #ifdef DEBUG
- /****************************************************************************/
- /* "debug only" section *****************************************************/
- /****************************************************************************/
-
--
- /*****************************************************************************
- *
- * DumpMsg - print a frame
-@@ -4764,9 +6098,11 @@ int devNbr) /* what device is to be
- * Returns: N/A
- *
- */
--static void DumpMsg(struct sk_buff *skb, char *str)
-+static void DumpMsg(
-+struct sk_buff *skb, /* linux' socket buffer */
-+char *str) /* additional msg string */
- {
-- int msglen;
-+ int msglen = (skb->len > 64) ? 64 : skb->len;
-
- if (skb == NULL) {
- printk("DumpMsg(): NULL-Message\n");
-@@ -4778,19 +6114,14 @@ static void DumpMsg(struct sk_buff *skb,
- return;
- }
-
-- msglen = skb->len;
-- if (msglen > 64)
-- msglen = 64;
--
-- printk("--- Begin of message from %s , len %d (from %d) ----\n", str, msglen, skb->len);
--
-+ printk("DumpMsg: PhysPage: %p\n",
-+ page_address(virt_to_page(skb->data)));
-+ printk("--- Begin of message from %s , len %d (from %d) ----\n",
-+ str, msglen, skb->len);
- DumpData((char *)skb->data, msglen);
--
- printk("------- End of message ---------\n");
- } /* DumpMsg */
-
--
--
- /*****************************************************************************
- *
- * DumpData - print a data area
-@@ -4802,23 +6133,22 @@ static void DumpMsg(struct sk_buff *skb,
- * Returns: N/A
- *
- */
--static void DumpData(char *p, int size)
--{
--register int i;
--int haddr, addr;
--char hex_buffer[180];
--char asc_buffer[180];
--char HEXCHAR[] = "0123456789ABCDEF";
--
-- addr = 0;
-- haddr = 0;
-- hex_buffer[0] = 0;
-- asc_buffer[0] = 0;
-+static void DumpData(
-+char *p, /* pointer to area containing the data */
-+int size) /* the size of that data area in bytes */
-+{
-+ register int i;
-+ int haddr = 0, addr = 0;
-+ char hex_buffer[180] = { '\0' };
-+ char asc_buffer[180] = { '\0' };
-+ char HEXCHAR[] = "0123456789ABCDEF";
-+
- for (i=0; i < size; ) {
-- if (*p >= '0' && *p <='z')
-+ if (*p >= '0' && *p <='z') {
- asc_buffer[addr] = *p;
-- else
-+ } else {
- asc_buffer[addr] = '.';
-+ }
- addr++;
- asc_buffer[addr] = 0;
- hex_buffer[haddr] = HEXCHAR[(*p & 0xf0) >> 4];
-@@ -4844,27 +6174,24 @@ char HEXCHAR[] = "0123456789ABCDEF";
- * DumpLong - print a data area as long values
- *
- * Description:
-- * This function prints a area of data to the system logfile/to the
-+ * This function prints a long variable to the system logfile/to the
- * console.
- *
- * Returns: N/A
- *
- */
--static void DumpLong(char *pc, int size)
--{
--register int i;
--int haddr, addr;
--char hex_buffer[180];
--char asc_buffer[180];
--char HEXCHAR[] = "0123456789ABCDEF";
--long *p;
--int l;
--
-- addr = 0;
-- haddr = 0;
-- hex_buffer[0] = 0;
-- asc_buffer[0] = 0;
-- p = (long*) pc;
-+static void DumpLong(
-+char *pc, /* location of the variable to print */
-+int size) /* how large is the variable? */
-+{
-+ register int i;
-+ int haddr = 0, addr = 0;
-+ char hex_buffer[180] = { '\0' };
-+ char asc_buffer[180] = { '\0' };
-+ char HEXCHAR[] = "0123456789ABCDEF";
-+ long *p = (long*) pc;
-+ int l;
-+
- for (i=0; i < size; ) {
- l = (long) *p;
- hex_buffer[haddr] = HEXCHAR[(l >> 28) & 0xf];
-@@ -4898,330 +6225,9 @@ int l;
-
- #endif
-
--static int __devinit skge_probe_one(struct pci_dev *pdev,
-- const struct pci_device_id *ent)
--{
-- SK_AC *pAC;
-- DEV_NET *pNet = NULL;
-- struct net_device *dev = NULL;
--#ifdef CONFIG_PROC_FS
-- struct proc_dir_entry *pProcFile;
--#endif
-- static int boards_found = 0;
-- int error = -ENODEV;
--
-- if (pci_enable_device(pdev))
-- goto out;
--
-- /* Configure DMA attributes. */
-- if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL) &&
-- pci_set_dma_mask(pdev, (u64) 0xffffffff))
-- goto out_disable_device;
--
--
-- if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) {
-- printk(KERN_ERR "Unable to allocate etherdev "
-- "structure!\n");
-- goto out_disable_device;
-- }
--
-- pNet = dev->priv;
-- pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
-- if (!pNet->pAC) {
-- printk(KERN_ERR "Unable to allocate adapter "
-- "structure!\n");
-- goto out_free_netdev;
-- }
--
-- memset(pNet->pAC, 0, sizeof(SK_AC));
-- pAC = pNet->pAC;
-- pAC->PciDev = pdev;
-- pAC->PciDevId = pdev->device;
-- pAC->dev[0] = dev;
-- pAC->dev[1] = dev;
-- sprintf(pAC->Name, "SysKonnect SK-98xx");
-- pAC->CheckQueue = SK_FALSE;
--
-- pNet->Mtu = 1500;
-- pNet->Up = 0;
-- dev->irq = pdev->irq;
-- error = SkGeInitPCI(pAC);
-- if (error) {
-- printk("SKGE: PCI setup failed: %i\n", error);
-- goto out_free_netdev;
-- }
--
-- SET_MODULE_OWNER(dev);
-- dev->open = &SkGeOpen;
-- dev->stop = &SkGeClose;
-- dev->hard_start_xmit = &SkGeXmit;
-- dev->get_stats = &SkGeStats;
-- dev->set_multicast_list = &SkGeSetRxMode;
-- dev->set_mac_address = &SkGeSetMacAddr;
-- dev->do_ioctl = &SkGeIoctl;
-- dev->change_mtu = &SkGeChangeMtu;
-- dev->flags &= ~IFF_RUNNING;
-- SET_NETDEV_DEV(dev, &pdev->dev);
--
--#ifdef SK_ZEROCOPY
--#ifdef USE_SK_TX_CHECKSUM
-- if (pAC->ChipsetType) {
-- /* Use only if yukon hardware */
-- /* SK and ZEROCOPY - fly baby... */
-- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
-- }
--#endif
--#endif
--
-- pAC->Index = boards_found++;
--
-- if (SkGeBoardInit(dev, pAC))
-- goto out_free_netdev;
--
-- /* Register net device */
-- if (register_netdev(dev)) {
-- printk(KERN_ERR "SKGE: Could not register device.\n");
-- goto out_free_resources;
-- }
--
-- /* Print adapter specific string from vpd */
-- ProductStr(pAC);
-- printk("%s: %s\n", dev->name, pAC->DeviceStr);
--
-- /* Print configuration settings */
-- printk(" PrefPort:%c RlmtMode:%s\n",
-- 'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber,
-- (pAC->RlmtMode==0) ? "Check Link State" :
-- ((pAC->RlmtMode==1) ? "Check Link State" :
-- ((pAC->RlmtMode==3) ? "Check Local Port" :
-- ((pAC->RlmtMode==7) ? "Check Segmentation" :
-- ((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error")))));
--
-- SkGeYellowLED(pAC, pAC->IoBase, 1);
--
--
-- memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6);
--
--#ifdef CONFIG_PROC_FS
-- pProcFile = create_proc_entry(dev->name, S_IRUGO, pSkRootDir);
-- if (pProcFile) {
-- pProcFile->proc_fops = &sk_proc_fops;
-- pProcFile->data = dev;
-- pProcFile->owner = THIS_MODULE;
-- }
--#endif
--
-- pNet->PortNr = 0;
-- pNet->NetNr = 0;
--
-- boards_found++;
--
-- /* More then one port found */
-- if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-- if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) {
-- printk(KERN_ERR "Unable to allocate etherdev "
-- "structure!\n");
-- goto out;
-- }
--
-- pAC->dev[1] = dev;
-- pNet = dev->priv;
-- pNet->PortNr = 1;
-- pNet->NetNr = 1;
-- pNet->pAC = pAC;
-- pNet->Mtu = 1500;
-- pNet->Up = 0;
--
-- dev->open = &SkGeOpen;
-- dev->stop = &SkGeClose;
-- dev->hard_start_xmit = &SkGeXmit;
-- dev->get_stats = &SkGeStats;
-- dev->set_multicast_list = &SkGeSetRxMode;
-- dev->set_mac_address = &SkGeSetMacAddr;
-- dev->do_ioctl = &SkGeIoctl;
-- dev->change_mtu = &SkGeChangeMtu;
-- dev->flags &= ~IFF_RUNNING;
--
--#ifdef SK_ZEROCOPY
--#ifdef USE_SK_TX_CHECKSUM
-- if (pAC->ChipsetType) {
-- /* SG and ZEROCOPY - fly baby... */
-- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
-- }
--#endif
--#endif
--
-- if (register_netdev(dev)) {
-- printk(KERN_ERR "SKGE: Could not register device.\n");
-- free_netdev(dev);
-- pAC->dev[1] = pAC->dev[0];
-- } else {
--#ifdef CONFIG_PROC_FS
-- pProcFile = create_proc_entry(dev->name, S_IRUGO,
-- pSkRootDir);
-- if (pProcFile) {
-- pProcFile->proc_fops = &sk_proc_fops;
-- pProcFile->data = dev;
-- pProcFile->owner = THIS_MODULE;
-- }
--#endif
--
-- memcpy(&dev->dev_addr,
-- &pAC->Addr.Net[1].CurrentMacAddress, 6);
--
-- printk("%s: %s\n", dev->name, pAC->DeviceStr);
-- printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
-- }
-- }
--
-- /* Save the hardware revision */
-- pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) +
-- (pAC->GIni.GIPciHwRev & 0x0F);
--
-- /* Set driver globals */
-- pAC->Pnmi.pDriverFileName = DRIVER_FILE_NAME;
-- pAC->Pnmi.pDriverReleaseDate = DRIVER_REL_DATE;
--
-- memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA));
-- memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA));
--
-- pci_set_drvdata(pdev, dev);
-- return 0;
--
-- out_free_resources:
-- FreeResources(dev);
-- out_free_netdev:
-- free_netdev(dev);
-- out_disable_device:
-- pci_disable_device(pdev);
-- out:
-- return error;
--}
--
--static void __devexit skge_remove_one(struct pci_dev *pdev)
--{
-- struct net_device *dev = pci_get_drvdata(pdev);
-- DEV_NET *pNet = (DEV_NET *) dev->priv;
-- SK_AC *pAC = pNet->pAC;
-- int have_second_mac = 0;
--
-- if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2)
-- have_second_mac = 1;
--
-- remove_proc_entry(dev->name, pSkRootDir);
-- unregister_netdev(dev);
-- if (have_second_mac) {
-- remove_proc_entry(pAC->dev[1]->name, pSkRootDir);
-- unregister_netdev(pAC->dev[1]);
-- }
--
-- SkGeYellowLED(pAC, pAC->IoBase, 0);
--
-- if (pAC->BoardLevel == SK_INIT_RUN) {
-- SK_EVPARA EvPara;
-- unsigned long Flags;
--
-- /* board is still alive */
-- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-- EvPara.Para32[0] = 0;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- EvPara.Para32[0] = 1;
-- EvPara.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara);
-- SkEventDispatcher(pAC, pAC->IoBase);
-- /* disable interrupts */
-- SK_OUT32(pAC->IoBase, B0_IMSK, 0);
-- SkGeDeInit(pAC, pAC->IoBase);
-- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-- pAC->BoardLevel = SK_INIT_DATA;
-- /* We do NOT check here, if IRQ was pending, of course*/
-- }
--
-- if (pAC->BoardLevel == SK_INIT_IO) {
-- /* board is still alive */
-- SkGeDeInit(pAC, pAC->IoBase);
-- pAC->BoardLevel = SK_INIT_DATA;
-- }
--
-- FreeResources(dev);
-- free_netdev(dev);
-- if (have_second_mac)
-- free_netdev(pAC->dev[1]);
-- kfree(pAC);
--}
--
--static struct pci_device_id skge_pci_tbl[] = {
-- { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_SYSKONNECT, 0x4300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_SYSKONNECT, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_DLINK, 0x4c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_MARVELL, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
--#if 0 /* don't handle Yukon2 cards at the moment -- mlindner@syskonnect.de */
-- { PCI_VENDOR_ID_MARVELL, 0x4360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_MARVELL, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
--#endif
-- { PCI_VENDOR_ID_MARVELL, 0x5005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_CNET, 0x434e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { PCI_VENDOR_ID_LINKSYS, 0x1064, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { 0, }
--};
--
--/*****************************************************************************
-+/*******************************************************************************
- *
-- * Avoid PCI ID confusion w/ skge by limiting advertised IDs so we don't
-- * needlessly overlap...
-+ * End of file
- *
-- */
--static struct pci_device_id advertised_skge_pci_tbl[] = {
-- { PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-- { 0, }
--};
--
--MODULE_DEVICE_TABLE(pci, advertised_skge_pci_tbl);
--
--static struct pci_driver skge_driver = {
-- .name = "skge",
-- .id_table = skge_pci_tbl,
-- .probe = skge_probe_one,
-- .remove = __devexit_p(skge_remove_one),
--};
--
--static int __init skge_init(void)
--{
-- int error;
--
--#ifdef CONFIG_PROC_FS
-- memcpy(&SK_Root_Dir_entry, BOOT_STRING, sizeof(SK_Root_Dir_entry) - 1);
--
-- pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
-- if (!pSkRootDir) {
-- printk(KERN_WARNING "Unable to create /proc/net/%s",
-- SK_Root_Dir_entry);
-- return -ENOMEM;
-- }
-- pSkRootDir->owner = THIS_MODULE;
--#endif
--
-- error = pci_module_init(&skge_driver);
-- if (error) {
--#ifdef CONFIG_PROC_FS
-- remove_proc_entry(pSkRootDir->name, proc_net);
--#endif
-- }
--
-- return error;
--}
--
--static void __exit skge_exit(void)
--{
-- pci_unregister_driver(&skge_driver);
--#ifdef CONFIG_PROC_FS
-- remove_proc_entry(pSkRootDir->name, proc_net);
--#endif
--}
-+ ******************************************************************************/
-
--module_init(skge_init);
--module_exit(skge_exit);
-diff -Nurap ./drivers/net/sk98lin.sk98/skgehwt.c ./drivers/net/sk98lin/skgehwt.c
---- ./drivers/net/sk98lin.sk98/skgehwt.c 2004-10-19 01:55:07.000000000 +0400
-+++ ./drivers/net/sk98lin/skgehwt.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skgehwt.c
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.15 $
-- * Date: $Date: 2003/09/16 13:41:23 $
-+ * Version: $Revision: 2.2 $
-+ * Date: $Date: 2004/05/28 13:39:04 $
- * Purpose: Hardware Timer
- *
- ******************************************************************************/
-@@ -11,7 +11,7 @@
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2004 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -27,7 +27,7 @@
- */
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skgehwt.c,v 1.15 2003/09/16 13:41:23 rschmidt Exp $ (C) Marvell.";
-+ "@(#) $Id: skgehwt.c,v 2.2 2004/05/28 13:39:04 rschmidt Exp $ (C) Marvell.";
- #endif
-
- #include "h/skdrv1st.h" /* Driver Specific Definitions */
-@@ -44,10 +44,10 @@ intro()
- /*
- * Prototypes of local functions.
- */
--#define SK_HWT_MAX (65000)
-+#define SK_HWT_MAX 65000UL * 160 /* ca. 10 sec. */
-
- /* correction factor */
--#define SK_HWT_FAC (1000 * (SK_U32)pAC->GIni.GIHstClkFact / 100)
-+#define SK_HWT_FAC (10 * (SK_U32)pAC->GIni.GIHstClkFact / 16)
-
- /*
- * Initialize hardware timer.
-@@ -73,29 +73,21 @@ SK_IOC Ioc) /* IoContext */
- void SkHwtStart(
- SK_AC *pAC, /* Adapters context */
- SK_IOC Ioc, /* IoContext */
--SK_U32 Time) /* Time in units of 16us to load the timer with. */
-+SK_U32 Time) /* Time in usec to load the timer */
- {
-- SK_U32 Cnt;
--
- if (Time > SK_HWT_MAX)
- Time = SK_HWT_MAX;
-
- pAC->Hwt.TStart = Time;
- pAC->Hwt.TStop = 0L;
-
-- Cnt = Time;
--
-- /*
-- * if time < 16 us
-- * time = 16 us
-- */
-- if (!Cnt) {
-- Cnt++;
-+ if (!Time) {
-+ Time = 1L;
- }
-
-- SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC);
--
-- SK_OUT16(Ioc, B2_TI_CTRL, TIM_START); /* Start timer. */
-+ SK_OUT32(Ioc, B2_TI_INI, Time * SK_HWT_FAC);
-+
-+ SK_OUT16(Ioc, B2_TI_CTRL, TIM_START); /* Start timer */
-
- pAC->Hwt.TActive = SK_TRUE;
- }
-@@ -109,13 +101,12 @@ SK_AC *pAC, /* Adapters context */
- SK_IOC Ioc) /* IoContext */
- {
- SK_OUT16(Ioc, B2_TI_CTRL, TIM_STOP);
--
-+
- SK_OUT16(Ioc, B2_TI_CTRL, TIM_CLR_IRQ);
-
- pAC->Hwt.TActive = SK_FALSE;
- }
-
--
- /*
- * Stop hardware timer and read time elapsed since last start.
- *
-@@ -129,6 +120,9 @@ SK_IOC Ioc) /* IoContext */
- {
- SK_U32 TRead;
- SK_U32 IStatus;
-+ SK_U32 TimerInt;
-+
-+ TimerInt = CHIP_ID_YUKON_2(pAC) ? Y2_IS_TIMINT : IS_TIMINT;
-
- if (pAC->Hwt.TActive) {
-
-@@ -139,15 +133,15 @@ SK_IOC Ioc) /* IoContext */
-
- SK_IN32(Ioc, B0_ISRC, &IStatus);
-
-- /* Check if timer expired (or wraped around) */
-- if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) {
--
-+ /* Check if timer expired (or wrapped around) */
-+ if ((TRead > pAC->Hwt.TStart) || ((IStatus & TimerInt) != 0)) {
-+
- SkHwtStop(pAC, Ioc);
--
-+
- pAC->Hwt.TStop = pAC->Hwt.TStart;
- }
- else {
--
-+
- pAC->Hwt.TStop = pAC->Hwt.TStart - TRead;
- }
- }
-@@ -162,9 +156,9 @@ SK_AC *pAC, /* Adapters context */
- SK_IOC Ioc) /* IoContext */
- {
- SkHwtStop(pAC, Ioc);
--
-+
- pAC->Hwt.TStop = pAC->Hwt.TStart;
--
-+
- SkTimerDone(pAC, Ioc);
- }
-
-diff -Nurap ./drivers/net/sk98lin.sk98/skgeinit.c ./drivers/net/sk98lin/skgeinit.c
---- ./drivers/net/sk98lin.sk98/skgeinit.c 2004-10-19 01:54:30.000000000 +0400
-+++ ./drivers/net/sk98lin/skgeinit.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgeinit.c
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.97 $
-- * Date: $Date: 2003/10/02 16:45:31 $
-+ * Version: $Revision: 2.93 $
-+ * Date: $Date: 2005/12/14 16:11:34 $
- * Purpose: Contains functions to initialize the adapter
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -31,7 +32,7 @@
-
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skgeinit.c,v 1.97 2003/10/02 16:45:31 rschmidt Exp $ (C) Marvell.";
-+ "@(#) $Id: skgeinit.c,v 2.93 2005/12/14 16:11:34 ibrueder Exp $ (C) Marvell.";
- #endif
-
- struct s_QOffTab {
-@@ -39,6 +40,7 @@ struct s_QOffTab {
- int XsQOff; /* Sync Tx Queue Address Offset */
- int XaQOff; /* Async Tx Queue Address Offset */
- };
-+
- static struct s_QOffTab QOffTab[] = {
- {Q_R1, Q_XS1, Q_XA1}, {Q_R2, Q_XS2, Q_XA2}
- };
-@@ -57,6 +59,97 @@ static struct s_Config OemConfig = {
- #endif
- };
-
-+#ifndef SK_SLIM
-+/******************************************************************************
-+ *
-+ * SkGePortVlan() - Enable / Disable VLAN support
-+ *
-+ * Description:
-+ * Enable or disable the VLAN support of the selected port.
-+ * The new configuration is *not* saved over any SkGeStopPort() and
-+ * SkGeInitPort() calls.
-+ * Currently this function is only supported on Yukon-2/EC adapters.
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+void SkGePortVlan(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port number */
-+SK_BOOL Enable) /* Flag */
-+{
-+ SK_U32 RxCtrl;
-+ SK_U32 TxCtrl;
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (Enable) {
-+ RxCtrl = RX_VLAN_STRIP_ON;
-+ TxCtrl = TX_VLAN_TAG_ON;
-+ }
-+ else {
-+ RxCtrl = RX_VLAN_STRIP_OFF;
-+ TxCtrl = TX_VLAN_TAG_OFF;
-+ }
-+
-+ SK_OUT32(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), RxCtrl);
-+ SK_OUT32(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), TxCtrl);
-+ }
-+} /* SkGePortVlan */
-+
-+
-+/******************************************************************************
-+ *
-+ * SkGeRxRss() - Enable / Disable RSS Hash Calculation
-+ *
-+ * Description:
-+ * Enable or disable the RSS hash calculation of the selected port.
-+ * The new configuration is *not* saved over any SkGeStopPort() and
-+ * SkGeInitPort() calls.
-+ * Currently this function is only supported on Yukon-2/EC adapters.
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+void SkGeRxRss(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port number */
-+SK_BOOL Enable) /* Flag */
-+{
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SK_OUT32(IoC, Q_ADDR(pAC->GIni.GP[Port].PRxQOff, Q_CSR),
-+ Enable ? BMU_ENA_RX_RSS_HASH : BMU_DIS_RX_RSS_HASH);
-+ }
-+} /* SkGeRxRss */
-+
-+
-+/******************************************************************************
-+ *
-+ * SkGeRxCsum() - Enable / Disable Receive Checksum
-+ *
-+ * Description:
-+ * Enable or disable the checksum of the selected port.
-+ * The new configuration is *not* saved over any SkGeStopPort() and
-+ * SkGeInitPort() calls.
-+ * Currently this function is only supported on Yukon-2/EC adapters.
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+void SkGeRxCsum(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port number */
-+SK_BOOL Enable) /* Flag */
-+{
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ SK_OUT32(IoC, Q_ADDR(pAC->GIni.GP[Port].PRxQOff, Q_CSR),
-+ Enable ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
-+ }
-+} /* SkGeRxCsum */
-+#endif /* !SK_SLIM */
-+
- /******************************************************************************
- *
- * SkGePollRxD() - Enable / Disable Descriptor Polling of RxD Ring
-@@ -71,8 +164,8 @@ static struct s_Config OemConfig = {
- * nothing
- */
- void SkGePollRxD(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL PollRxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */
- {
-@@ -80,8 +173,8 @@ SK_BOOL PollRxD) /* SK_TRUE (enable pol.
-
- pPrt = &pAC->GIni.GP[Port];
-
-- SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), (PollRxD) ?
-- CSR_ENA_POL : CSR_DIS_POL);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), (SK_U32)((PollRxD) ?
-+ CSR_ENA_POL : CSR_DIS_POL));
- } /* SkGePollRxD */
-
-
-@@ -99,8 +192,8 @@ SK_BOOL PollRxD) /* SK_TRUE (enable pol.
- * nothing
- */
- void SkGePollTxD(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL PollTxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */
- {
-@@ -114,13 +207,13 @@ SK_BOOL PollTxD) /* SK_TRUE (enable pol.
- if (pPrt->PXSQSize != 0) {
- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), DWord);
- }
--
-+
- if (pPrt->PXAQSize != 0) {
- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), DWord);
- }
- } /* SkGePollTxD */
-
--
-+#ifndef SK_SLIM
- /******************************************************************************
- *
- * SkGeYellowLED() - Switch the yellow LED on or off.
-@@ -135,20 +228,30 @@ SK_BOOL PollTxD) /* SK_TRUE (enable pol.
- * nothing
- */
- void SkGeYellowLED(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int State) /* yellow LED state, 0 = OFF, 0 != ON */
- {
-+ int LedReg;
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* different mapping on Yukon-2 */
-+ LedReg = B0_CTST + 1;
-+ }
-+ else {
-+ LedReg = B0_LED;
-+ }
-+
- if (State == 0) {
-- /* Switch yellow LED OFF */
-- SK_OUT8(IoC, B0_LED, LED_STAT_OFF);
-+ /* Switch state LED OFF */
-+ SK_OUT8(IoC, LedReg, LED_STAT_OFF);
- }
- else {
-- /* Switch yellow LED ON */
-- SK_OUT8(IoC, B0_LED, LED_STAT_ON);
-+ /* Switch state LED ON */
-+ SK_OUT8(IoC, LedReg, LED_STAT_ON);
- }
- } /* SkGeYellowLED */
--
-+#endif /* !SK_SLIM */
-
- #if (!defined(SK_SLIM) || defined(GENESIS))
- /******************************************************************************
-@@ -169,8 +272,8 @@ int State) /* yellow LED state, 0 = OF
- * nothing
- */
- void SkGeXmitLED(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Led, /* offset to the LED Init Value register */
- int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */
- {
-@@ -195,18 +298,17 @@ int Mode) /* Mode may be SK_LED_DIS, S
- */
- SK_OUT32(IoC, Led + XMIT_LED_CNT, 0);
- SK_OUT8(IoC, Led + XMIT_LED_TST, LED_T_OFF);
-- break;
- }
--
-+
- /*
-- * 1000BT: The Transmit LED is driven by the PHY.
-+ * 1000BT: the Transmit LED is driven by the PHY.
- * But the default LED configuration is used for
- * Level One and Broadcom PHYs.
-- * (Broadcom: It may be that PHY_B_PEC_EN_LTR has to be set.)
-- * (In this case it has to be added here. But we will see. XXX)
-+ * (Broadcom: It may be that PHY_B_PEC_EN_LTR has to be set.
-+ * In this case it has to be added here.)
- */
- } /* SkGeXmitLED */
--#endif /* !SK_SLIM || GENESIS */
-+#endif /* !SK_SLIM || GENESIS */
-
-
- /******************************************************************************
-@@ -227,7 +329,7 @@ int Mode) /* Mode may be SK_LED_DIS, S
- * 1: configuration error
- */
- static int DoCalcAddr(
--SK_AC *pAC, /* adapter context */
-+SK_AC *pAC, /* Adapter Context */
- SK_GEPORT SK_FAR *pPrt, /* port index */
- int QuSize, /* size of the queue to configure in kB */
- SK_U32 SK_FAR *StartVal, /* start value for address calculation */
-@@ -264,12 +366,35 @@ SK_U32 SK_FAR *QuEndAddr) /* end addres
-
- /******************************************************************************
- *
-+ * SkGeRoundQueueSize() - Round the given queue size to the adpaters QZ units
-+ *
-+ * Description:
-+ * This function rounds the given queue size in kBs to adapter specific
-+ * queue size units (Genesis and Yukon: 8 kB, Yukon-2/EC: 1 kB).
-+ *
-+ * Returns:
-+ * the rounded queue size in kB
-+ */
-+static int SkGeRoundQueueSize(
-+SK_AC *pAC, /* Adapter Context */
-+int QueueSizeKB) /* Queue size in kB */
-+{
-+ int QueueSizeSteps;
-+
-+ QueueSizeSteps = (CHIP_ID_YUKON_2(pAC)) ? QZ_STEP_Y2 : QZ_STEP;
-+
-+ return((QueueSizeKB + QueueSizeSteps - 1) & ~(QueueSizeSteps - 1));
-+} /* SkGeRoundQueueSize */
-+
-+
-+/******************************************************************************
-+ *
- * SkGeInitAssignRamToQueues() - allocate default queue sizes
- *
- * Description:
- * This function assigns the memory to the different queues and ports.
- * When DualNet is set to SK_TRUE all ports get the same amount of memory.
-- * Otherwise the first port gets most of the memory and all the
-+ * Otherwise the first port gets most of the memory and all the
- * other ports just the required minimum.
- * This function can only be called when pAC->GIni.GIRamSize and
- * pAC->GIni.GIMacsFound have been initialized, usually this happens
-@@ -282,102 +407,146 @@ SK_U32 SK_FAR *QuEndAddr) /* end addres
- */
-
- int SkGeInitAssignRamToQueues(
--SK_AC *pAC, /* Adapter context */
-+SK_AC *pAC, /* Adapter Context */
- int ActivePort, /* Active Port in RLMT mode */
--SK_BOOL DualNet) /* adapter context */
-+SK_BOOL DualNet) /* Dual Net active */
- {
- int i;
- int UsedKilobytes; /* memory already assigned */
- int ActivePortKilobytes; /* memory available for active port */
-- SK_GEPORT *pGePort;
--
-- UsedKilobytes = 0;
-+ int MinQueueSize; /* min. memory for queues */
-+ int TotalRamSize; /* total memory for queues */
-+ SK_BOOL DualPortYukon2;
-+ SK_GEPORT *pPrt;
-
- if (ActivePort >= pAC->GIni.GIMacsFound) {
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
- ("SkGeInitAssignRamToQueues: ActivePort (%d) invalid\n",
- ActivePort));
- return(1);
- }
-- if (((pAC->GIni.GIMacsFound * (SK_MIN_RXQ_SIZE + SK_MIN_TXQ_SIZE)) +
-- ((RAM_QUOTA_SYNC == 0) ? 0 : SK_MIN_TXQ_SIZE)) > pAC->GIni.GIRamSize) {
-+
-+ DualPortYukon2 = (CHIP_ID_YUKON_2(pAC) && pAC->GIni.GIMacsFound == 2);
-+
-+ TotalRamSize = pAC->GIni.GIRamSize;
-+
-+ if (DualPortYukon2) {
-+ TotalRamSize *= 2;
-+ }
-+
-+ MinQueueSize = SK_MIN_RXQ_SIZE + SK_MIN_TXQ_SIZE;
-+
-+ if (MinQueueSize > pAC->GIni.GIRamSize) {
-+ MinQueueSize = pAC->GIni.GIRamSize;
-+ }
-+
-+ if ((pAC->GIni.GIMacsFound * MinQueueSize +
-+ RAM_QUOTA_SYNC * SK_MIN_TXQ_SIZE) > TotalRamSize) {
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
- ("SkGeInitAssignRamToQueues: Not enough memory (%d)\n",
-- pAC->GIni.GIRamSize));
-+ TotalRamSize));
- return(2);
- }
-
- if (DualNet) {
- /* every port gets the same amount of memory */
-- ActivePortKilobytes = pAC->GIni.GIRamSize / pAC->GIni.GIMacsFound;
-+ ActivePortKilobytes = TotalRamSize / pAC->GIni.GIMacsFound;
-+
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-
-- pGePort = &pAC->GIni.GP[i];
--
-+ pPrt = &pAC->GIni.GP[i];
-+
-+ if (DualPortYukon2) {
-+ ActivePortKilobytes = pAC->GIni.GIRamSize;
-+ }
- /* take away the minimum memory for active queues */
-- ActivePortKilobytes -= (SK_MIN_RXQ_SIZE + SK_MIN_TXQ_SIZE);
-+ ActivePortKilobytes -= MinQueueSize;
-
- /* receive queue gets the minimum + 80% of the rest */
-- pGePort->PRxQSize = (int) (ROUND_QUEUE_SIZE_KB((
-- ActivePortKilobytes * (unsigned long) RAM_QUOTA_RX) / 100))
-+ pPrt->PRxQSize = SkGeRoundQueueSize(pAC,
-+ (int)((long)ActivePortKilobytes * RAM_QUOTA_RX) / 100)
- + SK_MIN_RXQ_SIZE;
-
-- ActivePortKilobytes -= (pGePort->PRxQSize - SK_MIN_RXQ_SIZE);
-+ ActivePortKilobytes -= (pPrt->PRxQSize - SK_MIN_RXQ_SIZE);
-
- /* synchronous transmit queue */
-- pGePort->PXSQSize = 0;
-+ pPrt->PXSQSize = 0;
-
- /* asynchronous transmit queue */
-- pGePort->PXAQSize = (int) ROUND_QUEUE_SIZE_KB(ActivePortKilobytes +
-- SK_MIN_TXQ_SIZE);
-+ pPrt->PXAQSize = SkGeRoundQueueSize(pAC,
-+ ActivePortKilobytes + SK_MIN_TXQ_SIZE);
- }
- }
-- else {
-- /* Rlmt Mode or single link adapter */
-+ else { /* RLMT Mode or single link adapter */
-+
-+ UsedKilobytes = 0;
-
-- /* Set standby queue size defaults for all standby ports */
-+ /* set standby queue size defaults for all standby ports */
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-
- if (i != ActivePort) {
-- pGePort = &pAC->GIni.GP[i];
-+ pPrt = &pAC->GIni.GP[i];
-
-- pGePort->PRxQSize = SK_MIN_RXQ_SIZE;
-- pGePort->PXAQSize = SK_MIN_TXQ_SIZE;
-- pGePort->PXSQSize = 0;
-+ if (DualPortYukon2) {
-+ pPrt->PRxQSize = SkGeRoundQueueSize(pAC,
-+ (int)((long)(pAC->GIni.GIRamSize - MinQueueSize) *
-+ RAM_QUOTA_RX) / 100) + SK_MIN_RXQ_SIZE;
-+
-+ pPrt->PXAQSize = pAC->GIni.GIRamSize - pPrt->PRxQSize;
-+ }
-+ else {
-+ pPrt->PRxQSize = SK_MIN_RXQ_SIZE;
-+ pPrt->PXAQSize = SK_MIN_TXQ_SIZE;
-+ }
-+ pPrt->PXSQSize = 0;
-
- /* Count used RAM */
-- UsedKilobytes += pGePort->PRxQSize + pGePort->PXAQSize;
-+ UsedKilobytes += pPrt->PRxQSize + pPrt->PXAQSize;
- }
- }
- /* what's left? */
-- ActivePortKilobytes = pAC->GIni.GIRamSize - UsedKilobytes;
-+ ActivePortKilobytes = TotalRamSize - UsedKilobytes;
-
- /* assign it to the active port */
- /* first take away the minimum memory */
-- ActivePortKilobytes -= (SK_MIN_RXQ_SIZE + SK_MIN_TXQ_SIZE);
-- pGePort = &pAC->GIni.GP[ActivePort];
-+ ActivePortKilobytes -= MinQueueSize;
-+ pPrt = &pAC->GIni.GP[ActivePort];
-+
-+ /* receive queue gets 80% of the rest */
-+ pPrt->PRxQSize = SkGeRoundQueueSize(pAC,
-+ (int)((long)ActivePortKilobytes * RAM_QUOTA_RX) / 100);
-
-- /* receive queue get's the minimum + 80% of the rest */
-- pGePort->PRxQSize = (int) (ROUND_QUEUE_SIZE_KB((ActivePortKilobytes *
-- (unsigned long) RAM_QUOTA_RX) / 100)) + SK_MIN_RXQ_SIZE;
-+ ActivePortKilobytes -= pPrt->PRxQSize;
-
-- ActivePortKilobytes -= (pGePort->PRxQSize - SK_MIN_RXQ_SIZE);
-+ /* add the minimum memory for Rx queue */
-+ pPrt->PRxQSize += MinQueueSize/2;
-
- /* synchronous transmit queue */
-- pGePort->PXSQSize = 0;
-+ pPrt->PXSQSize = 0;
-
-- /* asynchronous transmit queue */
-- pGePort->PXAQSize = (int) ROUND_QUEUE_SIZE_KB(ActivePortKilobytes) +
-- SK_MIN_TXQ_SIZE;
-+ /* asynchronous transmit queue gets 20% of the rest */
-+ pPrt->PXAQSize = SkGeRoundQueueSize(pAC, ActivePortKilobytes) +
-+ /* add the minimum memory for Tx queue */
-+ MinQueueSize/2;
- }
--#ifdef VCPU
-- VCPUprintf(0, "PRxQSize=%u, PXSQSize=%u, PXAQSize=%u\n",
-- pGePort->PRxQSize, pGePort->PXSQSize, pGePort->PXAQSize);
--#endif /* VCPU */
-+
-+#ifdef DEBUG
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+
-+ pPrt = &pAC->GIni.GP[i];
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Port %d: RxQSize=%u, TxAQSize=%u, TxSQSize=%u\n",
-+ i, pPrt->PRxQSize, pPrt->PXAQSize, pPrt->PXSQSize));
-+ }
-+#endif /* DEBUG */
-
- return(0);
- } /* SkGeInitAssignRamToQueues */
-
-+
- /******************************************************************************
- *
- * SkGeCheckQSize() - Checks the Adapters Queue Size Configuration
-@@ -388,12 +557,12 @@ SK_BOOL DualNet) /* adapter context */
- * used ports.
- * This requirements must be fullfilled to have a valid configuration:
- * - The size of all queues must not exceed GIRamSize.
-- * - The queue sizes must be specified in units of 8 kB.
-+ * - The queue sizes must be specified in units of 8 kB (Genesis & Yukon).
- * - The size of Rx queues of available ports must not be
-- * smaller than 16 kB.
-+ * smaller than 16 kB (Genesis & Yukon) resp. 10 kB (Yukon-2).
- * - The size of at least one Tx queue (synch. or asynch.)
-- * of available ports must not be smaller than 16 kB
-- * when Jumbo Frames are used.
-+ * of available ports must not be smaller than 16 kB (Genesis & Yukon),
-+ * resp. 10 kB (Yukon-2) when Jumbo Frames are used.
- * - The RAM start and end addresses must not be changed
- * for ports which are already initialized.
- * Furthermore SkGeCheckQSize() defines the Start and End Addresses
-@@ -404,7 +573,7 @@ SK_BOOL DualNet) /* adapter context */
- * 1: Queue Size Configuration invalid
- */
- static int SkGeCheckQSize(
--SK_AC *pAC, /* adapter context */
-+SK_AC *pAC, /* Adapter Context */
- int Port) /* port index */
- {
- SK_GEPORT *pPrt;
-@@ -414,55 +583,68 @@ int Port) /* port index */
- SK_U32 StartAddr;
- #ifndef SK_SLIM
- int UsedMem; /* total memory used (max. found ports) */
--#endif
-+#endif
-
- Rtv = 0;
--
-+
- #ifndef SK_SLIM
-
- UsedMem = 0;
-+
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
- pPrt = &pAC->GIni.GP[i];
-
-- if ((pPrt->PRxQSize & QZ_UNITS) != 0 ||
-- (pPrt->PXSQSize & QZ_UNITS) != 0 ||
-- (pPrt->PXAQSize & QZ_UNITS) != 0) {
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ UsedMem = 0;
-+ }
-+ else if (((pPrt->PRxQSize & QZ_UNITS) != 0 ||
-+ (pPrt->PXSQSize & QZ_UNITS) != 0 ||
-+ (pPrt->PXAQSize & QZ_UNITS) != 0)) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG);
- return(1);
- }
-
-- if (i == Port && pPrt->PRxQSize < SK_MIN_RXQ_SIZE) {
-+#ifndef SK_DIAG
-+ if (i == Port && pAC->GIni.GIRamSize > SK_MIN_RXQ_SIZE &&
-+ pPrt->PRxQSize < SK_MIN_RXQ_SIZE) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E011, SKERR_HWI_E011MSG);
- return(1);
- }
--
-+
- /*
- * the size of at least one Tx queue (synch. or asynch.) has to be > 0.
- * if Jumbo Frames are used, this size has to be >= 16 kB.
- */
- if ((i == Port && pPrt->PXSQSize == 0 && pPrt->PXAQSize == 0) ||
-- (pAC->GIni.GIPortUsage == SK_JUMBO_LINK &&
-- ((pPrt->PXSQSize > 0 && pPrt->PXSQSize < SK_MIN_TXQ_SIZE) ||
-+ (pPrt->PPortUsage == SK_JUMBO_LINK &&
-+ ((pPrt->PXSQSize > 0 && pPrt->PXSQSize < SK_MIN_TXQ_SIZE) ||
- (pPrt->PXAQSize > 0 && pPrt->PXAQSize < SK_MIN_TXQ_SIZE)))) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E023, SKERR_HWI_E023MSG);
- return(1);
- }
--
-+#endif /* !SK_DIAG */
-+
- UsedMem += pPrt->PRxQSize + pPrt->PXSQSize + pPrt->PXAQSize;
-+
-+ if (UsedMem > pAC->GIni.GIRamSize) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG);
-+ return(1);
-+ }
- }
--
-- if (UsedMem > pAC->GIni.GIRamSize) {
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG);
-- return(1);
-- }
--#endif /* !SK_SLIM */
-+
-+#endif /* !SK_SLIM */
-
- /* Now start address calculation */
- StartAddr = pAC->GIni.GIRamOffs;
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+
- pPrt = &pAC->GIni.GP[i];
-
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ StartAddr = 0;
-+ }
-+
- /* Calculate/Check values for the receive queue */
- Rtv2 = DoCalcAddr(pAC, pPrt, pPrt->PRxQSize, &StartAddr,
- &pPrt->PRxQRamStart, &pPrt->PRxQRamEnd);
-@@ -502,8 +684,8 @@ int Port) /* port index */
- * nothing
- */
- static void SkGeInitMacArb(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- /* release local reset */
- SK_OUT16(IoC, B3_MA_TO_CTRL, MA_RST_CLR);
-@@ -542,8 +724,8 @@ SK_IOC IoC) /* IO context */
- * nothing
- */
- static void SkGeInitPktArb(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- /* release local reset */
- SK_OUT16(IoC, B3_PA_CTRL, PA_RST_CLR);
-@@ -559,7 +741,8 @@ SK_IOC IoC) /* IO context */
- * NOTE: the packet arbiter timeout interrupt is needed for
- * half duplex hangup workaround
- */
-- if (pAC->GIni.GIPortUsage != SK_JUMBO_LINK) {
-+ if (pAC->GIni.GP[MAC_1].PPortUsage != SK_JUMBO_LINK &&
-+ pAC->GIni.GP[MAC_2].PPortUsage != SK_JUMBO_LINK) {
- if (pAC->GIni.GIMacsFound == 1) {
- SK_OUT16(IoC, B3_PA_CTRL, PA_ENA_TO_TX1);
- }
-@@ -582,14 +765,11 @@ SK_IOC IoC) /* IO context */
- * nothing
- */
- static void SkGeInitMacFifo(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U16 Word;
--#ifdef VCPU
-- SK_U32 DWord;
--#endif /* VCPU */
- /*
- * For each FIFO:
- * - release local reset
-@@ -597,63 +777,101 @@ int Port) /* Port Index (MAC_1 + n) */
- * - setup defaults for the control register
- * - enable the FIFO
- */
--
-+
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
-- /* Configure Rx MAC FIFO */
-+ /* configure Rx MAC FIFO */
- SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_CLR);
- SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_RX_CTRL_DEF);
- SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_ENA_OP_MD);
--
-- /* Configure Tx MAC FIFO */
-+
-+ /* configure Tx MAC FIFO */
- SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_RST_CLR);
- SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF);
- SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_ENA_OP_MD);
--
-- /* Enable frame flushing if jumbo frames used */
-- if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) {
-+
-+ /* enable frame flushing if jumbo frames used */
-+ if (pAC->GIni.GP[Port].PPortUsage == SK_JUMBO_LINK) {
- SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_ENA_FLUSH);
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
-- /* set Rx GMAC FIFO Flush Mask */
-- SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), (SK_U16)RX_FF_FL_DEF_MSK);
--
-+
- Word = (SK_U16)GMF_RX_CTRL_DEF;
-
- /* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */
-- if (pAC->GIni.GIYukonLite && pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-+ if (pAC->GIni.GIYukonLite /* && pAC->GIni.GIChipId == CHIP_ID_YUKON */) {
-
- Word &= ~GMF_RX_F_FL_ON;
- }
--
-- /* Configure Rx MAC FIFO */
-+
-+ /* configure Rx GMAC FIFO */
- SK_OUT8(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), (SK_U8)GMF_RST_CLR);
- SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), Word);
--
-- /* set Rx GMAC FIFO Flush Threshold (default: 0x0a -> 56 bytes) */
-- SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF);
--
-- /* Configure Tx MAC FIFO */
-+
-+ Word = RX_FF_FL_DEF_MSK;
-+
-+#ifndef SK_DIAG
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_4115)) {
-+ /*
-+ * Flushing must be enabled (needed for ASF see dev. #4.29),
-+ * but the flushing mask should be disabled (see dev. #4.115)
-+ */
-+ Word = 0;
-+ }
-+#endif /* !SK_DIAG */
-+
-+ /* set Rx GMAC FIFO Flush Mask (after clearing reset) */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), Word);
-+
-+ /* default: 0x0a -> 56 bytes on Yukon-1 and 64 bytes on Yukon-2 */
-+ Word = (SK_U16)RX_GMF_FL_THR_DEF;
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC &&
-+ pAC->GIni.GIAsfEnabled) {
-+ /* WA for dev. #4.30 (reduce to 0x08 -> 48 bytes) */
-+ Word -= 2;
-+ }
-+ }
-+ else {
-+ /*
-+ * because Pause Packet Truncation in GMAC is not working
-+ * we have to increase the Flush Threshold to 64 bytes
-+ * in order to flush pause packets in Rx FIFO on Yukon-1
-+ */
-+ Word++;
-+ }
-+
-+ /* set Rx GMAC FIFO Flush Threshold (after clearing reset) */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_THR), Word);
-+
-+ /* configure Tx GMAC FIFO */
- SK_OUT8(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), (SK_U8)GMF_RST_CLR);
- SK_OUT16(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), (SK_U16)GMF_TX_CTRL_DEF);
--
--#ifdef VCPU
-- SK_IN32(IoC, MR_ADDR(Port, RX_GMF_AF_THR), &DWord);
-- SK_IN32(IoC, MR_ADDR(Port, TX_GMF_AE_THR), &DWord);
--#endif /* VCPU */
--
-- /* set Tx GMAC FIFO Almost Empty Threshold */
--/* SK_OUT32(IoC, MR_ADDR(Port, TX_GMF_AE_THR), 0); */
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) {
-+ /* set Rx Pause Threshold */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_LP_THR), (SK_U16)SK_ECU_LLPP);
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_UP_THR), (SK_U16)SK_ECU_ULPP);
-+
-+ if (pAC->GIni.GP[Port].PPortUsage == SK_JUMBO_LINK) {
-+ /* set Tx GMAC FIFO Almost Empty Threshold */
-+ SK_OUT16(IoC, MR_ADDR(Port, TX_GMF_AE_THR),
-+ (SK_U16)SK_ECU_AE_THR);
-+ /* disable Store & Forward mode for TX */
-+ SK_OUT32(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), TX_STFW_DIS);
-+ }
-+ }
- }
- #endif /* YUKON */
-
- } /* SkGeInitMacFifo */
-
--#ifdef SK_LNK_SYNC_CNT
-+#ifdef SK_LNK_SYNC_CNT
- /******************************************************************************
- *
- * SkGeLoadLnkSyncCnt() - Load the Link Sync Counter and starts counting
-@@ -674,8 +892,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkGeLoadLnkSyncCnt(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_U32 CntVal) /* Counter value */
- {
-@@ -685,7 +903,7 @@ SK_U32 CntVal) /* Counter value */
- SK_BOOL IrqPend;
-
- /* stop counter */
-- SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_STOP);
-+ SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LNK_STOP);
-
- /*
- * ASIC problem:
-@@ -698,6 +916,7 @@ SK_U32 CntVal) /* Counter value */
- IrqPend = SK_FALSE;
- SK_IN32(IoC, B0_ISRC, &ISrc);
- SK_IN32(IoC, B0_IMSK, &OrgIMsk);
-+
- if (Port == MAC_1) {
- NewIMsk = OrgIMsk & ~IS_LNK_SYNC_M1;
- if ((ISrc & IS_LNK_SYNC_M1) != 0) {
-@@ -710,6 +929,7 @@ SK_U32 CntVal) /* Counter value */
- IrqPend = SK_TRUE;
- }
- }
-+
- if (!IrqPend) {
- SK_OUT32(IoC, B0_IMSK, NewIMsk);
- }
-@@ -718,15 +938,17 @@ SK_U32 CntVal) /* Counter value */
- SK_OUT32(IoC, MR_ADDR(Port, LNK_SYNC_INI), CntVal);
-
- /* start counter */
-- SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_START);
-+ SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LNK_START);
-
- if (!IrqPend) {
-- /* clear the unexpected IRQ, and restore the interrupt mask */
-- SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_CLR_IRQ);
-+ /* clear the unexpected IRQ */
-+ SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LNK_CLR_IRQ);
-+
-+ /* restore the interrupt mask */
- SK_OUT32(IoC, B0_IMSK, OrgIMsk);
- }
- } /* SkGeLoadLnkSyncCnt*/
--#endif /* SK_LNK_SYNC_CNT */
-+#endif /* SK_LNK_SYNC_CNT */
-
- #if defined(SK_DIAG) || defined(SK_CFG_SYNC)
- /******************************************************************************
-@@ -758,8 +980,8 @@ SK_U32 CntVal) /* Counter value */
- * synchronous queue is configured
- */
- int SkGeCfgSync(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_U32 IntTime, /* Interval Timer Value in units of 8ns */
- SK_U32 LimCount, /* Number of bytes to transfer during IntTime */
-@@ -777,16 +999,16 @@ int SyncMode) /* Sync Mode: TXA_ENA_ALL
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, SKERR_HWI_E010MSG);
- return(1);
- }
--
-+
- if (pAC->GIni.GP[Port].PXSQSize == 0) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E009, SKERR_HWI_E009MSG);
- return(2);
- }
--
-+
- /* calculate register values */
- IntTime = (IntTime / 2) * pAC->GIni.GIHstClkFact / 100;
- LimCount = LimCount / 8;
--
-+
- if (IntTime > TXA_MAX_VAL || LimCount > TXA_MAX_VAL) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, SKERR_HWI_E010MSG);
- return(1);
-@@ -804,13 +1026,13 @@ int SyncMode) /* Sync Mode: TXA_ENA_ALL
- */
- SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL),
- TXA_ENA_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC);
--
-+
- SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), IntTime);
- SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), LimCount);
--
-+
- SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL),
- (SK_U8)(SyncMode & (TXA_ENA_ALLOC | TXA_DIS_ALLOC)));
--
-+
- if (IntTime != 0 || LimCount != 0) {
- SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_DIS_FSYNC | TXA_START_RC);
- }
-@@ -831,10 +1053,10 @@ int SyncMode) /* Sync Mode: TXA_ENA_ALL
- * Returns:
- * nothing
- */
--static void DoInitRamQueue(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
--int QuIoOffs, /* Queue IO Address Offset */
-+void DoInitRamQueue(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int QuIoOffs, /* Queue I/O Address Offset */
- SK_U32 QuStartAddr, /* Queue Start Address */
- SK_U32 QuEndAddr, /* Queue End Address */
- int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */
-@@ -867,8 +1089,7 @@ int QuType) /* Queue Type (SK_RX_SRAM
-
- /* continue with SK_RX_BRAM_Q */
- case SK_RX_BRAM_Q:
-- /* write threshold for Rx Queue */
--
-+ /* write threshold for Rx Queue (Pause packets) */
- SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RX_UTPP), RxUpThresVal);
- SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RX_LTPP), RxLoThresVal);
-
-@@ -882,7 +1103,8 @@ int QuType) /* Queue Type (SK_RX_SRAM
- * or YUKON is used ((GMAC Tx FIFO is only 1 kB)
- * we NEED Store & Forward of the RAM buffer.
- */
-- if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK ||
-+ if (pAC->GIni.GP[MAC_1].PPortUsage == SK_JUMBO_LINK ||
-+ pAC->GIni.GP[MAC_2].PPortUsage == SK_JUMBO_LINK ||
- pAC->GIni.GIYukon) {
- /* enable Store & Forward Mode for the Tx Side */
- SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_ENA_STFWD);
-@@ -911,8 +1133,8 @@ int QuType) /* Queue Type (SK_RX_SRAM
- * nothing
- */
- static void SkGeInitRamBufs(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -920,8 +1142,8 @@ int Port) /* Port Index (MAC_1 + n) */
-
- pPrt = &pAC->GIni.GP[Port];
-
-- if (pPrt->PRxQSize == SK_MIN_RXQ_SIZE) {
-- RxQType = SK_RX_SRAM_Q; /* small Rx Queue */
-+ if (pPrt->PRxQSize <= SK_MIN_RXQ_SIZE) {
-+ RxQType = SK_RX_SRAM_Q; /* small Rx Queue */
- }
- else {
- RxQType = SK_RX_BRAM_Q; /* big Rx Queue */
-@@ -929,10 +1151,10 @@ int Port) /* Port Index (MAC_1 + n) */
-
- DoInitRamQueue(pAC, IoC, pPrt->PRxQOff, pPrt->PRxQRamStart,
- pPrt->PRxQRamEnd, RxQType);
--
-+
- DoInitRamQueue(pAC, IoC, pPrt->PXsQOff, pPrt->PXsQRamStart,
- pPrt->PXsQRamEnd, SK_TX_RAM_Q);
--
-+
- DoInitRamQueue(pAC, IoC, pPrt->PXaQOff, pPrt->PXaQRamStart,
- pPrt->PXaQRamEnd, SK_TX_RAM_Q);
-
-@@ -953,26 +1175,37 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkGeInitRamIface(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
-- /* release local reset */
-- SK_OUT16(IoC, B3_RI_CTRL, RI_RST_CLR);
-+ int i;
-+ int RamBuffers;
-
-- /* configure timeout values */
-- SK_OUT8(IoC, B3_RI_WTO_R1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_WTO_XA1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_WTO_XS1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_R1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_XA1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_XS1, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_WTO_R2, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_WTO_XA2, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_WTO_XS2, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_R2, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_XA2, SK_RI_TO_53);
-- SK_OUT8(IoC, B3_RI_RTO_XS2, SK_RI_TO_53);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ RamBuffers = pAC->GIni.GIMacsFound;
-+ }
-+ else {
-+ RamBuffers = 1;
-+ }
-+
-+ for (i = 0; i < RamBuffers; i++) {
-+ /* release local reset */
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_CTRL), (SK_U8)RI_RST_CLR);
-
-+ /* configure timeout values */
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_R1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_XA1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_XS1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_R1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_XA1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_XS1), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_R2), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_XA2), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_WTO_XS2), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_R2), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_XA2), SK_RI_TO_53);
-+ SK_OUT8(IoC, SELECT_RAM_BUFFER(i, B3_RI_RTO_XS2), SK_RI_TO_53);
-+ }
- } /* SkGeInitRamIface */
-
-
-@@ -987,41 +1220,91 @@ SK_IOC IoC) /* IO context */
- * nothing
- */
- static void SkGeInitBmu(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-- SK_U32 RxWm;
-- SK_U32 TxWm;
-+ SK_U16 RxWm;
-+ SK_U16 TxWm;
-
- pPrt = &pAC->GIni.GP[Port];
-
- RxWm = SK_BMU_RX_WM;
- TxWm = SK_BMU_TX_WM;
--
-- if (!pAC->GIni.GIPciSlot64 && !pAC->GIni.GIPciClock66) {
-- /* for better performance */
-- RxWm /= 2;
-- TxWm /= 2;
-- }
-
-- /* Rx Queue: Release all local resets and set the watermark */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_CLR_RESET);
-- SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_F), RxWm);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-
-- /*
-- * Tx Queue: Release all local resets if the queue is used !
-- * set watermark
-- */
-- if (pPrt->PXSQSize != 0) {
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_CLR_RESET);
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_F), TxWm);
-+ if (pAC->GIni.GIPciBus == SK_PEX_BUS) {
-+ /* for better performance set it to 128 */
-+ RxWm = SK_BMU_RX_WM_PEX;
-+ }
-+
-+ /* Rx Queue: Release all local resets and set the watermark */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), BMU_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), BMU_OPER_INIT);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), BMU_FIFO_OP_ON);
-+
-+ SK_OUT16(IoC, Q_ADDR(pPrt->PRxQOff, Q_WM), RxWm);
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U &&
-+ pAC->GIni.GIChipRev == CHIP_REV_YU_EC_U_A1) {
-+ /* MAC Rx RAM Read is controlled by hardware */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_F), F_M_RX_RAM_DIS);
-+ }
-+
-+ /*
-+ * Tx Queue: Release all local resets if the queue is used !
-+ * set watermark
-+ */
-+ if (pPrt->PXSQSize != 0 && HW_SYNC_TX_SUPPORTED(pAC)) {
-+ /* Yukon-EC doesn't have a synchronous Tx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), BMU_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), BMU_OPER_INIT);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), BMU_FIFO_OP_ON);
-+
-+ SK_OUT16(IoC, Q_ADDR(pPrt->PXsQOff, Q_WM), TxWm);
-+ }
-+
-+ if (pPrt->PXAQSize != 0) {
-+
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), BMU_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), BMU_OPER_INIT);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), BMU_FIFO_OP_ON);
-+
-+ SK_OUT16(IoC, Q_ADDR(pPrt->PXaQOff, Q_WM), TxWm);
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U &&
-+ pAC->GIni.GIChipRev == CHIP_REV_YU_EC_U_A0) {
-+ /* fix for Yukon-EC Ultra: set BMU FIFO level */
-+ SK_OUT16(IoC, Q_ADDR(pPrt->PXaQOff, Q_AL), SK_ECU_TXFF_LEV);
-+ }
-+ }
- }
--
-- if (pPrt->PXAQSize != 0) {
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_CLR_RESET);
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_F), TxWm);
-+ else {
-+ if (!pAC->GIni.GIPciSlot64 && !pAC->GIni.GIPciClock66) {
-+ /* for better performance */
-+ RxWm /= 2;
-+ TxWm /= 2;
-+ }
-+
-+ /* Rx Queue: Release all local resets and set the watermark */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_F), RxWm);
-+
-+ /*
-+ * Tx Queue: Release all local resets if the queue is used !
-+ * set watermark
-+ */
-+ if (pPrt->PXSQSize != 0) {
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_F), TxWm);
-+ }
-+
-+ if (pPrt->PXAQSize != 0) {
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_CLR_RESET);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_F), TxWm);
-+ }
- }
- /*
- * Do NOT enable the descriptor poll timers here, because
-@@ -1045,20 +1328,29 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- static SK_U32 TestStopBit(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int QuIoOffs) /* Queue IO Address Offset */
-+SK_IOC IoC, /* I/O Context */
-+int QuIoOffs) /* Queue I/O Address Offset */
- {
- SK_U32 QuCsr; /* CSR contents */
-
- SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr);
--
-- if ((QuCsr & (CSR_STOP | CSR_SV_IDLE)) == 0) {
-- /* Stop Descriptor overridden by start command */
-- SK_OUT32(IoC, Q_ADDR(QuIoOffs, Q_CSR), CSR_STOP);
-
-- SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if ((QuCsr & (BMU_STOP | BMU_IDLE)) == 0) {
-+ /* Stop Descriptor overridden by start command */
-+ SK_OUT32(IoC, Q_ADDR(QuIoOffs, Q_CSR), BMU_STOP);
-+
-+ SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr);
-+ }
-+ }
-+ else {
-+ if ((QuCsr & (CSR_STOP | CSR_SV_IDLE)) == 0) {
-+ /* Stop Descriptor overridden by start command */
-+ SK_OUT32(IoC, Q_ADDR(QuIoOffs, Q_CSR), CSR_STOP);
-+
-+ SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr);
-+ }
- }
--
- return(QuCsr);
- } /* TestStopBit */
-
-@@ -1082,8 +1374,8 @@ int QuIoOffs) /* Queue IO Address Offse
- * has to be stopped once before.
- * SK_STOP_ALL SK_STOP_TX + SK_STOP_RX
- *
-- * RstMode = SK_SOFT_RST Resets the MAC. The PHY is still alive.
-- * SK_HARD_RST Resets the MAC and the PHY.
-+ * RstMode = SK_SOFT_RST Resets the MAC, the PHY is still alive.
-+ * SK_HARD_RST Resets the MAC and the PHY.
- *
- * Example:
- * 1) A Link Down event was signaled for a port. Therefore the activity
-@@ -1142,56 +1434,82 @@ int QuIoOffs) /* Queue IO Address Offse
- * SWITCH_PORT.
- */
- void SkGeStopPort(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* I/O context */
--int Port, /* port to stop (MAC_1 + n) */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port to stop (MAC_1 + n) */
- int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */
- int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */
- {
--#ifndef SK_DIAG
-- SK_EVPARA Para;
--#endif /* !SK_DIAG */
- SK_GEPORT *pPrt;
-- SK_U32 DWord;
-+ SK_U32 RxCsr;
- SK_U32 XsCsr;
- SK_U32 XaCsr;
- SK_U64 ToutStart;
-+ SK_U32 CsrStart;
-+ SK_U32 CsrStop;
-+ SK_U32 CsrIdle;
-+ SK_U32 CsrTest;
-+ SK_U8 rsl; /* FIFO read shadow level */
-+ SK_U8 rl; /* FIFO read level */
- int i;
- int ToutCnt;
-
- pPrt = &pAC->GIni.GP[Port];
-
-+ /* set the proper values of Q_CSR register layout depending on the chip */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ CsrStart = BMU_START;
-+ CsrStop = BMU_STOP;
-+ CsrIdle = BMU_IDLE;
-+ CsrTest = BMU_IDLE;
-+ }
-+ else {
-+ CsrStart = CSR_START;
-+ CsrStop = CSR_STOP;
-+ CsrIdle = CSR_SV_IDLE;
-+ CsrTest = CSR_SV_IDLE | CSR_STOP;
-+ }
-+
- if ((Dir & SK_STOP_TX) != 0) {
-- /* disable receiver and transmitter */
-- SkMacRxTxDisable(pAC, IoC, Port);
--
-+
-+ if (!pAC->GIni.GIAsfEnabled) {
-+ /* disable receiver and transmitter */
-+ SkMacRxTxDisable(pAC, IoC, Port);
-+ }
-+
- /* stop both transmit queues */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CsrStop);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CsrStop);
- /*
- * If the BMU is in the reset state CSR_STOP will terminate
- * immediately.
- */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_STOP);
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_STOP);
-
- ToutStart = SkOsGetTime(pAC);
- ToutCnt = 0;
- do {
-- /*
-- * Clear packet arbiter timeout to make sure
-- * this loop will terminate.
-- */
-- SK_OUT16(IoC, B3_PA_CTRL, (SK_U16)((Port == MAC_1) ?
-- PA_CLR_TO_TX1 : PA_CLR_TO_TX2));
--
-- /*
-- * If the transfer stucks at the MAC the STOP command will not
-- * terminate if we don't flush the XMAC's transmit FIFO !
-- */
-- SkMacFlushTxFifo(pAC, IoC, Port);
-+#ifdef GENESIS
-+ if (pAC->GIni.GIGenesis) {
-+ /* clear Tx packet arbiter timeout IRQ */
-+ SK_OUT16(IoC, B3_PA_CTRL, (SK_U16)((Port == MAC_1) ?
-+ PA_CLR_TO_TX1 : PA_CLR_TO_TX2));
-+ /*
-+ * If the transfer stucks at the XMAC the STOP command will not
-+ * terminate if we don't flush the XMAC's transmit FIFO !
-+ */
-+ SkMacFlushTxFifo(pAC, IoC, Port);
-+ }
-+#endif /* GENESIS */
-
-- XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff);
- XaCsr = TestStopBit(pAC, IoC, pPrt->PXaQOff);
-
-+ if (HW_SYNC_TX_SUPPORTED(pAC)) {
-+ XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff);
-+ }
-+ else {
-+ XsCsr = XaCsr;
-+ }
-+
- if (SkOsGetTime(pAC) - ToutStart > (SK_TICKS_PER_SEC / 18)) {
- /*
- * Timeout of 1/18 second reached.
-@@ -1199,67 +1517,115 @@ int RstMode)/* Reset Mode (SK_SOFT_RST,
- */
- ToutCnt++;
- if (ToutCnt > 1) {
-- /* Might be a problem when the driver event handler
-- * calls StopPort again. XXX.
-+ /*
-+ * If BMU stop doesn't terminate, we assume that
-+ * we have a stable state and can reset the BMU,
-+ * the Prefetch Unit, and RAM buffer now.
- */
--
-- /* Fatal Error, Loop aborted */
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_HWI_E018,
-- SKERR_HWI_E018MSG);
--#ifndef SK_DIAG
-- Para.Para64 = Port;
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
--#endif /* !SK_DIAG */
-- return;
-+ break; /* ===> leave do/while loop here */
- }
- /*
-- * Cache incoherency workaround: Assume a start command
-+ * Cache incoherency workaround: assume a start command
- * has been lost while sending the frame.
- */
- ToutStart = SkOsGetTime(pAC);
-
-- if ((XsCsr & CSR_STOP) != 0) {
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_START);
-+ if ((XsCsr & CsrStop) != 0) {
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CsrStart);
- }
-- if ((XaCsr & CSR_STOP) != 0) {
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_START);
-+
-+ if ((XaCsr & CsrStop) != 0) {
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CsrStart);
- }
-- }
-
-+ /*
-+ * After the previous operations the X(s|a)Csr does no
-+ * longer contain the proper values
-+ */
-+ XaCsr = TestStopBit(pAC, IoC, pPrt->PXaQOff);
-+
-+ if (HW_SYNC_TX_SUPPORTED(pAC)) {
-+ XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff);
-+ }
-+ else {
-+ XsCsr = XaCsr;
-+ }
-+ }
- /*
- * Because of the ASIC problem report entry from 21.08.1998 it is
- * required to wait until CSR_STOP is reset and CSR_SV_IDLE is set.
-+ * (valid for GENESIS only)
- */
-- } while ((XsCsr & (CSR_STOP | CSR_SV_IDLE)) != CSR_SV_IDLE ||
-- (XaCsr & (CSR_STOP | CSR_SV_IDLE)) != CSR_SV_IDLE);
-+ } while (((XsCsr & CsrTest) != CsrIdle ||
-+ (XaCsr & CsrTest) != CsrIdle));
-+
-+ if (pAC->GIni.GIAsfEnabled) {
-
-- /* Reset the MAC depending on the RstMode */
-- if (RstMode == SK_SOFT_RST) {
-- SkMacSoftRst(pAC, IoC, Port);
-+ pPrt->PState = (RstMode == SK_SOFT_RST) ? SK_PRT_STOP :
-+ SK_PRT_RESET;
- }
- else {
-- SkMacHardRst(pAC, IoC, Port);
-- }
--
-- /* Disable Force Sync bit and Enable Alloc bit */
-- SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL),
-+ /* Reset the MAC depending on the RstMode */
-+ if (RstMode == SK_SOFT_RST) {
-+
-+ SkMacSoftRst(pAC, IoC, Port);
-+ }
-+ else {
-+#ifdef SK_DIAG
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_472) && Port == MAC_1 &&
-+ pAC->GIni.GP[MAC_2].PState == SK_PRT_RUN) {
-+
-+ pAC->GIni.GP[MAC_1].PState = SK_PRT_RESET;
-+
-+ /* set GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(MAC_1, GPHY_CTRL), (SK_U8)GPC_RST_SET);
-+ }
-+ else {
-+
-+ SkMacHardRst(pAC, IoC, Port);
-+ }
-+#else /* !SK_DIAG */
-+ SkMacHardRst(pAC, IoC, Port);
-+#endif /* !SK_DIAG */
-+ }
-+ }
-+
-+ /* disable Force Sync bit and Enable Alloc bit */
-+ SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL),
- TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC);
--
-+
- /* Stop Interval Timer and Limit Counter of Tx Arbiter */
- SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), 0L);
- SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), 0L);
-
- /* Perform a local reset of the port's Tx path */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* Reset the PCI FIFO of the async Tx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR),
-+ BMU_RST_SET | BMU_FIFO_RST);
-+
-+ /* Reset the PCI FIFO of the sync Tx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR),
-+ BMU_RST_SET | BMU_FIFO_RST);
-+
-+ /* Reset the Tx prefetch units */
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(pPrt->PXaQOff, PREF_UNIT_CTRL_REG),
-+ PREF_UNIT_RST_SET);
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(pPrt->PXsQOff, PREF_UNIT_CTRL_REG),
-+ PREF_UNIT_RST_SET);
-+ }
-+ else {
-+ /* Reset the PCI FIFO of the async Tx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_SET_RESET);
-+ /* Reset the PCI FIFO of the sync Tx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_SET_RESET);
-+ }
-
-- /* Reset the PCI FIFO of the async Tx queue */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_SET_RESET);
-- /* Reset the PCI FIFO of the sync Tx queue */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_SET_RESET);
- /* Reset the RAM Buffer async Tx queue */
- SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff, RB_CTRL), RB_RST_SET);
- /* Reset the RAM Buffer sync Tx queue */
- SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff, RB_CTRL), RB_RST_SET);
--
-+
- /* Reset Tx MAC FIFO */
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
-@@ -1271,74 +1637,129 @@ int RstMode)/* Reset Mode (SK_SOFT_RST,
- SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_DIS);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
-- /* Reset TX MAC FIFO */
-- SK_OUT8(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), (SK_U8)GMF_RST_SET);
-+ /* do the reset only if ASF is not enabled */
-+ if (!pAC->GIni.GIAsfEnabled) {
-+ /* Reset Tx MAC FIFO */
-+ SK_OUT8(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), (SK_U8)GMF_RST_SET);
-+ }
-+
-+ /* set Pause Off */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_PAUSE_OFF);
- }
- #endif /* YUKON */
- }
-
- if ((Dir & SK_STOP_RX) != 0) {
-- /*
-- * The RX Stop Command will not terminate if no buffers
-- * are queued in the RxD ring. But it will always reach
-- * the Idle state. Therefore we can use this feature to
-- * stop the transfer of received packets.
-- */
-- /* stop the port's receive queue */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_STOP);
--
-- i = 100;
-- do {
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
- /*
-- * Clear packet arbiter timeout to make sure
-- * this loop will terminate
-+ * The RX Stop command will not work for Yukon-2 if the BMU does not
-+ * reach the end of packet and since we can't make sure that we have
-+ * incoming data, we must reset the BMU while it is not during a DMA
-+ * transfer. Since it is possible that the RX path is still active,
-+ * the RX RAM buffer will be stopped first, so any possible incoming
-+ * data will not trigger a DMA. After the RAM buffer is stopped, the
-+ * BMU is polled until any DMA in progress is ended and only then it
-+ * will be reset.
- */
-- SK_OUT16(IoC, B3_PA_CTRL, (SK_U16)((Port == MAC_1) ?
-- PA_CLR_TO_RX1 : PA_CLR_TO_RX2));
-
-- DWord = TestStopBit(pAC, IoC, pPrt->PRxQOff);
-+ /* disable the RAM Buffer receive queue */
-+ SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff, RB_CTRL), RB_DIS_OP_MD);
-
-- /* timeout if i==0 (bug fix for #10748) */
-- if (--i == 0) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_HWI_E024,
-- SKERR_HWI_E024MSG);
-- break;
-+ i = 0xffff;
-+ while (--i) {
-+ SK_IN8(IoC, RB_ADDR(pPrt->PRxQOff, Q_RX_RSL), &rsl);
-+ SK_IN8(IoC, RB_ADDR(pPrt->PRxQOff, Q_RX_RL), &rl);
-+
-+ if (rsl == rl) {
-+ break;
-+ }
- }
-+
- /*
-- * because of the ASIC problem report entry from 21.08.98
-- * it is required to wait until CSR_STOP is reset and
-- * CSR_SV_IDLE is set.
-+ * If the Rx side is blocked, the above loop cannot terminate.
-+ * But, if there was any traffic it should be terminated, now.
-+ * However, stop the Rx BMU and the Prefetch Unit !
- */
-- } while ((DWord & (CSR_STOP | CSR_SV_IDLE)) != CSR_SV_IDLE);
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR),
-+ BMU_RST_SET | BMU_FIFO_RST);
-+ /* reset the Rx prefetch unit */
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(pPrt->PRxQOff, PREF_UNIT_CTRL_REG),
-+ PREF_UNIT_RST_SET);
-+ }
-+ else {
-+ /*
-+ * The RX Stop Command will not terminate if no buffers
-+ * are queued in the RxD ring. But it will always reach
-+ * the Idle state. Therefore we can use this feature to
-+ * stop the transfer of received packets.
-+ */
-+ /* stop the port's receive queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CsrStop);
-
-- /* The path data transfer activity is fully stopped now */
-+ i = 100;
-+ do {
-+#ifdef GENESIS
-+ if (pAC->GIni.GIGenesis) {
-+ /* clear Rx packet arbiter timeout IRQ */
-+ SK_OUT16(IoC, B3_PA_CTRL, (SK_U16)((Port == MAC_1) ?
-+ PA_CLR_TO_RX1 : PA_CLR_TO_RX2));
-+ }
-+#endif /* GENESIS */
-+
-+ RxCsr = TestStopBit(pAC, IoC, pPrt->PRxQOff);
-+
-+ /* timeout if i==0 (bug fix for #10748) */
-+ if (--i == 0) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_HWI_E024,
-+ SKERR_HWI_E024MSG);
-+ break;
-+ }
-+ /*
-+ * Because of the ASIC problem report entry from 21.08.1998 it is
-+ * required to wait until CSR_STOP is reset and CSR_SV_IDLE is set.
-+ * (valid for GENESIS only)
-+ */
-+ } while ((RxCsr & CsrTest) != CsrIdle);
-+ /* The path data transfer activity is fully stopped now */
-
-- /* Perform a local reset of the port's Rx path */
-+ /* Perform a local reset of the port's Rx path */
-+ /* Reset the PCI FIFO of the Rx queue */
-+ SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_SET_RESET);
-+ }
-
-- /* Reset the PCI FIFO of the Rx queue */
-- SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_SET_RESET);
- /* Reset the RAM Buffer receive queue */
- SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff, RB_CTRL), RB_RST_SET);
-
- /* Reset Rx MAC FIFO */
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_SET);
-
- /* switch Rx LED off, stop the LED counter */
- SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_DIS);
- }
- #endif /* GENESIS */
--
- #ifdef YUKON
-- if (pAC->GIni.GIYukon) {
-+ if (pAC->GIni.GIYukon && !pAC->GIni.GIAsfEnabled) {
- /* Reset Rx MAC FIFO */
- SK_OUT8(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), (SK_U8)GMF_RST_SET);
- }
-+
-+ if (((pAC->GIni.GIChipId == CHIP_ID_YUKON) ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE)) &&
-+ (RstMode == SK_HARD_RST)) {
-+ /* set Link Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_LINK_CTRL), (SK_U8)GMLC_RST_SET);
-+
-+ /* clear Link Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_LINK_CTRL), (SK_U8)GMLC_RST_CLR);
-+ }
-+
- #endif /* YUKON */
- }
- } /* SkGeStopPort */
-@@ -1355,8 +1776,8 @@ int RstMode)/* Reset Mode (SK_SOFT_RST,
- * nothing
- */
- static void SkGeInit0(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- int i;
- SK_GEPORT *pPrt;
-@@ -1365,6 +1786,7 @@ SK_IOC IoC) /* IO context */
- pPrt = &pAC->GIni.GP[i];
-
- pPrt->PState = SK_PRT_RESET;
-+ pPrt->PPortUsage = SK_RED_LINK;
- pPrt->PRxQOff = QOffTab[i].RxQOff;
- pPrt->PXsQOff = QOffTab[i].XsQOff;
- pPrt->PXaQOff = QOffTab[i].XaQOff;
-@@ -1393,24 +1815,30 @@ SK_IOC IoC) /* IO context */
- pPrt->PLipaAutoNeg = (SK_U8)SK_LIPA_UNKNOWN;
- pPrt->PAutoNegFail = SK_FALSE;
- pPrt->PHWLinkUp = SK_FALSE;
-- pPrt->PLinkBroken = SK_TRUE; /* See WA code */
-+ pPrt->PLinkBroken = SK_TRUE; /* See WA code */
- pPrt->PPhyPowerState = PHY_PM_OPERATIONAL_MODE;
- pPrt->PMacColThres = TX_COL_DEF;
- pPrt->PMacJamLen = TX_JAM_LEN_DEF;
- pPrt->PMacJamIpgVal = TX_JAM_IPG_DEF;
- pPrt->PMacJamIpgData = TX_IPG_JAM_DEF;
-+ pPrt->PMacBackOffLim = TX_BOF_LIM_DEF;
-+ pPrt->PMacDataBlind = DATA_BLIND_DEF;
- pPrt->PMacIpgData = IPG_DATA_DEF;
- pPrt->PMacLimit4 = SK_FALSE;
- }
-
-- pAC->GIni.GIPortUsage = SK_RED_LINK;
- pAC->GIni.GILedBlinkCtrl = (SK_U16)OemConfig.Value;
-- pAC->GIni.GIValIrqMask = IS_ALL_MSK;
-+ pAC->GIni.GIChipCap = 0;
-+
-+ for (i = 0; i < 4; i++) {
-+ pAC->GIni.HwF.Features[i]= 0x00000000;
-+ pAC->GIni.HwF.OnMask[i] = 0x00000000;
-+ pAC->GIni.HwF.OffMask[i] = 0x00000000;
-+ }
-
- } /* SkGeInit0*/
-
- #ifdef SK_PCI_RESET
--
- /******************************************************************************
- *
- * SkGePciReset() - Reset PCI interface
-@@ -1426,8 +1854,8 @@ SK_IOC IoC) /* IO context */
- * 1: Power state could not be changed to 3.
- */
- static int SkGePciReset(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- int i;
- SK_U16 PmCtlSts;
-@@ -1450,7 +1878,7 @@ SK_IOC IoC) /* IO context */
- /* We know the RAM Interface Arbiter is enabled. */
- SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D3);
- SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts);
--
-+
- if ((PmCtlSts & PCI_PM_STATE_MSK) != PCI_PM_STATE_D3) {
- return(1);
- }
-@@ -1460,7 +1888,7 @@ SK_IOC IoC) /* IO context */
-
- /* Check for D0 state. */
- SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts);
--
-+
- if ((PmCtlSts & PCI_PM_STATE_MSK) != PCI_PM_STATE_D0) {
- return(1);
- }
-@@ -1469,11 +1897,24 @@ SK_IOC IoC) /* IO context */
- SkPciReadCfgWord(pAC, PCI_COMMAND, &PciCmd);
- SkPciReadCfgByte(pAC, PCI_CACHE_LSZ, &Cls);
- SkPciReadCfgDWord(pAC, PCI_BASE_1ST, &Bp1);
-- SkPciReadCfgDWord(pAC, PCI_BASE_2ND, &Bp2);
-+
-+ /*
-+ * Compute the location in PCI config space of BAR2
-+ * relativ to the location of BAR1
-+ */
-+ if ((Bp1 & PCI_MEM_TYP_MSK) == PCI_MEM64BIT) {
-+ /* BAR1 is 64 bits wide */
-+ i = 8;
-+ }
-+ else {
-+ i = 4;
-+ }
-+
-+ SkPciReadCfgDWord(pAC, PCI_BASE_1ST + i, &Bp2);
- SkPciReadCfgByte(pAC, PCI_LAT_TIM, &Lat);
--
-- if (PciCmd != 0 || Cls != (SK_U8)0 || Lat != (SK_U8)0 ||
-- (Bp1 & 0xfffffff0L) != 0 || Bp2 != 1) {
-+
-+ if (PciCmd != 0 || Cls != 0 || (Bp1 & 0xfffffff0L) != 0 || Bp2 != 1 ||
-+ Lat != 0) {
- return(1);
- }
-
-@@ -1484,9 +1925,115 @@ SK_IOC IoC) /* IO context */
-
- return(0);
- } /* SkGePciReset */
--
- #endif /* SK_PCI_RESET */
-
-+
-+#ifndef SK_SLIM
-+/******************************************************************************
-+ *
-+ * SkGeSetUpSupFeatures() - Collect Feature List for HW_FEATURE Macro
-+ *
-+ * Description:
-+ * This function collects the available features and required
-+ * deviation services of the Adapter and provides these
-+ * information in the GIHwF struct. This information is used as
-+ * default value and may be overritten by the driver using the
-+ * SET_HW_FEATURE_MASK() macro in its Init0 phase.
-+ *
-+ * Notice:
-+ * Using the On and Off mask: Never switch on the same bit in both
-+ * masks simultaneously. However, if doing the Off mask will win.
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+static void SkGeSetUpSupFeatures(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
-+{
-+ int i;
-+ SK_U16 Word;
-+
-+ switch (pAC->GIni.GIChipId) {
-+ case CHIP_ID_YUKON_EC:
-+ if (pAC->GIni.GIChipRev == CHIP_REV_YU_EC_A1) {
-+ /* A0/A1 */
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_42 | HWF_WA_DEV_46 | HWF_WA_DEV_43_418 |
-+ HWF_WA_DEV_420 | HWF_WA_DEV_423 |
-+ HWF_WA_DEV_424 | HWF_WA_DEV_425 | HWF_WA_DEV_427 |
-+ HWF_WA_DEV_428 | HWF_WA_DEV_483 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4152| HWF_WA_DEV_4167;
-+ }
-+ else {
-+ /* A2/A3 */
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_424 | HWF_WA_DEV_425 | HWF_WA_DEV_427 |
-+ HWF_WA_DEV_428 | HWF_WA_DEV_483 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4152| HWF_WA_DEV_4167;
-+ }
-+ break;
-+ case CHIP_ID_YUKON_FE:
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4152| HWF_WA_DEV_4167;
-+ break;
-+ case CHIP_ID_YUKON_XL:
-+ switch (pAC->GIni.GIChipRev) {
-+ case CHIP_REV_YU_XL_A0: /* still needed for Diag */
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_463 | HWF_WA_DEV_472 |
-+ HWF_WA_DEV_479 | HWF_WA_DEV_483 | HWF_WA_DEV_4115 |
-+ HWF_WA_DEV_4152| HWF_WA_DEV_4167;
-+ break;
-+
-+ case CHIP_REV_YU_XL_A1:
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_483 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4115| HWF_WA_DEV_4152| HWF_WA_DEV_4167;
-+ break;
-+
-+ case CHIP_REV_YU_XL_A2:
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_483 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4115 |HWF_WA_DEV_4167;
-+ break;
-+
-+ case CHIP_REV_YU_XL_A3:
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_483 | HWF_WA_DEV_4109 |
-+ HWF_WA_DEV_4115;
-+ break;
-+ }
-+ break;
-+ case CHIP_ID_YUKON_EC_U:
-+ if (pAC->GIni.GIChipRev == CHIP_REV_YU_EC_U_A0) {
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_483 | HWF_WA_DEV_4109;
-+ }
-+ else if (pAC->GIni.GIChipRev == CHIP_REV_YU_EC_U_A1) {
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] =
-+ HWF_WA_DEV_427 | HWF_WA_DEV_4109 | HWF_WA_DEV_4185;
-+
-+ /* check for A1b */
-+ SK_IN16(IoC, Q_ADDR(Q_XA1, Q_WM), &Word);
-+ if (Word == 0) {
-+ pAC->GIni.HwF.Features[HW_DEV_LIST] |=
-+ HWF_WA_DEV_4185CS | HWF_WA_DEV_4200;
-+ }
-+ }
-+ break;
-+ }
-+
-+ for (i = 0; i < 4; i++) {
-+ pAC->GIni.HwF.Features[i] =
-+ (pAC->GIni.HwF.Features[i] | pAC->GIni.HwF.OnMask[i]) &
-+ ~pAC->GIni.HwF.OffMask[i];
-+ }
-+} /* SkGeSetUpSupFeatures */
-+#endif /* !SK_SLIM */
-+
-+
- /******************************************************************************
- *
- * SkGeInit1() - Level 1 Initialization
-@@ -1509,80 +2056,235 @@ SK_IOC IoC) /* IO context */
- * 6: HW self test failed
- */
- static int SkGeInit1(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- SK_U8 Byte;
- SK_U16 Word;
-- SK_U16 CtrlStat;
-+ SK_U32 CtrlStat;
-+ SK_U32 VauxAvail;
- SK_U32 DWord;
-+ SK_U32 Our1;
-+ SK_U32 PowerDownBit;
-+ SK_BOOL FiberType;
-+ SK_GEPORT *pPrt;
- int RetVal;
-- int i;
-+ int i, j;
-
- RetVal = 0;
-
-- /* save CLK_RUN bits (YUKON-Lite) */
-- SK_IN16(IoC, B0_CTST, &CtrlStat);
-+ /* save CLK_RUN & ASF_ENABLE bits (YUKON-Lite, YUKON-EC) */
-+ SK_IN32(IoC, B0_CTST, &CtrlStat);
-
- #ifdef SK_PCI_RESET
- (void)SkGePciReset(pAC, IoC);
- #endif /* SK_PCI_RESET */
-
-- /* do the SW-reset */
-- SK_OUT8(IoC, B0_CTST, CS_RST_SET);
--
- /* release the SW-reset */
-+ /* Important: SW-reset has to be cleared here, to ensure
-+ * the CHIP_ID can be read IO-mapped based, too -
-+ * remember the RAP register can only be written if
-+ * SW-reset is cleared.
-+ */
- SK_OUT8(IoC, B0_CTST, CS_RST_CLR);
-
-+ /* read Chip Identification Number */
-+ SK_IN8(IoC, B2_CHIP_ID, &Byte);
-+ pAC->GIni.GIChipId = Byte;
-+
-+ pAC->GIni.GIAsfEnabled = SK_FALSE;
-+
-+ /* ASF support only for Yukon-2 */
-+ if ((pAC->GIni.GIChipId >= CHIP_ID_YUKON_XL) &&
-+ (pAC->GIni.GIChipId <= CHIP_ID_YUKON_EC)) {
-+#ifdef SK_ASF
-+ if ((CtrlStat & Y2_ASF_ENABLE) != 0) {
-+ /* do the SW-reset only if ASF is not enabled */
-+ pAC->GIni.GIAsfEnabled = SK_TRUE;
-+ }
-+#else /* !SK_ASF */
-+
-+ SK_IN8(IoC, B28_Y2_ASF_STAT_CMD, &Byte);
-+
-+ pAC->GIni.GIAsfRunning = Byte & Y2_ASF_RUNNING;
-+
-+ /* put ASF system in reset state */
-+ SK_OUT8(IoC, B28_Y2_ASF_STAT_CMD, (SK_U8)Y2_ASF_RESET);
-+
-+ /* disable ASF Unit */
-+ SK_OUT16(IoC, B0_CTST, Y2_ASF_DISABLE);
-+#endif /* !SK_ASF */
-+ }
-+
-+ if (!pAC->GIni.GIAsfEnabled) {
-+ /* Yukon-2: required for Diag and Power Management */
-+ /* set the SW-reset */
-+ SK_OUT8(IoC, B0_CTST, CS_RST_SET);
-+
-+ /* release the SW-reset */
-+ SK_OUT8(IoC, B0_CTST, CS_RST_CLR);
-+ }
-+
-+ /* enable Config Write */
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+
- /* reset all error bits in the PCI STATUS register */
- /*
- * Note: PCI Cfg cycles cannot be used, because they are not
- * available on some platforms after 'boot time'.
- */
-- SK_IN16(IoC, PCI_C(PCI_STATUS), &Word);
--
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-- SK_OUT16(IoC, PCI_C(PCI_STATUS), (SK_U16)(Word | PCI_ERRBITS));
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+ SK_IN16(IoC, PCI_C(pAC, PCI_STATUS), &Word);
-+
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_STATUS), Word | (SK_U16)PCI_ERRBITS);
-
- /* release Master Reset */
- SK_OUT8(IoC, B0_CTST, CS_MRST_CLR);
-
- #ifdef CLK_RUN
- CtrlStat |= CS_CLK_RUN_ENA;
--#endif /* CLK_RUN */
-
- /* restore CLK_RUN bits */
- SK_OUT16(IoC, B0_CTST, (SK_U16)(CtrlStat &
- (CS_CLK_RUN_HOT | CS_CLK_RUN_RST | CS_CLK_RUN_ENA)));
-+#endif /* CLK_RUN */
-+
-+ if ((pAC->GIni.GIChipId >= CHIP_ID_YUKON_XL) &&
-+ (pAC->GIni.GIChipId <= CHIP_ID_YUKON_FE)) {
-+
-+ pAC->GIni.GIYukon2 = SK_TRUE;
-+ pAC->GIni.GIValIrqMask = Y2_IS_ALL_MSK;
-+ pAC->GIni.GIValHwIrqMask = Y2_HWE_ALL_MSK;
-+
-+ VauxAvail = Y2_VAUX_AVAIL;
-+
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_STATUS), &DWord);
-+
-+ if ((DWord & PCI_OS_PCI_X) != 0) {
-+#ifndef SK_SLIM
-+ /* this is a PCI / PCI-X bus */
-+ if ((DWord & PCI_OS_PCIX) != 0) {
-+ /* this is a PCI-X bus */
-+ pAC->GIni.GIPciBus = SK_PCIX_BUS;
-+
-+ /* PCI-X is always 64-bit wide */
-+ pAC->GIni.GIPciSlot64 = SK_TRUE;
-+
-+ pAC->GIni.GIPciMode = (SK_U8)(PCI_OS_SPEED(DWord));
-+ }
-+ else {
-+ /* this is a conventional PCI bus */
-+ pAC->GIni.GIPciBus = SK_PCI_BUS;
-+
-+ SK_IN16(IoC, PCI_C(pAC, PCI_OUR_REG_2), &Word);
-+
-+ /* check if 64-bit width is used */
-+ pAC->GIni.GIPciSlot64 = (SK_BOOL)
-+ (((DWord & PCI_OS_PCI64B) != 0) &&
-+ ((Word & PCI_USEDATA64) != 0));
-+
-+ /* check if 66 MHz PCI Clock is active */
-+ pAC->GIni.GIPciClock66 = (SK_BOOL)((DWord & PCI_OS_PCI66M) != 0);
-+ }
-+#endif /* !SK_SLIM */
-+ }
-+ else {
-+ /* this is a PEX bus */
-+ pAC->GIni.GIPciBus = SK_PEX_BUS;
-+
-+ /* clear any PEX errors */
-+ SK_OUT32(IoC, PCI_C(pAC, PEX_UNC_ERR_STAT), 0xffffffffUL);
-+
-+ SK_IN16(IoC, PCI_C(pAC, PEX_LNK_STAT), &Word);
-+
-+ pAC->GIni.GIPexWidth = (SK_U8)((Word & PEX_LS_LINK_WI_MSK) >> 4);
-+ }
-+ /*
-+ * Yukon-2 chips family has a different way of providing
-+ * the number of MACs available
-+ */
-+ pAC->GIni.GIMacsFound = 1;
-+
-+ SK_IN8(IoC, B2_Y2_HW_RES, &Byte);
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /*
-+ * OEM config value is overwritten and should not
-+ * be used for Yukon-2
-+ */
-+ pAC->GIni.GILedBlinkCtrl |= SK_ACT_LED_BLINK;
-+
-+ if (CFG_LED_MODE(Byte) == CFG_LED_DUAL_ACT_LNK) {
-+
-+ pAC->GIni.GILedBlinkCtrl |= SK_DUAL_LED_ACT_LNK;
-+ }
-+ }
-+
-+ if ((Byte & CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) {
-+
-+ SK_IN8(IoC, B2_Y2_CLK_GATE, &Byte);
-+
-+ if (!(Byte & Y2_STATUS_LNK2_INAC)) {
-+ /* Link 2 activ */
-+ pAC->GIni.GIMacsFound++;
-+ }
-+ }
-+
-+#ifdef VCPU
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) {
-+ /* temporary WA for reported number of links */
-+ pAC->GIni.GIMacsFound = 2;
-+ }
-+#endif /* VCPU */
-+
-+#ifdef REPLAY_TIMER
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) {
-+ SK_OUT16(IoC, PCI_C(pAC, PEX_ACK_RPLY_TOX1), 0x2710); /* 40 us */
-+ }
-+#endif
-+
-+ /* read Chip Revision */
-+ SK_IN8(IoC, B2_MAC_CFG, &Byte);
-+
-+ pAC->GIni.GIChipCap = Byte & 0x0f;
-+ }
-+ else {
-+ pAC->GIni.GIYukon2 = SK_FALSE;
-+ pAC->GIni.GIValIrqMask = IS_ALL_MSK;
-+ pAC->GIni.GIValHwIrqMask = 0; /* not activated */
-+
-+ VauxAvail = CS_VAUX_AVAIL;
-+
-+ /* read number of MACs and Chip Revision */
-+ SK_IN8(IoC, B2_MAC_CFG, &Byte);
-+
-+ pAC->GIni.GIMacsFound = (Byte & CFG_SNG_MAC) ? 1 : 2;
-+ }
-
-- /* read Chip Identification Number */
-- SK_IN8(IoC, B2_CHIP_ID, &Byte);
-- pAC->GIni.GIChipId = Byte;
--
-- /* read number of MACs */
-- SK_IN8(IoC, B2_MAC_CFG, &Byte);
-- pAC->GIni.GIMacsFound = (Byte & CFG_SNG_MAC) ? 1 : 2;
--
- /* get Chip Revision Number */
- pAC->GIni.GIChipRev = (SK_U8)((Byte & CFG_CHIP_R_MSK) >> 4);
-
-- /* get diff. PCI parameters */
-- SK_IN16(IoC, B0_CTST, &CtrlStat);
--
-+#ifndef SK_DIAG
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL &&
-+ pAC->GIni.GIChipRev == CHIP_REV_YU_XL_A0) {
-+ /* Yukon-2 Chip Rev. A0 */
-+ return(6);
-+ }
-+#endif /* !SK_DIAG */
-+
- /* read the adapters RAM size */
- SK_IN8(IoC, B2_E_0, &Byte);
--
-+
- pAC->GIni.GIGenesis = SK_FALSE;
- pAC->GIni.GIYukon = SK_FALSE;
- pAC->GIni.GIYukonLite = SK_FALSE;
-+ pAC->GIni.GIVauxAvail = SK_FALSE;
-
- #ifdef GENESIS
- if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
-
- pAC->GIni.GIGenesis = SK_TRUE;
-
-- if (Byte == (SK_U8)3) {
-+ if (Byte == (SK_U8)3) {
- /* special case: 4 x 64k x 36, offset = 0x80000 */
- pAC->GIni.GIRamSize = 1024;
- pAC->GIni.GIRamOffs = (SK_U32)512 * 1024;
-@@ -1591,57 +2293,83 @@ SK_IOC IoC) /* IO context */
- pAC->GIni.GIRamSize = (int)Byte * 512;
- pAC->GIni.GIRamOffs = 0;
- }
-- /* all GE adapters work with 53.125 MHz host clock */
-+ /* all GENESIS adapters work with 53.125 MHz host clock */
- pAC->GIni.GIHstClkFact = SK_FACT_53;
--
-+
- /* set Descr. Poll Timer Init Value to 250 ms */
- pAC->GIni.GIPollTimerVal =
- SK_DPOLL_DEF * (SK_U32)pAC->GIni.GIHstClkFact / 100;
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) {
--
-+
- pAC->GIni.GIYukon = SK_TRUE;
--
-+
- pAC->GIni.GIRamSize = (Byte == (SK_U8)0) ? 128 : (int)Byte * 4;
--
-+
-+#ifndef SK_SLIM
- pAC->GIni.GIRamOffs = 0;
--
-- /* WA for chip Rev. A */
-+
-+ /* WA for Yukon chip Rev. A */
- pAC->GIni.GIWolOffs = (pAC->GIni.GIChipId == CHIP_ID_YUKON &&
- pAC->GIni.GIChipRev == 0) ? WOL_REG_OFFS : 0;
--
-+
- /* get PM Capabilities of PCI config space */
-- SK_IN16(IoC, PCI_C(PCI_PM_CAP_REG), &Word);
-+ SK_IN16(IoC, PCI_C(pAC, PCI_PM_CAP_REG), &Word);
-
- /* check if VAUX is available */
-- if (((CtrlStat & CS_VAUX_AVAIL) != 0) &&
-+ if (((CtrlStat & VauxAvail) != 0) &&
- /* check also if PME from D3cold is set */
- ((Word & PCI_PME_D3C_SUP) != 0)) {
- /* set entry in GE init struct */
- pAC->GIni.GIVauxAvail = SK_TRUE;
- }
--
-- if (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) {
-- /* this is Rev. A1 */
-- pAC->GIni.GIYukonLite = SK_TRUE;
-- }
-- else {
-- /* save Flash-Address Register */
-- SK_IN32(IoC, B2_FAR, &DWord);
-+#endif /* !SK_SLIM */
-
-- /* test Flash-Address Register */
-- SK_OUT8(IoC, B2_FAR + 3, 0xff);
-- SK_IN8(IoC, B2_FAR + 3, &Byte);
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-
-- if (Byte != 0) {
-- /* this is Rev. A0 */
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) {
-+ /* this is Rev. A1 */
- pAC->GIni.GIYukonLite = SK_TRUE;
-+ }
-+#ifndef SK_SLIM
-+ else {
-+ /* save Flash-Address Register */
-+ SK_IN32(IoC, B2_FAR, &DWord);
-
-- /* restore Flash-Address Register */
-- SK_OUT32(IoC, B2_FAR, DWord);
-+ /* test Flash-Address Register */
-+ SK_OUT8(IoC, B2_FAR + 3, 0xff);
-+ SK_IN8(IoC, B2_FAR + 3, &Byte);
-+
-+ if (Byte != 0) {
-+ /* this is Rev. A0 */
-+ pAC->GIni.GIYukonLite = SK_TRUE;
-+
-+ /* restore Flash-Address Register */
-+ SK_OUT32(IoC, B2_FAR, DWord);
-+ }
-+ }
-+#endif /* !SK_SLIM */
-+ }
-+ else {
-+ /* Check for CLS = 0 (dev. #4.55) */
-+ if (pAC->GIni.GIPciBus != SK_PEX_BUS) {
-+ /* PCI and PCI-X */
-+ SK_IN8(IoC, PCI_C(pAC, PCI_CACHE_LSZ), &Byte);
-+
-+ if (Byte == 0) {
-+ /* set CLS to 2 if configured to 0 */
-+ SK_OUT8(IoC, PCI_C(pAC, PCI_CACHE_LSZ), 2);
-+ }
-+
-+ if (pAC->GIni.GIPciBus == SK_PCIX_BUS) {
-+ /* set Cache Line Size opt. */
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_1), &DWord);
-+ DWord |= PCI_CLS_OPT;
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_1), DWord);
-+ }
- }
- }
-
-@@ -1649,138 +2377,282 @@ SK_IOC IoC) /* IO context */
- SK_OUT8(IoC, B0_POWER_CTRL, (SK_U8)(PC_VAUX_ENA | PC_VCC_ENA |
- PC_VAUX_OFF | PC_VCC_ON));
-
-- /* read the Interrupt source */
-- SK_IN32(IoC, B0_ISRC, &DWord);
--
-- if ((DWord & IS_HW_ERR) != 0) {
-- /* read the HW Error Interrupt source */
-- SK_IN32(IoC, B0_HWE_ISRC, &DWord);
--
-- if ((DWord & IS_IRQ_SENSOR) != 0) {
-- /* disable HW Error IRQ */
-- pAC->GIni.GIValIrqMask &= ~IS_HW_ERR;
-+ Byte = 0;
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ switch (pAC->GIni.GIChipId) {
-+ /* PEX adapters work with different host clock */
-+ case CHIP_ID_YUKON_EC:
-+ case CHIP_ID_YUKON_EC_U:
-+ /* Yukon-EC works with 125 MHz host clock */
-+ pAC->GIni.GIHstClkFact = SK_FACT_125;
-+ break;
-+ case CHIP_ID_YUKON_FE:
-+ /* Yukon-FE works with 100 MHz host clock */
-+ pAC->GIni.GIHstClkFact = SK_FACT_100;
-+ break;
-+ case CHIP_ID_YUKON_XL:
-+ /* all Yukon-2 adapters work with 156 MHz host clock */
-+ pAC->GIni.GIHstClkFact = 2 * SK_FACT_78;
-+
-+ if (pAC->GIni.GIChipRev > CHIP_REV_YU_XL_A1) {
-+ /* enable bits are inverted */
-+ Byte = (SK_U8)(Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
-+ Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
-+ Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
-+ }
-+ break;
-+ default:
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_HWI_E006,
-+ SKERR_HWI_E006MSG);
-+ }
-+
-+ pAC->GIni.GIPollTimerVal =
-+ SK_DPOLL_DEF_Y2 * (SK_U32)pAC->GIni.GIHstClkFact / 100;
-+
-+ /* set power down bit */
-+ PowerDownBit = PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD;
-+
-+ /* disable Core Clock Division, set Clock Select to 0 (Yukon-2) */
-+ SK_OUT32(IoC, B2_Y2_CLK_CTRL, Y2_CLK_DIV_DIS);
-+
-+ /* enable MAC/PHY, PCI and Core Clock for both Links */
-+ SK_OUT8(IoC, B2_Y2_CLK_GATE, Byte);
-+ }
-+ else {
-+ /* YUKON adapters work with 78 MHz host clock */
-+ pAC->GIni.GIHstClkFact = SK_FACT_78;
-+
-+ pAC->GIni.GIPollTimerVal = SK_DPOLL_MAX; /* 215 ms */
-+
-+ /* read the Interrupt source */
-+ SK_IN32(IoC, B0_ISRC, &DWord);
-+
-+ if ((DWord & IS_HW_ERR) != 0) {
-+ /* read the HW Error Interrupt source */
-+ SK_IN32(IoC, B0_HWE_ISRC, &DWord);
-+
-+ if ((DWord & IS_IRQ_SENSOR) != 0) {
-+ /* disable HW Error IRQ */
-+ pAC->GIni.GIValIrqMask &= ~IS_HW_ERR;
-+ }
- }
-+ /* set power down bit */
-+ PowerDownBit = PCI_PHY_COMA;
- }
--
-- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-- /* set GMAC Link Control reset */
-- SK_OUT16(IoC, MR_ADDR(i, GMAC_LINK_CTRL), GMLC_RST_SET);
-
-- /* clear GMAC Link Control reset */
-- SK_OUT16(IoC, MR_ADDR(i, GMAC_LINK_CTRL), GMLC_RST_CLR);
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_1), &Our1);
-+
-+ Our1 &= ~PowerDownBit;
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL &&
-+ pAC->GIni.GIChipRev > CHIP_REV_YU_XL_A1) {
-+ /* deassert Low Power for 1st PHY */
-+ Our1 |= PCI_Y2_PHY1_COMA;
-+
-+ if (pAC->GIni.GIMacsFound > 1) {
-+ /* deassert Low Power for 2nd PHY */
-+ Our1 |= PCI_Y2_PHY2_COMA;
-+ }
-+ }
-+ else if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) {
-+ /* enable HW WOL */
-+ SK_OUT16(IoC, B0_CTST, (SK_U16)Y2_HW_WOL_ON);
-+
-+ /* enable all clocks */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_3), 0);
-+
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_4), &DWord);
-+
-+ DWord &= P_ASPM_CONTROL_MSK;
-+ /* set all bits to 0 except bits 15..12 */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_4), DWord);
-+
-+ /* set to default value */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_5), 0);
-+ }
-+
-+ /* release PHY from PowerDown/COMA Mode */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_1), Our1);
-+
-+ if (!pAC->GIni.GIAsfEnabled) {
-+
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ /* set Link Control reset */
-+ SK_OUT8(IoC, MR_ADDR(i, GMAC_LINK_CTRL), (SK_U8)GMLC_RST_SET);
-+
-+ /* clear Link Control reset */
-+ SK_OUT8(IoC, MR_ADDR(i, GMAC_LINK_CTRL), (SK_U8)GMLC_RST_CLR);
-+ }
- }
-- /* all YU chips work with 78.125 MHz host clock */
-- pAC->GIni.GIHstClkFact = SK_FACT_78;
--
-- pAC->GIni.GIPollTimerVal = SK_DPOLL_MAX; /* 215 ms */
- }
- #endif /* YUKON */
-
-- /* check if 64-bit PCI Slot is present */
-- pAC->GIni.GIPciSlot64 = (SK_BOOL)((CtrlStat & CS_BUS_SLOT_SZ) != 0);
--
-- /* check if 66 MHz PCI Clock is active */
-- pAC->GIni.GIPciClock66 = (SK_BOOL)((CtrlStat & CS_BUS_CLOCK) != 0);
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+
-+#ifndef SK_SLIM
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* this is a conventional PCI bus */
-+ pAC->GIni.GIPciBus = SK_PCI_BUS;
-+
-+ /* check if 64-bit PCI Slot is present */
-+ pAC->GIni.GIPciSlot64 = (SK_BOOL)((CtrlStat & CS_BUS_SLOT_SZ) != 0);
-+
-+ /* check if 66 MHz PCI Clock is active */
-+ pAC->GIni.GIPciClock66 = (SK_BOOL)((CtrlStat & CS_BUS_CLOCK) != 0);
-+ }
-
- /* read PCI HW Revision Id. */
-- SK_IN8(IoC, PCI_C(PCI_REV_ID), &Byte);
-+ SK_IN8(IoC, PCI_C(pAC, PCI_REV_ID), &Byte);
- pAC->GIni.GIPciHwRev = Byte;
-
-+ /* read connector type */
-+ SK_IN8(IoC, B2_CONN_TYP, &pAC->GIni.GIConTyp);
-+#endif /* !SK_SLIM */
-+
- /* read the PMD type */
- SK_IN8(IoC, B2_PMD_TYP, &Byte);
-- pAC->GIni.GICopperType = (SK_U8)(Byte == 'T');
-
-- /* read the PHY type */
-+ pAC->GIni.GIPmdTyp = Byte;
-+
-+ FiberType = (Byte == 'L' || Byte == 'S' || Byte == 'P');
-+
-+ pAC->GIni.GICopperType = (SK_BOOL)(Byte == 'T' || Byte == '1' ||
-+ (pAC->GIni.GIYukon2 && !FiberType));
-+
-+ /* read the PHY type (Yukon and Genesis) */
- SK_IN8(IoC, B2_E_1, &Byte);
-
- Byte &= 0x0f; /* the PHY type is stored in the lower nibble */
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
--
-+
-+ pPrt = &pAC->GIni.GP[i];
-+
-+ /* get the MAC addresses */
-+ for (j = 0; j < 3; j++) {
-+ SK_IN16(IoC, B2_MAC_1 + i * 8 + j * 2, &pPrt->PMacAddr[j]);
-+ }
-+
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
- switch (Byte) {
- case SK_PHY_XMAC:
-- pAC->GIni.GP[i].PhyAddr = PHY_ADDR_XMAC;
-+ pPrt->PhyAddr = PHY_ADDR_XMAC;
- break;
- case SK_PHY_BCOM:
-- pAC->GIni.GP[i].PhyAddr = PHY_ADDR_BCOM;
-- pAC->GIni.GP[i].PMSCap = (SK_U8)(SK_MS_CAP_AUTO |
-+ pPrt->PhyAddr = PHY_ADDR_BCOM;
-+ pPrt->PMSCap = (SK_U8)(SK_MS_CAP_AUTO |
- SK_MS_CAP_MASTER | SK_MS_CAP_SLAVE);
- break;
- #ifdef OTHER_PHY
- case SK_PHY_LONE:
-- pAC->GIni.GP[i].PhyAddr = PHY_ADDR_LONE;
-+ pPrt->PhyAddr = PHY_ADDR_LONE;
- break;
- case SK_PHY_NAT:
-- pAC->GIni.GP[i].PhyAddr = PHY_ADDR_NAT;
-+ pPrt->PhyAddr = PHY_ADDR_NAT;
- break;
- #endif /* OTHER_PHY */
- default:
- /* ERROR: unexpected PHY type detected */
- RetVal = 5;
-- break;
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-- if (Byte < (SK_U8)SK_PHY_MARV_COPPER) {
-+
-+ if (((Byte < (SK_U8)SK_PHY_MARV_COPPER) || pAC->GIni.GIYukon2) &&
-+ !FiberType) {
- /* if this field is not initialized */
- Byte = (SK_U8)SK_PHY_MARV_COPPER;
--
-+
- pAC->GIni.GICopperType = SK_TRUE;
- }
--
-- pAC->GIni.GP[i].PhyAddr = PHY_ADDR_MARV;
--
-+
-+ pPrt->PhyAddr = PHY_ADDR_MARV;
-+
- if (pAC->GIni.GICopperType) {
-
-- pAC->GIni.GP[i].PLinkSpeedCap = (SK_U8)(SK_LSPEED_CAP_AUTO |
-- SK_LSPEED_CAP_10MBPS | SK_LSPEED_CAP_100MBPS |
-- SK_LSPEED_CAP_1000MBPS);
--
-- pAC->GIni.GP[i].PLinkSpeed = (SK_U8)SK_LSPEED_AUTO;
--
-- pAC->GIni.GP[i].PMSCap = (SK_U8)(SK_MS_CAP_AUTO |
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE ||
-+ (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC &&
-+ pAC->GIni.GIChipCap == 2)) {
-+
-+ pPrt->PLinkSpeedCap = (SK_U8)(SK_LSPEED_CAP_100MBPS |
-+ SK_LSPEED_CAP_10MBPS);
-+
-+ pAC->GIni.GIRamSize = 4;
-+ }
-+ else {
-+ pPrt->PLinkSpeedCap = (SK_U8)(SK_LSPEED_CAP_1000MBPS |
-+ SK_LSPEED_CAP_100MBPS | SK_LSPEED_CAP_10MBPS |
-+ SK_LSPEED_CAP_AUTO);
-+ }
-+
-+ pPrt->PLinkSpeed = (SK_U8)SK_LSPEED_AUTO;
-+
-+ pPrt->PMSCap = (SK_U8)(SK_MS_CAP_AUTO |
- SK_MS_CAP_MASTER | SK_MS_CAP_SLAVE);
- }
- else {
- Byte = (SK_U8)SK_PHY_MARV_FIBER;
- }
- }
-+
-+ /* clear TWSI IRQ */
-+ SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-+
- #endif /* YUKON */
--
-- pAC->GIni.GP[i].PhyType = (int)Byte;
--
-+
-+ pPrt->PhyType = (int)Byte;
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-- ("PHY type: %d PHY addr: %04x\n", Byte,
-- pAC->GIni.GP[i].PhyAddr));
-+ ("PHY type: %d PHY addr: %04x\n",
-+ Byte, pPrt->PhyAddr));
- }
--
-+
- /* get MAC Type & set function pointers dependent on */
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- pAC->GIni.GIMacType = SK_MAC_XMAC;
-
- pAC->GIni.GIFunc.pFnMacUpdateStats = SkXmUpdateStats;
- pAC->GIni.GIFunc.pFnMacStatistic = SkXmMacStatistic;
- pAC->GIni.GIFunc.pFnMacResetCounter = SkXmResetCounter;
- pAC->GIni.GIFunc.pFnMacOverflow = SkXmOverflowStatus;
-+#ifdef SK_DIAG
-+ pAC->GIni.GIFunc.pFnMacPhyRead = SkXmPhyRead;
-+ pAC->GIni.GIFunc.pFnMacPhyWrite = SkXmPhyWrite;
-+#else /* SK_DIAG */
-+ pAC->GIni.GIFunc.pSkGeSirqIsr = SkGeYuSirqIsr;
-+#endif /* !SK_DIAG */
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
-+#ifndef SK_SLIM
- pAC->GIni.GIMacType = SK_MAC_GMAC;
-
- pAC->GIni.GIFunc.pFnMacUpdateStats = SkGmUpdateStats;
- pAC->GIni.GIFunc.pFnMacStatistic = SkGmMacStatistic;
- pAC->GIni.GIFunc.pFnMacResetCounter = SkGmResetCounter;
- pAC->GIni.GIFunc.pFnMacOverflow = SkGmOverflowStatus;
-+#endif /* !SK_SLIM */
-+
-+#ifdef SK_DIAG
-+ pAC->GIni.GIFunc.pFnMacPhyRead = SkGmPhyRead;
-+ pAC->GIni.GIFunc.pFnMacPhyWrite = SkGmPhyWrite;
-+#else /* SK_DIAG */
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ pAC->GIni.GIFunc.pSkGeSirqIsr = SkYuk2SirqIsr;
-+ }
-+ else {
-+ pAC->GIni.GIFunc.pSkGeSirqIsr = SkGeYuSirqIsr;
-+ }
-+#endif /* !SK_DIAG */
-
- #ifdef SPECIAL_HANDLING
- if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
-@@ -1793,7 +2665,13 @@ SK_IOC IoC) /* IO context */
- #endif
- }
- #endif /* YUKON */
--
-+
-+#ifndef SK_SLIM
-+
-+ SkGeSetUpSupFeatures(pAC, IoC);
-+
-+#endif /* !SK_SLIM */
-+
- return(RetVal);
- } /* SkGeInit1 */
-
-@@ -1814,9 +2692,12 @@ SK_IOC IoC) /* IO context */
- * nothing
- */
- static void SkGeInit2(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
-+#ifdef YUKON
-+ SK_U16 Word;
-+#endif /* YUKON */
- #ifdef GENESIS
- SK_U32 DWord;
- #endif /* GENESIS */
-@@ -1850,13 +2731,13 @@ SK_IOC IoC) /* IO context */
- SkGeInitPktArb(pAC, IoC);
- }
- #endif /* GENESIS */
--
--#ifdef YUKON
-+
-+#ifdef xSK_DIAG
- if (pAC->GIni.GIYukon) {
- /* start Time Stamp Timer */
- SK_OUT8(IoC, GMAC_TI_ST_CTRL, (SK_U8)GMT_ST_START);
- }
--#endif /* YUKON */
-+#endif /* SK_DIAG */
-
- /* enable the Tx Arbiters */
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-@@ -1866,8 +2747,34 @@ SK_IOC IoC) /* IO context */
- /* enable the RAM Interface Arbiter */
- SkGeInitRamIface(pAC, IoC);
-
-+#ifdef YUKON
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+
-+ if (pAC->GIni.GIPciBus == SK_PEX_BUS) {
-+
-+ SK_IN16(IoC, PCI_C(pAC, PEX_DEV_CTRL), &Word);
-+
-+ /* change Max. Read Request Size to 2048 bytes */
-+ Word &= ~PEX_DC_MAX_RRS_MSK;
-+ Word |= PEX_DC_MAX_RD_RQ_SIZE(4);
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+
-+ SK_OUT16(IoC, PCI_C(pAC, PEX_DEV_CTRL), Word);
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+ }
-+
-+ /*
-+ * Writing the HW Error Mask Reg. will not generate an IRQ
-+ * as long as the B0_IMSK is not set by the driver.
-+ */
-+ SK_OUT32(IoC, B0_HWE_IMSK, pAC->GIni.GIValHwIrqMask);
-+ }
-+#endif /* YUKON */
- } /* SkGeInit2 */
-
-+
- /******************************************************************************
- *
- * SkGeInit() - Initialize the GE Adapter with the specified level.
-@@ -1889,7 +2796,7 @@ SK_IOC IoC) /* IO context */
- * if Number of MACs > SK_MAX_MACS
- *
- * After returning from Level 0 the adapter
-- * may be accessed with IO operations.
-+ * may be accessed with I/O operations.
- *
- * Level 2: start the Blink Source Counter
- *
-@@ -1898,14 +2805,14 @@ SK_IOC IoC) /* IO context */
- * 1: Number of MACs exceeds SK_MAX_MACS (after level 1)
- * 2: Adapter not present or not accessible
- * 3: Illegal initialization level
-- * 4: Initialization Level 1 Call missing
-+ * 4: Initialization level 1 call missing
- * 5: Unexpected PHY type detected
- * 6: HW self test failed
- */
- int SkGeInit(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
--int Level) /* initialization level */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Level) /* Initialization Level */
- {
- int RetVal; /* return value */
- SK_U32 DWord;
-@@ -1920,7 +2827,7 @@ int Level) /* initialization level */
- SkGeInit0(pAC, IoC);
- pAC->GIni.GILevel = SK_INIT_DATA;
- break;
--
-+
- case SK_INIT_IO:
- /* Initialization Level 1 */
- RetVal = SkGeInit1(pAC, IoC);
-@@ -1932,22 +2839,24 @@ int Level) /* initialization level */
- SK_OUT32(IoC, B2_IRQM_INI, SK_TEST_VAL);
- SK_IN32(IoC, B2_IRQM_INI, &DWord);
- SK_OUT32(IoC, B2_IRQM_INI, 0L);
--
-+
- if (DWord != SK_TEST_VAL) {
- RetVal = 2;
- break;
- }
-
-+#ifdef DEBUG
- /* check if the number of GIMacsFound matches SK_MAX_MACS */
- if (pAC->GIni.GIMacsFound > SK_MAX_MACS) {
- RetVal = 1;
- break;
- }
-+#endif /* DEBUG */
-
- /* Level 1 successfully passed */
- pAC->GIni.GILevel = SK_INIT_IO;
- break;
--
-+
- case SK_INIT_RUN:
- /* Initialization Level 2 */
- if (pAC->GIni.GILevel != SK_INIT_IO) {
-@@ -1957,12 +2866,13 @@ int Level) /* initialization level */
- RetVal = 4;
- break;
- }
-+
- SkGeInit2(pAC, IoC);
-
- /* Level 2 successfully passed */
- pAC->GIni.GILevel = SK_INIT_RUN;
- break;
--
-+
- default:
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E003, SKERR_HWI_E003MSG);
- RetVal = 3;
-@@ -1985,77 +2895,82 @@ int Level) /* initialization level */
- * nothing
- */
- void SkGeDeInit(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC) /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
- {
- int i;
- SK_U16 Word;
-
--#ifdef SK_PHY_LP_MODE
-- SK_U8 Byte;
-+#ifdef SK_PHY_LP_MODE_DEEP_SLEEP
- SK_U16 PmCtlSts;
--#endif /* SK_PHY_LP_MODE */
-+#endif
-
- #if (!defined(SK_SLIM) && !defined(VCPU))
- /* ensure I2C is ready */
- SkI2cWaitIrq(pAC, IoC);
--#endif
--
-- /* stop all current transfer activity */
-- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-- if (pAC->GIni.GP[i].PState != SK_PRT_STOP &&
-- pAC->GIni.GP[i].PState != SK_PRT_RESET) {
--
-- SkGeStopPort(pAC, IoC, i, SK_STOP_ALL, SK_HARD_RST);
-- }
-- }
-+#endif
-
--#ifdef SK_PHY_LP_MODE
-- /*
-+#ifdef SK_PHY_LP_MODE_DEEP_SLEEP
-+ /*
- * for power saving purposes within mobile environments
-- * we set the PHY to coma mode and switch to D3 power state.
-+ * we set the PHY to coma mode.
- */
-- if (pAC->GIni.GIYukonLite &&
-- pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
-+#ifdef XXX
-+ if (pAC->GIni.GIVauxAvail) {
-+ /* switch power to VAUX */
-+ SK_OUT8(IoC, B0_POWER_CTRL, (SK_U8)(PC_VAUX_ENA | PC_VCC_ENA |
-+ PC_VAUX_ON | PC_VCC_OFF));
-+ }
-+#endif /* XXX */
-+
-+ if (CHIP_ID_YUKON_2(pAC) && /* pAC->GIni.GIMacsFound == 1 && */
-+ !pAC->GIni.GIAsfEnabled
-+#ifdef XXX
-+ || (pAC->GIni.GIYukonLite && pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3)
-+#endif /* XXX */
-+ ) {
-+
-+ /* flag for SkGmEnterLowPowerMode() that the call was from here */
-+ pAC->GIni.GILevel = SK_INIT_IO;
-
- /* for all ports switch PHY to coma mode */
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
--
-- SkGmEnterLowPowerMode(pAC, IoC, i, PHY_PM_DEEP_SLEEP);
-- }
--
-- if (pAC->GIni.GIVauxAvail) {
-- /* switch power to VAUX */
-- Byte = PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF;
-
-- SK_OUT8(IoC, B0_POWER_CTRL, Byte);
-+ (void)SkGmEnterLowPowerMode(pAC, IoC, i, PHY_PM_DEEP_SLEEP);
- }
--
-- /* switch to D3 state */
-- SK_IN16(IoC, PCI_C(PCI_PM_CTL_STS), &PmCtlSts);
--
-- PmCtlSts |= PCI_PM_STATE_D3;
-+ }
-+#else /* !SK_PHY_LP_MODE_DEEP_SLEEP */
-
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+ if (!pAC->GIni.GIAsfEnabled) {
-+ /* stop all current transfer activity */
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (pAC->GIni.GP[i].PState != SK_PRT_STOP &&
-+ pAC->GIni.GP[i].PState != SK_PRT_RESET) {
-
-- SK_OUT16(IoC, PCI_C(PCI_PM_CTL_STS), PmCtlSts);
-+ SkGeStopPort(pAC, IoC, i, SK_STOP_ALL, SK_HARD_RST);
-+ }
-+ }
- }
--#endif /* SK_PHY_LP_MODE */
-
-- /* Reset all bits in the PCI STATUS register */
-+ /* reset all bits in the PCI STATUS register */
- /*
- * Note: PCI Cfg cycles cannot be used, because they are not
- * available on some platforms after 'boot time'.
- */
-- SK_IN16(IoC, PCI_C(PCI_STATUS), &Word);
--
-+ SK_IN16(IoC, PCI_C(pAC, PCI_STATUS), &Word);
-+
- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-- SK_OUT16(IoC, PCI_C(PCI_STATUS), (SK_U16)(Word | PCI_ERRBITS));
-+
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_STATUS), Word | (SK_U16)PCI_ERRBITS);
-+
- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-
-- /* do the reset, all LEDs are switched off now */
-- SK_OUT8(IoC, B0_CTST, CS_RST_SET);
--
-+ if (!pAC->GIni.GIAsfEnabled) {
-+ /* set the SW-reset */
-+ SK_OUT8(IoC, B0_CTST, CS_RST_SET);
-+ }
-+#endif /* !SK_PHY_LP_MODE_DEEP_SLEEP */
-+
- pAC->GIni.GILevel = SK_INIT_DATA;
- } /* SkGeDeInit */
-
-@@ -2089,8 +3004,8 @@ SK_IOC IoC) /* IO context */
- * 2: The port has to be stopped before it can be initialized again.
- */
- int SkGeInitPort(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port to configure */
- {
- SK_GEPORT *pPrt;
-@@ -2101,8 +3016,8 @@ int Port) /* Port to configure */
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E004, SKERR_HWI_E004MSG);
- return(1);
- }
--
-- if (pPrt->PState == SK_PRT_INIT || pPrt->PState == SK_PRT_RUN) {
-+
-+ if (pPrt->PState >= SK_PRT_INIT) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E005, SKERR_HWI_E005MSG);
- return(2);
- }
-@@ -2119,29 +3034,29 @@ int Port) /* Port to configure */
- SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_ENA);
- SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_ENA);
- /* The Link LED is initialized by RLMT or Diagnostics itself */
--
-+
- SkXmInitMac(pAC, IoC, Port);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
-
- SkGmInitMac(pAC, IoC, Port);
- }
- #endif /* YUKON */
--
-+
- /* do NOT initialize the Link Sync Counter */
-
- SkGeInitMacFifo(pAC, IoC, Port);
--
-+
- SkGeInitRamBufs(pAC, IoC, Port);
--
-+
- if (pPrt->PXSQSize != 0) {
- /* enable Force Sync bit if synchronous queue available */
- SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_ENA_FSYNC);
- }
--
-+
- SkGeInitBmu(pAC, IoC, Port);
-
- /* mark port as initialized */
-@@ -2149,3 +3064,192 @@ int Port) /* Port to configure */
-
- return(0);
- } /* SkGeInitPort */
-+
-+
-+#if (defined(YUK2) && !defined(SK_SLIM))
-+/******************************************************************************
-+ *
-+ * SkGeRamWrite() - Writes One quadword to RAM
-+ *
-+ * Returns:
-+ * 0
-+ */
-+static void SkGeRamWrite(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 Addr, /* Address to be written to (in quadwords) */
-+SK_U32 LowDword, /* Lower Dword to be written */
-+SK_U32 HighDword, /* Upper Dword to be written */
-+int Port) /* Select RAM buffer (Yukon-2 has 2 RAM buffers) */
-+{
-+ SK_OUT32(IoC, SELECT_RAM_BUFFER(Port, B3_RAM_ADDR), Addr);
-+
-+ /* Write Access is initiated by writing the upper Dword */
-+ SK_OUT32(IoC, SELECT_RAM_BUFFER(Port, B3_RAM_DATA_LO), LowDword);
-+ SK_OUT32(IoC, SELECT_RAM_BUFFER(Port, B3_RAM_DATA_HI), HighDword);
-+}
-+
-+/******************************************************************************
-+ *
-+ * SkYuk2RestartRxBmu() - Restart Receive BMU on Yukon-2
-+ *
-+ * return:
-+ * 0 o.k.
-+ * 1 timeout
-+ */
-+int SkYuk2RestartRxBmu(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Port) /* Port Index (MAC_1 + n) */
-+{
-+ SK_U16 Word;
-+ SK_U16 MacCtrl;
-+ SK_U16 RxCtrl;
-+ SK_U16 FlushMask;
-+ SK_U16 FlushTrsh;
-+ SK_U32 RamAdr;
-+ SK_U32 StartTime;
-+ SK_U32 CurrTime;
-+ SK_U32 Delta;
-+ SK_U32 TimeOut;
-+ SK_GEPORT *pPrt; /* GIni Port struct pointer */
-+ int Rtv;
-+
-+ Rtv = 0;
-+
-+ pPrt = &pAC->GIni.GP[Port];
-+
-+/*
-+ 1. save Rx MAC FIFO Flush Mask and Rx MAC FIFO Flush Threshold
-+ 2. save GMAC Rx Control Register
-+ 3. re-initialize MAC Rx FIFO, Rx RAM Buffer Queue, PCI Rx FIFO,
-+ Rx BMU and Rx Prefetch Unit of the link.
-+ 4. set Rx MAC FIFO Flush Mask to 0xffff
-+ set Rx MAC FIFO Flush Threshold to a high value, e.g. 0x20
-+ 5. set GMAC to loopback mode and switch GMAC back to Rx/Tx enable
-+ 6. clear Rx/Tx Frame Complete IRQ in Rx/T MAC FIFO Control Register
-+ 7. send one packet with a size of 64bytes (size below flush threshold)
-+ from TXA RAM Buffer Queue to set the rx_sop flop:
-+ - set TxAQ Write Pointer to (packet size in qwords + 2)
-+ - set TxAQ Level to (packet size in qwords + 2)
-+ - write Internal Status Word 1 and 2 to TxAQ RAM Buffer Queue QWord 0,1
-+ according to figure 61 on page 330 of Yukon-2 Spec.
-+ - write MAC header with Destination Address = own MAC address to
-+ TxAQ RAM Buffer Queue QWords 2 and 3
-+ - set TxAQ Packet Counter to 1 -> packet is transmitted immediately
-+ 8. poll GMAC IRQ Source Register for IRQ Rx/Tx Frame Complete
-+ 9. restore GMAC Rx Control Register
-+10. restore Rx MAC FIFO Flush Mask and Rx MAC FIFO Flush Threshold
-+11. set GMAC back to GMII mode
-+*/
-+
-+ /* save Rx GMAC FIFO Flush Mask */
-+ SK_IN16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), &FlushMask);
-+
-+ /* save Rx GMAC FIFO Flush Threshold */
-+ SK_IN16(IoC, MR_ADDR(Port, RX_GMF_FL_THR), &FlushTrsh);
-+
-+ /* save GMAC Rx Control Register */
-+ GM_IN16(IoC, Port, GM_RX_CTRL, &RxCtrl);
-+
-+ /* configure the GMAC FIFOs */
-+ SkGeInitMacFifo(pAC, IoC, Port);
-+
-+ SkGeInitRamBufs(pAC, IoC, Port);
-+
-+ SkGeInitBmu(pAC, IoC, Port);
-+
-+ /* configure Rx GMAC FIFO */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), GMF_RX_CTRL_DEF);
-+
-+ /* set Rx GMAC FIFO Flush Mask */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), 0xffff);
-+
-+ /* set Rx GMAC FIFO Flush Threshold */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_THR), 0x20);
-+
-+ /* set to promiscuous mode */
-+ Word = RxCtrl & ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
-+
-+ /* set GMAC Rx Control Register */
-+ GM_OUT16(IoC, Port, GM_RX_CTRL, Word);
-+
-+ /* get General Purpose Control */
-+ GM_IN16(IoC, Port, GM_GP_CTRL, &MacCtrl);
-+
-+ /* enable MAC Loopback Mode*/
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, MacCtrl | GM_GPCR_LOOP_ENA);
-+
-+ /* enable MAC Loopback Mode and Rx/Tx */
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, MacCtrl | GM_GPCR_LOOP_ENA |
-+ GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
-+
-+ /* clear GMAC IRQ Rx Frame Complete */
-+ SK_OUT8(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), (SK_U8)GMF_CLI_RX_FC);
-+
-+ /* clear GMAC IRQ Tx Frame Complete */
-+ SK_OUT8(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), (SK_U8)GMF_CLI_TX_FC);
-+
-+ /* send one packet with a size of 64bytes from RAM buffer*/
-+
-+ RamAdr = pPrt->PXaQRamStart / 8;
-+
-+ SK_OUT32(IoC, RB_ADDR(pPrt->PXaQOff, RB_WP), RamAdr + 10);
-+
-+ SK_OUT32(IoC, RB_ADDR(pPrt->PXaQOff, RB_LEV), 10);
-+
-+ /* write 1st status quad word (packet end address in RAM, packet length */
-+ SkGeRamWrite(pAC, IoC, RamAdr, (RamAdr + 9) << 16, 64, Port);
-+
-+ /* write 2nd status quad word */
-+ SkGeRamWrite(pAC, IoC, RamAdr + 1, 0, 0, Port);
-+
-+ /* write DA to MAC header */
-+ SkGeRamWrite(pAC, IoC, RamAdr + 2, *(SK_U32 *)&pPrt->PMacAddr[0],
-+ *(SK_U32 *)&pPrt->PMacAddr[2], Port);
-+
-+ SK_OUT32(IoC, RB_ADDR(pPrt->PXaQOff, RB_PC), 1);
-+
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &StartTime);
-+
-+ /* set timeout to 10 ms */
-+ TimeOut = HW_MS_TO_TICKS(pAC, 10);
-+
-+ do {
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &CurrTime);
-+
-+ if (CurrTime >= StartTime) {
-+ Delta = CurrTime - StartTime;
-+ }
-+ else {
-+ Delta = CurrTime + ~StartTime + 1;
-+ }
-+
-+ if (Delta > TimeOut) {
-+ Rtv = 1;
-+ break;
-+ }
-+
-+ /* read the GMAC Interrupt source register */
-+ SK_IN16(IoC, MR_ADDR(Port, GMAC_IRQ_SRC), &Word);
-+
-+ } while ((Word & (GM_IS_TX_COMPL | GM_IS_RX_COMPL)) !=
-+ (GM_IS_TX_COMPL | GM_IS_RX_COMPL));
-+
-+ /* disable MAC Loopback Mode and Rx/Tx */
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, MacCtrl);
-+
-+ /* restore GMAC Rx Control Register */
-+ GM_OUT16(IoC, Port, GM_RX_CTRL, RxCtrl);
-+
-+ /* restore Rx GMAC FIFO Flush Mask */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), FlushMask);
-+
-+ /* restore Rx GMAC FIFO Flush Threshold */
-+ SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_THR), FlushTrsh);
-+
-+ return(Rtv);
-+
-+} /* SkYuk2RestartRxBmu */
-+#endif /* YUK2 && !SK_SLIM */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/skgemib.c ./drivers/net/sk98lin/skgemib.c
---- ./drivers/net/sk98lin.sk98/skgemib.c 2004-10-19 01:53:06.000000000 +0400
-+++ ./drivers/net/sk98lin/skgemib.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skgemib.c
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.11 $
-- * Date: $Date: 2003/09/15 13:38:12 $
-+ * Version: $Revision: 2.7 $
-+ * Date: $Date: 2004/10/26 12:42:18 $
- * Purpose: Private Network Management Interface Management Database
- *
- ****************************************************************************/
-@@ -251,6 +251,183 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTa
- 0,
- SK_PNMI_RW, DiagActions, 0},
- #endif /* SK_DIAG_SUPPORT */
-+#ifdef SK_ASF
-+ {OID_SKGE_ASF,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_STORE_CONFIG,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_ENA,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS_INT,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_HB_ENA,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_HB_INT,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_WD_ENA,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_WD_TIME,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_IP_SOURCE,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_MAC_SOURCE,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_IP_DEST,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_MAC_DEST,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_COMMUNITY_NAME,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RSP_ENA,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS_COUNT_MIN,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS_COUNT_MAX,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS_INT_MIN,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_RETRANS_INT_MAX,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_HB_INT_MIN,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_HB_INT_MAX,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_WD_TIME_MIN,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_WD_TIME_MAX,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_HB_CAP,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_WD_TIMER_RES,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_GUID,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_KEY_OP,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_KEY_ADM,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_KEY_GEN,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_CAP,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_PAR_1,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_OVERALL_OID,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RW, Asf, 0},
-+ {OID_SKGE_ASF_FWVER_OID,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RO, Asf, 0},
-+ {OID_SKGE_ASF_ACPI_OID,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RO, Asf, 0},
-+ {OID_SKGE_ASF_SMBUS_OID,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RO, Asf, 0},
-+#endif /* SK_ASF */
- {OID_SKGE_MDB_VERSION,
- 1,
- 0,
-@@ -1073,6 +1250,11 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTa
- 0,
- 0,
- SK_PNMI_RO, Vct, 0},
-+ {OID_SKGE_VCT_CAPABILITIES,
-+ 0,
-+ 0,
-+ 0,
-+ SK_PNMI_RO, Vct, 0},
- {OID_SKGE_BOARDLEVEL,
- 0,
- 0,
-diff -Nurap ./drivers/net/sk98lin.sk98/skgepnmi.c ./drivers/net/sk98lin/skgepnmi.c
---- ./drivers/net/sk98lin.sk98/skgepnmi.c 2004-10-19 01:54:40.000000000 +0400
-+++ ./drivers/net/sk98lin/skgepnmi.c 2006-08-31 14:59:52.000000000 +0400
-@@ -1,9 +1,9 @@
- /*****************************************************************************
- *
- * Name: skgepnmi.c
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.111 $
-- * Date: $Date: 2003/09/15 13:35:35 $
-+ * Project: Gigabit Ethernet Adapters, PNMI-Module
-+ * Version: $Revision: 2.24 $
-+ * Date: $Date: 2005/10/21 09:54:35 $
- * Purpose: Private Network Management Interface
- *
- ****************************************************************************/
-@@ -22,11 +22,10 @@
- *
- ******************************************************************************/
-
--
--#ifndef _lint
-+#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skgepnmi.c,v 1.111 2003/09/15 13:35:35 tschilli Exp $ (C) Marvell.";
--#endif /* !_lint */
-+ "@(#) $Id: skgepnmi.c,v 2.24 2005/10/21 09:54:35 mkunz Exp $ (C) Marvell.";
-+#endif
-
- #include "h/skdrv1st.h"
- #include "h/sktypes.h"
-@@ -38,12 +37,14 @@ static const char SysKonnectFileId[] =
- #include "h/skcsum.h"
- #include "h/skvpd.h"
- #include "h/skgehw.h"
-+#include "h/sky2le.h"
- #include "h/skgeinit.h"
- #include "h/skdrv2nd.h"
- #include "h/skgepnm2.h"
- #ifdef SK_POWER_MGMT
- #include "h/skgepmgt.h"
--#endif
-+#endif /* SK_POWER_MGMT */
-+
- /* defines *******************************************************************/
-
- #ifndef DEBUG
-@@ -72,7 +73,6 @@ int SkPnmiEvent(SK_AC *pAC, SK_IOC IoC,
- int SkPnmiGenIoctl(SK_AC *pAC, SK_IOC IoC, void * pBuf,
- unsigned int * pLen, SK_U32 NetIndex);
-
--
- /*
- * Private Function prototypes
- */
-@@ -112,6 +112,12 @@ PNMI_STATIC void VirtualConf(SK_AC *pAC,
- PNMI_STATIC int Vct(SK_AC *pAC, SK_IOC IoC, int Action, SK_U32 Id, char *pBuf,
- unsigned int *pLen, SK_U32 Instance, unsigned int TableIndex, SK_U32 NetIndex);
- PNMI_STATIC void CheckVctStatus(SK_AC *, SK_IOC, char *, SK_U32, SK_U32);
-+PNMI_STATIC void VctGetResults(SK_AC *, SK_IOC, SK_U32);
-+#ifdef SK_ASF
-+PNMI_STATIC int Asf(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id,
-+ char *pBuf, unsigned int *pLen, SK_U32 Instance,
-+ unsigned int TableIndex, SK_U32 NetIndex);
-+#endif /* SK_ASF */
-
- /*
- * Table to correlate OID with handler function and index to
-@@ -353,17 +359,13 @@ PNMI_STATIC const SK_PNMI_STATADDR StatA
- * Always 0
- */
- int SkPnmiInit(
--SK_AC *pAC, /* Pointer to adapter context */
--SK_IOC IoC, /* IO context handle */
--int Level) /* Initialization level */
-+SK_AC *pAC, /* Pointer to adapter context */
-+SK_IOC IoC, /* IO context handle */
-+int Level) /* Initialization level */
- {
- unsigned int PortMax; /* Number of ports */
- unsigned int PortIndex; /* Current port index in loop */
-- SK_U16 Val16; /* Multiple purpose 16 bit variable */
-- SK_U8 Val8; /* Mulitple purpose 8 bit variable */
-- SK_EVPARA EventParam; /* Event struct for timer event */
-- SK_PNMI_VCT *pVctBackupData;
--
-+ SK_EVPARA EventParam; /* Event struct for timer event */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
- ("PNMI: SkPnmiInit: Called, level=%d\n", Level));
-@@ -372,13 +374,19 @@ int Level) /* Initialization level */
-
- case SK_INIT_DATA:
- SK_MEMSET((char *)&pAC->Pnmi, 0, sizeof(pAC->Pnmi));
-+
- pAC->Pnmi.TrapBufFree = SK_PNMI_TRAP_QUEUE_LEN;
- pAC->Pnmi.StartUpTime = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC));
- pAC->Pnmi.RlmtChangeThreshold = SK_PNMI_DEF_RLMT_CHG_THRES;
-+
- for (PortIndex = 0; PortIndex < SK_MAX_MACS; PortIndex ++) {
-
- pAC->Pnmi.Port[PortIndex].ActiveFlag = SK_FALSE;
- pAC->Pnmi.DualNetActiveFlag = SK_FALSE;
-+
-+ /* Initialize DSP variables for Vct() to 0xff => Never written! */
-+ pAC->GIni.GP[PortIndex].PCableLen = 0xff;
-+ pAC->Pnmi.VctBackup[PortIndex].CableLen = 0xff;
- }
-
- #ifdef SK_PNMI_CHECK
-@@ -408,51 +416,36 @@ int Level) /* Initialization level */
- break;
-
- case SK_INIT_IO:
-- /*
-- * Reset MAC counters
-- */
-+
-+ /* Reset MAC counters. */
- PortMax = pAC->GIni.GIMacsFound;
-
- for (PortIndex = 0; PortIndex < PortMax; PortIndex ++) {
-
- pAC->GIni.GIFunc.pFnMacResetCounter(pAC, IoC, PortIndex);
- }
--
-- /* Initialize DSP variables for Vct() to 0xff => Never written! */
-- for (PortIndex = 0; PortIndex < PortMax; PortIndex ++) {
-- pAC->GIni.GP[PortIndex].PCableLen = 0xff;
-- pVctBackupData = &pAC->Pnmi.VctBackup[PortIndex];
-- pVctBackupData->PCableLen = 0xff;
-- }
--
-- /*
-- * Get pci bus speed
-- */
-- SK_IN16(IoC, B0_CTST, &Val16);
-- if ((Val16 & CS_BUS_CLOCK) == 0) {
-
-- pAC->Pnmi.PciBusSpeed = 33;
-+ /* Get PCI bus speed. */
-+ if (pAC->GIni.GIPciClock66) {
-+
-+ pAC->Pnmi.PciBusSpeed = 66;
- }
- else {
-- pAC->Pnmi.PciBusSpeed = 66;
-+ pAC->Pnmi.PciBusSpeed = 33;
- }
-
-- /*
-- * Get pci bus width
-- */
-- SK_IN16(IoC, B0_CTST, &Val16);
-- if ((Val16 & CS_BUS_SLOT_SZ) == 0) {
-+ /* Get PCI bus width. */
-+ if (pAC->GIni.GIPciSlot64) {
-
-- pAC->Pnmi.PciBusWidth = 32;
-+ pAC->Pnmi.PciBusWidth = 64;
- }
- else {
-- pAC->Pnmi.PciBusWidth = 64;
-+ pAC->Pnmi.PciBusWidth = 32;
- }
-
-- /*
-- * Get chipset
-- */
-+ /* Get chipset. */
- switch (pAC->GIni.GIChipId) {
-+
- case CHIP_ID_GENESIS:
- pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_XMAC;
- break;
-@@ -461,57 +454,51 @@ int Level) /* Initialization level */
- pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON;
- break;
-
-+ case CHIP_ID_YUKON_LITE:
-+ pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON_LITE;
-+ break;
-+
-+ case CHIP_ID_YUKON_LP:
-+ pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON_LP;
-+ break;
-+
-+ case CHIP_ID_YUKON_XL:
-+ pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON_XL;
-+ break;
-+
-+ case CHIP_ID_YUKON_EC:
-+ pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON_EC;
-+ break;
-+
-+ case CHIP_ID_YUKON_FE:
-+ pAC->Pnmi.Chipset = SK_PNMI_CHIPSET_YUKON_FE;
-+ break;
-+
- default:
- break;
- }
-
-- /*
-- * Get PMD and DeviceType
-- */
-- SK_IN8(IoC, B2_PMD_TYP, &Val8);
-- switch (Val8) {
-+ /* Get PMD and Device Type. */
-+ switch (pAC->GIni.GIPmdTyp) {
-+
- case 'S':
- pAC->Pnmi.PMD = 3;
-- if (pAC->GIni.GIMacsFound > 1) {
--
-- pAC->Pnmi.DeviceType = 0x00020002;
-- }
-- else {
-- pAC->Pnmi.DeviceType = 0x00020001;
-- }
-+ pAC->Pnmi.DeviceType = 0x00020001;
- break;
-
- case 'L':
- pAC->Pnmi.PMD = 2;
-- if (pAC->GIni.GIMacsFound > 1) {
--
-- pAC->Pnmi.DeviceType = 0x00020004;
-- }
-- else {
-- pAC->Pnmi.DeviceType = 0x00020003;
-- }
-+ pAC->Pnmi.DeviceType = 0x00020003;
- break;
-
- case 'C':
- pAC->Pnmi.PMD = 4;
-- if (pAC->GIni.GIMacsFound > 1) {
--
-- pAC->Pnmi.DeviceType = 0x00020006;
-- }
-- else {
-- pAC->Pnmi.DeviceType = 0x00020005;
-- }
-+ pAC->Pnmi.DeviceType = 0x00020005;
- break;
-
- case 'T':
- pAC->Pnmi.PMD = 5;
-- if (pAC->GIni.GIMacsFound > 1) {
--
-- pAC->Pnmi.DeviceType = 0x00020008;
-- }
-- else {
-- pAC->Pnmi.DeviceType = 0x00020007;
-- }
-+ pAC->Pnmi.DeviceType = 0x00020007;
- break;
-
- default :
-@@ -520,11 +507,14 @@ int Level) /* Initialization level */
- break;
- }
-
-- /*
-- * Get connector
-- */
-- SK_IN8(IoC, B2_CONN_TYP, &Val8);
-- switch (Val8) {
-+ if (pAC->GIni.GIMacsFound > 1) {
-+
-+ pAC->Pnmi.DeviceType++;
-+ }
-+
-+ /* Get connector type. */
-+ switch (pAC->GIni.GIConTyp) {
-+
- case 'C':
- pAC->Pnmi.Connector = 2;
- break;
-@@ -552,17 +542,17 @@ int Level) /* Initialization level */
- break;
-
- case SK_INIT_RUN:
-- /*
-- * Start timer for RLMT change counter
-- */
-+
-+ /* Start timer for RLMT change counter. */
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-+
- SkTimerStart(pAC, IoC, &pAC->Pnmi.RlmtChangeEstimate.EstTimer,
-- 28125000, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER,
-+ SK_PNMI_EVT_TIMER_CHECK, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER,
- EventParam);
- break;
-
- default:
-- break; /* Nothing todo */
-+ break; /* Nothing to do. */
- }
-
- return (0);
-@@ -642,7 +632,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- ("PNMI: SkPnmiPreSetVar: Called, Id=0x%x, BufLen=%d, Instance=%d, NetIndex=%d\n",
- Id, *pLen, Instance, NetIndex));
-
--
- return (PnmiVar(pAC, IoC, SK_PNMI_PRESET, Id, (char *)pBuf, pLen,
- Instance, NetIndex));
- }
-@@ -724,7 +713,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- unsigned int TmpLen;
- char KeyArr[SK_PNMI_VPD_ENTRIES][SK_PNMI_VPD_KEY_SIZE];
-
--
- SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
- ("PNMI: SkPnmiGetStruct: Called, BufLen=%d, NetIndex=%d\n",
- *pLen, NetIndex));
-@@ -733,22 +721,19 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- if (*pLen >= SK_PNMI_MIN_STRUCT_SIZE) {
-
-- SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT,
-- (SK_U32)(-1));
-+ SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT, (SK_U32)(-1));
- }
-
- *pLen = SK_PNMI_STRUCT_SIZE;
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /*
-- * Check NetIndex
-- */
-+ /* Check NetIndex. */
- if (NetIndex >= pAC->Rlmt.NumNets) {
- return (SK_PNMI_ERR_UNKNOWN_NET);
- }
-
-- /* Update statistic */
-+ /* Update statistics. */
- SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On call");
-
- if ((Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1)) !=
-@@ -773,35 +758,37 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (Ret);
- }
-
-- /*
-- * Increment semaphores to indicate that an update was
-- * already done
-- */
-+ /* Increment semaphores to indicate that an update was already done. */
- pAC->Pnmi.MacUpdatedFlag ++;
- pAC->Pnmi.RlmtUpdatedFlag ++;
- pAC->Pnmi.SirqUpdatedFlag ++;
-
-- /* Get vpd keys for instance calculation */
-- Ret = GetVpdKeyArr(pAC, IoC, &KeyArr[0][0], sizeof(KeyArr), &TmpLen);
-- if (Ret != SK_PNMI_ERR_OK) {
-+ /*
-+ * Get VPD keys for instance calculation.
-+ * Please read comment in Vpd().
-+ */
-+ if (pAC->Pnmi.VpdKeyReadError == SK_FALSE) {
-+ Ret = GetVpdKeyArr(pAC, IoC, &KeyArr[0][0], sizeof(KeyArr), &TmpLen);
-+ if (Ret != SK_PNMI_ERR_OK) {
-
-- pAC->Pnmi.MacUpdatedFlag --;
-- pAC->Pnmi.RlmtUpdatedFlag --;
-- pAC->Pnmi.SirqUpdatedFlag --;
-+ pAC->Pnmi.MacUpdatedFlag --;
-+ pAC->Pnmi.RlmtUpdatedFlag --;
-+ pAC->Pnmi.SirqUpdatedFlag --;
-
-- SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On return");
-- SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1));
-- *pLen = SK_PNMI_MIN_STRUCT_SIZE;
-- return (SK_PNMI_ERR_GENERAL);
-+ SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On return");
-+ SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1));
-+ *pLen = SK_PNMI_MIN_STRUCT_SIZE;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
- }
-
-- /* Retrieve values */
-+ /* Retrieve values. */
- SK_MEMSET((char *)pBuf, 0, SK_PNMI_STRUCT_SIZE);
-+
- for (TableIndex = 0; TableIndex < ID_TABLE_SIZE; TableIndex ++) {
-
- InstanceNo = IdTable[TableIndex].InstanceNo;
-- for (InstanceCnt = 1; InstanceCnt <= InstanceNo;
-- InstanceCnt ++) {
-+ for (InstanceCnt = 1; InstanceCnt <= InstanceNo; InstanceCnt ++) {
-
- DstOffset = IdTable[TableIndex].Offset +
- (InstanceCnt - 1) *
-@@ -998,7 +985,6 @@ SK_EVPARA Param) /* Event dependent para
- unsigned int PhysPortIndex;
- unsigned int MaxNetNumber;
- int CounterIndex;
-- int Ret;
- SK_U16 MacStatus;
- SK_U64 OverflowStatus;
- SK_U64 Mask;
-@@ -1012,12 +998,7 @@ SK_EVPARA Param) /* Event dependent para
- SK_U64 Delta;
- SK_PNMI_ESTIMATE *pEst;
- SK_U32 NetIndex;
-- SK_GEPORT *pPrt;
-- SK_PNMI_VCT *pVctBackupData;
- SK_U32 RetCode;
-- int i;
-- SK_U32 CableLength;
--
-
- #ifdef DEBUG
- if (Event != SK_PNMI_EVT_XMAC_RESET) {
-@@ -1048,9 +1029,7 @@ SK_EVPARA Param) /* Event dependent para
- #endif /* DEBUG */
- OverflowStatus = 0;
-
-- /*
-- * Check which source caused an overflow interrupt.
-- */
-+ /* Check which source caused an overflow interrupt. */
- if ((pAC->GIni.GIFunc.pFnMacOverflow(pAC, IoC, PhysPortIndex,
- MacStatus, &OverflowStatus) != 0) ||
- (OverflowStatus == 0)) {
-@@ -1068,7 +1047,6 @@ SK_EVPARA Param) /* Event dependent para
-
- Mask = (SK_U64)1 << CounterIndex;
- if ((OverflowStatus & Mask) == 0) {
--
- continue;
- }
-
-@@ -1100,9 +1078,7 @@ SK_EVPARA Param) /* Event dependent para
- case SK_PNMI_HRX_IRLENGTH:
- case SK_PNMI_HRX_RESERVED:
-
-- /*
-- * the following counters aren't be handled (id > 63)
-- */
-+ /* The following counters aren't be handled (id > 63). */
- case SK_PNMI_HTX_SYNC:
- case SK_PNMI_HTX_SYNC_OCTET:
- break;
-@@ -1189,7 +1165,7 @@ SK_EVPARA Param) /* Event dependent para
- if ((unsigned int)Param.Para64 >= (unsigned int)pAC->I2c.MaxSens) {
-
- SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-- ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_SEN_ERR_UPP parameter wrong, SensorIndex=%d\n",
-+ ("PNMI: ERR: SK_PNMI_EVT_SEN_ERR_UPP parameter wrong, SensorIndex=%d\n",
- (unsigned int)Param.Para64));
- return (0);
- }
-@@ -1208,16 +1184,14 @@ SK_EVPARA Param) /* Event dependent para
- case SK_PNMI_EVT_CHG_EST_TIMER:
- /*
- * Calculate port switch average on a per hour basis
-- * Time interval for check : 28125 ms
-+ * Time interval for check : 28125 ms (SK_PNMI_EVT_TIMER_CHECK)
- * Number of values for average : 8
- *
- * Be careful in changing these values, on change check
- * - typedef of SK_PNMI_ESTIMATE (Size of EstValue
- * array one less than value number)
- * - Timer initialization SkTimerStart() in SkPnmiInit
-- * - Delta value below must be multiplicated with
-- * power of 2
-- *
-+ * - Delta value below must be multiplicated with power of 2
- */
- pEst = &pAC->Pnmi.RlmtChangeEstimate;
- CounterIndex = pEst->EstValueIndex + 1;
-@@ -1240,7 +1214,7 @@ SK_EVPARA Param) /* Event dependent para
- Delta = NewestValue - OldestValue;
- }
- else {
-- /* Overflow situation */
-+ /* Overflow situation. */
- Delta = (SK_U64)(0 - OldestValue) + NewestValue;
- }
-
-@@ -1266,8 +1240,9 @@ SK_EVPARA Param) /* Event dependent para
- }
-
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-+
- SkTimerStart(pAC, IoC, &pAC->Pnmi.RlmtChangeEstimate.EstTimer,
-- 28125000, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER,
-+ SK_PNMI_EVT_TIMER_CHECK, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER,
- EventParam);
- break;
-
-@@ -1311,29 +1286,25 @@ SK_EVPARA Param) /* Event dependent para
- (unsigned int)Param.Para64));
- return (0);
- }
--#endif
-+#endif /* DEBUG */
-+
- PhysPortIndex = (unsigned int)Param.Para64;
-
-- /*
-- * Update XMAC statistic to get fresh values
-- */
-- Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1);
-- if (Ret != SK_PNMI_ERR_OK) {
-+ /* Update XMAC statistic to get fresh values. */
-+ if (MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1) !=
-+ SK_PNMI_ERR_OK) {
-
- SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return");
- return (0);
- }
-- /*
-- * Increment semaphore to indicate that an update was
-- * already done
-- */
-+
-+ /* Increment semaphore to indicate that an update was already done. */
- pAC->Pnmi.MacUpdatedFlag ++;
-
- for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX;
- CounterIndex ++) {
-
- if (!StatAddr[CounterIndex][MacType].GetOffset) {
--
- continue;
- }
-
-@@ -1366,14 +1337,15 @@ SK_EVPARA Param) /* Event dependent para
- QueueRlmtPortTrap(pAC, OID_SKGE_TRAP_RLMT_PORT_UP, PhysPortIndex);
- (void)SK_DRIVER_SENDEVENT(pAC, IoC);
-
-- /* Bugfix for XMAC errata (#10620)*/
-+ /* Bugfix for XMAC errata (#10620). */
- if (MacType == SK_MAC_XMAC) {
-- /* Add incremental difference to offset (#10620)*/
-+ /* Add incremental difference to offset (#10620). */
- (void)pAC->GIni.GIFunc.pFnMacStatistic(pAC, IoC, PhysPortIndex,
- XM_RXE_SHT_ERR, &Val32);
-
- Value = (((SK_U64)pAC->Pnmi.Port[PhysPortIndex].
- CounterHigh[SK_PNMI_HRX_SHORTS] << 32) | (SK_U64)Val32);
-+
- pAC->Pnmi.Port[PhysPortIndex].CounterOffset[SK_PNMI_HRX_SHORTS] +=
- Value - pAC->Pnmi.Port[PhysPortIndex].RxShortZeroMark;
- }
-@@ -1403,7 +1375,7 @@ SK_EVPARA Param) /* Event dependent para
- QueueRlmtPortTrap(pAC, OID_SKGE_TRAP_RLMT_PORT_DOWN, PhysPortIndex);
- (void)SK_DRIVER_SENDEVENT(pAC, IoC);
-
-- /* Bugfix #10620 - get zero level for incremental difference */
-+ /* Bugfix #10620 - get zero level for incremental difference. */
- if (MacType == SK_MAC_XMAC) {
-
- (void)pAC->GIni.GIFunc.pFnMacStatistic(pAC, IoC, PhysPortIndex,
-@@ -1435,17 +1407,13 @@ SK_EVPARA Param) /* Event dependent para
- }
- #endif /* DEBUG */
-
-- /*
-- * For now, ignore event if NetIndex != 0.
-- */
-+ /* For now, ignore event if NetIndex != 0. */
- if (Param.Para32[1] != 0) {
-
- return (0);
- }
-
-- /*
-- * Nothing to do if port is already inactive
-- */
-+ /* Nothing to do if port is already inactive. */
- if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-
- return (0);
-@@ -1476,7 +1444,6 @@ SK_EVPARA Param) /* Event dependent para
- CounterIndex ++) {
-
- if (!StatAddr[CounterIndex][MacType].GetOffset) {
--
- continue;
- }
-
-@@ -1485,9 +1452,7 @@ SK_EVPARA Param) /* Event dependent para
- pAC->Pnmi.VirtualCounterOffset[CounterIndex] += Value;
- }
-
-- /*
-- * Set port to inactive
-- */
-+ /* Set port to inactive. */
- pAC->Pnmi.Port[PhysPortIndex].ActiveFlag = SK_FALSE;
-
- pAC->Pnmi.MacUpdatedFlag --;
-@@ -1513,25 +1478,19 @@ SK_EVPARA Param) /* Event dependent para
- }
- #endif /* DEBUG */
-
-- /*
-- * For now, ignore event if NetIndex != 0.
-- */
-+ /* For now, ignore event if NetIndex != 0. */
- if (Param.Para32[1] != 0) {
-
- return (0);
- }
-
-- /*
-- * Nothing to do if port is already active
-- */
-+ /* Nothing to do if port is already inactive. */
- if (pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-
- return (0);
- }
-
-- /*
-- * Statistic maintenance
-- */
-+ /* Statistic maintenance. */
- pAC->Pnmi.RlmtChangeCts ++;
- pAC->Pnmi.RlmtChangeTime = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC));
-
-@@ -1565,7 +1524,6 @@ SK_EVPARA Param) /* Event dependent para
- CounterIndex ++) {
-
- if (!StatAddr[CounterIndex][MacType].GetOffset) {
--
- continue;
- }
-
-@@ -1574,16 +1532,14 @@ SK_EVPARA Param) /* Event dependent para
- pAC->Pnmi.VirtualCounterOffset[CounterIndex] -= Value;
- }
-
-- /* Set port to active */
-+ /* Set port to active. */
- pAC->Pnmi.Port[PhysPortIndex].ActiveFlag = SK_TRUE;
-
- pAC->Pnmi.MacUpdatedFlag --;
- break;
-
- case SK_PNMI_EVT_RLMT_SEGMENTATION:
-- /*
-- * Para.Para32[0] contains the NetIndex.
-- */
-+ /* Para.Para32[0] contains the NetIndex. */
-
- /*
- * Store a trap message in the trap buffer and generate an event for
-@@ -1598,71 +1554,53 @@ SK_EVPARA Param) /* Event dependent para
- * Param.Para32[0] contains the number of Nets.
- * Param.Para32[1] is reserved, contains -1.
- */
-- /*
-- * Check number of nets
-- */
-+ /* Check number of nets. */
- MaxNetNumber = pAC->GIni.GIMacsFound;
-- if (((unsigned int)Param.Para32[0] < 1)
-- || ((unsigned int)Param.Para32[0] > MaxNetNumber)) {
-+
-+ if (((unsigned int)Param.Para32[0] < 1) ||
-+ ((unsigned int)Param.Para32[0] > MaxNetNumber)) {
-+
- return (SK_PNMI_ERR_UNKNOWN_NET);
- }
-
-- if ((unsigned int)Param.Para32[0] == 1) { /* single net mode */
-+ if ((unsigned int)Param.Para32[0] == 1) { /* SingleNet mode. */
- pAC->Pnmi.DualNetActiveFlag = SK_FALSE;
- }
-- else { /* dual net mode */
-+ else { /* DualNet mode. */
- pAC->Pnmi.DualNetActiveFlag = SK_TRUE;
- }
- break;
-
- case SK_PNMI_EVT_VCT_RESET:
- PhysPortIndex = Param.Para32[0];
-- pPrt = &pAC->GIni.GP[PhysPortIndex];
-- pVctBackupData = &pAC->Pnmi.VctBackup[PhysPortIndex];
-
- if (pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_PENDING) {
-+
- RetCode = SkGmCableDiagStatus(pAC, IoC, PhysPortIndex, SK_FALSE);
-+
- if (RetCode == 2) {
- /*
- * VCT test is still running.
- * Start VCT timer counter again.
- */
-- SK_MEMSET((char *) &Param, 0, sizeof(Param));
-+ SK_MEMSET((char *)&Param, 0, sizeof(Param));
-+
- Param.Para32[0] = PhysPortIndex;
- Param.Para32[1] = -1;
-- SkTimerStart(pAC, IoC,
-- &pAC->Pnmi.VctTimeout[PhysPortIndex].VctTimer,
-- 4000000, SKGE_PNMI, SK_PNMI_EVT_VCT_RESET, Param);
-+
-+ SkTimerStart(pAC, IoC, &pAC->Pnmi.VctTimeout[PhysPortIndex],
-+ SK_PNMI_VCT_TIMER_CHECK, SKGE_PNMI, SK_PNMI_EVT_VCT_RESET, Param);
-+
- break;
- }
-- pAC->Pnmi.VctStatus[PhysPortIndex] &= ~SK_PNMI_VCT_PENDING;
-- pAC->Pnmi.VctStatus[PhysPortIndex] |=
-- (SK_PNMI_VCT_NEW_VCT_DATA | SK_PNMI_VCT_TEST_DONE);
-
-- /* Copy results for later use to PNMI struct. */
-- for (i = 0; i < 4; i++) {
-- if (pPrt->PMdiPairSts[i] == SK_PNMI_VCT_NORMAL_CABLE) {
-- if ((pPrt->PMdiPairLen[i] > 35) &&
-- (pPrt->PMdiPairLen[i] < 0xff)) {
-- pPrt->PMdiPairSts[i] = SK_PNMI_VCT_IMPEDANCE_MISMATCH;
-- }
-- }
-- if ((pPrt->PMdiPairLen[i] > 35) &&
-- (pPrt->PMdiPairLen[i] != 0xff)) {
-- CableLength = 1000 *
-- (((175 * pPrt->PMdiPairLen[i]) / 210) - 28);
-- }
-- else {
-- CableLength = 0;
-- }
-- pVctBackupData->PMdiPairLen[i] = CableLength;
-- pVctBackupData->PMdiPairSts[i] = pPrt->PMdiPairSts[i];
-- }
-+ VctGetResults(pAC, IoC, PhysPortIndex);
-
-- Param.Para32[0] = PhysPortIndex;
-- Param.Para32[1] = -1;
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, Param);
-- SkEventDispatcher(pAC, IoC);
-+ EventParam.Para32[0] = PhysPortIndex;
-+ EventParam.Para32[1] = -1;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, EventParam);
-+
-+ /* SkEventDispatcher(pAC, IoC); */
- }
-
- break;
-@@ -1710,14 +1648,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- unsigned int TableIndex;
- int Ret;
-
--
- if ((TableIndex = LookupId(Id)) == (unsigned int)(-1)) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_OID);
- }
-
-- /* Check NetIndex */
-+ /* Check NetIndex. */
- if (NetIndex >= pAC->Rlmt.NumNets) {
- return (SK_PNMI_ERR_UNKNOWN_NET);
- }
-@@ -1767,22 +1704,20 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Instance;
- SK_U32 Id;
-
--
-- /* Check if the passed buffer has the right size */
-+ /* Check if the passed buffer has the right size. */
- if (*pLen < SK_PNMI_STRUCT_SIZE) {
-
-- /* Check if we can return the error within the buffer */
-+ /* Check if we can return the error within the buffer. */
- if (*pLen >= SK_PNMI_MIN_STRUCT_SIZE) {
-
-- SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT,
-- (SK_U32)(-1));
-+ SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT, (SK_U32)(-1));
- }
-
- *pLen = SK_PNMI_STRUCT_SIZE;
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /* Check NetIndex */
-+ /* Check NetIndex. */
- if (NetIndex >= pAC->Rlmt.NumNets) {
- return (SK_PNMI_ERR_UNKNOWN_NET);
- }
-@@ -1810,12 +1745,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- pAC->Pnmi.RlmtUpdatedFlag ++;
- pAC->Pnmi.SirqUpdatedFlag ++;
-
-- /* Preset/Set values */
-+ /* PRESET/SET values. */
- for (TableIndex = 0; TableIndex < ID_TABLE_SIZE; TableIndex ++) {
-
- if ((IdTable[TableIndex].Access != SK_PNMI_RW) &&
- (IdTable[TableIndex].Access != SK_PNMI_WO)) {
--
- continue;
- }
-
-@@ -1826,8 +1760,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- InstanceCnt ++) {
-
- DstOffset = IdTable[TableIndex].Offset +
-- (InstanceCnt - 1) *
-- IdTable[TableIndex].StructSize;
-+ (InstanceCnt - 1) * IdTable[TableIndex].StructSize;
-
- /*
- * Because VPD multiple instance variables are
-@@ -1837,9 +1770,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- */
- Instance = (SK_U32)InstanceCnt;
-
-- /*
-- * Evaluate needed buffer length
-- */
-+ /* Evaluate needed buffer length. */
- Len = 0;
- Ret = IdTable[TableIndex].Func(pAC, IoC,
- SK_PNMI_GET, IdTable[TableIndex].Id,
-@@ -1855,8 +1786,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- pAC->Pnmi.SirqUpdatedFlag --;
-
- SK_PNMI_CHECKFLAGS("PnmiStruct: On return");
-- SK_PNMI_SET_STAT(pBuf,
-- SK_PNMI_ERR_GENERAL, DstOffset);
-+ SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_GENERAL, DstOffset);
- *pLen = SK_PNMI_MIN_STRUCT_SIZE;
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -1878,7 +1808,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
-
-- /* Call the OID handler function */
-+ /* Call the OID handler function. */
- Ret = IdTable[TableIndex].Func(pAC, IoC, Action,
- IdTable[TableIndex].Id, pBuf + DstOffset,
- &Len, Instance, TableIndex, NetIndex);
-@@ -1889,8 +1819,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- pAC->Pnmi.SirqUpdatedFlag --;
-
- SK_PNMI_CHECKFLAGS("PnmiStruct: On return");
-- SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_BAD_VALUE,
-- DstOffset);
-+ SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_BAD_VALUE, DstOffset);
- *pLen = SK_PNMI_MIN_STRUCT_SIZE;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-@@ -1924,7 +1853,7 @@ SK_U32 Id) /* Object identifier to be s
-
- if (IdTable[i].Id == Id) {
-
-- return i;
-+ return (i);
- }
- }
-
-@@ -1965,16 +1894,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- {
- if (Id != OID_SKGE_ALL_DATA) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR003,
-- SK_PNMI_ERR003MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR003, SK_PNMI_ERR003MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
-
-- /*
-- * Check instance. We only handle single instance variables
-- */
-+ /* Check instance. We only handle single instance variables. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
-@@ -2033,10 +1959,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- int Ret;
- SK_U32 ActionOp;
-
--
-- /*
-- * Check instance. We only handle single instance variables
-- */
-+ /* Check instance. We only handle single instance variables. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
-@@ -2049,10 +1972,10 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /* Check if a get should be performed */
-+ /* Check if a GET should be performed. */
- if (Action == SK_PNMI_GET) {
-
-- /* A get is easy. We always return the same value */
-+ /* A GET is easy. We always return the same value. */
- ActionOp = (SK_U32)SK_PNMI_ACT_IDLE;
- SK_PNMI_STORE_U32(pBuf, ActionOp);
- *pLen = sizeof(SK_U32);
-@@ -2060,13 +1983,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Continue with PRESET/SET action */
-+ /* Continue with PRESET/SET action. */
- if (*pLen > sizeof(SK_U32)) {
-
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* Check if the command is a known one */
-+ /* Check if the command is a known one. */
- SK_PNMI_READ_U32(pBuf, ActionOp);
- if (*pLen > sizeof(SK_U32) ||
- (ActionOp != SK_PNMI_ACT_IDLE &&
-@@ -2078,7 +2001,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* A preset ends here */
-+ /* A PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
-@@ -2087,19 +2010,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- switch (ActionOp) {
-
- case SK_PNMI_ACT_IDLE:
-- /* Nothing to do */
-+ /* Nothing to do. */
- break;
-
- case SK_PNMI_ACT_RESET:
-- /*
-- * Perform a driver reset or something that comes near
-- * to this.
-- */
-+ /* Perform a driver reset or something that comes near to this. */
- Ret = SK_DRIVER_RESET(pAC, IoC);
- if (Ret != 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR005,
-- SK_PNMI_ERR005MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR005, SK_PNMI_ERR005MSG);
-
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -2116,13 +2035,12 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case SK_PNMI_ACT_RESETCNT:
-- /* Set all counters and timestamps to zero */
-+ /* Set all counters and timestamps to zero. */
- ResetCounter(pAC, IoC, NetIndex);
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR006,
-- SK_PNMI_ERR006MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR006, SK_PNMI_ERR006MSG);
-
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -2166,25 +2084,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 StatVal32;
- SK_BOOL Is64BitReq = SK_FALSE;
-
-- /*
-- * Only the active Mac is returned
-- */
-+ /* Only the active MAC is returned. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-
-- /*
-- * Check action type
-- */
-+ /* Check action type. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /* Check length */
-+ /* Check length. */
- switch (Id) {
-
- case OID_802_3_PERMANENT_ADDRESS:
-@@ -2205,12 +2119,12 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- #else /* SK_NDIS_64BIT_CTR */
-
-- /* for compatibility, at least 32bit are required for OID */
-+ /* For compatibility, at least 32 bits are required for OID. */
- if (*pLen < sizeof(SK_U32)) {
- /*
-- * but indicate handling for 64bit values,
-- * if insufficient space is provided
-- */
-+ * Indicate handling for 64 bit values,
-+ * if insufficient space is provided.
-+ */
- *pLen = sizeof(SK_U64);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-@@ -2226,16 +2140,14 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- * to indicate that an update was already done.
- */
- Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1);
-- if ( Ret != SK_PNMI_ERR_OK) {
-+ if (Ret != SK_PNMI_ERR_OK) {
-
- *pLen = 0;
- return (Ret);
- }
- pAC->Pnmi.MacUpdatedFlag ++;
-
-- /*
-- * Get value (MAC Index 0 identifies the virtual MAC)
-- */
-+ /* Get value (MAC index 0 identifies the virtual MAC). */
- switch (Id) {
-
- case OID_802_3_PERMANENT_ADDRESS:
-@@ -2251,7 +2163,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- default:
- StatVal = GetStatVal(pAC, IoC, 0, IdTable[TableIndex].Param, NetIndex);
-
-- /* by default 32bit values are evaluated */
-+ /* By default 32 bit values are evaluated. */
- if (!Is64BitReq) {
- StatVal32 = (SK_U32)StatVal;
- SK_PNMI_STORE_U32(pBuf, StatVal32);
-@@ -2305,21 +2217,19 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- int MacType;
- int Ret;
- SK_U64 StatVal;
--
--
-
-- /* Calculate instance if wished. MAC index 0 is the virtual MAC */
-+ /* Calculate instance if wished. MAC index 0 is the virtual MAC. */
- PhysPortMax = pAC->GIni.GIMacsFound;
- LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax);
-
- MacType = pAC->GIni.GIMacType;
-
-- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* Dual net mode */
-+ if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* DualNet mode. */
- LogPortMax--;
- }
-
-- if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried */
-- /* Check instance range */
-+ if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried. */
-+ /* Check instance range. */
- if ((Instance < 1) || (Instance > LogPortMax)) {
-
- *pLen = 0;
-@@ -2329,20 +2239,20 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Limit = LogPortIndex + 1;
- }
-
-- else { /* Instance == (SK_U32)(-1), get all Instances of that OID */
-+ else { /* Instance == (SK_U32)(-1), get all Instances of that OID. */
-
- LogPortIndex = 0;
- Limit = LogPortMax;
- }
-
-- /* Check action */
-+ /* Check action. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /* Check length */
-+ /* Check length. */
- if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U64)) {
-
- *pLen = (Limit - LogPortIndex) * sizeof(SK_U64);
-@@ -2361,7 +2271,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- pAC->Pnmi.MacUpdatedFlag ++;
-
-- /* Get value */
-+ /* Get value. */
- Offset = 0;
- for (; LogPortIndex < Limit; LogPortIndex ++) {
-
-@@ -2467,19 +2377,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- unsigned int Limit;
- unsigned int Offset = 0;
-
-- /*
-- * Calculate instance if wished. MAC index 0 is the virtual
-- * MAC.
-- */
-+ /* Calculate instance if wished. MAC index 0 is the virtual MAC. */
- PhysPortMax = pAC->GIni.GIMacsFound;
- LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax);
-
-- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* Dual net mode */
-+ if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* DualNet mode. */
- LogPortMax--;
- }
-
-- if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried */
-- /* Check instance range */
-+ if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried. */
-+ /* Check instance range. */
- if ((Instance < 1) || (Instance > LogPortMax)) {
-
- *pLen = 0;
-@@ -2488,27 +2395,23 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- LogPortIndex = SK_PNMI_PORT_INST2LOG(Instance);
- Limit = LogPortIndex + 1;
- }
-- else { /* Instance == (SK_U32)(-1), get all Instances of that OID */
-+ else { /* Instance == (SK_U32)(-1), get all Instances of that OID. */
-
- LogPortIndex = 0;
- Limit = LogPortMax;
- }
-
-- /*
-- * Perform Action
-- */
-+ /* Perform action. */
- if (Action == SK_PNMI_GET) {
-
-- /* Check length */
-+ /* Check length. */
- if (*pLen < (Limit - LogPortIndex) * 6) {
-
- *pLen = (Limit - LogPortIndex) * 6;
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- for (; LogPortIndex < Limit; LogPortIndex ++) {
-
- switch (Id) {
-@@ -2532,8 +2435,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- &pAC->Addr.Net[NetIndex].PermanentMacAddress);
- }
- else {
-- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-+ PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-
- CopyMac(pBuf + Offset,
- &pAC->Addr.Port[PhysPortIndex].PermanentMacAddress);
-@@ -2542,8 +2444,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR008,
-- SK_PNMI_ERR008MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR008, SK_PNMI_ERR008MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -2554,8 +2455,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- else {
- /*
-- * The logical MAC address may not be changed only
-- * the physical ones
-+ * The logical MAC address may not be changed,
-+ * only the physical ones.
- */
- if (Id == OID_SKGE_PHYS_FAC_ADDR) {
-
-@@ -2563,19 +2464,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /*
-- * Only the current address may be changed
-- */
-+ /* Only the current address may be changed. */
- if (Id != OID_SKGE_PHYS_CUR_ADDR) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR009,
-- SK_PNMI_ERR009MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR009, SK_PNMI_ERR009MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
-
-- /* Check length */
-+ /* Check length. */
- if (*pLen < (Limit - LogPortIndex) * 6) {
-
- *pLen = (Limit - LogPortIndex) * 6;
-@@ -2587,32 +2485,26 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /*
-- * Check Action
-- */
-+ /* Check action. */
- if (Action == SK_PNMI_PRESET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_OK);
- }
-
-- /*
-- * Set OID_SKGE_MAC_CUR_ADDR
-- */
-+ /* Set OID_SKGE_MAC_CUR_ADDR. */
- for (; LogPortIndex < Limit; LogPortIndex ++, Offset += 6) {
-
- /*
- * A set to virtual port and set of broadcast
-- * address will be ignored
-+ * address will be ignored.
- */
- if (LogPortIndex == 0 || SK_MEMCMP(pBuf + Offset,
- "\xff\xff\xff\xff\xff\xff", 6) == 0) {
--
- continue;
- }
-
-- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC,
-- LogPortIndex);
-+ PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-
- Ret = SkAddrOverride(pAC, IoC, PhysPortIndex,
- (SK_MAC_ADDR *)(pBuf + Offset),
-@@ -2665,10 +2557,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- unsigned int Offset = 0;
- SK_U64 StatVal;
-
--
-- /*
-- * Calculate instance if wished
-- */
-+ /* Calculate instance if wished. */
- if (Instance != (SK_U32)(-1)) {
-
- if ((Instance < 1) || (Instance > SKCS_NUM_PROTOCOLS)) {
-@@ -2684,25 +2573,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Limit = SKCS_NUM_PROTOCOLS;
- }
-
-- /*
-- * Check action
-- */
-+ /* Check action. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /* Check length */
-+ /* Check length. */
- if (*pLen < (Limit - Index) * sizeof(SK_U64)) {
-
- *pLen = (Limit - Index) * sizeof(SK_U64);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- for (; Index < Limit; Index ++) {
-
- switch (Id) {
-@@ -2728,8 +2613,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR010,
-- SK_PNMI_ERR010MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR010, SK_PNMI_ERR010MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -2739,9 +2623,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Offset += sizeof(SK_U64);
- }
-
-- /*
-- * Store used buffer space
-- */
-+ /* Store used buffer space. */
- *pLen = Offset;
-
- return (SK_PNMI_ERR_OK);
-@@ -2784,10 +2666,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Val32;
- SK_U64 Val64;
-
--
-- /*
-- * Calculate instance if wished
-- */
-+ /* Calculate instance if wished. */
- if ((Instance != (SK_U32)(-1))) {
-
- if ((Instance < 1) || (Instance > (SK_U32)pAC->I2c.MaxSens)) {
-@@ -2804,16 +2683,14 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Limit = (unsigned int) pAC->I2c.MaxSens;
- }
-
-- /*
-- * Check action
-- */
-+ /* Check action. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /* Check length */
-+ /* Check length. */
- switch (Id) {
-
- case OID_SKGE_SENSOR_VALUE:
-@@ -2872,38 +2749,33 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR012,
-- SK_PNMI_ERR012MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR012, SK_PNMI_ERR012MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-
- }
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- for (Offset = 0; Index < Limit; Index ++) {
-
- switch (Id) {
-
- case OID_SKGE_SENSOR_INDEX:
- *(pBuf + Offset) = (char)Index;
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_SENSOR_DESCR:
- Len = SK_STRLEN(pAC->I2c.SenTable[Index].SenDesc);
-- SK_MEMCPY(pBuf + Offset + 1,
-- pAC->I2c.SenTable[Index].SenDesc, Len);
-+ SK_MEMCPY(pBuf + Offset + 1, pAC->I2c.SenTable[Index].SenDesc, Len);
- *(pBuf + Offset) = (char)Len;
- Offset += Len + 1;
- break;
-
- case OID_SKGE_SENSOR_TYPE:
-- *(pBuf + Offset) =
-- (char)pAC->I2c.SenTable[Index].SenType;
-- Offset += sizeof(char);
-+ *(pBuf + Offset) = (char)pAC->I2c.SenTable[Index].SenType;
-+ Offset ++;
- break;
-
- case OID_SKGE_SENSOR_VALUE:
-@@ -2940,9 +2812,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_SENSOR_STATUS:
-- *(pBuf + Offset) =
-- (char)pAC->I2c.SenTable[Index].SenErrFlag;
-- Offset += sizeof(char);
-+ *(pBuf + Offset) = (char)pAC->I2c.SenTable[Index].SenErrFlag;
-+ Offset ++;
- break;
-
- case OID_SKGE_SENSOR_WAR_CTS:
-@@ -2979,9 +2850,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
-
-- /*
-- * Store used buffer space
-- */
-+ /* Store used buffer space. */
- *pLen = Offset;
-
- return (SK_PNMI_ERR_OK);
-@@ -3036,8 +2905,29 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Val32;
-
- /*
-- * Get array of all currently stored VPD keys
-- */
-+ * VpdKeyReadError will be set in GetVpdKeyArr() if an error occurs.
-+ * Due to the fact that some drivers use SkPnmiGetStruct() to retrieve
-+ * all statistical data, an error in GetVpdKeyArr() will generate a PNMI
-+ * error and terminate SkPnmiGetStruct() without filling in statistical
-+ * data into the PNMI struct. In this case the driver will get no values
-+ * for statistical purposes (netstat, ifconfig etc.). GetVpdKeyArr() is
-+ * the first function to be called in SkPnmiGetStruct(), so any error
-+ * will terminate SkPnmiGetStruct() immediately. Hence, VpdKeyReadError will
-+ * be set during the first call to GetVpdKeyArr() to make successful calls
-+ * to SkPnmiGetStruct() possible. But there is another point to consider:
-+ * When filling in the statistical data into the PNMI struct, the VPD
-+ * handler Vpd() will also be called. If GetVpdKeyArr() in Vpd() would
-+ * return with SK_PNMI_ERR_GENERAL, SkPnmiGetStruct() would fail again.
-+ * For this reason VpdKeyReadError is checked here and, if set, Vpd()
-+ * will return without doing anything and the return value SK_PNMI_ERR_OK.
-+ * Therefore SkPnmiGetStruct() is able to continue and fill in all other
-+ * statistical data.
-+ */
-+ if (pAC->Pnmi.VpdKeyReadError == SK_TRUE) {
-+ return (SK_PNMI_ERR_OK);
-+ }
-+
-+ /* Get array of all currently stored VPD keys. */
- Ret = GetVpdKeyArr(pAC, IoC, &KeyArr[0][0], sizeof(KeyArr), &KeyNo);
- if (Ret != SK_PNMI_ERR_OK) {
- *pLen = 0;
-@@ -3082,34 +2972,32 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
-
-- /*
-- * Get value, if a query should be performed
-- */
-+ /* Get value, if a query should be performed. */
- if (Action == SK_PNMI_GET) {
-
- switch (Id) {
-
- case OID_SKGE_VPD_FREE_BYTES:
-- /* Check length of buffer */
-+ /* Check length of buffer. */
- if (*pLen < sizeof(SK_U32)) {
-
- *pLen = sizeof(SK_U32);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- /* Get number of free bytes */
-+ /* Get number of free bytes. */
- pVpdStatus = VpdStat(pAC, IoC);
- if (pVpdStatus == NULL) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR017,
-- SK_PNMI_ERR017MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR017MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
- if ((pVpdStatus->vpd_status & VPD_VALID) == 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR018,
-- SK_PNMI_ERR018MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR018MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3121,7 +3009,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_VPD_ENTRIES_LIST:
-- /* Check length */
-+ /* Check length. */
- for (Len = 0, Index = 0; Index < KeyNo; Index ++) {
-
- Len += SK_STRLEN(KeyArr[Index]) + 1;
-@@ -3132,7 +3020,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /* Get value */
-+ /* Get value. */
- *(pBuf) = (char)Len - 1;
- for (Offset = 1, Index = 0; Index < KeyNo; Index ++) {
-
-@@ -3151,7 +3039,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_VPD_ENTRIES_NUMBER:
-- /* Check length */
-+ /* Check length. */
- if (*pLen < sizeof(SK_U32)) {
-
- *pLen = sizeof(SK_U32);
-@@ -3164,7 +3052,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_VPD_KEY:
-- /* Check buffer length, if it is large enough */
-+ /* Check buffer length, if it is large enough. */
- for (Len = 0, Index = FirstIndex;
- Index < LastIndex; Index ++) {
-
-@@ -3180,32 +3068,28 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- * Get the key to an intermediate buffer, because
- * we have to prepend a length byte.
- */
-- for (Offset = 0, Index = FirstIndex;
-- Index < LastIndex; Index ++) {
-+ for (Offset = 0, Index = FirstIndex; Index < LastIndex; Index ++) {
-
- Len = SK_STRLEN(KeyArr[Index]);
-
- *(pBuf + Offset) = (char)Len;
-- SK_MEMCPY(pBuf + Offset + 1, KeyArr[Index],
-- Len);
-+ SK_MEMCPY(pBuf + Offset + 1, KeyArr[Index], Len);
- Offset += Len + 1;
- }
- *pLen = Offset;
- break;
-
- case OID_SKGE_VPD_VALUE:
-- /* Check the buffer length if it is large enough */
-- for (Offset = 0, Index = FirstIndex;
-- Index < LastIndex; Index ++) {
-+ /* Check the buffer length if it is large enough. */
-+ for (Offset = 0, Index = FirstIndex; Index < LastIndex; Index ++) {
-
- BufLen = 256;
- if (VpdRead(pAC, IoC, KeyArr[Index], Buf,
- (int *)&BufLen) > 0 ||
- BufLen >= SK_PNMI_VPD_DATALEN) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW,
-- SK_PNMI_ERR021,
-- SK_PNMI_ERR021MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR021MSG));
-
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -3221,17 +3105,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- * Get the value to an intermediate buffer, because
- * we have to prepend a length byte.
- */
-- for (Offset = 0, Index = FirstIndex;
-- Index < LastIndex; Index ++) {
-+ for (Offset = 0, Index = FirstIndex; Index < LastIndex; Index ++) {
-
- BufLen = 256;
- if (VpdRead(pAC, IoC, KeyArr[Index], Buf,
- (int *)&BufLen) > 0 ||
- BufLen >= SK_PNMI_VPD_DATALEN) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW,
-- SK_PNMI_ERR022,
-- SK_PNMI_ERR022MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR022MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3251,8 +3133,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- for (Offset = 0, Index = FirstIndex;
-- Index < LastIndex; Index ++) {
-+ for (Offset = 0, Index = FirstIndex; Index < LastIndex; Index ++) {
-
- if (VpdMayWrite(KeyArr[Index])) {
-
-@@ -3278,15 +3159,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR023,
-- SK_PNMI_ERR023MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR023MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
- }
- else {
-- /* The only OID which can be set is VPD_ACTION */
-+ /* The only OID which can be set is VPD_ACTION. */
- if (Id != OID_SKGE_VPD_ACTION) {
-
- if (Id == OID_SKGE_VPD_FREE_BYTES ||
-@@ -3300,8 +3181,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR024,
-- SK_PNMI_ERR024MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR024MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3317,14 +3198,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-
-- /*
-- * The first byte contains the VPD action type we should
-- * perform.
-- */
-+ /* The first byte contains the VPD action type we should perform. */
- switch (*pBuf) {
-
- case SK_PNMI_VPD_IGNORE:
-- /* Nothing to do */
-+ /* Nothing to do. */
- break;
-
- case SK_PNMI_VPD_CREATE:
-@@ -3356,13 +3234,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_MEMCPY(Buf, pBuf + 4, Offset);
- Buf[Offset] = 0;
-
-- /* A preset ends here */
-+ /* A PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Write the new entry or modify an existing one */
-+ /* Write the new entry or modify an existing one .*/
- Ret = VpdWrite(pAC, IoC, KeyStr, Buf);
- if (Ret == SK_PNMI_VPD_NOWRITE ) {
-
-@@ -3371,8 +3249,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- else if (Ret != SK_PNMI_VPD_OK) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR025,
-- SK_PNMI_ERR025MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR025MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3385,8 +3263,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Ret = VpdUpdate(pAC, IoC);
- if (Ret != SK_PNMI_VPD_OK) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR026,
-- SK_PNMI_ERR026MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR026MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3394,7 +3272,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case SK_PNMI_VPD_DELETE:
-- /* Check if the buffer size is plausible */
-+ /* Check if the buffer size is plausible. */
- if (*pLen < 3) {
-
- *pLen = 3;
-@@ -3409,7 +3287,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- KeyStr[1] = pBuf[2];
- KeyStr[2] = 0;
-
-- /* Find the passed key in the array */
-+ /* Find the passed key in the array. */
- for (Index = 0; Index < KeyNo; Index ++) {
-
- if (SK_STRCMP(KeyStr, KeyArr[Index]) == 0) {
-@@ -3417,6 +3295,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
- }
- }
-+
- /*
- * If we cannot find the key it is wrong, so we
- * return an appropriate error value.
-@@ -3432,12 +3311,12 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Ok, you wanted it and you will get it */
-+ /* Ok, you wanted it and you will get it. */
- Ret = VpdDelete(pAC, IoC, KeyStr);
- if (Ret != SK_PNMI_VPD_OK) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR027,
-- SK_PNMI_ERR027MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR027MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3450,8 +3329,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Ret = VpdUpdate(pAC, IoC);
- if (Ret != SK_PNMI_VPD_OK) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR028,
-- SK_PNMI_ERR028MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR028MSG));
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3505,23 +3384,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Val32;
- SK_U64 Val64;
- SK_U64 Val64RxHwErrs = 0;
-+ SK_U64 Val64RxRunt = 0;
-+ SK_U64 Val64RxFcs = 0;
- SK_U64 Val64TxHwErrs = 0;
- SK_BOOL Is64BitReq = SK_FALSE;
- char Buf[256];
- int MacType;
-
-- /*
-- * Check instance. We only handle single instance variables.
-- */
-+ /* Check instance. We only handle single instance variables. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-
-- /*
-- * Check action. We only allow get requests.
-- */
-+ /* Check action. We only allow get requests. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
-@@ -3530,9 +3407,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- MacType = pAC->GIni.GIMacType;
-
-- /*
-- * Check length for the various supported OIDs
-- */
-+ /* Check length for the various supported OIDs. */
- switch (Id) {
-
- case OID_GEN_XMIT_ERROR:
-@@ -3546,14 +3421,12 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- #else /* SK_NDIS_64BIT_CTR */
-
-- /*
-- * for compatibility, at least 32bit are required for oid
-- */
-+ /* For compatibility, at least 32bit are required for OID. */
- if (*pLen < sizeof(SK_U32)) {
- /*
-- * but indicate handling for 64bit values,
-- * if insufficient space is provided
-- */
-+ * Indicate handling for 64bit values,
-+ * if insufficient space is provided.
-+ */
- *pLen = sizeof(SK_U64);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-@@ -3624,11 +3497,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- /* Checked later */
-+ /* Checked later. */
- break;
- }
-
-- /* Update statistic */
-+ /* Update statistics. */
- if (Id == OID_SKGE_RX_HW_ERROR_CTS ||
- Id == OID_SKGE_TX_HW_ERROR_CTS ||
- Id == OID_SKGE_IN_ERRORS_CTS ||
-@@ -3636,7 +3509,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Id == OID_GEN_XMIT_ERROR ||
- Id == OID_GEN_RCV_ERROR) {
-
-- /* Force the XMAC to update its statistic counters and
-+ /*
-+ * Force the XMAC to update its statistic counters and
- * Increment semaphore to indicate that an update was
- * already done.
- */
-@@ -3667,27 +3541,40 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_IRLENGTH, NetIndex) +
- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SYMBOL, NetIndex) +
- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SHORTS, NetIndex) +
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT, NetIndex) +
- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG, NetIndex) +
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS, NetIndex) +
- GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CEXT, NetIndex);
-- break;
-
-- case OID_SKGE_TX_HW_ERROR_CTS:
-- case OID_SKGE_OUT_ERROR_CTS:
-- case OID_GEN_XMIT_ERROR:
-- Val64TxHwErrs =
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_EXCESS_COL, NetIndex) +
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_LATE_COL, NetIndex) +
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_UNDERRUN, NetIndex) +
-- GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_CARRIER, NetIndex);
-+
-+ /*
-+ * In some cases the runt and fcs counters are incremented when collisions
-+ * occur. We have to correct those counters here.
-+ */
-+ Val64RxRunt = GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT, NetIndex);
-+ Val64RxFcs = GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS, NetIndex);
-+
-+ if (Val64RxRunt > Val64RxFcs) {
-+ Val64RxRunt -= Val64RxFcs;
-+ Val64RxHwErrs += Val64RxRunt;
-+ }
-+ else {
-+ Val64RxFcs -= Val64RxRunt;
-+ Val64RxHwErrs += Val64RxFcs;
-+ }
-+ break;
-+
-+ case OID_SKGE_TX_HW_ERROR_CTS:
-+ case OID_SKGE_OUT_ERROR_CTS:
-+ case OID_GEN_XMIT_ERROR:
-+ Val64TxHwErrs =
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_EXCESS_COL, NetIndex) +
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_LATE_COL, NetIndex) +
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_UNDERRUN, NetIndex) +
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_CARRIER, NetIndex);
- break;
- }
- }
-
-- /*
-- * Retrieve value
-- */
-+ /* Retrieve value. */
- switch (Id) {
-
- case OID_SKGE_SUPPORTED_LIST:
-@@ -3697,11 +3584,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- *pLen = Len;
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- for (Offset = 0, Index = 0; Offset < Len;
-- Offset += sizeof(SK_U32), Index ++) {
-+ for (Offset = 0, Index = 0; Offset < Len; Index ++) {
-
- Val32 = (SK_U32)IdTable[Index].Id;
- SK_PNMI_STORE_U32(pBuf + Offset, Val32);
-+ Offset += sizeof(SK_U32);
- }
- *pLen = Len;
- break;
-@@ -3727,8 +3614,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- case OID_SKGE_DRIVER_DESCR:
- if (pAC->Pnmi.pDriverDescription == NULL) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR007,
-- SK_PNMI_ERR007MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR007, SK_PNMI_ERR007MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3737,8 +3623,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Len = SK_STRLEN(pAC->Pnmi.pDriverDescription) + 1;
- if (Len > SK_PNMI_STRINGLEN1) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR029,
-- SK_PNMI_ERR029MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR029, SK_PNMI_ERR029MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3757,8 +3642,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- case OID_SKGE_DRIVER_VERSION:
- if (pAC->Pnmi.pDriverVersion == NULL) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
-- SK_PNMI_ERR030MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030, SK_PNMI_ERR030MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3767,8 +3651,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Len = SK_STRLEN(pAC->Pnmi.pDriverVersion) + 1;
- if (Len > SK_PNMI_STRINGLEN1) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
-- SK_PNMI_ERR031MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031, SK_PNMI_ERR031MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3787,8 +3670,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- case OID_SKGE_DRIVER_RELDATE:
- if (pAC->Pnmi.pDriverReleaseDate == NULL) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
-- SK_PNMI_ERR053MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR053, SK_PNMI_ERR053MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3797,8 +3679,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Len = SK_STRLEN(pAC->Pnmi.pDriverReleaseDate) + 1;
- if (Len > SK_PNMI_STRINGLEN1) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
-- SK_PNMI_ERR054MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR054, SK_PNMI_ERR054MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3817,8 +3698,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- case OID_SKGE_DRIVER_FILENAME:
- if (pAC->Pnmi.pDriverFileName == NULL) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
-- SK_PNMI_ERR055MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR055, SK_PNMI_ERR055MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3827,8 +3707,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Len = SK_STRLEN(pAC->Pnmi.pDriverFileName) + 1;
- if (Len > SK_PNMI_STRINGLEN1) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
-- SK_PNMI_ERR056MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR056, SK_PNMI_ERR056MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3850,12 +3729,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- * query may move to the initialisation routine. But
- * the VPD data is cached and therefore a call here
- * will not make much difference.
-+ * Please read comment in Vpd().
- */
-+ if (pAC->Pnmi.VpdKeyReadError == SK_TRUE) {
-+ return (SK_PNMI_ERR_OK);
-+ }
-+
- Len = 256;
- if (VpdRead(pAC, IoC, VPD_NAME, Buf, (int *)&Len) > 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR032,
-- SK_PNMI_ERR032MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR032, SK_PNMI_ERR032MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3863,8 +3746,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Len ++;
- if (Len > SK_PNMI_STRINGLEN1) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR033,
-- SK_PNMI_ERR033MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR033, SK_PNMI_ERR033MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -3880,7 +3762,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_HW_VERSION:
-- /* Oh, I love to do some string manipulation */
- if (*pLen < 5) {
-
- *pLen = 5;
-@@ -3889,9 +3770,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Val8 = (SK_U8)pAC->GIni.GIPciHwRev;
- pBuf[0] = 4;
- pBuf[1] = 'v';
-- pBuf[2] = (char)(0x30 | ((Val8 >> 4) & 0x0F));
-+ pBuf[2] = (char)('0' | ((Val8 >> 4) & 0x0f));
- pBuf[3] = '.';
-- pBuf[4] = (char)(0x30 | (Val8 & 0x0F));
-+ pBuf[4] = (char)('0' | (Val8 & 0x0f));
- *pLen = 5;
- break;
-
-@@ -3914,12 +3795,12 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_VAUXAVAIL:
-- *pBuf = (char) pAC->GIni.GIVauxAvail;
-+ *pBuf = (char)pAC->GIni.GIVauxAvail;
- *pLen = sizeof(char);
- break;
-
- case OID_SKGE_BUS_TYPE:
-- *pBuf = (char) SK_PNMI_BUS_PCI;
-+ *pBuf = (char)SK_PNMI_BUS_PCI;
- *pLen = sizeof(char);
- break;
-
-@@ -3968,31 +3849,31 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RLMT_MONITOR_NUMBER:
--/* XXX Not yet implemented by RLMT therefore we return zero elements */
-+ /* Not yet implemented by RLMT, therefore we return zero elements. */
- Val32 = 0;
- SK_PNMI_STORE_U32(pBuf, Val32);
- *pLen = sizeof(SK_U32);
- break;
-
- case OID_SKGE_TX_SW_QUEUE_LEN:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxSwQueueLen;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxSwQueueLen +
- pAC->Pnmi.BufPort[1].TxSwQueueLen;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxSwQueueLen;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxSwQueueLen +
- pAC->Pnmi.Port[1].TxSwQueueLen;
-@@ -4004,24 +3885,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
-
- case OID_SKGE_TX_SW_QUEUE_MAX:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxSwQueueMax;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxSwQueueMax +
- pAC->Pnmi.BufPort[1].TxSwQueueMax;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxSwQueueMax;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxSwQueueMax +
- pAC->Pnmi.Port[1].TxSwQueueMax;
-@@ -4032,24 +3913,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_TX_RETRY:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxRetryCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxRetryCts +
- pAC->Pnmi.BufPort[1].TxRetryCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxRetryCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxRetryCts +
- pAC->Pnmi.Port[1].TxRetryCts;
-@@ -4060,24 +3941,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RX_INTR_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].RxIntrCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].RxIntrCts +
- pAC->Pnmi.BufPort[1].RxIntrCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].RxIntrCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].RxIntrCts +
- pAC->Pnmi.Port[1].RxIntrCts;
-@@ -4088,24 +3969,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_TX_INTR_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxIntrCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxIntrCts +
- pAC->Pnmi.BufPort[1].TxIntrCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxIntrCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxIntrCts +
- pAC->Pnmi.Port[1].TxIntrCts;
-@@ -4116,24 +3997,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RX_NO_BUF_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].RxNoBufCts +
- pAC->Pnmi.BufPort[1].RxNoBufCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].RxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].RxNoBufCts +
- pAC->Pnmi.Port[1].RxNoBufCts;
-@@ -4144,24 +4025,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_TX_NO_BUF_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxNoBufCts +
- pAC->Pnmi.BufPort[1].TxNoBufCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxNoBufCts +
- pAC->Pnmi.Port[1].TxNoBufCts;
-@@ -4172,24 +4053,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_TX_USED_DESCR_NO:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].TxUsedDescrNo;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].TxUsedDescrNo +
- pAC->Pnmi.BufPort[1].TxUsedDescrNo;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].TxUsedDescrNo;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].TxUsedDescrNo +
- pAC->Pnmi.Port[1].TxUsedDescrNo;
-@@ -4200,24 +4081,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RX_DELIVERED_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].RxDeliveredCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].RxDeliveredCts +
- pAC->Pnmi.BufPort[1].RxDeliveredCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].RxDeliveredCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].RxDeliveredCts +
- pAC->Pnmi.Port[1].RxDeliveredCts;
-@@ -4228,24 +4109,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RX_OCTETS_DELIV_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].RxOctetsDeliveredCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].RxOctetsDeliveredCts +
- pAC->Pnmi.BufPort[1].RxOctetsDeliveredCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].RxOctetsDeliveredCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].RxOctetsDeliveredCts +
- pAC->Pnmi.Port[1].RxOctetsDeliveredCts;
-@@ -4266,13 +4147,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_IN_ERRORS_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = Val64RxHwErrs + pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = Val64RxHwErrs +
- pAC->Pnmi.BufPort[0].RxNoBufCts +
-@@ -4280,11 +4161,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = Val64RxHwErrs + pAC->Pnmi.Port[NetIndex].RxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = Val64RxHwErrs +
- pAC->Pnmi.Port[0].RxNoBufCts +
-@@ -4296,13 +4177,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_OUT_ERROR_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = Val64TxHwErrs + pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = Val64TxHwErrs +
- pAC->Pnmi.BufPort[0].TxNoBufCts +
-@@ -4310,11 +4191,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = Val64TxHwErrs + pAC->Pnmi.Port[NetIndex].TxNoBufCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = Val64TxHwErrs +
- pAC->Pnmi.Port[0].TxNoBufCts +
-@@ -4326,24 +4207,24 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_ERR_RECOVERY_CTS:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.BufPort[NetIndex].ErrRecoveryCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.BufPort[0].ErrRecoveryCts +
- pAC->Pnmi.BufPort[1].ErrRecoveryCts;
- }
- }
- else {
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- Val64 = pAC->Pnmi.Port[NetIndex].ErrRecoveryCts;
- }
-- /* Single net mode */
-+ /* SingleNet mode. */
- else {
- Val64 = pAC->Pnmi.Port[0].ErrRecoveryCts +
- pAC->Pnmi.Port[1].ErrRecoveryCts;
-@@ -4367,7 +4248,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_GEN_RCV_ERROR:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
- Val64 = Val64RxHwErrs + pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
- }
-@@ -4376,7 +4257,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
-
- /*
-- * by default 32bit values are evaluated
-+ * By default 32bit values are evaluated.
- */
- if (!Is64BitReq) {
- Val32 = (SK_U32)Val64;
-@@ -4390,7 +4271,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_GEN_XMIT_ERROR:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
- Val64 = Val64TxHwErrs + pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
- }
-@@ -4399,7 +4280,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
-
- /*
-- * by default 32bit values are evaluated
-+ * By default 32bit values are evaluated.
- */
- if (!Is64BitReq) {
- Val32 = (SK_U32)Val64;
-@@ -4413,16 +4294,19 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_GEN_RCV_NO_BUFFER:
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
-- Val64 = pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
-+ Val64 = pAC->Pnmi.BufPort[NetIndex].RxNoBufCts +
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_OVERFLOW, NetIndex);
-+
- }
- else {
-- Val64 = pAC->Pnmi.Port[NetIndex].RxNoBufCts;
-+ Val64 = pAC->Pnmi.Port[NetIndex].RxNoBufCts +
-+ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_OVERFLOW, NetIndex);
- }
-
- /*
-- * by default 32bit values are evaluated
-+ * By default 32bit values are evaluated.
- */
- if (!Is64BitReq) {
- Val32 = (SK_U32)Val64;
-@@ -4442,8 +4326,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR034,
-- SK_PNMI_ERR034MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR034, SK_PNMI_ERR034MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -4500,25 +4383,17 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Val32;
- SK_U64 Val64;
-
--
-- /*
-- * Check instance. Only single instance OIDs are allowed here.
-- */
-+ /* Check instance. Only single instance OIDs are allowed here. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-
-- /*
-- * Perform the requested action.
-- */
-+ /* Perform the requested action. */
- if (Action == SK_PNMI_GET) {
-
-- /*
-- * Check if the buffer length is large enough.
-- */
--
-+ /* Check if the buffer length is large enough. */
- switch (Id) {
-
- case OID_SKGE_RLMT_MODE:
-@@ -4551,8 +4426,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR035,
-- SK_PNMI_ERR035MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR035, SK_PNMI_ERR035MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -4571,9 +4445,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- pAC->Pnmi.RlmtUpdatedFlag ++;
-
-- /*
-- * Retrieve Value
-- */
-+ /* Retrieve value. */
- switch (Id) {
-
- case OID_SKGE_RLMT_MODE:
-@@ -4651,17 +4523,17 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- pAC->Pnmi.RlmtUpdatedFlag --;
- }
- else {
-- /* Perform a preset or set */
-+ /* Perform a PRESET or SET. */
- switch (Id) {
-
- case OID_SKGE_RLMT_MODE:
-- /* Check if the buffer length is plausible */
-+ /* Check if the buffer length is plausible. */
- if (*pLen < sizeof(char)) {
-
- *pLen = sizeof(char);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- /* Check if the value range is correct */
-+ /* Check if the value range is correct. */
- if (*pLen != sizeof(char) ||
- (*pBuf & SK_PNMI_RLMT_MODE_CHK_LINK) == 0 ||
- *(SK_U8 *)pBuf > 15) {
-@@ -4669,21 +4541,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_OK);
- }
-- /* Send an event to RLMT to change the mode */
-+ /* Send an event to RLMT to change the mode. */
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-+
- EventParam.Para32[0] |= (SK_U32)(*pBuf);
- EventParam.Para32[1] = 0;
- if (SkRlmtEvent(pAC, IoC, SK_RLMT_MODE_CHANGE,
- EventParam) > 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR037,
-- SK_PNMI_ERR037MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR037, SK_PNMI_ERR037MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -4691,20 +4563,25 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RLMT_PORT_PREFERRED:
-- /* Check if the buffer length is plausible */
-+ /* PRESET/SET action makes no sense in Dual Net mode. */
-+ if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
-+ break;
-+ }
-+
-+ /* Check if the buffer length is plausible. */
- if (*pLen < sizeof(char)) {
-
- *pLen = sizeof(char);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- /* Check if the value range is correct */
-+ /* Check if the value range is correct. */
- if (*pLen != sizeof(char) || *(SK_U8 *)pBuf >
- (SK_U8)pAC->GIni.GIMacsFound) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- *pLen = 0;
-@@ -4717,13 +4594,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- * make the decision which is the preferred port.
- */
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-+
- EventParam.Para32[0] = (SK_U32)(*pBuf) - 1;
- EventParam.Para32[1] = NetIndex;
- if (SkRlmtEvent(pAC, IoC, SK_RLMT_PREFPORT_CHANGE,
- EventParam) > 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR038,
-- SK_PNMI_ERR038MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR038, SK_PNMI_ERR038MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -4731,22 +4608,20 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_SKGE_RLMT_CHANGE_THRES:
-- /* Check if the buffer length is plausible */
-+ /* Check if the buffer length is plausible. */
- if (*pLen < sizeof(SK_U64)) {
-
- *pLen = sizeof(SK_U64);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- /*
-- * There are not many restrictions to the
-- * value range.
-- */
-+
-+ /* There are not many restrictions to the value range. */
- if (*pLen != sizeof(SK_U64)) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-- /* A preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- *pLen = 0;
-@@ -4761,7 +4636,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- /* The other OIDs are not be able for set */
-+ /* The other OIDs are not be able for set. */
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-@@ -4806,54 +4681,49 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 Val32;
- SK_U64 Val64;
-
-- /*
-- * Calculate the port indexes from the instance.
-- */
-+
-+ /* Calculate the port indexes from the instance. */
- PhysPortMax = pAC->GIni.GIMacsFound;
-
- if ((Instance != (SK_U32)(-1))) {
-- /* Check instance range */
-+ /* Check instance range. */
- if ((Instance < 1) || (Instance > PhysPortMax)) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-
-- /* Single net mode */
-+ /* SingleNet mode. */
- PhysPortIndex = Instance - 1;
-
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- PhysPortIndex = NetIndex;
- }
-
-- /* Both net modes */
-+ /* Both net modes. */
- Limit = PhysPortIndex + 1;
- }
- else {
-- /* Single net mode */
-+ /* SingleNet mode. */
- PhysPortIndex = 0;
- Limit = PhysPortMax;
-
-- /* Dual net mode */
-+ /* DualNet mode. */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- PhysPortIndex = NetIndex;
- Limit = PhysPortIndex + 1;
- }
- }
-
-- /*
-- * Currently only get requests are allowed.
-- */
-+ /* Currently only GET requests are allowed. */
- if (Action != SK_PNMI_GET) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /*
-- * Check if the buffer length is large enough.
-- */
-+ /* Check if the buffer length is large enough. */
- switch (Id) {
-
- case OID_SKGE_RLMT_PORT_INDEX:
-@@ -4877,8 +4747,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR039,
-- SK_PNMI_ERR039MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR039, SK_PNMI_ERR039MSG);
-
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -4896,9 +4765,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- pAC->Pnmi.RlmtUpdatedFlag ++;
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- Offset = 0;
- for (; PhysPortIndex < Limit; PhysPortIndex ++) {
-
-@@ -5011,19 +4878,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- int Ret;
- SK_EVPARA EventParam;
- SK_U32 Val32;
-+#ifdef SK_PHY_LP_MODE
-+ SK_U8 CurrentPhyPowerState;
-+#endif /* SK_PHY_LP_MODE */
-
-- /*
-- * Calculate instance if wished. MAC index 0 is the virtual MAC.
-- */
-+
-+ /* Calculate instance if wished. MAC index 0 is the virtual MAC. */
- PhysPortMax = pAC->GIni.GIMacsFound;
- LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax);
-
-- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* Dual net mode */
-+ if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* DualNet mode. */
- LogPortMax--;
- }
-
-- if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried */
-- /* Check instance range */
-+ if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried. */
-+ /* Check instance range. */
- if ((Instance < 1) || (Instance > LogPortMax)) {
-
- *pLen = 0;
-@@ -5033,18 +4902,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Limit = LogPortIndex + 1;
- }
-
-- else { /* Instance == (SK_U32)(-1), get all Instances of that OID */
-+ else { /* Instance == (SK_U32)(-1), get all Instances of that OID. */
-
- LogPortIndex = 0;
- Limit = LogPortMax;
- }
-
-- /*
-- * Perform action
-- */
-+ /* Perform action. */
- if (Action == SK_PNMI_GET) {
-
-- /* Check length */
-+ /* Check length. */
- switch (Id) {
-
- case OID_SKGE_PMD:
-@@ -5082,8 +4949,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR041,
-- SK_PNMI_ERR041MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR041, SK_PNMI_ERR041MSG);
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -5099,9 +4965,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- pAC->Pnmi.SirqUpdatedFlag ++;
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- Offset = 0;
- for (; LogPortIndex < Limit; LogPortIndex ++) {
-
-@@ -5111,107 +4975,99 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- case OID_SKGE_PMD:
- *pBufPtr = pAC->Pnmi.PMD;
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_CONNECTOR:
- *pBufPtr = pAC->Pnmi.Connector;
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_PHY_TYPE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
- continue;
- }
-- else {
-- /* Get value for physical ports */
-- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-- Val32 = pAC->GIni.GP[PhysPortIndex].PhyType;
-- SK_PNMI_STORE_U32(pBufPtr, Val32);
-- }
-+ /* Get value for physical port. */
-+ PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-+ Val32 = pAC->GIni.GP[PhysPortIndex].PhyType;
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- Val32 = pAC->GIni.GP[NetIndex].PhyType;
-- SK_PNMI_STORE_U32(pBufPtr, Val32);
- }
-+ SK_PNMI_STORE_U32(pBufPtr, Val32);
- Offset += sizeof(SK_U32);
- break;
-
- #ifdef SK_PHY_LP_MODE
- case OID_SKGE_PHY_LP_MODE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
- continue;
- }
-- else {
-- /* Get value for physical ports */
-- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-- Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
-- *pBufPtr = Val8;
-- }
-+ /* Get value for physical port. */
-+ PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-+ *pBufPtr = (SK_U8)pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
-- Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
-- *pBufPtr = Val8;
-+ *pBufPtr = (SK_U8)pAC->GIni.GP[NetIndex].PPhyPowerState;
- }
- Offset += sizeof(SK_U8);
- break;
- #endif
-
- case OID_SKGE_LINK_CAP:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkCap;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PLinkCap;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_LINK_MODE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkModeConf;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PLinkModeConf;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_LINK_MODE_STATUS:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
-@@ -5219,147 +5075,147 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- CalculateLinkModeStatus(pAC, IoC, PhysPortIndex);
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = CalculateLinkModeStatus(pAC, IoC, NetIndex);
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_LINK_STATUS:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = CalculateLinkStatus(pAC, IoC, PhysPortIndex);
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = CalculateLinkStatus(pAC, IoC, NetIndex);
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_FLOWCTRL_CAP:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlCap;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlCap;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_FLOWCTRL_MODE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlMode;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlMode;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_FLOWCTRL_STATUS:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlStatus;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlStatus;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_PHY_OPERATION_CAP:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet Mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PMSCap;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PMSCap;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_PHY_OPERATION_MODE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PMSMode;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PMSMode;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_PHY_OPERATION_STATUS:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
-@@ -5370,70 +5226,70 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PMSStatus;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_SPEED_CAP:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical ports */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeedCap;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeedCap;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_SPEED_MODE:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeed;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeed;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_SPEED_STATUS:
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
-- /* Get value for virtual port */
-+ /* Get value for virtual port. */
- VirtualConf(pAC, IoC, Id, pBufPtr);
- }
- else {
-- /* Get value for physical port */
-+ /* Get value for physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
- pAC, LogPortIndex);
-
- *pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeedUsed;
- }
- }
-- else { /* DualNetMode */
-+ else { /* DualNet mode. */
-
- *pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeedUsed;
- }
-- Offset += sizeof(char);
-+ Offset ++;
- break;
-
- case OID_SKGE_MTU:
-@@ -5486,40 +5342,33 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
- break;
--#endif
-+#endif /* SK_PHY_LP_MODE */
-
- case OID_SKGE_MTU:
-- if (*pLen < sizeof(SK_U32)) {
-+ if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U32)) {
-
-- *pLen = sizeof(SK_U32);
-+ *pLen = (Limit - LogPortIndex) * sizeof(SK_U32);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- if (*pLen != sizeof(SK_U32)) {
--
-- *pLen = 0;
-- return (SK_PNMI_ERR_BAD_VALUE);
-- }
- break;
--
-+
- default:
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /*
-- * Perform preset or set
-- */
-+ /* Perform PRESET or SET. */
- Offset = 0;
- for (; LogPortIndex < Limit; LogPortIndex ++) {
-
-+ Val8 = *(pBuf + Offset);
-+
- switch (Id) {
-
- case OID_SKGE_LINK_MODE:
-- /* Check the value range */
-- Val8 = *(pBuf + Offset);
-+ /* Check the value range. */
- if (Val8 == 0) {
--
-- Offset += sizeof(char);
-+ Offset++;
- break;
- }
- if (Val8 < SK_LMODE_HALF ||
-@@ -5530,51 +5379,68 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- if (LogPortIndex == 0) {
--
-- /*
-- * The virtual port consists of all currently
-- * active ports. Find them and send an event
-- * with the new link mode to SIRQ.
-- */
-- for (PhysPortIndex = 0;
-- PhysPortIndex < PhysPortMax;
-- PhysPortIndex ++) {
--
-- if (!pAC->Pnmi.Port[PhysPortIndex].
-- ActiveFlag) {
--
-- continue;
-- }
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
-+ if (LogPortIndex == 0) {
-+ /*
-+ * The virtual port consists of all currently
-+ * active ports. Find them and send an event
-+ * with the new link mode to SIRQ.
-+ */
-+ for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
-+ PhysPortIndex ++) {
-
-- EventParam.Para32[0] = PhysPortIndex;
-+ if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-+ continue;
-+ }
-+
-+ EventParam.Para32[0] = PhysPortIndex;
-+ EventParam.Para32[1] = (SK_U32)Val8;
-+ if (SkGeSirqEvent(pAC, IoC,
-+ SK_HWEV_SET_LMODE,
-+ EventParam) > 0) {
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW,
-+ SK_PNMI_ERR043,
-+ SK_PNMI_ERR043MSG);
-+
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
-+ } /* for */
-+ }
-+ else {
-+ /*
-+ * Send an event with the new link mode to
-+ * the SIRQ module.
-+ */
-+ EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-+ pAC, LogPortIndex);
- EventParam.Para32[1] = (SK_U32)Val8;
-- if (SkGeSirqEvent(pAC, IoC,
-- SK_HWEV_SET_LMODE,
-+ if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_LMODE,
- EventParam) > 0) {
--
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW,
- SK_PNMI_ERR043,
- SK_PNMI_ERR043MSG);
--
-+
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
- }
- }
-- else {
-+ else { /* DualNet mode. */
-+
- /*
- * Send an event with the new link mode to
- * the SIRQ module.
- */
-- EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-+ EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)Val8;
- if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_LMODE,
- EventParam) > 0) {
-@@ -5587,15 +5453,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_GENERAL);
- }
- }
-- Offset += sizeof(char);
-+ Offset++;
- break;
-
- case OID_SKGE_FLOWCTRL_MODE:
-- /* Check the value range */
-- Val8 = *(pBuf + Offset);
-+ /* Check the value range. */
- if (Val8 == 0) {
--
-- Offset += sizeof(char);
-+ Offset++;
- break;
- }
- if (Val8 < SK_FLOW_MODE_NONE ||
-@@ -5606,30 +5470,48 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- if (LogPortIndex == 0) {
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
-+ if (LogPortIndex == 0) {
-+ /*
-+ * The virtual port consists of all currently
-+ * active ports. Find them and send an event
-+ * with the new flow control mode to SIRQ.
-+ */
-+ for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
-+ PhysPortIndex ++) {
-
-- /*
-- * The virtual port consists of all currently
-- * active ports. Find them and send an event
-- * with the new flow control mode to SIRQ.
-- */
-- for (PhysPortIndex = 0;
-- PhysPortIndex < PhysPortMax;
-- PhysPortIndex ++) {
-+ if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-+ continue;
-+ }
-
-- if (!pAC->Pnmi.Port[PhysPortIndex].
-- ActiveFlag) {
-+ EventParam.Para32[0] = PhysPortIndex;
-+ EventParam.Para32[1] = (SK_U32)Val8;
-+ if (SkGeSirqEvent(pAC, IoC,
-+ SK_HWEV_SET_FLOWMODE,
-+ EventParam) > 0) {
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW,
-+ SK_PNMI_ERR044,
-+ SK_PNMI_ERR044MSG);
-
-- continue;
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
- }
--
-- EventParam.Para32[0] = PhysPortIndex;
-+ }
-+ else {
-+ /*
-+ * Send an event with the new flow control
-+ * mode to the SIRQ module.
-+ */
-+ EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-+ pAC, LogPortIndex);
- EventParam.Para32[1] = (SK_U32)Val8;
- if (SkGeSirqEvent(pAC, IoC,
- SK_HWEV_SET_FLOWMODE,
-@@ -5644,17 +5526,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
- }
-- else {
-+ else { /* DualNet mode. */
-+
- /*
-- * Send an event with the new flow control
-- * mode to the SIRQ module.
-+ * Send an event with the new link mode to
-+ * the SIRQ module.
- */
-- EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-+ EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)Val8;
-- if (SkGeSirqEvent(pAC, IoC,
-- SK_HWEV_SET_FLOWMODE, EventParam)
-- > 0) {
-+ if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_FLOWMODE,
-+ EventParam) > 0) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_SW,
- SK_PNMI_ERR044,
-@@ -5664,15 +5545,14 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_GENERAL);
- }
- }
-- Offset += sizeof(char);
-+ Offset++;
- break;
-
- case OID_SKGE_PHY_OPERATION_MODE :
-- /* Check the value range */
-- Val8 = *(pBuf + Offset);
-+ /* Check the value range. */
- if (Val8 == 0) {
-- /* mode of this port remains unchanged */
-- Offset += sizeof(char);
-+ /* Mode of this port remains unchanged. */
-+ Offset++;
- break;
- }
- if (Val8 < SK_MS_MODE_AUTO ||
-@@ -5683,34 +5563,51 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- if (LogPortIndex == 0) {
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
-+ if (LogPortIndex == 0) {
-+ /*
-+ * The virtual port consists of all currently
-+ * active ports. Find them and send an event
-+ * with new master/slave (role) mode to SIRQ.
-+ */
-+ for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
-+ PhysPortIndex ++) {
-
-- /*
-- * The virtual port consists of all currently
-- * active ports. Find them and send an event
-- * with new master/slave (role) mode to SIRQ.
-- */
-- for (PhysPortIndex = 0;
-- PhysPortIndex < PhysPortMax;
-- PhysPortIndex ++) {
-+ if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-+ continue;
-+ }
-
-- if (!pAC->Pnmi.Port[PhysPortIndex].
-- ActiveFlag) {
-+ EventParam.Para32[0] = PhysPortIndex;
-+ EventParam.Para32[1] = (SK_U32)Val8;
-+ if (SkGeSirqEvent(pAC, IoC,
-+ SK_HWEV_SET_ROLE,
-+ EventParam) > 0) {
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW,
-+ SK_PNMI_ERR042,
-+ SK_PNMI_ERR042MSG);
-
-- continue;
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
- }
--
-- EventParam.Para32[0] = PhysPortIndex;
-+ }
-+ else {
-+ /*
-+ * Send an event with the new master/slave
-+ * (role) mode to the SIRQ module.
-+ */
-+ EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-+ pAC, LogPortIndex);
- EventParam.Para32[1] = (SK_U32)Val8;
- if (SkGeSirqEvent(pAC, IoC,
-- SK_HWEV_SET_ROLE,
-- EventParam) > 0) {
-+ SK_HWEV_SET_ROLE, EventParam) > 0) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_SW,
- SK_PNMI_ERR042,
-@@ -5721,16 +5618,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
- }
-- else {
-+ else { /* DualNet mode. */
-+
- /*
-- * Send an event with the new master/slave
-- * (role) mode to the SIRQ module.
-+ * Send an event with the new link mode to
-+ * the SIRQ module.
- */
-- EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-+ EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)Val8;
-- if (SkGeSirqEvent(pAC, IoC,
-- SK_HWEV_SET_ROLE, EventParam) > 0) {
-+ if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_ROLE,
-+ EventParam) > 0) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_SW,
- SK_PNMI_ERR042,
-@@ -5740,16 +5637,13 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_GENERAL);
- }
- }
--
-- Offset += sizeof(char);
-+ Offset++;
- break;
-
- case OID_SKGE_SPEED_MODE:
-- /* Check the value range */
-- Val8 = *(pBuf + Offset);
-+ /* Check the value range. */
- if (Val8 == 0) {
--
-- Offset += sizeof(char);
-+ Offset++;
- break;
- }
- if (Val8 < (SK_LSPEED_AUTO) ||
-@@ -5760,29 +5654,49 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- if (LogPortIndex == 0) {
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
-+ if (LogPortIndex == 0) {
-
-- /*
-- * The virtual port consists of all currently
-- * active ports. Find them and send an event
-- * with the new flow control mode to SIRQ.
-- */
-- for (PhysPortIndex = 0;
-- PhysPortIndex < PhysPortMax;
-- PhysPortIndex ++) {
-+ /*
-+ * The virtual port consists of all currently
-+ * active ports. Find them and send an event
-+ * with the new flow control mode to SIRQ.
-+ */
-+ for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
-+ PhysPortIndex ++) {
-
-- if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-+ if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
-+ continue;
-+ }
-
-- continue;
-- }
-+ EventParam.Para32[0] = PhysPortIndex;
-+ EventParam.Para32[1] = (SK_U32)Val8;
-+ if (SkGeSirqEvent(pAC, IoC,
-+ SK_HWEV_SET_SPEED,
-+ EventParam) > 0) {
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW,
-+ SK_PNMI_ERR045,
-+ SK_PNMI_ERR045MSG);
-
-- EventParam.Para32[0] = PhysPortIndex;
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
-+ }
-+ }
-+ else {
-+ /*
-+ * Send an event with the new flow control
-+ * mode to the SIRQ module.
-+ */
-+ EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-+ pAC, LogPortIndex);
- EventParam.Para32[1] = (SK_U32)Val8;
- if (SkGeSirqEvent(pAC, IoC,
- SK_HWEV_SET_SPEED,
-@@ -5797,16 +5711,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
- }
-- else {
-+ else { /* DualNet mode. */
-+
- /*
-- * Send an event with the new flow control
-- * mode to the SIRQ module.
-+ * Send an event with the new link mode to
-+ * the SIRQ module.
- */
-- EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
-- pAC, LogPortIndex);
-+ EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)Val8;
-- if (SkGeSirqEvent(pAC, IoC,
-- SK_HWEV_SET_SPEED,
-+ if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_SPEED,
- EventParam) > 0) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_SW,
-@@ -5817,23 +5730,25 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_GENERAL);
- }
- }
-- Offset += sizeof(char);
-+ Offset++;
- break;
-
-- case OID_SKGE_MTU :
-- /* Check the value range */
-- Val32 = *(SK_U32*)(pBuf + Offset);
-+ case OID_SKGE_MTU:
-+ /* Check the value range. */
-+ SK_PNMI_READ_U32((pBuf + Offset), Val32);
-+
- if (Val32 == 0) {
-- /* mtu of this port remains unchanged */
-+ /* MTU of this port remains unchanged. */
- Offset += sizeof(SK_U32);
- break;
- }
-+
- if (SK_DRIVER_PRESET_MTU(pAC, IoC, NetIndex, Val32) != 0) {
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
- return (SK_PNMI_ERR_OK);
- }
-@@ -5844,116 +5759,69 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- Offset += sizeof(SK_U32);
- break;
--
-+
- #ifdef SK_PHY_LP_MODE
- case OID_SKGE_PHY_LP_MODE:
-- /* The preset ends here */
-+ /* The PRESET ends here. */
- if (Action == SK_PNMI_PRESET) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
-+ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNet mode. */
- if (LogPortIndex == 0) {
- Offset = 0;
- continue;
- }
-- else {
-- /* Set value for physical ports */
-- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
--
-- switch (*(pBuf + Offset)) {
-- case 0:
-- /* If LowPowerMode is active, we can leave it. */
-- if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
--
-- Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
--
-- if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
--
-- SkDrvInitAdapter(pAC);
-- }
-- break;
-- }
-- else {
-- *pLen = 0;
-- return (SK_PNMI_ERR_GENERAL);
-- }
-- case 1:
-- case 2:
-- case 3:
-- case 4:
-- /* If no LowPowerMode is active, we can enter it. */
-- if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
--
-- if ((*(pBuf + Offset)) < 3) {
--
-- SkDrvDeInitAdapter(pAC);
-- }
--
-- Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
-- break;
-- }
-- else {
-- *pLen = 0;
-- return (SK_PNMI_ERR_GENERAL);
-- }
-- default:
-- *pLen = 0;
-- return (SK_PNMI_ERR_BAD_VALUE);
-- }
-- }
- }
-- else { /* DualNetMode */
--
-- switch (*(pBuf + Offset)) {
-- case 0:
-- /* If we are in a LowPowerMode, we can leave it. */
-- if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
-+ /* Set value for physical port. */
-+ PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-+ CurrentPhyPowerState = pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
-
-- Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
--
-- if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
-+ switch (Val8) {
-+ case PHY_PM_OPERATIONAL_MODE:
-+ /* If LowPowerMode is active, we can leave it. */
-+ if (CurrentPhyPowerState) {
-
-- SkDrvInitAdapter(pAC);
-- }
-- break;
-- }
-- else {
-- *pLen = 0;
-- return (SK_PNMI_ERR_GENERAL);
-- }
--
-- case 1:
-- case 2:
-- case 3:
-- case 4:
-- /* If we are not already in LowPowerMode, we can enter it. */
-- if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
--
-- if ((*(pBuf + Offset)) < 3) {
--
-- SkDrvDeInitAdapter(pAC);
-- }
-- else {
--
-- Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
-- }
-- break;
-- }
-- else {
-- *pLen = 0;
-- return (SK_PNMI_ERR_GENERAL);
-+ Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
-+
-+ if ((CurrentPhyPowerState == PHY_PM_DEEP_SLEEP) ||
-+ (CurrentPhyPowerState == PHY_PM_IEEE_POWER_DOWN)) {
-+
-+ SkDrvInitAdapter(pAC);
- }
--
-- default:
-+ break;
-+ }
-+ else {
- *pLen = 0;
-- return (SK_PNMI_ERR_BAD_VALUE);
-- }
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
-+ case PHY_PM_DEEP_SLEEP:
-+ case PHY_PM_IEEE_POWER_DOWN:
-+ /* If no LowPowerMode is active, we can enter it. */
-+ if (!CurrentPhyPowerState) {
-+ SkDrvDeInitAdapter(pAC);
-+ }
-+
-+ case PHY_PM_ENERGY_DETECT:
-+ case PHY_PM_ENERGY_DETECT_PLUS:
-+ /* If no LowPowerMode is active, we can enter it. */
-+ if (!CurrentPhyPowerState) {
-+
-+ Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
-+ break;
-+ }
-+ else {
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_GENERAL);
-+ }
-+ default:
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_BAD_VALUE);
- }
-- Offset += sizeof(SK_U8);
-+ Offset++;
- break;
--#endif
-+#endif /* SK_PHY_LP_MODE */
-
- default:
- SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR,
-@@ -6003,14 +5871,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- unsigned int Limit;
- unsigned int Offset;
- unsigned int Entries;
--
-
-- /*
-- * Calculate instance if wished.
-- */
-- /* XXX Not yet implemented. Return always an empty table. */
-+ /* Not implemented yet. Return always an empty table. */
- Entries = 0;
-
-+ /* Calculate instance if wished. */
- if ((Instance != (SK_U32)(-1))) {
-
- if ((Instance < 1) || (Instance > Entries)) {
-@@ -6027,12 +5892,10 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- Limit = Entries;
- }
-
-- /*
-- * Get/Set value
-- */
-+ /* GET/SET value. */
- if (Action == SK_PNMI_GET) {
-
-- for (Offset=0; Index < Limit; Index ++) {
-+ for (Offset = 0; Index < Limit; Index ++) {
-
- switch (Id) {
-
-@@ -6054,32 +5917,29 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- *pLen = Offset;
- }
- else {
-- /* Only MONITOR_ADMIN can be set */
-+ /* Only MONITOR_ADMIN can be set. */
- if (Id != OID_SKGE_RLMT_MONITOR_ADMIN) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_READ_ONLY);
- }
-
-- /* Check if the length is plausible */
-+ /* Check if the length is plausible. */
- if (*pLen < (Limit - Index)) {
-
- return (SK_PNMI_ERR_TOO_SHORT);
- }
-- /* Okay, we have a wide value range */
-+ /* Okay, we have a wide value range. */
- if (*pLen != (Limit - Index)) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
--/*
-- for (Offset=0; Index < Limit; Index ++) {
-- }
--*/
--/*
-- * XXX Not yet implemented. Return always BAD_VALUE, because the table
-- * is empty.
-- */
-+
-+ /*
-+ * Not yet implemented. Return always BAD_VALUE,
-+ * because the table is empty.
-+ */
- *pLen = 0;
- return (SK_PNMI_ERR_BAD_VALUE);
- }
-@@ -6120,14 +5980,12 @@ char *pBuf) /* Buffer used for the mana
- PortActiveFlag = SK_FALSE;
- PhysPortMax = pAC->GIni.GIMacsFound;
-
-- for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
-- PhysPortIndex ++) {
-+ for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax; PhysPortIndex ++) {
-
- pPrt = &pAC->GIni.GP[PhysPortIndex];
-
-- /* Check if the physical port is active */
-+ /* Check if the physical port is active. */
- if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
--
- continue;
- }
-
-@@ -6136,12 +5994,13 @@ char *pBuf) /* Buffer used for the mana
- switch (Id) {
-
- case OID_SKGE_PHY_TYPE:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
- Val32 = pPrt->PhyType;
- SK_PNMI_STORE_U32(pBuf, Val32);
- continue;
- }
-+ break;
-
- case OID_SKGE_LINK_CAP:
-
-@@ -6155,7 +6014,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_LINK_MODE:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PLinkModeConf;
-@@ -6163,9 +6022,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different link
-- * mode than the first one we return a value that
-- * indicates that the link mode is indeterminated.
-+ * If we find an active port with a different link mode
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PLinkModeConf) {
-
-@@ -6174,10 +6032,10 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_LINK_MODE_STATUS:
-- /* Get the link mode of the physical port */
-+ /* Get the link mode of the physical port. */
- Val8 = CalculateLinkModeStatus(pAC, IoC, PhysPortIndex);
-
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = Val8;
-@@ -6185,10 +6043,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different link
-- * mode status than the first one we return a value
-- * that indicates that the link mode status is
-- * indeterminated.
-+ * If we find an active port with a different link mode status
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != Val8) {
-
-@@ -6197,10 +6053,10 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_LINK_STATUS:
-- /* Get the link status of the physical port */
-+ /* Get the link status of the physical port. */
- Val8 = CalculateLinkStatus(pAC, IoC, PhysPortIndex);
-
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = Val8;
-@@ -6208,10 +6064,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different link
-- * status than the first one, we return a value
-- * that indicates that the link status is
-- * indeterminated.
-+ * If we find an active port with a different link status
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != Val8) {
-
-@@ -6220,7 +6074,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_FLOWCTRL_CAP:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PFlowCtrlCap;
-@@ -6235,7 +6089,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_FLOWCTRL_MODE:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PFlowCtrlMode;
-@@ -6243,9 +6097,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different flow
-- * control mode than the first one, we return a value
-- * that indicates that the mode is indeterminated.
-+ * If we find an active port with a different flow-control mode
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PFlowCtrlMode) {
-
-@@ -6254,7 +6107,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_FLOWCTRL_STATUS:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PFlowCtrlStatus;
-@@ -6262,10 +6115,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different flow
-- * control status than the first one, we return a
-- * value that indicates that the status is
-- * indeterminated.
-+ * If we find an active port with a different flow-control status
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PFlowCtrlStatus) {
-
-@@ -6274,7 +6125,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_PHY_OPERATION_CAP:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PMSCap;
-@@ -6289,7 +6140,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_PHY_OPERATION_MODE:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PMSMode;
-@@ -6297,9 +6148,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different master/
-- * slave mode than the first one, we return a value
-- * that indicates that the mode is indeterminated.
-+ * If we find an active port with a different master/slave mode
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PMSMode) {
-
-@@ -6308,7 +6158,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_PHY_OPERATION_STATUS:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PMSStatus;
-@@ -6316,10 +6166,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different master/
-- * slave status than the first one, we return a
-- * value that indicates that the status is
-- * indeterminated.
-+ * If we find an active port with a different master/slave status
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PMSStatus) {
-
-@@ -6328,7 +6176,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_SPEED_MODE:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PLinkSpeed;
-@@ -6336,9 +6184,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different flow
-- * control mode than the first one, we return a value
-- * that indicates that the mode is indeterminated.
-+ * If we find an active port with a different link speed
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PLinkSpeed) {
-
-@@ -6347,7 +6194,7 @@ char *pBuf) /* Buffer used for the mana
- break;
-
- case OID_SKGE_SPEED_STATUS:
-- /* Check if it is the first active port */
-+ /* Check if it is the first active port. */
- if (*pBuf == 0) {
-
- *pBuf = pPrt->PLinkSpeedUsed;
-@@ -6355,10 +6202,8 @@ char *pBuf) /* Buffer used for the mana
- }
-
- /*
-- * If we find an active port with a different flow
-- * control status than the first one, we return a
-- * value that indicates that the status is
-- * indeterminated.
-+ * If we find an active port with a different link speed used
-+ * than the first one we return indeterminated.
- */
- if (*pBuf != pPrt->PLinkSpeedUsed) {
-
-@@ -6368,9 +6213,7 @@ char *pBuf) /* Buffer used for the mana
- }
- }
-
-- /*
-- * If no port is active return an indeterminated answer
-- */
-+ /* If no port is active return an indeterminated answer. */
- if (!PortActiveFlag) {
-
- switch (Id) {
-@@ -6487,16 +6330,15 @@ unsigned int PhysPortIndex) /* Physical
- {
- SK_U8 Result;
-
-- /* Get the current mode, which can be full or half duplex */
-+ /* Get the current mode, which can be full or half duplex. */
- Result = pAC->GIni.GP[PhysPortIndex].PLinkModeStatus;
-
-- /* Check if no valid mode could be found (link is down) */
-+ /* Check if no valid mode could be found (link is down). */
- if (Result < SK_LMODE_STAT_HALF) {
-
- Result = SK_LMODE_STAT_UNKNOWN;
- }
- else if (pAC->GIni.GP[PhysPortIndex].PLinkMode >= SK_LMODE_AUTOHALF) {
--
- /*
- * Auto-negotiation was used to bring up the link. Change
- * the already found duplex status that it indicates
-@@ -6541,22 +6383,22 @@ unsigned int *pKeyNo) /* Number of keys
- int Index;
- int Ret;
-
--
- SK_MEMSET(pKeyArr, 0, KeyArrLen);
-
-- /*
-- * Get VPD key list
-- */
-- Ret = VpdKeys(pAC, IoC, (char *)&BufKeys, (int *)&BufKeysLen,
-+ /* Get VPD key list. */
-+ Ret = VpdKeys(pAC, IoC, BufKeys, (int *)&BufKeysLen,
- (int *)pKeyNo);
-+
- if (Ret > 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR014,
-- SK_PNMI_ERR014MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR014MSG));
-
-+ /* Please read comment in Vpd(). */
-+ pAC->Pnmi.VpdKeyReadError = SK_TRUE;
- return (SK_PNMI_ERR_GENERAL);
- }
-- /* If no keys are available return now */
-+ /* If no keys are available return now. */
- if (*pKeyNo == 0 || BufKeysLen == 0) {
-
- return (SK_PNMI_ERR_OK);
-@@ -6564,12 +6406,12 @@ unsigned int *pKeyNo) /* Number of keys
- /*
- * If the key list is too long for us trunc it and give a
- * errorlog notification. This case should not happen because
-- * the maximum number of keys is limited due to RAM limitations
-+ * the maximum number of keys is limited due to RAM limitations.
- */
- if (*pKeyNo > SK_PNMI_VPD_ENTRIES) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR015,
-- SK_PNMI_ERR015MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR015MSG));
-
- *pKeyNo = SK_PNMI_VPD_ENTRIES;
- }
-@@ -6582,14 +6424,14 @@ unsigned int *pKeyNo) /* Number of keys
- Offset ++) {
-
- if (BufKeys[Offset] != 0) {
--
- continue;
- }
-
- if (Offset - StartOffset > SK_PNMI_VPD_KEY_SIZE) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR016,
-- SK_PNMI_ERR016MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL,
-+ (SK_PNMI_ERR016MSG));
-+
- return (SK_PNMI_ERR_GENERAL);
- }
-
-@@ -6600,7 +6442,7 @@ unsigned int *pKeyNo) /* Number of keys
- StartOffset = Offset + 1;
- }
-
-- /* Last key not zero terminated? Get it anyway */
-+ /* Last key not zero terminated? Get it anyway. */
- if (StartOffset < Offset) {
-
- SK_STRNCPY(pKeyArr + Index * SK_PNMI_VPD_KEY_SIZE,
-@@ -6629,19 +6471,18 @@ SK_IOC IoC) /* IO context handle */
- {
- SK_EVPARA EventParam;
-
--
- /* Was the module already updated during the current PNMI call? */
- if (pAC->Pnmi.SirqUpdatedFlag > 0) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Send an synchronuous update event to the module */
-+ /* Send an synchronuous update event to the module. */
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-- if (SkGeSirqEvent(pAC, IoC, SK_HWEV_UPDATE_STAT, EventParam) > 0) {
-+
-+ if (SkGeSirqEvent(pAC, IoC, SK_HWEV_UPDATE_STAT, EventParam)) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR047,
-- SK_PNMI_ERR047MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR047, SK_PNMI_ERR047MSG);
-
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -6669,21 +6510,19 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- {
- SK_EVPARA EventParam;
-
--
- /* Was the module already updated during the current PNMI call? */
- if (pAC->Pnmi.RlmtUpdatedFlag > 0) {
-
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Send an synchronuous update event to the module */
-+ /* Send an synchronuous update event to the module. */
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
- EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)-1;
- if (SkRlmtEvent(pAC, IoC, SK_RLMT_STATS_UPDATE, EventParam) > 0) {
-
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR048,
-- SK_PNMI_ERR048MSG);
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR048, SK_PNMI_ERR048MSG);
-
- return (SK_PNMI_ERR_GENERAL);
- }
-@@ -6721,20 +6560,20 @@ unsigned int LastMac) /* Index of the la
- return (SK_PNMI_ERR_OK);
- }
-
-- /* Send an update command to all MACs specified */
-+ /* Send an update command to all MACs specified. */
- for (MacIndex = FirstMac; MacIndex <= LastMac; MacIndex ++) {
-
- /*
- * 2002-09-13 pweber: Freeze the current SW counters.
- * (That should be done as close as
- * possible to the update of the
-- * HW counters)
-+ * HW counters).
- */
- if (pAC->GIni.GIMacType == SK_MAC_XMAC) {
- pAC->Pnmi.BufPort[MacIndex] = pAC->Pnmi.Port[MacIndex];
- }
-
-- /* 2002-09-13 pweber: Update the HW counter */
-+ /* 2002-09-13 pweber: Update the HW counter. */
- if (pAC->GIni.GIFunc.pFnMacUpdateStats(pAC, IoC, MacIndex) != 0) {
-
- return (SK_PNMI_ERR_GENERAL);
-@@ -6772,19 +6611,19 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U64 Val = 0;
-
-
-- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* Dual net mode */
-+ if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* DualNet mode. */
-
- PhysPortIndex = NetIndex;
-
- Val = GetPhysStatVal(pAC, IoC, PhysPortIndex, StatIndex);
- }
-- else { /* Single Net mode */
-+ else { /* SingleNet mode. */
-
- if (LogPortIndex == 0) {
-
- PhysPortMax = pAC->GIni.GIMacsFound;
-
-- /* Add counter of all active ports */
-+ /* Add counter of all active ports. */
- for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax;
- PhysPortIndex ++) {
-
-@@ -6794,11 +6633,11 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- }
-
-- /* Correct value because of port switches */
-+ /* Correct value because of port switches. */
- Val += pAC->Pnmi.VirtualCounterOffset[StatIndex];
- }
- else {
-- /* Get counter value of physical port */
-+ /* Get counter value of physical port. */
- PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
-
- Val = GetPhysStatVal(pAC, IoC, PhysPortIndex, StatIndex);
-@@ -6844,7 +6683,7 @@ unsigned int StatIndex) /* Index to sta
-
- MacType = pAC->GIni.GIMacType;
-
-- /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
-+ /* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort). */
- if (MacType == SK_MAC_XMAC) {
- pPnmiPrt = &pAC->Pnmi.BufPort[PhysPortIndex];
- }
-@@ -6912,7 +6751,7 @@ unsigned int StatIndex) /* Index to sta
- case SK_PNMI_HTX_BURST:
- case SK_PNMI_HTX_EXCESS_DEF:
- case SK_PNMI_HTX_CARRIER:
-- /* Not supported by GMAC */
-+ /* Not supported by GMAC. */
- if (MacType == SK_MAC_GMAC) {
- return (Val);
- }
-@@ -6924,7 +6763,7 @@ unsigned int StatIndex) /* Index to sta
- break;
-
- case SK_PNMI_HTX_MACC:
-- /* GMAC only supports PAUSE MAC control frames */
-+ /* GMAC only supports PAUSE MAC control frames. */
- if (MacType == SK_MAC_GMAC) {
- HelpIndex = SK_PNMI_HTX_PMACC;
- }
-@@ -6941,7 +6780,7 @@ unsigned int StatIndex) /* Index to sta
-
- case SK_PNMI_HTX_COL:
- case SK_PNMI_HRX_UNDERSIZE:
-- /* Not supported by XMAC */
-+ /* Not supported by XMAC. */
- if (MacType == SK_MAC_XMAC) {
- return (Val);
- }
-@@ -6953,7 +6792,7 @@ unsigned int StatIndex) /* Index to sta
- break;
-
- case SK_PNMI_HTX_DEFFERAL:
-- /* Not supported by GMAC */
-+ /* Not supported by GMAC. */
- if (MacType == SK_MAC_GMAC) {
- return (Val);
- }
-@@ -6971,7 +6810,7 @@ unsigned int StatIndex) /* Index to sta
- HighVal = 0;
- }
- else {
-- /* Otherwise get contents of hardware register */
-+ /* Otherwise get contents of hardware register. */
- (void)pFnMac->pFnMacStatistic(pAC, IoC, PhysPortIndex,
- StatAddr[StatIndex][MacType].Reg,
- &LowVal);
-@@ -6980,7 +6819,7 @@ unsigned int StatIndex) /* Index to sta
- break;
-
- case SK_PNMI_HRX_BADOCTET:
-- /* Not supported by XMAC */
-+ /* Not supported by XMAC. */
- if (MacType == SK_MAC_XMAC) {
- return (Val);
- }
-@@ -6999,7 +6838,7 @@ unsigned int StatIndex) /* Index to sta
- return (Val);
-
- case SK_PNMI_HRX_LONGFRAMES:
-- /* For XMAC the SW counter is managed by PNMI */
-+ /* For XMAC the SW counter is managed by PNMI. */
- if (MacType == SK_MAC_XMAC) {
- return (pPnmiPrt->StatRxLongFrameCts);
- }
-@@ -7019,7 +6858,7 @@ unsigned int StatIndex) /* Index to sta
- Val = (((SK_U64)HighVal << 32) | (SK_U64)LowVal);
-
- if (MacType == SK_MAC_GMAC) {
-- /* For GMAC the SW counter is additionally managed by PNMI */
-+ /* For GMAC the SW counter is additionally managed by PNMI. */
- Val += pPnmiPrt->StatRxFrameTooLongCts;
- }
- else {
-@@ -7037,20 +6876,19 @@ unsigned int StatIndex) /* Index to sta
- break;
-
- case SK_PNMI_HRX_SHORTS:
-- /* Not supported by GMAC */
-+ /* Not supported by GMAC. */
- if (MacType == SK_MAC_GMAC) {
- /* GM_RXE_FRAG?? */
- return (Val);
- }
-
- /*
-- * XMAC counts short frame errors even if link down (#10620)
-- *
-- * If link-down the counter remains constant
-+ * XMAC counts short frame errors even if link down (#10620).
-+ * If the link is down, the counter remains constant.
- */
- if (pPrt->PLinkModeStatus != SK_LMODE_STAT_UNKNOWN) {
-
-- /* Otherwise get incremental difference */
-+ /* Otherwise get incremental difference. */
- (void)pFnMac->pFnMacStatistic(pAC, IoC, PhysPortIndex,
- StatAddr[StatIndex][MacType].Reg,
- &LowVal);
-@@ -7073,7 +6911,7 @@ unsigned int StatIndex) /* Index to sta
- case SK_PNMI_HRX_IRLENGTH:
- case SK_PNMI_HRX_SYMBOL:
- case SK_PNMI_HRX_CEXT:
-- /* Not supported by GMAC */
-+ /* Not supported by GMAC. */
- if (MacType == SK_MAC_GMAC) {
- return (Val);
- }
-@@ -7085,7 +6923,7 @@ unsigned int StatIndex) /* Index to sta
- break;
-
- case SK_PNMI_HRX_PMACC_ERR:
-- /* For GMAC the SW counter is managed by PNMI */
-+ /* For GMAC the SW counter is managed by PNMI. */
- if (MacType == SK_MAC_GMAC) {
- return (pPnmiPrt->StatRxPMaccErr);
- }
-@@ -7096,13 +6934,13 @@ unsigned int StatIndex) /* Index to sta
- HighVal = pPnmiPrt->CounterHigh[StatIndex];
- break;
-
-- /* SW counter managed by PNMI */
-+ /* SW counter managed by PNMI. */
- case SK_PNMI_HTX_SYNC:
- LowVal = (SK_U32)pPnmiPrt->StatSyncCts;
- HighVal = (SK_U32)(pPnmiPrt->StatSyncCts >> 32);
- break;
-
-- /* SW counter managed by PNMI */
-+ /* SW counter managed by PNMI. */
- case SK_PNMI_HTX_SYNC_OCTET:
- LowVal = (SK_U32)pPnmiPrt->StatSyncOctetsCts;
- HighVal = (SK_U32)(pPnmiPrt->StatSyncOctetsCts >> 32);
-@@ -7110,17 +6948,19 @@ unsigned int StatIndex) /* Index to sta
-
- case SK_PNMI_HRX_FCS:
- /*
-- * Broadcom filters FCS errors and counts it in
-- * Receive Error Counter register
-+ * Broadcom filters FCS errors and counts them in
-+ * Receive Error Counter register.
- */
- if (pPrt->PhyType == SK_PHY_BCOM) {
-- /* do not read while not initialized (PHY_READ hangs!)*/
-+#ifdef GENESIS
-+ /* Do not read while not initialized (PHY_READ hangs!). */
- if (pPrt->PState != SK_PRT_RESET) {
- SkXmPhyRead(pAC, IoC, PhysPortIndex, PHY_BCOM_RE_CTR, &Word);
-
- LowVal = Word;
- }
- HighVal = pPnmiPrt->CounterHigh[StatIndex];
-+#endif /* GENESIS */
- }
- else {
- (void)pFnMac->pFnMacStatistic(pAC, IoC, PhysPortIndex,
-@@ -7140,7 +6980,7 @@ unsigned int StatIndex) /* Index to sta
-
- Val = (((SK_U64)HighVal << 32) | (SK_U64)LowVal);
-
-- /* Correct value because of possible XMAC reset. XMAC Errata #2 */
-+ /* Correct value because of possible XMAC reset (XMAC Errata #2). */
- Val += pPnmiPrt->CounterOffset[StatIndex];
-
- return (Val);
-@@ -7165,22 +7005,21 @@ SK_U32 NetIndex)
- unsigned int PhysPortIndex;
- SK_EVPARA EventParam;
-
--
- SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam));
-
-- /* Notify sensor module */
-+ /* Notify sensor module. */
- SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_CLEAR, EventParam);
-
-- /* Notify RLMT module */
-+ /* Notify RLMT module. */
- EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)-1;
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STATS_CLEAR, EventParam);
- EventParam.Para32[1] = 0;
-
-- /* Notify SIRQ module */
-+ /* Notify SIRQ module. */
- SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_CLEAR_STAT, EventParam);
-
-- /* Notify CSUM module */
-+ /* Notify CSUM module. */
- #ifdef SK_USE_CSUM
- EventParam.Para32[0] = NetIndex;
- EventParam.Para32[1] = (SK_U32)-1;
-@@ -7188,7 +7027,7 @@ SK_U32 NetIndex)
- EventParam);
- #endif /* SK_USE_CSUM */
-
-- /* Clear XMAC statistic */
-+ /* Clear XMAC statistics. */
- for (PhysPortIndex = 0; PhysPortIndex <
- (unsigned int)pAC->GIni.GIMacsFound; PhysPortIndex ++) {
-
-@@ -7215,13 +7054,13 @@ SK_U32 NetIndex)
- PhysPortIndex].StatRxPMaccErr));
- }
-
-- /*
-- * Clear local statistics
-- */
-+ /* Clear local statistics. */
- SK_MEMSET((char *)&pAC->Pnmi.VirtualCounterOffset, 0,
- sizeof(pAC->Pnmi.VirtualCounterOffset));
-+
- pAC->Pnmi.RlmtChangeCts = 0;
- pAC->Pnmi.RlmtChangeTime = 0;
-+
- SK_MEMSET((char *)&pAC->Pnmi.RlmtChangeEstimate.EstValue[0], 0,
- sizeof(pAC->Pnmi.RlmtChangeEstimate.EstValue));
- pAC->Pnmi.RlmtChangeEstimate.EstValueIndex = 0;
-@@ -7258,23 +7097,21 @@ SK_AC *pAC, /* Pointer to adapter conte
- SK_U32 TrapId, /* SNMP ID of the trap */
- unsigned int Size) /* Space needed for trap entry */
- {
-- unsigned int BufPad = pAC->Pnmi.TrapBufPad;
-- unsigned int BufFree = pAC->Pnmi.TrapBufFree;
-- unsigned int Beg = pAC->Pnmi.TrapQueueBeg;
-- unsigned int End = pAC->Pnmi.TrapQueueEnd;
-+ unsigned int BufPad = pAC->Pnmi.TrapBufPad;
-+ unsigned int BufFree = pAC->Pnmi.TrapBufFree;
-+ unsigned int Beg = pAC->Pnmi.TrapQueueBeg;
-+ unsigned int End = pAC->Pnmi.TrapQueueEnd;
- char *pBuf = &pAC->Pnmi.TrapBuf[0];
- int Wrap;
-- unsigned int NeededSpace;
-- unsigned int EntrySize;
-+ unsigned int NeededSpace;
-+ unsigned int EntrySize;
- SK_U32 Val32;
- SK_U64 Val64;
-
--
-- /* Last byte of entry will get a copy of the entry length */
-+ /* Last byte of entry will get a copy of the entry length. */
- Size ++;
-
-- /*
-- * Calculate needed buffer space */
-+ /* Calculate needed buffer space. */
- if (Beg >= Size) {
-
- NeededSpace = Size;
-@@ -7289,7 +7126,7 @@ unsigned int Size) /* Space needed for t
- * Check if enough buffer space is provided. Otherwise
- * free some entries. Leave one byte space between begin
- * and end of buffer to make it possible to detect whether
-- * the buffer is full or empty
-+ * the buffer is full or empty.
- */
- while (BufFree < NeededSpace + 1) {
-
-@@ -7328,13 +7165,13 @@ unsigned int Size) /* Space needed for t
- }
- BufFree -= NeededSpace;
-
-- /* Save the current offsets */
-+ /* Save the current offsets. */
- pAC->Pnmi.TrapQueueBeg = Beg;
- pAC->Pnmi.TrapQueueEnd = End;
- pAC->Pnmi.TrapBufPad = BufPad;
- pAC->Pnmi.TrapBufFree = BufFree;
-
-- /* Initialize the trap entry */
-+ /* Initialize the trap entry. */
- *(pBuf + Beg + Size - 1) = (char)Size;
- *(pBuf + Beg) = (char)Size;
- Val32 = (pAC->Pnmi.TrapUnique) ++;
-@@ -7369,7 +7206,6 @@ char *pDstBuf) /* Buffer to which the q
- unsigned int Len;
- unsigned int DstOff = 0;
-
--
- while (Trap != End) {
-
- Len = (unsigned int)*(pBuf + Trap);
-@@ -7414,7 +7250,6 @@ unsigned int *pEntries) /* Returns numbe
- unsigned int Entries = 0;
- unsigned int TotalLen = 0;
-
--
- while (Trap != End) {
-
- Len = (unsigned int)*(pBuf + Trap);
-@@ -7471,14 +7306,14 @@ unsigned int SensorIndex) /* Index of se
- unsigned int DescrLen;
- SK_U32 Val32;
-
--
-- /* Get trap buffer entry */
-+ /* Get trap buffer entry. */
- DescrLen = SK_STRLEN(pAC->I2c.SenTable[SensorIndex].SenDesc);
-+
- pBuf = GetTrapEntry(pAC, TrapId,
- SK_PNMI_TRAP_SENSOR_LEN_BASE + DescrLen);
- Offset = SK_PNMI_TRAP_SIMPLE_LEN;
-
-- /* Store additionally sensor trap related data */
-+ /* Store additionally sensor trap related data. */
- Val32 = OID_SKGE_SENSOR_INDEX;
- SK_PNMI_STORE_U32(pBuf + Offset, Val32);
- *(pBuf + Offset + 4) = 4;
-@@ -7523,7 +7358,6 @@ unsigned int ActiveMac) /* Index (0..n)
- char *pBuf;
- SK_U32 Val32;
-
--
- pBuf = GetTrapEntry(pAC, OID_SKGE_TRAP_RLMT_CHANGE_PORT,
- SK_PNMI_TRAP_RLMT_CHANGE_LEN);
-
-@@ -7551,7 +7385,6 @@ unsigned int PortIndex) /* Index of the
- char *pBuf;
- SK_U32 Val32;
-
--
- pBuf = GetTrapEntry(pAC, TrapId, SK_PNMI_TRAP_RLMT_PORT_LEN);
-
- Val32 = OID_SKGE_RLMT_PORT_INDEX;
-@@ -7571,12 +7404,11 @@ unsigned int PortIndex) /* Index of the
- * Nothing
- */
- PNMI_STATIC void CopyMac(
--char *pDst, /* Pointer to destination buffer */
-+char *pDst, /* Pointer to destination buffer */
- SK_MAC_ADDR *pMac) /* Pointer of Source */
- {
- int i;
-
--
- for (i = 0; i < sizeof(SK_MAC_ADDR); i ++) {
-
- *(pDst + i) = pMac->a[i];
-@@ -7614,19 +7446,22 @@ unsigned int TableIndex, /* Index to the
- SK_U32 NetIndex) /* NetIndex (0..n), in single net mode allways zero */
- {
-
-+ int i;
-+ unsigned int HwPortIndex;
-+
- SK_U32 RetCode = SK_PNMI_ERR_GENERAL;
-
-- /*
-- * Check instance. We only handle single instance variables
-- */
-- if (Instance != (SK_U32)(-1) && Instance != 1) {
-+ /* Check instance. We only handle single instance variables. */
-+ if ((Instance != (SK_U32)(-1))) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-+
-+ /* Get hardware port index */
-+ HwPortIndex = NetIndex;
-
--
-- /* Check length */
-+ /* Check length. */
- switch (Id) {
-
- case OID_PNP_CAPABILITIES:
-@@ -7664,14 +7499,10 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
- }
-
-- /*
-- * Perform action
-- */
-+ /* Perform action. */
- if (Action == SK_PNMI_GET) {
-
-- /*
-- * Get value
-- */
-+ /* Get value. */
- switch (Id) {
-
- case OID_PNP_CAPABILITIES:
-@@ -7679,18 +7510,21 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_PNP_QUERY_POWER:
-- /* The Windows DDK describes: An OID_PNP_QUERY_POWER requests
-- the miniport to indicate whether it can transition its NIC
-- to the low-power state.
-- A miniport driver must always return NDIS_STATUS_SUCCESS
-- to a query of OID_PNP_QUERY_POWER. */
-+ /*
-+ * The Windows DDK describes: An OID_PNP_QUERY_POWER requests
-+ * the miniport to indicate whether it can transition its NIC
-+ * to the low-power state.
-+ * A miniport driver must always return NDIS_STATUS_SUCCESS
-+ * to a query of OID_PNP_QUERY_POWER.
-+ */
- *pLen = sizeof(SK_DEVICE_POWER_STATE);
- RetCode = SK_PNMI_ERR_OK;
- break;
-
-- /* NDIS handles these OIDs as write-only.
-+ /*
-+ * NDIS handles these OIDs as write-only.
- * So in case of get action the buffer with written length = 0
-- * is returned
-+ * is returned.
- */
- case OID_PNP_SET_POWER:
- case OID_PNP_ADD_WAKE_UP_PATTERN:
-@@ -7700,7 +7534,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case OID_PNP_ENABLE_WAKE_UP:
-- RetCode = SkPowerGetEnableWakeUp(pAC, IoC, pBuf, pLen);
-+ RetCode = SkPowerGetEnableWakeUp(pAC, IoC, HwPortIndex, pBuf, pLen);
- break;
-
- default:
-@@ -7711,31 +7545,49 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (RetCode);
- }
-
--
-- /*
-- * Perform preset or set
-- */
-+ /* Perform PRESET or SET. */
-
-- /* POWER module does not support PRESET action */
-+ /* The POWER module does not support PRESET action. */
- if (Action == SK_PNMI_PRESET) {
-+
- return (SK_PNMI_ERR_OK);
- }
-
-+ /* */
-+ i= HwPortIndex;
-+
- switch (Id) {
- case OID_PNP_SET_POWER:
-- RetCode = SkPowerSetPower(pAC, IoC, pBuf, pLen);
-+ /* Dual net mode? */
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (RetCode = SkPowerSetPower(pAC, IoC, i, pBuf, pLen)) {
-+ break;
-+ }
-+ }
- break;
-
- case OID_PNP_ADD_WAKE_UP_PATTERN:
-- RetCode = SkPowerAddWakeUpPattern(pAC, IoC, pBuf, pLen);
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (RetCode = SkPowerAddWakeUpPattern(pAC, IoC, i, pBuf, pLen)) {
-+ break;
-+ }
-+ }
- break;
-
- case OID_PNP_REMOVE_WAKE_UP_PATTERN:
-- RetCode = SkPowerRemoveWakeUpPattern(pAC, IoC, pBuf, pLen);
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (RetCode = SkPowerRemoveWakeUpPattern(pAC, IoC, i, pBuf, pLen)) {
-+ break;
-+ }
-+ }
- break;
-
- case OID_PNP_ENABLE_WAKE_UP:
-- RetCode = SkPowerSetEnableWakeUp(pAC, IoC, pBuf, pLen);
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (RetCode = SkPowerSetEnableWakeUp(pAC, IoC, i, pBuf, pLen)) {
-+ break;
-+ }
-+ }
- break;
-
- default:
-@@ -7749,7 +7601,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- #ifdef SK_DIAG_SUPPORT
- /*****************************************************************************
- *
-- * DiagActions - OID handler function of Diagnostic driver
-+ * DiagActions - OID handler function of Diagnostic driver
- *
- * Description:
- * The code is simple. No description necessary.
-@@ -7776,22 +7628,17 @@ SK_U32 Instance, /* Instance (1..n) that
- unsigned int TableIndex, /* Index to the Id table */
- SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
- {
--
- SK_U32 DiagStatus;
- SK_U32 RetCode = SK_PNMI_ERR_GENERAL;
-
-- /*
-- * Check instance. We only handle single instance variables.
-- */
-+ /* Check instance. We only handle single instance variables. */
- if (Instance != (SK_U32)(-1) && Instance != 1) {
-
- *pLen = 0;
- return (SK_PNMI_ERR_UNKNOWN_INST);
- }
-
-- /*
-- * Check length.
-- */
-+ /* Check length. */
- switch (Id) {
-
- case OID_SKGE_DIAG_MODE:
-@@ -7809,10 +7656,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
-
- /* Perform action. */
--
-- /* GET value. */
- if (Action == SK_PNMI_GET) {
-
-+ /* Get value. */
- switch (Id) {
-
- case OID_SKGE_DIAG_MODE:
-@@ -7827,14 +7673,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- RetCode = SK_PNMI_ERR_GENERAL;
- break;
- }
-- return (RetCode);
-+ return (RetCode);
- }
-
- /* From here SET or PRESET value. */
-
- /* PRESET value is not supported. */
- if (Action == SK_PNMI_PRESET) {
-- return (SK_PNMI_ERR_OK);
-+
-+ return (SK_PNMI_ERR_OK);
- }
-
- /* SET value. */
-@@ -7846,7 +7693,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- /* Attach the DIAG to this adapter. */
- case SK_DIAG_ATTACHED:
-- /* Check if we come from running */
-+ /* Check if we come from running. */
- if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
-
- RetCode = SkDrvLeaveDiagMode(pAC);
-@@ -7881,7 +7728,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- /* If DiagMode is not active, we can enter it. */
- if (!pAC->DiagModeActive) {
-
-- RetCode = SkDrvEnterDiagMode(pAC);
-+ RetCode = SkDrvEnterDiagMode(pAC);
- }
- else {
-
-@@ -7900,7 +7747,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- break;
-
- case SK_DIAG_IDLE:
-- /* Check if we come from running */
-+ /* Check if we come from running. */
- if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
-
- RetCode = SkDrvLeaveDiagMode(pAC);
-@@ -7946,7 +7793,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
-
- /*****************************************************************************
- *
-- * Vct - OID handler function of OIDs
-+ * Vct - OID handler function of OIDs for Virtual Cable Tester (VCT)
- *
- * Description:
- * The code is simple. No description necessary.
-@@ -7982,153 +7829,150 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- SK_U32 PhysPortIndex;
- SK_U32 Limit;
- SK_U32 Offset;
-- SK_BOOL Link;
-- SK_U32 RetCode = SK_PNMI_ERR_GENERAL;
-- int i;
-+ SK_U32 RetCode;
-+ int i;
- SK_EVPARA Para;
-- SK_U32 CableLength;
--
-- /*
-- * Calculate the port indexes from the instance.
-- */
-+
-+ RetCode = SK_PNMI_ERR_GENERAL;
-+
-+ /* Calculate the port indexes from the instance. */
- PhysPortMax = pAC->GIni.GIMacsFound;
- LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax);
--
-+
- /* Dual net mode? */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- LogPortMax--;
- }
--
-+
- if ((Instance != (SK_U32) (-1))) {
-- /* Check instance range. */
-- if ((Instance < 2) || (Instance > LogPortMax)) {
-- *pLen = 0;
-- return (SK_PNMI_ERR_UNKNOWN_INST);
-- }
--
-+ /*
-+ * Get one instance of that OID, so check the instance range:
-+ * There is no virtual port with an Instance == 1, so we get
-+ * the values from one physical port only.
-+ */
- if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
- PhysPortIndex = NetIndex;
- }
- else {
-+ if ((Instance < 2) || (Instance > LogPortMax)) {
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_UNKNOWN_INST);
-+ }
- PhysPortIndex = Instance - 2;
- }
- Limit = PhysPortIndex + 1;
- }
- else {
- /*
-- * Instance == (SK_U32) (-1), get all Instances of that OID.
-- *
-- * Not implemented yet. May be used in future releases.
-+ * Instance == (SK_U32) (-1), so get all instances of that OID.
-+ * There is no virtual port with an Instance == 1, so we get
-+ * the values from all physical ports.
- */
- PhysPortIndex = 0;
- Limit = PhysPortMax;
- }
--
-- pPrt = &pAC->GIni.GP[PhysPortIndex];
-- if (pPrt->PHWLinkUp) {
-- Link = SK_TRUE;
-- }
-- else {
-- Link = SK_FALSE;
-- }
--
-- /* Check MAC type */
-- if (pPrt->PhyType != SK_PHY_MARV_COPPER) {
-+
-+ /* Check MAC type. */
-+ if ((Id != OID_SKGE_VCT_CAPABILITIES) &&
-+ (pAC->GIni.GP[PhysPortIndex].PhyType != SK_PHY_MARV_COPPER)) {
- *pLen = 0;
-- return (SK_PNMI_ERR_GENERAL);
-+ return (SK_PNMI_ERR_NOT_SUPPORTED);
- }
--
-- /* Initialize backup data pointer. */
-- pVctBackupData = &pAC->Pnmi.VctBackup[PhysPortIndex];
--
-- /* Check action type */
-+
-+ /* Check action type. */
- if (Action == SK_PNMI_GET) {
-- /* Check length */
-+ /* Check length. */
- switch (Id) {
--
-+
- case OID_SKGE_VCT_GET:
- if (*pLen < (Limit - PhysPortIndex) * sizeof(SK_PNMI_VCT)) {
- *pLen = (Limit - PhysPortIndex) * sizeof(SK_PNMI_VCT);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
- break;
--
-+
- case OID_SKGE_VCT_STATUS:
-+ case OID_SKGE_VCT_CAPABILITIES:
- if (*pLen < (Limit - PhysPortIndex) * sizeof(SK_U8)) {
- *pLen = (Limit - PhysPortIndex) * sizeof(SK_U8);
- return (SK_PNMI_ERR_TOO_SHORT);
- }
- break;
--
-+
- default:
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
--
-- /* Get value */
-+
-+ /* Get value. */
- Offset = 0;
- for (; PhysPortIndex < Limit; PhysPortIndex++) {
-+
-+ pPrt = &pAC->GIni.GP[PhysPortIndex];
-+
- switch (Id) {
--
-+
- case OID_SKGE_VCT_GET:
-- if ((Link == SK_FALSE) &&
-+ if (!pPrt->PHWLinkUp &&
- (pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_PENDING)) {
-+
- RetCode = SkGmCableDiagStatus(pAC, IoC, PhysPortIndex, SK_FALSE);
-+
- if (RetCode == 0) {
-- pAC->Pnmi.VctStatus[PhysPortIndex] &= ~SK_PNMI_VCT_PENDING;
-- pAC->Pnmi.VctStatus[PhysPortIndex] |=
-- (SK_PNMI_VCT_NEW_VCT_DATA | SK_PNMI_VCT_TEST_DONE);
--
-- /* Copy results for later use to PNMI struct. */
-- for (i = 0; i < 4; i++) {
-- if (pPrt->PMdiPairSts[i] == SK_PNMI_VCT_NORMAL_CABLE) {
-- if ((pPrt->PMdiPairLen[i] > 35) && (pPrt->PMdiPairLen[i] < 0xff)) {
-- pPrt->PMdiPairSts[i] = SK_PNMI_VCT_IMPEDANCE_MISMATCH;
-- }
-- }
-- if ((pPrt->PMdiPairLen[i] > 35) && (pPrt->PMdiPairLen[i] != 0xff)) {
-- CableLength = 1000 * (((175 * pPrt->PMdiPairLen[i]) / 210) - 28);
-- }
-- else {
-- CableLength = 0;
-- }
-- pVctBackupData->PMdiPairLen[i] = CableLength;
-- pVctBackupData->PMdiPairSts[i] = pPrt->PMdiPairSts[i];
-- }
-+
-+ /* VCT test is finished, so save the data. */
-+ VctGetResults(pAC, IoC, PhysPortIndex);
-
- Para.Para32[0] = PhysPortIndex;
- Para.Para32[1] = -1;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, Para);
-- SkEventDispatcher(pAC, IoC);
-- }
-- else {
-- ; /* VCT test is running. */
-+
-+ /* SkEventDispatcher(pAC, IoC); */
- }
- }
--
-+
-+ /* Initialize backup data pointer. */
-+ pVctBackupData = &pAC->Pnmi.VctBackup[PhysPortIndex];
-+
- /* Get all results. */
- CheckVctStatus(pAC, IoC, pBuf, Offset, PhysPortIndex);
-- Offset += sizeof(SK_U8);
-+
-+ Offset++;
- *(pBuf + Offset) = pPrt->PCableLen;
-- Offset += sizeof(SK_U8);
-+ Offset++;
- for (i = 0; i < 4; i++) {
-- SK_PNMI_STORE_U32((pBuf + Offset), pVctBackupData->PMdiPairLen[i]);
-+
-+ SK_PNMI_STORE_U32((pBuf + Offset), pVctBackupData->MdiPairLen[i]);
- Offset += sizeof(SK_U32);
- }
- for (i = 0; i < 4; i++) {
-- *(pBuf + Offset) = pVctBackupData->PMdiPairSts[i];
-- Offset += sizeof(SK_U8);
-+
-+ *(pBuf + Offset) = pVctBackupData->MdiPairSts[i];
-+ Offset++;
- }
--
-+
- RetCode = SK_PNMI_ERR_OK;
- break;
--
-+
- case OID_SKGE_VCT_STATUS:
- CheckVctStatus(pAC, IoC, pBuf, Offset, PhysPortIndex);
-- Offset += sizeof(SK_U8);
-+
-+ Offset++;
- RetCode = SK_PNMI_ERR_OK;
- break;
--
-+
-+ case OID_SKGE_VCT_CAPABILITIES:
-+ if (pPrt->PhyType != SK_PHY_MARV_COPPER) {
-+ *(pBuf + Offset) = SK_PNMI_VCT_NOT_SUPPORTED;
-+ }
-+ else {
-+ *(pBuf + Offset) = SK_PNMI_VCT_SUPPORTED;
-+ }
-+ Offset++;
-+
-+ RetCode = SK_PNMI_ERR_OK;
-+ break;
-+
- default:
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -8136,15 +7980,15 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- } /* for */
- *pLen = Offset;
- return (RetCode);
--
-+
- } /* if SK_PNMI_GET */
--
-+
- /*
- * From here SET or PRESET action. Check if the passed
- * buffer length is plausible.
- */
--
-- /* Check length */
-+
-+ /* Check length. */
- switch (Id) {
- case OID_SKGE_VCT_SET:
- if (*pLen < (Limit - PhysPortIndex) * sizeof(SK_U32)) {
-@@ -8152,42 +7996,45 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- return (SK_PNMI_ERR_TOO_SHORT);
- }
- break;
--
-+
- default:
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
- }
--
-- /*
-- * Perform preset or set.
-- */
--
-+
-+ /* Perform PRESET or SET. */
-+
- /* VCT does not support PRESET action. */
- if (Action == SK_PNMI_PRESET) {
-+
- return (SK_PNMI_ERR_OK);
- }
--
-+
- Offset = 0;
- for (; PhysPortIndex < Limit; PhysPortIndex++) {
-+
-+ pPrt = &pAC->GIni.GP[PhysPortIndex];
-+
- switch (Id) {
- case OID_SKGE_VCT_SET: /* Start VCT test. */
-- if (Link == SK_FALSE) {
-+ if (!pPrt->PHWLinkUp) {
- SkGeStopPort(pAC, IoC, PhysPortIndex, SK_STOP_ALL, SK_SOFT_RST);
--
-+
- RetCode = SkGmCableDiagStatus(pAC, IoC, PhysPortIndex, SK_TRUE);
-+
- if (RetCode == 0) { /* RetCode: 0 => Start! */
- pAC->Pnmi.VctStatus[PhysPortIndex] |= SK_PNMI_VCT_PENDING;
-- pAC->Pnmi.VctStatus[PhysPortIndex] &= ~SK_PNMI_VCT_NEW_VCT_DATA;
-- pAC->Pnmi.VctStatus[PhysPortIndex] &= ~SK_PNMI_VCT_LINK;
--
-- /*
-- * Start VCT timer counter.
-- */
-- SK_MEMSET((char *) &Para, 0, sizeof(Para));
-+ pAC->Pnmi.VctStatus[PhysPortIndex] &=
-+ ~(SK_PNMI_VCT_NEW_VCT_DATA | SK_PNMI_VCT_LINK);
-+
-+ /* Start VCT timer counter. */
-+ SK_MEMSET((char *)&Para, 0, sizeof(Para));
- Para.Para32[0] = PhysPortIndex;
- Para.Para32[1] = -1;
-- SkTimerStart(pAC, IoC, &pAC->Pnmi.VctTimeout[PhysPortIndex].VctTimer,
-- 4000000, SKGE_PNMI, SK_PNMI_EVT_VCT_RESET, Para);
-+
-+ SkTimerStart(pAC, IoC, &pAC->Pnmi.VctTimeout[PhysPortIndex],
-+ SK_PNMI_VCT_TIMER_CHECK, SKGE_PNMI, SK_PNMI_EVT_VCT_RESET, Para);
-+
- SK_PNMI_STORE_U32((pBuf + Offset), RetCode);
- RetCode = SK_PNMI_ERR_OK;
- }
-@@ -8203,7 +8050,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- }
- Offset += sizeof(SK_U32);
- break;
--
-+
- default:
- *pLen = 0;
- return (SK_PNMI_ERR_GENERAL);
-@@ -8215,6 +8062,65 @@ SK_U32 NetIndex) /* NetIndex (0..n), in
- } /* Vct */
-
-
-+PNMI_STATIC void VctGetResults(
-+SK_AC *pAC,
-+SK_IOC IoC,
-+SK_U32 Port)
-+{
-+ SK_GEPORT *pPrt;
-+ int i;
-+ SK_U8 PairLen;
-+ SK_U8 PairSts;
-+ SK_U32 MinLength;
-+ SK_U32 CableLength;
-+
-+ pPrt = &pAC->GIni.GP[Port];
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+ MinLength = 25;
-+ }
-+ else {
-+ MinLength = 35;
-+ }
-+
-+ /* Copy results for later use to PNMI struct. */
-+ for (i = 0; i < 4; i++) {
-+
-+ PairLen = pPrt->PMdiPairLen[i];
-+
-+ if (((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) == 0) && (i > 1)) {
-+ PairSts = SK_PNMI_VCT_NOT_PRESENT;
-+ }
-+ else {
-+ PairSts = pPrt->PMdiPairSts[i];
-+ }
-+
-+ if ((PairSts == SK_PNMI_VCT_NORMAL_CABLE) &&
-+ (PairLen > 28) && (PairLen < 0xff)) {
-+
-+ PairSts = SK_PNMI_VCT_IMPEDANCE_MISMATCH;
-+ }
-+
-+ /* Ignore values <= MinLength, the linear factor is 4/5. */
-+ if ((PairLen > MinLength) && (PairLen < 0xff)) {
-+
-+ CableLength = 1000UL * (PairLen - MinLength) * 4 / 5;
-+ }
-+ else {
-+ /* No cable or short cable. */
-+ CableLength = 0;
-+ }
-+
-+ pAC->Pnmi.VctBackup[Port].MdiPairLen[i] = CableLength;
-+ pAC->Pnmi.VctBackup[Port].MdiPairSts[i] = PairSts;
-+ }
-+
-+ pAC->Pnmi.VctStatus[Port] &= ~SK_PNMI_VCT_PENDING;
-+ pAC->Pnmi.VctStatus[Port] |= (SK_PNMI_VCT_NEW_VCT_DATA |
-+ SK_PNMI_VCT_TEST_DONE);
-+
-+} /* GetVctResults */
-+
- PNMI_STATIC void CheckVctStatus(
- SK_AC *pAC,
- SK_IOC IoC,
-@@ -8224,54 +8130,57 @@ SK_U32 PhysPortIndex)
- {
- SK_GEPORT *pPrt;
- SK_PNMI_VCT *pVctData;
-+ SK_U8 VctStatus;
- SK_U32 RetCode;
--
-+
- pPrt = &pAC->GIni.GP[PhysPortIndex];
--
-+
- pVctData = (SK_PNMI_VCT *) (pBuf + Offset);
- pVctData->VctStatus = SK_PNMI_VCT_NONE;
--
-+
-+ VctStatus = pAC->Pnmi.VctStatus[PhysPortIndex];
-+
- if (!pPrt->PHWLinkUp) {
--
-+
- /* Was a VCT test ever made before? */
-- if (pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_TEST_DONE) {
-- if ((pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_LINK)) {
-+ if (VctStatus & SK_PNMI_VCT_TEST_DONE) {
-+ if (VctStatus & SK_PNMI_VCT_LINK) {
- pVctData->VctStatus |= SK_PNMI_VCT_OLD_VCT_DATA;
- }
- else {
- pVctData->VctStatus |= SK_PNMI_VCT_NEW_VCT_DATA;
- }
- }
--
-+
- /* Check VCT test status. */
- RetCode = SkGmCableDiagStatus(pAC,IoC, PhysPortIndex, SK_FALSE);
-+
- if (RetCode == 2) { /* VCT test is running. */
- pVctData->VctStatus |= SK_PNMI_VCT_RUNNING;
- }
- else { /* VCT data was copied to pAC here. Check PENDING state. */
-- if (pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_PENDING) {
-+ if (VctStatus & SK_PNMI_VCT_PENDING) {
- pVctData->VctStatus |= SK_PNMI_VCT_NEW_VCT_DATA;
- }
- }
--
-+
- if (pPrt->PCableLen != 0xff) { /* Old DSP value. */
- pVctData->VctStatus |= SK_PNMI_VCT_OLD_DSP_DATA;
- }
- }
- else {
--
- /* Was a VCT test ever made before? */
-- if (pAC->Pnmi.VctStatus[PhysPortIndex] & SK_PNMI_VCT_TEST_DONE) {
-+ if (VctStatus & SK_PNMI_VCT_TEST_DONE) {
- pVctData->VctStatus &= ~SK_PNMI_VCT_NEW_VCT_DATA;
- pVctData->VctStatus |= SK_PNMI_VCT_OLD_VCT_DATA;
- }
--
-+
- /* DSP only valid in 100/1000 modes. */
-- if (pAC->GIni.GP[PhysPortIndex].PLinkSpeedUsed !=
-- SK_LSPEED_STAT_10MBPS) {
-+ if (pPrt->PLinkSpeedUsed != SK_LSPEED_STAT_10MBPS) {
- pVctData->VctStatus |= SK_PNMI_VCT_NEW_DSP_DATA;
- }
- }
-+
- } /* CheckVctStatus */
-
-
-@@ -8314,29 +8223,29 @@ int HeaderLength; /* Length of desired
- ReturnCode = SK_PNMI_ERR_GENERAL;
-
- SK_MEMCPY(&Mode, pBuf, sizeof(SK_I32));
-- SK_MEMCPY(&Oid, (char *) pBuf + sizeof(SK_I32), sizeof(SK_U32));
-+ SK_MEMCPY(&Oid, (char *)pBuf + sizeof(SK_I32), sizeof(SK_U32));
- HeaderLength = sizeof(SK_I32) + sizeof(SK_U32);
- *pLen = *pLen - HeaderLength;
-- SK_MEMCPY((char *) pBuf + sizeof(SK_I32), (char *) pBuf + HeaderLength, *pLen);
-+ SK_MEMCPY((char *)pBuf + sizeof(SK_I32), (char *)pBuf + HeaderLength, *pLen);
-
- switch(Mode) {
- case SK_GET_SINGLE_VAR:
-- ReturnCode = SkPnmiGetVar(pAC, IoC, Oid,
-- (char *) pBuf + sizeof(SK_I32), pLen,
-+ ReturnCode = SkPnmiGetVar(pAC, IoC, Oid,
-+ (char *)pBuf + sizeof(SK_I32), pLen,
- ((SK_U32) (-1)), NetIndex);
- SK_PNMI_STORE_U32(pBuf, ReturnCode);
- *pLen = *pLen + sizeof(SK_I32);
- break;
- case SK_PRESET_SINGLE_VAR:
-- ReturnCode = SkPnmiPreSetVar(pAC, IoC, Oid,
-- (char *) pBuf + sizeof(SK_I32), pLen,
-+ ReturnCode = SkPnmiPreSetVar(pAC, IoC, Oid,
-+ (char *)pBuf + sizeof(SK_I32), pLen,
- ((SK_U32) (-1)), NetIndex);
- SK_PNMI_STORE_U32(pBuf, ReturnCode);
- *pLen = *pLen + sizeof(SK_I32);
- break;
- case SK_SET_SINGLE_VAR:
-- ReturnCode = SkPnmiSetVar(pAC, IoC, Oid,
-- (char *) pBuf + sizeof(SK_I32), pLen,
-+ ReturnCode = SkPnmiSetVar(pAC, IoC, Oid,
-+ (char *)pBuf + sizeof(SK_I32), pLen,
- ((SK_U32) (-1)), NetIndex);
- SK_PNMI_STORE_U32(pBuf, ReturnCode);
- *pLen = *pLen + sizeof(SK_I32);
-@@ -8357,3 +8266,86 @@ int HeaderLength; /* Length of desired
- return (ReturnCode);
-
- } /* SkGeIocGen */
-+
-+#ifdef SK_ASF
-+/*****************************************************************************
-+ *
-+ * Asf
-+ *
-+ * Description:
-+ * The code is simple. No description necessary.
-+ *
-+ * Returns:
-+ * SK_PNMI_ERR_OK The request was successfully performed.
-+ * SK_PNMI_ERR_GENERAL A general severe internal error occured.
-+ * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain
-+ * the correct data (e.g. a 32bit value is
-+ * needed, but a 16 bit value was passed).
-+ * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't
-+ * exist (e.g. port instance 3 on a two port
-+ * adapter.
-+ */
-+
-+PNMI_STATIC int Asf(
-+SK_AC *pAC, /* Pointer to adapter context */
-+SK_IOC IoC, /* IO context handle */
-+int Action, /* GET/PRESET/SET action */
-+SK_U32 Id, /* Object ID that is to be processed */
-+char *pBuf, /* Buffer used for the management data transfer */
-+unsigned int *pLen, /* On call: pBuf buffer length. On return: used buffer */
-+SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */
-+unsigned int TableIndex, /* Index to the Id table */
-+SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
-+{
-+ SK_U32 RetCode = SK_PNMI_ERR_GENERAL;
-+
-+ /*
-+ * Check instance. We only handle single instance variables.
-+ */
-+ if (Instance != (SK_U32)(-1) && Instance != 1) {
-+
-+ *pLen = 0;
-+ return (SK_PNMI_ERR_UNKNOWN_INST);
-+ }
-+
-+ /* Perform action. */
-+ /* GET value. */
-+ if (Action == SK_PNMI_GET) {
-+ switch (Id) {
-+ case OID_SKGE_ASF:
-+ RetCode = SkAsfGet(pAC, IoC, (SK_U8 *) pBuf, pLen);
-+ break;
-+ default:
-+ RetCode = SkAsfGetOid( pAC, IoC, Id, Instance, (SK_U8 *) pBuf, pLen );
-+ break;
-+ }
-+
-+ return (RetCode);
-+ }
-+
-+ /* PRESET value. */
-+ if (Action == SK_PNMI_PRESET) {
-+ switch (Id) {
-+ case OID_SKGE_ASF:
-+ RetCode = SkAsfPreSet(pAC, IoC, (SK_U8 *) pBuf, pLen);
-+ break;
-+ default:
-+ RetCode = SkAsfPreSetOid( pAC, IoC, Id, Instance, (SK_U8 *) pBuf, pLen );
-+ break;
-+ }
-+ }
-+
-+ /* SET value. */
-+ if (Action == SK_PNMI_SET) {
-+ switch (Id) {
-+ case OID_SKGE_ASF:
-+ RetCode = SkAsfSet(pAC, IoC, (SK_U8 *) pBuf, pLen);
-+ break;
-+ default:
-+ RetCode = SkAsfSetOid( pAC, IoC, Id, Instance, (SK_U8 *) pBuf, pLen );
-+ break;
-+ }
-+ }
-+ return (RetCode);
-+}
-+#endif /* SK_ASF */
-diff -Nurap ./drivers/net/sk98lin.sk98/skgesirq.c ./drivers/net/sk98lin/skgesirq.c
---- ./drivers/net/sk98lin.sk98/skgesirq.c 2004-10-19 01:53:06.000000000 +0400
-+++ ./drivers/net/sk98lin/skgesirq.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skgesirq.c
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.92 $
-- * Date: $Date: 2003/09/16 14:37:07 $
-+ * Version: $Revision: 2.26 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Special IRQ module
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -38,7 +39,7 @@
- * right after this ISR.
- *
- * The Interrupt source register of the adapter is NOT read by this module.
-- * SO if the drivers implementor needs a while loop around the
-+ * SO if the drivers implementor needs a while loop around the
- * slow data paths interrupt bits, he needs to call the SkGeSirqIsr() for
- * each loop entered.
- *
-@@ -46,11 +47,6 @@
- *
- */
-
--#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
--static const char SysKonnectFileId[] =
-- "@(#) $Id: skgesirq.c,v 1.92 2003/09/16 14:37:07 rschmidt Exp $ (C) Marvell.";
--#endif
--
- #include "h/skdrv1st.h" /* Driver Specific Definitions */
- #ifndef SK_SLIM
- #include "h/skgepnmi.h" /* PNMI Definitions */
-@@ -58,6 +54,13 @@ static const char SysKonnectFileId[] =
- #endif
- #include "h/skdrv2nd.h" /* Adapter Control and Driver specific Def. */
-
-+/* local variables ************************************************************/
-+
-+#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
-+static const char SysKonnectFileId[] =
-+ "@(#) $Id: skgesirq.c,v 2.26 2005/12/14 16:11:35 ibrueder Exp $ (C) Marvell.";
-+#endif
-+
- /* local function prototypes */
- #ifdef GENESIS
- static int SkGePortCheckUpXmac(SK_AC*, SK_IOC, int, SK_BOOL);
-@@ -86,7 +89,7 @@ static const SK_U16 SkGeRxRegs[]= {
- XM_RXF_511B,
- XM_RXF_1023B,
- XM_RXF_MAX_SZ
--} ;
-+};
- #endif /* GENESIS */
-
- #ifdef __C2MAN__
-@@ -109,8 +112,8 @@ intro()
- * Returns: N/A
- */
- static void SkHWInitDefSense(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -119,7 +122,7 @@ int Port) /* Port Index (MAC_1 + n) */
-
- pPrt->PAutoNegTimeOut = 0;
-
-- if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) {
-+ if (pPrt->PLinkModeConf != (SK_U8)SK_LMODE_AUTOSENSE) {
- pPrt->PLinkMode = pPrt->PLinkModeConf;
- return;
- }
-@@ -145,8 +148,8 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- */
- static SK_U8 SkHWSenseGetNext(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -155,18 +158,18 @@ int Port) /* Port Index (MAC_1 + n) */
-
- pPrt->PAutoNegTimeOut = 0;
-
-- if (pPrt->PLinkModeConf != (SK_U8)SK_LMODE_AUTOSENSE) {
-+ if (pPrt->PLinkModeConf != (SK_U8)SK_LMODE_AUTOSENSE) {
- /* Leave all as configured */
- return(pPrt->PLinkModeConf);
- }
-
-- if (pPrt->PLinkMode == (SK_U8)SK_LMODE_AUTOFULL) {
-+ if (pPrt->PLinkMode == (SK_U8)SK_LMODE_AUTOFULL) {
- /* Return next mode AUTOBOTH */
-- return ((SK_U8)SK_LMODE_AUTOBOTH);
-+ return((SK_U8)SK_LMODE_AUTOBOTH);
- }
-
- /* Return default autofull */
-- return ((SK_U8)SK_LMODE_AUTOFULL);
-+ return((SK_U8)SK_LMODE_AUTOFULL);
- } /* SkHWSenseGetNext */
-
-
-@@ -179,8 +182,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * Returns: N/A
- */
- static void SkHWSenseSetNext(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_U8 NewMode) /* New Mode to be written in sense mode */
- {
-@@ -190,7 +193,7 @@ SK_U8 NewMode) /* New Mode to be written
-
- pPrt->PAutoNegTimeOut = 0;
-
-- if (pPrt->PLinkModeConf != (SK_U8)SK_LMODE_AUTOSENSE) {
-+ if (pPrt->PLinkModeConf != (SK_U8)SK_LMODE_AUTOSENSE) {
- return;
- }
-
-@@ -214,8 +217,8 @@ SK_U8 NewMode) /* New Mode to be written
- * Returns: N/A
- */
- void SkHWLinkDown(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -227,11 +230,11 @@ int Port) /* Port Index (MAC_1 + n) */
-
- /* Disable Receiver and Transmitter */
- SkMacRxTxDisable(pAC, IoC, Port);
--
-+
- /* Init default sense mode */
- SkHWInitDefSense(pAC, IoC, Port);
-
-- if (pPrt->PHWLinkUp == SK_FALSE) {
-+ if (!pPrt->PHWLinkUp) {
- return;
- }
-
-@@ -241,10 +244,12 @@ int Port) /* Port Index (MAC_1 + n) */
- /* Set Link to DOWN */
- pPrt->PHWLinkUp = SK_FALSE;
-
-+#ifndef SK_SLIM
- /* Reset Port stati */
-- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
-- pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE;
-+ pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
-+ pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE;
- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_INDETERMINATED;
-+#endif /* !SK_SLIM */
-
- /* Re-init Phy especially when the AutoSense default is set now */
- SkMacInitPhy(pAC, IoC, Port, SK_FALSE);
-@@ -266,8 +271,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * Returns: N/A
- */
- void SkHWLinkUp(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -280,12 +285,14 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- pPrt->PHWLinkUp = SK_TRUE;
-+
-+#ifndef SK_SLIM
- pPrt->PAutoNegFail = SK_FALSE;
-- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
-+ pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
-
-- if (pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOHALF &&
-- pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOFULL &&
-- pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOBOTH) {
-+ if (pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOHALF &&
-+ pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOFULL &&
-+ pPrt->PLinkMode != (SK_U8)SK_LMODE_AUTOBOTH) {
- /* Link is up and no Auto-negotiation should be done */
-
- /* Link speed should be the configured one */
-@@ -293,7 +300,9 @@ int Port) /* Port Index (MAC_1 + n) */
- case SK_LSPEED_AUTO:
- /* default is 1000 Mbps */
- case SK_LSPEED_1000MBPS:
-- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
-+ pPrt->PLinkSpeedUsed =
-+ (SK_U8)((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) ?
-+ SK_LSPEED_STAT_1000MBPS : SK_LSPEED_STAT_100MBPS;
- break;
- case SK_LSPEED_100MBPS:
- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_100MBPS;
-@@ -304,19 +313,22 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- /* Set Link Mode Status */
-- if (pPrt->PLinkMode == SK_LMODE_FULL) {
-+ if (pPrt->PLinkMode == (SK_U8)SK_LMODE_FULL) {
- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_FULL;
- }
- else {
-- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_HALF;
-+ pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_HALF;
- }
-
- /* No flow control without auto-negotiation */
-- pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE;
-+ pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE;
-+#endif /* !SK_SLIM */
-
- /* enable Rx/Tx */
-- (void)SkMacRxTxEnable(pAC, IoC, Port);
-+ (void)SkMacRxTxEnable(pAC, IoC, Port);
-+#ifndef SK_SLIM
- }
-+#endif /* !SK_SLIM */
- } /* SkHWLinkUp */
-
-
-@@ -329,14 +341,16 @@ int Port) /* Port Index (MAC_1 + n) */
- * Returns: N/A
- */
- static void SkMacParity(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
--int Port) /* Port Index of the port failed */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
-+int Port) /* Port Index (MAC_1 + n) */
- {
- SK_EVPARA Para;
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
- SK_U32 TxMax; /* Tx Max Size Counter */
-
-+ TxMax = 0;
-+
- pPrt = &pAC->GIni.GP[Port];
-
- /* Clear IRQ Tx Parity Error */
-@@ -346,7 +360,7 @@ int Port) /* Port Index of the port fai
- SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_CLR_PERR);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */
-@@ -355,7 +369,7 @@ int Port) /* Port Index of the port fai
- pAC->GIni.GIChipRev == 0) ? GMF_CLI_TX_FC : GMF_CLI_TX_PE));
- }
- #endif /* YUKON */
--
-+
- if (pPrt->PCheckPar) {
-
- if (Port == MAC_1) {
-@@ -366,7 +380,7 @@ int Port) /* Port Index of the port fai
- }
- Para.Para64 = Port;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
--
-+
- Para.Para32[0] = Port;
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
-
-@@ -378,18 +392,18 @@ int Port) /* Port Index of the port fai
- if (pAC->GIni.GIGenesis) {
- /* Snap statistic counters */
- (void)SkXmUpdateStats(pAC, IoC, Port);
--
-+
- (void)SkXmMacStatistic(pAC, IoC, Port, XM_TXF_MAX_SZ, &TxMax);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
-
- (void)SkGmMacStatistic(pAC, IoC, Port, GM_TXF_1518B, &TxMax);
- }
- #endif /* YUKON */
--
-+
- if (TxMax > 0) {
- /* From now on check the parity */
- pPrt->PCheckPar = SK_TRUE;
-@@ -399,15 +413,15 @@ int Port) /* Port Index of the port fai
-
- /******************************************************************************
- *
-- * SkGeHwErr() - Hardware Error service routine
-+ * SkGeYuHwErr() - Hardware Error service routine (Genesis and Yukon)
- *
- * Description: handles all HW Error interrupts
- *
- * Returns: N/A
- */
--static void SkGeHwErr(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+static void SkGeYuHwErr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
- SK_U32 HwStatus) /* Interrupt status word */
- {
- SK_EVPARA Para;
-@@ -423,10 +437,10 @@ SK_U32 HwStatus) /* Interrupt status wor
- }
-
- /* Reset all bits in the PCI STATUS register */
-- SK_IN16(IoC, PCI_C(PCI_STATUS), &Word);
--
-+ SK_IN16(IoC, PCI_C(pAC, PCI_STATUS), &Word);
-+
- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-- SK_OUT16(IoC, PCI_C(PCI_STATUS), (SK_U16)(Word | PCI_ERRBITS));
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_STATUS), (SK_U16)(Word | PCI_ERRBITS));
- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-
- Para.Para64 = 0;
-@@ -461,7 +475,7 @@ SK_U32 HwStatus) /* Interrupt status wor
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* This is necessary only for Rx timing measurements */
-@@ -484,14 +498,18 @@ SK_U32 HwStatus) /* Interrupt status wor
- #endif /* YUKON */
-
- if ((HwStatus & IS_RAM_RD_PAR) != 0) {
-+
- SK_OUT16(IoC, B3_RI_CTRL, RI_CLR_RD_PERR);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E014, SKERR_SIRQ_E014MSG);
- Para.Para64 = 0;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para);
- }
-
- if ((HwStatus & IS_RAM_WR_PAR) != 0) {
-+
- SK_OUT16(IoC, B3_RI_CTRL, RI_CLR_WR_PERR);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E015, SKERR_SIRQ_E015MSG);
- Para.Para64 = 0;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para);
-@@ -512,7 +530,7 @@ SK_U32 HwStatus) /* Interrupt status wor
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E018, SKERR_SIRQ_E018MSG);
- Para.Para64 = MAC_1;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
--
-+
- Para.Para32[0] = MAC_1;
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
- }
-@@ -524,37 +542,288 @@ SK_U32 HwStatus) /* Interrupt status wor
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E019, SKERR_SIRQ_E019MSG);
- Para.Para64 = MAC_2;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
--
-+
- Para.Para32[0] = MAC_2;
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
- }
--} /* SkGeHwErr */
-+} /* SkGeYuHwErr */
-+
-+#ifdef YUK2
-+/******************************************************************************
-+ *
-+ * SkYuk2HwPortErr() - Service HW Errors for specified port (Yukon-2 only)
-+ *
-+ * Description: handles the HW Error interrupts for a specific port.
-+ *
-+ * Returns: N/A
-+ */
-+static void SkYuk2HwPortErr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 HwStatus, /* Interrupt status word */
-+int Port) /* Port Index (MAC_1 + n) */
-+{
-+ SK_EVPARA Para;
-+ int Queue;
-+
-+ if (Port == MAC_2) {
-+ HwStatus >>= 8;
-+ }
-+
-+ if ((HwStatus & Y2_HWE_L1_MASK) == 0) {
-+ return;
-+ }
-
-+ if ((HwStatus & Y2_IS_PAR_RD1) != 0) {
-+ /* Clear IRQ */
-+ SK_OUT16(IoC, SELECT_RAM_BUFFER(Port, B3_RI_CTRL), RI_CLR_RD_PERR);
-+
-+ if (Port == MAC_1) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E028, SKERR_SIRQ_E028MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E030, SKERR_SIRQ_E030MSG);
-+ }
-+ }
-+
-+ if ((HwStatus & Y2_IS_PAR_WR1) != 0) {
-+ /* Clear IRQ */
-+ SK_OUT16(IoC, SELECT_RAM_BUFFER(Port, B3_RI_CTRL), RI_CLR_WR_PERR);
-+
-+ if (Port == MAC_1) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E029, SKERR_SIRQ_E029MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E031, SKERR_SIRQ_E031MSG);
-+ }
-+ }
-+
-+ if ((HwStatus & Y2_IS_PAR_MAC1) != 0) {
-+ /* Clear IRQ */
-+ SK_OUT8(IoC, MR_ADDR(Port, TX_GMF_CTRL_T), GMF_CLI_TX_PE);
-+
-+ if (Port == MAC_1) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E016, SKERR_SIRQ_E016MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E017, SKERR_SIRQ_E017MSG);
-+ }
-+ }
-+
-+ if ((HwStatus & Y2_IS_PAR_RX1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_R1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E018, SKERR_SIRQ_E018MSG);
-+ }
-+ else {
-+ Queue = Q_R2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E019, SKERR_SIRQ_E019MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_PAR);
-+ }
-+
-+ if ((HwStatus & Y2_IS_TCP_TXS1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_XS1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E033, SKERR_SIRQ_E033MSG);
-+ }
-+ else {
-+ Queue = Q_XS2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E035, SKERR_SIRQ_E035MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_TCP);
-+ }
-+
-+ if ((HwStatus & Y2_IS_TCP_TXA1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_XA1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E032, SKERR_SIRQ_E032MSG);
-+ }
-+ else {
-+ Queue = Q_XA2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E034, SKERR_SIRQ_E034MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_TCP);
-+ }
-+
-+ Para.Para64 = Port;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
-+
-+ Para.Para32[0] = Port;
-+ SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
-+
-+} /* SkYuk2HwPortErr */
-
- /******************************************************************************
- *
-- * SkGeSirqIsr() - Special Interrupt Service Routine
-+ * SkYuk2HwErr() - Hardware Error service routine (Yukon-2 only)
- *
-- * Description: handles all non data transfer specific interrupts (slow path)
-+ * Description: handles all HW Error interrupts
-+ *
-+ * Returns: N/A
-+ */
-+static void SkYuk2HwErr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 HwStatus) /* Interrupt status word */
-+{
-+ SK_EVPARA Para;
-+ SK_U16 Word;
-+ SK_U32 DWord;
-+ SK_U32 TlpHead[4];
-+ int i;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ ("HW-Error Status: 0x%08lX\n", HwStatus));
-+
-+ /* This is necessary only for Rx timing measurements */
-+ if ((HwStatus & Y2_IS_TIST_OV) != 0) {
-+ /* increment Time Stamp Timer counter (high) */
-+ pAC->GIni.GITimeStampCnt++;
-+
-+ /* Clear Time Stamp Timer IRQ */
-+ SK_OUT8(IoC, GMAC_TI_ST_CTRL, (SK_U8)GMT_ST_CLR_IRQ);
-+ }
-+
-+ /* Evaluate Y2_IS_PCI_NEXP before Y2_IS_MST_ERR or Y2_IS_IRQ_STAT */
-+ if ((HwStatus & Y2_IS_PCI_NEXP) != 0) {
-+ /*
-+ * This error is also mapped either to Master Abort (Y2_IS_MST_ERR)
-+ * or Target Abort (Y2_IS_IRQ_STAT) bit and can only be cleared there.
-+ * Therefore handle this event just by printing an error log entry.
-+ */
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E027, SKERR_SIRQ_E027MSG);
-+ }
-+
-+ if ((HwStatus & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) != 0) {
-+ /* PCI Errors occured */
-+ if ((HwStatus & Y2_IS_IRQ_STAT) != 0) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E013, SKERR_SIRQ_E013MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E012, SKERR_SIRQ_E012MSG);
-+ }
-+
-+ /* Reset all bits in the PCI STATUS register */
-+ SK_IN16(IoC, PCI_C(pAC, PCI_STATUS), &Word);
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_STATUS), (SK_U16)(Word | PCI_ERRBITS));
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+
-+ Para.Para64 = 0;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para);
-+ }
-+
-+ /* check for PCI-Express Uncorrectable Error */
-+ if ((HwStatus & Y2_IS_PCI_EXP) != 0) {
-+ /*
-+ * On PCI-Express bus bridges are called root complexes (RC).
-+ * PCI-Express errors are recognized by the root complex too,
-+ * which requests the system to handle the problem. After error
-+ * occurence it may be that no access to the adapter may be performed
-+ * any longer.
-+ */
-+
-+ /* Get uncorrectable error status */
-+ SK_IN32(IoC, PCI_C(pAC, PEX_UNC_ERR_STAT), &DWord);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ ("PEX Uncorr.Error Status: 0x%08lX\n", DWord));
-+
-+ if (DWord != PEX_UNSUP_REQ) {
-+ /* ignore Unsupported Request Errors */
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E026, SKERR_SIRQ_E026MSG);
-+ }
-+
-+ if ((DWord & (PEX_FATAL_ERRORS | PEX_POIS_TLP)) != 0) {
-+ /*
-+ * Stop only, if the uncorrectable error is fatal or
-+ * Poisoned TLP occured
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ, ("Header Log:"));
-+
-+ for (i = 0; i < 4; i++) {
-+ /* get TLP Header from Log Registers */
-+ SK_IN32(IoC, PCI_C(pAC, PEX_HEADER_LOG + i*4), &TlpHead[i]);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ (" 0x%08lX", TlpHead[i]));
-+ }
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ, ("\n"));
-+
-+ /* check for vendor defined broadcast message */
-+ if (TlpHead[0] == 0x73004001 && (SK_U8)TlpHead[1] == 0x7f) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ ("Vendor defined broadcast message\n"));
-+ }
-+ else {
-+ Para.Para64 = 0;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para);
-+
-+ pAC->GIni.GIValHwIrqMask &= ~Y2_IS_PCI_EXP;
-+ /* Rewrite HW IRQ mask */
-+ SK_OUT32(IoC, B0_HWE_IMSK, pAC->GIni.GIValHwIrqMask);
-+ }
-+ }
-+ /* clear the interrupt */
-+ SK_OUT32(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+ SK_OUT32(IoC, PCI_C(pAC, PEX_UNC_ERR_STAT), 0xffffffffUL);
-+ SK_OUT32(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+ }
-+
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+
-+ SkYuk2HwPortErr(pAC, IoC, HwStatus, i);
-+ }
-+
-+} /* SkYuk2HwErr */
-+#endif /* YUK2 */
-+
-+/******************************************************************************
-+ *
-+ * SkGeSirqIsr() - Wrapper for Special Interrupt Service Routine
-+ *
-+ * Description: calls the preselected special ISR (slow path)
- *
- * Returns: N/A
- */
- void SkGeSirqIsr(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O context */
-+SK_U32 Istatus) /* Interrupt status word */
-+{
-+ pAC->GIni.GIFunc.pSkGeSirqIsr(pAC, IoC, Istatus);
-+}
-+
-+/******************************************************************************
-+ *
-+ * SkGeYuSirqIsr() - Special Interrupt Service Routine
-+ *
-+ * Description: handles all non data transfer specific interrupts (slow path)
-+ *
-+ * Returns: N/A
-+ */
-+void SkGeYuSirqIsr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- SK_U32 Istatus) /* Interrupt status word */
- {
- SK_EVPARA Para;
- SK_U32 RegVal32; /* Read register value */
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-- SK_U16 PhyInt;
-+ SK_U16 PhyInt;
- int i;
-
- if (((Istatus & IS_HW_ERR) & pAC->GIni.GIValIrqMask) != 0) {
- /* read the HW Error Interrupt source */
- SK_IN32(IoC, B0_HWE_ISRC, &RegVal32);
--
-- SkGeHwErr(pAC, IoC, RegVal32);
-+
-+ SkGeYuHwErr(pAC, IoC, RegVal32);
- }
-
- /*
-@@ -569,7 +838,7 @@ SK_U32 Istatus) /* Interrupt status word
- }
-
- if (((Istatus & (IS_PA_TO_RX2 | IS_PA_TO_TX2)) != 0) &&
-- pAC->GIni.GP[MAC_2].PState == SK_PRT_RESET) {
-+ pAC->GIni.GP[MAC_2].PState == SK_PRT_RESET) {
- /* MAC 2 was not initialized but Packet timeout occured */
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E005,
- SKERR_SIRQ_E005MSG);
-@@ -590,8 +859,8 @@ SK_U32 Istatus) /* Interrupt status word
- }
-
- if ((Istatus & IS_PA_TO_TX1) != 0) {
--
-- pPrt = &pAC->GIni.GP[0];
-+
-+ pPrt = &pAC->GIni.GP[MAC_1];
-
- /* May be a normal situation in a server with a slow network */
- SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_TX1);
-@@ -612,25 +881,18 @@ SK_U32 Istatus) /* Interrupt status word
- * we ignore those
- */
- pPrt->HalfDupTimerActive = SK_TRUE;
--#ifdef XXX
-- Len = sizeof(SK_U64);
-- SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets,
-- &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, 0),
-- pAC->Rlmt.Port[0].Net->NetNumber);
--
-- pPrt->LastOctets = Octets;
--#endif /* XXX */
-+
- /* Snap statistic counters */
- (void)SkXmUpdateStats(pAC, IoC, 0);
-
- (void)SkXmMacStatistic(pAC, IoC, 0, XM_TXO_OK_HI, &RegVal32);
-
- pPrt->LastOctets = (SK_U64)RegVal32 << 32;
--
-+
- (void)SkXmMacStatistic(pAC, IoC, 0, XM_TXO_OK_LO, &RegVal32);
-
- pPrt->LastOctets += RegVal32;
--
-+
- Para.Para32[0] = 0;
- SkTimerStart(pAC, IoC, &pPrt->HalfDupChkTimer, SK_HALFDUP_CHK_TIME,
- SKGE_HWAC, SK_HWEV_HALFDUP_CHK, Para);
-@@ -640,8 +902,8 @@ SK_U32 Istatus) /* Interrupt status word
- }
-
- if ((Istatus & IS_PA_TO_TX2) != 0) {
--
-- pPrt = &pAC->GIni.GP[1];
-+
-+ pPrt = &pAC->GIni.GP[MAC_2];
-
- /* May be a normal situation in a server with a slow network */
- SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_TX2);
-@@ -653,25 +915,18 @@ SK_U32 Istatus) /* Interrupt status word
- pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) &&
- !pPrt->HalfDupTimerActive) {
- pPrt->HalfDupTimerActive = SK_TRUE;
--#ifdef XXX
-- Len = sizeof(SK_U64);
-- SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets,
-- &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, 1),
-- pAC->Rlmt.Port[1].Net->NetNumber);
--
-- pPrt->LastOctets = Octets;
--#endif /* XXX */
-+
- /* Snap statistic counters */
- (void)SkXmUpdateStats(pAC, IoC, 1);
-
- (void)SkXmMacStatistic(pAC, IoC, 1, XM_TXO_OK_HI, &RegVal32);
-
- pPrt->LastOctets = (SK_U64)RegVal32 << 32;
--
-+
- (void)SkXmMacStatistic(pAC, IoC, 1, XM_TXO_OK_LO, &RegVal32);
-
- pPrt->LastOctets += RegVal32;
--
-+
- Para.Para32[0] = 1;
- SkTimerStart(pAC, IoC, &pPrt->HalfDupChkTimer, SK_HALFDUP_CHK_TIME,
- SKGE_HWAC, SK_HWEV_HALFDUP_CHK, Para);
-@@ -684,6 +939,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_R1_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_R1_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E006,
- SKERR_SIRQ_E006MSG);
- Para.Para64 = MAC_1;
-@@ -695,6 +951,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_R2_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_R2_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E007,
- SKERR_SIRQ_E007MSG);
- Para.Para64 = MAC_2;
-@@ -706,6 +963,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_XS1_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_XS1_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E008,
- SKERR_SIRQ_E008MSG);
- Para.Para64 = MAC_1;
-@@ -717,6 +975,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_XA1_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_XA1_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E009,
- SKERR_SIRQ_E009MSG);
- Para.Para64 = MAC_1;
-@@ -728,6 +987,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_XS2_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_XS2_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E010,
- SKERR_SIRQ_E010MSG);
- Para.Para64 = MAC_2;
-@@ -739,6 +999,7 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_XA2_C) != 0) {
- /* Clear IRQ */
- SK_OUT32(IoC, B0_XA2_CSR, CSR_IRQ_CL_C);
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E011,
- SKERR_SIRQ_E011MSG);
- Para.Para64 = MAC_2;
-@@ -751,39 +1012,37 @@ SK_U32 Istatus) /* Interrupt status word
- if ((Istatus & IS_EXT_REG) != 0) {
- /* Test IRQs from PHY */
- for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
--
-+
- pPrt = &pAC->GIni.GP[i];
--
-+
- if (pPrt->PState == SK_PRT_RESET) {
- continue;
- }
--
-+
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- switch (pPrt->PhyType) {
--
-+
- case SK_PHY_XMAC:
- break;
--
-+
- case SK_PHY_BCOM:
- SkXmPhyRead(pAC, IoC, i, PHY_BCOM_INT_STAT, &PhyInt);
--
-+
- if ((PhyInt & ~PHY_B_DEF_MSK) != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-- ("Port %d Bcom Int: 0x%04X\n",
-- i, PhyInt));
-+ ("Port %d PHY Int: 0x%04X\n", i, PhyInt));
- SkPhyIsrBcom(pAC, IoC, i, PhyInt);
- }
- break;
- #ifdef OTHER_PHY
- case SK_PHY_LONE:
- SkXmPhyRead(pAC, IoC, i, PHY_LONE_INT_STAT, &PhyInt);
--
-+
- if ((PhyInt & PHY_L_DEF_MSK) != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-- ("Port %d Lone Int: %x\n",
-- i, PhyInt));
-+ ("Port %d PHY Int: 0x%04X\n", i, PhyInt));
- SkPhyIsrLone(pAC, IoC, i, PhyInt);
- }
- break;
-@@ -791,7 +1050,7 @@ SK_U32 Istatus) /* Interrupt status word
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* Read PHY Interrupt Status */
-@@ -799,8 +1058,7 @@ SK_U32 Istatus) /* Interrupt status word
-
- if ((PhyInt & PHY_M_DEF_MSK) != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-- ("Port %d Marv Int: 0x%04X\n",
-- i, PhyInt));
-+ ("Port %d PHY Int: 0x%04X\n", i, PhyInt));
- SkPhyIsrGmac(pAC, IoC, i, PhyInt);
- }
- }
-@@ -808,13 +1066,13 @@ SK_U32 Istatus) /* Interrupt status word
- }
- }
-
-- /* I2C Ready interrupt */
-+ /* TWSI Ready interrupt */
- if ((Istatus & IS_I2C_READY) != 0) {
- #ifdef SK_SLIM
-- SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
--#else
-+ SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-+#else
- SkI2cIsr(pAC, IoC);
--#endif
-+#endif
- }
-
- /* SW forced interrupt */
-@@ -829,7 +1087,7 @@ SK_U32 Istatus) /* Interrupt status word
- * us only a link going down.
- */
- /* clear interrupt */
-- SK_OUT8(IoC, MR_ADDR(MAC_1, LNK_SYNC_CTRL), LED_CLR_IRQ);
-+ SK_OUT8(IoC, MR_ADDR(MAC_1, LNK_SYNC_CTRL), LNK_CLR_IRQ);
- }
-
- /* Check MAC after link sync counter */
-@@ -844,7 +1102,7 @@ SK_U32 Istatus) /* Interrupt status word
- * us only a link going down.
- */
- /* clear interrupt */
-- SK_OUT8(IoC, MR_ADDR(MAC_2, LNK_SYNC_CTRL), LED_CLR_IRQ);
-+ SK_OUT8(IoC, MR_ADDR(MAC_2, LNK_SYNC_CTRL), LNK_CLR_IRQ);
- }
-
- /* Check MAC after link sync counter */
-@@ -860,13 +1118,189 @@ SK_U32 Istatus) /* Interrupt status word
- /* read the HW Error Interrupt source */
- SK_IN32(IoC, B0_HWE_ISRC, &RegVal32);
-
-- SkGeHwErr(pAC, IoC, RegVal32);
-+ SkGeYuHwErr(pAC, IoC, RegVal32);
-+ }
-+
-+ SkHwtIsr(pAC, IoC);
-+ }
-+
-+} /* SkGeYuSirqIsr */
-+
-+#ifdef YUK2
-+/******************************************************************************
-+ *
-+ * SkYuk2PortSirq() - Service HW Errors for specified port (Yukon-2 only)
-+ *
-+ * Description: handles the HW Error interrupts for a specific port.
-+ *
-+ * Returns: N/A
-+ */
-+static void SkYuk2PortSirq(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 IStatus, /* Interrupt status word */
-+int Port) /* Port Index (MAC_1 + n) */
-+{
-+ SK_EVPARA Para;
-+ int Queue;
-+ SK_U16 PhyInt;
-+
-+ if (Port == MAC_2) {
-+ IStatus >>= 8;
-+ }
-+
-+ /* Interrupt from PHY */
-+ if ((IStatus & Y2_IS_IRQ_PHY1) != 0) {
-+ /* Read PHY Interrupt Status */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_INT_STAT, &PhyInt);
-+
-+ if ((PhyInt & PHY_M_DEF_MSK) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ ("Port %d PHY Int: 0x%04X\n", Port, PhyInt));
-+ SkPhyIsrGmac(pAC, IoC, Port, PhyInt);
-+ }
-+ }
-+
-+ /* Interrupt from MAC */
-+ if ((IStatus & Y2_IS_IRQ_MAC1) != 0) {
-+ SkMacIrq(pAC, IoC, Port);
-+ }
-+
-+ if ((IStatus & (Y2_IS_CHK_RX1 | Y2_IS_CHK_TXS1 | Y2_IS_CHK_TXA1)) != 0) {
-+ if ((IStatus & Y2_IS_CHK_RX1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_R1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E006,
-+ SKERR_SIRQ_E006MSG);
-+ }
-+ else {
-+ Queue = Q_R2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E007,
-+ SKERR_SIRQ_E007MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_CHK);
-+ }
-+
-+ if ((IStatus & Y2_IS_CHK_TXS1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_XS1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E008,
-+ SKERR_SIRQ_E008MSG);
-+ }
-+ else {
-+ Queue = Q_XS2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E010,
-+ SKERR_SIRQ_E010MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_CHK);
-+ }
-+
-+ if ((IStatus & Y2_IS_CHK_TXA1) != 0) {
-+ if (Port == MAC_1) {
-+ Queue = Q_XA1;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E009,
-+ SKERR_SIRQ_E009MSG);
-+ }
-+ else {
-+ Queue = Q_XA2;
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E011,
-+ SKERR_SIRQ_E011MSG);
-+ }
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, Q_ADDR(Queue, Q_CSR), BMU_CLR_IRQ_CHK);
- }
-
-+ Para.Para64 = Port;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
-+
-+ Para.Para32[0] = Port;
-+ SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
-+ }
-+} /* SkYuk2PortSirq */
-+#endif /* YUK2 */
-+
-+/******************************************************************************
-+ *
-+ * SkYuk2SirqIsr() - Special Interrupt Service Routine (Yukon-2 only)
-+ *
-+ * Description: handles all non data transfer specific interrupts (slow path)
-+ *
-+ * Returns: N/A
-+ */
-+void SkYuk2SirqIsr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 Istatus) /* Interrupt status word */
-+{
-+#ifdef YUK2
-+ SK_EVPARA Para;
-+ SK_U32 RegVal32; /* Read register value */
-+ SK_U8 Value;
-+
-+ /* HW Error indicated ? */
-+ if (((Istatus & Y2_IS_HW_ERR) & pAC->GIni.GIValIrqMask) != 0) {
-+ /* read the HW Error Interrupt source */
-+ SK_IN32(IoC, B0_HWE_ISRC, &RegVal32);
-+
-+ SkYuk2HwErr(pAC, IoC, RegVal32);
-+ }
-+
-+ /* Interrupt from ASF Subsystem */
-+ if ((Istatus & Y2_IS_ASF) != 0) {
-+ /* clear IRQ */
-+ /* later on clearing should be done in ASF ISR handler */
-+ SK_IN8(IoC, B28_Y2_ASF_STAT_CMD, &Value);
-+ Value |= Y2_ASF_CLR_HSTI;
-+ SK_OUT8(IoC, B28_Y2_ASF_STAT_CMD, Value);
-+ /* Call IRQ handler in ASF Module */
-+ /* TBD */
-+ }
-+
-+ /* Check IRQ from polling unit */
-+ if ((Istatus & Y2_IS_POLL_CHK) != 0) {
-+ /* Clear IRQ */
-+ SK_OUT32(IoC, POLL_CTRL, PC_CLR_IRQ_CHK);
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E036,
-+ SKERR_SIRQ_E036MSG);
-+ Para.Para64 = 0;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para);
-+ }
-+
-+ /* TWSI Ready interrupt */
-+ if ((Istatus & Y2_IS_TWSI_RDY) != 0) {
-+#ifdef SK_SLIM
-+ SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-+#else
-+ SkI2cIsr(pAC, IoC);
-+#endif
-+ }
-+
-+ /* SW forced interrupt */
-+ if ((Istatus & Y2_IS_IRQ_SW) != 0) {
-+ /* clear the software IRQ */
-+ SK_OUT8(IoC, B0_CTST, CS_CL_SW_IRQ);
-+ }
-+
-+ if ((Istatus & Y2_IS_L1_MASK) != 0) {
-+ SkYuk2PortSirq(pAC, IoC, Istatus, MAC_1);
-+ }
-+
-+ if ((Istatus & Y2_IS_L2_MASK) != 0) {
-+ SkYuk2PortSirq(pAC, IoC, Istatus, MAC_2);
-+ }
-+
-+ /* Timer interrupt (served last) */
-+ if ((Istatus & Y2_IS_TIMINT) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-+ ("Timer Int: 0x%08lX\n", Istatus));
- SkHwtIsr(pAC, IoC);
- }
-+#endif /* YUK2 */
-
--} /* SkGeSirqIsr */
-+} /* SkYuk2SirqIsr */
-
-
- #ifdef GENESIS
-@@ -880,8 +1314,8 @@ SK_U32 Istatus) /* Interrupt status word
- */
- static int SkGePortCheckShorts(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port) /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U32 Shorts; /* Short Event Counter */
- SK_U32 CheckShorts; /* Check value for Short Event Counter */
-@@ -909,9 +1343,9 @@ int Port) /* Which port should be chec
- RxCts = 0;
-
- for (i = 0; i < sizeof(SkGeRxRegs)/sizeof(SkGeRxRegs[0]); i++) {
--
-+
- (void)SkXmMacStatistic(pAC, IoC, Port, SkGeRxRegs[i], &RxTmp);
--
-+
- RxCts += (SK_U64)RxTmp;
- }
-
-@@ -928,11 +1362,11 @@ int Port) /* Which port should be chec
- CheckShorts = 2;
-
- (void)SkXmMacStatistic(pAC, IoC, Port, XM_RXF_FCS_ERR, &FcsErrCts);
--
-- if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE &&
-- pPrt->PLipaAutoNeg == SK_LIPA_UNKNOWN &&
-- (pPrt->PLinkMode == SK_LMODE_HALF ||
-- pPrt->PLinkMode == SK_LMODE_FULL)) {
-+
-+ if (pPrt->PLinkModeConf == (SK_U8)SK_LMODE_AUTOSENSE &&
-+ pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_UNKNOWN &&
-+ (pPrt->PLinkMode == (SK_U8)SK_LMODE_HALF ||
-+ pPrt->PLinkMode == (SK_U8)SK_LMODE_FULL)) {
- /*
- * This is autosensing and we are in the fallback
- * manual full/half duplex mode.
-@@ -941,16 +1375,16 @@ int Port) /* Which port should be chec
- /* Nothing received, restart link */
- pPrt->PPrevFcs = FcsErrCts;
- pPrt->PPrevShorts = Shorts;
--
-+
- return(SK_HW_PS_RESTART);
- }
- else {
-- pPrt->PLipaAutoNeg = SK_LIPA_MANUAL;
-+ pPrt->PLipaAutoNeg = (SK_U8)SK_LIPA_MANUAL;
- }
- }
-
- if (((RxCts - pPrt->PPrevRx) > pPrt->PRxLim) ||
-- (!(FcsErrCts - pPrt->PPrevFcs))) {
-+ (!(FcsErrCts - pPrt->PPrevFcs))) {
- /*
- * Note: The compare with zero above has to be done the way shown,
- * otherwise the Linux driver will have a problem.
-@@ -995,29 +1429,25 @@ int Port) /* Which port should be chec
- */
- static int SkGePortCheckUp(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port) /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
- SK_BOOL AutoNeg; /* Is Auto-negotiation used ? */
- int Rtv; /* Return value */
-
- Rtv = SK_HW_PS_NONE;
--
-+
- pPrt = &pAC->GIni.GP[Port];
-
-- if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
-- AutoNeg = SK_FALSE;
-- }
-- else {
-- AutoNeg = SK_TRUE;
-- }
-+ AutoNeg = pPrt->PLinkMode != SK_LMODE_HALF &&
-+ pPrt->PLinkMode != SK_LMODE_FULL;
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
-
- switch (pPrt->PhyType) {
--
-+
- case SK_PHY_XMAC:
- Rtv = SkGePortCheckUpXmac(pAC, IoC, Port, AutoNeg);
- break;
-@@ -1035,15 +1465,15 @@ int Port) /* Which port should be chec
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- Rtv = SkGePortCheckUpGmac(pAC, IoC, Port, AutoNeg);
- }
- #endif /* YUKON */
-
-- return(Rtv);
-+ return(Rtv);
- } /* SkGePortCheckUp */
-
-
-@@ -1059,8 +1489,8 @@ int Port) /* Which port should be chec
- */
- static int SkGePortCheckUpXmac(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port, /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
- {
- SK_U32 Shorts; /* Short Event Counter */
-@@ -1098,7 +1528,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- XM_IN16(IoC, Port, XM_ISRC, &Isrc);
- IsrcSum |= Isrc;
- SkXmAutoNegLipaXmac(pAC, IoC, Port, IsrcSum);
--
-+
- if ((Isrc & XM_IS_INP_ASS) == 0) {
- /* It has been in sync since last time */
- /* Restart the PORT */
-@@ -1117,14 +1547,14 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- * Link Restart Workaround:
- * it may be possible that the other Link side
- * restarts its link as well an we detect
-- * another LinkBroken. To prevent this
-+ * another PLinkBroken. To prevent this
- * happening we check for a maximum number
- * of consecutive restart. If those happens,
- * we do NOT restart the active link and
- * check whether the link is now o.k.
- */
- pPrt->PLinkResCt++;
--
-+
- pPrt->PAutoNegTimeOut = 0;
-
- if (pPrt->PLinkResCt < SK_MAX_LRESTART) {
-@@ -1132,13 +1562,13 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- }
-
- pPrt->PLinkResCt = 0;
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("Do NOT restart on Port %d %x %x\n", Port, Isrc, IsrcSum));
- }
- else {
- pPrt->PIsave = (SK_U16)(IsrcSum & XM_IS_AND);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("Save Sync/nosync Port %d %x %x\n", Port, Isrc, IsrcSum));
-
-@@ -1165,7 +1595,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- if ((Isrc & XM_IS_INP_ASS) != 0) {
- pPrt->PLinkBroken = SK_TRUE;
- /* Re-Init Link partner Autoneg flag */
-- pPrt->PLipaAutoNeg = SK_LIPA_UNKNOWN;
-+ pPrt->PLipaAutoNeg = (SK_U8)SK_LIPA_UNKNOWN;
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Link broken Port %d\n", Port));
-
-@@ -1178,7 +1608,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- }
- else {
- SkXmAutoNegLipaXmac(pAC, IoC, Port, Isrc);
--
-+
- if (SkGePortCheckShorts(pAC, IoC, Port) == SK_HW_PS_RESTART) {
- return(SK_HW_PS_RESTART);
- }
-@@ -1194,7 +1624,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- IsrcSum |= Isrc;
-
- SkXmAutoNegLipaXmac(pAC, IoC, Port, IsrcSum);
--
-+
- if ((GpReg & XM_GP_INP_ASS) != 0 || (IsrcSum & XM_IS_INP_ASS) != 0) {
- if ((GpReg & XM_GP_INP_ASS) == 0) {
- /* Save Auto-negotiation Done interrupt only if link is in sync */
-@@ -1210,17 +1640,21 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- }
-
- if (AutoNeg) {
-+ /* Auto-Negotiation Done ? */
- if ((IsrcSum & XM_IS_AND) != 0) {
-+
- SkHWLinkUp(pAC, IoC, Port);
-+
- Done = SkMacAutoNegDone(pAC, IoC, Port);
-+
- if (Done != SK_AND_OK) {
- /* Get PHY parameters, for debugging only */
- SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_LP, &LpAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_RES_ABI, &ResAb);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNeg FAIL Port %d (LpAb %x, ResAb %x)\n",
-- Port, LpAb, ResAb));
--
-+ Port, LpAb, ResAb));
-+
- /* Try next possible mode */
- NextMode = SkHWSenseGetNext(pAC, IoC, Port);
- SkHWLinkDown(pAC, IoC, Port);
-@@ -1236,42 +1670,41 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- * (clear Page Received bit if set)
- */
- SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_EXP, &ExtStat);
--
-+
- return(SK_HW_PS_LINK);
- }
--
-+
- /* AutoNeg not done, but HW link is up. Check for timeouts */
-- pPrt->PAutoNegTimeOut++;
-- if (pPrt->PAutoNegTimeOut >= SK_AND_MAX_TO) {
-+ if (pPrt->PAutoNegTimeOut++ >= SK_AND_MAX_TO) {
- /* Increase the Timeout counter */
- pPrt->PAutoNegTOCt++;
-
- /* Timeout occured */
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("AutoNeg timeout Port %d\n", Port));
-- if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE &&
-- pPrt->PLipaAutoNeg != SK_LIPA_AUTO) {
-+ if (pPrt->PLinkModeConf == (SK_U8)SK_LMODE_AUTOSENSE &&
-+ pPrt->PLipaAutoNeg != (SK_U8)SK_LIPA_AUTO) {
- /* Set Link manually up */
- SkHWSenseSetNext(pAC, IoC, Port, SK_LMODE_FULL);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Set manual full duplex Port %d\n", Port));
- }
-
-- if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE &&
-- pPrt->PLipaAutoNeg == SK_LIPA_AUTO &&
-+ if (pPrt->PLinkModeConf == (SK_U8)SK_LMODE_AUTOSENSE &&
-+ pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_AUTO &&
- pPrt->PAutoNegTOCt >= SK_MAX_ANEG_TO) {
- /*
- * This is rather complicated.
- * we need to check here whether the LIPA_AUTO
- * we saw before is false alert. We saw at one
-- * switch ( SR8800) that on boot time it sends
-+ * switch (SR8800) that on boot time it sends
- * just one auto-neg packet and does no further
- * auto-negotiation.
- * Solution: we restart the autosensing after
- * a few timeouts.
- */
- pPrt->PAutoNegTOCt = 0;
-- pPrt->PLipaAutoNeg = SK_LIPA_UNKNOWN;
-+ pPrt->PLipaAutoNeg = (SK_U8)SK_LIPA_UNKNOWN;
- SkHWInitDefSense(pAC, IoC, Port);
- }
-
-@@ -1282,18 +1715,18 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- else {
- /* Link is up and we don't need more */
- #ifdef DEBUG
-- if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ if (pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_AUTO) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("ERROR: Lipa auto detected on port %d\n", Port));
- }
- #endif /* DEBUG */
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Link sync(GP), Port %d\n", Port));
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- /*
-- * Link sync (GP) and so assume a good connection. But if not received
-- * a bunch of frames received in a time slot (maybe broken tx cable)
-+ * Link sync (GP) and so assume a good connection. But if no
-+ * bunch of frames received in a time slot (maybe broken Tx cable)
- * the port is restart.
- */
- return(SK_HW_PS_LINK);
-@@ -1314,8 +1747,8 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- */
- static int SkGePortCheckUpBcom(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port, /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -1334,74 +1767,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- /* Check for No HCD Link events (#10523) */
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_STAT, &Isrc);
-
--#ifdef xDEBUG
-- if ((Isrc & ~(PHY_B_IS_HCT | PHY_B_IS_LCT) ==
-- (PHY_B_IS_SCR_S_ER | PHY_B_IS_RRS_CHANGE | PHY_B_IS_LRS_CHANGE)) {
--
-- SK_U32 Stat1, Stat2, Stat3;
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_MASK, &Stat1);
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "CheckUp1 - Stat: %x, Mask: %x",
-- (void *)Isrc,
-- (void *)Stat1);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_CTRL, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_STAT, &Stat2);
-- Stat1 = Stat1 << 16 | Stat2;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_ADV, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &Stat3);
-- Stat2 = Stat2 << 16 | Stat3;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "Ctrl/Stat: %x, AN Adv/LP: %x",
-- (void *)Stat1,
-- (void *)Stat2);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_EXP, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_EXT_STAT, &Stat2);
-- Stat1 = Stat1 << 16 | Stat2;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_CTRL, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &Stat3);
-- Stat2 = Stat2 << 16 | Stat3;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "AN Exp/IEEE Ext: %x, 1000T Ctrl/Stat: %x",
-- (void *)Stat1,
-- (void *)Stat2);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_P_EXT_CTRL, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_P_EXT_STAT, &Stat2);
-- Stat1 = Stat1 << 16 | Stat2;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_CTRL, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_STAT, &Stat3);
-- Stat2 = Stat2 << 16 | Stat3;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "PHY Ext Ctrl/Stat: %x, Aux Ctrl/Stat: %x",
-- (void *)Stat1,
-- (void *)Stat2);
-- }
--#endif /* DEBUG */
--
- if ((Isrc & (PHY_B_IS_NO_HDCL /* | PHY_B_IS_NO_HDC */)) != 0) {
- /*
- * Workaround BCom Errata:
-@@ -1414,14 +1779,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- (SK_U16)(Ctrl & ~PHY_CT_LOOP));
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("No HCD Link event, Port %d\n", Port));
--#ifdef xDEBUG
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "No HCD link event, port %d.",
-- (void *)Port,
-- (void *)NULL);
--#endif /* DEBUG */
- }
-
- /* Not obsolete: link status bit is latched to 0 and autoclearing! */
-@@ -1431,72 +1788,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- return(SK_HW_PS_NONE);
- }
-
--#ifdef xDEBUG
-- {
-- SK_U32 Stat1, Stat2, Stat3;
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_MASK, &Stat1);
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "CheckUp1a - Stat: %x, Mask: %x",
-- (void *)Isrc,
-- (void *)Stat1);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_CTRL, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_STAT, &PhyStat);
-- Stat1 = Stat1 << 16 | PhyStat;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_ADV, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &Stat3);
-- Stat2 = Stat2 << 16 | Stat3;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "Ctrl/Stat: %x, AN Adv/LP: %x",
-- (void *)Stat1,
-- (void *)Stat2);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_EXP, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_EXT_STAT, &Stat2);
-- Stat1 = Stat1 << 16 | Stat2;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_CTRL, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ResAb);
-- Stat2 = Stat2 << 16 | ResAb;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "AN Exp/IEEE Ext: %x, 1000T Ctrl/Stat: %x",
-- (void *)Stat1,
-- (void *)Stat2);
--
-- Stat1 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_P_EXT_CTRL, &Stat1);
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_P_EXT_STAT, &Stat2);
-- Stat1 = Stat1 << 16 | Stat2;
-- Stat2 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_CTRL, &Stat2);
-- Stat3 = 0;
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_STAT, &Stat3);
-- Stat2 = Stat2 << 16 | Stat3;
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "PHY Ext Ctrl/Stat: %x, Aux Ctrl/Stat: %x",
-- (void *)Stat1,
-- (void *)Stat2);
-- }
--#endif /* DEBUG */
--
- /*
- * Here we usually can check whether the link is in sync and
- * auto-negotiation is done.
-@@ -1505,7 +1796,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_STAT, &PhyStat);
-
- SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("CheckUp Port %d, PhyStat: 0x%04X\n", Port, PhyStat));
-
-@@ -1513,88 +1804,62 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
-
- if ((ResAb & PHY_B_1000S_MSF) != 0) {
- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Master/Slave Fault port %d\n", Port));
--
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("Master/Slave Fault, ResAb: 0x%04X\n", ResAb));
-+
- pPrt->PAutoNegFail = SK_TRUE;
- pPrt->PMSStatus = SK_MS_STAT_FAULT;
--
-+
- return(SK_HW_PS_RESTART);
- }
-
- if ((PhyStat & PHY_ST_LSYNC) == 0) {
- return(SK_HW_PS_NONE);
- }
--
-+
- pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
- SK_MS_STAT_MASTER : SK_MS_STAT_SLAVE;
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("Port %d, ResAb: 0x%04X\n", Port, ResAb));
-
- if (AutoNeg) {
-+ /* Auto-Negotiation Over ? */
- if ((PhyStat & PHY_ST_AN_OVER) != 0) {
--
-+
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- Done = SkMacAutoNegDone(pAC, IoC, Port);
--
-+
- if (Done != SK_AND_OK) {
- #ifdef DEBUG
- /* Get PHY parameters, for debugging only */
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &LpAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ExtStat);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNeg FAIL Port %d (LpAb %x, 1000TStat %x)\n",
- Port, LpAb, ExtStat));
- #endif /* DEBUG */
- return(SK_HW_PS_RESTART);
- }
- else {
--#ifdef xDEBUG
-- /* Dummy read ISR to prevent extra link downs/ups */
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_STAT, &ExtStat);
--
-- if ((ExtStat & ~(PHY_B_IS_HCT | PHY_B_IS_LCT)) != 0) {
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "CheckUp2 - Stat: %x",
-- (void *)ExtStat,
-- (void *)NULL);
-- }
--#endif /* DEBUG */
- return(SK_HW_PS_LINK);
- }
- }
- }
- else { /* !AutoNeg */
-- /* Link is up and we don't need more. */
-+ /* Link is up and we don't need more */
- #ifdef DEBUG
-- if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ if (pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_AUTO) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("ERROR: Lipa auto detected on port %d\n", Port));
- }
- #endif /* DEBUG */
-
--#ifdef xDEBUG
-- /* Dummy read ISR to prevent extra link downs/ups */
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_STAT, &ExtStat);
--
-- if ((ExtStat & ~(PHY_B_IS_HCT | PHY_B_IS_LCT)) != 0) {
-- CMSMPrintString(
-- pAC->pConfigTable,
-- MSG_TYPE_RUNTIME_INFO,
-- "CheckUp3 - Stat: %x",
-- (void *)ExtStat,
-- (void *)NULL);
-- }
--#endif /* DEBUG */
--
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Link sync(GP), Port %d\n", Port));
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- return(SK_HW_PS_LINK);
- }
-
-@@ -1615,17 +1880,18 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- */
- static int SkGePortCheckUpGmac(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port, /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
- int Done;
-- SK_U16 PhyIsrc; /* PHY Interrupt source */
-- SK_U16 PhyStat; /* PPY Status */
-+ SK_U16 PhyStat; /* PHY Status */
- SK_U16 PhySpecStat;/* PHY Specific Status */
- SK_U16 ResAb; /* Master/Slave resolution */
-+#ifndef SK_SLIM
- SK_EVPARA Para;
-+#endif /* !SK_SLIM */
- #ifdef DEBUG
- SK_U16 Word; /* I/O helper */
- #endif /* DEBUG */
-@@ -1642,94 +1908,124 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("CheckUp Port %d, PhyStat: 0x%04X\n", Port, PhyStat));
-
-- /* Read PHY Interrupt Status */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_INT_STAT, &PhyIsrc);
-+ SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
-
-- if ((PhyIsrc & PHY_M_IS_AN_COMPL) != 0) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Auto-Negotiation Completed, PhyIsrc: 0x%04X\n", PhyIsrc));
-- }
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-
-- if ((PhyIsrc & PHY_M_IS_LSP_CHANGE) != 0) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Link Speed Changed, PhyIsrc: 0x%04X\n", PhyIsrc));
-- }
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb);
-
-- SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
--
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb);
-+ if ((ResAb & PHY_B_1000S_MSF) != 0) {
-+ /* Error */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("Master/Slave Fault, ResAb: 0x%04X\n", ResAb));
-
-- if ((ResAb & PHY_B_1000S_MSF) != 0) {
-- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Master/Slave Fault port %d\n", Port));
--
-- pPrt->PAutoNegFail = SK_TRUE;
-- pPrt->PMSStatus = SK_MS_STAT_FAULT;
--
-- return(SK_HW_PS_RESTART);
-+ pPrt->PAutoNegFail = SK_TRUE;
-+ pPrt->PMSStatus = SK_MS_STAT_FAULT;
-+
-+ return(SK_HW_PS_RESTART);
-+ }
- }
-
- /* Read PHY Specific Status */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_STAT, &PhySpecStat);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("Phy1000BT: 0x%04X, PhySpecStat: 0x%04X\n", ResAb, PhySpecStat));
-
- #ifdef DEBUG
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_EXP, &Word);
-
-- if ((PhyIsrc & PHY_M_IS_AN_PR) != 0 || (Word & PHY_ANE_RX_PG) != 0 ||
-- (PhySpecStat & PHY_M_PS_PAGE_REC) != 0) {
-+ if ((Word & PHY_ANE_RX_PG) != 0 ||
-+ (PhySpecStat & PHY_M_PS_PAGE_REC) != 0) {
- /* Read PHY Next Page Link Partner */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_NEPG_LP, &Word);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Page Received, NextPage: 0x%04X\n", Word));
-+ ("Page received, NextPage: 0x%04X\n", Word));
- }
- #endif /* DEBUG */
-
- if ((PhySpecStat & PHY_M_PS_LINK_UP) == 0) {
-+ /* Link down */
- return(SK_HW_PS_NONE);
- }
--
-- if ((PhySpecStat & PHY_M_PS_DOWNS_STAT) != 0 ||
-- (PhyIsrc & PHY_M_IS_DOWNSH_DET) != 0) {
-- /* Downshift detected */
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E025, SKERR_SIRQ_E025MSG);
--
-- Para.Para64 = Port;
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_DOWNSHIFT_DET, Para);
--
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Downshift detected, PhyIsrc: 0x%04X\n", PhyIsrc));
-+
-+#ifdef XXX
-+ SK_U16 PhyInt;
-+ /* Read PHY Interrupt Status */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_INT_STAT, &PhyInt);
-+
-+ /* cross check that the link is really up */
-+ if ((PhyInt & PHY_M_IS_LST_CHANGE) == 0) {
-+ /* Link Status unchanged */
-+ return(SK_HW_PS_NONE);
- }
-+#endif /* XXX */
-+
-+#ifndef SK_SLIM
-+ if (pAC->GIni.GICopperType) {
-+
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+
-+ if ((PhySpecStat & PHY_M_PS_DOWNS_STAT) != 0) {
-+ /* Downshift detected */
-+ Para.Para64 = Port;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_DOWNSHIFT_DET, Para);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Downshift detected, PhySpecStat: 0x%04X\n", PhySpecStat));
-+
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E025,
-+ SKERR_SIRQ_E025MSG);
-+ }
-+
-+ pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
-+ SK_MS_STAT_MASTER : SK_MS_STAT_SLAVE;
-+ }
-+
-+ if ((PhySpecStat & PHY_M_PS_MDI_X_STAT) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("MDI Xover detected, PhyStat: 0x%04X\n", PhySpecStat));
-+ }
-+
-+ /* on PHY 88E1112 & 88E1145 cable length is in Reg. 26, Page 5 */
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL ||
-+ pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) {
-+ /* select page 5 to access VCT DSP distance register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 5);
-+
-+ /* get VCT DSP distance */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL_2, &PhySpecStat);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 0);
-+
-+ pPrt->PCableLen = (SK_U8)(PhySpecStat & PHY_M_EC2_FO_AM_MSK);
-+ }
-+ else {
-+ pPrt->PCableLen = (SK_U8)((PhySpecStat & PHY_M_PS_CABLE_MSK) >> 7);
-+ }
-+ }
-+#endif /* !SK_SLIM */
-
-- pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
-- SK_MS_STAT_MASTER : SK_MS_STAT_SLAVE;
--
-- pPrt->PCableLen = (SK_U8)((PhySpecStat & PHY_M_PS_CABLE_MSK) >> 7);
--
- if (AutoNeg) {
-- /* Auto-Negotiation Over ? */
-+ /* Auto-Negotiation Complete ? */
- if ((PhyStat & PHY_ST_AN_OVER) != 0) {
--
-+
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- Done = SkMacAutoNegDone(pAC, IoC, Port);
--
-+
- if (Done != SK_AND_OK) {
- return(SK_HW_PS_RESTART);
- }
--
-+
- return(SK_HW_PS_LINK);
- }
- }
- else { /* !AutoNeg */
-- /* Link is up and we don't need more */
- #ifdef DEBUG
-- if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ if (pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_AUTO) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("ERROR: Lipa auto detected on port %d\n", Port));
- }
- #endif /* DEBUG */
-@@ -1737,12 +2033,13 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Link sync, Port %d\n", Port));
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- return(SK_HW_PS_LINK);
- }
-
- return(SK_HW_PS_NONE);
- } /* SkGePortCheckUpGmac */
-+
- #endif /* YUKON */
-
-
-@@ -1758,8 +2055,8 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- */
- static int SkGePortCheckUpLone(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port, /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -1788,7 +2085,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- StatSum |= PhyStat;
-
- SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
--
-+
- if ((PhyStat & PHY_ST_LSYNC) == 0) {
- /* Save Auto-negotiation Done bit */
- pPrt->PIsave = (SK_U16)(StatSum & PHY_ST_AN_OVER);
-@@ -1802,17 +2099,21 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- }
-
- if (AutoNeg) {
-+ /* Auto-Negotiation Over ? */
- if ((StatSum & PHY_ST_AN_OVER) != 0) {
-+
- SkHWLinkUp(pAC, IoC, Port);
-+
- Done = SkMacAutoNegDone(pAC, IoC, Port);
-+
- if (Done != SK_AND_OK) {
- /* Get PHY parameters, for debugging only */
- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_AUNE_LP, &LpAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_1000T_STAT, &ExtStat);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNeg FAIL Port %d (LpAb %x, 1000TStat %x)\n",
- Port, LpAb, ExtStat));
--
-+
- /* Try next possible mode */
- NextMode = SkHWSenseGetNext(pAC, IoC, Port);
- SkHWLinkDown(pAC, IoC, Port);
-@@ -1833,15 +2134,14 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- return(SK_HW_PS_LINK);
- }
- }
--
-+
- /* AutoNeg not done, but HW link is up. Check for timeouts */
-- pPrt->PAutoNegTimeOut++;
-- if (pPrt->PAutoNegTimeOut >= SK_AND_MAX_TO) {
-+ if (pPrt->PAutoNegTimeOut++ >= SK_AND_MAX_TO) {
- /* Timeout occured */
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("AutoNeg timeout Port %d\n", Port));
-- if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE &&
-- pPrt->PLipaAutoNeg != SK_LIPA_AUTO) {
-+ if (pPrt->PLinkModeConf == (SK_U8)SK_LMODE_AUTOSENSE &&
-+ pPrt->PLipaAutoNeg != (SK_U8)SK_LIPA_AUTO) {
- /* Set Link manually up */
- SkHWSenseSetNext(pAC, IoC, Port, SK_LMODE_FULL);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-@@ -1855,8 +2155,8 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- else {
- /* Link is up and we don't need more */
- #ifdef DEBUG
-- if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ if (pPrt->PLipaAutoNeg == (SK_U8)SK_LIPA_AUTO) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("ERROR: Lipa auto detected on port %d\n", Port));
- }
- #endif /* DEBUG */
-@@ -1866,11 +2166,12 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- * extra link down/ups
- */
- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_INT_STAT, &ExtStat);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("Link sync(GP), Port %d\n", Port));
-+
- SkHWLinkUp(pAC, IoC, Port);
--
-+
- return(SK_HW_PS_LINK);
- }
-
-@@ -1889,8 +2190,8 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- */
- static int SkGePortCheckUpNat(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO Context */
--int Port, /* Which port should be checked */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
- {
- /* todo: National */
-@@ -1909,38 +2210,40 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation
- */
- int SkGeSirqEvent(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* Io Context */
-+SK_IOC IoC, /* I/O Context */
- SK_U32 Event, /* Module specific Event */
- SK_EVPARA Para) /* Event specific Parameter */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-- SK_U32 Port;
-+ int Port;
- SK_U32 Val32;
- int PortStat;
-+#ifndef SK_SLIM
- SK_U8 Val8;
-+#endif
- #ifdef GENESIS
- SK_U64 Octets;
- #endif /* GENESIS */
-
-- Port = Para.Para32[0];
-+ Port = (int)Para.Para32[0];
- pPrt = &pAC->GIni.GP[Port];
-
- switch (Event) {
- case SK_HWEV_WATIM:
- if (pPrt->PState == SK_PRT_RESET) {
--
-+
- PortStat = SK_HW_PS_NONE;
- }
- else {
- /* Check whether port came up */
-- PortStat = SkGePortCheckUp(pAC, IoC, (int)Port);
-+ PortStat = SkGePortCheckUp(pAC, IoC, Port);
- }
-
- switch (PortStat) {
- case SK_HW_PS_RESTART:
- if (pPrt->PHWLinkUp) {
- /* Set Link to down */
-- SkHWLinkDown(pAC, IoC, (int)Port);
-+ SkHWLinkDown(pAC, IoC, Port);
-
- /*
- * Signal directly to RLMT to ensure correct
-@@ -1958,22 +2261,28 @@ SK_EVPARA Para) /* Event specific Param
- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_UP, Para);
- break;
- }
--
-+
- /* Start again the check Timer */
- if (pPrt->PHWLinkUp) {
-+
- Val32 = SK_WA_ACT_TIME;
- }
- else {
- Val32 = SK_WA_INA_TIME;
-- }
-
-- /* Todo: still needed for non-XMAC PHYs??? */
-+ if (pAC->GIni.GIYukon) {
-+ Val32 *= 5;
-+ }
-+ }
- /* Start workaround Errata #2 timer */
- SkTimerStart(pAC, IoC, &pPrt->PWaTimer, Val32,
- SKGE_HWAC, SK_HWEV_WATIM, Para);
-+
- break;
-
- case SK_HWEV_PORT_START:
-+
-+#ifndef SK_SLIM
- if (pPrt->PHWLinkUp) {
- /*
- * Signal directly to RLMT to ensure correct
-@@ -1981,8 +2290,9 @@ SK_EVPARA Para) /* Event specific Param
- */
- SkRlmtEvent(pAC, IoC, SK_RLMT_LINK_DOWN, Para);
- }
-+#endif /* !SK_SLIM */
-
-- SkHWLinkDown(pAC, IoC, (int)Port);
-+ SkHWLinkDown(pAC, IoC, Port);
-
- /* Schedule Port RESET */
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, Para);
-@@ -1990,9 +2300,11 @@ SK_EVPARA Para) /* Event specific Param
- /* Start workaround Errata #2 timer */
- SkTimerStart(pAC, IoC, &pPrt->PWaTimer, SK_WA_INA_TIME,
- SKGE_HWAC, SK_HWEV_WATIM, Para);
-+
- break;
-
- case SK_HWEV_PORT_STOP:
-+#ifndef SK_SLIM
- if (pPrt->PHWLinkUp) {
- /*
- * Signal directly to RLMT to ensure correct
-@@ -2000,20 +2312,22 @@ SK_EVPARA Para) /* Event specific Param
- */
- SkRlmtEvent(pAC, IoC, SK_RLMT_LINK_DOWN, Para);
- }
-+#endif /* !SK_SLIM */
-
- /* Stop Workaround Timer */
- SkTimerStop(pAC, IoC, &pPrt->PWaTimer);
-
-- SkHWLinkDown(pAC, IoC, (int)Port);
-+ SkHWLinkDown(pAC, IoC, Port);
- break;
-
-+#ifndef SK_SLIM
- case SK_HWEV_UPDATE_STAT:
- /* We do NOT need to update any statistics */
- break;
-
- case SK_HWEV_CLEAR_STAT:
- /* We do NOT need to clear any statistics */
-- for (Port = 0; Port < (SK_U32)pAC->GIni.GIMacsFound; Port++) {
-+ for (Port = 0; Port < pAC->GIni.GIMacsFound; Port++) {
- pPrt->PPrevRx = 0;
- pPrt->PPrevFcs = 0;
- pPrt->PPrevShorts = 0;
-@@ -2074,6 +2388,7 @@ SK_EVPARA Para) /* Event specific Param
- SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para);
- }
- break;
-+#endif /* !SK_SLIM */
-
- #ifdef GENESIS
- case SK_HWEV_HALFDUP_CHK:
-@@ -2085,23 +2400,18 @@ SK_EVPARA Para) /* Event specific Param
- pPrt->HalfDupTimerActive = SK_FALSE;
- if (pPrt->PLinkModeStatus == SK_LMODE_STAT_HALF ||
- pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) {
--#ifdef XXX
-- Len = sizeof(SK_U64);
-- SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets,
-- &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, Port),
-- pAC->Rlmt.Port[Port].Net->NetNumber);
--#endif /* XXX */
-+
- /* Snap statistic counters */
- (void)SkXmUpdateStats(pAC, IoC, Port);
-
- (void)SkXmMacStatistic(pAC, IoC, Port, XM_TXO_OK_HI, &Val32);
-
- Octets = (SK_U64)Val32 << 32;
--
-+
- (void)SkXmMacStatistic(pAC, IoC, Port, XM_TXO_OK_LO, &Val32);
-
- Octets += Val32;
--
-+
- if (pPrt->LastOctets == Octets) {
- /* Tx hanging, a FIFO flush restarts it */
- SkMacFlushTxFifo(pAC, IoC, Port);
-@@ -2110,7 +2420,7 @@ SK_EVPARA Para) /* Event specific Param
- }
- break;
- #endif /* GENESIS */
--
-+
- default:
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_SIRQ_E001, SKERR_SIRQ_E001MSG);
- break;
-@@ -2131,8 +2441,8 @@ SK_EVPARA Para) /* Event specific Param
- */
- static void SkPhyIsrBcom(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* Io Context */
--int Port, /* Port Num = PHY Num */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_U16 IStatus) /* Interrupt Status */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -2145,7 +2455,7 @@ SK_U16 IStatus) /* Interrupt Status */
- SK_ERR_LOG(pAC, SK_ERRCL_HW | SK_ERRCL_INIT, SKERR_SIRQ_E022,
- SKERR_SIRQ_E022MSG);
- }
--
-+
- if ((IStatus & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) != 0) {
-
- SkHWLinkDown(pAC, IoC, Port);
-@@ -2174,8 +2484,8 @@ SK_U16 IStatus) /* Interrupt Status */
- */
- static void SkPhyIsrGmac(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* Io Context */
--int Port, /* Port Num = PHY Num */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_U16 IStatus) /* Interrupt Status */
- {
- SK_GEPORT *pPrt; /* GIni Port struct pointer */
-@@ -2184,37 +2494,69 @@ SK_U16 IStatus) /* Interrupt Status */
-
- pPrt = &pAC->GIni.GP[Port];
-
-- if ((IStatus & (PHY_M_IS_AN_PR | PHY_M_IS_LST_CHANGE)) != 0) {
--
-- SkHWLinkDown(pAC, IoC, Port);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Port %d PHY IRQ, PhyIsrc: 0x%04X\n", Port, IStatus));
-
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_ADV, &Word);
-+ if ((IStatus & PHY_M_IS_LST_CHANGE) != 0) {
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("AutoNeg.Adv: 0x%04X\n", Word));
--
-- /* Set Auto-negotiation advertisement */
-- if (pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM) {
-- /* restore Asymmetric Pause bit */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_AUNE_ADV,
-- (SK_U16)(Word | PHY_M_AN_ASP));
-- }
--
-+ ("Link Status changed\n"));
-+
- Para.Para32[0] = (SK_U32)Port;
-- /* Signal to RLMT */
-- SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
-+
-+ if (pPrt->PHWLinkUp) {
-+
-+ SkHWLinkDown(pAC, IoC, Port);
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_ADV, &Word);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("AutoNeg.Adv: 0x%04X\n", Word));
-+
-+ /* Set Auto-negotiation advertisement */
-+ if (pAC->GIni.GIChipId != CHIP_ID_YUKON_FE &&
-+ pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM) {
-+ /* restore Asymmetric Pause bit */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_AUNE_ADV,
-+ (SK_U16)(Word | PHY_M_AN_ASP));
-+ }
-+
-+ /* Signal to RLMT */
-+ SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para);
-+ }
-+ else {
-+ if ((IStatus & PHY_M_IS_AN_COMPL) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Auto-Negotiation completed\n"));
-+ }
-+
-+ if ((IStatus & PHY_M_IS_LSP_CHANGE) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Link Speed changed\n"));
-+ }
-+
-+ SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_WATIM, Para);
-+ }
- }
--
-+
- if ((IStatus & PHY_M_IS_AN_ERROR) != 0) {
-- /* Auto-Negotiation Error */
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E023, SKERR_SIRQ_E023MSG);
-+ /* the copper PHY makes 1 retry */
-+ if (pAC->GIni.GICopperType) {
-+ /* not logged as error, it might be the first attempt */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Auto-Negotiation Error\n"));
-+ }
-+ else {
-+ /* Auto-Negotiation Error */
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E023, SKERR_SIRQ_E023MSG);
-+ }
- }
--
-+
- if ((IStatus & PHY_M_IS_FIFO_ERROR) != 0) {
- /* FIFO Overflow/Underrun Error */
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_SIRQ_E024, SKERR_SIRQ_E024MSG);
- }
--
-+
- } /* SkPhyIsrGmac */
- #endif /* YUKON */
-
-@@ -2230,14 +2572,14 @@ SK_U16 IStatus) /* Interrupt Status */
- */
- static void SkPhyIsrLone(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* Io Context */
--int Port, /* Port Num = PHY Num */
-+SK_IOC IoC, /* I/O Context */
-+int Port, /* Port Index (MAC_1 + n) */
- SK_U16 IStatus) /* Interrupt Status */
- {
- SK_EVPARA Para;
-
- if (IStatus & (PHY_L_IS_DUP | PHY_L_IS_ISOL)) {
--
-+
- SkHWLinkDown(pAC, IoC, Port);
-
- Para.Para32[0] = (SK_U32)Port;
-@@ -2249,3 +2591,4 @@ SK_U16 IStatus) /* Interrupt Status */
- #endif /* OTHER_PHY */
-
- /* End of File */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/ski2c.c ./drivers/net/sk98lin/ski2c.c
---- ./drivers/net/sk98lin.sk98/ski2c.c 2004-10-19 01:53:05.000000000 +0400
-+++ ./drivers/net/sk98lin/ski2c.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,1296 +0,0 @@
--/******************************************************************************
-- *
-- * Name: ski2c.c
-- * Project: Gigabit Ethernet Adapters, TWSI-Module
-- * Version: $Revision: 1.59 $
-- * Date: $Date: 2003/10/20 09:07:25 $
-- * Purpose: Functions to access Voltage and Temperature Sensor
-- *
-- ******************************************************************************/
--
--/******************************************************************************
-- *
-- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * The information in this file is provided "AS IS" without warranty.
-- *
-- ******************************************************************************/
--
--/*
-- * I2C Protocol
-- */
--#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
--static const char SysKonnectFileId[] =
-- "@(#) $Id: ski2c.c,v 1.59 2003/10/20 09:07:25 rschmidt Exp $ (C) Marvell. ";
--#endif
--
--#include "h/skdrv1st.h" /* Driver Specific Definitions */
--#include "h/lm80.h"
--#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
--
--#ifdef __C2MAN__
--/*
-- I2C protocol implementation.
--
-- General Description:
--
-- The I2C protocol is used for the temperature sensors and for
-- the serial EEPROM which hold the configuration.
--
-- This file covers functions that allow to read write and do
-- some bulk requests a specified I2C address.
--
-- The Genesis has 2 I2C buses. One for the EEPROM which holds
-- the VPD Data and one for temperature and voltage sensor.
-- The following picture shows the I2C buses, I2C devices and
-- their control registers.
--
-- Note: The VPD functions are in skvpd.c
--.
--. PCI Config I2C Bus for VPD Data:
--.
--. +------------+
--. | VPD EEPROM |
--. +------------+
--. |
--. | <-- I2C
--. |
--. +-----------+-----------+
--. | |
--. +-----------------+ +-----------------+
--. | PCI_VPD_ADR_REG | | PCI_VPD_DAT_REG |
--. +-----------------+ +-----------------+
--.
--.
--. I2C Bus for LM80 sensor:
--.
--. +-----------------+
--. | Temperature and |
--. | Voltage Sensor |
--. | LM80 |
--. +-----------------+
--. |
--. |
--. I2C --> |
--. |
--. +----+
--. +-------------->| OR |<--+
--. | +----+ |
--. +------+------+ |
--. | | |
--. +--------+ +--------+ +----------+
--. | B2_I2C | | B2_I2C | | B2_I2C |
--. | _CTRL | | _DATA | | _SW |
--. +--------+ +--------+ +----------+
--.
-- The I2C bus may be driven by the B2_I2C_SW or by the B2_I2C_CTRL
-- and B2_I2C_DATA registers.
-- For driver software it is recommended to use the I2C control and
-- data register, because I2C bus timing is done by the ASIC and
-- an interrupt may be received when the I2C request is completed.
--
-- Clock Rate Timing: MIN MAX generated by
-- VPD EEPROM: 50 kHz 100 kHz HW
-- LM80 over I2C Ctrl/Data reg. 50 kHz 100 kHz HW
-- LM80 over B2_I2C_SW register 0 400 kHz SW
--
-- Note: The clock generated by the hardware is dependend on the
-- PCI clock. If the PCI bus clock is 33 MHz, the I2C/VPD
-- clock is 50 kHz.
-- */
--intro()
--{}
--#endif
--
--#ifdef SK_DIAG
--/*
-- * I2C Fast Mode timing values used by the LM80.
-- * If new devices are added to the I2C bus the timing values have to be checked.
-- */
--#ifndef I2C_SLOW_TIMING
--#define T_CLK_LOW 1300L /* clock low time in ns */
--#define T_CLK_HIGH 600L /* clock high time in ns */
--#define T_DATA_IN_SETUP 100L /* data in Set-up Time */
--#define T_START_HOLD 600L /* start condition hold time */
--#define T_START_SETUP 600L /* start condition Set-up time */
--#define T_STOP_SETUP 600L /* stop condition Set-up time */
--#define T_BUS_IDLE 1300L /* time the bus must free after Tx */
--#define T_CLK_2_DATA_OUT 900L /* max. clock low to data output valid */
--#else /* I2C_SLOW_TIMING */
--/* I2C Standard Mode Timing */
--#define T_CLK_LOW 4700L /* clock low time in ns */
--#define T_CLK_HIGH 4000L /* clock high time in ns */
--#define T_DATA_IN_SETUP 250L /* data in Set-up Time */
--#define T_START_HOLD 4000L /* start condition hold time */
--#define T_START_SETUP 4700L /* start condition Set-up time */
--#define T_STOP_SETUP 4000L /* stop condition Set-up time */
--#define T_BUS_IDLE 4700L /* time the bus must free after Tx */
--#endif /* !I2C_SLOW_TIMING */
--
--#define NS2BCLK(x) (((x)*125)/10000)
--
--/*
-- * I2C Wire Operations
-- *
-- * About I2C_CLK_LOW():
-- *
-- * The Data Direction bit (I2C_DATA_DIR) has to be set to input when setting
-- * clock to low, to prevent the ASIC and the I2C data client from driving the
-- * serial data line simultaneously (ASIC: last bit of a byte = '1', I2C client
-- * send an 'ACK'). See also Concentrator Bugreport No. 10192.
-- */
--#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA)
--#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA)
--#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA_DIR)
--#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR | I2C_DATA)
--#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_CLK)
--#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK | I2C_DATA_DIR)
--#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK)
--
--#define NS2CLKT(x) ((x*125L)/10000)
--
--/*--------------- I2C Interface Register Functions --------------- */
--
--/*
-- * sending one bit
-- */
--void SkI2cSndBit(
--SK_IOC IoC, /* I/O Context */
--SK_U8 Bit) /* Bit to send */
--{
-- I2C_DATA_OUT(IoC);
-- if (Bit) {
-- I2C_DATA_HIGH(IoC);
-- }
-- else {
-- I2C_DATA_LOW(IoC);
-- }
-- SkDgWaitTime(IoC, NS2BCLK(T_DATA_IN_SETUP));
-- I2C_CLK_HIGH(IoC);
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH));
-- I2C_CLK_LOW(IoC);
--} /* SkI2cSndBit*/
--
--
--/*
-- * Signal a start to the I2C Bus.
-- *
-- * A start is signaled when data goes to low in a high clock cycle.
-- *
-- * Ends with Clock Low.
-- *
-- * Status: not tested
-- */
--void SkI2cStart(
--SK_IOC IoC) /* I/O Context */
--{
-- /* Init data and Clock to output lines */
-- /* Set Data high */
-- I2C_DATA_OUT(IoC);
-- I2C_DATA_HIGH(IoC);
-- /* Set Clock high */
-- I2C_CLK_HIGH(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_START_SETUP));
--
-- /* Set Data Low */
-- I2C_DATA_LOW(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_START_HOLD));
--
-- /* Clock low without Data to Input */
-- I2C_START_COND(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW));
--} /* SkI2cStart */
--
--
--void SkI2cStop(
--SK_IOC IoC) /* I/O Context */
--{
-- /* Init data and Clock to output lines */
-- /* Set Data low */
-- I2C_DATA_OUT(IoC);
-- I2C_DATA_LOW(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT));
--
-- /* Set Clock high */
-- I2C_CLK_HIGH(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_STOP_SETUP));
--
-- /*
-- * Set Data High: Do it by setting the Data Line to Input.
-- * Because of a pull up resistor the Data Line
-- * floods to high.
-- */
-- I2C_DATA_IN(IoC);
--
-- /*
-- * When I2C activity is stopped
-- * o DATA should be set to input and
-- * o CLOCK should be set to high!
-- */
-- SkDgWaitTime(IoC, NS2BCLK(T_BUS_IDLE));
--} /* SkI2cStop */
--
--
--/*
-- * Receive just one bit via the I2C bus.
-- *
-- * Note: Clock must be set to LOW before calling this function.
-- *
-- * Returns The received bit.
-- */
--int SkI2cRcvBit(
--SK_IOC IoC) /* I/O Context */
--{
-- int Bit;
-- SK_U8 I2cSwCtrl;
--
-- /* Init data as input line */
-- I2C_DATA_IN(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT));
--
-- I2C_CLK_HIGH(IoC);
--
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH));
--
-- SK_I2C_GET_SW(IoC, &I2cSwCtrl);
--
-- Bit = (I2cSwCtrl & I2C_DATA) ? 1 : 0;
--
-- I2C_CLK_LOW(IoC);
-- SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT));
--
-- return(Bit);
--} /* SkI2cRcvBit */
--
--
--/*
-- * Receive an ACK.
-- *
-- * returns 0 If acknowledged
-- * 1 in case of an error
-- */
--int SkI2cRcvAck(
--SK_IOC IoC) /* I/O Context */
--{
-- /*
-- * Received bit must be zero.
-- */
-- return(SkI2cRcvBit(IoC) != 0);
--} /* SkI2cRcvAck */
--
--
--/*
-- * Send an NACK.
-- */
--void SkI2cSndNAck(
--SK_IOC IoC) /* I/O Context */
--{
-- /*
-- * Received bit must be zero.
-- */
-- SkI2cSndBit(IoC, 1);
--} /* SkI2cSndNAck */
--
--
--/*
-- * Send an ACK.
-- */
--void SkI2cSndAck(
--SK_IOC IoC) /* I/O Context */
--{
-- /*
-- * Received bit must be zero.
-- */
-- SkI2cSndBit(IoC, 0);
--} /* SkI2cSndAck */
--
--
--/*
-- * Send one byte to the I2C device and wait for ACK.
-- *
-- * Return acknowleged status.
-- */
--int SkI2cSndByte(
--SK_IOC IoC, /* I/O Context */
--int Byte) /* byte to send */
--{
-- int i;
--
-- for (i = 0; i < 8; i++) {
-- if (Byte & (1<<(7-i))) {
-- SkI2cSndBit(IoC, 1);
-- }
-- else {
-- SkI2cSndBit(IoC, 0);
-- }
-- }
--
-- return(SkI2cRcvAck(IoC));
--} /* SkI2cSndByte */
--
--
--/*
-- * Receive one byte and ack it.
-- *
-- * Return byte.
-- */
--int SkI2cRcvByte(
--SK_IOC IoC, /* I/O Context */
--int Last) /* Last Byte Flag */
--{
-- int i;
-- int Byte = 0;
--
-- for (i = 0; i < 8; i++) {
-- Byte <<= 1;
-- Byte |= SkI2cRcvBit(IoC);
-- }
--
-- if (Last) {
-- SkI2cSndNAck(IoC);
-- }
-- else {
-- SkI2cSndAck(IoC);
-- }
--
-- return(Byte);
--} /* SkI2cRcvByte */
--
--
--/*
-- * Start dialog and send device address
-- *
-- * Return 0 if acknowleged, 1 in case of an error
-- */
--int SkI2cSndDev(
--SK_IOC IoC, /* I/O Context */
--int Addr, /* Device Address */
--int Rw) /* Read / Write Flag */
--{
-- SkI2cStart(IoC);
-- Rw = ~Rw;
-- Rw &= I2C_WRITE;
-- return(SkI2cSndByte(IoC, (Addr<<1) | Rw));
--} /* SkI2cSndDev */
--
--#endif /* SK_DIAG */
--
--/*----------------- I2C CTRL Register Functions ----------*/
--
--/*
-- * waits for a completion of an I2C transfer
-- *
-- * returns 0: success, transfer completes
-- * 1: error, transfer does not complete, I2C transfer
-- * killed, wait loop terminated.
-- */
--int SkI2cWait(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context */
--int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */
--{
-- SK_U64 StartTime;
-- SK_U64 CurrentTime;
-- SK_U32 I2cCtrl;
--
-- StartTime = SkOsGetTime(pAC);
--
-- do {
-- CurrentTime = SkOsGetTime(pAC);
--
-- if (CurrentTime - StartTime > SK_TICKS_PER_SEC / 8) {
--
-- SK_I2C_STOP(IoC);
--#ifndef SK_DIAG
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG);
--#endif /* !SK_DIAG */
-- return(1);
-- }
--
-- SK_I2C_GET_CTL(IoC, &I2cCtrl);
--
--#ifdef xYUKON_DBG
-- printf("StartTime=%lu, CurrentTime=%lu\n",
-- StartTime, CurrentTime);
-- if (kbhit()) {
-- return(1);
-- }
--#endif /* YUKON_DBG */
--
-- } while ((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31);
--
-- return(0);
--} /* SkI2cWait */
--
--
--/*
-- * waits for a completion of an I2C transfer
-- *
-- * Returns
-- * Nothing
-- */
--void SkI2cWaitIrq(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC) /* I/O Context */
--{
-- SK_SENSOR *pSen;
-- SK_U64 StartTime;
-- SK_U32 IrqSrc;
--
-- pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
--
-- if (pSen->SenState == SK_SEN_IDLE) {
-- return;
-- }
--
-- StartTime = SkOsGetTime(pAC);
--
-- do {
-- if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) {
--
-- SK_I2C_STOP(IoC);
--#ifndef SK_DIAG
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E016, SKERR_I2C_E016MSG);
--#endif /* !SK_DIAG */
-- return;
-- }
--
-- SK_IN32(IoC, B0_ISRC, &IrqSrc);
--
-- } while ((IrqSrc & IS_I2C_READY) == 0);
--
-- pSen->SenState = SK_SEN_IDLE;
-- return;
--} /* SkI2cWaitIrq */
--
--/*
-- * writes a single byte or 4 bytes into the I2C device
-- *
-- * returns 0: success
-- * 1: error
-- */
--int SkI2cWrite(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context */
--SK_U32 I2cData, /* I2C Data to write */
--int I2cDev, /* I2C Device Address */
--int I2cDevSize, /* I2C Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
--int I2cReg, /* I2C Device Register Address */
--int I2cBurst) /* I2C Burst Flag */
--{
-- SK_OUT32(IoC, B2_I2C_DATA, I2cData);
--
-- SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cDevSize, I2cReg, I2cBurst);
--
-- return(SkI2cWait(pAC, IoC, I2C_WRITE));
--} /* SkI2cWrite*/
--
--
--#ifdef SK_DIAG
--/*
-- * reads a single byte or 4 bytes from the I2C device
-- *
-- * returns the word read
-- */
--SK_U32 SkI2cRead(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context */
--int I2cDev, /* I2C Device Address */
--int I2cDevSize, /* I2C Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
--int I2cReg, /* I2C Device Register Address */
--int I2cBurst) /* I2C Burst Flag */
--{
-- SK_U32 Data;
--
-- SK_OUT32(IoC, B2_I2C_DATA, 0);
-- SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cDevSize, I2cReg, I2cBurst);
--
-- if (SkI2cWait(pAC, IoC, I2C_READ) != 0) {
-- w_print("%s\n", SKERR_I2C_E002MSG);
-- }
--
-- SK_IN32(IoC, B2_I2C_DATA, &Data);
--
-- return(Data);
--} /* SkI2cRead */
--#endif /* SK_DIAG */
--
--
--/*
-- * read a sensor's value
-- *
-- * This function reads a sensor's value from the I2C sensor chip. The sensor
-- * is defined by its index into the sensors database in the struct pAC points
-- * to.
-- * Returns
-- * 1 if the read is completed
-- * 0 if the read must be continued (I2C Bus still allocated)
-- */
--int SkI2cReadSensor(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context */
--SK_SENSOR *pSen) /* Sensor to be read */
--{
-- if (pSen->SenRead != NULL) {
-- return((*pSen->SenRead)(pAC, IoC, pSen));
-- }
-- else {
-- return(0); /* no success */
-- }
--} /* SkI2cReadSensor */
--
--/*
-- * Do the Init state 0 initialization
-- */
--static int SkI2cInit0(
--SK_AC *pAC) /* Adapter Context */
--{
-- int i;
--
-- /* Begin with first sensor */
-- pAC->I2c.CurrSens = 0;
--
-- /* Begin with timeout control for state machine */
-- pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
--
-- /* Set sensor number to zero */
-- pAC->I2c.MaxSens = 0;
--
--#ifndef SK_DIAG
-- /* Initialize Number of Dummy Reads */
-- pAC->I2c.DummyReads = SK_MAX_SENSORS;
--#endif
--
-- for (i = 0; i < SK_MAX_SENSORS; i++) {
-- pAC->I2c.SenTable[i].SenDesc = "unknown";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_UNKNOWN;
-- pAC->I2c.SenTable[i].SenThreErrHigh = 0;
-- pAC->I2c.SenTable[i].SenThreErrLow = 0;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = 0;
-- pAC->I2c.SenTable[i].SenThreWarnLow = 0;
-- pAC->I2c.SenTable[i].SenReg = LM80_FAN2_IN;
-- pAC->I2c.SenTable[i].SenInit = SK_SEN_DYN_INIT_NONE;
-- pAC->I2c.SenTable[i].SenValue = 0;
-- pAC->I2c.SenTable[i].SenErrFlag = SK_SEN_ERR_NOT_PRESENT;
-- pAC->I2c.SenTable[i].SenErrCts = 0;
-- pAC->I2c.SenTable[i].SenBegErrTS = 0;
-- pAC->I2c.SenTable[i].SenState = SK_SEN_IDLE;
-- pAC->I2c.SenTable[i].SenRead = NULL;
-- pAC->I2c.SenTable[i].SenDev = 0;
-- }
--
-- /* Now we are "INIT data"ed */
-- pAC->I2c.InitLevel = SK_INIT_DATA;
-- return(0);
--} /* SkI2cInit0*/
--
--
--/*
-- * Do the init state 1 initialization
-- *
-- * initialize the following register of the LM80:
-- * Configuration register:
-- * - START, noINT, activeLOW, noINT#Clear, noRESET, noCI, noGPO#, noINIT
-- *
-- * Interrupt Mask Register 1:
-- * - all interrupts are Disabled (0xff)
-- *
-- * Interrupt Mask Register 2:
-- * - all interrupts are Disabled (0xff) Interrupt modi doesn't matter.
-- *
-- * Fan Divisor/RST_OUT register:
-- * - Divisors set to 1 (bits 00), all others 0s.
-- *
-- * OS# Configuration/Temperature resolution Register:
-- * - all 0s
-- *
-- */
--static int SkI2cInit1(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC) /* I/O Context */
--{
-- int i;
-- SK_U8 I2cSwCtrl;
-- SK_GEPORT *pPrt; /* GIni Port struct pointer */
--
-- if (pAC->I2c.InitLevel != SK_INIT_DATA) {
-- /* ReInit not needed in I2C module */
-- return(0);
-- }
--
-- /* Set the Direction of I2C-Data Pin to IN */
-- SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR | I2C_DATA);
-- /* Check for 32-Bit Yukon with Low at I2C-Data Pin */
-- SK_I2C_GET_SW(IoC, &I2cSwCtrl);
--
-- if ((I2cSwCtrl & I2C_DATA) == 0) {
-- /* this is a 32-Bit board */
-- pAC->GIni.GIYukon32Bit = SK_TRUE;
-- return(0);
-- }
--
-- /* Check for 64 Bit Yukon without sensors */
-- if (SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_CFG, 0) != 0) {
-- return(0);
-- }
--
-- (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_1, 0);
--
-- (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_2, 0);
--
-- (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_FAN_CTRL, 0);
--
-- (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_TEMP_CTRL, 0);
--
-- (void)SkI2cWrite(pAC, IoC, (SK_U32)LM80_CFG_START, LM80_ADDR, I2C_025K_DEV,
-- LM80_CFG, 0);
--
-- /*
-- * MaxSens has to be updated here, because PhyType is not
-- * set when performing Init Level 0
-- */
-- pAC->I2c.MaxSens = 5;
--
-- pPrt = &pAC->GIni.GP[0];
--
-- if (pAC->GIni.GIGenesis) {
-- if (pPrt->PhyType == SK_PHY_BCOM) {
-- if (pAC->GIni.GIMacsFound == 1) {
-- pAC->I2c.MaxSens += 1;
-- }
-- else {
-- pAC->I2c.MaxSens += 3;
-- }
-- }
-- }
-- else {
-- pAC->I2c.MaxSens += 3;
-- }
--
-- for (i = 0; i < pAC->I2c.MaxSens; i++) {
-- switch (i) {
-- case 0:
-- pAC->I2c.SenTable[i].SenDesc = "Temperature";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_TEMP;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_TEMP_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_TEMP_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_TEMP_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_TEMP_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_TEMP_IN;
-- break;
-- case 1:
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PCI";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PCI_5V_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PCI_5V_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PCI_5V_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PCI_5V_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT0_IN;
-- break;
-- case 2:
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PCI-IO";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PCI_IO_5V_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PCI_IO_5V_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PCI_IO_3V3_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PCI_IO_3V3_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT1_IN;
-- pAC->I2c.SenTable[i].SenInit = SK_SEN_DYN_INIT_PCI_IO;
-- break;
-- case 3:
-- pAC->I2c.SenTable[i].SenDesc = "Voltage ASIC";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_VDD_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_VDD_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_VDD_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_VDD_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT2_IN;
-- break;
-- case 4:
-- if (pAC->GIni.GIGenesis) {
-- if (pPrt->PhyType == SK_PHY_BCOM) {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PHY A PLL";
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-- }
-- else {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PMA";
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-- }
-- }
-- else {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage VAUX";
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_VAUX_3V3_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_VAUX_3V3_HIGH_WARN;
-- if (pAC->GIni.GIVauxAvail) {
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_VAUX_3V3_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_VAUX_3V3_LOW_ERR;
-- }
-- else {
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_VAUX_0V_WARN_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_VAUX_0V_WARN_ERR;
-- }
-- }
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT3_IN;
-- break;
-- case 5:
-- if (pAC->GIni.GIGenesis) {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PHY 2V5";
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PHY_2V5_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PHY_2V5_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PHY_2V5_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR;
-- }
-- else {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage Core 1V5";
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_CORE_1V5_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_CORE_1V5_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_CORE_1V5_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_CORE_1V5_LOW_ERR;
-- }
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT4_IN;
-- break;
-- case 6:
-- if (pAC->GIni.GIGenesis) {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PHY B PLL";
-- }
-- else {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PHY 3V3";
-- }
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT5_IN;
-- break;
-- case 7:
-- if (pAC->GIni.GIGenesis) {
-- pAC->I2c.SenTable[i].SenDesc = "Speed Fan";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_FAN;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_FAN_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_FAN_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_FAN_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_FAN_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_FAN2_IN;
-- }
-- else {
-- pAC->I2c.SenTable[i].SenDesc = "Voltage PHY 2V5";
-- pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT;
-- pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_PHY_2V5_HIGH_ERR;
-- pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_PHY_2V5_HIGH_WARN;
-- pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_PHY_2V5_LOW_WARN;
-- pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR;
-- pAC->I2c.SenTable[i].SenReg = LM80_VT6_IN;
-- }
-- break;
-- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_INIT | SK_ERRCL_SW,
-- SKERR_I2C_E001, SKERR_I2C_E001MSG);
-- break;
-- }
--
-- pAC->I2c.SenTable[i].SenValue = 0;
-- pAC->I2c.SenTable[i].SenErrFlag = SK_SEN_ERR_OK;
-- pAC->I2c.SenTable[i].SenErrCts = 0;
-- pAC->I2c.SenTable[i].SenBegErrTS = 0;
-- pAC->I2c.SenTable[i].SenState = SK_SEN_IDLE;
-- pAC->I2c.SenTable[i].SenRead = SkLm80ReadSensor;
-- pAC->I2c.SenTable[i].SenDev = LM80_ADDR;
-- }
--
--#ifndef SK_DIAG
-- pAC->I2c.DummyReads = pAC->I2c.MaxSens;
--#endif /* !SK_DIAG */
--
-- /* Clear I2C IRQ */
-- SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
--
-- /* Now we are I/O initialized */
-- pAC->I2c.InitLevel = SK_INIT_IO;
-- return(0);
--} /* SkI2cInit1 */
--
--
--/*
-- * Init level 2: Start first sensor read.
-- */
--static int SkI2cInit2(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC) /* I/O Context */
--{
-- int ReadComplete;
-- SK_SENSOR *pSen;
--
-- if (pAC->I2c.InitLevel != SK_INIT_IO) {
-- /* ReInit not needed in I2C module */
-- /* Init0 and Init2 not permitted */
-- return(0);
-- }
--
-- pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-- ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
--
-- if (ReadComplete) {
-- SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, SKERR_I2C_E008MSG);
-- }
--
-- /* Now we are correctly initialized */
-- pAC->I2c.InitLevel = SK_INIT_RUN;
--
-- return(0);
--} /* SkI2cInit2*/
--
--
--/*
-- * Initialize I2C devices
-- *
-- * Get the first voltage value and discard it.
-- * Go into temperature read mode. A default pointer is not set.
-- *
-- * The things to be done depend on the init level in the parameter list:
-- * Level 0:
-- * Initialize only the data structures. Do NOT access hardware.
-- * Level 1:
-- * Initialize hardware through SK_IN / SK_OUT commands. Do NOT use interrupts.
-- * Level 2:
-- * Everything is possible. Interrupts may be used from now on.
-- *
-- * return:
-- * 0 = success
-- * other = error.
-- */
--int SkI2cInit(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context needed in levels 1 and 2 */
--int Level) /* Init Level */
--{
--
-- switch (Level) {
-- case SK_INIT_DATA:
-- return(SkI2cInit0(pAC));
-- case SK_INIT_IO:
-- return(SkI2cInit1(pAC, IoC));
-- case SK_INIT_RUN:
-- return(SkI2cInit2(pAC, IoC));
-- default:
-- break;
-- }
--
-- return(0);
--} /* SkI2cInit */
--
--
--#ifndef SK_DIAG
--
--/*
-- * Interrupt service function for the I2C Interface
-- *
-- * Clears the Interrupt source
-- *
-- * Reads the register and check it for sending a trap.
-- *
-- * Starts the timer if necessary.
-- */
--void SkI2cIsr(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC) /* I/O Context */
--{
-- SK_EVPARA Para;
--
-- /* Clear I2C IRQ */
-- SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
--
-- Para.Para64 = 0;
-- SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_IRQ, Para);
--} /* SkI2cIsr */
--
--
--/*
-- * Check this sensors Value against the threshold and send events.
-- */
--static void SkI2cCheckSensor(
--SK_AC *pAC, /* Adapter Context */
--SK_SENSOR *pSen)
--{
-- SK_EVPARA ParaLocal;
-- SK_BOOL TooHigh; /* Is sensor too high? */
-- SK_BOOL TooLow; /* Is sensor too low? */
-- SK_U64 CurrTime; /* Current Time */
-- SK_BOOL DoTrapSend; /* We need to send a trap */
-- SK_BOOL DoErrLog; /* We need to log the error */
-- SK_BOOL IsError; /* We need to log the error */
--
-- /* Check Dummy Reads first */
-- if (pAC->I2c.DummyReads > 0) {
-- pAC->I2c.DummyReads--;
-- return;
-- }
--
-- /* Get the current time */
-- CurrTime = SkOsGetTime(pAC);
--
-- /* Set para to the most useful setting: The current sensor. */
-- ParaLocal.Para64 = (SK_U64)pAC->I2c.CurrSens;
--
-- /* Check the Value against the thresholds. First: Error Thresholds */
-- TooHigh = (pSen->SenValue > pSen->SenThreErrHigh);
-- TooLow = (pSen->SenValue < pSen->SenThreErrLow);
--
-- IsError = SK_FALSE;
-- if (TooHigh || TooLow) {
-- /* Error condition is satisfied */
-- DoTrapSend = SK_TRUE;
-- DoErrLog = SK_TRUE;
--
-- /* Now error condition is satisfied */
-- IsError = SK_TRUE;
--
-- if (pSen->SenErrFlag == SK_SEN_ERR_ERR) {
-- /* This state is the former one */
--
-- /* So check first whether we have to send a trap */
-- if (pSen->SenLastErrTrapTS + SK_SEN_ERR_TR_HOLD >
-- CurrTime) {
-- /*
-- * Do NOT send the Trap. The hold back time
-- * has to run out first.
-- */
-- DoTrapSend = SK_FALSE;
-- }
--
-- /* Check now whether we have to log an Error */
-- if (pSen->SenLastErrLogTS + SK_SEN_ERR_LOG_HOLD >
-- CurrTime) {
-- /*
-- * Do NOT log the error. The hold back time
-- * has to run out first.
-- */
-- DoErrLog = SK_FALSE;
-- }
-- }
-- else {
-- /* We came from a different state -> Set Begin Time Stamp */
-- pSen->SenBegErrTS = CurrTime;
-- pSen->SenErrFlag = SK_SEN_ERR_ERR;
-- }
--
-- if (DoTrapSend) {
-- /* Set current Time */
-- pSen->SenLastErrTrapTS = CurrTime;
-- pSen->SenErrCts++;
--
-- /* Queue PNMI Event */
-- SkEventQueue(pAC, SKGE_PNMI, (TooHigh ?
-- SK_PNMI_EVT_SEN_ERR_UPP :
-- SK_PNMI_EVT_SEN_ERR_LOW),
-- ParaLocal);
-- }
--
-- if (DoErrLog) {
-- /* Set current Time */
-- pSen->SenLastErrLogTS = CurrTime;
--
-- if (pSen->SenType == SK_SEN_TEMP) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E011, SKERR_I2C_E011MSG);
-- }
-- else if (pSen->SenType == SK_SEN_VOLT) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E012, SKERR_I2C_E012MSG);
-- }
-- else {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E015, SKERR_I2C_E015MSG);
-- }
-- }
-- }
--
-- /* Check the Value against the thresholds */
-- /* 2nd: Warning thresholds */
-- TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh);
-- TooLow = (pSen->SenValue < pSen->SenThreWarnLow);
--
-- if (!IsError && (TooHigh || TooLow)) {
-- /* Error condition is satisfied */
-- DoTrapSend = SK_TRUE;
-- DoErrLog = SK_TRUE;
--
-- if (pSen->SenErrFlag == SK_SEN_ERR_WARN) {
-- /* This state is the former one */
--
-- /* So check first whether we have to send a trap */
-- if (pSen->SenLastWarnTrapTS + SK_SEN_WARN_TR_HOLD > CurrTime) {
-- /*
-- * Do NOT send the Trap. The hold back time
-- * has to run out first.
-- */
-- DoTrapSend = SK_FALSE;
-- }
--
-- /* Check now whether we have to log an Error */
-- if (pSen->SenLastWarnLogTS + SK_SEN_WARN_LOG_HOLD > CurrTime) {
-- /*
-- * Do NOT log the error. The hold back time
-- * has to run out first.
-- */
-- DoErrLog = SK_FALSE;
-- }
-- }
-- else {
-- /* We came from a different state -> Set Begin Time Stamp */
-- pSen->SenBegWarnTS = CurrTime;
-- pSen->SenErrFlag = SK_SEN_ERR_WARN;
-- }
--
-- if (DoTrapSend) {
-- /* Set current Time */
-- pSen->SenLastWarnTrapTS = CurrTime;
-- pSen->SenWarnCts++;
--
-- /* Queue PNMI Event */
-- SkEventQueue(pAC, SKGE_PNMI, (TooHigh ?
-- SK_PNMI_EVT_SEN_WAR_UPP :
-- SK_PNMI_EVT_SEN_WAR_LOW),
-- ParaLocal);
-- }
--
-- if (DoErrLog) {
-- /* Set current Time */
-- pSen->SenLastWarnLogTS = CurrTime;
--
-- if (pSen->SenType == SK_SEN_TEMP) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SKERR_I2C_E009MSG);
-- }
-- else if (pSen->SenType == SK_SEN_VOLT) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, SKERR_I2C_E010MSG);
-- }
-- else {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, SKERR_I2C_E014MSG);
-- }
-- }
-- }
--
-- /* Check for NO error at all */
-- if (!IsError && !TooHigh && !TooLow) {
-- /* Set o.k. Status if no error and no warning condition */
-- pSen->SenErrFlag = SK_SEN_ERR_OK;
-- }
--
-- /* End of check against the thresholds */
--
-- /* Bug fix AF: 16.Aug.2001: Correct the init base
-- * of LM80 sensor.
-- */
-- if (pSen->SenInit == SK_SEN_DYN_INIT_PCI_IO) {
--
-- pSen->SenInit = SK_SEN_DYN_INIT_NONE;
--
-- if (pSen->SenValue > SK_SEN_PCI_IO_RANGE_LIMITER) {
-- /* 5V PCI-IO Voltage */
-- pSen->SenThreWarnLow = SK_SEN_PCI_IO_5V_LOW_WARN;
-- pSen->SenThreErrLow = SK_SEN_PCI_IO_5V_LOW_ERR;
-- }
-- else {
-- /* 3.3V PCI-IO Voltage */
-- pSen->SenThreWarnHigh = SK_SEN_PCI_IO_3V3_HIGH_WARN;
-- pSen->SenThreErrHigh = SK_SEN_PCI_IO_3V3_HIGH_ERR;
-- }
-- }
--
--#ifdef TEST_ONLY
-- /* Dynamic thresholds also for VAUX of LM80 sensor */
-- if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) {
--
-- pSen->SenInit = SK_SEN_DYN_INIT_NONE;
--
-- /* 3.3V VAUX Voltage */
-- if (pSen->SenValue > SK_SEN_VAUX_RANGE_LIMITER) {
-- pSen->SenThreWarnLow = SK_SEN_VAUX_3V3_LOW_WARN;
-- pSen->SenThreErrLow = SK_SEN_VAUX_3V3_LOW_ERR;
-- }
-- /* 0V VAUX Voltage */
-- else {
-- pSen->SenThreWarnHigh = SK_SEN_VAUX_0V_WARN_ERR;
-- pSen->SenThreErrHigh = SK_SEN_VAUX_0V_WARN_ERR;
-- }
-- }
--
-- /*
-- * Check initialization state:
-- * The VIO Thresholds need adaption
-- */
-- if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN &&
-- pSen->SenValue > SK_SEN_WARNLOW2C &&
-- pSen->SenValue < SK_SEN_WARNHIGH2) {
-- pSen->SenThreErrLow = SK_SEN_ERRLOW2C;
-- pSen->SenThreWarnLow = SK_SEN_WARNLOW2C;
-- pSen->SenInit = SK_TRUE;
-- }
--
-- if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN &&
-- pSen->SenValue > SK_SEN_WARNLOW2 &&
-- pSen->SenValue < SK_SEN_WARNHIGH2C) {
-- pSen->SenThreErrHigh = SK_SEN_ERRHIGH2C;
-- pSen->SenThreWarnHigh = SK_SEN_WARNHIGH2C;
-- pSen->SenInit = SK_TRUE;
-- }
--#endif
--
-- if (pSen->SenInit != SK_SEN_DYN_INIT_NONE) {
-- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG);
-- }
--} /* SkI2cCheckSensor */
--
--
--/*
-- * The only Event to be served is the timeout event
-- *
-- */
--int SkI2cEvent(
--SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* I/O Context */
--SK_U32 Event, /* Module specific Event */
--SK_EVPARA Para) /* Event specific Parameter */
--{
-- int ReadComplete;
-- SK_SENSOR *pSen;
-- SK_U32 Time;
-- SK_EVPARA ParaLocal;
-- int i;
--
-- /* New case: no sensors */
-- if (pAC->I2c.MaxSens == 0) {
-- return(0);
-- }
--
-- switch (Event) {
-- case SK_I2CEV_IRQ:
-- pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-- ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
--
-- if (ReadComplete) {
-- /* Check sensor against defined thresholds */
-- SkI2cCheckSensor(pAC, pSen);
--
-- /* Increment Current sensor and set appropriate Timeout */
-- pAC->I2c.CurrSens++;
-- if (pAC->I2c.CurrSens >= pAC->I2c.MaxSens) {
-- pAC->I2c.CurrSens = 0;
-- Time = SK_I2C_TIM_LONG;
-- }
-- else {
-- Time = SK_I2C_TIM_SHORT;
-- }
--
-- /* Start Timer */
-- ParaLocal.Para64 = (SK_U64)0;
--
-- pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
--
-- SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-- SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-- }
-- else {
-- /* Start Timer */
-- ParaLocal.Para64 = (SK_U64)0;
--
-- pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
--
-- SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH,
-- SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-- }
-- break;
-- case SK_I2CEV_TIM:
-- if (pAC->I2c.TimerMode == SK_TIMER_NEW_GAUGING) {
--
-- ParaLocal.Para64 = (SK_U64)0;
-- SkTimerStop(pAC, IoC, &pAC->I2c.SenTimer);
--
-- pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-- ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
--
-- if (ReadComplete) {
-- /* Check sensor against defined thresholds */
-- SkI2cCheckSensor(pAC, pSen);
--
-- /* Increment Current sensor and set appropriate Timeout */
-- pAC->I2c.CurrSens++;
-- if (pAC->I2c.CurrSens == pAC->I2c.MaxSens) {
-- pAC->I2c.CurrSens = 0;
-- Time = SK_I2C_TIM_LONG;
-- }
-- else {
-- Time = SK_I2C_TIM_SHORT;
-- }
--
-- /* Start Timer */
-- ParaLocal.Para64 = (SK_U64)0;
--
-- pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
--
-- SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-- SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-- }
-- }
-- else {
-- pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-- pSen->SenErrFlag = SK_SEN_ERR_FAULTY;
-- SK_I2C_STOP(IoC);
--
-- /* Increment Current sensor and set appropriate Timeout */
-- pAC->I2c.CurrSens++;
-- if (pAC->I2c.CurrSens == pAC->I2c.MaxSens) {
-- pAC->I2c.CurrSens = 0;
-- Time = SK_I2C_TIM_LONG;
-- }
-- else {
-- Time = SK_I2C_TIM_SHORT;
-- }
--
-- /* Start Timer */
-- ParaLocal.Para64 = (SK_U64)0;
--
-- pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
--
-- SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-- SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-- }
-- break;
-- case SK_I2CEV_CLEAR:
-- for (i = 0; i < SK_MAX_SENSORS; i++) {
-- pAC->I2c.SenTable[i].SenErrFlag = SK_SEN_ERR_OK;
-- pAC->I2c.SenTable[i].SenErrCts = 0;
-- pAC->I2c.SenTable[i].SenWarnCts = 0;
-- pAC->I2c.SenTable[i].SenBegErrTS = 0;
-- pAC->I2c.SenTable[i].SenBegWarnTS = 0;
-- pAC->I2c.SenTable[i].SenLastErrTrapTS = (SK_U64)0;
-- pAC->I2c.SenTable[i].SenLastErrLogTS = (SK_U64)0;
-- pAC->I2c.SenTable[i].SenLastWarnTrapTS = (SK_U64)0;
-- pAC->I2c.SenTable[i].SenLastWarnLogTS = (SK_U64)0;
-- }
-- break;
-- default:
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E006, SKERR_I2C_E006MSG);
-- }
--
-- return(0);
--} /* SkI2cEvent*/
--
--#endif /* !SK_DIAG */
-diff -Nurap ./drivers/net/sk98lin.sk98/sklm80.c ./drivers/net/sk98lin/sklm80.c
---- ./drivers/net/sk98lin.sk98/sklm80.c 2004-10-19 01:55:06.000000000 +0400
-+++ ./drivers/net/sk98lin/sklm80.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: sklm80.c
- * Project: Gigabit Ethernet Adapters, TWSI-Module
-- * Version: $Revision: 1.22 $
-- * Date: $Date: 2003/10/20 09:08:21 $
-+ * Version: $Revision: 1.1 $
-+ * Date: $Date: 2003/12/19 14:02:31 $
- * Purpose: Functions to access Voltage and Temperature Sensor (LM80)
- *
- ******************************************************************************/
-@@ -27,7 +27,7 @@
- */
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: sklm80.c,v 1.22 2003/10/20 09:08:21 rschmidt Exp $ (C) Marvell. ";
-+ "@(#) $Id: sklm80.c,v 1.1 2003/12/19 14:02:31 mschmid Exp $ (C) Marvell. ";
- #endif
-
- #include "h/skdrv1st.h" /* Driver Specific Definitions */
-@@ -111,12 +111,12 @@ int Reg) /* register to read */
- /*
- * read a sensors value (LM80 specific)
- *
-- * This function reads a sensors value from the I2C sensor chip LM80.
-+ * This function reads a sensors value from the TWSI sensor chip LM80.
- * The sensor is defined by its index into the sensors database in the struct
- * pAC points to.
- *
- * Returns 1 if the read is completed
-- * 0 if the read must be continued (I2C Bus still allocated)
-+ * 0 if the read must be continued (TWSI Bus still allocated)
- */
- int SkLm80ReadSensor(
- SK_AC *pAC, /* Adapter Context */
-diff -Nurap ./drivers/net/sk98lin.sk98/skproc.c ./drivers/net/sk98lin/skproc.c
---- ./drivers/net/sk98lin.sk98/skproc.c 2004-10-19 01:53:11.000000000 +0400
-+++ ./drivers/net/sk98lin/skproc.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,28 +2,34 @@
- *
- * Name: skproc.c
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.11 $
-- * Date: $Date: 2003/12/11 16:03:57 $
-- * Purpose: Funktions to display statictic data
-+ * Version: $Revision: 1.14.2.4 $
-+ * Date: $Date: 2005/05/23 13:47:33 $
-+ * Purpose: Functions to display statictic data
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
-+ *
-+ * Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
-+ * Server Adapters.
-+ *
-+ * Author: Ralph Roesler (rroesler@syskonnect.de)
-+ * Mirko Lindner (mlindner@syskonnect.de)
-+ *
-+ * Address all question to: linux@syskonnect.de
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
-- * Created 22-Nov-2000
-- * Author: Mirko Lindner (mlindner@syskonnect.de)
-- *
- * The information in this file is provided "AS IS" without warranty.
- *
-- ******************************************************************************/
-+ *****************************************************************************/
-+
- #include <linux/proc_fs.h>
- #include <linux/seq_file.h>
-
-@@ -32,9 +38,16 @@
- #include "h/skversion.h"
-
- extern struct SK_NET_DEVICE *SkGeRootDev;
-+
-+/******************************************************************************
-+ *
-+ * Local Function Prototypes and Local Variables
-+ *
-+ *****************************************************************************/
-+
- static int sk_proc_print(void *writePtr, char *format, ...);
- static void sk_gen_browse(void *buffer);
--int len;
-+static int len;
-
- static int sk_seq_show(struct seq_file *seq, void *v);
- static int sk_proc_open(struct inode *inode, struct file *file);
-@@ -52,16 +65,18 @@ struct net_device *currDev = NULL;
- * sk_gen_browse -generic print "summaries" entry
- *
- * Description:
-- * This function fills the proc entry with statistic data about
-- * the ethernet device.
-+ * This function fills the proc entry with statistic data about
-+ * the ethernet device.
- *
-- * Returns: -
-+ * Returns: N/A
- *
- */
--static void sk_gen_browse(void *buffer)
-+static void sk_gen_browse(
-+void *buffer) /* buffer where the statistics will be stored in */
- {
- struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev;
- struct SK_NET_DEVICE *next;
-+ SK_BOOL DisableStatistic = 0;
- SK_PNMI_STRUCT_DATA *pPnmiStruct;
- SK_PNMI_STAT *pPnmiStat;
- unsigned long Flags;
-@@ -69,6 +84,7 @@ static void sk_gen_browse(void *buffer)
- DEV_NET *pNet;
- SK_AC *pAC;
- char sens_msg[50];
-+ int card_type;
- int MaxSecurityCount = 0;
- int t;
- int i;
-@@ -91,7 +107,7 @@ static void sk_gen_browse(void *buffer)
-
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- Size = SK_PNMI_STRUCT_SIZE;
--#ifdef SK_DIAG_SUPPORT
-+ DisableStatistic = 0;
- if (pAC->BoardLevel == SK_INIT_DATA) {
- SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA));
- if (pAC->DiagModeActive == DIAG_NOTACTIVE) {
-@@ -100,13 +116,13 @@ static void sk_gen_browse(void *buffer)
- } else {
- SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1);
- }
--#else
-- SkPnmiGetStruct(pAC, pAC->IoBase,
-- pPnmiStruct, &Size, t-1);
--#endif
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
--
- if (strcmp(pAC->dev[t-1]->name, currDev->name) == 0) {
-+ if (!pAC->GIni.GIYukon32Bit)
-+ card_type = 64;
-+ else
-+ card_type = 32;
-+
- pPnmiStat = &pPnmiStruct->Stat[0];
- len = sk_proc_print(buffer,
- "\nDetailed statistic for device %s\n",
-@@ -118,6 +134,17 @@ static void sk_gen_browse(void *buffer)
- len += sk_proc_print(buffer,
- "\nBoard statistics\n\n");
- len += sk_proc_print(buffer,
-+ "Card name %s\n",
-+ pAC->DeviceStr);
-+ len += sk_proc_print(buffer,
-+ "Vendor/Device ID %x/%x\n",
-+ pAC->PciDev->vendor,
-+ pAC->PciDev->device);
-+ len += sk_proc_print(buffer,
-+ "Card type (Bit) %d\n",
-+ card_type);
-+
-+ len += sk_proc_print(buffer,
- "Active Port %c\n",
- 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
- Net[t-1].PrefPort]->PortNumber);
-@@ -126,177 +153,239 @@ static void sk_gen_browse(void *buffer)
- 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
- Net[t-1].PrefPort]->PortNumber);
-
-- len += sk_proc_print(buffer,
-- "Bus speed (MHz) %d\n",
-- pPnmiStruct->BusSpeed);
--
-- len += sk_proc_print(buffer,
-- "Bus width (Bit) %d\n",
-- pPnmiStruct->BusWidth);
-- len += sk_proc_print(buffer,
-- "Driver version %s\n",
-- VER_STRING);
-- len += sk_proc_print(buffer,
-- "Hardware revision v%d.%d\n",
-- (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
-- pAC->GIni.GIPciHwRev & 0x0F);
--
-- /* Print sensor informations */
-- for (i=0; i < pAC->I2c.MaxSens; i ++) {
-- /* Check type */
-- switch (pAC->I2c.SenTable[i].SenType) {
-- case 1:
-- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-- strcat(sens_msg, " (C)");
-- len += sk_proc_print(buffer,
-- "%-25s %d.%02d\n",
-- sens_msg,
-- pAC->I2c.SenTable[i].SenValue / 10,
-- pAC->I2c.SenTable[i].SenValue % 10);
-+ if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) {
-+ len += sk_proc_print(buffer,
-+ "Interrupt Moderation static (%d ints/sec)\n",
-+ pAC->DynIrqModInfo.MaxModIntsPerSec);
-+ } else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
-+ len += sk_proc_print(buffer,
-+ "Interrupt Moderation dynamic (%d ints/sec)\n",
-+ pAC->DynIrqModInfo.MaxModIntsPerSec);
-+ } else {
-+ len += sk_proc_print(buffer,
-+ "Interrupt Moderation disabled\n");
-+ }
-
-- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-- strcat(sens_msg, " (F)");
-+ if (pAC->GIni.GIPciBus == SK_PEX_BUS) {
-+ len += sk_proc_print(buffer,
-+ "Bus type PCI-Express\n");
-+ len += sk_proc_print(buffer,
-+ "Bus width (Lanes) %d\n",
-+ pAC->GIni.GIPexWidth);
-+ } else {
-+ if (pAC->GIni.GIPciBus == SK_PCIX_BUS) {
- len += sk_proc_print(buffer,
-- "%-25s %d.%02d\n",
-- sens_msg,
-- ((((pAC->I2c.SenTable[i].SenValue)
-- *10)*9)/5 + 3200)/100,
-- ((((pAC->I2c.SenTable[i].SenValue)
-- *10)*9)/5 + 3200) % 10);
-- break;
-- case 2:
-- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-- strcat(sens_msg, " (V)");
-+ "Bus type PCI-X\n");
-+ if (pAC->GIni.GIPciMode == PCI_OS_SPD_X133) {
-+ len += sk_proc_print(buffer,
-+ "Bus speed (MHz) 133\n");
-+ } else if (pAC->GIni.GIPciMode == PCI_OS_SPD_X100) {
-+ len += sk_proc_print(buffer,
-+ "Bus speed (MHz) 100\n");
-+ } else if (pAC->GIni.GIPciMode == PCI_OS_SPD_X66) {
-+ len += sk_proc_print(buffer,
-+ "Bus speed (MHz) 66\n");
-+ } else {
-+ len += sk_proc_print(buffer,
-+ "Bus speed (MHz) 33\n");
-+ }
-+ } else {
- len += sk_proc_print(buffer,
-- "%-25s %d.%03d\n",
-- sens_msg,
-- pAC->I2c.SenTable[i].SenValue / 1000,
-- pAC->I2c.SenTable[i].SenValue % 1000);
-- break;
-- case 3:
-- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-- strcat(sens_msg, " (rpm)");
-+ "Bus type PCI\n");
- len += sk_proc_print(buffer,
-- "%-25s %d\n",
-- sens_msg,
-- pAC->I2c.SenTable[i].SenValue);
-- break;
-- default:
-- break;
-+ "Bus speed (MHz) %d\n",
-+ pPnmiStruct->BusSpeed);
- }
-+ len += sk_proc_print(buffer,
-+ "Bus width (Bit) %d\n",
-+ pPnmiStruct->BusWidth);
- }
--
-- /*Receive statistics */
-- len += sk_proc_print(buffer,
-- "\nReceive statistics\n\n");
-
- len += sk_proc_print(buffer,
-- "Received bytes %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
-- len += sk_proc_print(buffer,
-- "Received packets %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxOkCts);
--#if 0
-- if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
-- pAC->HWRevision < 12) {
-- pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
-- pPnmiStat->StatRxShortsCts;
-- pPnmiStat->StatRxShortsCts = 0;
-- }
--#endif
-- if (pNet->Mtu > 1500)
-- pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
-- pPnmiStat->StatRxTooLongCts;
--
-- len += sk_proc_print(buffer,
-- "Receive errors %Lu\n",
-- (unsigned long long) pPnmiStruct->InErrorsCts);
-- len += sk_proc_print(buffer,
-- "Receive dropped %Lu\n",
-- (unsigned long long) pPnmiStruct->RxNoBufCts);
-+ "Driver version %s (%s)\n",
-+ VER_STRING, PATCHLEVEL);
- len += sk_proc_print(buffer,
-- "Received multicast %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
-+ "Driver release date %s\n",
-+ pAC->Pnmi.pDriverReleaseDate);
- len += sk_proc_print(buffer,
-- "Receive error types\n");
-- len += sk_proc_print(buffer,
-- " length %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxRuntCts);
-- len += sk_proc_print(buffer,
-- " buffer overflow %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
-- len += sk_proc_print(buffer,
-- " bad crc %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxFcsCts);
-- len += sk_proc_print(buffer,
-- " framing %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxFramingCts);
-- len += sk_proc_print(buffer,
-- " missed frames %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxMissedCts);
--
-- if (pNet->Mtu > 1500)
-- pPnmiStat->StatRxTooLongCts = 0;
-+ "Hardware revision v%d.%d\n",
-+ (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
-+ pAC->GIni.GIPciHwRev & 0x0F);
-
-- len += sk_proc_print(buffer,
-- " too long %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxTooLongCts);
-- len += sk_proc_print(buffer,
-- " carrier extension %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxCextCts);
-- len += sk_proc_print(buffer,
-- " too short %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxShortsCts);
-- len += sk_proc_print(buffer,
-- " symbol %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxSymbolCts);
-- len += sk_proc_print(buffer,
-- " LLC MAC size %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxIRLengthCts);
-- len += sk_proc_print(buffer,
-- " carrier event %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxCarrierCts);
-- len += sk_proc_print(buffer,
-- " jabber %Lu\n",
-- (unsigned long long) pPnmiStat->StatRxJabberCts);
-+ if (!netif_running(pAC->dev[t-1])) {
-+ len += sk_proc_print(buffer,
-+ "\n Device %s is down.\n"
-+ " Therefore no statistics are available.\n"
-+ " After bringing the device up (ifconfig)"
-+ " statistics will\n"
-+ " be displayed.\n",
-+ pAC->dev[t-1]->name);
-+ DisableStatistic = 1;
-+ }
-
-+ /* Display only if statistic info available */
-+ /* Print sensor informations */
-+ if (!DisableStatistic) {
-+ for (i=0; i < pAC->I2c.MaxSens; i ++) {
-+ /* Check type */
-+ switch (pAC->I2c.SenTable[i].SenType) {
-+ case 1:
-+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-+ strcat(sens_msg, " (C)");
-+ len += sk_proc_print(buffer,
-+ "%-25s %d.%02d\n",
-+ sens_msg,
-+ pAC->I2c.SenTable[i].SenValue / 10,
-+ pAC->I2c.SenTable[i].SenValue %
-+ 10);
-+
-+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-+ strcat(sens_msg, " (F)");
-+ len += sk_proc_print(buffer,
-+ "%-25s %d.%02d\n",
-+ sens_msg,
-+ ((((pAC->I2c.SenTable[i].SenValue)
-+ *10)*9)/5 + 3200)/100,
-+ ((((pAC->I2c.SenTable[i].SenValue)
-+ *10)*9)/5 + 3200) % 10);
-+ break;
-+ case 2:
-+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-+ strcat(sens_msg, " (V)");
-+ len += sk_proc_print(buffer,
-+ "%-25s %d.%03d\n",
-+ sens_msg,
-+ pAC->I2c.SenTable[i].SenValue / 1000,
-+ pAC->I2c.SenTable[i].SenValue % 1000);
-+ break;
-+ case 3:
-+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
-+ strcat(sens_msg, " (rpm)");
-+ len += sk_proc_print(buffer,
-+ "%-25s %d\n",
-+ sens_msg,
-+ pAC->I2c.SenTable[i].SenValue);
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+
-+ /*Receive statistics */
-+ len += sk_proc_print(buffer,
-+ "\nReceive statistics\n\n");
-+
-+ len += sk_proc_print(buffer,
-+ "Received bytes %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
-+ len += sk_proc_print(buffer,
-+ "Received packets %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxOkCts);
-+#if 0
-+ if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
-+ pAC->HWRevision < 12) {
-+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
-+ pPnmiStat->StatRxShortsCts;
-+ pPnmiStat->StatRxShortsCts = 0;
-+ }
-+#endif
-+ if (pAC->dev[t-1]->mtu > 1500)
-+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
-+ pPnmiStat->StatRxTooLongCts;
-+
-+ len += sk_proc_print(buffer,
-+ "Receive errors %Lu\n",
-+ (unsigned long long) pPnmiStruct->InErrorsCts);
-+ len += sk_proc_print(buffer,
-+ "Receive dropped %Lu\n",
-+ (unsigned long long) pPnmiStruct->RxNoBufCts);
-+ len += sk_proc_print(buffer,
-+ "Received multicast %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
-+#ifdef ADVANCED_STATISTIC_OUTPUT
-+ len += sk_proc_print(buffer,
-+ "Receive error types\n");
-+ len += sk_proc_print(buffer,
-+ " length %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxRuntCts);
-+ len += sk_proc_print(buffer,
-+ " buffer overflow %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
-+ len += sk_proc_print(buffer,
-+ " bad crc %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxFcsCts);
-+ len += sk_proc_print(buffer,
-+ " framing %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxFramingCts);
-+ len += sk_proc_print(buffer,
-+ " missed frames %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxMissedCts);
-+
-+ if (pAC->dev[t-1]->mtu > 1500)
-+ pPnmiStat->StatRxTooLongCts = 0;
-+
-+ len += sk_proc_print(buffer,
-+ " too long %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxTooLongCts);
-+ len += sk_proc_print(buffer,
-+ " carrier extension %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxCextCts);
-+ len += sk_proc_print(buffer,
-+ " too short %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxShortsCts);
-+ len += sk_proc_print(buffer,
-+ " symbol %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxSymbolCts);
-+ len += sk_proc_print(buffer,
-+ " LLC MAC size %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxIRLengthCts);
-+ len += sk_proc_print(buffer,
-+ " carrier event %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxCarrierCts);
-+ len += sk_proc_print(buffer,
-+ " jabber %Lu\n",
-+ (unsigned long long) pPnmiStat->StatRxJabberCts);
-+#endif
-
-- /*Transmit statistics */
-- len += sk_proc_print(buffer,
-- "\nTransmit statistics\n\n");
-+ /*Transmit statistics */
-+ len += sk_proc_print(buffer,
-+ "\nTransmit statistics\n\n");
-
-- len += sk_proc_print(buffer,
-- "Transmited bytes %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
-- len += sk_proc_print(buffer,
-- "Transmited packets %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxOkCts);
-- len += sk_proc_print(buffer,
-- "Transmit errors %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
-- len += sk_proc_print(buffer,
-- "Transmit dropped %Lu\n",
-- (unsigned long long) pPnmiStruct->TxNoBufCts);
-- len += sk_proc_print(buffer,
-- "Transmit collisions %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
-- len += sk_proc_print(buffer,
-- "Transmit error types\n");
-- len += sk_proc_print(buffer,
-- " excessive collision %ld\n",
-- pAC->stats.tx_aborted_errors);
-- len += sk_proc_print(buffer,
-- " carrier %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxCarrierCts);
-- len += sk_proc_print(buffer,
-- " fifo underrun %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
-- len += sk_proc_print(buffer,
-- " heartbeat %Lu\n",
-- (unsigned long long) pPnmiStat->StatTxCarrierCts);
-- len += sk_proc_print(buffer,
-- " window %ld\n",
-- pAC->stats.tx_window_errors);
-+ len += sk_proc_print(buffer,
-+ "Transmitted bytes %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
-+ len += sk_proc_print(buffer,
-+ "Transmitted packets %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxOkCts);
-+ len += sk_proc_print(buffer,
-+ "Transmit errors %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
-+ len += sk_proc_print(buffer,
-+ "Transmit dropped %Lu\n",
-+ (unsigned long long) pPnmiStruct->TxNoBufCts);
-+ len += sk_proc_print(buffer,
-+ "Transmit collisions %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
-+#ifdef ADVANCED_STATISTIC_OUTPUT
-+ len += sk_proc_print(buffer,
-+ "Transmit error types\n");
-+ len += sk_proc_print(buffer,
-+ " excessive collision %ld\n",
-+ pAC->stats.tx_aborted_errors);
-+ len += sk_proc_print(buffer,
-+ " carrier %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxCarrierCts);
-+ len += sk_proc_print(buffer,
-+ " fifo underrun %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
-+ len += sk_proc_print(buffer,
-+ " heartbeat %Lu\n",
-+ (unsigned long long) pPnmiStat->StatTxCarrierCts);
-+ len += sk_proc_print(buffer,
-+ " window %ld\n",
-+ pAC->stats.tx_window_errors);
-+#endif
-+ } /* if (!DisableStatistic) */
-
- } /* if (strcmp(pACname, currDeviceName) == 0) */
- }
-@@ -306,16 +395,20 @@ static void sk_gen_browse(void *buffer)
-
- /*****************************************************************************
- *
-- * sk_proc_print -generic line print
-+ * sk_proc_print - generic line print
- *
- * Description:
-- * This function fills the proc entry with statistic data about
-- * the ethernet device.
-+ * This function fills the proc entry with statistic data about the
-+ * ethernet device.
- *
-- * Returns: number of bytes written
-+ * Returns:
-+ * the number of bytes written
- *
- */
--static int sk_proc_print(void *writePtr, char *format, ...)
-+static int sk_proc_print(
-+void *writePtr, /* the buffer pointer */
-+char *format, /* the format of the string */
-+...) /* variable list of arguments */
- {
- #define MAX_LEN_SINGLE_LINE 256
- char str[MAX_LEN_SINGLE_LINE];
-@@ -341,19 +434,22 @@ static int sk_proc_print(void *writePtr,
- * sk_seq_show - show proc information of a particular adapter
- *
- * Description:
-- * This function fills the proc entry with statistic data about
-- * the ethernet device. It invokes the generic sk_gen_browse() to
-- * print out all items one per one.
-+ * This function fills the proc entry with statistic data about the
-+ * ethernet device. It invokes the generic sk_gen_browse() to print
-+ * out all items one per one.
- *
-- * Returns: number of bytes written
-+ * Returns:
-+ * the number of bytes written
- *
- */
--static int sk_seq_show(struct seq_file *seq, void *v)
-+static int sk_seq_show(
-+struct seq_file *seq, /* the sequence pointer */
-+void *v) /* additional pointer */
- {
-- void *castedBuffer = (void *) seq;
-- currDev = seq->private;
-- sk_gen_browse(castedBuffer);
-- return 0;
-+ void *castedBuffer = (void *) seq;
-+ currDev = seq->private;
-+ sk_gen_browse(castedBuffer);
-+ return 0;
- }
-
- /*****************************************************************************
-@@ -361,14 +457,17 @@ static int sk_seq_show(struct seq_file *
- * sk_proc_open - register the show function when proc is open'ed
- *
- * Description:
-- * This function is called whenever a sk98lin proc file is queried.
-+ * This function is called whenever a sk98lin proc file is queried.
- *
-- * Returns: the return value of single_open()
-+ * Returns:
-+ * the return value of single_open()
- *
- */
--static int sk_proc_open(struct inode *inode, struct file *file)
-+static int sk_proc_open(
-+struct inode *inode, /* the inode of the file */
-+struct file *file) /* the file pointer itself */
- {
-- return single_open(file, sk_seq_show, PDE(inode)->data);
-+ return single_open(file, sk_seq_show, PDE(inode)->data);
- }
-
- /*******************************************************************************
-diff -Nurap ./drivers/net/sk98lin.sk98/skqueue.c ./drivers/net/sk98lin/skqueue.c
---- ./drivers/net/sk98lin.sk98/skqueue.c 2004-10-19 01:53:43.000000000 +0400
-+++ ./drivers/net/sk98lin/skqueue.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skqueue.c
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.20 $
-- * Date: $Date: 2003/09/16 13:44:00 $
-+ * Version: $Revision: 2.3 $
-+ * Date: $Date: 2004/05/14 13:28:18 $
- * Purpose: Management of an event queue.
- *
- ******************************************************************************/
-@@ -28,7 +28,7 @@
- */
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skqueue.c,v 1.20 2003/09/16 13:44:00 rschmidt Exp $ (C) Marvell.";
-+ "@(#) $Id: skqueue.c,v 2.3 2004/05/14 13:28:18 malthoff Exp $ (C) Marvell.";
- #endif
-
- #include "h/skdrv1st.h" /* Driver Specific Definitions */
-@@ -48,10 +48,16 @@ intro()
-
- #define PRINTF(a,b,c)
-
--/*
-- * init event queue management
-+/******************************************************************************
-+ *
-+ * SkEventInit() - init event queue management
- *
-- * Must be called during init level 0.
-+ * Description:
-+ * This function initializes event queue management.
-+ * It must be called during init level 0.
-+ *
-+ * Returns:
-+ * nothing
- */
- void SkEventInit(
- SK_AC *pAC, /* Adapter context */
-@@ -67,8 +73,17 @@ int Level) /* Init level */
- }
- }
-
--/*
-- * add event to queue
-+/******************************************************************************
-+ *
-+ * SkEventQueue() - add event to queue
-+ *
-+ * Description:
-+ * This function adds an event to the event queue.
-+ * At least Init Level 1 is required to queue events,
-+ * but will be scheduled add Init Level 2.
-+ *
-+ * returns:
-+ * nothing
- */
- void SkEventQueue(
- SK_AC *pAC, /* Adapters context */
-@@ -76,26 +91,45 @@ SK_U32 Class, /* Event Class */
- SK_U32 Event, /* Event to be queued */
- SK_EVPARA Para) /* Event parameter */
- {
-- pAC->Event.EvPut->Class = Class;
-- pAC->Event.EvPut->Event = Event;
-- pAC->Event.EvPut->Para = Para;
-+
-+ if (pAC->GIni.GILevel == SK_INIT_DATA) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E003, SKERR_Q_E003MSG);
-+ }
-+ else {
-+ pAC->Event.EvPut->Class = Class;
-+ pAC->Event.EvPut->Event = Event;
-+ pAC->Event.EvPut->Para = Para;
-
-- if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT])
-- pAC->Event.EvPut = pAC->Event.EvQueue;
-+ if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT])
-+ pAC->Event.EvPut = pAC->Event.EvQueue;
-
-- if (pAC->Event.EvPut == pAC->Event.EvGet) {
-- SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG);
-+ if (pAC->Event.EvPut == pAC->Event.EvGet) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG);
-+ }
- }
- }
-
--/*
-- * event dispatcher
-- * while event queue is not empty
-- * get event from queue
-- * send command to state machine
-- * end
-- * return error reported by individual Event function
-- * 0 if no error occured.
-+/******************************************************************************
-+ *
-+ * SkEventDispatcher() - Event Dispatcher
-+ *
-+ * Description:
-+ * The event dispatcher performs the following operations:
-+ * o while event queue is not empty
-+ * - get event from queue
-+ * - send event to state machine
-+ * end
-+ *
-+ * CAUTION:
-+ * The event functions MUST report an error if performing a reinitialization
-+ * of the event queue, e.g. performing level Init 0..2 while in dispatcher
-+ * call!
-+ * ANY OTHER return value delays scheduling the other events in the
-+ * queue. In this case the event blocks the queue until
-+ * the error condition is cleared!
-+ *
-+ * Returns:
-+ * The return value error reported by individual event function
- */
- int SkEventDispatcher(
- SK_AC *pAC, /* Adapters Context */
-@@ -105,6 +139,10 @@ SK_IOC Ioc) /* Io context */
- SK_U32 Class;
- int Rtv;
-
-+ if (pAC->GIni.GILevel != SK_INIT_RUN) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E005, SKERR_Q_E005MSG);
-+ }
-+
- pEv = pAC->Event.EvGet;
-
- PRINTF("dispatch get %x put %x\n", pEv, pAC->Event.ev_put);
-@@ -152,6 +190,11 @@ SK_IOC Ioc) /* Io context */
- Rtv = SkFdEvent(pAC, Ioc, pEv->Event, pEv->Para);
- break;
- #endif /* SK_USE_LAC_EV */
-+#ifdef SK_ASF
-+ case SKGE_ASF :
-+ Rtv = SkAsfEvent(pAC,Ioc,pEv->Event,pEv->Para);
-+ break ;
-+#endif
- #ifdef SK_USE_CSUM
- case SKGE_CSUM :
- Rtv = SkCsEvent(pAC, Ioc, pEv->Event, pEv->Para);
-@@ -163,6 +206,20 @@ SK_IOC Ioc) /* Io context */
- }
-
- if (Rtv != 0) {
-+ /*
-+ * Special Case: See CAUTION statement above.
-+ * We assume the event queue is reset.
-+ */
-+ if (pAC->Event.EvGet != pAC->Event.EvQueue &&
-+ pAC->Event.EvGet != pEv) {
-+ /*
-+ * Create an error log entry if the
-+ * event queue isn't reset.
-+ * In this case it may be blocked.
-+ */
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E004, SKERR_Q_E004MSG);
-+ }
-+
- return(Rtv);
- }
-
-diff -Nurap ./drivers/net/sk98lin.sk98/skrlmt.c ./drivers/net/sk98lin/skrlmt.c
---- ./drivers/net/sk98lin.sk98/skrlmt.c 2004-10-19 01:54:37.000000000 +0400
-+++ ./drivers/net/sk98lin/skrlmt.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: skrlmt.c
- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.69 $
-- * Date: $Date: 2003/04/15 09:39:22 $
-+ * Version: $Revision: 2.3 $
-+ * Date: $Date: 2005/05/04 09:47:53 $
- * Purpose: Manage links on SK-NET Adapters, esp. redundant ones.
- *
- ******************************************************************************/
-@@ -39,7 +39,7 @@
-
- #ifndef lint
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skrlmt.c,v 1.69 2003/04/15 09:39:22 tschilli Exp $ (C) Marvell.";
-+ "@(#) $Id: skrlmt.c,v 2.3 2005/05/04 09:47:53 tschilli Exp $ (C) Marvell.";
- #endif /* !defined(lint) */
-
- #define __SKRLMT_C
-@@ -350,7 +350,7 @@ int Level) /* Initialization Level */
- SK_BOOL PhysicalAMacAddressSet;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_INIT,
-- ("RLMT Init level %d.\n", Level))
-+ ("RLMT Init level %d.\n", Level));
-
- switch (Level) {
- case SK_INIT_DATA: /* Initialize data structures. */
-@@ -390,7 +390,7 @@ int Level) /* Initialization Level */
-
- case SK_INIT_IO: /* GIMacsFound first available here. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_INIT,
-- ("RLMT: %d MACs were detected.\n", pAC->GIni.GIMacsFound))
-+ ("RLMT: %d MACs were detected.\n", pAC->GIni.GIMacsFound));
-
- pAC->Rlmt.Net[0].NumPorts = pAC->GIni.GIMacsFound;
-
-@@ -512,7 +512,7 @@ SK_U32 NetIdx) /* Net Number */
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SkRlmtBuildCheckChain.\n"))
-+ ("SkRlmtBuildCheckChain.\n"));
-
- NumMacsUp = 0;
-
-@@ -558,7 +558,7 @@ SK_U32 NetIdx) /* Net Number */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
- ("Port %d checks %d other ports: %2X.\n", i,
- pAC->Rlmt.Net[NetIdx].Port[i]->PortsChecked,
-- pAC->Rlmt.Net[NetIdx].Port[i]->PortCheck[0].CheckAddr.a[5]))
-+ pAC->Rlmt.Net[NetIdx].Port[i]->PortCheck[0].CheckAddr.a[5]));
- }
- #endif /* DEBUG */
-
-@@ -604,7 +604,7 @@ SK_MAC_ADDR *DestAddr) /* Destination ad
- if ((CheckSrc == 0) || (CheckDest == 0)) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_ERR,
- ("SkRlmtBuildPacket: Invalid %s%saddr.\n",
-- (CheckSrc == 0 ? "Src" : ""), (CheckDest == 0 ? "Dest" : "")))
-+ (CheckSrc == 0 ? "Src" : ""), (CheckDest == 0 ? "Dest" : "")));
- }
- #endif
-
-@@ -796,7 +796,7 @@ SK_U32 PortNumber) /* Sending port */
-
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_TX,
-- ("SkRlmtSend: BPDU Packet on Port %u.\n", PortNumber))
-+ ("SkRlmtSend: BPDU Packet on Port %u.\n", PortNumber));
- }
- }
- return;
-@@ -835,7 +835,7 @@ SK_U32 PortNumber) /* Port to check */
- * Bring it up.
- */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Received on PortDown.\n"))
-+ ("SkRlmtPacketReceive: Received on PortDown.\n"));
-
- pRPort->PortState = SK_RLMT_PS_GOING_UP;
- pRPort->GuTimeStamp = SkOsGetTime(pAC);
-@@ -849,7 +849,7 @@ SK_U32 PortNumber) /* Port to check */
- } /* PortDown && !SuspectTx */
- else if (pRPort->CheckingState & SK_RLMT_PCS_RX) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Stop bringing port down.\n"))
-+ ("SkRlmtPacketReceive: Stop bringing port down.\n"));
- SkTimerStop(pAC, IoC, &pRPort->DownRxTimer);
- pRPort->CheckingState &= ~SK_RLMT_PCS_RX;
- /* pAC->Rlmt.CheckSwitch = SK_TRUE; */
-@@ -896,7 +896,7 @@ SK_MBUF *pMb) /* Received packet */
- pRPort = &pAC->Rlmt.Port[PortNumber];
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: PortNumber == %d.\n", PortNumber))
-+ ("SkRlmtPacketReceive: PortNumber == %d.\n", PortNumber));
-
- pRPacket = (SK_RLMT_PACKET*)pMb->pData;
- pSPacket = (SK_SPTREE_PACKET*)pRPacket;
-@@ -917,7 +917,7 @@ SK_MBUF *pMb) /* Received packet */
-
- /* Not sent to current MAC or registered MC address => Trash it. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Not for me.\n"))
-+ ("SkRlmtPacketReceive: Not for me.\n"));
-
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
- return;
-@@ -955,7 +955,7 @@ SK_MBUF *pMb) /* Received packet */
- pRPacket->Indicator[5] == SK_RLMT_INDICATOR5 &&
- pRPacket->Indicator[6] == SK_RLMT_INDICATOR6) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Duplicate MAC Address.\n"))
-+ ("SkRlmtPacketReceive: Duplicate MAC Address.\n"));
-
- /* Error Log entry. */
- SK_ERR_LOG(pAC, SK_ERRCL_COMM, SKERR_RLMT_E006, SKERR_RLMT_E006_MSG);
-@@ -963,7 +963,7 @@ SK_MBUF *pMb) /* Received packet */
- else {
- /* Simply trash it. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Sent by me.\n"))
-+ ("SkRlmtPacketReceive: Sent by me.\n"));
- }
-
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
-@@ -1007,7 +1007,7 @@ SK_MBUF *pMb) /* Received packet */
- #endif /* 0 */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Announce.\n"))
-+ ("SkRlmtPacketReceive: Announce.\n"));
-
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
- break;
-@@ -1015,7 +1015,7 @@ SK_MBUF *pMb) /* Received packet */
- case SK_PACKET_ALIVE:
- if (pRPacket->SSap & LLC_COMMAND_RESPONSE_BIT) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Alive Reply.\n"))
-+ ("SkRlmtPacketReceive: Alive Reply.\n"));
-
- if (!(pAC->Addr.Port[PortNumber].PromMode & SK_PROM_MODE_LLC) ||
- SK_ADDR_EQUAL(
-@@ -1046,7 +1046,7 @@ SK_MBUF *pMb) /* Received packet */
- }
- else { /* Alive Request Packet. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Alive Request.\n"))
-+ ("SkRlmtPacketReceive: Alive Request.\n"));
-
- pRPort->RxHelloCts++;
-
-@@ -1065,7 +1065,7 @@ SK_MBUF *pMb) /* Received packet */
-
- case SK_PACKET_CHECK_TX:
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Check your tx line.\n"))
-+ ("SkRlmtPacketReceive: Check your tx line.\n"));
-
- /* A port checking us requests us to check our tx line. */
- pRPort->CheckingState |= SK_RLMT_PCS_TX;
-@@ -1088,7 +1088,7 @@ SK_MBUF *pMb) /* Received packet */
-
- case SK_PACKET_ADDR_CHANGED:
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Address Change.\n"))
-+ ("SkRlmtPacketReceive: Address Change.\n"));
-
- /* Build the check chain. */
- SkRlmtBuildCheckChain(pAC, pRPort->Net->NetNumber);
-@@ -1097,7 +1097,7 @@ SK_MBUF *pMb) /* Received packet */
-
- default:
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Unknown RLMT packet.\n"))
-+ ("SkRlmtPacketReceive: Unknown RLMT packet.\n"));
-
- /* RA;:;: ??? */
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
-@@ -1107,7 +1107,7 @@ SK_MBUF *pMb) /* Received packet */
- pSPacket->Ctrl == SK_RLMT_SPT_CTRL &&
- (pSPacket->SSap & ~LLC_COMMAND_RESPONSE_BIT) == SK_RLMT_SPT_SSAP) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: BPDU Packet.\n"))
-+ ("SkRlmtPacketReceive: BPDU Packet.\n"));
-
- /* Spanning Tree packet. */
- pRPort->RxSpHelloCts++;
-@@ -1139,7 +1139,7 @@ SK_MBUF *pMb) /* Received packet */
- pRPort->Root.Id[0], pRPort->Root.Id[1],
- pRPort->Root.Id[2], pRPort->Root.Id[3],
- pRPort->Root.Id[4], pRPort->Root.Id[5],
-- pRPort->Root.Id[6], pRPort->Root.Id[7]))
-+ pRPort->Root.Id[6], pRPort->Root.Id[7]));
- }
-
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
-@@ -1150,7 +1150,7 @@ SK_MBUF *pMb) /* Received packet */
- }
- else {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
-- ("SkRlmtPacketReceive: Unknown Packet Type.\n"))
-+ ("SkRlmtPacketReceive: Unknown Packet Type.\n"));
-
- /* Unknown packet. */
- SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
-@@ -1232,7 +1232,7 @@ SK_U32 PortNumber) /* Port to check */
- if ((pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot) == 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
- ("SkRlmtCheckPort %d: No (%d) receives in last time slot.\n",
-- PortNumber, pRPort->PacketsPerTimeSlot))
-+ PortNumber, pRPort->PacketsPerTimeSlot));
-
- /*
- * Check segmentation if there was no receive at least twice
-@@ -1249,7 +1249,7 @@ SK_U32 PortNumber) /* Port to check */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
- ("SkRlmtCheckPort: PortsSuspect %d, PcsRx %d.\n",
-- pRPort->PortsSuspect, pRPort->CheckingState & SK_RLMT_PCS_RX))
-+ pRPort->PortsSuspect, pRPort->CheckingState & SK_RLMT_PCS_RX));
-
- if (pRPort->PortState != SK_RLMT_PS_DOWN) {
- NewTimeout = TO_SHORTEN(pAC->Rlmt.Port[PortNumber].Net->TimeoutValue);
-@@ -1295,7 +1295,7 @@ SK_U32 PortNumber) /* Port to check */
- ("SkRlmtCheckPort %d: %d (%d) receives in last time slot.\n",
- PortNumber,
- pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot,
-- pRPort->PacketsPerTimeSlot))
-+ pRPort->PacketsPerTimeSlot));
-
- SkRlmtPortReceives(pAC, IoC, PortNumber);
- if (pAC->Rlmt.CheckSwitch) {
-@@ -1345,7 +1345,7 @@ SK_U32 *pSelect) /* New active port */
- i,
- pAC->Rlmt.Port[i].PortDown, pAC->Rlmt.Port[i].PortNoRx,
- *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_HI32),
-- *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_LO32)))
-+ *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_LO32)));
-
- if (!pAC->Rlmt.Port[i].PortDown && !pAC->Rlmt.Port[i].PortNoRx) {
- if (!PortFound || pAC->Rlmt.Port[i].BcTimeStamp > BcTimeStamp) {
-@@ -1358,7 +1358,7 @@ SK_U32 *pSelect) /* New active port */
-
- if (PortFound) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Port %d received the last broadcast.\n", *pSelect))
-+ ("Port %d received the last broadcast.\n", *pSelect));
-
- /* Look if another port's time stamp is similar. */
- for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
-@@ -1373,7 +1373,7 @@ SK_U32 *pSelect) /* New active port */
- PortFound = SK_FALSE;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Port %d received a broadcast at a similar time.\n", i))
-+ ("Port %d received a broadcast at a similar time.\n", i));
- break;
- }
- }
-@@ -1385,7 +1385,7 @@ SK_U32 *pSelect) /* New active port */
- ("SK_RLMT_SELECT_BCRX found Port %d receiving the substantially "
- "latest broadcast (%u).\n",
- *pSelect,
-- BcTimeStamp - pAC->Rlmt.Port[1 - *pSelect].BcTimeStamp))
-+ BcTimeStamp - pAC->Rlmt.Port[1 - *pSelect].BcTimeStamp));
- }
- #endif /* DEBUG */
-
-@@ -1434,7 +1434,7 @@ SK_U32 *pSelect) /* New active port */
- PortFound = SK_TRUE;
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
- ("SK_RLMT_SELECT_NOTSUSPECT found Port %d up and not check RX.\n",
-- *pSelect))
-+ *pSelect));
- break;
- }
- }
-@@ -1483,7 +1483,7 @@ SK_BOOL AutoNegDone) /* Successfully aut
- }
- PortFound = SK_TRUE;
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SELECT_UP found Port %d up.\n", *pSelect))
-+ ("SK_RLMT_SELECT_UP found Port %d up.\n", *pSelect));
- break;
- }
- }
-@@ -1544,7 +1544,7 @@ SK_BOOL AutoNegDone) /* Successfully aut
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SELECT_GOINGUP found Port %d going up.\n", *pSelect))
-+ ("SK_RLMT_SELECT_GOINGUP found Port %d going up.\n", *pSelect));
- return (SK_TRUE);
- } /* SkRlmtSelectGoingUp */
-
-@@ -1590,7 +1590,7 @@ SK_BOOL AutoNegDone) /* Successfully aut
- }
- PortFound = SK_TRUE;
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SELECT_DOWN found Port %d down.\n", *pSelect))
-+ ("SK_RLMT_SELECT_DOWN found Port %d down.\n", *pSelect));
- break;
- }
- }
-@@ -1680,16 +1680,19 @@ SK_U32 NetIdx) /* Net index */
- Para.Para32[1] = NetIdx;
- SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_UP, Para);
-
-- if ((pAC->Rlmt.Net[NetIdx].RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
-- (Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC,
-- pAC->Rlmt.Net[NetIdx].Port[i]->PortNumber,
-- SK_PACKET_ANNOUNCE, &pAC->Addr.Net[NetIdx].
-- CurrentMacAddress, &SkRlmtMcAddr)) != NULL) {
-- /*
-- * Send announce packet to RLMT multicast address to force
-- * switches to learn the new location of the logical MAC address.
-- */
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
-+ if (pAC->Rlmt.NumNets == 1) {
-+ if ((pAC->Rlmt.Net[NetIdx].RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
-+ (Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC,
-+ pAC->Rlmt.Net[NetIdx].Port[i]->PortNumber,
-+ SK_PACKET_ANNOUNCE, &pAC->Addr.Net[NetIdx].
-+ CurrentMacAddress, &SkRlmtMcAddr)) != NULL) {
-+
-+ /*
-+ * Send announce packet to RLMT multicast address to force
-+ * switches to learn the new location of the logical MAC address.
-+ */
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
-+ }
- }
- }
- else {
-@@ -1788,7 +1791,7 @@ SK_U32 NetIdx) /* Net index */
-
- if (Para.Para32[1] != Active) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Active: %d, Para1: %d.\n", Active, Para.Para32[1]))
-+ ("Active: %d, Para1: %d.\n", Active, Para.Para32[1]));
- pAC->Rlmt.Net[NetIdx].ActivePort = Para.Para32[1];
- Para.Para32[0] = pAC->Rlmt.Net[NetIdx].
- Port[Para.Para32[0]]->PortNumber;
-@@ -1868,7 +1871,7 @@ SK_U32 NetIdx) /* Net number */
- pNet->Port[i]->Root.Id[0], pNet->Port[i]->Root.Id[1],
- pNet->Port[i]->Root.Id[2], pNet->Port[i]->Root.Id[3],
- pNet->Port[i]->Root.Id[4], pNet->Port[i]->Root.Id[5],
-- pNet->Port[i]->Root.Id[6], pNet->Port[i]->Root.Id[7]))
-+ pNet->Port[i]->Root.Id[6], pNet->Port[i]->Root.Id[7]));
-
- if (!pNet->RootIdSet) {
- pNet->Root = pNet->Port[i]->Root;
-@@ -1963,13 +1966,13 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- SK_U32 i;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTSTART_TIMEOUT Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_PORTSTART_TIMEOUT Port %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTSTART_TIMEOUT Event EMPTY.\n"))
-+ ("SK_RLMT_PORTSTART_TIMEOUT Event EMPTY.\n"));
- return;
- }
-
-@@ -1990,7 +1993,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTSTART_TIMEOUT Event END.\n"))
-+ ("SK_RLMT_PORTSTART_TIMEOUT Event END.\n"));
- } /* SkRlmtEvtPortStartTim */
-
-
-@@ -2018,21 +2021,21 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- SK_EVPARA Para2;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_UP Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_LINK_UP Port %d Event BEGIN.\n", Para.Para32[0]));
-
- pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
- if (!pRPort->PortStarted) {
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E008, SKERR_RLMT_E008_MSG);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_UP Event EMPTY.\n"))
-+ ("SK_RLMT_LINK_UP Event EMPTY.\n"));
- return;
- }
-
- if (!pRPort->LinkDown) {
- /* RA;:;: Any better solution? */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_UP Event EMPTY.\n"))
-+ ("SK_RLMT_LINK_UP Event EMPTY.\n"));
- return;
- }
-
-@@ -2082,16 +2085,19 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- Para2.Para32[1] = (SK_U32)-1;
- SkTimerStart(pAC, IoC, &pRPort->UpTimer, SK_RLMT_PORTUP_TIM_VAL,
- SKGE_RLMT, SK_RLMT_PORTUP_TIM, Para2);
--
-+
- /* Later: if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) && */
-- if ((pRPort->Net->RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
-- (pRPort->Net->RlmtMode & SK_RLMT_CHECK_LINK) != 0 &&
-- (Para2.pParaPtr =
-- SkRlmtBuildPacket(pAC, IoC, Para.Para32[0], SK_PACKET_ANNOUNCE,
-- &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress, &SkRlmtMcAddr)
-- ) != NULL) {
-- /* Send "new" packet to RLMT multicast address. */
-- SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2);
-+ if (pAC->Rlmt.NumNets == 1) {
-+ if ((pRPort->Net->RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
-+ (pRPort->Net->RlmtMode & SK_RLMT_CHECK_LINK) != 0 &&
-+ (Para2.pParaPtr =
-+ SkRlmtBuildPacket(pAC, IoC, Para.Para32[0], SK_PACKET_ANNOUNCE,
-+ &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress, &SkRlmtMcAddr)
-+ ) != NULL) {
-+
-+ /* Send "new" packet to RLMT multicast address. */
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2);
-+ }
- }
-
- if (pRPort->Net->RlmtMode & SK_RLMT_CHECK_SEG) {
-@@ -2110,7 +2116,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_UP Event END.\n"))
-+ ("SK_RLMT_LINK_UP Event END.\n"));
- } /* SkRlmtEvtLinkUp */
-
-
-@@ -2136,20 +2142,20 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- SK_RLMT_PORT *pRPort;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTUP_TIM Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_PORTUP_TIM Port %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTUP_TIM Event EMPTY.\n"))
-+ ("SK_RLMT_PORTUP_TIM Event EMPTY.\n"));
- return;
- }
-
- pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
- if (pRPort->LinkDown || (pRPort->PortState == SK_RLMT_PS_UP)) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTUP_TIM Port %d Event EMPTY.\n", Para.Para32[0]))
-+ ("SK_RLMT_PORTUP_TIM Port %d Event EMPTY.\n", Para.Para32[0]));
- return;
- }
-
-@@ -2164,7 +2170,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTUP_TIM Event END.\n"))
-+ ("SK_RLMT_PORTUP_TIM Event END.\n"));
- } /* SkRlmtEvtPortUpTim */
-
-
-@@ -2192,13 +2198,13 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
- ("SK_RLMT_PORTDOWN* Port %d Event (%d) BEGIN.\n",
-- Para.Para32[0], Event))
-+ Para.Para32[0], Event));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTDOWN* Event EMPTY.\n"))
-+ ("SK_RLMT_PORTDOWN* Event EMPTY.\n"));
- return;
- }
-
-@@ -2206,7 +2212,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- if (!pRPort->PortStarted || (Event == SK_RLMT_PORTDOWN_TX_TIM &&
- !(pRPort->CheckingState & SK_RLMT_PCS_TX))) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTDOWN* Event (%d) EMPTY.\n", Event))
-+ ("SK_RLMT_PORTDOWN* Event (%d) EMPTY.\n", Event));
- return;
- }
-
-@@ -2243,7 +2249,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORTDOWN* Event (%d) END.\n", Event))
-+ ("SK_RLMT_PORTDOWN* Event (%d) END.\n", Event));
- } /* SkRlmtEvtPortDownX */
-
-
-@@ -2270,7 +2276,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
-
- pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_DOWN Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_LINK_DOWN Port %d Event BEGIN.\n", Para.Para32[0]));
-
- if (!pAC->Rlmt.Port[Para.Para32[0]].LinkDown) {
- pRPort->Net->LinksUp--;
-@@ -2289,7 +2295,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_LINK_DOWN Event END.\n"))
-+ ("SK_RLMT_LINK_DOWN Event END.\n"));
- } /* SkRlmtEvtLinkDown */
-
-
-@@ -2318,13 +2324,13 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- SK_MAC_ADDR *pNewMacAddr;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORT_ADDR Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_PORT_ADDR Port %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORT_ADDR Event EMPTY.\n"))
-+ ("SK_RLMT_PORT_ADDR Event EMPTY.\n"));
- return;
- }
-
-@@ -2348,7 +2354,7 @@ SK_EVPARA Para) /* SK_U32 PortNumber; SK
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PORT_ADDR Event END.\n"))
-+ ("SK_RLMT_PORT_ADDR Event END.\n"));
- } /* SkRlmtEvtPortAddr */
-
-
-@@ -2376,35 +2382,35 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- SK_U32 PortNumber;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Net %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_START Net %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Event EMPTY.\n"))
-+ ("SK_RLMT_START Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[0]))
-+ ("Bad NetNumber %d.\n", Para.Para32[0]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Event EMPTY.\n"))
-+ ("SK_RLMT_START Event EMPTY.\n"));
- return;
- }
-
- if (pAC->Rlmt.Net[Para.Para32[0]].RlmtState != SK_RLMT_RS_INIT) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Event EMPTY.\n"))
-+ ("SK_RLMT_START Event EMPTY.\n"));
- return;
- }
-
- if (pAC->Rlmt.NetsStarted >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("All nets should have been started.\n"))
-+ ("All nets should have been started.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Event EMPTY.\n"))
-+ ("SK_RLMT_START Event EMPTY.\n"));
- return;
- }
-
-@@ -2438,7 +2444,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- pAC->Rlmt.NetsStarted++;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_START Event END.\n"))
-+ ("SK_RLMT_START Event END.\n"));
- } /* SkRlmtEvtStart */
-
-
-@@ -2466,35 +2472,35 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- SK_U32 i;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Net %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_STOP Net %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Event EMPTY.\n"))
-+ ("SK_RLMT_STOP Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[0]))
-+ ("Bad NetNumber %d.\n", Para.Para32[0]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Event EMPTY.\n"))
-+ ("SK_RLMT_STOP Event EMPTY.\n"));
- return;
- }
-
- if (pAC->Rlmt.Net[Para.Para32[0]].RlmtState == SK_RLMT_RS_INIT) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Event EMPTY.\n"))
-+ ("SK_RLMT_STOP Event EMPTY.\n"));
- return;
- }
-
- if (pAC->Rlmt.NetsStarted == 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("All nets are stopped.\n"))
-+ ("All nets are stopped.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Event EMPTY.\n"))
-+ ("SK_RLMT_STOP Event EMPTY.\n"));
- return;
- }
-
-@@ -2529,7 +2535,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- pAC->Rlmt.NetsStarted--;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STOP Event END.\n"))
-+ ("SK_RLMT_STOP Event END.\n"));
- } /* SkRlmtEvtStop */
-
-
-@@ -2559,13 +2565,13 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- SK_U32 i;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_TIM Event BEGIN.\n"))
-+ ("SK_RLMT_TIM Event BEGIN.\n"));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_TIM Event EMPTY.\n"))
-+ ("SK_RLMT_TIM Event EMPTY.\n"));
- return;
- }
-
-@@ -2637,7 +2643,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_TIM Event END.\n"))
-+ ("SK_RLMT_TIM Event END.\n"));
- } /* SkRlmtEvtTim */
-
-
-@@ -2665,13 +2671,13 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- #endif /* DEBUG */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SEG_TIM Event BEGIN.\n"))
-+ ("SK_RLMT_SEG_TIM Event BEGIN.\n"));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SEG_TIM Event EMPTY.\n"))
-+ ("SK_RLMT_SEG_TIM Event EMPTY.\n"));
- return;
- }
-
-@@ -2695,7 +2701,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- InAddr8[3], InAddr8[4], InAddr8[5],
- pAPort->Exact[k].a[0], pAPort->Exact[k].a[1],
- pAPort->Exact[k].a[2], pAPort->Exact[k].a[3],
-- pAPort->Exact[k].a[4], pAPort->Exact[k].a[5]))
-+ pAPort->Exact[k].a[4], pAPort->Exact[k].a[5]));
- }
- }
- #endif /* xDEBUG */
-@@ -2703,7 +2709,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- SkRlmtCheckSeg(pAC, IoC, Para.Para32[0]);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SEG_TIM Event END.\n"))
-+ ("SK_RLMT_SEG_TIM Event END.\n"));
- } /* SkRlmtEvtSegTim */
-
-
-@@ -2732,18 +2738,18 @@ SK_EVPARA Para) /* SK_MBUF *pMb */
-
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PACKET_RECEIVED Event BEGIN.\n"))
-+ ("SK_RLMT_PACKET_RECEIVED Event BEGIN.\n"));
-
- /* Should we ignore frames during port switching? */
-
- #ifdef DEBUG
- pMb = Para.pParaPtr;
- if (pMb == NULL) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL, ("No mbuf.\n"))
-+ SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL, ("No mbuf.\n"));
- }
- else if (pMb->pNext != NULL) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("More than one mbuf or pMb->pNext not set.\n"))
-+ ("More than one mbuf or pMb->pNext not set.\n"));
- }
- #endif /* DEBUG */
-
-@@ -2761,7 +2767,7 @@ SK_EVPARA Para) /* SK_MBUF *pMb */
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PACKET_RECEIVED Event END.\n"))
-+ ("SK_RLMT_PACKET_RECEIVED Event END.\n"));
- } /* SkRlmtEvtPacketRx */
-
-
-@@ -2788,21 +2794,21 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- SK_RLMT_PORT *pRPort;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_CLEAR Event BEGIN.\n"))
-+ ("SK_RLMT_STATS_CLEAR Event BEGIN.\n"));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"))
-+ ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[0]))
-+ ("Bad NetNumber %d.\n", Para.Para32[0]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"))
-+ ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"));
- return;
- }
-
-@@ -2817,7 +2823,7 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_CLEAR Event END.\n"))
-+ ("SK_RLMT_STATS_CLEAR Event END.\n"));
- } /* SkRlmtEvtStatsClear */
-
-
-@@ -2841,28 +2847,28 @@ SK_IOC IoC, /* I/O Context */
- SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
- {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_UPDATE Event BEGIN.\n"))
-+ ("SK_RLMT_STATS_UPDATE Event BEGIN.\n"));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"))
-+ ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[0]))
-+ ("Bad NetNumber %d.\n", Para.Para32[0]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"))
-+ ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"));
- return;
- }
-
- /* Update statistics - currently always up-to-date. */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_STATS_UPDATE Event END.\n"))
-+ ("SK_RLMT_STATS_UPDATE Event END.\n"));
- } /* SkRlmtEvtStatsUpdate */
-
-
-@@ -2886,13 +2892,13 @@ SK_IOC IoC, /* I/O Context */
- SK_EVPARA Para) /* SK_U32 PortIndex; SK_U32 NetNumber */
- {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PREFPORT_CHANGE to Port %d Event BEGIN.\n", Para.Para32[0]))
-+ ("SK_RLMT_PREFPORT_CHANGE to Port %d Event BEGIN.\n", Para.Para32[0]));
-
- if (Para.Para32[1] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[1]))
-+ ("Bad NetNumber %d.\n", Para.Para32[1]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"))
-+ ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"));
- return;
- }
-
-@@ -2905,7 +2911,7 @@ SK_EVPARA Para) /* SK_U32 PortIndex; SK_
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E010, SKERR_RLMT_E010_MSG);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"))
-+ ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"));
- return;
- }
-
-@@ -2919,7 +2925,7 @@ SK_EVPARA Para) /* SK_U32 PortIndex; SK_
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_PREFPORT_CHANGE Event END.\n"))
-+ ("SK_RLMT_PREFPORT_CHANGE Event END.\n"));
- } /* SkRlmtEvtPrefportChange */
-
-
-@@ -2945,37 +2951,37 @@ SK_EVPARA Para) /* SK_U32 NumNets; SK_U3
- int i;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event BEGIN.\n"))
-+ ("SK_RLMT_SET_NETS Event BEGIN.\n"));
-
- if (Para.Para32[1] != (SK_U32)-1) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad Parameter.\n"))
-+ ("Bad Parameter.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event EMPTY.\n"))
-+ ("SK_RLMT_SET_NETS Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] == 0 || Para.Para32[0] > SK_MAX_NETS ||
- Para.Para32[0] > (SK_U32)pAC->GIni.GIMacsFound) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad number of nets: %d.\n", Para.Para32[0]))
-+ ("Bad number of nets: %d.\n", Para.Para32[0]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event EMPTY.\n"))
-+ ("SK_RLMT_SET_NETS Event EMPTY.\n"));
- return;
- }
-
- if (Para.Para32[0] == pAC->Rlmt.NumNets) { /* No change. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event EMPTY.\n"))
-+ ("SK_RLMT_SET_NETS Event EMPTY.\n"));
- return;
- }
-
- /* Entering and leaving dual mode only allowed while nets are stopped. */
- if (pAC->Rlmt.NetsStarted > 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Changing dual mode only allowed while all nets are stopped.\n"))
-+ ("Changing dual mode only allowed while all nets are stopped.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event EMPTY.\n"))
-+ ("SK_RLMT_SET_NETS Event EMPTY.\n"));
- return;
- }
-
-@@ -3006,9 +3012,10 @@ SK_EVPARA Para) /* SK_U32 NumNets; SK_U3
- SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_SET_NETS, Para);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("RLMT: Changed to one net with two ports.\n"))
-+ ("RLMT: Changed to one net with two ports.\n"));
- }
- else if (Para.Para32[0] == 2) {
-+ pAC->Rlmt.RlmtOff = SK_TRUE;
- pAC->Rlmt.Port[1].Net= &pAC->Rlmt.Net[1];
- pAC->Rlmt.Net[1].NumPorts = pAC->GIni.GIMacsFound - 1;
- pAC->Rlmt.Net[0].NumPorts =
-@@ -3035,19 +3042,19 @@ SK_EVPARA Para) /* SK_U32 NumNets; SK_U3
- SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_SET_NETS, Para);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("RLMT: Changed to two nets with one port each.\n"))
-+ ("RLMT: Changed to two nets with one port each.\n"));
- }
- else {
- /* Not implemented for more than two nets. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SetNets not implemented for more than two nets.\n"))
-+ ("SetNets not implemented for more than two nets.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event EMPTY.\n"))
-+ ("SK_RLMT_SET_NETS Event EMPTY.\n"));
- return;
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_SET_NETS Event END.\n"))
-+ ("SK_RLMT_SET_NETS Event END.\n"));
- } /* SkRlmtSetNets */
-
-
-@@ -3075,13 +3082,13 @@ SK_EVPARA Para) /* SK_U32 NewMode; SK_U3
- SK_U32 PrevRlmtMode;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_MODE_CHANGE Event BEGIN.\n"))
-+ ("SK_RLMT_MODE_CHANGE Event BEGIN.\n"));
-
- if (Para.Para32[1] >= pAC->Rlmt.NumNets) {
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Bad NetNumber %d.\n", Para.Para32[1]))
-+ ("Bad NetNumber %d.\n", Para.Para32[1]));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"))
-+ ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"));
- return;
- }
-
-@@ -3091,9 +3098,9 @@ SK_EVPARA Para) /* SK_U32 NewMode; SK_U3
- Para.Para32[0] != SK_RLMT_MODE_CLS) {
- pAC->Rlmt.Net[Para.Para32[1]].RlmtMode = SK_RLMT_MODE_CLS;
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Forced RLMT mode to CLS on single port net.\n"))
-+ ("Forced RLMT mode to CLS on single port net.\n"));
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"))
-+ ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"));
- return;
- }
-
-@@ -3159,7 +3166,7 @@ SK_EVPARA Para) /* SK_U32 NewMode; SK_U3
- } /* SK_RLMT_CHECK_SEG bit changed. */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("SK_RLMT_MODE_CHANGE Event END.\n"))
-+ ("SK_RLMT_MODE_CHANGE Event END.\n"));
- } /* SkRlmtEvtModeChange */
-
-
-@@ -3245,7 +3252,7 @@ SK_EVPARA Para) /* Event-specific parame
-
- default: /* Create error log entry. */
- SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
-- ("Unknown RLMT Event %d.\n", Event))
-+ ("Unknown RLMT Event %d.\n", Event));
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E003, SKERR_RLMT_E003_MSG);
- break;
- } /* switch() */
-diff -Nurap ./drivers/net/sk98lin.sk98/sktimer.c ./drivers/net/sk98lin/sktimer.c
---- ./drivers/net/sk98lin.sk98/sktimer.c 2004-10-19 01:53:13.000000000 +0400
-+++ ./drivers/net/sk98lin/sktimer.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,8 +2,8 @@
- *
- * Name: sktimer.c
- * Project: Gigabit Ethernet Adapters, Event Scheduler Module
-- * Version: $Revision: 1.14 $
-- * Date: $Date: 2003/09/16 13:46:51 $
-+ * Version: $Revision: 2.2 $
-+ * Date: $Date: 2004/05/28 13:44:39 $
- * Purpose: High level timer functions.
- *
- ******************************************************************************/
-@@ -11,7 +11,7 @@
- /******************************************************************************
- *
- * (C)Copyright 1998-2002 SysKonnect GmbH.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2004 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -22,13 +22,12 @@
- *
- ******************************************************************************/
-
--
- /*
- * Event queue and dispatcher
- */
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: sktimer.c,v 1.14 2003/09/16 13:46:51 rschmidt Exp $ (C) Marvell.";
-+ "@(#) $Id: sktimer.c,v 2.2 2004/05/28 13:44:39 rschmidt Exp $ (C) Marvell.";
- #endif
-
- #include "h/skdrv1st.h" /* Driver Specific Definitions */
-@@ -62,7 +61,7 @@ int Level) /* Init Level */
- {
- switch (Level) {
- case SK_INIT_DATA:
-- pAC->Tim.StQueue = NULL;
-+ pAC->Tim.StQueue = 0;
- break;
- case SK_INIT_IO:
- SkHwtInit(pAC, Ioc);
-@@ -85,22 +84,20 @@ SK_TIMER *pTimer) /* Timer Pointer to be
- SK_TIMER **ppTimPrev;
- SK_TIMER *pTm;
-
-- /*
-- * remove timer from queue
-- */
-+ /* remove timer from queue */
- pTimer->TmActive = SK_FALSE;
--
-+
- if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) {
- SkHwtStop(pAC, Ioc);
- }
--
-+
- for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
- ppTimPrev = &pTm->TmNext ) {
--
-+
- if (pTm == pTimer) {
- /*
- * Timer found in queue
-- * - dequeue it and
-+ * - dequeue it
- * - correct delta of the next timer
- */
- *ppTimPrev = pTm->TmNext;
-@@ -121,7 +118,7 @@ void SkTimerStart(
- SK_AC *pAC, /* Adapters context */
- SK_IOC Ioc, /* IoContext */
- SK_TIMER *pTimer, /* Timer Pointer to be started */
--SK_U32 Time, /* Time value */
-+SK_U32 Time, /* Time Value (in microsec.) */
- SK_U32 Class, /* Event Class for this timer */
- SK_U32 Event, /* Event Value for this timer */
- SK_EVPARA Para) /* Event Parameter for this timer */
-@@ -130,11 +127,6 @@ SK_EVPARA Para) /* Event Parameter for
- SK_TIMER *pTm;
- SK_U32 Delta;
-
-- Time /= 16; /* input is uS, clock ticks are 16uS */
--
-- if (!Time)
-- Time = 1;
--
- SkTimerStop(pAC, Ioc, pTimer);
-
- pTimer->TmClass = Class;
-@@ -143,31 +135,26 @@ SK_EVPARA Para) /* Event Parameter for
- pTimer->TmActive = SK_TRUE;
-
- if (!pAC->Tim.StQueue) {
-- /* First Timer to be started */
-+ /* first Timer to be started */
- pAC->Tim.StQueue = pTimer;
-- pTimer->TmNext = NULL;
-+ pTimer->TmNext = 0;
- pTimer->TmDelta = Time;
--
-+
- SkHwtStart(pAC, Ioc, Time);
--
-+
- return;
- }
-
-- /*
-- * timer correction
-- */
-+ /* timer correction */
- timer_done(pAC, Ioc, 0);
-
-- /*
-- * find position in queue
-- */
-+ /* find position in queue */
- Delta = 0;
- for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
- ppTimPrev = &pTm->TmNext ) {
--
-+
- if (Delta + pTm->TmDelta > Time) {
-- /* Position found */
-- /* Here the timer needs to be inserted. */
-+ /* the timer needs to be inserted here */
- break;
- }
- Delta += pTm->TmDelta;
-@@ -179,9 +166,7 @@ SK_EVPARA Para) /* Event Parameter for
- pTimer->TmDelta = Time - Delta;
-
- if (pTm) {
-- /* There is a next timer
-- * -> correct its Delta value.
-- */
-+ /* there is a next timer: correct its Delta value */
- pTm->TmDelta -= pTimer->TmDelta;
- }
-
-@@ -210,7 +195,7 @@ int Restart) /* Do we need to restart t
- int Done = 0;
-
- Delta = SkHwtRead(pAC, Ioc);
--
-+
- ppLast = &pAC->Tim.StQueue;
- pTm = pAC->Tim.StQueue;
- while (pTm && !Done) {
-@@ -228,13 +213,13 @@ int Restart) /* Do we need to restart t
- Done = 1;
- }
- }
-- *ppLast = NULL;
-+ *ppLast = 0;
- /*
- * pTm points to the first Timer that did not run out.
- * StQueue points to the first Timer that run out.
- */
-
-- for ( pTComp = pAC->Tim.StQueue; pTComp; pTComp = pTComp->TmNext) {
-+ for (pTComp = pAC->Tim.StQueue; pTComp; pTComp = pTComp->TmNext) {
- SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent, pTComp->TmPara);
- }
-
-diff -Nurap ./drivers/net/sk98lin.sk98/sktwsi.c ./drivers/net/sk98lin/sktwsi.c
---- ./drivers/net/sk98lin.sk98/sktwsi.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/sktwsi.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,1359 @@
-+/******************************************************************************
-+ *
-+ * Name: sktwsi.c
-+ * Project: Gigabit Ethernet Adapters, TWSI-Module
-+ * Version: $Revision: 1.10 $
-+ * Date: $Date: 2005/08/03 09:45:32 $
-+ * Purpose: Functions to access Voltage and Temperature Sensor
-+ *
-+ ******************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * (C)Copyright 1998-2002 SysKonnect.
-+ * (C)Copyright 2002-2005 Marvell.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ * The information in this file is provided "AS IS" without warranty.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * TWSI Protocol
-+ */
-+#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
-+static const char SysKonnectFileId[] =
-+ "@(#) $Id: sktwsi.c,v 1.10 2005/08/03 09:45:32 rschmidt Exp $ (C) Marvell.";
-+#endif
-+
-+#include "h/skdrv1st.h" /* Driver Specific Definitions */
-+#include "h/lm80.h"
-+#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
-+
-+#ifdef __C2MAN__
-+/*
-+ TWSI protocol implementation.
-+
-+ General Description:
-+
-+ The TWSI protocol is used for the temperature sensors and for
-+ the serial EEPROM which hold the configuration.
-+
-+ This file covers functions that allow to read write and do
-+ some bulk requests a specified TWSI address.
-+
-+ The Genesis has 2 TWSI buses. One for the EEPROM which holds
-+ the VPD Data and one for temperature and voltage sensor.
-+ The following picture shows the TWSI buses, TWSI devices and
-+ their control registers.
-+
-+ Note: The VPD functions are in skvpd.c
-+.
-+. PCI Config TWSI Bus for VPD Data:
-+.
-+. +------------+
-+. | VPD EEPROM |
-+. +------------+
-+. |
-+. | <-- TWSI
-+. |
-+. +-----------+-----------+
-+. | |
-+. +-----------------+ +-----------------+
-+. | PCI_VPD_ADR_REG | | PCI_VPD_DAT_REG |
-+. +-----------------+ +-----------------+
-+.
-+.
-+. TWSI Bus for LM80 sensor:
-+.
-+. +-----------------+
-+. | Temperature and |
-+. | Voltage Sensor |
-+. | LM80 |
-+. +-----------------+
-+. |
-+. |
-+. TWSI --> |
-+. |
-+. +----+
-+. +-------------->| OR |<--+
-+. | +----+ |
-+. +------+------+ |
-+. | | |
-+. +--------+ +--------+ +----------+
-+. | B2_I2C | | B2_I2C | | B2_I2C |
-+. | _CTRL | | _DATA | | _SW |
-+. +--------+ +--------+ +----------+
-+.
-+ The TWSI bus may be driven by the B2_I2C_SW or by the B2_I2C_CTRL
-+ and B2_I2C_DATA registers.
-+ For driver software it is recommended to use the TWSI control and
-+ data register, because TWSI bus timing is done by the ASIC and
-+ an interrupt may be received when the TWSI request is completed.
-+
-+ Clock Rate Timing: MIN MAX generated by
-+ VPD EEPROM: 50 kHz 100 kHz HW
-+ LM80 over TWSI Ctrl/Data reg. 50 kHz 100 kHz HW
-+ LM80 over B2_I2C_SW register 0 400 kHz SW
-+
-+ Note: The clock generated by the hardware is dependend on the
-+ PCI clock. If the PCI bus clock is 33 MHz, the I2C/VPD
-+ clock is 50 kHz.
-+ */
-+intro()
-+{}
-+#endif
-+
-+#ifdef SK_DIAG
-+/*
-+ * TWSI Fast Mode timing values used by the LM80.
-+ * If new devices are added to the TWSI bus the timing values have to be checked.
-+ */
-+#ifndef I2C_SLOW_TIMING
-+#define T_CLK_LOW 1300L /* clock low time in ns */
-+#define T_CLK_HIGH 600L /* clock high time in ns */
-+#define T_DATA_IN_SETUP 100L /* data in Set-up Time */
-+#define T_START_HOLD 600L /* start condition hold time */
-+#define T_START_SETUP 600L /* start condition Set-up time */
-+#define T_STOP_SETUP 600L /* stop condition Set-up time */
-+#define T_BUS_IDLE 1300L /* time the bus must free after Tx */
-+#define T_CLK_2_DATA_OUT 900L /* max. clock low to data output valid */
-+#else /* I2C_SLOW_TIMING */
-+/* TWSI Standard Mode Timing */
-+#define T_CLK_LOW 4700L /* clock low time in ns */
-+#define T_CLK_HIGH 4000L /* clock high time in ns */
-+#define T_DATA_IN_SETUP 250L /* data in Set-up Time */
-+#define T_START_HOLD 4000L /* start condition hold time */
-+#define T_START_SETUP 4700L /* start condition Set-up time */
-+#define T_STOP_SETUP 4000L /* stop condition Set-up time */
-+#define T_BUS_IDLE 4700L /* time the bus must free after Tx */
-+#endif /* !I2C_SLOW_TIMING */
-+
-+#define NS2BCLK(x) (((x)*125)/10000)
-+
-+/*
-+ * TWSI Wire Operations
-+ *
-+ * About I2C_CLK_LOW():
-+ *
-+ * The Data Direction bit (I2C_DATA_DIR) has to be set to input when setting
-+ * clock to low, to prevent the ASIC and the TWSI data client from driving the
-+ * serial data line simultaneously (ASIC: last bit of a byte = '1', TWSI client
-+ * send an 'ACK'). See also Concentrator Bugreport No. 10192.
-+ */
-+#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA)
-+#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA)
-+#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA_DIR)
-+#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR | I2C_DATA)
-+#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_CLK)
-+#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK | I2C_DATA_DIR)
-+#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK)
-+
-+#define NS2CLKT(x) ((x*125L)/10000)
-+
-+/*--------------- TWSI Interface Register Functions --------------- */
-+
-+/*
-+ * sending one bit
-+ */
-+void SkI2cSndBit(
-+SK_IOC IoC, /* I/O Context */
-+SK_U8 Bit) /* Bit to send */
-+{
-+ I2C_DATA_OUT(IoC);
-+ if (Bit) {
-+ I2C_DATA_HIGH(IoC);
-+ }
-+ else {
-+ I2C_DATA_LOW(IoC);
-+ }
-+ SkDgWaitTime(IoC, NS2BCLK(T_DATA_IN_SETUP));
-+ I2C_CLK_HIGH(IoC);
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH));
-+ I2C_CLK_LOW(IoC);
-+} /* SkI2cSndBit*/
-+
-+
-+/*
-+ * Signal a start to the TWSI Bus.
-+ *
-+ * A start is signaled when data goes to low in a high clock cycle.
-+ *
-+ * Ends with Clock Low.
-+ *
-+ * Status: not tested
-+ */
-+void SkI2cStart(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ /* Init data and Clock to output lines */
-+ /* Set Data high */
-+ I2C_DATA_OUT(IoC);
-+ I2C_DATA_HIGH(IoC);
-+ /* Set Clock high */
-+ I2C_CLK_HIGH(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_START_SETUP));
-+
-+ /* Set Data Low */
-+ I2C_DATA_LOW(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_START_HOLD));
-+
-+ /* Clock low without Data to Input */
-+ I2C_START_COND(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW));
-+} /* SkI2cStart */
-+
-+
-+void SkI2cStop(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ /* Init data and Clock to output lines */
-+ /* Set Data low */
-+ I2C_DATA_OUT(IoC);
-+ I2C_DATA_LOW(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT));
-+
-+ /* Set Clock high */
-+ I2C_CLK_HIGH(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_STOP_SETUP));
-+
-+ /*
-+ * Set Data High: Do it by setting the Data Line to Input.
-+ * Because of a pull up resistor the Data Line
-+ * floods to high.
-+ */
-+ I2C_DATA_IN(IoC);
-+
-+ /*
-+ * When TWSI activity is stopped
-+ * o DATA should be set to input and
-+ * o CLOCK should be set to high!
-+ */
-+ SkDgWaitTime(IoC, NS2BCLK(T_BUS_IDLE));
-+} /* SkI2cStop */
-+
-+
-+/*
-+ * Receive just one bit via the TWSI bus.
-+ *
-+ * Note: Clock must be set to LOW before calling this function.
-+ *
-+ * Returns The received bit.
-+ */
-+int SkI2cRcvBit(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ int Bit;
-+ SK_U8 I2cSwCtrl;
-+
-+ /* Init data as input line */
-+ I2C_DATA_IN(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT));
-+
-+ I2C_CLK_HIGH(IoC);
-+
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH));
-+
-+ SK_I2C_GET_SW(IoC, &I2cSwCtrl);
-+
-+ Bit = (I2cSwCtrl & I2C_DATA) ? 1 : 0;
-+
-+ I2C_CLK_LOW(IoC);
-+ SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT));
-+
-+ return(Bit);
-+} /* SkI2cRcvBit */
-+
-+
-+/*
-+ * Receive an ACK.
-+ *
-+ * returns 0 If acknowledged
-+ * 1 in case of an error
-+ */
-+int SkI2cRcvAck(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ /*
-+ * Received bit must be zero.
-+ */
-+ return(SkI2cRcvBit(IoC) != 0);
-+} /* SkI2cRcvAck */
-+
-+
-+/*
-+ * Send an NACK.
-+ */
-+void SkI2cSndNAck(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ /*
-+ * Received bit must be zero.
-+ */
-+ SkI2cSndBit(IoC, 1);
-+} /* SkI2cSndNAck */
-+
-+
-+/*
-+ * Send an ACK.
-+ */
-+void SkI2cSndAck(
-+SK_IOC IoC) /* I/O Context */
-+{
-+ /*
-+ * Received bit must be zero.
-+ */
-+ SkI2cSndBit(IoC, 0);
-+} /* SkI2cSndAck */
-+
-+
-+/*
-+ * Send one byte to the TWSI device and wait for ACK.
-+ *
-+ * Return acknowleged status.
-+ */
-+int SkI2cSndByte(
-+SK_IOC IoC, /* I/O Context */
-+int Byte) /* byte to send */
-+{
-+ int i;
-+
-+ for (i = 0; i < 8; i++) {
-+ if (Byte & (1<<(7-i))) {
-+ SkI2cSndBit(IoC, 1);
-+ }
-+ else {
-+ SkI2cSndBit(IoC, 0);
-+ }
-+ }
-+
-+ return(SkI2cRcvAck(IoC));
-+} /* SkI2cSndByte */
-+
-+
-+/*
-+ * Receive one byte and ack it.
-+ *
-+ * Return byte.
-+ */
-+int SkI2cRcvByte(
-+SK_IOC IoC, /* I/O Context */
-+int Last) /* Last Byte Flag */
-+{
-+ int i;
-+ int Byte = 0;
-+
-+ for (i = 0; i < 8; i++) {
-+ Byte <<= 1;
-+ Byte |= SkI2cRcvBit(IoC);
-+ }
-+
-+ if (Last) {
-+ SkI2cSndNAck(IoC);
-+ }
-+ else {
-+ SkI2cSndAck(IoC);
-+ }
-+
-+ return(Byte);
-+} /* SkI2cRcvByte */
-+
-+
-+/*
-+ * Start dialog and send device address
-+ *
-+ * Return 0 if acknowleged, 1 in case of an error
-+ */
-+int SkI2cSndDev(
-+SK_IOC IoC, /* I/O Context */
-+int Addr, /* Device Address */
-+int Rw) /* Read / Write Flag */
-+{
-+ SkI2cStart(IoC);
-+ Rw = ~Rw;
-+ Rw &= I2C_WRITE;
-+ return(SkI2cSndByte(IoC, (Addr << 1) | Rw));
-+} /* SkI2cSndDev */
-+
-+#endif /* SK_DIAG */
-+
-+/*----------------- TWSI CTRL Register Functions ----------*/
-+
-+/*
-+ * waits for a completion of a TWSI transfer
-+ *
-+ * returns 0: success, transfer completes
-+ * 1: error, transfer does not complete, TWSI transfer
-+ * killed, wait loop terminated.
-+ */
-+int SkI2cWait(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */
-+{
-+ SK_U64 StartTime;
-+ SK_U64 CurrentTime;
-+ SK_U32 I2cCtrl;
-+
-+ StartTime = SkOsGetTime(pAC);
-+
-+ do {
-+ CurrentTime = SkOsGetTime(pAC);
-+
-+ if (CurrentTime - StartTime > SK_TICKS_PER_SEC / 8) {
-+
-+ SK_I2C_STOP(IoC);
-+#ifndef SK_DIAG
-+ if (pAC->I2c.InitLevel > SK_INIT_DATA) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG);
-+ }
-+#endif /* !SK_DIAG */
-+ return(1);
-+ }
-+
-+ SK_I2C_GET_CTL(IoC, &I2cCtrl);
-+
-+#ifdef xYUKON_DBG
-+ printf("StartTime=%lu, CurrentTime=%lu\n",
-+ StartTime, CurrentTime);
-+ if (kbhit()) {
-+ return(1);
-+ }
-+#endif /* YUKON_DBG */
-+
-+ } while ((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31);
-+
-+ return(0);
-+} /* SkI2cWait */
-+
-+
-+/*
-+ * waits for a completion of a TWSI transfer
-+ *
-+ * Returns
-+ * Nothing
-+ */
-+void SkI2cWaitIrq(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
-+{
-+ SK_SENSOR *pSen;
-+ SK_U64 StartTime;
-+ SK_U32 IrqSrc;
-+ SK_U32 IsTwsiReadyBit;
-+
-+ pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-+
-+ if (pSen->SenState == SK_SEN_IDLE) {
-+ return;
-+ }
-+
-+ IsTwsiReadyBit = CHIP_ID_YUKON_2(pAC) ? Y2_IS_TWSI_RDY : IS_I2C_READY;
-+
-+ StartTime = SkOsGetTime(pAC);
-+
-+ do {
-+ if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) {
-+
-+ SK_I2C_STOP(IoC);
-+#ifndef SK_DIAG
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E016, SKERR_I2C_E016MSG);
-+#endif /* !SK_DIAG */
-+ return;
-+ }
-+
-+ SK_IN32(IoC, B0_ISRC, &IrqSrc);
-+
-+ } while ((IrqSrc & IsTwsiReadyBit) == 0);
-+
-+ pSen->SenState = SK_SEN_IDLE;
-+ return;
-+} /* SkI2cWaitIrq */
-+
-+/*
-+ * writes a single byte or 4 bytes into the TWSI device
-+ *
-+ * returns 0: success
-+ * 1: error
-+ */
-+int SkI2cWrite(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 I2cData, /* TWSI Data to write */
-+int I2cDev, /* TWSI Device Address */
-+int I2cDevSize, /* TWSI Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
-+int I2cReg, /* TWSI Device Register Address */
-+int I2cBurst) /* TWSI Burst Flag */
-+{
-+ SK_OUT32(IoC, B2_I2C_DATA, I2cData);
-+
-+ SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cDevSize, I2cReg, I2cBurst);
-+
-+ return(SkI2cWait(pAC, IoC, I2C_WRITE));
-+} /* SkI2cWrite*/
-+
-+
-+#ifdef SK_DIAG
-+/*
-+ * reads a single byte or 4 bytes from the TWSI device
-+ *
-+ * returns the word read
-+ */
-+SK_U32 SkI2cRead(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+int I2cDev, /* TWSI Device Address */
-+int I2cDevSize, /* TWSI Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
-+int I2cReg, /* TWSI Device Register Address */
-+int I2cBurst) /* TWSI Burst Flag */
-+{
-+ SK_U32 Data;
-+
-+ SK_OUT32(IoC, B2_I2C_DATA, 0);
-+
-+ SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cDevSize, I2cReg, I2cBurst);
-+
-+ if (SkI2cWait(pAC, IoC, I2C_READ) != 0) {
-+ w_print("%s\n", SKERR_I2C_E002MSG);
-+ }
-+
-+ SK_IN32(IoC, B2_I2C_DATA, &Data);
-+
-+ return(Data);
-+} /* SkI2cRead */
-+#endif /* SK_DIAG */
-+
-+
-+/*
-+ * read a sensor's value
-+ *
-+ * This function reads a sensor's value from the TWSI sensor chip. The sensor
-+ * is defined by its index into the sensors database in the struct pAC points
-+ * to.
-+ * Returns
-+ * 1 if the read is completed
-+ * 0 if the read must be continued (TWSI Bus still allocated)
-+ */
-+int SkI2cReadSensor(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_SENSOR *pSen) /* Sensor to be read */
-+{
-+ if (pSen->SenRead != NULL) {
-+ return((*pSen->SenRead)(pAC, IoC, pSen));
-+ }
-+
-+ return(0); /* no success */
-+} /* SkI2cReadSensor */
-+
-+/*
-+ * Do the Init state 0 initialization
-+ */
-+static int SkI2cInit0(
-+SK_AC *pAC) /* Adapter Context */
-+{
-+ int i;
-+ SK_SENSOR *pSen;
-+
-+ /* Begin with first sensor */
-+ pAC->I2c.CurrSens = 0;
-+
-+ /* Begin with timeout control for state machine */
-+ pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
-+
-+ /* Set sensor number to zero */
-+ pAC->I2c.MaxSens = 0;
-+
-+#ifndef SK_DIAG
-+ /* Initialize Number of Dummy Reads */
-+ pAC->I2c.DummyReads = SK_MAX_SENSORS;
-+#endif /* !SK_DIAG */
-+
-+ for (i = 0; i < SK_MAX_SENSORS; i++) {
-+ pSen = &pAC->I2c.SenTable[i];
-+
-+ pSen->SenDesc = "unknown";
-+ pSen->SenType = SK_SEN_UNKNOWN;
-+ pSen->SenThreErrHigh = 0;
-+ pSen->SenThreErrLow = 0;
-+ pSen->SenThreWarnHigh = 0;
-+ pSen->SenThreWarnLow = 0;
-+ pSen->SenReg = LM80_FAN2_IN;
-+ pSen->SenInit = SK_SEN_DYN_INIT_NONE;
-+ pSen->SenValue = 0;
-+ pSen->SenErrFlag = SK_SEN_ERR_NOT_PRESENT;
-+ pSen->SenErrCts = 0;
-+ pSen->SenBegErrTS = 0;
-+ pSen->SenState = SK_SEN_IDLE;
-+ pSen->SenRead = NULL;
-+ pSen->SenDev = 0;
-+ }
-+
-+ /* Now we are "INIT data"ed */
-+ pAC->I2c.InitLevel = SK_INIT_DATA;
-+ return(0);
-+} /* SkI2cInit0*/
-+
-+
-+/*
-+ * Do the init state 1 initialization
-+ *
-+ * initialize the following register of the LM80:
-+ * Configuration register:
-+ * - START, noINT, activeLOW, noINT#Clear, noRESET, noCI, noGPO#, noINIT
-+ *
-+ * Interrupt Mask Register 1:
-+ * - all interrupts are Disabled (0xff)
-+ *
-+ * Interrupt Mask Register 2:
-+ * - all interrupts are Disabled (0xff) Interrupt modi doesn't matter.
-+ *
-+ * Fan Divisor/RST_OUT register:
-+ * - Divisors set to 1 (bits 00), all others 0s.
-+ *
-+ * OS# Configuration/Temperature resolution Register:
-+ * - all 0s
-+ *
-+ */
-+static int SkI2cInit1(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
-+{
-+ int i;
-+ SK_U8 I2cSwCtrl;
-+ SK_GEPORT *pPrt; /* GIni Port struct pointer */
-+ SK_SENSOR *pSen;
-+
-+ if (pAC->I2c.InitLevel != SK_INIT_DATA) {
-+ /* Re-init not needed in TWSI module */
-+ return(0);
-+ }
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC ||
-+ pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+ /* No sensors on Yukon-EC and Yukon-FE */
-+ return(0);
-+ }
-+
-+ /* Set the Direction of TWSI-Data Pin to IN */
-+ SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR | I2C_DATA);
-+
-+ /* Check for 32-Bit Yukon with Low at TWSI-Data Pin */
-+ SK_I2C_GET_SW(IoC, &I2cSwCtrl);
-+
-+ if ((I2cSwCtrl & I2C_DATA) == 0) {
-+ /* this is a 32-Bit board */
-+ pAC->GIni.GIYukon32Bit = SK_TRUE;
-+ return(0);
-+ }
-+
-+ /* Check for 64 Bit Yukon without sensors */
-+ if (SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_CFG, 0) != 0) {
-+ return(0);
-+ }
-+
-+ (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_1, 0);
-+
-+ (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_2, 0);
-+
-+ (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_FAN_CTRL, 0);
-+
-+ (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_TEMP_CTRL, 0);
-+
-+ (void)SkI2cWrite(pAC, IoC, (SK_U32)LM80_CFG_START, LM80_ADDR, I2C_025K_DEV,
-+ LM80_CFG, 0);
-+
-+ /*
-+ * MaxSens has to be updated here, because PhyType is not
-+ * set when performing Init Level 0
-+ */
-+ pAC->I2c.MaxSens = 5;
-+
-+ pPrt = &pAC->GIni.GP[0];
-+
-+ if (pAC->GIni.GIGenesis) {
-+ if (pPrt->PhyType == SK_PHY_BCOM) {
-+ if (pAC->GIni.GIMacsFound == 1) {
-+ pAC->I2c.MaxSens += 1;
-+ }
-+ else {
-+ pAC->I2c.MaxSens += 3;
-+ }
-+ }
-+ }
-+ else {
-+ pAC->I2c.MaxSens += 3;
-+ }
-+
-+ for (i = 0; i < pAC->I2c.MaxSens; i++) {
-+ pSen = &pAC->I2c.SenTable[i];
-+ switch (i) {
-+ case 0:
-+ pSen->SenDesc = "Temperature";
-+ pSen->SenType = SK_SEN_TEMP;
-+ pSen->SenThreErrHigh = SK_SEN_TEMP_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_TEMP_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_TEMP_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_TEMP_LOW_ERR;
-+ pSen->SenReg = LM80_TEMP_IN;
-+ break;
-+ case 1:
-+ pSen->SenDesc = "Voltage PCI";
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenThreErrHigh = SK_SEN_PCI_5V_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PCI_5V_HIGH_WARN;
-+ if (pAC->GIni.GIPciBus != SK_PEX_BUS) {
-+ pSen->SenThreWarnLow = SK_SEN_PCI_5V_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PCI_5V_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenThreWarnLow = 0;
-+ pSen->SenThreErrLow = 0;
-+ }
-+ pSen->SenReg = LM80_VT0_IN;
-+ break;
-+ case 2:
-+ pSen->SenDesc = "Voltage PCI-IO";
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenThreErrHigh = SK_SEN_PCI_IO_5V_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PCI_IO_5V_HIGH_WARN;
-+ if (pAC->GIni.GIPciBus != SK_PEX_BUS) {
-+ pSen->SenThreWarnLow = SK_SEN_PCI_IO_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PCI_IO_3V3_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenThreWarnLow = 0;
-+ pSen->SenThreErrLow = 0;
-+ }
-+ pSen->SenReg = LM80_VT1_IN;
-+ pSen->SenInit = SK_SEN_DYN_INIT_PCI_IO;
-+ break;
-+ case 3:
-+ if (pAC->GIni.GIGenesis) {
-+ pSen->SenDesc = "Voltage ASIC";
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage VMAIN";
-+ }
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenThreErrHigh = SK_SEN_VDD_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_VDD_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_VDD_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_VDD_LOW_ERR;
-+ pSen->SenReg = LM80_VT2_IN;
-+ break;
-+ case 4:
-+ if (pAC->GIni.GIGenesis) {
-+ if (pPrt->PhyType == SK_PHY_BCOM) {
-+ pSen->SenDesc = "Voltage PHY A PLL";
-+ pSen->SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage PMA";
-+ pSen->SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-+ }
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage VAUX";
-+ pSen->SenThreErrHigh = SK_SEN_VAUX_3V3_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_VAUX_3V3_HIGH_WARN;
-+ if (pAC->GIni.GIVauxAvail) {
-+ pSen->SenThreWarnLow = SK_SEN_VAUX_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_VAUX_3V3_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenThreErrLow = 0;
-+ pSen->SenThreWarnLow = 0;
-+ }
-+ }
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenReg = LM80_VT3_IN;
-+ break;
-+ case 5:
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ if (pAC->GIni.GIChipRev == 0) {
-+ pSen->SenDesc = "Voltage Core 1V3";
-+ pSen->SenThreErrHigh = SK_SEN_CORE_1V3_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_CORE_1V3_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_CORE_1V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_CORE_1V3_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage Core 1V2";
-+ pSen->SenThreErrHigh = SK_SEN_CORE_1V2_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_CORE_1V2_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_CORE_1V2_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_CORE_1V2_LOW_ERR;
-+ }
-+ }
-+ else {
-+ if (pAC->GIni.GIGenesis) {
-+ pSen->SenDesc = "Voltage PHY 2V5";
-+ pSen->SenThreErrHigh = SK_SEN_PHY_2V5_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PHY_2V5_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_PHY_2V5_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage Core 1V5";
-+ pSen->SenThreErrHigh = SK_SEN_CORE_1V5_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_CORE_1V5_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_CORE_1V5_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_CORE_1V5_LOW_ERR;
-+ }
-+ }
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenReg = LM80_VT4_IN;
-+ break;
-+ case 6:
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ pSen->SenDesc = "Voltage PHY 1V5";
-+ pSen->SenThreErrHigh = SK_SEN_CORE_1V5_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_CORE_1V5_HIGH_WARN;
-+ if (pAC->GIni.GIPciBus == SK_PEX_BUS) {
-+ pSen->SenThreWarnLow = SK_SEN_CORE_1V5_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_CORE_1V5_LOW_ERR;
-+ }
-+ else {
-+ pSen->SenThreWarnLow = 0;
-+ pSen->SenThreErrLow = 0;
-+ }
-+ }
-+ else {
-+ if (pAC->GIni.GIGenesis) {
-+ pSen->SenDesc = "Voltage PHY B PLL";
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage PHY 3V3";
-+ }
-+ pSen->SenThreErrHigh = SK_SEN_PLL_3V3_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PLL_3V3_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_PLL_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PLL_3V3_LOW_ERR;
-+ }
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenReg = LM80_VT5_IN;
-+ break;
-+ case 7:
-+ if (pAC->GIni.GIGenesis) {
-+ pSen->SenDesc = "Speed Fan";
-+ pSen->SenType = SK_SEN_FAN;
-+ pSen->SenThreErrHigh = SK_SEN_FAN_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_FAN_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_FAN_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_FAN_LOW_ERR;
-+ pSen->SenReg = LM80_FAN2_IN;
-+ }
-+ else {
-+ pSen->SenDesc = "Voltage PHY 2V5";
-+ pSen->SenType = SK_SEN_VOLT;
-+ pSen->SenThreErrHigh = SK_SEN_PHY_2V5_HIGH_ERR;
-+ pSen->SenThreWarnHigh = SK_SEN_PHY_2V5_HIGH_WARN;
-+ pSen->SenThreWarnLow = SK_SEN_PHY_2V5_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR;
-+ pSen->SenReg = LM80_VT6_IN;
-+ }
-+ break;
-+ default:
-+ SK_ERR_LOG(pAC, SK_ERRCL_INIT | SK_ERRCL_SW,
-+ SKERR_I2C_E001, SKERR_I2C_E001MSG);
-+ break;
-+ }
-+
-+ pSen->SenValue = 0;
-+ pSen->SenErrFlag = SK_SEN_ERR_OK;
-+ pSen->SenErrCts = 0;
-+ pSen->SenBegErrTS = 0;
-+ pSen->SenState = SK_SEN_IDLE;
-+ if (pSen->SenThreWarnLow != 0) {
-+ pSen->SenRead = SkLm80ReadSensor;
-+ }
-+ pSen->SenDev = LM80_ADDR;
-+ }
-+
-+#ifndef SK_DIAG
-+ pAC->I2c.DummyReads = pAC->I2c.MaxSens;
-+#endif /* !SK_DIAG */
-+
-+ /* Clear TWSI IRQ */
-+ SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-+
-+ /* Now we are I/O initialized */
-+ pAC->I2c.InitLevel = SK_INIT_IO;
-+ return(0);
-+} /* SkI2cInit1 */
-+
-+
-+/*
-+ * Init level 2: Start first sensor read.
-+ */
-+static int SkI2cInit2(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
-+{
-+ int ReadComplete;
-+ SK_SENSOR *pSen;
-+
-+ if (pAC->I2c.InitLevel != SK_INIT_IO) {
-+ /* ReInit not needed in TWSI module */
-+ /* Init0 and Init2 not permitted */
-+ return(0);
-+ }
-+
-+ pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-+
-+ ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
-+
-+ if (ReadComplete) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, SKERR_I2C_E008MSG);
-+ }
-+
-+ /* Now we are correctly initialized */
-+ pAC->I2c.InitLevel = SK_INIT_RUN;
-+
-+ return(0);
-+} /* SkI2cInit2*/
-+
-+
-+/*
-+ * Initialize TWSI devices
-+ *
-+ * Get the first voltage value and discard it.
-+ * Go into temperature read mode. A default pointer is not set.
-+ *
-+ * The things to be done depend on the init level in the parameter list:
-+ * Level 0:
-+ * Initialize only the data structures. Do NOT access hardware.
-+ * Level 1:
-+ * Initialize hardware through SK_IN / SK_OUT commands. Do NOT use interrupts.
-+ * Level 2:
-+ * Everything is possible. Interrupts may be used from now on.
-+ *
-+ * return:
-+ * 0 = success
-+ * other = error.
-+ */
-+int SkI2cInit(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context needed in levels 1 and 2 */
-+int Level) /* Init Level */
-+{
-+
-+ switch (Level) {
-+ case SK_INIT_DATA:
-+ return(SkI2cInit0(pAC));
-+ case SK_INIT_IO:
-+ return(SkI2cInit1(pAC, IoC));
-+ case SK_INIT_RUN:
-+ return(SkI2cInit2(pAC, IoC));
-+ default:
-+ break;
-+ }
-+
-+ return(0);
-+} /* SkI2cInit */
-+
-+
-+#ifndef SK_DIAG
-+/*
-+ * Interrupt service function for the TWSI Interface
-+ *
-+ * Clears the Interrupt source
-+ *
-+ * Reads the register and check it for sending a trap.
-+ *
-+ * Starts the timer if necessary.
-+ */
-+void SkI2cIsr(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC) /* I/O Context */
-+{
-+ SK_EVPARA Para;
-+
-+ /* Clear TWSI IRQ */
-+ SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-+
-+ Para.Para64 = 0;
-+ SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_IRQ, Para);
-+} /* SkI2cIsr */
-+
-+
-+/*
-+ * Check this sensors Value against the threshold and send events.
-+ */
-+static void SkI2cCheckSensor(
-+SK_AC *pAC, /* Adapter Context */
-+SK_SENSOR *pSen)
-+{
-+ SK_EVPARA ParaLocal;
-+ SK_BOOL TooHigh; /* Is sensor too high? */
-+ SK_BOOL TooLow; /* Is sensor too low? */
-+ SK_U64 CurrTime; /* Current Time */
-+ SK_BOOL DoTrapSend; /* We need to send a trap */
-+ SK_BOOL DoErrLog; /* We need to log the error */
-+ SK_BOOL IsError; /* Error occured */
-+
-+ /* Check Dummy Reads first */
-+ if (pAC->I2c.DummyReads > 0) {
-+ pAC->I2c.DummyReads--;
-+ return;
-+ }
-+
-+ /* Get the current time */
-+ CurrTime = SkOsGetTime(pAC);
-+
-+ /* Set para to the most useful setting: The current sensor. */
-+ ParaLocal.Para64 = (SK_U64)pAC->I2c.CurrSens;
-+
-+ /* Check the Value against the thresholds. First: Error Thresholds */
-+ TooHigh = pSen->SenValue > pSen->SenThreErrHigh;
-+ TooLow = pSen->SenValue < pSen->SenThreErrLow;
-+
-+ IsError = SK_FALSE;
-+
-+ if (TooHigh || TooLow) {
-+ /* Error condition is satisfied */
-+ DoTrapSend = SK_TRUE;
-+ DoErrLog = SK_TRUE;
-+
-+ /* Now error condition is satisfied */
-+ IsError = SK_TRUE;
-+
-+ if (pSen->SenErrFlag == SK_SEN_ERR_ERR) {
-+ /* This state is the former one */
-+
-+ /* So check first whether we have to send a trap */
-+ if (pSen->SenLastErrTrapTS + SK_SEN_ERR_TR_HOLD > CurrTime) {
-+ /*
-+ * Do NOT send the Trap. The hold back time
-+ * has to run out first.
-+ */
-+ DoTrapSend = SK_FALSE;
-+ }
-+
-+ /* Check now whether we have to log an Error */
-+ if (pSen->SenLastErrLogTS + SK_SEN_ERR_LOG_HOLD > CurrTime) {
-+ /*
-+ * Do NOT log the error. The hold back time
-+ * has to run out first.
-+ */
-+ DoErrLog = SK_FALSE;
-+ }
-+ }
-+ else {
-+ /* We came from a different state -> Set Begin Time Stamp */
-+ pSen->SenBegErrTS = CurrTime;
-+ pSen->SenErrFlag = SK_SEN_ERR_ERR;
-+ }
-+
-+ if (DoTrapSend) {
-+ /* Set current Time */
-+ pSen->SenLastErrTrapTS = CurrTime;
-+ pSen->SenErrCts++;
-+
-+ /* Queue PNMI Event */
-+ SkEventQueue(pAC, SKGE_PNMI, TooHigh ?
-+ SK_PNMI_EVT_SEN_ERR_UPP : SK_PNMI_EVT_SEN_ERR_LOW,
-+ ParaLocal);
-+ }
-+
-+ if (DoErrLog) {
-+ /* Set current Time */
-+ pSen->SenLastErrLogTS = CurrTime;
-+
-+ if (pSen->SenType == SK_SEN_TEMP) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E011, SKERR_I2C_E011MSG);
-+ }
-+ else if (pSen->SenType == SK_SEN_VOLT) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E012, SKERR_I2C_E012MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E015, SKERR_I2C_E015MSG);
-+ }
-+ }
-+ }
-+
-+ /* Check the Value against the thresholds */
-+ /* 2nd: Warning thresholds */
-+ TooHigh = pSen->SenValue > pSen->SenThreWarnHigh;
-+ TooLow = pSen->SenValue < pSen->SenThreWarnLow;
-+
-+ if (!IsError && (TooHigh || TooLow)) {
-+ /* Error condition is satisfied */
-+ DoTrapSend = SK_TRUE;
-+ DoErrLog = SK_TRUE;
-+
-+ if (pSen->SenErrFlag == SK_SEN_ERR_WARN) {
-+ /* This state is the former one */
-+
-+ /* So check first whether we have to send a trap */
-+ if (pSen->SenLastWarnTrapTS + SK_SEN_WARN_TR_HOLD > CurrTime) {
-+ /*
-+ * Do NOT send the Trap. The hold back time
-+ * has to run out first.
-+ */
-+ DoTrapSend = SK_FALSE;
-+ }
-+
-+ /* Check now whether we have to log an Error */
-+ if (pSen->SenLastWarnLogTS + SK_SEN_WARN_LOG_HOLD > CurrTime) {
-+ /*
-+ * Do NOT log the error. The hold back time
-+ * has to run out first.
-+ */
-+ DoErrLog = SK_FALSE;
-+ }
-+ }
-+ else {
-+ /* We came from a different state -> Set Begin Time Stamp */
-+ pSen->SenBegWarnTS = CurrTime;
-+ pSen->SenErrFlag = SK_SEN_ERR_WARN;
-+ }
-+
-+ if (DoTrapSend) {
-+ /* Set current Time */
-+ pSen->SenLastWarnTrapTS = CurrTime;
-+ pSen->SenWarnCts++;
-+
-+ /* Queue PNMI Event */
-+ SkEventQueue(pAC, SKGE_PNMI, TooHigh ?
-+ SK_PNMI_EVT_SEN_WAR_UPP : SK_PNMI_EVT_SEN_WAR_LOW, ParaLocal);
-+ }
-+
-+ if (DoErrLog) {
-+ /* Set current Time */
-+ pSen->SenLastWarnLogTS = CurrTime;
-+
-+ if (pSen->SenType == SK_SEN_TEMP) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SKERR_I2C_E009MSG);
-+ }
-+ else if (pSen->SenType == SK_SEN_VOLT) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, SKERR_I2C_E010MSG);
-+ }
-+ else {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, SKERR_I2C_E014MSG);
-+ }
-+ }
-+ }
-+
-+ /* Check for NO error at all */
-+ if (!IsError && !TooHigh && !TooLow) {
-+ /* Set o.k. Status if no error and no warning condition */
-+ pSen->SenErrFlag = SK_SEN_ERR_OK;
-+ }
-+
-+ /* End of check against the thresholds */
-+
-+ if (pSen->SenInit == SK_SEN_DYN_INIT_PCI_IO) {
-+ /* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
-+ pSen->SenInit = SK_SEN_DYN_INIT_NONE;
-+
-+ if (pSen->SenValue > SK_SEN_PCI_IO_RANGE_LIMITER) {
-+ /* 5V PCI-IO Voltage */
-+ pSen->SenThreWarnLow = SK_SEN_PCI_IO_5V_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_PCI_IO_5V_LOW_ERR;
-+ }
-+ else {
-+ /* 3.3V PCI-IO Voltage */
-+ pSen->SenThreWarnHigh = SK_SEN_PCI_IO_3V3_HIGH_WARN;
-+ pSen->SenThreErrHigh = SK_SEN_PCI_IO_3V3_HIGH_ERR;
-+ }
-+ }
-+
-+#ifdef TEST_ONLY
-+ /* Dynamic thresholds also for VAUX of LM80 sensor */
-+ if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) {
-+
-+ pSen->SenInit = SK_SEN_DYN_INIT_NONE;
-+
-+ /* 3.3V VAUX Voltage */
-+ if (pSen->SenValue > SK_SEN_VAUX_RANGE_LIMITER) {
-+ pSen->SenThreWarnLow = SK_SEN_VAUX_3V3_LOW_WARN;
-+ pSen->SenThreErrLow = SK_SEN_VAUX_3V3_LOW_ERR;
-+ }
-+ /* 0V VAUX Voltage */
-+ else {
-+ pSen->SenThreWarnHigh = SK_SEN_VAUX_0V_WARN_ERR;
-+ pSen->SenThreErrHigh = SK_SEN_VAUX_0V_WARN_ERR;
-+ }
-+ }
-+
-+ /* Check initialization state: the VIO Thresholds need adaption */
-+ if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN &&
-+ pSen->SenValue > SK_SEN_WARNLOW2C &&
-+ pSen->SenValue < SK_SEN_WARNHIGH2) {
-+
-+ pSen->SenThreErrLow = SK_SEN_ERRLOW2C;
-+ pSen->SenThreWarnLow = SK_SEN_WARNLOW2C;
-+ pSen->SenInit = SK_TRUE;
-+ }
-+
-+ if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN &&
-+ pSen->SenValue > SK_SEN_WARNLOW2 &&
-+ pSen->SenValue < SK_SEN_WARNHIGH2C) {
-+
-+ pSen->SenThreErrHigh = SK_SEN_ERRHIGH2C;
-+ pSen->SenThreWarnHigh = SK_SEN_WARNHIGH2C;
-+ pSen->SenInit = SK_TRUE;
-+ }
-+#endif
-+
-+ if (pSen->SenInit != SK_SEN_DYN_INIT_NONE) {
-+ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG);
-+ }
-+} /* SkI2cCheckSensor */
-+
-+
-+/*
-+ * The only Event to be served is the timeout event
-+ *
-+ */
-+int SkI2cEvent(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
-+SK_U32 Event, /* Module specific Event */
-+SK_EVPARA Para) /* Event specific Parameter */
-+{
-+ int ReadComplete;
-+ SK_SENSOR *pSen;
-+ SK_U32 Time;
-+ SK_EVPARA ParaLocal;
-+ int i;
-+
-+ /* New case: no sensors */
-+ if (pAC->I2c.MaxSens == 0) {
-+ return(0);
-+ }
-+
-+ switch (Event) {
-+ case SK_I2CEV_IRQ:
-+ pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-+ ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
-+
-+ if (ReadComplete) {
-+ /* Check sensor against defined thresholds */
-+ SkI2cCheckSensor(pAC, pSen);
-+
-+ /* Increment Current sensor and set appropriate Timeout */
-+ pAC->I2c.CurrSens++;
-+ if (pAC->I2c.CurrSens >= pAC->I2c.MaxSens) {
-+ pAC->I2c.CurrSens = 0;
-+ Time = SK_I2C_TIM_LONG;
-+ }
-+ else {
-+ Time = SK_I2C_TIM_SHORT;
-+ }
-+
-+ /* Start Timer */
-+ ParaLocal.Para64 = (SK_U64)0;
-+
-+ pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
-+
-+ SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-+ SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-+ }
-+ else {
-+ /* Start Timer */
-+ ParaLocal.Para64 = (SK_U64)0;
-+
-+ pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
-+
-+ SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH,
-+ SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-+ }
-+ break;
-+ case SK_I2CEV_TIM:
-+ if (pAC->I2c.TimerMode == SK_TIMER_NEW_GAUGING) {
-+
-+ ParaLocal.Para64 = (SK_U64)0;
-+ SkTimerStop(pAC, IoC, &pAC->I2c.SenTimer);
-+
-+ pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-+ ReadComplete = SkI2cReadSensor(pAC, IoC, pSen);
-+
-+ if (ReadComplete) {
-+ /* Check sensor against defined thresholds */
-+ SkI2cCheckSensor(pAC, pSen);
-+
-+ /* Increment Current sensor and set appropriate Timeout */
-+ pAC->I2c.CurrSens++;
-+ if (pAC->I2c.CurrSens == pAC->I2c.MaxSens) {
-+ pAC->I2c.CurrSens = 0;
-+ Time = SK_I2C_TIM_LONG;
-+ }
-+ else {
-+ Time = SK_I2C_TIM_SHORT;
-+ }
-+
-+ /* Start Timer */
-+ ParaLocal.Para64 = (SK_U64)0;
-+
-+ pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
-+
-+ SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-+ SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-+ }
-+ }
-+ else {
-+ pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens];
-+ pSen->SenErrFlag = SK_SEN_ERR_FAULTY;
-+ SK_I2C_STOP(IoC);
-+
-+ /* Increment Current sensor and set appropriate Timeout */
-+ pAC->I2c.CurrSens++;
-+ if (pAC->I2c.CurrSens == pAC->I2c.MaxSens) {
-+ pAC->I2c.CurrSens = 0;
-+ Time = SK_I2C_TIM_LONG;
-+ }
-+ else {
-+ Time = SK_I2C_TIM_SHORT;
-+ }
-+
-+ /* Start Timer */
-+ ParaLocal.Para64 = (SK_U64)0;
-+
-+ pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
-+
-+ SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
-+ SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
-+ }
-+ break;
-+ case SK_I2CEV_CLEAR:
-+ for (i = 0; i < SK_MAX_SENSORS; i++) {
-+ pSen = &pAC->I2c.SenTable[i];
-+
-+ pSen->SenErrFlag = SK_SEN_ERR_OK;
-+ pSen->SenErrCts = 0;
-+ pSen->SenWarnCts = 0;
-+ pSen->SenBegErrTS = 0;
-+ pSen->SenBegWarnTS = 0;
-+ pSen->SenLastErrTrapTS = (SK_U64)0;
-+ pSen->SenLastErrLogTS = (SK_U64)0;
-+ pSen->SenLastWarnTrapTS = (SK_U64)0;
-+ pSen->SenLastWarnLogTS = (SK_U64)0;
-+ }
-+ break;
-+ default:
-+ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E006, SKERR_I2C_E006MSG);
-+ }
-+
-+ return(0);
-+} /* SkI2cEvent*/
-+
-+#endif /* !SK_DIAG */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/skvpd.c ./drivers/net/sk98lin/skvpd.c
---- ./drivers/net/sk98lin.sk98/skvpd.c 2004-10-19 01:54:32.000000000 +0400
-+++ ./drivers/net/sk98lin/skvpd.c 2006-08-31 14:59:52.000000000 +0400
-@@ -1,22 +1,22 @@
- /******************************************************************************
- *
- * Name: skvpd.c
-- * Project: GEnesis, PCI Gigabit Ethernet Adapter
-- * Version: $Revision: 1.37 $
-- * Date: $Date: 2003/01/13 10:42:45 $
-- * Purpose: Shared software to read and write VPD data
-+ * Project: Gigabit Ethernet Adapters, VPD-Module
-+ * Version: $Revision: 2.6 $
-+ * Date: $Date: 2004/11/02 10:47:39 $
-+ * Purpose: Shared software to read and write VPD
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-- * (C)Copyright 1998-2003 SysKonnect GmbH.
-+ * (C)Copyright 1998-2002 SysKonnect.
-+ * (C)Copyright 2002-2004 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
- *
- ******************************************************************************/
-@@ -25,7 +25,7 @@
- Please refer skvpd.txt for infomation how to include this module
- */
- static const char SysKonnectFileId[] =
-- "@(#)$Id: skvpd.c,v 1.37 2003/01/13 10:42:45 rschmidt Exp $ (C) SK";
-+ "@(#) $Id: skvpd.c,v 2.6 2004/11/02 10:47:39 rschmidt Exp $ (C) Marvell.";
-
- #include "h/skdrv1st.h"
- #include "h/sktypes.h"
-@@ -59,9 +59,10 @@ int event) /* event to wait for (VPD_RE
- SK_U64 start_time;
- SK_U16 state;
-
-- SK_DBG_MSG(pAC,SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
- ("VPD wait for %s\n", event?"Write":"Read"));
- start_time = SkOsGetTime(pAC);
-+
- do {
- if (SkOsGetTime(pAC) - start_time > SK_TICKS_PER_SEC) {
-
-@@ -81,17 +82,18 @@ int event) /* event to wait for (VPD_RE
- ("ERROR:VPD wait timeout\n"));
- return(1);
- }
--
-+
- VPD_IN16(pAC, IoC, PCI_VPD_ADR_REG, &state);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
- ("state = %x, event %x\n",state,event));
-- } while((int)(state & PCI_VPD_FLAG) == event);
-+ } while ((int)(state & PCI_VPD_FLAG) == event);
-
- return(0);
- }
-
--#ifdef SKDIAG
-+
-+#ifdef SK_DIAG
-
- /*
- * Read the dword at address 'addr' from the VPD EEPROM.
-@@ -124,16 +126,15 @@ int addr) /* VPD address */
- Rtv = 0;
-
- VPD_IN32(pAC, IoC, PCI_VPD_DAT_REG, &Rtv);
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
- ("VPD read dword data = 0x%x\n",Rtv));
- return(Rtv);
- }
-+#endif /* SK_DIAG */
-
--#endif /* SKDIAG */
--
--#if 0
-
-+#ifdef XXX
- /*
- Write the dword 'data' at address 'addr' into the VPD EEPROM, and
- verify that the data is written.
-@@ -151,7 +152,6 @@ int addr) /* VPD address */
- . over all 3.8 ms 13.2 ms
- .
-
--
- Returns 0: success
- 1: error, I2C transfer does not terminate
- 2: error, data verify error
-@@ -189,7 +189,8 @@ SK_U32 data) /* VPD data to write */
- return(0);
- } /* VpdWriteDWord */
-
--#endif /* 0 */
-+#endif /* XXX */
-+
-
- /*
- * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from
-@@ -215,7 +216,7 @@ int Len) /* number of bytes to read / t
- pComp = (SK_U8 *) buf;
-
- for (i = 0; i < Len; i++, buf++) {
-- if ((i%sizeof(SK_U32)) == 0) {
-+ if ((i % SZ_LONG) == 0) {
- /*
- * At the begin of each cycle read the Data Reg
- * So it is initialized even if only a few bytes
-@@ -233,14 +234,13 @@ int Len) /* number of bytes to read / t
- }
- }
-
-- /* Write current Byte */
-- VPD_OUT8(pAC, IoC, PCI_VPD_DAT_REG + (i%sizeof(SK_U32)),
-- *(SK_U8*)buf);
-+ /* Write current byte */
-+ VPD_OUT8(pAC, IoC, PCI_VPD_DAT_REG + (i % SZ_LONG), *(SK_U8*)buf);
-
-- if (((i%sizeof(SK_U32)) == 3) || (i == (Len - 1))) {
-+ if (((i % SZ_LONG) == 3) || (i == (Len - 1))) {
- /* New Address needs to be written to VPD_ADDR reg */
- AdrReg = (SK_U16) Addr;
-- Addr += sizeof(SK_U32);
-+ Addr += SZ_LONG;
- AdrReg |= VPD_WRITE; /* WRITE operation */
-
- VPD_OUT16(pAC, IoC, PCI_VPD_ADR_REG, AdrReg);
-@@ -250,7 +250,7 @@ int Len) /* number of bytes to read / t
- if (Rtv != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
- ("Write Timed Out\n"));
-- return(i - (i%sizeof(SK_U32)));
-+ return(i - (i % SZ_LONG));
- }
-
- /*
-@@ -265,18 +265,18 @@ int Len) /* number of bytes to read / t
- if (Rtv != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
- ("Verify Timed Out\n"));
-- return(i - (i%sizeof(SK_U32)));
-+ return(i - (i % SZ_LONG));
- }
-
-- for (j = 0; j <= (int)(i%sizeof(SK_U32)); j++, pComp++) {
--
-+ for (j = 0; j <= (int)(i % SZ_LONG); j++, pComp++) {
-+
- VPD_IN8(pAC, IoC, PCI_VPD_DAT_REG + j, &Data);
--
-+
- if (Data != *pComp) {
- /* Verify Error */
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
- ("WriteStream Verify Error\n"));
-- return(i - (i%sizeof(SK_U32)) + j);
-+ return(i - (i % SZ_LONG) + j);
- }
- }
- }
-@@ -284,7 +284,7 @@ int Len) /* number of bytes to read / t
-
- return(Len);
- }
--
-+
-
- /*
- * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from
-@@ -304,10 +304,10 @@ int Len) /* number of bytes to read / t
- int Rtv;
-
- for (i = 0; i < Len; i++, buf++) {
-- if ((i%sizeof(SK_U32)) == 0) {
-+ if ((i % SZ_LONG) == 0) {
- /* New Address needs to be written to VPD_ADDR reg */
- AdrReg = (SK_U16) Addr;
-- Addr += sizeof(SK_U32);
-+ Addr += SZ_LONG;
- AdrReg &= ~VPD_WRITE; /* READ operation */
-
- VPD_OUT16(pAC, IoC, PCI_VPD_ADR_REG, AdrReg);
-@@ -318,13 +318,13 @@ int Len) /* number of bytes to read / t
- return(i);
- }
- }
-- VPD_IN8(pAC, IoC, PCI_VPD_DAT_REG + (i%sizeof(SK_U32)),
-- (SK_U8 *)buf);
-+ VPD_IN8(pAC, IoC, PCI_VPD_DAT_REG + (i % SZ_LONG), (SK_U8 *)buf);
- }
-
- return(Len);
- }
-
-+
- /*
- * Read ore writes 'len' bytes of VPD data, starting at 'addr' from
- * or to the I2C EEPROM.
-@@ -350,14 +350,14 @@ int dir) /* transfer direction may be V
- return(0);
-
- vpd_rom_size = pAC->vpd.rom_size;
--
-+
- if (addr > vpd_rom_size - 4) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
- ("Address error: 0x%x, exp. < 0x%x\n",
- addr, vpd_rom_size - 4));
- return(0);
- }
--
-+
- if (addr + len > vpd_rom_size) {
- len = vpd_rom_size - addr;
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
-@@ -374,8 +374,8 @@ int dir) /* transfer direction may be V
- return(Rtv);
- }
-
--#ifdef SKDIAG
-
-+#if defined (SK_DIAG) || defined (SK_ASF)
- /*
- * Read 'len' bytes of VPD data, starting at 'addr'.
- *
-@@ -391,6 +391,7 @@ int len) /* number of bytes to read */
- return(VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ));
- }
-
-+
- /*
- * Write 'len' bytes of *but to the VPD EEPROM, starting at 'addr'.
- *
-@@ -405,18 +406,27 @@ int len) /* number of bytes to write */
- {
- return(VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE));
- }
--#endif /* SKDIAG */
-+#endif /* SK_DIAG */
-
--/*
-- * (re)initialize the VPD buffer
-+
-+/******************************************************************************
- *
-- * Reads the VPD data from the EEPROM into the VPD buffer.
-- * Get the remaining read only and read / write space.
-+ * VpdInit() - (re)initialize the VPD buffer
- *
-- * return 0: success
-- * 1: fatal VPD error
-+ * Description:
-+ * Reads the VPD data from the EEPROM into the VPD buffer.
-+ * Get the remaining read only and read / write space.
-+ *
-+ * Note:
-+ * This is a local function and should be used locally only.
-+ * However, the ASF module needs to use this function also.
-+ * Therfore it has been published.
-+ *
-+ * Returns:
-+ * 0: success
-+ * 1: fatal VPD error
- */
--static int VpdInit(
-+int VpdInit(
- SK_AC *pAC, /* Adapters context */
- SK_IOC IoC) /* IO Context */
- {
-@@ -427,14 +437,14 @@ SK_IOC IoC) /* IO Context */
- SK_U16 dev_id;
- SK_U32 our_reg2;
-
-- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_INIT, ("VpdInit .. "));
--
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_INIT, ("VpdInit ... "));
-+
- VPD_IN16(pAC, IoC, PCI_DEVICE_ID, &dev_id);
--
-+
- VPD_IN32(pAC, IoC, PCI_OUR_REG_2, &our_reg2);
--
-+
- pAC->vpd.rom_size = 256 << ((our_reg2 & PCI_VPD_ROM_SZ) >> 14);
--
-+
- /*
- * this function might get used before the hardware is initialized
- * therefore we cannot always trust in GIChipId
-@@ -465,19 +475,15 @@ SK_IOC IoC) /* IO Context */
- ("Block Read Error\n"));
- return(1);
- }
--
-+
- pAC->vpd.vpd_size = vpd_size;
-
- /* Asus K8V Se Deluxe bugfix. Correct VPD content */
-- /* MBo April 2004 */
-- if (((unsigned char)pAC->vpd.vpd_buf[0x3f] == 0x38) &&
-- ((unsigned char)pAC->vpd.vpd_buf[0x40] == 0x3c) &&
-- ((unsigned char)pAC->vpd.vpd_buf[0x41] == 0x45)) {
-- printk("sk98lin: Asus mainboard with buggy VPD? "
-- "Correcting data.\n");
-- pAC->vpd.vpd_buf[0x40] = 0x38;
-- }
-+ i = 62;
-+ if (!SK_STRNCMP(pAC->vpd.vpd_buf + i, " 8<E", 4)) {
-
-+ pAC->vpd.vpd_buf[i + 2] = '8';
-+ }
-
- /* find the end tag of the RO area */
- if (!(r = vpd_find_para(pAC, VPD_RV, &rp))) {
-@@ -485,9 +491,9 @@ SK_IOC IoC) /* IO Context */
- ("Encoding Error: RV Tag not found\n"));
- return(1);
- }
--
-+
- if (r->p_val + r->p_len > pAC->vpd.vpd_buf + vpd_size/2) {
-- SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
- ("Encoding Error: Invalid VPD struct size\n"));
- return(1);
- }
-@@ -497,7 +503,7 @@ SK_IOC IoC) /* IO Context */
- for (i = 0, x = 0; (unsigned)i <= (unsigned)vpd_size/2 - r->p_len; i++) {
- x += pAC->vpd.vpd_buf[i];
- }
--
-+
- if (x != 0) {
- /* checksum error */
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
-@@ -511,7 +517,7 @@ SK_IOC IoC) /* IO Context */
- ("Encoding Error: RV Tag not found\n"));
- return(1);
- }
--
-+
- if (r->p_val < pAC->vpd.vpd_buf + vpd_size/2) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
- ("Encoding Error: Invalid VPD struct size\n"));
-@@ -531,6 +537,7 @@ SK_IOC IoC) /* IO Context */
- return(0);
- }
-
-+
- /*
- * find the Keyword 'key' in the VPD buffer and fills the
- * parameter struct 'p' with it's values
-@@ -541,7 +548,7 @@ SK_IOC IoC) /* IO Context */
- static SK_VPD_PARA *vpd_find_para(
- SK_AC *pAC, /* common data base */
- const char *key, /* keyword to find (e.g. "MN") */
--SK_VPD_PARA *p) /* parameter description struct */
-+SK_VPD_PARA *p) /* parameter description struct */
- {
- char *v ; /* points to VPD buffer */
- int max; /* Maximum Number of Iterations */
-@@ -556,10 +563,10 @@ SK_VPD_PARA *p) /* parameter descriptio
- if (*v != (char)RES_ID) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
- ("Error: 0x%x missing\n", RES_ID));
-- return NULL;
-+ return(0);
- }
-
-- if (strcmp(key, VPD_NAME) == 0) {
-+ if (SK_STRCMP(key, VPD_NAME) == 0) {
- p->p_len = VPD_GET_RES_LEN(v);
- p->p_val = VPD_GET_VAL(v);
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
-@@ -569,7 +576,7 @@ SK_VPD_PARA *p) /* parameter descriptio
-
- v += 3 + VPD_GET_RES_LEN(v) + 3;
- for (;; ) {
-- if (SK_MEMCMP(key,v,2) == 0) {
-+ if (SK_MEMCMP(key, v, 2) == 0) {
- p->p_len = VPD_GET_VPD_LEN(v);
- p->p_val = VPD_GET_VAL(v);
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
-@@ -579,11 +586,11 @@ SK_VPD_PARA *p) /* parameter descriptio
-
- /* exit when reaching the "RW" Tag or the maximum of itera. */
- max--;
-- if (SK_MEMCMP(VPD_RW,v,2) == 0 || max == 0) {
-+ if (SK_MEMCMP(VPD_RW, v, 2) == 0 || max == 0) {
- break;
- }
-
-- if (SK_MEMCMP(VPD_RV,v,2) == 0) {
-+ if (SK_MEMCMP(VPD_RV, v, 2) == 0) {
- v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */
- }
- else {
-@@ -600,9 +607,10 @@ SK_VPD_PARA *p) /* parameter descriptio
- ("Key/Len Encoding error\n"));
- }
- #endif /* DEBUG */
-- return NULL;
-+ return(0);
- }
-
-+
- /*
- * Move 'n' bytes. Begin with the last byte if 'n' is > 0,
- * Start with the last byte if n is < 0.
-@@ -637,6 +645,7 @@ int n) /* number of bytes the memory
- }
- }
-
-+
- /*
- * setup the VPD keyword 'key' at 'ip'.
- *
-@@ -653,10 +662,11 @@ char *ip) /* inseration point */
- p = (SK_VPD_KEY *) ip;
- p->p_key[0] = key[0];
- p->p_key[1] = key[1];
-- p->p_len = (unsigned char) len;
-- SK_MEMCPY(&p->p_val,buf,len);
-+ p->p_len = (unsigned char)len;
-+ SK_MEMCPY(&p->p_val, buf, len);
- }
-
-+
- /*
- * Setup the VPD end tag "RV" / "RW".
- * Also correct the remaining space variables vpd_free_ro / vpd_free_rw.
-@@ -682,7 +692,7 @@ char *etp) /* end pointer input positio
-
- if (p->p_key[0] != 'R' || (p->p_key[1] != 'V' && p->p_key[1] != 'W')) {
- /* something wrong here, encoding error */
-- SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
- ("Encoding Error: invalid end tag\n"));
- return(1);
- }
-@@ -714,6 +724,7 @@ char *etp) /* end pointer input positio
- return(0);
- }
-
-+
- /*
- * Insert a VPD keyword into the VPD buffer.
- *
-@@ -747,11 +758,11 @@ int op) /* operation to do: ADD_KEY o
-
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
- ("VPD setup para key = %s, val = %s\n",key,buf));
--
-+
- vpd_size = pAC->vpd.vpd_size;
-
- rtv = 0;
-- ip = NULL;
-+ ip = 0;
- if (type == VPD_RW_KEY) {
- /* end tag is "RW" */
- free = pAC->vpd.v.vpd_free_rw;
-@@ -875,18 +886,18 @@ int *elements) /* number of keywords re
- }
- }
-
-- if ((signed)strlen(VPD_NAME) + 1 <= *len) {
-+ if ((signed)SK_STRLEN(VPD_NAME) + 1 <= *len) {
- v = pAC->vpd.vpd_buf;
-- strcpy(buf,VPD_NAME);
-- n = strlen(VPD_NAME) + 1;
-+ SK_STRCPY(buf, VPD_NAME);
-+ n = SK_STRLEN(VPD_NAME) + 1;
- buf += n;
- *elements = 1;
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_RX,
-- ("'%c%c' ",v[0],v[1]));
-+ ("'%c%c' ", v[0], v[1]));
- }
- else {
- *len = 0;
-- SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
- ("buffer overflow\n"));
- return(2);
- }
-@@ -894,17 +905,17 @@ int *elements) /* number of keywords re
- v += 3 + VPD_GET_RES_LEN(v) + 3;
- for (;; ) {
- /* exit when reaching the "RW" Tag */
-- if (SK_MEMCMP(VPD_RW,v,2) == 0) {
-+ if (SK_MEMCMP(VPD_RW, v, 2) == 0) {
- break;
- }
-
-- if (SK_MEMCMP(VPD_RV,v,2) == 0) {
-+ if (SK_MEMCMP(VPD_RV, v, 2) == 0) {
- v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */
- continue;
- }
-
- if (n+3 <= *len) {
-- SK_MEMCPY(buf,v,2);
-+ SK_MEMCPY(buf, v, 2);
- buf += 2;
- *buf++ = '\0';
- n += 3;
-@@ -991,13 +1002,14 @@ char *key) /* keyword to write (allowed
- {
- if ((*key != 'Y' && *key != 'V') ||
- key[1] < '0' || key[1] > 'Z' ||
-- (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) {
-+ (key[1] > '9' && key[1] < 'A') || SK_STRLEN(key) != 2) {
-
- return(SK_FALSE);
- }
- return(SK_TRUE);
- }
-
-+
- /*
- * Read the contents of the VPD EEPROM and copy it to the VPD
- * buffer if not already done. Insert/overwrite the keyword 'key'
-@@ -1026,7 +1038,7 @@ const char *buf) /* buffer where the key
-
- if ((*key != 'Y' && *key != 'V') ||
- key[1] < '0' || key[1] > 'Z' ||
-- (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) {
-+ (key[1] > '9' && key[1] < 'A') || SK_STRLEN(key) != 2) {
-
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
- ("illegal key tag, keyword not written\n"));
-@@ -1042,13 +1054,13 @@ const char *buf) /* buffer where the key
- }
-
- rtv = 0;
-- len = strlen(buf);
-+ len = SK_STRLEN(buf);
- if (len > VPD_MAX_LEN) {
- /* cut it */
- len = VPD_MAX_LEN;
- rtv = 2;
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
-- ("keyword too long, cut after %d bytes\n",VPD_MAX_LEN));
-+ ("keyword too long, cut after %d bytes\n", VPD_MAX_LEN));
- }
- if ((rtv2 = VpdSetupPara(pAC, key, buf, len, VPD_RW_KEY, OWR_KEY)) != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
-@@ -1059,6 +1071,7 @@ const char *buf) /* buffer where the key
- return(rtv);
- }
-
-+
- /*
- * Read the contents of the VPD EEPROM and copy it to the
- * VPD buffer if not already done. Remove the VPD keyword
-@@ -1082,7 +1095,7 @@ char *key) /* keyword to read (e.g. "MN"
-
- vpd_size = pAC->vpd.vpd_size;
-
-- SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("VPD delete key %s\n",key));
-+ SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_TX, ("VPD delete key %s\n", key));
- if ((pAC->vpd.v.vpd_status & VPD_VALID) == 0) {
- if (VpdInit(pAC, IoC) != 0) {
- SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
-@@ -1119,6 +1132,7 @@ char *key) /* keyword to read (e.g. "MN"
- return(0);
- }
-
-+
- /*
- * If the VPD buffer contains valid data write the VPD
- * read/write area back to the VPD EEPROM.
-@@ -1149,7 +1163,6 @@ SK_IOC IoC) /* IO Context */
- }
-
-
--
- /*
- * Read the contents of the VPD EEPROM and copy it to the VPD buffer
- * if not already done. If the keyword "VF" is not present it will be
-@@ -1178,7 +1191,7 @@ char *msg) /* error log message */
- }
- }
-
-- len = strlen(msg);
-+ len = SK_STRLEN(msg);
- if (len > VPD_MAX_LEN) {
- /* cut it */
- len = VPD_MAX_LEN;
-diff -Nurap ./drivers/net/sk98lin.sk98/skxmac2.c ./drivers/net/sk98lin/skxmac2.c
---- ./drivers/net/sk98lin.sk98/skxmac2.c 2004-10-19 01:55:28.000000000 +0400
-+++ ./drivers/net/sk98lin/skxmac2.c 2006-08-31 14:59:52.000000000 +0400
-@@ -2,23 +2,24 @@
- *
- * Name: skxmac2.c
- * Project: Gigabit Ethernet Adapters, Common Modules
-- * Version: $Revision: 1.102 $
-- * Date: $Date: 2003/10/02 16:53:58 $
-+ * Version: $Revision: 2.52 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
- * Purpose: Contains functions to initialize the MACs and PHYs
- *
- ******************************************************************************/
-
- /******************************************************************************
- *
-+ * LICENSE:
- * (C)Copyright 1998-2002 SysKonnect.
-- * (C)Copyright 2002-2003 Marvell.
-+ * (C)Copyright 2002-2005 Marvell.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-- *
- * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
- *
- ******************************************************************************/
-
-@@ -37,7 +38,7 @@ typedef struct s_PhyHack {
-
- #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
- static const char SysKonnectFileId[] =
-- "@(#) $Id: skxmac2.c,v 1.102 2003/10/02 16:53:58 rschmidt Exp $ (C) Marvell.";
-+ "@(#) $Id: skxmac2.c,v 2.52 2005/12/14 16:11:35 ibrueder Exp $ (C) Marvell.";
- #endif
-
- #ifdef GENESIS
-@@ -83,7 +84,7 @@ static int SkXmAutoNegDoneNat (SK_AC*, S
- * Returns:
- * nothing
- */
--void SkXmPhyRead(
-+int SkXmPhyRead(
- SK_AC *pAC, /* Adapter Context */
- SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
-@@ -94,13 +95,13 @@ SK_U16 SK_FAR *pVal) /* Pointer to Value
- SK_GEPORT *pPrt;
-
- pPrt = &pAC->GIni.GP[Port];
--
-+
- /* write the PHY register's address */
- XM_OUT16(IoC, Port, XM_PHY_ADDR, PhyReg | pPrt->PhyAddr);
--
-+
- /* get the PHY register's value */
- XM_IN16(IoC, Port, XM_PHY_DATA, pVal);
--
-+
- if (pPrt->PhyType != SK_PHY_XMAC) {
- do {
- XM_IN16(IoC, Port, XM_MMU_CMD, &Mmu);
-@@ -110,6 +111,8 @@ SK_U16 SK_FAR *pVal) /* Pointer to Value
- /* get the PHY register's value */
- XM_IN16(IoC, Port, XM_PHY_DATA, pVal);
- }
-+
-+ return(0);
- } /* SkXmPhyRead */
-
-
-@@ -122,7 +125,7 @@ SK_U16 SK_FAR *pVal) /* Pointer to Value
- * Returns:
- * nothing
- */
--void SkXmPhyWrite(
-+int SkXmPhyWrite(
- SK_AC *pAC, /* Adapter Context */
- SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
-@@ -133,26 +136,28 @@ SK_U16 Val) /* Value */
- SK_GEPORT *pPrt;
-
- pPrt = &pAC->GIni.GP[Port];
--
-+
- if (pPrt->PhyType != SK_PHY_XMAC) {
- do {
- XM_IN16(IoC, Port, XM_MMU_CMD, &Mmu);
- /* wait until 'Busy' is cleared */
- } while ((Mmu & XM_MMU_PHY_BUSY) != 0);
- }
--
-+
- /* write the PHY register's address */
- XM_OUT16(IoC, Port, XM_PHY_ADDR, PhyReg | pPrt->PhyAddr);
--
-+
- /* write the PHY register's value */
- XM_OUT16(IoC, Port, XM_PHY_DATA, Val);
--
-+
- if (pPrt->PhyType != SK_PHY_XMAC) {
- do {
- XM_IN16(IoC, Port, XM_MMU_CMD, &Mmu);
- /* wait until 'Busy' is cleared */
- } while ((Mmu & XM_MMU_PHY_BUSY) != 0);
- }
-+
-+ return(0);
- } /* SkXmPhyWrite */
- #endif /* GENESIS */
-
-@@ -165,63 +170,97 @@ SK_U16 Val) /* Value */
- * Description: reads a 16-bit word from GPHY through MDIO
- *
- * Returns:
-- * nothing
-+ * 0 o.k.
-+ * 1 error during MDIO read
-+ * 2 timeout
- */
--void SkGmPhyRead(
-+int SkGmPhyRead(
- SK_AC *pAC, /* Adapter Context */
- SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int PhyReg, /* Register Address (Offset) */
- SK_U16 SK_FAR *pVal) /* Pointer to Value */
- {
-+ SK_U16 Word;
- SK_U16 Ctrl;
- SK_GEPORT *pPrt;
--#ifdef VCPU
-- u_long SimCyle;
-- u_long SimLowTime;
--
-- VCPUgetTime(&SimCyle, &SimLowTime);
-- VCPUprintf(0, "SkGmPhyRead(%u), SimCyle=%u, SimLowTime=%u\n",
-- PhyReg, SimCyle, SimLowTime);
--#endif /* VCPU */
--
-+ SK_U32 StartTime;
-+ SK_U32 CurrTime;
-+ SK_U32 Delta;
-+ SK_U32 TimeOut;
-+ int Rtv;
-+
-+ Rtv = 0;
-+
-+ *pVal = 0xffff;
-+
- pPrt = &pAC->GIni.GP[Port];
--
-+
- /* set PHY-Register offset and 'Read' OpCode (= 1) */
-- *pVal = (SK_U16)(GM_SMI_CT_PHY_AD(pPrt->PhyAddr) |
-+ Word = (SK_U16)(GM_SMI_CT_PHY_AD(pPrt->PhyAddr) |
- GM_SMI_CT_REG_AD(PhyReg) | GM_SMI_CT_OP_RD);
-
-- GM_OUT16(IoC, Port, GM_SMI_CTRL, *pVal);
-+ GM_OUT16(IoC, Port, GM_SMI_CTRL, Word);
-
-- GM_IN16(IoC, Port, GM_SMI_CTRL, &Ctrl);
--
- /* additional check for MDC/MDIO activity */
-- if ((Ctrl & GM_SMI_CT_BUSY) == 0) {
-- *pVal = 0;
-- return;
-+ GM_IN16(IoC, Port, GM_SMI_CTRL, &Ctrl);
-+
-+ if (Ctrl == 0xffff || (Ctrl & GM_SMI_CT_OP_RD) == 0) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("PHY read impossible on Port %d (Ctrl=0x%04x)\n", Port, Ctrl));
-+
-+ return(1);
- }
-
-- *pVal |= GM_SMI_CT_BUSY;
--
-- do {
-+ Word |= GM_SMI_CT_BUSY;
-+
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &StartTime);
-+
-+ /* set timeout to 10 ms */
-+ TimeOut = HW_MS_TO_TICKS(pAC, 10);
-+
-+ do { /* wait until 'Busy' is cleared and 'ReadValid' is set */
- #ifdef VCPU
- VCPUwaitTime(1000);
- #endif /* VCPU */
-
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &CurrTime);
-+
-+ if (CurrTime >= StartTime) {
-+ Delta = CurrTime - StartTime;
-+ }
-+ else {
-+ Delta = CurrTime + ~StartTime + 1;
-+ }
-+
-+ if (Delta > TimeOut) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("PHY read timeout on Port %d (Ctrl=0x%04x)\n", Port, Ctrl));
-+ Rtv = 2;
-+ break;
-+ }
-+
- GM_IN16(IoC, Port, GM_SMI_CTRL, &Ctrl);
-
-- /* wait until 'ReadValid' is set */
-- } while (Ctrl == *pVal);
--
-- /* get the PHY register's value */
-+ /* Error on reading SMI Control Register */
-+ if (Ctrl == 0xffff) {
-+ return(1);
-+ }
-+
-+ } while ((Ctrl ^ Word) != (GM_SMI_CT_RD_VAL | GM_SMI_CT_BUSY));
-+
- GM_IN16(IoC, Port, GM_SMI_DATA, pVal);
-
--#ifdef VCPU
-- VCPUgetTime(&SimCyle, &SimLowTime);
-- VCPUprintf(0, "VCPUgetTime(), SimCyle=%u, SimLowTime=%u\n",
-- SimCyle, SimLowTime);
--#endif /* VCPU */
-+ /* dummy read after GM_IN16() */
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &CurrTime);
-
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("SkGmPhyRead Port:%d, Reg=%d, Val = 0x%04X\n",
-+ Port, PhyReg, *pVal));
-+
-+ return(Rtv);
- } /* SkGmPhyRead */
-
-
-@@ -232,9 +271,11 @@ SK_U16 SK_FAR *pVal) /* Pointer to Value
- * Description: writes a 16-bit word to GPHY through MDIO
- *
- * Returns:
-- * nothing
-+ * 0 o.k.
-+ * 1 error during MDIO read
-+ * 2 timeout
- */
--void SkGmPhyWrite(
-+int SkGmPhyWrite(
- SK_AC *pAC, /* Adapter Context */
- SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
-@@ -243,54 +284,78 @@ SK_U16 Val) /* Value */
- {
- SK_U16 Ctrl;
- SK_GEPORT *pPrt;
--#ifdef VCPU
-- SK_U32 DWord;
-- u_long SimCyle;
-- u_long SimLowTime;
--
-- VCPUgetTime(&SimCyle, &SimLowTime);
-- VCPUprintf(0, "SkGmPhyWrite(Reg=%u, Val=0x%04x), SimCyle=%u, SimLowTime=%u\n",
-- PhyReg, Val, SimCyle, SimLowTime);
--#endif /* VCPU */
--
-+ SK_U32 StartTime;
-+ SK_U32 CurrTime;
-+ SK_U32 Delta;
-+ SK_U32 TimeOut;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("SkGmPhyWrite Port:%d, Reg=%d, Val = 0x%04X\n",
-+ Port, PhyReg, Val));
-+
- pPrt = &pAC->GIni.GP[Port];
--
-+
- /* write the PHY register's value */
- GM_OUT16(IoC, Port, GM_SMI_DATA, Val);
--
-- /* set PHY-Register offset and 'Write' OpCode (= 0) */
-- Val = GM_SMI_CT_PHY_AD(pPrt->PhyAddr) | GM_SMI_CT_REG_AD(PhyReg);
-
-- GM_OUT16(IoC, Port, GM_SMI_CTRL, Val);
--
-- GM_IN16(IoC, Port, GM_SMI_CTRL, &Ctrl);
--
-+#ifdef DEBUG
- /* additional check for MDC/MDIO activity */
-- if ((Ctrl & GM_SMI_CT_BUSY) == 0) {
-- return;
-+ GM_IN16(IoC, Port, GM_SMI_DATA, &Ctrl);
-+
-+ if (Ctrl != Val) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("PHY write impossible on Port %d (Val=0x%04x)\n", Port, Ctrl));
-+
-+ return(1);
- }
--
-- Val |= GM_SMI_CT_BUSY;
-+#endif /* DEBUG */
-
-- do {
--#ifdef VCPU
-- /* read Timer value */
-- SK_IN32(IoC, B2_TI_VAL, &DWord);
-+ /* set PHY-Register offset and 'Write' OpCode (= 0) */
-+ Ctrl = (SK_U16)(GM_SMI_CT_PHY_AD(pPrt->PhyAddr) |
-+ GM_SMI_CT_REG_AD(PhyReg));
-
-+ GM_OUT16(IoC, Port, GM_SMI_CTRL, Ctrl);
-+
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &StartTime);
-+
-+ /* set timeout to 10 ms */
-+ TimeOut = HW_MS_TO_TICKS(pAC, 10);
-+
-+ do { /* wait until 'Busy' is cleared */
-+#ifdef VCPU
- VCPUwaitTime(1000);
- #endif /* VCPU */
-
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &CurrTime);
-+
-+ if (CurrTime >= StartTime) {
-+ Delta = CurrTime - StartTime;
-+ }
-+ else {
-+ Delta = CurrTime + ~StartTime + 1;
-+ }
-+
-+ if (Delta > TimeOut) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("PHY write timeout on Port %d (Ctrl=0x%04x)\n", Port, Ctrl));
-+ return(2);
-+ }
-+
- GM_IN16(IoC, Port, GM_SMI_CTRL, &Ctrl);
-
-- /* wait until 'Busy' is cleared */
-- } while (Ctrl == Val);
--
--#ifdef VCPU
-- VCPUgetTime(&SimCyle, &SimLowTime);
-- VCPUprintf(0, "VCPUgetTime(), SimCyle=%u, SimLowTime=%u\n",
-- SimCyle, SimLowTime);
--#endif /* VCPU */
-+ /* Error on reading SMI Control Register */
-+ if (Ctrl == 0xffff) {
-+ return(1);
-+ }
-
-+ } while ((Ctrl & GM_SMI_CT_BUSY) != 0);
-+
-+ /* dummy read after GM_IN16() */
-+ SK_IN32(IoC, GMAC_TI_ST_VAL, &CurrTime);
-+
-+ return(0);
- } /* SkGmPhyWrite */
- #endif /* YUKON */
-
-@@ -312,16 +377,8 @@ int Port, /* Port Index (MAC_1 + n) */
- int PhyReg, /* Register Address (Offset) */
- SK_U16 *pVal) /* Pointer to Value */
- {
-- void (*r_func)(SK_AC *pAC, SK_IOC IoC, int Port, int Reg, SK_U16 *pVal);
-
-- if (pAC->GIni.GIGenesis) {
-- r_func = SkXmPhyRead;
-- }
-- else {
-- r_func = SkGmPhyRead;
-- }
--
-- r_func(pAC, IoC, Port, PhyReg, pVal);
-+ pAC->GIni.GIFunc.pFnMacPhyRead(pAC, IoC, Port, PhyReg, pVal);
- } /* SkGePhyRead */
-
-
-@@ -341,16 +398,8 @@ int Port, /* Port Index (MAC_1 + n) */
- int PhyReg, /* Register Address (Offset) */
- SK_U16 Val) /* Value */
- {
-- void (*w_func)(SK_AC *pAC, SK_IOC IoC, int Port, int Reg, SK_U16 Val);
-
-- if (pAC->GIni.GIGenesis) {
-- w_func = SkXmPhyWrite;
-- }
-- else {
-- w_func = SkGmPhyWrite;
-- }
--
-- w_func(pAC, IoC, Port, PhyReg, Val);
-+ pAC->GIni.GIFunc.pFnMacPhyWrite(pAC, IoC, Port, PhyReg, Val);
- } /* SkGePhyWrite */
- #endif /* SK_DIAG */
-
-@@ -360,15 +409,15 @@ SK_U16 Val) /* Value */
- * SkMacPromiscMode() - Enable / Disable Promiscuous Mode
- *
- * Description:
-- * enables / disables promiscuous mode by setting Mode Register (XMAC) or
-- * Receive Control Register (GMAC) dep. on board type
-+ * enables / disables promiscuous mode by setting Mode Register (XMAC) or
-+ * Receive Control Register (GMAC) dep. on board type
- *
- * Returns:
- * nothing
- */
- void SkMacPromiscMode(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL Enable) /* Enable / Disable */
- {
-@@ -377,11 +426,11 @@ SK_BOOL Enable) /* Enable / Disable */
- #endif
- #ifdef GENESIS
- SK_U32 MdReg;
--#endif
-+#endif
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- XM_IN32(IoC, Port, XM_MODE, &MdReg);
- /* enable or disable promiscuous mode */
- if (Enable) {
-@@ -394,12 +443,12 @@ SK_BOOL Enable) /* Enable / Disable */
- XM_OUT32(IoC, Port, XM_MODE, MdReg);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- GM_IN16(IoC, Port, GM_RX_CTRL, &RcReg);
--
-+
- /* enable or disable unicast and multicast filtering */
- if (Enable) {
- RcReg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
-@@ -420,28 +469,28 @@ SK_BOOL Enable) /* Enable / Disable */
- * SkMacHashing() - Enable / Disable Hashing
- *
- * Description:
-- * enables / disables hashing by setting Mode Register (XMAC) or
-- * Receive Control Register (GMAC) dep. on board type
-+ * enables / disables hashing by setting Mode Register (XMAC) or
-+ * Receive Control Register (GMAC) dep. on board type
- *
- * Returns:
- * nothing
- */
- void SkMacHashing(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL Enable) /* Enable / Disable */
- {
- #ifdef YUKON
- SK_U16 RcReg;
--#endif
-+#endif
- #ifdef GENESIS
- SK_U32 MdReg;
- #endif
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- XM_IN32(IoC, Port, XM_MODE, &MdReg);
- /* enable or disable hashing */
- if (Enable) {
-@@ -454,12 +503,12 @@ SK_BOOL Enable) /* Enable / Disable */
- XM_OUT32(IoC, Port, XM_MODE, MdReg);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- GM_IN16(IoC, Port, GM_RX_CTRL, &RcReg);
--
-+
- /* enable or disable multicast filtering */
- if (Enable) {
- RcReg |= GM_RXCR_MCF_ENA;
-@@ -487,8 +536,8 @@ SK_BOOL Enable) /* Enable / Disable */
- * - don't set XMR_FS_ERR in status SK_LENERR_OK_ON/OFF
- * for inrange length error frames
- * - don't set XMR_FS_ERR in status SK_BIG_PK_OK_ON/OFF
-- * for frames > 1514 bytes
-- * - enable Rx of own packets SK_SELF_RX_ON/OFF
-+ * for frames > 1514 bytes
-+ * - enable Rx of own packets SK_SELF_RX_ON/OFF
- *
- * for incoming packets may be enabled/disabled by this function.
- * Additional modes may be added later.
-@@ -499,11 +548,11 @@ SK_BOOL Enable) /* Enable / Disable */
- * nothing
- */
- static void SkXmSetRxCmd(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Mode) /* Mode is SK_STRIP_FCS_ON/OFF, SK_STRIP_PAD_ON/OFF,
-- SK_LENERR_OK_ON/OFF, or SK_BIG_PK_OK_ON/OFF */
-+ SK_LENERR_OK_ON/OFF, or SK_BIG_PK_OK_ON/OFF */
- {
- SK_U16 OldRxCmd;
- SK_U16 RxCmd;
-@@ -511,7 +560,7 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- XM_IN16(IoC, Port, XM_RX_CMD, &OldRxCmd);
-
- RxCmd = OldRxCmd;
--
-+
- switch (Mode & (SK_STRIP_FCS_ON | SK_STRIP_FCS_OFF)) {
- case SK_STRIP_FCS_ON:
- RxCmd |= XM_RX_STRIP_FCS;
-@@ -572,8 +621,8 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- * The features
- * - FCS (CRC) stripping, SK_STRIP_FCS_ON/OFF
- * - don't set GMR_FS_LONG_ERR SK_BIG_PK_OK_ON/OFF
-- * for frames > 1514 bytes
-- * - enable Rx of own packets SK_SELF_RX_ON/OFF
-+ * for frames > 1514 bytes
-+ * - enable Rx of own packets SK_SELF_RX_ON/OFF
- *
- * for incoming packets may be enabled/disabled by this function.
- * Additional modes may be added later.
-@@ -584,20 +633,17 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- * nothing
- */
- static void SkGmSetRxCmd(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Mode) /* Mode is SK_STRIP_FCS_ON/OFF, SK_STRIP_PAD_ON/OFF,
-- SK_LENERR_OK_ON/OFF, or SK_BIG_PK_OK_ON/OFF */
-+ SK_LENERR_OK_ON/OFF, or SK_BIG_PK_OK_ON/OFF */
- {
-- SK_U16 OldRxCmd;
- SK_U16 RxCmd;
-
- if ((Mode & (SK_STRIP_FCS_ON | SK_STRIP_FCS_OFF)) != 0) {
--
-- GM_IN16(IoC, Port, GM_RX_CTRL, &OldRxCmd);
-
-- RxCmd = OldRxCmd;
-+ GM_IN16(IoC, Port, GM_RX_CTRL, &RxCmd);
-
- if ((Mode & SK_STRIP_FCS_ON) != 0) {
- RxCmd |= GM_RXCR_CRC_DIS;
-@@ -605,17 +651,13 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- else {
- RxCmd &= ~GM_RXCR_CRC_DIS;
- }
-- /* Write the new mode to the Rx control register if required */
-- if (OldRxCmd != RxCmd) {
-- GM_OUT16(IoC, Port, GM_RX_CTRL, RxCmd);
-- }
-+ /* Write the new mode to the Rx Control register */
-+ GM_OUT16(IoC, Port, GM_RX_CTRL, RxCmd);
- }
-
- if ((Mode & (SK_BIG_PK_OK_ON | SK_BIG_PK_OK_OFF)) != 0) {
--
-- GM_IN16(IoC, Port, GM_SERIAL_MODE, &OldRxCmd);
-
-- RxCmd = OldRxCmd;
-+ GM_IN16(IoC, Port, GM_SERIAL_MODE, &RxCmd);
-
- if ((Mode & SK_BIG_PK_OK_ON) != 0) {
- RxCmd |= GM_SMOD_JUMBO_ENA;
-@@ -623,10 +665,8 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- else {
- RxCmd &= ~GM_SMOD_JUMBO_ENA;
- }
-- /* Write the new mode to the Rx control register if required */
-- if (OldRxCmd != RxCmd) {
-- GM_OUT16(IoC, Port, GM_SERIAL_MODE, RxCmd);
-- }
-+ /* Write the new mode to the Serial Mode register */
-+ GM_OUT16(IoC, Port, GM_SERIAL_MODE, RxCmd);
- }
- } /* SkGmSetRxCmd */
-
-@@ -641,17 +681,17 @@ int Mode) /* Mode is SK_STRIP_FCS_ON/O
- * nothing
- */
- void SkMacSetRxCmd(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Mode) /* Rx Mode */
- {
- if (pAC->GIni.GIGenesis) {
--
-+
- SkXmSetRxCmd(pAC, IoC, Port, Mode);
- }
- else {
--
-+
- SkGmSetRxCmd(pAC, IoC, Port, Mode);
- }
-
-@@ -668,15 +708,15 @@ int Mode) /* Rx Mode */
- * nothing
- */
- void SkMacCrcGener(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL Enable) /* Enable / Disable */
- {
- SK_U16 Word;
-
- if (pAC->GIni.GIGenesis) {
--
-+
- XM_IN16(IoC, Port, XM_TX_CMD, &Word);
-
- if (Enable) {
-@@ -689,9 +729,9 @@ SK_BOOL Enable) /* Enable / Disable */
- XM_OUT16(IoC, Port, XM_TX_CMD, Word);
- }
- else {
--
-+
- GM_IN16(IoC, Port, GM_TX_CTRL, &Word);
--
-+
- if (Enable) {
- Word &= ~GM_TXCR_CRC_DIS;
- }
-@@ -721,14 +761,14 @@ SK_BOOL Enable) /* Enable / Disable */
- * nothing
- */
- void SkXmClrExactAddr(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int StartNum, /* Begin with this Address Register Index (0..15) */
- int StopNum) /* Stop after finished with this Register Idx (0..15) */
- {
- int i;
-- SK_U16 ZeroAddr[3] = {0x0000, 0x0000, 0x0000};
-+ SK_U16 ZeroAddr[3] = {0, 0, 0};
-
- if ((unsigned)StartNum > 15 || (unsigned)StopNum > 15 ||
- StartNum > StopNum) {
-@@ -738,7 +778,7 @@ int StopNum) /* Stop after finished wit
- }
-
- for (i = StartNum; i <= StopNum; i++) {
-- XM_OUTADDR(IoC, Port, XM_EXM(i), &ZeroAddr[0]);
-+ XM_OUTADDR(IoC, Port, XM_EXM(i), ZeroAddr);
- }
- } /* SkXmClrExactAddr */
- #endif /* GENESIS */
-@@ -755,21 +795,21 @@ int StopNum) /* Stop after finished wit
- * nothing
- */
- void SkMacFlushTxFifo(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- #ifdef GENESIS
- SK_U32 MdReg;
-
- if (pAC->GIni.GIGenesis) {
--
-+
- XM_IN32(IoC, Port, XM_MODE, &MdReg);
-
- XM_OUT32(IoC, Port, XM_MODE, MdReg | XM_MD_FTF);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* no way to flush the FIFO we have to issue a reset */
-@@ -791,8 +831,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkMacFlushRxFifo(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- #ifdef GENESIS
-@@ -805,7 +845,7 @@ int Port) /* Port Index (MAC_1 + n) */
- XM_OUT32(IoC, Port, XM_MODE, MdReg | XM_MD_FRF);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* no way to flush the FIFO we have to issue a reset */
-@@ -853,23 +893,23 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkXmSoftRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
-- SK_U16 ZeroAddr[4] = {0x0000, 0x0000, 0x0000, 0x0000};
--
-+ SK_U16 ZeroAddr[4] = {0, 0, 0, 0};
-+
- /* reset the statistics module */
- XM_OUT32(IoC, Port, XM_GP_PORT, XM_GP_RES_STAT);
-
- /* disable all XMAC IRQs */
- XM_OUT16(IoC, Port, XM_IMSK, 0xffff);
--
-+
- XM_OUT32(IoC, Port, XM_MODE, 0); /* clear Mode Reg */
--
-+
- XM_OUT16(IoC, Port, XM_TX_CMD, 0); /* reset TX CMD Reg */
- XM_OUT16(IoC, Port, XM_RX_CMD, 0); /* reset RX CMD Reg */
--
-+
- /* disable all PHY IRQs */
- switch (pAC->GIni.GP[Port].PhyType) {
- case SK_PHY_BCOM:
-@@ -887,13 +927,13 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- /* clear the Hash Register */
-- XM_OUTHASH(IoC, Port, XM_HSM, &ZeroAddr);
-+ XM_OUTHASH(IoC, Port, XM_HSM, ZeroAddr);
-
- /* clear the Exact Match Address registers */
- SkXmClrExactAddr(pAC, IoC, Port, 0, 15);
--
-+
- /* clear the Source Check Address registers */
-- XM_OUTHASH(IoC, Port, XM_SRC_CHK, &ZeroAddr);
-+ XM_OUTHASH(IoC, Port, XM_SRC_CHK, ZeroAddr);
-
- } /* SkXmSoftRst */
-
-@@ -916,8 +956,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkXmHardRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U32 Reg;
-@@ -940,19 +980,19 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
--
-+
- SK_IN16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), &Word);
--
-+
- } while ((Word & MFF_SET_MAC_RST) == 0);
- }
-
- /* For external PHYs there must be special handling */
- if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) {
--
-+
- SK_IN32(IoC, B2_GP_IO, &Reg);
--
-+
- if (Port == 0) {
-- Reg |= GP_DIR_0; /* set to output */
-+ Reg |= GP_DIR_0; /* set to output */
- Reg &= ~GP_IO_0; /* set PHY reset (active low) */
- }
- else {
-@@ -978,12 +1018,12 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkXmClearRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U32 DWord;
--
-+
- /* clear HW reset */
- SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
-
-@@ -1000,7 +1040,7 @@ int Port) /* Port Index (MAC_1 + n) */
- /* Clear PHY reset */
- SK_OUT32(IoC, B2_GP_IO, DWord);
-
-- /* Enable GMII interface */
-+ /* enable GMII interface */
- XM_OUT16(IoC, Port, XM_HW_CFG, XM_HW_GMII_MD);
- }
- } /* SkXmClearRst */
-@@ -1020,29 +1060,28 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkGmSoftRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
-- SK_U16 EmptyHash[4] = {0x0000, 0x0000, 0x0000, 0x0000};
-- SK_U16 RxCtrl;
-+ SK_U16 EmptyHash[4] = { 0x0000, 0x0000, 0x0000, 0x0000 };
-+ SK_U16 RxCtrl;
-
- /* reset the statistics module */
-
- /* disable all GMAC IRQs */
-- SK_OUT8(IoC, GMAC_IRQ_MSK, 0);
--
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_IRQ_MSK), 0);
-+
- /* disable all PHY IRQs */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK, 0);
--
-+
- /* clear the Hash Register */
- GM_OUTHASH(IoC, Port, GM_MC_ADDR_H1, EmptyHash);
-
-- /* Enable Unicast and Multicast filtering */
-+ /* enable Unicast and Multicast filtering */
- GM_IN16(IoC, Port, GM_RX_CTRL, &RxCtrl);
--
-- GM_OUT16(IoC, Port, GM_RX_CTRL,
-- (SK_U16)(RxCtrl | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA));
-+
-+ GM_OUT16(IoC, Port, GM_RX_CTRL, RxCtrl | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
-
- } /* SkGmSoftRst */
-
-@@ -1057,16 +1096,16 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkGmHardRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U32 DWord;
--
-+
- /* WA code for COMA mode */
- if (pAC->GIni.GIYukonLite &&
-- pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
--
-+ pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
-+
- SK_IN32(IoC, B2_GP_IO, &DWord);
-
- DWord |= (GP_DIR_9 | GP_IO_9);
-@@ -1076,10 +1115,10 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- /* set GPHY Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), GPC_RST_SET);
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_SET);
-
- /* set GMAC Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_SET);
-
- } /* SkGmHardRst */
-
-@@ -1094,24 +1133,29 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkGmClearRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U32 DWord;
--
-+#ifndef SK_SLIM
-+ SK_U16 PhyId0;
-+ SK_U16 PhyId1;
-+ SK_U16 Word;
-+#endif
-+
- #ifdef XXX
-- /* clear GMAC Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_CLR);
-+ /* clear GMAC Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-
-- /* set GMAC Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
-+ /* set GMAC Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_SET);
- #endif /* XXX */
-
- /* WA code for COMA mode */
- if (pAC->GIni.GIYukonLite &&
-- pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
--
-+ pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
-+
- SK_IN32(IoC, B2_GP_IO, &DWord);
-
- DWord |= GP_DIR_9; /* set to output */
-@@ -1121,30 +1165,87 @@ int Port) /* Port Index (MAC_1 + n) */
- SK_OUT32(IoC, B2_GP_IO, DWord);
- }
-
-- /* set HWCFG_MODE */
-- DWord = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP |
-- GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE |
-- (pAC->GIni.GICopperType ? GPC_HWCFG_GMII_COP :
-- GPC_HWCFG_GMII_FIB);
-+#ifdef VCPU
-+ /* set MAC Reset before PHY reset is set */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_SET);
-+#endif /* VCPU */
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* set GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_SET);
-
-- /* set GPHY Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_SET);
-+ /* release GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_CLR);
-
-- /* release GPHY Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_CLR);
-+#ifdef DEBUG
-+ /* additional check for PEX */
-+ SK_IN16(IoC, GPHY_CTRL, &Word);
-+
-+ if (pAC->GIni.GIPciBus == SK_PEX_BUS && Word != GPC_RST_CLR) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("Error on PEX-bus after GPHY reset\n"));
-+ }
-+#endif /* DEBUG */
-+ }
-+ else {
-+ /* set HWCFG_MODE */
-+ DWord = GPC_INT_POL | GPC_DIS_FC | GPC_DIS_SLEEP |
-+ GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE |
-+ (pAC->GIni.GICopperType ? GPC_HWCFG_GMII_COP :
-+ GPC_HWCFG_GMII_FIB);
-+
-+ /* set GPHY Control reset */
-+ SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_SET);
-+
-+ /* release GPHY Control reset */
-+ SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_CLR);
-+ }
-
- #ifdef VCPU
-+ /* wait for internal initialization of GPHY */
-+ VCPUprintf(0, "Waiting until PHY %d is ready to initialize\n", Port);
-+ VCpuWait(10000);
-+
-+ /* release GMAC reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-+
-+ /* wait for stable GMAC clock */
- VCpuWait(9000);
- #endif /* VCPU */
-
- /* clear GMAC Control reset */
-- SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-+
-+#ifdef SK_DIAG
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_472) && Port == MAC_2) {
-+
-+ /* clear GMAC 1 Control reset */
-+ SK_OUT8(IoC, MR_ADDR(MAC_1, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-+
-+ do {
-+ /* set GMAC 2 Control reset */
-+ SK_OUT8(IoC, MR_ADDR(MAC_2, GMAC_CTRL), (SK_U8)GMC_RST_SET);
-+
-+ /* clear GMAC 2 Control reset */
-+ SK_OUT8(IoC, MR_ADDR(MAC_2, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-+
-+ SkGmPhyRead(pAC, IoC, MAC_2, PHY_MARV_ID0, &PhyId0);
-+
-+ SkGmPhyRead(pAC, IoC, MAC_2, PHY_MARV_ID1, &PhyId1);
-+
-+ SkGmPhyRead(pAC, IoC, MAC_2, PHY_MARV_INT_MASK, &Word);
-+
-+ } while (Word != 0 || PhyId0 != PHY_MARV_ID0_VAL ||
-+ PhyId1 != PHY_MARV_ID1_Y2);
-+ }
-+#endif /* SK_DIAG */
-
- #ifdef VCPU
- VCpuWait(2000);
--
-+
- SK_IN32(IoC, MR_ADDR(Port, GPHY_CTRL), &DWord);
--
-+
- SK_IN32(IoC, B0_ISRC, &DWord);
- #endif /* VCPU */
-
-@@ -1162,37 +1263,33 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkMacSoftRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
-- SK_GEPORT *pPrt;
--
-- pPrt = &pAC->GIni.GP[Port];
--
- /* disable receiver and transmitter */
- SkMacRxTxDisable(pAC, IoC, Port);
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- SkXmSoftRst(pAC, IoC, Port);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- SkGmSoftRst(pAC, IoC, Port);
- }
- #endif /* YUKON */
-
- /* flush the MAC's Rx and Tx FIFOs */
- SkMacFlushTxFifo(pAC, IoC, Port);
--
-+
- SkMacFlushRxFifo(pAC, IoC, Port);
-
-- pPrt->PState = SK_PRT_STOP;
-+ pAC->GIni.GP[Port].PState = SK_PRT_STOP;
-
- } /* SkMacSoftRst */
-
-@@ -1207,30 +1304,32 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkMacHardRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
--
-+
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- SkXmHardRst(pAC, IoC, Port);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- SkGmHardRst(pAC, IoC, Port);
- }
- #endif /* YUKON */
-
-+ pAC->GIni.GP[Port].PHWLinkUp = SK_FALSE;
-+
- pAC->GIni.GP[Port].PState = SK_PRT_RESET;
-
- } /* SkMacHardRst */
-
--
-+#ifndef SK_SLIM
- /******************************************************************************
- *
- * SkMacClearRst() - Clear the MAC reset
-@@ -1241,27 +1340,27 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkMacClearRst(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
--
-+
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- SkXmClearRst(pAC, IoC, Port);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- SkGmClearRst(pAC, IoC, Port);
- }
- #endif /* YUKON */
-
- } /* SkMacClearRst */
--
-+#endif /* !SK_SLIM */
-
- #ifdef GENESIS
- /******************************************************************************
-@@ -1279,8 +1378,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkXmInitMac(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -1290,13 +1389,13 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt = &pAC->GIni.GP[Port];
-
- if (pPrt->PState == SK_PRT_STOP) {
-- /* Port State: SK_PRT_STOP */
- /* Verify that the reset bit is cleared */
- SK_IN16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), &SWord);
-
- if ((SWord & MFF_SET_MAC_RST) != 0) {
- /* PState does not match HW state */
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E006, SKERR_HWI_E006MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("SkXmInitMac: PState does not match HW state"));
- /* Correct it */
- pPrt->PState = SK_PRT_RESET;
- }
-@@ -1315,7 +1414,7 @@ int Port) /* Port Index (MAC_1 + n) */
- * Must be done AFTER first access to BCOM chip.
- */
- XM_IN16(IoC, Port, XM_MMU_CMD, &SWord);
--
-+
- XM_OUT16(IoC, Port, XM_MMU_CMD, SWord | XM_MMU_NO_PRE);
-
- if (pPrt->PhyId1 == PHY_BCOM_ID1_C0) {
-@@ -1348,7 +1447,7 @@ int Port) /* Port Index (MAC_1 + n) */
- * Disable Power Management after reset.
- */
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_CTRL, &SWord);
--
-+
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUX_CTRL,
- (SK_U16)(SWord | PHY_B_AC_DIS_PM));
-
-@@ -1357,7 +1456,7 @@ int Port) /* Port Index (MAC_1 + n) */
-
- /* Dummy read the Interrupt source register */
- XM_IN16(IoC, Port, XM_ISRC, &SWord);
--
-+
- /*
- * The auto-negotiation process starts immediately after
- * clearing the reset. The auto-negotiation process should be
-@@ -1383,7 +1482,7 @@ int Port) /* Port Index (MAC_1 + n) */
- * independent. Remember this when changing.
- */
- SK_IN16(IoC, (B2_MAC_2 + Port * 8 + i * 2), &SWord);
--
-+
- XM_OUT16(IoC, Port, (XM_SA + i * 2), SWord);
- }
-
-@@ -1401,7 +1500,7 @@ int Port) /* Port Index (MAC_1 + n) */
- SWord = SK_XM_THR_SL; /* for single port */
-
- if (pAC->GIni.GIMacsFound > 1) {
-- switch (pAC->GIni.GIPortUsage) {
-+ switch (pPrt->PPortUsage) {
- case SK_RED_LINK:
- SWord = SK_XM_THR_REDL; /* redundant link */
- break;
-@@ -1424,7 +1523,7 @@ int Port) /* Port Index (MAC_1 + n) */
- /* setup register defaults for the Rx Command Register */
- SWord = XM_RX_STRIP_FCS | XM_RX_LENERR_OK;
-
-- if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) {
-+ if (pPrt->PPortUsage == SK_JUMBO_LINK) {
- SWord |= XM_RX_BIG_PK_OK;
- }
-
-@@ -1436,7 +1535,7 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- SWord |= XM_RX_DIS_CEXT;
- }
--
-+
- XM_OUT16(IoC, Port, XM_RX_CMD, SWord);
-
- /*
-@@ -1493,8 +1592,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkGmInitMac(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -1505,24 +1604,29 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt = &pAC->GIni.GP[Port];
-
- if (pPrt->PState == SK_PRT_STOP) {
-- /* Port State: SK_PRT_STOP */
- /* Verify that the reset bit is cleared */
- SK_IN32(IoC, MR_ADDR(Port, GMAC_CTRL), &DWord);
--
-+
- if ((DWord & GMC_RST_SET) != 0) {
- /* PState does not match HW state */
-- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E006, SKERR_HWI_E006MSG);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("SkGmInitMac: PState does not match HW state"));
- /* Correct it */
- pPrt->PState = SK_PRT_RESET;
- }
-+ else {
-+ /* enable PHY interrupts */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK,
-+ (SK_U16)PHY_M_DEF_MSK);
-+ }
- }
-
- if (pPrt->PState == SK_PRT_RESET) {
--
-+
- SkGmHardRst(pAC, IoC, Port);
-
- SkGmClearRst(pAC, IoC, Port);
--
-+
- /* Auto-negotiation ? */
- if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
- /* Auto-negotiation disabled */
-@@ -1532,10 +1636,10 @@ int Port) /* Port Index (MAC_1 + n) */
-
- /* disable auto-update for speed, duplex and flow-control */
- SWord |= GM_GPCR_AU_ALL_DIS;
--
-+
- /* setup General Purpose Control Register */
- GM_OUT16(IoC, Port, GM_GP_CTRL, SWord);
--
-+
- SWord = GM_GPCR_AU_ALL_DIS;
- }
- else {
-@@ -1546,7 +1650,10 @@ int Port) /* Port Index (MAC_1 + n) */
- switch (pPrt->PLinkSpeed) {
- case SK_LSPEED_AUTO:
- case SK_LSPEED_1000MBPS:
-- SWord |= GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100;
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+
-+ SWord |= GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100;
-+ }
- break;
- case SK_LSPEED_100MBPS:
- SWord |= GM_GPCR_SPEED_100;
-@@ -1564,8 +1671,6 @@ int Port) /* Port Index (MAC_1 + n) */
- /* flow-control settings */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
-- /* set Pause Off */
-- SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_PAUSE_OFF);
- /* disable Tx & Rx flow-control */
- SWord |= GM_GPCR_FC_TX_DIS | GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS;
- break;
-@@ -1583,24 +1688,22 @@ int Port) /* Port Index (MAC_1 + n) */
- GM_OUT16(IoC, Port, GM_GP_CTRL, SWord);
-
- /* dummy read the Interrupt Source Register */
-- SK_IN16(IoC, GMAC_IRQ_SRC, &SWord);
--
-+ SK_IN16(IoC, MR_ADDR(Port, GMAC_IRQ_SRC), &SWord);
-+
- #ifndef VCPU
-- /* read Id from PHY */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_ID1, &pPrt->PhyId1);
--
- SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE);
--#endif /* VCPU */
-+#endif /* !VCPU */
- }
-
- (void)SkGmResetCounter(pAC, IoC, Port);
-
- /* setup Transmit Control Register */
-- GM_OUT16(IoC, Port, GM_TX_CTRL, TX_COL_THR(pPrt->PMacColThres));
-+ GM_OUT16(IoC, Port, GM_TX_CTRL, (SK_U16)TX_COL_THR(pPrt->PMacColThres));
-
- /* setup Receive Control Register */
-- GM_OUT16(IoC, Port, GM_RX_CTRL, GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA |
-- GM_RXCR_CRC_DIS);
-+ SWord = GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA | GM_RXCR_CRC_DIS;
-+
-+ GM_OUT16(IoC, Port, GM_RX_CTRL, SWord);
-
- /* setup Transmit Flow Control Register */
- GM_OUT16(IoC, Port, GM_TX_FLOW_CTRL, 0xffff);
-@@ -1610,31 +1713,29 @@ int Port) /* Port Index (MAC_1 + n) */
- GM_IN16(IoC, Port, GM_TX_PARAM, &SWord);
- #endif /* VCPU */
-
-- SWord = TX_JAM_LEN_VAL(pPrt->PMacJamLen) |
-- TX_JAM_IPG_VAL(pPrt->PMacJamIpgVal) |
-- TX_IPG_JAM_DATA(pPrt->PMacJamIpgData);
--
-+ SWord = (SK_U16)(TX_JAM_LEN_VAL(pPrt->PMacJamLen) |
-+ TX_JAM_IPG_VAL(pPrt->PMacJamIpgVal) |
-+ TX_IPG_JAM_DATA(pPrt->PMacJamIpgData) |
-+ TX_BACK_OFF_LIM(pPrt->PMacBackOffLim));
-+
- GM_OUT16(IoC, Port, GM_TX_PARAM, SWord);
-
- /* configure the Serial Mode Register */
--#ifdef VCPU
-- GM_IN16(IoC, Port, GM_SERIAL_MODE, &SWord);
--#endif /* VCPU */
--
-- SWord = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(pPrt->PMacIpgData);
-+ SWord = (SK_U16)(DATA_BLIND_VAL(pPrt->PMacDataBlind) |
-+ GM_SMOD_VLAN_ENA | IPG_DATA_VAL(pPrt->PMacIpgData));
-
- if (pPrt->PMacLimit4) {
- /* reset of collision counter after 4 consecutive collisions */
- SWord |= GM_SMOD_LIMIT_4;
- }
-
-- if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) {
-+ if (pPrt->PPortUsage == SK_JUMBO_LINK) {
- /* enable jumbo mode (Max. Frame Length = 9018) */
- SWord |= GM_SMOD_JUMBO_ENA;
- }
--
-+
- GM_OUT16(IoC, Port, GM_SERIAL_MODE, SWord);
--
-+
- /*
- * configure the GMACs Station Addresses
- * in PROM you can find our addresses at:
-@@ -1663,17 +1764,17 @@ int Port) /* Port Index (MAC_1 + n) */
- else {
- GM_OUT16(IoC, Port, (GM_SRC_ADDR_1L + i * 4), SWord);
- }
--#else
-+#else
- GM_OUT16(IoC, Port, (GM_SRC_ADDR_1L + i * 4), SWord);
- #endif /* WA_DEV_16 */
--
-+
- /* virtual address: will be used for data */
- SK_IN16(IoC, (B2_MAC_1 + Port * 8 + i * 2), &SWord);
-
- GM_OUT16(IoC, Port, (GM_SRC_ADDR_2L + i * 4), SWord);
--
-+
- /* reset Multicast filtering Hash registers 1-3 */
-- GM_OUT16(IoC, Port, GM_MC_ADDR_H1 + 4*i, 0);
-+ GM_OUT16(IoC, Port, GM_MC_ADDR_H1 + i * 4, 0);
- }
-
- /* reset Multicast filtering Hash register 4 */
-@@ -1684,18 +1785,6 @@ int Port) /* Port Index (MAC_1 + n) */
- GM_OUT16(IoC, Port, GM_RX_IRQ_MSK, 0);
- GM_OUT16(IoC, Port, GM_TR_IRQ_MSK, 0);
-
--#if defined(SK_DIAG) || defined(DEBUG)
-- /* read General Purpose Status */
-- GM_IN16(IoC, Port, GM_GP_STAT, &SWord);
--
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("MAC Stat Reg.=0x%04X\n", SWord));
--#endif /* SK_DIAG || DEBUG */
--
--#ifdef SK_DIAG
-- c_print("MAC Stat Reg=0x%04X\n", SWord);
--#endif /* SK_DIAG */
--
- } /* SkGmInitMac */
- #endif /* YUKON */
-
-@@ -1714,8 +1803,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkXmInitDupMd(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- switch (pAC->GIni.GP[Port].PLinkModeStatus) {
-@@ -1762,8 +1851,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkXmInitPauseMd(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -1773,11 +1862,11 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt = &pAC->GIni.GP[Port];
-
- XM_IN16(IoC, Port, XM_MMU_CMD, &Word);
--
-+
- if (pPrt->PFlowCtrlStatus == SK_FLOW_STAT_NONE ||
- pPrt->PFlowCtrlStatus == SK_FLOW_STAT_LOC_SEND) {
-
-- /* Disable Pause Frame Reception */
-+ /* disable Pause Frame Reception */
- Word |= XM_MMU_IGN_PF;
- }
- else {
-@@ -1785,10 +1874,10 @@ int Port) /* Port Index (MAC_1 + n) */
- * enabling pause frame reception is required for 1000BT
- * because the XMAC is not reset if the link is going down
- */
-- /* Enable Pause Frame Reception */
-+ /* enable Pause Frame Reception */
- Word &= ~XM_MMU_IGN_PF;
-- }
--
-+ }
-+
- XM_OUT16(IoC, Port, XM_MMU_CMD, Word);
-
- XM_IN32(IoC, Port, XM_MODE, &DWord);
-@@ -1811,10 +1900,10 @@ int Port) /* Port Index (MAC_1 + n) */
- /* remember this value is defined in big endian (!) */
- XM_OUT16(IoC, Port, XM_MAC_PTIME, 0xffff);
-
-- /* Set Pause Mode in Mode Register */
-+ /* set Pause Mode in Mode Register */
- DWord |= XM_PAUSE_MODE;
-
-- /* Set Pause Mode in MAC Rx FIFO */
-+ /* set Pause Mode in MAC Rx FIFO */
- SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_ENA_PAUSE);
- }
- else {
-@@ -1822,13 +1911,13 @@ int Port) /* Port Index (MAC_1 + n) */
- * disable pause frame generation is required for 1000BT
- * because the XMAC is not reset if the link is going down
- */
-- /* Disable Pause Mode in Mode Register */
-+ /* disable Pause Mode in Mode Register */
- DWord &= ~XM_PAUSE_MODE;
-
-- /* Disable Pause Mode in MAC Rx FIFO */
-+ /* disable Pause Mode in MAC Rx FIFO */
- SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_DIS_PAUSE);
- }
--
-+
- XM_OUT32(IoC, Port, XM_MODE, DWord);
- } /* SkXmInitPauseMd*/
-
-@@ -1845,8 +1934,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- static void SkXmInitPhyXmac(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
-@@ -1855,12 +1944,12 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
-
- pPrt = &pAC->GIni.GP[Port];
- Ctrl = 0;
--
-+
- /* Auto-negotiation ? */
- if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyXmac: no auto-negotiation Port %d\n", Port));
-- /* Set DuplexMode in Config register */
-+ /* set DuplexMode in Config register */
- if (pPrt->PLinkMode == SK_LMODE_FULL) {
- Ctrl |= PHY_CT_DUP_MD;
- }
-@@ -1873,9 +1962,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- else {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyXmac: with auto-negotiation Port %d\n", Port));
-- /* Set Auto-negotiation advertisement */
-+ /* set Auto-negotiation advertisement */
-
-- /* Set Full/half duplex capabilities */
-+ /* set Full/half duplex capabilities */
- switch (pPrt->PLinkMode) {
- case SK_LMODE_AUTOHALF:
- Ctrl |= PHY_X_AN_HD;
-@@ -1891,7 +1980,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SKERR_HWI_E015MSG);
- }
-
-- /* Set Flow-control capabilities */
-+ /* set Flow-control capabilities */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- Ctrl |= PHY_X_P_NO_PAUSE;
-@@ -1918,7 +2007,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- }
-
- if (DoLoop) {
-- /* Set the Phy Loopback bit, too */
-+ /* set the Phy Loopback bit, too */
- Ctrl |= PHY_CT_LOOP;
- }
-
-@@ -1939,8 +2028,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * nothing
- */
- static void SkXmInitPhyBcom(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
-@@ -1962,7 +2051,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- /* manually Master/Slave ? */
- if (pPrt->PMSMode != SK_MS_MODE_AUTO) {
- Ctrl2 |= PHY_B_1000C_MSE;
--
-+
- if (pPrt->PMSMode == SK_MS_MODE_MASTER) {
- Ctrl2 |= PHY_B_1000C_MSC;
- }
-@@ -1971,7 +2060,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyBcom: no auto-negotiation Port %d\n", Port));
-- /* Set DuplexMode in Config register */
-+ /* set DuplexMode in Config register */
- if (pPrt->PLinkMode == SK_LMODE_FULL) {
- Ctrl1 |= PHY_CT_DUP_MD;
- }
-@@ -1989,7 +2078,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- else {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyBcom: with auto-negotiation Port %d\n", Port));
-- /* Set Auto-negotiation advertisement */
-+ /* set Auto-negotiation advertisement */
-
- /*
- * Workaround BCOM Errata #1 for the C5 type.
-@@ -1997,8 +2086,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * Set Repeater/DTE bit 10 of the 1000Base-T Control Register
- */
- Ctrl2 |= PHY_B_1000C_RD;
--
-- /* Set Full/half duplex capabilities */
-+
-+ /* set Full/half duplex capabilities */
- switch (pPrt->PLinkMode) {
- case SK_LMODE_AUTOHALF:
- Ctrl2 |= PHY_B_1000C_AHD;
-@@ -2014,7 +2103,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SKERR_HWI_E015MSG);
- }
-
-- /* Set Flow-control capabilities */
-+ /* set Flow-control capabilities */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- Ctrl3 |= PHY_B_P_NO_PAUSE;
-@@ -2036,27 +2125,27 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- /* Restart Auto-negotiation */
- Ctrl1 |= PHY_CT_ANE | PHY_CT_RE_CFG;
- }
--
-+
- /* Initialize LED register here? */
- /* No. Please do it in SkDgXmitLed() (if required) and swap
-- init order of LEDs and XMAC. (MAl) */
--
-+ init order of LEDs and XMAC. (MAl) */
-+
- /* Write 1000Base-T Control Register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_1000T_CTRL, Ctrl2);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set 1000B-T Ctrl Reg=0x%04X\n", Ctrl2));
--
-+ ("Set 1000B-T Ctrl Reg = 0x%04X\n", Ctrl2));
-+
- /* Write AutoNeg Advertisement Register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUNE_ADV, Ctrl3);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set Auto-Neg.Adv.Reg=0x%04X\n", Ctrl3));
--
-+ ("Set Auto-Neg.Adv.Reg = 0x%04X\n", Ctrl3));
-+
- if (DoLoop) {
-- /* Set the Phy Loopback bit, too */
-+ /* set the Phy Loopback bit, too */
- Ctrl1 |= PHY_CT_LOOP;
- }
-
-- if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) {
-+ if (pPrt->PPortUsage == SK_JUMBO_LINK) {
- /* configure FIFO to high latency for transmission of ext. packets */
- Ctrl4 |= PHY_B_PEC_HIGH_LA;
-
-@@ -2068,45 +2157,41 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
-
- /* Configure LED Traffic Mode and Jumbo Frame usage if specified */
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_P_EXT_CTRL, Ctrl4);
--
-+
- /* Write to the Phy control register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_CTRL, Ctrl1);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Control Reg=0x%04X\n", Ctrl1));
-+ ("PHY Control Reg = 0x%04X\n", Ctrl1));
- } /* SkXmInitPhyBcom */
- #endif /* GENESIS */
-
-
- #ifdef YUKON
--#ifndef SK_SLIM
-+#ifdef SK_PHY_LP_MODE
- /******************************************************************************
- *
- * SkGmEnterLowPowerMode()
- *
-- * Description:
-+ * Description:
- * This function sets the Marvell Alaska PHY to the low power mode
- * given by parameter mode.
- * The following low power modes are available:
-- *
-- * - Coma Mode (Deep Sleep):
-- * Power consumption: ~15 - 30 mW
-+ *
-+ * - COMA Mode (Deep Sleep):
- * The PHY cannot wake up on its own.
- *
- * - IEEE 22.2.4.1.5 compatible power down mode
-- * Power consumption: ~240 mW
- * The PHY cannot wake up on its own.
- *
- * - energy detect mode
-- * Power consumption: ~160 mW
- * The PHY can wake up on its own by detecting activity
- * on the CAT 5 cable.
- *
- * - energy detect plus mode
-- * Power consumption: ~150 mW
- * The PHY can wake up on its own by detecting activity
- * on the CAT 5 cable.
- * Connected devices can be woken up by sending normal link
-- * pulses every one second.
-+ * pulses every second.
- *
- * Note:
- *
-@@ -2115,113 +2200,298 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * 1: error
- */
- int SkGmEnterLowPowerMode(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (e.g. MAC_1) */
- SK_U8 Mode) /* low power mode */
- {
-+ SK_U8 LastMode;
-+ SK_U8 Byte;
- SK_U16 Word;
-+ SK_U16 ClkDiv;
- SK_U32 DWord;
-- SK_U8 LastMode;
-+ SK_U32 PowerDownBit;
-+ int ChipId;
- int Ret = 0;
-
-- if (pAC->GIni.GIYukonLite &&
-- pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
-+ if (!(CHIP_ID_YUKON_2(pAC) || (pAC->GIni.GIYukonLite &&
-+ pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3))) {
-
-- /* save current power mode */
-- LastMode = pAC->GIni.GP[Port].PPhyPowerState;
-- pAC->GIni.GP[Port].PPhyPowerState = Mode;
--
-- switch (Mode) {
-- /* coma mode (deep sleep) */
-- case PHY_PM_DEEP_SLEEP:
-- /* setup General Purpose Control Register */
-- GM_OUT16(IoC, 0, GM_GP_CTRL, GM_GPCR_FL_PASS |
-- GM_GPCR_SPEED_100 | GM_GPCR_AU_ALL_DIS);
--
-- /* apply COMA mode workaround */
-- SkGmPhyWrite(pAC, IoC, Port, 29, 0x001f);
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xfff3);
--
-- SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord);
--
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
--
-- /* Set PHY to Coma Mode */
-- SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord | PCI_PHY_COMA);
--
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
--
-- break;
--
-- /* IEEE 22.2.4.1.5 compatible power down mode */
-- case PHY_PM_IEEE_POWER_DOWN:
-- /*
-- * - disable MAC 125 MHz clock
-- * - allow MAC power down
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-- Word |= PHY_M_PC_DIS_125CLK;
-- Word &= ~PHY_M_PC_MAC_POW_UP;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+ return(1);
-+ }
-
-- /*
-- * register changes must be followed by a software
-- * reset to take effect
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-- Word |= PHY_CT_RESET;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
--
-- /* switch IEEE compatible power down mode on */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-- Word |= PHY_CT_PDOWN;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-- break;
-+ /* save current power mode */
-+ LastMode = pAC->GIni.GP[Port].PPhyPowerState;
-+ pAC->GIni.GP[Port].PPhyPowerState = Mode;
-
-- /* energy detect and energy detect plus mode */
-- case PHY_PM_ENERGY_DETECT:
-- case PHY_PM_ENERGY_DETECT_PLUS:
-- /*
-- * - disable MAC 125 MHz clock
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-- Word |= PHY_M_PC_DIS_125CLK;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
--
-- /* activate energy detect mode 1 */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
--
-- /* energy detect mode */
-- if (Mode == PHY_PM_ENERGY_DETECT) {
-- Word |= PHY_M_PC_EN_DET;
-+ ChipId = pAC->GIni.GIChipId;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_POWM, SK_DBGCAT_CTRL,
-+ ("SkGmEnterLowPowerMode: %u\n", Mode));
-+
-+ /* release GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_CLR);
-+
-+ /* release GMAC reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), (SK_U8)GMC_RST_CLR);
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* select page 2 to access MAC control register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 2);
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+ /* allow GMII Power Down */
-+ Word &= ~PHY_M_MAC_GMIF_PUP;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 0);
-+ }
-+
-+ switch (Mode) {
-+ /* COMA mode (deep sleep) */
-+ case PHY_PM_DEEP_SLEEP:
-+ /* setup General Purpose Control Register */
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, GM_GPCR_FL_PASS |
-+ GM_GPCR_SPEED_100 | GM_GPCR_AU_ALL_DIS);
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* set power down bit */
-+ PowerDownBit = (Port == MAC_1) ? PCI_Y2_PHY1_POWD :
-+ PCI_Y2_PHY2_POWD;
-+
-+ if (ChipId != CHIP_ID_YUKON_EC) {
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+ /* enable Power Down */
-+ Word |= PHY_M_PC_POW_D_ENA;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+ }
-+
-+ /* set IEEE compatible Power Down Mode (dev. #4.99) */
-+ Ret = SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PHY_CT_PDOWN);
-+ }
-+ }
-+ else {
-+ /* apply COMA mode workaround */
-+ (void)SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_ADDR, 0x001f);
-+
-+ Ret = SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xfff3);
-+
-+ PowerDownBit = PCI_PHY_COMA;
-+ }
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_1), &DWord);
-+
-+ /* set PHY to PowerDown/COMA Mode */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_1), DWord | PowerDownBit);
-+
-+ /* check if this routine was called from a for() loop */
-+ if (pAC->GIni.GIMacsFound == 1 || Port == MAC_2) {
-+
-+ /* ASF system clock stopped */
-+ SK_OUT8(IoC, B28_Y2_ASF_STAT_CMD, (SK_U8)Y2_ASF_CLK_HALT);
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* set GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_SET);
-+
-+ /* additional power saving measurements */
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_4), &DWord);
-+
-+ /* set gating core clock for LTSSM in L1 state */
-+ DWord |= (P_PEX_LTSSM_STAT(P_PEX_LTSSM_L1_STAT) |
-+ /* auto clock gated scheme controlled by CLKREQ */
-+ P_ASPM_A1_MODE_SELECT |
-+ /* enable Gate Root Core Clock */
-+ P_CLK_GATE_ROOT_COR_ENA);
-+
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_4200)) {
-+ /* Enable Clock Power Management (CLKREQ) */
-+ SK_IN16(IoC, PCI_C(pAC, PEX_LNK_CTRL), &Word);
-+ Word |= PEX_LC_CLK_PM_ENA;
-+ SK_OUT16(IoC, PCI_C(pAC, PEX_LNK_CTRL), Word);
- }
-- /* energy detect plus mode */
- else {
-- Word |= PHY_M_PC_EN_DET_PLUS;
-+ /* Force CLKREQ Enable in Our4 (A1b only) */
-+ DWord |= P_ASPM_FORCE_CLKREQ_ENA;
- }
-
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_4), DWord);
-
-- /*
-- * reinitialize the PHY to force a software reset
-- * which is necessary after the register settings
-- * for the energy detect modes.
-- * Furthermore reinitialisation prevents that the
-- * PHY is running out of a stable state.
-- */
-- SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE);
-- break;
-+ /* set Mask Register for Release/Gate Clock */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_5),
-+ P_REL_PCIE_EXIT_L1_ST | P_GAT_PCIE_ENTER_L1_ST |
-+ P_REL_PCIE_RX_EX_IDLE | P_GAT_PCIE_RX_EL_IDLE |
-+ P_REL_GPHY_LINK_UP | P_GAT_GPHY_LINK_DOWN);
-+ }
-
-- /* don't change current power mode */
-- default:
-- pAC->GIni.GP[Port].PPhyPowerState = LastMode;
-- Ret = 1;
-- break;
-+ if (HW_FEATURE(pAC, HWF_RED_CORE_CLK_SUP)) {
-+ /* divide clock by 4 only for Yukon-EC */
-+ ClkDiv = (ChipId == CHIP_ID_YUKON_EC) ? 1 : 0;
-+
-+ /* on Yukon-2 clock select value is 31 */
-+ DWord = (ChipId == CHIP_ID_YUKON_XL) ?
-+ (Y2_CLK_DIV_VAL_2(0) | Y2_CLK_SEL_VAL_2(31)) :
-+ Y2_CLK_DIV_VAL(ClkDiv);
-+
-+ /* check for Yukon-2 dual port PCI-Express adapter */
-+ if (!(pAC->GIni.GIMacsFound == 2 &&
-+ pAC->GIni.GIPciBus == SK_PEX_BUS)) {
-+ /* enable Core Clock Division */
-+ DWord |= Y2_CLK_DIV_ENA;
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Set Core Clock: 0x%08X\n", DWord));
-+
-+ /* reduce Core Clock Frequency */
-+ SK_OUT32(IoC, B2_Y2_CLK_CTRL, DWord);
-+ }
-+
-+ if (HW_FEATURE(pAC, HWF_CLK_GATING_ENABLE)) {
-+ /* check for Yukon-2 Rev. A2 */
-+ if (ChipId == CHIP_ID_YUKON_XL &&
-+ pAC->GIni.GIChipRev > CHIP_REV_YU_XL_A1) {
-+ /* enable bits are inverted */
-+ Byte = 0;
-+ }
-+ else {
-+ Byte = (SK_U8)(Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
-+ Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
-+ Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Set Clock Gating: 0x%02X\n", Byte));
-+
-+ /* disable MAC/PHY, PCI and Core Clock for both Links */
-+ SK_OUT8(IoC, B2_Y2_CLK_GATE, Byte);
-+ }
-+
-+ if (pAC->GIni.GIVauxAvail) {
-+ /* switch power to VAUX */
-+ SK_OUT8(IoC, B0_POWER_CTRL, (SK_U8)(PC_VAUX_ENA | PC_VCC_ENA |
-+ PC_VAUX_ON | PC_VCC_OFF));
-+ }
-+#ifdef DEBUG
-+ SK_IN32(IoC, B0_CTST, &DWord);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Ctrl/Stat & Switch: 0x%08x\n", DWord));
-+#endif /* DEBUG */
-+
-+ if (pAC->GIni.GILevel != SK_INIT_IO &&
-+ pAC->GIni.GIMacsFound == 1 &&
-+ pAC->GIni.GIPciBus == SK_PEX_BUS) {
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+
-+#ifdef PCI_E_L1_STATE
-+ SK_IN16(IoC, PCI_C(pAC, PCI_OUR_REG_1), &Word);
-+ /* force to PCIe L1 */
-+ Word |= (SK_U16)PCI_FORCE_PEX_L1;
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_OUR_REG_1), Word);
-+#endif /* PCI_E_L1_STATE */
-+ }
-+ else {
-+ /* switch to D1 state */
-+ SK_OUT8(IoC, PCI_C(pAC, PCI_PM_CTL_STS), PCI_PM_STATE_D1);
-+ }
-+ }
- }
-- }
-- /* low power modes are not supported by this chip */
-- else {
-+
-+ break;
-+
-+ /* IEEE 22.2.4.1.5 compatible power down mode */
-+ case PHY_PM_IEEE_POWER_DOWN:
-+
-+ Ret = SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+
-+ Word |= PHY_M_PC_POL_R_DIS;
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* disable MAC 125 MHz clock */
-+ Word |= PHY_M_PC_DIS_125CLK;
-+ Word &= ~PHY_M_PC_MAC_POW_UP;
-+ }
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+
-+ /* these register changes must be followed by a software reset */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word | PHY_CT_RESET);
-+
-+ /* switch IEEE compatible power down mode on */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word | PHY_CT_PDOWN);
-+
-+ break;
-+
-+ /* energy detect and energy detect plus mode */
-+ case PHY_PM_ENERGY_DETECT:
-+ case PHY_PM_ENERGY_DETECT_PLUS:
-+
-+ Ret = SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+
-+ Word |= PHY_M_PC_POL_R_DIS;
-+
-+ if (!CHIP_ID_YUKON_2(pAC)) {
-+ /* disable MAC 125 MHz clock */
-+ Word |= PHY_M_PC_DIS_125CLK;
-+ }
-+
-+ if (ChipId == CHIP_ID_YUKON_FE) {
-+ /* enable Energy Detect (sense & pulse) */
-+ Word |= PHY_M_PC_ENA_ENE_DT;
-+ }
-+ else {
-+ /* clear energy detect mode bits */
-+ Word &= ~PHY_M_PC_EN_DET_MSK;
-+
-+ Word |= (Mode == PHY_PM_ENERGY_DETECT) ? PHY_M_PC_EN_DET :
-+ PHY_M_PC_EN_DET_PLUS;
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+
-+ /* these register changes must be followed by a software reset */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-+ Word |= PHY_CT_RESET;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* additional power saving measurements */
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_4), &DWord);
-+
-+ /* set gating core clock for LTSSM in L1 state */
-+ DWord |= (P_PEX_LTSSM_STAT(P_PEX_LTSSM_L1_STAT) |
-+ /* Enable Gate Root Core Clock */
-+ P_CLK_GATE_ROOT_COR_ENA);
-+
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_4), DWord);
-+
-+ /* set Mask Register for Release/Gate Clock */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_5),
-+ P_REL_PCIE_EXIT_L1_ST | P_GAT_PCIE_ENTER_L1_ST |
-+ P_REL_PCIE_RX_EX_IDLE | P_GAT_PCIE_RX_EL_IDLE |
-+ P_REL_GPHY_LINK_UP | P_GAT_GPHY_LINK_DOWN);
-+
-+#ifdef PCI_E_L1_STATE
-+ SK_IN16(IoC, PCI_C(pAC, PCI_OUR_REG_1), &Word);
-+ /* enable PCIe L1 on GPHY link down */
-+ Word |= (SK_U16)PCI_ENA_GPHY_LNK;
-+ SK_OUT16(IoC, PCI_C(pAC, PCI_OUR_REG_1), Word);
-+#endif /* PCI_E_L1_STATE */
-+ }
-+
-+ break;
-+
-+ /* don't change current power mode */
-+ default:
-+ pAC->GIni.GP[Port].PPhyPowerState = LastMode;
- Ret = 1;
- }
-
-@@ -2233,7 +2503,7 @@ SK_U8 Mode) /* low power mode */
- *
- * SkGmLeaveLowPowerMode()
- *
-- * Description:
-+ * Description:
- * Leave the current low power mode and switch to normal mode
- *
- * Note:
-@@ -2243,115 +2513,169 @@ SK_U8 Mode) /* low power mode */
- * 1: error
- */
- int SkGmLeaveLowPowerMode(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (e.g. MAC_1) */
- {
- SK_U32 DWord;
-+ SK_U32 PowerDownBit;
- SK_U16 Word;
- SK_U8 LastMode;
-+ int ChipId;
- int Ret = 0;
-
-- if (pAC->GIni.GIYukonLite &&
-- pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
-+ if (!(CHIP_ID_YUKON_2(pAC) || (pAC->GIni.GIYukonLite &&
-+ pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3))) {
-
-- /* save current power mode */
-- LastMode = pAC->GIni.GP[Port].PPhyPowerState;
-- pAC->GIni.GP[Port].PPhyPowerState = PHY_PM_OPERATIONAL_MODE;
--
-- switch (LastMode) {
-- /* coma mode (deep sleep) */
-- case PHY_PM_DEEP_SLEEP:
-- SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord);
--
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
--
-- /* Release PHY from Coma Mode */
-- SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord & ~PCI_PHY_COMA);
--
-- SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
--
-- SK_IN32(IoC, B2_GP_IO, &DWord);
--
-- /* set to output */
-- DWord |= (GP_DIR_9 | GP_IO_9);
--
-- /* set PHY reset */
-- SK_OUT32(IoC, B2_GP_IO, DWord);
--
-- DWord &= ~GP_IO_9; /* clear PHY reset (active high) */
--
-- /* clear PHY reset */
-- SK_OUT32(IoC, B2_GP_IO, DWord);
-- break;
--
-- /* IEEE 22.2.4.1.5 compatible power down mode */
-- case PHY_PM_IEEE_POWER_DOWN:
-- /*
-- * - enable MAC 125 MHz clock
-- * - set MAC power up
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-- Word &= ~PHY_M_PC_DIS_125CLK;
-- Word |= PHY_M_PC_MAC_POW_UP;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+ return(1);
-+ }
-
-- /*
-- * register changes must be followed by a software
-- * reset to take effect
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-- Word |= PHY_CT_RESET;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
--
-- /* switch IEEE compatible power down mode off */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-- Word &= ~PHY_CT_PDOWN;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-- break;
-+ /* save current power mode */
-+ LastMode = pAC->GIni.GP[Port].PPhyPowerState;
-+ pAC->GIni.GP[Port].PPhyPowerState = PHY_PM_OPERATIONAL_MODE;
-
-- /* energy detect and energy detect plus mode */
-- case PHY_PM_ENERGY_DETECT:
-- case PHY_PM_ENERGY_DETECT_PLUS:
-- /*
-- * - enable MAC 125 MHz clock
-- */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-- Word &= ~PHY_M_PC_DIS_125CLK;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
--
-- /* disable energy detect mode */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-- Word &= ~PHY_M_PC_EN_DET_MSK;
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+ ChipId = pAC->GIni.GIChipId;
-
-- /*
-- * reinitialize the PHY to force a software reset
-- * which is necessary after the register settings
-- * for the energy detect modes.
-- * Furthermore reinitialisation prevents that the
-- * PHY is running out of a stable state.
-- */
-- SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE);
-- break;
-+ SK_DBG_MSG(pAC, SK_DBGMOD_POWM, SK_DBGCAT_CTRL,
-+ ("SkGmLeaveLowPowerMode: %u\n", LastMode));
-
-- /* don't change current power mode */
-- default:
-- pAC->GIni.GP[Port].PPhyPowerState = LastMode;
-- Ret = 1;
-- break;
-+ switch (LastMode) {
-+ /* COMA mode (deep sleep) */
-+ case PHY_PM_DEEP_SLEEP:
-+
-+ if (ChipId == CHIP_ID_YUKON_EC_U) {
-+#ifdef PCI_E_L1_STATE
-+ /* set to default value (leave PCIe L1) */
-+ SkPciWriteCfgWord(pAC, PCI_OUR_REG_1, 0);
-+#endif /* PCI_E_L1_STATE */
-+
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_4), &DWord);
-+
-+ DWord &= P_ASPM_CONTROL_MSK;
-+ /* set all bits to 0 except bits 15..12 */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_4), DWord);
-+
-+ /* set to default value */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_5), 0);
- }
-- }
-- /* low power modes are not supported by this chip */
-- else {
-+ else {
-+ SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &Word);
-+
-+ /* reset all DState bits */
-+ Word &= ~(PCI_PM_STATE_MSK);
-+
-+ /* switch to D0 state */
-+ SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, Word);
-+ }
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* disable Core Clock Division */
-+ SK_OUT32(IoC, B2_Y2_CLK_CTRL, Y2_CLK_DIV_DIS);
-+
-+ /* set power down bit */
-+ PowerDownBit = (Port == MAC_1) ? PCI_Y2_PHY1_POWD :
-+ PCI_Y2_PHY2_POWD;
-+ }
-+ else {
-+ PowerDownBit = PCI_PHY_COMA;
-+ }
-+
-+ SK_IN32(IoC, PCI_C(pAC, PCI_OUR_REG_1), &DWord);
-+
-+ /* Release PHY from PowerDown/COMA Mode */
-+ SK_OUT32(IoC, PCI_C(pAC, PCI_OUR_REG_1), DWord & ~PowerDownBit);
-+
-+ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-+
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+
-+ if (ChipId == CHIP_ID_YUKON_FE) {
-+ /* release IEEE compatible Power Down Mode */
-+ Ret = SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PHY_CT_ANE);
-+ }
-+ else if (ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* release GPHY Control reset */
-+ SK_OUT8(IoC, MR_ADDR(Port, GPHY_CTRL), (SK_U8)GPC_RST_CLR);
-+ }
-+ }
-+ else {
-+ SK_IN32(IoC, B2_GP_IO, &DWord);
-+
-+ /* set to output */
-+ DWord |= (GP_DIR_9 | GP_IO_9);
-+
-+ /* set PHY reset */
-+ SK_OUT32(IoC, B2_GP_IO, DWord);
-+
-+ DWord &= ~GP_IO_9; /* clear PHY reset (active high) */
-+
-+ /* clear PHY reset */
-+ SK_OUT32(IoC, B2_GP_IO, DWord);
-+ }
-+
-+ break;
-+
-+ /* IEEE 22.2.4.1.5 compatible power down mode */
-+ case PHY_PM_IEEE_POWER_DOWN:
-+
-+ if (ChipId != CHIP_ID_YUKON_XL) {
-+
-+ Ret = SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+ Word &= ~PHY_M_PC_DIS_125CLK; /* enable MAC 125 MHz clock */
-+ Word |= PHY_M_PC_MAC_POW_UP; /* set MAC power up */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+
-+ /* these register changes must be followed by a software reset */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-+ Word |= PHY_CT_RESET;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-+ }
-+
-+ /* switch IEEE compatible power down mode off */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-+ Word &= ~PHY_CT_PDOWN;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-+
-+ break;
-+
-+ /* energy detect and energy detect plus mode */
-+ case PHY_PM_ENERGY_DETECT:
-+ case PHY_PM_ENERGY_DETECT_PLUS:
-+
-+ if (ChipId != CHIP_ID_YUKON_XL) {
-+
-+ Ret = SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
-+
-+ if (ChipId == CHIP_ID_YUKON_FE) {
-+ /* disable Energy Detect */
-+ Word &= ~PHY_M_PC_ENA_ENE_DT;
-+ }
-+ else {
-+ /* disable energy detect mode & enable MAC 125 MHz clock */
-+ Word &= ~(PHY_M_PC_EN_DET_MSK | PHY_M_PC_DIS_125CLK);
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
-+
-+ /* these register changes must be followed by a software reset */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
-+ Word |= PHY_CT_RESET;
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
-+ }
-+ break;
-+
-+ /* don't change current power mode */
-+ default:
-+ pAC->GIni.GP[Port].PPhyPowerState = LastMode;
- Ret = 1;
- }
-
- return(Ret);
-
- } /* SkGmLeaveLowPowerMode */
--#endif /* !SK_SLIM */
--
-+#endif /* SK_PHY_LP_MODE */
-
- /******************************************************************************
- *
-@@ -2365,107 +2689,242 @@ int Port) /* Port Index (e.g. MAC_1) *
- * nothing
- */
- static void SkGmInitPhyMarv(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
- SK_GEPORT *pPrt;
-+ SK_BOOL AutoNeg;
- SK_U16 PhyCtrl;
- SK_U16 C1000BaseT;
- SK_U16 AutoNegAdv;
-+ SK_U8 PauseMode;
-+ int ChipId;
-+#ifndef VCPU
-+ SK_U16 SWord;
-+ SK_U16 PageReg;
-+#ifndef SK_SLIM
-+ SK_U16 LoopSpeed;
-+#endif /* !SK_SLIM */
- SK_U16 ExtPhyCtrl;
- SK_U16 LedCtrl;
-- SK_BOOL AutoNeg;
-+ SK_U16 LedOver;
-+#ifndef SK_DIAG
-+ SK_EVPARA Para;
-+#endif /* !SK_DIAG */
- #if defined(SK_DIAG) || defined(DEBUG)
- SK_U16 PhyStat;
- SK_U16 PhyStat1;
- SK_U16 PhySpecStat;
- #endif /* SK_DIAG || DEBUG */
-+#endif /* !VCPU */
-+
-+ /* set Pause On */
-+ PauseMode = (SK_U8)GMC_PAUSE_ON;
-
- pPrt = &pAC->GIni.GP[Port];
-
-+ ChipId = pAC->GIni.GIChipId;
-+
- /* Auto-negotiation ? */
-- if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
-- AutoNeg = SK_FALSE;
-+ AutoNeg = pPrt->PLinkMode != SK_LMODE_HALF &&
-+ pPrt->PLinkMode != SK_LMODE_FULL;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("InitPhyMarv: Port %d, Auto-neg. %s, LMode %d, LSpeed %d, FlowC %d\n",
-+ Port, AutoNeg ? "ON" : "OFF",
-+ pPrt->PLinkMode, pPrt->PLinkSpeed, pPrt->PFlowCtrlMode));
-+
-+#ifndef VCPU
-+ /* read Id from PHY */
-+ if (SkGmPhyRead(pAC, IoC, Port, PHY_MARV_ID1, &pPrt->PhyId1) != 0) {
-+
-+#ifndef SK_DIAG
-+ Para.Para64 = Port;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para);
-+#endif /* !SK_DIAG */
-+
-+ return;
- }
-- else {
-- AutoNeg = SK_TRUE;
-+
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+
-+#ifndef SK_SLIM
-+ if (DoLoop) {
-+ /* special setup for PHY 88E1112 */
-+ if (ChipId == CHIP_ID_YUKON_XL) {
-+
-+ LoopSpeed = pPrt->PLinkSpeed;
-+
-+ if (LoopSpeed == SK_LSPEED_AUTO) {
-+ /* force 1000 Mbps */
-+ LoopSpeed = SK_LSPEED_1000MBPS;
-+ }
-+ LoopSpeed += 2;
-+
-+ /* save page register */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_ADR, &PageReg);
-+
-+ /* select page 2 to access MAC control register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 2);
-+
-+ /* set MAC interface speed */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, LoopSpeed << 4);
-+
-+ /* restore page register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, PageReg);
-+
-+ /* disable link pulses */
-+ SWord = PHY_M_PC_DIS_LINK_P;
-+ }
-+ else {
-+ /* set 'MAC Power up'-bit, set Manual MDI configuration */
-+ SWord = PHY_M_PC_MAC_POW_UP;
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, SWord);
-+ }
-+ else
-+#endif /* !SK_SLIM */
-+ if (AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_AUTO &&
-+ !(ChipId == CHIP_ID_YUKON_XL || ChipId == CHIP_ID_YUKON_EC_U)) {
-+ /* Read Ext. PHY Specific Control */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl);
-+
-+ ExtPhyCtrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
-+ PHY_M_EC_MAC_S_MSK);
-+
-+ ExtPhyCtrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ);
-+
-+ /* on PHY 88E1040 Rev.D0 (and newer) downshift control changed */
-+ if (pAC->GIni.GIYukonLite || ChipId == CHIP_ID_YUKON_EC) {
-+ /* set downshift counter to 3x and enable downshift */
-+ ExtPhyCtrl |= PHY_M_EC_DSC_2(2) | PHY_M_EC_DOWN_S_ENA;
-+ }
-+ else {
-+ /* set master & slave downshift counter to 1x */
-+ ExtPhyCtrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1);
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL, ExtPhyCtrl);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Set Ext. PHY Ctrl = 0x%04X\n", ExtPhyCtrl));
-+ }
- }
--
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("InitPhyMarv: Port %d, auto-negotiation %s\n",
-- Port, AutoNeg ? "ON" : "OFF"));
-
--#ifdef VCPU
-- VCPUprintf(0, "SkGmInitPhyMarv(), Port=%u, DoLoop=%u\n",
-- Port, DoLoop);
--#else /* VCPU */
-- if (DoLoop) {
-- /* Set 'MAC Power up'-bit, set Manual MDI configuration */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL,
-- PHY_M_PC_MAC_POW_UP);
-+ if (CHIP_ID_YUKON_2(pAC)) {
-+ /* Read PHY Specific Control */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &PhyCtrl);
-+
-+ if (!DoLoop && pAC->GIni.GICopperType) {
-+
-+ if (ChipId == CHIP_ID_YUKON_FE) {
-+ /* enable Automatic Crossover (!!! Bits 5..4) */
-+ PhyCtrl |= (SK_U16)(PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1);
-+ }
-+ else {
-+ /* disable Energy Detect Mode */
-+ PhyCtrl &= ~PHY_M_PC_EN_DET_MSK;
-+
-+ /* enable Automatic Crossover */
-+ PhyCtrl |= (SK_U16)PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);
-+
-+ /* downshift on PHY 88E1112 and 88E1149 is changed */
-+ if (AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_AUTO &&
-+ (ChipId == CHIP_ID_YUKON_XL ||
-+ ChipId == CHIP_ID_YUKON_EC_U)) {
-+ /* set downshift counter to 3x and enable downshift */
-+ PhyCtrl &= ~PHY_M_PC_DSC_MSK;
-+ PhyCtrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
-+ }
-+ }
-+ }
-+ /* workaround for deviation #4.88 (CRC errors) */
-+ else {
-+ /* disable Automatic Crossover */
-+ PhyCtrl &= ~PHY_M_PC_MDIX_MSK;
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, PhyCtrl);
- }
-- else if (AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_AUTO) {
-- /* Read Ext. PHY Specific Control */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl);
--
-- ExtPhyCtrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
-- PHY_M_EC_MAC_S_MSK);
--
-- ExtPhyCtrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ) |
-- PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1);
--
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL, ExtPhyCtrl);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set Ext. PHY Ctrl=0x%04X\n", ExtPhyCtrl));
-+
-+ /* special setup for PHY 88E1112 Fiber */
-+ if (ChipId == CHIP_ID_YUKON_XL && !pAC->GIni.GICopperType) {
-+ /* select 1000BASE-X only mode in MAC Specific Ctrl Reg. */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 2);
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &SWord);
-+
-+ SWord &= ~PHY_M_MAC_MD_MSK;
-+ SWord |= PHY_M_MAC_MODE_SEL(PHY_M_MAC_MD_1000BX);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, SWord);
-+
-+ /* select page 1 to access Fiber registers */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 1);
-+
-+ if (pAC->GIni.GIPmdTyp == 'P') {
-+ /* for SFP-module set SIGDET polarity to low */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &SWord);
-+
-+ SWord |= PHY_M_FIB_SIGD_POL;
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, SWord);
-+ }
- }
-
- /* Read PHY Control */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &PhyCtrl);
-
-+#ifndef SK_SLIM
- if (!AutoNeg) {
-- /* Disable Auto-negotiation */
-+ /* disable Auto-negotiation */
- PhyCtrl &= ~PHY_CT_ANE;
- }
-+#endif /* !SK_SLIM */
-
- PhyCtrl |= PHY_CT_RESET;
-- /* Assert software reset */
-+ /* assert software reset */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl);
--#endif /* VCPU */
-+#endif /* !VCPU */
-
- PhyCtrl = 0 /* PHY_CT_COL_TST */;
- C1000BaseT = 0;
- AutoNegAdv = PHY_SEL_TYPE;
-
-+#ifndef SK_SLIM
- /* manually Master/Slave ? */
- if (pPrt->PMSMode != SK_MS_MODE_AUTO) {
- /* enable Manual Master/Slave */
- C1000BaseT |= PHY_M_1000C_MSE;
--
-+
- if (pPrt->PMSMode == SK_MS_MODE_MASTER) {
- C1000BaseT |= PHY_M_1000C_MSC; /* set it to Master */
- }
- }
--
-+#endif /* !SK_SLIM */
-+
- /* Auto-negotiation ? */
- if (!AutoNeg) {
--
-+
-+#ifndef SK_SLIM
- if (pPrt->PLinkMode == SK_LMODE_FULL) {
-- /* Set Full Duplex Mode */
-+ /* set Full Duplex Mode */
- PhyCtrl |= PHY_CT_DUP_MD;
- }
-
-- /* Set Master/Slave manually if not already done */
-+ /* set Master/Slave manually if not already done */
- if (pPrt->PMSMode == SK_MS_MODE_AUTO) {
- C1000BaseT |= PHY_M_1000C_MSE; /* set it to Slave */
- }
-
-- /* Set Speed */
-+ /* set Speed */
- switch (pPrt->PLinkSpeed) {
- case SK_LSPEED_AUTO:
- case SK_LSPEED_1000MBPS:
-- PhyCtrl |= PHY_CT_SP1000;
-+ PhyCtrl |= (((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) ?
-+ PHY_CT_SP1000 : PHY_CT_SP100);
- break;
- case SK_LSPEED_100MBPS:
- PhyCtrl |= PHY_CT_SP100;
-@@ -2477,38 +2936,67 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SKERR_HWI_E019MSG);
- }
-
-+ if ((pPrt->PFlowCtrlMode == SK_FLOW_STAT_NONE) ||
-+ /* disable Pause also for 10/100 Mbps in half duplex mode */
-+ ((ChipId != CHIP_ID_YUKON_EC_U) &&
-+ (pPrt->PLinkMode == SK_LMODE_HALF) &&
-+ ((pPrt->PLinkSpeed == SK_LSPEED_STAT_100MBPS) ||
-+ (pPrt->PLinkSpeed == SK_LSPEED_STAT_10MBPS)))) {
-+
-+ /* set Pause Off */
-+ PauseMode = (SK_U8)GMC_PAUSE_OFF;
-+ }
-+
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), PauseMode);
-+
- if (!DoLoop) {
-+ /* assert software reset */
- PhyCtrl |= PHY_CT_RESET;
- }
-+#endif /* !SK_SLIM */
- }
- else {
-- /* Set Auto-negotiation advertisement */
--
-+ /* set Auto-negotiation advertisement */
-+
- if (pAC->GIni.GICopperType) {
-- /* Set Speed capabilities */
-+ /* set Speed capabilities */
- switch (pPrt->PLinkSpeed) {
- case SK_LSPEED_AUTO:
-- C1000BaseT |= PHY_M_1000C_AHD | PHY_M_1000C_AFD;
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+ C1000BaseT |= PHY_M_1000C_AFD;
-+#ifdef xSK_DIAG
-+ C1000BaseT |= PHY_M_1000C_AHD;
-+#endif /* SK_DIAG */
-+ }
- AutoNegAdv |= PHY_M_AN_100_FD | PHY_M_AN_100_HD |
- PHY_M_AN_10_FD | PHY_M_AN_10_HD;
- break;
- case SK_LSPEED_1000MBPS:
-- C1000BaseT |= PHY_M_1000C_AHD | PHY_M_1000C_AFD;
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+ C1000BaseT |= PHY_M_1000C_AFD;
-+#ifdef xSK_DIAG
-+ C1000BaseT |= PHY_M_1000C_AHD;
-+#endif /* SK_DIAG */
-+ }
- break;
- case SK_LSPEED_100MBPS:
-- AutoNegAdv |= PHY_M_AN_100_FD | PHY_M_AN_100_HD |
-- /* advertise 10Base-T also */
-- PHY_M_AN_10_FD | PHY_M_AN_10_HD;
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_100MBPS) != 0) {
-+ AutoNegAdv |= PHY_M_AN_100_FD | PHY_M_AN_100_HD |
-+ /* advertise 10Base-T also */
-+ PHY_M_AN_10_FD | PHY_M_AN_10_HD;
-+ }
- break;
- case SK_LSPEED_10MBPS:
-- AutoNegAdv |= PHY_M_AN_10_FD | PHY_M_AN_10_HD;
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_10MBPS) != 0) {
-+ AutoNegAdv |= PHY_M_AN_10_FD | PHY_M_AN_10_HD;
-+ }
- break;
- default:
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_HWI_E019,
- SKERR_HWI_E019MSG);
- }
-
-- /* Set Full/half duplex capabilities */
-+ /* set Full/half duplex capabilities */
- switch (pPrt->PLinkMode) {
- case SK_LMODE_AUTOHALF:
- C1000BaseT &= ~PHY_M_1000C_AFD;
-@@ -2524,8 +3012,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_HWI_E015,
- SKERR_HWI_E015MSG);
- }
--
-- /* Set Flow-control capabilities */
-+
-+ /* set Flow-control capabilities */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- AutoNegAdv |= PHY_B_P_NO_PAUSE;
-@@ -2544,9 +3032,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SKERR_HWI_E016MSG);
- }
- }
-- else { /* special defines for FIBER (88E1011S only) */
--
-- /* Set Full/half duplex capabilities */
-+ else { /* special defines for FIBER (88E1040S only) */
-+
-+ /* set Full/half duplex capabilities */
- switch (pPrt->PLinkMode) {
- case SK_LMODE_AUTOHALF:
- AutoNegAdv |= PHY_M_AN_1000X_AHD;
-@@ -2561,8 +3049,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_HWI_E015,
- SKERR_HWI_E015MSG);
- }
--
-- /* Set Flow-control capabilities */
-+
-+ /* set Flow-control capabilities */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- AutoNegAdv |= PHY_M_P_NO_PAUSE_X;
-@@ -2587,138 +3075,228 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- PhyCtrl |= PHY_CT_ANE | PHY_CT_RE_CFG;
- }
- }
--
-+
- #ifdef VCPU
- /*
- * E-mail from Gu Lin (08-03-2002):
- */
--
-+
- /* Program PHY register 30 as 16'h0708 for simulation speed up */
- SkGmPhyWrite(pAC, IoC, Port, 30, 0x0700 /* 0x0708 */);
--
-+
- VCpuWait(2000);
-
--#else /* VCPU */
--
-- /* Write 1000Base-T Control Register */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_1000T_CTRL, C1000BaseT);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set 1000B-T Ctrl =0x%04X\n", C1000BaseT));
--
-+#else /* !VCPU */
-+
-+ if (ChipId != CHIP_ID_YUKON_FE) {
-+ /* Write 1000Base-T Control Register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_1000T_CTRL, C1000BaseT);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Set 1000B-T Ctrl = 0x%04X\n", C1000BaseT));
-+ }
-+
- /* Write AutoNeg Advertisement Register */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_AUNE_ADV, AutoNegAdv);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set Auto-Neg.Adv.=0x%04X\n", AutoNegAdv));
--#endif /* VCPU */
--
-+ ("Set Auto-Neg.Adv. = 0x%04X\n", AutoNegAdv));
-+#endif /* !VCPU */
-+
-+#ifndef SK_SLIM
- if (DoLoop) {
-- /* Set the PHY Loopback bit */
-+ /* set the PHY Loopback bit */
- PhyCtrl |= PHY_CT_LOOP;
-
- #ifdef XXX
- /* Program PHY register 16 as 16'h0400 to force link good */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, PHY_M_PC_FL_GOOD);
--#endif /* XXX */
-
--#ifndef VCPU
- if (pPrt->PLinkSpeed != SK_LSPEED_AUTO) {
- /* Write Ext. PHY Specific Control */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL,
- (SK_U16)((pPrt->PLinkSpeed + 2) << 4));
- }
--#endif /* VCPU */
-+#endif /* XXX */
- }
- #ifdef TEST_ONLY
- else if (pPrt->PLinkSpeed == SK_LSPEED_10MBPS) {
-- /* Write PHY Specific Control */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL,
-- PHY_M_PC_EN_DET_MSK);
-+ /* Write PHY Specific Control */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, PHY_M_PC_EN_DET_MSK);
- }
- #endif
-+#endif /* !SK_SLIM */
-
- /* Write to the PHY Control register */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Set PHY Ctrl Reg.=0x%04X\n", PhyCtrl));
-+ ("Set PHY Ctrl Reg. = 0x%04X\n", PhyCtrl));
-
- #ifdef VCPU
- VCpuWait(2000);
--#else
-+#else /* !VCPU */
-
-- LedCtrl = PHY_M_LED_PULS_DUR(PULS_170MS) | PHY_M_LED_BLINK_RT(BLINK_84MS);
-+ LedCtrl = PHY_M_LED_PULS_DUR(PULS_170MS);
-+
-+ LedOver = 0;
-
- if ((pAC->GIni.GILedBlinkCtrl & SK_ACT_LED_BLINK) != 0) {
-- LedCtrl |= PHY_M_LEDC_RX_CTRL | PHY_M_LEDC_TX_CTRL;
-+
-+ if (ChipId == CHIP_ID_YUKON_FE) {
-+ /* on 88E3082 these bits are at 11..9 (shifted left) */
-+ LedCtrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) << 1;
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_FE_LED_PAR, &SWord);
-+
-+ /* delete ACT LED control bits */
-+ SWord &= ~PHY_M_FELP_LED1_MSK;
-+ /* change ACT LED control to blink mode */
-+ SWord |= PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_ACT_BL);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_FE_LED_PAR, SWord);
-+ }
-+ else if (ChipId == CHIP_ID_YUKON_XL || ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* save page register */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_ADR, &PageReg);
-+
-+ /* select page 3 to access LED control register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 3);
-+
-+ /* set LED Function Control register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, (SK_U16)
-+ (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
-+ PHY_M_LEDC_INIT_CTRL(
-+ ChipId == CHIP_ID_YUKON_XL ? 7 : 8) | /* 10 Mbps */
-+ PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
-+ PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */
-+
-+ if (ChipId == CHIP_ID_YUKON_XL) {
-+ /* set Polarity Control register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_STAT, (SK_U16)
-+ (PHY_M_POLC_LS1_P_MIX(4) | PHY_M_POLC_IS0_P_MIX(4) |
-+ PHY_M_POLC_LOS_CTRL(2) | PHY_M_POLC_INIT_CTRL(2) |
-+ PHY_M_POLC_STA1_CTRL(2) | PHY_M_POLC_STA0_CTRL(2)));
-+ }
-+ else if (ChipId == CHIP_ID_YUKON_EC_U) {
-+ /* set Blink Rate in LED Timer Control Register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK,
-+ LedCtrl | (SK_U16)PHY_M_LED_BLINK_RT(BLINK_84MS));
-+ }
-+ /* restore page register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, PageReg);
-+ }
-+ else {
-+ /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */
-+ LedCtrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL;
-+
-+ /* on PHY 88E1111 there is a change for LED control */
-+ if (ChipId == CHIP_ID_YUKON_EC &&
-+ (pAC->GIni.GILedBlinkCtrl & SK_DUAL_LED_ACT_LNK) != 0) {
-+ /* Yukon-EC needs setting of 2 bits: 0,6=11) */
-+ LedCtrl |= PHY_M_LEDC_TX_C_LSB;
-+ }
-+ /* turn off the Rx LED (LED_RX) */
-+ LedOver |= PHY_M_LED_MO_RX(MO_LED_OFF);
-+ }
- }
-
- if ((pAC->GIni.GILedBlinkCtrl & SK_DUP_LED_NORMAL) != 0) {
-+ /* disable blink mode (LED_DUPLEX) on collisions */
- LedCtrl |= PHY_M_LEDC_DP_CTRL;
- }
--
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_CTRL, LedCtrl);
-
-- if ((pAC->GIni.GILedBlinkCtrl & SK_LED_LINK100_ON) != 0) {
-- /* only in forced 100 Mbps mode */
-- if (!AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_100MBPS) {
-+ if (ChipId == CHIP_ID_YUKON_EC_U &&
-+ pAC->GIni.GIChipRev == CHIP_REV_YU_EC_U_A1) {
-
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_OVER,
-- PHY_M_LED_MO_100(MO_LED_ON));
-+ /* apply fixes in PHY AFE */
-+ SkGmPhyWrite(pAC, IoC, Port, 22, 255);
-+ /* increase differential signal amplitude in 10BASE-T */
-+ SkGmPhyWrite(pAC, IoC, Port, 24, 0xaa99);
-+ SkGmPhyWrite(pAC, IoC, Port, 23, 0x2011);
-+
-+ /* fix for IEEE A/B Symmetry failure in 1000BASE-T */
-+ SkGmPhyWrite(pAC, IoC, Port, 24, 0xa204);
-+ SkGmPhyWrite(pAC, IoC, Port, 23, 0x2002);
-+
-+ /* set page register to 0 */
-+ SkGmPhyWrite(pAC, IoC, Port, 22, 0);
-+ }
-+ else {
-+ /* no effect on Yukon-XL and Yukon-EC Ultra */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_CTRL, LedCtrl);
-+
-+#ifndef SK_SLIM
-+ if ((pAC->GIni.GILedBlinkCtrl & SK_LED_LINK100_ON) != 0) {
-+ /* only in forced 100 Mbps mode */
-+ if (!AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_100MBPS) {
-+ /* turn on 100 Mbps LED (LED_LINK100) */
-+ LedOver |= PHY_M_LED_MO_100(MO_LED_ON);
-+ }
-+ }
-+#endif /* !SK_SLIM */
-+
-+ if (LedOver != 0) {
-+ /* set Manual LED Override */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_OVER, LedOver);
- }
- }
-
- #ifdef SK_DIAG
-- c_print("Set PHY Ctrl=0x%04X\n", PhyCtrl);
-- c_print("Set 1000 B-T=0x%04X\n", C1000BaseT);
-- c_print("Set Auto-Neg=0x%04X\n", AutoNegAdv);
-- c_print("Set Ext Ctrl=0x%04X\n", ExtPhyCtrl);
-+ c_print("Set PHY Ctrl = 0x%04X\n", PhyCtrl);
-+ c_print("Set 1000 B-T = 0x%04X\n", C1000BaseT);
-+ c_print("Set Auto-Neg = 0x%04X\n", AutoNegAdv);
-+ c_print("Set Ext Ctrl = 0x%04X\n", ExtPhyCtrl);
- #endif /* SK_DIAG */
-
- #if defined(SK_DIAG) || defined(DEBUG)
- /* Read PHY Control */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &PhyCtrl);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Ctrl Reg.=0x%04X\n", PhyCtrl));
--
-- /* Read 1000Base-T Control Register */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_CTRL, &C1000BaseT);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("1000B-T Ctrl =0x%04X\n", C1000BaseT));
--
-+ ("PHY Ctrl Reg. = 0x%04X\n", PhyCtrl));
-+
- /* Read AutoNeg Advertisement Register */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_ADV, &AutoNegAdv);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Auto-Neg.Adv.=0x%04X\n", AutoNegAdv));
--
-- /* Read Ext. PHY Specific Control */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl);
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Ext. PHY Ctrl=0x%04X\n", ExtPhyCtrl));
--
-+ ("Auto-Neg.Adv. = 0x%04X\n", AutoNegAdv));
-+
-+ if (ChipId != CHIP_ID_YUKON_FE) {
-+ /* Read 1000Base-T Control Register */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_CTRL, &C1000BaseT);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("1000B-T Ctrl = 0x%04X\n", C1000BaseT));
-+
-+ /* Read Ext. PHY Specific Control */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Ext. PHY Ctrl = 0x%04X\n", ExtPhyCtrl));
-+ }
-+
- /* Read PHY Status */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_STAT, &PhyStat);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Stat Reg.=0x%04X\n", PhyStat));
-+ ("PHY Stat Reg. = 0x%04X\n", PhyStat));
-+
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_STAT, &PhyStat1);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Stat Reg.=0x%04X\n", PhyStat1));
--
-+ ("PHY Stat Reg. = 0x%04X\n", PhyStat1));
-+
- /* Read PHY Specific Status */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_STAT, &PhySpecStat);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Spec Stat=0x%04X\n", PhySpecStat));
-+ ("PHY Spec Stat = 0x%04X\n", PhySpecStat));
- #endif /* SK_DIAG || DEBUG */
-
- #ifdef SK_DIAG
-- c_print("PHY Ctrl Reg=0x%04X\n", PhyCtrl);
-- c_print("PHY 1000 Reg=0x%04X\n", C1000BaseT);
-- c_print("PHY AnAd Reg=0x%04X\n", AutoNegAdv);
-- c_print("Ext Ctrl Reg=0x%04X\n", ExtPhyCtrl);
-- c_print("PHY Stat Reg=0x%04X\n", PhyStat);
-- c_print("PHY Stat Reg=0x%04X\n", PhyStat1);
-- c_print("PHY Spec Reg=0x%04X\n", PhySpecStat);
-+ c_print("PHY Ctrl Reg = 0x%04X\n", PhyCtrl);
-+ c_print("PHY 1000 Reg = 0x%04X\n", C1000BaseT);
-+ c_print("PHY AnAd Reg = 0x%04X\n", AutoNegAdv);
-+ c_print("Ext Ctrl Reg = 0x%04X\n", ExtPhyCtrl);
-+ c_print("PHY Stat Reg = 0x%04X\n", PhyStat);
-+ c_print("PHY Stat Reg = 0x%04X\n", PhyStat1);
-+ c_print("PHY Spec Reg = 0x%04X\n", PhySpecStat);
- #endif /* SK_DIAG */
-
--#endif /* VCPU */
-+ /* enable PHY interrupts */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK, (SK_U16)PHY_M_DEF_MSK);
-+#endif /* !VCPU */
-
- } /* SkGmInitPhyMarv */
- #endif /* YUKON */
-@@ -2737,8 +3315,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * nothing
- */
- static void SkXmInitPhyLone(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
-@@ -2756,7 +3334,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- /* manually Master/Slave ? */
- if (pPrt->PMSMode != SK_MS_MODE_AUTO) {
- Ctrl2 |= PHY_L_1000C_MSE;
--
-+
- if (pPrt->PMSMode == SK_MS_MODE_MASTER) {
- Ctrl2 |= PHY_L_1000C_MSC;
- }
-@@ -2769,7 +3347,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- */
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyLone: no auto-negotiation Port %d\n", Port));
-- /* Set DuplexMode in Config register */
-+ /* set DuplexMode in Config register */
- if (pPrt->PLinkMode == SK_LMODE_FULL) {
- Ctrl1 |= PHY_CT_DUP_MD;
- }
-@@ -2778,7 +3356,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- if (pPrt->PMSMode == SK_MS_MODE_AUTO) {
- Ctrl2 |= PHY_L_1000C_MSE; /* set it to Slave */
- }
--
- /*
- * Do NOT enable Auto-negotiation here. This would hold
- * the link down because no IDLES are transmitted
-@@ -2787,9 +3364,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- else {
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("InitPhyLone: with auto-negotiation Port %d\n", Port));
-- /* Set Auto-negotiation advertisement */
-+ /* set Auto-negotiation advertisement */
-
-- /* Set Full/half duplex capabilities */
-+ /* set Full/half duplex capabilities */
- switch (pPrt->PLinkMode) {
- case SK_LMODE_AUTOHALF:
- Ctrl2 |= PHY_L_1000C_AHD;
-@@ -2805,7 +3382,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- SKERR_HWI_E015MSG);
- }
-
-- /* Set Flow-control capabilities */
-+ /* set Flow-control capabilities */
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- Ctrl3 |= PHY_L_P_NO_PAUSE;
-@@ -2827,26 +3404,26 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- /* Restart Auto-negotiation */
- Ctrl1 = PHY_CT_ANE | PHY_CT_RE_CFG;
- }
--
-+
- /* Write 1000Base-T Control Register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_LONE_1000T_CTRL, Ctrl2);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("1000B-T Ctrl Reg=0x%04X\n", Ctrl2));
--
-+ ("1000B-T Ctrl Reg = 0x%04X\n", Ctrl2));
-+
- /* Write AutoNeg Advertisement Register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_LONE_AUNE_ADV, Ctrl3);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Auto-Neg.Adv.Reg=0x%04X\n", Ctrl3));
-+ ("Auto-Neg.Adv.Reg = 0x%04X\n", Ctrl3));
-
- if (DoLoop) {
-- /* Set the Phy Loopback bit, too */
-+ /* set the Phy Loopback bit, too */
- Ctrl1 |= PHY_CT_LOOP;
- }
-
- /* Write to the Phy control register */
- SkXmPhyWrite(pAC, IoC, Port, PHY_LONE_CTRL, Ctrl1);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Control Reg=0x%04X\n", Ctrl1));
-+ ("PHY Control Reg = 0x%04X\n", Ctrl1));
- } /* SkXmInitPhyLone */
-
-
-@@ -2862,8 +3439,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * nothing
- */
- static void SkXmInitPhyNat(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
-@@ -2884,8 +3461,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- * nothing
- */
- void SkMacInitPhy(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
- {
-@@ -2895,7 +3472,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- switch (pPrt->PhyType) {
- case SK_PHY_XMAC:
- SkXmInitPhyXmac(pAC, IoC, Port, DoLoop);
-@@ -2914,10 +3491,10 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- SkGmInitPhyMarv(pAC, IoC, Port, DoLoop);
- }
- #endif /* YUKON */
-@@ -2935,17 +3512,17 @@ SK_BOOL DoLoop) /* Should a Phy LoopBac
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
- static int SkXmAutoNegDoneXmac(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
- SK_U16 ResAb; /* Resolved Ability */
-- SK_U16 LPAb; /* Link Partner Ability */
-+ SK_U16 LinkPartAb; /* Link Partner Ability */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("AutoNegDoneXmac, Port %d\n", Port));
-@@ -2953,15 +3530,15 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt = &pAC->GIni.GP[Port];
-
- /* Get PHY parameters */
-- SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_LP, &LPAb);
-+ SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_LP, &LinkPartAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_RES_ABI, &ResAb);
-
-- if ((LPAb & PHY_X_AN_RFB) != 0) {
-+ if ((LinkPartAb & PHY_X_AN_RFB) != 0) {
- /* At least one of the remote fault bit is set */
-- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Remote fault bit set Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_OTHER);
- }
-
-@@ -2974,9 +3551,10 @@ int Port) /* Port Index (MAC_1 + n) */
- }
- else {
- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Duplex mode mismatch Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_DUP_CAP);
- }
-
-@@ -2984,19 +3562,19 @@ int Port) /* Port Index (MAC_1 + n) */
- /* We are NOT using chapter 4.23 of the Xaqti manual */
- /* We are using IEEE 802.3z/D5.0 Table 37-4 */
- if ((pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC ||
-- pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM) &&
-- (LPAb & PHY_X_P_SYM_MD) != 0) {
-+ pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM) &&
-+ (LinkPartAb & PHY_X_P_SYM_MD) != 0) {
- /* Symmetric PAUSE */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC;
- }
- else if (pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM &&
-- (LPAb & PHY_X_RS_PAUSE) == PHY_X_P_ASYM_MD) {
-- /* Enable PAUSE receive, disable PAUSE transmit */
-+ (LinkPartAb & PHY_X_RS_PAUSE) == PHY_X_P_ASYM_MD) {
-+ /* enable PAUSE receive, disable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND;
- }
- else if (pPrt->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND &&
-- (LPAb & PHY_X_RS_PAUSE) == PHY_X_P_BOTH_MD) {
-- /* Disable PAUSE receive, enable PAUSE transmit */
-+ (LinkPartAb & PHY_X_RS_PAUSE) == PHY_X_P_BOTH_MD) {
-+ /* disable PAUSE receive, enable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND;
- }
- else {
-@@ -3018,41 +3596,40 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
- static int SkXmAutoNegDoneBcom(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-- SK_U16 LPAb; /* Link Partner Ability */
-- SK_U16 AuxStat; /* Auxiliary Status */
--
- #ifdef TEST_ONLY
--01-Sep-2000 RA;:;:
- SK_U16 ResAb; /* Resolved Ability */
--#endif /* 0 */
-+#endif
-+ SK_U16 LinkPartAb; /* Link Partner Ability */
-+ SK_U16 AuxStat; /* Auxiliary Status */
-+
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("AutoNegDoneBcom, Port %d\n", Port));
- pPrt = &pAC->GIni.GP[Port];
-
- /* Get PHY parameters */
-- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &LPAb);
-+ SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &LinkPartAb);
- #ifdef TEST_ONLY
--01-Sep-2000 RA;:;:
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ResAb);
--#endif /* 0 */
--
-+#endif
-+
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_STAT, &AuxStat);
-
-- if ((LPAb & PHY_B_AN_RF) != 0) {
-+ if ((LinkPartAb & PHY_B_AN_RF) != 0) {
- /* Remote fault bit is set: Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Remote fault bit set Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_OTHER);
- }
-
-@@ -3065,26 +3642,26 @@ int Port) /* Port Index (MAC_1 + n) */
- }
- else {
- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Duplex mode mismatch Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_DUP_CAP);
- }
--
-+
- #ifdef TEST_ONLY
--01-Sep-2000 RA;:;:
- /* Check Master/Slave resolution */
- if ((ResAb & PHY_B_1000S_MSF) != 0) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("Master/Slave Fault Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
- pPrt->PMSStatus = SK_MS_STAT_FAULT;
- return(SK_AND_OTHER);
- }
--
-+
- pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
- SK_MS_STAT_MASTER : SK_MS_STAT_SLAVE;
--#endif /* 0 */
-+#endif
-
- /* Check PAUSE mismatch ??? */
- /* We are using IEEE 802.3z/D5.0 Table 37-4 */
-@@ -3093,11 +3670,11 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC;
- }
- else if ((AuxStat & PHY_B_AS_PAUSE_MSK) == PHY_B_AS_PRR) {
-- /* Enable PAUSE receive, disable PAUSE transmit */
-+ /* enable PAUSE receive, disable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND;
- }
- else if ((AuxStat & PHY_B_AS_PAUSE_MSK) == PHY_B_AS_PRT) {
-- /* Disable PAUSE receive, enable PAUSE transmit */
-+ /* disable PAUSE receive, enable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND;
- }
- else {
-@@ -3111,6 +3688,7 @@ int Port) /* Port Index (MAC_1 + n) */
- #endif /* GENESIS */
-
-
-+#ifndef SK_SLIM
- #ifdef YUKON
- /******************************************************************************
- *
-@@ -3121,102 +3699,148 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
- static int SkGmAutoNegDoneMarv(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-- SK_U16 LPAb; /* Link Partner Ability */
- SK_U16 ResAb; /* Resolved Ability */
-+ SK_U16 LinkPartAb; /* Link Partner Ability */
- SK_U16 AuxStat; /* Auxiliary Status */
-+ SK_U8 PauseMode; /* Pause Mode */
-+
-+ /* set Pause On */
-+ PauseMode = (SK_U8)GMC_PAUSE_ON;
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("AutoNegDoneMarv, Port %d\n", Port));
-+
- pPrt = &pAC->GIni.GP[Port];
-
- /* Get PHY parameters */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_LP, &LPAb);
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_LP, &LinkPartAb);
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Link P.Abil.=0x%04X\n", LPAb));
--
-- if ((LPAb & PHY_M_AN_RF) != 0) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ ("Link P.Abil. = 0x%04X\n", LinkPartAb));
-+
-+ if ((LinkPartAb & PHY_M_AN_RF) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Remote fault bit set Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_OTHER);
- }
-
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb);
--
-- /* Check Master/Slave resolution */
-- if ((ResAb & PHY_B_1000S_MSF) != 0) {
-+ /* Read PHY Auto-Negotiation Expansion */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_EXP, &LinkPartAb);
-+
-+ if ((LinkPartAb & PHY_ANE_LP_CAP) == 0) {
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("Master/Slave Fault Port %d\n", Port));
-- pPrt->PAutoNegFail = SK_TRUE;
-- pPrt->PMSStatus = SK_MS_STAT_FAULT;
-- return(SK_AND_OTHER);
-+ ("Link Partner not Auto-Neg. able, AN Exp.: 0x%04X\n", LinkPartAb));
-+ }
-+
-+ if ((pPrt->PLinkSpeedCap & SK_LSPEED_CAP_1000MBPS) != 0) {
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb);
-+
-+ /* Check Master/Slave resolution */
-+ if ((ResAb & PHY_B_1000S_MSF) != 0) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("Master/Slave Fault Port %d\n", Port));
-+ pPrt->PAutoNegFail = SK_TRUE;
-+ pPrt->PMSStatus = SK_MS_STAT_FAULT;
-+ return(SK_AND_OTHER);
-+ }
-+
-+ pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
-+ (SK_U8)SK_MS_STAT_MASTER : (SK_U8)SK_MS_STAT_SLAVE;
- }
--
-- pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ?
-- (SK_U8)SK_MS_STAT_MASTER : (SK_U8)SK_MS_STAT_SLAVE;
--
-+
- /* Read PHY Specific Status */
- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_STAT, &AuxStat);
--
-+
- /* Check Speed & Duplex resolved */
- if ((AuxStat & PHY_M_PS_SPDUP_RES) == 0) {
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Speed & Duplex not resolved, Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
-+
- return(SK_AND_DUP_CAP);
- }
--
-- if ((AuxStat & PHY_M_PS_FULL_DUP) != 0) {
-- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOFULL;
-- }
-- else {
-- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
-- }
--
-- /* Check PAUSE mismatch ??? */
-- /* We are using IEEE 802.3z/D5.0 Table 37-4 */
-- if ((AuxStat & PHY_M_PS_PAUSE_MSK) == PHY_M_PS_PAUSE_MSK) {
-- /* Symmetric PAUSE */
-- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC;
-- }
-- else if ((AuxStat & PHY_M_PS_PAUSE_MSK) == PHY_M_PS_RX_P_EN) {
-- /* Enable PAUSE receive, disable PAUSE transmit */
-- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND;
-- }
-- else if ((AuxStat & PHY_M_PS_PAUSE_MSK) == PHY_M_PS_TX_P_EN) {
-- /* Disable PAUSE receive, enable PAUSE transmit */
-- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND;
-+
-+ pPrt->PLinkModeStatus = (SK_U8)(((AuxStat & PHY_M_PS_FULL_DUP) != 0) ?
-+ SK_LMODE_STAT_AUTOFULL : SK_LMODE_STAT_AUTOHALF);
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+ /* set used link speed */
-+ pPrt->PLinkSpeedUsed = (SK_U8)(((AuxStat & PHY_M_PS_SPEED_100) != 0) ?
-+ SK_LSPEED_STAT_100MBPS : SK_LSPEED_STAT_10MBPS);
- }
- else {
-- /* PAUSE mismatch -> no PAUSE */
-- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
-+ /* set used link speed */
-+ switch ((unsigned)(AuxStat & PHY_M_PS_SPEED_MSK)) {
-+ case (unsigned)PHY_M_PS_SPEED_1000:
-+ pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
-+ break;
-+ case PHY_M_PS_SPEED_100:
-+ pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_100MBPS;
-+ break;
-+ default:
-+ pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_10MBPS;
-+ }
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL ||
-+ pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) {
-+ /* Tx & Rx Pause Enabled bits are at 9..8 */
-+ AuxStat >>= 6;
-+
-+ if (!pAC->GIni.GICopperType) {
-+ /* always 1000 Mbps on fiber */
-+ pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
-+ }
-+ }
-+
-+ AuxStat &= PHY_M_PS_PAUSE_MSK;
-+ /* We are using IEEE 802.3z/D5.0 Table 37-4 */
-+ if (AuxStat == PHY_M_PS_PAUSE_MSK) {
-+ /* Symmetric PAUSE */
-+ pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC;
-+ }
-+ else if (AuxStat == PHY_M_PS_RX_P_EN) {
-+ /* enable PAUSE receive, disable PAUSE transmit */
-+ pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND;
-+ }
-+ else if (AuxStat == PHY_M_PS_TX_P_EN) {
-+ /* disable PAUSE receive, enable PAUSE transmit */
-+ pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND;
-+ }
-+ else {
-+ /* PAUSE mismatch -> no PAUSE */
-+ pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
-+ }
- }
--
-- /* set used link speed */
-- switch ((unsigned)(AuxStat & PHY_M_PS_SPEED_MSK)) {
-- case (unsigned)PHY_M_PS_SPEED_1000:
-- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
-- break;
-- case PHY_M_PS_SPEED_100:
-- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_100MBPS;
-- break;
-- default:
-- pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_10MBPS;
-+
-+ if ((pPrt->PFlowCtrlStatus == SK_FLOW_STAT_NONE) ||
-+ /* disable Pause also for 10/100 Mbps in half duplex mode */
-+ ((pAC->GIni.GIChipId != CHIP_ID_YUKON_EC_U) &&
-+ (pPrt->PLinkSpeedUsed < (SK_U8)SK_LSPEED_STAT_1000MBPS) &&
-+ pPrt->PLinkModeStatus == (SK_U8)SK_LMODE_STAT_AUTOHALF)) {
-+
-+ /* set Pause Off */
-+ PauseMode = (SK_U8)GMC_PAUSE_OFF;
- }
-
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_CTRL), PauseMode);
-+
- return(SK_AND_OK);
- } /* SkGmAutoNegDoneMarv */
- #endif /* YUKON */
-+#endif /* !SK_SLIM */
-
-
- #ifdef OTHER_PHY
-@@ -3229,17 +3853,17 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
- static int SkXmAutoNegDoneLone(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
- SK_U16 ResAb; /* Resolved Ability */
-- SK_U16 LPAb; /* Link Partner Ability */
-+ SK_U16 LinkPartAb; /* Link Partner Ability */
- SK_U16 QuickStat; /* Auxiliary Status */
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-@@ -3247,16 +3871,16 @@ int Port) /* Port Index (MAC_1 + n) */
- pPrt = &pAC->GIni.GP[Port];
-
- /* Get PHY parameters */
-- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_AUNE_LP, &LPAb);
-+ SkXmPhyRead(pAC, IoC, Port, PHY_LONE_AUNE_LP, &LinkPartAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_1000T_STAT, &ResAb);
- SkXmPhyRead(pAC, IoC, Port, PHY_LONE_Q_STAT, &QuickStat);
-
-- if ((LPAb & PHY_L_AN_RF) != 0) {
-+ if ((LinkPartAb & PHY_L_AN_RF) != 0) {
- /* Remote fault bit is set */
-- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("AutoNegFail: Remote fault bit set Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
-+
- return(SK_AND_OTHER);
- }
-
-@@ -3267,28 +3891,25 @@ int Port) /* Port Index (MAC_1 + n) */
- else {
- pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
- }
--
-+
- /* Check Master/Slave resolution */
- if ((ResAb & PHY_L_1000S_MSF) != 0) {
- /* Error */
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("Master/Slave Fault Port %d\n", Port));
- pPrt->PAutoNegFail = SK_TRUE;
- pPrt->PMSStatus = SK_MS_STAT_FAULT;
- return(SK_AND_OTHER);
- }
-- else if (ResAb & PHY_L_1000S_MSR) {
-- pPrt->PMSStatus = SK_MS_STAT_MASTER;
-- }
-- else {
-- pPrt->PMSStatus = SK_MS_STAT_SLAVE;
-- }
-+
-+ pPrt->PMSStatus = ((ResAb & PHY_L_1000S_MSR) != 0) ?
-+ (SK_U8)SK_MS_STAT_MASTER : (SK_U8)SK_MS_STAT_SLAVE;
-
- /* Check PAUSE mismatch */
- /* We are using IEEE 802.3z/D5.0 Table 37-4 */
- /* we must manually resolve the abilities here */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
--
-+
- switch (pPrt->PFlowCtrlMode) {
- case SK_FLOW_MODE_NONE:
- /* default */
-@@ -3296,7 +3917,7 @@ int Port) /* Port Index (MAC_1 + n) */
- case SK_FLOW_MODE_LOC_SEND:
- if ((QuickStat & (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) ==
- (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) {
-- /* Disable PAUSE receive, enable PAUSE transmit */
-+ /* disable PAUSE receive, enable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND;
- }
- break;
-@@ -3309,7 +3930,7 @@ int Port) /* Port Index (MAC_1 + n) */
- case SK_FLOW_MODE_SYM_OR_REM:
- if ((QuickStat & (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) ==
- PHY_L_QS_AS_PAUSE) {
-- /* Enable PAUSE receive, disable PAUSE transmit */
-+ /* enable PAUSE receive, disable PAUSE transmit */
- pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND;
- }
- else if ((QuickStat & PHY_L_QS_PAUSE) != 0) {
-@@ -3321,7 +3942,7 @@ int Port) /* Port Index (MAC_1 + n) */
- SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_HWI_E016,
- SKERR_HWI_E016MSG);
- }
--
-+
- return(SK_AND_OK);
- } /* SkXmAutoNegDoneLone */
-
-@@ -3335,12 +3956,12 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
- static int SkXmAutoNegDoneNat(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- /* todo: National */
-@@ -3357,12 +3978,12 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * Returns:
- * SK_AND_OK o.k.
-- * SK_AND_DUP_CAP Duplex capability error happened
-- * SK_AND_OTHER Other error happened
-+ * SK_AND_DUP_CAP Duplex capability error happened
-+ * SK_AND_OTHER Other error happened
- */
--int SkMacAutoNegDone(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+int SkMacAutoNegDone(
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -3374,9 +3995,9 @@ int Port) /* Port Index (MAC_1 + n) */
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- switch (pPrt->PhyType) {
--
-+
- case SK_PHY_XMAC:
- Rtv = SkXmAutoNegDoneXmac(pAC, IoC, Port);
- break;
-@@ -3396,30 +4017,33 @@ int Port) /* Port Index (MAC_1 + n) */
- }
- }
- #endif /* GENESIS */
--
-+
-+#ifndef SK_SLIM
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- Rtv = SkGmAutoNegDoneMarv(pAC, IoC, Port);
- }
- #endif /* YUKON */
--
-+
- if (Rtv != SK_AND_OK) {
- return(Rtv);
- }
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
- ("AutoNeg done Port %d\n", Port));
--
-+
- /* We checked everything and may now enable the link */
- pPrt->PAutoNegFail = SK_FALSE;
-+#endif /* !SK_SLIM */
-
- SkMacRxTxEnable(pAC, IoC, Port);
--
-+
- return(SK_AND_OK);
- } /* SkMacAutoNegDone */
-
-
-+#ifndef SK_SLIM
- #ifdef GENESIS
- /******************************************************************************
- *
-@@ -3433,7 +4057,7 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- static void SkXmSetRxTxEn(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Para) /* Parameter to set: MAC or PHY LoopBack, Duplex Mode */
- {
-@@ -3458,7 +4082,7 @@ int Para) /* Parameter to set: MAC or
- Word &= ~XM_MMU_GMII_LOOP;
- break;
- }
--
-+
- switch (Para & (SK_PHY_FULLD_ON | SK_PHY_FULLD_OFF)) {
- case SK_PHY_FULLD_ON:
- Word |= XM_MMU_GMII_FD;
-@@ -3467,7 +4091,7 @@ int Para) /* Parameter to set: MAC or
- Word &= ~XM_MMU_GMII_FD;
- break;
- }
--
-+
- XM_OUT16(IoC, Port, XM_MMU_CMD, Word | XM_MMU_ENA_RX | XM_MMU_ENA_TX);
-
- /* dummy read to ensure writing */
-@@ -3490,12 +4114,12 @@ int Para) /* Parameter to set: MAC or
- */
- static void SkGmSetRxTxEn(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Para) /* Parameter to set: MAC LoopBack, Duplex Mode */
- {
- SK_U16 Ctrl;
--
-+
- GM_IN16(IoC, Port, GM_GP_CTRL, &Ctrl);
-
- switch (Para & (SK_MAC_LOOPB_ON | SK_MAC_LOOPB_OFF)) {
-@@ -3515,18 +4139,18 @@ int Para) /* Parameter to set: MAC Loo
- Ctrl &= ~GM_GPCR_DUP_FULL;
- break;
- }
--
-- GM_OUT16(IoC, Port, GM_GP_CTRL, (SK_U16)(Ctrl | GM_GPCR_RX_ENA |
-- GM_GPCR_TX_ENA));
-
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, Ctrl | GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
-+
-+#ifdef XXX
- /* dummy read to ensure writing */
- GM_IN16(IoC, Port, GM_GP_CTRL, &Ctrl);
-+#endif /* XXX */
-
- } /* SkGmSetRxTxEn */
- #endif /* YUKON */
-
-
--#ifndef SK_SLIM
- /******************************************************************************
- *
- * SkMacSetRxTxEn() - Special Set Rx/Tx Enable and parameters
-@@ -3537,20 +4161,20 @@ int Para) /* Parameter to set: MAC Loo
- */
- void SkMacSetRxTxEn(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- int Para)
- {
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- SkXmSetRxTxEn(pAC, IoC, Port, Para);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- SkGmSetRxTxEn(pAC, IoC, Port, Para);
- }
- #endif /* YUKON */
-@@ -3570,8 +4194,8 @@ int Para)
- * != 0 Error happened
- */
- int SkMacRxTxEnable(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -3589,9 +4213,9 @@ int Port) /* Port Index (MAC_1 + n) */
- }
-
- if ((pPrt->PLinkMode == SK_LMODE_AUTOHALF ||
-- pPrt->PLinkMode == SK_LMODE_AUTOFULL ||
-- pPrt->PLinkMode == SK_LMODE_AUTOBOTH) &&
-- pPrt->PAutoNegFail) {
-+ pPrt->PLinkMode == SK_LMODE_AUTOFULL ||
-+ pPrt->PLinkMode == SK_LMODE_AUTOBOTH) &&
-+ pPrt->PAutoNegFail) {
- /* Auto-negotiation is not done or failed */
- return(0);
- }
-@@ -3600,9 +4224,9 @@ int Port) /* Port Index (MAC_1 + n) */
- if (pAC->GIni.GIGenesis) {
- /* set Duplex Mode and Pause Mode */
- SkXmInitDupMd(pAC, IoC, Port);
--
-+
- SkXmInitPauseMd(pAC, IoC, Port);
--
-+
- /*
- * Initialize the Interrupt Mask Register. Default IRQs are...
- * - Link Asynchronous Event
-@@ -3618,23 +4242,23 @@ int Port) /* Port Index (MAC_1 + n) */
- /* add IRQ for Receive FIFO Overflow */
- IntMask &= ~XM_IS_RXF_OV;
- #endif /* DEBUG */
--
-+
- if (pPrt->PhyType != SK_PHY_XMAC) {
- /* disable GP0 interrupt bit */
- IntMask |= XM_IS_INP_ASS;
- }
- XM_OUT16(IoC, Port, XM_IMSK, IntMask);
--
-+
- /* get MMU Command Reg. */
- XM_IN16(IoC, Port, XM_MMU_CMD, &Reg);
--
-+
- if (pPrt->PhyType != SK_PHY_XMAC &&
- (pPrt->PLinkModeStatus == SK_LMODE_STAT_FULL ||
- pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOFULL)) {
- /* set to Full Duplex */
- Reg |= XM_MMU_GMII_FD;
- }
--
-+
- switch (pPrt->PhyType) {
- case SK_PHY_BCOM:
- /*
-@@ -3644,7 +4268,7 @@ int Port) /* Port Index (MAC_1 + n) */
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_CTRL, &SWord);
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUX_CTRL,
- (SK_U16)(SWord & ~PHY_B_AC_DIS_PM));
-- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_INT_MASK,
-+ SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_INT_MASK,
- (SK_U16)PHY_B_DEF_MSK);
- break;
- #ifdef OTHER_PHY
-@@ -3658,12 +4282,12 @@ int Port) /* Port Index (MAC_1 + n) */
- break;
- #endif /* OTHER_PHY */
- }
--
-+
- /* enable Rx/Tx */
- XM_OUT16(IoC, Port, XM_MMU_CMD, Reg | XM_MMU_ENA_RX | XM_MMU_ENA_TX);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /*
-@@ -3674,34 +4298,34 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- IntMask = GMAC_DEF_MSK;
-
--#ifdef DEBUG
-+#if (defined(DEBUG) || defined(YUK2)) && (!defined(SK_SLIM))
- /* add IRQ for Receive FIFO Overrun */
- IntMask |= GM_IS_RX_FF_OR;
--#endif /* DEBUG */
--
-- SK_OUT8(IoC, GMAC_IRQ_MSK, (SK_U8)IntMask);
--
-+#endif
-+
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_IRQ_MSK), (SK_U8)IntMask);
-+
- /* get General Purpose Control */
- GM_IN16(IoC, Port, GM_GP_CTRL, &Reg);
--
-+
- if (pPrt->PLinkModeStatus == SK_LMODE_STAT_FULL ||
- pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOFULL) {
- /* set to Full Duplex */
- Reg |= GM_GPCR_DUP_FULL;
- }
--
-+
- /* enable Rx/Tx */
-- GM_OUT16(IoC, Port, GM_GP_CTRL, (SK_U16)(Reg | GM_GPCR_RX_ENA |
-- GM_GPCR_TX_ENA));
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, Reg | GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
-
--#ifndef VCPU
-- /* Enable all PHY interrupts */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK,
-- (SK_U16)PHY_M_DEF_MSK);
--#endif /* VCPU */
-+#ifdef XXX
-+ /* dummy read to ensure writing */
-+ GM_IN16(IoC, Port, GM_GP_CTRL, &Reg);
-+#endif /* XXX */
- }
- #endif /* YUKON */
--
-+
-+ pAC->GIni.GP[Port].PState = SK_PRT_RUN;
-+
- return(0);
-
- } /* SkMacRxTxEnable */
-@@ -3717,33 +4341,38 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- void SkMacRxTxDisable(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U16 Word;
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- XM_IN16(IoC, Port, XM_MMU_CMD, &Word);
--
-- XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX));
--
-+
-+ Word &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
-+
-+ XM_OUT16(IoC, Port, XM_MMU_CMD, Word);
-+
- /* dummy read to ensure writing */
- XM_IN16(IoC, Port, XM_MMU_CMD, &Word);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
--
-+
- GM_IN16(IoC, Port, GM_GP_CTRL, &Word);
-
-- GM_OUT16(IoC, Port, GM_GP_CTRL, (SK_U16)(Word & ~(GM_GPCR_RX_ENA |
-- GM_GPCR_TX_ENA)));
-+ Word &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
-
-+ GM_OUT16(IoC, Port, GM_GP_CTRL, Word);
-+
-+#ifdef XXX
- /* dummy read to ensure writing */
- GM_IN16(IoC, Port, GM_GP_CTRL, &Word);
-+#endif /* XXX */
- }
- #endif /* YUKON */
-
-@@ -3760,7 +4389,7 @@ int Port) /* Port Index (MAC_1 + n) */
- */
- void SkMacIrqDisable(
- SK_AC *pAC, /* Adapter Context */
--SK_IOC IoC, /* IO context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -3772,18 +4401,18 @@ int Port) /* Port Index (MAC_1 + n) */
-
- #ifdef GENESIS
- if (pAC->GIni.GIGenesis) {
--
-+
- /* disable all XMAC IRQs */
-- XM_OUT16(IoC, Port, XM_IMSK, 0xffff);
--
-- /* Disable all PHY interrupts */
-+ XM_OUT16(IoC, Port, XM_IMSK, 0xffff);
-+
-+ /* disable all PHY interrupts */
- switch (pPrt->PhyType) {
- case SK_PHY_BCOM:
- /* Make sure that PHY is initialized */
- if (pPrt->PState != SK_PRT_RESET) {
- /* NOT allowed if BCOM is in RESET state */
- /* Workaround BCOM Errata (#10523) all BCom */
-- /* Disable Power Management if link is down */
-+ /* disable Power Management if link is down */
- SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_CTRL, &Word);
- SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUX_CTRL,
- (SK_U16)(Word | PHY_B_AC_DIS_PM));
-@@ -3802,16 +4431,16 @@ int Port) /* Port Index (MAC_1 + n) */
- }
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* disable all GMAC IRQs */
-- SK_OUT8(IoC, GMAC_IRQ_MSK, 0);
--
-+ SK_OUT8(IoC, MR_ADDR(Port, GMAC_IRQ_MSK), 0);
-+
- #ifndef VCPU
-- /* Disable all PHY interrupts */
-+ /* disable all PHY interrupts */
- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_INT_MASK, 0);
--#endif /* VCPU */
-+#endif /* !VCPU */
- }
- #endif /* YUKON */
-
-@@ -3823,29 +4452,72 @@ int Port) /* Port Index (MAC_1 + n) */
- *
- * SkXmSendCont() - Enable / Disable Send Continuous Mode
- *
-- * Description: enable / disable Send Continuous Mode on XMAC
-+ * Description: enable / disable Send Continuous Mode on XMAC resp.
-+ * Packet Generation on GPHY
- *
- * Returns:
- * nothing
- */
- void SkXmSendCont(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL Enable) /* Enable / Disable */
- {
-+ SK_U16 Reg;
-+ SK_U16 Save;
- SK_U32 MdReg;
-
-- XM_IN32(IoC, Port, XM_MODE, &MdReg);
-+ if (pAC->GIni.GIGenesis) {
-+ XM_IN32(IoC, Port, XM_MODE, &MdReg);
-
-- if (Enable) {
-- MdReg |= XM_MD_TX_CONT;
-+ if (Enable) {
-+ MdReg |= XM_MD_TX_CONT;
-+ }
-+ else {
-+ MdReg &= ~XM_MD_TX_CONT;
-+ }
-+ /* setup Mode Register */
-+ XM_OUT32(IoC, Port, XM_MODE, MdReg);
- }
- else {
-- MdReg &= ~XM_MD_TX_CONT;
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) {
-+ /* select page 18 */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_ADDR, 18);
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PAGE_DATA, &Reg);
-+
-+ Reg &= ~0x003c; /* clear bits 5..2 */
-+
-+ if (Enable) {
-+ /* enable packet generation, 1518 byte length */
-+ Reg |= (BIT_5S | BIT_3S);
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, Reg);
-+ }
-+ else if (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) {
-+ /* save page register */
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_ADR, &Save);
-+
-+ /* select page 6 to access Packet Generation register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 6);
-+
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Reg);
-+
-+ Reg &= ~0x003f; /* clear bits 5..0 */
-+
-+ if (Enable) {
-+ /* enable packet generation, 1518 byte length */
-+ Reg |= (BIT_3S | BIT_1S);
-+ }
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Reg);
-+
-+ /* restore page register */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, Save);
-+ }
- }
-- /* setup Mode Register */
-- XM_OUT32(IoC, Port, XM_MODE, MdReg);
-
- } /* SkXmSendCont */
-
-@@ -3860,8 +4532,8 @@ SK_BOOL Enable) /* Enable / Disable */
- * nothing
- */
- void SkMacTimeStamp(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL Enable) /* Enable / Disable */
- {
-@@ -3906,8 +4578,8 @@ SK_BOOL Enable) /* Enable / Disable */
- * is set true.
- */
- void SkXmAutoNegLipaXmac(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_U16 IStatus) /* Interrupt Status word to analyse */
- {
-@@ -3919,8 +4591,9 @@ SK_U16 IStatus) /* Interrupt Status word
- (IStatus & (XM_IS_LIPA_RC | XM_IS_RX_PAGE | XM_IS_AND)) != 0) {
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("AutoNegLipa: AutoNeg detected on Port %d, IStatus=0x%04X\n",
-+ ("AutoNegLipa: AutoNeg detected on Port %d, IStatus = 0x%04X\n",
- Port, IStatus));
-+
- pPrt->PLipaAutoNeg = SK_LIPA_AUTO;
- }
- } /* SkXmAutoNegLipaXmac */
-@@ -3936,8 +4609,8 @@ SK_U16 IStatus) /* Interrupt Status word
- * is set true.
- */
- void SkMacAutoNegLipaPhy(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_U16 PhyStat) /* PHY Status word to analyse */
- {
-@@ -3949,8 +4622,9 @@ SK_U16 PhyStat) /* PHY Status word to an
- (PhyStat & PHY_ST_AN_OVER) != 0) {
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("AutoNegLipa: AutoNeg detected on Port %d, PhyStat=0x%04X\n",
-+ ("AutoNegLipa: AutoNeg detected on Port %d, PhyStat = 0x%04X\n",
- Port, PhyStat));
-+
- pPrt->PLipaAutoNeg = SK_LIPA_AUTO;
- }
- } /* SkMacAutoNegLipaPhy */
-@@ -3965,7 +4639,7 @@ SK_U16 PhyStat) /* PHY Status word to an
- *
- * Note:
- * With an external PHY, some interrupt bits are not meaningfull any more:
-- * - LinkAsyncEvent (bit #14) XM_IS_LNK_AE
-+ * - LinkAsyncEvent (bit #14) XM_IS_LNK_AE
- * - LinkPartnerReqConfig (bit #10) XM_IS_LIPA_RC
- * - Page Received (bit #9) XM_IS_RX_PAGE
- * - NextPageLoadedForXmt (bit #8) XM_IS_TX_PAGE
-@@ -3977,22 +4651,23 @@ SK_U16 PhyStat) /* PHY Status word to an
- * nothing
- */
- void SkXmIrq(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-- SK_EVPARA Para;
- SK_U16 IStatus; /* Interrupt status read from the XMAC */
- SK_U16 IStatus2;
- #ifdef SK_SLIM
-- SK_U64 OverflowStatus;
--#endif
-+ SK_U64 OverflowStatus;
-+#else
-+ SK_EVPARA Para;
-+#endif /* SK_SLIM */
-
- pPrt = &pAC->GIni.GP[Port];
--
-+
- XM_IN16(IoC, Port, XM_ISRC, &IStatus);
--
-+
- /* LinkPartner Auto-negable? */
- if (pPrt->PhyType == SK_PHY_XMAC) {
- SkXmAutoNegLipaXmac(pAC, IoC, Port, IStatus);
-@@ -4003,7 +4678,7 @@ int Port) /* Port Index (MAC_1 + n) */
- XM_IS_RX_PAGE | XM_IS_TX_PAGE |
- XM_IS_AND | XM_IS_INP_ASS);
- }
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
- ("XmacIrq Port %d Isr 0x%04X\n", Port, IStatus));
-
-@@ -4113,49 +4788,55 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkGmIrq(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
- SK_U8 IStatus; /* Interrupt status */
- #ifdef SK_SLIM
-- SK_U64 OverflowStatus;
-+ SK_U64 OverflowStatus;
- #else
- SK_EVPARA Para;
--#endif
-+#endif /* SK_SLIM */
-
- pPrt = &pAC->GIni.GP[Port];
--
-- SK_IN8(IoC, GMAC_IRQ_SRC, &IStatus);
--
-+
-+ SK_IN8(IoC, MR_ADDR(Port, GMAC_IRQ_SRC), &IStatus);
-+
- #ifdef XXX
- /* LinkPartner Auto-negable? */
- SkMacAutoNegLipaPhy(pAC, IoC, Port, IStatus);
- #endif /* XXX */
--
-+
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,
-- ("GmacIrq Port %d Isr 0x%04X\n", Port, IStatus));
-+ ("GmacIrq Port %d Isr 0x%02X\n", Port, IStatus));
-
- /* Combined Tx & Rx Counter Overflow SIRQ Event */
- if (IStatus & (GM_IS_RX_CO_OV | GM_IS_TX_CO_OV)) {
- /* these IRQs will be cleared by reading GMACs register */
- #ifdef SK_SLIM
-- SkGmOverflowStatus(pAC, IoC, Port, IStatus, &OverflowStatus);
-+ SkGmOverflowStatus(pAC, IoC, Port, (SK_U16)IStatus, &OverflowStatus);
- #else
- Para.Para32[0] = (SK_U32)Port;
- Para.Para32[1] = (SK_U32)IStatus;
- SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_SIRQ_OVERFLOW, Para);
--#endif
-+#endif /* SK_SLIM */
- }
-
-+#ifndef SK_SLIM
- if (IStatus & GM_IS_RX_FF_OR) {
- /* clear GMAC Rx FIFO Overrun IRQ */
- SK_OUT8(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), (SK_U8)GMF_CLI_RX_FO);
-+
-+ Para.Para64 = Port;
-+ SkEventQueue(pAC, SKGE_DRV, SK_DRV_RX_OVERFLOW, Para);
-+
- #ifdef DEBUG
- pPrt->PRxOverCnt++;
- #endif /* DEBUG */
- }
-+#endif /* !SK_SLIM */
-
- if (IStatus & GM_IS_TX_FF_UR) {
- /* clear GMAC Tx FIFO Underrun IRQ */
-@@ -4185,8 +4866,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * nothing
- */
- void SkMacIrq(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port) /* Port Index (MAC_1 + n) */
- {
- #ifdef GENESIS
-@@ -4195,7 +4876,7 @@ int Port) /* Port Index (MAC_1 + n) */
- SkXmIrq(pAC, IoC, Port);
- }
- #endif /* GENESIS */
--
-+
- #ifdef YUKON
- if (pAC->GIni.GIYukon) {
- /* IRQ from GMAC */
-@@ -4222,8 +4903,8 @@ int Port) /* Port Index (MAC_1 + n) */
- * 1: something went wrong
- */
- int SkXmUpdateStats(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port) /* Port Index (MAC_1 + n) */
- {
- SK_GEPORT *pPrt;
-@@ -4245,7 +4926,7 @@ unsigned int Port) /* Port Index (MAC_1
- do {
-
- XM_IN16(IoC, Port, XM_STAT_CMD, &StatReg);
--
-+
- if (++WaitIndex > 10) {
-
- SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_HWI_E021, SKERR_HWI_E021MSG);
-@@ -4253,7 +4934,7 @@ unsigned int Port) /* Port Index (MAC_1
- return(1);
- }
- } while ((StatReg & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) != 0);
--
-+
- return(0);
- } /* SkXmUpdateStats */
-
-@@ -4272,19 +4953,19 @@ unsigned int Port) /* Port Index (MAC_1
- * 1: something went wrong
- */
- int SkXmMacStatistic(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port, /* Port Index (MAC_1 + n) */
- SK_U16 StatAddr, /* MIB counter base address */
--SK_U32 SK_FAR *pVal) /* ptr to return statistic value */
-+SK_U32 SK_FAR *pVal) /* Pointer to return statistic value */
- {
- if ((StatAddr < XM_TXF_OK) || (StatAddr > XM_RXF_MAX_SZ)) {
--
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E022, SKERR_HWI_E022MSG);
--
-+
- return(1);
- }
--
-+
- XM_IN32(IoC, Port, StatAddr, pVal);
-
- return(0);
-@@ -4303,12 +4984,12 @@ SK_U32 SK_FAR *pVal) /* ptr to return st
- * 1: something went wrong
- */
- int SkXmResetCounter(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port) /* Port Index (MAC_1 + n) */
- {
- XM_OUT16(IoC, Port, XM_STAT_CMD, XM_SC_CLR_RXC | XM_SC_CLR_TXC);
-- /* Clear two times according to Errata #3 */
-+ /* Clear two times according to XMAC Errata #3 */
- XM_OUT16(IoC, Port, XM_STAT_CMD, XM_SC_CLR_RXC | XM_SC_CLR_TXC);
-
- return(0);
-@@ -4335,11 +5016,11 @@ unsigned int Port) /* Port Index (MAC_1
- * 1: something went wrong
- */
- int SkXmOverflowStatus(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port, /* Port Index (MAC_1 + n) */
--SK_U16 IStatus, /* Interupt Status from MAC */
--SK_U64 SK_FAR *pStatus) /* ptr for return overflow status value */
-+SK_U16 IStatus, /* Interrupt Status from MAC */
-+SK_U64 SK_FAR *pStatus) /* Pointer for return overflow status value */
- {
- SK_U64 Status; /* Overflow status */
- SK_U32 RegVal;
-@@ -4351,7 +5032,7 @@ SK_U64 SK_FAR *pStatus) /* ptr for retur
- XM_IN32(IoC, Port, XM_RX_CNT_EV, &RegVal);
- Status |= (SK_U64)RegVal << 32;
- }
--
-+
- if ((IStatus & XM_IS_TXC_OV) != 0) {
-
- XM_IN32(IoC, Port, XM_TX_CNT_EV, &RegVal);
-@@ -4378,8 +5059,8 @@ SK_U64 SK_FAR *pStatus) /* ptr for retur
- * 1: something went wrong
- */
- int SkGmUpdateStats(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port) /* Port Index (MAC_1 + n) */
- {
- return(0);
-@@ -4400,24 +5081,27 @@ unsigned int Port) /* Port Index (MAC_1
- * 1: something went wrong
- */
- int SkGmMacStatistic(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port, /* Port Index (MAC_1 + n) */
- SK_U16 StatAddr, /* MIB counter base address */
--SK_U32 SK_FAR *pVal) /* ptr to return statistic value */
-+SK_U32 SK_FAR *pVal) /* Pointer to return statistic value */
- {
-
- if ((StatAddr < GM_RXF_UC_OK) || (StatAddr > GM_TXE_FIFO_UR)) {
--
-+
- SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E022, SKERR_HWI_E022MSG);
--
-- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
- ("SkGmMacStat: wrong MIB counter 0x%04X\n", StatAddr));
- return(1);
- }
--
-+
- GM_IN32(IoC, Port, StatAddr, pVal);
-
-+ /* dummy read after GM_IN32() */
-+ SK_IN16(IoC, B0_RAP, &StatAddr);
-+
- return(0);
- } /* SkGmMacStatistic */
-
-@@ -4434,8 +5118,8 @@ SK_U32 SK_FAR *pVal) /* ptr to return st
- * 1: something went wrong
- */
- int SkGmResetCounter(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port) /* Port Index (MAC_1 + n) */
- {
- SK_U16 Reg; /* Phy Address Register */
-@@ -4446,16 +5130,16 @@ unsigned int Port) /* Port Index (MAC_1
-
- /* set MIB Clear Counter Mode */
- GM_OUT16(IoC, Port, GM_PHY_ADDR, Reg | GM_PAR_MIB_CLR);
--
-+
- /* read all MIB Counters with Clear Mode set */
- for (i = 0; i < GM_MIB_CNT_SIZE; i++) {
- /* the reset is performed only when the lower 16 bits are read */
- GM_IN16(IoC, Port, GM_MIB_CNT_BASE + 8*i, &Word);
- }
--
-+
- /* clear MIB Clear Counter Mode */
- GM_OUT16(IoC, Port, GM_PHY_ADDR, Reg);
--
-+
- return(0);
- } /* SkGmResetCounter */
-
-@@ -4469,48 +5153,62 @@ unsigned int Port) /* Port Index (MAC_1
- * resulting counter overflow status is written to <pStatus>, whereas the
- * the following bit coding is used:
- * 63:56 - unused
-- * 55:48 - TxRx interrupt register bit7:0
-- * 32:47 - Rx interrupt register
-+ * 55:48 - TxRx interrupt register bit 7:0
-+ * 47:32 - Rx interrupt register
- * 31:24 - unused
-- * 23:16 - TxRx interrupt register bit15:8
-- * 15:0 - Tx interrupt register
-+ * 23:16 - TxRx interrupt register bit 15:8
-+ * 15: 0 - Tx interrupt register
- *
- * Returns:
- * 0: success
- * 1: something went wrong
- */
- int SkGmOverflowStatus(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- unsigned int Port, /* Port Index (MAC_1 + n) */
--SK_U16 IStatus, /* Interupt Status from MAC */
--SK_U64 SK_FAR *pStatus) /* ptr for return overflow status value */
-+SK_U16 IStatus, /* Interrupt Status from MAC */
-+SK_U64 SK_FAR *pStatus) /* Pointer for return overflow status value */
- {
-- SK_U64 Status; /* Overflow status */
- SK_U16 RegVal;
-+#ifndef SK_SLIM
-+ SK_U64 Status; /* Overflow status */
-
- Status = 0;
-+#endif /* !SK_SLIM */
-
- if ((IStatus & GM_IS_RX_CO_OV) != 0) {
- /* this register is self-clearing after read */
- GM_IN16(IoC, Port, GM_RX_IRQ_SRC, &RegVal);
-+
-+#ifndef SK_SLIM
- Status |= (SK_U64)RegVal << 32;
-+#endif /* !SK_SLIM */
- }
--
-+
- if ((IStatus & GM_IS_TX_CO_OV) != 0) {
- /* this register is self-clearing after read */
- GM_IN16(IoC, Port, GM_TX_IRQ_SRC, &RegVal);
-+
-+#ifndef SK_SLIM
- Status |= (SK_U64)RegVal;
-+#endif /* !SK_SLIM */
- }
--
-+
- /* this register is self-clearing after read */
- GM_IN16(IoC, Port, GM_TR_IRQ_SRC, &RegVal);
-+
-+#ifndef SK_SLIM
- /* Rx overflow interrupt register bits (LoByte)*/
- Status |= (SK_U64)((SK_U8)RegVal) << 48;
- /* Tx overflow interrupt register bits (HiByte)*/
- Status |= (SK_U64)(RegVal >> 8) << 16;
-
- *pStatus = Status;
-+#endif /* !SK_SLIM */
-+
-+ /* dummy read after GM_IN16() */
-+ SK_IN16(IoC, B0_RAP, &RegVal);
-
- return(0);
- } /* SkGmOverflowStatus */
-@@ -4526,60 +5224,118 @@ SK_U64 SK_FAR *pStatus) /* ptr for retur
- * gets the results if 'StartTest' is true
- *
- * NOTE: this test is meaningful only when link is down
-- *
-+ *
- * Returns:
- * 0: success
- * 1: no YUKON copper
- * 2: test in progress
- */
- int SkGmCableDiagStatus(
--SK_AC *pAC, /* adapter context */
--SK_IOC IoC, /* IO context */
-+SK_AC *pAC, /* Adapter Context */
-+SK_IOC IoC, /* I/O Context */
- int Port, /* Port Index (MAC_1 + n) */
- SK_BOOL StartTest) /* flag for start / get result */
- {
- int i;
-+ int CableDiagOffs;
-+ int MdiPairs;
-+ SK_BOOL FastEthernet;
-+ SK_BOOL Yukon2;
- SK_U16 RegVal;
- SK_GEPORT *pPrt;
-
- pPrt = &pAC->GIni.GP[Port];
-
- if (pPrt->PhyType != SK_PHY_MARV_COPPER) {
--
-+
- return(1);
- }
-
-+ Yukon2 = pAC->GIni.GIChipId == CHIP_ID_YUKON_XL ||
-+ pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U;
-+
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
-+
-+ CableDiagOffs = PHY_MARV_FE_VCT_TX;
-+ FastEthernet = SK_TRUE;
-+ MdiPairs = 2;
-+ }
-+ else {
-+ CableDiagOffs = Yukon2 ? PHY_MARV_PHY_CTRL : PHY_MARV_CABLE_DIAG;
-+ FastEthernet = SK_FALSE;
-+ MdiPairs = 4;
-+ }
-+
- if (StartTest) {
-+
-+ /* set to RESET to avoid PortCheckUp */
-+ pPrt->PState = SK_PRT_RESET;
-+
- /* only start the cable test */
-- if ((pPrt->PhyId1 & PHY_I1_REV_MSK) < 4) {
-- /* apply TDR workaround from Marvell */
-- SkGmPhyWrite(pAC, IoC, Port, 29, 0x001e);
--
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xcc00);
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xc800);
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xc400);
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xc000);
-- SkGmPhyWrite(pAC, IoC, Port, 30, 0xc100);
-+ if (!FastEthernet) {
-+
-+ if ((((pPrt->PhyId1 & PHY_I1_MOD_NUM) >> 4) == 2) &&
-+ ((pPrt->PhyId1 & PHY_I1_REV_MSK) < 4)) {
-+ /* apply TDR workaround for model 2, rev. < 4 */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_ADDR, 0x001e);
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xcc00);
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xc800);
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xc400);
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xc000);
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PAGE_DATA, 0xc100);
-+ }
-+
-+#ifdef YUKON_DBG
-+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) {
-+ /* set address to 1 for page 1 */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 1);
-+
-+ /* disable waiting period */
-+ SkGmPhyWrite(pAC, IoC, Port, CableDiagOffs,
-+ PHY_M_CABD_DIS_WAIT);
-+ }
-+#endif
-+ if (Yukon2) {
-+ /* set address to 5 for page 5 */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 5);
-+
-+#ifdef YUKON_DBG
-+ /* disable waiting period */
-+ SkGmPhyWrite(pAC, IoC, Port, CableDiagOffs + 1,
-+ PHY_M_CABD_DIS_WAIT);
-+#endif
-+ }
-+ else {
-+ /* set address to 0 for MDI[0] (Page 0) */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 0);
-+ }
- }
-+ else {
-+ RegVal = PHY_CT_RESET | PHY_CT_SP100;
-
-- /* set address to 0 for MDI[0] */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, 0);
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, RegVal);
-
-- /* Read Cable Diagnostic Reg */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CABLE_DIAG, &RegVal);
-+#ifdef xYUKON_DBG
-+ SkGmPhyRead(pAC, IoC, Port, PHY_MARV_FE_SPEC_2, &RegVal);
-+ /* disable waiting period */
-+ RegVal |= PHY_M_FESC_DIS_WAIT;
-+
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_FE_SPEC_2, RegVal);
-+#endif
-+ }
-
- /* start Cable Diagnostic Test */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CABLE_DIAG,
-- (SK_U16)(RegVal | PHY_M_CABD_ENA_TEST));
--
-+ SkGmPhyWrite(pAC, IoC, Port, CableDiagOffs, PHY_M_CABD_ENA_TEST);
-+
- return(0);
- }
--
-+
- /* Read Cable Diagnostic Reg */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CABLE_DIAG, &RegVal);
-+ SkGmPhyRead(pAC, IoC, Port, CableDiagOffs, &RegVal);
-
- SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
-- ("PHY Cable Diag.=0x%04X\n", RegVal));
-+ ("PHY Cable Diag. = 0x%04X\n", RegVal));
-
- if ((RegVal & PHY_M_CABD_ENA_TEST) != 0) {
- /* test is running */
-@@ -4587,16 +5343,24 @@ SK_BOOL StartTest) /* flag for start / g
- }
-
- /* get the test results */
-- for (i = 0; i < 4; i++) {
-- /* set address to i for MDI[i] */
-- SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, (SK_U16)i);
-+ for (i = 0; i < MdiPairs; i++) {
-+
-+ if (!FastEthernet && !Yukon2) {
-+ /* set address to i for MDI[i] */
-+ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_ADR, (SK_U16)i);
-+ }
-
- /* get Cable Diagnostic values */
-- SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CABLE_DIAG, &RegVal);
-+ SkGmPhyRead(pAC, IoC, Port, CableDiagOffs, &RegVal);
-
- pPrt->PMdiPairLen[i] = (SK_U8)(RegVal & PHY_M_CABD_DIST_MSK);
-
- pPrt->PMdiPairSts[i] = (SK_U8)((RegVal & PHY_M_CABD_STAT_MSK) >> 13);
-+
-+ if (FastEthernet || Yukon2) {
-+ /* get next register */
-+ CableDiagOffs++;
-+ }
- }
-
- return(0);
-@@ -4605,3 +5369,4 @@ SK_BOOL StartTest) /* flag for start / g
- #endif /* YUKON */
-
- /* End of file */
-+
-diff -Nurap ./drivers/net/sk98lin.sk98/sky2.c ./drivers/net/sk98lin/sky2.c
---- ./drivers/net/sk98lin.sk98/sky2.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/sky2.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,2717 @@
-+/******************************************************************************
-+ *
-+ * Name: sky2.c
-+ * Project: Yukon2 specific functions and implementations
-+ * Version: $Revision: 1.35.2.39 $
-+ * Date: $Date: 2005/09/05 08:59:54 $
-+ * Purpose: The main driver source module
-+ *
-+ *****************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * (C)Copyright 1998-2002 SysKonnect GmbH.
-+ * (C)Copyright 2002-2005 Marvell.
-+ *
-+ * Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
-+ * Server Adapters.
-+ *
-+ * Author: Ralph Roesler (rroesler@syskonnect.de)
-+ * Mirko Lindner (mlindner@syskonnect.de)
-+ *
-+ * Address all question to: linux@syskonnect.de
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * The information in this file is provided "AS IS" without warranty.
-+ *
-+ *****************************************************************************/
-+
-+#include "h/skdrv1st.h"
-+#include "h/skdrv2nd.h"
-+#include <linux/tcp.h>
-+
-+/******************************************************************************
-+ *
-+ * Local Function Prototypes
-+ *
-+ *****************************************************************************/
-+
-+static void InitPacketQueues(SK_AC *pAC,int Port);
-+static void GiveTxBufferToHw(SK_AC *pAC,SK_IOC IoC,int Port);
-+static void GiveRxBufferToHw(SK_AC *pAC,SK_IOC IoC,int Port,SK_PACKET *pPacket);
-+static SK_BOOL HandleReceives(SK_AC *pAC,int Port,SK_U16 Len,SK_U32 FrameStatus,SK_U16 Tcp1,SK_U16 Tcp2,SK_U32 Tist,SK_U16 Vlan);
-+static void CheckForSendComplete(SK_AC *pAC,SK_IOC IoC,int Port,SK_PKT_QUEUE *pPQ,SK_LE_TABLE *pLETab,unsigned int Done);
-+static void UnmapAndFreeTxPktBuffer(SK_AC *pAC,SK_PACKET *pSkPacket,int TxPort);
-+static SK_BOOL AllocateAndInitLETables(SK_AC *pAC);
-+static SK_BOOL AllocatePacketBuffersYukon2(SK_AC *pAC);
-+static void FreeLETables(SK_AC *pAC);
-+static void FreePacketBuffers(SK_AC *pAC);
-+static SK_BOOL AllocAndMapRxBuffer(SK_AC *pAC,SK_PACKET *pSkPacket,int Port);
-+#ifdef CONFIG_SK98LIN_NAPI
-+static SK_BOOL HandleStatusLEs(SK_AC *pAC,int *WorkDone,int WorkToDo);
-+#else
-+static SK_BOOL HandleStatusLEs(SK_AC *pAC);
-+#endif
-+
-+extern void SkGeCheckTimer (DEV_NET *pNet);
-+extern void SkLocalEventQueue( SK_AC *pAC,
-+ SK_U32 Class,
-+ SK_U32 Event,
-+ SK_U32 Param1,
-+ SK_U32 Param2,
-+ SK_BOOL Flag);
-+extern void SkLocalEventQueue64( SK_AC *pAC,
-+ SK_U32 Class,
-+ SK_U32 Event,
-+ SK_U64 Param,
-+ SK_BOOL Flag);
-+
-+/******************************************************************************
-+ *
-+ * Local Variables
-+ *
-+ *****************************************************************************/
-+
-+#define MAX_NBR_RX_BUFFERS_IN_HW 0x15
-+static SK_U8 NbrRxBuffersInHW;
-+#define FLUSH_OPC(le)
-+
-+/******************************************************************************
-+ *
-+ * Global Functions
-+ *
-+ *****************************************************************************/
-+
-+int SkY2Xmit( struct sk_buff *skb, struct SK_NET_DEVICE *dev);
-+void FillReceiveTableYukon2(SK_AC *pAC,SK_IOC IoC,int Port);
-+
-+/*****************************************************************************
-+ *
-+ * SkY2RestartStatusUnit - restarts teh status unit
-+ *
-+ * Description:
-+ * Reenables the status unit after any De-Init (e.g. when altering
-+ * the sie of the MTU via 'ifconfig a.b.c.d mtu xxx')
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2RestartStatusUnit(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2RestartStatusUnit\n"));
-+
-+ /*
-+ ** It might be that the TX timer is not started. Therefore
-+ ** it is initialized here -> to be more investigated!
-+ */
-+ SK_OUT32(pAC->IoBase, STAT_TX_TIMER_INI, HW_MS_TO_TICKS(pAC,10));
-+
-+ pAC->StatusLETable.Done = 0;
-+ pAC->StatusLETable.Put = 0;
-+ pAC->StatusLETable.HwPut = 0;
-+ SkGeY2InitStatBmu(pAC, pAC->IoBase, &pAC->StatusLETable);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2RestartStatusUnit\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2RlmtSend - sends out a single RLMT notification
-+ *
-+ * Description:
-+ * This function sends out an RLMT frame
-+ *
-+ * Returns:
-+ * > 0 - on succes: the number of bytes in the message
-+ * = 0 - on resource shortage: this frame sent or dropped, now
-+ * the ring is full ( -> set tbusy)
-+ * < 0 - on failure: other problems ( -> return failure to upper layers)
-+ */
-+int SkY2RlmtSend (
-+SK_AC *pAC, /* pointer to adapter control context */
-+int PortNr, /* index of port the packet(s) shall be send to */
-+struct sk_buff *pMessage) /* pointer to send-message */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("=== SkY2RlmtSend\n"));
-+#if 0
-+ return -1; // temporarily do not send out RLMT frames
-+#endif
-+ skb_shinfo(pMessage)->nr_frags = (2*MAX_SKB_FRAGS) + PortNr;
-+ return(SkY2Xmit(pMessage, pAC->dev[PortNr])); // SkY2Xmit needs device
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2AllocateResources - Allocates all required resources for Yukon2
-+ *
-+ * Description:
-+ * This function allocates all memory needed for the Yukon2.
-+ * It maps also RX buffers to the LETables and initializes the
-+ * status list element table.
-+ *
-+ * Returns:
-+ * SK_TRUE, if all resources could be allocated and setup succeeded
-+ * SK_FALSE, if an error
-+ */
-+SK_BOOL SkY2AllocateResources (
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ int CurrMac;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("==> SkY2AllocateResources\n"));
-+
-+ /*
-+ ** Initialize the packet queue variables first
-+ */
-+ for (CurrMac = 0; CurrMac < pAC->GIni.GIMacsFound; CurrMac++) {
-+ InitPacketQueues(pAC, CurrMac);
-+ }
-+
-+ /*
-+ ** Get sufficient memory for the LETables
-+ */
-+ if (!AllocateAndInitLETables(pAC)) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_INIT | SK_DBGCAT_DRV_ERROR,
-+ ("No memory for LETable.\n"));
-+ return(SK_FALSE);
-+ }
-+
-+ /*
-+ ** Allocate and intialize memory for both RX and TX
-+ ** packet and fragment buffers. On an error, free
-+ ** previously allocated LETable memory and quit.
-+ */
-+ if (!AllocatePacketBuffersYukon2(pAC)) {
-+ FreeLETables(pAC);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_INIT | SK_DBGCAT_DRV_ERROR,
-+ ("No memory for Packetbuffers.\n"));
-+ return(SK_FALSE);
-+ }
-+
-+ /*
-+ ** Rx and Tx LE tables will be initialized in SkGeOpen()
-+ **
-+ ** It might be that the TX timer is not started. Therefore
-+ ** it is initialized here -> to be more investigated!
-+ */
-+ SK_OUT32(pAC->IoBase, STAT_TX_TIMER_INI, HW_MS_TO_TICKS(pAC,10));
-+ SkGeY2InitStatBmu(pAC, pAC->IoBase, &pAC->StatusLETable);
-+
-+ pAC->MaxUnusedRxLeWorking = MAX_UNUSED_RX_LE_WORKING;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("<== SkY2AllocateResources\n"));
-+
-+ return (SK_TRUE);
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2FreeResources - Frees previously allocated resources of Yukon2
-+ *
-+ * Description:
-+ * This function frees all previously allocated memory of the Yukon2.
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2FreeResources (
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2FreeResources\n"));
-+
-+ FreeLETables(pAC);
-+ FreePacketBuffers(pAC);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2FreeResources\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2AllocateRxBuffers - Allocates the receive buffers for a port
-+ *
-+ * Description:
-+ * This function allocated all the RX buffers of the Yukon2.
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2AllocateRxBuffers (
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context */
-+int Port) /* port index of RX */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("==> SkY2AllocateRxBuffers (Port %c)\n", Port));
-+
-+ FillReceiveTableYukon2(pAC, IoC, Port);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("<== SkY2AllocateRxBuffers\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2FreeRxBuffers - Free's all allocates RX buffers of
-+ *
-+ * Description:
-+ * This function frees all RX buffers of the Yukon2 for a single port
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2FreeRxBuffers (
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context */
-+int Port) /* port index of RX */
-+{
-+ SK_PACKET *pSkPacket;
-+ unsigned long Flags; /* for POP/PUSH macros */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2FreeRxBuffers (Port %c)\n", Port));
-+
-+ if (pAC->RxPort[Port].ReceivePacketTable != NULL) {
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_working, pSkPacket);
-+ while (pSkPacket != NULL) {
-+ if ((pSkPacket->pFrag) != NULL) {
-+ pci_unmap_page(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen - 2,
-+ PCI_DMA_FROMDEVICE);
-+
-+ /* wipe out any rubbish data that may interfere */
-+ skb_shinfo(pSkPacket->pMBuf)->nr_frags = 0;
-+ skb_shinfo(pSkPacket->pMBuf)->frag_list = NULL;
-+ DEV_KFREE_SKB_ANY(pSkPacket->pMBuf);
-+ pSkPacket->pMBuf = NULL;
-+ pSkPacket->pFrag->pPhys = (SK_U64) 0;
-+ pSkPacket->pFrag->pVirt = NULL;
-+ }
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pSkPacket);
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_working, pSkPacket);
-+ }
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2FreeRxBuffers\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2FreeTxBuffers - Free's any currently maintained Tx buffer
-+ *
-+ * Description:
-+ * This function frees the TX buffers of the Yukon2 for a single port
-+ * which might be in use by a transmit action
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2FreeTxBuffers (
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context */
-+int Port) /* port index of TX */
-+{
-+ SK_PACKET *pSkPacket;
-+ SK_FRAG *pSkFrag;
-+ unsigned long Flags;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2FreeTxBuffers (Port %c)\n", Port));
-+
-+ if (pAC->TxPort[Port][0].TransmitPacketTable != NULL) {
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->TxPort[Port][0].TxAQ_working, pSkPacket);
-+ while (pSkPacket != NULL) {
-+ if ((pSkFrag = pSkPacket->pFrag) != NULL) {
-+ UnmapAndFreeTxPktBuffer(pAC, pSkPacket, Port);
-+ }
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->TxPort[Port][0].TxQ_free, pSkPacket);
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->TxPort[Port][0].TxAQ_working, pSkPacket);
-+ }
-+#if USE_SYNC_TX_QUEUE
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->TxPort[Port][0].TxSQ_working, pSkPacket);
-+ while (pSkPacket != NULL) {
-+ if ((pSkFrag = pSkPacket->pFrag) != NULL) {
-+ UnmapAndFreeTxPktBuffer(pAC, pSkPacket, Port);
-+ }
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->TxPort[Port][0].TxQ_free, pSkPacket);
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->TxPort[Port][0].TxSQ_working, pSkPacket);
-+ }
-+#endif
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2FreeTxBuffers\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * SkY2Isr - handle a receive IRQ for all yukon2 cards
-+ *
-+ * Description:
-+ * This function is called when a receive IRQ is set. (only for yukon2)
-+ * HandleReceives does the deferred processing of all outstanding
-+ * interrupt operations.
-+ *
-+ * Returns: N/A
-+ */
-+SkIsrRetVar SkY2Isr (
-+int irq, /* the irq we have received (might be shared!) */
-+void *dev_id, /* current device id */
-+struct pt_regs *ptregs) /* not used by our driver */
-+{
-+ struct SK_NET_DEVICE *dev = (struct SK_NET_DEVICE *)dev_id;
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ SK_U32 IntSrc;
-+ unsigned long Flags;
-+#ifndef CONFIG_SK98LIN_NAPI
-+ SK_BOOL handledStatLE = SK_FALSE;
-+#else
-+ SK_BOOL SetIntMask = SK_FALSE;
-+#endif
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("==> SkY2Isr\n"));
-+
-+ SK_IN32(pAC->IoBase, B0_Y2_SP_ISRC2, &IntSrc);
-+
-+ if ((IntSrc == 0) && (!pNet->NetConsoleMode)){
-+ SK_OUT32(pAC->IoBase, B0_Y2_SP_ICR, 2);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("No Interrupt\n ==> SkY2Isr\n"));
-+ return SkIsrRetNone;
-+
-+ }
-+
-+#ifdef Y2_RECOVERY
-+ if (pNet->InRecover) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Already in recover\n ==> SkY2Isr\n"));
-+ SK_OUT32(pAC->IoBase, B0_Y2_SP_ICR, 2);
-+ return SkIsrRetNone;
-+ }
-+#endif
-+
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (netif_rx_schedule_prep(pAC->dev[0])) {
-+ pAC->GIni.GIValIrqMask &= ~(Y2_IS_STAT_BMU);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ SetIntMask = SK_TRUE;
-+ __netif_rx_schedule(pAC->dev[0]);
-+ }
-+
-+ if (netif_rx_schedule_prep(pAC->dev[1])) {
-+ if (!SetIntMask) {
-+ pAC->GIni.GIValIrqMask &= ~(Y2_IS_STAT_BMU);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ }
-+ __netif_rx_schedule(pAC->dev[1]);
-+ }
-+#else
-+ handledStatLE = HandleStatusLEs(pAC);
-+#endif
-+
-+ /*
-+ ** Check for Special Interrupts
-+ */
-+ if ((IntSrc & ~Y2_IS_STAT_BMU) || pAC->CheckQueue || pNet->TimerExpired) {
-+ pAC->CheckQueue = SK_FALSE;
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ SkGeSirqIsr(pAC, pAC->IoBase, IntSrc);
-+ SkEventDispatcher(pAC, pAC->IoBase);
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+ }
-+
-+ /* Speed enhancement for a2 chipsets */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_42)) {
-+ spin_lock_irqsave(&pAC->SetPutIndexLock, Flags);
-+ SkGeY2SetPutIndex(pAC, pAC->IoBase, Y2_PREF_Q_ADDR(Q_XA1,0), &pAC->TxPort[0][0].TxALET);
-+ SkGeY2SetPutIndex(pAC, pAC->IoBase, Y2_PREF_Q_ADDR(Q_R1,0), &pAC->RxPort[0].RxLET);
-+ spin_unlock_irqrestore(&pAC->SetPutIndexLock, Flags);
-+ }
-+
-+ /*
-+ ** Reenable interrupts and signal end of ISR
-+ */
-+ SK_OUT32(pAC->IoBase, B0_Y2_SP_ICR, 2);
-+
-+ /*
-+ ** Stop and restart TX timer in case a Status LE was handled
-+ */
-+#ifndef CONFIG_SK98LIN_NAPI
-+ if ((HW_FEATURE(pAC, HWF_WA_DEV_43_418)) && (handledStatLE)) {
-+ SK_OUT8(pAC->IoBase, STAT_TX_TIMER_CTRL, TIM_STOP);
-+ SK_OUT8(pAC->IoBase, STAT_TX_TIMER_CTRL, TIM_START);
-+ }
-+#endif
-+
-+ if (!(IS_Q_EMPTY(&(pAC->TxPort[0][TX_PRIO_LOW].TxAQ_waiting)))) {
-+ GiveTxBufferToHw(pAC, pAC->IoBase, 0);
-+ }
-+ if (!(IS_Q_EMPTY(&(pAC->TxPort[1][TX_PRIO_LOW].TxAQ_waiting)))) {
-+ GiveTxBufferToHw(pAC, pAC->IoBase, 1);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("<== SkY2Isr\n"));
-+
-+ return SkIsrRetHandled;
-+} /* SkY2Isr */
-+
-+/*****************************************************************************
-+ *
-+ * SkY2Xmit - Linux frame transmit function for Yukon2
-+ *
-+ * Description:
-+ * The system calls this function to send frames onto the wire.
-+ * It puts the frame in the tx descriptor ring. If the ring is
-+ * full then, the 'tbusy' flag is set.
-+ *
-+ * Returns:
-+ * 0, if everything is ok
-+ * !=0, on error
-+ *
-+ * WARNING:
-+ * returning 1 in 'tbusy' case caused system crashes (double
-+ * allocated skb's) !!!
-+ */
-+int SkY2Xmit(
-+struct sk_buff *skb, /* socket buffer to be sent */
-+struct SK_NET_DEVICE *dev) /* via which device? */
-+{
-+ DEV_NET *pNet = (DEV_NET*) dev->priv;
-+ SK_AC *pAC = pNet->pAC;
-+ SK_U8 FragIdx = 0;
-+ SK_PACKET *pSkPacket;
-+ SK_FRAG *PrevFrag;
-+ SK_FRAG *CurrFrag;
-+ SK_PKT_QUEUE *pWorkQueue; /* corresponding TX queue */
-+ SK_PKT_QUEUE *pWaitQueue;
-+ SK_PKT_QUEUE *pFreeQueue;
-+ SK_LE_TABLE *pLETab; /* corresponding LETable */
-+ skb_frag_t *sk_frag;
-+ SK_U64 PhysAddr;
-+ unsigned long Flags;
-+ unsigned int Port;
-+ int CurrFragCtr;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("==> SkY2Xmit\n"));
-+
-+ /*
-+ ** Get port and return if no free packet is available
-+ */
-+ if (skb_shinfo(skb)->nr_frags > MAX_SKB_FRAGS) {
-+ Port = skb_shinfo(skb)->nr_frags - (2*MAX_SKB_FRAGS);
-+ skb_shinfo(skb)->nr_frags = 0;
-+ } else {
-+ Port = (pAC->RlmtNets == 2) ? pNet->PortNr : pAC->ActivePort;
-+ }
-+
-+ if (IS_Q_EMPTY(&(pAC->TxPort[Port][TX_PRIO_LOW].TxQ_free))) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_TX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("Not free packets available for send\n"));
-+ return 1; /* zero bytes sent! */
-+ }
-+
-+ /*
-+ ** Put any new packet to be sent in the waiting queue and
-+ ** handle also any possible fragment of that packet.
-+ */
-+ pWorkQueue = &(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_working);
-+ pWaitQueue = &(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting);
-+ pFreeQueue = &(pAC->TxPort[Port][TX_PRIO_LOW].TxQ_free);
-+ pLETab = &(pAC->TxPort[Port][TX_PRIO_LOW].TxALET);
-+
-+ /*
-+ ** Normal send operations require only one fragment, because
-+ ** only one sk_buff data area is passed.
-+ ** In contradiction to this, scatter-gather (zerocopy) send
-+ ** operations might pass one or more additional fragments
-+ ** where each fragment needs a separate fragment info packet.
-+ */
-+ if (((skb_shinfo(skb)->nr_frags + 1) * MAX_FRAG_OVERHEAD) >
-+ NUM_FREE_LE_IN_TABLE(pLETab)) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_TX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("Not enough LE available for send\n"));
-+ return 1; /* zero bytes sent! */
-+ }
-+
-+ if ((skb_shinfo(skb)->nr_frags + 1) > MAX_NUM_FRAGS) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_TX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("Not even one fragment available for send\n"));
-+ return 1; /* zero bytes sent! */
-+ }
-+
-+ /*
-+ ** Get first packet from free packet queue
-+ */
-+ POP_FIRST_PKT_FROM_QUEUE(pFreeQueue, pSkPacket);
-+ if(pSkPacket == NULL) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_TX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("Could not obtain free packet used for xmit\n"));
-+ return 1; /* zero bytes sent! */
-+ }
-+
-+ pSkPacket->pFrag = &(pSkPacket->FragArray[FragIdx]);
-+
-+ /*
-+ ** map the sk_buff to be available for the adapter
-+ */
-+ PhysAddr = (SK_U64) pci_map_page(pAC->PciDev,
-+ virt_to_page(skb->data),
-+ ((unsigned long) skb->data & ~PAGE_MASK),
-+ skb_headlen(skb),
-+ PCI_DMA_TODEVICE);
-+ pSkPacket->pMBuf = skb;
-+ pSkPacket->pFrag->pPhys = PhysAddr;
-+ pSkPacket->pFrag->FragLen = skb_headlen(skb);
-+ pSkPacket->pFrag->pNext = NULL; /* initial has no next default */
-+ pSkPacket->NumFrags = skb_shinfo(skb)->nr_frags + 1;
-+
-+ PrevFrag = pSkPacket->pFrag;
-+
-+ /*
-+ ** Each scatter-gather fragment need to be mapped...
-+ */
-+ for ( CurrFragCtr = 0;
-+ CurrFragCtr < skb_shinfo(skb)->nr_frags;
-+ CurrFragCtr++) {
-+ FragIdx++;
-+ sk_frag = &skb_shinfo(skb)->frags[CurrFragCtr];
-+ CurrFrag = &(pSkPacket->FragArray[FragIdx]);
-+
-+ /*
-+ ** map the sk_buff to be available for the adapter
-+ */
-+ PhysAddr = (SK_U64) pci_map_page(pAC->PciDev,
-+ sk_frag->page,
-+ sk_frag->page_offset,
-+ sk_frag->size,
-+ PCI_DMA_TODEVICE);
-+
-+ CurrFrag->pPhys = PhysAddr;
-+ CurrFrag->FragLen = sk_frag->size;
-+ CurrFrag->pNext = NULL;
-+
-+ /*
-+ ** Add the new fragment to the list of fragments
-+ */
-+ PrevFrag->pNext = CurrFrag;
-+ PrevFrag = CurrFrag;
-+ }
-+
-+ /*
-+ ** Add packet to waiting packets queue
-+ */
-+ PUSH_PKT_AS_LAST_IN_QUEUE(pWaitQueue, pSkPacket);
-+ GiveTxBufferToHw(pAC, pAC->IoBase, Port);
-+ dev->trans_start = jiffies;
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("<== SkY2Xmit(return 0)\n"));
-+ return (0);
-+} /* SkY2Xmit */
-+
-+#ifdef CONFIG_SK98LIN_NAPI
-+/*****************************************************************************
-+ *
-+ * SkY2Poll - NAPI Rx polling callback for Yukon2 chipsets
-+ *
-+ * Description:
-+ * Called by the Linux system in case NAPI polling is activated
-+ *
-+ * Returns
-+ * The number of work data still to be handled
-+ *
-+ * Notes
-+ * The slowpath lock needs to be set because HW accesses may
-+ * interfere with slowpath events (e.g. TWSI)
-+ */
-+int SkY2Poll(
-+struct net_device *dev, /* device that needs to be polled */
-+int *budget) /* how many budget do we have? */
-+{
-+ SK_AC *pAC = ((DEV_NET*)(dev->priv))->pAC;
-+ int WorkToDo = min(*budget, dev->quota);
-+ int WorkDone = 0;
-+ SK_BOOL handledStatLE = SK_FALSE;
-+ unsigned long Flags;
-+
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ handledStatLE = HandleStatusLEs(pAC, &WorkDone, WorkToDo);
-+
-+ *budget -= WorkDone;
-+ dev->quota -= WorkDone;
-+
-+ if(WorkDone < WorkToDo) {
-+ netif_rx_complete(dev);
-+ pAC->GIni.GIValIrqMask |= (Y2_IS_STAT_BMU);
-+ SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask);
-+ if ((HW_FEATURE(pAC, HWF_WA_DEV_43_418)) && (handledStatLE)) {
-+ SK_OUT8(pAC->IoBase, STAT_TX_TIMER_CTRL, TIM_STOP);
-+ SK_OUT8(pAC->IoBase, STAT_TX_TIMER_CTRL, TIM_START);
-+ }
-+ }
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+ return (WorkDone >= WorkToDo);
-+} /* SkY2Poll */
-+#endif
-+
-+/******************************************************************************
-+ *
-+ * SkY2PortStop - stop a port on Yukon2
-+ *
-+ * Description:
-+ * This function stops a port of the Yukon2 chip. This stop
-+ * stop needs to be performed in a specific order:
-+ *
-+ * a) Stop the Prefetch unit
-+ * b) Stop the Port (MAC, PHY etc.)
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2PortStop(
-+SK_AC *pAC, /* adapter control context */
-+SK_IOC IoC, /* I/O control context (address of adapter registers) */
-+int Port, /* port to stop (MAC_1 + n) */
-+int Dir, /* StopDirection (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */
-+int RstMode) /* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2PortStop (Port %c)\n", 'A' + Port));
-+
-+ /*
-+ ** Stop the HW
-+ */
-+ SkGeStopPort(pAC, IoC, Port, Dir, RstMode);
-+
-+ /*
-+ ** Move any TX packet from work queues into the free queue again
-+ ** and initialize the TX LETable variables
-+ */
-+ SkY2FreeTxBuffers(pAC, pAC->IoBase, Port);
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Bmu.RxTx.TcpWp = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Bmu.RxTx.MssValue = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.BufHighAddr = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Done = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Put = 0;
-+ // pAC->GIni.GP[Port].PState = SK_PRT_STOP;
-+
-+ /*
-+ ** Move any RX packet from work queue into the waiting queue
-+ ** and initialize the RX LETable variables
-+ */
-+ SkY2FreeRxBuffers(pAC, pAC->IoBase, Port);
-+ pAC->RxPort[Port].RxLET.BufHighAddr = 0;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2PortStop()\n"));
-+}
-+
-+/******************************************************************************
-+ *
-+ * SkY2PortStart - start a port on Yukon2
-+ *
-+ * Description:
-+ * This function starts a port of the Yukon2 chip. This start
-+ * action needs to be performed in a specific order:
-+ *
-+ * a) Initialize the LET indices (PUT/GET to 0)
-+ * b) Initialize the LET in HW (enables also prefetch unit)
-+ * c) Move all RX buffers from waiting queue to working queue
-+ * which involves also setting up of RX list elements
-+ * d) Initialize the FIFO settings of Yukon2 (Watermark etc.)
-+ * e) Initialize the Port (MAC, PHY etc.)
-+ * f) Initialize the MC addresses
-+ *
-+ * Returns: N/A
-+ */
-+void SkY2PortStart(
-+SK_AC *pAC, /* adapter control context */
-+SK_IOC IoC, /* I/O control context (address of adapter registers) */
-+int Port) /* port to start */
-+{
-+ // SK_GEPORT *pPrt = &pAC->GIni.GP[Port];
-+ SK_HWLE *pLE;
-+ SK_U32 DWord;
-+ SK_U32 PrefetchReg; /* register for Put index */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> SkY2PortStart (Port %c)\n", 'A' + Port));
-+
-+ /*
-+ ** Initialize the LET indices
-+ */
-+ pAC->RxPort[Port].RxLET.Done = 0;
-+ pAC->RxPort[Port].RxLET.Put = 0;
-+ pAC->RxPort[Port].RxLET.HwPut = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Done = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.Put = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxALET.HwPut = 0;
-+ if (HW_SYNC_TX_SUPPORTED(pAC)) {
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSLET.Done = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSLET.Put = 0;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSLET.HwPut = 0;
-+ }
-+
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_420)) {
-+ /*
-+ ** It might be that we have to limit the RX buffers
-+ ** effectively passed to HW. Initialize the start
-+ ** value in that case...
-+ */
-+ NbrRxBuffersInHW = 0;
-+ }
-+
-+ /*
-+ ** TODO on dual net adapters we need to check if
-+ ** StatusLETable need to be set...
-+ **
-+ ** pAC->StatusLETable.Done = 0;
-+ ** pAC->StatusLETable.Put = 0;
-+ ** pAC->StatusLETable.HwPut = 0;
-+ ** SkGeY2InitPrefetchUnit(pAC, pAC->IoBase, Q_ST, &pAC->StatusLETable);
-+ */
-+
-+ /*
-+ ** Initialize the LET in HW (enables also prefetch unit)
-+ */
-+ SkGeY2InitPrefetchUnit(pAC, IoC,(Port == 0) ? Q_R1 : Q_R2,
-+ &pAC->RxPort[Port].RxLET);
-+ SkGeY2InitPrefetchUnit( pAC, IoC,(Port == 0) ? Q_XA1 : Q_XA2,
-+ &pAC->TxPort[Port][TX_PRIO_LOW].TxALET);
-+ if (HW_SYNC_TX_SUPPORTED(pAC)) {
-+ SkGeY2InitPrefetchUnit( pAC, IoC, (Port == 0) ? Q_XS1 : Q_XS2,
-+ &pAC->TxPort[Port][TX_PRIO_HIGH].TxSLET);
-+ }
-+
-+
-+ /*
-+ ** Using new values for the watermarks and the timer for
-+ ** low latency optimization
-+ */
-+ if (pAC->LowLatency) {
-+ SK_OUT8(IoC, STAT_FIFO_WM, 1);
-+ SK_OUT8(IoC, STAT_FIFO_ISR_WM, 1);
-+ SK_OUT32(IoC, STAT_LEV_TIMER_INI, 50);
-+ SK_OUT32(IoC, STAT_ISR_TIMER_INI, 10);
-+ }
-+
-+
-+ /*
-+ ** Initialize the Port (MAC, PHY etc.)
-+ */
-+ if (SkGeInitPort(pAC, IoC, Port)) {
-+ if (Port == 0) {
-+ printk("%s: SkGeInitPort A failed.\n",pAC->dev[0]->name);
-+ } else {
-+ printk("%s: SkGeInitPort B failed.\n",pAC->dev[1]->name);
-+ }
-+ }
-+
-+ if (IS_GMAC(pAC)) {
-+ /* disable Rx GMAC FIFO Flush Mode */
-+ SK_OUT8(IoC, MR_ADDR(Port, RX_GMF_CTRL_T), (SK_U8) GMF_RX_F_FL_OFF);
-+ }
-+
-+ /*
-+ ** Initialize the MC addresses
-+ */
-+ SkAddrMcUpdate(pAC,IoC, Port);
-+
-+ SkMacRxTxEnable(pAC, IoC,Port);
-+
-+ if (pAC->RxPort[Port].UseRxCsum) {
-+ SkGeRxCsum(pAC, IoC, Port, SK_TRUE);
-+
-+ GET_RX_LE(pLE, &pAC->RxPort[Port].RxLET);
-+ RXLE_SET_STACS1(pLE, pAC->CsOfs1);
-+ RXLE_SET_STACS2(pLE, pAC->CsOfs2);
-+ RXLE_SET_CTRL(pLE, 0);
-+
-+ RXLE_SET_OPC(pLE, OP_TCPSTART | HW_OWNER);
-+ FLUSH_OPC(pLE);
-+ if (Port == 0) {
-+ PrefetchReg=Y2_PREF_Q_ADDR(Q_R1,PREF_UNIT_PUT_IDX_REG);
-+ } else {
-+ PrefetchReg=Y2_PREF_Q_ADDR(Q_R2,PREF_UNIT_PUT_IDX_REG);
-+ }
-+ DWord = GET_PUT_IDX(&pAC->RxPort[Port].RxLET);
-+ SK_OUT32(IoC, PrefetchReg, DWord);
-+ UPDATE_HWPUT_IDX(&pAC->RxPort[Port].RxLET);
-+ }
-+
-+ pAC->GIni.GP[Port].PState = SK_PRT_RUN;
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== SkY2PortStart()\n"));
-+}
-+
-+/******************************************************************************
-+ *
-+ * Local Functions
-+ *
-+ *****************************************************************************/
-+
-+/*****************************************************************************
-+ *
-+ * InitPacketQueues - initialize SW settings of packet queues
-+ *
-+ * Description:
-+ * This function will initialize the packet queues for a port.
-+ *
-+ * Returns: N/A
-+ */
-+static void InitPacketQueues(
-+SK_AC *pAC, /* pointer to adapter control context */
-+int Port) /* index of port to be initialized */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("==> InitPacketQueues(Port %c)\n", 'A' + Port));
-+
-+ pAC->RxPort[Port].RxQ_working.pHead = NULL;
-+ pAC->RxPort[Port].RxQ_working.pTail = NULL;
-+ spin_lock_init(&pAC->RxPort[Port].RxQ_working.QueueLock);
-+
-+ pAC->RxPort[Port].RxQ_waiting.pHead = NULL;
-+ pAC->RxPort[Port].RxQ_waiting.pTail = NULL;
-+ spin_lock_init(&pAC->RxPort[Port].RxQ_waiting.QueueLock);
-+
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxQ_free.pHead = NULL;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxQ_free.pTail = NULL;
-+ spin_lock_init(&pAC->TxPort[Port][TX_PRIO_LOW].TxQ_free.QueueLock);
-+
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_working.pHead = NULL;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_working.pTail = NULL;
-+ spin_lock_init(&pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_working.QueueLock);
-+
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting.pHead = NULL;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting.pTail = NULL;
-+ spin_lock_init(&pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting.QueueLock);
-+
-+#if USE_SYNC_TX_QUEUE
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_working.pHead = NULL;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_working.pTail = NULL;
-+ spin_lock_init(&pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_working.QueueLock);
-+
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_waiting.pHead = NULL;
-+ pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_waiting.pTail = NULL;
-+ spin_lock_init(&pAC->TxPort[Port][TX_PRIO_LOW].TxSQ_waiting.QueueLock);
-+#endif
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("<== InitPacketQueues(Port %c)\n", 'A' + Port));
-+} /* InitPacketQueues */
-+
-+/*****************************************************************************
-+ *
-+ * GiveTxBufferToHw - commits a previously allocated DMA area to HW
-+ *
-+ * Description:
-+ * This functions gives transmit buffers to HW. If no list elements
-+ * are available the buffers will be queued.
-+ *
-+ * Notes:
-+ * This function can run only once in a system at one time.
-+ *
-+ * Returns: N/A
-+ */
-+static void GiveTxBufferToHw(
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context (address of registers) */
-+int Port) /* port index for which the buffer is used */
-+{
-+ SK_HWLE *pLE;
-+ SK_PACKET *pSkPacket;
-+ SK_FRAG *pFrag;
-+ SK_PKT_QUEUE *pWorkQueue; /* corresponding TX queue */
-+ SK_PKT_QUEUE *pWaitQueue;
-+ SK_LE_TABLE *pLETab; /* corresponding LETable */
-+ SK_BOOL SetOpcodePacketFlag;
-+ SK_U32 HighAddress;
-+ SK_U32 LowAddress;
-+ SK_U16 TcpSumStart;
-+ SK_U16 TcpSumWrite;
-+ SK_U8 OpCode;
-+ SK_U8 Ctrl;
-+ unsigned long Flags;
-+ unsigned long LockFlag;
-+ int Protocol;
-+#ifdef NETIF_F_TSO
-+ SK_U16 Mss;
-+ int TcpOptLen;
-+ int IpTcpLen;
-+#endif
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("==> GiveTxBufferToHw\n"));
-+
-+ if (IS_Q_EMPTY(&(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting))) {
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&pAC->TxQueueLock, LockFlag);
-+
-+ /*
-+ ** Initialize queue settings
-+ */
-+ pWorkQueue = &(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_working);
-+ pWaitQueue = &(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting);
-+ pLETab = &(pAC->TxPort[Port][TX_PRIO_LOW].TxALET);
-+
-+ POP_FIRST_PKT_FROM_QUEUE(pWaitQueue, pSkPacket);
-+ while (pSkPacket != NULL) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("\tWe have a packet to send %p\n", pSkPacket));
-+
-+ /*
-+ ** the first frag of a packet gets opcode OP_PACKET
-+ */
-+ SetOpcodePacketFlag = SK_TRUE;
-+ pFrag = pSkPacket->pFrag;
-+
-+ /*
-+ ** fill list elements with data from fragments
-+ */
-+ while (pFrag != NULL) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("\tGet LE\n"));
-+#ifdef NETIF_F_TSO
-+ Mss = skb_shinfo(pSkPacket->pMBuf)->tso_size;
-+ if (Mss) {
-+ TcpOptLen = ((pSkPacket->pMBuf->h.th->doff - 5) * 4);
-+ IpTcpLen = ((pSkPacket->pMBuf->nh.iph->ihl * 4) +
-+ sizeof(struct tcphdr));
-+ Mss += (TcpOptLen + IpTcpLen + C_LEN_ETHERMAC_HEADER);
-+ }
-+ if (pLETab->Bmu.RxTx.MssValue != Mss) {
-+ pLETab->Bmu.RxTx.MssValue = Mss;
-+ /* Take a new LE for TSO from the table */
-+ GET_TX_LE(pLE, pLETab);
-+
-+#if 0
-+ if(pSkPacket->VlanId) {
-+ TXLE_SET_OPC(pLE, OP_LRGLENVLAN | HW_OWNER);
-+ TXLE_SET_VLAN(pLE, pSkPacket->VlanId);
-+ pSkPacket->VlanId = 0;
-+ Ctrl |= INS_VLAN;
-+ } else {
-+#endif
-+ TXLE_SET_OPC(pLE, OP_LRGLEN | HW_OWNER);
-+#if 0
-+ }
-+#endif
-+ /* set maximum segment size for new packet */
-+ TXLE_SET_LSLEN(pLE, pLETab->Bmu.RxTx.MssValue);
-+ FLUSH_OPC(pLE) ;
-+ }
-+#endif
-+ GET_TX_LE(pLE, pLETab);
-+ Ctrl = 0;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("\tGot empty LE %p idx %d\n", pLE, GET_PUT_IDX(pLETab)));
-+
-+ SK_DBG_DUMP_TX_LE(pLE);
-+
-+ LowAddress = (SK_U32) (pFrag->pPhys & 0xffffffff);
-+ HighAddress = (SK_U32) (pFrag->pPhys >> 32);
-+
-+ if (HighAddress != pLETab->BufHighAddr) {
-+ /* set opcode high part of the address in one LE */
-+ OpCode = OP_ADDR64 | HW_OWNER;
-+
-+ /* Set now the 32 high bits of the address */
-+ TXLE_SET_ADDR( pLE, HighAddress);
-+
-+ /* Set the opcode into the LE */
-+ TXLE_SET_OPC(pLE, OpCode);
-+
-+ /* Flush the LE to memory */
-+ FLUSH_OPC(pLE);
-+
-+ /* remember the HighAddress we gave to the Hardware */
-+ pLETab->BufHighAddr = HighAddress;
-+
-+ /* get a new LE because we filled one with high address */
-+ GET_TX_LE(pLE, pLETab);
-+ }
-+
-+ /*
-+ ** TCP checksum offload
-+ */
-+ if ((pSkPacket->pMBuf->ip_summed == CHECKSUM_HW) &&
-+ (SetOpcodePacketFlag == SK_TRUE)) {
-+ Protocol = ((SK_U8)pSkPacket->pMBuf->data[C_OFFSET_IPPROTO] & 0xff);
-+ /* if (Protocol & C_PROTO_ID_IP) { Ctrl = 0; } */
-+ if (Protocol & C_PROTO_ID_TCP) {
-+ Ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
-+ /* TCP Checksum Calculation Start Position */
-+ TcpSumStart = C_LEN_ETHERMAC_HEADER + IP_HDR_LEN;
-+ /* TCP Checksum Write Position */
-+ TcpSumWrite = TcpSumStart + TCP_CSUM_OFFS;
-+ } else {
-+ Ctrl = UDPTCP | CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
-+ /* TCP Checksum Calculation Start Position */
-+ TcpSumStart = ETHER_MAC_HDR_LEN + IP_HDR_LEN;
-+ /* UDP Checksum Write Position */
-+ TcpSumWrite = TcpSumStart + UDP_CSUM_OFFS;
-+ }
-+
-+ if ((Ctrl) && (pLETab->Bmu.RxTx.TcpWp != TcpSumWrite)) {
-+ /* Update the last value of the write position */
-+ pLETab->Bmu.RxTx.TcpWp = TcpSumWrite;
-+
-+ /* Set the Lock field for this LE: */
-+ /* Checksum calculation for one packet only */
-+ TXLE_SET_LCKCS(pLE, 1);
-+
-+ /* Set the start position for checksum. */
-+ TXLE_SET_STACS(pLE, TcpSumStart);
-+
-+ /* Set the position where the checksum will be writen */
-+ TXLE_SET_WRICS(pLE, TcpSumWrite);
-+
-+ /* Set the initial value for checksum */
-+ /* PseudoHeader CS passed from Linux -> 0! */
-+ TXLE_SET_INICS(pLE, 0);
-+
-+ /* Set the opcode for tcp checksum */
-+ TXLE_SET_OPC(pLE, OP_TCPLISW | HW_OWNER);
-+
-+ /* Flush the LE to memory */
-+ FLUSH_OPC(pLE);
-+
-+ /* get a new LE because we filled one with data for checksum */
-+ GET_TX_LE(pLE, pLETab);
-+ }
-+ } /* end TCP offload handling */
-+
-+ TXLE_SET_ADDR(pLE, LowAddress);
-+ TXLE_SET_LEN(pLE, pFrag->FragLen);
-+
-+ if (SetOpcodePacketFlag){
-+#ifdef NETIF_F_TSO
-+ if (Mss) {
-+ OpCode = OP_LARGESEND | HW_OWNER;
-+ } else {
-+#endif
-+ OpCode = OP_PACKET| HW_OWNER;
-+#ifdef NETIF_F_TSO
-+ }
-+#endif
-+ SetOpcodePacketFlag = SK_FALSE;
-+ } else {
-+ /* Follow packet in a sequence has always OP_BUFFER */
-+ OpCode = OP_BUFFER | HW_OWNER;
-+ }
-+
-+ /* Check if the low address is near the upper limit. */
-+ CHECK_LOW_ADDRESS(pLETab->BufHighAddr, LowAddress, pFrag->FragLen);
-+
-+ pFrag = pFrag->pNext;
-+ if (pFrag == NULL) {
-+ /* mark last fragment */
-+ Ctrl |= EOP;
-+ }
-+ TXLE_SET_CTRL(pLE, Ctrl);
-+ TXLE_SET_OPC(pLE, OpCode);
-+ FLUSH_OPC(pLE);
-+
-+ SK_DBG_DUMP_TX_LE(pLE);
-+ }
-+
-+ /*
-+ ** Remember next LE for tx complete
-+ */
-+ pSkPacket->NextLE = GET_PUT_IDX(pLETab);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("\tNext LE for pkt %p is %d\n", pSkPacket, pSkPacket->NextLE));
-+
-+ /*
-+ ** Add packet to working packets queue
-+ */
-+ PUSH_PKT_AS_LAST_IN_QUEUE(pWorkQueue, pSkPacket);
-+
-+ /*
-+ ** give transmit start command
-+ */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_42)) {
-+ spin_lock(&pAC->SetPutIndexLock);
-+ SkGeY2SetPutIndex(pAC, pAC->IoBase, Y2_PREF_Q_ADDR(Q_XA1,0), &pAC->TxPort[0][0].TxALET);
-+ spin_unlock(&pAC->SetPutIndexLock);
-+ } else {
-+ /* write put index */
-+ if (Port == 0) {
-+ SK_OUT32(pAC->IoBase,
-+ Y2_PREF_Q_ADDR(Q_XA1,PREF_UNIT_PUT_IDX_REG),
-+ GET_PUT_IDX(&pAC->TxPort[0][0].TxALET));
-+ UPDATE_HWPUT_IDX(&pAC->TxPort[0][0].TxALET);
-+ } else {
-+ SK_OUT32(pAC->IoBase,
-+ Y2_PREF_Q_ADDR(Q_XA2, PREF_UNIT_PUT_IDX_REG),
-+ GET_PUT_IDX(&pAC->TxPort[1][0].TxALET));
-+ UPDATE_HWPUT_IDX(&pAC->TxPort[1][0].TxALET);
-+ }
-+ }
-+
-+ if (IS_Q_EMPTY(&(pAC->TxPort[Port][TX_PRIO_LOW].TxAQ_waiting))) {
-+ break; /* get out of while */
-+ }
-+ POP_FIRST_PKT_FROM_QUEUE(pWaitQueue, pSkPacket);
-+ } /* while (pSkPacket != NULL) */
-+
-+ spin_unlock_irqrestore(&pAC->TxQueueLock, LockFlag);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("<== GiveTxBufferToHw\n"));
-+ return;
-+} /* GiveTxBufferToHw */
-+
-+/***********************************************************************
-+ *
-+ * GiveRxBufferToHw - commits a previously allocated DMA area to HW
-+ *
-+ * Description:
-+ * This functions gives receive buffers to HW. If no list elements
-+ * are available the buffers will be queued.
-+ *
-+ * Notes:
-+ * This function can run only once in a system at one time.
-+ *
-+ * Returns: N/A
-+ */
-+static void GiveRxBufferToHw(
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context (address of registers) */
-+int Port, /* port index for which the buffer is used */
-+SK_PACKET *pPacket) /* receive buffer(s) */
-+{
-+ SK_HWLE *pLE;
-+ SK_LE_TABLE *pLETab;
-+ SK_BOOL Done = SK_FALSE; /* at least on LE changed? */
-+ SK_U32 LowAddress;
-+ SK_U32 HighAddress;
-+ SK_U32 PrefetchReg; /* register for Put index */
-+ unsigned NumFree;
-+ unsigned Required;
-+ unsigned long Flags;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("==> GiveRxBufferToHw(Port %c, Packet %p)\n", 'A' + Port, pPacket));
-+
-+ pLETab = &pAC->RxPort[Port].RxLET;
-+
-+ if (Port == 0) {
-+ PrefetchReg = Y2_PREF_Q_ADDR(Q_R1, PREF_UNIT_PUT_IDX_REG);
-+ } else {
-+ PrefetchReg = Y2_PREF_Q_ADDR(Q_R2, PREF_UNIT_PUT_IDX_REG);
-+ }
-+
-+ if (pPacket != NULL) {
-+ /*
-+ ** For the time being, we have only one packet passed
-+ ** to this function which might be changed in future!
-+ */
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ }
-+
-+ /*
-+ ** now pPacket contains the very first waiting packet
-+ */
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ while (pPacket != NULL) {
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_420)) {
-+ if (NbrRxBuffersInHW >= MAX_NBR_RX_BUFFERS_IN_HW) {
-+ PUSH_PKT_AS_FIRST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== GiveRxBufferToHw()\n"));
-+ return;
-+ }
-+ NbrRxBuffersInHW++;
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("Try to add packet %p\n", pPacket));
-+
-+ /*
-+ ** Check whether we have enough listelements:
-+ **
-+ ** we have to take into account that each fragment
-+ ** may need an additional list element for the high
-+ ** part of the address here I simplified it by
-+ ** using MAX_FRAG_OVERHEAD maybe it's worth to split
-+ ** this constant for Rx and Tx or to calculate the
-+ ** real number of needed LE's
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tNum %d Put %d Done %d Free %d %d\n",
-+ pLETab->Num, pLETab->Put, pLETab->Done,
-+ NUM_FREE_LE_IN_TABLE(pLETab),
-+ (NUM_FREE_LE_IN_TABLE(pLETab))));
-+
-+ Required = pPacket->NumFrags + MAX_FRAG_OVERHEAD;
-+ NumFree = NUM_FREE_LE_IN_TABLE(pLETab);
-+ if (NumFree) {
-+ NumFree--;
-+ }
-+
-+ if (Required > NumFree ) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("\tOut of LEs have %d need %d\n",
-+ NumFree, Required));
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tWaitQueue starts with packet %p\n", pPacket));
-+ PUSH_PKT_AS_FIRST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ if (Done) {
-+ /*
-+ ** write Put index to BMU or Polling Unit and make the LE's
-+ ** available for the hardware
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tWrite new Put Idx\n"));
-+
-+ SK_OUT32(IoC, PrefetchReg, GET_PUT_IDX(pLETab));
-+ UPDATE_HWPUT_IDX(pLETab);
-+ }
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== GiveRxBufferToHw()\n"));
-+ return;
-+ } else {
-+ if (!AllocAndMapRxBuffer(pAC, pPacket, Port)) {
-+ /*
-+ ** Failure while allocating sk_buff might
-+ ** be due to temporary short of resources
-+ ** Maybe next time buffers are available.
-+ ** Until this, the packet remains in the
-+ ** RX waiting queue...
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("Failed to allocate Rx buffer\n"));
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("WaitQueue starts with packet %p\n", pPacket));
-+ PUSH_PKT_AS_FIRST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ if (Done) {
-+ /*
-+ ** write Put index to BMU or Polling
-+ ** Unit and make the LE's
-+ ** available for the hardware
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tWrite new Put Idx\n"));
-+
-+ SK_OUT32(IoC, PrefetchReg, GET_PUT_IDX(pLETab));
-+ UPDATE_HWPUT_IDX(pLETab);
-+ }
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== GiveRxBufferToHw()\n"));
-+ return;
-+ }
-+ }
-+ Done = SK_TRUE;
-+
-+ LowAddress = (SK_U32) (pPacket->pFrag->pPhys & 0xffffffff);
-+ HighAddress = (SK_U32) (pPacket->pFrag->pPhys >> 32);
-+ if (HighAddress != pLETab->BufHighAddr) {
-+ /* get a new LE for high address */
-+ GET_RX_LE(pLE, pLETab);
-+
-+ /* Set now the 32 high bits of the address */
-+ RXLE_SET_ADDR(pLE, HighAddress);
-+
-+ /* Set the control bits of the address */
-+ RXLE_SET_CTRL(pLE, 0);
-+
-+ /* Set the opcode into the LE */
-+ RXLE_SET_OPC(pLE, (OP_ADDR64 | HW_OWNER));
-+
-+ /* Flush the LE to memory */
-+ FLUSH_OPC(pLE);
-+
-+ /* remember the HighAddress we gave to the Hardware */
-+ pLETab->BufHighAddr = HighAddress;
-+ }
-+
-+ /*
-+ ** Fill data into listelement
-+ */
-+ GET_RX_LE(pLE, pLETab);
-+ RXLE_SET_ADDR(pLE, LowAddress);
-+ RXLE_SET_LEN(pLE, pPacket->pFrag->FragLen);
-+ RXLE_SET_CTRL(pLE, 0);
-+ RXLE_SET_OPC(pLE, (OP_PACKET | HW_OWNER));
-+ FLUSH_OPC(pLE);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("=== LE filled\n"));
-+
-+ SK_DBG_DUMP_RX_LE(pLE);
-+
-+ /*
-+ ** Remember next LE for rx complete
-+ */
-+ pPacket->NextLE = GET_PUT_IDX(pLETab);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tPackets Next LE is %d\n", pPacket->NextLE));
-+
-+ /*
-+ ** Add packet to working receive buffer queue and get
-+ ** any next packet out of the waiting queue
-+ */
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_working, pPacket);
-+ if (IS_Q_EMPTY(&(pAC->RxPort[Port].RxQ_waiting))) {
-+ break; /* get out of while processing */
-+ }
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pPacket);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tWaitQueue is empty\n"));
-+
-+ if (Done) {
-+ /*
-+ ** write Put index to BMU or Polling Unit and make the LE's
-+ ** available for the hardware
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("\tWrite new Put Idx\n"));
-+
-+ /* Speed enhancement for a2 chipsets */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_42)) {
-+ spin_lock_irqsave(&pAC->SetPutIndexLock, Flags);
-+ SkGeY2SetPutIndex(pAC, pAC->IoBase, Y2_PREF_Q_ADDR(Q_R1,0), pLETab);
-+ spin_unlock_irqrestore(&pAC->SetPutIndexLock, Flags);
-+ } else {
-+ /* write put index */
-+ if (Port == 0) {
-+ SK_OUT32(IoC,
-+ Y2_PREF_Q_ADDR(Q_R1, PREF_UNIT_PUT_IDX_REG),
-+ GET_PUT_IDX(pLETab));
-+ } else {
-+ SK_OUT32(IoC,
-+ Y2_PREF_Q_ADDR(Q_R2, PREF_UNIT_PUT_IDX_REG),
-+ GET_PUT_IDX(pLETab));
-+ }
-+
-+ /* Update put index */
-+ UPDATE_HWPUT_IDX(pLETab);
-+ }
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== GiveRxBufferToHw()\n"));
-+} /* GiveRxBufferToHw */
-+
-+/***********************************************************************
-+ *
-+ * FillReceiveTableYukon2 - map any waiting RX buffers to HW
-+ *
-+ * Description:
-+ * If the list element table contains more empty elements than
-+ * specified this function tries to refill them.
-+ *
-+ * Notes:
-+ * This function can run only once per port in a system at one time.
-+ *
-+ * Returns: N/A
-+ */
-+void FillReceiveTableYukon2(
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context */
-+int Port) /* port index of RX */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("==> FillReceiveTableYukon2 (Port %c)\n", 'A' + Port));
-+
-+ if (NUM_FREE_LE_IN_TABLE(&pAC->RxPort[Port].RxLET) >
-+ pAC->MaxUnusedRxLeWorking) {
-+
-+ /*
-+ ** Give alle waiting receive buffers down
-+ ** The queue holds all RX packets that
-+ ** need a fresh allocation of the sk_buff.
-+ */
-+ if (pAC->RxPort[Port].RxQ_waiting.pHead != NULL) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("Waiting queue is not empty -> give it to HW"));
-+ GiveRxBufferToHw(pAC, IoC, Port, NULL);
-+ }
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== FillReceiveTableYukon2 ()\n"));
-+} /* FillReceiveTableYukon2 */
-+
-+/******************************************************************************
-+ *
-+ *
-+ * HandleReceives - will pass any ready RX packet to kernel
-+ *
-+ * Description:
-+ * This functions handles a received packet. It checks wether it is
-+ * valid, updates the receive list element table and gives the receive
-+ * buffer to Linux
-+ *
-+ * Notes:
-+ * This function can run only once per port at one time in the system.
-+ *
-+ * Returns: N/A
-+ */
-+static SK_BOOL HandleReceives(
-+SK_AC *pAC, /* adapter control context */
-+int Port, /* port on which a packet has been received */
-+SK_U16 Len, /* number of bytes which was actually received */
-+SK_U32 FrameStatus, /* MAC frame status word */
-+SK_U16 Tcp1, /* first hw checksum */
-+SK_U16 Tcp2, /* second hw checksum */
-+SK_U32 Tist, /* timestamp */
-+SK_U16 Vlan) /* Vlan Id */
-+{
-+
-+ SK_PACKET *pSkPacket;
-+ SK_LE_TABLE *pLETab;
-+ SK_MBUF *pRlmtMbuf; /* buffer for giving RLMT frame */
-+ struct sk_buff *pMsg; /* ptr to message holding frame */
-+#ifdef __ia64__
-+ struct sk_buff *pNewMsg; /* used when IP aligning */
-+#endif
-+
-+#ifdef CONFIG_SK98LIN_NAPI
-+ SK_BOOL SlowPathLock = SK_FALSE;
-+#else
-+ SK_BOOL SlowPathLock = SK_TRUE;
-+#endif
-+ SK_BOOL IsGoodPkt;
-+ SK_BOOL IsBc;
-+ SK_BOOL IsMc;
-+ SK_EVPARA EvPara; /* an event parameter union */
-+ SK_I16 LenToFree; /* must be signed integer */
-+
-+ unsigned long Flags; /* for spin lock */
-+ unsigned int RlmtNotifier;
-+ unsigned short Type;
-+ int IpFrameLength;
-+ int FrameLength; /* total length of recvd frame */
-+ int HeaderLength;
-+ int NumBytes;
-+ int Result;
-+ int Offset = 0;
-+
-+#ifdef Y2_SYNC_CHECK
-+ SK_U16 MyTcp;
-+#endif
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("==> HandleReceives (Port %c)\n", 'A' + Port));
-+
-+ /*
-+ ** initialize vars for selected port
-+ */
-+ pLETab = &pAC->RxPort[Port].RxLET;
-+
-+ /*
-+ ** check whether we want to receive this packet
-+ */
-+ SK_Y2_RXSTAT_CHECK_PKT(Len, FrameStatus, IsGoodPkt);
-+
-+ /*
-+ ** Remember length to free (in case of RxBuffer overruns;
-+ ** unlikely, but might happen once in a while)
-+ */
-+ LenToFree = (SK_I16) Len;
-+
-+ /*
-+ ** maybe we put these two checks into the SK_RXDESC_CHECK_PKT macro too
-+ */
-+ if (Len > pAC->RxPort[Port].RxBufSize) {
-+ IsGoodPkt = SK_FALSE;
-+ }
-+
-+ /*
-+ ** take first receive buffer out of working queue
-+ */
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_working, pSkPacket);
-+ if (pSkPacket == NULL) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_ERROR,
-+ ("Packet not available. NULL pointer.\n"));
-+ return(SK_TRUE);
-+ }
-+
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_420)) {
-+ NbrRxBuffersInHW--;
-+ }
-+
-+ /*
-+ ** Verify the received length of the frame! Note that having
-+ ** multiple RxBuffers being aware of one single receive packet
-+ ** (one packet spread over multiple RxBuffers) is not supported
-+ ** by this driver!
-+ */
-+ if ((Len > pAC->RxPort[Port].RxBufSize) ||
-+ (Len > (SK_U16) pSkPacket->PacketLen)) {
-+ IsGoodPkt = SK_FALSE;
-+ }
-+
-+ /*
-+ ** Reset own bit in LE's between old and new Done index
-+ ** This is not really necessary but makes debugging easier
-+ */
-+ CLEAR_LE_OWN_FROM_DONE_TO(pLETab, pSkPacket->NextLE);
-+
-+ /*
-+ ** Free the list elements for new Rx buffers
-+ */
-+ SET_DONE_INDEX(pLETab, pSkPacket->NextLE);
-+ pMsg = pSkPacket->pMBuf;
-+ FrameLength = Len;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("Received frame of length %d on port %d\n",FrameLength, Port));
-+
-+ if (!IsGoodPkt) {
-+ /*
-+ ** release the DMA mapping
-+ */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
-+ pci_dma_sync_single(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+
-+#else
-+ pci_dma_sync_single_for_cpu(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+#endif
-+
-+ DEV_KFREE_SKB_ANY(pSkPacket->pMBuf);
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pSkPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== HandleReceives (Port %c)\n", 'A' + Port));
-+
-+ /*
-+ ** Sanity check for RxBuffer overruns...
-+ */
-+ LenToFree = LenToFree - (pSkPacket->pFrag->FragLen);
-+ while (LenToFree > 0) {
-+ POP_FIRST_PKT_FROM_QUEUE(&pAC->RxPort[Port].RxQ_working, pSkPacket);
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_420)) {
-+ NbrRxBuffersInHW--;
-+ }
-+ CLEAR_LE_OWN_FROM_DONE_TO(pLETab, pSkPacket->NextLE);
-+ SET_DONE_INDEX(pLETab, pSkPacket->NextLE);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
-+ pci_dma_sync_single(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+#else
-+ pci_dma_sync_single_for_device(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+#endif
-+
-+ DEV_KFREE_SKB_ANY(pSkPacket->pMBuf);
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pSkPacket);
-+ LenToFree = LenToFree - ((SK_I16)(pSkPacket->pFrag->FragLen));
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("<==HandleReceives (Port %c) drop faulty len pkt(2)\n",'A'+Port));
-+ }
-+ return(SK_TRUE);
-+ } else {
-+ /*
-+ ** Release the DMA mapping
-+ */
-+ pci_unmap_single(pAC->PciDev,
-+ pSkPacket->pFrag->pPhys,
-+ pAC->RxPort[Port].RxBufSize,
-+ PCI_DMA_FROMDEVICE);
-+
-+ skb_put(pMsg, FrameLength); /* set message len */
-+ pMsg->ip_summed = CHECKSUM_NONE; /* initial default */
-+
-+#ifdef Y2_SYNC_CHECK
-+ pAC->FramesWithoutSyncCheck++;
-+ if (pAC->FramesWithoutSyncCheck > Y2_RESYNC_WATERMARK) {
-+ if ((Tcp1 != 1) || (Tcp2 != 0)) {
-+ pAC->FramesWithoutSyncCheck = 0;
-+ MyTcp = (SK_U16) SkCsCalculateChecksum(
-+ &pMsg->data[14],
-+ FrameLength - 14);
-+ if (MyTcp != Tcp1) {
-+ /* Queue port reset event */
-+ SkLocalEventQueue(pAC, SKGE_DRV,
-+ SK_DRV_RECOVER,Port,-1,SK_FALSE);
-+ }
-+ }
-+ }
-+#endif
-+
-+ if (pAC->RxPort[Port].UseRxCsum) {
-+ Type = ntohs(*((short*)&pMsg->data[12]));
-+ if (Type == 0x800) {
-+ *((char *)&(IpFrameLength)) = pMsg->data[16];
-+ *(((char *)&(IpFrameLength))+1) = pMsg->data[17];
-+ IpFrameLength = ntohs(IpFrameLength);
-+ HeaderLength = FrameLength - IpFrameLength;
-+ if (HeaderLength == 0xe) {
-+ Result =
-+ SkCsGetReceiveInfo(pAC,&pMsg->data[14],Tcp1,Tcp2, Port);
-+ if ((Result == SKCS_STATUS_IP_FRAGMENT) ||
-+ (Result == SKCS_STATUS_IP_CSUM_OK) ||
-+ (Result == SKCS_STATUS_TCP_CSUM_OK) ||
-+ (Result == SKCS_STATUS_UDP_CSUM_OK)) {
-+ pMsg->ip_summed = CHECKSUM_UNNECESSARY;
-+ } else if ((Result == SKCS_STATUS_TCP_CSUM_ERROR) ||
-+ (Result == SKCS_STATUS_UDP_CSUM_ERROR) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR_UDP) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR_TCP) ||
-+ (Result == SKCS_STATUS_IP_CSUM_ERROR)) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("skge: CRC error. Frame dropped!\n"));
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pSkPacket);
-+ SK_DBG_MSG(pAC,SK_DBGMOD_DRV,SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<==HandleReceives(Port %c)\n",'A'+Port));
-+ return(SK_TRUE);
-+ } else {
-+ pMsg->ip_summed = CHECKSUM_NONE;
-+ }
-+ } /* end if (HeaderLength == valid) */
-+ } /* end if (Type == 0x800) -> IP frame */
-+ } /* end if (pRxPort->UseRxCsum) */
-+
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("V"));
-+ RlmtNotifier = SK_RLMT_RX_PROTOCOL;
-+
-+ IsBc = (FrameStatus & GMR_FS_BC) ? SK_TRUE : SK_FALSE;
-+ SK_RLMT_PRE_LOOKAHEAD(pAC,Port,FrameLength,
-+ IsBc,&Offset,&NumBytes);
-+ if (NumBytes != 0) {
-+ IsMc = (FrameStatus & GMR_FS_MC) ? SK_TRUE : SK_FALSE;
-+ SK_RLMT_LOOKAHEAD(pAC,Port,&pMsg->data[Offset],
-+ IsBc,IsMc,&RlmtNotifier);
-+ }
-+
-+ if (RlmtNotifier == SK_RLMT_RX_PROTOCOL) {
-+ SK_DBG_MSG(NULL,SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("W"));
-+ if ((Port == pAC->ActivePort)||(pAC->RlmtNets == 2)) {
-+ /* send up only frames from active port */
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("U"));
-+#ifdef xDEBUG
-+ DumpMsg(pMsg, "Rx");
-+#endif
-+ SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,
-+ FrameLength, Port);
-+#ifdef __ia64__
-+ pNewMsg = alloc_skb(pMsg->len, GFP_ATOMIC);
-+ skb_reserve(pNewMsg, 2); /* to align IP */
-+ SK_MEMCPY(pNewMsg->data,pMsg->data,pMsg->len);
-+ pNewMsg->ip_summed = pMsg->ip_summed;
-+ skb_put(pNewMsg, pMsg->len);
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ pMsg = pNewMsg;
-+#endif
-+ pMsg->dev = pAC->dev[Port];
-+ pMsg->protocol = eth_type_trans(pMsg,
-+ pAC->dev[Port]);
-+ netif_rx(pMsg);
-+ pAC->dev[Port]->last_rx = jiffies;
-+ } else { /* drop frame */
-+ SK_DBG_MSG(NULL,SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("D"));
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ }
-+ } else { /* This is an RLMT-packet! */
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("R"));
-+ pRlmtMbuf = SkDrvAllocRlmtMbuf(pAC,
-+ pAC->IoBase, FrameLength);
-+ if (pRlmtMbuf != NULL) {
-+ pRlmtMbuf->pNext = NULL;
-+ pRlmtMbuf->Length = FrameLength;
-+ pRlmtMbuf->PortIdx = Port;
-+ EvPara.pParaPtr = pRlmtMbuf;
-+ SK_MEMCPY((char*)(pRlmtMbuf->pData),
-+ (char*)(pMsg->data),FrameLength);
-+
-+ if (SlowPathLock == SK_TRUE) {
-+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
-+ SkEventQueue(pAC, SKGE_RLMT,
-+ SK_RLMT_PACKET_RECEIVED,
-+ EvPara);
-+ pAC->CheckQueue = SK_TRUE;
-+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-+ } else {
-+ SkEventQueue(pAC, SKGE_RLMT,
-+ SK_RLMT_PACKET_RECEIVED,
-+ EvPara);
-+ pAC->CheckQueue = SK_TRUE;
-+ }
-+
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS,("Q"));
-+ }
-+ if (pAC->dev[Port]->flags & (IFF_PROMISC | IFF_ALLMULTI)) {
-+#ifdef __ia64__
-+ pNewMsg = alloc_skb(pMsg->len, GFP_ATOMIC);
-+ skb_reserve(pNewMsg, 2); /* to align IP */
-+ SK_MEMCPY(pNewMsg->data,pMsg->data,pMsg->len);
-+ pNewMsg->ip_summed = pMsg->ip_summed;
-+ pNewMsg->len = pMsg->len;
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ pMsg = pNewMsg;
-+#endif
-+ pMsg->dev = pAC->dev[Port];
-+ pMsg->protocol = eth_type_trans(pMsg,pAC->dev[Port]);
-+ netif_rx(pMsg);
-+ pAC->dev[Port]->last_rx = jiffies;
-+ } else {
-+ DEV_KFREE_SKB_ANY(pMsg);
-+ }
-+ } /* if packet for rlmt */
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[Port].RxQ_waiting, pSkPacket);
-+ } /* end if-else (IsGoodPkt) */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<== HandleReceives (Port %c)\n", 'A' + Port));
-+ return(SK_TRUE);
-+
-+} /* HandleReceives */
-+
-+/***********************************************************************
-+ *
-+ * CheckForSendComplete - Frees any freeable Tx bufffer
-+ *
-+ * Description:
-+ * This function checks the queues of a port for completed send
-+ * packets and returns these packets back to the OS.
-+ *
-+ * Notes:
-+ * This function can run simultaneously for both ports if
-+ * the OS function OSReturnPacket() can handle this,
-+ *
-+ * Such a send complete does not mean, that the packet is really
-+ * out on the wire. We just know that the adapter has copied it
-+ * into its internal memory and the buffer in the systems memory
-+ * is no longer needed.
-+ *
-+ * Returns: N/A
-+ */
-+static void CheckForSendComplete(
-+SK_AC *pAC, /* pointer to adapter control context */
-+SK_IOC IoC, /* I/O control context */
-+int Port, /* port index */
-+SK_PKT_QUEUE *pPQ, /* tx working packet queue to check */
-+SK_LE_TABLE *pLETab, /* corresponding list element table */
-+unsigned int Done) /* done index reported for this LET */
-+{
-+ SK_PACKET *pSkPacket;
-+ SK_PKT_QUEUE SendCmplPktQ = { NULL, NULL, SPIN_LOCK_UNLOCKED };
-+ SK_BOOL DoWakeQueue = SK_FALSE;
-+ unsigned long Flags;
-+ unsigned Put;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("==> CheckForSendComplete(Port %c)\n", 'A' + Port));
-+
-+ /*
-+ ** Reset own bit in LE's between old and new Done index
-+ ** This is not really necessairy but makes debugging easier
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Clear Own Bits in TxTable from %d to %d\n",
-+ pLETab->Done, (Done == 0) ?
-+ NUM_LE_IN_TABLE(pLETab) :
-+ (Done - 1)));
-+
-+ spin_lock_irqsave(&(pPQ->QueueLock), Flags);
-+
-+ CLEAR_LE_OWN_FROM_DONE_TO(pLETab, Done);
-+
-+ Put = GET_PUT_IDX(pLETab);
-+
-+ /*
-+ ** Check whether some packets have been completed
-+ */
-+ PLAIN_POP_FIRST_PKT_FROM_QUEUE(pPQ, pSkPacket);
-+ while (pSkPacket != NULL) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Check Completion of Tx packet %p\n", pSkPacket));
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Put %d NewDone %d NextLe of Packet %d\n", Put, Done,
-+ pSkPacket->NextLE));
-+
-+ if ((Put > Done) &&
-+ ((pSkPacket->NextLE > Put) || (pSkPacket->NextLE <= Done))) {
-+ PLAIN_PUSH_PKT_AS_LAST_IN_QUEUE(&SendCmplPktQ, pSkPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Packet finished (a)\n"));
-+ } else if ((Done > Put) &&
-+ (pSkPacket->NextLE > Put) && (pSkPacket->NextLE <= Done)) {
-+ PLAIN_PUSH_PKT_AS_LAST_IN_QUEUE(&SendCmplPktQ, pSkPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Packet finished (b)\n"));
-+ } else if ((Done == TXA_MAX_LE-1) && (Put == 0) && (pSkPacket->NextLE == 0)) {
-+ PLAIN_PUSH_PKT_AS_LAST_IN_QUEUE(&SendCmplPktQ, pSkPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Packet finished (b)\n"));
-+ DoWakeQueue = SK_TRUE;
-+ } else if (Done == Put) {
-+ /* all packets have been sent */
-+ PLAIN_PUSH_PKT_AS_LAST_IN_QUEUE(&SendCmplPktQ, pSkPacket);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Packet finished (c)\n"));
-+ } else {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("Packet not yet finished\n"));
-+ PLAIN_PUSH_PKT_AS_FIRST_IN_QUEUE(pPQ, pSkPacket);
-+ break;
-+ }
-+ PLAIN_POP_FIRST_PKT_FROM_QUEUE(pPQ, pSkPacket);
-+ }
-+ spin_unlock_irqrestore(&(pPQ->QueueLock), Flags);
-+
-+ /*
-+ ** Set new done index in list element table
-+ */
-+ SET_DONE_INDEX(pLETab, Done);
-+
-+ /*
-+ ** All TX packets that are send complete should be added to
-+ ** the free queue again for new sents to come
-+ */
-+ pSkPacket = SendCmplPktQ.pHead;
-+ while (pSkPacket != NULL) {
-+ while (pSkPacket->pFrag != NULL) {
-+ pci_unmap_page(pAC->PciDev,
-+ (dma_addr_t) pSkPacket->pFrag->pPhys,
-+ pSkPacket->pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+ pSkPacket->pFrag = pSkPacket->pFrag->pNext;
-+ }
-+
-+ DEV_KFREE_SKB_ANY(pSkPacket->pMBuf);
-+ pSkPacket->pMBuf = NULL;
-+ pSkPacket = pSkPacket->pNext; /* get next packet */
-+ }
-+
-+ /*
-+ ** Append the available TX packets back to free queue
-+ */
-+ if (SendCmplPktQ.pHead != NULL) {
-+ spin_lock_irqsave(&(pAC->TxPort[Port][0].TxQ_free.QueueLock), Flags);
-+ if (pAC->TxPort[Port][0].TxQ_free.pTail != NULL) {
-+ pAC->TxPort[Port][0].TxQ_free.pTail->pNext = SendCmplPktQ.pHead;
-+ pAC->TxPort[Port][0].TxQ_free.pTail = SendCmplPktQ.pTail;
-+ if (pAC->TxPort[Port][0].TxQ_free.pHead->pNext == NULL) {
-+ netif_wake_queue(pAC->dev[Port]);
-+ }
-+ } else {
-+ pAC->TxPort[Port][0].TxQ_free.pHead = SendCmplPktQ.pHead;
-+ pAC->TxPort[Port][0].TxQ_free.pTail = SendCmplPktQ.pTail;
-+ netif_wake_queue(pAC->dev[Port]);
-+ }
-+ if (Done == Put) {
-+ netif_wake_queue(pAC->dev[Port]);
-+ }
-+ if (DoWakeQueue) {
-+ netif_wake_queue(pAC->dev[Port]);
-+ DoWakeQueue = SK_FALSE;
-+ }
-+ spin_unlock_irqrestore(&pAC->TxPort[Port][0].TxQ_free.QueueLock, Flags);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("<== CheckForSendComplete()\n"));
-+
-+ return;
-+} /* CheckForSendComplete */
-+
-+/*****************************************************************************
-+ *
-+ * UnmapAndFreeTxPktBuffer
-+ *
-+ * Description:
-+ * This function free any allocated space of receive buffers
-+ *
-+ * Arguments:
-+ * pAC - A pointer to the adapter context struct.
-+ *
-+ */
-+static void UnmapAndFreeTxPktBuffer(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_PACKET *pSkPacket, /* pointer to port struct of ring to fill */
-+int TxPort) /* TX port index */
-+{
-+ SK_FRAG *pFrag = pSkPacket->pFrag;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("--> UnmapAndFreeTxPktBuffer\n"));
-+
-+ while (pFrag != NULL) {
-+ pci_unmap_page(pAC->PciDev,
-+ (dma_addr_t) pFrag->pPhys,
-+ pFrag->FragLen,
-+ PCI_DMA_FROMDEVICE);
-+ pFrag = pFrag->pNext;
-+ }
-+
-+ DEV_KFREE_SKB_ANY(pSkPacket->pMBuf);
-+ pSkPacket->pMBuf = NULL;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS,
-+ ("<-- UnmapAndFreeTxPktBuffer\n"));
-+}
-+
-+/*****************************************************************************
-+ *
-+ * HandleStatusLEs
-+ *
-+ * Description:
-+ * This function checks for any new status LEs that may have been
-+ * received. Those status LEs may either be Rx or Tx ones.
-+ *
-+ * Returns: N/A
-+ */
-+static SK_BOOL HandleStatusLEs(
-+#ifdef CONFIG_SK98LIN_NAPI
-+SK_AC *pAC, /* pointer to adapter context */
-+int *WorkDone, /* Done counter needed for NAPI */
-+int WorkToDo) /* ToDo counter for NAPI */
-+#else
-+SK_AC *pAC) /* pointer to adapter context */
-+#endif
-+{
-+ int DoneTxA[SK_MAX_MACS];
-+ int DoneTxS[SK_MAX_MACS];
-+ int Port;
-+ SK_BOOL handledStatLE = SK_FALSE;
-+ SK_BOOL NewDone = SK_FALSE;
-+ SK_HWLE *pLE;
-+ SK_U16 HighVal;
-+ SK_U32 LowVal;
-+ SK_U8 OpCode;
-+ int i;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("==> HandleStatusLEs\n"));
-+
-+ do {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Check next Own Bit of ST-LE[%d]: 0x%li \n",
-+ (pAC->StatusLETable.Done + 1) % NUM_LE_IN_TABLE(&pAC->StatusLETable),
-+ OWN_OF_FIRST_LE(&pAC->StatusLETable)));
-+
-+ while (OWN_OF_FIRST_LE(&pAC->StatusLETable) == HW_OWNER) {
-+ GET_ST_LE(pLE, &pAC->StatusLETable);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Working on finished status LE[%d]:\n",
-+ GET_DONE_INDEX(&pAC->StatusLETable)));
-+ SK_DBG_DUMP_ST_LE(pLE);
-+ handledStatLE = SK_TRUE;
-+ OpCode = STLE_GET_OPC(pLE) & ~HW_OWNER;
-+ Port = STLE_GET_LINK(pLE);
-+
-+#ifdef USE_TIST_FOR_RESET
-+ if (SK_ADAPTER_WAITING_FOR_TIST(pAC)) {
-+ /* do we just have a tist LE ? */
-+ if ((OpCode & OP_RXTIMESTAMP) == OP_RXTIMESTAMP) {
-+ for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
-+ if (SK_PORT_WAITING_FOR_ANY_TIST(pAC, i)) {
-+ /* if a port is waiting for any tist it is done */
-+ SK_CLR_STATE_FOR_PORT(pAC, i);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Got any Tist on port %c (now 0x%X!!!)\n",
-+ 'A' + i, pAC->AdapterResetState));
-+ }
-+ if (SK_PORT_WAITING_FOR_SPECIFIC_TIST(pAC, i)) {
-+ Y2_GET_TIST_LOW_VAL(pAC->IoBase, &LowVal);
-+ if ((pAC->MinTistHi != pAC->GIni.GITimeStampCnt) ||
-+ (pAC->MinTistLo < LowVal)) {
-+ /* time is up now */
-+ SK_CLR_STATE_FOR_PORT(pAC, i);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Got expected Tist on Port %c (now 0x%X)!!!\n",
-+ 'A' + i, pAC->AdapterResetState));
-+#ifdef Y2_SYNC_CHECK
-+ pAC->FramesWithoutSyncCheck =
-+ Y2_RESYNC_WATERMARK;
-+#endif
-+ } else {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Got Tist %l:%l on Port %c but still waiting\n",
-+ pAC->GIni.GITimeStampCnt, pAC->MinTistLo,
-+ 'A' + i));
-+ }
-+ }
-+ }
-+#ifndef Y2_RECOVERY
-+ if (!SK_ADAPTER_WAITING_FOR_TIST(pAC)) {
-+ /* nobody needs tist anymore - turn it off */
-+ Y2_DISABLE_TIST(pAC->IoBase);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Turn off Tist !!!\n"));
-+ }
-+#endif
-+ } else if (OpCode == OP_TXINDEXLE) {
-+ /*
-+ * change OpCode to notify the folowing code
-+ * to ignore the done index from this LE
-+ * unfortunately tist LEs will be generated only
-+ * for RxStat LEs
-+ * so in order to get a safe Done index for a
-+ * port currently waiting for a tist we have to
-+ * get the done index directly from the BMU
-+ */
-+ OpCode = OP_MOD_TXINDEX;
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Mark unusable TX_INDEX LE!!!\n"));
-+ } else {
-+ if (SK_PORT_WAITING_FOR_TIST(pAC, Port)) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Ignore LE 0x%X on Port %c!!!\n",
-+ OpCode, 'A' + Port));
-+ OpCode = OP_MOD_LE;
-+#ifdef Y2_LE_CHECK
-+ /* mark entries invalid */
-+ pAC->LastOpc = 0xFF;
-+ pAC->LastPort = 3;
-+#endif
-+ }
-+ }
-+ } /* if (SK_ADAPTER_WAITING_FOR_TIST(pAC)) */
-+#endif
-+
-+
-+
-+
-+
-+#ifdef Y2_LE_CHECK
-+ if (pAC->LastOpc != 0xFF) {
-+ /* last opc is valid
-+ * check if current opcode follows last opcode
-+ */
-+ if ((((OpCode & OP_RXTIMESTAMP) == OP_RXTIMESTAMP) && (pAC->LastOpc != OP_RXSTAT)) ||
-+ (((OpCode & OP_RXCHKS) == OP_RXCHKS) && (pAC->LastOpc != OP_RXTIMESTAMP)) ||
-+ ((OpCode == OP_RXSTAT) && (pAC->LastOpc != OP_RXCHKS))) {
-+
-+ /* opcode sequence broken
-+ * current LE is invalid
-+ */
-+
-+ if (pAC->LastOpc == OP_RXTIMESTAMP) {
-+ /* force invalid checksum */
-+ pLE->St.StUn.StRxTCPCSum.RxTCPSum1 = 1;
-+ pLE->St.StUn.StRxTCPCSum.RxTCPSum2 = 0;
-+ OpCode = pAC->LastOpc = OP_RXCHKS;
-+ Port = pAC->LastPort;
-+ } else if (pAC->LastOpc == OP_RXCHKS) {
-+ /* force invalid frame */
-+ Port = pAC->LastPort;
-+ pLE->St.Stat.BufLen = 64;
-+ pLE->St.StUn.StRxStatWord = GMR_FS_CRC_ERR;
-+ OpCode = pAC->LastOpc = OP_RXSTAT;
-+#ifdef Y2_SYNC_CHECK
-+ /* force rx sync check */
-+ pAC->FramesWithoutSyncCheck = Y2_RESYNC_WATERMARK;
-+#endif
-+ } else if (pAC->LastOpc == OP_RXSTAT) {
-+ /* create dont care tist */
-+ pLE->St.StUn.StRxTimeStamp = 0;
-+ OpCode = pAC->LastOpc = OP_RXTIMESTAMP;
-+ /* dont know the port yet */
-+ } else {
-+#ifdef DEBUG
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Unknown LastOpc %X for Timestamp on port %c.\n",
-+ pAC->LastOpc, Port));
-+#endif
-+ }
-+ }
-+ }
-+#endif
-+
-+ switch (OpCode) {
-+ case OP_RXSTAT:
-+#ifdef Y2_RECOVERY
-+ pAC->LastOpc = OP_RXSTAT;
-+#endif
-+ /*
-+ ** This is always the last Status LE belonging
-+ ** to a received packet -> handle it...
-+ */
-+ if ((Port != 0) && (Port != 1)) {
-+ /* Unknown port */
-+ panic("sk98lin: Unknown port %d\n",
-+ Port);
-+ }
-+
-+ HandleReceives(
-+ pAC,
-+ Port,
-+ STLE_GET_LEN(pLE),
-+ STLE_GET_FRSTATUS(pLE),
-+ pAC->StatusLETable.Bmu.Stat.TcpSum1,
-+ pAC->StatusLETable.Bmu.Stat.TcpSum2,
-+ pAC->StatusLETable.Bmu.Stat.RxTimeStamp,
-+ pAC->StatusLETable.Bmu.Stat.VlanId);
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (*WorkDone >= WorkToDo) {
-+ break;
-+ }
-+ (*WorkDone)++;
-+#endif
-+ break;
-+ case OP_RXVLAN:
-+ /* this value will be used for next RXSTAT */
-+ pAC->StatusLETable.Bmu.Stat.VlanId = STLE_GET_VLAN(pLE);
-+ break;
-+ case OP_RXTIMEVLAN:
-+ /* this value will be used for next RXSTAT */
-+ pAC->StatusLETable.Bmu.Stat.VlanId = STLE_GET_VLAN(pLE);
-+ /* fall through */
-+ case OP_RXTIMESTAMP:
-+ /* this value will be used for next RXSTAT */
-+ pAC->StatusLETable.Bmu.Stat.RxTimeStamp = STLE_GET_TIST(pLE);
-+#ifdef Y2_RECOVERY
-+ pAC->LastOpc = OP_RXTIMESTAMP;
-+ pAC->LastPort = Port;
-+#endif
-+ break;
-+ case OP_RXCHKSVLAN:
-+ /* this value will be used for next RXSTAT */
-+ pAC->StatusLETable.Bmu.Stat.VlanId = STLE_GET_VLAN(pLE);
-+ /* fall through */
-+ case OP_RXCHKS:
-+ /* this value will be used for next RXSTAT */
-+ pAC->StatusLETable.Bmu.Stat.TcpSum1 = STLE_GET_TCP1(pLE);
-+ pAC->StatusLETable.Bmu.Stat.TcpSum2 = STLE_GET_TCP2(pLE);
-+#ifdef Y2_RECOVERY
-+ pAC->LastPort = Port;
-+ pAC->LastOpc = OP_RXCHKS;
-+#endif
-+ break;
-+ case OP_RSS_HASH:
-+ /* this value will be used for next RXSTAT */
-+#if 0
-+ pAC->StatusLETable.Bmu.Stat.RssHashValue = STLE_GET_RSS(pLE);
-+#endif
-+ break;
-+ case OP_TXINDEXLE:
-+ /*
-+ ** :;:; TODO
-+ ** it would be possible to check for which queues
-+ ** the index has been changed and call
-+ ** CheckForSendComplete() only for such queues
-+ */
-+ STLE_GET_DONE_IDX(pLE,LowVal,HighVal);
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("LowVal: 0x%x HighVal: 0x%x\n", LowVal, HighVal));
-+
-+ /*
-+ ** It would be possible to check whether we really
-+ ** need the values for second port or sync queue,
-+ ** but I think checking whether we need them is
-+ ** more expensive than the calculation
-+ */
-+ DoneTxA[0] = STLE_GET_DONE_IDX_TXA1(LowVal,HighVal);
-+ DoneTxS[0] = STLE_GET_DONE_IDX_TXS1(LowVal,HighVal);
-+ DoneTxA[1] = STLE_GET_DONE_IDX_TXA2(LowVal,HighVal);
-+ DoneTxS[1] = STLE_GET_DONE_IDX_TXS2(LowVal,HighVal);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("DoneTxa1 0x%x DoneTxS1: 0x%x DoneTxa2 0x%x DoneTxS2: 0x%x\n",
-+ DoneTxA[0], DoneTxS[0], DoneTxA[1], DoneTxS[1]));
-+
-+ NewDone = SK_TRUE;
-+ break;
-+#ifdef USE_TIST_FOR_RESET
-+ case OP_MOD_TXINDEX:
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("OP_MOD_TXINDEX\n"));
-+ SK_IN16(pAC->IoBase, Q_ADDR(Q_XA1, Q_DONE), &DoneTxA[0]);
-+ if (pAC->GIni.GIMacsFound > 1) {
-+ SK_IN16(pAC->IoBase, Q_ADDR(Q_XA2, Q_DONE), &DoneTxA[1]);
-+ }
-+ NewDone = SK_TRUE;
-+ break;
-+ case OP_MOD_LE:
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP,
-+ ("Ignore marked LE on port in Reset\n"));
-+ break;
-+#endif
-+
-+ default:
-+ /*
-+ ** Have to handle the illegal Opcode in Status LE
-+ */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Unexpected OpCode\n"));
-+ break;
-+ }
-+
-+#ifdef Y2_RECOVERY
-+ OpCode = STLE_GET_OPC(pLE) & ~HW_OWNER;
-+ STLE_SET_OPC(pLE, OpCode);
-+#else
-+ /*
-+ ** Reset own bit we have to do this in order to detect a overflow
-+ */
-+ STLE_SET_OPC(pLE, SW_OWNER);
-+#endif
-+ } /* while (OWN_OF_FIRST_LE(&pAC->StatusLETable) == HW_OWNER) */
-+
-+ /*
-+ ** Now handle any new transmit complete
-+ */
-+ if (NewDone) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Done Index for Tx BMU has been changed\n"));
-+ for (Port = 0; Port < pAC->GIni.GIMacsFound; Port++) {
-+ /*
-+ ** Do we have a new Done idx ?
-+ */
-+ if (DoneTxA[Port] != GET_DONE_INDEX(&pAC->TxPort[Port][0].TxALET)) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Check TxA%d\n", Port + 1));
-+ CheckForSendComplete(pAC, pAC->IoBase, Port,
-+ &(pAC->TxPort[Port][0].TxAQ_working),
-+ &pAC->TxPort[Port][0].TxALET,
-+ DoneTxA[Port]);
-+ } else {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("No changes for TxA%d\n", Port + 1));
-+ }
-+#if USE_SYNC_TX_QUEUE
-+ if (HW_SYNC_TX_SUPPORTED(pAC)) {
-+ /*
-+ ** Do we have a new Done idx ?
-+ */
-+ if (DoneTxS[Port] !=
-+ GET_DONE_INDEX(&pAC->TxPort[Port][0].TxSLET)) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_INT_SRC,
-+ ("Check TxS%d\n", Port));
-+ CheckForSendComplete(pAC, pAC->IoBase, Port,
-+ &(pAC->TxPort[Port][0].TxSQ_working),
-+ &pAC->TxPort[Port][0].TxSLET,
-+ DoneTxS[Port]);
-+ } else {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_INT_SRC,
-+ ("No changes for TxS%d\n", Port));
-+ }
-+ }
-+#endif
-+ }
-+ }
-+ NewDone = SK_FALSE;
-+
-+ /*
-+ ** Check whether we have to refill our RX table
-+ */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_420)) {
-+ if (NbrRxBuffersInHW < MAX_NBR_RX_BUFFERS_IN_HW) {
-+ for (Port = 0; Port < pAC->GIni.GIMacsFound; Port++) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Check for refill of RxBuffers on Port %c\n", 'A' + Port));
-+ FillReceiveTableYukon2(pAC, pAC->IoBase, Port);
-+ }
-+ }
-+ } else {
-+ for (Port = 0; Port < pAC->GIni.GIMacsFound; Port++) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC,
-+ ("Check for refill of RxBuffers on Port %c\n", 'A' + Port));
-+ if (NUM_FREE_LE_IN_TABLE(&pAC->RxPort[Port].RxLET) >= 64) {
-+ FillReceiveTableYukon2(pAC, pAC->IoBase, Port);
-+ }
-+ }
-+ }
-+#ifdef CONFIG_SK98LIN_NAPI
-+ if (*WorkDone >= WorkToDo) {
-+ break;
-+ }
-+#endif
-+ } while (OWN_OF_FIRST_LE(&pAC->StatusLETable) == HW_OWNER);
-+
-+ /*
-+ ** Clear status BMU
-+ */
-+ SK_OUT32(pAC->IoBase, STAT_CTRL, SC_STAT_CLR_IRQ);
-+
-+ return(handledStatLE);
-+} /* HandleStatusLEs */
-+
-+/*****************************************************************************
-+ *
-+ * AllocateAndInitLETables - allocate memory for the LETable and init
-+ *
-+ * Description:
-+ * This function will allocate space for the LETable and will also
-+ * initialize them. The size of the tables must have been specified
-+ * before.
-+ *
-+ * Arguments:
-+ * pAC - A pointer to the adapter context struct.
-+ *
-+ * Returns:
-+ * SK_TRUE - all LETables initialized
-+ * SK_FALSE - failed
-+ */
-+static SK_BOOL AllocateAndInitLETables(
-+SK_AC *pAC) /* pointer to adapter context */
-+{
-+ char *pVirtMemAddr;
-+ dma_addr_t pPhysMemAddr = 0;
-+ SK_U32 CurrMac;
-+ unsigned Size;
-+ unsigned Aligned;
-+ unsigned Alignment;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("==> AllocateAndInitLETables()\n"));
-+
-+ /*
-+ ** Determine how much memory we need with respect to alignment
-+ */
-+ Alignment = MAX_LEN_OF_LE_TAB;
-+ Size = 0;
-+ for (CurrMac = 0; CurrMac < pAC->GIni.GIMacsFound; CurrMac++) {
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(RX_MAX_LE), Alignment, Aligned);
-+ Size += Aligned;
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(TXA_MAX_LE), Alignment, Aligned);
-+ Size += Aligned;
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(TXS_MAX_LE), Alignment, Aligned);
-+ Size += Aligned;
-+ }
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(ST_MAX_LE), Alignment, Aligned);
-+ Size += Aligned;
-+ Size += Alignment;
-+ pAC->SizeOfAlignedLETables = Size;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("Need %08x bytes in total\n", Size));
-+
-+ /*
-+ ** Allocate the memory
-+ */
-+ pVirtMemAddr = pci_alloc_consistent(pAC->PciDev, Size, &pPhysMemAddr);
-+ if (pVirtMemAddr == NULL) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV,
-+ SK_DBGCAT_INIT | SK_DBGCAT_DRV_ERROR,
-+ ("AllocateAndInitLETables: kernel malloc failed!\n"));
-+ return (SK_FALSE);
-+ }
-+
-+ /*
-+ ** Initialize the memory
-+ */
-+ SK_MEMSET(pVirtMemAddr, 0, Size);
-+ ALIGN_ADDR(pVirtMemAddr, Alignment); /* Macro defined in skgew.h */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("Virtual address of LETab is %8p!\n", pVirtMemAddr));
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("Phys address of LETab is %8p!\n", (void *) pPhysMemAddr));
-+
-+ for (CurrMac = 0; CurrMac < pAC->GIni.GIMacsFound; CurrMac++) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("RxLeTable for Port %c", 'A' + CurrMac));
-+ SkGeY2InitSingleLETable(
-+ pAC,
-+ &pAC->RxPort[CurrMac].RxLET,
-+ RX_MAX_LE,
-+ pVirtMemAddr,
-+ (SK_U32) (pPhysMemAddr & 0xffffffff),
-+ (SK_U32) (((SK_U64) pPhysMemAddr) >> 32));
-+
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(RX_MAX_LE), Alignment, Aligned);
-+ pVirtMemAddr += Aligned;
-+ pPhysMemAddr += Aligned;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("TxALeTable for Port %c", 'A' + CurrMac));
-+ SkGeY2InitSingleLETable(
-+ pAC,
-+ &pAC->TxPort[CurrMac][0].TxALET,
-+ TXA_MAX_LE,
-+ pVirtMemAddr,
-+ (SK_U32) (pPhysMemAddr & 0xffffffff),
-+ (SK_U32) (((SK_U64) pPhysMemAddr) >> 32));
-+
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(TXA_MAX_LE), Alignment, Aligned);
-+ pVirtMemAddr += Aligned;
-+ pPhysMemAddr += Aligned;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("TxSLeTable for Port %c", 'A' + CurrMac));
-+ SkGeY2InitSingleLETable(
-+ pAC,
-+ &pAC->TxPort[CurrMac][0].TxSLET,
-+ TXS_MAX_LE,
-+ pVirtMemAddr,
-+ (SK_U32) (pPhysMemAddr & 0xffffffff),
-+ (SK_U32) (((SK_U64) pPhysMemAddr) >> 32));
-+
-+ SK_ALIGN_SIZE(LE_TAB_SIZE(TXS_MAX_LE), Alignment, Aligned);
-+ pVirtMemAddr += Aligned;
-+ pPhysMemAddr += Aligned;
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,("StLeTable"));
-+
-+ SkGeY2InitSingleLETable(
-+ pAC,
-+ &pAC->StatusLETable,
-+ ST_MAX_LE,
-+ pVirtMemAddr,
-+ (SK_U32) (pPhysMemAddr & 0xffffffff),
-+ (SK_U32) (((SK_U64) pPhysMemAddr) >> 32));
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("<== AllocateAndInitLETables(OK)\n"));
-+ return(SK_TRUE);
-+} /* AllocateAndInitLETables */
-+
-+/*****************************************************************************
-+ *
-+ * AllocatePacketBuffersYukon2 - allocate packet and fragment buffers
-+ *
-+ * Description:
-+ * This function will allocate space for the packets and fragments
-+ *
-+ * Arguments:
-+ * pAC - A pointer to the adapter context struct.
-+ *
-+ * Returns:
-+ * SK_TRUE - Memory was allocated correctly
-+ * SK_FALSE - An error occured
-+ */
-+static SK_BOOL AllocatePacketBuffersYukon2(
-+SK_AC *pAC) /* pointer to adapter context */
-+{
-+ SK_PACKET *pRxPacket;
-+ SK_PACKET *pTxPacket;
-+ SK_U32 CurrBuff;
-+ SK_U32 CurrMac;
-+ unsigned long Flags; /* needed for POP/PUSH functions */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("==> AllocatePacketBuffersYukon2()"));
-+
-+ for (CurrMac = 0; CurrMac < pAC->GIni.GIMacsFound; CurrMac++) {
-+ /*
-+ ** Allocate RX packet space, initialize the packets and
-+ ** add them to the RX waiting queue. Waiting queue means
-+ ** that packet and fragment are initialized, but no sk_buff
-+ ** has been assigned to it yet.
-+ */
-+ pAC->RxPort[CurrMac].ReceivePacketTable =
-+ kmalloc((RX_MAX_NBR_BUFFERS * sizeof(SK_PACKET)), GFP_KERNEL);
-+
-+ if (pAC->RxPort[CurrMac].ReceivePacketTable == NULL) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_INIT | SK_DBGCAT_DRV_ERROR,
-+ ("AllocatePacketBuffersYukon2: no mem RxPkts (port %i)",CurrMac));
-+ break;
-+ } else {
-+ SK_MEMSET(pAC->RxPort[CurrMac].ReceivePacketTable, 0,
-+ (RX_MAX_NBR_BUFFERS * sizeof(SK_PACKET)));
-+
-+ pRxPacket = pAC->RxPort[CurrMac].ReceivePacketTable;
-+
-+ for (CurrBuff=0;CurrBuff<RX_MAX_NBR_BUFFERS;CurrBuff++) {
-+ pRxPacket->pFrag = &(pRxPacket->FragArray[0]);
-+ pRxPacket->NumFrags = 1;
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->RxPort[CurrMac].RxQ_waiting, pRxPacket);
-+ pRxPacket++;
-+ }
-+ }
-+
-+ /*
-+ ** Allocate TX packet space, initialize the packets and
-+ ** add them to the TX free queue. Free queue means that
-+ ** packet is available and initialized, but no fragment
-+ ** has been assigned to it. (Must be done at TX side)
-+ */
-+ pAC->TxPort[CurrMac][0].TransmitPacketTable =
-+ kmalloc((TX_MAX_NBR_BUFFERS * sizeof(SK_PACKET)), GFP_KERNEL);
-+
-+ if (pAC->TxPort[CurrMac][0].TransmitPacketTable == NULL) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_INIT | SK_DBGCAT_DRV_ERROR,
-+ ("AllocatePacketBuffersYukon2: no mem TxPkts (port %i)",CurrMac));
-+ kfree(pAC->RxPort[CurrMac].ReceivePacketTable);
-+ return(SK_FALSE);
-+ } else {
-+ SK_MEMSET(pAC->TxPort[CurrMac][0].TransmitPacketTable, 0,
-+ (TX_MAX_NBR_BUFFERS * sizeof(SK_PACKET)));
-+
-+ pTxPacket = pAC->TxPort[CurrMac][0].TransmitPacketTable;
-+
-+ for (CurrBuff=0;CurrBuff<TX_MAX_NBR_BUFFERS;CurrBuff++) {
-+ PUSH_PKT_AS_LAST_IN_QUEUE(&pAC->TxPort[CurrMac][0].TxQ_free, pTxPacket);
-+ pTxPacket++;
-+ }
-+ }
-+ } /* end for (CurrMac = 0; CurrMac < pAC->GIni.GIMacsFound; CurrMac++) */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_INIT,
-+ ("<== AllocatePacketBuffersYukon2 (OK)\n"));
-+ return(SK_TRUE);
-+
-+} /* AllocatePacketBuffersYukon2 */
-+
-+/*****************************************************************************
-+ *
-+ * FreeLETables - release allocated memory of LETables
-+ *
-+ * Description:
-+ * This function will free all resources of the LETables
-+ *
-+ * Arguments:
-+ * pAC - A pointer to the adapter context struct.
-+ *
-+ * Returns: N/A
-+ */
-+static void FreeLETables(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ dma_addr_t pPhysMemAddr;
-+ char *pVirtMemAddr;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> FreeLETables()\n"));
-+
-+ /*
-+ ** The RxLETable is the first of all LET.
-+ ** Therefore we can use its address for the input
-+ ** of the free function.
-+ */
-+ pVirtMemAddr = (char *) pAC->RxPort[0].RxLET.pLETab;
-+ pPhysMemAddr = (((SK_U64) pAC->RxPort[0].RxLET.pPhyLETABHigh << (SK_U64) 32) |
-+ ((SK_U64) pAC->RxPort[0].RxLET.pPhyLETABLow));
-+
-+ /* free continuous memory */
-+ pci_free_consistent(pAC->PciDev, pAC->SizeOfAlignedLETables,
-+ pVirtMemAddr, pPhysMemAddr);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== FreeLETables()\n"));
-+} /* FreeLETables */
-+
-+/*****************************************************************************
-+ *
-+ * FreePacketBuffers - free's all packet buffers of an adapter
-+ *
-+ * Description:
-+ * This function will free all previously allocated memory of the
-+ * packet buffers.
-+ *
-+ * Arguments:
-+ * pAC - A pointer to the adapter context struct.
-+ *
-+ * Returns: N/A
-+ */
-+static void FreePacketBuffers(
-+SK_AC *pAC) /* pointer to adapter control context */
-+{
-+ int Port;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("==> FreePacketBuffers()\n"));
-+
-+ for (Port = 0; Port < pAC->GIni.GIMacsFound; Port++) {
-+ kfree(pAC->RxPort[Port].ReceivePacketTable);
-+ kfree(pAC->TxPort[Port][0].TransmitPacketTable);
-+ }
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MSG,
-+ ("<== FreePacketBuffers()\n"));
-+} /* FreePacketBuffers */
-+
-+/*****************************************************************************
-+ *
-+ * AllocAndMapRxBuffer - fill one buffer into the receive packet/fragment
-+ *
-+ * Description:
-+ * The function allocates a new receive buffer and assigns it to the
-+ * the passsed receive packet/fragment
-+ *
-+ * Returns:
-+ * SK_TRUE - a buffer was allocated and assigned
-+ * SK_FALSE - a buffer could not be added
-+ */
-+static SK_BOOL AllocAndMapRxBuffer(
-+SK_AC *pAC, /* pointer to the adapter control context */
-+SK_PACKET *pSkPacket, /* pointer to packet that is to fill */
-+int Port) /* port the packet belongs to */
-+{
-+ struct sk_buff *pMsgBlock; /* pointer to a new message block */
-+ SK_U64 PhysAddr; /* physical address of a rx buffer */
-+
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("--> AllocAndMapRxBuffer (Port: %i)\n", Port));
-+
-+ pMsgBlock = alloc_skb(pAC->RxPort[Port].RxBufSize, GFP_ATOMIC);
-+ if (pMsgBlock == NULL) {
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV,
-+ SK_DBGCAT_DRV_RX_PROGRESS | SK_DBGCAT_DRV_ERROR,
-+ ("%s: Allocation of rx buffer failed !\n",
-+ pAC->dev[Port]->name));
-+ SK_PNMI_CNT_NO_RX_BUF(pAC, pAC->RxPort[Port].PortIndex);
-+ return(SK_FALSE);
-+ }
-+ skb_reserve(pMsgBlock, 8);
-+
-+ PhysAddr = (SK_U64) pci_map_page(pAC->PciDev,
-+ virt_to_page(pMsgBlock->data),
-+ ((unsigned long) pMsgBlock->data &
-+ ~PAGE_MASK),
-+ pAC->RxPort[Port].RxBufSize,
-+ PCI_DMA_FROMDEVICE);
-+
-+ pSkPacket->pFrag->pVirt = pMsgBlock->data;
-+ pSkPacket->pFrag->pPhys = PhysAddr;
-+ pSkPacket->pFrag->FragLen = pAC->RxPort[Port].RxBufSize; /* for correct unmap */
-+ pSkPacket->pMBuf = pMsgBlock;
-+ pSkPacket->PacketLen = pAC->RxPort[Port].RxBufSize;
-+
-+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,
-+ ("<-- AllocAndMapRxBuffer\n"));
-+
-+ return (SK_TRUE);
-+} /* AllocAndMapRxBuffer */
-+
-+/*******************************************************************************
-+ *
-+ * End of file
-+ *
-+ ******************************************************************************/
-diff -Nurap ./drivers/net/sk98lin.sk98/sky2le.c ./drivers/net/sk98lin/sky2le.c
---- ./drivers/net/sk98lin.sk98/sky2le.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/net/sk98lin/sky2le.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,512 @@
-+/*****************************************************************************
-+ *
-+ * Name: sky2le.c
-+ * Project: Gigabit Ethernet Adapters, Common Modules
-+ * Version: $Revision: 1.12 $
-+ * Date: $Date: 2005/12/14 16:11:35 $
-+ * Purpose: Functions for handling List Element Tables
-+ *
-+ *****************************************************************************/
-+
-+/******************************************************************************
-+ *
-+ * LICENSE:
-+ * (C)Copyright 2002-2004 Marvell.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ * The information in this file is provided "AS IS" without warranty.
-+ * /LICENSE
-+ *
-+ ******************************************************************************/
-+
-+/*****************************************************************************
-+ *
-+ * Description:
-+ *
-+ * This module contains the code necessary for handling List Elements.
-+ *
-+ * Supported Gigabit Ethernet Chipsets:
-+ * Yukon-2 (PCI, PCI-X, PCI-Express)
-+ *
-+ * Include File Hierarchy:
-+ *
-+ *
-+ *****************************************************************************/
-+#include "h/skdrv1st.h"
-+#include "h/skdrv2nd.h"
-+
-+/* defines *******************************************************************/
-+/* typedefs ******************************************************************/
-+/* global variables **********************************************************/
-+/* local variables ***********************************************************/
-+
-+#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
-+static const char SysKonnectFileId[] =
-+ "@(#) $Id: sky2le.c,v 1.12 2005/12/14 16:11:35 ibrueder Exp $ (C) Marvell.";
-+#endif /* DEBUG || (!LINT && !SK_SLIM) */
-+
-+/* function prototypes *******************************************************/
-+
-+/*****************************************************************************
-+ *
-+ * SkGeY2InitSingleLETable() - initializes a list element table
-+ *
-+ * Description:
-+ * This function will initialize the selected list element table.
-+ * Should be called once during DriverInit. No InitLevel required.
-+ *
-+ * Arguments:
-+ * pAC - pointer to the adapter context struct.
-+ * pLETab - pointer to list element table structure
-+ * NumLE - number of list elements in this table
-+ * pVMem - virtual address of memory allocated for this LE table
-+ * PMemLowAddr - physical address of memory to be used for the LE table
-+ * PMemHighAddr
-+ *
-+ * Returns:
-+ * nothing
-+ */
-+void SkGeY2InitSingleLETable(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_LE_TABLE *pLETab, /* pointer to list element table to be initialized */
-+unsigned int NumLE, /* number of list elements to be filled in tab */
-+void *pVMem, /* virtual address of memory used for list elements */
-+SK_U32 PMemLowAddr, /* physical addr of mem used for LE */
-+SK_U32 PMemHighAddr)
-+{
-+ unsigned int i;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("==> SkGeY2InitSingleLETable()\n"));
-+
-+#ifdef DEBUG
-+ if (NumLE != 2) { /* not table for polling unit */
-+ if ((NumLE % MIN_LEN_OF_LE_TAB) != 0 || NumLE > MAX_LEN_OF_LE_TAB) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("ERROR: Illegal number of list elements %d\n", NumLE));
-+ }
-+ }
-+#endif /* DEBUG */
-+
-+ /* special case: unused list element table */
-+ if (NumLE == 0) {
-+ PMemLowAddr = 0;
-+ PMemHighAddr = 0;
-+ pVMem = 0;
-+ }
-+
-+ /*
-+ * in order to get the best possible performance the macros to access
-+ * list elements use & instead of %
-+ * this requires the length of LE tables to be a power of 2
-+ */
-+
-+ /*
-+ * this code guarantees that we use the next power of 2 below the
-+ * value specified for NumLe - this way some LEs in the table may
-+ * not be used but the macros work correctly
-+ * this code does not check for bad values below 128 because in such a
-+ * case we cannot do anything here
-+ */
-+
-+ if ((NumLE != 2) && (NumLE != 0)) {
-+ /* no check for polling unit and unused sync Tx */
-+ i = MIN_LEN_OF_LE_TAB;
-+ while (NumLE > i) {
-+ i *= 2;
-+ if (i > MAX_LEN_OF_LE_TAB) {
-+ break;
-+ }
-+ }
-+ if (NumLE != i) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("ERROR: Illegal number of list elements %d adjusted to %d\n",
-+ NumLE, (i / 2)));
-+ NumLE = i / 2;
-+ }
-+ }
-+
-+ /* set addresses */
-+ pLETab->pPhyLETABLow = PMemLowAddr;
-+ pLETab->pPhyLETABHigh = PMemHighAddr;
-+ pLETab->pLETab = pVMem;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("contains %d LEs", NumLE));
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ (" and starts at virt %08lx and phys %08lx:%08lx\n",
-+ pVMem, PMemHighAddr, PMemLowAddr));
-+
-+ /* initialize indexes */
-+ pLETab->Done = 0;
-+ pLETab->Put = 0;
-+ pLETab->HwPut = 0;
-+ /* initialize size */
-+ pLETab->Num = NumLE;
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("<== SkGeY2InitSingleLETable()\n"));
-+} /* SkGeY2InitSingleLETable */
-+
-+/*****************************************************************************
-+ *
-+ * SkGeY2InitPrefetchUnit() - Initialize a Prefetch Unit
-+ *
-+ * Description:
-+ * Calling this function requires an already configured list element
-+ * table. The prefetch unit to be configured is specified in the parameter
-+ * 'Queue'. The function is able to initialze the prefetch units of
-+ * the following queues: Q_R1, Q_R2, Q_XS1, Q_XS2, Q_XA1, Q_XA2.
-+ * The funcution should be called before SkGeInitPort().
-+ *
-+ * Arguments:
-+ * pAC - pointer to the adapter context struct.
-+ * IoC - I/O context.
-+ * Queue - I/O offset of queue e.g. Q_XA1.
-+ * pLETab - pointer to list element table to be initialized
-+ *
-+ * Returns: N/A
-+ */
-+void SkGeY2InitPrefetchUnit(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_IOC IoC, /* I/O context */
-+unsigned int Queue, /* Queue offset for finding the right registers */
-+SK_LE_TABLE *pLETab) /* pointer to list element table to be initialized */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("==> SkGeY2InitPrefetchUnit()\n"));
-+
-+#ifdef DEBUG
-+ if (Queue != Q_R1 && Queue != Q_R2 && Queue != Q_XS1 &&
-+ Queue != Q_XS2 && Queue != Q_XA1 && Queue != Q_XA2) {
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_ERR,
-+ ("ERROR: Illegal queue identifier %x\n", Queue));
-+ }
-+#endif /* DEBUG */
-+
-+ /* disable the prefetch unit */
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_CTRL_REG), PREF_UNIT_RST_SET);
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_CTRL_REG), PREF_UNIT_RST_CLR);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Base address: %08lx:%08lx\n", pLETab->pPhyLETABHigh,
-+ pLETab->pPhyLETABLow));
-+
-+ /* Set the list base address high part*/
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_ADDR_HI_REG),
-+ pLETab->pPhyLETABHigh);
-+
-+ /* Set the list base address low part */
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_ADDR_LOW_REG),
-+ pLETab->pPhyLETABLow);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Last index: %d\n", pLETab->Num-1));
-+
-+ /* Set the list last index */
-+ SK_OUT16(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_LAST_IDX_REG),
-+ (SK_U16)(pLETab->Num - 1));
-+
-+ /* turn on prefetch unit */
-+ SK_OUT32(IoC, Y2_PREF_Q_ADDR(Queue, PREF_UNIT_CTRL_REG), PREF_UNIT_OP_ON);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("<== SkGeY2InitPrefetchUnit()\n"));
-+} /* SkGeY2InitPrefetchUnit */
-+
-+
-+/*****************************************************************************
-+ *
-+ * SkGeY2InitStatBmu() - Initialize the Status BMU
-+ *
-+ * Description:
-+ * Calling this function requires an already configured list element
-+ * table. Ensure the status BMU is only initialized once during
-+ * DriverInit - InitLevel2 required.
-+ *
-+ * Arguments:
-+ * pAC - pointer to the adapter context struct.
-+ * IoC - I/O context.
-+ * pLETab - pointer to status LE table to be initialized
-+ *
-+ * Returns: N/A
-+ */
-+void SkGeY2InitStatBmu(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_IOC IoC, /* I/O context */
-+SK_LE_TABLE *pLETab) /* pointer to status LE table */
-+{
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("==> SkGeY2InitStatBmu()\n"));
-+
-+ /* disable the prefetch unit */
-+ SK_OUT32(IoC, STAT_CTRL, SC_STAT_RST_SET);
-+ SK_OUT32(IoC, STAT_CTRL, SC_STAT_RST_CLR);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Base address Low: %08lX\n", pLETab->pPhyLETABLow));
-+
-+ /* Set the list base address */
-+ SK_OUT32(IoC, STAT_LIST_ADDR_LO, pLETab->pPhyLETABLow);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Base address High: %08lX\n", pLETab->pPhyLETABHigh));
-+
-+ SK_OUT32(IoC, STAT_LIST_ADDR_HI, pLETab->pPhyLETABHigh);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Last index: %d\n", pLETab->Num - 1));
-+
-+ /* Set the list last index */
-+ SK_OUT16(IoC, STAT_LAST_IDX, (SK_U16)(pLETab->Num - 1));
-+
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_43_418)) {
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Set Tx index threshold\n"));
-+ /* WA for dev. #4.3 */
-+ SK_OUT16(IoC, STAT_TX_IDX_TH, ST_TXTH_IDX_MASK);
-+
-+ /* set Status-FIFO watermark */
-+ SK_OUT8(IoC, STAT_FIFO_WM, 0x21); /* WA for dev. #4.18 */
-+
-+ /* set Status-FIFO ISR watermark */
-+ SK_OUT8(IoC, STAT_FIFO_ISR_WM, 0x07); /* WA for dev. #4.18 */
-+
-+ /* WA for dev. #4.3 and #4.18 */
-+ /* set Status-FIFO Tx timer init value */
-+ SK_OUT32(IoC, STAT_TX_TIMER_INI, HW_MS_TO_TICKS(pAC, 10));
-+ }
-+ else {
-+ /*
-+ * Further settings may be added if required...
-+ * 1) Status-FIFO watermark (STAT_FIFO_WM, STAT_FIFO_ISR_WM)
-+ * 2) Status-FIFO timer values (STAT_TX_TIMER_INI,
-+ * STAT_LEV_TIMER_INI and STAT_ISR_TIMER_INI)
-+ * but tests shows that the default values give the best results,
-+ * therefore the defaults are used.
-+ */
-+
-+ /*
-+ * Theses settings should avoid the
-+ * temporary hanging of the status BMU.
-+ * May be not all required... still under investigation...
-+ */
-+ SK_OUT16(IoC, STAT_TX_IDX_TH, 0x000a);
-+
-+ /* set Status-FIFO watermark */
-+ SK_OUT8(IoC, STAT_FIFO_WM, 0x10);
-+
-+
-+ /* set Status-FIFO ISR watermark */
-+ if (HW_FEATURE(pAC, HWF_WA_DEV_4109)) {
-+ SK_OUT8(IoC, STAT_FIFO_ISR_WM, 0x10);
-+ }
-+ else {
-+ SK_OUT8(IoC, STAT_FIFO_ISR_WM, 0x04);
-+ }
-+
-+ SK_OUT32(IoC, STAT_ISR_TIMER_INI, 0x0190);
-+ }
-+
-+ /* start Status-FIFO timer */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Start Status FiFo timer\n"));
-+
-+ /* enable the prefetch unit */
-+ /* operational bit not functional for Yukon-EC, but fixed in Yukon-2 */
-+ SK_OUT32(IoC, STAT_CTRL, SC_STAT_OP_ON);
-+
-+ /* start Status-FIFO timer */
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Start Status FiFo timer\n"));
-+
-+ SK_OUT8(IoC, STAT_TX_TIMER_CTRL, TIM_START);
-+ SK_OUT8(IoC, STAT_LEV_TIMER_CTRL, TIM_START);
-+ SK_OUT8(IoC, STAT_ISR_TIMER_CTRL, TIM_START);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("<== SkGeY2InitStatBmu()\n"));
-+} /* SkGeY2InitStatBmu */
-+
-+#ifdef USE_POLLING_UNIT
-+/*****************************************************************************
-+ *
-+ * SkGeY2InitPollUnit() - Initialize the Polling Unit
-+ *
-+ * Description:
-+ * This function will write the data of one polling LE table into the
-+ * adapter.
-+ *
-+ * Arguments:
-+ * pAC - pointer to the adapter context struct.
-+ * IoC - I/O context.
-+ * pLETab - pointer to polling LE table to be initialized
-+ *
-+ * Returns: N/A
-+ */
-+void SkGeY2InitPollUnit(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_IOC IoC, /* I/O context */
-+SK_LE_TABLE *pLETab) /* pointer to polling LE table */
-+{
-+ SK_HWLE *pLE;
-+ int i;
-+#ifdef VCPU
-+ VCPU_VARS();
-+#endif /* VCPU */
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("==> SkGeY2InitPollUnit()\n"));
-+
-+#ifdef VCPU
-+ for (i = 0; i < SK_MAX_MACS; i++) {
-+ GET_PO_LE(pLE, pLETab, i);
-+ VCPU_START_AND_COPY_LE();
-+ /* initialize polling LE but leave indexes invalid */
-+ POLE_SET_OPC(pLE, OP_PUTIDX | HW_OWNER);
-+ POLE_SET_LINK(pLE, i);
-+ POLE_SET_RXIDX(pLE, 0);
-+ POLE_SET_TXAIDX(pLE, 0);
-+ POLE_SET_TXSIDX(pLE, 0);
-+ VCPU_WRITE_LE();
-+ SK_DBG_DUMP_PO_LE(pLE);
-+ }
-+#endif /* VCPU */
-+
-+ /* disable the polling unit */
-+ SK_OUT32(IoC, POLL_CTRL, PC_POLL_RST_SET);
-+ SK_OUT32(IoC, POLL_CTRL, PC_POLL_RST_CLR);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Base address Low: %08lX\n", pLETab->pPhyLETABLow));
-+
-+ /* Set the list base address */
-+ SK_OUT32(IoC, POLL_LIST_ADDR_LO, pLETab->pPhyLETABLow);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("Base address High: %08lX\n", pLETab->pPhyLETABHigh));
-+
-+ SK_OUT32(IoC, POLL_LIST_ADDR_HI, pLETab->pPhyLETABHigh);
-+
-+ /* we don't need to write the last index - it is hardwired to 1 */
-+
-+ /* enable the prefetch unit */
-+ SK_OUT32(IoC, POLL_CTRL, PC_POLL_OP_ON);
-+
-+ /*
-+ * now we have to start the descriptor poll timer because it triggers
-+ * the polling unit
-+ */
-+
-+ /*
-+ * still playing with the value (timer runs at 125 MHz)
-+ * descriptor poll timer is enabled by GeInit
-+ */
-+ SK_OUT32(IoC, B28_DPT_INI,
-+ (SK_DPOLL_DEF_Y2 * (SK_U32)pAC->GIni.GIHstClkFact / 100));
-+
-+ SK_OUT8(IoC, B28_DPT_CTRL, TIM_START);
-+
-+ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT,
-+ ("<== SkGeY2InitPollUnit()\n"));
-+} /* SkGeY2InitPollUnit */
-+#endif /* USE_POLLING_UNIT */
-+
-+
-+/******************************************************************************
-+ *
-+ * SkGeY2SetPutIndex
-+ *
-+ * Description:
-+ * This function is writing the Done index of a transmit
-+ * list element table.
-+ *
-+ * Notes:
-+ * Dev. Issue 4.2
-+ *
-+ * Returns: N/A
-+ */
-+void SkGeY2SetPutIndex(
-+SK_AC *pAC, /* pointer to adapter context */
-+SK_IOC IoC, /* pointer to the IO context */
-+SK_U32 StartAddrPrefetchUnit, /* start address of the prefetch unit */
-+SK_LE_TABLE *pLETab) /* list element table to work with */
-+{
-+ unsigned int Put;
-+ SK_U16 EndOfListIndex;
-+ SK_U16 HwGetIndex;
-+ SK_U16 HwPutIndex;
-+
-+ /* set put index we would like to write */
-+ Put = GET_PUT_IDX(pLETab);
-+
-+ /*
-+ * in this case we wrap around
-+ * new put is lower than last put given to hw
-+ */
-+ if (Put < pLETab->HwPut) {
-+
-+ /* set put index = last index of list */
-+ EndOfListIndex = (NUM_LE_IN_TABLE(pLETab)-1);
-+
-+ /* read get index of hw prefetch unit */
-+ SK_IN16(IoC, (StartAddrPrefetchUnit + PREF_UNIT_GET_IDX_REG),
-+ &HwGetIndex);
-+
-+ /* read put index of hw prefetch unit */
-+ SK_IN16(IoC, (StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG),
-+ &HwPutIndex);
-+
-+ /* prefetch unit reached end of list */
-+ /* prefetch unit reached first list element */
-+ if (HwGetIndex == 0) {
-+ /* restore watermark */
-+ SK_OUT8(IoC, StartAddrPrefetchUnit + PREF_UNIT_FIFO_WM_REG, 0xe0U);
-+ /* write put index */
-+ SK_OUT16(IoC, StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG,
-+ (SK_U16)Put);
-+
-+ /* remember put index we wrote to hw */
-+ pLETab->HwPut = Put;
-+ }
-+ else if (HwGetIndex == EndOfListIndex) {
-+ /* set watermark to one list element */
-+ SK_OUT8(IoC, StartAddrPrefetchUnit + PREF_UNIT_FIFO_WM_REG, 8);
-+ /* set put index to first list element */
-+ SK_OUT16(IoC, StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG, 0);
-+ }
-+ /* prefetch unit did not reach end of list yet */
-+ /* and we did not write put index to end of list yet */
-+ else if ((HwPutIndex != EndOfListIndex) &&
-+ (HwGetIndex != EndOfListIndex)) {
-+ /* write put index */
-+ SK_OUT16(IoC, StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG,
-+ EndOfListIndex);
-+ }
-+ else {
-+ /* do nothing */
-+ }
-+ }
-+ else {
-+#ifdef XXX /* leads in to problems in the Windows Driver */
-+ if (Put != pLETab->HwPut) {
-+ /* write put index */
-+ SK_OUT16(IoC, StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG,
-+ (SK_U16)Put);
-+ /* update put index */
-+ UPDATE_HWPUT_IDX(pLETab);
-+ }
-+#else
-+ /* write put index */
-+ SK_OUT16(IoC, StartAddrPrefetchUnit + PREF_UNIT_PUT_IDX_REG,
-+ (SK_U16)Put);
-+ /* update put index */
-+ UPDATE_HWPUT_IDX(pLETab);
-+#endif
-+ }
-+} /* SkGeY2SetPutIndex */
-+
diff --git a/openvz-sources/023.030/5128_linux-2.6.9-sky2-1.4.patch b/openvz-sources/023.030/5128_linux-2.6.9-sky2-1.4.patch
deleted file mode 100644
index 2e98c7d..0000000
--- a/openvz-sources/023.030/5128_linux-2.6.9-sky2-1.4.patch
+++ /dev/null
@@ -1,1130 +0,0 @@
---- ./drivers/net/Kconfig.sky 2006-09-08 11:13:02.000000000 +0400
-+++ ./drivers/net/Kconfig 2006-09-08 11:13:52.000000000 +0400
-@@ -2049,7 +2049,13 @@ config SKY2
- depends on PCI && EXPERIMENTAL
- select CRC32
- ---help---
-- This driver support the Marvell Yukon 2 Gigabit Ethernet adapter.
-+ This driver supports Gigabit Ethernet adapters based on the the
-+ Marvell Yukon 2 chipset:
-+ Marvell 88E8021/88E8022/88E8035/88E8036/88E8038/88E8050/88E8052/
-+ 88E8053/88E8055/88E8061/88E8062, SysKonnect SK-9E21D/SK-9S21
-+
-+ This driver does not support the original Yukon chipset: a seperate
-+ driver, skge, is provided for Yukon-based adapters.
-
- To compile this driver as a module, choose M here: the module
- will be called sky2. This is recommended.
---- ./drivers/net/sky2.c.sky 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/sky2.c 2006-09-08 11:14:17.000000000 +0400
-@@ -23,7 +23,6 @@
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
--#include <linux/config.h>
- #include <linux/crc32.h>
- #include <linux/kernel.h>
- #include <linux/version.h>
-@@ -52,7 +51,7 @@
- #include "sky2.h"
-
- #define DRV_NAME "sky2"
--#define DRV_VERSION "1.1"
-+#define DRV_VERSION "1.4"
- #define PFX DRV_NAME " "
-
- /*
-@@ -67,6 +66,7 @@
- #define RX_MAX_PENDING (RX_LE_SIZE/2 - 2)
- #define RX_DEF_PENDING RX_MAX_PENDING
- #define RX_SKB_ALIGN 8
-+#define RX_BUF_WRITE 16
-
- #define TX_RING_SIZE 512
- #define TX_DEF_PENDING (TX_RING_SIZE - 1)
-@@ -80,6 +80,8 @@
- #define NAPI_WEIGHT 64
- #define PHY_RETRIES 1000
-
-+#define RING_NEXT(x,s) (((x)+1) & ((s)-1))
-+
- static const u32 default_msg =
- NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
- | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR
-@@ -97,11 +99,14 @@ static int disable_msi = 0;
- module_param(disable_msi, int, 0);
- MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
-
-+static int idle_timeout = 100;
-+module_param(idle_timeout, int, 0);
-+MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)");
-+
- static const struct pci_device_id sky2_id_table[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
- { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
-- { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },
-- { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) },
-+ { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */
- { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) },
- { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) },
- { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) },
-@@ -125,6 +130,7 @@ MODULE_DEVICE_TABLE(pci, sky2_id_table);
- /* Avoid conditionals by using array */
- static const unsigned txqaddr[] = { Q_XA1, Q_XA2 };
- static const unsigned rxqaddr[] = { Q_R1, Q_R2 };
-+static const u32 portirq_msk[] = { Y2_IS_PORT_1, Y2_IS_PORT_2 };
-
- /* This driver supports yukon2 chipset only */
- static const char *yukon2_name[] = {
-@@ -182,12 +188,11 @@ static u16 gm_phy_read(struct sky2_hw *h
- return v;
- }
-
--static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
-+static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
- {
- u16 power_control;
- u32 reg1;
- int vaux;
-- int ret = 0;
-
- pr_debug("sky2_set_power_state %d\n", state);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-@@ -239,6 +244,7 @@ static int sky2_set_power_state(struct s
- }
-
- sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
-+ udelay(100);
-
- break;
-
-@@ -251,6 +257,7 @@ static int sky2_set_power_state(struct s
- else
- reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
- sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
-+ udelay(100);
-
- if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
- sky2_write8(hw, B2_Y2_CLK_GATE, 0);
-@@ -269,12 +276,10 @@ static int sky2_set_power_state(struct s
- break;
- default:
- printk(KERN_ERR PFX "Unknown power state %d\n", state);
-- ret = -1;
- }
-
- sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-- return ret;
- }
-
- static void sky2_phy_reset(struct sky2_hw *hw, unsigned port)
-@@ -301,7 +306,8 @@ static void sky2_phy_init(struct sky2_hw
- struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
- u16 ctrl, ct1000, adv, pg, ledctrl, ledover;
-
-- if (sky2->autoneg == AUTONEG_ENABLE && hw->chip_id != CHIP_ID_YUKON_XL) {
-+ if (sky2->autoneg == AUTONEG_ENABLE &&
-+ !(hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
- u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
-
- ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
-@@ -329,7 +335,7 @@ static void sky2_phy_init(struct sky2_hw
- ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);
-
- if (sky2->autoneg == AUTONEG_ENABLE &&
-- hw->chip_id == CHIP_ID_YUKON_XL) {
-+ (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
- ctrl &= ~PHY_M_PC_DSC_MSK;
- ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
- }
-@@ -445,10 +451,11 @@ static void sky2_phy_init(struct sky2_hw
- gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
-
- /* set LED Function Control register */
-- gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
-- PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */
-- PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
-- PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */
-+ gm_phy_write(hw, port, PHY_MARV_PHY_CTRL,
-+ (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
-+ PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */
-+ PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
-+ PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */
-
- /* set Polarity Control register */
- gm_phy_write(hw, port, PHY_MARV_PHY_STAT,
-@@ -462,6 +469,25 @@ static void sky2_phy_init(struct sky2_hw
- /* restore page register */
- gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
- break;
-+ case CHIP_ID_YUKON_EC_U:
-+ pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
-+
-+ /* select page 3 to access LED control register */
-+ gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
-+
-+ /* set LED Function Control register */
-+ gm_phy_write(hw, port, PHY_MARV_PHY_CTRL,
-+ (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
-+ PHY_M_LEDC_INIT_CTRL(8) | /* 10 Mbps */
-+ PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
-+ PHY_M_LEDC_STA0_CTRL(7)));/* 1000 Mbps */
-+
-+ /* set Blink Rate in LED Timer Control Register */
-+ gm_phy_write(hw, port, PHY_MARV_INT_MASK,
-+ ledctrl | PHY_M_LED_BLINK_RT(BLINK_84MS));
-+ /* restore page register */
-+ gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
-+ break;
-
- default:
- /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */
-@@ -470,19 +496,21 @@ static void sky2_phy_init(struct sky2_hw
- ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);
- }
-
-- if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) {
-+ if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) {
- /* apply fixes in PHY AFE */
-- gm_phy_write(hw, port, 22, 255);
-+ pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
-+ gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255);
-+
- /* increase differential signal amplitude in 10BASE-T */
-- gm_phy_write(hw, port, 24, 0xaa99);
-- gm_phy_write(hw, port, 23, 0x2011);
-+ gm_phy_write(hw, port, 0x18, 0xaa99);
-+ gm_phy_write(hw, port, 0x17, 0x2011);
-
- /* fix for IEEE A/B Symmetry failure in 1000BASE-T */
-- gm_phy_write(hw, port, 24, 0xa204);
-- gm_phy_write(hw, port, 23, 0x2002);
-+ gm_phy_write(hw, port, 0x18, 0xa204);
-+ gm_phy_write(hw, port, 0x17, 0x2002);
-
- /* set page register to 0 */
-- gm_phy_write(hw, port, 22, 0);
-+ gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
- } else {
- gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
-
-@@ -556,6 +584,11 @@ static void sky2_mac_init(struct sky2_hw
-
- if (sky2->duplex == DUPLEX_FULL)
- reg |= GM_GPCR_DUP_FULL;
-+
-+ /* turn off pause in 10/100mbps half duplex */
-+ else if (sky2->speed != SPEED_1000 &&
-+ hw->chip_id != CHIP_ID_YUKON_EC_U)
-+ sky2->tx_pause = sky2->rx_pause = 0;
- } else
- reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL;
-
-@@ -580,8 +613,8 @@ static void sky2_mac_init(struct sky2_hw
- reg = gma_read16(hw, port, GM_PHY_ADDR);
- gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR);
-
-- for (i = 0; i < GM_MIB_CNT_SIZE; i++)
-- gma_read16(hw, port, GM_MIB_CNT_BASE + 8 * i);
-+ for (i = GM_MIB_CNT_BASE; i <= GM_MIB_CNT_END; i += 4)
-+ gma_read16(hw, port, i);
- gma_write16(hw, port, GM_PHY_ADDR, reg);
-
- /* transmit control */
-@@ -722,7 +755,7 @@ static inline struct sky2_tx_le *get_tx_
- {
- struct sky2_tx_le *le = sky2->tx_le + sky2->tx_prod;
-
-- sky2->tx_prod = (sky2->tx_prod + 1) % TX_RING_SIZE;
-+ sky2->tx_prod = RING_NEXT(sky2->tx_prod, TX_RING_SIZE);
- return le;
- }
-
-@@ -738,7 +771,7 @@ static inline void sky2_put_idx(struct s
- static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2)
- {
- struct sky2_rx_le *le = sky2->rx_le + sky2->rx_put;
-- sky2->rx_put = (sky2->rx_put + 1) % RX_LE_SIZE;
-+ sky2->rx_put = RING_NEXT(sky2->rx_put, RX_LE_SIZE);
- return le;
- }
-
-@@ -928,8 +961,7 @@ static inline struct sk_buff *sky2_alloc
- skb = alloc_skb(size + RX_SKB_ALIGN, gfp_mask);
- if (likely(skb)) {
- unsigned long p = (unsigned long) skb->data;
-- skb_reserve(skb,
-- ((p + RX_SKB_ALIGN - 1) & ~(RX_SKB_ALIGN - 1)) - p);
-+ skb_reserve(skb, ALIGN(p, RX_SKB_ALIGN) - p);
- }
-
- return skb;
-@@ -946,6 +978,7 @@ static int sky2_rx_start(struct sky2_por
- struct sky2_hw *hw = sky2->hw;
- unsigned rxq = rxqaddr[sky2->port];
- int i;
-+ unsigned thresh;
-
- sky2->rx_put = sky2->rx_next = 0;
- sky2_qset(hw, rxq);
-@@ -970,9 +1003,21 @@ static int sky2_rx_start(struct sky2_por
- sky2_rx_add(sky2, re->mapaddr);
- }
-
-- /* Truncate oversize frames */
-- sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), sky2->rx_bufsize - 8);
-- sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON);
-+
-+ /*
-+ * The receiver hangs if it receives frames larger than the
-+ * packet buffer. As a workaround, truncate oversize frames, but
-+ * the register is limited to 9 bits, so if you do frames > 2052
-+ * you better get the MTU right!
-+ */
-+ thresh = (sky2->rx_bufsize - 8) / sizeof(u32);
-+ if (thresh > 0x1ff)
-+ sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_OFF);
-+ else {
-+ sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), thresh);
-+ sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON);
-+ }
-+
-
- /* Tell chip about available buffers */
- sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put);
-@@ -989,7 +1034,25 @@ static int sky2_up(struct net_device *de
- struct sky2_hw *hw = sky2->hw;
- unsigned port = sky2->port;
- u32 ramsize, rxspace, imask;
-- int err = -ENOMEM;
-+ int cap, err = -ENOMEM;
-+ struct net_device *otherdev = hw->dev[sky2->port^1];
-+
-+ /*
-+ * On dual port PCI-X card, there is an problem where status
-+ * can be received out of order due to split transactions
-+ */
-+ if (otherdev && netif_running(otherdev) &&
-+ (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
-+ struct sky2_port *osky2 = netdev_priv(otherdev);
-+ u16 cmd;
-+
-+ cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
-+ cmd &= ~PCI_X_CMD_MAX_SPLIT;
-+ sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
-+
-+ sky2->rx_csum = 0;
-+ osky2->rx_csum = 0;
-+ }
-
- if (netif_msg_ifup(sky2))
- printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
-@@ -1054,7 +1117,7 @@ static int sky2_up(struct net_device *de
-
- /* Enable interrupts from phy/mac for port */
- imask = sky2_read32(hw, B0_IMSK);
-- imask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2;
-+ imask |= portirq_msk[port];
- sky2_write32(hw, B0_IMSK, imask);
-
- return 0;
-@@ -1082,7 +1145,7 @@ err_out:
- /* Modular subtraction in ring */
- static inline int tx_dist(unsigned tail, unsigned head)
- {
-- return (head - tail) % TX_RING_SIZE;
-+ return (head - tail) & (TX_RING_SIZE - 1);
- }
-
- /* Number of list elements available for next tx */
-@@ -1099,7 +1162,7 @@ static unsigned tx_le_req(const struct s
- count = sizeof(dma_addr_t) / sizeof(u32);
- count += skb_shinfo(skb)->nr_frags * count;
-
-- if (skb_shinfo(skb)->tso_size)
-+ if (skb_is_tso(skb))
- ++count;
-
- if (skb->ip_summed == CHECKSUM_HW)
-@@ -1176,7 +1239,7 @@ static int sky2_xmit_frame(struct sk_buf
- /* just drop the packet if non-linear expansion fails */
- if (skb_header_cloned(skb) &&
- pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
-- dev_kfree_skb_any(skb);
-+ dev_kfree_skb(skb);
- goto out_unlock;
- }
-
-@@ -1259,7 +1322,7 @@ static int sky2_xmit_frame(struct sk_buf
- le->opcode = OP_BUFFER | HW_OWNER;
-
- fre = sky2->tx_ring
-- + ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE;
-+ + RING_NEXT((re - sky2->tx_ring) + i, TX_RING_SIZE);
- pci_unmap_addr_set(fre, mapaddr, mapping);
- }
-
-@@ -1319,17 +1382,17 @@ static void sky2_tx_complete(struct sky2
-
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
- struct tx_ring_info *fre;
-- fre = sky2->tx_ring + (put + i + 1) % TX_RING_SIZE;
-+ fre = sky2->tx_ring + RING_NEXT(put + i, TX_RING_SIZE);
- pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr),
- skb_shinfo(skb)->frags[i].size,
- PCI_DMA_TODEVICE);
- }
-
-- dev_kfree_skb_any(skb);
-+ dev_kfree_skb(skb);
- }
-
- sky2->tx_cons = put;
-- if (tx_avail(sky2) > MAX_SKB_TX_LE)
-+ if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
- netif_wake_queue(dev);
- }
-
-@@ -1405,7 +1468,7 @@ static int sky2_down(struct net_device *
-
- /* Disable port IRQ */
- imask = sky2_read32(hw, B0_IMSK);
-- imask &= ~(sky2->port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2;
-+ imask &= ~portirq_msk[port];
- sky2_write32(hw, B0_IMSK, imask);
-
- /* turn off LED's */
-@@ -1502,17 +1565,26 @@ static void sky2_link_up(struct sky2_por
- sky2_write8(hw, SK_REG(port, LNK_LED_REG),
- LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
-
-- if (hw->chip_id == CHIP_ID_YUKON_XL) {
-+ if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) {
- u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
-+ u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */
-+
-+ switch(sky2->speed) {
-+ case SPEED_10:
-+ led |= PHY_M_LEDC_INIT_CTRL(7);
-+ break;
-+
-+ case SPEED_100:
-+ led |= PHY_M_LEDC_STA1_CTRL(7);
-+ break;
-+
-+ case SPEED_1000:
-+ led |= PHY_M_LEDC_STA0_CTRL(7);
-+ break;
-+ }
-
- gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
-- gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
-- PHY_M_LEDC_INIT_CTRL(sky2->speed ==
-- SPEED_10 ? 7 : 0) |
-- PHY_M_LEDC_STA1_CTRL(sky2->speed ==
-- SPEED_100 ? 7 : 0) |
-- PHY_M_LEDC_STA0_CTRL(sky2->speed ==
-- SPEED_1000 ? 7 : 0));
-+ gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led);
- gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
- }
-
-@@ -1587,7 +1659,7 @@ static int sky2_autoneg_done(struct sky2
- sky2->speed = sky2_phy_speed(hw, aux);
-
- /* Pause bits are offset (9..8) */
-- if (hw->chip_id == CHIP_ID_YUKON_XL)
-+ if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)
- aux >>= 6;
-
- sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0;
-@@ -1689,13 +1761,12 @@ static void sky2_tx_timeout(struct net_d
- }
-
-
--#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
- /* Want receive buffer size to be multiple of 64 bits
- * and incl room for vlan and truncation
- */
- static inline unsigned sky2_buf_size(int mtu)
- {
-- return roundup(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
-+ return ALIGN(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
- }
-
- static int sky2_change_mtu(struct net_device *dev, int new_mtu)
-@@ -1820,9 +1891,6 @@ resubmit:
- re->skb->ip_summed = CHECKSUM_NONE;
- sky2_rx_add(sky2, re->mapaddr);
-
-- /* Tell receiver about new buffers. */
-- sky2_put_idx(sky2->hw, rxqaddr[sky2->port], sky2->rx_put);
--
- return skb;
-
- oversize:
-@@ -1860,39 +1928,39 @@ static inline void sky2_tx_done(struct n
- }
- }
-
-+/* Is status ring empty or is there more to do? */
-+static inline int sky2_more_work(const struct sky2_hw *hw)
-+{
-+ return (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX));
-+}
-+
- /* Process status response ring */
- static int sky2_status_intr(struct sky2_hw *hw, int to_do)
- {
-+ struct sky2_port *sky2;
- int work_done = 0;
-+ unsigned buf_write[2] = { 0, 0 };
-+ u16 hwidx = sky2_read16(hw, STAT_PUT_IDX);
-
- rmb();
-
-- for(;;) {
-+ while (hw->st_idx != hwidx) {
- struct sky2_status_le *le = hw->st_le + hw->st_idx;
- struct net_device *dev;
-- struct sky2_port *sky2;
- struct sk_buff *skb;
- u32 status;
- u16 length;
-- u8 link, opcode;
--
-- opcode = le->opcode;
-- if (!opcode)
-- break;
-- opcode &= ~HW_OWNER;
-
-- hw->st_idx = (hw->st_idx + 1) % STATUS_RING_SIZE;
-- le->opcode = 0;
-+ hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
-
-- link = le->link;
-- BUG_ON(link >= 2);
-- dev = hw->dev[link];
-+ BUG_ON(le->link >= 2);
-+ dev = hw->dev[le->link];
-
- sky2 = netdev_priv(dev);
- length = le->length;
- status = le->status;
-
-- switch (opcode) {
-+ switch (le->opcode & ~HW_OWNER) {
- case OP_RXSTAT:
- skb = sky2_receive(sky2, length, status);
- if (!skb)
-@@ -1911,6 +1979,14 @@ static int sky2_status_intr(struct sky2_
- #endif
- netif_receive_skb(skb);
-
-+ /* Update receiver after 16 frames */
-+ if (++buf_write[le->link] == RX_BUF_WRITE) {
-+ sky2_put_idx(hw, rxqaddr[le->link],
-+ sky2->rx_put);
-+ buf_write[le->link] = 0;
-+ }
-+
-+ /* Stop after net poll weight */
- if (++work_done >= to_do)
- goto exit_loop;
- break;
-@@ -1932,7 +2008,8 @@ static int sky2_status_intr(struct sky2_
-
- case OP_TXINDEXLE:
- /* TX index reports status for both ports */
-- sky2_tx_done(hw->dev[0], status & 0xffff);
-+ BUILD_BUG_ON(TX_RING_SIZE > 0x1000);
-+ sky2_tx_done(hw->dev[0], status & 0xfff);
- if (hw->dev[1])
- sky2_tx_done(hw->dev[1],
- ((status >> 24) & 0xff)
-@@ -1942,12 +2019,22 @@ static int sky2_status_intr(struct sky2_
- default:
- if (net_ratelimit())
- printk(KERN_WARNING PFX
-- "unknown status opcode 0x%x\n", opcode);
-- break;
-+ "unknown status opcode 0x%x\n", le->opcode);
-+ goto exit_loop;
- }
- }
-
- exit_loop:
-+ if (buf_write[0]) {
-+ sky2 = netdev_priv(hw->dev[0]);
-+ sky2_put_idx(hw, Q_R1, sky2->rx_put);
-+ }
-+
-+ if (buf_write[1]) {
-+ sky2 = netdev_priv(hw->dev[1]);
-+ sky2_put_idx(hw, Q_R2, sky2->rx_put);
-+ }
-+
- return work_done;
- }
-
-@@ -2089,6 +2176,28 @@ static void sky2_descriptor_error(struct
- }
- }
-
-+/* If idle then force a fake soft NAPI poll once a second
-+ * to work around cases where sharing an edge triggered interrupt.
-+ */
-+static inline void sky2_idle_start(struct sky2_hw *hw)
-+{
-+ if (idle_timeout > 0)
-+ mod_timer(&hw->idle_timer,
-+ jiffies + msecs_to_jiffies(idle_timeout));
-+}
-+
-+static void sky2_idle(unsigned long arg)
-+{
-+ struct sky2_hw *hw = (struct sky2_hw *) arg;
-+ struct net_device *dev = hw->dev[0];
-+
-+ if (__netif_rx_schedule_prep(dev))
-+ __netif_rx_schedule(dev);
-+
-+ mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout));
-+}
-+
-+
- static int sky2_poll(struct net_device *dev0, int *budget)
- {
- struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw;
-@@ -2096,49 +2205,49 @@ static int sky2_poll(struct net_device *
- int work_done = 0;
- u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
-
-- if (unlikely(status & ~Y2_IS_STAT_BMU)) {
-- if (status & Y2_IS_HW_ERR)
-- sky2_hw_intr(hw);
-+ if (!~status)
-+ goto out;
-
-- if (status & Y2_IS_IRQ_PHY1)
-- sky2_phy_intr(hw, 0);
-+ if (status & Y2_IS_HW_ERR)
-+ sky2_hw_intr(hw);
-
-- if (status & Y2_IS_IRQ_PHY2)
-- sky2_phy_intr(hw, 1);
-+ if (status & Y2_IS_IRQ_PHY1)
-+ sky2_phy_intr(hw, 0);
-
-- if (status & Y2_IS_IRQ_MAC1)
-- sky2_mac_intr(hw, 0);
-+ if (status & Y2_IS_IRQ_PHY2)
-+ sky2_phy_intr(hw, 1);
-
-- if (status & Y2_IS_IRQ_MAC2)
-- sky2_mac_intr(hw, 1);
-+ if (status & Y2_IS_IRQ_MAC1)
-+ sky2_mac_intr(hw, 0);
-
-- if (status & Y2_IS_CHK_RX1)
-- sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1);
-+ if (status & Y2_IS_IRQ_MAC2)
-+ sky2_mac_intr(hw, 1);
-
-- if (status & Y2_IS_CHK_RX2)
-- sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2);
-+ if (status & Y2_IS_CHK_RX1)
-+ sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1);
-
-- if (status & Y2_IS_CHK_TXA1)
-- sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1);
-+ if (status & Y2_IS_CHK_RX2)
-+ sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2);
-
-- if (status & Y2_IS_CHK_TXA2)
-- sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2);
-- }
-+ if (status & Y2_IS_CHK_TXA1)
-+ sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1);
-
-- if (status & Y2_IS_STAT_BMU) {
-- work_done = sky2_status_intr(hw, work_limit);
-- *budget -= work_done;
-- dev0->quota -= work_done;
-+ if (status & Y2_IS_CHK_TXA2)
-+ sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2);
-
-- if (work_done >= work_limit)
-- return 1;
-+ work_done = sky2_status_intr(hw, work_limit);
-+ *budget -= work_done;
-+ dev0->quota -= work_done;
-
-+ if (status & Y2_IS_STAT_BMU)
- sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
-- }
-
-+ if (sky2_more_work(hw))
-+ return 1;
-+out:
- netif_rx_complete(dev0);
-
-- status = sky2_read32(hw, B0_Y2_SP_LISR);
-+ sky2_read32(hw, B0_Y2_SP_LISR);
- return 0;
- }
-
-@@ -2156,8 +2265,6 @@ static irqreturn_t sky2_intr(int irq, vo
- prefetch(&hw->st_le[hw->st_idx]);
- if (likely(__netif_rx_schedule_prep(dev0)))
- __netif_rx_schedule(dev0);
-- else
-- printk(KERN_DEBUG PFX "irq race detected\n");
-
- return IRQ_HANDLED;
- }
-@@ -2166,8 +2273,10 @@ static irqreturn_t sky2_intr(int irq, vo
- static void sky2_netpoll(struct net_device *dev)
- {
- struct sky2_port *sky2 = netdev_priv(dev);
-+ struct net_device *dev0 = sky2->hw->dev[0];
-
-- sky2_intr(sky2->hw->pdev->irq, sky2->hw, NULL);
-+ if (netif_running(dev) && __netif_rx_schedule_prep(dev0))
-+ __netif_rx_schedule(dev0);
- }
- #endif
-
-@@ -2221,13 +2330,6 @@ static int sky2_reset(struct sky2_hw *hw
- return -EOPNOTSUPP;
- }
-
-- /* This chip is new and not tested yet */
-- if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
-- pr_info(PFX "%s: is a version of Yukon 2 chipset that has not been tested yet.\n",
-- pci_name(hw->pdev));
-- pr_info("Please report success/failure to maintainer <shemminger@osdl.org>\n");
-- }
--
- /* disable ASF */
- if (hw->chip_id <= CHIP_ID_YUKON_EC) {
- sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
-@@ -2479,17 +2581,34 @@ static const struct sky2_stat {
- { "rx_unicast", GM_RXF_UC_OK },
- { "tx_mac_pause", GM_TXF_MPAUSE },
- { "rx_mac_pause", GM_RXF_MPAUSE },
-- { "collisions", GM_TXF_SNG_COL },
-+ { "collisions", GM_TXF_COL },
- { "late_collision",GM_TXF_LAT_COL },
- { "aborted", GM_TXF_ABO_COL },
-+ { "single_collisions", GM_TXF_SNG_COL },
- { "multi_collisions", GM_TXF_MUL_COL },
-- { "fifo_underrun", GM_TXE_FIFO_UR },
-- { "fifo_overflow", GM_RXE_FIFO_OV },
-- { "rx_toolong", GM_RXF_LNG_ERR },
-- { "rx_jabber", GM_RXF_JAB_PKT },
-+
-+ { "rx_short", GM_RXF_SHT },
- { "rx_runt", GM_RXE_FRAG },
-+ { "rx_64_byte_packets", GM_RXF_64B },
-+ { "rx_65_to_127_byte_packets", GM_RXF_127B },
-+ { "rx_128_to_255_byte_packets", GM_RXF_255B },
-+ { "rx_256_to_511_byte_packets", GM_RXF_511B },
-+ { "rx_512_to_1023_byte_packets", GM_RXF_1023B },
-+ { "rx_1024_to_1518_byte_packets", GM_RXF_1518B },
-+ { "rx_1518_to_max_byte_packets", GM_RXF_MAX_SZ },
- { "rx_too_long", GM_RXF_LNG_ERR },
-+ { "rx_fifo_overflow", GM_RXE_FIFO_OV },
-+ { "rx_jabber", GM_RXF_JAB_PKT },
- { "rx_fcs_error", GM_RXF_FCS_ERR },
-+
-+ { "tx_64_byte_packets", GM_TXF_64B },
-+ { "tx_65_to_127_byte_packets", GM_TXF_127B },
-+ { "tx_128_to_255_byte_packets", GM_TXF_255B },
-+ { "tx_256_to_511_byte_packets", GM_TXF_511B },
-+ { "tx_512_to_1023_byte_packets", GM_TXF_1023B },
-+ { "tx_1024_to_1518_byte_packets", GM_TXF_1518B },
-+ { "tx_1519_to_max_byte_packets", GM_TXF_MAX_SZ },
-+ { "tx_fifo_underrun", GM_TXE_FIFO_UR },
- };
-
- static u32 sky2_get_rx_csum(struct net_device *dev)
-@@ -2591,7 +2710,7 @@ static struct net_device_stats *sky2_get
- sky2->net_stats.rx_bytes = data[1];
- sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
- sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
-- sky2->net_stats.multicast = data[5] + data[7];
-+ sky2->net_stats.multicast = data[3] + data[5];
- sky2->net_stats.collisions = data[10];
- sky2->net_stats.tx_aborted_errors = data[12];
-
-@@ -2924,7 +3043,7 @@ static void sky2_get_regs(struct net_dev
- void *p)
- {
- const struct sky2_port *sky2 = netdev_priv(dev);
-- void __iomem *io = sky2->hw->regs;
-+ const void __iomem *io = sky2->hw->regs;
-
- BUG_ON(regs->len < B3_RI_WTO_R1);
- regs->version = 1;
-@@ -2965,9 +3084,6 @@ static struct ethtool_ops sky2_ethtool_o
- .phys_id = sky2_phys_id,
- .get_stats_count = sky2_get_stats_count,
- .get_ethtool_stats = sky2_get_ethtool_stats,
--#if 0 /* Not in RHEL4... */
-- .get_perm_addr = ethtool_op_get_perm_addr,
--#endif
- };
-
- /* Initialize network device */
-@@ -3016,12 +3132,7 @@ static __devinit struct net_device *sky2
- sky2->duplex = -1;
- sky2->speed = -1;
- sky2->advertising = sky2_supported_modes(hw);
--
-- /* Receive checksum disabled for Yukon XL
-- * because of observed problems with incorrect
-- * values when multiple packets are received in one interrupt
-- */
-- sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
-+ sky2->rx_csum = 1;
-
- spin_lock_init(&sky2->phy_lock);
- sky2->tx_pending = TX_DEF_PENDING;
-@@ -3047,9 +3158,6 @@ static __devinit struct net_device *sky2
-
- /* read the mac address */
- memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN);
--#if 0 /* Not in RHEL4... */
-- memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--#endif
-
- /* device is off until link detection */
- netif_carrier_off(dev);
-@@ -3219,9 +3327,9 @@ static int __devinit sky2_probe(struct p
- if (err)
- goto err_out_iounmap;
-
-- printk(KERN_INFO PFX "v%s addr 0x%lx irq %d Yukon-%s (0x%x) rev %d\n",
-- DRV_VERSION, pci_resource_start(pdev, 0), pdev->irq,
-- yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL],
-+ printk(KERN_INFO PFX "v%s addr 0x%llx irq %d Yukon-%s (0x%x) rev %d\n",
-+ DRV_VERSION, (unsigned long long)pci_resource_start(pdev, 0),
-+ pdev->irq, yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL],
- hw->chip_id, hw->chip_rev);
-
- dev = sky2_init_netdev(hw, 0, using_dac);
-@@ -3266,6 +3374,9 @@ static int __devinit sky2_probe(struct p
-
- sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
-
-+ setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
-+ sky2_idle_start(hw);
-+
- pci_set_drvdata(pdev, hw);
-
- return 0;
-@@ -3301,13 +3412,17 @@ static void __devexit sky2_remove(struct
- if (!hw)
- return;
-
-+ del_timer_sync(&hw->idle_timer);
-+
-+ sky2_write32(hw, B0_IMSK, 0);
-+ synchronize_irq(hw->pdev->irq);
-+
- dev0 = hw->dev[0];
- dev1 = hw->dev[1];
- if (dev1)
- unregister_netdev(dev1);
- unregister_netdev(dev0);
-
-- sky2_write32(hw, B0_IMSK, 0);
- sky2_set_power_state(hw, PCI_D3hot);
- sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
- sky2_write8(hw, B0_CTST, CS_RST_SET);
-@@ -3333,21 +3448,27 @@ static int sky2_suspend(struct pci_dev *
- {
- struct sky2_hw *hw = pci_get_drvdata(pdev);
- int i;
-+ pci_power_t pstate = pci_choose_state(pdev, state);
-
-- for (i = 0; i < 2; i++) {
-- struct net_device *dev = hw->dev[i];
-+ if (!(pstate == PCI_D3hot || pstate == PCI_D3cold))
-+ return -EINVAL;
-
-- if (dev) {
-- if (!netif_running(dev))
-- continue;
-+ del_timer_sync(&hw->idle_timer);
-+ netif_poll_disable(hw->dev[0]);
-
-+ for (i = 0; i < hw->ports; i++) {
-+ struct net_device *dev = hw->dev[i];
-+
-+ if (netif_running(dev)) {
- sky2_down(dev);
- netif_device_detach(dev);
- }
- }
-
-- pci_save_state(pdev, hw->pci_cfg_state);
-- return sky2_set_power_state(hw, pci_choose_state(pdev, state));
-+ sky2_write32(hw, B0_IMSK, 0);
-+ pci_save_state(pdev, pdev->saved_config_space);
-+ sky2_set_power_state(hw, pstate);
-+ return 0;
- }
-
- static int sky2_resume(struct pci_dev *pdev)
-@@ -3355,29 +3476,33 @@ static int sky2_resume(struct pci_dev *p
- struct sky2_hw *hw = pci_get_drvdata(pdev);
- int i, err;
-
-- pci_restore_state(pdev, hw->pci_cfg_state);
-+ pci_restore_state(pdev, pdev->saved_config_space);
- pci_enable_wake(pdev, PCI_D0, 0);
-- err = sky2_set_power_state(hw, PCI_D0);
-- if (err)
-- goto out;
-+ sky2_set_power_state(hw, PCI_D0);
-
- err = sky2_reset(hw);
- if (err)
- goto out;
-
-- for (i = 0; i < 2; i++) {
-+ sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
-+
-+ for (i = 0; i < hw->ports; i++) {
- struct net_device *dev = hw->dev[i];
-- if (dev && netif_running(dev)) {
-+ if (netif_running(dev)) {
- netif_device_attach(dev);
-+
- err = sky2_up(dev);
- if (err) {
- printk(KERN_ERR PFX "%s: could not up: %d\n",
- dev->name, err);
- dev_close(dev);
-- break;
-+ goto out;
- }
- }
- }
-+
-+ netif_poll_enable(hw->dev[0]);
-+ sky2_idle_start(hw);
- out:
- return err;
- }
---- ./drivers/net/sky2.h.sky 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/sky2.h 2006-09-08 11:14:17.000000000 +0400
-@@ -214,6 +214,8 @@ enum csr_regs {
- enum {
- Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */
- Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */
-+ Y2_HW_WOL_ON = 1<<15,/* HW WOL On (Yukon-EC Ultra A1 only) */
-+ Y2_HW_WOL_OFF = 1<<14,/* HW WOL On (Yukon-EC Ultra A1 only) */
- Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */
- Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */
- Y2_CLK_RUN_ENA = 1<<11,/* CLK_RUN Enable (YUKON-2 only) */
-@@ -378,6 +380,9 @@ enum {
- CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */
- CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */
- CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */
-+
-+ CHIP_REV_YU_EC_U_A0 = 0,
-+ CHIP_REV_YU_EC_U_A1 = 1,
- };
-
- /* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
-@@ -1373,23 +1378,23 @@ enum {
- GM_SMI_CTRL = 0x0080, /* 16 bit r/w SMI Control Register */
- GM_SMI_DATA = 0x0084, /* 16 bit r/w SMI Data Register */
- GM_PHY_ADDR = 0x0088, /* 16 bit r/w GPHY Address Register */
-+/* MIB Counters */
-+ GM_MIB_CNT_BASE = 0x0100, /* Base Address of MIB Counters */
-+ GM_MIB_CNT_END = 0x025C, /* Last MIB counter */
- };
-
--/* MIB Counters */
--#define GM_MIB_CNT_BASE 0x0100 /* Base Address of MIB Counters */
--#define GM_MIB_CNT_SIZE 44 /* Number of MIB Counters */
-
- /*
- * MIB Counters base address definitions (low word) -
- * use offset 4 for access to high word (32 bit r/o)
- */
- enum {
-- GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0, /* Unicast Frames Received OK */
-+ GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0, /* Unicast Frames Received OK */
- GM_RXF_BC_OK = GM_MIB_CNT_BASE + 8, /* Broadcast Frames Received OK */
- GM_RXF_MPAUSE = GM_MIB_CNT_BASE + 16, /* Pause MAC Ctrl Frames Received */
- GM_RXF_MC_OK = GM_MIB_CNT_BASE + 24, /* Multicast Frames Received OK */
- GM_RXF_FCS_ERR = GM_MIB_CNT_BASE + 32, /* Rx Frame Check Seq. Error */
-- /* GM_MIB_CNT_BASE + 40: reserved */
-+
- GM_RXO_OK_LO = GM_MIB_CNT_BASE + 48, /* Octets Received OK Low */
- GM_RXO_OK_HI = GM_MIB_CNT_BASE + 56, /* Octets Received OK High */
- GM_RXO_ERR_LO = GM_MIB_CNT_BASE + 64, /* Octets Received Invalid Low */
-@@ -1397,37 +1402,36 @@ enum {
- GM_RXF_SHT = GM_MIB_CNT_BASE + 80, /* Frames <64 Byte Received OK */
- GM_RXE_FRAG = GM_MIB_CNT_BASE + 88, /* Frames <64 Byte Received with FCS Err */
- GM_RXF_64B = GM_MIB_CNT_BASE + 96, /* 64 Byte Rx Frame */
-- GM_RXF_127B = GM_MIB_CNT_BASE + 104, /* 65-127 Byte Rx Frame */
-- GM_RXF_255B = GM_MIB_CNT_BASE + 112, /* 128-255 Byte Rx Frame */
-- GM_RXF_511B = GM_MIB_CNT_BASE + 120, /* 256-511 Byte Rx Frame */
-- GM_RXF_1023B = GM_MIB_CNT_BASE + 128, /* 512-1023 Byte Rx Frame */
-- GM_RXF_1518B = GM_MIB_CNT_BASE + 136, /* 1024-1518 Byte Rx Frame */
-- GM_RXF_MAX_SZ = GM_MIB_CNT_BASE + 144, /* 1519-MaxSize Byte Rx Frame */
-- GM_RXF_LNG_ERR = GM_MIB_CNT_BASE + 152, /* Rx Frame too Long Error */
-- GM_RXF_JAB_PKT = GM_MIB_CNT_BASE + 160, /* Rx Jabber Packet Frame */
-- /* GM_MIB_CNT_BASE + 168: reserved */
-- GM_RXE_FIFO_OV = GM_MIB_CNT_BASE + 176, /* Rx FIFO overflow Event */
-- /* GM_MIB_CNT_BASE + 184: reserved */
-- GM_TXF_UC_OK = GM_MIB_CNT_BASE + 192, /* Unicast Frames Xmitted OK */
-- GM_TXF_BC_OK = GM_MIB_CNT_BASE + 200, /* Broadcast Frames Xmitted OK */
-- GM_TXF_MPAUSE = GM_MIB_CNT_BASE + 208, /* Pause MAC Ctrl Frames Xmitted */
-- GM_TXF_MC_OK = GM_MIB_CNT_BASE + 216, /* Multicast Frames Xmitted OK */
-- GM_TXO_OK_LO = GM_MIB_CNT_BASE + 224, /* Octets Transmitted OK Low */
-- GM_TXO_OK_HI = GM_MIB_CNT_BASE + 232, /* Octets Transmitted OK High */
-- GM_TXF_64B = GM_MIB_CNT_BASE + 240, /* 64 Byte Tx Frame */
-- GM_TXF_127B = GM_MIB_CNT_BASE + 248, /* 65-127 Byte Tx Frame */
-- GM_TXF_255B = GM_MIB_CNT_BASE + 256, /* 128-255 Byte Tx Frame */
-- GM_TXF_511B = GM_MIB_CNT_BASE + 264, /* 256-511 Byte Tx Frame */
-- GM_TXF_1023B = GM_MIB_CNT_BASE + 272, /* 512-1023 Byte Tx Frame */
-- GM_TXF_1518B = GM_MIB_CNT_BASE + 280, /* 1024-1518 Byte Tx Frame */
-- GM_TXF_MAX_SZ = GM_MIB_CNT_BASE + 288, /* 1519-MaxSize Byte Tx Frame */
--
-- GM_TXF_COL = GM_MIB_CNT_BASE + 304, /* Tx Collision */
-- GM_TXF_LAT_COL = GM_MIB_CNT_BASE + 312, /* Tx Late Collision */
-- GM_TXF_ABO_COL = GM_MIB_CNT_BASE + 320, /* Tx aborted due to Exces. Col. */
-- GM_TXF_MUL_COL = GM_MIB_CNT_BASE + 328, /* Tx Multiple Collision */
-- GM_TXF_SNG_COL = GM_MIB_CNT_BASE + 336, /* Tx Single Collision */
-- GM_TXE_FIFO_UR = GM_MIB_CNT_BASE + 344, /* Tx FIFO Underrun Event */
-+ GM_RXF_127B = GM_MIB_CNT_BASE + 104,/* 65-127 Byte Rx Frame */
-+ GM_RXF_255B = GM_MIB_CNT_BASE + 112,/* 128-255 Byte Rx Frame */
-+ GM_RXF_511B = GM_MIB_CNT_BASE + 120,/* 256-511 Byte Rx Frame */
-+ GM_RXF_1023B = GM_MIB_CNT_BASE + 128,/* 512-1023 Byte Rx Frame */
-+ GM_RXF_1518B = GM_MIB_CNT_BASE + 136,/* 1024-1518 Byte Rx Frame */
-+ GM_RXF_MAX_SZ = GM_MIB_CNT_BASE + 144,/* 1519-MaxSize Byte Rx Frame */
-+ GM_RXF_LNG_ERR = GM_MIB_CNT_BASE + 152,/* Rx Frame too Long Error */
-+ GM_RXF_JAB_PKT = GM_MIB_CNT_BASE + 160,/* Rx Jabber Packet Frame */
-+
-+ GM_RXE_FIFO_OV = GM_MIB_CNT_BASE + 176,/* Rx FIFO overflow Event */
-+ GM_TXF_UC_OK = GM_MIB_CNT_BASE + 192,/* Unicast Frames Xmitted OK */
-+ GM_TXF_BC_OK = GM_MIB_CNT_BASE + 200,/* Broadcast Frames Xmitted OK */
-+ GM_TXF_MPAUSE = GM_MIB_CNT_BASE + 208,/* Pause MAC Ctrl Frames Xmitted */
-+ GM_TXF_MC_OK = GM_MIB_CNT_BASE + 216,/* Multicast Frames Xmitted OK */
-+ GM_TXO_OK_LO = GM_MIB_CNT_BASE + 224,/* Octets Transmitted OK Low */
-+ GM_TXO_OK_HI = GM_MIB_CNT_BASE + 232,/* Octets Transmitted OK High */
-+ GM_TXF_64B = GM_MIB_CNT_BASE + 240,/* 64 Byte Tx Frame */
-+ GM_TXF_127B = GM_MIB_CNT_BASE + 248,/* 65-127 Byte Tx Frame */
-+ GM_TXF_255B = GM_MIB_CNT_BASE + 256,/* 128-255 Byte Tx Frame */
-+ GM_TXF_511B = GM_MIB_CNT_BASE + 264,/* 256-511 Byte Tx Frame */
-+ GM_TXF_1023B = GM_MIB_CNT_BASE + 272,/* 512-1023 Byte Tx Frame */
-+ GM_TXF_1518B = GM_MIB_CNT_BASE + 280,/* 1024-1518 Byte Tx Frame */
-+ GM_TXF_MAX_SZ = GM_MIB_CNT_BASE + 288,/* 1519-MaxSize Byte Tx Frame */
-+
-+ GM_TXF_COL = GM_MIB_CNT_BASE + 304,/* Tx Collision */
-+ GM_TXF_LAT_COL = GM_MIB_CNT_BASE + 312,/* Tx Late Collision */
-+ GM_TXF_ABO_COL = GM_MIB_CNT_BASE + 320,/* Tx aborted due to Exces. Col. */
-+ GM_TXF_MUL_COL = GM_MIB_CNT_BASE + 328,/* Tx Multiple Collision */
-+ GM_TXF_SNG_COL = GM_MIB_CNT_BASE + 336,/* Tx Single Collision */
-+ GM_TXE_FIFO_UR = GM_MIB_CNT_BASE + 344,/* Tx FIFO Underrun Event */
- };
-
- /* GMAC Bit Definitions */
-@@ -1476,7 +1480,7 @@ enum {
- GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */
- GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */
- GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */
-- GM_TXCR_COL_THR_MSK = 1<<10, /* Bit 12..10: Collision Threshold */
-+ GM_TXCR_COL_THR_MSK = 7<<10, /* Bit 12..10: Collision Threshold */
- };
-
- #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK)
-@@ -1805,7 +1809,7 @@ struct sky2_rx_le {
- __le16 length;
- u8 ctrl;
- u8 opcode;
--} __attribute((packed));;
-+} __attribute((packed));
-
- struct sky2_status_le {
- __le32 status; /* also checksum */
-@@ -1881,10 +1885,10 @@ struct sky2_hw {
- struct sky2_status_le *st_le;
- u32 st_idx;
- dma_addr_t st_dma;
-+
-+ struct timer_list idle_timer;
- int msi_detected;
- wait_queue_head_t msi_wait;
--
-- u32 pci_cfg_state[64 / sizeof(u32)];
- };
-
- /* Register accessor for memory mapped device */
---- ./drivers/net/sky2_compat.h.sky 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/net/sky2_compat.h 2006-09-08 11:14:17.000000000 +0400
-@@ -5,7 +5,7 @@
-
- #define skb_header_cloned(skb) 0
-
--#define __netif_rx_schedule_prep(dev) netif_rx_schedule_prep(dev)
-+//#define netif_rx_schedule_test(dev) netif_rx_schedule_prep(dev)
-
- typedef u32 pm_message_t;
-
-@@ -19,4 +19,47 @@ typedef int __bitwise pci_power_t;
-
- #define pci_choose_state(pdev, state) (state)
-
-+static inline int skb_is_tso(const struct sk_buff *skb)
-+{
-+ return skb_shinfo(skb)->tso_size;
-+}
-+
-+/* Test if receive needs to be scheduled */
-+static inline int __netif_rx_schedule_prep(struct net_device *dev)
-+{
-+ return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
-+}
-+
-+static inline void setup_timer(struct timer_list * timer,
-+ void (*function)(unsigned long),
-+ unsigned long data)
-+{
-+ timer->function = function;
-+ timer->data = data;
-+ init_timer(timer);
-+}
-+
-+#define __wait_event_timeout(wq, condition, ret) \
-+do { \
-+ DEFINE_WAIT(__wait); \
-+ \
-+ for (;;) { \
-+ prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
-+ if (condition) \
-+ break; \
-+ ret = schedule_timeout(ret); \
-+ if (!ret) \
-+ break; \
-+ } \
-+ finish_wait(&wq, &__wait); \
-+} while (0)
-+
-+#define wait_event_timeout(wq, condition, timeout) \
-+({ \
-+ long __ret = timeout; \
-+ if (!(condition)) \
-+ __wait_event_timeout(wq, condition, __ret); \
-+ __ret; \
-+})
-+
- #endif /* __SKY2_COMPAT_H__ */
diff --git a/openvz-sources/023.030/5129_linux-2.6.9-qla4xxx-5.00.02.patch b/openvz-sources/023.030/5129_linux-2.6.9-qla4xxx-5.00.02.patch
deleted file mode 100644
index e30efcb..0000000
--- a/openvz-sources/023.030/5129_linux-2.6.9-qla4xxx-5.00.02.patch
+++ /dev/null
@@ -1,36540 +0,0 @@
---- ./drivers/scsi/Kconfig.qla4xxx 2006-09-08 11:22:47.000000000 +0400
-+++ ./drivers/scsi/Kconfig 2006-09-08 11:25:17.000000000 +0400
-@@ -1838,4 +1838,6 @@ endmenu
-
- source "drivers/scsi/pcmcia/Kconfig"
-
-+source "drivers/scsi/qla4xxx/Kconfig"
-+
- endmenu
---- ./drivers/scsi/Makefile.qla4xxx 2006-09-08 11:27:08.000000000 +0400
-+++ ./drivers/scsi/Makefile 2006-09-08 11:27:37.000000000 +0400
-@@ -82,6 +82,7 @@ obj-$(CONFIG_SCSI_QLOGIC_ISP) += qlogici
- obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o
- obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
- obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/
-+obj-$(CONFIG_SCSI_QLA4XXX) += qla4xxx/
- obj-$(CONFIG_SCSI_PAS16) += pas16.o
- obj-$(CONFIG_SCSI_SEAGATE) += seagate.o
- obj-$(CONFIG_SCSI_FD_8xx) += seagate.o
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/Kconfig ./drivers/scsi/qla4xxx/Kconfig
---- ./drivers/scsi/qla4xxx.qla4xxx/Kconfig 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/Kconfig 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,14 @@
-+config SCSI_QLA4XXX
-+ tristate "QLogic ISP4XXX host adapter family support"
-+ depends on PCI && SCSI
-+ ---help---
-+ This driver supports the QLogic 40xx (ISP4XXX) host adapter family.
-+
-+config SCSI_QLA4XXX_FAILOVER
-+ bool "QLogic ISP4xxx Driver-level Failover support"
-+ depends on SCSI_QLA4XXX
-+ ---help---
-+ Compile the driver with failover support. Please review the driver
-+ documentation for further information on supported hosts and storage
-+ types.
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/Makefile ./drivers/scsi/qla4xxx/Makefile
---- ./drivers/scsi/qla4xxx.qla4xxx/Makefile 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/Makefile 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,17 @@
-+# --- Override settings until Kconfig embedded
-+# CONFIG_SCSI_QLA4XXX=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA4XXX -DCONFIG_SCSI_QLA4XXX_MODULE
-+
-+# --- Enable failover
-+# CONFIG_SCSI_QLA4XXX_FAILOVER=y
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA4XXX_FAILOVER
-+
-+qla4xxx-y = ql4_os.o ql4_init.o ql4_mbx.o ql4_iocb.o ql4_isr.o ql4_isns.o \
-+ ql4_nvram.o ql4_dbg.o
-+
-+qla4xxx-$(CONFIG_SCSI_QLA4XXX_FAILOVER) += ql4_cfg.o ql4_cfgln.o ql4_fo.o \
-+ ql4_foio.o ql4_foioctl.o ql4_foln.o ql4_xioct.o ql4_inioct.o \
-+ ql4_32ioctl.o ql4_foio.o ql4_foln.o
-+# ql4_foio.o ql4_foln.o
-+
-+obj-$(CONFIG_SCSI_QLA4XXX) += qla4xxx.o
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_32ioctl.c ./drivers/scsi/qla4xxx/ql4_32ioctl.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_32ioctl.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_32ioctl.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,168 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#include <linux/config.h>
-+#include "ql4_def.h"
-+
-+#if defined QLA_CONFIG_COMPAT
-+
-+#include <linux/file.h>
-+
-+
-+/* fs/ioctl.c */
-+extern asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, void *);
-+
-+extern int register_ioctl32_conversion(unsigned int cmd,
-+ int (*handler)(unsigned int, unsigned int, unsigned long, struct file *));
-+extern int unregister_ioctl32_conversion(unsigned int cmd);
-+
-+
-+int
-+qla4xxx_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg,
-+ struct file *pfile)
-+{
-+ return (sys_ioctl(fd, cmd, (void *)arg));
-+}
-+
-+inline int
-+apidev_reg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
-+{
-+ int err = 0;
-+ int i;
-+ unsigned int cmd;
-+
-+ for (i = low_idx; i <= high_idx; i++) {
-+ cmd = (unsigned int)QL_IOCTL_CMD(i);
-+ err = register_ioctl32_conversion(cmd, qla4xxx_ioctl32);
-+ if (err) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk(
-+ "%s: error registering cmd %x. err=%d.\n",
-+ __func__, cmd, err));
-+
-+ break;
-+ }
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: registered cmd %x.\n", __func__, cmd));
-+ }
-+
-+ return (err);
-+}
-+
-+inline int
-+apidev_unreg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
-+{
-+ int err = 0;
-+ int i;
-+ unsigned int cmd;
-+
-+ for (i = low_idx; i <= high_idx; i++) {
-+ cmd = (unsigned int)QL_IOCTL_CMD(i);
-+ err = unregister_ioctl32_conversion(cmd);
-+ if (err) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk(
-+ "%s: error unregistering cmd %x. err=%d.\n",
-+ __func__, cmd, err));
-+ break;
-+ }
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: unregistered cmd %x.\n", __func__, cmd));
-+ }
-+
-+ return (err);
-+}
-+
-+inline void
-+ql4_apidev_init_32ioctl(void)
-+{
-+ int err;
-+
-+ ENTER(__func__);
-+
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: going to register ioctl32 cmds.\n",
-+ __func__));
-+
-+ /* regular external ioctl codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_REG_CC_START_IDX,
-+ EXT_DEF_REG_CC_END_IDX);
-+ if (!err) {
-+ /* regular internal ioctl codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_INT_CC_START_IDX,
-+ EXT_DEF_INT_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* LN Drvr specific codes are defined in decreasing order */
-+ err = apidev_reg_increasing_idx(EXT_DEF_DRV_SPC_CC_END_IDX,
-+ EXT_DEF_DRV_SPC_CC_START_IDX);
-+ }
-+ if (!err) {
-+ /* QL NFO specific codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_NFO_CC_START_IDX,
-+ EXT_DEF_NFO_CC_END_IDX);
-+ }
-+ if (err) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: register failed.\n",
-+ __func__));
-+ }
-+
-+ LEAVE(__func__);
-+}
-+
-+inline void
-+ql4_apidev_cleanup_32ioctl(void)
-+{
-+ int err;
-+
-+ ENTER(__func__);
-+
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: going to unregister ioctl32 cmds.\n",
-+ __func__));
-+
-+ /* regular external ioctl codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_REG_CC_START_IDX,
-+ EXT_DEF_REG_CC_END_IDX);
-+ if (!err) {
-+ /* regular internal ioctl codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_INT_CC_START_IDX,
-+ EXT_DEF_INT_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* LN Drvr specific codes are defined in decreasing order */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_DRV_SPC_CC_END_IDX,
-+ EXT_DEF_DRV_SPC_CC_START_IDX);
-+ }
-+ if (!err) {
-+ /* QL FO specific codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_NFO_CC_START_IDX,
-+ EXT_DEF_NFO_CC_END_IDX);
-+ }
-+
-+ if (err) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: unregister failed.\n",
-+ __func__));
-+ }
-+
-+ LEAVE(__func__);
-+}
-+
-+#endif /* QLA_CONFIG_COMPAT */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_32ioctl.h ./drivers/scsi/qla4xxx/ql4_32ioctl.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_32ioctl.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_32ioctl.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,28 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#ifndef _QL4_32IOCTL_H_
-+#define _QL4_32IOCTL_H_
-+
-+extern inline void
-+ql4_apidev_init_32ioctl(void);
-+
-+extern inline void
-+ql4_apidev_cleanup_32ioctl(void);
-+
-+#endif /* _QL4_32IOCTL_H_ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfg.c ./drivers/scsi/qla4xxx/ql4_cfg.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfg.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_cfg.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,3577 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2003-2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * QLogic ISP4xxx Multi-path LUN Support Driver
-+ *
-+ */
-+
-+#include "ql4_def.h"
-+#include "ql4_cfg.h"
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+/*
-+#include "ql4_foln.h"
-+*/
-+#include "ql4_glbl.h"
-+
-+/*
-+ * Local Function Prototypes.
-+ */
-+
-+static uint32_t qla4xxx_add_iscsiname_to_mp_dev(mp_device_t *, uint8_t *, uint8_t *);
-+
-+static mp_device_t * qla4xxx_allocate_mp_dev(uint8_t *, uint8_t *);
-+static mp_path_t * qla4xxx_allocate_path(mp_host_t *, uint16_t, fc_port_t *,
-+ uint16_t);
-+static mp_path_list_t * qla4xxx_allocate_path_list(void);
-+
-+static mp_host_t * qla4xxx_find_host_by_iscsiname(uint8_t *);
-+
-+static mp_path_t * qla4xxx_find_or_allocate_path(mp_host_t *, mp_device_t *,
-+ uint16_t, uint16_t, fc_port_t *);
-+
-+static uint32_t qla4xxx_cfg_register_failover_lun(mp_device_t *,srb_t *,
-+ fc_lun_t *);
-+static uint32_t qla4xxx_send_failover_notify(mp_device_t *, uint8_t,
-+ mp_path_t *, mp_path_t *);
-+static mp_path_t * qla4xxx_select_next_path(mp_host_t *, mp_device_t *,
-+ uint8_t, srb_t *);
-+
-+static uint8_t qla4xxx_update_mp_host(mp_host_t *);
-+static uint32_t qla4xxx_update_mp_tree (void);
-+
-+static fc_lun_t *qla4xxx_find_matching_lun(uint8_t , mp_device_t *, mp_path_t *);
-+static mp_path_t *qla4xxx_find_path_by_id(mp_device_t *, uint8_t);
-+static mp_device_t *qla4xxx_find_mp_dev_by_iscsiname(mp_host_t *, uint8_t *,
-+ uint16_t *);
-+
-+static mp_path_t *qla4xxx_get_visible_path(mp_device_t *dp);
-+static void qla4xxx_map_os_targets(mp_host_t *);
-+static void qla4xxx_map_os_luns(mp_host_t *, mp_device_t *, uint16_t);
-+static uint8_t qla4xxx_map_a_oslun(mp_host_t *, mp_device_t *, uint16_t, uint16_t);
-+
-+static uint8_t qla4xxx_is_name_zero(uint8_t *);
-+static void qla4xxx_add_path(mp_path_list_t *, mp_path_t *);
-+static void qla4xxx_failback_single_lun(mp_device_t *, uint8_t, uint8_t);
-+static void qla4xxx_failback_luns(mp_host_t *);
-+static void qla4xxx_setup_new_path(mp_device_t *, mp_path_t *, fc_port_t *);
-+int qla4xxx_get_wwuln_from_device(mp_host_t *, fc_lun_t *, char *, int);
-+static mp_lun_t * qla4xxx_find_matching_lunid(char *);
-+static fc_lun_t * qla4xxx_find_matching_lun_by_num(uint16_t , mp_device_t *,
-+ mp_path_t *);
-+static int qla4xxx_configure_cfg_device(fc_port_t *);
-+static mp_lun_t *
-+qla4xxx_find_or_allocate_lun(mp_host_t *, uint16_t ,
-+ fc_port_t *, fc_lun_t *);
-+static void qla4xxx_add_lun( mp_device_t *, mp_lun_t *);
-+static mp_port_t *
-+qla4xxx_find_or_allocate_port(mp_host_t *, mp_lun_t *,
-+ mp_path_t *);
-+static mp_port_t *
-+qla4xxx_find_port_by_name(mp_lun_t *, mp_path_t *);
-+static struct _mp_path *
-+qla4xxx_find_first_active_path(mp_device_t *, mp_lun_t *);
-+#if 0
-+static int
-+qla4xxx_is_pathid_in_port(mp_port_t *, uint8_t );
-+#endif
-+
-+static mp_device_t *
-+qla4xxx_find_mp_dev_by_id(mp_host_t *host, uint16_t id );
-+
-+#define qla4xxx_is_name_equal(N1,N2) \
-+ ((memcmp((N1),(N2),ISCSI_NAME_SIZE)==0?1:0))
-+/*
-+ * Global data items
-+ */
-+mp_host_t *mp_hosts_base = NULL;
-+DECLARE_MUTEX(mp_hosts_lock);
-+int mp_config_required = 0;
-+static int mp_num_hosts;
-+static int mp_initialized;
-+
-+/*
-+ * ENTRY ROUTINES
-+ */
-+
-+ /*
-+ * Borrowed from scsi_scan.c
-+ */
-+int16_t
-+qla4xxx_cfg_lookup_device(unsigned char *response_data)
-+{
-+ int i = 0;
-+ unsigned char *pnt;
-+ DEBUG3(printk(KERN_INFO "Entering %s\n", __func__);)
-+ for (i = 0; 1; i++) {
-+ if (cfg_device_list[i].vendor == NULL)
-+ return -1;
-+ pnt = &response_data[8];
-+ while (*pnt && *pnt == ' ')
-+ pnt++;
-+ if (memcmp(cfg_device_list[i].vendor, pnt,
-+ strlen(cfg_device_list[i].vendor)))
-+ continue;
-+ pnt = &response_data[16];
-+ while (*pnt && *pnt == ' ')
-+ pnt++;
-+ if (memcmp(cfg_device_list[i].model, pnt,
-+ strlen(cfg_device_list[i].model)))
-+ continue;
-+ return i;
-+ }
-+ return -1;
-+}
-+
-+
-+void
-+qla4xxx_set_device_flags(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ if (fcport->cfg_id == -1)
-+ return;
-+
-+ fcport->flags &= ~(FCF_XP_DEVICE|FCF_MSA_DEVICE|FCF_EVA_DEVICE);
-+ if ((cfg_device_list[fcport->cfg_id].flags & 1)) {
-+ printk(KERN_INFO
-+ "scsi(%d) :Loop id 0x%04x is an XP device\n", ha->host_no,
-+ fcport->loop_id);
-+ fcport->flags |= FCF_XP_DEVICE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & 2)) {
-+ printk(KERN_INFO
-+ "scsi(%d) :Loop id 0x%04x is a MSA1000 device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FCF_MSA_DEVICE;
-+ fcport->flags |= FCF_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & 4)) {
-+ printk(KERN_INFO
-+ "scsi(%d) :Loop id 0x%04x is a EVA device\n", ha->host_no,
-+ fcport->loop_id);
-+ fcport->flags |= FCF_EVA_DEVICE;
-+ fcport->flags |= FCF_FAILBACK_DISABLE;
-+ }
-+ if ((cfg_device_list[fcport->cfg_id].flags & 8)) {
-+ printk(KERN_INFO
-+ "scsi(%d) :Loop id 0x%04x has FAILOVERS disabled.\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FCF_FAILOVER_DISABLE;
-+ }
-+}
-+
-+
-+static int
-+qla4xxx_configure_cfg_device(fc_port_t *fcport)
-+{
-+ int id = fcport->cfg_id;
-+
-+ DEBUG3(printk("Entering %s - id= %d\n", __func__, fcport->cfg_id));
-+
-+ if (fcport->cfg_id == -1)
-+ return 0;
-+
-+ /* Set any notify options */
-+ if (cfg_device_list[id].notify_type != FO_NOTIFY_TYPE_NONE) {
-+ fcport->notify_type = cfg_device_list[id].notify_type;
-+ }
-+
-+ DEBUG2(printk("%s - Configuring device \n", __func__));
-+
-+ /* Disable failover capability if needed and return */
-+ fcport->fo_combine = cfg_device_list[id].fo_combine;
-+ DEBUG2(printk("Exiting %s - id= %d\n", __func__, fcport->cfg_id));
-+
-+ return 1;
-+}
-+
-+/*
-+ * qla4xxx_cfg_init
-+ * Initialize configuration structures to handle an instance of
-+ * an HBA, QLA4xxx0 card.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_cfg_init(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+
-+ ENTER("qla4xxx_cfg_init");
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ mp_initialized = 1;
-+ /* First HBA, initialize the failover global properties */
-+ qla4xxx_fo_init_params(ha);
-+
-+ down(&mp_hosts_lock);
-+ /*
-+ * If the user specified a device configuration then it is use as the
-+ * configuration. Otherwise, we wait for path discovery.
-+ */
-+ if (mp_config_required)
-+ qla4xxx_cfg_build_path_tree(ha);
-+ rval = qla4xxx_cfg_path_discovery(ha);
-+ up(&mp_hosts_lock);
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla4xxx_cfg_init");
-+ return rval;
-+}
-+
-+/*
-+ * qla4xxx_cfg_path_discovery
-+ * Discover the path configuration from the device configuration
-+ * for the specified host adapter and build the path search tree.
-+ * This function is called after the lower level driver has
-+ * completed its port and lun discovery.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_cfg_path_discovery(scsi_qla_host_t *ha)
-+{
-+ int rval = QLA_SUCCESS;
-+ mp_host_t *host;
-+ uint8_t *name;
-+
-+ ENTER("qla4xxx_cfg_path_discovery");
-+
-+ name = &ha->name_string[0];
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ /* Initialize the path tree for this adapter */
-+ host = qla4xxx_find_host_by_iscsiname(name);
-+ if (mp_config_required) {
-+ if (host == NULL ) {
-+ DEBUG4(printk("cfg_path_discovery: host not found, "
-+ "port name = "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ name[0], name[1], name[2], name[3],
-+ name[4], name[5], name[6], name[7]);)
-+ rval = QLA_ERROR;
-+ } else if (ha->instance != host->instance) {
-+ DEBUG4(printk("cfg_path_discovery: host instance "
-+ "don't match - instance=%ld.\n",
-+ ha->instance);)
-+ rval = QLA_ERROR;
-+ }
-+ } else if (host == NULL) {
-+ /* New host adapter so allocate it */
-+ DEBUG3(printk("%s: found new ha inst %ld. alloc host.\n",
-+ __func__, ha->instance);)
-+ if ( (host = qla4xxx_alloc_host(ha)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla4xxx(%d): Couldn't allocate "
-+ "host - ha = %p.\n",
-+ (int)ha->instance, ha);
-+ rval = QLA_ERROR;
-+ }
-+ }
-+
-+ /* Fill in information about host */
-+ if (host != NULL ) {
-+ host->flags |= MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->flags |= MP_HOST_FLAG_LUN_FO_ENABLED;
-+ host->fcports = &ha->fcports;
-+
-+ /* Check if multipath is enabled */
-+ DEBUG3(printk("%s: updating mp host for ha inst %ld.\n",
-+ __func__, ha->instance);)
-+ if (!qla4xxx_update_mp_host(host)) {
-+ rval = QLA_ERROR;
-+ }
-+ host->flags &= ~MP_HOST_FLAG_LUN_FO_ENABLED;
-+ }
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("qla4xxx_path_discovery: Exiting FAILED\n");)
-+ } else {
-+ LEAVE("qla4xxx_cfg_path_discovery");
-+ }
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla4xxx_cfg_event_notifiy
-+ * Callback for host driver to notify us of configuration changes.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * i_type = event type
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_cfg_event_notify(scsi_qla_host_t *ha, uint32_t i_type)
-+{
-+ mp_host_t *host; /* host adapter pointer */
-+
-+ ENTER("qla4xxx_cfg_event_notify");
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ switch (i_type) {
-+ case MP_NOTIFY_RESET_DETECTED:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_RESET_DETECTED "
-+ "- no action\n",
-+ ha->host_no);)
-+ break;
-+ case MP_NOTIFY_PWR_LOSS:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_PWR_LOSS - "
-+ "update tree\n",
-+ ha->host_no);)
-+ /*
-+ * Update our path tree in case we are
-+ * losing the adapter
-+ */
-+ down(&mp_hosts_lock);
-+ qla4xxx_update_mp_tree();
-+ up(&mp_hosts_lock);
-+ /* Free our resources for adapter */
-+ break;
-+ case MP_NOTIFY_LOOP_UP:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_LOOP_UP - "
-+ "update host tree\n",
-+ ha->host_no);)
-+ /* Adapter is back up with new configuration */
-+ if ((host = qla4xxx_cfg_find_host(ha)) != NULL) {
-+ host->flags |= MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->fcports = &ha->fcports;
-+ set_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ down(&mp_hosts_lock);
-+ qla4xxx_update_mp_tree();
-+ up(&mp_hosts_lock);
-+ clear_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ }
-+ break;
-+ case MP_NOTIFY_LOOP_DOWN:
-+ case MP_NOTIFY_BUS_RESET:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_OTHERS - "
-+ "no action\n",
-+ ha->host_no);)
-+ break;
-+ default:
-+ break;
-+
-+ }
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla4xxx_cfg_event_notify");
-+
-+ return QLA_SUCCESS;
-+}
-+
-+int
-+qla4xxx_cfg_remap(scsi_qla_host_t *halist)
-+{
-+ scsi_qla_host_t *ha;
-+
-+ mp_initialized = 1;
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each_entry(ha, &qla4xxx_hostlist, list) {
-+ DEBUG2(printk("Entering %s ...\n",__func__);)
-+ /* Find the host that was specified */
-+ set_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ qla4xxx_cfg_path_discovery(ha);
-+ clear_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+ mp_initialized = 0;
-+ DEBUG2(printk("Exiting %s ...\n",__func__);)
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla4xxx_allocate_mp_port
-+ * Allocate an fc_mp_port, clear the memory, and log a system
-+ * error if the allocation fails. After fc_mp_port is allocated
-+ *
-+ */
-+static mp_port_t *
-+qla4xxx_allocate_mp_port(uint8_t *iscsiname)
-+{
-+ mp_port_t *port;
-+ int i;
-+
-+ DEBUG3(printk("%s: entered.\n", __func__);)
-+
-+ port = kmalloc(sizeof(mp_port_t), GFP_KERNEL);
-+ if (!port)
-+ return NULL;
-+ memset(port, 0, sizeof(*port));
-+
-+ DEBUG(printk("%s: mp_port_t allocated at %p\n",
-+ __func__, port);)
-+
-+ /*
-+ * Since this is the first port, it goes at
-+ * index zero.
-+ */
-+ if (iscsiname)
-+ {
-+ DEBUG3(printk("%s: copying port name =%s\n",
-+ __func__, iscsiname);)
-+ memcpy(&port->iscsiname[0], iscsiname, ISCSI_NAME_SIZE);
-+ }
-+ for ( i = 0 ;i < MAX_HOSTS; i++ ) {
-+ port->path_list[i] = PATH_INDEX_INVALID;
-+ }
-+ port->fo_cnt = 0;
-+
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__);)
-+
-+ return port;
-+}
-+
-+static mp_port_t *
-+qla4xxx_find_port_by_name(mp_lun_t *mplun,
-+ mp_path_t *path)
-+{
-+ mp_port_t *port = NULL;
-+ mp_port_t *temp_port;
-+ struct list_head *list, *temp;
-+
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ temp_port = list_entry(list, mp_port_t, list);
-+ if ( memcmp(temp_port->iscsiname, path->iscsiname, ISCSI_NAME_SIZE) == 0 ) {
-+ port = temp_port;
-+ break;
-+ }
-+ }
-+ return port;
-+}
-+
-+
-+static mp_port_t *
-+qla4xxx_find_or_allocate_port(mp_host_t *host, mp_lun_t *mplun,
-+ mp_path_t *path)
-+{
-+ mp_port_t *port = NULL;
-+ struct list_head *list, *temp;
-+ unsigned long instance = host->instance;
-+
-+ if( instance == MAX_HOSTS - 1) {
-+ printk(KERN_INFO "%s: Fail no room\n", __func__);
-+ return NULL;
-+ }
-+
-+ if ( mplun == NULL ) {
-+ return NULL;
-+ }
-+
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ port = list_entry(list, mp_port_t, list);
-+ if ( memcmp(port->iscsiname, path->iscsiname, ISCSI_NAME_SIZE) == 0 ) {
-+ if ( port->path_list[instance] == PATH_INDEX_INVALID ) {
-+ DEBUG(printk("scsi%ld %s: Found matching mp port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ instance, __func__, port->iscsiname[0], port->iscsiname[1],
-+ port->iscsiname[2], port->iscsiname[3],
-+ port->iscsiname[4], port->iscsiname[5],
-+ port->iscsiname[6], port->iscsiname[7]);)
-+ port->path_list[instance] = path->id;
-+ port->hba_list[instance] = host->ha;
-+ port->cnt++;
-+ DEBUG(printk("%s: adding iscsiname - port[%d] = "
-+ "%p at index = %d with path id %d\n",
-+ __func__, (int)instance ,port,
-+ (int)instance, path->id);)
-+ }
-+ return port;
-+ }
-+ }
-+ port = qla4xxx_allocate_mp_port(path->iscsiname);
-+ if( port ) {
-+ port->cnt++;
-+ DEBUG(printk("%s: allocate and adding iscsiname - port[%d] = "
-+ "%p at index = %d with path id %d\n",
-+ __func__, (int)instance, port,
-+ (int)instance, path->id);)
-+ port->path_list[instance] = path->id;
-+ port->hba_list[instance] = host->ha;
-+ /* add port to list */
-+ list_add_tail(&port->list,&mplun->ports_list );
-+ }
-+ return port;
-+}
-+
-+
-+/*
-+ * qla4xxx_cfg_failover_port
-+ * Failover all the luns on the specified target to
-+ * the new path.
-+ *
-+ * Inputs:
-+ * ha = pointer to host adapter
-+ * fp - pointer to new fc_lun (failover lun)
-+ * tgt - pointer to target
-+ *
-+ * Returns:
-+ *
-+ */
-+static fc_lun_t *
-+qla4xxx_cfg_failover_port( mp_host_t *host, mp_device_t *dp,
-+ mp_path_t *new_path, fc_port_t *old_fcport, srb_t *sp)
-+{
-+#if 0
-+ uint8_t l;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ fc_lun_t *new_fclun = NULL;
-+ os_lun_t *up;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+
-+ fcport = new_path->port;
-+#if MSA1000_SUPPORTED
-+ if( !qla4xxx_test_active_port(fcport) ) {
-+ DEBUG2(printk("%s(%ld): %s - port not ACTIVE "
-+ "to failover: port = %p, loop id= 0x%x\n",
-+ __func__,
-+ host->ha->host_no, __func__, fcport, fcport->loop_id);)
-+ return new_fclun;
-+ }
-+#endif
-+
-+ /* Log the failover to console */
-+ printk(KERN_INFO
-+ "qla4xxx%d: FAILOVER all LUNS on device %d to WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x, reason=0x%x\n",
-+ (int) host->instance,
-+ (int) dp->dev_id,
-+ old_fcport->iscsi_name[0], old_fcport->iscsi_name[1],
-+ old_fcport->iscsi_name[2], old_fcport->iscsi_name[3],
-+ old_fcport->iscsi_name[4], old_fcport->iscsi_name[5],
-+ old_fcport->iscsi_name[6], old_fcport->iscsi_name[7],
-+ fcport->iscsi_name[0], fcport->iscsi_name[1],
-+ fcport->iscsi_name[2], fcport->iscsi_name[3],
-+ fcport->iscsi_name[4], fcport->iscsi_name[5],
-+ fcport->iscsi_name[6], fcport->iscsi_name[7], sp->err_id );
-+ printk(KERN_INFO
-+ "qla4xxx: FROM HBA %d to HBA %d\n",
-+ (int)old_fcport->ha->instance,
-+ (int)fcport->ha->instance);
-+
-+ /* we failover all the luns on this port */
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ l = fclun->lun;
-+ if( (fclun->flags & FLF_VISIBLE_LUN) ) {
-+ continue;
-+ }
-+ dp->path_list->current_path[l] = new_path->id;
-+ if ((vis_path =
-+ qla4xxx_get_visible_path(dp)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla4xxx(%d): No visible "
-+ "path for target %d, "
-+ "dp = %p\n",
-+ (int)host->instance,
-+ dp->dev_id, dp);
-+ continue;
-+ }
-+
-+ vis_host = vis_path->host;
-+ up = (os_lun_t *) GET_LU_Q(vis_host->ha,
-+ dp->dev_id, l);
-+ if (up == NULL ) {
-+ DEBUG2(printk("%s: instance %d: No lun queue"
-+ "for target %d, lun %d.. \n",
-+ __func__,(int)vis_host->instance,dp->dev_id,l);)
-+ continue;
-+ }
-+
-+ up->fclun = fclun;
-+ fclun->fcport->cur_path = new_path->id;
-+
-+ DEBUG2(printk("%s: instance %d: Mapping target %d:0x%x,"
-+ "lun %d to path id %d\n",
-+ __func__,(int)vis_host->instance,dp->dev_id,
-+ fclun->fcport->loop_id, l,
-+ fclun->fcport->cur_path);)
-+
-+ /* issue reset to data luns only */
-+ if( fclun->device_type == TYPE_DISK) {
-+ new_fclun = fclun;
-+ /* send a reset lun command as well */
-+ printk(KERN_INFO
-+ "scsi(%ld:0x%x:%d) sending reset lun \n",
-+ fcport->ha->host_no,
-+ fcport->loop_id, l);
-+ qla4xxx_reset_lun(fcport->ha,
-+ fcport->ddbptr,
-+ fclun);
-+ }
-+ }
-+ return new_fclun;
-+#else
-+ return 0;
-+#endif
-+}
-+
-+/*
-+ * qla4xxx_cfg_failover
-+ * A problem has been detected with the current path for this
-+ * lun. Select the next available path as the current path
-+ * for this device.
-+ *
-+ * Inputs:
-+ * ha = pointer to host adapter
-+ * fp - pointer to failed fc_lun (failback lun)
-+ * tgt - pointer to target
-+ *
-+ * Returns:
-+ * pointer to new fc_lun_t, or NULL if failover fails.
-+ */
-+fc_lun_t *
-+qla4xxx_cfg_failover(scsi_qla_host_t *ha, fc_lun_t *fp,
-+ os_tgt_t *tgt, srb_t *sp)
-+{
-+ mp_host_t *host; /* host adapter pointer */
-+ mp_device_t *dp; /* virtual device pointer */
-+ mp_path_t *new_path; /* new path pointer */
-+ fc_lun_t *new_fp = NULL;
-+ fc_port_t *fcport, *new_fcport;
-+ struct fo_information *mp_info = NULL;
-+
-+ ENTER("qla4xxx_cfg_failover");
-+ DEBUG2(printk("%s entered\n",__func__);)
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ if ((host = qla4xxx_cfg_find_host(ha)) != NULL) {
-+ if ((dp = qla4xxx_find_mp_dev_by_id(
-+ host, tgt->id)) != NULL ) {
-+
-+ DEBUG2(printk("qla4xxx_cfg_failover: ha=%p instance=%d dp = %p, id=%d\n", ha, ha->instance, dp, tgt->id);)
-+ /*
-+ * Point at the next path in the path list if there is
-+ * one, and if it hasn't already been failed over by
-+ * another I/O. If there is only one path continuer
-+ * to point at it.
-+ */
-+ new_path = qla4xxx_select_next_path(host, dp,
-+ fp->lun, sp);
-+ if( new_path == NULL )
-+ goto cfg_failover_done;
-+ new_fp = qla4xxx_find_matching_lun(fp->lun,
-+ dp, new_path);
-+ if( new_fp == NULL )
-+ goto cfg_failover_done;
-+ DEBUG2(printk("cfg_failover: new path=%p, new pathid=%d"
-+ " new fp lun= %p\n",
-+ new_path, new_path->id, new_fp);)
-+
-+ fcport = fp->fcport;
-+ if( (fcport->flags & FCF_MSA_DEVICE) ) {
-+ /*
-+ * "select next path" has already
-+ * send out the switch path notify
-+ * command, so inactive old path
-+ */
-+ fcport->flags &= ~(FCF_MSA_PORT_ACTIVE);
-+ if( qla4xxx_cfg_failover_port( host, dp,
-+ new_path, fcport, sp) == NULL ) {
-+ mp_info = (struct fo_information *)
-+ sp->lun_queue->fo_info;
-+ mp_info->fo_retry_cnt[new_path->id]
-+ += qla_fo_params.MaxRetriesPerPath;
-+
-+ printk(KERN_INFO
-+ "scsi(%d): Fail to failover device "
-+ " - fcport = %p\n",
-+ host->ha->host_no, fcport);
-+ goto cfg_failover_done;
-+ }
-+ } else if( (fcport->flags & FCF_EVA_DEVICE) ) {
-+ new_fcport = new_path->port;
-+ if ( qla4xxx_test_active_lun(
-+ new_fcport, new_fp ) ) {
-+ qla4xxx_cfg_register_failover_lun(dp,
-+ sp, new_fp);
-+ /* send a reset lun command as well */
-+ printk(KERN_INFO
-+ "scsi(%d:0x%x:%d) sending"
-+ "reset lun \n",
-+ new_fcport->ha->host_no,
-+ new_fcport->loop_id, new_fp->lun);
-+ qla4xxx_reset_lun(new_fcport->ha,
-+ new_fcport->ddbptr,
-+ new_fp);
-+ } else {
-+ mp_info = (struct fo_information *)
-+ sp->lun_queue->fo_info;
-+ mp_info->fo_retry_cnt[new_path->id]
-+ += qla_fo_params.MaxRetriesPerPath;
-+ DEBUG2(printk(
-+ "scsi(%d): %s Fail to failover lun "
-+ "old fclun= %p, new fclun= %p\n",
-+ host->ha->host_no,
-+ __func__,fp, new_fp);)
-+ goto cfg_failover_done;
-+ }
-+ } else { /*default */
-+ new_fp = qla4xxx_find_matching_lun(fp->lun, dp,
-+ new_path);
-+ qla4xxx_cfg_register_failover_lun(dp, sp,
-+ new_fp);
-+ }
-+
-+ } else {
-+ printk(KERN_INFO
-+ "qla4xxx(%d): Couldn't find device "
-+ "to failover: dp = %p\n",
-+ host->instance, dp);
-+ }
-+ }
-+
-+cfg_failover_done:
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla4xxx_cfg_failover");
-+
-+ return new_fp;
-+}
-+
-+/*
-+ * IOCTL support -- moved to ql4_foioctl.c
-+ */
-+
-+/*
-+ * MP SUPPORT ROUTINES
-+ */
-+
-+/*
-+ * qla4xxx_add_mp_host
-+ * Add the specified host the host list.
-+ *
-+ * Input:
-+ * node_name = pointer to node name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla4xxx_add_mp_host(uint8_t *iscsi_name)
-+{
-+ mp_host_t *host, *temp;
-+
-+ host = kmalloc(sizeof(mp_host_t), GFP_KERNEL);
-+ if (!host)
-+ return NULL;
-+ memset(host, 0, sizeof(*host));
-+ memcpy(host->iscsiname, iscsi_name, ISCSI_NAME_SIZE);
-+ host->next = NULL;
-+
-+ /* add to list */
-+ if (mp_hosts_base == NULL) {
-+ mp_hosts_base = host;
-+ } else {
-+ temp = mp_hosts_base;
-+ while (temp->next != NULL)
-+ temp = temp->next;
-+ temp->next = host;
-+ }
-+
-+ mp_num_hosts++;
-+ return host;
-+}
-+
-+/*
-+ * qla4xxx_alloc_host
-+ * Allocate and initialize an mp host structure.
-+ *
-+ * Input:
-+ * ha = pointer to base driver's adapter structure.
-+ *
-+ * Returns:
-+ * Pointer to host structure or null on error.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla4xxx_alloc_host(scsi_qla_host_t *ha)
-+{
-+ mp_host_t *host, *temp;
-+ uint8_t *name;
-+
-+ name = &ha->name_string[0];
-+
-+ ENTER("qla4xxx_alloc_host");
-+
-+ host = kmalloc(sizeof(mp_host_t), GFP_KERNEL);
-+ if (!host)
-+ return NULL;
-+
-+ memset(host, 0, sizeof(*host));
-+ host->ha = ha;
-+ memcpy(host->iscsiname, name, ISCSI_NAME_SIZE);
-+ host->next = NULL;
-+ host->flags = MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->instance = ha->instance;
-+
-+ if (qla4xxx_fo_enabled(host->ha, host->instance)) {
-+ host->flags |= MP_HOST_FLAG_FO_ENABLED;
-+ DEBUG4(printk("%s: Failover enabled.\n",
-+ __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failover disabled.\n",
-+ __func__);)
-+ }
-+ /* add to list */
-+ if (mp_hosts_base == NULL) {
-+ mp_hosts_base = host;
-+ } else {
-+ temp = mp_hosts_base;
-+ while (temp->next != NULL)
-+ temp = temp->next;
-+ temp->next = host;
-+ }
-+ mp_num_hosts++;
-+
-+ DEBUG4(printk("%s: Alloc host @ %p\n", __func__, host);)
-+ return host;
-+}
-+
-+/*
-+ * qla4xxx_add_iscsiname_to_mp_dev
-+ * Add the specific port name to the list of port names for a
-+ * multi-path device.
-+ *
-+ * Input:
-+ * dp = pointer ti virtual device
-+ * iscsiname = Port name to add to device
-+ * nodename = Node name to add to device
-+ *
-+ * Returns:
-+ * qla4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla4xxx_add_iscsiname_to_mp_dev(mp_device_t *dp, uint8_t *iscsiname, uint8_t *nodename)
-+{
-+ uint16_t index;
-+ uint32_t rval = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_add_iscsiname_to_mp_dev");
-+
-+ /* Look for an empty slot and add the specified iscsiname. */
-+ for (index = 0; index < MAX_NUMBER_PATHS; index++) {
-+ if (qla4xxx_is_name_zero(&dp->iscsinames[index][0])) {
-+ DEBUG4(printk("%s: adding iscsiname to dp = "
-+ "%p at index = %d\n",
-+ __func__, dp, index);)
-+ memcpy(&dp->iscsinames[index][0], iscsiname, ISCSI_NAME_SIZE);
-+ break;
-+ }
-+ }
-+ if (index == MAX_NUMBER_PATHS) {
-+ rval = QLA_ERROR;
-+ DEBUG4(printk("%s: Fail no room\n", __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit OK\n", __func__);)
-+ }
-+
-+ LEAVE("qla4xxx_add_iscsiname_to_mp_dev");
-+
-+ return rval;
-+}
-+
-+
-+/*
-+ * qla4xxx_allocate_mp_dev
-+ * Allocate an fc_mp_dev, clear the memory, and log a system
-+ * error if the allocation fails. After fc_mp_dev is allocated
-+ *
-+ * Inputs:
-+ * nodename = pointer to nodename of new device
-+ * iscsiname = pointer to iscsiname of new device
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla4xxx_allocate_mp_dev(uint8_t *devname, uint8_t *iscsiname)
-+{
-+ mp_device_t *dp; /* Virtual device pointer */
-+
-+ ENTER("qla4xxx_allocate_mp_dev");
-+ DEBUG3(printk("%s: entered.\n", __func__);)
-+
-+ dp = kmalloc(sizeof(mp_device_t), GFP_KERNEL);
-+ if (!dp) {
-+ DEBUG4(printk("%s: Allocate failed.\n", __func__);)
-+ return NULL;
-+ }
-+ memset(dp, 0, sizeof(*dp));
-+
-+ DEBUG3(printk("%s: mp_device_t allocated at %p\n", __func__, dp);)
-+
-+ /*
-+ * Copy node name into the mp_device_t.
-+ */
-+ if (devname) {
-+ DEBUG2(printk("%s: copying dev name={%s} \n",
-+ __func__, devname);)
-+ memcpy(dp->devname, devname, ISCSI_NAME_SIZE);
-+ }
-+
-+ /*
-+ * Since this is the first port, it goes at
-+ * index zero.
-+ */
-+ if (iscsiname)
-+ {
-+ DEBUG3(printk("%s: copying port name (%s) "
-+ ".\n",
-+ __func__, iscsiname); )
-+ memcpy(&dp->iscsinames[0][0], iscsiname, ISCSI_NAME_SIZE);
-+ }
-+
-+ /* Allocate an PATH_LIST for the fc_mp_dev. */
-+ if ((dp->path_list = qla4xxx_allocate_path_list()) == NULL) {
-+ DEBUG4(printk("%s: allocate path_list Failed.\n",
-+ __func__);)
-+ kfree(dp);
-+ dp = NULL;
-+ } else {
-+ DEBUG4(printk("%s: mp_path_list_t allocated at %p\n",
-+ __func__, dp->path_list);)
-+ /* EMPTY */
-+ DEBUG4(printk("qla4xxx_allocate_mp_dev: Exit Okay\n");)
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__);)
-+ LEAVE("qla4xxx_allocate_mp_dev");
-+
-+ return dp;
-+}
-+
-+/*
-+ * qla4xxx_allocate_path
-+ * Allocate a PATH.
-+ *
-+ * Inputs:
-+ * host Host adapter for the device.
-+ * path_id path number
-+ * port port for device.
-+ * dev_id device number
-+ *
-+ * Returns:
-+ * Pointer to new PATH, or NULL if the allocation failed.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla4xxx_allocate_path(mp_host_t *host, uint16_t path_id,
-+ fc_port_t *port, uint16_t dev_id)
-+{
-+ mp_path_t *path;
-+ uint16_t lun;
-+
-+ ENTER("qla4xxx_allocate_path");
-+
-+ path = kmalloc(sizeof(mp_path_t), GFP_KERNEL);
-+ if (!path) {
-+ DEBUG4(printk("%s: Failed\n", __func__);)
-+ return 0;
-+ }
-+ memset(path, 0, sizeof(*path));
-+
-+ DEBUG3(printk("%s(%ld): allocated path %p at path id %d.\n",
-+ __func__, host->ha->host_no, path, path_id);)
-+
-+ /* Copy the supplied information into the MP_PATH. */
-+ path->host = host;
-+
-+ DEBUG3(printk("%s(%ld): assigned port pointer %p "
-+ "to path id %d.\n",
-+ __func__, host->ha->host_no, port, path_id);)
-+ path->port = port;
-+
-+ path->id = path_id;
-+ port->cur_path = path->id;
-+ path->mp_byte = port->mp_byte;
-+ path->next = NULL;
-+ memcpy(path->iscsiname, port->iscsi_name, ISCSI_NAME_SIZE);
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ path->lun_data.data[lun] |= LUN_DATA_ENABLED;
-+ }
-+
-+ return path;
-+}
-+
-+
-+/*
-+ * qla4xxx_allocate_path_list
-+ * Allocate a PATH_LIST
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Returns:
-+ * Pointer to new PATH_LIST, or NULL if the allocation fails.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_list_t *
-+qla4xxx_allocate_path_list( void )
-+{
-+ mp_path_list_t *path_list;
-+ uint16_t i;
-+ uint8_t l;
-+
-+ path_list = kmalloc(sizeof(mp_path_list_t), GFP_KERNEL);
-+ if (!path_list) {
-+ DEBUG4(printk("%s: Alloc pool failed for MP_PATH_LIST.\n",
-+ __func__);)
-+ return NULL;
-+ }
-+ memset(path_list, 0, sizeof(*path_list));
-+
-+ DEBUG4(printk("%s: allocated at %p\n", __func__, path_list);)
-+
-+ path_list->visible = PATH_INDEX_INVALID;
-+ /* Initialized current path */
-+ for (i = 0; i < MAX_LUNS_PER_DEVICE; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ path_list->current_path[l] = PATH_INDEX_INVALID;
-+ }
-+ path_list->last = NULL;
-+
-+ return path_list;
-+}
-+
-+/*
-+ * qla4xxx_cfg_find_host
-+ * Look through the existing multipath tree, and find
-+ * a host adapter to match the specified ha.
-+ *
-+ * Input:
-+ * ha = pointer to host adapter
-+ *
-+ * Return:
-+ * Pointer to new host, or NULL if no match found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla4xxx_cfg_find_host(scsi_qla_host_t *ha)
-+{
-+ mp_host_t *host = NULL; /* Host found and null if not */
-+ mp_host_t *tmp_host;
-+
-+ ENTER("qla4xxx_cfg_find_host");
-+
-+ for (tmp_host = mp_hosts_base; (tmp_host); tmp_host = tmp_host->next) {
-+ if (tmp_host->ha == ha) {
-+ host = tmp_host;
-+ DEBUG3(printk("%s: Found host =%p, instance %d\n",
-+ __func__, host, host->instance);)
-+ break;
-+ }
-+ }
-+
-+ LEAVE("qla4xxx_cfg_find_host");
-+
-+ return host;
-+}
-+
-+/*
-+ * qla4xxx_find_host_by_iscsiname
-+ * Look through the existing multipath tree, and find
-+ * a host adapter to match the specified iscsiname.
-+ *
-+ * Input:
-+ * name = iscsiname to match.
-+ *
-+ * Return:
-+ * Pointer to new host, or NULL if no match found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_host_t *
-+qla4xxx_find_host_by_iscsiname(uint8_t *name)
-+{
-+ mp_host_t *host; /* Host found and null if not */
-+
-+ for (host = mp_hosts_base; (host); host = host->next) {
-+ if (memcmp(host->iscsiname, name, ISCSI_NAME_SIZE) == 0)
-+ break;
-+ }
-+ return host;
-+}
-+
-+
-+/*
-+ * qla4xxx_find_matching_lunid
-+ * Find the lun in the lun list that matches the
-+ * specified wwu lun number.
-+ *
-+ * Input:
-+ * buf = buffer that contains the wwuln
-+ * host = host to search for lun
-+ *
-+ * Returns:
-+ * NULL or pointer to lun
-+ *
-+ * Context:
-+ * Kernel context.
-+ * (dg)
-+ */
-+static mp_lun_t *
-+qla4xxx_find_matching_lunid(char *buf)
-+{
-+ int devid = 0;
-+ mp_host_t *temp_host; /* temporary pointer */
-+ mp_device_t *temp_dp; /* temporary pointer */
-+ mp_lun_t *lun;
-+
-+ ENTER(__func__);
-+
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ for (devid = 0; devid < MAX_MP_DEVICES; devid++) {
-+ temp_dp = temp_host->mp_devs[devid];
-+
-+ if (temp_dp == NULL)
-+ continue;
-+
-+ for( lun = temp_dp->luns; lun != NULL ;
-+ lun = lun->next ) {
-+
-+ if (lun->siz > WWLUN_SIZE )
-+ lun->siz = WWLUN_SIZE;
-+
-+ if (memcmp(lun->wwuln, buf, lun->siz) == 0)
-+ return lun;
-+ }
-+ }
-+ }
-+ return NULL;
-+
-+}
-+
-+/*
-+ * qla4xxx_combine_by_lunid
-+ * Look through the existing multipath control tree, and find
-+ * an mp_lun_t with the supplied world-wide lun number. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter to add device to.
-+ * dev_id Index of device on adapter.
-+ * port port database information.
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * If the MP HOST does not already point to the mp_device_t,
-+ * a pointer is added at the proper port offset.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_combine_by_lunid( void *vhost, uint16_t dev_id,
-+ fc_port_t *fcport, uint16_t pathid)
-+{
-+ mp_host_t *host = (mp_host_t *) vhost;
-+ int fail = 0;
-+ mp_path_t *path;
-+ mp_device_t *dp = NULL;
-+ fc_lun_t *fclun;
-+ mp_lun_t *lun;
-+ mp_port_t *port;
-+ int l;
-+
-+ ENTER("qla4xxx_combine_by_lunid");
-+ //printk("Entering %s\n", __func__);
-+
-+ /*
-+ * Currently mp_config_required is not process by this routine
-+ * because we create common nodename for the gui, so we can use
-+ * the normal common namename processing.
-+ */
-+#if MSA1000_SUPPORTED
-+ if (mp_initialized && fcport->flags & FCF_MSA_DEVICE) {
-+ qla4xxx_test_active_port(fcport);
-+ }
-+#endif
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ lun = qla4xxx_find_or_allocate_lun(host, dev_id,
-+ fcport, fclun);
-+
-+ if (lun == NULL) {
-+ fail++;
-+ continue;
-+ }
-+ /*
-+ * Find the path in the current path list, or allocate
-+ * a new one and put it in the list if it doesn't exist.
-+ */
-+ dp = lun->dp;
-+ if (fclun->mplun == NULL )
-+ fclun->mplun = lun;
-+ path = qla4xxx_find_or_allocate_path(host, dp,
-+ dp->dev_id, pathid, fcport);
-+ if (path == NULL || dp == NULL) {
-+ fail++;
-+ continue;
-+ }
-+
-+ /* set the lun active flag */
-+ if (mp_initialized && fcport->flags & FCF_EVA_DEVICE) {
-+ qla4xxx_test_active_lun(
-+ path->port, fclun );
-+ }
-+
-+ /* Add fclun to path list */
-+ if (lun->paths[path->id] == NULL) {
-+ lun->paths[path->id] = fclun;
-+ lun->path_cnt++;
-+ DEBUG2(printk(
-+ "Updated path[%d]= %p for lun %p; max paths=%d\n",
-+ path->id, fclun, lun,
-+ lun->path_cnt));
-+ if ( lun->info )
-+ lun->info->path_cnt = lun->path_cnt;
-+ }
-+
-+ /*
-+ * if we have a visible lun then make
-+ * the target visible as well
-+ */
-+ l = lun->number;
-+ if( (fclun->flags & FLF_VISIBLE_LUN) ) {
-+ if (dp->path_list->visible ==
-+ PATH_INDEX_INVALID) {
-+ dp->path_list->visible = path->id;
-+ DEBUG2(printk("%s: dp %p setting "
-+ "visible id to %d\n",
-+ __func__,dp,path->id );)
-+ }
-+ dp->path_list->current_path[l] = path->id;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+
-+ DEBUG2(printk("%s: Found a controller path 0x%x "
-+ "- lun %d\n", __func__, path->id,l);)
-+ } else if (mp_initialized) {
-+ /*
-+ * Whenever a port or lun is "active" then
-+ * force it to be a preferred path.
-+ */
-+ if (qla4xxx_find_first_active_path(dp, lun)
-+ == path ){
-+ dp->path_list->current_path[l] =
-+ path->id;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk(
-+ "%s: Found preferred lun at loopid=0x%02x, lun=%d, pathid=%d\n",
-+ __func__, fcport->loop_id, l, path->id);)
-+ }
-+ }
-+
-+ /* if (port->flags & FCF_CONFIG)
-+ path->config = 1; */
-+
-+ port = qla4xxx_find_or_allocate_port(host, lun, path);
-+ if (port == NULL) {
-+ fail++;
-+ continue;
-+ }
-+ }
-+
-+ if (fail) {
-+ /* turn off failover */
-+ // fcport->flags |= FCF_FAILOVER_DISABLE;
-+ return 0;
-+ }
-+ return 1;
-+}
-+
-+/*
-+ * qla4xxx_find_or_allocate_path
-+ * Look through the path list for the supplied device, and either
-+ * find the supplied adapter (path) for the adapter, or create
-+ * a new one and add it to the path list.
-+ *
-+ * Input:
-+ * host Adapter (path) for the device.
-+ * dp Device and path list for the device.
-+ * dev_id Index of device on adapter.
-+ * port Device data from port database.
-+ *
-+ * Returns:
-+ * Pointer to new PATH, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * 1. If the PATH_LIST does not already point to the PATH,
-+ * a new PATH is added to the PATH_LIST.
-+ * 2. If the new path is found to be a second visible path, it is
-+ * marked as hidden, and the device database is updated to be
-+ * hidden as well, to keep the miniport synchronized.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla4xxx_find_or_allocate_path(mp_host_t *host, mp_device_t *dp,
-+ uint16_t dev_id, uint16_t pathid, fc_port_t *port)
-+{
-+ mp_path_list_t *path_list = dp->path_list;
-+ mp_path_t *path;
-+ uint8_t id;
-+
-+
-+ ENTER("qla4xxx_find_or_allocate_path");
-+
-+ DEBUG4(printk("%s: host =%p, port =%p, dp=%p, dev id = %d\n",
-+ __func__, host, port, dp, dev_id);)
-+ /*
-+ * Loop through each known path in the path list. Look for
-+ * a PATH that matches both the adapter and the port name.
-+ */
-+ path = qla4xxx_find_path_by_name(host, path_list, port->iscsi_name);
-+
-+
-+ if (path != NULL ) {
-+ DEBUG3(printk("%s: Found an existing "
-+ "path %p- host %p inst=%d, port =%p, path id = %d\n",
-+ __func__, path, host, host->instance, path->port,
-+ path->id);)
-+ DEBUG3(printk("%s: Luns for path_id %d, instance %d\n",
-+ __func__, path->id, host->instance);)
-+ DEBUG3(qla4xxx_dump_buffer(
-+ (char *)&path->lun_data.data[0], 64);)
-+
-+ /* If we found an existing path, look for any changes to it. */
-+ if (path->port == NULL) {
-+ DEBUG3(printk("%s: update path %p w/ port %p, path id="
-+ "%d, path mp_byte=0x%x port mp_byte=0x%x.\n",
-+ __func__, path, port, path->id,
-+ path->mp_byte, port->mp_byte);)
-+ path->port = port;
-+ port->mp_byte = path->mp_byte;
-+ } else {
-+ DEBUG3(printk("%s: update path %p port %p path id %d, "
-+ "path mp_byte=0x%x port mp_byte=0x%x.\n",
-+ __func__, path, path->port, path->id,
-+ path->mp_byte, port->mp_byte);)
-+
-+ if ((path->mp_byte & MP_MASK_HIDDEN) &&
-+ !(port->mp_byte & MP_MASK_HIDDEN)) {
-+
-+ DEBUG3(printk("%s: Adapter(%p) "
-+ "Device (%p) Path (%d) "
-+ "has become visible.\n",
-+ __func__, host, dp, path->id);)
-+
-+ path->mp_byte &= ~MP_MASK_HIDDEN;
-+ }
-+
-+ if (!(path->mp_byte & MP_MASK_HIDDEN) &&
-+ (port->mp_byte & MP_MASK_HIDDEN)) {
-+
-+ DEBUG3(printk("%s(%ld): Adapter(%p) "
-+ "Device (%p) Path (%d) "
-+ "has become hidden.\n",
-+ __func__, host->ha->host_no, host,
-+ dp, path->id);)
-+
-+ path->mp_byte |= MP_MASK_HIDDEN;
-+ }
-+ }
-+
-+ } else {
-+ /*
-+ * If we couldn't find an existing path, and there is still
-+ * room to add one, allocate one and put it in the list.
-+ */
-+ if (path_list->path_cnt < MAX_PATHS_PER_DEVICE &&
-+ path_list->path_cnt < qla_fo_params.MaxPathsPerDevice) {
-+
-+ if (port->flags & FCF_CONFIG) {
-+ /* Use id specified in config file. */
-+ id = pathid;
-+ DEBUG3(printk("%s(%ld): using path id %d from "
-+ "config file.\n",
-+ __func__, host->ha->host_no, id);)
-+ } else {
-+ /* Assign one. */
-+ id = path_list->path_cnt;
-+ DEBUG3(printk(
-+ "%s(%ld): assigning path id %d.\n",
-+ __func__, host->ha->host_no, id);)
-+ }
-+
-+ /* Update port with bitmask info */
-+ path = qla4xxx_allocate_path(host, id, port, dev_id);
-+ if (path) {
-+#if defined(QL_DEBUG_LEVEL_3)
-+ printk("%s: allocated new path %p, adding path "
-+ "id %d, mp_byte=0x%x\n", __func__, path,
-+ id, path->mp_byte);
-+ if (path->port)
-+ printk("port=%p-"
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ path->port,
-+ path->port->iscsi_name[0],
-+ path->port->iscsi_name[1],
-+ path->port->iscsi_name[2],
-+ path->port->iscsi_name[3],
-+ path->port->iscsi_name[4],
-+ path->port->iscsi_name[5],
-+ path->port->iscsi_name[6],
-+ path->port->iscsi_name[7]);
-+#endif
-+ qla4xxx_add_path(path_list, path);
-+
-+ /*
-+ * Reconcile the new path against the existing
-+ * ones.
-+ */
-+ qla4xxx_setup_new_path(dp, path, port);
-+ }
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Err exit, no space to add path.\n",
-+ __func__);)
-+ }
-+
-+ }
-+
-+ LEAVE("qla4xxx_find_or_allocate_path");
-+
-+ return path;
-+}
-+
-+/*
-+ * qla4xxx_find_or_allocate_lun
-+ * Look through the existing multipath control tree, and find
-+ * an mp_lun_t with the supplied world-wide lun number. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter (lun) for the device.
-+ * fclun Lun data from port database.
-+ *
-+ * Returns:
-+ * Pointer to new LUN, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * 1. If the LUN_LIST does not already point to the LUN,
-+ * a new LUN is added to the LUN_LIST.
-+ * 2. If the DEVICE_LIST does not already point to the DEVICE,
-+ * a new DEVICE is added to the DEVICE_LIST.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_lun_t *
-+qla4xxx_find_or_allocate_lun(mp_host_t *host, uint16_t dev_id,
-+ fc_port_t *port, fc_lun_t *fclun)
-+{
-+ mp_lun_t *lun = NULL;
-+ mp_device_t *dp = NULL;
-+#if 0
-+ mp_device_t *temp_dp = NULL;
-+#endif
-+ uint16_t len = 0;
-+ uint16_t idx;
-+ uint16_t new_id = dev_id;
-+ char wwulnbuf[WWLUN_SIZE];
-+ int new_dev = 0;
-+ int i;
-+
-+
-+ ENTER("qla4xxx_find_or_allocate_lun");
-+ DEBUG(printk("Entering %s\n", __func__);)
-+
-+ if( fclun == NULL )
-+ return NULL;
-+
-+ DEBUG2(printk("%s: "
-+ " lun num=%d fclun %p mplun %p hba inst=%d, port =%p, dev id = %d\n",
-+ __func__, fclun->lun, fclun, fclun->mplun, host->instance, port,
-+ dev_id);)
-+ /*
-+ * Perform inquiry page 83 to get the wwuln or
-+ * use what was specified by the user.
-+ */
-+ if ( (port->flags & FCF_CONFIG) ) {
-+ if( (len = fclun->mplen) != 0 )
-+ memcpy(wwulnbuf, fclun->mpbuf, len);
-+ } else {
-+ if( port->device_type == TYPE_DISK ){
-+ len = qla4xxx_get_wwuln_from_device(host, fclun,
-+ &wwulnbuf[0], WWLUN_SIZE);
-+ /* if fail to do the inq then exit */
-+ if( len == 0 ) {
-+ return lun;
-+ }
-+ }
-+
-+ }
-+
-+ if( len != 0 )
-+ lun = qla4xxx_find_matching_lunid(wwulnbuf);
-+
-+ /*
-+ * If this is a visible "controller" lun and
-+ * it is already exists on somewhere world wide
-+ * then allocate a new device, so it can be
-+ * exported it to the OS.
-+ */
-+ if( ((fclun->flags & FLF_VISIBLE_LUN) ||
-+ (port->device_type != TYPE_DISK ) ) &&
-+ lun != NULL ) {
-+ if( fclun->mplun == NULL ) {
-+ lun = NULL;
-+ new_dev++;
-+ DEBUG2(printk("%s: Creating visible lun "
-+ "lun %p num %d fclun %p mplun %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, lun, fclun->lun, fclun, fclun->mplun, host->instance, port,
-+ dev_id);)
-+ } else {
-+ lun = fclun->mplun;
-+ return lun;
-+ }
-+ }
-+
-+ if (lun != NULL ) {
-+ DEBUG2(printk("%s: Found an existing "
-+ "lun %p num %d fclun %p host %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, lun, fclun->lun, fclun, host, host->instance, port,
-+ dev_id);)
-+ if( (dp = lun->dp ) == NULL ) {
-+ printk("NO dp pointer in alloacted lun\n");
-+ return NULL;
-+ }
-+ if( qla4xxx_is_iscsiname_in_device(dp,
-+ port->iscsi_name) ) {
-+
-+ DEBUG2(printk("%s: Found iscsiname (%s)"
-+ " match in mp_dev[%d] = %p\n",
-+ __func__,
-+ port->iscsi_name,
-+ dp->dev_id, dp);)
-+ if(host->mp_devs[dp->dev_id] == NULL ) {
-+ host->mp_devs[dp->dev_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ } else {
-+ DEBUG(printk("%s(%ld): MP_DEV no-match on iscsiname. adding new port - "
-+ "dev_id %d. "
-+ "iscsi_name (%s)\n",
-+ __func__, host->ha->host_no, dev_id,
-+ port->iscsi_name);)
-+
-+ qla4xxx_add_iscsiname_to_mp_dev(dp,
-+ port->iscsi_name, NULL);
-+
-+ DEBUG2(printk("%s(%d): (1) Added iscsiname and mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, dp->dev_id, dp);)
-+ if(host->mp_devs[dp->dev_id] == NULL ) {
-+ host->mp_devs[dp->dev_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ }
-+ } else {
-+ DEBUG2(printk("%s: MP_lun %d not found "
-+ "for fclun %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, fclun->lun, fclun, host->instance, port,
-+ dev_id);)
-+
-+ if( (dp = qla4xxx_find_mp_dev_by_iscsiname(host,
-+ port->iscsi_name, &idx)) == NULL || new_dev ) {
-+ DEBUG2(printk("%s(%d): No match for WWPN. Creating new mpdev \n"
-+ "iscsi_name (%s)\n",
-+ __func__, host->ha->host_no,
-+ port->iscsi_name );)
-+ dp = qla4xxx_allocate_mp_dev(port->iscsi_name, port->iscsi_name);
-+ /* find a good index */
-+ for( i = dev_id; i < MAX_MP_DEVICES; i++ )
-+ if(host->mp_devs[i] == NULL ) {
-+ new_id = i;
-+ break;
-+ }
-+ } else if( dp != NULL ) { /* found dp */
-+ new_id = dp->dev_id;
-+ }
-+
-+ if( dp != NULL ) {
-+ DEBUG2(printk("%s(%d): (2) mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, new_id, dp);)
-+ host->mp_devs[new_id] = dp;
-+ dp->dev_id = new_id;
-+ dp->use_cnt++;
-+ lun = kmalloc(sizeof(mp_lun_t), GFP_KERNEL);
-+ if (lun != NULL) {
-+ memset(lun, 0, sizeof(*lun));
-+ DEBUG(printk("Added lun %p to dp %p lun number %d\n",
-+ lun, dp, fclun->lun);)
-+ DEBUG(qla4xxx_dump_buffer(wwulnbuf, len);)
-+ memcpy(lun->wwuln, wwulnbuf, len);
-+ lun->siz = len;
-+ lun->number = fclun->lun;
-+ lun->dp = dp;
-+ qla4xxx_add_lun(dp, lun);
-+ INIT_LIST_HEAD(&lun->ports_list);
-+ }
-+ }
-+ else
-+ printk(KERN_WARNING
-+ "qla4xxx: Couldn't get memory for dp. \n");
-+ }
-+
-+ DEBUG(printk("Exiting %s\n", __func__);)
-+ LEAVE("qla4xxx_find_or_allocate_lun");
-+
-+ return lun;
-+}
-+
-+
-+static uint32_t
-+qla4xxx_cfg_register_failover_lun(mp_device_t *dp, srb_t *sp, fc_lun_t *new_lp)
-+{
-+ uint32_t status = QLA_SUCCESS;
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+ fc_lun_t *old_lp;
-+
-+ DEBUG2(printk(KERN_INFO "%s: NEW fclun = %p, sp = %p\n",
-+ __func__, new_lp, sp);)
-+
-+ /*
-+ * Fix lun descriptors to point to new fclun which is a new fcport.
-+ */
-+ if (new_lp == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed new lun %p\n",
-+ __func__, new_lp);)
-+ return QLA_ERROR;
-+ }
-+
-+ tq = sp->tgt_queue;
-+ lq = sp->lun_queue;
-+ if (tq == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old tq %p\n",
-+ __func__, tq);)
-+ return QLA_ERROR;
-+ }
-+ if (lq == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old lq %p\n",
-+ __func__, lq);)
-+ return QLA_ERROR;
-+ }
-+ old_lp = lq->fclun;
-+ lq->fclun = new_lp;
-+
-+ /* Log the failover to console */
-+ printk(KERN_INFO
-+ "qla4xxx: FAILOVER device %d from\n", dp->dev_id);
-+ printk(KERN_INFO
-+ " [%s] -> [%s]\n", old_lp->fcport->iscsi_name,
-+ new_lp->fcport->iscsi_name);
-+ printk(KERN_INFO
-+ " TGT %02x LUN %02x, reason=0x%x\n",
-+ tq->id, new_lp->lun, sp->err_id);
-+ printk(KERN_INFO
-+ " FROM HBA %d to HBA %d\n", (int)old_lp->fcport->ha->instance,
-+ (int)new_lp->fcport->ha->instance);
-+
-+ DEBUG3(printk("%s: NEW fclun = %p , port =%p, "
-+ "loop_id =0x%x, instance %ld\n",
-+ __func__,
-+ new_lp, new_lp->fcport,
-+ new_lp->fcport->loop_id,
-+ new_lp->fcport->ha->instance);)
-+
-+ return status;
-+}
-+
-+
-+/*
-+ * qla4xxx_send_failover_notify
-+ * A failover operation has just been done from an old path
-+ * index to a new index. Call lower level driver
-+ * to perform the failover notification.
-+ *
-+ * Inputs:
-+ * device Device being failed over.
-+ * lun LUN being failed over.
-+ * newpath path that was failed over too.
-+ * oldpath path that was failed over from.
-+ *
-+ * Return:
-+ * Local function status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static uint32_t
-+qla4xxx_send_failover_notify(mp_device_t *dp,
-+ uint8_t lun, mp_path_t *newpath, mp_path_t *oldpath)
-+{
-+ fc_lun_t *old_lp, *new_lp;
-+ uint32_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_send_failover_notify");
-+
-+ if ((old_lp = qla4xxx_find_matching_lun(lun, dp, oldpath)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old lun %p, %d\n",
-+ __func__, old_lp,lun);)
-+ return QLA_ERROR;
-+ }
-+ if ((new_lp = qla4xxx_find_matching_lun(lun, dp, newpath)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get new lun %p,%d\n",
-+ __func__, new_lp,lun);)
-+ return QLA_ERROR;
-+ }
-+
-+ /*
-+ * If the target is the same target, but a new HBA has been selected,
-+ * send a third party logout if required.
-+ */
-+ if ((qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET ||
-+ qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_CDB) &&
-+ qla4xxx_is_name_equal(
-+ oldpath->iscsiname, newpath->iscsiname)) {
-+
-+ status = qla4xxx_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Logout succeded\n",
-+ __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Logout Failed\n",
-+ __func__);)
-+ }
-+ } else if ((qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LUN_RESET) ||
-+ (qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET)) {
-+
-+ /*
-+ * If desired, send a LUN reset as the
-+ * failover notification type.
-+ */
-+ if (newpath->lun_data.data[lun] & LUN_DATA_ENABLED) {
-+ status = qla4xxx_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: LUN reset succeeded.\n",
-+ __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failed reset LUN.\n",
-+ __func__);)
-+ }
-+ }
-+
-+ } else if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_CDB ||
-+ qla_fo_params.FailoverNotifyType ==
-+ FO_NOTIFY_TYPE_LOGOUT_OR_CDB) {
-+
-+ if (newpath->lun_data.data[lun] & LUN_DATA_ENABLED) {
-+ status = qla4xxx_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Send CDB succeeded.\n",
-+ __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Send CDB Error "
-+ "lun=(%d).\n", __func__, lun);)
-+ }
-+ }
-+ } else if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_SPINUP ||
-+ old_lp->fcport->notify_type == FO_NOTIFY_TYPE_SPINUP ){
-+
-+ status = qla4xxx_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG(printk("%s: Send CDB succeeded.\n",
-+ __func__);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG(printk("%s: Send CDB Error "
-+ "lun=(%d).\n", __func__, lun);)
-+ }
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: failover disabled or no notify routine "
-+ "defined.\n", __func__);)
-+ }
-+
-+ return status;
-+}
-+
-+static mp_path_t *
-+qla4xxx_find_host_from_port(mp_device_t *dp,
-+ mp_host_t *host,
-+ mp_port_t *port )
-+{
-+ unsigned long instance;
-+ uint8_t id;
-+ int i;
-+ mp_path_t *path = NULL;
-+
-+ /* get next host instance */
-+ instance = host->instance;
-+ for(i = 0 ; i < port->cnt ; i++ ) {
-+ instance = instance + 1;
-+ DEBUG3(printk("%s: Finding new instance %d, max %d, cnt %d\n",
-+ __func__, (int)instance, port->cnt, i);)
-+ /* Handle wrap-around */
-+ if( instance == port->cnt )
-+ instance = 0;
-+ if( port->hba_list[instance] == NULL )
-+ continue;
-+ if( port->hba_list[instance] != host->ha )
-+ break;
-+ }
-+ /* Found a different hba then return the path to it */
-+ if ( i != port->cnt ) {
-+ id = port->path_list[instance];
-+ DEBUG2(printk("%s: Changing to new host - pathid=%d\n",
-+ __func__, id);)
-+ path = qla4xxx_find_path_by_id(dp, id);
-+ }
-+ return( path );
-+}
-+
-+/*
-+ * Find_best_port
-+ * This routine tries to locate the best port to the target that
-+ * doesn't require issuing a target notify command.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla4xxx_find_best_port(mp_device_t *dp,
-+ mp_path_t *orig_path,
-+ mp_port_t *port,
-+ fc_lun_t *fclun )
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_t *new_path;
-+ mp_port_t *temp_port;
-+ int i, found;
-+ fc_lun_t *new_fp;
-+ struct list_head *list, *temp;
-+ mp_lun_t *mplun = (mp_lun_t *)fclun->mplun;
-+ unsigned long instance;
-+ uint16_t id;
-+
-+ found = 0;
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ temp_port = list_entry(list, mp_port_t, list);
-+ if ( port == temp_port ) {
-+ continue;
-+ }
-+ /* Search for an active matching lun on any HBA,
-+ but starting with the orig HBA */
-+ instance = orig_path->host->instance;
-+ for(i = 0 ; i < temp_port->cnt ; instance++) {
-+ if( instance == MAX_HOSTS )
-+ instance = 0;
-+ id = temp_port->path_list[instance];
-+ DEBUG(printk(
-+ "qla%d %s: i=%d, Checking temp port=%p, pathid=%d\n",
-+ (int)instance,__func__, i, temp_port, id);)
-+ if (id == PATH_INDEX_INVALID)
-+ continue;
-+ i++; /* found a valid hba entry */
-+ new_fp = mplun->paths[id];
-+ DEBUG(printk(
-+ "qla%d %s: Checking fclun %p, for pathid=%d\n",
-+ (int)instance,__func__, new_fp, id);)
-+ if( new_fp == NULL )
-+ continue;
-+ new_path = qla4xxx_find_path_by_id(dp, id);
-+ if( new_path != NULL ) {
-+ DEBUG(printk(
-+ "qla%d %s: Found new path new_fp=%p, "
-+ "path=%p, flags=0x%x\n",
-+ (int)new_path->host->instance,__func__, new_fp,
-+ new_path, new_path->port->flags);)
-+
-+
-+ if (atomic_read(&new_path->port->state) ==
-+ FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("qla(%d) %s - Port (0x%04x) "
-+ "DEAD.\n", (int)new_path->host->instance,
-+ __func__, new_path->port->loop_id));
-+ continue;
-+ }
-+
-+ /* Is this path on an active controller? */
-+ if( (new_path->port->flags & FCF_EVA_DEVICE) &&
-+ !(new_fp->flags & FLF_ACTIVE_LUN) ){
-+ DEBUG2(printk("qla(%d) %s - EVA Port (0x%04x) INACTIVE.\n",
-+ (int)new_path->host->instance, __func__,
-+ new_path->port->loop_id);)
-+ continue;
-+ }
-+
-+ if( (new_path->port->flags & FCF_MSA_DEVICE) &&
-+ !(new_path->port->flags & FCF_MSA_PORT_ACTIVE) ) {
-+ DEBUG2(printk("qla(%d) %s - MSA Port (0x%04x) INACTIVE.\n",
-+ (int)new_path->host->instance, __func__,
-+ new_path->port->loop_id);)
-+ continue;
-+ }
-+
-+ /* found a good path */
-+ DEBUG2(printk(
-+ "qla%d %s: *** Changing from port %p to new port %p - pathid=%d\n",
-+ (int)instance,__func__, port, temp_port, new_path->id); )
-+ return( new_path );
-+ }
-+ }
-+ }
-+
-+ return( path );
-+}
-+
-+void
-+qla4xxx_find_all_active_ports(srb_t *sp)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ uint16_t lun;
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Scanning for active ports...\n", __func__);)
-+
-+ lun = sp->lun_queue->fclun->lun;
-+
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each_entry(ha, &qla4xxx_hostlist, list) {
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (fcport->flags & (FCF_EVA_DEVICE | FCF_MSA_DEVICE)) {
-+ list_for_each_entry(fclun, &fcport->fcluns,
-+ list) {
-+ if (fclun->flags & FLF_VISIBLE_LUN)
-+ continue;
-+ if (lun != fclun->lun)
-+ continue;
-+
-+ qla4xxx_test_active_lun(fcport, fclun);
-+ }
-+ }
-+#if MSA1000_SUPPORTED
-+ if ((fcport->flags & FCF_MSA_DEVICE))
-+ qla4xxx_test_active_port(fcport);
-+#endif
-+ }
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Done Scanning ports...\n", __func__);)
-+}
-+
-+/*
-+ * qla4xxx_smart_failover
-+ * This routine tries to be smart about how it selects the
-+ * next path. It selects the next path base on whether the
-+ * loop went down or the port went down. If the loop went
-+ * down it will select the next HBA. Otherwise, it will select
-+ * the next port.
-+ *
-+ * Inputs:
-+ * device Device being failed over.
-+ * sp Request that initiated failover.
-+ * orig_path path that was failed over from.
-+ *
-+ * Return:
-+ * next path next path to use.
-+ * flag 1 - Don't send notify command
-+ * 0 - Send notify command
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla4xxx_smart_path(mp_device_t *dp,
-+ mp_path_t *orig_path, srb_t *sp, int *flag )
-+{
-+ mp_path_t *path = NULL;
-+ fc_lun_t *fclun;
-+ mp_port_t *port;
-+ mp_host_t *host= orig_path->host;
-+
-+ DEBUG2(printk("Entering %s - sp err = %d, instance =%d\n",
-+ __func__, sp->err_id, (int)host->instance);)
-+
-+ qla4xxx_find_all_active_ports(sp);
-+
-+ if( sp != NULL ) {
-+ fclun = sp->lun_queue->fclun;
-+ if( fclun == NULL ) {
-+ printk( KERN_INFO
-+ "scsi%d %s: couldn't find fclun %p pathid=%d\n",
-+ (int)host->instance,__func__, fclun, orig_path->id);
-+ return( orig_path->next );
-+ }
-+ port = qla4xxx_find_port_by_name(
-+ (mp_lun_t *)fclun->mplun, orig_path);
-+ if( port == NULL ) {
-+ printk( KERN_INFO
-+ "scsi%d %s: couldn't find MP port %p pathid=%d\n",
-+ (int)host->instance,__func__, port, orig_path->id);
-+ return( orig_path->next );
-+ }
-+
-+ /* Change to next HOST if loop went down */
-+ if( sp->err_id == SRB_ERR_LOOP ) {
-+ path = qla4xxx_find_host_from_port(dp,
-+ host, port );
-+ if( path != NULL ) {
-+ port->fo_cnt++;
-+ *flag = 1;
-+ /* if we used all the hbas then
-+ try and get another port */
-+ if( port->fo_cnt > port->cnt ) {
-+ port->fo_cnt = 0;
-+ *flag = 0;
-+ path =
-+ qla4xxx_find_best_port(dp,
-+ orig_path, port, fclun );
-+ if( path )
-+ *flag = 1;
-+ }
-+ }
-+ } else {
-+ path = qla4xxx_find_best_port(dp,
-+ orig_path, port, fclun );
-+ if( path )
-+ *flag = 1;
-+ }
-+ }
-+ /* Default path is next path*/
-+ if (path == NULL)
-+ path = orig_path->next;
-+
-+ DEBUG3(printk("Exiting %s\n", __func__);)
-+ return path;
-+}
-+
-+/*
-+ * qla4xxx_select_next_path
-+ * A problem has been detected with the current path for this
-+ * device. Try to select the next available path as the current
-+ * path for this device. If there are no more paths, the same
-+ * path will still be selected.
-+ *
-+ * Inputs:
-+ * dp pointer of device structure.
-+ * lun LUN to failover.
-+ *
-+ * Return Value:
-+ * new path or same path
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla4xxx_select_next_path(mp_host_t *host, mp_device_t *dp, uint8_t lun,
-+ srb_t *sp)
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_list_t *path_list;
-+ mp_path_t *orig_path;
-+ int id;
-+ uint32_t status;
-+ mp_host_t *new_host;
-+ int skip_notify= 0;
-+#if 0
-+ fc_lun_t *new_fp = NULL;
-+#endif
-+
-+
-+ ENTER("qla4xxx_select_next_path:");
-+
-+ path_list = dp->path_list;
-+ if (path_list == NULL)
-+ return NULL;
-+
-+ /* Get current path */
-+ id = path_list->current_path[lun];
-+
-+ /* Get path for current path id */
-+ if ((orig_path = qla4xxx_find_path_by_id(dp, id)) != NULL) {
-+ /* select next path */
-+ if (orig_path->port && (orig_path->port->flags &
-+ (FCF_MSA_DEVICE|FCF_EVA_DEVICE))) {
-+ path = qla4xxx_smart_path(dp, orig_path, sp,
-+ &skip_notify);
-+ } else
-+ path = orig_path->next;
-+
-+ new_host = path->host;
-+
-+ /* FIXME may need to check for HBA being reset */
-+ DEBUG2(printk("%s: orig path = %p new path = %p "
-+ "curr idx = %d, new idx = %d\n",
-+ __func__, orig_path, path, orig_path->id, path->id);)
-+ DEBUG3(printk(" FAILOVER: device name: %s\n",
-+ dp->devname);)
-+ DEBUG3(printk(" Original - host name: %s\n",
-+ orig_path->host->iscsi_name);)
-+ DEBUG3(printk(" path name: %s\n",
-+ orig_path->port->iscsi_name);)
-+ DEBUG3(printk(" New - host name: %s\n",
-+ new_host->iscsi_name);)
-+ DEBUG3(printk(" path name: %s\n",
-+ path->port->iscsi_name);)
-+
-+ path_list->current_path[lun] = path->id;
-+ /* If we selected a new path, do failover notification. */
-+ if ( (path != orig_path) && !skip_notify ) {
-+ status = qla4xxx_send_failover_notify(
-+ dp, lun, path, orig_path);
-+
-+ /*
-+ * Currently we ignore the returned status from
-+ * the notify. however, if failover notify fails
-+ */
-+ }
-+ }
-+
-+ LEAVE("qla4xxx_select_next_path:");
-+
-+ return path ;
-+}
-+
-+
-+
-+/*
-+ * qla4xxx_update_mp_host
-+ * Update the multipath control information from the port
-+ * database for that adapter.
-+ *
-+ * Input:
-+ * host Adapter to update. Devices that are new are
-+ * known to be attached to this adapter.
-+ *
-+ * Returns:
-+ * 1 if updated successfully; 0 if error.
-+ *
-+ */
-+static uint8_t
-+qla4xxx_update_mp_host(mp_host_t *host)
-+{
-+ uint8_t success = 1;
-+ uint16_t dev_id;
-+ fc_port_t *fcport;
-+ scsi_qla_host_t *ha = host->ha;
-+
-+ ENTER("qla4xxx_update_mp_host");
-+
-+ /*
-+ * We make sure each port is attached to some virtual device.
-+ */
-+ dev_id = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ DEBUG2(printk("%s(%d): checking fcport list. update port "
-+ "%p-%02x%02x%02x%02x%02x%02x%02x%02x dev_id %d "
-+ "to ha inst %d.\n",
-+ __func__, ha->host_no,
-+ fcport,
-+ fcport->iscsi_name[0], fcport->iscsi_name[1],
-+ fcport->iscsi_name[2], fcport->iscsi_name[3],
-+ fcport->iscsi_name[4], fcport->iscsi_name[5],
-+ fcport->iscsi_name[6], fcport->iscsi_name[7],
-+ dev_id, ha->instance);)
-+
-+ qla4xxx_configure_cfg_device(fcport);
-+ success |= qla4xxx_update_mp_device(host, fcport, dev_id, 0);
-+ dev_id++;
-+ }
-+ if (success) {
-+ DEBUG2(printk(KERN_INFO "%s: Exit OK\n", __func__);)
-+ qla4xxx_map_os_targets(host);
-+ } else {
-+ /* EMPTY */
-+ DEBUG2(printk(KERN_INFO "%s: Exit FAILED\n", __func__);)
-+ }
-+
-+ DEBUG2(printk("%s: inst %d exiting.\n", __func__, ha->instance);)
-+ LEAVE("qla4xxx_update_mp_host");
-+
-+ return success;
-+}
-+
-+/*
-+ * qla4xxx_update_mp_device
-+ * Update the multipath control information from the port
-+ * database for that adapter.
-+ *
-+ * Inputs:
-+ * host Host adapter structure
-+ * port Device to add to the path tree.
-+ * dev_id Device id
-+ *
-+ * Synchronization:
-+ * The Adapter Lock should have already been acquired
-+ * before calling this routine.
-+ *
-+ * Return
-+ * 1 if updated successfully; 0 if error.
-+ *
-+ */
-+uint8_t
-+qla4xxx_update_mp_device(mp_host_t *host,
-+ fc_port_t *port, uint16_t dev_id, uint16_t pathid)
-+{
-+ uint8_t success = 1;
-+
-+ ENTER("qla4xxx_update_mp_device");
-+
-+ DEBUG3(printk("%s(%ld): entered. host %p inst=%d,"
-+ "port iscsi_name=%s, dev id = %d\n",
-+ __func__, host->ha->host_no, host, host->instance,
-+ port->iscsi_name,
-+ dev_id);)
-+
-+ if (!qla4xxx_is_name_zero(port->iscsi_name)) {
-+ if( port->fo_combine ) {
-+ return( port->fo_combine(host, dev_id, port, pathid) );
-+ } else
-+ success = qla4xxx_combine_by_lunid( host, dev_id, port, pathid );
-+
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failed iscsiname empty.\n",
-+ __func__);)
-+ }
-+
-+ DEBUG3(printk("%s(%ld): exiting.\n",
-+ __func__, host->ha->host_no);)
-+ LEAVE("qla4xxx_update_mp_device");
-+
-+ return success;
-+}
-+
-+/*
-+ * qla4xxx_update_mp_tree
-+ * Get port information from each adapter, and build or rebuild
-+ * the multipath control tree from this data. This is called
-+ * from init and during port database notification.
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Return:
-+ * Local function return code.
-+ *
-+ */
-+static uint32_t
-+qla4xxx_update_mp_tree(void)
-+{
-+ mp_host_t *host;
-+ uint32_t rval = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_update_mp_tree:");
-+
-+ /* Loop through each adapter and see what needs updating. */
-+ for (host = mp_hosts_base; (host) ; host = host->next) {
-+
-+ DEBUG4(printk("%s: hba(%d) flags (%x)\n",
-+ __func__, host->instance, host->flags);)
-+ /* Clear the countdown; it may be reset in the update. */
-+ host->relogin_countdown = 0;
-+
-+ /* Override the NEEDS_UPDATE flag if disabled. */
-+ if (host->flags & MP_HOST_FLAG_DISABLE ||
-+ list_empty(host->fcports))
-+ host->flags &= ~MP_HOST_FLAG_NEEDS_UPDATE;
-+
-+ if (host->flags & MP_HOST_FLAG_NEEDS_UPDATE) {
-+
-+ /*
-+ * Perform the actual updates. If this succeeds, clear
-+ * the flag that an update is needed, and failback all
-+ * devices that are visible on this path to use this
-+ * path. If the update fails, leave set the flag that
-+ * an update is needed, and it will be picked back up
-+ * during the next timer routine.
-+ */
-+ if (qla4xxx_update_mp_host(host)) {
-+ host->flags &= ~MP_HOST_FLAG_NEEDS_UPDATE;
-+
-+ qla4xxx_failback_luns(host);
-+ } else
-+ rval = QLA_ERROR;
-+
-+ }
-+
-+ }
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit FAILED.\n", __func__);)
-+
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit OK.\n", __func__);)
-+ }
-+ return rval;
-+}
-+
-+
-+
-+/*
-+ * qla4xxx_find_matching_lun_by_num
-+ * Find the lun in the path that matches the
-+ * specified lun number.
-+ *
-+ * Input:
-+ * lun = lun number
-+ * newpath = path to search for lun
-+ *
-+ * Returns:
-+ * NULL or pointer to lun
-+ *
-+ * Context:
-+ * Kernel context.
-+ * (dg)
-+ */
-+static fc_lun_t *
-+qla4xxx_find_matching_lun_by_num(uint16_t lun_no, mp_device_t *dp,
-+ mp_path_t *newpath)
-+{
-+ int found;
-+ fc_lun_t *lp = NULL; /* lun ptr */
-+ fc_port_t *fcport; /* port ptr */
-+ mp_lun_t *lun;
-+
-+ /* Use the lun list if we have one */
-+ if( dp->luns ) {
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ if( lun_no == lun->number ) {
-+ lp = lun->paths[newpath->id];
-+ break;
-+ }
-+ }
-+ } else {
-+ if ((fcport = newpath->port) != NULL) {
-+ found = 0;
-+ list_for_each_entry(lp, &fcport->fcluns, list) {
-+ if (lun_no == lp->lun) {
-+ found++;
-+ break;
-+ }
-+ }
-+ if (!found)
-+ lp = NULL;
-+ }
-+ }
-+ return lp;
-+}
-+
-+static fc_lun_t *
-+qla4xxx_find_matching_lun(uint8_t lun, mp_device_t *dp,
-+ mp_path_t *newpath)
-+{
-+ fc_lun_t *lp;
-+
-+ lp = qla4xxx_find_matching_lun_by_num(lun, dp, newpath);
-+
-+ return lp;
-+}
-+
-+/*
-+ * qla4xxx_find_path_by_name
-+ * Find the path specified iscsiname from the pathlist
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * pathlist = multi-path path list
-+ * iscsiname iscsiname to search for
-+ *
-+ * Returns:
-+ * pointer to the path or NULL
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_path_t *
-+qla4xxx_find_path_by_name(mp_host_t *host, mp_path_list_t *plp,
-+ uint8_t *iscsiname)
-+{
-+ mp_path_t *path = NULL; /* match if not NULL */
-+ mp_path_t *tmp_path;
-+ int cnt;
-+
-+ if ((tmp_path = plp->last) != NULL) {
-+ for (cnt = 0; (tmp_path) && cnt < plp->path_cnt; cnt++) {
-+ if (tmp_path->host == host &&
-+ qla4xxx_is_name_equal(
-+ tmp_path->iscsiname, iscsiname)) {
-+
-+ path = tmp_path;
-+ break;
-+ }
-+ tmp_path = tmp_path->next;
-+ }
-+ }
-+ return path ;
-+}
-+
-+/*
-+ * qla4xxx_find_path_by_id
-+ * Find the path for the specified path id.
-+ *
-+ * Input:
-+ * dp multi-path device
-+ * id path id
-+ *
-+ * Returns:
-+ * pointer to the path or NULL
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla4xxx_find_path_by_id(mp_device_t *dp, uint8_t id)
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_t *tmp_path;
-+ mp_path_list_t *path_list;
-+ int cnt;
-+
-+ path_list = dp->path_list;
-+ tmp_path = path_list->last;
-+ for (cnt = 0; (tmp_path) && cnt < path_list->path_cnt; cnt++) {
-+ if (tmp_path->id == id) {
-+ path = tmp_path;
-+ break;
-+ }
-+ tmp_path = tmp_path->next;
-+ }
-+ return path ;
-+}
-+
-+/*
-+ * qla4xxx_find_mp_dev_by_id
-+ * Find the mp_dev for the specified target id.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * tgt = Target id
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla4xxx_find_mp_dev_by_id(mp_host_t *host, uint16_t id )
-+{
-+ if (id < MAX_MP_DEVICES)
-+ return host->mp_devs[id];
-+ else
-+ return NULL;
-+}
-+
-+/*
-+ * qla4xxx_find_mp_dev_by_iscsiname
-+ * Find the mp_dev for the specified target name.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * name = port name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla4xxx_find_mp_dev_by_iscsiname(mp_host_t *host, uint8_t *name, uint16_t *pidx)
-+{
-+ int id;
-+ mp_device_t *dp = NULL;
-+
-+ DEBUG3(printk("%s: entered.\n", __func__);)
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id] ) == NULL)
-+ continue;
-+
-+ if (qla4xxx_is_iscsiname_in_device(dp, name)) {
-+ DEBUG3(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id);)
-+ *pidx = id;
-+ return dp;
-+ }
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__);)
-+
-+ return NULL;
-+ }
-+
-+/*
-+ * qla4xxx_get_visible_path
-+ * Find the the visible path for the specified device.
-+ *
-+ * Input:
-+ * dp = device pointer
-+ *
-+ * Returns:
-+ * NULL or path
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla4xxx_get_visible_path(mp_device_t *dp)
-+{
-+ uint16_t id;
-+ mp_path_list_t *path_list;
-+ mp_path_t *path;
-+
-+ path_list = dp->path_list;
-+ /* if we don't have a visible path skip it */
-+ if ((id = path_list->visible) == PATH_INDEX_INVALID) {
-+ return NULL;
-+ }
-+
-+ if ((path = qla4xxx_find_path_by_id(dp,id))== NULL)
-+ return NULL;
-+
-+ return path ;
-+}
-+
-+/*
-+ * qla4xxx_map_os_targets
-+ * Allocate the luns and setup the OS target.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_map_os_targets(mp_host_t *host)
-+{
-+ scsi_qla_host_t *ha = host->ha;
-+ mp_path_t *path;
-+ mp_device_t *dp;
-+ os_tgt_t *tgt;
-+ int t;
-+
-+ ENTER("qla4xxx_map_os_targets ");
-+
-+ for (t = 0; t < MAX_TARGETS; t++ ) {
-+ dp = host->mp_devs[t];
-+ if (dp != NULL) {
-+ DEBUG2(printk("%s: (%d) found a dp=%p, "
-+ "host=%p, ha=%p\n",
-+ __func__, t, dp, host,ha);)
-+
-+ if ((path = qla4xxx_get_visible_path(dp)) == NULL) {
-+ DEBUG2( printk(KERN_INFO
-+ "qla_cfg(%d): No visible path "
-+ "for target %d, dp = %p\n",
-+ host->instance, t, dp); )
-+ continue;
-+ }
-+
-+ /* if not the visible path skip it */
-+ if (path->host == host) {
-+ if (TGT_Q(ha, t) == NULL) {
-+ /* XXX need to check for NULL */
-+ tgt = qla4xxx_tgt_alloc(ha, t);
-+ if( tgt == NULL )
-+ continue;
-+ memcpy(tgt->iscsi_name,dp->devname,
-+ ISCSI_NAME_SIZE);
-+ tgt->fcport = path->port;
-+ tgt->id = dp->dev_id;
-+ }
-+ if (path->port)
-+ path->port->os_target_id = t;
-+
-+ DEBUG3(printk("%s(%ld): host instance =%d, "
-+ "device= %p, tgt=%d has VISIBLE path,"
-+ "path id=%d\n",
-+ __func__, ha->host_no,
-+ host->instance,
-+ dp, t, path->id);)
-+ } else {
-+ /* EMPTY */
-+ DEBUG3(printk("%s(%ld): host instance =%d, "
-+ "device= %p, tgt=%d has HIDDEN "
-+ "path, path id=%d\n",
-+ __func__, ha->host_no,
-+ host->instance, dp, t,
-+ path->id); )
-+ continue;
-+ }
-+ qla4xxx_map_os_luns(host, dp, t);
-+ } else {
-+ if ((tgt= TGT_Q(ha,t)) != NULL) {
-+ qla4xxx_tgt_free(ha,t);
-+ }
-+ }
-+ }
-+
-+ LEAVE("qla4xxx_map_os_targets ");
-+}
-+
-+static void
-+qla4xxx_map_or_failover_oslun(mp_host_t *host, mp_device_t *dp,
-+ uint16_t t, uint16_t lun_no)
-+{
-+ int i;
-+
-+ /*
-+ * if this is initization time and we couldn't map the
-+ * lun then try and find a usable path.
-+ */
-+ if ( qla4xxx_map_a_oslun(host, dp, t, lun_no) &&
-+ (host->flags & MP_HOST_FLAG_LUN_FO_ENABLED) ){
-+ /* find a path for us to use */
-+ for ( i = 0; i < dp->path_list->path_cnt; i++ ){
-+ qla4xxx_select_next_path(host, dp, lun_no, NULL);
-+ if( !qla4xxx_map_a_oslun(host, dp, t, lun_no))
-+ break;
-+ }
-+ }
-+}
-+
-+/*
-+ * qla4xxx_map_os_luns
-+ * Allocate the luns for the OS target.
-+ *
-+ * Input:
-+ * dp = pointer to device
-+ * t = OS target number.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_map_os_luns(mp_host_t *host, mp_device_t *dp, uint16_t t)
-+{
-+ uint16_t lun_no;
-+ mp_lun_t *lun;
-+ os_lun_t *up;
-+
-+ DEBUG3(printk("Entering %s..\n",__func__);)
-+
-+ /* if we are using lun binding then scan for the discovered luns */
-+ if( dp->luns ) {
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ lun_no = lun->number;
-+ DEBUG2(printk("%s: instance %d: Mapping target %d, lun %d..\n",
-+ __func__,host->instance,t,lun->number);)
-+ qla4xxx_map_or_failover_oslun(host, dp,
-+ t, lun_no);
-+ up = (os_lun_t *) GET_LU_Q(host->ha, t, lun_no);
-+ if (up == NULL || up->fclun == NULL) {
-+ DEBUG2(printk("%s: instance %d: No FCLUN for target %d, lun %d.. \n",
-+ __func__,host->instance,t,lun->number);)
-+ continue;
-+ }
-+ if (up->fclun->fcport == NULL) {
-+ DEBUG2(printk("%s: instance %d: No FCPORT for target %d, lun %d.. \n",
-+ __func__,host->instance,t,lun->number);)
-+ continue;
-+ }
-+ DEBUG2(printk("%s: instance %d: Mapping target %d, lun %d.. to path id %d\n",
-+ __func__,host->instance,t,lun->number,
-+ up->fclun->fcport->cur_path);)
-+ if (lun->info == NULL )
-+ lun->info =
-+ (struct fo_information *) up->fo_info;
-+ }
-+ } else {
-+ for (lun_no = 0; lun_no < MAX_LUNS; lun_no++ ) {
-+ qla4xxx_map_or_failover_oslun(host, dp,
-+ t, lun_no);
-+ }
-+ }
-+ DEBUG3(printk("Exiting %s..\n",__func__);)
-+}
-+
-+/*
-+ * qla4xxx_map_a_osluns
-+ * Map the OS lun to the current path
-+ *
-+ * Input:
-+ * host = pointer to host
-+ * dp = pointer to device
-+ * lun = OS lun number.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+
-+static uint8_t
-+qla4xxx_map_a_oslun(mp_host_t *host, mp_device_t *dp, uint16_t t, uint16_t lun)
-+{
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ os_lun_t *lq;
-+ uint16_t id;
-+ mp_path_t *path, *vis_path;
-+ mp_host_t *vis_host;
-+ uint8_t status = 0;
-+ struct fo_information *mp_info;
-+
-+ if ((id = dp->path_list->current_path[lun]) != PATH_INDEX_INVALID) {
-+ DEBUG3(printk( "qla4xxx(%d): Current path for lun %d is path id %d\n",
-+ host->instance,
-+ lun, id);)
-+ path = qla4xxx_find_path_by_id(dp,id);
-+ if (path) {
-+ fcport = path->port;
-+ if (fcport) {
-+
-+ fcport->cur_path = id;
-+ fclun = qla4xxx_find_matching_lun(lun,dp,path);
-+ DEBUG3(printk( "qla4xxx(%d): found fclun %p, path id = %d\n", host->instance,fclun,id);)
-+
-+ /* Always map all luns if they are enabled */
-+ if (fclun &&
-+ (path->lun_data.data[lun] &
-+ LUN_DATA_ENABLED) ) {
-+ DEBUG(printk( "qla4xxx(%d): Current path for lun %d/%p is path id %d\n",
-+ host->instance,
-+ lun, fclun, id);)
-+ DEBUG3(printk( "qla4xxx(%d): Lun is enable \n", host->instance);)
-+
-+ /*
-+ * Mapped lun on the visible path
-+ */
-+ if ((vis_path =
-+ qla4xxx_get_visible_path(dp)) ==
-+ NULL ) {
-+
-+ printk(KERN_INFO
-+ "qla4xxx(%d): No visible "
-+ "path for target %d, "
-+ "dp = %p\n",
-+ host->instance,
-+ t, dp);
-+
-+ return 0;
-+ }
-+ vis_host = vis_path->host;
-+
-+ /* ra 11/30/01 */
-+ /*
-+ * Always alloc LUN 0 so kernel
-+ * will scan past LUN 0.
-+ */
-+#if 0
-+ if (lun != 0 &&
-+ (EXT_IS_LUN_BIT_SET(
-+ &(fcport->lun_mask), lun))) {
-+
-+ /* mask this LUN */
-+ return 0;
-+ }
-+#endif
-+
-+ if ((lq = qla4xxx_lun_alloc(
-+ vis_host->ha,
-+ t, lun)) != NULL) {
-+
-+ lq->fclun = fclun;
-+ mp_info = (struct fo_information *) lq->fo_info;
-+ mp_info->path_cnt = dp->path_list->path_cnt;
-+ }
-+ DEBUG(printk( "qla4xxx(%d): lun allocated %p for lun %d\n",
-+ host->instance,lq,lun);)
-+ }
-+ }
-+ else
-+ status = 1;
-+ }
-+ }
-+ return status;
-+}
-+
-+/*
-+ * qla4xxx_is_name_zero
-+ *
-+ * Input:
-+ * name = Pointer to WW name to check
-+ *
-+ * Returns:
-+ * 1 if name is 0 else 0
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint8_t
-+qla4xxx_is_name_zero(uint8_t *nn)
-+{
-+ int cnt;
-+
-+ /* Check for zero node name */
-+ for (cnt = 0; cnt < ISCSI_NAME_SIZE ; cnt++, nn++) {
-+ if (*nn != 0)
-+ break;
-+ }
-+ /* if zero return 1 */
-+ if (cnt == ISCSI_NAME_SIZE)
-+ return 1;
-+ else
-+ return 0;
-+}
-+
-+/*
-+ * qla4xxx_add_path
-+ * Add a path to the pathlist
-+ *
-+ * Input:
-+ * pathlist -- path list of paths
-+ * path -- path to be added to list
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_add_path( mp_path_list_t *pathlist, mp_path_t *path )
-+{
-+ mp_path_t *last = pathlist->last;
-+
-+ ENTER("qla4xxx_add_path");
-+ DEBUG3(printk("%s: entered for path id %d.\n",
-+ __func__, path->id);)
-+
-+ DEBUG3(printk("%s: pathlist =%p, path =%p, cnt = %d\n",
-+ __func__, pathlist, path, pathlist->path_cnt);)
-+ if (last == NULL) {
-+ last = path;
-+ } else {
-+ path->next = last->next;
-+ }
-+
-+ last->next = path;
-+ pathlist->last = path;
-+ pathlist->path_cnt++;
-+
-+ DEBUG3(printk("%s: exiting. path cnt=%d.\n",
-+ __func__, pathlist->path_cnt);)
-+ LEAVE("qla4xxx_add_path");
-+}
-+
-+static void
-+qla4xxx_add_lun( mp_device_t *dp, mp_lun_t *lun)
-+{
-+ mp_lun_t *cur_lun;
-+
-+ ENTER("qla4xxx_add_lun");
-+
-+ /* Insert new entry into the list of luns */
-+ lun->next = NULL;
-+
-+ cur_lun = dp->luns;
-+ if( cur_lun == NULL ) {
-+ dp->luns = lun;
-+ } else {
-+ /* add to tail of list */
-+ while( cur_lun->next != NULL )
-+ cur_lun = cur_lun->next;
-+
-+ cur_lun->next = lun;
-+ }
-+ LEAVE("qla4xxx_add_lun");
-+}
-+
-+/*
-+ * qla4xxx_is_iscsiname_in_device
-+ * Search for the specified "iscsiname" in the device list.
-+ *
-+ * Input:
-+ * dp = device pointer
-+ * iscsiname = iscsiname to searched for in device
-+ *
-+ * Returns:
-+ * qla4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_is_iscsiname_in_device(mp_device_t *dp, uint8_t *iscsiname)
-+{
-+ int idx;
-+
-+ for (idx = 0; idx < MAX_PATHS_PER_DEVICE; idx++) {
-+ if (memcmp(&dp->iscsinames[idx][0], iscsiname, ISCSI_NAME_SIZE) == 0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+
-+/*
-+ * qla4xxx_set_lun_data_from_bitmask
-+ * Set or clear the LUN_DATA_ENABLED bits in the LUN_DATA from
-+ * a LUN bitmask provided from the miniport driver.
-+ *
-+ * Inputs:
-+ * lun_data = Extended LUN_DATA buffer to set.
-+ * lun_mask = Pointer to lun bit mask union.
-+ *
-+ * Return Value: none.
-+ */
-+void
-+qla4xxx_set_lun_data_from_bitmask(mp_lun_data_t *lun_data,
-+ lun_bit_mask_t *lun_mask)
-+{
-+ int16_t lun;
-+
-+ ENTER("qla4xxx_set_lun_data_from_bitmask");
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ /* our bit mask is inverted */
-+#if 0
-+ if (!(EXT_IS_LUN_BIT_SET(lun_mask,lun)))
-+ lun_data->data[lun] |= LUN_DATA_ENABLED;
-+ else
-+ lun_data->data[lun] &= ~LUN_DATA_ENABLED;
-+#else
-+ lun_data->data[lun] |= LUN_DATA_ENABLED;
-+#endif
-+
-+ DEBUG5(printk("%s: lun data[%d] = 0x%x\n",
-+ __func__, lun, lun_data->data[lun]);)
-+ }
-+
-+ LEAVE("qla4xxx_set_lun_data_from_bitmask");
-+
-+ return;
-+}
-+
-+static void
-+qla4xxx_failback_single_lun(mp_device_t *dp, uint8_t lun, uint8_t new)
-+{
-+ mp_path_list_t *pathlist;
-+ mp_path_t *new_path, *old_path;
-+ uint8_t old;
-+ mp_host_t *host;
-+ os_lun_t *lq;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+ struct fo_information *mp_info;
-+
-+ /* Failback and update statistics. */
-+ if ((pathlist = dp->path_list) == NULL)
-+ return;
-+
-+ old = pathlist->current_path[lun];
-+ pathlist->current_path[lun] = new;
-+
-+ if ((new_path = qla4xxx_find_path_by_id(dp, new)) == NULL)
-+ return;
-+ if ((old_path = qla4xxx_find_path_by_id(dp, old)) == NULL)
-+ return;
-+
-+ /* An fclun should exist for the failbacked lun */
-+ if (qla4xxx_find_matching_lun(lun, dp, new_path) == NULL)
-+ return;
-+ if (qla4xxx_find_matching_lun(lun, dp, old_path) == NULL)
-+ return;
-+
-+ /* Log to console and to event log. */
-+ printk(KERN_INFO
-+ "qla4xxx: FAILBACK device %d -> "
-+ "[%s] LUN %02x\n",
-+ dp->dev_id, dp->devname, lun);
-+
-+ printk(KERN_INFO
-+ "qla4xxx: FROM HBA %d to HBA %d \n",
-+ old_path->host->instance,
-+ new_path->host->instance);
-+
-+
-+ /* Send a failover notification. */
-+ qla4xxx_send_failover_notify(dp, lun, new_path, old_path);
-+
-+ host = new_path->host;
-+
-+ /* remap the lun */
-+ qla4xxx_map_a_oslun(host, dp, dp->dev_id, lun);
-+
-+ /* 7/16
-+ * Reset counts on the visible path
-+ */
-+ if ((vis_path = qla4xxx_get_visible_path(dp)) == NULL) {
-+ printk(KERN_INFO
-+ "qla4xxx(%d): No visible path for "
-+ "target %d, dp = %p\n",
-+ host->instance,
-+ dp->dev_id, dp);
-+ return;
-+ }
-+
-+ vis_host = vis_path->host;
-+ if ((lq = qla4xxx_lun_alloc(vis_host->ha, dp->dev_id, lun)) != NULL) {
-+ mp_info = (struct fo_information *) lq->fo_info;
-+ mp_info->path_cnt = dp->path_list->path_cnt;
-+ qla4xxx_delay_lun(vis_host->ha, lq, ql4xrecoveryTime);
-+ qla4xxx_flush_failover_q(vis_host->ha, lq);
-+ qla4xxx_reset_lun_fo_counts(vis_host->ha, lq);
-+ }
-+}
-+
-+#if 0
-+static void
-+qla4xxx_failback_single_lun(mp_device_t *dp, uint8_t lun, uint8_t new)
-+{
-+ mp_path_list_t *pathlist;
-+ mp_path_t *new_path, *old_path;
-+ uint8_t old;
-+ mp_host_t *new_host;
-+ os_lun_t *lq;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+ int status;
-+
-+ /* Failback and update statistics. */
-+ if ((pathlist = dp->path_list) == NULL)
-+ return;
-+
-+ old = pathlist->current_path[lun];
-+ /* pathlist->current_path[lun] = new; */
-+
-+ if ((new_path = qla4xxx_find_path_by_id(dp, new)) == NULL)
-+ return;
-+ if ((old_path = qla4xxx_find_path_by_id(dp, old)) == NULL)
-+ return;
-+
-+ /* An fclun should exist for the failbacked lun */
-+ if (qla4xxx_find_matching_lun(lun, dp, new_path) == NULL)
-+ return;
-+ if (qla4xxx_find_matching_lun(lun, dp, old_path) == NULL)
-+ return;
-+
-+ if ((vis_path = qla4xxx_get_visible_path(dp)) == NULL) {
-+ printk(KERN_INFO
-+ "No visible path for "
-+ "target %d, dp = %p\n",
-+ dp->dev_id, dp);
-+ return;
-+ }
-+ vis_host = vis_path->host;
-+ /* Schedule the recovery before we move the luns */
-+ if( (lq = (os_lun_t *)
-+ LUN_Q(vis_host->ha, dp->dev_id, lun)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla4xxx(%d): No visible lun for "
-+ "target %d, dp = %p, lun=%d\n",
-+ vis_host->instance,
-+ dp->dev_id, dp, lun);
-+ return;
-+ }
-+
-+ qla4xxx_delay_lun(vis_host->ha, lq, ql4xrecoveryTime);
-+
-+ /* Log to console and to event log. */
-+ printk(KERN_INFO
-+ "qla4xxx: FAILBACK device %d -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x LUN %02x\n",
-+ dp->dev_id,
-+ dp->devname[0], dp->devname[1],
-+ dp->devname[2], dp->devname[3],
-+ dp->devname[4], dp->devname[5],
-+ dp->devname[6], dp->devname[7],
-+ lun);
-+
-+ printk(KERN_INFO
-+ "qla4xxx: FROM HBA %d to HBA %d \n",
-+ old_path->host->instance,
-+ new_path->host->instance);
-+
-+
-+ /* Send a failover notification. */
-+ status = qla4xxx_send_failover_notify(dp, lun,
-+ new_path, old_path);
-+
-+ new_host = new_path->host;
-+
-+ /* remap the lun */
-+ if (status == QLA_SUCCESS ) {
-+ pathlist->current_path[lun] = new;
-+ qla4xxx_map_a_oslun(new_host, dp, dp->dev_id, lun);
-+ qla4xxx_flush_failover_q(vis_host->ha, lq);
-+ qla4xxx_reset_lun_fo_counts(vis_host->ha, lq);
-+ }
-+}
-+#endif
-+
-+/*
-+* qla4xxx_failback_luns
-+* This routine looks through the devices on an adapter, and
-+* for each device that has this adapter as the visible path,
-+* it forces that path to be the current path. This allows us
-+* to keep some semblance of static load balancing even after
-+* an adapter goes away and comes back.
-+*
-+* Arguments:
-+* host Adapter that has just come back online.
-+*
-+* Return:
-+* None.
-+*/
-+static void
-+qla4xxx_failback_luns( mp_host_t *host)
-+{
-+ uint16_t dev_no;
-+ uint8_t l;
-+ uint16_t lun;
-+ int i;
-+ mp_device_t *dp;
-+ mp_path_list_t *path_list;
-+ mp_path_t *path;
-+ fc_lun_t *new_fp;
-+
-+ ENTER("qla4xxx_failback_luns");
-+
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ path_list = dp->path_list;
-+ for (path = path_list->last, i= 0;
-+ i < path_list->path_cnt;
-+ i++, path = path->next) {
-+
-+ if (path->host != host )
-+ continue;
-+
-+ if (path->port == NULL)
-+ continue;
-+
-+ if (atomic_read(&path->port->state) == FCS_DEVICE_DEAD)
-+ continue;
-+
-+ if ((path->port->flags & FCF_FAILBACK_DISABLE))
-+ continue;
-+
-+ /*
-+ * Failback all the paths for this host,
-+ * the luns could be preferred across all paths
-+ */
-+ DEBUG4(printk("%s(%d): Lun Data for device %p, "
-+ "dev id=%d, path id=%d\n",
-+ __func__, host->instance, dp, dp->dev_id,
-+ path->id);)
-+ DEBUG4(qla4xxx_dump_buffer(
-+ (char *)&path->lun_data.data[0], 64);)
-+ DEBUG4(printk("%s(%d): Perferrred Path data:\n",
-+ __func__, host->instance);)
-+ DEBUG4(qla4xxx_dump_buffer(
-+ (char *)&path_list->current_path[0], 64);)
-+
-+ for (lun = 0; lun < MAX_LUNS_PER_DEVICE; lun++) {
-+ l = (uint8_t)(lun & 0xFF);
-+
-+ /*
-+ * if this is the preferred lun and not
-+ * the current path then failback lun.
-+ */
-+ DEBUG4(printk("%s: target=%d, cur path id =%d, "
-+ "lun data[%d] = %d)\n",
-+ __func__, dp->dev_id, path->id,
-+ lun, path->lun_data.data[lun]);)
-+
-+ if ((path->lun_data.data[l] &
-+ LUN_DATA_PREFERRED_PATH) &&
-+ /* !path->relogin && */
-+ path_list->current_path[l] !=
-+ path->id) {
-+ /* No point in failing back a
-+ disconnected lun */
-+ new_fp = qla4xxx_find_matching_lun(
-+ l, dp, path);
-+
-+ if (new_fp == NULL)
-+ continue;
-+ /* Skip a disconect lun */
-+ if (new_fp->device_type & 0x20)
-+ continue;
-+
-+ qla4xxx_failback_single_lun(
-+ dp, l, path->id);
-+ }
-+ }
-+ }
-+
-+ }
-+
-+ LEAVE("qla4xxx_failback_luns");
-+
-+ return;
-+}
-+
-+static struct _mp_path *
-+qla4xxx_find_first_active_path( mp_device_t *dp, mp_lun_t *lun)
-+{
-+ mp_path_t *path= NULL;
-+ mp_path_list_t *plp = dp->path_list;
-+ mp_path_t *tmp_path;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ int cnt;
-+
-+ if ((tmp_path = plp->last) != NULL) {
-+ tmp_path = tmp_path->next;
-+ for (cnt = 0; (tmp_path) && cnt < plp->path_cnt;
-+ tmp_path = tmp_path->next, cnt++) {
-+ fcport = tmp_path->port;
-+ if (fcport != NULL) {
-+ if ((fcport->flags & FCF_EVA_DEVICE)) {
-+ fclun = lun->paths[tmp_path->id];
-+ if (fclun == NULL)
-+ continue;
-+ if (fclun->flags & FLF_ACTIVE_LUN) {
-+ path = tmp_path;
-+ break;
-+ }
-+ } else {
-+ if ((fcport->flags &
-+ FCF_MSA_PORT_ACTIVE)) {
-+ path = tmp_path;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return path;
-+}
-+
-+/*
-+ * qla4xxx_setup_new_path
-+ * Checks the path against the existing paths to see if there
-+ * are any incompatibilities. It then checks and sets up the
-+ * current path indices.
-+ *
-+ * Inputs:
-+ * dp = pointer to device
-+ * path = new path
-+ *
-+ * Returns:
-+ * None
-+ */
-+static void
-+qla4xxx_setup_new_path( mp_device_t *dp, mp_path_t *path, fc_port_t *fcport)
-+{
-+ mp_path_list_t *path_list = dp->path_list;
-+ mp_path_t *tmp_path, *first_path;
-+ mp_host_t *first_host;
-+ mp_host_t *tmp_host;
-+
-+ uint16_t lun;
-+ uint8_t l;
-+ int i;
-+
-+ ENTER("qla4xxx_setup_new_path");
-+ DEBUG(printk("qla4xxx_setup_new_path: path %p path id %d, fcport = %p\n",
-+ path, path->id, path->port);)
-+
-+ /* If this is a visible path, and there is not already a
-+ * visible path, save it as the visible path. If there
-+ * is already a visible path, log an error and make this
-+ * path invisible.
-+ */
-+ if (!(path->mp_byte & (MP_MASK_HIDDEN | MP_MASK_UNCONFIGURED))) {
-+
-+ /* No known visible path */
-+ if (path_list->visible == PATH_INDEX_INVALID) {
-+ DEBUG3(printk("%s: No know visible path - make this "
-+ "path visible\n",
-+ __func__);)
-+
-+ path_list->visible = path->id;
-+ path->mp_byte &= ~MP_MASK_HIDDEN;
-+ } else {
-+ DEBUG3(printk("%s: Second visible path found- make "
-+ "this one hidden\n",
-+ __func__);)
-+
-+ path->mp_byte |= MP_MASK_HIDDEN;
-+ }
-+ if (path->port)
-+ path->port->mp_byte = path->mp_byte;
-+ }
-+
-+ /*
-+ * If this is not the first path added, and the setting for
-+ * MaxLunsPerTarget does not match that of the first path
-+ * then disable qla_cfg for all adapters.
-+ */
-+ first_path = qla4xxx_find_path_by_id(dp, 0);
-+
-+ if (first_path != NULL) {
-+ first_host = first_path->host;
-+ if ((path->id != 0) &&
-+ (first_host->MaxLunsPerTarget !=
-+ path->host->MaxLunsPerTarget)) {
-+
-+ for (tmp_path = path_list->last, i = 0;
-+ (tmp_path) && i <= path->id; i++) {
-+
-+ tmp_host = tmp_path->host;
-+ if (!(tmp_host->flags &
-+ MP_HOST_FLAG_DISABLE)) {
-+
-+ DEBUG4(printk("%s: 2nd visible "
-+ "path (%p)\n",
-+ __func__, tmp_host);)
-+
-+ tmp_host->flags |= MP_HOST_FLAG_DISABLE;
-+ }
-+ }
-+ }
-+ }
-+
-+ if (!(fcport->flags & (FCF_MSA_DEVICE | FCF_EVA_DEVICE))) {
-+ /*
-+ * For each LUN, evaluate whether the new path that is added is
-+ * better than the existing path. If it is, make it the
-+ * current path for the LUN.
-+ */
-+ for (lun = 0; lun < MAX_LUNS_PER_DEVICE; lun++) {
-+ l = (uint8_t)(lun & 0xFF);
-+
-+ /*
-+ * If this is the first path added, it is the only
-+ * available path, so make it the current path.
-+ */
-+ DEBUG4(printk("%s: lun_data 0x%x, LUN %d\n",
-+ __func__, path->lun_data.data[l], lun);)
-+
-+ if (first_path == path) {
-+ path_list->current_path[l] = 0;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ } else if (path->lun_data.data[l] &
-+ LUN_DATA_PREFERRED_PATH) {
-+ /*
-+ * If this is not the first path added, if this
-+ * is the preferred path, so make it the
-+ * current path.
-+ */
-+ path_list->current_path[l] = path->id;
-+ }
-+ }
-+ }
-+
-+ LEAVE("qla4xxx_setup_new_path");
-+
-+ return;
-+}
-+
-+/*
-+ * qla4xxx_cfg_mem_free
-+ * Free all configuration structures.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_cfg_mem_free(scsi_qla_host_t *ha)
-+{
-+ mp_lun_t *cur_lun;
-+ mp_lun_t *tmp_lun;
-+ mp_device_t *dp;
-+ mp_path_list_t *path_list;
-+ mp_path_t *tmp_path, *path;
-+ mp_host_t *host, *temp;
-+ mp_port_t *temp_port;
-+ struct list_head *list, *temp_list;
-+ int id, cnt;
-+
-+ down(&mp_hosts_lock);
-+ if ((host = qla4xxx_cfg_find_host(ha)) != NULL) {
-+ if( mp_num_hosts == 0 )
-+ return;
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id]) == NULL)
-+ continue;
-+ if ((path_list = dp->path_list) == NULL)
-+ continue;
-+ if ((tmp_path = path_list->last) == NULL)
-+ continue;
-+ for (cnt = 0; cnt < path_list->path_cnt; cnt++) {
-+ path = tmp_path;
-+ tmp_path = tmp_path->next;
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing path[%d] "
-+ "= %p\n",
-+ host->instance,
-+ cnt, path);)
-+ kfree(path);
-+ }
-+ kfree(path_list);
-+ host->mp_devs[id] = NULL;
-+ /* remove dp from other hosts */
-+ for (temp = mp_hosts_base; (temp); temp = temp->next) {
-+ if (temp->mp_devs[id] == dp) {
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing host[%d] = "
-+ "%p\n",
-+ host->instance,
-+ temp->instance,temp);)
-+ temp->mp_devs[id] = NULL;
-+ }
-+ }
-+ /* Free all the lun struc's attached
-+ * to this mp_device */
-+ for ( cur_lun = dp->luns; (cur_lun != NULL);
-+ cur_lun = cur_lun->next) {
-+ DEBUG2(printk(KERN_INFO
-+ "host%d - Removing lun:%p "
-+ "attached to device:%p\n",
-+ host->instance,
-+ cur_lun,dp);)
-+ list_for_each_safe(list, temp_list,
-+ &cur_lun->ports_list) {
-+
-+ temp_port = list_entry(list, mp_port_t, list);
-+ list_del_init(&temp_port->list);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "host%d - Removing port:%p "
-+ "attached to lun:%p\n",
-+ host->instance, temp_port,
-+ cur_lun);)
-+ kfree(temp_port);
-+
-+ }
-+ tmp_lun = cur_lun;
-+ kfree(tmp_lun);
-+ }
-+ kfree(dp);
-+ }
-+
-+ /* remove this host from host list */
-+ temp = mp_hosts_base;
-+ if (temp != NULL) {
-+ /* Remove from top of queue */
-+ if (temp == host) {
-+ mp_hosts_base = host->next;
-+ } else {
-+ /*
-+ * Remove from middle of queue
-+ * or bottom of queue
-+ */
-+ for (temp = mp_hosts_base;
-+ temp != NULL;
-+ temp = temp->next) {
-+
-+ if (temp->next == host) {
-+ temp->next = host->next;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ kfree(host);
-+ mp_num_hosts--;
-+ }
-+ up(&mp_hosts_lock);
-+}
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfg.h ./drivers/scsi/qla4xxx/ql4_cfg.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfg.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_cfg.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,242 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2003-2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * QLogic ISP4xxx Multi-path LUN Support
-+ * Multi-path include file.
-+ */
-+
-+#if !defined(_QLA_CFG_H)
-+#define _QLA_CFG_H
-+
-+#if defined(__cplusplus)
-+extern "C"
-+{
-+#endif
-+
-+/*
-+ * Failover definitions
-+ */
-+#define FAILOVER_TYPE_COUNT 4
-+#define MP_NOTIFY_RESET_DETECTED 1
-+#define MP_NOTIFY_PWR_LOSS 2
-+#define MP_NOTIFY_LOOP_UP 3
-+#define MP_NOTIFY_LOOP_DOWN 4
-+#define MP_NOTIFY_BUS_RESET 5
-+#define FAILOVER_TYPE_ERROR_RETRY 1
-+#define MAX_NUMBER_PATHS FO_MAX_PATHS
-+#define PORT_NAME_SIZE WWN_SIZE
-+#define FAILOVER_NOTIFY_STATUS_ERROR QLA_SUCCESS
-+#define FAILOVER_NOTIFY_STATUS_SUCCESS QLA_SUCCESS
-+#define FAILOVER_NOTIFY_CDB_LENGTH_MAX FO_NOTIFY_CDB_LENGTH_MAX
-+#define MAX_TARGETS_PER_DEVICE SDM_DEF_MAX_TARGETS_PER_DEVICE
-+
-+/*
-+ * Limits definitions.
-+ */
-+#define MAX_LUNS_PER_DEVICE MAX_LUNS /* Maximum # of luns */
-+#define MAX_MP_DEVICES MAX_TARGETS /* Maximum # of virtual devs */
-+#define MAX_PATHS_PER_DEVICE 8 /* Maximum # of paths */
-+#if !defined(MAX_LUNS)
-+#define MAX_LUNS 256
-+#endif
-+#define MAX_HOSTS MAX_HBAS
-+
-+/* Async notification types */
-+#define NOTIFY_EVENT_LINK_DOWN 1 /* Link went down */
-+#define NOTIFY_EVENT_LINK_UP 2 /* Link is back up */
-+#define NOTIFY_EVENT_RESET_DETECTED 3 /* Reset detected */
-+
-+#define VITAL_PRODUCT_DATA_SIZE 32 /* 32 */
-+#define INQ_EVPD_SET 1
-+#define INQ_DEV_IDEN_PAGE 0x83
-+#define WWLUN_SIZE VITAL_PRODUCT_DATA_SIZE
-+
-+/* MACROS */
-+#if 0
-+#define qla4xxx_is_portname_equal(N1,N2) \
-+ ((memcmp((N1),(N2),WWN_SIZE)==0?TRUE:FALSE))
-+#define qla4xxx_is_nodename_equal(N1,N2) \
-+ ((memcmp((N1),(N2),WWN_SIZE)==0?TRUE:FALSE))
-+#endif
-+
-+/*
-+ * Per-multipath driver parameters
-+ */
-+typedef struct _mp_lun_data {
-+ uint8_t data[MAX_LUNS];
-+#define LUN_DATA_ENABLED BIT_7
-+#define LUN_DATA_PREFERRED_PATH BIT_6
-+}
-+mp_lun_data_t;
-+
-+
-+#define PATH_INDEX_INVALID 0xff
-+
-+/*
-+ * Per-device collection of all paths.
-+ */
-+typedef struct _mp_path_list {
-+ struct _mp_path *last; /* ptrs to end of circular list of paths */
-+ uint8_t path_cnt; /* number of paths */
-+ uint8_t visible; /* visible path */
-+ uint16_t reserved1; /* Memory alignment */
-+ uint32_t reserved2; /* Memory alignment */
-+ uint8_t current_path[ MAX_LUNS_PER_DEVICE ]; /* current path for a given lun */
-+ uint16_t failover_cnt[ FAILOVER_TYPE_COUNT ];
-+}
-+mp_path_list_t;
-+
-+/*
-+ * Definitions for failover notify SRBs. These SRBs contain failover notify
-+ * CDBs to notify a target that a failover has occurred.
-+ *
-+ */
-+typedef struct _failover_notify_srb {
-+ srb_t *srb;
-+ uint16_t status;
-+ uint16_t reserved;
-+}
-+failover_notify_srb_t;
-+
-+typedef struct _mp_lun {
-+ struct _mp_lun *next;
-+ struct _mp_device *dp; /* Multipath device */
-+ int number; /* actual lun number */
-+ fc_lun_t *paths[MAX_PATHS_PER_DEVICE]; /* list of fcluns */
-+ struct list_head ports_list;
-+ int path_cnt; /* Must be > 1 for fo device */
-+ int siz; /* Size of wwuln */
-+ struct fo_information *info;
-+ uint8_t wwuln[WWLUN_SIZE];/* lun id from inquiry page 83. */
-+}
-+mp_lun_t;
-+
-+typedef struct _mp_port {
-+ struct list_head list;
-+ uint8_t iscsiname[ISCSI_NAME_SIZE];
-+ uint8_t path_list[ MAX_HOSTS ]; /* path index for a given HBA */
-+ scsi_qla_host_t *hba_list[ MAX_HOSTS ];
-+ int cnt;
-+ int fo_cnt;
-+ ulong total_blks; /* blocks transferred on this port */
-+}
-+mp_port_t;
-+
-+/*
-+ * Per-device multipath control data.
-+ */
-+typedef struct _mp_device {
-+ mp_path_list_t *path_list; /* Path list for device. */
-+ int dev_id;
-+ int use_cnt; /* number of users */
-+ struct _mp_lun *luns; /* list of luns */
-+ uint8_t devname[ISCSI_NAME_SIZE]; /* World-wide node name for device. */
-+
-+ uint8_t iscsinames[MAX_PATHS_PER_DEVICE][ISCSI_NAME_SIZE];
-+}
-+mp_device_t;
-+
-+/*
-+ * Per-adapter multipath Host
-+ */
-+typedef struct _mp_host {
-+ struct _mp_host *next; /* ptr to next host adapter in list */
-+ scsi_qla_host_t *ha; /* ptr to lower-level driver adapter struct */
-+ int instance; /* OS instance number */
-+ struct list_head *fcports; /* Port chain for this adapter */
-+ mp_device_t *mp_devs[MAX_MP_DEVICES]; /* Multipath devices */
-+
-+ uint32_t flags;
-+#define MP_HOST_FLAG_NEEDS_UPDATE BIT_0 /* Need to update device data. */
-+#define MP_HOST_FLAG_FO_ENABLED BIT_1 /* Failover enabled for this host */
-+#define MP_HOST_FLAG_DISABLE BIT_2 /* Bypass qla_cfg. */
-+#define MP_HOST_FLAG_LUN_FO_ENABLED BIT_3 /* lun Failover enabled */
-+
-+ uint8_t iscsiname[ISCSI_NAME_SIZE]; /* World-wide node name for device. */
-+ uint16_t MaxLunsPerTarget;
-+
-+ uint16_t relogin_countdown;
-+}
-+mp_host_t;
-+
-+/*
-+ * Describes path a single.
-+ */
-+typedef struct _mp_path {
-+ struct _mp_path *next; /* next path in list */
-+ struct _mp_host *host; /* Pointer to adapter */
-+ fc_port_t *port; /* FC port info */
-+ uint16_t id; /* Path id (index) */
-+ uint16_t flags;
-+ uint8_t mp_byte; /* Multipath control byte */
-+#define MP_MASK_HIDDEN 0x80
-+#define MP_MASK_UNCONFIGURED 0x40
-+#define MP_MASK_OVERRIDE 0x10 /* MC_MASK_SEPARATE_TARGETS */
-+#define MP_MASK_PRIORITY 0x07
-+
-+ uint8_t relogin; /* Need to relogin to port */
-+ uint8_t config; /* User configured path */
-+ uint8_t reserved[3];
-+ mp_lun_data_t lun_data; /* Lun data information */
-+ uint8_t iscsiname[ISCSI_NAME_SIZE]; /* World-wide node name for device. */
-+}
-+mp_path_t;
-+
-+/*
-+ * Failover notification requests from host driver.
-+ */
-+typedef struct failover_notify_entry {
-+ struct scsi_address *os_addr;
-+}
-+failover_notify_t;
-+
-+struct fo_information {
-+ uint8_t path_cnt;
-+ uint32_t fo_retry_cnt[MAX_PATHS_PER_DEVICE];
-+};
-+
-+#if 0
-+/* ** NEW simified version of T3 ** */
-+typedef struct {
-+ uint8_t entry_type;
-+ uint8_t entry_status;
-+ uint8_t system_defined;
-+ uint8_t entry_count;
-+
-+ uint32_t handle;
-+ uint16_t target;
-+ uint16_t connection_id;
-+
-+ uint8_t control_flags;
-+ uint8_t state_flags;
-+ uint8_t cmd_ref_num;
-+ uint8_t reserved1;
-+ uint8_t scsi_cdb[IOCB_MAX_CDB_LEN];
-+ uint8_t lun[8];
-+ uint32_t cmd_seq_num;
-+ uint16_t timeout;
-+ uint16_t desg_count;
-+ uint32_t byte_count;
-+ uint32_t dseg_0_address[2];
-+ uint32_t dseg_0_length;
-+} cmd_entry_t;
-+#endif
-+
-+#endif /* _QLA_CFG_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfgln.c ./drivers/scsi/qla4xxx/ql4_cfgln.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_cfgln.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_cfgln.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,571 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * QLogic ISP4xxx Multi-path LUN Support Driver
-+ * Linux specific functions
-+ *
-+ */
-+
-+// #include "ql4_os.h"
-+#include "ql4_def.h"
-+/*
-+#include "ql4_foln.h"
-+*/
-+
-+#define MAX_SEARCH_STR_SIZE 512
-+
-+/*
-+ * qla4xxx_set_lun_data_from_config
-+ * Set lun_data byte from the configuration parameters.
-+ *
-+ * Input:
-+ * host -- pointer to host adapter structure.
-+ * port -- pointer to port
-+ * tgt -- target number
-+ * dev_no -- device number
-+ */
-+void
-+qla4xxx_set_lun_data_from_config(mp_host_t *host, fc_port_t *port,
-+ uint16_t tgt, uint16_t dev_no)
-+{
-+#if 0
-+ char *propbuf; /* As big as largest search string */
-+ int rval;
-+ int16_t lun, l;
-+ scsi_qla_host_t *ha = host->ha;
-+ mp_device_t *dp;
-+ lun_bit_mask_t *plun_mask;
-+ lun_bit_mask_t *mask_ptr;
-+ mp_path_list_t *pathlist;
-+
-+ mp_path_t *path;
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&propbuf,
-+ MAX_SEARCH_STR_SIZE)) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "propbuf requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ MAX_SEARCH_STR_SIZE);)
-+ return;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&plun_mask,
-+ sizeof(lun_bit_mask_t))) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "lun_mask requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(lun_bit_mask_t));)
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+ mask_ptr = plun_mask;
-+
-+ dp = host->mp_devs[tgt];
-+ if (dp == NULL) {
-+ printk("qla4xxx_set_lun_data_from_config: Target %d "
-+ "not found for hba %d\n",tgt, host->instance);
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+ if ( (pathlist = dp->path_list) == NULL ) {
-+ printk("qla4xxx_set_lun_data_from_config: path list "
-+ "not found for target %d\n", tgt);
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ if ((path = qla4xxx_find_path_by_name(host, pathlist,
-+ port->port_name)) == NULL ) {
-+ printk("qla4xxx_set_lun_data_from_config: No path found "
-+ "for target %d\n", tgt);
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ /* Get "target-N-device-N-preferred" as a 256 bit lun_mask*/
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-preferred", ha->instance,
-+ tgt, dev_no);
-+ DEBUG3(printk("build_tree: %s\n",propbuf);)
-+
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)(plun_mask), sizeof(lun_bit_mask_t));
-+
-+ if (rval == -1) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(%ld): no preferred mask entry found for "
-+ "path id %d on port %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]);)
-+ } else {
-+ if (rval != sizeof(lun_bit_mask_t)) {
-+ /* EMPTY */
-+ printk("qla4xxx_set_lun_data_from_config: "
-+ "Preferred mask len %d is incorrect.\n", rval);
-+ }
-+
-+ DEBUG3(printk("%s(%ld): reading Preferred Mask for path id %d "
-+ "on port %02x%02x%02x%02x%02x%02x%02x%02x:\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]);)
-+ DEBUG3(qla4xxx_dump_buffer((char *)plun_mask,
-+ sizeof(lun_bit_mask_t));)
-+
-+ for (lun = MAX_LUNS-1, l =0; lun >= 0; lun--, l++ ) {
-+ if (EXT_IS_LUN_BIT_SET(mask_ptr, lun)) {
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ pathlist->current_path[l] = path->id;
-+ } else {
-+ path->lun_data.data[l] &=
-+ ~LUN_DATA_PREFERRED_PATH;
-+ }
-+ }
-+
-+ }
-+
-+ /* Get "target-N-device-N-lun-disable" as a 256 bit lun_mask*/
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-lun-disabled", ha->instance,
-+ tgt, dev_no);
-+ DEBUG3(printk("build_tree: %s\n",propbuf);)
-+
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)plun_mask, sizeof(lun_bit_mask_t));
-+ if (rval == -1) {
-+ /* default: all luns enabled */
-+ DEBUG3(printk("%s(%ld): no entry found for path id %d. "
-+ "Assume all LUNs enabled on port %02x%02x%02x%02x%02x%"
-+ "02x%02x%02x.\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]);)
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ path->lun_data.data[lun] |= LUN_DATA_ENABLED;
-+ }
-+ } else {
-+ if (rval != sizeof(lun_bit_mask_t)) {
-+ printk("qla4xxx_set_lun_data_from_config: Enable "
-+ "mask has wrong size %d != %ld\n",
-+ rval, (ulong)sizeof(lun_bit_mask_t));
-+ } else {
-+ for (lun = MAX_LUNS-1, l =0; lun >= 0; lun--, l++) {
-+ /* our bit mask is inverted */
-+ if (!EXT_IS_LUN_BIT_SET(mask_ptr,lun))
-+ path->lun_data.data[l] |=
-+ LUN_DATA_ENABLED;
-+ else
-+ path->lun_data.data[l] &=
-+ ~LUN_DATA_ENABLED;
-+ }
-+ DEBUG3(printk("%s(%ld): got lun mask for path id %d "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x:\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]);)
-+ DEBUG3(qla4xxx_dump_buffer(
-+ (uint8_t *)&path->lun_data.data[0], 64);)
-+ }
-+ }
-+
-+ DEBUG3(printk("qla4xxx_set_lun_data_from_config: Luns data for "
-+ "device %p, instance %d, path id=%d\n",
-+ dp,host->instance,path->id);)
-+ DEBUG3(qla4xxx_dump_buffer((char *)&path->lun_data.data[0], 64);)
-+
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ LEAVE("qla4xxx_set_lun_data_from_config");
-+#endif
-+}
-+
-+
-+
-+/*
-+ * qla4xxx_cfg_build_path_tree
-+ * Find all path properties and build a path tree. The
-+ * resulting tree has no actual port assigned to it
-+ * until the port discovery is done by the lower level.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_cfg_build_path_tree(scsi_qla_host_t *ha)
-+{
-+#if 0
-+ char *propbuf;
-+ uint8_t node_name[WWN_SIZE];
-+ uint8_t port_name[WWN_SIZE];
-+ fc_port_t *port;
-+ uint16_t dev_no = 0, tgt;
-+ int instance, rval;
-+ mp_host_t *host = NULL;
-+ uint8_t *name;
-+ int done;
-+ uint8_t control_byte;
-+
-+
-+ ENTER("qla4xxx_cfg_build_path_tree");
-+
-+ printk(KERN_INFO
-+ "qla02%d: ConfigRequired is set. \n", (int)ha->instance);
-+ DEBUG(printk("qla4xxx_cfg_build_path_tree: hba =%d",
-+ (int)ha->instance);)
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&propbuf,
-+ MAX_SEARCH_STR_SIZE)) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "propbuf requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ MAX_SEARCH_STR_SIZE);)
-+ return;
-+ }
-+
-+ /* Look for adapter nodename in properties */
-+ sprintf(propbuf, "scsi-qla%ld-adapter-port", ha->instance);
-+ DEBUG(printk("build_tree: %s\n",propbuf);)
-+
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf, port_name, WWN_SIZE);
-+ if (rval != WWN_SIZE) {
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ /* Does nodename match the host adapter nodename? */
-+ name = &ha->init_cb->port_name[0];
-+ if (!qla4xxx_is_nodename_equal(name, port_name)) {
-+ printk(KERN_INFO
-+ "scsi(%d): Adapter nodenames don't match - ha = %p.\n",
-+ (int)ha->instance,ha);
-+ DEBUG(printk("qla(%d): Adapter nodenames don't match - "
-+ "ha=%p. port name=%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ (int)ha->instance,ha,
-+ name[0], name[1], name[2], name[3],
-+ name[4], name[5], name[6], name[7]);)
-+
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ DEBUG(printk("%s: found entry for adapter port %02x%02x%02x%02x"
-+ "%02x%02x%02x%02x.\n",
-+ __func__,
-+ port_name[0], port_name[1], port_name[2],
-+ port_name[3], port_name[4], port_name[5],
-+ port_name[6], port_name[7]);)
-+
-+ instance = ha->instance;
-+ if ((host = qla4xxx_alloc_host(ha)) == NULL) {
-+ printk(KERN_INFO
-+ "scsi(%d): Couldn't allocate host - ha = %p.\n",
-+ (int)instance,ha);
-+ } else {
-+ /* create a dummy port */
-+ port = kmalloc(sizeof(fc_port_t), GFP_KERNEL);
-+ if (port == NULL) {
-+ printk(KERN_INFO
-+ "scsi(%d): Couldn't allocate port.\n",
-+ (int)instance);
-+ DEBUG(printk("qla(%d): Couldn't allocate port.\n",
-+ (int)host->instance);)
-+ /* remove host */
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ done = 0;
-+
-+ /* For each target on the host bus adapter */
-+ for (tgt = 0; tgt < MAX_MP_DEVICES &&
-+ !done; tgt++) {
-+
-+ /* get all paths for this target */
-+ for (dev_no = 0; dev_no < MAX_PATHS_PER_DEVICE &&
-+ !done ; dev_no++) {
-+
-+ /*
-+ * O(N*M) scan, should ideally check if there
-+ * are any tgt entries present, if not, then
-+ * continue.
-+ *
-+ * sprintf(propbuf,
-+ * "scsi-qla%d-tgt-%d-",
-+ * instance, tgt);
-+ * if (strstr(ha->cmdline, propbuf) == NULL)
-+ * continue;
-+ *
-+ */
-+ memset(port, 0, sizeof (fc_port_t));
-+
-+ /*
-+ * Get "target-N-device-N-node" is a 16-chars
-+ * number
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-node",
-+ ha->instance, tgt, dev_no);
-+
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf,
-+ node_name, WWN_SIZE);
-+ if (rval != WWN_SIZE)
-+ /* di values may not be contiguous for
-+ * override case.
-+ */
-+ continue;
-+
-+ DEBUG(printk("build_tree: %s\n",propbuf);)
-+ memcpy(port->node_name, node_name, WWN_SIZE);
-+
-+ /*
-+ * Get "target-N-device-N-port" is a 16-chars
-+ * number
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-port",
-+ ha->instance, tgt, dev_no);
-+
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf,
-+ port_name, WWN_SIZE);
-+ if (rval != WWN_SIZE)
-+ continue;
-+
-+ DEBUG(printk("build_tree: %s\n",propbuf);)
-+ memcpy(port->node_name, node_name, WWN_SIZE);
-+ memcpy(port->port_name, port_name, WWN_SIZE);
-+ port->flags |= FCF_CONFIG;
-+
-+ /*
-+ * Get "target-N-device-N-control" if property
-+ * is present then all luns are visible.
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-control",
-+ ha->instance, tgt, dev_no);
-+ rval = qla4xxx_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)(&control_byte),
-+ sizeof(control_byte));
-+ if (rval == -1) {
-+ /* error getting string. go to next. */
-+ DEBUG2(printk(
-+ "%s: string parsing failed.\n",
-+ __func__);)
-+ continue;
-+ }
-+
-+ DEBUG3(printk("build_tree: %s\n",propbuf);)
-+
-+ DEBUG(printk("build_tree: control byte 0x%x\n",
-+ control_byte);)
-+
-+ port->mp_byte = control_byte;
-+ DEBUG(printk("%s(%ld): calling update_mp_device"
-+ " for host %p port %p-%02x%02x%02x%02x%02x"
-+ "%02x%02x%02x tgt=%d mpbyte=%02x.\n",
-+ __func__, ha->host_no, host, port,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ tgt, port->mp_byte);)
-+
-+ qla4xxx_update_mp_device(host, port, tgt,
-+ dev_no);
-+
-+ /* free any mplun info */
-+
-+ qla4xxx_set_lun_data_from_config(host,
-+ port, tgt, dev_no);
-+ }
-+ }
-+ kfree(port);
-+ }
-+
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ LEAVE("qla4xxx_cfg_build_path_tree");
-+ DEBUG(printk("Leaving: qla4xxx_cfg_build_path_tree\n");)
-+#endif
-+}
-+
-+/*
-+ * qla4xxx_cfg_display_devices
-+ * This routine will the node names of the different devices found
-+ * after port inquiry.
-+ *
-+ * Input:
-+ *
-+ * Returns:
-+ * None.
-+ */
-+void
-+qla4xxx_cfg_display_devices(int flag)
-+{
-+ mp_host_t *host;
-+ int id;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+ mp_path_list_t *path_list;
-+ int cnt, i, dev_no;
-+ int instance;
-+#if 0
-+ int mask_set;
-+ uint8_t l;
-+#endif
-+ mp_lun_t *lun;
-+ unsigned char tmp_buf[32];
-+
-+ for (host = mp_hosts_base; (host); host = host->next) {
-+
-+ instance = (int) host->instance;
-+ /* Display the node name for adapter */
-+ printk(KERN_INFO
-+ "scsi-qla%d-adapter-port="
-+ "%s\\;\n",
-+ instance,
-+ host->iscsiname);
-+
-+ for (id = 0; id < MAX_MP_DEVICES; id++) {
-+ if( (dp = host->mp_devs[id] ) == NULL )
-+ continue;
-+
-+ path_list = dp->path_list;
-+
-+
-+ if( (path = path_list->last) != NULL ) {
-+ /* Print out device port names */
-+ path = path->next; /* first path */
-+ for (dev_no = 0, cnt = 0;
-+ cnt < path_list->path_cnt;
-+ path = path->next, cnt++) {
-+
-+ /* skip others if not our host */
-+ if (host != path->host)
-+ continue;
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-name="
-+ "%s\\;\n",
-+ instance, id, path->id,
-+ dp->devname);
-+
-+ /* port_name */
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-port="
-+ "%s\\;\n",
-+ instance, id, path->id,
-+ path->iscsiname);
-+
-+ /* control byte */
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-"
-+ "control=%02x\\;\n",
-+ instance, id, path->id,
-+ path->mp_byte);
-+
-+ /*
-+ * Build preferred bit mask for this
-+ * path */
-+#if 0
-+ memset(&lun_mask, 0, sizeof(lun_mask));
-+ mask_set = 0;
-+ for (i = 0; i < MAX_LUNS; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ if (path_list->current_path[l] == path->id ) {
-+ lun_mask |= (lun_mask << l);
-+ mask_set++;
-+ }
-+ }
-+ if (mask_set) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-preferred=%08x%08x%08x%08x%08x%08x%08x%08x\\;\n",
-+ instance, id, path->id,
-+ *((uint32_t *) &lun_mask.mask[28]),
-+ *((uint32_t *) &lun_mask.mask[24]),
-+ *((uint32_t *) &lun_mask.mask[20]),
-+ *((uint32_t *) &lun_mask.mask[16]),
-+ *((uint32_t *) &lun_mask.mask[12]),
-+ *((uint32_t *) &lun_mask.mask[8]),
-+ *((uint32_t *) &lun_mask.mask[4]),
-+ *((uint32_t *) &lun_mask.mask[0]) );
-+ }
-+ /*
-+ * Build disable bit mask for this path
-+ */
-+ mask_set = 0;
-+ for (i = 0; i < MAX_LUNS; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ if (!(path->lun_data.data[l] &
-+ LUN_DATA_ENABLED) ) {
-+
-+ mask_set++;
-+ }
-+ }
-+ if (mask_set) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-lun-disable=%08x%08x%08x%08x%08x%08x%08x%08x\\;\n",
-+ instance, id, path->id,
-+ *((uint32_t *) &lun_mask.mask[28]),
-+ *((uint32_t *) &lun_mask.mask[24]),
-+ *((uint32_t *) &lun_mask.mask[20]),
-+ *((uint32_t *) &lun_mask.mask[16]),
-+ *((uint32_t *) &lun_mask.mask[12]),
-+ *((uint32_t *) &lun_mask.mask[8]),
-+ *((uint32_t *) &lun_mask.mask[4]),
-+ *((uint32_t *) &lun_mask.mask[0]) );
-+ }
-+#endif
-+ /* display lun wwuln */
-+ if( flag )
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-lun-%d-lunid=",
-+ instance, id, path->id, lun->number);
-+ for (i = 0 ; i < lun->siz ;
-+ i++) {
-+ sprintf(tmp_buf+i,
-+ "%02x",
-+ lun->wwuln[i]);
-+ }
-+ printk(KERN_INFO "%s:%02d;\n",
-+ tmp_buf,lun->siz);
-+ }
-+ dev_no++;
-+ }
-+
-+ }
-+ }
-+ }
-+}
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_dbg.c ./drivers/scsi/qla4xxx/ql4_dbg.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_dbg.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_dbg.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,691 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_get_debug_level
-+ * qla4xxx_set_debug_level
-+ * printchar
-+ * qla4xxx_dump_bytes
-+ * qla4xxx_dump_words
-+ * qla4xxx_dump_dwords
-+ * qla4xxx_print_scsi_cmd
-+ * qla4xxx_print_srb_info
-+ * qla4xxx_print_iocb_passthru
-+ * __dump_dwords
-+ * __dump_words
-+ * __dump_registers
-+ * qla4xxx_dump_registers
-+ * __dump_mailbox_registers
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+//#define QLP1 0x00000002 // Unrecoverable error messages
-+//#define QLP2 0x00000004 // Unexpected completion path error messages
-+//#define QLP3 0x00000008 // Function trace messages
-+//#define QLP4 0x00000010 // IOCTL trace messages
-+//#define QLP5 0x00000020 // I/O & Request/Response queue trace messages
-+//#define QLP6 0x00000040 // Watchdog messages (current state)
-+//#define QLP7 0x00000080 // Initialization
-+//#define QLP8 0x00000100 // Internal command queue traces
-+//#define QLP9 0x00000200 // Unused
-+//#define QLP10 0x00000400 // Extra Debug messages (dump buffers)
-+//#define QLP11 0x00000800 // Mailbox & ISR Details
-+//#define QLP12 0x00001000 // Enter/Leave routine messages
-+//#define QLP13 0x00002000 // Display data for Inquiry, TUR, ReqSense, RptLuns
-+//#define QLP14 0x00004000
-+//#define QLP15 0x00008000 // Display jiffies for IOCTL calls
-+//#define QLP16 0x00010000 // Extended proc print statements (srb info)
-+//#define QLP17 0x00020000 // Display NVRAM Accesses
-+//#define QLP18 0x00040000 // unused
-+//#define QLP19 0x00080000 // PDU info
-+//#define QLP20 0x00100000 // iSNS info
-+//#define QLP24 0x01000000 // Scatter/Gather info
-+
-+uint32_t ql_dbg_level = QLP1|QLP2|QLP7|QLP20;
-+
-+/**************************************************************************
-+ * qla4xxx_get_debug_level
-+ * This routine retrieves the driver's debug print level.
-+ *
-+ * Input:
-+ * dbg_level - driver's debug print level
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - always
-+ **************************************************************************/
-+inline uint8_t
-+qla4xxx_get_debug_level(uint32_t *dbg_level)
-+{
-+ *dbg_level = ql_dbg_level;
-+ barrier();
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_set_debug_level
-+ * This routine sets the driver's debug print level.
-+ *
-+ * Input:
-+ * dbg_level - driver's debug print level
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - always
-+ **************************************************************************/
-+inline uint8_t
-+qla4xxx_set_debug_level(uint32_t dbg_level)
-+{
-+ ql_dbg_level = dbg_level;
-+ barrier();
-+ return(QLA_SUCCESS);
-+}
-+
-+/****************************************************************************/
-+/* Debug Print Routines */
-+/****************************************************************************/
-+
-+void printchar(char ch)
-+{
-+ if (ch>=32)
-+ printk("%c", ch);
-+ else
-+ printk(".");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_dump_bytes
-+ * This routine displays bytes in hex format
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * buffer - data buffer to display
-+ * size - number of bytes to display
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_dump_bytes(uint32_t dbg_mask, void *buffer, uint32_t size)
-+{
-+ uint32_t i;
-+ uint8_t *data = (uint8_t *)buffer;
-+
-+ if ((ql_dbg_level & dbg_mask) != 0) {
-+ //printk(" 0 1 2 3 4 5 6 7 - 8 9 A B C D E F\n");
-+ //printk("---------------------------------------------------------\n");
-+
-+ for (i = 0; i < size; i++, data++) {
-+ if (i % 0x10 == 0) {
-+ printk("%04X: %02X", i, *data);
-+ }
-+ else if (i % 0x10 == 0x08) {
-+ printk(" - %02X", *data);
-+ }
-+ else if (i % 0x10 == 0xF) {
-+ printk(" %02X: ", *data);
-+ printchar(*(data-15));
-+ printchar(*(data-14));
-+ printchar(*(data-13));
-+ printchar(*(data-12));
-+ printchar(*(data-11));
-+ printchar(*(data-10));
-+ printchar(*(data-9));
-+ printchar(*(data-8));
-+ printchar(*(data-7));
-+ printchar(*(data-6));
-+ printchar(*(data-5));
-+ printchar(*(data-4));
-+ printchar(*(data-3));
-+ printchar(*(data-2));
-+ printchar(*(data-1));
-+ printchar(*data);
-+ printk("\n");
-+ }
-+ else {
-+ printk(" %02X", *data);
-+ }
-+ }
-+
-+ if ((i != 0) && (i % 0x10)) {
-+ printk("\n");
-+ }
-+ printk("\n");
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_dump_words
-+ * This routine displays words in hex format
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * buffer - data buffer to display
-+ * size - number of bytes to display
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_dump_words(uint32_t dbg_mask, void *buffer, uint32_t size)
-+{
-+ if ((ql_dbg_level & dbg_mask) != 0)
-+ __dump_words(buffer, size);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_dump_dwords
-+ * This routine displays double words in hex format
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * buffer - data buffer to display
-+ * size - number of bytes to display
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_dump_dwords(uint32_t dbg_mask, void *buffer, uint32_t size)
-+{
-+ if ((ql_dbg_level & dbg_mask) != 0)
-+ __dump_dwords(buffer, size);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_print_scsi_cmd
-+ * This routine displays the SCSI command
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * cmd - pointer to Linux kernel command structure
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_print_scsi_cmd(uint32_t dbg_mask, struct scsi_cmnd *cmd)
-+{
-+ if ((ql_dbg_level & dbg_mask) != 0) {
-+ int i;
-+
-+ printk("SCSI Command = 0x%p, Handle=0x%p\n",
-+ cmd, cmd->host_scribble);
-+
-+ printk(" b=%d, t=%02xh, l=%02xh, cmd_len = %02xh\n",
-+ cmd->device->channel, cmd->device->id, cmd->device->lun,
-+ cmd->cmd_len);
-+
-+ printk(" CDB = ");
-+ for (i = 0; i < cmd->cmd_len; i++)
-+ printk("%02x ", cmd->cmnd[i]);
-+
-+ printk(" seg_cnt = %d\n",cmd->use_sg);
-+ printk(" request buffer = 0x%p, request buffer len = 0x%x\n",
-+ cmd->request_buffer,cmd->request_bufflen);
-+
-+ if (cmd->use_sg) {
-+ struct scatterlist *sg;
-+ sg = (struct scatterlist *) cmd->request_buffer;
-+ printk(" SG buffer: \n");
-+ qla4xxx_dump_bytes(dbg_mask, (caddr_t)sg,
-+ (cmd->use_sg *
-+ sizeof(struct scatterlist)));
-+ }
-+
-+ printk(" tag = %d, transfersize = 0x%x \n",
-+ cmd->tag, cmd->transfersize);
-+
-+ printk(" Pid = %d, SP = 0x%p\n", (int)cmd->pid, CMD_SP(cmd));
-+ printk(" underflow size = 0x%x, direction=0x%x\n",
-+ cmd->underflow, cmd->sc_data_direction);
-+
-+ printk(" Current time (jiffies) = 0x%lx, "
-+ "timeout expires = 0x%lx\n",
-+ jiffies, cmd->eh_timeout.expires);
-+ }
-+}
-+
-+void
-+qla4xxx_dump_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd )
-+{
-+ if (host_byte(cmd->result) == DID_OK) {
-+ switch (cmd->cmnd[0]) {
-+ case TEST_UNIT_READY:
-+ QL4PRINT(QLP13,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "TEST_UNIT_READY "
-+ "status = 0x%x\n",
-+ ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun,
-+ __func__, cmd->result & 0xff));
-+
-+ if (driver_byte(cmd->result) & DRIVER_SENSE) {
-+ QL4PRINT(QLP13,
-+ printk("REQUEST_SENSE data: "
-+ "(MAX 0x20 bytes displayed)\n"));
-+
-+ qla4xxx_dump_bytes(QLP13, cmd->sense_buffer,
-+ MIN(0x20, sizeof(cmd->sense_buffer)));
-+ }
-+ break;
-+ case INQUIRY:
-+ QL4PRINT(QLP13, printk("scsi%d:%d:%d:%d: %s: "
-+ "INQUIRY data: "
-+ "(MAX 0x30 bytes displayed)\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun, __func__));
-+
-+ qla4xxx_dump_bytes(QLP13, cmd->request_buffer,
-+ MIN(0x30, cmd->request_bufflen));
-+
-+ if (strncmp(cmd->request_buffer,
-+ "\7f\00\00\00\7f\00\00\00", 8) == 0) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "Device not present. "
-+ "Possible connection "
-+ "problem with iSCSI router\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun, __func__));
-+ }
-+ break;
-+ case REQUEST_SENSE:
-+ QL4PRINT(QLP13,
-+ printk("scsi%d:%d:%d:%d: %s: REQUEST_SENSE "
-+ "data: (MAX 0x20 bytes displayed)\n",
-+ ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun, __func__));
-+
-+ qla4xxx_dump_bytes(QLP13, cmd->request_buffer,
-+ MIN(0x20, cmd->request_bufflen));
-+ break;
-+ case REPORT_LUNS:
-+ QL4PRINT(QLP13,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "REPORT_LUNS data: "
-+ "(MAX 0x40 bytes displayed)\n",
-+ ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun,
-+ __func__));
-+
-+ qla4xxx_dump_bytes(QLP13, cmd->request_buffer,
-+ MIN(0x40, cmd->request_bufflen));
-+ break;
-+ }
-+
-+ }
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_print_srb_info
-+ * This routine displays the srb structure
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * srb - pointer to srb structure
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_print_srb_info(uint32_t dbg_mask, srb_t *srb)
-+{
-+ if ((ql_dbg_level & dbg_mask) != 0) {
-+ printk("%s: srb = 0x%p, flags=0x%02x\n",
-+ __func__, srb, srb->flags);
-+ printk("%s: entry_count = 0x%02x, active_array_index=0x%04x\n",
-+ __func__, srb->entry_count, srb->active_array_index);
-+ printk("%s: cmd = 0x%p, saved_dma_handle = 0x%x\n",
-+ __func__, srb->cmd, (uint32_t) srb->saved_dma_handle);
-+ printk("%s: fw_ddb_index = %d, lun = %d\n",
-+ __func__, srb->fw_ddb_index, srb->lun);
-+ printk("%s: os_tov = %d, iocb_tov = %d\n",
-+ __func__, srb->os_tov, srb->iocb_tov);
-+ printk("%s: cc_stat = 0x%x, r_start = 0x%lx, u_start = 0x%lx\n\n",
-+ __func__, srb->cc_stat, srb->r_start, srb->u_start);
-+ }
-+}
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+void
-+qla4xxx_print_iocb_passthru(uint32_t dbg_mask, scsi_qla_host_t *ha, INT_IOCB_PASSTHRU *iocb)
-+{
-+ if ((ql_dbg_level & dbg_mask) != 0) {
-+ printk("SendDMAOffset=0x%x, RspDMAOffset=0x%x\n",
-+ iocb->SendDMAOffset, iocb->RspDMAOffset);
-+ printk("IOCBCmdBuffer:\n");
-+ qla4xxx_dump_bytes(dbg_mask, iocb->IOCBCmdBuffer, sizeof(iocb->IOCBCmdBuffer));
-+ printk("IOCBStatusBuffer:\n");
-+ qla4xxx_dump_bytes(dbg_mask, iocb->IOCBStatusBuffer, sizeof(iocb->IOCBStatusBuffer));
-+ printk("SendData: (SendData %p, Len=%d)\n", iocb->SendData, iocb->SendDataLen);
-+ qla4xxx_dump_bytes(dbg_mask, iocb->SendData, iocb->SendDataLen);
-+ printk("RspData: (RspData %p, Len=%d)\n", iocb->RspData, iocb->RspDataLen);
-+ qla4xxx_dump_bytes(dbg_mask, iocb->RspData, iocb->RspDataLen);
-+ }
-+}
-+#endif
-+
-+/* hardware_lock taken */
-+void
-+__dump_dwords(void *buffer, uint32_t size)
-+{
-+ uint32_t *data = (uint32_t *)buffer;
-+ uint32_t i;
-+
-+ for (i = 0; i < size; i+=4, data++) {
-+ if (i % 0x10 == 0) {
-+ printk("%04X: %08X", i, *data);
-+ }
-+ else if (i % 0x10 == 0x08) {
-+ printk(" - %08X", *data);
-+ }
-+ else if (i % 0x10 == 0x0C) {
-+ printk(" %08X\n", *data);
-+ }
-+ else {
-+ printk(" %08X", *data);
-+ }
-+ }
-+ if ((i != 0) && (i % 0x10 != 0)) {
-+ printk("\n");
-+ }
-+}
-+
-+/* hardware_lock taken */
-+void
-+__dump_words(void *buffer, uint32_t size)
-+{
-+ uint16_t *data = (uint16_t *)buffer;
-+ uint32_t i;
-+
-+ for (i = 0; i < size; i+=2, data++) {
-+ if (i % 0x10 == 0) {
-+ printk(KERN_INFO "%04X: %04X", i, *data);
-+ }
-+ else if (i % 0x10 == 0x08) {
-+ printk(KERN_INFO " - %04X", *data);
-+ }
-+ else if (i % 0x10 == 0x0E) {
-+ uint8_t *bdata = (uint8_t *) data;
-+ printk(KERN_INFO " %04X: ", *data);
-+ printchar(*(bdata-13));
-+ printchar(*(bdata-14));
-+ printchar(*(bdata-11));
-+ printchar(*(bdata-12));
-+ printchar(*(bdata-9));
-+ printchar(*(bdata-10));
-+ printchar(*(bdata-7));
-+ printchar(*(bdata-8));
-+ printchar(*(bdata-5));
-+ printchar(*(bdata-6));
-+ printchar(*(bdata-3));
-+ printchar(*(bdata-4));
-+ printchar(*(bdata-1));
-+ printchar(*(bdata-2));
-+ printchar(*(bdata+1));
-+ printchar(*(bdata));
-+ printk("\n");
-+ }
-+ else {
-+ printk(KERN_INFO " %04X", *data);
-+ }
-+ }
-+ if ((i != 0) && (i % 0x10 != 0)) {
-+ printk(KERN_INFO "\n");
-+ }
-+}
-+
-+/* hardware_lock taken */
-+void
-+__dump_registers(uint32_t dbg_mask, scsi_qla_host_t *ha)
-+{
-+ uint8_t i;
-+
-+ if ((ql_dbg_level & dbg_mask) == 0)
-+ return;
-+
-+
-+ for (i=0; i<MBOX_REG_COUNT; i++) {
-+ printk(KERN_INFO "0x%02X mailbox[%d] = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, mailbox[i]), i,
-+ RD_REG_DWORD(&ha->reg->mailbox[i]));
-+ }
-+ printk(KERN_INFO "0x%02X flash_address = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, flash_address),
-+ RD_REG_DWORD(&ha->reg->flash_address));
-+
-+ printk(KERN_INFO "0x%02X flash_data = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, flash_data),
-+ RD_REG_DWORD(&ha->reg->flash_data));
-+
-+ printk(KERN_INFO "0x%02X ctrl_status = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, ctrl_status),
-+ RD_REG_DWORD(&ha->reg->ctrl_status));
-+
-+ if (IS_QLA4010(ha)) {
-+
-+ printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u1.isp4010.nvram),
-+ RD_REG_DWORD(&ha->reg->u1.isp4010.nvram));
-+ }
-+ else if (IS_QLA4022(ha)) {
-+
-+ printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u1.isp4022.intr_mask),
-+ RD_REG_DWORD(&ha->reg->u1.isp4022.intr_mask));
-+
-+ printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u1.isp4022.nvram),
-+ RD_REG_DWORD(&ha->reg->u1.isp4022.nvram));
-+
-+ printk(KERN_INFO "0x%02X semaphore = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u1.isp4022.semaphore),
-+ RD_REG_DWORD(&ha->reg->u1.isp4022.semaphore));
-+ }
-+
-+ printk(KERN_INFO "0x%02X req_q_in = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, req_q_in),
-+ RD_REG_DWORD(&ha->reg->req_q_in));
-+
-+ printk(KERN_INFO "0x%02X rsp_q_out = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, rsp_q_out),
-+ RD_REG_DWORD(&ha->reg->rsp_q_out));
-+
-+ if (IS_QLA4010(ha)) {
-+
-+ printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.ext_hw_conf),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.ext_hw_conf));
-+
-+ printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.port_ctrl),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.port_ctrl));
-+
-+ printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.port_status),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.port_status));
-+
-+ printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.req_q_out),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.req_q_out));
-+
-+ printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.gp_out),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.gp_out));
-+
-+ printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.gp_in),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.gp_in));
-+
-+ printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4010.port_err_status),
-+ RD_REG_DWORD(&ha->reg->u2.isp4010.port_err_status));
-+ }
-+ else if (IS_QLA4022(ha)) {
-+
-+ printk(KERN_INFO "Page 0 Registers:\n");
-+
-+ printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.ext_hw_conf),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.ext_hw_conf));
-+
-+ printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.port_ctrl),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.port_ctrl));
-+
-+ printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.port_status),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.port_status));
-+
-+ printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.gp_out),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.gp_out));
-+
-+ printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.gp_in),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.gp_in));
-+
-+ printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p0.port_err_status),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p0.port_err_status));
-+
-+ printk(KERN_INFO "Page 1 Registers:\n");
-+
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, HOST_MEM_CFG_PAGE &
-+ SET_RMASK(CSR_SCSI_PAGE_SELECT));
-+
-+ printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
-+ (uint8_t) offsetof(isp_reg_t, u2.isp4022.p1.req_q_out),
-+ RD_REG_DWORD(&ha->reg->u2.isp4022.p1.req_q_out));
-+
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, PORT_CTRL_STAT_PAGE &
-+ SET_RMASK(CSR_SCSI_PAGE_SELECT));
-+
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_dump_registers
-+ * This routine displays ISP registers
-+ *
-+ * Input:
-+ * dbg_mask - this call's debug print mask
-+ * ha - adapter structure pointer
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ **************************************************************************/
-+void
-+qla4xxx_dump_registers(uint32_t dbg_mask, scsi_qla_host_t *ha)
-+{
-+ unsigned long flags = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ __dump_registers(dbg_mask, ha);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+void
-+__dump_mailbox_registers(uint32_t dbg_mask, scsi_qla_host_t *ha)
-+{
-+ int i = 0;
-+
-+ if ((ql_dbg_level & dbg_mask) == 0)
-+ return;
-+
-+ for (i = 1; i < MBOX_REG_COUNT; i++)
-+ printk(KERN_INFO " Mailbox[%d] = %08x\n", i,
-+ RD_REG_DWORD(&ha->reg->mailbox[i]));
-+}
-+
-+void
-+qla4xxx_dump_buffer(uint8_t * b, uint32_t size)
-+{
-+ uint32_t cnt;
-+ uint8_t c;
-+
-+ printk(" 0 1 2 3 4 5 6 7 8 9 "
-+ "Ah Bh Ch Dh Eh Fh\n");
-+ printk("----------------------------------------"
-+ "----------------------\n");
-+
-+ for (cnt = 0; cnt < size;) {
-+ c = *b++;
-+ printk("%02x",(uint32_t) c);
-+ cnt++;
-+ if (!(cnt % 16))
-+ printk("\n");
-+ else
-+ printk(" ");
-+ }
-+ if (cnt % 16)
-+ printk("\n");
-+}
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_dbg.h ./drivers/scsi/qla4xxx/ql4_dbg.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_dbg.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_dbg.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,143 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ *
-+ ****************************************************************************/
-+
-+/*
-+ * Driver debug definitions.
-+ */
-+#define QLP1 0x00000002 // Unrecoverable error messages
-+#define QLP2 0x00000004 // Unexpected completion path error messages
-+#define QLP3 0x00000008 // Function trace messages
-+#define QLP4 0x00000010 // IOCTL trace messages
-+#define QLP5 0x00000020 // I/O & Request/Response queue trace messages
-+#define QLP6 0x00000040 // Watchdog messages (current state)
-+#define QLP7 0x00000080 // Initialization
-+#define QLP8 0x00000100 // Internal command queue traces
-+#define QLP9 0x00000200 // Unused
-+#define QLP10 0x00000400 // Extra Debug messages (dump buffers)
-+#define QLP11 0x00000800 // Mailbox & ISR Details
-+#define QLP12 0x00001000 // Enter/Leave routine messages
-+#define QLP13 0x00002000 // Display data for Inquiry, TUR, ReqSense, RptLuns
-+#define QLP14 0x00004000 // Temporary
-+#define QLP15 0x00008000 // Display jiffies for IOCTL calls
-+#define QLP16 0x00010000 // Extended proc print statements (srb info)
-+#define QLP17 0x00020000 // Display NVRAM Accesses
-+#define QLP18 0x00040000 // unused
-+#define QLP19 0x00080000 // PDU info
-+#define QLP20 0x00100000 // iSNS info
-+#define QLP24 0x01000000 // Scatter/Gather info
-+
-+extern uint32_t ql_dbg_level;
-+
-+/*
-+ * Debug Print Routine Prototypes.
-+ */
-+#define QL4PRINT(m,x) do {if(((m) & ql_dbg_level) != 0) (x);} while(0);
-+#define ENTER(x) do {QL4PRINT(QLP12, printk("qla4xxx: Entering %s()\n", x));} while(0);
-+#define LEAVE(x) do {QL4PRINT(QLP12, printk("qla4xxx: Leaving %s()\n", x));} while(0);
-+
-+inline uint8_t qla4xxx_get_debug_level(uint32_t *dbg_level);
-+inline uint8_t qla4xxx_set_debug_level(uint32_t dbg_level);
-+
-+void qla4xxx_dump_bytes(uint32_t, void *, uint32_t);
-+void qla4xxx_dump_words(uint32_t, void *, uint32_t);
-+void qla4xxx_dump_dwords(uint32_t, void *, uint32_t);
-+void qla4xxx_print_scsi_cmd(uint32_t dbg_mask, struct scsi_cmnd *cmd);
-+void qla4xxx_print_srb_info(uint32_t dbg_mask, srb_t *srb);
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+void qla4xxx_print_iocb_passthru(uint32_t dbg_mask, scsi_qla_host_t *ha, INT_IOCB_PASSTHRU *iocb);
-+#endif
-+
-+/*
-+ * Driver debug definitions.
-+ */
-+/* #define QL_DEBUG_LEVEL_1 */ /* Output register accesses to COM1 */
-+
-+/* #define QL_DEBUG_LEVEL_3 */ /* Output function trace msgs to COM1 */
-+/* #define QL_DEBUG_LEVEL_4 */
-+/* #define QL_DEBUG_LEVEL_5 */
-+/* #define QL_DEBUG_LEVEL_9 */
-+
-+#define QL_DEBUG_LEVEL_2 /* Output error msgs to COM1 */
-+
-+#define DEBUG(x) do {} while (0);
-+
-+#if defined(QL_DEBUG_LEVEL_2)
-+#define DEBUG2(x) do {if(extended_error_logging == 2) x;} while (0);
-+#define DEBUG2_3(x) do {x;} while (0);
-+#else
-+#define DEBUG2(x) do {} while (0);
-+#endif
-+
-+#if defined(QL_DEBUG_LEVEL_3)
-+#define DEBUG3(x) do {x;} while (0);
-+#else
-+#define DEBUG3(x) do {} while (0);
-+ #if !defined(QL_DEBUG_LEVEL_2)
-+ #define DEBUG2_3(x) do {} while (0);
-+ #endif
-+#endif
-+#if defined(QL_DEBUG_LEVEL_4)
-+#define DEBUG4(x) do {x;} while (0);
-+#else
-+#define DEBUG4(x) do {} while (0);
-+#endif
-+
-+#if defined(QL_DEBUG_LEVEL_5)
-+#define DEBUG5(x) do {x;} while (0);
-+#else
-+#define DEBUG5(x) do {} while (0);
-+#endif
-+
-+#if defined(QL_DEBUG_LEVEL_9)
-+#define DEBUG9(x) do {x;} while (0);
-+#else
-+#define DEBUG9(x) do {} while (0);
-+#endif
-+
-+void __dump_dwords(void *, uint32_t);
-+void __dump_words(void *, uint32_t);
-+void __dump_mailbox_registers(uint32_t, scsi_qla_host_t *ha);
-+void __dump_registers(uint32_t, scsi_qla_host_t *ha);
-+void qla4xxx_dump_registers(uint32_t, scsi_qla_host_t *ha);
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_def.h ./drivers/scsi/qla4xxx/ql4_def.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_def.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_def.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,1063 @@
-+/********************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic ISP4xxx iSCSI driver
-+* Copyright (C) 2004 Qlogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+**
-+******************************************************************************/
-+
-+#ifndef __QL4_DEF_H
-+#define __QL4_DEF_H
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/types.h>
-+#include <linux/module.h>
-+#include <linux/list.h>
-+#include <linux/pci.h>
-+#include <linux/dma-mapping.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/dmapool.h>
-+#include <linux/mempool.h>
-+#include <linux/spinlock.h>
-+#include <linux/completion.h>
-+#include <asm/semaphore.h>
-+
-+#include <scsi/scsi.h>
-+#include <scsi/scsi_host.h>
-+#include <scsi/scsi_device.h>
-+#include <scsi/scsi_cmnd.h>
-+
-+/* XXX(dg): move to pci_ids.h */
-+#ifndef PCI_DEVICE_ID_QLOGIC_ISP4010
-+#define PCI_DEVICE_ID_QLOGIC_ISP4010 0x4010
-+#endif
-+
-+#ifndef PCI_DEVICE_ID_QLOGIC_ISP4022
-+#define PCI_DEVICE_ID_QLOGIC_ISP4022 0x4022
-+#endif
-+
-+#define IS_QLA4010(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4010)
-+#define IS_QLA4022(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4022)
-+
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+#define QLA_CONFIG_COMPAT
-+#endif
-+
-+/*
-+ * This file set some defines that are required to compile the
-+ * command source for 4000 module
-+ *----------------------------------------------------------------------------*/
-+#define QLA4010
-+#define QLA4XXX_BOARD_PORTS 1
-+#define QLA4XXX_PROC_NAME "qla4010"
-+
-+#define MEMORY_MAPPED_IO 1 /* 1=Memory Mapped (preferred),
-+ * 0=I/O Mapped */
-+
-+#define LINESIZE 256
-+#define MIN(x,y) ((x)<(y)?(x):(y))
-+#define MAX(x,y) ((x)>(y)?(x):(y))
-+
-+/*
-+ * Return status codes for internal routines
-+ ********************************************/
-+#define QLA_SUCCESS 0
-+#define QLA_ERROR 1
-+
-+/*
-+ * Data bit definitions
-+ */
-+#define BIT_0 0x1
-+#define BIT_1 0x2
-+#define BIT_2 0x4
-+#define BIT_3 0x8
-+#define BIT_4 0x10
-+#define BIT_5 0x20
-+#define BIT_6 0x40
-+#define BIT_7 0x80
-+#define BIT_8 0x100
-+#define BIT_9 0x200
-+#define BIT_10 0x400
-+#define BIT_11 0x800
-+#define BIT_12 0x1000
-+#define BIT_13 0x2000
-+#define BIT_14 0x4000
-+#define BIT_15 0x8000
-+#define BIT_16 0x10000
-+#define BIT_17 0x20000
-+#define BIT_18 0x40000
-+#define BIT_19 0x80000
-+#define BIT_20 0x100000
-+#define BIT_21 0x200000
-+#define BIT_22 0x400000
-+#define BIT_23 0x800000
-+#define BIT_24 0x1000000
-+#define BIT_25 0x2000000
-+#define BIT_26 0x4000000
-+#define BIT_27 0x8000000
-+#define BIT_28 0x10000000
-+#define BIT_29 0x20000000
-+#define BIT_30 0x40000000
-+#define BIT_31 0x80000000
-+
-+/*
-+ * Host adapter default definitions
-+ ***********************************/
-+#define MAX_HBAS 16
-+#define MAX_BUSES 1
-+#define MAX_TARGETS MAX_PRST_DEV_DB_ENTRIES + MAX_DEV_DB_ENTRIES
-+#define MAX_LUNS 256
-+#define MAX_AEN_ENTRIES 256 /* should be > EXT_DEF_MAX_AEN_QUEUE */
-+#define MAX_DDB_ENTRIES MAX_PRST_DEV_DB_ENTRIES + MAX_DEV_DB_ENTRIES
-+#define MAX_PDU_ENTRIES 32
-+#define INVALID_ENTRY 0xFFFF
-+#define MAX_CMDS_TO_RISC 1024
-+#define MAX_SRBS MAX_CMDS_TO_RISC
-+#define MBOX_AEN_REG_COUNT 5
-+#define MAX_INIT_RETRIES 2
-+#define IOCB_HIWAT_CUSHION 16
-+
-+/*
-+ * Buffer sizes
-+ ***************/
-+#define REQUEST_QUEUE_DEPTH MAX_CMDS_TO_RISC
-+#define RESPONSE_QUEUE_DEPTH 64
-+#define QUEUE_SIZE 64
-+#define DMA_BUFFER_SIZE 512
-+
-+/*
-+ * Misc
-+ *******/
-+#define MAC_ADDR_LEN 6 /* in bytes */
-+#define IP_ADDR_LEN 4 /* in bytes */
-+#define DRIVER_NAME "qla4xxx"
-+
-+#define MAX_LINKED_CMDS_PER_LUN 3
-+#define MAX_REQS_SERVICED_PER_INTR 16
-+
-+
-+/* Number of seconds to subtract for internal command timer */
-+#define QLA_CMD_TIMER_DELTA 2
-+
-+
-+#define ISCSI_IPADDR_SIZE 4 /* IP address size */
-+#define ISCSI_ALIAS_SIZE 32 /* ISCSI Alais name size */
-+#define ISCSI_NAME_SIZE 255 /* ISCSI Name size - usually a string */
-+
-+#define SYS_DELAY(x) do {udelay(x);barrier();} while(0);
-+#define QLA4XXX_DELAY(sec) do {mdelay(sec * 1000);} while(0);
-+#define NVRAM_DELAY() do {udelay(500);} while(0); /* 500 microsecond delay */
-+
-+/* delay 30 seconds */
-+#define RESET_DELAY() do {int delay; for(delay=30; delay!=0; delay--) \
-+ {current->state = TASK_UNINTERRUPTIBLE; \
-+ schedule_timeout(1 * HZ);}} while(0);
-+
-+#define TOPCAT_RESET_DELAY() do {udelay(1);} while(0);
-+#define TOPCAT_POST_RESET_DELAY() do {udelay(523);} while(0);
-+
-+
-+#define LSB(x) ((uint8_t)(x))
-+#define MSB(x) ((uint8_t)((uint16_t)(x) >> 8))
-+#define LSW(x) ((uint16_t)(x))
-+#define MSW(x) ((uint16_t)((uint32_t)(x) >> 16))
-+#define LSDW(x) ((uint32_t)((uint64_t)(x)))
-+#define MSDW(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
-+
-+#define IPAddrIsZero( _X1_ ) ((_X1_)[0] == 0 && \
-+ (_X1_)[1] == 0 && \
-+ (_X1_)[2] == 0 && \
-+ (_X1_)[3] == 0)
-+
-+#define IPAddrIsEqual(_X1_, _X2_) ((_X1_)[0] == (_X2_)[0] && \
-+ (_X1_)[1] == (_X2_)[1] && \
-+ (_X1_)[2] == (_X2_)[2] && \
-+ (_X1_)[3] == (_X2_)[3])
-+
-+#define IPAddr2Uint32(_X1_,_X2_) { \
-+ *_X2_ = 0; \
-+ *_X2_ |= _X1_[3] << 24; \
-+ *_X2_ |= _X1_[2] << 16; \
-+ *_X2_ |= _X1_[1] << 8; \
-+ *_X2_ |= _X1_[0];}
-+
-+/*
-+ * I/O port access macros
-+ *************************/
-+#if MEMORY_MAPPED_IO
-+# define RD_REG_BYTE(addr) readb(addr)
-+# define RD_REG_WORD(addr) readw(addr)
-+# define RD_REG_DWORD(addr) readl(addr)
-+# define RD_REG_WORD_RELAXED(addr) readw_relaxed(addr)
-+# define RD_REG_DWORD_RELAXED(addr) readl_relaxed(addr)
-+# define WRT_REG_BYTE(addr, data) writeb(data, addr)
-+# define WRT_REG_WORD(addr, data) writew(data, addr)
-+# define WRT_REG_DWORD(addr, data) writel(data, addr)
-+#else
-+# define RD_REG_BYTE(addr) (inb((u_long)addr))
-+# define RD_REG_WORD(addr) (inw((u_long)addr))
-+# define RD_REG_DWORD(addr) (inl((u_long)addr))
-+# define WRT_REG_BYTE(addr, data) (outb(data,(u_long)addr))
-+# define WRT_REG_WORD(addr, data) (outw((data),(u_long)addr))
-+# define WRT_REG_DWORD(addr, data) (outl((data),(u_long)addr))
-+#endif
-+
-+#define PCI_POSTING(a) (RD_REG_DWORD(a))
-+
-+#include "ql4_os.h"
-+#include "ql4_fw.h"
-+#include "ql4_nvram.h"
-+
-+/*---------------------------------------------------------------------------*/
-+
-+/*
-+ * Retry & Timeout Values
-+ *************************/
-+#define MBOX_TOV 30
-+#define SOFT_RESET_TOV 30
-+#define RESET_INTR_TOV 3
-+#define SEMAPHORE_TOV 10
-+#define ADAPTER_INIT_TOV 120
-+#define ADAPTER_RESET_TOV 180
-+#define INTERNAL_PASSTHRU__TOV 60
-+#define EXTEND_CMD_TOV 60
-+#define WAIT_CMD_TOV 30
-+#define EH_WAIT_CMD_TOV 120
-+#define FIRMWARE_UP_TOV 60
-+#define RESET_FIRMWARE_TOV 30
-+#define LOGOUT_TOV 10
-+#define IOCB_TOV_MARGIN 10
-+#define RELOGIN_TOV 18
-+#define ISNS_DEREG_TOV 5
-+
-+#define MAX_RESET_HA_RETRIES 2
-+
-+/*---------------------------------------------------------------------------*/
-+/*
-+ * SCSI Request Block structure (srb) that is placed
-+ * on cmd->SCp location of every I/O [We have 22 bytes available]
-+ */
-+typedef struct _srb_t {
-+ struct list_head list_entry; /* (8) */
-+ struct scsi_qla_host *ha; /* HA the SP is queued on */
-+
-+ uint16_t flags; /* (1) Status flags. */
-+ #define SRB_DMA_VALID BIT_3 /* DMA Buffer mapped. */
-+
-+ #define SRB_GOT_SENSE BIT_4 /* sense data recieved. */
-+ #define SRB_IOCTL_CMD BIT_5 /* generated from an IOCTL. */
-+ #define SRB_BUSY BIT_7 /* in busy retry state. */
-+
-+ #define SRB_FO_CANCEL BIT_8 /* don't need to failover. */
-+ #define SRB_RETRY BIT_9 /* needs retrying. */
-+ #define SRB_TAPE BIT_10 /* FCP2 (Tape) command. */
-+ #define SRB_FAILOVER BIT_11 /* being failed-over. */
-+
-+
-+ uint8_t state; /* (1) Status flags. */
-+ #define SRB_NO_QUEUE_STATE 0 /* Request is in between states */
-+ #define SRB_FREE_STATE 1
-+ #define SRB_PENDING_STATE 2
-+ #define SRB_ACTIVE_STATE 3
-+ #define SRB_ACTIVE_TIMEOUT_STATE 4
-+ #define SRB_RETRY_STATE 5
-+ #define SRB_DONE_STATE 6
-+ #define SRB_SUSPENDED_STATE 7 /* Request in suspended state */
-+ #define SRB_FAILOVER_STATE 8 /* Request in Failover Queue */
-+
-+ #define SRB_STATE_TBL() \
-+ { \
-+ "NO_QUEUE" , \
-+ "FREE" , \
-+ "PENDING" , \
-+ "ACTIVE" , \
-+ "ACTIVE_TIMEOUT" , \
-+ "RETRY" , \
-+ "DONE" , \
-+ "SUSPENDED" , \
-+ "FAILOVER" , \
-+ NULL \
-+ }
-+
-+ uint8_t entry_count; /* (1) number of request queue
-+ * entries used */
-+ uint16_t reserved2;
-+ uint16_t active_array_index;
-+
-+ struct scsi_cmnd *cmd; /* (4) SCSI command block */
-+ dma_addr_t saved_dma_handle; /* (4) for unmap of single transfers */
-+ atomic_t ref_count; /* reference count for this srb */
-+ uint32_t fw_ddb_index;
-+ /* Target/LUN queue pointers. */
-+ struct os_tgt *tgt_queue; /* ptr to visible ha's target */
-+ struct os_lun *lun_queue; /* ptr to visible ha's lun */
-+ struct fc_lun *fclun; /* FC LUN context pointer. */
-+ /* Raw completion info for use by failover ? */
-+ uint8_t fo_retry_cnt; /* Retry count this request */
-+ uint8_t err_id; /* error id */
-+ #define SRB_ERR_PORT 1 /* Request failed because "port down" */
-+ #define SRB_ERR_LOOP 2 /* Request failed because "loop down" */
-+ #define SRB_ERR_DEVICE 3 /* Request failed because "device error" */
-+ #define SRB_ERR_OTHER 4
-+
-+ uint32_t lun;
-+ struct timer_list timer; /* used to timeout command */
-+ uint16_t os_tov;
-+ uint16_t iocb_tov;
-+ uint16_t iocb_cnt; /* Number of used iocbs */
-+ uint16_t cc_stat;
-+ u_long r_start; /* Time we recieve a cmd from OS*/
-+ u_long u_start; /* Time when we handed the cmd to F/W */
-+} srb_t;
-+
-+/*
-+ * SCSI Target Queue structure
-+ */
-+typedef struct os_tgt {
-+ struct os_lun *olun[MAX_LUNS]; /* LUN context pointer. */
-+ struct scsi_qla_host *ha;
-+ uint32_t down_timer;
-+ struct fc_port *fcport; /* Current fcport for this target */
-+ unsigned long flags;
-+ uint8_t port_down_retry_count;
-+ uint8_t id;
-+
-+ /* Persistent binding information */
-+ uint16_t ddb_index;
-+ uint8_t iscsi_name[ISCSI_NAME_SIZE];
-+ //uint8_t ip_addr[ISCSI_IPADDR_SIZE];
-+ //uint8_t alias[ISCSI_ALIAS_SIZE];
-+ uint8_t *name;
-+} os_tgt_t;
-+
-+/*
-+ * SCSI Target Queue flags
-+ */
-+#define TQF_ONLINE 0 /* Device online to OS. */
-+#define TQF_SUSPENDED 1
-+#define TQF_RETRY_CMDS 2
-+
-+/*
-+ * LUN structure
-+ */
-+typedef struct os_lun {
-+ struct fc_lun *fclun; /* FC LUN context pointer. */
-+ struct list_head list_entry; /* 16 x10 For suspended lun list */
-+ struct scsi_device *sdev;
-+
-+ spinlock_t lun_lock; /* 24 x18 For suspended lun list */
-+ unsigned long flags;
-+ #define LF_LUN_DELAYED 0
-+ #define LF_LUN_SUSPEND 1
-+ #define LF_LUN_BLOCKED 2
-+ #define LUN_MPIO_RESET_CNTS 3 /* Lun */
-+
-+ uint8_t lun_state; /* 00 x00 */
-+ #define LS_LUN_READY 0 /* LUN is ready to accept commands */
-+ #define LS_LUN_SUSPENDED 1 /* LUN is suspended */
-+ #define LS_LUN_RETRY 2 /* LUN is retrying commands */
-+ #define LS_LUN_TIMEOUT 3 /* */
-+ #define LUN_STATE_TBL() \
-+ { \
-+ "READY" , \
-+ "SUSPENDED" , \
-+ "RETRY" , \
-+ "TIMEOUT" , \
-+ NULL \
-+ }
-+
-+ uint8_t out_count; /* 01 x01 Number of outstanding commands */
-+ uint8_t lun; /* 02 x02 Lun number */
-+
-+ uint8_t retry_count; /* 03 x03 Number of times lun is suspended */
-+ uint8_t max_retry_count; /* 04 x04 Max number of times lun can be */
-+ /* suspended before returning commands */
-+ uint8_t reserved[3]; /* 05 x05 */
-+ uint32_t tot_io_count; /* 08 x08 Total num outstanding I/Os */
-+ atomic_t suspend_timer; /* 12 x0c Timer for suspending lun */
-+ //struct list_head list_entry; /* 16 x10 List structure for suspended lun list */
-+ //spinlock_t lun_lock; /* 24 x18 Spinlock for suspended lun list */
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ void *fo_info;
-+#endif
-+} os_lun_t;
-+
-+/* Never set this to Zero */
-+#define SUSPEND_SECONDS 6
-+#define SUSPEND_RETRIES 1
-+
-+/* LUN BitMask structure definition, array of 32bit words,
-+ * 1 bit per lun. When bit == 1, the lun is masked.
-+ * Most significant bit of mask[0] is lun 0, bit 24 is lun 7.
-+ */
-+typedef struct lun_bit_mask {
-+ /* Must allocate at least enough bits to accomodate all LUNs */
-+#if ((MAX_LUNS & 0x7) == 0)
-+ UINT8 mask[MAX_LUNS >> 3];
-+#else
-+ uint8_t mask[(MAX_LUNS + 8) >> 3];
-+#endif
-+} lun_bit_mask_t;
-+
-+/*---------------------------------------------------------------------------*/
-+
-+/*
-+ * Device Database (DDB) structure
-+ */
-+
-+typedef struct ddb_entry {
-+ struct list_head list_entry; /* 00 x00 */
-+ uint16_t bus; /* 08 x08 SCSI bus number */
-+ uint16_t target; /* 10 x0a SCSI target ID */
-+ struct fc_port *fcport;
-+ uint16_t fw_ddb_index; /* 12 x0c DDB index from firmware's DEV_DB structure */
-+ uint16_t out_count; /* 14 x0e Number of active commands */
-+
-+ uint8_t num_valid_luns; /* 16 x10 Number of valid luns */
-+ uint8_t reserved[3]; /* 17 x11 */
-+
-+ /* refer to MBOX_CMD_GET_DATABASE_ENTRY for fw_ddb_fw_ddb_device_state definitions */
-+ uint32_t fw_ddb_device_state; /* 20 x14 Device State */
-+ #define DDB_STATE_TBL(){ \
-+ "UNASSIGNED", \
-+ "NO_CONNECTION_ACTIVE", \
-+ "DISCOVERY", \
-+ "NO_SESSION_ACTIVE", \
-+ "SESSION_ACTIVE", \
-+ "LOGGING_OUT", \
-+ "SESSION_FAILED", \
-+ NULL \
-+ }
-+ uint32_t CmdSn; /* 24 x18 */
-+ uint16_t target_session_id; /* 28 x1c */
-+ uint16_t connection_id; /* 30 x1e */
-+ uint16_t exe_throttle; /* 32 x20 Max mumber of cmds outstanding simultaneously */
-+ uint16_t task_mgmt_timeout; /* 34 x22 Min time for task mgmt cmds to complete */
-+ uint16_t default_relogin_timeout; /*36 x24 Max time to wait for relogin to complete */
-+ uint16_t tcp_source_port_num; /* 38 x26 */
-+ uint32_t default_time2wait; /* 40 x28 Default Min time between relogins (+aens) */
-+ atomic_t port_down_timer; /* 44 x2c Device down time */
-+ atomic_t retry_relogin_timer; /* 48 x30 Min Time between relogins (4000 only)*/
-+ atomic_t relogin_timer; /* 52 x34 Max Time to wait for relogin to complete */
-+ atomic_t relogin_retry_count; /* 56 x38 Num of times relogin has been retried */
-+ atomic_t state; /* 60 x3c Device State*/
-+ #define DEV_STATE_DEAD 0 /* We can no longer talk to this device */
-+ #define DEV_STATE_ONLINE 1 /* Device ready to accept commands */
-+ #define DEV_STATE_MISSING 2 /* Device logged off, trying to re-login */
-+ #define DEV_STATE_TBL(){ \
-+ "DEAD" , \
-+ "ONLINE" , \
-+ "MISSING" , \
-+ NULL \
-+ }
-+ unsigned long flags; /* 64 x40 */
-+ #define DF_RELOGIN 0 /* Relogin to device */
-+ #define DF_NO_RELOGIN 1 /* Do not relogin if IOCTL logged it out */
-+ #define DF_ISNS_DISCOVERED 2 /* Device was discovered via iSNS */
-+
-+ uint8_t ip_addr[ISCSI_IPADDR_SIZE];
-+ // uint8_t ip_addr[4]; /* 68 x44 */
-+ uint8_t iscsi_name[ISCSI_NAME_SIZE]; /* 72 x48 */
-+ // uint8_t iscsi_name[0x100]; /* 72 x48 */
-+ // lun_entry_t *lun_table[MAX_LUNS];/*328 x148 */
-+} ddb_entry_t; /*840 x348 */
-+
-+/*
-+ * Fibre channel port type.
-+ */
-+typedef enum {
-+ FCT_UNKNOWN,
-+ FCT_RSCN,
-+ FCT_SWITCH,
-+ FCT_BROADCAST,
-+ FCT_INITIATOR,
-+ FCT_TARGET
-+} fc_port_type_t;
-+
-+/*
-+ * Fibre channel port structure.
-+ */
-+typedef struct fc_port {
-+ struct list_head list;
-+ struct list_head fcluns;
-+
-+ struct scsi_qla_host *ha;
-+ struct scsi_qla_host *vis_ha; /* only used when suspending lun */
-+ ddb_entry_t *ddbptr;
-+
-+ uint8_t *iscsi_name;
-+ fc_port_type_t port_type;
-+
-+ atomic_t state;
-+ uint32_t flags;
-+
-+ os_tgt_t *tgt_queue;
-+ uint16_t os_target_id;
-+ uint8_t device_type;
-+ uint8_t unused;
-+
-+ uint8_t mp_byte; /* multi-path byte (not used) */
-+ uint8_t cur_path; /* current path id */
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ int16_t cfg_id; /* index into cfg device table */
-+ uint16_t notify_type;
-+ int (*fo_combine)(void *, uint16_t, struct fc_port *, uint16_t);
-+ int (*fo_detect)(void);
-+ int (*fo_notify)(void);
-+ int (*fo_select)(void);
-+#endif
-+
-+ lun_bit_mask_t lun_mask;
-+ int loop_id;
-+} fc_port_t;
-+
-+
-+/*
-+ * Fibre channel port/lun states.
-+ */
-+#define FCS_UNCONFIGURED 1
-+#define FCS_DEVICE_DEAD 2
-+#define FCS_DEVICE_LOST 3
-+#define FCS_ONLINE 4
-+#define FCS_NOT_SUPPORTED 5
-+#define FCS_FAILOVER 6
-+#define FCS_FAILOVER_FAILED 7
-+
-+/*
-+ * FC port flags.
-+ */
-+#define FCF_FABRIC_DEVICE BIT_0
-+#define FCF_INITIATOR_DEVICE BIT_1
-+#define FCF_FO_MASKED BIT_2
-+#define FCF_FAILOVER_NEEDED BIT_3
-+#define FCF_RESET_NEEDED BIT_4
-+#define FCF_PERSISTENT_BOUND BIT_5
-+#define FCF_TAPE_PRESENT BIT_6
-+#define FCF_XP_DEVICE BIT_7
-+#define FCF_CONFIG_DEVICE BIT_8
-+#define FCF_MSA_DEVICE BIT_9
-+#define FCF_MSA_PORT_ACTIVE BIT_10
-+#define FCF_LOGIN_NEEDED BIT_12
-+#define FCF_EVA_DEVICE BIT_13
-+
-+#define FCF_RLC_SUPPORT BIT_14
-+#define FCF_CONFIG BIT_15 /* Needed? */
-+#define FCF_RESCAN_NEEDED BIT_16
-+#define FCF_FAILBACK_DISABLE BIT_17
-+#define FCF_FAILOVER_DISABLE BIT_18
-+
-+#define FCF_VSA BIT_19
-+#define FCF_HD_DEVICE BIT_20
-+#define FCF_NONFO_DEVICE BIT_21 /* Non Failover device */
-+
-+/* No loop ID flag. */
-+//#define FC_NO_LOOP_ID 0x1000
-+
-+/*
-+ * Fibre channel LUN structure.
-+ */
-+typedef struct fc_lun {
-+ struct list_head list;
-+
-+ fc_port_t *fcport;
-+ uint16_t lun;
-+ atomic_t state;
-+ uint8_t device_type;
-+ uint8_t flags;
-+ #define FLF_VISIBLE_LUN BIT_0
-+ #define FLF_ACTIVE_LUN BIT_1
-+
-+ uint8_t lun_state; /* 00 x00 */
-+ #define LS_LUN_RESET_MARKER_NEEDED 4 /* LUN Reset marker needed */
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ void *mplun;
-+ void *mpbuf; /* ptr to buffer use by multi-path driver */
-+ int mplen;
-+ uint8_t max_path_retries;
-+#endif
-+} fc_lun_t, lun_entry_t;
-+
-+
-+/*---------------------------------------------------------------------------*/
-+
-+/*
-+ * Asynchronous Event Queue structure
-+ */
-+typedef struct {
-+ uint32_t mbox_sts[MBOX_AEN_REG_COUNT];
-+}aen_t;
-+
-+
-+/*
-+ * NOTE: This structure definition really belongs in the ql4isns.h file,
-+ * but it's easier to compile when the structure is defined here.
-+ */
-+typedef struct _ATTRIBUTE_LIST {
-+ uint32_t isns_tag;
-+ #define ISNS_ATTR_TYPE_EMPTY 1 // Used for delimiter attr. & operating attr. for query.
-+ #define ISNS_ATTR_TYPE_STRING 2 // UTF-8 encoded string
-+ #define ISNS_ATTR_TYPE_ULONG 3
-+ #define ISNS_ATTR_TYPE_ADDRESS 4 // 128-bit IPv6
-+ uint32_t type;
-+ unsigned long data;
-+} ATTRIBUTE_LIST;
-+
-+typedef struct hba_ioctl{
-+
-+ /* This semaphore protects several threads to do ioctl commands
-+ * concurrently.
-+ *-------------------------------------------------------------------*/
-+ struct semaphore ioctl_sem;
-+
-+ /* Passthru cmd/completion */
-+ struct semaphore ioctl_cmpl_sem;
-+ struct timer_list ioctl_cmpl_timer;
-+ uint32_t ioctl_tov;
-+ struct scsi_cmnd *ioctl_err_cmd;
-+ uint8_t ioctl_scsi_pass_in_progress;
-+ uint8_t ioctl_iocb_pass_in_progress;
-+
-+ /* AEN queue */
-+ void *aen_tracking_queue;/* points to async events buffer */
-+ uint8_t aen_q_head; /* index to the current head of q */
-+ uint8_t aen_q_tail; /* index to the current tail of q */
-+
-+ /* Misc. */
-+ uint32_t flags;
-+#define IOCTL_OPEN BIT_0
-+#define IOCTL_AEN_TRACKING_ENABLE BIT_1
-+ uint8_t *scrap_mem; /* per ha scrap buf for ioctl usage */
-+ uint32_t scrap_mem_size; /* total size */
-+ uint32_t scrap_mem_used; /* portion used */
-+
-+} hba_ioctl_context;
-+
-+/*
-+ * Linux Host Adapter structure
-+ */
-+typedef struct scsi_qla_host {
-+ struct list_head list;
-+
-+ /* Linux adapter configuration data */
-+ struct Scsi_Host *host; /* pointer to host data */
-+ struct scsi_qla_host *next;
-+
-+ uint32_t tot_ddbs;
-+
-+ unsigned long flags;
-+ #define AF_ONLINE 0 /* 0x00000001 */
-+ #define AF_INIT_DONE 1 /* 0x00000002 */
-+ #define AF_MBOX_COMMAND 2 /* 0x00000004 */
-+ #define AF_MBOX_COMMAND_DONE 3 /* 0x00000008 */
-+ #define AF_DPC_SCHEDULED 5 /* 0x00000020 */
-+ #define AF_INTERRUPTS_ON 6 /* 0x00000040 Not Used */
-+ #define AF_GET_CRASH_RECORD 7 /* 0x00000080 */
-+ #define AF_LINK_UP 8 /* 0x00000100 */
-+ #define AF_TOPCAT_CHIP_PRESENT 9 /* 0x00000200 */
-+ #define AF_IRQ_ATTACHED 10 /* 0x00000400 */
-+ #define AF_64BIT_PCI_ADDR 11 /* 0x00000800 */
-+
-+ unsigned long dpc_flags;
-+ #define DPC_RESET_HA 1 /* 0x00000002 */
-+ #define DPC_RETRY_RESET_HA 2 /* 0x00000004 */
-+ #define DPC_RELOGIN_DEVICE 3 /* 0x00000008 */
-+ #define DPC_RESET_HA_DESTROY_DDB_LIST 4 /* 0x00000010 */
-+ #define DPC_RESET_HA_INTR 5 /* 0x00000020 */
-+ #define DPC_IOCTL_ERROR_RECOVERY 6 /* 0x00000040 */
-+ #define DPC_ISNS_RESTART 7 /* 0x00000080 */
-+ #define DPC_ISNS_RESTART_COMPLETION 8 /* 0x00000100 */
-+ #define DPC_AEN 9 /* 0x00000200 */
-+ #define DPC_CHECK_LUN 10 /* 0x00000200 */
-+
-+ /* Failover flags */
-+ #define DPC_FAILOVER_EVENT_NEEDED 10
-+ #define DPC_FAILOVER_EVENT 11
-+ #define DPC_FAILOVER_NEEDED 12
-+
-+ #define DPC_WAIT_TO_RELOGIN_DEVICE 13
-+
-+ uint16_t iocb_cnt;
-+ uint16_t iocb_hiwat;
-+ uint16_t req_q_count; /* Number of available request queue entries. */
-+
-+ u_long i_start; /* jiffies at start of IOCTL */
-+ u_long i_end; /* jiffies at end of IOCTL */
-+ u_long f_start; /* jiffies at sending cmd to f/w */
-+ u_long f_end; /* jiffies at receiving cmd from f/w */
-+
-+ /* pci information */
-+ struct pci_dev *pdev;
-+ struct qla_board_info *brd_info;
-+ unsigned long pci_resource_flags;
-+
-+ uint8_t marker_needed;
-+ uint8_t rsvd1;
-+
-+ /* adapter instance w.r.t. all scsi hosts in OS */
-+ uint16_t host_no;
-+
-+ /* adapter instance w.r.t. this driver */
-+ uint16_t instance;
-+
-+ void *virt_mmapbase;
-+
-+ uint32_t function_number;
-+
-+ /* ISP registers, Base Memory-mapped I/O address */
-+ isp_reg_t *reg;
-+
-+ // temp only
-+ unsigned long io_addr;
-+ unsigned long mem_addr;
-+ unsigned long io_len;
-+ unsigned long mem_len;
-+ unsigned int irq; /* IRQ for adapter */
-+
-+ /* NVRAM registers */
-+ eeprom_data_t *nvram;
-+
-+ /* Counters for general statistics */
-+ uint64_t adapter_error_count;
-+ uint64_t device_error_count;
-+ uint64_t total_io_count;
-+ uint64_t total_mbytes_xferred;
-+ uint64_t isr_count; /* Interrupt count */
-+ uint64_t link_failure_count;
-+ uint64_t invalid_crc_count;
-+
-+ uint32_t spurious_int_count;
-+ uint32_t aborted_io_count;
-+ uint32_t io_timeout_count;
-+ uint32_t mailbox_timeout_count;
-+ uint32_t seconds_since_last_intr;
-+ uint32_t seconds_since_last_heartbeat;
-+
-+ /* Info Needed for Management App */
-+ /* --- From GetFwVersion --- */
-+ uint32_t firmware_version[2];
-+ uint32_t patch_number;
-+ uint32_t build_number;
-+ /* --- From Init_FW --- */
-+ uint16_t firmware_options;
-+ uint16_t tcp_options;
-+ uint8_t ip_address[IP_ADDR_LEN];
-+ uint8_t isns_ip_address[IP_ADDR_LEN];
-+ uint16_t isns_server_port_number;
-+ uint8_t alias[32];
-+ uint8_t name_string[256];
-+ uint8_t heartbeat_interval;
-+ uint8_t rsvd;
-+ /* --- From FlashSysInfo --- */
-+ uint8_t my_mac[MAC_ADDR_LEN];
-+ uint8_t serial_number[16];
-+ /* --- From GetFwState --- */
-+ uint32_t firmware_state;
-+ uint32_t board_id;
-+ uint32_t addl_fw_state;
-+
-+ /* FIXME: Define an iscsi structure for this stuf and point to it*/
-+ /* - this helps to keep the HA small for performance */
-+ /* iSNS information */
-+ unsigned long isns_flags;
-+ #define ISNS_FLAG_ISNS_ENABLED_IN_ISP 0 /* 0x00000001 */
-+ #define ISNS_FLAG_ISNS_SRV_ENABLED 1 /* 0x00000002 */
-+ #define ISNS_FLAG_ISNS_SRV_REGISTERED 2 /* 0x00000004 */
-+ #define ISNS_FLAG_ISNS_SCN_REGISTERED 4 /* 0x00000010 */
-+ #define ISNS_FLAG_QUERY_SINGLE_OBJECT 5 /* 0x00000020 */
-+ #define ISNS_FLAG_SCN_IN_PROGRESS 6 /* 0x00000040 */
-+ #define ISNS_FLAG_SCN_RESTART 7 /* 0x00000080 */
-+ #define ISNS_FLAG_REREGISTER 28 /* 0x10000000 */
-+ #define ISNS_FLAG_RESTART_SERVICE 31 /* 0x80000000 */
-+
-+ uint16_t isns_connection_id;
-+ uint16_t isns_scn_conn_id;
-+ uint16_t isns_esi_conn_id;
-+ uint16_t isns_nsh_conn_id;
-+ uint16_t isns_remote_port_num;
-+ uint16_t isns_scn_port_num;
-+ uint16_t isns_esi_port_num;
-+ uint16_t isns_nsh_port_num;
-+ uint8_t isns_entity_id[256];
-+
-+ atomic_t isns_restart_timer;
-+ uint16_t isns_transaction_id;
-+ uint16_t isns_num_discovered_targets;
-+
-+ ATTRIBUTE_LIST isns_reg_attr_list[13];
-+ ATTRIBUTE_LIST isns_dereg_attr_list[7];
-+ ATTRIBUTE_LIST isns_scn_reg_attr_list[5];
-+ ATTRIBUTE_LIST isns_scn_dereg_attr_list[3];
-+ ATTRIBUTE_LIST isns_dev_get_next_attr_list[5];
-+ ATTRIBUTE_LIST isns_dev_attr_qry_attr_list[13];
-+
-+ /* Linux kernel thread */
-+ pid_t dpc_pid;
-+ int dpc_should_die;
-+ struct completion dpc_inited;
-+ struct completion dpc_exited;
-+ struct semaphore *dpc_wait;
-+ uint8_t dpc_active; /* DPC routine is active */
-+
-+ /* Linux timer thread */
-+ struct timer_list timer;
-+ uint32_t timer_active;
-+
-+ /* Recovery Timers */
-+ uint32_t port_down_retry_count;
-+ uint32_t discovery_wait;
-+ atomic_t check_relogin_timeouts;
-+ uint32_t retry_reset_ha_cnt;
-+ uint32_t isp_reset_timer; /* reset test timer */
-+
-+ int eh_start; /* To wake up the mid layer error
-+ * handler thread */
-+
-+ /* This spinlock must be held with irqs disabled in order to access
-+ * the pending, retry and free srb queues.
-+ *
-+ * The list_lock spinlock is of lower priority than the io_request
-+ * lock.
-+ *-------------------------------------------------------------------*/
-+ spinlock_t list_lock ____cacheline_aligned;
-+
-+ /* internal srb queues */
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ struct list_head failover_queue; /* failover request list. */
-+ uint16_t failover_cnt;
-+#endif
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ struct list_head retry_srb_q; /* retry queue request list */
-+ uint16_t retry_srb_q_count;
-+#endif
-+
-+ struct list_head free_srb_q;
-+ uint16_t free_srb_q_count;
-+ uint16_t num_srbs_allocated;
-+
-+ /* This spinlock must be held with irqs disabled in order to access
-+ * the done srb queue and suspended_lun queue.
-+ *
-+ * The adapter_lock spinlock is of lower priority than the
-+ * io_request lock.
-+ *------------------------------------------------------------------*/
-+ spinlock_t adapter_lock;
-+
-+ /* Done queue
-+ * In order to avoid deadlocks with the list_lock,
-+ * place all srbs to be returned to OS on this list.
-+ * After the list_lock is released, return all of
-+ * these commands to the OS */
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ struct list_head done_srb_q;
-+ uint16_t done_srb_q_count;
-+#endif
-+
-+ /* This spinlock is used to protect "io transactions", you must
-+ * aquire it before doing any IO to the card, eg with RD_REG*() and
-+ * WRT_REG*() for the duration of your entire command transaction.
-+ * It is also used to protect the active_srb_array.
-+ *
-+ * The hardware_lock spinlock is of lower priority than the
-+ * io request lock.
-+ *-------------------------------------------------------------------*/
-+ //spinlock_t hardware_lock ____cacheline_aligned;
-+ spinlock_t hardware_lock;
-+
-+ /* Active array */
-+ srb_t *active_srb_array[MAX_SRBS];
-+ uint16_t active_srb_count;
-+ uint16_t current_active_index;
-+
-+ int mem_err;
-+
-+ /* DMA Memory Block */
-+ void *queues;
-+ dma_addr_t queues_dma;
-+ unsigned long queues_len;
-+#define MEM_ALIGN_VALUE \
-+ ((MAX(REQUEST_QUEUE_DEPTH, RESPONSE_QUEUE_DEPTH)) * \
-+ sizeof(QUEUE_ENTRY))
-+
-+ /* request and response queue variables */
-+ dma_addr_t request_dma;
-+ QUEUE_ENTRY *request_ring;
-+ QUEUE_ENTRY *request_ptr;
-+
-+ dma_addr_t response_dma;
-+ QUEUE_ENTRY *response_ring;
-+ QUEUE_ENTRY *response_ptr;
-+
-+ dma_addr_t shadow_regs_dma;
-+ shadow_regs_t *shadow_regs;
-+
-+ uint16_t request_in; /* Current indexes. */
-+ uint16_t request_out;
-+ uint16_t response_in;
-+ uint16_t response_out;
-+
-+ /* aen queue variables */
-+ uint16_t aen_q_count; /* Number of available aen_q entries */
-+ uint16_t aen_in; /* Current indexes */
-+ uint16_t aen_out;
-+ aen_t aen_q[MAX_AEN_ENTRIES];
-+
-+ /* pdu variables */
-+ uint16_t pdu_count; /* Number of available aen_q entries */
-+ uint16_t pdu_in; /* Current indexes */
-+ uint16_t pdu_out;
-+
-+ PDU_ENTRY *free_pdu_top;
-+ PDU_ENTRY *free_pdu_bottom;
-+ uint16_t pdu_active;
-+ PDU_ENTRY pdu_queue[MAX_PDU_ENTRIES];
-+
-+ /* This semaphore protects several threads to do mailbox commands
-+ * concurrently.
-+ *-------------------------------------------------------------------*/
-+ struct semaphore mbox_sem;
-+ wait_queue_head_t mailbox_wait_queue;
-+
-+ /* temporary mailbox status registers */
-+ volatile uint8_t mbox_status_count;
-+ volatile uint32_t mbox_status[MBOX_REG_COUNT];
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ hba_ioctl_context *ioctl;
-+ void *ioctl_dma_bufv;
-+ dma_addr_t ioctl_dma_bufp;
-+ uint32_t ioctl_dma_buf_len;
-+#endif
-+
-+ ISNS_DISCOVERED_TARGET *isns_disc_tgt_databasev;
-+ dma_addr_t isns_disc_tgt_databasep;
-+ uint32_t isns_disc_tgt_database_size;
-+
-+ /* local device database list (contains internal ddb entries)*/
-+ struct list_head ddb_list;
-+ /* Fibre Channel Device List. */
-+ struct list_head fcports;
-+
-+ /* Map ddb_list entry by SCSI target id */
-+ // ddb_entry_t *target_map[MAX_TARGETS];
-+ /* OS target queue pointers. */
-+ os_tgt_t *otgt[MAX_TARGETS+1];
-+
-+ /* Map ddb_list entry by FW ddb index */
-+ ddb_entry_t *fw_ddb_index_map[MAX_DDB_ENTRIES];
-+
-+ uint32_t failover_type;
-+ uint32_t failback_delay;
-+ unsigned long cfg_flags;
-+ #define CFG_ACTIVE 0 /* CFG during a failover, event update, or ioctl */
-+ #define CFG_FAILOVER 1
-+
-+ /* Adapter I/O statistics for failover */
-+ uint64_t IosRequested;
-+ uint64_t BytesRequested;
-+ uint64_t IosExecuted;
-+ uint64_t BytesExecuted;
-+
-+ /*
-+ * There are several Scsi_Host members that are RHEL3 specific
-+ * yet depend on the SCSI_HAS_HOST_LOCK define for visibility.
-+ * Unfortuantely, it seems several RH kernels have the define
-+ * set, but do not have a host_lock member.
-+ *
-+ * Use the SH_HAS_HOST_LOCK define determined during driver
-+ * compilation rather than SCSI_HAS_HOST_LOCK.
-+ */
-+
-+ /* Scsi midlayer lock */
-+ #if defined(SH_HAS_HOST_LOCK)
-+ spinlock_t host_lock ____cacheline_aligned;
-+ #endif
-+}scsi_qla_host_t;
-+
-+#define ADAPTER_UP(ha) ((test_bit(AF_ONLINE, &ha->flags) != 0) && (test_bit(AF_LINK_UP, &ha->flags) != 0))
-+
-+typedef struct {
-+ uint8_t ha_mac[MAX_HBAS][MAC_ADDR_LEN];
-+} mac_cfgs_t;
-+
-+/*
-+ * Other macros
-+ */
-+#define TGT_Q(ha, t) (ha->otgt[t])
-+#define LUN_Q(ha, t, l) (TGT_Q(ha, t)->olun[l])
-+#define GET_LU_Q(ha, t, l) ((TGT_Q(ha,t) != NULL)? TGT_Q(ha, t)->olun[l] : NULL)
-+
-+#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
-+
-+#define ql4_printk(level, ha, format, arg...) \
-+ dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
-+
-+
-+/*---------------------------------------------------------------------------*/
-+
-+/* Defines for qla4xxx_initialize_adapter() and qla4xxx_recover_adapter() */
-+#define PRESERVE_DDB_LIST 0
-+#define REBUILD_DDB_LIST 1
-+
-+/* Defines for process_aen() */
-+#define PROCESS_ALL_AENS 0
-+#define FLUSH_DDB_CHANGED_AENS 1
-+
-+/* Defines for qla4xxx_take_hw_semaphore */
-+#define NO_WAIT 0
-+#define WAIT_FOREVER 1
-+#define TIMED_WAIT 2
-+
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+#include "qlisioct.h"
-+#include "qlinioct.h"
-+#include "qlnfo.h"
-+#include "ql4_cfg.h"
-+#include "ql4_foln.h"
-+#endif
-+#include "ql4_version.h"
-+#include "ql4_settings.h"
-+#include "ql4_glbl.h"
-+#include "ql4_dbg.h"
-+#include "ql4_inline.h"
-+#include "ql4_listops.h"
-+#include "ql4_isns.h"
-+#include "ql4_foln.h"
-+
-+
-+#endif /*_QLA4XXX_H */
-+
-+/*
-+ * Overrides for Emacs so that we get a uniform tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 4
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -4
-+ * c-argdecl-indent: 4
-+ * c-label-offset: -4
-+ * c-continued-statement-offset: 4
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_fo.c ./drivers/scsi/qla4xxx/ql4_fo.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_fo.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_fo.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,595 @@
-+/********************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic ISP4xxx device driver for Linux 2.6.x
-+* Copyright (C) 2003-2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+*
-+******************************************************************************
-+* Failover include file
-+******************************************************************************/
-+
-+// #include "ql4_os.h"
-+#include "ql4_def.h"
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+
-+
-+/*
-+ * Global variables
-+ */
-+SysFoParams_t qla_fo_params;
-+
-+/*
-+ * Local routines
-+ */
-+static uint8_t qla4xxx_fo_count_retries(scsi_qla_host_t *ha, srb_t *sp);
-+
-+/*
-+ * qla4xxx_reset_lun_fo_counts
-+ * Reset failover retry counts
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+void
-+qla4xxx_reset_lun_fo_counts(scsi_qla_host_t *ha, os_lun_t *lq)
-+{
-+ srb_t *tsp;
-+ os_lun_t *orig_lq;
-+ struct list_head *list;
-+ unsigned long flags ;
-+ uint16_t path_id;
-+ struct fo_information *mp_info;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ /*
-+ * the retry queue.
-+ */
-+ list_for_each(list,&ha->retry_srb_q)
-+ {
-+ tsp = list_entry(list, srb_t, list_entry);
-+ orig_lq = tsp->lun_queue;
-+ if (orig_lq == lq)
-+ tsp->fo_retry_cnt = 0;
-+ }
-+
-+ /*
-+ * the done queue.
-+ */
-+ list_for_each(list, &ha->done_srb_q)
-+ {
-+ tsp = list_entry(list, srb_t, list_entry);
-+ orig_lq = tsp->lun_queue;
-+ if (orig_lq == lq)
-+ tsp->fo_retry_cnt = 0;
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ /* reset the failover retry count on all the paths */
-+ mp_info = (struct fo_information *) lq->fo_info;
-+ for (path_id = 0; path_id < MAX_PATHS_PER_DEVICE ; path_id++)
-+ mp_info->fo_retry_cnt[path_id] = 0;
-+
-+}
-+
-+
-+#if 0
-+void qla4xxx_find_all_active_ports(srb_t *sp)
-+{
-+ scsi_qla_host_t *ha = qla4xxx_hostlist;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ fc_lun_t *orig_fclun;
-+
-+ DEBUG2(printk(KERN_INFO "%s: Scanning for active ports... %d\n",
-+ __func__, sp->lun_queue->fclun->lun);)
-+ orig_fclun = sp->lun_queue->fclun;
-+ for (; (ha != NULL); ha=ha->next) {
-+ list_for_each_entry(fcport, &ha->fcports, list)
-+ {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+ if ((fcport->flags & (FCF_EVA_DEVICE|FCF_MSA_DEVICE))) {
-+ list_for_each_entry(fclun, &fcport->fcluns, list)
-+ {
-+ if (fclun->flags & FCF_VISIBLE_LUN)
-+ continue;
-+ if (orig_fclun->lun != fclun->lun)
-+ continue;
-+ qla4xxx_test_active_lun(fcport,fclun);
-+ }
-+ }
-+#if MSA1000_SUPPORTED
-+ if ((fcport->flags & FCF_MSA_DEVICE))
-+ qla4xxx_test_active_port(fcport);
-+#endif
-+ }
-+ }
-+ DEBUG2(printk(KERN_INFO "%s: Scanning ports...Done\n",
-+ __func__);)
-+}
-+#endif
-+
-+/*
-+ * qla4xxx_fo_count_retries
-+ * Increment the retry counter for the command.
-+ * Set or reset the SRB_RETRY flag.
-+ *
-+ * Input:
-+ * sp = Pointer to command.
-+ *
-+ * Returns:
-+ * 1 -- retry
-+ * 0 -- don't retry
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint8_t
-+qla4xxx_fo_count_retries(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+
-+ uint8_t retry = 0;
-+ os_lun_t *lq;
-+ os_tgt_t *tq;
-+ scsi_qla_host_t *vis_ha;
-+ uint16_t path_id;
-+ struct fo_information *mp_info;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__);)
-+ lq = sp->lun_queue;
-+ mp_info = (struct fo_information *) lq->fo_info;
-+ if (test_and_clear_bit(LUN_MPIO_RESET_CNTS, &lq->flags))
-+ for (path_id = 0; path_id < MAX_PATHS_PER_DEVICE; path_id++)
-+ mp_info->fo_retry_cnt[path_id] = 0;
-+
-+ /* check to see if we have exhausted retries on all the paths */
-+ for( path_id = 0; path_id < mp_info->path_cnt; path_id++) {
-+ if(mp_info->fo_retry_cnt[path_id] >=
-+ qla_fo_params.MaxRetriesPerPath)
-+ continue;
-+ retry = 1;
-+ break;
-+ }
-+
-+ if (!retry) {
-+ printk(KERN_INFO "qla4x00: no more failovers for request - pid = %ld",sp->cmd->serial_number);
-+ } else {
-+ /*
-+ * We haven't exceeded the max retries for this request, check
-+ * max retries this path
-+ */
-+ if ((++sp->fo_retry_cnt % qla_fo_params.MaxRetriesPerPath) == 0) {
-+ path_id = sp->fclun->fcport->cur_path;
-+ mp_info->fo_retry_cnt[path_id]++;
-+ DEBUG2(printk(" %s: FAILOVER - queuing ha=%d, sp=%p,"
-+ "pid =%ld, path_id=%d fo retry= %d \n",
-+ __func__, ha->host_no, sp,
-+ sp->cmd->serial_number, path_id,
-+ mp_info->fo_retry_cnt[path_id]);)
-+ /*
-+ * Note: we don't want it to timeout, so it is
-+ * recycling on the retry queue and the fialover queue.
-+ */
-+ lq = sp->lun_queue;
-+ tq = sp->tgt_queue;
-+ // set_bit(LUN_MPIO_BUSY, &lq->q_flag);
-+
-+ /*
-+ * ??? We can get a path error on any ha, but always
-+ * queue failover on originating ha. This will allow us
-+ * to syncronized the requests for a given lun.
-+ */
-+ /* Now queue it on to be failover */
-+ sp->ha = ha;
-+ /* we can only failover using the visible HA */
-+ vis_ha =
-+ (scsi_qla_host_t *)sp->cmd->device->host->hostdata;
-+ add_to_failover_queue(vis_ha,sp);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s: exiting. retry = %d.\n", __func__, retry);)
-+
-+ return retry ;
-+}
-+
-+int
-+qla4xxx_fo_check_device(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ int retry = 0;
-+ os_lun_t *lq;
-+ struct scsi_cmnd *cp;
-+ fc_port_t *fcport;
-+
-+ if ( !(sp->flags & SRB_GOT_SENSE) )
-+ return retry;
-+
-+ cp = sp->cmd;
-+ lq = sp->lun_queue;
-+ fcport = lq->fclun->fcport;
-+ switch (cp->sense_buffer[2] & 0xf) {
-+ case NOT_READY:
-+ if (fcport->flags & (FCF_MSA_DEVICE | FCF_EVA_DEVICE)) {
-+ /*
-+ * if we can't access port
-+ */
-+ if ((cp->sense_buffer[12] == 0x4 &&
-+ (cp->sense_buffer[13] == 0x0 ||
-+ cp->sense_buffer[13] == 0x3 ||
-+ cp->sense_buffer[13] == 0x2))) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ return 1;
-+ }
-+ }
-+ break;
-+
-+ case UNIT_ATTENTION:
-+ if (fcport->flags & FCF_EVA_DEVICE) {
-+ if ((cp->sense_buffer[12] == 0xa &&
-+ cp->sense_buffer[13] == 0x8)) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ return 1;
-+ }
-+ if ((cp->sense_buffer[12] == 0xa &&
-+ cp->sense_buffer[13] == 0x9)) {
-+ /* failback lun */
-+ }
-+ }
-+ break;
-+
-+ }
-+
-+ return (retry);
-+}
-+
-+/*
-+ * qla4xxx_fo_check
-+ * This function is called from the done routine to see if
-+ * the SRB requires a failover.
-+ *
-+ * This function examines the available os returned status and
-+ * if meets condition, the command(srb) is placed ont the failover
-+ * queue for processing.
-+ *
-+ * Input:
-+ * sp = Pointer to the SCSI Request Block
-+ *
-+ * Output:
-+ * sp->flags SRB_RETRY bit id command is to
-+ * be retried otherwise bit is reset.
-+ *
-+ * Returns:
-+ * None.
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ */
-+uint8_t
-+qla4xxx_fo_check(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ uint8_t retry = 0;
-+ int host_status;
-+#ifdef QL_DEBUG_LEVEL_2
-+ static char *reason[] = {
-+ "DID_OK",
-+ "DID_NO_CONNECT",
-+ "DID_BUS_BUSY",
-+ "DID_TIME_OUT",
-+ "DID_BAD_TARGET",
-+ "DID_ABORT",
-+ "DID_PARITY",
-+ "DID_ERROR",
-+ "DID_RESET",
-+ "DID_BAD_INTR",
-+ "DID_PASSTHROUGH",
-+ "DID_SOFT_ERROR",
-+ /* "DID_IMM_RETRY" */
-+ };
-+#endif
-+
-+ DEBUG9(printk("%s: entered.\n", __func__);)
-+
-+ /* we failover on selction timeouts only */
-+ host_status = host_byte(sp->cmd->result);
-+ if( host_status == DID_NO_CONNECT ||
-+ qla4xxx_fo_check_device(ha, sp) ) {
-+
-+ if (qla4xxx_fo_count_retries(ha, sp)) {
-+ /* Force a retry on this request, it will
-+ * cause the LINUX timer to get reset, while we
-+ * we are processing the failover.
-+ */
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ retry = 1;
-+ }
-+ DEBUG2(printk("qla4xxx_fo_check: pid= %ld sp %p/%d/%d retry count=%d, "
-+ "retry flag = %d, host status (%s), retuned status (%s)\n",
-+ sp->cmd->serial_number, sp, sp->state, sp->err_id, sp->fo_retry_cnt, retry,
-+ reason[host_status], reason[host_byte(sp->cmd->result)]);)
-+ }
-+
-+ /* Clear out any FO retry counts on good completions. */
-+ if (host_status == DID_OK)
-+ set_bit(LUN_MPIO_RESET_CNTS, &sp->lun_queue->flags);
-+
-+ DEBUG9(printk("%s: exiting. retry = %d.\n", __func__, retry);)
-+
-+ return retry;
-+}
-+
-+/*
-+ * qla4xxx_fo_path_change
-+ * This function is called from configuration mgr to notify
-+ * of a path change.
-+ *
-+ * Input:
-+ * type = Failover notify type, FO_NOTIFY_LUN_RESET or FO_NOTIFY_LOGOUT
-+ * newlunp = Pointer to the fc_lun struct for current path.
-+ * oldlunp = Pointer to fc_lun struct for previous path.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint32_t
-+qla4xxx_fo_path_change(uint32_t type, fc_lun_t *newlunp, fc_lun_t *oldlunp)
-+{
-+ uint32_t ret = QLA_SUCCESS;
-+
-+ newlunp->max_path_retries = 0;
-+ return ret;
-+}
-+
-+#if 0
-+/*
-+ * qla4xxx_fo_get_params
-+ * Process an ioctl request to get system wide failover parameters.
-+ *
-+ * Input:
-+ * pp = Pointer to FO_PARAMS structure.
-+ *
-+ * Returns:
-+ * EXT_STATUS code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla4xxx_fo_get_params(PFO_PARAMS pp)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__);)
-+
-+ pp->MaxPathsPerDevice = qla_fo_params.MaxPathsPerDevice;
-+ pp->MaxRetriesPerPath = qla_fo_params.MaxRetriesPerPath;
-+ pp->MaxRetriesPerIo = qla_fo_params.MaxRetriesPerIo;
-+ pp->Flags = qla_fo_params.Flags;
-+ pp->FailoverNotifyType = qla_fo_params.FailoverNotifyType;
-+ pp->FailoverNotifyCdbLength = qla_fo_params.FailoverNotifyCdbLength;
-+ memset(pp->FailoverNotifyCdb, 0, sizeof(pp->FailoverNotifyCdb));
-+ memcpy(pp->FailoverNotifyCdb,
-+ &qla_fo_params.FailoverNotifyCdb[0], sizeof(pp->FailoverNotifyCdb));
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__);)
-+
-+ return EXT_STATUS_OK;
-+}
-+
-+/*
-+ * qla4xxx_fo_set_params
-+ * Process an ioctl request to set system wide failover parameters.
-+ *
-+ * Input:
-+ * pp = Pointer to FO_PARAMS structure.
-+ *
-+ * Returns:
-+ * EXT_STATUS code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla4xxx_fo_set_params(PFO_PARAMS pp)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__);)
-+
-+ /* Check values for defined MIN and MAX */
-+ if ((pp->MaxPathsPerDevice > SDM_DEF_MAX_PATHS_PER_DEVICE) ||
-+ (pp->MaxRetriesPerPath < FO_MAX_RETRIES_PER_PATH_MIN) ||
-+ (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_PATH_MAX) ||
-+ (pp->MaxRetriesPerIo < FO_MAX_RETRIES_PER_IO_MIN) ||
-+ (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_IO_MAX)) {
-+ DEBUG2(printk("%s: got invalid params.\n", __func__);)
-+ return EXT_STATUS_INVALID_PARAM;
-+ }
-+
-+ /* Update the global structure. */
-+ qla_fo_params.MaxPathsPerDevice = pp->MaxPathsPerDevice;
-+ qla_fo_params.MaxRetriesPerPath = pp->MaxRetriesPerPath;
-+ qla_fo_params.MaxRetriesPerIo = pp->MaxRetriesPerIo;
-+ qla_fo_params.Flags = pp->Flags;
-+ qla_fo_params.FailoverNotifyType = pp->FailoverNotifyType;
-+ qla_fo_params.FailoverNotifyCdbLength = pp->FailoverNotifyCdbLength;
-+ if (pp->FailoverNotifyType & FO_NOTIFY_TYPE_CDB) {
-+ if (pp->FailoverNotifyCdbLength >
-+ sizeof(qla_fo_params.FailoverNotifyCdb)) {
-+ DEBUG2(printk("%s: got invalid cdb length.\n",
-+ __func__);)
-+ return EXT_STATUS_INVALID_PARAM;
-+ }
-+
-+ memcpy(qla_fo_params.FailoverNotifyCdb,
-+ pp->FailoverNotifyCdb,
-+ sizeof(qla_fo_params.FailoverNotifyCdb));
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__);)
-+
-+ return EXT_STATUS_OK;
-+}
-+#endif
-+
-+
-+/*
-+ * qla4xxx_fo_init_params
-+ * Gets driver configuration file failover properties to initalize
-+ * the global failover parameters structure.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_fo_init_params(scsi_qla_host_t *ha)
-+{
-+ DEBUG3(printk("%s: entered.\n", __func__);)
-+
-+ /* For parameters that are not completely implemented yet, */
-+
-+ memset(&qla_fo_params, 0, sizeof(qla_fo_params));
-+
-+ if(MaxPathsPerDevice) {
-+ qla_fo_params.MaxPathsPerDevice = MaxPathsPerDevice;
-+ } else
-+ qla_fo_params.MaxPathsPerDevice =FO_MAX_PATHS_PER_DEVICE_DEF ;
-+ if(MaxRetriesPerPath) {
-+ qla_fo_params.MaxRetriesPerPath = MaxRetriesPerPath;
-+ } else
-+ qla_fo_params.MaxRetriesPerPath =FO_MAX_RETRIES_PER_PATH_DEF;
-+ if(MaxRetriesPerIo) {
-+ qla_fo_params.MaxRetriesPerIo =MaxRetriesPerIo;
-+ } else
-+ qla_fo_params.MaxRetriesPerIo =FO_MAX_RETRIES_PER_IO_DEF;
-+
-+ qla_fo_params.Flags = 0;
-+ qla_fo_params.FailoverNotifyType = FO_NOTIFY_TYPE_NONE;
-+
-+ /* Set it to whatever user specified on the cmdline */
-+ if (qlFailoverNotifyType != FO_NOTIFY_TYPE_NONE)
-+ qla_fo_params.FailoverNotifyType = qlFailoverNotifyType;
-+
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__);)
-+}
-+
-+
-+/*
-+ * qla2100_fo_enabled
-+ * Reads and validates the failover enabled property.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * instance = HBA number.
-+ *
-+ * Returns:
-+ * 1 when failover is authorized else 0
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint8_t
-+qla4xxx_fo_enabled(scsi_qla_host_t *ha, int instance)
-+{
-+ return qla4xxx_failover_enabled(ha);
-+}
-+
-+/*
-+ * qla4xxx_send_fo_notification
-+ * Sends failover notification if needed. Change the fc_lun pointer
-+ * in the old path lun queue.
-+ *
-+ * Input:
-+ * old_lp = Pointer to old fc_lun.
-+ * new_lp = Pointer to new fc_lun.
-+ *
-+ * Returns:
-+ * Local function status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint32_t
-+qla4xxx_send_fo_notification(fc_lun_t *old_lp, fc_lun_t *new_lp)
-+{
-+ int rval = QLA_SUCCESS;
-+#if 0
-+ scsi_qla_host_t *old_ha = old_lp->fcport->ha;
-+ inq_cmd_rsp_t *pkt;
-+ uint16_t loop_id, lun;
-+ dma_addr_t phys_address;
-+#endif
-+
-+
-+ ENTER("qla4xxx_send_fo_notification");
-+ DEBUG3(printk("%s: entered.\n", __func__);)
-+
-+#if 0
-+ if( new_lp->fcport == NULL ){
-+ DEBUG2(printk("qla4xxx_send_fo_notification: No "
-+ "new fcport for lun pointer\n");)
-+ return QLA_ERROR;
-+ }
-+ loop_id = new_lp->fcport->loop_id;
-+ lun = new_lp->lun;
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_LUN_RESET) {
-+ rval = qla4xxx_lun_reset(old_ha, loop_id, lun);
-+ if (rval == QLA_SUCCESS) {
-+ DEBUG4(printk("qla4xxx_send_fo_notification: LUN "
-+ "reset succeded\n");)
-+ } else {
-+ DEBUG4(printk("qla4xxx_send_fo_notification: LUN "
-+ "reset failed\n");)
-+ }
-+
-+ }
-+ if ( (qla_fo_params.FailoverNotifyType ==
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET) ||
-+ (qla_fo_params.FailoverNotifyType ==
-+ FO_NOTIFY_TYPE_LOGOUT_OR_CDB) ) {
-+
-+ rval = qla4xxx_fabric_logout(old_ha, loop_id);
-+ if (rval == QLA_SUCCESS) {
-+ DEBUG4(printk("qla4xxx_send_fo_failover_notify: "
-+ "logout succeded\n");)
-+ } else {
-+ DEBUG4(printk("qla4xxx_send_fo_failover_notify: "
-+ "logout failed\n");)
-+ }
-+
-+ }
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_SPINUP ||
-+ new_lp->fcport->notify_type == FO_NOTIFY_TYPE_SPINUP ) {
-+ rval = qla4xxx_spinup(new_lp->fcport->ha, new_lp->fcport,
-+ new_lp->lun);
-+ }
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_CDB) {
-+ }
-+#endif
-+
-+ DEBUG3(printk("%s: exiting. rval = %d.\n", __func__, rval);)
-+
-+ return rval;
-+}
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_fo.h ./drivers/scsi/qla4xxx/ql4_fo.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_fo.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_fo.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,46 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2003-2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * QLogic ISP4xxx Failover Header
-+ *
-+ */
-+#ifndef _QLA_FO_H
-+#define _QLA_FO_H
-+
-+/*
-+ * This structure definition is for a scsi I/O request NOT subject to
-+ * failover re-routing. It is for the use of configuration operations
-+ * and diagnostics functions as definted in ExIoct.h
-+ */
-+ typedef struct scsi_cdb_request {
-+ struct adapter_state *ha;
-+ uint16_t target;
-+ uint16_t lun;
-+ uint8_t *cdb_ptr; /* Pointer to cdb to be sent */
-+ uint8_t cdb_len; /* cdb length */
-+ uint8_t direction; /* Direction of I/O for buffer */
-+ uint8_t scb_len; /* Scsi completion block length */
-+ uint8_t *scb_ptr; /* Scsi completion block pointer */
-+ uint8_t *buf_ptr; /* Pointer to I/O buffer */
-+ uint16_t buf_len; /* Buffer size */
-+ }
-+ SCSI_REQ_t, *SCSI_REQ_p;
-+
-+#endif /* ifndef _QLA_FO_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_foio.c ./drivers/scsi/qla4xxx/ql4_foio.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_foio.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_foio.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,1125 @@
-+/********************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic ISP4xxx device driver for Linux 2.6.x
-+* Copyright (C) 2003-2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+*
-+******************************************************************************/
-+
-+/****************************************
-+ * Issues requests for failover module
-+ ****************************************/
-+
-+// #include "qla_os.h"
-+#include "ql4_def.h"
-+
-+// #include "qlfo.h"
-+/*
-+#include "qlfolimits.h"
-+#include "ql4_foln.h"
-+*/
-+
-+/*
-+ * Function Prototypes.
-+ */
-+
-+int qla4xxx_issue_scsi_inquiry(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, fc_lun_t *fclun );
-+int qla4xxx_test_active_lun(fc_port_t *fcport, fc_lun_t *fclun);
-+int qla4xxx_get_wwuln_from_device(mp_host_t *host, fc_lun_t *fclun,
-+ char *evpd_buf, int wwlun_size);
-+fc_lun_t * qla4xxx_cfg_lun(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun,
-+ inq_cmd_rsp_t *inq, dma_addr_t inq_dma);
-+void
-+qla4xxx_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport);
-+static int
-+qla4xxx_inquiry(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, uint16_t lun, inq_cmd_rsp_t *inq, dma_addr_t inq_dma);
-+int qla4xxx_rpt_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ inq_cmd_rsp_t *inq, dma_addr_t inq_dma);
-+static int qla4xxx_report_lun(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ rpt_lun_cmd_rsp_t *rlc, dma_addr_t rlc_dma);
-+
-+int
-+qla4xxx_spinup(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun);
-+
-+/*
-+ * qla4xxx_get_wwuln_from_device
-+ * Issue SCSI inquiry page code 0x83 command for LUN WWLUN_NAME.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * fcport = FC port structure pointer.
-+ *
-+ * Return:
-+ * 0 - Failed to get the lun_wwlun_name
-+ * Otherwise : wwlun_size
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+
-+int
-+qla4xxx_get_wwuln_from_device(mp_host_t *host, fc_lun_t *fclun,
-+ char *evpd_buf, int wwlun_size)
-+{
-+
-+ evpd_inq_cmd_rsp_t *pkt;
-+ int rval, rval1;
-+ dma_addr_t phys_address = 0;
-+ int retries;
-+ uint8_t comp_status;
-+ uint8_t scsi_status;
-+ uint8_t iscsi_flags;
-+ scsi_qla_host_t *ha;
-+ ddb_entry_t *ddb_entry = fclun->fcport->ddbptr;
-+
-+ ENTER(__func__);
-+ //printk("%s entered\n",__func__);
-+
-+ rval = 0; /* failure */
-+
-+ if (atomic_read(&fclun->fcport->state) == FCS_DEVICE_DEAD){
-+ DEBUG(printk("%s leaving: Port is marked DEAD\n",__func__);)
-+ return rval;
-+ }
-+
-+ memset(evpd_buf, 0 ,wwlun_size);
-+ ha = host->ha;
-+ pkt = pci_alloc_consistent(ha->pdev,
-+ sizeof(evpd_inq_cmd_rsp_t), &phys_address);
-+
-+ if (pkt == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%d): Memory Allocation failed - INQ\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ for (retries = 3; retries; retries--) {
-+ memset(pkt, 0, sizeof(evpd_inq_cmd_rsp_t));
-+ pkt->p.cmd.hdr.entryType = ET_COMMAND;
-+ pkt->p.cmd.hdr.entryCount = 1;
-+
-+ pkt->p.cmd.lun[1] = LSB(cpu_to_le16(fclun->lun)); /*SAMII compliant lun*/
-+ pkt->p.cmd.lun[2] = MSB(cpu_to_le16(fclun->lun));
-+ pkt->p.cmd.target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ pkt->p.cmd.control_flags =(CF_READ | CF_SIMPLE_TAG);
-+ pkt->p.cmd.cdb[0] = INQUIRY;
-+ pkt->p.cmd.cdb[1] = INQ_EVPD_SET;
-+ pkt->p.cmd.cdb[2] = INQ_DEV_IDEN_PAGE;
-+ pkt->p.cmd.cdb[4] = VITAL_PRODUCT_DATA_SIZE;
-+ pkt->p.cmd.dataSegCnt = __constant_cpu_to_le16(1);
-+ pkt->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ pkt->p.cmd.ttlByteCnt =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ pkt->p.cmd.dataseg[0].base.addrLow = cpu_to_le32(
-+ LSDW(phys_address + sizeof(STATUS_ENTRY)));
-+ pkt->p.cmd.dataseg[0].base.addrHigh = cpu_to_le32(
-+ MSDW(phys_address + sizeof(STATUS_ENTRY)));
-+ pkt->p.cmd.dataseg[0].count =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ /* If in connection mode, bump sequence number */
-+ if ((ha->firmware_options & FWOPT_SESSION_MODE) != 0) {
-+ ddb_entry->CmdSn++;
-+ }
-+ pkt->p.cmd.cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+
-+ rval1 = qla4xxx_issue_iocb(ha, pkt,
-+ phys_address, sizeof(evpd_inq_cmd_rsp_t));
-+
-+ comp_status = pkt->p.rsp.completionStatus;
-+ scsi_status = pkt->p.rsp.scsiStatus;
-+ iscsi_flags = pkt->p.rsp.iscsiFlags;
-+
-+ DEBUG2(printk("%s: lun (%d) inquiry page 0x83- "
-+ " comp status 0x%x, "
-+ "scsi status 0x%x, iscsi flags=0x%x, rval=%d\n"
-+ ,__func__,
-+ fclun->lun, comp_status, scsi_status, iscsi_flags,
-+ rval1);)
-+ DEBUG2(printk("pkt resp len %d, bidi len %d \n",
-+ pkt->p.rsp.residualByteCnt,
-+ pkt->p.rsp.bidiResidualByteCnt);)
-+
-+
-+ if (rval1 != QLA_SUCCESS || comp_status != SCS_COMPLETE ||
-+ scsi_status & SCSISTAT_CHECK_CONDITION) {
-+
-+ if (scsi_status & SCSISTAT_CHECK_CONDITION) {
-+ DEBUG2(printk("scsi(%d): INQ "
-+ "SCSISTAT_CHECK_CONDITION Sense Data "
-+ "%02x %02x %02x %02x %02x %02x %02x %02x\n",
-+ ha->host_no,
-+ pkt->p.rsp.senseData[0],
-+ pkt->p.rsp.senseData[1],
-+ pkt->p.rsp.senseData[2],
-+ pkt->p.rsp.senseData[3],
-+ pkt->p.rsp.senseData[4],
-+ pkt->p.rsp.senseData[5],
-+ pkt->p.rsp.senseData[6],
-+ pkt->p.rsp.senseData[7]));
-+ }
-+
-+ /* Device underrun, treat as OK. */
-+ if (rval1 == QLA_SUCCESS &&
-+ comp_status == SCS_DATA_UNDERRUN &&
-+ iscsi_flags & ISCSI_FLAG_RESIDUAL_UNDER) {
-+
-+ /* rval1 = QLA_SUCCESS; */
-+ break;
-+ }
-+ } else {
-+ rval1 = QLA_SUCCESS;
-+ break;
-+ }
-+ }
-+
-+ if (rval1 == QLA_SUCCESS &&
-+ pkt->inq[1] == INQ_DEV_IDEN_PAGE ) {
-+
-+ if( pkt->inq[7] <= WWLUN_SIZE ){
-+ memcpy(evpd_buf,&pkt->inq[8], pkt->inq[7]);
-+ rval = pkt->inq[7] ; /* lun wwlun_size */
-+ DEBUG2(printk("%s : Lun(%d) WWLUN size %d\n",__func__,
-+ fclun->lun,pkt->inq[7]);)
-+ } else {
-+ memcpy(evpd_buf,&pkt->inq[8], WWLUN_SIZE);
-+ rval = WWLUN_SIZE;
-+ printk(KERN_INFO "%s : Lun(%d) WWLUN may "
-+ "not be complete, Buffer too small"
-+ " need: %d provided: %d\n",__func__,
-+ fclun->lun,pkt->inq[7],WWLUN_SIZE);
-+ }
-+ DEBUG2(qla4xxx_dump_buffer(evpd_buf, rval);)
-+ } else {
-+ if (scsi_status & SCSISTAT_CHECK_CONDITION) {
-+ /*
-+ * ILLEGAL REQUEST - 0x05
-+ * INVALID FIELD IN CDB - 24 : 00
-+ */
-+ if(pkt->p.rsp.senseData[2] == 0x05 &&
-+ pkt->p.rsp.senseData[12] == 0x24 &&
-+ pkt->p.rsp.senseData[13] == 0x00 ) {
-+
-+ DEBUG2(printk(KERN_INFO "%s Lun(%d) does not"
-+ " support Inquiry Page Code-0x83\n",
-+ __func__,fclun->lun);)
-+ } else {
-+ DEBUG2(printk(KERN_INFO "%s Lun(%d) does not"
-+ " support Inquiry Page Code-0x83\n",
-+ __func__,fclun->lun);)
-+ DEBUG2(printk( KERN_INFO "Unhandled check "
-+ "condition sense_data[2]=0x%x"
-+ " sense_data[12]=0x%x "
-+ "sense_data[13]=0x%x\n",
-+ pkt->p.rsp.senseData[2],
-+ pkt->p.rsp.senseData[12],
-+ pkt->p.rsp.senseData[13]);)
-+
-+ }
-+
-+ } else {
-+ /* Unable to issue Inquiry Page 0x83 */
-+ DEBUG2(printk(KERN_INFO
-+ "%s Failed to issue Inquiry Page 0x83 -- lun (%d) "
-+ "cs=0x%x ss=0x%x, rval=%d\n",
-+ __func__, fclun->lun, comp_status, scsi_status,
-+ rval);)
-+ }
-+ rval = 0 ;
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(evpd_inq_cmd_rsp_t),
-+ pkt, phys_address);
-+
-+ //printk("%s exit\n",__func__);
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla4xxx_inquiry
-+ * Issue SCSI inquiry command.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * fcport = FC port structure pointer.
-+ *
-+ * Return:
-+ * 0 - Success
-+ * BIT_0 - error
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla4xxx_inquiry(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ uint16_t lun, inq_cmd_rsp_t *inq, dma_addr_t inq_dma)
-+{
-+ int rval, rval1;
-+ uint16_t retries;
-+ uint8_t comp_status;
-+ uint8_t scsi_status;
-+ uint8_t iscsi_flags;
-+ ddb_entry_t *ddb_entry = fcport->ddbptr;
-+
-+ rval = QLA_ERROR;
-+
-+ for (retries = 3; retries; retries--) {
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd.hdr.entryType = ET_COMMAND;
-+
-+ /* rlc->p.cmd.handle = 1; */
-+ /* 8 byte lun number */
-+ inq->p.cmd.lun[1] = LSB(cpu_to_le16(lun)); /*SAMII compliant lun*/
-+ inq->p.cmd.lun[2] = MSB(cpu_to_le16(lun));
-+ inq->p.cmd.hdr.entryCount = 1;
-+ inq->p.cmd.target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ inq->p.cmd.control_flags =(CF_READ | CF_SIMPLE_TAG);
-+ inq->p.cmd.cdb[0] = INQUIRY;
-+ inq->p.cmd.cdb[4] = INQ_DATA_SIZE;
-+ inq->p.cmd.dataSegCnt = __constant_cpu_to_le16(1);
-+ inq->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ inq->p.cmd.ttlByteCnt =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ inq->p.cmd.dataseg[0].base.addrLow = cpu_to_le32(
-+ LSDW(inq_dma + sizeof(STATUS_ENTRY)));
-+ inq->p.cmd.dataseg[0].base.addrHigh = cpu_to_le32(
-+ MSDW(inq_dma + sizeof(STATUS_ENTRY)));
-+ inq->p.cmd.dataseg[0].count =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ /* rlc->p.cmd.lun[8]; always lun 0 */
-+ /* If in connection mode, bump sequence number */
-+ if ((ha->firmware_options & FWOPT_SESSION_MODE) != 0) {
-+ ddb_entry->CmdSn++;
-+ }
-+ inq->p.cmd.cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+
-+ DEBUG2(printk("scsi(%d): Lun Inquiry - fcport=[%04x/%p],"
-+ " lun (%d)\n",
-+ ha->host_no, fcport->loop_id, fcport, lun));
-+
-+ rval1 = qla4xxx_issue_iocb(ha, inq, inq_dma,
-+ sizeof(inq_cmd_rsp_t));
-+
-+ comp_status = inq->p.rsp.completionStatus;
-+ scsi_status = inq->p.rsp.scsiStatus;
-+ iscsi_flags = inq->p.rsp.iscsiFlags;
-+
-+ DEBUG2(printk("scsi(%d): lun (%d) inquiry - "
-+ "inq[0]= 0x%x, comp status 0x%x, scsi status 0x%x, "
-+ "rval=%d\n",
-+ ha->host_no, lun, inq->inq[0], comp_status, scsi_status,
-+ rval1));
-+
-+ if (rval1 != QLA_SUCCESS || comp_status != SCS_COMPLETE ||
-+ scsi_status & SCSISTAT_CHECK_CONDITION) {
-+
-+ DEBUG2(printk("scsi(%d): INQ failed to issue iocb! "
-+ "fcport=[%04x/%p] rval=%x cs=%x ss=%x\n",
-+ ha->host_no, fcport->loop_id, fcport, rval1,
-+ comp_status, scsi_status));
-+
-+
-+ if (scsi_status & SCSISTAT_CHECK_CONDITION) {
-+ DEBUG2(printk("scsi(%d): INQ "
-+ "SCSISTAT_CHECK_CONDITION Sense Data "
-+ "%02x %02x %02x %02x %02x %02x %02x %02x\n",
-+ ha->host_no,
-+ inq->p.rsp.senseData[0],
-+ inq->p.rsp.senseData[1],
-+ inq->p.rsp.senseData[2],
-+ inq->p.rsp.senseData[3],
-+ inq->p.rsp.senseData[4],
-+ inq->p.rsp.senseData[5],
-+ inq->p.rsp.senseData[6],
-+ inq->p.rsp.senseData[7]));
-+ }
-+
-+ /* Device underrun, treat as OK. */
-+ if (rval1 == QLA_SUCCESS &&
-+ comp_status == SCS_DATA_UNDERRUN &&
-+ iscsi_flags & ISCSI_FLAG_RESIDUAL_UNDER) {
-+
-+ rval = QLA_SUCCESS;
-+ break;
-+ }
-+ } else {
-+ rval = QLA_SUCCESS;
-+ break;
-+ }
-+ }
-+
-+ return (rval);
-+}
-+
-+int
-+qla4xxx_issue_scsi_inquiry(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, fc_lun_t *fclun )
-+{
-+ inq_cmd_rsp_t *pkt;
-+ dma_addr_t phys_address = 0;
-+ int ret = 0;
-+
-+ pkt = pci_alloc_consistent(ha->pdev,
-+ sizeof(inq_cmd_rsp_t), &phys_address);
-+
-+ if (pkt == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%d): Memory Allocation failed - INQ\n", ha->host_no);
-+ ha->mem_err++;
-+ return BIT_0;
-+ }
-+
-+ if ( qla4xxx_inquiry(ha, fcport,
-+ fclun->lun, pkt, phys_address) != QLA_SUCCESS) {
-+
-+ DEBUG2(printk("%s: Failed lun inquiry - "
-+ "inq[0]= 0x%x, "
-+ "\n",
-+ __func__,pkt->inq[0]);)
-+ ret = 1;
-+ } else {
-+ fclun->device_type = pkt->inq[0];
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(inq_cmd_rsp_t), pkt, phys_address);
-+
-+ return (ret);
-+}
-+
-+int
-+qla4xxx_test_active_lun(fc_port_t *fcport, fc_lun_t *fclun)
-+{
-+ tur_cmd_rsp_t *pkt;
-+ int rval = 0 ;
-+ dma_addr_t phys_address = 0;
-+ int retry;
-+ uint8_t comp_status;
-+ uint8_t scsi_status;
-+ uint8_t iscsi_flags;
-+ ddb_entry_t *ddb_entry = fcport->ddbptr;
-+ scsi_qla_host_t *ha;
-+ uint16_t lun = 0;
-+
-+ ENTER(__func__);
-+
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD){
-+ DEBUG2(printk("scsi(%d) %s leaving: Port loop_id 0x%02x is marked DEAD\n",
-+ ha->host_no,__func__,fcport->loop_id);)
-+ return rval;
-+ }
-+
-+ if ( fclun == NULL ){
-+ DEBUG2(printk("scsi(%d) %s Bad fclun ptr on entry.\n",
-+ ha->host_no,__func__);)
-+ return rval;
-+ }
-+
-+ lun = fclun->lun;
-+
-+ pkt = pci_alloc_consistent(ha->pdev,
-+ sizeof(tur_cmd_rsp_t), &phys_address);
-+
-+ if (pkt == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%d): Memory Allocation failed - TUR\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ retry = 4;
-+ do {
-+ memset(pkt, 0, sizeof(tur_cmd_rsp_t));
-+ pkt->p.cmd.hdr.entryType = ET_COMMAND;
-+ /* 8 byte lun number */
-+ pkt->p.cmd.lun[1] = LSB(cpu_to_le16(lun)); /*SAMII compliant lun*/
-+ pkt->p.cmd.lun[2] = MSB(cpu_to_le16(lun));
-+
-+ /* rlc->p.cmd.handle = 1; */
-+ pkt->p.cmd.hdr.entryCount = 1;
-+ pkt->p.cmd.target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ pkt->p.cmd.control_flags = (CF_NO_DATA | CF_SIMPLE_TAG);
-+ pkt->p.cmd.cdb[0] = TEST_UNIT_READY;
-+ pkt->p.cmd.dataSegCnt = __constant_cpu_to_le16(0);
-+ pkt->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ pkt->p.cmd.ttlByteCnt = __constant_cpu_to_le32(0);
-+ /* If in connection mode, bump sequence number */
-+ if ((ha->firmware_options & FWOPT_SESSION_MODE) != 0)
-+ ddb_entry->CmdSn++;
-+ pkt->p.cmd.cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+
-+ rval = qla4xxx_issue_iocb(ha, pkt, phys_address,
-+ sizeof(tur_cmd_rsp_t));
-+
-+ comp_status = pkt->p.rsp.completionStatus;
-+ scsi_status = pkt->p.rsp.scsiStatus;
-+ iscsi_flags = pkt->p.rsp.iscsiFlags;
-+
-+#if 0
-+
-+ if (rval != QLA_SUCCESS || comp_status != SCS_COMPLETE ||
-+ (scsi_status & SCSISTAT_CHECK_CONDITION) ) {
-+ /* Device underrun, treat as OK. */
-+ if (rval == QLA_SUCCESS &&
-+ comp_status == SCS_DATA_UNDERRUN &&
-+ iscsi_flags & ISCSI_FLAG_RESIDUAL_UNDER) {
-+ rval = QLA_SUCCESS;
-+ break;
-+ }
-+ }
-+#endif
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == SCS_DEVICE_LOGGED_OUT ||
-+ comp_status == SCS_INCOMPLETE ||
-+ comp_status == SCS_DEVICE_UNAVAILABLE ||
-+ comp_status == SCS_DEVICE_CONFIG_CHANGED )
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: TEST UNIT READY - comp "
-+ "status 0x%x, scsi status 0x%x, rval=%d\n", ha->host_no,
-+ fcport->loop_id, lun,__func__, comp_status, scsi_status,
-+ rval));
-+
-+ if ((scsi_status & SCSISTAT_CHECK_CONDITION)) {
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__,
-+ pkt->p.rsp.senseData[2],
-+ pkt->p.rsp.senseData[12],
-+ pkt->p.rsp.senseData[13]));
-+
-+ if (pkt->p.rsp.senseData[2] == NOT_READY &&
-+ pkt->p.rsp.senseData[12] == 0x4 &&
-+ pkt->p.rsp.senseData[13] == 0x2)
-+ break;
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != SCS_COMPLETE ||
-+ (scsi_status & SCSISTAT_CHECK_CONDITION)) && retry--);
-+
-+ if (rval == QLA_SUCCESS &&
-+ (!((scsi_status & SCSISTAT_CHECK_CONDITION) &&
-+ (pkt->p.rsp.senseData[2] == NOT_READY &&
-+ pkt->p.rsp.senseData[12] == 0x4 &&
-+ pkt->p.rsp.senseData[13] == 0x2)) &&
-+ comp_status == SCS_COMPLETE)) {
-+
-+ DEBUG2(printk("scsi(%d) %s - Lun (0x%02x:%d) set to ACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id, lun));
-+
-+ /* We found an active path */
-+ fclun->flags |= FLF_ACTIVE_LUN;
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk("scsi(%d) %s - Lun (0x%02x:%d) set to "
-+ "INACTIVE.\n", ha->host_no, __func__,
-+ fcport->loop_id, lun));
-+ /* fcport->flags &= ~(FCF_MSA_PORT_ACTIVE); */
-+ fclun->flags &= ~(FLF_ACTIVE_LUN);
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(tur_cmd_rsp_t), pkt, phys_address);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+#if MSA1000_SUPPORTED
-+static fc_lun_t *
-+qla4xxx_find_data_lun(fc_port_t *fcport)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_lun_t *fclun, *ret_fclun;
-+
-+ ha = fcport->ha;
-+ ret_fclun = NULL;
-+
-+ /* Go thur all luns and find a good data lun */
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ fclun->flags &= ~FLF_VISIBLE_LUN;
-+ if (fclun->device_type == 0xff)
-+ qla4xxx_issue_scsi_inquiry(ha, fcport, fclun);
-+ if (fclun->device_type == 0xc)
-+ fclun->flags |= FLF_VISIBLE_LUN;
-+ else if (fclun->device_type == TYPE_DISK) {
-+ ret_fclun = fclun;
-+ }
-+ }
-+ return (ret_fclun);
-+}
-+
-+/*
-+ * qla4xxx_test_active_port
-+ * Determines if the port is in active or standby mode. First, we
-+ * need to locate a storage lun then do a TUR on it.
-+ *
-+ * Input:
-+ * fcport = port structure pointer.
-+ *
-+ *
-+ * Return:
-+ * 0 - Standby or error
-+ * 1 - Active
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_test_active_port(fc_port_t *fcport)
-+{
-+ tur_cmd_rsp_t *pkt;
-+ int rval = 0 ;
-+ dma_addr_t phys_address = 0;
-+ int retry;
-+ uint16_t comp_status;
-+ uint16_t scsi_status;
-+ scsi_qla_host_t *ha;
-+ uint16_t lun = 0;
-+ fc_lun_t *fclun;
-+
-+ ENTER(__func__);
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fcport->loop_id);)
-+ return rval;
-+ }
-+
-+ if ((fclun = qla4xxx_find_data_lun(fcport)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s leaving: Couldn't find data lun\n",
-+ __func__);)
-+ return rval;
-+ }
-+ lun = fclun->lun;
-+
-+ pkt = pci_alloc_consistent(ha->pdev, sizeof(tur_cmd_rsp_t),
-+ &phys_address);
-+
-+ if (pkt == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TUR\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ retry = 4;
-+ do {
-+ memset(pkt, 0, sizeof(tur_cmd_rsp_t));
-+ //pkt->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ //pkt->p.cmd.entry_count = 1;
-+ //pkt->p.cmd.lun = cpu_to_le16(lun);
-+ // SET_TARGET_ID(ha, pkt->p.cmd.target, fcport->loop_id);
-+ pkt->p.cmd.hdr.entryType = ET_COMMAND;
-+ /* 8 byte lun number */
-+ pkt->p.cmd.lun[1] = LSB(cpu_to_le16(lun)); /*SAMII compliant lun*/
-+ pkt->p.cmd.lun[2] = MSB(cpu_to_le16(lun));
-+ pkt->p.cmd.target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+
-+ pkt->p.cmd.control_flags = CF_SIMPLE_TAG;
-+ pkt->p.cmd.scsi_cdb[0] = TEST_UNIT_READY;
-+
-+ pkt->p.cmd.dataSegCnt = __constant_cpu_to_le16(0);
-+ pkt->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ pkt->p.cmd.ttlByteCnt = __constant_cpu_to_le32(0);
-+
-+ rval = qla4xxx_issue_iocb(ha, pkt, phys_address,
-+ sizeof(tur_cmd_rsp_t));
-+
-+ comp_status = le16_to_cpu(pkt->p.rsp.comp_status);
-+ scsi_status = le16_to_cpu(pkt->p.rsp.scsi_status);
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: TEST UNIT READY - comp "
-+ "status 0x%x, scsi status 0x%x, rval=%d\n", ha->host_no,
-+ fcport->loop_id, lun,__func__, comp_status, scsi_status,
-+ rval));
-+ if ((scsi_status & SS_CHECK_CONDITION)) {
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__,
-+ pkt->p.rsp.req_sense_data[2],
-+ pkt->p.rsp.req_sense_data[12],
-+ pkt->p.rsp.req_sense_data[13]));
-+
-+ if (pkt->p.rsp.req_sense_data[2] == NOT_READY &&
-+ pkt->p.rsp.req_sense_data[12] == 0x4 &&
-+ pkt->p.rsp.req_sense_data[13] == 0x2)
-+ break;
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && retry--);
-+
-+ if (rval == QLA_SUCCESS &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (pkt->p.rsp.req_sense_data[2] == NOT_READY &&
-+ pkt->p.rsp.req_sense_data[12] == 0x4 &&
-+ pkt->p.rsp.req_sense_data[13] == 0x2 ) ) &&
-+ comp_status == CS_COMPLETE)) {
-+ DEBUG2(printk("scsi(%ld) %s - Port (0x%04x) set to ACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id));
-+ /* We found an active path */
-+ fcport->flags |= FCF_MSA_PORT_ACTIVE;
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk("scsi(%ld) %s - Port (0x%04x) set to INACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id));
-+ fcport->flags &= ~(FCF_MSA_PORT_ACTIVE);
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(tur_cmd_rsp_t), pkt, phys_address);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+#endif
-+/*
-+ * qla4xxx_cfg_lun
-+ * Configures LUN into fcport LUN list.
-+ *
-+ * Input:
-+ * fcport: FC port structure pointer.
-+ * lun: LUN number.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+fc_lun_t *
-+qla4xxx_cfg_lun(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun,
-+ inq_cmd_rsp_t *inq, dma_addr_t inq_dma)
-+{
-+ fc_lun_t *fclun;
-+ uint8_t device_type;
-+
-+
-+ /* Bypass LUNs that failed. */
-+ if (qla4xxx_failover_enabled(ha)) {
-+ if (qla4xxx_inquiry(ha, fcport, lun, inq, inq_dma) != QLA_SUCCESS) {
-+ DEBUG2(printk("scsi(%d): Failed inquiry - loop id=0x%04x "
-+ "lun=%d\n", ha->host_no, fcport->loop_id, lun));
-+
-+ return (NULL);
-+ }
-+ }
-+
-+ device_type = inq->inq[0] & 0x1f;
-+ switch (device_type) {
-+ case TYPE_DISK:
-+ break;
-+ case TYPE_PROCESSOR:
-+ case TYPE_WORM:
-+ case TYPE_ROM:
-+ case TYPE_SCANNER:
-+ case TYPE_MOD:
-+ case TYPE_MEDIUM_CHANGER:
-+ case TYPE_ENCLOSURE:
-+ case 0x20:
-+ case 0x0C:
-+ fcport->flags |= FCF_NONFO_DEVICE;
-+ break;
-+ case TYPE_TAPE:
-+ fcport->flags |= FCF_TAPE_PRESENT;
-+ break;
-+ default:
-+ DEBUG2(printk("scsi(%d): Unsupported lun type -- "
-+ "loop id=0x%04x lun=%d type=%x\n",
-+ ha->host_no, fcport->loop_id, lun, inq->inq[0]));
-+ return (NULL);
-+ }
-+
-+ fcport->device_type = device_type;
-+
-+ /* Does this port require special failover handling? */
-+ if (qla4xxx_failover_enabled(ha)) {
-+ fcport->cfg_id = qla4xxx_cfg_lookup_device(&inq->inq[0]);
-+ qla4xxx_set_device_flags(ha, fcport);
-+ }
-+ fclun = qla4xxx_add_fclun(fcport, lun);
-+
-+ if (fclun != NULL) {
-+ atomic_set(&fcport->state, FCS_ONLINE);
-+ }
-+
-+ return (fclun);
-+}
-+
-+/*
-+ * qla4xxx_lun_discovery
-+ * Issue SCSI inquiry command for LUN discovery.
-+ *
-+ * Input:
-+ * ha: adapter state pointer.
-+ * fcport: FC port structure pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t lun;
-+
-+ inq = pci_alloc_consistent(ha->pdev, sizeof(inq_cmd_rsp_t), &inq_dma);
-+ if (inq == NULL) {
-+ printk(KERN_WARNING
-+ "Memory Allocation failed - INQ\n");
-+ return;
-+ }
-+
-+ /* If report LUN works, exit. */
-+ if (qla4xxx_rpt_lun_discovery(ha, fcport, inq, inq_dma) !=
-+ QLA_SUCCESS) {
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ /* Configure LUN. */
-+ qla4xxx_cfg_lun(ha, fcport, lun, inq, inq_dma);
-+ }
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(inq_cmd_rsp_t), inq, inq_dma);
-+}
-+
-+/*
-+ * qla4xxx_rpt_lun_discovery
-+ * Issue SCSI report LUN command for LUN discovery.
-+ *
-+ * Input:
-+ * ha: adapter state pointer.
-+ * fcport: FC port structure pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_rpt_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ inq_cmd_rsp_t *inq, dma_addr_t inq_dma)
-+{
-+ int rval;
-+ uint32_t len, cnt;
-+ uint16_t lun;
-+ rpt_lun_cmd_rsp_t *rlc;
-+ dma_addr_t rlc_dma;
-+
-+ /* Assume a failed status */
-+ rval = QLA_ERROR;
-+
-+ /* No point in continuing if the device doesn't support RLC */
-+ if ((fcport->flags & FCF_RLC_SUPPORT) == 0)
-+ return (rval);
-+
-+ rlc = pci_alloc_consistent(ha->pdev, sizeof(rpt_lun_cmd_rsp_t),
-+ &rlc_dma);
-+ if (rlc == NULL) {
-+ printk(KERN_WARNING
-+ "Memory Allocation failed - RLC");
-+ return QLA_ERROR;
-+ }
-+ rval = qla4xxx_report_lun(ha, fcport, rlc, rlc_dma);
-+ if (rval != QLA_SUCCESS) {
-+ pci_free_consistent(ha->pdev, sizeof(rpt_lun_cmd_rsp_t), rlc,
-+ rlc_dma);
-+ return (rval);
-+ }
-+
-+ /* Always add a fc_lun_t structure for lun 0 -- mid-layer requirement */
-+ qla4xxx_add_fclun(fcport, 0);
-+
-+ /* Configure LUN list. */
-+ len = be32_to_cpu(rlc->list.hdr.len);
-+ len /= 8;
-+ for (cnt = 0; cnt < len; cnt++) {
-+ lun = CHAR_TO_SHORT(rlc->list.lst[cnt].lsb,
-+ rlc->list.lst[cnt].msb.b);
-+
-+ DEBUG2(printk("scsi(%d): RLC lun = (%d)\n", ha->host_no, lun));
-+
-+ /* We only support 0 through MAX_LUNS-1 range */
-+ if (lun < MAX_LUNS) {
-+ qla4xxx_cfg_lun(ha, fcport, lun, inq, inq_dma);
-+ }
-+ }
-+ atomic_set(&fcport->state, FCS_ONLINE);
-+
-+ pci_free_consistent(ha->pdev, sizeof(rpt_lun_cmd_rsp_t), rlc, rlc_dma);
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla4xxx_report_lun
-+ * Issue SCSI report LUN command.
-+ *
-+ * Input:
-+ * ha: adapter state pointer.
-+ * fcport: FC port structure pointer.
-+ * mem: pointer to dma memory object for report LUN IOCB
-+ * packet.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla4xxx_report_lun(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ rpt_lun_cmd_rsp_t *rlc, dma_addr_t rlc_dma)
-+{
-+ int rval;
-+ uint16_t retries;
-+ uint8_t comp_status;
-+ uint8_t scsi_status;
-+ uint8_t iscsi_flags;
-+ ddb_entry_t *ddb_entry = fcport->ddbptr;
-+
-+ rval = QLA_ERROR;
-+
-+ for (retries = 3; retries; retries--) {
-+ memset(rlc, 0, sizeof(rpt_lun_cmd_rsp_t));
-+ rlc->p.cmd.hdr.entryType = ET_COMMAND;
-+
-+ /* rlc->p.cmd.handle = 1; */
-+ rlc->p.cmd.hdr.entryCount = 1;
-+ rlc->p.cmd.target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ rlc->p.cmd.control_flags = (CF_READ | CF_SIMPLE_TAG);
-+ rlc->p.cmd.cdb[0] = REPORT_LUNS;
-+ rlc->p.cmd.cdb[8] = MSB(sizeof(rpt_lun_lst_t));
-+ rlc->p.cmd.cdb[9] = LSB(sizeof(rpt_lun_lst_t));
-+ rlc->p.cmd.dataSegCnt = __constant_cpu_to_le16(1);
-+ rlc->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ rlc->p.cmd.ttlByteCnt =
-+ __constant_cpu_to_le32(sizeof(rpt_lun_lst_t));
-+ rlc->p.cmd.dataseg[0].base.addrLow = cpu_to_le32(
-+ LSDW(rlc_dma + sizeof(STATUS_ENTRY)));
-+ rlc->p.cmd.dataseg[0].base.addrHigh = cpu_to_le32(
-+ MSDW(rlc_dma + sizeof(STATUS_ENTRY)));
-+ rlc->p.cmd.dataseg[0].count =
-+ __constant_cpu_to_le32(sizeof(rpt_lun_lst_t));
-+ /* rlc->p.cmd.lun[8]; always lun 0 */
-+ /* If in connection mode, bump sequence number */
-+ if ((ha->firmware_options & FWOPT_SESSION_MODE) != 0)
-+ ddb_entry->CmdSn++;
-+ rlc->p.cmd.cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+
-+ rval = qla4xxx_issue_iocb(ha, rlc, rlc_dma,
-+ sizeof(rpt_lun_cmd_rsp_t));
-+
-+ comp_status = rlc->p.rsp.completionStatus;
-+ scsi_status = rlc->p.rsp.scsiStatus;
-+ iscsi_flags = rlc->p.rsp.iscsiFlags;
-+
-+ if (rval != QLA_SUCCESS ||
-+ comp_status != SCS_COMPLETE ||
-+ scsi_status & SCSISTAT_CHECK_CONDITION) {
-+
-+ /* Device underrun, treat as OK. */
-+ if (rval == QLA_SUCCESS &&
-+ comp_status == SCS_DATA_UNDERRUN &&
-+ iscsi_flags & ISCSI_FLAG_RESIDUAL_UNDER) {
-+
-+ rval = QLA_SUCCESS;
-+ break;
-+ }
-+
-+ DEBUG2(printk("scsi(%d): RLC failed to issue iocb! "
-+ "fcport=[%04x/%p] rval=%x cs=%x ss=%x\n",
-+ ha->host_no, fcport->loop_id, fcport, rval,
-+ comp_status, scsi_status));
-+
-+ rval = QLA_ERROR;
-+ if (scsi_status & SCSISTAT_CHECK_CONDITION) {
-+ DEBUG2(printk("scsi(%d): RLC "
-+ "SCSISTAT_CHECK_CONDITION Sense Data "
-+ "%02x %02x %02x %02x %02x %02x %02x %02x\n",
-+ ha->host_no,
-+ rlc->p.rsp.senseData[0],
-+ rlc->p.rsp.senseData[1],
-+ rlc->p.rsp.senseData[2],
-+ rlc->p.rsp.senseData[3],
-+ rlc->p.rsp.senseData[4],
-+ rlc->p.rsp.senseData[5],
-+ rlc->p.rsp.senseData[6],
-+ rlc->p.rsp.senseData[7]));
-+ if (rlc->p.rsp.senseData[2] ==
-+ ILLEGAL_REQUEST) {
-+ fcport->flags &= ~(FCF_RLC_SUPPORT);
-+ break;
-+ }
-+ }
-+ } else {
-+ break;
-+ }
-+ }
-+
-+ return (rval);
-+}
-+
-+#if MSA1000_SUPPORTED
-+static int
-+qla4xxx_spinup(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun)
-+{
-+ inq_cmd_rsp_t *pkt;
-+ int rval = QLA_SUCCESS;
-+ int count, retry;
-+ dma_addr_t phys_address = 0;
-+ uint16_t comp_status = CS_COMPLETE;
-+ uint16_t scsi_status = 0;
-+
-+ ENTER(__func__);
-+
-+ pkt = pci_alloc_consistent(ha->pdev,
-+ sizeof(inq_cmd_rsp_t), &phys_address);
-+
-+ if (pkt == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - INQ\n",
-+ ha->host_no);
-+ return( QLA_FUNCTION_FAILED);
-+ }
-+
-+ count = 5;
-+ retry = 5;
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is not ONLINE\n",
-+ ha->host_no,__func__,fcport->loop_id);)
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+ else do {
-+ /* issue spinup */
-+ memset(pkt, 0, sizeof(inq_cmd_rsp_t));
-+ pkt->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ pkt->p.cmd.entry_count = 1;
-+ /* 8 byte lun number */
-+ inq->p.cmd.lun[1] = LSB(cpu_to_le16(lun)); /*SAMII compliant lun*/
-+ inq->p.cmd.lun[2] = MSB(cpu_to_le16(lun));
-+ SET_TARGET_ID(ha, pkt->p.cmd.target, fcport->loop_id);
-+ /* no direction for this command */
-+ pkt->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_SIMPLE_TAG);
-+ pkt->p.cmd.scsi_cdb[0] = START_STOP;
-+ pkt->p.cmd.scsi_cdb[4] = 1; /* start spin cycle */
-+ pkt->p.cmd.dseg_count = __constant_cpu_to_le16(0);
-+ pkt->p.cmd.timeout = __constant_cpu_to_le16(20);
-+ pkt->p.cmd.byte_count = __constant_cpu_to_le32(0);
-+
-+ rval = qla4xxx_issue_iocb(ha, pkt,
-+ phys_address, sizeof(inq_cmd_rsp_t));
-+
-+ comp_status = le16_to_cpu(pkt->p.rsp.comp_status);
-+ scsi_status = le16_to_cpu(pkt->p.rsp.scsi_status);
-+
-+ /* Port Logged Out, so don't retry */
-+ if( comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE ) {
-+ break;
-+ }
-+
-+ if ( (scsi_status & SS_CHECK_CONDITION) ) {
-+ DEBUG2(printk("%s(%ld): SS_CHECK_CONDITION "
-+ "Sense Data "
-+ "%02x %02x %02x %02x "
-+ "%02x %02x %02x %02x\n",
-+ __func__,
-+ ha->host_no,
-+ pkt->p.rsp.req_sense_data[0],
-+ pkt->p.rsp.req_sense_data[1],
-+ pkt->p.rsp.req_sense_data[2],
-+ pkt->p.rsp.req_sense_data[3],
-+ pkt->p.rsp.req_sense_data[4],
-+ pkt->p.rsp.req_sense_data[5],
-+ pkt->p.rsp.req_sense_data[6],
-+ pkt->p.rsp.req_sense_data[7]);)
-+ if (pkt->p.rsp.req_sense_data[2] ==
-+ NOT_READY &&
-+ (pkt->p.rsp.req_sense_data[12] == 4 ) &&
-+ (pkt->p.rsp.req_sense_data[13] == 3 ) ) {
-+
-+ current->state = TASK_UNINTERRUPTIBLE;
-+ schedule_timeout(HZ);
-+ printk(".");
-+ count--;
-+ } else
-+ retry--;
-+ }
-+
-+ printk(KERN_INFO
-+ "qla_fo(%ld): Sending Start - count %d, retry=%d"
-+ "comp status 0x%x, "
-+ "scsi status 0x%x, rval=%d\n",
-+ ha->host_no,
-+ count,
-+ retry,
-+ comp_status,
-+ scsi_status,
-+ rval);
-+
-+ if ((rval != QLA_SUCCESS) || (comp_status != CS_COMPLETE))
-+ retry--;
-+
-+ } while ( count && retry &&
-+ (rval != QLA_SUCCESS ||
-+ comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)));
-+
-+
-+ if (rval != QLA_SUCCESS ||
-+ comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) {
-+
-+ DEBUG(printk("qla_fo(%ld): Failed spinup - "
-+ "comp status 0x%x, "
-+ "scsi status 0x%x. loop_id=%d\n",
-+ ha->host_no,
-+ comp_status,
-+ scsi_status,
-+ fcport->loop_id);)
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(inq_cmd_rsp_t),
-+ pkt, phys_address);
-+
-+
-+ LEAVE(__func__);
-+
-+ return( rval );
-+
-+}
-+#endif
-+
-+
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_foioctl.c ./drivers/scsi/qla4xxx/ql4_foioctl.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_foioctl.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_foioctl.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,273 @@
-+/********************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic ISP4xxx device driver for Linux 2.6.x
-+* Copyright (C) 2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+*
-+******************************************************************************
-+* Failover include file
-+******************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#include <linux/blkdev.h>
-+#include <asm/uaccess.h>
-+
-+#include "qlnfo.h"
-+#include "ql4_ioctl.h"
-+
-+/*
-+ * Global variables
-+ */
-+
-+/*
-+ * Support routines
-+ */
-+
-+/*
-+ * qla4xxx_get_hba
-+ * Searches the hba structure chain for the requested instance
-+ * aquires the mutex and returns a pointer to the hba structure.
-+ *
-+ * Input:
-+ * inst = adapter instance number.
-+ *
-+ * Returns:
-+ * Return value is a pointer to the adapter structure or
-+ * NULL if instance not found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+scsi_qla_host_t *
-+qla4xxx_get_hba(unsigned long instance)
-+{
-+ int found;
-+ scsi_qla_host_t *ha;
-+
-+ ha = NULL;
-+ found = 0;
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each_entry(ha, &qla4xxx_hostlist, list) {
-+ if (ha->instance == instance) {
-+ found++;
-+ break;
-+ }
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+
-+ return (found ? ha : NULL);
-+}
-+
-+/*
-+ * qla4xxx_nfo_ioctl
-+ * Provides functions for failover ioctl() calls.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * ioctl_code = ioctl function to perform
-+ * arg = Address of application EXT_IOCTL_NFO cmd data
-+ * mode = flags
-+ *
-+ * Returns:
-+ * Return value is the ioctl rval_p return value.
-+ * 0 = success
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_nfo_ioctl(struct scsi_device *dev, int cmd, void *arg)
-+{
-+ char *ptemp;
-+ int status = 0;
-+ int tmp_stat = 0;
-+ EXT_IOCTL_NFO *pioctl = NULL;
-+ scsi_qla_host_t *ha = NULL;
-+
-+
-+ ENTER(__func__);
-+
-+ /*
-+ * Check to see if we can access the ioctl command structure
-+ */
-+ if (!access_ok(VERIFY_WRITE, arg, sizeof(EXT_IOCTL_NFO))) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: NULL EXT_IOCTL_NFO buffer\n",
-+ __func__));
-+
-+ status = (-EFAULT);
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ /* Allocate ioctl structure buffer to support multiple concurrent
-+ * entries. NO static structures allowed.
-+ */
-+ pioctl = QL_KMEM_ZALLOC(sizeof(EXT_IOCTL_NFO));
-+ if (pioctl == NULL) {
-+ /* error */
-+ printk(KERN_WARNING
-+ "qla4xxx: ERROR in main nfo ioctl buffer allocation.\n");
-+ status = (-ENOMEM);
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ /*
-+ * Copy the ioctl command structure from user space to local structure
-+ */
-+ status = copy_from_user((uint8_t *)pioctl, arg, sizeof(EXT_IOCTL_NFO));
-+ if (status) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi: %s: EXT_IOCTL_NFO copy error.\n",
-+ __func__));
-+
-+ goto exit_qla4nfo_ioctl;
-+ }
-+ QL4PRINT(QLP4|QLP10, printk("EXT_IOCTL_NFO structure: \n"));
-+ qla4xxx_dump_dwords(QLP4|QLP10, pioctl, sizeof(*pioctl));
-+
-+ /* check signature of this ioctl */
-+ ptemp = (uint8_t *)pioctl->Signature;
-+
-+ if (memcmp(ptemp, NFO_DEF_SIGNATURE, NFO_DEF_SIGNATURE_SIZE) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: signature did not match. "
-+ "cmd=%x arg=%p.\n", __func__, cmd, arg));
-+ pioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_NFO));
-+
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ /* check version of this ioctl */
-+ if (pioctl->Version > NFO_VERSION) {
-+ printk(KERN_WARNING
-+ "ql4xxx: ioctl interface version not supported = %d.\n",
-+ pioctl->Version);
-+
-+ pioctl->Status = EXT_STATUS_UNSUPPORTED_VERSION;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_NFO));
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ if (!((ulong)pioctl->VendorSpecificData & EXT_DEF_USE_HBASELECT)) {
-+ /* we don't support api that are too old */
-+ QL4PRINT(QLP2|QLP4,
-+ printk(
-+ "%s: got setinstance cmd w/o HbaSelect. Return error.\n",
-+ __func__));
-+ pioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_NFO));
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ /*
-+ * Get the adapter handle for the corresponding adapter instance
-+ */
-+ ha = qla4xxx_get_adapter_handle(pioctl->HbaSelect);
-+ if (ha == NULL) {
-+ QL4PRINT(QLP2,
-+ printk("%s: NULL EXT_IOCTL_NFO buffer\n",
-+ __func__));
-+
-+ pioctl->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_NFO));
-+ goto exit_qla4nfo_ioctl;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: ioctl+ (%s)\n", ha->host_no,
-+ IOCTL_TBL_STR(cmd, pioctl->SubCode)));
-+
-+ down(&ha->ioctl->ioctl_sem);
-+
-+ /*
-+ * If the DPC is active, wait for it to complete before proceeding
-+ */
-+ while (ha->dpc_active) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1*HZ);
-+ }
-+
-+ ha->i_start = jiffies;
-+ ha->i_end = 0;
-+ ha->f_start = 0;
-+ ha->f_end = 0;
-+
-+ /*
-+ * Issue the ioctl command
-+ */
-+ switch (cmd) {
-+#if 0
-+ case EXT_CC_TRANSPORT_INFO:
-+ case EXT_CC_GET_FOM_PROP:
-+ case EXT_CC_GET_HBA_INFO:
-+ case EXT_CC_GET_DPG_PROP:
-+ case EXT_CC_GET_DPG_PATH_INFO:
-+ case EXT_CC_SET_DPG_PATH_INFO:
-+ case EXT_CC_GET_LB_INFO:
-+ case EXT_CC_GET_LB_POLICY:
-+ case EXT_CC_SET_LB_POLICY:
-+ case EXT_CC_GET_DPG_STATS:
-+ case EXT_CC_CLEAR_DPG_ERR_STATS:
-+ case EXT_CC_CLEAR_DPG_IO_STATS:
-+ case EXT_CC_CLEAR_DPG_FO_STATS:
-+ case EXT_CC_GET_PATHS_FOR_ALL:
-+ case EXT_CC_MOVE_PATH:
-+ case EXT_CC_VERIFY_PATH:
-+ case EXT_CC_GET_EVENT_LIST:
-+ case EXT_CC_ENABLE_FOM:
-+ case EXT_CC_DISABLE_FOM:
-+ case EXT_CC_GET_STORAGE_LIST:
-+ status = xx();
-+ break;
-+#endif
-+ default:
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unsupported command code (%X)\n",
-+ ha->host_no, __func__, cmd));
-+
-+ pioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ }
-+
-+ /*
-+ * Copy the updated ioctl structure back to the user
-+ */
-+ tmp_stat = copy_to_user(arg, (void *)pioctl, sizeof(EXT_IOCTL_NFO));
-+ if (status == 0)
-+ status = tmp_stat;
-+
-+ ha->i_end = jiffies;
-+
-+ up(&ha->ioctl->ioctl_sem);
-+
-+ QL4PRINT(QLP4, printk("scsi%d: ioctl- (%s) "
-+ "i_start=%lx, f_start=%lx, f_end=%lx, i_end=%lx\n",
-+ ha->host_no, IOCTL_TBL_STR(cmd, pioctl->SubCode),
-+ ha->i_start, ha->f_start, ha->f_end, ha->i_end));
-+
-+exit_qla4nfo_ioctl:
-+
-+ if (pioctl)
-+ QL_KMEM_FREE(pioctl);
-+
-+ LEAVE(__func__);
-+
-+ return (status);
-+}
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_foln.c ./drivers/scsi/qla4xxx/ql4_foln.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_foln.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_foln.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,599 @@
-+/********************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic ISP4xxx device driver for Linux 2.6.x
-+* Copyright (C) 2003-2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+*
-+******************************************************************************/
-+
-+#include <linux/version.h>
-+#include <linux/moduleparam.h>
-+//#include <linux/vmalloc.h>
-+//#include <linux/smp_lock.h>
-+//#include <linux/delay.h>
-+
-+//#include "qla_os.h"
-+#include "ql4_def.h"
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+/*
-+#include "ql4_foln.h"
-+*/
-+
-+int ql4xfailover = 0;
-+module_param(ql4xfailover, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql4xfailover,
-+ "Driver failover support: 0 to disable; 1 to enable.");
-+
-+int ql4xrecoveryTime = MAX_RECOVERYTIME;
-+module_param_named(recoveryTime, ql4xrecoveryTime, int, S_IRUGO|S_IWUSR);
-+MODULE_PARM_DESC(recoveryTime,
-+ "Recovery time in seconds before a target device is sent I/O "
-+ "after a failback is performed.");
-+
-+int ql4xfailbackTime = MAX_FAILBACKTIME;
-+module_param_named(failbackTime, ql4xfailbackTime, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(failbackTime,
-+ "Delay in seconds before a failback is performed.");
-+
-+int MaxPathsPerDevice = 0;
-+module_param(MaxPathsPerDevice, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxPathsPerDevice,
-+ "Maximum number of paths to a device. Default 8.");
-+
-+int MaxRetriesPerPath = 0;
-+module_param(MaxRetriesPerPath, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxRetriesPerPath,
-+ "How many retries to perform on the current path before "
-+ "failing over to the next path in the path list.");
-+
-+int MaxRetriesPerIo = 0;
-+module_param(MaxRetriesPerIo, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxRetriesPerIo,
-+ "How many total retries to do before failing the command and "
-+ "returning to the OS with a DID_NO_CONNECT status.");
-+
-+int qlFailoverNotifyType = 0;
-+module_param(qlFailoverNotifyType, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(qlFailoverNotifyType,
-+ "Failover notification mechanism to use when a failover or "
-+ "failback occurs.");
-+
-+struct cfg_device_info cfg_device_list[] = {
-+
-+ {"IBM","DS300", 0x10, FO_NOTIFY_TYPE_NONE,
-+ qla4xxx_combine_by_lunid, NULL, NULL, NULL },
-+ {"IBM","DS400",0x10, FO_NOTIFY_TYPE_NONE,
-+ qla4xxx_combine_by_lunid, NULL, NULL, NULL },
-+
-+ /*
-+ * Must be at end of list...
-+ */
-+ {NULL, NULL }
-+};
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+/*
-+ * qla4xxx_flush_failover_queue
-+ * Return cmds of a "specific" LUN from the failover queue with
-+ * DID_BUS_BUSY status.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * q = lun queue.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+void
-+qla4xxx_flush_failover_q(scsi_qla_host_t *ha, os_lun_t *q)
-+{
-+ srb_t *sp;
-+ struct list_head *list, *temp;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_safe(list, temp, &ha->failover_queue){
-+ sp = list_entry(list, srb_t, list_entry);
-+ /*
-+ * If request originated from the same lun_q then delete it
-+ * from the failover queue
-+ */
-+ if (q == sp->lun_queue) {
-+ /* Remove srb from failover queue. */
-+ __del_from_failover_queue(ha,sp);
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->host_scribble = (unsigned char *) NULL;
-+ __add_to_done_srb_q(ha,sp);
-+ }
-+ } /* list_for_each_safe() */
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+#endif
-+
-+/*
-+ * qla4xxx_check_for_devices_online
-+ *
-+ * Check fcport state of all devices to make sure online.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Return:
-+ * None.
-+ *
-+ * Context:
-+ */
-+static uint8_t
-+qla4xxx_check_for_devices_online(scsi_qla_host_t *ha)
-+{
-+ fc_port_t *fcport;
-+
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if(fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if ((atomic_read(&fcport->state) == FCS_ONLINE) ||
-+ (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
-+ fcport->flags & FCF_FAILBACK_DISABLE)
-+ continue;
-+
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+/*
-+ * qla4xxx_failover_cleanup
-+ * Cleanup queues after a failover.
-+ *
-+ * Input:
-+ * sp = command pointer
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+static void
-+qla4xxx_failover_cleanup(srb_t *sp)
-+{
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->host_scribble = (unsigned char *) NULL;
-+
-+ /* turn-off all failover flags */
-+ sp->flags = sp->flags & ~(SRB_RETRY|SRB_FAILOVER|SRB_FO_CANCEL);
-+}
-+
-+int
-+qla4xxx_suspend_failover_targets(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ struct list_head *list, *temp;
-+ srb_t *sp;
-+ int count;
-+ os_tgt_t *tq;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ count = ha->failover_cnt;
-+ list_for_each_safe(list, temp, &ha->failover_queue) {
-+ sp = list_entry(ha->failover_queue.next, srb_t, list_entry);
-+ tq = sp->tgt_queue;
-+ if (!(test_bit(TQF_SUSPENDED, &tq->flags)))
-+ set_bit(TQF_SUSPENDED, &tq->flags);
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return count;
-+}
-+
-+srb_t *
-+qla4xxx_failover_next_request(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ srb_t *sp = NULL;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ if (!list_empty(&ha->failover_queue)) {
-+ sp = list_entry(ha->failover_queue.next, srb_t, list_entry);
-+ __del_from_failover_queue(ha, sp);
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ return( sp );
-+}
-+static void qla4xxx_resume_failover_targets(scsi_qla_host_t *ha)
-+{
-+ uint32_t t, l;
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+
-+ for (t = 0; t < ha->host->max_id; t++) {
-+ if ((tq = ha->otgt[t]) == NULL)
-+ continue;
-+ if (test_and_clear_bit(TQF_SUSPENDED, &tq->flags)) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(): remove suspend for "
-+ "target %d\n",
-+ __func__,
-+ t);)
-+ }
-+ for (l = 0; l < MAX_LUNS; l++) {
-+ if ((lq = (os_lun_t *) tq->olun[l]) == NULL)
-+ continue;
-+
-+#if 0
-+ if (test_and_clear_bit(LUN_MPIO_BUSY, &lq->q_flag)) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(): remove suspend for "
-+ "lun %d\n",
-+ __func__,
-+ lq->fclun->lun);)
-+ }
-+#endif
-+ }
-+ }
-+
-+}
-+
-+
-+
-+/*
-+ * qla4xxx_process_failover
-+ * Process any command on the failover queue.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+static void
-+qla4xxx_process_failover(scsi_qla_host_t *ha)
-+{
-+
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+ srb_t *sp;
-+ fc_port_t *fcport;
-+ scsi_qla_host_t *vis_ha = ha;
-+ int count, i;
-+
-+ DEBUG2(printk(KERN_INFO "scsi%d: %s: active=%d, retry=%d, "
-+ "done=%d, failover=%d commands.\n",
-+ ha->host_no,
-+ __func__,
-+ ha->active_srb_count,
-+ ha->retry_srb_q_count,
-+ ha->done_srb_q_count,
-+ ha->failover_cnt);)
-+
-+ /* Prevent acceptance of new I/O requests for failover target. */
-+ count = qla4xxx_suspend_failover_targets(ha);
-+
-+ /*
-+ * Process all the commands in the failover queue. Attempt to failover
-+ * then either complete the command as is or requeue for retry.
-+ */
-+ for (i = 0; i < count ; i++) {
-+ sp = qla4xxx_failover_next_request(ha);
-+ if (!sp)
-+ break;
-+
-+ qla4xxx_extend_timeout(sp->cmd, 360);
-+ if (i == 0)
-+ vis_ha =
-+ (scsi_qla_host_t *)sp->cmd->device->host->hostdata;
-+
-+ tq = sp->tgt_queue;
-+ lq = sp->lun_queue;
-+ fcport = lq->fclun->fcport;
-+
-+ DEBUG2(printk("%s(): pid %ld retrycnt=%d, fcport =%p, "
-+ "state=0x%x, \nha flags=0x%lx fclun=%p, lq fclun=%p, "
-+ "lq=%p, lun=%d\n", __func__, sp->cmd->serial_number,
-+ sp->cmd->retries, fcport, atomic_read(&fcport->state),
-+ ha->flags, sp->fclun, lq->fclun, lq,
-+ lq->fclun->lun));
-+ if (sp->err_id == SRB_ERR_DEVICE && sp->fclun == lq->fclun &&
-+ atomic_read(&fcport->state) == FCS_ONLINE) {
-+ if (!(qla4xxx_test_active_lun(fcport, sp->fclun))) {
-+ DEBUG2(printk("scsi(%d) %s Detected INACTIVE "
-+ "Port 0x%02x \n", ha->host_no, __func__,
-+ fcport->loop_id));
-+ sp->err_id = SRB_ERR_OTHER;
-+ sp->cmd->sense_buffer[2] = 0;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ }
-+ }
-+ if ((sp->flags & SRB_GOT_SENSE)) {
-+ sp->flags &= ~SRB_GOT_SENSE;
-+ sp->cmd->sense_buffer[0] = 0;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->host_scribble = (unsigned char *) NULL;
-+ }
-+
-+ /*** Select an alternate path ***/
-+ /*
-+ * If the path has already been change by a previous request
-+ * sp->fclun != lq->fclun
-+ */
-+ if (sp->fclun != lq->fclun || (sp->err_id != SRB_ERR_OTHER &&
-+ atomic_read(&fcport->state) != FCS_DEVICE_DEAD)) {
-+ qla4xxx_failover_cleanup(sp);
-+ } else if (qla4xxx_cfg_failover(ha,
-+ lq->fclun, tq, sp) == NULL) {
-+ /*
-+ * We ran out of paths, so just retry the status which
-+ * is already set in the cmd. We want to serialize the
-+ * failovers, so we make them go thur visible HBA.
-+ */
-+ printk(KERN_INFO
-+ "%s(): Ran out of paths - pid %ld - retrying\n",
-+ __func__, sp->cmd->serial_number);
-+ } else {
-+ qla4xxx_failover_cleanup(sp);
-+
-+ }
-+ add_to_done_srb_q(ha, sp);
-+ }
-+
-+ qla4xxx_resume_failover_targets(vis_ha);
-+#if 0
-+ for (t = 0; t < vis_ha->max_targets; t++) {
-+ if ((tq = vis_ha->otgt[t]) == NULL)
-+ continue;
-+ if (test_and_clear_bit(TQF_SUSPENDED, &tq->flags)) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(): remove suspend for target %d\n",
-+ __func__, t));
-+ }
-+ for (l = 0; l < vis_ha->max_luns; l++) {
-+ if ((lq = (os_lun_t *) tq->olun[l]) == NULL)
-+ continue;
-+
-+ if( test_and_clear_bit(LUN_MPIO_BUSY, &lq->q_flag) ) {
-+ /* EMPTY */
-+ DEBUG(printk("%s(): remove suspend for "
-+ "lun %d\n", __func__, lq->fclun->lun));
-+ }
-+ }
-+ }
-+#endif
-+ // qla4xxx_restart_queues(ha, 0);
-+
-+ DEBUG2(printk("%s() - done", __func__));
-+}
-+
-+int
-+qla4xxx_search_failover_queue(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-+{
-+ struct list_head *list, *temp;
-+ unsigned long flags;
-+ srb_t *sp;
-+
-+ DEBUG3(printk("qla4xxx_eh_abort: searching sp %p in "
-+ "failover queue.\n", sp);)
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_safe(list, temp, &ha->failover_queue) {
-+ sp = list_entry(list, srb_t, list_entry);
-+
-+ if (cmd == sp->cmd)
-+ goto found;
-+
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return 0;
-+
-+ found:
-+ /* Remove srb from failover queue. */
-+ __del_from_failover_queue(ha, sp);
-+ cmd->result = DID_ABORT << 16;
-+ __add_to_done_srb_q(ha, sp);
-+
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ return 1;
-+}
-+
-+/*
-+ * If we are not processing a ioctl or one of
-+ * the ports are still MISSING or need a resync
-+ * then process the failover event.
-+ */
-+void
-+qla4xxx_process_failover_event(scsi_qla_host_t *ha)
-+{
-+ if (test_bit(CFG_ACTIVE, &ha->cfg_flags))
-+ return;
-+ if (qla4xxx_check_for_devices_online(ha)) {
-+ if (test_and_clear_bit(DPC_FAILOVER_EVENT, &ha->dpc_flags)) {
-+ // if (ha->flags.online)
-+ if (ADAPTER_UP(ha))
-+ qla4xxx_cfg_event_notify(ha, ha->failover_type);
-+ }
-+ }
-+
-+ /*
-+ * Get any requests from failover queue
-+ */
-+ if (test_and_clear_bit(DPC_FAILOVER_NEEDED, &ha->dpc_flags))
-+ qla4xxx_process_failover(ha);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_start_fo_cmd
-+ * This routine retrieves and processes next request from the pending
-+ * queue.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_start_fo_cmd(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+ fc_port_t *fcport;
-+
-+ ENTER(__func__);
-+
-+ lun_entry = srb->lun_queue;
-+ fcport = lun_entry->fclun->fcport;
-+ ddb_entry = fcport->ddbptr;
-+
-+ if ((atomic_read(&ddb_entry->state) == DEV_STATE_DEAD)) {
-+ if (!test_bit(AF_LINK_UP, &fcport->ha->flags))
-+ srb->err_id = SRB_ERR_LOOP;
-+ else
-+ srb->err_id = SRB_ERR_PORT;
-+
-+ DEBUG2(printk("scsi%d: Port dead, err_id=%d, sp=%ld - "
-+ "retry_q\n", fcport->ha->host_no,srb->err_id,
-+ srb->cmd->serial_number));
-+
-+ srb->cmd->result = DID_NO_CONNECT << 16;
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ add_to_done_srb_q(ha,srb);
-+#else
-+ qla4xxx_complete_request(ha,srb);
-+#endif
-+ goto exit_start_cmd;
-+
-+ }
-+
-+ if (atomic_read(&ddb_entry->state) == DEV_STATE_MISSING ||
-+ !ADAPTER_UP(fcport->ha)) {
-+ DEBUG2(printk("scsi%d: Port missing or adapter down"
-+ "-ddb state=0x%x, hba flags=0x%lx, sp=%ld - "
-+ "retry_q\n", fcport->ha->host_no,
-+ atomic_read(&ddb_entry->state),
-+ fcport->ha->flags, srb->cmd->serial_number));
-+
-+ qla4xxx_extend_timeout(srb->cmd, EXTEND_CMD_TOV);
-+ add_to_retry_srb_q(ha, srb);
-+ goto exit_start_cmd;
-+ }
-+
-+ if (!(srb->flags & SRB_TAPE) &&
-+ (test_bit(CFG_FAILOVER, &fcport->ha->cfg_flags) ||
-+ (srb->flags & SRB_FAILOVER))) {
-+ DEBUG2(printk("scsi%d: Failover flag set - sp=%ld"
-+ "cfg flags=0x%lx - retry_q\n",
-+ fcport->ha->host_no, srb->cmd->serial_number,
-+ fcport->ha->cfg_flags ));
-+
-+ qla4xxx_extend_timeout(srb->cmd, EXTEND_CMD_TOV);
-+ add_to_retry_srb_q(ha, srb);
-+ goto exit_start_cmd;
-+ }
-+
-+ if (lun_entry->lun_state == LS_LUN_SUSPENDED) {
-+ DEBUG2(printk("scsi%d: Lun suspended - sp=%ld - "
-+ "retry_q\n", fcport->ha->host_no,
-+ srb->cmd->serial_number));
-+
-+ add_to_retry_srb_q(ha, srb);
-+ goto exit_start_cmd;
-+ }
-+
-+
-+ if (qla4xxx_send_command_to_isp(ha, srb) != QLA_SUCCESS) {
-+ /*
-+ * Unable to send command to the ISP at this time.
-+ * Notify the OS to queue commands in the OS. The OS
-+ * will not attempt to queue more commands until a
-+ * command is returned to the OS.
-+ */
-+ DEBUG2(printk("scsi%d: %s: unable to send cmd "
-+ "to ISP, retry later\n", ha->host_no, __func__));
-+ srb->cmd->result = DID_ERROR << 16;
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ add_to_done_srb_q(ha,srb);
-+#else
-+ qla4xxx_complete_request(ha,srb);
-+#endif
-+ // add_to_pending_srb_q_head(ha, srb);
-+ goto exit_start_cmd;
-+ }
-+
-+
-+exit_start_cmd:
-+ LEAVE(__func__);
-+}
-+
-+
-+
-+int
-+qla4xxx_do_fo_check(scsi_qla_host_t *ha, srb_t *sp, scsi_qla_host_t *vis_ha)
-+{
-+ /*
-+ * This routine checks for DID_NO_CONNECT to decide
-+ * whether to failover to another path or not. We only
-+ * failover on that status.
-+ */
-+ if (sp->lun_queue->fclun->fcport->flags & FCF_FAILOVER_DISABLE)
-+ return 0;
-+
-+ if (sp->lun_queue->fclun->flags & FLF_VISIBLE_LUN)
-+ return 0;
-+
-+ if (!qla4xxx_fo_check(ha, sp))
-+ return 0;
-+
-+ if ((sp->state != SRB_FAILOVER_STATE)) {
-+ /*
-+ * Retry the command on this path
-+ * several times before selecting a new
-+ * path.
-+ */
-+ qla4xxx_start_fo_cmd(vis_ha, sp);
-+ } else
-+ qla4xxx_extend_timeout(sp->cmd, EXTEND_CMD_TIMEOUT);
-+
-+ return 1;
-+}
-+
-+void
-+qla4xxx_start_all_adapters(scsi_qla_host_t *ha)
-+{
-+#if 0
-+ struct list_head *hal;
-+ scsi_qla_host_t *vis_ha;
-+
-+ /* Try and start all visible adapters */
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each(hal, &qla4xxx_hostlist) {
-+ vis_ha = list_entry(hal, scsi_qla_host_t, list);
-+
-+ if (!list_empty(&vis_ha->pending_srb_q))
-+ qla4xxx_start_io(vis_ha);
-+
-+ DEBUG2(printk("host(%d):Commands busy=%d "
-+ "failed=%d\neh_active=%d\n ",
-+ vis_ha->host_no,
-+ vis_ha->host->host_busy,
-+ vis_ha->host->host_failed,
-+ vis_ha->host->eh_active);)
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+#endif
-+}
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_foln.h ./drivers/scsi/qla4xxx/ql4_foln.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_foln.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_foln.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,237 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2003-2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+#ifndef __QLA_FOLN_H
-+#define __QLA_FOLN_H
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+
-+// #include "exioct.h"
-+#include "ql4_fo.h"
-+#include "ql4_cfg.h"
-+#include "ql4_fw.h"
-+
-+/*
-+ * Inquiry command structure.
-+ */
-+#define INQ_DATA_SIZE 36
-+
-+typedef struct {
-+ union {
-+ COMMAND_T3_ENTRY cmd;
-+ STATUS_ENTRY rsp;
-+ } p;
-+ uint8_t inq[INQ_DATA_SIZE];
-+} inq_cmd_rsp_t;
-+
-+/*
-+ * Report LUN command structure.
-+ */
-+#define RPT_LUN_SCSI_OPCODE 0xA0
-+#define CHAR_TO_SHORT(a, b) (uint16_t)((uint8_t)b << 8 | (uint8_t)a)
-+
-+typedef struct {
-+ uint32_t len;
-+ uint32_t rsrv;
-+} rpt_hdr_t;
-+
-+typedef struct {
-+ struct {
-+ uint8_t b : 6;
-+ uint8_t address_method : 2;
-+ } msb;
-+ uint8_t lsb;
-+ uint8_t unused[6];
-+} rpt_lun_t;
-+
-+typedef struct {
-+ rpt_hdr_t hdr;
-+ rpt_lun_t lst[MAX_LUNS];
-+} rpt_lun_lst_t;
-+
-+typedef struct {
-+ union {
-+ COMMAND_T3_ENTRY cmd;
-+ STATUS_ENTRY rsp;
-+ } p;
-+ rpt_lun_lst_t list;
-+} rpt_lun_cmd_rsp_t;
-+
-+
-+/*
-+ * Device configuration table
-+ *
-+ * This table provides a library of information about the device
-+ */
-+struct cfg_device_info {
-+ const char *vendor;
-+ const char *model;
-+ const int flags; /* bit 0 (0x1) -- translate the real
-+ WWNN to the common WWNN for the target AND
-+ XP_DEVICE */
-+ /* bit 1 (0x2) -- MSA 1000 */
-+ /* bit 2 (0x4) -- EVA */
-+ /* bit 3 (0x8) -- DISABLE FAILOVER */
-+ const int notify_type; /* support the different types: 1 - 4 */
-+ int ( *fo_combine)(void *,
-+ uint16_t, fc_port_t *, uint16_t );
-+ int ( *fo_detect)(void);
-+ int ( *fo_notify)(void);
-+ int ( *fo_select)(void);
-+};
-+
-+
-+typedef struct {
-+ union {
-+ COMMAND_T3_ENTRY cmd;
-+ STATUS_ENTRY rsp;
-+ } p;
-+ uint8_t inq[VITAL_PRODUCT_DATA_SIZE];
-+} evpd_inq_cmd_rsp_t;
-+
-+typedef struct {
-+ union {
-+ COMMAND_T3_ENTRY cmd;
-+ STATUS_ENTRY rsp;
-+ } p;
-+} tur_cmd_rsp_t;
-+
-+
-+#define SDM_DEF_MAX_DEVICES 16
-+#define SDM_DEF_MAX_PATHS_PER_TARGET 4
-+#define SDM_DEF_MAX_TARGETS_PER_DEVICE 4
-+#define SDM_DEF_MAX_PATHS_PER_DEVICE (SDM_DEF_MAX_PATHS_PER_TARGET * SDM_DEF_MAX_TARGETS_PER_DEVICE)
-+
-+#define FO_MAX_LUNS_PER_DEVICE MAX_LUNS_OS
-+#define FO_MAX_PATHS (SDM_DEF_MAX_PATHS_PER_DEVICE * SDM_DEF_MAX_DEVICES)
-+#define FO_MAX_ADAPTERS 32
-+#define FO_ADAPTER_ALL 0xFF
-+#define FO_DEF_WWN_SIZE 8
-+#define FO_MAX_GEN_INFO_STRING_LEN 32
-+
-+/*
-+ * Global Data in qla_fo.c source file.
-+ */
-+
-+/*
-+ * Global Function Prototypes in qla_fo.c source file.
-+ */
-+extern scsi_qla_host_t *qla4xxx_get_hba(unsigned long);
-+extern uint32_t qla4xxx_send_fo_notification(fc_lun_t *fclun_p, fc_lun_t *olun_p);
-+extern void qla4xxx_fo_init_params(scsi_qla_host_t *ha);
-+extern uint8_t qla4xxx_fo_enabled(scsi_qla_host_t *ha, int instance);
-+//extern int qla4xxx_fo_ioctl(scsi_qla_host_t *, int, EXT_IOCTL *, int);
-+
-+/*
-+ * Global Data in qla_cfg.c source file.
-+ */
-+extern mp_host_t *mp_hosts_base;
-+extern int mp_config_required;
-+
-+/*
-+ * Global Function Prototypes in qla_cfg.c source file.
-+ */
-+
-+extern mp_host_t *qla4xxx_cfg_find_host(scsi_qla_host_t *);
-+extern int qla4xxx_is_iscsiname_in_device(mp_device_t *, uint8_t *);
-+extern int qla4xxx_cfg_path_discovery(scsi_qla_host_t *);
-+extern int qla4xxx_cfg_event_notify(scsi_qla_host_t *, uint32_t);
-+extern fc_lun_t *qla4xxx_cfg_failover(scsi_qla_host_t *, fc_lun_t *,
-+ os_tgt_t *, srb_t *);
-+extern void qla4xxx_fo_properties(scsi_qla_host_t *);
-+extern mp_host_t *qla4xxx_add_mp_host(uint8_t *);
-+extern mp_host_t *qla4xxx_alloc_host(scsi_qla_host_t *);
-+extern uint8_t qla4xxx_fo_check(scsi_qla_host_t *ha, srb_t *);
-+extern mp_path_t *qla4xxx_find_path_by_name(mp_host_t *, mp_path_list_t *,
-+ uint8_t *);
-+
-+extern int __qla4xxx_is_fcport_in_config(scsi_qla_host_t *, fc_port_t *);
-+extern int qla4xxx_cfg_init(scsi_qla_host_t *);
-+extern void qla4xxx_cfg_mem_free(scsi_qla_host_t *);
-+
-+extern int qla4xxx_cfg_remap(scsi_qla_host_t *);
-+extern void qla4xxx_set_device_flags(scsi_qla_host_t *, fc_port_t *);
-+
-+extern int16_t qla4xxx_cfg_lookup_device(unsigned char *);
-+extern int qla4xxx_combine_by_lunid(void *, uint16_t, fc_port_t *, uint16_t);
-+extern int qla4xxx_export_target(void *, uint16_t, fc_port_t *, uint16_t);
-+
-+extern int qla4xxx_test_active_lun(fc_port_t *, fc_lun_t *);
-+extern int qla4xxx_test_active_port(fc_port_t *);
-+
-+extern int qla4xxx_is_fcport_in_foconfig(scsi_qla_host_t *, fc_port_t *);
-+
-+/*
-+ * Global Function Prototypes in qla_cfgln.c source file.
-+ */
-+extern void qla4xxx_cfg_build_path_tree( scsi_qla_host_t *ha);
-+extern uint8_t qla4xxx_update_mp_device(mp_host_t *,
-+ fc_port_t *, uint16_t, uint16_t);
-+extern void qla4xxx_cfg_display_devices(int);
-+
-+
-+/*
-+ * Global Function Prototypes in qla_foln.c source file.
-+ */
-+extern int qla4xxx_search_failover_queue(scsi_qla_host_t *, struct scsi_cmnd *);
-+extern void qla4xxx_process_failover_event(scsi_qla_host_t *);
-+extern int qla4xxx_do_fo_check(scsi_qla_host_t *, srb_t *, scsi_qla_host_t *);
-+extern void qla4xxx_start_all_adapters(scsi_qla_host_t *);
-+extern void qla4xxx_start_fo_cmd(scsi_qla_host_t *ha, srb_t *srb);
-+
-+extern int ql4xfailover;
-+extern int ql4xrecoveryTime;
-+extern int ql4xfailbackTime;
-+
-+extern int MaxPathsPerDevice;
-+extern int MaxRetriesPerPath;
-+extern int MaxRetriesPerIo;
-+extern int qlFailoverNotifyType;
-+
-+extern struct cfg_device_info cfg_device_list[];
-+
-+#define qla4xxx_failover_enabled(ha) (ql4xfailover)
-+
-+#else
-+
-+#define qla4xxx_is_fcport_in_foconfig(ha, fcport) (0)
-+#define qla4xxx_fo_missing_port_summary(ha, e, s, m, c, r) (0)
-+/* qla4xxx_cfg_init() is declared int but the retval isn't checked.. */
-+#define qla4xxx_cfg_init(ha) do { } while (0)
-+#define qla4xxx_cfg_mem_free(ha) do { } while (0)
-+#define qla4xxx_cfg_display_devices() do { } while (0)
-+#define qla4xxx_process_failover_event(ha) do { } while (0)
-+#define qla4xxx_start_all_adapters(ha) do { } while (0)
-+#define qla4xxx_search_failover_queue(ha, cmd) (0)
-+#define qla4xxx_do_fo_check(ha, sp, vis_ha) (0)
-+#define qla4xxx_failover_enabled(ha) (0)
-+#endif /* CONFIG_SCSI_QLA4XXX_FAILOVER */
-+
-+static __inline int
-+qla4xxx_is_fcport_in_config(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ if (qla4xxx_failover_enabled(ha))
-+ return qla4xxx_is_fcport_in_foconfig(ha, fcport);
-+ else if (fcport->flags & FCF_PERSISTENT_BOUND)
-+ return 1;
-+ return 0;
-+}
-+
-+
-+#endif /* __QLA_FOLN_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_fw.h ./drivers/scsi/qla4xxx/ql4_fw.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_fw.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_fw.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,1571 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+/*
-+ * This file defines mailbox structures and definitions for the QLA4xxx
-+ * iSCSI HBA firmware.
-+ */
-+
-+#ifndef _QLA4X_FW_H
-+#define _QLA4X_FW_H
-+
-+#ifndef INT8
-+#define INT8 __s8
-+#endif
-+#ifndef INT16
-+#define INT16 __s16
-+#endif
-+#ifndef INT32
-+#define INT32 __s32
-+#endif
-+#ifndef UINT8
-+#define UINT8 __u8
-+#endif
-+#ifndef UINT16
-+#define UINT16 __u16
-+#endif
-+#ifndef UINT32
-+#define UINT32 __u32
-+#endif
-+#ifndef UINT64
-+#define UINT64 __u64
-+#endif
-+
-+
-+#define QLA4XXX_VENDOR_ID 0x1077
-+#define QLA4000_DEVICE_ID 0x4000
-+#define QLA4010_DEVICE_ID 0x4010
-+
-+#define QLA4040_SSDID_NIC 0x011D /* Uses QLA4010 PCI Device ID */
-+#define QLA4040_SSDID_ISCSI 0x011E
-+#define QLA4040C_SSDID_NIC 0x011F
-+#define QLA4040C_SSDID_ISCSI 0x0120
-+
-+#define MAX_PRST_DEV_DB_ENTRIES 64
-+#define MIN_DISC_DEV_DB_ENTRY MAX_PRST_DEV_DB_ENTRIES
-+#define MAX_DEV_DB_ENTRIES 512
-+#define MAX_ISNS_DISCOVERED_TARGETS MAX_DEV_DB_ENTRIES
-+
-+// ISP Maximum number of DSD per command
-+#define DSD_MAX 1024
-+
-+// FW check
-+#define FW_UP(reg,stat) (((stat = RD_REG_DWORD(reg->mailbox[0])) != 0) && (stat != 0x0007))
-+
-+#define INVALID_REGISTER ((UINT32)-1)
-+
-+#define ISP4010_NET_FUNCTION 0
-+#define ISP4010_ISCSI_FUNCTION 1
-+
-+
-+/*************************************************************************
-+ *
-+ * ISP 4010 I/O Register Set Structure and Definitions
-+ *
-+ *************************************************************************/
-+
-+typedef struct _PORT_CTRL_STAT_REGS {
-+ UINT32 ext_hw_conf; // 80 x50 R/W
-+ UINT32 intChipConfiguration; // 84 x54 *
-+ UINT32 port_ctrl; // 88 x58 *
-+ UINT32 port_status; // 92 x5c *
-+ UINT32 HostPrimMACHi; // 96 x60 *
-+ UINT32 HostPrimMACLow; //100 x64 *
-+ UINT32 HostSecMACHi; //104 x68 *
-+ UINT32 HostSecMACLow; //108 x6c *
-+ UINT32 EPPrimMACHi; //112 x70 *
-+ UINT32 EPPrimMACLow; //116 x74 *
-+ UINT32 EPSecMACHi; //120 x78 *
-+ UINT32 EPSecMACLow; //124 x7c *
-+ UINT32 HostPrimIPHi; //128 x80 *
-+ UINT32 HostPrimIPMidHi; //132 x84 *
-+ UINT32 HostPrimIPMidLow; //136 x88 *
-+ UINT32 HostPrimIPLow; //140 x8c *
-+ UINT32 HostSecIPHi; //144 x90 *
-+ UINT32 HostSecIPMidHi; //148 x94 *
-+ UINT32 HostSecIPMidLow; //152 x98 *
-+ UINT32 HostSecIPLow; //156 x9c *
-+ UINT32 EPPrimIPHi; //160 xa0 *
-+ UINT32 EPPrimIPMidHi; //164 xa4 *
-+ UINT32 EPPrimIPMidLow; //168 xa8 *
-+ UINT32 EPPrimIPLow; //172 xac *
-+ UINT32 EPSecIPHi; //176 xb0 *
-+ UINT32 EPSecIPMidHi; //180 xb4 *
-+ UINT32 EPSecIPMidLow; //184 xb8 *
-+ UINT32 EPSecIPLow; //188 xbc *
-+ UINT32 IPReassemblyTimeout; //192 xc0 *
-+ UINT32 EthMaxFramePayload; //196 xc4 *
-+ UINT32 TCPMaxWindowSize; //200 xc8 *
-+ UINT32 TCPCurrentTimestampHi; //204 xcc *
-+ UINT32 TCPCurrentTimestampLow; //208 xd0 *
-+ UINT32 LocalRAMAddress; //212 xd4 *
-+ UINT32 LocalRAMData; //216 xd8 *
-+ UINT32 PCSReserved1; //220 xdc *
-+ UINT32 gp_out; //224 xe0 *
-+ UINT32 gp_in; //228 xe4 *
-+ UINT32 ProbeMuxAddr; //232 xe8 *
-+ UINT32 ProbeMuxData; //236 xec *
-+ UINT32 ERMQueueBaseAddr0; //240 xf0 *
-+ UINT32 ERMQueueBaseAddr1; //244 xf4 *
-+ UINT32 MACConfiguration; //248 xf8 *
-+ UINT32 port_err_status; //252 xfc COR
-+} PORT_CTRL_STAT_REGS, *PPORT_CTRL_STAT_REGS;
-+
-+typedef struct _HOST_MEM_CFG_REGS {
-+ UINT32 NetRequestQueueOut; // 80 x50 *
-+ UINT32 NetRequestQueueOutAddrHi; // 84 x54 *
-+ UINT32 NetRequestQueueOutAddrLow; // 88 x58 *
-+ UINT32 NetRequestQueueBaseAddrHi; // 92 x5c *
-+ UINT32 NetRequestQueueBaseAddrLow; // 96 x60 *
-+ UINT32 NetRequestQueueLength; //100 x64 *
-+ UINT32 NetResponseQueueIn; //104 x68 *
-+ UINT32 NetResponseQueueInAddrHi; //108 x6c *
-+ UINT32 NetResponseQueueInAddrLow; //112 x70 *
-+ UINT32 NetResponseQueueBaseAddrHi; //116 x74 *
-+ UINT32 NetResponseQueueBaseAddrLow; //120 x78 *
-+ UINT32 NetResponseQueueLength; //124 x7c *
-+ UINT32 req_q_out; //128 x80 *
-+ UINT32 RequestQueueOutAddrHi; //132 x84 *
-+ UINT32 RequestQueueOutAddrLow; //136 x88 *
-+ UINT32 RequestQueueBaseAddrHi; //140 x8c *
-+ UINT32 RequestQueueBaseAddrLow; //144 x90 *
-+ UINT32 RequestQueueLength; //148 x94 *
-+ UINT32 ResponseQueueIn; //152 x98 *
-+ UINT32 ResponseQueueInAddrHi; //156 x9c *
-+ UINT32 ResponseQueueInAddrLow; //160 xa0 *
-+ UINT32 ResponseQueueBaseAddrHi; //164 xa4 *
-+ UINT32 ResponseQueueBaseAddrLow; //168 xa8 *
-+ UINT32 ResponseQueueLength; //172 xac *
-+ UINT32 NetRxLargeBufferQueueOut; //176 xb0 *
-+ UINT32 NetRxLargeBufferQueueBaseAddrHi; //180 xb4 *
-+ UINT32 NetRxLargeBufferQueueBaseAddrLow; //184 xb8 *
-+ UINT32 NetRxLargeBufferQueueLength; //188 xbc *
-+ UINT32 NetRxLargeBufferLength; //192 xc0 *
-+ UINT32 NetRxSmallBufferQueueOut; //196 xc4 *
-+ UINT32 NetRxSmallBufferQueueBaseAddrHi; //200 xc8 *
-+ UINT32 NetRxSmallBufferQueueBaseAddrLow; //204 xcc *
-+ UINT32 NetRxSmallBufferQueueLength; //208 xd0 *
-+ UINT32 NetRxSmallBufferLength; //212 xd4 *
-+ UINT32 HMCReserved0[10]; //216 xd8 *
-+} HOST_MEM_CFG_REGS, *PHOST_MEM_CFG_REGS;
-+
-+typedef struct _LOCAL_RAM_CFG_REGS {
-+ UINT32 BufletSize; // 80 x50 *
-+ UINT32 BufletMaxCount; // 84 x54 *
-+ UINT32 BufletCurrCount; // 88 x58 *
-+ UINT32 BufletPauseThresholdCount; // 92 x5c *
-+ UINT32 BufletTCPWinThresholdHi; // 96 x60 *
-+ UINT32 BufletTCPWinThresholdLow; //100 x64 *
-+ UINT32 IPHashTableBaseAddr; //104 x68 *
-+ UINT32 IPHashTableSize; //108 x6c *
-+ UINT32 TCPHashTableBaseAddr; //112 x70 *
-+ UINT32 TCPHashTableSize; //116 x74 *
-+ UINT32 NCBAreaBaseAddr; //120 x78 *
-+ UINT32 NCBMaxCount; //124 x7c *
-+ UINT32 NCBCurrCount; //128 x80 *
-+ UINT32 DRBAreaBaseAddr; //132 x84 *
-+ UINT32 DRBMaxCount; //136 x88 *
-+ UINT32 DRBCurrCount; //140 x8c *
-+ UINT32 LRCReserved[28]; //144 x90 *
-+} LOCAL_RAM_CFG_REGS, *PLOCAL_RAM_CFG_REGS;
-+
-+typedef struct _PROT_STAT_REGS {
-+ UINT32 MACTxFrameCount; // 80 x50 R
-+ UINT32 MACTxByteCount; // 84 x54 R
-+ UINT32 MACRxFrameCount; // 88 x58 R
-+ UINT32 MACRxByteCount; // 92 x5c R
-+ UINT32 MACCRCErrCount; // 96 x60 R
-+ UINT32 MACEncErrCount; //100 x64 R
-+ UINT32 MACRxLengthErrCount; //104 x68 R
-+ UINT32 IPTxPacketCount; //108 x6c R
-+ UINT32 IPTxByteCount; //112 x70 R
-+ UINT32 IPTxFragmentCount; //116 x74 R
-+ UINT32 IPRxPacketCount; //120 x78 R
-+ UINT32 IPRxByteCount; //124 x7c R
-+ UINT32 IPRxFragmentCount; //128 x80 R
-+ UINT32 IPDatagramReassemblyCount; //132 x84 R
-+ UINT32 IPV6RxPacketCount; //136 x88 R
-+ UINT32 IPErrPacketCount; //140 x8c R
-+ UINT32 IPReassemblyErrCount; //144 x90 R
-+ UINT32 TCPTxSegmentCount; //148 x94 R
-+ UINT32 TCPTxByteCount; //152 x98 R
-+ UINT32 TCPRxSegmentCount; //156 x9c R
-+ UINT32 TCPRxByteCount; //160 xa0 R
-+ UINT32 TCPTimerExpCount; //164 xa4 R
-+ UINT32 TCPRxAckCount; //168 xa8 R
-+ UINT32 TCPTxAckCount; //172 xac R
-+ UINT32 TCPRxErrOOOCount; //176 xb0 R
-+ UINT32 PSReserved0; //180 xb4 *
-+ UINT32 TCPRxWindowProbeUpdateCount; //184 xb8 R
-+ UINT32 ECCErrCorrectionCount; //188 xbc R
-+ UINT32 PSReserved1[16]; //192 xc0 *
-+} PROT_STAT_REGS, *PPROT_STAT_REGS;
-+
-+#define MBOX_REG_COUNT 8
-+
-+// remote register set (access via PCI memory read/write)
-+typedef struct isp_reg_t {
-+ uint32_t mailbox[MBOX_REG_COUNT];
-+
-+ uint32_t flash_address; /* 0x20 */
-+ uint32_t flash_data;
-+ uint32_t ctrl_status;
-+
-+ union {
-+ struct {
-+ uint32_t nvram;
-+ uint32_t reserved1[2]; /* 0x30 */
-+ } __attribute__((packed)) isp4010;
-+ struct {
-+ uint32_t intr_mask;
-+ uint32_t nvram; /* 0x30 */
-+ uint32_t semaphore;
-+ } __attribute__((packed)) isp4022;
-+ } u1;
-+
-+
-+ uint32_t req_q_in; /* SCSI Request Queue Producer Index */
-+ uint32_t rsp_q_out; /* SCSI Completion Queue Consumer Index */
-+
-+ uint32_t reserved2[4]; /* 0x40 */
-+
-+ union {
-+ struct {
-+ uint32_t ext_hw_conf; /* 0x50 */
-+ uint32_t flow_ctrl;
-+ uint32_t port_ctrl;
-+ uint32_t port_status;
-+
-+ uint32_t reserved3[8]; /* 0x60 */
-+
-+ uint32_t req_q_out; /* 0x80 */
-+
-+ uint32_t reserved4[23]; /* 0x84 */
-+
-+ uint32_t gp_out; /* 0xe0 */
-+ uint32_t gp_in;
-+
-+ uint32_t reserved5[5];
-+
-+ uint32_t port_err_status; /* 0xfc */
-+ } __attribute__((packed)) isp4010;
-+ struct {
-+ union {
-+ PORT_CTRL_STAT_REGS p0;
-+ HOST_MEM_CFG_REGS p1;
-+ LOCAL_RAM_CFG_REGS p2;
-+ PROT_STAT_REGS p3;
-+ uint32_t r_union[44];
-+ };
-+
-+ } __attribute__((packed)) isp4022;
-+ } u2;
-+} isp_reg_t; //256 x100
-+
-+#define ISP_NVRAM(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u1.isp4022.nvram : \
-+ &ha->reg->u1.isp4010.nvram)
-+
-+#define ISP_EXT_HW_CONF(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p0.ext_hw_conf : \
-+ &ha->reg->u2.isp4010.ext_hw_conf)
-+
-+#define ISP_PORT_STATUS(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p0.port_status : \
-+ &ha->reg->u2.isp4010.port_status)
-+
-+#define ISP_REQ_Q_OUT(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p1.req_q_out : \
-+ &ha->reg->u2.isp4010.req_q_out)
-+
-+#define ISP_PORT_ERROR_STATUS(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p0.port_err_status : \
-+ &ha->reg->u2.isp4010.port_err_status)
-+
-+#define ISP_GP_OUT(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p0.gp_out : \
-+ &ha->reg->u2.isp4010.gp_out)
-+
-+#define ISP_GP_IN(ha) \
-+ (IS_QLA4022(ha) ? \
-+ &ha->reg->u2.isp4022.p0.gp_in : \
-+ &ha->reg->u2.isp4010.gp_in)
-+
-+/* Page # defines for 4022 */
-+#define PORT_CTRL_STAT_PAGE 0 /* 4022 */
-+#define HOST_MEM_CFG_PAGE 1 /* 4022 */
-+#define LOCAL_RAM_CFG_PAGE 2 /* 4022 */
-+#define PROT_STAT_PAGE 3 /* 4022 */
-+
-+/* Register Mask - sets corresponding mask bits in the upper word */
-+#define SET_RMASK(val) ((val & 0xffff) | (val << 16))
-+#define CLR_RMASK(val) (0 | (val << 16))
-+
-+// ctrl_status definitions
-+#define CSR_SCSI_PAGE_SELECT 0x00000003
-+#define CSR_SCSI_INTR_ENABLE 0x00000004 /* 4010 */
-+#define CSR_SCSI_RESET_INTR 0x00000008
-+#define CSR_SCSI_COMPLETION_INTR 0x00000010
-+#define CSR_SCSI_PROCESSOR_INTR 0x00000020
-+#define CSR_INTR_RISC 0x00000040
-+#define CSR_BOOT_ENABLE 0x00000080
-+#define CSR_NET_PAGE_SELECT 0x00000300 /* 4010 */
-+#define CSR_NET_INTR_ENABLE 0x00000400 /* 4010 */
-+#define CSR_FUNC_NUM 0x00000700 /* 4022 */
-+#define CSR_PCI_FUNC_NUM_MASK 0x00000300 /* 4022 */
-+#define CSR_NET_RESET_INTR 0x00000800 /* 4010 */
-+#define CSR_NET_COMPLETION_INTR 0x00001000 /* 4010 */
-+#define CSR_FORCE_SOFT_RESET 0x00002000 /* 4022 */
-+#define CSR_FATAL_ERROR 0x00004000
-+#define CSR_SOFT_RESET 0x00008000
-+
-+#define INTR_PENDING (CSR_SCSI_COMPLETION_INTR | CSR_SCSI_PROCESSOR_INTR | CSR_SCSI_RESET_INTR)
-+
-+/* ISP InterruptMask definitions */
-+#define IMR_SCSI_INTR_ENABLE 0x00000004 /* 4022 */
-+
-+/* ISP 4022 nvram definitions */
-+#define NVR_WRITE_ENABLE 0x00000010 /* 4022 */
-+
-+// ISP port_ctrl definitions
-+#define PCR_CONFIG_COMPLETE 0x00008000 /* 4022 */
-+#define PCR_BIOS_BOOTED_FIRMWARE 0x00008000 /* 4010 */
-+#define PCR_ENABLE_SERIAL_DATA 0x00001000 /* 4010 */
-+#define PCR_SERIAL_DATA_OUT 0x00000800 /* 4010 */
-+#define PCR_ENABLE_SERIAL_CLOCK 0x00000400 /* 4010 */
-+#define PCR_SERIAL_CLOCK 0x00000200 /* 4010 */
-+
-+// ISP port_status definitions
-+#define PSR_CONFIG_COMPLETE 0x00000001 /* 4010 */
-+#define PSR_INIT_COMPLETE 0x00000200
-+
-+// ISP Semaphore definitions
-+#define SR_FIRWMARE_BOOTED 0x00000001
-+
-+// ISP General Purpose Output definitions
-+#define GPOR_TOPCAT_RESET 0x00000004
-+
-+// shadow registers (DMA'd from HA to system memory. read only)
-+typedef struct {
-+ /* SCSI Request Queue Consumer Index */
-+ UINT32 req_q_out; // 0 x0 R
-+
-+ /* SCSI Completion Queue Producer Index */
-+ UINT32 rsp_q_in; // 4 x4 R
-+} shadow_regs_t; // 8 x8
-+
-+#define EHWC_PROT_METHOD_NONE 0
-+#define EHWC_PROT_METHOD_BYTE_PARITY 1
-+#define EHWC_PROT_METHOD_ECC 2
-+#define EHWC_SDRAM_BANKS_1 0
-+#define EHWC_SDRAM_BANKS_2 1
-+#define EHWC_SDRAM_WIDTH_8_BIT 0
-+#define EHWC_SDRAM_WIDTH_16_BIT 1
-+#define EHWC_SDRAM_CHIP_SIZE_64MB 0
-+#define EHWC_SDRAM_CHIP_SIZE_128MB 1
-+#define EHWC_SDRAM_CHIP_SIZE_256MB 2
-+#define EHWC_MEM_TYPE_SYNC_FLOWTHROUGH 0
-+#define EHWC_MEM_TYPE_SYNC_PIPELINE 1
-+#define EHWC_WRITE_BURST_512 0
-+#define EHWC_WRITE_BURST_1024 1
-+#define EHWC_WRITE_BURST_2048 2
-+#define EHWC_WRITE_BURST_4096 3
-+
-+// External hardware configuration register
-+typedef union _EXTERNAL_HW_CONFIG_REG {
-+ struct {
-+ UINT32 bReserved0 :1;
-+ UINT32 bSDRAMProtectionMethod :2;
-+ UINT32 bSDRAMBanks :1;
-+ UINT32 bSDRAMChipWidth :1;
-+ UINT32 bSDRAMChipSize :2;
-+ UINT32 bParityDisable :1;
-+ UINT32 bExternalMemoryType :1;
-+ UINT32 bFlashBIOSWriteEnable :1;
-+ UINT32 bFlashUpperBankSelect :1;
-+ UINT32 bWriteBurst :2;
-+ UINT32 bReserved1 :3;
-+ UINT32 bMask :16;
-+ };
-+ UINT32 AsUINT32;
-+} EXTERNAL_HW_CONFIG_REG, *PEXTERNAL_HW_CONFIG_REG;
-+
-+/*************************************************************************
-+ *
-+ * Mailbox Commands Structures and Definitions
-+ *
-+ *************************************************************************/
-+
-+// Mailbox command definitions
-+#define MBOX_CMD_LOAD_RISC_RAM_EXT 0x0001
-+#define MBOX_CMD_EXECUTE_FW 0x0002
-+#define MBOX_CMD_DUMP_RISC_RAM_EXT 0x0003
-+#define MBOX_CMD_WRITE_RISC_RAM_EXT 0x0004
-+#define MBOX_CMD_READ_RISC_RAM_EXT 0x0005
-+#define MBOX_CMD_REGISTER_TEST 0x0006
-+#define MBOX_CMD_VERIFY_CHECKSUM 0x0007
-+#define MBOX_CMD_ABOUT_FW 0x0009
-+#define MBOX_CMD_LOOPBACK_DIAG 0x000A
-+#define MBOX_CMD_PING 0x000B
-+#define MBOX_CMD_CHECKSUM_FW 0x000E
-+#define MBOX_CMD_RESET_FW 0x0014
-+#define MBOX_CMD_ABORT_TASK 0x0015
-+#define MBOX_CMD_LUN_RESET 0x0016
-+#define MBOX_CMD_TARGET_WARM_RESET 0x0017
-+#define MBOX_CMD_TARGET_COLD_RESET 0x0018
-+#define MBOX_CMD_ABORT_QUEUE 0x001C
-+#define MBOX_CMD_GET_QUEUE_STATUS 0x001D
-+#define MBOX_CMD_GET_MANAGEMENT_DATA 0x001E
-+#define MBOX_CMD_GET_FW_STATUS 0x001F
-+#define MBOX_CMD_SET_ISNS_SERVICE 0x0021
-+ #define ISNS_DISABLE 0
-+ #define ISNS_ENABLE 1
-+ #define ISNS_STATUS 2
-+#define MBOX_CMD_COPY_FLASH 0x0024
-+ #define COPY_FLASH_OPTION_PRIM_TO_SEC 0
-+ #define COPY_FLASH_OPTION_SEC_TO_PRIM 1
-+#define MBOX_CMD_WRITE_FLASH 0x0025
-+ #define WRITE_FLASH_OPTION_HOLD_DATA 0
-+ #define WRITE_FLASH_OPTION_COMMIT_DATA 2
-+ #define WRITE_FLASH_OPTION_FLASH_DATA 3
-+#define MBOX_CMD_READ_FLASH 0x0026
-+#define MBOX_CMD_GET_QUEUE_PARAMS 0x0029
-+#define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031
-+#define MBOX_CMD_SET_QUEUE_PARAMS 0x0039
-+#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056
-+ #define LOGOUT_OPTION_CLOSE_SESSION 0x01
-+ #define LOGOUT_OPTION_RELOGIN 0x02
-+#define MBOX_CMD_EXECUTE_IOCB_A64 0x005A
-+#define MBOX_CMD_INITIALIZE_FIRMWARE 0x0060
-+#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK 0x0061
-+#define MBOX_CMD_REQUEST_DATABASE_ENTRY 0x0062
-+#define MBOX_CMD_SET_DATABASE_ENTRY 0x0063
-+#define MBOX_CMD_GET_DATABASE_ENTRY 0x0064
-+ #define DDB_DS_UNASSIGNED 0x00
-+ #define DDB_DS_NO_CONNECTION_ACTIVE 0x01
-+ #define DDB_DS_DISCOVERY 0x02
-+ #define DDB_DS_NO_SESSION_ACTIVE 0x03
-+ #define DDB_DS_SESSION_ACTIVE 0x04
-+ #define DDB_DS_LOGGING_OUT 0x05
-+ #define DDB_DS_SESSION_FAILED 0x06
-+ #define DDB_DS_LOGIN_IN_PROCESS 0x07
-+ #define DELETEABLE_DDB_DS(ds) ((ds == DDB_DS_UNASSIGNED) || \
-+ (ds == DDB_DS_NO_CONNECTION_ACTIVE) || \
-+ (ds == DDB_DS_SESSION_FAILED))
-+#define MBOX_CMD_CLEAR_ACA 0x0065
-+#define MBOX_CMD_CLEAR_TASK_SET 0x0067
-+#define MBOX_CMD_ABORT_TASK_SET 0x0068
-+#define MBOX_CMD_GET_FW_STATE 0x0069
-+
-+/* Mailbox 1 */
-+ #define FW_STATE_READY 0x0000
-+ #define FW_STATE_CONFIG_WAIT 0x0001
-+ #define FW_STATE_WAIT_LOGIN 0x0002
-+ #define FW_STATE_ERROR 0x0004
-+ #define FW_STATE_DHCP_IN_PROGRESS 0x0008
-+ #define FW_STATE_ISNS_IN_PROGRESS 0x0010
-+ #define FW_STATE_TOPCAT_INIT_IN_PROGRESS 0x0040
-+
-+/* Mailbox 3 */
-+ #define FW_ADDSTATE_COPPER_MEDIA 0x0000
-+ #define FW_ADDSTATE_OPTICAL_MEDIA 0x0001
-+ #define FW_ADDSTATE_DHCP_ENABLED 0x0002
-+ #define FW_ADDSTATE_DHCP_LEASE_ACQUIRED 0x0004
-+ #define FW_ADDSTATE_DHCP_LEASE_EXPIRED 0x0008
-+ #define FW_ADDSTATE_LINK_UP 0x0010
-+ #define FW_ADDSTATE_ISNS_SVC_ENABLED 0x0020
-+ #define FW_ADDSTATE_TOPCAT_NOT_INITIALIZED 0x0040
-+#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS 0x006A
-+#define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS 0x006B
-+#define MBOX_CMD_CONN_OPEN_SESS_LOGIN 0x0074
-+#define MBOX_CMD_DIAGNOSTICS_TEST_RESULTS 0x0075 /* 4010 only */
-+ #define DIAG_TEST_LOCAL_RAM_SIZE 0x0002
-+ #define DIAG_TEST_LOCAL_RAM_READ_WRITE 0x0003
-+ #define DIAG_TEST_RISC_RAM 0x0004
-+ #define DIAG_TEST_NVRAM 0x0005
-+ #define DIAG_TEST_FLASH_ROM 0x0006
-+ #define DIAG_TEST_NW_INT_LOOPBACK 0x0007
-+ #define DIAG_TEST_NW_EXT_LOOPBACK 0x0008
-+#define MBOX_CMD_GET_CRASH_RECORD 0x0076 /* 4010 only */
-+#define MBOX_CMD_NOP 0x00FF
-+
-+// Mailbox status definitions
-+#define MBOX_COMPLETION_STATUS 4
-+#define MBOX_STS_BUSY 0x0007
-+#define MBOX_STS_INTERMEDIATE_COMPLETION 0x1000
-+#define MBOX_STS_COMMAND_COMPLETE 0x4000
-+#define MBOX_STS_INVALID_COMMAND 0x4001
-+#define MBOX_STS_HOST_INTERFACE_ERROR 0x4002
-+#define MBOX_STS_TEST_FAILED 0x4003
-+#define MBOX_STS_COMMAND_ERROR 0x4005
-+#define MBOX_STS_COMMAND_PARAMETER_ERROR 0x4006
-+#define MBOX_STS_TARGET_MODE_INIT_FAIL 0x4007
-+#define MBOX_STS_INITIATOR_MODE_INIT_FAIL 0x4008
-+
-+#define MBOX_ASYNC_EVENT_STATUS 8
-+#define MBOX_ASTS_SYSTEM_ERROR 0x8002
-+#define MBOX_ASTS_REQUEST_TRANSFER_ERROR 0x8003
-+#define MBOX_ASTS_RESPONSE_TRANSFER_ERROR 0x8004
-+#define MBOX_ASTS_PROTOCOL_STATISTIC_ALARM 0x8005
-+#define MBOX_ASTS_SCSI_COMMAND_PDU_REJECTED 0x8006
-+#define MBOX_ASTS_LINK_UP 0x8010
-+#define MBOX_ASTS_LINK_DOWN 0x8011
-+#define MBOX_ASTS_DATABASE_CHANGED 0x8014
-+#define MBOX_ASTS_UNSOLICITED_PDU_RECEIVED 0x8015
-+#define MBOX_ASTS_SELF_TEST_FAILED 0x8016
-+#define MBOX_ASTS_LOGIN_FAILED 0x8017
-+#define MBOX_ASTS_DNS 0x8018
-+#define MBOX_ASTS_HEARTBEAT 0x8019
-+#define MBOX_ASTS_NVRAM_INVALID 0x801A
-+#define MBOX_ASTS_MAC_ADDRESS_CHANGED 0x801B
-+#define MBOX_ASTS_IP_ADDRESS_CHANGED 0x801C
-+#define MBOX_ASTS_DHCP_LEASE_EXPIRED 0x801D
-+#define MBOX_ASTS_DHCP_LEASE_ACQUIRED 0x801F
-+#define MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED 0x8021
-+ #define ISNS_EVENT_DATA_RECEIVED 0x0000
-+ #define ISNS_EVENT_CONNECTION_OPENED 0x0001
-+ #define ISNS_EVENT_CONNECTION_FAILED 0x0002
-+#define MBOX_ASTS_IPSEC_SYSTEM_FATAL_ERROR 0x8022
-+
-+
-+/*************************************************************************/
-+
-+/* Host Adapter Initialization Control Block (from host) */
-+typedef struct _INIT_FW_CTRL_BLK {
-+ UINT8 Version; /* 00 */
-+ UINT8 Control; /* 01 */
-+
-+ UINT16 FwOptions; /* 02-03 */
-+ #define FWOPT_HEARTBEAT_ENABLE 0x1000
-+ #define FWOPT_MARKER_DISABLE 0x0400
-+ #define FWOPT_PROTOCOL_STAT_ALARM_ENABLE 0x0200
-+ #define FWOPT_TARGET_ACCEPT_AEN_ENABLE 0x0100
-+ #define FWOPT_ACCESS_CONTROL_ENABLE 0x0080
-+ #define FWOPT_SESSION_MODE 0x0040
-+ #define FWOPT_INITIATOR_MODE 0x0020
-+ #define FWOPT_TARGET_MODE 0x0010
-+ #define FWOPT_FAST_POSTING 0x0008
-+ #define FWOPT_AUTO_TARGET_INFO_DISABLE 0x0004
-+ #define FWOPT_SENSE_BUFFER_DATA_ENABLE 0x0002
-+
-+ UINT16 ExecThrottle; /* 04-05 */
-+ UINT8 RetryCount; /* 06 */
-+ UINT8 RetryDelay; /* 07 */
-+ UINT16 MaxEthFrPayloadSize; /* 08-09 */
-+ UINT16 AddFwOptions; /* 0A-0B */
-+ #define ADDFWOPT_AUTOCONNECT_DISABLE 0x0002
-+ #define ADDFWOPT_SUSPEND_ON_FW_ERROR 0x0001
-+
-+ UINT8 HeartbeatInterval; /* 0C */
-+ UINT8 InstanceNumber; /* 0D */
-+ UINT16 RES2; /* 0E-0F */
-+ UINT16 ReqQConsumerIndex; /* 10-11 */
-+ UINT16 ComplQProducerIndex; /* 12-13 */
-+ UINT16 ReqQLen; /* 14-15 */
-+ UINT16 ComplQLen; /* 16-17 */
-+ UINT32 ReqQAddrLo; /* 18-1B */
-+ UINT32 ReqQAddrHi; /* 1C-1F */
-+ UINT32 ComplQAddrLo; /* 20-23 */
-+ UINT32 ComplQAddrHi; /* 24-27 */
-+ UINT32 ShadowRegBufAddrLo; /* 28-2B */
-+ UINT32 ShadowRegBufAddrHi; /* 2C-2F */
-+
-+ UINT16 iSCSIOptions; /* 30-31 */
-+ #define IOPT_RCV_ISCSI_MARKER_ENABLE 0x8000
-+ #define IOPT_SEND_ISCSI_MARKER_ENABLE 0x4000
-+ #define IOPT_HEADER_DIGEST_ENABLE 0x2000
-+ #define IOPT_DATA_DIGEST_ENABLE 0x1000
-+ #define IOPT_IMMEDIATE_DATA_ENABLE 0x0800
-+ #define IOPT_INITIAL_R2T_ENABLE 0x0400
-+ #define IOPT_DATA_SEQ_IN_ORDER 0x0200
-+ #define IOPT_DATA_PDU_IN_ORDER 0x0100
-+ #define IOPT_CHAP_AUTH_ENABLE 0x0080
-+ #define IOPT_SNACK_REQ_ENABLE 0x0040
-+ #define IOPT_DISCOVERY_LOGOUT_ENABLE 0x0020
-+ #define IOPT_BIDIR_CHAP_ENABLE 0x0010
-+
-+ UINT16 TCPOptions; /* 32-33 */
-+ #define TOPT_ISNS_ENABLE 0x4000
-+ #define TOPT_SLP_USE_DA_ENABLE 0x2000
-+ #define TOPT_AUTO_DISCOVERY_ENABLE 0x1000
-+ #define TOPT_SLP_UA_ENABLE 0x0800
-+ #define TOPT_SLP_SA_ENABLE 0x0400
-+ #define TOPT_DHCP_ENABLE 0x0200
-+ #define TOPT_GET_DNS_VIA_DHCP_ENABLE 0x0100
-+ #define TOPT_GET_SLP_VIA_DHCP_ENABLE 0x0080
-+ #define TOPT_LEARN_ISNS_IP_ADDR_ENABLE 0x0040
-+ #define TOPT_NAGLE_DISABLE 0x0020
-+ #define TOPT_TIMER_SCALE_MASK 0x000E
-+ #define TOPT_TIME_STAMP_ENABLE 0x0001
-+
-+ UINT16 IPOptions; /* 34-35 */
-+ #define IPOPT_FRAG_DISABLE 0x0010
-+ #define IPOPT_PAUSE_FRAME_ENABLE 0x0002
-+ #define IPOPT_IP_ADDRESS_VALID 0x0001
-+
-+ UINT16 MaxPDUSize; /* 36-37 */
-+ UINT16 RcvMarkerInt; /* 38-39 */
-+ UINT16 SndMarkerInt; /* 3A-3B */
-+ UINT16 InitMarkerlessInt; /* 3C-3D */ //FIXME: Reserved in spec, but IOCTL struct uses it
-+ UINT16 FirstBurstSize; /* 3E-3F */
-+ UINT16 DefaultTime2Wait; /* 40-41 */
-+ UINT16 DefaultTime2Retain; /* 42-43 */
-+ UINT16 MaxOutStndngR2T; /* 44-45 */
-+ UINT16 KeepAliveTimeout; /* 46-47 */
-+ UINT16 PortNumber; /* 48-49 */
-+ UINT16 MaxBurstSize; /* 4A-4B */
-+ UINT32 RES4; /* 4C-4F */
-+ UINT8 IPAddr[4]; /* 50-53 */
-+ UINT8 RES5[12]; /* 54-5F */
-+ UINT8 SubnetMask[4]; /* 60-63 */
-+ UINT8 RES6[12]; /* 64-6F */
-+ UINT8 GatewayIPAddr[4]; /* 70-73 */
-+ UINT8 RES7[12]; /* 74-7F */
-+ UINT8 PriDNSIPAddr[4]; /* 80-83 */
-+ UINT8 SecDNSIPAddr[4]; /* 84-87 */
-+ UINT8 RES8[8]; /* 88-8F */
-+ UINT8 Alias[32]; /* 90-AF */
-+ UINT8 TargAddr[8]; /* B0-B7 */ //FIXME: Remove??
-+ UINT8 CHAPNameSecretsTable[8]; /* B8-BF */
-+ UINT8 EthernetMACAddr[6]; /* C0-C5 */
-+ UINT16 TargetPortalGroup; /* C6-C7 */
-+ UINT8 SendScale; /* C8 */
-+ UINT8 RecvScale; /* C9 */
-+ UINT8 TypeOfService; /* CA */
-+ UINT8 Time2Live; /* CB */
-+ UINT16 VLANPriority; /* CC-CD */
-+ UINT16 Reserved8; /* CE-CF */
-+ UINT8 SecIPAddr[4]; /* D0-D3 */
-+ UINT8 Reserved9[12]; /* D4-DF */
-+ UINT8 iSNSIPAddr[4]; /* E0-E3 */
-+ UINT16 iSNSServerPortNumber; /* E4-E5 */
-+ UINT8 Reserved10[10]; /* E6-EF */
-+ UINT8 SLPDAIPAddr[4]; /* F0-F3 */
-+ UINT8 Reserved11[12]; /* F4-FF */
-+ UINT8 iSCSINameString[256]; /* 100-1FF */
-+} INIT_FW_CTRL_BLK;
-+
-+typedef struct {
-+ INIT_FW_CTRL_BLK init_fw_cb;
-+ UINT32 Cookie;
-+ #define INIT_FW_CTRL_BLK_COOKIE 0x11BEAD5A
-+} FLASH_INIT_FW_CTRL_BLK;
-+
-+/*************************************************************************/
-+
-+typedef struct _DEV_DB_ENTRY {
-+ UINT8 options; /* 00 */
-+ #define DDB_OPT_DISABLE 0x08 /* do not connect to device */
-+ #define DDB_OPT_ACCESSGRANTED 0x04
-+ #define DDB_OPT_TARGET 0x02 /* device is a target */
-+ #define DDB_OPT_INITIATOR 0x01 /* device is an initiator */
-+
-+ UINT8 control; /* 01 */
-+ #define DDB_CTRL_DATABASE_ENTRY_STATE 0xC0
-+ #define DDB_CTRL_SESSION_RECOVERY 0x10
-+ #define DDB_CTRL_SENDING 0x08
-+ #define DDB_CTRL_XFR_PENDING 0x04
-+ #define DDB_CTRL_QUEUE_ABORTED 0x02
-+ #define DDB_CTRL_LOGGED_IN 0x01
-+
-+ UINT16 exeThrottle; /* 02-03 */
-+ UINT16 exeCount; /* 04-05 */
-+ UINT8 retryCount; /* 06 */
-+ UINT8 retryDelay; /* 07 */
-+ UINT16 iSCSIOptions; /* 08-09 */
-+ #define DDB_IOPT_RECV_ISCSI_MARKER_ENABLE 0x8000
-+ #define DDB_IOPT_SEND_ISCSI_MARKER_ENABLE 0x4000
-+ #define DDB_IOPT_HEADER_DIGEST_ENABLE 0x2000
-+ #define DDB_IOPT_DATA_DIGEST_ENABLE 0x1000
-+ #define DDB_IOPT_IMMEDIATE_DATA_ENABLE 0x0800
-+ #define DDB_IOPT_INITIAL_R2T_ENABLE 0x0400
-+ #define DDB_IOPT_DATA_SEQUENCE_IN_ORDER 0x0200
-+ #define DDB_IOPT_DATA_PDU_IN_ORDER 0x0100
-+ #define DDB_IOPT_CHAP_AUTH_ENABLE 0x0080
-+ #define DDB_IOPT_BIDIR_CHAP_CHAL_ENABLE 0x0010
-+ #define DDB_IOPT_RESERVED2 0x007F
-+
-+ UINT16 TCPOptions; /* 0A-0B */
-+ #define DDB_TOPT_NAGLE_DISABLE 0x0020
-+ #define DDB_TOPT_TIMER_SCALE_MASK 0x000E
-+ #define DDB_TOPT_TIME_STAMP_ENABLE 0x0001
-+
-+ UINT16 IPOptions; /* 0C-0D */
-+ #define DDB_IPOPT_FRAG_DISABLE 0x0002
-+ #define DDB_IPOPT_IP_ADDRESS_VALID 0x0001
-+
-+ UINT16 maxPDUSize; /* 0E-0F */
-+ UINT16 rcvMarkerInt; /* 10-11 */
-+ UINT16 sndMarkerInt; /* 12-13 */
-+ UINT16 iSCSIMaxSndDataSegLen; /* 14-15 */
-+ UINT16 firstBurstSize; /* 16-17 */
-+ UINT16 minTime2Wait; /* 18-19 */
-+ UINT16 maxTime2Retain; /* 1A-1B */
-+ UINT16 maxOutstndngR2T; /* 1C-1D */
-+ UINT16 keepAliveTimeout; /* 1E-1F */
-+ UINT8 ISID[6]; /* 20-25 big-endian, must be converted to little-endian */
-+ UINT16 TSID; /* 26-27 */
-+ UINT16 portNumber; /* 28-29 */
-+ UINT16 maxBurstSize; /* 2A-2B */
-+ UINT16 taskMngmntTimeout; /* 2C-2D */
-+ UINT16 reserved1; /* 2E-2F */
-+ UINT8 ipAddr[0x10]; /* 30-3F */
-+ UINT8 iSCSIAlias[0x20]; /* 40-5F */
-+ UINT8 targetAddr[0x20]; /* 60-7F */
-+ UINT8 userID[0x20]; /* 80-9F */
-+ UINT8 password[0x20]; /* A0-BF */
-+ UINT8 iscsiName[0x100]; /* C0-1BF : xxzzy Make this a pointer to a string so we don't
-+ have to reserve soooo much RAM */
-+ UINT16 ddbLink; /* 1C0-1C1 */
-+ UINT16 CHAPTableIndex; /* 1C2-1C3 */
-+ UINT16 TargetPortalGroup; /* 1C4-1C5 */
-+ UINT16 reserved2[2]; /* 1C6-1C7 */
-+ UINT32 statSN; /* 1C8-1CB */
-+ UINT32 expStatSN; /* 1CC-1CF */
-+ UINT16 reserved3[0x2C]; /* 1D0-1FB */
-+ UINT16 ddbValidCookie; /* 1FC-1FD */
-+ UINT16 ddbValidSize; /* 1FE-1FF */
-+} DEV_DB_ENTRY;
-+
-+
-+/*************************************************************************/
-+
-+// Flash definitions
-+#define FLASH_FW_IMG_PAGE_SIZE 0x20000
-+#define FLASH_FW_IMG_PAGE(addr) (0xfffe0000 & (addr))
-+#define FLASH_STRUCTURE_TYPE_MASK 0x0f000000
-+
-+#define FLASH_OFFSET_FW_LOADER_IMG 0x00000000
-+#define FLASH_OFFSET_SECONDARY_FW_IMG 0x01000000
-+#define FLASH_OFFSET_SYS_INFO 0x02000000
-+#define FLASH_OFFSET_DRIVER_BLK 0x03000000
-+#define FLASH_OFFSET_INIT_FW_CTRL_BLK 0x04000000
-+#define FLASH_OFFSET_DEV_DB_AREA 0x05000000
-+#define FLASH_OFFSET_CHAP_AREA 0x06000000
-+#define FLASH_OFFSET_PRIMARY_FW_IMG 0x07000000
-+#define FLASH_READ_RAM_FLAG 0x10000000
-+
-+#define MAX_FLASH_SZ 0x400000 /* 4M flash */
-+#define FLASH_DEFAULTBLOCKSIZE 0x20000
-+#define FLASH_EOF_OFFSET FLASH_DEFAULTBLOCKSIZE - 8 /* 4 bytes for EOF signature */
-+#define FLASH_FILESIZE_OFFSET FLASH_EOF_OFFSET - 4 /* 4 bytes for file size */
-+#define FLASH_CKSUM_OFFSET FLASH_FILESIZE_OFFSET - 4 /* 4 bytes for chksum protection */
-+
-+typedef struct _SYS_INFO_PHYS_ADDR {
-+ UINT8 address[6]; /* 00-05 */
-+ UINT8 filler[2]; /* 06-07 */
-+} SYS_INFO_PHYS_ADDR;
-+
-+typedef struct _FLASH_SYS_INFO {
-+ UINT32 cookie; /* 00-03 */
-+ UINT32 physAddrCount; /* 04-07 */
-+ SYS_INFO_PHYS_ADDR physAddr[4]; /* 08-27 */
-+ UINT8 vendorId[128]; /* 28-A7 */
-+ UINT8 productId[128]; /* A8-127 */
-+ UINT32 serialNumber; /* 128-12B */
-+
-+ // PCI Configuration values
-+ UINT32 pciDeviceVendor; /* 12C-12F */
-+ UINT32 pciDeviceId; /* 130-133 */
-+ UINT32 pciSubsysVendor; /* 134-137 */
-+ UINT32 pciSubsysId; /* 138-13B */
-+
-+ // This validates version 1.
-+ UINT32 crumbs; /* 13C-13F */
-+
-+ UINT32 enterpriseNumber; /* 140-143 */
-+
-+ UINT32 mtu; /* 144-147 */
-+ UINT32 reserved0; /* 148-14b */
-+ UINT32 crumbs2; /* 14c-14f */
-+ UINT8 acSerialNumber[16]; /* 150-15f */
-+ UINT32 crumbs3; /* 160-16f */
-+
-+ // Leave this last in the struct so it is declared invalid if
-+ // any new items are added.
-+ UINT32 reserved1[39]; /* 170-1ff */
-+} FLASH_SYS_INFO, *PFLASH_SYS_INFO; /* 200 */
-+
-+typedef struct _FLASH_DRIVER_INFO {
-+ UINT32 LinuxDriverCookie;
-+ #define FLASH_LINUX_DRIVER_COOKIE 0x0A1B2C3D
-+ UINT8 Pad[4];
-+
-+} FLASH_DRIVER_INFO, *PFLASH_DRIVER_INFO;
-+
-+typedef struct _CHAP_ENTRY {
-+ UINT16 link; // 0 x0
-+ #define CHAP_FLAG_PEER_NAME 0x40
-+ #define CHAP_FLAG_LOCAL_NAME 0x80
-+
-+ UINT8 flags; // 2 x2
-+ #define MIN_CHAP_SECRET_LENGTH 12
-+ #define MAX_CHAP_SECRET_LENGTH 100
-+
-+ UINT8 secretLength; // 3 x3
-+ UINT8 secret[MAX_CHAP_SECRET_LENGTH]; // 4 x4
-+ #define MAX_CHAP_CHALLENGE_LENGTH 256
-+
-+ UINT8 user_name[MAX_CHAP_CHALLENGE_LENGTH]; //104 x68
-+ UINT16 reserved; //360 x168
-+ #define CHAP_COOKIE 0x4092
-+
-+ UINT16 cookie; //362 x16a
-+} CHAP_ENTRY, *PCHAP_ENTRY; //364 x16c
-+
-+
-+/*************************************************************************/
-+
-+typedef struct _CRASH_RECORD {
-+ UINT16 fw_major_version; /* 00 - 01 */
-+ UINT16 fw_minor_version; /* 02 - 03 */
-+ UINT16 fw_patch_version; /* 04 - 05 */
-+ UINT16 fw_build_version; /* 06 - 07 */
-+
-+ UINT8 build_date[16]; /* 08 - 17 */
-+ UINT8 build_time[16]; /* 18 - 27 */
-+ UINT8 build_user[16]; /* 28 - 37 */
-+ UINT8 card_serial_num[16]; /* 38 - 47 */
-+
-+ UINT32 time_of_crash_in_secs; /* 48 - 4B */
-+ UINT32 time_of_crash_in_ms; /* 4C - 4F */
-+
-+ UINT16 out_RISC_sd_num_frames; /* 50 - 51 */
-+ UINT16 OAP_sd_num_words; /* 52 - 53 */
-+ UINT16 IAP_sd_num_frames; /* 54 - 55 */
-+ UINT16 in_RISC_sd_num_words; /* 56 - 57 */
-+
-+ UINT8 reserved1[28]; /* 58 - 7F */
-+
-+ UINT8 out_RISC_reg_dump[256]; /* 80 -17F */
-+ UINT8 in_RISC_reg_dump[256]; /*180 -27F */
-+ UINT8 in_out_RISC_stack_dump[0]; /*280 - ??? */
-+} CRASH_RECORD, *PCRASH_RECORD;
-+
-+
-+
-+/*************************************************************************
-+ *
-+ * IOCB Commands Structures and Definitions
-+ *
-+ *************************************************************************/
-+#define IOCB_MAX_CDB_LEN 16 /* Bytes in a CBD */
-+#define IOCB_MAX_SENSEDATA_LEN 32 /* Bytes of sense data */
-+#define IOCB_MAX_EXT_SENSEDATA_LEN 60 /* Bytes of extended sense data */
-+#define IOCB_MAX_DSD_CNT 1 /* DSDs per noncontinuation type IOCB */
-+#define IOCB_CONT_MAX_DSD_CNT 5 /* DSDs per Continuation */
-+#define CTIO_MAX_SENSEDATA_LEN 24 /* Bytes of sense data in a CTIO*/
-+
-+#define RESERVED_BYTES_MARKER 40 /* Reserved Bytes at end of Marker */
-+#define RESERVED_BYTES_INOT 28 /* Reserved Bytes at end of Immediate Notify */
-+#define RESERVED_BYTES_NOTACK 28 /* Reserved Bytes at end of Notify Acknowledge */
-+#define RESERVED_BYTES_CTIO 2 /* Reserved Bytes in middle of CTIO */
-+
-+#define MAX_MBX_COUNT 14 /* Maximum number of mailboxes in MBX IOCB */
-+
-+#define ISCSI_MAX_NAME_BYTECNT 256 /* Bytes in a target name */
-+
-+#define IOCB_ENTRY_SIZE 0x40
-+
-+
-+/* IOCB header structure */
-+typedef struct _HEADER {
-+ UINT8 entryType;
-+ #define ET_STATUS 0x03
-+ #define ET_MARKER 0x04
-+ #define ET_CONT_T1 0x0A
-+ #define ET_INOT 0x0D
-+ #define ET_NACK 0x0E
-+ #define ET_STATUS_CONTINUATION 0x10
-+ #define ET_CMND_T4 0x15
-+ #define ET_ATIO 0x16
-+ #define ET_CMND_T3 0x19
-+ #define ET_CTIO4 0x1E
-+ #define ET_CTIO3 0x1F
-+ #define ET_PERFORMANCE_STATUS 0x20
-+ #define ET_MAILBOX_CMD 0x38
-+ #define ET_MAILBOX_STATUS 0x39
-+ #define ET_PASSTHRU0 0x3A
-+ #define ET_PASSTHRU1 0x3B
-+ #define ET_PASSTHRU_STATUS 0x3C
-+ #define ET_ASYNCH_MSG 0x3D
-+ #define ET_CTIO5 0x3E
-+ #define ET_CTIO6 0x3F
-+
-+ UINT8 entryStatus;
-+ #define ES_MASK 0x3E
-+ #define ES_SUPPRESS_COMPL_INT 0x01
-+ #define ES_BUSY 0x02
-+ #define ES_INVALID_ENTRY_TYPE 0x04
-+ #define ES_INVALID_ENTRY_PARAM 0x08
-+ #define ES_INVALID_ENTRY_COUNT 0x10
-+ #define ES_INVALID_ENTRY_ORDER 0x20
-+ UINT8 systemDefined;
-+ UINT8 entryCount;
-+
-+ /* SyetemDefined definition */
-+ #define SD_PASSTHRU_IOCB 0x01
-+} HEADER ;
-+
-+/* Genric queue entry structure*/
-+typedef struct QUEUE_ENTRY {
-+ UINT8 data[60];
-+ UINT32 signature;
-+
-+} QUEUE_ENTRY;
-+
-+
-+/* 64 bit addressing segment counts*/
-+
-+#define COMMAND_SEG_A64 1
-+#define CONTINUE_SEG_A64 5
-+#define CONTINUE_SEG_A64_MINUS1 4
-+
-+/* 64 bit addressing segment definition*/
-+
-+typedef struct DATA_SEG_A64 {
-+ struct {
-+ UINT32 addrLow;
-+ UINT32 addrHigh;
-+
-+ } base;
-+
-+ UINT32 count;
-+
-+} DATA_SEG_A64;
-+
-+/* Command Type 3 entry structure*/
-+
-+typedef struct _COMMAND_T3_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connection_id; /* 0A-0B */
-+
-+ UINT8 control_flags; /* 0C */
-+ #define CF_IMMEDIATE 0x80
-+
-+ /* data direction (bits 5-6)*/
-+ #define CF_WRITE 0x20
-+ #define CF_READ 0x40
-+ #define CF_NO_DATA 0x00
-+ #define CF_DIRECTION_MASK 0x60
-+
-+ /* misc (bits 4-3)*/
-+ #define CF_DSD_PTR_ENABLE 0x10 /* 4010 only */
-+ #define CF_CMD_PTR_ENABLE 0x08 /* 4010 only */
-+
-+ /* task attributes (bits 2-0) */
-+ #define CF_ACA_QUEUE 0x04
-+ #define CF_HEAD_TAG 0x03
-+ #define CF_ORDERED_TAG 0x02
-+ #define CF_SIMPLE_TAG 0x01
-+ #define CF_TAG_TYPE_MASK 0x07
-+ #define CF_ATTRIBUTES_MASK 0x67
-+
-+ /* STATE FLAGS FIELD IS A PLACE HOLDER. THE FW WILL SET BITS IN THIS FIELD
-+ AS THE COMMAND IS PROCESSED. WHEN THE IOCB IS CHANGED TO AN IOSB THIS
-+ FIELD WILL HAVE THE STATE FLAGS SET PROPERLY.
-+ */
-+ UINT8 state_flags; /* 0D */
-+ UINT8 cmdRefNum; /* 0E */
-+ UINT8 reserved1; /* 0F */
-+ UINT8 cdb[IOCB_MAX_CDB_LEN]; /* 10-1F */
-+ UINT8 lun[8]; /* 20-27 */
-+ UINT32 cmdSeqNum; /* 28-2B */
-+ UINT16 timeout; /* 2C-2D */
-+ UINT16 dataSegCnt; /* 2E-2F */
-+ UINT32 ttlByteCnt; /* 30-33 */
-+ DATA_SEG_A64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
-+
-+} COMMAND_T3_ENTRY;
-+
-+typedef struct _COMMAND_T4_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connection_id; /* 0A-0B */
-+ UINT8 control_flags; /* 0C */
-+
-+ /* STATE FLAGS FIELD IS A PLACE HOLDER. THE FW WILL SET BITS IN THIS FIELD
-+ AS THE COMMAND IS PROCESSED. WHEN THE IOCB IS CHANGED TO AN IOSB THIS
-+ FIELD WILL HAVE THE STATE FLAGS SET PROPERLY.
-+ */
-+ UINT8 state_flags; /* 0D */
-+ UINT8 cmdRefNum; /* 0E */
-+ UINT8 reserved1; /* 0F */
-+ UINT8 cdb[IOCB_MAX_CDB_LEN]; /* 10-1F */
-+ UINT8 lun[8]; /* 20-27 */
-+ UINT32 cmdSeqNum; /* 28-2B */
-+ UINT16 timeout; /* 2C-2D */
-+ UINT16 dataSegCnt; /* 2E-2F */
-+ UINT32 ttlByteCnt; /* 30-33 */
-+
-+ /* WE ONLY USE THE ADDRESS FIELD OF THE FOLLOWING STRUCT.
-+ THE COUNT FIELD IS RESERVED */
-+ DATA_SEG_A64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
-+} COMMAND_T4_ENTRY;
-+
-+/* Continuation Type 1 entry structure*/
-+typedef struct _CONTINUATION_T1_ENTRY {
-+ HEADER hdr;
-+
-+ DATA_SEG_A64 dataseg[CONTINUE_SEG_A64];
-+
-+}CONTINUATION_T1_ENTRY;
-+
-+/* Status Continuation Type entry structure*/
-+typedef struct _STATUS_CONTINUATION_ENTRY {
-+ HEADER hdr;
-+
-+ UINT8 extSenseData[IOCB_MAX_EXT_SENSEDATA_LEN];
-+
-+}STATUS_CONTINUATION_ENTRY;
-+
-+/* Parameterize for 64 or 32 bits */
-+ #define COMMAND_SEG COMMAND_SEG_A64
-+ #define CONTINUE_SEG CONTINUE_SEG_A64
-+
-+ #define COMMAND_ENTRY COMMAND_T3_ENTRY
-+ #define CONTINUE_ENTRY CONTINUATION_T1_ENTRY
-+
-+ #define ET_COMMAND ET_CMND_T3
-+ #define ET_CONTINUE ET_CONT_T1
-+
-+
-+
-+/* Marker entry structure*/
-+typedef struct _MARKER_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+
-+ UINT32 system_defined; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 modifier; /* 0A-0B */
-+ #define MM_LUN_RESET 0
-+ #define MM_TARGET_WARM_RESET 1
-+ #define MM_TARGET_COLD_RESET 2
-+ #define MM_CLEAR_ACA 3
-+ #define MM_CLEAR_TASK_SET 4
-+ #define MM_ABORT_TASK_SET 5
-+
-+ UINT16 flags; /* 0C-0D */
-+ UINT16 reserved1; /* 0E-0F */
-+ UINT8 lun[8]; /* 10-17 */
-+ UINT64 reserved2; /* 18-1F */
-+ UINT64 reserved3; /* 20-27 */
-+ UINT64 reserved4; /* 28-2F */
-+ UINT64 reserved5; /* 30-37 */
-+ UINT64 reserved6; /* 38-3F */
-+}MARKER_ENTRY;
-+
-+/* Status entry structure*/
-+typedef struct _STATUS_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+
-+ UINT32 handle; /* 04-07 */
-+
-+ UINT8 scsiStatus; /* 08 */
-+ #define SCSI_STATUS_MASK 0xFF
-+ #define SCSI_STATUS 0xFF
-+ #define SCSI_GOOD 0x00
-+
-+ UINT8 iscsiFlags; /* 09 */
-+ #define ISCSI_FLAG_RESIDUAL_UNDER 0x02
-+ #define ISCSI_FLAG_RESIDUAL_OVER 0x04
-+ #define ISCSI_FLAG_RESIDUAL_UNDER_BIREAD 0x08
-+ #define ISCSI_FLAG_RESIDUAL_OVER_BIREAD 0x10
-+
-+ UINT8 iscsiResponse; /* 0A */
-+ #define ISCSI_RSP_COMPLETE 0x00
-+ #define ISCSI_RSP_TARGET_FAILURE 0x01
-+ #define ISCSI_RSP_DELIVERY_SUBSYS_FAILURE 0x02
-+ #define ISCSI_RSP_UNSOLISITED_DATA_REJECT 0x03
-+ #define ISCSI_RSP_NOT_ENOUGH_UNSOLISITED_DATA 0x04
-+ #define ISCSI_RSP_CMD_IN_PROGRESS 0x05
-+
-+ UINT8 completionStatus; /* 0B */
-+ #define SCS_COMPLETE 0x00
-+ #define SCS_INCOMPLETE 0x01
-+ #define SCS_DMA_ERROR 0x02
-+ #define SCS_TRANSPORT_ERROR 0x03
-+ #define SCS_RESET_OCCURRED 0x04
-+ #define SCS_ABORTED 0x05
-+ #define SCS_TIMEOUT 0x06
-+ #define SCS_DATA_OVERRUN 0x07
-+ #define SCS_DATA_DIRECTION_ERROR 0x08
-+ #define SCS_DATA_UNDERRUN 0x15
-+ #define SCS_QUEUE_FULL 0x1C
-+ #define SCS_DEVICE_UNAVAILABLE 0x28
-+ #define SCS_DEVICE_LOGGED_OUT 0x29
-+ #define SCS_DEVICE_CONFIG_CHANGED 0x2A
-+
-+ UINT8 reserved1; /* 0C */
-+
-+ /* state_flags MUST be at the same location as state_flags in the
-+ Command_T3/4_Entry */
-+ UINT8 state_flags; /* 0D */
-+ #define STATE_FLAG_SENT_COMMAND 0x01
-+ #define STATE_FLAG_TRANSFERRED_DATA 0x02
-+ #define STATE_FLAG_GOT_STATUS 0x04
-+ #define STATE_FLAG_LOGOUT_SENT 0x10
-+
-+ UINT16 senseDataByteCnt; /* 0E-0F */
-+ UINT32 residualByteCnt; /* 10-13 */
-+ UINT32 bidiResidualByteCnt; /* 14-17 */
-+ UINT32 expSeqNum; /* 18-1B */
-+ UINT32 maxCmdSeqNum; /* 1C-1F */
-+ UINT8 senseData[IOCB_MAX_SENSEDATA_LEN]; /* 20-3F */
-+
-+}STATUS_ENTRY;
-+
-+/*
-+ * Performance Status Entry where up to 30 handles can be posted in a
-+ * single IOSB. Handles are of 16 bit value.
-+ */
-+typedef struct _PERFORMANCE_STATUS_ENTRY {
-+ UINT8 entryType;
-+ UINT8 entryCount;
-+ UINT16 handleCount;
-+
-+ #define MAX_STATUS_HANDLE 30
-+ UINT16 handleArray[ MAX_STATUS_HANDLE ];
-+
-+} PERFORMANCE_STATUS_ENTRY;
-+
-+
-+typedef struct _IMMEDIATE_NOTIFY_ENTRY {
-+ HEADER hdr;
-+ UINT32 handle;
-+ UINT16 initiator;
-+ UINT16 InitSessionID;
-+ UINT16 ConnectionID;
-+ UINT16 TargSessionID;
-+ UINT16 inotStatus;
-+ #define INOT_STATUS_ABORT_TASK 0x0020
-+ #define INOT_STATUS_LOGIN_RECVD 0x0021
-+ #define INOT_STATUS_LOGOUT_RECVD 0x0022
-+ #define INOT_STATUS_LOGGED_OUT 0x0029
-+ #define INOT_STATUS_RESTART_RECVD 0x0030
-+ #define INOT_STATUS_MSG_RECVD 0x0036
-+ #define INOT_STATUS_TSK_REASSIGN 0x0037
-+
-+ UINT16 taskFlags;
-+ #define TASK_FLAG_CLEAR_ACA 0x4000
-+ #define TASK_FLAG_COLD_RESET 0x2000
-+ #define TASK_FLAG_WARM_RESET 0x0800
-+ #define TASK_FLAG_LUN_RESET 0x1000
-+ #define TASK_FLAG_CLEAR_TASK_SET 0x0400
-+ #define TASK_FLAG_ABORT_TASK_SET 0x0200
-+
-+
-+ UINT32 refTaskTag;
-+ UINT8 lun[8];
-+ UINT32 inotTaskTag;
-+ UINT8 res3[RESERVED_BYTES_INOT];
-+} IMMEDIATE_NOTIFY_ENTRY ;
-+
-+typedef struct _NOTIFY_ACK_ENTRY {
-+ HEADER hdr;
-+ UINT32 handle;
-+ UINT16 initiator;
-+ UINT16 res1;
-+ UINT16 flags;
-+ UINT8 responseCode;
-+ UINT8 qualifier;
-+ UINT16 notAckStatus;
-+ UINT16 taskFlags;
-+ #define NACK_FLAG_RESPONSE_CODE_VALID 0x0010
-+
-+ UINT32 refTaskTag;
-+ UINT8 lun[8];
-+ UINT32 inotTaskTag;
-+ UINT8 res3[RESERVED_BYTES_NOTACK];
-+} NOTIFY_ACK_ENTRY ;
-+
-+typedef struct _ATIO_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0f */
-+ UINT8 scsiCDB[IOCB_MAX_CDB_LEN]; /* 10-1F */
-+ UINT8 LUN[8]; /* 20-27 */
-+ UINT8 cmdRefNum; /* 28 */
-+
-+ UINT8 pduType; /* 29 */
-+ #define PDU_TYPE_NOPOUT 0x00
-+ #define PDU_TYPE_SCSI_CMD 0x01
-+ #define PDU_TYPE_SCSI_TASK_MNGMT_CMD 0x02
-+ #define PDU_TYPE_LOGIN_CMD 0x03
-+ #define PDU_TYPE_TEXT_CMD 0x04
-+ #define PDU_TYPE_SCSI_DATA 0x05
-+ #define PDU_TYPE_LOGOUT_CMD 0x06
-+ #define PDU_TYPE_SNACK 0x10
-+
-+ UINT16 atioStatus; /* 2A-2B */
-+ #define ATIO_CDB_RECVD 0x003d
-+
-+ UINT16 reserved1; /* 2C-2D */
-+
-+ UINT8 taskCode; /* 2E */
-+ #define ATIO_TASK_CODE_UNTAGGED 0x00
-+ #define ATIO_TASK_CODE_SIMPLE_QUEUE 0x01
-+ #define ATIO_TASK_CODE_ORDERED_QUEUE 0x02
-+ #define ATIO_TASK_CODE_HEAD_OF_QUEUE 0x03
-+ #define ATIO_TASK_CODE_ACA_QUEUE 0x04
-+
-+ UINT8 reserved2; /* 2F */
-+ UINT32 totalByteCnt; /* 30-33 */
-+ UINT32 cmdSeqNum; /* 34-37 */
-+ UINT64 immDataBufDesc; /* 38-3F */
-+} ATIO_ENTRY ;
-+
-+typedef struct _CTIO3_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0F */
-+
-+ UINT8 flags; /* 10 */
-+ #define CTIO_FLAG_SEND_SCSI_STATUS 0x01
-+ #define CTIO_FLAG_TERMINATE_COMMAND 0x10
-+ #define CTIO_FLAG_FAST_POST 0x08
-+ #define CTIO_FLAG_FINAL_CTIO 0x80
-+
-+ /* NOTE: Our firmware assumes that the CTIO_FLAG_SEND_DATA and
-+ CTIO_FLAG_GET_DATA flags are in the same bit positions
-+ as the R and W bits in SCSI Command PDUs, so their values
-+ should not be changed!
-+ */
-+ #define CTIO_FLAG_SEND_DATA 0x0040 /* (see note) Read Data Flag, send data to initiator */
-+ #define CTIO_FLAG_GET_DATA 0x0020 /* (see note) Write Data Flag, get data from the initiator */
-+
-+ UINT8 scsiStatus; /* 11 */
-+ UINT16 timeout; /* 12-13 */
-+ UINT32 offset; /* 14-17 */
-+ UINT32 r2tSN; /* 18-1B */
-+ UINT32 expCmdSN; /* 1C-1F */
-+ UINT32 maxCmdSN; /* 20-23 */
-+ UINT32 dataSN; /* 24-27 */
-+ UINT32 residualCount; /* 28-2B */
-+ UINT16 reserved; /* 2C-2D */
-+ UINT16 segmentCnt; /* 2E-2F */
-+ UINT32 totalByteCnt; /* 30-33 */
-+ DATA_SEG_A64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
-+} CTIO3_ENTRY ;
-+
-+typedef struct _CTIO4_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0F */
-+ UINT8 flags; /* 10 */
-+ UINT8 scsiStatus; /* 11 */
-+ UINT16 timeout; /* 12-13 */
-+ UINT32 offset; /* 14-17 */
-+ UINT32 r2tSN; /* 18-1B */
-+ UINT32 expCmdSN; /* 1C-1F */
-+ UINT32 maxCmdSN; /* 20-23 */
-+ UINT32 dataSN; /* 24-27 */
-+ UINT32 residualCount; /* 28-2B */
-+ UINT16 reserved; /* 2C-2D */
-+ UINT16 segmentCnt; /* 2E-2F */
-+ UINT32 totalByteCnt; /* 30-33 */
-+ /* WE ONLY USE THE ADDRESS FROM THE FOLLOWING STRUCTURE THE COUNT FIELD IS
-+ RESERVED */
-+ DATA_SEG_A64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
-+} CTIO4_ENTRY ;
-+
-+typedef struct _CTIO5_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0F */
-+ UINT8 response; /* 10 */
-+ UINT8 scsiStatus; /* 11 */
-+ UINT16 timeout; /* 12-13 */
-+ UINT32 reserved1; /* 14-17 */
-+ UINT32 expR2TSn; /* 18-1B */
-+ UINT32 expCmdSn; /* 1C-1F */
-+ UINT32 MaxCmdSn; /* 20-23 */
-+ UINT32 expDataSn; /* 24-27 */
-+ UINT32 residualCnt; /* 28-2B */
-+ UINT32 bidiResidualCnt; /* 2C-2F */
-+ UINT32 reserved2; /* 30-33 */
-+ DATA_SEG_A64 dataseg[1]; /* 34-3F */
-+} CTIO5_ENTRY ;
-+
-+typedef struct _CTIO6_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connection; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0F */
-+ UINT16 flags; /* 10-11 */
-+ UINT16 timeout; /* 12-13 */
-+ UINT32 reserved1; /* 14-17 */
-+ UINT64 reserved2; /* 18-1F */
-+ UINT64 reserved3; /* 20-27 */
-+ UINT64 reserved4; /* 28-2F */
-+ UINT32 reserved5; /* 30-33 */
-+ DATA_SEG_A64 dataseg[1]; /* 34-3F */
-+} CTIO6_ENTRY ;
-+
-+typedef struct _CTIO_STATUS_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 initiator; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ UINT32 taskTag; /* 0C-0F */
-+ UINT16 status; /* 10-11 */
-+ #define CTIO_STATUS_COMPLETE 0x0001
-+ #define CTIO_STATUS_ABORTED 0x0002
-+ #define CTIO_STATUS_DMA_ERROR 0x0003
-+ #define CTIO_STATUS_ERROR 0x0004
-+ #define CTIO_STATUS_INVALID_TAG 0x0008
-+ #define CTIO_STATUS_DATA_OVERRUN 0x0009
-+ #define CTIO_STATUS_CMD_TIMEOUT 0x000B
-+ #define CTIO_STATUS_PCI_ERROR 0x0010
-+ #define CTIO_STATUS_DATA_UNDERRUN 0x0015
-+ #define CTIO_STATUS_TARGET_RESET 0x0017
-+ #define CTIO_STATUS_NO_CONNECTION 0x0028
-+ #define CTIO_STATUS_LOGGED_OUT 0x0029
-+ #define CTIO_STATUS_CONFIG_CHANGED 0x002A
-+ #define CTIO_STATUS_UNACK_EVENT 0x0035
-+ #define CTIO_STATUS_INVALID_DATA_XFER 0x0036
-+
-+ UINT16 timeout; /* 12-13 */
-+ UINT32 reserved1; /* 14-17 */
-+ UINT32 expR2TSN; /* 18-1B */
-+ UINT32 reserved2; /* 1C-1F */
-+ UINT32 reserved3; /* 20-23 */
-+ UINT64 expDataSN; /* 24-27 */
-+ UINT32 residualCount; /* 28-2B */
-+ UINT32 reserved4; /* 2C-2F */
-+ UINT64 reserved5; /* 30-37 */
-+ UINT64 reserved6; /* 38-3F */
-+} CTIO_STATUS_ENTRY ;
-+
-+typedef struct _MAILBOX_ENTRY {
-+ HEADER hdr;
-+ UINT32 handle;
-+ UINT32 mbx[MAX_MBX_COUNT];
-+} MAILBOX_ENTRY ;
-+
-+typedef struct MAILBOX_STATUS_ENTRY {
-+ HEADER hdr;
-+ UINT32 handle;
-+ UINT32 mbx[MAX_MBX_COUNT];
-+} MAILBOX_STATUS_ENTRY ;
-+
-+
-+typedef struct _PDU_ENTRY {
-+ UINT8 *Buff;
-+ UINT32 BuffLen;
-+ UINT32 SendBuffLen;
-+ UINT32 RecvBuffLen;
-+ struct _PDU_ENTRY *Next;
-+ dma_addr_t DmaBuff;
-+} PDU_ENTRY, *PPDU_ENTRY;
-+
-+typedef struct _ISNS_DISCOVERED_TARGET_PORTAL {
-+ UINT8 IPAddr[4];
-+ UINT16 PortNumber;
-+ UINT16 Reserved;
-+} ISNS_DISCOVERED_TARGET_PORTAL, *PISNS_DISCOVERED_TARGET_PORTAL;
-+
-+typedef struct _ISNS_DISCOVERED_TARGET {
-+ UINT32 NumPortals; /* 00-03 */
-+#define ISNS_MAX_PORTALS 4
-+ ISNS_DISCOVERED_TARGET_PORTAL Portal[ISNS_MAX_PORTALS]; /* 04-23 */
-+ UINT32 DDID; /* 24-27 */
-+ UINT8 NameString[256]; /* 28-127 */
-+ UINT8 Alias[32]; /* 128-147 */
-+// UINT32 SecurityBitmap
-+} ISNS_DISCOVERED_TARGET, *PISNS_DISCOVERED_TARGET;
-+
-+
-+typedef struct _PASSTHRU0_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+ #define ISNS_DEFAULT_SERVER_CONN_ID ((uint16_t)0x8000)
-+
-+ UINT16 controlFlags; /* 0C-0D */
-+ #define PT_FLAG_ETHERNET_FRAME 0x8000
-+ #define PT_FLAG_ISNS_PDU 0x8000
-+ #define PT_FLAG_IP_DATAGRAM 0x4000
-+ #define PT_FLAG_TCP_PACKET 0x2000
-+ #define PT_FLAG_NETWORK_PDU (PT_FLAG_ETHERNET_FRAME | PT_FLAG_IP_DATAGRAM | PT_FLAG_TCP_PACKET)
-+ #define PT_FLAG_iSCSI_PDU 0x1000
-+ #define PT_FLAG_SEND_BUFFER 0x0200
-+ #define PT_FLAG_WAIT_4_RESPONSE 0x0100
-+ #define PT_FLAG_NO_FAST_POST 0x0080
-+
-+ UINT16 timeout; /* 0E-0F */
-+ #define PT_DEFAULT_TIMEOUT 30 // seconds
-+
-+ DATA_SEG_A64 outDataSeg64; /* 10-1B */
-+ UINT32 res1; /* 1C-1F */
-+ DATA_SEG_A64 inDataSeg64; /* 20-2B */
-+ UINT8 res2[20]; /* 2C-3F */
-+} PASSTHRU0_ENTRY ;
-+
-+typedef struct _PASSTHRU1_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+
-+ UINT16 controlFlags; /* 0C-0D */
-+ #define PT_FLAG_ETHERNET_FRAME 0x8000
-+ #define PT_FLAG_IP_DATAGRAM 0x4000
-+ #define PT_FLAG_TCP_PACKET 0x2000
-+ #define PT_FLAG_iSCSI_PDU 0x1000
-+ #define PT_FLAG_SEND_BUFFER 0x0200
-+ #define PT_FLAG_WAIT_4_REPONSE 0x0100
-+ #define PT_FLAG_NO_FAST_POST 0x0080
-+
-+ UINT16 timeout; /* 0E-0F */
-+ DATA_SEG_A64 outDSDList; /* 10-1B */
-+ UINT32 outDSDCnt; /* 1C-1F */
-+ DATA_SEG_A64 inDSDList; /* 20-2B */
-+ UINT32 inDSDCnt; /* 2C-2F */
-+ UINT8 res1; /* 30-3F */
-+
-+} PASSTHRU1_ENTRY ;
-+
-+typedef struct _PASSTHRU_STATUS_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connectionID; /* 0A-0B */
-+
-+ UINT8 completionStatus; /* 0C */
-+ #define PASSTHRU_STATUS_COMPLETE 0x01
-+ #define PASSTHRU_STATUS_ERROR 0x04
-+ #define PASSTHRU_STATUS_INVALID_DATA_XFER 0x06
-+ #define PASSTHRU_STATUS_CMD_TIMEOUT 0x0B
-+ #define PASSTHRU_STATUS_PCI_ERROR 0x10
-+ #define PASSTHRU_STATUS_NO_CONNECTION 0x28
-+
-+ UINT8 residualFlags; /* 0D */
-+ #define PASSTHRU_STATUS_DATAOUT_OVERRUN 0x01
-+ #define PASSTHRU_STATUS_DATAOUT_UNDERRUN 0x02
-+ #define PASSTHRU_STATUS_DATAIN_OVERRUN 0x04
-+ #define PASSTHRU_STATUS_DATAIN_UNDERRUN 0x08
-+
-+ UINT16 timeout; /* 0E-0F */
-+ UINT16 portNumber; /* 10-11 */
-+ UINT8 res1[10]; /* 12-1B */
-+ UINT32 outResidual; /* 1C-1F */
-+ UINT8 res2[12]; /* 20-2B */
-+ UINT32 inResidual; /* 2C-2F */
-+ UINT8 res4[16]; /* 30-3F */
-+} PASSTHRU_STATUS_ENTRY ;
-+
-+typedef struct _ASYNCHMSG_ENTRY {
-+ HEADER hdr;
-+ UINT32 handle;
-+ UINT16 target;
-+ UINT16 connectionID;
-+ UINT8 lun[8];
-+ UINT16 iSCSIEvent;
-+ #define AMSG_iSCSI_EVENT_NO_EVENT 0x0000
-+ #define AMSG_iSCSI_EVENT_TARG_RESET 0x0001
-+ #define AMSG_iSCSI_EVENT_TARGT_LOGOUT 0x0002
-+ #define AMSG_iSCSI_EVENT_CONNECTION_DROPPED 0x0003
-+ #define AMSG_ISCSI_EVENT_ALL_CONNECTIONS_DROPPED 0x0004
-+
-+ UINT16 SCSIEvent;
-+ #define AMSG_NO_SCSI_EVENT 0x0000
-+ #define AMSG_SCSI_EVENT 0x0001
-+
-+ UINT16 parameter1;
-+ UINT16 parameter2;
-+ UINT16 parameter3;
-+ UINT32 expCmdSn;
-+ UINT32 maxCmdSn;
-+ UINT16 senseDataCnt;
-+ UINT16 reserved;
-+ UINT32 senseData[IOCB_MAX_SENSEDATA_LEN];
-+} ASYNCHMSG_ENTRY ;
-+
-+/* Timer entry structure, this is an internal generated structure
-+ which causes the QLA4000 initiator to send a NOP-OUT or the
-+ QLA4000 target to send a NOP-IN */
-+
-+typedef struct _TIMER_ENTRY {
-+ HEADER hdr; /* 00-03 */
-+
-+ UINT32 handle; /* 04-07 */
-+ UINT16 target; /* 08-09 */
-+ UINT16 connection_id; /* 0A-0B */
-+
-+ UINT8 control_flags; /* 0C */
-+
-+ /* STATE FLAGS FIELD IS A PLACE HOLDER. THE FW WILL SET BITS IN THIS FIELD
-+ AS THE COMMAND IS PROCESSED. WHEN THE IOCB IS CHANGED TO AN IOSB THIS
-+ FIELD WILL HAVE THE STATE FLAGS SET PROPERLY.
-+ */
-+ UINT8 state_flags; /* 0D */
-+ UINT8 cmdRefNum; /* 0E */
-+ UINT8 reserved1; /* 0F */
-+ UINT8 cdb[IOCB_MAX_CDB_LEN]; /* 10-1F */
-+ UINT8 lun[8]; /* 20-27 */
-+ UINT32 cmdSeqNum; /* 28-2B */
-+ UINT16 timeout; /* 2C-2D */
-+ UINT16 dataSegCnt; /* 2E-2F */
-+ UINT32 ttlByteCnt; /* 30-33 */
-+ DATA_SEG_A64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
-+
-+} TIMER_ENTRY;
-+
-+
-+#endif /* _QLA4X_FW_H */
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_glbl.h ./drivers/scsi/qla4xxx/ql4_glbl.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_glbl.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_glbl.h 2006-08-31 14:59:59.000000000 +0400
-@@ -0,0 +1,207 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Global include file.
-+ ****************************************************************************/
-+#ifndef __QLA4x_GBL_H
-+#define __QLA4x_GBL_H
-+
-+#include <linux/interrupt.h>
-+
-+/*
-+ * Defined in ql4_os.c
-+ */
-+
-+extern void qla4xxx_start_io(scsi_qla_host_t *ha);
-+extern srb_t *del_from_active_array(scsi_qla_host_t *ha, uint32_t index);
-+extern uint8_t qla4xxx_complete_request(scsi_qla_host_t *ha, srb_t *srb);
-+extern uint8_t qla4xxx_reset_lun(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry, lun_entry_t *lun_entry);
-+extern uint8_t qla4xxx_soft_reset(scsi_qla_host_t *);
-+extern const char *host_sts_msg[];
-+extern void qla4xxx_delete_timer_from_cmd(srb_t *srb);
-+extern scsi_qla_host_t *qla4xxx_get_adapter_handle(uint16_t instance);
-+extern inline uint32_t qla4xxx_get_hba_count(void);
-+extern void qla4xxx_free_ddb_list(scsi_qla_host_t *ha);
-+
-+extern void qla4xxx_tgt_free(scsi_qla_host_t *ha, uint16_t t);
-+extern os_tgt_t *qla4xxx_tgt_alloc(scsi_qla_host_t *, uint16_t);
-+extern os_lun_t * qla4xxx_lun_alloc(scsi_qla_host_t *, uint16_t, uint16_t);
-+extern void qla4xxx_extend_timeout(struct scsi_cmnd *cmd, int timeout);
-+extern int qla4xxx_done(scsi_qla_host_t *old_ha);
-+extern int qla4xxx_device_suspend( scsi_qla_host_t *, os_lun_t *, srb_t * );
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+extern struct list_head qla4xxx_hostlist;
-+extern rwlock_t qla4xxx_hostlist_lock;
-+
-+extern void qla4xxx_flush_failover_q(scsi_qla_host_t *, os_lun_t *);
-+#endif
-+extern int extended_error_logging;
-+/*
-+ * Defined in ql4_iocb.c
-+ */
-+extern uint8_t qla4xxx_send_marker(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry, lun_entry_t *lun_entry);
-+extern uint8_t qla4xxx_send_marker_iocb(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry, lun_entry_t *lun_entry);
-+
-+extern uint8_t qla4xxx_get_req_pkt(scsi_qla_host_t *, QUEUE_ENTRY **);
-+
-+extern PDU_ENTRY *qla4xxx_get_pdu(scsi_qla_host_t *, uint32_t);
-+extern void qla4xxx_free_pdu(scsi_qla_host_t *, PDU_ENTRY *);
-+extern uint8_t qla4xxx_send_passthru0_iocb(scsi_qla_host_t *, uint16_t,
-+ uint16_t, dma_addr_t, uint32_t, uint32_t, uint16_t, uint32_t);
-+
-+/*
-+ * Defined in ql4_isr.c
-+ */
-+
-+extern irqreturn_t qla4xxx_intr_handler(int, void *, struct pt_regs *);
-+extern void qla4xxx_interrupt_service_routine(scsi_qla_host_t *ha, uint32_t intr_status);
-+extern void __qla4xxx_suspend_lun(scsi_qla_host_t *ha, srb_t *srb, os_lun_t *lun_entry, uint16_t time,
-+ uint16_t retries, int delay);
-+
-+
-+/*
-+ * Defined in ql4_init.c
-+ */
-+extern uint8_t qla4xxx_initialize_adapter(scsi_qla_host_t *ha, uint8_t renew_ddb_list);
-+
-+extern ddb_entry_t *qla4xxx_alloc_ddb(scsi_qla_host_t *ha, uint32_t fw_ddb_index);
-+extern uint8_t qla4xxx_update_ddb_entry(scsi_qla_host_t *ha, ddb_entry_t
-+ *ddb_entry, uint32_t fw_ddb_index);
-+extern uint8_t qla4xxx_get_fwddb_entry(scsi_qla_host_t *ha, uint16_t fw_ddb_index, DEV_DB_ENTRY *fw_ddb_entry, dma_addr_t fw_ddb_entry_dma, uint32_t *num_valid_ddb_entries, uint32_t *next_ddb_index, uint32_t *fw_ddb_device_state, uint32_t *time2wait, uint16_t *tcp_source_port_num, uint16_t *connection_id);
-+extern uint8_t qla4xxx_relogin_device(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry);
-+extern uint8_t qla4xxx_send_command_to_isp(scsi_qla_host_t *, srb_t *);
-+extern int qla4xxx_get_prop_12chars(scsi_qla_host_t *ha, uint8_t *propname, uint8_t *propval, uint8_t *db);
-+extern void qla4xxx_free_ddb(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry);
-+extern uint8_t qla4xxx_resize_ioctl_dma_buf(scsi_qla_host_t *ha, uint32_t size);
-+extern uint8_t qla4xxx_set_ddb_entry(scsi_qla_host_t *ha, uint16_t fw_ddb_index, DEV_DB_ENTRY *fw_ddb_entry, dma_addr_t fw_ddb_entry_dma);
-+extern uint8_t qla4xxx_process_ddb_changed(scsi_qla_host_t *ha, uint32_t fw_ddb_index, uint32_t state);
-+extern uint8_t qla4xxx_init_rings(scsi_qla_host_t *ha);
-+extern uint8_t qla4xxx_reinitialize_ddb_list(scsi_qla_host_t *ha);
-+extern fc_lun_t * qla4xxx_add_fclun(fc_port_t *fcport, uint16_t lun);
-+extern os_lun_t *
-+qla4xxx_fclun_bind(scsi_qla_host_t *ha, fc_port_t *fcport, fc_lun_t *fclun);
-+extern void qla4xxx_flush_all_srbs(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry, os_lun_t *lun_entry);
-+
-+
-+/*
-+ * Defined in ql4_mbx.c
-+ */
-+extern void qla4xxx_process_aen(scsi_qla_host_t *ha, uint8_t flush_ddb_chg_aens);
-+extern uint8_t qla4xxx_mailbox_command(scsi_qla_host_t *ha, uint8_t inCount, uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts);
-+extern uint8_t qla4xxx_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr, size_t size);
-+
-+extern uint8_t qla4xxx_isns_enable(scsi_qla_host_t *, uint32_t, uint16_t);
-+extern uint8_t qla4xxx_isns_disable(scsi_qla_host_t *);
-+
-+extern uint8_t qla4xxx_get_flash(scsi_qla_host_t *, dma_addr_t, uint32_t,
-+ uint32_t);
-+
-+extern uint8_t qla4xxx_initialize_fw_cb(scsi_qla_host_t *);
-+
-+extern uint8_t qla4xxx_get_firmware_state(scsi_qla_host_t *);
-+
-+extern void qla4xxx_get_crash_record(scsi_qla_host_t *);
-+
-+extern uint8_t qla4xxx_conn_close_sess_logout(scsi_qla_host_t *, uint16_t,
-+ uint16_t, uint16_t);
-+
-+extern uint8_t qla4xxx_clear_database_entry(scsi_qla_host_t *, uint16_t);
-+
-+extern uint8_t qla4xxx_get_fw_version(scsi_qla_host_t *ha);
-+
-+extern uint8_t qla4xxx_get_firmware_status(scsi_qla_host_t *ha);
-+
-+/*
-+ * Defined in ql4_inioct.c
-+ */
-+extern void qla4xxx_iocb_pass_done(scsi_qla_host_t *ha, PASSTHRU_STATUS_ENTRY *sts_entry);
-+
-+/*
-+ * Defined in ql4_xioct.c
-+ */
-+extern void qla4xxx_scsi_pass_done(struct scsi_cmnd *cmd);
-+extern void qla4xxx_ioctl_sem_init (scsi_qla_host_t *ha);
-+
-+
-+/*
-+ * Defined in ql4_isns.c
-+ */
-+extern uint8_t qla4xxx_isns_process_response(scsi_qla_host_t *ha, PASSTHRU_STATUS_ENTRY *sts_entry);
-+
-+extern uint8_t
-+qla4xxx_isns_restart_service_completion(scsi_qla_host_t *ha,
-+ uint32_t isns_ip_addr,
-+ uint16_t isns_server_port_num);
-+extern uint8_t qla4xxx_isns_restart_service(scsi_qla_host_t *);
-+
-+extern uint8_t qla4xxx_isns_init_attributes(scsi_qla_host_t *);
-+
-+extern uint8_t qla4xxx_isns_reenable(scsi_qla_host_t *, uint32_t, uint16_t);
-+
-+extern void qla4xxx_isns_enable_callback(scsi_qla_host_t *, uint32_t, uint32_t,
-+ uint32_t, uint32_t);
-+extern uint8_t qla4xxx_isns_get_server_request(scsi_qla_host_t *, uint32_t,
-+ uint16_t);
-+
-+/*
-+ * Defined in ql4_nvram.c
-+ */
-+
-+extern u16 RD_NVRAM_WORD(scsi_qla_host_t *, int);
-+extern uint8_t qla4xxx_is_NVRAM_configuration_valid(scsi_qla_host_t *ha);
-+extern void qla4xxx_clear_hw_semaphore(scsi_qla_host_t *ha, uint32_t sem);
-+extern uint8_t qla4xxx_take_hw_semaphore(scsi_qla_host_t *ha, uint32_t sem, uint8_t wait_flag);
-+
-+/*
-+ * Defined in ql4_dbg.c
-+ */
-+extern void qla4xxx_dump_buffer(uint8_t *, uint32_t);
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+/*
-+ * Defined in ql4_fo.c
-+ */
-+extern void
-+qla4xxx_reset_lun_fo_counts(scsi_qla_host_t *ha, os_lun_t *lq);
-+
-+/*
-+ * Defined in ql4_foio.c
-+ */
-+extern void qla4xxx_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport);
-+
-+/*
-+ * Defined in ql4_foln.c
-+ */
-+extern void qla4xxx_flush_failover_q(scsi_qla_host_t *ha, os_lun_t *q);
-+
-+extern int qla4xxx_issue_scsi_inquiry(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, fc_lun_t *fclun );
-+extern int qla4xxx_test_active_lun(fc_port_t *fcport, fc_lun_t *fclun);
-+extern int qla4xxx_get_wwuln_from_device(mp_host_t *host, fc_lun_t *fclun,
-+ char *evpd_buf, int wwlun_size);
-+extern fc_lun_t * qla4xxx_cfg_lun(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ uint16_t lun, inq_cmd_rsp_t *inq, dma_addr_t inq_dma);
-+extern void
-+qla4xxx_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport);
-+extern int qla4xxx_rpt_lun_discovery(scsi_qla_host_t *ha, fc_port_t *fcport,
-+ inq_cmd_rsp_t *inq, dma_addr_t inq_dma);
-+extern int
-+qla4xxx_spinup(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun);
-+#endif
-+#endif /* _QLA4x_GBL_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_inioct.c ./drivers/scsi/qla4xxx/ql4_inioct.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_inioct.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_inioct.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,1769 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4intioctl_logout_iscsi
-+ * qla4intioctl_ping
-+ * __xlate_sys_info
-+ * __xlate_driver_info
-+ * __xlate_init_fw_ctrl_blk
-+ * __xlate_dev_db
-+ * __xlate_chap
-+ * qla4intioctl_get_flash
-+ * qla4intioctl_get_driver_debug_level
-+ * qla4intioctl_get_host_no
-+ * qla4intioctl_get_data
-+ * qla4intioctl_set_flash
-+ * qla4intioctl_set_driver_debug_level
-+ * qla4intioctl_set_data
-+ * qla4intioctl_hba_reset
-+ * qla4intioctl_copy_fw_flash
-+ * qla4xxx_iocb_pass_done
-+ * qla4intioctl_iocb_passthru
-+ ****************************************************************************/
-+#include "ql4_def.h"
-+#include "ql4_ioctl.h"
-+
-+
-+// KRH: (BEGIN) Define these locally, for now
-+/*
-+ * Sub codes for Get Data.
-+ * Use in combination with INT_GET_DATA as the ioctl code
-+ */
-+#define INT_SC_GET_DRIVER_DEBUG_LEVEL 2
-+#define INT_SC_GET_HOST_NO 3
-+
-+/*
-+ * Sub codes for Set Data.
-+ * Use in combination with INT_SET_DATA as the ioctl code
-+ */
-+#define INT_SC_SET_DRIVER_DEBUG_LEVEL 2
-+
-+/*
-+ * Sub codes for Reset
-+ * Use in combination with INT_CC_HBA_RESET as the ioctl code
-+ */
-+#define INT_SC_HBA_RESET 0
-+#define INT_SC_FIRMWARE_RESET 1
-+#define INT_SC_TARGET_WARM_RESET 2
-+#define INT_SC_LUN_RESET 3
-+//KRH: (END)
-+
-+/* Defines for byte-order translation direction */
-+#define GET_DATA 0
-+#define SET_DATA 1
-+
-+ioctl_tbl_row_t IOCTL_SCMD_IGET_DATA_TBL[] =
-+{
-+ {INT_SC_GET_FLASH, "INT_SC_GET_FLASH"},
-+ {INT_SC_GET_DRIVER_DEBUG_LEVEL, "INT_SC_GET_DRIVER_DEBUG_LEVEL"},
-+ {INT_SC_GET_HOST_NO, "INT_SC_GET_HOST_NO"},
-+ {0, "UNKNOWN"}
-+};
-+
-+ioctl_tbl_row_t IOCTL_SCMD_ISET_DATA_TBL[] =
-+{
-+ {INT_SC_SET_FLASH, "INT_SC_SET_FLASH"},
-+ {INT_SC_SET_DRIVER_DEBUG_LEVEL, "INT_SC_SET_DRIVER_DEBUG_LEVEL"},
-+ {0, "UNKNOWN"}
-+};
-+
-+
-+/**************************************************************************
-+ * qla4intioctl_logout_iscsi
-+ * This routine requests that the specified device either login or
-+ * logout, depending on the option specified.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_logout_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ INT_LOGOUT_ISCSI logout;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ioctl->RequestLen > sizeof(INT_LOGOUT_ISCSI)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_logout;
-+ }
-+
-+ /* --- Copy logout structure from user space --- */
-+ if ((status = copy_from_user((void *)&logout,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(INT_LOGOUT_ISCSI))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from "
-+ "user's memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_logout;
-+ }
-+
-+ /* --- Execute command --- */
-+ if (logout.Options == INT_DEF_CLOSE_SESSION) {
-+ if (qla4xxx_logout_device(ha, logout.TargetID,
-+ logout.ConnectionID) == QLA_SUCCESS) {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: CLOSE_SESSION SUCCEEDED!, "
-+ "target %d\n", ha->host_no, __func__,
-+ logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: CLOSE_SESSION FAILED!, "
-+ "target %d\n", ha->host_no, __func__,
-+ logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ }
-+
-+ } else if (logout.Options == INT_DEF_RELOGIN_CONNECTION) {
-+ if (qla4xxx_login_device(ha, logout.TargetID,
-+ logout.ConnectionID) == QLA_SUCCESS) {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: RELOGIN_CONNECTION "
-+ "SUCCEEDED!, target %d\n",
-+ ha->host_no, __func__, logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: RELOGIN_CONNECTION "
-+ "FAILED!, target %d\n",
-+ ha->host_no, __func__, logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ }
-+
-+ } else if (logout.Options == INT_DEF_DELETE_DDB) {
-+ if (qla4xxx_delete_device(ha, logout.TargetID,
-+ logout.ConnectionID) == QLA_SUCCESS) {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: DELETE_DDB "
-+ "SUCCEEDED!, target %d\n",
-+ ha->host_no, __func__, logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: DELETE_DDB FAILED!, "
-+ "target %d\n",
-+ ha->host_no, __func__, logout.TargetID));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ }
-+ }
-+
-+exit_logout:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_ping
-+ * This routine requests that the HBA PING the specified IP Address.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_ping(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ INT_PING ping;
-+ uint32_t ip_addr;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /*
-+ * Copy user's data to local buffer
-+ */
-+ if ((status = copy_from_user((uint8_t *)&ping,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(ping))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from "
-+ "user's memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_ping;
-+ }
-+
-+ /*
-+ * Debug Print Statement
-+ */
-+ if (ping.IPAddr.Type == EXT_DEF_TYPE_ISCSI_IP) {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: %d.%d.%d.%d\n",
-+ ha->host_no, __func__,
-+ ping.IPAddr.IPAddress[0],
-+ ping.IPAddr.IPAddress[1],
-+ ping.IPAddr.IPAddress[2],
-+ ping.IPAddr.IPAddress[3]));
-+ } else {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: %d.%d.%d.%d. %d.%d.%d.%d. "
-+ "%d.%d.%d.%d. %d.%d.%d.%d\n",
-+ ha->host_no, __func__,
-+ ping.IPAddr.IPAddress[0], ping.IPAddr.IPAddress[1],
-+ ping.IPAddr.IPAddress[2], ping.IPAddr.IPAddress[3],
-+ ping.IPAddr.IPAddress[4], ping.IPAddr.IPAddress[5],
-+ ping.IPAddr.IPAddress[6], ping.IPAddr.IPAddress[7],
-+ ping.IPAddr.IPAddress[8], ping.IPAddr.IPAddress[9],
-+ ping.IPAddr.IPAddress[10], ping.IPAddr.IPAddress[11],
-+ ping.IPAddr.IPAddress[12], ping.IPAddr.IPAddress[13],
-+ ping.IPAddr.IPAddress[14], ping.IPAddr.IPAddress[15]));
-+ }
-+
-+ /*
-+ * Issue Mailbox Command
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_PING;
-+ mbox_cmd[1] = cpu_to_le16(ping.PacketCount);
-+ memcpy(&ip_addr, &ping.IPAddr.IPAddress, EXT_DEF_IP_ADDR_SIZE);
-+ mbox_cmd[2] = cpu_to_le32(ip_addr);
-+
-+ if (qla4xxx_mailbox_command(ha, 6, 1, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_ping;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+exit_ping:
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+#if BYTE_ORDER_SUPPORT_ENABLED
-+static void
-+__xlate_sys_info(FLASH_SYS_INFO *from, FLASH_SYS_INFO *to,
-+ uint8_t direction)
-+{
-+ switch (direction) {
-+ case GET_DATA:
-+ from->cookie = le32_to_cpu(to->cookie);
-+ from->physAddrCount = le32_to_cpu(to->physAddrCount);
-+ memcpy(from->physAddr, to->physAddr, sizeof(from->physAddr));
-+ memcpy(from->vendorId, to->vendorId, sizeof(from->vendorId));
-+ memcpy(from->productId, to->productId, sizeof(from->productId));
-+ from->serialNumber = le32_to_cpu(to->serialNumber);
-+ from->pciDeviceVendor = le32_to_cpu(to->pciDeviceVendor);
-+ from->pciDeviceId = le32_to_cpu(to->pciDeviceId);
-+ from->pciSubsysVendor = le32_to_cpu(to->pciSubsysVendor);
-+ from->pciSubsysId = le32_to_cpu(to->pciSubsysId);
-+ from->crumbs = le32_to_cpu(to->crumbs);
-+ from->enterpriseNumber = le32_to_cpu(to->enterpriseNumber);
-+ from->mtu = le32_to_cpu(to->mtu);
-+ from->reserved0 = le32_to_cpu(to->reserved0);
-+ from->crumbs2 = le32_to_cpu(to->crumbs2);
-+ memcpy(from->acSerialNumber, to->acSerialNumber,
-+ sizeof(from->acSerialNumber));
-+ from->crumbs3 = le32_to_cpu(to->crumbs3);
-+ memcpy(from->reserved1, to->reserved1, sizeof(from->reserved1));
-+ break;
-+
-+ case SET_DATA:
-+ from->cookie = cpu_to_le32(to->cookie);
-+ from->physAddrCount = cpu_to_le32(to->physAddrCount);
-+ memcpy(from->physAddr, to->physAddr, sizeof(from->physAddr));
-+ memcpy(from->vendorId, to->vendorId, sizeof(from->vendorId));
-+ memcpy(from->productId, to->productId, sizeof(from->productId));
-+ from->serialNumber = cpu_to_le32(to->serialNumber);
-+ from->pciDeviceVendor = cpu_to_le32(to->pciDeviceVendor);
-+ from->pciDeviceId = cpu_to_le32(to->pciDeviceId);
-+ from->pciSubsysVendor = cpu_to_le32(to->pciSubsysVendor);
-+ from->pciSubsysId = cpu_to_le32(to->pciSubsysId);
-+ from->crumbs = cpu_to_le32(to->crumbs);
-+ from->enterpriseNumber = cpu_to_le32(to->enterpriseNumber);
-+ from->mtu = cpu_to_le32(to->mtu);
-+ from->reserved0 = cpu_to_le32(to->reserved0);
-+ from->crumbs2 = cpu_to_le32(to->crumbs2);
-+ memcpy(from->acSerialNumber, to->acSerialNumber,
-+ sizeof(from->acSerialNumber));
-+ from->crumbs3 = cpu_to_le32(to->crumbs3);
-+ memcpy(from->reserved1, to->reserved1, sizeof(from->reserved1));
-+ break;
-+ }
-+}
-+
-+static void
-+__xlate_driver_info(INT_FLASH_DRIVER_PARAM *from,
-+ INT_FLASH_DRIVER_PARAM *to, uint8_t direction)
-+{
-+ switch (direction) {
-+ case GET_DATA:
-+ from->DiscoveryTimeOut = le16_to_cpu(to->DiscoveryTimeOut);
-+ from->PortDownTimeout = le16_to_cpu(to->PortDownTimeout);
-+ memcpy(from->Reserved, to->Reserved, sizeof(from->Reserved));
-+ break;
-+
-+ case SET_DATA:
-+ from->DiscoveryTimeOut = cpu_to_le32(to->DiscoveryTimeOut);
-+ from->PortDownTimeout = cpu_to_le32(to->PortDownTimeout);
-+ memcpy(from->Reserved, to->Reserved, sizeof(from->Reserved));
-+ break;
-+ }
-+}
-+
-+static void
-+__xlate_init_fw_ctrl_blk(INIT_FW_CTRL_BLK *from,
-+ INIT_FW_CTRL_BLK *to, uint8_t direction)
-+{
-+ switch (direction) {
-+ case GET_DATA:
-+ from->Version = to->Version;
-+ from->Control = to->Control;
-+ from->FwOptions = le16_to_cpu(to->FwOptions);
-+ from->ExecThrottle = le16_to_cpu(to->ExecThrottle);
-+ from->RetryCount = to->RetryCount;
-+ from->RetryDelay = to->RetryDelay;
-+ from->MaxEthFrPayloadSize = le16_to_cpu(to->MaxEthFrPayloadSize);
-+ from->AddFwOptions = le16_to_cpu(to->AddFwOptions);
-+ from->HeartbeatInterval = to->HeartbeatInterval;
-+ from->InstanceNumber = to->InstanceNumber;
-+ from->RES2 = le16_to_cpu(to->RES2);
-+ from->ReqQConsumerIndex = le16_to_cpu(to->ReqQConsumerIndex);
-+ from->ComplQProducerIndex = le16_to_cpu(to->ComplQProducerIndex);
-+ from->ReqQLen = le16_to_cpu(to->ReqQLen);
-+ from->ComplQLen = le16_to_cpu(to->ComplQLen);
-+ from->ReqQAddrLo = le32_to_cpu(to->ReqQAddrLo);
-+ from->ReqQAddrHi = le32_to_cpu(to->ReqQAddrHi);
-+ from->ComplQAddrLo = le32_to_cpu(to->ComplQAddrLo);
-+ from->ComplQAddrHi = le32_to_cpu(to->ComplQAddrHi);
-+ from->ShadowRegBufAddrLo= le32_to_cpu(to->ShadowRegBufAddrLo);
-+ from->ShadowRegBufAddrHi= le32_to_cpu(to->ShadowRegBufAddrHi);
-+ from->iSCSIOptions = le16_to_cpu(to->iSCSIOptions);
-+ from->TCPOptions = le16_to_cpu(to->TCPOptions);
-+ from->IPOptions = le16_to_cpu(to->IPOptions);
-+ from->MaxPDUSize = le16_to_cpu(to->MaxPDUSize);
-+ from->RcvMarkerInt = le16_to_cpu(to->RcvMarkerInt);
-+ from->SndMarkerInt = le16_to_cpu(to->SndMarkerInt);
-+ from->InitMarkerlessInt = le16_to_cpu(to->InitMarkerlessInt);
-+ from->FirstBurstSize = le16_to_cpu(to->FirstBurstSize);
-+ from->DefaultTime2Wait = le16_to_cpu(to->DefaultTime2Wait);
-+ from->DefaultTime2Retain= le16_to_cpu(to->DefaultTime2Retain);
-+ from->MaxOutStndngR2T = le16_to_cpu(to->MaxOutStndngR2T);
-+ from->KeepAliveTimeout = le16_to_cpu(to->KeepAliveTimeout);
-+ from->PortNumber = le16_to_cpu(to->PortNumber);
-+ from->MaxBurstSize = le16_to_cpu(to->MaxBurstSize);
-+ from->RES4 = le32_to_cpu(to->RES4);
-+ memcpy(from->IPAddr, to->IPAddr, sizeof(from->IPAddr));
-+ memcpy(from->RES5, to->RES5, sizeof(from->RES5));
-+ memcpy(from->SubnetMask, to->SubnetMask,
-+ sizeof(from->SubnetMask));
-+ memcpy(from->RES6, to->RES6, sizeof(from->RES6));
-+ memcpy(from->GatewayIPAddr, to->GatewayIPAddr,
-+ sizeof(from->GatewayIPAddr));
-+ memcpy(from->RES7, to->RES7, sizeof(from->RES7));
-+ memcpy(from->PriDNSIPAddr, to->PriDNSIPAddr,
-+ sizeof(from->PriDNSIPAddr));
-+ memcpy(from->SecDNSIPAddr, to->SecDNSIPAddr,
-+ sizeof(from->SecDNSIPAddr));
-+ memcpy(from->RES8, to->RES8, sizeof(from->RES8));
-+ memcpy(from->Alias, to->Alias, sizeof(from->Alias));
-+ memcpy(from->TargAddr, to->TargAddr, sizeof(from->TargAddr));
-+ memcpy(from->CHAPNameSecretsTable, to->CHAPNameSecretsTable,
-+ sizeof(from->CHAPNameSecretsTable));
-+ memcpy(from->EthernetMACAddr, to->EthernetMACAddr,
-+ sizeof(from->EthernetMACAddr));
-+ from->TargetPortalGroup = le16_to_cpu(to->TargetPortalGroup);
-+ from->SendScale = to->SendScale;
-+ from->RecvScale = to->RecvScale;
-+ from->TypeOfService = to->TypeOfService;
-+ from->Time2Live = to->Time2Live;
-+ from->VLANPriority = le16_to_cpu(to->VLANPriority);
-+ from->Reserved8 = le16_to_cpu(to->Reserved8);
-+ memcpy(from->SecIPAddr, to->SecIPAddr, sizeof(from->SecIPAddr));
-+ memcpy(from->Reserved9, to->Reserved9, sizeof(from->Reserved9));
-+ memcpy(from->iSNSIPAddr, to->iSNSIPAddr,
-+ sizeof(from->iSNSIPAddr));
-+ memcpy(from->Reserved10, to->Reserved10,
-+ sizeof(from->Reserved10));
-+ from->iSNSClientPortNumber =
-+ le16_to_cpu(to->iSNSClientPortNumber);
-+ from->iSNSServerPortNumber =
-+ le16_to_cpu(to->iSNSServerPortNumber);
-+ from->iSNSSCNPortNumber = le16_to_cpu(to->iSNSSCNPortNumber);
-+ from->iSNSESIPortNumber = le16_to_cpu(to->iSNSESIPortNumber);
-+ memcpy(from->SLPDAIPAddr, to->SLPDAIPAddr,
-+ sizeof(from->SLPDAIPAddr));
-+ memcpy(from->Reserved11, to->Reserved11,
-+ sizeof(from->Reserved11));
-+ memcpy(from->iSCSINameString, to->iSCSINameString,
-+ sizeof(from->iSCSINameString));
-+ break;
-+
-+ case SET_DATA:
-+ from->Version = to->Version;
-+ from->Control = to->Control;
-+ from->FwOptions = cpu_to_le16(to->FwOptions);
-+ from->ExecThrottle = cpu_to_le16(to->ExecThrottle);
-+ from->RetryCount = to->RetryCount;
-+ from->RetryDelay = to->RetryDelay;
-+ from->MaxEthFrPayloadSize = cpu_to_le16(to->MaxEthFrPayloadSize);
-+ from->AddFwOptions = cpu_to_le16(to->AddFwOptions);
-+ from->HeartbeatInterval = to->HeartbeatInterval;
-+ from->InstanceNumber = to->InstanceNumber;
-+ from->RES2 = cpu_to_le16(to->RES2);
-+ from->ReqQConsumerIndex = cpu_to_le16(to->ReqQConsumerIndex);
-+ from->ComplQProducerIndex = cpu_to_le16(to->ComplQProducerIndex);
-+ from->ReqQLen = cpu_to_le16(to->ReqQLen);
-+ from->ComplQLen = cpu_to_le16(to->ComplQLen);
-+ from->ReqQAddrLo = cpu_to_le32(to->ReqQAddrLo);
-+ from->ReqQAddrHi = cpu_to_le32(to->ReqQAddrHi);
-+ from->ComplQAddrLo = cpu_to_le32(to->ComplQAddrLo);
-+ from->ComplQAddrHi = cpu_to_le32(to->ComplQAddrHi);
-+ from->ShadowRegBufAddrLo= cpu_to_le32(to->ShadowRegBufAddrLo);
-+ from->ShadowRegBufAddrHi= cpu_to_le32(to->ShadowRegBufAddrHi);
-+ from->iSCSIOptions = cpu_to_le16(to->iSCSIOptions);
-+ from->TCPOptions = cpu_to_le16(to->TCPOptions);
-+ from->IPOptions = cpu_to_le16(to->IPOptions);
-+ from->MaxPDUSize = cpu_to_le16(to->MaxPDUSize);
-+ from->RcvMarkerInt = cpu_to_le16(to->RcvMarkerInt);
-+ from->SndMarkerInt = cpu_to_le16(to->SndMarkerInt);
-+ from->InitMarkerlessInt = cpu_to_le16(to->InitMarkerlessInt);
-+ from->FirstBurstSize = cpu_to_le16(to->FirstBurstSize);
-+ from->DefaultTime2Wait = cpu_to_le16(to->DefaultTime2Wait);
-+ from->DefaultTime2Retain= cpu_to_le16(to->DefaultTime2Retain);
-+ from->MaxOutStndngR2T = cpu_to_le16(to->MaxOutStndngR2T);
-+ from->KeepAliveTimeout = cpu_to_le16(to->KeepAliveTimeout);
-+ from->PortNumber = cpu_to_le16(to->PortNumber);
-+ from->MaxBurstSize = cpu_to_le16(to->MaxBurstSize);
-+ from->RES4 = cpu_to_le32(to->RES4);
-+ memcpy(from->IPAddr, to->IPAddr, sizeof(from->IPAddr));
-+ memcpy(from->RES5, to->RES5, sizeof(from->RES5));
-+ memcpy(from->SubnetMask, to->SubnetMask,
-+ sizeof(from->SubnetMask));
-+ memcpy(from->RES6, to->RES6, sizeof(from->RES6));
-+ memcpy(from->GatewayIPAddr, to->GatewayIPAddr,
-+ sizeof(from->GatewayIPAddr));
-+ memcpy(from->RES7, to->RES7, sizeof(from->RES7));
-+ memcpy(from->PriDNSIPAddr, to->PriDNSIPAddr,
-+ sizeof(from->PriDNSIPAddr));
-+ memcpy(from->SecDNSIPAddr, to->SecDNSIPAddr,
-+ sizeof(from->SecDNSIPAddr));
-+ memcpy(from->RES8, to->RES8, sizeof(from->RES8));
-+ memcpy(from->Alias, to->Alias, sizeof(from->Alias));
-+ memcpy(from->TargAddr, to->TargAddr, sizeof(from->TargAddr));
-+ memcpy(from->CHAPNameSecretsTable, to->CHAPNameSecretsTable,
-+ sizeof(from->CHAPNameSecretsTable));
-+ memcpy(from->EthernetMACAddr, to->EthernetMACAddr,
-+ sizeof(from->EthernetMACAddr));
-+ from->TargetPortalGroup = cpu_to_le16(to->TargetPortalGroup);
-+ from->SendScale = to->SendScale;
-+ from->RecvScale = to->RecvScale;
-+ from->TypeOfService = to->TypeOfService;
-+ from->Time2Live = to->Time2Live;
-+ from->VLANPriority = cpu_to_le16(to->VLANPriority);
-+ from->Reserved8 = cpu_to_le16(to->Reserved8);
-+ memcpy(from->SecIPAddr, to->SecIPAddr, sizeof(from->SecIPAddr));
-+ memcpy(from->Reserved9, to->Reserved9, sizeof(from->Reserved9));
-+ memcpy(from->iSNSIPAddr, to->iSNSIPAddr,
-+ sizeof(from->iSNSIPAddr));
-+ memcpy(from->Reserved10, to->Reserved10,
-+ sizeof(from->Reserved10));
-+ from->iSNSClientPortNumber =
-+ cpu_to_le16(to->iSNSClientPortNumber);
-+ from->iSNSServerPortNumber =
-+ cpu_to_le16(to->iSNSServerPortNumber);
-+ from->iSNSSCNPortNumber = cpu_to_le16(to->iSNSSCNPortNumber);
-+ from->iSNSESIPortNumber = cpu_to_le16(to->iSNSESIPortNumber);
-+ memcpy(from->SLPDAIPAddr, to->SLPDAIPAddr,
-+ sizeof(from->SLPDAIPAddr));
-+ memcpy(from->Reserved11, to->Reserved11,
-+ sizeof(from->Reserved11));
-+ memcpy(from->iSCSINameString, to->iSCSINameString,
-+ sizeof(from->iSCSINameString));
-+ break;
-+ }
-+}
-+
-+static void
-+__xlate_dev_db(DEV_DB_ENTRY *from, DEV_DB_ENTRY *to,
-+ uint8_t direction)
-+{
-+ switch (direction) {
-+ case GET_DATA:
-+ from->options = to->options;
-+ from->control = to->control;
-+ from->exeThrottle = le16_to_cpu(to->exeThrottle);
-+ from->exeCount = le16_to_cpu(to->exeCount);
-+ from->retryCount = to->retryCount;
-+ from->retryDelay = to->retryDelay;
-+ from->iSCSIOptions = le16_to_cpu(to->iSCSIOptions);
-+ from->TCPOptions = le16_to_cpu(to->TCPOptions);
-+ from->IPOptions = le16_to_cpu(to->IPOptions);
-+ from->maxPDUSize = le16_to_cpu(to->maxPDUSize);
-+ from->rcvMarkerInt = le16_to_cpu(to->rcvMarkerInt);
-+ from->sndMarkerInt = le16_to_cpu(to->sndMarkerInt);
-+ from->iSCSIMaxSndDataSegLen =
-+ le16_to_cpu(to->iSCSIMaxSndDataSegLen);
-+ from->firstBurstSize = le16_to_cpu(to->firstBurstSize);
-+ from->minTime2Wait = le16_to_cpu(to->minTime2Wait);
-+ from->maxTime2Retain = le16_to_cpu(to->maxTime2Retain);
-+ from->maxOutstndngR2T = le16_to_cpu(to->maxOutstndngR2T);
-+ from->keepAliveTimeout = le16_to_cpu(to->keepAliveTimeout);
-+ memcpy(from->ISID, to->ISID, sizeof(from->ISID));
-+ from->TSID = le16_to_cpu(to->TSID);
-+ from->portNumber = le16_to_cpu(to->portNumber);
-+ from->maxBurstSize = le16_to_cpu(to->maxBurstSize);
-+ from->taskMngmntTimeout = le16_to_cpu(to->taskMngmntTimeout);
-+ from->reserved1 = le16_to_cpu(to->reserved1);
-+ memcpy(from->ipAddr, to->ipAddr, sizeof(from->ipAddr));
-+ memcpy(from->iSCSIAlias, to->iSCSIAlias,
-+ sizeof(from->iSCSIAlias));
-+ memcpy(from->targetAddr, to->targetAddr,
-+ sizeof(from->targetAddr));
-+ memcpy(from->userID, to->userID, sizeof(from->userID));
-+ memcpy(from->password, to->password, sizeof(from->password));
-+ memcpy(from->iscsiName, to->iscsiName, sizeof(from->iscsiName));
-+ from->ddbLink = le16_to_cpu(to->ddbLink);
-+ from->CHAPTableIndex = le16_to_cpu(to->CHAPTableIndex);
-+ memcpy(from->reserved2, to->reserved2, sizeof(from->reserved2));
-+ from->Cookie = le16_to_cpu(to->Cookie);
-+ break;
-+
-+ case SET_DATA:
-+ from->options = to->options;
-+ from->control = to->control;
-+ from->exeThrottle = cpu_to_le16(to->exeThrottle);
-+ from->exeCount = cpu_to_le16(to->exeCount);
-+ from->retryCount = to->retryCount;
-+ from->retryDelay = to->retryDelay;
-+ from->iSCSIOptions = cpu_to_le16(to->iSCSIOptions);
-+ from->TCPOptions = cpu_to_le16(to->TCPOptions);
-+ from->IPOptions = cpu_to_le16(to->IPOptions);
-+ from->maxPDUSize = cpu_to_le16(to->maxPDUSize);
-+ from->rcvMarkerInt = cpu_to_le16(to->rcvMarkerInt);
-+ from->sndMarkerInt = cpu_to_le16(to->sndMarkerInt);
-+ from->iSCSIMaxSndDataSegLen =
-+ cpu_to_le16(to->iSCSIMaxSndDataSegLen);
-+ from->firstBurstSize = cpu_to_le16(to->firstBurstSize);
-+ from->minTime2Wait = cpu_to_le16(to->minTime2Wait);
-+ from->maxTime2Retain = cpu_to_le16(to->maxTime2Retain);
-+ from->maxOutstndngR2T = cpu_to_le16(to->maxOutstndngR2T);
-+ from->keepAliveTimeout = cpu_to_le16(to->keepAliveTimeout);
-+ memcpy(from->ISID, to->ISID, sizeof(from->ISID));
-+ from->TSID = cpu_to_le16(to->TSID);
-+ from->portNumber = cpu_to_le16(to->portNumber);
-+ from->maxBurstSize = cpu_to_le16(to->maxBurstSize);
-+ from->taskMngmntTimeout = cpu_to_le16(to->taskMngmntTimeout);
-+ from->reserved1 = cpu_to_le16(to->reserved1);
-+ memcpy(from->ipAddr, to->ipAddr, sizeof(from->ipAddr));
-+ memcpy(from->iSCSIAlias, to->iSCSIAlias,
-+ sizeof(from->iSCSIAlias));
-+ memcpy(from->targetAddr, to->targetAddr,
-+ sizeof(from->targetAddr));
-+ memcpy(from->userID, to->userID, sizeof(from->userID));
-+ memcpy(from->password, to->password, sizeof(from->password));
-+ memcpy(from->iscsiName, to->iscsiName, sizeof(from->iscsiName));
-+ from->ddbLink = cpu_to_le16(to->ddbLink);
-+ from->CHAPTableIndex = cpu_to_le16(to->CHAPTableIndex);
-+ memcpy(from->reserved2, to->reserved2, sizeof(from->reserved2));
-+ from->Cookie = cpu_to_le16(to->Cookie);
-+ break;
-+ }
-+}
-+
-+static void
-+__xlate_chap(CHAP_ENTRY *from, CHAP_ENTRY *to, uint8_t direction)
-+{
-+ switch (direction) {
-+ case GET_DATA:
-+ from->link = le16_to_cpu(to->link);
-+ from->flags = to->flags;
-+ from->secretLength = to->secretLength;
-+ memcpy(from->secret, to->secret, sizeof(from->secret));
-+ memcpy(from->user_name, to->user_name, sizeof(from->user_name));
-+ from->reserved = le16_to_cpu(to->reserved);
-+ from->cookie = le16_to_cpu(to->cookie);
-+ break;
-+
-+ case SET_DATA:
-+ from->link = cpu_to_le16(to->link);
-+ from->flags = to->flags;
-+ from->secretLength = to->secretLength;
-+ memcpy(from->secret, to->secret, sizeof(from->secret));
-+ memcpy(from->user_name, to->user_name, sizeof(from->user_name));
-+ from->reserved = cpu_to_le16(to->reserved);
-+ from->cookie = cpu_to_le16(to->cookie);
-+ break;
-+ }
-+}
-+#endif
-+
-+/**************************************************************************
-+ * qla4intioctl_get_flash
-+ * This routine reads the requested area of FLASH.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4intioctl_get_flash(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ void *local_dma_bufv = NULL;
-+ dma_addr_t local_dma_bufp;
-+ INT_ACCESS_FLASH *paccess_flash = NULL;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /*
-+ * Allocate local flash buffer
-+ */
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&paccess_flash,
-+ sizeof(INT_ACCESS_FLASH))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(INT_ACCESS_FLASH)));
-+ goto exit_get_flash;
-+ }
-+
-+ /*
-+ * Copy user's data to local flash buffer
-+ */
-+ if ((status = copy_from_user((uint8_t *)paccess_flash,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(INT_ACCESS_FLASH))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_flash;
-+ }
-+
-+ /*
-+ * Allocate DMA memory
-+ */
-+ local_dma_bufv = pci_alloc_consistent(ha->pdev, paccess_flash->DataLen,
-+ &local_dma_bufp);
-+ if (local_dma_bufv == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to allocate dma memory\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_get_flash;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: offset=%08x, len=%08x\n",
-+ ha->host_no, __func__,
-+ paccess_flash->DataOffset, paccess_flash->DataLen));
-+
-+ /*
-+ * Issue Mailbox Command
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(local_dma_bufp);
-+ mbox_cmd[2] = MSDW(local_dma_bufp);
-+ mbox_cmd[3] = paccess_flash->DataOffset;
-+ mbox_cmd[4] = paccess_flash->DataLen;
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_get_flash;
-+ }
-+
-+ //FIXME: For byte-order support, this entire structure must be translated
-+#if BYTE_ORDER_SUPPORT_ENABLED
-+ /*
-+ * Copy data from DMA buffer into access_flash->FlashData buffer
-+ * (in the process, translating for byte-order support, if necessary)
-+ */
-+ switch (paccess_flash->DataOffset & INT_ISCSI_PAGE_MASK) {
-+ case INT_ISCSI_FW_IMAGE2_FLASH_OFFSET:
-+ case INT_ISCSI_FW_IMAGE1_FLASH_OFFSET:
-+ break;
-+ case INT_ISCSI_SYSINFO_FLASH_OFFSET:
-+ __xlate_sys_info((FLASH_SYS_INFO *) local_dma_bufv,
-+ (FLASH_SYS_INFO *) &paccess_flash->FlashData[0],
-+ ioctl->SubCode);
-+ break;
-+ case INT_ISCSI_DRIVER_FLASH_OFFSET:
-+ __xlate_driver_info((INT_FLASH_DRIVER_PARAM *) local_dma_bufv,
-+ (INT_FLASH_DRIVER_PARAM *) &paccess_flash->FlashData[0],
-+ ioctl->SubCode);
-+ break;
-+ case INT_ISCSI_INITFW_FLASH_OFFSET:
-+ __xlate_init_fw_ctrl_blk((INIT_FW_CTRL_BLK *) local_dma_bufv,
-+ (INIT_FW_CTRL_BLK *) &paccess_flash->FlashData[0],
-+ ioctl->SubCode);
-+ break;
-+ case INT_ISCSI_DDB_FLASH_OFFSET:
-+ __xlate_dev_db((DEV_DB_ENTRY *)local_dma_bufv,
-+ (DEV_DB_ENTRY *) &paccess_flash->FlashData[0],
-+ ioctl->SubCode);
-+ break;
-+ case INT_ISCSI_CHAP_FLASH_OFFSET:
-+ __xlate_chap((CHAP_ENTRY *) local_dma_bufv,
-+ (CHAP_ENTRY *) &paccess_flash->FlashData[0],
-+ ioctl->SubCode);
-+ break;
-+ }
-+#else
-+ memcpy(&paccess_flash->FlashData[0], local_dma_bufv,
-+ MIN(paccess_flash->DataLen, sizeof(paccess_flash->FlashData)));
-+
-+#endif
-+
-+ /*
-+ * Copy local DMA buffer to user's response data area
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ paccess_flash, sizeof(*paccess_flash))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_flash;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ ioctl->ResponseLen = paccess_flash->DataLen;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("INT_ACCESS_FLASH buffer (1st 60h bytes only):\n"));
-+ qla4xxx_dump_bytes(QLP4|QLP10, paccess_flash, 0x60);
-+
-+exit_get_flash:
-+
-+ if (local_dma_bufv)
-+ pci_free_consistent(ha->pdev,
-+ paccess_flash->DataLen, local_dma_bufv, local_dma_bufp);
-+
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_get_driver_debug_level
-+ * This routine retrieves the driver's debug print level.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4intioctl_get_driver_debug_level(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t dbg_level;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_debug_level(&dbg_level) == QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to set debug level, "
-+ "debug driver not loaded!\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto exit_get_driver_debug_level;
-+ }
-+
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ &dbg_level, sizeof(dbg_level))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to copy data\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_driver_debug_level;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: debug level is %04x\n",
-+ ha->host_no, __func__, dbg_level));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_get_driver_debug_level:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_get_host_no
-+ * This routine retrieves the host number for the specified adapter
-+ * instance.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4intioctl_get_host_no(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ &(ha->host_no), sizeof(ha->host_no))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to copy data\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ } else {
-+ ioctl->Status = EXT_STATUS_OK;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_get_data
-+ * This routine calls get data IOCTLs based on the IOCTL Sub Code.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ * -EINVAL = if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_get_data(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+ switch (ioctl->SubCode) {
-+ case INT_SC_GET_FLASH:
-+ status = qla4intioctl_get_flash(ha, ioctl);
-+ break;
-+ case INT_SC_GET_DRIVER_DEBUG_LEVEL:
-+ status = qla4intioctl_get_driver_debug_level(ha, ioctl);
-+ break;
-+ case INT_SC_GET_HOST_NO:
-+ status = qla4intioctl_get_host_no(ha, ioctl);
-+ break;
-+ default:
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unsupported internal get data "
-+ "sub-command code (%X)\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ return status;
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_set_flash
-+ * This routine writes the requested area of FLASH.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4intioctl_set_flash(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ INT_ACCESS_FLASH *paccess_flash;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /*
-+ * Allocate local flash buffer
-+ */
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&paccess_flash,
-+ sizeof(INT_ACCESS_FLASH))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(INT_ACCESS_FLASH)));
-+ goto exit_set_flash;
-+ }
-+
-+ /*
-+ * Copy user's data to local DMA buffer
-+ */
-+ if ((status = copy_from_user((uint8_t *)paccess_flash,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(INT_ACCESS_FLASH))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_set_flash;
-+ }
-+
-+ /*
-+ * Resizr IOCTL DMA memory, if necesary
-+ */
-+ if ((paccess_flash->DataLen != 0) &&
-+ (ha->ioctl_dma_buf_len < paccess_flash->DataLen)) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha, paccess_flash->DataLen) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_set_flash;
-+ }
-+ }
-+
-+ //FIXME: For byte-order support, this entire structure must be translated
-+#if BYTE_ORDER_SUPPORT_ENABLED
-+ /*
-+ * Copy data from DMA buffer into access_flash->FlashData buffer
-+ * (in the process, translating for byte-order support, if necessary)
-+ */
-+ switch (paccess_flash->DataOffset & INT_ISCSI_PAGE_MASK) {
-+ case INT_ISCSI_FW_IMAGE2_FLASH_OFFSET:
-+ case INT_ISCSI_FW_IMAGE1_FLASH_OFFSET:
-+ break;
-+ case INT_ISCSI_SYSINFO_FLASH_OFFSET:
-+ __xlate_sys_info((FLASH_SYS_INFO *)&paccess_flash->FlashData[0],
-+ (FLASH_SYS_INFO *) ha->ioctl_dma_bufv, SET_DATA);
-+ break;
-+ case INT_ISCSI_DRIVER_FLASH_OFFSET:
-+ __xlate_driver_info(
-+ (INT_FLASH_DRIVER_PARAM *) &paccess_flash->FlashData[0],
-+ (INT_FLASH_DRIVER_PARAM *) ha->ioctl_dma_bufv,
-+ SET_DATA);
-+ break;
-+ case INT_ISCSI_INITFW_FLASH_OFFSET:
-+ __xlate_init_fw_ctrl_blk(
-+ (INIT_FW_CTRL_BLK *) &paccess_flash->FlashData[0],
-+ (INIT_FW_CTRL_BLK *) ha->ioctl_dma_bufv, SET_DATA);
-+ break;
-+ case INT_ISCSI_DDB_FLASH_OFFSET:
-+ __xlate_dev_db((DEV_DB_ENTRY *) &paccess_flash->FlashData[0],
-+ (DEV_DB_ENTRY *) ha->ioctl_dma_bufv, SET_DATA);
-+ break;
-+ case INT_ISCSI_CHAP_FLASH_OFFSET:
-+ __xlate_chap((CHAP_ENTRY *) &paccess_flash->FlashData[0],
-+ (CHAP_ENTRY *) ha->ioctl_dma_bufv, SET_DATA);
-+ break;
-+ }
-+#else
-+ memcpy(ha->ioctl_dma_bufv, &paccess_flash->FlashData[0],
-+ MIN(ha->ioctl_dma_buf_len, sizeof(paccess_flash->FlashData)));
-+
-+#endif
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: offset=%08x, len=%08x\n",
-+ ha->host_no, __func__,
-+ paccess_flash->DataOffset, paccess_flash->DataLen));
-+
-+ /*
-+ * Issue Mailbox Command
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_WRITE_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = paccess_flash->DataOffset;
-+ mbox_cmd[4] = paccess_flash->DataLen;
-+ mbox_cmd[5] = paccess_flash->Options;
-+
-+ if (qla4xxx_mailbox_command(ha, 6, 2, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->VendorSpecificStatus[0] = mbox_sts[1];
-+ goto exit_set_flash;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ ioctl->ResponseLen = paccess_flash->DataLen;
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d): INT_ACCESS_FLASH buffer (1st 60h bytes only:\n",
-+ ha->host_no));
-+ qla4xxx_dump_bytes(QLP4|QLP10, ha->ioctl_dma_bufv, 0x60);
-+
-+exit_set_flash:
-+ /*
-+ * Free Memory
-+ */
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_set_driver_debug_level
-+ * This routine sets the driver's debug print level.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4intioctl_set_driver_debug_level(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t dbg_level;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if ((status = copy_from_user(&dbg_level,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(dbg_level))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to copy data\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_set_driver_debug_level;
-+ }
-+
-+ if (qla4xxx_set_debug_level(dbg_level) == QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to set debug level, "
-+ "debug driver not loaded!\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto exit_set_driver_debug_level;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: debug level set to 0x%04X\n",
-+ ha->host_no, __func__, dbg_level));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_set_driver_debug_level:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_set_data
-+ * This routine calls set data IOCTLs based on the IOCTL Sub Code.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ * -EINVAL = if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_set_data(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+ switch (ioctl->SubCode) {
-+ case INT_SC_SET_FLASH:
-+ status = qla4intioctl_set_flash(ha, ioctl);
-+ break;
-+ case INT_SC_SET_DRIVER_DEBUG_LEVEL:
-+ status = qla4intioctl_set_driver_debug_level(ha, ioctl);
-+ break;
-+ default:
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unsupported internal set data "
-+ "sub-command code (%X)\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ return status;
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_hba_reset
-+ * This routine resets the specified HBA.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_hba_reset(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ uint8_t status = 0;
-+ u_long wait_count;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ switch (ioctl->SubCode) {
-+ case INT_SC_HBA_RESET:
-+ case INT_SC_FIRMWARE_RESET:
-+ set_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags);
-+
-+ /* Wait a fixed amount of time for reset to complete */
-+ wait_count = jiffies + ADAPTER_RESET_TOV * HZ;
-+ while (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST,
-+ &ha->dpc_flags) != 0) {
-+ if (wait_count <= jiffies)
-+ break;
-+
-+ /* wait for 1 second */
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1*HZ);
-+ }
-+
-+ if (test_bit(AF_ONLINE, &ha->flags)) {
-+ QL4PRINT(QLP4, printk("scsi%d: %s: Succeeded\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_OK;
-+ } else {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: FAILED\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ }
-+
-+ break;
-+
-+ case INT_SC_TARGET_WARM_RESET:
-+ case INT_SC_LUN_RESET:
-+ default:
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: not supported.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_copy_fw_flash
-+ * This routine requests copying the FW image in FLASH from primary-to-
-+ * secondary or secondary-to-primary.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_copy_fw_flash(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ INT_COPY_FW_FLASH copy_flash;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if ((status = copy_from_user((uint8_t *)&copy_flash,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), ioctl->RequestLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_copy_flash;
-+ }
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_COPY_FLASH;
-+ mbox_cmd[1] = copy_flash.Options;
-+
-+ if (qla4xxx_mailbox_command(ha, 2, 2, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: %s: Succeeded\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ } else {
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: %s: FAILED\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->VendorSpecificStatus[0] = mbox_sts[1];
-+ }
-+
-+exit_copy_flash:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_iocb_pass_done
-+ * This routine resets the ioctl progress flag and wakes up the ioctl
-+ * completion semaphore.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * sts_entry - pointer to passthru status buffer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_iocb_pass_done(scsi_qla_host_t *ha, PASSTHRU_STATUS_ENTRY *sts_entry)
-+{
-+ INT_IOCB_PASSTHRU *iocb;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /* --- Copy passthru status buffer to iocb passthru buffer ---*/
-+ iocb = (INT_IOCB_PASSTHRU *)(ulong)le32_to_cpu(sts_entry->handle);
-+ memcpy(iocb->IOCBStatusBuffer, sts_entry,
-+ MIN(sizeof(iocb->IOCBStatusBuffer), sizeof(*sts_entry)));
-+
-+ /* --- Reset IOCTL flags and wakeup semaphore.
-+ * But first check to see if IOCTL has already
-+ * timed out because we don't want to get the
-+ * up/down semaphore counters off. --- */
-+ if (ha->ioctl->ioctl_iocb_pass_in_progress == 1) {
-+ ha->ioctl->ioctl_iocb_pass_in_progress = 0;
-+ ha->ioctl->ioctl_tov = 0;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("%s: UP count=%d\n", __func__,
-+ atomic_read(&ha->ioctl->ioctl_cmpl_sem.count)));
-+ up(&ha->ioctl->ioctl_cmpl_sem);
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return;
-+}
-+
-+/**************************************************************************
-+ * qla4intioctl_iocb_passthru
-+ * This routine
-+ *
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4intioctl_iocb_passthru(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ INT_IOCB_PASSTHRU *iocb;
-+ INT_IOCB_PASSTHRU *iocb_dma;
-+ PASSTHRU0_ENTRY *passthru_entry;
-+ unsigned long flags;
-+ DATA_SEG_A64 *data_seg;
-+
-+
-+ ENTER("qla4intioctl_iocb_passthru");
-+ QL4PRINT(QLP3, printk("scsi%d: %s:\n", ha->host_no, __func__));
-+
-+ /* --- Use internal DMA buffer for iocb structure --- */
-+
-+ if (ha->ioctl_dma_buf_len < sizeof(*iocb))
-+ qla4xxx_resize_ioctl_dma_buf(ha, sizeof(*iocb));
-+
-+ if (!ha->ioctl_dma_bufv || ha->ioctl_dma_buf_len < sizeof(*iocb)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: dma buffer inaccessible.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_iocb_passthru;
-+ }
-+
-+ iocb = (INT_IOCB_PASSTHRU *) ha->ioctl_dma_bufv;
-+ iocb_dma = (INT_IOCB_PASSTHRU *)(unsigned long)ha->ioctl_dma_bufp;
-+
-+ /* --- Copy IOCB_PASSTHRU structure from user space --- */
-+ if ((status = copy_from_user((uint8_t *)iocb,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), ioctl->RequestLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_iocb_passthru;
-+ }
-+
-+ if ((iocb->IOCBCmdBuffer[0x00] == 0x3A) &&
-+ (iocb->IOCBCmdBuffer[0x0A] == 0x80) &&
-+ (iocb->IOCBCmdBuffer[0x0B] == 0x10) &&
-+ (iocb->SendData[0x0C] == 0x81) &&
-+ (iocb->SendData[0x0D] == 0x4F)) {
-+ // ok to process command, proceed ...
-+ } else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: unable to process command. "
-+ "Did not pass secure I/O boundary check.\n",
-+ ha->host_no, __func__));
-+ QL4PRINT(QLP2, printk("IOCBCmdBuffer[0x00] = 0x%x, expecting 0x3A\n", iocb->IOCBCmdBuffer[0x00]));
-+ QL4PRINT(QLP2, printk("IOCBCmdBuffer[0x0A] = 0x%x, expecting 0x80\n", iocb->IOCBCmdBuffer[0x0A]));
-+ QL4PRINT(QLP2, printk("IOCBCmdBuffer[0x0B] = 0x%x, expecting 0x10\n", iocb->IOCBCmdBuffer[0x0B]));
-+ QL4PRINT(QLP2, printk("SendData[0x0C] = 0x%x, expecting 0x81\n", iocb->SendData[0x0C]));
-+ QL4PRINT(QLP2, printk("SendData[0x0D] = 0x%x, expecting 0x4F\n", iocb->SendData[0x0D]));
-+ status = (-EFAULT);
-+ ioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ goto exit_iocb_passthru;
-+ }
-+
-+ /* --- Get pointer to the passthru queue entry --- */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ if (qla4xxx_get_req_pkt(ha, (QUEUE_ENTRY **) &passthru_entry) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: request queue full, try again later\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_HBA_QUEUE_FULL;
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ goto exit_iocb_passthru;
-+ }
-+
-+ /* --- Fill in passthru queue entry --- */
-+ if (iocb->SendDMAOffset) {
-+ data_seg = (DATA_SEG_A64 *)(iocb->IOCBCmdBuffer +
-+ iocb->SendDMAOffset);
-+ data_seg->base.addrHigh =
-+ cpu_to_le32(MSDW((ulong)&iocb_dma->SendData[0]));
-+ data_seg->base.addrLow =
-+ cpu_to_le32(LSDW((ulong)&iocb_dma->SendData[0]));
-+ }
-+
-+ if (iocb->RspDMAOffset) {
-+ data_seg =
-+ (DATA_SEG_A64 *)(iocb->IOCBCmdBuffer + iocb->RspDMAOffset);
-+ data_seg->base.addrHigh =
-+ cpu_to_le32(MSDW((ulong)&iocb_dma->RspData[0]));
-+ data_seg->base.addrLow =
-+ cpu_to_le32(LSDW((ulong)&iocb_dma->RspData[0]));
-+ }
-+
-+ memcpy(passthru_entry, iocb->IOCBCmdBuffer,
-+ MIN(sizeof(*passthru_entry), sizeof(iocb->IOCBCmdBuffer)));
-+ passthru_entry->handle = (uint32_t) (unsigned long) iocb;
-+ passthru_entry->hdr.systemDefined = SD_PASSTHRU_IOCB;
-+
-+ if (passthru_entry->hdr.entryType != ET_PASSTHRU0)
-+ passthru_entry->timeout = MBOX_TOV;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk(KERN_INFO
-+ "scsi%d: Passthru0 IOCB type %x count %x In (%x) %p\n",
-+ ha->host_no, passthru_entry->hdr.entryType,
-+ passthru_entry->hdr.entryCount, ha->request_in, passthru_entry));
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk(KERN_INFO "scsi%d: Dump Passthru entry %p: \n",
-+ ha->host_no, passthru_entry));
-+ qla4xxx_dump_bytes(QLP4|QLP10, passthru_entry, sizeof(*passthru_entry));
-+
-+ /* ---- Prepare for receiving completion ---- */
-+ ha->ioctl->ioctl_iocb_pass_in_progress = 1;
-+ ha->ioctl->ioctl_tov = passthru_entry->timeout * HZ;
-+ qla4xxx_ioctl_sem_init(ha);
-+
-+ /* ---- Send command to adapter ---- */
-+ ha->ioctl->ioctl_cmpl_timer.expires = jiffies + ha->ioctl->ioctl_tov;
-+ add_timer(&ha->ioctl->ioctl_cmpl_timer);
-+
-+ WRT_REG_DWORD(&ha->reg->req_q_in, ha->request_in);
-+ PCI_POSTING(&ha->reg->req_q_in);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ QL4PRINT(QLP4|QLP10, printk("%s: DOWN count=%d\n",
-+ __func__, atomic_read(&ha->ioctl->ioctl_cmpl_sem.count)));
-+
-+ down(&ha->ioctl->ioctl_cmpl_sem);
-+
-+ /*******************************************************
-+ * *
-+ * Passthru Completion *
-+ * *
-+ *******************************************************/
-+ del_timer(&ha->ioctl->ioctl_cmpl_timer);
-+
-+ /* ---- Check for timeout --- */
-+ if (ha->ioctl->ioctl_iocb_pass_in_progress == 1) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: ERROR = command timeout.\n",
-+ ha->host_no, __func__));
-+
-+ ha->ioctl->ioctl_iocb_pass_in_progress = 0;
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto exit_iocb_passthru;
-+ }
-+
-+ /* ---- Copy IOCB Passthru structure with updated status buffer
-+ * to user space ---- */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ iocb, sizeof(INT_IOCB_PASSTHRU))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy passthru struct "
-+ "to user's memory area.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_iocb_passthru;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10, printk("Dump iocb structure (OUT)\n"));
-+ qla4xxx_print_iocb_passthru(QLP4|QLP10, ha, iocb);
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: Succeeded\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_iocb_passthru:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_resize_ioctl_dma_buf
-+ * This routine deallocates the dma_buf of the previous size and re-
-+ * allocates the dma_buf with the given size.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ * size - Size of dma buffer to allocate
-+ *
-+ * Output:
-+ * dma_buf - virt_addr, phys_addr, and buf_len values filled in
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully re-allocates memory
-+ * QLA_ERROR - Failed to re-allocate memory
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_resize_ioctl_dma_buf(scsi_qla_host_t *ha, uint32_t size)
-+{
-+ uint8_t status = 0;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ha->ioctl_dma_buf_len) {
-+ QL4PRINT(QLP3|QLP4,
-+ printk("scsi%d: %s: deallocate old dma_buf, size=0x%x\n",
-+ ha->host_no, __func__, ha->ioctl_dma_buf_len));
-+ pci_free_consistent(ha->pdev, ha->ioctl_dma_buf_len,
-+ ha->ioctl_dma_bufv, ha->ioctl_dma_bufp);
-+ ha->ioctl_dma_buf_len = 0;
-+ ha->ioctl_dma_bufv = 0;
-+ ha->ioctl_dma_bufp = 0;
-+ }
-+
-+ QL4PRINT(QLP3|QLP4,
-+ printk("scsi%d: %s: allocate new ioctl_dma_buf, size=0x%x\n",
-+ ha->host_no, __func__, size));
-+
-+ ha->ioctl_dma_bufv = pci_alloc_consistent(ha->pdev, size,
-+ &ha->ioctl_dma_bufp);
-+ if (ha->ioctl_dma_bufv == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: ERROR allocating new ioctl_dma_buf, "
-+ "size=0x%x\n", ha->host_no, __func__, size));
-+ } else {
-+ ha->ioctl_dma_buf_len = size;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_init.c ./drivers/scsi/qla4xxx/ql4_init.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_init.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_init.c 2006-08-31 14:59:59.000000000 +0400
-@@ -0,0 +1,2992 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_alloc_dma_memory
-+ * qla4xxx_free_dma_memory
-+ * qla4xxx_free_lun
-+ * qla4xxx_free_ddb
-+ * qla4xxx_free_ddb_list
-+ * qla4xxx_init_rings
-+ * qla4xxx_validate_mac_address
-+ * qla4xxx_init_local_data
-+ * qla4xxx_init_firmware
-+ * qla4xxx_send_internal_scsi_passthru
-+ * qla4xxx_send_inquiry_cmd
-+ * qla4xxx_send_report_luns_cmd
-+ * qla4xxx_is_discovered_target
-+ * qla4xxx_update_ddb_entry
-+ * qla4xxx_alloc_lun
-+ * qla4xxx_discover_target_luns
-+ * qla4xxx_map_targets_to_ddbs
-+ * qla4xxx_alloc_ddb
-+ * qla4xxx_build_ddb_list
-+ * qla4xxx_initialize_ddb_list
-+ * qla4xxx_reinitialize_ddb_list
-+ * qla4xxx_relogin_device
-+ * qla4xxx_get_topcat_presence
-+ * qla4xxx_start_firmware
-+ * qla4xxx_initialize_adapter
-+ * qla4xxx_find_propname
-+ * qla4xxx_get_prop_12chars
-+ * qla4xxx_add_device_dynamically
-+ * qla4xxx_process_ddb_changed
-+ * qla4xxx_login_device
-+ * qla4xxx_logout_device
-+ * qla4xxx_flush_all_srbs
-+ * qla4xxx_delete_device
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#include <linux/delay.h>
-+
-+/*
-+ * External Function Prototypes.
-+ */
-+extern int ql4xdiscoverywait;
-+extern char *ql4xdevconf;
-+
-+/*
-+ * Local routines
-+ */
-+static fc_port_t *
-+qla4xxx_find_or_alloc_fcport(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry);
-+static void qla4xxx_config_os(scsi_qla_host_t *ha);
-+static uint16_t
-+qla4xxx_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport);
-+os_lun_t *
-+qla4xxx_fclun_bind(scsi_qla_host_t *ha, fc_port_t *fcport, fc_lun_t *fclun);
-+os_tgt_t *
-+qla4xxx_tgt_alloc(scsi_qla_host_t *ha, uint16_t tgt);
-+void
-+qla4xxx_tgt_free(scsi_qla_host_t *ha, uint16_t tgt);
-+os_lun_t *
-+qla4xxx_lun_alloc(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun);
-+static void
-+qla4xxx_lun_free(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun);
-+fc_lun_t *
-+qla4xxx_add_fclun(fc_port_t *fcport, uint16_t lun);
-+static ddb_entry_t *
-+qla4xxx_get_ddb_entry(scsi_qla_host_t *ha, uint32_t fw_ddb_index);
-+
-+/**
-+ * qla4xxx_alloc_fcport() - Allocate a generic fcport.
-+ * @ha: HA context
-+ * @flags: allocation flags
-+ *
-+ * Returns a pointer to the allocated fcport, or NULL, if none available.
-+ */
-+static fc_port_t *
-+qla4xxx_alloc_fcport(scsi_qla_host_t *ha, int flags)
-+{
-+ fc_port_t *fcport;
-+
-+ fcport = kmalloc(sizeof(fc_port_t), flags);
-+ if (fcport == NULL)
-+ return(fcport);
-+
-+ /* Setup fcport template structure. */
-+ memset(fcport, 0, sizeof (fc_port_t));
-+ fcport->ha = ha;
-+ fcport->port_type = FCT_UNKNOWN;
-+ atomic_set(&fcport->state, FCS_DEVICE_DEAD);
-+ fcport->flags = FCF_RLC_SUPPORT;
-+ INIT_LIST_HEAD(&fcport->fcluns);
-+
-+ return(fcport);
-+}
-+
-+/*
-+* qla4xxx_init_tgt_map
-+* Initializes target map.
-+*
-+* Input:
-+* ha = adapter block pointer.
-+*
-+* Output:
-+* TGT_Q initialized
-+*/
-+static void
-+qla4xxx_init_tgt_map(scsi_qla_host_t *ha)
-+{
-+ uint32_t t;
-+
-+ ENTER(__func__);
-+
-+ for (t = 0; t < MAX_TARGETS; t++)
-+ TGT_Q(ha, t) = (os_tgt_t *) NULL;
-+
-+ LEAVE(__func__);
-+}
-+
-+
-+
-+
-+/*
-+ * qla4xxx_update_fcport
-+ * Updates device on list.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * fcport = port structure pointer.
-+ *
-+ * Return:
-+ * 0 - Success
-+ * BIT_0 - error
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+#if 0
-+ uint16_t index;
-+ unsigned long flags;
-+ srb_t *sp;
-+#endif
-+
-+ if (fcport == NULL)
-+ return;
-+
-+ ENTER(__func__);
-+ fcport->ha = ha;
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ fcport->flags &= ~(FCF_FAILOVER_NEEDED);
-+#endif
-+ /* XXX need to get this info from option field of DDB entry */
-+ fcport->port_type = FCT_TARGET;
-+ fcport->iscsi_name = fcport->ddbptr->iscsi_name;
-+
-+ /*
-+ * Check for outstanding cmd on tape Bypass LUN discovery if active
-+ * command on tape.
-+ */
-+#if 0
-+ if (fcport->flags & FCF_TAPE_PRESENT) {
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-+ if ((sp = ha->outstanding_cmds[index]) != 0) {
-+ if (sp->fclun->fcport == fcport) {
-+ atomic_set(&fcport->state, FCS_ONLINE);
-+ spin_unlock_irqrestore(
-+ &ha->hardware_lock, flags);
-+ return;
-+ }
-+ }
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ }
-+#endif
-+
-+ /* Do LUN discovery. */
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha)) {
-+ qla4xxx_lun_discovery(ha, fcport);
-+ }
-+#endif
-+
-+ /* Always set online */
-+ atomic_set(&fcport->state, FCS_ONLINE);
-+ LEAVE(__func__);
-+}
-+
-+
-+
-+/*
-+ * qla4xxx_add_fclun
-+ * Adds LUN to database
-+ *
-+ * Input:
-+ * fcport: FC port structure pointer.
-+ * lun: LUN number.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+fc_lun_t *
-+qla4xxx_add_fclun(fc_port_t *fcport, uint16_t lun)
-+{
-+ int found;
-+ fc_lun_t *fclun;
-+
-+ if (fcport == NULL) {
-+ DEBUG2(printk("scsi: Unable to add lun to NULL port\n"));
-+ return(NULL);
-+ }
-+
-+ /* Allocate LUN if not already allocated. */
-+ found = 0;
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ if (fclun->lun == lun) {
-+ found++;
-+ break;
-+ }
-+ }
-+ if (found) {
-+ return(fclun);
-+ }
-+
-+ fclun = kmalloc(sizeof(fc_lun_t), GFP_ATOMIC);
-+ if (fclun == NULL) {
-+ printk(KERN_WARNING
-+ "%s(): Memory Allocation failed - FCLUN\n",
-+ __func__);
-+ return(NULL);
-+ }
-+
-+ /* Setup LUN structure. */
-+ memset(fclun, 0, sizeof(fc_lun_t));
-+ fclun->lun = lun;
-+ fclun->fcport = fcport;
-+ fclun->device_type = fcport->device_type;
-+ // atomic_set(&fcport->state, FCS_UNCONFIGURED);
-+
-+ list_add_tail(&fclun->list, &fcport->fcluns);
-+
-+ return(fclun);
-+}
-+
-+
-+
-+
-+/*
-+ * qla4xxx_config_os
-+ * Setup OS target and LUN structures.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_config_os(scsi_qla_host_t *ha)
-+{
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ os_tgt_t *tq;
-+ uint16_t tgt;
-+
-+
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if ((tq = TGT_Q(ha, tgt)) == NULL)
-+ continue;
-+
-+ tq->flags &= ~TQF_ONLINE;
-+ }
-+
-+ list_for_each_entry(fcport, &ha->fcports, list)
-+ {
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ fcport->os_target_id = MAX_TARGETS;
-+ continue;
-+ }
-+
-+ /* Bind FC port to OS target number. */
-+ if (qla4xxx_fcport_bind(ha, fcport) == MAX_TARGETS) {
-+ continue;
-+ }
-+
-+ /* Bind FC LUN to OS LUN number. */
-+ list_for_each_entry(fclun, &fcport->fcluns, list)
-+ {
-+ qla4xxx_fclun_bind(ha, fcport, fclun);
-+ }
-+ }
-+}
-+
-+/*
-+ * qla4xxx_fcport_bind
-+ * Locates a target number for FC port.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * fcport = FC port structure pointer.
-+ *
-+ * Returns:
-+ * target number
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint16_t
-+qla4xxx_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ uint16_t tgt;
-+ os_tgt_t *tq = NULL;
-+
-+ if (fcport->ddbptr == NULL)
-+ return (MAX_TARGETS);
-+
-+ /* Check for persistent binding. */
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if ((tq = TGT_Q(ha, tgt)) == NULL)
-+ continue;
-+
-+ if (memcmp(fcport->ddbptr->iscsi_name, tq->iscsi_name,
-+ ISCSI_NAME_SIZE) == 0) {
-+ break;
-+ }
-+ }
-+ /* TODO: honor the ConfigRequired flag */
-+ if (tgt == MAX_TARGETS) {
-+ tgt = 0;
-+
-+ /* Check if targetID 0 available. */
-+ if (TGT_Q(ha, tgt) != NULL) {
-+ /* Locate first free target for device. */
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (TGT_Q(ha, tgt) == NULL) {
-+ break;
-+ }
-+ }
-+ }
-+ if (tgt != MAX_TARGETS) {
-+ if ((tq = qla4xxx_tgt_alloc(ha, tgt)) != NULL) {
-+ memcpy(tq->iscsi_name, fcport->ddbptr->iscsi_name,
-+ ISCSI_NAME_SIZE);
-+ }
-+ }
-+ }
-+
-+ /* Reset target numbers incase it changed. */
-+ fcport->os_target_id = tgt;
-+ if (tgt != MAX_TARGETS && tq != NULL) {
-+ DEBUG2(printk("scsi(%d): %s: Assigning target ID=%02d @ %p to "
-+ "ddb[%d], fcport %p, port state=0x%x, port down retry=%d\n",
-+ ha->host_no, __func__, tgt, tq,
-+ fcport->ddbptr->fw_ddb_index,
-+ fcport,
-+ atomic_read(&fcport->state),
-+ atomic_read(&fcport->ddbptr->port_down_timer)));
-+
-+ fcport->ddbptr->target = tgt;
-+ fcport->tgt_queue = tq;
-+ fcport->flags |= FCF_PERSISTENT_BOUND;
-+ tq->fcport = fcport;
-+ tq->flags |= TQF_ONLINE;
-+ tq->id = tgt;
-+ }
-+
-+ if (tgt == MAX_TARGETS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "Unable to bind fcport, loop_id=%x\n", fcport->loop_id));
-+ }
-+
-+ return(tgt);
-+}
-+
-+/*
-+ * qla4xxx_fclun_bind
-+ * Binds all FC device LUNS to OS LUNS.
-+ *
-+ * Input:
-+ * ha: adapter state pointer.
-+ * fcport: FC port structure pointer.
-+ *
-+ * Returns:
-+ * target number
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+os_lun_t *
-+qla4xxx_fclun_bind(scsi_qla_host_t *ha, fc_port_t *fcport, fc_lun_t *fclun)
-+{
-+ os_lun_t *lq;
-+ uint16_t tgt;
-+ uint16_t lun;
-+
-+ tgt = fcport->os_target_id;
-+ lun = fclun->lun;
-+
-+ /* Allocate LUNs */
-+ if (lun >= MAX_LUNS) {
-+ DEBUG2(printk("scsi%d: Unable to bind lun, invalid "
-+ "lun=(%x).\n", ha->host_no, lun));
-+ return(NULL);
-+ }
-+
-+ if ((lq = qla4xxx_lun_alloc(ha, tgt, lun)) == NULL) {
-+ printk(KERN_WARNING "Unable to bind fclun, lun=%x\n",
-+ lun);
-+ return(NULL);
-+ }
-+
-+ lq->fclun = fclun;
-+
-+ return(lq);
-+}
-+
-+/*
-+ * qla4xxx_tgt_alloc
-+ * Allocate and pre-initialize target queue.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * t = SCSI target number.
-+ *
-+ * Returns:
-+ * NULL = failure
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+os_tgt_t *
-+qla4xxx_tgt_alloc(scsi_qla_host_t *ha, uint16_t tgt)
-+{
-+ os_tgt_t *tq;
-+
-+ /*
-+ * If SCSI addressing OK, allocate TGT queue and lock.
-+ */
-+ if (tgt >= MAX_TARGETS) {
-+ DEBUG2(printk("scsi%d: Unable to allocate target, invalid "
-+ "target number %d.\n", ha->host_no, tgt));
-+ return(NULL);
-+ }
-+
-+ tq = TGT_Q(ha, tgt);
-+ if (tq == NULL) {
-+ tq = kmalloc(sizeof(os_tgt_t), GFP_ATOMIC);
-+ if (tq != NULL) {
-+ DEBUG3(printk("scsi%d: Alloc Target %d @ %p\n",
-+ ha->host_no, tgt, tq));
-+
-+ memset(tq, 0, sizeof(os_tgt_t));
-+ tq->ha = ha;
-+
-+ TGT_Q(ha, tgt) = tq;
-+ }
-+ }
-+ if (tq != NULL) {
-+ tq->port_down_retry_count = ha->port_down_retry_count;
-+ }
-+ else {
-+ printk(KERN_WARNING "Unable to allocate target.\n");
-+ }
-+
-+ return(tq);
-+}
-+
-+/*
-+ * qla4xxx_tgt_free
-+ * Frees target and LUN queues.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * t = SCSI target number.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_tgt_free(scsi_qla_host_t *ha, uint16_t tgt)
-+{
-+ os_tgt_t *tq;
-+ uint16_t lun;
-+
-+ /*
-+ * If SCSI addressing OK, allocate TGT queue and lock.
-+ */
-+ if (tgt >= MAX_TARGETS) {
-+ DEBUG2(printk("scsi%d: Unable to de-allocate target, "
-+ "invalid target number %d.\n", ha->host_no, tgt));
-+
-+ return;
-+ }
-+
-+ tq = TGT_Q(ha, tgt);
-+ if (tq != NULL) {
-+ TGT_Q(ha, tgt) = NULL;
-+
-+ /* Free LUN structures. */
-+ for (lun = 0; lun < MAX_LUNS; lun++)
-+ qla4xxx_lun_free(ha, tgt, lun);
-+
-+ kfree(tq);
-+ }
-+
-+ return;
-+}
-+
-+/*
-+ * qla4xxx_lun_alloc
-+ * Allocate and initialize LUN queue.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * t = SCSI target number.
-+ * l = LUN number.
-+ *
-+ * Returns:
-+ * NULL = failure
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+os_lun_t *
-+qla4xxx_lun_alloc(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun)
-+{
-+ os_lun_t *lq;
-+
-+ /*
-+ * If SCSI addressing OK, allocate LUN queue.
-+ */
-+ if (lun >= MAX_LUNS || TGT_Q(ha, tgt) == NULL) {
-+ DEBUG2(printk("scsi%d: Unable to allocate lun, invalid "
-+ "parameter.\n", ha->host_no));
-+
-+ return(NULL);
-+ }
-+
-+ lq = LUN_Q(ha, tgt, lun);
-+ if (lq == NULL) {
-+ lq = kmalloc(sizeof(os_lun_t), GFP_ATOMIC);
-+
-+ if (lq != NULL) {
-+ DEBUG3(printk("scsi%d: Alloc Lun %d @ tgt %d.\n",
-+ ha->host_no, lun, tgt));
-+
-+ memset(lq, 0, sizeof (os_lun_t));
-+ LUN_Q(ha, tgt, lun) = lq;
-+
-+ /*
-+ * The following lun queue initialization code
-+ * must be duplicated in alloc_ioctl_mem function
-+ * for ioctl_lq.
-+ */
-+ lq->lun_state = LS_LUN_READY;
-+ spin_lock_init(&lq->lun_lock);
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled()) {
-+ lq->fo_info = kmalloc(sizeof(struct fo_information), GFP_ATOMIC);
-+ if (lq->fo_info) {
-+ memset(lq->fo_info, 0, sizeof(struct fo_information));
-+ } else {
-+ printk(KERN_WARNING "%s failed to"
-+ " alloc fo_retry_cnt buffer\n",
-+ __func__);
-+ }
-+ }
-+#endif
-+ DEBUG2(printk("Allocating Lun %d @ %p \n",lun,lq);)
-+ }
-+ }
-+
-+ if (lq == NULL) {
-+ printk(KERN_WARNING "Unable to allocate lun.\n");
-+ }
-+
-+ return(lq);
-+}
-+
-+/*
-+ * qla4xxx_lun_free
-+ * Frees LUN queue.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * t = SCSI target number.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla4xxx_lun_free(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun)
-+{
-+ os_lun_t *lq;
-+
-+ /*
-+ * If SCSI addressing OK, allocate TGT queue and lock.
-+ */
-+ if (tgt >= MAX_TARGETS || lun >= MAX_LUNS) {
-+ DEBUG2(printk("scsi%d: Unable to deallocate lun, invalid "
-+ "parameter.\n", ha->host_no));
-+
-+ return;
-+ }
-+
-+ if (TGT_Q(ha, tgt) != NULL && (lq = LUN_Q(ha, tgt, lun)) != NULL) {
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (lq->fo_info != NULL)
-+ kfree(lq->fo_info);
-+#endif
-+ LUN_Q(ha, tgt, lun) = NULL;
-+ kfree(lq);
-+ }
-+
-+ return;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_free_ddb
-+ * This routine deallocates and unlinks the specified ddb_entry from the
-+ * adapter's
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_free_ddb(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry)
-+{
-+ fc_port_t *fcport;
-+
-+ ENTER("qla4xxx_free_ddb");
-+
-+ /* Remove device entry from list */
-+ list_del_init(&ddb_entry->list_entry);
-+
-+ /* Remove device pointer from index mapping arrays */
-+ ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = (ddb_entry_t *) INVALID_ENTRY;
-+ //if (ddb_entry->target < MAX_DDB_ENTRIES)
-+ //ha->target_map[ddb_entry->target] = (ddb_entry_t *) INVALID_ENTRY;
-+ ha->tot_ddbs--;
-+
-+ fcport = ddb_entry->fcport;
-+ if (fcport) {
-+ atomic_set(&fcport->state, FCS_DEVICE_DEAD);
-+ fcport->ddbptr = NULL;
-+ }
-+ /* Free memory allocated for all luns */
-+ //for (lun = 0; lun < MAX_LUNS; lun++)
-+ //if (ddb_entry->lun_table[lun])
-+ //qla4xxx_free_lun(ddb_entry, lun);
-+
-+ /* Free memory for device entry */
-+ kfree(ddb_entry);
-+ LEAVE("qla4xxx_free_ddb");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_free_ddb_list
-+ * This routine deallocates and removes all devices on the sppecified
-+ * adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_free_ddb_list(scsi_qla_host_t *ha)
-+{
-+ struct list_head *ptr;
-+ ddb_entry_t *ddb_entry;
-+ fc_port_t *fcport;
-+
-+ ENTER("qla4xxx_free_ddb_list");
-+
-+ while (!list_empty(&ha->ddb_list)) {
-+ /* Remove device entry from head of list */
-+ ptr = ha->ddb_list.next;
-+ list_del_init(ptr);
-+
-+ /* Free memory for device entry */
-+ ddb_entry = list_entry(ptr, ddb_entry_t, list_entry);
-+ if (ddb_entry) {
-+ fcport = ddb_entry->fcport;
-+ if (fcport) {
-+ atomic_set(&fcport->state, FCS_DEVICE_DEAD);
-+ fcport->ddbptr = NULL;
-+ }
-+ kfree(ddb_entry);
-+ }
-+ }
-+
-+ LEAVE("qla4xxx_free_ddb_list");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_init_rings
-+ * This routine initializes the internal queues for the specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks:
-+ * The QLA4010 requires us to restart the queues at index 0.
-+ * The QLA4000 doesn't care, so just default to QLA4010's requirement.
-+ * Returns:
-+ * QLA_SUCCESS - Always return success.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_init_rings(scsi_qla_host_t *ha)
-+{
-+ uint16_t i;
-+ unsigned long flags = 0;
-+
-+ ENTER("qla4xxx_init_rings");
-+
-+ /* Initialize request queue. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ha->request_out = 0;
-+ ha->request_in = 0;
-+ ha->request_ptr = &ha->request_ring[ha->request_in];
-+ ha->req_q_count = REQUEST_QUEUE_DEPTH;
-+
-+ /* Initialize response queue. */
-+ ha->response_in = 0;
-+ ha->response_out = 0;
-+ ha->response_ptr = &ha->response_ring[ha->response_out];
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s response_ptr=%p\n", ha->host_no,
-+ __func__, ha->response_ptr));
-+
-+ /*
-+ * Initialize DMA Shadow registers. The firmware is really supposed to
-+ * take care of this, but on some uniprocessor systems, the shadow
-+ * registers aren't cleared-- causing the interrupt_handler to think
-+ * there are responses to be processed when there aren't.
-+ */
-+ ha->shadow_regs->req_q_out = __constant_cpu_to_le32(0);
-+ ha->shadow_regs->rsp_q_in = __constant_cpu_to_le32(0);
-+ wmb();
-+
-+ WRT_REG_DWORD(&ha->reg->req_q_in, 0);
-+ WRT_REG_DWORD(&ha->reg->rsp_q_out, 0);
-+ PCI_POSTING(&ha->reg->rsp_q_out);
-+
-+ /* Initialize active array */
-+ for (i = 0; i < MAX_SRBS; i++)
-+ ha->active_srb_array[i] = 0;
-+ ha->active_srb_count = 0;
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_init_rings");
-+
-+ return (QLA_SUCCESS);
-+}
-+
-+
-+#define qla4xxx_mac_is_equal(mac1, mac2) (memcmp(mac1, mac2, MAC_ADDR_LEN) == 0)
-+
-+/**************************************************************************
-+ * qla4xxx_validate_mac_address
-+ * This routine validates the M.A.C. Address(es) of the adapter
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully validated M.A.C. address
-+ * QLA_ERROR - Failed to validate M.A.C. address
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_validate_mac_address(scsi_qla_host_t *ha)
-+{
-+ FLASH_SYS_INFO *sys_info = NULL;
-+ dma_addr_t sys_info_dma;
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER("qla4xxx_validate_mac_address");
-+ sys_info = (FLASH_SYS_INFO *) pci_alloc_consistent(ha->pdev,
-+ sizeof(*sys_info), &sys_info_dma);
-+ if (sys_info == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Unable to allocate dma "
-+ "buffer.\n", ha->host_no, __func__));
-+ goto exit_validate_mac;
-+ }
-+ memset(sys_info, 0, sizeof(*sys_info));
-+
-+ /* Get flash sys info */
-+ if (qla4xxx_get_flash(ha, sys_info_dma, FLASH_OFFSET_SYS_INFO,
-+ sizeof(*sys_info)) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: get_flash "
-+ "FLASH_OFFSET_SYS_INFO failed\n", ha->host_no, __func__));
-+ goto exit_validate_mac;
-+ }
-+
-+ /* Save M.A.C. address & serial_number */
-+ memcpy(ha->my_mac, &sys_info->physAddr[0].address[0],
-+ MIN(sizeof(ha->my_mac), sizeof(sys_info->physAddr[0].address)));
-+ memcpy(ha->serial_number, &sys_info->acSerialNumber,
-+ MIN(sizeof(ha->serial_number), sizeof(sys_info->acSerialNumber)));
-+
-+ /* Display Debug Print Info */
-+ QL4PRINT(QLP10, printk("scsi%d: Flash Sys Info\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP10, sys_info, sizeof(*sys_info));
-+
-+ /*
-+ * If configuration information was specified on the command line,
-+ * validate the mac address here.
-+ */
-+ if (ql4xdevconf) {
-+ char *propbuf;
-+ uint8_t cfg_mac[MAC_ADDR_LEN];
-+
-+ propbuf = kmalloc(LINESIZE, GFP_ATOMIC);
-+ if (propbuf == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Unable to "
-+ "allocate memory.\n", ha->host_no, __func__));
-+ goto exit_validate_mac;
-+ }
-+
-+ /* Get mac address from configuration file. */
-+ sprintf(propbuf, "scsi-qla%d-mac", ha->instance);
-+ qla4xxx_get_prop_12chars(ha, propbuf, &cfg_mac[0], ql4xdevconf);
-+
-+ if (qla4xxx_mac_is_equal(&ha->my_mac, cfg_mac)) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: This is a "
-+ "registered adapter.\n", ha->host_no, __func__));
-+ status = QLA_SUCCESS;
-+ } else {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: This is NOT a "
-+ "registered adapter.\n", ha->host_no, __func__));
-+ }
-+ kfree(propbuf);
-+ } else {
-+ status = QLA_SUCCESS;
-+ }
-+
-+exit_validate_mac:
-+ if (sys_info)
-+ pci_free_consistent(ha->pdev, sizeof(*sys_info), sys_info,
-+ sys_info_dma);
-+
-+ LEAVE("qla4xxx_validate_mac_address");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_init_local_data
-+ * This routine initializes the local data for the specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully initialized local data
-+ * QLA_ERROR - Failed to initialize local data
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_init_local_data(scsi_qla_host_t *ha)
-+{
-+ int i;
-+
-+ /* Initialize passthru PDU list */
-+ for (i = 0; i < (MAX_PDU_ENTRIES - 1); i++) {
-+ ha->pdu_queue[i].Next = &ha->pdu_queue[i+1];
-+ }
-+ ha->free_pdu_top = &ha->pdu_queue[0];
-+ ha->free_pdu_bottom = &ha->pdu_queue[MAX_PDU_ENTRIES - 1];
-+ ha->free_pdu_bottom->Next = NULL;
-+ ha->pdu_active = 0;
-+
-+ /* Initilize aen queue */
-+ ha->aen_q_count = MAX_AEN_ENTRIES;
-+
-+ /* Initialize local iSNS data */
-+ qla4xxx_isns_init_attributes(ha);
-+ ha->isns_flags = 0;
-+ atomic_set(&ha->isns_restart_timer, 0);
-+ ha->isns_connection_id = 0;
-+ ha->isns_remote_port_num = 0;
-+ ha->isns_scn_port_num = 0;
-+ ha->isns_esi_port_num = 0;
-+ ha->isns_nsh_port_num = 0;
-+ memset(ha->isns_entity_id, 0, sizeof(ha->isns_entity_id));
-+ ha->isns_num_discovered_targets = 0;
-+
-+ return (qla4xxx_get_firmware_status(ha));
-+
-+ //return (QLA_SUCCESS);
-+}
-+
-+static int
-+qla4xxx_fw_ready ( scsi_qla_host_t *ha )
-+{
-+ uint32_t timeout_count;
-+ int ready = 0;
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "Waiting for Firmware Ready..\n");
-+ for (timeout_count = ADAPTER_INIT_TOV; timeout_count > 0;
-+ timeout_count--) {
-+ /* Get firmware state. */
-+ if (qla4xxx_get_firmware_state(ha) != QLA_SUCCESS) {
-+ DEBUG2(printk("scsi%d: %s: unable to get "
-+ "firmware state\n", ha->host_no, __func__));
-+ LEAVE("qla4xxx_init_firmware");
-+ break;
-+
-+ }
-+
-+ if (ha->firmware_state & FW_STATE_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: an unrecoverable "
-+ "error has occurred\n", ha->host_no, __func__));
-+ LEAVE("qla4xxx_init_firmware");
-+ break;
-+
-+ }
-+ if (ha->firmware_state & FW_STATE_CONFIG_WAIT) {
-+ /*
-+ * The firmware has not yet been issued an Initialize
-+ * Firmware command, so issue it now.
-+ */
-+ if (qla4xxx_initialize_fw_cb(ha) == QLA_ERROR) {
-+ LEAVE("qla4xxx_init_firmware");
-+ break;
-+ }
-+
-+ /* Go back and test for ready state - no wait. */
-+ continue;
-+ }
-+
-+ if (ha->firmware_state & FW_STATE_WAIT_LOGIN) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: fwstate:"
-+ "LOGIN in progress\n", ha->host_no, __func__));
-+ }
-+
-+ if (ha->firmware_state & FW_STATE_DHCP_IN_PROGRESS) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: fwstate: DHCP in progress\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ if (ha->firmware_state == FW_STATE_READY) {
-+ ql4_printk(KERN_INFO, ha, "Firmware Ready..\n");
-+ /* The firmware is ready to process SCSI commands. */
-+ QL4PRINT(QLP7, printk("scsi%d: %s: FW STATE - READY\n",
-+ ha->host_no, __func__));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: MEDIA TYPE - %s\n",
-+ ha->host_no, __func__,
-+ ((ha->addl_fw_state & FW_ADDSTATE_OPTICAL_MEDIA) !=
-+ 0) ? "OPTICAL" : "COPPER"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: DHCP STATE Enabled "
-+ "%s\n", ha->host_no, __func__,
-+ ((ha->addl_fw_state & FW_ADDSTATE_DHCP_ENABLED) !=
-+ 0) ? "YES" : "NO"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: DHCP STATE Lease "
-+ "Acquired %s\n", ha->host_no, __func__,
-+ ((ha->addl_fw_state &
-+ FW_ADDSTATE_DHCP_LEASE_ACQUIRED) != 0) ?
-+ "YES" : "NO"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: DHCP STATE Lease "
-+ "Expired %s\n", ha->host_no, __func__,
-+ ((ha->addl_fw_state &
-+ FW_ADDSTATE_DHCP_LEASE_EXPIRED) != 0) ?
-+ "YES" : "NO"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: LINK %s\n",
-+ ha->host_no, __func__,
-+ ((ha->addl_fw_state & FW_ADDSTATE_LINK_UP) != 0) ?
-+ "UP" : "DOWN"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: iSNS Service "
-+ "Started %s\n", ha->host_no, __func__,
-+ ((ha->addl_fw_state &
-+ FW_ADDSTATE_ISNS_SVC_ENABLED) != 0) ?
-+ "YES" : "NO"));
-+ if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: QLA4040 TopCat "
-+ "Initialized %s\n", ha->host_no, __func__,
-+ ((ha->addl_fw_state &
-+ FW_ADDSTATE_TOPCAT_NOT_INITIALIZED) != 0) ?
-+ "NO" : "YES"));
-+ }
-+ ready = 1;
-+
-+ /* If iSNS is enabled, start the iSNS service now. */
-+ if ((ha->tcp_options & TOPT_ISNS_ENABLE) &&
-+ !IPAddrIsZero(ha->isns_ip_address)) {
-+ uint32_t ip_addr = 0;
-+
-+ IPAddr2Uint32(ha->isns_ip_address, &ip_addr);
-+ ql4_printk(KERN_INFO, ha, "Initializing ISNS..\n");
-+ qla4xxx_isns_reenable(ha, ip_addr, ha->isns_server_port_number);
-+ }
-+
-+ break;
-+ }
-+
-+ DEBUG2(printk("scsi%d: %s: waiting on fw, state=%x:%x - "
-+ "seconds expired= %d\n", ha->host_no,
-+ __func__, ha->firmware_state,
-+ ha->addl_fw_state, timeout_count));
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ } /* for */
-+
-+ if (timeout_count <= 0 )
-+ DEBUG2(printk("scsi%d: %s: FW Initialization timed out!\n",
-+ ha->host_no, __func__));
-+
-+ return ready;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_init_firmware
-+ * This routine initializes the firmware.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully initialized firmware
-+ * QLA_ERROR - Failed to initialize firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_init_firmware(scsi_qla_host_t *ha)
-+{
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER("qla4xxx_init_firmware");
-+
-+ ql4_printk(KERN_INFO, ha, "Initializing firmware..\n");
-+ if (qla4xxx_initialize_fw_cb(ha) == QLA_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: Failed to initialize "
-+ "firmware control block\n", ha->host_no, __func__));
-+ LEAVE("qla4xxx_init_firmware");
-+ return (status);
-+ }
-+
-+ if( !qla4xxx_fw_ready(ha) )
-+ return (status);
-+
-+
-+ set_bit(AF_ONLINE, &ha->flags);
-+ LEAVE("qla4xxx_init_firmware");
-+
-+ return (qla4xxx_get_firmware_status(ha));
-+
-+ //return (QLA_SUCCESS);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_is_discovered_target
-+ * This routine locates a device handle given iSNS information.
-+ * If device doesn't exist, returns NULL.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ip_addr - Pointer to IP address
-+ * alias - Pointer to iSCSI alias
-+ *
-+ * Returns:
-+ * Pointer to the corresponding internal device database structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline uint8_t
-+qla4xxx_is_discovered_target(scsi_qla_host_t *ha,
-+ uint8_t *ip_addr,
-+ uint8_t *alias,
-+ uint8_t *name_str)
-+{
-+ ISNS_DISCOVERED_TARGET *discovered_target = NULL;
-+ int i,j;
-+
-+ for (i=0; i < ha->isns_num_discovered_targets; i++) {
-+ discovered_target = &ha->isns_disc_tgt_databasev[i];
-+
-+ for (j = 0; j < discovered_target->NumPortals; j++) {
-+ if (memcmp(discovered_target->Portal[j].IPAddr, ip_addr,
-+ MIN(sizeof(discovered_target->Portal[j].IPAddr),
-+ sizeof(*ip_addr)) == 0) &&
-+ memcmp(discovered_target->Alias, alias,
-+ MIN(sizeof(discovered_target->Alias),
-+ sizeof(*alias)) == 0) &&
-+ memcmp(discovered_target->NameString, name_str,
-+ MIN(sizeof(discovered_target->Alias),
-+ sizeof(*name_str)) == 0)) {
-+
-+ return (QLA_SUCCESS);
-+ }
-+ }
-+ }
-+
-+ return (QLA_ERROR);
-+}
-+
-+static ddb_entry_t *
-+qla4xxx_get_ddb_entry(scsi_qla_host_t *ha, uint32_t fw_ddb_index)
-+{
-+ DEV_DB_ENTRY *fw_ddb_entry = NULL;
-+ dma_addr_t fw_ddb_entry_dma;
-+ ddb_entry_t *ddb_entry = NULL;
-+ int found = 0;
-+ uint32_t device_state;
-+
-+
-+ ENTER(__func__);
-+
-+ /* Make sure the dma buffer is valid */
-+ fw_ddb_entry = pci_alloc_consistent(ha->pdev, sizeof(*fw_ddb_entry),
-+ &fw_ddb_entry_dma);
-+ if (fw_ddb_entry == NULL) {
-+ DEBUG2(printk("scsi%d: %s: Unable to allocate dma "
-+ "buffer.\n", ha->host_no, __func__));
-+ LEAVE(__func__);
-+ return NULL;
-+ }
-+
-+ if (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, fw_ddb_entry,
-+ fw_ddb_entry_dma, NULL, NULL, &device_state, NULL, NULL,
-+ NULL) == QLA_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: failed get_ddb_entry for "
-+ "fw_ddb_index %d\n", ha->host_no, __func__, fw_ddb_index));
-+ LEAVE(__func__);
-+ return NULL;
-+ }
-+
-+ if (device_state != DDB_DS_SESSION_ACTIVE) {
-+ /* This target must be active to reach here.
-+ * Return error so the update code does not continue.
-+ */
-+ DEBUG2(printk("scsi%d: %s: ddb_entry %d not active. state=%x\n",
-+ ha->host_no, __func__, fw_ddb_index, device_state));
-+ LEAVE(__func__);
-+ return NULL;
-+ }
-+
-+ /* Allocate DDB if not already allocated. */
-+ DEBUG2(printk("scsi%d: %s: Looking for ddb[%d]\n", ha->host_no,
-+ __func__, fw_ddb_index));
-+ list_for_each_entry(ddb_entry, &ha->ddb_list, list_entry) {
-+ if (memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsiName,
-+ ISCSI_NAME_SIZE) == 0) {
-+ found++;
-+ break;
-+ }
-+ }
-+
-+ if (!found) {
-+ DEBUG2(printk(
-+ "scsi%d: %s: ddb[%d] not found - allocating new ddb\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ ddb_entry = qla4xxx_alloc_ddb(ha, fw_ddb_index);
-+ }
-+
-+ /* if not found allocate new ddb */
-+
-+ if (fw_ddb_entry)
-+ pci_free_consistent(ha->pdev, sizeof(*fw_ddb_entry),
-+ fw_ddb_entry, fw_ddb_entry_dma);
-+
-+ LEAVE(__func__);
-+
-+ return ddb_entry;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_update_ddb_entry
-+ * This routine updates the driver's internal device database entry
-+ * with information retrieved from the firmware's device database
-+ * entry for the specified device.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ *
-+ * Output:
-+ * ddb_entry - Structure filled in.
-+ *
-+ * Remarks:
-+ * The ddb_entry->fw_ddb_index field must be initialized prior to
-+ * calling this routine
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully update ddb_entry
-+ * QLA_ERROR - Failed to update ddb_entry
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_update_ddb_entry(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry,
-+ uint32_t fw_ddb_index)
-+{
-+ DEV_DB_ENTRY *fw_ddb_entry = NULL;
-+ dma_addr_t fw_ddb_entry_dma;
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER(__func__);
-+
-+ if (ddb_entry == NULL) {
-+ DEBUG2(printk("scsi%d: %s: ddb_entry is NULL\n",
-+ ha->host_no, __func__));
-+ goto exit_update_ddb;
-+ }
-+
-+ /* Make sure the dma buffer is valid */
-+ fw_ddb_entry = pci_alloc_consistent(ha->pdev, sizeof(*fw_ddb_entry),
-+ &fw_ddb_entry_dma);
-+ if (fw_ddb_entry == NULL) {
-+ DEBUG2(printk("scsi%d: %s: Unable to allocate dma "
-+ "buffer.\n", ha->host_no, __func__));
-+
-+ goto exit_update_ddb;
-+ }
-+
-+ if (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, fw_ddb_entry,
-+ fw_ddb_entry_dma, NULL, NULL, &ddb_entry->fw_ddb_device_state,
-+ &ddb_entry->default_time2wait, &ddb_entry->tcp_source_port_num,
-+ &ddb_entry->connection_id) == QLA_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: failed get_ddb_entry for "
-+ "fw_ddb_index %d\n", ha->host_no, __func__, fw_ddb_index));
-+
-+ goto exit_update_ddb;
-+ }
-+
-+ status = QLA_SUCCESS;
-+ switch (ddb_entry->fw_ddb_device_state) {
-+ case DDB_DS_SESSION_ACTIVE:
-+ ddb_entry->target_session_id = le16_to_cpu(fw_ddb_entry->TSID);
-+ ddb_entry->task_mgmt_timeout =
-+ le16_to_cpu(fw_ddb_entry->taskMngmntTimeout);
-+ ddb_entry->CmdSn = 0;
-+ ddb_entry->exe_throttle =
-+ le16_to_cpu(fw_ddb_entry->exeThrottle);
-+ ddb_entry->default_relogin_timeout =
-+ le16_to_cpu(fw_ddb_entry->taskMngmntTimeout);
-+
-+ /* Update index in case it changed */
-+ ddb_entry->fw_ddb_index = fw_ddb_index;
-+ ha->fw_ddb_index_map[fw_ddb_index] = ddb_entry;
-+
-+ memcpy(&ddb_entry->iscsi_name[0], &fw_ddb_entry->iscsiName[0],
-+ MIN(sizeof(ddb_entry->iscsi_name),
-+ sizeof(fw_ddb_entry->iscsiName)));
-+ memcpy(&ddb_entry->ip_addr[0], &fw_ddb_entry->ipAddr[0],
-+ MIN(sizeof(ddb_entry->ip_addr),
-+ sizeof(fw_ddb_entry->ipAddr)));
-+
-+ if (qla4xxx_is_discovered_target(ha, fw_ddb_entry->ipAddr,
-+ fw_ddb_entry->iSCSIAlias, fw_ddb_entry->iscsiName) ==
-+ QLA_SUCCESS) {
-+ set_bit(DF_ISNS_DISCOVERED, &ddb_entry->flags);
-+ }
-+
-+ break;
-+
-+ case DDB_DS_NO_CONNECTION_ACTIVE:
-+ case DDB_DS_NO_SESSION_ACTIVE:
-+ case DDB_DS_SESSION_FAILED:
-+ ddb_entry->target_session_id = 0;
-+ ddb_entry->task_mgmt_timeout = 0;
-+ ddb_entry->connection_id = 0;
-+ ddb_entry->CmdSn = 0;
-+ ddb_entry->exe_throttle = 0;
-+ ddb_entry->default_time2wait = 0;
-+
-+ break;
-+
-+ case DDB_DS_UNASSIGNED:
-+ /* This target does not exist anymore.
-+ * Return error so the update code does not continue.
-+ */
-+ DEBUG2(printk("scsi%d: %s: ddb_entry %d removed.\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ status = QLA_ERROR;
-+ break;
-+
-+ case DDB_DS_DISCOVERY:
-+ case DDB_DS_LOGGING_OUT:
-+ break;
-+
-+ default:
-+ status = QLA_ERROR;
-+ break;
-+ }
-+
-+ DEBUG2(printk("scsi%d: %s: ddb[%d] - State= %x status= %d.\n",
-+ ha->host_no, __func__, fw_ddb_index,
-+ ddb_entry->fw_ddb_device_state, status);)
-+
-+exit_update_ddb:
-+ if (fw_ddb_entry)
-+ pci_free_consistent(ha->pdev, sizeof(*fw_ddb_entry),
-+ fw_ddb_entry, fw_ddb_entry_dma);
-+
-+ LEAVE(__func__);
-+
-+ return (status);
-+}
-+
-+
-+static void
-+qla4xxx_configure_fcports(scsi_qla_host_t *ha)
-+{
-+ fc_port_t *fcport;
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ qla4xxx_update_fcport(ha, fcport);
-+ }
-+}
-+
-+static fc_port_t *
-+qla4xxx_find_or_alloc_fcport(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry)
-+{
-+ fc_port_t *fcport;
-+ int found;
-+
-+ ENTER(__func__);
-+ /* Check for matching device in port list. */
-+ found = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ //if (memcmp(new_fcport->port_name, fcport->port_name,
-+ //WWN_SIZE) == 0)
-+ if (fcport->ddbptr == ddb_entry) {
-+ fcport->flags &= ~(FCF_PERSISTENT_BOUND);
-+ found++;
-+ break;
-+ }
-+ }
-+
-+ if (!found) {
-+ /* Allocate a new replacement fcport. */
-+ fcport = qla4xxx_alloc_fcport(ha, GFP_KERNEL);
-+ if (fcport != NULL) {
-+ /* New device, add to fcports list. */
-+ list_add_tail(&fcport->list, &ha->fcports);
-+ fcport->ddbptr = ddb_entry;
-+ }
-+ }
-+
-+ LEAVE(__func__);
-+
-+ return (fcport);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_alloc_ddb
-+ * This routine allocates a ddb_entry, ititializes some values, and
-+ * inserts it into the ddb list.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ *
-+ * Returns:
-+ * Pointer to internal device database structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+ddb_entry_t *
-+qla4xxx_alloc_ddb(scsi_qla_host_t *ha, uint32_t fw_ddb_index)
-+{
-+ ddb_entry_t *ddb_entry;
-+
-+ QL4PRINT(QLP12, printk("scsi%d: %s: fw_ddb_index [%d]\n", ha->host_no,
-+ __func__, fw_ddb_index));
-+
-+ ddb_entry = (ddb_entry_t *) kmalloc(sizeof(*ddb_entry), GFP_KERNEL);
-+ if (ddb_entry == NULL) {
-+ DEBUG2(printk("scsi%d: %s: Unable to allocate memory "
-+ "to add fw_ddb_index [%d]\n", ha->host_no, __func__,
-+ fw_ddb_index));
-+ } else {
-+ memset(ddb_entry, 0, sizeof(*ddb_entry));
-+ ddb_entry->fw_ddb_index = fw_ddb_index;
-+ atomic_set(&ddb_entry->port_down_timer,
-+ ha->port_down_retry_count);
-+ atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY);
-+ atomic_set(&ddb_entry->relogin_timer, 0);
-+ atomic_set(&ddb_entry->relogin_retry_count, 0);
-+ atomic_set(&ddb_entry->state, DEV_STATE_ONLINE);
-+ list_add_tail(&ddb_entry->list_entry, &ha->ddb_list);
-+ ha->fw_ddb_index_map[fw_ddb_index] = ddb_entry;
-+ ha->tot_ddbs++;
-+ ddb_entry->fcport = qla4xxx_find_or_alloc_fcport(ha, ddb_entry);
-+ }
-+ return (ddb_entry);
-+}
-+
-+static int
-+qla4xxx_wait_for_login(scsi_qla_host_t *ha,
-+ uint32_t fw_ddb_index)
-+{
-+ uint32_t login_delay_time = RELOGIN_TOV + 12;
-+ int rval = 0;
-+ unsigned long wtime;
-+ ddb_entry_t *ddb_entry;
-+
-+ wtime = jiffies + (login_delay_time * HZ);
-+
-+ /* Delay between relogins */
-+ DEBUG2( printk("scsi%d: %s: Login %d max seconds\n",
-+ ha->host_no, __func__, login_delay_time));
-+ /* wait for login to complete */
-+ do {
-+ /* poll for event */
-+ qla4xxx_get_firmware_state(ha);
-+ if (test_and_clear_bit(DPC_AEN, &ha->dpc_flags)) {
-+ qla4xxx_process_aen(ha, PROCESS_ALL_AENS);
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha,
-+ fw_ddb_index);
-+ if( ddb_entry ){
-+
-+ DEBUG2(printk("scsi%d: %s: Found DDB[%d].\n",
-+
-+ ha->host_no, __func__,fw_ddb_index));
-+ rval = 1;
-+ }
-+ break;
-+ }
-+ /* delay */
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ / 2);
-+ } while (!time_after_eq(jiffies,wtime));
-+ DEBUG2( printk("scsi%d: %s: Delay complete.\n",
-+ ha->host_no, __func__));
-+
-+ return (rval);
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_build_ddb_list
-+ * This routine searches for all valid firmware ddb entries and builds
-+ * an internal ddb list.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks:
-+ * Ddbs that are considered valid are those with a device state of
-+ * SESSION_ACTIVE.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully built internal ddb list
-+ * QLA_ERROR - Failed to build internal ddb list
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_build_ddb_list(scsi_qla_host_t *ha)
-+{
-+ uint8_t status = QLA_ERROR;
-+ uint32_t fw_ddb_index = 0;
-+ uint32_t next_fw_ddb_index = 0;
-+ uint32_t ddb_state;
-+ ddb_entry_t *ddb_entry;
-+
-+ ENTER("qla4xxx_build_ddb_list");
-+
-+ ql4_printk(KERN_INFO, ha, "Initializing DDBs ...\n");
-+ for (fw_ddb_index = 0; fw_ddb_index < MAX_DDB_ENTRIES;
-+ fw_ddb_index = next_fw_ddb_index) {
-+ /* First, let's see if a device exists here */
-+ if (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, NULL, 0, NULL,
-+ &next_fw_ddb_index, &ddb_state, NULL, NULL, NULL) ==
-+ QLA_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: get_ddb_entry, "
-+ "fw_ddb_index %d failed", ha->host_no, __func__,
-+ fw_ddb_index));
-+ goto exit_build_ddb_list;
-+ }
-+
-+ DEBUG2(printk("scsi%d: %s: Getting DDB[%d] ddbstate=0x%x, "
-+ "next_fw_ddb_index=%d.\n",
-+ ha->host_no, __func__, fw_ddb_index, ddb_state,
-+ next_fw_ddb_index));
-+
-+ /*
-+ * If the device is logged in (SESSION_ACTIVE) then
-+ * add it to internal our ddb list.
-+ */
-+ if (ddb_state == DDB_DS_SESSION_ACTIVE) {
-+ /* Allocate a device structure */
-+ ddb_entry = qla4xxx_get_ddb_entry(ha, fw_ddb_index);
-+ if (ddb_entry == NULL) {
-+ DEBUG2(printk("scsi%d: %s: Unable to "
-+ "allocate memory for device at "
-+ "fw_ddb_index %d\n", ha->host_no, __func__,
-+ fw_ddb_index));
-+ goto exit_build_ddb_list;
-+ }
-+ /* Fill in the device structure */
-+ if (qla4xxx_update_ddb_entry(ha, ddb_entry,
-+ fw_ddb_index) == QLA_ERROR) {
-+ ha->fw_ddb_index_map[fw_ddb_index] =
-+ (ddb_entry_t *) INVALID_ENTRY;
-+
-+ // qla4xxx_free_ddb(ha, ddb_entry);
-+ DEBUG2(printk("scsi%d: %s: "
-+ "update_ddb_entry failed for fw_ddb_index"
-+ "%d.\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ goto exit_build_ddb_list;
-+ }
-+
-+ /* if fw_ddb with session active state found,
-+ * add to ddb_list */
-+ DEBUG2(printk("scsi%d: %s: DDB[%d] "
-+ "added to list\n", ha->host_no, __func__,
-+ fw_ddb_index));
-+ } else if (ddb_state == DDB_DS_SESSION_FAILED) {
-+ /* Try and login to device */
-+ DEBUG2(printk("scsi%d: %s: Login to DDB[%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ qla4xxx_set_ddb_entry(ha, fw_ddb_index, NULL, 0);
-+ qla4xxx_wait_for_login(ha, fw_ddb_index);
-+ }
-+
-+ /* We know we've reached the last device when
-+ * next_fw_ddb_index is 0 */
-+ if (next_fw_ddb_index == 0)
-+ break;
-+ }
-+
-+ /* tot_ddbs updated in alloc/free_ddb routines */
-+ if (ha->tot_ddbs)
-+ status = QLA_SUCCESS;
-+ ql4_printk(KERN_INFO, ha, "DDB list done..\n");
-+
-+exit_build_ddb_list:
-+ LEAVE("qla4xxx_build_ddb_list");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_devices_ready
-+ * This routine waits for device information from the
-+ * F/W database during driver load time.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully (re)built internal ddb list
-+ * QLA_ERROR - Failed to (re)build internal ddb list
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4xxx_devices_ready(scsi_qla_host_t *ha)
-+{
-+ int rval = QLA_ERROR;
-+ int rval1;
-+ unsigned long wtime;
-+
-+ wtime = jiffies + (ql4xdiscoverywait * HZ);
-+
-+ DEBUG(printk("Waiting (%d) for devices ...\n",ql4xdiscoverywait));
-+ QL4PRINT(QLP7, printk("Waiting (%d) for devices ...\n",ql4xdiscoverywait));
-+ do {
-+ rval1 = qla4xxx_get_firmware_state(ha);
-+ if (rval1 == QLA_SUCCESS) {
-+ DEBUG3(printk("fw state=0x%x, curr time=%lx\n",
-+ ha->firmware_state,jiffies);)
-+
-+ /* ready? */
-+ if (!(ha->firmware_state & (BIT_3|BIT_2|BIT_1|BIT_0))) {
-+ if (test_bit(DPC_AEN, &ha->dpc_flags)) {
-+ rval = QLA_SUCCESS;
-+ DEBUG(printk("Done...\n"));
-+ break;
-+ }
-+ }
-+ /* error */
-+ if (ha->firmware_state & (BIT_2|BIT_0))
-+ break;
-+ /* in process */
-+ }
-+ if (rval == QLA_SUCCESS)
-+ break;
-+
-+ /* delay */
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ / 2);
-+ } while (!time_after_eq(jiffies,wtime));
-+
-+ return (rval);
-+}
-+
-+static uint8_t
-+qla4xxx_initialize_ddb_list(scsi_qla_host_t *ha)
-+{
-+ uint16_t fw_ddb_index;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_initialize_ddb_list");
-+
-+ /* free the ddb list if is not empty */
-+ if (!list_empty(&ha->ddb_list))
-+ qla4xxx_free_ddb_list(ha);
-+
-+ /* Initialize internal DDB list and mappingss */
-+ qla4xxx_init_tgt_map(ha);
-+
-+ for (fw_ddb_index = 0; fw_ddb_index < MAX_DDB_ENTRIES; fw_ddb_index++)
-+ ha->fw_ddb_index_map[fw_ddb_index] =
-+ (ddb_entry_t *) INVALID_ENTRY;
-+
-+ ha->tot_ddbs = 0;
-+
-+ /* Wait for an AEN */
-+ qla4xxx_devices_ready(ha);
-+
-+ /*
-+ * First perform device discovery for active
-+ * fw ddb indexes and build
-+ * ddb list.
-+ */
-+ qla4xxx_build_ddb_list(ha);
-+
-+
-+ /*
-+ * Here we map a SCSI target to a fw_ddb_index and discover all
-+ * possible luns.
-+ */
-+ qla4xxx_configure_fcports(ha);
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (!qla4xxx_failover_enabled())
-+ qla4xxx_config_os(ha);
-+#else
-+ qla4xxx_config_os(ha);
-+#endif
-+
-+ /*
-+ * Targets can come online after the inital discovery, so processing
-+ * the aens here will catch them.
-+ */
-+ if (test_and_clear_bit(DPC_AEN, &ha->dpc_flags))
-+ qla4xxx_process_aen(ha, PROCESS_ALL_AENS);
-+
-+ if (!ha->tot_ddbs)
-+ status = QLA_ERROR;
-+
-+ LEAVE("qla4xxx_initialize_ddb_list");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_reinitialize_ddb_list
-+ * This routine obtains device information from the F/W database after
-+ * firmware or adapter resets. The device table is preserved.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully updated internal ddb list
-+ * QLA_ERROR - Failed to update internal ddb list
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_reinitialize_ddb_list(scsi_qla_host_t *ha)
-+{
-+ uint8_t status = QLA_SUCCESS;
-+ ddb_entry_t *ddb_entry, *detemp;
-+
-+ ENTER("qla4xxx_reinitialize_ddb_list");
-+
-+ /* Update the device information for all devices. */
-+ list_for_each_entry_safe(ddb_entry, detemp, &ha->ddb_list, list_entry) {
-+ qla4xxx_update_ddb_entry(ha, ddb_entry,
-+ ddb_entry->fw_ddb_index);
-+ if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) {
-+ atomic_set(&ddb_entry->state, DEV_STATE_ONLINE);
-+ // DG XXX
-+ //atomic_set(&ddb_entry->fcport->state, FCS_ONLINE);
-+ qla4xxx_update_fcport(ha, ddb_entry->fcport);
-+
-+ QL4PRINT(QLP3|QLP7, printk(KERN_INFO
-+ "scsi%d:%d:%d: %s: index [%d] marked ONLINE\n",
-+ ha->host_no, ddb_entry->bus, ddb_entry->target,
-+ __func__, ddb_entry->fw_ddb_index));
-+ } else if (atomic_read(&ddb_entry->state) == DEV_STATE_ONLINE)
-+ qla4xxx_mark_device_missing(ha, ddb_entry);
-+ }
-+
-+ LEAVE("qla4xxx_reinitialize_ddb_list");
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_relogin_device
-+ * This routine does a session relogin with the specified device.
-+ * The ddb entry must be assigned prior to making this call.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = Successfully relogged in device
-+ * QLA_ERROR = Failed to relogin device
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_relogin_device(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry)
-+{
-+ uint16_t relogin_timer;
-+
-+ ENTER("qla4xxx_relogin_device");
-+
-+ relogin_timer = MAX(ddb_entry->default_relogin_timeout, RELOGIN_TOV);
-+ atomic_set(&ddb_entry->relogin_timer, relogin_timer);
-+
-+ QL4PRINT(QLP3, printk(KERN_WARNING
-+ "scsi%d:%d:%d: Relogin index [%d]. TOV=%d\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target, ddb_entry->fw_ddb_index,
-+ relogin_timer));
-+
-+ qla4xxx_set_ddb_entry(ha, ddb_entry->fw_ddb_index, NULL, 0);
-+
-+ LEAVE("qla4xxx_relogin_device");
-+
-+ return (QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4010_topcat_soft_reset
-+ * This routine determines if the QLA4040 TopCat chip is present.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4010_get_topcat_presence(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ uint16_t topcat;
-+
-+ if (qla4xxx_take_hw_semaphore(ha, SEM_NVRAM, SEM_FLG_TIMED_WAIT) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: %s: Unable to take SEM_NVRAM semaphore\n",
-+ ha->host_no, __func__));
-+ return;
-+ }
-+//XXX DG fixme please!
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha)) {
-+ set_bit(DPC_FAILOVER_EVENT_NEEDED, &ha->dpc_flags);
-+ ha->failover_type = MP_NOTIFY_LOOP_UP;
-+ }
-+#endif
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ topcat = RD_NVRAM_WORD(ha, offsetof(eeprom_data_t, isp4010.topcat));
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if ((topcat & TOPCAT_MASK) == TOPCAT_PRESENT)
-+ set_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags);
-+ else
-+ clear_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags);
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_NVRAM);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_start_firmware
-+ * This routine performs the neccessary steps to start the firmware for
-+ * the QLA4010 adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully started QLA4xxx firmware
-+ * QLA_ERROR - Failed to start QLA4xxx firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_start_firmware(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags = 0;
-+ uint32_t mbox_status;
-+ uint8_t status = QLA_ERROR;
-+ uint8_t soft_reset = 0;
-+ uint8_t boot_firmware = 0;
-+ uint8_t configure_hardware = 0;
-+
-+ ENTER("qla4xxx_start_firmware");
-+
-+ if (IS_QLA4010(ha))
-+ qla4010_get_topcat_presence(ha);
-+
-+ /* Is Hardware already initialized? */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ if ((RD_REG_DWORD(ISP_PORT_STATUS(ha)) & PSR_INIT_COMPLETE) != 0) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Hardware has already been "
-+ "initialized\n", ha->host_no, __func__));
-+
-+ /* Is firmware already booted? */
-+ if (IS_QLA4022(ha)) {
-+ if ((RD_REG_DWORD(&ha->reg->u1.isp4022.semaphore) &
-+ SR_FIRWMARE_BOOTED) != 0) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Firmware "
-+ "has already been booted\n", ha->host_no,
-+ __func__));
-+
-+ /* Receive firmware boot acknowledgement */
-+ mbox_status =
-+ RD_REG_DWORD(&ha->reg->mailbox[0]);
-+ if (mbox_status == MBOX_STS_COMMAND_COMPLETE) {
-+ /* Acknowledge interrupt */
-+ WRT_REG_DWORD(&ha->reg->ctrl_status,
-+ SET_RMASK(CSR_SCSI_PROCESSOR_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ spin_unlock_irqrestore(
-+ &ha->hardware_lock, flags);
-+ qla4xxx_get_fw_version(ha);
-+
-+ return QLA_SUCCESS;
-+ } else {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "ERROR: Hardware initialized but "
-+ "firmware not successfully "
-+ "booted\n", ha->host_no, __func__));
-+
-+ boot_firmware = 1;
-+ }
-+ } else {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Firmware "
-+ "has NOT already been booted\n",
-+ ha->host_no, __func__));
-+
-+ boot_firmware = 1;
-+ }
-+ }
-+ //XXX Why are we not checking for !boot_firmware?
-+ //if (!boot_firmware) {
-+ /* Did BIOS initialize hardware? */
-+ /*
-+ * If the BIOS is loaded then the firmware is already
-+ * initialized. Reinitializing it without first
-+ * performing a reset is a NO-NO. We need to check
-+ * here if the BIOS is loaded (i.e.
-+ * FW_STATE_CONFIG_WAIT == 0). If so, force a soft
-+ * reset.
-+ */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ if (qla4xxx_get_firmware_state(ha) == QLA_SUCCESS) {
-+ if (!(ha->firmware_state &
-+ FW_STATE_CONFIG_WAIT)) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Firmware has been initialized by "
-+ "BIOS -- RESET\n", ha->host_no,
-+ __func__));
-+
-+ soft_reset = 1;
-+
-+ qla4xxx_process_aen(ha,
-+ FLUSH_DDB_CHANGED_AENS);
-+ }
-+ } else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Error "
-+ "detecting if firmware has already been "
-+ "initialized by BIOS -- RESET\n",
-+ ha->host_no, __func__));
-+
-+ soft_reset = 1;
-+ }
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ //}
-+ } else {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Hardware has NOT already "
-+ "been initialized\n", ha->host_no, __func__));
-+
-+ configure_hardware = 1;
-+ boot_firmware = 1;
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if (soft_reset) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Issue Soft Reset\n",
-+ ha->host_no, __func__));
-+
-+ status = qla4xxx_soft_reset(ha);
-+
-+ if (status == QLA_ERROR) {
-+ QL4PRINT(QLP3|QLP7, printk("scsi%d: %s: Soft Reset "
-+ "failed!\n", ha->host_no, __func__));
-+ return QLA_ERROR;
-+ }
-+
-+ configure_hardware = 1;
-+ boot_firmware = 1;
-+ }
-+
-+ if (configure_hardware) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Set up Hardware "
-+ "Configuration Register\n", ha->host_no, __func__));
-+
-+ if (qla4xxx_take_hw_semaphore(ha, SEM_FLASH, TIMED_WAIT) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: %s: Unable to take SEM_FLASH semaphore\n",
-+ ha->host_no, __func__));
-+
-+ return QLA_ERROR;
-+ }
-+ if (qla4xxx_take_hw_semaphore(ha, SEM_NVRAM, TIMED_WAIT) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: %s: Unable to take SEM_NVRAM semaphore\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_FLASH);
-+
-+ return QLA_ERROR;
-+ }
-+
-+ ql4_printk(KERN_INFO, ha, "Configuring NVRAM ...\n");
-+ if (qla4xxx_is_NVRAM_configuration_valid(ha) == QLA_SUCCESS) {
-+ EXTERNAL_HW_CONFIG_REG extHwConfig;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ extHwConfig.AsUINT32 = RD_NVRAM_WORD(ha,
-+ EEPROM_EXT_HW_CONF_OFFSET());
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Setting extHwConfig "
-+ "to 0xFFFF%04x\n", ha->host_no, __func__,
-+ extHwConfig.AsUINT32));
-+
-+ WRT_REG_DWORD(ISP_EXT_HW_CONF(ha),
-+ ((0xFFFF << 16) | extHwConfig.AsUINT32));
-+ PCI_POSTING(ISP_EXT_HW_CONF(ha));
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_NVRAM);
-+ qla4xxx_clear_hw_semaphore(ha, SEM_FLASH);
-+
-+ status = QLA_SUCCESS;
-+ } else {
-+ /*
-+ * QLogic adapters should always have a valid NVRAM.
-+ * If not valid, do not load.
-+ */
-+ QL4PRINT(QLP7, printk("scsi%d: %s: EEProm checksum "
-+ "invalid. Please update your EEPROM\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_NVRAM);
-+ qla4xxx_clear_hw_semaphore(ha, SEM_FLASH);
-+
-+ return QLA_ERROR;
-+ }
-+ }
-+
-+ if (boot_firmware) {
-+ uint32_t max_wait_time;
-+
-+ if (qla4xxx_take_hw_semaphore(ha, SEM_HW_LOCK, TIMED_WAIT) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: %s: Unable to take SEM_HW_LOCK semaphore "
-+ "(2)\n", ha->host_no, __func__));
-+
-+ return QLA_ERROR;
-+ }
-+
-+ /*
-+ * Start firmware from flash ROM
-+ *
-+ * WORKAROUND: Stuff a non-constant value that the firmware can
-+ * use as a seed for a random number generator in MB7 prior to
-+ * setting BOOT_ENABLE. Fixes problem where the TCP
-+ * connections use the same TCP ports after each reboot,
-+ * causing some connections to not get re-established.
-+ */
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Start firmware from flash "
-+ "ROM\n", ha->host_no, __func__));
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ WRT_REG_DWORD(&ha->reg->mailbox[7], jiffies);
-+ if (IS_QLA4022(ha))
-+ WRT_REG_DWORD(&ha->reg->u1.isp4022.nvram,
-+ SET_RMASK(NVR_WRITE_ENABLE));
-+
-+ WRT_REG_DWORD(&ha->reg->ctrl_status,
-+ SET_RMASK(CSR_BOOT_ENABLE));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* Wait for firmware to come UP. */
-+ max_wait_time = FIRMWARE_UP_TOV;
-+ do {
-+ uint32_t ctrl_status;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ctrl_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ mbox_status = RD_REG_DWORD(&ha->reg->mailbox[0]);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if (ctrl_status & SET_RMASK(CSR_SCSI_PROCESSOR_INTR))
-+ break;
-+ if (mbox_status == MBOX_STS_COMMAND_COMPLETE)
-+ break;
-+
-+ DEBUG(printk("scsi%d: %s: Waiting for "
-+ "firmware to come up... ctrl_sts=0x%x, "
-+ "remaining=%d\n", ha->host_no, __func__,
-+ ctrl_status, max_wait_time));
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ } while ((max_wait_time--));
-+
-+ if (mbox_status == MBOX_STS_COMMAND_COMPLETE) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Firmware has "
-+ "started\n", ha->host_no, __func__));
-+
-+ if (IS_QLA4010(ha)) {
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ha->firmware_version[0] =
-+ RD_REG_DWORD(&ha->reg->mailbox[1]);
-+ ha->firmware_version[1] =
-+ RD_REG_DWORD(&ha->reg->mailbox[2]);
-+ ha->patch_number =
-+ RD_REG_DWORD(&ha->reg->mailbox[3]);
-+ ha->build_number =
-+ RD_REG_DWORD(&ha->reg->mailbox[4]);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ QL4PRINT(QLP7, printk("scsi%d: FW Version "
-+ "%02d.%02d Patch %02d Build %02d\n",
-+ ha->host_no, ha->firmware_version[0],
-+ ha->firmware_version[1], ha->patch_number,
-+ ha->build_number));
-+ } else if (IS_QLA4022(ha)) {
-+ qla4xxx_get_fw_version(ha);
-+ }
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ WRT_REG_DWORD(&ha->reg->ctrl_status,
-+ SET_RMASK(CSR_SCSI_PROCESSOR_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ status = QLA_SUCCESS;
-+ } else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Self Test failed "
-+ "with status 0x%x\n", ha->host_no, __func__,
-+ mbox_status));
-+
-+ status = QLA_ERROR;
-+ }
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_HW_LOCK);
-+ }
-+
-+ if (status == QLA_SUCCESS) {
-+ if (test_and_clear_bit(AF_GET_CRASH_RECORD, &ha->flags))
-+ qla4xxx_get_crash_record(ha);
-+ } else {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Firmware has NOT started\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_dump_registers(QLP7, ha);
-+ }
-+
-+ LEAVE("qla4xxx_start_firmware");
-+ return status;
-+}
-+
-+static void
-+qla4x00_pci_config(scsi_qla_host_t *ha)
-+{
-+ uint16_t w, mwi;
-+
-+ ql4_printk(KERN_INFO, ha, "Configuring PCI space...\n");
-+
-+ pci_set_master(ha->pdev);
-+ mwi = 0;
-+ if (pci_set_mwi(ha->pdev))
-+ mwi = PCI_COMMAND_INVALIDATE;
-+
-+ /*
-+ * We want to respect framework's setting of PCI configuration space
-+ * command register and also want to make sure that all bits of
-+ * interest to us are properly set in command register.
-+ */
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &w);
-+ w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR);
-+ w &= ~PCI_COMMAND_INTX_DISABLE;
-+ pci_write_config_word(ha->pdev, PCI_COMMAND, w);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_initialize_adapter
-+ * This routine parforms all of the steps necessary to initialize the
-+ * adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * renew_ddb_list - Indicates what to do with the adapter's ddb list
-+ * after adapter recovery has completed.
-+ * 0=preserve ddb list, 1=destroy and rebuild ddb list
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully initialized adapter
-+ * QLA_ERROR - Failed to initialize adapter
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+
-+uint8_t
-+qla4xxx_initialize_adapter(scsi_qla_host_t *ha, uint8_t renew_ddb_list)
-+{
-+ uint8_t status;
-+
-+ ENTER("qla4xxx_initialize_adapter");
-+
-+ qla4x00_pci_config(ha);
-+
-+ qla4xxx_disable_intrs(ha);
-+ /* Initialize the Host adapter request/response queues and firmware */
-+ if ((status = qla4xxx_start_firmware(ha)) == QLA_ERROR) {
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d: Failed to start QLA4xxx firmware\n", ha->host_no));
-+ } else if ((status = qla4xxx_validate_mac_address(ha)) == QLA_ERROR) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Failed to validate mac address\n", ha->host_no));
-+ } else if ((status = qla4xxx_init_local_data(ha)) == QLA_ERROR) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Failed to initialize local data\n", ha->host_no));
-+ } else if ((status = qla4xxx_init_firmware(ha)) == QLA_ERROR) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Failed to initialize firmware\n", ha->host_no));
-+ } else {
-+ if (renew_ddb_list == PRESERVE_DDB_LIST) {
-+ /*
-+ * We want to preserve lun states (i.e. suspended, etc.)
-+ * for recovery initiated by the driver. So just update
-+ * the device states for the existing ddb_list
-+ */
-+ qla4xxx_reinitialize_ddb_list(ha);
-+ }
-+ else if (renew_ddb_list == REBUILD_DDB_LIST) {
-+ /*
-+ * We want to build the ddb_list from scratch during
-+ * driver initialization and recovery initiated by the
-+ * INT_HBA_RESET IOCTL.
-+ */
-+ qla4xxx_initialize_ddb_list(ha);
-+ }
-+
-+ if (test_bit(ISNS_FLAG_ISNS_ENABLED_IN_ISP, &ha->isns_flags)) {
-+ if (!test_bit(ISNS_FLAG_ISNS_SRV_ENABLED,
-+ &ha->isns_flags)) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: iSNS service failed to start\n",
-+ ha->host_no));
-+ }
-+ else {
-+ if (!ha->isns_num_discovered_targets) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Failed to discover devices\n",
-+ ha->host_no));
-+ }
-+ }
-+ }
-+ else if (!ha->tot_ddbs)
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Failed to initialize devices\n",
-+ ha->host_no));
-+ }
-+
-+ LEAVE("qla4xxx_initialize_adapter");
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_find_propname
-+ * Get property in database.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * db = pointer to database
-+ * propstr = pointer to dest array for string
-+ * propname = name of property to search for.
-+ * siz = size of property
-+ *
-+ * Returns:
-+ * 0 = no property
-+ * size = index of property
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_find_propname(scsi_qla_host_t *ha,
-+ char *propname, char *propstr,
-+ char *db, int siz)
-+{
-+ char *cp;
-+
-+ /* find the specified string */
-+ if (db) {
-+ /* find the property name */
-+ if ((cp = strstr(db,propname)) != NULL) {
-+ while ((*cp) && *cp != '=')
-+ cp++;
-+ if (*cp) {
-+ strncpy(propstr, cp, siz+1);
-+ propstr[siz+1] = '\0';
-+ QL4PRINT(QLP7, printk("scsi%d: %s: found "
-+ "property = {%s}\n",
-+ ha->host_no, __func__,
-+ propstr));
-+ return(siz); /* match */
-+ }
-+ }
-+ }
-+
-+ return(0);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_get_prop_12chars
-+ * Get a 6-byte property value for the specified property name by
-+ * converting from the property string found in the configuration file.
-+ * The resulting converted value is in big endian format (MSB at byte0).
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * propname = property name pointer.
-+ * propval = pointer to location for the converted property val.
-+ * db = pointer to database
-+ *
-+ * Returns:
-+ * 0 = value returned successfully.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_get_prop_12chars(scsi_qla_host_t *ha, uint8_t *propname,
-+ uint8_t *propval, uint8_t *db)
-+{
-+ char *propstr;
-+ int i, k;
-+ int rval;
-+ uint8_t nval;
-+ uint8_t *pchar;
-+ uint8_t *ret_byte;
-+ uint8_t *tmp_byte;
-+ uint8_t *retval = (uint8_t*)propval;
-+ uint8_t tmpval[6] = {0, 0, 0, 0, 0, 0};
-+ uint16_t max_byte_cnt = 6; /* 12 chars = 6 bytes */
-+ uint16_t max_strlen = 12;
-+ static char buf[LINESIZE];
-+
-+ rval = qla4xxx_find_propname(ha, propname, buf, db, max_strlen);
-+
-+ propstr = &buf[0];
-+ if (*propstr == '=')
-+ propstr++; /* ignore equal sign */
-+
-+ if (rval == 0) {
-+ return(1);
-+ }
-+
-+ /* Convert string to numbers. */
-+ pchar = (uint8_t *)propstr;
-+ tmp_byte = (uint8_t *)tmpval;
-+
-+ rval = 0;
-+ for (i = 0; i < max_strlen; i++) {
-+ /*
-+ * Check for invalid character, two at a time,
-+ * then convert them starting with first byte.
-+ */
-+
-+ if ((pchar[i] >= '0') && (pchar[i] <= '9')) {
-+ nval = pchar[i] - '0';
-+ }
-+ else if ((pchar[i] >= 'A') && (pchar[i] <= 'F')) {
-+ nval = pchar[i] - 'A' + 10;
-+ }
-+ else if ((pchar[i] >= 'a') && (pchar[i] <= 'f')) {
-+ nval = pchar[i] - 'a' + 10;
-+ }
-+ else {
-+ /* invalid character */
-+ rval = 1;
-+ break;
-+ }
-+
-+ if (i & 0x01) {
-+ *tmp_byte = *tmp_byte | nval;
-+ tmp_byte++;
-+ }
-+ else {
-+ *tmp_byte = *tmp_byte | nval << 4;
-+ }
-+ }
-+
-+ if (rval != 0) {
-+ /* Encountered invalid character. */
-+ return(rval);
-+ }
-+
-+ /* Copy over the converted value. */
-+ ret_byte = retval;
-+ tmp_byte = tmpval;
-+
-+ i = max_byte_cnt;
-+ k = 0;
-+ while (i--) {
-+ *ret_byte++ = *tmp_byte++;
-+ }
-+
-+ /* big endian retval[0]; */
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_add_device_dynamically
-+ * This routine processes adds a device as a result of an 8014h AEN.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4xxx_add_device_dynamically(scsi_qla_host_t *ha, uint32_t fw_ddb_index)
-+{
-+ ddb_entry_t *ddb_entry;
-+
-+ ENTER("qla4xxx_add_device_dynamically");
-+
-+ /* First allocate a device structure */
-+ ddb_entry = qla4xxx_get_ddb_entry(ha, fw_ddb_index);
-+ if (ddb_entry == NULL) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Unable to allocate memory to add fw_ddb_index "
-+ "%d\n", ha->host_no, fw_ddb_index));
-+ } else if (qla4xxx_update_ddb_entry(ha, ddb_entry, fw_ddb_index) ==
-+ QLA_ERROR) {
-+ ha->fw_ddb_index_map[fw_ddb_index] =
-+ (ddb_entry_t *) INVALID_ENTRY;
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: failed to add new device at index [%d]\n"
-+ "Unable to retrieve fw ddb entry\n", ha->host_no,
-+ fw_ddb_index));
-+ } else {
-+ /* New device. Let's add it to the database */
-+ DEBUG2(printk("scsi%d: %s: new device at index [%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+
-+ qla4xxx_update_fcport(ha, ddb_entry->fcport);
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (!qla4xxx_failover_enabled())
-+ qla4xxx_config_os(ha);
-+#else
-+ qla4xxx_config_os(ha);
-+#endif
-+
-+ }
-+
-+ LEAVE("qla4xxx_add_device_dynamically");
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_process_ddb_changed
-+ * This routine processes a Decive Database Changed AEN Event.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ * state - Device state
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully processed ddb_changed aen
-+ * QLA_ERROR - Failed to process ddb_changed aen
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_process_ddb_changed(scsi_qla_host_t *ha, uint32_t fw_ddb_index,
-+ uint32_t state)
-+{
-+ ddb_entry_t *ddb_entry;
-+ uint32_t old_fw_ddb_device_state;
-+
-+ ENTER(__func__);
-+
-+ /* check for out of range index */
-+ if (fw_ddb_index >= MAX_DDB_ENTRIES) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: device index [%d] out of "
-+ "range\n", ha->host_no, __func__, fw_ddb_index));
-+
-+ LEAVE(__func__);
-+ return (QLA_ERROR);
-+ }
-+
-+ /* Get the corresponging ddb entry */
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index);
-+
-+ /* Device does not currently exist in our database. */
-+ if (ddb_entry == NULL) {
-+ if (state == DDB_DS_SESSION_ACTIVE) {
-+ qla4xxx_add_device_dynamically(ha, fw_ddb_index);
-+ }
-+//FIXME: Is this really necessary?
-+#if 0
-+ else if (state == DDB_DS_SESSION_FAILED ) {
-+ ddb_entry = qla4xxx_get_ddb_entry(ha, fw_ddb_index);
-+ if( ddb_entry ) {
-+ atomic_set(&ddb_entry->retry_relogin_timer,
-+ ddb_entry->default_time2wait);
-+ qla4xxx_mark_device_missing(ha, ddb_entry);
-+ }
-+ }
-+#endif
-+ LEAVE(__func__);
-+
-+ return (QLA_SUCCESS);
-+ }
-+
-+ /* Device already exists in our database. */
-+ old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state;
-+ DEBUG2(printk("scsi%d: %s DDB - old state= 0x%x, "
-+ "new state=0x%x for index [%d]\n",
-+ ha->host_no, __func__, ddb_entry->fw_ddb_device_state,
-+ state,
-+ fw_ddb_index));
-+ if (old_fw_ddb_device_state == state) {
-+ /* Do nothing, state not changed. */
-+ LEAVE(__func__);
-+
-+ return (QLA_SUCCESS);
-+ }
-+
-+//FIXME: Is this really necessary?
-+#if 0
-+ if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, NULL, 0, NULL,
-+ NULL, &ddb_entry->fw_ddb_device_state, NULL, NULL, NULL) ==
-+ QLA_ERROR) {
-+ #if 0
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to retrieve "
-+ "fw_ddb_device_state for index [%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+
-+ LEAVE(__func__);
-+ return(QLA_ERROR);
-+ #else
-+ ddb_entry->fw_ddb_device_state = state;
-+ #endif
-+ }
-+
-+ DEBUG2(printk("scsi%d: %s DDB after query - old fw state= 0x%x, "
-+ "new fw state=0x%x for index [%d]\n",
-+ ha->host_no, __func__, ddb_entry->fw_ddb_device_state,
-+ state,
-+ fw_ddb_index));
-+#else
-+ ddb_entry->fw_ddb_device_state = state;
-+#endif
-+ /* Device is back online. */
-+ if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) {
-+ atomic_set(&ddb_entry->port_down_timer,
-+ ha->port_down_retry_count);
-+ atomic_set(&ddb_entry->state, DEV_STATE_ONLINE);
-+ atomic_set(&ddb_entry->relogin_retry_count, 0);
-+ atomic_set(&ddb_entry->relogin_timer, 0);
-+ clear_bit(DF_RELOGIN, &ddb_entry->flags);
-+ clear_bit(DF_NO_RELOGIN, &ddb_entry->flags);
-+ qla4xxx_update_fcport(ha, ddb_entry->fcport);
-+
-+/* XXX FIXUP LUN_READY/SUSPEND code -- dg */
-+ /*
-+ * Change the lun state to READY in case the lun TIMEOUT before
-+ * the device came back.
-+ */
-+ if (ddb_entry->fcport->vis_ha) {
-+ int t, l;
-+ unsigned long cpu_flags;
-+ os_lun_t *lq;
-+ scsi_qla_host_t *os_ha;
-+
-+ os_ha = ddb_entry->fcport->vis_ha;
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+ for (l = 0; l < MAX_LUNS; l++) {
-+ if (!(lq = GET_LU_Q(os_ha, t, l)))
-+ continue;
-+
-+ spin_lock_irqsave(&lq->lun_lock,
-+ cpu_flags);
-+ lq->lun_state = LS_LUN_READY;
-+ ddb_entry->fcport->vis_ha = NULL;
-+ spin_unlock_irqrestore(&lq->lun_lock,
-+ cpu_flags);
-+
-+ }
-+ }
-+ }
-+
-+ // DG XXX
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha)) {
-+ set_bit(DPC_FAILOVER_EVENT_NEEDED, &ha->dpc_flags);
-+ ha->failover_type = MP_NOTIFY_LOOP_UP;
-+ }
-+#endif
-+ } else {
-+ /* Device went away, try to relogin. */
-+ /* Mark device missing */
-+ if (atomic_read(&ddb_entry->state) == DEV_STATE_ONLINE)
-+ qla4xxx_mark_device_missing(ha, ddb_entry);
-+
-+ /*
-+ * Relogin if device state changed to a not active state.
-+ * However, do not relogin if this aen is a result of an IOCTL
-+ * logout (DF_NO_RELOGIN) or if this is a discovered device.
-+ */
-+ if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_FAILED &&
-+ (!test_bit(DF_RELOGIN, &ddb_entry->flags)) &&
-+ (!test_bit(DF_NO_RELOGIN, &ddb_entry->flags)) &&
-+ (!test_bit(DF_ISNS_DISCOVERED, &ddb_entry->flags))) {
-+ QL4PRINT(QLP3, printk("scsi%d:%d:%d: index [%d] "
-+ "initate relogin after %d seconds\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target,
-+ ddb_entry->fw_ddb_index,
-+ ddb_entry->default_time2wait));
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ // DG XXX
-+ qla4xxx_update_fcport(ha, ddb_entry->fcport);
-+#endif
-+
-+ /*
-+ * This triggers a relogin. After the relogin_timer
-+ * expires, the relogin gets scheduled. We must wait a
-+ * minimum amount of time since receiving an 0x8014 AEN
-+ * with failed device_state or a logout response before
-+ * we can issue another relogin.
-+ */
-+ atomic_set(&ddb_entry->retry_relogin_timer,
-+ ddb_entry->default_time2wait);
-+ }
-+ }
-+
-+ LEAVE(__func__);
-+
-+ return (QLA_SUCCESS);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_login_device
-+ * This routine is called by the login IOCTL to log in the specified
-+ * device.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Index of the device to login
-+ * connection_id - Connection ID of the device to login
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully logged in device
-+ * QLA_ERROR - Failed to login device
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_login_device(scsi_qla_host_t *ha, uint16_t fw_ddb_index,
-+ uint16_t connection_id)
-+{
-+ ddb_entry_t *ddb_entry;
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER("qla4xxx_login_device");
-+
-+ QL4PRINT(QLP3, printk("scsi%d: %s: Login index [%d]\n", ha->host_no,
-+ __func__, fw_ddb_index));
-+
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index);
-+ if (ddb_entry == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid index [%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ goto exit_login_device;
-+ }
-+
-+ if (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, NULL, 0, NULL, NULL,
-+ &ddb_entry->fw_ddb_device_state, NULL, NULL, NULL) == QLA_ERROR) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: 1st get ddb entry failed\n",
-+ ha->host_no, __func__));
-+ goto exit_login_device;
-+ }
-+
-+ if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) {
-+ QL4PRINT(QLP3, printk("scsi%d: %s: login successful for index "
-+ "[%d]\n", ha->host_no, __func__, ddb_entry->fw_ddb_index));
-+
-+ status = QLA_SUCCESS;
-+
-+ goto exit_login_device;
-+ }
-+
-+ if (qla4xxx_conn_close_sess_logout(ha, fw_ddb_index, connection_id,
-+ LOGOUT_OPTION_RELOGIN) != QLA_SUCCESS) {
-+ goto exit_login_device;
-+ }
-+
-+ status = QLA_SUCCESS;
-+
-+exit_login_device:
-+ LEAVE("qla4xxx_login_device");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_logout_device
-+ * This support routine is called by the logout IOCTL to log out
-+ * the specified device.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Index of the device to logout
-+ * connection_id - Connection ID of the device to logout
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully logged out device
-+ * QLA_ERROR - Failed to logout device
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_logout_device(scsi_qla_host_t *ha, uint16_t fw_ddb_index,
-+ uint16_t connection_id)
-+{
-+ uint8_t status = QLA_ERROR;
-+ ddb_entry_t *ddb_entry;
-+ uint32_t old_fw_ddb_device_state;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered. index=%d.\n",
-+ ha->host_no, __func__, ha->instance, fw_ddb_index));
-+
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index);
-+ if (ddb_entry == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: Invalid index [%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ goto exit_logout_device;
-+ }
-+
-+ if (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, NULL, 0, NULL, NULL,
-+ &old_fw_ddb_device_state, NULL, NULL, NULL) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: get_ddb_entry failed\n",
-+ ha->host_no, __func__));
-+ goto exit_logout_device;
-+ }
-+
-+ set_bit(DF_NO_RELOGIN, &ddb_entry->flags);
-+
-+ if (qla4xxx_conn_close_sess_logout(ha, fw_ddb_index, connection_id,
-+ LOGOUT_OPTION_CLOSE_SESSION) != QLA_SUCCESS) {
-+ goto exit_logout_device;
-+ }
-+
-+ status = QLA_SUCCESS;
-+
-+exit_logout_device:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return (status);
-+}
-+
-+void
-+qla4xxx_flush_all_srbs(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry,
-+ os_lun_t *lun_entry)
-+{
-+ int i;
-+ unsigned long flags;
-+ srb_t *srb;
-+
-+ if (lun_entry == NULL || ddb_entry == NULL)
-+ return;
-+
-+ /* free active commands */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ if (lun_entry->out_count != 0) {
-+ for (i = 1; i < MAX_SRBS; i++) {
-+ srb = ha->active_srb_array[i];
-+ if (!srb)
-+ continue;
-+
-+ QL4PRINT(QLP3, printk("scsi%d:%d:%d:%d: %s: found srb "
-+ "%p in active_q\n", ha->host_no, ddb_entry->bus,
-+ ddb_entry->target, lun_entry->lun, __func__, srb));
-+
-+ if (srb->lun_queue != lun_entry)
-+ continue;
-+
-+ del_from_active_array(ha, i);
-+ srb->cmd->result = DID_NO_CONNECT << 16;
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ add_to_done_srb_q(ha,srb);
-+#else
-+ qla4xxx_complete_request(ha, srb);
-+#endif
-+ }
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* Free Failover commands */
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ qla4xxx_flush_failover_q(ha, lun_entry);
-+#endif
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ /* Send all srbs back to OS */
-+ if (!list_empty(&ha->done_srb_q)) {
-+ qla4xxx_done(ha);
-+ }
-+#endif
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_delete_device
-+ * This routine is called by the logout IOCTL to delete the specified
-+ * device. Send the LOGOUT and DELETE_DDB commands for the specified
-+ * target, even if it's not in our internal database.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Index of the device to delete
-+ * connection_id - Connection ID of the device to delete
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully deleted device
-+ * QLA_ERROR - Failed to delete device
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_delete_device(scsi_qla_host_t *ha, uint16_t fw_ddb_index,
-+ uint16_t connection_id)
-+{
-+ uint8_t status = QLA_ERROR;
-+ uint32_t fw_ddb_device_state = 0xFFFF;
-+ u_long wait_count;
-+ ddb_entry_t *ddb_entry;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered. index=%d.\n",
-+ ha->host_no, __func__, ha->instance, fw_ddb_index));
-+
-+ /* If the device is in our internal tables, set the NO_RELOGIN bit. */
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index);
-+ if (ddb_entry != NULL) {
-+ QL4PRINT(QLP4,
-+ printk("scsi%d:%d:%d: %s: setting NO_RELOGIN flag\n",
-+ ha->host_no, ddb_entry->bus, ddb_entry->target, __func__));
-+
-+ set_bit(DF_NO_RELOGIN, &ddb_entry->flags);
-+ }
-+
-+ /*
-+ * If the device state is already one that we can delete, bypass the
-+ * logout command.
-+ */
-+ qla4xxx_get_fwddb_entry(ha, fw_ddb_index, NULL, 0, NULL, NULL,
-+ &fw_ddb_device_state, NULL, NULL, NULL);
-+ if (fw_ddb_device_state == DDB_DS_UNASSIGNED ||
-+ fw_ddb_device_state == DDB_DS_NO_CONNECTION_ACTIVE ||
-+ fw_ddb_device_state == DDB_DS_SESSION_FAILED)
-+ goto delete_ddb;
-+
-+ /* First logout index */
-+ if (qla4xxx_conn_close_sess_logout(ha, fw_ddb_index, connection_id,
-+ LOGOUT_OPTION_CLOSE_SESSION) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: LOGOUT_OPTION_CLOSE_SESSION "
-+ "failed index [%d]\n", ha->host_no, __func__,
-+ fw_ddb_index));
-+ goto exit_delete_ddb;
-+ }
-+
-+ /* Wait enough time to complete logout */
-+ wait_count = jiffies + LOGOUT_TOV * HZ;
-+ while (qla4xxx_get_fwddb_entry(ha, fw_ddb_index, NULL, 0, NULL, NULL,
-+ &fw_ddb_device_state, NULL, NULL, NULL) == QLA_SUCCESS) {
-+ if (wait_count <= jiffies)
-+ goto exit_delete_ddb;
-+
-+ if (fw_ddb_device_state == DDB_DS_UNASSIGNED ||
-+ fw_ddb_device_state == DDB_DS_NO_CONNECTION_ACTIVE ||
-+ fw_ddb_device_state == DDB_DS_SESSION_FAILED)
-+ break;
-+
-+ udelay(50);
-+ }
-+
-+delete_ddb:
-+ /* Now delete index */
-+ if (qla4xxx_clear_database_entry(ha, fw_ddb_index) == QLA_SUCCESS) {
-+ uint16_t lun;
-+ os_lun_t *lun_entry;
-+ os_tgt_t *tgt_entry;
-+
-+ status = QLA_SUCCESS;
-+ if (!ddb_entry)
-+ goto exit_delete_ddb;
-+
-+ atomic_set(&ddb_entry->state, DEV_STATE_DEAD);
-+ atomic_set(&ddb_entry->fcport->state, FCS_DEVICE_DEAD);
-+/* XXX FIXUP LUN_READY/SUSPEND code -- dg */
-+ tgt_entry = qla4xxx_lookup_target_by_fcport(ha,
-+ ddb_entry->fcport);
-+ if (tgt_entry) {
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ lun_entry = tgt_entry->olun[lun];
-+ if (lun_entry != NULL) {
-+ unsigned long cpu_flags;
-+ uint16_t retry_count;
-+
-+ spin_lock_irqsave(&lun_entry->lun_lock,
-+ cpu_flags);
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ retry_count = ha->retry_srb_q_count;
-+#else
-+ retry_count = 0;
-+#endif
-+ QL4PRINT(QLP4, printk(
-+ "scsi%d:%d:%d:%d: %s: flushing "
-+ "srbs, pendq_cnt=%d, retryq_cnt="
-+ "%d, activeq_cnt=%d\n", ha->host_no,
-+ ddb_entry->bus, tgt_entry->id, lun,
-+ __func__, 0 ,
-+ retry_count,
-+ ha->active_srb_count));
-+
-+ qla4xxx_flush_all_srbs(ha, ddb_entry,
-+ lun_entry);
-+ if (lun_entry->lun_state ==
-+ LS_LUN_SUSPENDED) {
-+ lun_entry->lun_state =
-+ LS_LUN_READY;
-+ }
-+
-+ spin_unlock_irqrestore(
-+ &lun_entry->lun_lock, cpu_flags);
-+ }
-+ }
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: removing index %d.\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+
-+ ha->fw_ddb_index_map[fw_ddb_index] =
-+ (ddb_entry_t *) INVALID_ENTRY;
-+ // qla4xxx_free_ddb(ha, ddb_entry);
-+ }
-+
-+exit_delete_ddb:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return (status);
-+}
-+
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_inline.h ./drivers/scsi/qla4xxx/ql4_inline.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_inline.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_inline.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,282 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ *
-+ ****************************************************************************/
-+
-+/**************************************************************************
-+ * qla4xxx_lookup_lun_handle
-+ * This routine locates a lun handle given the device handle and lun
-+ * number.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ * lun - SCSI LUN
-+ *
-+ * Returns:
-+ * Pointer to corresponding lun_entry structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline os_lun_t *
-+qla4xxx_lookup_lun_handle(scsi_qla_host_t *ha, os_tgt_t *tq, uint16_t lun)
-+{
-+ os_lun_t *lq = NULL;
-+
-+ if (tq && lun < MAX_LUNS)
-+ lq = tq->olun[lun];
-+ return lq;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_lookup_target_by_SCSIID
-+ * This routine locates a target handle given the SCSI bus and
-+ * target IDs. If device doesn't exist, returns NULL.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * bus - SCSI bus number
-+ * target - SCSI target ID.
-+ *
-+ * Returns:
-+ * Pointer to the corresponding internal device database structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline os_tgt_t *
-+qla4xxx_lookup_target_by_SCSIID(scsi_qla_host_t *ha, uint32_t bus,
-+ uint32_t target)
-+{
-+ os_tgt_t *tq = NULL;
-+
-+ if (target < MAX_TARGETS)
-+ tq = TGT_Q(ha, target);
-+
-+ QL4PRINT(QLP3, printk("scsi%d: %s: b%d:t%d, tgt = %p\n",
-+ ha->host_no, __func__, bus, target, tq));
-+
-+ return tq;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_lookup_target_by_fcport
-+ * This routine locates a target handle given the fcport
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fcport - port handle
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline os_tgt_t *
-+qla4xxx_lookup_target_by_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ int t;
-+ os_tgt_t *tq = NULL;
-+
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+ if ((tq = TGT_Q(ha, t)) == NULL)
-+ continue;
-+
-+ if (fcport == tq->fcport)
-+ break;
-+ }
-+
-+ return tq;
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_lookup_ddb_by_fw_index
-+ * This routine locates a device handle given the firmware device
-+ * database index. If device doesn't exist, returns NULL.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ *
-+ * Returns:
-+ * Pointer to the corresponding internal device database structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline ddb_entry_t *
-+qla4xxx_lookup_ddb_by_fw_index(scsi_qla_host_t *ha, uint32_t fw_ddb_index)
-+{
-+ ddb_entry_t *ddb_entry = NULL;
-+
-+ if ((fw_ddb_index < MAX_DDB_ENTRIES) &&
-+ (ha->fw_ddb_index_map[fw_ddb_index] !=
-+ (ddb_entry_t *) INVALID_ENTRY)) {
-+ ddb_entry = ha->fw_ddb_index_map[fw_ddb_index];
-+ }
-+
-+ DEBUG3(printk("scsi%d: %s: index [%d], ddb_entry = %p\n",
-+ ha->host_no, __func__, fw_ddb_index, ddb_entry));
-+
-+ return ddb_entry;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_mark_device_missing
-+ * This routine marks a device missing and resets the relogin retry count.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static inline void
-+qla4xxx_mark_device_missing(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry)
-+{
-+ atomic_set(&ddb_entry->state, DEV_STATE_MISSING);
-+ if (ddb_entry->fcport != NULL)
-+ atomic_set(&ddb_entry->fcport->state, FCS_DEVICE_LOST);
-+
-+ QL4PRINT(QLP3, printk(KERN_INFO "scsi%d:%d:%d: index [%d] marked "
-+ "MISSING\n", ha->host_no, ddb_entry->bus, ddb_entry->target,
-+ ddb_entry->fw_ddb_index));
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_enable_intrs
-+ * This routine enables the PCI interrupt request by clearing the
-+ * appropriate bit.
-+ *
-+ * qla4xxx_disable_intrs
-+ * This routine disables the PCI interrupt request by setting the
-+ * appropriate bit.
-+ *
-+ * Remarks:
-+ * The hardware_lock must be unlocked upon entry.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+static inline void __qla4xxx_enable_intrs(scsi_qla_host_t *ha)
-+{
-+ ENTER("qla4xxx_enable_intrs");
-+ set_bit(AF_INTERRUPTS_ON, &ha->flags);
-+
-+ if( IS_QLA4022(ha) ) {
-+ WRT_REG_DWORD(&ha->reg->u1.isp4022.intr_mask, SET_RMASK(IMR_SCSI_INTR_ENABLE));
-+ PCI_POSTING(&ha->reg->u1.isp4022.intr_mask);
-+ } else {
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SCSI_INTR_ENABLE));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ QL4PRINT(QLP7, printk("scsi%d: %s: intSET_RMASK = %08x\n",
-+ ha->host_no, __func__,
-+ RD_REG_DWORD(&ha->reg->ctrl_status)));
-+ }
-+ LEAVE("qla4xxx_enable_intrs");
-+}
-+
-+static inline void __qla4xxx_disable_intrs(scsi_qla_host_t *ha)
-+{
-+
-+ ENTER("qla4xxx_disable_intrs");
-+ clear_bit(AF_INTERRUPTS_ON, &ha->flags);
-+
-+ if( IS_QLA4022(ha) ) {
-+ WRT_REG_DWORD(&ha->reg->u1.isp4022.intr_mask, CLR_RMASK(IMR_SCSI_INTR_ENABLE));
-+ PCI_POSTING(&ha->reg->u1.isp4022.intr_mask);
-+ } else {
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, CLR_RMASK(CSR_SCSI_INTR_ENABLE));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ QL4PRINT(QLP7, printk("scsi%d: %s: intSET_RMASK = %08x\n",
-+ ha->host_no, __func__,
-+ RD_REG_DWORD(&ha->reg->ctrl_status)));
-+ }
-+ LEAVE("qla4xxx_disable_intrs");
-+}
-+static inline void qla4xxx_enable_intrs(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ __qla4xxx_enable_intrs(ha);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+static inline void qla4xxx_disable_intrs(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ __qla4xxx_disable_intrs(ha);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+static __inline__ void
-+qla4xxx_suspend_lun(scsi_qla_host_t *, srb_t *sp, os_lun_t *, int, int);
-+static __inline__ void
-+qla4xxx_delay_lun(scsi_qla_host_t *, os_lun_t *, int);
-+
-+static __inline__ void
-+qla4xxx_suspend_lun(scsi_qla_host_t *ha, srb_t *sp, os_lun_t *lq, int time, int count)
-+{
-+ return (__qla4xxx_suspend_lun(ha, sp, lq, time, count, 0));
-+}
-+
-+static __inline__ void
-+qla4xxx_delay_lun(scsi_qla_host_t *ha, os_lun_t *lq, int time)
-+{
-+ return (__qla4xxx_suspend_lun(ha, NULL, lq, time, 1, 1));
-+}
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_iocb.c ./drivers/scsi/qla4xxx/ql4_iocb.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_iocb.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_iocb.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,376 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_get_req_pkt
-+ * qla4xxx_send_marker_iocb
-+ * qla4xxx_get_pdu
-+ * qla4xxx_free_pdu
-+ * qla4xxx_send_passthru0_iocb
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+/**************************************************************************
-+ * qla4xxx_get_req_pkt
-+ * This routine performs the following tasks:
-+ * - returns the current request_in pointer (if queue not full)
-+ * - advances the request_in pointer
-+ * - checks for queue full
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * queue_entry - Pointer to pointer to queue entry structure
-+ *
-+ * Output:
-+ * queue_entry - Return pointer to next available request packet
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully retrieved request packet
-+ * QLA_ERROR - Failed to retrieve request packet
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_get_req_pkt(scsi_qla_host_t *ha, QUEUE_ENTRY **queue_entry)
-+{
-+ uint16_t request_in;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_get_req_pkt");
-+
-+ *queue_entry = ha->request_ptr;
-+
-+ /* get the latest request_in and request_out index */
-+ request_in = ha->request_in;
-+ ha->request_out =
-+ (uint16_t) le32_to_cpu(ha->shadow_regs->req_q_out);
-+
-+ /* Advance request queue pointer and check for queue full */
-+ if (request_in == (REQUEST_QUEUE_DEPTH - 1)) {
-+ request_in = 0;
-+ ha->request_ptr = ha->request_ring;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: wraparound -- new "
-+ "request_in = %04x, new request_ptr = %p\n", ha->host_no,
-+ __func__, request_in, ha->request_ptr));
-+ } else {
-+ request_in++;
-+ ha->request_ptr++;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: new request_in = %04x, new "
-+ "request_ptr = %p\n", ha->host_no, __func__, request_in,
-+ ha->request_ptr));
-+ }
-+
-+ /* request queue is full, try again later */
-+ if ((ha->iocb_cnt + 1) >= ha->iocb_hiwat) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: request queue is full, "
-+ "iocb_cnt=%d, iocb_hiwat=%d\n", ha->host_no, __func__,
-+ ha->iocb_cnt, ha->iocb_hiwat));
-+
-+ /* restore request pointer */
-+ ha->request_ptr = *queue_entry;
-+ QL4PRINT(QLP2, printk("scsi%d: %s: restore request_ptr = %p, "
-+ "request_in = %04x, request_out = %04x\n", ha->host_no,
-+ __func__, ha->request_ptr, ha->request_in,
-+ ha->request_out));
-+ status = QLA_ERROR;
-+ } else {
-+ ha->request_in = request_in;
-+ memset(*queue_entry, 0, sizeof(**queue_entry));
-+ }
-+
-+ LEAVE("qla4xxx_get_req_pkt");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_send_marker_iocb
-+ * This routine issues a marker IOCB.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ * lun - SCSI LUN
-+ * marker_type - marker identifier
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully sent marker IOCB
-+ * QLA_ERROR - Failed to send marker IOCB
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_send_marker_iocb(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry,
-+ fc_lun_t *lun_entry)
-+{
-+ MARKER_ENTRY *marker_entry;
-+ unsigned long flags = 0;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_send_marker_iocb");
-+
-+ /* Acquire hardware specific lock */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ /* Get pointer to the queue entry for the marker */
-+ if (qla4xxx_get_req_pkt(ha, (QUEUE_ENTRY **) &marker_entry)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: request queue full, try "
-+ "again later\n", ha->host_no, __func__));
-+
-+ status = QLA_ERROR;
-+ goto exit_send_marker;
-+ }
-+
-+ /* Put the marker in the request queue */
-+ marker_entry->hdr.entryType = ET_MARKER;
-+ marker_entry->hdr.entryCount = 1;
-+ marker_entry->target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ marker_entry->modifier = cpu_to_le16(MM_LUN_RESET);
-+ marker_entry->lun[1] = LSB(lun_entry->lun); /*SAMII compliant lun*/
-+ marker_entry->lun[2] = MSB(lun_entry->lun);
-+ wmb();
-+
-+ QL4PRINT(QLP3, printk(KERN_INFO
-+ "scsi%d:%d:%d:%d: LUN_RESET Marker sent\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target, lun_entry->lun));
-+
-+ /* Tell ISP it's got a new I/O request */
-+ WRT_REG_DWORD(&ha->reg->req_q_in, ha->request_in);
-+ PCI_POSTING(&ha->reg->req_q_in);
-+
-+exit_send_marker:
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_send_marker_iocb");
-+
-+ return (status);
-+}
-+
-+PDU_ENTRY *
-+qla4xxx_get_pdu(scsi_qla_host_t *ha, uint32_t length)
-+{
-+ PDU_ENTRY *pdu;
-+ PDU_ENTRY *free_pdu_top;
-+ PDU_ENTRY *free_pdu_bottom;
-+ uint16_t pdu_active;
-+
-+ if (ha->free_pdu_top == NULL) {
-+ QL4PRINT(QLP2|QLP19,
-+ printk("scsi%d: %s: Out of PDUs!\n",
-+ ha->host_no, __func__));
-+ return(NULL);
-+ }
-+
-+ /* Save current state */
-+ free_pdu_top = ha->free_pdu_top;
-+ free_pdu_bottom = ha->free_pdu_bottom;
-+ pdu_active = ha->pdu_active + 1;
-+
-+ /* get next available pdu */
-+ pdu = free_pdu_top;
-+ free_pdu_top = pdu->Next;
-+
-+ if (free_pdu_top == NULL)
-+ free_pdu_bottom = NULL;
-+
-+
-+ /* round up to nearest page */
-+ length = (length + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
-+
-+
-+ /* Allocate pdu buffer PDU */
-+ pdu->Buff = pci_alloc_consistent(ha->pdev, length, &pdu->DmaBuff);
-+ if (pdu->Buff == NULL) {
-+ QL4PRINT(QLP2|QLP19,
-+ printk("scsi%d: %s: Unable to allocate memory "
-+ "for PDU buffer\n",
-+ ha->host_no, __func__));
-+ return(NULL);
-+ }
-+
-+ memset(pdu->Buff, 0, length);
-+
-+ /* Fill in remainder of PDU */
-+ pdu->BuffLen = length;
-+ pdu->SendBuffLen = 0;
-+ pdu->RecvBuffLen = 0;
-+ pdu->Next = NULL;
-+
-+ ha->free_pdu_top = free_pdu_top;
-+ ha->free_pdu_bottom = free_pdu_bottom;
-+ ha->pdu_active = pdu_active;
-+
-+ QL4PRINT(QLP19,
-+ printk("scsi%d: %s: Get PDU SUCCEEDED! "
-+ "Top %p Bot %p PDU %p Buf %p DmaBuf %lx Length %x "
-+ "Active %d\n", ha->host_no, __func__, free_pdu_top,
-+ free_pdu_bottom, pdu, pdu->Buff,
-+ (unsigned long)pdu->DmaBuff, pdu->BuffLen,
-+ pdu_active));
-+ return(pdu);
-+}
-+
-+void qla4xxx_free_pdu(scsi_qla_host_t *ha, PDU_ENTRY *pdu)
-+{
-+ if (ha->free_pdu_bottom == NULL) {
-+ ha->free_pdu_top = pdu;
-+ ha->free_pdu_bottom = pdu;
-+ }
-+ else {
-+ ha->free_pdu_bottom->Next = pdu;
-+ ha->free_pdu_bottom = pdu;
-+ }
-+
-+ pci_free_consistent(ha->pdev, pdu->BuffLen, pdu->Buff, pdu->DmaBuff);
-+ ha->pdu_active--;
-+
-+ QL4PRINT(QLP19,
-+ printk("scsi%d: %s: Top %p Bot %p PDU %p Buf %p DmaBuf %lx, "
-+ "Length %x Active %d\n", ha->host_no, __func__,
-+ ha->free_pdu_top, ha->free_pdu_bottom, pdu, pdu->Buff,
-+ (unsigned long) pdu->DmaBuff, pdu->BuffLen,
-+ ha->pdu_active));
-+
-+ /* Clear PDU */
-+ pdu->Buff = NULL;
-+ pdu->BuffLen = 0;
-+ pdu->SendBuffLen = 0;
-+ pdu->RecvBuffLen = 0;
-+ pdu->Next = NULL;
-+ pdu->DmaBuff = 0;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_send_passthru0_iocb
-+ * This routine issues a passthru0 IOCB.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks: hardware_lock acquired upon entry, interrupt context
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully sent marker IOCB
-+ * QLA_ERROR - Failed to send marker IOCB
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_send_passthru0_iocb(scsi_qla_host_t *ha,
-+ uint16_t fw_ddb_index,
-+ uint16_t connection_id,
-+ dma_addr_t pdu_dma_data,
-+ uint32_t send_len,
-+ uint32_t recv_len,
-+ uint16_t control_flags,
-+ uint32_t handle)
-+{
-+ PASSTHRU0_ENTRY *passthru_entry;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_send_passthru0_iocb");
-+
-+ /* Get pointer to the queue entry for the marker */
-+ if (qla4xxx_get_req_pkt(ha, (QUEUE_ENTRY **) &passthru_entry)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP5|QLP2|QLP19,
-+ printk("scsi%d: %s: request queue full, try again later\n",
-+ ha->host_no, __func__));
-+
-+ status = QLA_ERROR;
-+ goto exit_send_pt0;
-+ }
-+
-+ /* Fill in the request queue */
-+ passthru_entry->hdr.entryType = ET_PASSTHRU0;
-+ passthru_entry->hdr.entryCount = 1;
-+ passthru_entry->handle = cpu_to_le32(handle);
-+ passthru_entry->target = cpu_to_le16(fw_ddb_index);
-+ passthru_entry->connectionID = cpu_to_le16(connection_id);
-+ passthru_entry->timeout = __constant_cpu_to_le16(PT_DEFAULT_TIMEOUT);
-+
-+ if (send_len) {
-+ control_flags |= PT_FLAG_SEND_BUFFER;
-+ passthru_entry->outDataSeg64.base.addrHigh =
-+ cpu_to_le32(MSDW(pdu_dma_data));
-+ passthru_entry->outDataSeg64.base.addrLow =
-+ cpu_to_le32(LSDW(pdu_dma_data));
-+ passthru_entry->outDataSeg64.count =
-+ cpu_to_le32(send_len);
-+
-+ QL4PRINT(QLP19,
-+ printk("scsi%d: %s: sending 0x%X bytes, "
-+ "pdu_dma_data = %lx\n",
-+ ha->host_no, __func__, send_len,
-+ (unsigned long)pdu_dma_data));
-+ }
-+
-+ if (recv_len) {
-+ passthru_entry->inDataSeg64.base.addrHigh = cpu_to_le32(MSDW(pdu_dma_data));
-+ passthru_entry->inDataSeg64.base.addrLow = cpu_to_le32(LSDW(pdu_dma_data));
-+ passthru_entry->inDataSeg64.count = cpu_to_le32(recv_len);
-+ QL4PRINT(QLP19, printk("scsi%d: %s: receiving 0x%X bytes, pdu_dma_data = %lx\n",
-+ ha->host_no, __func__, recv_len, (unsigned long)pdu_dma_data));
-+ }
-+
-+ passthru_entry->controlFlags = cpu_to_le16(control_flags);
-+
-+ wmb();
-+
-+ QL4PRINT(QLP19, printk(KERN_INFO "scsi%d: Passthru0 IOCB type %x count %x In (%x) pt0 %p handle %x\n",
-+ ha->host_no, passthru_entry->hdr.entryType,
-+ passthru_entry->hdr.entryCount, ha->request_in, passthru_entry, handle));
-+ qla4xxx_dump_bytes(QLP10, passthru_entry, sizeof(*passthru_entry));
-+
-+
-+ /* Tell ISP it's got a new I/O request */
-+ WRT_REG_DWORD(&ha->reg->req_q_in, ha->request_in);
-+ PCI_POSTING(&ha->reg->req_q_in);
-+
-+ exit_send_pt0:
-+ LEAVE("qla4xxx_send_passthru0_iocb");
-+ return(status);
-+}
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_ioctl.h ./drivers/scsi/qla4xxx/ql4_ioctl.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_ioctl.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_ioctl.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,102 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#ifndef _QL4_IOCTL_H_
-+#define _QL4_IOCTL_H_
-+
-+#include <linux/blkdev.h>
-+#include <asm/uaccess.h>
-+
-+/*---------------------------------------------------------------------------*/
-+
-+typedef struct {
-+ int cmd;
-+ char *s;
-+} ioctl_tbl_row_t;
-+
-+#define QL_KMEM_ZALLOC(siz) ql4_kzmalloc((siz), GFP_ATOMIC)
-+#define QL_KMEM_FREE(ptr) kfree((ptr))
-+
-+/* Defines for Passthru */
-+#define IOCTL_INVALID_STATUS 0xffff
-+#define IOCTL_PASSTHRU_TOV 30
-+
-+/*
-+ * extern from ql4_xioctl.c
-+ */
-+extern void *
-+Q64BIT_TO_PTR(uint64_t);
-+
-+extern inline void *
-+ql4_kzmalloc(int, int);
-+
-+extern char *
-+IOCTL_TBL_STR(int, int);
-+
-+extern int
-+qla4xxx_alloc_ioctl_mem(scsi_qla_host_t *);
-+
-+extern void
-+qla4xxx_free_ioctl_mem(scsi_qla_host_t *);
-+
-+extern int
-+qla4xxx_get_ioctl_scrap_mem(scsi_qla_host_t *, void **, uint32_t);
-+
-+extern void
-+qla4xxx_free_ioctl_scrap_mem(scsi_qla_host_t *);
-+
-+/*
-+ * from ql4_inioct.c
-+ */
-+extern ioctl_tbl_row_t IOCTL_SCMD_IGET_DATA_TBL[];
-+extern ioctl_tbl_row_t IOCTL_SCMD_ISET_DATA_TBL[];
-+
-+extern int
-+qla4intioctl_logout_iscsi(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_copy_fw_flash(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_iocb_passthru(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_ping(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_get_data(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_set_data(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+extern int
-+qla4intioctl_hba_reset(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+/*
-+ * from ql4_init.c
-+ */
-+extern uint8_t
-+qla4xxx_logout_device(scsi_qla_host_t *, uint16_t, uint16_t);
-+
-+extern uint8_t
-+qla4xxx_login_device(scsi_qla_host_t *, uint16_t, uint16_t);
-+
-+extern uint8_t
-+qla4xxx_delete_device(scsi_qla_host_t *, uint16_t, uint16_t);
-+
-+#endif
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_isns.c ./drivers/scsi/qla4xxx/ql4_isns.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_isns.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_isns.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,2689 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_strtolower
-+ * qla4xxx_isns_build_entity_id
-+ * qla4xxx_isns_reenable
-+ * qla4xxx_isns_enable_callback
-+ * qla4xxx_isns_restart_service
-+ * qla4xxx_isns_restart_service_completion
-+ * qla4xxx_isns_init_isns_reg_attr_list
-+ * qla4xxx_isns_init_isns_dereg_attr_list
-+ * qla4xxx_isns_init_isns_scn_reg_attr_list
-+ * qla4xxx_isns_init_isns_scn_dereg_attr_list
-+ * qla4xxx_isns_init_isns_dev_get_next_attr_list
-+ * qla4xxx_isns_init_isns_dev_attr_qry_attr_list
-+ * qla4xxx_isns_init_attributes
-+ * qla4xxx_isns_append_attribute
-+ * qla4xxx_isns_build_iocb_handle
-+ * qla4xxx_isns_get_server_request
-+ * qla4xxx_isns_build_scn_registration_packet
-+ * qla4xxx_isns_build_scn_deregistration_packet
-+ * qla4xxx_isns_build_registration_packet
-+ * qla4xxx_isns_build_deregistration_packet
-+ * qla4xxx_isns_build_request_packet
-+ * qla4xxx_isns_build_server_request_response_packet
-+ * qla4xxx_isns_build_dev_get_next_packet
-+ * qla4xxx_isns_build_dev_attr_qry_packet
-+ * qla4xxx_isns_parse_get_next_response
-+ * qla4xxx_isns_parse_query_response
-+ * qla4xxx_isns_process_response
-+ * qla4xxx_isns_reassemble_pdu
-+ * qla4xxx_isns_scn
-+ * qla4xxx_isns_esi
-+ * qla4xxx_isns_server_request_error
-+ * qla4xxx_isns_parse_and_dispatch_server_request
-+ * qla4xxx_isns_parse_and_dispatch_server_response
-+ * qla4xxx_isns_dev_attr_reg
-+ * qla4xxx_isns_dev_attr_reg_rsp
-+ * qla4xxx_isns_scn_reg
-+ * qla4xxx_isns_scn_reg_rsp
-+ * qla4xxx_isns_dev_attr_qry
-+ * qla4xxx_isns_dev_attr_qry_rsp
-+ * qla4xxx_isns_dev_get_next
-+ * qla4xxx_isns_dev_get_next_rsp
-+ * qla4xxx_isns_dev_dereg
-+ * qla4xxx_isns_dev_dereg_rsp
-+ * qla4xxx_isns_scn_dereg
-+ * qla4xxx_isns_scn_dereg_rsp
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+void qla4xxx_isns_enable_callback(scsi_qla_host_t *, uint32_t, uint32_t, uint32_t, uint32_t);
-+uint8_t qla4xxx_isns_restart_service(scsi_qla_host_t *);
-+uint32_t qla4xxx_isns_build_iocb_handle(scsi_qla_host_t *, uint32_t, PDU_ENTRY *);
-+uint8_t qla4xxx_isns_get_server_request(scsi_qla_host_t *, uint32_t, uint16_t);
-+uint8_t qla4xxx_isns_reassemble_pdu(scsi_qla_host_t *, uint8_t *, uint32_t *);
-+uint8_t qla4xxx_isns_parse_and_dispatch_server_request(scsi_qla_host_t *, uint8_t *, uint32_t, uint16_t);
-+uint8_t qla4xxx_isns_parse_and_dispatch_server_response(scsi_qla_host_t *, uint8_t *, uint32_t);
-+uint8_t qla4xxx_isns_build_scn_registration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *packet_size);
-+uint8_t qla4xxx_isns_build_scn_deregistration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *packet_size);
-+uint8_t qla4xxx_isns_build_registration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buff,
-+ uint32_t buff_size,
-+ uint8_t *isns_entity_id,
-+ uint8_t *ip_addr,
-+ uint32_t port_number,
-+ uint32_t scn_port,
-+ uint32_t esi_port,
-+ uint8_t *local_alias,
-+ uint32_t *packet_size);
-+uint8_t qla4xxx_isns_build_deregistration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buff,
-+ uint32_t buff_size,
-+ uint8_t *isns_entity_id,
-+ uint8_t *ip_addr,
-+ uint32_t port_number,
-+ uint32_t *packet_size);
-+uint8_t qla4xxx_isns_build_request_packet(scsi_qla_host_t *ha,
-+ uint8_t *buff,
-+ uint32_t buff_size,
-+ uint16_t function_id,
-+ uint16_t tx_id,
-+ uint8_t use_replace_flag,
-+ ATTRIBUTE_LIST *attr_list,
-+ uint32_t *packet_size);
-+uint8_t qla4xxx_isns_append_attribute(scsi_qla_host_t *ha,
-+ uint8_t **buffer,
-+ uint8_t *buffer_end,
-+ ATTRIBUTE_LIST *attr_list);
-+uint8_t qla4xxx_isns_dev_attr_reg(scsi_qla_host_t *);
-+
-+uint8_t qla4xxx_isns_dev_attr_reg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+uint8_t qla4xxx_isns_dev_attr_qry_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+uint8_t qla4xxx_isns_dev_get_next_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+uint8_t qla4xxx_isns_dev_dereg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+uint8_t qla4xxx_isns_scn_reg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+uint8_t qla4xxx_isns_scn_dereg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size);
-+
-+uint8_t qla4xxx_isns_scn_dereg(scsi_qla_host_t *);
-+uint8_t qla4xxx_isns_scn_reg(scsi_qla_host_t *ha);
-+uint8_t qla4xxx_isns_dev_get_next (scsi_qla_host_t *ha,
-+ uint8_t *last_iscsi_name);
-+
-+
-+const char *isns_error_code_msg[] = ISNS_ERROR_CODE_TBL();
-+
-+static void
-+qla4xxx_strtolower(uint8_t *str)
-+{
-+ uint8_t *tmp;
-+ for (tmp = str; *tmp != '\0'; tmp++) {
-+ if (*tmp >= 'A' && *tmp <= 'Z')
-+ *tmp += 'a' - 'A';
-+ }
-+}
-+
-+void
-+qla4xxx_isns_build_entity_id(scsi_qla_host_t *ha)
-+{
-+ sprintf(ha->isns_entity_id, "eid:qlogic:qla4010-%s", ha->serial_number);
-+ qla4xxx_strtolower(ha->isns_entity_id);
-+}
-+
-+uint8_t
-+qla4xxx_isns_reenable(scsi_qla_host_t *ha,
-+ uint32_t isns_ip_addr,
-+ uint16_t isns_server_port_num)
-+{
-+ set_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags);
-+ ISNS_CLEAR_FLAGS(ha);
-+
-+ if (qla4xxx_isns_enable(ha, isns_ip_addr, isns_server_port_num)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Failed!\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+/* interrupt context, hardware lock set */
-+void
-+qla4xxx_isns_enable_callback(scsi_qla_host_t *ha,
-+ uint32_t svr,
-+ uint32_t scn,
-+ uint32_t esi,
-+ uint32_t nsh)
-+{
-+ ha->isns_connection_id = (uint16_t) svr & 0x0000FFFF;
-+ ha->isns_scn_conn_id = (uint16_t) scn & 0x0000FFFF;
-+ ha->isns_esi_conn_id = (uint16_t) esi & 0x0000FFFF;
-+ ha->isns_nsh_conn_id = (uint16_t) nsh & 0x0000FFFF;
-+
-+ ha->isns_remote_port_num = (uint16_t) (svr >> 16);
-+ ha->isns_scn_port_num = (uint16_t) (scn >> 16);
-+ ha->isns_esi_port_num = (uint16_t) (esi >> 16);
-+ ha->isns_nsh_port_num = (uint16_t) (nsh >> 16);
-+
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: iSNS Server TCP Connect succeeded %d\n",
-+ ha->host_no, __func__, svr));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: Remote iSNS Server %d ConnID %x\n",
-+ ha->host_no, __func__,
-+ ha->isns_remote_port_num,
-+ ha->isns_connection_id));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: Local SCN Listen %d ConnID %x\n",
-+ ha->host_no, __func__,
-+ ha->isns_scn_port_num,
-+ ha->isns_scn_conn_id));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: Local ESI Listen %d ConnID %x\n",
-+ ha->host_no, __func__,
-+ ha->isns_esi_port_num,
-+ ha->isns_esi_conn_id));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: Local HSN Listen %d ConnID %x\n",
-+ ha->host_no, __func__,
-+ ha->isns_nsh_port_num,
-+ ha->isns_nsh_conn_id));
-+
-+ if (ha->isns_connection_id == (uint16_t)-1) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: iSNS server refused connection\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_isns_restart_service(ha);
-+ return;
-+ }
-+
-+ set_bit(ISNS_FLAG_ISNS_SRV_ENABLED, &ha->isns_flags);
-+
-+ if (test_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags)) {
-+ if (qla4xxx_isns_scn_dereg(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: qla4xxx_isns_scn_dereg failed!\n",
-+ ha->host_no, __func__));
-+ return;
-+ }
-+ }
-+ else {
-+ if (qla4xxx_isns_dev_attr_reg(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: qla4xxx_isns_dev_attr_reg failed!\n",
-+ ha->host_no, __func__));
-+ return;
-+ }
-+ }
-+}
-+
-+
-+uint8_t
-+qla4xxx_isns_restart_service(scsi_qla_host_t *ha)
-+{
-+ qla4xxx_isns_disable(ha);
-+ set_bit(ISNS_FLAG_RESTART_SERVICE, &ha->isns_flags);
-+ ISNS_CLEAR_FLAGS(ha);
-+
-+ /* Set timer for restart to complete */
-+ atomic_set(&ha->isns_restart_timer, ISNS_RESTART_TOV);
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_restart_service_completion(scsi_qla_host_t *ha,
-+ uint32_t isns_ip_addr,
-+ uint16_t isns_server_port_num)
-+{
-+ QL4PRINT(QLP20, printk("scsi%d: %s: isns_ip_addr %08x\n",
-+ ha->host_no, __func__, isns_ip_addr));
-+
-+ if (qla4xxx_isns_enable(ha, isns_ip_addr, isns_server_port_num)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: failed!\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+ else {
-+ set_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags);
-+ ISNS_CLEAR_FLAGS(ha);
-+ return(QLA_SUCCESS);
-+ }
-+}
-+
-+
-+static void
-+qla4xxx_isns_init_isns_reg_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_reg_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1},
-+ // Entity ID.
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes to register
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1},
-+ { ISNS_ATTR_TAG_ENTITY_PROTOCOL, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ENTITY_PROTOCOL_ISCSI)},
-+ { ISNS_ATTR_TAG_PORTAL_IP_ADDRESS, ISNS_ATTR_TYPE_ADDRESS, -1},
-+ { ISNS_ATTR_TAG_PORTAL_PORT, ISNS_ATTR_TYPE_ULONG, -1},
-+ { ISNS_ATTR_TAG_SCN_PORT, ISNS_ATTR_TYPE_ULONG, -1},
-+ { ISNS_ATTR_TAG_ESI_PORT, ISNS_ATTR_TYPE_ULONG, -1},
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_ISCSI_NODE_TYPE, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ISCSI_NODE_TYPE_INITIATOR)},
-+ { ISNS_ATTR_TAG_ISCSI_ALIAS, ISNS_ATTR_TYPE_STRING, -1}, // Friendly machine name?
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_reg_attr_list, isns_reg_attr_list, sizeof(isns_reg_attr_list));
-+}
-+
-+static void
-+qla4xxx_isns_init_isns_dereg_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_dereg_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // No key attribute for DevDereg
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1}, // FQDN
-+#if 0
-+ { ISNS_ATTR_TAG_PORTAL_IP_ADDRESS, ISNS_ATTR_TYPE_ADDRESS, -1},
-+ { ISNS_ATTR_TAG_PORTAL_PORT, ISNS_ATTR_TYPE_ULONG, -1},
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+#endif
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_dereg_attr_list, isns_dereg_attr_list, sizeof(isns_dereg_attr_list));
-+}
-+
-+static void
-+qla4xxx_isns_init_isns_scn_reg_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_scn_reg_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // Key attributes
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // Required delimiter to indicate division between key and operating attrs.
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes
-+ { ISNS_ATTR_TAG_ISCSI_SCN_BITMAP, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ISCSI_SCN_OBJECT_UPDATED |
-+ ISCSI_SCN_OBJECT_ADDED |
-+ ISCSI_SCN_OBJECT_REMOVED |
-+ ISCSI_SCN_TARGET_AND_SELF_INFO_ONLY)},
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_scn_reg_attr_list, isns_scn_reg_attr_list, sizeof(isns_scn_reg_attr_list));
-+}
-+
-+static void
-+qla4xxx_isns_init_isns_scn_dereg_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_scn_dereg_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // Key attributes
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_scn_dereg_attr_list, isns_scn_dereg_attr_list, sizeof(isns_scn_dereg_attr_list));
-+}
-+
-+static void
-+qla4xxx_isns_init_isns_dev_get_next_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_dev_get_next_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // Key attributes
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, -1},
-+ // Required delimiter to indicate division between key and operating attrs.
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes (attributes of object matching key attribute to return)
-+ { ISNS_ATTR_TAG_ISCSI_NODE_TYPE, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ISCSI_NODE_TYPE_TARGET)},
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_dev_get_next_attr_list, isns_dev_get_next_attr_list, sizeof(isns_dev_get_next_attr_list));
-+}
-+
-+static void
-+qla4xxx_isns_init_isns_dev_attr_qry_attr_list(scsi_qla_host_t *ha)
-+{
-+ ATTRIBUTE_LIST isns_dev_attr_qry_attr_list[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // Key attributes
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, -1},
-+ // Required delimiter to indicate division between key and operating attrs.
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes (attributes of objects matching key attributes to return)
-+ { ISNS_ATTR_TAG_ENTITY_PROTOCOL, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_ISCSI_NODE_TYPE, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_ISCSI_ALIAS, ISNS_ATTR_TYPE_EMPTY, 0}, // Friendly name
-+ { ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_PORTAL_IP_ADDRESS, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_PORTAL_PORT, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP, ISNS_ATTR_TYPE_EMPTY, 0},
-+ { ISNS_ATTR_TAG_DD_ID, ISNS_ATTR_TYPE_EMPTY, 0},
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->isns_dev_attr_qry_attr_list, isns_dev_attr_qry_attr_list, sizeof(isns_dev_attr_qry_attr_list));
-+}
-+
-+uint8_t
-+qla4xxx_isns_init_attributes (scsi_qla_host_t *ha)
-+{
-+ /* Separate these calls to minimize stack usage */
-+
-+ qla4xxx_isns_init_isns_reg_attr_list(ha);
-+ qla4xxx_isns_init_isns_dereg_attr_list(ha);
-+ qla4xxx_isns_init_isns_scn_reg_attr_list(ha);
-+ qla4xxx_isns_init_isns_scn_dereg_attr_list(ha);
-+ qla4xxx_isns_init_isns_dev_get_next_attr_list(ha);
-+ qla4xxx_isns_init_isns_dev_attr_qry_attr_list(ha);
-+
-+#if 0
-+ {
-+ ATTRIBUTE_LIST asRegUpdateAddObjectsAttrList[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // We are adding objects to an Entity so specify the Entity as the Key
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1}, // FQDN
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes to register
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_ISCSI_NODE_TYPE, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ISCSI_NODE_TYPE_INITIATOR)},
-+ { ISNS_ATTR_TAG_ISCSI_ALIAS, ISNS_ATTR_TYPE_STRING, -1}, // Friendly machine name?
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ ATTRIBUTE_LIST asRegUpdateNodeAttrList[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // We updating attributes of a Node so specify the Node as the Key
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes to update
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_ISCSI_ALIAS, ISNS_ATTR_TYPE_STRING, -1}, // Friendly machine name?
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ ATTRIBUTE_LIST asRegReplaceNodeAttrList[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // We updating attributes of a Node so specify the Node as the Key
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes to update
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ { ISNS_ATTR_TAG_ISCSI_NODE_TYPE, ISNS_ATTR_TYPE_ULONG, cpu_to_be32(ISCSI_NODE_TYPE_INITIATOR)},
-+ { ISNS_ATTR_TAG_ISCSI_ALIAS, ISNS_ATTR_TYPE_STRING, -1}, // Friendly machine name?
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ ATTRIBUTE_LIST asRegUpdateEntityAttrList[] = {
-+ // Source attribute
-+ { ISNS_ATTR_TAG_ISCSI_NAME, ISNS_ATTR_TYPE_STRING, (unsigned long) ha->name_string},
-+ // We updating attributes of an Entity so specify the Entity as the Key
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1}, // FQDN
-+ { ISNS_ATTR_TAG_DELIMITER, ISNS_ATTR_TYPE_EMPTY, 0},
-+ // Operating attributes to update
-+ { ISNS_ATTR_TAG_ENTITY_IDENTIFIER, ISNS_ATTR_TYPE_STRING, -1}, // FQDN
-+ { ISNS_ATTR_TAG_MGMT_IP_ADDRESS, ISNS_ATTR_TYPE_ADDRESS, -1},
-+
-+ { 0, 0, 0} // Terminating NULL entry
-+ };
-+
-+ memcpy(ha->asRegUpdateAddObjectsAttrList, asRegUpdateAddObjectsAttrList, sizeof(asRegUpdateAddObjectsAttrList));
-+ memcpy(ha->asRegUpdateNodeAttrList, asRegUpdateNodeAttrList, sizeof(asRegUpdateNodeAttrList));
-+ memcpy(ha->asRegReplaceNodeAttrList, asRegReplaceNodeAttrList, sizeof(asRegReplaceNodeAttrList));
-+ memcpy(ha->asRegUpdateEntityAttrList, asRegUpdateEntityAttrList, sizeof(asRegUpdateEntityAttrList));
-+ }
-+#endif
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_append_attribute(scsi_qla_host_t *ha,
-+ uint8_t **buffer,
-+ uint8_t *buffer_end,
-+ ATTRIBUTE_LIST *attribute)
-+{
-+
-+ ISNS_ATTRIBUTE *isns_attr;
-+ uint32_t data_len;
-+ uint8_t *local;
-+
-+ isns_attr = (ISNS_ATTRIBUTE *) *buffer;
-+
-+ switch (attribute->type) {
-+ case ISNS_ATTR_TYPE_EMPTY:
-+ data_len = 0;
-+ if ((&isns_attr->value[0] + data_len) > buffer_end) {
-+ return(QLA_ERROR);
-+ }
-+ isns_attr->tag = cpu_to_be32(attribute->isns_tag);
-+ isns_attr->length = cpu_to_be32(data_len);
-+ break;
-+
-+ case ISNS_ATTR_TYPE_STRING:
-+ /*
-+ * Length must include NULL terminator.
-+ * Note also that all iSNS strings must be UTF-8 encoded.
-+ * You should encode your strings for UTF-8 before registering
-+ * them with the iSNS server.
-+ */
-+ data_len = strlen ((uint8_t *) attribute->data) + sizeof(uint8_t);
-+ if (data_len % 4) {
-+ data_len += (4 - (data_len % 4)); // Pad to 4 byte boundary.
-+ }
-+
-+ if ((&isns_attr->value[0] + data_len) > buffer_end) {
-+ return(QLA_ERROR);
-+ }
-+ isns_attr->tag = cpu_to_be32(attribute->isns_tag);
-+ isns_attr->length = cpu_to_be32(data_len);
-+ memset(isns_attr->value, 0, data_len);
-+ strcpy (&isns_attr->value[0], (uint8_t *) attribute->data);
-+ break;
-+
-+ case ISNS_ATTR_TYPE_ULONG:
-+ data_len = sizeof(uint32_t);
-+ if ((isns_attr->value + data_len) > buffer_end) {
-+ return(QLA_ERROR);
-+ }
-+ isns_attr->tag = cpu_to_be32(attribute->isns_tag);
-+ isns_attr->length = cpu_to_be32(data_len);
-+ *(uint32_t *) isns_attr->value = (uint32_t) attribute->data;
-+ break;
-+
-+ case ISNS_ATTR_TYPE_ADDRESS:
-+ local = (uint8_t *) attribute->data;
-+ data_len = 16; // Size of an IPv6 address
-+ if ((isns_attr->value + data_len) > buffer_end) {
-+ return(QLA_ERROR);
-+ }
-+ isns_attr->tag = cpu_to_be32(attribute->isns_tag);
-+ isns_attr->length = cpu_to_be32(data_len);
-+ // Prepend IP Address with 0xFFFF to indicate this is an IPv4
-+ // only address. IPv6 addresses not supported by driver.
-+ memset(isns_attr->value, 0, 16);
-+ isns_attr->value[10] = 0xFF;
-+ isns_attr->value[11] = 0xFF;
-+ isns_attr->value[12] = local[0];
-+ isns_attr->value[13] = local[1];
-+ isns_attr->value[14] = local[2];
-+ isns_attr->value[15] = local[3];
-+ break;
-+
-+ default:
-+ return(QLA_ERROR);
-+
-+ }
-+
-+ *buffer = &isns_attr->value[0] + data_len;
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+uint32_t
-+qla4xxx_isns_build_iocb_handle(scsi_qla_host_t *ha,
-+ uint32_t type,
-+ PDU_ENTRY *pdu_entry)
-+{
-+ uint32_t handle;
-+
-+ handle = (IOCB_ISNS_PT_PDU_TYPE(type) |
-+ (((uint8_t *)pdu_entry - (uint8_t *)ha->pdu_queue)
-+ / sizeof(PDU_ENTRY)));
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: type %x PDU %p = handle %x\n",
-+ ha->host_no, __func__,
-+ type, pdu_entry, handle));
-+ return(handle);
-+}
-+
-+/*
-+ * Remarks:
-+ * hardware_lock locked upon entry
-+ */
-+uint8_t
-+qla4xxx_isns_get_server_request(scsi_qla_host_t *ha,
-+ uint32_t pdu_buff_len,
-+ uint16_t connection_id)
-+{
-+ PDU_ENTRY *pdu_entry;
-+
-+ pdu_entry = qla4xxx_get_pdu(ha, MAX(pdu_buff_len, PAGE_SIZE));
-+ if (pdu_entry == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = 0;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(ha, ISNS_DEVICE_INDEX, connection_id,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle(ha, /*ISNS_REQ_RSP_PDU*/ISNS_ASYNCH_REQ_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: send_passthru_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_scn_registration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *packet_size)
-+{
-+ /*
-+ * Fill in all of the run time requested data in the attribute array
-+ * then call iSNSBuildRequestPacket to do the actual work.
-+ */
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buffer, buffer_size,
-+ ISNS_FCID_SCNReg,
-+ ha->isns_transaction_id,
-+ 0,
-+ ha->isns_scn_reg_attr_list,
-+ packet_size));
-+}
-+
-+
-+uint8_t
-+qla4xxx_isns_build_scn_deregistration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *packet_size)
-+{
-+ /*
-+ * Fill in all of the run time requested data in the attribute array
-+ * then call iSNSBuildRequestPacket to do the actual work.
-+ */
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buffer, buffer_size,
-+ ISNS_FCID_SCNDereg,
-+ ha->isns_transaction_id,
-+ 0,
-+ ha->isns_scn_dereg_attr_list,
-+ packet_size));
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_registration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buff,
-+ uint32_t buff_size,
-+ uint8_t *isns_entity_id,
-+ uint8_t *ip_addr,
-+ uint32_t port_number,
-+ uint32_t scn_port,
-+ uint32_t esi_port,
-+ uint8_t *local_alias,
-+ uint32_t *packet_size)
-+{
-+ /*
-+ * Fill in all of the run time requested data in the attribute array,
-+ * then call build_request_packet to do the actual work.
-+ */
-+ ha->isns_reg_attr_list[1].data = (unsigned long) isns_entity_id;
-+ ha->isns_reg_attr_list[3].data = (unsigned long) isns_entity_id;
-+ ha->isns_reg_attr_list[5].data = (unsigned long) ip_addr;
-+ ha->isns_reg_attr_list[6].data = cpu_to_be32(port_number);
-+ ha->isns_reg_attr_list[7].data = cpu_to_be32(scn_port);
-+ ha->isns_reg_attr_list[8].data = cpu_to_be32(esi_port);
-+ if (local_alias && local_alias[0]) {
-+ ha->isns_reg_attr_list[11].data = (unsigned long) local_alias;
-+ }
-+ else {
-+ ha->isns_reg_attr_list[11].data = (unsigned long) "<No alias specified>";
-+ }
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buff, buff_size,
-+ ISNS_FCID_DevAttrReg,
-+ ha->isns_transaction_id,
-+ 0,
-+ ha->isns_reg_attr_list,
-+ packet_size));
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_deregistration_packet(scsi_qla_host_t *ha,
-+ uint8_t *buff,
-+ uint32_t buff_size,
-+ uint8_t *isns_entity_id,
-+ uint8_t *ip_addr,
-+ uint32_t port_number,
-+ uint32_t *packet_size)
-+{
-+ /*
-+ * Fill in all of the run time requested data in the attribute array,
-+ * then call build_request_packet to do the actual work.
-+ */
-+ ha->isns_dereg_attr_list[2].data = (unsigned long) isns_entity_id;
-+ #if 0
-+ ha->isns_dereg_attr_list[3].data = (unsigned long) ip_addr;
-+ ha->isns_dereg_attr_list[4].data = (unsigned long) cpu_to_be32(port_number);
-+ #endif
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buff, buff_size,
-+ ISNS_FCID_DevDereg,
-+ ha->isns_transaction_id,
-+ 0,
-+ ha->isns_dereg_attr_list,
-+ packet_size));
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_request_packet(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint16_t function_id,
-+ uint16_t tx_id,
-+ uint8_t use_replace_flag,
-+ ATTRIBUTE_LIST *attr_list,
-+ uint32_t *packet_size)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ uint8_t *ptr;
-+ uint8_t *buffer_end;
-+ uint8_t *payload_start;
-+ uint32_t i;
-+ uint8_t success;
-+
-+ /*
-+ * Ensure that the buffer size is at a minimum sufficient to hold the
-+ * message header plus at least one attribute.
-+ */
-+ if (buffer_size < (sizeof(*isns_message) + sizeof(*attr_list))) {
-+ QL4PRINT(QLP12, printk("scsi%d: %s: Insufficient buffer size "
-+ "%d, need %d\n",
-+ ha->host_no, __func__, buffer_size,
-+ (unsigned int) (sizeof(*isns_message) +
-+ sizeof(*attr_list))));
-+
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ buffer_end = (uint8_t *) ((unsigned long) buffer + buffer_size);
-+
-+ /* Initialize message header contents */
-+ isns_message->isnsp_version = cpu_to_be16(ISNSP_VERSION);
-+ isns_message->function_id = cpu_to_be16(function_id);
-+ if (use_replace_flag) {
-+ isns_message->flags = cpu_to_be16(ISNSP_CLIENT_SENDER |
-+ ISNSP_FIRST_PDU |
-+ ISNSP_LAST_PDU |
-+ ISNSP_REPLACE_FLAG);
-+ }
-+ else {
-+ isns_message->flags = cpu_to_be16(ISNSP_CLIENT_SENDER |
-+ ISNSP_FIRST_PDU |
-+ ISNSP_LAST_PDU);
-+ }
-+
-+ isns_message->transaction_id = cpu_to_be16(tx_id);
-+ isns_message->sequence_id = 0; // First and only packet in this message
-+
-+ ptr = payload_start = &isns_message->payload[0];
-+
-+ /*
-+ * Now that most of the message header has been initialized (we'll fill
-+ * in the size when we're finished), let's append the desired attributes
-+ * to the request packet.
-+ */
-+ success = 1;
-+ for (i = 0; attr_list[i].type && success; i++) {
-+ success = (qla4xxx_isns_append_attribute (ha, &ptr, buffer_end,
-+ &attr_list[i])
-+ == QLA_SUCCESS);
-+ }
-+
-+ if (!success) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Ran out of buffer space\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ /*
-+ * We've successfully finished building the request packet.
-+ * Set the size field.
-+ */
-+ isns_message->pdu_length = cpu_to_be16((unsigned long) ptr -
-+ (unsigned long) payload_start);
-+
-+ *packet_size = (uint32_t) ((unsigned long) ptr -
-+ (unsigned long) buffer);
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_server_request_response_packet(scsi_qla_host_t *ha,
-+ uint8_t * buffer,
-+ uint32_t buffer_size,
-+ uint16_t function_id, //cpu
-+ uint32_t error_code, //cpu
-+ uint16_t transaction_id, //cpu
-+ uint32_t *packet_size)
-+{
-+ ISNSP_MESSAGE_HEADER * isns_message;
-+ ISNSP_RESPONSE_HEADER * isns_response;
-+ uint8_t *ptr;
-+ uint8_t *buffer_end;
-+ uint8_t *payload_start;
-+
-+ // Ensure that the buffer size is at a minimum sufficient to hold the
-+ // message headers.
-+
-+ if (buffer_size < (sizeof(ISNSP_MESSAGE_HEADER) + sizeof(ISNSP_RESPONSE_HEADER))) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Insufficient buffer size %x\n",
-+ ha->host_no, __func__, buffer_size));
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+ payload_start = ( uint8_t *) isns_response;
-+ buffer_end = ( uint8_t *) (buffer + buffer_size);
-+
-+ // Initialize message header contents.
-+
-+ isns_message->isnsp_version = cpu_to_be16(ISNSP_VERSION);
-+ isns_message->function_id = (function_id);
-+ //isns_message->function_id = cpu_to_be16(function_id);
-+ isns_message->flags = cpu_to_be16(ISNSP_CLIENT_SENDER |
-+ ISNSP_FIRST_PDU |
-+ ISNSP_LAST_PDU);
-+ isns_message->transaction_id =(transaction_id);
-+ //isns_message->transaction_id = cpu_to_be16(transaction_id);
-+ isns_message->sequence_id = 0; // First and only packet in this message
-+
-+ isns_response->error_code = cpu_to_be32(error_code);
-+
-+ ptr = &isns_response->attributes[0];
-+
-+ // We've successfully finished building the request packet.
-+ // Set the size field.
-+
-+ //QLASSERT (!((ptr - payload_start) % 4));
-+
-+ isns_message->pdu_length = cpu_to_be16((unsigned long) ptr -
-+ (unsigned long) payload_start);
-+
-+ *packet_size = (unsigned long) ptr - (unsigned long) buffer;
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_dev_get_next_packet (scsi_qla_host_t *ha,
-+ uint8_t * buffer,
-+ uint32_t buffer_size,
-+ uint8_t * last_iscsi_name,
-+ uint32_t *packet_size)
-+{
-+ // Fill in all of the run time requested data in the attribute array
-+ // then call qla4xxx_isns_build_request_packet to do the actual work.
-+
-+ if (last_iscsi_name && last_iscsi_name[0]) {
-+ ha->isns_dev_get_next_attr_list[1].type = ISNS_ATTR_TYPE_STRING;
-+ ha->isns_dev_get_next_attr_list[1].data = (unsigned long) last_iscsi_name;
-+ }
-+ else {
-+ ha->isns_dev_get_next_attr_list[1].type = ISNS_ATTR_TYPE_EMPTY;
-+ ha->isns_dev_get_next_attr_list[1].data = 0;
-+ }
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buffer, buffer_size,
-+ ISNS_FCID_DevGetNext,
-+ ha->isns_transaction_id,
-+ 0,
-+ ha->isns_dev_get_next_attr_list,
-+ packet_size));
-+}
-+
-+uint8_t
-+qla4xxx_isns_build_dev_attr_qry_packet (scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint8_t *object_iscsi_name,
-+ uint32_t *packet_size)
-+{
-+ // Fill in all of the run time requested data in the attribute array
-+ // then call qla4xxx_isns_build_request_packet to do the actual work.
-+
-+ ha->isns_dev_attr_qry_attr_list[1].data = (unsigned long) object_iscsi_name;
-+
-+ return(qla4xxx_isns_build_request_packet(ha, buffer, buffer_size,
-+ ISNS_FCID_DevAttrQry,
-+ ha->isns_transaction_id, 0,
-+ ha->isns_dev_attr_qry_attr_list,
-+ packet_size));
-+}
-+
-+uint8_t
-+qla4xxx_isns_parse_get_next_response(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *isns_error, // cpu, w.r.t. PPC byte order
-+ uint8_t *last_iscsi_name,
-+ uint32_t last_iscsi_name_size,
-+ uint8_t *IsTarget)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+ ISNS_ATTRIBUTE *isns_attr;
-+ uint8_t *buffer_end;
-+
-+ *IsTarget = 0;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ buffer_end = ( uint8_t *) (( uint8_t *) &isns_message->payload[0] +
-+ be16_to_cpu(isns_message->pdu_length));
-+
-+ // Validate pdu_length specified in the iSNS message header.
-+
-+ if (((unsigned long) buffer_end -
-+ (unsigned long) buffer) > buffer_size) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid length field in "
-+ "iSNS response from iSNS server\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ // It is safe to assume from this point on that the pdu_length value
-+ // (and thus our idea about the end of the buffer) is valid.
-+
-+ // Ensure that we have the correct function_id.
-+
-+ if (be16_to_cpu(isns_message->function_id) != ISNS_FCID_DevGetNextRsp) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid Function ID (0x%04x) "
-+ "in iSNS response from iSNS server\n",
-+ ha->host_no, __func__,
-+ be16_to_cpu(isns_message->function_id)));
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+
-+ *isns_error = be32_to_cpu(isns_response->error_code);
-+ if (*isns_error) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: iSNS Error code: %d\n",
-+ ha->host_no, __func__, *isns_error));
-+
-+ if (*isns_error == ISNS_ERR_NO_SUCH_ENTRY) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: No more targets.\n",
-+ ha->host_no, __func__));
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Get Next failed. Error code %x\n",
-+ ha->host_no, __func__, *isns_error));
-+ }
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_attr = (ISNS_ATTRIBUTE *) &isns_response->attributes[0];
-+
-+ // Save the returned key attribute for the next DevGetNext request.
-+
-+ if (VALIDATE_ATTR(isns_attr, buffer_end) &&
-+ be32_to_cpu(isns_attr->tag) == ISNS_ATTR_TAG_ISCSI_NAME) {
-+ strncpy(last_iscsi_name, &isns_attr->value[0], last_iscsi_name_size);
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Bad Key attribute in DevGetNextRsp\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ // Point to next attribute.
-+
-+ isns_attr = NEXT_ATTR(isns_attr);
-+
-+ if (VALIDATE_ATTR(isns_attr, buffer_end) &&
-+ be32_to_cpu(isns_attr->tag) == ISNS_ATTR_TAG_DELIMITER) {
-+ ; // Do nothing.
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: No delimiter in DevGetNextRsp\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ *IsTarget = 1; //FIXME
-+
-+ // Point to next attribute.
-+
-+ isns_attr = NEXT_ATTR(isns_attr);
-+
-+ if (VALIDATE_ATTR(isns_attr, buffer_end) &&
-+ be32_to_cpu(isns_attr->tag) == ISNS_ATTR_TAG_ISCSI_NODE_TYPE) {
-+ if (be32_to_cpu(*(uint32_t *) &isns_attr->value[0]) & ISCSI_NODE_TYPE_TARGET) {
-+ *IsTarget = 1;
-+ }
-+ }
-+ #if 0
-+ else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Bad operating attr in DevGetNextRsp (%d)\n",
-+ ha->host_no, __func__, be16_to_cpu(isns_attr->tag)));
-+ return(QLA_ERROR);
-+ }
-+ #endif
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_parse_query_response (scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint32_t *isns_error, // cpu
-+ ISNS_DISCOVERED_TARGET *isns_discovered_target,
-+ uint8_t *IsTarget,
-+ uint8_t *last_iscsi_name)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+ ISNS_ATTRIBUTE *isns_attr;
-+ uint8_t *buffer_end;
-+ uint8_t *tmpptr;
-+ uint16_t wTmp;
-+ uint32_t ulTmp;
-+ uint32_t i;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ buffer_end = &isns_message->payload[0] +
-+ be16_to_cpu(isns_message->pdu_length);
-+
-+ // Validate pdu_length specified in the iSNS message header.
-+
-+ if (((unsigned long) buffer_end -
-+ (unsigned long) buffer) > buffer_size) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid length field in "
-+ "iSNS response from iSNS server\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ // It is safe to assume from this point on that the pdu_length value
-+ // (and thus our idea about the end of the buffer) is valid.
-+
-+ // Ensure that we have the correct function_id.
-+
-+ if (be16_to_cpu(isns_message->function_id) != ISNS_FCID_DevAttrQryRsp) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid Function ID %04x in iSNS response\n",
-+ ha->host_no, __func__,
-+ be16_to_cpu(isns_message->function_id)));
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+
-+ QL4PRINT(QLP20, printk("-----------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: DevAttrQry response from iSNS server:\n",
-+ ha->host_no, __func__));
-+
-+ *isns_error = be32_to_cpu(isns_response->error_code);
-+ if (*isns_error) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: iSNS Query failed. error_code %x.\n",
-+ ha->host_no, __func__, *isns_error));
-+ return(QLA_ERROR);
-+ }
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Attributes:\n", ha->host_no, __func__));
-+
-+ isns_attr = (ISNS_ATTRIBUTE *) &isns_response->attributes[0];
-+
-+ // Skip key and delimiter attributes.
-+
-+ while (VALIDATE_ATTR(isns_attr, buffer_end) &&
-+ be32_to_cpu(isns_attr->tag) != ISNS_ATTR_TAG_DELIMITER) {
-+ // Point to next attribute.
-+ if (be32_to_cpu(isns_attr->tag) == ISNS_ATTR_TAG_ISCSI_NAME) {
-+ // Note that this string is in UTF-8 format. In production code,
-+ // it would be necessary to convert from UTF-8 before using the
-+ // string.
-+ QL4PRINT(QLP20, printk("scsi%d: %s: MsgTag iSCSI Name: \"%s\"\n",
-+ ha->host_no, __func__, &isns_attr->value[0]));
-+ if (strlen (isns_attr->value) > 256)
-+ return(QLA_ERROR);
-+ strcpy (last_iscsi_name, (uint8_t *) &isns_attr->value[0]);
-+ }
-+ isns_attr = NEXT_ATTR(isns_attr);
-+ }
-+
-+ if (!VALIDATE_ATTR(isns_attr, buffer_end) ||
-+ be32_to_cpu(isns_attr->tag) != ISNS_ATTR_TAG_DELIMITER) {
-+ // There was no delimiter attribute in the response.
-+ return(QLA_ERROR);
-+ }
-+
-+ // Skip delimiter attribute.
-+ isns_attr = NEXT_ATTR(isns_attr);
-+
-+ while (VALIDATE_ATTR(isns_attr, buffer_end)) {
-+ // We only need to parse for the operating attributes that we
-+ // requested in the DevAttrQuery.
-+
-+ switch (be32_to_cpu(isns_attr->tag)) {
-+ case ISNS_ATTR_TAG_ENTITY_PROTOCOL:
-+ if (be32_to_cpu(*(uint32_t *) isns_attr->value) != ENTITY_PROTOCOL_ISCSI) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Entity does not support iSCSI protocol\n", ha->host_no, __func__));
-+ }
-+ break;
-+
-+ case ISNS_ATTR_TAG_ISCSI_NODE_TYPE:
-+ switch (be32_to_cpu(*(uint32_t *) isns_attr->value)) {
-+ case ISCSI_NODE_TYPE_TARGET:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: iSCSI node type Target\n", ha->host_no, __func__));
-+ *IsTarget = 1;
-+ break;
-+ case ISCSI_NODE_TYPE_INITIATOR:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: iSCSI node type Initiator\n", ha->host_no, __func__));
-+ *IsTarget = 0;
-+ break;
-+ case ISCSI_NODE_TYPE_CONTROL:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: iSCSI node type Control\n", ha->host_no, __func__));
-+ *IsTarget = 0;
-+ break;
-+ default:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: iSCSI node type unknown\n", ha->host_no, __func__));
-+ *IsTarget = 0;
-+ break;
-+ }
-+ break;
-+
-+ case ISNS_ATTR_TAG_MGMT_IP_ADDRESS:
-+ // WARNING: This doesn't handle IPv6 addresses.
-+ tmpptr = &isns_attr->value[0];
-+ for (i = 0; i < 8; i++) {
-+ if (tmpptr[i])
-+ return(QLA_ERROR);
-+ }
-+
-+ for (i = 8; i < 12; i++) {
-+ if (tmpptr[i] != 0 && tmpptr[i] != 0xFF)
-+ return(QLA_ERROR);
-+ }
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Management IP address: %u.%u.%u.%u\n",
-+ ha->host_no, __func__, tmpptr[12],
-+ tmpptr[13], tmpptr[14], tmpptr[15]));
-+ break;
-+
-+ case ISNS_ATTR_TAG_PORTAL_IP_ADDRESS:
-+ // WARNING: This doesn't handle IPv6 addresses.
-+ tmpptr = &isns_attr->value[0];
-+ for (i = 0; i < 8; i++) {
-+ if (tmpptr[i])
-+ return(QLA_ERROR);
-+ }
-+
-+ for (i = 8; i < 12; i++) {
-+ if (tmpptr[i] != 0 && tmpptr[i] != 0xFF)
-+ return(QLA_ERROR);
-+ }
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Portal IP address: %u.%u.%u.%u\n",
-+ ha->host_no, __func__, tmpptr[12],
-+ tmpptr[13], tmpptr[14], tmpptr[15]));
-+
-+ if (isns_discovered_target->NumPortals >= ISNS_MAX_PORTALS)
-+ break;
-+ memcpy(isns_discovered_target->Portal[isns_discovered_target->NumPortals].IPAddr,
-+ &tmpptr[12], 4);
-+ break;
-+
-+ case ISNS_ATTR_TAG_PORTAL_PORT:
-+ wTmp = (uint16_t) (be32_to_cpu(*(uint32_t *) isns_attr->value));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Portal port: %u\n",
-+ ha->host_no, __func__, be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ if (isns_discovered_target->NumPortals >= ISNS_MAX_PORTALS)
-+ break;
-+ isns_discovered_target->Portal[isns_discovered_target->NumPortals].PortNumber = wTmp;
-+ isns_discovered_target->NumPortals++;
-+ break;
-+
-+ case ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME:
-+ // Note that this string is in UTF-8 format. In production code,
-+ // it would be necessary to convert from UTF-8 before using the
-+ // string.
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Portal Symbolic Name: \"%s\"\n",
-+ ha->host_no, __func__, &isns_attr->value[0]));
-+#if 0
-+ if (isns_discovered_target->NumPortals >= ISNS_MAX_PORTALS)
-+ break;
-+ qlstrncpy(isns_discovered_target->Portal[isns_discovered_target->NumPortals].SymbolicName,
-+ (uint8_t *) isns_attr->value, 32);
-+ isns_discovered_target->Portal[isns_discovered_target->NumPortals].SymbolicName[31] = 0;
-+#endif
-+ break;
-+
-+ case ISNS_ATTR_TAG_SCN_PORT:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: SCN port: %u\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ break;
-+
-+ case ISNS_ATTR_TAG_ESI_PORT:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: ESI port: %u\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ break;
-+
-+ case ISNS_ATTR_TAG_ESI_INTERVAL:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: ESI Interval: %u\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ break;
-+
-+ case ISNS_ATTR_TAG_REGISTRATION_PERIOD:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Entity Registration Period: %u\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ break;
-+
-+ case ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP:
-+ ulTmp = be32_to_cpu(*(uint32_t *) isns_attr->value);
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Portal Security Bitmap:\n", ha->host_no, __func__));
-+ if (ulTmp & ISNS_SECURITY_BITMAP_VALID) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_BITMAP_VALID\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_IKE_IPSEC_ENABLED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_IKE_IPSEC_ENABLED\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_MAIN_MODE_ENABLED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_MAIN_MODE_ENABLED\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_AGGRESSIVE_MODE_ENABLED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_AGGRESSIVE_MODE_ENABLED\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_PFS_ENABLED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_PFS_ENABLED\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_TRANSPORT_MODE_PREFERRED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_TRANSPORT_MODE_PREFERRED\n", ha->host_no, __func__));
-+ }
-+ if (ulTmp & ISNS_SECURITY_TUNNEL_MODE_PREFERRED) {
-+ QL4PRINT(QLP20, printk("scsi%d: %s:\tISNS_SECURITY_TUNNEL_MODE_PREFERRED\n", ha->host_no, __func__));
-+ }
-+ // isns_discovered_target->SecurityBitmap = ulTmp;
-+ break;
-+
-+ case ISNS_ATTR_TAG_ENTITY_IDENTIFIER:
-+ // Note that this string is in UTF-8 format. In production code,
-+ // it would be necessary to convert from UTF-8 before using the
-+ // string.
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Entity Identifier: \"%s\"\n",
-+ ha->host_no, __func__, isns_attr->value));
-+ break;
-+
-+ case ISNS_ATTR_TAG_ISCSI_NAME:
-+ // Note that this string is in UTF-8 format. In production code,
-+ // it would be necessary to convert from UTF-8 before using the
-+ // string.
-+ QL4PRINT(QLP20, printk("scsi%d: %s: iSCSI Name: \"%s\"\n",
-+ ha->host_no, __func__, isns_attr->value));
-+ if (strlen (isns_attr->value) > 256)
-+ return(QLA_ERROR);
-+ strcpy (isns_discovered_target->NameString, ( uint8_t *) isns_attr->value);
-+ break;
-+
-+ case ISNS_ATTR_TAG_ISCSI_ALIAS:
-+ // Note that this string is in UTF-8 format. In production code,
-+ // it would be necessary to convert from UTF-8 before using the
-+ // string.
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Alias: \"%s\"\n",
-+ ha->host_no, __func__, isns_attr->value));
-+ if (strlen (isns_attr->value) <= 32)
-+ strcpy (isns_discovered_target->Alias, ( uint8_t *) isns_attr->value);
-+ break;
-+
-+ case ISNS_ATTR_TAG_DD_ID:
-+ ulTmp = be32_to_cpu(*(uint32_t *) isns_attr->value);
-+ QL4PRINT(QLP20, printk("scsi%d: %s: DD ID: %u\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(*(uint32_t *) isns_attr->value)));
-+ isns_discovered_target->DDID = ulTmp;
-+ break;
-+
-+ default:
-+ //QLASSERT (0);
-+ break;
-+ }
-+
-+ // Point to next attribute.
-+
-+ isns_attr = NEXT_ATTR(isns_attr);
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_process_response(scsi_qla_host_t *ha, PASSTHRU_STATUS_ENTRY *sts_entry)
-+{
-+ uint32_t handle = le32_to_cpu(sts_entry->handle);
-+ uint32_t inResidual = le32_to_cpu(sts_entry->inResidual);
-+ uint16_t connectionID = le16_to_cpu(sts_entry->connectionID);
-+ PDU_ENTRY *pdu_entry = (PDU_ENTRY *) &ha->pdu_queue[IOCB_ISNS_PT_PDU_INDEX(handle)];
-+ uint32_t pdu_type = IOCB_ISNS_PT_PDU_TYPE(handle);
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_passthru_status_entry");
-+
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s isns_flags 0x%lx to=0x%x "
-+ "IOCS=0x%02x OutResidual/Len=0x%x/0x%x "
-+ "InResidual/Len=0x%x/0x%x\n",
-+ ha->host_no, __func__,
-+ ha->isns_flags,
-+ le16_to_cpu(sts_entry->timeout),
-+ sts_entry->completionStatus,
-+ le32_to_cpu(sts_entry->outResidual),
-+ pdu_entry->SendBuffLen,
-+ inResidual,
-+ pdu_entry->RecvBuffLen));
-+
-+ if (pdu_entry->RecvBuffLen - inResidual) {
-+ QL4PRINT(QLP19, printk("PDU (0x%p) <-\n", pdu_entry->Buff));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, (pdu_entry->RecvBuffLen - inResidual));
-+ }
-+
-+
-+ if (sts_entry->completionStatus != PASSTHRU_STATUS_COMPLETE) {
-+
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ set_bit(DPC_ISNS_RESTART, &ha->dpc_flags);
-+ goto exit_pt_sts;
-+ }
-+
-+ switch (pdu_type) {
-+ case ISNS_ASYNCH_RSP_PDU:
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ break;
-+
-+ case ISNS_ASYNCH_REQ_PDU:
-+ pdu_entry->RecvBuffLen -= inResidual;
-+
-+ QL4PRINT(QLP19, printk("scsi%d: %s ISNS_ASYNCH_REQ_PDU PDU Buff=%p, PDU RecvLen=0x%X\n",
-+ ha->host_no, __func__, pdu_entry->Buff, pdu_entry->RecvBuffLen));
-+
-+ if (qla4xxx_isns_reassemble_pdu(ha, pdu_entry->Buff,
-+ &pdu_entry->RecvBuffLen)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s ISNS_ASYNCH_REQ_PDU "
-+ "reassemble_pdu failed!\n",
-+ ha->host_no, __func__));
-+ goto exit_pt_sts;
-+ }
-+
-+ if (qla4xxx_isns_parse_and_dispatch_server_request(ha,
-+ pdu_entry->Buff,
-+ pdu_entry->RecvBuffLen,
-+ connectionID)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s ISNS_ASYNCH_REQ_PDU "
-+ "parse_and_dispatch_server_request failed!\n",
-+ ha->host_no, __func__));
-+ }
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ break;
-+
-+ case ISNS_REQ_RSP_PDU:
-+ pdu_entry->RecvBuffLen -= inResidual;
-+
-+ QL4PRINT(QLP19, printk("scsi%d: %s ISNS_REQ_RSP_PDU PDU Buff=%p, PDU RecvLen=0x%X\n",
-+ ha->host_no, __func__, pdu_entry->Buff, pdu_entry->RecvBuffLen));
-+
-+
-+ if (qla4xxx_isns_reassemble_pdu(ha, pdu_entry->Buff,
-+ &pdu_entry->RecvBuffLen)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s ISNS_REQ_RSP_PDU "
-+ "reassemble_pdu failed!\n",
-+ ha->host_no, __func__));
-+ goto exit_pt_sts;
-+ }
-+
-+ if (qla4xxx_isns_parse_and_dispatch_server_response(ha,
-+ pdu_entry->Buff,
-+ pdu_entry->RecvBuffLen)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s ISNS_REQ_RSP_PDU "
-+ "parse_and_dispatch_server_response failed!\n",
-+ ha->host_no, __func__));
-+ }
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ break;
-+ default:
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s iSNS handle 0x%x invalid\n",
-+ ha->host_no, __func__, handle));
-+ status = QLA_ERROR;
-+ break;
-+ }
-+
-+ exit_pt_sts:
-+ LEAVE("qla4xxx_passthru_status_entry");
-+ return(status);
-+}
-+
-+uint8_t
-+qla4xxx_isns_reassemble_pdu(scsi_qla_host_t *ha, uint8_t *buffer, uint32_t *buffer_size)
-+{
-+ uint16_t copy_size = 0;
-+ uint32_t new_pdu_length = 0;
-+ uint32_t bytes_remaining;
-+ uint32_t pdu_size;
-+ uint8_t *dest_ptr = NULL;
-+ uint8_t *src_ptr = NULL;
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ uint32_t i;
-+
-+ // We have read all the PDU's for this message. Now reassemble them
-+ // into a single PDU.
-+ if (buffer == NULL || buffer_size == 0) {
-+ return(QLA_ERROR);
-+ }
-+
-+ if (*buffer_size == 0) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: %s: Length 0. "
-+ "Nothing to reassemble\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ new_pdu_length = 0;
-+ bytes_remaining = *buffer_size;
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+
-+
-+ // First, calculate the size of the payload for the collapsed PDU
-+ do {
-+ if (bytes_remaining < sizeof(ISNSP_MESSAGE_HEADER)) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: %s: Length 0. "
-+ "bytes_remaining < "
-+ "sizeof(ISNSP_MESSAGE_HEADER). "
-+ "BytesRemaining %x, discard PDU\n",
-+ ha->host_no, __func__,
-+ bytes_remaining));
-+ *buffer_size = 0;
-+ return(QLA_ERROR);
-+ }
-+ else if (be16_to_cpu(isns_message->isnsp_version) !=
-+ ISNSP_VERSION) {
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: %s: Bad Version "
-+ "number in iSNS Message Header "
-+ "(%04x, expecting %04x), discard PDU\n",
-+ ha->host_no, __func__,
-+ be16_to_cpu(isns_message->isnsp_version),
-+ ISNSP_VERSION));
-+ *buffer_size = 0;
-+ return(QLA_ERROR);
-+ }
-+ else if (bytes_remaining < sizeof(ISNSP_MESSAGE_HEADER) +
-+ be16_to_cpu(isns_message->pdu_length)) {
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: %s: Short PDU "
-+ "in sequence. BytesRemaining %x, "
-+ "discard PDU\n",
-+ ha->host_no, __func__,
-+ bytes_remaining));
-+ *buffer_size = 0;
-+ return(QLA_ERROR);
-+ }
-+
-+ if (bytes_remaining == sizeof(ISNSP_MESSAGE_HEADER) +
-+ be16_to_cpu(isns_message->pdu_length)) {
-+
-+ if (!(be16_to_cpu(isns_message->flags) &
-+ ISNSP_LAST_PDU)) {
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: %s: "
-+ "Last PDU Flag not set at end "
-+ "of sequence. discard PDU\n",
-+ ha->host_no, __func__));
-+ *buffer_size = 0;
-+ return(QLA_ERROR);
-+ }
-+ }
-+
-+ new_pdu_length += be16_to_cpu(isns_message->pdu_length);
-+ pdu_size = sizeof(ISNSP_MESSAGE_HEADER) +
-+ be16_to_cpu(isns_message->pdu_length);
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) ((uint8_t *)
-+ isns_message + pdu_size);
-+
-+ bytes_remaining = bytes_remaining > pdu_size ?
-+ bytes_remaining - pdu_size : 0;
-+ }
-+ while (bytes_remaining);
-+
-+ dest_ptr = buffer;
-+ bytes_remaining = *buffer_size;
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ i = 0;
-+ QL4PRINT(QLP19, printk("scsi%d: %s: PDU%d=%p payloadLength=%04x\n",
-+ ha->host_no, __func__, i, dest_ptr,
-+ be16_to_cpu(isns_message->pdu_length)));
-+
-+ while (bytes_remaining) {
-+ // If this is the first PDU perform no copy,
-+ // otherwise copy just the payload.
-+
-+ if (dest_ptr != buffer) {
-+ i++;
-+ copy_size = be16_to_cpu(isns_message->pdu_length);
-+ src_ptr = (uint8_t *) isns_message->payload;
-+ QL4PRINT(QLP19,
-+ printk("scsi%d: %s: PDU%d %p <= %p (%04x)\n",
-+ ha->host_no, __func__, i, dest_ptr,
-+ src_ptr, copy_size));
-+ memcpy(dest_ptr, src_ptr, copy_size);
-+ dest_ptr += copy_size;
-+ }
-+ pdu_size = sizeof(ISNSP_MESSAGE_HEADER) +
-+ be16_to_cpu(isns_message->pdu_length);
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) ((uint8_t *)
-+ isns_message + pdu_size);
-+
-+ bytes_remaining = bytes_remaining > pdu_size ?
-+ bytes_remaining - pdu_size : 0;
-+ }
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+
-+ // Update pdu_length field in reassembled PDU to reflect actual
-+ // combined PDU payload length.
-+ isns_message->pdu_length = cpu_to_be16(new_pdu_length);
-+
-+ // Also set LAST_PDU flag in reassembled PDU
-+ isns_message->flags |= cpu_to_be16(ISNSP_LAST_PDU);
-+
-+ // Return number of bytes in buffer to caller.
-+ *buffer_size = new_pdu_length + sizeof(ISNSP_MESSAGE_HEADER);
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_scn (scsi_qla_host_t *ha,
-+ uint8_t * req_buffer,
-+ uint32_t req_buffer_size,
-+ uint16_t ConnectionId)
-+{
-+ ISNSP_MESSAGE_HEADER * isns_req_message;
-+ ISNSP_MESSAGE_HEADER * isns_rsp_message;
-+ ISNSP_RESPONSE_HEADER * isns_response;
-+ PDU_ENTRY * pdu_entry;
-+ ISNS_ATTRIBUTE * attr;
-+ uint8_t * req_buffer_end;
-+ uint8_t * rsp_buffer_end;
-+ uint8_t * payload_start;
-+ uint8_t * ptr;
-+ uint32_t packet_size;
-+ uint32_t copy_size;
-+
-+ isns_req_message = (ISNSP_MESSAGE_HEADER *) req_buffer;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu (ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ // First, setup the response packet.
-+ if (qla4xxx_isns_build_server_request_response_packet(ha,
-+ pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ (be16_to_cpu(isns_req_message->function_id) | 0x8000),
-+ ISNS_ERR_SUCCESS,
-+ be16_to_cpu(isns_req_message->transaction_id),
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: qla4xxx_isns_build_server_"
-+ "request_response_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ isns_rsp_message = (ISNSP_MESSAGE_HEADER *) pdu_entry->Buff;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_rsp_message->payload[0];
-+ payload_start = (uint8_t *) isns_response;
-+ rsp_buffer_end = (uint8_t *) (pdu_entry->Buff + pdu_entry->BuffLen);
-+
-+ ptr = &isns_response->attributes[0];
-+
-+ req_buffer_end = (uint8_t *) ((uint8_t *) &isns_req_message->payload[0] +
-+ be16_to_cpu(isns_req_message->pdu_length));
-+
-+ // Point to the source attribute in the request. We need to return only
-+ // this attribute in the SCN Response.
-+ attr = (ISNS_ATTRIBUTE *) &isns_req_message->payload[0];
-+ if (!VALIDATE_ATTR(attr, req_buffer_end)) {
-+ isns_response->error_code = cpu_to_be32(ISNS_ERR_MSG_FORMAT);
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Malformed packet\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ // Validate that this is an iSCSI Name attribute.
-+ if (be32_to_cpu(attr->tag) != ISNS_ATTR_TAG_ISCSI_NAME) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Did not find iSCSN Name attribute\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ // Copy source attribute to return buffer.
-+ copy_size = sizeof(ISNS_ATTRIBUTE) + be32_to_cpu(attr->length);
-+
-+ if (ptr + copy_size < rsp_buffer_end) {
-+ // Attribute will fit in the response buffer. Go ahead
-+ // and copy it.
-+ memcpy(ptr, attr, copy_size);
-+ ptr += copy_size;
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Insufficient buffer size\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ // We've successfully finished building the response packet.
-+ // Set the size field.
-+
-+ //QLASSERT (!((ptr - payload_start) % 4));
-+
-+ isns_rsp_message->pdu_length = cpu_to_be16((unsigned long) ptr -
-+ (unsigned long) payload_start);
-+
-+ packet_size = (unsigned long) ptr - (unsigned long) pdu_entry->Buff;
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = 0;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: sending %d SCNRsp\n",
-+ ha->host_no, __func__,
-+ be16_to_cpu(isns_rsp_message->transaction_id)));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb (ha, ISNS_DEVICE_INDEX, ConnectionId,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_ASYNCH_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ if (test_bit(ISNS_FLAG_SCN_IN_PROGRESS, &ha->isns_flags)) {
-+ set_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags);
-+ }
-+ else {
-+ set_bit(ISNS_FLAG_SCN_IN_PROGRESS, &ha->isns_flags);
-+ clear_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags);
-+ ha->isns_num_discovered_targets = 0;
-+ if (qla4xxx_isns_dev_get_next (ha, NULL) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ ISNS_CLEAR_FLAGS(ha);
-+ }
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_esi (scsi_qla_host_t *ha,
-+ uint8_t *req_buffer,
-+ uint32_t req_buffer_size,
-+ uint16_t ConnectionId)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_req_message;
-+ ISNSP_MESSAGE_HEADER *isns_rsp_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+ PDU_ENTRY * pdu_entry;
-+ ISNS_ATTRIBUTE *attr;
-+ uint8_t * req_buffer_end;
-+ uint8_t * rsp_buffer_end;
-+ uint8_t * payload_start;
-+ uint8_t * ptr;
-+ uint32_t packet_size;
-+ uint32_t copy_size;
-+
-+ isns_req_message = (ISNSP_MESSAGE_HEADER *) req_buffer;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu (ha, req_buffer_size + sizeof(uint32_t))) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ // First, setup the response packet.
-+ if (qla4xxx_isns_build_server_request_response_packet(ha,
-+ pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ (be16_to_cpu(isns_req_message->function_id) | 0x8000),
-+ ISNS_ERR_SUCCESS,
-+ be16_to_cpu(isns_req_message->transaction_id),
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_build_server_request_response_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ isns_rsp_message = (ISNSP_MESSAGE_HEADER *) pdu_entry->Buff;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_rsp_message->payload[0];
-+ payload_start = ( uint8_t *) isns_response;
-+ rsp_buffer_end = ( uint8_t *) (pdu_entry->Buff + pdu_entry->BuffLen);
-+
-+ ptr = &isns_response->attributes[0];
-+
-+ req_buffer_end =
-+ ( uint8_t *) (( uint8_t *) &isns_req_message->payload[0] +
-+ be16_to_cpu(isns_req_message->pdu_length));
-+
-+ // Point to the source attribute in the request. We need to return
-+ // all attributes in the ESI Response.
-+ attr = (ISNS_ATTRIBUTE *) &isns_req_message->payload[0];
-+
-+ // Copy source attributes to return buffer.
-+ copy_size = req_buffer_end - ( uint8_t *) attr;
-+
-+ if (ptr + copy_size < rsp_buffer_end) {
-+ // Attributes will fit in the response buffer. Go ahead
-+ // and copy them.
-+ memcpy(ptr, attr, copy_size);
-+ ptr += copy_size;
-+ }
-+ else {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Insufficient buffer size\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ // We've successfully finished building the response packet.
-+ // Set the size field.
-+
-+ //QLASSERT (!((ptr - payload_start) % 4));
-+
-+ isns_rsp_message->pdu_length = cpu_to_be16((unsigned long) ptr -
-+ (unsigned long) payload_start);
-+
-+ packet_size = (unsigned long) ptr - (unsigned long) pdu_entry->Buff;
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = 0;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: sending %d ESIRsp\n",
-+ ha->host_no, __func__,
-+ be16_to_cpu(isns_rsp_message->transaction_id)));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(ha, ISNS_DEVICE_INDEX,
-+ ConnectionId,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU,
-+ qla4xxx_isns_build_iocb_handle (ha, ISNS_ASYNCH_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+uint8_t
-+qla4xxx_isns_server_request_error(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint16_t connection_id,
-+ uint32_t error_code) //cpu
-+{
-+ PDU_ENTRY *pdu_entry;
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ uint16_t function_id;
-+ uint32_t packet_size;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ function_id = be16_to_cpu(isns_message->function_id);
-+
-+ // Return "Message Format Error"
-+ if ((pdu_entry = qla4xxx_get_pdu(ha, sizeof(ISNSP_MESSAGE_HEADER) +
-+ sizeof(uint32_t))) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_server_request_response_packet(
-+ ha, pdu_entry->Buff, pdu_entry->BuffLen,
-+ (be16_to_cpu(isns_message->function_id) | 0x8000),
-+ error_code,
-+ be16_to_cpu(isns_message->transaction_id),
-+ &packet_size) != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_build_server_"
-+ "request_response_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = 0;
-+
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX, connection_id,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen, PT_FLAG_ISNS_PDU,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_ASYNCH_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb "
-+ "failed\n, ha->host_no, __func__",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+uint8_t
-+qla4xxx_isns_parse_and_dispatch_server_request(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size,
-+ uint16_t connection_id)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ uint16_t function_id;
-+ uint16_t transaction_id;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ function_id = be16_to_cpu(isns_message->function_id);
-+ transaction_id = be16_to_cpu(isns_message->transaction_id);
-+
-+ // Validate pdu_length specified in the iSNS message header.
-+ if ((offsetof (ISNSP_MESSAGE_HEADER, payload) +
-+ be16_to_cpu(isns_message->pdu_length)) > buffer_size) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid message size %u %u\n",
-+ ha->host_no, __func__,
-+ (uint32_t) (offsetof(ISNSP_MESSAGE_HEADER, payload) +
-+ be16_to_cpu(isns_message->pdu_length)),
-+ buffer_size));
-+
-+ if (function_id <= ISNS_FCID_ESI) {
-+ return(qla4xxx_isns_server_request_error(ha, buffer,
-+ buffer_size,
-+ connection_id,
-+ ISNS_ERR_MSG_FORMAT));
-+ }
-+ return(QLA_ERROR);
-+ }
-+
-+ // It is safe to assume from this point on that the pdu_length value
-+ // (and thus our idea about the end of the buffer) is valid.
-+
-+ switch (function_id) {
-+ case ISNS_FCID_SCN:
-+ QL4PRINT(QLP2, printk("scsi%d: %s: received %d SCN\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_scn(ha, buffer, buffer_size, connection_id));
-+ break;
-+
-+ case ISNS_FCID_ESI:
-+ QL4PRINT(QLP2, printk("scsi%d: %s: received %d ESI\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_esi(ha, buffer, buffer_size, connection_id));
-+ break;
-+
-+ default:
-+ QL4PRINT(QLP2, printk("scsi%d: %s: received %d Unknown iSNS ServerRequest %x\n",
-+ ha->host_no, __func__,
-+ transaction_id, function_id));
-+ if (function_id <= ISNS_FCID_ESI) {
-+ // Return "Message Not Supported"
-+ return(qla4xxx_isns_server_request_error (ha,
-+ buffer,
-+ buffer_size,
-+ connection_id,
-+ ISNS_ERR_MSG_NOT_SUPPORTED));
-+ }
-+ return(QLA_ERROR);
-+ break;
-+ }
-+ return(QLA_SUCCESS);
-+
-+
-+}
-+
-+uint8_t
-+qla4xxx_isns_parse_and_dispatch_server_response(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+ ISNS_ATTRIBUTE *isns_attr;
-+ uint16_t function_id;
-+ uint16_t transaction_id;
-+ uint8_t *buffer_end;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ buffer_end = (uint8_t *) ((uint8_t *) isns_message->payload +
-+ be16_to_cpu(isns_message->pdu_length));
-+
-+ isns_attr = (ISNS_ATTRIBUTE *) isns_message->payload;
-+
-+ /* Validate pdu_length specified in the iSNS message header. */
-+ if (((uint32_t *) buffer_end - (uint32_t *) buffer) > buffer_size) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Invalid message size %u %u\n",
-+ ha->host_no, __func__,
-+ (unsigned int) ((uint32_t *) buffer_end - (uint32_t *) buffer),
-+ buffer_size));
-+ return(QLA_ERROR);
-+ }
-+
-+ transaction_id = be16_to_cpu(isns_message->transaction_id);
-+ function_id = be16_to_cpu(isns_message->function_id);
-+ /*
-+ * It is safe to assume from this point on that the pdu_length value
-+ * (and thus our idea about the end of the buffer) is valid.
-+ */
-+ if (transaction_id > ha->isns_transaction_id) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid message transaction "
-+ "ID recv %x exp %x\n",
-+ ha->host_no, __func__,
-+ transaction_id,
-+ ha->isns_transaction_id));
-+ qla4xxx_dump_bytes(QLP2, buffer, buffer_size);
-+
-+ set_bit(DPC_ISNS_RESTART, &ha->dpc_flags);
-+ return(QLA_ERROR);
-+ }
-+
-+
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+
-+ //QL4PRINT(QLP20, printk("---------------------------\n"));
-+ //QL4PRINT(QLP20, printk("scsi%d: %s: received function_id %x\n",
-+ // ha->host_no, __func__, function_id));
-+
-+ switch (function_id) {
-+ case ISNS_FCID_DevAttrRegRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d DevAttrRegRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_dev_attr_reg_rsp(ha, buffer, buffer_size));
-+
-+ case ISNS_FCID_DevAttrQryRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d DevAttrQryRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_dev_attr_qry_rsp(ha, buffer, buffer_size));
-+
-+ case ISNS_FCID_DevGetNextRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d DevGetNextRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_dev_get_next_rsp(ha, buffer, buffer_size));
-+
-+ case ISNS_FCID_DevDeregRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d DevDeregRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_dev_dereg_rsp(ha, buffer, buffer_size));
-+
-+ case ISNS_FCID_SCNRegRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d SCNRegRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_scn_reg_rsp(ha, buffer, buffer_size));
-+
-+ case ISNS_FCID_SCNDeregRsp:
-+ QL4PRINT(QLP20, printk("scsi%d: %s: received %d SCNDeregRsp\n",
-+ ha->host_no, __func__,
-+ transaction_id));
-+ return(qla4xxx_isns_scn_dereg_rsp(ha, buffer, buffer_size));
-+
-+ default:
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Received %d Unknown iSNS function_id %x\n",
-+ ha->host_no, __func__,
-+ transaction_id, function_id));
-+ break;
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_attr_reg(scsi_qla_host_t *ha)
-+{
-+ PDU_ENTRY *pdu_entry;
-+ uint32_t packet_size;
-+
-+ pdu_entry = qla4xxx_get_pdu(ha, PAGE_SIZE);
-+ if (pdu_entry == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: get pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_registration_packet(ha, pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ ha->isns_entity_id,
-+ ha->ip_address,
-+ ha->isns_remote_port_num,
-+ ha->isns_scn_port_num,
-+ ha->isns_esi_port_num,
-+ ha->alias, &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: "
-+ "qla4xxx_isns_build_registration_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: sending %d DevAttrReg\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: Registering iSNS . . .\n",
-+ ha->host_no, __func__));
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU|PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_REQ_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: "
-+ "qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_attr_reg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+ uint32_t error_code;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+ error_code = be32_to_cpu(isns_response->error_code);
-+
-+ if (error_code) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: iSNS DevAttrReg failed, "
-+ "error code (%x) \"%s\"\n",
-+ ha->host_no, __func__,
-+ error_code,
-+ isns_error_code_msg[error_code]));
-+ clear_bit(ISNS_FLAG_ISNS_SRV_REGISTERED, &ha->isns_flags);
-+ return(QLA_ERROR);
-+ }
-+
-+ set_bit(ISNS_FLAG_ISNS_SRV_REGISTERED, &ha->isns_flags);
-+ if (qla4xxx_isns_scn_reg(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_scn_reg failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_scn_reg(scsi_qla_host_t *ha)
-+{
-+ PDU_ENTRY *isns_pdu_entry;
-+ uint32_t packet_size;
-+
-+ if ((isns_pdu_entry = qla4xxx_get_pdu (ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_scn_registration_packet(
-+ ha, isns_pdu_entry->Buff, isns_pdu_entry->BuffLen,
-+ &packet_size) != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_build_scn_"
-+ "registration_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, isns_pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ isns_pdu_entry->SendBuffLen = packet_size;
-+ isns_pdu_entry->RecvBuffLen = isns_pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d :%s: sending %d SCNReg\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", isns_pdu_entry->Buff, isns_pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, isns_pdu_entry->Buff, isns_pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ isns_pdu_entry->DmaBuff,
-+ isns_pdu_entry->SendBuffLen,
-+ isns_pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_REQ_RSP_PDU, isns_pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, isns_pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_scn_reg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) isns_message->payload;
-+
-+ if (isns_response->error_code) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: iSNS SCNReg failed, error code %x\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(isns_response->error_code)));
-+ clear_bit(ISNS_FLAG_ISNS_SCN_REGISTERED, &ha->isns_flags);
-+ return(QLA_ERROR);
-+ }
-+
-+ set_bit(ISNS_FLAG_ISNS_SCN_REGISTERED, &ha->isns_flags);
-+
-+ ha->isns_num_discovered_targets = 0;
-+ if (qla4xxx_isns_dev_get_next(ha, NULL) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_attr_qry(scsi_qla_host_t *ha,
-+ uint8_t *last_iscsi_name)
-+{
-+ PDU_ENTRY *pdu_entry;
-+ uint32_t packet_size;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu(ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_dev_attr_qry_packet(ha, pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ last_iscsi_name,
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: qla4xxx_isns_build_dev_attr_qry_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: sending %d DevAttrQry\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle (ha, ISNS_REQ_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb "
-+ "failed\n", ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_attr_qry_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ uint8_t *last_iscsi_name = NULL;
-+ ISNS_DISCOVERED_TARGET *discovered_target = NULL;
-+ uint32_t isns_error;
-+ int i;
-+ uint8_t bIsTarget = 1;
-+ uint8_t bFound = 0;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ if (test_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags)) {
-+ clear_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags);
-+ ha->isns_num_discovered_targets = 0;
-+ if (qla4xxx_isns_dev_get_next(ha, NULL) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ goto exit_qry_rsp_clear_flags;
-+ }
-+ goto exit_qry_rsp;
-+ }
-+
-+ last_iscsi_name = kmalloc(256, GFP_ATOMIC);
-+ discovered_target = kmalloc(sizeof(*discovered_target), GFP_ATOMIC);
-+ if (!last_iscsi_name || !discovered_target) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: failed to allocate memory\n",
-+ ha->host_no, __func__));
-+ status = QLA_ERROR;
-+ goto exit_qry_rsp;
-+ }
-+
-+ memset(last_iscsi_name, 0, 256);
-+ memset(discovered_target, 0, sizeof(ISNS_DISCOVERED_TARGET));
-+ if (qla4xxx_isns_parse_query_response(ha, buffer, buffer_size,
-+ &isns_error,
-+ discovered_target,
-+ &bIsTarget,
-+ last_iscsi_name)
-+ == QLA_SUCCESS) {
-+
-+ if (bIsTarget &&
-+ discovered_target->NameString[0] &&
-+ discovered_target->NumPortals) {
-+
-+ for (i = 0; i < ha->isns_num_discovered_targets; i++) {
-+ if (!strcmp(discovered_target->NameString,
-+ ha->isns_disc_tgt_databasev[i].NameString)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: found at index %x\n",
-+ ha->host_no, __func__, i));
-+ memcpy(&ha->isns_disc_tgt_databasev[i],
-+ discovered_target,
-+ sizeof(ISNS_DISCOVERED_TARGET));
-+ ha->isns_disc_tgt_databasev[i] = *discovered_target;
-+ bFound = 1;
-+ break;
-+ }
-+ }
-+ if (!bFound && i < MAX_ISNS_DISCOVERED_TARGETS) {
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: not already present, "
-+ "put in index %x\n",
-+ ha->host_no, __func__, i));
-+ memcpy(&ha->isns_disc_tgt_databasev[i],
-+ discovered_target,
-+ sizeof(ISNS_DISCOVERED_TARGET));
-+ ha->isns_num_discovered_targets++;
-+ }
-+ }
-+ }
-+
-+ if (test_bit(ISNS_FLAG_QUERY_SINGLE_OBJECT, &ha->isns_flags)) {
-+ goto exit_qry_rsp_clear_flags;
-+ }
-+ else if (last_iscsi_name[0] == 0) {
-+ goto exit_qry_rsp_clear_flags;
-+ }
-+ else {
-+ if (qla4xxx_isns_dev_get_next (ha, last_iscsi_name) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: "
-+ "qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ goto exit_qry_rsp_clear_flags;
-+ }
-+ }
-+
-+ goto exit_qry_rsp;
-+
-+ exit_qry_rsp_clear_flags:
-+ ISNS_CLEAR_FLAGS(ha);
-+
-+ exit_qry_rsp:
-+ if (last_iscsi_name) kfree(last_iscsi_name);
-+ if (discovered_target) kfree (discovered_target);
-+ return(status);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_get_next(scsi_qla_host_t *ha,
-+ uint8_t *last_iscsi_name)
-+{
-+ PDU_ENTRY *pdu_entry;
-+ uint32_t packet_size;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu(ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_dev_get_next_packet (ha, pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ last_iscsi_name,
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_build_dev_get_next_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: sending %d DevGetNext\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_REQ_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_get_next_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ uint32_t isns_error = 0;
-+ uint8_t bIsTarget;
-+ static uint8_t last_iscsi_name[256];
-+
-+ if (test_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags)) {
-+ clear_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags);
-+ ha->isns_num_discovered_targets = 0;
-+ if (qla4xxx_isns_dev_get_next(ha, NULL) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ goto exit_get_next_rsp;
-+ }
-+ return(QLA_SUCCESS);
-+ }
-+
-+ if (qla4xxx_isns_parse_get_next_response(ha, buffer, buffer_size,
-+ &isns_error, &last_iscsi_name[0],
-+ sizeof(last_iscsi_name) - 1,
-+ &bIsTarget)
-+ != QLA_SUCCESS) {
-+ if (isns_error != ISNS_ERR_NO_SUCH_ENTRY) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_parse_get_next_response failed\n",
-+ ha->host_no, __func__));
-+ }
-+ goto exit_get_next_rsp;
-+ }
-+
-+ #if 1
-+ if (bIsTarget) {
-+ if (qla4xxx_isns_dev_attr_qry(ha, &last_iscsi_name[0]) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_attr_qry failed\n",
-+ ha->host_no, __func__));
-+ goto exit_get_next_rsp;
-+ }
-+ }
-+ else {
-+ if (qla4xxx_isns_dev_get_next(ha, &last_iscsi_name[0]) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_get_next failed\n",
-+ ha->host_no, __func__));
-+ goto exit_get_next_rsp;
-+ }
-+ }
-+ #else
-+ if (qla4xxx_isns_dev_attr_qry(ha, &last_iscsi_name[0]) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_attr_qry failed\n",
-+ ha->host_no, __func__));
-+ goto exit_get_next_rsp;
-+ }
-+ #endif
-+
-+ return(QLA_SUCCESS);
-+
-+ exit_get_next_rsp:
-+ clear_bit(ISNS_FLAG_SCN_IN_PROGRESS, &ha->isns_flags);
-+ clear_bit(ISNS_FLAG_SCN_RESTART, &ha->isns_flags);
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_dev_dereg(scsi_qla_host_t *ha)
-+{
-+ PDU_ENTRY *pdu_entry;
-+ uint32_t packet_size;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu (ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_deregistration_packet(ha, pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ ha->isns_entity_id,
-+ ha->isns_ip_address,
-+ ha->isns_server_port_number,
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: QLiSNSBuildDeregistrationPacket "
-+ "failed\n", ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20,
-+ printk("scsi%d: %s: sending %d DevDereg\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle(ha, ISNS_REQ_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu(ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+uint8_t
-+qla4xxx_isns_dev_dereg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ ISNSP_MESSAGE_HEADER * isns_message;
-+ ISNSP_RESPONSE_HEADER * isns_response;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+
-+ clear_bit(ISNS_FLAG_ISNS_SRV_REGISTERED, &ha->isns_flags);
-+
-+ if (be32_to_cpu(isns_response->error_code)) {
-+ QL4PRINT(QLP10, printk("scsi%d: %s: iSNS SCNDereg rsp code %x\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(isns_response->error_code)));
-+ }
-+
-+ if (test_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags)) {
-+ clear_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags);
-+
-+ if (qla4xxx_isns_dev_attr_reg(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_dev_attr_reg failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_scn_dereg(scsi_qla_host_t *ha)
-+{
-+ PDU_ENTRY *pdu_entry;
-+ uint32_t packet_size;
-+
-+ if ((pdu_entry = qla4xxx_get_pdu(ha, PAGE_SIZE)) == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_get_pdu failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_isns_build_scn_deregistration_packet(ha, pdu_entry->Buff,
-+ pdu_entry->BuffLen,
-+ &packet_size)
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_isns_build_scn_"
-+ "deregistration_packet failed\n",
-+ ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+
-+ pdu_entry->SendBuffLen = packet_size;
-+ pdu_entry->RecvBuffLen = pdu_entry->BuffLen;
-+
-+ QL4PRINT(QLP20, printk("---------------------------\n"));
-+ QL4PRINT(QLP20, printk("scsi%d: %s: sending %d SCNDereg\n",
-+ ha->host_no, __func__, ha->isns_transaction_id));
-+ QL4PRINT(QLP19, printk("PDU (0x%p) 0x%x ->\n", pdu_entry->Buff, pdu_entry->SendBuffLen));
-+ qla4xxx_dump_bytes(QLP19, pdu_entry->Buff, pdu_entry->SendBuffLen);
-+
-+ if (qla4xxx_send_passthru0_iocb(
-+ ha, ISNS_DEVICE_INDEX,
-+ ISNS_DEFAULT_SERVER_CONN_ID,
-+ pdu_entry->DmaBuff,
-+ pdu_entry->SendBuffLen,
-+ pdu_entry->RecvBuffLen,
-+ PT_FLAG_ISNS_PDU | PT_FLAG_WAIT_4_RESPONSE,
-+ qla4xxx_isns_build_iocb_handle (ha, ISNS_REQ_RSP_PDU, pdu_entry))
-+ != QLA_SUCCESS) {
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: qla4xxx_send_passthru0_iocb "
-+ "failed\n", ha->host_no, __func__));
-+ qla4xxx_free_pdu (ha, pdu_entry);
-+ return(QLA_ERROR);
-+ }
-+ ha->isns_transaction_id++;
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_scn_dereg_rsp(scsi_qla_host_t *ha,
-+ uint8_t *buffer,
-+ uint32_t buffer_size)
-+{
-+ ISNSP_MESSAGE_HEADER *isns_message;
-+ ISNSP_RESPONSE_HEADER *isns_response;
-+
-+ isns_message = (ISNSP_MESSAGE_HEADER *) buffer;
-+ isns_response = (ISNSP_RESPONSE_HEADER *) &isns_message->payload[0];
-+
-+ clear_bit(ISNS_FLAG_ISNS_SCN_REGISTERED, &ha->isns_flags);
-+
-+ if (be32_to_cpu(isns_response->error_code)) {
-+ QL4PRINT(QLP10, printk("scsi%d: %s: iSNS SCNDereg rsp code %x\n",
-+ ha->host_no, __func__,
-+ be32_to_cpu(isns_response->error_code)));
-+ }
-+
-+ if (test_bit(ISNS_FLAG_REREGISTER, &ha->isns_flags)) {
-+ if (qla4xxx_isns_dev_dereg(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: QLiSNSDevDereg failed\n",
-+ ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_isns.h ./drivers/scsi/qla4xxx/ql4_isns.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_isns.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_isns.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,377 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#define ISNSP_VERSION 0x0001 // Current iSNS version as defined by
-+// the latest spec that we support
-+
-+/* Swap Macros
-+ *
-+ * These are designed to be used on constants (such as the function codes
-+ * below) such that the swapping is done by the compiler at compile time
-+ * and not at run time. Of course, they should also work on variables
-+ * in which case the swapping will occur at run time.
-+ */
-+#define WSWAP(x) (uint16_t)(((((uint16_t)x)<<8)&0xFF00) | \
-+ ((((uint16_t)x)>>8)&0x00FF))
-+#define DWSWAP(x) (uint32_t)(((((uint32_t)x)<<24)&0xFF000000) | \
-+ ((((uint32_t)x)<<8)&0x00FF0000) | \
-+ ((((uint32_t)x)>>8)&0x0000FF00) | \
-+ ((((uint32_t)x)>>24)&0x000000FF))
-+
-+/*
-+ * Timeout Values
-+ *******************/
-+#define ISNS_RESTART_TOV 5
-+
-+#define IOCB_ISNS_PT_PDU_TYPE(x) ((x) & 0x0F000000)
-+#define IOCB_ISNS_PT_PDU_INDEX(x) ((x) & (MAX_PDU_ENTRIES-1))
-+
-+#define ISNS_ASYNCH_REQ_PDU 0x01000000
-+#define ISNS_ASYNCH_RSP_PDU 0x02000000
-+#define ISNS_REQ_RSP_PDU 0x03000000
-+
-+
-+// Fake device indexes. Used internally by the driver for indexing to other than a DDB entry
-+#define ISNS_DEVICE_INDEX MAX_DEV_DB_ENTRIES + 0
-+
-+#define ISNS_CLEAR_FLAGS(ha) do {clear_bit(ISNS_FLAG_SCN_IN_PROGRESS | \
-+ ISNS_FLAG_SCN_RESTART | \
-+ ISNS_FLAG_QUERY_SINGLE_OBJECT, \
-+ &ha->isns_flags);} while(0);
-+
-+
-+
-+// iSNS Message Function ID codes
-+
-+#define ISNS_FCID_DevAttrReg 0x0001 // Device Attribute Registration Request
-+#define ISNS_FCID_DevAttrQry 0x0002 // Device Attribute Query Request
-+#define ISNS_FCID_DevGetNext 0x0003 // Device Get Next Request
-+#define ISNS_FCID_DevDereg 0x0004 // Device Deregister Request
-+#define ISNS_FCID_SCNReg 0x0005 // SCN Register Request
-+#define ISNS_FCID_SCNDereg 0x0006 // SCN Deregister Request
-+#define ISNS_FCID_SCNEvent 0x0007 // SCN Event
-+#define ISNS_FCID_SCN 0x0008 // State Change Notification
-+#define ISNS_FCID_DDReg 0x0009 // DD Register
-+#define ISNS_FCID_DDDereg 0x000A // DD Deregister
-+#define ISNS_FCID_DDSReg 0x000B // DDS Register
-+#define ISNS_FCID_DDSDereg 0x000C // DDS Deregister
-+#define ISNS_FCID_ESI 0x000D // Entity Status Inquiry
-+#define ISNS_FCID_Heartbeat 0x000E // Name Service Heartbeat
-+//NOT USED 0x000F-0x0010
-+#define ISNS_FCID_RqstDomId 0x0011 // Request FC_DOMAIN_ID
-+#define ISNS_FCID_RlseDomId 0x0012 // Release FC_DOMAIN_ID
-+#define ISNS_FCID_GetDomId 0x0013 // Get FC_DOMAIN_IDs
-+//RESERVED 0x0014-0x00FF
-+//Vendor Specific 0x0100-0x01FF
-+//RESERVED 0x0200-0x8000
-+
-+
-+// iSNS Response Message Function ID codes
-+
-+#define ISNS_FCID_DevAttrRegRsp 0x8001 // Device Attribute Registration Response
-+#define ISNS_FCID_DevAttrQryRsp 0x8002 // Device Attribute Query Response
-+#define ISNS_FCID_DevGetNextRsp 0x8003 // Device Get Next Response
-+#define ISNS_FCID_DevDeregRsp 0x8004 // Deregister Device Response
-+#define ISNS_FCID_SCNRegRsp 0x8005 // SCN Register Response
-+#define ISNS_FCID_SCNDeregRsp 0x8006 // SCN Deregister Response
-+#define ISNS_FCID_SCNEventRsp 0x8007 // SCN Event Response
-+#define ISNS_FCID_SCNRsp 0x8008 // SCN Response
-+#define ISNS_FCID_DDRegRsp 0x8009 // DD Register Response
-+#define ISNS_FCID_DDDeregRsp 0x800A // DD Deregister Response
-+#define ISNS_FCID_DDSRegRsp 0x800B // DDS Register Response
-+#define ISNS_FCID_DDSDeregRsp 0x800C // DDS Deregister Response
-+#define ISNS_FCID_ESIRsp 0x800D // Entity Status Inquiry Response
-+//NOT USED 0x800E-0x8010
-+#define ISNS_FCID_RqstDomIdRsp 0x8011 // Request FC_DOMAIN_ID Response
-+#define ISNS_FCID_RlseDomIdRsp 0x8012 // Release FC_DOMAIN_ID Response
-+#define ISNS_FCID_GetDomIdRsp 0x8013 // Get FC_DOMAIN_IDs Response
-+//RESERVED 0x8014-0x80FF
-+//Vendor Specific 0x8100-0x81FF
-+//RESERVED 0x8200-0xFFFF
-+
-+
-+// iSNS Error Codes
-+
-+#define ISNS_ERR_SUCCESS 0 // Successful
-+#define ISNS_ERR_UNKNOWN 1 // Unknown Error
-+#define ISNS_ERR_MSG_FORMAT 2 // Message Format Error
-+#define ISNS_ERR_INVALID_REG 3 // Invalid Registration
-+//RESERVED 4
-+#define ISNS_ERR_INVALID_QUERY 5 // Invalid Query
-+#define ISNS_ERR_SOURCE_UNKNOWN 6 // Source Unknown
-+#define ISNS_ERR_SOURCE_ABSENT 7 // Source Absent
-+#define ISNS_ERR_SOURCE_UNAUTHORIZED 8 // Source Unauthorized
-+#define ISNS_ERR_NO_SUCH_ENTRY 9 // No Such Entry
-+#define ISNS_ERR_VER_NOT_SUPPORTED 10 // Version Not Supported
-+#define ISNS_ERR_INTERNAL_ERROR 11 // Internal Error
-+#define ISNS_ERR_BUSY 12 // Busy
-+#define ISNS_ERR_OPT_NOT_UNDERSTOOD 13 // Option Not Understood
-+#define ISNS_ERR_INVALID_UPDATE 14 // Invalid Update
-+#define ISNS_ERR_MSG_NOT_SUPPORTED 15 // Message (FUNCTION_ID) Not Supported
-+#define ISNS_ERR_SCN_EVENT_REJECTED 16 // SCN Event Rejected
-+#define ISNS_ERR_SCN_REG_REJECTED 17 // SCN Registration Rejected
-+#define ISNS_ERR_ATTR_NOT_IMPLEMENTED 18 // Attribute Not Implemented
-+#define ISNS_ERR_FC_DOMAIN_ID_NOT_AVAIL 19 // FC_DOMAIN_ID Not Available
-+#define ISNS_ERR_FC_DOMAIN_ID_NOT_ALLOC 20 // FC_DOMAIN_ID Not Allocated
-+#define ISNS_ERR_ESI_NOT_AVAILABLE 21 // ESI Not Available
-+#define ISNS_ERR_INVALID_DEREG 22 // Invalid Deregistration
-+#define ISNS_ERR_REG_FEATURES_NOT_SUPPORTED 23 // Registration Features Not Supported
-+
-+#define ISNS_ERROR_CODE_TBL() { \
-+ "SUCCESSFUL" , \
-+ "UNKNOWN ERROR" , \
-+ "MESSAGE FORMAT ERROR" , \
-+ "INVALID REGISTRATION" , \
-+ "RESERVED" , \
-+ "INVALID QUERY" , \
-+ "SOURCE UNKNOWN" , \
-+ "SOURCE ABSENT" , \
-+ "SOURCE UNAUTHORIZED" , \
-+ "NO SUCH ENTRY" , \
-+ "VERSION NOT SUPPORTED" , \
-+ "INTERNAL ERROR" , \
-+ "BUSY" , \
-+ "OPTION NOT UNDERSTOOD" , \
-+ "INVALID UPDATE" , \
-+ "MESSAGE (FUNCTION_ID) NOT SUPPORTED" , \
-+ "SCN EVENT REJECTED" , \
-+ "SCN REGISTRATION REJECTED" , \
-+ "ATTRIBUTE NOT IMPLEMENTED" , \
-+ "FC_DOMAIN_ID NOT AVAILABLE" , \
-+ "FC_DOMAIN_ID NOT ALLOCATED" , \
-+ "ESI NOT AVAILABLE" , \
-+ "INVALID DEREGISTRATION" , \
-+ "REGISTRATION FEATURES NOT SUPPORTED" , \
-+ NULL \
-+}
-+
-+
-+// iSNS Protocol Structures
-+
-+typedef struct {
-+ uint16_t isnsp_version;
-+ uint16_t function_id;
-+ uint16_t pdu_length; // Length of the payload (does not include header)
-+ uint16_t flags;
-+ uint16_t transaction_id;
-+ uint16_t sequence_id;
-+ uint8_t payload[0]; // Variable payload data
-+} ISNSP_MESSAGE_HEADER, *PISNSP_MESSAGE_HEADER;
-+
-+typedef struct {
-+ uint32_t error_code;
-+ uint8_t attributes[0];
-+} ISNSP_RESPONSE_HEADER, *PISNSP_RESPONSE_HEADER;
-+
-+
-+// iSNS Message Flags Definitions
-+
-+#define ISNSP_CLIENT_SENDER 0x8000
-+#define ISNSP_SERVER_SENDER 0x4000
-+#define ISNSP_AUTH_BLOCK_PRESENT 0x2000
-+#define ISNSP_REPLACE_FLAG 0x1000
-+#define ISNSP_LAST_PDU 0x0800
-+#define ISNSP_FIRST_PDU 0x0400
-+
-+#define ISNSP_VALID_FLAGS_MASK (ISNSP_CLIENT_SENDER | \
-+ ISNSP_SERVER_SENDER | \
-+ ISNSP_AUTH_BLOCK_PRESENT | \
-+ ISNSP_REPLACE_FLAG | \
-+ ISNSP_LAST_PDU | \
-+ ISNSP_FIRST_PDU)
-+
-+
-+// iSNS Attribute Structure
-+
-+typedef struct {
-+ uint32_t tag;
-+ uint32_t length;
-+ uint8_t value[0]; // Variable length data
-+} ISNS_ATTRIBUTE, *PISNS_ATTRIBUTE;
-+
-+
-+
-+
-+// The following macro assumes that the attribute is wholly contained within
-+// the buffer in question and is valid (see VALIDATE_ATTR below).
-+
-+static inline PISNS_ATTRIBUTE
-+NEXT_ATTR(PISNS_ATTRIBUTE pattr)
-+{
-+ return (PISNS_ATTRIBUTE) (&pattr->value[0] + be32_to_cpu(pattr->length));
-+}
-+
-+static inline uint8_t
-+VALIDATE_ATTR(PISNS_ATTRIBUTE PAttr, uint8_t *buffer_end)
-+{
-+ // Ensure that the Length field of the current attribute is contained
-+ // within the buffer before trying to read it, and then be sure that
-+ // the entire attribute is contained within the buffer.
-+
-+ if ((((unsigned long)&PAttr->length + sizeof(PAttr->length)) <= (unsigned long)buffer_end) &&
-+ (unsigned long)NEXT_ATTR(PAttr) <= (unsigned long)buffer_end) {
-+//XXX:
-+//printk("%s: end attr_len = 0x%x, end_buf = 0x%x\n", __func__,
-+// (unsigned long)&PAttr->length + sizeof(PAttr->length),
-+// (unsigned long)buffer_end);
-+
-+ return(1);
-+ }
-+
-+ return(0);
-+}
-+
-+
-+// iSNS-defined Attribute Tags
-+
-+#define ISNS_ATTR_TAG_DELIMITER 0
-+#define ISNS_ATTR_TAG_ENTITY_IDENTIFIER 1
-+#define ISNS_ATTR_TAG_ENTITY_PROTOCOL 2
-+#define ISNS_ATTR_TAG_MGMT_IP_ADDRESS 3
-+#define ISNS_ATTR_TAG_TIMESTAMP 4
-+#define ISNS_ATTR_TAG_PROTOCOL_VERSION_RANGE 5
-+#define ISNS_ATTR_TAG_REGISTRATION_PERIOD 6
-+#define ISNS_ATTR_TAG_ENTITY_INDEX 7
-+#define ISNS_ATTR_TAG_ENTITY_NEXT_INDEX 8
-+#define ISNS_ATTR_TAG_ENTITY_ISAKMP_PHASE_1 11
-+#define ISNS_ATTR_TAG_ENTITY_CERTIFICATE 12
-+#define ISNS_ATTR_TAG_PORTAL_IP_ADDRESS 16
-+#define ISNS_ATTR_TAG_PORTAL_PORT 17
-+#define ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME 18
-+#define ISNS_ATTR_TAG_ESI_INTERVAL 19
-+#define ISNS_ATTR_TAG_ESI_PORT 20
-+#define ISNS_ATTR_TAG_PORTAL_GROUP 21
-+#define ISNS_ATTR_TAG_PORTAL_INDEX 22
-+#define ISNS_ATTR_TAG_SCN_PORT 23
-+#define ISNS_ATTR_TAG_PORTAL_NEXT_INDEX 24
-+#define ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP 27
-+#define ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_1 28
-+#define ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_2 29
-+#define ISNS_ATTR_TAG_PORTAL_CERTIFICATE 31
-+#define ISNS_ATTR_TAG_ISCSI_NAME 32
-+#define ISNS_ATTR_TAG_ISCSI_NODE_TYPE 33
-+#define ISNS_ATTR_TAG_ISCSI_ALIAS 34
-+#define ISNS_ATTR_TAG_ISCSI_SCN_BITMAP 35
-+#define ISNS_ATTR_TAG_ISCSI_NODE_INDEX 36
-+#define ISNS_ATTR_TAG_WWNN_TOKEN 37
-+#define ISNS_ATTR_TAG_ISCSI_NODE_NEXT_INDEX 38
-+#define ISNS_ATTR_TAG_ISCSI_AUTH_METHOD 42
-+#define ISNS_ATTR_TAG_ISCSI_NODE_CERTIFICATE 43
-+#define ISNS_ATTR_TAG_PG_TAG 48
-+#define ISNS_ATTR_TAG_PG_ISCSI_NAME 49
-+#define ISNS_ATTR_TAG_PG_PORTAL_IP_ADDRESS 50
-+#define ISNS_ATTR_TAG_PG_PORTAL_PORT 51
-+#define ISNS_ATTR_TAG_PG_INDEX 52
-+#define ISNS_ATTR_TAG_PG_NEXT_INDEX 53
-+#define ISNS_ATTR_TAG_FC_PORT_NAME_WWPN 64
-+#define ISNS_ATTR_TAG_PORT_ID 65
-+#define ISNS_ATTR_TAG_FC_PORT_TYPE 66
-+#define ISNS_ATTR_TAG_SYMBOLIC_PORT_NAME 67
-+#define ISNS_ATTR_TAG_FABRIC_PORT_NAME 68
-+#define ISNS_ATTR_TAG_HARD_ADDRESS 69
-+#define ISNS_ATTR_TAG_PORT_IP_ADDRESS 70
-+#define ISNS_ATTR_TAG_CLASS_OF_SERVICE 71
-+#define ISNS_ATTR_TAG_FC4_TYPES 72
-+#define ISNS_ATTR_TAG_FC4_DESCRIPTOR 73
-+#define ISNS_ATTR_TAG_FC4_FEATURES 74
-+#define ISNS_ATTR_TAG_IFCP_SCN_BITMAP 75
-+#define ISNS_ATTR_TAG_PORT_ROLE 76
-+#define ISNS_ATTR_TAG_PERMANENT_PORT_NAME 77
-+#define ISNS_ATTR_TAG_PORT_CERTIFICATE 83
-+#define ISNS_ATTR_TAG_FC4_TYPE_CODE 95
-+#define ISNS_ATTR_TAG_FC_NODE_NAME_WWNN 96
-+#define ISNS_ATTR_TAG_SYMBOLIC_NODE_NAME 97
-+#define ISNS_ATTR_TAG_NODE_IP_ADDRESS 98
-+#define ISNS_ATTR_TAG_NODE_IPA 99
-+#define ISNS_ATTR_TAG_NODE_CERTIFICATE 100
-+#define ISNS_ATTR_TAG_PROXY_ISCSI_NAME 101
-+#define ISNS_ATTR_TAG_SWITCH_NAME 128
-+#define ISNS_ATTR_TAG_PREFERRED_ID 129
-+#define ISNS_ATTR_TAG_ASSIGNED_ID 130
-+#define ISNS_ATTR_TAG_VIRTUAL_FABRIC_ID 131
-+#define ISNS_ATTR_TAG_VENDOR_OUI 256
-+//Vendor-specific iSNS Server 257-384
-+//Vendor-specific Entity 385-512
-+//Vendor-specific Portal 513-640
-+//Vendor-specific iSCSI Node 641-768
-+//Vendor-specific FC Port Name 769-896
-+//Vendor-specific FC Node Name 897-1024
-+//Vendor-specific DDS 1025-1280
-+//Vendor-Specific DD 1281-1536
-+//Vendor-specific (other) 1237-2048
-+#define ISNS_ATTR_TAG_DD_SET_ID 2049
-+#define ISNS_ATTR_TAG_DD_SET_SYMBOLIC_NAME 2050
-+#define ISNS_ATTR_TAG_DD_SET_STATUS 2051
-+#define ISNS_ATTR_TAG_DD_SET_NEXT_ID 2052
-+#define ISNS_ATTR_TAG_DD_ID 2065
-+#define ISNS_ATTR_TAG_DD_SYMBOLIC_NAME 2066
-+#define ISNS_ATTR_TAG_DD_MEMBER_ISCSI_INDEX 2067
-+#define ISNS_ATTR_TAG_DD_MEMBER_ISCSI_NAME 2068
-+#define ISNS_ATTR_TAG_DD_MEMBER_IFCP_NODE 2069
-+#define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_INDEX 2070
-+#define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_IP_ADDRESS 2071
-+#define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_PORT 2072
-+#define ISNS_ATTR_TAG_DD_FEATURES 2078
-+#define ISNS_ATTR_TAG_DD_ID_NEXT_ID 2079
-+
-+
-+// Definitions used for Entity Protocol
-+
-+#define ENTITY_PROTOCOL_NEUTRAL 1
-+#define ENTITY_PROTOCOL_ISCSI 2
-+#define ENTITY_PROTOCOL_IFCP 3
-+
-+
-+// Definitions used for iSCSI Node Type
-+
-+#define ISCSI_NODE_TYPE_TARGET 0x00000001
-+#define ISCSI_NODE_TYPE_INITIATOR 0x00000002
-+#define ISCSI_NODE_TYPE_CONTROL 0x00000004
-+
-+
-+// Definitions used for iSCSI Node SCN Bitmap
-+
-+#define ISCSI_SCN_DD_DDS_MEMBER_ADDED 0x00000001 // Management SCN only
-+#define ISCSI_SCN_DD_DDS_MEMBER_REMOVED 0x00000002 // Management SCN only
-+#define ISCSI_SCN_OBJECT_UPDATED 0x00000004
-+#define ISCSI_SCN_OBJECT_ADDED 0x00000008
-+#define ISCSI_SCN_OBJECT_REMOVED 0x00000010
-+#define ISCSI_SCN_MANAGEMENT_SCN 0x00000020
-+#define ISCSI_SCN_TARGET_AND_SELF_INFO_ONLY 0x00000040
-+#define ISCSI_SCN_INITIATOR_AND_SELF_INFO_ONLY 0x00000080
-+
-+#define ISCSI_SCN_OBJECT_MASK (ISCSI_SCN_OBJECT_UPDATED | \
-+ ISCSI_SCN_OBJECT_ADDED | \
-+ ISCSI_SCN_OBJECT_REMOVED)
-+
-+
-+// Definitions used for iSCSI Security Bitmap
-+
-+#define ISNS_SECURITY_BITMAP_VALID 0x00000001
-+#define ISNS_SECURITY_IKE_IPSEC_ENABLED 0x00000002
-+#define ISNS_SECURITY_MAIN_MODE_ENABLED 0x00000004
-+#define ISNS_SECURITY_AGGRESSIVE_MODE_ENABLED 0x00000008
-+#define ISNS_SECURITY_PFS_ENABLED 0x00000010
-+#define ISNS_SECURITY_TRANSPORT_MODE_PREFERRED 0x00000020
-+#define ISNS_SECURITY_TUNNEL_MODE_PREFERRED 0x00000040
-+
-+
-+// Definitions used for Portal Port
-+
-+#define PORTAL_PORT_NUMBER_MASK 0x0000FFFF
-+#define PORTAL_PORT_TYPE_UDP 0x00010000
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_isr.c ./drivers/scsi/qla4xxx/ql4_isr.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_isr.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_isr.c 2006-08-31 14:59:58.000000000 +0400
-@@ -0,0 +1,1379 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_suspend_lun
-+ * qla4xxx_status_entry
-+ * qla4xxx_process_response_queue
-+ * qla4xxx_isr_decode_mailbox
-+ * qla4xxx_interrupt_service_routine
-+ * qla4xxx_intr_handler
-+ * qla4xxx_ok2relogin
-+ * qla4xxx_process_aen
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+static void
-+qla4xxx_process_completed_request(struct scsi_qla_host *ha, uint32_t index);
-+
-+/*
-+ * String messages for various state values (used for print statements)
-+ *---------------------------------------------------------------------------*/
-+const char *host_sts_msg[] = HOST_STS_TBL();
-+
-+
-+/**************************************************************************
-+ * qla4xxx_suspend_lun
-+ * This routine suspends the lun queue for the specified lun and places
-+ * all requests for this lun onto the retry queue for a specified
-+ * amount of time.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * srb - Pointer to SCSI Request Block
-+ * lun_entry - lun structure
-+ * time - Number of seconds to suspend queue
-+ * retries - Max retry count for this lun
-+ * delay = non-zero, if lun should be delayed rather than suspended
-+ *
-+ * Remarks:
-+ * The suspend queue algorithm is provided as a method to keep commands
-+ * within the driver while a device is attempting to recover from certain
-+ * failures. By keeping the commands within the driver, it prevents the
-+ * kernel's retries from being exhausted so quickly and minimizes failures
-+ * at the application level.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+void
-+__qla4xxx_suspend_lun(scsi_qla_host_t *ha,
-+ srb_t *srb,
-+ os_lun_t *lun_entry,
-+ uint16_t time,
-+ uint16_t retries, int delay)
-+{
-+ unsigned long flags;
-+ uint8_t status = 0 ;
-+
-+ if (lun_entry == NULL)
-+ return;
-+
-+ spin_lock_irqsave(&lun_entry->lun_lock, flags);
-+
-+ if (lun_entry->lun_state == LS_LUN_READY ||
-+ lun_entry->lun_state == LS_LUN_RETRY) {
-+ if (lun_entry->lun_state == LS_LUN_READY) {
-+ lun_entry->max_retry_count = retries;
-+ lun_entry->retry_count = 0;
-+ }
-+
-+ /* Set the suspend time */
-+ atomic_set(&lun_entry->suspend_timer, time);
-+ DEBUG2( printk("scsi%d: %s lun %d retry count = %d\n",
-+ ha->host_no, __func__, lun_entry->lun,
-+ lun_entry->retry_count));
-+
-+ /* now suspend the lun */
-+ lun_entry->lun_state = LS_LUN_SUSPENDED;
-+ lun_entry->fclun->fcport->vis_ha = ha;
-+ if (delay) {
-+ set_bit(LF_LUN_DELAYED, &lun_entry->flags);
-+ }
-+ status = 1;
-+
-+ }
-+ spin_unlock_irqrestore(&lun_entry->lun_lock, flags);
-+
-+#if 0
-+ if (status) {
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_entry_safe(sp, stemp, &ha->pending_srb_q,
-+ list_entry) {
-+ if (sp->lun_queue != lun_entry)
-+ continue;
-+
-+ __del_from_pending_srb_q(ha, sp);
-+
-+ if (retries > sp->cmd->allowed)
-+ sp->cmd->allowed = retries;
-+ __add_to_retry_srb_q(ha,sp);
-+
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ }
-+#endif
-+ if( srb )
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ add_to_retry_srb_q(ha,srb);
-+#else
-+ qla4xxx_complete_request(ha, srb);
-+#endif
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_check_and_copy_sense
-+ * This routine processes Status IOCBs
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * sts_entry - Pointer to status entry structure
-+ * srb - Pointer to internal SCSI request block structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - We want the caller to complete the command
-+ * QLA_ERROR - We do not want the caller to complete the request
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_check_and_copy_sense(scsi_qla_host_t *ha, STATUS_ENTRY *sts_entry, srb_t *srb)
-+{
-+ struct scsi_cmnd *cmd = srb->cmd;
-+ scsi_qla_host_t *osha;
-+ uint16_t sensebytecnt;
-+ os_lun_t *lun_entry = srb->lun_queue;
-+ fc_port_t *fcport;
-+ osha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ /* FIXMEdg: Always clear buffer */
-+ memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
-+
-+ sensebytecnt = le16_to_cpu(sts_entry->senseDataByteCnt);
-+ if (sensebytecnt == 0)
-+ return(QLA_SUCCESS);
-+
-+ /* always perform the copy to cmd fields */
-+ CMD_ACTUAL_SNSLEN(cmd) = sensebytecnt;
-+
-+ memcpy(cmd->sense_buffer,
-+ sts_entry->senseData,
-+ MIN(sensebytecnt, sizeof(cmd->sense_buffer)));
-+
-+ if (!(srb->flags & (SRB_IOCTL_CMD | SRB_TAPE)))
-+ return(QLA_SUCCESS);
-+
-+ /* check for vaild sense data */
-+ if ((sts_entry->senseData[0] & 0x70) != 0x70)
-+ return(QLA_SUCCESS);
-+
-+ DEBUG2(printk("scsi%d:%d:%d:%d: %s: "
-+ "sense key = "
-+ "%x, ASC/ASCQ = %02x/%02x\n",
-+ ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun, __func__,
-+ sts_entry->senseData[2] & 0x0f,
-+ sts_entry->senseData[12],
-+ sts_entry->senseData[13]));
-+
-+ srb->flags |= SRB_GOT_SENSE;
-+
-+ switch (sts_entry->senseData[2] & 0x0f) {
-+ case RECOVERED_ERROR:
-+ cmd->result = DID_OK << 16;
-+ cmd->sense_buffer[0] = 0;
-+ break;
-+
-+ case NOT_READY:
-+ case HARDWARE_ERROR:
-+ fcport = lun_entry->fclun->fcport;
-+
-+ /*
-+ * Suspend the lun only for hard disk device type.
-+ */
-+ if (test_bit(AF_INIT_DONE, &ha->flags) &&
-+ lun_entry != NULL &&
-+ (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
-+ lun_entry->lun_state != LS_LUN_TIMEOUT) {
-+ /*
-+ * If target is in process of being ready then suspend
-+ * lun for 6 secs and retry all the commands.
-+ */
-+ if (sts_entry->senseData[12] == 0x4 &&
-+ sts_entry->senseData[13] == 0x1) {
-+ /* To give the lun more time to become ready,
-+ * suspend lun then retry command */
-+ qla4xxx_suspend_lun(osha, srb, lun_entry,
-+ SUSPEND_SECONDS,
-+ SUSPEND_RETRIES);
-+ return(QLA_ERROR);
-+ }
-+ else if (sts_entry->senseData[12] == 0x8 &&
-+ sts_entry->senseData[13] == 0x0) {
-+ /* To give the lun more time to become ready,
-+ * suspend lun then retry command */
-+ qla4xxx_suspend_lun(osha, srb, lun_entry,
-+ SUSPEND_SECONDS,
-+ (ha->port_down_retry_count /
-+ SUSPEND_SECONDS)) ;
-+ return(QLA_ERROR);
-+ }
-+ }
-+ break;
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_status_entry
-+ * This routine processes Status IOCBs
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * sts_entry - Pointer to status entry structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+static void
-+qla4xxx_status_entry(scsi_qla_host_t *ha, STATUS_ENTRY *sts_entry)
-+{
-+ srb_t *srb;
-+ uint8_t scsi_status;
-+
-+ ENTER("qla4xxx_status_entry");
-+
-+ /* FIXMEdg: Fast path completion. */
-+ if (sts_entry->completionStatus == SCS_COMPLETE &&
-+ sts_entry->scsiStatus == 0) {
-+ qla4xxx_process_completed_request(ha,
-+ le32_to_cpu(sts_entry->handle));
-+ return;
-+ }
-+
-+ srb = del_from_active_array(ha, le32_to_cpu(sts_entry->handle));
-+ if (srb) {
-+ struct scsi_cmnd *cmd = srb->cmd;
-+ uint32_t residual = le32_to_cpu(sts_entry->residualByteCnt);
-+ ddb_entry_t *ddb_entry = srb->fclun->fcport->ddbptr;
-+
-+ if (cmd == NULL) {
-+ DEBUG2(printk("scsi(%d): Command already returned back to OS "
-+ "pkt->handle=%d srb=%p srb->state:%d\n",
-+ ha->host_no, sts_entry->handle, srb, srb->state));
-+ printk(KERN_WARNING
-+ "Command is NULL: already returned to OS (srb=%p)\n", srb);
-+
-+ return;
-+ }
-+
-+ if (srb->lun_queue == NULL) {
-+ DEBUG2(printk("scsi(%d): Status Entry invalid lun pointer.\n",
-+ ha->host_no));
-+ /* FIXMEdg: Don't we need to reset ISP in this case??? */
-+ }
-+
-+ if (ddb_entry == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ goto status_entry_exit;
-+ }
-+ /*
-+ * Translate ISP error to a Linux SCSI error
-+ */
-+ scsi_status = sts_entry->scsiStatus;
-+
-+ switch (sts_entry->completionStatus) {
-+ case SCS_COMPLETE:
-+
-+ if (scsi_status == 0) {
-+ cmd->result = DID_OK << 16;
-+ break;
-+ }
-+
-+ if (sts_entry->iscsiFlags &
-+ (ISCSI_FLAG_RESIDUAL_OVER |
-+ ISCSI_FLAG_RESIDUAL_UNDER)) {
-+ cmd->resid = residual;
-+ // CMD_RESID_LEN(cmd) = residual;
-+ }
-+
-+ if (scsi_status == SCSISTAT_BUSY) {
-+ cmd->result = DID_BUS_BUSY << 16 | scsi_status;
-+ break;
-+ }
-+
-+ if (scsi_status != SCSISTAT_CHECK_CONDITION)
-+ break;
-+
-+ /* Check for sense errors */
-+ if (qla4xxx_check_and_copy_sense(ha, sts_entry ,srb) == QLA_ERROR) {
-+ LEAVE("qla4xxx_status_entry");
-+ return; /* DO NOT complete request */
-+ }
-+
-+ break;
-+
-+ case SCS_INCOMPLETE:
-+ /* Always set the status to DID_ERROR, since
-+ * all conditions result in that status anyway */
-+ cmd->result = DID_ERROR << 16;
-+ break;
-+
-+ case SCS_RESET_OCCURRED:
-+ DEBUG2(printk("scsi%d:%d:%d:%d: %s: "
-+ "Device RESET occurred\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__));
-+
-+ /* FIXME: Should we requeue RESET status ??? */
-+ // cmd->result = DID_RESET << 16;
-+ if (srb->flags & (SRB_IOCTL_CMD | SRB_TAPE)) {
-+ cmd->result = DID_RESET << 16;
-+ }
-+ else {
-+ qla4xxx_device_suspend(ha, srb->lun_queue, srb);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ return;
-+#endif
-+ }
-+
-+ break;
-+
-+ case SCS_ABORTED:
-+ QL4PRINT(QLP2|QLP3, printk("scsi%d:%d:%d:%d: %s: "
-+ "Abort occurred\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__));
-+
-+ cmd->result = DID_ABORT << 16;
-+ // ha->aborted_io_count++;
-+ break;
-+
-+ case SCS_TIMEOUT:
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d:%d:%d:%d: "
-+ "Timeout\n",
-+ ha->host_no, cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun));
-+
-+ /* F/W logout the connection when this occurs */
-+ cmd->result = DID_BUS_BUSY << 16;
-+
-+ /*
-+ * Mark device missing so that we won't continue to send
-+ * I/O to this device. We should get a ddb state change
-+ * AEN soon.
-+ */
-+ if ((atomic_read(&ddb_entry->state) == DEV_STATE_ONLINE))
-+ qla4xxx_mark_device_missing(ha, ddb_entry);
-+ break;
-+
-+ case SCS_DATA_UNDERRUN:
-+ case SCS_DATA_OVERRUN:
-+ if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) != 0) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "Data overrun, "
-+ "residual = 0x%x\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__, residual));
-+
-+ QL4PRINT(QLP10,
-+ printk("scsi%d: %s: "
-+ "response packet data\n",
-+ ha->host_no, __func__));
-+ qla4xxx_dump_bytes(QLP10, sts_entry,
-+ (sizeof(*sts_entry) *
-+ sts_entry->hdr.entryCount));
-+
-+ cmd->result = DID_ERROR << 16;
-+ break;
-+ }
-+
-+
-+ if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_UNDER) == 0) {
-+ cmd->resid = residual;
-+ // CMD_RESID_LEN(cmd) = residual;
-+ QL4PRINT(QLP2,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "UNDERRUN status detected, "
-+ "xferlen = 0x%x, "
-+ "residual = 0x%x\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__, cmd->request_bufflen,
-+ residual));
-+ }
-+
-+ /*
-+ * If there is scsi_status, it takes precedense over
-+ * underflow condition.
-+ */
-+ if (scsi_status != 0) {
-+ if (scsi_status == SCSISTAT_BUSY) {
-+ cmd->result = DID_BUS_BUSY << 16 | scsi_status;
-+ break;
-+ }
-+ cmd->result = DID_OK << 16 | scsi_status;
-+
-+ if (scsi_status != SCSISTAT_CHECK_CONDITION)
-+ break;
-+
-+ /* Check for sense errors */
-+ if (qla4xxx_check_and_copy_sense(ha, sts_entry ,srb) == QLA_ERROR) {
-+ LEAVE("qla4xxx_status_entry");
-+ return; /* DO NOT complete request */
-+ }
-+ }
-+ else {
-+ /*
-+ * If RISC reports underrun and target does not
-+ * report it then we must have a lost frame, so
-+ * tell upper layer to retry it by reporting a
-+ * bus busy.
-+ */
-+ if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_UNDER) == 0) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d:%d:%d:%d: "
-+ "%s: Dropped frame(s) "
-+ "detected (%x of %x bytes)..."
-+ " retrying command.\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__,
-+ residual,
-+ cmd->request_bufflen));
-+
-+ cmd->result = DID_BUS_BUSY << 16;
-+ }
-+ else if ((cmd->request_bufflen - residual) < cmd->underflow) {
-+ /*
-+ * Handle mid-layer underflow???
-+ *
-+ * For kernels less than 2.4, the driver must
-+ * return an error if an underflow is detected.
-+ * For kernels equal-to and above 2.4, the
-+ * mid-layer will appearantly handle the
-+ * underflow by detecting the residual count --
-+ * unfortunately, we do not see where this is
-+ * actually being done. In the interim, we
-+ * will return DID_ERROR.
-+ */
-+ QL4PRINT(QLP2,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "Mid-layer Data underrun, "
-+ "xferlen = 0x%x, "
-+ "residual = 0x%x\n",
-+ ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__, cmd->request_bufflen,
-+ residual));
-+
-+ cmd->result = DID_ERROR << 16;
-+ CMD_RESID_LEN(cmd) = residual;
-+ }
-+ else {
-+ cmd->result = DID_OK << 16;
-+ }
-+ }
-+ break;
-+
-+ case SCS_DEVICE_LOGGED_OUT:
-+ case SCS_DEVICE_UNAVAILABLE:
-+ /*
-+ * Mark device missing so that we won't continue to
-+ * send I/O to this device. We should get a ddb
-+ * state change AEN soon.
-+ */
-+
-+ if ((atomic_read(&ddb_entry->state) ==
-+ DEV_STATE_ONLINE))
-+ qla4xxx_mark_device_missing(ha, ddb_entry);
-+
-+ if ((srb->flags & SRB_TAPE) ||
-+ (atomic_read(&ddb_entry->fcport->state)
-+ == FCS_DEVICE_DEAD)) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ }
-+ else {
-+ cmd->result = DID_ERROR << 16;
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ qla4xxx_extend_timeout(cmd, EXTEND_CMD_TOV);
-+ add_to_retry_srb_q(ha, srb);
-+ return; /* DO NOT complete request */
-+#endif
-+ }
-+
-+ break;
-+
-+ case SCS_QUEUE_FULL:
-+ /*
-+ * SCSI Mid-Layer handles device queue full
-+ */
-+ cmd->result = DID_OK << 16 | sts_entry->scsiStatus;
-+ DEBUG2( printk("scsi%d:%d:%d: %s: QUEUE FULL detected "
-+ "compl=%02x, scsi=%02x, state=%02x, "
-+ "iFlags=%02x, iResp=%02x\n",
-+ ha->host_no, cmd->device->id,
-+ cmd->device->lun,
-+ __func__, sts_entry->completionStatus,
-+ sts_entry->scsiStatus,
-+ sts_entry->state_flags,
-+ sts_entry->iscsiFlags,
-+ sts_entry->iscsiResponse));
-+ break;
-+
-+ case SCS_DMA_ERROR:
-+ case SCS_TRANSPORT_ERROR:
-+ case SCS_DATA_DIRECTION_ERROR:
-+ case SCS_DEVICE_CONFIG_CHANGED:
-+ default:
-+ cmd->result = DID_ERROR << 16;
-+ break;
-+ }
-+
-+ status_entry_exit:
-+
-+
-+ /* fill in info for passthru command */
-+ CMD_SCSI_STATUS(cmd) = sts_entry->scsiStatus;
-+
-+ if (srb->flags & (SRB_IOCTL_CMD | SRB_TAPE)) {
-+ CMD_COMPL_STATUS(cmd) = sts_entry->completionStatus;
-+ CMD_ISCSI_RESPONSE(cmd) = sts_entry->iscsiResponse;
-+ CMD_STATE_FLAGS(cmd) = sts_entry->state_flags;
-+ CMD_HOST_STATUS(cmd) = host_byte(cmd->result);
-+ }
-+
-+ /* complete the request */
-+ srb->cc_stat = sts_entry->completionStatus;
-+ if (host_byte(cmd->result) == DID_RESET ||
-+ host_byte(cmd->result) == DID_BUS_BUSY ||
-+ /* host_byte(cmd->result) == DID_IMM_RETRY || */
-+ host_byte(cmd->result) == DID_ABORT ||
-+ host_byte(cmd->result) == DID_ERROR) {
-+ DEBUG2(printk("scsi%d:%d:%d: %s: "
-+ "did_error=%d, comp-scsi=0x%x-0x%x, "
-+ "pid=%ld\n",
-+ ha->host_no, cmd->device->id,
-+ cmd->device->lun,
-+ __func__,
-+ host_byte(cmd->result),
-+ sts_entry->completionStatus,
-+ sts_entry->scsiStatus,
-+ cmd->serial_number));
-+ }
-+
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ add_to_done_srb_q(ha, srb);
-+#else
-+ qla4xxx_complete_request(ha, srb);
-+#endif
-+ }
-+ else {
-+ /* FIXMEdg: Don't we need to reset ISP in this case??? */
-+ DEBUG2(printk(KERN_WARNING "scsi%d: Status Entry invalid "
-+ "handle 0x%x, sp=%p. "
-+ "This cmd may have already been completed.\n",
-+ ha->host_no, le32_to_cpu(sts_entry->handle),
-+ srb));
-+
-+ // QL4PRINT(QLP2, printk("scsi%d: %s: sts_entry 0x%p\n",
-+ // ha->host_no, __func__, sts_entry));
-+ // qla4xxx_dump_bytes(QLP2, sts_entry, sizeof(*sts_entry));
-+ }
-+
-+ LEAVE("qla4xxx_status_entry");
-+}
-+
-+/**
-+ * qla2x00_process_completed_request() - Process a Fast Post response.
-+ * @ha: SCSI driver HA context
-+ * @index: SRB index
-+ */
-+static void
-+qla4xxx_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
-+{
-+ srb_t *srb;
-+
-+ srb = del_from_active_array(ha, index);
-+
-+ if (srb) {
-+ CMD_COMPL_STATUS(srb->cmd) = 0L;
-+ CMD_SCSI_STATUS(srb->cmd) = 0L;
-+
-+ /* Save ISP completion status */
-+ srb->cmd->result = DID_OK << 16;
-+ srb->fo_retry_cnt = 0;
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ add_to_done_srb_q(ha, srb);
-+#else
-+ qla4xxx_complete_request(ha, srb);
-+#endif
-+ }
-+ else {
-+ DEBUG2(printk(
-+ "scsi(%d): Invalid ISP SCSI completion handle = %d\n",
-+ ha->host_no, index));
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_process_response_queue
-+ * This routine handles the Response Queue Completion.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * hardware_lock locked upon entry
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully processed response queue
-+ * QLA_ERROR - Failed to process response queue
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+static uint32_t
-+qla4xxx_process_response_queue(scsi_qla_host_t *ha)
-+{
-+ uint32_t count = 0;
-+ srb_t *srb = 0;
-+ STATUS_ENTRY *sts_entry;
-+
-+ ENTER("qla4xxx_process_response_queue");
-+
-+ /* Process all responses from response queue */
-+ while ((ha->response_in = (uint16_t)
-+ le32_to_cpu(ha->shadow_regs->rsp_q_in)) != ha->response_out) {
-+ sts_entry = (STATUS_ENTRY *) ha->response_ptr;
-+ count++;
-+
-+ /* Advance pointers for next entry */
-+ if (ha->response_out == (RESPONSE_QUEUE_DEPTH - 1)) {
-+ ha->response_out = 0;
-+ ha->response_ptr = ha->response_ring;
-+ }
-+ else {
-+ ha->response_out++;
-+ ha->response_ptr++;
-+ }
-+
-+ /* process entry */
-+ switch (sts_entry->hdr.entryType) {
-+ case ET_STATUS:
-+ /* Common status - Single completion posted in single
-+ * IOSB */
-+ // ha->f_end = jiffies;
-+
-+ qla4xxx_status_entry(ha, sts_entry);
-+ break;
-+ case ET_PASSTHRU_STATUS:
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ /* FIXME: DG XXX We should be using callbacks here */
-+ /* if (sts_entry->hdr.systemDefined == SD_PASSTHRU_IOCB)
-+ qla4xxx_iocb_pass_done(ha, (PASSTHRU_STATUS_ENTRY *) sts_entry);
-+ else */
-+ qla4xxx_isns_process_response(ha,
-+ (PASSTHRU_STATUS_ENTRY *) sts_entry);
-+#else
-+ qla4xxx_isns_process_response(ha,
-+ (PASSTHRU_STATUS_ENTRY *) sts_entry);
-+#endif
-+ break;
-+
-+/* FIXMEdg: Cut and paste from fibre code */
-+ case ET_STATUS_CONTINUATION:
-+ /* Just throw away the status continuation entries */
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Status Continuation entry "
-+ "- ignoring\n", ha->host_no, __func__));
-+ break;
-+
-+ case ET_COMMAND:
-+ /* ISP device queue is full. Command not accepted by
-+ * ISP. Queue command for later */
-+
-+ srb = del_from_active_array(ha, le32_to_cpu(sts_entry->handle));
-+ if (srb == NULL)
-+ goto exit_prq_invalid_handle;
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: FW device queue full, "
-+ "srb %p\n",
-+ ha->host_no, __func__, srb));
-+
-+ /* Let's RETRY normally by sending it back with DID_BUS_BUSY */
-+ srb->cmd->result = DID_BUS_BUSY << 16;
-+ qla4xxx_complete_request(ha, srb);
-+ break;
-+
-+ case ET_CONTINUE:
-+ /* Just throw away the continuation entries */
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Continuation entry - "
-+ "ignoring\n",
-+ ha->host_no, __func__));
-+ break;
-+
-+ default:
-+ /* Invalid entry in response queue, reset RISC
-+ * firmware */
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Invalid entry %x "
-+ "in response queue \n",
-+ ha->host_no, __func__,
-+ sts_entry->hdr.entryType));
-+
-+ QL4PRINT(QLP10, printk("scsi%d: %s: Dumping Response Entry "
-+ "%p:%x out %x in%x\n",
-+ ha->host_no, __func__,
-+ sts_entry,
-+ le32_to_cpu(((QUEUE_ENTRY*)sts_entry)->
-+ signature),
-+ ha->response_out,
-+ ha->response_in));
-+
-+ qla4xxx_dump_bytes(QLP10, sts_entry,
-+ sizeof(*sts_entry));
-+ goto exit_prq_error;
-+ }
-+ }
-+
-+ if (ha->response_out == ha->response_in) {
-+ QL4PRINT(QLP5,
-+ printk("scsi%d: %s: Response count %x out %x "
-+ "in %x, next %p:%x. Finished!\n",
-+ ha->host_no, __func__, count,
-+ ha->response_out, ha->response_in,
-+ ha->request_ptr,
-+ ha->response_ptr->signature));
-+ }
-+
-+ /* Done with responses, update the ISP
-+ * For QLA4010, this also clears the interrupt.
-+ */
-+ WRT_REG_DWORD(&ha->reg->rsp_q_out, ha->response_out);
-+ PCI_POSTING(&ha->reg->rsp_q_out);
-+
-+ LEAVE("qla4xxx_process_response_queue");
-+ return(QLA_SUCCESS);
-+
-+ exit_prq_invalid_handle:
-+ DEBUG2(printk("scsi%d: %s: Invalid handle(srb)=%p type=%x "
-+ "IOCS=%x\n", ha->host_no, __func__,
-+ srb, sts_entry->hdr.entryType,
-+ sts_entry->completionStatus));
-+
-+ exit_prq_error:
-+ WRT_REG_DWORD(ISP_REQ_Q_OUT(ha), ha->response_out);
-+ PCI_POSTING(ISP_REQ_Q_OUT(ha));
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+
-+ LEAVE("qla4xxx_process_response_queue");
-+ return(QLA_ERROR);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_isr_decode_mailbox
-+ * This routine decodes the mailbox status during the ISR.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * mailbox_status - Mailbox status.
-+ *
-+ * Remarks:
-+ * hardware_lock locked upon entry
-+ *
-+ * Returns:
-+ * None.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+static void
-+qla4xxx_isr_decode_mailbox(scsi_qla_host_t *ha, uint32_t mbox_status)
-+{
-+ /* used for MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED */
-+ static uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ if ((mbox_status == MBOX_STS_BUSY) ||
-+ (mbox_status == MBOX_STS_INTERMEDIATE_COMPLETION) ||
-+ (mbox_status >>12 == MBOX_COMPLETION_STATUS)) {
-+ ha->mbox_status[0] = mbox_status;
-+
-+ if (test_bit(AF_MBOX_COMMAND, &ha->flags)) {
-+ /*
-+ * Copy all mailbox registers to a temporary
-+ * location and set mailbox command done flag
-+ */
-+ uint8_t i;
-+
-+ for (i = 1; i < ha->mbox_status_count; i++) {
-+ ha->mbox_status[i] =
-+ RD_REG_DWORD(&ha->reg->mailbox[i]);
-+ }
-+
-+ QL4PRINT(QLP11,
-+ printk("scsi%d: %s: mailbox cmd done!\n",
-+ ha->host_no, __func__));
-+
-+ ha->f_end = jiffies;
-+ set_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
-+ wake_up(&ha->mailbox_wait_queue);
-+ }
-+ #if 0
-+ else {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: ERROR: Receiving mailbox "
-+ "status %08X when no mailbox command "
-+ "active.\n",
-+ ha->host_no, mbox_status));
-+
-+ __dump_registers(ha);
-+ }
-+ #endif
-+ }
-+ else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) {
-+ /* Immediately process the AENs that don't require much work.
-+ * Only queue the database_changed AENs */
-+ switch (mbox_status) {
-+ case MBOX_ASTS_SYSTEM_ERROR:
-+ /* Log Mailbox registers */
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO
-+ "scsi%d: AEN %04x, System Error, "
-+ "Dump Mailboxes\n",
-+ ha->host_no, mbox_status));
-+ __dump_mailbox_registers(QLP2, ha);
-+ set_bit(AF_GET_CRASH_RECORD, &ha->flags);
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ break;
-+
-+ case MBOX_ASTS_REQUEST_TRANSFER_ERROR:
-+ case MBOX_ASTS_RESPONSE_TRANSFER_ERROR:
-+ case MBOX_ASTS_NVRAM_INVALID:
-+ case MBOX_ASTS_IP_ADDRESS_CHANGED:
-+ case MBOX_ASTS_DHCP_LEASE_EXPIRED:
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x, "
-+ "ERROR Status, Reset HA\n",
-+ ha->host_no, mbox_status));
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ break;
-+
-+ case MBOX_ASTS_LINK_UP:
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x "
-+ "Adapter LINK UP\n",
-+ ha->host_no, mbox_status));
-+ set_bit(AF_LINK_UP, &ha->flags);
-+ break;
-+
-+ case MBOX_ASTS_LINK_DOWN:
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x "
-+ "Adapter LINK DOWN\n",
-+ ha->host_no, mbox_status));
-+ clear_bit(AF_LINK_UP, &ha->flags);
-+ break;
-+
-+ case MBOX_ASTS_HEARTBEAT:
-+ QL4PRINT(QLP7,
-+ printk(KERN_INFO "scsi%d: AEN %04x "
-+ "HEARTBEAT\n",
-+ ha->host_no, mbox_status));
-+ ha->seconds_since_last_heartbeat = 0;
-+ break;
-+
-+ case MBOX_ASTS_DHCP_LEASE_ACQUIRED:
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: AEN %04x DHCP LEASE ACQUIRED\n",
-+ ha->host_no, mbox_status));
-+ break;
-+
-+ case MBOX_ASTS_PROTOCOL_STATISTIC_ALARM:
-+ case MBOX_ASTS_SCSI_COMMAND_PDU_REJECTED: /* Target mode only */
-+ case MBOX_ASTS_UNSOLICITED_PDU_RECEIVED: /* connection mode only */
-+ case MBOX_ASTS_IPSEC_SYSTEM_FATAL_ERROR:
-+ /* No action */
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: AEN %04x\n",
-+ ha->host_no, mbox_status));
-+ break;
-+
-+ case MBOX_ASTS_MAC_ADDRESS_CHANGED:
-+ case MBOX_ASTS_DNS:
-+ /* No action */
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x, "
-+ "mbox_sts[1]=%04x, "
-+ "mbox_sts[2]=%04x\n",
-+ ha->host_no, mbox_status,
-+ RD_REG_DWORD(&ha->reg->mailbox[1]),
-+ RD_REG_DWORD(&ha->reg->mailbox[2])));
-+ break;
-+
-+ case MBOX_ASTS_SELF_TEST_FAILED:
-+ case MBOX_ASTS_LOGIN_FAILED:
-+ /* No action */
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x, "
-+ "mbox_sts[1]=%04x, "
-+ "mbox_sts[2]=%04x, mbox_sts[3]=%04x\n",
-+ ha->host_no, mbox_status,
-+ RD_REG_DWORD(&ha->reg->mailbox[1]),
-+ RD_REG_DWORD(&ha->reg->mailbox[2]),
-+ RD_REG_DWORD(&ha->reg->mailbox[3])));
-+ break;
-+
-+ case MBOX_ASTS_DATABASE_CHANGED:
-+ /* Queue AEN information and process it in the DPC
-+ * routine */
-+ if (ha->aen_q_count > 0) {
-+ int i;
-+
-+ /* advance pointer */
-+ if (ha->aen_in == (MAX_AEN_ENTRIES - 1))
-+ ha->aen_in = 0;
-+ else
-+ ha->aen_in++;
-+
-+ /* decrement available counter */
-+ ha->aen_q_count--;
-+
-+ for (i = 1; i < MBOX_AEN_REG_COUNT; i++) {
-+ ha->aen_q[ha->aen_in].mbox_sts[i] =
-+ RD_REG_DWORD(&ha->reg->mailbox[i]);
-+ }
-+ ha->aen_q[ha->aen_in].mbox_sts[0] = mbox_status;
-+
-+ /* print debug message */
-+ DEBUG2( printk("scsi%d: AEN[%d] %04x queued!\n",
-+ ha->host_no, ha->aen_in,
-+ mbox_status));
-+
-+ /* The DPC routine will process the aen */
-+ set_bit(DPC_AEN, &ha->dpc_flags);
-+ }
-+ else {
-+ int i;
-+
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: aen %04x, queue "
-+ "overflowed! AEN LOST!!\n",
-+ ha->host_no, __func__,
-+ mbox_status));
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: "
-+ "DUMP AEN QUEUE\n",
-+ ha->host_no));
-+
-+ for (i=0; i < MAX_AEN_ENTRIES; i++) {
-+ DEBUG2(printk(KERN_WARNING "AEN[%d] %04x %04x %04x %04x\n",
-+ i,
-+ ha->aen_q[i].mbox_sts[0],
-+ ha->aen_q[i].mbox_sts[1],
-+ ha->aen_q[i].mbox_sts[2],
-+ ha->aen_q[i].mbox_sts[3]));
-+ }
-+ }
-+ break;
-+
-+ case MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED:
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_sts[0] = mbox_status;
-+ mbox_sts[1] = RD_REG_DWORD(&ha->reg->mailbox[1]);
-+ mbox_sts[2] = RD_REG_DWORD(&ha->reg->mailbox[2]);
-+ mbox_sts[3] = RD_REG_DWORD(&ha->reg->mailbox[3]);
-+ mbox_sts[4] = RD_REG_DWORD(&ha->reg->mailbox[4]);
-+ mbox_sts[5] = RD_REG_DWORD(&ha->reg->mailbox[5]);
-+
-+ if (mbox_sts[1] == ISNS_EVENT_DATA_RECEIVED) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: AEN %04x, mbox_sts[1]=%04x, "
-+ "mbox_sts[2]=%04x, mbox_sts[3]=%04x, mbox_sts[4]=%04x\n",
-+ ha->host_no, mbox_status, mbox_sts[1],
-+ mbox_sts[2], mbox_sts[3], mbox_sts[4]));
-+
-+ if (qla4xxx_isns_get_server_request(ha,
-+ mbox_sts[3],
-+ mbox_sts[2])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: AEN %04x, "
-+ "isns_get_server_request FAILED!!\n",
-+ ha->host_no, __func__, mbox_status));
-+ }
-+ }
-+ else if (mbox_sts[1] == ISNS_EVENT_CONNECTION_OPENED) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: AEN %04x, iSNS Service "
-+ "Connection Opened!\n"
-+ "mbox_sts[2]=%08x, mbox_sts[3]=%08x, "
-+ "mbox_sts[4]=%08x, mbox_sts[5]=%08x\n",
-+ ha->host_no, mbox_status, mbox_sts[2],
-+ mbox_sts[3], mbox_sts[4], mbox_sts[5]));
-+
-+ qla4xxx_isns_enable_callback(ha,
-+ mbox_sts[2],
-+ mbox_sts[3],
-+ mbox_sts[4],
-+ mbox_sts[5]);
-+ }
-+ else if (mbox_sts[1] == ISNS_EVENT_CONNECTION_FAILED) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: AEN %04x, iSNS Service"
-+ " Connection FAILED! reason %04x\n",
-+ ha->host_no, mbox_status, mbox_sts[2]));
-+ }
-+ break;
-+ default:
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: AEN %04x UNKNOWN\n",
-+ ha->host_no, mbox_status));
-+ }
-+ }
-+ else {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: Unknown mailbox status %08X\n",
-+ ha->host_no, mbox_status));
-+
-+ ha->mbox_status[0] = mbox_status;
-+ __dump_registers(QLP2, ha);
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_interrupt_service_routine
-+ * This routine services the interrupt
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks:
-+ * hardware_lock locked upon entry
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - success, An interrupt was found and processed
-+ * QLA_ERROR - failure, The adapter was not interrupting
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_interrupt_service_routine(scsi_qla_host_t *ha, uint32_t intr_status)
-+{
-+ ENTER("qla4xxx_interrupt_service_routine");
-+
-+ /*
-+ * Process response queue interrupt.
-+ */
-+ if (intr_status & CSR_SCSI_COMPLETION_INTR) {
-+ qla4xxx_process_response_queue(ha);
-+ }
-+
-+ /*
-+ * Process mailbox/asynch event interrupt.
-+ */
-+ if (intr_status & CSR_SCSI_PROCESSOR_INTR) {
-+ uint32_t mbox_status = RD_REG_DWORD(&ha->reg->mailbox[0]);
-+ qla4xxx_isr_decode_mailbox(ha, mbox_status);
-+
-+ /* Clear Mailbox Interrupt */
-+ WRT_REG_DWORD(&ha->reg->ctrl_status,
-+ SET_RMASK(CSR_SCSI_PROCESSOR_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ }
-+
-+
-+ LEAVE("qla4xxx_interrupt_service_routine");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_intr_handler
-+ * This routine handles the H/W interrupt
-+ *
-+ * Input:
-+ * irq - Unused
-+ * dev_id - Pointer to host adapter structure
-+ * regs - Unused
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+irqreturn_t
-+qla4xxx_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
-+{
-+ scsi_qla_host_t *ha;
-+ uint32_t intr_status;
-+ unsigned long flags = 0;
-+ uint8_t reqs_count = 0;
-+
-+ ENTER("qla4xxx_intr_handler");
-+ ha = (scsi_qla_host_t *) dev_id;
-+ if (!ha) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "qla4xxx: Interrupt with NULL host ptr\n"));
-+ return IRQ_NONE;
-+ }
-+
-+ ha->isr_count++;
-+
-+ /*
-+ * Check for pending interrupts
-+ */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ /*
-+ * Repeatedly service interrupts up to a maximum of
-+ * MAX_REQS_SERVICED_PER_INTR
-+ */
-+ while (1) {
-+ /*
-+ * Read interrupt status
-+ */
-+ if (le32_to_cpu(ha->shadow_regs->rsp_q_in) !=
-+ ha->response_out) {
-+ intr_status = CSR_SCSI_COMPLETION_INTR;
-+ }
-+ else {
-+ intr_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ }
-+
-+ if ((intr_status & (CSR_SCSI_RESET_INTR|CSR_FATAL_ERROR|INTR_PENDING)) == 0) {
-+ if (reqs_count == 0)
-+ ha->spurious_int_count++;
-+ break;
-+ }
-+
-+ /*
-+ * Service interrupt
-+ */
-+ if (intr_status & CSR_SCSI_RESET_INTR) {
-+ QL4PRINT(QLP3,
-+ printk(KERN_INFO "scsi%d: Soft Reset requested by "
-+ "Network function or RISC\n", ha->host_no));
-+
-+ clear_bit(AF_ONLINE, &ha->flags);
-+ __qla4xxx_disable_intrs(ha);
-+
-+ QL4PRINT(QLP3,
-+ printk(KERN_INFO "scsi%d: Clear SCSI Reset Interrupt\n",
-+ ha->host_no));
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SCSI_RESET_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
-+
-+ break;
-+ }
-+ else if (intr_status & CSR_FATAL_ERROR) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: Fatal Error, "
-+ "Status 0x%04x\n", ha->host_no,
-+ RD_REG_DWORD(ISP_PORT_ERROR_STATUS(ha))));
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: Dump Registers:\n", ha->host_no));
-+ __dump_registers(QLP2, ha);
-+
-+ /* Issue Soft Reset to clear this error condition.
-+ * This will prevent the RISC from repeatedly
-+ * interrupting the driver; thus, allowing the DPC to
-+ * get scheduled to continue error recovery.
-+ * NOTE: Disabling RISC interrupts does not work in
-+ * this case, as CSR_FATAL_ERROR overrides
-+ * CSR_SCSI_INTR_ENABLE */
-+ if ((RD_REG_DWORD(&ha->reg->ctrl_status) & CSR_SCSI_RESET_INTR) == 0) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: Issue soft reset\n",
-+ ha->host_no));
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SOFT_RESET));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ }
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: Acknowledge fatal error\n",
-+ ha->host_no));
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_FATAL_ERROR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ __qla4xxx_disable_intrs(ha);
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+
-+ break;
-+ }
-+ else if (intr_status & INTR_PENDING) {
-+ qla4xxx_interrupt_service_routine(ha, intr_status);
-+ ha->total_io_count++;
-+ if (++reqs_count == MAX_REQS_SERVICED_PER_INTR) {
-+ QL4PRINT(QLP11,
-+ printk("scsi%d: %s: exiting, %d "
-+ "requests serviced\n",
-+ ha->host_no, __func__,
-+ reqs_count));
-+ break;
-+ }
-+ intr_status = 0;
-+ }
-+ }
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if (!list_empty(&ha->done_srb_q))
-+ qla4xxx_done(ha);
-+#endif
-+
-+ LEAVE("qla4xxx_intr_handler");
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_process_aen
-+ * This routine processes Asynchronous Events received from the firmware.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * flush_ddb_chg_aens - 1 = Ignore ddb changed aens
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_process_aen(scsi_qla_host_t *ha, uint8_t flush_ddb_chg_aens)
-+{
-+ uint32_t mbox_sts[MBOX_AEN_REG_COUNT];
-+ aen_t *aen;
-+ int i;
-+ unsigned long flags;
-+
-+ ENTER("qla4xxx_process_aen");
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ while (ha->aen_out != ha->aen_in) {
-+
-+ /* Advance pointers for next entry */
-+ if (ha->aen_out == (MAX_AEN_ENTRIES - 1))
-+ ha->aen_out = 0;
-+ else
-+ ha->aen_out++;
-+
-+ ha->aen_q_count++;
-+ aen = &ha->aen_q[ha->aen_out];
-+
-+ /* copy aen information to local structure */
-+ for (i=0; i < MBOX_AEN_REG_COUNT; i++)
-+ mbox_sts[i] = aen->mbox_sts[i];
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ DEBUG2(printk("scsi%d: Process AEN[%d] mb0=0x%x mb1=0x%x "
-+ "ddb[%d] state=0x%x mb4=0x%x\n",
-+ ha->host_no, ha->aen_out, mbox_sts[0],
-+ mbox_sts[1], mbox_sts[2], mbox_sts[3],
-+ mbox_sts[4]);)
-+ switch (mbox_sts[0]) {
-+ case MBOX_ASTS_DATABASE_CHANGED:
-+ if (flush_ddb_chg_aens) {
-+ DEBUG2(printk(KERN_INFO
-+ "scsi%d: aen[%d] %04x, index [%d] "
-+ "state=%04x IGNORED!\n", ha->host_no,
-+ ha->aen_out, mbox_sts[0], mbox_sts[2],
-+ mbox_sts[3]));
-+ break;
-+ }
-+
-+ QL4PRINT(QLP2|QLP7, printk(KERN_INFO
-+ "scsi%d: aen[%d] %04x, index [%d] state=%04x\n",
-+ ha->host_no, ha->aen_out, mbox_sts[0], mbox_sts[2],
-+ mbox_sts[3]));
-+
-+ if (mbox_sts[1] == 0) { /* Global DB change. */
-+ QL4PRINT(QLP2|QLP7, printk("scsi%d: %s: "
-+ "global database changed aen\n",
-+ ha->host_no, __func__));
-+ qla4xxx_reinitialize_ddb_list(ha);
-+ } else if (mbox_sts[1] == 1) { /* Specific device. */
-+ qla4xxx_process_ddb_changed(ha, mbox_sts[2],
-+ mbox_sts[3]);
-+ } else {
-+ QL4PRINT(QLP2|QLP7, printk("scsi%d: %s: "
-+ "invalid database changed aen modifier, "
-+ "mbox_sts[1]=%04x\n", ha->host_no,
-+ __func__, mbox_sts[1]));
-+ }
-+ break;
-+ }
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_process_aen");
-+}
-+
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_listops.h ./drivers/scsi/qla4xxx/ql4_listops.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_listops.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_listops.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,294 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 Qlogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/* Management functions for various lists */
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+/*************************************/
-+
-+static inline void
-+__add_to_retry_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ QL4PRINT(QLP8, printk("scsi%d: %s: ha %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance, srb));
-+ list_add_tail(&srb->list_entry, &ha->retry_srb_q);
-+ srb->state = SRB_RETRY_STATE;
-+ ha->retry_srb_q_count++;
-+ srb->ha = ha;
-+}
-+
-+static inline void
-+__del_from_retry_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ QL4PRINT(QLP8, printk("scsi%d: %s: ha %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance, srb));
-+ list_del_init(&srb->list_entry);
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ ha->retry_srb_q_count--;
-+}
-+
-+/*************************************/
-+
-+static inline void
-+__add_to_done_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ QL4PRINT(QLP8, printk("scsi%d: %s: ha %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance, srb));
-+ list_add_tail(&srb->list_entry, &ha->done_srb_q);
-+ srb->state = SRB_DONE_STATE;
-+ ha->done_srb_q_count++;
-+ srb->ha = ha;
-+}
-+
-+static inline void
-+__del_from_done_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ QL4PRINT(QLP8, printk("scsi%d: %s: ha %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance, srb));
-+ list_del_init(&srb->list_entry);
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ ha->done_srb_q_count--;
-+}
-+
-+static inline srb_t *__del_from_done_srb_q_head(scsi_qla_host_t *ha)
-+{
-+ struct list_head *ptr;
-+ srb_t *srb = NULL;
-+
-+ if (!list_empty(&ha->done_srb_q)) {
-+ /* Remove list entry from head of queue */
-+ ptr = ha->done_srb_q.next;
-+ list_del_init(ptr);
-+
-+ /* Return pointer to srb structure */
-+ srb = list_entry(ptr, srb_t, list_entry);
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ ha->done_srb_q_count--;
-+ }
-+ QL4PRINT(QLP8, printk("scsi%d: %s: ha %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance, srb));
-+
-+ return(srb);
-+}
-+#endif
-+
-+/*************************************/
-+
-+static inline void
-+__add_to_free_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ DEBUG(printk("scsi%d: %s: instance %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance,
-+ srb ));
-+
-+ //memset(srb, 0, sizeof(srb_t));
-+ list_add_tail(&srb->list_entry, &ha->free_srb_q);
-+ ha->free_srb_q_count++;
-+ srb->state = SRB_FREE_STATE;
-+}
-+
-+static inline void __del_from_free_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+
-+ DEBUG(printk("scsi%d: %s: instance %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance,
-+ srb ));
-+ list_del_init(&srb->list_entry);
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ ha->free_srb_q_count--;
-+}
-+
-+static inline srb_t *__del_from_free_srb_q_head(scsi_qla_host_t *ha)
-+{
-+ struct list_head *ptr;
-+ srb_t *srb = NULL;
-+
-+ if (!list_empty(&ha->free_srb_q)) {
-+ /* Remove list entry from head of queue */
-+ ptr = ha->free_srb_q.next;
-+ list_del_init(ptr);
-+
-+ /* Return pointer to srb structure */
-+ srb = list_entry(ptr, srb_t, list_entry);
-+ // memset(srb, 0, sizeof(*srb));
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ ha->free_srb_q_count--;
-+ }
-+ DEBUG(printk("scsi%d: %s: instance %d, srb = %p\n",
-+ ha->host_no, __func__, ha->instance,
-+ srb ));
-+
-+ return(srb);
-+}
-+
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+/*************************************/
-+
-+static inline void
-+add_to_retry_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ __add_to_retry_srb_q(ha ,srb);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+static inline void
-+del_from_retry_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ __del_from_retry_srb_q(ha ,srb);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+/*************************************/
-+
-+static inline void
-+add_to_done_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ unsigned long flags;
-+
-+ // spin_lock_irqsave(&ha->adapter_lock, flags);
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ __add_to_done_srb_q(ha ,srb);
-+ // spin_unlock_irqrestore(&ha->adapter_lock, flags);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+static inline void
-+del_from_done_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ // spin_lock_irqsave(&ha->adapter_lock, flags);
-+ __del_from_done_srb_q(ha ,srb);
-+ // spin_unlock_irqrestore(&ha->adapter_lock, flags);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+static inline srb_t *
-+del_from_done_srb_q_head(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ srb_t *srb;
-+
-+ // spin_lock_irqsave(&ha->adapter_lock, flags);
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ srb = __del_from_done_srb_q_head(ha);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ // spin_unlock_irqrestore(&ha->adapter_lock, flags);
-+ return(srb);
-+}
-+#endif
-+
-+/*************************************/
-+
-+static inline void
-+add_to_free_srb_q(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ memset(srb, 0, sizeof(*srb));
-+ __add_to_free_srb_q(ha ,srb);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+static inline srb_t *
-+del_from_free_srb_q_head(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ srb_t *srb;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ srb = __del_from_free_srb_q_head(ha);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ if (srb) {
-+ #ifdef DEBUG
-+ if (atomic_read(&srb->ref_count) != 0) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: WARNING: "
-+ "ref_count not zero.\n",
-+ ha->host_no, __func__));
-+ }
-+ #endif
-+
-+ atomic_set(&srb->ref_count, 1);
-+ }
-+ return(srb);
-+}
-+
-+/*************************************/
-+
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+/*
-+ * Failover Stuff.
-+ */
-+static inline void
-+__add_to_failover_queue(struct scsi_qla_host * ha, srb_t * sp)
-+{
-+ /*
-+ if( sp->state != SRB_NO_QUEUE_STATE &&
-+ sp->state != SRB_ACTIVE_STATE)
-+ BUG();
-+ */
-+
-+ list_add_tail(&sp->list_entry,&ha->failover_queue);
-+ ha->failover_cnt++;
-+ sp->state = SRB_FAILOVER_STATE;
-+ sp->ha = ha;
-+}
-+
-+static inline void add_to_failover_queue(struct scsi_qla_host * ha, srb_t * sp)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+
-+ __add_to_failover_queue(ha,sp);
-+
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+static inline void __del_from_failover_queue(struct scsi_qla_host * ha, srb_t *
-+ sp)
-+{
-+ ha->failover_cnt--;
-+ list_del_init(&sp->list_entry);
-+ sp->state = SRB_NO_QUEUE_STATE;
-+}
-+
-+static inline void del_from_failover_queue(struct scsi_qla_host * ha, srb_t * sp)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+
-+ __del_from_failover_queue(ha,sp);
-+
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+#endif
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_mbx.c ./drivers/scsi/qla4xxx/ql4_mbx.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_mbx.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_mbx.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,1370 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_mailbox_command
-+ * qla4xxx_mbx_test
-+ * qla4xxx_send_noop
-+ * qla4xxx_conn_close_sess_logout
-+ * qla4xxx_clear_database_entry
-+ * qla4xxx_initialize_fw_cb
-+ * qla4xxx_get_fw_version
-+ * qla4xxx_get_firmware_state
-+ * qla4xxx_get_fwddb_entry
-+ * qla4xxx_set_ddb_entry
-+ * qla4xxx_get_crash_record
-+ * qla4xxx_reset_lun
-+ * qla4xxx_isns_enable
-+ * qla4xxx_isns_disable
-+ * qla4xxx_isns_status
-+ * qla4xxx_get_flash
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#include <linux/delay.h>
-+
-+extern int ql4xportdownretrycount; //FIXME: Find some way to Remove
-+extern int ql4xdiscoverywait;
-+extern void qla4xxx_isns_build_entity_id(scsi_qla_host_t *ha);
-+extern int qla4xxx_eh_wait_for_active_target_commands(scsi_qla_host_t *ha, int target, int lun);
-+
-+/**************************************************************************
-+ * qla4xxx_mailbox_command
-+ * This routine sssue mailbox commands and waits for completion.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * inCount - number of mailbox registers to load.
-+ * outCount - number of mailbox registers to return.
-+ * mbx_cmd - data pointer for mailbox in registers.
-+ * mbx_sts - data pointer for mailbox out registers.
-+ *
-+ * Output:
-+ * mbx_sts - returned mailbox out data.
-+ *
-+ * Remarks:
-+ * If outCount is 0, this routine completes successfully WITHOUT waiting
-+ * for the mailbox command to complete.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Mailbox command completed successfully
-+ * QLA_ERROR - Mailbox command competed in error.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_mailbox_command(scsi_qla_host_t *ha,
-+ uint8_t inCount,
-+ uint8_t outCount,
-+ uint32_t *mbx_cmd,
-+ uint32_t *mbx_sts)
-+{
-+ uint8_t status = QLA_ERROR;
-+ uint8_t i;
-+ u_long wait_count;
-+ uint32_t intr_status;
-+ unsigned long flags = 0;
-+ DECLARE_WAITQUEUE(wait, current);
-+
-+
-+ ENTER("qla4xxx_mailbox_command");
-+
-+ down(&ha->mbox_sem);
-+
-+
-+ set_bit(AF_MBOX_COMMAND, &ha->flags);
-+
-+
-+ /* Make sure that pointers are valid */
-+ if (!mbx_cmd || !mbx_sts) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Invalid mbx_cmd or mbx_sts pointer\n",
-+ ha->host_no, __func__));
-+
-+ goto mbox_exit;
-+ }
-+
-+ /* To prevent overwriting mailbox registers for a command that has
-+ * not yet been serviced, check to see if a previously issued
-+ * mailbox command is interrupting.
-+ * -----------------------------------------------------------------
-+ */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ intr_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ if (intr_status & CSR_SCSI_PROCESSOR_INTR) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Trying to execute a mailbox request, "
-+ "while another one is interrupting\n"
-+ "Service existing interrupt first\n",
-+ ha->host_no, __func__));
-+
-+ /* Service existing interrupt */
-+ qla4xxx_interrupt_service_routine(ha, intr_status);
-+ }
-+
-+
-+ /* Send the mailbox command to the firmware
-+ * ----------------------------------------
-+ */
-+ ha->f_start = jiffies;
-+ ha->mbox_status_count = outCount;
-+ for (i=0; i < outCount; i++) {
-+ ha->mbox_status[i] = 0;
-+ }
-+
-+ for (i=0; i<inCount; i++) {
-+ QL4PRINT(QLP11, printk("scsi%d: %s: Mailbox In[%d] 0x%08X\n",
-+ ha->host_no, __func__, i, mbx_cmd[i]));
-+ }
-+
-+ /* Load all mailbox registers, except mailbox 0.*/
-+ for (i = 1; i < inCount; i++) {
-+ WRT_REG_DWORD(&ha->reg->mailbox[i], mbx_cmd[i]);
-+ }
-+
-+ /* Write Mailbox 0 to alert the firmware that the mailbox registers
-+ * contain a command to be processed. NOTE: We could be interrupted
-+ * here if system interrupts are enabled */
-+ WRT_REG_DWORD(&ha->reg->mailbox[0], mbx_cmd[0]);
-+ PCI_POSTING(&ha->reg->mailbox[0]);
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_INTR_RISC));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ add_wait_queue(&ha->mailbox_wait_queue,&wait);
-+
-+ /*
-+ * If we don't want status, don't wait for the mailbox command to
-+ * complete. For example, MBOX_CMD_RESET_FW doesn't return status,
-+ * you must poll the inbound Interrupt Mask for completion.
-+ */
-+ if (outCount == 0) {
-+ status = QLA_SUCCESS;
-+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&ha->mailbox_wait_queue,&wait);
-+ ha->f_end = jiffies;
-+ goto mbox_exit;
-+ }
-+
-+ /*
-+ * Wait for command to complete
-+ * -----------------------------
-+ */
-+ wait_count = jiffies + MBOX_TOV * HZ;
-+
-+ while (test_bit(AF_MBOX_COMMAND_DONE, &ha->flags) == 0) {
-+ if (wait_count <= jiffies)
-+ break;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ intr_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+
-+ QL4PRINT(QLP11, printk("scsi%d: %s: INTR_STATUS = 0x%X\n",
-+ ha->host_no, __func__, intr_status));
-+
-+ if (intr_status & INTR_PENDING) {
-+ /*
-+ * Service the interrupt.
-+ * The ISR will save the mailbox status registers
-+ * to a temporary storage location in the adapter
-+ * structure.
-+ */
-+ ha->mbox_status_count = outCount;
-+ qla4xxx_interrupt_service_routine(ha, intr_status);
-+ // DG XXX
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (!list_empty(&ha->done_srb_q))
-+ qla4xxx_done(ha);
-+#endif
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /*
-+ * Delay for 10 microseconds
-+ * NOTE: Interrupt_handler may be called here,
-+ * if interrupts are enabled
-+ */
-+ udelay(10);
-+ } /* wait loop */
-+
-+
-+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&ha->mailbox_wait_queue,&wait);
-+
-+ /*
-+ * Check for mailbox timeout
-+ */
-+ if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: Mailbox Cmd 0x%08X timed out ...,"
-+ " Scheduling Adapter Reset\n",
-+ ha->host_no, mbx_cmd[0]));
-+
-+ ha->mailbox_timeout_count++;
-+ mbx_sts[0] = (-1);
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ goto mbox_exit;
-+ }
-+
-+ QL4PRINT(QLP11,
-+ printk("scsi%d: %s: mailbox cmd done!\n",
-+ ha->host_no, __func__));
-+
-+ /*
-+ * Copy the mailbox out registers to the caller's mailbox in/out
-+ * structure.
-+ */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ for (i=0; i < outCount; i++) {
-+ mbx_sts[i] = ha->mbox_status[i];
-+ QL4PRINT(QLP11,
-+ printk("scsi%d: %s: Mailbox Status[%d] 0x%08X\n",
-+ ha->host_no, __func__, i, mbx_sts[i]));
-+ }
-+
-+ /*
-+ * Set return status and error flags (if applicable)
-+ */
-+ switch (ha->mbox_status[0]) {
-+
-+ case MBOX_STS_COMMAND_COMPLETE:
-+ status = QLA_SUCCESS;
-+ break;
-+
-+ case MBOX_STS_INTERMEDIATE_COMPLETION:
-+ status = QLA_SUCCESS;
-+ QL4PRINT(QLP5,
-+ printk("scsi%d: %s: Cmd = %08X, Intermediate completion\n",
-+ ha->host_no, __func__, mbx_cmd[0]));
-+ break;
-+
-+ case MBOX_STS_BUSY:
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Cmd = %08X, ISP BUSY\n",
-+ ha->host_no, __func__, mbx_cmd[0]));
-+
-+ ha->mailbox_timeout_count++;
-+ break;
-+
-+ case MBOX_STS_INVALID_COMMAND:
-+ case MBOX_STS_HOST_INTERFACE_ERROR:
-+ case MBOX_STS_TEST_FAILED:
-+ case MBOX_STS_COMMAND_ERROR:
-+ case MBOX_STS_COMMAND_PARAMETER_ERROR:
-+ default:
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: **** FAILED, cmd = %08X, "
-+ "sts = %08X ****\n",
-+ ha->host_no, __func__, mbx_cmd[0], mbx_sts[0]));
-+
-+
-+ __dump_registers(QLP2, ha);
-+ break;
-+ } /* switch mbox status */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ mbox_exit:
-+ clear_bit(AF_MBOX_COMMAND, &ha->flags);
-+ clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
-+ LEAVE("qla4xxx_mailbox_command");
-+ up(&ha->mbox_sem);
-+
-+ return(status);
-+}
-+
-+
-+#if 0
-+uint8_t qla4xxx_send_noop(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_NOP;
-+
-+ if (qla4xxx_mailbox_command(ha, 1, 1, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: NOP failed\n", ha->host_no));
-+ return(QLA_ERROR);
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: NOP succeded\n", ha->host_no));
-+ return(QLA_SUCCESS);
-+ }
-+}
-+
-+uint8_t qla4xxx_mbx_test(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ int i;
-+ uint8_t status;
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_REGISTER_TEST;
-+ mbox_cmd[1] = 0x11111111;
-+ mbox_cmd[2] = 0x22222222;
-+ mbox_cmd[3] = 0x33333333;
-+ mbox_cmd[4] = 0x44444444;
-+ mbox_cmd[5] = 0x55555555;
-+ mbox_cmd[6] = 0x66666666;
-+ mbox_cmd[7] = 0x77777777;
-+
-+ if (qla4xxx_mailbox_command(ha, 8, 8, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: REGISTER_TEST failed, mbox_sts = 0x%x\n",
-+ ha->host_no, mbox_sts[0]));
-+ return(QLA_ERROR);
-+ }
-+
-+ if (mbox_sts[1] != 0x11111111 ||
-+ mbox_sts[2] != 0x22222222 ||
-+ mbox_sts[3] != 0x33333333 ||
-+ mbox_sts[4] != 0x44444444 ||
-+ mbox_sts[5] != 0x55555555 ||
-+ mbox_sts[6] != 0x66666666 ||
-+ mbox_sts[7] != 0x77777777) {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: REGISTER_TEST failed\n", ha->host_no));
-+ status = QLA_ERROR;
-+
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: REGISTER_TEST succeded\n", ha->host_no));
-+ status = QLA_SUCCESS;
-+ }
-+
-+ for (i = 0; i < 8; i++) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: MBX%d = 0x%x\n",
-+ ha->host_no, __func__, i, mbox_cmd[i]));
-+ }
-+ return(status);
-+}
-+#endif
-+
-+/*
-+ * qla4xxx_issue_iocb
-+ * Issue IOCB using mailbox command
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * buffer = buffer pointer.
-+ * phys_addr = physical address of buffer.
-+ * size = size of buffer.
-+ * TARGET_QUEUE_LOCK must be released.
-+ * ADAPTER_STATE_LOCK must be released.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint8_t
-+qla4xxx_issue_iocb(scsi_qla_host_t *ha, void* buffer,
-+ dma_addr_t phys_addr, size_t size)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ uint8_t status;
-+
-+ ENTER("qla4xxx_issue_iocb: started");
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_EXECUTE_IOCB_A64;
-+ mbox_cmd[1] = 0;
-+ mbox_cmd[2] = LSDW(phys_addr);
-+ mbox_cmd[3] = MSDW(phys_addr);
-+ status = qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]);
-+
-+ if (status != QLA_SUCCESS) {
-+ /*EMPTY*/
-+ QL4PRINT(QLP2, printk("qla4xxx_issue_iocb(%d): failed statis 0x%x",
-+ ha->host_no, status));
-+ } else {
-+ /*EMPTY*/
-+ LEAVE("qla4xxx_issue_iocb: exiting normally");
-+ }
-+
-+ return status;
-+}
-+
-+uint8_t
-+qla4xxx_conn_close_sess_logout(scsi_qla_host_t *ha, uint16_t fw_ddb_index,
-+ uint16_t connection_id, uint16_t option)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_CONN_CLOSE_SESS_LOGOUT;
-+ mbox_cmd[1] = fw_ddb_index;
-+ mbox_cmd[2] = connection_id;
-+ mbox_cmd[3] = LOGOUT_OPTION_RELOGIN;
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 2, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT "
-+ "option %04x failed sts %04X %04X",
-+ ha->host_no, __func__, option,
-+ mbox_sts[0], mbox_sts[1]));
-+
-+ if (mbox_sts[0] == 0x4005) {
-+ QL4PRINT(QLP2, printk(", reason %04X\n", mbox_sts[1]));
-+ }
-+ else {
-+ QL4PRINT(QLP2, printk("\n"));
-+ }
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_clear_database_entry(scsi_qla_host_t *ha, uint16_t fw_ddb_index)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_CLEAR_DATABASE_ENTRY;
-+ mbox_cmd[1] = fw_ddb_index;
-+
-+ if (qla4xxx_mailbox_command(ha, 2, 5, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_CLEAR_DATABASE_ENTRY "
-+ "failed sts %04X index [%d], state %04x\n",
-+ ha->host_no, __func__, mbox_sts[0], fw_ddb_index,
-+ mbox_sts[4]));
-+ return(QLA_ERROR);
-+ }
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_initialize_fw_cb
-+ * This routine initializes the firmware control block for the
-+ * specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully initialized firmware ctrl block
-+ * QLA_ERROR - Failed to initialize firmware ctrl block
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_initialize_fw_cb(scsi_qla_host_t *ha)
-+{
-+ INIT_FW_CTRL_BLK *init_fw_cb;
-+ dma_addr_t init_fw_cb_dma;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER("qla4xxx_initialize_fw_cb");
-+
-+ init_fw_cb = pci_alloc_consistent(ha->pdev, sizeof(INIT_FW_CTRL_BLK),
-+ &init_fw_cb_dma);
-+ if (init_fw_cb == NULL) {
-+ printk("scsi%d: %s: Unable to alloc init_cb\n", ha->host_no,
-+ __func__);
-+ return 10;
-+ }
-+ memset(init_fw_cb, 0, sizeof(INIT_FW_CTRL_BLK));
-+
-+ /*
-+ * Get Initialize Firmware Control Block
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-+ mbox_cmd[2] = LSDW(init_fw_cb_dma);
-+ mbox_cmd[3] = MSDW(init_fw_cb_dma);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: Failed to get init_fw_ctrl_blk\n",
-+ ha->host_no, __func__));
-+ LEAVE("qla4xxx_initialize_fw_cb");
-+ pci_free_consistent(ha->pdev, sizeof(INIT_FW_CTRL_BLK),
-+ init_fw_cb, init_fw_cb_dma);
-+ return (status);
-+ }
-+
-+ // QL4PRINT(QLP10, printk("scsi%d: Init Fw Ctrl Blk\n", ha->host_no));
-+ // qla4xxx_dump_bytes(QLP10, init_fw_cb, sizeof(INIT_FW_CTRL_BLK));
-+
-+ /*
-+ * Initialize request and response queues
-+ */
-+ qla4xxx_init_rings(ha);
-+
-+ /*
-+ * Fill in the request and response queue information
-+ */
-+ init_fw_cb->ReqQConsumerIndex = cpu_to_le16(ha->request_out);
-+ init_fw_cb->ComplQProducerIndex = cpu_to_le16(ha->response_in);
-+ init_fw_cb->ReqQLen = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH);
-+ init_fw_cb->ComplQLen = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH);
-+ init_fw_cb->ReqQAddrLo = cpu_to_le32(LSDW(ha->request_dma));
-+ init_fw_cb->ReqQAddrHi = cpu_to_le32(MSDW(ha->request_dma));
-+ init_fw_cb->ComplQAddrLo = cpu_to_le32(LSDW(ha->response_dma));
-+ init_fw_cb->ComplQAddrHi = cpu_to_le32(MSDW(ha->response_dma));
-+ init_fw_cb->ShadowRegBufAddrLo = cpu_to_le32(LSDW(ha->shadow_regs_dma));
-+ init_fw_cb->ShadowRegBufAddrHi = cpu_to_le32(MSDW(ha->shadow_regs_dma));
-+
-+ /*
-+ * Set up required options
-+ */
-+ init_fw_cb->FwOptions |=
-+ __constant_cpu_to_le16(FWOPT_SESSION_MODE | FWOPT_INITIATOR_MODE);
-+ init_fw_cb->FwOptions &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);
-+
-+ /*
-+ * Save some info in adapter structure
-+ */
-+ ha->firmware_options = le16_to_cpu(init_fw_cb->FwOptions);
-+ ha->tcp_options = le16_to_cpu(init_fw_cb->TCPOptions);
-+ ha->heartbeat_interval = init_fw_cb->HeartbeatInterval;
-+ ha->isns_server_port_number =
-+ le16_to_cpu(init_fw_cb->iSNSServerPortNumber);
-+
-+ memcpy(ha->ip_address, init_fw_cb->IPAddr,
-+ MIN(sizeof(ha->ip_address), sizeof(init_fw_cb->IPAddr)));
-+ memcpy(ha->isns_ip_address, init_fw_cb->iSNSIPAddr,
-+ MIN(sizeof(ha->isns_ip_address), sizeof(init_fw_cb->iSNSIPAddr)));
-+ memcpy(ha->name_string, init_fw_cb->iSCSINameString,
-+ MIN(sizeof(ha->name_string), sizeof(init_fw_cb->iSCSINameString)));
-+ memcpy(ha->alias, init_fw_cb->Alias,
-+ MIN(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));
-+
-+ /* Save Command Line Paramater info */
-+ ha->port_down_retry_count = init_fw_cb->KeepAliveTimeout;
-+ ha->discovery_wait = ql4xdiscoverywait;
-+
-+ /*
-+ * Send Initialize Firmware Control Block
-+ */
-+ QL4PRINT(QLP7, printk("scsi%d: %s: init_fw cmd sent\n", ha->host_no,
-+ __func__));
-+
-+ mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
-+ mbox_cmd[1] = 0;
-+ mbox_cmd[2] = LSDW(init_fw_cb_dma);
-+ mbox_cmd[3] = MSDW(init_fw_cb_dma);
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0])
-+ == QLA_SUCCESS) {
-+ QL4PRINT(QLP7, printk("scsi%d: Init Fw Ctrl Blk\n",
-+ ha->host_no));
-+ qla4xxx_dump_bytes(QLP7, init_fw_cb, sizeof(INIT_FW_CTRL_BLK));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "IP Address %d.%d.%d.%d\n", ha->host_no,
-+ __func__, ha->ip_address[0], ha->ip_address[1],
-+ ha->ip_address[2], ha->ip_address[3]));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Subnet Mask %d.%d.%d.%d\n", ha->host_no,
-+ __func__, init_fw_cb->SubnetMask[0],
-+ init_fw_cb->SubnetMask[1], init_fw_cb->SubnetMask[2],
-+ init_fw_cb->SubnetMask[3]));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Default Gateway %d.%d.%d.%d\n", ha->host_no,
-+ __func__, init_fw_cb->GatewayIPAddr[0],
-+ init_fw_cb->GatewayIPAddr[1], init_fw_cb->GatewayIPAddr[2],
-+ init_fw_cb->GatewayIPAddr[3]));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Auto-Negotiate %s\n", ha->host_no, __func__,
-+ ((le16_to_cpu(init_fw_cb->AddFwOptions) & 0x10) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "SLP Use DA Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_SLP_USE_DA_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "SLP UA Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_SLP_UA_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "DHCP Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_DHCP_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "DNS via DHCP Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_GET_DNS_VIA_DHCP_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "SLP via DHCP Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_GET_SLP_VIA_DHCP_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Auto Discovery Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_AUTO_DISCOVERY_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7|QLP20, printk("scsi%d: %s: "
-+ "iSNS Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_ISNS_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ QL4PRINT(QLP7|QLP20, printk("scsi%d: %s: "
-+ "Learn iSNS IP Addr Enable %s\n", ha->host_no, __func__,
-+ ((ha->tcp_options & TOPT_LEARN_ISNS_IP_ADDR_ENABLE) != 0)
-+ ? "ON" : "OFF"));
-+ if (ha->tcp_options & TOPT_ISNS_ENABLE) {
-+ set_bit(ISNS_FLAG_ISNS_ENABLED_IN_ISP, &ha->isns_flags);
-+
-+ QL4PRINT(QLP7|QLP20, printk("scsi%d: %s: "
-+ "iSNS IP Address %d.%d.%d.%d\n",
-+ ha->host_no, __func__, ha->isns_ip_address[0],
-+ ha->isns_ip_address[1], ha->isns_ip_address[2],
-+ ha->isns_ip_address[3]));
-+ QL4PRINT(QLP7|QLP20, printk("scsi%d: %s: "
-+ "iSNS Server Port Number %d\n", ha->host_no,
-+ __func__, ha->isns_server_port_number));
-+ }
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Heartbeat Enable %s\n", ha->host_no, __func__,
-+ ((ha->firmware_options & FWOPT_HEARTBEAT_ENABLE) != 0) ?
-+ "ON" : "OFF"));
-+ if (ha->firmware_options & FWOPT_HEARTBEAT_ENABLE)
-+ QL4PRINT(QLP7, printk("scsi%d: %s: "
-+ "Heartbeat Interval %d\n", ha->host_no, __func__,
-+ ha->heartbeat_interval));
-+
-+ status = QLA_SUCCESS;
-+ } else {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: "
-+ "MBOX_CMD_INITIALIZE_FIRMWARE failed w/ status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ }
-+
-+ pci_free_consistent(ha->pdev, sizeof(INIT_FW_CTRL_BLK), init_fw_cb,
-+ init_fw_cb_dma);
-+
-+ LEAVE("qla4xxx_initialize_fw_cb");
-+
-+ return status;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_firmware_state
-+ * This routine retrieves the firmware state for the specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully retrieved firmware state
-+ * QLA_ERROR - Failed to retrieve firmware state
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_get_firmware_state(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER("qla4xxx_get_firmware_state");
-+
-+ /* Get firmware version */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_FW_STATE;
-+ if (qla4xxx_mailbox_command(ha, 1, 4, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_GET_FW_STATE failed w/ "
-+ "status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ return(QLA_ERROR);
-+ }
-+
-+ ha->firmware_state = mbox_sts[1];
-+ ha->board_id = mbox_sts[2];
-+ ha->addl_fw_state = mbox_sts[3];
-+ LEAVE("qla4xxx_get_firmware_state");
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_firmware_status
-+ * This routine retrieves the firmware status for the specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully retrieved firmware status
-+ * QLA_ERROR - Failed to retrieve firmware status
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_get_firmware_status(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER(__func__);
-+
-+ /* Get firmware version */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_FW_STATUS;
-+ if (qla4xxx_mailbox_command(ha, 1, 3, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_GET_FW_STATUS failed w/ "
-+ "status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ return(QLA_ERROR);
-+ }
-+
-+ /* High-water mark of IOCBs */
-+ ha->iocb_hiwat = mbox_sts[2];
-+ if (ha->iocb_hiwat > IOCB_HIWAT_CUSHION)
-+ ha->iocb_hiwat -= IOCB_HIWAT_CUSHION;
-+ else
-+ ql4_printk(KERN_INFO, ha, "WARNING!!! You have less "
-+ "than %d firmare IOCBs available (%d).\n",
-+ IOCB_HIWAT_CUSHION, ha->iocb_hiwat);
-+
-+ LEAVE(__func__);
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_fwddb_entry
-+ * This routine retrieves the firmware's device database entry.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ * fw_ddb_entry - Pointer to firmware's device database entry structure
-+ * num_valid_ddb_entries - Pointer to number of valid ddb entries
-+ * next_ddb_index - Pointer to next valid device database index
-+ * fw_ddb_device_state - Pointer to device state
-+ *
-+ * Output:
-+ * fw_ddb_entry - Fills in structure if pointer is supplied
-+ * num_valid_ddb_entries - Fills in if pointer is supplied
-+ * next_ddb_index - Fills in if pointer is supplied
-+ * fw_ddb_device_state - Fills in if pointer is supplied
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully retrieved ddb info from firmware
-+ * QLA_ERROR - Failed to retrieve ddb info from firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_get_fwddb_entry(scsi_qla_host_t *ha,
-+ uint16_t fw_ddb_index,
-+ DEV_DB_ENTRY *fw_ddb_entry,
-+ dma_addr_t fw_ddb_entry_dma,
-+ uint32_t *num_valid_ddb_entries,
-+ uint32_t *next_ddb_index,
-+ uint32_t *fw_ddb_device_state,
-+ uint32_t *time2wait,
-+ uint16_t *tcp_source_port_num,
-+ uint16_t *connection_id)
-+{
-+ uint8_t status = QLA_ERROR;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER(__func__);
-+
-+ /* Make sure the device index is valid */
-+ if (fw_ddb_index >= MAX_DDB_ENTRIES) {
-+ DEBUG2( printk("scsi%d: %s: index [%d] out of range.\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+ goto exit_get_fwddb;
-+ }
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY;
-+ mbox_cmd[1] = (uint32_t) fw_ddb_index;
-+ mbox_cmd[2] = LSDW(fw_ddb_entry_dma);
-+ mbox_cmd[3] = MSDW(fw_ddb_entry_dma);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 7, &mbox_cmd[0], &mbox_sts[0])
-+ == QLA_ERROR) {
-+ DEBUG2(printk("scsi%d: %s: MBOX_CMD_GET_DATABASE_ENTRY failed "
-+ "with status 0x%04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ goto exit_get_fwddb;
-+ }
-+
-+ if (fw_ddb_index != mbox_sts[1]) {
-+ DEBUG2(printk("scsi%d: %s: index mismatch [%d] != [%d].\n",
-+ ha->host_no, __func__, fw_ddb_index,
-+ mbox_sts[1]));
-+ goto exit_get_fwddb;
-+ }
-+
-+ if (fw_ddb_entry) {
-+ ql4_printk(KERN_INFO, ha,
-+ "DDB[%d] MB0 %04x Tot %d Next %d "
-+ "State %04x %d.%d.%d.%d:%04d \"%s\"\n",
-+ fw_ddb_index,
-+ mbox_sts[0], mbox_sts[2], mbox_sts[3], mbox_sts[4],
-+ fw_ddb_entry->ipAddr[0],
-+ fw_ddb_entry->ipAddr[1],
-+ fw_ddb_entry->ipAddr[2],
-+ fw_ddb_entry->ipAddr[3],
-+ le16_to_cpu(fw_ddb_entry->portNumber),
-+ fw_ddb_entry->iscsiName);
-+ }
-+
-+ if (num_valid_ddb_entries)
-+ *num_valid_ddb_entries = mbox_sts[2];
-+
-+ if (next_ddb_index)
-+ *next_ddb_index = mbox_sts[3];
-+
-+ if (fw_ddb_device_state)
-+ *fw_ddb_device_state = mbox_sts[4];
-+
-+ if (time2wait)
-+ *time2wait = mbox_sts[5];
-+
-+ if (tcp_source_port_num)
-+ *tcp_source_port_num = (uint16_t) mbox_sts[6] >> 16;
-+
-+ if (connection_id)
-+ *connection_id = (uint16_t) mbox_sts[6] & 0x00FF;
-+
-+ status = QLA_SUCCESS;
-+
-+ exit_get_fwddb:
-+
-+ LEAVE(__func__);
-+ return(status);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_set_fwddb_entry
-+ * This routine initializes or updates the adapter's device database
-+ * entry for the specified device.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * fw_ddb_index - Firmware's device database index
-+ * fw_ddb_entry - Pointer to firmware's device database entry
-+ * structure, or NULL.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * This routine also triggers a login for the specified device.
-+ * Therefore, it may also be used as a secondary login routine when
-+ * a NULL pointer is specified for the fw_ddb_entry.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully set ddb_entry in firmware
-+ * QLA_ERROR - Failed to set ddb_entry in firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_set_ddb_entry(scsi_qla_host_t *ha,
-+ uint16_t fw_ddb_index,
-+ DEV_DB_ENTRY *fw_ddb_entry,
-+ dma_addr_t fw_ddb_entry_dma)
-+{
-+ uint8_t status = QLA_ERROR;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER("qla4xxx_set_fwddb_entry");
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: index [%d]\n",
-+ ha->host_no, __func__, fw_ddb_index));
-+
-+ /* Do not wait for completion. The firmware will send us an
-+ * ASTS_DATABASE_CHANGED (0x8014) to notify us of the login status.
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_SET_DATABASE_ENTRY;
-+ mbox_cmd[1] = (uint32_t) fw_ddb_index;
-+ mbox_cmd[2] = LSDW(fw_ddb_entry_dma);
-+ mbox_cmd[3] = MSDW(fw_ddb_entry_dma);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 0, &mbox_cmd[0], &mbox_sts[0]) != QLA_SUCCESS) {
-+ status = QLA_ERROR;
-+ }
-+ else {
-+ status = QLA_SUCCESS;
-+ }
-+
-+ LEAVE("qla4xxx_set_fwddb_entry");
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_crash_record
-+ * This routine retrieves a crash record from the QLA4010 after an
-+ * 8002h aen.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_get_crash_record(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ CRASH_RECORD *crash_record = NULL;
-+ dma_addr_t crash_record_dma = 0;
-+ uint32_t crash_record_size = 0;
-+
-+ ENTER("qla4xxx_get_crash_record");
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_cmd));
-+
-+ /*
-+ * Get size of crash record
-+ */
-+ mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD;
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: ERROR: Unable to retrieve size!\n",
-+ ha->host_no, __func__));
-+ goto exit_get_crash_record;
-+ }
-+
-+ crash_record_size = mbox_sts[4];
-+ if (crash_record_size == 0) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: ERROR: Crash record size is 0!\n",
-+ ha->host_no, __func__));
-+ goto exit_get_crash_record;
-+ }
-+
-+ /*
-+ * Alloc Memory for Crash Record
-+ */
-+ crash_record = (CRASH_RECORD *) pci_alloc_consistent(ha->pdev,
-+ crash_record_size,
-+ &crash_record_dma);
-+
-+ if (crash_record == NULL){
-+ QL4PRINT(QLP2, printk("scsi%d: %s: ERROR: Unable to allocate "
-+ " memory (%d bytes) for crash record!\n",
-+ ha->host_no, __func__, crash_record_size));
-+ goto exit_get_crash_record;
-+ }
-+
-+ /*
-+ * Get Crash Record
-+ */
-+ mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD;
-+ mbox_cmd[2] = LSDW(crash_record_dma);
-+ mbox_cmd[3] = MSDW(crash_record_dma);
-+ mbox_cmd[4] = crash_record_size;
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: ERROR: Unable to retrieve crash"
-+ " record!\n", ha->host_no, __func__));
-+ goto exit_get_crash_record;
-+ }
-+
-+ /*
-+ * Dump Crash Record
-+ */
-+ QL4PRINT(QLP1, printk(KERN_INFO "scsi%d: Crash Record Dump:\n",
-+ ha->host_no));
-+ QL4PRINT( QLP1,
-+ printk(KERN_INFO "Firmware Version: %02d.%02d.%02d.%02d\n",
-+ crash_record->fw_major_version,
-+ crash_record->fw_minor_version,
-+ crash_record->fw_patch_version,
-+ crash_record->fw_build_version));
-+ QL4PRINT(QLP1, printk(KERN_INFO "Build Date: %s\n",
-+ crash_record->build_date));
-+ QL4PRINT(QLP1, printk(KERN_INFO "Build Time: %s\n",
-+ crash_record->build_time));
-+ QL4PRINT(QLP1, printk(KERN_INFO "Build User: %s\n",
-+ crash_record->build_user));
-+ QL4PRINT(QLP1, printk(KERN_INFO "Card Serial #: %s\n",
-+ crash_record->card_serial_num));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "Time of Crash (in seconds): %d (0x%x)\n",
-+ crash_record->time_of_crash_in_secs,
-+ crash_record->time_of_crash_in_secs));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "Time of Crash (in milliseconds): "
-+ "%d (0x%x)\n",
-+ crash_record->time_of_crash_in_ms,
-+ crash_record->time_of_crash_in_ms));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "# frames in OUT RISC processor stack dump: "
-+ "%d (0x%x)\n",
-+ crash_record->out_RISC_sd_num_frames,
-+ crash_record->out_RISC_sd_num_frames));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "# words in OAP stack dump: %d (0x%x)\n",
-+ crash_record->OAP_sd_num_words,
-+ crash_record->OAP_sd_num_words));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "# frames in IAP stack dump: %d (0x%x)\n",
-+ crash_record->IAP_sd_num_frames,
-+ crash_record->IAP_sd_num_frames));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "# words in IN RISC processor stack dump: "
-+ "%d (0x%x)\n",
-+ crash_record->in_RISC_sd_num_words,
-+ crash_record->in_RISC_sd_num_words));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "\nOUT RISC processor register dump:\n"));
-+ qla4xxx_dump_dwords(QLP1, &crash_record->out_RISC_reg_dump,
-+ sizeof(crash_record->out_RISC_reg_dump));
-+ QL4PRINT(QLP1,
-+ printk(KERN_INFO "\nIN RISC processor register dump:\n"));
-+ qla4xxx_dump_dwords(QLP1, &crash_record->in_RISC_reg_dump,
-+ sizeof(crash_record->in_RISC_reg_dump));
-+ QL4PRINT(QLP1, printk(KERN_INFO "\nOUT RISC processor stack dump:\n"));
-+ qla4xxx_dump_dwords(QLP1, &crash_record->in_out_RISC_stack_dump,
-+ crash_record->OAP_sd_num_words);
-+ QL4PRINT(QLP1, printk(KERN_INFO "\nIN RISC processor stack dump:\n"));
-+ qla4xxx_dump_dwords(QLP1, &crash_record->in_out_RISC_stack_dump[0] +
-+ crash_record->OAP_sd_num_words,
-+ crash_record->in_RISC_sd_num_words);
-+
-+
-+ exit_get_crash_record:
-+ if (crash_record)
-+ pci_free_consistent(ha->pdev,
-+ crash_record_size,
-+ crash_record,
-+ crash_record_dma);
-+ LEAVE("qla4xxx_get_crash_record");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_reset_lun
-+ * This routine performs a LUN RESET on the specified target/lun.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ * lun_entry - Pointer to lun entry structure
-+ *
-+ * Remarks:
-+ * The caller must ensure that the ddb_entry and lun_entry pointers
-+ * are valid before calling this routine.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - lun reset completed successfully
-+ * QLA_ERROR - lun reset failed
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_reset_lun(scsi_qla_host_t *ha,
-+ ddb_entry_t *ddb_entry,
-+ fc_lun_t *lun_entry)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ uint8_t target = ddb_entry->target;
-+ uint8_t lun = lun_entry->lun;
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_reset_lun");
-+
-+ //spin_unlock_irq(ha->host->host_lock);
-+
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d:%d:%d:%d: lun reset issued\n", ha->host_no, ddb_entry->bus,
-+ target, lun));
-+
-+ /*
-+ * Send lun reset command to ISP, so that the ISP will return all
-+ * outstanding requests with RESET status
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_LUN_RESET;
-+ mbox_cmd[1] = ddb_entry->fw_ddb_index;
-+ mbox_cmd[2] = lun << 8;
-+ mbox_cmd[5] = 0x01; /* Immediate Command Enable */
-+
-+ qla4xxx_mailbox_command(ha, 6, 1, &mbox_cmd[0], &mbox_sts[0]);
-+ if ((mbox_sts[0] == MBOX_STS_COMMAND_COMPLETE) ||
-+ (mbox_sts[0] == MBOX_STS_COMMAND_ERROR)) {
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d:%d:%d:%d: lun reset SUCCEEDED\n", ha->host_no,
-+ ddb_entry->bus, target, lun));
-+ } else {
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d:%d:%d:%d: lun reset FAILED w/ status %04x\n",
-+ ha->host_no, ddb_entry->bus, target, lun, mbox_sts[0]));
-+
-+ status = QLA_ERROR;
-+ }
-+
-+ //spin_lock_irq(ha->host->host_lock);
-+
-+ LEAVE("qla4xxx_reset_lun");
-+
-+ return (status);
-+}
-+
-+uint8_t
-+qla4xxx_isns_enable(scsi_qla_host_t *ha,
-+ uint32_t isns_ip_addr,
-+ uint16_t isns_server_port_num)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: isns_ip_addr %08x\n",
-+ ha->host_no, __func__, isns_ip_addr));
-+
-+ qla4xxx_isns_build_entity_id(ha);
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_SET_ISNS_SERVICE;
-+ mbox_cmd[1] = ISNS_ENABLE;
-+ mbox_cmd[2] = isns_ip_addr;
-+ mbox_cmd[3] = isns_server_port_num;
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 6, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_SET_ISNS_SERVICE failed "
-+ "w/ status %04X %04X\n",
-+ ha->host_no, __func__, mbox_sts[0], mbox_sts[1]));
-+ return(QLA_ERROR);
-+ }
-+
-+ QL4PRINT(QLP7|QLP20, printk(KERN_INFO "scsi%d: Start iSNS Service "
-+ "%d.%d.%d.%d Port %04d . . .\n", ha->host_no,
-+ (isns_ip_addr & 0x000000FF),
-+ (isns_ip_addr & 0x0000FF00) >> 8,
-+ (isns_ip_addr & 0x00FF0000) >> 16,
-+ (isns_ip_addr & 0xFF000000) >> 24,
-+ isns_server_port_num));
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_disable(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ if (test_bit(ISNS_FLAG_ISNS_SRV_ENABLED, &ha->isns_flags)) {
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_SET_ISNS_SERVICE;
-+ mbox_cmd[1] = ISNS_DISABLE;
-+
-+ if (qla4xxx_mailbox_command(ha, 2, 2, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_SET_ISNS_SERVICE failed "
-+ "w/ status %04X %04X\n",
-+ ha->host_no, __func__, mbox_sts[0], mbox_sts[1]));
-+ return(QLA_ERROR);
-+ }
-+ }
-+
-+ clear_bit(ISNS_FLAG_ISNS_SRV_ENABLED, &ha->isns_flags);
-+ ISNS_CLEAR_FLAGS(ha);
-+
-+ ha->isns_connection_id = 0;
-+ //ha->isns_scn_conn_id = 0;
-+ //ha->isns_esi_conn_id = 0;
-+ //ha->isns_nsh_conn_id = 0;
-+
-+ ha->isns_remote_port_num = 0;
-+ ha->isns_scn_port_num = 0;
-+ ha->isns_esi_port_num = 0;
-+ ha->isns_nsh_port_num = 0;
-+
-+ ha->isns_num_discovered_targets = 0;
-+ memset(ha->isns_entity_id, 0, sizeof(ha->isns_entity_id));
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_isns_status(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_SET_ISNS_SERVICE;
-+ mbox_cmd[1] = ISNS_STATUS;
-+
-+ if (qla4xxx_mailbox_command(ha, 2, 2, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_SET_ISNS_SERVICE failed "
-+ "w/ status %04X %04X\n",
-+ ha->host_no, __func__, mbox_sts[0], mbox_sts[1]));
-+ return(QLA_ERROR);
-+ }
-+
-+ QL4PRINT(QLP20, printk("scsi%d: %s: = %s\n",
-+ ha->host_no, __func__,
-+ ((mbox_sts[1] & 1) == 0) ? "DISABLED" : "ENABLED"));
-+ return(QLA_SUCCESS);
-+}
-+
-+uint8_t
-+qla4xxx_get_flash(scsi_qla_host_t *ha, dma_addr_t dma_addr, uint32_t offset, uint32_t len)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(dma_addr);
-+ mbox_cmd[2] = MSDW(dma_addr);
-+ mbox_cmd[3] = offset;
-+ mbox_cmd[4] = len;
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: MBOX_CMD_READ_FLASH, failed w/ "
-+ "status %04X %04X, offset %08x, len %08x\n",
-+ ha->host_no, __func__, mbox_sts[0], mbox_sts[1],
-+ offset, len));
-+ return(QLA_ERROR);
-+ }
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_fw_version
-+ * This routine retrieves the firmware version for the specified adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * In QLA4010, mailboxes 2 & 3 may hold an address for data. Make sure
-+ * that we write 0 to those mailboxes, if unused.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully retrieved firmware version
-+ * QLA_ERROR - Failed to retrieve firmware version
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_get_fw_version(scsi_qla_host_t *ha)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ /*
-+ * Get firmware version
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_ABOUT_FW;
-+ if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0])
-+ != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: MBOX_CMD_ABOUT_FW failed w/ "
-+ "status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ return(QLA_ERROR);
-+ }
-+
-+ /*
-+ * Save firmware version information
-+ */
-+ ha->firmware_version[0] = mbox_sts[1];
-+ ha->firmware_version[1] = mbox_sts[2];
-+ ha->patch_number = mbox_sts[3];
-+ ha->build_number = mbox_sts[4];
-+
-+ QL4PRINT(QLP7, printk("scsi%d: FW Version %02d.%02d Patch %02d Build %02d\n",
-+ ha->host_no, ha->firmware_version[0], ha->firmware_version[1],
-+ ha->patch_number, ha->build_number));
-+
-+ return(QLA_SUCCESS);
-+}
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_nvram.c ./drivers/scsi/qla4xxx/ql4_nvram.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_nvram.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_nvram.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,321 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic qla4xxx driver for Linux 2.6.x
-+ * Copyright (C) 2004 Qlogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * FM93C56A_Select
-+ * FM93C56A_Cmd
-+ * FM93C56A_Deselect
-+ * FM93C56A_DataIn
-+ * EEPROM_ReadWord
-+ * RD_NVRAM_WORD
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#define EEPROM_SIZE(ha) \
-+ (IS_QLA4022(ha) ? \
-+ FM93C86A_SIZE_16 : \
-+ FM93C66A_SIZE_16)
-+
-+#define EEPROM_NO_ADDR_BITS(ha) \
-+ (IS_QLA4022(ha) ? \
-+ FM93C86A_NO_ADDR_BITS_16 : \
-+ FM93C56A_NO_ADDR_BITS_16)
-+
-+#define EEPROM_NO_DATA_BITS(ha) FM93C56A_DATA_BITS_16
-+
-+int eepromCmdData = 0;
-+
-+
-+static int FM93C56A_Select(scsi_qla_host_t *ha)
-+{
-+ QL4PRINT(QLP17, printk(KERN_ERR "FM93C56A_Select:\n"));
-+ eepromCmdData = AUBURN_EEPROM_CS_1 | 0x000f0000;
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+ return(1);
-+}
-+
-+static int FM93C56A_Cmd(scsi_qla_host_t *ha, int cmd, int addr)
-+{
-+ int i;
-+ int mask;
-+ int dataBit;
-+ int previousBit;
-+
-+ QL4PRINT(QLP17, printk(KERN_ERR "FM93C56A_Cmd(%d, 0x%x)\n", cmd, addr));
-+
-+ // Clock in a zero, then do the start bit
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | AUBURN_EEPROM_DO_1);
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | AUBURN_EEPROM_DO_1 | AUBURN_EEPROM_CLK_RISE);
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | AUBURN_EEPROM_DO_1 | AUBURN_EEPROM_CLK_FALL);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+
-+ mask = 1 << (FM93C56A_CMD_BITS-1);
-+ // Force the previous data bit to be different
-+ previousBit = 0xffff;
-+ for (i = 0; i < FM93C56A_CMD_BITS; i++) {
-+ dataBit = (cmd & mask) ? AUBURN_EEPROM_DO_1 : AUBURN_EEPROM_DO_0;
-+ if (previousBit != dataBit) {
-+ // If the bit changed, then change the DO state to match
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit);
-+ previousBit = dataBit;
-+ }
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit | AUBURN_EEPROM_CLK_RISE);
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit | AUBURN_EEPROM_CLK_FALL);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+ cmd = cmd << 1;
-+ }
-+
-+ mask = 1 << (EEPROM_NO_ADDR_BITS(ha)-1);
-+ // Force the previous data bit to be different
-+ previousBit = 0xffff;
-+ for (i = 0; i < EEPROM_NO_ADDR_BITS(ha); i++) {
-+ dataBit = (addr & mask) ? AUBURN_EEPROM_DO_1 : AUBURN_EEPROM_DO_0;
-+ if (previousBit != dataBit) {
-+ // If the bit changed, then change the DO state to match
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit);
-+ previousBit = dataBit;
-+ }
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit | AUBURN_EEPROM_CLK_RISE);
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | dataBit | AUBURN_EEPROM_CLK_FALL);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+ addr = addr << 1;
-+ }
-+ return(1);
-+}
-+
-+static int FM93C56A_Deselect(scsi_qla_host_t *ha)
-+{
-+ QL4PRINT(QLP17, printk(KERN_ERR "FM93C56A_Deselect:\n"));
-+ eepromCmdData = AUBURN_EEPROM_CS_0 | 0x000f0000 ;
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+ return(1);
-+}
-+
-+static int FM93C56A_DataIn(scsi_qla_host_t *ha, unsigned short *value)
-+{
-+ int i;
-+ int data = 0;
-+ int dataBit;
-+
-+ // Read the data bits
-+ // The first bit is a dummy. Clock right over it.
-+ for (i = 0; i < EEPROM_NO_DATA_BITS(ha); i++) {
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | AUBURN_EEPROM_CLK_RISE);
-+ WRT_REG_DWORD(ISP_NVRAM(ha), eepromCmdData | AUBURN_EEPROM_CLK_FALL);
-+ dataBit = (RD_REG_DWORD(ISP_NVRAM(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;
-+ data = (data << 1) | dataBit;
-+ }
-+ *value = data;
-+ QL4PRINT(QLP17, printk(KERN_ERR "FM93C56A_DataIn(0x%x)\n", *value));
-+ return(1);
-+}
-+
-+static int
-+EEPROM_ReadWord(int eepromAddr, u16 *value, scsi_qla_host_t *ha)
-+{
-+ QL4PRINT(QLP17, printk(KERN_ERR "EEPROM_Reg addr %p\n", ISP_NVRAM(ha)));
-+ QL4PRINT(QLP17, printk(KERN_ERR "EEPROM_ReadWord(0x%x)\n", eepromAddr));
-+
-+ FM93C56A_Select(ha);
-+ FM93C56A_Cmd(ha, FM93C56A_READ, eepromAddr);
-+ FM93C56A_DataIn(ha, value);
-+ FM93C56A_Deselect(ha);
-+ QL4PRINT(QLP17, printk(KERN_ERR "EEPROM_ReadWord(0x%x, %d)\n",
-+ eepromAddr, *value));
-+ return(1);
-+}
-+
-+/* Hardware_lock must be set before calling */
-+u16
-+RD_NVRAM_WORD(scsi_qla_host_t *ha, int offset)
-+{
-+ u16 val;
-+ /* NOTE: NVRAM uses half-word addresses */
-+ EEPROM_ReadWord(offset, &val, ha);
-+ return(val);
-+}
-+
-+uint8_t
-+qla4xxx_is_NVRAM_configuration_valid(scsi_qla_host_t *ha)
-+{
-+ uint16_t checksum = 0;
-+ uint32_t index;
-+ unsigned long flags;
-+ uint8_t status = QLA_ERROR;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ for (index = 0; index < EEPROM_SIZE(ha); index++) {
-+ checksum += RD_NVRAM_WORD(ha, index);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if (checksum == 0)
-+ status = QLA_SUCCESS;
-+
-+ return (status);
-+}
-+
-+/*************************************************************************
-+ *
-+ * Hardware Semaphore
-+ *
-+ *************************************************************************/
-+
-+isp4xxxSemInfo_t semInfo4010[] = {
-+ { SEM_HW_LOCK, 4}
-+ , { SEM_GPO, 6}
-+ , { SEM_SDRAM_INIT, 8}
-+ , { SEM_PHY_GBIC, 10}
-+ , { SEM_NVRAM, 12}
-+ , { SEM_FLASH, 14}
-+};
-+
-+isp4xxxSemInfo_t semInfo4022[] = {
-+ { SEM_HW_LOCK, 1}
-+ , { SEM_GPO, 7}
-+ , { SEM_SDRAM_INIT, 4}
-+ , { SEM_PHY_GBIC, 7}
-+ , { SEM_NVRAM, 10}
-+ , { SEM_FLASH, 13}
-+};
-+
-+static uint32_t SEM_READ(scsi_qla_host_t *ha, uint32_t semId)
-+{
-+ if (IS_QLA4022(ha))
-+ return ((RD_REG_DWORD(ISP_NVRAM(ha)) >> semInfo4022[semId].semShift) & SEM_MASK);
-+ else
-+ return ((RD_REG_DWORD(ISP_NVRAM(ha)) >> semInfo4010[semId].semShift) & SEM_MASK);
-+
-+}
-+
-+
-+static void SEM_WRITE(scsi_qla_host_t *ha, uint32_t semId, uint8_t owner)
-+{
-+ if (IS_QLA4022(ha))
-+ WRT_REG_DWORD(ISP_NVRAM(ha), (SEM_MASK << 16 << semInfo4022[semId].semShift) | (owner << semInfo4022[semId].semShift));
-+ else
-+ WRT_REG_DWORD(ISP_NVRAM(ha), (SEM_MASK << 16 << semInfo4010[semId].semShift) | (owner << semInfo4010[semId].semShift));
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_take_hw_semaphore
-+ * This routine acquires the specified semaphore for the iSCSI
-+ * storage driver.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * sem - Indicates which semaphore.
-+ * wait_flag - specifies type of wait to acquire semaphore
-+ * SEM_FLG_WAIT_FOREVER = wait indefinitely
-+ * SEM_FLG_TIMED_WAIT = wait for a specified amout of time
-+ * SEM_FLG_NO_WAIT = try once to acquire semaphore
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully acquired semaphore
-+ * QLA_ERROR - Failed to acquire semaphore
-+ *
-+ * Context:
-+ * ?? context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_take_hw_semaphore(scsi_qla_host_t *ha, uint32_t sem, uint8_t wait_flag)
-+{
-+ uint32_t wait_time = SEMAPHORE_TOV;
-+ unsigned long flags = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ for (SEM_WRITE(ha, sem, SEM_OWNER_STORAGE);
-+ (SEM_READ(ha, sem) != SEM_OWNER_STORAGE) && (wait_time--);
-+ (SEM_WRITE(ha, sem, SEM_OWNER_STORAGE), PCI_POSTING(ISP_NVRAM(ha)))) {
-+ if (wait_flag == SEM_FLG_NO_WAIT) {
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ return(QLA_ERROR);
-+ }
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ }
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if (wait_time)
-+ return(QLA_SUCCESS);
-+ else
-+ return(QLA_ERROR);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_clear_hw_semaphore
-+ * This routine restores the specified semaphore to the available
-+ * state.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * sem - Indicates which semaphore.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully restored semaphore
-+ * QLA_ERROR - Failed to restore semaphore
-+ *
-+ * Context:
-+ * ?? context.
-+ **************************************************************************/
-+void
-+qla4xxx_clear_hw_semaphore(scsi_qla_host_t *ha, uint32_t sem)
-+{
-+ unsigned long flags = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ if (SEM_READ(ha, sem) == SEM_OWNER_STORAGE) {
-+ SEM_WRITE(ha, sem, SEM_AVAILABLE);
-+ PCI_POSTING(ISP_NVRAM(ha));
-+ }
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+
-+
-+/*
-+ * Overrides for Emacs so that we get a uniform tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 4
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -4
-+ * c-argdecl-indent: 4
-+ * c-label-offset: -4
-+ * c-continued-statement-offset: 4
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_nvram.h ./drivers/scsi/qla4xxx/ql4_nvram.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_nvram.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_nvram.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,367 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+/*
-+ * Module Name: ql4nvrm.h
-+ */
-+
-+
-+#ifndef _QL2XNVRM_H_
-+#define _QL2XNVRM_H_
-+
-+
-+//
-+// AM29LV Flash definitions
-+//
-+#define FM93C56A_SIZE_8 0x100
-+#define FM93C56A_SIZE_16 0x80
-+#define FM93C66A_SIZE_8 0x200
-+#define FM93C66A_SIZE_16 0x100 /* 4010 */
-+#define FM93C86A_SIZE_16 0x400 /* 4022 */
-+
-+#define FM93C56A_START 0x1
-+
-+// Commands
-+#define FM93C56A_READ 0x2
-+#define FM93C56A_WEN 0x0
-+#define FM93C56A_WRITE 0x1
-+#define FM93C56A_WRITE_ALL 0x0
-+#define FM93C56A_WDS 0x0
-+#define FM93C56A_ERASE 0x3
-+#define FM93C56A_ERASE_ALL 0x0
-+
-+// Command Extentions
-+#define FM93C56A_WEN_EXT 0x3
-+#define FM93C56A_WRITE_ALL_EXT 0x1
-+#define FM93C56A_WDS_EXT 0x0
-+#define FM93C56A_ERASE_ALL_EXT 0x2
-+
-+// Address Bits
-+#define FM93C56A_NO_ADDR_BITS_16 8 /* 4010 */
-+#define FM93C56A_NO_ADDR_BITS_8 9 /* 4010 */
-+#define FM93C86A_NO_ADDR_BITS_16 10 /* 4022 */
-+
-+
-+// Data Bits
-+#define FM93C56A_DATA_BITS_16 16
-+#define FM93C56A_DATA_BITS_8 8
-+
-+// Special Bits
-+#define FM93C56A_READ_DUMMY_BITS 1
-+#define FM93C56A_READY 0
-+#define FM93C56A_BUSY 1
-+#define FM93C56A_CMD_BITS 2
-+
-+// Auburn Bits
-+#define AUBURN_EEPROM_DI 0x8
-+#define AUBURN_EEPROM_DI_0 0x0
-+#define AUBURN_EEPROM_DI_1 0x8
-+#define AUBURN_EEPROM_DO 0x4
-+#define AUBURN_EEPROM_DO_0 0x0
-+#define AUBURN_EEPROM_DO_1 0x4
-+#define AUBURN_EEPROM_CS 0x2
-+#define AUBURN_EEPROM_CS_0 0x0
-+#define AUBURN_EEPROM_CS_1 0x2
-+#define AUBURN_EEPROM_CLK_RISE 0x1
-+#define AUBURN_EEPROM_CLK_FALL 0x0
-+
-+
-+//
-+// EEPROM format
-+//
-+typedef struct _BIOS_PARAMS
-+{
-+ UINT16 SpinUpDelay :1;
-+ UINT16 BIOSDisable :1;
-+ UINT16 MMAPEnable :1;
-+ UINT16 BootEnable :1;
-+ UINT16 Reserved0 :12;
-+
-+ UINT8 bootID0 :7;
-+ UINT8 bootID0Valid :1;
-+
-+ UINT8 bootLUN0[8];
-+
-+ UINT8 bootID1 :7;
-+ UINT8 bootID1Valid :1;
-+
-+ UINT8 bootLUN1[8];
-+
-+ UINT16 MaxLunsPerTarget;
-+ UINT8 Reserved1[10];
-+} BIOS_PARAMS, *PBIOS_PARAMS;
-+
-+typedef struct _EEPROM_PORT_CFG
-+{
-+ // MTU MAC 0
-+ u16 etherMtu_mac;
-+
-+ // Flow Control MAC 0
-+ u16 pauseThreshold_mac;
-+ u16 resumeThreshold_mac;
-+ u16 reserved[13];
-+} EEPROM_PORT_CFG, *PEEPROM_PORT_CFG;
-+
-+typedef struct _EEPROM_FUNCTION_CFG
-+{
-+ u8 reserved[30];
-+
-+ // MAC ADDR
-+ u8 macAddress[6];
-+ u8 macAddressSecondary[6];
-+
-+ u16 subsysVendorId;
-+ u16 subsysDeviceId;
-+} EEPROM_FUNCTION_CFG;
-+
-+typedef struct {
-+ union {
-+ struct { /* isp4010 */
-+ u8 asic_id[4]; // x00
-+ u8 version; // x04
-+ u8 reserved; // x05
-+
-+ u16 board_id; // x06
-+ # define EEPROM_BOARDID_ELDORADO 1
-+ # define EEPROM_BOARDID_PLACER 2
-+
-+ # define EEPROM_SERIAL_NUM_SIZE 16
-+ u8 serial_number[EEPROM_SERIAL_NUM_SIZE]; // x08
-+
-+ // ExtHwConfig:
-+ // Offset = 24bytes
-+ //
-+ // | SSRAM Size| |ST|PD|SDRAM SZ| W| B| SP | |
-+ // |15|14|13|12|11|10| 9| 8 | 7| 6| 5| 4| 3| 2| 1| 0|
-+ // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-+ u16 ext_hw_conf; // x18
-+
-+ u8 mac0[6]; // x1A
-+ u8 mac1[6]; // x20
-+ u8 mac2[6]; // x26
-+ u8 mac3[6]; // x2C
-+
-+ u16 etherMtu; // x32
-+ u16 macConfig; // x34
-+ #define MAC_CONFIG_ENABLE_ANEG 0x0001
-+ #define MAC_CONFIG_ENABLE_PAUSE 0x0002
-+
-+ u16 phyConfig; // x36
-+ #define PHY_CONFIG_PHY_ADDR_MASK 0x1f
-+ #define PHY_CONFIG_ENABLE_FW_MANAGEMENT_MASK 0x20
-+
-+ u16 topcat; // x38
-+ #define TOPCAT_PRESENT 0x0100
-+ #define TOPCAT_MASK 0xFF00
-+
-+ # define EEPROM_UNUSED_1_SIZE 2
-+ u8 unused_1[EEPROM_UNUSED_1_SIZE]; // x3A
-+
-+ u16 bufletSize; // x3C
-+ u16 bufletCount; // x3E
-+ u16 bufletPauseThreshold; // x40
-+ u16 tcpWindowThreshold50; // x42
-+ u16 tcpWindowThreshold25; // x44
-+ u16 tcpWindowThreshold0; // x46
-+ u16 ipHashTableBaseHi; // x48
-+ u16 ipHashTableBaseLo; // x4A
-+ u16 ipHashTableSize; // x4C
-+ u16 tcpHashTableBaseHi; // x4E
-+ u16 tcpHashTableBaseLo; // x50
-+ u16 tcpHashTableSize; // x52
-+ u16 ncbTableBaseHi; // x54
-+ u16 ncbTableBaseLo; // x56
-+ u16 ncbTableSize; // x58
-+ u16 drbTableBaseHi; // x5A
-+ u16 drbTableBaseLo; // x5C
-+ u16 drbTableSize; // x5E
-+
-+ # define EEPROM_UNUSED_2_SIZE 4
-+ u8 unused_2[EEPROM_UNUSED_2_SIZE]; // x60
-+
-+ u16 ipReassemblyTimeout; // x64
-+ u16 tcpMaxWindowSizeHi; // x66
-+ u16 tcpMaxWindowSizeLo; // x68
-+
-+ u32 net_ip_addr0 ; // x6A /* Added for TOE functionality. */
-+ u32 net_ip_addr1 ; // x6E
-+ u32 scsi_ip_addr0 ; // x72
-+ u32 scsi_ip_addr1 ; // x76
-+ # define EEPROM_UNUSED_3_SIZE 128 /* changed from 144 to account for ip addresses */
-+ u8 unused_3[EEPROM_UNUSED_3_SIZE]; // x7A
-+
-+ u16 subsysVendorId_f0; // xFA
-+ u16 subsysDeviceId_f0; // xFC
-+
-+ // Address = 0x7F
-+ # define FM93C56A_SIGNATURE 0x9356
-+ # define FM93C66A_SIGNATURE 0x9366
-+ u16 signature; // xFE
-+
-+ # define EEPROM_UNUSED_4_SIZE 250
-+ u8 unused_4[EEPROM_UNUSED_4_SIZE]; // x100
-+
-+ u16 subsysVendorId_f1; // x1FA
-+ u16 subsysDeviceId_f1; // x1FC
-+
-+ u16 checksum; // x1FE
-+ } __attribute__((packed)) isp4010;
-+
-+ struct { /* isp4022 */
-+ u8 asicId[4]; // x00
-+ u8 version; // x04
-+ u8 reserved_5; // x05
-+
-+ u16 boardId; // x06
-+ u8 boardIdStr[16]; // x08
-+ u8 serialNumber[16]; // x18
-+
-+ // External Hardware Configuration
-+ u16 ext_hw_conf; // x28
-+
-+ // MAC 0 CONFIGURATION
-+ EEPROM_PORT_CFG macCfg_port0; // x2A
-+
-+ // MAC 1 CONFIGURATION
-+ EEPROM_PORT_CFG macCfg_port1; // x4A
-+
-+ // DDR SDRAM Configuration
-+ u16 bufletSize; // x6A
-+ u16 bufletCount; // x6C
-+ u16 tcpWindowThreshold50; // x6E
-+ u16 tcpWindowThreshold25; // x70
-+ u16 tcpWindowThreshold0; // x72
-+ u16 ipHashTableBaseHi; // x74
-+ u16 ipHashTableBaseLo; // x76
-+ u16 ipHashTableSize; // x78
-+ u16 tcpHashTableBaseHi; // x7A
-+ u16 tcpHashTableBaseLo; // x7C
-+ u16 tcpHashTableSize; // x7E
-+ u16 ncbTableBaseHi; // x80
-+ u16 ncbTableBaseLo; // x82
-+ u16 ncbTableSize; // x84
-+ u16 drbTableBaseHi; // x86
-+ u16 drbTableBaseLo; // x88
-+ u16 drbTableSize; // x8A
-+ u16 reserved_142[4]; // x8C
-+
-+ // TCP/IP Parameters
-+ u16 ipReassemblyTimeout; // x94
-+ u16 tcpMaxWindowSize; // x96
-+ u16 ipSecurity; // x98
-+
-+ u8 reserved_156[294]; // x9A
-+ u16 qDebug[8]; // QLOGIC USE ONLY x1C0
-+
-+ EEPROM_FUNCTION_CFG funcCfg_fn0; // x1D0
-+ u16 reserved_510; // x1FE
-+
-+ // Address = 512
-+ u8 oemSpace[432]; // x200
-+
-+ BIOS_PARAMS sBIOSParams_fn1; // x3B0
-+ EEPROM_FUNCTION_CFG funcCfg_fn1; // x3D0
-+ u16 reserved_1022; // x3FE
-+
-+ // Address = 1024
-+ u8 reserved_1024[464]; // x400
-+ EEPROM_FUNCTION_CFG funcCfg_fn2; // x5D0
-+
-+ u16 reserved_1534; // x5FE
-+
-+ // Address = 1536
-+ u8 reserved_1536[432]; // x600
-+ BIOS_PARAMS sBIOSParams_fn3; // x7B0
-+ EEPROM_FUNCTION_CFG funcCfg_fn3; // x7D0
-+
-+ u16 checksum; // x7FE
-+ } __attribute__((packed)) isp4022;
-+ };
-+
-+} eeprom_data_t;
-+
-+#define EEPROM_EXT_HW_CONF_OFFSET() \
-+ (IS_QLA4022(ha) ? \
-+ offsetof(eeprom_data_t, isp4022.ext_hw_conf) / 2 : \
-+ offsetof(eeprom_data_t, isp4010.ext_hw_conf) / 2)
-+
-+
-+/*************************************************************************
-+ *
-+ * Hardware Semaphore
-+ *
-+ *************************************************************************/
-+//
-+// Semaphore register definitions
-+//
-+#define SEM_AVAILABLE 0x00
-+#define SEM_OWNER_FIRMWARE 0x01
-+#define SEM_OWNER_STORAGE 0x02
-+#define SEM_OWNER_NETWORK 0x03
-+
-+
-+//
-+// Private Semaphore definitions
-+//
-+typedef enum
-+{
-+ SEM_HW_LOCK
-+ , SEM_GPO
-+ , SEM_SDRAM_INIT
-+ , SEM_PHY_GBIC
-+ , SEM_NVRAM
-+ , SEM_FLASH
-+
-+ , SEM_COUNT // Not a real semaphore, just indicates how many there are
-+} ISP4XXX_SEMAPHORE;
-+
-+typedef struct {
-+ UINT32 semId;
-+ UINT32 semShift;
-+} isp4xxxSemInfo_t;
-+
-+
-+#define SEM_MASK 0x3
-+
-+/* Wait flag defines -- specifies type of wait to acquire semaphore */
-+#define SEM_FLG_NO_WAIT 0
-+#define SEM_FLG_WAIT_FOREVER 1
-+#define SEM_FLG_TIMED_WAIT 2
-+
-+
-+
-+#endif // _QL2XNVRM_H_
-+
-+/*
-+ * Overrides for Emacs so that we get a uniform tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 4
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -4
-+ * c-argdecl-indent: 4
-+ * c-label-offset: -4
-+ * c-continued-statement-offset: 4
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_os.c ./drivers/scsi/qla4xxx/ql4_os.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_os.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_os.c 2006-08-31 14:59:59.000000000 +0400
-@@ -0,0 +1,5556 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4xxx_get_hba_count
-+ * pci_set_dma_mask
-+ * qla4xxx_config_dma_addressing
-+ * qla4xxx_detect
-+ * qla4xxx_display_config
-+ * qla4xxx_alloc_srb_pool
-+ * qla4xxx_free_srb_pool
-+ * qla4xxx_mem_alloc
-+ * qla4xxx_mem_free
-+ * qla4xxx_register_resources
-+ * qla4xxx_set_info
-+ * copy_mem_info
-+ * copy_info
-+ * qla4xxx_proc_dump_srb_info
-+ * qla4xxx_proc_dump_discovered_devices
-+ * qla4xxx_proc_dump_scanned_devices
-+ * qla4xxx_proc_info
-+ * qla4xxx_get_adapter_handle
-+ * qla4xxx_release
-+ * del_from_active_array
-+ * qla4xxx_normalize_dma_addr
-+ * qla4xxx_alloc_cont_entry
-+ * qla4xxx_send_command_to_isp
-+ * qla4xxx_complete_request
-+ * qla4xxx_queuecommand
-+ * qla4xxx_extend_timeout
-+ * qla4xxx_start_io
-+ * qla4xxx_os_cmd_timeout
-+ * qla4xxx_add_timer_to_cmd
-+ * qla4xxx_delete_timer_from_cmd
-+ * qla4xxx_timer
-+ * qla4xxx_ioctl_error_recovery
-+ * qla4xxx_do_dpc
-+ * qla4xxx_panic
-+ * qla4xxx_eh_wait_on_command
-+ * qla4xxx_wait_for_hba_online
-+ * qla4xxx_eh_abort
-+ * qla4010_soft_reset
-+ * qla4xxx_topcat_reset
-+ * qla4xxx_soft_reset
-+ * qla4xxx_hard_reset
-+ * qla4xxx_cmd_wait
-+ * qla4xxx_recover_adapter
-+ * qla4xxx_eh_wait_for_active_target_commands
-+ * qla4xxx_eh_device_reset
-+ * qla4xxx_eh_bus_reset
-+ * qla4xxx_reset_target
-+ * qla4xxx_flush_active_srbs
-+ * qla4xxx_eh_host_reset
-+ * apidev_open
-+ * apidev_close
-+ * apidev_ioctl
-+ * apidev_init
-+ * apidev_cleanup
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#include <linux/version.h>
-+#include <linux/moduleparam.h>
-+#include <linux/vmalloc.h>
-+#include <linux/smp_lock.h>
-+#include <linux/delay.h>
-+
-+#include <scsi/scsi_tcq.h>
-+#include <scsi/scsicam.h>
-+
-+/*
-+ * List of host adapters
-+ *---------------------------------------------------------------------------*/
-+/*
-+ * True list of host adapters. Available for use after qla4xxx_detect has completed
-+ */
-+struct list_head qla4xxx_hostlist = LIST_HEAD_INIT(qla4xxx_hostlist);
-+rwlock_t qla4xxx_hostlist_lock = RW_LOCK_UNLOCKED;
-+
-+int qla4xxx_hba_count = 0;
-+
-+/*
-+ * Command line options
-+ *---------------------------------------------------------------------------*/
-+/*
-+ * Just in case someone uses commas to separate items on the insmod
-+ * command line, we define a dummy buffer here to avoid having insmod
-+ * write wild stuff into our code segment
-+ */
-+
-+int ql4xdiscoverywait=60;
-+module_param(ql4xdiscoverywait, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql4xdiscoverywait,
-+ "Discovery wait time");
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+int ql4xcmdretrycount = 40;
-+#else
-+int ql4xcmdretrycount = 20;
-+#endif
-+module_param(ql4xcmdretrycount, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql4xcmdretrycount,
-+ "Maximum number of mid-layer retries allowed for a command. "
-+ "Default value in non-failover mode is 20, "
-+ "in failover mode, 30.");
-+
-+#ifdef QLA4XXX_NEW_SEND_IOS
-+int ql4xmaxqdepth = 0;
-+#else
-+int ql4xmaxqdepth = 2;
-+#endif
-+
-+module_param(ql4xmaxqdepth, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql4xmaxqdepth,
-+ "Maximum queue depth to report for target devices.");
-+
-+int extended_error_logging = 0; /* 0 = off, 1 = log errors, 2 = debug logging */
-+module_param(extended_error_logging, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(extended_error_logging,
-+ "Option to enable extended error logging, "
-+ "Default is 0 - no logging. 1 - log errors. 2 - debug "
-+ "logging");
-+
-+int displayConfig = 0;
-+module_param(displayConfig, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(displayConfig,
-+ "If 1 then display the configuration used in "
-+ "/etc/modules.conf.");
-+
-+char *ql4xdevconf = NULL;
-+
-+MODULE_AUTHOR("QLogic Corporation");
-+MODULE_DESCRIPTION("QLogic ISP4XXX iSCSI Host Bus Adapter driver");
-+MODULE_LICENSE("GPL");
-+
-+/*
-+ * Proc info processing
-+ *---------------------------------------------------------------------------*/
-+struct info_str {
-+ char *buffer;
-+ int length;
-+ off_t offset;
-+ int pos;
-+};
-+
-+/*
-+ * String messages for various state values (used for print statements)
-+ *---------------------------------------------------------------------------*/
-+const char *ddb_state_msg[] = DDB_STATE_TBL();
-+const char *srb_state_msg[] = SRB_STATE_TBL();
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+/*
-+ * extern from ql4_xioctl.c
-+ */
-+extern int
-+qla4xxx_ioctl_init(void);
-+extern int
-+qla4xxx_ioctl_exit(void);
-+extern int
-+qla4xxx_alloc_ioctl_mem(scsi_qla_host_t *);
-+extern void
-+qla4xxx_free_ioctl_mem(scsi_qla_host_t *);
-+#endif
-+
-+
-+static uint8_t qla4xxx_mem_alloc(scsi_qla_host_t *ha);
-+static void qla4xxx_mem_free(scsi_qla_host_t *ha);
-+void qla4xxx_timer(unsigned long p);
-+static int qla4xxx_do_dpc(void *data);
-+void qla4xxx_display_config(void);
-+void qla4xxx_add_timer_to_cmd(srb_t *srb, int timeout);
-+static void qla4xxx_flush_active_srbs(scsi_qla_host_t *ha);
-+uint8_t qla4xxx_reset_target(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry);
-+uint8_t qla4xxx_recover_adapter(scsi_qla_host_t *ha, uint8_t renew_ddb_list);
-+void qla4xxx_config_dma_addressing(scsi_qla_host_t *ha);
-+
-+#ifdef QLA4XXX_NEW_SEND_IOS
-+CONTINUE_ENTRY *qla4xxx_alloc_cont_entry(scsi_qla_host_t *ha);
-+#else
-+inline uint8_t
-+qla4xxx_alloc_cont_entry(scsi_qla_host_t *ha,
-+ DATA_SEG_A64 **cur_dsd,
-+ uint16_t *avail_dsds);
-+#endif
-+
-+static void qla4xxx_free_other_mem(scsi_qla_host_t *ha);
-+static int qla4xxx_iospace_config(scsi_qla_host_t *ha);
-+extern fc_lun_t * qla4xxx_add_fclun(fc_port_t *fcport, uint16_t lun);
-+
-+
-+/*
-+ * PCI driver interface definitions
-+ *---------------------------------------------------------------------------*/
-+static struct pci_device_id qla4xxx_pci_tbl[] __devinitdata =
-+{
-+ {
-+ .vendor = PCI_VENDOR_ID_QLOGIC,
-+ .device = PCI_DEVICE_ID_QLOGIC_ISP4010,
-+ .subvendor = PCI_ANY_ID,
-+ .subdevice = PCI_ANY_ID,
-+ },
-+ {
-+ .vendor = PCI_VENDOR_ID_QLOGIC,
-+ .device = PCI_DEVICE_ID_QLOGIC_ISP4022,
-+ .subvendor = PCI_ANY_ID,
-+ .subdevice = PCI_ANY_ID,
-+ },
-+ {0, 0},
-+};
-+MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl);
-+
-+static int __devinit qla4xxx_probe_adapter(struct pci_dev *, const struct pci_device_id *);
-+static void __devexit qla4xxx_remove_adapter(struct pci_dev *);
-+static void qla4xxx_free_adapter(scsi_qla_host_t *ha);
-+
-+struct pci_driver qla4xxx_pci_driver = {
-+ .name = DRIVER_NAME,
-+ .id_table = qla4xxx_pci_tbl,
-+ .probe = qla4xxx_probe_adapter,
-+ .remove = qla4xxx_remove_adapter,
-+};
-+
-+int qla4xxx_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
-+int qla4xxx_queuecommand(struct scsi_cmnd *cmd, void (*done_fn)(struct scsi_cmnd *));
-+int qla4xxx_eh_abort(struct scsi_cmnd *cmd);
-+int qla4xxx_eh_bus_reset(struct scsi_cmnd *cmd);
-+int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd);
-+int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
-+int qla4xxx_slave_configure(struct scsi_device * device);
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+extern int qla4xxx_ioctl(struct scsi_device *dev, int cmd, void *arg);
-+#endif
-+
-+static struct scsi_host_template qla4xxx_driver_template = {
-+ .module = THIS_MODULE,
-+ .name = "qla4xxx",
-+ .proc_name = "qla4xxx",
-+ .proc_info = qla4xxx_proc_info,
-+ .queuecommand = qla4xxx_queuecommand,
-+
-+ .eh_abort_handler = qla4xxx_eh_abort,
-+ .eh_device_reset_handler = qla4xxx_eh_device_reset,
-+ .eh_bus_reset_handler = qla4xxx_eh_bus_reset,
-+ .eh_host_reset_handler = qla4xxx_eh_host_reset,
-+
-+ .slave_configure = qla4xxx_slave_configure,
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ .ioctl = qla4xxx_ioctl,
-+#endif
-+ .this_id = -1,
-+ .cmd_per_lun = 3,
-+ .use_clustering = ENABLE_CLUSTERING,
-+ .sg_tablesize = SG_ALL,
-+};
-+
-+/**************************************************************************
-+ * qla4xxx_set_info
-+ * This routine set parameters for the driver from the /proc filesystem.
-+ *
-+ * Input:
-+ * Unused
-+ *
-+ * Returns:
-+ * -ENOSYS - no-op
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_set_info(char *buffer, int length, struct Scsi_Host *host)
-+{
-+ return(-ENOSYS); /* Currently this is a no-op */
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_module_init
-+ * Module initialization.
-+ **************************************************************************/
-+static int __init
-+qla4xxx_module_init(void)
-+{
-+ printk(KERN_INFO
-+ "QLogic iSCSI HBA Driver (%p)\n", qla4xxx_set_info);
-+
-+#if ISP_RESET_TEST
-+ printk(KERN_INFO "qla4xxx: Adapter Reset Test Enabled! "
-+ "Adapter Resets will be issued every 3 minutes!\n");
-+#endif
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ qla4xxx_ioctl_init();
-+#endif
-+
-+ return pci_module_init(&qla4xxx_pci_driver);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_module_exit
-+ * Module cleanup.
-+ **************************************************************************/
-+static void __exit
-+qla4xxx_module_exit(void)
-+{
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ qla4xxx_ioctl_exit();
-+#endif
-+ pci_unregister_driver(&qla4xxx_pci_driver);
-+}
-+module_init(qla4xxx_module_init);
-+module_exit(qla4xxx_module_exit);
-+
-+
-+/**************************************************************************
-+ * qla4xxx_probe_adapter
-+ * This routine will probe for Qlogic 4010 iSCSI host adapters.
-+ * It returns the number of host adapters of a particular
-+ * type that were found. It also initializes all data necessary for
-+ * the driver. It is passed-in the host number, so that it
-+ * knows where its first entry is in the scsi_hosts[] array.
-+ *
-+ * Input:
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int __devinit
-+qla4xxx_probe_adapter(struct pci_dev *pdev, const struct pci_device_id *ent)
-+{
-+ struct Scsi_Host *host;
-+ scsi_qla_host_t *ha;
-+ uint8_t status;
-+ uint8_t init_retry_count = 0;
-+
-+ ENTER(__func__);
-+
-+ if (pci_enable_device(pdev))
-+ return -1;
-+
-+ host = scsi_host_alloc(&qla4xxx_driver_template,
-+ sizeof(scsi_qla_host_t));
-+ if (host == NULL) {
-+ printk(KERN_WARNING
-+ "qla4xxx: Couldn't allocate host from scsi layer!\n");
-+ goto probe_disable_device;
-+ }
-+
-+ /* Clear our data area */
-+ ha = (scsi_qla_host_t *)host->hostdata;
-+ memset(ha, 0, sizeof(scsi_qla_host_t));
-+
-+ /* Save the information from PCI BIOS. */
-+ ha->pdev = pdev;
-+ ha->host = host;
-+ ha->host_no = host->host_no;
-+ ha->instance = qla4xxx_hba_count;
-+
-+ /* Configure PCI I/O space. */
-+ if (qla4xxx_iospace_config(ha) != QLA_SUCCESS)
-+ goto probe_failed;
-+
-+ host->irq = pdev->irq;
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "Found an ISP%04x, irq %d, iobase 0x%p\n", pdev->device, host->irq,
-+ ha->reg);
-+
-+ /* Configure OS DMA addressing method. */
-+ qla4xxx_config_dma_addressing(ha);
-+
-+ /* Initialize lists and spinlocks. */
-+ INIT_LIST_HEAD(&ha->ddb_list);
-+ INIT_LIST_HEAD(&ha->free_srb_q);
-+ INIT_LIST_HEAD(&ha->fcports);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ INIT_LIST_HEAD(&ha->done_srb_q);
-+ INIT_LIST_HEAD(&ha->retry_srb_q);
-+#endif
-+
-+ init_MUTEX(&ha->mbox_sem);
-+ init_waitqueue_head(&ha->mailbox_wait_queue);
-+
-+ spin_lock_init(&ha->hardware_lock);
-+ spin_lock_init(&ha->adapter_lock);
-+ spin_lock_init(&ha->list_lock);
-+
-+ ha->dpc_pid = -1;
-+ init_completion(&ha->dpc_inited);
-+ init_completion(&ha->dpc_exited);
-+
-+ /* Verify iSCSI PCI Funcion Number */
-+ if (IS_QLA4010(ha)) {
-+ ha->function_number = ISP4010_ISCSI_FUNCTION;
-+ } else if (IS_QLA4022(ha)) {
-+ spin_lock_irq(&ha->hardware_lock);
-+ ha->function_number = (RD_REG_DWORD(&ha->reg->ctrl_status) &
-+ CSR_PCI_FUNC_NUM_MASK) >> 8;
-+ spin_unlock_irq(&ha->hardware_lock);
-+ }
-+ if (PCI_FUNC(pdev->devfn) != ha->function_number) {
-+ ql4_printk(KERN_WARNING, ha, "HA function number (0x%x) does "
-+ "not match PCI function number (0x%x)\n",
-+ ha->function_number, PCI_FUNC(pdev->devfn));
-+
-+ goto probe_failed;
-+ }
-+
-+ /*
-+ * Allocate memory for dma buffers
-+ */
-+ if (qla4xxx_mem_alloc(ha) == QLA_ERROR) {
-+ ql4_printk(KERN_WARNING, ha,
-+ "[ERROR] Failed to allocate memory for adapter\n");
-+
-+ goto probe_failed;
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ INIT_LIST_HEAD(&ha->failover_queue);
-+ init_MUTEX(&ha->ioctl->ioctl_sem);
-+ init_MUTEX_LOCKED(&ha->ioctl->ioctl_cmpl_sem);
-+#endif
-+
-+ /*
-+ * Initialize the Host adapter request/response queues and
-+ * firmware
-+ * NOTE: interrupts enabled upon successful completion
-+ */
-+ status = qla4xxx_initialize_adapter(ha, REBUILD_DDB_LIST);
-+ while ((status == QLA_ERROR) &&
-+ test_bit(DPC_RESET_HA, &ha->dpc_flags) &&
-+ (init_retry_count++ < MAX_INIT_RETRIES)) {
-+ DEBUG2(printk("scsi: %s: retrying adapter "
-+ "initialization (%d)\n", __func__, init_retry_count));
-+
-+ qla4xxx_soft_reset(ha);
-+ status = qla4xxx_initialize_adapter(ha, REBUILD_DDB_LIST);
-+ }
-+
-+ if (status == QLA_ERROR) {
-+ ql4_printk(KERN_WARNING, ha,"Failed to initialize adapter\n");
-+
-+ DEBUG2(printk(KERN_INFO "scsi: Failed to initialize adapter\n"));
-+
-+ goto probe_failed;
-+ }
-+
-+ host->cmd_per_lun = 3;
-+ host->io_port = ha->io_addr;
-+ host->max_channel = 0;
-+ host->max_lun = MAX_LUNS-1;
-+ host->max_id = MAX_TARGETS;
-+ host->unique_id = ha->instance;
-+ host->max_cmd_len = IOCB_MAX_CDB_LEN;
-+ //FIXME KH: What does 128 represent. We shouldn't use hard-coded values.
-+ host->can_queue = REQUEST_QUEUE_DEPTH + 128;
-+
-+ /* Startup the kernel thread for this host adapter. */
-+ QL4PRINT(QLP7, printk("scsi: %s: Starting kernel thread for "
-+ "qla4xxx_dpc\n", __func__));
-+ ha->dpc_should_die = 0;
-+ ha->dpc_pid = kernel_thread(qla4xxx_do_dpc, ha, 0);
-+ if (ha->dpc_pid < 0) {
-+ ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n");
-+
-+ goto probe_failed;
-+ }
-+ wait_for_completion(&ha->dpc_inited);
-+
-+ /* Install the interrupt handler with the new ha */
-+ if (request_irq(ha->pdev->irq, qla4xxx_intr_handler,
-+ SA_INTERRUPT|SA_SHIRQ, "qla4xxx", ha)) {
-+ ql4_printk(KERN_WARNING, ha,
-+ "Failed to reserve interrupt %d already in use.\n",
-+ host->irq);
-+
-+ goto probe_failed;
-+ }
-+ set_bit(AF_IRQ_ATTACHED, &ha->flags);
-+ QL4PRINT(QLP7, printk("scsi%d: irq %d attached\n", ha->host_no,
-+ ha->pdev->irq));
-+ qla4xxx_enable_intrs(ha);
-+
-+ /* Start timer thread. */
-+ QL4PRINT(QLP7, printk("scsi: %s: Starting timer thread for adapter "
-+ "%d\n", __func__, ha->instance));
-+ init_timer(&ha->timer);
-+ ha->timer.expires = jiffies + HZ;
-+ ha->timer.data = (unsigned long)ha;
-+ ha->timer.function = (void (*)(unsigned long))qla4xxx_timer;
-+ add_timer(&ha->timer);
-+ ha->timer_active = 1;
-+
-+ /* Insert new entry into the list of adapters. */
-+ write_lock(&qla4xxx_hostlist_lock);
-+ list_add_tail(&ha->list, &qla4xxx_hostlist);
-+ write_unlock(&qla4xxx_hostlist_lock);
-+
-+ qla4xxx_display_config();
-+
-+ set_bit(AF_INIT_DONE, &ha->flags);
-+ qla4xxx_hba_count++;
-+
-+ pci_set_drvdata(pdev, ha);
-+
-+ if (scsi_add_host(host, &pdev->dev))
-+ goto probe_failed;
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ /*
-+ * if failover is enabled
-+ */
-+ if (qla4xxx_failover_enabled(ha)) {
-+ qla4xxx_cfg_init(ha);
-+ }
-+
-+ printk(KERN_INFO
-+ " QLogic iSCSI HBA Driver version: %s-fo%c\n"
-+ " QLogic ISP%04x @ %s hdma%c, host#=%d, fw=%02d.%02d.%02d.%02d\n",
-+ QLA4XXX_DRIVER_VERSION,
-+ (qla4xxx_failover_enabled(ha)) ? '+': '-',
-+ ha->pdev->device, pci_name(ha->pdev),
-+ test_bit(AF_64BIT_PCI_ADDR, &ha->flags) ? '+': '-', ha->host_no,
-+ ha->firmware_version[0], ha->firmware_version[1],
-+ ha->patch_number, ha->build_number);
-+#else
-+ printk(KERN_INFO
-+ " QLogic iSCSI HBA Driver version: %s\n"
-+ " QLogic ISP%04x @ %s hdma%c, host#=%d, fw=%02d.%02d.%02d.%02d\n",
-+ QLA4XXX_DRIVER_VERSION,
-+ ha->pdev->device, pci_name(ha->pdev),
-+ test_bit(AF_64BIT_PCI_ADDR, &ha->flags) ? '+': '-', ha->host_no,
-+ ha->firmware_version[0], ha->firmware_version[1],
-+ ha->patch_number, ha->build_number);
-+#endif
-+ scsi_scan_host(host);
-+
-+ return 0;
-+
-+probe_failed:
-+ qla4xxx_free_adapter(ha);
-+
-+probe_disable_device:
-+ pci_disable_device(pdev);
-+
-+ return -1;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_remove_adapter
-+ *
-+ * Input:
-+ * pci_dev - PCI device pointer
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void __devexit
-+qla4xxx_remove_adapter(struct pci_dev *pdev)
-+{
-+ scsi_qla_host_t *ha;
-+
-+ ha = pci_get_drvdata(pdev);
-+
-+ write_lock(&qla4xxx_hostlist_lock);
-+ list_del_init(&ha->list);
-+ write_unlock(&qla4xxx_hostlist_lock);
-+
-+ scsi_remove_host(ha->host);
-+
-+ qla4xxx_free_adapter(ha);
-+
-+ scsi_host_put(ha->host);
-+
-+ pci_set_drvdata(pdev, NULL);
-+}
-+
-+static void
-+qla4xxx_free_adapter(scsi_qla_host_t *ha)
-+{
-+ int ret;
-+ unsigned long flags;
-+
-+ ENTER(__func__);
-+
-+#if 0
-+ /* Deregister with the iSNS Server */
-+ if (test_bit(ISNS_FLAG_ISNS_SRV_REGISTERED, &ha->isns_flags)) {
-+ u_long wait_cnt;
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: deregister iSNS\n",
-+ ha->host_no, __func__));
-+ qla4xxx_isns_scn_dereg(ha); //FIXME: KRH
-+ qla4xxx_isns_dev_dereg(ha); //FIXME: KRH
-+
-+ wait_cnt = jiffies + ISNS_DEREG_TOV * HZ;
-+ while (wait_cnt > jiffies) {
-+ if (test_bit(ISNS_FLAG_ISNS_SRV_REGISTERED,
-+ &ha->isns_flags) == 0)
-+ break;
-+ QL4PRINT(QLP7, printk("."));
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ }
-+ }
-+#endif
-+
-+ if (test_bit(ISNS_FLAG_ISNS_ENABLED_IN_ISP, &ha->isns_flags)) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Stop iSNS service\n",
-+ ha->host_no, __func__));
-+ qla4xxx_isns_disable(ha);
-+ }
-+
-+ if (test_bit(AF_INTERRUPTS_ON, &ha->flags)) {
-+ /* Turn-off interrupts on the card. */
-+ qla4xxx_disable_intrs(ha);
-+ }
-+
-+ /* Issue Soft Reset to put firmware in unknown state */
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Soft Reset\n", ha->host_no,
-+ __func__));
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SOFT_RESET));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* Remove timer thread, if present */
-+ if (ha->timer_active) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: Removing timer thread for "
-+ "adapter %d\n", ha->host_no, __func__, ha->instance));
-+
-+ del_timer_sync(&ha->timer);
-+ ha->timer_active = 0;
-+ }
-+
-+ /* Kill the kernel thread for this host */
-+ if (ha->dpc_pid >= 0) {
-+ ha->dpc_should_die = 1;
-+ wmb();
-+ ret = kill_proc(ha->dpc_pid, SIGHUP, 1);
-+ if (ret) {
-+ ql4_printk(KERN_ERR, ha,
-+ "Unable to signal DPC thread -- (%d)\n", ret);
-+
-+ /* TODO: SOMETHING MORE??? */
-+ } else
-+ wait_for_completion(&ha->dpc_exited);
-+ }
-+
-+ /* free extra memory */
-+ qla4xxx_mem_free(ha);
-+
-+ /* Detach interrupts */
-+ if (test_and_clear_bit(AF_IRQ_ATTACHED, &ha->flags))
-+ free_irq(ha->pdev->irq, ha);
-+
-+ /* Free I/O Region */
-+ if (ha->io_addr) {
-+ release_region(ha->io_addr, ha->io_len);
-+ ha->io_addr = 0;
-+ }
-+
-+ pci_disable_device(ha->pdev);
-+
-+ LEAVE(__func__);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_iospace_config
-+ * This routine
-+ *
-+ * Input:
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4xxx_iospace_config(scsi_qla_host_t *ha)
-+{
-+ int bar;
-+
-+ /* Search for I/O register. */
-+ for (bar = 0; bar <= 5; bar++) {
-+ unsigned long pci_base_address;
-+
-+ pci_base_address = pci_resource_start(ha->pdev, bar);
-+ ha->pci_resource_flags = pci_resource_flags(ha->pdev, bar);
-+
-+#if MEMORY_MAPPED_IO
-+ if (ha->pci_resource_flags & IORESOURCE_MEM) {
-+ QL4PRINT(QLP7, printk("scsi%d: Assigned to Memory I/O "
-+ "0x%lx in PCI BAR%d\n", ha->host_no,
-+ pci_base_address, bar));
-+
-+ ha->mem_addr = pci_base_address;
-+ ha->mem_len = pci_resource_len(ha->pdev, bar);
-+ break;
-+ }
-+#else
-+ if (ha->pci_resource_flags IORESOURCE_IO) {
-+ QL4PRINT(QLP7, printk("scsi%d: Assigned to I/O Port "
-+ "0x%lx in PCI BAR%d\n", ha->host_no,
-+ pci_base_address, bar));
-+
-+ ha->io_addr = pci_base_address;
-+ ha->io_len = pci_resource_len(ha->pdev, bar);
-+ break;
-+ }
-+#endif
-+ }
-+
-+ /* Map the Memory I/O register. */
-+ if (ha->mem_addr) {
-+ unsigned long page_offset, base;
-+
-+ if (!request_mem_region(ha->mem_addr, ha->mem_len,
-+ DRIVER_NAME)) {
-+ printk(KERN_WARNING
-+ "Could not allocate IO Memory space %lx len %ld.\n",
-+ ha->mem_addr, ha->mem_len);
-+ return -1;
-+ }
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: base memory address = "
-+ "0x%lx\n", ha->host_no, __func__, ha->mem_addr));
-+
-+ /* Find proper memory chunk for memory map I/O reg. */
-+ base = ha->mem_addr & PAGE_MASK;
-+ page_offset = ha->mem_addr - base;
-+
-+ /* Get virtual address for I/O registers. */
-+ ha->virt_mmapbase = ioremap(base, page_offset +
-+ sizeof(*ha->reg));
-+ if (ha->virt_mmapbase == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: I/O Remap Failed\n",
-+ ha->host_no, __func__));
-+ return -1;
-+ }
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: virt memory_mapped_address "
-+ "= 0x%p\n", ha->host_no, __func__, ha->virt_mmapbase));
-+
-+ ha->reg = (isp_reg_t *)(ha->virt_mmapbase + page_offset);
-+ QL4PRINT(QLP7, printk("scsi%d: %s: registers = 0x%p\n",
-+ ha->host_no, __func__, ha->reg));
-+ }
-+
-+ if (ha->io_addr) {
-+ if (!request_region(ha->io_addr, ha->io_len, DRIVER_NAME)) {
-+ printk(KERN_WARNING
-+ "Could not allocate IO space %lx len %ld.\n",
-+ ha->io_addr, ha->io_len);
-+
-+ return -1;
-+ }
-+ }
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_display_config
-+ * This routine displays the configuration information to be used in
-+ * modules.conf.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_display_config(void)
-+{
-+ scsi_qla_host_t *ha, *htemp;
-+
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each_entry_safe(ha, htemp, &qla4xxx_hostlist, list) {
-+ /* Display the M.A.C. Address for adapter */
-+ printk(KERN_INFO
-+ "scsi-qla%d-mac=%02x%02x%02x%02x%02x%02x\\;\n",
-+ ha->instance,
-+ ha->my_mac[0], ha->my_mac[1], ha->my_mac[2],
-+ ha->my_mac[3], ha->my_mac[4], ha->my_mac[5]);
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_hba_count
-+ * This routine returns the number of host adapters present.
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Returns:
-+ * qla4xxx_hba_count - Number of host adapters present.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+inline uint32_t
-+qla4xxx_get_hba_count(void)
-+{
-+ return(qla4xxx_hba_count);
-+}
-+
-+
-+
-+/****************************************************************************/
-+/* LINUX - Loadable Module Functions. */
-+/****************************************************************************/
-+
-+/**
-+ * qla4xxx_config_dma_addressing() - Configure OS DMA addressing method.
-+ * @ha: HA context
-+ *
-+ * At exit, the @ha's flags.enable_64bit_addressing set to indicated
-+ * supported addressing method.
-+ */
-+void
-+qla4xxx_config_dma_addressing(scsi_qla_host_t *ha)
-+{
-+ /* Assume 32bit DMA address. */
-+ clear_bit(AF_64BIT_PCI_ADDR, &ha->flags);
-+
-+ /*
-+ * Given the two variants pci_set_dma_mask(), allow the compiler to
-+ * assist in setting the proper dma mask.
-+ */
-+ if (sizeof(dma_addr_t) > 4) {
-+ /* Update our PCI device dma_mask for full 64 bit mask */
-+ if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) {
-+ set_bit(AF_64BIT_PCI_ADDR, &ha->flags);
-+
-+ if (pci_set_consistent_dma_mask(ha->pdev,
-+ DMA_64BIT_MASK)) {
-+ ql4_printk(KERN_DEBUG, ha,
-+ "Failed to set 64 bit PCI consistent mask; "
-+ "using 32 bit.\n");
-+
-+ pci_set_consistent_dma_mask(ha->pdev,
-+ DMA_32BIT_MASK);
-+ }
-+ } else {
-+ ql4_printk(KERN_DEBUG, ha,
-+ "Failed to set 64 bit PCI DMA mask, falling back "
-+ "to 32 bit MASK.\n");
-+
-+ pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK);
-+ }
-+ } else {
-+ pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK);
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_alloc_srb_pool
-+ * This routine is called during driver initialization to allocate
-+ * memory for the local srb pool.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully allocated srbs
-+ * QLA_ERROR - Failed to allocate any srbs
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_alloc_srb_pool(scsi_qla_host_t *ha)
-+{
-+ srb_t *srb;
-+ int i;
-+ uint8_t status = QLA_ERROR;
-+
-+ ENTER("qla4xxx_alloc_srb_pool");
-+
-+ ha->num_srbs_allocated = 0;
-+ ha->free_srb_q_count = 0; /* incremented in add_to_free_srb_q routine */
-+
-+ /*
-+ * NOTE: Need to allocate each SRB separately, as Kernel 2.4.4 seems to
-+ * have an error when allocating a large amount of memory.
-+ */
-+ for (i=0; i < MAX_SRBS; i++) {
-+ srb = (srb_t *) kmalloc(sizeof(srb_t), GFP_KERNEL);
-+ if (srb == NULL) {
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d: %s: failed to allocate memory, count = "
-+ "%d\n", ha->host_no, __func__, i));
-+ } else {
-+ ha->num_srbs_allocated++;
-+ memset(srb, 0, sizeof(srb_t));
-+ atomic_set(&srb->ref_count, 0);
-+ __add_to_free_srb_q(ha, srb);
-+ }
-+ }
-+
-+ if (ha->free_srb_q_count)
-+ status = QLA_SUCCESS;
-+
-+ DEBUG2(printk("scsi%d: %s: Allocated %d SRB(s)\n",
-+ ha->host_no, __func__, ha->free_srb_q_count));
-+
-+ LEAVE("qla4xxx_alloc_srb_pool");
-+
-+ return (status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_free_srb_pool
-+ * This routine is called during driver unload to deallocate the srb
-+ * pool.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4xxx_free_srb_pool(scsi_qla_host_t *ha)
-+{
-+ srb_t *srb, *stemp;
-+ int cnt_free_srbs = 0;
-+ unsigned long flags;
-+
-+ ENTER("qla4xxx_free_srb_pool");
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_entry_safe(srb, stemp, &ha->free_srb_q, list_entry) {
-+ __del_from_free_srb_q(ha, srb);
-+ kfree(srb);
-+ cnt_free_srbs++;
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ if (cnt_free_srbs != ha->num_srbs_allocated) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING
-+ "scsi%d: Did not free all srbs, Free'd srb count = %d, "
-+ "Alloc'd srb count %d\n", ha->host_no, cnt_free_srbs,
-+ ha->num_srbs_allocated));
-+ }
-+
-+ LEAVE("qla4xxx_free_srb_pool");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_mem_alloc
-+ * This routine allocates memory use by the adapter.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully allocated adapter memory
-+ * QLA_ERROR - Failed to allocate adapter memory
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_mem_alloc(scsi_qla_host_t *ha)
-+{
-+ unsigned long align;
-+
-+ ENTER("qla4xxx_mem_alloc");
-+
-+ /* Allocate contiguous block of DMA memory for queues. */
-+ ha->queues_len = ((REQUEST_QUEUE_DEPTH * QUEUE_SIZE) +
-+ (RESPONSE_QUEUE_DEPTH * QUEUE_SIZE) + sizeof(shadow_regs_t) +
-+ MEM_ALIGN_VALUE + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-+ ha->queues = pci_alloc_consistent(ha->pdev, ha->queues_len,
-+ &ha->queues_dma);
-+ if (ha->queues == NULL) {
-+ ql4_printk(KERN_WARNING, ha,
-+ "Memory Allocation failed - queues.\n");
-+
-+ goto mem_alloc_error_exit;
-+ }
-+ memset(ha->queues, 0, ha->queues_len);
-+
-+ /*
-+ * As per RISC alignment requirements -- the bus-address must be a
-+ * multiple of the request-ring size (in bytes).
-+ */
-+ align = 0;
-+ if ((unsigned long)ha->queues_dma & (MEM_ALIGN_VALUE - 1)) {
-+ align = MEM_ALIGN_VALUE -
-+ ((unsigned long)ha->queues_dma & (MEM_ALIGN_VALUE - 1));
-+ }
-+
-+ /* Update request and response queue pointers. */
-+ ha->request_dma = ha->queues_dma + align;
-+ ha->request_ring = (QUEUE_ENTRY *)(ha->queues + align);
-+ ha->response_dma = ha->queues_dma + align +
-+ (REQUEST_QUEUE_DEPTH * QUEUE_SIZE);
-+ ha->response_ring = (QUEUE_ENTRY *)(ha->queues + align +
-+ (REQUEST_QUEUE_DEPTH * QUEUE_SIZE));
-+ ha->shadow_regs_dma = ha->queues_dma + align +
-+ (REQUEST_QUEUE_DEPTH * QUEUE_SIZE) +
-+ (RESPONSE_QUEUE_DEPTH * QUEUE_SIZE);
-+ ha->shadow_regs = (shadow_regs_t *)(ha->queues + align +
-+ (REQUEST_QUEUE_DEPTH * QUEUE_SIZE) +
-+ (RESPONSE_QUEUE_DEPTH * QUEUE_SIZE));
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: queues 0x%lx (%p) %lx\n",
-+ ha->host_no, __func__, (unsigned long)ha->queues_dma,
-+ ha->queues, ha->queues_len));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: request ring 0x%lx (%p)\n",
-+ ha->host_no, __func__, (unsigned long)ha->request_dma,
-+ ha->request_ring));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: response ring 0x%lx (%p)\n",
-+ ha->host_no, __func__, (unsigned long)ha->response_dma,
-+ ha->response_ring));
-+ QL4PRINT(QLP7, printk("scsi%d: %s: shadow regs 0x%lx (%p)\n",
-+ ha->host_no, __func__, (unsigned long)ha->shadow_regs_dma,
-+ ha->shadow_regs));
-+
-+ /* Allocate iSNS Discovered Target Database
-+ * ---------------------------------------- */
-+ ha->isns_disc_tgt_database_size = sizeof(ISNS_DISCOVERED_TARGET) *
-+ MAX_ISNS_DISCOVERED_TARGETS;
-+ ha->isns_disc_tgt_databasev = pci_alloc_consistent(ha->pdev,
-+ ha->isns_disc_tgt_database_size, &ha->isns_disc_tgt_databasep);
-+ if (ha->isns_disc_tgt_databasev == NULL) {
-+ ql4_printk(KERN_WARNING, ha,
-+ "Memory Allocation failed - iSNS DB.\n");
-+
-+ goto mem_alloc_error_exit;
-+ }
-+ memset(ha->isns_disc_tgt_databasev, 0, ha->isns_disc_tgt_database_size);
-+
-+ QL4PRINT(QLP7, printk("scsi%d: %s: iSNS DB 0x%ld (%p)\n", ha->host_no,
-+ __func__, (unsigned long)ha->isns_disc_tgt_databasep,
-+ ha->isns_disc_tgt_databasev));
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_alloc_ioctl_mem(ha) != QLA_SUCCESS) {
-+ ql4_printk(KERN_WARNING, ha,
-+ "Memory Allocation failed - IOCTL DMA buffer.\n");
-+
-+ goto mem_alloc_error_exit;
-+ }
-+#endif
-+
-+ /*
-+ * Allocate memory for srb pool
-+ *-----------------------------*/
-+ if (qla4xxx_alloc_srb_pool(ha) == QLA_ERROR)
-+ goto mem_alloc_error_exit;
-+
-+ LEAVE("qla4xxx_mem_alloc");
-+
-+ return (QLA_SUCCESS);
-+
-+mem_alloc_error_exit:
-+ qla4xxx_mem_free(ha);
-+ LEAVE("qla4xxx_mem_alloc");
-+ return (QLA_ERROR);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_mem_free
-+ * This routine frees adapter allocated memory
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4xxx_mem_free(scsi_qla_host_t *ha)
-+{
-+ ENTER("qla4xxx_mem_free");
-+
-+ if (ha->queues) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: free queues.\n", ha->host_no,
-+ __func__));
-+
-+ pci_free_consistent(ha->pdev, ha->queues_len, ha->queues,
-+ ha->queues_dma);
-+ }
-+ ha->queues_len = 0;
-+ ha->queues = NULL;
-+ ha->queues_dma = 0;
-+ ha->request_ring = NULL;
-+ ha->request_dma = 0;
-+ ha->response_ring = NULL;
-+ ha->response_dma = 0;
-+ ha->shadow_regs = NULL;
-+ ha->shadow_regs_dma = 0;
-+
-+ if (ha->isns_disc_tgt_databasev) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: free iSNS DB.\n",
-+ ha->host_no, __func__));
-+
-+ pci_free_consistent(ha->pdev, ha->isns_disc_tgt_database_size,
-+ ha->isns_disc_tgt_databasev, ha->isns_disc_tgt_databasep);
-+ }
-+ ha->isns_disc_tgt_database_size = 0;
-+ ha->isns_disc_tgt_databasev = 0;
-+ ha->isns_disc_tgt_databasep = 0;
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ qla4xxx_free_ioctl_mem(ha);
-+#endif
-+
-+ /* Free srb pool */
-+ if (ha->num_srbs_allocated) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: free srb pool\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_free_srb_pool(ha);
-+ }
-+
-+ /* Free ddb list */
-+ if (!list_empty(&ha->ddb_list)) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: free ddb list\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_free_ddb_list(ha);
-+ }
-+
-+ /* Unmap Memory Mapped I/O region */
-+ if (ha->virt_mmapbase) {
-+ QL4PRINT(QLP7, printk("scsi%d: %s: unmap mem io region\n",
-+ ha->host_no, __func__));
-+
-+ iounmap(ha->virt_mmapbase);
-+ ha->virt_mmapbase = NULL;
-+ }
-+
-+ if (ha->mem_addr)
-+ release_mem_region(ha->mem_addr, ha->mem_len);
-+ ha->mem_addr = 0;
-+
-+ qla4xxx_free_other_mem(ha);
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha))
-+ qla4xxx_cfg_mem_free(ha);
-+#endif
-+
-+ LEAVE("qla4xxx_mem_free");
-+}
-+
-+
-+/**************************************************************************
-+* qla2xxx_slave_configure
-+*
-+* Description:
-+**************************************************************************/
-+int
-+qla4xxx_slave_configure(struct scsi_device *sdev)
-+{
-+ scsi_qla_host_t *ha = to_qla_host(sdev->host);
-+ int queue_depth;
-+ os_tgt_t *tgt_entry;
-+ os_lun_t *lun_entry;
-+
-+ queue_depth = 32;
-+
-+ /* Enable TCQ. */
-+ if (sdev->tagged_supported) {
-+ if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
-+ queue_depth = ql4xmaxqdepth;
-+
-+ ql4xmaxqdepth = queue_depth;
-+
-+ scsi_activate_tcq(sdev, queue_depth);
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "scsi(%d:%d:%d:%d): Enabled tagged queuing, queue "
-+ "depth %d.\n", sdev->host->host_no, sdev->channel,
-+ sdev->id, sdev->lun, sdev->queue_depth);
-+ } else {
-+ scsi_adjust_queue_depth(sdev, 0 /* TCQ off */,
-+ sdev->host->hostt->cmd_per_lun /* 3 */);
-+ }
-+
-+ /* Save misc. information. */
-+ tgt_entry = qla4xxx_lookup_target_by_SCSIID(ha, sdev->channel,
-+ sdev->id);
-+ if (tgt_entry != NULL) {
-+ lun_entry = qla4xxx_lookup_lun_handle(ha, tgt_entry,
-+ sdev->lun);
-+ if (lun_entry != NULL) {
-+ lun_entry->sdev = sdev;
-+ if (sdev->type == TYPE_TAPE) {
-+ tgt_entry->fcport->flags |= FCF_TAPE_PRESENT;
-+ // lun_entry->fclun->flags |= FLF_TAPE_PRESENT;
-+ }
-+ }
-+ }
-+
-+ return (0);
-+}
-+
-+
-+/*
-+ * The following support functions are adopted to handle
-+ * the re-entrant qla4xxx_proc_info correctly.
-+ */
-+static void
-+copy_mem_info(struct info_str *info, char *data, int len)
-+{
-+ if (info->pos + len > info->offset + info->length)
-+ len = info->offset + info->length - info->pos;
-+
-+ if (info->pos + len < info->offset) {
-+ info->pos += len;
-+ return;
-+ }
-+
-+ if (info->pos < info->offset) {
-+ off_t partial;
-+
-+ partial = info->offset - info->pos;
-+ data += partial;
-+ info->pos += partial;
-+ len -= partial;
-+ }
-+
-+ if (len > 0) {
-+ memcpy(info->buffer, data, len);
-+ info->pos += len;
-+ info->buffer += len;
-+ }
-+}
-+
-+static int
-+copy_info(struct info_str *info, char *fmt, ...)
-+{
-+ va_list args;
-+ static char buf[256];
-+ int len;
-+
-+ va_start(args, fmt);
-+ len = vsprintf(buf, fmt, args);
-+ va_end(args);
-+
-+ copy_mem_info(info, buf, len);
-+
-+ return(len);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_proc_dump_srb_info
-+ * This routine displays srb information in the proc buffer.
-+ *
-+ * Input:
-+ * len - length of proc buffer prior to this function's execution.
-+ * srb - Pointer to srb to display.
-+ *
-+ * Remarks:
-+ * This routine is dependent on the DISPLAY_SRBS_IN_PROC #define being
-+ * set to 1.
-+ *
-+ * Returns:
-+ * len - length of proc buffer after this function's execution.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+inline void
-+qla4xxx_proc_dump_srb_info(scsi_qla_host_t *ha, struct info_str *info, srb_t *srb)
-+{
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+
-+ ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, srb->fw_ddb_index);
-+ lun_entry = srb->lun_queue;
-+
-+ copy_info(info, "srb %p", srb);
-+
-+ if (ddb_entry && lun_entry && srb->cmd) {
-+ struct scsi_cmnd *cmd = srb->cmd;
-+ //int i;
-+
-+ copy_info(info, ", b%d,t%d,l%d, SS=%d, DS=%d, LS=%d, "
-+ "r_start=%ld, u_start=%ld",
-+ cmd->device->channel, cmd->device->id,
-+ cmd->device->lun,
-+ srb->state,
-+ atomic_read(&ddb_entry->state),
-+ lun_entry->lun_state,
-+ srb->r_start,srb->u_start);
-+
-+ //copy_info(info, ", cdb=");
-+ //for (i=0; i<cmd->cmd_len; i++)
-+ // copy_info(info, "%02X ", cmd->cmnd[i]);
-+ }
-+
-+ copy_info(info, "\n");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_proc_dump_discovered_devices
-+ * This routine displays information for discovered devices in the proc
-+ * buffer.
-+ *
-+ * Input:
-+ * info - length of proc buffer prior to this function's execution.
-+ *
-+ * Remarks:
-+ * This routine is dependent on the DISPLAY_SRBS_IN_PROC #define being
-+ * set to 1.
-+ *
-+ * Returns:
-+ * info - length of proc buffer after this function's execution.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+inline void
-+qla4xxx_proc_dump_discovered_devices(scsi_qla_host_t *ha, struct info_str *info)
-+{
-+ int i,j;
-+
-+ ENTER(__func__);
-+
-+ copy_info(info, "SCSI discovered device Information:\n");
-+ copy_info(info, "Index: DID: NameString: Alias:\n");
-+
-+ for (i=0; i < ha->isns_num_discovered_targets; i++) {
-+ ISNS_DISCOVERED_TARGET *isns_tgt =
-+ &ha->isns_disc_tgt_databasev[i];
-+
-+ copy_info(info, "%2d: %4d: %s: %s\n",
-+ i,
-+ isns_tgt->DDID,
-+ isns_tgt->NameString,
-+ isns_tgt->Alias);
-+
-+ for (j = 0; j < isns_tgt->NumPortals; j++) {
-+ ISNS_DISCOVERED_TARGET_PORTAL *isns_portal =
-+ &isns_tgt->Portal[j];
-+
-+ copy_info(info, " Port %d: IP %d.%d.%d.%d\n",
-+ isns_portal->PortNumber,
-+ isns_portal->IPAddr[0],
-+ isns_portal->IPAddr[1],
-+ isns_portal->IPAddr[2],
-+ isns_portal->IPAddr[3]);
-+ }
-+ }
-+ LEAVE(__func__);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_proc_dump_scanned_devices
-+ * This routine displays information for scanned devices in the proc
-+ * buffer.
-+ *
-+ * Input:
-+ * info - length of proc buffer prior to this function's execution.
-+ *
-+ * Remarks:
-+ * This routine is dependent on the DISPLAY_SRBS_IN_PROC #define being
-+ * set to 1.
-+ *
-+ * Returns:
-+ * info - length of proc buffer after this function's execution.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+inline void
-+qla4xxx_proc_dump_scanned_devices(scsi_qla_host_t *ha, struct info_str *info)
-+{
-+ os_lun_t *up;
-+ os_tgt_t *tq;
-+ ddb_entry_t *ddb_entry;
-+ fc_port_t *fcport;
-+ int t, l, i;
-+
-+ ENTER(__func__);
-+ /* 2.25 node/port display to proc */
-+ /* Display the node name for adapter */
-+ copy_info(info, "\nSCSI Device Information:\n");
-+ copy_info(info,
-+ "scsi-qla%d-adapter-port=%s;\n",
-+ (int)ha->instance, ha->name_string);
-+
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+ if ((tq = TGT_Q(ha, t)) == NULL)
-+ continue;
-+ copy_info(info,
-+ "scsi-qla%d-target-%d=%s;\n",
-+ (int)ha->instance, t, tq->iscsi_name);
-+ }
-+
-+ /* Print out device port names */
-+ copy_info(info, "\nISCSI Port Information:\n");
-+ i = 0;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if(fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ ddb_entry = fcport->ddbptr;
-+
-+ copy_info(info,
-+ "scsi-qla%d-port-%d=\"%s\":%d.%d.%d.%d:0x%04x;\n",
-+ (int)ha->instance, i, fcport->iscsi_name,
-+ ddb_entry->ip_addr[0],
-+ ddb_entry->ip_addr[1],
-+ ddb_entry->ip_addr[2],
-+ ddb_entry->ip_addr[3],
-+ ddb_entry->fw_ddb_index);
-+ i++;
-+ }
-+
-+
-+ //copy_info(info, "SCSI scanned device Information:\n");
-+ copy_info(info, "\nSCSI LUN Information:\n");
-+ copy_info(info, " (T : L) * - indicates lun is not registered with the OS.\n");
-+
-+ /* scan for all equipment stats */
-+ for (t = 0; t < ha->host->max_id; t++) {
-+ /* scan all luns */
-+ for (l = 0; l < ha->host->max_lun; l++) {
-+ up = (os_lun_t *) GET_LU_Q(ha, t, l);
-+
-+ if (up == NULL) {
-+ continue;
-+ }
-+ if (up->fclun == NULL) {
-+ continue;
-+ }
-+
-+ if (up->fclun->fcport == NULL) {
-+ continue;
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (!qla4xxx_failover_enabled(ha)) {
-+ if (up->tot_io_count < 4)
-+ continue;
-+ }
-+#else
-+ /* don't display luns if OS didn't probe */
-+ if (up->tot_io_count < 4)
-+ continue;
-+#endif
-+
-+ ddb_entry = up->fclun->fcport->ddbptr;
-+ copy_info(info,
-+ "(%2d:%2d): Total reqs %ld,",
-+ t,l,up->tot_io_count);
-+
-+ copy_info(info,
-+ " Active reqs %ld,",
-+ up->out_count);
-+
-+ copy_info(info, "states= %d:%d:%d ",
-+ atomic_read(&ddb_entry->state),
-+ up->lun_state,
-+ ddb_entry->fw_ddb_device_state);
-+
-+ if (up->tot_io_count < 4) {
-+ copy_info(info,
-+ " flags 0x%lx*,",
-+ ddb_entry->flags);
-+ }
-+ else {
-+ copy_info(info,
-+ " flags 0x%lx,",
-+ ddb_entry->flags);
-+ }
-+
-+ copy_info(info,
-+ " %d:%d:%02x %02x",
-+ up->fclun->fcport->ha->instance,
-+ up->fclun->fcport->cur_path,
-+ ddb_entry->fw_ddb_index,
-+ up->fclun->device_type);
-+
-+ copy_info(info, "\n");
-+
-+ if (info->pos >= info->offset + info->length) {
-+ /* No need to continue */
-+ return;
-+ }
-+ }
-+
-+ if (info->pos >= info->offset + info->length) {
-+ /* No need to continue */
-+ break;
-+ }
-+ }
-+ LEAVE(__func__);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_proc_info
-+ * This routine return information to handle /proc support for the driver
-+ *
-+ * Input:
-+ * Output:
-+ * inout - Decides on the direction of the dataflow and the meaning of
-+ * the variables.
-+ * buffer - If inout==0 data is being written to it else read from
-+ * it (ptrs to a page buffer).
-+ * *start - If inout==0 start of the valid data in the buffer.
-+ * offset - If inout==0 offset from the beginning of the imaginary
-+ * file from which we start writing into the buffer.
-+ * length - If inout==0 max number of bytes to be written into the
-+ * buffer else number of bytes in the buffer.
-+ * hostno - Host number
-+ *
-+ * Remarks:
-+ * None
-+ *
-+ * Returns:
-+ * Size of proc buffer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
-+ off_t offset, int length, int inout)
-+{
-+ int retval = -EINVAL;
-+ scsi_qla_host_t *ha = NULL;
-+ struct info_str info;
-+ unsigned long flags;
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ srb_t *srb, *stemp;
-+#endif
-+
-+ QL4PRINT(QLP16, printk("scsi%d: Entering %s: buff_in=%p, "
-+ "offset=0x%lx, length=0x%x\n",
-+ shost->host_no, __func__, buffer, offset,
-+ length));
-+
-+ ha = (scsi_qla_host_t *) shost->hostdata;
-+
-+ if (inout) {
-+ /* Has data been written to the file? */
-+ QL4PRINT(QLP3, printk("scsi%d: %s: has data been written "
-+ "to the file. \n",
-+ ha->host_no, __func__));
-+ return(qla4xxx_set_info(buffer, length, ha->host));
-+ }
-+
-+ if (start) {
-+ *start = buffer;
-+ }
-+
-+ info.buffer = buffer;
-+ info.length = length;
-+ info.offset = offset;
-+ info.pos = 0;
-+
-+ /* start building the print buffer */
-+ copy_info(&info, "QLogic iSCSI Adapter for ISP %x:\n",
-+ ha->pdev->device);
-+ copy_info(&info, "Driver version %s\n", QLA4XXX_DRIVER_VERSION);
-+ copy_info(&info, "Firmware version %2d.%02d.%02d.%02d\n",
-+ ha->firmware_version[0], ha->firmware_version[1],
-+ ha->patch_number, ha->build_number);
-+ copy_info(&info, "Code starts at address = %p\n", qla4xxx_set_info);
-+
-+#if 0
-+ copy_info(&info, "MEDIA TYPE - %s\n",
-+ ((ha->addl_fw_state & FW_ADDSTATE_OPTICAL_MEDIA) !=
-+ 0) ? "OPTICAL" : "COPPER");
-+#endif
-+
-+ if (ha->mem_addr)
-+ copy_info(&info, "Memory I/O = 0x%lx\n", ha->mem_addr);
-+ else
-+ copy_info(&info, "I/O Port = 0x%lx\n", ha->io_addr);
-+
-+ copy_info(&info, "IP Address = %d.%d.%d.%d\n",
-+ ha->ip_address[0], ha->ip_address[1],
-+ ha->ip_address[2], ha->ip_address[3]);
-+
-+ if (ha->tcp_options & TOPT_ISNS_ENABLE) {
-+ copy_info(&info, "iSNS IP Address = %d.%d.%d.%d\n",
-+ ha->isns_ip_address[0], ha->isns_ip_address[1],
-+ ha->isns_ip_address[2], ha->isns_ip_address[3]);
-+ copy_info(&info, "iSNS Server Port# = %d\n",
-+ ha->isns_server_port_number);
-+ }
-+//FIXME: print both BUS (%llx) and virtual address (%p).
-+#if 0
-+ copy_info(&info, "ReqQ DMA= 0x%lx, virt= 0x%p, depth= 0x%x\n",
-+ (unsigned long)ha->request_dma, ha->request_ring, REQUEST_QUEUE_DEPTH);
-+ copy_info(&info, "ComplQ DMA= 0x%lx, virt= 0x%p, depth= 0x%x\n",
-+ (unsigned long)ha->response_dma, ha->response_ring, RESPONSE_QUEUE_DEPTH);
-+ copy_info(&info, "Shadow Regs DMA= 0x%lx, virt= 0x%p, size (bytes) = 0x%x\n",
-+ (unsigned long)ha->shadow_regs_dma, ha->shadow_regs, sizeof(shadow_regs_t));
-+ copy_info(&info, "PDU Buffer Addr= 0x%x, size (bytes) = 0x%x\n",
-+ ha->pdu_buffsv, ha->pdu_buff_size);
-+
-+ copy_info(&info, "Discovered Target Database Addr = 0x%x, size (bytes) = 0x%x\n",
-+ ha->isns_disc_tgt_databasev,
-+ sizeof(ha->isns_disc_tgt_databasev));
-+#endif
-+ copy_info(&info, "Number of free request entries = %d of %d\n",
-+ ha->req_q_count, REQUEST_QUEUE_DEPTH);
-+ copy_info(&info, "Number of free aen entries = %d of %d\n",
-+ ha->aen_q_count, MAX_AEN_ENTRIES);
-+ copy_info(&info, "Number of Mailbox Timeouts = %d\n",
-+ ha->mailbox_timeout_count);
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ copy_info(&info, "Interrupt Status = %d\n",
-+ RD_REG_DWORD(&ha->reg->ctrl_status));
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ copy_info(&info, "ReqQptr=%p, ReqIn=%d, ReqOut=%d\n",
-+ ha->request_ptr, ha->request_in, ha->request_out);
-+ copy_info(&info, "Device queue depth = 0x%x\n",
-+ (ql4xmaxqdepth == 0) ? 16 : ql4xmaxqdepth);
-+ copy_info(&info, "Adapter flags = 0x%x, DPC flags = 0x%x\n",
-+ ha->flags, ha->dpc_flags);
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ copy_info(&info, "Number of commands in retry_srb_q = %d\n",
-+ ha->retry_srb_q_count);
-+
-+ if (((ql_dbg_level & QLP16) != 0) && (ha->retry_srb_q_count)) {
-+ copy_info(&info, "\nDump retry_srb_q:\n");
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_entry_safe(srb, stemp, &ha->retry_srb_q,
-+ list_entry)
-+ qla4xxx_proc_dump_srb_info(ha, &info, srb);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ copy_info(&info, "\n");
-+ }
-+
-+ copy_info(&info, "Number of commands in done_srb_q = %d\n",
-+ ha->done_srb_q_count);
-+
-+ if (((ql_dbg_level & QLP16) != 0) && (ha->done_srb_q_count)) {
-+ copy_info(&info, "\nDump done_srb_q:\n");
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_entry_safe(srb, stemp, &ha->done_srb_q,
-+ list_entry)
-+ qla4xxx_proc_dump_srb_info(ha, &info, srb);
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ copy_info(&info, "\n");
-+ }
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha)) {
-+ copy_info(&info,
-+ "Number of reqs in failover_q= %d\n",
-+ ha->failover_cnt);
-+ }
-+#endif
-+#endif
-+
-+ copy_info(&info, "Dpc flags = 0x%lx\n", ha->dpc_flags);
-+
-+ copy_info(&info, "Number of active commands = %d\n",
-+ ha->active_srb_count);
-+
-+ if (((ql_dbg_level & QLP16) != 0) && (ha->active_srb_count)) {
-+ int i;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ copy_info(&info, "\nDump active commands:\n");
-+ for (i = 1; i < MAX_SRBS; i++) {
-+ srb_t *srb = ha->active_srb_array[i];
-+ if (srb)
-+ qla4xxx_proc_dump_srb_info(ha, &info, srb);
-+ }
-+ copy_info(&info, "\n");
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ }
-+
-+ copy_info(&info, "Total number of IOCBs (used/max) "
-+ "= (%d/%d)\n", ha->iocb_cnt, ha->iocb_hiwat);
-+ copy_info(&info, "Number of free srbs = %d of %d\n",
-+ ha->free_srb_q_count, ha->num_srbs_allocated);
-+ copy_info(&info, "\n");
-+
-+ qla4xxx_proc_dump_scanned_devices(ha, &info);
-+ copy_info(&info, "\n");
-+
-+ if (test_bit(ISNS_FLAG_ISNS_ENABLED_IN_ISP, &ha->isns_flags))
-+ qla4xxx_proc_dump_discovered_devices(ha, &info);
-+
-+ copy_info(&info, "\0");
-+
-+ retval = info.pos > info.offset ? info.pos - info.offset : 0;
-+
-+ QL4PRINT(QLP16, printk("scsi%d: Exiting %s: info.pos=%d, "
-+ "offset=0x%lx, length=0x%x\n",
-+ ha->host_no, __func__, info.pos, offset, length));
-+
-+ return(retval);
-+}
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+/**************************************************************************
-+ * qla4xxx_get_adapter_handle
-+ * This routine returns the adapter handle that corresponds to the
-+ * specified instance number.
-+ *
-+ * Input:
-+ * instance - Instance number of the desired host adapter.
-+ *
-+ * Returns:
-+ * Pointer to host adapter structure
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+scsi_qla_host_t *
-+qla4xxx_get_adapter_handle(uint16_t instance)
-+{
-+ scsi_qla_host_t *ha, *htemp;
-+
-+ read_lock(&qla4xxx_hostlist_lock);
-+ list_for_each_entry_safe(ha, htemp, &qla4xxx_hostlist, list) {
-+ if (ha->instance != instance)
-+ continue;
-+
-+ QL4PRINT(QLP3, printk("scsi%d: %s: handle (%p) for instance "
-+ "%d\n", ha->host_no, __func__, ha, instance));
-+
-+ read_unlock(&qla4xxx_hostlist_lock);
-+
-+ return (ha);
-+ }
-+ read_unlock(&qla4xxx_hostlist_lock);
-+
-+ QL4PRINT(QLP2, printk("scsi: %s: instance %d not found\n", __func__,
-+ instance));
-+
-+ return NULL;
-+}
-+#endif
-+
-+/**************************************************************************
-+ * del_from_active_array
-+ * This routine removes and returns the srb at the specified index
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * index - index into to the active_array
-+ *
-+ * Returns:
-+ * Pointer to corresponding SCSI Request Block
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+srb_t *
-+del_from_active_array(scsi_qla_host_t *ha, uint32_t index)
-+{
-+ srb_t *srb = NULL;
-+
-+ /* validate handle and remove from active array */
-+ if (index < MAX_SRBS) {
-+ srb = ha->active_srb_array[index];
-+ ha->active_srb_array[index] = 0;
-+
-+ if (srb) {
-+ // ddb_entry_t *ddb_entry =
-+ // qla4xxx_lookup_ddb_by_fw_index(ha,
-+ // srb->fw_ddb_index);
-+ os_lun_t *lun_entry = srb->lun_queue;
-+
-+ /* update counters */
-+ ha->req_q_count += srb->entry_count;
-+ ha->iocb_cnt -= srb->iocb_cnt;
-+ if (ha->active_srb_count)
-+ ha->active_srb_count--;
-+ // if (ddb_entry) ddb_entry->out_count--;
-+ if (lun_entry)
-+ lun_entry->out_count--;
-+ /* FIXMEdg: Is this needed ???? */
-+ srb->active_array_index = INVALID_ENTRY;
-+ if (srb->cmd)
-+ srb->cmd->host_scribble = NULL;
-+ }
-+ else
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: %s: array_index=%d "
-+ "already completed.\n",
-+ ha->host_no, __func__, index));
-+ }
-+ else
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: %s: array_index=%d "
-+ "exceeded max index of %d\n",
-+ ha->host_no, __func__, index, MAX_SRBS));
-+
-+ return(srb);
-+}
-+
-+uint16_t
-+qla4xxx_calc_request_entries(uint16_t dsds)
-+{
-+ uint16_t iocbs;/* number of request queue entries */
-+ /* (commamd + continue) */
-+ iocbs = 1;
-+ if (dsds > COMMAND_SEG) {
-+ iocbs += (dsds - COMMAND_SEG) / CONTINUE_SEG;
-+ if ((dsds - COMMAND_SEG) % CONTINUE_SEG)
-+ iocbs++;
-+ }
-+ return (iocbs);
-+}
-+
-+#ifdef QLA4XXX_NEW_SEND_IOS
-+void
-+qla4xxx_build_scsi_iocbs(srb_t *srb, COMMAND_ENTRY *cmd_entry, uint16_t tot_dsds)
-+{
-+ scsi_qla_host_t *ha;
-+ uint16_t avail_dsds;
-+ DATA_SEG_A64 *cur_dsd;
-+ struct scsi_cmnd *cmd;
-+
-+ cmd = srb->cmd;
-+ ha = srb->ha;
-+
-+ if (cmd->request_bufflen == 0 ||
-+ cmd->sc_data_direction == DMA_NONE) {
-+ /* No data being transferred */
-+ QL4PRINT(QLP5, printk("scsi%d:%d:%d:%d: %s: No data xfer\n",
-+ ha->host_no, cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__));
-+
-+ cmd_entry->ttlByteCnt = __constant_cpu_to_le32(0);
-+ return;
-+ }
-+
-+ avail_dsds = COMMAND_SEG;
-+ cur_dsd = (DATA_SEG_A64 *) &(cmd_entry->dataseg[0]);
-+
-+ /* Load data segments */
-+ if (cmd->use_sg) {
-+ struct scatterlist *cur_seg;
-+ struct scatterlist *end_seg;
-+
-+ /* Data transfer with Scatter/Gather
-+ *
-+ * We must build an SG list in adapter format, as the kernel's
-+ * SG list cannot be used directly because of data field size
-+ * (__alpha__) differences and the kernel SG list uses virtual
-+ * addresses where we need physical addresses.
-+ */
-+ cur_seg = (struct scatterlist *) cmd->request_buffer;
-+ end_seg = cur_seg + tot_dsds;
-+
-+ while (cur_seg < end_seg) {
-+ dma_addr_t sle_dma;
-+
-+ /* Allocate additional continuation packets? */
-+ if (avail_dsds == 0) {
-+ CONTINUE_ENTRY *cont_entry;
-+
-+ cont_entry = qla4xxx_alloc_cont_entry(ha);
-+ cur_dsd = (DATA_SEG_A64 *) &cont_entry->dataseg[0];
-+ avail_dsds = CONTINUE_SEG;
-+ }
-+
-+ sle_dma = sg_dma_address(cur_seg);
-+ cur_dsd->base.addrLow = cpu_to_le32(LSDW(sle_dma));
-+ cur_dsd->base.addrHigh = cpu_to_le32(MSDW(sle_dma));
-+ cur_dsd->count = cpu_to_le32(sg_dma_len(cur_seg));
-+ avail_dsds--;
-+
-+ QL4PRINT(QLP5|QLP24, printk("scsi%d:%d:%d:%d: %s: S/G "
-+ "DSD %p phys_addr=%x:%08x, len=0x%x, tot_dsd=0x%x, "
-+ "avail_dsd=0x%x\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__, cur_dsd,
-+ cur_dsd->base.addrHigh, cur_dsd->base.addrLow,
-+ cur_dsd->count, tot_dsds, avail_dsds));
-+
-+ cur_dsd++;
-+ cur_seg++;
-+ }
-+ } else {
-+ /* Data transfer without SG entries. */
-+ dma_addr_t req_dma;
-+ struct page *page;
-+ unsigned long offset;
-+
-+ page = virt_to_page(cmd->request_buffer);
-+ offset = ((unsigned long) cmd->request_buffer & ~PAGE_MASK);
-+ req_dma = pci_map_page(ha->pdev, page, offset,
-+ cmd->request_bufflen, cmd->sc_data_direction);
-+ srb->saved_dma_handle = req_dma;
-+
-+ cur_dsd->base.addrLow = cpu_to_le32(LSDW(req_dma));
-+ cur_dsd->base.addrHigh = cpu_to_le32(MSDW(req_dma));
-+ cur_dsd->count = cpu_to_le32(cmd->request_bufflen);
-+
-+ QL4PRINT(QLP5, printk("scsi%d:%d:%d:%d: %s: No S/G transfer, "
-+ "DSD=%p cmd=%p dma_addr=%x:%08x, len=%x, tot_dsd=0x%x, "
-+ "avail_dsd=0x%x\n", ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun, __func__, cur_dsd, cmd,
-+ cur_dsd->base.addrHigh, cur_dsd->base.addrLow,
-+ cur_dsd->count, tot_dsds, avail_dsds));
-+
-+ cur_dsd++;
-+ }
-+}
-+#endif
-+
-+#ifdef QLA4XXX_NEW_SEND_IOS
-+CONTINUE_ENTRY *
-+qla4xxx_alloc_cont_entry(scsi_qla_host_t *ha)
-+{
-+ CONTINUE_ENTRY *cont_entry;
-+ ENTER("qla4xxx_alloc_cont_entry");
-+
-+ cont_entry = (CONTINUE_ENTRY *)ha->request_ptr;
-+
-+ /* Advance request queue pointer */
-+ if (ha->request_in == (REQUEST_QUEUE_DEPTH - 1)) {
-+ ha->request_in = 0;
-+ ha->request_ptr = ha->request_ring;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: wraparound -- new "
-+ "request_in = %04x, new request_ptr = %p\n", ha->host_no,
-+ __func__, ha->request_in, ha->request_ptr));
-+ } else {
-+ ha->request_in++;
-+ ha->request_ptr++;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: new request_in = %04x, new "
-+ "request_ptr = %p\n", ha->host_no, __func__, ha->request_in,
-+ ha->request_ptr));
-+ }
-+
-+ /* Load packet defaults */
-+ cont_entry->hdr.entryType = ET_CONTINUE;
-+ cont_entry->hdr.entryCount = 1;
-+ cont_entry->hdr.systemDefined =
-+ (uint8_t) cpu_to_le16(ha->request_in);
-+
-+ LEAVE("qla4xxx_alloc_cont_entry");
-+ return(cont_entry);
-+}
-+#else
-+inline uint8_t
-+qla4xxx_alloc_cont_entry(scsi_qla_host_t *ha,
-+ DATA_SEG_A64 **cur_dsd,
-+ uint16_t *avail_dsds)
-+{
-+ CONTINUE_ENTRY *cont_entry;
-+ ENTER("qla4xxx_alloc_cont_entry");
-+
-+ /* Get request queue entry and adjust ring index. */
-+ if (qla4xxx_get_req_pkt(ha, (QUEUE_ENTRY **) &cont_entry) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: Unable to allocate "
-+ "continuation packet\n",
-+ ha->host_no, __func__));
-+
-+ LEAVE("qla4xxx_alloc_cont_entry");
-+ return(QLA_ERROR);
-+ }
-+
-+ cont_entry->hdr.entryType = ET_CONTINUE;
-+ cont_entry->hdr.entryCount = 1;
-+ cont_entry->hdr.systemDefined =
-+ (uint8_t) cpu_to_le16(ha->request_in);
-+ *cur_dsd = (DATA_SEG_A64 *) &cont_entry->dataseg[0];
-+ *avail_dsds = CONTINUE_SEG;
-+
-+ LEAVE("qla4xxx_alloc_cont_entry");
-+ return(QLA_SUCCESS);
-+}
-+
-+#endif
-+
-+#ifdef QLA4XXX_NEW_SEND_IOS
-+/**************************************************************************
-+ * qla4xxx_send_command_to_isp
-+ * This routine is called by qla4xxx_queuecommand to build an ISP
-+ * command and pass it to the ISP for execution.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * srb - pointer to SCSI Request Block to be sent to ISP
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully sent command to ISP
-+ * QLA_ERROR - Failed to send command to ISP
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_send_command_to_isp(scsi_qla_host_t *os_ha, srb_t *srb)
-+{
-+ struct scsi_cmnd *cmd = srb->cmd;
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+ COMMAND_ENTRY *cmd_entry;
-+ struct scatterlist *sg;
-+
-+ uint16_t tot_dsds; /* number of data segments */
-+ /* (sg entries, if sg request) */
-+ uint16_t req_cnt; /* number of request queue entries */
-+
-+ unsigned long flags;
-+ uint16_t cnt;
-+ uint16_t i;
-+ uint32_t index;
-+ uint8_t found = 0;
-+ fc_lun_t *fclun;
-+ scsi_qla_host_t *ha;
-+ char tag[2];
-+
-+ ENTER("qla4xxx_send_command_to_isp");
-+
-+ /* Get real lun and adapter */
-+ fclun = srb->lun_queue->fclun;
-+ ha = fclun->fcport->ha;
-+
-+ cmd = srb->cmd;
-+ ddb_entry = fclun->fcport->ddbptr;
-+ lun_entry = srb->lun_queue;
-+
-+ /* Send marker(s) if needed. */
-+ if (ha->marker_needed == 1) {
-+ if (qla4xxx_send_marker_iocb(ha, ddb_entry, fclun) !=
-+ QLA_SUCCESS) {
-+ return(QLA_ERROR);
-+ }
-+ }
-+ ha->marker_needed = 0;
-+
-+ /* Acquire hardware specific lock */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ /* Check for room in active srb array */
-+ index = ha->current_active_index;
-+ for (i = 0; i < MAX_SRBS; i++) {
-+ index++;
-+ if (index == MAX_SRBS)
-+ index = 1;
-+ if (ha->active_srb_array[index] == 0) {
-+ found = 1;
-+ ha->current_active_index = index;
-+ break;
-+ }
-+ }
-+ if (!found) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d:%d: %s: no room in active "
-+ "array, try again later\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun,
-+ __func__));
-+
-+ goto exit_send_cmd;
-+ }
-+
-+ /* Calculate the number of request entries needed. */
-+ req_cnt = qla4xxx_calc_request_entries(cmd->request->nr_hw_segments);
-+ if (ha->req_q_count < (req_cnt + 2)) {
-+ cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha));
-+ if (ha->request_in < cnt)
-+ ha->req_q_count = cnt - ha->request_in;
-+ else
-+ ha->req_q_count = REQUEST_QUEUE_DEPTH /*ha->request_q_length*/ -
-+ (ha->request_in - cnt);
-+ }
-+ if (ha->req_q_count < (req_cnt + 2))
-+ goto exit_send_cmd;
-+
-+ /* check for request queue full */
-+ if ((ha->iocb_cnt + req_cnt) >= ha->iocb_hiwat) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: request queue is full, "
-+ "iocb_cnt=%d, iocb_hiwat=%d, need %d\n", ha->host_no,
-+ __func__, ha->iocb_cnt, ha->iocb_hiwat, req_cnt));
-+ goto exit_send_cmd;
-+ }
-+
-+ /* Finally, we have enough space, now perform mappings. */
-+ tot_dsds = 0;
-+ if (cmd->use_sg) {
-+ sg = (struct scatterlist *) cmd->request_buffer;
-+ tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
-+ cmd->sc_data_direction);
-+ if (tot_dsds == 0)
-+ goto exit_send_cmd;
-+ } else if (cmd->request_bufflen) {
-+ tot_dsds++;
-+ }
-+ req_cnt = qla4xxx_calc_request_entries(tot_dsds);
-+
-+ /* Build command entry packet to send to ISP. */
-+ cmd_entry = (COMMAND_ENTRY *) ha->request_ptr;
-+ cmd_entry->hdr.entryType = ET_COMMAND;
-+ cmd_entry->handle = cpu_to_le32(index);
-+ cmd_entry->target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ cmd_entry->connection_id = cpu_to_le16(ddb_entry->connection_id);
-+ cmd_entry->lun[1] = LSB(cmd->device->lun); /* SAMII compliant. */
-+ cmd_entry->lun[2] = MSB(cmd->device->lun);
-+ cmd_entry->cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+ cmd_entry->ttlByteCnt = cpu_to_le32(cmd->request_bufflen);
-+ memcpy(cmd_entry->cdb, cmd->cmnd, MIN(MAX_COMMAND_SIZE, cmd->cmd_len));
-+ cmd_entry->dataSegCnt = cpu_to_le16(tot_dsds);
-+ cmd_entry->hdr.entryCount = srb->entry_count = req_cnt;
-+
-+ /* Set firmware timeout to [target_mgmt_timeout + IOCB_TOV_MARGIN]
-+ * seconds less than OS timeout.
-+ * We want the firmware to time out the command first
-+ */
-+ cmd_entry->timeout = (cmd->timeout_per_command / HZ)
-+ - (QLA_CMD_TIMER_DELTA+1);
-+ if (cmd_entry->timeout > ddb_entry->task_mgmt_timeout + IOCB_TOV_MARGIN)
-+ cmd_entry->timeout -=
-+ (ddb_entry->task_mgmt_timeout + IOCB_TOV_MARGIN);
-+ cmd_entry->timeout = cpu_to_le16(cmd_entry->timeout);
-+
-+ srb->iocb_tov = cmd_entry->timeout;
-+ srb->os_tov = cmd->timeout_per_command / HZ;
-+
-+ QL4PRINT(QLP10, printk("scsi%d:%d:%d:%d: %s: timeout set to %d "
-+ "seconds, \n", ha->host_no, cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__, cmd_entry->timeout));
-+
-+ /* Set data transfer direction control flags
-+ * NOTE: Look at data_direction bits iff there is data to be
-+ * transferred, as the data direction bit is sometimed filled
-+ * in when there is no data to be transferred */
-+ cmd_entry->control_flags = CF_NO_DATA;
-+ if (cmd->request_bufflen) {
-+ if (cmd->sc_data_direction == DMA_TO_DEVICE)
-+ cmd_entry->control_flags = CF_WRITE;
-+ else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
-+ cmd_entry->control_flags = CF_READ;
-+ }
-+
-+ /* Set tagged queueing control flags */
-+ cmd_entry->control_flags |= CF_SIMPLE_TAG;
-+ if (scsi_populate_tag_msg(cmd, tag)) {
-+ switch (tag[0]) {
-+ case MSG_HEAD_TAG:
-+ cmd_entry->control_flags |= CF_HEAD_TAG;
-+ break;
-+ case MSG_ORDERED_TAG:
-+ cmd_entry->control_flags |= CF_ORDERED_TAG;
-+ break;
-+ }
-+ }
-+
-+ /* Advance request queue pointer */
-+ if (ha->request_in == (REQUEST_QUEUE_DEPTH - 1)) {
-+ ha->request_in = 0;
-+ ha->request_ptr = ha->request_ring;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: wraparound -- new "
-+ "request_in = %04x, new request_ptr = %p\n", ha->host_no,
-+ __func__, ha->request_in, ha->request_ptr));
-+ } else {
-+ ha->request_in++;
-+ ha->request_ptr++;
-+ QL4PRINT(QLP10, printk("scsi%d: %s: new request_in = %04x, new "
-+ "request_ptr = %p\n", ha->host_no, __func__, ha->request_in,
-+ ha->request_ptr));
-+ }
-+
-+ qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
-+
-+ wmb();
-+
-+ /* put command in active array */
-+ ha->active_srb_array[index] = srb;
-+ srb->cmd->host_scribble = (unsigned char *)(unsigned long)index;
-+
-+ /* update counters */
-+ ha->active_srb_count++;
-+ ha->req_q_count -= srb->entry_count;
-+ ddb_entry->out_count++;
-+ lun_entry->out_count++;
-+ lun_entry->tot_io_count++;
-+ srb->active_array_index = index;
-+ srb->state = SRB_ACTIVE_STATE;
-+ srb->flags |= SRB_DMA_VALID;
-+
-+ /* Track IOCB used */
-+ ha->iocb_cnt += req_cnt;
-+ srb->iocb_cnt = req_cnt;
-+
-+ /* Debug print statements */
-+#ifdef QL_DEBUG_LEVEL_3
-+ QL4PRINT(QLP14, printk("scsi%d:%d:%d:%d: %s: CDB = ", ha->host_no,
-+ cmd->device->channel, cmd->device->target, cmd->device->lun,
-+ __func__));
-+ for (i = 0; i < cmd->cmd_len; i++)
-+ QL4PRINT(QLP14, printk("%02x ", cmd->cmnd[i]));
-+ QL4PRINT(QLP14, printk("\n"));
-+
-+ QL4PRINT(QLP5, printk("scsi%d: %s: srb=%p, srb->index=0x%x, "
-+ "cmd_entry->handle=0x%x "
-+ "tot_dsds=%d, req_cnt=%d\n",
-+ ha->host_no, __func__, srb,
-+ srb->active_array_index,
-+ cmd_entry->handle,
-+ tot_dsds, req_cnt));
-+
-+ QL4PRINT(QLP10|QLP24, printk("scsi%d: %s: cmd_entry 0x%p\n",
-+ ha->host_no, __func__, cmd_entry));
-+ qla4xxx_dump_bytes(QLP10|QLP24, cmd_entry, sizeof(*cmd_entry));
-+
-+ for (i=1; i<=req_cnt-1; i++) {
-+ CONTINUE_ENTRY *cont_entry = (CONTINUE_ENTRY *) cmd_entry+i;
-+ QL4PRINT(QLP10|QLP24,
-+ printk("\nscsi%d: %s: cont_entry 0x%p\n",
-+ ha->host_no, __func__, cont_entry));
-+ qla4xxx_dump_bytes(QLP10|QLP24,
-+ cont_entry, sizeof(*cont_entry));
-+ }
-+
-+ /* Tell ISP that there's a new request */
-+ QL4PRINT(QLP5, printk("scsi%d: %s: RequestQueueIn %x\n",
-+ ha->host_no, __func__, ha->request_in));
-+#endif
-+
-+ srb->u_start = jiffies;
-+ ha->f_start = srb->u_start;
-+ WRT_REG_DWORD(&ha->reg->req_q_in, ha->request_in);
-+ PCI_POSTING(&ha->reg->req_q_in);
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_send_command_to_isp");
-+
-+ return(QLA_SUCCESS);
-+
-+exit_send_cmd:
-+ /* Release hardware specific lock */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_send_command_to_isp");
-+
-+ return(QLA_ERROR);
-+}
-+#else
-+/**************************************************************************
-+ * qla4xxx_send_command_to_isp
-+ * This routine is called by qla4xxx_queuecommand to build an ISP
-+ * command and pass it to the ISP for execution.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * srb - pointer to SCSI Request Block to be sent to ISP
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully sent command to ISP
-+ * QLA_ERROR - Failed to send command to ISP
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_send_command_to_isp(scsi_qla_host_t *os_ha, srb_t *srb)
-+{
-+ struct scsi_cmnd *cmd = srb->cmd;
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+ COMMAND_ENTRY *cmd_entry;
-+ uint16_t saved_request_in;
-+ QUEUE_ENTRY *saved_request_ptr;
-+
-+ uint16_t avail_dsds;
-+ DATA_SEG_A64 *cur_dsd;
-+ uint16_t tot_dsds; /* number of data segments */
-+ /* (sg entries, if sg request) */
-+
-+ uint8_t tot_iocbs;/* number of request queue entries */
-+ /* (commamd + continue) */
-+ unsigned long flags;
-+ uint16_t i;
-+ uint32_t index;
-+ uint8_t found = 0;
-+ fc_lun_t *fclun;
-+ scsi_qla_host_t *ha;
-+ char tag[2];
-+
-+ ENTER("qla4xxx_send_command_to_isp");
-+
-+ /* Get real lun and adapter */
-+ fclun = srb->lun_queue->fclun;
-+ ha = fclun->fcport->ha;
-+
-+ /* FIXME: Where are we checking the iocb count? The f/w can only accept
-+ * a max number of IOCB and mailbox commands.
-+ */
-+ cmd = srb->cmd;
-+ ddb_entry = fclun->fcport->ddbptr;
-+ lun_entry = srb->lun_queue;
-+
-+ /* Send marker(s) if needed. */
-+ if (ha->marker_needed == 1) {
-+ if (qla4xxx_send_marker_iocb(ha, ddb_entry, fclun) !=
-+ QLA_SUCCESS) {
-+ return(QLA_ERROR);
-+ }
-+ }
-+ ha->marker_needed = 0;
-+
-+ /* Acquire hardware specific lock */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ /* Save some variables to undo things if an error occurs */
-+ saved_request_in = ha->request_in;
-+ saved_request_ptr = ha->request_ptr;
-+
-+ tot_dsds = 0;
-+ tot_iocbs = 1;
-+ avail_dsds = COMMAND_SEG;
-+
-+ /* Get request queue entry and adjust ring index. */
-+ if (qla4xxx_get_req_pkt(ha, (QUEUE_ENTRY **) &cmd_entry) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d:%d: %s: request queue is "
-+ "full, try again later\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun,
-+ __func__));
-+
-+ goto exit_send_cmd;
-+ }
-+
-+ /* Check for room in active srb array */
-+ index = ha->current_active_index;
-+ for (i = 0; i < MAX_SRBS; i++) {
-+ index++;
-+ if (index == MAX_SRBS)
-+ index = 1;
-+ if (ha->active_srb_array[index] == 0) {
-+ found = 1;
-+ ha->current_active_index = index;
-+ break;
-+ }
-+ }
-+ if (!found) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d:%d: %s: no room in active "
-+ "array, try again later\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun,
-+ __func__));
-+
-+ goto exit_send_cmd_return_request;
-+ }
-+
-+ /* Build command entry packet to send to ISP. */
-+ /* If in connection mode, bump sequence number */
-+ if ((ha->firmware_options & FWOPT_SESSION_MODE) != 0)
-+ ddb_entry->CmdSn++;
-+
-+ cmd_entry->hdr.entryType = ET_COMMAND;
-+ cmd_entry->handle = cpu_to_le32(index);
-+ cmd_entry->target = cpu_to_le16(ddb_entry->fw_ddb_index);
-+ cmd_entry->connection_id = cpu_to_le16(ddb_entry->connection_id);
-+ cmd_entry->lun[1] = LSB(cmd->device->lun); /* SAMII compliant. */
-+ cmd_entry->lun[2] = MSB(cmd->device->lun);
-+ cmd_entry->cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
-+ cmd_entry->ttlByteCnt = cpu_to_le32(cmd->request_bufflen);
-+ memcpy(cmd_entry->cdb, cmd->cmnd, MIN(MAX_COMMAND_SIZE, cmd->cmd_len));
-+
-+ /* Set firmware timeout to [target_mgmt_timeout + IOCB_TOV_MARGIN]
-+ * seconds less than OS timeout.
-+ * We want the firmware to time out the command first */
-+ cmd_entry->timeout = (cmd->timeout_per_command / HZ)
-+ - (QLA_CMD_TIMER_DELTA+1);
-+ if (cmd_entry->timeout > ddb_entry->task_mgmt_timeout + IOCB_TOV_MARGIN)
-+ cmd_entry->timeout -=
-+ (ddb_entry->task_mgmt_timeout + IOCB_TOV_MARGIN);
-+ cmd_entry->timeout = cpu_to_le16(cmd_entry->timeout);
-+
-+ srb->iocb_tov = cmd_entry->timeout;
-+ srb->os_tov = cmd->timeout_per_command / HZ;
-+
-+ QL4PRINT(QLP10, printk("scsi%d:%d:%d:%d: %s: timeout set to %d "
-+ "seconds, \n", ha->host_no, cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__, cmd_entry->timeout));
-+
-+ /* Set data transfer direction control flags
-+ * NOTE: Look at data_direction bits iff there is data to be
-+ * transferred, as the data direction bit is sometimed filled
-+ * in when there is no data to be transferred */
-+ cmd_entry->control_flags = CF_NO_DATA;
-+ if (cmd->request_bufflen) {
-+ if (cmd->sc_data_direction == DMA_TO_DEVICE)
-+ cmd_entry->control_flags = CF_WRITE;
-+ else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
-+ cmd_entry->control_flags = CF_READ;
-+ }
-+
-+ /* Set tagged queueing control flags */
-+ cmd_entry->control_flags |= CF_SIMPLE_TAG;
-+ if (scsi_populate_tag_msg(cmd, tag)) {
-+ switch (tag[0]) {
-+ case MSG_HEAD_TAG:
-+ cmd_entry->control_flags |= CF_HEAD_TAG;
-+ break;
-+ case MSG_ORDERED_TAG:
-+ cmd_entry->control_flags |= CF_ORDERED_TAG;
-+ break;
-+ }
-+ }
-+
-+ /* Set data segments and byte counts */
-+ cur_dsd = (DATA_SEG_A64 *) &(cmd_entry->dataseg[0]);
-+ if (cmd->request_bufflen == 0 ||
-+ cmd->sc_data_direction == DMA_NONE) {
-+ /* No data being transferred */
-+ QL4PRINT(QLP5, printk("scsi%d:%d:%d:%d: %s: No data xfer\n",
-+ ha->host_no, cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__));
-+
-+ tot_dsds = 0;
-+ cmd_entry->ttlByteCnt = __constant_cpu_to_le32(0);
-+ } else if (cmd->use_sg) {
-+ struct scatterlist *cur_seg;
-+ struct scatterlist *end_seg;
-+ int nseg;
-+
-+ /* Data transfer with Scatter/Gather
-+ *
-+ * We must build an SG list in adapter format, as the kernel's
-+ * SG list cannot be used directly because of data field size
-+ * (__alpha__) differences and the kernel SG list uses virtual
-+ * addresses where we need physical addresses.
-+ */
-+ cur_seg = (struct scatterlist *) cmd->request_buffer;
-+ nseg = pci_map_sg(ha->pdev, cur_seg, cmd->use_sg,
-+ cmd->sc_data_direction);
-+ if (nseg == 0)
-+ goto exit_send_cmd;
-+ end_seg = cur_seg + nseg;
-+
-+ while (cur_seg < end_seg) {
-+ dma_addr_t sle_dma;
-+
-+ /* Allocate additional continuation packets? */
-+ if (avail_dsds == 0) {
-+ tot_iocbs++;
-+ if (qla4xxx_alloc_cont_entry(ha, &cur_dsd,
-+ &avail_dsds) == QLA_ERROR) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d:%d:%d:%d: %s: "
-+ "request queue full, "
-+ "unmap sg, try again "
-+ "later\n", ha->host_no,
-+ cmd->device->channel,
-+ cmd->device->id,
-+ cmd->device->lun,
-+ __func__));
-+
-+ goto exit_send_cmd_return_dma;
-+ }
-+ }
-+
-+ sle_dma = sg_dma_address(cur_seg);
-+ cur_dsd->base.addrLow = cpu_to_le32(LSDW(sle_dma));
-+ cur_dsd->base.addrHigh = cpu_to_le32(MSDW(sle_dma));
-+ cur_dsd->count = cpu_to_le32(sg_dma_len(cur_seg));
-+ tot_dsds++;
-+ avail_dsds--;
-+
-+ QL4PRINT(QLP5|QLP24, printk("scsi%d:%d:%d:%d: %s: S/G "
-+ "DSD %p phys_addr=%x:%08x, len=0x%x, tot_dsd=0x%x, "
-+ "avail_dsd=0x%x\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__, cur_dsd,
-+ cur_dsd->base.addrHigh, cur_dsd->base.addrLow,
-+ cur_dsd->count, tot_dsds, avail_dsds));
-+
-+ cur_dsd++;
-+ cur_seg++;
-+ }
-+ } else {
-+ /* Data transfer without SG entries. */
-+ dma_addr_t req_dma;
-+ struct page *page;
-+ unsigned long offset;
-+
-+ page = virt_to_page(cmd->request_buffer);
-+ offset = ((unsigned long) cmd->request_buffer & ~PAGE_MASK);
-+ req_dma = pci_map_page(ha->pdev, page, offset,
-+ cmd->request_bufflen, cmd->sc_data_direction);
-+ srb->saved_dma_handle = req_dma;
-+ if (!srb->saved_dma_handle) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d:%d: %s: pci "
-+ "mapping failed!, try again later\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id,
-+ cmd->device->lun, __func__));
-+
-+ goto exit_send_cmd_return_dma;
-+ }
-+
-+ cur_dsd->base.addrLow = cpu_to_le32(LSDW(req_dma));
-+ cur_dsd->base.addrHigh = cpu_to_le32(MSDW(req_dma));
-+ cur_dsd->count = cpu_to_le32(cmd->request_bufflen);
-+ tot_dsds++;
-+ avail_dsds--;
-+
-+ QL4PRINT(QLP5, printk("scsi%d:%d:%d:%d: %s: No S/G transfer, "
-+ "DSD=%p cmd=%p dma_addr=%x:%08x, len=%x, tot_dsd=0x%x, "
-+ "avail_dsd=0x%x\n", ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun, __func__, cur_dsd, cmd,
-+ cur_dsd->base.addrHigh, cur_dsd->base.addrLow,
-+ cur_dsd->count, tot_dsds, avail_dsds));
-+
-+ cur_dsd++;
-+ }
-+
-+ cmd_entry->dataSegCnt = cpu_to_le16(tot_dsds);
-+ cmd_entry->hdr.entryCount = srb->entry_count = tot_iocbs;
-+ wmb();
-+
-+ /* put command in active array */
-+ ha->active_srb_array[index] = srb;
-+ srb->cmd->host_scribble = (unsigned char *)(unsigned long)index;
-+
-+ /* update counters */
-+ ha->active_srb_count++;
-+ ha->req_q_count -= srb->entry_count;
-+ ddb_entry->out_count++;
-+ lun_entry->out_count++;
-+ lun_entry->tot_io_count++;
-+ srb->active_array_index = index;
-+ srb->state = SRB_ACTIVE_STATE;
-+ srb->flags |= SRB_DMA_VALID;
-+
-+ /* Track IOCB used */
-+ ha->iocb_cnt += tot_iocbs;
-+ srb->iocb_cnt = tot_iocbs;
-+
-+ /* Debug print statements */
-+#ifdef QL_DEBUG_LEVEL_3
-+ QL4PRINT(QLP14, printk("scsi%d:%d:%d:%d: %s: CDB = ", ha->host_no,
-+ cmd->device->channel, cmd->device->target, cmd->device->lun,
-+ __func__));
-+ for (i = 0; i < cmd->cmd_len; i++)
-+ QL4PRINT(QLP14, printk("%02x ", cmd->cmnd[i]));
-+ QL4PRINT(QLP14, printk("\n"));
-+
-+ QL4PRINT(QLP5, printk("scsi%d: %s: srb=%p, srb->index=0x%x, "
-+ "cmd_entry->handle=0x%x "
-+ "tot_dsds=%d, tot_iocbs=%d\n",
-+ ha->host_no, __func__, srb,
-+ srb->active_array_index,
-+ cmd_entry->handle,
-+ tot_dsds, tot_iocbs));
-+
-+ QL4PRINT(QLP10|QLP24, printk("scsi%d: %s: cmd_entry 0x%p\n",
-+ ha->host_no, __func__, cmd_entry));
-+ qla4xxx_dump_bytes(QLP10|QLP24, cmd_entry, sizeof(*cmd_entry));
-+
-+ for (i=1; i<=tot_iocbs-1; i++) {
-+ CONTINUE_ENTRY *cont_entry = (CONTINUE_ENTRY *) cmd_entry+i;
-+ QL4PRINT(QLP10|QLP24,
-+ printk("\nscsi%d: %s: cont_entry 0x%p\n",
-+ ha->host_no, __func__, cont_entry));
-+ qla4xxx_dump_bytes(QLP10|QLP24,
-+ cont_entry, sizeof(*cont_entry));
-+ }
-+
-+ /* Tell ISP that there's a new request */
-+ QL4PRINT(QLP5, printk("scsi%d: %s: RequestQueueIn %x\n",
-+ ha->host_no, __func__, ha->request_in));
-+#endif
-+
-+ srb->u_start = jiffies;
-+ ha->f_start = srb->u_start;
-+ WRT_REG_DWORD(&ha->reg->req_q_in, ha->request_in);
-+ PCI_POSTING(&ha->reg->req_q_in);
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_send_command_to_isp");
-+
-+ return(QLA_SUCCESS);
-+
-+exit_send_cmd_return_dma:
-+ /* Unmap srb dma buffer */
-+ pci_unmap_sg(ha->pdev, (struct scatterlist *)cmd->request_buffer,
-+ cmd->use_sg, cmd->sc_data_direction);
-+
-+exit_send_cmd_return_request:
-+ /* restore request queue in pointers */
-+ ha->request_in = saved_request_in;
-+ ha->request_ptr = saved_request_ptr;
-+
-+exit_send_cmd:
-+ /* Release hardware specific lock */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE("qla4xxx_send_command_to_isp");
-+
-+ return(QLA_ERROR);
-+}
-+
-+#endif
-+
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+/**************************************************************************
-+* qla4xxx_done
-+* Process completed commands.
-+*
-+* Input:
-+* old_ha = adapter block pointer.
-+*
-+* Returns:
-+* int
-+**************************************************************************/
-+int
-+qla4xxx_done(scsi_qla_host_t *old_ha)
-+{
-+ os_lun_t *lq;
-+ struct scsi_cmnd *cmd;
-+ unsigned long flags = 0;
-+ scsi_qla_host_t *ha;
-+ scsi_qla_host_t *vis_ha;
-+ int cnt;
-+ srb_t *srb, *stemp;
-+ struct list_head local_sp_list;
-+
-+ ENTER(__func__);
-+
-+ cnt = 0;
-+
-+ INIT_LIST_HEAD(&local_sp_list);
-+
-+ /*
-+ * Get into local queue such that we do not wind up calling done queue
-+ * takslet for the same IOs from DPC or any other place.
-+ */
-+ spin_lock_irqsave(&old_ha->list_lock,flags);
-+ list_splice_init(&old_ha->done_srb_q, &local_sp_list);
-+ spin_unlock_irqrestore(&old_ha->list_lock, flags);
-+
-+ list_for_each_entry_safe(srb, stemp, &local_sp_list, list_entry) {
-+ old_ha->done_srb_q_count--;
-+ srb->state = SRB_NO_QUEUE_STATE;
-+ list_del_init(&srb->list_entry);
-+
-+ cnt++;
-+
-+ cmd = srb->cmd;
-+ if (cmd == NULL) {
-+#if 0
-+ panic("qla4xxx_done: SP %p already freed - %s %d.\n",
-+ srb, __FILE__,__LINE__);
-+#else
-+ continue;
-+#endif
-+ }
-+
-+ vis_ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
-+ lq = srb->lun_queue;
-+#if 1
-+ if( lq == NULL ) {
-+ DEBUG2(printk("qla4xxx_done: lq == NULL , sp= %p, %s %d \n",
-+ srb, __FILE__,__LINE__);)
-+ continue;
-+ }
-+ if( lq->fclun == NULL ) {
-+ DEBUG2(printk("qla4xxx_done: lq->fclun == NULL , sp=%p %s %d \n",
-+ srb,__FILE__,__LINE__);)
-+ continue;
-+ }
-+ if( lq->fclun->fcport == NULL ) {
-+ DEBUG2(printk("qla4xxx_done: lq->fclun->fcport == NULL , sp=%p %s %d \n",
-+ srb,__FILE__,__LINE__);)
-+ continue;
-+ }
-+#endif
-+ ha = srb->ha;
-+ /* Release memory used for this I/O */
-+ if ((srb->flags & SRB_DMA_VALID) != 0) {
-+ srb->flags &= ~SRB_DMA_VALID;
-+
-+ /* Release memory used for this I/O */
-+ if (cmd->use_sg) {
-+ pci_unmap_sg(ha->pdev,
-+ cmd->request_buffer,
-+ cmd->use_sg,
-+ cmd->sc_data_direction);
-+ } else if (cmd->request_bufflen) {
-+ pci_unmap_page(ha->pdev,
-+ srb->saved_dma_handle,
-+ cmd->request_bufflen,
-+ cmd->sc_data_direction);
-+ }
-+
-+ ha->total_mbytes_xferred += cmd->request_bufflen / 1024;
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ // qla4xxx_do_fo_check(ha, sp, vis_ha);
-+ if (!(srb->flags & (SRB_TAPE)) &&
-+ qla4xxx_failover_enabled(ha)) {
-+ /*
-+ * This routine checks for DID_NO_CONNECT to decide
-+ * whether to failover to another path or not. We only
-+ * failover on selection timeout(DID_NO_CONNECT) status.
-+ */
-+ if (!(lq->fclun->fcport->flags &
-+ FCF_FAILOVER_DISABLE) &&
-+ !(lq->fclun->flags & FLF_VISIBLE_LUN) &&
-+ qla4xxx_fo_check(ha,srb)) {
-+ if ((srb->state != SRB_FAILOVER_STATE)) {
-+ /*
-+ * Retry the command on this path
-+ * several times before selecting a new
-+ * path.
-+ */
-+ // qla4xxx_complete_request(vis_ha,srb);
-+ qla4xxx_start_fo_cmd(vis_ha, srb);
-+ }
-+ else {
-+ /* we failover this path */
-+ qla4xxx_extend_timeout(srb->cmd,
-+ EXTEND_CMD_TOV);
-+ }
-+ continue;
-+ }
-+
-+ }
-+#endif
-+ qla4xxx_complete_request(vis_ha, srb);
-+
-+ } /* end of while */
-+
-+ LEAVE(__func__);
-+
-+ return(cnt);
-+}
-+#endif
-+
-+/**************************************************************************
-+ * qla4xxx_request_cleanup
-+ * This routine frees resources for a command that
-+ * didn't get completed.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * srb - Pointer to SCSI Request Block
-+ *
-+ * Remarks:
-+ * The srb pointer should be guaranteed to be nonzero before calling
-+ * this function. The caller should also ensure that the list_lock is
-+ * released before calling this function.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_request_cleanup(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ struct scsi_cmnd *cmd;
-+
-+ qla4xxx_delete_timer_from_cmd(srb);
-+
-+ cmd = srb->cmd;
-+ /* Let abort handler know we are completing the command */
-+ CMD_SP(cmd) = NULL;
-+
-+ /* Release memory used for this I/O */
-+ if ( (srb->flags & SRB_DMA_VALID) ) {
-+ srb->flags &= ~SRB_DMA_VALID;
-+
-+ /* Release memory used for this I/O */
-+ if (cmd->use_sg) {
-+ pci_unmap_sg(ha->pdev,
-+ cmd->request_buffer,
-+ cmd->use_sg,
-+ cmd->sc_data_direction);
-+ }
-+ else if (cmd->request_bufflen) {
-+ pci_unmap_page(ha->pdev,
-+ srb->saved_dma_handle,
-+ cmd->request_bufflen,
-+ srb->cmd->sc_data_direction);
-+ }
-+ }
-+
-+ srb->cmd = NULL;
-+ add_to_free_srb_q(ha, srb);
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_complete_request
-+ * This routine returns a command to the caller via the done_fn
-+ * specified in the cmd structure.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * srb - Pointer to SCSI Request Block
-+ *
-+ * Remarks:
-+ * The srb pointer should be guaranteed to be nonzero before calling
-+ * this function. The caller should also ensure that the list_lock is
-+ * released before calling this function.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully completed request
-+ * QLA_ERROR - Failed to complete request
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_complete_request(scsi_qla_host_t *ha, srb_t *srb)
-+{
-+ uint8_t status = QLA_ERROR;
-+ struct scsi_cmnd *cmd;
-+ unsigned long flags;
-+
-+ //ENTER("qla4xxx_complete_request");
-+ /* Make sure the cmd pointer is valid */
-+ if (srb == NULL) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: ERROR: NULL srb \n",
-+ ha->host_no, __func__));
-+ goto exit_complete_request;
-+ }
-+ /* FIXMEdg: Why do we need this check?? */
-+ if ((srb->flags & SRB_FREE_STATE) == 0)
-+ qla4xxx_delete_timer_from_cmd(srb);
-+
-+ cmd = srb->cmd;
-+ if (cmd == NULL) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: ERROR: NULL cmd pointer in "
-+ "srb=%p\n", ha->host_no, __func__, srb));
-+
-+ goto exit_complete_request;
-+ }
-+
-+ /* Let abort handler know we are completing the command */
-+ CMD_SP(cmd) = NULL;
-+
-+
-+ /* Release memory used for this I/O */
-+ if ((srb->flags & SRB_DMA_VALID) != 0) {
-+ srb->flags &= ~SRB_DMA_VALID;
-+
-+ /* Release memory used for this I/O */
-+ if (cmd->use_sg) {
-+ QL4PRINT(QLP5,
-+ printk("scsi%d: %s: S/G unmap_sg cmd=%p\n",
-+ ha->host_no, __func__, cmd));
-+
-+ pci_unmap_sg(ha->pdev,
-+ cmd->request_buffer,
-+ cmd->use_sg,
-+ cmd->sc_data_direction);
-+ }
-+ else if (cmd->request_bufflen) {
-+ QL4PRINT(QLP5,
-+ printk("scsi%d: %s: No S/G unmap_single "
-+ "cmd=%p saved_dma_handle=%x\n",
-+ ha->host_no, __func__, cmd,
-+ (uint32_t) srb->saved_dma_handle));
-+
-+ pci_unmap_page(ha->pdev,
-+ srb->saved_dma_handle,
-+ cmd->request_bufflen,
-+ srb->cmd->sc_data_direction);
-+ }
-+
-+ ha->total_mbytes_xferred += cmd->request_bufflen / 1024;
-+ }
-+
-+ if (host_byte(cmd->result) == DID_OK) {
-+ if (!(srb->flags & SRB_GOT_SENSE)) {
-+ os_lun_t *lun_entry = srb->lun_queue;
-+
-+ if (lun_entry) {
-+ /*
-+ * If lun was not ready (suspended or timeout)
-+ * then change state to "READY".
-+ */
-+ spin_lock_irqsave(&lun_entry->lun_lock, flags);
-+ if (lun_entry->lun_state != LS_LUN_READY) {
-+ lun_entry->lun_state = LS_LUN_READY;
-+ }
-+ spin_unlock_irqrestore(&lun_entry->lun_lock, flags);
-+ }
-+ }
-+ }
-+
-+ #ifdef DEBUG
-+ /* debug prints */
-+ // qla4xxx_dump_command(ha, cmd);
-+
-+ #endif
-+
-+ /*
-+ * WORKAROUND
-+ * A backdoor device-reset (via eh_resets) requires different
-+ * error handling. This code differentiates between normal
-+ * error handling and the backdoor method
-+ */
-+ if (host_byte(cmd->result) == DID_RESET) {
-+ #define EH_ACTIVE 1
-+ if (ha->host->eh_active != EH_ACTIVE)
-+ // srb->cmd->result = DID_IMM_RETRY << 16;
-+ srb->cmd->result = DID_BUS_BUSY << 16;
-+ }
-+
-+#ifdef QL_DEBUG_LEVEL_3
-+ if (cmd->result & 0xff) {
-+ QL4PRINT(QLP13,
-+ printk("REQUEST_SENSE data: "
-+ "(MAX 0x20 bytes displayed)\n"));
-+
-+ qla4xxx_dump_bytes(QLP13, cmd->sense_buffer,
-+ MIN(0x20, sizeof(cmd->sense_buffer)));
-+ }
-+
-+#endif
-+
-+ /* Call the mid-level driver interrupt handler */
-+ srb->cmd = NULL;
-+ add_to_free_srb_q(ha, srb);
-+
-+
-+ // CMD_SP(cmd) = NULL;
-+ (*(cmd)->scsi_done)(cmd);
-+
-+ exit_complete_request:
-+ //LEAVE("qla4xxx_complete_request");
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_queuecommand
-+ * This routine is invoked by Linux to send a SCSI command to the driver.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ * done_fn - Function that the driver calls to notify the SCSI mid-layer
-+ * that the command has been processed.
-+ *
-+ * Remarks:
-+ * The mid-level driver tries to ensure that queuecommand never gets
-+ * invoked concurrently with itself or the interrupt handler (although
-+ * the interrupt handler may call this routine as part of request-
-+ * completion handling). Unfortunely, it sometimes calls the scheduler
-+ * in interrupt context which is a big NO! NO!.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_queuecommand(struct scsi_cmnd *cmd, void (*done_fn)(struct scsi_cmnd *))
-+{
-+ scsi_qla_host_t *ha;
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+ os_tgt_t *tgt_entry;
-+ uint32_t b, t, l;
-+ int return_status = 0;
-+ srb_t *srb;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+
-+ b = cmd->device->channel;
-+ t = cmd->device->id;
-+ l = cmd->device->lun;
-+ ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ spin_unlock_irq(ha->host->host_lock);
-+
-+ /*
-+ * Retrieve srb from pool. If no srb available, Notify the OS to queue
-+ * commands in the OS. The OS will not attempt to queue more commands
-+ * until a command is returned to the OS.
-+ */
-+ srb = del_from_free_srb_q_head(ha);
-+ if (srb == NULL) {
-+ DEBUG2(printk("scsi%d: %s: srb not available\n"
-+ , ha->host_no, __func__);)
-+ DEBUG2(printk("Number of free srbs = %d of %d\n",
-+ ha->free_srb_q_count, ha->num_srbs_allocated);)
-+
-+ spin_lock_irq(ha->host->host_lock);
-+
-+ return_status = SCSI_MLQUEUE_HOST_BUSY;
-+ return (return_status);
-+ }
-+
-+ /* Link the srb with cmd */
-+ CMD_SP(cmd) = (char *)srb;
-+ cmd->scsi_done = done_fn;
-+ srb->cmd = cmd;
-+ srb->r_start = jiffies; /*Time we recieved the I/O*/
-+ srb->flags = 0;
-+
-+ srb->fo_retry_cnt = 0;
-+
-+ srb->err_id = 0;
-+ srb->ha = ha;
-+ if ((cmd->timeout_per_command/HZ) > QLA_CMD_TIMER_DELTA)
-+ qla4xxx_add_timer_to_cmd(srb, (cmd->timeout_per_command / HZ) -
-+ QLA_CMD_TIMER_DELTA);
-+ else
-+ qla4xxx_add_timer_to_cmd(srb, (cmd->timeout_per_command / HZ));
-+
-+ /* retrieve device and lun handles */
-+ tgt_entry = qla4xxx_lookup_target_by_SCSIID(ha, b, t);
-+ if (tgt_entry == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ goto qc_complete;
-+ }
-+
-+ lun_entry = qla4xxx_lookup_lun_handle(ha, tgt_entry, l);
-+ if (lun_entry == NULL) {
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if ((qla4xxx_failover_enabled(ha) && l != 0) ||
-+ tgt_entry->fcport == NULL ) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ goto qc_complete;
-+ }
-+#else
-+ if (tgt_entry->fcport == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ goto qc_complete;
-+ }
-+#endif
-+ /*
-+ * Allocate a LUN queue for this request if we haven't
-+ * already did it on a previous command.
-+ */
-+ fcport = tgt_entry->fcport;
-+ fclun = qla4xxx_add_fclun(fcport, l);
-+ if (fclun == NULL) {
-+ DEBUG2(printk("%s: Can't get FCLUN queue.\n",
-+ __func__);)
-+ cmd->result = DID_ERROR << 16;
-+ goto qc_complete;
-+ }
-+
-+ /* Assume this type right now and fixup after command completes */
-+ fclun->device_type = TYPE_DISK;
-+ lun_entry = qla4xxx_fclun_bind(ha, fcport, fclun);
-+ if( lun_entry == NULL ) {
-+ DEBUG2(printk("%s: Can't Bind or allocate LUN queue.\n",
-+ __func__);)
-+ cmd->result = DID_ERROR << 16;
-+ goto qc_complete;
-+ }
-+ }
-+
-+ srb->tgt_queue = tgt_entry;
-+ srb->lun_queue = lun_entry;
-+ srb->fclun = lun_entry->fclun;
-+ if (lun_entry->fclun == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ DEBUG2(printk(
-+ "scsi%d: (lq->fclun == NULL) sp=%ld,lq=%p\n",
-+ ha->host_no, srb->cmd->serial_number, lun_entry));
-+ goto qc_complete;
-+ }
-+ fcport = lun_entry->fclun->fcport;
-+ if (fcport == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ DEBUG2(printk(
-+ "scsi%d: (lq->fclun->fcport == NULL) sp=%ld, lq=%p,"
-+ "lq->fclun=%p\n",
-+ ha->host_no, srb->cmd->serial_number,
-+ lun_entry, lun_entry->fclun));
-+ goto qc_complete;
-+ }
-+
-+ ddb_entry = fcport->ddbptr;
-+ if (ddb_entry == NULL) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ DEBUG2(printk("scsi%d: (ddbptr == NULL) sp=%ld, ddb entry=%p\n",
-+ ha->host_no, srb->cmd->serial_number, ddb_entry));
-+ goto qc_complete;
-+ }
-+ srb->ha = fcport->ha;
-+
-+ /* Only modify the allowed count if the target is a *non* tape device */
-+ if ( !(fcport->flags & FCF_TAPE_PRESENT) &&
-+ cmd->allowed < ql4xcmdretrycount)
-+ cmd->allowed = ql4xcmdretrycount;
-+
-+ if ( (fcport->flags & FCF_TAPE_PRESENT) ||
-+ (fcport->flags & FCF_NONFO_DEVICE) )
-+ srb->flags |= SRB_TAPE;
-+
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ cmd->result = DID_NO_CONNECT << 16;
-+ if (!test_bit(AF_LINK_UP, &fcport->ha->flags))
-+ srb->err_id = SRB_ERR_LOOP;
-+ else
-+ srb->err_id = SRB_ERR_PORT;
-+ DEBUG2(printk(
-+ "scsi%d: PORT DEAD sp=%ld, errid=%d, fcport=%p\n",
-+ ha->host_no, srb->cmd->serial_number, srb->err_id, fcport));
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ add_to_done_srb_q(ha, srb);
-+ qla4xxx_done(ha);
-+ spin_lock_irq(ha->host->host_lock);
-+ return 0;
-+#else
-+ goto qc_complete;
-+#endif
-+ }
-+
-+ /*
-+ * If the device is missing or the adapter is OFFLINE,
-+ * put the request on the retry queue.
-+ */
-+ if (atomic_read(&ddb_entry->state) == DEV_STATE_MISSING ||
-+ !ADAPTER_UP(fcport->ha)) {
-+ DEBUG2(printk("scsi%d: PORT missing or HBA link-down"
-+ "-ddb state=0x%x, hba flags=0x%lx, sp=%ld"
-+ "\n", fcport->ha->host_no,
-+ atomic_read(&ddb_entry->state),
-+ fcport->ha->flags, srb->cmd->serial_number));
-+
-+ qla4xxx_device_suspend(ha, lun_entry, srb);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ spin_lock_irq(ha->host->host_lock);
-+ return 0;
-+#else
-+ goto qc_complete;
-+#endif
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (!(srb->flags & SRB_TAPE) &&
-+ (test_bit(CFG_FAILOVER, &fcport->ha->cfg_flags) ||
-+ (srb->flags & SRB_FAILOVER))) {
-+ DEBUG2(printk("scsi%d: Failover flag set - sp=%ld"
-+ "cfg flags=0x%lx, srb flags 0x%x\n",
-+ fcport->ha->host_no, srb->cmd->serial_number,
-+ fcport->ha->cfg_flags,srb->flags ));
-+
-+ qla4xxx_extend_timeout(srb->cmd, EXTEND_CMD_TOV);
-+ add_to_retry_srb_q(ha, srb);
-+ spin_lock_irq(ha->host->host_lock);
-+ return 0;
-+ }
-+#endif
-+
-+ /*
-+ * If this request's lun is suspended then put the request on
-+ * the scsi_retry queue.
-+ */
-+ if (lun_entry->lun_state == LS_LUN_SUSPENDED) {
-+ DEBUG2(printk("scsi%d: Lun suspended - sp=%ld - "
-+ "retry_q\n", fcport->ha->host_no,
-+ srb->cmd->serial_number));
-+
-+ qla4xxx_device_suspend(ha, lun_entry, srb);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ spin_lock_irq(ha->host->host_lock);
-+ return 0;
-+#else
-+ goto qc_complete;
-+#endif
-+ }
-+
-+ DEBUG(printk(
-+ "scsi%d: %s sp=%ld, errid=%d, sp->flags=0x%x fcport=%p\n",
-+ ha->host_no, __func__, srb->cmd->serial_number, srb->err_id, srb->flags, fcport));
-+
-+ /* If target suspended put incoming I/O in retry_q. */
-+ if (test_bit(TQF_SUSPENDED, &tgt_entry->flags) &&
-+ (srb->flags & SRB_TAPE) == 0) {
-+ qla4xxx_device_suspend(ha, lun_entry, srb);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ spin_lock_irq(ha->host->host_lock);
-+ return 0;
-+#else
-+ goto qc_complete;
-+#endif
-+ }
-+
-+ if (qla4xxx_send_command_to_isp(ha, srb) != QLA_SUCCESS) {
-+ /*
-+ * Unable to send command to the ISP at this time.
-+ * Notify the OS to queue commands.
-+ */
-+ DEBUG(printk("scsi%d: %s: unable to send cmd "
-+ "to ISP, retry later\n", ha->host_no, __func__));
-+ qla4xxx_request_cleanup(ha, srb);
-+ return_status = SCSI_MLQUEUE_HOST_BUSY;
-+
-+ }
-+ spin_lock_irq(ha->host->host_lock);
-+ return(return_status);
-+
-+qc_complete:
-+ qla4xxx_complete_request(ha, srb);
-+
-+ spin_lock_irq(ha->host->host_lock);
-+ return(return_status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_device_suspend
-+ * This routine is invoked by driver to stall the request queue
-+ *
-+ * Input:
-+ *
-+ * Remarks:
-+ * This routine calls the scsi_device_quiesce which may go to sleep.
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_device_suspend( scsi_qla_host_t *ha, os_lun_t *lun_entry, srb_t *srb )
-+{
-+#ifdef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ struct scsi_device *sdev = lun_entry->sdev;
-+#endif
-+ int ret = 0;
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ qla4xxx_extend_timeout(srb->cmd, EXTEND_CMD_TOV);
-+ add_to_retry_srb_q(ha, srb);
-+#else
-+ if (!test_bit(LF_LUN_BLOCKED, &lun_entry->flags)) {
-+ set_bit(LF_LUN_BLOCKED, &lun_entry->flags);
-+ ret = scsi_internal_device_block(sdev);
-+ }
-+#endif
-+ return ret;
-+}
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+void
-+qla4xxx_device_unsuspend( os_lun_t *lun_entry )
-+{
-+ struct scsi_device *sdev = lun_entry->sdev;
-+
-+ clear_bit(LF_LUN_BLOCKED, &lun_entry->flags);
-+ scsi_internal_device_unblock(sdev);
-+}
-+
-+void
-+qla4xxx_check_for_blocked_luns(scsi_qla_host_t *ha)
-+{
-+ int t,l;
-+ os_lun_t *lun_entry;
-+ os_tgt_t *tgt_entry;
-+ fc_port_t *fcport;
-+
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+
-+ if ( (tgt_entry = TGT_Q(ha, t)) == NULL )
-+ continue;
-+
-+ if (test_bit(TQF_SUSPENDED, &tgt_entry->flags) ){
-+ continue;
-+ }
-+
-+ for (l = 0; l < MAX_LUNS ; l++) {
-+ lun_entry = LUN_Q(ha, t, l);
-+ if (lun_entry == NULL)
-+ continue;
-+
-+ if( test_bit(LF_LUN_BLOCKED, &lun_entry->flags) ) {
-+ if (lun_entry->lun_state == LS_LUN_SUSPENDED)
-+ continue;
-+ fcport = lun_entry->fclun->fcport;
-+
-+ if ( !(atomic_read(&fcport->state) ==
-+ FCS_DEVICE_DEAD ||
-+ atomic_read(&fcport->state) ==
-+ FCS_ONLINE) ) {
-+ continue;
-+ }
-+ qla4xxx_device_unsuspend(lun_entry);
-+ }
-+
-+ }
-+ }
-+}
-+#endif
-+
-+/**************************************************************************
-+ * qla4xxx_extend_timeout
-+ * This routine will extend the timeout to the specified value.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ * timeout - Amount of time to extend the OS timeout
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_extend_timeout(struct scsi_cmnd *cmd, int timeout)
-+{
-+ srb_t *srb = (srb_t *) CMD_SP(cmd);
-+ u_long our_jiffies = (timeout * HZ) + jiffies;
-+
-+ if (cmd->eh_timeout.function) {
-+ mod_timer(&cmd->eh_timeout,our_jiffies);
-+ }
-+ if (srb->timer.function != NULL) {
-+ /*
-+ * Our internal timer should timeout before the midlayer has a
-+ * chance begin the abort process
-+ */
-+ mod_timer(&srb->timer,
-+ our_jiffies - (QLA_CMD_TIMER_DELTA * HZ));
-+ }
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_os_cmd_timeout
-+ *
-+ * Description:
-+ * Handles the command if it times out in any state.
-+ *
-+ * Input:
-+ * sp - pointer to validate
-+ *
-+ * Returns:
-+ * None.
-+ **************************************************************************/
-+void
-+qla4xxx_os_cmd_timeout(srb_t *sp)
-+{
-+ int t, l;
-+ int processed;
-+ scsi_qla_host_t *vis_ha, *dest_ha;
-+ struct scsi_cmnd *cmd;
-+ ulong flags;
-+ ulong cpu_flags;
-+ fc_port_t *fcport;
-+
-+ cmd = sp->cmd;
-+ vis_ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ DEBUG2(printk("cmd_timeout: Entering sp->state = %x\n", sp->state);)
-+
-+ t = cmd->device->id;
-+ l = cmd->device->lun;
-+ fcport = sp->fclun->fcport;
-+ dest_ha = sp->ha;
-+
-+ /*
-+ * If IO is found either in retry Queue
-+ * OR in Lun Queue
-+ * Return this IO back to host
-+ */
-+ processed = 0;
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ spin_lock_irqsave(&dest_ha->list_lock, flags);
-+ if ((sp->state == SRB_RETRY_STATE)
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ || (sp->state == SRB_FAILOVER_STATE)
-+#endif
-+ ) {
-+
-+ DEBUG2(printk(KERN_INFO "scsi%d: Found in (Scsi) Retry queue or "
-+ "failover Q pid %ld, State = %x., "
-+ "fcport state=%d jiffies=%lx retried=%d\n",
-+ dest_ha->host_no,
-+ sp->cmd->serial_number, sp->state,
-+ atomic_read(&fcport->state),
-+ jiffies, sp->cmd->retries);)
-+
-+ if ((sp->state == SRB_RETRY_STATE)) {
-+ __del_from_retry_srb_q(dest_ha, sp);
-+ }
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ else if ((sp->state == SRB_FAILOVER_STATE)) {
-+ __del_from_failover_queue(dest_ha, sp);
-+ }
-+#endif
-+
-+ /*
-+ * If FC_DEVICE is marked as dead return the cmd with
-+ * DID_NO_CONNECT status. Otherwise set the host_byte to
-+ * DID_IMM_RETRY to let the OS retry this cmd.
-+ */
-+ if (qla4xxx_failover_enabled(dest_ha)) {
-+ // cmd->result = DID_IMM_RETRY << 16;
-+ cmd->result = DID_BUS_BUSY << 16;
-+ }
-+ else
-+ {
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ qla4xxx_extend_timeout(cmd, EXTEND_CMD_TOV);
-+ cmd->result = DID_NO_CONNECT << 16;
-+ if (!test_bit(AF_LINK_UP, &fcport->ha->flags))
-+ sp->err_id = SRB_ERR_LOOP;
-+ else
-+ sp->err_id = SRB_ERR_PORT;
-+ }
-+ else {
-+ // cmd->result = DID_IMM_RETRY << 16;
-+ cmd->result = DID_BUS_BUSY << 16;
-+ }
-+ }
-+
-+ __add_to_done_srb_q(dest_ha, sp);
-+ processed++;
-+ }
-+ spin_unlock_irqrestore(&dest_ha->list_lock, flags);
-+ if (processed) {
-+ qla4xxx_done(dest_ha);
-+ return;
-+ }
-+#endif
-+
-+ spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if (sp->state == SRB_DONE_STATE) {
-+ /* IO in done_q -- leave it */
-+ DEBUG2(printk("scsi%d: Found in Done queue pid %ld sp=%p.\n",
-+ dest_ha->host_no, sp->cmd->serial_number, sp);)
-+ }
-+ else if (sp->state == SRB_SUSPENDED_STATE) {
-+#else
-+ if (sp->state == SRB_SUSPENDED_STATE) {
-+#endif
-+ DEBUG2(printk("scsi%d: Found SP %p in suspended state "
-+ "- pid %ld:\n",
-+ dest_ha->host_no,sp,
-+ sp->cmd->serial_number);)
-+ }
-+ else if (sp->state == SRB_ACTIVE_STATE) {
-+ /*
-+ * IO is with ISP find the command in our active list.
-+ */
-+ spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags); /* 01/03 */
-+ spin_lock_irqsave(&dest_ha->hardware_lock, flags);
-+ if (sp == dest_ha->active_srb_array
-+ [(unsigned long)sp->cmd->host_scribble]) {
-+
-+ if (sp->flags & SRB_TAPE) {
-+ /*
-+ * We cannot allow the midlayer error handler
-+ * to wakeup and begin the abort process.
-+ * Extend the timer so that the firmware can
-+ * properly return the IOCB.
-+ */
-+ DEBUG2(printk("cmd_timeout: Extending timeout "
-+ "of FCP2 tape command!\n"));
-+ qla4xxx_extend_timeout(sp->cmd,
-+ EXTEND_CMD_TOV);
-+ }
-+
-+ sp->state = SRB_ACTIVE_TIMEOUT_STATE;
-+ spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
-+ }
-+ else {
-+ spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
-+ printk(KERN_INFO
-+ "qla_cmd_timeout: State indicates it is with "
-+ "ISP, But not in active array\n");
-+ }
-+ spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
-+ }
-+ else if (sp->state == SRB_ACTIVE_TIMEOUT_STATE) {
-+ /* double timeout */
-+ }
-+ else {
-+ /* EMPTY */
-+ DEBUG3(printk("cmd_timeout%ld: LOST command state = "
-+ "0x%x, sp=%p\n",
-+ vis_ha->host_no, sp->state,sp);)
-+
-+ printk(KERN_INFO
-+ "cmd_timeout: LOST command state = 0x%x\n", sp->state);
-+ }
-+ spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
-+
-+ DEBUG3(printk("cmd_timeout: Leaving\n");)
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_add_timer_to_cmd
-+ * This routine creates a timer for the specified command. The timeout
-+ * is usually the command time from kernel minus 2 secs.
-+ *
-+ * Input:
-+ * srb - Pointer to SCSI Request Block
-+ * timeout - Number of seconds to extend command timeout.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_add_timer_to_cmd(srb_t *srb, int timeout)
-+{
-+ init_timer(&srb->timer);
-+ srb->timer.expires = jiffies + timeout * HZ;
-+ srb->timer.data = (unsigned long) srb;
-+ srb->timer.function = (void (*) (unsigned long))qla4xxx_os_cmd_timeout;
-+ add_timer(&srb->timer);
-+ QL4PRINT(QLP3, printk("%s: srb %p, timeout %d\n",
-+ __func__, srb, timeout));
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_delete_timer_from_cmd
-+ * This routine deletes the timer for the specified command.
-+ *
-+ * Input:
-+ * srb - Pointer to SCSI Request Block
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_delete_timer_from_cmd(srb_t *srb )
-+{
-+ if (srb->timer.function != NULL) {
-+ del_timer(&srb->timer);
-+ srb->timer.function = NULL;
-+ srb->timer.data = (unsigned long) NULL;
-+ }
-+}
-+
-+
-+/****************************************************************************/
-+/* Interrupt Service Routine. */
-+/****************************************************************************/
-+
-+/**************************************************************************
-+ * qla4xxx_timer
-+ * This routine is scheduled to be invoked every second to search for
-+ * work to do.
-+ *
-+ * Input:
-+ * p - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_timer(unsigned long p)
-+{
-+ scsi_qla_host_t *ha = (scsi_qla_host_t *) p;
-+ ddb_entry_t *ddb_entry, *dtemp;
-+ int start_dpc = 0;
-+ os_lun_t *lun_entry;
-+ unsigned long cpu_flags;
-+ int t, l;
-+
-+#if ISP_RESET_TEST
-+ if (ha->isp_reset_timer++ == (60 *3)) {
-+ printk("scsi%d: %s going to schedule BIG HAMMER\n",
-+ ha->host_no, __func__);
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ ha->isp_reset_timer = 0;
-+ }
-+#endif
-+
-+ DEBUG3(printk("scsi%d: %s: Host%d=%d/%d flags=[%lx,%lx,%lx] <%d,%d> "
-+ "AENs={%d}, counters={%d,%d} %d\n", ha->host_no, __func__, ha->instance,
-+ ha->spurious_int_count, (uint32_t)ha->isr_count, ha->flags,
-+ ha->dpc_flags, ha->isns_flags, ha->aborted_io_count,
-+ ha->mailbox_timeout_count, MAX_AEN_ENTRIES-ha->aen_q_count,
-+ ha->retry_srb_q_count,
-+ ha->active_srb_count, ha->seconds_since_last_intr));
-+ /* Do we need to process the retry queue? */
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if (!list_empty(&ha->retry_srb_q)) {
-+ start_dpc++;
-+ }
-+#endif
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ /*
-+ * We try and failover any request in the failover
-+ * queue every second.
-+ */
-+ if (!list_empty(&ha->failover_queue)) {
-+ set_bit(DPC_FAILOVER_NEEDED, &ha->dpc_flags);
-+ start_dpc++;
-+ }
-+#endif
-+
-+ /* LUN suspension */
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+ for (l = 0; l < MAX_LUNS ; l++) {
-+ lun_entry = GET_LU_Q(ha, t, l);
-+ if (lun_entry == NULL)
-+ continue;
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if( test_bit(LF_LUN_BLOCKED, &lun_entry->flags) ){
-+ set_bit(DPC_CHECK_LUN, &ha->dpc_flags);
-+ start_dpc++;
-+ }
-+#endif
-+
-+ spin_lock_irqsave(&lun_entry->lun_lock, cpu_flags);
-+ if (lun_entry->lun_state != LS_LUN_SUSPENDED ||
-+ !atomic_read(&lun_entry->suspend_timer)) {
-+ spin_unlock_irqrestore(&lun_entry->lun_lock,
-+ cpu_flags);
-+ continue;
-+ }
-+
-+ DEBUG2(printk("scsi%d: %s:"
-+ "suspended lun_q - lun=%d, timer=%d "
-+ "retry_count=%d\n", ha->host_no, __func__,
-+ lun_entry->lun,
-+ atomic_read(&lun_entry->suspend_timer),
-+ lun_entry->retry_count));
-+
-+ if (!atomic_dec_and_test(&lun_entry->suspend_timer)) {
-+ spin_unlock_irqrestore(&lun_entry->lun_lock,
-+ cpu_flags);
-+ continue;
-+ }
-+
-+
-+ if (test_and_clear_bit(LF_LUN_DELAYED,
-+ &lun_entry->flags)) {
-+ lun_entry->lun_state = LS_LUN_READY;
-+ } else {
-+ lun_entry->retry_count++;
-+ if (lun_entry->retry_count ==
-+ lun_entry->max_retry_count) {
-+ DEBUG2(printk("scsi%d: %s: LUN "
-+ "%d TIMEOUT RETRY_CNT:%d\n",
-+ ha->host_no, __func__,
-+ lun_entry->lun,
-+ lun_entry->retry_count));
-+
-+ lun_entry->lun_state = LS_LUN_TIMEOUT;
-+ } else {
-+ DEBUG2(printk("scsi%d: %s: LUN "
-+ "%d RETRY\n", ha->host_no, __func__,
-+ lun_entry->lun));
-+
-+ lun_entry->lun_state = LS_LUN_RETRY;
-+ }
-+ }
-+ spin_unlock_irqrestore(&lun_entry->lun_lock, cpu_flags);
-+ }
-+ }
-+
-+ /*
-+ * Search for relogin's to time-out and port down retry.
-+ */
-+ list_for_each_entry_safe(ddb_entry, dtemp, &ha->ddb_list, list_entry) {
-+ /* First check to see if the device has exhausted the
-+ * port down retry count */
-+ if (atomic_read(&ddb_entry->state) == DEV_STATE_MISSING) {
-+ if (atomic_read(&ddb_entry->port_down_timer) == 0)
-+ continue;
-+
-+ if (atomic_dec_and_test(&ddb_entry->port_down_timer)) {
-+ DEBUG2(printk("scsi%d: %s: index [%d] "
-+ "port down retry count of (%d) secs "
-+ "exhausted, marking device DEAD.\n",
-+ ha->host_no, __func__,
-+ ddb_entry->fw_ddb_index,
-+ ha->port_down_retry_count);)
-+
-+ atomic_set(&ddb_entry->state, DEV_STATE_DEAD);
-+ if (ddb_entry->fcport)
-+ atomic_set(&ddb_entry->fcport->state,
-+ FCS_DEVICE_DEAD);
-+
-+ DEBUG2(printk(KERN_INFO "scsi%d:%d:%d: "
-+ "%s: index [%d] marked DEAD\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target, __func__,
-+ ddb_entry->fw_ddb_index);)
-+#ifdef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ set_bit(DPC_CHECK_LUN, &ha->dpc_flags);
-+#endif
-+ start_dpc++;
-+ }
-+ }
-+
-+
-+ /* Count down time between sending relogins */
-+ if (ADAPTER_UP(ha) && (!test_bit(DF_RELOGIN, &ddb_entry->flags) &&
-+ (atomic_read(&ddb_entry->state) != DEV_STATE_ONLINE))) {
-+ if (atomic_read(&ddb_entry->retry_relogin_timer) !=
-+ INVALID_ENTRY) {
-+ if (atomic_read(&ddb_entry->retry_relogin_timer) == 0) {
-+ atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY);
-+ set_bit(DPC_RELOGIN_DEVICE,
-+ &ha->dpc_flags);
-+ set_bit(DF_RELOGIN,
-+ &ddb_entry->flags);
-+ DEBUG2(printk(KERN_INFO "scsi%d:%d:%d: "
-+ "%s: index [%d] login device\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target, __func__,
-+ ddb_entry->fw_ddb_index);)
-+ } else
-+ atomic_dec(&ddb_entry->retry_relogin_timer);
-+ }
-+ }
-+
-+ /* Wait for relogin to timeout */
-+ if (atomic_read(&ddb_entry->relogin_timer) &&
-+ (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) {
-+ /*
-+ * If the relogin times out and the device is
-+ * still NOT ONLINE then try and relogin again.
-+ */
-+ if (atomic_read(&ddb_entry->state) !=
-+ DEV_STATE_ONLINE &&
-+ ddb_entry->fw_ddb_device_state ==
-+ DDB_DS_SESSION_FAILED) {
-+ /* Reset login timer */
-+ atomic_inc(&ddb_entry->relogin_retry_count);
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d:%d:%d: index[%d] relogin timed "
-+ "out-retrying relogin (%d)\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target,
-+ ddb_entry->fw_ddb_index,
-+ atomic_read(&ddb_entry->relogin_retry_count)));
-+ start_dpc++;
-+ QL4PRINT(QLP3, printk(KERN_INFO
-+ "scsi%d:%d:%d: index [%d] initate relogin "
-+ "after %d seconds\n", ha->host_no,
-+ ddb_entry->bus, ddb_entry->target,
-+ ddb_entry->fw_ddb_index,
-+ ddb_entry->default_time2wait));
-+
-+ atomic_set(&ddb_entry->retry_relogin_timer,
-+ ddb_entry->default_time2wait);
-+
-+ }
-+ }
-+ }
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if (!list_empty(&ha->done_srb_q)) {
-+ start_dpc++;
-+ }
-+#endif
-+
-+#if EH_WAKEUP_WORKAROUND
-+ /*
-+ * Check for kernel wakeup error
-+ */
-+ if (ha->host->in_recovery &&
-+ (HOST_BUSY(ha) == ha->host->host_failed) &&
-+ !ha->host->eh_active) {
-+ if ((ha->eh_start++) == 60) {
-+ if (ha->host->eh_wait)
-+ up(ha->host->eh_wait);
-+ ha->eh_start=0;
-+
-+ QL4PRINT(QLP2, printk(KERN_INFO "scsi%d: !!! Waking up error "
-+ "handler for scsi layer\n", ha->host_no));
-+ }
-+ }
-+#endif /* EH_WAKEUP_WORKAROUND */
-+
-+ /*
-+ * Check for heartbeat interval
-+ */
-+ if ((ha->firmware_options & FWOPT_HEARTBEAT_ENABLE) &&
-+ (ha->heartbeat_interval != 0)) {
-+ ha->seconds_since_last_heartbeat ++;
-+
-+ if (ha->seconds_since_last_heartbeat >
-+ ha->heartbeat_interval+2) {
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d: Heartbeat not received for %d seconds. "
-+ "HeartbeatInterval = %d seconds. Scheduling SOFT "
-+ "RESET.\n", ha->host_no,
-+ ha->seconds_since_last_heartbeat,
-+ ha->heartbeat_interval));
-+
-+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ }
-+ }
-+
-+ /*
-+ * Check for iSNS actions
-+ */
-+ if (test_bit(ISNS_FLAG_RESTART_SERVICE, &ha->isns_flags)) {
-+ if (atomic_read(&ha->isns_restart_timer)) {
-+ if (!atomic_dec_and_test(&ha->isns_restart_timer) &&
-+ test_bit(ISNS_FLAG_ISNS_SRV_ENABLED,
-+ &ha->isns_flags) &&
-+ !IPAddrIsZero(ha->isns_ip_address) &&
-+ ha->isns_server_port_number) {
-+ set_bit(DPC_ISNS_RESTART_COMPLETION,
-+ &ha->dpc_flags);
-+ }
-+ } else
-+ clear_bit(ISNS_FLAG_RESTART_SERVICE, &ha->isns_flags);
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (test_bit(DPC_FAILOVER_EVENT_NEEDED, &ha->dpc_flags)) {
-+ if (ha->failback_delay) {
-+ ha->failback_delay--;
-+ if (ha->failback_delay == 0) {
-+ set_bit(DPC_FAILOVER_EVENT, &ha->dpc_flags);
-+ clear_bit(DPC_FAILOVER_EVENT_NEEDED,
-+ &ha->dpc_flags);
-+ }
-+ } else {
-+ set_bit(DPC_FAILOVER_EVENT, &ha->dpc_flags);
-+ clear_bit(DPC_FAILOVER_EVENT_NEEDED, &ha->dpc_flags);
-+ }
-+ }
-+#endif
-+
-+ /* Wakeup the dpc routine for this adapter, if needed */
-+ if ((start_dpc ||
-+ test_bit(DPC_RESET_HA, &ha->dpc_flags) ||
-+ test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags) ||
-+ test_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags) ||
-+
-+ test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags) ||
-+ test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) ||
-+ test_bit(DPC_IOCTL_ERROR_RECOVERY, &ha->dpc_flags) ||
-+ test_bit(DPC_ISNS_RESTART, &ha->dpc_flags) ||
-+ test_bit(DPC_ISNS_RESTART_COMPLETION, &ha->dpc_flags) ||
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ test_bit(DPC_FAILOVER_EVENT, &ha->dpc_flags) ||
-+ test_bit(DPC_FAILOVER_NEEDED, &ha->dpc_flags) ||
-+#endif
-+ test_bit(DPC_AEN, &ha->dpc_flags)) &&
-+ !test_bit(AF_DPC_SCHEDULED, &ha->flags) &&
-+ !ha->dpc_active && ha->dpc_wait) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: scheduling dpc routine\n",
-+ ha->host_no, __func__));
-+ set_bit(AF_DPC_SCHEDULED, &ha->flags);
-+ up(ha->dpc_wait);
-+ }
-+
-+ /* Reschedule timer thread to call us back in one second */
-+ mod_timer(&ha->timer, jiffies + HZ);
-+
-+ DEBUG2(ha->seconds_since_last_intr++;)
-+}
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+void
-+qla4xxx_ioctl_error_recovery(scsi_qla_host_t *ha)
-+{
-+ int return_status;
-+ unsigned long flags;
-+
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d: %s: issuing device reset\n", ha->host_no, __func__));
-+ if (!ha->ioctl->ioctl_err_cmd) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: should not occur\n",
-+ ha->host_no, __func__));
-+ return;
-+ }
-+
-+ spin_lock_irqsave(ha->host->host_lock, flags);
-+
-+ return_status = qla4xxx_eh_device_reset(ha->ioctl->ioctl_err_cmd);
-+ if (return_status != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: elevation to host_reset\n",
-+ ha->host_no, __func__));
-+ return_status = qla4xxx_eh_host_reset(ha->ioctl->ioctl_err_cmd);
-+ QL4PRINT(QLP2, printk("scsi%d: %s: return_status=%x\n",
-+ ha->host_no, __func__, return_status));
-+ }
-+ ha->ioctl->ioctl_err_cmd = NULL ;
-+
-+ spin_unlock_irqrestore(ha->host->host_lock, flags);
-+}
-+#endif
-+
-+
-+/**************************************************************************
-+ * qla4xxx_do_dpc
-+ * This routine is a task that is schedule by the interrupt handler
-+ * to perform the background processing for interrupts. We put it
-+ * on a task queue that is consumed whenever the scheduler runs; that's
-+ * so you can do anything (i.e. put the process to sleep etc). In fact,
-+ * the mid-level tries to sleep when it reaches the driver threshold
-+ * "host->can_queue". This can cause a panic if we were in our interrupt
-+ * code.
-+ *
-+ * Input:
-+ * p - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4xxx_do_dpc(void *data)
-+{
-+ DECLARE_MUTEX_LOCKED(sem);
-+ scsi_qla_host_t *ha = (scsi_qla_host_t *) data;
-+ ddb_entry_t *ddb_entry, *dtemp;
-+ fc_port_t *fcport;
-+
-+ ENTER("qla4xxx_do_dpc");
-+
-+ lock_kernel();
-+
-+ daemonize("qla4xxx_%d_dpc", ha->host_no);
-+ allow_signal(SIGHUP);
-+
-+ ha->dpc_wait = &sem;
-+
-+ set_user_nice(current, -20);
-+
-+ unlock_kernel();
-+
-+ complete(&ha->dpc_inited);
-+
-+ while (1) {
-+ DEBUG2(printk("scsi%d: %s: DPC handler sleeping "
-+ "*****************\n", ha->host_no, __func__));
-+
-+ if (down_interruptible(&sem))
-+ break;
-+
-+ if (ha->dpc_should_die)
-+ break;
-+
-+ DEBUG2(printk("scsi%d: %s: DPC handler waking up "
-+ "****************\n", ha->host_no, __func__));
-+
-+ DEBUG2(printk("scsi%d: %s: ha->flags = 0x%08lx\n",
-+ ha->host_no, __func__, ha->flags));
-+ DEBUG2(printk("scsi%d: %s: ha->dpc_flags = 0x%08lx\n",
-+ ha->host_no, __func__, ha->dpc_flags));
-+
-+ /* Initialization not yet finished. Don't do anything yet. */
-+ if (!test_bit(AF_INIT_DONE, &ha->flags) || ha->dpc_active)
-+ continue;
-+
-+ ha->dpc_active = 1;
-+ clear_bit(AF_DPC_SCHEDULED, &ha->flags);
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ if (!list_empty(&ha->done_srb_q))
-+ qla4xxx_done(ha);
-+
-+ /* ---- return cmds on retry_q? --- */
-+ if (!list_empty(&ha->retry_srb_q)) {
-+ srb_t *srb, *stemp;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+
-+ DEBUG2(printk("scsi%d: %s: found %d srbs in "
-+ "retry_srb_q \n", ha->host_no, __func__,
-+ ha->retry_srb_q_count));
-+
-+ list_for_each_entry_safe(srb, stemp, &ha->retry_srb_q,
-+ list_entry) {
-+ ddb_entry_t *ddb_entry;
-+ os_lun_t *lun_entry;
-+
-+ lun_entry = srb->lun_queue;
-+ if (lun_entry && lun_entry->lun_state ==
-+ LS_LUN_SUSPENDED)
-+ continue;
-+ fcport = lun_entry->fclun->fcport;
-+ ddb_entry = fcport->ddbptr;
-+
-+ if (ddb_entry &&
-+ atomic_read(&ddb_entry->state) ==
-+ DEV_STATE_DEAD) {
-+ DEBUG2(printk("scsi%d: %s: found srb %p "
-+ "in retry_srb_q, "
-+ "Device DEAD, returning\n",
-+ ha->host_no, __func__,
-+ srb));
-+
-+ __del_from_retry_srb_q(ha, srb);
-+ srb->cmd->result = DID_NO_CONNECT << 16;
-+ __add_to_done_srb_q(ha,srb);
-+ }
-+
-+ /*
-+ * Send requests to OS when device goes ONLINE
-+ * so that the OS will retry them via I/O thread.
-+ * We don't want to issue I/O via recovery thread.
-+ */
-+ if (ADAPTER_UP(ha) &&
-+ (atomic_read(&ddb_entry->state)
-+ == DEV_STATE_ONLINE)) {
-+ DEBUG2(printk("scsi%d: %s: found srb %p "
-+ "in retry_srb_q, "
-+ "Device ONLINE, returning\n",
-+ ha->host_no, __func__,
-+ srb));
-+
-+ __del_from_retry_srb_q(ha, srb);
-+ // srb->cmd->result = DID_IMM_RETRY << 16;
-+ srb->cmd->result = DID_BUS_BUSY << 16;
-+ __add_to_done_srb_q(ha,srb);
-+ }
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ if (!list_empty(&ha->done_srb_q))
-+ qla4xxx_done(ha);
-+
-+ }
-+#else
-+ /* ---- wakeup suspended luns --- */
-+ if (test_and_clear_bit(DPC_CHECK_LUN, &ha->dpc_flags)) {
-+ qla4xxx_check_for_blocked_luns(ha);
-+ }
-+#endif
-+
-+
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(ha))
-+ qla4xxx_process_failover_event(ha);
-+#endif
-+ /*
-+ * Determine what action is necessary
-+ */
-+
-+ /* ---- recover adapter? --- */
-+ if (ADAPTER_UP(ha) ||
-+ test_bit(DPC_RESET_HA, &ha->dpc_flags) ||
-+ test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) ||
-+ test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) {
-+#if DISABLE_HBA_RESETS
-+ QL4PRINT(QLP2, printk("scsi: %s: ignoring RESET_HA, "
-+ "rebootdisable=1 \n", __func__));
-+ clear_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
-+ clear_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags);
-+#else
-+ if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST,
-+ &ha->dpc_flags))
-+ /* dg 09/23 Never initialize ddb list once we up and running
-+ qla4xxx_recover_adapter(ha, REBUILD_DDB_LIST); */
-+ qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
-+
-+ if (test_bit(DPC_RESET_HA, &ha->dpc_flags))
-+ qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
-+
-+ if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) {
-+ uint8_t wait_time = RESET_INTR_TOV;
-+ unsigned long flags = 0;
-+
-+ qla4xxx_flush_active_srbs(ha);
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ while ((RD_REG_DWORD(ISP_PORT_STATUS(ha)) &
-+ PSR_INIT_COMPLETE) == 0) {
-+ if (wait_time-- == 0)
-+ break;
-+
-+ spin_unlock_irqrestore(
-+ &ha->hardware_lock, flags);
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+
-+ spin_lock_irqsave(&ha->hardware_lock,
-+ flags);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock,
-+ flags);
-+
-+ if (wait_time == 0)
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: IC bit not set\n",
-+ ha->host_no, __func__));
-+
-+ qla4xxx_initialize_adapter(
-+ ha,
-+ PRESERVE_DDB_LIST);
-+ clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
-+ }
-+#endif
-+ }
-+
-+ /* ---- process AEN? --- */
-+ if (test_and_clear_bit(DPC_AEN, &ha->dpc_flags))
-+ qla4xxx_process_aen(ha, PROCESS_ALL_AENS);
-+
-+ /* ---- relogin device? --- */
-+ if (ADAPTER_UP(ha) &&
-+ test_and_clear_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags)) {
-+ list_for_each_entry_safe(ddb_entry, dtemp,
-+ &ha->ddb_list, list_entry) {
-+ if (test_and_clear_bit(DF_RELOGIN,
-+ &ddb_entry->flags) &&
-+ atomic_read(&ddb_entry->state) != DEV_STATE_ONLINE) {
-+ qla4xxx_relogin_device(ha, ddb_entry);
-+ }
-+ }
-+ }
-+
-+ /* ---- restart iSNS server? --- */
-+ if (ADAPTER_UP(ha) &&
-+ test_and_clear_bit(DPC_ISNS_RESTART, &ha->dpc_flags)) {
-+ qla4xxx_isns_restart_service(ha);
-+ }
-+
-+ if (ADAPTER_UP(ha) &&
-+ test_and_clear_bit(DPC_ISNS_RESTART_COMPLETION,
-+ &ha->dpc_flags)) {
-+ uint32_t ip_addr = 0;
-+ IPAddr2Uint32(ha->isns_ip_address, &ip_addr);
-+
-+ if (qla4xxx_isns_restart_service_completion(ha,
-+ ip_addr,
-+ ha->isns_server_port_number)
-+ != QLA_SUCCESS) {
-+ DEBUG2( printk(KERN_WARNING "scsi%d: %s: "
-+ "restart service failed\n",
-+ ha->host_no, __func__));
-+ }
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (test_and_clear_bit(DPC_IOCTL_ERROR_RECOVERY,
-+ &ha->dpc_flags)) {
-+ qla4xxx_ioctl_error_recovery(ha);
-+ }
-+#endif
-+
-+ ha->dpc_active = 0;
-+ }
-+
-+ /*
-+ * Make sure that nobody tries to wake us up again.
-+ */
-+ ha->dpc_wait = NULL;
-+ ha->dpc_active = 0;
-+
-+ complete_and_exit(&ha->dpc_exited, 0);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_eh_wait_on_command
-+ * This routine waits for the command to be returned by the Firmware
-+ * for some max time.
-+ *
-+ * Input:
-+ * ha = actual ha whose done queue will contain the command
-+ * returned by firmware.
-+ * cmd = Scsi Command to wait on.
-+ *
-+ * Returns:
-+ * Not Found : 0
-+ * Found : 1
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4xxx_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-+{
-+ int done = 0;
-+ srb_t *rp;
-+ uint32_t max_wait_time = EH_WAIT_CMD_TOV;
-+
-+ do {
-+ /* Checking to see if its returned to OS */
-+ rp = (srb_t *) CMD_SP(cmd);
-+ if (rp == NULL) {
-+ done++;
-+ break;
-+ }
-+
-+ spin_unlock_irq(ha->host->host_lock);
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(2*HZ);
-+
-+
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ while ((rp = del_from_done_srb_q_head(ha)) != NULL)
-+ qla4xxx_complete_request(ha, rp);
-+#endif
-+
-+ spin_lock_irq(ha->host->host_lock);
-+ } while (max_wait_time--);
-+
-+ if (done)
-+ QL4PRINT(QLP2, printk("scsi%d: %s: found cmd=%p.\n",
-+ ha->host_no, __func__, cmd));
-+
-+ return done;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_wait_for_hba_online
-+ * This routine
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure
-+ *
-+ * Remarks:
-+ *
-+ * Returns:
-+ * SUCCESS - Adapter is ONLINE
-+ * FAILED - Adapter is DEAD
-+ *
-+ * Context:
-+ * Kernel context. Assume io_request_lock LOCKED upon entry
-+ **************************************************************************/
-+inline uint8_t
-+qla4xxx_wait_for_hba_online(scsi_qla_host_t *ha)
-+{
-+ unsigned long wait_online;
-+
-+ wait_online = jiffies + (30 * HZ);
-+ while (time_before(jiffies, wait_online)) {
-+ if (ADAPTER_UP(ha))
-+ return QLA_SUCCESS;
-+
-+ if (!ADAPTER_UP(ha) && (ha->retry_reset_ha_cnt == 0)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: adapter down, "
-+ "retry_reset_ha_cnt = %d\n", ha->host_no, __func__,
-+ ha->retry_reset_ha_cnt));
-+
-+ return QLA_ERROR;
-+ }
-+
-+ QL4PRINT(QLP3, printk("scsi%d: %s: adapter down, "
-+ "retry_reset_ha_cnt = %d, delay 2 sec.\n", ha->host_no,
-+ __func__, ha->retry_reset_ha_cnt));
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(2 * HZ);
-+ }
-+
-+ return QLA_ERROR;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_eh_abort
-+ * This routine aborts commands that currently held in the adapter's
-+ * internal queues. Commands that are active are NOT aborted.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ *
-+ * Remarks:
-+ * Aborts get translated to "device resets" by the scsi switch
-+ * which will return a RESET status and not ABORT. Since the
-+ * mid-level is expecting an ABORT status during an abort(),
-+ * we always elevate to device reset.
-+ *
-+ * Returns:
-+ * SUCCESS - Successfully aborted non-active command
-+ * FAILED - Command not found, or command currently active
-+ *
-+ * Context:
-+ * Kernel context. io_request_lock LOCKED
-+ **************************************************************************/
-+int
-+qla4xxx_eh_abort(struct scsi_cmnd *cmd)
-+{
-+ int return_status = FAILED;
-+ scsi_qla_host_t *ha, *vis_ha;
-+ srb_t *srb;
-+ srb_t *stemp;
-+
-+ srb = (srb_t *) CMD_SP(cmd);
-+ if (!srb) {
-+ /* Already returned to upper-layers. */
-+ ql4_printk(KERN_INFO, to_qla_host(cmd->device->host),
-+ "Command already completed cmd=%ld.\n", cmd->serial_number);
-+
-+ return SUCCESS;
-+ }
-+
-+ vis_ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(vis_ha))
-+ ha = (scsi_qla_host_t *)srb->ha;
-+ else
-+ ha = vis_ha;
-+#else
-+ ha = vis_ha;
-+#endif
-+
-+ ha->aborted_io_count++;
-+
-+ /* Print statements
-+ * ---------------- */
-+ QL4PRINT(QLP2, printk(KERN_INFO
-+ "scsi%d:%d:%d:%d: abort srb=%p, cmd=%p, state=%s, r_start=%ld , "
-+ "u_start=%ld\n", ha->host_no, cmd->device->channel,
-+ cmd->device->id, cmd->device->lun, srb, cmd,
-+ srb_state_msg[srb->state],srb->r_start,srb->u_start));
-+ qla4xxx_dump_dwords(QLP10, srb, sizeof(*srb));
-+
-+ /* If srb found in done_q, return the cmd with ABORTED status */
-+#ifndef CONFIG_SCSI_QLA4XXX_USE_KERNELQ
-+ spin_lock(&ha->adapter_lock);
-+ list_for_each_entry_safe(srb, stemp, &ha->done_srb_q, list_entry) {
-+ if (srb->cmd != cmd)
-+ continue;
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: srb %p found on done "
-+ "queue\n", ha->host_no, __func__, srb));
-+
-+ cmd->result = DID_ABORT << 16;
-+
-+ spin_unlock(&ha->adapter_lock);
-+ spin_unlock_irq(ha->host->host_lock);
-+ while ((srb = del_from_done_srb_q_head(ha)) != NULL)
-+ qla4xxx_complete_request(ha, srb);
-+ spin_lock_irq(ha->host->host_lock);
-+
-+ return SUCCESS;
-+ }
-+ spin_unlock(&ha->adapter_lock);
-+
-+ spin_lock(&ha->list_lock);
-+ list_for_each_entry_safe(srb, stemp, &ha->retry_srb_q, list_entry) {
-+ if (srb->cmd != cmd)
-+ continue;
-+
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: srb %p found on retry queue\n",
-+ ha->host_no, __func__, srb));
-+
-+ __del_from_retry_srb_q(ha, srb);
-+ cmd->result = DID_ABORT << 16;
-+
-+ spin_unlock(&ha->list_lock);
-+ spin_unlock_irq(ha->host->host_lock);
-+ qla4xxx_complete_request(ha, srb);
-+ spin_lock_irq(ha->host->host_lock);
-+ return SUCCESS;
-+ }
-+ spin_unlock(&ha->list_lock);
-+#endif
-+
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ if (qla4xxx_failover_enabled(vis_ha)) {
-+ spin_lock(&ha->list_lock);
-+ list_for_each_entry_safe(srb, stemp, &ha->failover_queue,
-+ list_entry) {
-+ if (cmd != srb->cmd)
-+ continue;
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: srb %p found on "
-+ "failover queue\n", ha->host_no, __func__, srb));
-+
-+ /* Remove srb from failover queue. */
-+ __del_from_failover_queue(ha, srb);
-+
-+ srb->cmd->result = DID_ABORT << 16;
-+
-+ spin_unlock(&ha->list_lock);
-+ spin_unlock_irq(ha->host->host_lock);
-+ qla4xxx_complete_request(ha, srb);
-+ spin_lock_irq(ha->host->host_lock);
-+
-+ return_status = SUCCESS;
-+ return return_status;
-+ }
-+ spin_unlock(&ha->list_lock);
-+ }
-+#endif
-+ /*
-+ * Aborts get translated to "device resets" by the scsi switch which
-+ * will return a RESET status and not ABORT. Since the mid-level is
-+ * expecting an ABORT status during an abort(), we always elevate to
-+ * device reset.
-+ */
-+ return_status = FAILED;
-+
-+ QL4PRINT(QLP2, printk("scsi%d: %s: return with status = %x\n",
-+ ha->host_no, __func__, return_status));
-+
-+ return return_status;
-+}
-+
-+/**************************************************************************
-+ * qla4010_soft_reset
-+ * This routine performs a SOFT RESET.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully reset the firmware
-+ * QLA_ERROR - Failed to reset the firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4010_soft_reset(scsi_qla_host_t *ha){
-+ uint32_t max_wait_time;
-+ unsigned long flags = 0;
-+ uint8_t status = QLA_ERROR;
-+ uint32_t ctrl_status;
-+
-+ ENTER(__func__);
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ /*
-+ * If the SCSI Reset Interrupt bit is set, clear it.
-+ * Otherwise, the Soft Reset won't work.
-+ */
-+ ctrl_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ if ((ctrl_status & CSR_SCSI_RESET_INTR) != 0)
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SCSI_RESET_INTR));
-+
-+ /* Issue Soft Reset */
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SOFT_RESET));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* Wait until the Network Reset Intr bit is cleared */
-+ max_wait_time = RESET_INTR_TOV;
-+ do {
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ctrl_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if ((ctrl_status & CSR_NET_RESET_INTR) == 0)
-+ break;
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ } while ((max_wait_time--));
-+
-+ if ((ctrl_status & CSR_NET_RESET_INTR) != 0) {
-+ QL4PRINT(QLP2,
-+ printk(KERN_WARNING "scsi%d: Network Reset Intr not cleared "
-+ "by Network function, clearing it now!\n", ha->host_no));
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_NET_RESET_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ }
-+
-+ /* Wait until the firmware tells us the Soft Reset is done */
-+ max_wait_time = SOFT_RESET_TOV;
-+ do {
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ctrl_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ if ((ctrl_status & CSR_SOFT_RESET) == 0) {
-+ status = QLA_SUCCESS;
-+ break;
-+ }
-+
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ } while ((max_wait_time--));
-+
-+ /*
-+ * Also, make sure that the SCSI Reset Interrupt bit has been cleared
-+ * after the soft reset has taken place.
-+ */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ ctrl_status = RD_REG_DWORD(&ha->reg->ctrl_status);
-+ if ((ctrl_status & CSR_SCSI_RESET_INTR) != 0) {
-+ WRT_REG_DWORD(&ha->reg->ctrl_status, SET_RMASK(CSR_SCSI_RESET_INTR));
-+ PCI_POSTING(&ha->reg->ctrl_status);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ LEAVE(__func__);
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_topcat_reset
-+ * This routine performs a HARD RESET of the TopCat chip.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully reset the firmware
-+ * QLA_ERROR - Failed to reset the firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_topcat_reset(scsi_qla_host_t *ha){
-+ unsigned long flags;
-+
-+ QL4PRINT(QLP2, printk(KERN_WARNING "scsi%d: %s: TopCat chip reset!\n",
-+ ha->host_no, __func__));
-+
-+ if (qla4xxx_take_hw_semaphore(ha, SEM_NVRAM, SEM_FLG_TIMED_WAIT) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk(KERN_WARNING "scsi%d: %s: Unable to take SEM_NVRAM "
-+ "semaphore\n", ha->host_no, __func__));
-+ return(QLA_ERROR);
-+ }
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ WRT_REG_DWORD(ISP_GP_OUT(ha), SET_RMASK(GPOR_TOPCAT_RESET));
-+ PCI_POSTING(ISP_GP_OUT(ha));
-+ TOPCAT_RESET_DELAY();
-+ WRT_REG_DWORD(ISP_GP_OUT(ha), CLR_RMASK(GPOR_TOPCAT_RESET));
-+ PCI_POSTING(ISP_GP_OUT(ha));
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ TOPCAT_POST_RESET_DELAY();
-+
-+ qla4xxx_clear_hw_semaphore(ha, SEM_NVRAM);
-+ return(QLA_SUCCESS);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4xxx_soft_reset
-+ * This routine performs a SOFT RESET.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully reset the firmware
-+ * QLA_ERROR - Failed to reset the firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_soft_reset(scsi_qla_host_t *ha){
-+
-+ QL4PRINT(QLP2, printk(KERN_WARNING "scsi%d: %s: chip reset!\n",
-+ ha->host_no, __func__));
-+ if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
-+ uint8_t status = QLA_ERROR;
-+
-+ if (qla4010_soft_reset(ha) == QLA_SUCCESS) {
-+ if (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) {
-+ if (qla4010_soft_reset(ha) == QLA_SUCCESS) {
-+ status = QLA_SUCCESS;
-+ }
-+ }
-+ }
-+ return(status);
-+ }
-+ else
-+ return(qla4010_soft_reset(ha));
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_hard_reset
-+ * This routine performs a HARD RESET.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully reset the firmware
-+ * QLA_ERROR - Failed to reset the firmware
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+inline uint8_t
-+qla4xxx_hard_reset(scsi_qla_host_t *ha){
-+ /* The QLA4010 really doesn't have an equivalent to a hard reset */
-+ qla4xxx_flush_active_srbs(ha);
-+ if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
-+ uint8_t status = QLA_ERROR;
-+
-+ if (qla4010_soft_reset(ha) == QLA_SUCCESS) {
-+ if (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) {
-+ if (qla4010_soft_reset(ha) == QLA_SUCCESS) {
-+ status = QLA_SUCCESS;
-+ }
-+ }
-+ }
-+ return(status);
-+ }
-+ else
-+ return(qla4010_soft_reset(ha));
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_cmd_wait
-+ * This routine stalls the driver until all outstanding commands are
-+ * returned.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks:
-+ * Caller must release the Hardware Lock prior to calling this routine.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - All outstanding commands completed
-+ * QLA_ERROR - All outstanding commands did not complete
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static uint8_t
-+qla4xxx_cmd_wait(scsi_qla_host_t *ha){
-+ uint32_t index = 0;
-+ uint8_t stat = QLA_SUCCESS;
-+ int wait_cnt = WAIT_CMD_TOV; /* Initialized for 30 seconds as we expect all
-+ commands to retuned ASAP.*/
-+ unsigned long flags;
-+
-+ ENTER("qla4xxx_cmd_wait: started\n");
-+
-+ while (wait_cnt) {
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ /* Find a command that hasn't completed. */
-+ for (index = 1; index < MAX_SRBS; index++) {
-+ if (ha->active_srb_array[index] != NULL)
-+ break;
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* If No Commands are pending, wait is complete */
-+ if (index == MAX_SRBS) {
-+ break;
-+ }
-+
-+ /* If we timed out on waiting for commands to come back
-+ * return ERROR.
-+ */
-+ wait_cnt--;
-+ if (wait_cnt == 0)
-+ stat = QLA_ERROR;
-+ else {
-+ /* sleep a second */
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ }
-+ } /* End of While (wait_cnt) */
-+
-+ QL4PRINT(QLP2,printk("(%d): %s: Done waiting on commands - array_index=%d\n",
-+ ha->host_no, __func__, index));
-+
-+ LEAVE("qla4xxx_cmd_wait");
-+
-+ return(stat);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_recover_adapter
-+ * This routine recovers that adapter from a fatal state.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * renew_ddb_list - Indicates what to do with the adapter's ddb list
-+ * after adapter recovery has completed.
-+ * 0=preserve ddb list, 1=destroy and rebuild ddb list
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully recovered adapter
-+ * QLA_ERROR - Failed to recover adapter
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_recover_adapter(scsi_qla_host_t *ha, uint8_t renew_ddb_list){
-+ uint8_t status = QLA_SUCCESS;
-+
-+ ENTER("qla4xxx_recover_adapter");
-+
-+ QL4PRINT(QLP2,
-+ printk(KERN_INFO "scsi%d: recover adapter (begin)\n",
-+ ha->host_no));
-+
-+ /* Stall incoming I/O until we are done */
-+ clear_bit(AF_ONLINE, &ha->flags);
-+ DEBUG2(printk("scsi%d: %s calling qla4xxx_cmd_wait\n",
-+ ha->host_no, __func__));
-+
-+ /* Wait for outstanding commands to complete.
-+ * Stalls the driver for max 30 secs
-+ */
-+ status = qla4xxx_cmd_wait(ha);
-+
-+ qla4xxx_disable_intrs(ha);
-+
-+ /* Flush any pending ddb changed AENs */
-+ qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
-+
-+ /* Reset the firmware. If successful, function
-+ * returns with ISP interrupts enabled.
-+ */
-+ if (status == QLA_SUCCESS) {
-+ DEBUG2(printk(KERN_INFO
-+ "scsi%d: %s - Performing soft reset..\n",
-+ ha->host_no,__func__));
-+ status = qla4xxx_soft_reset(ha);
-+ }
-+ /* FIXMEkaren: Do we want to keep interrupts enabled and process
-+ AENs after soft reset */
-+
-+ /* If firmware (SOFT) reset failed, or if all outstanding
-+ * commands have not returned, then do a HARD reset.
-+ */
-+ if (status == QLA_ERROR) {
-+ DEBUG2(printk(KERN_INFO
-+ "scsi%d: %s - Performing hard reset..\n",
-+ ha->host_no,__func__));
-+ status = qla4xxx_hard_reset(ha);
-+ }
-+
-+ /* Flush any pending ddb changed AENs */
-+ qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
-+
-+ /* Re-initialize firmware. If successful, function returns
-+ * with ISP interrupts enabled */
-+ if (status == QLA_SUCCESS) {
-+ DEBUG2(printk(
-+ KERN_INFO "scsi%d: %s - Initializing adapter..\n",
-+ ha->host_no, __func__));
-+
-+ /* If successful, AF_ONLINE flag set in
-+ * qla4xxx_initialize_adapter */
-+ status = qla4xxx_initialize_adapter(ha, renew_ddb_list);
-+ }
-+
-+ /* Failed adapter initialization?
-+ * Retry reset_ha only if invoked via DPC (DPC_RESET_HA) */
-+ if ((test_bit(AF_ONLINE, &ha->flags) == 0) &&
-+ (test_bit(DPC_RESET_HA, &ha->dpc_flags))) {
-+ /* Adapter initialization failed, see if we can retry
-+ * resetting the ha */
-+ if (!test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags)) {
-+ ha->retry_reset_ha_cnt = MAX_RESET_HA_RETRIES;
-+ DEBUG2(
-+ printk(KERN_INFO "scsi%d: recover adapter - "
-+ "retrying (%d) more times\n",
-+ ha->host_no, ha->retry_reset_ha_cnt));
-+ set_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags);
-+ status = QLA_ERROR;
-+ }
-+ else {
-+ if (ha->retry_reset_ha_cnt > 0) {
-+ /* Schedule another Reset HA -- DPC will retry */
-+ ha->retry_reset_ha_cnt--;
-+ DEBUG2(printk(KERN_INFO
-+ "scsi%d: recover adapter - "
-+ "retry remaining %d\n", ha->host_no,
-+ ha->retry_reset_ha_cnt));
-+ status = QLA_ERROR;
-+ }
-+
-+ if (ha->retry_reset_ha_cnt == 0) {
-+ /* Recover adapter retries have been exhausted.
-+ * Adapter DEAD */
-+ DEBUG2( printk(KERN_INFO
-+ "scsi%d: recover adapter failed - "
-+ "board disabled\n", ha->host_no));
-+ qla4xxx_flush_active_srbs(ha);
-+ clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags);
-+ clear_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ clear_bit(DPC_RESET_HA_DESTROY_DDB_LIST,
-+ &ha->dpc_flags);
-+ status = QLA_ERROR;
-+ }
-+ }
-+ }
-+ else {
-+ clear_bit(DPC_RESET_HA, &ha->dpc_flags);
-+ clear_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags);
-+ clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags);
-+ }
-+
-+ ha->adapter_error_count++;
-+
-+ if (status == QLA_SUCCESS)
-+ qla4xxx_enable_intrs(ha);
-+
-+ DEBUG2( printk(KERN_INFO
-+ "scsi%d: recover adapter .. DONE\n", ha->host_no));
-+ LEAVE("qla4xxx_recover_adapter");
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_eh_wait_for_active_target_commands
-+ * This routine
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * target - SCSI target ID
-+ *
-+ * Returns:
-+ * 0 - All pending commands returned
-+ * non-zero - All pending commands did not return
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_eh_wait_for_active_target_commands(scsi_qla_host_t *ha, int t, int l)
-+{
-+ int cnt;
-+ int status;
-+ srb_t *sp;
-+ struct scsi_cmnd *cmd;
-+
-+ /*
-+ * Waiting for all commands for the designated target in the active
-+ * array
-+ */
-+ status = 0;
-+ for (cnt = 1; cnt < MAX_SRBS; cnt++) {
-+ spin_lock(&ha->hardware_lock);
-+ sp = ha->active_srb_array[cnt];
-+ if (sp) {
-+ cmd = sp->cmd;
-+ spin_unlock(&ha->hardware_lock);
-+ if (cmd->device->id == t && cmd->device->lun == l) {
-+ if (!qla4xxx_eh_wait_on_command(ha, cmd)) {
-+ status++;
-+ break;
-+ }
-+ }
-+ } else {
-+ spin_unlock(&ha->hardware_lock);
-+ }
-+ }
-+ return status;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_eh_device_reset
-+ * This routine is called by the Linux OS to reset all luns on the
-+ * specified target.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Remarks:
-+ * None
-+ *
-+ * Returns:
-+ * SUCCESS - Successfully reset target/lun
-+ * FAILED - Failed to reset target/lun
-+ *
-+ * Context:
-+ * Kernel context. io_request_lock LOCKED
-+ **************************************************************************/
-+ int
-+qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
-+{
-+ int return_status = FAILED;
-+ scsi_qla_host_t *ha;
-+ os_lun_t *lun_entry;
-+ os_tgt_t *tgt_entry;
-+ fc_lun_t *fclun;
-+ uint8_t stat;
-+
-+ ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ /* Retrieve device and lun handles */
-+ tgt_entry = qla4xxx_lookup_target_by_SCSIID(ha, cmd->device->channel,
-+ cmd->device->id);
-+ if (!tgt_entry)
-+ return FAILED;
-+ lun_entry = qla4xxx_lookup_lun_handle(ha, tgt_entry, cmd->device->lun);
-+ if (!lun_entry)
-+ return FAILED;
-+ fclun = lun_entry->fclun;
-+ if (!fclun)
-+ return FAILED;
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "scsi(%d:%d:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "scsi(%d): DEVICE_RESET cmd=%p jiffies = 0x%lx, timeout=%x, "
-+ "dpc_flags=%lx, status=%x allowed=%d cmd.state=%x\n",
-+ ha->host_no, cmd, jiffies, cmd->timeout_per_command / HZ,
-+ ha->dpc_flags, cmd->result, cmd->allowed, cmd->state));
-+
-+ /* If we are coming in from the back-door, stall I/O until complete. */
-+ if (!cmd->device->host->eh_active) {
-+ set_bit(TQF_SUSPENDED, &tgt_entry->flags);
-+ }
-+
-+ spin_unlock_irq(ha->host->host_lock);
-+ stat = qla4xxx_reset_lun(ha, fclun->fcport->ddbptr, fclun);
-+ spin_lock_irq(ha->host->host_lock);
-+ if (stat != QLA_SUCCESS) {
-+ ql4_printk(KERN_INFO, ha, "DEVICE RESET FAILED. %d\n", stat);
-+
-+ goto eh_dev_reset_done;
-+ }
-+
-+ /* Send marker. */
-+ ha->marker_needed = 1;
-+
-+ /*
-+ * If we are coming down the EH path, wait for all commands to complete
-+ * for the device.
-+ */
-+ if (cmd->device->host->eh_active) {
-+ if (qla4xxx_eh_wait_for_active_target_commands(ha,
-+ cmd->device->id, cmd->device->lun)) {
-+ ql4_printk(KERN_INFO, ha, "DEVICE RESET FAILED - "
-+ "waiting for commands.\n");
-+
-+ goto eh_dev_reset_done;
-+ }
-+ }
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "scsi(%d:%d:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun);
-+
-+ return_status = SUCCESS;
-+
-+eh_dev_reset_done:
-+
-+ if (!cmd->device->host->eh_active)
-+ clear_bit(TQF_SUSPENDED, &tgt_entry->flags);
-+ QL4PRINT(QLP2, printk("scsi%d: %s: return with status = %x\n",
-+ ha->host_no, __func__, return_status));
-+
-+ return return_status;
-+ }
-+
-+
-+/**************************************************************************
-+ * qla4xxx_eh_bus_reset
-+ * This routine is called by the Linux OS to reset the specified
-+ * adapter/bus.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ *
-+ * Returns:
-+ * SUCCESS - Successfully reset adapter/bus
-+ * FAILED - Failed to reset adapter/bus
-+ *
-+ * Context:
-+ * Kernel context. io_request_lock LOCKED
-+ **************************************************************************/
-+int
-+qla4xxx_eh_bus_reset(struct scsi_cmnd *cmd)
-+{
-+ uint8_t status = QLA_SUCCESS;
-+ int return_status = FAILED;
-+ scsi_qla_host_t *ha;
-+ ddb_entry_t *ddb_entry, *dtemp;
-+
-+ ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "scsi(%d:%d:%d:%d): BUS RESET ISSUED.\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun);
-+
-+ spin_unlock_irq(ha->host->host_lock);
-+ if (qla4xxx_wait_for_hba_online(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d: %s: Unable to reset "
-+ "bus. Adapter DEAD.\n", ha->host_no,
-+ cmd->device->channel, __func__));
-+
-+ spin_lock_irq(ha->host->host_lock);
-+ return FAILED;
-+ }
-+ spin_lock_irq(ha->host->host_lock);
-+
-+ /* Attempt to reset all valid targets with outstanding commands */
-+ list_for_each_entry_safe(ddb_entry, dtemp, &ha->ddb_list, list_entry) {
-+ QL4PRINT(QLP5, printk("scsi%d: %s: reset target b%d, t%x, "
-+ "index [%d]\n", ha->host_no, __func__, ddb_entry->bus,
-+ ddb_entry->target, ddb_entry->fw_ddb_index));
-+
-+ /* Issue a reset */
-+ status |= qla4xxx_reset_target(ha, ddb_entry);
-+ }
-+
-+ /*
-+ * Status is QLA_SUCCESS if target resets for ALL devices completed
-+ * successfully. Otherwise the status is QLA_ERROR.
-+ */
-+ if (status == QLA_SUCCESS)
-+ return_status = SUCCESS;
-+
-+ ql4_printk(KERN_INFO, ha, "BUS RESET %s.\n",
-+ (return_status == FAILED) ? "FAILED" : "SUCCEDED");
-+
-+ return return_status;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_reset_target
-+ * This routine issues either a warm or cold target reset to the
-+ * specified device.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ * ddb_entry - Pointer to device database entry
-+ *
-+ * Remarks:
-+ * The caller must ensure that the ddb_entry pointer is valid before
-+ * calling this routine.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - Successfully reset target
-+ * QLA_ERROR - Failed to reset target
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+uint8_t
-+qla4xxx_reset_target(scsi_qla_host_t *ha, ddb_entry_t *ddb_entry)
-+{
-+ uint8_t status = QLA_SUCCESS;
-+ fc_lun_t *fclun;
-+ fc_port_t *fcport;
-+ uint8_t stat;
-+
-+ /* Reset all LUNs on this target */
-+ fcport = ddb_entry->fcport;
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ spin_unlock_irq(ha->host->host_lock);
-+ stat = qla4xxx_reset_lun(ha, ddb_entry, fclun);
-+ spin_lock_irq(ha->host->host_lock);
-+ if (stat == QLA_SUCCESS) {
-+ /* Send marker. */
-+ ha->marker_needed =1;
-+
-+ /*
-+ * Waiting for all active commands to complete for the
-+ * device.
-+ */
-+ status |= qla4xxx_eh_wait_for_active_target_commands(
-+ ha, ddb_entry->target, fclun->lun);
-+ } else {
-+ status |= QLA_ERROR;
-+ }
-+ }
-+
-+ if (status == QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d: device reset SUCCEEDED.\n",
-+ ha->host_no, ddb_entry->bus, fcport->os_target_id));
-+ } else {
-+ QL4PRINT(QLP2, printk("scsi%d:%d:%d: device reset FAILED.\n",
-+ ha->host_no, ddb_entry->bus, fcport->os_target_id));
-+
-+ status = QLA_ERROR;
-+ }
-+
-+ return status;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_flush_active_srbs
-+ * This routine is called just prior to a HARD RESET to return all
-+ * outstanding commands back to the Operating System.
-+ *
-+ * Input:
-+ * ha - Pointer to host adapter structure.
-+ *
-+ * Remarks:
-+ * Caller should make sure that the following locks are released
-+ * before this calling routine:
-+ * Hardware lock, io_request_lock, adapter_lock, and lun_lock.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4xxx_flush_active_srbs(scsi_qla_host_t *ha){
-+ srb_t *srb;
-+ int i;
-+ unsigned long flags;
-+
-+ ENTER("qla4xxx_flush_active_srbs");
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ for (i = 1; i < MAX_SRBS; i++) {
-+ if ((srb = ha->active_srb_array[i]) != NULL) {
-+ QL4PRINT(QLP5,
-+ printk("scsi%d: %s: found srb %p in active array, "
-+ "returning\n", ha->host_no, __func__, srb));
-+ del_from_active_array(ha, i);
-+ srb->cmd->result = DID_RESET << 16;
-+#ifdef CONFIG_SCSI_QLA4XXX_FAILOVER
-+ add_to_done_srb_q(ha,srb);
-+#else
-+ qla4xxx_complete_request(ha,srb);
-+#endif
-+ }
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ // if (!list_empty(&ha->done_srb_q)) {
-+ // while ((srb = del_from_done_srb_q_head(ha)) != NULL)
-+ // qla4xxx_complete_request(ha, srb);
-+ // }
-+
-+ LEAVE("qla4xxx_flush_active_srbs");
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_eh_host_reset
-+ * This routine is invoked by the Linux kernel to perform fatal error
-+ * recovery on the specified adapter.
-+ *
-+ * Input:
-+ * cmd - Pointer to Linux's SCSI command structure
-+ *
-+ * Returns:
-+ * SUCCESS - Successfully recovered host adapter
-+ * FAILED - Failed to recover host adapter
-+ *
-+ * Context:
-+ * Kernel context. io_request_lock LOCKED
-+ **************************************************************************/
-+int
-+qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
-+{
-+ int return_status = FAILED;
-+ scsi_qla_host_t *ha;
-+
-+ ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ ql4_printk(KERN_INFO, ha,
-+ "scsi(%d:%d:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no,
-+ cmd->device->channel, cmd->device->id, cmd->device->lun);
-+
-+ spin_unlock_irq(ha->host->host_lock);
-+
-+ if (qla4xxx_wait_for_hba_online(ha) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2, printk("scsi%d:%d: %s: Unable to reset "
-+ "host. Adapter DEAD.\n", ha->host_no,
-+ cmd->device->channel, __func__));
-+
-+ spin_lock_irq(ha->host->host_lock);
-+ return FAILED;
-+ }
-+
-+ if (qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST) == QLA_SUCCESS) {
-+ return_status = SUCCESS;
-+ }
-+
-+ ql4_printk(KERN_INFO, ha, "HOST RESET %s.\n",
-+ (return_status == FAILED) ? "FAILED" : "SUCCEDED");
-+
-+ spin_lock_irq(ha->host->host_lock);
-+
-+ return return_status;
-+}
-+
-+/*
-+* qla4xxx_free_other_mem
-+* Frees all adapter allocated memory.
-+*
-+* Input:
-+* ha = adapter block pointer.
-+*/
-+static void
-+qla4xxx_free_other_mem(scsi_qla_host_t *ha)
-+{
-+ uint32_t t;
-+ fc_port_t *fcport, *fptemp;
-+ fc_lun_t *fclun, *fltemp;
-+
-+ if (ha == NULL) {
-+ /* error */
-+ DEBUG2(printk("%s(): ERROR invalid ha pointer.\n", __func__));
-+ return;
-+ }
-+
-+ /* Free the target and lun queues */
-+ for (t = 0; t < MAX_TARGETS; t++) {
-+ qla4xxx_tgt_free(ha, t);
-+ }
-+
-+ /* Free fcport and fcluns */
-+ list_for_each_entry_safe(fcport, fptemp, &ha->fcports, list) {
-+ list_for_each_entry_safe(fclun, fltemp, &fcport->fcluns, list) {
-+ list_del_init(&fclun->list);
-+ kfree(fclun);
-+ }
-+ list_del_init(&fcport->list);
-+ kfree(fcport);
-+ }
-+ INIT_LIST_HEAD(&ha->fcports);
-+}
-+
-+#if 0
-+
-+/**************************************************************************
-+* qla4xxx_get_line
-+* Copy a substring from the specified string. The substring
-+* consists of any number of chars seperated by white spaces
-+* (i.e. spaces) and ending with a newline '\n' or a semicolon ';'.
-+*
-+* Enter:
-+* str - orig string
-+* line - substring
-+*
-+* Returns:
-+* cp - pointer to next string, or
-+* null - End of string
-+*
-+* Context:
-+* Kernel context.
-+*************************************************************/
-+static char *
-+qla4xxx_get_line(char *str, char *line)
-+{
-+ register char *cp = str;
-+ register char *sp = line;
-+
-+ /* skip preceeding spaces */
-+ while (*cp && *cp == ' ')
-+ ++cp;
-+ while ((*cp) && *cp != '\n' && *cp != ';') /* end of line */
-+ *sp++ = *cp++;
-+
-+ *sp = '\0';
-+
-+ QL4PRINT(QLP7, printk("%s: %s\n", __func__, line));
-+
-+ if ((*cp)) {
-+ cp++;
-+ return(cp);
-+ }
-+
-+ return(NULL);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_get_tokens
-+ * This routine retrieves a token from the command line.
-+ *
-+ * Input:
-+ * line - Pointer to command line
-+ * argv - Pointer to arguements
-+ * str - Pointer to starting point of symbol
-+ *
-+ * Output:
-+ * count - Number of tokens retrieved
-+ *
-+ * Remarks:
-+ * None
-+ *
-+ * Returns:
-+ * Pointer to command Line after token is retrieved.
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4xxx_get_tokens(char *line, char **argv, int maxargs )
-+{
-+ register char *cp = line;
-+ int count = 0;
-+
-+ while (*cp && count < maxargs) {
-+ /* skip preceeding spaces */
-+ while ((*cp) && *cp == ' ')
-+ ++cp;
-+ /* symbol starts here */
-+ argv[count++] = cp;
-+ /* skip symbols */
-+ while ((*cp) && !(*cp == ' ' || *cp == ';' || *cp == ':'))
-+ cp++;
-+ /* replace comma or space with a null */
-+ if ((*cp) && (*cp ==' ' ) && argv[count-1] != cp)
-+ *cp++ = '\0';
-+ }
-+ return(count);
-+}
-+
-+/*
-+ * Create character driver "HbaApiDev" w dynamically allocated major number
-+ * and create "/proc/scsi/<QLA4XXX_PROC_NAME>/HbaApiNode" as the device
-+ * node associated with the major number.
-+ */
-+#define APIDEV_NODE "HbaApiNode"
-+#define APIDEV_NAME "HbaApiDev"
-+
-+static int apidev_major = 0;
-+static struct Scsi_Host *apidev_host = 0;
-+
-+int apidev_cleanup(void);
-+int apidev_init(struct Scsi_Host *host);
-+
-+/**************************************************************************
-+ * apidev_open
-+ * This routine is invoked just prior to every IOCTL call. We only
-+ * display debug information.
-+ *
-+ * Input:
-+ * Unused
-+ *
-+ * Returns:
-+ * 0 - Always returns successful
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+apidev_open(struct inode *inode, struct file *file){
-+ QL4PRINT(QLP4, printk("scsi: apidev_open MAJOR number = %d, "
-+ "MINOR number = %d\n",
-+ MAJOR (inode->i_rdev),
-+ MINOR (inode->i_rdev)));
-+ return(0);
-+}
-+
-+/**************************************************************************
-+ * apidev_close
-+ * This routine is invoked just after every IOCTL call. We only
-+ * display debug information.
-+ *
-+ * Input:
-+ * Unused
-+ *
-+ * Returns:
-+ * 0 - Always returns successful
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+apidev_close(struct inode *inode, struct file *file){
-+ QL4PRINT(QLP4, printk("scsi: apidev_close\n"));
-+ return(0);
-+}
-+
-+/**************************************************************************
-+ * apidev_ioctl
-+ * This routine is invoked whenever an ioctl call is made. It in turn
-+ * calls the IOCTL function for this driver.
-+ *
-+ * Input:
-+ * inode - unused
-+ * fp - unused
-+ * cmd - internal or external ioctl command code
-+ * arg - pointer to ioctl structure
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - IOCTL completed successfully
-+ * QLA_ERROR - IOCTL completed in error
-+ * -EFAULT - if the arg pointer is NULL
-+ * -EINVAL - if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+apidev_ioctl(struct inode *inode, struct file *fp,
-+ unsigned int cmd, unsigned long arg){
-+ static struct scsi_device fake_scsi_device;
-+ fake_scsi_device.host = apidev_host;
-+ return(qla4xxx_ioctl(&fake_scsi_device, (int)cmd, (void*)arg));
-+}
-+
-+static struct file_operations
-+apidev_fops = {
-+ ioctl: apidev_ioctl,
-+ open: apidev_open,
-+ release: apidev_close
-+};
-+
-+/**************************************************************************
-+ * apidev_init
-+ * This routine creates a proc file for IOCTL interface.
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Output:
-+ * apidev_host - Updated with desired host number.
-+ * apidev_major - Registered.
-+ *
-+ * Remarks:
-+ * Create character driver "HbaApiDev" w dynamically allocated major
-+ * number and create "/proc/scsi/qla4xxx/HbaApiNode" as
-+ * the device node associated with the major number.
-+ *
-+ * Returns:
-+ * 0 - Always returns successful
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+apidev_init(struct Scsi_Host *host){
-+ if (apidev_host) return(0);
-+
-+ if (0 > (apidev_major = register_chrdev(0, APIDEV_NAME, &apidev_fops))) {
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi: apidev_init: rc=%d\n",
-+ apidev_major));
-+ return(apidev_major);
-+ }
-+
-+ apidev_host = host;
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi: Created /proc/scsi/qla4xxx/%s major=%d\n",
-+ APIDEV_NODE, apidev_major));
-+
-+ proc_mknod(APIDEV_NODE,
-+ 0600+S_IFCHR,
-+ host->hostt->proc_dir,
-+ (kdev_t)MKDEV(apidev_major,0));
-+
-+ return(0);
-+}
-+
-+/**************************************************************************
-+ * apidev_cleanup
-+ * This routine removes the proc file for the IOCTL interface
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Output:
-+ * apidev_host - Cleared.
-+ * apidev_major - Unregistered.
-+ *
-+ * Returns:
-+ * 0 - Always returns successful
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+apidev_cleanup(void){
-+ if (!apidev_host) return(0);
-+ unregister_chrdev(apidev_major,APIDEV_NAME);
-+
-+ QL4PRINT(QLP4|QLP7, printk("scsi: apidev_cleanup\n"));
-+ remove_proc_entry(APIDEV_NODE,apidev_host->hostt->proc_dir);
-+ apidev_host = 0;
-+ return(0);
-+}
-+#endif
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_os.h ./drivers/scsi/qla4xxx/ql4_os.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_os.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_os.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,136 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ****************************************************************************/
-+#ifndef _QL4_OS_H_
-+#define _QL4_OS_H_
-+
-+#define __KERNEL_SYSCALLS__
-+#define SHUTDOWN_SIGS (sigmask(SIGHUP))
-+
-+
-+#define HOST_STS_TBL(){ \
-+ "DID_OK", \
-+ "DID_NO_CONNECT", \
-+ "DID_BUS_BUSY", \
-+ "DID_TIME_OUT", \
-+ "DID_BAD_TARGET", \
-+ "DID_ABORT", \
-+ "DID_PARITY", \
-+ "DID_ERROR", \
-+ "DID_RESET", \
-+ "DID_BAD_INTR", \
-+ NULL \
-+}
-+
-+/*---------------------------------------------------------------------------*/
-+
-+/* We use the Scsi_Pointer structure that's included with each command
-+ * SCSI_Cmnd as a scratchpad for our SRB.
-+ */
-+#define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
-+
-+/* Additional fields used by ioctl passthru */
-+#define CMD_PASSTHRU_TYPE(Cmnd) (((Cmnd)->SCp.buffer))
-+#define CMD_COMPL_STATUS(Cmnd) ((Cmnd)->SCp.this_residual)
-+#define CMD_RESID_LEN(Cmnd) ((Cmnd)->SCp.buffers_residual)
-+#define CMD_SCSI_STATUS(Cmnd) ((Cmnd)->SCp.Status)
-+#define CMD_ACTUAL_SNSLEN(Cmnd) ((Cmnd)->SCp.have_data_in)
-+#define CMD_HOST_STATUS(Cmnd) ((Cmnd)->SCp.Message)
-+#define CMD_ISCSI_RESPONSE(Cmnd)((Cmnd)->SCp.sent_command)
-+#define CMD_STATE_FLAGS(Cmnd) ((Cmnd)->SCp.phase)
-+
-+
-+/*
-+ * SCSI definitions not defined in Linux's scsi.h
-+ */
-+
-+/* The SCSISTAT values are defined in scsi.h,
-+ * but the values are shifted by one bit.
-+ * We re-define them here without bit shifting
-+ * to minimize confusion */
-+#define SCSISTAT_GOOD 0x00
-+#define SCSISTAT_CHECK_CONDITION 0x02
-+#define SCSISTAT_CONDITION_GOOD 0x04
-+#define SCSISTAT_BUSY 0x08
-+#define SCSISTAT_INTERMEDIATE_GOOD 0x10
-+#define SCSISTAT_INTERMEDIATE_C_GOOD 0x14
-+#define SCSISTAT_RESERVATION_CONFLICT 0x18
-+#define SCSISTAT_COMMAND_TERMINATED 0x22
-+#define SCSISTAT_QUEUE_FULL 0x28
-+
-+
-+/* SAM-II compliant lun structure */
-+typedef struct {
-+ uint8_t bus_identifier:6;
-+ uint8_t address_method:2;
-+
-+ uint8_t single_level_lun;
-+ uint16_t second_level_lun;
-+ uint16_t third_level_lun;
-+ uint16_t fourth_level_lun;
-+} single_level_lun_t;
-+
-+typedef struct {
-+ uint32_t lun_list_length;
-+ uint8_t reserved[4];
-+ single_level_lun_t lun[MAX_LUNS];
-+} report_luns_t;
-+
-+
-+
-+
-+/*
-+ * Declarations for load module
-+ *
-+ * Scsi_Host_template (see drivers/scsi/hosts.h)
-+ * Device driver Interfaces to mid-level SCSI driver.
-+ */
-+
-+#if 0
-+
-+//FIXME: Add above, then test
-+TEMPLATE_HIGHMEM_IO \
-+TEMPLATE_CAN_DMA_32 \
-+TEMPLATE_SINGLE_SG_OK \
-+TEMPLATE_CAN_DO_VARYIO \
-+TEMPLATE_VARY_IO \
-+
-+#endif
-+
-+#endif /* _QL4_OS_H_ */
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_settings.h ./drivers/scsi/qla4xxx/ql4_settings.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_settings.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_settings.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,88 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ *
-+ ****************************************************************************/
-+
-+/*
-+ * Compile time Options:
-+ * 0 - Disable and 1 - Enable
-+ ****************************************/
-+
-+/*
-+ * The following compile time options are temporary,
-+ * used for debug purposes only.
-+ ****************************************/
-+#define ISP_RESET_TEST 0 /* Issues BIG HAMMER (reset) every 3 minutes */
-+#define BYTE_ORDER_SUPPORT_ENABLED 0 /* In the process of translating IOCTL structures */
-+
-+/*
-+ * Under heavy I/O on SMP systems (8-way and IA64) with many command
-+ * timeouts, the scsi mid-layer will sometimes not wake-up the
-+ * error-handling thread when an error-condition occurs.
-+ *
-+ * This workaround, if enabled, will wakeup the error-handler if it is
-+ * stuck in this condition for sixty seconds.
-+ ****************************************/
-+#define EH_WAKEUP_WORKAROUND 0
-+#if SH_HAS_ATOMIC_HOST_BUSY /* defined in makefile */
-+#define HOST_BUSY(ha) atomic_read(&ha->host->host_busy)
-+#else
-+#define HOST_BUSY(ha) ha->host->host_busy
-+#endif
-+
-+
-+/*
-+ * Compile time Options:
-+ * 0 - Disable and 1 - Enable
-+ */
-+#define DEBUG_QLA4xx 0 /* For Debug of qla4xxx */
-+
-+#define DISABLE_HBA_RESETS 0
-+
-+/* Failover options */
-+#define MAX_RECOVERYTIME 10 /*
-+ * Max suspend time for a lun recovery
-+ * time
-+ */
-+#define MAX_FAILBACKTIME 5 /* Max suspend time before fail back */
-+
-+#define EXTEND_CMD_TIMEOUT 60
-+#if 0
-+/*
-+ * When a lun is suspended for the "Not Ready" condition then it will suspend
-+ * the lun for increments of 6 sec delays. SUSPEND_COUNT is that count.
-+ */
-+#define SUSPEND_COUNT 10 /* 6 secs * 10 retries = 60 secs */
-+
-+/*
-+ * Defines the time in seconds that the driver extends the command timeout to
-+ * get around the problem where the mid-layer only allows 5 retries for
-+ * commands that return BUS_BUSY
-+ */
-+
-+#define MAX_RETRIES_OF_ISP_ABORT 5
-+
-+#define DISABLE_HBA_RESETS 1
-+
-+//#include "ql4_version.h"
-+#endif
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_version.h ./drivers/scsi/qla4xxx/ql4_version.h
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_version.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_version.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,24 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ ****************************************************************************/
-+
-+#define QLA4XXX_DRIVER_VERSION "5.00.02"
-+
-+#define QL4_DRIVER_MAJOR_VER 5
-+#define QL4_DRIVER_MINOR_VER 0
-+#define QL4_DRIVER_PATCH_VER 2
-+#define QL4_DRIVER_BETA_VER 0
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/ql4_xioct.c ./drivers/scsi/qla4xxx/ql4_xioct.c
---- ./drivers/scsi/qla4xxx.qla4xxx/ql4_xioct.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/ql4_xioct.c 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,4513 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE *
-+ * *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x *
-+ * Copyright (C) 2004 Qlogic Corporation *
-+ * (www.qlogic.com) *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify it *
-+ * under the terms of the GNU General Public License as published by the *
-+ * Free Software Foundation; either version 2, or (at your option) any *
-+ * later version. *
-+ * *
-+ * This program is distributed in the hope that it will be useful, but *
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
-+ * General Public License for more details. *
-+ * *
-+ ******************************************************************************
-+ * Please see release.txt for revision history. *
-+ * *
-+ ******************************************************************************
-+ * Function Table of Contents:
-+ * qla4extioctl_query_hba_iscsi_node
-+ * qla4extioctl_query_hba_iscsi_portal
-+ * qla4extioctl_query_disc_iscsi_node
-+ * qla4extioctl_query_disc_iscsi_portal
-+ * qla4extioctl_query_driver
-+ * qla4extioctl_query_fw
-+ * qla4extioctl_query_chip
-+ * qla4extioctl_query
-+ * qla4extioctl_reg_aen
-+ * qla4extioctl_get_aen
-+ * qla4extioctl_get_statistics_gen
-+ * qla4extioctl_get_statistics_iscsi
-+ * qla4extioctl_get_device_entry_iscsi
-+ * qla4extioctl_get_init_fw_iscsi
-+ * qla4extioctl_get_isns_server
-+ * qla4extioctl_get_isns_disc_targets
-+ * qla4extioctl_get_data
-+ * qla4extioctl_rst_statistics_gen
-+ * qla4extioctl_rst_statistics_iscsi
-+ * qla4extioctl_set_device_entry_iscsi
-+ * qla4extioctl_set_init_fw_iscsi
-+ * qla4extioctl_set_isns_server
-+ * qla4extioctl_set_data
-+ * qla4xxx_ioctl_sleep_done
-+ * qla4xxx_ioctl_sem_init
-+ * qla4xxx_scsi_pass_done
-+ * qla4extioctl_scsi_passthru
-+ * qla4extioctl_iscsi_passthru
-+ * qla4extioctl_get_hbacnt
-+ * qla4xxx_ioctl
-+ ****************************************************************************/
-+
-+#include "ql4_def.h"
-+
-+#include "ql4_ioctl.h"
-+#include "qlinioct.h"
-+#if defined(QLA_CONFIG_COMPAT)
-+#include "ql4_32ioctl.h"
-+#endif
-+
-+#define QLA_IOCTL_SCRAP_SIZE 17000 /* scrap memory for local use. */
-+#define STATIC
-+
-+/*
-+ * Externs from ql4_inioct.c
-+ */
-+extern int qla4intioctl_logout_iscsi(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+extern int qla4intioctl_ping(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+extern int qla4intioctl_get_data(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+extern int qla4intioctl_set_data(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+extern int qla4intioctl_hba_reset(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+extern int qla4intioctl_copy_fw_flash(scsi_qla_host_t *, EXT_IOCTL_ISCSI *);
-+
-+/*
-+ * extern from ql4_nfoioctl.c
-+ */
-+extern int qla4xxx_nfo_ioctl(struct scsi_device *, int, void *);
-+
-+/* local function prototypes */
-+int
-+qla4xxx_ioctl(struct scsi_device *, int, void *);
-+
-+/*
-+ * ioctl initialization
-+ */
-+static struct class_simple *apidev_class;
-+static int apidev_major;
-+
-+static int
-+apidev_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ return (qla4xxx_ioctl(NULL, (int)cmd, (void*)arg));
-+}
-+
-+static struct file_operations apidev_fops = {
-+ .owner = THIS_MODULE,
-+ .ioctl = apidev_ioctl,
-+};
-+
-+inline void *
-+ql4_kzmalloc(int siz, int code)
-+{
-+ void * bp;
-+
-+ if ((bp = kmalloc(siz, code)) != NULL) {
-+ memset(bp, 0, siz);
-+ }
-+
-+ return (bp);
-+}
-+
-+
-+/*
-+ * qla4xxx_alloc_ioctl_mem
-+ * Allocates memory needed by IOCTL code.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * ql4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_alloc_ioctl_mem(scsi_qla_host_t *ha)
-+{
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /* Allocate IOCTL DMA Buffer
-+ * ------------------------- */
-+ ha->ioctl_dma_buf_len = DMA_BUFFER_SIZE;
-+ ha->ioctl_dma_bufv = pci_alloc_consistent(ha->pdev,
-+ ha->ioctl_dma_buf_len, &ha->ioctl_dma_bufp);
-+ if (ha->ioctl_dma_bufv == NULL) {
-+ printk(KERN_WARNING
-+ "qla4xxx(%d): Memory Allocation failed - "
-+ "IOCTL DMA buffer.\n", ha->host_no);
-+
-+ return QLA_ERROR;
-+ }
-+
-+ memset(ha->ioctl_dma_bufv, 0, ha->ioctl_dma_buf_len);
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi%d: %s: IOCTL DMAv = 0x%p\n",
-+ ha->host_no, __func__, ha->ioctl_dma_bufv));
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi%d: %s: IOCTL DMAp = 0x%lx\n",
-+ ha->host_no, __func__, (unsigned long)ha->ioctl_dma_bufp));
-+
-+ /* Allocate context memory buffer */
-+ ha->ioctl = QL_KMEM_ZALLOC(sizeof(hba_ioctl_context));
-+ if (ha->ioctl == NULL) {
-+ /* error */
-+ printk(KERN_WARNING
-+ "ql4xxx(%d): ERROR in ioctl context allocation.\n",
-+ ha->host_no);
-+ return QLA_ERROR;
-+ }
-+
-+ /* Allocate AEN tracking buffer */
-+ ha->ioctl->aen_tracking_queue =
-+ QL_KMEM_ZALLOC(EXT_DEF_MAX_AEN_QUEUE * sizeof(EXT_ASYNC_EVENT));
-+ if (ha->ioctl->aen_tracking_queue == NULL) {
-+ printk(KERN_WARNING
-+ "ql4xxx(%d): ERROR in ioctl aen_queue allocation.\n",
-+ ha->host_no);
-+ return QLA_ERROR;
-+ }
-+
-+ /* Pick the largest size we'll need per ha of all ioctl cmds.
-+ * Use this size when freeing.
-+ */
-+ ha->ioctl->scrap_mem = QL_KMEM_ZALLOC(QLA_IOCTL_SCRAP_SIZE);
-+ if (ha->ioctl->scrap_mem == NULL) {
-+ printk(KERN_WARNING
-+ "ql4xxx(%d): ERROR in ioctl scrap_mem allocation.\n",
-+ ha->host_no);
-+ return QLA_ERROR;
-+ }
-+ ha->ioctl->scrap_mem_size = QLA_IOCTL_SCRAP_SIZE;
-+ ha->ioctl->scrap_mem_used = 0;
-+
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi(%d): %s: scrap_mem_size=%d.\n",
-+ ha->host_no, __func__, ha->ioctl->scrap_mem_size));
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi(%d): %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ LEAVE(__func__);
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla4xxx_free_ioctl_mem
-+ * Frees memory used by IOCTL code for the specified ha.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla4xxx_free_ioctl_mem(scsi_qla_host_t *ha)
-+{
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ha->ioctl != NULL) {
-+
-+ if (ha->ioctl->scrap_mem != NULL) {
-+ /* The size here must match up to what we
-+ * allocated before.
-+ */
-+ QL_KMEM_FREE(ha->ioctl->scrap_mem);
-+ ha->ioctl->scrap_mem = NULL;
-+ ha->ioctl->scrap_mem_size = 0;
-+ }
-+
-+ if (ha->ioctl->aen_tracking_queue != NULL) {
-+ QL_KMEM_FREE(ha->ioctl->aen_tracking_queue);
-+ ha->ioctl->aen_tracking_queue = NULL;
-+ }
-+
-+ QL_KMEM_FREE(ha->ioctl);
-+ ha->ioctl = NULL;
-+ }
-+
-+ if (ha->ioctl_dma_bufv) {
-+ QL4PRINT(QLP4|QLP7,
-+ printk("scsi%d: %s: freeing IOCTL DMA Buffers\n",
-+ ha->host_no, __func__));
-+ pci_free_consistent(ha->pdev, ha->ioctl_dma_buf_len,
-+ ha->ioctl_dma_bufv, ha->ioctl_dma_bufp);
-+ }
-+ ha->ioctl_dma_buf_len = 0;
-+ ha->ioctl_dma_bufv = 0;
-+ ha->ioctl_dma_bufp = 0;
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+}
-+
-+/*
-+ * qla4xxx_get_ioctl_scrap_mem
-+ * Returns pointer to memory of the specified size from the scrap buffer.
-+ * This can be called multiple times before the free call as long
-+ * as the memory is to be used by the same ioctl command and
-+ * there's still memory left in the scrap buffer.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * ppmem = pointer to return a buffer pointer.
-+ * size = size of buffer to return.
-+ *
-+ * Returns:
-+ * ql4xxx local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla4xxx_get_ioctl_scrap_mem(scsi_qla_host_t *ha, void **ppmem, uint32_t size)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint32_t free_mem;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ free_mem = ha->ioctl->scrap_mem_size - ha->ioctl->scrap_mem_used;
-+
-+ if (free_mem >= size) {
-+ *ppmem = ha->ioctl->scrap_mem + ha->ioctl->scrap_mem_used;
-+ ha->ioctl->scrap_mem_used += size;
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi(%d): %s: no more scrap memory.\n",
-+ ha->host_no, __func__));
-+
-+ ret = QLA_ERROR;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla4xxx_free_ioctl_scrap_mem
-+ * Makes the entire scrap buffer free for use.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * ql4xxx local function return status code.
-+ *
-+ */
-+void
-+qla4xxx_free_ioctl_scrap_mem(scsi_qla_host_t *ha)
-+{
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ memset(ha->ioctl->scrap_mem, 0, ha->ioctl->scrap_mem_size);
-+ ha->ioctl->scrap_mem_used = 0;
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+}
-+
-+int
-+qla4xxx_ioctl_init(void)
-+{
-+ void * tmp;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi: %s: entered.\n",
-+ __func__));
-+
-+ apidev_class = class_simple_create(THIS_MODULE, "qla4xxx");
-+ if (IS_ERR(apidev_class)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(): Unable to sysfs class for qla4xxx.\n",
-+ __func__));
-+
-+ apidev_class = NULL;
-+ return 1;
-+ }
-+ QL4PRINT(QLP4,
-+ printk("scsi: %s: apidev_class=%p.\n",
-+ __func__, apidev_class));
-+
-+ apidev_major = register_chrdev(0, "qla4xxx", &apidev_fops);
-+ if (apidev_major < 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(): Unable to register CHAR device (%d)\n",
-+ __func__, apidev_major));
-+
-+ class_simple_destroy(apidev_class);
-+ apidev_class = NULL;
-+
-+ return apidev_major;
-+ }
-+ QL4PRINT(QLP4,
-+ printk("scsi: %s: apidev_major=%d.\n",
-+ __func__, apidev_major));
-+
-+ tmp = class_simple_device_add(apidev_class, MKDEV(apidev_major, 0),
-+ NULL, "qla4xxx");
-+ QL4PRINT(QLP4,
-+ printk("scsi: %s: tmp=%p.\n",
-+ __func__, tmp));
-+
-+#if defined(QLA_CONFIG_COMPAT)
-+ ql4_apidev_init_32ioctl();
-+#endif
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi: %s: exiting.\n",
-+ __func__));
-+ LEAVE(__func__);
-+
-+ return 0;
-+}
-+
-+int
-+qla4xxx_ioctl_exit(void)
-+{
-+ ENTER(__func__);
-+
-+ if (!apidev_class)
-+ return 1;
-+
-+#if defined(QLA_CONFIG_COMPAT)
-+ ql4_apidev_cleanup_32ioctl();
-+#endif
-+
-+ class_simple_device_remove(MKDEV(apidev_major, 0));
-+
-+ unregister_chrdev(apidev_major, "qla4xxx");
-+
-+ class_simple_destroy(apidev_class);
-+
-+ apidev_class = NULL;
-+
-+ LEAVE(__func__);
-+
-+ return 0;
-+}
-+
-+/*
-+ * ioctl support functions
-+ */
-+
-+void *
-+Q64BIT_TO_PTR(uint64_t buf_addr)
-+{
-+#if defined(QLA_CONFIG_COMPAT) || !defined(CONFIG_64BIT)
-+ union ql_doublelong {
-+ struct {
-+ uint32_t lsl;
-+ uint32_t msl;
-+ } longs;
-+ uint64_t dl;
-+ };
-+
-+ union ql_doublelong tmpval;
-+
-+ tmpval.dl = buf_addr;
-+#if defined(QLA_CONFIG_COMPAT)
-+ return((void *)(uint64_t)(tmpval.longs.lsl));
-+#else
-+ return((void *)(tmpval.longs.lsl));
-+#endif
-+#else
-+ return((void *)buf_addr);
-+#endif
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_hba_iscsi_node
-+ * This routine retrieves the HBA node properties
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_hba_iscsi_node(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_HBA_ISCSI_NODE *phba_node = NULL;
-+ INIT_FW_CTRL_BLK *init_fw_cb;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&phba_node,
-+ sizeof(EXT_HBA_ISCSI_NODE))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_ISCSI_NODE)));
-+ goto exit_query_hba_node;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp || !ioctl->ResponseAdr) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory allocation problem\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_query_hba_node;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_HBA_ISCSI_NODE) ||
-+ ha->ioctl_dma_buf_len < sizeof(*init_fw_cb)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_query_hba_node;
-+ }
-+
-+ /*
-+ * Send mailbox command
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+
-+ goto exit_query_hba_node;
-+ }
-+
-+ /*
-+ * Transfer data from Fw's DEV_DB_ENTRY buffer to IOCTL's
-+ * EXT_HBA_ISCSI_NODE buffer
-+ */
-+ init_fw_cb = (INIT_FW_CTRL_BLK *) ha->ioctl_dma_bufv;
-+
-+ memset(phba_node, 0, sizeof(EXT_HBA_ISCSI_NODE));
-+ phba_node->PortNumber = le16_to_cpu(init_fw_cb->PortNumber);
-+ phba_node->NodeInfo.PortalCount = 1;
-+
-+ memcpy(phba_node->NodeInfo.IPAddr.IPAddress, init_fw_cb->IPAddr,
-+ sizeof(phba_node->NodeInfo.IPAddr.IPAddress));
-+ memcpy(phba_node->NodeInfo.iSCSIName, init_fw_cb->iSCSINameString,
-+ sizeof(phba_node->NodeInfo.iSCSIName));
-+ memcpy(phba_node->NodeInfo.Alias, init_fw_cb->Alias,
-+ sizeof(phba_node->NodeInfo.Alias));
-+
-+ sprintf(phba_node->DeviceName, "/proc/scsi/qla4xxx/%d",
-+ ha->host_no);
-+
-+ /*
-+ * Copy the IOCTL EXT_HBA_ISCSI_NODE buffer to the user's data space
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), phba_node,
-+ ioctl->ResponseLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: copy failed\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_query_hba_node;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_query_hba_node:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_hba_iscsi_portal
-+ * This routine retrieves the HBA iSCSI portal properties
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_hba_iscsi_portal(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_HBA_ISCSI_PORTAL *phba_portal;
-+ FLASH_SYS_INFO *sys_info;
-+ uint32_t num_valid_ddb_entries;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (!ioctl->ResponseAdr) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: no response buffer found.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_query_hba_portal;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&phba_portal,
-+ sizeof(EXT_HBA_ISCSI_PORTAL))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_ISCSI_PORTAL)));
-+ goto exit_query_hba_portal;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(*phba_portal)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_query_hba_portal;
-+ }
-+
-+ /*
-+ * Fill in EXT_HBA_ISCSI_PORTAL buffer
-+ */
-+ memset(phba_portal, 0, sizeof(EXT_HBA_ISCSI_PORTAL));
-+
-+ strcpy(phba_portal->DriverVersion, QLA4XXX_DRIVER_VERSION);
-+ sprintf(phba_portal->FWVersion, "%02d.%02d Patch %02d Build %02d",
-+ ha->firmware_version[0], ha->firmware_version[1],
-+ ha->patch_number, ha->build_number);
-+
-+ /* ----- Get firmware state information ---- */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_FW_STATE;
-+ if (qla4xxx_mailbox_command(ha, 1, 4, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: MBOX_CMD_GET_FW_STATE "
-+ "failed w/ status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+/* RLU: mailbox values should be stored in VendorSpecificStatus */
-+ goto exit_query_hba_portal;
-+ }
-+
-+ switch (mbox_sts[1]) {
-+ case FW_STATE_READY:
-+ phba_portal->State = EXT_DEF_CARD_STATE_READY;
-+ break;
-+ case FW_STATE_CONFIG_WAIT:
-+ phba_portal->State = EXT_DEF_CARD_STATE_CONFIG_WAIT;
-+ break;
-+ case FW_STATE_WAIT_LOGIN:
-+ phba_portal->State = EXT_DEF_CARD_STATE_LOGIN;
-+ break;
-+ case FW_STATE_ERROR:
-+ phba_portal->State = EXT_DEF_CARD_STATE_ERROR;
-+ break;
-+ }
-+
-+ switch (mbox_sts[3] & 0x0001) {
-+ case FW_ADDSTATE_COPPER_MEDIA:
-+ phba_portal->Type = EXT_DEF_TYPE_COPPER;
-+ break;
-+ case FW_ADDSTATE_OPTICAL_MEDIA:
-+ phba_portal->Type = EXT_DEF_TYPE_OPTICAL;
-+ break;
-+ }
-+
-+ /* ----- Get ddb entry information ---- */
-+ if (qla4xxx_get_fwddb_entry(ha, 0, NULL, 0, &num_valid_ddb_entries,
-+ NULL, NULL, NULL, NULL, NULL) == QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: qla4xxx_get_ddb_entry failed!\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->RequestLen = 0;
-+ ioctl->DetailStatus = ioctl->Instance;
-+
-+ goto exit_query_hba_portal;
-+ }
-+
-+ phba_portal->DiscTargetCount = (uint16_t) num_valid_ddb_entries;
-+
-+ /* ----- Get flash sys info information ---- */
-+ sys_info = (FLASH_SYS_INFO *) ha->ioctl_dma_bufv;
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = INT_ISCSI_SYSINFO_FLASH_OFFSET;
-+ mbox_cmd[4] = sizeof(*sys_info);
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: MBOX_CMD_READ_FLASH failed w/ "
-+ "status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+/* RLU: mailbox values should be stored in VendorSpecificStatus */
-+
-+ goto exit_query_hba_portal;
-+ }
-+
-+ phba_portal->SerialNum = le32_to_cpu(sys_info->serialNumber);
-+ memcpy(phba_portal->IPAddr.IPAddress, ha->ip_address,
-+ MIN(sizeof(phba_portal->IPAddr.IPAddress), sizeof(ha->ip_address)));
-+ memcpy(phba_portal->MacAddr, sys_info->physAddr[0].address,
-+ sizeof(phba_portal->MacAddr));
-+ memcpy(phba_portal->Manufacturer, sys_info->vendorId,
-+ sizeof(phba_portal->Manufacturer));
-+ memcpy(phba_portal->Model, sys_info->productId,
-+ sizeof(phba_portal->Model));
-+
-+ /*memcpy(phba_portal->OptRomVersion, ?,
-+ sizeof(phba_portal->OptRomVersion)); */
-+
-+ /*
-+ * Copy the IOCTL EXT_HBA_ISCSI_PORTAL buffer to the user's data space
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ phba_portal, ioctl->ResponseLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_query_hba_portal;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_query_hba_portal:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_disc_iscsi_node
-+ * This routine retrieves the properties of the attached devices
-+ * registered as iSCSI nodes discovered by the HBA driver.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_disc_iscsi_node(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ DEV_DB_ENTRY *fw_ddb_entry = (DEV_DB_ENTRY *) ha->ioctl_dma_bufv;
-+ EXT_DISC_ISCSI_NODE *pdisc_node;
-+ ddb_entry_t *ddb_entry;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_DISC_ISCSI_NODE)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_disc_node;
-+ }
-+
-+ if (ha->ioctl_dma_buf_len < sizeof(DEV_DB_ENTRY)) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha, sizeof(DEV_DB_ENTRY)) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_disc_node;
-+ }
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pdisc_node,
-+ sizeof(EXT_DISC_ISCSI_NODE))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DISC_ISCSI_NODE)));
-+ goto exit_disc_node;
-+ }
-+
-+ /* ----- get device database entry info from firmware ---- */
-+ if (qla4xxx_get_fwddb_entry(ha, ioctl->Instance, fw_ddb_entry,
-+ ha->ioctl_dma_bufp, NULL, NULL, NULL, NULL, NULL, NULL) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to get DEV_DB_ENTRY "
-+ "info.\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->RequestLen = 0;
-+ ioctl->DetailStatus = ioctl->Instance;
-+
-+ goto exit_disc_node;
-+ }
-+
-+ /* --- Transfer data from Fw's DEV_DB_ENTRY buffer to
-+ * IOCTL's EXT_DISC_ISCSI_PORTAL buffer --- */
-+ memset(pdisc_node, 0, sizeof(EXT_DISC_ISCSI_NODE));
-+ pdisc_node->NodeInfo.PortalCount = 1;
-+ pdisc_node->NodeInfo.IPAddr.Type = EXT_DEF_TYPE_ISCSI_IP;
-+ memcpy(pdisc_node->NodeInfo.IPAddr.IPAddress, fw_ddb_entry->ipAddr,
-+ MIN(sizeof(pdisc_node->NodeInfo.IPAddr.IPAddress),
-+ sizeof(fw_ddb_entry->ipAddr)));
-+ strncpy(pdisc_node->NodeInfo.Alias, fw_ddb_entry->iSCSIAlias,
-+ MIN(sizeof(pdisc_node->NodeInfo.Alias),
-+ sizeof(fw_ddb_entry->iSCSIAlias)));
-+ strncpy(pdisc_node->NodeInfo.iSCSIName, fw_ddb_entry->iscsiName,
-+ MIN(sizeof(pdisc_node->NodeInfo.iSCSIName),
-+ sizeof(fw_ddb_entry->iscsiName)));
-+
-+ if ((ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, ioctl->Instance))==
-+ NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: device index [%d] not logged in. "
-+ "Dummy target info returned.\n",
-+ ha->host_no, __func__, ioctl->Instance));
-+
-+ pdisc_node->SessionID = 0xDEAD;
-+ pdisc_node->ConnectionID = 0xDEAD;
-+ pdisc_node->PortalGroupID = 0xDEAD;
-+ pdisc_node->ScsiAddr.Bus = 0xFF;
-+ pdisc_node->ScsiAddr.Target = 0xFF;
-+ pdisc_node->ScsiAddr.Lun = 0xFF;
-+ }
-+ else {
-+ pdisc_node->SessionID = ddb_entry->target_session_id;
-+ pdisc_node->ConnectionID = ddb_entry->connection_id;
-+ pdisc_node->PortalGroupID = 0;
-+ pdisc_node->ScsiAddr.Bus = 0;
-+ pdisc_node->ScsiAddr.Target = ddb_entry->fcport->os_target_id;
-+ pdisc_node->ScsiAddr.Lun = 0;
-+ }
-+
-+ /* --- Copy Results to user space --- */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pdisc_node, sizeof(EXT_DISC_ISCSI_NODE))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: copy error to user space.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_disc_node;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_disc_node:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_disc_iscsi_portal
-+ * This routine retrieves the properties of the iSCSI portal
-+ * discovered by the HBA driver.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_disc_iscsi_portal(scsi_qla_host_t *ha,
-+ EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ DEV_DB_ENTRY *fw_ddb_entry = (DEV_DB_ENTRY *) ha->ioctl_dma_bufv;
-+ EXT_DISC_ISCSI_PORTAL *pdisc_portal;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pdisc_portal,
-+ sizeof(EXT_DISC_ISCSI_PORTAL))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DISC_ISCSI_PORTAL)));
-+ goto exit_disc_portal;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_DISC_ISCSI_PORTAL)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_disc_portal;
-+ }
-+
-+ if (ha->ioctl_dma_buf_len < sizeof(DEV_DB_ENTRY)) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha, sizeof(DEV_DB_ENTRY)) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_disc_portal;
-+ }
-+ }
-+
-+ /* ----- get device database entry info from firmware ---- */
-+ if (qla4xxx_get_fwddb_entry(ha, ioctl->Instance, fw_ddb_entry,
-+ ha->ioctl_dma_bufp, NULL, NULL, NULL, NULL, NULL, NULL) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to get DEV_DB_ENTRY info.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->RequestLen = 0;
-+ ioctl->DetailStatus = ioctl->Instance;
-+ goto exit_disc_portal;
-+ }
-+
-+ /* --- Transfer data from Fw's DEV_DB_ENTRY buffer to IOCTL's
-+ * EXT_DISC_ISCSI_PORTAL buffer --- */
-+ memset(pdisc_portal, 0, sizeof(EXT_DISC_ISCSI_PORTAL));
-+ memcpy(pdisc_portal->IPAddr.IPAddress, fw_ddb_entry->ipAddr,
-+ MIN(sizeof(pdisc_portal->IPAddr.IPAddress),
-+ sizeof(fw_ddb_entry->ipAddr)));
-+
-+ pdisc_portal->PortNumber = le16_to_cpu(fw_ddb_entry->portNumber);
-+ pdisc_portal->IPAddr.Type = EXT_DEF_TYPE_ISCSI_IP;
-+ pdisc_portal->NodeCount = 0;
-+
-+ strncpy(pdisc_portal->HostName, fw_ddb_entry->iscsiName,
-+ MIN(sizeof(pdisc_portal->HostName),
-+ sizeof(fw_ddb_entry->iscsiName)));
-+
-+ /* --- Copy Results to user space --- */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pdisc_portal, sizeof(EXT_DISC_ISCSI_PORTAL))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: copy error to user space.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_disc_portal;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_disc_portal:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_driver
-+ * This routine retrieves the driver properties.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_driver(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ EXT_DRIVER_INFO *pdinfo;
-+ int status = 0;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pdinfo,
-+ sizeof(EXT_DRIVER_INFO))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DRIVER_INFO)));
-+ goto exit_query_driver;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_DRIVER_INFO)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_query_driver;
-+ }
-+
-+ memset(pdinfo, 0, sizeof(EXT_DRIVER_INFO));
-+ memcpy(pdinfo->Version, QLA4XXX_DRIVER_VERSION,
-+ sizeof(QLA4XXX_DRIVER_VERSION));
-+
-+ pdinfo->NumOfBus = EXT_DEF_MAX_HBA;
-+ pdinfo->TargetsPerBus = EXT_DEF_MAX_TARGET;
-+ pdinfo->LunPerTarget = EXT_DEF_MAX_LUN;
-+ pdinfo->LunPerTargetOS = EXT_DEF_MAX_BUS;
-+
-+ if (sizeof(dma_addr_t) > 4)
-+ pdinfo->DmaBitAddresses = 1; /* 64-bit */
-+ else
-+ pdinfo->DmaBitAddresses = 0; /* 32-bit */
-+
-+ if (ha->mem_addr)
-+ pdinfo->IoMapType = 1;
-+ else
-+ pdinfo->IoMapType = 0;
-+
-+ //FIXME: Incomplete
-+ //pdinfo->MaxTransferLen = ?;
-+ //pdinfo->MaxDataSegments = ?;
-+ //pdinfo->Attrib = ?;
-+ //pdinfo->InternalFlags = ?;
-+
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), pdinfo,
-+ sizeof(EXT_DRIVER_INFO))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi(%d): %s: error copy to response buffer.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_query_driver;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_query_driver:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_fw
-+ * This routine retrieves the firmware properties.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_fw(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ EXT_FW_INFO *pfw_info;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ int status = 0;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pfw_info,
-+ sizeof(EXT_FW_INFO))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_FW_INFO)));
-+ goto exit_query_fw;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_FW_INFO)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_query_fw;
-+ }
-+
-+ /* Fill in structure */
-+ memset(pfw_info, 0, sizeof(EXT_FW_INFO));
-+
-+ /* ----- Get firmware version information ---- */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_ABOUT_FW;
-+
-+ /*
-+ * NOTE: In QLA4010, mailboxes 2 & 3 may hold an address for data.
-+ * Make sure that we write 0 to those mailboxes, if unused.
-+ */
-+ if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: MBOX_CMD_ABOUT_FW failed w/ "
-+ "status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+/* RLU: mailbox values should be stored in VendorSpecificStatus */
-+ goto exit_query_fw;
-+ }
-+
-+ sprintf(pfw_info->Version, "FW Version %d.%d Patch %d Build %d",
-+ mbox_sts[1], mbox_sts[2], mbox_sts[3], mbox_sts[4]);
-+
-+ /* Copy info to caller */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), pfw_info,
-+ sizeof(EXT_FW_INFO))) != 0) {
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi(%d): %s: response copy error.\n",
-+ ha->host_no, __func__));
-+
-+ goto exit_query_fw;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_query_fw:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query_chip
-+ * This routine retrieves the chip properties.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query_chip(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_CHIP_INFO *pchip_info;
-+ FLASH_SYS_INFO *sys_info;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pchip_info,
-+ sizeof(EXT_CHIP_INFO))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_CHIP_INFO)));
-+ goto exit_query_chip;
-+ }
-+
-+ if (!ioctl->ResponseAdr || ioctl->ResponseLen < sizeof(EXT_CHIP_INFO)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_query_chip;
-+ }
-+
-+ /* Fill in structure */
-+ memset(pchip_info, 0, sizeof(EXT_CHIP_INFO));
-+
-+ /* ----- Get flash sys info information ---- */
-+ sys_info = (FLASH_SYS_INFO *) ha->ioctl_dma_bufv;
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = INT_ISCSI_SYSINFO_FLASH_OFFSET;
-+ mbox_cmd[4] = sizeof(*sys_info);
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: MBOX_CMD_READ_FLASH failed "
-+ "w/ status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+/* RLU: mailbox values should be stored in VendorSpecificStatus */
-+ goto exit_query_chip;
-+ }
-+
-+ pchip_info->VendorId = le32_to_cpu(sys_info->pciDeviceVendor);
-+ pchip_info->DeviceId = le32_to_cpu(sys_info->pciDeviceId);
-+ pchip_info->SubVendorId = le32_to_cpu(sys_info->pciSubsysVendor);
-+ pchip_info->SubSystemId = le32_to_cpu(sys_info->pciSubsysId);
-+
-+ /* ----- Get firmware state information ---- */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_FW_STATE;
-+ if (qla4xxx_mailbox_command(ha, 1, 4, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: MBOX_CMD_GET_FW_STATE failed "
-+ "w/ status %04X\n",
-+ ha->host_no, __func__, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+/* RLU: mailbox values should be stored in VendorSpecificStatus */
-+ goto exit_query_chip;
-+ }
-+
-+ pchip_info->BoardID = mbox_sts[2];
-+
-+ /* Copy info to caller */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pchip_info, sizeof(EXT_CHIP_INFO))) != 0) {
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi(%d): %s: response copy error.\n",
-+ ha->host_no, __func__));
-+
-+ goto exit_query_chip;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_query_chip:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_query
-+ * This routine calls query IOCTLs based on the IOCTL Sub Code.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ * -EINVAL = if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_query(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ switch (ioctl->SubCode) {
-+ case EXT_SC_QUERY_HBA_ISCSI_NODE:
-+ return(qla4extioctl_query_hba_iscsi_node(ha, ioctl));
-+
-+ case EXT_SC_QUERY_HBA_ISCSI_PORTAL:
-+ return(qla4extioctl_query_hba_iscsi_portal(ha, ioctl));
-+
-+ case EXT_SC_QUERY_DISC_ISCSI_NODE:
-+ return(qla4extioctl_query_disc_iscsi_node(ha, ioctl));
-+
-+ case EXT_SC_QUERY_DISC_ISCSI_PORTAL:
-+ return(qla4extioctl_query_disc_iscsi_portal(ha, ioctl));
-+
-+ case EXT_SC_QUERY_DRIVER:
-+ return(qla4extioctl_query_driver(ha, ioctl));
-+
-+ case EXT_SC_QUERY_FW:
-+ return(qla4extioctl_query_fw(ha, ioctl));
-+
-+ case EXT_SC_QUERY_CHIP:
-+ return(qla4extioctl_query_chip(ha, ioctl));
-+
-+ default:
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unsupported query sub-command "
-+ "code (%x)\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ return(0);
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_reg_aen
-+ * This routine enables/disables storing of asynchronous events
-+ * from the ISP into the driver's internal buffer.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_reg_aen(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+ ENTER(__func__);
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: UNSUPPORTED\n", ha->host_no, __func__));
-+
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_aen
-+ * This routine retrieves the contents of the driver's internal
-+ * asynchronous event tracking queue.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_aen(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+ ENTER("qla4extioctl_get_aen");
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: UNSUPPORTED\n", ha->host_no, __func__));
-+
-+ LEAVE("qla4extioctl_get_aen");
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_statistics_gen
-+ * This routine retrieves the HBA general statistical information.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_statistics_gen(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ EXT_HBA_PORT_STAT_GEN *pstat_gen;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pstat_gen,
-+ sizeof(EXT_HBA_PORT_STAT_GEN))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_PORT_STAT_GEN)));
-+ goto exit_get_stat_gen;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_HBA_PORT_STAT_GEN)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_get_stat_gen;
-+ }
-+
-+ /*
-+ * Fill in the data
-+ */
-+ memset(pstat_gen, 0, sizeof(EXT_HBA_PORT_STAT_GEN));
-+ pstat_gen->HBAPortErrorCount = ha->adapter_error_count;
-+ pstat_gen->DevicePortErrorCount = ha->device_error_count;
-+ pstat_gen->IoCount = ha->total_io_count;
-+ pstat_gen->MBytesCount = ha->total_mbytes_xferred;
-+ pstat_gen->InterruptCount = ha->isr_count;
-+ pstat_gen->LinkFailureCount = ha->link_failure_count;
-+ pstat_gen->InvalidCrcCount = ha->invalid_crc_count;
-+
-+ /*
-+ * Copy the IOCTL EXT_HBA_PORT_STAT_GEN buffer to the user's data space
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), pstat_gen,
-+ ioctl->ResponseLen)) != 0) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_stat_gen;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_get_stat_gen:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_statistics_iscsi
-+ * This routine retrieves the HBA iSCSI statistical information.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_statistics_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_HBA_PORT_STAT_ISCSI* pstat_local;
-+ EXT_HBA_PORT_STAT_ISCSI* pstat_user;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ pstat_user = kmalloc(sizeof(EXT_HBA_PORT_STAT_ISCSI), GFP_ATOMIC);
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pstat_user,
-+ sizeof(EXT_HBA_PORT_STAT_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_PORT_STAT_ISCSI)));
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ if (!ioctl->ResponseAdr || !ioctl->ResponseLen) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: invalid parameter\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_HBA_PORT_STAT_ISCSI)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: RespLen too small (0x%x), "
-+ "need (0x%x).\n",
-+ ha->host_no, __func__, ioctl->ResponseLen,
-+ (unsigned int) sizeof(EXT_HBA_PORT_STAT_ISCSI)));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ if ((ha->ioctl_dma_buf_len < sizeof(EXT_HBA_PORT_STAT_ISCSI)) &&
-+ (qla4xxx_resize_ioctl_dma_buf(ha, sizeof(EXT_HBA_PORT_STAT_ISCSI))
-+ != QLA_SUCCESS)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ /*
-+ * Make the mailbox call
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_MANAGEMENT_DATA;
-+ mbox_cmd[1] = ioctl->Instance;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: get mngmt data for index [%d] failed "
-+ "w/ mailbox ststus 0x%x\n",
-+ ha->host_no, __func__, ioctl->Instance, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ pstat_local = (EXT_HBA_PORT_STAT_ISCSI *) ha->ioctl_dma_bufv;
-+ memset(pstat_user, 0, sizeof(EXT_HBA_PORT_STAT_ISCSI));
-+ pstat_user->MACTxFramesCount =
-+ le64_to_cpu(pstat_local->MACTxFramesCount);
-+ pstat_user->MACTxBytesCount =
-+ le64_to_cpu(pstat_local->MACTxBytesCount);
-+ pstat_user->MACRxFramesCount =
-+ le64_to_cpu(pstat_local->MACRxFramesCount);
-+ pstat_user->MACRxBytesCount =
-+ le64_to_cpu(pstat_local->MACRxBytesCount);
-+ pstat_user->MACCRCErrorCount =
-+ le64_to_cpu(pstat_local->MACCRCErrorCount);
-+ pstat_user->MACEncodingErrorCount =
-+ le64_to_cpu(pstat_local->MACEncodingErrorCount);
-+ pstat_user->IPTxPacketsCount =
-+ le64_to_cpu(pstat_local->IPTxPacketsCount);
-+ pstat_user->IPTxBytesCount =
-+ le64_to_cpu(pstat_local->IPTxBytesCount);
-+ pstat_user->IPTxFragmentsCount =
-+ le64_to_cpu(pstat_local->IPTxFragmentsCount);
-+ pstat_user->IPRxPacketsCount =
-+ le64_to_cpu(pstat_local->IPRxPacketsCount);
-+ pstat_user->IPRxBytesCount =
-+ le64_to_cpu(pstat_local->IPRxBytesCount);
-+ pstat_user->IPRxFragmentsCount =
-+ le64_to_cpu(pstat_local->IPRxFragmentsCount);
-+ pstat_user->IPDatagramReassemblyCount =
-+ le64_to_cpu(pstat_local->IPDatagramReassemblyCount);
-+ pstat_user->IPv6RxPacketsCount =
-+ le64_to_cpu(pstat_local->IPv6RxPacketsCount);
-+ pstat_user->IPRxPacketErrorCount =
-+ le64_to_cpu(pstat_local->IPRxPacketErrorCount);
-+ pstat_user->IPReassemblyErrorCount =
-+ le64_to_cpu(pstat_local->IPReassemblyErrorCount);
-+ pstat_user->TCPTxSegmentsCount =
-+ le64_to_cpu(pstat_local->TCPTxSegmentsCount);
-+ pstat_user->TCPTxBytesCount =
-+ le64_to_cpu(pstat_local->TCPTxBytesCount);
-+ pstat_user->TCPRxSegmentsCount =
-+ le64_to_cpu(pstat_local->TCPRxSegmentsCount);
-+ pstat_user->TCPRxBytesCount =
-+ le64_to_cpu(pstat_local->TCPRxBytesCount);
-+ pstat_user->TCPTimerExpiredCount =
-+ le64_to_cpu(pstat_local->TCPTimerExpiredCount);
-+ pstat_user->TCPRxACKCount =
-+ le64_to_cpu(pstat_local->TCPRxACKCount);
-+ pstat_user->TCPTxACKCount =
-+ le64_to_cpu(pstat_local->TCPTxACKCount);
-+ pstat_user->TCPRxErrorSegmentCount =
-+ le64_to_cpu(pstat_local->TCPRxErrorSegmentCount);
-+ pstat_user->TCPWindowProbeUpdateCount =
-+ le64_to_cpu(pstat_local->TCPWindowProbeUpdateCount);
-+ pstat_user->iSCSITxPDUCount =
-+ le64_to_cpu(pstat_local->iSCSITxPDUCount);
-+ pstat_user->iSCSITxBytesCount =
-+ le64_to_cpu(pstat_local->iSCSITxBytesCount);
-+ pstat_user->iSCSIRxPDUCount =
-+ le64_to_cpu(pstat_local->iSCSIRxPDUCount);
-+ pstat_user->iSCSIRxBytesCount =
-+ le64_to_cpu(pstat_local->iSCSIRxBytesCount);
-+ pstat_user->iSCSICompleteIOsCount =
-+ le64_to_cpu(pstat_local->iSCSICompleteIOsCount);
-+ pstat_user->iSCSIUnexpectedIORxCount =
-+ le64_to_cpu(pstat_local->iSCSIUnexpectedIORxCount);
-+ pstat_user->iSCSIFormatErrorCount =
-+ le64_to_cpu(pstat_local->iSCSIFormatErrorCount);
-+ pstat_user->iSCSIHeaderDigestCount =
-+ le64_to_cpu(pstat_local->iSCSIHeaderDigestCount);
-+ pstat_user->iSCSIDataDigestErrorCount =
-+ le64_to_cpu(pstat_local->iSCSIDataDigestErrorCount);
-+ pstat_user->iSCSISeqErrorCount =
-+ le64_to_cpu(pstat_local->iSCSISeqErrorCount);
-+
-+ /*
-+ * Copy the data from the dma buffer to the user's data space
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pstat_user, ioctl->ResponseLen)) != 0) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_stats_iscsi;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_get_stats_iscsi:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_device_entry_iscsi
-+ * This routine retrieves the database entry for the specified device.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_device_entry_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ DEV_DB_ENTRY *pfw_ddb_entry;
-+ EXT_DEVICE_ENTRY_ISCSI *pdev_entry;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pdev_entry,
-+ sizeof(EXT_DEVICE_ENTRY_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DEVICE_ENTRY_ISCSI)));
-+ goto exit_get_dev_entry;
-+ }
-+
-+ if (ha->ioctl_dma_buf_len < sizeof(DEV_DB_ENTRY)) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha, sizeof(DEV_DB_ENTRY)) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_get_dev_entry;
-+ }
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_DEVICE_ENTRY_ISCSI)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_get_dev_entry;
-+ }
-+
-+ /*
-+ * Make the mailbox call
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ memset(pdev_entry, 0, sizeof(EXT_DEVICE_ENTRY_ISCSI));
-+
-+ if (ioctl->SubCode == EXT_SC_GET_DEVICE_ENTRY_ISCSI)
-+ mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY;
-+ else
-+ mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS;
-+
-+ mbox_cmd[1] = ioctl->Instance;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: get ddb entry for index [%d] failed "
-+ "w/ mailbox ststus 0x%x\n",
-+ ha->host_no, __func__, ioctl->Instance, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_get_dev_entry;
-+ }
-+
-+ /*
-+ * Transfer data from Fw's DEV_DB_ENTRY buffer to IOCTL's
-+ * EXT_DEVICE_ENTRY_ISCSI buffer
-+ */
-+ pfw_ddb_entry = ha->ioctl_dma_bufv;
-+
-+ pdev_entry->NumValid = mbox_sts[2];
-+ pdev_entry->NextValid = mbox_sts[3];
-+ pdev_entry->DeviceState = mbox_sts[4];
-+ pdev_entry->Options = pfw_ddb_entry->options;
-+ pdev_entry->Control = pfw_ddb_entry->control;
-+ pdev_entry->TargetSessID = le16_to_cpu(pfw_ddb_entry->TSID);
-+ memcpy(pdev_entry->InitiatorSessID, pfw_ddb_entry->ISID,
-+ sizeof(pfw_ddb_entry->ISID));
-+
-+ pdev_entry->DeviceInfo.DeviceType = le16_to_cpu(EXT_DEF_ISCSI_REMOTE);
-+ pdev_entry->DeviceInfo.ExeThrottle =
-+ le16_to_cpu(pfw_ddb_entry->exeThrottle);
-+ pdev_entry->DeviceInfo.InitMarkerlessInt =
-+ le16_to_cpu(pfw_ddb_entry->iSCSIMaxSndDataSegLen);
-+ pdev_entry->DeviceInfo.RetryCount = pfw_ddb_entry->retryCount;
-+ pdev_entry->DeviceInfo.RetryDelay = pfw_ddb_entry->retryDelay;
-+ pdev_entry->DeviceInfo.iSCSIOptions =
-+ le16_to_cpu(pfw_ddb_entry->iSCSIOptions);
-+ pdev_entry->DeviceInfo.TCPOptions =
-+ le16_to_cpu(pfw_ddb_entry->TCPOptions);
-+ pdev_entry->DeviceInfo.IPOptions =
-+ le16_to_cpu(pfw_ddb_entry->IPOptions);
-+ pdev_entry->DeviceInfo.MaxPDUSize =
-+ le16_to_cpu(pfw_ddb_entry->maxPDUSize);
-+ pdev_entry->DeviceInfo.FirstBurstSize =
-+ le16_to_cpu(pfw_ddb_entry->firstBurstSize);
-+ pdev_entry->DeviceInfo.LogoutMinTime =
-+ le16_to_cpu(pfw_ddb_entry->minTime2Wait);
-+ pdev_entry->DeviceInfo.LogoutMaxTime =
-+ le16_to_cpu(pfw_ddb_entry->maxTime2Retain);
-+ pdev_entry->DeviceInfo.MaxOutstandingR2T =
-+ le16_to_cpu(pfw_ddb_entry->maxOutstndngR2T);
-+ pdev_entry->DeviceInfo.KeepAliveTimeout =
-+ le16_to_cpu(pfw_ddb_entry->keepAliveTimeout);
-+ pdev_entry->DeviceInfo.PortNumber =
-+ le16_to_cpu(pfw_ddb_entry->portNumber);
-+ pdev_entry->DeviceInfo.MaxBurstSize =
-+ le16_to_cpu(pfw_ddb_entry->maxBurstSize);
-+ pdev_entry->DeviceInfo.TaskMgmtTimeout =
-+ le16_to_cpu(pfw_ddb_entry->taskMngmntTimeout);
-+ pdev_entry->EntryInfo.PortalCount = mbox_sts[2];
-+ pdev_entry->ExeCount = le16_to_cpu(pfw_ddb_entry->exeCount);
-+ pdev_entry->DDBLink = le16_to_cpu(pfw_ddb_entry->ddbLink);
-+
-+ memcpy(pdev_entry->UserID, pfw_ddb_entry->userID,
-+ sizeof(pdev_entry->UserID));
-+ memcpy(pdev_entry->Password, pfw_ddb_entry->password,
-+ sizeof(pdev_entry->Password));
-+
-+ memcpy(pdev_entry->DeviceInfo.TargetAddr, pfw_ddb_entry->targetAddr,
-+ sizeof(pdev_entry->DeviceInfo.TargetAddr));
-+ memcpy(pdev_entry->EntryInfo.IPAddr.IPAddress, pfw_ddb_entry->ipAddr,
-+ sizeof(pdev_entry->EntryInfo.IPAddr.IPAddress));
-+ memcpy(pdev_entry->EntryInfo.iSCSIName, pfw_ddb_entry->iscsiName,
-+ sizeof(pdev_entry->EntryInfo.iSCSIName));
-+ memcpy(pdev_entry->EntryInfo.Alias, pfw_ddb_entry->iSCSIAlias,
-+ sizeof(pdev_entry->EntryInfo.Alias));
-+
-+ QL4PRINT(QLP10|QLP4,
-+ printk("scsi%d: DEV_DB_ENTRY structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP10|QLP4,
-+ pfw_ddb_entry, sizeof(DEV_DB_ENTRY));
-+ QL4PRINT(QLP10|QLP4,
-+ printk("scsi%d: EXT_DEVICE_ENTRY_ISCSI structure:\n",
-+ ha->host_no));
-+ qla4xxx_dump_bytes(QLP10|QLP4,
-+ pdev_entry, sizeof(EXT_DEVICE_ENTRY_ISCSI));
-+
-+ /*
-+ * Copy the IOCTL EXT_DEVICE_ENTRY_ISCSI buffer to the user's data space
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pdev_entry, ioctl->ResponseLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_dev_entry;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_get_dev_entry:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+
-+/**************************************************************************
-+ * qla4extioctl_get_init_fw_iscsi
-+ * This routine retrieves the initialize firmware control block for
-+ * the specified HBA.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_init_fw_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_INIT_FW_ISCSI *pinit_fw;
-+ INIT_FW_CTRL_BLK *pinit_fw_cb;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pinit_fw,
-+ sizeof(EXT_INIT_FW_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_INIT_FW_ISCSI)));
-+ goto exit_get_init_fw;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp ||
-+ (ha->ioctl_dma_buf_len < sizeof(INIT_FW_CTRL_BLK)) ||
-+ (ioctl->ResponseLen < sizeof(EXT_INIT_FW_ISCSI))) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_get_init_fw;
-+ }
-+
-+ /*
-+ * Send mailbox command
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ switch (ioctl->SubCode) {
-+ case EXT_SC_GET_INIT_FW_ISCSI:
-+ mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-+ break;
-+ case EXT_SC_GET_INIT_FW_DEFAULTS_ISCSI:
-+ mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS;
-+ break;
-+ default:
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: invalid subcode (0x%04X) speficied\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ goto exit_get_init_fw;
-+ }
-+
-+ mbox_cmd[1] = 0;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_get_init_fw;
-+ }
-+
-+ /*
-+ * Transfer Data from DMA buffer to Local buffer
-+ */
-+ pinit_fw_cb = (INIT_FW_CTRL_BLK *)ha->ioctl_dma_bufv;
-+ memset(pinit_fw, 0, sizeof(EXT_INIT_FW_ISCSI));
-+
-+ pinit_fw->Version = pinit_fw_cb->Version;
-+ pinit_fw->FWOptions = le16_to_cpu(pinit_fw_cb->FwOptions);
-+ pinit_fw->AddFWOptions = le16_to_cpu(pinit_fw_cb->AddFwOptions);
-+ //FIXME: pinit_fw->WakeupThreshold = le16_to_cpu(pinit_fw_cb->WakeupThreshold);
-+ memcpy(&pinit_fw->IPAddr.IPAddress, &pinit_fw_cb->IPAddr,
-+ MIN(sizeof(pinit_fw->IPAddr.IPAddress),
-+ sizeof(pinit_fw_cb->IPAddr)));
-+ memcpy(&pinit_fw->SubnetMask.IPAddress, &pinit_fw_cb->SubnetMask,
-+ MIN(sizeof(pinit_fw->SubnetMask.IPAddress),
-+ sizeof(pinit_fw_cb->SubnetMask)));
-+ memcpy(&pinit_fw->Gateway.IPAddress, &pinit_fw_cb->GatewayIPAddr,
-+ MIN(sizeof(pinit_fw->Gateway.IPAddress),
-+ sizeof(pinit_fw_cb->GatewayIPAddr)));
-+ memcpy(&pinit_fw->DNSConfig.IPAddr.IPAddress,
-+ &pinit_fw_cb->PriDNSIPAddr,
-+ MIN(sizeof(pinit_fw->DNSConfig.IPAddr.IPAddress),
-+ sizeof(pinit_fw_cb->PriDNSIPAddr)));
-+ memcpy(&pinit_fw->Alias, &pinit_fw_cb->Alias,
-+ MIN(sizeof(pinit_fw->Alias), sizeof(pinit_fw_cb->Alias)));
-+ memcpy(&pinit_fw->iSCSIName, &pinit_fw_cb->iSCSINameString,
-+ MIN(sizeof(pinit_fw->iSCSIName),
-+ sizeof(pinit_fw_cb->iSCSINameString)));
-+
-+ pinit_fw->DeviceInfo.DeviceType = le16_to_cpu(EXT_DEF_ISCSI_LOCAL);
-+ pinit_fw->DeviceInfo.ExeThrottle =
-+ le16_to_cpu(pinit_fw_cb->ExecThrottle);
-+ pinit_fw->DeviceInfo.InitMarkerlessInt =
-+ le16_to_cpu(pinit_fw_cb->InitMarkerlessInt);
-+ pinit_fw->DeviceInfo.RetryCount = pinit_fw_cb->RetryCount;
-+ pinit_fw->DeviceInfo.RetryDelay = pinit_fw_cb->RetryDelay;
-+ pinit_fw->DeviceInfo.iSCSIOptions =
-+ le16_to_cpu(pinit_fw_cb->iSCSIOptions);
-+ pinit_fw->DeviceInfo.TCPOptions = le16_to_cpu(pinit_fw_cb->TCPOptions);
-+ pinit_fw->DeviceInfo.IPOptions = le16_to_cpu(pinit_fw_cb->IPOptions);
-+ pinit_fw->DeviceInfo.MaxPDUSize = le16_to_cpu(pinit_fw_cb->MaxPDUSize);
-+ pinit_fw->DeviceInfo.FirstBurstSize =
-+ le16_to_cpu(pinit_fw_cb->FirstBurstSize);
-+ pinit_fw->DeviceInfo.LogoutMinTime =
-+ le16_to_cpu(pinit_fw_cb->DefaultTime2Wait);
-+ pinit_fw->DeviceInfo.LogoutMaxTime =
-+ le16_to_cpu(pinit_fw_cb->DefaultTime2Retain);
-+ pinit_fw->DeviceInfo.LogoutMaxTime =
-+ le16_to_cpu(pinit_fw_cb->DefaultTime2Retain);
-+ pinit_fw->DeviceInfo.MaxOutstandingR2T =
-+ le16_to_cpu(pinit_fw_cb->MaxOutStndngR2T);
-+ pinit_fw->DeviceInfo.KeepAliveTimeout =
-+ le16_to_cpu(pinit_fw_cb->KeepAliveTimeout);
-+ pinit_fw->DeviceInfo.PortNumber = le16_to_cpu(pinit_fw_cb->PortNumber);
-+ pinit_fw->DeviceInfo.MaxBurstSize =
-+ le16_to_cpu(pinit_fw_cb->MaxBurstSize);
-+ //pinit_fw->DeviceInfo.TaskMgmtTimeout = pinit_fw_cb->T;
-+ memcpy(&pinit_fw->DeviceInfo.TargetAddr, &pinit_fw_cb->TargAddr,
-+ EXT_DEF_ISCSI_TADDR_SIZE);
-+
-+ /*
-+ * Copy the local data to the user's buffer
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), pinit_fw,
-+ sizeof(EXT_INIT_FW_ISCSI))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_init_fw;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP10|QLP4,
-+ printk("scsi%d: EXT_INIT_FW_ISCSI structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP10|QLP4, pinit_fw, sizeof(EXT_INIT_FW_ISCSI));
-+
-+exit_get_init_fw:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_isns_server
-+ * This routine retrieves the iSNS server information.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_isns_server(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_ISNS_SERVER *pisns_server;
-+ FLASH_INIT_FW_CTRL_BLK *pflash_init_fw_cb = NULL;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pisns_server,
-+ sizeof(EXT_ISNS_SERVER))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_ISNS_SERVER)));
-+ goto exit_get_isns_server;
-+ }
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_ISNS_SERVER)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ ioctl->ResponseLen = 0;
-+ goto exit_get_isns_server;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp ||
-+ (ha->ioctl_dma_buf_len < sizeof(FLASH_INIT_FW_CTRL_BLK))) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha,
-+ sizeof(FLASH_INIT_FW_CTRL_BLK)) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ ioctl->ResponseLen = 0;
-+ goto exit_get_isns_server;
-+ }
-+ }
-+
-+ /*
-+ * First get Flash Initialize Firmware Control Block, so as not to
-+ * destroy unaffected data
-+ *----------------------------------------------------------------*/
-+ pflash_init_fw_cb = (FLASH_INIT_FW_CTRL_BLK *)ha->ioctl_dma_bufv;
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = INT_ISCSI_INITFW_FLASH_OFFSET;
-+ mbox_cmd[4] = sizeof(FLASH_INIT_FW_CTRL_BLK);
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: READ_FLASH command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->ResponseLen = 0;
-+ goto exit_get_isns_server;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: READ_FLASH command successful \n",
-+ ha->host_no, __func__));
-+
-+ /*
-+ * Copy iSNS Server info to the isns_server structure
-+ *---------------------------------------------------*/
-+ memset(pisns_server, 0, sizeof(EXT_ISNS_SERVER));
-+ pisns_server->PerformiSNSDiscovery =
-+ (cpu_to_le16(pflash_init_fw_cb->init_fw_cb.TCPOptions) & TOPT_ISNS_ENABLE) ? 1:0;
-+ pisns_server->AutomaticiSNSDiscovery =
-+ (cpu_to_le16(pflash_init_fw_cb->init_fw_cb.TCPOptions) &
-+ TOPT_LEARN_ISNS_IP_ADDR_ENABLE) ? 1 : 0;
-+ pisns_server->PortNumber =
-+ cpu_to_le16(pflash_init_fw_cb->init_fw_cb.iSNSServerPortNumber);
-+ pisns_server->IPAddr.Type = EXT_DEF_TYPE_ISCSI_IP;
-+ memcpy(pisns_server->IPAddr.IPAddress,
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr,
-+ MIN(sizeof(pisns_server->IPAddr.IPAddress),
-+ sizeof(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr)));
-+ memcpy(pisns_server->InitiatorName,
-+ pflash_init_fw_cb->init_fw_cb.iSCSINameString,
-+ MIN(sizeof(pisns_server->InitiatorName),
-+ sizeof(pflash_init_fw_cb->init_fw_cb.iSCSINameString)));
-+
-+#if 1
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_SET_ISNS_SERVICE;
-+ mbox_cmd[1] = ISNS_STATUS;
-+ if (qla4xxx_mailbox_command(ha, 2, 2, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: GET ISNS SERVICE STATUS cmnd failed \n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->ResponseLen = 0;
-+ goto exit_get_isns_server;
-+ }
-+
-+ QL4PRINT(QLP4|QLP20,
-+ printk("scsi%d: %s: GET ISNS SERVICE STATUS = 0x%04x \"%s\"\n",
-+ ha->host_no, __func__, mbox_sts[1],
-+ ((mbox_sts[1] & 1) == 0) ? "DISABLED" : "ENABLED"));
-+#endif
-+
-+ /*
-+ * Copy the local data to the user's buffer
-+ *-----------------------------------------*/
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pisns_server, sizeof(EXT_ISNS_SERVER))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_isns_server;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+ ioctl->ResponseLen = sizeof(EXT_ISNS_SERVER);
-+ ioctl->DetailStatus = 0;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: EXT_ISNS_SERVER structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP4|QLP10,
-+ pisns_server, sizeof(EXT_ISNS_SERVER));
-+
-+exit_get_isns_server:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_isns_disc_targets
-+ * This routine retrieves the targets discovered via iSNS.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_isns_disc_targets(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t isns_disc_tgt_index_start;
-+ uint32_t i, j;
-+ EXT_ISNS_DISCOVERED_TARGETS *pisns_disc_tgts = NULL;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_ISNS_DISCOVERED_TARGETS)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: response buffer "
-+ "too small. RspLen=0x%x, need 0x%x\n",
-+ ha->host_no, __func__, ioctl->ResponseLen,
-+ (unsigned int) sizeof(EXT_ISNS_DISCOVERED_TARGETS)));
-+ ioctl->ResponseLen = 0;
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ ioctl->DetailStatus = sizeof(EXT_ISNS_DISCOVERED_TARGETS);
-+ goto exit_get_isns_disc_tgts;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv ||
-+ ((ioctl->ResponseLen > ha->ioctl_dma_buf_len) &&
-+ qla4xxx_resize_ioctl_dma_buf(ha,
-+ sizeof(EXT_ISNS_DISCOVERED_TARGETS)) != QLA_SUCCESS)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+ ioctl->ResponseLen = 0;
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_get_isns_disc_tgts;
-+ }
-+
-+ /*
-+ * Copy the IOCTL EXT_ISNS_DISCOVERED_TARGETS buffer from the user's
-+ * data space
-+ */
-+ pisns_disc_tgts = (EXT_ISNS_DISCOVERED_TARGETS *) ha->ioctl_dma_bufv;
-+ if (copy_from_user((uint8_t *)pisns_disc_tgts,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), ioctl->RequestLen) != 0) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->ResponseLen = 0;
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_isns_disc_tgts;
-+ }
-+
-+ isns_disc_tgt_index_start =
-+ pisns_disc_tgts->iSNSDiscoveredTargetIndexStart;
-+ memset(pisns_disc_tgts, 0, sizeof(EXT_ISNS_DISCOVERED_TARGETS));
-+ pisns_disc_tgts->iSNSDiscoveredTargetIndexStart =
-+ isns_disc_tgt_index_start;
-+
-+ /*
-+ * Transfer Data from Local buffer to DMA buffer
-+ */
-+ if (isns_disc_tgt_index_start < ha->isns_num_discovered_targets) {
-+ EXT_ISNS_DISCOVERED_TARGET *isns_disc_tgt;
-+ ISNS_DISCOVERED_TARGET *isns_local_disc_target;
-+
-+ for (i = isns_disc_tgt_index_start;
-+ i < ha->isns_num_discovered_targets &&
-+ pisns_disc_tgts->NumiSNSDiscoveredTargets <
-+ EXT_DEF_NUM_ISNS_DISCOVERED_TARGETS;
-+ i++) {
-+ isns_disc_tgt = (EXT_ISNS_DISCOVERED_TARGET *)
-+ &pisns_disc_tgts->iSNSDiscoveredTargets[
-+ pisns_disc_tgts->NumiSNSDiscoveredTargets];
-+ isns_local_disc_target = (ISNS_DISCOVERED_TARGET *)
-+ &ha->isns_disc_tgt_databasev[i];
-+
-+ isns_disc_tgt->NumPortals =
-+ isns_local_disc_target->NumPortals;
-+
-+ for (j = 0; j < isns_disc_tgt->NumPortals; j++) {
-+ memcpy(isns_disc_tgt->Portal[j].IPAddr.
-+ IPAddress,
-+ isns_local_disc_target->Portal[j].IPAddr,
-+ MIN(sizeof(isns_disc_tgt->Portal[j].IPAddr.
-+ IPAddress),
-+ sizeof(isns_local_disc_target->Portal[j].
-+ IPAddr)));
-+ isns_disc_tgt->Portal[j].IPAddr.Type =
-+ EXT_DEF_TYPE_ISCSI_IP;
-+ isns_disc_tgt->Portal[j].PortNumber =
-+ isns_local_disc_target->Portal[j].
-+ PortNumber;
-+ }
-+
-+ isns_disc_tgt->DDID = isns_local_disc_target->DDID;
-+
-+ memcpy(isns_disc_tgt->NameString,
-+ isns_local_disc_target->NameString,
-+ MIN(sizeof(isns_disc_tgt->NameString),
-+ sizeof(isns_local_disc_target->NameString)));
-+ memcpy(isns_disc_tgt->Alias,
-+ isns_local_disc_target->Alias,
-+ MIN(sizeof(isns_disc_tgt->Alias),
-+ sizeof(isns_local_disc_target->Alias)));
-+
-+ pisns_disc_tgts->NumiSNSDiscoveredTargets++;
-+ }
-+ }
-+
-+ /*
-+ * Copy the data to the user's buffer
-+ */
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ pisns_disc_tgts, sizeof(EXT_ISNS_DISCOVERED_TARGETS))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_isns_disc_tgts;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: EXT_INIT_FW_ISCSI structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP4|QLP10,
-+ pisns_disc_tgts, sizeof(EXT_ISNS_DISCOVERED_TARGETS));
-+
-+exit_get_isns_disc_tgts:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_data
-+ * This routine calls get data IOCTLs based on the IOCTL Sub Code.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ * -EINVAL = if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_data(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ switch (ioctl->SubCode) {
-+ case EXT_SC_GET_STATISTICS_GEN:
-+ return(qla4extioctl_get_statistics_gen(ha, ioctl));
-+
-+ case EXT_SC_GET_STATISTICS_ISCSI:
-+ return(qla4extioctl_get_statistics_iscsi(ha, ioctl));
-+
-+ case EXT_SC_GET_DEVICE_ENTRY_ISCSI:
-+ case EXT_SC_GET_DEVICE_ENTRY_DEFAULTS_ISCSI:
-+ return(qla4extioctl_get_device_entry_iscsi(ha, ioctl));
-+
-+ case EXT_SC_GET_INIT_FW_ISCSI:
-+ case EXT_SC_GET_INIT_FW_DEFAULTS_ISCSI:
-+ return(qla4extioctl_get_init_fw_iscsi(ha, ioctl));
-+
-+ case EXT_SC_GET_ISNS_SERVER:
-+ return(qla4extioctl_get_isns_server(ha, ioctl));
-+
-+ case EXT_SC_GET_ISNS_DISCOVERED_TARGETS:
-+ return(qla4extioctl_get_isns_disc_targets(ha, ioctl));
-+
-+ default:
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unsupported external get "
-+ "data sub-command code (%X)\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ return(0);
-+ }
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_rst_statistics_gen
-+ * This routine clears the HBA general statistical information.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_rst_statistics_gen(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /*
-+ * Reset the general statistics fields
-+ */
-+ ha->adapter_error_count = 0;
-+ ha->device_error_count = 0;
-+ ha->total_io_count = 0;
-+ ha->total_mbytes_xferred = 0;
-+ ha->isr_count = 0;
-+ ha->link_failure_count = 0;
-+ ha->invalid_crc_count = 0;
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_rst_statistics_iscsi
-+ * This routine clears the HBA iSCSI statistical information.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_rst_statistics_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ /*
-+ * Make the mailbox call
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_MANAGEMENT_DATA;
-+ mbox_cmd[1] = ioctl->Instance;
-+ mbox_cmd[2] = 0;
-+ mbox_cmd[3] = 0;
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: get mngmt data for index [%d] failed! "
-+ "w/ mailbox ststus 0x%x\n",
-+ ha->host_no, __func__, ioctl->Instance, mbox_sts[0]));
-+
-+ ioctl->Status = EXT_STATUS_MAILBOX;
-+ ioctl->DetailStatus = mbox_sts[0];
-+
-+ return(0);
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_set_device_entry_iscsi
-+ * This routine configures a device with specific database entry data.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_set_device_entry_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ DEV_DB_ENTRY *pfw_ddb_entry;
-+ EXT_DEVICE_ENTRY_ISCSI *pdev_entry;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pdev_entry,
-+ sizeof(EXT_DEVICE_ENTRY_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DEVICE_ENTRY_ISCSI)));
-+ goto exit_set_dev_entry;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp || !ioctl->RequestAdr) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: memory allocation problem\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_set_dev_entry;
-+ }
-+
-+ if (ha->ioctl_dma_buf_len < sizeof(DEV_DB_ENTRY)) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha, sizeof(DEV_DB_ENTRY)) !=
-+ QLA_SUCCESS) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto exit_set_dev_entry;
-+ }
-+ }
-+
-+ if (ioctl->RequestLen < sizeof(EXT_DEVICE_ENTRY_ISCSI)) {
-+ QL4PRINT(QLP2, printk("scsi%d: %s: memory area too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_set_dev_entry;
-+ }
-+
-+ /*
-+ * Copy the IOCTL EXT_DEVICE_ENTRY_ISCSI buffer from the user's
-+ * data space
-+ */
-+ if ((status = copy_from_user((uint8_t *)pdev_entry,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), ioctl->RequestLen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data from user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_set_dev_entry;
-+ }
-+
-+ /*
-+ * Transfer data from IOCTL's EXT_DEVICE_ENTRY_ISCSI buffer to
-+ * Fw's DEV_DB_ENTRY buffer
-+ */
-+ pfw_ddb_entry = ha->ioctl_dma_bufv;
-+ memset(pfw_ddb_entry, 0, sizeof(DEV_DB_ENTRY));
-+
-+ pfw_ddb_entry->options = pdev_entry->Options;
-+ pfw_ddb_entry->control = pdev_entry->Control;
-+ pfw_ddb_entry->TSID = cpu_to_le16(pdev_entry->TargetSessID);
-+ pfw_ddb_entry->exeCount = cpu_to_le16(pdev_entry->ExeCount);
-+ pfw_ddb_entry->ddbLink = cpu_to_le16(pdev_entry->DDBLink);
-+ memcpy(pfw_ddb_entry->ISID, pdev_entry->InitiatorSessID,
-+ sizeof(pdev_entry->InitiatorSessID));
-+ memcpy(pfw_ddb_entry->userID, pdev_entry->UserID,
-+ sizeof(pdev_entry->UserID));
-+ memcpy(pfw_ddb_entry->password, pdev_entry->Password,
-+ sizeof(pdev_entry->Password));
-+
-+ pfw_ddb_entry->exeThrottle =
-+ cpu_to_le16(pdev_entry->DeviceInfo.ExeThrottle);
-+ pfw_ddb_entry->iSCSIMaxSndDataSegLen =
-+ cpu_to_le16(pdev_entry->DeviceInfo.InitMarkerlessInt);
-+ pfw_ddb_entry->retryCount =
-+ pdev_entry->DeviceInfo.RetryCount;
-+ pfw_ddb_entry->retryDelay = pdev_entry->DeviceInfo.RetryDelay;
-+ pfw_ddb_entry->iSCSIOptions =
-+ cpu_to_le16(pdev_entry->DeviceInfo.iSCSIOptions);
-+ pfw_ddb_entry->TCPOptions =
-+ cpu_to_le16(pdev_entry->DeviceInfo.TCPOptions);
-+ pfw_ddb_entry->IPOptions =
-+ cpu_to_le16(pdev_entry->DeviceInfo.IPOptions);
-+ pfw_ddb_entry->maxPDUSize =
-+ cpu_to_le16(pdev_entry->DeviceInfo.MaxPDUSize);
-+ pfw_ddb_entry->firstBurstSize =
-+ cpu_to_le16(pdev_entry->DeviceInfo.FirstBurstSize);
-+ pfw_ddb_entry->minTime2Wait =
-+ cpu_to_le16(pdev_entry->DeviceInfo.LogoutMinTime);
-+ pfw_ddb_entry->maxTime2Retain =
-+ cpu_to_le16(pdev_entry->DeviceInfo.LogoutMaxTime);
-+ pfw_ddb_entry->maxOutstndngR2T =
-+ cpu_to_le16(pdev_entry->DeviceInfo.MaxOutstandingR2T);
-+ pfw_ddb_entry->keepAliveTimeout =
-+ cpu_to_le16(pdev_entry->DeviceInfo.KeepAliveTimeout);
-+ pfw_ddb_entry->portNumber =
-+ cpu_to_le16(pdev_entry->DeviceInfo.PortNumber);
-+ pfw_ddb_entry->maxBurstSize =
-+ cpu_to_le16(pdev_entry->DeviceInfo.MaxBurstSize);
-+ pfw_ddb_entry->taskMngmntTimeout =
-+ cpu_to_le16(pdev_entry->DeviceInfo.TaskMgmtTimeout);
-+ memcpy(pfw_ddb_entry->targetAddr, pdev_entry->DeviceInfo.TargetAddr,
-+ sizeof(pdev_entry->DeviceInfo.TargetAddr));
-+
-+ memcpy(pfw_ddb_entry->ipAddr, pdev_entry->EntryInfo.IPAddr.IPAddress,
-+ sizeof(pdev_entry->EntryInfo.IPAddr.IPAddress));
-+ memcpy(pfw_ddb_entry->iscsiName, pdev_entry->EntryInfo.iSCSIName,
-+ sizeof(pdev_entry->EntryInfo.iSCSIName));
-+ memcpy(pfw_ddb_entry->iSCSIAlias, pdev_entry->EntryInfo.Alias,
-+ sizeof(pdev_entry->EntryInfo.Alias));
-+
-+ /*
-+ * Make the IOCTL call
-+ */
-+ if (qla4xxx_set_ddb_entry(ha, ioctl->Instance, pfw_ddb_entry,
-+ ha->ioctl_dma_bufp) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: SET DDB Entry failed\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto exit_set_dev_entry;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_set_dev_entry:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_set_init_fw_iscsi
-+ * This routine configures a device with specific data entry data.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_set_init_fw_iscsi(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ EXT_INIT_FW_ISCSI *pinit_fw;
-+ INIT_FW_CTRL_BLK *pinit_fw_cb;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pinit_fw,
-+ sizeof(EXT_INIT_FW_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_INIT_FW_ISCSI)));
-+ goto exit_set_init_fw;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp ||
-+ (ha->ioctl_dma_buf_len < sizeof(INIT_FW_CTRL_BLK)) ||
-+ (ioctl->RequestLen < sizeof(EXT_INIT_FW_ISCSI))) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: requst buffer too small\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ goto exit_set_init_fw;
-+ }
-+
-+ /*
-+ * Copy the data from the user's buffer
-+ */
-+ if ((status = copy_from_user((uint8_t *)pinit_fw,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(EXT_INIT_FW_ISCSI))) !=
-+ 0) {
-+ QL4PRINT(QLP2,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_set_init_fw;
-+ }
-+
-+ /*
-+ * First get Initialize Firmware Control Block, so as not to
-+ * destroy unaffected data
-+ */
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_set_init_fw;
-+ }
-+
-+ /*
-+ * Transfer Data from Local buffer to DMA buffer
-+ */
-+ pinit_fw_cb = (INIT_FW_CTRL_BLK *)ha->ioctl_dma_bufv;
-+
-+ pinit_fw_cb->Version = pinit_fw->Version;
-+ pinit_fw_cb->FwOptions = cpu_to_le16(pinit_fw->FWOptions);
-+ pinit_fw_cb->AddFwOptions = cpu_to_le16(pinit_fw->AddFWOptions);
-+ //FIXME: pinit_fw_cb->WakeupThreshold = cpu_to_le16(pinit_fw->WakeupThreshold);
-+ memcpy(pinit_fw_cb->IPAddr, pinit_fw->IPAddr.IPAddress,
-+ MIN(sizeof(pinit_fw_cb->IPAddr),
-+ sizeof(pinit_fw->IPAddr.IPAddress)));
-+ memcpy(pinit_fw_cb->SubnetMask, pinit_fw->SubnetMask.IPAddress,
-+ MIN(sizeof(pinit_fw_cb->SubnetMask),
-+ sizeof(pinit_fw->SubnetMask.IPAddress)));
-+ memcpy(pinit_fw_cb->GatewayIPAddr, pinit_fw->Gateway.IPAddress,
-+ MIN(sizeof(pinit_fw_cb->GatewayIPAddr),
-+ sizeof(pinit_fw->Gateway.IPAddress)));
-+ memcpy(pinit_fw_cb->PriDNSIPAddr, pinit_fw->DNSConfig.IPAddr.IPAddress,
-+ MIN(sizeof(pinit_fw_cb->PriDNSIPAddr),
-+ sizeof(pinit_fw->DNSConfig.IPAddr.IPAddress)));
-+ memcpy(pinit_fw_cb->Alias, pinit_fw->Alias,
-+ MIN(sizeof(pinit_fw_cb->Alias), sizeof(pinit_fw->Alias)));
-+ memcpy(pinit_fw_cb->iSCSINameString, pinit_fw->iSCSIName,
-+ MIN(sizeof(pinit_fw_cb->iSCSINameString),
-+ sizeof(pinit_fw->iSCSIName)));
-+
-+ pinit_fw_cb->ExecThrottle =
-+ cpu_to_le16(pinit_fw->DeviceInfo.ExeThrottle);
-+ pinit_fw_cb->InitMarkerlessInt =
-+ cpu_to_le16(pinit_fw->DeviceInfo.InitMarkerlessInt);
-+ pinit_fw_cb->RetryCount = pinit_fw->DeviceInfo.RetryCount;
-+ pinit_fw_cb->RetryDelay = pinit_fw->DeviceInfo.RetryDelay;
-+ pinit_fw_cb->iSCSIOptions =
-+ cpu_to_le16(pinit_fw->DeviceInfo.iSCSIOptions);
-+ pinit_fw_cb->TCPOptions = cpu_to_le16(pinit_fw->DeviceInfo.TCPOptions);
-+ pinit_fw_cb->IPOptions = cpu_to_le16(pinit_fw->DeviceInfo.IPOptions);
-+ pinit_fw_cb->MaxPDUSize = cpu_to_le16(pinit_fw->DeviceInfo.MaxPDUSize);
-+ pinit_fw_cb->FirstBurstSize =
-+ cpu_to_le16(pinit_fw->DeviceInfo.FirstBurstSize);
-+ pinit_fw_cb->DefaultTime2Wait =
-+ cpu_to_le16(pinit_fw->DeviceInfo.LogoutMinTime);
-+ pinit_fw_cb->DefaultTime2Retain =
-+ cpu_to_le16(pinit_fw->DeviceInfo.LogoutMaxTime);
-+ pinit_fw_cb->MaxOutStndngR2T =
-+ cpu_to_le16(pinit_fw->DeviceInfo.MaxOutstandingR2T);
-+ pinit_fw_cb->KeepAliveTimeout =
-+ cpu_to_le16(pinit_fw->DeviceInfo.KeepAliveTimeout);
-+ pinit_fw_cb->PortNumber = cpu_to_le16(pinit_fw->DeviceInfo.PortNumber);
-+ pinit_fw_cb->MaxBurstSize =
-+ cpu_to_le16(pinit_fw->DeviceInfo.MaxBurstSize);
-+ //pinit_fw_cb->? = pinit_fw->DeviceInfo.TaskMgmtTimeout;
-+ memcpy(pinit_fw_cb->TargAddr, pinit_fw->DeviceInfo.TargetAddr,
-+ EXT_DEF_ISCSI_TADDR_SIZE);
-+
-+ /*
-+ * Send mailbox command
-+ */
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
-+ mbox_cmd[2] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = MSDW(ha->ioctl_dma_bufp);
-+
-+ if ((status = qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0],
-+ &mbox_sts[0])) == QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ goto exit_set_init_fw;
-+ }
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: EXT_INIT_FW_ISCSI structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP4|QLP10, pinit_fw, sizeof(EXT_INIT_FW_ISCSI));
-+
-+exit_set_init_fw:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_set_isns_server
-+ * This routine retrieves the targets discovered via iSNS.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_set_isns_server(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ uint32_t mbox_cmd[MBOX_REG_COUNT];
-+ uint32_t mbox_sts[MBOX_REG_COUNT];
-+ EXT_ISNS_SERVER *pisns_server;
-+ FLASH_INIT_FW_CTRL_BLK *pflash_init_fw_cb = NULL;
-+ uint16_t tcp_options;
-+ uint16_t port_number;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pisns_server,
-+ sizeof(EXT_ISNS_SERVER))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_ISNS_SERVER)));
-+ goto exit_set_isns_svr;
-+ }
-+
-+ if (ioctl->RequestLen < sizeof(*pisns_server)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: requst buffer too small (%d/%xh)\n",
-+ ha->host_no, __func__, ioctl->RequestLen,
-+ ioctl->RequestLen));
-+
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+
-+ if (!ha->ioctl_dma_bufv || !ha->ioctl_dma_bufp ||
-+ (ha->ioctl_dma_buf_len < sizeof(FLASH_INIT_FW_CTRL_BLK))) {
-+ if (qla4xxx_resize_ioctl_dma_buf(ha,
-+ sizeof(DEV_DB_ENTRY)) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to allocate memory "
-+ "for dma buffer.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+ }
-+
-+ /*
-+ * Copy iSNS Server info from the user's buffer
-+ *---------------------------------------------*/
-+ if ((status = copy_from_user((uint8_t *)pisns_server,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr), sizeof(EXT_ISNS_SERVER))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy data to user's "
-+ "memory area\n", ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: EXT_ISNS_SERVER structure:\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP4|QLP10, pisns_server, sizeof(EXT_ISNS_SERVER));
-+
-+ /*
-+ * First get Flash Initialize Firmware Control Block, so as not to
-+ * destroy unaffected data
-+ *----------------------------------------------------------------*/
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_READ_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = INT_ISCSI_INITFW_FLASH_OFFSET;
-+ mbox_cmd[4] = sizeof(FLASH_INIT_FW_CTRL_BLK);
-+
-+ if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) ==
-+ QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: READ_FLASH command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: READ_FLASH command successful \n",
-+ ha->host_no, __func__));
-+
-+ /*
-+ * Copy iSNS Server info to the flash_init_fw_cb
-+ *----------------------------------------------*/
-+ pflash_init_fw_cb = (FLASH_INIT_FW_CTRL_BLK *)ha->ioctl_dma_bufv;
-+
-+ // convert a couple of variables used for comparisons
-+ tcp_options = le16_to_cpu(pflash_init_fw_cb->init_fw_cb.TCPOptions);
-+ port_number = le16_to_cpu(pflash_init_fw_cb->init_fw_cb.iSNSServerPortNumber);
-+
-+ if (pisns_server->PerformiSNSDiscovery) {
-+ if (pisns_server->AutomaticiSNSDiscovery) {
-+ tcp_options |= TOPT_LEARN_ISNS_IP_ADDR_ENABLE;
-+ memset(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr, 0,
-+ sizeof(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr));
-+ } else {
-+ tcp_options &= ~TOPT_LEARN_ISNS_IP_ADDR_ENABLE;
-+ memcpy(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr,
-+ pisns_server->IPAddr.IPAddress,
-+ MIN(sizeof(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr),
-+ sizeof(pisns_server->IPAddr.IPAddress)));
-+ }
-+
-+ port_number = EXT_DEF_ISNS_WELL_KNOWN_PORT;
-+ tcp_options |= TOPT_ISNS_ENABLE;
-+
-+ } else {
-+ tcp_options &= ~TOPT_ISNS_ENABLE;
-+ memset(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr, 0,
-+ sizeof(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr));
-+ port_number = 0;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: IPAddr %d.%d.%d.%d Port# %04d\n",
-+ ha->host_no, __func__,
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr[0],
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr[1],
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr[2],
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr[3],
-+ port_number));
-+
-+ /*
-+ * If the internal iSNS info is different from the flash_init_fw_cb,
-+ * flash it now.
-+ *------------------------------------------------------------------*/
-+ if (((ha->tcp_options & TOPT_LEARN_ISNS_IP_ADDR_ENABLE) !=
-+ (tcp_options & TOPT_LEARN_ISNS_IP_ADDR_ENABLE)) ||
-+ (!IPAddrIsEqual(ha->isns_ip_address,
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr)) ||
-+ (ha->isns_server_port_number != port_number)) {
-+
-+ pflash_init_fw_cb->init_fw_cb.TCPOptions = cpu_to_le16(tcp_options);
-+ pflash_init_fw_cb->init_fw_cb.iSNSServerPortNumber = cpu_to_le16(port_number);
-+
-+ memset(&mbox_cmd, 0, sizeof(mbox_cmd));
-+ memset(&mbox_sts, 0, sizeof(mbox_sts));
-+ mbox_cmd[0] = MBOX_CMD_WRITE_FLASH;
-+ mbox_cmd[1] = LSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[2] = MSDW(ha->ioctl_dma_bufp);
-+ mbox_cmd[3] = INT_ISCSI_INITFW_FLASH_OFFSET;
-+ mbox_cmd[4] = sizeof(*pflash_init_fw_cb);
-+ mbox_cmd[5] = WRITE_FLASH_OPTION_COMMIT_DATA;
-+
-+ if (qla4xxx_mailbox_command(ha, 6, 2, &mbox_cmd[0],
-+ &mbox_sts[0]) == QLA_ERROR) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: WRITE_FLASH command failed \n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = mbox_sts[0];
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: WRITE_FLASH command successful \n",
-+ ha->host_no, __func__));
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: Init Fw Ctrl Blk\n", ha->host_no));
-+ qla4xxx_dump_bytes(QLP4, pflash_init_fw_cb,
-+ sizeof(FLASH_INIT_FW_CTRL_BLK));
-+
-+ /*
-+ * Update internal iSNS info
-+ */
-+ if (pisns_server->AutomaticiSNSDiscovery)
-+ ha->tcp_options |= TOPT_LEARN_ISNS_IP_ADDR_ENABLE;
-+ else
-+ ha->tcp_options &= ~TOPT_LEARN_ISNS_IP_ADDR_ENABLE;
-+
-+ memcpy(ha->isns_ip_address,
-+ pflash_init_fw_cb->init_fw_cb.iSNSIPAddr,
-+ MIN(sizeof(ha->isns_ip_address),
-+ sizeof(pflash_init_fw_cb->init_fw_cb.iSNSIPAddr)));
-+
-+ ha->isns_server_port_number = port_number;
-+ }
-+
-+ /*
-+ * Start or Stop iSNS Service accordingly, if needed.
-+ *---------------------------------------------------*/
-+ //FIXME:
-+ if (test_bit(ISNS_FLAG_ISNS_ENABLED_IN_ISP, &ha->isns_flags)) {
-+ if (!IPAddrIsZero(ha->isns_ip_address) &&
-+ ha->isns_server_port_number &&
-+ (ha->tcp_options & TOPT_LEARN_ISNS_IP_ADDR_ENABLE) == 0) {
-+ uint32_t ip_addr;
-+ IPAddr2Uint32(ha->isns_ip_address, &ip_addr);
-+
-+ status = qla4xxx_isns_reenable(ha, ip_addr,
-+ ha->isns_server_port_number);
-+
-+ if (status == QLA_ERROR) {
-+ QL4PRINT(QLP4, printk(
-+ "scsi%d: qla4xxx_isns_reenable failed!\n",
-+ ha->host_no));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ ioctl->DetailStatus = 0;
-+ ioctl->ResponseLen = 0;
-+ goto exit_set_isns_svr;
-+ }
-+ } else if (test_bit(ISNS_FLAG_ISNS_SRV_ENABLED,
-+ &ha->isns_flags) && IPAddrIsZero(ha->isns_ip_address)) {
-+ qla4xxx_isns_disable(ha);
-+ }
-+ }
-+
-+ /*
-+ * Complete IOCTL successfully
-+ *----------------------------*/
-+ ioctl->Status = EXT_STATUS_OK;
-+ ioctl->DetailStatus = 0;
-+ ioctl->ResponseLen = 0;
-+
-+exit_set_isns_svr:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_set_data
-+ * This routine calls set data IOCTLs based on the IOCTL Sub Code.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ * -EINVAL = if the command is invalid
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int qla4extioctl_set_data(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ switch (ioctl->SubCode) {
-+ case EXT_SC_RST_STATISTICS_GEN:
-+ return(qla4extioctl_rst_statistics_gen(ha, ioctl));
-+
-+ case EXT_SC_RST_STATISTICS_ISCSI:
-+ return(qla4extioctl_rst_statistics_iscsi(ha, ioctl));
-+
-+ case EXT_SC_SET_DEVICE_ENTRY_ISCSI:
-+ return(qla4extioctl_set_device_entry_iscsi(ha, ioctl));
-+
-+ case EXT_SC_SET_INIT_FW_ISCSI:
-+ return(qla4extioctl_set_init_fw_iscsi(ha, ioctl));
-+
-+ case EXT_SC_SET_ISNS_SERVER:
-+ return(qla4extioctl_set_isns_server(ha, ioctl));
-+
-+ default:
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unsupported set data sub-command "
-+ "code (%X)\n",
-+ ha->host_no, __func__, ioctl->SubCode));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ return(0);
-+ }
-+ return(0);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_ioctl_sleep_done
-+ * This routine is the callback function to wakeup ioctl completion
-+ * semaphore for the ioctl request that is waiting.
-+ *
-+ * Input:
-+ * sem - pointer to the ioctl completion semaphore.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static void
-+qla4xxx_ioctl_sleep_done (struct semaphore * sem)
-+{
-+ ENTER(__func__);
-+
-+ if (sem != NULL) {
-+ QL4PRINT(QLP4, printk("%s: wake up sem.\n", __func__));
-+ QL4PRINT(QLP10, printk("%s: UP count=%d\n", __func__,
-+ atomic_read(&sem->count)));
-+ up(sem);
-+ }
-+
-+ LEAVE(__func__);
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_ioctl_sem_init
-+ * This routine initializes the ioctl timer and semaphore used to wait
-+ * for passthru completion.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+void
-+qla4xxx_ioctl_sem_init (scsi_qla_host_t *ha)
-+{
-+ init_timer(&(ha->ioctl->ioctl_cmpl_timer));
-+ ha->ioctl->ioctl_cmpl_timer.data = (ulong)&ha->ioctl->ioctl_cmpl_sem;
-+ ha->ioctl->ioctl_cmpl_timer.function =
-+ (void (*)(ulong))qla4xxx_ioctl_sleep_done;
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_scsi_pass_done
-+ * This routine resets the ioctl progress flag and wakes up the ioctl
-+ * completion semaphore.
-+ *
-+ * Input:
-+ * cmd - pointer to the passthru Scsi cmd structure which has completed.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Interrupt context.
-+ **************************************************************************/
-+void
-+qla4xxx_scsi_pass_done(struct scsi_cmnd *cmd)
-+{
-+ scsi_qla_host_t *ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+
-+ ENTER(__func__);
-+
-+ /* First check to see if the command has previously timed-out
-+ * because we don't want to get the up/down semaphore counters off.
-+ */
-+ if (ha->ioctl->ioctl_scsi_pass_in_progress == 1) {
-+ ha->ioctl->ioctl_scsi_pass_in_progress = 0;
-+ ha->ioctl->ioctl_tov = 0;
-+ ha->ioctl->ioctl_err_cmd = NULL;
-+
-+ up(&ha->ioctl->ioctl_cmpl_sem);
-+ }
-+
-+ LEAVE(__func__);
-+
-+ return;
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_scsi_passthru
-+ * This routine
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Map of DMA Buffer:
-+ * +-------------------------+
-+ * | EXT_SCSI_PASSTHRU_ISCSI |
-+ * +-------------------------+
-+ * | [SCSI READ|WRITE data] |
-+ * +-------------------------+
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_scsi_passthru(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ ddb_entry_t *ddb_entry;
-+ int i;
-+ EXT_SCSI_PASSTHRU_ISCSI *pscsi_pass;
-+ struct scsi_device *pscsi_device;
-+ struct scsi_cmnd *pscsi_cmd;
-+ struct request *request = NULL;
-+ srb_t *srb;
-+ uint32_t dma_buf_len;
-+ os_tgt_t *tgt_entry;
-+ os_lun_t *lun_entry;
-+ fc_port_t *fcport;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (!ADAPTER_UP(ha)) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: command not pocessed, "
-+ "adapter link down.\n",
-+ ha->host_no, __func__));
-+ ioctl->Status = EXT_STATUS_HBA_NOT_READY;
-+ return(QLA_ERROR);
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pscsi_cmd,
-+ sizeof(struct scsi_cmnd))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_cmnd)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pscsi_device,
-+ sizeof(struct scsi_device))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_device)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&request,
-+ sizeof(struct request))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct request)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&pscsi_pass,
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_SCSI_PASSTHRU_ISCSI)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ memset(pscsi_device, 0, sizeof(struct scsi_device));
-+ memset(pscsi_pass, 0, sizeof(EXT_SCSI_PASSTHRU_ISCSI));
-+ memset(pscsi_cmd, 0, sizeof(struct scsi_cmnd));
-+ pscsi_cmd->device = pscsi_device;
-+ pscsi_cmd->request = request;
-+ pscsi_cmd->request->nr_hw_segments = 1;
-+
-+ /* ---- Get passthru structure from user space ---- */
-+ if ((status = copy_from_user((uint8_t *)pscsi_pass,
-+ Q64BIT_TO_PTR(ioctl->RequestAdr),
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy passthru struct "
-+ "from user's memory area.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: %s: incoming EXT_SCSI_PASSTHRU_ISCSI structure:\n",
-+ ha->host_no, __func__));
-+ qla4xxx_dump_bytes(QLP4|QLP10,
-+ pscsi_pass, sizeof(EXT_SCSI_PASSTHRU_ISCSI));
-+
-+ /* ---- Make sure device exists ---- */
-+ tgt_entry = qla4xxx_lookup_target_by_SCSIID(ha,
-+ pscsi_pass->Addr.Bus,
-+ pscsi_pass->Addr.Target);
-+ if (tgt_entry == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to find target queue for "
-+ "tgt %d.\n",
-+ ha->host_no, __func__, pscsi_pass->Addr.Target));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ lun_entry = qla4xxx_lookup_lun_handle(ha, tgt_entry,
-+ pscsi_pass->Addr.Lun);
-+ if (lun_entry == NULL) {
-+ fc_lun_t *fclun;
-+
-+ /* ---- Create temporary lun --- */
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&lun_entry,
-+ sizeof(*lun_entry))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(*lun_entry)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ if (qla4xxx_get_ioctl_scrap_mem(ha, (void **)&fclun,
-+ sizeof(*fclun))) {
-+ /* not enough memory */
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s(%d): inst=%d scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(*fclun)));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ fcport = tgt_entry->fcport;
-+
-+ fclun->lun = pscsi_pass->Addr.Lun;
-+ fclun->fcport = fcport;
-+ fclun->device_type = TYPE_DISK;
-+
-+ lun_entry->fclun = fclun;
-+ lun_entry->fclun->fcport = fcport;
-+ lun_entry->lun_state = LS_LUN_READY;
-+ spin_lock_init(&lun_entry->lun_lock);
-+
-+ goto scsipt_lun_created;
-+ }
-+
-+ if (lun_entry->fclun == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to find fclun of lun queue "
-+ "for lun %d.\n",
-+ ha->host_no, __func__, pscsi_pass->Addr.Lun));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ fcport = lun_entry->fclun->fcport;
-+ if (fcport == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to find fcport of lun queue "
-+ "for lun %d.\n",
-+ ha->host_no, __func__, pscsi_pass->Addr.Lun));
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+scsipt_lun_created:
-+ ddb_entry = fcport->ddbptr;
-+ if (ddb_entry == NULL) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: invalid device (b%d,t%d) specified.\n",
-+ ha->host_no, __func__,
-+ pscsi_pass->Addr.Bus, pscsi_pass->Addr.Target));
-+
-+ ioctl->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ /* ---- Make sure device is in an active state ---- */
-+ if (ddb_entry->fw_ddb_device_state != DDB_DS_SESSION_ACTIVE) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: device (b%d,t%d) not in active state\n",
-+ ha->host_no, __func__,
-+ pscsi_pass->Addr.Bus, pscsi_pass->Addr.Target));
-+
-+ ioctl->Status = EXT_STATUS_DEVICE_NOT_READY;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ /* ---- Retrieve srb from pool ---- */
-+ srb = del_from_free_srb_q_head(ha);
-+ if (srb == NULL) {
-+ QL4PRINT(QLP2|QLP4, printk("scsi%d: %s: srb not available\n",
-+ ha->host_no, __func__));
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ /* ---- Allocate larger DMA buffer, if neccessary ---- */
-+ dma_buf_len = MAX(ioctl->ResponseLen - sizeof(EXT_SCSI_PASSTHRU_ISCSI),
-+ ioctl->RequestLen - sizeof(EXT_SCSI_PASSTHRU_ISCSI));
-+
-+ if (ha->ioctl_dma_buf_len < dma_buf_len &&
-+ qla4xxx_resize_ioctl_dma_buf(ha, dma_buf_len) != QLA_SUCCESS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: ERROR cannot allocate requested "
-+ "DMA buffer size 0x%x.\n",
-+ ha->host_no, __func__, dma_buf_len));
-+
-+ ioctl->Status = EXT_STATUS_NO_MEMORY;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ memset(ha->ioctl_dma_bufv, 0, ha->ioctl_dma_buf_len);
-+
-+ /* ---- Fill in the SCSI command structure ---- */
-+ pscsi_cmd->device->channel = pscsi_pass->Addr.Bus;
-+ pscsi_cmd->device->id = pscsi_pass->Addr.Target;
-+ pscsi_cmd->device->lun = pscsi_pass->Addr.Lun;
-+ pscsi_cmd->device = pscsi_device;
-+ pscsi_cmd->device->host = ha->host;
-+ pscsi_cmd->request_buffer = ha->ioctl_dma_bufv;
-+ pscsi_cmd->scsi_done = qla4xxx_scsi_pass_done;
-+ pscsi_cmd->timeout_per_command = IOCTL_PASSTHRU_TOV * HZ;
-+
-+ CMD_SP(pscsi_cmd) = (char *) srb;
-+ srb->cmd = pscsi_cmd;
-+ srb->fw_ddb_index = ddb_entry->fw_ddb_index;
-+ srb->lun = pscsi_cmd->device->lun;
-+ srb->flags |= SRB_IOCTL_CMD;
-+ srb->fo_retry_cnt = 0;
-+ srb->tgt_queue = tgt_entry;
-+ srb->lun_queue = lun_entry;
-+ srb->fclun = lun_entry->fclun;
-+ srb->ha = fcport->ha;
-+
-+ if (pscsi_pass->CdbLength == 6 || pscsi_pass->CdbLength == 10 ||
-+ pscsi_pass->CdbLength == 12 || pscsi_pass->CdbLength == 16) {
-+ pscsi_cmd->cmd_len = pscsi_pass->CdbLength;
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: Unsupported CDB length 0x%x \n",
-+ ha->host_no, __func__, pscsi_cmd->cmd_len));
-+
-+ ioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ if (pscsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-+ pscsi_cmd->sc_data_direction = DMA_FROM_DEVICE;
-+ pscsi_cmd->request_bufflen = ioctl->ResponseLen -
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI);
-+
-+ } else if (pscsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_OUT) {
-+ pscsi_cmd->sc_data_direction = DMA_TO_DEVICE;
-+ pscsi_cmd->request_bufflen = ioctl->RequestLen -
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI);
-+
-+ /* Sending user data from ioctl->ResponseAddr to SCSI
-+ * command buffer
-+ */
-+ if ((status = copy_from_user((uint8_t *)pscsi_cmd->
-+ request_buffer, Q64BIT_TO_PTR(ioctl->RequestAdr) +
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI),
-+ pscsi_cmd->request_bufflen)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy write buffer "
-+ "from user's memory area.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+ } else {
-+ pscsi_cmd->sc_data_direction = DMA_NONE;
-+ pscsi_cmd->request_buffer = 0;
-+ pscsi_cmd->request_bufflen = 0;
-+ }
-+
-+ memcpy(pscsi_cmd->cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
-+ memcpy(pscsi_cmd->data_cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d:%d:%d:%d: %s: CDB = ",
-+ ha->host_no, pscsi_cmd->device->channel, pscsi_cmd->device->id,
-+ pscsi_cmd->device->lun, __func__));
-+
-+ for (i = 0; i < pscsi_cmd->cmd_len; i++)
-+ QL4PRINT(QLP4, printk("%02X ", pscsi_cmd->cmnd[i]));
-+
-+ QL4PRINT(QLP4, printk("\n"));
-+
-+ /* ---- prepare for receiving completion ---- */
-+ ha->ioctl->ioctl_scsi_pass_in_progress = 1;
-+ ha->ioctl->ioctl_tov = pscsi_cmd->timeout_per_command;
-+
-+ qla4xxx_ioctl_sem_init(ha);
-+ CMD_COMPL_STATUS(pscsi_cmd) = IOCTL_INVALID_STATUS;
-+ CMD_PASSTHRU_TYPE(pscsi_cmd) = (void *)1;
-+
-+ /* ---- send command to adapter ---- */
-+ QL4PRINT(QLP4, printk("scsi%d:%d:%d:%d: %s: sending command.\n",
-+ ha->host_no, pscsi_cmd->device->channel, pscsi_cmd->device->id,
-+ pscsi_cmd->device->lun, __func__));
-+
-+ ha->ioctl->ioctl_cmpl_timer.expires = jiffies + ha->ioctl->ioctl_tov;
-+ add_timer(&ha->ioctl->ioctl_cmpl_timer);
-+
-+ if (qla4xxx_send_command_to_isp(ha, srb) != QLA_SUCCESS) {
-+ add_to_free_srb_q(ha, srb);
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: error sending cmd to isp\n",
-+ ha->host_no, __func__));
-+ del_timer(&ha->ioctl->ioctl_cmpl_timer);
-+ ioctl->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ down(&ha->ioctl->ioctl_cmpl_sem);
-+
-+ /*******************************************************
-+ * *
-+ * Passthru Completion *
-+ * *
-+ *******************************************************/
-+ del_timer(&ha->ioctl->ioctl_cmpl_timer);
-+
-+ /* ---- check for timeout --- */
-+ if (ha->ioctl->ioctl_scsi_pass_in_progress == 1) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: ERROR = command timeout.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+
-+ if ((srb != NULL) && (srb->active_array_index < MAX_SRBS)) {
-+ u_long wait_cnt = WAIT_CMD_TOV;
-+
-+ if ((srb->flags & SRB_FREE_STATE) == 0)
-+ qla4xxx_delete_timer_from_cmd(srb);
-+
-+ /* Wait for command to get out of active state */
-+ wait_cnt = jiffies + WAIT_CMD_TOV * HZ;
-+ while (wait_cnt > jiffies){
-+ if (srb->flags != SRB_ACTIVE_STATE)
-+ break;
-+
-+ QL4PRINT(QLP7, printk("."));
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1 * HZ);
-+ }
-+
-+ /* Command timed-out, but it's still active.
-+ * When it comes back, just discard it. */
-+ srb->cmd = NULL;
-+ }
-+
-+ ha->ioctl->ioctl_scsi_pass_in_progress = 0;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ /* --- Return info from status entry --- */
-+ ioctl->DetailStatus = CMD_SCSI_STATUS(pscsi_cmd);
-+ pscsi_pass->Reserved[0] = (uint8_t) CMD_SCSI_STATUS(pscsi_cmd);
-+ pscsi_pass->Reserved[1] = (uint8_t) CMD_COMPL_STATUS(pscsi_cmd);
-+ pscsi_pass->Reserved[2] = (uint8_t) CMD_ACTUAL_SNSLEN(pscsi_cmd);
-+ pscsi_pass->Reserved[3] = (uint8_t) CMD_HOST_STATUS(pscsi_cmd);
-+ pscsi_pass->Reserved[6] = (uint8_t) CMD_ISCSI_RESPONSE(pscsi_cmd);
-+ pscsi_pass->Reserved[7] = (uint8_t) CMD_STATE_FLAGS(pscsi_cmd);
-+
-+ if (CMD_ACTUAL_SNSLEN(pscsi_cmd)) {
-+ memcpy(pscsi_pass->SenseData, pscsi_cmd->sense_buffer,
-+ MIN(CMD_ACTUAL_SNSLEN(pscsi_cmd),
-+ sizeof(pscsi_pass->SenseData)));
-+
-+ QL4PRINT(QLP2|QLP4|QLP10,
-+ printk("scsi%d: %s: sense data dump:\n",
-+ ha->host_no, __func__));
-+ qla4xxx_dump_bytes(QLP2|QLP4|QLP10,
-+ pscsi_pass->SenseData, sizeof(pscsi_pass->SenseData));
-+ }
-+
-+ /* ---- check for command completion --- */
-+ if (CMD_COMPL_STATUS(pscsi_cmd) == IOCTL_INVALID_STATUS) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d:%d:%d:%d: %s: ERROR = "
-+ "command not completed.\n",
-+ ha->host_no, pscsi_cmd->device->channel,
-+ pscsi_cmd->device->id,
-+ pscsi_cmd->device->lun, __func__));
-+
-+ ioctl->Status = EXT_STATUS_ERR;
-+ goto error_exit_scsi_pass;
-+
-+ } else if (CMD_HOST_STATUS(pscsi_cmd) == DID_OK) {
-+
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ } else if (CMD_COMPL_STATUS(pscsi_cmd) == SCS_DATA_UNDERRUN) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: Data underrun. Resid = 0x%x\n",
-+ ha->host_no, __func__, CMD_RESID_LEN(pscsi_cmd)));
-+
-+ ioctl->Status = EXT_STATUS_DATA_UNDERRUN;
-+ pscsi_pass->Reserved[4] = MSB(CMD_RESID_LEN(pscsi_cmd));
-+ pscsi_pass->Reserved[5] = LSB(CMD_RESID_LEN(pscsi_cmd));
-+
-+ } else if (CMD_COMPL_STATUS(pscsi_cmd) == SCS_DATA_OVERRUN) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: Data overrun. Resid = 0x%x\n",
-+ ha->host_no, __func__, CMD_RESID_LEN(pscsi_cmd)));
-+
-+ ioctl->Status = EXT_STATUS_DATA_OVERRUN;
-+ pscsi_pass->Reserved[4] = MSB(CMD_RESID_LEN(pscsi_cmd));
-+ pscsi_pass->Reserved[5] = LSB(CMD_RESID_LEN(pscsi_cmd));
-+
-+ } else {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: Command completed in ERROR. "
-+ "cs=%04x, ss=%-4x\n", ha->host_no, __func__,
-+ CMD_COMPL_STATUS(pscsi_cmd), CMD_SCSI_STATUS(pscsi_cmd)));
-+
-+ if (CMD_SCSI_STATUS(pscsi_cmd) != SCSI_GOOD) {
-+ ioctl->Status = EXT_STATUS_SCSI_STATUS;
-+ } else {
-+ ioctl->Status = EXT_STATUS_ERR;
-+ }
-+ }
-+
-+ /* ---- Copy SCSI Passthru structure with updated sense buffer
-+ * to user space ----
-+ */
-+ if (copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), pscsi_pass,
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy passthru struct "
-+ "to user's memory area.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: %s: outgoing EXT_SCSI_PASSTHRU_ISCSI structure:\n",
-+ ha->host_no, __func__));
-+ qla4xxx_dump_bytes(QLP4|QLP10,
-+ Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI));
-+
-+ /* ---- Copy SCSI READ data from SCSI command buffer
-+ * to user space ---- */
-+ if (pscsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-+ void *xfer_ptr = Q64BIT_TO_PTR(ioctl->ResponseAdr) +
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI);
-+ uint32_t xfer_len = ioctl->ResponseLen -
-+ sizeof(EXT_SCSI_PASSTHRU_ISCSI);
-+
-+
-+ /* Update ResponseLen if a data underrun occurred */
-+ if (CMD_COMPL_STATUS(pscsi_cmd) == SCS_DATA_UNDERRUN &&
-+ CMD_RESID_LEN(pscsi_cmd)) {
-+ xfer_len -= CMD_RESID_LEN(pscsi_cmd);
-+ }
-+
-+ if ((status = copy_to_user(xfer_ptr, pscsi_cmd->request_buffer,
-+ xfer_len)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unable to copy READ data "
-+ "to user's memory area.\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto error_exit_scsi_pass;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10,
-+ printk("scsi%d: %s: outgoing READ data: (0x%p)\n",
-+ ha->host_no, __func__, xfer_ptr));
-+
-+ qla4xxx_dump_bytes(QLP4|QLP10, xfer_ptr, xfer_len);
-+ }
-+
-+ goto exit_scsi_pass;
-+
-+error_exit_scsi_pass:
-+ ioctl->ResponseLen = 0;
-+
-+exit_scsi_pass:
-+ qla4xxx_free_ioctl_scrap_mem(ha);
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_iscsi_passthru
-+ * This routine sends iSCSI pass-through to destination.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_iscsi_passthru(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ ioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ QL4PRINT(QLP4, printk("scsi%d: %s: UNSUPPORTED\n",
-+ ha->host_no, __func__));
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/**************************************************************************
-+ * qla4extioctl_get_hbacnt
-+ * This routine retrieves the number of supported HBAs found.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * ioctl = IOCTL structure pointer.
-+ *
-+ * Output:
-+ * None
-+ *
-+ * Returns:
-+ * QLA_SUCCESS = success
-+ * QLA_ERROR = error
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+static int
-+qla4extioctl_get_hbacnt(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ EXT_HBA_COUNT hba_cnt;
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ hba_cnt.HbaCnt = qla4xxx_get_hba_count();
-+ if ((status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr),
-+ &hba_cnt, sizeof(hba_cnt))) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: failed to copy data\n",
-+ ha->host_no, __func__));
-+
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+ goto exit_get_hbacnt;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: hbacnt is %d\n",
-+ ha->host_no, __func__, hba_cnt.HbaCnt));
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+exit_get_hbacnt:
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+STATIC int
-+qla4extioctl_get_hostno(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d entered.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ ioctl->HbaSelect = ha->host_no;
-+ ioctl->Status = EXT_STATUS_OK;
-+
-+ QL4PRINT(QLP4, printk("scsi%d: %s: instance is %d\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+STATIC int
-+qla4extioctl_driver_specific(scsi_qla_host_t *ha, EXT_IOCTL_ISCSI *ioctl)
-+{
-+ int status = 0;
-+ EXT_LN_DRIVER_DATA data;
-+
-+
-+ ENTER(__func__);
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+
-+ if (ioctl->ResponseLen < sizeof(EXT_LN_DRIVER_DATA)) {
-+ ioctl->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: ERROR ResponseLen too small.\n",
-+ __func__));
-+
-+ goto exit_driver_specific;
-+ }
-+
-+ data.DrvVer.Major = QL4_DRIVER_MAJOR_VER;
-+ data.DrvVer.Minor = QL4_DRIVER_MINOR_VER;
-+ data.DrvVer.Patch = QL4_DRIVER_PATCH_VER;
-+ data.DrvVer.Beta = QL4_DRIVER_BETA_VER;
-+ /* RLU: set this flag when code is added.
-+ data.Flags = EXT_DEF_NGFO_CAPABLE;
-+ */
-+ if (IS_QLA4010(ha))
-+ data.AdapterModel = EXT_DEF_QLA4010_DRIVER;
-+ else if (IS_QLA4022(ha))
-+ data.AdapterModel = EXT_DEF_QLA4022_DRIVER;
-+
-+ status = copy_to_user(Q64BIT_TO_PTR(ioctl->ResponseAdr), &data,
-+ sizeof(EXT_LN_DRIVER_DATA));
-+
-+ if (status) {
-+ ioctl->Status = EXT_STATUS_COPY_ERR;
-+
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: ERROR copy resp buf\n", __func__));
-+ }
-+
-+exit_driver_specific:
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi%d: %s: inst %d exiting.\n",
-+ ha->host_no, __func__, ha->instance));
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+ioctl_tbl_row_t IOCTL_CMD_TBL[] =
-+{
-+ {EXT_CC_QUERY, "EXT_CC_QUERY"},
-+ {EXT_CC_REG_AEN, "EXT_CC_REG_AEN"},
-+ {EXT_CC_GET_AEN, "EXT_CC_GET_AEN"},
-+ {EXT_CC_GET_DATA, "EXT_CC_GET_DATA"},
-+ {EXT_CC_SET_DATA, "EXT_CC_SET_DATA"},
-+ {EXT_CC_SEND_SCSI_PASSTHRU, "EXT_CC_SEND_SCSI_PASSTHRU"},
-+ {EXT_CC_SEND_ISCSI_PASSTHRU, "EXT_CC_SEND_ISCSI_PASSTHRU"},
-+ {INT_CC_LOGOUT_ISCSI, "INT_CC_LOGOUT_ISCSI"},
-+ {EXT_CC_GET_HBACNT, "EXT_CC_GET_HBACNT"},
-+ {INT_CC_DIAG_PING, "INT_CC_DIAG_PING"},
-+ {INT_CC_GET_DATA, "INT_CC_GET_DATA"},
-+ {INT_CC_SET_DATA, "INT_CC_SET_DATA"},
-+ {INT_CC_HBA_RESET, "INT_CC_HBA_RESET"},
-+ {INT_CC_COPY_FW_FLASH, "INT_CC_COPY_FW_FLASH"},
-+ {INT_CC_IOCB_PASSTHRU, "INT_CC_IOCB_PASSTHRU"},
-+ {0, "UNKNOWN"}
-+};
-+
-+ioctl_tbl_row_t IOCTL_SCMD_QUERY_TBL[] =
-+{
-+ {EXT_SC_QUERY_HBA_ISCSI_NODE, "EXT_SC_QUERY_HBA_ISCSI_NODE"},
-+ {EXT_SC_QUERY_HBA_ISCSI_PORTAL, "EXT_SC_QUERY_HBA_ISCSI_PORTAL"},
-+ {EXT_SC_QUERY_DISC_ISCSI_NODE, "EXT_SC_QUERY_DISC_ISCSI_NODE"},
-+ {EXT_SC_QUERY_DISC_ISCSI_PORTAL, "EXT_SC_QUERY_DISC_ISCSI_PORTAL"},
-+ {EXT_SC_QUERY_DRIVER, "EXT_SC_QUERY_DRIVER"},
-+ {EXT_SC_QUERY_FW, "EXT_SC_QUERY_FW"},
-+ {EXT_SC_QUERY_CHIP, "EXT_SC_QUERY_CHIP"},
-+ {0, "UNKNOWN"}
-+};
-+
-+ioctl_tbl_row_t IOCTL_SCMD_EGET_DATA_TBL[] =
-+{
-+ {EXT_SC_GET_STATISTICS_ISCSI, "EXT_SC_GET_STATISTICS_ISCSI"},
-+ {EXT_SC_GET_DEVICE_ENTRY_ISCSI, "EXT_SC_GET_DEVICE_ENTRY_ISCSI"},
-+ {EXT_SC_GET_DEVICE_ENTRY_DEFAULTS_ISCSI, "EXT_SC_GET_DEVICE_ENTRY_DEFAULTS_ISCSI"},
-+ {EXT_SC_GET_INIT_FW_ISCSI, "EXT_SC_GET_INIT_FW_ISCSI"},
-+ {EXT_SC_GET_INIT_FW_DEFAULTS_ISCSI, "EXT_SC_GET_INIT_FW_DEFAULTS_ISCSI"},
-+ {EXT_SC_GET_ISNS_SERVER, "EXT_SC_GET_ISNS_SERVER"},
-+ {EXT_SC_GET_ISNS_DISCOVERED_TARGETS, "EXT_SC_GET_ISNS_DISCOVERED_TARGETS"},
-+ {0, "UNKNOWN"}
-+};
-+
-+ioctl_tbl_row_t IOCTL_SCMD_ESET_DATA_TBL[] =
-+{
-+ {EXT_SC_RST_STATISTICS_GEN, "EXT_SC_RST_STATISTICS_GEN"},
-+ {EXT_SC_RST_STATISTICS_ISCSI, "EXT_SC_RST_STATISTICS_ISCSI"},
-+ {EXT_SC_SET_DEVICE_ENTRY_ISCSI, "EXT_SC_SET_DEVICE_ENTRY_ISCSI"},
-+ {EXT_SC_SET_INIT_FW_ISCSI, "EXT_SC_SET_INIT_FW_ISCSI"},
-+ {EXT_SC_SET_ISNS_SERVER, "EXT_SC_SET_ISNS_SERVER"},
-+ {0, "UNKNOWN"}
-+};
-+
-+char *IOCTL_TBL_STR(int cc, int sc)
-+{
-+ ioctl_tbl_row_t *r;
-+ int cmd;
-+
-+ switch (cc) {
-+ case EXT_CC_QUERY:
-+ r = IOCTL_SCMD_QUERY_TBL;
-+ cmd = sc;
-+ break;
-+ case EXT_CC_GET_DATA:
-+ r = IOCTL_SCMD_EGET_DATA_TBL;
-+ cmd = sc;
-+ break;
-+ case EXT_CC_SET_DATA:
-+ r = IOCTL_SCMD_ESET_DATA_TBL;
-+ cmd = sc;
-+ break;
-+ case INT_CC_GET_DATA:
-+ r = IOCTL_SCMD_IGET_DATA_TBL;
-+ cmd = sc;
-+ break;
-+ case INT_CC_SET_DATA:
-+ r = IOCTL_SCMD_ISET_DATA_TBL;
-+ cmd = sc;
-+ break;
-+
-+ default:
-+ r = IOCTL_CMD_TBL;
-+ cmd = cc;
-+ break;
-+ }
-+
-+ while (r->cmd != 0) {
-+ if (r->cmd == cmd) break;
-+ r++;
-+ }
-+ return(r->s);
-+
-+}
-+
-+/**************************************************************************
-+ * qla4xxx_ioctl
-+ * This the main entry point for all ioctl requests
-+ *
-+ * Input:
-+ * dev - pointer to SCSI device structure
-+ * cmd - internal or external ioctl command code
-+ * arg - pointer to the main ioctl structure
-+ *
-+ * Instance field in ioctl structure - to determine which device to
-+ * perform ioctl
-+ * HbaSelect field in ioctl structure - to determine which adapter to
-+ * perform ioctl
-+ *
-+ * Output:
-+ * The resulting data/status is returned via the main ioctl structure.
-+ *
-+ * When Status field in ioctl structure is valid for normal command errors
-+ * this function returns 0 (QLA_SUCCESS).
-+ *
-+ * All other return values indicate ioctl/system specific error which
-+ * prevented the actual ioctl command from completing.
-+ *
-+ * Returns:
-+ * QLA_SUCCESS - command completed successfully, either with or without
-+ * errors in the Status field of the main ioctl structure
-+ * -EFAULT - arg pointer is NULL or memory access error
-+ * -EINVAL - command is invalid
-+ * -ENOMEM - memory allocation failed
-+ *
-+ * Context:
-+ * Kernel context.
-+ **************************************************************************/
-+int
-+qla4xxx_ioctl(struct scsi_device *dev, int cmd, void *arg)
-+{
-+ EXT_IOCTL_ISCSI *pioctl = NULL;
-+ scsi_qla_host_t *ha = NULL;
-+ int status = 0; /* ioctl status; errno value when function returns */
-+ int tmp_stat;
-+
-+ ENTER(__func__);
-+
-+ /* Catch any non-exioct ioctls */
-+ if (_IOC_TYPE(cmd) != QLMULTIPATH_MAGIC) {
-+ printk(KERN_WARNING
-+ "qla4xxx: invalid ioctl magic number received.\n");
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi(): %s: invalid magic number received.\n",
-+ __func__));
-+
-+ status = (-EINVAL);
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ QL4PRINT(QLP4,
-+ printk("scsi(): %s: received cmd %x.\n",
-+ __func__, cmd));
-+
-+ switch (cmd) {
-+ /* All NFO functions go here */
-+ case EXT_CC_TRANSPORT_INFO:
-+ case EXT_CC_GET_FOM_PROP:
-+ case EXT_CC_GET_HBA_INFO:
-+ case EXT_CC_GET_DPG_PROP:
-+ case EXT_CC_GET_DPG_PATH_INFO:
-+ case EXT_CC_SET_DPG_PATH_INFO:
-+ case EXT_CC_GET_LB_INFO:
-+ case EXT_CC_GET_LB_POLICY:
-+ case EXT_CC_SET_LB_POLICY:
-+ case EXT_CC_GET_DPG_STATS:
-+ case EXT_CC_CLEAR_DPG_ERR_STATS:
-+ case EXT_CC_CLEAR_DPG_IO_STATS:
-+ case EXT_CC_CLEAR_DPG_FO_STATS:
-+ case EXT_CC_GET_PATHS_FOR_ALL:
-+ case EXT_CC_MOVE_PATH:
-+ case EXT_CC_VERIFY_PATH:
-+ case EXT_CC_GET_EVENT_LIST:
-+ case EXT_CC_ENABLE_FOM:
-+ case EXT_CC_DISABLE_FOM:
-+ case EXT_CC_GET_STORAGE_LIST:
-+ status = qla4xxx_nfo_ioctl(dev, cmd, arg);
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ /* Allocate ioctl structure buffer to support multiple concurrent
-+ * entries. NO static structures allowed.
-+ */
-+ pioctl = QL_KMEM_ZALLOC(sizeof(EXT_IOCTL_ISCSI));
-+ if (pioctl == NULL) {
-+ /* error */
-+ printk(KERN_WARNING
-+ "qla4xxx: ERROR in main ioctl buffer allocation.\n");
-+ status = (-ENOMEM);
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ /*
-+ * Check to see if we can access the ioctl command structure
-+ */
-+ if (!access_ok(VERIFY_WRITE, arg, sizeof(EXT_IOCTL_ISCSI))) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: EXT_IOCTL_ISCSI access error.\n",
-+ __func__));
-+
-+ status = (-EFAULT);
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ /*
-+ * Copy the ioctl command structure from user space to local structure
-+ */
-+ if ((status = copy_from_user((uint8_t *)pioctl, arg,
-+ sizeof(EXT_IOCTL_ISCSI)))) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: EXT_IOCTL_ISCSI copy error.\n",
-+ __func__));
-+
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ QL4PRINT(QLP4|QLP10, printk("EXT_IOCTL_ISCSI structure dump: \n"));
-+ qla4xxx_dump_dwords(QLP4|QLP10, pioctl, sizeof(*pioctl));
-+
-+ /* check signature of this ioctl */
-+ if (memcmp(pioctl->Signature, EXT_DEF_REGULAR_SIGNATURE,
-+ sizeof(EXT_DEF_REGULAR_SIGNATURE)) != 0) {
-+ QL4PRINT(QLP2|QLP4,
-+ printk("%s: signature did not match. "
-+ "received cmd=%x arg=%p signature=%s.\n",
-+ __func__, cmd, arg, pioctl->Signature));
-+ pioctl->Status = EXT_STATUS_INVALID_PARAM;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_ISCSI));
-+
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ /* check version of this ioctl */
-+ if (pioctl->Version > EXT_VERSION) {
-+ printk(KERN_WARNING
-+ "ql4xxx: ioctl interface version not supported = %d.\n",
-+ pioctl->Version);
-+
-+ pioctl->Status = EXT_STATUS_UNSUPPORTED_VERSION;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_ISCSI));
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ /*
-+ * Get the adapter handle for the corresponding adapter instance
-+ */
-+ ha = qla4xxx_get_adapter_handle(pioctl->HbaSelect);
-+ if (ha == NULL) {
-+ QL4PRINT(QLP2,
-+ printk("%s: NULL EXT_IOCTL_ISCSI buffer\n",
-+ __func__));
-+
-+ pioctl->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ status = copy_to_user(arg, (void *)pioctl,
-+ sizeof(EXT_IOCTL_ISCSI));
-+ goto exit_qla4xxx_ioctl;
-+ }
-+
-+ QL4PRINT(QLP4, printk("scsi%d: ioctl+ (%s)\n", ha->host_no,
-+ IOCTL_TBL_STR(cmd, pioctl->SubCode)));
-+
-+ down(&ha->ioctl->ioctl_sem);
-+
-+ /*
-+ * If the DPC is active, wait for it to complete before proceeding
-+ */
-+ while (ha->dpc_active) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1*HZ);
-+ }
-+
-+ ha->i_start = jiffies;
-+ ha->i_end = 0;
-+ ha->f_start = 0;
-+ ha->f_end = 0;
-+
-+ /*
-+ * Issue the ioctl command
-+ */
-+ switch (cmd) {
-+ case EXT_CC_QUERY:
-+ status = qla4extioctl_query(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_REG_AEN:
-+ status = qla4extioctl_reg_aen(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_GET_AEN:
-+ status = qla4extioctl_get_aen(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_GET_DATA:
-+ status = qla4extioctl_get_data(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_SET_DATA:
-+ status = qla4extioctl_set_data(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_SEND_SCSI_PASSTHRU:
-+ status = qla4extioctl_scsi_passthru(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_SEND_ISCSI_PASSTHRU:
-+ status = qla4extioctl_iscsi_passthru(ha, pioctl);
-+ break;
-+
-+ case INT_CC_LOGOUT_ISCSI:
-+ status = qla4intioctl_logout_iscsi(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_GET_HBACNT:
-+ status = qla4extioctl_get_hbacnt(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_GET_HOST_NO:
-+ status = qla4extioctl_get_hostno(ha, pioctl);
-+ break;
-+
-+ case EXT_CC_DRIVER_SPECIFIC:
-+ status = qla4extioctl_driver_specific(ha, pioctl);
-+ break;
-+
-+ case INT_CC_DIAG_PING:
-+ status = qla4intioctl_ping(ha, pioctl);
-+ break;
-+
-+ case INT_CC_GET_DATA:
-+ status = qla4intioctl_get_data(ha, pioctl);
-+ break;
-+
-+ case INT_CC_SET_DATA:
-+ status = qla4intioctl_set_data(ha, pioctl);
-+ break;
-+
-+ case INT_CC_HBA_RESET:
-+ status = qla4intioctl_hba_reset(ha, pioctl);
-+ break;
-+
-+ case INT_CC_COPY_FW_FLASH:
-+ status = qla4intioctl_copy_fw_flash(ha, pioctl);
-+ break;
-+
-+ case INT_CC_IOCB_PASSTHRU:
-+ status = qla4intioctl_iocb_passthru(ha, pioctl);
-+ break;
-+
-+ default:
-+ QL4PRINT(QLP2|QLP4,
-+ printk("scsi%d: %s: unsupported command code (%x)\n",
-+ ha->host_no, __func__, cmd));
-+
-+ pioctl->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ }
-+
-+ /*
-+ * Copy the updated ioctl structure back to the user
-+ */
-+ tmp_stat = copy_to_user(arg, (void *)pioctl, sizeof(EXT_IOCTL_ISCSI));
-+ if (status == 0) {
-+ status = tmp_stat;
-+ }
-+
-+ ha->i_end = jiffies;
-+
-+ up(&ha->ioctl->ioctl_sem);
-+
-+ QL4PRINT(QLP15, printk("scsi%d: ioctl- (%s) "
-+ "i_start=%lx, f_start=%lx, f_end=%lx, i_end=%lx\n",
-+ ha->host_no, IOCTL_TBL_STR(cmd, pioctl->SubCode),
-+ ha->i_start, ha->f_start, ha->f_end, ha->i_end));
-+
-+exit_qla4xxx_ioctl:
-+
-+ if (pioctl)
-+ QL_KMEM_FREE(pioctl);
-+
-+ LEAVE(__func__);
-+
-+ return(status);
-+}
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlfo.h ./drivers/scsi/qla4xxx/qlfo.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlfo.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlfo.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,145 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2003-2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * San/Device Management Failover Ioctl Header
-+ * File is created to adhere to Solaris requirement using 8-space tabs.
-+ *
-+ * !!!!! PLEASE DO NOT REMOVE THE TABS !!!!!
-+ * !!!!! PLEASE NO SINGLE LINE COMMENTS: // !!!!!
-+ * !!!!! PLEASE NO MORE THAN 80 CHARS PER LINE !!!!!
-+ *
-+ * Revision History:
-+ *
-+ * Rev. 0.00 August 8, 2000
-+ * WTR - Created.
-+ *
-+ * Rev. 0.01 August 8, 2000
-+ * WTR - Made size of HbaInstance fields consistant as UINT8.
-+ * Made command codes as 300 upward to be consistant with definitions
-+ * in ExIoct.h.
-+ * Rev. 0.01 October 3, 2000
-+ * TLE - Exclusion of ExIoct.h
-+ *
-+ * Rev. 0.01 October 6, 2000
-+ * TLE - Made size of HbaInstance fields UINT8
-+ *
-+ * Rev. 0.01 October 10, 2000
-+ * TLE - Add _FO_DRIVER_VERSION data structure
-+ */
-+
-+
-+
-+#ifndef _FO_H
-+#define _FO_H
-+
-+/*
-+ * ***********************************************************************
-+ * X OS type definitions
-+ * ***********************************************************************
-+ */
-+#ifdef _MSC_VER /* NT */
-+
-+#pragma pack(1)
-+#include "qlfont.h"
-+
-+#elif defined(linux) /* Linux */
-+
-+#include "qlfoln.h"
-+
-+#elif defined(sun) || defined(__sun) /* Solaris */
-+
-+#include "qlfoso.h"
-+
-+#endif
-+
-+#define SDM_DEF_MAX_DEVICES 16
-+#define SDM_DEF_MAX_PATHS_PER_TARGET 4
-+#define SDM_DEF_MAX_TARGETS_PER_DEVICE 4
-+#define SDM_DEF_MAX_PATHS_PER_DEVICE (SDM_DEF_MAX_PATHS_PER_TARGET * SDM_DEF_MAX_TARGETS_PER_DEVICE)
-+
-+#define FO_MAX_LUNS_PER_DEVICE MAX_LUNS_OS
-+#define FO_MAX_PATHS (SDM_DEF_MAX_PATHS_PER_DEVICE * SDM_DEF_MAX_DEVICES)
-+#define FO_MAX_ADAPTERS 32
-+#define FO_ADAPTER_ALL 0xFF
-+#define FO_DEF_WWN_SIZE 8
-+#define FO_MAX_GEN_INFO_STRING_LEN 32
-+
-+#if 0 /* defined in qlfolimits.h */
-+#define FO_NOTIFY_TYPE_NONE 0
-+#define FO_NOTIFY_TYPE_LUN_RESET 1
-+#define FO_NOTIFY_TYPE_CDB 2
-+#define FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET 3
-+#define FO_NOTIFY_TYPE_LOGOUT_OR_CDB 4
-+#define FO_NOTIFY_TYPE_SPINUP 5
-+
-+#define FO_NOTIFY_TYPE_MIN FO_NOTIFY_TYPE_NONE
-+#define FO_NOTIFY_TYPE_MAX FO_NOTIFY_TYPE_LOGOUT_OR_CDB
-+#define FO_NOTIFY_TYPE_DEF FO_NOTIFY_TYPE_SPINUP
-+
-+#define FO_NOTIFY_CDB_LENGTH_MIN 6
-+#define FO_NOTIFY_CDB_LENGTH_MAX 16
-+#endif
-+
-+/*
-+ * IOCTL Commands
-+ */
-+
-+/* Systemwide failover parameters. */
-+
-+typedef struct _FO_PARAMS
-+{
-+ UINT32 InspectionInterval; /* Timer interval to check for failover.*/
-+ UINT8 MaxPathsPerDevice; /* Max paths to any single device. */
-+ UINT8 MaxRetriesPerPath; /* Max retries on a path before */
-+
-+ /* Failover. */
-+ UINT8 MaxRetriesPerIo; /* Max retries per i/o request. */
-+ UINT8 Reserved1;
-+ UINT32 Flags; /* Control flags. */
-+ UINT8 DeviceErrorThreshold; /* Max device errors. */
-+ UINT8 DeviceTimeoutThreshold; /* Max device timeouts.*/
-+ UINT8 FrameErrorThreshold; /* Max frame errors.*/
-+ UINT8 LinkErrorThreshold; /* Max link errors.*/
-+ UINT32 Reserved2[4]; /* Spares.*/
-+
-+ /* Load balancing parameters.*/
-+
-+ UINT8 RollingAverageIntervals;/* Intervals to sum for rolling average.*/
-+ UINT8 MaxDevicesToMigrate; /* Max devices to migrate in any interval.*/
-+ UINT8 BalanceMethod; /* Method to use for load balancing.*/
-+ UINT8 Reserved3; /* Memory alignment.*/
-+
-+ UINT16 LoadShareMinPercentage; /* Load balancing parameter.*/
-+ UINT16 LoadShareMaxPercentage; /* Load balancing parameter.*/
-+
-+ /* Failover notify parameters. */
-+
-+ UINT8 FailoverNotifyType; /* Type of notification. */
-+ UINT8 FailoverNotifyCdbLength;/* Length of notification CDB. */
-+ UINT16 Reserved4;
-+ UINT8 FailoverNotifyCdb[16]; /* CDB if notification by CDB. */
-+ UINT32 Reserved5;
-+
-+}
-+FO_PARAMS, *PFO_PARAMS, SysFoParams_t, *SysFoParams_p;
-+
-+extern SysFoParams_t qla_fo_params;
-+
-+#endif /* ifndef _FO_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlfolimits.h ./drivers/scsi/qla4xxx/qlfolimits.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlfolimits.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlfolimits.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,93 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * Minimums, maximums, defaults, and other definitions for MC_PARAMS.
-+ */
-+
-+#define FO_INSPECTION_INTERVAL_MIN 0
-+#define FO_INSPECTION_INTERVAL_MAX 1000000
-+#define FO_INSPECTION_INTERVAL_DEF 600
-+
-+#define FO_MAX_PATHS_PER_DEVICE_MIN 1
-+#define FO_MAX_PATHS_PER_DEVICE_MAX 8
-+#define FO_MAX_PATHS_PER_DEVICE_DEF 8
-+
-+#define FO_MAX_RETRIES_PER_PATH_MIN 1
-+#define FO_MAX_RETRIES_PER_PATH_MAX 8
-+#define FO_MAX_RETRIES_PER_PATH_DEF 3
-+
-+#define FO_MAX_RETRIES_PER_IO_MIN ((FO_MAX_PATHS_PER_DEVICE_MIN * FO_MAX_RETRIES_PER_PATH_MIN) + 1)
-+#define FO_MAX_RETRIES_PER_IO_MAX ((FO_MAX_PATHS_PER_DEVICE_MAX * FO_MAX_RETRIES_PER_PATH_MAX) + 1)
-+#define FO_MAX_RETRIES_PER_IO_DEF ((FO_MAX_PATHS_PER_DEVICE_DEF * FO_MAX_RETRIES_PER_PATH_DEF) + 1)
-+
-+#define FO_DEVICE_ERROR_THRESHOLD_MIN 1
-+#define FO_DEVICE_ERROR_THRESHOLD_MAX 255
-+#define FO_DEVICE_ERROR_THRESHOLD_DEF 4
-+
-+#define FO_DEVICE_TIMEOUT_THRESHOLD_MIN 1
-+#define FO_DEVICE_TIMEOUT_THRESHOLD_MAX 255
-+#define FO_DEVICE_TIMEOUT_THRESHOLD_DEF 4
-+
-+#define FO_FRAME_ERROR_THRESHOLD_MIN 1
-+#define FO_FRAME_ERROR_THRESHOLD_MAX 255
-+#define FO_FRAME_ERROR_THRESHOLD_DEF 4
-+
-+#define FO_LINK_ERROR_THRESHOLD_MIN 1
-+#define FO_LINK_ERROR_THRESHOLD_MAX 255
-+#define FO_LINK_ERROR_THRESHOLD_DEF 4
-+
-+#define FO_ROLLING_AVERAGE_INTERVALS_MIN 1
-+#define FO_ROLLING_AVERAGE_INTERVALS_MAX 10
-+#define FO_ROLLING_AVERAGE_INTERVALS_DEF 1
-+
-+#define FO_MAX_DEVICES_TO_MIGRATE_MIN 0
-+#define FO_MAX_DEVICES_TO_MIGRATE_MAX 255
-+#define FO_MAX_DEVICES_TO_MIGRATE_DEF 4
-+
-+#define FO_BALANCE_METHOD_NONE 0
-+#define FO_BALANCE_METHOD_IOS 1
-+#define FO_BALANCE_METHOD_MBS 2
-+
-+#define FO_BALANCE_METHOD_MIN FO_BALANCE_METHOD_NONE
-+#define FO_BALANCE_METHOD_MAX FO_BALANCE_METHOD_MBS
-+#define FO_BALANCE_METHOD_DEF FO_BALANCE_METHOD_IOS
-+
-+#define FO_LOAD_SHARE_MIN_PERCENTAGE_MIN 25
-+#define FO_LOAD_SHARE_MIN_PERCENTAGE_MAX 99
-+#define FO_LOAD_SHARE_MIN_PERCENTAGE_DEF 75
-+
-+#define FO_LOAD_SHARE_MAX_PERCENTAGE_MIN 101
-+#define FO_LOAD_SHARE_MAX_PERCENTAGE_MAX 500
-+#define FO_LOAD_SHARE_MAX_PERCENTAGE_DEF 150
-+
-+#define FO_NOTIFY_TYPE_NONE 0
-+#define FO_NOTIFY_TYPE_LUN_RESET 1
-+#define FO_NOTIFY_TYPE_CDB 2
-+#define FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET 3
-+#define FO_NOTIFY_TYPE_LOGOUT_OR_CDB 4
-+#define FO_NOTIFY_TYPE_SPINUP 5
-+
-+#define FO_NOTIFY_TYPE_MIN FO_NOTIFY_TYPE_NONE
-+#define FO_NOTIFY_TYPE_MAX FO_NOTIFY_TYPE_LOGOUT_OR_CDB
-+#define FO_NOTIFY_TYPE_DEF FO_NOTIFY_TYPE_NONE
-+
-+#define FO_NOTIFY_CDB_LENGTH_MIN 6
-+#define FO_NOTIFY_CDB_LENGTH_MAX 16
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlfoln.h ./drivers/scsi/qla4xxx/qlfoln.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlfoln.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlfoln.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,79 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+
-+
-+/*************************************************************
-+ * Failover ioctl command codes range from 0xc0 to 0xdf.
-+ * The foioctl command code end index must be updated whenever
-+ * adding new commands.
-+ *************************************************************/
-+#define FO_CC_START_IDX 0xc8 /* foioctl cmd start index */
-+
-+#define FO_CC_GET_PARAMS_OS \
-+ QL_IOCTL_CMD(0xc8)
-+#define FO_CC_SET_PARAMS_OS \
-+ QL_IOCTL_CMD(0xc9)
-+#define FO_CC_GET_PATHS_OS \
-+ QL_IOCTL_CMD(0xca)
-+#define FO_CC_SET_CURRENT_PATH_OS \
-+ QL_IOCTL_CMD(0xcb)
-+#define FO_CC_GET_HBA_STAT_OS \
-+ QL_IOCTL_CMD(0xcc)
-+#define FO_CC_RESET_HBA_STAT_OS \
-+ QL_IOCTL_CMD(0xcd)
-+#define FO_CC_GET_LUN_DATA_OS \
-+ QL_IOCTL_CMD(0xce)
-+#define FO_CC_SET_LUN_DATA_OS \
-+ QL_IOCTL_CMD(0xcf)
-+#define FO_CC_GET_TARGET_DATA_OS \
-+ QL_IOCTL_CMD(0xd0)
-+#define FO_CC_SET_TARGET_DATA_OS \
-+ QL_IOCTL_CMD(0xd1)
-+#define FO_CC_GET_FO_DRIVER_VERSION_OS \
-+ QL_IOCTL_CMD(0xd2)
-+
-+#define FO_CC_END_IDX 0xd2 /* foioctl cmd end index */
-+
-+
-+#define BOOLEAN uint8_t
-+#define MAX_LUNS_OS 256
-+
-+/* Driver attributes bits */
-+#define DRVR_FO_ENABLED 0x1 /* bit 0 */
-+
-+
-+/*
-+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
-+ * Emacs will notice this stuff at the end of the file and automatically
-+ * adjust the settings for this buffer only. This must remain at the end
-+ * of the file.
-+ * ---------------------------------------------------------------------------
-+ * Local variables:
-+ * c-indent-level: 2
-+ * c-brace-imaginary-offset: 0
-+ * c-brace-offset: -2
-+ * c-argdecl-indent: 2
-+ * c-label-offset: -2
-+ * c-continued-statement-offset: 2
-+ * c-continued-brace-offset: 0
-+ * indent-tabs-mode: nil
-+ * tab-width: 8
-+ * End:
-+ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlinioct.h ./drivers/scsi/qla4xxx/qlinioct.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlinioct.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlinioct.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,433 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#ifndef _QLINIOCT_H_
-+#define _QLINIOCT_H_
-+
-+#include "qlisioln.h"
-+
-+/*
-+ Ioctl
-+*/
-+
-+/*
-+ General
-+*/
-+
-+/*
-+ * Command Codes definitions
-+ */
-+#define INT_CC_GET_DATA EXT_CC_RESERVED0A_OS
-+#define INT_CC_SET_DATA EXT_CC_RESERVED0B_OS
-+#define INT_CC_DIAG_PING EXT_CC_RESERVED0C_OS
-+#define INT_CC_ISCSI_LOOPBACK EXT_CC_RESERVED0D_OS
-+#define INT_CC_HBA_RESET EXT_CC_RESERVED0E_OS
-+#define INT_CC_COPY_FW_FLASH EXT_CC_RESERVED0F_OS
-+#define INT_CC_LOGOUT_ISCSI EXT_CC_RESERVED0G_OS
-+#define INT_CC_FW_PASSTHRU EXT_CC_RESERVED0H_OS
-+#define INT_CC_IOCB_PASSTHRU EXT_CC_RESERVED0I_OS
-+
-+/*
-+ * Sub codes for Get Data.
-+ * Use in combination with INT_GET_DATA as the ioctl code
-+ */
-+#define INT_SC_GET_FLASH 1
-+
-+/*
-+ * Sub codes for Set Data.
-+ * Use in combination with INT_SET_DATA as the ioctl code
-+ */
-+#define INT_SC_SET_FLASH 1
-+
-+#define INT_DEF_DNS_ENABLE 0x0100
-+
-+/*
-+ * ***********************************************************************
-+ * INIT_FW_ISCSI_ALL
-+ * ***********************************************************************
-+ */
-+typedef struct _INT_INIT_FW_ISCSI_ALL {
-+ UINT8 Version; /* 1 */
-+ UINT8 Reserved0; /* 1 */
-+ UINT16 FWOptions; /* 2 */
-+ UINT16 exeThrottle; /* 2 */
-+ UINT8 retryCount; /* 1 */
-+ UINT8 retryDelay; /* 1 */
-+ UINT16 EthernetMTU; /* 2 */
-+ UINT16 addFWOptions; /* 2 */
-+ UINT8 HeartBeat; /* 1 */
-+ UINT8 Reserved1; /* 1 */
-+ UINT16 Reserved2; /* 2 */
-+ UINT16 ReqQOutPtr; /* 2 */
-+ UINT16 RespQInPtr; /* 2 */
-+ UINT16 ReqQLen; /* 2 */
-+ UINT16 RespQLen; /* 2 */
-+ UINT32 ReqQAddr[2]; /* 8 */
-+ UINT32 RespQAddr[2]; /* 8 */
-+ UINT32 IntRegBufAddr[2]; /* 8 */
-+ UINT16 iSCSIOptions; /* 2 */
-+ UINT16 TCPOptions; /* 2 */
-+ UINT16 IPOptions; /* 2 */
-+ UINT16 MaxRxDataSegmentLen; /* 2 */
-+ UINT16 recvMarkerInt; /* 2 */
-+ UINT16 sendMarkerInt; /* 2 */
-+ UINT16 Reserved3; /* 2 */
-+ UINT16 firstBurstSize; /* 2 */
-+ UINT16 DefaultTime2Wait; /* 2 */
-+ UINT16 DefaultTime2Retain; /* 2 */
-+ UINT16 maxOutstandingR2T; /* 2 */
-+ UINT16 keepAliveTimeout; /* 2 */
-+ UINT16 portNumber; /* 2 */
-+ UINT16 maxBurstSize; /* 2 */
-+ UINT32 Reserved4; /* 4 */
-+ UINT8 IPAddr[16]; /* 16 */
-+ UINT8 SubnetMask[16]; /* 16 */
-+ UINT8 IPGateway[16]; /* 16 */
-+ UINT8 DNSsvrIP[4]; /* 4 */
-+ UINT8 DNSsecSvrIP[4]; /* 4 */
-+ UINT8 Reserved5[8]; /* 8 */
-+ UINT8 Alias[EXT_DEF_ISCSI_ALIAS_LEN]; /* 32 */
-+ UINT32 targetAddr0; /* 4 */
-+ UINT32 targetAddr1; /* 4 */
-+ UINT32 CHAPTableAddr0; /* 4 */
-+ UINT32 CHAPTableAddr1; /* 4 */
-+ UINT8 EthernetMACAddr[6]; /* 6 */
-+ UINT16 TargetPortalGrp; /* 2 */
-+ UINT8 SendScale; /* 1 */
-+ UINT8 RecvScale; /* 1 */
-+ UINT8 TypeOfService; /* 1 */
-+ UINT8 Time2Live; /* 1 */
-+ UINT16 VLANPriority; /* 2 */
-+ UINT16 Reserved6; /* 2 */
-+ UINT8 SecondaryIPAddr[16]; /* 16 */
-+ UINT8 iSNSServerAdr[4]; /* 4 */
-+ UINT16 iSNSServerPort; /* 2 */
-+ UINT8 Reserved7[10]; /* 10 */
-+ UINT8 SLPDAAddr[16]; /* 16 */
-+ UINT8 iSCSIName[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+} INT_INIT_FW_ISCSI_ALL, *PINT_INIT_FW_ISCSI_ALL; /* 512 */
-+
-+/*
-+ * ***********************************************************************
-+ * INT_DEVICE_ENTRY_ISCSI_ALL
-+ * ***********************************************************************
-+ */
-+typedef struct _INT_DEVICE_ENTRY_ISCSI_ALL {
-+ UINT8 Options; /* 1 */
-+ UINT8 Control; /* 1 */
-+ UINT16 exeThrottle; /* 2 */
-+ UINT16 exeCount; /* 2 */
-+ UINT8 retryCount; /* 1 */
-+ UINT8 retryDelay; /* 1 */
-+ UINT16 iSCSIOptions; /* 2 */
-+ UINT16 TCPOptions; /* 2 */
-+ UINT16 IPOptions; /* 2 */
-+ UINT16 MaxRxDataSegmentLen; /* 2 */
-+ UINT16 RecvMarkerInterval; /* 2 */
-+ UINT16 SendMarkerInterval; /* 2 */
-+ UINT16 MaxTxDataSegmentLen; /* 2 */
-+ UINT16 firstBurstSize; /* 2 */
-+ UINT16 DefaultTime2Wait; /* 2 */
-+ UINT16 DefaultTime2Retain; /* 2 */
-+ UINT16 maxOutstandingR2T; /* 2 */
-+ UINT16 keepAliveTimeout; /* 2 */
-+ UINT8 InitiatorSessID[EXT_DEF_ISCSI_ISID_SIZE]; /* 6 */
-+ UINT16 TargetSessID; /* 2 */
-+ UINT16 portNumber; /* 2 */
-+ UINT16 maxBurstSize; /* 2 */
-+ UINT16 taskMngmntTimeout; /* 2 */
-+ UINT16 Reserved0; /* 2 */
-+ UINT8 IPAddress[16]; /* 16 */
-+ UINT8 Alias[EXT_DEF_ISCSI_ALIAS_LEN]; /* 32 */
-+ UINT8 targetAddr[EXT_DEF_ISCSI_TADDR_SIZE]; /* 32 */
-+ /* need to find new definition XXX */
-+ UINT8 res[64];
-+ UINT8 iSCSIName[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ UINT16 ddbLink; /* 2 */
-+ UINT16 chapTableIndex; /* 2 */
-+ UINT16 targetPortalGrp; /* 2 */
-+ UINT16 Reserved1; /* 2 */
-+ UINT32 statSN; /* 4 */
-+ UINT32 expStatSN; /* 4 */
-+} INT_DEVICE_ENTRY_ISCSI_ALL, *PINT_DEVICE_ENTRY_ISCSI_ALL; /* 464 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_DEVDDB_ENTRY
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _FLASH_DEVDB_ENTRY {
-+ INT_DEVICE_ENTRY_ISCSI_ALL entryData; /* 0-1C7 */
-+ UINT8 RES0[0x2C]; /* 1C8-1FB */
-+ UINT16 ddbValidCookie; /* 1FC-1FD */
-+ UINT16 ddbValidSize; /* 1FE-1FF */
-+} FLASH_DEVDB_ENTRY, *PFLASH_DEVDB_ENTRY;
-+
-+/*
-+ * ****************************************************************************
-+ * INT_FLASH_INITFW
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _FLASH_INITFW {
-+ INT_INIT_FW_ISCSI_ALL initFWData;
-+ UINT32 validCookie;
-+} FLASH_INITFW, *PFLASH_INITFW;
-+
-+
-+/*
-+ * ***********************************************************************
-+ * INT_ACCESS_FLASH
-+ * ***********************************************************************
-+ */
-+
-+#define INT_DEF_AREA_TYPE_FW_IMAGE1 0x01
-+#define INT_DEF_AREA_TYPE_FW_IMAGE2 0x02
-+#define INT_DEF_AREA_TYPE_DRIVER 0x03
-+#define INT_DEF_AREA_TYPE_DDB 0x04
-+#define INT_DEF_AREA_TYPE_INIT_FW 0x05
-+#define INT_DEF_AREA_TYPE_SYS_INFO 0x06
-+
-+#define INT_DEF_FLASH_BLK_SIZE 0x4000
-+#define INT_DEF_FLASH_PHYS_BLK_SIZE 0x20000
-+
-+#define INT_ISCSI_FW_IMAGE2_FLASH_OFFSET 0x01000000
-+#define INT_ISCSI_SYSINFO_FLASH_OFFSET 0x02000000
-+#define INT_ISCSI_DRIVER_FLASH_OFFSET 0x03000000
-+#define INT_ISCSI_INITFW_FLASH_OFFSET 0x04000000
-+#define INT_ISCSI_DDB_FLASH_OFFSET 0x05000000
-+#define INT_ISCSI_CHAP_FLASH_OFFSET 0x06000000
-+#define INT_ISCSI_FW_IMAGE1_FLASH_OFFSET 0x07000000
-+#define INT_ISCSI_BIOS_FLASH_OFFSET 0x0d000000
-+#define INT_ISCSI_OFFSET_MASK 0x00FFFFFF
-+#define INT_ISCSI_PAGE_MASK 0x0F000000
-+
-+#define INT_ISCSI_ACCESS_FLASH 0x00000000
-+#define INT_ISCSI_ACCESS_RAM 0x10000000
-+#define INT_ISCSI_ACCESS_MASK 0xF0000000
-+
-+/* WRITE_FLASH option definitions */
-+#define INT_WRITE_FLASH_OPT_HOLD 0 /* Write data to FLASH but
-+ do not Commit */
-+#define INT_WRITE_FLASH_OPT_CLEAR_REMAINING 1 /* Write data to FLASH but
-+ do not Commit any data
-+ not written before
-+ commit will be cleared
-+ (set to 0xFF) */
-+#define INT_WRITE_FLASH_OPT_COMMIT_DATA 2 /* Commit (Burn) data to
-+ FLASH */
-+
-+
-+typedef struct _INT_ACCESS_FLASH {
-+ UINT32 AreaType; /* 4 */
-+ UINT32 DataLen; /* 4 */
-+ UINT32 DataOffset; /* 4 */
-+ UINT8 FlashData[INT_DEF_FLASH_BLK_SIZE]; /* 0x4000 */
-+ UINT32 Options; /* 4 */
-+} INT_ACCESS_FLASH, *PINT_ACCESS_FLASH; /* 0x4010 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_FLASH_DRIVER_PARAM
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _INT_FLASH_DRIVER_PARAM {
-+ UINT16 DiscoveryTimeOut; /* 2 */
-+ UINT16 PortDownTimeout; /* 2 */
-+ UINT32 Reserved[32]; /* 128 */
-+} INT_FLASH_DRIVER_PARAM, *PINT_FLASH_DRIVER_PARAM; /* 132 */
-+
-+
-+#define VALID_FLASH_INITFW 0x11BEAD5A
-+
-+#define FLASH_ISCSI_MAX_DDBS 64
-+#define FLASH_DDB_VALID_COOKIE 0x9034 /* this value indicates this
-+ entry in flash is valid */
-+#define FLASH_DDB_INVALID_COOKIE 0x0 /* this value is used to set
-+ the entry to invalid */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_HBA_SYS_INFO
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _INT_HBA_SYS_INFO {
-+ UINT32 cookie; /* 4 */
-+ UINT32 physAddrCount; /* 4 */
-+ UINT8 macAddr0[6]; /* 6 */
-+ UINT8 reserved0[2]; /* 2 */
-+ UINT8 macAddr1[6]; /* 6 */
-+ UINT8 reserved1[2]; /* 2 */
-+ UINT8 macAddr2[6]; /* 6 */
-+ UINT8 reserved2[2]; /* 2 */
-+ UINT8 macAddr3[6]; /* 6 */
-+ UINT8 reserved3[2]; /* 2 */
-+ UINT8 vendorId[128]; /* 128 */
-+ UINT8 productId[128]; /* 128 */
-+ UINT32 serialNumber; /* 4 */
-+ UINT32 pciDeviceVendor; /* 4 */
-+ UINT32 pciDeviceId; /* 4 */
-+ UINT32 pciSubsysVendor; /* 4 */
-+ UINT32 pciSubsysId; /* 4 */
-+ UINT32 crumbs; /* 4 */
-+ UINT32 enterpriseNumber; /* 4 */
-+ UINT32 crumbs2; /* 4 */
-+} INT_HBA_SYS_INFO, *PINT_HBA_SYS_INFO; /* 328 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_FW_DW_HDR
-+ * ****************************************************************************
-+ */
-+
-+/* File header for FW */
-+typedef struct _INT_FW_DL_HDR {
-+ UINT32 Size; /* download size, excluding DL_HDR & EXT_HDR*/
-+ UINT32 Checksum; /* Checksum of download file, excluding DL_HDR
-+ & EXT_HDR */
-+ UINT32 HdrChecksum; /* Checksum of header area should be zero */
-+ UINT32 Flags; /* See Flags bits defined above */
-+ UINT32 Cookie; /* Target specific identifier */
-+ UINT32 Target; /* Target specific identifier */
-+ UINT32 Reserved0; /* Reserved */
-+ UINT32 Reserved1; /* Reserved */
-+ UINT8 Copyright[64]; /* Copyright */
-+ UINT8 Version[32]; /* Version String */
-+} INT_FW_DL_HDR, *PINT_FW_DL_HDR;
-+
-+/* File header for BIOS */
-+typedef struct _INT_BIOS_HDR {
-+ UINT8 BIOSidCode55;
-+ UINT8 BIOSidCodeAA;
-+ UINT8 reserved[52];
-+ UINT8 BIOSminorVer;
-+ UINT8 BIOSmajorVer;
-+} INT_BIOS_HDR, *PINT_BIOS_HDR;
-+
-+typedef struct _INT_SDMBIOS_NVRAM {
-+ UINT16 Flags;
-+ UINT8 PriID;
-+ UINT64 PriLUN;
-+ UINT8 SecID;
-+ UINT64 SecLUN;
-+} INT_SDMBIOS_NVRAM, *PINT_SDMBIOS_NVRAM;
-+
-+/*
-+ * ****************************************************************************
-+ * INT_HBA_RESET
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _INT_HBA_RESET {
-+ UINT32 Reserved[2]; /* 8 */
-+} INT_HBA_RESET, *PINT_HBA_RESET; /* 8 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_COPY_FW_FLASH
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _INT_COPY_FW_FLASH {
-+ UINT32 Options; /* 4 */
-+} INT_COPY_FW_FLASH, *PINT_COPY_FW_FLASH; /* 4 */
-+
-+#define INT_COPY_FLASH_PRIMARY_TO_SECONDARY 0
-+#define INT_COPY_FLASH_SECONDARY_TO_PRIMARY 1
-+
-+/*
-+ * ****************************************************************************
-+ * INT_LOGOUT_ISCSI
-+ * ****************************************************************************
-+ */
-+
-+/* Logout Options */
-+
-+#define INT_DEF_CLOSE_SESSION 0x0001
-+#define INT_DEF_RELOGIN_CONNECTION 0x0002
-+#define INT_DEF_DELETE_DDB 0x0004
-+#define INT_DEF_REINDEX_DDB 0x0008
-+
-+typedef struct _INT_LOGOUT_ISCSI {
-+ UINT16 TargetID; /* 2 */
-+ UINT16 ConnectionID; /* 2 */
-+ UINT16 Options; /* 2 */
-+ UINT32 NewTargetID; /* 4 */
-+} INT_LOGOUT_ISCSI, *PINT_LOGOUT_ISCSI; /* 10 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_PING
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _INT_PING {
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT16 PacketCount; /* 2 */
-+ UINT16 Reserved; /* 2 */
-+} INT_PING, *PINT_PING; /* 24 */
-+
-+/*
-+ * ****************************************************************************
-+ * INT_IOCB_PASSTHRU
-+ * ****************************************************************************
-+ */
-+
-+#define INT_DEF_IOCB_BUF_SIZE 64
-+#define INT_DEF_IOCB_DATA_SIZE 1500
-+
-+typedef struct _INT_IOCB_PASSTHRU {
-+ UINT32 SendDMAOffset; /* 4 */
-+ UINT32 RspDMAOffset; /* 4 */
-+ UINT8 IOCBCmdBuffer[INT_DEF_IOCB_BUF_SIZE]; /* 64 */
-+ UINT8 IOCBStatusBuffer[INT_DEF_IOCB_BUF_SIZE]; /* 64 */
-+ UINT32 SendDataLen; /* 4 */
-+ UINT8 SendData[INT_DEF_IOCB_DATA_SIZE]; /* 1500 */
-+ UINT32 RspDataLen; /* 4 */
-+ UINT8 RspData[INT_DEF_IOCB_DATA_SIZE]; /* 1500 */
-+ UINT32 Reserved; /* 4 */
-+} INT_IOCB_PASSTHRU, *PINT_IOCB_PASSTHRU; /* 3148 */
-+
-+
-+/*
-+ * ****************************************************************************
-+ * INT_CC_FW_PASSTHRU
-+ * ****************************************************************************
-+ */
-+
-+/* FW PASSTHRU Defines */
-+#define INT_DEF_FW_PASSHTRU_BLK_SIZE 0x4000
-+
-+#define INT_DEF_DATA_TYPE_CHAP_TABLE 0x0001
-+#define INT_DEF_DATA_TYPE_DDB 0x0002
-+#define INT_DEF_DATA_TYPE_INITFW 0x0003
-+#define INT_DEF_DATA_TYPE_FW_IMAGE 0x0004
-+
-+#define INT_DEF_DATA_LOCATION_HBA_FLASH 0x0001
-+#define INT_DEF_DATA_LOCATION_HBA_RAM 0x0002
-+
-+#define INT_DEF_DATA_READ 0x0001
-+#define INT_DEF_DATA_WRITE 0x0002
-+
-+#define INT_DEF_DATA_INIT 0x0001
-+#define INT_DEF_DATA_COMMIT 0x0002
-+
-+#endif /* _QLINIOCT_H_ */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlisioct.h ./drivers/scsi/qla4xxx/qlisioct.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlisioct.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlisioct.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,732 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+/*
-+ * File Name: qlisioct.h
-+ *
-+ */
-+#ifndef _QLISIOCT_H
-+#define _QLISIOCT_H
-+
-+/*
-+ * NOTE: the following version defines must be updated each time the
-+ * changes made may affect the backward compatibility of the
-+ * input/output relations of the IOCTL functions.
-+ */
-+#define EXT_VERSION 6
-+
-+/*
-+ * OS independent General definitions
-+ */
-+#define EXT_DEF_SIGNATURE_SIZE 8
-+#define EXT_DEF_SERIAL_NUM_SIZE 4
-+#define EXT_DEF_MAX_STR_SIZE 128
-+
-+#define EXT_DEF_ADDR_MODE_32 1
-+#define EXT_DEF_ADDR_MODE_64 2
-+
-+/*
-+ * ****************************************************************************
-+ * OS type definitions
-+ * ****************************************************************************
-+ */
-+#ifdef _MSC_VER /* NT */
-+
-+#include "qlisiont.h"
-+
-+#elif defined(linux) /* Linux */
-+
-+#include "qlisioln.h"
-+
-+#elif defined(sun) || defined(__sun) /* Solaris */
-+
-+#include "qlisioso.h"
-+
-+#endif
-+
-+/*
-+ * ****************************************************************************
-+ * OS dependent General configuration defines
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_MAX_HBA EXT_DEF_MAX_HBA_OS
-+#define EXT_DEF_MAX_BUS EXT_DEF_MAX_BUS_OS
-+#define EXT_DEF_MAX_TARGET EXT_DEF_MAX_TARGET_OS
-+#define EXT_DEF_MAX_LUN EXT_DEF_MAX_LUN_OS
-+
-+/*
-+ * Addressing mode used by the user application
-+ */
-+#define EXT_ADDR_MODE EXT_ADDR_MODE_OS
-+
-+/*
-+ * Command Codes definitions
-+ */
-+#define EXT_CC_QUERY EXT_CC_QUERY_OS
-+#define EXT_CC_REG_AEN EXT_CC_REG_AEN_OS
-+#define EXT_CC_GET_AEN EXT_CC_GET_AEN_OS
-+#define EXT_CC_GET_DATA EXT_CC_GET_DATA_OS
-+#define EXT_CC_SET_DATA EXT_CC_SET_DATA_OS
-+#define EXT_CC_SEND_SCSI_PASSTHRU EXT_CC_SEND_SCSI_PASSTHRU_OS
-+#define EXT_CC_SEND_ISCSI_PASSTHRU EXT_CC_SEND_ISCSI_PASSTHRU_OS
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_IOCTL_ISCSI
-+ * ****************************************************************************
-+ */
-+/*
-+ * Status. These macros are being used for setting Status field in
-+ * EXT_IOCTL_ISCSI structure.
-+ */
-+#define EXT_STATUS_OK 0
-+#define EXT_STATUS_ERR 1
-+#define EXT_STATUS_BUSY 2
-+#define EXT_STATUS_PENDING 3
-+#define EXT_STATUS_SUSPENDED 4
-+#define EXT_STATUS_RETRY_PENDING 5
-+#define EXT_STATUS_INVALID_PARAM 6
-+#define EXT_STATUS_DATA_OVERRUN 7
-+#define EXT_STATUS_DATA_UNDERRUN 8
-+#define EXT_STATUS_DEV_NOT_FOUND 9
-+#define EXT_STATUS_COPY_ERR 10
-+#define EXT_STATUS_MAILBOX 11
-+#define EXT_STATUS_UNSUPPORTED_SUBCODE 12
-+#define EXT_STATUS_UNSUPPORTED_VERSION 13
-+#define EXT_STATUS_MS_NO_RESPONSE 14
-+#define EXT_STATUS_SCSI_STATUS 15
-+#define EXT_STATUS_BUFFER_TOO_SMALL 16
-+#define EXT_STATUS_NO_MEMORY 17
-+#define EXT_STATUS_UNKNOWN 18
-+#define EXT_STATUS_UNKNOWN_DSTATUS 19
-+#define EXT_STATUS_INVALID_REQUEST 20
-+#define EXT_STATUS_DEVICE_NOT_READY 21
-+#define EXT_STATUS_DEVICE_OFFLINE 22
-+#define EXT_STATUS_HBA_NOT_READY 23
-+#define EXT_STATUS_HBA_QUEUE_FULL 24
-+
-+/*
-+ * Detail Status contains the SCSI bus status codes.
-+ */
-+#define EXT_DSTATUS_GOOD 0x00
-+#define EXT_DSTATUS_CHECK_CONDITION 0x02
-+#define EXT_DSTATUS_CONDITION_MET 0x04
-+#define EXT_DSTATUS_BUSY 0x08
-+#define EXT_DSTATUS_INTERMEDIATE 0x10
-+#define EXT_DSTATUS_INTERMEDIATE_COND_MET 0x14
-+#define EXT_DSTATUS_RESERVATION_CONFLICT 0x18
-+#define EXT_DSTATUS_COMMAND_TERMINATED 0x22
-+#define EXT_DSTATUS_QUEUE_FULL 0x28
-+
-+/*
-+ * Detail Status contains one of the following codes
-+ * when Status = EXT_STATUS_INVALID_PARAM or
-+ * = EXT_STATUS_DEV_NOT_FOUND
-+ */
-+#define EXT_DSTATUS_NOADNL_INFO 0x00
-+#define EXT_DSTATUS_HBA_INST 0x01
-+#define EXT_DSTATUS_TARGET 0x02
-+#define EXT_DSTATUS_LUN 0x03
-+#define EXT_DSTATUS_REQUEST_LEN 0x04
-+#define EXT_DSTATUS_PATH_INDEX 0x05
-+
-+/*
-+ * FLASH error status
-+*/
-+#define EXT_FLASH_NO_INFO 0x00
-+#define EXT_FLASH_NO_MEMORY 0x0a
-+#define EXT_FLASH_FW_IMAGE_INVALID 0x0b
-+#define EXT_FLASH_NO_BKUP_FW_IMAGE 0x0c
-+#define EXT_FLASH_ERROR_ACCESSING_FLASH 0x0d
-+
-+/*
-+ * EXT_IOCTL_ISCSI SubCode definition.
-+ * These macros are being used for setting SubCode field in EXT_IOCTL_ISCSI
-+ * structure.
-+ */
-+
-+/*
-+ * Sub codes for Query.
-+ * Uses in combination with EXT_QUERY as the ioctl code.
-+ */
-+#define EXT_SC_QUERY_HBA_ISCSI_NODE 1
-+#define EXT_SC_QUERY_HBA_ISCSI_PORTAL 2
-+#define EXT_SC_QUERY_DISC_ISCSI_NODE 3
-+#define EXT_SC_QUERY_DISC_ISCSI_PORTAL 4
-+#define EXT_SC_QUERY_DISC_LUN 5
-+#define EXT_SC_QUERY_DRIVER 6
-+#define EXT_SC_QUERY_FW 7
-+#define EXT_SC_QUERY_CHIP 8
-+
-+/*
-+ * Sub codes for Get Data.
-+ * Use in combination with EXT_GET_DATA as the ioctl code
-+ */
-+#define EXT_SC_GET_STATISTICS_GEN 1
-+#define EXT_SC_GET_STATISTICS_ISCSI 2
-+#define EXT_SC_GET_DEVICE_ENTRY_ISCSI 3
-+#define EXT_SC_GET_INIT_FW_ISCSI 4
-+#define EXT_SC_GET_INIT_FW_DEFAULTS_ISCSI 5
-+#define EXT_SC_GET_DEVICE_ENTRY_DEFAULTS_ISCSI 6
-+#define EXT_SC_GET_ISNS_SERVER 7
-+#define EXT_SC_GET_ISNS_DISCOVERED_TARGETS 8
-+
-+/*
-+ * Sub codes for Set Data.
-+ * Use in combination with EXT_SET_DATA as the ioctl code
-+ */
-+#define EXT_SC_RST_STATISTICS_GEN 1
-+#define EXT_SC_RST_STATISTICS_ISCSI 2
-+#define EXT_SC_SET_DEVICE_ENTRY_ISCSI 3
-+#define EXT_SC_SET_INIT_FW_ISCSI 4
-+#define EXT_SC_SET_ISNS_SERVER 5
-+
-+/*
-+ * Defines for VendorSpecificStatus
-+ */
-+#define VENDOR_SPECIFIC_STATUS_MB_STATUS_INDEX 0 /* [0-4] mbSts */
-+#define VENDOR_SPECIFIC_STATUS_MB_COMMAND_INDEX 5 /* [5-10] mbCmd */
-+#define VENDOR_SPECIFIC_STATUS_IOSB_COMPLETION_INDEX 0
-+#define VENDOR_SPECIFIC_STATUS_SCSI_STATUS_INDEX 1
-+
-+
-+typedef struct _EXT_IOCTL_ISCSI {
-+ UINT8 Signature[EXT_DEF_SIGNATURE_SIZE]; /* 8 */
-+ UINT16 AddrMode; /* 2 */
-+ UINT16 Version; /* 2 */
-+ UINT16 SubCode; /* 2 */
-+ UINT16 Instance; /* 2 */
-+ UINT32 Status; /* 4 */
-+ UINT32 DetailStatus; /* 4 */
-+ UINT32 Reserved1; /* 4 */
-+ UINT32 RequestLen; /* 4 */
-+ UINT32 ResponseLen; /* 4 */
-+ UINT64 RequestAdr; /* 8 */
-+ UINT64 ResponseAdr; /* 8 */
-+ UINT16 HbaSelect; /* 2 */
-+ UINT32 VendorSpecificStatus[11]; /* 44 */
-+ UINT64 Signature2; /* 8 */
-+} __attribute__((packed)) EXT_IOCTL_ISCSI, *PEXT_IOCTL_ISCSI; /* 106 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISCSI_DEVICE
-+ * ****************************************************************************
-+ */
-+/* Device Type */
-+#define EXT_DEF_ISCSI_REMOTE 0x02
-+#define EXT_DEF_ISCSI_LOCAL 0x01
-+
-+#define EXT_ISCSI_ENABLE_DHCP 0x01
-+
-+#define EXT_DEF_ISCSI_TADDR_SIZE 32
-+
-+typedef struct _EXT_ISCSI_DEVICE {
-+ UINT16 DeviceType; /* 2 */
-+ UINT16 ExeThrottle; /* 2 */
-+ UINT16 InitMarkerlessInt; /* 2 */
-+ UINT8 RetryCount; /* 1 */
-+ UINT8 RetryDelay; /* 1 */
-+ UINT16 iSCSIOptions; /* 2 */
-+ UINT16 TCPOptions; /* 2 */
-+ UINT16 IPOptions; /* 2 */
-+ UINT16 MaxPDUSize; /* 2 */
-+ UINT16 FirstBurstSize; /* 2 */
-+ UINT16 LogoutMinTime; /* 2 */
-+ UINT16 LogoutMaxTime; /* 2 */
-+ UINT16 MaxOutstandingR2T; /* 2 */
-+ UINT16 KeepAliveTimeout; /* 2 */
-+ UINT16 PortNumber; /* 2 */
-+ UINT16 MaxBurstSize; /* 2 */
-+ UINT16 TaskMgmtTimeout; /* 2 */
-+ UINT8 TargetAddr[EXT_DEF_ISCSI_TADDR_SIZE]; /* 32 */
-+} EXT_ISCSI_DEVICE, *PEXT_ISCSI_DEVICE; /* 64 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISCSI_IP_ADDR
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_IP_ADDR_SIZE 16
-+#define EXT_DEF_TYPE_ISCSI_IP 0
-+#define EXT_DEF_TYPE_ISCSI_IPV6 1
-+
-+typedef struct _EXT_ISCSI_IP_ADDR {
-+ UINT8 IPAddress[EXT_DEF_IP_ADDR_SIZE]; /* 16 */
-+ UINT16 Type; /* 2 */
-+ UINT16 Reserved; /* 2 */
-+} EXT_ISCSI_IP_ADDR, *PEXT_ISCSI_IP_ADDR; /* 20 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_NODE_INFO_ISCSI
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_ISCSI_NAME_LEN 256
-+#define EXT_DEF_ISCSI_ALIAS_LEN 32
-+
-+typedef struct _EXT_NODE_INFO_ISCSI {
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT8 iSCSIName[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ UINT8 Alias[EXT_DEF_ISCSI_ALIAS_LEN]; /* 32 */
-+ UINT16 PortalCount; /* 2 */
-+ UINT8 Reserved[10]; /* 10 */
-+} EXT_NODE_INFO_ISCSI, *PEXT_NODE_INFO_ISCSI; /* 320 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_SCSI_ADDR_ISCSI
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_SCSI_ADDR_ISCSI {
-+ UINT16 Bus; /* 2 */
-+ UINT16 Target; /* 2 */
-+ UINT16 Lun; /* 2 */
-+ UINT16 Padding[5]; /* 10 */
-+} EXT_SCSI_ADDR_ISCSI, *PEXT_SCSI_ADDR_ISCSI; /* 16 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ASYNC_EVENT
-+ * ****************************************************************************
-+ */
-+
-+/* Asynchronous Event Codes */
-+#define EXT_DEF_LINK_UP 0x8011
-+#define EXT_DEF_LINK_DOWN 0x8012
-+#define EXT_DEF_DEVICE_UPDATE 0x8014
-+#define EXT_DEF_STATS_ALARM 0x8020
-+
-+/* Required # of entries in the queue buffer allocated. */
-+#define EXT_DEF_MAX_AEN_QUEUE EXT_DEF_MAX_AEN_QUEUE_OS
-+#define EXT_DEF_MAX_AEN_PAYLOAD 7
-+
-+typedef struct _EXT_ASYNC_EVENT {
-+ UINT32 AsyncEventCode; /* 4 */
-+ UINT32 Payload[EXT_DEF_MAX_AEN_PAYLOAD]; /* 28 */
-+} EXT_ASYNC_EVENT, *PEXT_ASYNC_EVENT; /* 32 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_CHIP_INFO
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_CHIP_INFO {
-+ UINT16 VendorId; /* 2 */
-+ UINT16 DeviceId; /* 2 */
-+ UINT16 SubVendorId; /* 2 */
-+ UINT16 SubSystemId; /* 2 */
-+ UINT16 BoardID; /* 2 */
-+ UINT16 Reserved[35]; /* 70 */
-+} EXT_CHIP_INFO, *PEXT_CHIP_INFO; /* 80 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DEVICE_ENTRY_ISCSI
-+ * ****************************************************************************
-+ */
-+/* Options */
-+#define EXT_DEF_ISCSI_GRANT_ACCESS 0x04
-+#define EXT_DEF_ISCSI_TARGET_DEVICE 0x02
-+#define EXT_DEF_ISCSI_INITIATOR_DEVICE 0x01
-+
-+/* Control */
-+#define EXT_DEF_SESS_RECVRY_IN_PROCESS 0x10
-+#define EXT_DEF_ISCSI_TRANSMITTING 0x08
-+#define EXT_DEF_ISCSI_TX_LINKED 0x04
-+#define EXT_DEF_ISCSI_QUEUE_ABORTED 0x02
-+#define EXT_DEF_ISCSI_TX_LOGGED_IN 0x01
-+
-+/* DeviceState */
-+#define EXT_DEF_DEV_STATE_UNASSIGNED 0x00
-+#define EXT_DEF_DEV_STATE_NO_CONNECTION_ACTIVE 0x01
-+#define EXT_DEF_DEV_STATE_DISCOVERY 0x02
-+#define EXT_DEF_DEV_STATE_NO_SESSION_ACTIVE 0x03
-+#define EXT_DEF_DEV_STATE_SESSION_ACTIVE 0x04
-+#define EXT_DEF_DEV_STATE_LOGGING_OUT 0x05
-+#define EXT_DEF_DEV_STATE_SESSION_FAILED 0x06
-+#define EXT_DEF_DEV_STATE_OPENING 0x07
-+
-+#define EXT_DEF_ISCSI_ISID_SIZE 6
-+#define EXT_DEF_ISCSI_USER_ID_SIZE 32
-+#define EXT_DEF_ISCSI_PASSWORD_SIZE 32
-+
-+typedef struct _EXT_DEVICE_ENTRY_ISCSI {
-+ UINT8 Options; /* 1 */
-+ UINT8 Control; /* 1 */
-+ UINT8 InitiatorSessID[EXT_DEF_ISCSI_ISID_SIZE]; /* 6 */
-+ UINT16 TargetSessID; /* 2 */
-+ UINT32 ReservedFlags; /* 4 */
-+ UINT8 UserID[EXT_DEF_ISCSI_USER_ID_SIZE]; /* 32 */
-+ UINT8 Password[EXT_DEF_ISCSI_PASSWORD_SIZE]; /* 32 */
-+ EXT_ISCSI_DEVICE DeviceInfo; /* 64 */
-+ EXT_NODE_INFO_ISCSI EntryInfo; /* 320 */
-+ UINT16 ExeCount; /* 2 */
-+ UINT32 NumValid; /* 4 */
-+ UINT32 NextValid; /* 4 */
-+ UINT32 DeviceState; /* 4 */
-+ UINT16 DDBLink; /* 2 */
-+ UINT16 Reserved[17]; /* 34 */
-+} EXT_DEVICE_ENTRY_ISCSI, *PEXT_DEVICE_ENTRY_ISCSI; /* 512 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DEST_ADDR_ISCSI
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_DEST_ADDR_ISCSI {
-+ UINT8 iSCSINameStr[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ UINT16 SessionID; /* 2 */
-+ UINT16 ConnectionID; /* 2 */
-+ UINT16 PortNumber; /* 2 */
-+ UINT16 Reserved[3]; /* 6 */
-+} EXT_DEST_ADDR_ISCSI, *PEXT_DEST_ADDR_ISCSI; /* 268 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DISC_ISCSI_PORTAL
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_DISC_ISCSI_PORTAL {
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT16 NodeCount; /* 2 */
-+ UINT8 HostName[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT16 PortNumber; /* 2 */
-+ UINT16 Reserved; /* 2 */
-+} EXT_DISC_ISCSI_PORTAL, *PEXT_DISC_ISCSI_PORTAL; /* 154 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DISC_ISCSI_NODE
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_DISC_ISCSI_NODE {
-+ UINT16 SessionID; /* 2 */
-+ UINT16 ConnectionID; /* 2 */
-+ UINT16 PortalGroupID; /* 2 */
-+ EXT_NODE_INFO_ISCSI NodeInfo; /* 320 */
-+ EXT_SCSI_ADDR_ISCSI ScsiAddr; /* 16 */
-+ UINT16 Reserved; /* 2 */
-+} EXT_DISC_ISCSI_NODE, *PEXT_DISC_ISCSI_NODE; /* 344 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DNS
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_DNS {
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT8 Reserved[132]; /* 132 */
-+} EXT_DNS, *PEXT_DNS; /* 152 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_DRIVER_INFO
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_DRIVER_INFO {
-+ UINT8 Version[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT16 NumOfBus; /* 2 */
-+ UINT16 TargetsPerBus; /* 2 */
-+ UINT16 LunPerTarget; /* 2 */
-+ UINT16 LunPerTargetOS; /* 2 */
-+ UINT32 MaxTransferLen; /* 4 */
-+ UINT32 MaxDataSegments; /* 4 */
-+ UINT16 DmaBitAddresses; /* 2 */
-+ UINT16 IoMapType; /* 2 */
-+ UINT32 Attrib; /* 4 */
-+ UINT32 InternalFlags[4]; /* 16 */
-+ UINT32 Reserved[8]; /* 32 */
-+} EXT_DRIVER_INFO, *PEXT_DRIVER_INFO; /* 200 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_FW_INFO
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_FW_INFO {
-+ UINT8 Version[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT32 Attrib; /* 4 */
-+ UINT32 Reserved[8]; /* 32 */
-+} EXT_FW_INFO, *PEXT_FW_INFO; /* 164 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_HBA_ISCSI_NODE
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_HBA_ISCSI_NODE {
-+ UINT8 DeviceName[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT16 PortNumber; /* 2 */
-+ EXT_NODE_INFO_ISCSI NodeInfo; /* 320 */
-+ UINT16 Reserved; /* 2 */
-+} EXT_HBA_ISCSI_NODE, *PEXT_HBA_ISCSI_NODE; /* 452 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_HBA_ISCSI_PORTAL
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_MAC_ADDR_SIZE 6
-+
-+/* State */
-+#define EXT_DEF_CARD_STATE_READY 1
-+#define EXT_DEF_CARD_STATE_CONFIG_WAIT 2
-+#define EXT_DEF_CARD_STATE_LOGIN 3
-+#define EXT_DEF_CARD_STATE_ERROR 4
-+
-+/* Type */
-+#define EXT_DEF_TYPE_COPPER 1
-+#define EXT_DEF_TYPE_OPTICAL 2
-+
-+#define EXT_DEF_SERIAL_NUM_SIZE 4
-+
-+typedef struct _EXT_HBA_ISCSI_PORTAL {
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT8 MacAddr[EXT_DEF_MAC_ADDR_SIZE]; /* 6 */
-+ UINT8 Padding[2]; /* 2 */
-+ UINT32 SerialNum; /* 4 */
-+ UINT8 Manufacturer[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT8 Model[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT8 DriverVersion[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT8 FWVersion[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT8 OptRomVersion[EXT_DEF_MAX_STR_SIZE]; /* 128 */
-+ UINT16 State; /* 2 */
-+ UINT16 Type; /* 2 */
-+ UINT32 DriverAttr; /* 4 */
-+ UINT32 FWAttr; /* 4 */
-+ UINT16 DiscTargetCount; /* 2 */
-+ UINT32 Reserved; /* 4 */
-+} EXT_HBA_ISCSI_PORTAL, *PEXT_HBA_ISCSI_PORTAL; /* 686 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_HBA_PORT_STAT_GEN
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_HBA_PORT_STAT_GEN {
-+ UINT64 HBAPortErrorCount; /* 8 */
-+ UINT64 DevicePortErrorCount; /* 8 */
-+ UINT64 IoCount; /* 8 */
-+ UINT64 MBytesCount; /* 8 */
-+ UINT64 InterruptCount; /* 8 */
-+ UINT64 LinkFailureCount; /* 8 */
-+ UINT64 InvalidCrcCount; /* 8 */
-+ UINT32 Reserved[2]; /* 8 */
-+} EXT_HBA_PORT_STAT_GEN, *PEXT_HBA_PORT_STAT_GEN; /* 64 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_HBA_PORT_STAT_ISCSI
-+ * ****************************************************************************
-+ */
-+typedef struct _EXT_HBA_PORT_STAT_ISCSI {
-+ UINT64 MACTxFramesCount; /* 8 */
-+ UINT64 MACTxBytesCount; /* 8 */
-+ UINT64 MACRxFramesCount; /* 8 */
-+ UINT64 MACRxBytesCount; /* 8 */
-+ UINT64 MACCRCErrorCount; /* 8 */
-+ UINT64 MACEncodingErrorCount; /* 8 */
-+ UINT64 IPTxPacketsCount; /* 8 */
-+ UINT64 IPTxBytesCount; /* 8 */
-+ UINT64 IPTxFragmentsCount; /* 8 */
-+ UINT64 IPRxPacketsCount; /* 8 */
-+ UINT64 IPRxBytesCount; /* 8 */
-+ UINT64 IPRxFragmentsCount; /* 8 */
-+ UINT64 IPDatagramReassemblyCount; /* 8 */
-+ UINT64 IPv6RxPacketsCount; /* 8 */
-+ UINT64 IPRxPacketErrorCount; /* 8 */
-+ UINT64 IPReassemblyErrorCount; /* 8 */
-+ UINT64 TCPTxSegmentsCount; /* 8 */
-+ UINT64 TCPTxBytesCount; /* 8 */
-+ UINT64 TCPRxSegmentsCount; /* 8 */
-+ UINT64 TCPRxBytesCount; /* 8 */
-+ UINT64 TCPTimerExpiredCount; /* 8 */
-+ UINT64 TCPRxACKCount; /* 8 */
-+ UINT64 TCPTxACKCount; /* 8 */
-+ UINT64 TCPRxErrorSegmentCount; /* 8 */
-+ UINT64 TCPWindowProbeUpdateCount; /* 8 */
-+ UINT64 iSCSITxPDUCount; /* 8 */
-+ UINT64 iSCSITxBytesCount; /* 8 */
-+ UINT64 iSCSIRxPDUCount; /* 8 */
-+ UINT64 iSCSIRxBytesCount; /* 8 */
-+ UINT64 iSCSICompleteIOsCount; /* 8 */
-+ UINT64 iSCSIUnexpectedIORxCount; /* 8 */
-+ UINT64 iSCSIFormatErrorCount; /* 8 */
-+ UINT64 iSCSIHeaderDigestCount; /* 8 */
-+ UINT64 iSCSIDataDigestErrorCount; /* 8 */
-+ UINT64 iSCSISeqErrorCount; /* 8 */
-+ UINT32 Reserved[2]; /* 8 */
-+} EXT_HBA_PORT_STAT_ISCSI, *PEXT_HBA_PORT_STAT_ISCSI; /* 272 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_INIT_FW_ISCSI
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_FW_MARKER_DISABLE 0x0400
-+#define EXT_DEF_FW_ACCESS_CONTROL_ENABLE 0x0080
-+#define EXT_DEF_FW_SESSION_MODE_ENABLE 0x0040
-+#define EXT_DEF_FW_INITIATOR_MODE_ENABLE 0x0020
-+#define EXT_DEF_FW_TARGET_MODE_ENABLE 0x0010
-+#define EXT_DEF_FW_FAST_STATUS_ENABLE 0x0008
-+#define EXT_DEF_FW_DMA_INT_ENABLE 0x0004
-+#define EXT_DEF_FW_SENSE_BUFF_DESC_ENABLE 0x0002
-+
-+typedef struct _EXT_INIT_FW_ISCSI {
-+ UINT8 Reserved1; /* 1 */
-+ UINT8 Version; /* 1 */
-+ UINT16 FWOptions; /* 2 */
-+ UINT16 AddFWOptions; /* 2 */
-+ UINT16 WakeupThreshold; /* 2 */
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ EXT_ISCSI_IP_ADDR SubnetMask; /* 20 */
-+ EXT_ISCSI_IP_ADDR Gateway; /* 20 */
-+ EXT_DNS DNSConfig; /* 152 */
-+ UINT8 Alias[EXT_DEF_ISCSI_ALIAS_LEN]; /* 32 */
-+ UINT8 iSCSIName[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ EXT_ISCSI_DEVICE DeviceInfo; /* 64 */
-+ UINT8 Reserved[4]; /* 4 */
-+} EXT_INIT_FW_ISCSI , *PEXT_INIT_FW_ISCSI; /* 576 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISCSI_PASSTHRU
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_ISCSI_PASSTHRU_PDU_LENGTH 64
-+
-+#define EXT_DEF_ISCSI_PASSTHRU_DATA_IN 1
-+#define EXT_DEF_ISCSI_PASSTHRU_DATA_OUT 2
-+
-+typedef struct _EXT_ISCSI_PASSTHRU {
-+ EXT_DEST_ADDR_ISCSI Addr; /* 268 */
-+ UINT16 Direction; /* 2 */
-+ UINT32 PduInLength; /* 4 */
-+ UINT8 PduIn[EXT_DEF_ISCSI_PASSTHRU_PDU_LENGTH]; /* 64 */
-+ UINT32 PduOutLength; /* 4 */
-+ UINT8 PduOut[EXT_DEF_ISCSI_PASSTHRU_PDU_LENGTH]; /* 64 */
-+ UINT32 Flags; /* 4 */
-+ UINT32 Reserved; /* 4 */
-+} EXT_ISCSI_PASSTHRU, *PEXT_ISCSI_PASSTHRU; /* 282 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_REG_AEN_ISCSI
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_ENABLE_STATS_AEN 0x00000002
-+#define EXT_DEF_ENABLE_DDB_CHANGED_AEN 0x00000001
-+
-+typedef struct _EXT_REG_AEN_ISCSI {
-+ UINT32 Enable; /* 4 */
-+ UINT32 Reserved[3]; /* 12 */
-+} EXT_REG_AEN_ISCSI, *PEXT_REG_AEN_ISCSI; /* 16 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_SCSI_PASSTHRU_ISCSI
-+ * ****************************************************************************
-+ */
-+#define EXT_DEF_SCSI_PASSTHRU_CDB_LENGTH 16
-+
-+#define EXT_DEF_SCSI_PASSTHRU_DATA_IN 1
-+#define EXT_DEF_SCSI_PASSTHRU_DATA_OUT 2
-+
-+#define EXT_DEF_SCSI_SENSE_DATA_SIZE 256
-+
-+typedef struct _EXT_SCSI_PASSTHRU_ISCSI {
-+ EXT_SCSI_ADDR_ISCSI Addr; /* 16 */
-+ UINT8 Direction; /* 1 */
-+ UINT8 CdbLength; /* 1 */
-+ UINT8 Cdb[EXT_DEF_SCSI_PASSTHRU_CDB_LENGTH]; /* 16 */
-+ UINT8 Reserved[16]; /* 16 */
-+ UINT8 SenseData[EXT_DEF_SCSI_SENSE_DATA_SIZE];/* 256 */
-+} EXT_SCSI_PASSTHRU_ISCSI, *PEXT_SCSI_PASSTHRU_ISCSI; /* 306 */
-+
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISNS_SERVER
-+ * ****************************************************************************
-+ */
-+
-+#define EXT_DEF_ISNS_WELL_KNOWN_PORT 3205
-+
-+typedef struct _EXT_ISNS_SERVER {
-+ UINT8 PerformiSNSDiscovery; /* 1 */
-+ UINT8 AutomaticiSNSDiscovery; /* 1 */
-+ UINT8 Reserved1[2]; /* 2 */
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT16 PortNumber; /* 2 */
-+ UINT16 Reserved2; /* 2 */
-+ UINT8 InitiatorName[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ UINT32 Reserved3; /* 4 */
-+} EXT_ISNS_SERVER, *PEXT_ISNS_SERVER; /* 288 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISNS_DISCOVERED_TARGET_PORTAL
-+ * ****************************************************************************
-+ */
-+
-+typedef struct _EXT_ISNS_DISCOVERED_TARGET_PORTAL
-+{
-+ EXT_ISCSI_IP_ADDR IPAddr; /* 20 */
-+ UINT16 PortNumber; /* 2 */
-+ UINT16 Reserved; /* 2 */
-+} EXT_ISNS_DISCOVERED_TARGET_PORTAL, *PEXT_ISNS_DISCOVERED_TARGET_PORTAL;
-+ /* 24 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISNS_DISCOVERED_TARGET
-+ * ****************************************************************************
-+ */
-+
-+#define EXT_DEF_ISNS_MAX_PORTALS 4
-+
-+typedef struct _EXT_ISNS_DISCOVERED_TARGET
-+{
-+ UINT32 NumPortals; /* 4 */
-+ EXT_ISNS_DISCOVERED_TARGET_PORTAL Portal[EXT_DEF_ISNS_MAX_PORTALS]; /* 96 */
-+ UINT32 DDID; /* 4 */
-+ UINT8 NameString[EXT_DEF_ISCSI_NAME_LEN]; /* 256 */
-+ UINT8 Alias[EXT_DEF_ISCSI_ALIAS_LEN]; /* 32 */
-+} EXT_ISNS_DISCOVERED_TARGET, *PEXT_ISNS_DISCOVERED_TARGET; /* 392 */
-+
-+/*
-+ * ****************************************************************************
-+ * EXT_ISNS_DISCOVERED_TARGETS
-+ * ****************************************************************************
-+ */
-+
-+#define EXT_DEF_NUM_ISNS_DISCOVERED_TARGETS 32
-+
-+typedef struct _EXT_ISNS_DISCOVERED_TARGETS
-+{
-+ UINT32 iSNSDiscoveredTargetIndexStart; /* 4 */
-+ UINT32 NumiSNSDiscoveredTargets; /* 4 */
-+ EXT_ISNS_DISCOVERED_TARGET
-+ iSNSDiscoveredTargets[EXT_DEF_NUM_ISNS_DISCOVERED_TARGETS];
-+ /* 12544 */
-+} EXT_ISNS_DISCOVERED_TARGETS, *PEXT_ISNS_DISCOVERED_TARGETS;
-+ /* 12548 */
-+
-+
-+#endif /* _QLISIOCT_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlisioln.h ./drivers/scsi/qla4xxx/qlisioln.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlisioln.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlisioln.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,233 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+#ifndef _QLISIOLN_H_
-+#define _QLISIOLN_H_
-+
-+#include <linux/ioctl.h>
-+
-+#ifdef APILIB
-+#include <stdint.h>
-+#include <linux/types.h>
-+#endif
-+
-+#ifndef INT8
-+#define INT8 int8_t
-+#endif
-+#ifndef INT16
-+#define INT16 int16_t
-+#endif
-+#ifndef INT32
-+#define INT32 int32_t
-+#endif
-+#ifndef UINT8
-+#define UINT8 uint8_t
-+#endif
-+#ifndef UINT16
-+#define UINT16 uint16_t
-+#endif
-+#ifndef UINT32
-+#define UINT32 uint32_t
-+#endif
-+
-+#ifndef UINT64
-+#define UINT64 unsigned long long
-+#endif
-+
-+#ifndef BOOLEAN
-+#define BOOLEAN uint8_t
-+#endif
-+
-+
-+#if BITS_PER_LONG <= 32
-+#define EXT_ADDR_MODE_OS EXT_DEF_ADDR_MODE_32
-+#else
-+#define EXT_ADDR_MODE_OS EXT_DEF_ADDR_MODE_64
-+#endif
-+
-+
-+#define QLMULTIPATH_MAGIC 'z'
-+
-+#define _QLBUILD /* for qlisioct.h to enable include of qinsdmgt.h */
-+
-+
-+
-+/* max index values */
-+#define EXT_DEF_MAX_HBA_OS 63 /* 0 - 0x3F */
-+#define EXT_DEF_MAX_HBAS 64
-+
-+#define EXT_DEF_MAX_BUS_OS 1
-+
-+#define EXT_DEF_MAX_TARGET_OS 255 /* 0 - 0xFF */
-+#define EXT_DEF_MAX_TARGETS 256
-+
-+#define EXT_DEF_MAX_LUN_OS 255 /* 0 - 0xFF */
-+#define EXT_DEF_MAX_LUNS 256
-+
-+#define EXT_DEF_MAX_AEN_QUEUE_OS 64
-+
-+#define EXT_DEF_USE_HBASELECT 0x02 /* bit 1: HbaSelect field is
-+ * used to specify destination
-+ * HBA of each command.
-+ * SetInstance cmd is now
-+ * issued only once during
-+ * API initialization.
-+ */
-+
-+
-+#define EXT_DEF_REGULAR_SIGNATURE "QLOGIC"
-+
-+
-+/*************************************************************/
-+/* Command codes */
-+/*-----------------------------------------------------------*/
-+/* Correctly defined to work on both 32bit and 64bit kernels */
-+/*************************************************************/
-+#define QL_IOCTL_BASE(idx) \
-+ _IOWR(QLMULTIPATH_MAGIC, idx, EXT_IOCTL_ISCSI)
-+
-+#define QL_IOCTL_CMD(idx) QL_IOCTL_BASE(idx)
-+
-+
-+/***********************************
-+ * These are regular command codes
-+ * idx range from 0x00 to 0x2f
-+ ***********************************/
-+#define EXT_DEF_REG_CC_START_IDX 0x00
-+
-+#define EXT_CC_QUERY_OS /* QUERY */ \
-+ QL_IOCTL_CMD(0x00)
-+
-+#define EXT_CC_REG_AEN_OS /* REG_AEN */ \
-+ QL_IOCTL_CMD(0x01)
-+
-+#define EXT_CC_GET_AEN_OS /* GET_AEN */ \
-+ QL_IOCTL_CMD(0x02)
-+
-+#define EXT_CC_GET_DATA_OS /* GET_DATA */ \
-+ QL_IOCTL_CMD(0x03)
-+
-+#define EXT_CC_SET_DATA_OS /* SET_DATA */ \
-+ QL_IOCTL_CMD(0x04)
-+
-+#define EXT_CC_SEND_SCSI_PASSTHRU_OS /* SCSI_PASSTHRU */ \
-+ QL_IOCTL_CMD(0x05)
-+
-+#define EXT_CC_SEND_ISCSI_PASSTHRU_OS /* ISCSI_PASSTHRU */ \
-+ QL_IOCTL_CMD(0x06)
-+
-+#define EXT_DEF_REG_CC_END_IDX 0x06
-+
-+/***********************************
-+ * Internal command codes
-+ * idx range from 0x10 to 0x2f
-+ ***********************************/
-+#define EXT_DEF_INT_CC_START_IDX 0x10
-+
-+#define EXT_CC_RESERVED0A_OS \
-+ QL_IOCTL_CMD(0x10)
-+#define EXT_CC_RESERVED0B_OS \
-+ QL_IOCTL_CMD(0x11)
-+#define EXT_CC_RESERVED0C_OS \
-+ QL_IOCTL_CMD(0x12)
-+#define EXT_CC_RESERVED0D_OS \
-+ QL_IOCTL_CMD(0x13)
-+#define EXT_CC_RESERVED0E_OS \
-+ QL_IOCTL_CMD(0x14)
-+#define EXT_CC_RESERVED0F_OS \
-+ QL_IOCTL_CMD(0x15)
-+#define EXT_CC_RESERVED0G_OS \
-+ QL_IOCTL_CMD(0x16)
-+#define EXT_CC_RESERVED0H_OS \
-+ QL_IOCTL_CMD(0x17)
-+#define EXT_CC_RESERVED0I_OS \
-+ QL_IOCTL_CMD(0x18)
-+
-+#define EXT_DEF_INT_CC_END_IDX 0x18
-+
-+/***********************************
-+ * NextGen Failover ioctl command
-+ * codes range from 0x37 to 0x4f.
-+ * See qlnfoln.h
-+ ***********************************/
-+
-+/***********************************
-+ * These are a Linux driver specific
-+ * commands.
-+ * idx range from highest value 0xff
-+ * and in decreasing order.
-+ ***********************************/
-+#define EXT_DEF_DRV_SPC_CC_START_IDX 0xff
-+
-+#define EXT_CC_GET_HBACNT /* GET_HBACNT */ \
-+ QL_IOCTL_CMD(0xff)
-+
-+#define EXT_CC_GET_HOST_NO /* SET_INSTANCE */ \
-+ QL_IOCTL_CMD(0xfe)
-+
-+#define EXT_CC_DRIVER_SPECIFIC /* DRIVER_SPECIFIC */ \
-+ QL_IOCTL_CMD(0xfc)
-+
-+
-+#define EXT_DEF_DRV_SPC_CC_END_IDX 0xfc
-+
-+/******************************/
-+/* Response struct definition */
-+/******************************/
-+
-+/*
-+ * HBA Count
-+ */
-+typedef struct _EXT_HBA_COUNT {
-+ UINT16 HbaCnt; /* 2 */
-+} EXT_HBA_COUNT, *PEXT_HBA_COUNT; /* 2 */
-+
-+/*
-+ * Driver Specific
-+ */
-+typedef struct _EXT_LN_DRV_VERSION {
-+ UINT8 Major;
-+ UINT8 Minor;
-+ UINT8 Patch;
-+ UINT8 Beta;
-+ UINT8 Reserved[4];
-+} EXT_LN_DRV_VERSION; /* 8 */
-+
-+typedef struct _EXT_LN_DRIVER_DATA {
-+ EXT_LN_DRV_VERSION DrvVer; /* 8 */
-+ UINT32 Flags; /* 4 */
-+ UINT32 AdapterModel; /* 4 */
-+ UINT32 Reserved[12]; /* 48 */
-+} EXT_LN_DRIVER_DATA, *PEXT_LN_DRIVER_DATA; /* 64 */
-+
-+/* Bit defines for the Flags field */
-+#define EXT_DEF_NGFO_CAPABLE 0x0001 /* bit 0 */
-+
-+/* Bit defines for the AdapterModel field */
-+/* bit 0 to bit 7 are used by FC driver. when adding new bit
-+ * definitions they must be unique among all supported drivers
-+ */
-+#define EXT_DEF_QLA4010_DRIVER 0x0100 /* bit 8 */
-+#define EXT_DEF_QLA4022_DRIVER 0x0200 /* bit 9 */
-+
-+#define EXT_DEF_QLA4XXX_DRIVER \
-+ (EXT_DEF_QLA4010_DRIVER | EXT_DEF_QLA4022_DRIVER)
-+
-+
-+
-+#endif //_QLISIOLN_H_
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlnfo.h ./drivers/scsi/qla4xxx/qlnfo.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlnfo.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlnfo.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,605 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+/*
-+ * File Name: qlnfo.h
-+ *
-+ * Revision History:
-+ *
-+ */
-+
-+#ifndef _QLNFO_H
-+#define _QLNFO_H
-+
-+#include "qlud.h"
-+
-+/*
-+ * NOTE: the following version defines must be updated each time the
-+ * changes made may affect the backward compatibility of the
-+ * input/output relations
-+ */
-+#define NFO_VERSION 1
-+#define NFO_VERSION_STR "1.0"
-+
-+/*
-+ * ***********************************************************************
-+ * Data type definitions
-+ * ***********************************************************************
-+ */
-+#ifdef _MSC_VER
-+
-+#include "ntddscsi.h"
-+#include "qlnfowin.h"
-+
-+/*
-+ * ***********************************************************************
-+ * OS dependent General configuration defines
-+ * ***********************************************************************
-+ */
-+
-+#elif defined(linux) /* Linux */
-+
-+#elif defined(sun) || defined(__sun) /* Solaris */
-+
-+#endif
-+
-+/*
-+ * ***********************************************************************
-+ * Generic definitions
-+ * ***********************************************************************
-+ */
-+#define NFO_DEF_SIGNATURE_SIZE 8
-+#define NFO_DEF_SIGNATURE "QLGCNFO"
-+
-+/* Constants */
-+#define NFO_DEF_UNSUPPORTED 0xFFFFFFFF
-+#define NFO_DEF_STR_NAME_SIZE_32 32
-+#define NFO_DEF_STR_NAME_SIZE_64 64
-+#define NFO_DEF_STR_NAME_SIZE_128 128
-+#define NFO_DEF_STR_NAME_SIZE_256 256
-+#define NFO_DEF_STR_NAME_SIZE_512 512
-+#define NFO_DEF_INQ_VENDOR_ID_SIZE 8
-+#define NFO_DEF_INQ_PROD_ID_SIZE 16
-+#define NFO_DEF_INQ_PROD_VER_SIZE 4
-+#define NFO_DEF_INQ_LUID_SIZE 16
-+#define NFO_DEF_INQ_SERIAL_NO_SIZE 16
-+#define NFO_DEF_PATH_ALL NFO_DEF_UNSUPPORTED /* All paths */
-+
-+/* Device transport protocol */
-+#define NFO_TRANSPORT_FC 1
-+#define NFO_TRANSPORT_ISCSI 2
-+#define NFO_TRANSPORT_NO_SUP NFO_TRANSPORT_ISCSI /* No supported */
-+#define NFO_TRANSPORT_UNKNOWN NFO_DEF_UNSUPPORTED
-+
-+/* Unique identification */
-+#define NFO_FC_WWN_SIZE 8
-+#define NFO_FC_PID_SIZE 4
-+#define NFO_IS_NAME_SIZE 256
-+#define NFO_IS_IP_ADDR_SIZE 16
-+#define NFO_IS_IP_ADDR_TYPE4 4
-+#define NFO_IS_IP_ADDR_TYPE6 6
-+
-+/* API_INFO */
-+#define NFO_AI_MAXFOM_NO_LIMIT NFO_DEF_UNSUPPORTED /* No limit */
-+
-+/* FOM_PROP */
-+#define NFO_FP_FLG_HBA 1 /* FO implemented in HBA driver */
-+#define NFO_FP_FLG_DISABLE 2 /* FOM disabled */
-+#define NFO_FP_FLG_SUP_LB 16 /* Support load balancing */
-+#define NFO_FP_FLG_SUP_PATH_ORDER 32 /* Support path ordering */
-+#define NFO_FP_FLG_SUP_PATH_WEIGH 64 /* Support path weigh */
-+#define NFO_FOM_PROP_NO_SUP 1 /* Settable property supported no */
-+
-+/* PATH_INFO */
-+#define NFO_PI_PREFERRED 1 /* Preferred path bit */
-+#define NFO_PATH_PROP_NO_SUP 0 /* Settable property supported no */
-+
-+/* LB_POLICY */
-+#define NFO_LB_UNKNOWN NFO_DEF_UNSUPPORTED
-+#define NFO_LB_FAILOVER_ONLY 1
-+#define NFO_LB_ROUND_ROBIN 2
-+#define NFO_LB_ROUND_ROBIN_SUBSET 3
-+#define NFO_LB_DYN_LEAST_QUEUE_DEPTH 4
-+#define NFO_LB_WEIGHTED_PATHS 5
-+#define NFO_LB_LEAST_BLOCKS 6
-+#define NFO_LB_VENDOR_SPECIFIC 7
-+#define NFO_LB_STATIC 8
-+
-+/* SPC3 Asymmetric access state */
-+#define NFO_AAS_ACTIVE_OPT 0
-+#define NFO_AAS_ACTIVE_NONOPT 1
-+#define NFO_AAS_STANDBY 2
-+#define NFO_AAS_UNAVAIL 3
-+#define NFO_AAS_RESERVED 4
-+#define NFO_AAS_ILL_REQ 15
-+
-+/* Device state */
-+#define NFO_DS_ACTIVE 1
-+#define NFO_DS_PASSIVE 2
-+#define NFO_DS_FAILED 3
-+#define NFO_DS_PENDING_REMOVE 4
-+#define NFO_DS_REMOVED 5
-+#define NFO_DS_UNAVAILABLE 6
-+#define NFO_DS_TRANSITIONING 7
-+#define NFO_DS_RESERVED 8
-+
-+/* Fog state */
-+#define NFO_FOG_NORMAL 1
-+#define NFO_FOG_PENDING 2
-+#define NFO_FOG_FAILBACK 3
-+#define NFO_FOG_FAILOVER 4
-+
-+/* Return status */
-+#define NFO_STS_BASE 0x90000000
-+#define NFO_STS_OK (NFO_STS_BASE + 0)
-+#define NFO_STS_INV_HNDL (NFO_STS_BASE + 1)
-+#define NFO_STS_INV_INSTN (NFO_STS_BASE + 2)
-+#define NFO_STS_UNDERRUN (NFO_STS_BASE + 3)
-+#define NFO_STS_EXISTED (NFO_STS_BASE + 4)
-+#define NFO_STS_NOT_PRESENT (NFO_STS_BASE + 5)
-+#define NFO_STS_FAIL (NFO_STS_BASE + 6)
-+#define NFO_STS_NOT_YET_IMPLEMENTED (NFO_STS_BASE + 7)
-+#define NFO_STS_UNSUP (NFO_STS_BASE + 8) /* Not supported */
-+#define NFO_STS_INV_INSTANCE (NFO_STS_BASE + 9) /* Invalid instance */
-+#define NFO_STS_REBOOT_NEEDED (NFO_STS_BASE + 10) /* Reboot needed */
-+#define NFO_STS_INV_PATH (NFO_STS_BASE + 11) /* Invalid path */
-+#define NFO_STS_INV_PARAM (NFO_STS_BASE + 19)
-+#define NFO_STS_INV_PARAM0 (NFO_STS_BASE + 20)
-+#define NFO_STS_INV_PARAM1 (NFO_STS_BASE + 21)
-+#define NFO_STS_INV_PARAM2 (NFO_STS_BASE + 22)
-+#define NFO_STS_INV_PARAM3 (NFO_STS_BASE + 23)
-+#define NFO_STS_INV_PARAM4 (NFO_STS_BASE + 24)
-+#define NFO_STS_INV_PARAM5 (NFO_STS_BASE + 25)
-+#define NFO_STS_INV_PARAM6 (NFO_STS_BASE + 26)
-+#define NFO_STS_INV_PARAM7 (NFO_STS_BASE + 27)
-+#define NFO_STS_INV_PARAM8 (NFO_STS_BASE + 28)
-+#define NFO_STS_INV_PARAM9 (NFO_STS_BASE + 29)
-+#define NFO_STS_CFG_CHANGED (NFO_STS_BASE + 50)
-+#define NFO_STS_FOM_ENABLED (NFO_STS_BASE + 51)
-+#define NFO_STS_FOM_DISABLED (NFO_STS_BASE + 52)
-+#define NFO_STS_FOM_ADDED (NFO_STS_BASE + 53)
-+#define NFO_STS_FOM_REMOVED (NFO_STS_BASE + 54)
-+#define NFO_STS_HBA_ADDED (NFO_STS_BASE + 55)
-+#define NFO_STS_HBA_REMOVED (NFO_STS_BASE + 56)
-+#define NFO_STS_PATH_ADDED (NFO_STS_BASE + 57)
-+#define NFO_STS_PATH_REMOVED (NFO_STS_BASE + 58)
-+#define NFO_STS_DEV_ADDED (NFO_STS_BASE + 59)
-+#define NFO_STS_DEV_REMOVED (NFO_STS_BASE + 60)
-+
-+/* Event Codes */
-+#define NFO_ES_INFO 0x60000000
-+#define NFO_ES_WARN 0xA0000000
-+#define NFO_ES_ERR 0xE0000000
-+#define NFO_EF_FOM 0x00010000
-+#define NFO_EF_HBA 0x00020000
-+#define NFO_EF_DPG 0x00030000
-+#define NFO_EF_PATH 0x00040000
-+#define NFO_EVT_FOM_ENABLED (NFO_ES_INFO | NFO_EF_FOM | 1) /* FOM enable */
-+#define NFO_EVT_FOM_DISABLED (NFO_ES_INFO | NFO_EF_FOM | 2) /* FOM disable */
-+#define NFO_EVT_FOM_ADDED (NFO_ES_INFO | NFO_EF_FOM | 3) /* FOM add */
-+#define NFO_EVT_FOM_REMOVED (NFO_ES_INFO | NFO_EF_FOM | 4) /* FOM del */
-+#define NFO_EVT_HBA_ADDED (NFO_ES_INFO | NFO_EF_HBA | 5) /* HBA add */
-+#define NFO_EVT_HBA_REMOVED (NFO_ES_INFO | NFO_EF_HBA | 6) /* HBA del */
-+#define NFO_EVT_PATH_ADDED (NFO_ES_INFO | NFO_EF_PATH | 7) /* Path add */
-+#define NFO_EVT_PATH_REMOVED (NFO_ES_INFO | NFO_EF_PATH | 8) /* Path del */
-+#define NFO_EVT_DEV_ADDED (NFO_ES_INFO | NFO_EF_PATH | 9) /* Dev add */
-+#define NFO_EVT_DEV_REMOVED (NFO_ES_INFO | NFO_EF_PATH | 10) /* Dev del */
-+#define NFO_EVT_PATH_FAILOVER (NFO_ES_INFO | NFO_EF_PATH | 11) /* Path failover */
-+#define NFO_EVT_PATH_FAILBACK (NFO_ES_INFO | NFO_EF_PATH | 12) /* Path failback */
-+#define NFO_EVT_ER_THOLD (NFO_ES_INFO | NFO_EF_DPG | 13) /* Err threshold */
-+#define NFO_EVT_FO_THOLD (NFO_ES_INFO | NFO_EF_DPG | 14) /* Fo threshold */
-+#define NFO_MAX_EVENT (NFO_EVT_END)
-+
-+#define NFO_EVENT_CB UD_H
-+/*
-+ * ***********************************************************************
-+ * Common header struct definitions
-+ * ***********************************************************************
-+ */
-+typedef struct _NFO_API_INFO
-+{
-+ UD_UI4 Version;
-+ UD_UI4 MaxFOM;
-+ UD_UI4 Reserved[8];
-+} NFO_API_INFO, *PNFO_API_INFO;
-+
-+typedef struct _NFO_PROP_ENTRY
-+{
-+ UD_UI4 Current;
-+ UD_UI4 Min;
-+ UD_UI4 Def;
-+ UD_UI4 Max;
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_32];
-+ UD_UI4 Reserved[8];
-+} NFO_PROP_ENTRY, *PNFO_PROP_ENTRY;
-+
-+typedef struct _NFO_PROP_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_PROP_ENTRY Entry[1];
-+} NFO_PROP_LIST, *PNFO_PROP_LIST;
-+
-+typedef struct _NFO_FOM_PROP
-+{
-+ UD_UI4 Version;
-+ UD_UI4 Flag;
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_32];
-+ UD_UI4 HbaCount;
-+ UD_UI4 DpgCount;
-+ UD_UI4 SupportedTargetCount;
-+ UD_UI4 CurrentTargetCount;
-+ UD_UI4 MaxPath;
-+ UD_UI4 Reserved[8];
-+ NFO_PROP_LIST PropList;
-+} NFO_FOM_PROP, *PNFO_FOM_PROP;
-+
-+typedef struct _NFO_FC_UID
-+{
-+ UD_UI1 Wwpn[NFO_FC_WWN_SIZE];
-+ UD_UI1 Wwnn[NFO_FC_WWN_SIZE];
-+ UD_UI1 Pid[NFO_FC_PID_SIZE];
-+ UD_UI4 Reserved[8];
-+} NFO_FC_UID, *PNFO_FC_UID;
-+
-+typedef struct _NFO_IS_UID
-+{
-+ UD_UI4 IpType;
-+ UD_UI1 Ip[NFO_IS_IP_ADDR_SIZE];
-+ UD_UI1 Name[NFO_IS_NAME_SIZE];
-+ UD_UI4 Reserved[8];
-+} NFO_IS_UID, *PNFO_IS_UID;
-+
-+typedef struct _NFO_TRANSPORT
-+{
-+ UD_UI4 Value;
-+ UD_UI1 Name[NFO_IS_NAME_SIZE];
-+ UD_UI4 Reserved[8];
-+} NFO_TRANSPORT, *PNFO_TRANSPORT;
-+
-+typedef struct _NFO_TRANSPORT_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_TRANSPORT Entry[1];
-+} NFO_TRANSPORT_LIST, *PNFO_TRANSPORT_LIST;
-+
-+typedef struct _NFO_HBA_INFO
-+{
-+ UD_UI4 Number;
-+ UD_UI4 Transport;
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_64];
-+ union
-+ {
-+ NFO_FC_UID FcUid;
-+ NFO_IS_UID IsUid;
-+ } Uid;
-+ UD_UI4 Reserved[8];
-+} NFO_HBA_INFO, *PNFO_HBA_INFO;
-+
-+typedef struct _NFO_HBA_INFO_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_HBA_INFO Entry[1];
-+} NFO_HBA_INFO_LIST, *PNFO_HBA_INFO_LIST;
-+
-+typedef struct _NFO_SCSI_ADDR
-+{
-+ UD_UI4 Number;
-+ UD_UI4 Bus;
-+ UD_UI4 Target;
-+ UD_UI4 Lun;
-+} NFO_SCSI_ADDR, *PNFO_SCSI_ADDR;
-+
-+typedef struct _NFO_DEV_INFO
-+{
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_64];
-+ UD_UI1 VendorId[NFO_DEF_INQ_VENDOR_ID_SIZE];
-+ UD_UI1 ProductId[NFO_DEF_INQ_PROD_ID_SIZE];
-+ UD_UI1 ProductVersion[NFO_DEF_INQ_PROD_VER_SIZE];
-+ UD_UI1 Luid[NFO_DEF_INQ_LUID_SIZE];
-+ UD_UI4 Transport;
-+ union
-+ {
-+ NFO_FC_UID FcUid;
-+ NFO_IS_UID IsUid;
-+ } Uid;
-+ UD_UI4 Reserved[8];
-+} NFO_DEV_INFO, *PNFO_DEV_INFO;
-+
-+typedef struct _LB_POLICY
-+{
-+ UD_UI4 Value;
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_32];
-+ UD_UI4 Reserved[8];
-+} NFO_LB_POLICY, *PNFO_LB_POLICY;
-+
-+typedef struct _LB_POLICY_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI1 Count;
-+ NFO_LB_POLICY Entry[1];
-+} NFO_LB_POLICY_LIST, *PNFO_LB_POLICY_LIST;
-+
-+typedef struct _LB_POLICY_INFO
-+{
-+ NFO_LB_POLICY_LIST Supported;
-+ UD_UI4 Current;
-+ UD_UI4 ActivePathCount;
-+ UD_UI4 Reserved[8];
-+} NFO_LB_POLICY_INFO, *PNFO_LB_POLICY_INFO;
-+
-+typedef struct _DPG_PROP
-+{
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_64];
-+ NFO_DEV_INFO DevInfo;
-+ UD_UI4 PathCount;
-+ NFO_LB_POLICY LbPolicy;
-+ UD_UI4 Reserved[8];
-+} NFO_DPG_PROP, *PNFO_DPG_PROP;
-+
-+typedef struct _NFO_DPG_PROP_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_DPG_PROP Entry[1];
-+} NFO_DPG_PROP_LIST, *PNFO_DPG_PROP_LIST;
-+
-+typedef struct _NFO_PATH_INFO
-+{
-+ NFO_SCSI_ADDR ScsiAddr;
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_64];
-+ UD_UI4 Status;
-+ UD_UI4 Flag;
-+ UD_UI4 RelTgtPortId;
-+ UD_UI4 TgtPortGrp;
-+ UD_UI4 Reserved[8];
-+ NFO_PROP_LIST PropList;
-+} NFO_PATH_INFO, *PNFO_PATH_INFO;
-+
-+typedef struct _NFO_IO_STAT
-+{
-+ UD_UI8 NoRead;
-+ UD_UI8 NoWrite;
-+ UD_UI8 MBRead;
-+ UD_UI8 MBWritten;
-+ UD_UI4 Reserved[8];
-+} NFO_IO_STAT, *PNFO_IO_STAT;
-+
-+typedef struct _NFO_PATH_STAT
-+{
-+ UD_UI8 NoFailover;
-+ UD_UI8 NoFailback;
-+ UD_UI4 Reserved[8];
-+} NFO_PATH_STAT, *PNFO_PATH_STAT;
-+
-+typedef struct _NFO_ER_STAT
-+{
-+ UD_UI8 NoReadRetry;
-+ UD_UI8 NoWriteRetry;
-+ UD_UI8 NoReadFailure;
-+ UD_UI8 NoWriteFailure;
-+ UD_UI8 NoFailover;
-+ UD_UI4 Reserved[8];
-+} NFO_ER_STAT, *PNFO_ER_STAT;
-+
-+typedef struct _NFO_ADP_STAT
-+{
-+ NFO_IO_STAT IoStat;
-+ NFO_ER_STAT ErStat;
-+ NFO_PATH_STAT PathStat;
-+ UD_UI4 Reserved[8];
-+} NFO_ADP_STAT, *PNFO_ADP_STAT;
-+
-+typedef struct _NFO_STORAGE
-+{
-+ UD_UI1 Name[NFO_DEF_STR_NAME_SIZE_32];
-+ UD_UI4 Type;
-+ UD_UI4 ControlFlag;
-+ UD_UI4 DefaultLB;
-+ UD_UI4 Reserved[8];
-+} NFO_STORAGE, *PNFO_STORAGE;
-+
-+
-+typedef struct _NFO_STORAGE_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_STORAGE SupportList[1];
-+} NFO_STORAGE_LIST, *PNFO_STORAGE_LIST;
-+
-+typedef struct _NFO_PATH
-+{
-+ UD_UI8 PathUid;
-+ UD_UI4 Fom;
-+ NFO_PATH_INFO PathInfo;
-+ UD_UI4 DPathStatus;
-+ UD_UI4 HbaInstance;
-+ UD_UI4 DpgInstance;
-+ UD_UI4 StorageInstance;
-+ NFO_HBA_INFO HbaInfo;
-+ NFO_DPG_PROP DpgProp;
-+ NFO_STORAGE Storage;
-+ UD_UI4 Reserved[8];
-+} NFO_PATH, *PNFO_PATH;
-+
-+typedef struct _NFO_PATH_INFO_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_PATH_INFO Entry[1];
-+} NFO_PATH_INFO_LIST, *PNFO_PATH_INFO_LIST;
-+
-+typedef struct _NFO_PATH_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_PATH Path[1];
-+} NFO_PATH_LIST, *PNFO_PATH_LIST;
-+
-+typedef struct _NFO_EVENT_CB_ENTRY
-+{
-+ UD_UI4 Id;
-+ NFO_EVENT_CB Callback;
-+ UD_UI4 Context;
-+ UD_UI4 Reserved[8];
-+} NFO_EVENT_CB_ENTRY, *PNFO_EVENT_CB_ENTRY;
-+
-+typedef struct _NFO_EVENT_CB_LIST
-+{
-+ UD_UI4 Size;
-+ UD_UI4 Count;
-+ NFO_EVENT_CB_ENTRY Entry[1];
-+} NFO_EVENT_CB_LIST, *PNFO_EVENT_CB_LIST;
-+
-+typedef struct _NFO_EVT_FOM
-+{
-+ UD_UI4 Instance;
-+ UD_H Handle;
-+ UD_UI8 Timestamp;
-+ UD_UI4 Reason;
-+ UD_UI4 Reserved[8];
-+} NFO_EVT_FOM, *PNFO_EVT_FOM;
-+
-+typedef struct _NFO_EVT_HBA
-+{
-+ UD_UI4 Instance;
-+ UD_H Handle;
-+ UD_UI8 Timestamp;
-+ UD_UI4 Reason;
-+ UD_UI4 Reserved[8];
-+} NFO_EVT_HBA, *PNFO_EVT_HBA;
-+
-+typedef struct _NFO_EVT_PATH
-+{
-+ UD_UI4 Instance;
-+ UD_H Handle;
-+ UD_UI8 Timestamp;
-+ UD_UI4 Reason;
-+ UD_UI4 Reserved[8];
-+} NFO_EVT_PATH, *PNFO_EVT_PATH;
-+
-+typedef struct _NFO_EVT_DEV
-+{
-+ UD_UI4 Instance;
-+ UD_H Handle;
-+ UD_UI8 Timestamp;
-+ UD_UI4 Reason;
-+ UD_UI4 Reserved[8];
-+} NFO_EVT_DEV, *PNFO_EVT_DEV;
-+
-+typedef struct _NFO_EVT
-+{
-+ UD_UI4 Code;
-+ union
-+ {
-+ NFO_EVT_FOM Fom;
-+ NFO_EVT_HBA HBA;
-+ NFO_EVT_PATH Path;
-+ NFO_EVT_DEV Dev;
-+ UD_UI4 Data[1];
-+ } Data;
-+} NFO_EVT, *PNFO_EVT;
-+
-+/*
-+ * ***********************************************************************
-+ * Function prototypes
-+ * ***********************************************************************
-+ */
-+UD_UI4 NfoGetApiInfo (PNFO_API_INFO pApiInfo);
-+UD_UI4 NfoGetFomCount (PUD_UI4 pFomCount);
-+UD_UI4 NfoOpenFom (UD_UI4 Instance, PUD_H pFomHandle);
-+UD_UI4 NfoCloseFom (UD_H FomHandle);
-+UD_UI4 NfoGetTransportInfo (UD_H FomHandle, UD_UI4 BufSize, PNFO_TRANSPORT_LIST pTransport);
-+UD_UI4 NfoGetFomProperty (UD_H FomHandle, PNFO_FOM_PROP pProp);
-+UD_UI4 NfoSetFomProperty (UD_H FomHandle, UD_UI4 BufSize, PNFO_PROP_LIST pPropList);
-+UD_UI4 NfoGetHbaInfo (UD_H FomHandle, UD_UI4 HbaInstance, PNFO_HBA_INFO pInfo);
-+UD_UI4 NfoGetHbaInfoAll (UD_H FomHandle, UD_UI4 HbaInstance, UD_UI4 BufSize, PNFO_HBA_INFO_LIST pHbaInfoList);
-+UD_UI4 NfoGetDpgProperty (UD_H FomHandle, UD_UI4 DpgInstance, PNFO_DPG_PROP pDpgProp);
-+UD_UI4 NfoGetDpgPropertyAll (UD_H FomHandle, UD_UI4 Instance, UD_UI4 BufSize, PNFO_DPG_PROP_LIST pDpgPropList);
-+UD_UI4 NfoGetDpgPathInfo (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo, PNFO_PATH_INFO pPathInfo);
-+UD_UI4 NfoGetDpgPathInfoAll (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 Instance, UD_UI4 BufSize, PNFO_PATH_INFO_LIST pPathInfoList);
-+UD_UI4 NfoSetDpgPathInfo (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo, PNFO_PATH_INFO pPathInfo);
-+UD_UI4 NfoSetDpgPathInfoAll (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 Instance, UD_UI4 BufSize, PNFO_PATH_INFO_LIST pPathInfoList);
-+UD_UI4 NfoGetLBInfo (UD_H FomHandle, UD_UI4 BufSize, PNFO_LB_POLICY_LIST pLb);
-+UD_UI4 NfoGetLBPolicy (UD_H FomHandle, UD_UI4 DpgInstance, PUD_UI4 pLbPolicy);
-+UD_UI4 NfoSetLBPolicy (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 LbPolicy);
-+UD_UI4 NfoGetDpgStatistics (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo, PNFO_ADP_STAT pAdpStat);
-+UD_UI4 NfoClearDpgErrStatistics (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo);
-+UD_UI4 NfoClearDpgIoStatistics (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo);
-+UD_UI4 NfoClearDpgFoStatistics (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo, PNFO_PATH_STAT pFoStat);
-+UD_UI4 NfoMovePath (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo);
-+UD_UI4 NfoVerifyPath (UD_H FomHandle, UD_UI4 DpgInstance, UD_UI4 PathNo);
-+UD_UI4 NfoGetEventList (UD_H FomHandle, UD_UI4 BufSize, PNFO_EVENT_CB_LIST pEventCbList);
-+UD_UI4 NfoRegisterEventCallback (UD_H FomHandle, UD_UI4 BufSize, PNFO_EVENT_CB_LIST pEventCbList);
-+UD_UI4 NfoDeregisterEventCallback (UD_H FomHandle, UD_UI4 BufSize, PNFO_EVENT_CB_LIST pEventCbList);
-+UD_UI4 NfoEnableFom (UD_H FomHandle);
-+UD_UI4 NfoDisableFom (UD_H FomHandle);
-+UD_UI4 NfoGetSupportedStorageList (UD_H FomHandle, UD_UI4 BufSize, PNFO_STORAGE_LIST pStorageList);
-+UD_UI4 NfoGetPathAll (UD_H FomHandle, UD_UI4 Index, UD_UI4 BufSize, PNFO_PATH_LIST pPathList);
-+
-+#if 0
-+/* Example tables */
-+/* Example transport protocol table */
-+NFO_TRANSPORT_LIST TransportTbl =
-+{
-+ sizeof(NFO_TRANSPORT) * NFO_TRANSPORT_NO_SUP + 1,
-+ NFO_TRANSPORT_NO_SUP + 1,
-+ { NFO_TRANSPORT_FC, "Fibre Channel" },
-+ { NFO_TRANSPORT_IS, "iScsi" },
-+ { NFO_TRANSPORT_UNKNWON, "Unknown" },
-+};
-+
-+/* Example property table */
-+NFO_PROP_LIST FomPropTbl =
-+{
-+ sizeof(NFO_PROP) * NFO_FOM_PROP_NO_SUP,
-+ NFO_FOM_PROP_NO_SUP,
-+ { 3, 1, 3, 10, "Io Retry Count" },
-+};
-+
-+/* Example path property table */
-+NFO_PROP_LIST FomPropTbl =
-+{
-+ sizeof(NFO_PROP) * NFO_PATH_PROP_NO_SUP,
-+ NFO_PATH_PROP_NO_SUP,
-+ { 1, 1, 1, 32, "Order" },
-+ { 1, 1, 1, 10, "Weight" },
-+};
-+
-+/* Example policy table for Active/Active model, can have one for each DPG */
-+NFO_LB_POLICY_LIST LbPolicyAATbl =
-+{
-+ sizeof(NFO_LB_POLICY) * 5,
-+ 5,
-+ { NFO_LB_FAILOVER_ONLY, "Failover only" },
-+ { NFO_LB_ROUND_ROBIN, "Round Robin" },
-+ { NFO_LB_DYN_LEAST_QUEUE_DEPTH, "IO Bandpass" },
-+ { NFO_LB_LEAST_BLOCKS, "MB Bandpass" },
-+ { NFO_LB_STATIC, "Static" },
-+};
-+#endif
-+
-+
-+#if defined(linux) /* Linux */
-+#include "qlnfoln.h"
-+#endif
-+
-+
-+#endif /* _QLNFO_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlnfoln.h ./drivers/scsi/qla4xxx/qlnfoln.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlnfoln.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlnfoln.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,92 @@
-+/*****************************************************************************
-+* QLOGIC LINUX SOFTWARE
-+*
-+* QLogic device driver for Linux 2.6.x+
-+* Copyright (C) 2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+****************************************************************************/
-+#ifndef _QLNFOLN_H_
-+#define _QLNFOLN_H_
-+
-+/********************************************************
-+ * NextGen Failover ioctl command codes range from 0x37
-+ * to 0x4f. See qlnfoln.h
-+ ********************************************************/
-+#define EXT_DEF_NFO_CC_START_IDX 0x37 /* NFO cmd start index */
-+
-+#define EXT_CC_TRANSPORT_INFO \
-+ QL_IOCTL_CMD(0x37)
-+#define EXT_CC_GET_FOM_PROP \
-+ QL_IOCTL_CMD(0x38)
-+#define EXT_CC_GET_HBA_INFO \
-+ QL_IOCTL_CMD(0x39)
-+#define EXT_CC_GET_DPG_PROP \
-+ QL_IOCTL_CMD(0x3a)
-+#define EXT_CC_GET_DPG_PATH_INFO \
-+ QL_IOCTL_CMD(0x3b)
-+#define EXT_CC_SET_DPG_PATH_INFO \
-+ QL_IOCTL_CMD(0x3c)
-+#define EXT_CC_GET_LB_INFO \
-+ QL_IOCTL_CMD(0x3d)
-+#define EXT_CC_GET_LB_POLICY \
-+ QL_IOCTL_CMD(0x3e)
-+#define EXT_CC_SET_LB_POLICY \
-+ QL_IOCTL_CMD(0x3f)
-+#define EXT_CC_GET_DPG_STATS \
-+ QL_IOCTL_CMD(0x40)
-+#define EXT_CC_CLEAR_DPG_ERR_STATS \
-+ QL_IOCTL_CMD(0x41)
-+#define EXT_CC_CLEAR_DPG_IO_STATS \
-+ QL_IOCTL_CMD(0x42)
-+#define EXT_CC_CLEAR_DPG_FO_STATS \
-+ QL_IOCTL_CMD(0x43)
-+#define EXT_CC_GET_PATHS_FOR_ALL \
-+ QL_IOCTL_CMD(0x44)
-+#define EXT_CC_MOVE_PATH \
-+ QL_IOCTL_CMD(0x45)
-+#define EXT_CC_VERIFY_PATH \
-+ QL_IOCTL_CMD(0x46)
-+#define EXT_CC_GET_EVENT_LIST \
-+ QL_IOCTL_CMD(0x47)
-+#define EXT_CC_ENABLE_FOM \
-+ QL_IOCTL_CMD(0x48)
-+#define EXT_CC_DISABLE_FOM \
-+ QL_IOCTL_CMD(0x49)
-+#define EXT_CC_GET_STORAGE_LIST \
-+ QL_IOCTL_CMD(0x4a)
-+
-+#define EXT_DEF_NFO_CC_END_IDX 0x4a /* NFO cmd end index */
-+
-+
-+typedef struct _EXT_IOCTL_NFO {
-+ UINT8 Signature[NFO_DEF_SIGNATURE_SIZE]; /* 8 */
-+ UINT16 AddrMode; /* 2 */
-+ UINT16 Version; /* 2 */
-+ UINT16 SubCode; /* 2 */
-+ UINT16 Instance; /* 2 */
-+ UINT32 Status; /* 4 */
-+ UINT32 DetailStatus; /* 4 */
-+ UINT32 Reserved1; /* 4 */
-+ UINT32 RequestLen; /* 4 */
-+ UINT32 ResponseLen; /* 4 */
-+ UINT64 RequestAdr; /* 8 */
-+ UINT64 ResponseAdr; /* 8 */
-+ UINT16 HbaSelect; /* 2 */
-+ UINT32 VendorSpecificStatus[11]; /* 44 */
-+ UINT8 VendorSpecificData[8]; /* 8 */
-+ UINT32 Reserved2[8]; /* 32 */
-+} EXT_IOCTL_NFO, *PEXT_IOCTL_NFO; /* 138 */
-+
-+
-+#endif /* _QLNFOLN_H_ */
-+
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/qlud.h ./drivers/scsi/qla4xxx/qlud.h
---- ./drivers/scsi/qla4xxx.qla4xxx/qlud.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/qlud.h 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,95 @@
-+/******************************************************************************
-+ * QLOGIC LINUX SOFTWARE
-+ *
-+ * QLogic ISP4xxx device driver for Linux 2.6.x
-+ * Copyright (C) 2004 QLogic Corporation
-+ * (www.qlogic.com)
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2, or (at your option) any
-+ * later version.
-+ *
-+ * This program is distributed in the hope that it will be useful, but
-+ * WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ ******************************************************************************/
-+/*
-+ * File Name: qlud.h
-+ *
-+ * Revision History:
-+ *
-+ */
-+
-+#ifndef _QLUD_H
-+#define _QLUD_H
-+
-+/*
-+ * NOTE: the following version defines must be updated each time the
-+ * changes made may affect the backward compatibility of the
-+ * input/output relations
-+ */
-+#define UD_VERSION 1
-+#define UD_VERSION_STR "1.0"
-+
-+/*
-+ * ***********************************************************************
-+ * Data type definitions
-+ * ***********************************************************************
-+ */
-+#ifdef _MSC_VER
-+
-+#define UD_BOOL BOOLEAN
-+#define UD_UI1 UCHAR
-+#define UD_UI2 USHORT
-+#define UD_UI4 ULONG
-+#define UD_UI8 ULONGLONG
-+#define UD_I1 CHAR
-+#define UD_I2 SHORT
-+#define UD_I4 LONG
-+#define UD_I8 LONGLONG
-+#define UD_V VOID
-+#define UD_PV PVOID
-+#define PUD_UI1 PUCHAR
-+#define PUD_UI2 PUSHORT
-+#define PUD_UI4 PULONG
-+#define PUD_I1 PCHAR
-+#define PUD_I2 PSHORT
-+#define PUD_I4 PLONG
-+#define UD_H PVOID
-+
-+#define PUD_H UD_H*
-+
-+#elif defined(linux) /* Linux */
-+
-+#ifdef APILIB
-+#include <stdint.h>
-+#endif
-+
-+#define UD_BOOL uint8_t
-+#define UD_UI1 uint8_t
-+#define UD_UI2 uint16_t
-+#define UD_UI4 uint32_t
-+#define UD_UI8 uint64_t
-+#define UD_I1 int8_t
-+#define UD_I2 int16_t
-+#define UD_I4 int32_t
-+#define UD_I8 int64_t
-+#define UD_V void
-+#define UD_PV void *
-+#define PUD_UI1 uint8_t *
-+#define PUD_UI2 uint16_t *
-+#define PUD_UI4 uint32_t *
-+#define PUD_I1 int8_t *
-+#define PUD_I2 int16_t *
-+#define PUD_I4 int32_t *
-+#define UD_H int
-+#define PUD_H int *
-+
-+#elif defined(sun) || defined(__sun) /* Solaris */
-+
-+#endif
-+
-+#endif /* _QLUD_H */
-diff -Nurap ./drivers/scsi/qla4xxx.qla4xxx/revision.notes ./drivers/scsi/qla4xxx/revision.notes
---- ./drivers/scsi/qla4xxx.qla4xxx/revision.notes 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla4xxx/revision.notes 2006-08-31 14:59:53.000000000 +0400
-@@ -0,0 +1,32 @@
-+/*************************************************
-+ * QLogic ISP4010 Linux Driver Revision List File.
-+ *
-+ **************************************************
-+ *
-+ * Revision History
-+ *
-+ * Rev 5.00.02 DG
-+ * - Released.
-+ *
-+ * Rev 5.00.02b8 KH
-+ * - Added secure i/o fix.
-+ *
-+ * Rev 5.00.02b7 KH & DG
-+ * - Fixed adapter recover logic
-+ *
-+ * Rev 5.00.02b6 KH & DG
-+ * - Fixed 64-bit compilation warning
-+ * - Fixed ioctl passthur code to create lun when it doesn't exists.
-+ * - Fixed removal of "qla4xxx_conf" in build.sh
-+ * - Fixed deadlock in reset_lun
-+ *
-+ * Rev 5.00.02b5 KH
-+ * - Fixed issue enabling ISNS after obtaining ip address via DHCP.
-+ *
-+ * Rev 5.00.02b4 DG & KH
-+ *
-+ * - Change port_down_timer 60 secs to the KeepALive timer from init_cb.
-+ * - Added new build procdure for all archs.
-+ * - Fixed issues related to 64bit support and endiness support in the isns
-+ * code.
-+ *
diff --git a/openvz-sources/023.030/5130_linux-2.6.9-arcmsr-1.20.0X.12.patch b/openvz-sources/023.030/5130_linux-2.6.9-arcmsr-1.20.0X.12.patch
deleted file mode 100644
index cc05444..0000000
--- a/openvz-sources/023.030/5130_linux-2.6.9-arcmsr-1.20.0X.12.patch
+++ /dev/null
@@ -1,8019 +0,0 @@
---- ./drivers/scsi/Kconfig.arcmsr 2006-09-08 11:36:42.000000000 +0400
-+++ ./drivers/scsi/Kconfig 2006-09-08 11:37:36.000000000 +0400
-@@ -675,6 +675,17 @@ config SCSI_LPFC
- This lpfc driver supports the Emulex LightPulse
- family of Fibre Channel PCI host adapters.
-
-+config SCSI_ARCMSR
-+ tristate "ARECA (ARC1110/1120/1130/1160/1210/1220/1230/1260) SATA RAID HOST Controller"
-+ depends on PCI && SCSI
-+ help
-+ This driver supports all of ARECA's SATA RAID controllers cards.
-+ This is an ARECA maintained driver by Erich Chen.
-+ <If you have any problems, please mail to: erich@areca.com.tw>.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called arcmsr (modprobe arcmsr).
-+
- config SCSI_FUTURE_DOMAIN
- tristate "Future Domain 16xx SCSI/AHA-2920A support"
- depends on (ISA || PCI) && SCSI
---- ./drivers/scsi/Makefile.arcmsr 2006-09-08 11:37:47.000000000 +0400
-+++ ./drivers/scsi/Makefile 2006-09-08 11:38:28.000000000 +0400
-@@ -142,6 +142,7 @@ obj-$(CONFIG_SCSI_SATA_ULI) += libata.o
- obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o
- obj-$(CONFIG_SCSI_PDC_ADMA) += libata.o pdc_adma.o
- obj-$(CONFIG_SCSI_LPFC) += lpfc/
-+obj-$(CONFIG_SCSI_ARCMSR) += arcmsr/
-
- obj-$(CONFIG_ARM) += arm/
-
-diff -Nurap ./drivers/scsi/arcmsr.arcmsr/Makefile ./drivers/scsi/arcmsr/Makefile
---- ./drivers/scsi/arcmsr.arcmsr/Makefile 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/arcmsr/Makefile 2006-08-31 14:59:54.000000000 +0400
-@@ -0,0 +1,8 @@
-+# File: drivers/arcmsr/Makefile
-+# Makefile for the ARECA PCI-X PCI-EXPRESS SATA RAID controllers SCSI driver.
-+
-+obj-$(CONFIG_SCSI_ARCMSR) := arcmsr.o
-+
-+EXTRA_CFLAGS += -I.
-+
-+
-diff -Nurap ./drivers/scsi/arcmsr.arcmsr/arcmsr.c ./drivers/scsi/arcmsr/arcmsr.c
---- ./drivers/scsi/arcmsr.arcmsr/arcmsr.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/arcmsr/arcmsr.c 2006-08-31 14:59:54.000000000 +0400
-@@ -0,0 +1,2970 @@
-+/*
-+******************************************************************************************
-+** O.S : Linux
-+** FILE NAME : arcmsr.c
-+** BY : Erich Chen
-+** Description: SCSI RAID Device Driver for
-+** ARCMSR RAID Host adapter
-+************************************************************************
-+** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved.
-+**
-+** Web site: www.areca.com.tw
-+** E-mail: erich@areca.com.tw
-+**
-+** This program is free software; you can redistribute it and/or modify
-+** it under the terms of the GNU General Public License version 2 as
-+** published by the Free Software Foundation.
-+** This program is distributed in the hope that it will be useful,
-+** but WITHOUT ANY WARRANTY; without even the implied warranty of
-+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+** GNU General Public License for more details.
-+************************************************************************
-+** Redistribution and use in source and binary forms,with or without
-+** modification,are permitted provided that the following conditions
-+** are met:
-+** 1. Redistributions of source code must retain the above copyright
-+** notice,this list of conditions and the following disclaimer.
-+** 2. Redistributions in binary form must reproduce the above copyright
-+** notice,this list of conditions and the following disclaimer in the
-+** documentation and/or other materials provided with the distribution.
-+** 3. The name of the author may not be used to endorse or promote products
-+** derived from this software without specific prior written permission.
-+**
-+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-+** IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,THE IMPLIED WARRANTIES
-+** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,INDIRECT,
-+** INCIDENTAL,SPECIAL,EXEMPLARY,OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT
-+** NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+** DATA,OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
-+** THEORY OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
-+**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
-+** THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+**************************************************************************
-+** History
-+**
-+** REV# DATE NAME DESCRIPTION
-+** 1.00.00.00 3/31/2004 Erich Chen First release
-+** 1.10.00.04 7/28/2004 Erich Chen modify for ioctl
-+** 1.10.00.06 8/28/2004 Erich Chen modify for 2.6.x
-+** 1.10.00.08 9/28/2004 Erich Chen modify for x86_64
-+** 1.10.00.10 10/10/2004 Erich Chen bug fix for SMP & ioctl
-+** 1.20.00.00 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error
-+** 1.20.00.02 12/09/2004 Erich Chen bug fix with over 2T bytes RAID Volume
-+** 1.20.00.04 1/09/2005 Erich Chen fits for Debian linux kernel version 2.2.xx
-+** 1.20.0X.07 3/28/2005 Erich Chen sync for 1.20.00.07 (linux.org version)
-+** remove some unused function
-+** --.--.0X.-- is for old style kernel compatibility
-+** 1.20.0X.08 6/23/2005 Erich Chen bug fix with abort command,in case of heavy loading when sata cable
-+** working on low quality connection
-+** 1.20.0X.09 9/12/2005 Erich Chen bug fix with abort command handling,and firmware version check
-+** and firmware update notify for hardware bug fix
-+** 1.20.0X.10 9/23/2005 Erich Chen enhance sysfs function for change driver's max tag Q number.
-+** add DMA_64BIT_MASK for backward compatible with all 2.6.x
-+** add some useful message for abort command
-+** add ioctl code 'ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE'
-+** customer can send this command for sync raid volume data
-+** 1.20.0X.11 9/29/2005 Erich Chen by comment of Arjan van de Ven fix incorrect msleep redefine
-+** cast off sizeof(dma_addr_t) condition for 64bit pci_set_dma_mask
-+** 1.20.0X.12 9/30/2005 Erich Chen bug fix with 64bit platform's ccbs using if over 4G system memory
-+** change 64bit pci_set_consistent_dma_mask into 32bit
-+** increcct adapter count if adapter initialize fail.
-+** miss edit at arcmsr_build_ccb....
-+** psge += sizeof(struct _SG64ENTRY *) => psge += sizeof(struct _SG64ENTRY)
-+** 64 bits sg entry would be incorrectly calculated
-+** thanks Kornel Wieliczek give me kindly notify and detail description
-+******************************************************************************************
-+*/
-+#define ARCMSR_DEBUG 0
-+/************************************/
-+#if defined __KERNEL__
-+ #include <linux/config.h>
-+ #if defined( CONFIG_MODVERSIONS ) && ! defined( MODVERSIONS )
-+ #define MODVERSIONS
-+ #endif
-+ /* modversions.h should be before should be before module.h */
-+ #if defined( MODVERSIONS )
-+ #include <config/modversions.h>
-+ #endif
-+ #include <linux/module.h>
-+ #include <linux/version.h>
-+ /* Now your module include files & source code follows */
-+ #include <asm/dma.h>
-+ #include <asm/io.h>
-+ #include <asm/system.h>
-+ #include <asm/uaccess.h>
-+ #include <linux/delay.h>
-+ #include <linux/signal.h>
-+ #include <linux/errno.h>
-+ #include <linux/kernel.h>
-+ #include <linux/ioport.h>
-+ #include <linux/pci.h>
-+ #include <linux/proc_fs.h>
-+ #include <linux/string.h>
-+ #include <linux/ctype.h>
-+ #include <linux/interrupt.h>
-+ #include <linux/smp_lock.h>
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,5,0)
-+ #include <linux/moduleparam.h>
-+ #include <linux/blkdev.h>
-+ #else
-+ #include <linux/blk.h>
-+ #endif
-+ #include <linux/timer.h>
-+ #include <linux/devfs_fs_kernel.h>
-+ #include <linux/reboot.h>
-+ #include <linux/notifier.h>
-+ #include <linux/sched.h>
-+ #include <linux/init.h>
-+
-+ # if LINUX_VERSION_CODE >=KERNEL_VERSION(2,3,30)
-+ # include <linux/spinlock.h>
-+ # else
-+ # include <asm/spinlock.h>
-+ # endif /* 2,3,30 */
-+
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,5,0)
-+ #include <scsi/scsi.h>
-+ #include <scsi/scsi_host.h>
-+ #include <scsi/scsi_cmnd.h>
-+ #include <scsi/scsi_tcq.h>
-+ #include <scsi/scsi_device.h>
-+ #else
-+ #include "/usr/src/linux/drivers/scsi/scsi.h"
-+ #include "/usr/src/linux/drivers/scsi/hosts.h"
-+ #include "/usr/src/linux/drivers/scsi/constants.h"
-+ #include "/usr/src/linux/drivers/scsi/sd.h"
-+ #endif
-+ #include "arcmsr.h"
-+#endif
-+
-+MODULE_AUTHOR("Erich Chen <erich@areca.com.tw>");
-+MODULE_DESCRIPTION("ARECA (ARC11xx/12xx) SATA RAID HOST Adapter");
-+
-+#ifdef MODULE_LICENSE
-+MODULE_LICENSE("Dual BSD/GPL");
-+#endif
-+
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+static u_int8_t arcmsr_adapterCnt=0;
-+static struct _HCBARC arcmsr_host_control_block;
-+/*
-+**********************************************************************************
-+** notifier block to get a notify on system shutdown/halt/reboot
-+**********************************************************************************
-+*/
-+static int arcmsr_fops_ioctl(struct inode *inode, struct file *filep, unsigned int ioctl_cmd, unsigned long arg);
-+static int arcmsr_fops_close(struct inode *inode, struct file *filep);
-+static int arcmsr_fops_open(struct inode *inode, struct file *filep);
-+static int arcmsr_halt_notify(struct notifier_block *nb,unsigned long event,void *buf);
-+static int arcmsr_initialize(struct _ACB *pACB,struct pci_dev *pPCI_DEV);
-+static int arcmsr_iop_ioctlcmd(struct _ACB *pACB,int ioctl_cmd,void *arg);
-+static void arcmsr_free_pci_pool(struct _ACB *pACB);
-+static void arcmsr_pcidev_disattach(struct _ACB *pACB);
-+static void arcmsr_iop_init(struct _ACB *pACB);
-+static u_int8_t arcmsr_wait_msgint_ready(struct _ACB *pACB);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ #define arcmsr_detect NULL
-+ static irqreturn_t arcmsr_interrupt(struct _ACB *pACB);
-+ static int __devinit arcmsr_device_probe(struct pci_dev *pPCI_DEV,const struct pci_device_id *id);
-+ static void arcmsr_device_remove(struct pci_dev *pPCI_DEV);
-+#else
-+ static void arcmsr_interrupt(struct _ACB *pACB);
-+ int arcmsr_schedule_command(struct scsi_cmnd *pcmd);
-+ int arcmsr_detect(Scsi_Host_Template *);
-+#endif
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+static struct notifier_block arcmsr_event_notifier={arcmsr_halt_notify,NULL,0};
-+static struct file_operations arcmsr_file_operations =
-+{
-+ ioctl: arcmsr_fops_ioctl,
-+ open: arcmsr_fops_open,
-+ release: arcmsr_fops_close
-+};
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30)
-+ struct proc_dir_entry arcmsr_proc_scsi=
-+ {
-+ PROC_SCSI_ARCMSR,
-+ 8,
-+ "arcmsr",
-+ S_IFDIR | S_IRUGO | S_IXUGO,
-+ 2
-+ };
-+#endif
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ /* We do our own ID filtering. So, grab all SCSI storage class devices. */
-+ static struct pci_device_id arcmsr_device_id_table[] =
-+ {
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1110, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1120, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1130, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1160, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1170, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1210, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1220, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1230, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1260, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {.vendor=PCIVendorIDARECA, .device=PCIDeviceIDARC1270, .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,},
-+ {0, 0}, /* Terminating entry */
-+ };
-+ MODULE_DEVICE_TABLE(pci, arcmsr_device_id_table);
-+ struct pci_driver arcmsr_pci_driver =
-+ {
-+ .name = "arcmsr",
-+ .id_table = arcmsr_device_id_table,
-+ .probe = arcmsr_device_probe,
-+ .remove = arcmsr_device_remove,
-+ };
-+ /*
-+ *********************************************************************
-+ *********************************************************************
-+ */
-+ static irqreturn_t arcmsr_do_interrupt(int irq,void *dev_id,struct pt_regs *regs)
-+ {
-+ irqreturn_t handle_state;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ struct _ACB *pACB;
-+ struct _ACB *pACBtmp;
-+ int i=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_do_interrupt.................. \n");
-+ #endif
-+
-+ pACB=(struct _ACB *)dev_id;
-+ pACBtmp=pHCBARC->pACB[i];
-+ while((pACB != pACBtmp) && pACBtmp && (i <ARCMSR_MAX_ADAPTER) )
-+ {
-+ i++;
-+ pACBtmp=pHCBARC->pACB[i];
-+ }
-+ if(!pACBtmp)
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_do_interrupt: Invalid pACB=0x%p \n",pACB);
-+ #endif
-+ return IRQ_NONE;
-+ }
-+ spin_lock_irq(&pACB->isr_lockunlock);
-+ handle_state=arcmsr_interrupt(pACB);
-+ spin_unlock_irq(&pACB->isr_lockunlock);
-+ return(handle_state);
-+ }
-+ /*
-+ *********************************************************************
-+ *********************************************************************
-+ */
-+ int arcmsr_bios_param(struct scsi_device *sdev, struct block_device *bdev,sector_t capacity, int *geom)
-+ {
-+ int heads,sectors,cylinders,total_capacity;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_bios_param.................. \n");
-+ #endif
-+ total_capacity=capacity;
-+ heads=64;
-+ sectors=32;
-+ cylinders=total_capacity / (heads * sectors);
-+ if(cylinders > 1024)
-+ {
-+ heads=255;
-+ sectors=63;
-+ cylinders=total_capacity / (heads * sectors);
-+ }
-+ geom[0]=heads;
-+ geom[1]=sectors;
-+ geom[2]=cylinders;
-+ return (0);
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ static int __devinit arcmsr_device_probe(struct pci_dev *pPCI_DEV,const struct pci_device_id *id)
-+ {
-+ struct Scsi_Host *host;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ uint8_t bus,dev_fun;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_device_probe............................\n");
-+ #endif
-+ if(pci_enable_device(pPCI_DEV))
-+ {
-+ printk("arcmsr%d adapter probe: pci_enable_device error \n",arcmsr_adapterCnt);
-+ return -ENODEV;
-+ }
-+ /* allocate scsi host information (includes out adapter) scsi_host_alloc==scsi_register */
-+ if((host=scsi_host_alloc(&arcmsr_scsi_host_template,sizeof(struct _ACB)))==0)
-+ {
-+ printk("arcmsr%d adapter probe: scsi_host_alloc error \n",arcmsr_adapterCnt);
-+ return -ENODEV;
-+ }
-+ if(!pci_set_dma_mask(pPCI_DEV, DMA_64BIT_MASK))
-+ {
-+ printk("ARECA RAID ADAPTER%d: 64BITS PCI BUS DMA ADDRESSING SUPPORTED\n",arcmsr_adapterCnt);
-+ }
-+ else if(!pci_set_dma_mask(pPCI_DEV, DMA_32BIT_MASK))
-+ {
-+ printk("ARECA RAID ADAPTER%d: 32BITS PCI BUS DMA ADDRESSING SUPPORTED\n",arcmsr_adapterCnt);
-+ }
-+ else
-+ {
-+ printk("ARECA RAID ADAPTER%d: No suitable DMA available.\n",arcmsr_adapterCnt);
-+ return -ENOMEM;
-+ }
-+ if (pci_set_consistent_dma_mask(pPCI_DEV, DMA_32BIT_MASK))
-+ {
-+ printk("ARECA RAID ADAPTER%d: No 32BIT coherent DMA adressing available.\n",arcmsr_adapterCnt);
-+ return -ENOMEM;
-+ }
-+ bus = pPCI_DEV->bus->number;
-+ dev_fun = pPCI_DEV->devfn;
-+ pACB=(struct _ACB *) host->hostdata;
-+ memset(pACB,0,sizeof(struct _ACB));
-+ spin_lock_init(&pACB->isr_lockunlock);
-+ spin_lock_init(&pACB->wait2go_lockunlock);
-+ spin_lock_init(&pACB->qbuffer_lockunlock);
-+ spin_lock_init(&pACB->ccb_doneindex_lockunlock);
-+ spin_lock_init(&pACB->ccb_startindex_lockunlock);
-+ pACB->pPCI_DEV=pPCI_DEV;
-+ pACB->host=host;
-+ host->max_sectors=ARCMSR_MAX_XFER_SECTORS;
-+ host->max_lun=ARCMSR_MAX_TARGETLUN;
-+ host->max_id=ARCMSR_MAX_TARGETID;/*16:8*/
-+ host->max_cmd_len=16; /*this is issue of 64bit LBA ,over 2T byte*/
-+ host->sg_tablesize=ARCMSR_MAX_SG_ENTRIES;
-+ host->can_queue=ARCMSR_MAX_OUTSTANDING_CMD; /* max simultaneous cmds */
-+ host->cmd_per_lun=ARCMSR_MAX_CMD_PERLUN;
-+ host->this_id=ARCMSR_SCSI_INITIATOR_ID;
-+ host->unique_id=(bus << 8) | dev_fun;
-+ host->io_port=0;
-+ host->n_io_port=0;
-+ host->irq=pPCI_DEV->irq;
-+ pci_set_master(pPCI_DEV);
-+ if(arcmsr_initialize(pACB,pPCI_DEV))
-+ {
-+ printk("arcmsr%d initialize got error \n",arcmsr_adapterCnt);
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ pHCBARC->pACB[arcmsr_adapterCnt]=NULL;
-+ scsi_host_put(host);
-+ return -ENODEV;
-+ }
-+ if (pci_request_regions(pPCI_DEV, "arcmsr"))
-+ {
-+ printk("arcmsr%d adapter probe: pci_request_regions failed \n",arcmsr_adapterCnt--);
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ arcmsr_pcidev_disattach(pACB);
-+ scsi_host_put(host);
-+ return -ENODEV;
-+ }
-+ if(request_irq(pPCI_DEV->irq,arcmsr_do_interrupt,SA_INTERRUPT | SA_SHIRQ,"arcmsr",pACB))
-+ {
-+ printk("arcmsr%d request IRQ=%d failed !\n",arcmsr_adapterCnt--,pPCI_DEV->irq);
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ arcmsr_pcidev_disattach(pACB);
-+ scsi_host_put(host);
-+ return -ENODEV;
-+ }
-+ arcmsr_iop_init(pACB);
-+ if(scsi_add_host(host, &pPCI_DEV->dev))
-+ {
-+ printk("arcmsr%d scsi_add_host got error \n",arcmsr_adapterCnt--);
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ arcmsr_pcidev_disattach(pACB);
-+ scsi_host_put(host);
-+ return -ENODEV;
-+ }
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ pci_set_drvdata(pPCI_DEV, host);
-+ scsi_scan_host(host);
-+ return 0;
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ static void arcmsr_device_remove(struct pci_dev *pPCI_DEV)
-+ {
-+ struct Scsi_Host *host=pci_get_drvdata(pPCI_DEV);
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ struct _ACB *pACB=(struct _ACB *) host->hostdata;
-+ int i;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_device_remove............................\n");
-+ #endif
-+ /* Flush cache to disk */
-+ /* Free irq,otherwise extra interrupt is generated */
-+ /* Issue a blocking(interrupts disabled) command to the card */
-+ arcmsr_pcidev_disattach(pACB);
-+ scsi_remove_host(host);
-+ scsi_host_put(host);
-+ pci_set_drvdata(pPCI_DEV, NULL);
-+ /*if this is last pACB */
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if(pHCBARC->pACB[i]!=NULL)
-+ {
-+ return;/* this is not last adapter's release */
-+ }
-+ }
-+ unregister_chrdev(pHCBARC->arcmsr_major_number, "arcmsr");
-+ unregister_reboot_notifier(&arcmsr_event_notifier);
-+ return;
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ static int arcmsr_scsi_host_template_init(struct scsi_host_template * host_template)
-+ {
-+ int error;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_scsi_host_template_init..............\n");
-+ #endif
-+ /*
-+ ** register as a PCI hot-plug driver module
-+ */
-+ memset(pHCBARC,0,sizeof(struct _HCBARC));
-+ error=pci_module_init(&arcmsr_pci_driver);
-+ if(pHCBARC->pACB[0]!=NULL)
-+ {
-+ host_template->proc_name="arcmsr";
-+ register_reboot_notifier(&arcmsr_event_notifier);
-+ pHCBARC->arcmsr_major_number=register_chrdev(0, "arcmsr", &arcmsr_file_operations);
-+ printk("arcmsr device major number %d \n",pHCBARC->arcmsr_major_number);
-+ }
-+ return(error);
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ static int arcmsr_module_init(void)
-+ {
-+ return (arcmsr_scsi_host_template_init(&arcmsr_scsi_host_template));
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ static void arcmsr_module_exit(void)
-+ {
-+ pci_unregister_driver(&arcmsr_pci_driver);
-+ return;
-+ }
-+ module_init(arcmsr_module_init);
-+ module_exit(arcmsr_module_exit);
-+#else
-+
-+ /*
-+ *************************************************************************
-+ *************************************************************************
-+ */
-+ static void arcmsr_internal_done(struct scsi_cmnd *pcmd)
-+ {
-+ pcmd->SCp.Status++;
-+ return;
-+ }
-+ /*
-+ ***************************************************************
-+ * arcmsr_schedule_command
-+ * Description: Process a command from the SCSI manager(A.P)
-+ * Parameters: cmd - Pointer to SCSI command structure.
-+ * Returns: Status code.
-+ ***************************************************************
-+ */
-+ int arcmsr_schedule_command(struct scsi_cmnd *pcmd)
-+ {
-+ unsigned long timeout;
-+ #if ARCMSR_DEBUG
-+ printk(" arcmsr_schedule_command................ \n");
-+ #endif
-+ pcmd->SCp.Status=0;
-+ arcmsr_queue_command(pcmd,arcmsr_internal_done);
-+ timeout=jiffies + 60 * HZ;
-+ while(time_before(jiffies,timeout) && !pcmd->SCp.Status)
-+ {
-+ schedule();
-+ }
-+ if(!pcmd->SCp.Status)
-+ {
-+ pcmd->result=(DID_ERROR<<16);
-+ }
-+ return pcmd->result;
-+ }
-+ /*
-+ *********************************************************************
-+ *********************************************************************
-+ */
-+ void arcmsr_do_interrupt(int irq,void *dev_id,struct pt_regs *regs)
-+ {
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ struct _ACB *pACB;
-+ struct _ACB *pACBtmp;
-+ int i=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_do_interrupt.................. \n");
-+ #endif
-+ pACB=(struct _ACB *)dev_id;
-+ pACBtmp=pHCBARC->pACB[i];
-+ while((pACB != pACBtmp) && pACBtmp && (i <ARCMSR_MAX_ADAPTER) )
-+ {
-+ i++;
-+ pACBtmp=pHCBARC->pACB[i];
-+ }
-+ if(!pACBtmp)
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_do_interrupt: Invalid pACB=0x%p \n",pACB);
-+ #endif
-+ return;
-+ }
-+ spin_lock_irq(&pACB->isr_lockunlock);
-+ arcmsr_interrupt(pACB);
-+ spin_unlock_irq(&pACB->isr_lockunlock);
-+ return;
-+ }
-+ /*
-+ *********************************************************************
-+ *********************************************************************
-+ */
-+ int arcmsr_bios_param(Disk *disk,kdev_t dev,int geom[])
-+ {
-+ int heads,sectors,cylinders,total_capacity;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_bios_param.................. \n");
-+ #endif
-+ total_capacity=disk->capacity;
-+ heads=64;
-+ sectors=32;
-+ cylinders=total_capacity / (heads * sectors);
-+ if(cylinders > 1024)
-+ {
-+ heads=255;
-+ sectors=63;
-+ cylinders=total_capacity / (heads * sectors);
-+ }
-+ geom[0]=heads;
-+ geom[1]=sectors;
-+ geom[2]=cylinders;
-+ return (0);
-+ }
-+ /*
-+ ************************************************************************
-+ ************************************************************************
-+ */
-+ int arcmsr_detect(Scsi_Host_Template * host_template)
-+ {
-+ struct
-+ {
-+ unsigned int vendor_id;
-+ unsigned int device_id;
-+ } const arcmsr_devices[]={
-+ { PCIVendorIDARECA,PCIDeviceIDARC1110 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1120 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1130 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1160 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1170 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1210 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1220 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1230 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1260 }
-+ ,{ PCIVendorIDARECA,PCIDeviceIDARC1270 }
-+ };
-+ struct pci_dev *pPCI_DEV=NULL;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ struct Scsi_Host *host;
-+ static u_int8_t i;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_detect............................\n");
-+ #endif
-+ memset(pHCBARC,0,sizeof(struct _HCBARC));
-+ for(i=0; i < (sizeof(arcmsr_devices)/sizeof(arcmsr_devices[0])) ; ++i)
-+ {
-+ pPCI_DEV=NULL;
-+ while((pPCI_DEV=pci_find_device(arcmsr_devices[i].vendor_id,arcmsr_devices[i].device_id,pPCI_DEV)))
-+ {
-+ if((host=scsi_register(host_template,sizeof(struct _ACB)))==0)
-+ {
-+ printk("arcmsr_detect: scsi_register error . . . . . . . . . . .\n");
-+ continue;
-+ }
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ {
-+ if(pci_enable_device(pPCI_DEV))
-+ {
-+ printk("arcmsr_detect: pci_enable_device ERROR..................................\n");
-+ scsi_unregister(host);
-+ continue;
-+ }
-+ if(!pci_set_dma_mask(pPCI_DEV,(dma_addr_t)0xffffffffffffffffULL))/*64bit*/
-+ {
-+ printk("ARECA RAID: 64BITS PCI BUS DMA ADDRESSING SUPPORTED\n");
-+ }
-+ else if(pci_set_dma_mask(pPCI_DEV,(dma_addr_t)0x00000000ffffffffULL))/*32bit*/
-+ {
-+ printk("ARECA RAID: 32BITS PCI BUS DMA ADDRESSING NOT SUPPORTED (ERROR)\n");
-+ scsi_unregister(host);
-+ continue;
-+ }
-+ }
-+ #endif
-+ pACB=(struct _ACB *) host->hostdata;
-+ memset(pACB,0,sizeof(struct _ACB));
-+ spin_lock_init(&pACB->isr_lockunlock);
-+ spin_lock_init(&pACB->wait2go_lockunlock);
-+ spin_lock_init(&pACB->qbuffer_lockunlock);
-+ spin_lock_init(&pACB->ccb_doneindex_lockunlock);
-+ spin_lock_init(&pACB->ccb_startindex_lockunlock);
-+ pACB->pPCI_DEV=pPCI_DEV;
-+ pACB->host=host;
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
-+ host->max_sectors=ARCMSR_MAX_XFER_SECTORS;
-+ #endif
-+ host->max_lun=ARCMSR_MAX_TARGETLUN;
-+ host->max_id=ARCMSR_MAX_TARGETID;/*16:8*/
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ host->max_cmd_len=16; /*this is issue of 64bit LBA ,over 2T byte*/
-+ #endif
-+ host->sg_tablesize=ARCMSR_MAX_SG_ENTRIES;
-+ host->can_queue=ARCMSR_MAX_OUTSTANDING_CMD; /* max simultaneous cmds */
-+ host->cmd_per_lun=ARCMSR_MAX_CMD_PERLUN;
-+ host->this_id=ARCMSR_SCSI_INITIATOR_ID;
-+ host->io_port=0;
-+ host->n_io_port=0;
-+ host->irq=pPCI_DEV->irq;
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
-+ scsi_set_pci_device(host,pPCI_DEV);
-+ #endif
-+ if(!arcmsr_initialize(pACB,pPCI_DEV))
-+ {
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ pci_set_drvdata(pPCI_DEV,pACB); /*set driver_data*/
-+ #endif
-+ pci_set_master(pPCI_DEV);
-+ if(request_irq(pPCI_DEV->irq,arcmsr_do_interrupt,SA_INTERRUPT | SA_SHIRQ,"arcmsr",pACB))
-+ {
-+ printk("arcmsr_detect: request_irq got ERROR...................\n");
-+ arcmsr_adapterCnt--;
-+ pHCBARC->pACB[pACB->adapter_index]=NULL;
-+ iounmap(pACB->pmu);
-+ arcmsr_free_pci_pool(pACB);
-+ scsi_unregister(host);
-+ goto next_areca;
-+ }
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ if (pci_request_regions(pPCI_DEV, "arcmsr"))
-+ {
-+ printk("arcmsr_detect: pci_request_regions got ERROR...................\n");
-+ arcmsr_adapterCnt--;
-+ pHCBARC->pACB[pACB->adapter_index]=NULL;
-+ iounmap(pACB->pmu);
-+ arcmsr_free_pci_pool(pACB);
-+ scsi_unregister(host);
-+ goto next_areca;
-+ }
-+ #endif
-+ arcmsr_iop_init(pACB);/* on kernel 2.4.21 driver's iop read/write must after request_irq */
-+ }
-+ else
-+ {
-+ printk("arcmsr: arcmsr_initialize got ERROR...................\n");
-+ scsi_unregister(host);
-+ }
-+ next_areca: ;
-+ }
-+ }
-+ if(arcmsr_adapterCnt)
-+ {
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,3,30)
-+ host_template->proc_name="arcmsr";
-+ #else
-+ host_template->proc_dir= &arcmsr_proc_scsi;
-+ #endif
-+ register_reboot_notifier(&arcmsr_event_notifier);
-+ }
-+ else
-+ {
-+ printk("arcmsr_detect:...............NO ARECA RAID ADAPTER FOUND...........\n");
-+ return(arcmsr_adapterCnt);
-+ }
-+ pHCBARC->adapterCnt=arcmsr_adapterCnt;
-+ pHCBARC->arcmsr_major_number=register_chrdev(0, "arcmsr", &arcmsr_file_operations);
-+ printk("arcmsr device major number %d \n",pHCBARC->arcmsr_major_number);
-+ return(arcmsr_adapterCnt);
-+ }
-+#endif
-+/*
-+**********************************************************************
-+**********************************************************************
-+*/
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ void arcmsr_pci_unmap_dma(struct _CCB *pCCB)
-+ {
-+ struct _ACB *pACB=pCCB->pACB;
-+ struct scsi_cmnd *pcmd=pCCB->pcmd;
-+
-+ if(pcmd->use_sg != 0)
-+ {
-+ struct scatterlist *sl;
-+
-+ sl = (struct scatterlist *)pcmd->request_buffer;
-+ pci_unmap_sg(pACB->pPCI_DEV, sl, pcmd->use_sg, pcmd->sc_data_direction);
-+ }
-+ else if(pcmd->request_bufflen != 0)
-+ {
-+ pci_unmap_single(pACB->pPCI_DEV,(dma_addr_t)(unsigned long)pcmd->SCp.ptr,pcmd->request_bufflen, pcmd->sc_data_direction);
-+ }
-+ return;
-+ }
-+#endif
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+static int arcmsr_fops_open(struct inode *inode, struct file *filep)
-+{
-+ int i,minor;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+
-+ minor = MINOR(inode->i_rdev);
-+ if(minor >= pHCBARC->adapterCnt)
-+ {
-+ return -ENXIO;
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if((pACB=pHCBARC->pACB[i])!=NULL)
-+ {
-+ if(pACB->adapter_index==minor)
-+ {
-+ break;
-+ }
-+ }
-+ }
-+ if(i>=ARCMSR_MAX_ADAPTER)
-+ {
-+ return -ENXIO;
-+ }
-+ return 0; /* success */
-+}
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+static int arcmsr_fops_close(struct inode *inode, struct file *filep)
-+{
-+ int i,minor;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+
-+ minor = MINOR(inode->i_rdev);
-+ if(minor >= pHCBARC->adapterCnt)
-+ {
-+ return -ENXIO;
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if((pACB=pHCBARC->pACB[i])!=NULL)
-+ {
-+ if(pACB->adapter_index==minor)
-+ {
-+ break;
-+ }
-+ }
-+ }
-+ if(i>=ARCMSR_MAX_ADAPTER)
-+ {
-+ return -ENXIO;
-+ }
-+ return 0;
-+}
-+/*
-+**********************************************************************************
-+**********************************************************************************
-+*/
-+static int arcmsr_fops_ioctl(struct inode *inode, struct file *filep, unsigned int ioctl_cmd, unsigned long arg)
-+{
-+ int i,minor;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+
-+ minor = MINOR(inode->i_rdev);
-+ if(minor >= pHCBARC->adapterCnt)
-+ {
-+ return -ENXIO;
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if((pACB=pHCBARC->pACB[i])!=NULL)
-+ {
-+ if(pACB->adapter_index==minor)
-+ {
-+ break;
-+ }
-+ }
-+ }
-+ if(i>=ARCMSR_MAX_ADAPTER)
-+ {
-+ return -ENXIO;
-+ }
-+ /*
-+ ************************************************************
-+ ** We do not allow muti ioctls to the driver at the same duration.
-+ ************************************************************
-+ */
-+ return arcmsr_iop_ioctlcmd(pACB,ioctl_cmd,(void *)arg);
-+}
-+/*
-+************************************************************************
-+************************************************************************
-+*/
-+void arcmsr_flush_adapter_cache(struct _ACB *pACB)
-+{
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_flush_adapter_cache..............\n");
-+ #endif
-+ writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE,&pACB->pmu->inbound_msgaddr0);
-+ return;
-+}
-+/*
-+**********************************************************************
-+**********************************************************************
-+*/
-+void arcmsr_ccb_complete(struct _CCB *pCCB)
-+{
-+ unsigned long flag;
-+ struct _ACB *pACB=pCCB->pACB;
-+ struct scsi_cmnd *pcmd=pCCB->pcmd;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_ccb_complete:pCCB=0x%p ccb_doneindex=0x%x ccb_startindex=0x%x\n",pCCB,pACB->ccb_doneindex,pACB->ccb_startindex);
-+ #endif
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ arcmsr_pci_unmap_dma(pCCB);
-+#endif
-+ spin_lock_irqsave(&pACB->ccb_doneindex_lockunlock,flag);
-+ atomic_dec(&pACB->ccboutstandingcount);
-+ pCCB->startdone=ARCMSR_CCB_DONE;
-+ pCCB->ccb_flags=0;
-+ pACB->pccbringQ[pACB->ccb_doneindex]=pCCB;
-+ pACB->ccb_doneindex++;
-+ pACB->ccb_doneindex %= ARCMSR_MAX_FREECCB_NUM;
-+ spin_unlock_irqrestore(&pACB->ccb_doneindex_lockunlock,flag);
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ {
-+ pcmd->scsi_done(pcmd);
-+ }
-+ #else
-+ {
-+ unsigned long flags;
-+ spin_lock_irqsave(&io_request_lock, flags);
-+ pcmd->scsi_done(pcmd);
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+ }
-+ #endif
-+ return;
-+}
-+/*
-+**********************************************************************
-+** if scsi error do auto request sense
-+**********************************************************************
-+*/
-+void arcmsr_report_sense_info(struct _CCB *pCCB)
-+{
-+ struct scsi_cmnd *pcmd=pCCB->pcmd;
-+ struct _SENSE_DATA *psenseBuffer=(struct _SENSE_DATA *)pcmd->sense_buffer;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_report_sense_info...........\n");
-+ #endif
-+ pcmd->result=DID_OK << 16;
-+ if(psenseBuffer)
-+ {
-+ int sense_data_length=sizeof(struct _SENSE_DATA) < sizeof(pcmd->sense_buffer) ? sizeof(struct _SENSE_DATA) : sizeof(pcmd->sense_buffer);
-+ memset(psenseBuffer, 0, sizeof(pcmd->sense_buffer));
-+ memcpy(psenseBuffer,pCCB->arcmsr_cdb.SenseData,sense_data_length);
-+ psenseBuffer->ErrorCode=0x70;
-+ psenseBuffer->Valid=1;
-+ }
-+ return;
-+}
-+/*
-+*********************************************************************
-+** to insert pCCB into tail of pACB wait exec ccbQ
-+*********************************************************************
-+*/
-+void arcmsr_queue_wait2go_ccb(struct _ACB *pACB,struct _CCB *pCCB)
-+{
-+ unsigned long flag;
-+ int i=0;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_qtail_wait2go_ccb:......................................... \n");
-+ #endif
-+
-+ spin_lock_irqsave(&pACB->wait2go_lockunlock,flag);
-+ while(1)
-+ {
-+ if(pACB->pccbwait2go[i]==NULL)
-+ {
-+ pACB->pccbwait2go[i]=pCCB;
-+ atomic_inc(&pACB->ccbwait2gocount);
-+ spin_unlock_irqrestore(&pACB->wait2go_lockunlock,flag);
-+ return;
-+ }
-+ i++;
-+ i%=ARCMSR_MAX_OUTSTANDING_CMD;
-+ }
-+ return;
-+}
-+/*
-+*********************************************************************
-+*********************************************************************
-+*/
-+void arcmsr_abort_allcmd(struct _ACB *pACB)
-+{
-+ writel(ARCMSR_INBOUND_MESG0_ABORT_CMD,&pACB->pmu->inbound_msgaddr0);
-+ return;
-+}
-+/*
-+**********************************************************************
-+**********************************************************************
-+*/
-+static u_int8_t arcmsr_wait_msgint_ready(struct _ACB *pACB)
-+{
-+ uint32_t Index;
-+ uint8_t Retries=0x00;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_wait_msgint_ready: ...............................\n");
-+ #endif
-+ do
-+ {
-+ for(Index=0; Index < 100; Index++)
-+ {
-+ if(readl(&pACB->pmu->outbound_intstatus) & ARCMSR_MU_OUTBOUND_MESSAGE0_INT)
-+ {
-+ writel(ARCMSR_MU_OUTBOUND_MESSAGE0_INT,&pACB->pmu->outbound_intstatus);/*clear interrupt*/
-+ return 0x00;
-+ }
-+ arc_mdelay_int(10);
-+ }/*max 1 seconds*/
-+ }while(Retries++ < 20);/*max 20 sec*/
-+ return 0xff;
-+}
-+/*
-+****************************************************************************
-+** Routine Description: Reset 80331 iop.
-+** Arguments:
-+** Return Value: Nothing.
-+****************************************************************************
-+*/
-+static void arcmsr_iop_reset(struct _ACB *pACB)
-+{
-+ struct _CCB *pCCB;
-+ uint32_t intmask_org,mask;
-+ int i=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_reset: reset iop controller......................................\n");
-+ #endif
-+ if(atomic_read(&pACB->ccboutstandingcount)!=0)
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_reset: ccboutstandingcount=%d ...\n",atomic_read(&pACB->ccboutstandingcount));
-+ #endif
-+ /* disable all outbound interrupt */
-+ intmask_org=readl(&pACB->pmu->outbound_intmask);
-+ writel(intmask_org|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,&pACB->pmu->outbound_intmask);
-+ /* talk to iop 331 outstanding command aborted*/
-+ arcmsr_abort_allcmd(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d: iop reset wait 'abort all outstanding command' timeout \n",pACB->adapter_index);
-+ }
-+ /*clear all outbound posted Q*/
-+ for(i=0;i<ARCMSR_MAX_OUTSTANDING_CMD;i++)
-+ {
-+ readl(&pACB->pmu->outbound_queueport);
-+ }
-+ for(i=0;i<ARCMSR_MAX_FREECCB_NUM;i++)
-+ {
-+ pCCB=pACB->pccb_pool[i];
-+ if(pCCB->startdone==ARCMSR_CCB_START)
-+ {
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ }
-+ /* enable all outbound interrupt */
-+ mask=~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE|ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE|ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE);
-+ writel(intmask_org & mask,&pACB->pmu->outbound_intmask);
-+ /* post abort all outstanding command message to RAID controller */
-+ }
-+ i=0;
-+ while(atomic_read(&pACB->ccbwait2gocount)!=0)
-+ {
-+ pCCB=pACB->pccbwait2go[i];
-+ if(pCCB!=NULL)
-+ {
-+ printk("arcmsr%d:iop reset abort command ccbwait2gocount=%d \n",pACB->adapter_index,atomic_read(&pACB->ccbwait2gocount));
-+ pACB->pccbwait2go[i]=NULL;
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ atomic_dec(&pACB->ccbwait2gocount);
-+ }
-+ i++;
-+ i%=ARCMSR_MAX_OUTSTANDING_CMD;
-+ }
-+ atomic_set(&pACB->ccboutstandingcount,0);
-+ return;
-+}
-+/*
-+**********************************************************************
-+**********************************************************************
-+*/
-+void arcmsr_build_ccb(struct _ACB *pACB,struct _CCB *pCCB,struct scsi_cmnd *pcmd)
-+{
-+ struct _ARCMSR_CDB *pARCMSR_CDB= &pCCB->arcmsr_cdb;
-+ uint8_t *psge=(uint8_t * )&pARCMSR_CDB->u;
-+ uint32_t address_lo,address_hi;
-+ int arccdbsize=0x30;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_build_ccb........................... \n");
-+ #endif
-+ pCCB->pcmd=pcmd;
-+ memset(pARCMSR_CDB,0,sizeof(struct _ARCMSR_CDB));
-+ pARCMSR_CDB->Bus=0;
-+ pARCMSR_CDB->TargetID=pcmd->device->id;
-+ pARCMSR_CDB->LUN=pcmd->device->lun;
-+ pARCMSR_CDB->Function=1;
-+ pARCMSR_CDB->CdbLength=(uint8_t)pcmd->cmd_len;
-+ pARCMSR_CDB->Context=(unsigned long)pARCMSR_CDB;
-+ memcpy(pARCMSR_CDB->Cdb, pcmd->cmnd, pcmd->cmd_len);
-+ if(pcmd->use_sg)
-+ {
-+ int length,sgcount,i,cdb_sgcount=0;
-+ struct scatterlist *sl;
-+
-+ /* Get Scatter Gather List from scsiport. */
-+ sl=(struct scatterlist *) pcmd->request_buffer;
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,3,30)
-+ sgcount=pci_map_sg(pACB->pPCI_DEV, sl, pcmd->use_sg, pcmd->sc_data_direction);
-+ #else
-+ sgcount=pcmd->use_sg;
-+ #endif
-+ /* map stor port SG list to our iop SG List.*/
-+ for(i=0;i<sgcount;i++)
-+ {
-+ /* Get the physical address of the current data pointer */
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,3,30)
-+ length=cpu_to_le32(sg_dma_len(sl));
-+ address_lo=cpu_to_le32(dma_addr_lo32(sg_dma_address(sl)));
-+ address_hi=cpu_to_le32(dma_addr_hi32(sg_dma_address(sl)));
-+ #else
-+ length=cpu_to_le32(sl->length);
-+ address_lo=cpu_to_le32(virt_to_bus(sl->address));
-+ address_hi=0;
-+ #endif
-+ if(address_hi==0)
-+ {
-+ struct _SG32ENTRY* pdma_sg=(struct _SG32ENTRY*)psge;
-+
-+ pdma_sg->address=address_lo;
-+ pdma_sg->length=length;
-+ psge += sizeof(struct _SG32ENTRY);
-+ arccdbsize += sizeof(struct _SG32ENTRY);
-+ }
-+ else
-+ {
-+ struct _SG64ENTRY *pdma_sg=(struct _SG64ENTRY *)psge;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_build_ccb: ..........address_hi=0x%x.... \n",address_hi);
-+ #endif
-+
-+ pdma_sg->addresshigh=address_hi;
-+ pdma_sg->address=address_lo;
-+ pdma_sg->length=length|IS_SG64_ADDR;
-+ psge +=sizeof(struct _SG64ENTRY);
-+ arccdbsize +=sizeof(struct _SG64ENTRY);
-+ }
-+ sl++;
-+ cdb_sgcount++;
-+ }
-+ pARCMSR_CDB->sgcount=(uint8_t)cdb_sgcount;
-+ pARCMSR_CDB->DataLength=pcmd->request_bufflen;
-+ if( arccdbsize > 256)
-+ {
-+ pARCMSR_CDB->Flags|=ARCMSR_CDB_FLAG_SGL_BSIZE;
-+ }
-+ }
-+ else if(pcmd->request_bufflen)
-+ {
-+ #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,3,30)
-+ dma_addr_t dma_addr;
-+ dma_addr=pci_map_single(pACB->pPCI_DEV, pcmd->request_buffer, pcmd->request_bufflen, pcmd->sc_data_direction);
-+ pcmd->SCp.ptr = (char *)(unsigned long) dma_addr;
-+ address_lo=cpu_to_le32(dma_addr_lo32(dma_addr));
-+ address_hi=cpu_to_le32(dma_addr_hi32(dma_addr));
-+ #else
-+ address_lo=cpu_to_le32(virt_to_bus(pcmd->request_buffer));/* Actual requested buffer */
-+ address_hi=0;
-+ #endif
-+ if(address_hi==0)
-+ {
-+ struct _SG32ENTRY* pdma_sg=(struct _SG32ENTRY*)psge;
-+ pdma_sg->address=address_lo;
-+ pdma_sg->length=pcmd->request_bufflen;
-+ }
-+ else
-+ {
-+ struct _SG64ENTRY* pdma_sg=(struct _SG64ENTRY*)psge;
-+ pdma_sg->addresshigh=address_hi;
-+ pdma_sg->address=address_lo;
-+ pdma_sg->length=pcmd->request_bufflen|IS_SG64_ADDR;
-+ }
-+ pARCMSR_CDB->sgcount=1;
-+ pARCMSR_CDB->DataLength=pcmd->request_bufflen;
-+ }
-+ if(pcmd->cmnd[0]|WRITE_6 || pcmd->cmnd[0]|WRITE_10)
-+ {
-+ pARCMSR_CDB->Flags|=ARCMSR_CDB_FLAG_WRITE;
-+ pCCB->ccb_flags|=CCB_FLAG_WRITE;
-+ }
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_build_ccb: pCCB=0x%p cmd=0x%x xferlength=%d arccdbsize=%d sgcount=%d\n",pCCB,pcmd->cmnd[0],pARCMSR_CDB->DataLength,arccdbsize,pARCMSR_CDB->sgcount);
-+ #endif
-+ return;
-+}
-+/*
-+**************************************************************************
-+** arcmsr_post_ccb - Send a protocol specific ARC send postcard to a AIOC .
-+** handle: Handle of registered ARC protocol driver
-+** adapter_id: AIOC unique identifier(integer)
-+** pPOSTCARD_SEND: Pointer to ARC send postcard
-+**
-+** This routine posts a ARC send postcard to the request post FIFO of a
-+** specific ARC adapter.
-+**************************************************************************
-+*/
-+static void arcmsr_post_ccb(struct _ACB *pACB,struct _CCB *pCCB)
-+{
-+ uint32_t cdb_shifted_phyaddr=pCCB->cdb_shifted_phyaddr;
-+ struct _ARCMSR_CDB *pARCMSR_CDB=(struct _ARCMSR_CDB *)&pCCB->arcmsr_cdb;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_post_ccb: pCCB=0x%p cdb_shifted_phyaddr=0x%x pCCB->pACB=0x%p \n",pCCB,cdb_shifted_phyaddr,pCCB->pACB);
-+ #endif
-+ atomic_inc(&pACB->ccboutstandingcount);
-+ pCCB->startdone=ARCMSR_CCB_START;
-+ if(pARCMSR_CDB->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE)
-+ {
-+ writel(cdb_shifted_phyaddr|ARCMSR_CCBPOST_FLAG_SGL_BSIZE,&pACB->pmu->inbound_queueport);
-+ }
-+ else
-+ {
-+ writel(cdb_shifted_phyaddr,&pACB->pmu->inbound_queueport);
-+ }
-+ return;
-+}
-+/*
-+**************************************************************************
-+**************************************************************************
-+*/
-+void arcmsr_post_wait2go_ccb(struct _ACB *pACB)
-+{
-+ unsigned long flag;
-+ struct _CCB *pCCB;
-+ int i=0;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_post_wait2go_ccb:ccbwait2gocount=%d ccboutstandingcount=%d\n",atomic_read(&pACB->ccbwait2gocount),atomic_read(&pACB->ccboutstandingcount));
-+ #endif
-+ spin_lock_irqsave(&pACB->wait2go_lockunlock,flag);
-+ while((atomic_read(&pACB->ccbwait2gocount) > 0) && (atomic_read(&pACB->ccboutstandingcount) < ARCMSR_MAX_OUTSTANDING_CMD))
-+ {
-+ pCCB=pACB->pccbwait2go[i];
-+ if(pCCB!=NULL)
-+ {
-+ pACB->pccbwait2go[i]=NULL;
-+ arcmsr_post_ccb(pACB,pCCB);
-+ atomic_dec(&pACB->ccbwait2gocount);
-+ }
-+ i++;
-+ i%=ARCMSR_MAX_OUTSTANDING_CMD;
-+ }
-+ spin_unlock_irqrestore(&pACB->wait2go_lockunlock,flag);
-+ return;
-+}
-+/*
-+**********************************************************************
-+** Function: arcmsr_post_Qbuffer
-+** Output:
-+**********************************************************************
-+*/
-+static void arcmsr_post_Qbuffer(struct _ACB *pACB)
-+{
-+ uint8_t * pQbuffer;
-+ struct _QBUFFER* pwbuffer=(struct _QBUFFER*)&pACB->pmu->ioctl_wbuffer;
-+ uint8_t * iop_data=(uint8_t * )pwbuffer->data;
-+ int32_t allxfer_len=0;
-+
-+ while((pACB->wqbuf_firstindex!=pACB->wqbuf_lastindex) && (allxfer_len<124))
-+ {
-+ pQbuffer= &pACB->wqbuffer[pACB->wqbuf_firstindex];
-+ memcpy(iop_data,pQbuffer,1);
-+ pACB->wqbuf_firstindex++;
-+ pACB->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
-+ iop_data++;
-+ allxfer_len++;
-+ }
-+ pwbuffer->data_len=allxfer_len;
-+ /*
-+ ** push inbound doorbell and wait reply at hwinterrupt routine for next Qbuffer post
-+ */
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK,&pACB->pmu->inbound_doorbell);
-+ return;
-+}
-+/*
-+************************************************************************
-+************************************************************************
-+*/
-+static void arcmsr_stop_adapter_bgrb(struct _ACB *pACB)
-+{
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_stop_adapter_bgrb..............\n");
-+ #endif
-+ pACB->acb_flags |= ACB_F_MSG_STOP_BGRB;
-+ pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
-+ writel(ARCMSR_INBOUND_MESG0_STOP_BGRB,&pACB->pmu->inbound_msgaddr0);
-+ return;
-+}
-+/*
-+************************************************************************
-+************************************************************************
-+*/
-+static void arcmsr_free_pci_pool(struct _ACB *pACB)
-+{
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ {
-+ dma_free_coherent(&pACB->pPCI_DEV->dev,((sizeof(struct _CCB) * ARCMSR_MAX_FREECCB_NUM)+0x20),pACB->dma_coherent,pACB->dma_coherent_handle);
-+ }
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ {
-+ pci_free_consistent(pACB->pPCI_DEV, ((sizeof(struct _CCB) * ARCMSR_MAX_FREECCB_NUM)+0x20), pACB->dma_coherent, pACB->dma_coherent_handle);
-+ }
-+#else
-+ {
-+ kfree(pACB->dma_coherent);
-+ }
-+#endif
-+ return;
-+}
-+/*
-+**********************************************************************
-+** Function: arcmsr_interrupt
-+** Output: void
-+** DID_OK 0x00 // NO error
-+** DID_NO_CONNECT 0x01 // Couldn't connect before timeout period
-+** DID_BUS_BUSY 0x02 // BUS stayed busy through time out period
-+** DID_TIME_OUT 0x03 // TIMED OUT for other reason
-+** DID_BAD_TARGET 0x04 // BAD target.
-+** DID_ABORT 0x05 // Told to abort for some other reason
-+** DID_PARITY 0x06 // Parity error
-+** DID_ERROR 0x07 // Internal error
-+** DID_RESET 0x08 // Reset by somebody.
-+** DID_BAD_INTR 0x09 // Got an interrupt we weren't expecting.
-+** DID_PASSTHROUGH 0x0a // Force command past mid-layer
-+** DID_SOFT_ERROR 0x0b // The low level driver just wish a retry
-+** DRIVER_OK 0x00 // Driver status
-+**********************************************************************
-+*/
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ static irqreturn_t arcmsr_interrupt(struct _ACB *pACB)
-+#else
-+ static void arcmsr_interrupt(struct _ACB *pACB)
-+#endif
-+{
-+ struct _CCB *pCCB;
-+ uint32_t flag_ccb,outbound_intstatus,outbound_doorbell;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_interrupt...................................\n");
-+ #endif
-+
-+ /*
-+ *********************************************
-+ ** check outbound intstatus À˹µL¶l®t«öªù¹a
-+ *********************************************
-+ */
-+ outbound_intstatus=readl(&pACB->pmu->outbound_intstatus) & pACB->outbound_int_enable;
-+ writel(outbound_intstatus,&pACB->pmu->outbound_intstatus);/*clear interrupt*/
-+ if(outbound_intstatus & ARCMSR_MU_OUTBOUND_DOORBELL_INT)
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_interrupt:..........ARCMSR_MU_OUTBOUND_DOORBELL_INT \n");
-+ #endif
-+ /*
-+ *********************************************
-+ ** DOORBELL ¥m¾´! ¬O§_¦³¶l¥ó­nñ¦¬
-+ *********************************************
-+ */
-+ outbound_doorbell=readl(&pACB->pmu->outbound_doorbell);
-+ writel(outbound_doorbell,&pACB->pmu->outbound_doorbell);/*clear interrupt */
-+ if(outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK)
-+ {
-+ struct _QBUFFER* prbuffer=(struct _QBUFFER*)&pACB->pmu->ioctl_rbuffer;
-+ uint8_t * iop_data=(uint8_t * )prbuffer->data;
-+ uint8_t * pQbuffer;
-+ int32_t my_empty_len,iop_len,rqbuf_firstindex,rqbuf_lastindex;
-+
-+ /*check this iop data if overflow my rqbuffer*/
-+ rqbuf_lastindex=pACB->rqbuf_lastindex;
-+ rqbuf_firstindex=pACB->rqbuf_firstindex;
-+ iop_len=prbuffer->data_len;
-+ my_empty_len=(rqbuf_firstindex-rqbuf_lastindex-1)&(ARCMSR_MAX_QBUFFER-1);
-+ if(my_empty_len>=iop_len)
-+ {
-+ while(iop_len > 0)
-+ {
-+ pQbuffer= &pACB->rqbuffer[pACB->rqbuf_lastindex];
-+ memcpy(pQbuffer,iop_data,1);
-+ pACB->rqbuf_lastindex++;
-+ pACB->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;/*if last index number set it to 0 */
-+ iop_data++;
-+ iop_len--;
-+ }
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);/*signature, let IOP331 know data has been readed */
-+ }
-+ else
-+ {
-+ pACB->acb_flags|=ACB_F_IOPDATA_OVERFLOW;
-+ }
-+ }
-+ if(outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_READ_OK)
-+ {
-+ /*
-+ *********************************************
-+ ** ¬Ý¬Ý¬O§_ÁÙ¦³¶l¥ó­n¶¶¹D±H¥X
-+ *********************************************
-+ */
-+ if(pACB->wqbuf_firstindex!=pACB->wqbuf_lastindex)
-+ {
-+ uint8_t * pQbuffer;
-+ struct _QBUFFER* pwbuffer=(struct _QBUFFER*)&pACB->pmu->ioctl_wbuffer;
-+ uint8_t * iop_data=(uint8_t * )pwbuffer->data;
-+ int32_t allxfer_len=0;
-+
-+ while((pACB->wqbuf_firstindex!=pACB->wqbuf_lastindex) && (allxfer_len<124))
-+ {
-+ pQbuffer= &pACB->wqbuffer[pACB->wqbuf_firstindex];
-+ memcpy(iop_data,pQbuffer,1);
-+ pACB->wqbuf_firstindex++;
-+ pACB->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
-+ iop_data++;
-+ allxfer_len++;
-+ }
-+ pwbuffer->data_len=allxfer_len;
-+ /*
-+ ** push inbound doorbell tell iop driver data write ok and wait reply on next hwinterrupt for next Qbuffer post
-+ */
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK,&pACB->pmu->inbound_doorbell);
-+ }
-+ else
-+ {
-+ pACB->acb_flags |= ACB_F_IOCTL_WQBUFFER_CLEARED;
-+ }
-+ }
-+ }
-+ if(outbound_intstatus & ARCMSR_MU_OUTBOUND_POSTQUEUE_INT)
-+ {
-+ int id,lun;
-+ /*
-+ *****************************************************************************
-+ ** areca cdb command done
-+ *****************************************************************************
-+ */
-+ while(1)
-+ {
-+ if((flag_ccb=readl(&pACB->pmu->outbound_queueport)) == 0xFFFFFFFF)
-+ {
-+ break;/*chip FIFO no ccb for completion already*/
-+ }
-+ /* check if command done with no error*/
-+ pCCB=(struct _CCB *)(pACB->vir2phy_offset+(flag_ccb << 5));/*frame must be 32 bytes aligned*/
-+ if((pCCB->pACB!=pACB) || (pCCB->startdone!=ARCMSR_CCB_START))
-+ {
-+ if(pCCB->startdone==ARCMSR_CCB_ABORTED)
-+ {
-+ printk("arcmsr%d scsi id=%d lun=%d ccb='0x%p' isr command abort successfully \n",pACB->adapter_index,pCCB->pcmd->device->id,pCCB->pcmd->device->lun,pCCB);
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ continue;
-+ }
-+ printk("arcmsr%d isr get an illegal ccb command done acb='0x%p' ccb='0x%p' ccbacb='0x%p' startdone=0x%x ccboutstandingcount=%d \n",pACB->adapter_index,pACB,pCCB,pCCB->pACB,pCCB->startdone,atomic_read(&pACB->ccboutstandingcount));
-+ continue;
-+ }
-+ id=pCCB->pcmd->device->id;
-+ lun=pCCB->pcmd->device->lun;
-+ if((flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR)==0)
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("pCCB=0x%p scsi cmd=0x%x................... GOOD ..............done\n",pCCB,pCCB->pcmd->cmnd[0]);
-+ #endif
-+
-+ if(pACB->devstate[id][lun]==ARECA_RAID_GONE)
-+ {
-+ pACB->devstate[id][lun]=ARECA_RAID_GOOD;
-+ }
-+ pCCB->pcmd->result=DID_OK << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ else
-+ {
-+ switch(pCCB->arcmsr_cdb.DeviceStatus)
-+ {
-+ case ARCMSR_DEV_SELECT_TIMEOUT:
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("pCCB=0x%p ......ARCMSR_DEV_SELECT_TIMEOUT\n",pCCB);
-+ #endif
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_TIME_OUT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ case ARCMSR_DEV_ABORTED:
-+ case ARCMSR_DEV_INIT_FAIL:
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("pCCB=0x%p .....ARCMSR_DEV_INIT_FAIL\n",pCCB);
-+ #endif
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_BAD_TARGET << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ case SCSISTAT_CHECK_CONDITION:
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("pCCB=0x%p .....SCSISTAT_CHECK_CONDITION\n",pCCB);
-+ #endif
-+ pACB->devstate[id][lun]=ARECA_RAID_GOOD;
-+ arcmsr_report_sense_info(pCCB);
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ default:
-+ /* error occur Q all error ccb to errorccbpending Q*/
-+ printk("arcmsr%d scsi id=%d lun=%d isr get command error done, but got unknow DeviceStatus=0x%x \n",pACB->adapter_index,id,lun,pCCB->arcmsr_cdb.DeviceStatus);
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_BAD_TARGET << 16;/*unknow error or crc error just for retry*/
-+ arcmsr_ccb_complete(pCCB);
-+ break;
-+ }
-+ }
-+ } /*drain reply FIFO*/
-+ }
-+ if(!(outbound_intstatus & ARCMSR_MU_OUTBOUND_HANDLE_INT))
-+ {
-+ /*it must be share irq*/
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_interrupt..........FALSE....................share irq.....\n");
-+ #endif
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ return IRQ_NONE;
-+ #else
-+ return;
-+ #endif
-+ }
-+ if(atomic_read(&pACB->ccbwait2gocount) != 0)
-+ {
-+ arcmsr_post_wait2go_ccb(pACB);/*try to post all pending ccb*/
-+ }
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ return IRQ_HANDLED;
-+ #else
-+ return;
-+ #endif
-+}
-+/*
-+*******************************************************************************
-+*******************************************************************************
-+*/
-+static void arcmsr_iop_parking(struct _ACB *pACB)
-+{
-+ if(pACB!=NULL)
-+ {
-+ /* stop adapter background rebuild */
-+ if(pACB->acb_flags & ACB_F_MSG_START_BGRB)
-+ {
-+ pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
-+ arcmsr_stop_adapter_bgrb(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d iop parking wait 'stop adapter rebulid' timeout \n",pACB->adapter_index);
-+ }
-+ arcmsr_flush_adapter_cache(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d iop parking wait 'flush adapter cache' timeout \n",pACB->adapter_index);
-+ }
-+ }
-+ }
-+}
-+/*
-+***********************************************************************
-+************************************************************************
-+*/
-+static int arcmsr_iop_ioctlcmd(struct _ACB *pACB,int ioctl_cmd,void *arg)
-+{
-+ PCMD_IOCTL_FIELD pcmdioctlfld;
-+ dma_addr_t cmd_handle;
-+ int retvalue=0;
-+ /* Only let one of these through at a time */
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd.......................................\n");
-+ #endif
-+ pcmdioctlfld=pci_alloc_consistent(pACB->pPCI_DEV, sizeof (struct _CMD_IOCTL_FIELD), &cmd_handle);
-+ if(pcmdioctlfld==NULL)
-+ {
-+ return -ENOMEM;
-+ }
-+ if(copy_from_user(pcmdioctlfld, arg, sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue = -EFAULT;
-+ goto ioctl_out;
-+ }
-+ if(memcmp(pcmdioctlfld->cmdioctl.Signature,"ARCMSR",6)!=0)
-+ {
-+ retvalue = -EINVAL;
-+ goto ioctl_out;
-+ }
-+ switch(ioctl_cmd)
-+ {
-+ case ARCMSR_IOCTL_READ_RQBUFFER:
-+ {
-+ unsigned long flag;
-+ unsigned long *ver_addr;
-+ dma_addr_t buf_handle;
-+ uint8_t *pQbuffer,*ptmpQbuffer;
-+ int32_t allxfer_len=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_READ_RQBUFFER..... \n");
-+ #endif
-+ ver_addr=pci_alloc_consistent(pACB->pPCI_DEV, 1032, &buf_handle);
-+ if(ver_addr==NULL)
-+ {
-+ retvalue = -ENOMEM;
-+ goto ioctl_out;
-+ }
-+ ptmpQbuffer=(uint8_t *)ver_addr;
-+ spin_lock_irqsave(&pACB->qbuffer_lockunlock,flag);
-+ while((pACB->rqbuf_firstindex!=pACB->rqbuf_lastindex) && (allxfer_len<1031))
-+ {
-+ /*copy READ QBUFFER to srb*/
-+ pQbuffer= &pACB->rqbuffer[pACB->rqbuf_firstindex];
-+ memcpy(ptmpQbuffer,pQbuffer,1);
-+ pACB->rqbuf_firstindex++;
-+ pACB->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
-+ ptmpQbuffer++;
-+ allxfer_len++;
-+ }
-+ if(pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW)
-+ {
-+ struct _QBUFFER* prbuffer=(struct _QBUFFER*)&pACB->pmu->ioctl_rbuffer;
-+ uint8_t * pQbuffer;
-+ uint8_t * iop_data=(uint8_t *)prbuffer->data;
-+ int32_t iop_len;
-+
-+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
-+ iop_len=(int32_t)prbuffer->data_len;
-+ /*this iop data does no chance to make me overflow again here, so just do it*/
-+ while(iop_len>0)
-+ {
-+ pQbuffer= &pACB->rqbuffer[pACB->rqbuf_lastindex];
-+ memcpy(pQbuffer,iop_data,1);
-+ pACB->rqbuf_lastindex++;
-+ pACB->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;/*if last index number set it to 0 */
-+ iop_data++;
-+ iop_len--;
-+ }
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);/*signature, let IOP331 know data has been readed */
-+ }
-+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock,flag);
-+ memcpy(pcmdioctlfld->ioctldatabuffer,(uint8_t *)ver_addr,allxfer_len);
-+ pcmdioctlfld->cmdioctl.Length=allxfer_len;
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr, buf_handle);
-+ }
-+ break;
-+ case ARCMSR_IOCTL_WRITE_WQBUFFER:
-+ {
-+ unsigned long flag;
-+ unsigned long *ver_addr;
-+ dma_addr_t buf_handle;
-+ int32_t my_empty_len,user_len,wqbuf_firstindex,wqbuf_lastindex;
-+ uint8_t *pQbuffer,*ptmpuserbuffer;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_WRITE_WQBUFFER..... \n");
-+ #endif
-+ ver_addr=pci_alloc_consistent(pACB->pPCI_DEV, 1032, &buf_handle);
-+ if(ver_addr==NULL)
-+ {
-+ retvalue= -ENOMEM;
-+ goto ioctl_out;
-+ }
-+ ptmpuserbuffer=(uint8_t *)ver_addr;
-+ user_len=pcmdioctlfld->cmdioctl.Length;
-+ memcpy(ptmpuserbuffer,pcmdioctlfld->ioctldatabuffer,user_len);
-+ /*check if data xfer length of this request will overflow my array qbuffer */
-+ spin_lock_irqsave(&pACB->qbuffer_lockunlock,flag);
-+ wqbuf_lastindex=pACB->wqbuf_lastindex;
-+ wqbuf_firstindex=pACB->wqbuf_firstindex;
-+ my_empty_len=(wqbuf_firstindex-wqbuf_lastindex-1)&(ARCMSR_MAX_QBUFFER-1);
-+ if(my_empty_len>=user_len)
-+ {
-+ while(user_len>0)
-+ {
-+ /*copy srb data to wqbuffer*/
-+ pQbuffer= &pACB->wqbuffer[pACB->wqbuf_lastindex];
-+ memcpy(pQbuffer,ptmpuserbuffer,1);
-+ pACB->wqbuf_lastindex++;
-+ pACB->wqbuf_lastindex %= ARCMSR_MAX_QBUFFER;/*if last index number set it to 0 */
-+ ptmpuserbuffer++;
-+ user_len--;
-+ }
-+ /*post fist Qbuffer*/
-+ if(pACB->acb_flags & ACB_F_IOCTL_WQBUFFER_CLEARED)
-+ {
-+ pACB->acb_flags &=~ACB_F_IOCTL_WQBUFFER_CLEARED;
-+ arcmsr_post_Qbuffer(pACB);
-+ }
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ }
-+ else
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd:invalid data xfer ............qbuffer full............ \n");
-+ #endif
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_ERROR;
-+ }
-+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock,flag);
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr, buf_handle);
-+ }
-+ break;
-+ case ARCMSR_IOCTL_CLEAR_RQBUFFER:
-+ {
-+ unsigned long flag;
-+ uint8_t * pQbuffer=pACB->rqbuffer;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_CLEAR_RQBUFFER..... \n");
-+ #endif
-+ if(pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW)
-+ {
-+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);/*signature, let IOP331 know data has been readed */
-+ }
-+ pACB->acb_flags |= ACB_F_IOCTL_RQBUFFER_CLEARED;
-+ spin_lock_irqsave(&pACB->qbuffer_lockunlock,flag);
-+ pACB->rqbuf_firstindex=0;
-+ pACB->rqbuf_lastindex=0;
-+ memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
-+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock,flag);
-+ /*report success*/
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ }
-+ break;
-+ case ARCMSR_IOCTL_CLEAR_WQBUFFER:
-+ {
-+ unsigned long flag;
-+ uint8_t * pQbuffer=pACB->wqbuffer;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_CLEAR_WQBUFFER..... \n");
-+ #endif
-+
-+ if(pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW)
-+ {
-+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);/*signature, let IOP331 know data has been readed */
-+ }
-+ pACB->acb_flags |= ACB_F_IOCTL_WQBUFFER_CLEARED;
-+ spin_lock_irqsave(&pACB->qbuffer_lockunlock,flag);
-+ pACB->wqbuf_firstindex=0;
-+ pACB->wqbuf_lastindex=0;
-+ memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
-+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock,flag);
-+ /*report success*/
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ }
-+ break;
-+ case ARCMSR_IOCTL_CLEAR_ALLQBUFFER:
-+ {
-+ unsigned long flag;
-+ uint8_t * pQbuffer;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_CLEAR_ALLQBUFFER..... \n");
-+ #endif
-+ if(pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW)
-+ {
-+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);/*signature, let IOP331 know data has been readed */
-+ }
-+ pACB->acb_flags |= (ACB_F_IOCTL_WQBUFFER_CLEARED|ACB_F_IOCTL_RQBUFFER_CLEARED);
-+ spin_lock_irqsave(&pACB->qbuffer_lockunlock,flag);
-+ pACB->rqbuf_firstindex=0;
-+ pACB->rqbuf_lastindex=0;
-+ pACB->wqbuf_firstindex=0;
-+ pACB->wqbuf_lastindex=0;
-+ pQbuffer=pACB->rqbuffer;
-+ memset(pQbuffer, 0, sizeof(struct _QBUFFER));
-+ pQbuffer=pACB->wqbuffer;
-+ memset(pQbuffer, 0, sizeof(struct _QBUFFER));
-+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock,flag);
-+ /*report success*/
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ }
-+ break;
-+ case ARCMSR_IOCTL_RETURN_CODE_3F:
-+ {
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_RETURNCODE_3F..... \n");
-+ #endif
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_3F;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ }
-+ break;
-+ case ARCMSR_IOCTL_SAY_HELLO:
-+ {
-+ int8_t * hello_string="Hello! I am ARCMSR";
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_ioctlcmd: ARCMSR_IOCTL_SAY_HELLO..... \n");
-+ #endif
-+ memcpy(pcmdioctlfld->ioctldatabuffer,hello_string,(int16_t)strlen(hello_string));
-+ pcmdioctlfld->cmdioctl.ReturnCode=ARCMSR_IOCTL_RETURNCODE_OK;
-+ if(copy_to_user(arg,pcmdioctlfld,sizeof (struct _CMD_IOCTL_FIELD))!=0)
-+ {
-+ retvalue= -EFAULT;
-+ }
-+ }
-+ break;
-+ case ARCMSR_IOCTL_SAY_GOODBYE:
-+ {
-+ arcmsr_iop_parking(pACB);
-+ }
-+ break;
-+ case ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE:
-+ {
-+ arcmsr_flush_adapter_cache(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d ioctl flush cache wait 'flush adapter cache' timeout \n",pACB->adapter_index);
-+ }
-+ }
-+ break;
-+ default:
-+ retvalue= -EFAULT;
-+ }
-+ioctl_out:
-+ pci_free_consistent(pACB->pPCI_DEV, sizeof (struct _CMD_IOCTL_FIELD), pcmdioctlfld, cmd_handle);
-+ return retvalue;
-+}
-+/*
-+************************************************************************
-+** arcmsr_ioctl
-+** Performs ioctl requests not satified by the upper levels.
-+** copy_from_user(to,from,n)
-+** copy_to_user(to,from,n)
-+**
-+** The scsi_device struct contains what we know about each given scsi
-+** device.
-+**
-+** FIXME(eric) - one of the great regrets that I have is that I failed to define
-+** these structure elements as something like sdev_foo instead of foo. This would
-+** make it so much easier to grep through sources and so forth. I propose that
-+** all new elements that get added to these structures follow this convention.
-+** As time goes on and as people have the stomach for it, it should be possible to
-+** go back and retrofit at least some of the elements here with with the prefix.
-+**
-+**
-+**struct scsi_device {
-+** %% private: %%
-+** %%
-+** %% This information is private to the scsi mid-layer. Wrapping it in a
-+** %% struct private is a way of marking it in a sort of C++ type of way.
-+** %%
-+**
-+** struct scsi_device *next; %% Used for linked list %%
-+** struct scsi_device *prev; %% Used for linked list %%
-+** wait_queue_head_t scpnt_wait; %% Used to wait if device is busy %%
-+** struct Scsi_Host *host;
-+** request_queue_t request_queue;
-+** atomic_t device_active; %% commands checked out for device %%
-+** volatile unsigned short device_busy; %% commands actually active on low-level %%
-+** int (*scsi_init_io_fn) (struct scsi_cmnd *); %% Used to initialize new request %%
-+** Scsi_Cmnd *device_queue; %% queue of SCSI Command structures %%
-+**
-+** %% public: %%
-+**
-+** unsigned int id, lun, channel;
-+** unsigned int manufacturer; %% Manufacturer of device, for using vendor-specific cmd's %%
-+** unsigned sector_size; %% size in bytes %%
-+** int attached; %% # of high level drivers attached to this %%
-+** int access_count; %% Count of open channels/mounts %%
-+** void *hostdata; %% available to low-level driver %%
-+** devfs_handle_t de; %% directory for the device %%
-+** char type;
-+** char scsi_level;
-+** char vendor[8], model[16], rev[4];
-+** unsigned char current_tag; %% current tag %%
-+** unsigned char sync_min_period; %% Not less than this period %%
-+** unsigned char sync_max_offset; %% Not greater than this offset %%
-+** unsigned char queue_depth; %% How deep a queue to use %%
-+** unsigned online:1;
-+** unsigned writeable:1;
-+** unsigned removable:1;
-+** unsigned random:1;
-+** unsigned has_cmdblocks:1;
-+** unsigned changed:1; %% Data invalid due to media change %%
-+** unsigned busy:1; %% Used to prevent races %%
-+** unsigned lockable:1; %% Able to prevent media removal %%
-+** unsigned borken:1; %% Tell the Seagate driver to be painfully slow on this device %%
-+** unsigned tagged_supported:1; %% Supports SCSI-II tagged queuing %%
-+** unsigned tagged_queue:1; %% SCSI-II tagged queuing enabled %%
-+** unsigned disconnect:1; %% can disconnect %%
-+** unsigned soft_reset:1; %% Uses soft reset option %%
-+** unsigned sync:1; %% Negotiate for sync transfers %%
-+** unsigned wide:1; %% Negotiate for WIDE transfers %%
-+** unsigned single_lun:1; %% Indicates we should only allow I/O to one of the luns for the device at a time. %%
-+** unsigned was_reset:1; %% There was a bus reset on the bus for this device %%
-+** unsigned expecting_cc_ua:1; %% Expecting a CHECK_CONDITION/UNIT_ATTN because we did a bus reset. %%
-+** unsigned device_blocked:1; %% Device returned QUEUE_FULL. %%
-+** unsigned ten:1; %% support ten byte read / write %%
-+** unsigned remap:1; %% support remapping %%
-+** unsigned starved:1; %% unable to process commands because host busy %%
-+** int allow_revalidate; %% Flag to allow revalidate to succeed in sd_open
-+**};
-+**
-+************************************************************************
-+*/
-+int arcmsr_ioctl(struct scsi_device *dev,int ioctl_cmd,void *arg)
-+{
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ int32_t match=0x55AA,i;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_ioctl..................................................... \n");
-+ #endif
-+
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if((pACB=pHCBARC->pACB[i])!=NULL)
-+ {
-+ if(pACB->host==dev->host)
-+ {
-+ match=i;
-+ break;
-+ }
-+ }
-+ }
-+ if(match==0x55AA)
-+ {
-+ return -ENXIO;
-+ }
-+ if(!arg)
-+ {
-+ return -EINVAL;
-+ }
-+ return(arcmsr_iop_ioctlcmd(pACB,ioctl_cmd,arg));
-+}
-+/*
-+**************************************************************************
-+**************************************************************************
-+*/
-+static struct _CCB * arcmsr_get_freeccb(struct _ACB *pACB)
-+{
-+ struct _CCB *pCCB;
-+ unsigned long flag;
-+ int ccb_startindex,ccb_doneindex;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_get_freeccb: ccb_startindex=%d ccb_doneindex=%d\n",pACB->ccb_startindex,pACB->ccb_doneindex);
-+ #endif
-+ spin_lock_irqsave(&pACB->ccb_startindex_lockunlock,flag);
-+ ccb_doneindex=pACB->ccb_doneindex;
-+ ccb_startindex=pACB->ccb_startindex;
-+ pCCB=pACB->pccbringQ[ccb_startindex];
-+ ccb_startindex++;
-+ ccb_startindex %= ARCMSR_MAX_FREECCB_NUM;
-+ if(ccb_doneindex!=ccb_startindex)
-+ {
-+ pACB->ccb_startindex=ccb_startindex;
-+ }
-+ else
-+ {
-+ pCCB=NULL;
-+ }
-+ spin_unlock_irqrestore(&pACB->ccb_startindex_lockunlock,flag);
-+ return(pCCB);
-+}
-+/*
-+***********************************************************************
-+**
-+** struct scsi_cmnd {
-+** int sc_magic;
-+** // private: //
-+** //
-+** // This information is private to the scsi mid-layer. Wrapping it in a
-+** // struct private is a way of marking it in a sort of C++ type of way.
-+** //
-+** struct Scsi_Host *host;
-+** unsigned short state;
-+** unsigned short owner;
-+** Scsi_Device *device;
-+** Scsi_Request *sc_request;
-+** struct scsi_cmnd *next;
-+** struct scsi_cmnd *reset_chain;
-+**
-+** int eh_state; // Used for state tracking in error handlr
-+** void (*done) (struct scsi_cmnd *);
-+** // Mid-level done function
-+** //
-+** // A SCSI Command is assigned a nonzero serial_number when internal_cmnd
-+** // passes it to the driver's queue command function. The serial_number
-+** // is cleared when scsi_done is entered indicating that the command has
-+** // been completed. If a timeout occurs,the serial number at the moment
-+** // of timeout is copied into serial_number_at_timeout. By subsequently
-+** // comparing the serial_number and serial_number_at_timeout fields
-+** // during abort or reset processing,we can detect whether the command
-+** // has already completed. This also detects cases where the command has
-+** // completed and the SCSI Command structure has already being reused
-+** // for another command,so that we can avoid incorrectly aborting or
-+** // resetting the new command.
-+** //
-+**
-+** unsigned long serial_number;
-+** unsigned long serial_number_at_timeout;
-+**
-+** int retries;
-+** int allowed;
-+** int timeout_per_command;
-+** int timeout_total;
-+** int timeout;
-+**
-+** //
-+** // We handle the timeout differently if it happens when a reset,
-+** // abort,etc are in process.
-+** //
-+** unsigned volatile char internal_timeout;
-+** struct scsi_cmnd *bh_next;
-+** // To enumerate the commands waiting to be processed.
-+**
-+** // public: //
-+**
-+** unsigned int target;
-+** unsigned int lun;
-+** unsigned int channel;
-+** unsigned char cmd_len;
-+** unsigned char old_cmd_len;
-+** unsigned char sc_data_direction;
-+** unsigned char sc_old_data_direction;
-+** // These elements define the operation we are about to perform
-+** unsigned char cmnd[MAX_COMMAND_SIZE];
-+** unsigned request_bufflen;
-+** // Actual request size
-+**
-+** struct timer_list eh_timeout;
-+** // Used to time out the command.
-+** void *request_buffer;
-+** // Actual requested buffer
-+** // These elements define the operation we ultimately want to perform
-+** unsigned char data_cmnd[MAX_COMMAND_SIZE];
-+** unsigned short old_use_sg;
-+** // We save use_sg here when requesting sense info
-+** unsigned short use_sg;
-+** // Number of pieces of scatter-gather
-+** unsigned short sglist_len;
-+** // size of malloc'd scatter-gather list
-+** unsigned short abort_reason;
-+** // If the mid-level code requests an abort,this is the reason.
-+** unsigned bufflen;
-+** // Size of data buffer
-+** void *buffer;
-+** // Data buffer
-+** unsigned underflow;
-+** // Return error if less than this amount is transferred
-+** unsigned old_underflow;
-+** // save underflow here when reusing the command for error handling
-+**
-+** unsigned transfersize;
-+** // How much we are guaranteed to transfer with each SCSI transfer
-+** // (ie,between disconnect/reconnects. Probably==sector size
-+** int resid;
-+** // Number of bytes requested to be transferred
-+** // less actual number transferred (0 if not supported)
-+** struct request request;
-+** // A copy of the command we are working on
-+** unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
-+** // obtained by REQUEST SENSE when CHECK CONDITION is received on original command (auto-sense)
-+** unsigned flags;
-+** // Used to indicate that a command which has timed out also
-+** // completed normally. Typically the completion function will
-+** // do nothing but set this flag in this instance because the
-+** // timeout handler is already running.
-+** unsigned done_late:1;
-+** // Low-level done function - can be used by low-level driver to point
-+** // to completion function. Not used by mid/upper level code.
-+** void (*scsi_done) (struct scsi_cmnd *);
-+** // The following fields can be written to by the host specific code.
-+** // Everything else should be left alone.
-+** Scsi_Pointer SCp;
-+** // Scratchpad used by some host adapters
-+** unsigned char *host_scribble;
-+** // The host adapter is allowed to
-+** // call scsi_malloc and get some memory
-+** // and hang it here. The host adapter
-+** // is also expected to call scsi_free
-+** // to release this memory. (The memory
-+** // obtained by scsi_malloc is guaranteed
-+** // to be at an address < 16Mb).
-+** int result;
-+** // Status code from lower level driver
-+** unsigned char tag;
-+** // SCSI-II queued command tag
-+** unsigned long pid;
-+** // Process ID,starts at 0
-+** };
-+**
-+** The Scsi_Cmnd structure is used by scsi.c internally,
-+** and for communication
-+** with low level drivers that support multiple outstanding commands.
-+**
-+**typedef struct scsi_pointer
-+**{
-+** char * ptr; // data pointer
-+** int this_residual; // left in this buffer
-+** struct scatterlist *buffer; // which buffer
-+** int buffers_residual; // how many buffers left
-+**
-+** volatile int Status;
-+** volatile int Message;
-+** volatile int have_data_in;
-+** volatile int sent_command;
-+** volatile int phase;
-+**} Scsi_Pointer;
-+***********************************************************************
-+*/
-+int arcmsr_queue_command(struct scsi_cmnd *cmd,void (* done)(struct scsi_cmnd *))
-+{
-+ struct Scsi_Host *host = cmd->device->host;
-+ struct _ACB *pACB=(struct _ACB *) host->hostdata;
-+ struct _CCB *pCCB;
-+ int target=cmd->device->id;
-+ int lun=cmd->device->lun;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_queue_command:Cmd=%2x,TargetId=%d,Lun=%d \n",cmd->cmnd[0],target,lun);
-+ #endif
-+
-+ cmd->scsi_done=done;
-+ cmd->host_scribble=NULL;
-+ cmd->result=0;
-+ if(cmd->cmnd[0]==SYNCHRONIZE_CACHE) /* 0x35 avoid synchronizing disk cache cmd during .remove : arcmsr_device_remove (linux bug) */
-+ {
-+ if(pACB->devstate[target][lun]==ARECA_RAID_GONE)
-+ {
-+ cmd->result=(DID_NO_CONNECT << 16);
-+ }
-+ cmd->scsi_done(cmd);
-+ return(0);
-+ }
-+ if(pACB->acb_flags & ACB_F_BUS_RESET)
-+ {
-+ printk("arcmsr%d bus reset and return busy \n",pACB->adapter_index);
-+ cmd->result=(DID_BUS_BUSY << 16);
-+ cmd->scsi_done(cmd);
-+ return(0);
-+ }
-+ if(pACB->devstate[target][lun]==ARECA_RAID_GONE)
-+ {
-+ uint8_t block_cmd;
-+
-+ block_cmd=cmd->cmnd[0] & 0x0f;
-+ if(block_cmd==0x08 || block_cmd==0x0a)
-+ {
-+ printk("arcmsr%d block 'read/write' command with gone raid volume Cmd=%2x,TargetId=%d,Lun=%d \n",pACB->adapter_index,cmd->cmnd[0],target,lun);
-+ cmd->result=(DID_NO_CONNECT << 16);
-+ cmd->scsi_done(cmd);
-+ return(0);
-+ }
-+ }
-+ if((pCCB=arcmsr_get_freeccb(pACB)) != NULL)
-+ {
-+ arcmsr_build_ccb(pACB,pCCB,cmd);
-+ if(atomic_read(&pACB->ccboutstandingcount) < ARCMSR_MAX_OUTSTANDING_CMD)
-+ {
-+ /*
-+ ******************************************************************
-+ ** and we can make sure there were no pending ccb in this duration
-+ ******************************************************************
-+ */
-+ arcmsr_post_ccb(pACB,pCCB);
-+ }
-+ else
-+ {
-+ /*
-+ ******************************************************************
-+ ** Q of ccbwaitexec will be post out when any outstanding command complete
-+ ******************************************************************
-+ */
-+ arcmsr_queue_wait2go_ccb(pACB,pCCB);
-+ }
-+ }
-+ else
-+ {
-+ printk("arcmsr%d 'out of ccbs resource' ccb outstanding=%d pending=%d \n",pACB->adapter_index,atomic_read(&pACB->ccboutstandingcount),atomic_read(&pACB->ccbwait2gocount));
-+ cmd->result=(DID_BUS_BUSY << 16);
-+ cmd->scsi_done(cmd);
-+ }
-+ return(0);
-+}
-+/*
-+**********************************************************************
-+** get firmware miscellaneous data
-+**********************************************************************
-+*/
-+static void arcmsr_get_firmware_spec(struct _ACB *pACB)
-+{
-+ char *acb_firm_model=pACB->firm_model;
-+ char *acb_firm_version=pACB->firm_version;
-+ char *iop_firm_model=(char *) (&pACB->pmu->message_rwbuffer[15]); /*firm_model,15,60-67*/
-+ char *iop_firm_version=(char *) (&pACB->pmu->message_rwbuffer[17]); /*firm_version,17,68-83*/
-+ int count;
-+
-+ writel(ARCMSR_INBOUND_MESG0_GET_CONFIG,&pACB->pmu->inbound_msgaddr0);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d wait 'get adapter firmware miscellaneous data' timeout \n",pACB->adapter_index);
-+ }
-+ count=8;
-+ while(count)
-+ {
-+ *acb_firm_model=readb(iop_firm_model);
-+ acb_firm_model++;
-+ iop_firm_model++;
-+ count--;
-+ }
-+ count=16;
-+ while(count)
-+ {
-+ *acb_firm_version=readb(iop_firm_version);
-+ acb_firm_version++;
-+ iop_firm_version++;
-+ count--;
-+ }
-+ printk("ARECA RAID ADAPTER%d: FIRMWARE VERSION %s \n",pACB->adapter_index,pACB->firm_version);
-+ if(strncmp(pACB->firm_version,"V1.37",5) < 0)
-+ {
-+ printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-+ printk("!!!!!! PLEASE UPDATE RAID FIRMWARE VERSION EQUAL OR MORE THAN 'V1.37' !!!!!!\n");
-+ printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-+ }
-+ pACB->firm_request_len=readl(&pACB->pmu->message_rwbuffer[1]); /*firm_request_len,1,04-07*/
-+ pACB->firm_numbers_queue=readl(&pACB->pmu->message_rwbuffer[2]); /*firm_numbers_queue,2,08-11*/
-+ pACB->firm_sdram_size=readl(&pACB->pmu->message_rwbuffer[3]); /*firm_sdram_size,3,12-15*/
-+ pACB->firm_ide_channels=readl(&pACB->pmu->message_rwbuffer[4]); /*firm_ide_channels,4,16-19*/
-+ return;
-+}
-+/*
-+**********************************************************************
-+** start background rebulid
-+**********************************************************************
-+*/
-+static void arcmsr_start_adapter_bgrb(struct _ACB *pACB)
-+{
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_start_adapter_bgrb.................................. \n");
-+ #endif
-+ pACB->acb_flags |= ACB_F_MSG_START_BGRB;
-+ pACB->acb_flags &= ~ACB_F_MSG_STOP_BGRB;
-+ writel(ARCMSR_INBOUND_MESG0_START_BGRB,&pACB->pmu->inbound_msgaddr0);
-+ return;
-+}
-+/*
-+**********************************************************************
-+**********************************************************************
-+*/
-+static void arcmsr_polling_ccbdone(struct _ACB *pACB,struct _CCB *poll_ccb)
-+{
-+ struct _CCB *pCCB;
-+ uint32_t flag_ccb,outbound_intstatus,poll_ccb_done=0,poll_count=0;
-+ int id,lun;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_polling_ccbdone.................................. \n");
-+ #endif
-+polling_ccb_retry:
-+ poll_count++;
-+ outbound_intstatus=readl(&pACB->pmu->outbound_intstatus) & pACB->outbound_int_enable;
-+ writel(outbound_intstatus,&pACB->pmu->outbound_intstatus);/*clear interrupt*/
-+ while(1)
-+ {
-+ if((flag_ccb=readl(&pACB->pmu->outbound_queueport))==0xFFFFFFFF)
-+ {
-+ if(poll_ccb_done)
-+ {
-+ break;/*chip FIFO no ccb for completion already*/
-+ }
-+ else
-+ {
-+ arc_mdelay(25);
-+ if(poll_count > 100)
-+ {
-+ break;
-+ }
-+ goto polling_ccb_retry;
-+ }
-+ }
-+ /* check ifcommand done with no error*/
-+ pCCB=(struct _CCB *)(pACB->vir2phy_offset+(flag_ccb << 5));/*frame must be 32 bytes aligned*/
-+ if((pCCB->pACB!=pACB) || (pCCB->startdone!=ARCMSR_CCB_START))
-+ {
-+ if((pCCB->startdone==ARCMSR_CCB_ABORTED) && (pCCB==poll_ccb))
-+ {
-+ printk("arcmsr%d scsi id=%d lun=%d ccb='0x%p' poll command abort successfully \n",pACB->adapter_index,pCCB->pcmd->device->id,pCCB->pcmd->device->lun,pCCB);
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ poll_ccb_done=1;
-+ continue;
-+ }
-+ printk("arcmsr%d polling get an illegal ccb command done ccb='0x%p' ccboutstandingcount=%d \n",pACB->adapter_index,pCCB,atomic_read(&pACB->ccboutstandingcount));
-+ continue;
-+ }
-+ id=pCCB->pcmd->device->id;
-+ lun=pCCB->pcmd->device->lun;
-+ if((flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR)==0)
-+ {
-+ if(pACB->devstate[id][lun]==ARECA_RAID_GONE)
-+ {
-+ pACB->devstate[id][lun]=ARECA_RAID_GOOD;
-+ }
-+ pCCB->pcmd->result=DID_OK << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ else
-+ {
-+ switch(pCCB->arcmsr_cdb.DeviceStatus)
-+ {
-+ case ARCMSR_DEV_SELECT_TIMEOUT:
-+ {
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_TIME_OUT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ case ARCMSR_DEV_ABORTED:
-+ case ARCMSR_DEV_INIT_FAIL:
-+ {
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_BAD_TARGET << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ case SCSISTAT_CHECK_CONDITION:
-+ {
-+ pACB->devstate[id][lun]=ARECA_RAID_GOOD;
-+ arcmsr_report_sense_info(pCCB);
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ break;
-+ default:
-+ /* error occur Q all error ccb to errorccbpending Q*/
-+ printk("arcmsr%d scsi id=%d lun=%d polling and getting command error done, but got unknow DeviceStatus=0x%x \n",pACB->adapter_index,id,lun,pCCB->arcmsr_cdb.DeviceStatus);
-+ pACB->devstate[id][lun]=ARECA_RAID_GONE;
-+ pCCB->pcmd->result=DID_BAD_TARGET << 16;/*unknow error or crc error just for retry*/
-+ arcmsr_ccb_complete(pCCB);
-+ break;
-+ }
-+ }
-+ } /*drain reply FIFO*/
-+ return;
-+}
-+/*
-+**********************************************************************
-+** start background rebulid
-+**********************************************************************
-+*/
-+static void arcmsr_iop_init(struct _ACB *pACB)
-+{
-+ uint32_t intmask_org,mask,outbound_doorbell,firmware_state=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_iop_init.................................. \n");
-+ #endif
-+ do
-+ {
-+ firmware_state=readl(&pACB->pmu->outbound_msgaddr1);
-+ }while((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK)==0);
-+ intmask_org=readl(&pACB->pmu->outbound_intmask);/*change "disable iop interrupt" to arcmsr_initialize*/
-+ arcmsr_get_firmware_spec(pACB);
-+ /*start background rebuild*/
-+ arcmsr_start_adapter_bgrb(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d wait 'start adapter background rebulid' timeout \n",pACB->adapter_index);
-+ }
-+ /* clear Qbuffer if door bell ringed */
-+ outbound_doorbell=readl(&pACB->pmu->outbound_doorbell);
-+ if(outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK)
-+ {
-+ writel(outbound_doorbell,&pACB->pmu->outbound_doorbell);/*clear interrupt */
-+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,&pACB->pmu->inbound_doorbell);
-+ }
-+ /* enable outbound Post Queue,outbound message0,outbell doorbell Interrupt */
-+ mask=~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE|ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE|ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE);
-+ writel(intmask_org & mask,&pACB->pmu->outbound_intmask);
-+ pACB->outbound_int_enable = ~(intmask_org & mask) & 0x000000ff;
-+ pACB->acb_flags |=ACB_F_IOP_INITED;
-+ return;
-+}
-+/*
-+****************************************************************************
-+****************************************************************************
-+*/
-+int arcmsr_bus_reset(struct scsi_cmnd *cmd)
-+{
-+ struct _ACB *pACB;
-+ int retry=0;
-+
-+ pACB=(struct _ACB *) cmd->device->host->hostdata;
-+ printk("arcmsr%d bus reset ..... \n",pACB->adapter_index);
-+ pACB->num_resets++;
-+ pACB->acb_flags |= ACB_F_BUS_RESET;
-+ while(atomic_read(&pACB->ccboutstandingcount)!=0 && retry < 400)
-+ {
-+ arcmsr_interrupt(pACB);
-+ arc_mdelay(25);
-+ retry++;
-+ }
-+ arcmsr_iop_reset(pACB);
-+ pACB->acb_flags &= ~ACB_F_BUS_RESET;
-+ return SUCCESS;
-+}
-+/*
-+*****************************************************************************************
-+*****************************************************************************************
-+*/
-+static int arcmsr_seek_cmd2abort(struct scsi_cmnd *pabortcmd)
-+{
-+ struct _ACB *pACB=(struct _ACB *) pabortcmd->device->host->hostdata;
-+ struct _CCB *pCCB;
-+ uint32_t intmask_org,mask;
-+ int i=0;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_seek_cmd2abort.................. \n");
-+ #endif
-+ pACB->num_aborts++;
-+ /*
-+ *****************************************************************************
-+ ** It is the upper layer do abort command this lock just prior to calling us.
-+ ** First determine if we currently own this command.
-+ ** Start by searching the device queue. If not found
-+ ** at all,and the system wanted us to just abort the
-+ ** command return success.
-+ *****************************************************************************
-+ */
-+ if(atomic_read(&pACB->ccboutstandingcount)!=0)
-+ {
-+ for(i=0;i<ARCMSR_MAX_FREECCB_NUM;i++)
-+ {
-+ pCCB=pACB->pccb_pool[i];
-+ if(pCCB->startdone==ARCMSR_CCB_START)
-+ {
-+ if(pCCB->pcmd==pabortcmd)
-+ {
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ printk("arcmsr%d scsi id=%d lun=%d abort ccb '0x%p' outstanding command \n",pACB->adapter_index,pabortcmd->device->id,pabortcmd->device->lun,pCCB);
-+ goto abort_outstanding_cmd;
-+ }
-+ }
-+ }
-+ }
-+ /*
-+ *************************************************************
-+ ** seek this command at our command list
-+ ** if command found then remove,abort it and free this CCB
-+ *************************************************************
-+ */
-+ if(atomic_read(&pACB->ccbwait2gocount)!=0)
-+ {
-+ for(i=0;i<ARCMSR_MAX_OUTSTANDING_CMD;i++)
-+ {
-+ pCCB=pACB->pccbwait2go[i];
-+ if(pCCB!=NULL)
-+ {
-+ if(pCCB->pcmd==pabortcmd)
-+ {
-+ printk("arcmsr%d scsi id=%d lun=%d abort ccb '0x%p' pending command \n",pACB->adapter_index,pabortcmd->device->id,pabortcmd->device->lun,pCCB);
-+ pACB->pccbwait2go[i]=NULL;
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ atomic_dec(&pACB->ccbwait2gocount);
-+ return(SUCCESS);
-+ }
-+ }
-+ }
-+ }
-+ return (SUCCESS);
-+abort_outstanding_cmd:
-+ /* disable all outbound interrupt */
-+ intmask_org=readl(&pACB->pmu->outbound_intmask);
-+ writel(intmask_org|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,&pACB->pmu->outbound_intmask);
-+ /* do not talk to iop 331 abort command */
-+ arcmsr_polling_ccbdone(pACB,pCCB);
-+ /* enable all outbound interrupt */
-+ mask=~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE|ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE|ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE);
-+ writel(intmask_org & mask,&pACB->pmu->outbound_intmask);
-+ atomic_set(&pACB->ccboutstandingcount,0);
-+ return (SUCCESS);
-+}
-+/*
-+*****************************************************************************************
-+*****************************************************************************************
-+*/
-+int arcmsr_cmd_abort(struct scsi_cmnd *cmd)
-+{
-+ struct _ACB *pACB=(struct _ACB *) cmd->device->host->hostdata;
-+ int error;
-+
-+ printk("arcmsr%d abort device command of scsi id=%d lun=%d \n",pACB->adapter_index,cmd->device->id,cmd->device->lun);
-+ /*
-+ ************************************************
-+ ** the all interrupt service routine is locked
-+ ** we need to handle it as soon as possible and exit
-+ ************************************************
-+ */
-+ error=arcmsr_seek_cmd2abort(cmd);
-+ if(error !=SUCCESS)
-+ {
-+ printk("arcmsr%d abort command failed scsi id=%d lun=%d \n",pACB->adapter_index,cmd->device->id,cmd->device->lun);
-+ }
-+ return (error);
-+}
-+/*
-+*********************************************************************
-+** arcmsr_info()
-+**struct pci_dev {
-+** struct list_head global_list; ## node in list of all PCI devices ##
-+** struct list_head bus_list; ## node in per-bus list ##
-+** struct pci_bus *bus; ## bus this device is on ##
-+** struct pci_bus *subordinate; ## bus this device bridges to ##
-+** void *sysdata; ## hook for sys-specific extension ##
-+** struct proc_dir_entry *procent; ## device entry in /proc/bus/pci ##
-+** unsigned int devfn; ## encoded device & function index ##
-+** unsigned short vendor;
-+** unsigned short device;
-+** unsigned short subsystem_vendor;
-+** unsigned short subsystem_device;
-+** unsigned int class; ## 3 bytes: (base,sub,prog-if) ##
-+** u8 hdr_type; ## PCI header type (`multi' flag masked out) ##
-+** u8 rom_base_reg; ## which config register controls the ROM ##
-+**
-+** struct pci_driver *driver; ## which driver has allocated this device ##
-+** void *driver_data; ## data private to the driver ##
-+** u64 dma_mask; ## Mask of the bits of bus address this device implements. Normally this is
-+** ## 0xffffffff. You only need to change this if your device has broken DMA
-+** ## or supports 64-bit transfers.
-+** u32 current_state; ## Current operating state. In ACPI-speak, this is D0-D3, D0 being fully functional, and D3 being off. ##
-+** unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE]; ## device is compatible with these IDs ##
-+** unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
-+** ##
-+** ##Instead of touching interrupt line and base address registers
-+** ##directly, use the values stored here. They might be different!
-+** ##
-+** unsigned int irq;
-+** struct resource resource[DEVICE_COUNT_RESOURCE]; ## I/O and memory regions + expansion ROMs ##
-+** struct resource dma_resource[DEVICE_COUNT_DMA];
-+** struct resource irq_resource[DEVICE_COUNT_IRQ];
-+** char name[90]; ## device name ##
-+** char slot_name[8]; ## slot name ##
-+** u32 saved_state[16]; ## for saving the config space before suspend ##
-+** int active; ## ISAPnP: device is active ##
-+** int ro; ## ISAPnP: read only ##
-+** unsigned short regs; ## ISAPnP: supported registers ##
-+** ## These fields are used by common fixups ##
-+** unsigned short transparent:1; ## Transparent PCI bridge ##
-+** int (*prepare)(struct pci_dev *dev); ## ISAPnP hooks ##
-+** int (*activate)(struct pci_dev *dev);
-+** int (*deactivate)(struct pci_dev *dev);
-+**};
-+**
-+*********************************************************************
-+*/
-+const char *arcmsr_info(struct Scsi_Host *host)
-+{
-+ static char buf[256];
-+ struct _ACB * pACB;
-+ uint16_t device_id;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_info.............\n");
-+ #endif
-+ pACB=(struct _ACB *) host->hostdata;
-+ device_id=pACB->pPCI_DEV->device;
-+ switch(device_id)
-+ {
-+ case PCIDeviceIDARC1110:
-+ {
-+ sprintf(buf,"ARECA ARC1110 PCI-X 4 PORTS SATA RAID CONTROLLER\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1120:
-+ {
-+ sprintf(buf,"ARECA ARC1120 PCI-X 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1130:
-+ {
-+ sprintf(buf,"ARECA ARC1130 PCI-X 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1160:
-+ {
-+ sprintf(buf,"ARECA ARC1160 PCI-X 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1170:
-+ {
-+ sprintf(buf,"ARECA ARC1170 PCI-X 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1210:
-+ {
-+ sprintf(buf,"ARECA ARC1210 PCI-EXPRESS 4 PORTS SATA RAID CONTROLLER\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1220:
-+ {
-+ sprintf(buf,"ARECA ARC1220 PCI-EXPRESS 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1230:
-+ {
-+ sprintf(buf,"ARECA ARC1230 PCI-EXPRESS 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1260:
-+ {
-+ sprintf(buf,"ARECA ARC1260 PCI-EXPRESS 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ case PCIDeviceIDARC1270:
-+ {
-+ sprintf(buf,"ARECA ARC1270 PCI-EXPRESS 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ default:
-+ {
-+ sprintf(buf,"ARECA X-TYPE SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",ARCMSR_DRIVER_VERSION);
-+ break;
-+ }
-+ }
-+ return buf;
-+}
-+/*
-+************************************************************************
-+************************************************************************
-+*/
-+static int arcmsr_initialize(struct _ACB *pACB,struct pci_dev *pPCI_DEV)
-+{
-+ uint32_t intmask_org,page_base,page_offset,mem_base_start,ccb_phyaddr_hi32;
-+ dma_addr_t dma_addr,dma_coherent_handle;
-+ void *page_remapped;
-+ void *dma_coherent;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ uint8_t pcicmd;
-+ int i,j;
-+ struct _CCB *pccb_tmp;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_initialize....................................\n");
-+ #endif
-+ /* Enable Busmaster/Mem */
-+ pci_read_config_byte(pPCI_DEV,PCI_COMMAND,&pcicmd);
-+ pci_write_config_byte(pPCI_DEV,PCI_COMMAND,pcicmd|PCI_COMMAND_INVALIDATE|PCI_COMMAND_MASTER|PCI_COMMAND_MEMORY);
-+ mem_base_start=(uint32_t)arcget_pcicfg_base(pPCI_DEV,0);
-+ page_base=mem_base_start & PAGE_MASK;
-+ page_offset=mem_base_start - page_base;
-+ page_remapped=ioremap(page_base,page_offset + 0x1FFF);
-+ if( page_remapped==NULL )
-+ {
-+ printk("arcmsr%d memory mapping region fail \n",arcmsr_adapterCnt);
-+ return(ENXIO);
-+ }
-+ pACB->pmu=(PMU)(page_remapped+page_offset);
-+ pACB->acb_flags |= (ACB_F_IOCTL_WQBUFFER_CLEARED|ACB_F_IOCTL_RQBUFFER_CLEARED);
-+ pACB->acb_flags &= ~ACB_F_SCSISTOPADAPTER;
-+ pACB->irq=pPCI_DEV->irq;
-+ /*
-+ *******************************************************************************
-+ ** Allocate the pccb_pool memory
-+ ** Attempt to claim larger area for request queue pCCB).
-+ *******************************************************************************
-+ */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ dma_coherent = dma_alloc_coherent(&pPCI_DEV->dev, ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB) + 0x20, &dma_coherent_handle, GFP_KERNEL);
-+#else
-+ dma_coherent = pci_alloc_consistent(pPCI_DEV, ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB) + 0x20, &dma_coherent_handle);
-+#endif
-+ if (dma_coherent == NULL)
-+ {
-+ printk("arcmsr%d dma_alloc_coherent got error \n",arcmsr_adapterCnt);
-+ return -ENOMEM;
-+ }
-+ pACB->dma_coherent=dma_coherent;
-+ pACB->dma_coherent_handle=dma_coherent_handle;
-+ memset(dma_coherent, 0, ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB)+0x20);
-+ if(((unsigned long)dma_coherent & 0x1F)!=0) /*ccb address must 32 (0x20) boundary*/
-+ {
-+ dma_coherent=dma_coherent+(0x20-((unsigned long)dma_coherent & 0x1F));
-+ dma_coherent_handle=dma_coherent_handle+(0x20-((unsigned long)dma_coherent_handle & 0x1F));
-+ }
-+ dma_addr=dma_coherent_handle;
-+ pccb_tmp=(struct _CCB *)dma_coherent;
-+ for(i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++)
-+ {
-+ pccb_tmp->cdb_shifted_phyaddr=dma_addr >> 5;
-+ pccb_tmp->pACB=pACB;
-+ pACB->pccbringQ[i]=pACB->pccb_pool[i]=pccb_tmp;
-+ dma_addr=dma_addr+sizeof(struct _CCB);
-+ pccb_tmp++;
-+ }
-+ pACB->vir2phy_offset=(unsigned long)pccb_tmp-(unsigned long)dma_addr;
-+ /*
-+ ********************************************************************
-+ ** init raid volume state
-+ ********************************************************************
-+ */
-+ for(i=0;i<ARCMSR_MAX_TARGETID;i++)
-+ {
-+ for(j=0;j<ARCMSR_MAX_TARGETLUN;j++)
-+ {
-+ pACB->devstate[i][j]=ARECA_RAID_GOOD;
-+ }
-+ }
-+ /*
-+ ********************************************************************
-+ ** here we need to tell iop 331 our pccb_tmp.HighPart
-+ ** if pccb_tmp.HighPart is not zero
-+ ********************************************************************
-+ */
-+ ccb_phyaddr_hi32=(uint32_t) ((dma_coherent_handle>>16)>>16);
-+ if(ccb_phyaddr_hi32!=0)
-+ {
-+ writel(ARCMSR_SIGNATURE_SET_CONFIG,&pACB->pmu->message_rwbuffer[0]);
-+ writel(ccb_phyaddr_hi32,&pACB->pmu->message_rwbuffer[1]);
-+ writel(ARCMSR_INBOUND_MESG0_SET_CONFIG,&pACB->pmu->inbound_msgaddr0);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d 'set ccb high part physical address' timeout \n",arcmsr_adapterCnt);
-+ }
-+ }
-+ pACB->adapter_index=arcmsr_adapterCnt;
-+ pHCBARC->pACB[arcmsr_adapterCnt]=pACB;
-+ /* disable iop all outbound interrupt */
-+ intmask_org=readl(&pACB->pmu->outbound_intmask);
-+ writel(intmask_org|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,&pACB->pmu->outbound_intmask);
-+ arcmsr_adapterCnt++;
-+ return(0);
-+}
-+/*
-+*********************************************************************
-+*********************************************************************
-+*/
-+static int arcmsr_set_info(char *buffer,int length)
-+{
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_set_info.............\n");
-+ #endif
-+ return (0);
-+}
-+/*
-+*********************************************************************
-+*********************************************************************
-+*/
-+static void arcmsr_pcidev_disattach(struct _ACB *pACB)
-+{
-+ struct _CCB *pCCB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ uint32_t intmask_org;
-+ int i=0,poll_count=0;
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_pcidev_disattach.................. \n");
-+ #endif
-+ /* disable all outbound interrupt */
-+ intmask_org=readl(&pACB->pmu->outbound_intmask);
-+ writel(intmask_org|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,&pACB->pmu->outbound_intmask);
-+ /* stop adapter background rebuild */
-+ arcmsr_stop_adapter_bgrb(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d pcidev disattach wait 'stop adapter rebulid' timeout \n",pACB->adapter_index);
-+ }
-+ arcmsr_flush_adapter_cache(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d pcidev disattach wait 'flush adapter cache' timeout \n",pACB->adapter_index);
-+ }
-+ /* abort all outstanding command */
-+ pACB->acb_flags |= ACB_F_SCSISTOPADAPTER;
-+ pACB->acb_flags &= ~ACB_F_IOP_INITED;
-+ if(atomic_read(&pACB->ccboutstandingcount)!=0)
-+ {
-+ while(atomic_read(&pACB->ccboutstandingcount)!=0 && (poll_count < 256))
-+ {
-+ arcmsr_interrupt(pACB);
-+ arc_mdelay(25);
-+ poll_count++;
-+ }
-+ if(atomic_read(&pACB->ccboutstandingcount)!=0)
-+ {
-+ /* talk to iop 331 outstanding command aborted*/
-+ arcmsr_abort_allcmd(pACB);
-+ if(arcmsr_wait_msgint_ready(pACB))
-+ {
-+ printk("arcmsr%d pcidev disattach wait 'abort all outstanding command' timeout \n",pACB->adapter_index);
-+ }
-+ /*clear all outbound posted Q*/
-+ for(i=0;i<ARCMSR_MAX_OUTSTANDING_CMD;i++)
-+ {
-+ readl(&pACB->pmu->outbound_queueport);
-+ }
-+ for(i=0;i<ARCMSR_MAX_FREECCB_NUM;i++)
-+ {
-+ pCCB=pACB->pccb_pool[i];
-+ if(pCCB->startdone==ARCMSR_CCB_START)
-+ {
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ }
-+ }
-+ }
-+ }
-+ if(atomic_read(&pACB->ccbwait2gocount)!=0)
-+ { /*remove first wait2go ccb and abort it*/
-+ for(i=0;i<ARCMSR_MAX_OUTSTANDING_CMD;i++)
-+ {
-+ pCCB=pACB->pccbwait2go[i];
-+ if(pCCB!=NULL)
-+ {
-+ pACB->pccbwait2go[i]=NULL;
-+ pCCB->startdone=ARCMSR_CCB_ABORTED;
-+ pCCB->pcmd->result=DID_ABORT << 16;
-+ arcmsr_ccb_complete(pCCB);
-+ atomic_dec(&pACB->ccbwait2gocount);
-+ }
-+ }
-+ }
-+ atomic_set(&pACB->ccboutstandingcount,0);
-+ free_irq(pACB->pPCI_DEV->irq,pACB);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ pci_release_regions(pACB->pPCI_DEV);
-+#endif
-+ iounmap(pACB->pmu);
-+ arcmsr_free_pci_pool(pACB);
-+ pHCBARC->pACB[pACB->adapter_index]=0; /* clear record */
-+ arcmsr_adapterCnt--;
-+ return;
-+}
-+/*
-+***************************************************************
-+***************************************************************
-+*/
-+static int arcmsr_halt_notify(struct notifier_block *nb,unsigned long event,void *buf)
-+{
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ struct Scsi_Host *host;
-+ int i;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_halt_notify............................1 \n");
-+ #endif
-+ if((event !=SYS_RESTART) && (event !=SYS_HALT) && (event !=SYS_POWER_OFF))
-+ {
-+ return NOTIFY_DONE;
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ pACB=pHCBARC->pACB[i];
-+ if(pACB==NULL)
-+ {
-+ continue;
-+ }
-+ /* Flush cache to disk */
-+ /* Free irq,otherwise extra interrupt is generated */
-+ /* Issue a blocking(interrupts disabled) command to the card */
-+ host=pACB->host;
-+ arcmsr_pcidev_disattach(pACB);
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ scsi_remove_host(host);
-+ scsi_host_put(host);
-+ #else
-+ scsi_unregister(host);
-+ #endif
-+ }
-+ unregister_chrdev(pHCBARC->arcmsr_major_number, "arcmsr");
-+ unregister_reboot_notifier(&arcmsr_event_notifier);
-+ return NOTIFY_OK;
-+}
-+/*
-+*********************************************************************
-+*********************************************************************
-+*/
-+#undef SPRINTF
-+#define SPRINTF(args...) pos +=sprintf(pos,## args)
-+#define YESNO(YN)\
-+if(YN) SPRINTF(" Yes ");\
-+else SPRINTF(" No ")
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ int arcmsr_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout)
-+#else
-+ int arcmsr_proc_info(char * buffer,char ** start,off_t offset,int length,int hostno,int inout)
-+#endif
-+{
-+ uint8_t i;
-+ char * pos=buffer;
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_proc_info.............\n");
-+ #endif
-+ if(inout)
-+ {
-+ return(arcmsr_set_info(buffer,length));
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ pACB=pHCBARC->pACB[i];
-+ if(pACB==NULL)
-+ continue;
-+ SPRINTF("ARECA SATA RAID Mass Storage Host Adadpter \n");
-+ SPRINTF("Driver Version %s ",ARCMSR_DRIVER_VERSION);
-+ SPRINTF("IRQ%d \n",pACB->pPCI_DEV->irq);
-+ SPRINTF("===========================\n");
-+ }
-+ *start=buffer + offset;
-+ if(pos - buffer < offset)
-+ {
-+ return 0;
-+ }
-+ else if(pos - buffer - offset < length)
-+ {
-+ return (pos - buffer - offset);
-+ }
-+ else
-+ {
-+ return length;
-+ }
-+}
-+/*
-+************************************************************************
-+************************************************************************
-+*/
-+int arcmsr_release(struct Scsi_Host *host)
-+{
-+ struct _ACB *pACB;
-+ struct _HCBARC *pHCBARC= &arcmsr_host_control_block;
-+ uint8_t match=0xff,i;
-+
-+ #if ARCMSR_DEBUG
-+ printk("arcmsr_release...........................\n");
-+ #endif
-+ if(host==NULL)
-+ {
-+ return -ENXIO;
-+ }
-+ pACB=(struct _ACB *)host->hostdata;
-+ if(pACB==NULL)
-+ {
-+ return -ENXIO;
-+ }
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if(pHCBARC->pACB[i]==pACB)
-+ {
-+ match=i;
-+ }
-+ }
-+ if(match==0xff)
-+ {
-+ return -ENXIO;
-+ }
-+ /* Flush cache to disk */
-+ /* Free irq,otherwise extra interrupt is generated */
-+ /* Issue a blocking(interrupts disabled) command to the card */
-+ arcmsr_pcidev_disattach(pACB);
-+ scsi_unregister(host);
-+ /*if this is last pACB */
-+ for(i=0;i<ARCMSR_MAX_ADAPTER;i++)
-+ {
-+ if(pHCBARC->pACB[i]!=NULL)
-+ {
-+ return(0);/* this is not last adapter's release */
-+ }
-+ }
-+ unregister_chrdev(pHCBARC->arcmsr_major_number, "arcmsr");
-+ unregister_reboot_notifier(&arcmsr_event_notifier);
-+ return(0);
-+}
-+
-diff -Nurap ./drivers/scsi/arcmsr.arcmsr/arcmsr.h ./drivers/scsi/arcmsr/arcmsr.h
---- ./drivers/scsi/arcmsr.arcmsr/arcmsr.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/arcmsr/arcmsr.h 2006-08-31 14:59:54.000000000 +0400
-@@ -0,0 +1,4999 @@
-+/*
-+***********************************************************************************************
-+** O.S : Linux
-+** FILE NAME : arcmsr.h
-+** BY : Erich Chen
-+** Description: SCSI RAID Device Driver for
-+** ARCMSR RAID Host adapter
-+***********************************************************************************************
-+** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved.
-+**
-+** Web site: www.areca.com.tw
-+** E-mail: erich@areca.com.tw
-+**
-+** This program is free software; you can redistribute it and/or modify
-+** it under the terms of the GNU General Public License version 2 as
-+** published by the Free Software Foundation.
-+** This program is distributed in the hope that it will be useful,
-+** but WITHOUT ANY WARRANTY; without even the implied warranty of
-+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+** GNU General Public License for more details.
-+************************************************************************
-+** Redistribution and use in source and binary forms,with or without
-+** modification,are permitted provided that the following conditions
-+** are met:
-+** 1. Redistributions of source code must retain the above copyright
-+** notice,this list of conditions and the following disclaimer.
-+** 2. Redistributions in binary form must reproduce the above copyright
-+** notice,this list of conditions and the following disclaimer in the
-+** documentation and/or other materials provided with the distribution.
-+** 3. The name of the author may not be used to endorse or promote products
-+** derived from this software without specific prior written permission.
-+**
-+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-+** IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,THE IMPLIED WARRANTIES
-+** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,INDIRECT,
-+** INCIDENTAL,SPECIAL,EXEMPLARY,OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT
-+** NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+** DATA,OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
-+** THEORY OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
-+**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
-+** THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+**************************************************************************
-+*/
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#ifndef KERNEL_VERSION
-+ #define KERNEL_VERSION(V, P, S) (((V) << 16) + ((P) << 8) + (S))
-+#endif
-+#if defined(__SMP__) && !defined(CONFIG_SMP)
-+ #define CONFIG_SMP
-+#endif
-+/*
-+**********************************************************************************
-+**
-+**********************************************************************************
-+*/
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ #define ARCMSR_MAX_OUTSTANDING_CMD 256
-+ #define ARCMSR_MAX_FREECCB_NUM 320
-+#else
-+ #define ARCMSR_MAX_OUTSTANDING_CMD 230
-+ #define ARCMSR_MAX_FREECCB_NUM 240
-+#endif
-+#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.0X.12"
-+#define ARCMSR_SCSI_INITIATOR_ID 16
-+#define ARCMSR_DEV_SECTOR_SIZE 512
-+#define ARCMSR_MAX_XFER_SECTORS 256
-+#define ARCMSR_MAX_XFER_LEN ARCMSR_MAX_XFER_SECTORS * ARCMSR_DEV_SECTOR_SIZE /*128k*/
-+#define ARCMSR_MAX_TARGETID 16 /*16 max target id + 1*/
-+#define ARCMSR_MAX_TARGETLUN 8 /*8*/
-+#define ARCMSR_MAX_CHIPTYPE_NUM 4
-+#define ARCMSR_MAX_CMD_PERLUN ARCMSR_MAX_OUTSTANDING_CMD /* if eq. 256 will kernel panic at 2.2.x */
-+#define ARCMSR_MAX_DPC 16 /* defer procedure call */
-+#define ARCMSR_MAX_QBUFFER 4096 /* ioctl QBUFFER */
-+#define ARCMSR_MAX_SG_ENTRIES 38 /* max 38*/
-+#define ARCMSR_MAX_ADAPTER 4
-+/*
-+**********************************************************************************
-+**
-+**********************************************************************************
-+*/
-+#define PCIVendorIDARECA 0x17D3 /* Vendor ID */
-+#define PCIDeviceIDARC1110 0x1110 /* Device ID */
-+#define PCIDeviceIDARC1120 0x1120 /* Device ID */
-+#define PCIDeviceIDARC1130 0x1130 /* Device ID */
-+#define PCIDeviceIDARC1160 0x1160 /* Device ID */
-+#define PCIDeviceIDARC1170 0x1170 /* Device ID */
-+#define PCIDeviceIDARC1210 0x1210 /* Device ID */
-+#define PCIDeviceIDARC1220 0x1220 /* Device ID */
-+#define PCIDeviceIDARC1230 0x1230 /* Device ID */
-+#define PCIDeviceIDARC1260 0x1260 /* Device ID */
-+#define PCIDeviceIDARC1270 0x1270 /* Device ID */
-+/*
-+**********************************************************************************
-+**
-+**********************************************************************************
-+*/
-+#define dma_addr_hi32(addr) (uint32_t) ((addr>>16)>>16)
-+#define dma_addr_lo32(addr) (uint32_t) (addr & 0xffffffff)
-+
-+#ifndef DMA_64BIT_MASK
-+ #define DMA_64BIT_MASK 0xffffffffffffffffULL
-+ #define DMA_32BIT_MASK 0x00000000ffffffffULL
-+#endif
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,10)
-+ #define arcget_pcicfg_base(pdev,n) pci_resource_start(pdev,n)
-+#else
-+ #define arcget_pcicfg_base(pdev,n) pdev->base_address[n] & PCI_BASE_ADDRESS_MEM_MASK
-+#endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30)
-+
-+ #if (BITS_PER_LONG == 64)
-+ typedef u64 dma_addr_t;
-+ #else
-+ typedef u32 dma_addr_t;
-+ #endif
-+
-+ static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
-+ {
-+ void *virt_ptr;
-+
-+ virt_ptr = kmalloc(size, GFP_KERNEL);
-+ *dma_handle = virt_to_bus(virt_ptr);
-+ return virt_ptr;
-+ }
-+ #define pci_free_consistent(cookie, size, ptr, dma_ptr) kfree(ptr)
-+ #define pci_map_single(cookie, address, size, dir) virt_to_bus(address)
-+ #define pci_unmap_single(cookie, address, size, dir)
-+#endif
-+#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,9)
-+ #define arc_mdelay(msec) msleep(msec)
-+ #define arc_mdelay_int(msec) msleep_interruptible(msec)
-+#else
-+ #define arc_mdelay(msec) mdelay(msec)
-+ #define arc_mdelay_int(msec) mdelay(msec)
-+#endif
-+/*
-+************************************************************************
-+** IOCTL CONTROL CODE
-+************************************************************************
-+*/
-+typedef struct _CMD_IO_CONTROL
-+{
-+ uint32_t HeaderLength;
-+ uint8_t Signature[8];
-+ uint32_t Timeout;
-+ uint32_t ControlCode;
-+ uint32_t ReturnCode;
-+ uint32_t Length;
-+}CMD_IO_CONTROL,*PCMD_IO_CONTROL;
-+/*
-+************************************************************************************************************
-+**
-+************************************************************************************************************
-+*/
-+typedef struct _CMD_IOCTL_FIELD
-+{
-+ CMD_IO_CONTROL cmdioctl; /*ioctl header*/
-+ uint8_t ioctldatabuffer[1032];/*areca gui program does not accept more than 1031 byte*/
-+}CMD_IOCTL_FIELD,*PCMD_IOCTL_FIELD;
-+/*error code for StorPortLogError,ScsiPortLogError*/
-+#define ARCMSR_IOP_ERROR_ILLEGALPCI 0x0001
-+#define ARCMSR_IOP_ERROR_VENDORID 0x0002
-+#define ARCMSR_IOP_ERROR_DEVICEID 0x0002
-+#define ARCMSR_IOP_ERROR_ILLEGALCDB 0x0003
-+#define ARCMSR_IOP_ERROR_UNKNOW_CDBERR 0x0004
-+#define ARCMSR_SYS_ERROR_MEMORY_ALLOCATE 0x0005
-+#define ARCMSR_SYS_ERROR_MEMORY_CROSS4G 0x0006
-+#define ARCMSR_SYS_ERROR_MEMORY_LACK 0x0007
-+#define ARCMSR_SYS_ERROR_MEMORY_RANGE 0x0008
-+#define ARCMSR_SYS_ERROR_DEVICE_BASE 0x0009
-+#define ARCMSR_SYS_ERROR_PORT_VALIDATE 0x000A
-+/*DeviceType*/
-+#define ARECA_SATA_RAID 0x90000000
-+/*FunctionCode*/
-+#define FUNCTION_READ_RQBUFFER 0x0801
-+#define FUNCTION_WRITE_WQBUFFER 0x0802
-+#define FUNCTION_CLEAR_RQBUFFER 0x0803
-+#define FUNCTION_CLEAR_WQBUFFER 0x0804
-+#define FUNCTION_CLEAR_ALLQBUFFER 0x0805
-+#define FUNCTION_RETURN_CODE_3F 0x0806
-+#define FUNCTION_SAY_HELLO 0x0807
-+#define FUNCTION_SAY_GOODBYE 0x0808
-+#define FUNCTION_FLUSH_ADAPTER_CACHE 0x0809
-+/* ARECA IO CONTROL CODE*/
-+#define ARCMSR_IOCTL_READ_RQBUFFER ARECA_SATA_RAID | FUNCTION_READ_RQBUFFER
-+#define ARCMSR_IOCTL_WRITE_WQBUFFER ARECA_SATA_RAID | FUNCTION_WRITE_WQBUFFER
-+#define ARCMSR_IOCTL_CLEAR_RQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_RQBUFFER
-+#define ARCMSR_IOCTL_CLEAR_WQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_WQBUFFER
-+#define ARCMSR_IOCTL_CLEAR_ALLQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_ALLQBUFFER
-+#define ARCMSR_IOCTL_RETURN_CODE_3F ARECA_SATA_RAID | FUNCTION_RETURN_CODE_3F
-+#define ARCMSR_IOCTL_SAY_HELLO ARECA_SATA_RAID | FUNCTION_SAY_HELLO
-+#define ARCMSR_IOCTL_SAY_GOODBYE ARECA_SATA_RAID | FUNCTION_SAY_GOODBYE
-+#define ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE ARECA_SATA_RAID | FUNCTION_FLUSH_ADAPTER_CACHE
-+/* ARECA IOCTL ReturnCode */
-+#define ARCMSR_IOCTL_RETURNCODE_OK 0x00000001
-+#define ARCMSR_IOCTL_RETURNCODE_ERROR 0x00000006
-+#define ARCMSR_IOCTL_RETURNCODE_3F 0x0000003F
-+/*
-+*************************************************************
-+** structure for holding DMA address data
-+*************************************************************
-+*/
-+#define IS_SG64_ADDR 0x01000000 /* bit24 */
-+typedef struct _SG32ENTRY /* size 8 bytes */
-+{ /* length bit 24 == 0 */
-+ uint32_t length; /* high 8 bit == flag,low 24 bit == length */
-+ uint32_t address;
-+}SG32ENTRY,*PSG32ENTRY;
-+typedef struct _SG64ENTRY /* size 12 bytes */
-+{ /* length bit 24 == 1 */
-+ uint32_t length; /* high 8 bit == flag,low 24 bit == length */
-+ uint32_t address;
-+ uint32_t addresshigh;
-+}SG64ENTRY,*PSG64ENTRY;
-+typedef struct _SGENTRY_UNION
-+{
-+ union
-+ {
-+ SG32ENTRY sg32entry; /* 30h Scatter gather address */
-+ SG64ENTRY sg64entry; /* 30h */
-+ }u;
-+}SGENTRY_UNION,*PSGENTRY_UNION;
-+/*
-+*************************************************************
-+**
-+*************************************************************
-+*/
-+typedef struct _ARCMSR_PCIINFO
-+{
-+ uint16_t vendor_id;
-+ uint16_t device_id;
-+ uint16_t irq;
-+ uint16_t reserved;
-+}ARCMSR_PCIINFO,*PARCMSR_PCIINFO;
-+/*
-+**********************************
-+** Inquiry Data format
-+** typedef struct _INQUIRYDATA
-+** {
-+** uint8_t DeviceType : 5;
-+** uint8_t DeviceTypeQualifier : 3;
-+** uint8_t DeviceTypeModifier : 7;
-+** uint8_t RemovableMedia : 1;
-+** uint8_t Versions;
-+** uint8_t ResponseDataFormat : 4;
-+** uint8_t HiSupport : 1;
-+** uint8_t NormACA : 1;
-+** uint8_t ReservedBit : 1;
-+** uint8_t AERC : 1;
-+** uint8_t AdditionalLength;
-+** uint8_t Reserved[2];
-+** uint8_t SoftReset : 1;
-+** uint8_t CommandQueue : 1;
-+** uint8_t Reserved2 : 1;
-+** uint8_t LinkedCommands : 1;
-+** uint8_t Synchronous : 1;
-+** uint8_t Wide16Bit : 1;
-+** uint8_t Wide32Bit : 1;
-+** uint8_t RelativeAddressing : 1;
-+** uint8_t VendorId[8];
-+** uint8_t ProductId[16];
-+** uint8_t ProductRevisionLevel[4];
-+** uint8_t VendorSpecific[20];
-+** uint8_t Reserved3[40];
-+** } INQUIRYDATA, *PINQUIRYDATA;
-+**********************************
-+*/
-+typedef struct _QBUFFER
-+{
-+ uint32_t data_len;
-+ uint8_t data[124];
-+}QBUFFER,*PQBUFFER;
-+/*
-+************************************************************************************************
-+** FIRMWARE INFO
-+************************************************************************************************
-+*/
-+typedef struct _FIRMWARE_INFO
-+{
-+ uint32_t signature; /*0,00-03*/
-+ uint32_t request_len; /*1,04-07*/
-+ uint32_t numbers_queue; /*2,08-11*/
-+ uint32_t sdram_size; /*3,12-15*/
-+ uint32_t ide_channels; /*4,16-19*/
-+ char vendor[40]; /*5,20-59*/
-+ char model[8]; /*15,60-67*/
-+ char firmware_ver[16]; /*17,68-83*/
-+ char device_map[16]; /*21,84-99*/
-+}FIRMWARE_INFO,*PFIRMWARE_INFO;
-+/*
-+************************************************************************************************
-+** ARECA FIRMWARE SPEC
-+************************************************************************************************
-+** Usage of IOP331 adapter
-+** (All In/Out is in IOP331's view)
-+** 1. Message 0 --> InitThread message and retrun code
-+** 2. Doorbell is used for RS-232 emulation
-+** inDoorBell : bit0 -- data in ready (DRIVER DATA WRITE OK)
-+** bit1 -- data out has been read (DRIVER DATA READ OK)
-+** outDooeBell: bit0 -- data out ready (IOP331 DATA WRITE OK)
-+** bit1 -- data in has been read (IOP331 DATA READ OK)
-+** 3. Index Memory Usage
-+** offset 0xf00 : for RS232 out (request buffer)
-+** offset 0xe00 : for RS232 in (scratch buffer)
-+** offset 0xa00 : for inbound message code message_rwbuffer (driver to IOP331)
-+** offset 0xa00 : for outbound message code message_rwbuffer (IOP331 to driver)
-+** 4. RS-232 emulation
-+** Currently 128 byte buffer is used
-+** 1st uint32_t : Data length (1--124)
-+** Byte 4--127 : Max 124 bytes of data
-+** 5. PostQ
-+** All SCSI Command must be sent through postQ:
-+** (inbound queue port) Request frame must be 32 bytes aligned
-+** # bit27--bit31 => flag for post ccb
-+** # bit0--bit26 => real address (bit27--bit31) of post arcmsr_cdb
-+** bit31 : 0 : 256 bytes frame
-+** 1 : 512 bytes frame
-+** bit30 : 0 : normal request
-+** 1 : BIOS request
-+** bit29 : reserved
-+** bit28 : reserved
-+** bit27 : reserved
-+** -------------------------------------------------------------------------------
-+** (outbount queue port) Request reply
-+** # bit27--bit31 => flag for reply
-+** # bit0--bit26 => real address (bit27--bit31) of reply arcmsr_cdb
-+** bit31 : must be 0 (for this type of reply)
-+** bit30 : reserved for BIOS handshake
-+** bit29 : reserved
-+** bit28 : 0 : no error, ignore AdapStatus/DevStatus/SenseData
-+** 1 : Error, error code in AdapStatus/DevStatus/SenseData
-+** bit27 : reserved
-+** 6. BIOS request
-+** All BIOS request is the same with request from PostQ
-+** Except :
-+** Request frame is sent from configuration space
-+** offset: 0x78 : Request Frame (bit30 == 1)
-+** offset: 0x18 : writeonly to generate IRQ to IOP331
-+** Completion of request:
-+** (bit30 == 0, bit28==err flag)
-+** 7. Definition of SGL entry (structure)
-+** 8. Message1 Out - Diag Status Code (????)
-+** 9. Message0 message code :
-+** 0x00 : NOP
-+** 0x01 : Get Config ->offset 0xa00 :for outbound message code message_rwbuffer (IOP331 to driver)
-+** Signature 0x87974060(4)
-+** Request len 0x00000200(4)
-+** # of queue 0x00000100(4)
-+** SDRAM Size 0x00000100(4)-->256 MB
-+** IDE Channels 0x00000008(4)
-+** vendor 40 bytes char
-+** model 8 bytes char
-+** FirmVer 16 bytes char
-+** Device Map 16 Bytes
-+** FirmwareVersion DWORD <== Added for checking of new firmware capability
-+** 0x02 : Set Config ->offset 0xa00 : for inbound message code message_rwbuffer (driver to IOP331)
-+** Signature 0x87974063(4)
-+** UPPER32 of Request Frame (4)-->Driver Only
-+** 0x03 : Reset (Abort all queued Command)
-+** 0x04 : Stop Background Activity
-+** 0x05 : Flush Cache
-+** 0x06 : Start Background Activity (re-start if background is halted)
-+** 0x07 : Check If Host Command Pending (Novell May Need This Function)
-+** 0x08 : Set controller time ->offset 0xa00 : for inbound message code message_rwbuffer (driver to IOP331)
-+** byte 0 : 0xaa <-- signature
-+** byte 1 : 0x55 <-- signature
-+** byte 2 : year (04)
-+** byte 3 : month (1..12)
-+** byte 4 : date (1..31)
-+** byte 5 : hour (0..23)
-+** byte 6 : minute (0..59)
-+** byte 7 : second (0..59)
-+************************************************************************************************
-+*/
-+/* signature of set and get firmware config */
-+#define ARCMSR_SIGNATURE_GET_CONFIG 0x87974060
-+#define ARCMSR_SIGNATURE_SET_CONFIG 0x87974063
-+/* message code of inbound message register */
-+#define ARCMSR_INBOUND_MESG0_NOP 0x00000000
-+#define ARCMSR_INBOUND_MESG0_GET_CONFIG 0x00000001
-+#define ARCMSR_INBOUND_MESG0_SET_CONFIG 0x00000002
-+#define ARCMSR_INBOUND_MESG0_ABORT_CMD 0x00000003
-+#define ARCMSR_INBOUND_MESG0_STOP_BGRB 0x00000004
-+#define ARCMSR_INBOUND_MESG0_FLUSH_CACHE 0x00000005
-+#define ARCMSR_INBOUND_MESG0_START_BGRB 0x00000006
-+#define ARCMSR_INBOUND_MESG0_CHK331PENDING 0x00000007
-+#define ARCMSR_INBOUND_MESG0_SYNC_TIMER 0x00000008
-+/* doorbell interrupt generator */
-+#define ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK 0x00000001
-+#define ARCMSR_INBOUND_DRIVER_DATA_READ_OK 0x00000002
-+#define ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK 0x00000001
-+#define ARCMSR_OUTBOUND_IOP331_DATA_READ_OK 0x00000002
-+/* ccb areca cdb flag */
-+#define ARCMSR_CCBPOST_FLAG_SGL_BSIZE 0x80000000
-+#define ARCMSR_CCBPOST_FLAG_IAM_BIOS 0x40000000
-+#define ARCMSR_CCBREPLY_FLAG_IAM_BIOS 0x40000000
-+#define ARCMSR_CCBREPLY_FLAG_ERROR 0x10000000
-+/* outbound firmware ok */
-+#define ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK 0x80000000
-+/*
-+************************************************************************************************
-+** size 0x1F8 (504)
-+************************************************************************************************
-+*/
-+typedef struct _ARCMSR_CDB
-+{
-+ uint8_t Bus; /* 00h should be 0 */
-+ uint8_t TargetID; /* 01h should be 0--15 */
-+ uint8_t LUN; /* 02h should be 0--7 */
-+ uint8_t Function; /* 03h should be 1 */
-+
-+ uint8_t CdbLength; /* 04h not used now */
-+ uint8_t sgcount; /* 05h */
-+ uint8_t Flags; /* 06h */
-+#define ARCMSR_CDB_FLAG_SGL_BSIZE 0x01 /* bit 0: 0(256) / 1(512) bytes */
-+#define ARCMSR_CDB_FLAG_BIOS 0x02 /* bit 1: 0(from driver) / 1(from BIOS) */
-+#define ARCMSR_CDB_FLAG_WRITE 0x04 /* bit 2: 0(Data in) / 1(Data out) */
-+#define ARCMSR_CDB_FLAG_SIMPLEQ 0x00 /* bit 4/3 ,00 : simple Q,01 : head of Q,10 : ordered Q */
-+#define ARCMSR_CDB_FLAG_HEADQ 0x08
-+#define ARCMSR_CDB_FLAG_ORDEREDQ 0x10
-+ uint8_t Reserved1; /* 07h */
-+
-+ uint32_t Context; /* 08h Address of this request */
-+ uint32_t DataLength; /* 0ch not used now */
-+
-+ uint8_t Cdb[16]; /* 10h SCSI CDB */
-+ /*
-+ ********************************************************
-+ **Device Status : the same from SCSI bus if error occur
-+ ** SCSI bus status codes.
-+ ********************************************************
-+ */
-+ uint8_t DeviceStatus; /* 20h if error */
-+#define SCSISTAT_GOOD 0x00
-+#define SCSISTAT_CHECK_CONDITION 0x02
-+#define SCSISTAT_CONDITION_MET 0x04
-+#define SCSISTAT_BUSY 0x08
-+#define SCSISTAT_INTERMEDIATE 0x10
-+#define SCSISTAT_INTERMEDIATE_COND_MET 0x14
-+#define SCSISTAT_RESERVATION_CONFLICT 0x18
-+#define SCSISTAT_COMMAND_TERMINATED 0x22
-+#define SCSISTAT_QUEUE_FULL 0x28
-+#define ARCMSR_DEV_SELECT_TIMEOUT 0xF0
-+#define ARCMSR_DEV_ABORTED 0xF1
-+#define ARCMSR_DEV_INIT_FAIL 0xF2
-+
-+ uint8_t SenseData[15]; /* 21h output */
-+
-+ union
-+ {
-+ SG32ENTRY sg32entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h Scatter gather address */
-+ SG64ENTRY sg64entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h */
-+ } u;
-+}ARCMSR_CDB,*PARCMSR_CDB;
-+/*
-+*********************************************************************
-+** Command Control Block (SrbExtension)
-+** CCB must be not cross page boundary,and the order from offset 0
-+** structure describing an ATA disk request
-+** this CCB length must be 32 bytes boundary
-+*********************************************************************
-+*/
-+typedef struct _CCB
-+{
-+ ARCMSR_CDB arcmsr_cdb; /* 0-503 (size of CDB=504): arcmsr messenger scsi command descriptor size 504 bytes */
-+ uint32_t cdb_shifted_phyaddr; /* 504-507 */
-+ uint32_t reserved1; /* 508-511 */
-+ /* ======================512+32 bytes======================== */
-+#if BITS_PER_LONG == 64
-+ struct scsi_cmnd * pcmd; /* 512-515 516-519 pointer of linux scsi command */
-+ struct _ACB * pACB; /* 520-523 524-27 */
-+
-+ uint16_t ccb_flags; /* 528-529 */
-+ #define CCB_FLAG_READ 0x0000
-+ #define CCB_FLAG_WRITE 0x0001
-+ #define CCB_FLAG_ERROR 0x0002
-+ #define CCB_FLAG_FLUSHCACHE 0x0004
-+ #define CCB_FLAG_MASTER_ABORTED 0x0008
-+ uint16_t startdone; /* 530-531 */
-+ #define ARCMSR_CCB_DONE 0x0000
-+ #define ARCMSR_CCB_START 0x55AA
-+ #define ARCMSR_CCB_ABORTED 0xAA55
-+ #define ARCMSR_CCB_ILLEGAL 0xFFFF
-+ uint32_t reserved2[3]; /* 532-535 536-539 540-543 */
-+#else
-+ struct scsi_cmnd * pcmd; /* 512-515 pointer of linux scsi command */
-+ struct _ACB * pACB; /* 516-519 */
-+
-+ uint16_t ccb_flags; /* 520-521 */
-+ #define CCB_FLAG_READ 0x0000
-+ #define CCB_FLAG_WRITE 0x0001
-+ #define CCB_FLAG_ERROR 0x0002
-+ #define CCB_FLAG_FLUSHCACHE 0x0004
-+ #define CCB_FLAG_MASTER_ABORTED 0x0008
-+ uint16_t startdone; /* 522-523 */
-+ #define ARCMSR_CCB_DONE 0x0000
-+ #define ARCMSR_CCB_START 0x55AA
-+ #define ARCMSR_CCB_ABORTED 0xAA55
-+ #define ARCMSR_CCB_ILLEGAL 0xFFFF
-+ uint32_t reserved2[5]; /* 524-527 528-531 532-535 536-539 540-543 */
-+#endif
-+ /* ========================================================== */
-+}CCB,*PCCB;
-+/*
-+*********************************************************************
-+** Adapter Control Block
-+**
-+*********************************************************************
-+*/
-+typedef struct _ACB
-+{
-+ struct pci_dev * pPCI_DEV;
-+ struct Scsi_Host * host;
-+ unsigned long vir2phy_offset; /* Offset is used in making arc cdb physical to virtual calculations */
-+ uint32_t outbound_int_enable;
-+
-+ struct _MU * pmu; /* message unit ATU inbound base address0 */
-+
-+ uint8_t adapter_index; /* */
-+ uint8_t irq;
-+ uint16_t acb_flags; /* */
-+#define ACB_F_SCSISTOPADAPTER 0x0001
-+#define ACB_F_MSG_STOP_BGRB 0x0002 /* stop RAID background rebuild */
-+#define ACB_F_MSG_START_BGRB 0x0004 /* stop RAID background rebuild */
-+#define ACB_F_IOPDATA_OVERFLOW 0x0008 /* iop ioctl data rqbuffer overflow */
-+#define ACB_F_IOCTL_WQBUFFER_CLEARED 0x0010 /* ioctl clear wqbuffer */
-+#define ACB_F_IOCTL_RQBUFFER_CLEARED 0x0020 /* ioctl clear rqbuffer */
-+#define ACB_F_BUS_RESET 0x0040
-+#define ACB_F_IOP_INITED 0x0080 /* iop init */
-+
-+ struct _CCB * pccbwait2go[ARCMSR_MAX_OUTSTANDING_CMD];
-+ atomic_t ccbwait2gocount;
-+ atomic_t ccboutstandingcount;
-+
-+ void * dma_coherent; /* dma_coherent used for memory free */
-+ dma_addr_t dma_coherent_handle; /* dma_coherent_handle used for memory free */
-+ struct _CCB * pccb_pool[ARCMSR_MAX_FREECCB_NUM]; /* used for memory free */
-+ struct _CCB * pccbringQ[ARCMSR_MAX_FREECCB_NUM]; /* ccb pointer array */
-+ int32_t ccb_doneindex; /* done ccb array index */
-+ int32_t ccb_startindex; /* start ccb array index */
-+
-+ uint8_t rqbuffer[ARCMSR_MAX_QBUFFER]; /* data collection buffer for read from 80331 */
-+ int32_t rqbuf_firstindex; /* first of read buffer */
-+ int32_t rqbuf_lastindex; /* last of read buffer */
-+
-+ uint8_t wqbuffer[ARCMSR_MAX_QBUFFER]; /* data collection buffer for write to 80331 */
-+ int32_t wqbuf_firstindex; /* first of write buffer */
-+ int32_t wqbuf_lastindex; /* last of write buffer */
-+
-+ spinlock_t isr_lockunlock;
-+ spinlock_t wait2go_lockunlock;
-+ spinlock_t qbuffer_lockunlock;
-+ spinlock_t ccb_doneindex_lockunlock;
-+ spinlock_t ccb_startindex_lockunlock;
-+ uint8_t devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN]; /* id0 ..... id15,lun0...lun7 */
-+#define ARECA_RAID_GONE 0x55
-+#define ARECA_RAID_GOOD 0xaa
-+ uint32_t num_resets;
-+ uint32_t num_aborts;
-+ uint32_t firm_request_len; /*1,04-07*/
-+ uint32_t firm_numbers_queue; /*2,08-11*/
-+ uint32_t firm_sdram_size; /*3,12-15*/
-+ uint32_t firm_ide_channels; /*4,16-19*/
-+ char firm_model[12]; /*15,60-67*/
-+ char firm_version[20];
-+}ACB,*PACB;
-+/*
-+*********************************************************************
-+**
-+*********************************************************************
-+*/
-+typedef struct _HCBARC
-+{
-+ struct _ACB * pACB[ARCMSR_MAX_ADAPTER];
-+
-+ int32_t arcmsr_major_number;
-+
-+ uint8_t adapterCnt;
-+ uint8_t reserved[3];
-+}HCBARC,*PHCBARC;
-+/*
-+*************************************************************
-+*************************************************************
-+*/
-+typedef struct _SENSE_DATA
-+{
-+ uint8_t ErrorCode:7;
-+ uint8_t Valid:1;
-+ uint8_t SegmentNumber;
-+ uint8_t SenseKey:4;
-+ uint8_t Reserved:1;
-+ uint8_t IncorrectLength:1;
-+ uint8_t EndOfMedia:1;
-+ uint8_t FileMark:1;
-+ uint8_t Information[4];
-+ uint8_t AdditionalSenseLength;
-+ uint8_t CommandSpecificInformation[4];
-+ uint8_t AdditionalSenseCode;
-+ uint8_t AdditionalSenseCodeQualifier;
-+ uint8_t FieldReplaceableUnitCode;
-+ uint8_t SenseKeySpecific[3];
-+}SENSE_DATA, *PSENSE_DATA;
-+/*
-+**********************************
-+** Peripheral Device Type definitions
-+**********************************
-+*/
-+#define SCSI_DASD 0x00 /* Direct-access Device */
-+#define SCSI_SEQACESS 0x01 /* Sequential-access device */
-+#define SCSI_PRINTER 0x02 /* Printer device */
-+#define SCSI_PROCESSOR 0x03 /* Processor device */
-+#define SCSI_WRITEONCE 0x04 /* Write-once device */
-+#define SCSI_CDROM 0x05 /* CD-ROM device */
-+#define SCSI_SCANNER 0x06 /* Scanner device */
-+#define SCSI_OPTICAL 0x07 /* Optical memory device */
-+#define SCSI_MEDCHGR 0x08 /* Medium changer device */
-+#define SCSI_COMM 0x09 /* Communications device */
-+#define SCSI_NODEV 0x1F /* Unknown or no device type*/
-+/*
-+************************************************************************************************************
-+** @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-+** 80331 PCI-to-PCI Bridge
-+** PCI Configuration Space
-+**
-+** @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-+** Programming Interface
-+** ========================
-+** Configuration Register Address Space Groupings and Ranges
-+** =============================================================
-+** Register Group Configuration Offset
-+** -------------------------------------------------------------
-+** Standard PCI Configuration 00-3Fh
-+** -------------------------------------------------------------
-+** Device Specific Registers 40-A7h
-+** -------------------------------------------------------------
-+** Reserved A8-CBh
-+** -------------------------------------------------------------
-+** Enhanced Capability List CC-FFh
-+** ==========================================================================================================
-+** Standard PCI [Type 1] Configuration Space Address Map
-+** **********************************************************************************************************
-+** | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Configu-ration Byte Offset
-+** ----------------------------------------------------------------------------------------------------------
-+** | Device ID | Vendor ID | 00h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Primary Status | Primary Command | 04h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Class Code | RevID | 08h
-+** ----------------------------------------------------------------------------------------------------------
-+** | reserved | Header Type | Primary MLT | Primary CLS | 0Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 10h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 14h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Secondary MLT | Subordinate Bus Number | Secondary Bus Number | Primary Bus Number | 18h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Secondary Status | I/O Limit | I/O Base | 1Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | Non-prefetchable Memory Limit Address | Non-prefetchable Memory Base Address | 20h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Prefetchable Memory Limit Address | Prefetchable Memory Base Address | 24h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Prefetchable Memory Base Address Upper 32 Bits | 28h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Prefetchable Memory Limit Address Upper 32 Bits | 2Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | I/O Limit Upper 16 Bits | I/O Base Upper 16 | 30h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Capabilities Pointer | 34h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 38h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Bridge Control | Primary Interrupt Pin | Primary Interrupt Line | 3Ch
-+**=============================================================================================================
-+*/
-+/*
-+**=============================================================================================================
-+** 0x03-0x00 :
-+** Bit Default Description
-+**31:16 0335h Device ID (DID): Indicates the unique device ID that is assigned to bridge by the PCI SIG.
-+** ID is unique per product speed as indicated.
-+**15:00 8086h Vendor ID (VID): 16-bit field which indicates that Intel is the vendor.
-+**=============================================================================================================
-+*/
-+#define ARCMSR_PCI2PCI_VENDORID_REG 0x00 /*word*/
-+#define ARCMSR_PCI2PCI_DEVICEID_REG 0x02 /*word*/
-+/*
-+**==============================================================================
-+** 0x05-0x04 : command register
-+** Bit Default Description
-+**15:11 00h Reserved
-+** 10 0 Interrupt Disable: Disables/Enables the generation of Interrupts on the primary bus.
-+** The bridge does not support interrupts.
-+** 09 0 FB2B Enable: Enables/Disables the generation of fast back to back transactions on the primary bus.
-+** The bridge does not generate fast back to back transactions on the primary bus.
-+** 08 0 SERR# Enable (SEE): Enables primary bus SERR# assertions.
-+** 0=The bridge does not assert P_SERR#.
-+** 1=The bridge may assert P_SERR#, subject to other programmable criteria.
-+** 07 0 Wait Cycle Control (WCC): Always returns 0bzero indicating that bridge does not perform address or data stepping,
-+** 06 0 Parity Error Response (PER): Controls bridge response to a detected primary bus parity error.
-+** 0=When a data parity error is detected bridge does not assert S_PERR#.
-+** Also bridge does not assert P_SERR# in response to a detected address or attribute parity error.
-+** 1=When a data parity error is detected bridge asserts S_PERR#.
-+** The bridge also asserts P_SERR# (when enabled globally via bit(8) of this register) in response to a detected address or attribute parity error.
-+** 05 0 VGA Palette Snoop Enable (VGA_PSE): Controls bridge response to VGA-compatible palette write transactions.
-+** VGA palette write transactions are I/O transactions whose address bits are: P_AD[9:0] equal to 3C6h, 3C8h or 3C9h
-+** P_AD[15:10] are not decoded (i.e. aliases are claimed), or are fully decoding (i.e., must be all 0's depending upon the VGA aliasing bit in the Bridge Control Register, offset 3Eh.
-+** P_AD[31:16] equal to 0000h
-+** 0=The bridge ignores VGA palette write transactions, unless decoded by the standard I/O address range window.
-+** 1=The bridge responds to VGA palette write transactions with medium DEVSEL# timing and forwards them to the secondary bus.
-+** 04 0 Memory Write and Invalidate Enable (MWIE): The bridge does not promote MW transactions to MWI transactions.
-+** MWI transactions targeting resources on the opposite side of the bridge, however, are forwarded as MWI transactions.
-+** 03 0 Special Cycle Enable (SCE): The bridge ignores special cycle transactions.
-+** This bit is read only and always returns 0 when read
-+** 02 0 Bus Master Enable (BME): Enables bridge to initiate memory and I/O transactions on the primary interface.
-+** Initiation of configuration transactions is not affected by the state of this bit.
-+** 0=The bridge does not initiate memory or I/O transactions on the primary interface.
-+** 1=The bridge is enabled to function as an initiator on the primary interface.
-+** 01 0 Memory Space Enable (MSE): Controls target response to memory transactions on the primary interface.
-+** 0=The bridge target response to memory transactions on the primary interface is disabled.
-+** 1=The bridge target response to memory transactions on the primary interface is enabled.
-+** 00 0 I/O Space Enable (IOSE): Controls target response to I/O transactions on the primary interface.
-+** 0=The bridge target response to I/O transactions on the primary interface is disabled.
-+** 1=The bridge target response to I/O transactions on the primary interface is enabled.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_COMMAND_REG 0x04 /*word*/
-+#define PCI_DISABLE_INTERRUPT 0x0400
-+/*
-+**==============================================================================
-+** 0x07-0x06 : status register
-+** Bit Default Description
-+** 15 0 Detected Parity Error: The bridge sets this bit to a 1b whenever it detects an address, attribute or data parity error.
-+** This bit is set regardless of the state of the PER bit in the command register.
-+** 14 0 Signaled System Error: The bridge sets this bit to a 1b whenever it asserts SERR# on the primary bus.
-+** 13 0 Received Master Abort: The bridge sets this bit to a 1b when, acting as the initiator on the primary bus, its transaction (with the exception of special cycles) has been terminated with a Master Abort.
-+** 12 0 Received Target Abort: The bridge sets this bit to a 1b when, acting as the initiator on the primary bus, its transaction has been terminated with a Target Abort.
-+** 11 0 Signaled Target Abort: The bridge sets this bit to a 1b when it, as the target of a transaction, terminates it with a Target Abort.
-+** In PCI-X mode this bit is also set when it forwards a SCM with a target abort error code.
-+** 10:09 01 DEVSEL# Timing: Indicates slowest response to a non-configuration command on the primary interface.
-+** Returns ¡§01b¡¨ when read, indicating that bridge responds no slower than with medium timing.
-+** 08 0 Master Data Parity Error: The bridge sets this bit to a 1b when all of the following conditions are true: The bridge is the current master on the primary bus
-+** S_PERR# is detected asserted or is asserted by bridge
-+** The Parity Error Response bit is set in the Command register
-+** 07 1 Fast Back to Back Capable: Returns a 1b when read indicating that bridge is able to respond to fast back to back transactions on its primary interface.
-+** 06 0 Reserved
-+** 05 1 66 MHz Capable Indication: Returns a 1b when read indicating that bridge primary interface is 66 MHz capable.
-+** 1 =
-+** 04 1 Capabilities List Enable: Returns 1b when read indicating that bridge supports PCI standard enhanced capabilities.
-+** Offset 34h (Capability Pointer register) provides the offset for the first entry in the linked list of enhanced capabilities.
-+** 03 0 Interrupt Status: Reflects the state of the interrupt in the device/function.
-+** The bridge does not support interrupts.
-+** 02:00 000 Reserved
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_STATUS_REG 0x06 /*word: 06,07 */
-+#define ARCMSR_ADAP_66MHZ 0x20
-+/*
-+**==============================================================================
-+** 0x08 : revision ID
-+** Bit Default Description
-+** 07:00 00000000 Revision ID (RID): '00h' indicating bridge A-0 stepping.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_REVISIONID_REG 0x08 /*byte*/
-+/*
-+**==============================================================================
-+** 0x0b-0x09 : 0180_00 (class code 1,native pci mode )
-+** Bit Default Description
-+** 23:16 06h Base Class Code (BCC): Indicates that this is a bridge device.
-+** 15:08 04h Sub Class Code (SCC): Indicates this is of type PCI-to-PCI bridge.
-+** 07:00 00h Programming Interface (PIF): Indicates that this is standard (non-subtractive) PCI-PCI bridge.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_CLASSCODE_REG 0x09 /*3bytes*/
-+/*
-+**==============================================================================
-+** 0x0c : cache line size
-+** Bit Default Description
-+** 07:00 00h Cache Line Size (CLS): Designates the cache line size in 32-bit dword units.
-+** The contents of this register are factored into internal policy decisions associated with memory read prefetching, and the promotion of Memory Write transactions to MWI transactions.
-+** Valid cache line sizes are 8 and 16 dwords.
-+** When the cache line size is set to an invalid value, bridge behaves as though the cache line size was set to 00h.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_CACHELINESIZE_REG 0x0C /*byte*/
-+/*
-+**==============================================================================
-+** 0x0d : latency timer (number of pci clock 00-ff )
-+** Bit Default Description
-+** Primary Latency Timer (PTV):
-+** 07:00 00h (Conventional PCI) Conventional PCI Mode: Primary bus Master latency timer. Indicates the number of PCI clock cycles,
-+** referenced from the assertion of FRAME# to the expiration of the timer,
-+** when bridge may continue as master of the current transaction. All bits are writable,
-+** resulting in a granularity of 1 PCI clock cycle.
-+** When the timer expires (i.e., equals 00h) bridge relinquishes the bus after the first data transfer when its PCI bus grant has been deasserted.
-+** or 40h (PCI-X) PCI-X Mode: Primary bus Master latency timer.
-+** Indicates the number of PCI clock cycles,
-+** referenced from the assertion of FRAME# to the expiration of the timer,
-+** when bridge may continue as master of the current transaction.
-+** All bits are writable, resulting in a granularity of 1 PCI clock cycle.
-+** When the timer expires (i.e., equals 00h) bridge relinquishes the bus at the next ADB.
-+** (Except in the case where MLT expires within 3 data phases of an ADB.In this case bridge continues on until it reaches the next ADB before relinquishing the bus.)
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_LATENCYTIMER_REG 0x0D /*byte*/
-+/*
-+**==============================================================================
-+** 0x0e : (header type,single function )
-+** Bit Default Description
-+** 07 0 Multi-function device (MVD): 80331 is a single-function device.
-+** 06:00 01h Header Type (HTYPE): Defines the layout of addresses 10h through 3Fh in configuration space.
-+** Returns ¡§01h¡¨ when read indicating that the register layout conforms to the standard PCI-to-PCI bridge layout.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_HEADERTYPE_REG 0x0E /*byte*/
-+/*
-+**==============================================================================
-+** 0x0f :
-+**==============================================================================
-+*/
-+/*
-+**==============================================================================
-+** 0x13-0x10 :
-+** PCI CFG Base Address #0 (0x10)
-+**==============================================================================
-+*/
-+/*
-+**==============================================================================
-+** 0x17-0x14 :
-+** PCI CFG Base Address #1 (0x14)
-+**==============================================================================
-+*/
-+/*
-+**==============================================================================
-+** 0x1b-0x18 :
-+** PCI CFG Base Address #2 (0x18)
-+**-----------------0x1A,0x19,0x18--Bus Number Register - BNR
-+** Bit Default Description
-+** 23:16 00h Subordinate Bus Number (SBBN): Indicates the highest PCI bus number below this bridge.
-+** Any Type 1 configuration cycle on the primary bus whose bus number is greater than the secondary bus number,
-+** and less than or equal to the subordinate bus number is forwarded unaltered as a Type 1 configuration cycle on the secondary PCI bus.
-+** 15:08 00h Secondary Bus Number (SCBN): Indicates the bus number of PCI to which the secondary interface is connected.
-+** Any Type 1 configuration cycle matching this bus number is translated to a Type 0 configuration cycle (or a Special Cycle) before being executed on bridge's secondary PCI bus.
-+** 07:00 00h Primary Bus Number (PBN): Indicates bridge primary bus number.
-+** Any Type 1 configuration cycle on the primary interface with a bus number that is less than the contents of this register field does not be claimed by bridge.
-+**-----------------0x1B--Secondary Latency Timer Register - SLTR
-+** Bit Default Description
-+** Secondary Latency Timer (STV):
-+** 07:00 00h (Conventional PCI) Conventional PCI Mode: Secondary bus Master latency timer.
-+** Indicates the number of PCI clock cycles,referenced from the assertion of FRAME# to the expiration of the timer,
-+** when bridge may continue as master of the current transaction. All bits are writable,
-+** resulting in a granularity of 1 PCI clock cycle.
-+** When the timer expires (i.e., equals 00h) bridge relinquishes the bus after the first data transfer when its PCI bus grant has been deasserted.
-+** or 40h (PCI-X) PCI-X Mode: Secondary bus Master latency timer.
-+** Indicates the number of PCI clock cycles,referenced from the assertion of FRAME# to the expiration of the timer,
-+** when bridge may continue as master of the current transaction. All bits are writable,
-+** resulting in a granularity of 1 PCI clock cycle.
-+** When the timer expires (i.e., equals 00h) bridge relinquishes the bus at the next ADB.
-+** (Except in the case where MLT expires within 3 data phases of an ADB. In this case bridge continues on until it reaches the next ADB before relinquishing the bus)
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_BUSNUMBER_REG 0x18 /*3byte 0x1A,0x19,0x18*/
-+#define ARCMSR_PCI2PCI_SECONDARY_BUSNUMBER_REG 0x19 /*byte*/
-+#define ARCMSR_PCI2PCI_SUBORDINATE_BUSNUMBER_REG 0x1A /*byte*/
-+#define ARCMSR_PCI2PCI_SECONDARY_LATENCYTIMER_REG 0x1B /*byte*/
-+/*
-+**==============================================================================
-+** 0x1f-0x1c :
-+** PCI CFG Base Address #3 (0x1C)
-+**-----------------0x1D,0x1C--I/O Base and Limit Register - IOBL
-+** Bit Default Description
-+** 15:12 0h I/O Limit Address Bits [15:12]: Defines the top address of an address range to determine when to forward I/O transactions from one interface to the other.
-+** These bits correspond to address lines 15:12 for 4KB alignment.
-+** Bits 11:0 are assumed to be FFFh.
-+** 11:08 1h I/O Limit Addressing Capability: This field is hard-wired to 1h, indicating support 32-bit I/O addressing.
-+** 07:04 0h I/O Base Address Bits [15:12]: Defines the bottom address of an address range to determine when to forward I/O transactions from one interface to the other.
-+** These bits correspond to address lines 15:12 for 4KB alignment. Bits 11:0 are assumed to be 000h.
-+** 03:00 1h I/O Base Addressing Capability: This is hard-wired to 1h, indicating support for 32-bit I/O addressing.
-+**-----------------0x1F,0x1E--Secondary Status Register - SSR
-+** Bit Default Description
-+** 15 0b Detected Parity Error: The bridge sets this bit to a 1b whenever it detects an address, attribute or data parity error on its secondary interface.
-+** 14 0b Received System Error: The bridge sets this bit when it samples SERR# asserted on its secondary bus interface.
-+** 13 0b Received Master Abort: The bridge sets this bit to a 1b when, acting as the initiator on the secondary bus, it's transaction (with the exception of special cycles) has been terminated with a Master Abort.
-+** 12 0b Received Target Abort: The bridge sets this bit to a 1b when, acting as the initiator on the secondary bus, it's transaction has been terminated with a Target Abort.
-+** 11 0b Signaled Target Abort: The bridge sets this bit to a 1b when it, as the target of a transaction, terminates it with a Target Abort.
-+** In PCI-X mode this bit is also set when it forwards a SCM with a target abort error code.
-+** 10:09 01b DEVSEL# Timing: Indicates slowest response to a non-configuration command on the secondary interface.
-+** Returns ¡§01b¡¨ when read, indicating that bridge responds no slower than with medium timing.
-+** 08 0b Master Data Parity Error: The bridge sets this bit to a 1b when all of the following conditions are true:
-+** The bridge is the current master on the secondary bus
-+** S_PERR# is detected asserted or is asserted by bridge
-+** The Parity Error Response bit is set in the Command register
-+** 07 1b Fast Back-to-Back Capable (FBC): Indicates that the secondary interface of bridge can receive fast back-to-back cycles.
-+** 06 0b Reserved
-+** 05 1b 66 MHz Capable (C66): Indicates the secondary interface of the bridge is 66 MHz capable.
-+** 1 =
-+** 04:00 00h Reserved
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_IO_BASE_REG 0x1C /*byte*/
-+#define ARCMSR_PCI2PCI_IO_LIMIT_REG 0x1D /*byte*/
-+#define ARCMSR_PCI2PCI_SECONDARY_STATUS_REG 0x1E /*word: 0x1F,0x1E */
-+/*
-+**==============================================================================
-+** 0x23-0x20 :
-+** PCI CFG Base Address #4 (0x20)
-+**-----------------0x23,0x22,0x21,0x20--Memory Base and Limit Register - MBL
-+** Bit Default Description
-+** 31:20 000h Memory Limit: These 12 bits are compared with P_AD[31:20] of the incoming address to determine
-+** the upper 1MB aligned value (exclusive) of the range.
-+** The incoming address must be less than or equal to this value.
-+** For the purposes of address decoding the lower 20 address bits (P_AD[19:0] are assumed to be F FFFFh.
-+** 19:16 0h Reserved.
-+** 15:04 000h Memory Base: These 12 bits are compared with bits P_AD[31:20] of the incoming address to determine the lower 1MB aligned value (inclusive) of the range.
-+** The incoming address must be greater than or equal to this value.
-+** For the purposes of address decoding the lower 20 address bits (P_AD[19:0]) are assumed to be 0 0000h.
-+** 03:00 0h Reserved.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_NONPREFETCHABLE_MEMORY_BASE_REG 0x20 /*word: 0x21,0x20 */
-+#define ARCMSR_PCI2PCI_NONPREFETCHABLE_MEMORY_LIMIT_REG 0x22 /*word: 0x23,0x22 */
-+/*
-+**==============================================================================
-+** 0x27-0x24 :
-+** PCI CFG Base Address #5 (0x24)
-+**-----------------0x27,0x26,0x25,0x24--Prefetchable Memory Base and Limit Register - PMBL
-+** Bit Default Description
-+** 31:20 000h Prefetchable Memory Limit: These 12 bits are compared with P_AD[31:20] of the incoming address to determine
-+** the upper 1MB aligned value (exclusive) of the range.
-+** The incoming address must be less than or equal to this value.
-+** For the purposes of address decoding the lower 20 address bits (P_AD[19:0] are assumed to be F FFFFh.
-+** 19:16 1h 64-bit Indicator: Indicates that 64-bit addressing is supported.
-+** 15:04 000h Prefetchable Memory Base: These 12 bits are compared with bits P_AD[31:20] of the incoming address to determine the lower 1MB aligned value (inclusive) of the range.
-+** The incoming address must be greater than or equal to this value.
-+** For the purposes of address decoding the lower 20 address bits (P_AD[19:0]) are assumed to be 0 0000h.
-+** 03:00 1h 64-bit Indicator: Indicates that 64-bit addressing is supported.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PREFETCHABLE_MEMORY_BASE_REG 0x24 /*word: 0x25,0x24 */
-+#define ARCMSR_PCI2PCI_PREFETCHABLE_MEMORY_LIMIT_REG 0x26 /*word: 0x27,0x26 */
-+/*
-+**==============================================================================
-+** 0x2b-0x28 :
-+** Bit Default Description
-+** 31:00 00000000h Prefetchable Memory Base Upper Portion: All bits are read/writable
-+** bridge supports full 64-bit addressing.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PREFETCHABLE_MEMORY_BASE_UPPER32_REG 0x28 /*dword: 0x2b,0x2a,0x29,0x28 */
-+/*
-+**==============================================================================
-+** 0x2f-0x2c :
-+** Bit Default Description
-+** 31:00 00000000h Prefetchable Memory Limit Upper Portion: All bits are read/writable
-+** bridge supports full 64-bit addressing.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PREFETCHABLE_MEMORY_LIMIT_UPPER32_REG 0x2C /*dword: 0x2f,0x2e,0x2d,0x2c */
-+/*
-+**==============================================================================
-+** 0x33-0x30 :
-+** Bit Default Description
-+** 07:00 DCh Capabilities Pointer: Pointer to the first CAP ID entry in the capabilities list is at DCh in PCI configuration
-+** space. (Power Management Capability Registers)
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_CAPABILITIES_POINTER_REG 0x34 /*byte*/
-+/*
-+**==============================================================================
-+** 0x3b-0x35 : reserved
-+**==============================================================================
-+*/
-+/*
-+**==============================================================================
-+** 0x3d-0x3c :
-+**
-+** Bit Default Description
-+** 15:08 00h Interrupt Pin (PIN): Bridges do not support the generation of interrupts.
-+** 07:00 00h Interrupt Line (LINE): The bridge does not generate interrupts, so this is reserved as '00h'.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_PRIMARY_INTERRUPT_LINE_REG 0x3C /*byte*/
-+#define ARCMSR_PCI2PCI_PRIMARY_INTERRUPT_PIN_REG 0x3D /*byte*/
-+/*
-+**==============================================================================
-+** 0x3f-0x3e :
-+** Bit Default Description
-+** 15:12 0h Reserved
-+** 11 0b Discard Timer SERR# Enable: Controls the generation of SERR# on the primary interface (P_SERR#) in response
-+** to a timer discard on either the primary or secondary interface.
-+** 0b=SERR# is not asserted.
-+** 1b=SERR# is asserted.
-+** 10 0b Discard Timer Status (DTS): This bit is set to a '1b' when either the primary or secondary discard timer expires.
-+** The delayed completion is then discarded.
-+** 09 0b Secondary Discard Timer (SDT): Sets the maximum number of PCI clock cycles that bridge waits for an initiator on the secondary bus to repeat a delayed transaction request.
-+** The counter starts when the delayed transaction completion is ready to be returned to the initiator.
-+** When the initiator has not repeated the transaction at least once before the counter expires,bridge discards the delayed transaction from its queues.
-+** 0b=The secondary master time-out counter is 2 15 PCI clock cycles.
-+** 1b=The secondary master time-out counter is 2 10 PCI clock cycles.
-+** 08 0b Primary Discard Timer (PDT): Sets the maximum number of PCI clock cycles that bridge waits for an initiator on the primary bus to repeat a delayed transaction request.
-+** The counter starts when the delayed transaction completion is ready to be returned to the initiator.
-+** When the initiator has not repeated the transaction at least once before the counter expires, bridge discards the delayed transaction from its queues.
-+** 0b=The primary master time-out counter is 2 15 PCI clock cycles.
-+** 1b=The primary master time-out counter is 2 10 PCI clock cycles.
-+** 07 0b Fast Back-to-Back Enable (FBE): The bridge does not initiate back to back transactions.
-+** 06 0b Secondary Bus Reset (SBR):
-+** When cleared to 0b: The bridge deasserts S_RST#, when it had been asserted by writing this bit to a 1b.
-+** When set to 1b: The bridge asserts S_RST#.
-+** 05 0b Master Abort Mode (MAM): Dictates bridge behavior on the initiator bus when a master abort termination occurs in response to a delayed transaction initiated by bridge on the target bus.
-+** 0b=The bridge asserts TRDY# in response to a non-locked delayed transaction,and returns FFFF FFFFh when a read.
-+** 1b=When the transaction had not yet been completed on the initiator bus (e.g.,delayed reads, or non-posted writes),
-+** then bridge returns a Target Abort in response to the original requester
-+** when it returns looking for its delayed completion on the initiator bus.
-+** When the transaction had completed on the initiator bus (e.g., a PMW), then bridge asserts P_SERR# (when enabled).
-+** For PCI-X transactions this bit is an enable for the assertion of P_SERR# due to a master abort while attempting to deliver a posted memory write on the destination bus.
-+** 04 0b VGA Alias Filter Enable: This bit dictates bridge behavior in conjunction with the VGA enable bit (also of this register),
-+** and the VGA Palette Snoop Enable bit (Command Register).
-+** When the VGA enable, or VGA Palette Snoop enable bits are on (i.e., 1b) the VGA Aliasing bit for the corresponding enabled functionality,:
-+** 0b=Ignores address bits AD[15:10] when decoding VGA I/O addresses.
-+** 1b=Ensures that address bits AD[15:10] equal 000000b when decoding VGA I/O addresses.
-+** When all VGA cycle forwarding is disabled, (i.e., VGA Enable bit =0b and VGA Palette Snoop bit =0b), then this bit has no impact on bridge behavior.
-+** 03 0b VGA Enable: Setting this bit enables address decoding and transaction forwarding of the following VGA transactions from the primary bus to the secondary bus:
-+** frame buffer memory addresses 000A0000h:000BFFFFh, VGA I/O addresses 3B0:3BBh and 3C0h:3DFh, where AD[31:16]=¡§0000h¡¨ and AD[15:10] are either not decoded (i.e., don't cares), or must be ¡§000000b¡¨
-+** depending upon the state of the VGA Alias Filter Enable bit. (bit(4) of this register)
-+** I/O and Memory Enable bits must be set in the Command register to enable forwarding of VGA cycles.
-+** 02 0b ISA Enable: Setting this bit enables special handling for the forwarding of ISA I/O transactions that fall within the address range specified by the I/O Base and Limit registers, and are within the lowest 64Kbyte of the I/O address map (i.e., 0000 0000h - 0000 FFFFh).
-+** 0b=All I/O transactions that fall within the I/O Base and Limit registers' specified range are forwarded from primary to secondary unfiltered.
-+** 1b=Blocks the forwarding from primary to secondary of the top 768 bytes of each 1Kbyte alias. On the secondary the top 768 bytes of each 1K alias are inversely decoded and forwarded from secondary to primary.
-+** 01 0b SERR# Forward Enable: 0b=The bridge does not assert P_SERR# as a result of an S_SERR# assertion.
-+** 1b=The bridge asserts P_SERR# whenever S_SERR# is detected asserted provided the SERR# Enable bit is set (PCI Command Register bit(8)=1b).
-+** 00 0b Parity Error Response: This bit controls bridge response to a parity error that is detected on its secondary interface.
-+** 0b=When a data parity error is detected bridge does not assert S_PERR#.
-+** Also bridge does not assert P_SERR# in response to a detected address or attribute parity error.
-+** 1b=When a data parity error is detected bridge asserts S_PERR#. The bridge also asserts P_SERR# (when enabled globally via bit(8) of the Command register)
-+** in response to a detected address or attribute parity error.
-+**==============================================================================
-+*/
-+#define ARCMSR_PCI2PCI_BRIDGE_CONTROL_REG 0x3E /*word*/
-+/*
-+**************************************************************************
-+** Device Specific Registers 40-A7h
-+**************************************************************************
-+** ----------------------------------------------------------------------------------------------------------
-+** | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Configu-ration Byte Offset
-+** ----------------------------------------------------------------------------------------------------------
-+** | Bridge Control 0 | Arbiter Control/Status | Reserved | 40h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Bridge Control 2 | Bridge Control 1 | 44h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Bridge Status | 48h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 4Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | Prefetch Policy | Multi-Transaction Timer | 50h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Pre-boot Status | P_SERR# Assertion Control | 54h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Reserved | Secondary Decode Enable | 58h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Secondary IDSEL | 5Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 5Ch
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 68h:CBh
-+** ----------------------------------------------------------------------------------------------------------
-+**************************************************************************
-+**==============================================================================
-+** 0x42-0x41: Secondary Arbiter Control/Status Register - SACSR
-+** Bit Default Description
-+** 15:12 1111b Grant Time-out Violator: This field indicates the agent that violated the Grant Time-out rule (PCI=16 clocks,PCI-X=6 clocks).
-+** Note that this field is only meaningful when:
-+** # Bit[11] of this register is set to 1b, indicating that a Grant Time-out violation had occurred.
-+** # bridge internal arbiter is enabled.
-+** Bits[15:12] Violating Agent (REQ#/GNT# pair number)
-+** 0000b REQ#/GNT#[0]
-+** 0001b REQ#/GNT#[1]
-+** 0010b REQ#/GNT#[2]
-+** 0011b REQ#/GNT#[3]
-+** 1111b Default Value (no violation detected)
-+** When bit[11] is cleared by software, this field reverts back to its default value.
-+** All other values are Reserved
-+** 11 0b Grant Time-out Occurred: When set to 1b,
-+** this indicates that a Grant Time-out error had occurred involving one of the secondary bus agents.
-+** Software clears this bit by writing a 1b to it.
-+** 10 0b Bus Parking Control: 0=During bus idle, bridge parks the bus on the last master to use the bus.
-+** 1=During bus idle, bridge parks the bus on itself. The bus grant is removed from the last master and internally asserted to bridge.
-+** 09:08 00b Reserved
-+** 07:00 0000 0000b Secondary Bus Arbiter Priority Configuration: The bridge secondary arbiter provides two rings of arbitration priority.
-+** Each bit of this field assigns its corresponding secondary bus master to either the high priority arbiter ring (1b) or to the low priority arbiter ring (0b).
-+** Bits [3:0] correspond to request inputs S_REQ#[3:0], respectively.
-+** Bit [6] corresponds to the bridge internal secondary bus request while Bit [7] corresponds to the SATU secondary bus request.
-+** Bits [5:4] are unused.
-+** 0b=Indicates that the master belongs to the low priority group.
-+** 1b=Indicates that the master belongs to the high priority group
-+**=================================================================================
-+** 0x43: Bridge Control Register 0 - BCR0
-+** Bit Default Description
-+** 07 0b Fully Dynamic Queue Mode: 0=The number of Posted write transactions is limited to eight and the Posted Write data is limited to 4KB.
-+** 1=Operation in fully dynamic queue mode. The bridge enqueues up to 14 Posted Memory Write transactions and 8KB of posted write data.
-+** 06:03 0H Reserved.
-+** 02 0b Upstream Prefetch Disable: This bit disables bridge ability to perform upstream prefetch operations for Memory Read requests received on its secondary interface.
-+** This bit also controls the bridge's ability to generate advanced read commands when forwarding a Memory Read Block transaction request upstream from a PCI-X bus to a Conventional PCI bus.
-+** 0b=bridge treats all upstream Memory Read requests as though they target prefetchable memory. The use of Memory Read Line and Memory Read
-+** Multiple is enabled when forwarding a PCI-X Memory Read Block request to an upstream bus operating in Conventional PCI mode.
-+** 1b=bridge treats upstream PCI Memory Read requests as though they target non-prefetchable memory and forwards upstream PCI-X Memory Read Block commands as Memory Read when the primary bus is operating in Conventional PCI mode.
-+** NOTE: This bit does not affect bridge ability to perform read prefetching when the received command is Memory Read Line or Memory Read Multiple.
-+**=================================================================================
-+** 0x45-0x44: Bridge Control Register 1 - BCR1 (Sheet 2 of 2)
-+** Bit Default Description
-+** 15:08 0000000b Reserved
-+** 07:06 00b Alias Command Mapping: This two bit field determines how bridge handles PCI-X ¡§Alias¡¨ commands, specifically the Alias to Memory Read Block and Alias to Memory Write Block commands.
-+** The three options for handling these alias commands are to either pass it as is, re-map to the actual block memory read/write command encoding, or ignore
-+** the transaction forcing a Master Abort to occur on the Origination Bus.
-+** Bit (7:6) Handling of command
-+** 0 0 Re-map to Memory Read/Write Block before forwarding
-+** 0 1 Enqueue and forward the alias command code unaltered
-+** 1 0 Ignore the transaction, forcing Master Abort
-+** 1 1 Reserved
-+** 05 1b Watchdog Timers Disable: Disables or enables all 2 24 Watchdog Timers in both directions.
-+** The watchdog timers are used to detect prohibitively long latencies in the system.
-+** The watchdog timer expires when any Posted Memory Write (PMW), Delayed Request,
-+** or Split Requests (PCI-X mode) is not completed within 2 24 events
-+** (¡§events¡¨ are defined as PCI Clocks when operating in PCI-X mode, and as the number of times being retried when operating in Conventional PCI mode)
-+** 0b=All 2 24 watchdog timers are enabled.
-+** 1b=All 2 24 watchdog timers are disabled and there is no limits to the number of attempts bridge makes when initiating a PMW,
-+** transacting a Delayed Transaction, or how long it waits for a split completion corresponding to one of its requests.
-+** 04 0b GRANT# time-out disable: This bit enables/disables the GNT# time-out mechanism.
-+** Grant time-out is 16 clocks for conventional PCI, and 6 clocks for PCI-X.
-+** 0b=The Secondary bus arbiter times out an agent that does not assert FRAME# within 16/6 clocks of receiving its grant, once the bus has gone idle.
-+** The time-out counter begins as soon as the bus goes idle with the new GNT# asserted.
-+** An infringing agent does not receive a subsequent GNT# until it de-asserts its REQ# for at least one clock cycle.
-+** 1b=GNT# time-out mechanism is disabled.
-+** 03 00b Reserved.
-+** 02 0b Secondary Discard Timer Disable: This bit enables/disables bridge secondary delayed transaction discard mechanism.
-+** The time out mechanism is used to ensure that initiators of delayed transactions return for their delayed completion data/status within a reasonable amount of time after it is available from bridge.
-+** 0b=The secondary master time-out counter is enabled and uses the value specified by the Secondary Discard Timer bit (see Bridge Control Register).
-+** 1b=The secondary master time-out counter is disabled. The bridge waits indefinitely for a secondary bus master to repeat a delayed transaction.
-+** 01 0b Primary Discard Timer Disable: This bit enables/disables bridge primary delayed transaction discard mechanism. The time out mechanism is used to ensure that initiators of delayed transactions return for their delayed completion data/status within a reasonable amount of time after it is available from bridge.
-+** 0b=The primary master time-out counter is enabled and uses the value specified by the Primary Discard Timer bit (see Bridge Control Register).
-+** 1b=The secondary master time-out counter is disabled. The bridge waits indefinitely for a secondary bus master to repeat a delayed transaction.
-+** 00 0b Reserved
-+**=================================================================================
-+** 0x47-0x46: Bridge Control Register 2 - BCR2
-+** Bit Default Description
-+** 15:07 0000b Reserved.
-+** 06 0b Global Clock Out Disable (External Secondary Bus Clock Source Enable): This bit disables all of the secondary PCI clock outputs including the feedback clock S_CLKOUT.
-+** This means that the user is required to provide an S_CLKIN input source.
-+** 05:04 11 (66 MHz) Preserved.
-+** 01 (100 MHz)
-+** 00 (133 MHz)
-+** 03:00 Fh (100 MHz & 66 MHz)
-+** 7h (133 MHz)
-+** This 4 bit field provides individual enable/disable mask bits for each of bridge
-+** secondary PCI clock outputs. Some, or all secondary clock outputs (S_CLKO[3:0])
-+** default to being enabled following the rising edge of P_RST#, depending on the
-+** frequency of the secondary bus clock:
-+** ¡E Designs with 100 MHz (or lower) Secondary PCI clock power up with all four S_CLKOs enabled by default. (SCLKO[3:0])¡P
-+** ¡E Designs with 133 MHz Secondary PCI clock power up with the lower order 3 S_CLKOs enabled by default. (S_CLKO[2:0]) Only those SCLKs that power up enabled by can be connected to downstream device clock inputs.
-+**=================================================================================
-+** 0x49-0x48: Bridge Status Register - BSR
-+** Bit Default Description
-+** 15 0b Upstream Delayed Transaction Discard Timer Expired: This bit is set to a 1b and P_SERR# is conditionally asserted when the secondary discard timer expires.
-+** 14 0b Upstream Delayed/Split Read Watchdog Timer Expired:
-+** Conventional PCI Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards an upstream delayed read transaction request after 2 24 retries following the initial retry.
-+** PCI-X Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards an upstream split read request after waiting in excess of 2 24 clocks for the corresponding Split Completion to arrive.
-+** 13 0b Upstream Delayed/Split Write Watchdog Timer Expired:
-+** Conventional PCI Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards an upstream delayed write transaction request after 2 24 retries following the initial retry.
-+** PCI-X Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards an upstream split write request after waiting in excess of 2 24 clocks for the corresponding Split Completion to arrive.
-+** 12 0b Master Abort during Upstream Posted Write: This bit is set to a 1b and P_SERR# is conditionally asserted when a Master Abort occurs as a result of an attempt, by bridge, to retire a PMW upstream.
-+** 11 0b Target Abort during Upstream Posted Write: This bit is set to a 1b and P_SERR# is conditionally asserted when a Target Abort occurs as a result of an attempt, by bridge, to retire a PMW upstream.
-+** 10 0b Upstream Posted Write Data Discarded: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards an upstream PMW transaction after receiving 2 24 target retries from the primary bus target
-+** 09 0b Upstream Posted Write Data Parity Error: This bit is set to a 1b and P_SERR# is conditionally asserted when a data parity error is detected by bridge while attempting to retire a PMW upstream
-+** 08 0b Secondary Bus Address Parity Error: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge detects an address parity error on the secondary bus.
-+** 07 0b Downstream Delayed Transaction Discard Timer Expired: This bit is set to a 1b and P_SERR# is conditionally asserted when the primary bus discard timer expires.
-+** 06 0b Downstream Delayed/Split Read Watchdog Timer Expired:
-+** Conventional PCI Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards a downstream delayed read transaction request after receiving 2 24 target retries from the secondary bus target.
-+** PCI-X Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards a downstream split read request after waiting in excess of 2 24 clocks for the corresponding Split Completion to arrive.
-+** 05 0b Downstream Delayed Write/Split Watchdog Timer Expired:
-+** Conventional PCI Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards a downstream delayed write transaction request after receiving 2 24 target retries from the secondary bus target.
-+** PCI-X Mode: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards a downstream split write request after waiting in excess of 2 24 clocks for the corresponding Split Completion to arrive.
-+** 04 0b Master Abort during Downstream Posted Write: This bit is set to a 1b and P_SERR# is conditionally asserted when a Master Abort occurs as a result of an attempt, by bridge, to retire a PMW downstream.
-+** 03 0b Target Abort during Downstream Posted Write: This bit is set to a 1b and P_SERR# is conditionally asserted when a Target Abort occurs as a result of an attempt, by bridge, to retire a PMW downstream.
-+** 02 0b Downstream Posted Write Data Discarded: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge discards a downstream PMW transaction after receiving 2 24 target retries from the secondary bus target
-+** 01 0b Downstream Posted Write Data Parity Error: This bit is set to a 1b and P_SERR# is conditionally asserted when a data parity error is detected by bridge while attempting to retire a PMW downstream.
-+** 00 0b Primary Bus Address Parity Error: This bit is set to a 1b and P_SERR# is conditionally asserted when bridge detects an address parity error on the primary bus.
-+**==================================================================================
-+** 0x51-0x50: Bridge Multi-Transaction Timer Register - BMTTR
-+** Bit Default Description
-+** 15:13 000b Reserved
-+** 12:10 000b GRANT# Duration: This field specifies the count (PCI clocks) that a secondary bus master has its grant maintained in order to enable multiple transactions to execute within the same arbitration cycle.
-+** Bit[02:00] GNT# Extended Duration
-+** 000 MTT Disabled (Default=no GNT# extension)
-+** 001 16 clocks
-+** 010 32 clocks
-+** 011 64 clocks
-+** 100 128 clocks
-+** 101 256 clocks
-+** 110 Invalid (treated as 000)
-+** 111 Invalid (treated as 000)
-+** 09:08 00b Reserved
-+** 07:00 FFh MTT Mask: This field enables/disables MTT usage for each REQ#/GNT# pair supported by bridge secondary arbiter.
-+** Bit(7) corresponds to SATU internal REQ#/GNT# pair,
-+** bit(6) corresponds to bridge internal REQ#/GNT# pair,
-+** bit(5) corresponds to REQ#/GNT#(5) pair, etc.
-+** When a given bit is set to 1b, its corresponding REQ#/GNT# pair is enabled for MTT functionality as determined by bits(12:10) of this register.
-+** When a given bit is cleared to 0b, its corresponding REQ#/GNT# pair is disabled from using the MTT.
-+**==================================================================================
-+** 0x53-0x52: Read Prefetch Policy Register - RPPR
-+** Bit Default Description
-+** 15:13 000b ReRead_Primary Bus: 3-bit field indicating the multiplication factor to be used in calculating the number of bytes to prefetch from the secondary bus interface on subsequent PreFetch operations given that the read demands were not satisfied using the FirstRead parameter.
-+** The default value of 000b correlates to: Command Type Hardwired pre-fetch amount Memory Read 4 DWORDs Memory Read Line 1 cache lines Memory Read Multiple 2 cache lines
-+** 12:10 000b FirstRead_Primary Bus: 3-bit field indicating the multiplication factor to be used in calculating the number of bytes to prefetch from the secondary bus interface on the initial PreFetch operation.
-+** The default value of 000b correlates to: Command Type Hardwired pre-fetch amount Memory Read 4 DWORDs Memory Read Line 1 cache line Memory Read Multiple 2 cache lines
-+** 09:07 010b ReRead_Secondary Bus: 3-bit field indicating the multiplication factor to be used in calculating the number of bytes to prefetch from the primary bus interface on subsequent PreFetch operations given that the read demands were not satisfied using the FirstRead parameter.
-+** The default value of 010b correlates to: Command Type Hardwired pre-fetch amount Memory Read 3 cache lines Memory Read Line 3 cache lines Memory Read Multiple 6 cache lines
-+** 06:04 000b FirstRead_Secondary Bus: 3-bit field indicating the multiplication factor to be used in calculating the number of bytes to prefetch from the primary bus interface on the initial PreFetch operation.
-+** The default value of 000b correlates to: Command Type Hardwired pre-fetch amount Memory Read 4 DWORDs Memory Read Line 1 cache line Memory Read Multiple 2 cache lines
-+** 03:00 1111b Staged Prefetch Enable: This field enables/disables the FirstRead/ReRead pre-fetch algorithm for the secondary and the primary bus interfaces.
-+** Bit(3) is a ganged enable bit for REQ#/GNT#[7:3], and bits(2:0) provide individual
-+** enable bits for REQ#/GNT#[2:0]. (bit(2) is the enable bit for REQ#/GNT#[2], etc...)
-+** 1b: enables the staged pre-fetch feature
-+** 0b: disables staged pre-fetch,
-+** and hardwires read pre-fetch policy to the following for
-+** Memory Read,
-+** Memory Read Line,
-+** and Memory Read Multiple commands:
-+** Command Type Hardwired Pre-Fetch Amount...
-+** Memory Read 4 DWORDs
-+** Memory Read Line 1 cache line
-+** Memory Read Multiple 2 cache lines
-+** NOTE: When the starting address is not cache line aligned, bridge pre-fetches Memory Read line commands only to the next higher cache line boundary.For non-cache line aligned Memory Read Multiple commands bridge pre-fetches only to the second cache line boundary encountered.
-+**==================================================================================
-+** 0x55-0x54: P_SERR# Assertion Control - SERR_CTL
-+** Bit Default Description
-+** 15 0b Upstream Delayed Transaction Discard Timer Expired: Dictates the bridge behavior in response to its discarding of a delayed transaction that was initiated from the primary bus.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 14 0b Upstream Delayed/Split Read Watchdog Timer Expired: Dictates bridge behavior following expiration of the subject watchdog timer.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 13 0b Upstream Delayed/Split Write Watchdog Timer Expired: Dictates bridge behavior following expiration of the subject watchdog timer.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 12 0b Master Abort during Upstream Posted Write: Dictates bridge behavior following its having detected a Master Abort while attempting to retire one of its PMWs upstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 11 0b Target Abort during Upstream Posted Write: Dictates bridge behavior following its having been terminated with Target Abort while attempting to retire one of its PMWs upstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 10 0b Upstream Posted Write Data Discarded: Dictates bridge behavior in the event that it discards an upstream posted write transaction.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 09 0b Upstream Posted Write Data Parity Error: Dictates bridge behavior when a data parity error is detected while attempting to retire on of its PMWs upstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 08 0b Secondary Bus Address Parity Error: This bit dictates bridge behavior when it detects an address parity error on the secondary bus.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 07 0b Downstream Delayed Transaction Discard Timer Expired: Dictates bridge behavior in response to its discarding of a delayed transaction that was initiated on the secondary bus.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 06 0b Downstream Delayed/Split Read Watchdog Timer Expired: Dictates bridge behavior following expiration of the subject watchdog timer.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 05 0b Downstream Delayed/Split Write Watchdog Timer Expired: Dictates bridge behavior following expiration of the subject watchdog timer.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 04 0b Master Abort during Downstream Posted Write: Dictates bridge behavior following its having detected a Master Abort while attempting to retire one of its PMWs downstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 03 0b Target Abort during Downstream Posted Write: Dictates bridge behavior following its having been terminated with Target Abort while attempting to retire one of its PMWs downstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 02 0b Downstream Posted Write Data Discarded: Dictates bridge behavior in the event that it discards a downstream posted write transaction.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 01 0b Downstream Posted Write Data Parity Error: Dictates bridge behavior when a data parity error is detected while attempting to retire on of its PMWs downstream.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+** 00 0b Primary Bus Address Parity Error: This bit dictates bridge behavior when it detects an address parity error on the primary bus.
-+** 0b=bridge asserts P_SERR#.
-+** 1b=bridge does not assert P_SERR#
-+**===============================================================================
-+** 0x56: Pre-Boot Status Register - PBSR
-+** Bit Default Description
-+** 07 1 Reserved
-+** 06 - Reserved - value indeterminate
-+** 05:02 0 Reserved
-+** 01 Varies with External State of S_133EN at PCI Bus Reset Secondary Bus Max Frequency Setting: This bit reflect captured S_133EN strap, indicating the maximum secondary bus clock frequency when in PCI-X mode.
-+** Max Allowable Secondary Bus Frequency
-+** S_133EN PCI-X Mode
-+** 0 100 MHz
-+** 1 133 MH
-+** 00 0b Reserved
-+**===============================================================================
-+** 0x59-0x58: Secondary Decode Enable Register - SDER
-+** Bit Default Description
-+** 15:03 FFF1h Preserved.
-+** 02 Varies with External State of PRIVMEM at PCI Bus Reset Private Memory Space Enable - when set, bridge overrides its secondary inverse decode logic and not
-+** forward upstream any secondary bus initiated DAC Memory transactions with AD(63)=1b.
-+** This creates a private memory space on the Secondary PCI bus that allows peer-to-peer transactions.
-+** 01:00 10 2 Preserved.
-+**===============================================================================
-+** 0x5D-0x5C: Secondary IDSEL Select Register - SISR
-+** Bit Default Description
-+** 15:10 000000 2 Reserved.
-+** 09 Varies with External State of PRIVDEV at PCI Bus Reset AD25- IDSEL Disable - When this bit is set, AD25 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD25 is asserted when Primary addresses AD[15:11]=01001 2 during a Type 1 to Type 0 conversion.
-+** 08 Varies with External State of PRIVDEV at PCI Bus Reset AD24- IDSEL Disable - When this bit is set, AD24 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD24 is asserted when Primary addresses AD[15:11]=01000 2 during a Type 1 to Type 0 conversion.
-+** 07 Varies with External State of PRIVDEV at PCI Bus Reset AD23- IDSEL Disable - When this bit is set, AD23 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD23 is asserted when Primary addresses AD[15:11]=00111 2 during a Type 1 to Type 0 conversion.
-+** 06 Varies with External State of PRIVDEV at PCI Bus Reset AD22- IDSEL Disable - When this bit is set, AD22 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD22 is asserted when Primary addresses AD[15:11]=00110 2 during a Type 1 to Type 0 conversion.
-+** 05 Varies with External State of PRIVDEV at PCI Bus Reset AD21- IDSEL Disable - When this bit is set, AD21 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD21 is asserted when Primary addresses AD[15:11]=00101 2 during a Type 1 to Type 0 conversion.
-+** 04 Varies with External State of PRIVDEV at PCI Bus Reset AD20- IDSEL Disable - When this bit is set, AD20 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD20 is asserted when Primary addresses AD[15:11]=00100 2 during a Type 1 to Type 0 conversion.
-+** 03 Varies with External State of PRIVDEV at PCI Bus Reset AD19- IDSEL Disable - When this bit is set, AD19 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD19 is asserted when Primary addresses AD[15:11]=00011 2 during a Type 1 to Type 0 conversion.
-+** 02 Varies with External State of PRIVDEV at PCI Bus Reset AD18- IDSEL Disable - When this bit is set, AD18 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD18 is asserted when Primary addresses AD[15:11]=00010 2 during a Type 1 to Type 0 conversion.
-+** 01 Varies with External State of PRIVDEV at PCI Bus Reset AD17- IDSEL Disable - When this bit is set, AD17 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD17 is asserted when Primary addresses AD[15:11]=00001 2 during a Type 1 to Type 0 conversion.
-+** 00 Varies with External State of PRIVDEV at PCI Bus Reset AD16- IDSEL Disable - When this bit is set, AD16 is deasserted for any possible Type 1 to Type 0 conversion.
-+** When this bit is clear, AD16 is asserted when Primary addresses AD[15:11]=00000 2 during a Type 1 to Type 0 conversion.
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** Reserved A8-CBh
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** PCI Extended Enhanced Capabilities List CC-FFh
-+**************************************************************************
-+** ----------------------------------------------------------------------------------------------------------
-+** | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Configu-ration Byte Offset
-+** ----------------------------------------------------------------------------------------------------------
-+** | Power Management Capabilities | Next Item Ptr | Capability ID | DCh
-+** ----------------------------------------------------------------------------------------------------------
-+** | PM Data | PPB Support | Extensions Power Management CSR | E0h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Reserved | Reserved | E4h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | E8h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | Reserved | Reserved | Reserved | ECh
-+** ----------------------------------------------------------------------------------------------------------
-+** | PCI-X Secondary Status | Next Item Ptr | Capability ID | F0h
-+** ----------------------------------------------------------------------------------------------------------
-+** | PCI-X Bridge Status | F4h
-+** ----------------------------------------------------------------------------------------------------------
-+** | PCI-X Upstream Split Transaction Control | F8h
-+** ----------------------------------------------------------------------------------------------------------
-+** | PCI-X Downstream Split Transaction Control | FCh
-+** ----------------------------------------------------------------------------------------------------------
-+**===============================================================================
-+** 0xDC: Power Management Capabilities Identifier - PM_CAPID
-+** Bit Default Description
-+** 07:00 01h Identifier (ID): PCI SIG assigned ID for PCI-PM register block
-+**===============================================================================
-+** 0xDD: Next Item Pointer - PM_NXTP
-+** Bit Default Description
-+** 07:00 F0H Next Capabilities Pointer (PTR): The register defaults to F0H pointing to the PCI-X Extended Capability Header.
-+**===============================================================================
-+** 0xDF-0xDE: Power Management Capabilities Register - PMCR
-+** Bit Default Description
-+** 15:11 00h PME Supported (PME): PME# cannot be asserted by bridge.
-+** 10 0h State D2 Supported (D2): Indicates no support for state D2. No power management action in this state.
-+** 09 1h State D1 Supported (D1): Indicates support for state D1. No power management action in this state.
-+** 08:06 0h Auxiliary Current (AUXC): This 3 bit field reports the 3.3Vaux auxiliary current requirements for the PCI function.
-+** This returns 000b as PME# wake-up for bridge is not implemented.
-+** 05 0 Special Initialization Required (SINT): Special initialization is not required for bridge.
-+** 04:03 00 Reserved
-+** 02:00 010 Version (VS): Indicates that this supports PCI Bus Power Management Interface Specification, Revision 1.1.
-+**===============================================================================
-+** 0xE1-0xE0: Power Management Control / Status - Register - PMCSR
-+** Bit Default Description
-+** 15:09 00h Reserved
-+** 08 0b PME_Enable: This bit, when set to 1b enables bridge to assert PME#. Note that bridge never has occasion to assert PME# and implements this dummy R/W bit only for the purpose of working around an OS PCI-PM bug.
-+** 07:02 00h Reserved
-+** 01:00 00 Power State (PSTATE): This 2-bit field is used both to determine the current power state of a function and to set the Function into a new power state.
-+** 00 - D0 state
-+** 01 - D1 state
-+** 10 - D2 state
-+** 11 - D3 hot state
-+**===============================================================================
-+** 0xE2: Power Management Control / Status PCI to PCI Bridge Support - PMCSR_BSE
-+** Bit Default Description
-+** 07 0 Bus Power/Clock Control Enable (BPCC_En): Indicates that the bus power/clock control policies have been disabled.
-+** 06 0 B2/B3 support for D3 Hot (B2_B3#): The state of this bit determines the action that is to occur as a direct result of programming the function to D3 hot.
-+** This bit is only meaningful when bit 7 (BPCC_En) is a ¡§1¡¨.
-+** 05:00 00h Reserved
-+**===============================================================================
-+** 0xE3: Power Management Data Register - PMDR
-+** Bit Default Description
-+** 07:00 00h Reserved
-+**===============================================================================
-+** 0xF0: PCI-X Capabilities Identifier - PX_CAPID
-+** Bit Default Description
-+** 07:00 07h Identifier (ID): Indicates this is a PCI-X capabilities list.
-+**===============================================================================
-+** 0xF1: Next Item Pointer - PX_NXTP
-+** Bit Default Description
-+** 07:00 00h Next Item Pointer: Points to the next capability in the linked list The power on default value of this
-+** register is 00h indicating that this is the last entry in the linked list of capabilities.
-+**===============================================================================
-+** 0xF3-0xF2: PCI-X Secondary Status - PX_SSTS
-+** Bit Default Description
-+** 15:09 00h Reserved
-+** 08:06 Xxx Secondary Clock Frequency (SCF): This field is set with the frequency of the secondary bus.
-+** The values are:
-+** BitsMax FrequencyClock Period
-+** 000PCI ModeN/A
-+** 00166 15
-+** 01010010
-+** 0111337.5
-+** 1xxreservedreserved
-+** The default value for this register is the operating frequency of the secondary bus
-+** 05 0b Split Request Delayed. (SRD): This bit is supposed to be set by a bridge when it cannot forward a transaction on the
-+** secondary bus to the primary bus because there is not enough room within the limit
-+** specified in the Split Transaction Commitment Limit field in the Downstream Split
-+** Transaction Control register. The bridge does not set this bit.
-+** 04 0b Split Completion Overrun (SCO): This bit is supposed to be set when a bridge terminates a Split Completion on the secondary bus with retry or Disconnect at next ADB because its buffers are full. The bridge does not set this bit.
-+** 03 0b Unexpected Split Completion (USC): This bit is set when an unexpected split completion with a requester ID equal to bridge secondary bus number, device number 00h, and function number 0 is received on the secondary interface. This bit is cleared by software writing a '1'.
-+** 02 0b Split Completion Discarded (SCD): This bit is set when bridge discards a split completion moving toward the secondary bus because the requester would not accept it. This bit cleared by software writing a '1'.
-+** 01 1b 133 MHz Capable: Indicates that bridge is capable of running its secondary bus at 133 MHz
-+** 00 1b 64-bit Device (D64): Indicates the width of the secondary bus as 64-bits.
-+**===============================================================================
-+** 0xF7-0xF6-0xf5-0xF4: PCI-X Bridge Status - PX_BSTS
-+** Bit Default Description
-+** 31:22 0 Reserved
-+** 21 0 Split Request Delayed (SRD): This bit does not be set by bridge.
-+** 20 0 Split Completion Overrun (SCO): This bit does not be set by bridge because bridge throttles traffic on the completion side.
-+** 19 0 Unexpected Split Completion (USC): The bridge sets this bit to 1b when it encounters a corrupted Split Completion, possibly with an inconsistent remaining byte count.Software clears this bit by writing a 1b to it.
-+** 18 0 Split Completion Discarded (SCD): The bridge sets this bit to 1b when it has discarded a Split Completion.Software clears this bit by writing a 1b to it.
-+** 17 1 133 MHz Capable: This bit indicates that the bridge primary interface is capable of 133 MHz operation in PCI-X mode.
-+** 0=The maximum operating frequency is 66 MHz.
-+** 1=The maximum operating frequency is 133 MHz.
-+** 16 Varies with the external state of P_32BITPCI# at PCI Bus Reset 64-bit Device (D64): Indicates bus width of the Primary PCI bus interface.
-+** 0=Primary Interface is connected as a 32-bit PCI bus.
-+** 1=Primary Interface is connected as a 64-bit PCI bus.
-+** 15:08 00h Bus Number (BNUM): This field is simply an alias to the PBN field of the BNUM register at offset 18h.
-+** Apparently it was deemed necessary reflect it here for diagnostic purposes.
-+** 07:03 1fh Device Number (DNUM): Indicates which IDSEL bridge consumes. May be updated whenever a PCI-X
-+** configuration write cycle that targets bridge scores a hit.
-+** 02:00 0h Function Number (FNUM): The bridge Function #
-+**===============================================================================
-+** 0xFB-0xFA-0xF9-0xF8: PCI-X Upstream Split Transaction Control - PX_USTC
-+** Bit Default Description
-+** 31:16 003Eh Split Transaction Limit (STL): This register indicates the size of the commitment limit in units of ADQs.
-+** Software is permitted to program this register to any value greater than or equal to
-+** the contents of the Split Transaction Capacity register. A value less than the contents
-+** of the Split Transaction Capacity register causes unspecified results.
-+** A value of 003Eh or greater enables the bridge to forward all Split Requests of any
-+** size regardless of the amount of buffer space available.
-+** 15:00 003Eh Split Transaction Capacity (STC): This read-only field indicates the size of the buffer (number of ADQs) for storing
-+** split completions. This register controls behavior of the bridge buffers for forwarding
-+** Split Transactions from a primary bus requester to a secondary bus completer.
-+** The default value of 003Eh indicates there is available buffer space for 62 ADQs (7936 bytes).
-+**===============================================================================
-+** 0xFF-0xFE-0xFD-0xFC: PCI-X Downstream Split Transaction Control - PX_DSTC
-+** Bit Default Description
-+** 31:16 003Eh Split Transaction Limit (STL): This register indicates the size of the commitment limit in units of ADQs.
-+** Software is permitted to program this register to any value greater than or equal to
-+** the contents of the Split Transaction Capacity register. A value less than the contents
-+** of the Split Transaction Capacity register causes unspecified results.
-+** A value of 003Eh or greater enables the bridge to forward all Split Requests of any
-+** size regardless of the amount of buffer space available.
-+** 15:00 003Eh Split Transaction Capacity (STC): This read-only field indicates the size of the buffer (number of ADQs) for storing
-+** split completions. This register controls behavior of the bridge buffers for forwarding
-+** Split Transactions from a primary bus requester to a secondary bus completer.
-+** The default value of 003Eh indicates there is available buffer space for 62 ADQs (7936 bytes).
-+**************************************************************************
-+*/
-+
-+
-+
-+
-+/*
-+*************************************************************************************************************************************
-+** 80331 Address Translation Unit Register Definitions
-+** ATU Interface Configuration Header Format
-+** The ATU is programmed via a [Type 0] configuration command on the PCI interface.
-+*************************************************************************************************************************************
-+** | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Configuration Byte Offset
-+**===================================================================================================================================
-+** | ATU Device ID | Vendor ID | 00h
-+** ----------------------------------------------------------------------------------------------------------
-+** | Status | Command | 04H
-+** ----------------------------------------------------------------------------------------------------------
-+** | ATU Class Code | Revision ID | 08H
-+** ----------------------------------------------------------------------------------------------------------
-+** | ATUBISTR | Header Type | Latency Timer | Cacheline Size | 0CH
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Base Address 0 | 10H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Upper Base Address 0 | 14H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Base Address 1 | 18H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Upper Base Address 1 | 1CH
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Base Address 2 | 20H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Inbound ATU Upper Base Address 2 | 24H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 28H
-+** ----------------------------------------------------------------------------------------------------------
-+** | ATU Subsystem ID | ATU Subsystem Vendor ID | 2CH
-+** ----------------------------------------------------------------------------------------------------------
-+** | Expansion ROM Base Address | 30H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved Capabilities Pointer | 34H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Reserved | 38H
-+** ----------------------------------------------------------------------------------------------------------
-+** | Maximum Latency | Minimum Grant | Interrupt Pin | Interrupt Line | 3CH
-+** ----------------------------------------------------------------------------------------------------------
-+*********************************************************************************************************************
-+*/
-+/*
-+***********************************************************************************
-+** ATU Vendor ID Register - ATUVID
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:00 8086H (0x17D3) ATU Vendor ID - This is a 16-bit value assigned to Intel. This register, combined with the DID, uniquely identify the PCI device.
-+** Access type is Read/Write to allow the 80331 to configure the register as a different vendor ID to simulate the interface of a standard mechanism currently used by existing application software.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_VENDOR_ID_REG 0x00 /*word*/
-+/*
-+***********************************************************************************
-+** ATU Device ID Register - ATUDID
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:00 0336H (0x1110) ATU Device ID - This is a 16-bit value assigned to the ATU. This ID, combined with the VID, uniquely identify any PCI device.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_DEVICE_ID_REG 0x02 /*word*/
-+/*
-+***********************************************************************************
-+** ATU Command Register - ATUCMD
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:11 000000 2 Reserved
-+** 10 0 Interrupt Disable - This bit disables 80331 from asserting the ATU interrupt signal.
-+** 0=enables the assertion of interrupt signal.
-+** 1=disables the assertion of its interrupt signal.
-+** 09 0 2 Fast Back to Back Enable - When cleared, the ATU interface is not allowed to generate fast back-to-back cycles on its bus. Ignored when operating in the PCI-X mode.
-+** 08 0 2 SERR# Enable - When cleared, the ATU interface is not allowed to assert SERR# on the PCI interface.
-+** 07 1 2 Address/Data Stepping Control - Address stepping is implemented for configuration transactions. The
-+** ATU inserts 2 clock cycles of address stepping for Conventional Mode and 4 clock cycles of address stepping for PCI-X mode.
-+** 06 0 2 Parity Error Response - When set, the ATU takes normal action when a parity error is detected. When cleared, parity checking is disabled.
-+** 05 0 2 VGA Palette Snoop Enable - The ATU interface does not support I/O writes and therefore, does not perform VGA palette snooping.
-+** 04 0 2 Memory Write and Invalidate Enable - When set, ATU may generate MWI commands. When clear, ATU use Memory Write commands instead of MWI. Ignored when operating in the PCI-X mode.
-+** 03 0 2 Special Cycle Enable - The ATU interface does not respond to special cycle commands in any way. Not implemented and a reserved bit field.
-+** 02 0 2 Bus Master Enable - The ATU interface can act as a master on the PCI bus. When cleared, disables the device from generating PCI accesses. When set, allows the device to behave as a PCI bus master.
-+** When operating in the PCI-X mode, ATU initiates a split completion transaction regardless of the state of this bit.
-+** 01 0 2 Memory Enable - Controls the ATU interface¡¦s response to PCI memory addresses. When cleared, the ATU interface does not respond to any memory access on the PCI bus.
-+** 00 0 2 I/O Space Enable - Controls the ATU interface response to I/O transactions. Not implemented and a reserved bit field.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_COMMAND_REG 0x04 /*word*/
-+/*
-+***********************************************************************************
-+** ATU Status Register - ATUSR (Sheet 1 of 2)
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15 0 2 Detected Parity Error - set when a parity error is detected in data received by the ATU on the PCI bus even
-+** when the ATUCMD register¡¦s Parity Error Response bit is cleared. Set under the following conditions:
-+** ¡E Write Data Parity Error when the ATU is a target (inbound write).
-+** ¡E Read Data Parity Error when the ATU is a requester (outbound read).
-+** ¡E Any Address or Attribute (PCI-X Only) Parity Error on the Bus (including one generated by the ATU).
-+** 14 0 2 SERR# Asserted - set when SERR# is asserted on the PCI bus by the ATU.
-+** 13 0 2 Master Abort - set when a transaction initiated by the ATU PCI master interface, ends in a Master-Abort
-+** or when the ATU receives a Master Abort Split Completion Error Message in PCI-X mode.
-+** 12 0 2 Target Abort (master) - set when a transaction initiated by the ATU PCI master interface, ends in a target
-+** abort or when the ATU receives a Target Abort Split Completion Error Message in PCI-X mode.
-+** 11 0 2 Target Abort (target) - set when the ATU interface, acting as a target, terminates the transaction on the PCI bus with a target abort.
-+** 10:09 01 2 DEVSEL# Timing - These bits are read-only and define the slowest DEVSEL# timing for a target device in Conventional PCI Mode regardless of the operating mode (except configuration accesses).
-+** 00 2=Fast
-+** 01 2=Medium
-+** 10 2=Slow
-+** 11 2=Reserved
-+** The ATU interface uses Medium timing.
-+** 08 0 2 Master Parity Error - The ATU interface sets this bit under the following conditions:
-+** ¡E The ATU asserted PERR# itself or the ATU observed PERR# asserted.
-+** ¡E And the ATU acted as the requester for the operation in which the error occurred.
-+** ¡E And the ATUCMD register¡¦s Parity Error Response bit is set
-+** ¡E Or (PCI-X Mode Only) the ATU received a Write Data Parity Error Message
-+** ¡E And the ATUCMD register¡¦s Parity Error Response bit is set
-+** 07 1 2 (Conventional mode)
-+** 0 2 (PCI-X mode)
-+** Fast Back-to-Back - The ATU/Messaging Unit interface is capable of accepting fast back-to-back
-+** transactions in Conventional PCI mode when the transactions are not to the same target. Since fast
-+** back-to-back transactions do not exist in PCI-X mode, this bit is forced to 0 in the PCI-X mode.
-+** 06 0 2 UDF Supported - User Definable Features are not supported
-+** 05 1 2 66 MHz. Capable - 66 MHz operation is supported.
-+** 04 1 2 Capabilities - When set, this function implements extended capabilities.
-+** 03 0 Interrupt Status - reflects the state of the ATU interrupt when the Interrupt Disable bit in the command register is a 0.
-+** 0=ATU interrupt signal deasserted.
-+** 1=ATU interrupt signal asserted.
-+** NOTE: Setting the Interrupt Disable bit to a 1 has no effect on the state of this bit. Refer to
-+** Section 3.10.23, ¡§ATU Interrupt Pin Register - ATUIPR¡¨ on page 236 for details on the ATU
-+** interrupt signal.
-+** 02:00 00000 2 Reserved.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_STATUS_REG 0x06 /*word*/
-+/*
-+***********************************************************************************
-+** ATU Revision ID Register - ATURID
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 00H ATU Revision - identifies the 80331 revision number.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_REVISION_REG 0x08 /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Class Code Register - ATUCCR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 23:16 05H Base Class - Memory Controller
-+** 15:08 80H Sub Class - Other Memory Controller
-+** 07:00 00H Programming Interface - None defined
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_CLASS_CODE_REG 0x09 /*3bytes 0x0B,0x0A,0x09*/
-+/*
-+***********************************************************************************
-+** ATU Cacheline Size Register - ATUCLSR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 00H ATU Cacheline Size - specifies the system cacheline size in DWORDs. Cacheline size is restricted to either 0, 8 or 16 DWORDs.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_CACHELINE_SIZE_REG 0x0C /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Latency Timer Register - ATULT
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:03 00000 2 (for Conventional mode)
-+** 01000 2 (for PCI-X mode)
-+** Programmable Latency Timer - This field varies the latency timer for the interface from 0 to 248 clocks.
-+** The default value is 0 clocks for Conventional PCI mode, and 64 clocks for PCI-X mode.
-+** 02:00 000 2 Latency Timer Granularity - These Bits are read only giving a programmable granularity of 8 clocks for the latency timer.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_LATENCY_TIMER_REG 0x0D /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Header Type Register - ATUHTR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07 0 2 Single Function/Multi-Function Device - Identifies the 80331 as a single-function PCI device.
-+** 06:00 000000 2 PCI Header Type - This bit field indicates the type of PCI header implemented. The ATU interface
-+** header conforms to PCI Local Bus Specification, Revision 2.3.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_HEADER_TYPE_REG 0x0E /*byte*/
-+/*
-+***********************************************************************************
-+** ATU BIST Register - ATUBISTR
-+**
-+** The ATU BIST Register controls the functions the Intel XScale core performs when BIST is
-+** initiated. This register is the interface between the host processor requesting BIST functions and
-+** the 80331 replying with the results from the software implementation of the BIST functionality.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07 0 2 BIST Capable - This bit value is always equal to the ATUCR ATU BIST Interrupt Enable bit.
-+** 06 0 2 Start BIST - When the ATUCR BIST Interrupt Enable bit is set:
-+** Setting this bit generates an interrupt to the Intel XScale core to perform a software BIST function.
-+** The Intel XScale core clears this bit when the BIST software has completed with the BIST results
-+** found in ATUBISTR register bits [3:0].
-+** When the ATUCR BIST Interrupt Enable bit is clear:
-+** Setting this bit does not generate an interrupt to the Intel XScale core and no BIST functions is performed.
-+** The Intel XScale core does not clear this bit.
-+** 05:04 00 2 Reserved
-+** 03:00 0000 2 BIST Completion Code - when the ATUCR BIST Interrupt Enable bit is set and the ATUBISTR Start BIST bit is set (bit 6):
-+** The Intel XScale core places the results of the software BIST in these bits. A nonzero value indicates a device-specific error.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_BIST_REG 0x0F /*byte*/
-+
-+/*
-+***************************************************************************************
-+** ATU Base Registers and Associated Limit Registers
-+***************************************************************************************
-+** Base Address Register Limit Register Description
-+** Inbound ATU Base Address Register 0 Inbound ATU Limit Register 0 Defines the inbound translation window 0 from the PCI bus.
-+** Inbound ATU Upper Base Address Register 0 N/A Together with ATU Base Address Register 0 defines the inbound translation window 0 from the PCI bus for DACs.
-+** Inbound ATU Base Address Register 1 Inbound ATU Limit Register 1 Defines inbound window 1 from the PCI bus.
-+** Inbound ATU Upper Base Address Register 1 N/A Together with ATU Base Address Register 1 defines inbound window 1 from the PCI bus for DACs.
-+** Inbound ATU Base Address Register 2 Inbound ATU Limit Register 2 Defines the inbound translation window 2 from the PCI bus.
-+** Inbound ATU Upper Base Address Register 2 N/A Together with ATU Base Address Register 2 defines the inbound translation window 2 from the PCI bus for DACs.
-+** Inbound ATU Base Address Register 3 Inbound ATU Limit Register 3 Defines the inbound translation window 3 from the PCI bus.
-+** Inbound ATU Upper Base Address Register 3 N/A Together with ATU Base Address Register 3 defines the inbound translation window 3 from the PCI bus for DACs.
-+** NOTE: This is a private BAR that resides outside of the standard PCI configuration header space (offsets 00H-3FH).
-+** Expansion ROM Base Address Register Expansion ROM Limit Register Defines the window of addresses used by a bus master for reading from an Expansion ROM.
-+**--------------------------------------------------------------------------------------
-+** ATU Inbound Window 1 is not a translate window.
-+** The ATU does not claim any PCI accesses that fall within this range.
-+** This window is used to allocate host memory for use by Private Devices.
-+** When enabled, the ATU interrupts the Intel XScale core when either the IABAR1 register or the IAUBAR1 register is written from the PCI bus.
-+***********************************************************************************
-+*/
-+
-+/*
-+***********************************************************************************
-+** Inbound ATU Base Address Register 0 - IABAR0
-+**
-+** . The Inbound ATU Base Address Register 0 (IABAR0) together with the Inbound ATU Upper Base Address Register 0 (IAUBAR0) defines the block of memory addresses where the inbound translation window 0 begins.
-+** . The inbound ATU decodes and forwards the bus request to the 80331 internal bus with a translated address to map into 80331 local memory.
-+** . The IABAR0 and IAUBAR0 define the base address and describes the required memory block size.
-+** . Bits 31 through 12 of the IABAR0 is either read/write bits or read only with a value of 0
-+** depending on the value located within the IALR0.
-+** This configuration allows the IABAR0 to be programmed per PCI Local Bus Specification.
-+** The first 4 Kbytes of memory defined by the IABAR0, IAUBAR0 and the IALR0 is reserved for the Messaging Unit.
-+** The programmed value within the base address register must comply with the PCI programming requirements for address alignment.
-+** Warning:
-+** When IALR0 is cleared prior to host configuration:
-+** the user should also clear the Prefetchable Indicator and the Type Indicator.
-+** Assuming IALR0 is not cleared:
-+** a. Since non prefetchable memory windows can never be placed above the 4 Gbyte address boundary,
-+** when the Prefetchable Indicator is cleared prior to host configuration,
-+** the user should also set the Type Indicator for 32 bit addressability.
-+** b. For compliance to the PCI-X Addendum to the PCI Local Bus Specification,
-+** when the Prefetchable Indicator is set prior to host configuration, the user
-+** should also set the Type Indicator for 64 bit addressability.
-+** This is the default for IABAR0.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Translation Base Address 0 - These bits define the actual location the translation function is to respond to when addressed from the PCI bus.
-+** 11:04 00H Reserved.
-+** 03 1 2 Prefetchable Indicator - When set, defines the memory space as prefetchable.
-+** 02:01 10 2 Type Indicator - Defines the width of the addressability for this memory window:
-+** 00 - Memory Window is locatable anywhere in 32 bit address space
-+** 10 - Memory Window is locatable anywhere in 64 bit address space
-+** 00 0 2 Memory Space Indicator - This bit field describes memory or I/O space base address.
-+** The ATU does not occupy I/O space,
-+** thus this bit must be zero.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_BASE_ADDRESS0_REG 0x10 /*dword 0x13,0x12,0x11,0x10*/
-+#define ARCMSR_INBOUND_ATU_MEMORY_PREFETCHABLE 0x08
-+#define ARCMSR_INBOUND_ATU_MEMORY_WINDOW64 0x04
-+/*
-+***********************************************************************************
-+** Inbound ATU Upper Base Address Register 0 - IAUBAR0
-+**
-+** This register contains the upper base address when decoding PCI addresses beyond 4 GBytes.
-+** Together with the Translation Base Address this register defines the actual location the translation
-+** function is to respond to when addressed from the PCI bus for addresses > 4GBytes (for DACs).
-+** The programmed value within the base address register must comply with the PCI programming requirements for address alignment.
-+** Note:
-+** When the Type indicator of IABAR0 is set to indicate 32 bit addressability,
-+** the IAUBAR0 register attributes are read-only.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:0 00000H Translation Upper Base Address 0 - Together with the Translation Base Address 0 these bits define the
-+** actual location the translation function is to respond to when addressed from the PCI bus for addresses > 4GBytes.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_UPPER_BASE_ADDRESS0_REG 0x14 /*dword 0x17,0x16,0x15,0x14*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Base Address Register 1 - IABAR1
-+**
-+** . The Inbound ATU Base Address Register (IABAR1) together with the Inbound ATU Upper Base Address Register 1 (IAUBAR1) defines the block of memory addresses where the inbound translation window 1 begins.
-+** . This window is used merely to allocate memory on the PCI bus and, the ATU does not process any PCI bus transactions to this memory range.
-+** . The programmed value within the base address register must comply with the PCI programming requirements for address alignment.
-+** . When enabled, the ATU interrupts the Intel XScale core when the IABAR1 register is written from the PCI bus.
-+** Warning:
-+** When a non-zero value is not written to IALR1 prior to host configuration,
-+** the user should not set either the Prefetchable Indicator or the Type Indicator for 64 bit addressability.
-+** This is the default for IABAR1.
-+** Assuming a non-zero value is written to IALR1,
-+** the user may set the Prefetchable Indicator
-+** or the Type Indicator:
-+** a. Since non prefetchable memory windows can never be placed above the 4 Gbyte address
-+** boundary, when the Prefetchable Indicator is not set prior to host configuration,
-+** the user should also leave the Type Indicator set for 32 bit addressability.
-+** This is the default for IABAR1.
-+** b. when the Prefetchable Indicator is set prior to host configuration,
-+** the user should also set the Type Indicator for 64 bit addressability.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Translation Base Address 1 - These bits define the actual location of window 1 on the PCI bus.
-+** 11:04 00H Reserved.
-+** 03 0 2 Prefetchable Indicator - When set, defines the memory space as prefetchable.
-+** 02:01 00 2 Type Indicator - Defines the width of the addressability for this memory window:
-+** 00 - Memory Window is locatable anywhere in 32 bit address space
-+** 10 - Memory Window is locatable anywhere in 64 bit address space
-+** 00 0 2 Memory Space Indicator - This bit field describes memory or I/O space base address.
-+** The ATU does not occupy I/O space,
-+** thus this bit must be zero.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_BASE_ADDRESS1_REG 0x18 /*dword 0x1B,0x1A,0x19,0x18*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Upper Base Address Register 1 - IAUBAR1
-+**
-+** This register contains the upper base address when locating this window for PCI addresses beyond 4 GBytes.
-+** Together with the IABAR1 this register defines the actual location for this memory window for addresses > 4GBytes (for DACs).
-+** This window is used merely to allocate memory on the PCI bus and, the ATU does not process any PCI bus transactions to this memory range.
-+** The programmed value within the base address register must comply with the PCI programming
-+** requirements for address alignment.
-+** When enabled, the ATU interrupts the Intel XScale core when the IAUBAR1 register is written
-+** from the PCI bus.
-+** Note:
-+** When the Type indicator of IABAR1 is set to indicate 32 bit addressability,
-+** the IAUBAR1 register attributes are read-only.
-+** This is the default for IABAR1.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:0 00000H Translation Upper Base Address 1 - Together with the Translation Base Address 1 these bits define the actual location for this memory window on the PCI bus for addresses > 4GBytes.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_UPPER_BASE_ADDRESS1_REG 0x1C /*dword 0x1F,0x1E,0x1D,0x1C*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Base Address Register 2 - IABAR2
-+**
-+** . The Inbound ATU Base Address Register 2 (IABAR2) together with the Inbound ATU Upper Base Address Register 2 (IAUBAR2) defines the block of memory addresses where the inbound translation window 2 begins.
-+** . The inbound ATU decodes and forwards the bus request to the 80331 internal bus with a translated address to map into 80331 local memory.
-+** . The IABAR2 and IAUBAR2 define the base address and describes the required memory block size
-+** . Bits 31 through 12 of the IABAR2 is either read/write bits or read only with a value of 0 depending on the value located within the IALR2.
-+** The programmed value within the base address register must comply with the PCI programming requirements for address alignment.
-+** Warning:
-+** When a non-zero value is not written to IALR2 prior to host configuration,
-+** the user should not set either the Prefetchable Indicator
-+** or the Type Indicator for 64 bit addressability.
-+** This is the default for IABAR2.
-+** Assuming a non-zero value is written to IALR2,
-+** the user may set the Prefetchable Indicator
-+** or the Type Indicator:
-+** a. Since non prefetchable memory windows can never be placed above the 4 Gbyte address boundary,
-+** when the Prefetchable Indicator is not set prior to host configuration,
-+** the user should also leave the Type Indicator set for 32 bit addressability.
-+** This is the default for IABAR2.
-+** b. when the Prefetchable Indicator is set prior to host configuration,
-+** the user should also set the Type Indicator for 64 bit addressability.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Translation Base Address 2 - These bits define the actual location the translation function is to respond to when addressed from the PCI bus.
-+** 11:04 00H Reserved.
-+** 03 0 2 Prefetchable Indicator - When set, defines the memory space as prefetchable.
-+** 02:01 00 2 Type Indicator - Defines the width of the addressability for this memory window:
-+** 00 - Memory Window is locatable anywhere in 32 bit address space
-+** 10 - Memory Window is locatable anywhere in 64 bit address space
-+** 00 0 2 Memory Space Indicator - This bit field describes memory or I/O space base address.
-+** The ATU does not occupy I/O space,
-+** thus this bit must be zero.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_BASE_ADDRESS2_REG 0x20 /*dword 0x23,0x22,0x21,0x20*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Upper Base Address Register 2 - IAUBAR2
-+**
-+** This register contains the upper base address when decoding PCI addresses beyond 4 GBytes.
-+** Together with the Translation Base Address this register defines the actual location the translation function is to respond to when addressed from the PCI bus for addresses > 4GBytes (for DACs).
-+** The programmed value within the base address register must comply with the PCI programming
-+** requirements for address alignment.
-+** Note:
-+** When the Type indicator of IABAR2 is set to indicate 32 bit addressability,
-+** the IAUBAR2 register attributes are read-only.
-+** This is the default for IABAR2.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:0 00000H Translation Upper Base Address 2 - Together with the Translation Base Address 2 these bits define the actual location the translation function is to respond to when addressed from the PCI bus for addresses > 4GBytes.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_UPPER_BASE_ADDRESS2_REG 0x24 /*dword 0x27,0x26,0x25,0x24*/
-+/*
-+***********************************************************************************
-+** ATU Subsystem Vendor ID Register - ASVIR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:0 0000H Subsystem Vendor ID - This register uniquely identifies the add-in board or subsystem vendor.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_SUBSYSTEM_VENDOR_ID_REG 0x2C /*word 0x2D,0x2C*/
-+/*
-+***********************************************************************************
-+** ATU Subsystem ID Register - ASIR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:0 0000H Subsystem ID - uniquely identifies the add-in board or subsystem.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_SUBSYSTEM_ID_REG 0x2E /*word 0x2F,0x2E*/
-+/*
-+***********************************************************************************
-+** Expansion ROM Base Address Register -ERBAR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Expansion ROM Base Address - These bits define the actual location where the Expansion ROM address window resides when addressed from the PCI bus on any 4 Kbyte boundary.
-+** 11:01 000H Reserved
-+** 00 0 2 Address Decode Enable - This bit field shows the ROM address decoder is enabled or disabled. When cleared, indicates the address decoder is disabled.
-+***********************************************************************************
-+*/
-+#define ARCMSR_EXPANSION_ROM_BASE_ADDRESS_REG 0x30 /*dword 0x33,0x32,0v31,0x30*/
-+#define ARCMSR_EXPANSION_ROM_ADDRESS_DECODE_ENABLE 0x01
-+/*
-+***********************************************************************************
-+** ATU Capabilities Pointer Register - ATU_CAP_PTR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 C0H Capability List Pointer - This provides an offset in this function¡¦s configuration space that points to the 80331 PCl Bus Power Management extended capability.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_CAPABILITY_PTR_REG 0x34 /*byte*/
-+/*
-+***********************************************************************************
-+** Determining Block Sizes for Base Address Registers
-+** The required address size and type can be determined by writing ones to a base address register and
-+** reading from the registers. By scanning the returned value from the least-significant bit of the base
-+** address registers upwards, the programmer can determine the required address space size. The
-+** binary-weighted value of the first non-zero bit found indicates the required amount of space.
-+** Table 105 describes the relationship between the values read back and the byte sizes the base
-+** address register requires.
-+** As an example, assume that FFFF.FFFFH is written to the ATU Inbound Base Address Register 0
-+** (IABAR0) and the value read back is FFF0.0008H. Bit zero is a zero, so the device requires
-+** memory address space. Bit three is one, so the memory does supports prefetching. Scanning
-+** upwards starting at bit four, bit twenty is the first one bit found. The binary-weighted value of this
-+** bit is 1,048,576, indicated that the device requires 1 Mbyte of memory space.
-+** The ATU Base Address Registers and the Expansion ROM Base Address Register use their
-+** associated limit registers to enable which bits within the base address register are read/write and
-+** which bits are read only (0). This allows the programming of these registers in a manner similar to
-+** other PCI devices even though the limit is variable.
-+** Table 105. Memory Block Size Read Response
-+** Response After Writing all 1s
-+** to the Base Address Register
-+** Size
-+** (Bytes)
-+** Response After Writing all 1s
-+** to the Base Address Register
-+** Size
-+** (Bytes)
-+** FFFFFFF0H 16 FFF00000H 1 M
-+** FFFFFFE0H 32 FFE00000H 2 M
-+** FFFFFFC0H 64 FFC00000H 4 M
-+** FFFFFF80H 128 FF800000H 8 M
-+** FFFFFF00H 256 FF000000H 16 M
-+** FFFFFE00H 512 FE000000H 32 M
-+** FFFFFC00H 1K FC000000H 64 M
-+** FFFFF800H 2K F8000000H 128 M
-+** FFFFF000H 4K F0000000H 256 M
-+** FFFFE000H 8K E0000000H 512 M
-+** FFFFC000H 16K C0000000H 1 G
-+** FFFF8000H 32K 80000000H 2 G
-+** FFFF0000H 64K
-+** 00000000H
-+** Register not
-+** imple-mented,
-+** no
-+** address
-+** space
-+** required.
-+** FFFE0000H 128K
-+** FFFC0000H 256K
-+** FFF80000H 512K
-+**
-+***************************************************************************************
-+*/
-+
-+
-+
-+/*
-+***********************************************************************************
-+** ATU Interrupt Line Register - ATUILR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 FFH Interrupt Assigned - system-assigned value identifies which system interrupt controller¡¦s interrupt
-+** request line connects to the device's PCI interrupt request lines (as specified in the interrupt pin register).
-+** A value of FFH signifies ¡§no connection¡¨ or ¡§unknown¡¨.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_INTERRUPT_LINE_REG 0x3C /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Interrupt Pin Register - ATUIPR
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 01H Interrupt Used - A value of 01H signifies that the ATU interface unit uses INTA# as the interrupt pin.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_INTERRUPT_PIN_REG 0x3D /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Minimum Grant Register - ATUMGNT
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 80H This register specifies how long a burst period the device needs in increments of 8 PCI clocks.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_MINIMUM_GRANT_REG 0x3E /*byte*/
-+/*
-+***********************************************************************************
-+** ATU Maximum Latency Register - ATUMLAT
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 00H Specifies frequency (how often) the device needs to access the PCI bus in increments of 8 PCI clocks. A zero value indicates the device has no stringent requirement.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_MAXIMUM_LATENCY_REG 0x3F /*byte*/
-+/*
-+***********************************************************************************
-+** Inbound Address Translation
-+**
-+** The ATU allows external PCI bus initiators to directly access the internal bus.
-+** These PCI bus initiators can read or write 80331 memory-mapped registers or 80331 local memory space.
-+** The process of inbound address translation involves two steps:
-+** 1. Address Detection.
-+** ¡E Determine when the 32-bit PCI address (64-bit PCI address during DACs) is
-+** within the address windows defined for the inbound ATU.
-+** ¡E Claim the PCI transaction with medium DEVSEL# timing in the conventional PCI
-+** mode and with Decode A DEVSEL# timing in the PCI-X mode.
-+** 2. Address Translation.
-+** ¡E Translate the 32-bit PCI address (lower 32-bit PCI address during DACs) to a 32-bit 80331 internal bus address.
-+** The ATU uses the following registers in inbound address window 0 translation:
-+** ¡E Inbound ATU Base Address Register 0
-+** ¡E Inbound ATU Limit Register 0
-+** ¡E Inbound ATU Translate Value Register 0
-+** The ATU uses the following registers in inbound address window 2 translation:
-+** ¡E Inbound ATU Base Address Register 2
-+** ¡E Inbound ATU Limit Register 2
-+** ¡E Inbound ATU Translate Value Register 2
-+** The ATU uses the following registers in inbound address window 3 translation:
-+** ¡E Inbound ATU Base Address Register 3
-+** ¡E Inbound ATU Limit Register 3
-+** ¡E Inbound ATU Translate Value Register 3
-+** Note: Inbound Address window 1 is not a translate window.
-+** Instead, window 1 may be used to allocate host memory for Private Devices.
-+** Inbound Address window 3 does not reside in the standard section of the configuration header (offsets 00H - 3CH),
-+** thus the host BIOS does not configure window 3.
-+** Window 3 is intended to be used as a special window into local memory for private PCI
-+** agents controlled by the 80331 in conjunction with the Private Memory Space of the bridge.
-+** PCI-to-PCI Bridge in 80331 or
-+** Inbound address detection is determined from the 32-bit PCI address,
-+** (64-bit PCI address during DACs) the base address register and the limit register.
-+** In the case of DACs none of the upper 32-bits of the address is masked during address comparison.
-+**
-+** The algorithm for detection is:
-+**
-+** Equation 1. Inbound Address Detection
-+** When (PCI_Address [31:0] & Limit_Register[31:0]) == (Base_Register[31:0] & PCI_Address [63:32]) == Base_Register[63:32] (for DACs only)
-+** the PCI Address is claimed by the Inbound ATU.
-+**
-+** The incoming 32-bit PCI address (lower 32-bits of the address in case of DACs) is bitwise ANDed
-+** with the associated inbound limit register.
-+** When the result matches the base register (and upper base address matches upper PCI address in case of DACs),
-+** the inbound PCI address is detected as being within the inbound translation window and is claimed by the ATU.
-+**
-+** Note: The first 4 Kbytes of the ATU inbound address translation window 0 are reserved for the Messaging Unit.
-+** Once the transaction is claimed, the address must be translated from a PCI address to a 32-bit
-+** internal bus address. In case of DACs upper 32-bits of the address is simply discarded and only the
-+** lower 32-bits are used during address translation.
-+** The algorithm is:
-+**
-+**
-+** Equation 2. Inbound Translation
-+** Intel I/O processor Internal Bus Address=(PCI_Address[31:0] & ~Limit_Register[31:0]) | ATU_Translate_Value_Register[31:0].
-+**
-+** The incoming 32-bit PCI address (lower 32-bits in case of DACs) is first bitwise ANDed with the
-+** bitwise inverse of the limit register. This result is bitwise ORed with the ATU Translate Value and
-+** the result is the internal bus address. This translation mechanism is used for all inbound memory
-+** read and write commands excluding inbound configuration read and writes.
-+** In the PCI mode for inbound memory transactions, the only burst order supported is Linear
-+** Incrementing. For any other burst order, the ATU signals a Disconnect after the first data phase.
-+** The PCI-X supports linear incrementing only, and hence above situation is not encountered in the PCI-X mode.
-+** example:
-+** Register Values
-+** Base_Register=3A00 0000H
-+** Limit_Register=FF80 0000H (8 Mbyte limit value)
-+** Value_Register=B100 0000H
-+** Inbound Translation Window ranges from 3A00 0000H to 3A7F FFFFH (8 Mbytes)
-+**
-+** Address Detection (32-bit address)
-+**
-+** PCI_Address & Limit_Register == Base_Register
-+** 3A45 012CH & FF80 0000H == 3A00 0000H
-+**
-+** ANS: PCI_Address is in the Inbound Translation Window
-+** Address Translation (to get internal bus address)
-+**
-+** IB_Address=(PCI_Address & ~Limit_Register) | Value_Reg
-+** IB_Address=(3A45 012CH & 007F FFFFH) | B100 0000H
-+**
-+** ANS:IB_Address=B145 012CH
-+***********************************************************************************
-+*/
-+
-+
-+
-+/*
-+***********************************************************************************
-+** Inbound ATU Limit Register 0 - IALR0
-+**
-+** Inbound address translation for memory window 0 occurs for data transfers occurring from the PCI
-+** bus (originated from the PCI bus) to the 80331 internal bus. The address translation block converts
-+** PCI addresses to internal bus addresses.
-+** The 80331 translate value register¡¦s programmed value must be naturally aligned with the base
-+** address register¡¦s programmed value. The limit register is used as a mask; thus, the lower address
-+** bits programmed into the 80331 translate value register are invalid. Refer to the PCI Local Bus
-+** Specification, Revision 2.3 for additional information on programming base address registers.
-+** Bits 31 to 12 within the IALR0 have a direct effect on the IABAR0 register, bits 31 to 12, with a
-+** one to one correspondence. A value of 0 in a bit within the IALR0 makes the corresponding bit
-+** within the IABAR0 a read only bit which always returns 0. A value of 1 in a bit within the IALR0
-+** makes the corresponding bit within the IABAR0 read/write from PCI. Note that a consequence of
-+** this programming scheme is that unless a valid value exists within the IALR0, all writes to the
-+** IABAR0 has no effect since a value of all zeros within the IALR0 makes the IABAR0 a read only register.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 FF000H Inbound Translation Limit 0 - This readback value determines the memory block size required for
-+** inbound memory window 0 of the address translation unit. This defaults to an inbound window of 16MB.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_LIMIT0_REG 0x40 /*dword 0x43,0x42,0x41,0x40*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Translate Value Register 0 - IATVR0
-+**
-+** The Inbound ATU Translate Value Register 0 (IATVR0) contains the internal bus address used to
-+** convert PCI bus addresses. The converted address is driven on the internal bus as a result of the
-+** inbound ATU address translation.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 FF000H Inbound ATU Translation Value 0 - This value is used to convert the PCI address to internal bus addresses.
-+** This value must be 64-bit aligned on the internal bus. The default address allows the ATU to access the internal 80331 memory-mapped registers.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_TRANSLATE_VALUE0_REG 0x44 /*dword 0x47,0x46,0x45,0x44*/
-+/*
-+***********************************************************************************
-+** Expansion ROM Limit Register - ERLR
-+**
-+** The Expansion ROM Limit Register (ERLR) defines the block size of addresses the ATU defines
-+** as Expansion ROM address space. The block size is programmed by writing a value into the ERLR.
-+** Bits 31 to 12 within the ERLR have a direct effect on the ERBAR register, bits 31 to 12, with a one
-+** to one correspondence. A value of 0 in a bit within the ERLR makes the corresponding bit within
-+** the ERBAR a read only bit which always returns 0. A value of 1 in a bit within the ERLR makes
-+** the corresponding bit within the ERBAR read/write from PCI.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 000000H Expansion ROM Limit - Block size of memory required for the Expansion ROM translation unit. Default
-+** value is 0, which indicates no Expansion ROM address space and all bits within the ERBAR are read only with a value of 0.
-+** 11:00 000H Reserved.
-+***********************************************************************************
-+*/
-+#define ARCMSR_EXPANSION_ROM_LIMIT_REG 0x48 /*dword 0x4B,0x4A,0x49,0x48*/
-+/*
-+***********************************************************************************
-+** Expansion ROM Translate Value Register - ERTVR
-+**
-+** The Expansion ROM Translate Value Register contains the 80331 internal bus address which the
-+** ATU converts the PCI bus access. This address is driven on the internal bus as a result of the
-+** Expansion ROM address translation.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Expansion ROM Translation Value - Used to convert PCI addresses to 80331 internal bus addresses
-+** for Expansion ROM accesses. The Expansion ROM address translation value must be word aligned on the internal bus.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_EXPANSION_ROM_TRANSLATE_VALUE_REG 0x4C /*dword 0x4F,0x4E,0x4D,0x4C*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Limit Register 1 - IALR1
-+**
-+** Bits 31 to 12 within the IALR1 have a direct effect on the IABAR1 register, bits 31 to 12, with a
-+** one to one correspondence. A value of 0 in a bit within the IALR1 makes the corresponding bit
-+** within the IABAR1 a read only bit which always returns 0. A value of 1 in a bit within the IALR1
-+** makes the corresponding bit within the IABAR1 read/write from PCI. Note that a consequence of
-+** this programming scheme is that unless a valid value exists within the IALR1, all writes to the
-+** IABAR1 has no effect since a value of all zeros within the IALR1 makes the IABAR1 a read only
-+** register.
-+** The inbound memory window 1 is used merely to allocate memory on the PCI bus. The ATU does
-+** not process any PCI bus transactions to this memory range.
-+** Warning: The ATU does not claim any PCI accesses that fall within the range defined by IABAR1,
-+** IAUBAR1, and IALR1.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Inbound Translation Limit 1 - This readback value determines the memory block size required for the ATUs memory window 1.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_LIMIT1_REG 0x50 /*dword 0x53,0x52,0x51,0x50*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Limit Register 2 - IALR2
-+**
-+** Inbound address translation for memory window 2 occurs for data transfers occurring from the PCI
-+** bus (originated from the PCI bus) to the 80331 internal bus. The address translation block converts
-+** PCI addresses to internal bus addresses.
-+** The inbound translation base address for inbound window 2 is specified in Section 3.10.15. When
-+** determining block size requirements ¡X as described in Section 3.10.21 ¡X the translation limit
-+** register provides the block size requirements for the base address register. The remaining registers
-+** used for performing address translation are discussed in Section 3.2.1.1.
-+** The 80331 translate value register¡¦s programmed value must be naturally aligned with the base
-+** address register¡¦s programmed value. The limit register is used as a mask; thus, the lower address
-+** bits programmed into the 80331 translate value register are invalid. Refer to the PCI Local Bus
-+** Specification, Revision 2.3 for additional information on programming base address registers.
-+** Bits 31 to 12 within the IALR2 have a direct effect on the IABAR2 register, bits 31 to 12, with a
-+** one to one correspondence. A value of 0 in a bit within the IALR2 makes the corresponding bit
-+** within the IABAR2 a read only bit which always returns 0. A value of 1 in a bit within the IALR2
-+** makes the corresponding bit within the IABAR2 read/write from PCI. Note that a consequence of
-+** this programming scheme is that unless a valid value exists within the IALR2, all writes to the
-+** IABAR2 has no effect since a value of all zeros within the IALR2 makes the IABAR2 a read only
-+** register.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Inbound Translation Limit 2 - This readback value determines the memory block size required for the ATUs memory window 2.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_LIMIT2_REG 0x54 /*dword 0x57,0x56,0x55,0x54*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Translate Value Register 2 - IATVR2
-+**
-+** The Inbound ATU Translate Value Register 2 (IATVR2) contains the internal bus address used to
-+** convert PCI bus addresses. The converted address is driven on the internal bus as a result of the
-+** inbound ATU address translation.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Inbound ATU Translation Value 2 - This value is used to convert the PCI address to internal bus addresses.
-+** This value must be 64-bit aligned on the internal bus. The default address allows the ATU to access the internal 80331 memory-mapped registers.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_TRANSLATE_VALUE2_REG 0x58 /*dword 0x5B,0x5A,0x59,0x58*/
-+/*
-+***********************************************************************************
-+** Outbound I/O Window Translate Value Register - OIOWTVR
-+**
-+** The Outbound I/O Window Translate Value Register (OIOWTVR) contains the PCI I/O address
-+** used to convert the internal bus access to a PCI address. This address is driven on the PCI bus as a
-+** result of the outbound ATU address translation.
-+** The I/O window is from 80331 internal bus address 9000 000H to 9000 FFFFH with the fixed
-+** length of 64 Kbytes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:16 0000H Outbound I/O Window Translate Value - Used to convert internal bus addresses to PCI addresses.
-+** 15:00 0000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_IO_WINDOW_TRANSLATE_VALUE_REG 0x5C /*dword 0x5F,0x5E,0x5D,0x5C*/
-+/*
-+***********************************************************************************
-+** Outbound Memory Window Translate Value Register 0 -OMWTVR0
-+**
-+** The Outbound Memory Window Translate Value Register 0 (OMWTVR0) contains the PCI
-+** address used to convert 80331 internal bus addresses for outbound transactions. This address is
-+** driven on the PCI bus as a result of the outbound ATU address translation.
-+** The memory window is from internal bus address 8000 000H to 83FF FFFFH with the fixed length
-+** of 64 Mbytes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:26 00H Outbound MW Translate Value - Used to convert 80331 internal bus addresses to PCI addresses.
-+** 25:02 00 0000H Reserved
-+** 01:00 00 2 Burst Order - This bit field shows the address sequence during a memory burst. Only linear incrementing mode is supported.
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_MEMORY_WINDOW_TRANSLATE_VALUE0_REG 0x60 /*dword 0x63,0x62,0x61,0x60*/
-+/*
-+***********************************************************************************
-+** Outbound Upper 32-bit Memory Window Translate Value Register 0 - OUMWTVR0
-+**
-+** The Outbound Upper 32-bit Memory Window Translate Value Register 0 (OUMWTVR0) defines
-+** the upper 32-bits of address used during a dual address cycle. This enables the outbound ATU to
-+** directly address anywhere within the 64-bit host address space. When this register is all-zero, then
-+** a SAC is generated on the PCI bus.
-+** The memory window is from internal bus address 8000 000H to 83FF FFFFH with the fixed
-+** length of 64 Mbytes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H These bits define the upper 32-bits of address driven during the dual address cycle (DAC).
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_UPPER32_MEMORY_WINDOW_TRANSLATE_VALUE0_REG 0x64 /*dword 0x67,0x66,0x65,0x64*/
-+/*
-+***********************************************************************************
-+** Outbound Memory Window Translate Value Register 1 -OMWTVR1
-+**
-+** The Outbound Memory Window Translate Value Register 1 (OMWTVR1) contains the PCI
-+** address used to convert 80331 internal bus addresses for outbound transactions. This address is
-+** driven on the PCI bus as a result of the outbound ATU address translation.
-+** The memory window is from internal bus address 8400 000H to 87FF FFFFH with the fixed length
-+** of 64 Mbytes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:26 00H Outbound MW Translate Value - Used to convert 80331 internal bus addresses to PCI addresses.
-+** 25:02 00 0000H Reserved
-+** 01:00 00 2 Burst Order - This bit field shows the address sequence during a memory burst. Only linear incrementing mode is supported.
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_MEMORY_WINDOW_TRANSLATE_VALUE1_REG 0x68 /*dword 0x6B,0x6A,0x69,0x68*/
-+/*
-+***********************************************************************************
-+** Outbound Upper 32-bit Memory Window Translate Value Register 1 - OUMWTVR1
-+**
-+** The Outbound Upper 32-bit Memory Window Translate Value Register 1 (OUMWTVR1) defines
-+** the upper 32-bits of address used during a dual address cycle. This enables the outbound ATU to
-+** directly address anywhere within the 64-bit host address space. When this register is all-zero, then
-+** a SAC is generated on the PCI bus.
-+** The memory window is from internal bus address 8400 000H to 87FF FFFFH with the fixed length
-+** of 64 Mbytes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H These bits define the upper 32-bits of address driven during the dual address cycle (DAC).
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_UPPER32_MEMORY_WINDOW_TRANSLATE_VALUE1_REG 0x6C /*dword 0x6F,0x6E,0x6D,0x6C*/
-+/*
-+***********************************************************************************
-+** Outbound Upper 32-bit Direct Window Translate Value Register - OUDWTVR
-+**
-+** The Outbound Upper 32-bit Direct Window Translate Value Register (OUDWTVR) defines the
-+** upper 32-bits of address used during a dual address cycle for the transactions via Direct Addressing
-+** Window. This enables the outbound ATU to directly address anywhere within the 64-bit host
-+** address space. When this register is all-zero, then a SAC is generated on the PCI bus.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H These bits define the upper 32-bits of address driven during the dual address cycle (DAC).
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_UPPER32_DIRECT_WINDOW_TRANSLATE_VALUE_REG 0x78 /*dword 0x7B,0x7A,0x79,0x78*/
-+/*
-+***********************************************************************************
-+** ATU Configuration Register - ATUCR
-+**
-+** The ATU Configuration Register controls the outbound address translation for address translation
-+** unit. It also contains bits for Conventional PCI Delayed Read Command (DRC) aliasing, discard
-+** timer status, SERR# manual assertion, SERR# detection interrupt masking, and ATU BIST
-+** interrupt enabling.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 00H Reserved
-+** 19 0 2 ATU DRC Alias - when set, the ATU does not distinguish read commands when attempting to match a
-+** current PCI read transaction with read data enqueued within the DRC buffer. When clear, a current read
-+** transaction must have the exact same read command as the DRR for the ATU to deliver DRC data. Not
-+** applicable in the PCI-X mode.
-+** 18 0 2 Direct Addressing Upper 2Gbytes Translation Enable - When set, with Direct Addressing enabled (bit 7 of the ATUCR set), the ATU forwards internal bus cycles with an address between 0000.0040H and
-+** 7FFF.FFFFH to the PCI bus with bit 31 of the address set (8000.0000H - FFFF.FFFFH). When clear, no translation occurs.
-+** 17 0 2 Reserved
-+** 16 0 2 SERR# Manual Assertion - when set, the ATU asserts SERR# for one clock on the PCI interface. Until
-+** cleared, SERR# may not be manually asserted again. Once cleared, operation proceeds as specified.
-+** 15 0 2 ATU Discard Timer Status - when set, one of the 4 discard timers within the ATU has expired and
-+** discarded the delayed completion transaction within the queue. When clear, no timer has expired.
-+** 14:10 00000 2 Reserved
-+** 09 0 2 SERR# Detected Interrupt Enable - When set, the Intel XScale core is signalled an HPI# interrupt
-+** when the ATU detects that SERR# was asserted. When clear, the Intel XScale core is not interrupted when SERR# is detected.
-+** 08 0 2 Direct Addressing Enable - Setting this bit enables direct outbound addressing through the ATU.
-+** Internal bus cycles with an address between 0000.0040H and 7FFF.FFFFH automatically forwards to
-+** the PCI bus with or without translation of address bit 31 based on the setting of bit 18 of the ATUCR.
-+** 07:04 0000 2 Reserved
-+** 03 0 2 ATU BIST Interrupt Enable - When set, enables an interrupt to the Intel XScale core when the start
-+** BIST bit is set in the ATUBISTR register. This bit is also reflected as the BIST Capable bit 7 in the ATUBISTR register.
-+** 02 0 2 Reserved
-+** 01 0 2 Outbound ATU Enable - When set, enables the outbound address translation unit. When cleared, disables the outbound ATU.
-+** 00 0 2 Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_CONFIGURATION_REG 0x80 /*dword 0x83,0x82,0x81,0x80*/
-+/*
-+***********************************************************************************
-+** PCI Configuration and Status Register - PCSR
-+**
-+** The PCI Configuration and Status Register has additional bits for controlling and monitoring
-+** various features of the PCI bus interface.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:19 0000H Reserved
-+** 18 0 2 Detected Address or Attribute Parity Error - set when a parity error is detected during either the address
-+** or attribute phase of a transaction on the PCI bus even when the ATUCMD register Parity Error
-+** Response bit is cleared. Set under the following conditions:
-+** ¡E Any Address or Attribute (PCI-X Only) Parity Error on the Bus (including one generated by the ATU).
-+** 17:16 Varies with
-+** external state
-+** of DEVSEL#,
-+** STOP#, and
-+** TRDY#,
-+** during
-+** P_RST#
-+** PCI-X capability - These two bits define the mode of the PCI bus (conventional or PCI-X) as well as the
-+** operating frequency in the case of PCI-X mode.
-+** 00 - Conventional PCI mode
-+** 01 - PCI-X 66
-+** 10 - PCI-X 100
-+** 11 - PCI-X 133
-+** As defined by the PCI-X Addendum to the PCI Local Bus Specification, Revision 1.0a, the operating
-+** mode is determined by an initialization pattern on the PCI bus during P_RST# assertion:
-+** DEVSEL# STOP# TRDY# Mode
-+** Deasserted Deasserted Deasserted Conventional
-+** Deasserted Deasserted Asserted PCI-X 66
-+** Deasserted Asserted Deasserted PCI-X 100
-+** Deasserted Asserted Asserted PCI-X 133
-+** All other patterns are reserved.
-+** 15 0 2
-+** Outbound Transaction Queue Busy:
-+** 0=Outbound Transaction Queue Empty
-+** 1=Outbound Transaction Queue Busy
-+** 14 0 2
-+** Inbound Transaction Queue Busy:
-+** 0=Inbound Transaction Queue Empty
-+** 1=Inbound Transaction Queue Busy
-+** 13 0 2 Reserved.
-+** 12 0 2
-+** Discard Timer Value - This bit controls the time-out value for the four discard timers attached to the queues holding read data.
-+** A value of 0 indicates the time-out value is 2 15 clocks.
-+** A value of 1 indicates the time-out value is 2 10 clocks.
-+** 11 0 2 Reserved.
-+** 10 Varies with
-+** external state
-+** of M66EN
-+** during
-+** P_RST#
-+** Bus Operating at 66 MHz - When set, the interface has been initialized to function at 66 MHz in
-+** Conventional PCI mode by the assertion of M66EN during bus initialization. When clear, the interface
-+** has been initialized as a 33 MHz bus.
-+** NOTE: When PCSR bits 17:16 are not equal to zero, then this bit is meaningless since the 80331 is
-+** operating in PCI-X mode.
-+** 09 0 2 Reserved
-+** 08 Varies with
-+** external state
-+** of REQ64#
-+** during
-+** P_RST#
-+** PCI Bus 64-Bit Capable - When clear, the PCI bus interface has been configured as 64-bit capable by
-+** the assertion of REQ64# on the rising edge of P_RST#. When set, the PCI interface is configured as
-+** 32-bit only.
-+** 07:06 00 2 Reserved.
-+** 05 0 2 Reset Internal Bus - This bit controls the reset of the Intel XScale core and all units on the internal
-+** bus. In addition to the internal bus initialization, this bit triggers the assertion of the M_RST# pin for
-+** initialization of registered DIMMs. When set:
-+** When operating in the conventional PCI mode:
-+** ¡E All current PCI transactions being mastered by the ATU completes, and the ATU master interfaces
-+** proceeds to an idle state. No additional transactions is mastered by these units until the internal bus
-+** reset is complete.
-+** ¡E All current transactions being slaved by the ATU on either the PCI bus or the internal bus
-+** completes, and the ATU target interfaces proceeds to an idle state. All future slave transactions
-+** master aborts, with the exception of the completion cycle for the transaction that set the Reset
-+** Internal Bus bit in the PCSR.
-+** ¡E When the value of the Core Processor Reset bit in the PCSR (upon P_RST# assertion) is set, the
-+** Intel XScale core is held in reset when the internal bus reset is complete.
-+** ¡E The ATU ignores configuration cycles, and they appears as master aborts for: 32 Internal Bus clocks.
-+** ¡E The 80331 hardware clears this bit after the reset operation completes.
-+** When operating in the PCI-X mode:
-+** The ATU hardware responds the same as in Conventional PCI-X mode. However, this may create a
-+** problem in PCI-X mode for split requests in that there may still be an outstanding split completion that the
-+** ATU is either waiting to receive (Outbound Request) or initiate (Inbound Read Request). For a cleaner
-+** internal bus reset, host software can take the following steps prior to asserting Reset Internal bus:
-+** 1. Clear the Bus Master (bit 2 of the ATUCMD) and the Memory Enable (bit 1 of the ATUCMD) bits in
-+** the ATUCMD. This ensures that no new transactions, either outbound or inbound are enqueued.
-+** 2. Wait for both the Outbound (bit 15 of the PCSR) and Inbound Read (bit 14 of the PCSR) Transaction
-+** queue busy bits to be clear.
-+** 3. Set the Reset Internal Bus bit
-+** As a result, the ATU hardware resets the internal bus using the same logic as in conventional mode,
-+** however the user is now assured that the ATU no longer has any pending inbound or outbound split
-+** completion transactions.
-+** NOTE: Since the Reset Internal Bus bit is set using an inbound configuration cycle, the user is
-+** guaranteed that any prior configuration cycles have properly completed since there is only a one
-+** deep transaction queue for configuration transaction requests. The ATU sends the appropriate
-+** Split Write Completion Message to the Requester prior to the onset of Internal Bus Reset.
-+** 04 0 2 Bus Master Indicator Enable: Provides software control for the Bus Master Indicator signal P_BMI used
-+** for external RAIDIOS logic control of private devices. Only valid when operating with the bridge and
-+** central resource/arbiter disabled (BRG_EN =low, ARB_EN=low).
-+** 03 Varies with
-+** external state
-+** of PRIVDEV
-+** during
-+** P_RST#
-+** Private Device Enable - This bit indicates the state of the reset strap which enables the private device
-+** control mechanism within the PCI-to-PCI Bridge SISR configuration register.
-+** 0=Private Device control Disabled - SISR register bits default to zero
-+** 1=Private Device control Enabled - SISR register bits default to one
-+** 02 Varies with
-+** external state
-+** of RETRY
-+** during
-+** P_RST#
-+** Configuration Cycle Retry - When this bit is set, the PCI interface of the 80331 responds to all
-+** configuration cycles with a Retry condition. When clear, the 80331 responds to the appropriate
-+** configuration cycles.
-+** The default condition for this bit is based on the external state of the RETRY pin at the rising edge of
-+** P_RST#. When the external state of the pin is high, the bit is set. When the external state of the pin is
-+** low, the bit is cleared.
-+** 01 Varies with
-+** external state
-+** of
-+** CORE_RST#
-+** during
-+** P_RST#
-+** Core Processor Reset - This bit is set to its default value by the hardware when either P_RST# is
-+** asserted or the Reset Internal Bus bit in PCSR is set. When this bit is set, the Intel XScale core is
-+** being held in reset. Software cannot set this bit. Software is required to clear this bit to deassert Intel
-+** XScale core reset.
-+** The default condition for this bit is based on the external state of the CORE_RST# pin at the rising edge
-+** of P_RST#. When the external state of the pin is low, the bit is set. When the external state of the pin is
-+** high, the bit is clear.
-+** 00 Varies with
-+** external state
-+** of PRIVMEM
-+** during
-+** P_RST#
-+** Private Memory Enable - This bit indicates the state of the reset strap which enables the private device
-+** control mechanism within the PCI-to-PCI Bridge SDER configuration register.
-+** 0=Private Memory control Disabled - SDER register bit 2 default to zero
-+** 1=Private Memory control Enabled - SDER register bits 2 default to one
-+***********************************************************************************
-+*/
-+#define ARCMSR_PCI_CONFIGURATION_STATUS_REG 0x84 /*dword 0x87,0x86,0x85,0x84*/
-+/*
-+***********************************************************************************
-+** ATU Interrupt Status Register - ATUISR
-+**
-+** The ATU Interrupt Status Register is used to notify the core processor of the source of an ATU
-+** interrupt. In addition, this register is written to clear the source of the interrupt to the interrupt unit
-+** of the 80331. All bits in this register are Read/Clear.
-+** Bits 4:0 are a direct reflection of bits 14:11 and bit 8 (respectively) of the ATU Status Register
-+** (these bits are set at the same time by hardware but need to be cleared independently). Bit 7 is set
-+** by an error associated with the internal bus of the 80331. Bit 8 is for software BIST. The
-+** conditions that result in an ATU interrupt are cleared by writing a 1 to the appropriate bits in this
-+** register.
-+** Note: Bits 4:0, and bits 15 and 13:7 can result in an interrupt being driven to the Intel XScale core.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:18 0000H Reserved
-+** 17 0 2 VPD Address Register Updated - This bit is set when a PCI bus configuration write occurs to the VPDAR
-+** register. Configuration register writes to the VPDAR does NOT result in bit 15 also being set. When set,
-+** this bit results in the assertion of the ATU Configure Register Write Interrupt.
-+** 16 0 2 Reserved
-+** 15 0 2 ATU Configuration Write - This bit is set when a PCI bus configuration write occurs to any ATU register.
-+** When set, this bit results in the assertion of the ATU Configure Register Write Interrupt.
-+** 14 0 2 ATU Inbound Memory Window 1 Base Updated - This bit is set when a PCI bus configuration write
-+** occurs to either the IABAR1 register or the IAUBAR1 register. Configuration register writes to these
-+** registers deos NOT result in bit 15 also being set. When set, this bit results in the assertion of the ATU
-+** Configure Register Write Interrupt.
-+** 13 0 2 Initiated Split Completion Error Message - This bit is set when the device initiates a Split Completion
-+** Message on the PCI Bus with the Split Completion Error attribute bit set.
-+** 12 0 2 Received Split Completion Error Message - This bit is set when the device receives a Split Completion
-+** Message from the PCI Bus with the Split Completion Error attribute bit set.
-+** 11 0 2 Power State Transition - When the Power State Field of the ATU Power Management Control/Status
-+** Register is written to transition the ATU function Power State from D0 to D3, D0 to D1, or D3 to D0 and
-+** the ATU Power State Transition Interrupt mask bit is cleared, this bit is set.
-+** 10 0 2 P_SERR# Asserted - set when P_SERR# is asserted on the PCI bus by the ATU.
-+** 09 0 2 Detected Parity Error - set when a parity error is detected on the PCI bus even when the ATUCMD
-+** register¡¦s Parity Error Response bit is cleared. Set under the following conditions:
-+** ¡E Write Data Parity Error when the ATU is a target (inbound write).
-+** ¡E Read Data Parity Error when the ATU is an initiator (outbound read).
-+** ¡E Any Address or Attribute (PCI-X Only) Parity Error on the Bus.
-+** 08 0 2 ATU BIST Interrupt - When set, generates the ATU BIST Start Interrupt and indicates the host processor
-+** has set the Start BIST bit (ATUBISTR register bit 6), when the ATU BIST interrupt is enabled (ATUCR
-+** register bit 3). The Intel XScale core can initiate the software BIST and store the result in ATUBISTR
-+** register bits 3:0.
-+** Configuration register writes to the ATUBISTR does NOT result in bit 15 also being set or the assertion
-+** of the ATU Configure Register Write Interrupt.
-+** 07 0 2 Internal Bus Master Abort - set when a transaction initiated by the ATU internal bus initiator interface ends in a Master-abort.
-+** 06:05 00 2 Reserved.
-+** 04 0 2 P_SERR# Detected - set when P_SERR# is detected on the PCI bus by the ATU.
-+** 03 0 2 PCI Master Abort - set when a transaction initiated by the ATU PCI initiator interface ends in a Master-abort.
-+** 02 0 2 PCI Target Abort (master) - set when a transaction initiated by the ATU PCI master interface ends in a Target-abort.
-+** 01 0 2 PCI Target Abort (target) - set when the ATU interface, acting as a target, terminates the transaction on the PCI bus with a target abort.
-+** 00 0 2 PCI Master Parity Error - Master Parity Error - The ATU interface sets this bit under the following
-+** conditions:
-+** ¡E The ATU asserted PERR# itself or the ATU observed PERR# asserted.
-+** ¡E And the ATU acted as the requester for the operation in which the error occurred.
-+** ¡E And the ATUCMD register¡¦s Parity Error Response bit is set
-+** ¡E Or (PCI-X Mode Only) the ATU received a Write Data Parity Error Message
-+** ¡E And the ATUCMD register¡¦s Parity Error Response bit is set
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_INTERRUPT_STATUS_REG 0x88 /*dword 0x8B,0x8A,0x89,0x88*/
-+/*
-+***********************************************************************************
-+** ATU Interrupt Mask Register - ATUIMR
-+**
-+** The ATU Interrupt Mask Register contains the control bit to enable and disable interrupts
-+** generated by the ATU.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:15 0 0000H Reserved
-+** 14 0 2 VPD Address Register Updated Mask - Controls the setting of bit 17 of the ATUISR and generation of the
-+** ATU Configuration Register Write interrupt when a PCI bus write occurs to the VPDAR register.
-+** 0=Not Masked
-+** 1=Masked
-+** 13 0 2 Reserved
-+** 12 0 2 Configuration Register Write Mask - Controls the setting of bit 15 of the ATUISR and generation of the
-+** ATU Configuration Register Write interrupt when a PCI bus write occurs to any ATU configuration register
-+** except those covered by mask bit 11 and bit 14 of this register, and ATU BIST enable bit 3 of the ATUCR.
-+** 0=Not Masked
-+** 1=Masked
-+** 11 1 2 ATU Inbound Memory Window 1 Base Updated Mask - Controls the setting of bit 14 of the ATUISR and
-+** generation of the ATU Configuration Register Write interrupt when a PCI bus write occurs to either the
-+** IABAR1 register or the IAUBAR1 register.
-+** 0=Not Masked
-+** 1=Masked
-+** 10 0 2 Initiated Split Completion Error Message Interrupt Mask - Controls the setting of bit 13 of the ATUISR and
-+** generation of the ATU Error interrupt when the ATU initiates a Split Completion Error Message.
-+** 0=Not Masked
-+** 1=Masked
-+** 09 0 2 Received Split Completion Error Message Interrupt Mask- Controls the setting of bit 12 of the ATUISR
-+** and generation of the ATU Error interrupt when a Split Completion Error Message results in bit 29 of the
-+** PCIXSR being set.
-+** 0=Not Masked
-+** 1=Masked
-+** 08 1 2 Power State Transition Interrupt Mask - Controls the setting of bit 12 of the ATUISR and generation of the
-+** ATU Error interrupt when ATU Power Management Control/Status Register is written to transition the
-+** ATU Function Power State from D0 to D3, D0 to D1, D1 to D3 or D3 to D0.
-+** 0=Not Masked
-+** 1=Masked
-+** 07 0 2 ATU Detected Parity Error Interrupt Mask - Controls the setting of bit 9 of the ATUISR and generation of
-+** the ATU Error interrupt when a parity error detected on the PCI bus that sets bit 15 of the ATUSR.
-+** 0=Not Masked
-+** 1=Masked
-+** 06 0 2 ATU SERR# Asserted Interrupt Mask - Controls the setting of bit 10 of the ATUISR and generation of the
-+** ATU Error interrupt when SERR# is asserted on the PCI interface resulting in bit 14 of the ATUSR being set.
-+** 0=Not Masked
-+** 1=Masked
-+** NOTE: This bit is specific to the ATU asserting SERR# and not detecting SERR# from another master.
-+** 05 0 2 ATU PCI Master Abort Interrupt Mask - Controls the setting of bit 3 of the ATUISR and generation of the
-+** ATU Error interrupt when a master abort error resulting in bit 13 of the ATUSR being set.
-+** 0=Not Masked
-+** 1=Masked
-+** 04 0 2 ATU PCI Target Abort (Master) Interrupt Mask- Controls the setting of bit 12 of the ATUISR and ATU Error
-+** generation of the interrupt when a target abort error resulting in bit 12 of the ATUSR being set
-+** 0=Not Masked
-+** 1=Masked
-+** 03 0 2 ATU PCI Target Abort (Target) Interrupt Mask- Controls the setting of bit 1 of the ATUISR and generation
-+** of the ATU Error interrupt when a target abort error resulting in bit 11 of the ATUSR being set.
-+** 0=Not Masked
-+** 1=Masked
-+** 02 0 2 ATU PCI Master Parity Error Interrupt Mask - Controls the setting of bit 0 of the ATUISR and generation
-+** of the ATU Error interrupt when a parity error resulting in bit 8 of the ATUSR being set.
-+** 0=Not Masked
-+** 1=Masked
-+** 01 0 2 ATU Inbound Error SERR# Enable - Controls when the ATU asserts (when enabled through the
-+** ATUCMD) SERR# on the PCI interface in response to a master abort on the internal bus during an
-+** inbound write transaction.
-+** 0=SERR# Not Asserted due to error
-+** 1=SERR# Asserted due to error
-+** 00 0 2 ATU ECC Target Abort Enable - Controls the ATU response on the PCI interface to a target abort (ECC
-+** error) from the memory controller on the internal bus. In conventional mode, this action only occurs
-+** during an inbound read transaction where the data phase that was target aborted on the internal bus is
-+** actually requested from the inbound read queue.
-+** 0=Disconnect with data (the data being up to 64 bits of 1¡¦s)
-+** 1=Target Abort
-+** NOTE: In PCI-X Mode, The ATU initiates a Split Completion Error Message (with message class=2h -
-+** completer error and message index=81h - 80331 internal bus target abort) on the PCI bus,
-+** independent of the setting of this bit.
-+***********************************************************************************
-+*/
-+#define ARCMSR_ATU_INTERRUPT_MASK_REG 0x8C /*dword 0x8F,0x8E,0x8D,0x8C*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Base Address Register 3 - IABAR3
-+**
-+** . The Inbound ATU Base Address Register 3 (IABAR3) together with the Inbound ATU Upper Base Address Register 3 (IAUBAR3) defines the block of memory addresses where the inbound translation window 3 begins.
-+** . The inbound ATU decodes and forwards the bus request to the 80331 internal bus with a translated address to map into 80331 local memory.
-+** . The IABAR3 and IAUBAR3 define the base address and describes the required memory block size.
-+** . Bits 31 through 12 of the IABAR3 is either read/write bits or read only with a value of 0 depending on the value located within the IALR3.
-+** The programmed value within the base address register must comply with the PCI programming requirements for address alignment.
-+** Note:
-+** Since IABAR3 does not appear in the standard PCI configuration header space (offsets 00H - 3CH),
-+** IABAR3 is not configured by the host during normal system initialization.
-+** Warning:
-+** When a non-zero value is not written to IALR3,
-+** the user should not set either the Prefetchable Indicator
-+** or the Type Indicator for 64 bit addressability.
-+** This is the default for IABAR3.
-+** Assuming a non-zero value is written to IALR3,
-+** the user may set the Prefetchable Indicator
-+** or the Type Indicator:
-+** a. Since non prefetchable memory windows can never be placed above the 4 Gbyte address boundary,
-+** when the Prefetchable Indicator is not set,
-+** the user should also leave the Type Indicator set for 32 bit addressability.
-+** This is the default for IABAR3.
-+** b. when the Prefetchable Indicator is set,
-+** the user should also set the Type Indicator for 64 bit addressability.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Translation Base Address 3 - These bits define the actual location the translation function is to respond to when addressed from the PCI bus.
-+** 11:04 00H Reserved.
-+** 03 0 2 Prefetchable Indicator - When set, defines the memory space as prefetchable.
-+** 02:01 00 2 Type Indicator - Defines the width of the addressability for this memory window:
-+** 00 - Memory Window is locatable anywhere in 32 bit address space
-+** 10 - Memory Window is locatable anywhere in 64 bit address space
-+** 00 0 2 Memory Space Indicator - This bit field describes memory or I/O space base address.
-+** The ATU does not occupy I/O space,
-+** thus this bit must be zero.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_BASE_ADDRESS3_REG 0x90 /*dword 0x93,0x92,0x91,0x90*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Upper Base Address Register 3 - IAUBAR3
-+**
-+** This register contains the upper base address when decoding PCI addresses beyond 4 GBytes.
-+** Together with the Translation Base Address this register defines the actual location the translation function is to respond to when addressed from the PCI bus for addresses > 4GBytes (for DACs).
-+** The programmed value within the base address register must comply with the PCI programming
-+** requirements for address alignment.
-+** Note:
-+** When the Type indicator of IABAR3 is set to indicate 32 bit addressability,
-+** the IAUBAR3 register attributes are read-only.
-+** This is the default for IABAR3.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:0 00000H Translation Upper Base Address 3 - Together with the Translation Base Address 3 these bits define the actual location the translation function is to respond to when addressed from the PCI bus for addresses > 4GBytes.
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_UPPER_BASE_ADDRESS3_REG 0x94 /*dword 0x97,0x96,0x95,0x94*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Limit Register 3 - IALR3
-+**
-+** Inbound address translation for memory window 3 occurs for data transfers occurring from the PCI
-+** bus (originated from the PCI bus) to the 80331 internal bus. The address translation block converts
-+** PCI addresses to internal bus addresses.
-+** The inbound translation base address for inbound window 3 is specified in Section 3.10.15. When
-+** determining block size requirements ¡X as described in Section 3.10.21 ¡X the translation limit
-+** register provides the block size requirements for the base address register. The remaining registers
-+** used for performing address translation are discussed in Section 3.2.1.1.
-+** The 80331 translate value register¡¦s programmed value must be naturally aligned with the base
-+** address register¡¦s programmed value. The limit register is used as a mask; thus, the lower address
-+** bits programmed into the 80331 translate value register are invalid. Refer to the PCI Local Bus
-+** Specification, Revision 2.3 for additional information on programming base address registers.
-+** Bits 31 to 12 within the IALR3 have a direct effect on the IABAR3 register, bits 31 to 12, with a
-+** one to one correspondence. A value of 0 in a bit within the IALR3 makes the corresponding bit
-+** within the IABAR3 a read only bit which always returns 0. A value of 1 in a bit within the IALR3
-+** makes the corresponding bit within the IABAR3 read/write from PCI. Note that a consequence of
-+** this programming scheme is that unless a valid value exists within the IALR3, all writes to the
-+** IABAR3 has no effect since a value of all zeros within the IALR3 makes the IABAR3 a read only
-+** register.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Inbound Translation Limit 3 - This readback value determines the memory block size required for the ATUs memory window 3.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_LIMIT3_REG 0x98 /*dword 0x9B,0x9A,0x99,0x98*/
-+/*
-+***********************************************************************************
-+** Inbound ATU Translate Value Register 3 - IATVR3
-+**
-+** The Inbound ATU Translate Value Register 3 (IATVR3) contains the internal bus address used to
-+** convert PCI bus addresses. The converted address is driven on the internal bus as a result of the
-+** inbound ATU address translation.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 00000H Inbound ATU Translation Value 3 - This value is used to convert the PCI address to internal bus addresses.
-+** This value must be 64-bit aligned on the internal bus. The default address allows the ATU to
-+** access the internal 80331 memory-mapped registers.
-+** 11:00 000H Reserved
-+***********************************************************************************
-+*/
-+#define ARCMSR_INBOUND_ATU_TRANSLATE_VALUE3_REG 0x9C /*dword 0x9F,0x9E,0x9D,0x9C*/
-+/*
-+***********************************************************************************
-+** Outbound Configuration Cycle Address Register - OCCAR
-+**
-+** The Outbound Configuration Cycle Address Register is used to hold the 32-bit PCI configuration
-+** cycle address. The Intel XScale core writes the PCI configuration cycles address which then
-+** enables the outbound configuration read or write. The Intel XScale core then performs a read or
-+** write to the Outbound Configuration Cycle Data Register to initiate the configuration cycle on the
-+** PCI bus.
-+** Note: Bits 15:11 of the configuration cycle address for Type 0 configuration cycles are defined differently
-+** for Conventional versus PCI-X modes. When 80331 software programs the OCCAR to initiate a
-+** Type 0 configuration cycle, the OCCAR should always be loaded based on the PCI-X definition for
-+** the Type 0 configuration cycle address. When operating in Conventional mode, the 80331 clears
-+** bits 15:11 of the OCCAR prior to initiating an outbound Type 0 configuration cycle. See the PCI-X
-+** Addendum to the PCI Local Bus Specification, Revision 1.0a for details on the two formats.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H Configuration Cycle Address - These bits define the 32-bit PCI address used during an outbound configuration read or write cycle.
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_CONFIGURATION_CYCLE_ADDRESS_REG 0xA4 /*dword 0xA7,0xA6,0xA5,0xA4*/
-+/*
-+***********************************************************************************
-+** Outbound Configuration Cycle Data Register - OCCDR
-+**
-+** The Outbound Configuration Cycle Data Register is used to initiate a configuration read or write
-+** on the PCI bus. The register is logical rather than physical meaning that it is an address not a
-+** register. The Intel XScale core reads or writes the data registers memory-mapped address to
-+** initiate the configuration cycle on the PCI bus with the address found in the OCCAR. For a
-+** configuration write, the data is latched from the internal bus and forwarded directly to the OWQ.
-+** For a read, the data is returned directly from the ORQ to the Intel XScale core and is never
-+** actually entered into the data register (which does not physically exist).
-+** The OCCDR is only visible from 80331 internal bus address space and appears as a reserved value
-+** within the ATU configuration space.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H Configuration Cycle Data - These bits define the data used during an outbound configuration read or write cycle.
-+***********************************************************************************
-+*/
-+#define ARCMSR_OUTBOUND_CONFIGURATION_CYCLE_DATA_REG 0xAC /*dword 0xAF,0xAE,0xAD,0xAC*/
-+/*
-+***********************************************************************************
-+** VPD Capability Identifier Register - VPD_CAPID
-+**
-+** The Capability Identifier Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register in the PCI Extended Capability header identifies the type of Extended
-+** Capability contained in that header. In the case of the 80331, this is the VPD extended capability
-+** with an ID of 03H as defined by the PCI Local Bus Specification, Revision 2.3.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 03H Cap_Id - This field with its¡¦ 03H value identifies this item in the linked list of Extended Capability Headers as being the VPD capability registers.
-+***********************************************************************************
-+*/
-+#define ARCMSR_VPD_CAPABILITY_IDENTIFIER_REG 0xB8 /*byte*/
-+/*
-+***********************************************************************************
-+** VPD Next Item Pointer Register - VPD_NXTP
-+**
-+** The Next Item Pointer Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register describes the location of the next item in the function¡¦s capability list.
-+** For the 80331, this the final capability list, and hence, this register is set to 00H.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 00H Next_ Item_ Pointer - This field provides an offset into the function¡¦s configuration space pointing to the
-+** next item in the function¡¦s capability list. Since the VPD capabilities are the last in the linked list of
-+** extended capabilities in the 80331, the register is set to 00H.
-+***********************************************************************************
-+*/
-+#define ARCMSR_VPD_NEXT_ITEM_PTR_REG 0xB9 /*byte*/
-+/*
-+***********************************************************************************
-+** VPD Address Register - VPD_AR
-+**
-+** The VPD Address register (VPDAR) contains the DWORD-aligned byte address of the VPD to be
-+** accessed. The register is read/write and the initial value at power-up is indeterminate.
-+** A PCI Configuration Write to the VPDAR interrupts the Intel XScale core. Software can use
-+** the Flag setting to determine whether the configuration write was intended to initiate a read or
-+** write of the VPD through the VPD Data Register.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15 0 2 Flag - A flag is used to indicate when a transfer of data between the VPD Data Register and the storage
-+** component has completed. Please see Section 3.9, ¡§Vital Product Data¡¨ on page 201 for more details on
-+** how the 80331 handles the data transfer.
-+** 14:0 0000H VPD Address - This register is written to set the DWORD-aligned byte address used to read or write
-+** Vital Product Data from the VPD storage component.
-+***********************************************************************************
-+*/
-+#define ARCMSR_VPD_ADDRESS_REG 0xBA /*word 0xBB,0xBA*/
-+/*
-+***********************************************************************************
-+** VPD Data Register - VPD_DR
-+**
-+** This register is used to transfer data between the 80331 and the VPD storage component.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000H VPD Data - Four bytes are always read or written through this register to/from the VPD storage component.
-+***********************************************************************************
-+*/
-+#define ARCMSR_VPD_DATA_REG 0xBC /*dword 0xBF,0xBE,0xBD,0xBC*/
-+/*
-+***********************************************************************************
-+** Power Management Capability Identifier Register -PM_CAPID
-+**
-+** The Capability Identifier Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register in the PCI Extended Capability header identifies the type of Extended
-+** Capability contained in that header. In the case of the 80331, this is the PCI Bus Power
-+** Management extended capability with an ID of 01H as defined by the PCI Bus Power Management
-+** Interface Specification, Revision 1.1.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 01H Cap_Id - This field with its¡¦ 01H value identifies this item in the linked list of Extended Capability Headers as being the PCI Power Management Registers.
-+***********************************************************************************
-+*/
-+#define ARCMSR_POWER_MANAGEMENT_CAPABILITY_IDENTIFIER_REG 0xC0 /*byte*/
-+/*
-+***********************************************************************************
-+** Power Management Next Item Pointer Register - PM_NXTP
-+**
-+** The Next Item Pointer Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register describes the location of the next item in the function¡¦s capability list.
-+** For the 80331, the next capability (MSI capability list) is located at off-set D0H.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 D0H Next_ Item_ Pointer - This field provides an offset into the function¡¦s configuration space pointing to the
-+** next item in the function¡¦s capability list which in the 80331 is the MSI extended capabilities header.
-+***********************************************************************************
-+*/
-+#define ARCMSR_POWER_NEXT_ITEM_PTR_REG 0xC1 /*byte*/
-+/*
-+***********************************************************************************
-+** Power Management Capabilities Register - PM_CAP
-+**
-+** Power Management Capabilities bits adhere to the definitions in the PCI Bus Power Management
-+** Interface Specification, Revision 1.1. This register is a 16-bit read-only register which provides
-+** information on the capabilities of the ATU function related to power management.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:11 00000 2 PME_Support - This function is not capable of asserting the PME# signal in any state, since PME# is not supported by the 80331.
-+** 10 0 2 D2_Support - This bit is set to 0 2 indicating that the 80331 does not support the D2 Power Management State
-+** 9 1 2 D1_Support - This bit is set to 1 2 indicating that the 80331 supports the D1 Power Management State
-+** 8:6 000 2 Aux_Current - This field is set to 000 2 indicating that the 80331 has no current requirements for the
-+** 3.3Vaux signal as defined in the PCI Bus Power Management Interface Specification, Revision 1.1
-+** 5 0 2 DSI - This field is set to 0 2 meaning that this function requires a device specific initialization sequence
-+** following the transition to the D0 uninitialized state.
-+** 4 0 2 Reserved.
-+** 3 0 2 PME Clock - Since the 80331 does not support PME# signal generation this bit is cleared to 0 2 .
-+** 2:0 010 2 Version - Setting these bits to 010 2 means that this function complies with PCI Bus Power Management Interface Specification, Revision 1.1
-+***********************************************************************************
-+*/
-+#define ARCMSR_POWER_MANAGEMENT_CAPABILITY_REG 0xC2 /*word 0xC3,0xC2*/
-+/*
-+***********************************************************************************
-+** Power Management Control/Status Register - PM_CSR
-+**
-+** Power Management Control/Status bits adhere to the definitions in the PCI Bus Power
-+** Management Interface Specification, Revision 1.1. This 16-bit register is the control and status
-+** interface for the power management extended capability.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15 0 2 PME_Status - This function is not capable of asserting the PME# signal in any state, since PME## is not supported by the 80331.
-+** 14:9 00H Reserved
-+** 8 0 2 PME_En - This bit is hardwired to read-only 0 2 since this function does not support PME# generation from any power state.
-+** 7:2 000000 2 Reserved
-+** 1:0 00 2 Power State - This 2-bit field is used both to determine the current power state of a function and to set the function into a new power state. The definition of the values is:
-+** 00 2 - D0
-+** 01 2 - D1
-+** 10 2 - D2 (Unsupported)
-+** 11 2 - D3 hot
-+** The 80331 supports only the D0 and D3 hot states.
-+**
-+***********************************************************************************
-+*/
-+#define ARCMSR_POWER_MANAGEMENT_CONTROL_STATUS_REG 0xC4 /*word 0xC5,0xC4*/
-+/*
-+***********************************************************************************
-+** PCI-X Capability Identifier Register - PX_CAPID
-+**
-+** The Capability Identifier Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register in the PCI Extended Capability header identifies the type of Extended
-+** Capability contained in that header. In the case of the 80331, this is the PCI-X extended capability with
-+** an ID of 07H as defined by the PCI-X Addendum to the PCI Local Bus Specification, Revision 1.0a.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 07H Cap_Id - This field with its¡¦ 07H value identifies this item in the linked list of Extended Capability Headers as being the PCI-X capability registers.
-+***********************************************************************************
-+*/
-+#define ARCMSR_PCIX_CAPABILITY_IDENTIFIER_REG 0xE0 /*byte*/
-+/*
-+***********************************************************************************
-+** PCI-X Next Item Pointer Register - PX_NXTP
-+**
-+** The Next Item Pointer Register bits adhere to the definitions in the PCI Local Bus Specification,
-+** Revision 2.3. This register describes the location of the next item in the function¡¦s capability list.
-+** By default, the PCI-X capability is the last capabilities list for the 80331, thus this register defaults
-+** to 00H.
-+** However, this register may be written to B8H prior to host configuration to include the VPD
-+** capability located at off-set B8H.
-+** Warning: Writing this register to any value other than 00H (default) or B8H is not supported and may
-+** produce unpredictable system behavior.
-+** In order to guarantee that this register is written prior to host configuration, the 80331 must be
-+** initialized at P_RST# assertion to Retry Type 0 configuration cycles (bit 2 of PCSR). Typically,
-+** the Intel XScale core would be enabled to boot immediately following P_RST# assertion in
-+** this case (bit 1 of PCSR), as well. Please see Table 125, ¡§PCI Configuration and Status Register -
-+** PCSR¡¨ on page 253 for more details on the 80331 initialization modes.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 07:00 00H Next_ Item_ Pointer - This field provides an offset into the function¡¦s configuration space pointing to the
-+** next item in the function¡¦s capability list. Since the PCI-X capabilities are the last in the linked list of
-+** extended capabilities in the 80331, the register is set to 00H.
-+** However, this field may be written prior to host configuration with B8H to extend the list to include the
-+** VPD extended capabilities header.
-+***********************************************************************************
-+*/
-+#define ARCMSR_PCIX_NEXT_ITEM_PTR_REG 0xE1 /*byte*/
-+/*
-+***********************************************************************************
-+** PCI-X Command Register - PX_CMD
-+**
-+** This register controls various modes and features of ATU and Message Unit when operating in the
-+** PCI-X mode.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 15:7 000000000 2 Reserved.
-+** 6:4 011 2 Maximum Outstanding Split Transactions - This register sets the maximum number of Split Transactions
-+** the device is permitted to have outstanding at one time.
-+** Register Maximum Outstanding
-+** 0 1
-+** 1 2
-+** 2 3
-+** 3 4
-+** 4 8
-+** 5 12
-+** 6 16
-+** 7 32
-+** 3:2 00 2 Maximum Memory Read Byte Count - This register sets the maximum byte count the device uses when
-+** initiating a Sequence with one of the burst memory read commands.
-+** Register Maximum Byte Count
-+** 0 512
-+** 1 1024
-+** 2 2048
-+** 3 4096
-+** 1 0 2
-+** Enable Relaxed Ordering - The 80331 does not set the relaxed ordering bit in the Requester Attributes
-+** of Transactions.
-+** 0 0 2 Data Parity Error Recovery Enable - The device driver sets this bit to enable the device to attempt to
-+** recover from data parity errors. When this bit is 0 and the device is in PCI-X mode, the device asserts
-+** SERR# (when enabled) whenever the Master Data Parity Error bit (Status register, bit 8) is set.
-+***********************************************************************************
-+*/
-+#define ARCMSR_PCIX_COMMAND_REG 0xE2 /*word 0xE3,0xE2*/
-+/*
-+***********************************************************************************
-+** PCI-X Status Register - PX_SR
-+**
-+** This register identifies the capabilities and current operating mode of ATU, DMAs and Message
-+** Unit when operating in the PCI-X mode.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:30 00 2 Reserved
-+** 29 0 2 Received Split Completion Error Message - This bit is set when the device receives a Split Completion
-+** Message with the Split Completion Error attribute bit set. Once set, this bit remains set until software
-+** writes a 1 to this location.
-+** 0=no Split Completion error message received.
-+** 1=a Split Completion error message has been received.
-+** 28:26 001 2 Designed Maximum Cumulative Read Size (DMCRS) - The value of this register depends on the setting
-+** of the Maximum Memory Read Byte Count field of the PCIXCMD register:
-+** DMCRS Max ADQs Maximum Memory Read Byte Count Register Setting
-+** 1 16 512 (Default)
-+** 2 32 1024
-+** 2 32 2048
-+** 2 32 4096
-+** 25:23 011 2 Designed Maximum Outstanding Split Transactions - The 80331 can have up to four outstanding split transactions.
-+** 22:21 01 2 Designed Maximum Memory Read Byte Count - The 80331 can generate memory reads with byte counts up to 1024 bytes.
-+** 20 1 2 80331 is a complex device.
-+** 19 0 2 Unexpected Split Completion - This bit is set when an unexpected Split Completion with this device¡¦s
-+** Requester ID is received. Once set, this bit remains set until software writes a 1 to this location.
-+** 0=no unexpected Split Completion has been received.
-+** 1=an unexpected Split Completion has been received.
-+** 18 0 2 Split Completion Discarded - This bit is set when the device discards a Split Completion because the
-+** requester would not accept it. See Section 5.4.4 of the PCI-X Addendum to the PCI Local Bus
-+** Specification, Revision 1.0a for details. Once set, this bit remains set until software writes a 1 to this
-+** location.
-+** 0=no Split Completion has been discarded.
-+** 1=a Split Completion has been discarded.
-+** NOTE: The 80331 does not set this bit since there is no Inbound address responding to Inbound Read
-+** Requests with Split Responses (Memory or Register) that has ¡§read side effects.¡¨
-+** 17 1 2 80331 is a 133 MHz capable device.
-+** 16 1 2 or P_32BITPCI# 80331 with bridge enabled (BRG_EN=1) implements the ATU with a 64-bit interface on the secondary PCI bus, therefore this bit is always set.
-+** 80331 with no bridge and central resource disabled (BRG_EN=0, ARB_EN=0), use this bit to identify the add-in card to the system as 64-bit or 32-bit wide via a user-configurable strap (P_32BITPCI#).
-+** This strap, by default, identifies the add in card based on 80331 with bridge disabled as 64-bit unless the user attaches the appropriate pull-down resistor to the strap.
-+** 0=The bus is 32 bits wide.
-+** 1=The bus is 64 bits wide.
-+** 15:8 FFH Bus Number - This register is read for diagnostic purposes only. It indicates the number of the bus
-+** segment for the device containing this function. The function uses this number as part of its Requester
-+** ID and Completer ID. For all devices other than the source bridge, each time the function is addressed
-+** by a Configuration Write transaction, the function must update this register with the contents of AD[7::0]
-+** of the attribute phase of the Configuration Write, regardless of which register in the function is
-+** addressed by the transaction. The function is addressed by a Configuration Write transaction when all of
-+** the following are true:
-+** 1. The transaction uses a Configuration Write command.
-+** 2. IDSEL is asserted during the address phase.
-+** 3. AD[1::0] are 00b (Type 0 configuration transaction).
-+** 4. AD[10::08] of the configuration address contain the appropriate function number.
-+** 7:3 1FH Device Number - This register is read for diagnostic purposes only. It indicates the number of the device
-+** containing this function, i.e., the number in the Device Number field (AD[15::11]) of the address of a
-+** Type 0 configuration transaction that is assigned to the device containing this function by the connection
-+** of the system hardware. The system must assign a device number other than 00h (00h is reserved for
-+** the source bridge). The function uses this number as part of its Requester ID and Completer ID. Each
-+** time the function is addressed by a Configuration Write transaction, the device must update this register
-+** with the contents of AD[15::11] of the address phase of the Configuration Write, regardless of which
-+** register in the function is addressed by the transaction. The function is addressed by a Configuration
-+** Write transaction when all of the following are true:
-+** 1. The transaction uses a Configuration Write command.
-+** 2. IDSEL is asserted during the address phase.
-+** 3. AD[1::0] are 00b (Type 0 configuration transaction).
-+** 4. AD[10::08] of the configuration address contain the appropriate function number.
-+** 2:0 000 2 Function Number - This register is read for diagnostic purposes only. It indicates the number of this
-+** function; i.e., the number in the Function Number field (AD[10::08]) of the address of a Type 0
-+** configuration transaction to which this function responds. The function uses this number as part of its
-+** Requester ID and Completer ID.
-+**
-+**************************************************************************
-+*/
-+#define ARCMSR_PCIX_STATUS_REG 0xE4 /*dword 0xE7,0xE6,0xE5,0xE4*/
-+
-+/*
-+**************************************************************************
-+** Inbound Read Transaction
-+** ========================================================================
-+** An inbound read transaction is initiated by a PCI initiator and is targeted at either 80331 local
-+** memory or a 80331 memory-mapped register space. The read transaction is propagated through
-+** the inbound transaction queue (ITQ) and read data is returned through the inbound read queue
-+** (IRQ).
-+** When operating in the conventional PCI mode, all inbound read transactions are processed as
-+** delayed read transactions. When operating in the PCI-X mode, all inbound read transactions are
-+** processed as split transactions. The ATUs PCI interface claims the read transaction and forwards
-+** the read request through to the internal bus and returns the read data to the PCI bus. Data flow for
-+** an inbound read transaction on the PCI bus is summarized in the following statements:
-+** ¡E The ATU claims the PCI read transaction when the PCI address is within the inbound
-+** translation window defined by ATU Inbound Base Address Register (and Inbound Upper Base
-+** Address Register during DACs) and Inbound Limit Register.
-+** ¡E When operating in the conventional PCI mode, when the ITQ is currently holding transaction
-+** information from a previous delayed read, the current transaction information is compared to
-+** the previous transaction information (based on the setting of the DRC Alias bit in
-+** Section 3.10.39, ¡§ATU Configuration Register - ATUCR¡¨ on page 252). When there is a
-+** match and the data is in the IRQ, return the data to the master on the PCI bus. When there is a
-+** match and the data is not available, a Retry is signaled with no other action taken. When there
-+** is not a match and when the ITQ has less than eight entries, capture the transaction
-+** information, signal a Retry and initiate a delayed transaction. When there is not a match and
-+** when the ITQ is full, then signal a Retry with no other action taken.
-+** ¡X When an address parity error is detected, the address parity response defined in
-+** Section 3.7 is used.
-+** ¡E When operating in the conventional PCI mode, once read data is driven onto the PCI bus from
-+** the IRQ, it continues until one of the following is true:
-+** ¡X The initiator completes the PCI transaction. When there is data left unread in the IRQ, the
-+** data is flushed.
-+** ¡X An internal bus Target Abort was detected. In this case, the QWORD associated with the
-+** Target Abort is never entered into the IRQ, and therefore is never returned.
-+** ¡X Target Abort or a Disconnect with Data is returned in response to the Internal Bus Error.
-+** ¡X The IRQ becomes empty. In this case, the PCI interface signals a Disconnect with data to
-+** the initiator on the last data word available.
-+** ¡E When operating in the PCI-X mode, when ITQ is not full, the PCI address, attribute and
-+** command are latched into the available ITQ and a Split Response Termination is signalled to
-+** the initiator.
-+** ¡E When operating in the PCI-X mode, when the transaction does not cross a 1024 byte aligned
-+** boundary, then the ATU waits until it receives the full byte count from the internal bus target
-+** before returning read data by generating the split completion transaction on the PCI-X bus.
-+** When the read requested crosses at least one 1024 byte boundary, then ATU completes the
-+** transfer by returning data in 1024 byte aligned chunks.
-+** ¡E When operating in the PCI-X mode, once a split completion transaction has started, it
-+** continues until one of the following is true:
-+** ¡X The requester (now the target) generates a Retry Termination, or a Disconnection at Next
-+** ADB (when the requester is a bridge)
-+** ¡X The byte count is satisfied.
-+** ¡X An internal bus Target Abort was detected. The ATU generates a Split Completion
-+** Message (message class=2h - completer error, and message index=81h - target abort) to
-+** inform the requester about the abnormal condition. The ITQ for this transaction is flushed.
-+** Refer to Section 3.7.1.
-+** ¡X An internal bus Master Abort was detected. The ATU generates a Split Completion
-+** Message (message class=2h - completer error, and message index=80h - Master abort) to
-+** inform the requester about the abnormal condition. The ITQ for this transaction is flushed.
-+** Refer to Section 3.7.1
-+** ¡E When operating in the conventional PCI mode, when the master inserts wait states on the PCI
-+** bus, the ATU PCI slave interface waits with no premature disconnects.
-+** ¡E When a data parity error occurs signified by PERR# asserted from the initiator, no action is
-+** taken by the target interface. Refer to Section 3.7.2.5.
-+** ¡E When operating in the conventional PCI mode, when the read on the internal bus is
-+** target-aborted, either a target-abort or a disconnect with data is signaled to the initiator. This is
-+** based on the ATU ECC Target Abort Enable bit (bit 0 of the ATUIMR for ATU). When set, a
-+** target abort is used, when clear, a disconnect is used.
-+** ¡E When operating in the PCI-X mode (with the exception of the MU queue ports at offsets 40h
-+** and 44h), when the transaction on the internal bus resulted in a target abort, the ATU generates
-+** a Split Completion Message (message class=2h - completer error, and message index=81h -
-+** internal bus target abort) to inform the requester about the abnormal condition. For the MU
-+** queue ports, the ATU returns either a target abort or a single data phase disconnect depending
-+** on the ATU ECC Target Abort Enable bit (bit 0 of the ATUIMR for ATU). The ITQ for this
-+** transaction is flushed. Refer to Section 3.7.1.
-+** ¡E When operating in the conventional PCI mode, when the transaction on the internal bus
-+** resulted in a master abort, the ATU returns a target abort to inform the requester about the
-+** abnormal condition. The ITQ for this transaction is flushed. Refer to Section 3.7.1
-+** ¡E When operating in the PCI-X mode, when the transaction on the internal bus resulted in a
-+** master abort, the ATU generates a Split Completion Message (message class=2h - completer
-+** error, and message index=80h - internal bus master abort) to inform the requester about the
-+** abnormal condition. The ITQ for this transaction is flushed. Refer to Section 3.7.1.
-+** ¡E When operating in the PCI-X mode, when the Split Completion transaction completes with
-+** either Master-Abort or Target-Abort, the requester is indicating a failure condition that
-+** prevents it from accepting the completion it requested. In this case, since the Split Request
-+** addresses a location that has no read side effects, the completer must discard the Split
-+** Completion and take no further action.
-+** The data flow for an inbound read transaction on the internal bus is summarized in the following
-+** statements:
-+** ¡E The ATU internal bus master interface requests the internal bus when a PCI address appears in
-+** an ITQ and transaction ordering has been satisfied. When operating in the PCI-X mode the
-+** ATU does not use the information provided by the Relax Ordering Attribute bit. That is, ATU
-+** always uses conventional PCI ordering rules.
-+** ¡E Once the internal bus is granted, the internal bus master interface drives the translated address
-+** onto the bus and wait for IB_DEVSEL#. When a Retry is signaled, the request is repeated.
-+** When a master abort occurs, the transaction is considered complete and a target abort is loaded
-+** into the associated IRQ for return to the PCI initiator (transaction is flushed once the PCI
-+** master has been delivered the target abort).
-+** ¡E Once the translated address is on the bus and the transaction has been accepted, the internal
-+** bus target starts returning data with the assertion of IB_TRDY#. Read data is continuously
-+** received by the IRQ until one of the following is true:
-+** ¡X The full byte count requested by the ATU read request is received. The ATU internal bus
-+** initiator interface performs a initiator completion in this case.
-+** ¡X When operating in the conventional PCI mode, a Target Abort is received on the internal
-+** bus from the internal bus target. In this case, the transaction is aborted and the PCI side is
-+** informed.
-+** ¡X When operating in the PCI-X mode, a Target Abort is received on the internal bus from
-+** the internal bus target. In this case, the transaction is aborted. The ATU generates a Split
-+** Completion Message (message class=2h - completer error, and message index=81h -
-+** target abort) on the PCI bus to inform the requester about the abnormal condition. The
-+** ITQ for this transaction is flushed.
-+** ¡X When operating in the conventional PCI mode, a single data phase disconnection is
-+** received from the internal bus target. When the data has not been received up to the next
-+** QWORD boundary, the ATU internal bus master interface attempts to reacquire the bus.
-+** When not, the bus returns to idle.
-+** ¡X When operating in the PCI-X mode, a single data phase disconnection is received from
-+** the internal bus target. The ATU IB initiator interface attempts to reacquire the bus to
-+** obtain remaining data.
-+** ¡X When operating in the conventional PCI mode, a disconnection at Next ADB is received
-+** from the internal bus target. The bus returns to idle.
-+** ¡X When operating in the PCI-X mode, a disconnection at Next ADB is received from the
-+** internal bus target. The ATU IB initiator interface attempts to reacquire the bus to obtain
-+** remaining data.
-+** To support PCI Local Bus Specification, Revision 2.0 devices, the ATU can be programmed to
-+** ignore the memory read command (Memory Read, Memory Read Line, and Memory Read
-+** Multiple) when trying to match the current inbound read transaction with data in a DRC queue
-+** which was read previously (DRC on target bus). When the Read Command Alias Bit in the
-+** ATUCR register is set, the ATU does not distinguish the read commands on transactions. For
-+** example, the ATU enqueues a DRR with a Memory Read Multiple command and performs the read
-+** on the internal bus. Some time later, a PCI master attempts a Memory Read with the same address
-+** as the previous Memory Read Multiple. When the Read Command Bit is set, the ATU would return
-+** the read data from the DRC queue and consider the Delayed Read transaction complete. When the
-+** Read Command bit in the ATUCR was clear, the ATU would not return data since the PCI read
-+** commands did not match, only the address.
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** Inbound Write Transaction
-+**========================================================================
-+** An inbound write transaction is initiated by a PCI master and is targeted at either 80331 local
-+** memory or a 80331 memory-mapped register.
-+** Data flow for an inbound write transaction on the PCI bus is summarized as:
-+** ¡E The ATU claims the PCI write transaction when the PCI address is within the inbound
-+** translation window defined by the ATU Inbound Base Address Register (and Inbound Upper
-+** Base Address Register during DACs) and Inbound Limit Register.
-+** ¡E When the IWADQ has at least one address entry available and the IWQ has at least one buffer
-+** available, the address is captured and the first data phase is accepted.
-+** ¡E The PCI interface continues to accept write data until one of the following is true:
-+** ¡X The initiator performs a disconnect.
-+** ¡X The transaction crosses a buffer boundary.
-+** ¡E When an address parity error is detected during the address phase of the transaction, the
-+** address parity error mechanisms are used. Refer to Section 3.7.1 for details of the address
-+** parity error response.
-+** ¡E When operating in the PCI-X mode when an attribute parity error is detected, the attribute
-+** parity error mechanism described in Section 3.7.1 is used.
-+** ¡E When a data parity error is detected while accepting data, the slave interface sets the
-+** appropriate bits based on PCI specifications. No other action is taken. Refer to Section 3.7.2.6
-+** for details of the inbound write data parity error response.
-+** Once the PCI interface places a PCI address in the IWADQ, when IWQ has received data sufficient
-+** to cross a buffer boundary or the master disconnects on the PCI bus, the ATUs internal bus
-+** interface becomes aware of the inbound write. When there are additional write transactions ahead
-+** in the IWQ/IWADQ, the current transaction remains posted until ordering and priority have been
-+** satisfied (Refer to Section 3.5.3) and the transaction is attempted on the internal bus by the ATU
-+** internal master interface. The ATU does not insert target wait states nor do data merging on the PCI
-+** interface, when operating in the PCI mode.
-+** In the PCI-X mode memory writes are always executed as immediate transactions, while
-+** configuration write transactions are processed as split transactions. The ATU generates a Split
-+** Completion Message, (with Message class=0h - Write Completion Class and Message index =
-+** 00h - Write Completion Message) once a configuration write is successfully executed.
-+** Also, when operating in the PCI-X mode a write sequence may contain multiple write transactions.
-+** The ATU handles such transactions as independent transactions.
-+** Data flow for the inbound write transaction on the internal bus is summarized as:
-+** ¡E The ATU internal bus master requests the internal bus when IWADQ has at least one entry
-+** with associated data in the IWQ.
-+** ¡E When the internal bus is granted, the internal bus master interface initiates the write
-+** transaction by driving the translated address onto the internal bus. For details on inbound
-+** address translation.
-+** ¡E When IB_DEVSEL# is not returned, a master abort condition is signaled on the internal bus.
-+** The current transaction is flushed from the queue and SERR# may be asserted on the PCI
-+** interface.
-+** ¡E The ATU initiator interface asserts IB_REQ64# to attempt a 64-bit transfer. When
-+** IB_ACK64# is not returned, a 32-bit transfer is used. Transfers of less than 64-bits use the
-+** IB_C/BE[7:0]# to mask the bytes not written in the 64-bit data phase. Write data is transferred
-+** from the IWQ to the internal bus when data is available and the internal bus interface retains
-+** internal bus ownership.
-+** ¡E The internal bus interface stops transferring data from the current transaction to the internal
-+** bus when one of the following conditions becomes true:
-+** ¡X The internal bus initiator interface loses bus ownership. The ATU internal initiator
-+** terminates the transfer (initiator disconnection) at the next ADB (for the internal bus ADB
-+** is defined as a naturally aligned 128-byte boundary) and attempt to reacquire the bus to
-+** complete the delivery of remaining data using the same sequence ID but with the
-+** modified starting address and byte count.
-+** ¡X A Disconnect at Next ADB is signaled on the internal bus from the internal target. When
-+** the transaction in the IWQ completes at that ADB, the initiator returns to idle. When the
-+** transaction in the IWQ is not complete, the initiator attempts to reacquire the bus to
-+** complete the delivery of remaining data using the same sequence ID but with the
-+** modified starting address and byte count.
-+** ¡X A Single Data Phase Disconnect is signaled on the internal bus from the internal target.
-+** When the transaction in the IWQ needs only a single data phase, the master returns to idle.
-+** When the transaction in the IWQ is not complete, the initiator attempts to reacquire the
-+** bus to complete the delivery of remaining data using the same sequence ID but with the
-+** modified starting address and byte count.
-+** ¡X The data from the current transaction has completed (satisfaction of byte count). An
-+** initiator termination is performed and the bus returns to idle.
-+** ¡X A Master Abort is signaled on the internal bus. SERR# may be asserted on the PCI bus.
-+** Data is flushed from the IWQ.
-+*****************************************************************
-+*/
-+
-+
-+
-+/*
-+**************************************************************************
-+** Inbound Read Completions Data Parity Errors
-+**========================================================================
-+** As an initiator, the ATU may encounter this error condition when operating in the PCI-X mode.
-+** When as the completer of a Split Read Request the ATU observes PERR# assertion during the split
-+** completion transaction, the ATU attempts to complete the transaction normally and no further
-+** action is taken.
-+**************************************************************************
-+*/
-+
-+/*
-+**************************************************************************
-+** Inbound Configuration Write Completion Message Data Parity Errors
-+**========================================================================
-+** As an initiator, the ATU may encounter this error condition when operating in the PCI-X mode.
-+** When as the completer of a Configuration (Split) Write Request the ATU observes PERR#
-+** assertion during the split completion transaction, the ATU attempts to complete the transaction
-+** normally and no further action is taken.
-+**************************************************************************
-+*/
-+
-+/*
-+**************************************************************************
-+** Inbound Read Request Data Parity Errors
-+**===================== Immediate Data Transfer ==========================
-+** As a target, the ATU may encounter this error when operating in the Conventional PCI or PCI-X modes.
-+** Inbound read data parity errors occur when read data delivered from the IRQ is detected as having
-+** bad parity by the initiator of the transaction who is receiving the data. The initiator may optionally
-+** report the error to the system by asserting PERR#. As a target device in this scenario, no action is
-+** required and no error bits are set.
-+**=====================Split Response Termination=========================
-+** As a target, the ATU may encounter this error when operating in the PCI-X mode.
-+** Inbound read data parity errors occur during the Split Response Termination. The initiator may
-+** optionally report the error to the system by asserting PERR#. As a target device in this scenario, no
-+** action is required and no error bits are set.
-+**************************************************************************
-+*/
-+
-+/*
-+**************************************************************************
-+** Inbound Write Request Data Parity Errors
-+**========================================================================
-+** As a target, the ATU may encounter this error when operating in the Conventional or PCI-X modes.
-+** Data parity errors occurring during write operations received by the ATU may assert PERR# on
-+** the PCI Bus. When an error occurs, the ATU continues accepting data until the initiator of the write
-+** transaction completes or a queue fill condition is reached. Specifically, the following actions with
-+** the given constraints are taken by the ATU:
-+** ¡E PERR# is asserted two clocks cycles (three clock cycles when operating in the PCI-X mode)
-+** following the data phase in which the data parity error is detected on the bus. This is only
-+** done when the Parity Error Response bit in the ATUCMD is set.
-+** ¡E The Detected Parity Error bit in the ATUSR is set. When the ATU sets this bit, additional
-+** actions is taken:
-+** ¡X When the ATU Detected Parity Error Interrupt Mask bit in the ATUIMR is clear, set the
-+** Detected Parity Error bit in the ATUISR. When set, no action.
-+***************************************************************************
-+*/
-+
-+
-+/*
-+***************************************************************************
-+** Inbound Configuration Write Request
-+** =====================================================================
-+** As a target, the ATU may encounter this error when operating in the Conventional or PCI-X modes.
-+** ===============================================
-+** Conventional PCI Mode
-+** ===============================================
-+** To allow for correct data parity calculations for delayed write transactions, the ATU delays the
-+** assertion of STOP# (signalling a Retry) until PAR is driven by the master. A parity error during a
-+** delayed write transaction (inbound configuration write cycle) can occur in any of the following
-+** parts of the transactions:
-+** ¡E During the initial Delayed Write Request cycle on the PCI bus when the ATU latches the
-+** address/command and data for delayed delivery to the internal configuration register.
-+** ¡E During the Delayed Write Completion cycle on the PCI bus when the ATU delivers the status
-+** of the operation back to the original master.
-+** The 80331 ATU PCI interface has the following responses to a delayed write parity error for
-+** inbound transactions during Delayed Write Request cycles with the given constraints:
-+** ¡E When the Parity Error Response bit in the ATUCMD is set, the ATU asserts TRDY#
-+** (disconnects with data) and two clock cycles later asserts PERR# notifying the initiator of the
-+** parity error. The delayed write cycle is not enqueued and forwarded to the internal bus.
-+** When the Parity Error Response bit in the ATUCMD is cleared, the ATU retries the
-+** transaction by asserting STOP# and enqueues the Delayed Write Request cycle to be
-+** forwarded to the internal bus. PERR# is not asserted.
-+** ¡E The Detected Parity Error bit in the ATUSR is set. When the ATU sets this bit, additional
-+** actions is taken:
-+** ¡X When the ATU Detected Parity Error Interrupt Mask bit in the ATUIMR is clear, set the
-+** Detected Parity Error bit in the ATUISR. When set, no action.
-+** For the original write transaction to be completed, the initiator retries the transaction on the PCI
-+** bus and the ATU returns the status from the internal bus, completing the transaction.
-+** For the Delayed Write Completion transaction on the PCI bus where a data parity error occurs and
-+** therefore does not agree with the status being returned from the internal bus (i.e. status being
-+** returned is normal completion) the ATU performs the following actions with the given constraints:
-+** ¡E When the Parity Error Response Bit is set in the ATUCMD, the ATU asserts TRDY#
-+** (disconnects with data) and two clocks later asserts PERR#. The Delayed Completion cycle in
-+** the IDWQ remains since the data of retried command did not match the data within the queue.
-+** ¡E The Detected Parity Error bit in the ATUSR is set. When the ATU sets this bit, additional
-+** actions is taken:
-+** ¡X When the ATU Detected Parity Error Interrupt Mask bit in the ATUIMR is clear, set the
-+** Detected Parity Error bit in the ATUISR. When set, no action.
-+** ===================================================
-+** PCI-X Mode
-+** ===================================================
-+** Data parity errors occurring during configuration write operations received by the ATU may cause
-+** PERR# assertion and delivery of a Split Completion Error Message on the PCI Bus. When an error
-+** occurs, the ATU accepts the write data and complete with a Split Response Termination.
-+** Specifically, the following actions with the given constraints are then taken by the ATU:
-+** ¡E When the Parity Error Response bit in the ATUCMD is set, PERR# is asserted three clocks
-+** cycles following the Split Response Termination in which the data parity error is detected on
-+** the bus. When the ATU asserts PERR#, additional actions is taken:
-+** ¡X A Split Write Data Parity Error message (with message class=2h - completer error and
-+** message index=01h - Split Write Data Parity Error) is initiated by the ATU on the PCI bus
-+** that addresses the requester of the configuration write.
-+** ¡X When the Initiated Split Completion Error Message Interrupt Mask in the ATUIMR is
-+** clear, set the Initiated Split Completion Error Message bit in the ATUISR. When set, no
-+** action.
-+** ¡X The Split Write Request is not enqueued and forwarded to the internal bus.
-+** ¡E The Detected Parity Error bit in the ATUSR is set. When the ATU sets this bit, additional
-+** actions is taken:
-+** ¡X When the ATU Detected Parity Error Interrupt Mask bit in the ATUIMR is clear, set the
-+** Detected Parity Error bit in the ATUISR. When set, no action.
-+**
-+***************************************************************************
-+*/
-+
-+/*
-+***************************************************************************
-+** Split Completion Messages
-+** =======================================================================
-+** As a target, the ATU may encounter this error when operating in the PCI-X mode.
-+** Data parity errors occurring during Split Completion Messages claimed by the ATU may assert
-+** PERR# (when enabled) or SERR# (when enabled) on the PCI Bus. When an error occurs, the
-+** ATU accepts the data and complete normally. Specifically, the following actions with the given
-+** constraints are taken by the ATU:
-+** ¡E PERR# is asserted three clocks cycles following the data phase in which the data parity error
-+** is detected on the bus. This is only done when the Parity Error Response bit in the ATUCMD
-+** is set. When the ATU asserts PERR#, additional actions is taken:
-+** ¡X The Master Parity Error bit in the ATUSR is set.
-+** ¡X When the ATU PCI Master Parity Error Interrupt Mask Bit in the ATUIMR is clear, set the
-+** PCI Master Parity Error bit in the ATUISR. When set, no action.
-+** ¡X When the SERR# Enable bit in the ATUCMD is set, and the Data Parity Error Recover
-+** Enable bit in the PCIXCMD register is clear, assert SERR#; otherwise no action is taken.
-+** When the ATU asserts SERR#, additional actions is taken:
-+** Set the SERR# Asserted bit in the ATUSR.
-+** When the ATU SERR# Asserted Interrupt Mask Bit in the ATUIMR is clear, set the
-+** SERR# Asserted bit in the ATUISR. When set, no action.
-+** When the ATU SERR# Detected Interrupt Enable Bit in the ATUCR is set, set the
-+** SERR# Detected bit in the ATUISR. When clear, no action.
-+** ¡E When the SCE bit (Split Completion Error -- bit 30 of the Completer Attributes) is set during
-+** the Attribute phase, the Received Split Completion Error Message bit in the PCIXSR is set.
-+** When the ATU sets this bit, additional actions is taken:
-+** ¡X When the ATU Received Split Completion Error Message Interrupt Mask bit in the
-+** ATUIMR is clear, set the Received Split Completion Error Message bit in the ATUISR.
-+** When set, no action.
-+** ¡E The Detected Parity Error bit in the ATUSR is set. When the ATU sets this bit, additional
-+** actions is taken:
-+** ¡X When the ATU Detected Parity Error Interrupt Mask bit in the ATUIMR is clear, set the
-+** Detected Parity Error bit in the ATUISR. When set, no action.
-+** ¡E The transaction associated with the Split Completion Message is discarded.
-+** ¡E When the discarded transaction was a read, a completion error message (with message
-+** class=2h - completer error and message index=82h - PCI bus read parity error) is generated on
-+** the internal bus of the 80331.
-+*****************************************************************************
-+*/
-+
-+
-+/*
-+******************************************************************************************************
-+** Messaging Unit (MU) of the Intel R 80331 I/O processor (80331)
-+** ==================================================================================================
-+** The Messaging Unit (MU) transfers data between the PCI system and the 80331
-+** notifies the respective system when new data arrives.
-+** The PCI window for messaging transactions is always the first 4 Kbytes of the inbound translation.
-+** window defined by:
-+** 1.Inbound ATU Base Address Register 0 (IABAR0)
-+** 2.Inbound ATU Limit Register 0 (IALR0)
-+** All of the Messaging Unit errors are reported in the same manner as ATU errors.
-+** Error conditions and status can be found in :
-+** 1.ATUSR
-+** 2.ATUISR
-+**====================================================================================================
-+** Mechanism Quantity Assert PCI Interrupt Signals Generate I/O Processor Interrupt
-+**----------------------------------------------------------------------------------------------------
-+** Message Registers 2 Inbound Optional Optional
-+** 2 Outbound
-+**----------------------------------------------------------------------------------------------------
-+** Doorbell Registers 1 Inbound Optional Optional
-+** 1 Outbound
-+**----------------------------------------------------------------------------------------------------
-+** Circular Queues 4 Circular Queues Under certain conditions Under certain conditions
-+**----------------------------------------------------------------------------------------------------
-+** Index Registers 1004 32-bit Memory Locations No Optional
-+**====================================================================================================
-+** PCI Memory Map: First 4 Kbytes of the ATU Inbound PCI Address Space
-+**====================================================================================================
-+** 0000H Reserved
-+** 0004H Reserved
-+** 0008H Reserved
-+** 000CH Reserved
-+**------------------------------------------------------------------------
-+** 0010H Inbound Message Register 0 ]
-+** 0014H Inbound Message Register 1 ]
-+** 0018H Outbound Message Register 0 ]
-+** 001CH Outbound Message Register 1 ] 4 Message Registers
-+**------------------------------------------------------------------------
-+** 0020H Inbound Doorbell Register ]
-+** 0024H Inbound Interrupt Status Register ]
-+** 0028H Inbound Interrupt Mask Register ]
-+** 002CH Outbound Doorbell Register ]
-+** 0030H Outbound Interrupt Status Register ]
-+** 0034H Outbound Interrupt Mask Register ] 2 Doorbell Registers and 4 Interrupt Registers
-+**------------------------------------------------------------------------
-+** 0038H Reserved
-+** 003CH Reserved
-+**------------------------------------------------------------------------
-+** 0040H Inbound Queue Port ]
-+** 0044H Outbound Queue Port ] 2 Queue Ports
-+**------------------------------------------------------------------------
-+** 0048H Reserved
-+** 004CH Reserved
-+**------------------------------------------------------------------------
-+** 0050H ]
-+** : ]
-+** : Intel Xscale Microarchitecture Local Memory ]
-+** : ]
-+** 0FFCH ] 1004 Index Registers
-+*******************************************************************************
-+*/
-+typedef struct _MU
-+{
-+ uint32_t resrved0[4]; /*0000 000F*/
-+ uint32_t inbound_msgaddr0; /*0010 0013*/
-+ uint32_t inbound_msgaddr1; /*0014 0017*/
-+ uint32_t outbound_msgaddr0; /*0018 001B*/
-+ uint32_t outbound_msgaddr1; /*001C 001F*/
-+ uint32_t inbound_doorbell; /*0020 0023*/
-+ uint32_t inbound_intstatus; /*0024 0027*/
-+ uint32_t inbound_intmask; /*0028 002B*/
-+ uint32_t outbound_doorbell; /*002C 002F*/
-+ uint32_t outbound_intstatus; /*0030 0033*/
-+ uint32_t outbound_intmask; /*0034 0037*/
-+ uint32_t reserved1[2]; /*0038 003F*/
-+ uint32_t inbound_queueport; /*0040 0043*/
-+ uint32_t outbound_queueport; /*0044 0047*/
-+ uint32_t reserved2[2]; /*0048 004F*/
-+ uint32_t reserved3[492]; /*0050 07FF ......local_buffer 492*/
-+ uint32_t reserved4[128]; /*0800 09FF 128*/
-+ uint32_t message_rwbuffer[256]; /*0a00 0DFF 256*/
-+ uint32_t ioctl_wbuffer[32]; /*0E00 0E7F 32*/
-+ uint32_t reserved5[32]; /*0E80 0EFF 32*/
-+ uint32_t ioctl_rbuffer[32]; /*0F00 0F7F 32*/
-+ uint32_t reserved6[32]; /*0F80 0FFF 32*/
-+}MU,*PMU;
-+/*
-+*****************************************************************************
-+** Theory of MU Operation
-+*****************************************************************************
-+**--------------------
-+** inbound_msgaddr0:
-+** inbound_msgaddr1:
-+** outbound_msgaddr0:
-+** outbound_msgaddr1:
-+** . The MU has four independent messaging mechanisms.
-+** There are four Message Registers that are similar to a combination of mailbox and doorbell registers.
-+** Each holds a 32-bit value and generates an interrupt when written.
-+**--------------------
-+** inbound_doorbell:
-+** outbound_doorbell:
-+** . The two Doorbell Registers support software interrupts.
-+** When a bit is set in a Doorbell Register, an interrupt is generated.
-+**--------------------
-+** inbound_queueport:
-+** outbound_queueport:
-+**
-+**
-+** . The Circular Queues support a message passing scheme that uses 4 circular queues.
-+** The 4 circular queues are implemented in 80331 local memory.
-+** Two queues are used for inbound messages and two are used for outbound messages.
-+** Interrupts may be generated when the queue is written.
-+**--------------------
-+** local_buffer 0x0050 ....0x0FFF
-+** . The Index Registers use a portion of the 80331 local memory to implement a large set of message registers.
-+** When one of the Index Registers is written, an interrupt is generated and the address of the register written is captured.
-+** Interrupt status for all interrupts is recorded in the Inbound Interrupt Status Register and the Outbound Interrupt Status Register.
-+** Each interrupt generated by the Messaging Unit can be masked.
-+**--------------------
-+** . Multi-DWORD PCI burst accesses are not supported by the Messaging Unit,
-+** with the exception of Multi-DWORD reads to the index registers.
-+** In Conventional mode: the MU terminates Multi-DWORD PCI transactions (other than index register reads) with a disconnect at the next Qword boundary, with the exception of queue ports.
-+** In PCI-X mode : the MU terminates a Multi-DWORD PCI read transaction with a Split Response and the data is returned through split completion transaction(s).
-+** however, when the burst request crosses into or through the range of offsets 40h to 4Ch (e.g., this includes the queue ports) the transaction is signaled target-abort immediately on the PCI bus.
-+** In PCI-X mode, Multi-DWORD PCI writes is signaled a Single-Data-Phase Disconnect which means that no data beyond the first Qword (Dword when the MU does not assert P_ACK64#) is written.
-+**--------------------
-+** . All registers needed to configure and control the Messaging Unit are memory-mapped registers.
-+** The MU uses the first 4 Kbytes of the inbound translation window in the Address Translation Unit (ATU).
-+** This PCI address window is used for PCI transactions that access the 80331 local memory.
-+** The PCI address of the inbound translation window is contained in the Inbound ATU Base Address Register.
-+**--------------------
-+** . From the PCI perspective, the Messaging Unit is part of the Address Translation Unit.
-+** The Messaging Unit uses the PCI configuration registers of the ATU for control and status information.
-+** The Messaging Unit must observe all PCI control bits in the ATU Command Register and ATU Configuration Register.
-+** The Messaging Unit reports all PCI errors in the ATU Status Register.
-+**--------------------
-+** . Parts of the Messaging Unit can be accessed as a 64-bit PCI device.
-+** The register interface, message registers, doorbell registers, and index registers returns a P_ACK64# in response to a P_REQ64# on the PCI interface.
-+** Up to 1 Qword of data can be read or written per transaction (except Index Register reads).
-+** The Inbound and Outbound Queue Ports are always 32-bit addresses and the MU does not assert P_ACK64# to offsets 40H and 44H.
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** Message Registers
-+** ==============================
-+** . Messages can be sent and received by the 80331 through the use of the Message Registers.
-+** . When written, the message registers may cause an interrupt to be generated to either the Intel XScale core or the host processor.
-+** . Inbound messages are sent by the host processor and received by the 80331.
-+** Outbound messages are sent by the 80331 and received by the host processor.
-+** . The interrupt status for outbound messages is recorded in the Outbound Interrupt Status Register.
-+** Interrupt status for inbound messages is recorded in the Inbound Interrupt Status Register.
-+**
-+** Inbound Messages:
-+** -----------------
-+** . When an inbound message register is written by an external PCI agent, an interrupt may be generated to the Intel XScale core.
-+** . The interrupt may be masked by the mask bits in the Inbound Interrupt Mask Register.
-+** . The Intel XScale core interrupt is recorded in the Inbound Interrupt Status Register.
-+** The interrupt causes the Inbound Message Interrupt bit to be set in the Inbound Interrupt Status Register.
-+** This is a Read/Clear bit that is set by the MU hardware and cleared by software.
-+** The interrupt is cleared when the Intel XScale core writes a value of 1 to the Inbound Message Interrupt bit in the Inbound Interrupt Status Register.
-+** ------------------------------------------------------------------------
-+** Inbound Message Register - IMRx
-+**
-+** . There are two Inbound Message Registers: IMR0 and IMR1.
-+** . When the IMR register is written, an interrupt to the Intel XScale core may be generated.
-+** The interrupt is recorded in the Inbound Interrupt Status Register and may be masked by the Inbound Message Interrupt Mask bit in the Inbound Interrupt Mask Register.
-+** -----------------------------------------------------------------
-+** Bit Default Description
-+** 31:00 0000 0000H Inbound Message - This is a 32-bit message written by an external PCI agent.
-+** When written, an interrupt to the Intel XScale core may be generated.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_MESSAGE_REG0 0x10 /*dword 0x13,0x12,0x11,0x10*/
-+#define ARCMSR_MU_INBOUND_MESSAGE_REG1 0x14 /*dword 0x17,0x16,0x15,0x14*/
-+/*
-+**************************************************************************
-+** Outbound Message Register - OMRx
-+** --------------------------------
-+** There are two Outbound Message Registers: OMR0 and OMR1. When the OMR register is
-+** written, a PCI interrupt may be generated. The interrupt is recorded in the Outbound Interrupt
-+** Status Register and may be masked by the Outbound Message Interrupt Mask bit in the Outbound
-+** Interrupt Mask Register.
-+**
-+** Bit Default Description
-+** 31:00 00000000H Outbound Message - This is 32-bit message written by the Intel XScale core. When written, an
-+** interrupt may be generated on the PCI Interrupt pin determined by the ATU Interrupt Pin Register.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_OUTBOUND_MESSAGE_REG0 0x18 /*dword 0x1B,0x1A,0x19,0x18*/
-+#define ARCMSR_MU_OUTBOUND_MESSAGE_REG1 0x1C /*dword 0x1F,0x1E,0x1D,0x1C*/
-+/*
-+**************************************************************************
-+** Doorbell Registers
-+** ==============================
-+** There are two Doorbell Registers:
-+** Inbound Doorbell Register
-+** Outbound Doorbell Register
-+** The Inbound Doorbell Register allows external PCI agents to generate interrupts to the Intel R XScale core.
-+** The Outbound Doorbell Register allows the Intel R XScale core to generate a PCI interrupt.
-+** Both Doorbell Registers may generate interrupts whenever a bit in the register is set.
-+**
-+** Inbound Doorbells:
-+** ------------------
-+** . When the Inbound Doorbell Register is written by an external PCI agent, an interrupt may be generated to the Intel R XScale core.
-+** An interrupt is generated when any of the bits in the doorbell register is written to a value of 1.
-+** Writing a value of 0 to any bit does not change the value of that bit and does not cause an interrupt to be generated.
-+** . Once a bit is set in the Inbound Doorbell Register, it cannot be cleared by any external PCI agent.
-+** The interrupt is recorded in the Inbound Interrupt Status Register.
-+** . The interrupt may be masked by the Inbound Doorbell Interrupt mask bit in the Inbound Interrupt Mask Register.
-+** When the mask bit is set for a particular bit, no interrupt is generated for that bit.
-+** The Inbound Interrupt Mask Register affects only the generation of the normal messaging unit interrupt and not the values written to the Inbound Doorbell Register.
-+** One bit in the Inbound Doorbell Register is reserved for an Error Doorbell interrupt.
-+** . The interrupt is cleared when the Intel R XScale core writes a value of 1 to the bits in the Inbound Doorbell Register that are set.
-+** Writing a value of 0 to any bit does not change the value of that bit and does not clear the interrupt.
-+** ------------------------------------------------------------------------
-+** Inbound Doorbell Register - IDR
-+**
-+** . The Inbound Doorbell Register (IDR) is used to generate interrupts to the Intel XScale core.
-+** . Bit 31 is reserved for generating an Error Doorbell interrupt.
-+** When bit 31 is set, an Error interrupt may be generated to the Intel XScale core.
-+** All other bits, when set, cause the Normal Messaging Unit interrupt line of the Intel XScale core to be asserted,
-+** when the interrupt is not masked by the Inbound Doorbell Interrupt Mask bit in the Inbound Interrupt Mask Register.
-+** The bits in the IDR register can only be set by an external PCI agent and can only be cleared by the Intel XScale core.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31 0 2 Error Interrupt - Generate an Error Interrupt to the Intel XScale core.
-+** 30:00 00000000H Normal Interrupt - When any bit is set, generate a Normal interrupt to the Intel XScale core.
-+** When all bits are clear, do not generate a Normal Interrupt.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_DOORBELL_REG 0x20 /*dword 0x23,0x22,0x21,0x20*/
-+/*
-+**************************************************************************
-+** Inbound Interrupt Status Register - IISR
-+**
-+** . The Inbound Interrupt Status Register (IISR) contains hardware interrupt status.
-+** It records the status of Intel XScale core interrupts generated by the Message Registers, Doorbell Registers, and the Circular Queues.
-+** All interrupts are routed to the Normal Messaging Unit interrupt input of the Intel XScale core,
-+** except for the Error Doorbell Interrupt and the Outbound Free Queue Full interrupt;
-+** these two are routed to the Messaging Unit Error interrupt input.
-+** The generation of interrupts recorded in the Inbound Interrupt Status Register may be masked by setting the corresponding bit in the Inbound Interrupt Mask Register.
-+** Some of the bits in this register are Read Only.
-+** For those bits, the interrupt must be cleared through another register.
-+**
-+** Bit Default Description
-+** 31:07 0000000H 0 2 Reserved
-+** 06 0 2 Index Register Interrupt - This bit is set by the MU hardware when an Index Register has been written after a PCI transaction.
-+** 05 0 2 Outbound Free Queue Full Interrupt - This bit is set when the Outbound Free Head Pointer becomes equal to the Tail Pointer and the queue is full.
-+** An Error interrupt is generated for this condition.
-+** 04 0 2 Inbound Post Queue Interrupt - This bit is set by the MU hardware when the Inbound Post Queue has been written.
-+** Once cleared, an interrupt does NOT be generated when the head and tail pointers remain unequal (i.e. queue status is Not Empty).
-+** Therefore, when software leaves any unprocessed messages in the post queue when the interrupt is cleared,
-+** software must retain the information that the Inbound Post queue status is not empty.
-+** NOTE:
-+** This interrupt is provided with dedicated support in the 80331 Interrupt Controller.
-+** 03 0 2 Error Doorbell Interrupt - This bit is set when the Error Interrupt of the Inbound Doorbell Register is set.
-+** To clear this bit (and the interrupt), the Error Interrupt bit of the Inbound Doorbell Register must be clear.
-+** 02 0 2 Inbound Doorbell Interrupt - This bit is set when at least one Normal Interrupt bit in the Inbound Doorbell Register is set.
-+** To clear this bit (and the interrupt), the Normal Interrupt bits in the Inbound Doorbell Register must all be clear.
-+** 01 0 2 Inbound Message 1 Interrupt - This bit is set by the MU hardware when the Inbound Message 1 Register has been written.
-+** 00 0 2 Inbound Message 0 Interrupt - This bit is set by the MU hardware when the Inbound Message 0 Register has been written.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_INTERRUPT_STATUS_REG 0x24 /*dword 0x27,0x26,0x25,0x24*/
-+#define ARCMSR_MU_INBOUND_INDEX_INT 0x40
-+#define ARCMSR_MU_INBOUND_QUEUEFULL_INT 0x20
-+#define ARCMSR_MU_INBOUND_POSTQUEUE_INT 0x10
-+#define ARCMSR_MU_INBOUND_ERROR_DOORBELL_INT 0x08
-+#define ARCMSR_MU_INBOUND_DOORBELL_INT 0x04
-+#define ARCMSR_MU_INBOUND_MESSAGE1_INT 0x02
-+#define ARCMSR_MU_INBOUND_MESSAGE0_INT 0x01
-+/*
-+**************************************************************************
-+** Inbound Interrupt Mask Register - IIMR
-+**
-+** . The Inbound Interrupt Mask Register (IIMR) provides the ability to mask Intel XScale core interrupts generated by the Messaging Unit.
-+** Each bit in the Mask register corresponds to an interrupt bit in the Inbound Interrupt Status Register.
-+** Setting or clearing bits in this register does not affect the Inbound Interrupt Status Register.
-+** They only affect the generation of the Intel XScale core interrupt.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:07 000000H 0 2 Reserved
-+** 06 0 2 Index Register Interrupt Mask - When set, this bit masks the interrupt generated by the MU hardware when an Index Register has been written after a PCI transaction.
-+** 05 0 2 Outbound Free Queue Full Interrupt Mask - When set, this bit masks the Error interrupt generated when the Outbound Free Head Pointer becomes equal to the Tail Pointer and the queue is full.
-+** 04 0 2 Inbound Post Queue Interrupt Mask - When set, this bit masks the interrupt generated by the MU hardware when the Inbound Post Queue has been written.
-+** 03 0 2 Error Doorbell Interrupt Mask - When set, this bit masks the Error Interrupt when the Error Interrupt bit of the Inbound Doorbell Register is set.
-+** 02 0 2 Inbound Doorbell Interrupt Mask - When set, this bit masks the interrupt generated when at least one Normal Interrupt bit in the Inbound Doorbell Register is set.
-+** 01 0 2 Inbound Message 1 Interrupt Mask - When set, this bit masks the Inbound Message 1 Interrupt generated by a write to the Inbound Message 1 Register.
-+** 00 0 2 Inbound Message 0 Interrupt Mask - When set, this bit masks the Inbound Message 0 Interrupt generated by a write to the Inbound Message 0 Register.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_INTERRUPT_MASK_REG 0x28 /*dword 0x2B,0x2A,0x29,0x28*/
-+#define ARCMSR_MU_INBOUND_INDEX_INTMASKENABLE 0x40
-+#define ARCMSR_MU_INBOUND_QUEUEFULL_INTMASKENABLE 0x20
-+#define ARCMSR_MU_INBOUND_POSTQUEUE_INTMASKENABLE 0x10
-+#define ARCMSR_MU_INBOUND_DOORBELL_ERROR_INTMASKENABLE 0x08
-+#define ARCMSR_MU_INBOUND_DOORBELL_INTMASKENABLE 0x04
-+#define ARCMSR_MU_INBOUND_MESSAGE1_INTMASKENABLE 0x02
-+#define ARCMSR_MU_INBOUND_MESSAGE0_INTMASKENABLE 0x01
-+/*
-+**************************************************************************
-+** Outbound Doorbell Register - ODR
-+**
-+** The Outbound Doorbell Register (ODR) allows software interrupt generation. It allows the Intel
-+** XScale core to generate PCI interrupts to the host processor by writing to this register. The
-+** generation of PCI interrupts through the Outbound Doorbell Register may be masked by setting the
-+** Outbound Doorbell Interrupt Mask bit in the Outbound Interrupt Mask Register.
-+** The Software Interrupt bits in this register can only be set by the Intel XScale core and can only
-+** be cleared by an external PCI agent.
-+** ----------------------------------------------------------------------
-+** Bit Default Description
-+** 31 0 2 Reserved
-+** 30 0 2 Reserved.
-+** 29 0 2 Reserved
-+** 28 0000 0000H PCI Interrupt - When set, this bit causes the P_INTC# interrupt output (P_INTA# with BRG_EN and ARB_EN straps low)
-+** signal to be asserted or a Message-signaled Interrupt is generated (when enabled).
-+** When this bit is cleared, the P_INTC# interrupt output (P_INTA# with BRG_EN and ARB_EN straps low)
-+** signal is deasserted.
-+** 27:00 000 0000H Software Interrupts - When any bit is set the P_INTC# interrupt output (P_INTA# with BRG_EN and ARB_EN straps low)
-+** signal is asserted or a Message-signaled Interrupt is generated (when enabled).
-+** When all bits are cleared, the P_INTC# interrupt output (P_INTA# with BRG_EN and ARB_EN straps low)
-+** signal is deasserted.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_OUTBOUND_DOORBELL_REG 0x2C //dword 0x2F,0x2E,0x2D,0x2C//
-+/*
-+**************************************************************************
-+** Outbound Interrupt Status Register - OISR
-+**
-+** The Outbound Interrupt Status Register (OISR) contains hardware interrupt status. It records the
-+** status of PCI interrupts generated by the Message Registers, Doorbell Registers, and the Circular
-+** Queues. The generation of PCI interrupts recorded in the Outbound Interrupt Status Register may
-+** be masked by setting the corresponding bit in the Outbound Interrupt Mask Register. Some of the
-+** bits in this register are Read Only. For those bits, the interrupt must be cleared through another
-+** register.
-+** ----------------------------------------------------------------------
-+** Bit Default Description
-+** 31:05 000000H 000 2 Reserved
-+** 04 0 2 PCI Interrupt - This bit is set when the PCI Interrupt bit (bit 28) is set in the Outbound Doorbell Register.
-+** To clear this bit (and the interrupt), the PCI Interrupt bit must be cleared.
-+** 03 0 2 Outbound Post Queue Interrupt - This bit is set when data in the prefetch buffer is valid. This bit is
-+** cleared when any prefetch data has been read from the Outbound Queue Port.
-+** 02 0 2 Outbound Doorbell Interrupt - This bit is set when at least one Software Interrupt bit in the Outbound
-+** Doorbell Register is set. To clear this bit (and the interrupt), the Software Interrupt bits in the Outbound
-+** Doorbell Register must all be clear.
-+** 01 0 2 Outbound Message 1 Interrupt - This bit is set by the MU when the Outbound Message 1 Register is
-+** written. Clearing this bit clears the interrupt.
-+** 00 0 2 Outbound Message 0 Interrupt - This bit is set by the MU when the Outbound Message 0 Register is
-+** written. Clearing this bit clears the interrupt.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_OUTBOUND_INTERRUPT_STATUS_REG 0x30 //dword 0x33,0x32,0x31,0x30//
-+#define ARCMSR_MU_OUTBOUND_PCI_INT 0x10
-+#define ARCMSR_MU_OUTBOUND_POSTQUEUE_INT 0x08
-+#define ARCMSR_MU_OUTBOUND_DOORBELL_INT 0x04
-+#define ARCMSR_MU_OUTBOUND_MESSAGE1_INT 0x02
-+#define ARCMSR_MU_OUTBOUND_MESSAGE0_INT 0x01
-+#define ARCMSR_MU_OUTBOUND_HANDLE_INT (ARCMSR_MU_OUTBOUND_MESSAGE0_INT|ARCMSR_MU_OUTBOUND_MESSAGE1_INT|ARCMSR_MU_OUTBOUND_DOORBELL_INT|ARCMSR_MU_OUTBOUND_POSTQUEUE_INT|ARCMSR_MU_OUTBOUND_PCI_INT)
-+/*
-+**************************************************************************
-+** Outbound Interrupt Mask Register - OIMR
-+** The Outbound Interrupt Mask Register (OIMR) provides the ability to mask outbound PCI
-+** interrupts generated by the Messaging Unit. Each bit in the mask register corresponds to a
-+** hardware interrupt bit in the Outbound Interrupt Status Register. When the bit is set, the PCI
-+** interrupt is not generated. When the bit is clear, the interrupt is allowed to be generated.
-+** Setting or clearing bits in this register does not affect the Outbound Interrupt Status Register. They
-+** only affect the generation of the PCI interrupt.
-+** ----------------------------------------------------------------------
-+** Bit Default Description
-+** 31:05 000000H Reserved
-+** 04 0 2 PCI Interrupt Mask - When set, this bit masks the interrupt generation when the PCI Interrupt bit (bit 28)
-+** in the Outbound Doorbell Register is set.
-+** 03 0 2 Outbound Post Queue Interrupt Mask - When set, this bit masks the interrupt generated when data in
-+** the prefetch buffer is valid.
-+** 02 0 2 Outbound Doorbell Interrupt Mask - When set, this bit masks the interrupt generated by the Outbound
-+** Doorbell Register.
-+** 01 0 2 Outbound Message 1 Interrupt Mask - When set, this bit masks the Outbound Message 1 Interrupt
-+** generated by a write to the Outbound Message 1 Register.
-+** 00 0 2 Outbound Message 0 Interrupt Mask- When set, this bit masks the Outbound Message 0 Interrupt
-+** generated by a write to the Outbound Message 0 Register.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_OUTBOUND_INTERRUPT_MASK_REG 0x34 //dword 0x37,0x36,0x35,0x34//
-+#define ARCMSR_MU_OUTBOUND_PCI_INTMASKENABLE 0x10
-+#define ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE 0x08
-+#define ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE 0x04
-+#define ARCMSR_MU_OUTBOUND_MESSAGE1_INTMASKENABLE 0x02
-+#define ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE 0x01
-+#define ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE 0x1F
-+/*
-+**************************************************************************
-+**
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_QUEUE_PORT_REG 0x40 //dword 0x43,0x42,0x41,0x40//
-+#define ARCMSR_MU_OUTBOUND_QUEUE_PORT_REG 0x44 //dword 0x47,0x46,0x45,0x44//
-+/*
-+**************************************************************************
-+** Circular Queues
-+** ======================================================================
-+** The MU implements four circular queues. There are 2 inbound queues and 2 outbound queues. In
-+** this case, inbound and outbound refer to the direction of the flow of posted messages.
-+** Inbound messages are either:
-+** ¡E posted messages by other processors for the Intel XScale core to process or
-+** ¡E free (or empty) messages that can be reused by other processors.
-+** Outbound messages are either:
-+** ¡E posted messages by the Intel XScale core for other processors to process or
-+** ¡E free (or empty) messages that can be reused by the Intel XScale core.
-+** Therefore, free inbound messages flow away from the 80331 and free outbound messages flow toward the 80331.
-+** The four Circular Queues are used to pass messages in the following manner.
-+** . The two inbound queues are used to handle inbound messages
-+** and the two outbound queues are used to handle outbound messages.
-+** . One of the inbound queues is designated the Free queue and it contains inbound free messages.
-+** The other inbound queue is designated the Post queue and it contains inbound posted messages.
-+** Similarly, one of the outbound queues is designated the Free queue and the other outbound queue is designated the Post queue.
-+**
-+** =============================================================================================================
-+** Circular Queue Summary
-+** _____________________________________________________________________________________________________________
-+** | Queue Name | Purpose | Action on PCI Interface|
-+** |______________________|____________________________________________________________|_________________________|
-+** |Inbound Post Queue | Queue for inbound messages from other processors | Written |
-+** | | waiting to be processed by the 80331 | |
-+** |Inbound Free Queue | Queue for empty inbound messages from the 80331 | Read |
-+** | | available for use by other processors | |
-+** |Outbound Post Queue | Queue for outbound messages from the 80331 | Read |
-+** | | that are being posted to the other processors | |
-+** |Outbound Free Queue | Queue for empty outbound messages from other processors | Written |
-+** | | available for use by the 80331 | |
-+** |______________________|____________________________________________________________|_________________________|
-+**
-+** . The two inbound queues allow the host processor to post inbound messages for the 80331 in one
-+** queue and to receive free messages returning from the 80331.
-+** The host processor posts inbound messages,
-+** the Intel XScale core receives the posted message and when it is finished with the message,
-+** places it back on the inbound free queue for reuse by the host processor.
-+**
-+** The circular queues are accessed by external PCI agents through two port locations in the PCI
-+** address space:
-+** Inbound Queue Port
-+** and Outbound Queue Port.
-+** The Inbound Queue Port is used by external PCI agents to read the Inbound Free Queue and write the Inbound Post Queue.
-+** The Outbound Queue Port is used by external PCI agents to read the Outbound Post Queue and write the Outbound Free Queue.
-+** Note that a PCI transaction to the inbound or outbound queue ports with null byte enables (P_C/BE[3:0]#=1111 2 )
-+** does not cause the MU hardware to increment the queue pointers.
-+** This is treated as when the PCI transaction did not occur.
-+** The Inbound and Outbound Queue Ports never respond with P_ACK64# on the PCI interface.
-+** ======================================================================================
-+** Overview of Circular Queue Operation
-+** ======================================================================================
-+** . The data storage for the circular queues must be provided by the 80331 local memory.
-+** . The base address of the circular queues is contained in the Queue Base Address Register.
-+** Each entry in the queue is a 32-bit data value.
-+** . Each read from or write to the queue may access only one queue entry.
-+** . Multi-DWORD accesses to the circular queues are not allowed.
-+** Sub-DWORD accesses are promoted to DWORD accesses.
-+** . Each circular queue has a head pointer and a tail pointer.
-+** The pointers are offsets from the Queue Base Address.
-+** . Writes to a queue occur at the head of the queue and reads occur from the tail.
-+** The head and tail pointers are incremented by either the Intel XScale core or the Messaging Unit hardware.
-+** Which unit maintains the pointer is determined by the writer of the queue.
-+** More details about the pointers are given in the queue descriptions below.
-+** The pointers are incremented after the queue access.
-+** Both pointers wrap around to the first address of the circular queue when they reach the circular queue size.
-+**
-+** Messaging Unit...
-+**
-+** The Messaging Unit generates an interrupt to the Intel XScale core or generate a PCI interrupt under certain conditions.
-+** . In general, when a Post queue is written, an interrupt is generated to notify the receiver that a message was posted.
-+** The size of each circular queue can range from 4K entries (16 Kbytes) to 64K entries (256 Kbytes).
-+** . All four queues must be the same size and may be contiguous.
-+** Therefore, the total amount of local memory needed by the circular queues ranges from 64 Kbytes to 1 Mbytes.
-+** The Queue size is determined by the Queue Size field in the MU Configuration Register.
-+** . There is one base address for all four queues.
-+** It is stored in the Queue Base Address Register (QBAR).
-+** The starting addresses of each queue is based on the Queue Base Address and the Queue Size field.
-+** here shows an example of how the circular queues should be set up based on the
-+** Intelligent I/O (I 2 O) Architecture Specification.
-+** Other ordering of the circular queues is possible.
-+**
-+** Queue Starting Address
-+** Inbound Free Queue QBAR
-+** Inbound Post Queue QBAR + Queue Size
-+** Outbound Post Queue QBAR + 2 * Queue Size
-+** Outbound Free Queue QBAR + 3 * Queue Size
-+** ===================================================================================
-+** Inbound Post Queue
-+** ------------------
-+** The Inbound Post Queue holds posted messages placed there by other processors for the Intel XScale core to process.
-+** This queue is read from the queue tail by the Intel XScale core. It is written to the queue head by external PCI agents.
-+** The tail pointer is maintained by the Intel XScale core. The head pointer is maintained by the MU hardware.
-+** For a PCI write transaction that accesses the Inbound Queue Port, the MU writes the data to the local memory location address in the Inbound Post Head Pointer Register.
-+** When the data written to the Inbound Queue Port is written to local memory, the MU hardware increments the Inbound Post Head Pointer Register.
-+** An Intel XScale core interrupt may be generated when the Inbound Post Queue is written.
-+** The Inbound Post Queue Interrupt bit in the Inbound Interrupt Status Register indicates the interrupt status.
-+** The interrupt is cleared when the Inbound Post Queue Interrupt bit is cleared.
-+** The interrupt can be masked by the Inbound Interrupt Mask Register.
-+** Software must be aware of the state of the Inbound Post Queue Interrupt Mask bit to guarantee that the full condition is recognized by the core processor.
-+** In addition, to guarantee that the queue does not get overwritten, software must process messages from the tail of the queue before incrementing the tail pointer and clearing this interrupt.
-+** Once cleared, an interrupt is NOT generated when the head and tail pointers remain unequal (i.e. queue status is Not Empty).
-+** Only a new message posting the in the inbound queue generates a new interrupt.
-+** Therefore, when software leaves any unprocessed messages in the post queue when the interrupt is cleared, software must retain the information that the Inbound Post queue status.
-+** From the time that the PCI write transaction is received until the data is written in local memory and the Inbound Post Head Pointer Register is incremented, any PCI transaction that attempts to access the Inbound Post Queue Port is signalled a Retry.
-+** The Intel XScale core may read messages from the Inbound Post Queue by reading the data from the local memory location pointed to by the Inbound Post Tail Pointer Register.
-+** The Intel XScale core must then increment the Inbound Post Tail Pointer Register.
-+** When the Inbound Post Queue is full (head and tail pointers are equal and the head pointer was last updated by hardware), the hardware retries any PCI writes until a slot in the queue becomes available.
-+** A slot in the post queue becomes available by the Intel XScale core incrementing the tail pointer.
-+** ===================================================================================
-+** Inbound Free Queue
-+** ------------------
-+** The Inbound Free Queue holds free inbound messages placed there by the Intel XScale core for other processors to use.
-+** This queue is read from the queue tail by external PCI agents.
-+** It is written to the queue head by the Intel XScale core.
-+** The tail pointer is maintained by the MU hardware.
-+** The head pointer is maintained by the Intel XScale core.
-+** For a PCI read transaction that accesses the Inbound Queue Port,
-+** the MU attempts to read the data at the local memory address in the Inbound Free Tail Pointer.
-+** When the queue is not empty (head and tail pointers are not equal) or full (head and tail pointers are equal but the head pointer was last written by software), the data is returned.
-+** When the queue is empty (head and tail pointers are equal and the head pointer was last updated by hardware), the value of -1 (FFFF.FFFFH) is returned.
-+** When the queue was not empty and the MU succeeded in returning the data at the tail,
-+** the MU hardware must increment the value in the Inbound Free Tail Pointer Register.
-+** To reduce latency for the PCI read access, the MU implements a prefetch mechanism to anticipate accesses to the Inbound Free Queue.
-+** The MU hardware prefetches the data at the tail of the Inbound Free Queue and load it into an internal prefetch register.
-+** When the PCI read access occurs, the data is read directly from the prefetch register.
-+** The prefetch mechanism loads a value of -1 (FFFF.FFFFH) into the prefetch register
-+** when the head and tail pointers are equal and the queue is empty.
-+** In order to update the prefetch register when messages are added to the queue and it becomes non-empty,
-+** the prefetch mechanism automatically starts a prefetch when the prefetch register contains FFFF.FFFFH and the Inbound Free Head Pointer Register is written.
-+** The Intel XScale core needs to update the Inbound Free Head Pointer Register when it adds messages to the queue.
-+** A prefetch must appear atomic from the perspective of the external PCI agent.
-+** When a prefetch is started, any PCI transaction that attempts to access the Inbound Free Queue is signalled a Retry until the prefetch is completed.
-+** The Intel XScale core may place messages in the Inbound Free Queue by writing the data to the
-+** local memory location pointed to by the Inbound Free Head Pointer Register.
-+** The processor must then increment the Inbound Free Head Pointer Register.
-+** ==================================================================================
-+** Outbound Post Queue
-+** -------------------
-+** The Outbound Post Queue holds outbound posted messages placed there by the Intel XScale
-+** core for other processors to process. This queue is read from the queue tail by external PCI agents.
-+** It is written to the queue head by the Intel XScale core. The tail pointer is maintained by the
-+** MU hardware. The head pointer is maintained by the Intel XScale core.
-+** For a PCI read transaction that accesses the Outbound Queue Port, the MU attempts to read the
-+** data at the local memory address in the Outbound Post Tail Pointer Register. When the queue is not
-+** empty (head and tail pointers are not equal) or full (head and tail pointers are equal but the head
-+** pointer was last written by software), the data is returned. When the queue is empty (head and tail
-+** pointers are equal and the head pointer was last updated by hardware), the value of -1
-+** (FFFF.FFFFH) is returned. When the queue was not empty and the MU succeeded in returning the
-+** data at the tail, the MU hardware must increment the value in the Outbound Post Tail Pointer
-+** Register.
-+** To reduce latency for the PCI read access, the MU implements a prefetch mechanism to anticipate
-+** accesses to the Outbound Post Queue. The MU hardware prefetches the data at the tail of the
-+** Outbound Post Queue and load it into an internal prefetch register. When the PCI read access
-+** occurs, the data is read directly from the prefetch register.
-+** The prefetch mechanism loads a value of -1 (FFFF.FFFFH) into the prefetch register when the head
-+** and tail pointers are equal and the queue is empty. In order to update the prefetch register when
-+** messages are added to the queue and it becomes non-empty, the prefetch mechanism automatically
-+** starts a prefetch when the prefetch register contains FFFF.FFFFH and the Outbound Post Head
-+** Pointer Register is written. The Intel XScale core needs to update the Outbound Post Head
-+** Pointer Register when it adds messages to the queue.
-+** A prefetch must appear atomic from the perspective of the external PCI agent. When a prefetch is
-+** started, any PCI transaction that attempts to access the Outbound Post Queue is signalled a Retry
-+** until the prefetch is completed.
-+** A PCI interrupt may be generated when data in the prefetch buffer is valid. When the prefetch
-+** queue is clear, no interrupt is generated. The Outbound Post Queue Interrupt bit in the Outbound
-+** Interrupt Status Register shall indicate the status of the prefetch buffer data and therefore the
-+** interrupt status. The interrupt is cleared when any prefetched data has been read from the Outbound
-+** Queue Port. The interrupt can be masked by the Outbound Interrupt Mask Register.
-+** The Intel XScale core may place messages in the Outbound Post Queue by writing the data to
-+** the local memory address in the Outbound Post Head Pointer Register. The processor must then
-+** increment the Outbound Post Head Pointer Register.
-+** ==================================================
-+** Outbound Free Queue
-+** -----------------------
-+** The Outbound Free Queue holds free messages placed there by other processors for the Intel
-+** XScale core to use. This queue is read from the queue tail by the Intel XScale core. It is
-+** written to the queue head by external PCI agents. The tail pointer is maintained by the Intel
-+** XScale core. The head pointer is maintained by the MU hardware.
-+** For a PCI write transaction that accesses the Outbound Queue Port, the MU writes the data to the
-+** local memory address in the Outbound Free Head Pointer Register. When the data written to the
-+** Outbound Queue Port is written to local memory, the MU hardware increments the Outbound Free
-+** Head Pointer Register.
-+** When the head pointer and the tail pointer become equal and the queue is full, the MU may signal
-+** an interrupt to the Intel XScale core to register the queue full condition. This interrupt is
-+** recorded in the Inbound Interrupt Status Register. The interrupt is cleared when the Outbound Free
-+** Queue Full Interrupt bit is cleared and not by writing to the head or tail pointers. The interrupt can
-+** be masked by the Inbound Interrupt Mask Register. Software must be aware of the state of the
-+** Outbound Free Queue Interrupt Mask bit to guarantee that the full condition is recognized by the
-+** core processor.
-+** From the time that a PCI write transaction is received until the data is written in local memory and
-+** the Outbound Free Head Pointer Register is incremented, any PCI transaction that attempts to
-+** access the Outbound Free Queue Port is signalled a retry.
-+** The Intel XScale core may read messages from the Outbound Free Queue by reading the data
-+** from the local memory address in the Outbound Free Tail Pointer Register. The processor must
-+** then increment the Outbound Free Tail Pointer Register. When the Outbound Free Queue is full,
-+** the hardware must retry any PCI writes until a slot in the queue becomes available.
-+**
-+** ==================================================================================
-+** Circular Queue Summary
-+** ----------------------
-+** ________________________________________________________________________________________________________________________________________________
-+** | Queue Name | PCI Port |Generate PCI Interrupt |Generate Intel Xscale Core Interrupt|Head Pointer maintained by|Tail Pointer maintained by|
-+** |_____________|_______________|_______________________|____________________________________|__________________________|__________________________|
-+** |Inbound Post | Inbound Queue | | | | |
-+** | Queue | Port | NO | Yes, when queue is written | MU hardware | Intel XScale |
-+** |_____________|_______________|_______________________|____________________________________|__________________________|__________________________|
-+** |Inbound Free | Inbound Queue | | | | |
-+** | Queue | Port | NO | NO | Intel XScale | MU hardware |
-+** |_____________|_______________|_______________________|____________________________________|__________________________|__________________________|
-+** ==================================================================================
-+** Circular Queue Status Summary
-+** ----------------------
-+** ____________________________________________________________________________________________________
-+** | Queue Name | Queue Status | Head & Tail Pointer | Last Pointer Update |
-+** |_____________________|________________|_____________________|_______________________________________|
-+** | Inbound Post Queue | Empty | Equal | Tail pointer last updated by software |
-+** |_____________________|________________|_____________________|_______________________________________|
-+** | Inbound Free Queue | Empty | Equal | Head pointer last updated by hardware |
-+** |_____________________|________________|_____________________|_______________________________________|
-+**************************************************************************
-+*/
-+
-+/*
-+**************************************************************************
-+** Index Registers
-+** ========================
-+** . The Index Registers are a set of 1004 registers that when written by an external PCI agent can generate an interrupt to the Intel XScale core.
-+** These registers are for inbound messages only.
-+** The interrupt is recorded in the Inbound Interrupt Status Register.
-+** The storage for the Index Registers is allocated from the 80331 local memory.
-+** PCI write accesses to the Index Registers write the data to local memory.
-+** PCI read accesses to the Index Registers read the data from local memory.
-+** . The local memory used for the Index Registers ranges from Inbound ATU Translate Value Register + 050H
-+** to Inbound ATU Translate Value Register + FFFH.
-+** . The address of the first write access is stored in the Index Address Register.
-+** This register is written during the earliest write access and provides a means to determine which Index Register was written.
-+** Once updated by the MU, the Index Address Register is not updated until the Index Register Interrupt bit in the Inbound Interrupt Status Register is cleared.
-+** . When the interrupt is cleared, the Index Address Register is re-enabled and stores the address of the next Index Register write access.
-+** Writes by the Intel XScale core to the local memory used by the Index Registers does not cause an interrupt and does not update the Index Address Register.
-+** . The index registers can be accessed with Multi-DWORD reads and single QWORD aligned writes.
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** Messaging Unit Internal Bus Memory Map
-+** =======================================
-+** Internal Bus Address___Register Description (Name)____________________|_PCI Configuration Space Register Number_
-+** FFFF E300H reserved |
-+** .. .. |
-+** FFFF E30CH reserved |
-+** FFFF E310H Inbound Message Register 0 | Available through
-+** FFFF E314H Inbound Message Register 1 | ATU Inbound Translation Window
-+** FFFF E318H Outbound Message Register 0 |
-+** FFFF E31CH Outbound Message Register 1 | or
-+** FFFF E320H Inbound Doorbell Register |
-+** FFFF E324H Inbound Interrupt Status Register | must translate PCI address to
-+** FFFF E328H Inbound Interrupt Mask Register | the Intel Xscale Core
-+** FFFF E32CH Outbound Doorbell Register | Memory-Mapped Address
-+** FFFF E330H Outbound Interrupt Status Register |
-+** FFFF E334H Outbound Interrupt Mask Register |
-+** ______________________________________________________________________|________________________________________
-+** FFFF E338H reserved |
-+** FFFF E33CH reserved |
-+** FFFF E340H reserved |
-+** FFFF E344H reserved |
-+** FFFF E348H reserved |
-+** FFFF E34CH reserved |
-+** FFFF E350H MU Configuration Register |
-+** FFFF E354H Queue Base Address Register |
-+** FFFF E358H reserved |
-+** FFFF E35CH reserved | must translate PCI address to
-+** FFFF E360H Inbound Free Head Pointer Register | the Intel Xscale Core
-+** FFFF E364H Inbound Free Tail Pointer Register | Memory-Mapped Address
-+** FFFF E368H Inbound Post Head pointer Register |
-+** FFFF E36CH Inbound Post Tail Pointer Register |
-+** FFFF E370H Outbound Free Head Pointer Register |
-+** FFFF E374H Outbound Free Tail Pointer Register |
-+** FFFF E378H Outbound Post Head pointer Register |
-+** FFFF E37CH Outbound Post Tail Pointer Register |
-+** FFFF E380H Index Address Register |
-+** FFFF E384H reserved |
-+** .. .. |
-+** FFFF E3FCH reserved |
-+** ______________________________________________________________________|_______________________________________
-+**************************************************************************
-+*/
-+/*
-+**************************************************************************
-+** MU Configuration Register - MUCR FFFF.E350H
-+**
-+** . The MU Configuration Register (MUCR) contains the Circular Queue Enable bit and the size of one Circular Queue.
-+** . The Circular Queue Enable bit enables or disables the Circular Queues.
-+** The Circular Queues are disabled at reset to allow the software to initialize the head and tail pointer registers before any PCI accesses to the Queue Ports.
-+** . Each Circular Queue may range from 4 K entries (16 Kbytes) to 64 K entries (256 Kbytes) and there are four Circular Queues.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:06 000000H 00 2 Reserved
-+** 05:01 00001 2 Circular Queue Size - This field determines the size of each Circular Queue.
-+** All four queues are the same size.
-+** ¡E 00001 2 - 4K Entries (16 Kbytes)
-+** ¡E 00010 2 - 8K Entries (32 Kbytes)
-+** ¡E 00100 2 - 16K Entries (64 Kbytes)
-+** ¡E 01000 2 - 32K Entries (128 Kbytes)
-+** ¡E 10000 2 - 64K Entries (256 Kbytes)
-+** 00 0 2 Circular Queue Enable - This bit enables or disables the Circular Queues. When clear the Circular
-+** Queues are disabled, however the MU accepts PCI accesses to the Circular Queue Ports but ignores
-+** the data for Writes and return FFFF.FFFFH for Reads. Interrupts are not generated to the core when
-+** disabled. When set, the Circular Queues are fully enabled.
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_CONFIGURATION_REG 0xFFFFE350
-+#define ARCMSR_MU_CIRCULAR_QUEUE_SIZE64K 0x0020
-+#define ARCMSR_MU_CIRCULAR_QUEUE_SIZE32K 0x0010
-+#define ARCMSR_MU_CIRCULAR_QUEUE_SIZE16K 0x0008
-+#define ARCMSR_MU_CIRCULAR_QUEUE_SIZE8K 0x0004
-+#define ARCMSR_MU_CIRCULAR_QUEUE_SIZE4K 0x0002
-+#define ARCMSR_MU_CIRCULAR_QUEUE_ENABLE 0x0001 /*0:disable 1:enable*/
-+/*
-+**************************************************************************
-+** Queue Base Address Register - QBAR
-+**
-+** . The Queue Base Address Register (QBAR) contains the local memory address of the Circular Queues.
-+** The base address is required to be located on a 1 Mbyte address boundary.
-+** . All Circular Queue head and tail pointers are based on the QBAR.
-+** When the head and tail pointer registers are read, the Queue Base Address is returned in the upper 12 bits.
-+** Writing to the upper 12 bits of the head and tail pointer registers does not affect the Queue Base Address or Queue Base Address Register.
-+** Warning:
-+** The QBAR must designate a range allocated to the 80331 DDR SDRAM interface
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 000H Queue Base Address - Local memory address of the circular queues.
-+** 19:00 00000H Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_QUEUE_BASE_ADDRESS_REG 0xFFFFE354
-+/*
-+**************************************************************************
-+** Inbound Free Head Pointer Register - IFHPR
-+**
-+** . The Inbound Free Head Pointer Register (IFHPR) contains the local memory offset from the Queue Base Address of the head pointer for the Inbound Free Queue.
-+** The Head Pointer must be aligned on a DWORD address boundary.
-+** When read, the Queue Base Address is provided in the upper 12 bits of the register.
-+** Writes to the upper 12 bits of the register are ignored.
-+** This register is maintained by software.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 000H Queue Base Address - Local memory address of the circular queues.
-+** 19:02 0000H 00 2 Inbound Free Head Pointer - Local memory offset of the head pointer for the Inbound Free Queue.
-+** 01:00 00 2 Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_FREE_HEAD_PTR_REG 0xFFFFE360
-+/*
-+**************************************************************************
-+** Inbound Free Tail Pointer Register - IFTPR
-+**
-+** . The Inbound Free Tail Pointer Register (IFTPR) contains the local memory offset from the Queue
-+** Base Address of the tail pointer for the Inbound Free Queue. The Tail Pointer must be aligned on a
-+** DWORD address boundary. When read, the Queue Base Address is provided in the upper 12 bits
-+** of the register. Writes to the upper 12 bits of the register are ignored.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 000H Queue Base Address - Local memory address of the circular queues.
-+** 19:02 0000H 00 2 Inbound Free Tail Pointer - Local memory offset of the tail pointer for the Inbound Free Queue.
-+** 01:00 00 2 Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_FREE_TAIL_PTR_REG 0xFFFFE364
-+/*
-+**************************************************************************
-+** Inbound Post Head Pointer Register - IPHPR
-+**
-+** . The Inbound Post Head Pointer Register (IPHPR) contains the local memory offset from the Queue
-+** Base Address of the head pointer for the Inbound Post Queue. The Head Pointer must be aligned on
-+** a DWORD address boundary. When read, the Queue Base Address is provided in the upper 12 bits
-+** of the register. Writes to the upper 12 bits of the register are ignored.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 000H Queue Base Address - Local memory address of the circular queues.
-+** 19:02 0000H 00 2 Inbound Post Head Pointer - Local memory offset of the head pointer for the Inbound Post Queue.
-+** 01:00 00 2 Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_POST_HEAD_PTR_REG 0xFFFFE368
-+/*
-+**************************************************************************
-+** Inbound Post Tail Pointer Register - IPTPR
-+**
-+** . The Inbound Post Tail Pointer Register (IPTPR) contains the local memory offset from the Queue
-+** Base Address of the tail pointer for the Inbound Post Queue. The Tail Pointer must be aligned on a
-+** DWORD address boundary. When read, the Queue Base Address is provided in the upper 12 bits
-+** of the register. Writes to the upper 12 bits of the register are ignored.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:20 000H Queue Base Address - Local memory address of the circular queues.
-+** 19:02 0000H 00 2 Inbound Post Tail Pointer - Local memory offset of the tail pointer for the Inbound Post Queue.
-+** 01:00 00 2 Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_INBOUND_POST_TAIL_PTR_REG 0xFFFFE36C
-+/*
-+**************************************************************************
-+** Index Address Register - IAR
-+**
-+** . The Index Address Register (IAR) contains the offset of the least recently accessed Index Register.
-+** It is written by the MU when the Index Registers are written by a PCI agent.
-+** The register is not updated until the Index Interrupt bit in the Inbound Interrupt Status Register is cleared.
-+** . The local memory address of the Index Register least recently accessed is computed by adding the Index Address Register to the Inbound ATU Translate Value Register.
-+** ------------------------------------------------------------------------
-+** Bit Default Description
-+** 31:12 000000H Reserved
-+** 11:02 00H 00 2 Index Address - is the local memory offset of the Index Register written (050H to FFCH)
-+** 01:00 00 2 Reserved
-+**************************************************************************
-+*/
-+#define ARCMSR_MU_LOCAL_MEMORY_INDEX_REG 0xFFFFE380 /*1004 dwords 0x0050....0x0FFC, 4016 bytes 0x0050...0x0FFF*/
-+/*
-+**********************************************************************************************************
-+** RS-232 Interface for Areca Raid Controller
-+** The low level command interface is exclusive with VT100 terminal
-+** --------------------------------------------------------------------
-+** 1. Sequence of command execution
-+** --------------------------------------------------------------------
-+** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61)
-+** (B) Command block : variable length of data including length, command code, data and checksum byte
-+** (C) Return data : variable length of data
-+** --------------------------------------------------------------------
-+** 2. Command block
-+** --------------------------------------------------------------------
-+** (A) 1st byte : command block length (low byte)
-+** (B) 2nd byte : command block length (high byte)
-+** note ..command block length shouldn't > 2040 bytes, length excludes these two bytes
-+** (C) 3rd byte : command code
-+** (D) 4th and following bytes : variable length data bytes depends on command code
-+** (E) last byte : checksum byte (sum of 1st byte until last data byte)
-+** --------------------------------------------------------------------
-+** 3. Command code and associated data
-+** --------------------------------------------------------------------
-+** The following are command code defined in raid controller Command code 0x10--0x1? are used for system level management, no password checking is needed and should be implemented in separate well controlled utility and not for end user access.
-+** Command code 0x20--0x?? always check the password, password must be entered to enable these command.
-+** enum
-+** {
-+** GUI_SET_SERIAL=0x10,
-+** GUI_SET_VENDOR,
-+** GUI_SET_MODEL,
-+** GUI_IDENTIFY,
-+** GUI_CHECK_PASSWORD,
-+** GUI_LOGOUT,
-+** GUI_HTTP,
-+** GUI_SET_ETHERNET_ADDR,
-+** GUI_SET_LOGO,
-+** GUI_POLL_EVENT,
-+** GUI_GET_EVENT,
-+** GUI_GET_HW_MONITOR,
-+**
-+** // GUI_QUICK_CREATE=0x20, (function removed)
-+** GUI_GET_INFO_R=0x20,
-+** GUI_GET_INFO_V,
-+** GUI_GET_INFO_P,
-+** GUI_GET_INFO_S,
-+** GUI_CLEAR_EVENT,
-+**
-+** GUI_MUTE_BEEPER=0x30,
-+** GUI_BEEPER_SETTING,
-+** GUI_SET_PASSWORD,
-+** GUI_HOST_INTERFACE_MODE,
-+** GUI_REBUILD_PRIORITY,
-+** GUI_MAX_ATA_MODE,
-+** GUI_RESET_CONTROLLER,
-+** GUI_COM_PORT_SETTING,
-+** GUI_NO_OPERATION,
-+** GUI_DHCP_IP,
-+**
-+** GUI_CREATE_PASS_THROUGH=0x40,
-+** GUI_MODIFY_PASS_THROUGH,
-+** GUI_DELETE_PASS_THROUGH,
-+** GUI_IDENTIFY_DEVICE,
-+**
-+** GUI_CREATE_RAIDSET=0x50,
-+** GUI_DELETE_RAIDSET,
-+** GUI_EXPAND_RAIDSET,
-+** GUI_ACTIVATE_RAIDSET,
-+** GUI_CREATE_HOT_SPARE,
-+** GUI_DELETE_HOT_SPARE,
-+**
-+** GUI_CREATE_VOLUME=0x60,
-+** GUI_MODIFY_VOLUME,
-+** GUI_DELETE_VOLUME,
-+** GUI_START_CHECK_VOLUME,
-+** GUI_STOP_CHECK_VOLUME
-+** };
-+**
-+** Command description :
-+**
-+** GUI_SET_SERIAL : Set the controller serial#
-+** byte 0,1 : length
-+** byte 2 : command code 0x10
-+** byte 3 : password length (should be 0x0f)
-+** byte 4-0x13 : should be "ArEcATecHnoLogY"
-+** byte 0x14--0x23 : Serial number string (must be 16 bytes)
-+** GUI_SET_VENDOR : Set vendor string for the controller
-+** byte 0,1 : length
-+** byte 2 : command code 0x11
-+** byte 3 : password length (should be 0x08)
-+** byte 4-0x13 : should be "ArEcAvAr"
-+** byte 0x14--0x3B : vendor string (must be 40 bytes)
-+** GUI_SET_MODEL : Set the model name of the controller
-+** byte 0,1 : length
-+** byte 2 : command code 0x12
-+** byte 3 : password length (should be 0x08)
-+** byte 4-0x13 : should be "ArEcAvAr"
-+** byte 0x14--0x1B : model string (must be 8 bytes)
-+** GUI_IDENTIFY : Identify device
-+** byte 0,1 : length
-+** byte 2 : command code 0x13
-+** return "Areca RAID Subsystem "
-+** GUI_CHECK_PASSWORD : Verify password
-+** byte 0,1 : length
-+** byte 2 : command code 0x14
-+** byte 3 : password length
-+** byte 4-0x?? : user password to be checked
-+** GUI_LOGOUT : Logout GUI (force password checking on next command)
-+** byte 0,1 : length
-+** byte 2 : command code 0x15
-+** GUI_HTTP : HTTP interface (reserved for Http proxy service)(0x16)
-+**
-+** GUI_SET_ETHERNET_ADDR : Set the ethernet MAC address
-+** byte 0,1 : length
-+** byte 2 : command code 0x17
-+** byte 3 : password length (should be 0x08)
-+** byte 4-0x13 : should be "ArEcAvAr"
-+** byte 0x14--0x19 : Ethernet MAC address (must be 6 bytes)
-+** GUI_SET_LOGO : Set logo in HTTP
-+** byte 0,1 : length
-+** byte 2 : command code 0x18
-+** byte 3 : Page# (0/1/2/3) (0xff --> clear OEM logo)
-+** byte 4/5/6/7 : 0x55/0xaa/0xa5/0x5a
-+** byte 8 : TITLE.JPG data (each page must be 2000 bytes)
-+** note .... page0 1st 2 byte must be actual length of the JPG file
-+** GUI_POLL_EVENT : Poll If Event Log Changed
-+** byte 0,1 : length
-+** byte 2 : command code 0x19
-+** GUI_GET_EVENT : Read Event
-+** byte 0,1 : length
-+** byte 2 : command code 0x1a
-+** byte 3 : Event Page (0:1st page/1/2/3:last page)
-+** GUI_GET_HW_MONITOR : Get HW monitor data
-+** byte 0,1 : length
-+** byte 2 : command code 0x1b
-+** byte 3 : # of FANs(example 2)
-+** byte 4 : # of Voltage sensor(example 3)
-+** byte 5 : # of temperature sensor(example 2)
-+** byte 6 : # of power
-+** byte 7/8 : Fan#0 (RPM)
-+** byte 9/10 : Fan#1
-+** byte 11/12 : Voltage#0 original value in *1000
-+** byte 13/14 : Voltage#0 value
-+** byte 15/16 : Voltage#1 org
-+** byte 17/18 : Voltage#1
-+** byte 19/20 : Voltage#2 org
-+** byte 21/22 : Voltage#2
-+** byte 23 : Temp#0
-+** byte 24 : Temp#1
-+** byte 25 : Power indicator (bit0 : power#0, bit1 : power#1)
-+** byte 26 : UPS indicator
-+** GUI_QUICK_CREATE : Quick create raid/volume set
-+** byte 0,1 : length
-+** byte 2 : command code 0x20
-+** byte 3/4/5/6 : raw capacity
-+** byte 7 : raid level
-+** byte 8 : stripe size
-+** byte 9 : spare
-+** byte 10/11/12/13: device mask (the devices to create raid/volume)
-+** This function is removed, application like to implement quick create function
-+** need to use GUI_CREATE_RAIDSET and GUI_CREATE_VOLUMESET function.
-+** GUI_GET_INFO_R : Get Raid Set Information
-+** byte 0,1 : length
-+** byte 2 : command code 0x20
-+** byte 3 : raidset#
-+**
-+** typedef struct sGUI_RAIDSET
-+** {
-+** BYTE grsRaidSetName[16];
-+** DWORD grsCapacity;
-+** DWORD grsCapacityX;
-+** DWORD grsFailMask;
-+** BYTE grsDevArray[32];
-+** BYTE grsMemberDevices;
-+** BYTE grsNewMemberDevices;
-+** BYTE grsRaidState;
-+** BYTE grsVolumes;
-+** BYTE grsVolumeList[16];
-+** BYTE grsRes1;
-+** BYTE grsRes2;
-+** BYTE grsRes3;
-+** BYTE grsFreeSegments;
-+** DWORD grsRawStripes[8];
-+** DWORD grsRes4;
-+** DWORD grsRes5; // Total to 128 bytes
-+** DWORD grsRes6; // Total to 128 bytes
-+** } sGUI_RAIDSET, *pGUI_RAIDSET;
-+** GUI_GET_INFO_V : Get Volume Set Information
-+** byte 0,1 : length
-+** byte 2 : command code 0x21
-+** byte 3 : volumeset#
-+**
-+** typedef struct sGUI_VOLUMESET
-+** {
-+** BYTE gvsVolumeName[16]; // 16
-+** DWORD gvsCapacity;
-+** DWORD gvsCapacityX;
-+** DWORD gvsFailMask;
-+** DWORD gvsStripeSize;
-+** DWORD gvsNewFailMask;
-+** DWORD gvsNewStripeSize;
-+** DWORD gvsVolumeStatus;
-+** DWORD gvsProgress; // 32
-+** sSCSI_ATTR gvsScsi;
-+** BYTE gvsMemberDisks;
-+** BYTE gvsRaidLevel; // 8
-+**
-+** BYTE gvsNewMemberDisks;
-+** BYTE gvsNewRaidLevel;
-+** BYTE gvsRaidSetNumber;
-+** BYTE gvsRes0; // 4
-+** BYTE gvsRes1[4]; // 64 bytes
-+** } sGUI_VOLUMESET, *pGUI_VOLUMESET;
-+**
-+** GUI_GET_INFO_P : Get Physical Drive Information
-+** byte 0,1 : length
-+** byte 2 : command code 0x22
-+** byte 3 : drive # (from 0 to max-channels - 1)
-+**
-+** typedef struct sGUI_PHY_DRV
-+** {
-+** BYTE gpdModelName[40];
-+** BYTE gpdSerialNumber[20];
-+** BYTE gpdFirmRev[8];
-+** DWORD gpdCapacity;
-+** DWORD gpdCapacityX; // Reserved for expansion
-+** BYTE gpdDeviceState;
-+** BYTE gpdPioMode;
-+** BYTE gpdCurrentUdmaMode;
-+** BYTE gpdUdmaMode;
-+** BYTE gpdDriveSelect;
-+** BYTE gpdRaidNumber; // 0xff if not belongs to a raid set
-+** sSCSI_ATTR gpdScsi;
-+** BYTE gpdReserved[40]; // Total to 128 bytes
-+** } sGUI_PHY_DRV, *pGUI_PHY_DRV;
-+**
-+** GUI_GET_INFO_S : Get System Information
-+** byte 0,1 : length
-+** byte 2 : command code 0x23
-+**
-+** typedef struct sCOM_ATTR
-+** {
-+** BYTE comBaudRate;
-+** BYTE comDataBits;
-+** BYTE comStopBits;
-+** BYTE comParity;
-+** BYTE comFlowControl;
-+** } sCOM_ATTR, *pCOM_ATTR;
-+**
-+** typedef struct sSYSTEM_INFO
-+** {
-+** BYTE gsiVendorName[40];
-+** BYTE gsiSerialNumber[16];
-+** BYTE gsiFirmVersion[16];
-+** BYTE gsiBootVersion[16];
-+** BYTE gsiMbVersion[16];
-+** BYTE gsiModelName[8];
-+** BYTE gsiLocalIp[4];
-+** BYTE gsiCurrentIp[4];
-+** DWORD gsiTimeTick;
-+** DWORD gsiCpuSpeed;
-+** DWORD gsiICache;
-+** DWORD gsiDCache;
-+** DWORD gsiScache;
-+** DWORD gsiMemorySize;
-+** DWORD gsiMemorySpeed;
-+** DWORD gsiEvents;
-+** BYTE gsiMacAddress[6];
-+** BYTE gsiDhcp;
-+** BYTE gsiBeeper;
-+** BYTE gsiChannelUsage;
-+** BYTE gsiMaxAtaMode;
-+** BYTE gsiSdramEcc; // 1:if ECC enabled
-+** BYTE gsiRebuildPriority;
-+** sCOM_ATTR gsiComA; // 5 bytes
-+** sCOM_ATTR gsiComB; // 5 bytes
-+** BYTE gsiIdeChannels;
-+** BYTE gsiScsiHostChannels;
-+** BYTE gsiIdeHostChannels;
-+** BYTE gsiMaxVolumeSet;
-+** BYTE gsiMaxRaidSet;
-+** BYTE gsiEtherPort; // 1:if ether net port supported
-+** BYTE gsiRaid6Engine; // 1:Raid6 engine supported
-+** BYTE gsiRes[75];
-+** } sSYSTEM_INFO, *pSYSTEM_INFO;
-+**
-+** GUI_CLEAR_EVENT : Clear System Event
-+** byte 0,1 : length
-+** byte 2 : command code 0x24
-+**
-+** GUI_MUTE_BEEPER : Mute current beeper
-+** byte 0,1 : length
-+** byte 2 : command code 0x30
-+**
-+** GUI_BEEPER_SETTING : Disable beeper
-+** byte 0,1 : length
-+** byte 2 : command code 0x31
-+** byte 3 : 0->disable, 1->enable
-+**
-+** GUI_SET_PASSWORD : Change password
-+** byte 0,1 : length
-+** byte 2 : command code 0x32
-+** byte 3 : pass word length ( must <= 15 )
-+** byte 4 : password (must be alpha-numerical)
-+**
-+** GUI_HOST_INTERFACE_MODE : Set host interface mode
-+** byte 0,1 : length
-+** byte 2 : command code 0x33
-+** byte 3 : 0->Independent, 1->cluster
-+**
-+** GUI_REBUILD_PRIORITY : Set rebuild priority
-+** byte 0,1 : length
-+** byte 2 : command code 0x34
-+** byte 3 : 0/1/2/3 (low->high)
-+**
-+** GUI_MAX_ATA_MODE : Set maximum ATA mode to be used
-+** byte 0,1 : length
-+** byte 2 : command code 0x35
-+** byte 3 : 0/1/2/3 (133/100/66/33)
-+**
-+** GUI_RESET_CONTROLLER : Reset Controller
-+** byte 0,1 : length
-+** byte 2 : command code 0x36
-+** *Response with VT100 screen (discard it)
-+**
-+** GUI_COM_PORT_SETTING : COM port setting
-+** byte 0,1 : length
-+** byte 2 : command code 0x37
-+** byte 3 : 0->COMA (term port), 1->COMB (debug port)
-+** byte 4 : 0/1/2/3/4/5/6/7 (1200/2400/4800/9600/19200/38400/57600/115200)
-+** byte 5 : data bit (0:7 bit, 1:8 bit : must be 8 bit)
-+** byte 6 : stop bit (0:1, 1:2 stop bits)
-+** byte 7 : parity (0:none, 1:off, 2:even)
-+** byte 8 : flow control (0:none, 1:xon/xoff, 2:hardware => must use none)
-+**
-+** GUI_NO_OPERATION : No operation
-+** byte 0,1 : length
-+** byte 2 : command code 0x38
-+**
-+** GUI_DHCP_IP : Set DHCP option and local IP address
-+** byte 0,1 : length
-+** byte 2 : command code 0x39
-+** byte 3 : 0:dhcp disabled, 1:dhcp enabled
-+** byte 4/5/6/7 : IP address
-+**
-+** GUI_CREATE_PASS_THROUGH : Create pass through disk
-+** byte 0,1 : length
-+** byte 2 : command code 0x40
-+** byte 3 : device #
-+** byte 4 : scsi channel (0/1)
-+** byte 5 : scsi id (0-->15)
-+** byte 6 : scsi lun (0-->7)
-+** byte 7 : tagged queue (1 : enabled)
-+** byte 8 : cache mode (1 : enabled)
-+** byte 9 : max speed (0/1/2/3/4, async/20/40/80/160 for scsi)
-+** (0/1/2/3/4, 33/66/100/133/150 for ide )
-+**
-+** GUI_MODIFY_PASS_THROUGH : Modify pass through disk
-+** byte 0,1 : length
-+** byte 2 : command code 0x41
-+** byte 3 : device #
-+** byte 4 : scsi channel (0/1)
-+** byte 5 : scsi id (0-->15)
-+** byte 6 : scsi lun (0-->7)
-+** byte 7 : tagged queue (1 : enabled)
-+** byte 8 : cache mode (1 : enabled)
-+** byte 9 : max speed (0/1/2/3/4, async/20/40/80/160 for scsi)
-+** (0/1/2/3/4, 33/66/100/133/150 for ide )
-+**
-+** GUI_DELETE_PASS_THROUGH : Delete pass through disk
-+** byte 0,1 : length
-+** byte 2 : command code 0x42
-+** byte 3 : device# to be deleted
-+**
-+** GUI_IDENTIFY_DEVICE : Identify Device
-+** byte 0,1 : length
-+** byte 2 : command code 0x43
-+** byte 3 : Flash Method(0:flash selected, 1:flash not selected)
-+** byte 4/5/6/7 : IDE device mask to be flashed
-+** note .... no response data available
-+**
-+** GUI_CREATE_RAIDSET : Create Raid Set
-+** byte 0,1 : length
-+** byte 2 : command code 0x50
-+** byte 3/4/5/6 : device mask
-+** byte 7-22 : raidset name (if byte 7 == 0:use default)
-+**
-+** GUI_DELETE_RAIDSET : Delete Raid Set
-+** byte 0,1 : length
-+** byte 2 : command code 0x51
-+** byte 3 : raidset#
-+**
-+** GUI_EXPAND_RAIDSET : Expand Raid Set
-+** byte 0,1 : length
-+** byte 2 : command code 0x52
-+** byte 3 : raidset#
-+** byte 4/5/6/7 : device mask for expansion
-+** byte 8/9/10 : (8:0 no change, 1 change, 0xff:terminate, 9:new raid level,10:new stripe size 0/1/2/3/4/5->4/8/16/32/64/128K )
-+** byte 11/12/13 : repeat for each volume in the raidset ....
-+**
-+** GUI_ACTIVATE_RAIDSET : Activate incomplete raid set
-+** byte 0,1 : length
-+** byte 2 : command code 0x53
-+** byte 3 : raidset#
-+**
-+** GUI_CREATE_HOT_SPARE : Create hot spare disk
-+** byte 0,1 : length
-+** byte 2 : command code 0x54
-+** byte 3/4/5/6 : device mask for hot spare creation
-+**
-+** GUI_DELETE_HOT_SPARE : Delete hot spare disk
-+** byte 0,1 : length
-+** byte 2 : command code 0x55
-+** byte 3/4/5/6 : device mask for hot spare deletion
-+**
-+** GUI_CREATE_VOLUME : Create volume set
-+** byte 0,1 : length
-+** byte 2 : command code 0x60
-+** byte 3 : raidset#
-+** byte 4-19 : volume set name (if byte4 == 0, use default)
-+** byte 20-27 : volume capacity (blocks)
-+** byte 28 : raid level
-+** byte 29 : stripe size (0/1/2/3/4/5->4/8/16/32/64/128K)
-+** byte 30 : channel
-+** byte 31 : ID
-+** byte 32 : LUN
-+** byte 33 : 1 enable tag
-+** byte 34 : 1 enable cache
-+** byte 35 : speed (0/1/2/3/4->async/20/40/80/160 for scsi)
-+** (0/1/2/3/4->33/66/100/133/150 for IDE )
-+** byte 36 : 1 to select quick init
-+**
-+** GUI_MODIFY_VOLUME : Modify volume Set
-+** byte 0,1 : length
-+** byte 2 : command code 0x61
-+** byte 3 : volumeset#
-+** byte 4-19 : new volume set name (if byte4 == 0, not change)
-+** byte 20-27 : new volume capacity (reserved)
-+** byte 28 : new raid level
-+** byte 29 : new stripe size (0/1/2/3/4/5->4/8/16/32/64/128K)
-+** byte 30 : new channel
-+** byte 31 : new ID
-+** byte 32 : new LUN
-+** byte 33 : 1 enable tag
-+** byte 34 : 1 enable cache
-+** byte 35 : speed (0/1/2/3/4->async/20/40/80/160 for scsi)
-+** (0/1/2/3/4->33/66/100/133/150 for IDE )
-+**
-+** GUI_DELETE_VOLUME : Delete volume set
-+** byte 0,1 : length
-+** byte 2 : command code 0x62
-+** byte 3 : volumeset#
-+**
-+** GUI_START_CHECK_VOLUME : Start volume consistency check
-+** byte 0,1 : length
-+** byte 2 : command code 0x63
-+** byte 3 : volumeset#
-+**
-+** GUI_STOP_CHECK_VOLUME : Stop volume consistency check
-+** byte 0,1 : length
-+** byte 2 : command code 0x64
-+** ---------------------------------------------------------------------
-+** 4. Returned data
-+** ---------------------------------------------------------------------
-+** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61)
-+** (B) Length : 2 bytes (low byte 1st, excludes length and checksum byte)
-+** (C) status or data :
-+** <1> If length == 1 ==> 1 byte status code
-+** #define GUI_OK 0x41
-+** #define GUI_RAIDSET_NOT_NORMAL 0x42
-+** #define GUI_VOLUMESET_NOT_NORMAL 0x43
-+** #define GUI_NO_RAIDSET 0x44
-+** #define GUI_NO_VOLUMESET 0x45
-+** #define GUI_NO_PHYSICAL_DRIVE 0x46
-+** #define GUI_PARAMETER_ERROR 0x47
-+** #define GUI_UNSUPPORTED_COMMAND 0x48
-+** #define GUI_DISK_CONFIG_CHANGED 0x49
-+** #define GUI_INVALID_PASSWORD 0x4a
-+** #define GUI_NO_DISK_SPACE 0x4b
-+** #define GUI_CHECKSUM_ERROR 0x4c
-+** #define GUI_PASSWORD_REQUIRED 0x4d
-+** <2> If length > 1 ==> data block returned from controller and the contents depends on the command code
-+** (E) Checksum : checksum of length and status or data byte
-+**************************************************************************
-+*/
-+extern int arcmsr_release(struct Scsi_Host *);
-+extern int arcmsr_queue_command(struct scsi_cmnd *cmd,void (* done)(struct scsi_cmnd *cmd));
-+extern int arcmsr_cmd_abort(struct scsi_cmnd *cmd);
-+extern int arcmsr_bus_reset(struct scsi_cmnd *cmd);
-+extern int arcmsr_ioctl(struct scsi_device *dev,int ioctl_cmd,void *arg);
-+extern const char *arcmsr_info(struct Scsi_Host *);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-+ #define arcmsr_detect NULL
-+ extern int arcmsr_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout);
-+ extern int arcmsr_bios_param(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *info);
-+
-+ static ssize_t arcmsr_show_firmware_info(struct class_device *dev, char *buf)
-+ {
-+ struct Scsi_Host *host=class_to_shost(dev);
-+ struct _ACB *pACB=(struct _ACB *) host->hostdata;
-+ unsigned long flags=0;
-+ ssize_t len;
-+
-+ spin_lock_irqsave(pACB->host->host_lock, flags);
-+ len=snprintf(buf, PAGE_SIZE,
-+ "=================================\n"
-+ "Firmware Version: %s\n"
-+ "%s"
-+ "Adapter Model: %s\n"
-+ "Reguest Lenth: %4d\n"
-+ "Numbers of Queue: %4d\n"
-+ "SDRAM Size: %4d\n"
-+ "IDE Channels: %4d\n"
-+ "=================================\n",
-+ pACB->firm_version,
-+ (strncmp(pACB->firm_version,"V1.37",5) < 0) ? " PLEASE UPDATE RAID FIRMWARE VERSION EQUAL OR MORE THAN 'V1.37'\n" : "",
-+ pACB->firm_model,
-+ pACB->firm_request_len,
-+ pACB->firm_numbers_queue,
-+ pACB->firm_sdram_size,
-+ pACB->firm_ide_channels);
-+ spin_unlock_irqrestore(pACB->host->host_lock, flags);
-+ return len;
-+ }
-+ static ssize_t arcmsr_show_driver_state(struct class_device *dev, char *buf)
-+ {
-+ struct Scsi_Host *host=class_to_shost(dev);
-+ struct _ACB *pACB=(struct _ACB *)host->hostdata;
-+ unsigned long flags=0;
-+ ssize_t len;
-+
-+ spin_lock_irqsave(pACB->host->host_lock, flags);
-+ len=snprintf(buf, PAGE_SIZE,
-+ "=================================\n"
-+ "ARCMSR: %s\n"
-+ "Current commands posted: %4d\n"
-+ "Max commands posted: %4d\n"
-+ "Current pending commands: %4d\n"
-+ "Max pending commands: %4d\n"
-+ "Max sgl length: %4d\n"
-+ "Max sector count: %4d\n"
-+ "SCSI Host Resets: %4d\n"
-+ "SCSI Aborts/Timeouts: %4d\n"
-+ "=================================\n",
-+ ARCMSR_DRIVER_VERSION,
-+ atomic_read(&pACB->ccboutstandingcount),
-+ ARCMSR_MAX_OUTSTANDING_CMD,
-+ atomic_read(&pACB->ccbwait2gocount),
-+ ARCMSR_MAX_FREECCB_NUM-ARCMSR_MAX_OUTSTANDING_CMD,
-+ ARCMSR_MAX_SG_ENTRIES,
-+ ARCMSR_MAX_XFER_SECTORS,
-+ pACB->num_resets,
-+ pACB->num_aborts);
-+ spin_unlock_irqrestore(pACB->host->host_lock, flags);
-+ return len;
-+ }
-+ static struct class_device_attribute arcmsr_firmware_info_attr=
-+ {
-+ .attr={
-+ .name="firmware_info",
-+ .mode=S_IRUGO,
-+ },
-+ .show =arcmsr_show_firmware_info,
-+ };
-+ static struct class_device_attribute arcmsr_driver_state_attr=
-+ {
-+ .attr={
-+ .name="driver_state",
-+ .mode=S_IRUGO,
-+ },
-+ .show=arcmsr_show_driver_state
-+ };
-+ static struct class_device_attribute *arcmsr_scsi_host_attr[]=
-+ {
-+ &arcmsr_firmware_info_attr,
-+ &arcmsr_driver_state_attr,
-+ NULL
-+ };
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
-+ static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,int queue_depth)
-+ {
-+ if(queue_depth > ARCMSR_MAX_CMD_PERLUN)
-+ {
-+ queue_depth=ARCMSR_MAX_CMD_PERLUN;
-+ }
-+ scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
-+ return queue_depth;
-+ }
-+ #else
-+ static ssize_t arcmsr_adjust_disk_queue_depth(struct device *dev, const char *buf, size_t count)
-+ {
-+ int queue_depth;
-+ struct scsi_device *sdev = to_scsi_device(dev);
-+
-+ queue_depth = simple_strtoul(buf, NULL, 0);
-+ if(queue_depth > ARCMSR_MAX_CMD_PERLUN)
-+ return -EINVAL;
-+ scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
-+ return count;
-+ }
-+ static struct device_attribute arcmsr_queue_depth_attr =
-+ {
-+ .attr = {
-+ .name = "queue_depth",
-+ .mode = S_IRUSR | S_IWUSR,
-+ },
-+ .store = arcmsr_adjust_disk_queue_depth
-+ };
-+ static struct device_attribute *arcmsr_scsi_device_attr[] =
-+ {
-+ &arcmsr_queue_depth_attr,
-+ NULL,
-+ };
-+ #endif
-+ static struct scsi_host_template arcmsr_scsi_host_template = {
-+ .module = THIS_MODULE,
-+ .proc_name = "arcmsr",
-+ .proc_info = arcmsr_proc_info,
-+ .name = "ARCMSR ARECA SATA RAID HOST Adapter" ARCMSR_DRIVER_VERSION, /* *name */
-+ .release = arcmsr_release,
-+ .info = arcmsr_info,
-+ .ioctl = arcmsr_ioctl,
-+ .queuecommand = arcmsr_queue_command,
-+ .eh_strategy_handler = NULL,
-+ .eh_abort_handler = arcmsr_cmd_abort,
-+ .eh_device_reset_handler= NULL,
-+ .eh_bus_reset_handler = arcmsr_bus_reset,
-+ .eh_host_reset_handler = NULL,
-+ .bios_param = arcmsr_bios_param,
-+ .can_queue = ARCMSR_MAX_OUTSTANDING_CMD,
-+ .this_id = ARCMSR_SCSI_INITIATOR_ID,
-+ .sg_tablesize = ARCMSR_MAX_SG_ENTRIES,
-+ .max_sectors = ARCMSR_MAX_XFER_SECTORS,
-+ .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN,
-+ .unchecked_isa_dma = 0,
-+ .use_clustering = ENABLE_CLUSTERING,
-+ .shost_attrs = arcmsr_scsi_host_attr,
-+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
-+ .change_queue_depth =arcmsr_adjust_disk_queue_depth,
-+ #else
-+ .sdev_attrs = arcmsr_scsi_device_attr,
-+ #endif
-+ };
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-+ extern int arcmsr_detect(Scsi_Host_Template *);
-+ extern int arcmsr_schedule_command(struct scsi_cmnd * pcmd);
-+ extern int arcmsr_proc_info(char * buffer,char ** start,off_t offset,int length,int hostno,int inout);
-+ extern int arcmsr_bios_param(Disk *, kdev_t , int []);
-+
-+ static Scsi_Host_Template driver_template = {
-+ .proc_name = "arcmsr",
-+ .proc_info = arcmsr_proc_info,
-+ .name = "ARCMSR ARECA SATA RAID HOST Adapter" ARCMSR_DRIVER_VERSION, /* *name */
-+ .detect = arcmsr_detect,
-+ .release = arcmsr_release,
-+ .info = arcmsr_info,
-+ .ioctl = arcmsr_ioctl,
-+ .command = arcmsr_schedule_command,
-+ .queuecommand = arcmsr_queue_command,
-+ .eh_strategy_handler = NULL,
-+ .eh_abort_handler = arcmsr_cmd_abort,
-+ .eh_device_reset_handler= NULL,
-+ .eh_bus_reset_handler = arcmsr_bus_reset,
-+ .eh_host_reset_handler = NULL,
-+ .bios_param = arcmsr_bios_param,
-+ .can_queue = ARCMSR_MAX_OUTSTANDING_CMD,
-+ .this_id = ARCMSR_SCSI_INITIATOR_ID,
-+ .sg_tablesize = ARCMSR_MAX_SG_ENTRIES,
-+ .max_sectors = ARCMSR_MAX_XFER_SECTORS,
-+ .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN,
-+ .unchecked_isa_dma = 0,
-+ .use_clustering = DISABLE_CLUSTERING,
-+ };
-+ #include "/usr/src/linux/drivers/scsi/scsi_module.c"
-+#else /* KERNEL_VERSION(2,2,xx) */
-+ extern int arcmsr_detect(Scsi_Host_Template *);
-+ extern int arcmsr_schedule_command(struct scsi_cmnd * pcmd);
-+ extern int arcmsr_proc_info(char * buffer,char ** start,off_t offset,int length,int hostno,int inout);
-+ extern int arcmsr_bios_param(Disk *, kdev_t , int []);
-+
-+ #define ARCMSR { \
-+ proc_dir: NULL, \
-+ proc_info: arcmsr_proc_info, \
-+ name: "ARCMSR ARECA SATA RAID HOST Adapter" ARCMSR_DRIVER_VERSION, /* *name */ \
-+ detect: arcmsr_detect, \
-+ release: arcmsr_release, \
-+ info: arcmsr_info, \
-+ ioctl: arcmsr_ioctl, \
-+ command: arcmsr_schedule_command, \
-+ queuecommand: arcmsr_queue_command, \
-+ eh_strategy_handler: NULL, \
-+ eh_abort_handler: arcmsr_cmd_abort, \
-+ eh_device_reset_handler: NULL, \
-+ eh_bus_reset_handler: arcmsr_bus_reset, \
-+ eh_host_reset_handler: NULL, \
-+ abort: NULL, \
-+ reset: NULL, \
-+ slave_attach: NULL, \
-+ bios_param: arcmsr_bios_param, \
-+ can_queue: ARCMSR_MAX_OUTSTANDING_CMD,\
-+ this_id: ARCMSR_SCSI_INITIATOR_ID, \
-+ sg_tablesize: ARCMSR_MAX_SG_ENTRIES, \
-+ cmd_per_lun: ARCMSR_MAX_CMD_PERLUN, \
-+ use_new_eh_code: 1, \
-+ unchecked_isa_dma: 0, \
-+ use_clustering: DISABLE_CLUSTERING \
-+ }
-+ #ifdef MODULE
-+ /* Eventually this will go into an include file, but this will be later */
-+ Scsi_Host_Template driver_template = ARCMSR;
-+ #include "scsi_module.c"
-+ #endif
-+#endif
diff --git a/openvz-sources/023.030/5131_linux-2.6.9-dell_rbu-0.9.patch b/openvz-sources/023.030/5131_linux-2.6.9-dell_rbu-0.9.patch
deleted file mode 100644
index 7cb8ef7..0000000
--- a/openvz-sources/023.030/5131_linux-2.6.9-dell_rbu-0.9.patch
+++ /dev/null
@@ -1,213 +0,0 @@
---- ./drivers/firmware/dell_rbu.c.rbu 2006-08-23 11:10:22.000000000 +0400
-+++ ./drivers/firmware/dell_rbu.c 2006-09-08 13:59:32.000000000 +0400
-@@ -48,7 +48,12 @@
- MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>");
- MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems");
- MODULE_LICENSE("GPL");
--MODULE_VERSION("0.7");
-+MODULE_VERSION("0.9");
-+
-+static unsigned long allocation_floor = 0x100000;
-+module_param(allocation_floor, ulong, 0644);
-+MODULE_PARM_DESC(allocation_floor,
-+ "Minimum address for allocations when using Packet mode");
-
- static struct _rbu_data {
- void *image_update_buffer;
-@@ -56,7 +61,6 @@ static struct _rbu_data {
- unsigned long bios_image_size;
- unsigned long image_update_order_number;
- spinlock_t lock;
-- unsigned long packet_read_count;
- unsigned long packet_write_count;
- unsigned long num_packets;
- unsigned long packetsize;
-@@ -89,7 +93,6 @@ static void init_packet_head(void)
- {
- INIT_LIST_HEAD(&packet_data_head.list);
- rbu_data.packet_write_count = 0;
-- rbu_data.packet_read_count = 0;
- rbu_data.num_packets = 0;
- rbu_data.packetsize = 0;
- }
-@@ -200,33 +203,92 @@ static int create_packet(size_t length)
- {
- struct packet_data *newpacket;
- int ordernum = 0;
-+ int retval = 0;
-+ unsigned int packet_array_size = 0;
-+ void **invalid_addr_packet_array = 0;
-+ void *packet_data_temp_buf = 0;
-+ unsigned int idx = 0;
-
- pr_debug("create_packet: entry \n");
-
- if (rbu_data.packetsize == 0 ) {
- pr_debug("create_packet: packetsize not specified\n");
-- return -EINVAL;
-+ retval = -EINVAL;
-+ goto out_noalloc;
- }
-+
-+ spin_unlock(&rbu_data.lock);
-
- newpacket = kmalloc(sizeof(struct packet_data) ,GFP_KERNEL);
- if(newpacket == NULL) {
- printk(KERN_WARNING "create_packet: failed to allocate new "
- "packet\n");
-- return -ENOMEM;
-+ retval = -ENOMEM;
-+ spin_lock(&rbu_data.lock);
-+ goto out_noalloc;
- }
-
-- /* there is no upper limit on memory address for packetized mechanism*/
-- newpacket->data = get_free_pages_limited(rbu_data.packetsize,
-- &ordernum, 0);
-- pr_debug("create_packet: newpacket %p\n", newpacket->data);
--
-- if(newpacket->data == NULL) {
-- printk(KERN_WARNING "create_packet: failed to allocate new "
-- "packet\n");
-- kfree(newpacket);
-- return -ENOMEM;
-+ ordernum = get_order(rbu_data.packetsize);
-+
-+ /*
-+ * BIOS errata mean we cannot allocate packets below 1MB or they will
-+ * be overwritten by BIOS.
-+ *
-+ * array to temporarily hold packets
-+ * that are below the allocation floor
-+ *
-+ * NOTE: very simplistic because we only need the floor to be at 1MB
-+ * due to BIOS errata. This shouldn't be used for higher floors
-+ * or you will run out of mem trying to allocate the array.
-+ */
-+ packet_array_size = max(
-+ (unsigned int)(allocation_floor / rbu_data.packetsize),
-+ (unsigned int)1);
-+ invalid_addr_packet_array = kmalloc(packet_array_size * sizeof(void*),
-+ GFP_KERNEL);
-+
-+ if (!invalid_addr_packet_array) {
-+ printk(KERN_WARNING
-+ "dell_rbu:%s: failed to allocate "
-+ "invalid_addr_packet_array \n",
-+ __FUNCTION__);
-+ retval = -ENOMEM;
-+ spin_lock(&rbu_data.lock);
-+ goto out_alloc_packet;
- }
-
-+ while (!packet_data_temp_buf)
-+ {
-+ packet_data_temp_buf = (unsigned char *)
-+ __get_free_pages(GFP_KERNEL, ordernum);
-+ if (!packet_data_temp_buf)
-+ {
-+ printk(KERN_WARNING
-+ "dell_rbu:%s: failed to allocate new "
-+ "packet\n", __FUNCTION__);
-+ retval = -ENOMEM;
-+ spin_lock(&rbu_data.lock);
-+ goto out_alloc_packet_array;
-+ }
-+
-+ if ((unsigned long)virt_to_phys(packet_data_temp_buf)
-+ < allocation_floor)
-+ {
-+ pr_debug("packet 0x%lx below floor at 0x%lx.\n",
-+ (unsigned long)virt_to_phys(
-+ packet_data_temp_buf),
-+ allocation_floor);
-+ invalid_addr_packet_array[idx++] = packet_data_temp_buf;
-+ packet_data_temp_buf = 0;
-+ }
-+ }
-+ spin_lock(&rbu_data.lock);
-+
-+ newpacket->data = packet_data_temp_buf;
-+
-+ pr_debug("create_packet: newpacket at physical addr %lx\n",
-+ (unsigned long)virt_to_phys(newpacket->data));
-+
- newpacket->ordernum = ordernum;
- ++rbu_data.num_packets;
- /* initialize the newly created packet headers */
-@@ -237,7 +299,25 @@ static int create_packet(size_t length)
-
- pr_debug("create_packet: exit \n");
-
-- return 0;
-+out_alloc_packet_array:
-+ /* always free packet array */
-+ for (;idx>0;idx--)
-+ {
-+ pr_debug("freeing unused packet below floor 0x%lx.",
-+ (unsigned long)virt_to_phys(
-+ invalid_addr_packet_array[idx-1]));
-+ free_pages((unsigned long)invalid_addr_packet_array[idx-1],
-+ ordernum);
-+ }
-+ kfree(invalid_addr_packet_array);
-+
-+out_alloc_packet:
-+ /* if error, free data */
-+ if (retval)
-+ kfree(newpacket);
-+
-+out_noalloc:
-+ return retval;
- }
-
-
-@@ -311,7 +391,7 @@ int do_packet_read(char *data,
- *pread_length: is the length of the incoming buffer. At return
- this value is adjusted to the actual size of the data read.
- */
--static int packet_read_list(char *data, size_t *pread_length)
-+static int packet_read_list(char *data, size_t *pread_length, loff_t pos)
- {
- struct list_head *ptemp_list;
- int temp_count = 0;
-@@ -325,7 +405,7 @@ static int packet_read_list(char *data,
- return -ENOMEM;
-
- remaining_bytes = *pread_length;
-- bytes_read = rbu_data.packet_read_count;
-+ bytes_read = pos;
-
- ptemp_list = (&packet_data_head.list)->next;
- while(!list_empty(ptemp_list)) {
-@@ -344,8 +424,7 @@ static int packet_read_list(char *data,
- ptemp_list = ptemp_list->next;
- }
- /*finally set the bytes read */
-- *pread_length = bytes_read - rbu_data.packet_read_count;
-- rbu_data.packet_read_count = bytes_read;
-+ *pread_length = bytes_read - pos;
- return 0;
- }
-
-@@ -370,7 +449,6 @@ static void packet_empty_list(void)
- kfree(newpacket);
- }
- rbu_data.packet_write_count = 0;
-- rbu_data.packet_read_count = 0;
- rbu_data.num_packets = 0;
- }
-
-@@ -713,11 +791,10 @@ static ssize_t read_rbu_packet_data(stru
- bytes_left = imagesize - pos;
- data_length = min(bytes_left, count);
-
-- if ((retval = packet_read_list(ptempBuf, &data_length)) < 0)
-+ if ((retval = packet_read_list(ptempBuf, &data_length, pos)) < 0)
- goto read_rbu_data_exit;
-
- if ((pos + count) > imagesize) {
-- rbu_data.packet_read_count = 0;
- /* this was the last copy */
- retval = bytes_left;
- }
diff --git a/openvz-sources/023.030/5132_linux-2.6.9-aoe-14.patch b/openvz-sources/023.030/5132_linux-2.6.9-aoe-14.patch
deleted file mode 100644
index 67185c0..0000000
--- a/openvz-sources/023.030/5132_linux-2.6.9-aoe-14.patch
+++ /dev/null
@@ -1,2296 +0,0 @@
-diff -Nurap ./Documentation/aoe.aoe/aoe.txt ./Documentation/aoe/aoe.txt
---- ./Documentation/aoe.aoe/aoe.txt 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/aoe.txt 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,123 @@
-+The EtherDrive (R) HOWTO for users of 2.6 kernels is found at ...
-+
-+ http://www.coraid.com/support/linux/EtherDrive-2.6-HOWTO.html
-+
-+ It has many tips and hints!
-+
-+The aoetools are userland programs that are designed to work with this
-+driver. The aoetools are on sourceforge.
-+
-+ http://aoetools.sourceforge.net/
-+
-+The scripts in this Documentation/aoe directory are intended to
-+document the use of the driver and are not necessary if you install
-+the aoetools.
-+
-+
-+CREATING DEVICE NODES
-+
-+ Users of udev should find the block device nodes created
-+ automatically, but to create all the necessary device nodes, use the
-+ udev configuration rules provided in udev.txt (in this directory).
-+
-+ There is a udev-install.sh script that shows how to install these
-+ rules on your system.
-+
-+ If you are not using udev, two scripts are provided in
-+ Documentation/aoe as examples of static device node creation for
-+ using the aoe driver.
-+
-+ rm -rf /dev/etherd
-+ sh Documentation/aoe/mkdevs.sh /dev/etherd
-+
-+ ... or to make just one shelf's worth of block device nodes ...
-+
-+ sh Documentation/aoe/mkshelf.sh /dev/etherd 0
-+
-+ There is also an autoload script that shows how to edit
-+ /etc/modprobe.conf to ensure that the aoe module is loaded when
-+ necessary.
-+
-+USING DEVICE NODES
-+
-+ "cat /dev/etherd/err" blocks, waiting for error diagnostic output,
-+ like any retransmitted packets.
-+
-+ "echo eth2 eth4 > /dev/etherd/interfaces" tells the aoe driver to
-+ limit ATA over Ethernet traffic to eth2 and eth4. AoE traffic from
-+ untrusted networks should be ignored as a matter of security. See
-+ also the aoe_iflist driver option described below.
-+
-+ "echo > /dev/etherd/discover" tells the driver to find out what AoE
-+ devices are available.
-+
-+ These character devices may disappear and be replaced by sysfs
-+ counterparts. Using the commands in aoetools insulates users from
-+ these implementation details.
-+
-+ The block devices are named like this:
-+
-+ e{shelf}.{slot}
-+ e{shelf}.{slot}p{part}
-+
-+ ... so that "e0.2" is the third blade from the left (slot 2) in the
-+ first shelf (shelf address zero). That's the whole disk. The first
-+ partition on that disk would be "e0.2p1".
-+
-+USING SYSFS
-+
-+ Each aoe block device in /sys/block has the extra attributes of
-+ state, mac, and netif. The state attribute is "up" when the device
-+ is ready for I/O and "down" if detected but unusable. The
-+ "down,closewait" state shows that the device is still open and
-+ cannot come up again until it has been closed.
-+
-+ The mac attribute is the ethernet address of the remote AoE device.
-+ The netif attribute is the network interface on the localhost
-+ through which we are communicating with the remote AoE device.
-+
-+ There is a script in this directory that formats this information
-+ in a convenient way. Users with aoetools can use the aoe-stat
-+ command.
-+
-+ root@makki root# sh Documentation/aoe/status.sh
-+ e10.0 eth3 up
-+ e10.1 eth3 up
-+ e10.2 eth3 up
-+ e10.3 eth3 up
-+ e10.4 eth3 up
-+ e10.5 eth3 up
-+ e10.6 eth3 up
-+ e10.7 eth3 up
-+ e10.8 eth3 up
-+ e10.9 eth3 up
-+ e4.0 eth1 up
-+ e4.1 eth1 up
-+ e4.2 eth1 up
-+ e4.3 eth1 up
-+ e4.4 eth1 up
-+ e4.5 eth1 up
-+ e4.6 eth1 up
-+ e4.7 eth1 up
-+ e4.8 eth1 up
-+ e4.9 eth1 up
-+
-+ Use /sys/module/aoe/parameters/aoe_iflist (or better, the driver
-+ option discussed below) instead of /dev/etherd/interfaces to limit
-+ AoE traffic to the network interfaces in the given
-+ whitespace-separated list. Unlike the old character device, the
-+ sysfs entry can be read from as well as written to.
-+
-+ It's helpful to trigger discovery after setting the list of allowed
-+ interfaces. The aoetools package provides an aoe-discover script
-+ for this purpose. You can also directly use the
-+ /dev/etherd/discover special file described above.
-+
-+DRIVER OPTIONS
-+
-+ There is a boot option for the built-in aoe driver and a
-+ corresponding module parameter, aoe_iflist. Without this option,
-+ all network interfaces may be used for ATA over Ethernet. Here is a
-+ usage example for the module parameter.
-+
-+ modprobe aoe_iflist="eth1 eth3"
-diff -Nurap ./Documentation/aoe.aoe/autoload.sh ./Documentation/aoe/autoload.sh
---- ./Documentation/aoe.aoe/autoload.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/autoload.sh 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,17 @@
-+#!/bin/sh
-+# set aoe to autoload by installing the
-+# aliases in /etc/modprobe.conf
-+
-+f=/etc/modprobe.conf
-+
-+if test ! -r $f || test ! -w $f; then
-+ echo "cannot configure $f for module autoloading" 1>&2
-+ exit 1
-+fi
-+
-+grep major-152 $f >/dev/null
-+if [ $? = 1 ]; then
-+ echo alias block-major-152 aoe >> $f
-+ echo alias char-major-152 aoe >> $f
-+fi
-+
-diff -Nurap ./Documentation/aoe.aoe/mkdevs.sh ./Documentation/aoe/mkdevs.sh
---- ./Documentation/aoe.aoe/mkdevs.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/mkdevs.sh 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,37 @@
-+#!/bin/sh
-+
-+n_shelves=${n_shelves:-10}
-+n_partitions=${n_partitions:-16}
-+
-+if test "$#" != "1"; then
-+ echo "Usage: sh `basename $0` {dir}" 1>&2
-+ echo " n_partitions=16 sh `basename $0` {dir}" 1>&2
-+ exit 1
-+fi
-+dir=$1
-+
-+MAJOR=152
-+
-+echo "Creating AoE devnode files in $dir ..."
-+
-+set -e
-+
-+mkdir -p $dir
-+
-+# (Status info is in sysfs. See status.sh.)
-+# rm -f $dir/stat
-+# mknod -m 0400 $dir/stat c $MAJOR 1
-+rm -f $dir/err
-+mknod -m 0400 $dir/err c $MAJOR 2
-+rm -f $dir/discover
-+mknod -m 0200 $dir/discover c $MAJOR 3
-+rm -f $dir/interfaces
-+mknod -m 0200 $dir/interfaces c $MAJOR 4
-+
-+export n_partitions
-+mkshelf=`echo $0 | sed 's!mkdevs!mkshelf!'`
-+i=0
-+while test $i -lt $n_shelves; do
-+ sh -xc "sh $mkshelf $dir $i"
-+ i=`expr $i + 1`
-+done
-diff -Nurap ./Documentation/aoe.aoe/mkshelf.sh ./Documentation/aoe/mkshelf.sh
---- ./Documentation/aoe.aoe/mkshelf.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/mkshelf.sh 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,28 @@
-+#! /bin/sh
-+
-+if test "$#" != "2"; then
-+ echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2
-+ echo " n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2
-+ exit 1
-+fi
-+n_partitions=${n_partitions:-16}
-+dir=$1
-+shelf=$2
-+nslots=16
-+maxslot=`echo $nslots 1 - p | dc`
-+MAJOR=152
-+
-+set -e
-+
-+minor=`echo $nslots \* $shelf \* $n_partitions | bc`
-+endp=`echo $n_partitions - 1 | bc`
-+for slot in `seq 0 $maxslot`; do
-+ for part in `seq 0 $endp`; do
-+ name=e$shelf.$slot
-+ test "$part" != "0" && name=${name}p$part
-+ rm -f $dir/$name
-+ mknod -m 0660 $dir/$name b $MAJOR $minor
-+
-+ minor=`expr $minor + 1`
-+ done
-+done
-diff -Nurap ./Documentation/aoe.aoe/status.sh ./Documentation/aoe/status.sh
---- ./Documentation/aoe.aoe/status.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/status.sh 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,27 @@
-+#! /bin/sh
-+# collate and present sysfs information about AoE storage
-+
-+set -e
-+format="%8s\t%8s\t%8s\n"
-+me=`basename $0`
-+sysd=${sysfs_dir:-/sys}
-+
-+# printf "$format" device mac netif state
-+
-+# Suse 9.1 Pro doesn't put /sys in /etc/mtab
-+#test -z "`mount | grep sysfs`" && {
-+test ! -d "$sysd/block" && {
-+ echo "$me Error: sysfs is not mounted" 1>&2
-+ exit 1
-+}
-+
-+for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
-+ # maybe ls comes up empty, so we use "end"
-+ test $d = end && continue
-+
-+ dev=`echo "$d" | sed 's/.*!//'`
-+ printf "$format" \
-+ "$dev" \
-+ "`cat \"$d/netif\"`" \
-+ "`cat \"$d/state\"`"
-+done | sort
-diff -Nurap ./Documentation/aoe.aoe/todo.txt ./Documentation/aoe/todo.txt
---- ./Documentation/aoe.aoe/todo.txt 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/todo.txt 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,14 @@
-+There is a potential for deadlock when allocating a struct sk_buff for
-+data that needs to be written out to aoe storage. If the data is
-+being written from a dirty page in order to free that page, and if
-+there are no other pages available, then deadlock may occur when a
-+free page is needed for the sk_buff allocation. This situation has
-+not been observed, but it would be nice to eliminate any potential for
-+deadlock under memory pressure.
-+
-+Because ATA over Ethernet is not fragmented by the kernel's IP code,
-+the destructore member of the struct sk_buff is available to the aoe
-+driver. By using a mempool for allocating all but the first few
-+sk_buffs, and by registering a destructor, we should be able to
-+efficiently allocate sk_buffs without introducing any potential for
-+deadlock.
-diff -Nurap ./Documentation/aoe.aoe/udev-install.sh ./Documentation/aoe/udev-install.sh
---- ./Documentation/aoe.aoe/udev-install.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/udev-install.sh 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,30 @@
-+# install the aoe-specific udev rules from udev.txt into
-+# the system's udev configuration
-+#
-+
-+me="`basename $0`"
-+
-+# find udev.conf, often /etc/udev/udev.conf
-+# (or environment can specify where to find udev.conf)
-+#
-+if test -z "$conf"; then
-+ if test -r /etc/udev/udev.conf; then
-+ conf=/etc/udev/udev.conf
-+ else
-+ conf="`find /etc -type f -name udev.conf 2> /dev/null`"
-+ if test -z "$conf" || test ! -r "$conf"; then
-+ echo "$me Error: no udev.conf found" 1>&2
-+ exit 1
-+ fi
-+ fi
-+fi
-+
-+# find the directory where udev rules are stored, often
-+# /etc/udev/rules.d
-+#
-+rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
-+if test -z "$rules_d" || test ! -d "$rules_d"; then
-+ echo "$me Error: cannot find udev rules directory" 1>&2
-+ exit 1
-+fi
-+sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
-diff -Nurap ./Documentation/aoe.aoe/udev.txt ./Documentation/aoe/udev.txt
---- ./Documentation/aoe.aoe/udev.txt 1970-01-01 03:00:00.000000000 +0300
-+++ ./Documentation/aoe/udev.txt 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,23 @@
-+# These rules tell udev what device nodes to create for aoe support.
-+# They may be installed along the following lines (adjusted to what
-+# you see on your system).
-+#
-+# ecashin@makki ~$ su
-+# Password:
-+# bash# find /etc -type f -name udev.conf
-+# /etc/udev/udev.conf
-+# bash# grep udev_rules= /etc/udev/udev.conf
-+# udev_rules="/etc/udev/rules.d/"
-+# bash# ls /etc/udev/rules.d/
-+# 10-wacom.rules 50-udev.rules
-+# bash# cp /path/to/linux-2.6.xx/Documentation/aoe/udev.txt \
-+# /etc/udev/rules.d/60-aoe.rules
-+#
-+
-+# aoe char devices
-+SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220"
-+SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440"
-+SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220"
-+
-+# aoe block devices
-+KERNEL="etherd*", NAME="%k", GROUP="disk"
---- ./drivers/block/Kconfig.aoe 2006-09-05 11:38:33.000000000 +0400
-+++ ./drivers/block/Kconfig 2006-09-08 14:18:29.000000000 +0400
-@@ -361,6 +361,13 @@ config LBD
- your machine, or if you want to have a raid or loopback device
- bigger than 2TB. Otherwise say N.
-
-+config ATA_OVER_ETH
-+ tristate "ATA over Ethernet support"
-+ help
-+ AoE is a simple protocol used to package ATA commands and responses
-+ for transmission over Ethernet. AoE also provides hosts with a method
-+ for obtaining information about the EtherDrive blade.
-+
- config CCISS_DUMP
- bool "driver-side part of cciss diskdump"
- depends on DISKDUMP
---- ./drivers/block/Makefile.aoe 2006-09-05 11:38:33.000000000 +0400
-+++ ./drivers/block/Makefile 2006-09-08 14:22:17.000000000 +0400
-@@ -35,6 +35,7 @@ obj-$(CONFIG_BLK_DEV_XD) += xd.o
- obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o
- obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o
- obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o
-+obj-$(CONFIG_ATA_OVER_ETH) += aoe/
- obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
-
- obj-$(CONFIG_BLK_DEV_UMEM) += umem.o
-diff -Nurap ./drivers/block/aoe.aoe/Makefile ./drivers/block/aoe/Makefile
---- ./drivers/block/aoe.aoe/Makefile 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/Makefile 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,6 @@
-+#
-+# Makefile for ATA over Ethernet
-+#
-+
-+obj-$(CONFIG_ATA_OVER_ETH) += aoe.o
-+aoe-objs := aoeblk.o aoechr.o aoecmd.o aoedev.o aoemain.o aoenet.o
-diff -Nurap ./drivers/block/aoe.aoe/aoe.h ./drivers/block/aoe/aoe.h
---- ./drivers/block/aoe.aoe/aoe.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoe.h 2006-08-31 14:59:58.000000000 +0400
-@@ -0,0 +1,183 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+#define VERSION "14"
-+#define AOE_MAJOR 152
-+#define DEVICE_NAME "aoe"
-+
-+/* set AOE_PARTITIONS to 1 to use whole-disks only
-+ * default is 16, which is 15 partitions plus the whole disk
-+ */
-+#ifndef AOE_PARTITIONS
-+#define AOE_PARTITIONS (16)
-+#endif
-+
-+
-+#define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
-+#define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
-+#define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
-+#define WHITESPACE " \t\v\f\n"
-+/* for compatibility, so that this driver builds for kernels with
-+ * or without AoE already in them
-+ */
-+#ifndef ETH_P_AOE
-+#define ETH_P_AOE 0x88a2
-+#endif
-+
-+enum {
-+ AOECMD_ATA,
-+ AOECMD_CFG,
-+
-+ AOEFL_RSP = (1<<3),
-+ AOEFL_ERR = (1<<2),
-+
-+ AOEAFL_EXT = (1<<6),
-+ AOEAFL_DEV = (1<<4),
-+ AOEAFL_ASYNC = (1<<1),
-+ AOEAFL_WRITE = (1<<0),
-+
-+ AOECCMD_READ = 0,
-+ AOECCMD_TEST,
-+ AOECCMD_PTEST,
-+ AOECCMD_SET,
-+ AOECCMD_FSET,
-+
-+ AOE_HVER = 0x10,
-+};
-+
-+struct aoe_hdr {
-+ unsigned char dst[6];
-+ unsigned char src[6];
-+ u16 type;
-+ unsigned char verfl;
-+ unsigned char err;
-+ u16 major;
-+ unsigned char minor;
-+ unsigned char cmd;
-+ u32 tag;
-+};
-+
-+struct aoe_atahdr {
-+ unsigned char aflags;
-+ unsigned char errfeat;
-+ unsigned char scnt;
-+ unsigned char cmdstat;
-+ unsigned char lba0;
-+ unsigned char lba1;
-+ unsigned char lba2;
-+ unsigned char lba3;
-+ unsigned char lba4;
-+ unsigned char lba5;
-+ unsigned char res[2];
-+};
-+
-+struct aoe_cfghdr {
-+ u16 bufcnt;
-+ u16 fwver;
-+ unsigned char res;
-+ unsigned char aoeccmd;
-+ unsigned char cslen[2];
-+};
-+
-+enum {
-+ DEVFL_UP = 1, /* device is installed in system and ready for AoE->ATA commands */
-+ DEVFL_TKILL = (1<<1), /* flag for timer to know when to kill self */
-+ DEVFL_EXT = (1<<2), /* device accepts lba48 commands */
-+ DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */
-+ DEVFL_WC_UPDATE = (1<<4), /* this device needs to update write cache status */
-+ DEVFL_WORKON = (1<<4),
-+
-+ BUFFL_FAIL = 1,
-+};
-+
-+enum {
-+ MAXATADATA = 1024,
-+ NPERSHELF = 16, /* number of slots per shelf address */
-+ FREETAG = -1,
-+ MIN_BUFS = 8,
-+};
-+
-+struct buf {
-+ struct list_head bufs;
-+ ulong start_time; /* for disk stats */
-+ ulong flags;
-+ ulong nframesout;
-+ char *bufaddr;
-+ ulong resid;
-+ ulong bv_resid;
-+ sector_t sector;
-+ struct bio *bio;
-+ struct bio_vec *bv;
-+};
-+
-+struct frame {
-+ int tag;
-+ ulong waited;
-+ struct buf *buf;
-+ char *bufaddr;
-+ int writedatalen;
-+ int ndata;
-+
-+ /* largest possible */
-+ unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
-+};
-+
-+struct aoedev {
-+ struct aoedev *next;
-+ unsigned char addr[6]; /* remote mac addr */
-+ ushort flags;
-+ ulong sysminor;
-+ ulong aoemajor;
-+ ulong aoeminor;
-+ ulong nopen; /* (bd_openers isn't available without sleeping) */
-+ ulong rttavg; /* round trip average of requests/responses */
-+ u16 fw_ver; /* version of blade's firmware */
-+ struct work_struct work;/* disk create work struct */
-+ struct gendisk *gd;
-+ request_queue_t blkq;
-+ struct hd_geometry geo;
-+ sector_t ssize;
-+ struct timer_list timer;
-+ spinlock_t lock;
-+ struct net_device *ifp; /* interface ed is attached to */
-+ struct sk_buff *sendq_hd; /* packets needing to be sent, list head */
-+ struct sk_buff *sendq_tl;
-+ mempool_t *bufpool; /* for deadlock-free Buf allocation */
-+ struct list_head bufq; /* queue of bios to work on */
-+ struct buf *inprocess; /* the one we're currently working on */
-+ ulong lasttag; /* last tag sent */
-+ ulong nframes; /* number of frames below */
-+ struct frame *frames;
-+};
-+
-+
-+int aoeblk_init(void);
-+void aoeblk_exit(void);
-+void aoeblk_gdalloc(void *);
-+void aoedisk_rm_sysfs(struct aoedev *d);
-+
-+int aoechr_init(void);
-+void aoechr_exit(void);
-+void aoechr_error(char *);
-+
-+void aoecmd_work(struct aoedev *d);
-+void aoecmd_cfg(ushort, unsigned char);
-+void aoecmd_ata_rsp(struct sk_buff *);
-+void aoecmd_cfg_rsp(struct sk_buff *);
-+
-+int aoedev_init(void);
-+void aoedev_exit(void);
-+struct aoedev *aoedev_by_aoeaddr(int maj, int min);
-+void aoedev_downdev(struct aoedev *d);
-+struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong);
-+int aoedev_busy(void);
-+
-+int aoenet_init(void);
-+void aoenet_exit(void);
-+void aoenet_xmit(struct sk_buff *);
-+int is_aoe_netif(struct net_device *ifp);
-+int set_aoe_iflist(const char __user *str, size_t size);
-+
-+u64 mac_addr(char addr[6]);
-+
-+/* for compatibility with older 2.6 kernels lacking kcalloc
-+ */
-+extern void *aoe_kcalloc(size_t, size_t, int);
-diff -Nurap ./drivers/block/aoe.aoe/aoeblk.c ./drivers/block/aoe/aoeblk.c
---- ./drivers/block/aoe.aoe/aoeblk.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoeblk.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,281 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoeblk.c
-+ * block device routines
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/fs.h>
-+#include <linux/ioctl.h>
-+#include <linux/genhd.h>
-+#include <linux/netdevice.h>
-+#include "aoe.h"
-+#include "disk_attr.h"
-+
-+static kmem_cache_t *buf_pool_cache;
-+
-+static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
-+{
-+ struct aoedev *d = disk->private_data;
-+
-+ return snprintf(page, PAGE_SIZE,
-+ "%s%s\n",
-+ (d->flags & DEVFL_UP) ? "up" : "down",
-+ (d->flags & DEVFL_CLOSEWAIT) ? ",closewait" : "");
-+}
-+static ssize_t aoedisk_show_mac(struct gendisk * disk, char *page)
-+{
-+ struct aoedev *d = disk->private_data;
-+
-+ return snprintf(page, PAGE_SIZE, "%012llx\n",
-+ (unsigned long long)mac_addr(d->addr));
-+}
-+static ssize_t aoedisk_show_netif(struct gendisk * disk, char *page)
-+{
-+ struct aoedev *d = disk->private_data;
-+
-+ return snprintf(page, PAGE_SIZE, "%s\n", d->ifp->name);
-+}
-+/* firmware version */
-+static ssize_t aoedisk_show_fwver(struct gendisk * disk, char *page)
-+{
-+ struct aoedev *d = disk->private_data;
-+
-+ return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver);
-+}
-+
-+static struct disk_attribute disk_attr_state = {
-+ .attr = {.name = "state", .mode = S_IRUGO },
-+ .show = aoedisk_show_state
-+};
-+static struct disk_attribute disk_attr_mac = {
-+ .attr = {.name = "mac", .mode = S_IRUGO },
-+ .show = aoedisk_show_mac
-+};
-+static struct disk_attribute disk_attr_netif = {
-+ .attr = {.name = "netif", .mode = S_IRUGO },
-+ .show = aoedisk_show_netif
-+};
-+static struct disk_attribute disk_attr_fwver = {
-+ .attr = {.name = "firmware-version", .mode = S_IRUGO },
-+ .show = aoedisk_show_fwver
-+};
-+
-+static void
-+aoedisk_add_sysfs(struct aoedev *d)
-+{
-+ sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr);
-+ sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
-+ sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
-+ sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
-+}
-+void
-+aoedisk_rm_sysfs(struct aoedev *d)
-+{
-+ sysfs_remove_link(&d->gd->kobj, "state");
-+ sysfs_remove_link(&d->gd->kobj, "mac");
-+ sysfs_remove_link(&d->gd->kobj, "netif");
-+ sysfs_remove_link(&d->gd->kobj, "firmware-version");
-+}
-+
-+static int
-+aoeblk_open(struct inode *inode, struct file *filp)
-+{
-+ struct aoedev *d;
-+ ulong flags;
-+
-+ d = inode->i_bdev->bd_disk->private_data;
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+ if (d->flags & DEVFL_UP) {
-+ d->nopen++;
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return 0;
-+ }
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return -ENODEV;
-+}
-+
-+static int
-+aoeblk_release(struct inode *inode, struct file *filp)
-+{
-+ struct aoedev *d;
-+ ulong flags;
-+
-+ d = inode->i_bdev->bd_disk->private_data;
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ if (--d->nopen == 0 && (d->flags & DEVFL_CLOSEWAIT)) {
-+ d->flags &= ~DEVFL_CLOSEWAIT;
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ aoecmd_cfg(d->aoemajor, d->aoeminor);
-+ return 0;
-+ }
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ return 0;
-+}
-+
-+static int
-+aoeblk_make_request(request_queue_t *q, struct bio *bio)
-+{
-+ struct aoedev *d;
-+ struct buf *buf;
-+ struct sk_buff *sl;
-+ ulong flags;
-+
-+ blk_queue_bounce(q, &bio);
-+
-+ d = bio->bi_bdev->bd_disk->private_data;
-+ buf = mempool_alloc(d->bufpool, GFP_NOIO);
-+ if (buf == NULL) {
-+ printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation "
-+ "failure\n");
-+ bio_endio(bio, bio->bi_size, -ENOMEM);
-+ return 0;
-+ }
-+ memset(buf, 0, sizeof(*buf));
-+ INIT_LIST_HEAD(&buf->bufs);
-+ buf->start_time = jiffies;
-+ buf->bio = bio;
-+ buf->resid = bio->bi_size;
-+ buf->sector = bio->bi_sector;
-+ buf->bv = buf->bio->bi_io_vec;
-+ buf->bv_resid = buf->bv->bv_len;
-+ buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ if ((d->flags & DEVFL_UP) == 0) {
-+ printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n",
-+ d->aoemajor, d->aoeminor);
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ mempool_free(buf, d->bufpool);
-+ bio_endio(bio, bio->bi_size, -ENXIO);
-+ return 0;
-+ }
-+
-+ list_add_tail(&buf->bufs, &d->bufq);
-+ aoecmd_work(d);
-+
-+ sl = d->sendq_hd;
-+ d->sendq_hd = d->sendq_tl = NULL;
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ aoenet_xmit(sl);
-+ return 0;
-+}
-+
-+/* This ioctl implementation expects userland to have the device node
-+ * permissions set so that only priviledged users can open an aoe
-+ * block device directly.
-+ */
-+static int
-+aoeblk_ioctl(struct inode *inode, struct file *filp, uint cmd, ulong arg)
-+{
-+ struct aoedev *d;
-+
-+ if (!arg)
-+ return -EINVAL;
-+
-+ d = inode->i_bdev->bd_disk->private_data;
-+ if ((d->flags & DEVFL_UP) == 0) {
-+ printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n");
-+ return -ENODEV;
-+ }
-+
-+ if (cmd == HDIO_GETGEO) {
-+ d->geo.start = get_start_sect(inode->i_bdev);
-+ if (!copy_to_user((void __user *) arg, &d->geo, sizeof d->geo))
-+ return 0;
-+ return -EFAULT;
-+ }
-+ printk(KERN_INFO "aoe: aoeblk_ioctl: unknown ioctl %d\n", cmd);
-+ return -ENOTTY; /* for older kernels */
-+}
-+
-+static struct block_device_operations aoe_bdops = {
-+ .open = aoeblk_open,
-+ .release = aoeblk_release,
-+ .ioctl = aoeblk_ioctl,
-+ .owner = THIS_MODULE,
-+};
-+
-+/* alloc_disk and add_disk can sleep */
-+void
-+aoeblk_gdalloc(void *vp)
-+{
-+ struct aoedev *d = vp;
-+ struct gendisk *gd;
-+ ulong flags;
-+
-+ gd = alloc_disk(AOE_PARTITIONS);
-+ if (gd == NULL) {
-+ printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk "
-+ "structure for %ld.%ld\n", d->aoemajor, d->aoeminor);
-+ spin_lock_irqsave(&d->lock, flags);
-+ d->flags &= ~DEVFL_WORKON;
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+
-+ d->bufpool = mempool_create(MIN_BUFS,
-+ mempool_alloc_slab, mempool_free_slab,
-+ buf_pool_cache);
-+ if (d->bufpool == NULL) {
-+ printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool "
-+ "for %ld.%ld\n", d->aoemajor, d->aoeminor);
-+ put_disk(gd);
-+ spin_lock_irqsave(&d->lock, flags);
-+ d->flags &= ~DEVFL_WORKON;
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+ blk_queue_make_request(&d->blkq, aoeblk_make_request);
-+ gd->major = AOE_MAJOR;
-+ gd->first_minor = d->sysminor * AOE_PARTITIONS;
-+ gd->fops = &aoe_bdops;
-+ gd->private_data = d;
-+ gd->capacity = d->ssize;
-+ snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%ld",
-+ d->aoemajor, d->aoeminor);
-+
-+ gd->queue = &d->blkq;
-+ d->gd = gd;
-+ d->flags &= ~DEVFL_WORKON;
-+ d->flags |= DEVFL_UP;
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ add_disk(gd);
-+ aoedisk_add_sysfs(d);
-+
-+ printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
-+ "sectors\n", (unsigned long long)mac_addr(d->addr),
-+ d->aoemajor, d->aoeminor,
-+ d->fw_ver, (long long)d->ssize);
-+}
-+
-+void
-+aoeblk_exit(void)
-+{
-+ kmem_cache_destroy(buf_pool_cache);
-+}
-+
-+int __init
-+aoeblk_init(void)
-+{
-+ buf_pool_cache = kmem_cache_create("aoe_bufs",
-+ sizeof(struct buf),
-+ 0, 0, NULL, NULL);
-+ if (buf_pool_cache == NULL)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-diff -Nurap ./drivers/block/aoe.aoe/aoechr.c ./drivers/block/aoe/aoechr.c
---- ./drivers/block/aoe.aoe/aoechr.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoechr.c 2006-08-31 14:59:58.000000000 +0400
-@@ -0,0 +1,229 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoechr.c
-+ * AoE character device driver
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/init.h>
-+#include "aoe.h"
-+
-+enum {
-+ //MINOR_STAT = 1, (moved to sysfs)
-+ MINOR_ERR = 2,
-+ MINOR_DISCOVER,
-+ MINOR_INTERFACES,
-+ MSGSZ = 2048,
-+ NARGS = 10,
-+ NMSG = 100, /* message backlog to retain */
-+};
-+
-+struct aoe_chardev {
-+ ulong minor;
-+ char name[32];
-+};
-+
-+enum { EMFL_VALID = 1 };
-+
-+struct ErrMsg {
-+ short flags;
-+ short len;
-+ char *msg;
-+};
-+
-+static struct ErrMsg emsgs[NMSG];
-+static int emsgs_head_idx, emsgs_tail_idx;
-+static struct semaphore emsgs_sema;
-+static spinlock_t emsgs_lock;
-+static int nblocked_emsgs_readers;
-+static struct aoe_chardev chardevs[] = {
-+ { MINOR_ERR, "err" },
-+ { MINOR_DISCOVER, "discover" },
-+ { MINOR_INTERFACES, "interfaces" },
-+};
-+
-+static int
-+discover(void)
-+{
-+ aoecmd_cfg(0xffff, 0xff);
-+ return 0;
-+}
-+
-+static int
-+interfaces(const char __user *str, size_t size)
-+{
-+ if (set_aoe_iflist(str, size)) {
-+ printk(KERN_CRIT
-+ "%s: could not set interface list: %s\n",
-+ __FUNCTION__, "too many interfaces");
-+ return -EINVAL;
-+ }
-+ return 0;
-+}
-+
-+void
-+aoechr_error(char *msg)
-+{
-+ struct ErrMsg *em;
-+ char *mp;
-+ ulong flags, n;
-+
-+ n = strlen(msg);
-+
-+ spin_lock_irqsave(&emsgs_lock, flags);
-+
-+ em = emsgs + emsgs_tail_idx;
-+ if ((em->flags & EMFL_VALID)) {
-+bail: spin_unlock_irqrestore(&emsgs_lock, flags);
-+ return;
-+ }
-+
-+ mp = kmalloc(n, GFP_ATOMIC);
-+ if (mp == NULL) {
-+ printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n);
-+ goto bail;
-+ }
-+
-+ memcpy(mp, msg, n);
-+ em->msg = mp;
-+ em->flags |= EMFL_VALID;
-+ em->len = n;
-+
-+ emsgs_tail_idx++;
-+ emsgs_tail_idx %= ARRAY_SIZE(emsgs);
-+
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+
-+ if (nblocked_emsgs_readers)
-+ up(&emsgs_sema);
-+}
-+
-+static ssize_t
-+aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
-+{
-+ int ret = -EINVAL;
-+
-+ switch ((unsigned long) filp->private_data) {
-+ default:
-+ printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
-+ break;
-+ case MINOR_DISCOVER:
-+ ret = discover();
-+ break;
-+ case MINOR_INTERFACES:
-+ ret = interfaces(buf, cnt);
-+ break;
-+ }
-+ if (ret == 0)
-+ ret = cnt;
-+ return ret;
-+}
-+
-+static int
-+aoechr_open(struct inode *inode, struct file *filp)
-+{
-+ int n, i;
-+
-+ n = MINOR(inode->i_rdev);
-+ filp->private_data = (void *) (unsigned long) n;
-+
-+ for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
-+ if (chardevs[i].minor == n)
-+ return 0;
-+ return -EINVAL;
-+}
-+
-+static int
-+aoechr_rel(struct inode *inode, struct file *filp)
-+{
-+ return 0;
-+}
-+
-+static ssize_t
-+aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
-+{
-+ unsigned long n;
-+ char *mp;
-+ struct ErrMsg *em;
-+ ssize_t len;
-+ ulong flags;
-+
-+ n = (unsigned long) filp->private_data;
-+ switch (n) {
-+ case MINOR_ERR:
-+ spin_lock_irqsave(&emsgs_lock, flags);
-+loop:
-+ em = emsgs + emsgs_head_idx;
-+ if ((em->flags & EMFL_VALID) == 0) {
-+ if (filp->f_flags & O_NDELAY) {
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+ return -EAGAIN;
-+ }
-+ nblocked_emsgs_readers++;
-+
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+
-+ n = down_interruptible(&emsgs_sema);
-+
-+ spin_lock_irqsave(&emsgs_lock, flags);
-+
-+ nblocked_emsgs_readers--;
-+
-+ if (n) {
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+ return -ERESTARTSYS;
-+ }
-+ goto loop;
-+ }
-+ if (em->len > cnt) {
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+ return -EAGAIN;
-+ }
-+ mp = em->msg;
-+ len = em->len;
-+ em->msg = NULL;
-+ em->flags &= ~EMFL_VALID;
-+
-+ emsgs_head_idx++;
-+ emsgs_head_idx %= ARRAY_SIZE(emsgs);
-+
-+ spin_unlock_irqrestore(&emsgs_lock, flags);
-+
-+ n = copy_to_user(buf, mp, len);
-+ kfree(mp);
-+ return n == 0 ? len : -EFAULT;
-+ default:
-+ return -EFAULT;
-+ }
-+}
-+
-+static struct file_operations aoe_fops = {
-+ .write = aoechr_write,
-+ .read = aoechr_read,
-+ .open = aoechr_open,
-+ .release = aoechr_rel,
-+ .owner = THIS_MODULE,
-+};
-+
-+int __init
-+aoechr_init(void)
-+{
-+ int n;
-+
-+ n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
-+ if (n < 0) {
-+ printk(KERN_ERR "aoe: aoechr_init: can't register char device\n");
-+ return n;
-+ }
-+ sema_init(&emsgs_sema, 0);
-+ spin_lock_init(&emsgs_lock);
-+ return 0;
-+}
-+
-+void
-+aoechr_exit(void)
-+{
-+ unregister_chrdev(AOE_MAJOR, "aoechr");
-+}
-+
-diff -Nurap ./drivers/block/aoe.aoe/aoecmd.c ./drivers/block/aoe/aoecmd.c
---- ./drivers/block/aoe.aoe/aoecmd.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoecmd.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,652 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoecmd.c
-+ * Filesystem request handling methods
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/skbuff.h>
-+#include <linux/netdevice.h>
-+#include <asm/unaligned.h>
-+#include "aoe.h"
-+
-+#define TIMERTICK (HZ / 10)
-+#define MINTIMER (2 * TIMERTICK)
-+#define MAXTIMER (HZ << 1)
-+#define MAXWAIT (60 * 3) /* After MAXWAIT seconds, give up and fail dev */
-+
-+static struct sk_buff *
-+new_skb(struct net_device *if_dev, ulong len)
-+{
-+ struct sk_buff *skb;
-+
-+ if (len < ETH_ZLEN)
-+ len = ETH_ZLEN;
-+
-+ skb = alloc_skb(len, GFP_ATOMIC);
-+ if (skb) {
-+ skb->nh.raw = skb->mac.raw = skb->data;
-+ skb->dev = if_dev;
-+ skb->protocol = __constant_htons(ETH_P_AOE);
-+ skb->priority = 0;
-+ skb_put(skb, len);
-+ memset(skb->head, 0, len);
-+ skb->next = skb->prev = NULL;
-+
-+ /* tell the network layer not to perform IP checksums
-+ * or to get the NIC to do it
-+ */
-+ skb->ip_summed = CHECKSUM_NONE;
-+ }
-+ return skb;
-+}
-+
-+static struct sk_buff *
-+skb_prepare(struct aoedev *d, struct frame *f)
-+{
-+ struct sk_buff *skb;
-+ char *p;
-+
-+ skb = new_skb(d->ifp, f->ndata + f->writedatalen);
-+ if (!skb) {
-+ printk(KERN_INFO "aoe: skb_prepare: failure to allocate skb\n");
-+ return NULL;
-+ }
-+
-+ p = skb->mac.raw;
-+ memcpy(p, f->data, f->ndata);
-+
-+ if (f->writedatalen) {
-+ p += sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr);
-+ memcpy(p, f->bufaddr, f->writedatalen);
-+ }
-+
-+ return skb;
-+}
-+
-+static struct frame *
-+getframe(struct aoedev *d, int tag)
-+{
-+ struct frame *f, *e;
-+
-+ f = d->frames;
-+ e = f + d->nframes;
-+ for (; f<e; f++)
-+ if (f->tag == tag)
-+ return f;
-+ return NULL;
-+}
-+
-+/*
-+ * Leave the top bit clear so we have tagspace for userland.
-+ * The bottom 16 bits are the xmit tick for rexmit/rttavg processing.
-+ * This driver reserves tag -1 to mean "unused frame."
-+ */
-+static int
-+newtag(struct aoedev *d)
-+{
-+ register ulong n;
-+
-+ n = jiffies & 0xffff;
-+ return n |= (++d->lasttag & 0x7fff) << 16;
-+}
-+
-+static int
-+aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h)
-+{
-+ u32 host_tag = newtag(d);
-+
-+ memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
-+ memcpy(h->dst, d->addr, sizeof h->dst);
-+ h->type = __constant_cpu_to_be16(ETH_P_AOE);
-+ h->verfl = AOE_HVER;
-+ h->major = cpu_to_be16(d->aoemajor);
-+ h->minor = d->aoeminor;
-+ h->cmd = AOECMD_ATA;
-+ h->tag = cpu_to_be32(host_tag);
-+
-+ return host_tag;
-+}
-+
-+static void
-+aoecmd_ata_rw(struct aoedev *d, struct frame *f)
-+{
-+ struct aoe_hdr *h;
-+ struct aoe_atahdr *ah;
-+ struct buf *buf;
-+ struct sk_buff *skb;
-+ ulong bcnt;
-+ register sector_t sector;
-+ char writebit, extbit;
-+
-+ writebit = 0x10;
-+ extbit = 0x4;
-+
-+ buf = d->inprocess;
-+
-+ sector = buf->sector;
-+ bcnt = buf->bv_resid;
-+ if (bcnt > MAXATADATA)
-+ bcnt = MAXATADATA;
-+
-+ /* initialize the headers & frame */
-+ h = (struct aoe_hdr *) f->data;
-+ ah = (struct aoe_atahdr *) (h+1);
-+ f->ndata = sizeof *h + sizeof *ah;
-+ memset(h, 0, f->ndata);
-+ f->tag = aoehdr_atainit(d, h);
-+ f->waited = 0;
-+ f->buf = buf;
-+ f->bufaddr = buf->bufaddr;
-+
-+ /* set up ata header */
-+ ah->scnt = bcnt >> 9;
-+ ah->lba0 = sector;
-+ ah->lba1 = sector >>= 8;
-+ ah->lba2 = sector >>= 8;
-+ ah->lba3 = sector >>= 8;
-+ if (d->flags & DEVFL_EXT) {
-+ ah->aflags |= AOEAFL_EXT;
-+ ah->lba4 = sector >>= 8;
-+ ah->lba5 = sector >>= 8;
-+ } else {
-+ extbit = 0;
-+ ah->lba3 &= 0x0f;
-+ ah->lba3 |= 0xe0; /* LBA bit + obsolete 0xa0 */
-+ }
-+
-+ if (bio_data_dir(buf->bio) == WRITE) {
-+ ah->aflags |= AOEAFL_WRITE;
-+ f->writedatalen = bcnt;
-+ } else {
-+ writebit = 0;
-+ f->writedatalen = 0;
-+ }
-+
-+ ah->cmdstat = WIN_READ | writebit | extbit;
-+
-+ /* mark all tracking fields and load out */
-+ buf->nframesout += 1;
-+ buf->bufaddr += bcnt;
-+ buf->bv_resid -= bcnt;
-+/* printk(KERN_INFO "aoe: bv_resid=%ld\n", buf->bv_resid); */
-+ buf->resid -= bcnt;
-+ buf->sector += bcnt >> 9;
-+ if (buf->resid == 0) {
-+ d->inprocess = NULL;
-+ } else if (buf->bv_resid == 0) {
-+ buf->bv++;
-+ buf->bv_resid = buf->bv->bv_len;
-+ buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
-+ }
-+
-+ skb = skb_prepare(d, f);
-+ if (skb) {
-+ skb->next = NULL;
-+ if (d->sendq_hd)
-+ d->sendq_tl->next = skb;
-+ else
-+ d->sendq_hd = skb;
-+ d->sendq_tl = skb;
-+ }
-+}
-+
-+/* enters with d->lock held */
-+void
-+aoecmd_work(struct aoedev *d)
-+{
-+ struct frame *f;
-+ struct buf *buf;
-+loop:
-+ f = getframe(d, FREETAG);
-+ if (f == NULL)
-+ return;
-+ if (d->inprocess == NULL) {
-+ if (list_empty(&d->bufq))
-+ return;
-+ buf = container_of(d->bufq.next, struct buf, bufs);
-+ list_del(d->bufq.next);
-+/*printk(KERN_INFO "aoecmd_work: bi_size=%ld\n", buf->bio->bi_size); */
-+ d->inprocess = buf;
-+ }
-+ aoecmd_ata_rw(d, f);
-+ goto loop;
-+}
-+
-+static void
-+rexmit(struct aoedev *d, struct frame *f)
-+{
-+ struct sk_buff *skb;
-+ struct aoe_hdr *h;
-+ char buf[128];
-+ u32 n;
-+
-+ n = newtag(d);
-+
-+ snprintf(buf, sizeof buf,
-+ "%15s e%ld.%ld oldtag=%08x@%08lx newtag=%08x\n",
-+ "retransmit",
-+ d->aoemajor, d->aoeminor, f->tag, jiffies, n);
-+ aoechr_error(buf);
-+
-+ h = (struct aoe_hdr *) f->data;
-+ f->tag = n;
-+ h->tag = cpu_to_be32(n);
-+
-+ skb = skb_prepare(d, f);
-+ if (skb) {
-+ skb->next = NULL;
-+ if (d->sendq_hd)
-+ d->sendq_tl->next = skb;
-+ else
-+ d->sendq_hd = skb;
-+ d->sendq_tl = skb;
-+ }
-+}
-+
-+static int
-+tsince(int tag)
-+{
-+ int n;
-+
-+ n = jiffies & 0xffff;
-+ n -= tag & 0xffff;
-+ if (n < 0)
-+ n += 1<<16;
-+ return n;
-+}
-+
-+static void
-+rexmit_timer(ulong vp)
-+{
-+ struct aoedev *d;
-+ struct frame *f, *e;
-+ struct sk_buff *sl;
-+ register long timeout;
-+ ulong flags, n;
-+
-+ d = (struct aoedev *) vp;
-+ sl = NULL;
-+
-+ /* timeout is always ~150% of the moving average */
-+ timeout = d->rttavg;
-+ timeout += timeout >> 1;
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ if (d->flags & DEVFL_TKILL) {
-+tdie: spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+ f = d->frames;
-+ e = f + d->nframes;
-+ for (; f<e; f++) {
-+ if (f->tag != FREETAG && tsince(f->tag) >= timeout) {
-+ n = f->waited += timeout;
-+ n /= HZ;
-+ if (n > MAXWAIT) { /* waited too long. device failure. */
-+ aoedev_downdev(d);
-+ goto tdie;
-+ }
-+ rexmit(d, f);
-+ }
-+ }
-+
-+ sl = d->sendq_hd;
-+ d->sendq_hd = d->sendq_tl = NULL;
-+ if (sl) {
-+ n = d->rttavg <<= 1;
-+ if (n > MAXTIMER)
-+ d->rttavg = MAXTIMER;
-+ }
-+
-+ d->timer.expires = jiffies + TIMERTICK;
-+ add_timer(&d->timer);
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ aoenet_xmit(sl);
-+}
-+
-+static void
-+ataid_complete(struct aoedev *d, unsigned char *id)
-+{
-+ u64 ssize;
-+ u16 n;
-+
-+ /* word 83: command set supported */
-+ n = le16_to_cpu(get_unaligned((u16 *) &id[83<<1]));
-+
-+ /* word 86: command set/feature enabled */
-+ n |= le16_to_cpu(get_unaligned((u16 *) &id[86<<1]));
-+
-+ if (n & (1<<10)) { /* bit 10: LBA 48 */
-+ d->flags |= DEVFL_EXT;
-+
-+ /* word 100: number lba48 sectors */
-+ ssize = le64_to_cpu(get_unaligned((u64 *) &id[100<<1]));
-+
-+ /* set as in ide-disk.c:init_idedisk_capacity */
-+ d->geo.cylinders = ssize;
-+ d->geo.cylinders /= (255 * 63);
-+ d->geo.heads = 255;
-+ d->geo.sectors = 63;
-+ } else {
-+ d->flags &= ~DEVFL_EXT;
-+
-+ /* number lba28 sectors */
-+ ssize = le32_to_cpu(get_unaligned((u32 *) &id[60<<1]));
-+
-+ /* NOTE: obsolete in ATA 6 */
-+ d->geo.cylinders = le16_to_cpu(get_unaligned((u16 *) &id[54<<1]));
-+ d->geo.heads = le16_to_cpu(get_unaligned((u16 *) &id[55<<1]));
-+ d->geo.sectors = le16_to_cpu(get_unaligned((u16 *) &id[56<<1]));
-+ }
-+ d->ssize = ssize;
-+ d->geo.start = 0;
-+ if (d->gd != NULL) {
-+ d->gd->capacity = ssize;
-+ d->flags |= DEVFL_UP;
-+ return;
-+ }
-+ if (d->flags & DEVFL_WORKON) {
-+ printk(KERN_INFO "aoe: ataid_complete: can't schedule work, it's already on! "
-+ "(This really shouldn't happen).\n");
-+ return;
-+ }
-+ INIT_WORK(&d->work, aoeblk_gdalloc, d);
-+ schedule_work(&d->work);
-+ d->flags |= DEVFL_WORKON;
-+}
-+
-+static void
-+calc_rttavg(struct aoedev *d, int rtt)
-+{
-+ register long n;
-+
-+ n = rtt;
-+ if (n < MINTIMER)
-+ n = MINTIMER;
-+ else if (n > MAXTIMER)
-+ n = MAXTIMER;
-+
-+ /* g == .25; cf. Congestion Avoidance and Control, Jacobson & Karels; 1988 */
-+ n -= d->rttavg;
-+ d->rttavg += n >> 2;
-+}
-+
-+void
-+aoecmd_ata_rsp(struct sk_buff *skb)
-+{
-+ struct aoedev *d;
-+ struct aoe_hdr *hin;
-+ struct aoe_atahdr *ahin, *ahout;
-+ struct frame *f;
-+ struct buf *buf;
-+ struct sk_buff *sl;
-+ register long n;
-+ ulong flags;
-+ char ebuf[128];
-+ u16 aoemajor;
-+
-+ hin = (struct aoe_hdr *) skb->mac.raw;
-+ aoemajor = be16_to_cpu(hin->major);
-+ d = aoedev_by_aoeaddr(aoemajor, hin->minor);
-+ if (d == NULL) {
-+ snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
-+ "for unknown device %d.%d\n",
-+ aoemajor, hin->minor);
-+ aoechr_error(ebuf);
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ f = getframe(d, be32_to_cpu(hin->tag));
-+ if (f == NULL) {
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ snprintf(ebuf, sizeof ebuf,
-+ "%15s e%d.%d tag=%08x@%08lx\n",
-+ "unexpected rsp",
-+ be16_to_cpu(hin->major),
-+ hin->minor,
-+ be32_to_cpu(hin->tag),
-+ jiffies);
-+ aoechr_error(ebuf);
-+ return;
-+ }
-+
-+ calc_rttavg(d, tsince(f->tag));
-+
-+ ahin = (struct aoe_atahdr *) (hin+1);
-+ ahout = (struct aoe_atahdr *) (f->data + sizeof(struct aoe_hdr));
-+ buf = f->buf;
-+
-+ if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */
-+ printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh "
-+ "stat=%2.2Xh from e%ld.%ld\n",
-+ ahout->cmdstat, ahin->cmdstat,
-+ d->aoemajor, d->aoeminor);
-+ if (buf)
-+ buf->flags |= BUFFL_FAIL;
-+ } else {
-+ switch (ahout->cmdstat) {
-+ case WIN_READ:
-+ case WIN_READ_EXT:
-+ n = ahout->scnt << 9;
-+ if (skb->len - sizeof *hin - sizeof *ahin < n) {
-+ printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt "
-+ "ata data size in read. skb->len=%d\n",
-+ skb->len);
-+ /* fail frame f? just returning will rexmit. */
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+ memcpy(f->bufaddr, ahin+1, n);
-+ case WIN_WRITE:
-+ case WIN_WRITE_EXT:
-+ break;
-+ case WIN_IDENTIFY:
-+ if (skb->len - sizeof *hin - sizeof *ahin < 512) {
-+ printk(KERN_INFO "aoe: aoecmd_ata_rsp: runt data size "
-+ "in ataid. skb->len=%d\n", skb->len);
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+ ataid_complete(d, (char *) (ahin+1));
-+ /* d->flags |= DEVFL_WC_UPDATE; */
-+ break;
-+ default:
-+ printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
-+ "outbound ata command %2.2Xh for %d.%d\n",
-+ ahout->cmdstat,
-+ be16_to_cpu(hin->major),
-+ hin->minor);
-+ }
-+ }
-+
-+ if (buf) {
-+ buf->nframesout -= 1;
-+ if (buf->nframesout == 0 && buf->resid == 0) {
-+ unsigned long duration = jiffies - buf->start_time;
-+ unsigned long n_sect = buf->bio->bi_size >> 9;
-+ struct gendisk *disk = d->gd;
-+
-+ if (bio_data_dir(buf->bio) == WRITE) {
-+ disk_stat_inc(disk, writes);
-+ disk_stat_add(disk, write_ticks, duration);
-+ disk_stat_add(disk, write_sectors, n_sect);
-+ } else {
-+ disk_stat_inc(disk, reads);
-+ disk_stat_add(disk, read_ticks, duration);
-+ disk_stat_add(disk, read_sectors, n_sect);
-+ }
-+ disk_stat_add(disk, io_ticks, duration);
-+ n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
-+ bio_endio(buf->bio, buf->bio->bi_size, n);
-+ mempool_free(buf, d->bufpool);
-+ }
-+ }
-+
-+ f->buf = NULL;
-+ f->tag = FREETAG;
-+
-+ aoecmd_work(d);
-+
-+ sl = d->sendq_hd;
-+ d->sendq_hd = d->sendq_tl = NULL;
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ aoenet_xmit(sl);
-+}
-+
-+void
-+aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
-+{
-+ struct aoe_hdr *h;
-+ struct aoe_cfghdr *ch;
-+ struct sk_buff *skb, *sl;
-+ struct net_device *ifp;
-+
-+ sl = NULL;
-+
-+ read_lock(&dev_base_lock);
-+ for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) {
-+ dev_hold(ifp);
-+ if (!is_aoe_netif(ifp))
-+ continue;
-+
-+ skb = new_skb(ifp, sizeof *h + sizeof *ch);
-+ if (skb == NULL) {
-+ printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n");
-+ continue;
-+ }
-+ h = (struct aoe_hdr *) skb->mac.raw;
-+ memset(h, 0, sizeof *h + sizeof *ch);
-+
-+ memset(h->dst, 0xff, sizeof h->dst);
-+ memcpy(h->src, ifp->dev_addr, sizeof h->src);
-+ h->type = __constant_cpu_to_be16(ETH_P_AOE);
-+ h->verfl = AOE_HVER;
-+ h->major = cpu_to_be16(aoemajor);
-+ h->minor = aoeminor;
-+ h->cmd = AOECMD_CFG;
-+
-+ skb->next = sl;
-+ sl = skb;
-+ }
-+ read_unlock(&dev_base_lock);
-+
-+ aoenet_xmit(sl);
-+}
-+
-+/*
-+ * Since we only call this in one place (and it only prepares one frame)
-+ * we just return the skb. Usually we'd chain it up to the aoedev sendq.
-+ */
-+static struct sk_buff *
-+aoecmd_ata_id(struct aoedev *d)
-+{
-+ struct aoe_hdr *h;
-+ struct aoe_atahdr *ah;
-+ struct frame *f;
-+ struct sk_buff *skb;
-+
-+ f = getframe(d, FREETAG);
-+ if (f == NULL) {
-+ printk(KERN_CRIT "aoe: aoecmd_ata_id: can't get a frame. "
-+ "This shouldn't happen.\n");
-+ return NULL;
-+ }
-+
-+ /* initialize the headers & frame */
-+ h = (struct aoe_hdr *) f->data;
-+ ah = (struct aoe_atahdr *) (h+1);
-+ f->ndata = sizeof *h + sizeof *ah;
-+ memset(h, 0, f->ndata);
-+ f->tag = aoehdr_atainit(d, h);
-+ f->waited = 0;
-+ f->writedatalen = 0;
-+
-+ /* this message initializes the device, so we reset the rttavg */
-+ d->rttavg = MAXTIMER;
-+
-+ /* set up ata header */
-+ ah->scnt = 1;
-+ ah->cmdstat = WIN_IDENTIFY;
-+ ah->lba3 = 0xa0;
-+
-+ skb = skb_prepare(d, f);
-+
-+ /* we now want to start the rexmit tracking */
-+ d->flags &= ~DEVFL_TKILL;
-+ d->timer.data = (ulong) d;
-+ d->timer.function = rexmit_timer;
-+ d->timer.expires = jiffies + TIMERTICK;
-+ add_timer(&d->timer);
-+
-+ return skb;
-+}
-+
-+void
-+aoecmd_cfg_rsp(struct sk_buff *skb)
-+{
-+ struct aoedev *d;
-+ struct aoe_hdr *h;
-+ struct aoe_cfghdr *ch;
-+ ulong flags, sysminor, aoemajor;
-+ u16 bufcnt;
-+ struct sk_buff *sl;
-+ enum { MAXFRAMES = 8 };
-+
-+ h = (struct aoe_hdr *) skb->mac.raw;
-+ ch = (struct aoe_cfghdr *) (h+1);
-+
-+ /*
-+ * Enough people have their dip switches set backwards to
-+ * warrant a loud message for this special case.
-+ */
-+ aoemajor = be16_to_cpu(h->major);
-+ if (aoemajor == 0xfff) {
-+ printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
-+ "address is all ones. Check shelf dip switches\n");
-+ return;
-+ }
-+
-+ sysminor = SYSMINOR(aoemajor, h->minor);
-+ if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
-+ printk(KERN_INFO
-+ "aoe: e%ld.%d: minor number too large\n",
-+ aoemajor, (int) h->minor);
-+ return;
-+ }
-+
-+ bufcnt = be16_to_cpu(ch->bufcnt);
-+ if (bufcnt > MAXFRAMES) /* keep it reasonable */
-+ bufcnt = MAXFRAMES;
-+
-+ d = aoedev_set(sysminor, h->src, skb->dev, bufcnt);
-+ if (d == NULL) {
-+ printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device set failure\n");
-+ return;
-+ }
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ if (d->flags & (DEVFL_UP | DEVFL_CLOSEWAIT)) {
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return;
-+ }
-+
-+ d->fw_ver = be16_to_cpu(ch->fwver);
-+
-+ /* we get here only if the device is new */
-+ sl = aoecmd_ata_id(d);
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ aoenet_xmit(sl);
-+}
-+
-diff -Nurap ./drivers/block/aoe.aoe/aoedev.c ./drivers/block/aoe/aoedev.c
---- ./drivers/block/aoe.aoe/aoedev.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoedev.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,177 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoedev.c
-+ * AoE device utility functions; maintains device list.
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/netdevice.h>
-+#include "aoe.h"
-+
-+static struct aoedev *devlist;
-+static spinlock_t devlist_lock;
-+
-+struct aoedev *
-+aoedev_by_aoeaddr(int maj, int min)
-+{
-+ struct aoedev *d;
-+ ulong flags;
-+
-+ spin_lock_irqsave(&devlist_lock, flags);
-+
-+ for (d=devlist; d; d=d->next)
-+ if (d->aoemajor == maj && d->aoeminor == min)
-+ break;
-+
-+ spin_unlock_irqrestore(&devlist_lock, flags);
-+ return d;
-+}
-+
-+/* called with devlist lock held */
-+static struct aoedev *
-+aoedev_newdev(ulong nframes)
-+{
-+ struct aoedev *d;
-+ struct frame *f, *e;
-+
-+ d = aoe_kcalloc(1, sizeof *d, GFP_ATOMIC);
-+ if (d == NULL)
-+ return NULL;
-+ f = aoe_kcalloc(nframes, sizeof *f, GFP_ATOMIC);
-+ if (f == NULL) {
-+ kfree(d);
-+ return NULL;
-+ }
-+
-+ d->nframes = nframes;
-+ d->frames = f;
-+ e = f + nframes;
-+ for (; f<e; f++)
-+ f->tag = FREETAG;
-+
-+ spin_lock_init(&d->lock);
-+ init_timer(&d->timer);
-+ d->bufpool = NULL; /* defer to aoeblk_gdalloc */
-+ INIT_LIST_HEAD(&d->bufq);
-+ d->next = devlist;
-+ devlist = d;
-+
-+ return d;
-+}
-+
-+void
-+aoedev_downdev(struct aoedev *d)
-+{
-+ struct frame *f, *e;
-+ struct buf *buf;
-+ struct bio *bio;
-+
-+ d->flags |= DEVFL_TKILL;
-+ del_timer(&d->timer);
-+
-+ f = d->frames;
-+ e = f + d->nframes;
-+ for (; f<e; f->tag = FREETAG, f->buf = NULL, f++) {
-+ if (f->tag == FREETAG || f->buf == NULL)
-+ continue;
-+ buf = f->buf;
-+ bio = buf->bio;
-+ if (--buf->nframesout == 0) {
-+ mempool_free(buf, d->bufpool);
-+ bio_endio(bio, bio->bi_size, -EIO);
-+ }
-+ }
-+ d->inprocess = NULL;
-+
-+ while (!list_empty(&d->bufq)) {
-+ buf = container_of(d->bufq.next, struct buf, bufs);
-+ list_del(d->bufq.next);
-+ bio = buf->bio;
-+ mempool_free(buf, d->bufpool);
-+ bio_endio(bio, bio->bi_size, -EIO);
-+ }
-+
-+ if (d->nopen)
-+ d->flags |= DEVFL_CLOSEWAIT;
-+ if (d->gd)
-+ d->gd->capacity = 0;
-+
-+ d->flags &= ~DEVFL_UP;
-+}
-+
-+struct aoedev *
-+aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bufcnt)
-+{
-+ struct aoedev *d;
-+ ulong flags;
-+
-+ spin_lock_irqsave(&devlist_lock, flags);
-+
-+ for (d=devlist; d; d=d->next)
-+ if (d->sysminor == sysminor)
-+ break;
-+
-+ if (d == NULL && (d = aoedev_newdev(bufcnt)) == NULL) {
-+ spin_unlock_irqrestore(&devlist_lock, flags);
-+ printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
-+ return NULL;
-+ } /* if newdev, (d->flags & DEVFL_UP) == 0 for below */
-+
-+ spin_unlock_irqrestore(&devlist_lock, flags);
-+ spin_lock_irqsave(&d->lock, flags);
-+
-+ d->ifp = ifp;
-+ memcpy(d->addr, addr, sizeof d->addr);
-+ if ((d->flags & DEVFL_UP) == 0) {
-+ aoedev_downdev(d); /* flushes outstanding frames */
-+ d->sysminor = sysminor;
-+ d->aoemajor = AOEMAJOR(sysminor);
-+ d->aoeminor = AOEMINOR(sysminor);
-+ }
-+
-+ spin_unlock_irqrestore(&d->lock, flags);
-+ return d;
-+}
-+
-+static void
-+aoedev_freedev(struct aoedev *d)
-+{
-+ if (d->gd) {
-+ aoedisk_rm_sysfs(d);
-+ del_gendisk(d->gd);
-+ put_disk(d->gd);
-+ }
-+ kfree(d->frames);
-+ if (d->bufpool)
-+ mempool_destroy(d->bufpool);
-+ kfree(d);
-+}
-+
-+void
-+aoedev_exit(void)
-+{
-+ struct aoedev *d;
-+ ulong flags;
-+
-+ flush_scheduled_work();
-+
-+ while ((d = devlist)) {
-+ devlist = d->next;
-+
-+ spin_lock_irqsave(&d->lock, flags);
-+ aoedev_downdev(d);
-+ spin_unlock_irqrestore(&d->lock, flags);
-+
-+ del_timer_sync(&d->timer);
-+ aoedev_freedev(d);
-+ }
-+}
-+
-+int __init
-+aoedev_init(void)
-+{
-+ spin_lock_init(&devlist_lock);
-+ return 0;
-+}
-+
-diff -Nurap ./drivers/block/aoe.aoe/aoemain.c ./drivers/block/aoe/aoemain.c
---- ./drivers/block/aoe.aoe/aoemain.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoemain.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,136 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoemain.c
-+ * Module initialization routines, discover timer
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/init.h>
-+#include "aoe.h"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Sam Hopkins <sah@coraid.com>");
-+MODULE_DESCRIPTION("AoE block/char driver for 2.6.[0-9]+");
-+/* this creates warning "Warning: could not find versions for .tmp_versions/aoe.mod"
-+MODULE_VERSION(VERSION);
-+*/
-+
-+/* modinfo sometimes works, but this will be in sysfs */
-+static char version[] = VERSION;
-+module_param_string(version, version, sizeof version, 0400);
-+MODULE_PARM_DESC(version, "aoe module version " VERSION "\n");
-+
-+enum { TINIT, TRUN, TKILL };
-+
-+/* copied from mm/slab.c for backwards compatibility */
-+void *
-+aoe_kcalloc(size_t n, size_t size, int flags)
-+{
-+ void *ret = NULL;
-+
-+ if (n != 0 && size > INT_MAX / n)
-+ return ret;
-+
-+ ret = kmalloc(n * size, flags);
-+ if (ret)
-+ memset(ret, 0, n * size);
-+ return ret;
-+}
-+
-+static void
-+discover_timer(ulong vp)
-+{
-+ static struct timer_list t;
-+ static volatile ulong die;
-+ static spinlock_t lock;
-+ ulong flags;
-+ enum { DTIMERTICK = HZ * 60 }; /* one minute */
-+
-+ switch (vp) {
-+ case TINIT:
-+ init_timer(&t);
-+ spin_lock_init(&lock);
-+ t.data = TRUN;
-+ t.function = discover_timer;
-+ die = 0;
-+ case TRUN:
-+ spin_lock_irqsave(&lock, flags);
-+ if (!die) {
-+ t.expires = jiffies + DTIMERTICK;
-+ add_timer(&t);
-+ }
-+ spin_unlock_irqrestore(&lock, flags);
-+
-+ aoecmd_cfg(0xffff, 0xff);
-+ return;
-+ case TKILL:
-+ spin_lock_irqsave(&lock, flags);
-+ die = 1;
-+ spin_unlock_irqrestore(&lock, flags);
-+
-+ del_timer_sync(&t);
-+ default:
-+ return;
-+ }
-+}
-+
-+static void
-+aoe_exit(void)
-+{
-+ discover_timer(TKILL);
-+
-+ aoenet_exit();
-+ unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
-+ aoechr_exit();
-+ aoedev_exit();
-+ aoeblk_exit(); /* free cache after de-allocating bufs */
-+}
-+
-+static int __init
-+aoe_init(void)
-+{
-+ int ret;
-+
-+ ret = aoedev_init();
-+ if (ret)
-+ return ret;
-+ ret = aoechr_init();
-+ if (ret)
-+ goto chr_fail;
-+ ret = aoeblk_init();
-+ if (ret)
-+ goto blk_fail;
-+ ret = aoenet_init();
-+ if (ret)
-+ goto net_fail;
-+ ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
-+ if (ret < 0) {
-+ printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
-+ goto blkreg_fail;
-+ }
-+
-+ printk(KERN_INFO
-+ "aoe: aoe_init: AoE v2.6-%s initialised.\n",
-+ VERSION);
-+ discover_timer(TINIT);
-+ return 0;
-+
-+ blkreg_fail:
-+ aoenet_exit();
-+ net_fail:
-+ aoeblk_exit();
-+ blk_fail:
-+ aoechr_exit();
-+ chr_fail:
-+ aoedev_exit();
-+
-+ printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
-+ return ret;
-+}
-+
-+module_init(aoe_init);
-+module_exit(aoe_exit);
-+
-diff -Nurap ./drivers/block/aoe.aoe/aoenet.c ./drivers/block/aoe/aoenet.c
---- ./drivers/block/aoe.aoe/aoenet.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/aoenet.c 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1,209 @@
-+/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
-+/*
-+ * aoenet.c
-+ * Ethernet portion of AoE driver
-+ */
-+
-+#include <linux/hdreg.h>
-+#include <linux/blkdev.h>
-+#include <linux/netdevice.h>
-+#include <linux/moduleparam.h>
-+#include "aoe.h"
-+
-+#define NECODES 5
-+
-+static char *aoe_errlist[] =
-+{
-+ "no such error",
-+ "unrecognized command code",
-+ "bad argument parameter",
-+ "device unavailable",
-+ "config string present",
-+ "unsupported version"
-+};
-+
-+enum {
-+ IFLISTSZ = 1024,
-+};
-+
-+static char aoe_iflist[IFLISTSZ];
-+module_param_string(aoe_iflist, aoe_iflist, IFLISTSZ, 0600);
-+MODULE_PARM_DESC(aoe_iflist, "aoe_iflist=\"dev1 [dev2 ...]\"\n");
-+
-+#ifndef MODULE
-+static int __init aoe_iflist_setup(char *str)
-+{
-+ strncpy(aoe_iflist, str, IFLISTSZ);
-+ aoe_iflist[IFLISTSZ - 1] = '\0';
-+ return 1;
-+}
-+
-+__setup("aoe_iflist=", aoe_iflist_setup);
-+#endif
-+
-+/* This function is copied here from linux-2.6.10-rc3-bk11/lib/string.c
-+ * for compatibility with FC2, which issues a warning on MODPOST
-+ * about strcspn being undefined.
-+ */
-+static size_t
-+aoe_strcspn(const char *s, const char *reject)
-+{
-+ const char *p;
-+ const char *r;
-+ size_t count = 0;
-+
-+ for (p = s; *p != '\0'; ++p) {
-+ for (r = reject; *r != '\0'; ++r) {
-+ if (*p == *r)
-+ return count;
-+ }
-+ ++count;
-+ }
-+
-+ return count;
-+}
-+
-+int
-+is_aoe_netif(struct net_device *ifp)
-+{
-+ register char *p, *q;
-+ register int len;
-+
-+ if (aoe_iflist[0] == '\0')
-+ return 1;
-+
-+ p = aoe_iflist + strspn(aoe_iflist, WHITESPACE);
-+ for (; *p; p = q + strspn(q, WHITESPACE)) {
-+ q = p + aoe_strcspn(p, WHITESPACE);
-+ if (q != p)
-+ len = q - p;
-+ else
-+ len = strlen(p); /* last token in aoe_iflist */
-+
-+ if (strlen(ifp->name) == len && !strncmp(ifp->name, p, len))
-+ return 1;
-+ if (q == p)
-+ break;
-+ }
-+
-+ return 0;
-+}
-+
-+int
-+set_aoe_iflist(const char __user *user_str, size_t size)
-+{
-+ if (size >= IFLISTSZ)
-+ return -EINVAL;
-+
-+ if (copy_from_user(aoe_iflist, user_str, size)) {
-+ printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__);
-+ return -EFAULT;
-+ }
-+ aoe_iflist[size] = 0x00;
-+ return 0;
-+}
-+
-+u64
-+mac_addr(char addr[6])
-+{
-+ u64 n = 0;
-+ char *p = (char *) &n;
-+
-+ memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */
-+
-+ return __be64_to_cpu(n);
-+}
-+
-+static struct sk_buff *
-+skb_check(struct sk_buff *skb)
-+{
-+ if (skb_is_nonlinear(skb))
-+ if ((skb = skb_share_check(skb, GFP_ATOMIC)))
-+ if (skb_linearize(skb, GFP_ATOMIC) < 0) {
-+ dev_kfree_skb(skb);
-+ return NULL;
-+ }
-+ return skb;
-+}
-+
-+void
-+aoenet_xmit(struct sk_buff *sl)
-+{
-+ struct sk_buff *skb;
-+
-+ while ((skb = sl)) {
-+ sl = sl->next;
-+ skb->next = skb->prev = NULL;
-+ dev_queue_xmit(skb);
-+ }
-+}
-+
-+/*
-+ * (1) len doesn't include the header by default. I want this.
-+ */
-+static int
-+aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
-+{
-+ struct aoe_hdr *h;
-+ u32 n;
-+
-+ skb = skb_check(skb);
-+ if (!skb)
-+ return 0;
-+
-+ if (!is_aoe_netif(ifp))
-+ goto exit;
-+
-+ //skb->len += ETH_HLEN; /* (1) */
-+ skb_push(skb, ETH_HLEN); /* (1) */
-+
-+ h = (struct aoe_hdr *) skb->mac.raw;
-+ n = be32_to_cpu(h->tag);
-+ if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
-+ goto exit;
-+
-+ if (h->verfl & AOEFL_ERR) {
-+ n = h->err;
-+ if (n > NECODES)
-+ n = 0;
-+ if (net_ratelimit())
-+ printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; "
-+ "ecode=%d '%s'\n",
-+ be16_to_cpu(h->major), h->minor,
-+ h->err, aoe_errlist[n]);
-+ goto exit;
-+ }
-+
-+ switch (h->cmd) {
-+ case AOECMD_ATA:
-+ aoecmd_ata_rsp(skb);
-+ break;
-+ case AOECMD_CFG:
-+ aoecmd_cfg_rsp(skb);
-+ break;
-+ default:
-+ printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd);
-+ }
-+exit:
-+ dev_kfree_skb(skb);
-+ return 0;
-+}
-+
-+static struct packet_type aoe_pt = {
-+ .type = __constant_htons(ETH_P_AOE),
-+ .func = aoenet_rcv,
-+};
-+
-+int __init
-+aoenet_init(void)
-+{
-+ dev_add_pack(&aoe_pt);
-+ return 0;
-+}
-+
-+void
-+aoenet_exit(void)
-+{
-+ dev_remove_pack(&aoe_pt);
-+}
-+
-diff -Nurap ./drivers/block/aoe.aoe/disk_attr.h ./drivers/block/aoe/disk_attr.h
---- ./drivers/block/aoe.aoe/disk_attr.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/block/aoe/disk_attr.h 2006-08-31 14:59:52.000000000 +0400
-@@ -0,0 +1 @@
-+/* struct disk_attribute is defined in kernel headers */
---- ./drivers/block/genhd.c.aoe 2006-09-05 11:38:27.000000000 +0400
-+++ ./drivers/block/genhd.c 2006-09-08 14:38:53.000000000 +0400
-@@ -337,11 +337,6 @@ subsys_initcall(device_init);
- * kobject & sysfs bindings for block devices
- */
-
--struct disk_attribute {
-- struct attribute attr;
-- ssize_t (*show)(struct gendisk *, char *);
--};
--
- static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr,
- char *page)
- {
---- ./include/linux/genhd.h.aoe 2004-10-19 01:53:22.000000000 +0400
-+++ ./include/linux/genhd.h 2006-09-08 14:36:47.000000000 +0400
-@@ -127,6 +127,12 @@ struct gendisk {
- #endif
- };
-
-+/* Structure for sysfs attributes on block devices */
-+struct disk_attribute {
-+ struct attribute attr;
-+ ssize_t (*show)(struct gendisk *, char *);
-+};
-+
- /*
- * Macros to operate on percpu disk statistics:
- * Since writes to disk_stats are serialised through the queue_lock,
diff --git a/openvz-sources/023.030/5133_linux-2.6.9-dpt_i2o-2.5.0-2426.patch b/openvz-sources/023.030/5133_linux-2.6.9-dpt_i2o-2.5.0-2426.patch
deleted file mode 100644
index 267349f..0000000
--- a/openvz-sources/023.030/5133_linux-2.6.9-dpt_i2o-2.5.0-2426.patch
+++ /dev/null
@@ -1,5916 +0,0 @@
-diff -Nurap ./drivers/scsi/dpt.dpt/dpt_osdutil.h ./drivers/scsi/dpt/dpt_osdutil.h
---- ./drivers/scsi/dpt.dpt/dpt_osdutil.h 2004-10-19 01:55:28.000000000 +0400
-+++ ./drivers/scsi/dpt/dpt_osdutil.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,358 +0,0 @@
--/* BSDI osd_util.h,v 1.8 1998/06/03 19:14:58 karels Exp */
--
--/*
-- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation
-- * All rights reserved.
-- *
-- * Redistribution and use in source form, with or without modification, are
-- * permitted provided that redistributions of source code must retain the
-- * above copyright notice, this list of conditions and the following disclaimer.
-- *
-- * This software is provided `as is' by Distributed Processing Technology and
-- * any express or implied warranties, including, but not limited to, the
-- * implied warranties of merchantability and fitness for a particular purpose,
-- * are disclaimed. In no event shall Distributed Processing Technology be
-- * liable for any direct, indirect, incidental, special, exemplary or
-- * consequential damages (including, but not limited to, procurement of
-- * substitute goods or services; loss of use, data, or profits; or business
-- * interruptions) however caused and on any theory of liability, whether in
-- * contract, strict liability, or tort (including negligence or otherwise)
-- * arising in any way out of the use of this driver software, even if advised
-- * of the possibility of such damage.
-- *
-- */
--
--#ifndef __OSD_UTIL_H
--#define __OSD_UTIL_H
--
--/*File - OSD_UTIL.H
-- ****************************************************************************
-- *
-- *Description:
-- *
-- * This file contains defines and function prototypes that are
-- *operating system dependent. The resources defined in this file
-- *are not specific to any particular application.
-- *
-- *Copyright Distributed Processing Technology, Corp.
-- * 140 Candace Dr.
-- * Maitland, Fl. 32751 USA
-- * Phone: (407) 830-5522 Fax: (407) 260-5366
-- * All Rights Reserved
-- *
-- *Author: Doug Anderson
-- *Date: 1/7/94
-- *
-- *Editors:
-- *
-- *Remarks:
-- *
-- *
-- *****************************************************************************/
--
--
--/*Definitions - Defines & Constants ----------------------------------------- */
--
--/*----------------------------- */
--/* Operating system selections: */
--/*----------------------------- */
--
--/*#define _DPT_MSDOS */
--/*#define _DPT_WIN_3X */
--/*#define _DPT_WIN_4X */
--/*#define _DPT_WIN_NT */
--/*#define _DPT_NETWARE */
--/*#define _DPT_OS2 */
--/*#define _DPT_SCO */
--/*#define _DPT_UNIXWARE */
--/*#define _DPT_SOLARIS */
--/*#define _DPT_NEXTSTEP */
--/*#define _DPT_BANYAN */
--
--/*-------------------------------- */
--/* Include the OS specific defines */
--/*-------------------------------- */
--
--/*#define OS_SELECTION From Above List */
--/*#define SEMAPHORE_T ??? */
--/*#define DLL_HANDLE_T ??? */
--
--#if (defined(KERNEL) && (defined(__FreeBSD__) || defined(__bsdi__)))
--# include "i386/isa/dpt_osd_defs.h"
--#else
--# include "osd_defs.h"
--#endif
--
--#ifndef DPT_UNALIGNED
-- #define DPT_UNALIGNED
--#endif
--
--#ifndef DPT_EXPORT
-- #define DPT_EXPORT
--#endif
--
--#ifndef DPT_IMPORT
-- #define DPT_IMPORT
--#endif
--
--#ifndef DPT_RUNTIME_IMPORT
-- #define DPT_RUNTIME_IMPORT DPT_IMPORT
--#endif
--
--/*--------------------- */
--/* OS dependent defines */
--/*--------------------- */
--
--#if defined (_DPT_MSDOS) || defined (_DPT_WIN_3X)
-- #define _DPT_16_BIT
--#else
-- #define _DPT_32_BIT
--#endif
--
--#if defined (_DPT_SCO) || defined (_DPT_UNIXWARE) || defined (_DPT_SOLARIS) || defined (_DPT_AIX) || defined (SNI_MIPS) || defined (_DPT_BSDI) || defined (_DPT_FREE_BSD) || defined(_DPT_LINUX)
-- #define _DPT_UNIX
--#endif
--
--#if defined (_DPT_WIN_3x) || defined (_DPT_WIN_4X) || defined (_DPT_WIN_NT) \
-- || defined (_DPT_OS2)
-- #define _DPT_DLL_SUPPORT
--#endif
--
--#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X) && !defined (_DPT_NETWARE)
-- #define _DPT_PREEMPTIVE
--#endif
--
--#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X)
-- #define _DPT_MULTI_THREADED
--#endif
--
--#if !defined (_DPT_MSDOS)
-- #define _DPT_MULTI_TASKING
--#endif
--
-- /* These exist for platforms that */
-- /* chunk when accessing mis-aligned */
-- /* data */
--#if defined (SNI_MIPS) || defined (_DPT_SOLARIS)
-- #if defined (_DPT_BIG_ENDIAN)
-- #if !defined (_DPT_STRICT_ALIGN)
-- #define _DPT_STRICT_ALIGN
-- #endif
-- #endif
--#endif
--
-- /* Determine if in C or C++ mode */
--#ifdef __cplusplus
-- #define _DPT_CPP
--#else
-- #define _DPT_C
--#endif
--
--/*-------------------------------------------------------------------*/
--/* Under Solaris the compiler refuses to accept code like: */
--/* { {"DPT"}, 0, NULL .... }, */
--/* and complains about the {"DPT"} part by saying "cannot use { } */
--/* to initialize char*". */
--/* */
--/* By defining these ugly macros we can get around this and also */
--/* not have to copy and #ifdef large sections of code. I know that */
--/* these macros are *really* ugly, but they should help reduce */
--/* maintenance in the long run. */
--/* */
--/*-------------------------------------------------------------------*/
--#if !defined (DPTSQO)
-- #if defined (_DPT_SOLARIS)
-- #define DPTSQO
-- #define DPTSQC
-- #else
-- #define DPTSQO {
-- #define DPTSQC }
-- #endif /* solaris */
--#endif /* DPTSQO */
--
--
--/*---------------------- */
--/* OS dependent typedefs */
--/*---------------------- */
--
--#if defined (_DPT_MSDOS) || defined (_DPT_SCO)
-- #define BYTE unsigned char
-- #define WORD unsigned short
--#endif
--
--#ifndef _DPT_TYPEDEFS
-- #define _DPT_TYPEDEFS
-- typedef unsigned char uCHAR;
-- typedef unsigned short uSHORT;
-- typedef unsigned int uINT;
-- typedef unsigned long uLONG;
--
-- typedef union {
-- uCHAR u8[4];
-- uSHORT u16[2];
-- uLONG u32;
-- } access_U;
--#endif
--
--#if !defined (NULL)
-- #define NULL 0
--#endif
--
--
--/*Prototypes - function ----------------------------------------------------- */
--
--#ifdef __cplusplus
-- extern "C" { /* Declare all these functions as "C" functions */
--#endif
--
--/*------------------------ */
--/* Byte reversal functions */
--/*------------------------ */
--
-- /* Reverses the byte ordering of a 2 byte variable */
--#if (!defined(osdSwap2))
-- uSHORT osdSwap2(DPT_UNALIGNED uSHORT *);
--#endif // !osdSwap2
--
-- /* Reverses the byte ordering of a 4 byte variable and shifts left 8 bits */
--#if (!defined(osdSwap3))
-- uLONG osdSwap3(DPT_UNALIGNED uLONG *);
--#endif // !osdSwap3
--
--
--#ifdef _DPT_NETWARE
-- #include "novpass.h" /* For DPT_Bswapl() prototype */
-- /* Inline the byte swap */
-- #ifdef __cplusplus
-- inline uLONG osdSwap4(uLONG *inLong) {
-- return *inLong = DPT_Bswapl(*inLong);
-- }
-- #else
-- #define osdSwap4(inLong) DPT_Bswapl(inLong)
-- #endif // cplusplus
--#else
-- /* Reverses the byte ordering of a 4 byte variable */
--# if (!defined(osdSwap4))
-- uLONG osdSwap4(DPT_UNALIGNED uLONG *);
--# endif // !osdSwap4
--
-- /* The following functions ALWAYS swap regardless of the *
-- * presence of DPT_BIG_ENDIAN */
--
-- uSHORT trueSwap2(DPT_UNALIGNED uSHORT *);
-- uLONG trueSwap4(DPT_UNALIGNED uLONG *);
--
--#endif // netware
--
--
--/*-------------------------------------*
-- * Network order swap functions *
-- * *
-- * These functions/macros will be used *
-- * by the structure insert()/extract() *
-- * functions. *
-- *
-- * We will enclose all structure *
-- * portability modifications inside *
-- * #ifdefs. When we are ready, we *
-- * will #define DPT_PORTABLE to begin *
-- * using the modifications. *
-- *-------------------------------------*/
--uLONG netSwap4(uLONG val);
--
--#if defined (_DPT_BIG_ENDIAN)
--
--// for big-endian we need to swap
--
--#ifndef NET_SWAP_2
--#define NET_SWAP_2(x) (((x) >> 8) | ((x) << 8))
--#endif // NET_SWAP_2
--
--#ifndef NET_SWAP_4
--#define NET_SWAP_4(x) netSwap4((x))
--#endif // NET_SWAP_4
--
--#else
--
--// for little-endian we don't need to do anything
--
--#ifndef NET_SWAP_2
--#define NET_SWAP_2(x) (x)
--#endif // NET_SWAP_2
--
--#ifndef NET_SWAP_4
--#define NET_SWAP_4(x) (x)
--#endif // NET_SWAP_4
--
--#endif // big endian
--
--
--
--/*----------------------------------- */
--/* Run-time loadable module functions */
--/*----------------------------------- */
--
-- /* Loads the specified run-time loadable DLL */
--DLL_HANDLE_T osdLoadModule(uCHAR *);
-- /* Unloads the specified run-time loadable DLL */
--uSHORT osdUnloadModule(DLL_HANDLE_T);
-- /* Returns a pointer to a function inside a run-time loadable DLL */
--void * osdGetFnAddr(DLL_HANDLE_T,uCHAR *);
--
--/*--------------------------------------- */
--/* Mutually exclusive semaphore functions */
--/*--------------------------------------- */
--
-- /* Create a named semaphore */
--SEMAPHORE_T osdCreateNamedSemaphore(char *);
-- /* Create a mutually exlusive semaphore */
--SEMAPHORE_T osdCreateSemaphore(void);
-- /* create an event semaphore */
--SEMAPHORE_T osdCreateEventSemaphore(void);
-- /* create a named event semaphore */
--SEMAPHORE_T osdCreateNamedEventSemaphore(char *);
--
-- /* Destroy the specified mutually exclusive semaphore object */
--uSHORT osdDestroySemaphore(SEMAPHORE_T);
-- /* Request access to the specified mutually exclusive semaphore */
--uLONG osdRequestSemaphore(SEMAPHORE_T,uLONG);
-- /* Release access to the specified mutually exclusive semaphore */
--uSHORT osdReleaseSemaphore(SEMAPHORE_T);
-- /* wait for a event to happen */
--uLONG osdWaitForEventSemaphore(SEMAPHORE_T, uLONG);
-- /* signal an event */
--uLONG osdSignalEventSemaphore(SEMAPHORE_T);
-- /* reset the event */
--uLONG osdResetEventSemaphore(SEMAPHORE_T);
--
--/*----------------- */
--/* Thread functions */
--/*----------------- */
--
-- /* Releases control to the task switcher in non-preemptive */
-- /* multitasking operating systems. */
--void osdSwitchThreads(void);
--
-- /* Starts a thread function */
--uLONG osdStartThread(void *,void *);
--
--/* what is my thread id */
--uLONG osdGetThreadID(void);
--
--/* wakes up the specifed thread */
--void osdWakeThread(uLONG);
--
--/* osd sleep for x miliseconds */
--void osdSleep(uLONG);
--
--#define DPT_THREAD_PRIORITY_LOWEST 0x00
--#define DPT_THREAD_PRIORITY_NORMAL 0x01
--#define DPT_THREAD_PRIORITY_HIGHEST 0x02
--
--uCHAR osdSetThreadPriority(uLONG tid, uCHAR priority);
--
--#ifdef __cplusplus
-- } /* end the xtern "C" declaration */
--#endif
--
--#endif /* osd_util_h */
-diff -Nurap ./drivers/scsi/dpt.dpt/dpti_i2o-dev.h ./drivers/scsi/dpt/dpti_i2o-dev.h
---- ./drivers/scsi/dpt.dpt/dpti_i2o-dev.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/dpt/dpti_i2o-dev.h 2006-09-08 15:10:02.000000000 +0400
-@@ -0,0 +1,395 @@
-+/*
-+ * I2O user space accessible structures/APIs
-+ *
-+ * (c) Copyright 1999, 2000 Red Hat Software
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the License, or (at your option) any later version.
-+ *
-+ *************************************************************************
-+ *
-+ * This header file defines the I2O APIs that are available to both
-+ * the kernel and user level applications. Kernel specific structures
-+ * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which
-+ * automatically includs this file.
-+ *
-+ */
-+
-+#ifndef _I2O_DEV_H
-+#define _I2O_DEV_H
-+
-+
-+#include <linux/ioctl.h>
-+
-+/*
-+ * I2O Control IOCTLs and structures
-+ */
-+#define I2O_MAGIC_NUMBER 'i'
-+#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS])
-+#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct)
-+#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct)
-+#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget)
-+#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget)
-+#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer)
-+#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer)
-+#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer)
-+#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32)
-+#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
-+#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id)
-+#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info)
-+
-+struct i2o_cmd_hrtlct
-+{
-+ unsigned int iop; /* IOP unit number */
-+ void *resbuf; /* Buffer for result */
-+ unsigned int *reslen; /* Buffer length in bytes */
-+};
-+
-+struct i2o_cmd_psetget
-+{
-+ unsigned int iop; /* IOP unit number */
-+ unsigned int tid; /* Target device TID */
-+ void *opbuf; /* Operation List buffer */
-+ unsigned int oplen; /* Operation List buffer length in bytes */
-+ void *resbuf; /* Result List buffer */
-+ unsigned int *reslen; /* Result List buffer length in bytes */
-+};
-+
-+struct i2o_sw_xfer
-+{
-+ unsigned int iop; /* IOP unit number */
-+ unsigned char flags; /* Flags field */
-+ unsigned char sw_type; /* Software type */
-+ unsigned int sw_id; /* Software ID */
-+ void *buf; /* Pointer to software buffer */
-+ unsigned int *swlen; /* Length of software data */
-+ unsigned int *maxfrag; /* Maximum fragment count */
-+ unsigned int *curfrag; /* Current fragment count */
-+};
-+
-+struct i2o_html
-+{
-+ unsigned int iop; /* IOP unit number */
-+ unsigned int tid; /* Target device ID */
-+ unsigned int page; /* HTML page */
-+ void *resbuf; /* Buffer for reply HTML page */
-+ unsigned int *reslen; /* Length in bytes of reply buffer */
-+ void *qbuf; /* Pointer to HTTP query string */
-+ unsigned int qlen; /* Length in bytes of query string buffer */
-+};
-+
-+#define I2O_EVT_Q_LEN 32
-+
-+struct i2o_evt_id
-+{
-+ unsigned int iop;
-+ unsigned int tid;
-+ unsigned int evt_mask;
-+};
-+
-+/* Event data size = frame size - message header + evt indicator */
-+#define I2O_EVT_DATA_SIZE 88
-+
-+struct i2o_evt_info
-+{
-+ struct i2o_evt_id id;
-+ unsigned char evt_data[I2O_EVT_DATA_SIZE];
-+ unsigned int data_size;
-+};
-+
-+struct i2o_evt_get
-+{
-+ struct i2o_evt_info info;
-+ int pending;
-+ int lost;
-+};
-+
-+
-+/**************************************************************************
-+ * HRT related constants and structures
-+ **************************************************************************/
-+#define I2O_BUS_LOCAL 0
-+#define I2O_BUS_ISA 1
-+#define I2O_BUS_EISA 2
-+#define I2O_BUS_MCA 3
-+#define I2O_BUS_PCI 4
-+#define I2O_BUS_PCMCIA 5
-+#define I2O_BUS_NUBUS 6
-+#define I2O_BUS_CARDBUS 7
-+#define I2O_BUS_UNKNOWN 0x80
-+
-+#ifndef __KERNEL__
-+
-+typedef unsigned char u8;
-+typedef unsigned short u16;
-+typedef unsigned int u32;
-+
-+#endif /* __KERNEL__ */
-+
-+typedef struct _i2o_pci_bus {
-+ u8 PciFunctionNumber;
-+ u8 PciDeviceNumber;
-+ u8 PciBusNumber;
-+ u8 reserved;
-+ u16 PciVendorID;
-+ u16 PciDeviceID;
-+} i2o_pci_bus;
-+
-+typedef struct _i2o_local_bus {
-+ u16 LbBaseIOPort;
-+ u16 reserved;
-+ u32 LbBaseMemoryAddress;
-+} i2o_local_bus;
-+
-+typedef struct _i2o_isa_bus {
-+ u16 IsaBaseIOPort;
-+ u8 CSN;
-+ u8 reserved;
-+ u32 IsaBaseMemoryAddress;
-+} i2o_isa_bus;
-+
-+typedef struct _i2o_eisa_bus_info {
-+ u16 EisaBaseIOPort;
-+ u8 reserved;
-+ u8 EisaSlotNumber;
-+ u32 EisaBaseMemoryAddress;
-+} i2o_eisa_bus;
-+
-+typedef struct _i2o_mca_bus {
-+ u16 McaBaseIOPort;
-+ u8 reserved;
-+ u8 McaSlotNumber;
-+ u32 McaBaseMemoryAddress;
-+} i2o_mca_bus;
-+
-+typedef struct _i2o_other_bus {
-+ u16 BaseIOPort;
-+ u16 reserved;
-+ u32 BaseMemoryAddress;
-+} i2o_other_bus;
-+
-+typedef struct _i2o_hrt_entry {
-+ u32 adapter_id;
-+ u32 parent_tid:12;
-+ u32 state:4;
-+ u32 bus_num:8;
-+ u32 bus_type:8;
-+ union {
-+ i2o_pci_bus pci_bus;
-+ i2o_local_bus local_bus;
-+ i2o_isa_bus isa_bus;
-+ i2o_eisa_bus eisa_bus;
-+ i2o_mca_bus mca_bus;
-+ i2o_other_bus other_bus;
-+ } bus;
-+} i2o_hrt_entry;
-+
-+typedef struct _i2o_hrt {
-+ u16 num_entries;
-+ u8 entry_len;
-+ u8 hrt_version;
-+ u32 change_ind;
-+ i2o_hrt_entry hrt_entry[1];
-+} i2o_hrt;
-+
-+typedef struct _i2o_lct_entry {
-+ u32 entry_size:16;
-+ u32 tid:12;
-+ u32 reserved:4;
-+ u32 change_ind;
-+ u32 device_flags;
-+ u32 class_id:12;
-+ u32 version:4;
-+ u32 vendor_id:16;
-+ u32 sub_class;
-+ u32 user_tid:12;
-+ u32 parent_tid:12;
-+ u32 bios_info:8;
-+ u8 identity_tag[8];
-+ u32 event_capabilities;
-+} i2o_lct_entry;
-+
-+typedef struct _i2o_lct {
-+ u32 table_size:16;
-+ u32 boot_tid:12;
-+ u32 lct_ver:4;
-+ u32 iop_flags;
-+ u32 change_ind;
-+ i2o_lct_entry lct_entry[1];
-+} i2o_lct;
-+
-+typedef struct _i2o_status_block {
-+ u16 org_id;
-+ u16 reserved;
-+ u16 iop_id:12;
-+ u16 reserved1:4;
-+ u16 host_unit_id;
-+ u16 segment_number:12;
-+ u16 i2o_version:4;
-+ u8 iop_state;
-+ u8 msg_type;
-+ u16 inbound_frame_size;
-+ u8 init_code;
-+ u8 reserved2;
-+ u32 max_inbound_frames;
-+ u32 cur_inbound_frames;
-+ u32 max_outbound_frames;
-+ char product_id[24];
-+ u32 expected_lct_size;
-+ u32 iop_capabilities;
-+ u32 desired_mem_size;
-+ u32 current_mem_size;
-+ u32 current_mem_base;
-+ u32 desired_io_size;
-+ u32 current_io_size;
-+ u32 current_io_base;
-+ u32 reserved3:24;
-+ u32 cmd_status:8;
-+} i2o_status_block;
-+
-+/* Event indicator mask flags */
-+#define I2O_EVT_IND_STATE_CHANGE 0x80000000
-+#define I2O_EVT_IND_GENERAL_WARNING 0x40000000
-+#define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000
-+#define I2O_EVT_IND_LOCK_RELEASE 0x10000000
-+#define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000
-+#define I2O_EVT_IND_DEVICE_RESET 0x04000000
-+#define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000
-+#define I2O_EVT_IND_FIELD_MODIFIED 0x01000000
-+#define I2O_EVT_IND_VENDOR_EVT 0x00800000
-+#define I2O_EVT_IND_DEVICE_STATE 0x00400000
-+
-+/* Executive event indicitors */
-+#define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001
-+#define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002
-+#define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004
-+#define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008
-+#define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010
-+#define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020
-+#define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040
-+#define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080
-+#define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100
-+#define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200
-+#define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400
-+
-+/* Random Block Storage Event Indicators */
-+#define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001
-+#define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002
-+#define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004
-+#define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008
-+#define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010
-+
-+/* Event data for generic events */
-+#define I2O_EVT_STATE_CHANGE_NORMAL 0x00
-+#define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01
-+#define I2O_EVT_STATE_CHANGE_RESTART 0x02
-+#define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03
-+#define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04
-+#define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05
-+#define I2O_EVT_STATE_CHANGE_FAILED 0x10
-+#define I2O_EVT_STATE_CHANGE_FAULTED 0x11
-+
-+#define I2O_EVT_GEN_WARNING_NORMAL 0x00
-+#define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01
-+#define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02
-+
-+#define I2O_EVT_CAPABILITY_OTHER 0x01
-+#define I2O_EVT_CAPABILITY_CHANGED 0x02
-+
-+#define I2O_EVT_SENSOR_STATE_CHANGED 0x01
-+
-+/*
-+ * I2O classes / subclasses
-+ */
-+
-+/* Class ID and Code Assignments
-+ * (LCT.ClassID.Version field)
-+ */
-+#define I2O_CLASS_VERSION_10 0x00
-+#define I2O_CLASS_VERSION_11 0x01
-+
-+/* Class code names
-+ * (from v1.5 Table 6-1 Class Code Assignments.)
-+ */
-+
-+#define I2O_CLASS_EXECUTIVE 0x000
-+#define I2O_CLASS_DDM 0x001
-+#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010
-+#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011
-+#define I2O_CLASS_LAN 0x020
-+#define I2O_CLASS_WAN 0x030
-+#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040
-+#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041
-+#define I2O_CLASS_SCSI_PERIPHERAL 0x051
-+#define I2O_CLASS_ATE_PORT 0x060
-+#define I2O_CLASS_ATE_PERIPHERAL 0x061
-+#define I2O_CLASS_FLOPPY_CONTROLLER 0x070
-+#define I2O_CLASS_FLOPPY_DEVICE 0x071
-+#define I2O_CLASS_BUS_ADAPTER_PORT 0x080
-+#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090
-+#define I2O_CLASS_PEER_TRANSPORT 0x091
-+
-+/*
-+ * Rest of 0x092 - 0x09f reserved for peer-to-peer classes
-+ */
-+
-+#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff
-+
-+/*
-+ * Subclasses
-+ */
-+
-+#define I2O_SUBCLASS_i960 0x001
-+#define I2O_SUBCLASS_HDM 0x020
-+#define I2O_SUBCLASS_ISM 0x021
-+
-+/* Operation functions */
-+
-+#define I2O_PARAMS_FIELD_GET 0x0001
-+#define I2O_PARAMS_LIST_GET 0x0002
-+#define I2O_PARAMS_MORE_GET 0x0003
-+#define I2O_PARAMS_SIZE_GET 0x0004
-+#define I2O_PARAMS_TABLE_GET 0x0005
-+#define I2O_PARAMS_FIELD_SET 0x0006
-+#define I2O_PARAMS_LIST_SET 0x0007
-+#define I2O_PARAMS_ROW_ADD 0x0008
-+#define I2O_PARAMS_ROW_DELETE 0x0009
-+#define I2O_PARAMS_TABLE_CLEAR 0x000A
-+
-+/*
-+ * I2O serial number conventions / formats
-+ * (circa v1.5)
-+ */
-+
-+#define I2O_SNFORMAT_UNKNOWN 0
-+#define I2O_SNFORMAT_BINARY 1
-+#define I2O_SNFORMAT_ASCII 2
-+#define I2O_SNFORMAT_UNICODE 3
-+#define I2O_SNFORMAT_LAN48_MAC 4
-+#define I2O_SNFORMAT_WAN 5
-+
-+/*
-+ * Plus new in v2.0 (Yellowstone pdf doc)
-+ */
-+
-+#define I2O_SNFORMAT_LAN64_MAC 6
-+#define I2O_SNFORMAT_DDM 7
-+#define I2O_SNFORMAT_IEEE_REG64 8
-+#define I2O_SNFORMAT_IEEE_REG128 9
-+#define I2O_SNFORMAT_UNKNOWN2 0xff
-+
-+/*
-+ * I2O Get Status State values
-+ */
-+
-+#define ADAPTER_STATE_INITIALIZING 0x01
-+#define ADAPTER_STATE_RESET 0x02
-+#define ADAPTER_STATE_HOLD 0x04
-+#define ADAPTER_STATE_READY 0x05
-+#define ADAPTER_STATE_OPERATIONAL 0x08
-+#define ADAPTER_STATE_FAILED 0x10
-+#define ADAPTER_STATE_FAULTED 0x11
-+
-+#endif /* _I2O_DEV_H */
-diff -Nurap ./drivers/scsi/dpt.dpt/dpti_i2o.h ./drivers/scsi/dpt/dpti_i2o.h
---- ./drivers/scsi/dpt.dpt/dpti_i2o.h 2004-10-19 01:54:08.000000000 +0400
-+++ ./drivers/scsi/dpt/dpti_i2o.h 2006-09-08 15:10:02.000000000 +0400
-@@ -1,6 +1,5 @@
--#ifndef _SCSI_I2O_H
--#define _SCSI_I2O_H
--
-+#ifndef _I2O_H
-+#define _I2O_H
- /* I2O kernel space accessible structures/APIs
- *
- * (c) Copyright 1999, 2000 Red Hat Software
-@@ -19,10 +18,9 @@
-
- #ifdef __KERNEL__ /* This file to be included by kernel only */
-
--#include <linux/i2o-dev.h>
-+#include "dpti_i2o-dev.h"
-
- #include <asm/semaphore.h> /* Needed for MUTEX init macros */
--#include <linux/version.h>
- #include <linux/config.h>
- #include <linux/notifier.h>
- #include <asm/atomic.h>
-@@ -44,11 +42,17 @@
-
- #define I2O_MAX_MANAGERS 4
-
-+#include <asm/semaphore.h> /* Needed for MUTEX init macros */
-+
- /*
- * I2O Interface Objects
- */
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-+#include <linux/config.h>
-+#include <linux/notifier.h>
-+#include <asm/atomic.h>
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-
- #define DECLARE_MUTEX(name) struct semaphore name=MUTEX
-
-@@ -456,4 +460,4 @@ struct i2o_sys_tbl
-
- #endif /* __KERNEL__ */
-
--#endif /* _SCSI_I2O_H */
-+#endif /* _I2O_H */
-diff -Nurap ./drivers/scsi/dpt.dpt/dpti_ioctl.h ./drivers/scsi/dpt/dpti_ioctl.h
---- ./drivers/scsi/dpt.dpt/dpti_ioctl.h 2004-10-19 01:54:07.000000000 +0400
-+++ ./drivers/scsi/dpt/dpti_ioctl.h 2006-09-08 15:10:02.000000000 +0400
-@@ -3,10 +3,10 @@
- -------------------
- begin : Thu Sep 7 2000
- copyright : (C) 2001 by Adaptec
-- email : deanna_bonds@adaptec.com
-+ email : Mark_Salyzyn@adaptec.com
-+ original author : doug_anderson@adaptec.com & deanna_bonds@adaptec.com
-
-- See Documentation/scsi/dpti.txt for history, notes, license info
-- and credits
-+ See README.dpti for history, notes, license info, and credits
- ***************************************************************************/
-
- /***************************************************************************
-diff -Nurap ./drivers/scsi/dpt.dpt/dptsig.h ./drivers/scsi/dpt/dptsig.h
---- ./drivers/scsi/dpt.dpt/dptsig.h 2004-10-19 01:55:07.000000000 +0400
-+++ ./drivers/scsi/dpt/dptsig.h 2006-09-08 15:10:02.000000000 +0400
-@@ -1,7 +1,8 @@
- /* BSDI dptsig.h,v 1.7 1998/06/03 19:15:00 karels Exp */
-
- /*
-- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation
-+ * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
-+ * Copyright (c) 2000-2001 Adaptec Corporation.
- * All rights reserved.
- *
- * Redistribution and use in source form, with or without modification, are
-@@ -36,8 +37,12 @@ typedef unsigned short sigWORD;
- #if (defined(_MULTI_DATAMODEL) && defined(sun) && !defined(_ILP32))
- typedef uint32_t sigLONG;
- #else
-+#if (defined(__linux__))
-+typedef u32 sigLONG;
-+#else
- typedef unsigned long sigLONG;
- #endif
-+#endif
-
- /*
- * use sigWORDLittleEndian for:
-@@ -76,7 +81,7 @@ typedef unsigned long sigLONG;
- #endif /* aix */
- #endif
- /* For the Macintosh */
--#if STRUCTALIGNMENTSUPPORTED
-+#ifdef STRUCTALIGNMENTSUPPORTED
- #pragma options align=mac68k
- #endif
-
-@@ -92,6 +97,7 @@ typedef unsigned long sigLONG;
- #define PROC_INTEL 0x00 /* Intel 80x86 */
- #define PROC_MOTOROLA 0x01 /* Motorola 68K */
- #define PROC_MIPS4000 0x02 /* MIPS RISC 4000 */
-+#define PROC_MIPS PROC_MIPS4000 /* MIPS RISC */
- #define PROC_ALPHA 0x03 /* DEC Alpha */
- #define PROC_POWERPC 0x04 /* IBM Power PC */
- #define PROC_i960 0x05 /* Intel i960 */
-@@ -108,10 +114,14 @@ typedef unsigned long sigLONG;
- #define PROC_486 0x08 /* Intel 80486 */
- #define PROC_PENTIUM 0x10 /* Intel 586 aka P5 aka Pentium */
- #define PROC_SEXIUM 0x20 /* Intel 686 aka P6 aka Pentium Pro or MMX */
-+#define PROC_ITANIUM 0x40 /* Intel Itanium 64 bit */
-
- /* PROC_i960: */
--#define PROC_960RX 0x01 /* Intel 80960RC/RD */
-+#define PROC_960RX 0x01 /* Intel 80960RP/RD */
- #define PROC_960HX 0x02 /* Intel 80960HA/HD/HT */
-+#define PROC_960RN 0x03 /* Intel 80960RN/RM */
-+#define PROC_960RS 0x04 /* Intel 80960RS */
-+#define PROC_80303 0x05 /* Intel 80303 (ZION) */
-
- /* PROC_MOTOROLA: */
- #define PROC_68000 0x01 /* Motorola 68000 */
-@@ -125,8 +135,9 @@ typedef unsigned long sigLONG;
- #define PROC_PPC603 0x02 /* PowerPC 603 */
- #define PROC_PPC604 0x04 /* PowerPC 604 */
-
--/* PROC_MIPS4000: */
-+/* PROC_MIPS */
- #define PROC_R4000 0x01 /* MIPS R4000 */
-+#define PROC_RM7000 0x02 /* MIPS RM7000 */
-
- /* Filetype - sigBYTE dsFiletype; DISTINCT VALUES */
- /* ------------------------------------------------------------------ */
-@@ -147,6 +158,7 @@ typedef unsigned long sigLONG;
- #define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
- #define FT_RESOURCE 15 /* Storage Manager Resource File */
- #define FT_MODEM_DB 16 /* Storage Manager Modem Database */
-+#define FT_DMI 17 /* DMI component interface */
-
- /* Filetype flags - sigBYTE dsFiletypeFlags; FLAG BITS */
- /* ------------------------------------------------------------------ */
-@@ -170,6 +182,7 @@ typedef unsigned long sigLONG;
- #define OEM_OLIVETTI 5 /* Olivetti */
- #define OEM_SNI 6 /* Siemens/Nixdorf */
- #define OEM_SUN 7 /* SUN Microsystems */
-+#define OEM_ADAPTEC 8 /* Adaptec */
-
- /* Operating System - sigLONG dsOS; FLAG BITS */
- /* ------------------------------------------------------------------ */
-@@ -202,6 +215,8 @@ typedef unsigned long sigLONG;
- #define OS_SINIX_N 0x04000000 /* SNI SINIX-N */
- #define OS_PLAN9 0x08000000 /* ATT Plan 9 */
- #define OS_TSX 0x10000000 /* SNH TSX-32 */
-+#define OS_WINDOWS_98 0x20000000 /* Microsoft Windows '98 */
-+#define OS_NW5x 0x40000000 /* Novell Netware 5x */
-
- #define OS_OTHER 0x80000000 /* Other */
-
-@@ -284,6 +299,93 @@ typedef unsigned long sigLONG;
- #define REQ_ENGINE 0x10 /* Requires a DPT Engine to be loaded */
- #define REQ_COMM_ENG 0x20 /* Requires a DPT Communications Engine */
-
-+/* ------------------------------------------------------------------ */
-+/* Requirements - sigWORD dsFirmware; FLAG BITS */
-+/* ------------------------------------------------------------------ */
-+#define dsFirmware dsApplication
-+#define FW_DNLDSIZE16_OLD 0x0000 /* 0..3 DownLoader Size 16K - TO SUPPORT OLD IMAGES */
-+#define FW_DNLDSIZE16k 0x0000 /* 0..3 DownLoader Size 16k */
-+#define FW_DNLDSIZE16 0x0001 /* 0..3 DownLoader Size 16K */
-+#define FW_DNLDSIZE32 0x0002 /* 0..3 DownLoader Size 32K */
-+#define FW_DNLDSIZE64 0x0004 /* 0..3 DownLoader Size 64K */
-+#define FW_DNLDSIZE0 0x000f /* 0..3 DownLoader Size 0K - NONE */
-+#define FW_DNLDSIZE_NONE 0x000F /* 0..3 DownLoader Size - NONE */
-+
-+ /* Code Offset is position of the code within the ROM CODE Segment */
-+#define FW_DNLDR_TOP 0x0000 /* 12 DownLoader Position (0=Top, 1=Bottom) */
-+#define FW_DNLDR_BTM 0x1000 /* 12 DownLoader Position (0=Top, 1=Bottom) Dominator */
-+
-+#define FW_LOAD_BTM 0x0000 /* 13 Code Offset (0=Btm, 1=Top) MIPS */
-+#define FW_LOAD_TOP 0x2000 /* 13 Code Offset (0=Btm, 1=Top) i960 */
-+
-+#define FW_SIG_VERSION1 0x0000 /* 15..14 Version Bits 0=Ver1 */
-+#define FW_SIG_VERSION2 0x4000 /* 15..14 Version Bits 1=Ver2 */
-+
-+/*
-+ 0..3 Downloader Size (Value * 16K)
-+
-+ 4
-+ 5
-+ 6
-+ 7
-+
-+ 8
-+ 9
-+ 10
-+ 11
-+
-+ 12 Downloader Position (0=Top of Image 1= Bottom of Image (Dominator) )
-+ 13 Load Offset (0=BTM (MIPS) -- 1=TOP (960) )
-+ 14..15 F/W Sig Version (0=Ver1)
-+*/
-+
-+/* ------------------------------------------------------------------ */
-+/* Sub System Vendor IDs - The PCI Sub system and vendor IDs for each */
-+/* Adaptec Raid controller */
-+/* ------------------------------------------------------------------ */
-+#define PM1554U2_SUB_ID 0xC0011044
-+#define PM1654U2_SUB_ID 0xC0021044
-+#define PM1564U3_1_SUB_ID 0xC0031044
-+#define PM1564U3_2_SUB_ID 0xC0041044
-+#define PM1554U2_NOACPI_SUB_ID 0xC0051044
-+#define PM2554U2_SUB_ID 0xC00A1044
-+#define PM2654U2_SUB_ID 0xC00B1044
-+#define PM2664U3_1_SUB_ID 0xC00C1044
-+#define PM2664U3_2_SUB_ID 0xC00D1044
-+#define PM2554U2_NOACPI_SUB_ID 0xC00E1044
-+#define PM2654U2_NOACPI_SUB_ID 0xC00F1044
-+#define PM3754U2_SUB_ID 0xC0141044
-+#define PM3755U2B_SUB_ID 0xC0151044
-+#define PM3755F_SUB_ID 0xC0161044
-+#define PM3757U2_1_SUB_ID 0xC01E1044
-+#define PM3757U2_2_SUB_ID 0xC01F1044
-+#define PM3767U3_2_SUB_ID 0xC0201044
-+#define PM3767U3_4_SUB_ID 0xC0211044
-+#define PM2865U3_1_SUB_ID 0xC0281044
-+#define PM2865U3_2_SUB_ID 0xC0291044
-+#define PM2865F_SUB_ID 0xC02A1044
-+#define ADPT2000S_1_SUB_ID 0xC03C1044
-+#define ADPT2000S_2_SUB_ID 0xC03D1044
-+#define ADPT2000F_SUB_ID 0xC03E1044
-+#define ADPT3000S_1_SUB_ID 0xC0461044
-+#define ADPT3000S_2_SUB_ID 0xC0471044
-+#define ADPT3000F_SUB_ID 0xC0481044
-+#define ADPT5000S_1_SUB_ID 0xC0501044
-+#define ADPT5000S_2_SUB_ID 0xC0511044
-+#define ADPT5000F_SUB_ID 0xC0521044
-+#define ADPT1000UDMA_SUB_ID 0xC05A1044
-+#define ADPT1000UDMA_DAC_SUB_ID 0xC05B1044
-+#define ADPTI2O_DEVICE_ID 0xa501
-+#define ADPTDOMINATOR_DEVICE_ID 0xa511
-+#define ADPTDOMINATOR_SUB_ID_START 0xC0321044
-+#define ADPTDOMINATOR_SUB_ID_END 0xC03b1044
-+
-+
-+
-+/* ------------------------------------------------------------------ */
-+/* ------------------------------------------------------------------ */
-+/* ------------------------------------------------------------------ */
-+
- /*
- * You may adjust dsDescription_size with an override to a value less than
- * 50 so that the structure allocates less real space.
-@@ -318,6 +420,35 @@ typedef struct dpt_sig {
- /* 32 bytes minimum - with no description. Put NULL at description[0] */
- /* 81 bytes maximum - with 49 character description plus NULL. */
-
-+#if defined __bsdi__
-+#ifndef PACK
-+#define PACK __attribute__ ((packed))
-+#endif
-+typedef struct dpt_sig_Packed {
-+ char dsSignature[6] PACK; /* ALWAYS "dPtSiG" */
-+ sigBYTE dsSigVersion PACK; /* signature version (currently 1) */
-+ sigBYTE dsProcessorFamily PACK; /* what type of processor */
-+ sigBYTE dsProcessor PACK; /* precise processor */
-+ sigBYTE dsFiletype PACK; /* type of file */
-+ sigBYTE dsFiletypeFlags PACK; /* flags to specify load type, etc. */
-+ sigBYTE dsOEM PACK; /* OEM file was created for */
-+ sigLONG dsOS PACK; /* which Operating systems */
-+ sigWORD dsCapabilities PACK; /* RAID levels, etc. */
-+ sigWORD dsDeviceSupp PACK; /* Types of SCSI devices supported */
-+ sigWORD dsAdapterSupp PACK; /* DPT adapter families supported */
-+ sigWORD dsApplication PACK; /* applications file is for */
-+ sigBYTE dsRequirements PACK; /* Other driver dependencies */
-+ sigBYTE dsVersion PACK; /* 1 */
-+ sigBYTE dsRevision PACK; /* 'J' */
-+ sigBYTE dsSubRevision PACK; /* '9' ' ' if N/A */
-+ sigBYTE dsMonth PACK; /* creation month */
-+ sigBYTE dsDay PACK; /* creation day */
-+ sigBYTE dsYear PACK; /* creation year since 1980 (1993=13) */
-+ /* description (NULL terminated) */
-+ char dsDescription[dsDescription_size] PACK;
-+} dpt_sig_S_Packed;
-+#define PACKED_SIG_SIZE sizeof(dpt_sig_S_Packed)
-+#endif
- /* This line added at Roycroft's request */
- /* Microsoft's NT compiler gets confused if you do a pack and don't */
- /* restore it. */
-@@ -332,7 +463,7 @@ typedef struct dpt_sig {
- #endif /* aix */
- #endif
- /* For the Macintosh */
--#if STRUCTALIGNMENTSUPPORTED
-+#ifdef STRUCTALIGNMENTSUPPORTED
- #pragma options align=reset
- #endif
-
-diff -Nurap ./drivers/scsi/dpt.dpt/osd_util.h ./drivers/scsi/dpt/osd_util.h
---- ./drivers/scsi/dpt.dpt/osd_util.h 2004-10-19 01:55:37.000000000 +0400
-+++ ./drivers/scsi/dpt/osd_util.h 2006-09-08 15:10:02.000000000 +0400
-@@ -185,7 +185,11 @@
- typedef unsigned char uCHAR;
- typedef unsigned short uSHORT;
- typedef unsigned int uINT;
-+#if(defined(__linux__))
-+ typedef u32 uLONG;
-+#else
- typedef unsigned long uLONG;
-+#endif
-
- typedef union {
- uCHAR u8[4];
---- ./drivers/scsi/dpt_i2o.c.dpt 2006-09-08 15:20:34.000000000 +0400
-+++ ./drivers/scsi/dpt_i2o.c 2006-09-08 15:10:02.000000000 +0400
-@@ -1,14 +1,15 @@
- /***************************************************************************
-- dpti.c - description
-+ dpt_i2o.c - description
- -------------------
- begin : Thu Sep 7 2000
-- copyright : (C) 2000 by Adaptec
-- email : deanna_bonds@adaptec.com
-+ copyright : (C) 2000-2005 by Adaptec
-+ email : Mark_Salyzyn@adaptec.com
-+ original author : deanna_bonds@adaptec.com
-
-- July 30, 2001 First version being submitted
-+ July 30, 2001 First version being submitted
- for inclusion in the kernel. V2.4
-
-- See Documentation/scsi/dpti.txt for history, notes, license info
-+ See Documentation/scsi/dpti.txt for history, notes, license info,
- and credits
- ***************************************************************************/
-
-@@ -20,27 +21,31 @@
- * (at your option) any later version. *
- * *
- ***************************************************************************/
--/***************************************************************************
-- * Sat Dec 20 2003 Go Taniguchi <go@turbolinux.co.jp>
-- - Support 2.6 kernel and DMA-mapping
-- - ioctl fix for raid tools
-- - use schedule_timeout in long long loop
-- **************************************************************************/
--
--/*#define DEBUG 1 */
--/*#define UARTDELAY 1 */
-
--/* On the real kernel ADDR32 should always be zero for 2.4. GFP_HIGH allocates
-- high pages. Keep the macro around because of the broken unmerged ia64 tree */
--
--#define ADDR32 (0)
-+//#define DEBUG 1
-+//#define UARTDELAY 1
-
- #include <linux/version.h>
-+#include <linux/init.h>
- #include <linux/module.h>
-
--MODULE_AUTHOR("Deanna Bonds, with _lots_ of help from Mark Salyzyn");
-+MODULE_AUTHOR("Deanna Bonds & Mark Salyzyn");
- MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
-
-+#ifdef UTS_RELEASE
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+static char kernel_version[] = UTS_RELEASE;
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-+#if 0
-+static const char __module_kernel_version[] __attribute__((section(".modinfo"))) = "kernel_version=" UTS_RELEASE;
-+#endif
-+#endif
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)) && (LINUX_VERSION_CODE != KERNEL_VERSION(2,4,13)) && (LINUX_VERSION_CODE != KERNEL_VERSION(2,4,9))
-+# define dma_handle ptr
-+#endif
-+
- ////////////////////////////////////////////////////////////////
-
- #include <linux/ioctl.h> /* For SCSI-Passthrough */
-@@ -51,32 +56,86 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Dri
- #include <linux/config.h> /* for CONFIG_PCI */
- #include <linux/pci.h> /* for PCI support */
- #include <linux/proc_fs.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
- #include <linux/blkdev.h>
-+#else
-+#include <linux/blk.h>
-+#include <linux/tqueue.h>
-+#endif
- #include <linux/delay.h> /* for udelay */
- #include <linux/interrupt.h>
- #include <linux/kernel.h> /* for printk */
- #include <linux/sched.h>
- #include <linux/reboot.h>
--#include <linux/spinlock.h>
- #include <linux/smp_lock.h>
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,3))
-+#include <linux/syscalls.h>
-+#endif
-
- #include <linux/timer.h>
- #include <linux/string.h>
- #include <linux/ioport.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
-+#include <linux/mutex.h>
-+#endif
-+#include <linux/stat.h>
-
- #include <asm/processor.h> /* for boot_cpu_data */
- #include <asm/pgtable.h>
--#include <asm/io.h> /* for virt_to_bus, etc. */
-+#include <asm/io.h>
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+#include "scsi.h"
-+#include "hosts.h"
-+#define scsi_host_template SHT
-+#include "sd.h"
-+#if (defined(SCSI_HAS_DUMP))
-+#include "scsi_dump.h"
-+#endif
-+#else
- #include <scsi/scsi.h>
-+#if (!defined(DID_OK))
-+#define DID_OK 0x00
-+#define DID_NO_CONNECT 0x01
-+#define DID_BUS_BUSY 0x02
-+#define DID_TIME_OUT 0x03
-+#define DID_ABORT 0x05
-+#define DID_PARITY 0x06
-+#define DID_ERROR 0x07
-+#define DID_RESET 0x08
-+#define SUCCESS 0x2002
-+#define FAILED 0x2003
-+#endif
- #include <scsi/scsi_cmnd.h>
- #include <scsi/scsi_device.h>
- #include <scsi/scsi_host.h>
- #include <scsi/scsi_tcq.h>
-+#endif
-
- #include "dpt/dptsig.h"
- #include "dpti.h"
-
-+#if ((KERNEL_VERSION(2,4,19) <= LINUX_VERSION_CODE) && (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,22))) && (defined(CONFIG_COMPAT))
-+#include <asm-x86_64/ioctl32.h>
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,70))
-+#include <linux/ioctl32.h>
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-+#define DMA_BIDIRECTIONAL SCSI_DATA_UNKNOWN
-+#define DMA_TO_DEVICE SCSI_DATA_WRITE
-+#define DMA_FROM_DEVICE SCSI_DATA_READ
-+#define DMA_NONE SCSI_DATA_NONE
-+#endif
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2))
-+static inline int pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
-+{
-+ dev->dma_mask = mask;
-+
-+ return 0;
-+}
-+#endif
-+
- /*============================================================================
- * Create a binary signature - this is read by dptsig
- * Needed for our management apps
-@@ -86,17 +145,19 @@ static dpt_sig_S DPTI_sig = {
- {'d', 'P', 't', 'S', 'i', 'G'}, SIG_VERSION,
- #ifdef __i386__
- PROC_INTEL, PROC_386 | PROC_486 | PROC_PENTIUM | PROC_SEXIUM,
--#elif defined(__ia64__)
-- PROC_INTEL, PROC_IA64,
--#elif defined(__sparc__)
-- PROC_ULTRASPARC, PROC_ULTRASPARC,
--#elif defined(__alpha__)
-- PROC_ALPHA, PROC_ALPHA,
-+#elif defined __ia64__
-+ PROC_INTEL, PROC_ITANIUM,
-+#elif defined __x86_64__
-+ PROC_INTEL, PROC_SEXIUM,
-+#elif defined __sparc__
-+ PROC_ULTRASPARC, ~(sigBYTE)0U,
-+#elif defined __alpha__
-+ PROC_ALPHA, ~(sigBYTE)0U,
- #else
-- (-1),(-1),
-+ ~(sigBYTE)0U, ~(sigBYTE)0U,
- #endif
- FT_HBADRVR, 0, OEM_DPT, OS_LINUX, CAP_OVERLAP, DEV_ALL,
-- ADF_ALL_SC5, 0, 0, DPT_VERSION, DPT_REVISION, DPT_SUBREVISION,
-+ ADF_ALL_SC5, 0, 0, DPT_VERSION, DPT_REVISION+'0', DPT_SUBREVISION+'0',
- DPT_MONTH, DPT_DAY, DPT_YEAR, "Adaptec Linux I2O RAID Driver"
- };
-
-@@ -108,18 +169,34 @@ static dpt_sig_S DPTI_sig = {
- *============================================================================
- */
-
--DECLARE_MUTEX(adpt_configuration_lock);
--
--static struct i2o_sys_tbl *sys_tbl = NULL;
--static int sys_tbl_ind = 0;
--static int sys_tbl_len = 0;
--
--static adpt_hba* hbas[DPTI_MAX_HBA];
--static adpt_hba* hba_chain = NULL;
--static int hba_count = 0;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+static struct semaphore adpt_configuration_lock = MUTEX;
-+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+static DECLARE_MUTEX(adpt_configuration_lock);
-+#else
-+static DEFINE_MUTEX(adpt_configuration_lock);
-+#endif
-+static struct i2o_sys_tbl *sys_tbl_va;
-+static dma_addr_t sys_tbl_pa;
-+static int sys_tbl_ind;
-+static int sys_tbl_len;
-+
-+static adpt_hba* hba_chain;
-+static int hba_count;
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11))
-+#ifdef CONFIG_COMPAT
-+static long adpt_compat_ioctl(struct file * file, unsigned cmd, unsigned long arg);
-+#endif
-+#endif
-
- static struct file_operations adpt_fops = {
- .ioctl = adpt_ioctl,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11))
-+#ifdef CONFIG_COMPAT
-+ .compat_ioctl = adpt_compat_ioctl,
-+#endif
-+#endif
- .open = adpt_open,
- .release = adpt_close
- };
-@@ -144,9 +221,13 @@ struct adpt_i2o_post_wait_data
- struct adpt_i2o_post_wait_data *next;
- };
-
--static struct adpt_i2o_post_wait_data *adpt_post_wait_queue = NULL;
--static u32 adpt_post_wait_id = 0;
-+static struct adpt_i2o_post_wait_data *adpt_post_wait_queue;
-+static u32 adpt_post_wait_id;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
- static spinlock_t adpt_post_wait_lock = SPIN_LOCK_UNLOCKED;
-+#else
-+static DEFINE_SPINLOCK(adpt_post_wait_lock);
-+#endif
-
-
- /*============================================================================
-@@ -156,9 +237,9 @@ static spinlock_t adpt_post_wait_lock =
-
- static u8 adpt_read_blink_led(adpt_hba* host)
- {
-- if(host->FwDebugBLEDflag_P != 0) {
-- if( readb(host->FwDebugBLEDflag_P) == 0xbc ){
-- return readb(host->FwDebugBLEDvalue_P);
-+ if(host->bled_flag_addr_virt != 0) {
-+ if( readb(host->bled_flag_addr_virt) == 0xbc ){
-+ return readb(host->bled_value_addr_virt);
- }
- }
- return 0;
-@@ -176,112 +257,40 @@ static struct pci_device_id dptids[] = {
- };
- MODULE_DEVICE_TABLE(pci,dptids);
-
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
-+#if (!defined(SCSI_HAS_SCSI_IN_DETECTION))
-+static struct Scsi_Host * dpt_dummy;
-+#endif
-+
- static int adpt_detect(struct scsi_host_template* sht)
- {
-- struct pci_dev *pDev = NULL;
-- adpt_hba* pHba;
--
-- adpt_init();
--
-- PINFO("Detecting Adaptec I2O RAID controllers...\n");
--
-- /* search for all Adatpec I2O RAID cards */
-- while ((pDev = pci_find_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
-- if(pDev->device == PCI_DPT_DEVICE_ID ||
-- pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
-- if(adpt_install_hba(sht, pDev) ){
-- PERROR("Could not Init an I2O RAID device\n");
-- PERROR("Will not try to detect others.\n");
-- return hba_count-1;
-- }
-- }
-- }
--
-- /* In INIT state, Activate IOPs */
-- for (pHba = hba_chain; pHba; pHba = pHba->next) {
-- // Activate does get status , init outbound, and get hrt
-- if (adpt_i2o_activate_hba(pHba) < 0) {
-- adpt_i2o_delete_hba(pHba);
-- }
-- }
--
--
-- /* Active IOPs in HOLD state */
--
--rebuild_sys_tab:
-- if (hba_chain == NULL)
-- return 0;
--
-- /*
-- * If build_sys_table fails, we kill everything and bail
-- * as we can't init the IOPs w/o a system table
-- */
-- if (adpt_i2o_build_sys_table() < 0) {
-- adpt_i2o_sys_shutdown();
-- return 0;
-- }
--
-- PDEBUG("HBA's in HOLD state\n");
--
-- /* If IOP don't get online, we need to rebuild the System table */
-- for (pHba = hba_chain; pHba; pHba = pHba->next) {
-- if (adpt_i2o_online_hba(pHba) < 0) {
-- adpt_i2o_delete_hba(pHba);
-- goto rebuild_sys_tab;
-- }
-- }
--
-- /* Active IOPs now in OPERATIONAL state */
-- PDEBUG("HBA's in OPERATIONAL state\n");
--
-- printk("dpti: If you have a lot of devices this could take a few minutes.\n");
-- for (pHba = hba_chain; pHba; pHba = pHba->next) {
-- printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name);
-- if (adpt_i2o_lct_get(pHba) < 0){
-- adpt_i2o_delete_hba(pHba);
-- continue;
-- }
--
-- if (adpt_i2o_parse_lct(pHba) < 0){
-- adpt_i2o_delete_hba(pHba);
-- continue;
-- }
-- adpt_inquiry(pHba);
-- }
--
-- for (pHba = hba_chain; pHba; pHba = pHba->next) {
-- if( adpt_scsi_register(pHba,sht) < 0){
-- adpt_i2o_delete_hba(pHba);
-- continue;
-- }
-- pHba->initialized = TRUE;
-- pHba->state &= ~DPTI_STATE_RESET;
-- }
--
-- // Register our control device node
-- // nodes will need to be created in /dev to access this
-- // the nodes can not be created from within the driver
-- if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) {
-- adpt_i2o_sys_shutdown();
-- return 0;
-+#if (!defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ /* By changing the host list we trick a scan */
-+ if (dpt_dummy) {
-+ scsi_host_put(dpt_dummy);
-+ dpt_dummy = NULL;
- }
-- return hba_count;
-+ return hba_count != 0;
-+#else
-+ return template->present = 1;
-+#endif
- }
-
-
-+#endif
- /*
- * scsi_unregister will be called AFTER we return.
- */
- static int adpt_release(struct Scsi_Host *host)
- {
-- adpt_hba* pHba = (adpt_hba*) host->hostdata[0];
-+ adpt_hba* pHba = *((adpt_hba**) host->hostdata);
-+ if (!pHba)
-+ return 0;
- // adpt_i2o_quiesce_hba(pHba);
- adpt_i2o_delete_hba(pHba);
-- scsi_unregister(host);
- return 0;
- }
-
--
- static void adpt_inquiry(adpt_hba* pHba)
- {
- u32 msg[14];
-@@ -292,11 +301,12 @@ static void adpt_inquiry(adpt_hba* pHba)
- u32 len;
- u32 reqlen;
- u8* buf;
-+ dma_addr_t addr;
- u8 scb[16];
- s32 rcode;
-
- memset(msg, 0, sizeof(msg));
-- buf = (u8*)kmalloc(80,GFP_KERNEL|ADDR32);
-+ buf = (u8*)pci_alloc_consistent(pHba->pDev, 80, &addr);
- if(!buf){
- printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name);
- return;
-@@ -309,18 +319,18 @@ static void adpt_inquiry(adpt_hba* pHba)
-
- reqlen = 14; // SINGLE SGE
- /* Stick the headers on */
-- msg[0] = reqlen<<16 | SGL_OFFSET_12;
-- msg[1] = (0xff<<24|HOST_TID<<12|ADAPTER_TID);
-+ msg[0] = cpu_to_le32(reqlen<<16 | SGL_OFFSET_12);
-+ msg[1] = cpu_to_le32(0xff<<24|HOST_TID<<12|ADAPTER_TID);
- msg[2] = 0;
-- msg[3] = 0;
-+ msg[3] = 0;
- // Adaptec/DPT Private stuff
-- msg[4] = I2O_CMD_SCSI_EXEC|DPT_ORGANIZATION_ID<<16;
-- msg[5] = ADAPTER_TID | 1<<16 /* Interpret*/;
-+ msg[4] = cpu_to_le32(I2O_CMD_SCSI_EXEC|DPT_ORGANIZATION_ID<<16);
-+ msg[5] = cpu_to_le32(ADAPTER_TID | 1<<16) /* Interpret*/;
- /* Direction, disconnect ok | sense data | simple queue , CDBLen */
- // I2O_SCB_FLAG_ENABLE_DISCONNECT |
- // I2O_SCB_FLAG_SIMPLE_QUEUE_TAG |
- // I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE;
-- msg[6] = scsidir|0x20a00000| 6 /* cmd len*/;
-+ msg[6] = cpu_to_le32(scsidir|0x20a00000| 6) /* cmd len*/;
-
- mptr=msg+7;
-
-@@ -339,9 +349,20 @@ static void adpt_inquiry(adpt_hba* pHba)
- lenptr=mptr++; /* Remember me - fill in when we know */
-
- /* Now fill in the SGList and command */
-- *lenptr = len;
-- *mptr++ = 0xD0000000|direction|len;
-- *mptr++ = virt_to_bus(buf);
-+ *lenptr = cpu_to_le32(len);
-+ /* The following test gets optimized out if dma_addr_t is <= 32 bits */
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)addr >> 32) != 0) ) {
-+ *mptr++ = cpu_to_le32((0x7C<<24)+(2<<16)+0x02); /* Enable 64 bit */
-+ *mptr++ = cpu_to_le32(1 << PAGE_SHIFT);
-+ *mptr++ = cpu_to_le32(0xD0000000|direction|len);
-+ *mptr++ = cpu_to_le32(addr);
-+ *mptr++ = cpu_to_le32((u64)addr >> 32);
-+ reqlen += 3;
-+ msg[0] = cpu_to_le32(reqlen<<16 | SGL_OFFSET_12);
-+ } else {
-+ *mptr++ = cpu_to_le32(0xD0000000|direction|len);
-+ *mptr++ = cpu_to_le32(addr);
-+ }
-
- // Send it on it's way
- rcode = adpt_i2o_post_wait(pHba, msg, reqlen<<2, 120);
-@@ -349,44 +370,100 @@ static void adpt_inquiry(adpt_hba* pHba)
- sprintf(pHba->detail, "Adaptec I2O RAID");
- printk(KERN_INFO "%s: Inquiry Error (%d)\n",pHba->name,rcode);
- if (rcode != -ETIME && rcode != -EINTR)
-- kfree(buf);
-+ pci_free_consistent(pHba->pDev, 80, buf, addr);
-+ pHba->pae_support = 0;
- } else {
- memset(pHba->detail, 0, sizeof(pHba->detail));
-- memcpy(&(pHba->detail), "Vendor: Adaptec ", 16);
-+ memcpy(&(pHba->detail[0]), "Vendor: Adaptec ", 16);
- memcpy(&(pHba->detail[16]), " Model: ", 8);
- memcpy(&(pHba->detail[24]), (u8*) &buf[16], 16);
- memcpy(&(pHba->detail[40]), " FW: ", 4);
- memcpy(&(pHba->detail[44]), (u8*) &buf[32], 4);
- pHba->detail[48] = '\0'; /* precautionary */
-- kfree(buf);
-+ pci_free_consistent(pHba->pDev, 80, buf, addr);
- }
- adpt_i2o_status_get(pHba);
- return ;
- }
-
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
- static int adpt_slave_configure(struct scsi_device * device)
- {
-- struct Scsi_Host *host = device->host;
-- adpt_hba* pHba;
-+ struct Scsi_Host * host = device->host;
-+ adpt_hba * pHba;
-
-- pHba = (adpt_hba *) host->hostdata[0];
-+ pHba = *((adpt_hba **) host->hostdata);
-
- if (host->can_queue && device->tagged_supported) {
- scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
-- host->can_queue - 1);
-+ host->can_queue - 1);
- } else {
- scsi_adjust_queue_depth(device, 0, 1);
-- }
-+ }
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6)) || defined(SCSI_DEVICE_HAS_TIMEOUT))
-+ if (device->type == TYPE_DISK)
-+ device->timeout = TMOUT_SCSI * HZ;
-+#endif
- return 0;
- }
-+#else
-+static void adpt_select_queue_depths(struct Scsi_Host *host, struct scsi_device * devicelist)
-+{
-+ struct scsi_device *device; /* scsi layer per device information */
-+ adpt_hba* pHba;
-+
-+ pHba = *((adpt_hba **) host->hostdata);
-+
-+ for (device = devicelist; device != NULL; device = device->next) {
-+ if (device->host != host) {
-+ continue;
-+ }
-+ if (host->can_queue) {
-+ device->queue_depth = host->can_queue - 1;
-+ } else {
-+ device->queue_depth = 1;
-+ }
-+ }
-+}
-+#endif
-+#if 0
-+static void inline adpt_sleep(void)
-+{
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ spinlock_t * was_locked = (spinlock_t *)NULL;
-+ if (spin_is_locked(&io_request_lock)) {
-+ was_locked = &io_request_lock;
-+ spin_unlock_irq(was_locked);
-+ }
-+#endif
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8))
-+ scsi_sleep(1);
-+#else
-+ ssleep(1);
-+#endif
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ if (was_locked)
-+ spin_lock_irq(was_locked);
-+#endif
-+}
-+#define ADPT_SLEEP() adpt_sleep()
-+#else
-+#define ADPT_SLEEP()
-+#endif
-
- static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
- {
- adpt_hba* pHba = NULL;
- struct adpt_device* pDev = NULL; /* dpt per device information */
-+#if ((LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,6)) && !defined(SCSI_DEVICE_HAS_TIMEOUT))
- ulong timeout = jiffies + (TMOUT_SCSI*HZ);
-+#endif
-
-+#if 0
-+printk (KERN_INFO"adpt_queue(%p,%p)\n", cmd, done);
-+ADPT_SLEEP();
-+#endif
- cmd->scsi_done = done;
- /*
- * SCSI REQUEST_SENSE commands will be executed automatically by the
-@@ -398,11 +475,19 @@ static int adpt_queue(struct scsi_cmnd *
- if ((cmd->cmnd[0] == REQUEST_SENSE) && (cmd->sense_buffer[0] != 0)) {
- cmd->result = (DID_OK << 16);
- cmd->scsi_done(cmd);
-+#if 0
-+printk (KERN_INFO"adpt_queue(%p,%p)=0\n", cmd, done);
-+ADPT_SLEEP();
-+#endif
- return 0;
- }
-
-- pHba = (adpt_hba*)cmd->device->host->hostdata[0];
-+ pHba = *((adpt_hba**)cmd->device->host->hostdata);
- if (!pHba) {
-+#if 0
-+printk (KERN_INFO"adpt_queue(%p,%p)=FAILED\n", cmd, done);
-+ADPT_SLEEP();
-+#endif
- return FAILED;
- }
-
-@@ -418,31 +503,67 @@ static int adpt_queue(struct scsi_cmnd *
- if(((pHba->state) & DPTI_STATE_IOCTL) || ((pHba->state) & DPTI_STATE_RESET)) {
- pHba->host->last_reset = jiffies;
- pHba->host->resetting = 1;
-+#if 0
-+printk (KERN_INFO"adpt_queue(%p,%p)=1\n", cmd, done);
-+ADPT_SLEEP();
-+#endif
- return 1;
- }
--
-- if(cmd->eh_state != SCSI_STATE_QUEUED){
-- // If we are not doing error recovery
-+#if (defined(SCSI_HAS_DUMP))
-+ if (!dpti_crashdump_mode())
-+#endif
-+#if ((LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,6)) && !defined(SCSI_DEVICE_HAS_TIMEOUT))
-+ if ((cmd->eh_state != SCSI_STATE_QUEUED)
-+ && (cmd->device->type == TYPE_DISK)) {
-+ /* If the controller is doing error recovery */
- mod_timer(&cmd->eh_timeout, timeout);
- }
--
-+#endif
- // TODO if the cmd->device if offline then I may need to issue a bus rescan
- // followed by a get_lct to see if the device is there anymore
-- if((pDev = (struct adpt_device*) (cmd->device->hostdata)) == NULL) {
-+ if(((pDev = (struct adpt_device*) (cmd->device->hostdata)) == NULL)
-+ || ((cmd->cmnd[0] == INQUIRY)
-+ && ((pDev->scsi_channel != scmd_channel(cmd))
-+ || (pDev->scsi_id != scmd_id(cmd))
-+ || (pDev->scsi_lun != cmd->device->lun)))) {
- /*
- * First command request for this device. Set up a pointer
- * to the device structure. This should be a TEST_UNIT_READY
- * command from scan_scsis_single.
- */
-- if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun)) == NULL) {
-+#if 0
-+printk (KERN_INFO"adpt_find_device(%p,%d,%d,%d)\n", pHba, scmd_channel(cmd), scmd_id(cmd), cmd->device->lun);
-+//ADPT_SLEEP();
-+#endif
-+ if ((pDev = adpt_find_device(pHba, (u32)scmd_channel(cmd), (u32)scmd_id(cmd), (u32)cmd->device->lun)) == NULL) {
-+ if (cmd->cmnd[0] == INQUIRY) {
-+ int lun = cmd->device->lun;
-+ while (lun < pHba->host->max_lun) {
-+ if (adpt_find_device(pHba, (u32)scmd_channel(cmd), (u32)scmd_id(cmd), lun) != NULL) {
-+ ((u8*)cmd->buffer)[0] = 0x7F;
-+ cmd->result = (DID_OK << 16);
-+ cmd->scsi_done(cmd);
-+ return 0;
-+ }
-+ ++lun;
-+ }
-+ }
- // TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response
- // with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue.
- cmd->result = (DID_NO_CONNECT << 16);
- cmd->scsi_done(cmd);
- return 0;
- }
-+#if 0
-+printk (KERN_INFO"pDev=%p\n", pDev);
-+//ADPT_SLEEP();
-+#endif
- cmd->device->hostdata = pDev;
- }
-+#if 0
-+printk (KERN_INFO"pDev->pScsi_dev=%p\n", cmd->device);
-+ADPT_SLEEP();
-+#endif
- pDev->pScsi_dev = cmd->device;
-
- /*
-@@ -455,12 +576,21 @@ static int adpt_queue(struct scsi_cmnd *
- return adpt_scsi_to_i2o(pHba, cmd, pDev);
- }
-
--static int adpt_bios_param(struct scsi_device *sdev, struct block_device *dev,
-- sector_t capacity, int geom[])
-+static int adpt_bios_param(
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ struct scsi_device *sdev, struct block_device *dev, sector_t capacity,
-+#else
-+ Disk* disk, kdev_t dev,
-+#endif
-+ int geom[])
- {
- int heads=-1;
- int sectors=-1;
- int cylinders=-1;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ unsigned long capacity = disk->capacity;
-+ struct scsi_device * sdev = disk->device;
-+#endif
-
- // *** First lets set the default geometry ****
-
-@@ -489,7 +619,12 @@ static int adpt_bios_param(struct scsi_d
- heads = 255;
- sectors = 63;
- }
-- cylinders = sector_div(capacity, heads * sectors);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ sector_div(capacity, heads * sectors);
-+ cylinders = (unsigned)capacity;
-+#else
-+ cylinders = capacity / (heads * sectors);
-+#endif
-
- // Special case if CDROM
- if(sdev->type == 5) { // CDROM
-@@ -509,14 +644,23 @@ static int adpt_bios_param(struct scsi_d
-
- static const char *adpt_info(struct Scsi_Host *host)
- {
-- adpt_hba* pHba;
--
-- pHba = (adpt_hba *) host->hostdata[0];
-+ adpt_hba* pHba = *((adpt_hba**) host->hostdata);
-+#if ((LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)) && !defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ if (host == dpt_dummy)
-+ return host->hostt->name;
-+#endif
- return (char *) (pHba->detail);
- }
-
--static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
-- int length, int inout)
-+static int adpt_proc_info(
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ struct Scsi_Host *host,
-+#endif
-+ char *buffer, char **start, off_t offset, int length,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ int hostno,
-+#endif
-+ int inout)
- {
- struct adpt_device* d;
- int id;
-@@ -525,10 +669,13 @@ static int adpt_proc_info(struct Scsi_Ho
- int begin = 0;
- int pos = 0;
- adpt_hba* pHba;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ struct Scsi_Host *host;
-+#endif
- int unit;
-
- *start = buffer;
-- if (inout == TRUE) {
-+ if (inout == 1) {
- /*
- * The user has done a write and wants us to take the
- * data in the buffer and do something with it.
-@@ -546,19 +693,32 @@ static int adpt_proc_info(struct Scsi_Ho
- */
-
- // Find HBA (host bus adapter) we are looking for
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
- for (pHba = hba_chain; pHba; pHba = pHba->next) {
-- if (pHba->host == host) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ if (pHba->host == host)
-+#else
-+ if (pHba->host->host_no == hostno)
-+#endif
-+ {
- break; /* found adapter */
- }
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
- if (pHba == NULL) {
- return 0;
- }
- host = pHba->host;
-
-- len = sprintf(buffer , "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION);
-+ len = sprintf(buffer , "Adaptec I2O RAID Driver Version: " DPT_I2O_VERSION "\n\n");
- len += sprintf(buffer+len, "%s\n", pHba->detail);
- len += sprintf(buffer+len, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n",
- pHba->host->host_no, pHba->name, host->irq);
-@@ -585,11 +745,10 @@ static int adpt_proc_info(struct Scsi_Ho
- for(id = 0; id < MAX_ID; id++) {
- d = pHba->channel[chan].device[id];
- while(d){
-- if(!(d->pScsi_dev))
-- continue;
--
-- len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor);
-- len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev);
-+ if (d->pScsi_dev) {
-+ len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor);
-+ len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev);
-+ }
- pos = begin + len;
-
-
-@@ -602,10 +761,10 @@ static int adpt_proc_info(struct Scsi_Ho
- begin = pos;
- }
-
-- unit = d->pI2o_dev->lct_data.tid;
-+ unit = le32_to_cpu(d->pI2o_dev->lct_data.tid);
- len += sprintf(buffer+len, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n",
- unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun,
-- scsi_device_online(d->pScsi_dev)? "online":"offline");
-+ (d->pScsi_dev && scsi_device_online(d->pScsi_dev)? "online":"offline"));
- pos = begin + len;
-
- /* CHECKPOINT */
-@@ -659,7 +818,7 @@ static int adpt_abort(struct scsi_cmnd *
- if(cmd->serial_number == 0){
- return FAILED;
- }
-- pHba = (adpt_hba*) cmd->device->host->hostdata[0];
-+ pHba = *((adpt_hba**) cmd->device->host->hostdata);
- printk(KERN_INFO"%s: Trying to Abort cmd=%ld\n",pHba->name, cmd->serial_number);
- if ((dptdevice = (void*) (cmd->device->hostdata)) == NULL) {
- printk(KERN_ERR "%s: Unable to abort: No device in cmnd\n",pHba->name);
-@@ -667,12 +826,24 @@ static int adpt_abort(struct scsi_cmnd *
- }
-
- memset(msg, 0, sizeof(msg));
-- msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1] = I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|dptdevice->tid;
-+ msg[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1] = cpu_to_le32(I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|dptdevice->tid);
- msg[2] = 0;
-- msg[3]= 0;
-- msg[4] = (u32)cmd;
-- if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){
-+ msg[3] = 0;
-+ if (sizeof(cmd) > sizeof(u32))
-+ msg[4] = (u32)cmd->serial_number;
-+ else
-+ msg[4] = (u32)(unsigned long)cmd; /* EVIL, not 64 bit safe, but faster */
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_lock_irq(pHba->host->host_lock);
-+#endif
-+ rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_unlock_irq(pHba->host->host_lock);
-+#endif
-+ if (rcode != 0) {
- if(rcode == -EOPNOTSUPP ){
- printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
- return FAILED;
-@@ -695,24 +866,33 @@ static int adpt_device_reset(struct scsi
- u32 msg[4];
- u32 rcode;
- int old_state;
-- struct adpt_device* d = (void*) cmd->device->hostdata;
-+ struct adpt_device* d = cmd->device->hostdata;
-
-- pHba = (void*) cmd->device->host->hostdata[0];
-+ pHba = *((adpt_hba**) cmd->device->host->hostdata);
- printk(KERN_INFO"%s: Trying to reset device\n",pHba->name);
- if (!d) {
- printk(KERN_INFO"%s: Reset Device: Device Not found\n",pHba->name);
- return FAILED;
- }
- memset(msg, 0, sizeof(msg));
-- msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1] = (I2O_DEVICE_RESET<<24|HOST_TID<<12|d->tid);
-+ msg[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1] = cpu_to_le32(I2O_DEVICE_RESET<<24|HOST_TID<<12|d->tid);
- msg[2] = 0;
- msg[3] = 0;
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_lock_irq(pHba->host->host_lock);
-+#endif
- old_state = d->state;
- d->state |= DPTI_DEV_RESET;
-- if( (rcode = adpt_i2o_post_wait(pHba, (void*)msg,sizeof(msg), FOREVER)) ){
-- d->state = old_state;
-+ rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
-+ d->state = old_state;
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_unlock_irq(pHba->host->host_lock);
-+#endif
-+ if (rcode != 0) {
- if(rcode == -EOPNOTSUPP ){
- printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
- return FAILED;
-@@ -720,7 +900,6 @@ static int adpt_device_reset(struct scsi
- printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
- return FAILED;
- } else {
-- d->state = old_state;
- printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
- return SUCCESS;
- }
-@@ -733,15 +912,27 @@ static int adpt_bus_reset(struct scsi_cm
- {
- adpt_hba* pHba;
- u32 msg[4];
-+ int channel;
-+ u32 rcode;
-
-- pHba = (adpt_hba*)cmd->device->host->hostdata[0];
-+ channel = scmd_channel(cmd);
-+ pHba = *((adpt_hba**)cmd->device->host->hostdata);
- memset(msg, 0, sizeof(msg));
-- printk(KERN_WARNING"%s: Bus reset: SCSI Bus %d: tid: %d\n",pHba->name, cmd->device->channel,pHba->channel[cmd->device->channel].tid );
-- msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
-+ printk(KERN_WARNING"%s: Bus reset: SCSI Bus %d: tid: %d\n",pHba->name, channel,pHba->channel[channel].tid );
-+ msg[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1] = cpu_to_le32(I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[channel].tid);
- msg[2] = 0;
- msg[3] = 0;
-- if(adpt_i2o_post_wait(pHba, (void*)msg,sizeof(msg), FOREVER) ){
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_lock_irq(pHba->host->host_lock);
-+#endif
-+ rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ if (pHba->host)
-+ spin_unlock_irq(pHba->host->host_lock);
-+#endif
-+ if (rcode) {
- printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
- return FAILED;
- } else {
-@@ -755,8 +946,11 @@ static int adpt_reset(struct scsi_cmnd*
- {
- adpt_hba* pHba;
- int rcode;
-- pHba = (adpt_hba*)cmd->device->host->hostdata[0];
-- printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,cmd->device->channel,pHba->channel[cmd->device->channel].tid );
-+ int channel;
-+
-+ channel = scmd_channel(cmd);
-+ pHba = *((adpt_hba**)cmd->device->host->hostdata);
-+ printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,channel,pHba->channel[channel].tid );
- rcode = adpt_hba_reset(pHba);
- if(rcode == 0){
- printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name);
-@@ -802,6 +996,8 @@ static int adpt_hba_reset(adpt_hba* pHba
- adpt_i2o_delete_hba(pHba);
- return rcode;
- }
-+ adpt_inquiry(pHba);
-+
- pHba->state &= ~DPTI_STATE_RESET;
-
- adpt_fail_posted_scbs(pHba);
-@@ -817,7 +1013,7 @@ static int adpt_hba_reset(adpt_hba* pHba
- static void adpt_i2o_sys_shutdown(void)
- {
- adpt_hba *pHba, *pNext;
-- struct adpt_i2o_post_wait_data *p1, *p2;
-+ struct adpt_i2o_post_wait_data *p1, *old;
-
- printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n");
- printk(KERN_INFO" This could take a few minutes if there are many devices attached\n");
-@@ -831,16 +1027,17 @@ static void adpt_i2o_sys_shutdown(void)
- }
-
- /* Remove any timedout entries from the wait queue. */
-- p2 = NULL;
- // spin_lock_irqsave(&adpt_post_wait_lock, flags);
- /* Nothing should be outstanding at this point so just
- * free them
- */
-- for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p2->next) {
-- kfree(p1);
-+ for(p1 = adpt_post_wait_queue; p1;) {
-+ old = p1;
-+ p1 = p1->next;
-+ kfree(old);
- }
- // spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
-- adpt_post_wait_queue = NULL;
-+ adpt_post_wait_queue = 0;
-
- printk(KERN_INFO "Adaptec I2O controllers down.\n");
- }
-@@ -866,264 +1063,39 @@ static int adpt_reboot_event(struct noti
- #endif
-
-
--static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev)
-+static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
- {
-+ struct adpt_device* d;
-
-- adpt_hba* pHba = NULL;
-- adpt_hba* p = NULL;
-- ulong base_addr0_phys = 0;
-- ulong base_addr1_phys = 0;
-- u32 hba_map0_area_size = 0;
-- u32 hba_map1_area_size = 0;
-- ulong base_addr_virt = 0;
-- ulong msg_addr_virt = 0;
--
-- int raptorFlag = FALSE;
-- int i;
-+ if(chan < 0 || chan >= MAX_CHANNEL)
-+ return NULL;
-
-- if(pci_enable_device(pDev)) {
-- return -EINVAL;
-+ if( pHba->channel[chan].device == NULL){
-+ printk(KERN_DEBUG"Adaptec I2O RAID: Trying to find device before they are allocated\n");
-+ return NULL;
- }
-- pci_set_master(pDev);
-- if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&
-- pci_set_dma_mask(pDev, 0xffffffffULL))
-- return -EINVAL;
-
-- base_addr0_phys = pci_resource_start(pDev,0);
-- hba_map0_area_size = pci_resource_len(pDev,0);
-+ if (id < 0 || id >= MAX_ID)
-+ return NULL;
-
-- // Check if standard PCI card or single BAR Raptor
-- if(pDev->device == PCI_DPT_DEVICE_ID){
-- if(pDev->subsystem_device >=0xc032 && pDev->subsystem_device <= 0xc03b){
-- // Raptor card with this device id needs 4M
-- hba_map0_area_size = 0x400000;
-- } else { // Not Raptor - it is a PCI card
-- if(hba_map0_area_size > 0x100000 ){
-- hba_map0_area_size = 0x100000;
-- }
-- }
-- } else {// Raptor split BAR config
-- // Use BAR1 in this configuration
-- base_addr1_phys = pci_resource_start(pDev,1);
-- hba_map1_area_size = pci_resource_len(pDev,1);
-- raptorFlag = TRUE;
-+ d = pHba->channel[chan].device[id];
-+ if(!d || d->tid == 0) {
-+ return NULL;
- }
-
--
-- base_addr_virt = (ulong)ioremap(base_addr0_phys,hba_map0_area_size);
-- if(base_addr_virt == 0) {
-- PERROR("dpti: adpt_config_hba: io remap failed\n");
-- return -EINVAL;
-+ /* If it is the only lun at that address then this should match*/
-+ if(d->scsi_lun == lun){
-+ return d;
- }
-
-- if(raptorFlag == TRUE) {
-- msg_addr_virt = (ulong)ioremap(base_addr1_phys, hba_map1_area_size );
-- if(msg_addr_virt == 0) {
-- PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");
-- iounmap((void*)base_addr_virt);
-- return -EINVAL;
-- }
-- } else {
-- msg_addr_virt = base_addr_virt;
-- }
--
-- // Allocate and zero the data structure
-- pHba = kmalloc(sizeof(adpt_hba), GFP_KERNEL);
-- if( pHba == NULL) {
-- if(msg_addr_virt != base_addr_virt){
-- iounmap((void*)msg_addr_virt);
-+ /* else we need to look through all the luns */
-+ for(d=d->next_lun ; d ; d = d->next_lun){
-+ if(d->scsi_lun == lun){
-+ return d;
- }
-- iounmap((void*)base_addr_virt);
-- return -ENOMEM;
- }
-- memset(pHba, 0, sizeof(adpt_hba));
--
-- down(&adpt_configuration_lock);
-- for(i=0;i<DPTI_MAX_HBA;i++) {
-- if(hbas[i]==NULL) {
-- hbas[i]=pHba;
-- break;
-- }
-- }
--
-- if(hba_chain != NULL){
-- for(p = hba_chain; p->next; p = p->next);
-- p->next = pHba;
-- } else {
-- hba_chain = pHba;
-- }
-- pHba->next = NULL;
-- pHba->unit = hba_count;
-- sprintf(pHba->name, "dpti%d", i);
-- hba_count++;
--
-- up(&adpt_configuration_lock);
--
-- pHba->pDev = pDev;
-- pHba->base_addr_phys = base_addr0_phys;
--
-- // Set up the Virtual Base Address of the I2O Device
-- pHba->base_addr_virt = base_addr_virt;
-- pHba->msg_addr_virt = msg_addr_virt;
-- pHba->irq_mask = (ulong)(base_addr_virt+0x30);
-- pHba->post_port = (ulong)(base_addr_virt+0x40);
-- pHba->reply_port = (ulong)(base_addr_virt+0x44);
--
-- pHba->hrt = NULL;
-- pHba->lct = NULL;
-- pHba->lct_size = 0;
-- pHba->status_block = NULL;
-- pHba->post_count = 0;
-- pHba->state = DPTI_STATE_RESET;
-- pHba->pDev = pDev;
-- pHba->devices = NULL;
--
-- // Initializing the spinlocks
-- spin_lock_init(&pHba->state_lock);
-- spin_lock_init(&adpt_post_wait_lock);
--
-- if(raptorFlag == 0){
-- printk(KERN_INFO"Adaptec I2O RAID controller %d at %lx size=%x irq=%d\n",
-- hba_count-1, base_addr_virt, hba_map0_area_size, pDev->irq);
-- } else {
-- printk(KERN_INFO"Adaptec I2O RAID controller %d irq=%d\n",hba_count-1, pDev->irq);
-- printk(KERN_INFO" BAR0 %lx - size= %x\n",base_addr_virt,hba_map0_area_size);
-- printk(KERN_INFO" BAR1 %lx - size= %x\n",msg_addr_virt,hba_map1_area_size);
-- }
--
-- if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ, pHba->name, pHba)) {
-- printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq);
-- adpt_i2o_delete_hba(pHba);
-- return -EINVAL;
-- }
--
-- return 0;
--}
--
--
--static void adpt_i2o_delete_hba(adpt_hba* pHba)
--{
-- adpt_hba* p1;
-- adpt_hba* p2;
-- struct i2o_device* d;
-- struct i2o_device* next;
-- int i;
-- int j;
-- struct adpt_device* pDev;
-- struct adpt_device* pNext;
--
--
-- down(&adpt_configuration_lock);
-- // scsi_unregister calls our adpt_release which
-- // does a quiese
-- if(pHba->host){
-- free_irq(pHba->host->irq, pHba);
-- }
-- for(i=0;i<DPTI_MAX_HBA;i++) {
-- if(hbas[i]==pHba) {
-- hbas[i] = NULL;
-- }
-- }
-- p2 = NULL;
-- for( p1 = hba_chain; p1; p2 = p1,p1=p1->next){
-- if(p1 == pHba) {
-- if(p2) {
-- p2->next = p1->next;
-- } else {
-- hba_chain = p1->next;
-- }
-- break;
-- }
-- }
--
-- hba_count--;
-- up(&adpt_configuration_lock);
--
-- iounmap((void*)pHba->base_addr_virt);
-- if(pHba->msg_addr_virt != pHba->base_addr_virt){
-- iounmap((void*)pHba->msg_addr_virt);
-- }
-- if(pHba->hrt) {
-- kfree(pHba->hrt);
-- }
-- if(pHba->lct){
-- kfree(pHba->lct);
-- }
-- if(pHba->status_block) {
-- kfree(pHba->status_block);
-- }
-- if(pHba->reply_pool){
-- kfree(pHba->reply_pool);
-- }
--
-- for(d = pHba->devices; d ; d = next){
-- next = d->next;
-- kfree(d);
-- }
-- for(i = 0 ; i < pHba->top_scsi_channel ; i++){
-- for(j = 0; j < MAX_ID; j++){
-- if(pHba->channel[i].device[j] != NULL){
-- for(pDev = pHba->channel[i].device[j]; pDev; pDev = pNext){
-- pNext = pDev->next_lun;
-- kfree(pDev);
-- }
-- }
-- }
-- }
-- kfree(pHba);
--
-- if(hba_count <= 0){
-- unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER);
-- }
--}
--
--
--static int adpt_init(void)
--{
-- int i;
--
-- printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
-- for (i = 0; i < DPTI_MAX_HBA; i++) {
-- hbas[i] = NULL;
-- }
--#ifdef REBOOT_NOTIFIER
-- register_reboot_notifier(&adpt_reboot_notifier);
--#endif
--
-- return 0;
--}
--
--
--static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
--{
-- struct adpt_device* d;
--
-- if(chan < 0 || chan >= MAX_CHANNEL)
-- return NULL;
--
-- if( pHba->channel[chan].device == NULL){
-- printk(KERN_DEBUG"Adaptec I2O RAID: Trying to find device before they are allocated\n");
-- return NULL;
-- }
--
-- d = pHba->channel[chan].device[id];
-- if(!d || d->tid == 0) {
-- return NULL;
-- }
--
-- /* If it is the only lun at that address then this should match*/
-- if(d->scsi_lun == lun){
-- return d;
-- }
--
-- /* else we need to look through all the luns */
-- for(d=d->next_lun ; d ; d = d->next_lun){
-- if(d->scsi_lun == lun){
-- return d;
-- }
-- }
-- return NULL;
--}
-+ return NULL;
-+}
-
-
- static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
-@@ -1136,12 +1108,12 @@ static int adpt_i2o_post_wait(adpt_hba*
- ulong flags = 0;
- struct adpt_i2o_post_wait_data *p1, *p2;
- struct adpt_i2o_post_wait_data *wait_data =
-- kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_KERNEL);
-- adpt_wait_queue_t wait;
-+ kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_ATOMIC);
-+ DECLARE_WAITQUEUE(wait, current);
-
-- if(!wait_data){
-+ if (!wait_data)
- return -ENOMEM;
-- }
-+
- /*
- * The spin locking is needed to keep anyone from playing
- * with the queue pointers and id while we do the same
-@@ -1152,47 +1124,110 @@ static int adpt_i2o_post_wait(adpt_hba*
- wait_data->next = adpt_post_wait_queue;
- adpt_post_wait_queue = wait_data;
- adpt_post_wait_id++;
-- adpt_post_wait_id &= 0x7fff;
-+ adpt_post_wait_id = (adpt_post_wait_id & 0x7fff);
- wait_data->id = adpt_post_wait_id;
- spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
-
- wait_data->wq = &adpt_wq_i2o_post;
- wait_data->status = -ETIMEDOUT;
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ add_wait_queue(&adpt_wq_i2o_post, &wait);
-+#else
- // this code is taken from kernel/sched.c:interruptible_sleep_on_timeout
- wait.task = current;
-- init_waitqueue_entry(&wait, current);
-- spin_lock_irqsave(&adpt_wq_i2o_post.lock, flags);
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+ write_lock_irqsave(&waitqueue_lock,flags);
- __add_wait_queue(&adpt_wq_i2o_post, &wait);
-- spin_unlock(&adpt_wq_i2o_post.lock);
-+ write_unlock(&waitqueue_lock);
-+#else
-+ add_wait_queue(&adpt_wq_i2o_post, &wait);
-+//#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+// init_waitqueue_entry(&wait, current);
-+// spin_lock_irqsave(&adpt_wq_i2o_post.lock,flags);
-+// __add_wait_queue(&adpt_wq_i2o_post, &wait);
-+// spin_unlock(&adpt_wq_i2o_post.lock);
-+//#else
-+// init_waitqueue_entry(&wait, current);
-+// wq_write_lock_irqsave(&adpt_wq_i2o_post.lock,flags);
-+// __add_wait_queue(&adpt_wq_i2o_post, &wait);
-+// wq_write_unlock(&adpt_wq_i2o_post.lock);
-+#endif
-+#endif
-
- msg[2] |= 0x80000000 | ((u32)wait_data->id);
- timeout *= HZ;
- if((status = adpt_i2o_post_this(pHba, msg, len)) == 0){
-+ spinlock_t * was_locked = (spinlock_t *)NULL;
- set_current_state(TASK_INTERRUPTIBLE);
-- if(pHba->host)
-- spin_unlock_irq(pHba->host->host_lock);
-- if (!timeout)
-+ /*
-+ * We are called before the host & host lock has been
-+ * assigned, and may be called with, or without, the host lock
-+ * held. We need to free the lock, if held, before going
-+ * to sleep.
-+ */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+#if 0
-+ if ((pHba->host != NULL) /* Sad */
-+ && (spin_is_locked(pHba->host->host_lock))) {
-+#else
-+ if (pHba->host != NULL) { /* Sad */
-+#endif
-+ was_locked = pHba->host->host_lock;
-+ spin_unlock_irq(was_locked);
-+ }
-+#else
-+ if (spin_is_locked(&io_request_lock)) {
-+ was_locked = &io_request_lock;
-+ spin_unlock_irq(was_locked);
-+ }
-+#endif
-+ if(!timeout){
- schedule();
-- else{
-+ } else {
- timeout = schedule_timeout(timeout);
- if (timeout == 0) {
- // I/O issued, but cannot get result in
-- // specified time. Freeing resorces is
-+ // specified time. Freeing resources is
- // dangerous.
- status = -ETIME;
- }
-- schedule_timeout(timeout*HZ);
- }
-- if(pHba->host)
-- spin_lock_irq(pHba->host->host_lock);
-+ if (was_locked)
-+ spin_lock_irq(was_locked);
-+ if (signal_pending(current)) {
-+ printk("adpt_i2o_post_wait: interrupted\n");
-+ status = -EINTR;
-+ }
- }
-- spin_lock_irq(&adpt_wq_i2o_post.lock);
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-+ remove_wait_queue(&adpt_wq_i2o_post, &wait);
-+#else
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+ write_lock_irq(&waitqueue_lock);
- __remove_wait_queue(&adpt_wq_i2o_post, &wait);
-- spin_unlock_irqrestore(&adpt_wq_i2o_post.lock, flags);
-+ write_unlock_irqrestore(&waitqueue_lock,flags);
-+#else
-+ remove_wait_queue(&adpt_wq_i2o_post, &wait);
-+//#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+// spin_lock_irq(&adpt_wq_i2o_post.lock);
-+// __remove_wait_queue(&adpt_wq_i2o_post, &wait);
-+// spin_unlock_irqrestore(&adpt_wq_i2o_post.lock,flags);
-+//#else
-+// wq_write_lock_irq(&adpt_wq_i2o_post.lock);
-+// __remove_wait_queue(&adpt_wq_i2o_post, &wait);
-+// wq_write_unlock_irqrestore(&adpt_wq_i2o_post.lock,flags);
-+#endif
-+#endif
-+
-+ wait_data->wq = 0;
-+
-+ if (status == -EINTR)
-+ return status;
-
-- if(status == -ETIMEDOUT){
-- printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit);
-+ if(status == -ETIMEDOUT || status == -ETIME) {
-+ printk(KERN_INFO"dpti%d: POST WAIT FAILED (%d)\n",
-+ pHba->unit, status);
- // We will have to free the wait_data memory during shutdown
- return status;
- }
-@@ -1225,7 +1260,7 @@ static s32 adpt_i2o_post_this(adpt_hba*
- {
-
- u32 m = EMPTY_QUEUE;
-- u32 *msg;
-+ u32 __iomem *msg;
- ulong timeout = jiffies + 30*HZ;
- do {
- rmb();
-@@ -1237,11 +1272,9 @@ static s32 adpt_i2o_post_this(adpt_hba*
- printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit);
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
- } while(m == EMPTY_QUEUE);
-
-- msg = (u32*) (pHba->msg_addr_virt + m);
-+ msg = (u32 __iomem*) (pHba->msg_addr_virt + m);
- memcpy_toio(msg, data, len);
- wmb();
-
-@@ -1276,12 +1309,13 @@ static void adpt_i2o_post_wait_complete(
- if(p1->id == context) {
- p1->status = status;
- spin_unlock(&adpt_post_wait_lock);
-- wake_up_interruptible(p1->wq);
-+ if (p1->wq)
-+ wake_up_interruptible(p1->wq);
- return;
- }
- }
- spin_unlock(&adpt_post_wait_lock);
-- // If this happens we lose commands that probably really completed
-+ // If this happens we loose commands that probably really completed
- printk(KERN_DEBUG"dpti: Could Not find task %d in wait queue\n",context);
- printk(KERN_DEBUG" Tasks in wait queue:\n");
- for(p1 = adpt_post_wait_queue; p1; p1 = p1->next) {
-@@ -1294,10 +1328,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba*
- {
- u32 msg[8];
- u8* status;
-+ dma_addr_t addr;
-+ u64 addr64;
- u32 m = EMPTY_QUEUE ;
- ulong timeout = jiffies + (TMOUT_IOPRESET*HZ);
-
-- if(pHba->initialized == FALSE) { // First time reset should be quick
-+ if(pHba->initialized == 0) { // First time reset should be quick
- timeout = jiffies + (25*HZ);
- } else {
- adpt_i2o_quiesce_hba(pHba);
-@@ -1306,18 +1342,16 @@ static s32 adpt_i2o_reset_hba(adpt_hba*
- do {
- rmb();
- m = readl(pHba->post_port);
-- if (m != EMPTY_QUEUE) {
-+ if (m != cpu_to_le32(EMPTY_QUEUE)) {
- break;
- }
- if(time_after(jiffies,timeout)){
- printk(KERN_WARNING"Timeout waiting for message!\n");
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
-- } while (m == EMPTY_QUEUE);
-+ } while (m == cpu_to_le32(EMPTY_QUEUE));
-
-- status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32);
-+ status = (u8*)pci_alloc_consistent(pHba->pDev, 4, &addr);
- if(status == NULL) {
- adpt_send_nop(pHba, m);
- printk(KERN_ERR"IOP reset failed - no free memory.\n");
-@@ -1325,16 +1359,17 @@ static s32 adpt_i2o_reset_hba(adpt_hba*
- }
- memset(status,0,4);
-
-- msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID;
-+ msg[0]=cpu_to_le32(EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1]=cpu_to_le32(I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID);
- msg[2]=0;
- msg[3]=0;
- msg[4]=0;
- msg[5]=0;
-- msg[6]=virt_to_bus(status);
-- msg[7]=0;
-+ addr64 = cpu_to_le64(addr);
-+ msg[6]=(u32)addr64;
-+ msg[7]=(u32)(addr64 >> 32);
-
-- memcpy_toio(pHba->msg_addr_virt+m, msg, sizeof(msg));
-+ memcpy_toio(pHba->msg_addr_virt+le32_to_cpu(m), msg, sizeof(msg));
- wmb();
- writel(m, pHba->post_port);
- wmb();
-@@ -1342,44 +1377,47 @@ static s32 adpt_i2o_reset_hba(adpt_hba*
- while(*status == 0){
- if(time_after(jiffies,timeout)){
- printk(KERN_WARNING"%s: IOP Reset Timeout\n",pHba->name);
-- kfree(status);
-+ /* We loose 4 bytes of "status" here, but we cannot
-+ free these because controller may awake and corrupt
-+ those bytes at any time */
-+ /* pci_free_consistent(pHba->pDev, 4, buf, addr); */
- return -ETIMEDOUT;
- }
- rmb();
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
- }
-
-- if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) {
-+ if(*status == cpu_to_le32(0x01) /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) {
- PDEBUG("%s: Reset in progress...\n", pHba->name);
- // Here we wait for message frame to become available
- // indicated that reset has finished
- do {
- rmb();
- m = readl(pHba->post_port);
-- if (m != EMPTY_QUEUE) {
-+ if (m != cpu_to_le32(EMPTY_QUEUE)) {
- break;
- }
- if(time_after(jiffies,timeout)){
- printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name);
-+ /* We loose 4 bytes of "status" here, but we
-+ cannot free these because controller may
-+ awake and corrupt those bytes at any time */
-+ /* pci_free_consistent(pHba->pDev, 4, buf, addr); */
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
-- } while (m == EMPTY_QUEUE);
-+ } while (m == cpu_to_le32(EMPTY_QUEUE));
- // Flush the offset
- adpt_send_nop(pHba, m);
- }
- adpt_i2o_status_get(pHba);
-- if(*status == 0x02 ||
-- pHba->status_block->iop_state != ADAPTER_STATE_RESET) {
-+ if(*status == cpu_to_le32(0x02) ||
-+ pHba->status_block_va->iop_state != cpu_to_le32(ADAPTER_STATE_RESET)) {
- printk(KERN_WARNING"%s: Reset reject, trying to clear\n",
- pHba->name);
- } else {
- PDEBUG("%s: Reset completed.\n", pHba->name);
- }
-
-- kfree(status);
-+ pci_free_consistent(pHba->pDev, 4, status, addr);
- #ifdef UARTDELAY
- // This delay is to allow someone attached to the card through the debug UART to
- // set up the dump levels that they want before the rest of the initialization sequence
-@@ -1395,7 +1433,7 @@ static int adpt_i2o_parse_lct(adpt_hba*
- int max;
- int tid;
- struct i2o_device *d;
-- i2o_lct *lct = pHba->lct;
-+ i2o_lct *lct = pHba->lct_va;
- u8 bus_no = 0;
- s16 scsi_id;
- s16 scsi_lun;
-@@ -1412,7 +1450,7 @@ static int adpt_i2o_parse_lct(adpt_hba*
- max /= 9;
-
- for(i=0;i<max;i++) {
-- if( lct->lct_entry[i].user_tid != 0xfff){
-+ if( lct->lct_entry[i].user_tid != cpu_to_le32(0xfff)){
- /*
- * If we have hidden devices, we need to inform the upper layers about
- * the possible maximum id reference to handle device access when
-@@ -1420,12 +1458,12 @@ static int adpt_i2o_parse_lct(adpt_hba*
- * allow us future access to devices that are currently hidden
- * behind arrays, hotspares or have not been configured (JBOD mode).
- */
-- if( lct->lct_entry[i].class_id != I2O_CLASS_RANDOM_BLOCK_STORAGE &&
-- lct->lct_entry[i].class_id != I2O_CLASS_SCSI_PERIPHERAL &&
-- lct->lct_entry[i].class_id != I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL ){
-+ if( lct->lct_entry[i].class_id != cpu_to_le32(I2O_CLASS_RANDOM_BLOCK_STORAGE) &&
-+ lct->lct_entry[i].class_id != cpu_to_le32(I2O_CLASS_SCSI_PERIPHERAL) &&
-+ lct->lct_entry[i].class_id != cpu_to_le32(I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL) ){
- continue;
- }
-- tid = lct->lct_entry[i].tid;
-+ tid = le32_to_cpu(lct->lct_entry[i].tid);
- // I2O_DPT_DEVICE_INFO_GROUP_NO;
- if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)<0) {
- continue;
-@@ -1437,7 +1475,7 @@ static int adpt_i2o_parse_lct(adpt_hba*
- printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
- continue;
- }
-- if (scsi_id >= MAX_ID){
-+ if(scsi_id > MAX_ID){
- printk(KERN_WARNING"%s: SCSI ID %d out of range \n", pHba->name, bus_no);
- continue;
- }
-@@ -1452,34 +1490,34 @@ static int adpt_i2o_parse_lct(adpt_hba*
- }
- continue;
- }
-- d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
-+ d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_ATOMIC);
- if(d==NULL)
- {
- printk(KERN_CRIT"%s: Out of memory for I2O device data.\n",pHba->name);
- return -ENOMEM;
- }
-
-- d->controller = (void*)pHba;
-+ d->controller = pHba;
- d->next = NULL;
-
- memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry));
-
- d->flags = 0;
-- tid = d->lct_data.tid;
-+ tid = le32_to_cpu(d->lct_data.tid);
- adpt_i2o_report_hba_unit(pHba, d);
- adpt_i2o_install_device(pHba, d);
- }
- bus_no = 0;
- for(d = pHba->devices; d ; d = d->next) {
-- if(d->lct_data.class_id == I2O_CLASS_BUS_ADAPTER_PORT ||
-- d->lct_data.class_id == I2O_CLASS_FIBRE_CHANNEL_PORT){
-- tid = d->lct_data.tid;
-+ if(d->lct_data.class_id == cpu_to_le32(I2O_CLASS_BUS_ADAPTER_PORT) ||
-+ d->lct_data.class_id == cpu_to_le32(I2O_CLASS_FIBRE_CHANNEL_PORT)){
-+ tid = le32_to_cpu(d->lct_data.tid);
- // TODO get the bus_no from hrt-but for now they are in order
- //bus_no =
- if(bus_no > pHba->top_scsi_channel){
- pHba->top_scsi_channel = bus_no;
- }
-- pHba->channel[bus_no].type = d->lct_data.class_id;
-+ pHba->channel[bus_no].type = le32_to_cpu(d->lct_data.class_id);
- pHba->channel[bus_no].tid = tid;
- if(adpt_i2o_query_scalar(pHba, tid, 0x0200, -1, buf, 28)>=0)
- {
-@@ -1497,11 +1535,11 @@ static int adpt_i2o_parse_lct(adpt_hba*
-
- // Setup adpt_device table
- for(d = pHba->devices; d ; d = d->next) {
-- if(d->lct_data.class_id == I2O_CLASS_RANDOM_BLOCK_STORAGE ||
-- d->lct_data.class_id == I2O_CLASS_SCSI_PERIPHERAL ||
-- d->lct_data.class_id == I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL ){
-+ if(d->lct_data.class_id == cpu_to_le32(I2O_CLASS_RANDOM_BLOCK_STORAGE) ||
-+ d->lct_data.class_id == cpu_to_le32(I2O_CLASS_SCSI_PERIPHERAL) ||
-+ d->lct_data.class_id == cpu_to_le32(I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL) ){
-
-- tid = d->lct_data.tid;
-+ tid = le32_to_cpu(d->lct_data.tid);
- scsi_id = -1;
- // I2O_DPT_DEVICE_INFO_GROUP_NO;
- if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)>=0) {
-@@ -1511,11 +1549,11 @@ static int adpt_i2o_parse_lct(adpt_hba*
- if(bus_no >= MAX_CHANNEL) { // Something wrong skip it
- continue;
- }
-- if (scsi_id >= MAX_ID) {
-+ if(scsi_id > MAX_ID){
- continue;
- }
- if( pHba->channel[bus_no].device[scsi_id] == NULL){
-- pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL);
-+ pDev = kmalloc(sizeof(struct adpt_device),GFP_ATOMIC);
- if(pDev == NULL) {
- return -ENOMEM;
- }
-@@ -1525,7 +1563,7 @@ static int adpt_i2o_parse_lct(adpt_hba*
- for( pDev = pHba->channel[bus_no].device[scsi_id];
- pDev->next_lun; pDev = pDev->next_lun){
- }
-- pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL);
-+ pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_ATOMIC);
- if(pDev->next_lun == NULL) {
- return -ENOMEM;
- }
-@@ -1564,7 +1602,11 @@ static int adpt_i2o_parse_lct(adpt_hba*
-
- static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d)
- {
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
- d->controller=pHba;
- d->owner=NULL;
- d->next=pHba->devices;
-@@ -1575,7 +1617,11 @@ static int adpt_i2o_install_device(adpt_
- pHba->devices=d;
- *d->dev_name = 0;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
- return 0;
- }
-
-@@ -1590,24 +1636,40 @@ static int adpt_open(struct inode *inode
- if (minor >= hba_count) {
- return -ENXIO;
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
- for (pHba = hba_chain; pHba; pHba = pHba->next) {
- if (pHba->unit == minor) {
- break; /* found adapter */
- }
- }
- if (pHba == NULL) {
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
- return -ENXIO;
- }
-
- // if(pHba->in_use){
-- // up(&adpt_configuration_lock);
-+//#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+// up(&adpt_configuration_lock);
-+//#else
-+// mutex_unlock(&adpt_configuration_lock);
-+//#endif
- // return -EBUSY;
- // }
-
- pHba->in_use = 1;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
-
- return 0;
- }
-@@ -1621,13 +1683,21 @@ static int adpt_close(struct inode *inod
- if (minor >= hba_count) {
- return -ENXIO;
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
- for (pHba = hba_chain; pHba; pHba = pHba->next) {
- if (pHba->unit == minor) {
- break; /* found adapter */
- }
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
- if (pHba == NULL) {
- return -ENXIO;
- }
-@@ -1637,22 +1707,22 @@ static int adpt_close(struct inode *inod
- return 0;
- }
-
--
- static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
- {
- u32 msg[MAX_MESSAGE_SIZE];
- u32* reply = NULL;
- u32 size = 0;
- u32 reply_size = 0;
-- u32 __user *user_msg = arg;
-- u32 __user * user_reply = NULL;
-- void *sg_list[pHba->sg_tablesize];
-+ u32* user_msg = (u32*)arg;
-+ u32* user_reply = NULL;
-+ void * sg_list[pHba->sg_tablesize];
- u32 sg_offset = 0;
- u32 sg_count = 0;
- int sg_index = 0;
- u32 i = 0;
- u32 rcode = 0;
-- void *p = NULL;
-+ void * p = 0;
-+ dma_addr_t addr;
- ulong flags = 0;
-
- memset(&msg, 0, MAX_MESSAGE_SIZE*4);
-@@ -1678,7 +1748,7 @@ static int adpt_i2o_passthru(adpt_hba* p
- reply_size = REPLY_FRAME_SIZE;
- }
- reply_size *= 4;
-- reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL);
-+ reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_ATOMIC);
- if(reply == NULL) {
- printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name);
- return -ENOMEM;
-@@ -1686,10 +1756,34 @@ static int adpt_i2o_passthru(adpt_hba* p
- memset(reply,0,REPLY_FRAME_SIZE*4);
- sg_offset = (msg[0]>>4)&0xf;
- msg[2] = 0x40000000; // IOCTL context
-- msg[3] = (u32)reply;
-+ if (sizeof(reply) > sizeof(u32)) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_lock_irqsave(pHba->host->host_lock, flags);
-+#else
-+ spin_lock_irqsave(&io_request_lock, flags);
-+#endif
-+ for (i = 0; i < (sizeof(pHba->ioctl_reply_context) / sizeof(pHba->ioctl_reply_context[0])); ++i) {
-+ if (pHba->ioctl_reply_context[i] == NULL) {
-+ pHba->ioctl_reply_context[i] = reply;
-+ break;
-+ }
-+ }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+#else
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+#endif
-+ if (i >= (sizeof(pHba->ioctl_reply_context) / sizeof(pHba->ioctl_reply_context[0]))) {
-+ kfree (reply);
-+ printk(KERN_WARNING"%s: Too many outstanding ioctl commands\n",pHba->name);
-+ return -EBUSY;
-+ }
-+ msg[3] = i;
-+ } else
-+ msg[3] = (u32)reply; // EVIL, not 64 bit safe but dealt with
- memset(sg_list,0, sizeof(sg_list[0])*pHba->sg_tablesize);
- if(sg_offset) {
-- // TODO 64bit fix
-+ // TODO 64 bit fix ?
- struct sg_simple_element *sg = (struct sg_simple_element*) (msg+sg_offset);
- sg_count = (size - sg_offset*4) / sizeof(struct sg_simple_element);
- if (sg_count > pHba->sg_tablesize){
-@@ -1708,43 +1802,52 @@ static int adpt_i2o_passthru(adpt_hba* p
- }
- sg_size = sg[i].flag_count & 0xffffff;
- /* Allocate memory for the transfer */
-- p = kmalloc(sg_size, GFP_KERNEL|ADDR32);
-- if(!p) {
-+ p = pci_alloc_consistent(pHba->pDev, sg_size, &addr);
-+ if(p == 0) {
- printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
- pHba->name,sg_size,i,sg_count);
- rcode = -ENOMEM;
- goto cleanup;
- }
- sg_list[sg_index++] = p; // sglist indexed with input frame, not our internal frame.
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)addr >> 32) != 0) ) {
-+ printk(KERN_DEBUG"%s: Could not allocate SG buffer in 32 space - size = %d buffer number %d of %d\n",
-+ pHba->name,sg_size,i,sg_count);
-+ rcode = -ENOMEM;
-+ goto cleanup;
-+ }
- /* Copy in the user's SG buffer if necessary */
- if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) {
-- // TODO 64bit fix
-- if (copy_from_user(p,(void __user *)sg[i].addr_bus, sg_size)) {
-+ // TODO 64 bit fix?
-+ if (copy_from_user((void*)p,(void*)sg[i].addr_bus, sg_size)) {
- printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",pHba->name,i);
- rcode = -EFAULT;
- goto cleanup;
- }
- }
- //TODO 64bit fix
-- sg[i].addr_bus = (u32)virt_to_bus(p);
-+ sg[i].addr_bus = cpu_to_le32(addr);
- }
- }
-
- do {
-- if(pHba->host)
-- spin_lock_irqsave(pHba->host->host_lock, flags);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_lock_irqsave(pHba->host->host_lock, flags);
-+#else
-+ spin_lock_irqsave(&io_request_lock, flags);
-+#endif
- // This state stops any new commands from enterring the
- // controller while processing the ioctl
- // pHba->state |= DPTI_STATE_IOCTL;
- // We can't set this now - The scsi subsystem sets host_blocked and
- // the queue empties and stops. We need a way to restart the queue
- rcode = adpt_i2o_post_wait(pHba, msg, size, FOREVER);
-- if (rcode != 0)
-- printk("adpt_i2o_passthru: post wait failed %d %p\n",
-- rcode, reply);
- // pHba->state &= ~DPTI_STATE_IOCTL;
-- if(pHba->host)
-- spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+#else
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+#endif
- } while(rcode == -ETIMEDOUT);
-
- if(rcode){
-@@ -1768,7 +1871,7 @@ static int adpt_i2o_passthru(adpt_hba* p
- size = size>>16;
- size *= 4;
- /* Copy in the user's I2O command */
-- if (copy_from_user (msg, user_msg, size)) {
-+ if (copy_from_user ((void*)msg, (void*)user_msg, size)) {
- rcode = -EFAULT;
- goto cleanup;
- }
-@@ -1780,8 +1883,8 @@ static int adpt_i2o_passthru(adpt_hba* p
- /* Copy out the SG list to user's buffer if necessary */
- if(! (sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) {
- sg_size = sg[j].flag_count & 0xffffff;
-- // TODO 64bit fix
-- if (copy_to_user((void __user *)sg[j].addr_bus,sg_list[j], sg_size)) {
-+ // TODO 64bit fix, source currently 32 bit app
-+ if (copy_to_user((void*)sg[j].addr_bus,sg_list[j], sg_size)) {
- printk(KERN_WARNING"%s: Could not copy %p TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus);
- rcode = -EFAULT;
- goto cleanup;
-@@ -1805,12 +1908,13 @@ static int adpt_i2o_passthru(adpt_hba* p
-
-
- cleanup:
-- if (rcode != -ETIME && rcode != -EINTR)
-+ if (rcode != -ETIME && rcode != -EINTR) {
-+ struct sg_simple_element *sg = (struct sg_simple_element*) (msg+sg_offset);
- kfree (reply);
-- while(sg_index) {
-- if(sg_list[--sg_index]) {
-- if (rcode != -ETIME && rcode != -EINTR)
-- kfree(sg_list[sg_index]);
-+ while(sg_index) {
-+ if(sg_list[--sg_index]) {
-+ pci_free_consistent(pHba->pDev, sg[sg_index].flag_count & 0xffffff, sg_list[sg_index], le32_to_cpu(sg[sg_index].addr_bus));
-+ }
- }
- }
- return rcode;
-@@ -1823,26 +1927,28 @@ cleanup:
- */
-
- /* Get all the info we can not get from kernel services */
--static int adpt_system_info(void __user *buffer)
-+static int adpt_system_info(void *buffer)
- {
- sysInfo_S si;
-
- memset(&si, 0, sizeof(si));
-
- si.osType = OS_LINUX;
-+#ifdef LINUX_VERSION_CODE
- si.osMajorVersion = (u8) (LINUX_VERSION_CODE >> 16);
- si.osMinorVersion = (u8) (LINUX_VERSION_CODE >> 8 & 0x0ff);
- si.osRevision = (u8) (LINUX_VERSION_CODE & 0x0ff);
-+#endif
- si.busType = SI_PCI_BUS;
- si.processorFamily = DPTI_sig.dsProcessorFamily;
-
- #if defined __i386__
- adpt_i386_info(&si);
--#elif defined (__ia64__)
-+#elif defined __ia64__
- adpt_ia64_info(&si);
--#elif defined(__sparc__)
-+#elif defined __sparc__
- adpt_sparc_info(&si);
--#elif defined (__alpha__)
-+#elif defined __alpha__
- adpt_alpha_info(&si);
- #else
- si.processorType = 0xff ;
-@@ -1861,7 +1967,7 @@ static void adpt_ia64_info(sysInfo_S* si
- // This is all the info we need for now
- // We will add more info as our new
- // managmenent utility requires it
-- si->processorType = PROC_IA64;
-+ si->processorType = PROC_ITANIUM;
- }
- #endif
-
-@@ -1911,6 +2017,35 @@ static void adpt_i386_info(sysInfo_S* si
-
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+#if 0
-+static int adpt_busy(struct device * dev, void * arg)
-+{
-+#if 0
-+ TARGET_BUSY_T * busy = (TARGET_BUSY_T *)arg;
-+ struct scsi_device * sdev = to_scsi_device(dev);
-+
-+ if ((busy->isBusy == sdev->host->host_no)
-+ && (busy->channel == sdev->channel)
-+ && (busy->id == sdev->id)
-+ && (busy->lun == sdev->lun)
-+ && (0))
-+/* Enumerate through gendisk */
-+/* struct scsi_disk->disk */
-+if (disk & GENHD_FL_DRIVERFS)
-+struct gendisk * disk;
-+disk->driverfs_dev = &sdev->sdev_gendev = dev;
-+if (disk & GENHD_FL_UP)
-+struct block_device = * bdev;
-+bdev = bdget_disk(disk, 0);
-+bdev->bd_dev + (1 < disk->minors)
-+blkdev_put (bdev);
-+ return 1;
-+#endif
-+ return 0;
-+}
-+#endif
-+#endif
-
- static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
- ulong arg)
-@@ -1919,25 +2054,32 @@ static int adpt_ioctl(struct inode *inod
- int error = 0;
- adpt_hba* pHba;
- ulong flags = 0;
-- void __user *argp = (void __user *)arg;
-
- minor = iminor(inode);
- if (minor >= DPTI_MAX_HBA){
- return -ENXIO;
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
- for (pHba = hba_chain; pHba; pHba = pHba->next) {
- if (pHba->unit == minor) {
- break; /* found adapter */
- }
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
- if(pHba == NULL){
- return -ENXIO;
- }
-
- while((volatile u32) pHba->state & DPTI_STATE_RESET ) {
-- set_task_state(current,TASK_UNINTERRUPTIBLE);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(2);
-
- }
-@@ -1945,12 +2087,12 @@ static int adpt_ioctl(struct inode *inod
- switch (cmd) {
- // TODO: handle 3 cases
- case DPT_SIGNATURE:
-- if (copy_to_user(argp, &DPTI_sig, sizeof(DPTI_sig))) {
-+ if (copy_to_user((void __user *)arg, &DPTI_sig, sizeof(DPTI_sig))) {
- return -EFAULT;
- }
- break;
- case I2OUSRCMD:
-- return adpt_i2o_passthru(pHba, argp);
-+ return adpt_i2o_passthru(pHba, (u32 __user *)arg);
-
- case DPT_CTRLINFO:{
- drvrHBAinfo_S HbaInfo;
-@@ -1966,113 +2108,254 @@ static int adpt_ioctl(struct inode *inod
- HbaInfo.pciDeviceNum=PCI_SLOT(pHba->pDev->devfn);
- HbaInfo.Interrupt = pHba->pDev->irq;
- HbaInfo.hbaFlags = FLG_OSD_PCI_VALID | FLG_OSD_DMA | FLG_OSD_I2O;
-- if(copy_to_user(argp, &HbaInfo, sizeof(HbaInfo))){
-+ if(copy_to_user((void __user *)arg, &HbaInfo, sizeof(HbaInfo))){
- printk(KERN_WARNING"%s: Could not copy HbaInfo TO user\n",pHba->name);
- return -EFAULT;
- }
- break;
- }
- case DPT_SYSINFO:
-- return adpt_system_info(argp);
-+ return adpt_system_info((void*)arg);
- case DPT_BLINKLED:{
- u32 value;
- value = (u32)adpt_read_blink_led(pHba);
-- if (copy_to_user(argp, &value, sizeof(value))) {
-+ if (copy_to_user((void __user *)arg, &value, sizeof(value))) {
- return -EFAULT;
- }
- break;
- }
- case I2ORESETCMD:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
- if(pHba->host)
- spin_lock_irqsave(pHba->host->host_lock, flags);
-+#else
-+ spin_lock_irqsave(&io_request_lock, flags);
-+#endif
- adpt_hba_reset(pHba);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
- if(pHba->host)
- spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+#else
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+#endif
- break;
- case I2ORESCANCMD:
- adpt_rescan(pHba);
- break;
-- default:
-- return -EINVAL;
-- }
--
-- return error;
--}
-+ case DPT_TARGET_BUSY & 0xFFFF:
-+ case DPT_TARGET_BUSY:
-+ {
-+ TARGET_BUSY_T busy;
-
-+ if (copy_from_user((void*)&busy, (void*)arg, sizeof(TARGET_BUSY_T))) {
-+ return -EFAULT;
-+ }
-
--static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
--{
-- struct scsi_cmnd* cmd;
-- adpt_hba* pHba = dev_id;
-- u32 m;
-- ulong reply;
-- u32 status=0;
-- u32 context;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+#if 0
-+ if (bd_claim(inode->i_bdev, pHba))
-+ busy.isBusy = 1;
-+ else {
-+ extern struct bus_type scsi_bus_type;
-+ bd_release(inode->i_bdev);
-+ busy.isBusy = pHba->unit;
-+ busy.isBusy = bus_for_each_dev(&scsi_bus_type, NULL, &busy, adpt_busy);
-+ }
-+#else
-+ busy.isBusy = 0;
-+#endif
-+#else
-+ {
-+ struct adpt_device* d;
-+ d = adpt_find_device(pHba, busy.channel, busy.id, busy.lun);
-+ if (!d)
-+ return -ENODEV;
-+ busy.isBusy = ((d->pScsi_dev)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-+ && (atomic_read(&d->pScsi_dev->access_count)
-+ || test_bit(SHOST_RECOVERY, &pHba->host->shost_state)));
-+#else
-+ && (d->pScsi_dev->access_count
-+ || pHba->host->in_recovery));
-+#endif
-+ }
-+#endif
-+ if (copy_to_user ((char*)arg, &busy, sizeof(busy))) {
-+ return -EFAULT;
-+ }
-+ break;
-+ }
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ return error;
-+}
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11))
-+#ifdef CONFIG_COMPAT
-+static long adpt_compat_ioctl(struct file * file, unsigned cmd, unsigned long arg)
-+{
-+ long ret;
-+ lock_kernel();
-+ ret = adpt_ioctl(file->f_dentry->d_inode, file, cmd, arg);
-+ unlock_kernel();
-+ return ret;
-+}
-+#endif
-+#endif
-+
-+static inline struct scsi_cmnd * adpt_cmd_from_context(adpt_hba * pHba, u32 context)
-+{
-+ struct scsi_cmnd * cmd;
-+
-+ if (context == 0)
-+ return NULL;
-+ if (sizeof(cmd) > sizeof(u32)) {
-+ struct scsi_device * d;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+# if ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) || defined(shost_for_each_device))
-+ spin_unlock(pHba->host->host_lock);
-+ shost_for_each_device(d, pHba->host) {
-+# else
-+ list_for_each_entry(d, &pHba->host->my_devices, siblings) {
-+# endif
-+ unsigned long flags;
-+ spin_lock_irqsave(&d->list_lock, flags);
-+ list_for_each_entry(cmd, &d->cmd_list, list) {
-+ if (((u32)cmd->serial_number == context)
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
-+ || ((u32)cmd->serial_number_at_timeout == context)
-+#endif
-+ ) {
-+ spin_unlock_irqrestore(&d->list_lock, flags);
-+ scsi_device_put(d);
-+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+ spin_lock(pHba->host->host_lock);
-+# endif
-+ return cmd;
-+ }
-+ }
-+ spin_unlock_irqrestore(&d->list_lock, flags);
-+ }
-+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+ spin_lock(pHba->host->host_lock);
-+# endif
-+#else
-+ d = pHba->host->host_queue;
-+ while (d) {
-+ for (cmd = d->device_queue; cmd ; cmd = cmd->next)
-+ if (((u32)cmd->serial_number == context)
-+ || ((u32)cmd->serial_number_at_timeout == context))
-+ return cmd;
-+ d = d->next;
-+ }
-+#endif
-+ } else
-+ return (struct scsi_cmnd*)(unsigned long)context; /* 64 bit! */
-+ return NULL;
-+}
-+
-+static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
-+{
-+ struct scsi_cmnd* cmd;
-+ adpt_hba* pHba = dev_id;
-+ u32 m;
-+ void __iomem * reply = (void __iomem *)-1L;
-+ u32 status=0;
-+ u32 context;
- ulong flags = 0;
-- int handled = 0;
-
-- if (pHba == NULL){
-+ if (pHba == NULL ){
- printk(KERN_WARNING"adpt_isr: NULL dev_id\n");
- return IRQ_NONE;
- }
-- if(pHba->host)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ if (pHba->host != NULL) /* Sad */
- spin_lock_irqsave(pHba->host->host_lock, flags);
--
-- while( readl(pHba->irq_mask) & I2O_INTERRUPT_PENDING_B) {
-+#else
-+ spin_lock_irqsave(&io_request_lock, flags);
-+#endif
-+ while( readl(pHba->irq_mask) & cpu_to_le32(I2O_INTERRUPT_PENDING_B)) {
- m = readl(pHba->reply_port);
-- if(m == EMPTY_QUEUE){
-+ if(m == cpu_to_le32(EMPTY_QUEUE)){
- // Try twice then give up
- rmb();
- m = readl(pHba->reply_port);
-- if(m == EMPTY_QUEUE){
-+ if(m == cpu_to_le32(EMPTY_QUEUE)){
- // This really should not happen
- printk(KERN_ERR"dpti: Could not get reply frame\n");
- goto out;
- }
- }
-- reply = (ulong)bus_to_virt(m);
-+ if ((pHba->reply_pool_pa <= le32_to_cpu(m))
-+ && (le32_to_cpu(m) < (pHba->reply_pool_pa + (pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4)))) {
-+ reply = ((u8 *)pHba->reply_pool_va) + (le32_to_cpu(m) - pHba->reply_pool_pa);
-+ } else {
-+ /* Ick, we should *never* be here */
-+ printk(KERN_ERR"dpti: replay frame not from pool\n");
-+ reply = bus_to_virt(le32_to_cpu(m));
-+ }
-
-- if (readl(reply) & MSG_FAIL) {
-+ if (readl(reply) & cpu_to_le32(MSG_FAIL)) {
- u32 old_m = readl(reply+28);
-- ulong msg;
-+ void __iomem * msg;
- u32 old_context;
- PDEBUG("%s: Failed message\n",pHba->name);
-- if(old_m >= 0x100000){
-+ if(le32_to_cpu(old_m) >= 0x100000){
- printk(KERN_ERR"%s: Bad preserved MFA (%x)- dropping frame\n",pHba->name,old_m);
- writel(m,pHba->reply_port);
- continue;
- }
- // Transaction context is 0 in failed reply frame
-- msg = (ulong)(pHba->msg_addr_virt + old_m);
-+ msg = pHba->msg_addr_virt + le32_to_cpu(old_m);
- old_context = readl(msg+12);
- writel(old_context, reply+12);
- adpt_send_nop(pHba, old_m);
- }
- context = readl(reply+8);
- if(context & 0x40000000){ // IOCTL
-- ulong p = (ulong)(readl(reply+12));
-+ u32 context = readl(reply+12);
-+ void * p;
-+ if (sizeof(reply) > sizeof(u32)) {
-+ p = pHba->ioctl_reply_context[context];
-+ pHba->ioctl_reply_context[context] = NULL;
-+ } else
-+ // EVIL, not 64 bit safe but dealt with
-+ p = (void *)context;
- if( p != 0) {
-- memcpy((void*)p, (void*)reply, REPLY_FRAME_SIZE * 4);
-+ memcpy_fromio(p, reply, REPLY_FRAME_SIZE * 4);
- }
- // All IOCTLs will also be post wait
- }
- if(context & 0x80000000){ // Post wait message
-- status = readl(reply+16);
-+ status = le32_to_cpu(readl(reply+16));
- if(status >> 24){
- status &= 0xffff; /* Get detail status */
- } else {
- status = I2O_POST_WAIT_OK;
- }
- if(!(context & 0x40000000)) {
-- cmd = (struct scsi_cmnd*) readl(reply+12);
-+ cmd = adpt_cmd_from_context (pHba, readl(reply+12));
- if(cmd != NULL) {
- printk(KERN_WARNING"%s: Apparent SCSI cmd in Post Wait Context - cmd=%p context=%x\n", pHba->name, cmd, context);
- }
- }
- adpt_i2o_post_wait_complete(context, status);
- } else { // SCSI message
-- cmd = (struct scsi_cmnd*) readl(reply+12);
-+ cmd = adpt_cmd_from_context (pHba, readl(reply+12));
- if(cmd != NULL){
-+ if(cmd->use_sg)
-+ pci_unmap_sg(pHba->pDev,
-+ (struct scatterlist *)cmd->buffer,
-+ cmd->use_sg,
-+ cmd->sc_data_direction);
-+ else if(cmd->request_bufflen)
-+ pci_unmap_single(pHba->pDev,
-+ (dma_addr_t)cmd->SCp.dma_handle,
-+ cmd->request_bufflen,
-+ cmd->sc_data_direction);
-+
- if(cmd->serial_number != 0) { // If not timedout
- adpt_i2o_to_scsi(reply, cmd);
- }
-@@ -2082,11 +2365,28 @@ static irqreturn_t adpt_isr(int irq, voi
- wmb();
- rmb();
- }
-- handled = 1;
--out: if(pHba->host)
-+out:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ if (pHba->host != NULL) /* Sad */
- spin_unlock_irqrestore(pHba->host->host_lock, flags);
-- return IRQ_RETVAL(handled);
-+#else
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+#endif
-+ if (reply == (void __iomem *)-1L) {
-+ return IRQ_NONE;
-+ }
-+ return IRQ_HANDLED;
-+
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+/*
-+ * dpti2oscsi2.c contains a table of scsi commands that is used to determine
-+ * the data direction of the command. It is used in dpt_scsi_to_i2o to speed
-+ * up the building of the scsi message.
-+ */
-+#include "dpti2oscsi2.c"
-+#endif
-+
-
- static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* d)
- {
-@@ -2100,6 +2400,10 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH
- u32 reqlen;
- s32 rcode;
-
-+#if 0
-+printk (KERN_INFO"adpt_scsi_to_i2o(%p,%p,%p)\n", pHba, cmd, d);
-+ADPT_SLEEP();
-+#endif
- memset(msg, 0 , sizeof(msg));
- len = cmd->request_bufflen;
- direction = 0x00000000;
-@@ -2112,6 +2416,34 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH
- * Note: Do not have to verify index is less than 0 since
- * cmd->cmnd[0] is an unsigned char
- */
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+ if (cmd->cmnd[0] < DISKXFERTBLSIZE) {
-+ switch (i2oscsi2diskxfer[cmd->cmnd[0]]) {
-+ case DATAIN:
-+ scsidir =0x40000000; // DATA IN (iop<--dev)
-+ break;
-+ case DATAOUT:
-+ direction=0x04000000; // SGL OUT
-+ scsidir =0x80000000; // DATA OUT (iop-->dev)
-+ break;
-+ case NODATA:
-+ break;
-+ case NOSUPPORT:
-+ scsidir =0x40000000; // DATA IN (iop<--dev)
-+ // Assume In - and continue;
-+ break;
-+ default:
-+ printk(KERN_WARNING"%s: scsi opcode 0x%x not supported.\n",
-+ pHba->name, cmd->cmnd[0]);
-+ cmd->result = (DID_OK <<16) | (INITIATOR_ERROR << 8);
-+ cmd->scsi_done(cmd);
-+ return 0;
-+ }
-+ } else {
-+ printk(KERN_WARNING"%s: cmd->cmnd[0] = %d is greater than table size, which is %d\n",
-+ pHba->name, cmd->cmnd[0], DISKXFERTBLSIZE);
-+ }
-+#else
- switch(cmd->sc_data_direction){
- case DMA_FROM_DEVICE:
- scsidir =0x40000000; // DATA IN (iop<--dev)
-@@ -2133,21 +2465,25 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH
- cmd->scsi_done(cmd);
- return 0;
- }
-+#endif
- }
- // msg[0] is set later
- // I2O_CMD_SCSI_EXEC
-- msg[1] = ((0xff<<24)|(HOST_TID<<12)|d->tid);
-+ msg[1] = cpu_to_le32((0xff<<24)|(HOST_TID<<12)|d->tid);
- msg[2] = 0;
-- msg[3] = (u32)cmd; /* We want the SCSI control block back */
-+ if (sizeof(cmd) > sizeof(u32))
-+ msg[3] = (u32)cmd->serial_number;
-+ else
-+ msg[3] = (u32)(unsigned long)cmd; /* EVIL 64 bit We want the SCSI control block back */
- // Our cards use the transaction context as the tag for queueing
- // Adaptec/DPT Private stuff
-- msg[4] = I2O_CMD_SCSI_EXEC|(DPT_ORGANIZATION_ID<<16);
-- msg[5] = d->tid;
-+ msg[4] = cpu_to_le32(I2O_CMD_SCSI_EXEC|(DPT_ORGANIZATION_ID<<16));
-+ msg[5] = cpu_to_le32(d->tid);
- /* Direction, disconnect ok | sense data | simple queue , CDBLen */
- // I2O_SCB_FLAG_ENABLE_DISCONNECT |
- // I2O_SCB_FLAG_SIMPLE_QUEUE_TAG |
- // I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE;
-- msg[6] = scsidir|0x20a00000|cmd->cmd_len;
-+ msg[6] = cpu_to_le32(scsidir|0x20a00000|cmd->cmd_len);
-
- mptr=msg+7;
-
-@@ -2157,44 +2493,102 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH
- mptr+=4;
- lenptr=mptr++; /* Remember me - fill in when we know */
- reqlen = 14; // SINGLE SGE
-+ /* The following test gets optimized out if dma_addr_t is <= 32 bits */
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support)) {
-+ *mptr++ = cpu_to_le32((0x7C<<24)+(2<<16)+0x02); /* Enable 64 bit */
-+ *mptr++ = cpu_to_le32(1 << PAGE_SHIFT);
-+ reqlen += 2;
-+ }
- /* Now fill in the SGList and command */
- if(cmd->use_sg) {
- struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer;
- int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
--
--
-+ cmd->sc_data_direction);
- len = 0;
-- for(i = 0 ; i < sg_count; i++) {
-- *mptr++ = direction|0x10000000|sg_dma_len(sg);
-- len+=sg_dma_len(sg);
-- *mptr++ = sg_dma_address(sg);
-- sg++;
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support)) {
-+ for(i = 0 ; i < sg_count; i++) {
-+ dma_addr_t addr;
-+ *mptr++ = cpu_to_le32(direction|0x10000000|sg_dma_len(sg));
-+ len+=sg_dma_len(sg);
-+ addr = sg_dma_address(sg);
-+ *mptr++ = cpu_to_le32(addr);
-+ *mptr++ = cpu_to_le32((u64)addr >> 32);
-+ sg++;
-+ }
-+ /* Make this an end of list */
-+ mptr[-3] = cpu_to_le32(direction|0xD0000000|sg_dma_len(sg-1));
-+#if 0
-+reqlen = mptr - msg;
-+*lenptr = cpu_to_le32(len);
-+msg[0] = cpu_to_le32(reqlen<<16 | ((reqlen > 12) ? SGL_OFFSET_12 : SGL_OFFSET_0));
-+printk(KERN_INFO"Message64=");
-+{int i;
-+for (i=0; i<reqlen; ++i)
-+printk("%c%08x", (i?' ':'{'), msg[i]);
-+}
-+printk("}\n");
-+ADPT_SLEEP();
-+#endif
-+ } else {
-+ for(i = 0 ; i < sg_count; i++) {
-+ *mptr++ = cpu_to_le32(direction|0x10000000|sg_dma_len(sg));
-+ len+=sg_dma_len(sg);
-+ *mptr++ = cpu_to_le32(sg_dma_address(sg));
-+ sg++;
-+ }
-+ /* Make this an end of list */
-+ mptr[-2] = cpu_to_le32(direction|0xD0000000|sg_dma_len(sg-1));
-+#if 0
-+reqlen = mptr - msg;
-+*lenptr = cpu_to_le32(len);
-+msg[0] = cpu_to_le32(reqlen<<16 | ((reqlen > 12) ? SGL_OFFSET_12 : SGL_OFFSET_0));
-+printk(KERN_INFO"Message32=");
-+{int i;
-+for (i=0; i<reqlen; ++i)
-+printk("%c%08x", (i?' ':'{'), msg[i]);
-+}
-+printk("}\n");
-+ADPT_SLEEP();
-+#endif
- }
-- /* Make this an end of list */
-- mptr[-2] = direction|0xD0000000|sg_dma_len(sg-1);
- reqlen = mptr - msg;
-- *lenptr = len;
-+ *lenptr = cpu_to_le32(len);
-
- if(cmd->underflow && len != cmd->underflow){
- printk(KERN_WARNING"Cmd len %08X Cmd underflow %08X\n",
- len, cmd->underflow);
- }
- } else {
-- *lenptr = len = cmd->request_bufflen;
-+ len = cmd->request_bufflen;
-+
-+ *lenptr = cpu_to_le32(len);
- if(len == 0) {
- reqlen = 12;
- } else {
-- *mptr++ = 0xD0000000|direction|cmd->request_bufflen;
-- *mptr++ = pci_map_single(pHba->pDev,
-- cmd->request_buffer,
-- cmd->request_bufflen,
-- cmd->sc_data_direction);
-- }
-+ *mptr++ = cpu_to_le32(0xD0000000|direction|cmd->request_bufflen);
-+ cmd->SCp.dma_handle = pci_map_single(pHba->pDev,
-+ cmd->request_buffer,
-+ len, cmd->sc_data_direction);
-+ *mptr++ = cpu_to_le32(cmd->SCp.dma_handle);
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support)) {
-+ *mptr++ = cpu_to_le32((u64)cmd->SCp.dma_handle >> 32);
-+ ++reqlen;
-+ }
-+ }
-+#if 0
-+msg[0] = cpu_to_le32(reqlen<<16 | ((reqlen > 12) ? SGL_OFFSET_12 : SGL_OFFSET_0));
-+printk(KERN_INFO"Message=");
-+{int i;
-+for (i=0; i<reqlen; ++i)
-+printk("%c%08x", (i?' ':'{'), msg[i]);
-+}
-+printk("}\n");
-+ADPT_SLEEP();
-+#endif
- }
-
- /* Stick the headers on */
-- msg[0] = reqlen<<16 | ((reqlen > 12) ? SGL_OFFSET_12 : SGL_OFFSET_0);
-+ msg[0] = cpu_to_le32(reqlen<<16 | ((reqlen > 12) ? SGL_OFFSET_12 : SGL_OFFSET_0));
-
- // Send it on it's way
- rcode = adpt_i2o_post_this(pHba, msg, reqlen<<2);
-@@ -2209,14 +2603,44 @@ static s32 adpt_scsi_register(adpt_hba*
- {
- struct Scsi_Host *host = NULL;
-
-- host = scsi_register(sht, sizeof(adpt_hba*));
-+ host = scsi_host_alloc(sht, sizeof(adpt_hba*));
- if (host == NULL) {
-- printk ("%s: scsi_register returned NULL\n",pHba->name);
-+ printk ("%s: scsi_host_alloc returned NULL\n",pHba->name);
- return -1;
- }
-- host->hostdata[0] = (unsigned long)pHba;
-+ *((adpt_hba**)(host->hostdata)) = pHba;
- pHba->host = host;
-
-+ /*
-+ * Only enable PAE mode if the dma_addr_t is larger than
-+ * 32 bit addressing, and we have more than 32 bit addressing
-+ * worth of memory.
-+ */
-+ if( (sizeof(dma_addr_t) > 4)
-+ && (num_physpages > (0xFFFFFFFFULL >> PAGE_SHIFT))) {
-+ pHba->pae_support = ((pHba->detail[44] > '3')
-+ || ((pHba->detail[44] == '3')
-+ && ((pHba->detail[45] > '7')
-+ || ((pHba->detail[45] == '7')
-+ && ((pHba->detail[46] > '0')
-+ || ((pHba->detail[46] == '0')
-+ && (pHba->detail[47] >= '9')))))));
-+ if (pHba->pae_support) {
-+ if (pci_set_dma_mask(pHba->pDev, DMA_64BIT_MASK)) {
-+ if (pci_set_dma_mask(pHba->pDev, DMA_32BIT_MASK)) {
-+ scsi_unregister(host);
-+ printk ("%s: pci_set_dma_mask returned failure\n",
-+ pHba->name);
-+ return -1;
-+ }
-+ pHba->pae_support = 0;
-+ }
-+#if (KERNEL_VERSION(2,4,18) <= LINUX_VERSION_CODE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && defined(CONFIG_HIGHMEM) && ((LINUX_VERSION_CODE != KERNEL_VERSION(2,4,19)) || defined(CONFIG_HIGHIO))
-+ else
-+ host->highmem_io = 1;
-+#endif
-+ }
-+ }
- host->irq = pHba->pDev->irq;
- /* no IO ports, so don't have to set host->io_port and
- * host->n_io_port
-@@ -2227,41 +2651,75 @@ static s32 adpt_scsi_register(adpt_hba*
- host->max_id = 16;
- host->max_lun = 256;
- host->max_channel = pHba->top_scsi_channel + 1;
-- host->cmd_per_lun = 1;
-- host->unique_id = (uint) pHba;
-+ host->cmd_per_lun = 256;
-+ host->unique_id = (uint)(unsigned long)pHba; /* 64 bit */
- host->sg_tablesize = pHba->sg_tablesize;
- host->can_queue = pHba->post_fifo_size;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-+ scsi_set_pci_device(host, pHba->pDev);
-+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-+ scsi_set_device(host, &pHba->pDev->dev);
-+#endif
-+ if (scsi_add_host(host, &pHba->pDev->dev)) {
-+ scsi_unregister(pHba->host);
-+ return -1;
-+ }
-+ scsi_scan_host(host);
-
- return 0;
- }
-
-
--static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd)
-+static s32 adpt_i2o_to_scsi(void __iomem * reply, struct scsi_cmnd* cmd)
- {
- adpt_hba* pHba;
- u32 hba_status;
- u32 dev_status;
-- u32 reply_flags = readl(reply) & 0xff00; // Leave it shifted up 8 bits
-+ u32 reply_flags = le32_to_cpu(readl(reply)) & 0xff00; // Leave it shifted up 8 bits
- // I know this would look cleaner if I just read bytes
- // but the model I have been using for all the rest of the
- // io is in 4 byte words - so I keep that model
-- u16 detailed_status = readl(reply+16) &0xffff;
-+ u16 detailed_status = le32_to_cpu(readl(reply+16)) &0xffff;
- dev_status = (detailed_status & 0xff);
- hba_status = detailed_status >> 8;
-+#if 0
-+ if (hba_status == 1) {
-+ printk ("ReplyFrame=%08x %08x %08x %08x %08x %08x\n",
-+ le32_to_cpu(readl(reply)), le32_to_cpu(readl(reply+4)),
-+ le32_to_cpu(readl(reply+8)), le32_to_cpu(readl(reply+12)),
-+ le32_to_cpu(readl(reply+16)), le32_to_cpu(readl(reply+20)));
-+ }
-+#endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
- // calculate resid for sg
-- cmd->resid = cmd->request_bufflen - readl(reply+5);
-+ cmd->resid = cmd->request_bufflen - le32_to_cpu(readl(reply+5));
-+#endif
-
-- pHba = (adpt_hba*) cmd->device->host->hostdata[0];
-+ pHba = *((adpt_hba**) cmd->device->host->hostdata);
-+#if 0
-+ if (cmd->cmnd[0] == INQUIRY) {
-+ struct adpt_device* d = (struct adpt_device*) cmd->device->hostdata;
-+ printk(KERN_INFO
-+ "INQUIRY (%d,%d,%d) dev=%p tid=%d, reply_flags=%d",
-+ (u32)scmd_channel(cmd), (u32)scmd_id(cmd),
-+ (u32)cmd->device->lun, d, d->tid, reply_flags);
-+ printk(KERN_INFO " 0x%02x 0x%02x %.8s %.16s %.4s\n",
-+ ((u8*)cmd->buffer)[0], ((u8*)cmd->buffer)[1],
-+ ((char*)cmd->buffer) + 8, ((char*)cmd->buffer) + 16,
-+ ((char*)cmd->buffer) + 32);
-+ }
-+#endif
-
- cmd->sense_buffer[0] = '\0'; // initialize sense valid flag to false
-
-+
- if(!(reply_flags & MSG_FAIL)) {
- switch(detailed_status & I2O_SCSI_DSC_MASK) {
- case I2O_SCSI_DSC_SUCCESS:
- cmd->result = (DID_OK << 16);
- // handle underflow
-- if(readl(reply+5) < cmd->underflow ) {
-+ if(le32_to_cpu(readl(reply+5)) < cmd->underflow ) {
- cmd->result = (DID_ERROR <<16);
- printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
- }
-@@ -2276,7 +2734,9 @@ static s32 adpt_i2o_to_scsi(ulong reply,
- case I2O_SCSI_DSC_NO_ADAPTER:
- case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE:
- printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%d) hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
-- pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]);
-+ pHba->name,
-+ (u32)scmd_channel(cmd), (u32)scmd_id(cmd), (u32)cmd->device->lun,
-+ hba_status, dev_status, cmd->cmnd[0]);
- cmd->result = (DID_TIME_OUT << 16);
- break;
- case I2O_SCSI_DSC_ADAPTER_BUSY:
-@@ -2316,7 +2776,8 @@ static s32 adpt_i2o_to_scsi(ulong reply,
- case I2O_SCSI_DSC_REQUEST_INVALID:
- default:
- printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
-- pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
-+ pHba->name, detailed_status & I2O_SCSI_DSC_MASK,
-+ (u32)scmd_channel(cmd), (u32)scmd_id(cmd), (u32)cmd->device->lun,
- hba_status, dev_status, cmd->cmnd[0]);
- cmd->result = (DID_ERROR << 16);
- break;
-@@ -2328,13 +2789,14 @@ static s32 adpt_i2o_to_scsi(ulong reply,
- u32 len = sizeof(cmd->sense_buffer);
- len = (len > 40) ? 40 : len;
- // Copy over the sense data
-- memcpy(cmd->sense_buffer, (void*)(reply+28) , len);
-+ memcpy_fromio(cmd->sense_buffer, (reply+28) , len);
- if(cmd->sense_buffer[0] == 0x70 /* class 7 */ &&
- cmd->sense_buffer[2] == DATA_PROTECT ){
- /* This is to handle an array failed */
- cmd->result = (DID_TIME_OUT << 16);
- printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
-- pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
-+ pHba->name,
-+ (u32)scmd_channel(cmd), (u32)scmd_id(cmd), (u32)cmd->device->lun,
- hba_status, dev_status, cmd->cmnd[0]);
-
- }
-@@ -2346,7 +2808,8 @@ static s32 adpt_i2o_to_scsi(ulong reply,
- */
- cmd->result = (DID_TIME_OUT << 16);
- printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%d) tid=%d, cmd=0x%x\n",
-- pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
-+ pHba->name,
-+ (u32)scmd_channel(cmd), (u32)scmd_id(cmd), (u32)cmd->device->lun,
- ((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]);
- }
-
-@@ -2362,17 +2825,27 @@ static s32 adpt_i2o_to_scsi(ulong reply,
- static s32 adpt_rescan(adpt_hba* pHba)
- {
- s32 rcode;
-- ulong flags = 0;
-+ ulong flags;
-
-- if(pHba->host)
-- spin_lock_irqsave(pHba->host->host_lock, flags);
-- if ((rcode=adpt_i2o_lct_get(pHba)) < 0)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_lock_irqsave(pHba->host->host_lock, flags);
-+#else
-+ spin_lock_irqsave(&io_request_lock, flags);
-+#endif
-+ if ((rcode=adpt_i2o_lct_get(pHba)) < 0){
- goto out;
-- if ((rcode=adpt_i2o_reparse_lct(pHba)) < 0)
-+ }
-+
-+ if ((rcode=adpt_i2o_reparse_lct(pHba)) < 0){
- goto out;
-+ }
- rcode = 0;
--out: if(pHba->host)
-- spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+out:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ spin_unlock_irqrestore(pHba->host->host_lock, flags);
-+#else
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+#endif
- return rcode;
- }
-
-@@ -2383,7 +2856,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- int max;
- int tid;
- struct i2o_device *d;
-- i2o_lct *lct = pHba->lct;
-+ i2o_lct *lct = pHba->lct_va;
- u8 bus_no = 0;
- s16 scsi_id;
- s16 scsi_lun;
-@@ -2412,14 +2885,14 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- printk(KERN_INFO "%s: LCT has %d entries.\n", pHba->name,max);
-
- for(i=0;i<max;i++) {
-- if( lct->lct_entry[i].user_tid != 0xfff){
-+ if( lct->lct_entry[i].user_tid != cpu_to_le32(0xfff)){
- continue;
- }
-
-- if( lct->lct_entry[i].class_id == I2O_CLASS_RANDOM_BLOCK_STORAGE ||
-- lct->lct_entry[i].class_id == I2O_CLASS_SCSI_PERIPHERAL ||
-- lct->lct_entry[i].class_id == I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL ){
-- tid = lct->lct_entry[i].tid;
-+ if( lct->lct_entry[i].class_id == cpu_to_le32(I2O_CLASS_RANDOM_BLOCK_STORAGE) ||
-+ lct->lct_entry[i].class_id == cpu_to_le32(I2O_CLASS_SCSI_PERIPHERAL) ||
-+ lct->lct_entry[i].class_id == cpu_to_le32(I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL) ){
-+ tid = le32_to_cpu(lct->lct_entry[i].tid);
- if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)<0) {
- printk(KERN_ERR"%s: Could not query device\n",pHba->name);
- continue;
-@@ -2427,6 +2900,14 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- bus_no = buf[0]>>16;
- scsi_id = buf[1];
- scsi_lun = (buf[2]>>8 )&0xff;
-+ if(bus_no >= MAX_CHANNEL) { /* Something wrong skit it */
-+ printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
-+ continue;
-+ }
-+ if(scsi_id >= MAX_ID) {
-+ printk(KERN_WARNING"%s: Id number %d out of range \n", pHba->name, scsi_id);
-+ continue;
-+ }
- pDev = pHba->channel[bus_no].device[scsi_id];
- /* da lun */
- while(pDev) {
-@@ -2436,14 +2917,14 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- pDev = pDev->next_lun;
- }
- if(!pDev ) { // Something new add it
-- d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
-+ d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_ATOMIC);
- if(d==NULL)
- {
- printk(KERN_CRIT "Out of memory for I2O device data.\n");
- return -ENOMEM;
- }
-
-- d->controller = (void*)pHba;
-+ d->controller = pHba;
- d->next = NULL;
-
- memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry));
-@@ -2452,13 +2933,9 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- adpt_i2o_report_hba_unit(pHba, d);
- adpt_i2o_install_device(pHba, d);
-
-- if(bus_no >= MAX_CHANNEL) { // Something wrong skip it
-- printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
-- continue;
-- }
- pDev = pHba->channel[bus_no].device[scsi_id];
- if( pDev == NULL){
-- pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL);
-+ pDev = kmalloc(sizeof(struct adpt_device),GFP_ATOMIC);
- if(pDev == NULL) {
- return -ENOMEM;
- }
-@@ -2467,13 +2944,13 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- while (pDev->next_lun) {
- pDev = pDev->next_lun;
- }
-- pDev = pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL);
-+ pDev = pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_ATOMIC);
- if(pDev == NULL) {
- return -ENOMEM;
- }
- }
- memset(pDev,0,sizeof(struct adpt_device));
-- pDev->tid = d->lct_data.tid;
-+ pDev->tid = le32_to_cpu(d->lct_data.tid);
- pDev->scsi_channel = bus_no;
- pDev->scsi_id = scsi_id;
- pDev->scsi_lun = scsi_lun;
-@@ -2494,20 +2971,32 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- // We found an old device - check it
- while(pDev) {
- if(pDev->scsi_lun == scsi_lun) {
-- if(!scsi_device_online(pDev->pScsi_dev)) {
-+ /*
-+ * Can not set a device to
-+ * changed when in eh code
-+ * as it causes a recurse stack
-+ * panic timebomb.
-+ */
-+ int change_ok = pDev->pScsi_dev
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,1))
-+ && !test_bit(SHOST_RECOVERY, &pHba->host->shost_state);
-+#elif (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,0))
-+ && !test_bit(SHOST_RECOVERY, &pHba->host->shost_state);
-+#else
-+ && !pHba->host->in_recovery;
-+#endif
-+ if(pDev->pScsi_dev && !scsi_device_online(pDev->pScsi_dev)) {
- printk(KERN_WARNING"%s: Setting device (%d,%d,%d) back online\n",
- pHba->name,bus_no,scsi_id,scsi_lun);
-- if (pDev->pScsi_dev) {
-- scsi_device_set_state(pDev->pScsi_dev, SDEV_RUNNING);
-- }
-+ scsi_device_set_online(pDev->pScsi_dev, 1);
- }
- d = pDev->pI2o_dev;
-- if(d->lct_data.tid != tid) { // something changed
-+ if(le32_to_cpu(d->lct_data.tid) != tid) { // something changed
- pDev->tid = tid;
- memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry));
-- if (pDev->pScsi_dev) {
-- pDev->pScsi_dev->changed = TRUE;
-- pDev->pScsi_dev->removable = TRUE;
-+ if (change_ok) {
-+ pDev->pScsi_dev->changed = 1;
-+ pDev->pScsi_dev->removable = 1;
- }
- }
- // Found it - mark it scanned
-@@ -2529,7 +3018,21 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- pDev->state = DPTI_DEV_OFFLINE;
- printk(KERN_WARNING"%s: Device (%d,%d,%d) offline\n",pHba->name,pDev->scsi_channel,pDev->scsi_id,pDev->scsi_lun);
- if (pDev->pScsi_dev) {
-- scsi_device_set_state(pDev->pScsi_dev, SDEV_OFFLINE);
-+ scsi_device_set_online(pDev->pScsi_dev, 0);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
-+ if (atomic_read(&pDev->pScsi_dev->access_count)) {
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+ if (pDev->pScsi_dev->device_busy) {
-+#else
-+ if (pDev->pScsi_dev->access_count) {
-+#endif
-+ // A drive that was mounted is no longer there... bad!
-+#ifdef SCSI_LOG_ERROR_RECOVERY
-+ SCSI_LOG_ERROR_RECOVERY(1, printk ("%s:Rescan: Previously "
-+ "mounted drive not found!\n",pHba->name));
-+#endif
-+ printk(KERN_WARNING"%s:Mounted drive taken offline\n",pHba->name);
-+ }
- }
- }
- }
-@@ -2539,20 +3042,42 @@ static s32 adpt_i2o_reparse_lct(adpt_hba
- static void adpt_fail_posted_scbs(adpt_hba* pHba)
- {
- struct scsi_cmnd* cmd = NULL;
-- struct scsi_device* d = NULL;
-+ struct scsi_device* d;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+# if ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) || defined(shost_for_each_device))
-+ spin_unlock(pHba->host->host_lock);
- shost_for_each_device(d, pHba->host) {
-+# else
-+ list_for_each_entry(d, &pHba->host->my_devices, siblings) {
-+# endif
- unsigned long flags;
- spin_lock_irqsave(&d->list_lock, flags);
- list_for_each_entry(cmd, &d->cmd_list, list) {
-+ if (cmd->serial_number == 0) {
-+ continue;
-+ }
-+ cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
-+ cmd->scsi_done(cmd);
-+ }
-+ spin_unlock_irqrestore(&d->list_lock, flags);
-+ }
-+# if ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) || defined(shost_for_each_device))
-+ spin_lock(pHba->host->host_lock);
-+# endif
-+#else
-+ d = pHba->host->host_queue;
-+ while( d != NULL ){
-+ for(cmd = d->device_queue; cmd ; cmd = cmd->next){
- if(cmd->serial_number == 0){
- continue;
- }
- cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
- cmd->scsi_done(cmd);
- }
-- spin_unlock_irqrestore(&d->list_lock, flags);
-+ d = d->next;
- }
-+#endif
- }
-
-
-@@ -2582,17 +3107,17 @@ static int adpt_i2o_activate_hba(adpt_hb
- }
- }
-
-- if(pHba->status_block->iop_state == ADAPTER_STATE_FAULTED) {
-+ if(pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_FAULTED)) {
- printk(KERN_CRIT "%s: hardware fault\n", pHba->name);
- return -1;
- }
-
-- if (pHba->status_block->iop_state == ADAPTER_STATE_READY ||
-- pHba->status_block->iop_state == ADAPTER_STATE_OPERATIONAL ||
-- pHba->status_block->iop_state == ADAPTER_STATE_HOLD ||
-- pHba->status_block->iop_state == ADAPTER_STATE_FAILED) {
-+ if (pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_READY) ||
-+ pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_OPERATIONAL) ||
-+ pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_HOLD) ||
-+ pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_FAILED)) {
- adpt_i2o_reset_hba(pHba);
-- if (adpt_i2o_status_get(pHba) < 0 || pHba->status_block->iop_state != ADAPTER_STATE_RESET) {
-+ if (adpt_i2o_status_get(pHba) < 0 || pHba->status_block_va->iop_state != cpu_to_le32(ADAPTER_STATE_RESET)) {
- printk(KERN_ERR "%s: Failed to initialize.\n", pHba->name);
- return -1;
- }
-@@ -2641,25 +3166,23 @@ static int adpt_i2o_online_hba(adpt_hba*
-
- static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
- {
-- u32 *msg;
-+ u32 __iomem *msg;
- ulong timeout = jiffies + 5*HZ;
-
-- while(m == EMPTY_QUEUE){
-+ while(m == cpu_to_le32(EMPTY_QUEUE)){
- rmb();
- m = readl(pHba->post_port);
-- if(m != EMPTY_QUEUE){
-+ if(m != cpu_to_le32(EMPTY_QUEUE)){
- break;
- }
- if(time_after(jiffies,timeout)){
- printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name);
- return 2;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
- }
-- msg = (u32*)(pHba->msg_addr_virt + m);
-- writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]);
-- writel( I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0,&msg[1]);
-+ msg = (u32 __iomem *)(pHba->msg_addr_virt + le32_to_cpu(m));
-+ writel( cpu_to_le32(THREE_WORD_MSG_SIZE | SGL_OFFSET_0),&msg[0]);
-+ writel( cpu_to_le32(I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0),&msg[1]);
- writel( 0,&msg[2]);
- wmb();
-
-@@ -2671,17 +3194,16 @@ static s32 adpt_send_nop(adpt_hba*pHba,u
- static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
- {
- u8 *status;
-- u32 *msg = NULL;
-+ dma_addr_t addr;
-+ u32 __iomem *msg = NULL;
- int i;
- ulong timeout = jiffies + TMOUT_INITOUTBOUND*HZ;
-- u32* ptr;
-- u32 outbound_frame; // This had to be a 32 bit address
- u32 m;
-
- do {
- rmb();
- m = readl(pHba->post_port);
-- if (m != EMPTY_QUEUE) {
-+ if (m != cpu_to_le32(EMPTY_QUEUE)) {
- break;
- }
-
-@@ -2689,29 +3211,34 @@ static s32 adpt_i2o_init_outbound_q(adpt
- printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name);
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
-- } while(m == EMPTY_QUEUE);
-+ } while(m == cpu_to_le32(EMPTY_QUEUE));
-
-- msg=(u32 *)(pHba->msg_addr_virt+m);
-+ msg=(u32 __iomem *)(pHba->msg_addr_virt+le32_to_cpu(m));
-
-- status = kmalloc(4,GFP_KERNEL|ADDR32);
-+ status = (u8*)pci_alloc_consistent(pHba->pDev, 4, &addr);
- if (status==NULL) {
- adpt_send_nop(pHba, m);
- printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n",
- pHba->name);
- return -ENOMEM;
- }
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)addr >> 32) != 0) ) {
-+ pci_free_consistent(pHba->pDev, 4, status, addr);
-+ adpt_send_nop(pHba, m);
-+ printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n",
-+ pHba->name);
-+ return -ENOMEM;
-+ }
- memset(status, 0, 4);
-
-- writel(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6, &msg[0]);
-- writel(I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID, &msg[1]);
-+ writel( cpu_to_le32(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6), &msg[0]);
-+ writel( cpu_to_le32(I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID), &msg[1]);
- writel(0, &msg[2]);
- writel(0x0106, &msg[3]); /* Transaction context */
-- writel(4096, &msg[4]); /* Host page frame size */
-- writel((REPLY_FRAME_SIZE)<<16|0x80, &msg[5]); /* Outbound msg frame size and Initcode */
-- writel(0xD0000004, &msg[6]); /* Simple SG LE, EOB */
-- writel(virt_to_bus(status), &msg[7]);
-+ writel( cpu_to_le32(4096), &msg[4]); /* Host page frame size */
-+ writel( cpu_to_le32((REPLY_FRAME_SIZE)<<16|0x80), &msg[5]); /* Outbound msg frame size and Initcode */
-+ writel( cpu_to_le32(0xD0000004), &msg[6]); /* Simple SG LE, EOB */
-+ writel( cpu_to_le32(addr), &msg[7]);
-
- writel(m, pHba->post_port);
- wmb();
-@@ -2726,37 +3253,42 @@ static s32 adpt_i2o_init_outbound_q(adpt
- rmb();
- if(time_after(jiffies,timeout)){
- printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name);
-+ /* We loose 4 bytes of "status" here, but we
-+ cannot free these because controller may
-+ awake and corrupt those bytes at any time */
-+ /* pci_free_consistent(pHba->pDev, 4, status, addr); */
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
- } while (1);
-
- // If the command was successful, fill the fifo with our reply
- // message packets
-- if(*status != 0x04 /*I2O_EXEC_OUTBOUND_INIT_COMPLETE*/) {
-- kfree((void*)status);
-+ if(*status != le32_to_cpu(0x04) /*I2O_EXEC_OUTBOUND_INIT_COMPLETE*/) {
-+ pci_free_consistent(pHba->pDev, 4, status, addr);
- return -2;
- }
-- kfree((void*)status);
-+ pci_free_consistent(pHba->pDev, 4, status, addr);
-
-- if(pHba->reply_pool != NULL){
-- kfree(pHba->reply_pool);
-+ if(pHba->reply_pool_va != NULL){
-+ pci_free_consistent(pHba->pDev, pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, pHba->reply_pool_va, pHba->reply_pool_pa);
- }
-
-- pHba->reply_pool = (u32*)kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
-- if(!pHba->reply_pool){
-+ pHba->reply_pool_va = (u32*)pci_alloc_consistent(pHba->pDev, pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, &pHba->reply_pool_pa);
-+ if(!pHba->reply_pool_va){
- printk(KERN_ERR"%s: Could not allocate reply pool\n",pHba->name);
- return -1;
- }
-- memset(pHba->reply_pool, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4);
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)pHba->reply_pool_pa >> 32) != 0) ) {
-+ pci_free_consistent(pHba->pDev, pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, pHba->reply_pool_va, pHba->reply_pool_pa);
-+ pHba->reply_pool_va = NULL;
-+ printk(KERN_ERR"%s: Could not allocate reply pool in 32 bit space\n",pHba->name);
-+ return -1;
-+ }
-+ memset(pHba->reply_pool_va, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4);
-
-- ptr = pHba->reply_pool;
- for(i = 0; i < pHba->reply_fifo_size; i++) {
-- outbound_frame = (u32)virt_to_bus(ptr);
-- writel(outbound_frame, pHba->reply_port);
-+ writel(cpu_to_le32(pHba->reply_pool_pa + (i * REPLY_FRAME_SIZE * 4)), pHba->reply_port);
- wmb();
-- ptr += REPLY_FRAME_SIZE;
- }
- adpt_i2o_status_get(pHba);
- return 0;
-@@ -2778,28 +3310,28 @@ static s32 adpt_i2o_status_get(adpt_hba*
- {
- ulong timeout;
- u32 m;
-- u32 *msg;
-+ u32 __iomem *msg;
- u8 *status_block=NULL;
-- ulong status_block_bus;
-+ u64 status_block_pa;
-
-- if(pHba->status_block == NULL) {
-- pHba->status_block = (i2o_status_block*)
-- kmalloc(sizeof(i2o_status_block),GFP_KERNEL|ADDR32);
-- if(pHba->status_block == NULL) {
-+ if(pHba->status_block_va == NULL) {
-+ pHba->status_block_va = (i2o_status_block*)
-+ pci_alloc_consistent(pHba->pDev, sizeof(i2o_status_block),
-+ &pHba->status_block_pa);
-+ if(pHba->status_block_va == NULL) {
- printk(KERN_ERR
- "dpti%d: Get Status Block failed; Out of memory. \n",
- pHba->unit);
- return -ENOMEM;
- }
- }
-- memset(pHba->status_block, 0, sizeof(i2o_status_block));
-- status_block = (u8*)(pHba->status_block);
-- status_block_bus = virt_to_bus(pHba->status_block);
-+ memset(pHba->status_block_va, 0, sizeof(i2o_status_block));
-+ status_block = (u8*)(pHba->status_block_va);
- timeout = jiffies+TMOUT_GETSTATUS*HZ;
- do {
- rmb();
- m = readl(pHba->post_port);
-- if (m != EMPTY_QUEUE) {
-+ if (m != cpu_to_le32(EMPTY_QUEUE)) {
- break;
- }
- if(time_after(jiffies,timeout)){
-@@ -2807,22 +3339,21 @@ static s32 adpt_i2o_status_get(adpt_hba*
- pHba->name);
- return -ETIMEDOUT;
- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
-- } while(m==EMPTY_QUEUE);
-+ } while(m==cpu_to_le32(EMPTY_QUEUE));
-
-
-- msg=(u32*)(pHba->msg_addr_virt+m);
-+ msg=(u32 __iomem *)(pHba->msg_addr_virt+le32_to_cpu(m));
-
-- writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_0, &msg[0]);
-- writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]);
-- writel(1, &msg[2]);
-+ writel( cpu_to_le32(NINE_WORD_MSG_SIZE|SGL_OFFSET_0), &msg[0]);
-+ writel( cpu_to_le32(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID), &msg[1]);
-+ writel( cpu_to_le32(1), &msg[2]);
- writel(0, &msg[3]);
- writel(0, &msg[4]);
- writel(0, &msg[5]);
-- writel(((u32)status_block_bus)&0xffffffff, &msg[6]);
-- writel(0, &msg[7]);
-- writel(sizeof(i2o_status_block), &msg[8]); // 88 bytes
-+ status_block_pa = cpu_to_le64(pHba->status_block_pa);
-+ writel( (u32)status_block_pa, &msg[6]);
-+ writel( (u32)(status_block_pa >> 32), &msg[7]);
-+ writel( cpu_to_le32(sizeof(i2o_status_block)), &msg[8]); // 88 bytes
-
- //post message
- writel(m, pHba->post_port);
-@@ -2835,23 +3366,28 @@ static s32 adpt_i2o_status_get(adpt_hba*
- return -ETIMEDOUT;
- }
- rmb();
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
- }
-
- // Set up our number of outbound and inbound messages
-- pHba->post_fifo_size = pHba->status_block->max_inbound_frames;
-+ pHba->post_fifo_size = le32_to_cpu(pHba->status_block_va->max_inbound_frames);
- if (pHba->post_fifo_size > MAX_TO_IOP_MESSAGES) {
- pHba->post_fifo_size = MAX_TO_IOP_MESSAGES;
- }
-
-- pHba->reply_fifo_size = pHba->status_block->max_outbound_frames;
-+ pHba->reply_fifo_size = le32_to_cpu(pHba->status_block_va->max_outbound_frames);
- if (pHba->reply_fifo_size > MAX_FROM_IOP_MESSAGES) {
- pHba->reply_fifo_size = MAX_FROM_IOP_MESSAGES;
- }
-
- // Calculate the Scatter Gather list size
-- pHba->sg_tablesize = (pHba->status_block->inbound_frame_size * 4 -40)/ sizeof(struct sg_simple_element);
-+ pHba->sg_tablesize = (le32_to_cpu(pHba->status_block_va->inbound_frame_size) * 4 - 12 * sizeof(u32))/ sizeof(struct sg_simple_element);
-+ if( (sizeof(dma_addr_t) > 4)
-+ && (num_physpages > (0xFFFFFFFFULL >> PAGE_SHIFT))) {
-+ pHba->sg_tablesize
-+ = (le32_to_cpu(pHba->status_block_va->inbound_frame_size) * 4
-+ - 14 * sizeof(u32))
-+ / (sizeof(struct sg_simple_element) + sizeof(u32));
-+ }
- if (pHba->sg_tablesize > SG_LIST_ELEMENTS) {
- pHba->sg_tablesize = SG_LIST_ELEMENTS;
- }
-@@ -2859,7 +3395,7 @@ static s32 adpt_i2o_status_get(adpt_hba*
-
- #ifdef DEBUG
- printk("dpti%d: State = ",pHba->unit);
-- switch(pHba->status_block->iop_state) {
-+ switch(le32_to_cpu(pHba->status_block_va->iop_state)) {
- case 0x01:
- printk("INIT\n");
- break;
-@@ -2882,7 +3418,7 @@ static s32 adpt_i2o_status_get(adpt_hba*
- printk("FAULTED\n");
- break;
- default:
-- printk("%x (unknown!!)\n",pHba->status_block->iop_state);
-+ printk("%x (unknown!!)\n",le32_to_cpu(pHba->status_block_va->iop_state));
- }
- #endif
- return 0;
-@@ -2897,28 +3433,35 @@ static int adpt_i2o_lct_get(adpt_hba* pH
- int ret;
- u32 buf[16];
-
-- if ((pHba->lct_size == 0) || (pHba->lct == NULL)){
-- pHba->lct_size = pHba->status_block->expected_lct_size;
-+ if ((pHba->lct_size == 0) || (pHba->lct_va == NULL)){
-+ pHba->lct_size = le32_to_cpu(pHba->status_block_va->expected_lct_size);
- }
- do {
-- if (pHba->lct == NULL) {
-- pHba->lct = kmalloc(pHba->lct_size, GFP_KERNEL|ADDR32);
-- if(pHba->lct == NULL) {
-+ if (pHba->lct_va == NULL) {
-+ pHba->lct_va = pci_alloc_consistent(pHba->pDev, pHba->lct_size, &pHba->lct_pa);
-+ if(pHba->lct_va == NULL) {
- printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n",
- pHba->name);
- return -ENOMEM;
- }
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)pHba->lct_pa >> 32) != 0) ) {
-+ pci_free_consistent(pHba->pDev, pHba->lct_size, pHba->lct_va, pHba->lct_pa);
-+ pHba->lct_va = NULL;
-+ printk(KERN_CRIT "%s: Lct Get failed. Out of 32 bit memory.\n",
-+ pHba->name);
-+ return -ENOMEM;
-+ }
- }
-- memset(pHba->lct, 0, pHba->lct_size);
-+ memset(pHba->lct_va, 0, pHba->lct_size);
-
-- msg[0] = EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6;
-- msg[1] = I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID;
-+ msg[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6);
-+ msg[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID);
- msg[2] = 0;
- msg[3] = 0;
- msg[4] = 0xFFFFFFFF; /* All devices */
- msg[5] = 0x00000000; /* Report now */
-- msg[6] = 0xD0000000|pHba->lct_size;
-- msg[7] = virt_to_bus(pHba->lct);
-+ msg[6] = cpu_to_le32(0xD0000000|pHba->lct_size);
-+ msg[7] = cpu_to_le32(pHba->lct_pa);
-
- if ((ret=adpt_i2o_post_wait(pHba, msg, sizeof(msg), 360))) {
- printk(KERN_ERR "%s: LCT Get failed (status=%#10x.\n",
-@@ -2927,26 +3470,29 @@ static int adpt_i2o_lct_get(adpt_hba* pH
- return ret;
- }
-
-- if ((pHba->lct->table_size << 2) > pHba->lct_size) {
-- pHba->lct_size = pHba->lct->table_size << 2;
-- kfree(pHba->lct);
-- pHba->lct = NULL;
-+ ret = le32_to_cpu(pHba->lct_va->table_size) << 2;
-+ if (ret > pHba->lct_size) {
-+ pci_free_consistent(pHba->pDev, pHba->lct_size, pHba->lct_va, pHba->lct_pa);
-+ pHba->lct_size = ret;
-+ pHba->lct_va = NULL;
- }
-- } while (pHba->lct == NULL);
-+ } while (pHba->lct_va == NULL);
-
- PDEBUG("%s: Hardware resource table read.\n", pHba->name);
-
-
- // I2O_DPT_EXEC_IOP_BUFFERS_GROUP_NO;
- if(adpt_i2o_query_scalar(pHba, 0 , 0x8000, -1, buf, sizeof(buf))>=0) {
-- pHba->FwDebugBufferSize = buf[1];
-- pHba->FwDebugBuffer_P = pHba->base_addr_virt + buf[0];
-- pHba->FwDebugFlags_P = pHba->FwDebugBuffer_P + FW_DEBUG_FLAGS_OFFSET;
-- pHba->FwDebugBLEDvalue_P = pHba->FwDebugBuffer_P + FW_DEBUG_BLED_OFFSET;
-- pHba->FwDebugBLEDflag_P = pHba->FwDebugBLEDvalue_P + 1;
-- pHba->FwDebugStrLength_P = pHba->FwDebugBuffer_P + FW_DEBUG_STR_LENGTH_OFFSET;
-- pHba->FwDebugBuffer_P += buf[2];
-- pHba->FwDebugFlags = 0;
-+ pHba->fw_buffer_addr_virt = pHba->base_addr_virt + buf[0];
-+ pHba->bled_value_addr_virt = pHba->fw_buffer_addr_virt + FW_DEBUG_BLED_OFFSET;
-+ pHba->bled_flag_addr_virt = pHba->bled_value_addr_virt + 1;
-+ /* bled fields are both 8 bits, so increment by one is what is desired*/
-+#ifdef DEBUG
-+ pHba->fw_buffer_size = buf[1];
-+ pHba->fw_debug_flags_addr_virt = pHba->fw_buffer_addr_virt + FW_DEBUG_FLAGS_OFFSET;
-+ pHba->fw_string_len_addr_virt = pHba->fw_buffer_addr_virt + FW_DEBUG_STR_LENGTH_OFFSET;
-+#endif
-+ pHba->fw_buffer_addr_virt += buf[2];
- }
-
- return 0;
-@@ -2954,51 +3500,58 @@ static int adpt_i2o_lct_get(adpt_hba* pH
-
- static int adpt_i2o_build_sys_table(void)
- {
-- adpt_hba* pHba = NULL;
-+ adpt_hba* pHba = hba_chain;
- int count = 0;
-
-+ if(sys_tbl_va)
-+ pci_free_consistent(pHba->pDev, sys_tbl_len, sys_tbl_va, sys_tbl_pa);
- sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs
- (hba_count) * sizeof(struct i2o_sys_tbl_entry);
-
-- if(sys_tbl)
-- kfree(sys_tbl);
--
-- sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL|ADDR32);
-- if(!sys_tbl) {
-+ sys_tbl_va = pci_alloc_consistent(pHba->pDev, sys_tbl_len, &sys_tbl_pa);
-+ if(!sys_tbl_va) {
- printk(KERN_WARNING "SysTab Set failed. Out of memory.\n");
- return -ENOMEM;
- }
-- memset(sys_tbl, 0, sys_tbl_len);
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)sys_tbl_pa >> 32) != 0) ) {
-+ pci_free_consistent(pHba->pDev, sys_tbl_len, sys_tbl_va, sys_tbl_pa);
-+ sys_tbl_va = NULL;
-+ printk(KERN_WARNING "SysTab Set failed. Out of 32 bit memory.\n");
-+ return -ENOMEM;
-+ }
-+ memset(sys_tbl_va, 0, sys_tbl_len);
-
-- sys_tbl->num_entries = hba_count;
-- sys_tbl->version = I2OVERSION;
-- sys_tbl->change_ind = sys_tbl_ind++;
-+ sys_tbl_va->num_entries = cpu_to_le32(hba_count);
-+ sys_tbl_va->version = cpu_to_le32(I2OVERSION);
-+ sys_tbl_va->change_ind = cpu_to_le32(sys_tbl_ind++);
-
- for(pHba = hba_chain; pHba; pHba = pHba->next) {
-+ u64 addr;
- // Get updated Status Block so we have the latest information
- if (adpt_i2o_status_get(pHba)) {
-- sys_tbl->num_entries--;
-+ sys_tbl_va->num_entries = cpu_to_le32(le32_to_cpu(sys_tbl_va->num_entries) - 1);
- continue; // try next one
- }
-
-- sys_tbl->iops[count].org_id = pHba->status_block->org_id;
-- sys_tbl->iops[count].iop_id = pHba->unit + 2;
-- sys_tbl->iops[count].seg_num = 0;
-- sys_tbl->iops[count].i2o_version = pHba->status_block->i2o_version;
-- sys_tbl->iops[count].iop_state = pHba->status_block->iop_state;
-- sys_tbl->iops[count].msg_type = pHba->status_block->msg_type;
-- sys_tbl->iops[count].frame_size = pHba->status_block->inbound_frame_size;
-- sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ??
-- sys_tbl->iops[count].iop_capabilities = pHba->status_block->iop_capabilities;
-- sys_tbl->iops[count].inbound_low = (u32)virt_to_bus((void*)pHba->post_port);
-- sys_tbl->iops[count].inbound_high = (u32)((u64)virt_to_bus((void*)pHba->post_port)>>32);
-+ sys_tbl_va->iops[count].org_id = pHba->status_block_va->org_id;
-+ sys_tbl_va->iops[count].iop_id = cpu_to_le32(pHba->unit + 2);
-+ sys_tbl_va->iops[count].seg_num = 0;
-+ sys_tbl_va->iops[count].i2o_version = pHba->status_block_va->i2o_version;
-+ sys_tbl_va->iops[count].iop_state = pHba->status_block_va->iop_state;
-+ sys_tbl_va->iops[count].msg_type = pHba->status_block_va->msg_type;
-+ sys_tbl_va->iops[count].frame_size = pHba->status_block_va->inbound_frame_size;
-+ sys_tbl_va->iops[count].last_changed = cpu_to_le32(sys_tbl_ind - 1); // ??
-+ sys_tbl_va->iops[count].iop_capabilities = pHba->status_block_va->iop_capabilities;
-+ addr = cpu_to_le64(pHba->base_addr_phys + 0x40);
-+ sys_tbl_va->iops[count].inbound_low = (u32)addr;
-+ sys_tbl_va->iops[count].inbound_high = (u32)(addr >> 32);
-
- count++;
- }
-
- #ifdef DEBUG
- {
-- u32 *table = (u32*)sys_tbl;
-+ u32 *table = (u32*)sys_tbl_va;
- printk(KERN_DEBUG"sys_tbl_len=%d in 32bit words\n",(sys_tbl_len >>2));
- for(count = 0; count < (sys_tbl_len >>2); count++) {
- printk(KERN_INFO "sys_tbl[%d] = %0#10x\n",
-@@ -3018,7 +3571,7 @@ static int adpt_i2o_build_sys_table(void
- static void adpt_i2o_report_hba_unit(adpt_hba* pHba, struct i2o_device *d)
- {
- char buf[64];
-- int unit = d->lct_data.tid;
-+ int unit = le32_to_cpu(d->lct_data.tid);
-
- printk(KERN_INFO "TID %3.3d ", unit);
-
-@@ -3038,17 +3591,17 @@ static void adpt_i2o_report_hba_unit(adp
- printk(" Rev: %-12.12s\n", buf);
- }
- #ifdef DEBUG
-- printk(KERN_INFO "\tClass: %.21s\n", adpt_i2o_get_class_name(d->lct_data.class_id));
-- printk(KERN_INFO "\tSubclass: 0x%04X\n", d->lct_data.sub_class);
-+ printk(KERN_INFO "\tClass: %.21s\n", adpt_i2o_get_class_name(le32_to_cpu(d->lct_data.class_id)));
-+ printk(KERN_INFO "\tSubclass: 0x%04X\n", le32_to_cpu(d->lct_data.sub_class));
- printk(KERN_INFO "\tFlags: ");
-
-- if(d->lct_data.device_flags&(1<<0))
-+ if(le32_to_cpu(d->lct_data.device_flags)&(1<<0))
- printk("C"); // ConfigDialog requested
-- if(d->lct_data.device_flags&(1<<1))
-+ if(le32_to_cpu(d->lct_data.device_flags)&(1<<1))
- printk("U"); // Multi-user capable
-- if(!(d->lct_data.device_flags&(1<<4)))
-+ if(!(le32_to_cpu(d->lct_data.device_flags)&(1<<4)))
- printk("P"); // Peer service enabled!
-- if(!(d->lct_data.device_flags&(1<<5)))
-+ if(!(le32_to_cpu(d->lct_data.device_flags)&(1<<5)))
- printk("M"); // Mgmt service enabled!
- printk("\n");
- #endif
-@@ -3123,35 +3676,42 @@ static const char *adpt_i2o_get_class_na
- static s32 adpt_i2o_hrt_get(adpt_hba* pHba)
- {
- u32 msg[6];
-- int ret, size = sizeof(i2o_hrt);
-+ int ret, size = sizeof(i2o_hrt), new_size;
-
- do {
-- if (pHba->hrt == NULL) {
-- pHba->hrt=kmalloc(size, GFP_KERNEL|ADDR32);
-- if (pHba->hrt == NULL) {
-+ if (pHba->hrt_va == NULL) {
-+ pHba->hrt_va = pci_alloc_consistent(pHba->pDev, size, &pHba->hrt_pa);
-+ if (pHba->hrt_va == NULL) {
- printk(KERN_CRIT "%s: Hrt Get failed; Out of memory.\n", pHba->name);
- return -ENOMEM;
- }
-+ if( (sizeof(dma_addr_t) > 4) && (pHba->pae_support) && (((u64)pHba->hrt_pa >> 32) != 0) ) {
-+ pci_free_consistent(pHba->pDev, size, pHba->hrt_va, pHba->hrt_pa);
-+ pHba->hrt_va = NULL;
-+ printk(KERN_CRIT "%s: Hrt Get failed; Out of 32 bit memory.\n", pHba->name);
-+ return -ENOMEM;
-+ }
- }
-
-- msg[0]= SIX_WORD_MSG_SIZE| SGL_OFFSET_4;
-- msg[1]= I2O_CMD_HRT_GET<<24 | HOST_TID<<12 | ADAPTER_TID;
-+ msg[0]= cpu_to_le32(SIX_WORD_MSG_SIZE| SGL_OFFSET_4);
-+ msg[1]= cpu_to_le32(I2O_CMD_HRT_GET<<24 | HOST_TID<<12 | ADAPTER_TID);
- msg[2]= 0;
- msg[3]= 0;
-- msg[4]= (0xD0000000 | size); /* Simple transaction */
-- msg[5]= virt_to_bus(pHba->hrt); /* Dump it here */
-+ msg[4]= cpu_to_le32(0xD0000000 | size); /* Simple transaction */
-+ msg[5]= cpu_to_le32(pHba->hrt_pa); /* Dump it here */
-
- if ((ret = adpt_i2o_post_wait(pHba, msg, sizeof(msg),20))) {
- printk(KERN_ERR "%s: Unable to get HRT (status=%#10x)\n", pHba->name, ret);
- return ret;
- }
-
-- if (pHba->hrt->num_entries * pHba->hrt->entry_len << 2 > size) {
-- size = pHba->hrt->num_entries * pHba->hrt->entry_len << 2;
-- kfree(pHba->hrt);
-- pHba->hrt = NULL;
-+ new_size = le32_to_cpu(pHba->hrt_va->num_entries) * le32_to_cpu(pHba->hrt_va->entry_len) << 2;
-+ if (new_size > size) {
-+ pci_free_consistent(pHba->pDev, size, pHba->hrt_va, pHba->hrt_pa);
-+ size = new_size;
-+ pHba->hrt_va = NULL;
- }
-- } while(pHba->hrt == NULL);
-+ } while(pHba->hrt_va == NULL);
- return 0;
- }
-
-@@ -3161,34 +3721,47 @@ static s32 adpt_i2o_hrt_get(adpt_hba* pH
- static int adpt_i2o_query_scalar(adpt_hba* pHba, int tid,
- int group, int field, void *buf, int buflen)
- {
-- u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field };
-- u8 *resblk;
--
-+ u16 opblk[] = { cpu_to_le16(1), 0, cpu_to_le16(I2O_PARAMS_FIELD_GET), cpu_to_le16(group), cpu_to_le16(1), cpu_to_le16(field) };
-+ u8 *opblk_va;
-+ dma_addr_t opblk_pa;
-+ u8 *resblk_va;
-+ dma_addr_t resblk_pa;
- int size;
-
- /* 8 bytes for header */
-- resblk = kmalloc(sizeof(u8) * (8+buflen), GFP_KERNEL|ADDR32);
-- if (resblk == NULL) {
-- printk(KERN_CRIT "%s: query scalar failed; Out of memory.\n", pHba->name);
-+ resblk_va = pci_alloc_consistent(pHba->pDev, sizeof(u8) * (8 + buflen), &resblk_pa);
-+ if (resblk_va == NULL) {
-+ printk(KERN_CRIT "%s: query scaler failed; Out of memory.\n", pHba->name);
-+ return -ENOMEM;
-+ }
-+
-+ opblk_va = pci_alloc_consistent(pHba->pDev, sizeof(opblk), &opblk_pa);
-+ if (opblk_va == NULL) {
-+ pci_free_consistent(pHba->pDev, sizeof(u8) * (8+buflen), resblk_va, resblk_pa);
-+ printk(KERN_CRIT "%s: query operatio failed; Out of memory.\n", pHba->name);
- return -ENOMEM;
- }
-
- if (field == -1) /* whole group */
-- opblk[4] = -1;
-+ opblk[4] = -1;
-+ memcpy(opblk_va, opblk, sizeof(opblk));
-
- size = adpt_i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, pHba, tid,
-- opblk, sizeof(opblk), resblk, sizeof(u8)*(8+buflen));
-+ opblk_va, opblk_pa, sizeof(opblk), resblk_va, resblk_pa, sizeof(u8)*(8+buflen));
-+ pci_free_consistent(pHba->pDev, sizeof(opblk), opblk_va, opblk_pa);
- if (size == -ETIME) {
-+ pci_free_consistent(pHba->pDev, sizeof(u8) * (8+buflen), resblk_va, resblk_pa);
- printk(KERN_WARNING "%s: issue params failed; Timed out.\n", pHba->name);
- return -ETIME;
- } else if (size == -EINTR) {
-+ pci_free_consistent(pHba->pDev, sizeof(u8) * (8+buflen), resblk_va, resblk_pa);
- printk(KERN_WARNING "%s: issue params failed; Interrupted.\n", pHba->name);
- return -EINTR;
- }
-
-- memcpy(buf, resblk+8, buflen); /* cut off header */
-+ memcpy(buf, resblk_va+8, buflen); /* cut off header */
-
-- kfree(resblk);
-+ pci_free_consistent(pHba->pDev, sizeof(u8) * (8+buflen), resblk_va, resblk_pa);
- if (size < 0)
- return size;
-
-@@ -3205,38 +3778,38 @@ static int adpt_i2o_query_scalar(adpt_hb
- * ResultCount, ErrorInfoSize, BlockStatus and BlockSize.
- */
- static int adpt_i2o_issue_params(int cmd, adpt_hba* pHba, int tid,
-- void *opblk, int oplen, void *resblk, int reslen)
-+ void *opblk_va, dma_addr_t opblk_pa, int oplen,
-+ void *resblk_va, dma_addr_t resblk_pa, int reslen)
- {
- u32 msg[9];
-- u32 *res = (u32 *)resblk;
-+ u32 *res = (u32 *)resblk_va;
- int wait_status;
-
-- msg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_5;
-- msg[1] = cmd << 24 | HOST_TID << 12 | tid;
-+ msg[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_5);
-+ msg[1] = cpu_to_le32(cmd << 24 | HOST_TID << 12 | tid);
- msg[2] = 0;
- msg[3] = 0;
- msg[4] = 0;
-- msg[5] = 0x54000000 | oplen; /* OperationBlock */
-- msg[6] = virt_to_bus(opblk);
-- msg[7] = 0xD0000000 | reslen; /* ResultBlock */
-- msg[8] = virt_to_bus(resblk);
-+ msg[5] = cpu_to_le32(0x54000000 | oplen); /* OperationBlock */
-+ msg[6] = cpu_to_le32(opblk_pa);
-+ msg[7] = cpu_to_le32(0xD0000000 | reslen); /* ResultBlock */
-+ msg[8] = cpu_to_le32(resblk_pa);
-
- if ((wait_status = adpt_i2o_post_wait(pHba, msg, sizeof(msg), 20))) {
-- printk("adpt_i2o_issue_params: post_wait failed (%p)\n", resblk);
- return wait_status; /* -DetailedStatus */
- }
-
-- if (res[1]&0x00FF0000) { /* BlockStatus != SUCCESS */
-+ if (res[1]&cpu_to_le32(0x00FF0000)) { /* BlockStatus != SUCCESS */
- printk(KERN_WARNING "%s: %s - Error:\n ErrorInfoSize = 0x%02x, "
- "BlockStatus = 0x%02x, BlockSize = 0x%04x\n",
- pHba->name,
- (cmd == I2O_CMD_UTIL_PARAMS_SET) ? "PARAMS_SET"
- : "PARAMS_GET",
-- res[1]>>24, (res[1]>>16)&0xFF, res[1]&0xFFFF);
-- return -((res[1] >> 16) & 0xFF); /* -BlockStatus */
-+ le32_to_cpu(res[1])>>24, (le32_to_cpu(res[1])>>16)&0xFF, le32_to_cpu(res[1])&0xFFFF);
-+ return -((le32_to_cpu(res[1]) >> 16) & 0xFF); /* -BlockStatus */
- }
-
-- return 4 + ((res[1] & 0x0000FFFF) << 2); /* bytes used in resblk */
-+ return 4 + ((le32_to_cpu(res[1]) & 0x0000FFFF) << 2); /* bytes used in resblk */
- }
-
-
-@@ -3249,13 +3822,13 @@ static s32 adpt_i2o_quiesce_hba(adpt_hba
-
- /* SysQuiesce discarded if IOP not in READY or OPERATIONAL state */
-
-- if((pHba->status_block->iop_state != ADAPTER_STATE_READY) &&
-- (pHba->status_block->iop_state != ADAPTER_STATE_OPERATIONAL)){
-+ if((pHba->status_block_va->iop_state != cpu_to_le32(ADAPTER_STATE_READY)) &&
-+ (pHba->status_block_va->iop_state != cpu_to_le32(ADAPTER_STATE_OPERATIONAL))){
- return 0;
- }
-
-- msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1] = I2O_CMD_SYS_QUIESCE<<24|HOST_TID<<12|ADAPTER_TID;
-+ msg[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1] = cpu_to_le32(I2O_CMD_SYS_QUIESCE<<24|HOST_TID<<12|ADAPTER_TID);
- msg[2] = 0;
- msg[3] = 0;
-
-@@ -3280,18 +3853,18 @@ static int adpt_i2o_enable_hba(adpt_hba*
- int ret;
-
- adpt_i2o_status_get(pHba);
-- if(!pHba->status_block){
-+ if(!pHba->status_block_va){
- return -ENOMEM;
- }
- /* Enable only allowed on READY state */
-- if(pHba->status_block->iop_state == ADAPTER_STATE_OPERATIONAL)
-+ if(pHba->status_block_va->iop_state == cpu_to_le32(ADAPTER_STATE_OPERATIONAL))
- return 0;
-
-- if(pHba->status_block->iop_state != ADAPTER_STATE_READY)
-+ if(pHba->status_block_va->iop_state != cpu_to_le32(ADAPTER_STATE_READY))
- return -EINVAL;
-
-- msg[0]=FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
-- msg[1]=I2O_CMD_SYS_ENABLE<<24|HOST_TID<<12|ADAPTER_TID;
-+ msg[0]= cpu_to_le32(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0);
-+ msg[1]= cpu_to_le32(I2O_CMD_SYS_ENABLE<<24|HOST_TID<<12|ADAPTER_TID);
- msg[2]= 0;
- msg[3]= 0;
-
-@@ -3312,11 +3885,11 @@ static int adpt_i2o_systab_send(adpt_hba
- u32 msg[12];
- int ret;
-
-- msg[0] = I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6;
-- msg[1] = I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID;
-+ msg[0] = cpu_to_le32(I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6);
-+ msg[1] = cpu_to_le32(I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID);
- msg[2] = 0;
- msg[3] = 0;
-- msg[4] = (0<<16) | ((pHba->unit+2) << 12); /* Host 0 IOP ID (unit + 2) */
-+ msg[4] = cpu_to_le32((0<<16) | ((pHba->unit+2) << 12)); /* Host 0 IOP ID (unit + 2) */
- msg[5] = 0; /* Segment 0 */
-
- /*
-@@ -3324,11 +3897,11 @@ static int adpt_i2o_systab_send(adpt_hba
- * System table (SysTab), Private memory space declaration and
- * Private i/o space declaration
- */
-- msg[6] = 0x54000000 | sys_tbl_len;
-- msg[7] = virt_to_phys(sys_tbl);
-- msg[8] = 0x54000000 | 0;
-+ msg[6] = cpu_to_le32(0x54000000 | sys_tbl_len);
-+ msg[7] = cpu_to_le32(sys_tbl_pa);
-+ msg[8] = cpu_to_le32(0x54000000 | 0);
- msg[9] = 0;
-- msg[10] = 0xD4000000 | 0;
-+ msg[10] = cpu_to_le32(0xD4000000 | 0);
- msg[11] = 0;
-
- if ((ret=adpt_i2o_post_wait(pHba, msg, sizeof(msg), 120))) {
-@@ -3363,24 +3936,744 @@ static static void adpt_delay(int millis
-
- #endif
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+static struct pci_dev *
-+adpt_pci_find_device(uint vendor, struct pci_dev *from)
-+{
-+ if(!from){
-+ from = pci_devices;
-+ } else {
-+ from = from->next;
-+ }
-+ while (from && from->vendor != vendor) {
-+ from = from->next;
-+ }
-+ return from;
-+}
-+#endif
-+
-+#if (defined(SCSI_HAS_DUMP))
-+#if defined(CONFIG_DISKDUMP) || defined(CONFIG_DISKDUMP_MODULE)
-+static int
-+adpt_i2o_sanity_check(Scsi_Device *device)
-+{
-+ adpt_hba* pHba = (adpt_hba*) device->host->hostdata[0];
-+ struct adpt_device* pDev = NULL;
-+
-+ if(pHba == NULL) {
-+ return -ENXIO;
-+ }
-+
-+ pDev = pHba->channel[device->channel].device[device->id];
-+ while(pDev) {
-+ if(pDev->scsi_lun == device->lun) {
-+ break;
-+ }
-+ pDev = pDev->next_lun;
-+ }
-+
-+ if(pDev == NULL) {
-+ return -ENXIO;
-+ }
-+
-+ if(spin_is_locked(&adpt_post_wait_lock)) {
-+ return -EBUSY;
-+ }
-+
-+ return 0;
-+}
-+
-+static int
-+adpt_i2o_quiesce(Scsi_Device *SDev)
-+{
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,1)
-+ spin_lock_init(&io_request_lock);
-+#endif
-+ return 0;
-+}
-+
-+static void adpt_isr_poll(adpt_hba* pHba)
-+{
-+ Scsi_Cmnd* cmd;
-+ u32 m;
-+ ulong reply;
-+ u32 status=0;
-+ u32 context;
-+ ulong flags = 0;
-+
-+ if (pHba == NULL ){
-+ printk(KERN_WARNING"adpt_isr: NULL dev_id\n");
-+ return;
-+ }
-+ spin_lock_irqsave(&io_request_lock, flags);
-+ m = readl(pHba->reply_port);
-+ if(m == EMPTY_QUEUE){
-+ spin_unlock_irqrestore(&io_request_lock,flags);
-+ return;
-+ }
-+ reply = (ulong)bus_to_virt(m);
-+
-+ if (readl(reply) & MSG_FAIL) {
-+ u32 old_m = readl(reply+28);
-+ ulong msg;
-+ u32 old_context;
-+ PDEBUG("%s: Failed message\n",pHba->name);
-+ if(old_m >= 0x100000){
-+ printk(KERN_ERR"%s: Bad preserved MFA (%x)- dropping frame\n",pHba->name,old_m);
-+ writel(m,pHba->reply_port);
-+ spin_unlock_irqrestore(&io_request_lock,flags);
-+ return;
-+ }
-+ // Transaction context is 0 in failed reply frame
-+ msg = (ulong)(pHba->msg_addr_virt + old_m);
-+ old_context = readl(msg+12);
-+ writel(old_context, reply+12);
-+ adpt_send_nop(pHba, old_m);
-+ }
-+ context = readl(reply+8);
-+ if(context & 0x40000000){ // IOCTL
-+ ulong p = (ulong)(readl(reply+12));
-+ if( p != 0) {
-+ memcpy((void*)p, (void*)reply, REPLY_FRAME_SIZE * 4);
-+ }
-+ // All IOCTLs will also be post wait
-+ }
-+ if(context & 0x80000000){ // Post wait message
-+ status = readl(reply+16);
-+ if(status >> 24){
-+ status &= 0xffff; /* Get detail status */
-+ } else {
-+ status = I2O_POST_WAIT_OK;
-+ }
-+ if(!(context & 0x40000000)) {
-+ cmd = (Scsi_Cmnd*) readl(reply+12);
-+ if(cmd != NULL) {
-+ printk(KERN_WARNING"%s: Apparent SCSI cmd in Post Wait Context - cmd=%p context=%x\n", pHba->name, cmd, context);
-+ }
-+ }
-+ adpt_i2o_post_wait_complete(context, status);
-+ } else { // SCSI message
-+ cmd = (Scsi_Cmnd*) readl(reply+12);
-+ if(cmd != NULL){
-+ adpt_i2o_to_scsi(reply, cmd);
-+ }
-+ }
-+ writel(m, pHba->reply_port);
-+
-+ spin_unlock_irqrestore(&io_request_lock, flags);
-+ return;
-+
-+}
-+
-+static void
-+adpt_i2o_poll(Scsi_Device *device)
-+{
-+ adpt_hba* pHba = (adpt_hba*) device->host->hostdata[0];
-+
-+ adpt_isr_poll(pHba);
-+}
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VESION(2,6,0))
-+static struct scsi_dump_ops dpt_i2o_dump_ops = {
-+ .sanity_check = adpt_i2o_sanity_check,
-+ .quiesce = adpt_i2o_quiesce,
-+ .poll = adpt_i2o_poll
-+};
-+#define driver_template driver_template_dump.hostt
-+static struct SHT_dump driver_template_dump = {
-+ .hostt = {
-+#else
-+static struct scsi_host_template driver_template = {
-+#endif
-+#else
- static struct scsi_host_template driver_template = {
-- .name = "dpt_i2o",
-- .proc_name = "dpt_i2o",
-- .proc_info = adpt_proc_info,
-- .detect = adpt_detect,
-- .release = adpt_release,
-- .info = adpt_info,
-- .queuecommand = adpt_queue,
-- .eh_abort_handler = adpt_abort,
-- .eh_device_reset_handler = adpt_device_reset,
-- .eh_bus_reset_handler = adpt_bus_reset,
-- .eh_host_reset_handler = adpt_reset,
-- .bios_param = adpt_bios_param,
-- .slave_configure = adpt_slave_configure,
-- .can_queue = MAX_TO_IOP_MESSAGES,
-- .this_id = 7,
-- .cmd_per_lun = 1,
-- .use_clustering = ENABLE_CLUSTERING,
-+#endif
-+#else
-+static struct scsi_host_template driver_template = {
-+#endif
-+ .name = DPT_DRIVER,
-+ .proc_name = DPT_DRIVER,
-+ .proc_info = adpt_proc_info,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-+ .detect = adpt_detect,
-+ .release = adpt_release,
-+#endif
-+ .info = adpt_info,
-+ .queuecommand = adpt_queue,
-+ .eh_abort_handler = adpt_abort,
-+ .eh_device_reset_handler = adpt_device_reset,
-+ .eh_bus_reset_handler = adpt_bus_reset,
-+ .eh_host_reset_handler = adpt_reset,
-+ .bios_param = adpt_bios_param,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+ .slave_configure = adpt_slave_configure,
-+#else
-+ .select_queue_depths = adpt_select_queue_depths,
-+#endif
-+ .can_queue = MAX_TO_IOP_MESSAGES,
-+ .this_id = 7,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ .sg_tablesize = 0, /* max scatter-gather cmds */
-+#endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7))
-+ .max_sectors = 4096,
-+#endif
-+ .cmd_per_lun = 256,
-+ .use_clustering = ENABLE_CLUSTERING,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+ .use_new_eh_code = 1,
-+#endif
-+#if (defined(SCSI_HAS_VARY_IO))
-+ .vary_io = 1,
-+#endif
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,65))
-+#if (defined(SCSI_HAS_DUMP))
-+#if (defined(SCSI_HAS_DUMP_SANITY_CHECK))
-+ .dump_sanity_check = adpt_i2o_sanity_check,
-+#endif
-+ .dump_poll = adpt_i2o_poll,
-+#endif
-+#elif (defined(SCSI_HAS_DUMP))
-+ .disk_dump = 1,
-+},
-+ .dump_ops = &dpt_i2o_dump_ops
-+#endif
- };
--#include "scsi_module.c"
--MODULE_LICENSE("GPL");
-+
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)) && ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)) || defined(PCI_HAS_SHUTDOWN)))
-+static void dpt_shutdown(struct pci_dev *pDev)
-+{
-+ adpt_i2o_sys_shutdown();
-+}
-+
-+#endif
-+static void __devexit dpt_remove_one(struct pci_dev * pDev)
-+{
-+ struct Scsi_Host *shost;
-+ adpt_hba* pHba;
-+
-+ shost = pci_get_drvdata(pDev);
-+ if (!shost)
-+ return;
-+#if 0
-+printk(KERN_INFO "dpt_remove_one(%p)\n", pDev);
-+printk(KERN_INFO "shost=%p pHba=%p\n", shost, pHba);
-+#endif
-+ adpt_release(shost);
-+ scsi_remove_host(shost);
-+ scsi_host_put(shost);
-+ pHba = *((adpt_hba**) shost->hostdata);
-+ if (pHba)
-+ pHba->host = NULL;
-+ pci_disable_device(pDev);
-+}
-+
-+static int __devinit dpt_probe_one(struct pci_dev *pDev,
-+ const struct pci_device_id * id)
-+{
-+ adpt_hba* pHba = NULL;
-+ adpt_hba* p = NULL;
-+ ulong base_addr0_phys = 0;
-+ ulong base_addr1_phys = 0;
-+ u32 hba_map0_area_size = 0;
-+ u32 hba_map1_area_size = 0;
-+ char __iomem * base_addr_virt = 0;
-+ char __iomem * msg_addr_virt = 0;
-+ int error = -EINVAL;
-+ int raptorFlag = 0;
-+
-+#if 0
-+printk(KERN_INFO "dpt_probe_one(%p,%p)\n", pDev, id);
-+#endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
-+ if(pci_enable_device(pDev))
-+ return error;
-+
-+ if (pci_request_regions(pDev, DPT_DRIVER)) {
-+ PERROR("dpti: adpt_config_hba: pci request region failed\n");
-+ return error;
-+ }
-+
-+ pci_set_master(pDev);
-+ if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
-+ pci_set_dma_mask(pDev, DMA_32BIT_MASK))
-+ return error;
-+
-+ base_addr0_phys = pci_resource_start(pDev,0);
-+ hba_map0_area_size = pci_resource_len(pDev,0);
-+
-+ // Check if standard PCI card or single BAR Raptor
-+ if(pDev->device == PCI_DPT_DEVICE_ID){
-+ if(pDev->subsystem_device >=0xc032 && pDev->subsystem_device <= 0xc03b){
-+ // Raptor card with this device id needs 4M
-+ hba_map0_area_size = 0x400000;
-+ } else { // Not Raptor - it is a PCI card
-+ if(hba_map0_area_size > 0x100000 ){
-+ hba_map0_area_size = 0x100000;
-+ }
-+ }
-+ } else {// Raptor split BAR config
-+ // Use BAR1 in this configuration
-+ base_addr1_phys = pci_resource_start(pDev,1);
-+ hba_map1_area_size = pci_resource_len(pDev,1);
-+ raptorFlag = 1;
-+ }
-+#else
-+ u16 command = 0;
-+ u16 subdevice = 0;
-+
-+ // Read in the command register and make sure that the device is
-+ // enabled and set up for bus master
-+ pci_read_config_word(pDev, PCI_COMMAND, &command);
-+ if(((command & PCI_COMMAND_MEMORY) && !(command & PCI_COMMAND_MASTER))){
-+ command |= PCI_COMMAND_MASTER;
-+ pci_write_config_word(pDev, PCI_COMMAND, command);
-+ }
-+
-+ pci_read_config_dword(pDev, PCI_BASE_ADDRESS_0,(u32*)&base_addr0_phys);
-+ // To get the size of the memory space taken we have to write out
-+ // 0xffffffff (32 bit) to the base register (PCI_BASE_ADDRESS_0)
-+ // and then read it back. The lower 4 bits are ignored not needed.
-+ // They contain address space flag (io or memory)
-+ // and memory type (32 1M 64)
-+ // The Rest is used to determine the size of memory space
-+ // used. All other upper bits will be set to ones.
-+ // If we take the negative of this number and add one
-+ // it will give us the memory size. We must also write the original
-+ // Base address back out to reset it up.
-+ pci_write_config_dword(pDev, PCI_BASE_ADDRESS_0 , 0xffffffff);
-+ pci_read_config_dword(pDev, PCI_BASE_ADDRESS_0 , &hba_map0_area_size);
-+
-+ // Restore the base address
-+ pci_write_config_dword(pDev, PCI_BASE_ADDRESS_0 , (u32)base_addr0_phys);
-+ (u32)base_addr0_phys &= PCI_BASE_ADDRESS_MEM_MASK;
-+
-+ // Take the negative, disreguard the bottem four bits and add 1
-+ hba_map0_area_size &= PCI_BASE_ADDRESS_MEM_MASK; // And out the lower 4 bits
-+ hba_map0_area_size = ~hba_map0_area_size + 1; // Take the negative and add 1
-+
-+ pci_read_config_word (pDev, PCI_SUBSYSTEM_ID, &subdevice);
-+
-+ if(pDev->device == PCI_DPT_DEVICE_ID){
-+ // Raptor card with this device id needs 4M
-+ if(subdevice >= 0xc032 && subdevice <= 0xc03b){
-+ hba_map0_area_size = 0x400000;
-+ } else {
-+ if(hba_map0_area_size > 0x100000) { // Only give 'em 1M
-+ hba_map0_area_size = 0x100000;
-+ }
-+ }
-+ } else {
-+ //Use BAR1 in this config
-+ pci_read_config_dword(pDev,PCI_BASE_ADDRESS_1, (u32*)&base_addr1_phys);
-+ pci_write_config_dword(pDev,PCI_BASE_ADDRESS_1, 0xffffffff);
-+ pci_read_config_dword(pDev,PCI_BASE_ADDRESS_1, &hba_map1_area_size);
-+
-+ //Restore the base address
-+ pci_write_config_dword(pDev,PCI_BASE_ADDRESS_1, (u32)base_addr1_phys);
-+ (u32)base_addr1_phys &= PCI_BASE_ADDRESS_MEM_MASK;
-+ hba_map1_area_size &= PCI_BASE_ADDRESS_MEM_MASK;
-+ hba_map1_area_size = ~hba_map1_area_size + 1;
-+
-+ raptorFlag=1;
-+ }
-+#endif
-+ /* x86_64 machines need more optimal mappings */
-+ if(raptorFlag == 1) {
-+ if (hba_map0_area_size > 128)
-+ hba_map0_area_size = 128;
-+ if (hba_map1_area_size > 524288)
-+ hba_map1_area_size = 524288;
-+ } else {
-+ if (hba_map0_area_size > 524288)
-+ hba_map0_area_size = 524288;
-+ }
-+
-+ base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);
-+ if(!base_addr_virt) {
-+ pci_release_regions(pDev);
-+ PERROR("dpti: adpt_config_hba: io remap failed\n");
-+ return error;
-+ }
-+
-+ if(raptorFlag == 1) {
-+ msg_addr_virt = ioremap(base_addr1_phys, hba_map1_area_size );
-+ if (!msg_addr_virt) {
-+ PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");
-+ iounmap(base_addr_virt);
-+ pci_release_regions(pDev);
-+ return error;
-+ }
-+ } else {
-+ msg_addr_virt = base_addr_virt;
-+ }
-+
-+ // Allocate and zero the data structure
-+ pHba = kmalloc(sizeof(adpt_hba), GFP_ATOMIC);
-+ if( pHba == NULL) {
-+ if(msg_addr_virt != base_addr_virt){
-+ iounmap(msg_addr_virt);
-+ }
-+ iounmap(base_addr_virt);
-+ pci_release_regions(pDev);
-+ return -ENOMEM;
-+ }
-+ memset(pHba, 0, sizeof(adpt_hba));
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+ down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
-+
-+ if(hba_chain != NULL){
-+ for(p = hba_chain; p->next; p = p->next);
-+ p->next = pHba;
-+ } else {
-+ hba_chain = pHba;
-+ }
-+ pHba->next = NULL;
-+ pHba->unit = hba_count;
-+ sprintf(pHba->name, "dpti%d", hba_count);
-+ hba_count++;
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+ up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
-+
-+ pHba->pDev = pDev;
-+ pHba->base_addr_phys = base_addr0_phys;
-+
-+ // Set up the Virtual Base Address of the I2O Device
-+ pHba->base_addr_virt = base_addr_virt;
-+ pHba->msg_addr_virt = msg_addr_virt;
-+ pHba->irq_mask = (u32 __iomem *)(base_addr_virt+0x30);
-+ pHba->post_port = (u32 __iomem *)(base_addr_virt+0x40);
-+ pHba->reply_port = (u32 __iomem *)(base_addr_virt+0x44);
-+
-+ pHba->hrt_va = NULL;
-+ pHba->lct_va = NULL;
-+ pHba->lct_size = 0;
-+ pHba->status_block_va = NULL;
-+ pHba->post_count = 0;
-+ pHba->state = DPTI_STATE_RESET;
-+ pHba->devices = NULL;
-+
-+ // Initializing the spinlocks
-+ spin_lock_init(&pHba->state_lock);
-+
-+ if(raptorFlag == 0){
-+ printk(KERN_INFO"Adaptec I2O RAID controller %d at %p size=%x irq=%d\n",
-+ hba_count-1, base_addr_virt, hba_map0_area_size, pDev->irq);
-+ } else {
-+ printk(KERN_INFO"Adaptec I2O RAID controller %d irq=%d\n",hba_count-1, pDev->irq);
-+ printk(KERN_INFO" BAR0 %p - size= %x\n",base_addr_virt,hba_map0_area_size);
-+ printk(KERN_INFO" BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size);
-+ }
-+
-+ if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ | SA_SAMPLE_RANDOM, pHba->name, pHba)) {
-+ printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq);
-+ adpt_i2o_delete_hba(pHba);
-+ return error;
-+ }
-+
-+ return 0;
-+}
-+
-+static struct pci_driver dpt_pci_driver = {
-+ .name = DPT_DRIVER,
-+ .id_table = dptids,
-+ .probe = dpt_probe_one,
-+ .remove = __devexit_p(dpt_remove_one),
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)) && ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)) || defined(PCI_HAS_SHUTDOWN)))
-+ .shutdown = dpt_shutdown,
-+#endif
-+};
-+
-+static void adpt_i2o_delete_hba(adpt_hba* pHba)
-+{
-+ adpt_hba* p1;
-+ adpt_hba* p2;
-+ struct i2o_device* d;
-+ struct i2o_device* next;
-+ int i;
-+ int j;
-+ struct adpt_device* pDev;
-+ struct adpt_device* pNext;
-+
-+#if 0
-+printk(KERN_INFO "adpt_i2o_delete_hba(%p)\n", pHba);
-+#endif
-+ if (pHba->host) {
-+ scsi_remove_host(pHba->host);
-+ free_irq(pHba->host->irq, pHba);
-+ }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+ down(&adpt_configuration_lock);
-+#else
-+ mutex_lock(&adpt_configuration_lock);
-+#endif
-+ // scsi_unregister calls our adpt_release which
-+ // does a quiese
-+ p2 = NULL;
-+ for( p1 = hba_chain; p1; p2 = p1,p1=p1->next){
-+ if(p1 == pHba) {
-+ if(p2) {
-+ p2->next = p1->next;
-+ } else {
-+ hba_chain = p1->next;
-+ }
-+ break;
-+ }
-+ }
-+
-+ hba_count--;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-+ up(&adpt_configuration_lock);
-+#else
-+ mutex_unlock(&adpt_configuration_lock);
-+#endif
-+
-+ iounmap(pHba->base_addr_virt);
-+ pHba->irq_mask = NULL;
-+ pHba->post_port = NULL;
-+ pHba->reply_port = NULL;
-+ if(pHba->msg_addr_virt != pHba->base_addr_virt){
-+ iounmap(pHba->msg_addr_virt);
-+ pHba->msg_addr_virt = NULL;
-+ }
-+ pHba->base_addr_virt = NULL;
-+ pci_release_regions(pHba->pDev);
-+ if(pHba->hrt_va) {
-+ pci_free_consistent(pHba->pDev, le32_to_cpu(pHba->hrt_va->num_entries) * le32_to_cpu(pHba->hrt_va->entry_len) << 2, pHba->hrt_va, pHba->hrt_pa);
-+ pHba->hrt_va = NULL;
-+ }
-+ if(pHba->lct_va){
-+ pci_free_consistent(pHba->pDev, pHba->lct_size, pHba->lct_va, pHba->lct_pa);
-+ pHba->lct_va = NULL;
-+ }
-+ if(pHba->status_block_va) {
-+ pci_free_consistent(pHba->pDev, sizeof(i2o_status_block), pHba->status_block_va, pHba->status_block_pa);
-+ pHba->status_block_va = NULL;
-+ }
-+ if(pHba->reply_pool_va){
-+ pci_free_consistent(pHba->pDev, pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, pHba->reply_pool_va, pHba->reply_pool_pa);
-+ pHba->reply_pool_va = NULL;
-+ }
-+
-+ for(d = pHba->devices; d ; d = next){
-+ next = d->next;
-+ kfree(d);
-+ }
-+ pHba->devices = NULL;
-+ for(i = 0 ; i < pHba->top_scsi_channel ; i++){
-+ for(j = 0; j < MAX_ID; j++){
-+ if(pHba->channel[i].device[j] != NULL){
-+ for(pDev = pHba->channel[i].device[j]; pDev; pDev = pNext){
-+ pNext = pDev->next_lun;
-+ kfree(pDev);
-+ }
-+ pHba->channel[i].device[j] = NULL;
-+ }
-+ }
-+ }
-+
-+ if (pHba->host != NULL) {
-+ scsi_host_put(pHba->host);
-+ pci_set_drvdata(pHba->pDev, NULL);
-+ pHba->host = NULL;
-+ }
-+ pci_disable_device(pHba->pDev);
-+ kfree(pHba);
-+
-+ if(hba_count <= 0){
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
-+# if (defined(CONFIG_COMPAT))
-+ unregister_ioctl32_conversion(DPT_SIGNATURE);
-+ unregister_ioctl32_conversion(I2OUSRCMD);
-+ unregister_ioctl32_conversion(DPT_CTRLINFO);
-+ unregister_ioctl32_conversion(DPT_SYSINFO);
-+ unregister_ioctl32_conversion(DPT_BLINKLED);
-+ unregister_ioctl32_conversion(I2ORESETCMD);
-+ unregister_ioctl32_conversion(I2ORESCANCMD);
-+ unregister_ioctl32_conversion(DPT_TARGET_BUSY & 0xFFFF);
-+ unregister_ioctl32_conversion(DPT_TARGET_BUSY);
-+# endif
-+#endif
-+ unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER);
-+#ifdef REBOOT_NOTIFIER
-+ unregister_reboot_notifier(&adpt_reboot_notifier);
-+#endif
-+ pci_unregister_driver(&dpt_pci_driver);
-+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) && defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ scsi_unregister_module(MODULE_SCSI_HA,&driver_template);
-+#endif
-+ }
-+}
-+
-+static int __init dpt_init(void)
-+{
-+ int error;
-+ adpt_hba* pHba;
-+
-+ printk(KERN_INFO"Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
-+#ifdef REBOOT_NOTIFIER
-+ register_reboot_notifier(&adpt_reboot_notifier);
-+#endif
-+
-+ PINFO("Detecting Adaptec I2O RAID controllers...\n");
-+
-+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) && defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ scsi_register_module(MODULE_SCSI_HA,&driver_template);
-+ /* Reverse 'detect' action */
-+ driver_template.present = 0;
-+#endif
-+
-+ error = pci_register_driver(&dpt_pci_driver);
-+
-+ if (error < 0 || hba_count == 0) {
-+ pci_unregister_driver(&dpt_pci_driver);
-+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) && defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ scsi_unregister_module(MODULE_SCSI_HA,&driver_template);
-+#endif
-+#ifdef REBOOT_NOTIFIER
-+ unregister_reboot_notifier(&adpt_reboot_notifier);
-+#endif
-+ return (error < 0) ? error : -ENODEV;
-+ }
-+ /* In INIT state, Activate IOPs */
-+ for (pHba = hba_chain; pHba; pHba = pHba->next) {
-+ // Activate does get status , init outbound, and get hrt
-+ if (adpt_i2o_activate_hba(pHba) < 0) {
-+ adpt_i2o_delete_hba(pHba);
-+ }
-+ }
-+
-+ /* Active IOPs in HOLD state */
-+
-+rebuild_sys_tab:
-+ if (hba_chain == NULL)
-+ return -ENODEV;
-+
-+ /*
-+ * If build_sys_table fails, we kill everything and bail
-+ * as we can't init the IOPs w/o a system table
-+ */
-+ if (adpt_i2o_build_sys_table() < 0) {
-+ adpt_i2o_sys_shutdown();
-+ return -ENODEV;
-+ }
-+
-+ PDEBUG("HBA's in HOLD state\n");
-+
-+ /* If IOP don't get online, we need to rebuild the System table */
-+ for (pHba = hba_chain; pHba; pHba = pHba->next) {
-+ if (adpt_i2o_online_hba(pHba) < 0) {
-+ adpt_i2o_delete_hba(pHba);
-+ goto rebuild_sys_tab;
-+ }
-+ }
-+
-+ /* Active IOPs now in OPERATIONAL state */
-+ PDEBUG("HBA's in OPERATIONAL state\n");
-+
-+ printk(KERN_INFO"dpti: If you have a lot of devices this could take a few minutes.\n");
-+ for (pHba = hba_chain; pHba; pHba = pHba->next) {
-+ printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name);
-+ if (adpt_i2o_lct_get(pHba) < 0){
-+ adpt_i2o_delete_hba(pHba);
-+ continue;
-+ }
-+
-+ if (adpt_i2o_parse_lct(pHba) < 0){
-+ adpt_i2o_delete_hba(pHba);
-+ continue;
-+ }
-+ adpt_inquiry(pHba);
-+ }
-+
-+#if 0
-+printk (KERN_INFO"dpti: Register us with the SCSI system\n");
-+#endif
-+ for (pHba = hba_chain; pHba; pHba = pHba->next) {
-+ pHba->initialized = 1;
-+ pHba->state &= ~DPTI_STATE_RESET;
-+#if 0
-+printk (KERN_INFO"adpt_scsi_register(%p,%p)\n", pHba, &driver_template);
-+#endif
-+ if( adpt_scsi_register(pHba, &driver_template) < 0){
-+#if 0
-+printk (KERN_INFO"adpt_i2o_delete_hba(%p)\n", pHba);
-+#endif
-+ adpt_i2o_delete_hba(pHba);
-+ continue;
-+ }
-+#if 0
-+printk (KERN_INFO"registered\n");
-+#endif
-+ }
-+
-+ // Register our control device node
-+ // nodes will need to be created in /dev to access this
-+ // the nodes can not be created from within the driver
-+#if 0
-+printk (KERN_INFO"dpti: Register us with the char device system\n");
-+#endif
-+ if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) {
-+ adpt_i2o_sys_shutdown();
-+ return -EINVAL;
-+ }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
-+# if (defined(CONFIG_COMPAT))
-+ register_ioctl32_conversion(DPT_SIGNATURE,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(I2OUSRCMD,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(DPT_CTRLINFO,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(DPT_SYSINFO,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(DPT_BLINKLED,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(I2ORESETCMD,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(I2ORESCANCMD,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(DPT_TARGET_BUSY & 0xFFFF,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+ register_ioctl32_conversion(DPT_TARGET_BUSY,
-+ (int(*)(unsigned int,unsigned int,unsigned long,struct file*))sys_ioctl);
-+# endif
-+#endif
-+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) && !defined(SCSI_HAS_SCSI_IN_DETECTION))
-+ /* Trigger a target scan in the 2.4 tree */
-+ if (!dpt_dummy) {
-+ dpt_dummy = scsi_host_alloc(&driver_template,0);
-+ }
-+ scsi_register_module(MODULE_SCSI_HA,&driver_template);
-+#endif
-+
-+#if 0
-+printk (KERN_INFO"dpti: %d adapters\n", hba_count);
-+#endif
-+ return hba_count == 0;
-+}
-+
-+static void __exit dpt_exit(void)
-+{
-+ adpt_i2o_sys_shutdown();
-+}
-+
-+module_init(dpt_init);
-+module_exit(dpt_exit);
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,65))
-+EXPORT_NO_SYMBOLS;
-+#endif
-+
-+MODULE_LICENSE("Dual BSD/GPL");
-+#if ((LINUX_VERSION_CODE > KERNEL_VERSION(2,6,3)) || defined(MODULE_VERSION))
-+MODULE_VERSION(DPT_I2O_VERSION);
-+#endif
---- ./drivers/scsi/dpti.h.dpt 2004-10-19 01:53:06.000000000 +0400
-+++ ./drivers/scsi/dpti.h 2006-09-08 15:10:02.000000000 +0400
-@@ -3,10 +3,10 @@
- -------------------
- begin : Thu Sep 7 2000
- copyright : (C) 2001 by Adaptec
-- email : deanna_bonds@adaptec.com
-+ email : Mark_Salyzyn@adaptec.com
-+ original author : deanna_bonds@adaptec.com
-
-- See Documentation/scsi/dpti.txt for history, notes, license info
-- and credits
-+ See README.dpti for history, notes, license info, and credits
- ***************************************************************************/
-
- /***************************************************************************
-@@ -25,54 +25,97 @@
- #include <linux/version.h>
- #endif
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,00)
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,00))
- #define MAX_TO_IOP_MESSAGES (210)
- #else
- #define MAX_TO_IOP_MESSAGES (255)
- #endif
- #define MAX_FROM_IOP_MESSAGES (255)
-
-+#if (defined(SCSI_HAS_DUMP))
-+/******************************** Disk dump ***********************************/
-+#if defined(CONFIG_DISKDUMP) || defined(CONFIG_DISKDUMP_MODULE)
-+#undef schedule
-+#define schedule diskdump_schedule
-+#undef schedule_timeout
-+#define schedule_timeout diskdump_schedule_timeout
-+#undef __wake_up
-+#define __wake_up diskdump_wake_up
-+#define dpti_crashdump_mode() crashdump_mode()
-+#else
-+#define dpti_crashdump_mode() (0)
-+#endif
-+#endif
-
- /*
- * SCSI interface function Prototypes
- */
-
-+#ifndef scmd_printk
-+#define scmd_printk(w,c,f,...) dev_printk(w,&c->device->sdev_gendev,f,__VA_ARGS__)
-+#endif
-+#ifndef scmd_channel
-+#define scmd_channel(x) x->device->channel
-+#endif
-+#ifndef scmd_id
-+#define scmd_id(x) x->device->id
-+#endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+static int adpt_proc_info(struct Scsi_Host * host, char *buffer, char **start, off_t offset, int length, int inout);
-+#else
- static int adpt_detect(struct scsi_host_template * sht);
-+static int adpt_proc_info(char *buffer, char **start, off_t offset, int length, int host_no, int inout);
-+#endif
- static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *));
- static int adpt_abort(struct scsi_cmnd * cmd);
- static int adpt_reset(struct scsi_cmnd* cmd);
- static int adpt_release(struct Scsi_Host *host);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
- static int adpt_slave_configure(struct scsi_device *);
-+#else
-+static void adpt_select_queue_depths(struct Scsi_Host *host, struct scsi_device * devicelist);
-+#endif
-
- static const char *adpt_info(struct Scsi_Host *pSHost);
--static int adpt_bios_param(struct scsi_device * sdev, struct block_device *dev,
-- sector_t, int geom[]);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,65))
-+static int adpt_bios_param(struct scsi_device * sdev, struct block_device * bdev, sector_t, int geom[]);
-+#else
-+static int adpt_bios_param(Disk * disk, kdev_t dev, int geom[]);
-+#endif
-
- static int adpt_bus_reset(struct scsi_cmnd* cmd);
- static int adpt_device_reset(struct scsi_cmnd* cmd);
-
--
--/*
-- * Scsi_Host_Template (see hosts.h)
-- */
--
- #define DPT_DRIVER_NAME "Adaptec I2O RAID"
-
- #ifndef HOSTS_C
-
- #include "dpt/sys_info.h"
- #include <linux/wait.h>
-+#include <linux/interrupt.h>
- #include "dpt/dpti_i2o.h"
- #include "dpt/dpti_ioctl.h"
-
--#define DPT_I2O_VERSION "2.4 Build 5go"
- #define DPT_VERSION 2
--#define DPT_REVISION '4'
--#define DPT_SUBREVISION '5'
-+#define DPT_REVISION 5
-+#define DPT_SUBREVISION 0
- #define DPT_BETA ""
--#define DPT_MONTH 8
--#define DPT_DAY 7
--#define DPT_YEAR (2001-1980)
-+#define DPT_MONTH 6
-+#define DPT_DAY 8
-+#define DPT_YEAR (2005-1980)
-+
-+#define _str(x) #x
-+#define str(x) _str(x)
-+#if (defined(DPT_I2O_DRIVER_BUILD))
-+# if (DPT_I2O_DRIVER_BUILD == 9999)
-+# under DPT_I2O_DRIVER_BUILD
-+# endif
-+#endif
-+#if (defined(DPT_I2O_DRIVER_BUILD))
-+# define DPT_I2O_VERSION str(DPT_VERSION) "." str(DPT_REVISION) "." str(DPT_SUBREVISION) "[" str(DPT_I2O_DRIVER_BUILD) "]" DPT_BETA
-+#else
-+# define DPT_I2O_VERSION str(DPT_VERSION) "." str(DPT_REVISION) "." str(DPT_SUBREVISION) DPT_BETA " " __DATE__ " " __TIME__
-+#endif
-
- #define DPT_DRIVER "dpt_i2o"
- #define DPTI_I2O_MAJOR (151)
-@@ -213,6 +256,16 @@ struct adpt_channel {
- // HBA state flags
- #define DPTI_STATE_RESET (0x01)
- #define DPTI_STATE_IOCTL (0x02)
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-+#define __iomem
-+#define __user
-+#endif
-+#ifndef DMA_64BIT_MASK
-+#define DMA_64BIT_MASK ((dma_addr_t)0xffffffffffffffffULL)
-+#endif
-+#ifndef DMA_32BIT_MASK
-+#define DMA_32BIT_MASK ((dma_addr_t)0xffffffffULL)
-+#endif
-
- typedef struct _adpt_hba {
- struct _adpt_hba *next;
-@@ -228,36 +281,42 @@ typedef struct _adpt_hba {
- char name[32];
- char detail[55];
-
-- ulong base_addr_virt;
-- ulong msg_addr_virt;
-+ char __iomem * base_addr_virt;
-+ char __iomem * msg_addr_virt;
- ulong base_addr_phys;
-- ulong post_port;
-- ulong reply_port;
-- ulong irq_mask;
-+ u32 __iomem * post_port;
-+ u32 __iomem * reply_port;
-+ u32 __iomem * irq_mask;
- u16 post_count;
- u32 post_fifo_size;
- u32 reply_fifo_size;
-- u32* reply_pool;
-+ u32* reply_pool_va;
-+ dma_addr_t reply_pool_pa;
- u32 sg_tablesize; // Scatter/Gather List Size.
- u8 top_scsi_channel;
- u8 top_scsi_id;
- u8 top_scsi_lun;
-+ u8 pae_support;
-
-- i2o_status_block* status_block;
-- i2o_hrt* hrt;
-- i2o_lct* lct;
-+ i2o_status_block* status_block_va;
-+ dma_addr_t status_block_pa;
-+ i2o_hrt* hrt_va;
-+ dma_addr_t hrt_pa;
-+ i2o_lct* lct_va;
-+ dma_addr_t lct_pa;
- uint lct_size;
- struct i2o_device* devices;
- struct adpt_channel channel[MAX_CHANNEL];
- struct proc_dir_entry* proc_entry; /* /proc dir */
-
-- ulong FwDebugBuffer_P; // Virtual Address Of FW Debug Buffer
-- u32 FwDebugBufferSize; // FW Debug Buffer Size In Bytes
-- ulong FwDebugStrLength_P; // Virtual Addr Of FW Debug String Len
-- ulong FwDebugFlags_P; // Virtual Address Of FW Debug Flags
-- ulong FwDebugBLEDflag_P; // Virtual Addr Of FW Debug BLED
-- ulong FwDebugBLEDvalue_P; // Virtual Addr Of FW Debug BLED
-- u32 FwDebugFlags;
-+ char __iomem * fw_buffer_addr_virt; // Virtual Address Of FW Debug Buffer
-+ char __iomem * bled_flag_addr_virt; // Virtual Addr Of FW Debug BLED
-+ char __iomem * bled_value_addr_virt; // Virtual Addr Of FW Debug BLED
-+
-+ u32 fw_buffer_size; // FW Debug Buffer Size In Bytes
-+ char __iomem * fw_string_len_addr_virt; // Virtual Addr Of FW Debug String Len
-+ char __iomem * fw_debug_flags_addr_virt; // Virtual Address Of FW Debug Flags
-+ u32 * ioctl_reply_context[4];
- } adpt_hba;
-
- struct sg_simple_element {
-@@ -269,8 +328,59 @@ struct sg_simple_element {
- * Function Prototypes
- */
-
-+#ifndef IRQ_HANDLED
-+ typedef void irqreturn_t;
-+# define IRQ_NONE
-+# define IRQ_HANDLED
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
-+#define iminor(x) MINOR(x->i_rdev)
-+#define scsi_host_alloc(t,s) scsi_register(t,s)
-+#define scsi_host_put(s) scsi_unregister(s)
-+#define scsi_add_host(s,d) 0
-+#define scsi_remove_host(s)
-+#ifndef SCSI_HAS_SCSI_SCAN_HOST
-+#ifndef scsi_scan_host
-+#define scsi_scan_host(s)
-+#endif
-+#endif
-+#if (!defined(__devexit_p))
-+# if (defined(MODULE))
-+# define __devexit_p(x) x
-+# else
-+# define __devexit_p(x) NULL
-+# endif
-+#endif
-+#if (!defined(__devexit))
-+# define __devexit
-+#endif
-+#if (!defined(__devinit))
-+# define __devinit
-+#endif
-+#if (!defined(__exit))
-+# define __exit
-+#endif
-+#if (!defined(__init))
-+# define __init
-+#endif
-+#endif
-+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6)) && (!defined(SCSI_HAS_SCSI_DEVICE_ONLINE)))
-+#define scsi_device_online(d) ((d)->online)
-+#define scsi_device_set_online(d,s) ((d)->online=(s))
-+#else
-+#define scsi_device_set_online(d,s) ((d)->sdev_state = (s) ? SDEV_RUNNING : SDEV_OFFLINE)
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-+#define set_current_state(x) current->state = x
-+#endif
-+
-+#ifndef MODULE_LICENSE
-+# define MODULE_LICENSE(x) /* NOTHING */
-+#endif
-+
- static void adpt_i2o_sys_shutdown(void);
--static int adpt_init(void);
- static int adpt_i2o_build_sys_table(void);
- static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs);
- #ifdef REBOOT_NOTIFIER
-@@ -284,7 +394,8 @@ static int adpt_i2o_query_scalar(adpt_hb
- static const char *adpt_i2o_get_class_name(int class);
- #endif
- static int adpt_i2o_issue_params(int cmd, adpt_hba* pHba, int tid,
-- void *opblk, int oplen, void *resblk, int reslen);
-+ void *opblk_va, dma_addr_t opblk_pa, int oplen,
-+ void *resblk_va, dma_addr_t resblk_pa, int reslen);
- static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout);
- static int adpt_i2o_lct_get(adpt_hba* pHba);
- static int adpt_i2o_parse_lct(adpt_hba* pHba);
-@@ -297,7 +408,7 @@ static s32 adpt_i2o_status_get(adpt_hba*
- static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
- static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
- static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
--static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd);
-+static s32 adpt_i2o_to_scsi(void __iomem * reply, struct scsi_cmnd* cmd);
- static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht);
- static s32 adpt_hba_reset(adpt_hba* pHba);
- static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
-@@ -308,7 +419,6 @@ static void adpt_i2o_delete_hba(adpt_hba
- static void adpt_inquiry(adpt_hba* pHba);
- static void adpt_fail_posted_scbs(adpt_hba* pHba);
- static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun);
--static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
- static int adpt_i2o_online_hba(adpt_hba* pHba);
- static void adpt_i2o_post_wait_complete(u32, int);
- static int adpt_i2o_systab_send(adpt_hba* pHba);
-@@ -322,9 +432,18 @@ static int adpt_close(struct inode *inod
- static void adpt_delay(int millisec);
- #endif
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
- static struct pci_dev* adpt_pci_find_device(uint vendor, struct pci_dev* from);
- #endif
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2))
-+static inline void scsi_set_pci_device(struct Scsi_Host * SHpnt, struct pci_dev * pdev)
-+{
-+// SHpnt->pci_dev = pdev;
-+}
-+#endif
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,4))
-+# define pci_disable_device(x)
-+#endif
-
- #if defined __ia64__
- static void adpt_ia64_info(sysInfo_S* si);
diff --git a/openvz-sources/023.030/5134_linux-2.6.9-i2o-1.325.patch b/openvz-sources/023.030/5134_linux-2.6.9-i2o-1.325.patch
deleted file mode 100644
index 50cc2e3..0000000
--- a/openvz-sources/023.030/5134_linux-2.6.9-i2o-1.325.patch
+++ /dev/null
@@ -1,9634 +0,0 @@
-diff -Nurap ./drivers/message/i2o.i2o/Kconfig ./drivers/message/i2o/Kconfig
---- ./drivers/message/i2o.i2o/Kconfig 2004-10-19 01:53:07.000000000 +0400
-+++ ./drivers/message/i2o/Kconfig 2006-09-08 15:10:02.000000000 +0400
-@@ -24,10 +24,40 @@ config I2O
-
- If unsure, say N.
-
-+config I2O_LCT_NOTIFY_ON_CHANGES
-+ bool "Enable LCT notification"
-+ depends on I2O
-+ default y
-+ ---help---
-+ Only say N here if you have a I2O controller from SUN. The SUN
-+ firmware doesn't support LCT notification on changes. If this option
-+ is enabled on such a controller the driver will hang up in a endless
-+ loop. On all other controllers say Y.
-+
-+ If unsure, say Y.
-+
-+config I2O_EXT_ADAPTEC
-+ bool "Enable Adaptec extensions"
-+ depends on I2O
-+ default y
-+ ---help---
-+ Say Y for support of raidutils for Adaptec I2O controllers. You also
-+ have to say Y to "I2O Configuration support", "I2O SCSI OSM" below
-+ and to "SCSI generic support" under "SCSI device configuration".
-+
-+config I2O_EXT_ADAPTEC_DMA64
-+ bool "Enable 64-bit DMA"
-+ depends on I2O_EXT_ADAPTEC && ( 64BIT || HIGHMEM64G )
-+ default y
-+ ---help---
-+ Say Y for support of 64-bit DMA transfer mode on Adaptec I2O
-+ controllers.
-+ Note: You need at least firmware version 3709.
-+
- config I2O_CONFIG
- tristate "I2O Configuration support"
-- depends on PCI && I2O
-- help
-+ depends on I2O
-+ ---help---
- Say Y for support of the configuration interface for the I2O adapters.
- If you have a RAID controller from Adaptec and you want to use the
- raidutils to manage your RAID array, you have to say Y here.
-@@ -35,10 +65,31 @@ config I2O_CONFIG
- To compile this support as a module, choose M here: the
- module will be called i2o_config.
-
-+ Note: If you want to use the new API you have to download the
-+ i2o_config patch from http://i2o.shadowconnect.com/
-+
-+config I2O_CONFIG_OLD_IOCTL
-+ bool "Enable ioctls (OBSOLETE)"
-+ depends on I2O_CONFIG
-+ default y
-+ ---help---
-+ Enables old ioctls.
-+
-+config I2O_BUS
-+ tristate "I2O Bus Adapter OSM"
-+ depends on I2O
-+ ---help---
-+ Include support for the I2O Bus Adapter OSM. The Bus Adapter OSM
-+ provides access to the busses on the I2O controller. The main purpose
-+ is to rescan the bus to find new devices.
-+
-+ To compile this support as a module, choose M here: the
-+ module will be called i2o_bus.
-+
- config I2O_BLOCK
- tristate "I2O Block OSM"
- depends on I2O
-- help
-+ ---help---
- Include support for the I2O Block OSM. The Block OSM presents disk
- and other structured block devices to the operating system. If you
- are using an RAID controller, you could access the array only by
-@@ -51,7 +102,7 @@ config I2O_BLOCK
- config I2O_SCSI
- tristate "I2O SCSI OSM"
- depends on I2O && SCSI
-- help
-+ ---help---
- Allows direct SCSI access to SCSI devices on a SCSI or FibreChannel
- I2O controller. You can use both the SCSI and Block OSM together if
- you wish. To access a RAID array, you must use the Block OSM driver.
-@@ -63,7 +114,7 @@ config I2O_SCSI
- config I2O_PROC
- tristate "I2O /proc support"
- depends on I2O
-- help
-+ ---help---
- If you say Y here and to "/proc file system support", you will be
- able to read I2O related information from the virtual directory
- /proc/i2o.
-diff -Nurap ./drivers/message/i2o.i2o/Makefile ./drivers/message/i2o/Makefile
---- ./drivers/message/i2o.i2o/Makefile 2004-10-19 01:54:39.000000000 +0400
-+++ ./drivers/message/i2o/Makefile 2006-09-08 15:10:02.000000000 +0400
-@@ -6,8 +6,11 @@
- #
-
- i2o_core-y += iop.o driver.o device.o debug.o pci.o exec-osm.o
-+i2o_bus-y += bus-osm.o
-+i2o_config-y += config-osm.o
- obj-$(CONFIG_I2O) += i2o_core.o
- obj-$(CONFIG_I2O_CONFIG)+= i2o_config.o
-+obj-$(CONFIG_I2O_BUS) += i2o_bus.o
- obj-$(CONFIG_I2O_BLOCK) += i2o_block.o
- obj-$(CONFIG_I2O_SCSI) += i2o_scsi.o
- obj-$(CONFIG_I2O_PROC) += i2o_proc.o
-diff -Nurap ./drivers/message/i2o.i2o/README.ioctl ./drivers/message/i2o/README.ioctl
---- ./drivers/message/i2o.i2o/README.ioctl 2004-10-19 01:54:37.000000000 +0400
-+++ ./drivers/message/i2o/README.ioctl 2006-09-08 15:10:02.000000000 +0400
-@@ -185,7 +185,7 @@ VII. Getting Parameters
- ENOMEM Kernel memory allocation error
-
- A return value of 0 does not mean that the value was actually
-- properly retreived. The user should check the result list
-+ properly retrieved. The user should check the result list
- to determine the specific status of the transaction.
-
- VIII. Downloading Software
-diff -Nurap ./drivers/message/i2o.i2o/bus-osm.c ./drivers/message/i2o/bus-osm.c
---- ./drivers/message/i2o.i2o/bus-osm.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/message/i2o/bus-osm.c 2006-09-08 15:10:02.000000000 +0400
-@@ -0,0 +1,164 @@
-+/*
-+ * Bus Adapter OSM
-+ *
-+ * Copyright (C) 2005 Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * Fixes/additions:
-+ * Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ * initial version.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/i2o.h>
-+
-+#define OSM_NAME "bus-osm"
-+#define OSM_VERSION "1.317"
-+#define OSM_DESCRIPTION "I2O Bus Adapter OSM"
-+
-+static struct i2o_driver i2o_bus_driver;
-+
-+/* Bus OSM class handling definition */
-+static struct i2o_class_id i2o_bus_class_id[] = {
-+ {I2O_CLASS_BUS_ADAPTER},
-+ {I2O_CLASS_END}
-+};
-+
-+/**
-+ * i2o_bus_scan - Scan the bus for new devices
-+ * @dev: I2O device of the bus, which should be scanned
-+ *
-+ * Scans the bus dev for new / removed devices. After the scan a new LCT
-+ * will be fetched automatically.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+static int i2o_bus_scan(struct i2o_device *dev)
-+{
-+ struct i2o_message *msg;
-+
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return -ETIMEDOUT;
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BUS_SCAN << 24 | HOST_TID << 12 | dev->lct_data.
-+ tid);
-+
-+ return i2o_msg_post_wait(dev->iop, msg, 60);
-+};
-+
-+/**
-+ * i2o_bus_store_scan - Scan the I2O Bus Adapter
-+ * @d: device which should be scanned
-+ *
-+ * Returns count.
-+ */
-+static ssize_t i2o_bus_store_scan(struct device *d,
-+ const char *buf, size_t count)
-+{
-+ struct i2o_device *i2o_dev = to_i2o_device(d);
-+ int rc;
-+
-+ if ((rc = i2o_bus_scan(i2o_dev)))
-+ osm_warn("bus scan failed %d\n", rc);
-+
-+ return count;
-+}
-+
-+/* Bus Adapter OSM device attributes */
-+static DEVICE_ATTR(scan, S_IWUSR, NULL, i2o_bus_store_scan);
-+
-+/**
-+ * i2o_bus_probe - verify if dev is a I2O Bus Adapter device and install it
-+ * @dev: device to verify if it is a I2O Bus Adapter device
-+ *
-+ * Because we want all Bus Adapters always return 0.
-+ *
-+ * Returns 0.
-+ */
-+static int i2o_bus_probe(struct device *dev)
-+{
-+ struct i2o_device *i2o_dev = to_i2o_device(get_device(dev));
-+
-+ device_create_file(dev, &dev_attr_scan);
-+
-+ osm_info("device added (TID: %03x)\n", i2o_dev->lct_data.tid);
-+
-+ return 0;
-+};
-+
-+/**
-+ * i2o_bus_remove - remove the I2O Bus Adapter device from the system again
-+ * @dev: I2O Bus Adapter device which should be removed
-+ *
-+ * Always returns 0.
-+ */
-+static int i2o_bus_remove(struct device *dev)
-+{
-+ struct i2o_device *i2o_dev = to_i2o_device(dev);
-+
-+ device_remove_file(dev, &dev_attr_scan);
-+
-+ put_device(dev);
-+
-+ osm_info("device removed (TID: %03x)\n", i2o_dev->lct_data.tid);
-+
-+ return 0;
-+};
-+
-+/* Bus Adapter OSM driver struct */
-+static struct i2o_driver i2o_bus_driver = {
-+ .name = OSM_NAME,
-+ .classes = i2o_bus_class_id,
-+ .driver = {
-+ .probe = i2o_bus_probe,
-+ .remove = i2o_bus_remove,
-+ },
-+};
-+
-+/**
-+ * i2o_bus_init - Bus Adapter OSM initialization function
-+ *
-+ * Only register the Bus Adapter OSM in the I2O core.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+static int __init i2o_bus_init(void)
-+{
-+ int rc;
-+
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-+
-+ /* Register Bus Adapter OSM into I2O core */
-+ rc = i2o_driver_register(&i2o_bus_driver);
-+ if (rc) {
-+ osm_err("Could not register Bus Adapter OSM\n");
-+ return rc;
-+ }
-+
-+ return 0;
-+};
-+
-+/**
-+ * i2o_bus_exit - Bus Adapter OSM exit function
-+ *
-+ * Unregisters Bus Adapter OSM from I2O core.
-+ */
-+static void __exit i2o_bus_exit(void)
-+{
-+ i2o_driver_unregister(&i2o_bus_driver);
-+};
-+
-+MODULE_AUTHOR("Markus Lidel <Markus.Lidel@shadowconnect.com>");
-+MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-+
-+module_init(i2o_bus_init);
-+module_exit(i2o_bus_exit);
-diff -Nurap ./drivers/message/i2o.i2o/config-osm.c ./drivers/message/i2o/config-osm.c
---- ./drivers/message/i2o.i2o/config-osm.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/message/i2o/config-osm.c 2006-09-08 15:10:02.000000000 +0400
-@@ -0,0 +1,90 @@
-+/*
-+ * Configuration OSM
-+ *
-+ * Copyright (C) 2005 Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * Fixes/additions:
-+ * Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ * initial version.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/i2o.h>
-+#include <linux/dcache.h>
-+#include <linux/namei.h>
-+#include <linux/fs.h>
-+
-+#include <asm/uaccess.h>
-+
-+#define OSM_NAME "config-osm"
-+#define OSM_VERSION "1.323"
-+#define OSM_DESCRIPTION "I2O Configuration OSM"
-+
-+/* access mode user rw */
-+#define S_IWRSR (S_IRUSR | S_IWUSR)
-+
-+static struct i2o_driver i2o_config_driver;
-+
-+/* Config OSM driver struct */
-+static struct i2o_driver i2o_config_driver = {
-+ .name = OSM_NAME,
-+};
-+
-+#ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
-+#include "i2o_config.c"
-+#endif
-+
-+/**
-+ * i2o_config_init - Configuration OSM initialization function
-+ *
-+ * Registers Configuration OSM in the I2O core and if old ioctl's are
-+ * compiled in initialize them.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+static int __init i2o_config_init(void)
-+{
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-+
-+ if (i2o_driver_register(&i2o_config_driver)) {
-+ osm_err("handler register failed.\n");
-+ return -EBUSY;
-+ }
-+#ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
-+ if (i2o_config_old_init()) {
-+ osm_err("old config handler initialization failed\n");
-+ i2o_driver_unregister(&i2o_config_driver);
-+ return -EBUSY;
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+/**
-+ * i2o_config_exit - Configuration OSM exit function
-+ *
-+ * If old ioctl's are compiled in exit remove them and unregisters
-+ * Configuration OSM from I2O core.
-+ */
-+static void i2o_config_exit(void)
-+{
-+#ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
-+ i2o_config_old_exit();
-+#endif
-+
-+ i2o_driver_unregister(&i2o_config_driver);
-+}
-+
-+MODULE_AUTHOR("Markus Lidel <Markus.Lidel@shadowconnect.com>");
-+MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-+
-+module_init(i2o_config_init);
-+module_exit(i2o_config_exit);
-diff -Nurap ./drivers/message/i2o.i2o/core.h ./drivers/message/i2o/core.h
---- ./drivers/message/i2o.i2o/core.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/message/i2o/core.h 2006-09-08 15:10:02.000000000 +0400
-@@ -0,0 +1,66 @@
-+/*
-+ * I2O core internal declarations
-+ *
-+ * Copyright (C) 2005 Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * Fixes/additions:
-+ * Markus Lidel <Markus.Lidel@shadowconnect.com>
-+ * initial version.
-+ */
-+
-+/* Exec-OSM */
-+extern struct i2o_driver i2o_exec_driver;
-+extern int i2o_exec_lct_get(struct i2o_controller *);
-+
-+extern int __init i2o_exec_init(void);
-+extern void __exit i2o_exec_exit(void);
-+
-+/* driver */
-+extern struct bus_type i2o_bus_type;
-+
-+extern int i2o_driver_dispatch(struct i2o_controller *, u32);
-+
-+extern int __init i2o_driver_init(void);
-+extern void __exit i2o_driver_exit(void);
-+
-+/* PCI */
-+extern int __init i2o_pci_init(void);
-+extern void __exit i2o_pci_exit(void);
-+
-+/* device */
-+extern struct device_attribute i2o_device_attrs[];
-+
-+extern void i2o_device_remove(struct i2o_device *);
-+extern int i2o_device_parse_lct(struct i2o_controller *);
-+
-+/* IOP */
-+extern struct i2o_controller *i2o_iop_alloc(void);
-+
-+/**
-+ * i2o_iop_free - Free the i2o_controller struct
-+ * @c: I2O controller to free
-+ */
-+static inline void i2o_iop_free(struct i2o_controller *c)
-+{
-+ i2o_pool_free(&c->in_msg);
-+ kfree(c);
-+}
-+
-+extern int i2o_iop_add(struct i2o_controller *);
-+extern void i2o_iop_remove(struct i2o_controller *);
-+
-+/* control registers relative to c->base */
-+#define I2O_IRQ_STATUS 0x30
-+#define I2O_IRQ_MASK 0x34
-+#define I2O_IN_PORT 0x40
-+#define I2O_OUT_PORT 0x44
-+
-+/* Motorola/Freescale specific register offset */
-+#define I2O_MOTOROLA_PORT_OFFSET 0x10400
-+
-+#define I2O_IRQ_OUTBOUND_POST 0x00000008
-diff -Nurap ./drivers/message/i2o.i2o/debug.c ./drivers/message/i2o/debug.c
---- ./drivers/message/i2o.i2o/debug.c 2004-10-19 01:54:32.000000000 +0400
-+++ ./drivers/message/i2o/debug.c 2006-09-08 15:10:02.000000000 +0400
-@@ -4,40 +4,12 @@
- #include <linux/pci.h>
- #include <linux/i2o.h>
-
--static int verbose;
--extern struct i2o_driver **i2o_drivers;
--extern unsigned int i2o_max_drivers;
- static void i2o_report_util_cmd(u8 cmd);
- static void i2o_report_exec_cmd(u8 cmd);
--void i2o_report_fail_status(u8 req_status, u32 * msg);
--void i2o_report_common_status(u8 req_status);
-+static void i2o_report_fail_status(u8 req_status, u32 * msg);
-+static void i2o_report_common_status(u8 req_status);
- static void i2o_report_common_dsc(u16 detailed_status);
-
--void i2o_dump_status_block(i2o_status_block * sb)
--{
-- pr_debug("Organization ID: %d\n", sb->org_id);
-- pr_debug("IOP ID: %d\n", sb->iop_id);
-- pr_debug("Host Unit ID: %d\n", sb->host_unit_id);
-- pr_debug("Segment Number: %d\n", sb->segment_number);
-- pr_debug("I2O Version: %d\n", sb->i2o_version);
-- pr_debug("IOP State: %d\n", sb->iop_state);
-- pr_debug("Messanger Type: %d\n", sb->msg_type);
-- pr_debug("Inbound Frame Size: %d\n", sb->inbound_frame_size);
-- pr_debug("Init Code: %d\n", sb->init_code);
-- pr_debug("Max Inbound MFrames: %d\n", sb->max_inbound_frames);
-- pr_debug("Current Inbound MFrames: %d\n", sb->cur_inbound_frames);
-- pr_debug("Max Outbound MFrames: %d\n", sb->max_outbound_frames);
-- pr_debug("Product ID String: %s\n", sb->product_id);
-- pr_debug("Expected LCT Size: %d\n", sb->expected_lct_size);
-- pr_debug("IOP Capabilities: %d\n", sb->iop_capabilities);
-- pr_debug("Desired Private MemSize: %d\n", sb->desired_mem_size);
-- pr_debug("Current Private MemSize: %d\n", sb->current_mem_size);
-- pr_debug("Current Private MemBase: %d\n", sb->current_mem_base);
-- pr_debug("Desired Private IO Size: %d\n", sb->desired_io_size);
-- pr_debug("Current Private IO Size: %d\n", sb->current_io_size);
-- pr_debug("Current Private IO Base: %d\n", sb->current_io_base);
--};
--
- /*
- * Used for error reporting/debugging purposes.
- * Report Cmd name, Request status, Detailed Status.
-@@ -49,12 +21,11 @@ void i2o_report_status(const char *sever
- u8 cmd = (msg[1] >> 24) & 0xFF;
- u8 req_status = (msg[4] >> 24) & 0xFF;
- u16 detailed_status = msg[4] & 0xFFFF;
-- //struct i2o_driver *h = i2o_drivers[msg[2] & (i2o_max_drivers-1)];
-
- if (cmd == I2O_CMD_UTIL_EVT_REGISTER)
- return; // No status in this reply
-
-- printk("%s%s: ", severity, str);
-+ printk(KERN_DEBUG "%s%s: ", severity, str);
-
- if (cmd < 0x1F) // Utility cmd
- i2o_report_util_cmd(cmd);
-@@ -62,7 +33,7 @@ void i2o_report_status(const char *sever
- else if (cmd >= 0xA0 && cmd <= 0xEF) // Executive cmd
- i2o_report_exec_cmd(cmd);
- else
-- printk("Cmd = %0#2x, ", cmd); // Other cmds
-+ printk(KERN_DEBUG "Cmd = %0#2x, ", cmd); // Other cmds
-
- if (msg[0] & MSG_FAIL) {
- i2o_report_fail_status(req_status, msg);
-@@ -74,7 +45,8 @@ void i2o_report_status(const char *sever
- if (cmd < 0x1F || (cmd >= 0xA0 && cmd <= 0xEF))
- i2o_report_common_dsc(detailed_status);
- else
-- printk(" / DetailedStatus = %0#4x.\n", detailed_status);
-+ printk(KERN_DEBUG " / DetailedStatus = %0#4x.\n",
-+ detailed_status);
- }
-
- /* Used to dump a message to syslog during debugging */
-@@ -90,71 +62,12 @@ void i2o_dump_message(struct i2o_message
- #endif
- }
-
--/**
-- * i2o_report_controller_unit - print information about a tid
-- * @c: controller
-- * @d: device
-- *
-- * Dump an information block associated with a given unit (TID). The
-- * tables are read and a block of text is output to printk that is
-- * formatted intended for the user.
-- */
--
--void i2o_report_controller_unit(struct i2o_controller *c, struct i2o_device *d)
--{
-- char buf[64];
-- char str[22];
-- int ret;
--
-- if (verbose == 0)
-- return;
--
-- printk(KERN_INFO "Target ID %03x.\n", d->lct_data.tid);
-- if ((ret = i2o_parm_field_get(d, 0xF100, 3, buf, 16)) >= 0) {
-- buf[16] = 0;
-- printk(KERN_INFO " Vendor: %s\n", buf);
-- }
-- if ((ret = i2o_parm_field_get(d, 0xF100, 4, buf, 16)) >= 0) {
-- buf[16] = 0;
-- printk(KERN_INFO " Device: %s\n", buf);
-- }
-- if (i2o_parm_field_get(d, 0xF100, 5, buf, 16) >= 0) {
-- buf[16] = 0;
-- printk(KERN_INFO " Description: %s\n", buf);
-- }
-- if ((ret = i2o_parm_field_get(d, 0xF100, 6, buf, 8)) >= 0) {
-- buf[8] = 0;
-- printk(KERN_INFO " Rev: %s\n", buf);
-- }
--
-- printk(KERN_INFO " Class: ");
-- //sprintf(str, "%-21s", i2o_get_class_name(d->lct_data.class_id));
-- printk("%s\n", str);
--
-- printk(KERN_INFO " Subclass: 0x%04X\n", d->lct_data.sub_class);
-- printk(KERN_INFO " Flags: ");
--
-- if (d->lct_data.device_flags & (1 << 0))
-- printk("C"); // ConfigDialog requested
-- if (d->lct_data.device_flags & (1 << 1))
-- printk("U"); // Multi-user capable
-- if (!(d->lct_data.device_flags & (1 << 4)))
-- printk("P"); // Peer service enabled!
-- if (!(d->lct_data.device_flags & (1 << 5)))
-- printk("M"); // Mgmt service enabled!
-- printk("\n");
--}
--
--/*
--MODULE_PARM(verbose, "i");
--MODULE_PARM_DESC(verbose, "Verbose diagnostics");
--*/
- /*
- * Used for error reporting/debugging purposes.
- * Following fail status are common to all classes.
- * The preserved message must be handled in the reply handler.
- */
--void i2o_report_fail_status(u8 req_status, u32 * msg)
-+static void i2o_report_fail_status(u8 req_status, u32 * msg)
- {
- static char *FAIL_STATUS[] = {
- "0x80", /* not used */
-@@ -177,9 +90,11 @@ void i2o_report_fail_status(u8 req_statu
- };
-
- if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE)
-- printk("TRANSPORT_UNKNOWN_FAILURE (%0#2x)\n.", req_status);
-+ printk(KERN_DEBUG "TRANSPORT_UNKNOWN_FAILURE (%0#2x).\n",
-+ req_status);
- else
-- printk("TRANSPORT_%s.\n", FAIL_STATUS[req_status & 0x0F]);
-+ printk(KERN_DEBUG "TRANSPORT_%s.\n",
-+ FAIL_STATUS[req_status & 0x0F]);
-
- /* Dump some details */
-
-@@ -192,16 +107,17 @@ void i2o_report_fail_status(u8 req_statu
-
- printk(KERN_ERR " Severity: 0x%02X ", (msg[4] >> 16) & 0xFF);
- if (msg[4] & (1 << 16))
-- printk("(FormatError), "
-+ printk(KERN_DEBUG "(FormatError), "
- "this msg can never be delivered/processed.\n");
- if (msg[4] & (1 << 17))
-- printk("(PathError), "
-+ printk(KERN_DEBUG "(PathError), "
- "this msg can no longer be delivered/processed.\n");
- if (msg[4] & (1 << 18))
-- printk("(PathState), "
-+ printk(KERN_DEBUG "(PathState), "
- "the system state does not allow delivery.\n");
- if (msg[4] & (1 << 19))
-- printk("(Congestion), resources temporarily not available;"
-+ printk(KERN_DEBUG
-+ "(Congestion), resources temporarily not available;"
- "do not retry immediately.\n");
- }
-
-@@ -209,7 +125,7 @@ void i2o_report_fail_status(u8 req_statu
- * Used for error reporting/debugging purposes.
- * Following reply status are common to all classes.
- */
--void i2o_report_common_status(u8 req_status)
-+static void i2o_report_common_status(u8 req_status)
- {
- static char *REPLY_STATUS[] = {
- "SUCCESS",
-@@ -227,9 +143,9 @@ void i2o_report_common_status(u8 req_sta
- };
-
- if (req_status >= ARRAY_SIZE(REPLY_STATUS))
-- printk("RequestStatus = %0#2x", req_status);
-+ printk(KERN_DEBUG "RequestStatus = %0#2x", req_status);
- else
-- printk("%s", REPLY_STATUS[req_status]);
-+ printk(KERN_DEBUG "%s", REPLY_STATUS[req_status]);
- }
-
- /*
-@@ -272,9 +188,10 @@ static void i2o_report_common_dsc(u16 de
- };
-
- if (detailed_status > I2O_DSC_DEVICE_NOT_AVAILABLE)
-- printk(" / DetailedStatus = %0#4x.\n", detailed_status);
-+ printk(KERN_DEBUG " / DetailedStatus = %0#4x.\n",
-+ detailed_status);
- else
-- printk(" / %s.\n", COMMON_DSC[detailed_status]);
-+ printk(KERN_DEBUG " / %s.\n", COMMON_DSC[detailed_status]);
- }
-
- /*
-@@ -284,49 +201,49 @@ static void i2o_report_util_cmd(u8 cmd)
- {
- switch (cmd) {
- case I2O_CMD_UTIL_NOP:
-- printk("UTIL_NOP, ");
-+ printk(KERN_DEBUG "UTIL_NOP, ");
- break;
- case I2O_CMD_UTIL_ABORT:
-- printk("UTIL_ABORT, ");
-+ printk(KERN_DEBUG "UTIL_ABORT, ");
- break;
- case I2O_CMD_UTIL_CLAIM:
-- printk("UTIL_CLAIM, ");
-+ printk(KERN_DEBUG "UTIL_CLAIM, ");
- break;
- case I2O_CMD_UTIL_RELEASE:
-- printk("UTIL_CLAIM_RELEASE, ");
-+ printk(KERN_DEBUG "UTIL_CLAIM_RELEASE, ");
- break;
- case I2O_CMD_UTIL_CONFIG_DIALOG:
-- printk("UTIL_CONFIG_DIALOG, ");
-+ printk(KERN_DEBUG "UTIL_CONFIG_DIALOG, ");
- break;
- case I2O_CMD_UTIL_DEVICE_RESERVE:
-- printk("UTIL_DEVICE_RESERVE, ");
-+ printk(KERN_DEBUG "UTIL_DEVICE_RESERVE, ");
- break;
- case I2O_CMD_UTIL_DEVICE_RELEASE:
-- printk("UTIL_DEVICE_RELEASE, ");
-+ printk(KERN_DEBUG "UTIL_DEVICE_RELEASE, ");
- break;
- case I2O_CMD_UTIL_EVT_ACK:
-- printk("UTIL_EVENT_ACKNOWLEDGE, ");
-+ printk(KERN_DEBUG "UTIL_EVENT_ACKNOWLEDGE, ");
- break;
- case I2O_CMD_UTIL_EVT_REGISTER:
-- printk("UTIL_EVENT_REGISTER, ");
-+ printk(KERN_DEBUG "UTIL_EVENT_REGISTER, ");
- break;
- case I2O_CMD_UTIL_LOCK:
-- printk("UTIL_LOCK, ");
-+ printk(KERN_DEBUG "UTIL_LOCK, ");
- break;
- case I2O_CMD_UTIL_LOCK_RELEASE:
-- printk("UTIL_LOCK_RELEASE, ");
-+ printk(KERN_DEBUG "UTIL_LOCK_RELEASE, ");
- break;
- case I2O_CMD_UTIL_PARAMS_GET:
-- printk("UTIL_PARAMS_GET, ");
-+ printk(KERN_DEBUG "UTIL_PARAMS_GET, ");
- break;
- case I2O_CMD_UTIL_PARAMS_SET:
-- printk("UTIL_PARAMS_SET, ");
-+ printk(KERN_DEBUG "UTIL_PARAMS_SET, ");
- break;
- case I2O_CMD_UTIL_REPLY_FAULT_NOTIFY:
-- printk("UTIL_REPLY_FAULT_NOTIFY, ");
-+ printk(KERN_DEBUG "UTIL_REPLY_FAULT_NOTIFY, ");
- break;
- default:
-- printk("Cmd = %0#2x, ", cmd);
-+ printk(KERN_DEBUG "Cmd = %0#2x, ", cmd);
- }
- }
-
-@@ -337,106 +254,106 @@ static void i2o_report_exec_cmd(u8 cmd)
- {
- switch (cmd) {
- case I2O_CMD_ADAPTER_ASSIGN:
-- printk("EXEC_ADAPTER_ASSIGN, ");
-+ printk(KERN_DEBUG "EXEC_ADAPTER_ASSIGN, ");
- break;
- case I2O_CMD_ADAPTER_READ:
-- printk("EXEC_ADAPTER_READ, ");
-+ printk(KERN_DEBUG "EXEC_ADAPTER_READ, ");
- break;
- case I2O_CMD_ADAPTER_RELEASE:
-- printk("EXEC_ADAPTER_RELEASE, ");
-+ printk(KERN_DEBUG "EXEC_ADAPTER_RELEASE, ");
- break;
- case I2O_CMD_BIOS_INFO_SET:
-- printk("EXEC_BIOS_INFO_SET, ");
-+ printk(KERN_DEBUG "EXEC_BIOS_INFO_SET, ");
- break;
- case I2O_CMD_BOOT_DEVICE_SET:
-- printk("EXEC_BOOT_DEVICE_SET, ");
-+ printk(KERN_DEBUG "EXEC_BOOT_DEVICE_SET, ");
- break;
- case I2O_CMD_CONFIG_VALIDATE:
-- printk("EXEC_CONFIG_VALIDATE, ");
-+ printk(KERN_DEBUG "EXEC_CONFIG_VALIDATE, ");
- break;
- case I2O_CMD_CONN_SETUP:
-- printk("EXEC_CONN_SETUP, ");
-+ printk(KERN_DEBUG "EXEC_CONN_SETUP, ");
- break;
- case I2O_CMD_DDM_DESTROY:
-- printk("EXEC_DDM_DESTROY, ");
-+ printk(KERN_DEBUG "EXEC_DDM_DESTROY, ");
- break;
- case I2O_CMD_DDM_ENABLE:
-- printk("EXEC_DDM_ENABLE, ");
-+ printk(KERN_DEBUG "EXEC_DDM_ENABLE, ");
- break;
- case I2O_CMD_DDM_QUIESCE:
-- printk("EXEC_DDM_QUIESCE, ");
-+ printk(KERN_DEBUG "EXEC_DDM_QUIESCE, ");
- break;
- case I2O_CMD_DDM_RESET:
-- printk("EXEC_DDM_RESET, ");
-+ printk(KERN_DEBUG "EXEC_DDM_RESET, ");
- break;
- case I2O_CMD_DDM_SUSPEND:
-- printk("EXEC_DDM_SUSPEND, ");
-+ printk(KERN_DEBUG "EXEC_DDM_SUSPEND, ");
- break;
- case I2O_CMD_DEVICE_ASSIGN:
-- printk("EXEC_DEVICE_ASSIGN, ");
-+ printk(KERN_DEBUG "EXEC_DEVICE_ASSIGN, ");
- break;
- case I2O_CMD_DEVICE_RELEASE:
-- printk("EXEC_DEVICE_RELEASE, ");
-+ printk(KERN_DEBUG "EXEC_DEVICE_RELEASE, ");
- break;
- case I2O_CMD_HRT_GET:
-- printk("EXEC_HRT_GET, ");
-+ printk(KERN_DEBUG "EXEC_HRT_GET, ");
- break;
- case I2O_CMD_ADAPTER_CLEAR:
-- printk("EXEC_IOP_CLEAR, ");
-+ printk(KERN_DEBUG "EXEC_IOP_CLEAR, ");
- break;
- case I2O_CMD_ADAPTER_CONNECT:
-- printk("EXEC_IOP_CONNECT, ");
-+ printk(KERN_DEBUG "EXEC_IOP_CONNECT, ");
- break;
- case I2O_CMD_ADAPTER_RESET:
-- printk("EXEC_IOP_RESET, ");
-+ printk(KERN_DEBUG "EXEC_IOP_RESET, ");
- break;
- case I2O_CMD_LCT_NOTIFY:
-- printk("EXEC_LCT_NOTIFY, ");
-+ printk(KERN_DEBUG "EXEC_LCT_NOTIFY, ");
- break;
- case I2O_CMD_OUTBOUND_INIT:
-- printk("EXEC_OUTBOUND_INIT, ");
-+ printk(KERN_DEBUG "EXEC_OUTBOUND_INIT, ");
- break;
- case I2O_CMD_PATH_ENABLE:
-- printk("EXEC_PATH_ENABLE, ");
-+ printk(KERN_DEBUG "EXEC_PATH_ENABLE, ");
- break;
- case I2O_CMD_PATH_QUIESCE:
-- printk("EXEC_PATH_QUIESCE, ");
-+ printk(KERN_DEBUG "EXEC_PATH_QUIESCE, ");
- break;
- case I2O_CMD_PATH_RESET:
-- printk("EXEC_PATH_RESET, ");
-+ printk(KERN_DEBUG "EXEC_PATH_RESET, ");
- break;
- case I2O_CMD_STATIC_MF_CREATE:
-- printk("EXEC_STATIC_MF_CREATE, ");
-+ printk(KERN_DEBUG "EXEC_STATIC_MF_CREATE, ");
- break;
- case I2O_CMD_STATIC_MF_RELEASE:
-- printk("EXEC_STATIC_MF_RELEASE, ");
-+ printk(KERN_DEBUG "EXEC_STATIC_MF_RELEASE, ");
- break;
- case I2O_CMD_STATUS_GET:
-- printk("EXEC_STATUS_GET, ");
-+ printk(KERN_DEBUG "EXEC_STATUS_GET, ");
- break;
- case I2O_CMD_SW_DOWNLOAD:
-- printk("EXEC_SW_DOWNLOAD, ");
-+ printk(KERN_DEBUG "EXEC_SW_DOWNLOAD, ");
- break;
- case I2O_CMD_SW_UPLOAD:
-- printk("EXEC_SW_UPLOAD, ");
-+ printk(KERN_DEBUG "EXEC_SW_UPLOAD, ");
- break;
- case I2O_CMD_SW_REMOVE:
-- printk("EXEC_SW_REMOVE, ");
-+ printk(KERN_DEBUG "EXEC_SW_REMOVE, ");
- break;
- case I2O_CMD_SYS_ENABLE:
-- printk("EXEC_SYS_ENABLE, ");
-+ printk(KERN_DEBUG "EXEC_SYS_ENABLE, ");
- break;
- case I2O_CMD_SYS_MODIFY:
-- printk("EXEC_SYS_MODIFY, ");
-+ printk(KERN_DEBUG "EXEC_SYS_MODIFY, ");
- break;
- case I2O_CMD_SYS_QUIESCE:
-- printk("EXEC_SYS_QUIESCE, ");
-+ printk(KERN_DEBUG "EXEC_SYS_QUIESCE, ");
- break;
- case I2O_CMD_SYS_TAB_SET:
-- printk("EXEC_SYS_TAB_SET, ");
-+ printk(KERN_DEBUG "EXEC_SYS_TAB_SET, ");
- break;
- default:
-- printk("Cmd = %#02x, ", cmd);
-+ printk(KERN_DEBUG "Cmd = %#02x, ", cmd);
- }
- }
-
-@@ -445,46 +362,32 @@ void i2o_debug_state(struct i2o_controll
- printk(KERN_INFO "%s: State = ", c->name);
- switch (((i2o_status_block *) c->status_block.virt)->iop_state) {
- case 0x01:
-- printk("INIT\n");
-+ printk(KERN_DEBUG "INIT\n");
- break;
- case 0x02:
-- printk("RESET\n");
-+ printk(KERN_DEBUG "RESET\n");
- break;
- case 0x04:
-- printk("HOLD\n");
-+ printk(KERN_DEBUG "HOLD\n");
- break;
- case 0x05:
-- printk("READY\n");
-+ printk(KERN_DEBUG "READY\n");
- break;
- case 0x08:
-- printk("OPERATIONAL\n");
-+ printk(KERN_DEBUG "OPERATIONAL\n");
- break;
- case 0x10:
-- printk("FAILED\n");
-+ printk(KERN_DEBUG "FAILED\n");
- break;
- case 0x11:
-- printk("FAULTED\n");
-+ printk(KERN_DEBUG "FAULTED\n");
- break;
- default:
-- printk("%x (unknown !!)\n",
-+ printk(KERN_DEBUG "%x (unknown !!)\n",
- ((i2o_status_block *) c->status_block.virt)->iop_state);
- }
- };
-
--void i2o_systab_debug(struct i2o_sys_tbl *sys_tbl)
--{
-- u32 *table;
-- int count;
-- u32 size;
--
-- table = (u32 *) sys_tbl;
-- size = sizeof(struct i2o_sys_tbl) + sys_tbl->num_entries
-- * sizeof(struct i2o_sys_tbl_entry);
--
-- for (count = 0; count < (size >> 2); count++)
-- printk(KERN_INFO "sys_tbl[%d] = %0#10x\n", count, table[count]);
--}
--
- void i2o_dump_hrt(struct i2o_controller *c)
- {
- u32 *rows = (u32 *) c->hrt.virt;
-@@ -533,13 +436,13 @@ void i2o_dump_hrt(struct i2o_controller
- switch (p[3] & 0xFFFF) {
- case 0:
- /* Adapter private bus - easy */
-- printk("Local bus %d: I/O at 0x%04X Mem 0x%08X",
-- p[2], d[1] << 8 | d[0], *(u32 *) (d + 4));
-+ printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2],
-+ d[1] << 8 | d[0], *(u32 *) (d + 4));
- break;
- case 1:
- /* ISA bus */
-- printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X",
-- p[2], d[2], d[1] << 8 | d[0], *(u32 *) (d + 4));
-+ printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2],
-+ d[2], d[1] << 8 | d[0], *(u32 *) (d + 4));
- break;
-
- case 2: /* EISA bus */
-@@ -548,13 +451,13 @@ void i2o_dump_hrt(struct i2o_controller
- break;
-
- case 3: /* MCA bus */
-- printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X",
-- p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4));
-+ printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2],
-+ d[3], d[1] << 8 | d[0], *(u32 *) (d + 4));
- break;
-
- case 4: /* PCI bus */
-- printk("PCI %d: Bus %d Device %d Function %d",
-- p[2], d[2], d[1], d[0]);
-+ printk("PCI %d: Bus %d Device %d Function %d", p[2],
-+ d[2], d[1], d[0]);
- break;
-
- case 0x80: /* Other */
-@@ -567,5 +470,4 @@ void i2o_dump_hrt(struct i2o_controller
- }
- }
-
--EXPORT_SYMBOL(i2o_dump_status_block);
- EXPORT_SYMBOL(i2o_dump_message);
-diff -Nurap ./drivers/message/i2o.i2o/device.c ./drivers/message/i2o/device.c
---- ./drivers/message/i2o.i2o/device.c 2004-10-19 01:54:32.000000000 +0400
-+++ ./drivers/message/i2o/device.c 2006-09-08 15:10:02.000000000 +0400
-@@ -15,9 +15,10 @@
-
- #include <linux/module.h>
- #include <linux/i2o.h>
--
--/* Exec OSM functions */
--extern struct bus_type i2o_bus_type;
-+#include <linux/delay.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+#include "core.h"
-
- /**
- * i2o_device_issue_claim - claim or release a device
-@@ -35,21 +36,21 @@ static inline int i2o_device_issue_claim
- u32 type)
- {
- struct i2o_message *msg;
-- u32 m;
--
-- m = i2o_msg_get_wait(dev->iop, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
-
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(cmd << 24 | HOST_TID << 12 | dev->lct_data.tid, &msg->u.head[1]);
-- writel(type, &msg->body[0]);
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(cmd << 24 | HOST_TID << 12 | dev->lct_data.tid);
-+ msg->body[0] = cpu_to_le32(type);
-
-- return i2o_msg_post_wait(dev->iop, m, 60);
--};
-+ return i2o_msg_post_wait(dev->iop, msg, 60);
-+}
-
- /**
-- * i2o_device_claim - claim a device for use by an OSM
-+ * i2o_device_claim - claim a device for use by an OSM
- * @dev: I2O device to claim
- * @drv: I2O driver which wants to claim the device
- *
-@@ -65,15 +66,16 @@ int i2o_device_claim(struct i2o_device *
-
- rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
- if (!rc)
-- pr_debug("claim of device %d succeded\n", dev->lct_data.tid);
-+ pr_debug("i2o: claim of device %d succeded\n",
-+ dev->lct_data.tid);
- else
-- pr_debug("claim of device %d failed %d\n", dev->lct_data.tid,
-- rc);
-+ pr_debug("i2o: claim of device %d failed %d\n",
-+ dev->lct_data.tid, rc);
-
- up(&dev->lock);
-
- return rc;
--};
-+}
-
- /**
- * i2o_device_claim_release - release a device that the OSM is using
-@@ -106,21 +108,20 @@ int i2o_device_claim_release(struct i2o_
- if (!rc)
- break;
-
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(HZ);
-+ ssleep(1);
- }
-
- if (!rc)
-- pr_debug("claim release of device %d succeded\n",
-+ pr_debug("i2o: claim release of device %d succeded\n",
- dev->lct_data.tid);
- else
-- pr_debug("claim release of device %d failed %d\n",
-+ pr_debug("i2o: claim release of device %d failed %d\n",
- dev->lct_data.tid, rc);
-
- up(&dev->lock);
-
- return rc;
--};
-+}
-
- /**
- * i2o_device_release - release the memory for a I2O device
-@@ -133,42 +134,48 @@ static void i2o_device_release(struct de
- {
- struct i2o_device *i2o_dev = to_i2o_device(dev);
-
-- pr_debug("Release I2O device %s\n", dev->bus_id);
-+ pr_debug("i2o: device %s released\n", dev->bus_id);
-
- kfree(i2o_dev);
--};
-+}
-
- /**
-- * i2o_device_class_release - Remove I2O device attributes
-- * @cd: I2O class device which is added to the I2O device class
-+ * i2o_device_show_class_id - Displays class id of I2O device
-+ * @dev: device of which the class id should be displayed
-+ * @attr: pointer to device attribute
-+ * @buf: buffer into which the class id should be printed
- *
-- * Removes attributes from the I2O device again. Also search each device
-- * on the controller for I2O devices which refert to this device as parent
-- * or user and remove this links also.
-+ * Returns the number of bytes which are printed into the buffer.
- */
--static void i2o_device_class_release(struct class_device *cd)
-+static ssize_t i2o_device_show_class_id(struct device *dev, char *buf)
- {
-- struct i2o_device *i2o_dev, *tmp;
-- struct i2o_controller *c;
-+ struct i2o_device *i2o_dev = to_i2o_device(dev);
-
-- i2o_dev = to_i2o_device(cd->dev);
-- c = i2o_dev->iop;
-+ sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id);
-+ return strlen(buf) + 1;
-+}
-
-- sysfs_remove_link(&i2o_dev->device.kobj, "parent");
-- sysfs_remove_link(&i2o_dev->device.kobj, "user");
-+/**
-+ * i2o_device_show_tid - Displays TID of I2O device
-+ * @dev: device of which the TID should be displayed
-+ * @attr: pointer to device attribute
-+ * @buf: buffer into which the TID should be printed
-+ *
-+ * Returns the number of bytes which are printed into the buffer.
-+ */
-+static ssize_t i2o_device_show_tid(struct device *dev, char *buf)
-+{
-+ struct i2o_device *i2o_dev = to_i2o_device(dev);
-
-- list_for_each_entry(tmp, &c->devices, list) {
-- if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
-- sysfs_remove_link(&tmp->device.kobj, "parent");
-- if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
-- sysfs_remove_link(&tmp->device.kobj, "user");
-- }
--};
-+ sprintf(buf, "0x%03x\n", i2o_dev->lct_data.tid);
-+ return strlen(buf) + 1;
-+}
-
--/* I2O device class */
--static struct class i2o_device_class = {
-- .name = "i2o_device",
-- .release = i2o_device_class_release
-+/* I2O device attributes */
-+struct device_attribute i2o_device_attrs[] = {
-+ __ATTR(class_id, S_IRUGO, i2o_device_show_class_id, NULL),
-+ __ATTR(tid, S_IRUGO, i2o_device_show_tid, NULL),
-+ __ATTR_NULL
- };
-
- /**
-@@ -183,22 +190,18 @@ static struct i2o_device *i2o_device_all
- {
- struct i2o_device *dev;
-
-- dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (!dev)
- return ERR_PTR(-ENOMEM);
-
-- memset(dev, 0, sizeof(*dev));
--
- INIT_LIST_HEAD(&dev->list);
- init_MUTEX(&dev->lock);
-
- dev->device.bus = &i2o_bus_type;
- dev->device.release = &i2o_device_release;
-- dev->classdev.class = &i2o_device_class;
-- dev->classdev.dev = &dev->device;
-
- return dev;
--};
-+}
-
- /**
- * i2o_device_add - allocate a new I2O device and add it to the IOP
-@@ -211,40 +214,61 @@ static struct i2o_device *i2o_device_all
- * Returns a pointer to the I2O device on success or negative error code
- * on failure.
- */
--struct i2o_device *i2o_device_add(struct i2o_controller *c,
-- i2o_lct_entry * entry)
-+static struct i2o_device *i2o_device_add(struct i2o_controller *c,
-+ i2o_lct_entry * entry)
- {
-- struct i2o_device *dev;
-+ struct i2o_device *i2o_dev, *tmp;
-
-- dev = i2o_device_alloc();
-- if (IS_ERR(dev)) {
-+ i2o_dev = i2o_device_alloc();
-+ if (IS_ERR(i2o_dev)) {
- printk(KERN_ERR "i2o: unable to allocate i2o device\n");
-- return dev;
-+ return i2o_dev;
- }
-
-- dev->lct_data = *entry;
-+ i2o_dev->lct_data = *entry;
-
-- snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit,
-- dev->lct_data.tid);
-+ snprintf(i2o_dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit,
-+ i2o_dev->lct_data.tid);
-
-- snprintf(dev->classdev.class_id, BUS_ID_SIZE, "%d:%03x", c->unit,
-- dev->lct_data.tid);
-+ i2o_dev->iop = c;
-+ i2o_dev->device.parent = &c->device;
-
-- dev->iop = c;
-- dev->device.parent = &c->device;
-+ device_register(&i2o_dev->device);
-
-- device_register(&dev->device);
-+ list_add_tail(&i2o_dev->list, &c->devices);
-
-- list_add_tail(&dev->list, &c->devices);
-+ /* create user entries for this device */
-+ tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.user_tid);
-+ if (tmp && (tmp != i2o_dev))
-+ sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
-+ "user");
-
-- class_device_register(&dev->classdev);
-+ /* create user entries refering to this device */
-+ list_for_each_entry(tmp, &c->devices, list)
-+ if ((tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
-+ && (tmp != i2o_dev))
-+ sysfs_create_link(&tmp->device.kobj,
-+ &i2o_dev->device.kobj, "user");
-
-- i2o_driver_notify_device_add_all(dev);
-+ /* create parent entries for this device */
-+ tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.parent_tid);
-+ if (tmp && (tmp != i2o_dev))
-+ sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
-+ "parent");
-
-- pr_debug("I2O device %s added\n", dev->device.bus_id);
-+ /* create parent entries refering to this device */
-+ list_for_each_entry(tmp, &c->devices, list)
-+ if ((tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
-+ && (tmp != i2o_dev))
-+ sysfs_create_link(&tmp->device.kobj,
-+ &i2o_dev->device.kobj, "parent");
-
-- return dev;
--};
-+ i2o_driver_notify_device_add_all(i2o_dev);
-+
-+ pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id);
-+
-+ return i2o_dev;
-+}
-
- /**
- * i2o_device_remove - remove an I2O device from the I2O core
-@@ -256,11 +280,24 @@ struct i2o_device *i2o_device_add(struct
- */
- void i2o_device_remove(struct i2o_device *i2o_dev)
- {
-+ struct i2o_device *tmp;
-+ struct i2o_controller *c = i2o_dev->iop;
-+
- i2o_driver_notify_device_remove_all(i2o_dev);
-- class_device_unregister(&i2o_dev->classdev);
-+
-+ sysfs_remove_link(&i2o_dev->device.kobj, "parent");
-+ sysfs_remove_link(&i2o_dev->device.kobj, "user");
-+
-+ list_for_each_entry(tmp, &c->devices, list) {
-+ if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
-+ sysfs_remove_link(&tmp->device.kobj, "parent");
-+ if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
-+ sysfs_remove_link(&tmp->device.kobj, "user");
-+ }
- list_del(&i2o_dev->list);
-+
- device_unregister(&i2o_dev->device);
--};
-+}
-
- /**
- * i2o_device_parse_lct - Parse a previously fetched LCT and create devices
-@@ -276,56 +313,83 @@ int i2o_device_parse_lct(struct i2o_cont
- {
- struct i2o_device *dev, *tmp;
- i2o_lct *lct;
-- int i;
-- int max;
-+ u32 *dlct = c->dlct.virt;
-+ int max = 0, i = 0;
-+ u16 table_size;
-+ u32 buf;
-
- down(&c->lct_lock);
-
-- if (c->lct)
-- kfree(c->lct);
-+ kfree(c->lct);
-
-- lct = c->dlct.virt;
-+ buf = le32_to_cpu(*dlct++);
-+ table_size = buf & 0xffff;
-
-- c->lct = kmalloc(lct->table_size * 4, GFP_KERNEL);
-- if (!c->lct) {
-+ lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL);
-+ if (!lct) {
- up(&c->lct_lock);
- return -ENOMEM;
- }
-
-- if (lct->table_size * 4 > c->dlct.len) {
-- memcpy_fromio(c->lct, c->dlct.virt, c->dlct.len);
-- up(&c->lct_lock);
-- return -EAGAIN;
-- }
-+ lct->lct_ver = buf >> 28;
-+ lct->boot_tid = buf >> 16 & 0xfff;
-+ lct->table_size = table_size;
-+ lct->change_ind = le32_to_cpu(*dlct++);
-+ lct->iop_flags = le32_to_cpu(*dlct++);
-+
-+ table_size -= 3;
-
-- memcpy_fromio(c->lct, c->dlct.virt, lct->table_size * 4);
-+ pr_debug("%s: LCT has %d entries (LCT size: %d)\n", c->name, max,
-+ lct->table_size);
-
-- lct = c->lct;
-+ while (table_size > 0) {
-+ i2o_lct_entry *entry = &lct->lct_entry[max];
-+ int found = 0;
-
-- max = (lct->table_size - 3) / 9;
-+ buf = le32_to_cpu(*dlct++);
-+ entry->entry_size = buf & 0xffff;
-+ entry->tid = buf >> 16 & 0xfff;
-
-- pr_debug("LCT has %d entries (LCT size: %d)\n", max, lct->table_size);
-+ entry->change_ind = le32_to_cpu(*dlct++);
-+ entry->device_flags = le32_to_cpu(*dlct++);
-
-- /* remove devices, which are not in the LCT anymore */
-- list_for_each_entry_safe(dev, tmp, &c->devices, list) {
-- int found = 0;
-+ buf = le32_to_cpu(*dlct++);
-+ entry->class_id = buf & 0xfff;
-+ entry->version = buf >> 12 & 0xf;
-+ entry->vendor_id = buf >> 16;
-
-- for (i = 0; i < max; i++) {
-- if (lct->lct_entry[i].tid == dev->lct_data.tid) {
-+ entry->sub_class = le32_to_cpu(*dlct++);
-+
-+ buf = le32_to_cpu(*dlct++);
-+ entry->user_tid = buf & 0xfff;
-+ entry->parent_tid = buf >> 12 & 0xfff;
-+ entry->bios_info = buf >> 24;
-+
-+ memcpy(&entry->identity_tag, dlct, 8);
-+ dlct += 2;
-+
-+ entry->event_capabilities = le32_to_cpu(*dlct++);
-+
-+ /* add new devices, which are new in the LCT */
-+ list_for_each_entry_safe(dev, tmp, &c->devices, list) {
-+ if (entry->tid == dev->lct_data.tid) {
- found = 1;
- break;
- }
- }
-
- if (!found)
-- i2o_device_remove(dev);
-+ i2o_device_add(c, entry);
-+
-+ table_size -= 9;
-+ max++;
- }
-
-- /* add new devices, which are new in the LCT */
-- for (i = 0; i < max; i++) {
-+ /* remove devices, which are not in the LCT anymore */
-+ list_for_each_entry_safe(dev, tmp, &c->devices, list) {
- int found = 0;
-
-- list_for_each_entry_safe(dev, tmp, &c->devices, list) {
-+ for (i = 0; i < max; i++) {
- if (lct->lct_entry[i].tid == dev->lct_data.tid) {
- found = 1;
- break;
-@@ -333,102 +397,13 @@ int i2o_device_parse_lct(struct i2o_cont
- }
-
- if (!found)
-- i2o_device_add(c, &lct->lct_entry[i]);
-+ i2o_device_remove(dev);
- }
-- up(&c->lct_lock);
--
-- return 0;
--};
--
--/**
-- * i2o_device_class_show_class_id - Displays class id of I2O device
-- * @cd: class device of which the class id should be displayed
-- * @buf: buffer into which the class id should be printed
-- *
-- * Returns the number of bytes which are printed into the buffer.
-- */
--static ssize_t i2o_device_class_show_class_id(struct class_device *cd,
-- char *buf)
--{
-- struct i2o_device *dev = to_i2o_device(cd->dev);
--
-- sprintf(buf, "%03x\n", dev->lct_data.class_id);
-- return strlen(buf) + 1;
--};
--
--/**
-- * i2o_device_class_show_tid - Displays TID of I2O device
-- * @cd: class device of which the TID should be displayed
-- * @buf: buffer into which the class id should be printed
-- *
-- * Returns the number of bytes which are printed into the buffer.
-- */
--static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf)
--{
-- struct i2o_device *dev = to_i2o_device(cd->dev);
--
-- sprintf(buf, "%03x\n", dev->lct_data.tid);
-- return strlen(buf) + 1;
--};
--
--/* I2O device class attributes */
--static CLASS_DEVICE_ATTR(class_id, S_IRUGO, i2o_device_class_show_class_id,
-- NULL);
--static CLASS_DEVICE_ATTR(tid, S_IRUGO, i2o_device_class_show_tid, NULL);
--
--/**
-- * i2o_device_class_add - Adds attributes to the I2O device
-- * @cd: I2O class device which is added to the I2O device class
-- *
-- * This function get called when a I2O device is added to the class. It
-- * creates the attributes for each device and creates user/parent symlink
-- * if necessary.
-- *
-- * Returns 0 on success or negative error code on failure.
-- */
--static int i2o_device_class_add(struct class_device *cd)
--{
-- struct i2o_device *i2o_dev, *tmp;
-- struct i2o_controller *c;
--
-- i2o_dev = to_i2o_device(cd->dev);
-- c = i2o_dev->iop;
--
-- class_device_create_file(cd, &class_device_attr_class_id);
-- class_device_create_file(cd, &class_device_attr_tid);
-
-- /* create user entries for this device */
-- tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.user_tid);
-- if (tmp)
-- sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
-- "user");
--
-- /* create user entries refering to this device */
-- list_for_each_entry(tmp, &c->devices, list)
-- if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
-- sysfs_create_link(&tmp->device.kobj,
-- &i2o_dev->device.kobj, "user");
--
-- /* create parent entries for this device */
-- tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.parent_tid);
-- if (tmp)
-- sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
-- "parent");
--
-- /* create parent entries refering to this device */
-- list_for_each_entry(tmp, &c->devices, list)
-- if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
-- sysfs_create_link(&tmp->device.kobj,
-- &i2o_dev->device.kobj, "parent");
-+ up(&c->lct_lock);
-
- return 0;
--};
--
--/* I2O device class interface */
--static struct class_interface i2o_device_class_interface = {
-- .class = &i2o_device_class,
-- .add = i2o_device_class_add
--};
-+}
-
- /*
- * Run time support routines
-@@ -442,15 +417,10 @@ static struct class_interface i2o_device
- * Note that the minimum sized reslist is 8 bytes and contains
- * ResultCount, ErrorInfoSize, BlockStatus and BlockSize.
- */
--
- int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist,
- int oplen, void *reslist, int reslen)
- {
- struct i2o_message *msg;
-- u32 m;
-- u32 *res32 = (u32 *) reslist;
-- u32 *restmp = (u32 *) reslist;
-- int len = 0;
- int i = 0;
- int rc;
- struct i2o_dma res;
-@@ -462,64 +432,36 @@ int i2o_parm_issue(struct i2o_device *i2
- if (i2o_dma_alloc(dev, &res, reslen, GFP_KERNEL))
- return -ENOMEM;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY) {
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg)) {
- i2o_dma_free(dev, &res);
-- return -ETIMEDOUT;
-+ return PTR_ERR(msg);
- }
-
- i = 0;
-- writel(cmd << 24 | HOST_TID << 12 | i2o_dev->lct_data.tid,
-- &msg->u.head[1]);
-- writel(0, &msg->body[i++]);
-- writel(0x4C000000 | oplen, &msg->body[i++]); /* OperationList */
-- memcpy_toio(&msg->body[i], oplist, oplen);
-+ msg->u.head[1] =
-+ cpu_to_le32(cmd << 24 | HOST_TID << 12 | i2o_dev->lct_data.tid);
-+ msg->body[i++] = cpu_to_le32(0x00000000);
-+ msg->body[i++] = cpu_to_le32(0x4C000000 | oplen); /* OperationList */
-+ memcpy(&msg->body[i], oplist, oplen);
- i += (oplen / 4 + (oplen % 4 ? 1 : 0));
-- writel(0xD0000000 | res.len, &msg->body[i++]); /* ResultList */
-- writel(res.phys, &msg->body[i++]);
-+ msg->body[i++] = cpu_to_le32(0xD0000000 | res.len); /* ResultList */
-+ msg->body[i++] = cpu_to_le32(res.phys);
-
-- writel(I2O_MESSAGE_SIZE(i + sizeof(struct i2o_message) / 4) |
-- SGL_OFFSET_5, &msg->u.head[0]);
-+ msg->u.head[0] =
-+ cpu_to_le32(I2O_MESSAGE_SIZE(i + sizeof(struct i2o_message) / 4) |
-+ SGL_OFFSET_5);
-
-- rc = i2o_msg_post_wait_mem(c, m, 10, &res);
-+ rc = i2o_msg_post_wait_mem(c, msg, 10, &res);
-
- /* This only looks like a memory leak - don't "fix" it. */
- if (rc == -ETIMEDOUT)
- return rc;
-
-- memcpy_fromio(reslist, res.virt, res.len);
-+ memcpy(reslist, res.virt, res.len);
- i2o_dma_free(dev, &res);
-
-- /* Query failed */
-- if (rc)
-- return rc;
-- /*
-- * Calculate number of bytes of Result LIST
-- * We need to loop through each Result BLOCK and grab the length
-- */
-- restmp = res32 + 1;
-- len = 1;
-- for (i = 0; i < (res32[0] & 0X0000FFFF); i++) {
-- if (restmp[0] & 0x00FF0000) { /* BlockStatus != SUCCESS */
-- printk(KERN_WARNING
-- "%s - Error:\n ErrorInfoSize = 0x%02x, "
-- "BlockStatus = 0x%02x, BlockSize = 0x%04x\n",
-- (cmd ==
-- I2O_CMD_UTIL_PARAMS_SET) ? "PARAMS_SET" :
-- "PARAMS_GET", res32[1] >> 24,
-- (res32[1] >> 16) & 0xFF, res32[1] & 0xFFFF);
--
-- /*
-- * If this is the only request,than we return an error
-- */
-- if ((res32[0] & 0x0000FFFF) == 1) {
-- return -((res32[1] >> 16) & 0xFF); /* -BlockStatus */
-- }
-- }
-- len += restmp[0] & 0x0000FFFF; /* Length of res BLOCK */
-- restmp += restmp[0] & 0x0000FFFF; /* Skip to next BLOCK */
-- }
-- return (len << 2); /* bytes used by result list */
-+ return rc;
- }
-
- /*
-@@ -528,78 +470,40 @@ int i2o_parm_issue(struct i2o_device *i2
- int i2o_parm_field_get(struct i2o_device *i2o_dev, int group, int field,
- void *buf, int buflen)
- {
-- u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field };
-- u8 resblk[8 + buflen]; /* 8 bytes for header */
-- int size;
--
-- if (field == -1) /* whole group */
-- opblk[4] = -1;
--
-- size = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk,
-- sizeof(opblk), resblk, sizeof(resblk));
--
-- memcpy(buf, resblk + 8, buflen); /* cut off header */
--
-- if (size > buflen)
-- return buflen;
--
-- return size;
--}
--
--/*
-- * Set a scalar group value or a whole group.
-- */
--int i2o_parm_field_set(struct i2o_device *i2o_dev, int group, int field,
-- void *buf, int buflen)
--{
-- u16 *opblk;
-- u8 resblk[8 + buflen]; /* 8 bytes for header */
-- int size;
-+ u32 opblk[] = { cpu_to_le32(0x00000001),
-+ cpu_to_le32((u16) group << 16 | I2O_PARAMS_FIELD_GET),
-+ cpu_to_le32((s16) field << 16 | 0x00000001)
-+ };
-+ u8 *resblk; /* 8 bytes for header */
-+ int rc;
-
-- opblk = kmalloc(buflen + 64, GFP_KERNEL);
-- if (opblk == NULL) {
-- printk(KERN_ERR "i2o: no memory for operation buffer.\n");
-+ resblk = kmalloc(buflen + 8, GFP_KERNEL | GFP_ATOMIC);
-+ if (!resblk)
- return -ENOMEM;
-- }
--
-- opblk[0] = 1; /* operation count */
-- opblk[1] = 0; /* pad */
-- opblk[2] = I2O_PARAMS_FIELD_SET;
-- opblk[3] = group;
-
-- if (field == -1) { /* whole group */
-- opblk[4] = -1;
-- memcpy(opblk + 5, buf, buflen);
-- } else { /* single field */
--
-- opblk[4] = 1;
-- opblk[5] = field;
-- memcpy(opblk + 6, buf, buflen);
-- }
-+ rc = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk,
-+ sizeof(opblk), resblk, buflen + 8);
-
-- size = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_SET, opblk,
-- 12 + buflen, resblk, sizeof(resblk));
-+ memcpy(buf, resblk + 8, buflen); /* cut off header */
-
-- kfree(opblk);
-- if (size > buflen)
-- return buflen;
-+ kfree(resblk);
-
-- return size;
-+ return rc;
- }
-
- /*
-- * if oper == I2O_PARAMS_TABLE_GET, get from all rows
-- * if fieldcount == -1 return all fields
-+ * if oper == I2O_PARAMS_TABLE_GET, get from all rows
-+ * if fieldcount == -1 return all fields
- * ibuf and ibuflen are unused (use NULL, 0)
-- * else return specific fields
-- * ibuf contains fieldindexes
-+ * else return specific fields
-+ * ibuf contains fieldindexes
- *
-- * if oper == I2O_PARAMS_LIST_GET, get from specific rows
-- * if fieldcount == -1 return all fields
-+ * if oper == I2O_PARAMS_LIST_GET, get from specific rows
-+ * if fieldcount == -1 return all fields
- * ibuf contains rowcount, keyvalues
-- * else return specific fields
-+ * else return specific fields
- * fieldcount is # of fieldindexes
-- * ibuf contains fieldindexes, rowcount, keyvalues
-+ * ibuf contains fieldindexes, rowcount, keyvalues
- *
- * You could also use directly function i2o_issue_params().
- */
-@@ -637,38 +541,8 @@ int i2o_parm_table_get(struct i2o_device
- return size;
- }
-
--/**
-- * i2o_device_init - Initialize I2O devices
-- *
-- * Registers the I2O device class.
-- *
-- * Returns 0 on success or negative error code on failure.
-- */
--int i2o_device_init(void)
--{
-- int rc;
--
-- rc = class_register(&i2o_device_class);
-- if (rc)
-- return rc;
--
-- return class_interface_register(&i2o_device_class_interface);
--};
--
--/**
-- * i2o_device_exit - I2O devices exit function
-- *
-- * Unregisters the I2O device class.
-- */
--void i2o_device_exit(void)
--{
-- class_interface_register(&i2o_device_class_interface);
-- class_unregister(&i2o_device_class);
--};
--
- EXPORT_SYMBOL(i2o_device_claim);
- EXPORT_SYMBOL(i2o_device_claim_release);
- EXPORT_SYMBOL(i2o_parm_field_get);
--EXPORT_SYMBOL(i2o_parm_field_set);
- EXPORT_SYMBOL(i2o_parm_table_get);
- EXPORT_SYMBOL(i2o_parm_issue);
-diff -Nurap ./drivers/message/i2o.i2o/driver.c ./drivers/message/i2o/driver.c
---- ./drivers/message/i2o.i2o/driver.c 2004-10-19 01:55:35.000000000 +0400
-+++ ./drivers/message/i2o/driver.c 2006-09-08 15:10:02.000000000 +0400
-@@ -17,15 +17,20 @@
- #include <linux/module.h>
- #include <linux/rwsem.h>
- #include <linux/i2o.h>
-+#include <linux/workqueue.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+#include "core.h"
-
-+#define OSM_NAME "i2o"
-
- /* max_drivers - Maximum I2O drivers (OSMs) which could be registered */
--unsigned int i2o_max_drivers = I2O_MAX_DRIVERS;
-+static unsigned int i2o_max_drivers = I2O_MAX_DRIVERS;
- module_param_named(max_drivers, i2o_max_drivers, uint, 0);
- MODULE_PARM_DESC(max_drivers, "maximum number of OSM's to support");
-
- /* I2O drivers lock and array */
--static spinlock_t i2o_drivers_lock = SPIN_LOCK_UNLOCKED;
-+static spinlock_t i2o_drivers_lock;
- static struct i2o_driver **i2o_drivers;
-
- /**
-@@ -59,6 +64,7 @@ static int i2o_bus_match(struct device *
- struct bus_type i2o_bus_type = {
- .name = "i2o",
- .match = i2o_bus_match,
-+ .dev_attrs = i2o_device_attrs
- };
-
- /**
-@@ -77,16 +83,16 @@ int i2o_driver_register(struct i2o_drive
- int rc = 0;
- unsigned long flags;
-
-- pr_debug("Register driver %s\n", drv->name);
-+ osm_debug("Register driver %s\n", drv->name);
-
- if (drv->event) {
- drv->event_queue = create_workqueue(drv->name);
- if (!drv->event_queue) {
-- printk(KERN_ERR "i2o: Could not initialize event queue "
-- "for driver %s\n", drv->name);
-+ osm_err("Could not initialize event queue for driver "
-+ "%s\n", drv->name);
- return -EFAULT;
- }
-- pr_debug("Event queue initialized for driver %s\n", drv->name);
-+ osm_debug("Event queue initialized for driver %s\n", drv->name);
- } else
- drv->event_queue = NULL;
-
-@@ -97,8 +103,8 @@ int i2o_driver_register(struct i2o_drive
-
- for (i = 0; i2o_drivers[i]; i++)
- if (i >= i2o_max_drivers) {
-- printk(KERN_ERR "i2o: too many drivers registered, "
-- "increase max_drivers\n");
-+ osm_err("too many drivers registered, increase "
-+ "max_drivers\n");
- spin_unlock_irqrestore(&i2o_drivers_lock, flags);
- return -EFAULT;
- }
-@@ -108,17 +114,16 @@ int i2o_driver_register(struct i2o_drive
-
- spin_unlock_irqrestore(&i2o_drivers_lock, flags);
-
-- pr_debug("driver %s gets context id %d\n", drv->name, drv->context);
-+ osm_debug("driver %s gets context id %d\n", drv->name, drv->context);
-
- list_for_each_entry(c, &i2o_controllers, list) {
- struct i2o_device *i2o_dev;
-
- i2o_driver_notify_controller_add(drv, c);
- list_for_each_entry(i2o_dev, &c->devices, list)
-- i2o_driver_notify_device_add(drv, i2o_dev);
-+ i2o_driver_notify_device_add(drv, i2o_dev);
- }
-
--
- rc = driver_register(&drv->driver);
- if (rc)
- destroy_workqueue(drv->event_queue);
-@@ -138,7 +143,7 @@ void i2o_driver_unregister(struct i2o_dr
- struct i2o_controller *c;
- unsigned long flags;
-
-- pr_debug("unregister driver %s\n", drv->name);
-+ osm_debug("unregister driver %s\n", drv->name);
-
- driver_unregister(&drv->driver);
-
-@@ -146,7 +151,7 @@ void i2o_driver_unregister(struct i2o_dr
- struct i2o_device *i2o_dev;
-
- list_for_each_entry(i2o_dev, &c->devices, list)
-- i2o_driver_notify_device_remove(drv, i2o_dev);
-+ i2o_driver_notify_device_remove(drv, i2o_dev);
-
- i2o_driver_notify_controller_remove(drv, c);
- }
-@@ -158,7 +163,7 @@ void i2o_driver_unregister(struct i2o_dr
- if (drv->event_queue) {
- destroy_workqueue(drv->event_queue);
- drv->event_queue = NULL;
-- pr_debug("event queue removed for %s\n", drv->name);
-+ osm_debug("event queue removed for %s\n", drv->name);
- }
- };
-
-@@ -175,68 +180,70 @@ void i2o_driver_unregister(struct i2o_dr
- * on success and if the message should be flushed afterwords. Returns
- * negative error code on failure (the message will be flushed too).
- */
--int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
-- struct i2o_message *msg)
-+int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
- {
- struct i2o_driver *drv;
-- u32 context = readl(&msg->u.s.icntxt);
-+ struct i2o_message *msg = i2o_msg_out_to_virt(c, m);
-+ u32 context = le32_to_cpu(msg->u.s.icntxt);
-+ unsigned long flags;
-+
-+ if (unlikely(context >= i2o_max_drivers)) {
-+ osm_warn("%s: Spurious reply to unknown driver %d\n", c->name,
-+ context);
-+ return -EIO;
-+ }
-+
-+ spin_lock_irqsave(&i2o_drivers_lock, flags);
-+ drv = i2o_drivers[context];
-+ spin_unlock_irqrestore(&i2o_drivers_lock, flags);
-+
-+ if (unlikely(!drv)) {
-+ osm_warn("%s: Spurious reply to unknown driver %d\n", c->name,
-+ context);
-+ return -EIO;
-+ }
-+
-+ if ((le32_to_cpu(msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) {
-+ struct i2o_device *dev, *tmp;
-+ struct i2o_event *evt;
-+ u16 size;
-+ u16 tid = le32_to_cpu(msg->u.head[1]) & 0xfff;
-
-- if (likely(context < i2o_max_drivers)) {
-- spin_lock(&i2o_drivers_lock);
-- drv = i2o_drivers[context];
-- spin_unlock(&i2o_drivers_lock);
--
-- if (unlikely(!drv)) {
-- printk(KERN_WARNING "i2o: Spurious reply to unknown "
-- "driver %d\n", context);
-+ osm_debug("event received from device %d\n", tid);
-+
-+ if (!drv->event)
- return -EIO;
-- }
-
-- if ((readl(&msg->u.head[1]) >> 24) == I2O_CMD_UTIL_EVT_REGISTER) {
-- struct i2o_device *dev, *tmp;
-- struct i2o_event *evt;
-- u16 size;
-- u16 tid;
--
-- tid = readl(&msg->u.head[1]) & 0x1fff;
--
-- pr_debug("%s: event received from device %d\n", c->name,
-- tid);
--
-- /* cut of header from message size (in 32-bit words) */
-- size = (readl(&msg->u.head[0]) >> 16) - 5;
--
-- evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC);
-- if (!evt)
-- return -ENOMEM;
-- memset(evt, 0, size * 4 + sizeof(*evt));
--
-- evt->size = size;
-- memcpy_fromio(&evt->tcntxt, &msg->u.s.tcntxt,
-- (size + 2) * 4);
--
-- list_for_each_entry_safe(dev, tmp, &c->devices, list)
-- if (dev->lct_data.tid == tid) {
-- evt->i2o_dev = dev;
-- break;
-- }
--
-- INIT_WORK(&evt->work, (void (*)(void *))drv->event,
-- evt);
-- queue_work(drv->event_queue, &evt->work);
-- return 1;
-+ /* cut of header from message size (in 32-bit words) */
-+ size = (le32_to_cpu(msg->u.head[0]) >> 16) - 5;
-+
-+ evt = kzalloc(size * 4 + sizeof(*evt), GFP_ATOMIC);
-+ if (!evt)
-+ return -ENOMEM;
-+
-+ evt->size = size;
-+ evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt);
-+ evt->event_indicator = le32_to_cpu(msg->body[0]);
-+ memcpy(&evt->data, &msg->body[1], size * 4);
-+
-+ list_for_each_entry_safe(dev, tmp, &c->devices, list)
-+ if (dev->lct_data.tid == tid) {
-+ evt->i2o_dev = dev;
-+ break;
- }
-
-- if (likely(drv->reply))
-- return drv->reply(c, m, msg);
-- else
-- pr_debug("%s: Reply to driver %s, but no reply function"
-- " defined!\n", c->name, drv->name);
-+ INIT_WORK(&evt->work, (void (*)(void *))drv->event, evt);
-+ queue_work(drv->event_queue, &evt->work);
-+ return 1;
-+ }
-+
-+ if (unlikely(!drv->reply)) {
-+ osm_debug("%s: Reply to driver %s, but no reply function"
-+ " defined!\n", c->name, drv->name);
- return -EIO;
-- } else
-- printk(KERN_WARNING "i2o: Spurious reply to unknown driver "
-- "%d\n", readl(&msg->u.s.icntxt));
-- return -EIO;
-+ }
-+
-+ return drv->reply(c, m, msg);
- }
-
- /**
-@@ -246,14 +253,15 @@ int i2o_driver_dispatch(struct i2o_contr
- * Send notifications to all registered drivers that a new controller was
- * added.
- */
--void i2o_driver_notify_controller_add_all(struct i2o_controller *c) {
-+void i2o_driver_notify_controller_add_all(struct i2o_controller *c)
-+{
- int i;
- struct i2o_driver *drv;
-
-- for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
-+ for (i = 0; i < I2O_MAX_DRIVERS; i++) {
- drv = i2o_drivers[i];
-
-- if(drv)
-+ if (drv)
- i2o_driver_notify_controller_add(drv, c);
- }
- }
-@@ -265,14 +273,15 @@ void i2o_driver_notify_controller_add_al
- * Send notifications to all registered drivers that a controller was
- * removed.
- */
--void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) {
-+void i2o_driver_notify_controller_remove_all(struct i2o_controller *c)
-+{
- int i;
- struct i2o_driver *drv;
-
-- for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
-+ for (i = 0; i < I2O_MAX_DRIVERS; i++) {
- drv = i2o_drivers[i];
-
-- if(drv)
-+ if (drv)
- i2o_driver_notify_controller_remove(drv, c);
- }
- }
-@@ -283,14 +292,15 @@ void i2o_driver_notify_controller_remove
- *
- * Send notifications to all registered drivers that a device was added.
- */
--void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) {
-+void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev)
-+{
- int i;
- struct i2o_driver *drv;
-
-- for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
-+ for (i = 0; i < I2O_MAX_DRIVERS; i++) {
- drv = i2o_drivers[i];
-
-- if(drv)
-+ if (drv)
- i2o_driver_notify_device_add(drv, i2o_dev);
- }
- }
-@@ -301,14 +311,15 @@ void i2o_driver_notify_device_add_all(st
- *
- * Send notifications to all registered drivers that a device was removed.
- */
--void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) {
-+void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
-+{
- int i;
- struct i2o_driver *drv;
-
-- for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
-+ for (i = 0; i < I2O_MAX_DRIVERS; i++) {
- drv = i2o_drivers[i];
-
-- if(drv)
-+ if (drv)
- i2o_driver_notify_device_remove(drv, i2o_dev);
- }
- }
-@@ -324,22 +335,22 @@ int __init i2o_driver_init(void)
- {
- int rc = 0;
-
-+ spin_lock_init(&i2o_drivers_lock);
-+
- if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) ||
- ((i2o_max_drivers ^ (i2o_max_drivers - 1)) !=
- (2 * i2o_max_drivers - 1))) {
-- printk(KERN_WARNING "i2o: max_drivers set to %d, but must be "
-- ">=2 and <= 64 and a power of 2\n", i2o_max_drivers);
-+ osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and "
-+ "a power of 2\n", i2o_max_drivers);
- i2o_max_drivers = I2O_MAX_DRIVERS;
- }
-- printk(KERN_INFO "i2o: max_drivers=%d\n", i2o_max_drivers);
-+ osm_info("max drivers = %d\n", i2o_max_drivers);
-
- i2o_drivers =
-- kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL);
-+ kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL);
- if (!i2o_drivers)
- return -ENOMEM;
-
-- memset(i2o_drivers, 0, i2o_max_drivers * sizeof(*i2o_drivers));
--
- rc = bus_register(&i2o_bus_type);
-
- if (rc < 0)
-diff -Nurap ./drivers/message/i2o.i2o/exec-osm.c ./drivers/message/i2o/exec-osm.c
---- ./drivers/message/i2o.i2o/exec-osm.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/message/i2o/exec-osm.c 2006-09-08 15:10:02.000000000 +0400
-@@ -29,19 +29,23 @@
-
- #include <linux/module.h>
- #include <linux/i2o.h>
-+#include <linux/delay.h>
-+#include <linux/workqueue.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+#include <linux/sched.h> /* wait_event_interruptible_timeout() needs this */
-+#include <asm/param.h> /* HZ */
-+#include "core.h"
-
--struct i2o_driver i2o_exec_driver;
-+#define OSM_NAME "exec-osm"
-
--/* Module internal functions from other sources */
--extern int i2o_device_parse_lct(struct i2o_controller *);
-+struct i2o_driver i2o_exec_driver;
-
-+#ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES
-+static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind);
-+#endif
- /* global wait list for POST WAIT */
- static LIST_HEAD(i2o_exec_wait_list);
--/*
-- * i2o_exec_wait_list and i2o_exec_wait's complete and wq fields
-- * must be accessed under this lock
-- */
--static spinlock_t i2o_exec_wait_list_lock = SPIN_LOCK_UNLOCKED;
-
- /* Wait struct needed for POST WAIT */
- struct i2o_exec_wait {
-@@ -52,6 +56,14 @@ struct i2o_exec_wait {
- u32 m; /* message id */
- struct i2o_message *msg; /* pointer to the reply message */
- struct list_head list; /* node in global wait list */
-+ spinlock_t lock; /* lock before modifying */
-+};
-+
-+/* Work struct needed to handle LCT NOTIFY replies */
-+struct i2o_exec_lct_notify_work {
-+ struct work_struct work; /* work struct */
-+ struct i2o_controller *c; /* controller on which the LCT NOTIFY
-+ was received */
- };
-
- /* Exec OSM class handling definition */
-@@ -72,13 +84,12 @@ static struct i2o_exec_wait *i2o_exec_wa
- {
- struct i2o_exec_wait *wait;
-
-- wait = kmalloc(sizeof(*wait), GFP_KERNEL);
-+ wait = kzalloc(sizeof(*wait), GFP_KERNEL);
- if (!wait)
-- return ERR_PTR(-ENOMEM);
--
-- memset(wait, 0, sizeof(*wait));
-+ return NULL;
-
- INIT_LIST_HEAD(&wait->list);
-+ spin_lock_init(&wait->lock);
-
- return wait;
- };
-@@ -108,70 +119,59 @@ static void i2o_exec_wait_free(struct i2
- * buffer must not be freed. Instead the event completion will free them
- * for you. In all other cases the buffer are your problem.
- *
-- * Returns 0 on success or negative error code on failure.
-+ * Returns 0 on success, negative error code on timeout or positive error
-+ * code from reply.
- */
--int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long
-- timeout, struct i2o_dma *dma)
-+int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
-+ unsigned long timeout, struct i2o_dma *dma)
- {
- DECLARE_WAIT_QUEUE_HEAD(wq);
-- DEFINE_WAIT(wait);
-- struct i2o_exec_wait *iwait;
-+ struct i2o_exec_wait *wait;
- static u32 tcntxt = 0x80000000;
-- struct i2o_message *msg = c->in_queue.virt + m;
-- int rc = 0;
- unsigned long flags;
-+ int rc = 0;
-
-- iwait = i2o_exec_wait_alloc();
-- if (!iwait)
-+ wait = i2o_exec_wait_alloc();
-+ if (!wait)
- return -ENOMEM;
-
- if (tcntxt == 0xffffffff)
- tcntxt = 0x80000000;
-
- if (dma)
-- iwait->dma = *dma;
-+ wait->dma = *dma;
-
- /*
- * Fill in the message initiator context and transaction context.
- * We will only use transaction contexts >= 0x80000000 for POST WAIT,
- * so we could find a POST WAIT reply easier in the reply handler.
- */
-- writel(i2o_exec_driver.context, &msg->u.s.icntxt);
-- iwait->tcntxt = tcntxt++;
-- writel(iwait->tcntxt, &msg->u.s.tcntxt);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-+ wait->tcntxt = tcntxt++;
-+ msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt);
-
-+ wait->wq = &wq;
- /*
-- * Post the message to the controller. At some point later it will
-- * return. If we time out before it returns then complete will be zero.
-+ * we add elements to the head, because if a entry in the list will
-+ * never be removed, we have to iterate over it every time
- */
-- i2o_msg_post(c, m);
-+ list_add(&wait->list, &i2o_exec_wait_list);
-
-- spin_lock_irqsave(&i2o_exec_wait_list_lock, flags);
-- iwait->wq = &wq;
- /*
-- * we add elements add the head, because if a entry in the list
-- * will never be removed, we have to iterate over it every time
-+ * Post the message to the controller. At some point later it will
-+ * return. If we time out before it returns then complete will be zero.
- */
-- list_add(&iwait->list, &i2o_exec_wait_list);
-+ i2o_msg_post(c, msg);
-
-- prepare_to_wait(&wq, &wait, TASK_INTERRUPTIBLE);
--
-- if (!iwait->complete) {
-- spin_unlock_irqrestore(&i2o_exec_wait_list_lock, flags);
-- schedule_timeout(timeout * HZ);
-- spin_lock_irqsave(&i2o_exec_wait_list_lock, flags);
-- }
-+ wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ);
-
-- finish_wait(&wq, &wait);
-+ spin_lock_irqsave(&wait->lock, flags);
-
-- iwait->wq = NULL;
-+ wait->wq = NULL;
-
-- if (iwait->complete) {
-- spin_unlock_irqrestore(&i2o_exec_wait_list_lock, flags);
-- rc = readl(&iwait->msg->body[0]) >> 24;
-- i2o_flush_reply(c, iwait->m);
-- i2o_exec_wait_free(iwait);
-- } else {
-+ if (wait->complete)
-+ rc = le32_to_cpu(wait->msg->body[0]) >> 24;
-+ else {
- /*
- * We cannot remove it now. This is important. When it does
- * terminate (which it must do if the controller has not
-@@ -183,7 +183,13 @@ int i2o_msg_post_wait_mem(struct i2o_con
- dma->virt = NULL;
-
- rc = -ETIMEDOUT;
-- spin_unlock_irqrestore(&i2o_exec_wait_list_lock, flags);
-+ }
-+
-+ spin_unlock_irqrestore(&wait->lock, flags);
-+
-+ if (rc != -ETIMEDOUT) {
-+ i2o_flush_reply(c, wait->m);
-+ i2o_exec_wait_free(wait);
- }
-
- return rc;
-@@ -194,6 +200,7 @@ int i2o_msg_post_wait_mem(struct i2o_con
- * @c: I2O controller which answers
- * @m: message id
- * @msg: pointer to the I2O reply message
-+ * @context: transaction context of request
- *
- * This function is called in interrupt context only. If the reply reached
- * before the timeout, the i2o_exec_wait struct is filled with the message
-@@ -208,14 +215,11 @@ int i2o_msg_post_wait_mem(struct i2o_con
- * message must also be given back to the controller.
- */
- static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
-- struct i2o_message *msg)
-+ struct i2o_message *msg, u32 context)
- {
- struct i2o_exec_wait *wait, *tmp;
-- int rc = 1;
-- u32 context;
- unsigned long flags;
--
-- context = readl(&msg->u.s.tcntxt);
-+ int rc = 1;
-
- /*
- * We need to search through the i2o_exec_wait_list to see if the given
-@@ -224,44 +228,90 @@ static int i2o_msg_post_wait_complete(st
- * already expired. Not much we can do about that except log it for
- * debug purposes, increase timeout, and recompile.
- */
-- spin_lock_irqsave(&i2o_exec_wait_list_lock, flags);
- list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) {
- if (wait->tcntxt == context) {
-+ spin_lock_irqsave(&wait->lock, flags);
-+
- list_del(&wait->list);
-
- wait->m = m;
- wait->msg = msg;
- wait->complete = 1;
-
-- if (wait->wq) {
-- wake_up_interruptible(wait->wq);
-+ if (wait->wq)
- rc = 0;
-- } else {
-+ else
-+ rc = -1;
-+
-+ spin_unlock_irqrestore(&wait->lock, flags);
-+
-+ if (rc) {
- struct device *dev;
-
- dev = &c->pdev->dev;
-
-- pr_debug("timedout reply received!\n");
-+ pr_debug("%s: timedout reply received!\n",
-+ c->name);
- i2o_dma_free(dev, &wait->dma);
- i2o_exec_wait_free(wait);
-- rc = -1;
-- }
--
-- spin_unlock_irqrestore(&i2o_exec_wait_list_lock, flags);
-+ } else
-+ wake_up_interruptible(wait->wq);
-
- return rc;
- }
- }
-
-- spin_unlock_irqrestore(&i2o_exec_wait_list_lock, flags);
--
-- pr_debug("i2o: Bogus reply in POST WAIT (tr-context: %08x)!\n",
-+ osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name,
- context);
-
- return -1;
- };
-
- /**
-+ * i2o_exec_show_vendor_id - Displays Vendor ID of controller
-+ * @d: device of which the Vendor ID should be displayed
-+ * @buf: buffer into which the Vendor ID should be printed
-+ *
-+ * Returns number of bytes printed into buffer.
-+ */
-+static ssize_t i2o_exec_show_vendor_id(struct device *d, char *buf)
-+{
-+ struct i2o_device *dev = to_i2o_device(d);
-+ u16 id;
-+
-+ if (!i2o_parm_field_get(dev, 0x0000, 0, &id, 2)) {
-+ sprintf(buf, "0x%04x", le16_to_cpu(id));
-+ return strlen(buf) + 1;
-+ }
-+
-+ return 0;
-+};
-+
-+/**
-+ * i2o_exec_show_product_id - Displays Product ID of controller
-+ * @d: device of which the Product ID should be displayed
-+ * @buf: buffer into which the Product ID should be printed
-+ *
-+ * Returns number of bytes printed into buffer.
-+ */
-+static ssize_t i2o_exec_show_product_id(struct device *d, char *buf)
-+{
-+ struct i2o_device *dev = to_i2o_device(d);
-+ u16 id;
-+
-+ if (!i2o_parm_field_get(dev, 0x0000, 1, &id, 2)) {
-+ sprintf(buf, "0x%04x", le16_to_cpu(id));
-+ return strlen(buf) + 1;
-+ }
-+
-+ return 0;
-+};
-+
-+/* Exec-OSM device attributes */
-+static DEVICE_ATTR(vendor_id, S_IRUGO, i2o_exec_show_vendor_id, NULL);
-+static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL);
-+
-+/**
- * i2o_exec_probe - Called if a new I2O device (executive class) appears
- * @dev: I2O device which should be probed
- *
-@@ -276,7 +326,8 @@ static int i2o_exec_probe(struct device
-
- i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
-
-- i2o_dev->iop->exec = i2o_dev;
-+ device_create_file(dev, &dev_attr_vendor_id);
-+ device_create_file(dev, &dev_attr_product_id);
-
- return 0;
- };
-@@ -291,6 +342,9 @@ static int i2o_exec_probe(struct device
- */
- static int i2o_exec_remove(struct device *dev)
- {
-+ device_remove_file(dev, &dev_attr_product_id);
-+ device_remove_file(dev, &dev_attr_vendor_id);
-+
- i2o_event_register(to_i2o_device(dev), &i2o_exec_driver, 0, 0);
-
- return 0;
-@@ -302,12 +356,21 @@ static int i2o_exec_remove(struct device
- *
- * This function handles asynchronus LCT NOTIFY replies. It parses the
- * new LCT and if the buffer for the LCT was to small sends a LCT NOTIFY
-- * again.
-+ * again, otherwise send LCT NOTIFY to get informed on next LCT change.
- */
--static void i2o_exec_lct_modified(struct i2o_controller *c)
-+static void i2o_exec_lct_modified(struct i2o_exec_lct_notify_work *work)
- {
-- if (i2o_device_parse_lct(c) == -EAGAIN)
-- i2o_exec_lct_notify(c, 0);
-+ u32 change_ind = 0;
-+ struct i2o_controller *c = work->c;
-+
-+ kfree(work);
-+
-+ if (i2o_device_parse_lct(c) != -EAGAIN)
-+ change_ind = c->lct->change_ind + 1;
-+
-+#ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES
-+ i2o_exec_lct_notify(c, change_ind);
-+#endif
- };
-
- /**
-@@ -327,28 +390,33 @@ static void i2o_exec_lct_modified(struct
- static int i2o_exec_reply(struct i2o_controller *c, u32 m,
- struct i2o_message *msg)
- {
-- if (readl(&msg->u.head[0]) & MSG_FAIL) { // Fail bit is set
-- struct i2o_message *pmsg; /* preserved message */
-+ u32 context;
-+
-+ if (le32_to_cpu(msg->u.head[0]) & MSG_FAIL) {
-+ struct i2o_message __iomem *pmsg;
- u32 pm;
-
-- pm = readl(&msg->body[3]);
-+ /*
-+ * If Fail bit is set we must take the transaction context of
-+ * the preserved message to find the right request again.
-+ */
-
-- pmsg = c->in_queue.virt + pm;
-+ pm = le32_to_cpu(msg->body[3]);
-+ pmsg = i2o_msg_in_to_virt(c, pm);
-+ context = readl(&pmsg->u.s.tcntxt);
-
- i2o_report_status(KERN_INFO, "i2o_core", msg);
-
-- /* Release the preserved msg by resubmitting it as a NOP */
-- i2o_msg_nop(c, pm);
--
-- /* If reply to i2o_post_wait failed, return causes a timeout */
-- return -1;
-- }
-+ /* Release the preserved msg */
-+ i2o_msg_nop_mfa(c, pm);
-+ } else
-+ context = le32_to_cpu(msg->u.s.tcntxt);
-
-- if (readl(&msg->u.s.tcntxt) & 0x80000000)
-- return i2o_msg_post_wait_complete(c, m, msg);
-+ if (context & 0x80000000)
-+ return i2o_msg_post_wait_complete(c, m, msg, context);
-
-- if ((readl(&msg->u.head[1]) >> 24) == I2O_CMD_LCT_NOTIFY) {
-- struct work_struct *work;
-+ if ((le32_to_cpu(msg->u.head[1]) >> 24) == I2O_CMD_LCT_NOTIFY) {
-+ struct i2o_exec_lct_notify_work *work;
-
- pr_debug("%s: LCT notify received\n", c->name);
-
-@@ -356,8 +424,11 @@ static int i2o_exec_reply(struct i2o_con
- if (!work)
- return -ENOMEM;
-
-- INIT_WORK(work, (void (*)(void *))i2o_exec_lct_modified, c);
-- queue_work(i2o_exec_driver.event_queue, work);
-+ work->c = c;
-+
-+ INIT_WORK(&work->work, (void (*)(void *))i2o_exec_lct_modified,
-+ work);
-+ queue_work(i2o_exec_driver.event_queue, &work->work);
- return 1;
- }
-
-@@ -383,8 +454,9 @@ static int i2o_exec_reply(struct i2o_con
- */
- static void i2o_exec_event(struct i2o_event *evt)
- {
-- printk(KERN_INFO "Event received from device: %d\n",
-- evt->i2o_dev->lct_data.tid);
-+ if (likely(evt->i2o_dev))
-+ osm_debug("Event received from device: %d\n",
-+ evt->i2o_dev->lct_data.tid);
- kfree(evt);
- };
-
-@@ -401,24 +473,25 @@ static void i2o_exec_event(struct i2o_ev
- int i2o_exec_lct_get(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
- int i = 0;
- int rc = -EAGAIN;
-
- for (i = 1; i <= I2O_LCT_GET_TRIES; i++) {
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6, &msg->u.head[0]);
-- writel(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(0xffffffff, &msg->body[0]);
-- writel(0x00000000, &msg->body[1]);
-- writel(0xd0000000 | c->dlct.len, &msg->body[2]);
-- writel(c->dlct.phys, &msg->body[3]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] =
-+ cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->body[0] = cpu_to_le32(0xffffffff);
-+ msg->body[1] = cpu_to_le32(0x00000000);
-+ msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
-+ msg->body[3] = cpu_to_le32(c->dlct.phys);
-
-- rc = i2o_msg_post_wait(c, m, I2O_TIMEOUT_LCT_GET);
-+ rc = i2o_msg_post_wait(c, msg, I2O_TIMEOUT_LCT_GET);
- if (rc < 0)
- break;
-
-@@ -430,6 +503,7 @@ int i2o_exec_lct_get(struct i2o_controll
- return rc;
- }
-
-+#ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES
- /**
- * i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request
- * @c: I2O controller to which the request should be send
-@@ -440,40 +514,44 @@ int i2o_exec_lct_get(struct i2o_controll
- * replies immediately after the request. If change_ind > 0 the reply is
- * send after change indicator of the LCT is > change_ind.
- */
--int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
-+static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
- {
- i2o_status_block *sb = c->status_block.virt;
- struct device *dev;
- struct i2o_message *msg;
-- u32 m;
-+
-+ down(&c->lct_lock);
-
- dev = &c->pdev->dev;
-
-- if (i2o_dma_realloc(dev, &c->dlct, sb->expected_lct_size, GFP_KERNEL))
-+ if (i2o_dma_realloc
-+ (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL))
- return -ENOMEM;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6, &msg->u.head[0]);
-- writel(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_exec_driver.context, &msg->u.s.icntxt);
-- writel(0, &msg->u.s.tcntxt); /* FIXME */
-- writel(0xffffffff, &msg->body[0]);
-- writel(change_ind, &msg->body[1]);
-- writel(0xd0000000 | c->dlct.len, &msg->body[2]);
-- writel(c->dlct.phys, &msg->body[3]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
-+ msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-+ msg->u.s.tcntxt = cpu_to_le32(0x00000000);
-+ msg->body[0] = cpu_to_le32(0xffffffff);
-+ msg->body[1] = cpu_to_le32(change_ind);
-+ msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
-+ msg->body[3] = cpu_to_le32(c->dlct.phys);
-
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-+
-+ up(&c->lct_lock);
-
- return 0;
- };
--
-+#endif
- /* Exec OSM driver struct */
- struct i2o_driver i2o_exec_driver = {
-- .name = "exec-osm",
-+ .name = OSM_NAME,
- .reply = i2o_exec_reply,
- .event = i2o_exec_event,
- .classes = i2o_exec_class_id,
-@@ -507,4 +585,3 @@ void __exit i2o_exec_exit(void)
-
- EXPORT_SYMBOL(i2o_msg_post_wait_mem);
- EXPORT_SYMBOL(i2o_exec_lct_get);
--EXPORT_SYMBOL(i2o_exec_lct_notify);
-diff -Nurap ./drivers/message/i2o.i2o/i2o_block.c ./drivers/message/i2o/i2o_block.c
---- ./drivers/message/i2o.i2o/i2o_block.c 2004-10-19 01:54:39.000000000 +0400
-+++ ./drivers/message/i2o/i2o_block.c 2006-09-08 15:10:02.000000000 +0400
-@@ -59,8 +59,14 @@
- #include <linux/blkdev.h>
- #include <linux/hdreg.h>
-
-+#include <scsi/scsi.h>
-+
- #include "i2o_block.h"
-
-+#define OSM_NAME "block-osm"
-+#define OSM_VERSION "1.325"
-+#define OSM_DESCRIPTION "I2O Block Device OSM"
-+
- static struct i2o_driver i2o_block_driver;
-
- /* global Block OSM request mempool */
-@@ -100,8 +106,8 @@ static int i2o_block_remove(struct devic
- struct i2o_device *i2o_dev = to_i2o_device(dev);
- struct i2o_block_device *i2o_blk_dev = dev_get_drvdata(dev);
-
-- printk(KERN_INFO "block-osm: Device removed %s\n",
-- i2o_blk_dev->gd->disk_name);
-+ osm_info("device removed (TID: %03x): %s\n", i2o_dev->lct_data.tid,
-+ i2o_blk_dev->gd->disk_name);
-
- i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0);
-
-@@ -127,22 +133,45 @@ static int i2o_block_remove(struct devic
- static int i2o_block_device_flush(struct i2o_device *dev)
- {
- struct i2o_message *msg;
-- u32 m;
-
-- m = i2o_msg_get_wait(dev->iop, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_BLOCK_CFLUSH << 24 | HOST_TID << 12 | dev->lct_data.tid,
-- &msg->u.head[1]);
-- writel(60 << 16, &msg->body[0]);
-- pr_debug("Flushing...\n");
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BLOCK_CFLUSH << 24 | HOST_TID << 12 | dev->
-+ lct_data.tid);
-+ msg->body[0] = cpu_to_le32(60 << 16);
-+ osm_debug("Flushing...\n");
-
-- return i2o_msg_post_wait(dev->iop, m, 60);
-+ return i2o_msg_post_wait(dev->iop, msg, 60);
- };
-
- /**
-+ * i2o_block_issue_flush - device-flush interface for block-layer
-+ * @queue: the request queue of the device which should be flushed
-+ * @disk: gendisk
-+ * @error_sector: error offset
-+ *
-+ * Helper function to provide flush functionality to block-layer.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+
-+static int i2o_block_issue_flush(request_queue_t * queue, struct gendisk *disk,
-+ sector_t * error_sector)
-+{
-+ struct i2o_block_device *i2o_blk_dev = queue->queuedata;
-+ int rc = -ENODEV;
-+
-+ if (likely(i2o_blk_dev))
-+ rc = i2o_block_device_flush(i2o_blk_dev->i2o_dev);
-+
-+ return rc;
-+}
-+
-+/**
- * i2o_block_device_mount - Mount (load) the media of device dev
- * @dev: I2O device which should receive the mount request
- * @media_id: Media Identifier
-@@ -155,20 +184,20 @@ static int i2o_block_device_flush(struct
- static int i2o_block_device_mount(struct i2o_device *dev, u32 media_id)
- {
- struct i2o_message *msg;
-- u32 m;
-
-- m = i2o_msg_get_wait(dev->iop, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_BLOCK_MMOUNT << 24 | HOST_TID << 12 | dev->lct_data.tid,
-- &msg->u.head[1]);
-- writel(-1, &msg->body[0]);
-- writel(0, &msg->body[1]);
-- pr_debug("Mounting...\n");
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BLOCK_MMOUNT << 24 | HOST_TID << 12 | dev->
-+ lct_data.tid);
-+ msg->body[0] = cpu_to_le32(-1);
-+ msg->body[1] = cpu_to_le32(0x00000000);
-+ osm_debug("Mounting...\n");
-
-- return i2o_msg_post_wait(dev->iop, m, 2);
-+ return i2o_msg_post_wait(dev->iop, msg, 2);
- };
-
- /**
-@@ -184,19 +213,19 @@ static int i2o_block_device_mount(struct
- static int i2o_block_device_lock(struct i2o_device *dev, u32 media_id)
- {
- struct i2o_message *msg;
-- u32 m;
-
-- m = i2o_msg_get_wait(dev->iop, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_BLOCK_MLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid,
-- &msg->u.head[1]);
-- writel(-1, &msg->body[0]);
-- pr_debug("Locking...\n");
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg) == I2O_QUEUE_EMPTY)
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BLOCK_MLOCK << 24 | HOST_TID << 12 | dev->
-+ lct_data.tid);
-+ msg->body[0] = cpu_to_le32(-1);
-+ osm_debug("Locking...\n");
-
-- return i2o_msg_post_wait(dev->iop, m, 2);
-+ return i2o_msg_post_wait(dev->iop, msg, 2);
- };
-
- /**
-@@ -212,19 +241,19 @@ static int i2o_block_device_lock(struct
- static int i2o_block_device_unlock(struct i2o_device *dev, u32 media_id)
- {
- struct i2o_message *msg;
-- u32 m;
-
-- m = i2o_msg_get_wait(dev->iop, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_BLOCK_MUNLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid,
-- &msg->u.head[1]);
-- writel(media_id, &msg->body[0]);
-- pr_debug("Unlocking...\n");
-+ msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BLOCK_MUNLOCK << 24 | HOST_TID << 12 | dev->
-+ lct_data.tid);
-+ msg->body[0] = cpu_to_le32(media_id);
-+ osm_debug("Unlocking...\n");
-
-- return i2o_msg_post_wait(dev->iop, m, 2);
-+ return i2o_msg_post_wait(dev->iop, msg, 2);
- };
-
- /**
-@@ -241,20 +270,20 @@ static int i2o_block_device_power(struct
- struct i2o_device *i2o_dev = dev->i2o_dev;
- struct i2o_controller *c = i2o_dev->iop;
- struct i2o_message *msg;
-- u32 m;
- int rc;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_BLOCK_POWER << 24 | HOST_TID << 12 | i2o_dev->lct_data.
-- tid, &msg->u.head[1]);
-- writel(op << 24, &msg->body[0]);
-- pr_debug("Power...\n");
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_BLOCK_POWER << 24 | HOST_TID << 12 | i2o_dev->
-+ lct_data.tid);
-+ msg->body[0] = cpu_to_le32(op << 24);
-+ osm_debug("Power...\n");
-
-- rc = i2o_msg_post_wait(c, m, 60);
-+ rc = i2o_msg_post_wait(c, msg, 60);
- if (!rc)
- dev->power = op;
-
-@@ -295,28 +324,31 @@ static inline void i2o_block_request_fre
-
- /**
- * i2o_block_sglist_alloc - Allocate the SG list and map it
-+ * @c: I2O controller to which the request belongs
- * @ireq: I2O block request
- *
-- * Builds the SG list and map it into to be accessable by the controller.
-+ * Builds the SG list and map it to be accessable by the controller.
- *
-- * Returns the number of elements in the SG list or 0 on failure.
-+ * Returns 0 on failure or 1 on success.
- */
--static inline int i2o_block_sglist_alloc(struct i2o_block_request *ireq)
-+static inline int i2o_block_sglist_alloc(struct i2o_controller *c,
-+ struct i2o_block_request *ireq,
-+ u32 ** mptr)
- {
-- struct device *dev = &ireq->i2o_blk_dev->i2o_dev->iop->pdev->dev;
- int nents;
-+ enum dma_data_direction direction;
-
-+ ireq->dev = &c->pdev->dev;
- nents = blk_rq_map_sg(ireq->req->q, ireq->req, ireq->sg_table);
-
- if (rq_data_dir(ireq->req) == READ)
-- ireq->sg_dma_direction = PCI_DMA_FROMDEVICE;
-+ direction = PCI_DMA_FROMDEVICE;
- else
-- ireq->sg_dma_direction = PCI_DMA_TODEVICE;
-+ direction = PCI_DMA_TODEVICE;
-
-- ireq->sg_nents = dma_map_sg(dev, ireq->sg_table, nents,
-- ireq->sg_dma_direction);
-+ ireq->sg_nents = nents;
-
-- return ireq->sg_nents;
-+ return i2o_dma_map_sg(c, ireq->sg_table, nents, direction, mptr);
- };
-
- /**
-@@ -327,10 +359,14 @@ static inline int i2o_block_sglist_alloc
- */
- static inline void i2o_block_sglist_free(struct i2o_block_request *ireq)
- {
-- struct device *dev = &ireq->i2o_blk_dev->i2o_dev->iop->pdev->dev;
-+ enum dma_data_direction direction;
-+
-+ if (rq_data_dir(ireq->req) == READ)
-+ direction = PCI_DMA_FROMDEVICE;
-+ else
-+ direction = PCI_DMA_TODEVICE;
-
-- dma_unmap_sg(dev, ireq->sg_table, ireq->sg_nents,
-- ireq->sg_dma_direction);
-+ dma_unmap_sg(ireq->dev, ireq->sg_table, ireq->sg_nents, direction);
- };
-
- /**
-@@ -348,9 +384,14 @@ static int i2o_block_prep_req_fn(struct
- struct i2o_block_device *i2o_blk_dev = q->queuedata;
- struct i2o_block_request *ireq;
-
-+ if (unlikely(!i2o_blk_dev)) {
-+ osm_err("block device already removed\n");
-+ return BLKPREP_KILL;
-+ }
-+
- /* request is already processed by us, so return */
- if (req->flags & REQ_SPECIAL) {
-- pr_debug("REQ_SPECIAL already set!\n");
-+ osm_debug("REQ_SPECIAL already set!\n");
- req->flags |= REQ_DONTPREP;
- return BLKPREP_OK;
- }
-@@ -359,7 +400,7 @@ static int i2o_block_prep_req_fn(struct
- if (!req->special) {
- ireq = i2o_block_request_alloc();
- if (unlikely(IS_ERR(ireq))) {
-- pr_debug("unable to allocate i2o_block_request!\n");
-+ osm_debug("unable to allocate i2o_block_request!\n");
- return BLKPREP_DEFER;
- }
-
-@@ -397,104 +438,69 @@ static void i2o_block_delayed_request_fn
- };
-
- /**
-- * i2o_block_reply - Block OSM reply handler.
-- * @c: I2O controller from which the message arrives
-- * @m: message id of reply
-- * qmsg: the actuall I2O message reply
-+ * i2o_block_end_request - Post-processing of completed commands
-+ * @req: request which should be completed
-+ * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error
-+ * @nr_bytes: number of bytes to complete
- *
-- * This function gets all the message replies.
-+ * Mark the request as complete. The lock must not be held when entering.
- *
- */
--static int i2o_block_reply(struct i2o_controller *c, u32 m,
-- struct i2o_message *msg)
-+static void i2o_block_end_request(struct request *req, int uptodate,
-+ int nr_bytes)
- {
-- struct i2o_block_request *ireq;
-- struct request *req;
-- struct i2o_block_device *dev;
-- struct request_queue *q;
-- u8 st;
-+ struct i2o_block_request *ireq = req->special;
-+ struct i2o_block_device *dev = ireq->i2o_blk_dev;
-+ request_queue_t *q = req->q;
- unsigned long flags;
-
-- /* FAILed message */
-- if (unlikely(readl(&msg->u.head[0]) & (1 << 13))) {
-- struct i2o_message *pmsg;
-- u32 pm;
--
-- printk(KERN_WARNING "FAIL");
-- /*
-- * FAILed message from controller
-- * We increment the error count and abort it
-- *
-- * In theory this will never happen. The I2O block class
-- * specification states that block devices never return
-- * FAILs but instead use the REQ status field...but
-- * better be on the safe side since no one really follows
-- * the spec to the book :)
-- */
-- pm = readl(&msg->body[3]);
-- pmsg = c->in_queue.virt + pm;
-+ if (end_that_request_chunk(req, uptodate, nr_bytes)) {
-+ int leftover = (req->hard_nr_sectors << KERNEL_SECTOR_SHIFT);
-
-- req = i2o_cntxt_list_get(c, readl(&pmsg->u.s.tcntxt));
-- if (unlikely(!req)) {
-- printk(KERN_ERR "block-osm: NULL reply received!\n");
-- return -1;
-- }
-+ if (blk_pc_request(req))
-+ leftover = req->data_len;
-
-- ireq = req->special;
-- dev = ireq->i2o_blk_dev;
-- q = dev->gd->queue;
-+ if (end_io_error(uptodate))
-+ end_that_request_chunk(req, 0, leftover);
-+ }
-
-- req->errors++;
-+ add_disk_randomness(req->rq_disk);
-
-- spin_lock_irqsave(q->queue_lock, flags);
-+ spin_lock_irqsave(q->queue_lock, flags);
-
-- while (end_that_request_chunk(req, !req->errors,
-- readl(&pmsg->body[1]))) ;
-- end_that_request_last(req);
-+ end_that_request_last(req);
-
-+ if (likely(dev)) {
- dev->open_queue_depth--;
- list_del(&ireq->queue);
-- blk_start_queue(q);
--
-- spin_unlock_irqrestore(q->queue_lock, flags);
--
-- /* Now flush the message by making it a NOP */
-- i2o_msg_nop(c, pm);
--
-- return -1;
- }
-
-- req = i2o_cntxt_list_get(c, readl(&msg->u.s.tcntxt));
-- if (unlikely(!req)) {
-- printk(KERN_ERR "block-osm: NULL reply received!\n");
-- return -1;
-- }
-+ blk_start_queue(q);
-
-- ireq = req->special;
-- dev = ireq->i2o_blk_dev;
-- q = dev->gd->queue;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-
-- if (unlikely(!dev->i2o_dev)) {
-- /*
-- * This is HACK, but Intel Integrated RAID allows user
-- * to delete a volume that is claimed, locked, and in use
-- * by the OS. We have to check for a reply from a
-- * non-existent device and flag it as an error or the system
-- * goes kaput...
-- */
-- req->errors++;
-- printk(KERN_WARNING
-- "I2O Block: Data transfer to deleted device!\n");
-- spin_lock_irqsave(q->queue_lock, flags);
-- while (end_that_request_chunk
-- (req, !req->errors, readl(&msg->body[1]))) ;
-- end_that_request_last(req);
-+ i2o_block_sglist_free(ireq);
-+ i2o_block_request_free(ireq);
-+};
-
-- dev->open_queue_depth--;
-- list_del(&ireq->queue);
-- blk_start_queue(q);
-+/**
-+ * i2o_block_reply - Block OSM reply handler.
-+ * @c: I2O controller from which the message arrives
-+ * @m: message id of reply
-+ * qmsg: the actuall I2O message reply
-+ *
-+ * This function gets all the message replies.
-+ *
-+ */
-+static int i2o_block_reply(struct i2o_controller *c, u32 m,
-+ struct i2o_message *msg)
-+{
-+ struct request *req;
-+ int uptodate = 1;
-
-- spin_unlock_irqrestore(q->queue_lock, flags);
-+ req = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt));
-+ if (unlikely(!req)) {
-+ osm_err("NULL reply received!\n");
- return -1;
- }
-
-@@ -503,29 +509,8 @@ static int i2o_block_reply(struct i2o_co
- * request in the context.
- */
-
-- st = readl(&msg->body[0]) >> 24;
--
-- if (st != 0) {
-- int err;
-- char *bsa_errors[] = {
-- "Success",
-- "Media Error",
-- "Failure communicating to device",
-- "Device Failure",
-- "Device is not ready",
-- "Media not present",
-- "Media is locked by another user",
-- "Media has failed",
-- "Failure communicating to device",
-- "Device bus failure",
-- "Device is locked by another user",
-- "Device is write protected",
-- "Device has reset",
-- "Volume has changed, waiting for acknowledgement"
-- };
--
-- err = readl(&msg->body[0]) & 0xffff;
--
-+ if ((le32_to_cpu(msg->body[0]) >> 24) != 0) {
-+ u32 status = le32_to_cpu(msg->body[0]);
- /*
- * Device not ready means two things. One is that the
- * the thing went offline (but not a removal media)
-@@ -538,209 +523,26 @@ static int i2o_block_reply(struct i2o_co
- * Don't stick a supertrak100 into cache aggressive modes
- */
-
-- printk(KERN_ERR "\n/dev/%s error: %s", dev->gd->disk_name,
-- bsa_errors[readl(&msg->body[0]) & 0xffff]);
-- if (readl(&msg->body[0]) & 0x00ff0000)
-- printk(" - DDM attempted %d retries",
-- (readl(&msg->body[0]) >> 16) & 0x00ff);
-- printk(".\n");
-- req->errors++;
-- } else
-- req->errors = 0;
--
-- if (!end_that_request_chunk(req, !req->errors, readl(&msg->body[1]))) {
-- add_disk_randomness(req->rq_disk);
-- spin_lock_irqsave(q->queue_lock, flags);
--
-- end_that_request_last(req);
-+ osm_err("TID %03x error status: 0x%02x, detailed status: "
-+ "0x%04x\n", (le32_to_cpu(msg->u.head[1]) >> 12 & 0xfff),
-+ status >> 24, status & 0xffff);
-
-- dev->open_queue_depth--;
-- list_del(&ireq->queue);
-- blk_start_queue(q);
-+ req->errors++;
-
-- spin_unlock_irqrestore(q->queue_lock, flags);
-+ uptodate = 0;
-+ }
-
-- i2o_block_sglist_free(ireq);
-- i2o_block_request_free(ireq);
-- } else
-- printk(KERN_ERR "still remaining chunks\n");
-+ i2o_block_end_request(req, uptodate, le32_to_cpu(msg->body[1]));
-
- return 1;
- };
-
- static void i2o_block_event(struct i2o_event *evt)
- {
-- printk(KERN_INFO "block-osm: event received\n");
-+ osm_debug("event received\n");
-+ kfree(evt);
- };
-
--#if 0
--static int i2o_block_event(void *dummy)
--{
-- unsigned int evt;
-- unsigned long flags;
-- struct i2o_block_device *dev;
-- int unit;
-- //The only event that has data is the SCSI_SMART event.
-- struct i2o_reply {
-- u32 header[4];
-- u32 evt_indicator;
-- u8 ASC;
-- u8 ASCQ;
-- u16 pad;
-- u8 data[16];
-- } *evt_local;
--
-- daemonize("i2oblock");
-- allow_signal(SIGKILL);
--
-- evt_running = 1;
--
-- while (1) {
-- if (down_interruptible(&i2ob_evt_sem)) {
-- evt_running = 0;
-- printk("exiting...");
-- break;
-- }
--
-- /*
-- * Keep another CPU/interrupt from overwriting the
-- * message while we're reading it
-- *
-- * We stuffed the unit in the TxContext and grab the event mask
-- * None of the BSA we care about events have EventData
-- */
-- spin_lock_irqsave(&i2ob_evt_lock, flags);
-- evt_local = (struct i2o_reply *)evt_msg;
-- spin_unlock_irqrestore(&i2ob_evt_lock, flags);
--
-- unit = le32_to_cpu(evt_local->header[3]);
-- evt = le32_to_cpu(evt_local->evt_indicator);
--
-- dev = &i2o_blk_dev[unit];
-- switch (evt) {
-- /*
-- * New volume loaded on same TID, so we just re-install.
-- * The TID/controller don't change as it is the same
-- * I2O device. It's just new media that we have to
-- * rescan.
-- */
-- case I2O_EVT_IND_BSA_VOLUME_LOAD:
-- {
-- i2ob_install_device(dev->i2o_device->iop,
-- dev->i2o_device, unit);
-- add_disk(dev->gendisk);
-- break;
-- }
--
-- /*
-- * No media, so set all parameters to 0 and set the media
-- * change flag. The I2O device is still valid, just doesn't
-- * have media, so we don't want to clear the controller or
-- * device pointer.
-- */
-- case I2O_EVT_IND_BSA_VOLUME_UNLOAD:
-- {
-- struct gendisk *p = dev->gendisk;
-- blk_queue_max_sectors(dev->gendisk->queue, 0);
-- del_gendisk(p);
-- put_disk(p);
-- dev->gendisk = NULL;
-- dev->media_change_flag = 1;
-- break;
-- }
--
-- case I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ:
-- printk(KERN_WARNING
-- "%s: Attempt to eject locked media\n",
-- dev->i2o_device->dev_name);
-- break;
--
-- /*
-- * The capacity has changed and we are going to be
-- * updating the max_sectors and other information
-- * about this disk. We try a revalidate first. If
-- * the block device is in use, we don't want to
-- * do that as there may be I/Os bound for the disk
-- * at the moment. In that case we read the size
-- * from the device and update the information ourselves
-- * and the user can later force a partition table
-- * update through an ioctl.
-- */
-- case I2O_EVT_IND_BSA_CAPACITY_CHANGE:
-- {
-- u64 size;
--
-- if (i2ob_query_device(dev, 0x0004, 0, &size, 8)
-- != 0)
-- i2ob_query_device(dev, 0x0000, 4, &size,
-- 8);
--
-- spin_lock_irqsave(dev->req_queue->queue_lock,
-- flags);
-- set_capacity(dev->gendisk, size >> 9);
-- spin_unlock_irqrestore(dev->req_queue->
-- queue_lock, flags);
-- break;
-- }
--
-- /*
-- * We got a SCSI SMART event, we just log the relevant
-- * information and let the user decide what they want
-- * to do with the information.
-- */
-- case I2O_EVT_IND_BSA_SCSI_SMART:
-- {
-- char buf[16];
-- printk(KERN_INFO
-- "I2O Block: %s received a SCSI SMART Event\n",
-- dev->i2o_device->dev_name);
-- evt_local->data[16] = '\0';
-- sprintf(buf, "%s", &evt_local->data[0]);
-- printk(KERN_INFO " Disk Serial#:%s\n",
-- buf);
-- printk(KERN_INFO " ASC 0x%02x \n",
-- evt_local->ASC);
-- printk(KERN_INFO " ASCQ 0x%02x \n",
-- evt_local->ASCQ);
-- break;
-- }
--
-- /*
-- * Non event
-- */
--
-- case 0:
-- break;
--
-- /*
-- * An event we didn't ask for. Call the card manufacturer
-- * and tell them to fix their firmware :)
-- */
--
-- case 0x20:
-- /*
-- * If a promise card reports 0x20 event then the brown stuff
-- * hit the fan big time. The card seems to recover but loses
-- * the pending writes. Deeply ungood except for testing fsck
-- */
-- if (dev->i2o_device->iop->promise)
-- panic
-- ("I2O controller firmware failed. Reboot and force a filesystem check.\n");
-- default:
-- printk(KERN_INFO
-- "%s: Received event 0x%X we didn't register for\n"
-- KERN_INFO
-- " Blame the I2O card manufacturer 8)\n",
-- dev->i2o_device->dev_name, evt);
-- break;
-- }
-- };
--
-- complete_and_exit(&i2ob_thread_dead, 0);
-- return 0;
--}
--#endif
--
- /*
- * SCSI-CAM for ioctl geometry mapping
- * Duplicated with SCSI - this should be moved into somewhere common
-@@ -816,7 +618,7 @@ static int i2o_block_open(struct inode *
-
- i2o_block_device_lock(dev->i2o_dev, -1);
-
-- pr_debug("Ready.\n");
-+ osm_debug("Ready.\n");
-
- return 0;
- };
-@@ -859,7 +661,14 @@ static int i2o_block_release(struct inod
-
- return 0;
- }
--
-+#if 0
-+static int i2o_block_getgeo(struct block_device *bdev, struct hd_geometry *geo)
-+{
-+ i2o_block_biosparam(get_capacity(bdev->bd_disk),
-+ &geo->cylinders, &geo->heads, &geo->sectors);
-+ return 0;
-+}
-+#endif
- /**
- * i2o_block_ioctl - Issue device specific ioctl calls.
- * @cmd: ioctl command
-@@ -885,8 +694,8 @@ static int i2o_block_ioctl(struct inode
- case HDIO_GETGEO:
- {
- struct hd_geometry g;
-- i2o_block_biosparam(get_capacity(disk),
-- &g.cylinders, &g.heads, &g.sectors);
-+ i2o_block_biosparam(get_capacity(disk), &g.cylinders,
-+ &g.heads, &g.sectors);
- g.start = get_start_sect(inode->i_bdev);
- return copy_to_user(argp, &g, sizeof(g)) ? -EFAULT : 0;
- }
-@@ -943,22 +752,28 @@ static int i2o_block_media_changed(struc
- static int i2o_block_transfer(struct request *req)
- {
- struct i2o_block_device *dev = req->rq_disk->private_data;
-- struct i2o_controller *c = dev->i2o_dev->iop;
-+ struct i2o_controller *c;
- int tid = dev->i2o_dev->lct_data.tid;
- struct i2o_message *msg;
-- void *mptr;
-+ u32 *mptr;
- struct i2o_block_request *ireq = req->special;
-- struct scatterlist *sg;
-- int sgnum;
-- int i;
-- u32 m;
- u32 tcntxt;
-- u32 sg_flags;
-+ u32 sgl_offset = SGL_OFFSET_8;
-+ u32 ctl_flags = 0x00000000;
- int rc;
-+ u32 cmd;
-+
-+ if (unlikely(!dev->i2o_dev)) {
-+ osm_err("transfer to removed drive\n");
-+ rc = -ENODEV;
-+ goto exit;
-+ }
-
-- m = i2o_msg_get(c, &msg);
-- if (m == I2O_QUEUE_EMPTY) {
-- rc = -EBUSY;
-+ c = dev->i2o_dev->iop;
-+
-+ msg = i2o_msg_get(c);
-+ if (IS_ERR(msg)) {
-+ rc = PTR_ERR(msg);
- goto exit;
- }
-
-@@ -968,95 +783,124 @@ static int i2o_block_transfer(struct req
- goto nop_msg;
- }
-
-- if ((sgnum = i2o_block_sglist_alloc(ireq)) <= 0) {
-- rc = -ENOMEM;
-- goto context_remove;
-- }
--
-- /* Build the message based on the request. */
-- writel(i2o_block_driver.context, &msg->u.s.icntxt);
-- writel(tcntxt, &msg->u.s.tcntxt);
-- writel(req->nr_sectors << 9, &msg->body[1]);
--
-- writel((((u64) req->sector) << 9) & 0xffffffff, &msg->body[2]);
-- writel(req->sector >> 23, &msg->body[3]);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_block_driver.context);
-+ msg->u.s.tcntxt = cpu_to_le32(tcntxt);
-
-- mptr = &msg->body[4];
--
-- sg = ireq->sg_table;
-+ mptr = &msg->body[0];
-
- if (rq_data_dir(req) == READ) {
-- writel(I2O_CMD_BLOCK_READ << 24 | HOST_TID << 12 | tid,
-- &msg->u.head[1]);
-- sg_flags = 0x10000000;
-+ cmd = I2O_CMD_BLOCK_READ << 24;
-+
- switch (dev->rcache) {
-- case CACHE_NULL:
-- writel(0, &msg->body[0]);
-- break;
- case CACHE_PREFETCH:
-- writel(0x201F0008, &msg->body[0]);
-+ ctl_flags = 0x201F0008;
- break;
-+
- case CACHE_SMARTFETCH:
- if (req->nr_sectors > 16)
-- writel(0x201F0008, &msg->body[0]);
-+ ctl_flags = 0x201F0008;
- else
-- writel(0x001F0000, &msg->body[0]);
-+ ctl_flags = 0x001F0000;
-+ break;
-+
-+ default:
- break;
- }
- } else {
-- writel(I2O_CMD_BLOCK_WRITE << 24 | HOST_TID << 12 | tid,
-- &msg->u.head[1]);
-- sg_flags = 0x14000000;
-+ cmd = I2O_CMD_BLOCK_WRITE << 24;
-+
- switch (dev->wcache) {
-- case CACHE_NULL:
-- writel(0, &msg->body[0]);
-- break;
- case CACHE_WRITETHROUGH:
-- writel(0x001F0008, &msg->body[0]);
-+ ctl_flags = 0x001F0008;
- break;
- case CACHE_WRITEBACK:
-- writel(0x001F0010, &msg->body[0]);
-+ ctl_flags = 0x001F0010;
- break;
- case CACHE_SMARTBACK:
- if (req->nr_sectors > 16)
-- writel(0x001F0004, &msg->body[0]);
-+ ctl_flags = 0x001F0004;
- else
-- writel(0x001F0010, &msg->body[0]);
-+ ctl_flags = 0x001F0010;
- break;
- case CACHE_SMARTTHROUGH:
- if (req->nr_sectors > 16)
-- writel(0x001F0004, &msg->body[0]);
-+ ctl_flags = 0x001F0004;
- else
-- writel(0x001F0010, &msg->body[0]);
-+ ctl_flags = 0x001F0010;
-+ default:
-+ break;
- }
- }
-
-- for (i = sgnum; i > 0; i--) {
-- if (i == 1)
-- sg_flags |= 0x80000000;
-- writel(sg_flags | sg_dma_len(sg), mptr);
-- writel(sg_dma_address(sg), mptr + 4);
-- mptr += 8;
-- sg++;
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
-+ if (c->adaptec) {
-+ u8 cmd[10];
-+ u32 scsi_flags;
-+ u16 hwsec = queue_hardsect_size(req->q) >> KERNEL_SECTOR_SHIFT;
-+
-+ memset(cmd, 0, 10);
-+
-+ sgl_offset = SGL_OFFSET_12;
-+
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_PRIVATE << 24 | HOST_TID << 12 | tid);
-+
-+ *mptr++ = cpu_to_le32(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC);
-+ *mptr++ = cpu_to_le32(tid);
-+
-+ /*
-+ * ENABLE_DISCONNECT
-+ * SIMPLE_TAG
-+ * RETURN_SENSE_DATA_IN_REPLY_MESSAGE_FRAME
-+ */
-+ if (rq_data_dir(req) == READ) {
-+ cmd[0] = READ_10;
-+ scsi_flags = 0x60a0000a;
-+ } else {
-+ cmd[0] = WRITE_10;
-+ scsi_flags = 0xa0a0000a;
-+ }
-+
-+ *mptr++ = cpu_to_le32(scsi_flags);
-+
-+ *((u32 *) & cmd[2]) = cpu_to_be32(req->sector * hwsec);
-+ *((u16 *) & cmd[7]) = cpu_to_be16(req->nr_sectors * hwsec);
-+
-+ memcpy(mptr, cmd, 10);
-+ mptr += 4;
-+ *mptr++ = cpu_to_le32(req->nr_sectors << KERNEL_SECTOR_SHIFT);
-+ } else
-+#endif
-+ {
-+ msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
-+ *mptr++ = cpu_to_le32(ctl_flags);
-+ *mptr++ = cpu_to_le32(req->nr_sectors << KERNEL_SECTOR_SHIFT);
-+ *mptr++ =
-+ cpu_to_le32((u32) (req->sector << KERNEL_SECTOR_SHIFT));
-+ *mptr++ =
-+ cpu_to_le32(req->sector >> (32 - KERNEL_SECTOR_SHIFT));
- }
-
-- writel(I2O_MESSAGE_SIZE
-- (((unsigned long)mptr -
-- (unsigned long)&msg->u.head[0]) >> 2) | SGL_OFFSET_8,
-- &msg->u.head[0]);
-+ if (!i2o_block_sglist_alloc(c, ireq, &mptr)) {
-+ rc = -ENOMEM;
-+ goto context_remove;
-+ }
-
-- i2o_msg_post(c, m);
-+ msg->u.head[0] =
-+ cpu_to_le32(I2O_MESSAGE_SIZE(mptr - &msg->u.head[0]) | sgl_offset);
-
- list_add_tail(&ireq->queue, &dev->open_queue);
- dev->open_queue_depth++;
-
-+ i2o_msg_post(c, msg);
-+
- return 0;
-
- context_remove:
- i2o_cntxt_list_remove(c, req);
-
- nop_msg:
-- i2o_msg_nop(c, m);
-+ i2o_msg_nop(c, msg);
-
- exit:
- return rc;
-@@ -1086,11 +930,13 @@ static void i2o_block_request_fn(struct
-
- queue_depth = ireq->i2o_blk_dev->open_queue_depth;
-
-- if (queue_depth < I2O_BLOCK_MAX_OPEN_REQUESTS)
-+ if (queue_depth < I2O_BLOCK_MAX_OPEN_REQUESTS) {
- if (!i2o_block_transfer(req)) {
- blkdev_dequeue_request(req);
- continue;
-- }
-+ } else
-+ osm_info("transfer error\n");
-+ }
-
- if (queue_depth)
- break;
-@@ -1104,7 +950,6 @@ static void i2o_block_request_fn(struct
- INIT_WORK(&dreq->work, i2o_block_delayed_request_fn,
- dreq);
-
-- printk(KERN_INFO "block-osm: transfer error\n");
- if (!queue_delayed_work(i2o_block_driver.event_queue,
- &dreq->work,
- I2O_BLOCK_RETRY_TIME))
-@@ -1124,6 +969,7 @@ static struct block_device_operations i2
- .open = i2o_block_open,
- .release = i2o_block_release,
- .ioctl = i2o_block_ioctl,
-+/* .getgeo = i2o_block_getgeo,*/
- .media_changed = i2o_block_media_changed
- };
-
-@@ -1143,14 +989,12 @@ static struct i2o_block_device *i2o_bloc
- struct request_queue *queue;
- int rc;
-
-- dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (!dev) {
-- printk(KERN_ERR "block-osm: Insufficient memory to allocate "
-- "I2O Block disk.\n");
-+ osm_err("Insufficient memory to allocate I2O Block disk.\n");
- rc = -ENOMEM;
- goto exit;
- }
-- memset(dev, 0, sizeof(*dev));
-
- INIT_LIST_HEAD(&dev->open_queue);
- spin_lock_init(&dev->lock);
-@@ -1160,8 +1004,7 @@ static struct i2o_block_device *i2o_bloc
- /* allocate a gendisk with 16 partitions */
- gd = alloc_disk(16);
- if (!gd) {
-- printk(KERN_ERR "block-osm: Insufficient memory to allocate "
-- "gendisk.\n");
-+ osm_err("Insufficient memory to allocate gendisk.\n");
- rc = -ENOMEM;
- goto cleanup_dev;
- }
-@@ -1169,13 +1012,13 @@ static struct i2o_block_device *i2o_bloc
- /* initialize the request queue */
- queue = blk_init_queue(i2o_block_request_fn, &dev->lock);
- if (!queue) {
-- printk(KERN_ERR "block-osm: Insufficient memory to allocate "
-- "request queue.\n");
-+ osm_err("Insufficient memory to allocate request queue.\n");
- rc = -ENOMEM;
- goto cleanup_queue;
- }
-
- blk_queue_prep_rq(queue, i2o_block_prep_req_fn);
-+ blk_queue_issue_flush_fn(queue, i2o_block_issue_flush);
-
- gd->major = I2O_MAJOR;
- gd->queue = queue;
-@@ -1208,38 +1051,43 @@ static struct i2o_block_device *i2o_bloc
- static int i2o_block_probe(struct device *dev)
- {
- struct i2o_device *i2o_dev = to_i2o_device(dev);
-- struct i2o_block_device *i2o_blk_dev;
- struct i2o_controller *c = i2o_dev->iop;
-+ struct i2o_block_device *i2o_blk_dev;
- struct gendisk *gd;
- struct request_queue *queue;
- static int unit = 0;
- int rc;
- u64 size;
- u32 blocksize;
-+ u16 body_size = 4;
- u16 power;
-- u32 flags, status;
-- int segments;
-+ unsigned short max_sectors;
-+
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
-+ if (c->adaptec)
-+ body_size = 8;
-+#endif
-+
-+ if (c->limit_sectors)
-+ max_sectors = I2O_MAX_SECTORS_LIMITED;
-+ else
-+ max_sectors = I2O_MAX_SECTORS;
-
- /* skip devices which are used by IOP */
- if (i2o_dev->lct_data.user_tid != 0xfff) {
-- pr_debug("skipping used device %03x\n", i2o_dev->lct_data.tid);
-+ osm_debug("skipping used device %03x\n", i2o_dev->lct_data.tid);
- return -ENODEV;
- }
-
-- printk(KERN_INFO "block-osm: New device detected (TID: %03x)\n",
-- i2o_dev->lct_data.tid);
--
- if (i2o_device_claim(i2o_dev)) {
-- printk(KERN_WARNING "block-osm: Unable to claim device. "
-- "Installation aborted\n");
-+ osm_warn("Unable to claim device. Installation aborted\n");
- rc = -EFAULT;
- goto exit;
- }
-
- i2o_blk_dev = i2o_block_device_alloc();
- if (IS_ERR(i2o_blk_dev)) {
-- printk(KERN_ERR "block-osm: could not alloc a new I2O block"
-- "device");
-+ osm_err("could not alloc a new I2O block device");
- rc = PTR_ERR(i2o_blk_dev);
- goto claim_release;
- }
-@@ -1258,43 +1106,32 @@ static int i2o_block_probe(struct device
- queue = gd->queue;
- queue->queuedata = i2o_blk_dev;
-
-- blk_queue_max_phys_segments(queue, I2O_MAX_SEGMENTS);
-- blk_queue_max_sectors(queue, I2O_MAX_SECTORS);
--
-- if (c->short_req)
-- segments = 8;
-- else {
-- i2o_status_block *sb;
--
-- sb = c->status_block.virt;
--
-- segments = (sb->inbound_frame_size -
-- sizeof(struct i2o_message) / 4 - 4) / 2;
-- }
--
-- blk_queue_max_hw_segments(queue, segments);
--
-- pr_debug("max sectors: %d\n", I2O_MAX_SECTORS);
-- pr_debug("phys segments: %d\n", I2O_MAX_SEGMENTS);
-- pr_debug("hw segments: %d\n", segments);
-+ blk_queue_max_phys_segments(queue, I2O_MAX_PHYS_SEGMENTS);
-+ blk_queue_max_sectors(queue, max_sectors);
-+ blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size));
-+
-+ osm_debug("max sectors = %d\n", queue->max_phys_segments);
-+ osm_debug("phys segments = %d\n", queue->max_sectors);
-+ osm_debug("max hw segments = %d\n", queue->max_hw_segments);
-
- /*
- * Ask for the current media data. If that isn't supported
- * then we ask for the device capacity data
- */
-- if (i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) != 0
-- || i2o_parm_field_get(i2o_dev, 0x0004, 0, &size, 8) != 0) {
-- i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4);
-- i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8);
-- }
-- pr_debug("blocksize: %d\n", blocksize);
--
-- if (i2o_parm_field_get(i2o_dev, 0x0000, 2, &power, 2))
-- power = 0;
-- i2o_parm_field_get(i2o_dev, 0x0000, 5, &flags, 4);
-- i2o_parm_field_get(i2o_dev, 0x0000, 6, &status, 4);
-+ if (!i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) ||
-+ !i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4)) {
-+ blk_queue_hardsect_size(queue, le32_to_cpu(blocksize));
-+ } else
-+ osm_warn("unable to get blocksize of %s\n", gd->disk_name);
-
-- set_capacity(gd, size >> 9);
-+ if (!i2o_parm_field_get(i2o_dev, 0x0004, 0, &size, 8) ||
-+ !i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8)) {
-+ set_capacity(gd, le64_to_cpu(size) >> KERNEL_SECTOR_SHIFT);
-+ } else
-+ osm_warn("could not get size of %s\n", gd->disk_name);
-+
-+ if (!i2o_parm_field_get(i2o_dev, 0x0000, 2, &power, 2))
-+ i2o_blk_dev->power = power;
-
- i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0xffffffff);
-
-@@ -1302,6 +1139,9 @@ static int i2o_block_probe(struct device
-
- unit++;
-
-+ osm_info("device added (TID: %03x): %s\n", i2o_dev->lct_data.tid,
-+ i2o_blk_dev->gd->disk_name);
-+
- return 0;
-
- claim_release:
-@@ -1313,7 +1153,7 @@ static int i2o_block_probe(struct device
-
- /* Block OSM driver struct */
- static struct i2o_driver i2o_block_driver = {
-- .name = "block-osm",
-+ .name = OSM_NAME,
- .event = i2o_block_event,
- .reply = i2o_block_reply,
- .classes = i2o_block_class_id,
-@@ -1336,8 +1176,7 @@ static int __init i2o_block_init(void)
- int rc;
- int size;
-
-- printk(KERN_INFO "I2O Block Storage OSM v0.9\n");
-- printk(KERN_INFO " (c) Copyright 1999-2001 Red Hat Software.\n");
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-
- /* Allocate request mempool and slab */
- size = sizeof(struct i2o_block_request);
-@@ -1345,17 +1184,16 @@ static int __init i2o_block_init(void)
- SLAB_HWCACHE_ALIGN, NULL,
- NULL);
- if (!i2o_blk_req_pool.slab) {
-- printk(KERN_ERR "block-osm: can't init request slab\n");
-+ osm_err("can't init request slab\n");
- rc = -ENOMEM;
- goto exit;
- }
-
-- i2o_blk_req_pool.pool = mempool_create(I2O_REQ_MEMPOOL_SIZE,
-- mempool_alloc_slab,
-- mempool_free_slab,
-- i2o_blk_req_pool.slab);
-+ i2o_blk_req_pool.pool =
-+ mempool_create(I2O_BLOCK_REQ_MEMPOOL_SIZE, mempool_alloc_slab,
-+ mempool_free_slab, i2o_blk_req_pool.slab);
- if (!i2o_blk_req_pool.pool) {
-- printk(KERN_ERR "block-osm: can't init request mempool\n");
-+ osm_err("can't init request mempool\n");
- rc = -ENOMEM;
- goto free_slab;
- }
-@@ -1363,18 +1201,17 @@ static int __init i2o_block_init(void)
- /* Register the block device interfaces */
- rc = register_blkdev(I2O_MAJOR, "i2o_block");
- if (rc) {
-- printk(KERN_ERR "block-osm: unable to register block device\n");
-+ osm_err("unable to register block device\n");
- goto free_mempool;
- }
- #ifdef MODULE
-- printk(KERN_INFO "block-osm: registered device at major %d\n",
-- I2O_MAJOR);
-+ osm_info("registered device at major %d\n", I2O_MAJOR);
- #endif
-
- /* Register Block OSM into I2O core */
- rc = i2o_driver_register(&i2o_block_driver);
- if (rc) {
-- printk(KERN_ERR "block-osm: Could not register Block driver\n");
-+ osm_err("Could not register Block driver\n");
- goto unregister_blkdev;
- }
-
-@@ -1413,8 +1250,9 @@ static void __exit i2o_block_exit(void)
- };
-
- MODULE_AUTHOR("Red Hat");
--MODULE_DESCRIPTION("I2O Block Device OSM");
- MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-
- module_init(i2o_block_init);
- module_exit(i2o_block_exit);
-diff -Nurap ./drivers/message/i2o.i2o/i2o_block.h ./drivers/message/i2o/i2o_block.h
---- ./drivers/message/i2o.i2o/i2o_block.h 2004-10-19 01:55:07.000000000 +0400
-+++ ./drivers/message/i2o/i2o_block.h 2006-09-08 15:10:02.000000000 +0400
-@@ -56,42 +56,46 @@
- #define I2O_BLOCK_RETRY_TIME HZ/4
- #define I2O_BLOCK_MAX_OPEN_REQUESTS 50
-
-+/* request queue sizes */
-+#define I2O_BLOCK_REQ_MEMPOOL_SIZE 32
-+
-+#define KERNEL_SECTOR_SHIFT 9
-+#define KERNEL_SECTOR_SIZE (1 << KERNEL_SECTOR_SHIFT)
-+
- /* I2O Block OSM mempool struct */
- struct i2o_block_mempool {
-- kmem_cache_t *slab;
-- mempool_t *pool;
-+ kmem_cache_t *slab;
-+ mempool_t *pool;
- };
-
- /* I2O Block device descriptor */
- struct i2o_block_device {
- struct i2o_device *i2o_dev; /* pointer to I2O device */
- struct gendisk *gd;
-- spinlock_t lock; /* queue lock */
-+ spinlock_t lock; /* queue lock */
- struct list_head open_queue; /* list of transfered, but unfinished
- requests */
- unsigned int open_queue_depth; /* number of requests in the queue */
-
-- int rcache; /* read cache flags */
-- int wcache; /* write cache flags */
-+ int rcache; /* read cache flags */
-+ int wcache; /* write cache flags */
- int flags;
-- int power; /* power state */
-- int media_change_flag; /* media changed flag */
-+ u16 power; /* power state */
-+ int media_change_flag; /* media changed flag */
- };
-
- /* I2O Block device request */
--struct i2o_block_request
--{
-+struct i2o_block_request {
- struct list_head queue;
-- struct request *req; /* corresponding request */
-+ struct request *req; /* corresponding request */
- struct i2o_block_device *i2o_blk_dev; /* I2O block device */
-- int sg_dma_direction; /* direction of DMA buffer read/write */
-- int sg_nents; /* number of SG elements */
-- struct scatterlist sg_table[I2O_MAX_SEGMENTS]; /* SG table */
-+ struct device *dev; /* device used for DMA */
-+ int sg_nents; /* number of SG elements */
-+ struct scatterlist sg_table[I2O_MAX_PHYS_SEGMENTS]; /* SG table */
- };
-
- /* I2O Block device delayed request */
--struct i2o_block_delayed_request
--{
-+struct i2o_block_delayed_request {
- struct work_struct work;
- struct request_queue *queue;
- };
-diff -Nurap ./drivers/message/i2o.i2o/i2o_config.c ./drivers/message/i2o/i2o_config.c
---- ./drivers/message/i2o.i2o/i2o_config.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/message/i2o/i2o_config.c 2006-09-08 15:10:02.000000000 +0400
-@@ -30,28 +30,20 @@
- * 2 of the License, or (at your option) any later version.
- */
-
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/pci.h>
--#include <linux/i2o.h>
--#include <linux/errno.h>
--#include <linux/init.h>
--#include <linux/slab.h>
- #include <linux/miscdevice.h>
--#include <linux/mm.h>
--#include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <linux/ioctl32.h>
- #include <linux/compat.h>
--#include <linux/syscalls.h>
-
- #include <asm/uaccess.h>
--#include <asm/io.h>
-+
-+#define SG_TABLESIZE 30
-
- extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
-
--static spinlock_t i2o_config_lock = SPIN_LOCK_UNLOCKED;
--struct wait_queue *i2o_wait_queue;
-+static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int,
-+ unsigned long);
-+
-+static spinlock_t i2o_config_lock;
-
- #define MODINC(x,y) ((x) = ((x) + 1) % (y))
-
-@@ -74,122 +66,22 @@ struct i2o_cfg_info {
- static struct i2o_cfg_info *open_files = NULL;
- static ulong i2o_cfg_info_id = 0;
-
--#if 0
--/*
-- * This is the callback for any message we have posted. The message itself
-- * will be returned to the message pool when we return from the IRQ
-- *
-- * This runs in irq context so be short and sweet.
-- */
--static void i2o_cfg_reply(struct i2o_handler *h, struct i2o_controller *c,
-- struct i2o_message *m)
--{
-- u32 *msg = (u32 *) m;
--
-- if (msg[0] & MSG_FAIL) {
-- u32 *preserved_msg = (u32 *) (c->msg_virt + msg[7]);
--
-- printk(KERN_ERR "i2o_config: IOP failed to process the msg.\n");
--
-- /* Release the preserved msg frame by resubmitting it as a NOP */
--
-- preserved_msg[0] = THREE_WORD_MSG_SIZE | SGL_OFFSET_0;
-- preserved_msg[1] = I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0;
-- preserved_msg[2] = 0;
-- i2o_post_message(c, msg[7]);
-- }
--
-- if (msg[4] >> 24) // ReqStatus != SUCCESS
-- i2o_report_status(KERN_INFO, "i2o_config", msg);
--
-- if (m->function == I2O_CMD_UTIL_EVT_REGISTER) {
-- struct i2o_cfg_info *inf;
--
-- for (inf = open_files; inf; inf = inf->next)
-- if (inf->q_id == i2o_cntxt_list_get(c, msg[3]))
-- break;
--
-- //
-- // If this is the case, it means that we're getting
-- // events for a file descriptor that's been close()'d
-- // w/o the user unregistering for events first.
-- // The code currently assumes that the user will
-- // take care of unregistering for events before closing
-- // a file.
-- //
-- // TODO:
-- // Should we track event registartion and deregister
-- // for events when a file is close()'d so this doesn't
-- // happen? That would get rid of the search through
-- // the linked list since file->private_data could point
-- // directly to the i2o_config_info data structure...but
-- // it would mean having all sorts of tables to track
-- // what each file is registered for...I think the
-- // current method is simpler. - DS
-- //
-- if (!inf)
-- return;
--
-- inf->event_q[inf->q_in].id.iop = c->unit;
-- inf->event_q[inf->q_in].id.tid = m->target_tid;
-- inf->event_q[inf->q_in].id.evt_mask = msg[4];
--
-- //
-- // Data size = msg size - reply header
-- //
-- inf->event_q[inf->q_in].data_size = (m->size - 5) * 4;
-- if (inf->event_q[inf->q_in].data_size)
-- memcpy(inf->event_q[inf->q_in].evt_data,
-- (unsigned char *)(msg + 5),
-- inf->event_q[inf->q_in].data_size);
--
-- spin_lock(&i2o_config_lock);
-- MODINC(inf->q_in, I2O_EVT_Q_LEN);
-- if (inf->q_len == I2O_EVT_Q_LEN) {
-- MODINC(inf->q_out, I2O_EVT_Q_LEN);
-- inf->q_lost++;
-- } else {
-- // Keep I2OEVTGET on another CPU from touching this
-- inf->q_len++;
-- }
-- spin_unlock(&i2o_config_lock);
--
--// printk(KERN_INFO "File %p w/id %d has %d events\n",
--// inf->fp, inf->q_id, inf->q_len);
--
-- kill_fasync(&inf->fasync, SIGIO, POLL_IN);
-- }
--
-- return;
--}
--#endif
--
--/*
-- * Each of these describes an i2o message handler. They are
-- * multiplexed by the i2o_core code
-- */
--
--struct i2o_driver i2o_config_driver = {
-- .name = "Config-OSM"
--};
--
- static int i2o_cfg_getiops(unsigned long arg)
- {
- struct i2o_controller *c;
- u8 __user *user_iop_table = (void __user *)arg;
- u8 tmp[MAX_I2O_CONTROLLERS];
-+ int ret = 0;
-
- memset(tmp, 0, MAX_I2O_CONTROLLERS);
-
-- if (!access_ok(VERIFY_WRITE, user_iop_table, MAX_I2O_CONTROLLERS))
-- return -EFAULT;
--
- list_for_each_entry(c, &i2o_controllers, list)
- tmp[c->unit] = 1;
-
-- __copy_to_user(user_iop_table, tmp, MAX_I2O_CONTROLLERS);
-+ if (copy_to_user(user_iop_table, tmp, MAX_I2O_CONTROLLERS))
-+ ret = -EFAULT;
-
-- return 0;
-+ return ret;
- };
-
- static int i2o_cfg_gethrt(unsigned long arg)
-@@ -339,7 +231,6 @@ static int i2o_cfg_swdl(unsigned long ar
- unsigned char maxfrag = 0, curfrag = 1;
- struct i2o_dma buffer;
- struct i2o_message *msg;
-- u32 m;
- unsigned int status = 0, swlen = 0, fragsize = 8192;
- struct i2o_controller *c;
-
-@@ -365,31 +256,34 @@ static int i2o_cfg_swdl(unsigned long ar
- if (!c)
- return -ENXIO;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -EBUSY;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-
- if (i2o_dma_alloc(&c->pdev->dev, &buffer, fragsize, GFP_KERNEL)) {
-- i2o_msg_nop(c, m);
-+ i2o_msg_nop(c, msg);
- return -ENOMEM;
- }
-
- __copy_from_user(buffer.virt, kxfer.buf, fragsize);
-
-- writel(NINE_WORD_MSG_SIZE | SGL_OFFSET_7, &msg->u.head[0]);
-- writel(I2O_CMD_SW_DOWNLOAD << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_config_driver.context, &msg->u.head[2]);
-- writel(0, &msg->u.head[3]);
-- writel((((u32) kxfer.flags) << 24) | (((u32) kxfer.sw_type) << 16) |
-- (((u32) maxfrag) << 8) | (((u32) curfrag)), &msg->body[0]);
-- writel(swlen, &msg->body[1]);
-- writel(kxfer.sw_id, &msg->body[2]);
-- writel(0xD0000000 | fragsize, &msg->body[3]);
-- writel(buffer.phys, &msg->body[4]);
-+ msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_7);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SW_DOWNLOAD << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->u.head[2] = cpu_to_le32(i2o_config_driver.context);
-+ msg->u.head[3] = cpu_to_le32(0);
-+ msg->body[0] =
-+ cpu_to_le32((((u32) kxfer.flags) << 24) | (((u32) kxfer.
-+ sw_type) << 16) |
-+ (((u32) maxfrag) << 8) | (((u32) curfrag)));
-+ msg->body[1] = cpu_to_le32(swlen);
-+ msg->body[2] = cpu_to_le32(kxfer.sw_id);
-+ msg->body[3] = cpu_to_le32(0xD0000000 | fragsize);
-+ msg->body[4] = cpu_to_le32(buffer.phys);
-
--// printk("i2o_config: swdl frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
-- status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
-+ osm_debug("swdl frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
-+ status = i2o_msg_post_wait_mem(c, msg, 60, &buffer);
-
- if (status != -ETIMEDOUT)
- i2o_dma_free(&c->pdev->dev, &buffer);
-@@ -397,9 +291,7 @@ static int i2o_cfg_swdl(unsigned long ar
- if (status != I2O_POST_WAIT_OK) {
- // it fails if you try and send frags out of order
- // and for some yet unknown reasons too
-- printk(KERN_INFO
-- "i2o_config: swdl failed, DetailedStatus = %d\n",
-- status);
-+ osm_info("swdl failed, DetailedStatus = %d\n", status);
- return status;
- }
-
-@@ -413,71 +305,75 @@ static int i2o_cfg_swul(unsigned long ar
- unsigned char maxfrag = 0, curfrag = 1;
- struct i2o_dma buffer;
- struct i2o_message *msg;
-- u32 m;
- unsigned int status = 0, swlen = 0, fragsize = 8192;
- struct i2o_controller *c;
-+ int ret = 0;
-
- if (copy_from_user(&kxfer, pxfer, sizeof(struct i2o_sw_xfer)))
-- return -EFAULT;
-+ goto return_fault;
-
- if (get_user(swlen, kxfer.swlen) < 0)
-- return -EFAULT;
-+ goto return_fault;
-
- if (get_user(maxfrag, kxfer.maxfrag) < 0)
-- return -EFAULT;
-+ goto return_fault;
-
- if (get_user(curfrag, kxfer.curfrag) < 0)
-- return -EFAULT;
-+ goto return_fault;
-
- if (curfrag == maxfrag)
- fragsize = swlen - (maxfrag - 1) * 8192;
-
-- if (!kxfer.buf || !access_ok(VERIFY_WRITE, kxfer.buf, fragsize))
-- return -EFAULT;
-+ if (!kxfer.buf)
-+ goto return_fault;
-
- c = i2o_find_iop(kxfer.iop);
- if (!c)
- return -ENXIO;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -EBUSY;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-
- if (i2o_dma_alloc(&c->pdev->dev, &buffer, fragsize, GFP_KERNEL)) {
-- i2o_msg_nop(c, m);
-+ i2o_msg_nop(c, msg);
- return -ENOMEM;
- }
-
-- writel(NINE_WORD_MSG_SIZE | SGL_OFFSET_7, &msg->u.head[0]);
-- writel(I2O_CMD_SW_UPLOAD << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_config_driver.context, &msg->u.head[2]);
-- writel(0, &msg->u.head[3]);
-- writel((u32) kxfer.flags << 24 | (u32) kxfer.
-- sw_type << 16 | (u32) maxfrag << 8 | (u32) curfrag,
-- &msg->body[0]);
-- writel(swlen, &msg->body[1]);
-- writel(kxfer.sw_id, &msg->body[2]);
-- writel(0xD0000000 | fragsize, &msg->body[3]);
-- writel(buffer.phys, &msg->body[4]);
-+ msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_7);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SW_UPLOAD << 24 | HOST_TID << 12 | ADAPTER_TID);
-+ msg->u.head[2] = cpu_to_le32(i2o_config_driver.context);
-+ msg->u.head[3] = cpu_to_le32(0);
-+ msg->body[0] =
-+ cpu_to_le32((u32) kxfer.flags << 24 | (u32) kxfer.
-+ sw_type << 16 | (u32) maxfrag << 8 | (u32) curfrag);
-+ msg->body[1] = cpu_to_le32(swlen);
-+ msg->body[2] = cpu_to_le32(kxfer.sw_id);
-+ msg->body[3] = cpu_to_le32(0xD0000000 | fragsize);
-+ msg->body[4] = cpu_to_le32(buffer.phys);
-
--// printk("i2o_config: swul frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
-- status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
-+ osm_debug("swul frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
-+ status = i2o_msg_post_wait_mem(c, msg, 60, &buffer);
-
- if (status != I2O_POST_WAIT_OK) {
- if (status != -ETIMEDOUT)
- i2o_dma_free(&c->pdev->dev, &buffer);
-
-- printk(KERN_INFO
-- "i2o_config: swul failed, DetailedStatus = %d\n",
-- status);
-+ osm_info("swul failed, DetailedStatus = %d\n", status);
- return status;
- }
-
-- __copy_to_user(kxfer.buf, buffer.virt, fragsize);
-+ if (copy_to_user(kxfer.buf, buffer.virt, fragsize))
-+ ret = -EFAULT;
-+
- i2o_dma_free(&c->pdev->dev, &buffer);
-
-- return 0;
-+ return_ret:
-+ return ret;
-+ return_fault:
-+ ret = -EFAULT;
-+ goto return_ret;
- };
-
- static int i2o_cfg_swdel(unsigned long arg)
-@@ -486,7 +382,6 @@ static int i2o_cfg_swdel(unsigned long a
- struct i2o_sw_xfer kxfer;
- struct i2o_sw_xfer __user *pxfer = (struct i2o_sw_xfer __user *)arg;
- struct i2o_message *msg;
-- u32 m;
- unsigned int swlen;
- int token;
-
-@@ -500,26 +395,24 @@ static int i2o_cfg_swdel(unsigned long a
- if (!c)
- return -ENXIO;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -EBUSY;
--
-- writel(SEVEN_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_SW_REMOVE << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_config_driver.context, &msg->u.head[2]);
-- writel(0, &msg->u.head[3]);
-- writel((u32) kxfer.flags << 24 | (u32) kxfer.sw_type << 16,
-- &msg->body[0]);
-- writel(swlen, &msg->body[1]);
-- writel(kxfer.sw_id, &msg->body[2]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(SEVEN_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SW_REMOVE << 24 | HOST_TID << 12 | ADAPTER_TID);
-+ msg->u.head[2] = cpu_to_le32(i2o_config_driver.context);
-+ msg->u.head[3] = cpu_to_le32(0);
-+ msg->body[0] =
-+ cpu_to_le32((u32) kxfer.flags << 24 | (u32) kxfer.sw_type << 16);
-+ msg->body[1] = cpu_to_le32(swlen);
-+ msg->body[2] = cpu_to_le32(kxfer.sw_id);
-
-- token = i2o_msg_post_wait(c, m, 10);
-+ token = i2o_msg_post_wait(c, msg, 10);
-
- if (token != I2O_POST_WAIT_OK) {
-- printk(KERN_INFO
-- "i2o_config: swdel failed, DetailedStatus = %d\n",
-- token);
-+ osm_info("swdel failed, DetailedStatus = %d\n", token);
- return -ETIMEDOUT;
- }
-
-@@ -531,28 +424,27 @@ static int i2o_cfg_validate(unsigned lon
- int token;
- int iop = (int)arg;
- struct i2o_message *msg;
-- u32 m;
- struct i2o_controller *c;
-
- c = i2o_find_iop(iop);
- if (!c)
- return -ENXIO;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -EBUSY;
--
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_CONFIG_VALIDATE << 24 | HOST_TID << 12 | iop,
-- &msg->u.head[1]);
-- writel(i2o_config_driver.context, &msg->u.head[2]);
-- writel(0, &msg->u.head[3]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_CONFIG_VALIDATE << 24 | HOST_TID << 12 | iop);
-+ msg->u.head[2] = cpu_to_le32(i2o_config_driver.context);
-+ msg->u.head[3] = cpu_to_le32(0);
-
-- token = i2o_msg_post_wait(c, m, 10);
-+ token = i2o_msg_post_wait(c, msg, 10);
-
- if (token != I2O_POST_WAIT_OK) {
-- printk(KERN_INFO "Can't validate configuration, ErrorStatus = "
-- "%d\n", token);
-+ osm_info("Can't validate configuration, ErrorStatus = %d\n",
-+ token);
- return -ETIMEDOUT;
- }
-
-@@ -562,7 +454,6 @@ static int i2o_cfg_validate(unsigned lon
- static int i2o_cfg_evt_reg(unsigned long arg, struct file *fp)
- {
- struct i2o_message *msg;
-- u32 m;
- struct i2o_evt_id __user *pdesc = (struct i2o_evt_id __user *)arg;
- struct i2o_evt_id kdesc;
- struct i2o_controller *c;
-@@ -581,18 +472,19 @@ static int i2o_cfg_evt_reg(unsigned long
- if (!d)
- return -ENODEV;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -EBUSY;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_UTIL_EVT_REGISTER << 24 | HOST_TID << 12 |
-+ kdesc.tid);
-+ msg->u.head[2] = cpu_to_le32(i2o_config_driver.context);
-+ msg->u.head[3] = cpu_to_le32(i2o_cntxt_list_add(c, fp->private_data));
-+ msg->body[0] = cpu_to_le32(kdesc.evt_mask);
-
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_UTIL_EVT_REGISTER << 24 | HOST_TID << 12 | kdesc.tid,
-- &msg->u.head[1]);
-- writel(i2o_config_driver.context, &msg->u.head[2]);
-- writel(i2o_cntxt_list_add(c, fp->private_data), &msg->u.head[3]);
-- writel(kdesc.evt_mask, &msg->body[0]);
--
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-
- return 0;
- }
-@@ -624,9 +516,10 @@ static int i2o_cfg_evt_get(unsigned long
- return 0;
- }
-
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
- #ifdef CONFIG_COMPAT
--static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
-- struct file *file)
-+static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
-+ unsigned long arg)
- {
- struct i2o_cmd_passthru32 __user *cmd;
- struct i2o_controller *c;
-@@ -643,7 +536,6 @@ static int i2o_cfg_passthru32(unsigned f
- u32 sg_index = 0;
- i2o_status_block *sb;
- struct i2o_message *msg;
-- u32 m;
- unsigned int iop;
-
- cmd = (struct i2o_cmd_passthru32 __user *)arg;
-@@ -655,22 +547,22 @@ static int i2o_cfg_passthru32(unsigned f
-
- c = i2o_find_iop(iop);
- if (!c) {
-- pr_debug("controller %d not found\n", iop);
-+ osm_debug("controller %d not found\n", iop);
- return -ENXIO;
- }
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-
- sb = c->status_block.virt;
-
- if (get_user(size, &user_msg[0])) {
-- printk(KERN_WARNING "unable to get size!\n");
-+ osm_warn("unable to get size!\n");
- return -EFAULT;
- }
- size = size >> 16;
-
- if (size > sb->inbound_frame_size) {
-- pr_debug("size of message > inbound_frame_size");
-+ osm_warn("size of message > inbound_frame_size");
- return -EFAULT;
- }
-
-@@ -680,7 +572,7 @@ static int i2o_cfg_passthru32(unsigned f
-
- /* Copy in the user's I2O command */
- if (copy_from_user(msg, user_msg, size)) {
-- printk(KERN_WARNING "unable to copy user message\n");
-+ osm_warn("unable to copy user message\n");
- return -EFAULT;
- }
- i2o_dump_message(msg);
-@@ -691,13 +583,12 @@ static int i2o_cfg_passthru32(unsigned f
- reply_size >>= 16;
- reply_size <<= 2;
-
-- reply = kmalloc(reply_size, GFP_KERNEL);
-+ reply = kzalloc(reply_size, GFP_KERNEL);
- if (!reply) {
- printk(KERN_WARNING "%s: Could not allocate reply buffer\n",
- c->name);
- return -ENOMEM;
- }
-- memset(reply, 0, reply_size);
-
- sg_offset = (msg->u.head[0] >> 4) & 0x0f;
-
-@@ -751,8 +642,9 @@ static int i2o_cfg_passthru32(unsigned f
- flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
- // TODO 64bit fix
- if (copy_from_user
-- (p->virt, (void __user *)(unsigned long)sg[i].addr_bus,
-- sg_size)) {
-+ (p->virt,
-+ (void __user *)(unsigned long)sg[i].
-+ addr_bus, sg_size)) {
- printk(KERN_DEBUG
- "%s: Could not copy SG buf %d FROM user\n",
- c->name, i);
-@@ -765,14 +657,14 @@ static int i2o_cfg_passthru32(unsigned f
- }
- }
-
-- rcode = i2o_msg_post_wait(c, m, 60);
-+ rcode = i2o_msg_post_wait(c, msg, 60);
- if (rcode) {
- reply[4] = ((u32) rcode) << 24;
- goto sg_list_cleanup;
- }
-
- if (sg_offset) {
-- u32 msg[MSG_FRAME_SIZE];
-+ u32 msg[I2O_OUTBOUND_MSG_FRAME_SIZE];
- /* Copy back the Scatter Gather buffers back to user space */
- u32 j;
- // TODO 64bit fix
-@@ -780,7 +672,7 @@ static int i2o_cfg_passthru32(unsigned f
- int sg_size;
-
- // re-acquire the original message to handle correctly the sg copy operation
-- memset(&msg, 0, MSG_FRAME_SIZE * 4);
-+ memset(&msg, 0, I2O_OUTBOUND_MSG_FRAME_SIZE * 4);
- // get user msg size in u32s
- if (get_user(size, &user_msg[0])) {
- rcode = -EFAULT;
-@@ -845,7 +737,27 @@ static int i2o_cfg_passthru32(unsigned f
- return rcode;
- }
-
--#else
-+static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
-+ unsigned long arg)
-+{
-+ int ret;
-+ lock_kernel();
-+ switch (cmd) {
-+ case I2OGETIOPS:
-+ ret = i2o_cfg_ioctl(NULL, file, cmd, arg);
-+ break;
-+ case I2OPASSTHRU32:
-+ ret = i2o_cfg_passthru32(file, cmd, arg);
-+ break;
-+ default:
-+ ret = -ENOIOCTLCMD;
-+ break;
-+ }
-+ unlock_kernel();
-+ return ret;
-+}
-+
-+#endif
-
- static int i2o_cfg_passthru(unsigned long arg)
- {
-@@ -866,7 +778,6 @@ static int i2o_cfg_passthru(unsigned lon
- void *p = NULL;
- i2o_status_block *sb;
- struct i2o_message *msg;
-- u32 m;
- unsigned int iop;
-
- if (get_user(iop, &cmd->iop) || get_user(user_msg, &cmd->msg))
-@@ -874,11 +785,11 @@ static int i2o_cfg_passthru(unsigned lon
-
- c = i2o_find_iop(iop);
- if (!c) {
-- pr_debug("controller %d not found\n", iop);
-+ osm_warn("controller %d not found\n", iop);
- return -ENXIO;
- }
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-
- sb = c->status_block.virt;
-
-@@ -887,7 +798,7 @@ static int i2o_cfg_passthru(unsigned lon
- size = size >> 16;
-
- if (size > sb->inbound_frame_size) {
-- pr_debug("size of message > inbound_frame_size");
-+ osm_warn("size of message > inbound_frame_size");
- return -EFAULT;
- }
-
-@@ -905,13 +816,12 @@ static int i2o_cfg_passthru(unsigned lon
- reply_size >>= 16;
- reply_size <<= 2;
-
-- reply = kmalloc(reply_size, GFP_KERNEL);
-+ reply = kzalloc(reply_size, GFP_KERNEL);
- if (!reply) {
- printk(KERN_WARNING "%s: Could not allocate reply buffer\n",
- c->name);
- return -ENOMEM;
- }
-- memset(reply, 0, reply_size);
-
- sg_offset = (msg->u.head[0] >> 4) & 0x0f;
-
-@@ -976,7 +886,7 @@ static int i2o_cfg_passthru(unsigned lon
- }
- }
-
-- rcode = i2o_msg_post_wait(c, m, 60);
-+ rcode = i2o_msg_post_wait(c, msg, 60);
- if (rcode) {
- reply[4] = ((u32) rcode) << 24;
- goto sg_list_cleanup;
-@@ -991,7 +901,7 @@ static int i2o_cfg_passthru(unsigned lon
- int sg_size;
-
- // re-acquire the original message to handle correctly the sg copy operation
-- memset(&msg, 0, MSG_FRAME_SIZE * 4);
-+ memset(&msg, 0, I2O_OUTBOUND_MSG_FRAME_SIZE * 4);
- // get user msg size in u32s
- if (get_user(size, &user_msg[0])) {
- rcode = -EFAULT;
-@@ -1109,14 +1019,14 @@ static int i2o_cfg_ioctl(struct inode *i
- ret = i2o_cfg_evt_get(arg, fp);
- break;
-
--#ifndef CONFIG_COMPAT
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
- case I2OPASSTHRU:
- ret = i2o_cfg_passthru(arg);
- break;
- #endif
-
- default:
-- pr_debug("i2o_config: unknown ioctl called!\n");
-+ osm_debug("unknown ioctl called!\n");
- ret = -EINVAL;
- }
-
-@@ -1201,6 +1111,9 @@ static struct file_operations config_fop
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .ioctl = i2o_cfg_ioctl,
-+#if 0
-+ .compat_ioctl = i2o_cfg_compat_ioctl,
-+#endif
- .open = cfg_open,
- .release = cfg_release,
- .fasync = cfg_fasync,
-@@ -1212,43 +1125,21 @@ static struct miscdevice i2o_miscdev = {
- &config_fops
- };
-
--static int __init i2o_config_init(void)
-+static int __init i2o_config_old_init(void)
- {
-- printk(KERN_INFO "I2O configuration manager v 0.04.\n");
-- printk(KERN_INFO " (C) Copyright 1999 Red Hat Software\n");
-+ spin_lock_init(&i2o_config_lock);
-
- if (misc_register(&i2o_miscdev) < 0) {
-- printk(KERN_ERR "i2o_config: can't register device.\n");
-- return -EBUSY;
-- }
-- /*
-- * Install our handler
-- */
-- if (i2o_driver_register(&i2o_config_driver)) {
-- printk(KERN_ERR "i2o_config: handler register failed.\n");
-- misc_deregister(&i2o_miscdev);
-+ osm_err("can't register device.\n");
- return -EBUSY;
- }
--#ifdef CONFIG_COMPAT
-- register_ioctl32_conversion(I2OPASSTHRU32, i2o_cfg_passthru32);
-- register_ioctl32_conversion(I2OGETIOPS, (void *)sys_ioctl);
--#endif
-+
- return 0;
- }
-
--static void i2o_config_exit(void)
-+static void i2o_config_old_exit(void)
- {
--#ifdef CONFIG_COMPAT
-- unregister_ioctl32_conversion(I2OPASSTHRU32);
-- unregister_ioctl32_conversion(I2OGETIOPS);
--#endif
- misc_deregister(&i2o_miscdev);
-- i2o_driver_unregister(&i2o_config_driver);
- }
-
- MODULE_AUTHOR("Red Hat Software");
--MODULE_DESCRIPTION("I2O Configuration");
--MODULE_LICENSE("GPL");
--
--module_init(i2o_config_init);
--module_exit(i2o_config_exit);
-diff -Nurap ./drivers/message/i2o.i2o/i2o_lan.h ./drivers/message/i2o/i2o_lan.h
---- ./drivers/message/i2o.i2o/i2o_lan.h 2004-10-19 01:55:27.000000000 +0400
-+++ ./drivers/message/i2o/i2o_lan.h 2006-09-08 15:10:02.000000000 +0400
-@@ -103,14 +103,14 @@
- #define I2O_LAN_DSC_SUSPENDED 0x11
-
- struct i2o_packet_info {
-- u32 offset : 24;
-- u32 flags : 8;
-- u32 len : 24;
-- u32 status : 8;
-+ u32 offset:24;
-+ u32 flags:8;
-+ u32 len:24;
-+ u32 status:8;
- };
-
- struct i2o_bucket_descriptor {
-- u32 context; /* FIXME: 64bit support */
-+ u32 context; /* FIXME: 64bit support */
- struct i2o_packet_info packet_info[1];
- };
-
-@@ -127,14 +127,14 @@ struct i2o_lan_local {
- u8 unit;
- struct i2o_device *i2o_dev;
-
-- struct fddi_statistics stats; /* see also struct net_device_stats */
-- unsigned short (*type_trans)(struct sk_buff *, struct net_device *);
-- atomic_t buckets_out; /* nbr of unused buckets on DDM */
-- atomic_t tx_out; /* outstanding TXes */
-- u8 tx_count; /* packets in one TX message frame */
-- u16 tx_max_out; /* DDM's Tx queue len */
-- u8 sgl_max; /* max SGLs in one message frame */
-- u32 m; /* IOP address of the batch msg frame */
-+ struct fddi_statistics stats; /* see also struct net_device_stats */
-+ unsigned short (*type_trans) (struct sk_buff *, struct net_device *);
-+ atomic_t buckets_out; /* nbr of unused buckets on DDM */
-+ atomic_t tx_out; /* outstanding TXes */
-+ u8 tx_count; /* packets in one TX message frame */
-+ u16 tx_max_out; /* DDM's Tx queue len */
-+ u8 sgl_max; /* max SGLs in one message frame */
-+ u32 m; /* IOP address of the batch msg frame */
-
- struct work_struct i2o_batch_send_task;
- int send_active;
-@@ -144,16 +144,16 @@ struct i2o_lan_local {
-
- spinlock_t tx_lock;
-
-- u32 max_size_mc_table; /* max number of multicast addresses */
-+ u32 max_size_mc_table; /* max number of multicast addresses */
-
- /* LAN OSM configurable parameters are here: */
-
-- u16 max_buckets_out; /* max nbr of buckets to send to DDM */
-- u16 bucket_thresh; /* send more when this many used */
-+ u16 max_buckets_out; /* max nbr of buckets to send to DDM */
-+ u16 bucket_thresh; /* send more when this many used */
- u16 rx_copybreak;
-
-- u8 tx_batch_mode; /* Set when using batch mode sends */
-- u32 i2o_event_mask; /* To turn on interesting event flags */
-+ u8 tx_batch_mode; /* Set when using batch mode sends */
-+ u32 i2o_event_mask; /* To turn on interesting event flags */
- };
-
--#endif /* _I2O_LAN_H */
-+#endif /* _I2O_LAN_H */
-diff -Nurap ./drivers/message/i2o.i2o/i2o_proc.c ./drivers/message/i2o/i2o_proc.c
---- ./drivers/message/i2o.i2o/i2o_proc.c 2004-10-19 01:54:37.000000000 +0400
-+++ ./drivers/message/i2o/i2o_proc.c 2006-09-08 15:10:02.000000000 +0400
-@@ -27,6 +27,10 @@
- * Changes for new I2O API
- */
-
-+#define OSM_NAME "proc-osm"
-+#define OSM_VERSION "1.316"
-+#define OSM_DESCRIPTION "I2O ProcFS OSM"
-+
- #define I2O_MAX_MODULES 4
- // FIXME!
- #define FMT_U64_HEX "0x%08x%08x"
-@@ -60,7 +64,7 @@ static struct proc_dir_entry *i2o_proc_d
-
- /* proc OSM driver struct */
- static struct i2o_driver i2o_proc_driver = {
-- .name = "proc-osm",
-+ .name = OSM_NAME,
- };
-
- static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len)
-@@ -224,7 +228,7 @@ static const char *i2o_get_class_name(in
- case I2O_CLASS_FLOPPY_DEVICE:
- idx = 12;
- break;
-- case I2O_CLASS_BUS_ADAPTER_PORT:
-+ case I2O_CLASS_BUS_ADAPTER:
- idx = 13;
- break;
- case I2O_CLASS_PEER_TRANSPORT_AGENT:
-@@ -290,7 +294,7 @@ static char *bus_strings[] = {
- "CARDBUS"
- };
-
--int i2o_seq_show_hrt(struct seq_file *seq, void *v)
-+static int i2o_seq_show_hrt(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- i2o_hrt *hrt = (i2o_hrt *) c->hrt.virt;
-@@ -391,7 +395,7 @@ int i2o_seq_show_hrt(struct seq_file *se
- return 0;
- }
-
--int i2o_seq_show_lct(struct seq_file *seq, void *v)
-+static int i2o_seq_show_lct(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- i2o_lct *lct = (i2o_lct *) c->lct;
-@@ -486,7 +490,7 @@ int i2o_seq_show_lct(struct seq_file *se
- seq_printf(seq, ", Unknown Device Type");
- break;
-
-- case I2O_CLASS_BUS_ADAPTER_PORT:
-+ case I2O_CLASS_BUS_ADAPTER:
- if (lct->lct_entry[i].sub_class < BUS_TABLE_SIZE)
- seq_printf(seq, ", %s",
- bus_ports[lct->lct_entry[i].
-@@ -521,7 +525,7 @@ int i2o_seq_show_lct(struct seq_file *se
- return 0;
- }
-
--int i2o_seq_show_status(struct seq_file *seq, void *v)
-+static int i2o_seq_show_status(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- char prodstr[25];
-@@ -718,7 +722,7 @@ int i2o_seq_show_status(struct seq_file
- return 0;
- }
-
--int i2o_seq_show_hw(struct seq_file *seq, void *v)
-+static int i2o_seq_show_hw(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- static u32 work32[5];
-@@ -775,7 +779,7 @@ int i2o_seq_show_hw(struct seq_file *seq
- }
-
- /* Executive group 0003h - Executing DDM List (table) */
--int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
-+static int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- int token;
-@@ -851,7 +855,7 @@ int i2o_seq_show_ddm_table(struct seq_fi
- }
-
- /* Executive group 0004h - Driver Store (scalar) */
--int i2o_seq_show_driver_store(struct seq_file *seq, void *v)
-+static int i2o_seq_show_driver_store(struct seq_file *seq, void *v)
- {
- struct i2o_controller *c = (struct i2o_controller *)seq->private;
- u32 work32[8];
-@@ -874,7 +878,7 @@ int i2o_seq_show_driver_store(struct seq
- }
-
- /* Executive group 0005h - Driver Store Table (table) */
--int i2o_seq_show_drivers_stored(struct seq_file *seq, void *v)
-+static int i2o_seq_show_drivers_stored(struct seq_file *seq, void *v)
- {
- typedef struct _i2o_driver_store {
- u16 stored_ddm_index;
-@@ -938,11 +942,6 @@ int i2o_seq_show_drivers_stored(struct s
- seq_printf(seq, " ");
- }
-
--#if 0
-- if (c->i2oversion == 0x02)
-- seq_printf(seq, "%-d", dst->module_state);
--#endif
--
- seq_printf(seq, "%-#7x", dst->i2o_vendor_id);
- seq_printf(seq, "%-#8x", dst->module_id);
- seq_printf(seq, "%-29s", chtostr(dst->module_name_version, 28));
-@@ -950,10 +949,6 @@ int i2o_seq_show_drivers_stored(struct s
- seq_printf(seq, "%8d ", dst->module_size);
- seq_printf(seq, "%8d ", dst->mpb_size);
- seq_printf(seq, "0x%04x", dst->module_flags);
--#if 0
-- if (c->i2oversion == 0x02)
-- seq_printf(seq, "%d", dst->notification_level);
--#endif
- seq_printf(seq, "\n");
- }
-
-@@ -962,7 +957,7 @@ int i2o_seq_show_drivers_stored(struct s
- }
-
- /* Generic group F000h - Params Descriptor (table) */
--int i2o_seq_show_groups(struct seq_file *seq, void *v)
-+static int i2o_seq_show_groups(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1038,7 +1033,7 @@ int i2o_seq_show_groups(struct seq_file
- }
-
- /* Generic group F001h - Physical Device Table (table) */
--int i2o_seq_show_phys_device(struct seq_file *seq, void *v)
-+static int i2o_seq_show_phys_device(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1079,7 +1074,7 @@ int i2o_seq_show_phys_device(struct seq_
- }
-
- /* Generic group F002h - Claimed Table (table) */
--int i2o_seq_show_claimed(struct seq_file *seq, void *v)
-+static int i2o_seq_show_claimed(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1119,7 +1114,7 @@ int i2o_seq_show_claimed(struct seq_file
- }
-
- /* Generic group F003h - User Table (table) */
--int i2o_seq_show_users(struct seq_file *seq, void *v)
-+static int i2o_seq_show_users(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1173,7 +1168,7 @@ int i2o_seq_show_users(struct seq_file *
- }
-
- /* Generic group F005h - Private message extensions (table) (optional) */
--int i2o_seq_show_priv_msgs(struct seq_file *seq, void *v)
-+static int i2o_seq_show_priv_msgs(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1222,7 +1217,7 @@ int i2o_seq_show_priv_msgs(struct seq_fi
- }
-
- /* Generic group F006h - Authorized User Table (table) */
--int i2o_seq_show_authorized_users(struct seq_file *seq, void *v)
-+static int i2o_seq_show_authorized_users(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1263,7 +1258,7 @@ int i2o_seq_show_authorized_users(struct
- }
-
- /* Generic group F100h - Device Identity (scalar) */
--int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
-+static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- static u32 work32[128]; // allow for "stuff" + up to 256 byte (max) serial number
-@@ -1301,7 +1296,7 @@ int i2o_seq_show_dev_identity(struct seq
- return 0;
- }
-
--int i2o_seq_show_dev_name(struct seq_file *seq, void *v)
-+static int i2o_seq_show_dev_name(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
-
-@@ -1311,7 +1306,7 @@ int i2o_seq_show_dev_name(struct seq_fil
- }
-
- /* Generic group F101h - DDM Identity (scalar) */
--int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v)
-+static int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1348,7 +1343,7 @@ int i2o_seq_show_ddm_identity(struct seq
- }
-
- /* Generic group F102h - User Information (scalar) */
--int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
-+static int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1380,7 +1375,7 @@ int i2o_seq_show_uinfo(struct seq_file *
- }
-
- /* Generic group F103h - SGL Operating Limits (scalar) */
--int i2o_seq_show_sgl_limits(struct seq_file *seq, void *v)
-+static int i2o_seq_show_sgl_limits(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- static u32 work32[12];
-@@ -1427,7 +1422,7 @@ int i2o_seq_show_sgl_limits(struct seq_f
- }
-
- /* Generic group F200h - Sensors (scalar) */
--int i2o_seq_show_sensors(struct seq_file *seq, void *v)
-+static int i2o_seq_show_sensors(struct seq_file *seq, void *v)
- {
- struct i2o_device *d = (struct i2o_device *)seq->private;
- int token;
-@@ -1947,11 +1942,11 @@ static void i2o_proc_device_add(struct p
-
- sprintf(buff, "%03x", dev->lct_data.tid);
-
-- pr_debug("Adding device /proc/i2o/iop%d/%s\n", dev->iop->unit, buff);
-+ osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
-
- devdir = proc_mkdir(buff, dir);
- if (!devdir) {
-- printk(KERN_WARNING "i2o: Could not allocate procdir!\n");
-+ osm_warn("Could not allocate procdir!\n");
- return;
- }
-
-@@ -1987,13 +1982,10 @@ static int i2o_proc_iop_add(struct proc_
- {
- struct proc_dir_entry *iopdir;
- struct i2o_device *dev;
-- char buff[10];
-
-- snprintf(buff, 10, "iop%d", c->unit);
-+ osm_debug("adding IOP /proc/i2o/%s\n", c->name);
-
-- pr_debug("Adding IOP /proc/i2o/%s\n", buff);
--
-- iopdir = proc_mkdir(buff, dir);
-+ iopdir = proc_mkdir(c->name, dir);
- if (!iopdir)
- return -1;
-
-@@ -2027,7 +2019,7 @@ static void i2o_proc_iop_remove(struct p
- i2o_proc_subdir_remove(pe);
- remove_proc_entry(pe->name, dir);
- }
-- pr_debug("Removing IOP /proc/i2o/iop%d\n", c->unit);
-+ osm_debug("removing IOP /proc/i2o/%s\n", c->name);
- pe = tmp;
- }
- }
-@@ -2085,6 +2077,8 @@ static int __init i2o_proc_init(void)
- {
- int rc;
-
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-+
- rc = i2o_driver_register(&i2o_proc_driver);
- if (rc)
- return rc;
-@@ -2110,8 +2104,9 @@ static void __exit i2o_proc_exit(void)
- };
-
- MODULE_AUTHOR("Deepak Saxena");
--MODULE_DESCRIPTION("I2O procfs Handler");
- MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-
- module_init(i2o_proc_init);
- module_exit(i2o_proc_exit);
-diff -Nurap ./drivers/message/i2o.i2o/i2o_scsi.c ./drivers/message/i2o/i2o_scsi.c
---- ./drivers/message/i2o.i2o/i2o_scsi.c 2004-10-19 01:54:55.000000000 +0400
-+++ ./drivers/message/i2o/i2o_scsi.c 2006-09-08 15:10:02.000000000 +0400
-@@ -54,7 +54,9 @@
- #include <linux/pci.h>
- #include <linux/blkdev.h>
- #include <linux/i2o.h>
--
-+#if 0
-+#include <linux/scatterlist.h>
-+#endif
- #include <asm/dma.h>
- #include <asm/system.h>
- #include <asm/io.h>
-@@ -64,17 +66,24 @@
- #include <scsi/scsi_host.h>
- #include <scsi/scsi_device.h>
- #include <scsi/scsi_cmnd.h>
--
--#define VERSION_STRING "Version 0.1.2"
-+#include <scsi/scsi_request.h>
-+#include <scsi/sg.h>
-+#if 0
-+#include <scsi/sg_request.h>
-+#endif
-+#define OSM_NAME "scsi-osm"
-+#define OSM_VERSION "1.316"
-+#define OSM_DESCRIPTION "I2O SCSI Peripheral OSM"
-
- static struct i2o_driver i2o_scsi_driver;
-
--static int i2o_scsi_max_id = 16;
--static int i2o_scsi_max_lun = 8;
-+static unsigned int i2o_scsi_max_id = 16;
-+static unsigned int i2o_scsi_max_lun = 255;
-
- struct i2o_scsi_host {
- struct Scsi_Host *scsi_host; /* pointer to the SCSI host */
- struct i2o_controller *iop; /* pointer to the I2O controller */
-+ unsigned int lun; /* lun's used for block devices */
- struct i2o_device *channel[0]; /* channel->i2o_dev mapping table */
- };
-
-@@ -97,17 +106,22 @@ static struct i2o_scsi_host *i2o_scsi_ho
- u8 type;
- int i;
- size_t size;
-- i2o_status_block *sb;
-+ u16 body_size = 6;
-+
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
-+ if (c->adaptec)
-+ body_size = 8;
-+#endif
-
- list_for_each_entry(i2o_dev, &c->devices, list)
-- if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER_PORT) {
-- if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) || (type == 1)) /* SCSI bus */
-+ if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) {
-+ if (!i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1)
-+ && (type == 0x01)) /* SCSI bus */
- max_channel++;
- }
-
- if (!max_channel) {
-- printk(KERN_WARNING "scsi-osm: no channels found on %s\n",
-- c->name);
-+ osm_warn("no channels found on %s\n", c->name);
- return ERR_PTR(-EFAULT);
- }
-
-@@ -116,7 +130,7 @@ static struct i2o_scsi_host *i2o_scsi_ho
-
- scsi_host = scsi_host_alloc(&i2o_scsi_host_template, size);
- if (!scsi_host) {
-- printk(KERN_WARNING "scsi-osm: Could not allocate SCSI host\n");
-+ osm_warn("Could not allocate SCSI host\n");
- return ERR_PTR(-ENOMEM);
- }
-
-@@ -124,20 +138,18 @@ static struct i2o_scsi_host *i2o_scsi_ho
- scsi_host->max_id = i2o_scsi_max_id;
- scsi_host->max_lun = i2o_scsi_max_lun;
- scsi_host->this_id = c->unit;
--
-- sb = c->status_block.virt;
--
-- scsi_host->sg_tablesize = (sb->inbound_frame_size -
-- sizeof(struct i2o_message) / 4 - 6) / 2;
-+ scsi_host->sg_tablesize = i2o_sg_tablesize(c, body_size);
-
- i2o_shost = (struct i2o_scsi_host *)scsi_host->hostdata;
- i2o_shost->scsi_host = scsi_host;
- i2o_shost->iop = c;
-+ i2o_shost->lun = 1;
-
- i = 0;
- list_for_each_entry(i2o_dev, &c->devices, list)
-- if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER_PORT) {
-- if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) || (type == 1)) /* only SCSI bus */
-+ if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) {
-+ if (!i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1)
-+ && (type == 0x01)) /* only SCSI bus */
- i2o_shost->channel[i++] = i2o_dev;
-
- if (i >= max_channel)
-@@ -177,10 +189,13 @@ static int i2o_scsi_remove(struct device
- struct i2o_scsi_host *i2o_shost;
- struct scsi_device *scsi_dev;
-
-+ osm_info("device removed (TID: %03x)\n", i2o_dev->lct_data.tid);
-+
- i2o_shost = i2o_scsi_get_host(c);
-
- shost_for_each_device(scsi_dev, i2o_shost->scsi_host)
- if (scsi_dev->hostdata == i2o_dev) {
-+ sysfs_remove_link(&i2o_dev->device.kobj, "scsi");
- scsi_remove_device(scsi_dev);
- scsi_device_put(scsi_dev);
- break;
-@@ -206,8 +221,8 @@ static int i2o_scsi_probe(struct device
- struct Scsi_Host *scsi_host;
- struct i2o_device *parent;
- struct scsi_device *scsi_dev;
-- u32 id;
-- u64 lun;
-+ u32 id = -1;
-+ u64 lun = -1;
- int channel = -1;
- int i;
-
-@@ -217,52 +232,88 @@ static int i2o_scsi_probe(struct device
-
- scsi_host = i2o_shost->scsi_host;
-
-- if (i2o_parm_field_get(i2o_dev, 0, 3, &id, 4) < 0)
-- return -EFAULT;
-+ switch (i2o_dev->lct_data.class_id) {
-+ case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-+ case I2O_CLASS_EXECUTIVE:
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
-+ if (c->adaptec) {
-+ u8 type;
-+ struct i2o_device *d = i2o_shost->channel[0];
-+
-+ if (!i2o_parm_field_get(d, 0x0000, 0, &type, 1)
-+ && (type == 0x01)) /* SCSI bus */
-+ if (!i2o_parm_field_get(d, 0x0200, 4, &id, 4)) {
-+ channel = 0;
-+ if (i2o_dev->lct_data.class_id ==
-+ I2O_CLASS_RANDOM_BLOCK_STORAGE)
-+ lun =
-+ cpu_to_le64(i2o_shost->
-+ lun++);
-+ else
-+ lun = 0;
-+ }
-+ }
-+#endif
-+ break;
-+
-+ case I2O_CLASS_SCSI_PERIPHERAL:
-+ if (i2o_parm_field_get(i2o_dev, 0x0000, 3, &id, 4))
-+ return -EFAULT;
-+
-+ if (i2o_parm_field_get(i2o_dev, 0x0000, 4, &lun, 8))
-+ return -EFAULT;
-+
-+ parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid);
-+ if (!parent) {
-+ osm_warn("can not find parent of device %03x\n",
-+ i2o_dev->lct_data.tid);
-+ return -EFAULT;
-+ }
-+
-+ for (i = 0; i <= i2o_shost->scsi_host->max_channel; i++)
-+ if (i2o_shost->channel[i] == parent)
-+ channel = i;
-+ break;
-
-- if (id >= scsi_host->max_id) {
-- printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_id "
-- "of I2O host (%d)", id, scsi_host->max_id);
-+ default:
- return -EFAULT;
- }
-
-- if (i2o_parm_field_get(i2o_dev, 0, 4, &lun, 8) < 0)
-- return -EFAULT;
-- if (lun >= scsi_host->max_lun) {
-- printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_lun "
-- "of I2O host (%d)", (unsigned int)lun,
-- scsi_host->max_lun);
-+ if (channel == -1) {
-+ osm_warn("can not find channel of device %03x\n",
-+ i2o_dev->lct_data.tid);
- return -EFAULT;
- }
-
-- parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid);
-- if (!parent) {
-- printk(KERN_WARNING "scsi-osm: can not find parent of device "
-- "%03x\n", i2o_dev->lct_data.tid);
-+ if (le32_to_cpu(id) >= scsi_host->max_id) {
-+ osm_warn("SCSI device id (%d) >= max_id of I2O host (%d)",
-+ le32_to_cpu(id), scsi_host->max_id);
- return -EFAULT;
- }
-
-- for (i = 0; i <= i2o_shost->scsi_host->max_channel; i++)
-- if (i2o_shost->channel[i] == parent)
-- channel = i;
--
-- if (channel == -1) {
-- printk(KERN_WARNING "scsi-osm: can not find channel of device "
-- "%03x\n", i2o_dev->lct_data.tid);
-+ if (le64_to_cpu(lun) >= scsi_host->max_lun) {
-+ osm_warn("SCSI device lun (%lu) >= max_lun of I2O host (%d)",
-+ (long unsigned int)le64_to_cpu(lun),
-+ scsi_host->max_lun);
- return -EFAULT;
- }
-
- scsi_dev =
-- __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev);
-+ __scsi_add_device(i2o_shost->scsi_host, channel, le32_to_cpu(id),
-+ le64_to_cpu(lun), i2o_dev);
-
-- if (!scsi_dev) {
-- printk(KERN_WARNING "scsi-osm: can not add SCSI device "
-- "%03x\n", i2o_dev->lct_data.tid);
-- return -EFAULT;
-+ if (IS_ERR(scsi_dev)) {
-+ osm_warn("can not add SCSI device %03x\n",
-+ i2o_dev->lct_data.tid);
-+ return PTR_ERR(scsi_dev);
- }
-
-- pr_debug("Added new SCSI device %03x (cannel: %d, id: %d, lun: %d)\n",
-- i2o_dev->lct_data.tid, channel, id, (unsigned int)lun);
-+ sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj,
-+ "scsi");
-+
-+ osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n",
-+ i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
-+ (long unsigned int)le64_to_cpu(lun));
-
- return 0;
- };
-@@ -274,53 +325,6 @@ static const char *i2o_scsi_info(struct
- return hostdata->iop->name;
- }
-
--#if 0
--/**
-- * i2o_retry_run - retry on timeout
-- * @f: unused
-- *
-- * Retry congested frames. This actually needs pushing down into
-- * i2o core. We should only bother the OSM with this when we can't
-- * queue and retry the frame. Or perhaps we should call the OSM
-- * and its default handler should be this in the core, and this
-- * call a 2nd "I give up" handler in the OSM ?
-- */
--
--static void i2o_retry_run(unsigned long f)
--{
-- int i;
-- unsigned long flags;
--
-- spin_lock_irqsave(&retry_lock, flags);
-- for (i = 0; i < retry_ct; i++)
-- i2o_post_message(retry_ctrl[i], virt_to_bus(retry[i]));
-- retry_ct = 0;
-- spin_unlock_irqrestore(&retry_lock, flags);
--}
--
--/**
-- * flush_pending - empty the retry queue
-- *
-- * Turn each of the pending commands into a NOP and post it back
-- * to the controller to clear it.
-- */
--
--static void flush_pending(void)
--{
-- int i;
-- unsigned long flags;
--
-- spin_lock_irqsave(&retry_lock, flags);
-- for (i = 0; i < retry_ct; i++) {
-- retry[i][0] &= ~0xFFFFFF;
-- retry[i][0] |= I2O_CMD_UTIL_NOP << 24;
-- i2o_post_message(retry_ctrl[i], virt_to_bus(retry[i]));
-- }
-- retry_ct = 0;
-- spin_unlock_irqrestore(&retry_lock, flags);
--}
--#endif
--
- /**
- * i2o_scsi_reply - SCSI OSM message reply handler
- * @c: controller issuing the reply
-@@ -340,159 +344,89 @@ static int i2o_scsi_reply(struct i2o_con
- struct i2o_message *msg)
- {
- struct scsi_cmnd *cmd;
-+ u32 error;
- struct device *dev;
-- u8 as, ds, st;
--
-- cmd = i2o_cntxt_list_get(c, readl(&msg->u.s.tcntxt));
-
-- if (msg->u.head[0] & (1 << 13)) {
-- struct i2o_message *pmsg; /* preserved message */
-- u32 pm;
--
-- pm = readl(&msg->body[3]);
--
-- pmsg = c->in_queue.virt + pm;
--
-- printk("IOP fail.\n");
-- printk("From %d To %d Cmd %d.\n",
-- (msg->u.head[1] >> 12) & 0xFFF,
-- msg->u.head[1] & 0xFFF, msg->u.head[1] >> 24);
-- printk("Failure Code %d.\n", msg->body[0] >> 24);
-- if (msg->body[0] & (1 << 16))
-- printk("Format error.\n");
-- if (msg->body[0] & (1 << 17))
-- printk("Path error.\n");
-- if (msg->body[0] & (1 << 18))
-- printk("Path State.\n");
-- if (msg->body[0] & (1 << 18))
-- printk("Congestion.\n");
--
-- printk("Failing message is %p.\n", pmsg);
--
-- cmd = i2o_cntxt_list_get(c, readl(&pmsg->u.s.tcntxt));
-- if (!cmd)
-- return 1;
--
-- printk("Aborted %ld\n", cmd->serial_number);
-- cmd->result = DID_ERROR << 16;
-- cmd->scsi_done(cmd);
--
-- /* Now flush the message by making it a NOP */
-- i2o_msg_nop(c, pm);
--
-- return 1;
-+ cmd = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt));
-+ if (unlikely(!cmd)) {
-+ osm_err("NULL reply received!\n");
-+ return -1;
- }
-
- /*
- * Low byte is device status, next is adapter status,
- * (then one byte reserved), then request status.
- */
-- ds = (u8) readl(&msg->body[0]);
-- as = (u8) (readl(&msg->body[0]) >> 8);
-- st = (u8) (readl(&msg->body[0]) >> 24);
-+ error = le32_to_cpu(msg->body[0]);
-
-+ osm_debug("Completed %ld\n", cmd->serial_number);
-+
-+ cmd->result = error & 0xff;
- /*
-- * Is this a control request coming back - eg an abort ?
-+ * if DeviceStatus is not SCSI_SUCCESS copy over the sense data and let
-+ * the SCSI layer handle the error
- */
-+ if (cmd->result)
-+ memcpy(cmd->sense_buffer, &msg->body[3],
-+ min(sizeof(cmd->sense_buffer), (size_t) 40));
-+
-+ /* only output error code if AdapterStatus is not HBA_SUCCESS */
-+ if ((error >> 8) & 0xff)
-+ osm_err("SCSI error %08x\n", error);
-
-- if (!cmd) {
-- if (st)
-- printk(KERN_WARNING "SCSI abort: %08X",
-- readl(&msg->body[0]));
-- printk(KERN_INFO "SCSI abort completed.\n");
-- return -EFAULT;
-- }
--
-- pr_debug("Completed %ld\n", cmd->serial_number);
--
-- if (st) {
-- u32 count, error;
-- /* An error has occurred */
--
-- switch (st) {
-- case 0x06:
-- count = readl(&msg->body[1]);
-- if (count < cmd->underflow) {
-- int i;
-- printk(KERN_ERR "SCSI: underflow 0x%08X 0x%08X"
-- "\n", count, cmd->underflow);
-- printk("Cmd: ");
-- for (i = 0; i < 15; i++)
-- printk("%02X ", cmd->cmnd[i]);
-- printk(".\n");
-- cmd->result = (DID_ERROR << 16);
-- }
-- break;
--
-- default:
-- error = readl(&msg->body[0]);
-+ dev = &c->pdev->dev;
-+ if (cmd->use_sg)
-+ dma_unmap_sg(dev, cmd->request_buffer, cmd->use_sg,
-+ cmd->sc_data_direction);
-+ else if (cmd->SCp.dma_handle)
-+ dma_unmap_single(dev, cmd->SCp.dma_handle, cmd->request_bufflen,
-+ cmd->sc_data_direction);
-
-- printk(KERN_ERR "scsi-osm: SCSI error %08x\n", error);
-+ cmd->scsi_done(cmd);
-
-- if ((error & 0xff) == 0x02 /*CHECK_CONDITION */ ) {
-- int i;
-- u32 len = sizeof(cmd->sense_buffer);
-- len = (len > 40) ? 40 : len;
-- // Copy over the sense data
-- memcpy(cmd->sense_buffer, (void *)&msg->body[3],
-- len);
-- for (i = 0; i <= len; i++)
-- printk(KERN_INFO "%02x\n",
-- cmd->sense_buffer[i]);
-- if (cmd->sense_buffer[0] == 0x70
-- && cmd->sense_buffer[2] == DATA_PROTECT) {
-- /* This is to handle an array failed */
-- cmd->result = (DID_TIME_OUT << 16);
-- printk(KERN_WARNING "%s: SCSI Data "
-- "Protect-Device (%d,%d,%d) "
-- "hba_status=0x%x, dev_status="
-- "0x%x, cmd=0x%x\n", c->name,
-- (u32) cmd->device->channel,
-- (u32) cmd->device->id,
-- (u32) cmd->device->lun,
-- (error >> 8) & 0xff,
-- error & 0xff, cmd->cmnd[0]);
-- } else
-- cmd->result = (DID_ERROR << 16);
--
-- break;
-- }
--
-- switch (as) {
-- case 0x0E:
-- /* SCSI Reset */
-- cmd->result = DID_RESET << 16;
-- break;
--
-- case 0x0F:
-- cmd->result = DID_PARITY << 16;
-- break;
--
-- default:
-- cmd->result = DID_ERROR << 16;
-- break;
-- }
-+ return 1;
-+};
-
-- break;
-- }
-+/**
-+ * i2o_scsi_notify_device_add - Retrieve notifications of added devices
-+ * @i2o_dev: the I2O device which was added
-+ *
-+ * If a I2O device is added we catch the notification, because I2O classes
-+ * other then SCSI peripheral will not be received through
-+ * i2o_scsi_probe().
-+ */
-+static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev)
-+{
-+ switch (i2o_dev->lct_data.class_id) {
-+ case I2O_CLASS_EXECUTIVE:
-+ case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-+ i2o_scsi_probe(&i2o_dev->device);
-+ break;
-
-- cmd->scsi_done(cmd);
-- return 1;
-+ default:
-+ break;
- }
-+};
-
-- cmd->result = DID_OK << 16 | ds;
--
-- cmd->scsi_done(cmd);
--
-- dev = &c->pdev->dev;
-- if (cmd->use_sg)
-- dma_unmap_sg(dev, (struct scatterlist *)cmd->buffer,
-- cmd->use_sg, cmd->sc_data_direction);
-- else if (cmd->request_bufflen)
-- dma_unmap_single(dev, (dma_addr_t) ((long)cmd->SCp.ptr),
-- cmd->request_bufflen, cmd->sc_data_direction);
-+/**
-+ * i2o_scsi_notify_device_remove - Retrieve notifications of removed
-+ * devices
-+ * @i2o_dev: the I2O device which was removed
-+ *
-+ * If a I2O device is removed, we catch the notification to remove the
-+ * corresponding SCSI device.
-+ */
-+static void i2o_scsi_notify_device_remove(struct i2o_device *i2o_dev)
-+{
-+ switch (i2o_dev->lct_data.class_id) {
-+ case I2O_CLASS_EXECUTIVE:
-+ case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-+ i2o_scsi_remove(&i2o_dev->device);
-+ break;
-
-- return 1;
-+ default:
-+ break;
-+ }
- };
-
- /**
-@@ -503,29 +437,27 @@ static int i2o_scsi_reply(struct i2o_con
- * If a I2O controller is added, we catch the notification to add a
- * corresponding Scsi_Host.
- */
--void i2o_scsi_notify_controller_add(struct i2o_controller *c)
-+static void i2o_scsi_notify_controller_add(struct i2o_controller *c)
- {
- struct i2o_scsi_host *i2o_shost;
- int rc;
-
- i2o_shost = i2o_scsi_host_alloc(c);
- if (IS_ERR(i2o_shost)) {
-- printk(KERN_ERR "scsi-osm: Could not initialize"
-- " SCSI host\n");
-+ osm_err("Could not initialize SCSI host\n");
- return;
- }
-
- rc = scsi_add_host(i2o_shost->scsi_host, &c->device);
- if (rc) {
-- printk(KERN_ERR "scsi-osm: Could not add SCSI "
-- "host\n");
-+ osm_err("Could not add SCSI host\n");
- scsi_host_put(i2o_shost->scsi_host);
- return;
- }
-
- c->driver_data[i2o_scsi_driver.context] = i2o_shost;
-
-- pr_debug("new I2O SCSI host added\n");
-+ osm_debug("new I2O SCSI host added\n");
- };
-
- /**
-@@ -536,7 +468,7 @@ void i2o_scsi_notify_controller_add(stru
- * If a I2O controller is removed, we catch the notification to remove the
- * corresponding Scsi_Host.
- */
--void i2o_scsi_notify_controller_remove(struct i2o_controller *c)
-+static void i2o_scsi_notify_controller_remove(struct i2o_controller *c)
- {
- struct i2o_scsi_host *i2o_shost;
- i2o_shost = i2o_scsi_get_host(c);
-@@ -547,14 +479,16 @@ void i2o_scsi_notify_controller_remove(s
-
- scsi_remove_host(i2o_shost->scsi_host);
- scsi_host_put(i2o_shost->scsi_host);
-- pr_debug("I2O SCSI host removed\n");
-+ osm_debug("I2O SCSI host removed\n");
- };
-
- /* SCSI OSM driver struct */
- static struct i2o_driver i2o_scsi_driver = {
-- .name = "scsi-osm",
-+ .name = OSM_NAME,
- .reply = i2o_scsi_reply,
- .classes = i2o_scsi_class_id,
-+ .notify_device_add = i2o_scsi_notify_device_add,
-+ .notify_device_remove = i2o_scsi_notify_device_remove,
- .notify_controller_add = i2o_scsi_notify_controller_add,
- .notify_controller_remove = i2o_scsi_notify_controller_remove,
- .driver = {
-@@ -581,83 +515,125 @@ static int i2o_scsi_queuecommand(struct
- void (*done) (struct scsi_cmnd *))
- {
- struct i2o_controller *c;
-- struct Scsi_Host *host;
- struct i2o_device *i2o_dev;
-- struct device *dev;
- int tid;
- struct i2o_message *msg;
-- u32 m;
-- u32 scsi_flags, sg_flags;
-- u32 *mptr, *lenptr;
-- u32 len, reqlen;
-- int i;
-+ /*
-+ * ENABLE_DISCONNECT
-+ * SIMPLE_TAG
-+ * RETURN_SENSE_DATA_IN_REPLY_MESSAGE_FRAME
-+ */
-+ u32 scsi_flags = 0x20a00000;
-+ u32 sgl_offset;
-+ u32 *mptr;
-+ u32 cmd = I2O_CMD_SCSI_EXEC << 24;
-+ int rc = 0;
-
- /*
- * Do the incoming paperwork
- */
--
- i2o_dev = SCpnt->device->hostdata;
-- host = SCpnt->device->host;
- c = i2o_dev->iop;
-- dev = &c->pdev->dev;
-
- SCpnt->scsi_done = done;
-
- if (unlikely(!i2o_dev)) {
-- printk(KERN_WARNING "scsi-osm: no I2O device in request\n");
-+ osm_warn("no I2O device in request\n");
- SCpnt->result = DID_NO_CONNECT << 16;
- done(SCpnt);
-- return 0;
-+ goto exit;
- }
-
- tid = i2o_dev->lct_data.tid;
-
-- pr_debug("qcmd: Tid = %03x\n", tid);
-- pr_debug("Real scsi messages.\n");
--
-- /*
-- * Obtain an I2O message. If there are none free then
-- * throw it back to the scsi layer
-- */
--
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return SCSI_MLQUEUE_HOST_BUSY;
-+ osm_debug("qcmd: Tid = %03x\n", tid);
-+ osm_debug("Real scsi messages.\n");
-
- /*
- * Put together a scsi execscb message
- */
--
-- len = SCpnt->request_bufflen;
--
- switch (SCpnt->sc_data_direction) {
- case PCI_DMA_NONE:
-- scsi_flags = 0x00000000; // DATA NO XFER
-- sg_flags = 0x00000000;
-+ /* DATA NO XFER */
-+ sgl_offset = SGL_OFFSET_0;
- break;
-
- case PCI_DMA_TODEVICE:
-- scsi_flags = 0x80000000; // DATA OUT (iop-->dev)
-- sg_flags = 0x14000000;
-+ /* DATA OUT (iop-->dev) */
-+ scsi_flags |= 0x80000000;
-+ sgl_offset = SGL_OFFSET_10;
- break;
-
- case PCI_DMA_FROMDEVICE:
-- scsi_flags = 0x40000000; // DATA IN (iop<--dev)
-- sg_flags = 0x10000000;
-+ /* DATA IN (iop<--dev) */
-+ scsi_flags |= 0x40000000;
-+ sgl_offset = SGL_OFFSET_10;
- break;
-
- default:
- /* Unknown - kill the command */
- SCpnt->result = DID_NO_CONNECT << 16;
- done(SCpnt);
-- return 0;
-+ goto exit;
-+ }
-+
-+ /*
-+ * Obtain an I2O message. If there are none free then
-+ * throw it back to the scsi layer
-+ */
-+
-+ msg = i2o_msg_get(c);
-+ if (IS_ERR(msg)) {
-+ rc = SCSI_MLQUEUE_HOST_BUSY;
-+ goto exit;
- }
-
-- writel(I2O_CMD_SCSI_EXEC << 24 | HOST_TID << 12 | tid, &msg->u.head[1]);
-- writel(i2o_scsi_driver.context, &msg->u.s.icntxt);
-+ mptr = &msg->body[0];
-+
-+#if 0
-+#ifdef CONFIG_I2O_EXT_ADAPTEC
-+ if (c->adaptec) {
-+ u32 adpt_flags = 0;
-+
-+ if (SCpnt->sc_request && SCpnt->sc_request->upper_private_data) {
-+ i2o_sg_io_hdr_t __user *usr_ptr =
-+ ((Sg_request *) (SCpnt->sc_request->
-+ upper_private_data))->header.
-+ usr_ptr;
-+
-+ if (usr_ptr)
-+ get_user(adpt_flags, &usr_ptr->flags);
-+ }
-+
-+ switch (i2o_dev->lct_data.class_id) {
-+ case I2O_CLASS_EXECUTIVE:
-+ case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-+ /* interpret flag has to be set for executive */
-+ adpt_flags ^= I2O_DPT_SG_FLAG_INTERPRET;
-+ break;
-+
-+ default:
-+ break;
-+ }
-+
-+ /*
-+ * for Adaptec controllers we use the PRIVATE command, because
-+ * the normal SCSI EXEC doesn't support all SCSI commands on
-+ * all controllers (for example READ CAPACITY).
-+ */
-+ if (sgl_offset == SGL_OFFSET_10)
-+ sgl_offset = SGL_OFFSET_12;
-+ cmd = I2O_CMD_PRIVATE << 24;
-+ *mptr++ = cpu_to_le32(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC);
-+ *mptr++ = cpu_to_le32(adpt_flags | tid);
-+ }
-+#endif
-+#endif
-+ msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_scsi_driver.context);
-
- /* We want the SCSI control block back */
-- writel(i2o_cntxt_list_add(c, SCpnt), &msg->u.s.tcntxt);
-+ msg->u.s.tcntxt = cpu_to_le32(i2o_cntxt_list_add(c, SCpnt));
-
- /* LSI_920_PCI_QUIRK
- *
-@@ -671,7 +647,7 @@ static int i2o_scsi_queuecommand(struct
- */
-
- /* Attach tags to the devices */
-- /*
-+ /* FIXME: implement
- if(SCpnt->device->tagged_supported) {
- if(SCpnt->tag == HEAD_OF_QUEUE_TAG)
- scsi_flags |= 0x01000000;
-@@ -680,74 +656,49 @@ static int i2o_scsi_queuecommand(struct
- }
- */
-
-- /* Direction, disconnect ok, tag, CDBLen */
-- writel(scsi_flags | 0x20200000 | SCpnt->cmd_len, &msg->body[0]);
--
-- mptr = &msg->body[1];
-+ *mptr++ = cpu_to_le32(scsi_flags | SCpnt->cmd_len);
-
- /* Write SCSI command into the message - always 16 byte block */
-- memcpy_toio(mptr, SCpnt->cmnd, 16);
-+ memcpy(mptr, SCpnt->cmnd, 16);
- mptr += 4;
-- lenptr = mptr++; /* Remember me - fill in when we know */
-
-- reqlen = 12; // SINGLE SGE
--
-- /* Now fill in the SGList and command */
-- if (SCpnt->use_sg) {
-- struct scatterlist *sg;
-- int sg_count;
--
-- sg = SCpnt->request_buffer;
-- len = 0;
--
-- sg_count = dma_map_sg(dev, sg, SCpnt->use_sg,
-- SCpnt->sc_data_direction);
--
-- if (unlikely(sg_count <= 0))
-- return -ENOMEM;
--
-- for (i = SCpnt->use_sg; i > 0; i--) {
-- if (i == 1)
-- sg_flags |= 0xC0000000;
-- writel(sg_flags | sg_dma_len(sg), mptr++);
-- writel(sg_dma_address(sg), mptr++);
-- len += sg_dma_len(sg);
-- sg++;
-+ if (sgl_offset != SGL_OFFSET_0) {
-+ /* write size of data addressed by SGL */
-+ *mptr++ = cpu_to_le32(SCpnt->request_bufflen);
-+
-+ /* Now fill in the SGList and command */
-+ if (SCpnt->use_sg) {
-+ if (!i2o_dma_map_sg(c, SCpnt->request_buffer,
-+ SCpnt->use_sg,
-+ SCpnt->sc_data_direction, &mptr))
-+ goto nomem;
-+ } else {
-+ SCpnt->SCp.dma_handle =
-+ i2o_dma_map_single(c, SCpnt->request_buffer,
-+ SCpnt->request_bufflen,
-+ SCpnt->sc_data_direction, &mptr);
-+ if (dma_mapping_error(SCpnt->SCp.dma_handle))
-+ goto nomem;
- }
--
-- reqlen = mptr - &msg->u.head[0];
-- writel(len, lenptr);
-- } else {
-- len = SCpnt->request_bufflen;
--
-- writel(len, lenptr);
--
-- if (len > 0) {
-- dma_addr_t dma_addr;
--
-- dma_addr = dma_map_single(dev, SCpnt->request_buffer,
-- SCpnt->request_bufflen,
-- SCpnt->sc_data_direction);
-- if (!dma_addr)
-- return -ENOMEM;
--
-- SCpnt->SCp.ptr = (void *)(unsigned long)dma_addr;
-- sg_flags |= 0xC0000000;
-- writel(sg_flags | SCpnt->request_bufflen, mptr++);
-- writel(dma_addr, mptr++);
-- } else
-- reqlen = 9;
- }
-
- /* Stick the headers on */
-- writel(reqlen << 16 | SGL_OFFSET_10, &msg->u.head[0]);
-+ msg->u.head[0] =
-+ cpu_to_le32(I2O_MESSAGE_SIZE(mptr - &msg->u.head[0]) | sgl_offset);
-
- /* Queue the message */
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-
-- pr_debug("Issued %ld\n", SCpnt->serial_number);
-+ osm_debug("Issued %ld\n", SCpnt->serial_number);
-
- return 0;
-+
-+ nomem:
-+ rc = -ENOMEM;
-+ i2o_msg_nop(c, msg);
-+
-+ exit:
-+ return rc;
- };
-
- /**
-@@ -761,31 +712,30 @@ static int i2o_scsi_queuecommand(struct
- * Returns 0 if the command is successfully aborted or negative error code
- * on failure.
- */
--int i2o_scsi_abort(struct scsi_cmnd *SCpnt)
-+static int i2o_scsi_abort(struct scsi_cmnd *SCpnt)
- {
- struct i2o_device *i2o_dev;
- struct i2o_controller *c;
- struct i2o_message *msg;
-- u32 m;
- int tid;
- int status = FAILED;
-
-- printk(KERN_WARNING "i2o_scsi: Aborting command block.\n");
-+ osm_warn("Aborting command block.\n");
-
- i2o_dev = SCpnt->device->hostdata;
- c = i2o_dev->iop;
- tid = i2o_dev->lct_data.tid;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
- return SCSI_MLQUEUE_HOST_BUSY;
-
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_SCSI_ABORT << 24 | HOST_TID << 12 | tid,
-- &msg->u.head[1]);
-- writel(i2o_cntxt_list_get_ptr(c, SCpnt), &msg->body[0]);
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SCSI_ABORT << 24 | HOST_TID << 12 | tid);
-+ msg->body[0] = cpu_to_le32(i2o_cntxt_list_get_ptr(c, SCpnt));
-
-- if (i2o_msg_post_wait(c, m, I2O_TIMEOUT_SCSI_SCB_ABORT))
-+ if (!i2o_msg_post_wait(c, msg, I2O_TIMEOUT_SCSI_SCB_ABORT))
- status = SUCCESS;
-
- return status;
-@@ -820,8 +770,8 @@ static int i2o_scsi_bios_param(struct sc
- }
-
- static struct scsi_host_template i2o_scsi_host_template = {
-- .proc_name = "SCSI-OSM",
-- .name = "I2O SCSI Peripheral OSM",
-+ .proc_name = OSM_NAME,
-+ .name = OSM_DESCRIPTION,
- .info = i2o_scsi_info,
- .queuecommand = i2o_scsi_queuecommand,
- .eh_abort_handler = i2o_scsi_abort,
-@@ -832,15 +782,6 @@ static struct scsi_host_template i2o_scs
- .use_clustering = ENABLE_CLUSTERING,
- };
-
--/*
--int
--i2o_scsi_queuecommand(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
--{
-- printk(KERN_INFO "queuecommand\n");
-- return SCSI_MLQUEUE_HOST_BUSY;
--};
--*/
--
- /**
- * i2o_scsi_init - SCSI OSM initialization function
- *
-@@ -852,12 +793,12 @@ static int __init i2o_scsi_init(void)
- {
- int rc;
-
-- printk(KERN_INFO "I2O SCSI Peripheral OSM\n");
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-
- /* Register SCSI OSM into I2O core */
- rc = i2o_driver_register(&i2o_scsi_driver);
- if (rc) {
-- printk(KERN_ERR "scsi-osm: Could not register SCSI driver\n");
-+ osm_err("Could not register SCSI driver\n");
- return rc;
- }
-
-@@ -877,6 +818,8 @@ static void __exit i2o_scsi_exit(void)
-
- MODULE_AUTHOR("Red Hat Software");
- MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-
- module_init(i2o_scsi_init);
- module_exit(i2o_scsi_exit);
-diff -Nurap ./drivers/message/i2o.i2o/iop.c ./drivers/message/i2o/iop.c
---- ./drivers/message/i2o.i2o/iop.c 2004-10-19 01:53:46.000000000 +0400
-+++ ./drivers/message/i2o/iop.c 2006-09-08 15:10:02.000000000 +0400
-@@ -27,6 +27,13 @@
-
- #include <linux/module.h>
- #include <linux/i2o.h>
-+#include <linux/delay.h>
-+#include <linux/sched.h>
-+#include "core.h"
-+
-+#define OSM_NAME "i2o"
-+#define OSM_VERSION "1.325"
-+#define OSM_DESCRIPTION "I2O subsystem"
-
- /* global I2O controller list */
- LIST_HEAD(i2o_controllers);
-@@ -37,40 +44,7 @@ LIST_HEAD(i2o_controllers);
- */
- static struct i2o_dma i2o_systab;
-
--/* Module internal functions from other sources */
--extern struct i2o_driver i2o_exec_driver;
--extern int i2o_exec_lct_get(struct i2o_controller *);
--extern void i2o_device_remove(struct i2o_device *);
--
--extern int __init i2o_driver_init(void);
--extern void __exit i2o_driver_exit(void);
--extern int __init i2o_exec_init(void);
--extern void __exit i2o_exec_exit(void);
--extern int __init i2o_pci_init(void);
--extern void __exit i2o_pci_exit(void);
--extern int i2o_device_init(void);
--extern void i2o_device_exit(void);
--
--/**
-- * i2o_msg_nop - Returns a message which is not used
-- * @c: I2O controller from which the message was created
-- * @m: message which should be returned
-- *
-- * If you fetch a message via i2o_msg_get, and can't use it, you must
-- * return the message with this function. Otherwise the message frame
-- * is lost.
-- */
--void i2o_msg_nop(struct i2o_controller *c, u32 m)
--{
-- struct i2o_message *msg = c->in_queue.virt + m;
--
-- writel(THREE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(0, &msg->u.head[2]);
-- writel(0, &msg->u.head[3]);
-- i2o_msg_post(c, m);
--};
-+static int i2o_hrt_get(struct i2o_controller *c);
-
- /**
- * i2o_msg_get_wait - obtain an I2O message from the IOP
-@@ -86,23 +60,22 @@ void i2o_msg_nop(struct i2o_controller *
- * address from the read port (see the i2o spec). If no message is
- * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
- */
--u32 i2o_msg_get_wait(struct i2o_controller *c, struct i2o_message **msg,
-- int wait)
-+struct i2o_message *i2o_msg_get_wait(struct i2o_controller *c, int wait)
- {
- unsigned long timeout = jiffies + wait * HZ;
-- u32 m;
-+ struct i2o_message *msg;
-
-- while ((m = i2o_msg_get(c, msg)) == I2O_QUEUE_EMPTY) {
-+ while (IS_ERR(msg = i2o_msg_get(c))) {
- if (time_after(jiffies, timeout)) {
-- pr_debug("%s: Timeout waiting for message frame.\n",
-- c->name);
-- return I2O_QUEUE_EMPTY;
-+ osm_debug("%s: Timeout waiting for message frame.\n",
-+ c->name);
-+ return ERR_PTR(-ETIMEDOUT);
- }
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
- }
-
-- return m;
-+ return msg;
- };
-
- #if BITS_PER_LONG == 64
-@@ -117,18 +90,19 @@ u32 i2o_msg_get_wait(struct i2o_controll
- *
- * Returns context id > 0 on success or 0 on failure.
- */
--u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
-+u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
- {
- struct i2o_context_list_element *entry;
- unsigned long flags;
-
- if (!ptr)
-- printk(KERN_ERR "NULL pointer found!\n");
-+ osm_err("%s: couldn't add NULL pointer to context list!\n",
-+ c->name);
-
- entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
- if (!entry) {
-- printk(KERN_ERR "i2o: Could not allocate memory for context "
-- "list element\n");
-+ osm_err("%s: Could not allocate memory for context list element"
-+ "\n", c->name);
- return 0;
- }
-
-@@ -147,7 +121,7 @@ u32 i2o_cntxt_list_add(struct i2o_contro
-
- spin_unlock_irqrestore(&c->context_list_lock, flags);
-
-- pr_debug("Add context to list %p -> %d\n", ptr, context);
-+ osm_debug("%s: Add context to list %p -> %d\n", c->name, ptr, context);
-
- return entry->context;
- };
-@@ -162,7 +136,7 @@ u32 i2o_cntxt_list_add(struct i2o_contro
- *
- * Returns context id on succes or 0 on failure.
- */
--u32 i2o_cntxt_list_remove(struct i2o_controller *c, void *ptr)
-+u32 i2o_cntxt_list_remove(struct i2o_controller * c, void *ptr)
- {
- struct i2o_context_list_element *entry;
- u32 context = 0;
-@@ -179,10 +153,11 @@ u32 i2o_cntxt_list_remove(struct i2o_con
- spin_unlock_irqrestore(&c->context_list_lock, flags);
-
- if (!context)
-- printk(KERN_WARNING "i2o: Could not remove nonexistent ptr "
-- "%p\n", ptr);
-+ osm_warn("%s: Could not remove nonexistent ptr %p\n", c->name,
-+ ptr);
-
-- pr_debug("remove ptr from context list %d -> %p\n", context, ptr);
-+ osm_debug("%s: remove ptr from context list %d -> %p\n", c->name,
-+ context, ptr);
-
- return context;
- };
-@@ -212,9 +187,10 @@ void *i2o_cntxt_list_get(struct i2o_cont
- spin_unlock_irqrestore(&c->context_list_lock, flags);
-
- if (!ptr)
-- printk(KERN_WARNING "i2o: context id %d not found\n", context);
-+ osm_warn("%s: context id %d not found\n", c->name, context);
-
-- pr_debug("get ptr from context list %d -> %p\n", context, ptr);
-+ osm_debug("%s: get ptr from context list %d -> %p\n", c->name, context,
-+ ptr);
-
- return ptr;
- };
-@@ -242,10 +218,11 @@ u32 i2o_cntxt_list_get_ptr(struct i2o_co
- spin_unlock_irqrestore(&c->context_list_lock, flags);
-
- if (!context)
-- printk(KERN_WARNING "i2o: Could not find nonexistent ptr "
-- "%p\n", ptr);
-+ osm_warn("%s: Could not find nonexistent ptr %p\n", c->name,
-+ ptr);
-
-- pr_debug("get context id from context list %p -> %d\n", ptr, context);
-+ osm_debug("%s: get context id from context list %p -> %d\n", c->name,
-+ ptr, context);
-
- return context;
- };
-@@ -304,7 +281,6 @@ struct i2o_device *i2o_iop_find_device(s
- static int i2o_iop_quiesce(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
- i2o_status_block *sb = c->status_block.virt;
- int rc;
-
-@@ -315,20 +291,20 @@ static int i2o_iop_quiesce(struct i2o_co
- (sb->iop_state != ADAPTER_STATE_OPERATIONAL))
- return 0;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_SYS_QUIESCE << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SYS_QUIESCE << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-
- /* Long timeout needed for quiesce if lots of devices */
-- if ((rc = i2o_msg_post_wait(c, m, 240)))
-- printk(KERN_INFO "%s: Unable to quiesce (status=%#x).\n",
-- c->name, -rc);
-+ if ((rc = i2o_msg_post_wait(c, msg, 240)))
-+ osm_info("%s: Unable to quiesce (status=%#x).\n", c->name, -rc);
- else
-- pr_debug("%s: Quiesced.\n", c->name);
-+ osm_debug("%s: Quiesced.\n", c->name);
-
- i2o_status_get(c); // Entered READY state
-
-@@ -346,7 +322,6 @@ static int i2o_iop_quiesce(struct i2o_co
- static int i2o_iop_enable(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
- i2o_status_block *sb = c->status_block.virt;
- int rc;
-
-@@ -356,20 +331,20 @@ static int i2o_iop_enable(struct i2o_con
- if (sb->iop_state != ADAPTER_STATE_READY)
- return -EINVAL;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_SYS_ENABLE << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SYS_ENABLE << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-
- /* How long of a timeout do we need? */
-- if ((rc = i2o_msg_post_wait(c, m, 240)))
-- printk(KERN_ERR "%s: Could not enable (status=%#x).\n",
-- c->name, -rc);
-+ if ((rc = i2o_msg_post_wait(c, msg, 240)))
-+ osm_err("%s: Could not enable (status=%#x).\n", c->name, -rc);
- else
-- pr_debug("%s: Enabled.\n", c->name);
-+ osm_debug("%s: Enabled.\n", c->name);
-
- i2o_status_get(c); // entered OPERATIONAL state
-
-@@ -418,35 +393,94 @@ static inline void i2o_iop_enable_all(vo
- static int i2o_iop_clear(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
- int rc;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-
- /* Quiesce all IOPs first */
- i2o_iop_quiesce_all();
-
-- writel(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_ADAPTER_CLEAR << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
--
-- if ((rc = i2o_msg_post_wait(c, m, 30)))
-- printk(KERN_INFO "%s: Unable to clear (status=%#x).\n",
-- c->name, -rc);
-+ msg->u.head[0] = cpu_to_le32(FOUR_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_ADAPTER_CLEAR << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+
-+ if ((rc = i2o_msg_post_wait(c, msg, 30)))
-+ osm_info("%s: Unable to clear (status=%#x).\n", c->name, -rc);
- else
-- pr_debug("%s: Cleared.\n", c->name);
-+ osm_debug("%s: Cleared.\n", c->name);
-
- /* Enable all IOPs */
- i2o_iop_enable_all();
-
-- i2o_status_get(c);
--
- return rc;
- }
-
- /**
-+ * i2o_iop_init_outbound_queue - setup the outbound message queue
-+ * @c: I2O controller
-+ *
-+ * Clear and (re)initialize IOP's outbound queue and post the message
-+ * frames to the IOP.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+static int i2o_iop_init_outbound_queue(struct i2o_controller *c)
-+{
-+ u32 m;
-+ volatile u8 *status = c->status.virt;
-+ struct i2o_message *msg;
-+ ulong timeout;
-+ int i;
-+
-+ osm_debug("%s: Initializing Outbound Queue...\n", c->name);
-+
-+ memset(c->status.virt, 0, 4);
-+
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_OUTBOUND_INIT << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-+ msg->u.s.tcntxt = cpu_to_le32(0x00000000);
-+ msg->body[0] = cpu_to_le32(PAGE_SIZE);
-+ /* Outbound msg frame size in words and Initcode */
-+ msg->body[1] = cpu_to_le32(I2O_OUTBOUND_MSG_FRAME_SIZE << 16 | 0x80);
-+ msg->body[2] = cpu_to_le32(0xd0000004);
-+ msg->body[3] = cpu_to_le32(i2o_dma_low(c->status.phys));
-+ msg->body[4] = cpu_to_le32(i2o_dma_high(c->status.phys));
-+
-+ i2o_msg_post(c, msg);
-+
-+ timeout = jiffies + I2O_TIMEOUT_INIT_OUTBOUND_QUEUE * HZ;
-+ while (*status <= I2O_CMD_IN_PROGRESS) {
-+ if (time_after(jiffies, timeout)) {
-+ osm_warn("%s: Timeout Initializing\n", c->name);
-+ return -ETIMEDOUT;
-+ }
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(1);
-+ }
-+
-+ m = c->out_queue.phys;
-+
-+ /* Post frames */
-+ for (i = 0; i < I2O_MAX_OUTBOUND_MSG_FRAMES; i++) {
-+ i2o_flush_reply(c, m);
-+ udelay(1); /* Promise */
-+ m += I2O_OUTBOUND_MSG_FRAME_SIZE * sizeof(u32);
-+ }
-+
-+ return 0;
-+}
-+
-+/**
- * i2o_iop_reset - reset an I2O controller
- * @c: controller to reset
- *
-@@ -457,88 +491,94 @@ static int i2o_iop_clear(struct i2o_cont
- */
- static int i2o_iop_reset(struct i2o_controller *c)
- {
-- u8 *status = c->status.virt;
-+ volatile u8 *status = c->status.virt;
- struct i2o_message *msg;
-- u32 m;
- unsigned long timeout;
- i2o_status_block *sb = c->status_block.virt;
- int rc = 0;
-
-- pr_debug("Resetting controller\n");
-+ osm_debug("%s: Resetting controller\n", c->name);
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-
-- memset(status, 0, 4);
-+ memset(c->status_block.virt, 0, 8);
-
- /* Quiesce all IOPs first */
- i2o_iop_quiesce_all();
-
-- writel(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_ADAPTER_RESET << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_exec_driver.context, &msg->u.s.icntxt);
-- writel(0, &msg->u.s.tcntxt); //FIXME: use reasonable transaction context
-- writel(0, &msg->body[0]);
-- writel(0, &msg->body[1]);
-- writel(i2o_ptr_low((void *)c->status.phys), &msg->body[2]);
-- writel(i2o_ptr_high((void *)c->status.phys), &msg->body[3]);
-+ msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_ADAPTER_RESET << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-+ msg->u.s.tcntxt = cpu_to_le32(0x00000000);
-+ msg->body[0] = cpu_to_le32(0x00000000);
-+ msg->body[1] = cpu_to_le32(0x00000000);
-+ msg->body[2] = cpu_to_le32(i2o_dma_low(c->status.phys));
-+ msg->body[3] = cpu_to_le32(i2o_dma_high(c->status.phys));
-
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-
- /* Wait for a reply */
- timeout = jiffies + I2O_TIMEOUT_RESET * HZ;
- while (!*status) {
-- if (time_after(jiffies, timeout)) {
-- printk(KERN_ERR "IOP reset timeout.\n");
-- rc = -ETIMEDOUT;
-- goto exit;
-- }
-+ if (time_after(jiffies, timeout))
-+ break;
-+
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
--
-- rmb();
- }
-
-- if (*status == I2O_CMD_IN_PROGRESS) {
-+ switch (*status) {
-+ case I2O_CMD_REJECTED:
-+ osm_warn("%s: IOP reset rejected\n", c->name);
-+ rc = -EPERM;
-+ break;
-+
-+ case I2O_CMD_IN_PROGRESS:
- /*
- * Once the reset is sent, the IOP goes into the INIT state
-- * which is indeterminate. We need to wait until the IOP
-- * has rebooted before we can let the system talk to
-- * it. We read the inbound Free_List until a message is
-- * available. If we can't read one in the given ammount of
-- * time, we assume the IOP could not reboot properly.
-+ * which is indeterminate. We need to wait until the IOP has
-+ * rebooted before we can let the system talk to it. We read
-+ * the inbound Free_List until a message is available. If we
-+ * can't read one in the given ammount of time, we assume the
-+ * IOP could not reboot properly.
- */
-- pr_debug("%s: Reset in progress, waiting for reboot...\n",
-- c->name);
-+ osm_debug("%s: Reset in progress, waiting for reboot...\n",
-+ c->name);
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);
-- while (m == I2O_QUEUE_EMPTY) {
-+ while (IS_ERR(msg = i2o_msg_get_wait(c, I2O_TIMEOUT_RESET))) {
- if (time_after(jiffies, timeout)) {
-- printk(KERN_ERR "IOP reset timeout.\n");
-- rc = -ETIMEDOUT;
-+ osm_err("%s: IOP reset timeout.\n", c->name);
-+ rc = PTR_ERR(msg);
- goto exit;
- }
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
--
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);
- }
-- i2o_msg_nop(c, m);
-- }
-+ i2o_msg_nop(c, msg);
-
-- /* from here all quiesce commands are safe */
-- c->no_quiesce = 0;
-+ /* from here all quiesce commands are safe */
-+ c->no_quiesce = 0;
-
-- /* If IopReset was rejected or didn't perform reset, try IopClear */
-- i2o_status_get(c);
-- if (*status == I2O_CMD_REJECTED || sb->iop_state != ADAPTER_STATE_RESET) {
-- printk(KERN_WARNING "%s: Reset rejected, trying to clear\n",
-- c->name);
-- i2o_iop_clear(c);
-- } else
-- pr_debug("%s: Reset completed.\n", c->name);
-+ /* verify if controller is in state RESET */
-+ i2o_status_get(c);
-+
-+ if (!c->promise && (sb->iop_state != ADAPTER_STATE_RESET))
-+ osm_warn("%s: reset completed, but adapter not in RESET"
-+ " state.\n", c->name);
-+ else
-+ osm_debug("%s: reset completed.\n", c->name);
-+
-+ break;
-+
-+ default:
-+ osm_err("%s: IOP reset timeout.\n", c->name);
-+ rc = -ETIMEDOUT;
-+ break;
-+ }
-
- exit:
- /* Enable all IOPs */
-@@ -548,70 +588,6 @@ static int i2o_iop_reset(struct i2o_cont
- };
-
- /**
-- * i2o_iop_init_outbound_queue - setup the outbound message queue
-- * @c: I2O controller
-- *
-- * Clear and (re)initialize IOP's outbound queue and post the message
-- * frames to the IOP.
-- *
-- * Returns 0 on success or a negative errno code on failure.
-- */
--int i2o_iop_init_outbound_queue(struct i2o_controller *c)
--{
-- u8 *status = c->status.virt;
-- u32 m;
-- struct i2o_message *msg;
-- ulong timeout;
-- int i;
--
-- pr_debug("%s: Initializing Outbound Queue...\n", c->name);
--
-- memset(status, 0, 4);
--
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(EIGHT_WORD_MSG_SIZE | TRL_OFFSET_6, &msg->u.head[0]);
-- writel(I2O_CMD_OUTBOUND_INIT << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_exec_driver.context, &msg->u.s.icntxt);
-- writel(0x0106, &msg->u.s.tcntxt); /* FIXME: why 0x0106, maybe in
-- Spec? */
-- writel(PAGE_SIZE, &msg->body[0]);
-- writel(MSG_FRAME_SIZE << 16 | 0x80, &msg->body[1]); /* Outbound msg frame
-- size in words and Initcode */
-- writel(0xd0000004, &msg->body[2]);
-- writel(i2o_ptr_low((void *)c->status.phys), &msg->body[3]);
-- writel(i2o_ptr_high((void *)c->status.phys), &msg->body[4]);
--
-- i2o_msg_post(c, m);
--
-- timeout = jiffies + I2O_TIMEOUT_INIT_OUTBOUND_QUEUE * HZ;
-- while (*status <= I2O_CMD_IN_PROGRESS) {
-- if (time_after(jiffies, timeout)) {
-- printk(KERN_WARNING "%s: Timeout Initializing\n",
-- c->name);
-- return -ETIMEDOUT;
-- }
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
--
-- rmb();
-- }
--
-- m = c->out_queue.phys;
--
-- /* Post frames */
-- for (i = 0; i < NMBR_MSG_FRAMES; i++) {
-- i2o_flush_reply(c, m);
-- m += MSG_FRAME_SIZE * 4;
-- }
--
-- return 0;
--}
--
--/**
- * i2o_iop_activate - Bring controller up to HOLD
- * @c: controller
- *
-@@ -624,48 +600,60 @@ static int i2o_iop_activate(struct i2o_c
- {
- i2o_status_block *sb = c->status_block.virt;
- int rc;
-+ int state;
-+
- /* In INIT state, Wait Inbound Q to initialize (in i2o_status_get) */
- /* In READY state, Get status */
-
- rc = i2o_status_get(c);
- if (rc) {
-- printk(KERN_INFO "Unable to obtain status of %s, "
-- "attempting a reset.\n", c->name);
-- if (i2o_iop_reset(c))
-+ osm_info("%s: Unable to obtain status, attempting a reset.\n",
-+ c->name);
-+ rc = i2o_iop_reset(c);
-+ if (rc)
- return rc;
- }
-
- if (sb->i2o_version > I2OVER15) {
-- printk(KERN_ERR "%s: Not running vrs. 1.5. of the I2O "
-- "Specification.\n", c->name);
-+ osm_err("%s: Not running version 1.5 of the I2O Specification."
-+ "\n", c->name);
- return -ENODEV;
- }
-
- switch (sb->iop_state) {
- case ADAPTER_STATE_FAULTED:
-- printk(KERN_CRIT "%s: hardware fault\n", c->name);
-- return -ENODEV;
-+ osm_err("%s: hardware fault\n", c->name);
-+ return -EFAULT;
-
- case ADAPTER_STATE_READY:
- case ADAPTER_STATE_OPERATIONAL:
- case ADAPTER_STATE_HOLD:
- case ADAPTER_STATE_FAILED:
-- pr_debug("already running, trying to reset...\n");
-- if (i2o_iop_reset(c))
-- return -ENODEV;
-+ osm_debug("%s: already running, trying to reset...\n", c->name);
-+ rc = i2o_iop_reset(c);
-+ if (rc)
-+ return rc;
- }
-
-+ /* preserve state */
-+ state = sb->iop_state;
-+
- rc = i2o_iop_init_outbound_queue(c);
- if (rc)
- return rc;
-
-- /* In HOLD state */
-+ /* if adapter was not in RESET state clear now */
-+ if (state != ADAPTER_STATE_RESET)
-+ i2o_iop_clear(c);
-
-- rc = i2o_hrt_get(c);
-- if (rc)
-- return rc;
-+ i2o_status_get(c);
-
-- return 0;
-+ if (sb->iop_state != ADAPTER_STATE_HOLD) {
-+ osm_err("%s: failed to bring IOP into HOLD state\n", c->name);
-+ return -EIO;
-+ }
-+
-+ return i2o_hrt_get(c);
- };
-
- /**
-@@ -679,7 +667,6 @@ static int i2o_iop_activate(struct i2o_c
- static int i2o_iop_systab_set(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
- i2o_status_block *sb = c->status_block.virt;
- struct device *dev = &c->pdev->dev;
- struct resource *root;
-@@ -691,18 +678,18 @@ static int i2o_iop_systab_set(struct i2o
- res->flags = IORESOURCE_MEM;
- res->start = 0;
- res->end = 0;
-- printk("%s: requires private memory resources.\n", c->name);
-+ osm_info("%s: requires private memory resources.\n", c->name);
- root = pci_find_parent_resource(c->pdev, res);
- if (root == NULL)
-- printk("Can't find parent resource!\n");
-+ osm_warn("%s: Can't find parent resource!\n", c->name);
- if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
- NULL, NULL) >= 0) {
- c->mem_alloc = 1;
- sb->current_mem_size = 1 + res->end - res->start;
- sb->current_mem_base = res->start;
-- printk(KERN_INFO
-- "%s: allocated %ld bytes of PCI memory at 0x%08lX.\n",
-- c->name, 1 + res->end - res->start, res->start);
-+ osm_info("%s: allocated %ld bytes of PCI memory at "
-+ "0x%08lX.\n", c->name,
-+ 1 + res->end - res->start, res->start);
- }
- }
-
-@@ -712,67 +699,62 @@ static int i2o_iop_systab_set(struct i2o
- res->flags = IORESOURCE_IO;
- res->start = 0;
- res->end = 0;
-- printk("%s: requires private memory resources.\n", c->name);
-+ osm_info("%s: requires private memory resources.\n", c->name);
- root = pci_find_parent_resource(c->pdev, res);
- if (root == NULL)
-- printk("Can't find parent resource!\n");
-+ osm_warn("%s: Can't find parent resource!\n", c->name);
- if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
- NULL, NULL) >= 0) {
- c->io_alloc = 1;
- sb->current_io_size = 1 + res->end - res->start;
- sb->current_mem_base = res->start;
-- printk(KERN_INFO
-- "%s: allocated %ld bytes of PCI I/O at 0x%08lX.\n",
-- c->name, 1 + res->end - res->start, res->start);
-+ osm_info("%s: allocated %ld bytes of PCI I/O at 0x%08lX"
-+ ".\n", c->name, 1 + res->end - res->start,
-+ res->start);
- }
- }
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-
- i2o_systab.phys = dma_map_single(dev, i2o_systab.virt, i2o_systab.len,
- PCI_DMA_TODEVICE);
- if (!i2o_systab.phys) {
-- i2o_msg_nop(c, m);
-+ i2o_msg_nop(c, msg);
- return -ENOMEM;
- }
-
-- writel(I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6, &msg->u.head[0]);
-- writel(I2O_CMD_SYS_TAB_SET << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-+ msg->u.head[0] = cpu_to_le32(I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_SYS_TAB_SET << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-
- /*
- * Provide three SGL-elements:
- * System table (SysTab), Private memory space declaration and
- * Private i/o space declaration
-- *
-- * FIXME: is this still true?
-- * Nasty one here. We can't use dma_alloc_coherent to send the
-- * same table to everyone. We have to go remap it for them all
- */
-
-- writel(c->unit + 2, &msg->body[0]);
-- writel(0, &msg->body[1]);
-- writel(0x54000000 | i2o_systab.phys, &msg->body[2]);
-- writel(i2o_systab.phys, &msg->body[3]);
-- writel(0x54000000 | sb->current_mem_size, &msg->body[4]);
-- writel(sb->current_mem_base, &msg->body[5]);
-- writel(0xd4000000 | sb->current_io_size, &msg->body[6]);
-- writel(sb->current_io_base, &msg->body[6]);
-+ msg->body[0] = cpu_to_le32(c->unit + 2);
-+ msg->body[1] = cpu_to_le32(0x00000000);
-+ msg->body[2] = cpu_to_le32(0x54000000 | i2o_systab.len);
-+ msg->body[3] = cpu_to_le32(i2o_systab.phys);
-+ msg->body[4] = cpu_to_le32(0x54000000 | sb->current_mem_size);
-+ msg->body[5] = cpu_to_le32(sb->current_mem_base);
-+ msg->body[6] = cpu_to_le32(0xd4000000 | sb->current_io_size);
-+ msg->body[6] = cpu_to_le32(sb->current_io_base);
-
-- rc = i2o_msg_post_wait(c, m, 120);
-+ rc = i2o_msg_post_wait(c, msg, 120);
-
- dma_unmap_single(dev, i2o_systab.phys, i2o_systab.len,
- PCI_DMA_TODEVICE);
-
- if (rc < 0)
-- printk(KERN_ERR "%s: Unable to set SysTab (status=%#x).\n",
-- c->name, -rc);
-+ osm_err("%s: Unable to set SysTab (status=%#x).\n", c->name,
-+ -rc);
- else
-- pr_debug("%s: SysTab set.\n", c->name);
--
-- i2o_status_get(c); // Entered READY state
-+ osm_debug("%s: SysTab set.\n", c->name);
-
- return rc;
- }
-@@ -783,7 +765,7 @@ static int i2o_iop_systab_set(struct i2o
- *
- * Send the system table and enable the I2O controller.
- *
-- * Returns 0 on success or negativer error code on failure.
-+ * Returns 0 on success or negative error code on failure.
- */
- static int i2o_iop_online(struct i2o_controller *c)
- {
-@@ -794,7 +776,7 @@ static int i2o_iop_online(struct i2o_con
- return rc;
-
- /* In READY state */
-- pr_debug("%s: Attempting to enable...\n", c->name);
-+ osm_debug("%s: Attempting to enable...\n", c->name);
- rc = i2o_iop_enable(c);
- if (rc)
- return rc;
-@@ -813,7 +795,7 @@ void i2o_iop_remove(struct i2o_controlle
- {
- struct i2o_device *dev, *tmp;
-
-- pr_debug("Deleting controller %s\n", c->name);
-+ osm_debug("%s: deleting controller\n", c->name);
-
- i2o_driver_notify_controller_remove_all(c);
-
-@@ -822,6 +804,8 @@ void i2o_iop_remove(struct i2o_controlle
- list_for_each_entry_safe(dev, tmp, &c->devices, list)
- i2o_device_remove(dev);
-
-+ device_del(&c->device);
-+
- /* Ask the IOP to switch to RESET state */
- i2o_iop_reset(c);
- }
-@@ -856,13 +840,11 @@ static int i2o_systab_build(void)
- i2o_systab.len = sizeof(struct i2o_sys_tbl) + num_controllers *
- sizeof(struct i2o_sys_tbl_entry);
-
-- systab = i2o_systab.virt = kmalloc(i2o_systab.len, GFP_KERNEL);
-+ systab = i2o_systab.virt = kzalloc(i2o_systab.len, GFP_KERNEL);
- if (!systab) {
-- printk(KERN_ERR "i2o: unable to allocate memory for System "
-- "Table\n");
-+ osm_err("unable to allocate memory for System Table\n");
- return -ENOMEM;
- }
-- memset(systab, 0, i2o_systab.len);
-
- systab->version = I2OVERSION;
- systab->change_ind = change_ind + 1;
-@@ -871,8 +853,8 @@ static int i2o_systab_build(void)
- i2o_status_block *sb;
-
- if (count >= num_controllers) {
-- printk(KERN_ERR "i2o: controller added while building "
-- "system table\n");
-+ osm_err("controller added while building system table"
-+ "\n");
- break;
- }
-
-@@ -886,9 +868,8 @@ static int i2o_systab_build(void)
- * it is techninically not part of the I2O subsystem...
- */
- if (unlikely(i2o_status_get(c))) {
-- printk(KERN_ERR "%s: Deleting b/c could not get status"
-- " while attempting to build system table\n",
-- c->name);
-+ osm_err("%s: Deleting b/c could not get status while "
-+ "attempting to build system table\n", c->name);
- i2o_iop_remove(c);
- continue; // try the next one
- }
-@@ -902,8 +883,10 @@ static int i2o_systab_build(void)
- systab->iops[count].frame_size = sb->inbound_frame_size;
- systab->iops[count].last_changed = change_ind;
- systab->iops[count].iop_capabilities = sb->iop_capabilities;
-- systab->iops[count].inbound_low = i2o_ptr_low(c->post_port);
-- systab->iops[count].inbound_high = i2o_ptr_high(c->post_port);
-+ systab->iops[count].inbound_low =
-+ i2o_dma_low(c->base.phys + I2O_IN_PORT);
-+ systab->iops[count].inbound_high =
-+ i2o_dma_high(c->base.phys + I2O_IN_PORT);
-
- count++;
- }
-@@ -940,42 +923,40 @@ static int i2o_parse_hrt(struct i2o_cont
- int i2o_status_get(struct i2o_controller *c)
- {
- struct i2o_message *msg;
-- u32 m;
-- u8 *status_block;
-+ volatile u8 *status_block;
- unsigned long timeout;
-
- status_block = (u8 *) c->status_block.virt;
-- memset(status_block, 0, sizeof(i2o_status_block));
-+ memset(c->status_block.virt, 0, sizeof(i2o_status_block));
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(NINE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_STATUS_GET << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(i2o_exec_driver.context, &msg->u.s.icntxt);
-- writel(0, &msg->u.s.tcntxt); // FIXME: use resonable transaction context
-- writel(0, &msg->body[0]);
-- writel(0, &msg->body[1]);
-- writel(i2o_ptr_low((void *)c->status_block.phys), &msg->body[2]);
-- writel(i2o_ptr_high((void *)c->status_block.phys), &msg->body[3]);
-- writel(sizeof(i2o_status_block), &msg->body[4]); /* always 88 bytes */
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_STATUS_GET << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-+ msg->u.s.tcntxt = cpu_to_le32(0x00000000);
-+ msg->body[0] = cpu_to_le32(0x00000000);
-+ msg->body[1] = cpu_to_le32(0x00000000);
-+ msg->body[2] = cpu_to_le32(i2o_dma_low(c->status_block.phys));
-+ msg->body[3] = cpu_to_le32(i2o_dma_high(c->status_block.phys));
-+ msg->body[4] = cpu_to_le32(sizeof(i2o_status_block)); /* always 88 bytes */
-
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-
- /* Wait for a reply */
- timeout = jiffies + I2O_TIMEOUT_STATUS_GET * HZ;
- while (status_block[87] != 0xFF) {
- if (time_after(jiffies, timeout)) {
-- printk(KERN_ERR "%s: Get status timeout.\n", c->name);
-+ osm_err("%s: Get status timeout.\n", c->name);
- return -ETIMEDOUT;
- }
-
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
--
-- rmb();
- }
-
- #ifdef DEBUG
-@@ -992,9 +973,9 @@ int i2o_status_get(struct i2o_controller
- * The HRT contains information about possible hidden devices but is
- * mostly useless to us.
- *
-- * Returns 0 on success or negativer error code on failure.
-+ * Returns 0 on success or negative error code on failure.
- */
--int i2o_hrt_get(struct i2o_controller *c)
-+static int i2o_hrt_get(struct i2o_controller *c)
- {
- int rc;
- int i;
-@@ -1004,23 +985,23 @@ int i2o_hrt_get(struct i2o_controller *c
-
- for (i = 0; i < I2O_HRT_GET_TRIES; i++) {
- struct i2o_message *msg;
-- u32 m;
--
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
-
-- writel(SIX_WORD_MSG_SIZE | SGL_OFFSET_4, &msg->u.head[0]);
-- writel(I2O_CMD_HRT_GET << 24 | HOST_TID << 12 | ADAPTER_TID,
-- &msg->u.head[1]);
-- writel(0xd0000000 | c->hrt.len, &msg->body[0]);
-- writel(c->hrt.phys, &msg->body[1]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(SIX_WORD_MSG_SIZE | SGL_OFFSET_4);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_HRT_GET << 24 | HOST_TID << 12 |
-+ ADAPTER_TID);
-+ msg->body[0] = cpu_to_le32(0xd0000000 | c->hrt.len);
-+ msg->body[1] = cpu_to_le32(c->hrt.phys);
-
-- rc = i2o_msg_post_wait_mem(c, m, 20, &c->hrt);
-+ rc = i2o_msg_post_wait_mem(c, msg, 20, &c->hrt);
-
- if (rc < 0) {
-- printk(KERN_ERR "%s: Unable to get HRT (status=%#x)\n",
-- c->name, -rc);
-+ osm_err("%s: Unable to get HRT (status=%#x)\n", c->name,
-+ -rc);
- return rc;
- }
-
-@@ -1034,17 +1015,31 @@ int i2o_hrt_get(struct i2o_controller *c
- return i2o_parse_hrt(c);
- }
-
-- printk(KERN_ERR "%s: Unable to get HRT after %d tries, giving up\n",
-- c->name, I2O_HRT_GET_TRIES);
-+ osm_err("%s: Unable to get HRT after %d tries, giving up\n", c->name,
-+ I2O_HRT_GET_TRIES);
-
- return -EBUSY;
- }
-
- /**
-+ * i2o_iop_release - release the memory for a I2O controller
-+ * @dev: I2O controller which should be released
-+ *
-+ * Release the allocated memory. This function is called if refcount of
-+ * device reaches 0 automatically.
-+ */
-+static void i2o_iop_release(struct device *dev)
-+{
-+ struct i2o_controller *c = to_i2o_controller(dev);
-+
-+ i2o_iop_free(c);
-+};
-+
-+/**
- * i2o_iop_alloc - Allocate and initialize a i2o_controller struct
- *
- * Allocate the necessary memory for a i2o_controller struct and
-- * initialize the lists.
-+ * initialize the lists and message mempool.
- *
- * Returns a pointer to the I2O controller or a negative error code on
- * failure.
-@@ -1053,23 +1048,38 @@ struct i2o_controller *i2o_iop_alloc(voi
- {
- static int unit = 0; /* 0 and 1 are NULL IOP and Local Host */
- struct i2o_controller *c;
-+ char poolname[32];
-
-- c = kmalloc(sizeof(*c), GFP_KERNEL);
-+ c = kzalloc(sizeof(*c), GFP_KERNEL);
- if (!c) {
-- printk(KERN_ERR "i2o: Insufficient memory to allocate the "
-- "controller.\n");
-+ osm_err("i2o: Insufficient memory to allocate a I2O controller."
-+ "\n");
- return ERR_PTR(-ENOMEM);
- }
-- memset(c, 0, sizeof(*c));
-
-- INIT_LIST_HEAD(&c->devices);
-- c->lock = SPIN_LOCK_UNLOCKED;
-- init_MUTEX(&c->lct_lock);
- c->unit = unit++;
- sprintf(c->name, "iop%d", c->unit);
-
-+ snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name);
-+ if (i2o_pool_alloc
-+ (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32),
-+ I2O_MSG_INPOOL_MIN)) {
-+ kfree(c);
-+ return ERR_PTR(-ENOMEM);
-+ };
-+
-+ INIT_LIST_HEAD(&c->devices);
-+ spin_lock_init(&c->lock);
-+ init_MUTEX(&c->lct_lock);
-+
-+ device_initialize(&c->device);
-+
-+ c->device.release = &i2o_iop_release;
-+
-+ snprintf(c->device.bus_id, BUS_ID_SIZE, "iop%d", c->unit);
-+
- #if BITS_PER_LONG == 64
-- c->context_list_lock = SPIN_LOCK_UNLOCKED;
-+ spin_lock_init(&c->context_list_lock);
- atomic_set(&c->context_list_counter, 0);
- INIT_LIST_HEAD(&c->context_list);
- #endif
-@@ -1078,15 +1088,6 @@ struct i2o_controller *i2o_iop_alloc(voi
- };
-
- /**
-- * i2o_iop_free - Free the i2o_controller struct
-- * @c: I2O controller to free
-- */
--void i2o_iop_free(struct i2o_controller *c)
--{
-- kfree(c);
--};
--
--/**
- * i2o_iop_add - Initialize the I2O controller and add him to the I2O core
- * @c: controller
- *
-@@ -1099,45 +1100,50 @@ int i2o_iop_add(struct i2o_controller *c
- {
- int rc;
-
-- printk(KERN_INFO "%s: Activating I2O controller...\n", c->name);
-- printk(KERN_INFO "%s: This may take a few minutes if there are many "
-- "devices\n", c->name);
-+ if ((rc = device_add(&c->device))) {
-+ osm_err("%s: could not add controller\n", c->name);
-+ goto iop_reset;
-+ }
-+
-+ osm_info("%s: Activating I2O controller...\n", c->name);
-+ osm_info("%s: This may take a few minutes if there are many devices\n",
-+ c->name);
-
- if ((rc = i2o_iop_activate(c))) {
-- printk(KERN_ERR "%s: controller could not activated\n",
-- c->name);
-- i2o_iop_reset(c);
-- return rc;
-+ osm_err("%s: could not activate controller\n", c->name);
-+ goto device_del;
- }
-
-- pr_debug("building sys table %s...\n", c->name);
-+ osm_debug("%s: building sys table...\n", c->name);
-
-- if ((rc = i2o_systab_build())) {
-- i2o_iop_reset(c);
-- return rc;
-- }
-+ if ((rc = i2o_systab_build()))
-+ goto device_del;
-
-- pr_debug("online controller %s...\n", c->name);
-+ osm_debug("%s: online controller...\n", c->name);
-
-- if ((rc = i2o_iop_online(c))) {
-- i2o_iop_reset(c);
-- return rc;
-- }
-+ if ((rc = i2o_iop_online(c)))
-+ goto device_del;
-
-- pr_debug("getting LCT %s...\n", c->name);
-+ osm_debug("%s: getting LCT...\n", c->name);
-
-- if ((rc = i2o_exec_lct_get(c))) {
-- i2o_iop_reset(c);
-- return rc;
-- }
-+ if ((rc = i2o_exec_lct_get(c)))
-+ goto device_del;
-
- list_add(&c->list, &i2o_controllers);
-
- i2o_driver_notify_controller_add_all(c);
-
-- printk(KERN_INFO "%s: Controller added\n", c->name);
-+ osm_info("%s: Controller added\n", c->name);
-
- return 0;
-+
-+ device_del:
-+ device_del(&c->device);
-+
-+ iop_reset:
-+ i2o_iop_reset(c);
-+
-+ return rc;
- };
-
- /**
-@@ -1151,28 +1157,27 @@ int i2o_iop_add(struct i2o_controller *c
- * is waited for, or expected. If you do not want further notifications,
- * call the i2o_event_register again with a evt_mask of 0.
- *
-- * Returns 0 on success or -ETIMEDOUT if no message could be fetched for
-- * sending the request.
-+ * Returns 0 on success or negative error code on failure.
- */
- int i2o_event_register(struct i2o_device *dev, struct i2o_driver *drv,
- int tcntxt, u32 evt_mask)
- {
- struct i2o_controller *c = dev->iop;
- struct i2o_message *msg;
-- u32 m;
-
-- m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
-- if (m == I2O_QUEUE_EMPTY)
-- return -ETIMEDOUT;
--
-- writel(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
-- writel(I2O_CMD_UTIL_EVT_REGISTER << 24 | HOST_TID << 12 | dev->lct_data.
-- tid, &msg->u.head[1]);
-- writel(drv->context, &msg->u.s.icntxt);
-- writel(tcntxt, &msg->u.s.tcntxt);
-- writel(evt_mask, &msg->body[0]);
-+ msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-+ if (IS_ERR(msg))
-+ return PTR_ERR(msg);
-+
-+ msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
-+ msg->u.head[1] =
-+ cpu_to_le32(I2O_CMD_UTIL_EVT_REGISTER << 24 | HOST_TID << 12 | dev->
-+ lct_data.tid);
-+ msg->u.s.icntxt = cpu_to_le32(drv->context);
-+ msg->u.s.tcntxt = cpu_to_le32(tcntxt);
-+ msg->body[0] = cpu_to_le32(evt_mask);
-
-- i2o_msg_post(c, m);
-+ i2o_msg_post(c, msg);
-
- return 0;
- };
-@@ -1189,18 +1194,12 @@ static int __init i2o_iop_init(void)
- {
- int rc = 0;
-
-- printk(KERN_INFO "I2O Core - (C) Copyright 1999 Red Hat Software\n");
-+ printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
-
-- rc = i2o_device_init();
-- if (rc)
-+ if ((rc = i2o_driver_init()))
- goto exit;
-
-- rc = i2o_driver_init();
-- if (rc)
-- goto device_exit;
--
-- rc = i2o_exec_init();
-- if (rc)
-+ if ((rc = i2o_exec_init()))
- goto driver_exit;
-
- rc = i2o_pci_init();
-@@ -1215,9 +1214,6 @@ static int __init i2o_iop_init(void)
- driver_exit:
- i2o_driver_exit();
-
-- device_exit:
-- i2o_device_exit();
--
- exit:
- return rc;
- }
-@@ -1232,15 +1228,15 @@ static void __exit i2o_iop_exit(void)
- i2o_pci_exit();
- i2o_exec_exit();
- i2o_driver_exit();
-- i2o_device_exit();
- };
-
- module_init(i2o_iop_init);
- module_exit(i2o_iop_exit);
-
- MODULE_AUTHOR("Red Hat Software");
--MODULE_DESCRIPTION("I2O Core");
- MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION(OSM_DESCRIPTION);
-+MODULE_VERSION(OSM_VERSION);
-
- #if BITS_PER_LONG == 64
- EXPORT_SYMBOL(i2o_cntxt_list_add);
-@@ -1254,5 +1250,4 @@ EXPORT_SYMBOL(i2o_find_iop);
- EXPORT_SYMBOL(i2o_iop_find_device);
- EXPORT_SYMBOL(i2o_event_register);
- EXPORT_SYMBOL(i2o_status_get);
--EXPORT_SYMBOL(i2o_hrt_get);
- EXPORT_SYMBOL(i2o_controllers);
-diff -Nurap ./drivers/message/i2o.i2o/pci.c ./drivers/message/i2o/pci.c
---- ./drivers/message/i2o.i2o/pci.c 2004-10-19 01:53:43.000000000 +0400
-+++ ./drivers/message/i2o/pci.c 2006-09-08 15:10:02.000000000 +0400
-@@ -30,60 +30,27 @@
- #include <linux/pci.h>
- #include <linux/interrupt.h>
- #include <linux/i2o.h>
-+#include "core.h"
-
--#ifdef CONFIG_MTRR
--#include <asm/mtrr.h>
--#endif // CONFIG_MTRR
--
--/* Module internal functions from other sources */
--extern struct i2o_controller *i2o_iop_alloc(void);
--extern void i2o_iop_free(struct i2o_controller *);
--
--extern int i2o_iop_add(struct i2o_controller *);
--extern void i2o_iop_remove(struct i2o_controller *);
--
--extern int i2o_driver_dispatch(struct i2o_controller *, u32,
-- struct i2o_message *);
-+#define OSM_DESCRIPTION "I2O-subsystem"
-
- /* PCI device id table for all I2O controllers */
- static struct pci_device_id __devinitdata i2o_pci_ids[] = {
- {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)},
- {PCI_DEVICE(PCI_VENDOR_ID_DPT, 0xa511)},
-+ {.vendor = PCI_VENDOR_ID_INTEL,.device = 0x1962,
-+ .subvendor = PCI_VENDOR_ID_PROMISE,.subdevice = PCI_ANY_ID},
- {0}
- };
-
- /**
-- * i2o_dma_realloc - Realloc DMA memory
-- * @dev: struct device pointer to the PCI device of the I2O controller
-- * @addr: pointer to a i2o_dma struct DMA buffer
-- * @len: new length of memory
-- * @gfp_mask: GFP mask
-- *
-- * If there was something allocated in the addr, free it first. If len > 0
-- * than try to allocate it and write the addresses back to the addr
-- * structure. If len == 0 set the virtual address to NULL.
-- *
-- * Returns the 0 on success or negative error code on failure.
-- */
--int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, size_t len,
-- unsigned int gfp_mask)
--{
-- i2o_dma_free(dev, addr);
--
-- if (len)
-- return i2o_dma_alloc(dev, addr, len, gfp_mask);
--
-- return 0;
--};
--
--/**
- * i2o_pci_free - Frees the DMA memory for the I2O controller
- * @c: I2O controller to free
- *
- * Remove all allocated DMA memory and unmap memory IO regions. If MTRR
- * is enabled, also remove it again.
- */
--static void __devexit i2o_pci_free(struct i2o_controller *c)
-+static void i2o_pci_free(struct i2o_controller *c)
- {
- struct device *dev;
-
-@@ -91,24 +58,18 @@ static void __devexit i2o_pci_free(struc
-
- i2o_dma_free(dev, &c->out_queue);
- i2o_dma_free(dev, &c->status_block);
-- if (c->lct)
-- kfree(c->lct);
-+ kfree(c->lct);
- i2o_dma_free(dev, &c->dlct);
- i2o_dma_free(dev, &c->hrt);
- i2o_dma_free(dev, &c->status);
-
--#ifdef CONFIG_MTRR
-- if (c->mtrr_reg0 >= 0)
-- mtrr_del(c->mtrr_reg0, 0, 0);
-- if (c->mtrr_reg1 >= 0)
-- mtrr_del(c->mtrr_reg1, 0, 0);
--#endif
--
- if (c->raptor && c->in_queue.virt)
- iounmap(c->in_queue.virt);
-
- if (c->base.virt)
- iounmap(c->base.virt);
-+
-+ pci_release_regions(c->pdev);
- }
-
- /**
-@@ -127,6 +88,11 @@ static int __devinit i2o_pci_alloc(struc
- struct device *dev = &pdev->dev;
- int i;
-
-+ if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
-+ printk(KERN_ERR "%s: device already claimed\n", c->name);
-+ return -ENODEV;
-+ }
-+
- for (i = 0; i < 6; i++) {
- /* Skip I/O spaces */
- if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
-@@ -138,13 +104,13 @@ static int __devinit i2o_pci_alloc(struc
- * If we know what card it is, set the size
- * correctly. Code is taken from dpt_i2o.c
- */
-- if(pdev->device == 0xa501) {
-- if(pdev->subsystem_device >= 0xc032 &&
-- pdev->subsystem_device <= 0xc03b) {
-- if(c->base.len > 0x400000)
-+ if (pdev->device == 0xa501) {
-+ if (pdev->subsystem_device >= 0xc032 &&
-+ pdev->subsystem_device <= 0xc03b) {
-+ if (c->base.len > 0x400000)
- c->base.len = 0x400000;
- } else {
-- if(c->base.len > 0x100000)
-+ if (c->base.len > 0x100000)
- c->base.len = 0x100000;
- }
- }
-@@ -159,79 +125,68 @@ static int __devinit i2o_pci_alloc(struc
- }
-
- if (i == 6) {
-- printk(KERN_ERR "i2o: I2O controller has no memory regions"
-- " defined.\n");
-+ printk(KERN_ERR "%s: I2O controller has no memory regions"
-+ " defined.\n", c->name);
- i2o_pci_free(c);
- return -EINVAL;
- }
-
- /* Map the I2O controller */
- if (c->raptor) {
-- printk(KERN_INFO "i2o: PCI I2O controller\n");
-+ printk(KERN_INFO "%s: PCI I2O controller\n", c->name);
- printk(KERN_INFO " BAR0 at 0x%08lX size=%ld\n",
- (unsigned long)c->base.phys, (unsigned long)c->base.len);
- printk(KERN_INFO " BAR1 at 0x%08lX size=%ld\n",
- (unsigned long)c->in_queue.phys,
- (unsigned long)c->in_queue.len);
- } else
-- printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n",
-- (unsigned long)c->base.phys, (unsigned long)c->base.len);
-+ printk(KERN_INFO "%s: PCI I2O controller at %08lX size=%ld\n",
-+ c->name, (unsigned long)c->base.phys,
-+ (unsigned long)c->base.len);
-
-- c->base.virt = ioremap(c->base.phys, c->base.len);
-+ c->base.virt = ioremap_nocache(c->base.phys, c->base.len);
- if (!c->base.virt) {
-- printk(KERN_ERR "i2o: Unable to map controller.\n");
-+ printk(KERN_ERR "%s: Unable to map controller.\n", c->name);
-+ i2o_pci_free(c);
- return -ENOMEM;
- }
-
- if (c->raptor) {
-- c->in_queue.virt = ioremap(c->in_queue.phys, c->in_queue.len);
-+ c->in_queue.virt =
-+ ioremap_nocache(c->in_queue.phys, c->in_queue.len);
- if (!c->in_queue.virt) {
-- printk(KERN_ERR "i2o: Unable to map controller.\n");
-+ printk(KERN_ERR "%s: Unable to map controller.\n",
-+ c->name);
- i2o_pci_free(c);
- return -ENOMEM;
- }
- } else
- c->in_queue = c->base;
-
-- c->irq_mask = c->base.virt + 0x34;
-- c->post_port = c->base.virt + 0x40;
-- c->reply_port = c->base.virt + 0x44;
--
--#ifdef CONFIG_MTRR
-- /* Enable Write Combining MTRR for IOP's memory region */
-- c->mtrr_reg0 = mtrr_add(c->in_queue.phys, c->in_queue.len,
-- MTRR_TYPE_WRCOMB, 1);
-- c->mtrr_reg1 = -1;
--
-- if (c->mtrr_reg0 < 0)
-- printk(KERN_WARNING "i2o: could not enable write combining "
-- "MTRR\n");
-- else
-- printk(KERN_INFO "i2o: using write combining MTRR\n");
--
-- /*
-- * If it is an INTEL i960 I/O processor then set the first 64K to
-- * Uncacheable since the region contains the messaging unit which
-- * shouldn't be cached.
-- */
-- if ((pdev->vendor == PCI_VENDOR_ID_INTEL ||
-- pdev->vendor == PCI_VENDOR_ID_DPT) && !c->raptor) {
-- printk(KERN_INFO "i2o: MTRR workaround for Intel i960 processor"
-- "\n");
-- c->mtrr_reg1 = mtrr_add(c->base.phys, 0x10000,
-- MTRR_TYPE_UNCACHABLE, 1);
--
-- if (c->mtrr_reg1 < 0) {
-- printk(KERN_WARNING "i2o_pci: Error in setting "
-- "MTRR_TYPE_UNCACHABLE\n");
-- mtrr_del(c->mtrr_reg0, c->in_queue.phys,
-- c->in_queue.len);
-- c->mtrr_reg0 = -1;
-+ c->irq_status = c->base.virt + I2O_IRQ_STATUS;
-+ c->irq_mask = c->base.virt + I2O_IRQ_MASK;
-+ c->in_port = c->base.virt + I2O_IN_PORT;
-+ c->out_port = c->base.virt + I2O_OUT_PORT;
-+
-+ /* Motorola/Freescale chip does not follow spec */
-+ if (pdev->vendor == PCI_VENDOR_ID_MOTOROLA && pdev->device == 0x18c0) {
-+ /* Check if CPU is enabled */
-+ if (be32_to_cpu(readl(c->base.virt + 0x10000)) & 0x10000000) {
-+ printk(KERN_INFO "%s: MPC82XX needs CPU running to "
-+ "service I2O.\n", c->name);
-+ i2o_pci_free(c);
-+ return -ENODEV;
-+ } else {
-+ c->irq_status += I2O_MOTOROLA_PORT_OFFSET;
-+ c->irq_mask += I2O_MOTOROLA_PORT_OFFSET;
-+ c->in_port += I2O_MOTOROLA_PORT_OFFSET;
-+ c->out_port += I2O_MOTOROLA_PORT_OFFSET;
-+ printk(KERN_INFO "%s: MPC82XX workarounds activated.\n",
-+ c->name);
- }
- }
--#endif
-
-- if (i2o_dma_alloc(dev, &c->status, 4, GFP_KERNEL)) {
-+ if (i2o_dma_alloc(dev, &c->status, 8, GFP_KERNEL)) {
- i2o_pci_free(c);
- return -ENOMEM;
- }
-@@ -252,7 +207,10 @@ static int __devinit i2o_pci_alloc(struc
- return -ENOMEM;
- }
-
-- if (i2o_dma_alloc(dev, &c->out_queue, MSG_POOL_SIZE, GFP_KERNEL)) {
-+ if (i2o_dma_alloc
-+ (dev, &c->out_queue,
-+ I2O_MAX_OUTBOUND_MSG_FRAMES * I2O_OUTBOUND_MSG_FRAME_SIZE *
-+ sizeof(u32), GFP_KERNEL)) {
- i2o_pci_free(c);
- return -ENOMEM;
- }
-@@ -274,56 +232,30 @@ static int __devinit i2o_pci_alloc(struc
- static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r)
- {
- struct i2o_controller *c = dev_id;
-- struct device *dev = &c->pdev->dev;
-- struct i2o_message *m;
-- u32 mv;
-- u32 *msg;
--
-- /*
-- * Old 960 steppings had a bug in the I2O unit that caused
-- * the queue to appear empty when it wasn't.
-- */
-- mv = I2O_REPLY_READ32(c);
-- if (mv == I2O_QUEUE_EMPTY) {
-- mv = I2O_REPLY_READ32(c);
-- if (unlikely(mv == I2O_QUEUE_EMPTY)) {
-- return IRQ_NONE;
-- } else
-- pr_debug("960 bug detected\n");
-- }
--
-- while (mv != I2O_QUEUE_EMPTY) {
-- /*
-- * Map the message from the page frame map to kernel virtual.
-- * Because bus_to_virt is deprecated, we have calculate the
-- * location by ourself!
-- */
-- m = (struct i2o_message *)(mv -
-- (unsigned long)c->out_queue.phys +
-- (unsigned long)c->out_queue.virt);
-+ u32 m;
-+ irqreturn_t rc = IRQ_NONE;
-
-- msg = (u32 *) m;
--
-- /*
-- * Ensure this message is seen coherently but cachably by
-- * the processor
-- */
-- dma_sync_single_for_cpu(dev, c->out_queue.phys, MSG_FRAME_SIZE,
-- PCI_DMA_FROMDEVICE);
-+ while (readl(c->irq_status) & I2O_IRQ_OUTBOUND_POST) {
-+ m = readl(c->out_port);
-+ if (m == I2O_QUEUE_EMPTY) {
-+ /*
-+ * Old 960 steppings had a bug in the I2O unit that
-+ * caused the queue to appear empty when it wasn't.
-+ */
-+ m = readl(c->out_port);
-+ if (unlikely(m == I2O_QUEUE_EMPTY))
-+ break;
-+ }
-
- /* dispatch it */
-- if (i2o_driver_dispatch(c, mv, m))
-+ if (i2o_driver_dispatch(c, m))
- /* flush it if result != 0 */
-- i2o_flush_reply(c, mv);
-+ i2o_flush_reply(c, m);
-
-- /*
-- * That 960 bug again...
-- */
-- mv = I2O_REPLY_READ32(c);
-- if (mv == I2O_QUEUE_EMPTY)
-- mv = I2O_REPLY_READ32(c);
-+ rc = IRQ_HANDLED;
- }
-- return IRQ_HANDLED;
-+
-+ return rc;
- }
-
- /**
-@@ -339,7 +271,7 @@ static int i2o_pci_irq_enable(struct i2o
- struct pci_dev *pdev = c->pdev;
- int rc;
-
-- I2O_IRQ_WRITE32(c, 0xffffffff);
-+ writel(0xffffffff, c->irq_mask);
-
- if (pdev->irq) {
- rc = request_irq(pdev->irq, i2o_pci_interrupt, SA_SHIRQ,
-@@ -351,7 +283,7 @@ static int i2o_pci_irq_enable(struct i2o
- }
- }
-
-- I2O_IRQ_WRITE32(c, 0x00000000);
-+ writel(0x00000000, c->irq_mask);
-
- printk(KERN_INFO "%s: Installed at IRQ %d\n", c->name, pdev->irq);
-
-@@ -366,7 +298,7 @@ static int i2o_pci_irq_enable(struct i2o
- */
- static void i2o_pci_irq_disable(struct i2o_controller *c)
- {
-- I2O_IRQ_WRITE32(c, 0xffffffff);
-+ writel(0xffffffff, c->irq_mask);
-
- if (c->pdev->irq > 0)
- free_irq(c->pdev->irq, c);
-@@ -388,28 +320,27 @@ static int __devinit i2o_pci_probe(struc
- {
- struct i2o_controller *c;
- int rc;
-+ struct pci_dev *i960 = NULL;
-+ int enabled = pdev->is_enabled;
-
- printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n");
-
- if ((pdev->class & 0xff) > 1) {
-- printk(KERN_WARNING "i2o: I2O controller found but does not "
-- "support I2O 1.5 (skipping).\n");
-+ printk(KERN_WARNING "i2o: %s does not support I2O 1.5 "
-+ "(skipping).\n", pci_name(pdev));
- return -ENODEV;
- }
-
-- if ((rc = pci_enable_device(pdev))) {
-- printk(KERN_WARNING "i2o: I2O controller found but could not be"
-- " enabled.\n");
-- return rc;
-- }
--
-- printk(KERN_INFO "i2o: I2O controller found on bus %d at %d.\n",
-- pdev->bus->number, pdev->devfn);
-+ if (!enabled)
-+ if ((rc = pci_enable_device(pdev))) {
-+ printk(KERN_WARNING "i2o: couldn't enable device %s\n",
-+ pci_name(pdev));
-+ return rc;
-+ }
-
- if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
-- printk(KERN_WARNING "i2o: I2O controller on bus %d at %d: No "
-- "suitable DMA available!\n", pdev->bus->number,
-- pdev->devfn);
-+ printk(KERN_WARNING "i2o: no suitable DMA found for %s\n",
-+ pci_name(pdev));
- rc = -ENODEV;
- goto disable;
- }
-@@ -418,48 +349,87 @@ static int __devinit i2o_pci_probe(struc
-
- c = i2o_iop_alloc();
- if (IS_ERR(c)) {
-- printk(KERN_ERR "i2o: memory for I2O controller could not be "
-- "allocated\n");
-+ printk(KERN_ERR "i2o: couldn't allocate memory for %s\n",
-+ pci_name(pdev));
- rc = PTR_ERR(c);
- goto disable;
-- }
-+ } else
-+ printk(KERN_INFO "%s: controller found (%s)\n", c->name,
-+ pci_name(pdev));
-
- c->pdev = pdev;
-- c->device = pdev->dev;
-+ c->device.parent = &pdev->dev;
-
- /* Cards that fall apart if you hit them with large I/O loads... */
- if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) {
- c->short_req = 1;
-- printk(KERN_INFO "i2o: Symbios FC920 workarounds activated.\n");
-+ printk(KERN_INFO "%s: Symbios FC920 workarounds activated.\n",
-+ c->name);
- }
-
- if (pdev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) {
-+ /*
-+ * Expose the ship behind i960 for initialization, or it will
-+ * failed
-+ */
-+ i960 =
-+ pci_find_slot(c->pdev->bus->number,
-+ PCI_DEVFN(PCI_SLOT(c->pdev->devfn), 0));
-+
-+ if (i960)
-+ pci_write_config_word(i960, 0x42, 0);
-+
- c->promise = 1;
-- printk(KERN_INFO "i2o: Promise workarounds activated.\n");
-+ c->limit_sectors = 1;
- }
-
-+ if (pdev->subsystem_vendor == PCI_VENDOR_ID_DPT)
-+ c->adaptec = 1;
-+
- /* Cards that go bananas if you quiesce them before you reset them. */
- if (pdev->vendor == PCI_VENDOR_ID_DPT) {
- c->no_quiesce = 1;
- if (pdev->device == 0xa511)
- c->raptor = 1;
-+
-+ if (pdev->subsystem_device == 0xc05a) {
-+ c->limit_sectors = 1;
-+ printk(KERN_INFO
-+ "%s: limit sectors per request to %d\n", c->name,
-+ I2O_MAX_SECTORS_LIMITED);
-+ }
-+#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
-+ if (sizeof(dma_addr_t) > 4) {
-+ if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
-+ printk(KERN_INFO "%s: 64-bit DMA unavailable\n",
-+ c->name);
-+ else {
-+ c->pae_support = 1;
-+ printk(KERN_INFO "%s: using 64-bit DMA\n",
-+ c->name);
-+ }
-+ }
-+#endif
- }
-
- if ((rc = i2o_pci_alloc(c))) {
-- printk(KERN_ERR "i2o: DMA / IO allocation for I2O controller "
-- " failed\n");
-+ printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
-+ "failed\n", c->name);
- goto free_controller;
- }
-
- if (i2o_pci_irq_enable(c)) {
-- printk(KERN_ERR "i2o: unable to enable interrupts for I2O "
-- "controller\n");
-+ printk(KERN_ERR "%s: unable to enable interrupts for I2O "
-+ "controller\n", c->name);
- goto free_pci;
- }
-
- if ((rc = i2o_iop_add(c)))
- goto uninstall;
-
-+ if (i960)
-+ pci_write_config_word(i960, 0x42, 0x03ff);
-+
- return 0;
-
- uninstall:
-@@ -472,7 +442,8 @@ static int __devinit i2o_pci_probe(struc
- i2o_iop_free(c);
-
- disable:
-- pci_disable_device(pdev);
-+ if (!enabled)
-+ pci_disable_device(pdev);
-
- return rc;
- }
-@@ -493,15 +464,16 @@ static void __devexit i2o_pci_remove(str
- i2o_pci_irq_disable(c);
- i2o_pci_free(c);
-
-+ pci_disable_device(pdev);
-+
- printk(KERN_INFO "%s: Controller removed.\n", c->name);
-
-- i2o_iop_free(c);
-- pci_disable_device(pdev);
-+ put_device(&c->device);
- };
-
- /* PCI driver for I2O controller */
- static struct pci_driver i2o_pci_driver = {
-- .name = "I2O controller",
-+ .name = "PCI_I2O",
- .id_table = i2o_pci_ids,
- .probe = i2o_pci_probe,
- .remove = __devexit_p(i2o_pci_remove),
-@@ -525,4 +497,4 @@ void __exit i2o_pci_exit(void)
- pci_unregister_driver(&i2o_pci_driver);
- };
-
--EXPORT_SYMBOL(i2o_dma_realloc);
-+MODULE_DEVICE_TABLE(pci, i2o_pci_ids);
---- ./include/linux/i2o-dev.h.i2o 2004-10-19 01:53:21.000000000 +0400
-+++ ./include/linux/i2o-dev.h 2006-09-08 16:10:52.000000000 +0400
-@@ -24,6 +24,13 @@
- #define MAX_I2O_CONTROLLERS 32
-
- //#include <linux/ioctl.h>
-+#ifndef __KERNEL__
-+
-+typedef unsigned char u8;
-+typedef unsigned short u16;
-+typedef unsigned int u32;
-+
-+#endif /* __KERNEL__ */
-
- /*
- * I2O Control IOCTLs and structures
-@@ -113,6 +120,10 @@ struct i2o_evt_get {
- int lost;
- };
-
-+typedef struct i2o_sg_io_hdr {
-+ unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */
-+} i2o_sg_io_hdr_t;
-+
- /**************************************************************************
- * HRT related constants and structures
- **************************************************************************/
-@@ -126,14 +137,6 @@ struct i2o_evt_get {
- #define I2O_BUS_CARDBUS 7
- #define I2O_BUS_UNKNOWN 0x80
-
--#ifndef __KERNEL__
--
--typedef unsigned char u8;
--typedef unsigned short u16;
--typedef unsigned int u32;
--
--#endif /* __KERNEL__ */
--
- typedef struct _i2o_pci_bus {
- u8 PciFunctionNumber;
- u8 PciDeviceNumber;
-@@ -333,7 +336,7 @@ typedef struct _i2o_status_block {
- #define I2O_CLASS_ATE_PERIPHERAL 0x061
- #define I2O_CLASS_FLOPPY_CONTROLLER 0x070
- #define I2O_CLASS_FLOPPY_DEVICE 0x071
--#define I2O_CLASS_BUS_ADAPTER_PORT 0x080
-+#define I2O_CLASS_BUS_ADAPTER 0x080
- #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090
- #define I2O_CLASS_PEER_TRANSPORT 0x091
- #define I2O_CLASS_END 0xfff
-@@ -399,4 +402,26 @@ typedef struct _i2o_status_block {
- #define ADAPTER_STATE_FAILED 0x10
- #define ADAPTER_STATE_FAULTED 0x11
-
-+/*
-+ * Software module types
-+ */
-+#define I2O_SOFTWARE_MODULE_IRTOS 0x11
-+#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22
-+#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23
-+
-+/*
-+ * Vendors
-+ */
-+#define I2O_VENDOR_DPT 0x001b
-+
-+/*
-+ * DPT / Adaptec specific values for i2o_sg_io_hdr flags.
-+ */
-+#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000
-+#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000
-+
-+#define I2O_DPT_FLASH_FRAG_SIZE 0x10000
-+#define I2O_DPT_FLASH_READ 0x0101
-+#define I2O_DPT_FLASH_WRITE 0x0102
-+
- #endif /* _I2O_DEV_H */
---- ./include/linux/i2o.h.i2o 2006-08-23 11:10:17.000000000 +0400
-+++ ./include/linux/i2o.h 2006-09-08 16:10:52.000000000 +0400
-@@ -23,173 +23,543 @@
- #include <linux/i2o-dev.h>
-
- /* How many different OSM's are we allowing */
--#define I2O_MAX_DRIVERS 4
-+#define I2O_MAX_DRIVERS 8
-
--#include <asm/io.h>
--#include <asm/semaphore.h> /* Needed for MUTEX init macros */
- #include <linux/pci.h>
- #include <linux/dma-mapping.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+#include <linux/workqueue.h> /* work_struct */
-+#include <linux/mempool.h>
-+
-+#include <asm/io.h>
-+#include <asm/semaphore.h> /* Needed for MUTEX init macros */
-
- /* message queue empty */
- #define I2O_QUEUE_EMPTY 0xffffffff
-
- /*
-- * Message structures
-+ * Cache strategies
- */
--struct i2o_message {
-- union {
-- struct {
-- u8 version_offset;
-- u8 flags;
-- u16 size;
-- u32 target_tid:12;
-- u32 init_tid:12;
-- u32 function:8;
-- u32 icntxt; /* initiator context */
-- u32 tcntxt; /* transaction context */
-- } s;
-- u32 head[4];
-- } u;
-- /* List follows */
-- u32 body[0];
--};
-
--/*
-- * Each I2O device entity has one of these. There is one per device.
-+/* The NULL strategy leaves everything up to the controller. This tends to be a
-+ * pessimal but functional choice.
- */
--struct i2o_device {
-- i2o_lct_entry lct_data; /* Device LCT information */
--
-- struct i2o_controller *iop; /* Controlling IOP */
-- struct list_head list; /* node in IOP devices list */
--
-- struct device device;
-+#define CACHE_NULL 0
-+/* Prefetch data when reading. We continually attempt to load the next 32 sectors
-+ * into the controller cache.
-+ */
-+#define CACHE_PREFETCH 1
-+/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
-+ * into the controller cache. When an I/O is less <= 8K we assume its probably
-+ * not sequential and don't prefetch (default)
-+ */
-+#define CACHE_SMARTFETCH 2
-+/* Data is written to the cache and then out on to the disk. The I/O must be
-+ * physically on the medium before the write is acknowledged (default without
-+ * NVRAM)
-+ */
-+#define CACHE_WRITETHROUGH 17
-+/* Data is written to the cache and then out on to the disk. The controller
-+ * is permitted to write back the cache any way it wants. (default if battery
-+ * backed NVRAM is present). It can be useful to set this for swap regardless of
-+ * battery state.
-+ */
-+#define CACHE_WRITEBACK 18
-+/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
-+ * write large I/O's directly to disk bypassing the cache to avoid the extra
-+ * memory copy hits. Small writes are writeback cached
-+ */
-+#define CACHE_SMARTBACK 19
-+/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
-+ * write large I/O's directly to disk bypassing the cache to avoid the extra
-+ * memory copy hits. Small writes are writethrough cached. Suitable for devices
-+ * lacking battery backup
-+ */
-+#define CACHE_SMARTTHROUGH 20
-
-- struct semaphore lock; /* device lock */
-+/*
-+ * Ioctl structures
-+ */
-
-- struct class_device classdev; /* i2o device class */
--};
-+#define BLKI2OGRSTRAT _IOR('2', 1, int)
-+#define BLKI2OGWSTRAT _IOR('2', 2, int)
-+#define BLKI2OSRSTRAT _IOW('2', 3, int)
-+#define BLKI2OSWSTRAT _IOW('2', 4, int)
-
- /*
-- * Event structure provided to the event handling function
-+ * I2O Function codes
- */
--struct i2o_event {
-- struct work_struct work;
-- struct i2o_device *i2o_dev; /* I2O device pointer from which the
-- event reply was initiated */
-- u16 size; /* Size of data in 32-bit words */
-- u32 tcntxt; /* Transaction context used at
-- registration */
-- u32 event_indicator; /* Event indicator from reply */
-- u32 data[0]; /* Event data from reply */
--};
-
- /*
-- * I2O classes which could be handled by the OSM
-+ * Executive Class
- */
--struct i2o_class_id {
-- u16 class_id:12;
--};
-+#define I2O_CMD_ADAPTER_ASSIGN 0xB3
-+#define I2O_CMD_ADAPTER_READ 0xB2
-+#define I2O_CMD_ADAPTER_RELEASE 0xB5
-+#define I2O_CMD_BIOS_INFO_SET 0xA5
-+#define I2O_CMD_BOOT_DEVICE_SET 0xA7
-+#define I2O_CMD_CONFIG_VALIDATE 0xBB
-+#define I2O_CMD_CONN_SETUP 0xCA
-+#define I2O_CMD_DDM_DESTROY 0xB1
-+#define I2O_CMD_DDM_ENABLE 0xD5
-+#define I2O_CMD_DDM_QUIESCE 0xC7
-+#define I2O_CMD_DDM_RESET 0xD9
-+#define I2O_CMD_DDM_SUSPEND 0xAF
-+#define I2O_CMD_DEVICE_ASSIGN 0xB7
-+#define I2O_CMD_DEVICE_RELEASE 0xB9
-+#define I2O_CMD_HRT_GET 0xA8
-+#define I2O_CMD_ADAPTER_CLEAR 0xBE
-+#define I2O_CMD_ADAPTER_CONNECT 0xC9
-+#define I2O_CMD_ADAPTER_RESET 0xBD
-+#define I2O_CMD_LCT_NOTIFY 0xA2
-+#define I2O_CMD_OUTBOUND_INIT 0xA1
-+#define I2O_CMD_PATH_ENABLE 0xD3
-+#define I2O_CMD_PATH_QUIESCE 0xC5
-+#define I2O_CMD_PATH_RESET 0xD7
-+#define I2O_CMD_STATIC_MF_CREATE 0xDD
-+#define I2O_CMD_STATIC_MF_RELEASE 0xDF
-+#define I2O_CMD_STATUS_GET 0xA0
-+#define I2O_CMD_SW_DOWNLOAD 0xA9
-+#define I2O_CMD_SW_UPLOAD 0xAB
-+#define I2O_CMD_SW_REMOVE 0xAD
-+#define I2O_CMD_SYS_ENABLE 0xD1
-+#define I2O_CMD_SYS_MODIFY 0xC1
-+#define I2O_CMD_SYS_QUIESCE 0xC3
-+#define I2O_CMD_SYS_TAB_SET 0xA3
-
- /*
-- * I2O driver structure for OSMs
-+ * Utility Class
- */
--struct i2o_driver {
-- char *name; /* OSM name */
-- int context; /* Low 8 bits of the transaction info */
-- struct i2o_class_id *classes; /* I2O classes that this OSM handles */
--
-- /* Message reply handler */
-- int (*reply) (struct i2o_controller *, u32, struct i2o_message *);
--
-- /* Event handler */
-- void (*event) (struct i2o_event *);
--
-- struct workqueue_struct *event_queue; /* Event queue */
--
-- struct device_driver driver;
--
-- /* notification of changes */
-- void (*notify_controller_add) (struct i2o_controller *);
-- void (*notify_controller_remove) (struct i2o_controller *);
-- void (*notify_device_add) (struct i2o_device *);
-- void (*notify_device_remove) (struct i2o_device *);
--
-- struct semaphore lock;
--};
-+#define I2O_CMD_UTIL_NOP 0x00
-+#define I2O_CMD_UTIL_ABORT 0x01
-+#define I2O_CMD_UTIL_CLAIM 0x09
-+#define I2O_CMD_UTIL_RELEASE 0x0B
-+#define I2O_CMD_UTIL_PARAMS_GET 0x06
-+#define I2O_CMD_UTIL_PARAMS_SET 0x05
-+#define I2O_CMD_UTIL_EVT_REGISTER 0x13
-+#define I2O_CMD_UTIL_EVT_ACK 0x14
-+#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
-+#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
-+#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
-+#define I2O_CMD_UTIL_LOCK 0x17
-+#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
-+#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
-
- /*
-- * Contains all information which are necessary for DMA operations
-+ * SCSI Host Bus Adapter Class
- */
--struct i2o_dma {
-- void *virt;
-- dma_addr_t phys;
-- u32 len;
--};
-+#define I2O_CMD_SCSI_EXEC 0x81
-+#define I2O_CMD_SCSI_ABORT 0x83
-+#define I2O_CMD_SCSI_BUSRESET 0x27
-
- /*
-- * Context queue entry, used for 32-bit context on 64-bit systems
-+ * Bus Adapter Class
- */
--struct i2o_context_list_element {
-- struct list_head list;
-- u32 context;
-- void *ptr;
-- unsigned long timestamp;
--};
-+#define I2O_CMD_BUS_ADAPTER_RESET 0x85
-+#define I2O_CMD_BUS_RESET 0x87
-+#define I2O_CMD_BUS_SCAN 0x89
-+#define I2O_CMD_BUS_QUIESCE 0x8b
-
- /*
-- * Each I2O controller has one of these objects
-+ * Random Block Storage Class
- */
--struct i2o_controller {
-- char name[16];
-- int unit;
-- int type;
--
-- struct pci_dev *pdev; /* PCI device */
-+#define I2O_CMD_BLOCK_READ 0x30
-+#define I2O_CMD_BLOCK_WRITE 0x31
-+#define I2O_CMD_BLOCK_CFLUSH 0x37
-+#define I2O_CMD_BLOCK_MLOCK 0x49
-+#define I2O_CMD_BLOCK_MUNLOCK 0x4B
-+#define I2O_CMD_BLOCK_MMOUNT 0x41
-+#define I2O_CMD_BLOCK_MEJECT 0x43
-+#define I2O_CMD_BLOCK_POWER 0x70
-
-- int short_req:1; /* use small block sizes */
-- int no_quiesce:1; /* dont quiesce before reset */
-- int raptor:1; /* split bar */
-- int promise:1; /* Promise controller */
--
--#ifdef CONFIG_MTRR
-- int mtrr_reg0;
-- int mtrr_reg1;
--#endif
-+#define I2O_CMD_PRIVATE 0xFF
-
-- struct list_head devices; /* list of I2O devices */
-+/* Command status values */
-
-- struct notifier_block *event_notifer; /* Events */
-- atomic_t users;
-- struct list_head list; /* Controller list */
-- void *post_port; /* Inbout port address */
-- void *reply_port; /* Outbound port address */
-- void *irq_mask; /* Interrupt register address */
-+#define I2O_CMD_IN_PROGRESS 0x01
-+#define I2O_CMD_REJECTED 0x02
-+#define I2O_CMD_FAILED 0x03
-+#define I2O_CMD_COMPLETED 0x04
-
-- /* Dynamic LCT related data */
-+/* I2O API function return values */
-
-- struct i2o_dma status; /* status of IOP */
-+#define I2O_RTN_NO_ERROR 0
-+#define I2O_RTN_NOT_INIT 1
-+#define I2O_RTN_FREE_Q_EMPTY 2
-+#define I2O_RTN_TCB_ERROR 3
-+#define I2O_RTN_TRANSACTION_ERROR 4
-+#define I2O_RTN_ADAPTER_ALREADY_INIT 5
-+#define I2O_RTN_MALLOC_ERROR 6
-+#define I2O_RTN_ADPTR_NOT_REGISTERED 7
-+#define I2O_RTN_MSG_REPLY_TIMEOUT 8
-+#define I2O_RTN_NO_STATUS 9
-+#define I2O_RTN_NO_FIRM_VER 10
-+#define I2O_RTN_NO_LINK_SPEED 11
-
-- struct i2o_dma hrt; /* HW Resource Table */
-- i2o_lct *lct; /* Logical Config Table */
-- struct i2o_dma dlct; /* Temp LCT */
-- struct semaphore lct_lock; /* Lock for LCT updates */
-- struct i2o_dma status_block; /* IOP status block */
-+/* Reply message status defines for all messages */
-
-- struct i2o_dma base; /* controller messaging unit */
-- struct i2o_dma in_queue; /* inbound message queue Host->IOP */
-- struct i2o_dma out_queue; /* outbound message queue IOP->Host */
-+#define I2O_REPLY_STATUS_SUCCESS 0x00
-+#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
-+#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
-+#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
-+#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
-+#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
-+#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
-+#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
-+#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
-+#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
-+#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
-+#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
-
-- int battery:1; /* Has a battery backup */
-- int io_alloc:1; /* An I/O resource was allocated */
-- int mem_alloc:1; /* A memory resource was allocated */
-+/* Status codes and Error Information for Parameter functions */
-
-- struct resource io_resource; /* I/O resource allocated to the IOP */
-- struct resource mem_resource; /* Mem resource allocated to the IOP */
-+#define I2O_PARAMS_STATUS_SUCCESS 0x00
-+#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
-+#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
-+#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
-+#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
-+#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
-+#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
-+#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
-+#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
-+#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
-+#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
-+#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
-+#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
-+#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
-+#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
-+#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
-+#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
-
-- struct proc_dir_entry *proc_entry; /* /proc dir */
-+/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
-+ * messages: Table 3-2 Detailed Status Codes.*/
-+
-+#define I2O_DSC_SUCCESS 0x0000
-+#define I2O_DSC_BAD_KEY 0x0002
-+#define I2O_DSC_TCL_ERROR 0x0003
-+#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
-+#define I2O_DSC_NO_SUCH_PAGE 0x0005
-+#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
-+#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
-+#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
-+#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
-+#define I2O_DSC_DEVICE_LOCKED 0x000B
-+#define I2O_DSC_DEVICE_RESET 0x000C
-+#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
-+#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
-+#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
-+#define I2O_DSC_INVALID_OFFSET 0x0010
-+#define I2O_DSC_INVALID_PARAMETER 0x0011
-+#define I2O_DSC_INVALID_REQUEST 0x0012
-+#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
-+#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
-+#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
-+#define I2O_DSC_MISSING_PARAMETER 0x0016
-+#define I2O_DSC_TIMEOUT 0x0017
-+#define I2O_DSC_UNKNOWN_ERROR 0x0018
-+#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
-+#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
-+#define I2O_DSC_DEVICE_BUSY 0x001B
-+#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
-+
-+/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
-+ Status Codes.*/
-+
-+#define I2O_BSA_DSC_SUCCESS 0x0000
-+#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
-+#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
-+#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
-+#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
-+#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
-+#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
-+#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
-+#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
-+#define I2O_BSA_DSC_BUS_FAILURE 0x0009
-+#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
-+#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
-+#define I2O_BSA_DSC_DEVICE_RESET 0x000C
-+#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
-+#define I2O_BSA_DSC_TIMEOUT 0x000E
-+
-+/* FailureStatusCodes, Table 3-3 Message Failure Codes */
-+
-+#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
-+#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
-+#define I2O_FSC_TRANSPORT_CONGESTION 0x83
-+#define I2O_FSC_TRANSPORT_FAILURE 0x84
-+#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
-+#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
-+#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
-+#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
-+#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
-+#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
-+#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
-+#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
-+#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
-+#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
-+#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
-+#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
-+
-+/* Device Claim Types */
-+#define I2O_CLAIM_PRIMARY 0x01000000
-+#define I2O_CLAIM_MANAGEMENT 0x02000000
-+#define I2O_CLAIM_AUTHORIZED 0x03000000
-+#define I2O_CLAIM_SECONDARY 0x04000000
-+
-+/* Message header defines for VersionOffset */
-+#define I2OVER15 0x0001
-+#define I2OVER20 0x0002
-+
-+/* Default is 1.5 */
-+#define I2OVERSION I2OVER15
-+
-+#define SGL_OFFSET_0 I2OVERSION
-+#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
-+#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
-+#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
-+#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
-+#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
-+#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
-+#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
-+#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
-+#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
-+#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
-+
-+/* Transaction Reply Lists (TRL) Control Word structure */
-+#define TRL_SINGLE_FIXED_LENGTH 0x00
-+#define TRL_SINGLE_VARIABLE_LENGTH 0x40
-+#define TRL_MULTIPLE_FIXED_LENGTH 0x80
-+
-+ /* msg header defines for MsgFlags */
-+#define MSG_STATIC 0x0100
-+#define MSG_64BIT_CNTXT 0x0200
-+#define MSG_MULTI_TRANS 0x1000
-+#define MSG_FAIL 0x2000
-+#define MSG_FINAL 0x4000
-+#define MSG_REPLY 0x8000
-+
-+ /* minimum size msg */
-+#define THREE_WORD_MSG_SIZE 0x00030000
-+#define FOUR_WORD_MSG_SIZE 0x00040000
-+#define FIVE_WORD_MSG_SIZE 0x00050000
-+#define SIX_WORD_MSG_SIZE 0x00060000
-+#define SEVEN_WORD_MSG_SIZE 0x00070000
-+#define EIGHT_WORD_MSG_SIZE 0x00080000
-+#define NINE_WORD_MSG_SIZE 0x00090000
-+#define TEN_WORD_MSG_SIZE 0x000A0000
-+#define ELEVEN_WORD_MSG_SIZE 0x000B0000
-+#define I2O_MESSAGE_SIZE(x) ((x)<<16)
-+
-+/* special TID assignments */
-+#define ADAPTER_TID 0
-+#define HOST_TID 1
-+
-+/* outbound queue defines */
-+#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
-+#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
-+
-+/* inbound queue definitions */
-+#define I2O_MSG_INPOOL_MIN 32
-+#define I2O_INBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
-+
-+#define I2O_POST_WAIT_OK 0
-+#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
-+
-+#define I2O_CONTEXT_LIST_MIN_LENGTH 15
-+#define I2O_CONTEXT_LIST_USED 0x01
-+#define I2O_CONTEXT_LIST_DELETED 0x02
-+
-+/* timeouts */
-+#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
-+#define I2O_TIMEOUT_MESSAGE_GET 5
-+#define I2O_TIMEOUT_RESET 30
-+#define I2O_TIMEOUT_STATUS_GET 5
-+#define I2O_TIMEOUT_LCT_GET 360
-+#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
-+
-+/* retries */
-+#define I2O_HRT_GET_TRIES 3
-+#define I2O_LCT_GET_TRIES 3
-+
-+/* defines for max_sectors and max_phys_segments */
-+#define I2O_MAX_SECTORS 1024
-+#define I2O_MAX_SECTORS_LIMITED 128
-+#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
-+
-+/*
-+ * Message structures
-+ */
-+struct i2o_message {
-+ union {
-+ struct {
-+ u8 version_offset;
-+ u8 flags;
-+ u16 size;
-+ u32 target_tid:12;
-+ u32 init_tid:12;
-+ u32 function:8;
-+ u32 icntxt; /* initiator context */
-+ u32 tcntxt; /* transaction context */
-+ } s;
-+ u32 head[4];
-+ } u;
-+ /* List follows */
-+ u32 body[0];
-+};
-+
-+/* MFA and I2O message used by mempool */
-+struct i2o_msg_mfa {
-+ u32 mfa; /* MFA returned by the controller */
-+ struct i2o_message msg; /* I2O message */
-+};
-+
-+/*
-+ * Each I2O device entity has one of these. There is one per device.
-+ */
-+struct i2o_device {
-+ i2o_lct_entry lct_data; /* Device LCT information */
-+
-+ struct i2o_controller *iop; /* Controlling IOP */
-+ struct list_head list; /* node in IOP devices list */
-+
-+ struct device device;
-+
-+ struct semaphore lock; /* device lock */
-+};
-+
-+/*
-+ * Event structure provided to the event handling function
-+ */
-+struct i2o_event {
-+ struct work_struct work;
-+ struct i2o_device *i2o_dev; /* I2O device pointer from which the
-+ event reply was initiated */
-+ u16 size; /* Size of data in 32-bit words */
-+ u32 tcntxt; /* Transaction context used at
-+ registration */
-+ u32 event_indicator; /* Event indicator from reply */
-+ u32 data[0]; /* Event data from reply */
-+};
-+
-+/*
-+ * I2O classes which could be handled by the OSM
-+ */
-+struct i2o_class_id {
-+ u16 class_id:12;
-+};
-+
-+/*
-+ * I2O driver structure for OSMs
-+ */
-+struct i2o_driver {
-+ char *name; /* OSM name */
-+ int context; /* Low 8 bits of the transaction info */
-+ struct i2o_class_id *classes; /* I2O classes that this OSM handles */
-+
-+ /* Message reply handler */
-+ int (*reply) (struct i2o_controller *, u32, struct i2o_message *);
-+
-+ /* Event handler */
-+ void (*event) (struct i2o_event *);
-+
-+ struct workqueue_struct *event_queue; /* Event queue */
-+
-+ struct device_driver driver;
-+
-+ /* notification of changes */
-+ void (*notify_controller_add) (struct i2o_controller *);
-+ void (*notify_controller_remove) (struct i2o_controller *);
-+ void (*notify_device_add) (struct i2o_device *);
-+ void (*notify_device_remove) (struct i2o_device *);
-+
-+ struct semaphore lock;
-+};
-+
-+/*
-+ * Contains DMA mapped address information
-+ */
-+struct i2o_dma {
-+ void *virt;
-+ dma_addr_t phys;
-+ size_t len;
-+};
-+
-+/*
-+ * Contains slab cache and mempool information
-+ */
-+struct i2o_pool {
-+ char *name;
-+ kmem_cache_t *slab;
-+ mempool_t *mempool;
-+};
-+
-+/*
-+ * Contains IO mapped address information
-+ */
-+struct i2o_io {
-+ void __iomem *virt;
-+ unsigned long phys;
-+ unsigned long len;
-+};
-+
-+/*
-+ * Context queue entry, used for 32-bit context on 64-bit systems
-+ */
-+struct i2o_context_list_element {
-+ struct list_head list;
-+ u32 context;
-+ void *ptr;
-+ unsigned long timestamp;
-+};
-+
-+/*
-+ * Each I2O controller has one of these objects
-+ */
-+struct i2o_controller {
-+ char name[16];
-+ int unit;
-+ int type;
-+
-+ struct pci_dev *pdev; /* PCI device */
-+
-+ unsigned int promise:1; /* Promise controller */
-+ unsigned int adaptec:1; /* DPT / Adaptec controller */
-+ unsigned int raptor:1; /* split bar */
-+ unsigned int no_quiesce:1; /* dont quiesce before reset */
-+ unsigned int short_req:1; /* use small block sizes */
-+ unsigned int limit_sectors:1; /* limit number of sectors / request */
-+ unsigned int pae_support:1; /* controller has 64-bit SGL support */
-+
-+ struct list_head devices; /* list of I2O devices */
-+ struct list_head list; /* Controller list */
-+
-+ void __iomem *in_port; /* Inbout port address */
-+ void __iomem *out_port; /* Outbound port address */
-+ void __iomem *irq_status; /* Interrupt status register address */
-+ void __iomem *irq_mask; /* Interrupt mask register address */
-+
-+ struct i2o_dma status; /* IOP status block */
-+
-+ struct i2o_dma hrt; /* HW Resource Table */
-+ i2o_lct *lct; /* Logical Config Table */
-+ struct i2o_dma dlct; /* Temp LCT */
-+ struct semaphore lct_lock; /* Lock for LCT updates */
-+ struct i2o_dma status_block; /* IOP status block */
-+
-+ struct i2o_io base; /* controller messaging unit */
-+ struct i2o_io in_queue; /* inbound message queue Host->IOP */
-+ struct i2o_dma out_queue; /* outbound message queue IOP->Host */
-+
-+ struct i2o_pool in_msg; /* mempool for inbound messages */
-+
-+ unsigned int battery:1; /* Has a battery backup */
-+ unsigned int io_alloc:1; /* An I/O resource was allocated */
-+ unsigned int mem_alloc:1; /* A memory resource was allocated */
-+
-+ struct resource io_resource; /* I/O resource allocated to the IOP */
-+ struct resource mem_resource; /* Mem resource allocated to the IOP */
-
-- struct list_head bus_list; /* list of busses on IOP */
- struct device device;
- struct i2o_device *exec; /* Executive */
- #if BITS_PER_LONG == 64
-@@ -241,29 +611,17 @@ struct i2o_sys_tbl {
- extern struct list_head i2o_controllers;
-
- /* Message functions */
--static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message **);
--extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message **,
-- int);
--static inline void i2o_msg_post(struct i2o_controller *, u32);
--static inline int i2o_msg_post_wait(struct i2o_controller *, u32,
-- unsigned long);
--extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
-- struct i2o_dma *);
--extern void i2o_msg_nop(struct i2o_controller *, u32);
-+static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
-+extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
-+static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
-+static inline int i2o_msg_post_wait(struct i2o_controller *,
-+ struct i2o_message *, unsigned long);
-+extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
-+ unsigned long, struct i2o_dma *);
- static inline void i2o_flush_reply(struct i2o_controller *, u32);
-
--/* DMA handling functions */
--static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t,
-- unsigned int);
--static inline void i2o_dma_free(struct device *, struct i2o_dma *);
--int i2o_dma_realloc(struct device *, struct i2o_dma *, size_t, unsigned int);
--
--static inline int i2o_dma_map(struct device *, struct i2o_dma *);
--static inline void i2o_dma_unmap(struct device *, struct i2o_dma *);
--
- /* IOP functions */
- extern int i2o_status_get(struct i2o_controller *);
--extern int i2o_hrt_get(struct i2o_controller *);
-
- extern int i2o_event_register(struct i2o_device *, struct i2o_driver *, int,
- u32);
-@@ -286,6 +644,16 @@ static inline u32 i2o_ptr_high(void *ptr
- {
- return (u32) ((u64) ptr >> 32);
- };
-+
-+static inline u32 i2o_dma_low(dma_addr_t dma_addr)
-+{
-+ return (u32) (u64) dma_addr;
-+};
-+
-+static inline u32 i2o_dma_high(dma_addr_t dma_addr)
-+{
-+ return (u32) ((u64) dma_addr >> 32);
-+};
- #else
- static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
- {
-@@ -316,189 +684,163 @@ static inline u32 i2o_ptr_high(void *ptr
- {
- return 0;
- };
--#endif
--
--/* I2O driver (OSM) functions */
--extern int i2o_driver_register(struct i2o_driver *);
--extern void i2o_driver_unregister(struct i2o_driver *);
--
--/**
-- * i2o_driver_notify_controller_add - Send notification of added controller
-- * to a single I2O driver
-- *
-- * Send notification of added controller to a single registered driver.
-- */
--static inline void i2o_driver_notify_controller_add(struct i2o_driver *drv,
-- struct i2o_controller *c)
--{
-- if (drv->notify_controller_add)
-- drv->notify_controller_add(c);
--};
--
--/**
-- * i2o_driver_notify_controller_remove - Send notification of removed
-- * controller to a single I2O driver
-- *
-- * Send notification of removed controller to a single registered driver.
-- */
--static inline void i2o_driver_notify_controller_remove(struct i2o_driver *drv,
-- struct i2o_controller *c)
--{
-- if (drv->notify_controller_remove)
-- drv->notify_controller_remove(c);
--};
--
--/**
-- * i2o_driver_notify_device_add - Send notification of added device to a
-- * single I2O driver
-- *
-- * Send notification of added device to a single registered driver.
-- */
--static inline void i2o_driver_notify_device_add(struct i2o_driver *drv,
-- struct i2o_device *i2o_dev)
--{
-- if (drv->notify_device_add)
-- drv->notify_device_add(i2o_dev);
--};
--
--/**
-- * i2o_driver_notify_device_remove - Send notification of removed device
-- * to a single I2O driver
-- *
-- * Send notification of removed device to a single registered driver.
-- */
--static inline void i2o_driver_notify_device_remove(struct i2o_driver *drv,
-- struct i2o_device *i2o_dev)
--{
-- if (drv->notify_device_remove)
-- drv->notify_device_remove(i2o_dev);
--};
--
--extern void i2o_driver_notify_controller_add_all(struct i2o_controller *);
--extern void i2o_driver_notify_controller_remove_all(struct i2o_controller *);
--extern void i2o_driver_notify_device_add_all(struct i2o_device *);
--extern void i2o_driver_notify_device_remove_all(struct i2o_device *);
--
--/* I2O device functions */
--extern int i2o_device_claim(struct i2o_device *);
--extern int i2o_device_claim_release(struct i2o_device *);
--
--/* Exec OSM functions */
--extern int i2o_exec_lct_get(struct i2o_controller *);
--extern int i2o_exec_lct_notify(struct i2o_controller *, u32);
--
--/* device to i2o_device and driver to i2o_driver convertion functions */
--#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
--#define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
--
--/*
-- * Messenger inlines
-- */
--static inline u32 I2O_POST_READ32(struct i2o_controller *c)
--{
-- rmb();
-- return readl(c->post_port);
--};
--
--static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val)
--{
-- wmb();
-- writel(val, c->post_port);
--};
--
--static inline u32 I2O_REPLY_READ32(struct i2o_controller *c)
--{
-- rmb();
-- return readl(c->reply_port);
--};
--
--static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val)
--{
-- wmb();
-- writel(val, c->reply_port);
--};
--
--static inline u32 I2O_IRQ_READ32(struct i2o_controller *c)
--{
-- rmb();
-- return readl(c->irq_mask);
--};
-
--static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val)
-+static inline u32 i2o_dma_low(dma_addr_t dma_addr)
- {
-- wmb();
-- writel(val, c->irq_mask);
-- wmb();
-+ return (u32) dma_addr;
- };
-
--/**
-- * i2o_msg_get - obtain an I2O message from the IOP
-- * @c: I2O controller
-- * @msg: pointer to a I2O message pointer
-- *
-- * This function tries to get a message slot. If no message slot is
-- * available do not wait until one is availabe (see also i2o_msg_get_wait).
-- *
-- * On a success the message is returned and the pointer to the message is
-- * set in msg. The returned message is the physical page frame offset
-- * address from the read port (see the i2o spec). If no message is
-- * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
-- */
--static inline u32 i2o_msg_get(struct i2o_controller *c,
-- struct i2o_message **msg)
--{
-- u32 m;
--
-- if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY)
-- *msg = c->in_queue.virt + m;
--
-- return m;
-+static inline u32 i2o_dma_high(dma_addr_t dma_addr)
-+{
-+ return 0;
- };
-+#endif
-
- /**
-- * i2o_msg_post - Post I2O message to I2O controller
-- * @c: I2O controller to which the message should be send
-- * @m: the message identifier
-+ * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL
-+ * @c: I2O controller for which the calculation should be done
-+ * @body_size: maximum body size used for message in 32-bit words.
- *
-- * Post the message to the I2O controller.
-+ * Return the maximum number of SG elements in a SG list.
- */
--static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
-+static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
- {
-- I2O_POST_WRITE32(c, m);
-+ i2o_status_block *sb = c->status_block.virt;
-+ u16 sg_count =
-+ (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
-+ body_size;
-+
-+ if (c->pae_support) {
-+ /*
-+ * for 64-bit a SG attribute element must be added and each
-+ * SG element needs 12 bytes instead of 8.
-+ */
-+ sg_count -= 2;
-+ sg_count /= 3;
-+ } else
-+ sg_count /= 2;
-+
-+ if (c->short_req && (sg_count > 8))
-+ sg_count = 8;
-+
-+ return sg_count;
- };
-
- /**
-- * i2o_msg_post_wait - Post and wait a message and wait until return
-- * @c: controller
-- * @m: message to post
-- * @timeout: time in seconds to wait
-+ * i2o_dma_map_single - Map pointer to controller and fill in I2O message.
-+ * @c: I2O controller
-+ * @ptr: pointer to the data which should be mapped
-+ * @size: size of data in bytes
-+ * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
-+ * @sg_ptr: pointer to the SG list inside the I2O message
- *
-- * This API allows an OSM to post a message and then be told whether or
-- * not the system received a successful reply. If the message times out
-- * then the value '-ETIMEDOUT' is returned.
-+ * This function does all necessary DMA handling and also writes the I2O
-+ * SGL elements into the I2O message. For details on DMA handling see also
-+ * dma_map_single(). The pointer sg_ptr will only be set to the end of the
-+ * SG list if the allocation was successful.
- *
-- * Returns 0 on success or negative error code on failure.
-+ * Returns DMA address which must be checked for failures using
-+ * dma_mapping_error().
- */
--static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m,
-- unsigned long timeout)
--{
-- return i2o_msg_post_wait_mem(c, m, timeout, NULL);
-+static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
-+ size_t size,
-+ enum dma_data_direction direction,
-+ u32 ** sg_ptr)
-+{
-+ u32 sg_flags;
-+ u32 *mptr = *sg_ptr;
-+ dma_addr_t dma_addr;
-+
-+ switch (direction) {
-+ case DMA_TO_DEVICE:
-+ sg_flags = 0xd4000000;
-+ break;
-+ case DMA_FROM_DEVICE:
-+ sg_flags = 0xd0000000;
-+ break;
-+ default:
-+ return 0;
-+ }
-+
-+ dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
-+ if (!dma_mapping_error(dma_addr)) {
-+#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
-+ if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
-+ *mptr++ = cpu_to_le32(0x7C020002);
-+ *mptr++ = cpu_to_le32(PAGE_SIZE);
-+ }
-+#endif
-+
-+ *mptr++ = cpu_to_le32(sg_flags | size);
-+ *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
-+#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
-+ if ((sizeof(dma_addr_t) > 4) && c->pae_support)
-+ *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
-+#endif
-+ *sg_ptr = mptr;
-+ }
-+ return dma_addr;
- };
-
- /**
-- * i2o_flush_reply - Flush reply from I2O controller
-+ * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message.
- * @c: I2O controller
-- * @m: the message identifier
-+ * @sg: SG list to be mapped
-+ * @sg_count: number of elements in the SG list
-+ * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
-+ * @sg_ptr: pointer to the SG list inside the I2O message
- *
-- * The I2O controller must be informed that the reply message is not needed
-- * anymore. If you forget to flush the reply, the message frame can't be
-- * used by the controller anymore and is therefore lost.
-+ * This function does all necessary DMA handling and also writes the I2O
-+ * SGL elements into the I2O message. For details on DMA handling see also
-+ * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG
-+ * list if the allocation was successful.
- *
-- * FIXME: is there a timeout after which the controller reuse the message?
-+ * Returns 0 on failure or 1 on success.
- */
--static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
--{
-- I2O_REPLY_WRITE32(c, m);
-+static inline int i2o_dma_map_sg(struct i2o_controller *c,
-+ struct scatterlist *sg, int sg_count,
-+ enum dma_data_direction direction,
-+ u32 ** sg_ptr)
-+{
-+ u32 sg_flags;
-+ u32 *mptr = *sg_ptr;
-+
-+ switch (direction) {
-+ case DMA_TO_DEVICE:
-+ sg_flags = 0x14000000;
-+ break;
-+ case DMA_FROM_DEVICE:
-+ sg_flags = 0x10000000;
-+ break;
-+ default:
-+ return 0;
-+ }
-+
-+ sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction);
-+ if (!sg_count)
-+ return 0;
-+
-+#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
-+ if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
-+ *mptr++ = cpu_to_le32(0x7C020002);
-+ *mptr++ = cpu_to_le32(PAGE_SIZE);
-+ }
-+#endif
-+
-+ while (sg_count-- > 0) {
-+ if (!sg_count)
-+ sg_flags |= 0xC0000000;
-+ *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
-+ *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
-+#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
-+ if ((sizeof(dma_addr_t) > 4) && c->pae_support)
-+ *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
-+#endif
-+ sg++;
-+ }
-+ *sg_ptr = mptr;
-+
-+ return 1;
- };
-
- /**
-@@ -513,9 +855,23 @@ static inline void i2o_flush_reply(struc
- * Returns 0 on success or -ENOMEM on failure.
- */
- static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
-- size_t len, unsigned int gfp_mask)
-+ size_t len, gfp_t gfp_mask)
- {
-+ struct pci_dev *pdev = to_pci_dev(dev);
-+ int dma_64 = 0;
-+
-+ if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
-+ dma_64 = 1;
-+ if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
-+ return -ENOMEM;
-+ }
-+
- addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
-+
-+ if ((sizeof(dma_addr_t) > 4) && dma_64)
-+ if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
-+ printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
-+
- if (!addr->virt)
- return -ENOMEM;
-
-@@ -545,415 +901,360 @@ static inline void i2o_dma_free(struct d
- };
-
- /**
-- * i2o_dma_map - Map the memory to DMA
-+ * i2o_dma_realloc - Realloc DMA memory
- * @dev: struct device pointer to the PCI device of the I2O controller
-- * @addr: i2o_dma struct which should be mapped
-+ * @addr: pointer to a i2o_dma struct DMA buffer
-+ * @len: new length of memory
-+ * @gfp_mask: GFP mask
- *
-- * Map the memory in addr->virt to coherent DMA memory and write the
-- * physical address into addr->phys.
-+ * If there was something allocated in the addr, free it first. If len > 0
-+ * than try to allocate it and write the addresses back to the addr
-+ * structure. If len == 0 set the virtual address to NULL.
- *
-- * Returns 0 on success or -ENOMEM on failure.
-+ * Returns the 0 on success or negative error code on failure.
- */
--static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr)
-+static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
-+ size_t len, gfp_t gfp_mask)
- {
-- if (!addr->virt)
-- return -EFAULT;
-+ i2o_dma_free(dev, addr);
-
-- if (!addr->phys)
-- addr->phys = dma_map_single(dev, addr->virt, addr->len,
-- DMA_BIDIRECTIONAL);
-- if (!addr->phys)
-- return -ENOMEM;
-+ if (len)
-+ return i2o_dma_alloc(dev, addr, len, gfp_mask);
-
- return 0;
- };
-
--/**
-- * i2o_dma_unmap - Unmap the DMA memory
-- * @dev: struct device pointer to the PCI device of the I2O controller
-- * @addr: i2o_dma struct which should be unmapped
-+/*
-+ * i2o_pool_alloc - Allocate an slab cache and mempool
-+ * @mempool: pointer to struct i2o_pool to write data into.
-+ * @name: name which is used to identify cache
-+ * @size: size of each object
-+ * @min_nr: minimum number of objects
- *
-- * Unmap the memory in addr->virt from DMA memory.
-+ * First allocates a slab cache with name and size. Then allocates a
-+ * mempool which uses the slab cache for allocation and freeing.
-+ *
-+ * Returns 0 on success or negative error code on failure.
- */
--static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr)
-+static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
-+ size_t size, int min_nr)
- {
-- if (!addr->virt)
-- return;
--
-- if (addr->phys) {
-- dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL);
-- addr->phys = 0;
-- }
--};
--
--/*
-- * Endian handling wrapped into the macro - keeps the core code
-- * cleaner.
-- */
--
--#define i2o_raw_writel(val, mem) __raw_writel(cpu_to_le32(val), mem)
--
--extern int i2o_parm_field_get(struct i2o_device *, int, int, void *, int);
--extern int i2o_parm_field_set(struct i2o_device *, int, int, void *, int);
--extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
-- void *, int);
--/* FIXME: remove
--extern int i2o_query_table(int, struct i2o_controller *, int, int, int,
-- void *, int, void *, int);
--extern int i2o_clear_table(struct i2o_controller *, int, int);
--extern int i2o_row_add_table(struct i2o_controller *, int, int, int,
-- void *, int);
--extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int,
-- void *, int);
--*/
--
--/* debugging functions */
--extern void i2o_report_status(const char *, const char *, struct i2o_message *);
--extern void i2o_dump_message(struct i2o_message *);
--extern void i2o_dump_hrt(struct i2o_controller *c);
--extern void i2o_debug_state(struct i2o_controller *c);
--
--/*
-- * Cache strategies
-- */
-+ pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
-+ if (!pool->name)
-+ goto exit;
-+ strcpy(pool->name, name);
-+
-+ pool->slab =
-+ kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL,
-+ NULL);
-+ if (!pool->slab)
-+ goto free_name;
-+
-+ pool->mempool = mempool_create(min_nr, mempool_alloc_slab,
-+ mempool_free_slab, pool->slab);
-+ if (!pool->mempool)
-+ goto free_slab;
-
--/* The NULL strategy leaves everything up to the controller. This tends to be a
-- * pessimal but functional choice.
-- */
--#define CACHE_NULL 0
--/* Prefetch data when reading. We continually attempt to load the next 32 sectors
-- * into the controller cache.
-- */
--#define CACHE_PREFETCH 1
--/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
-- * into the controller cache. When an I/O is less <= 8K we assume its probably
-- * not sequential and don't prefetch (default)
-- */
--#define CACHE_SMARTFETCH 2
--/* Data is written to the cache and then out on to the disk. The I/O must be
-- * physically on the medium before the write is acknowledged (default without
-- * NVRAM)
-- */
--#define CACHE_WRITETHROUGH 17
--/* Data is written to the cache and then out on to the disk. The controller
-- * is permitted to write back the cache any way it wants. (default if battery
-- * backed NVRAM is present). It can be useful to set this for swap regardless of
-- * battery state.
-- */
--#define CACHE_WRITEBACK 18
--/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
-- * write large I/O's directly to disk bypassing the cache to avoid the extra
-- * memory copy hits. Small writes are writeback cached
-- */
--#define CACHE_SMARTBACK 19
--/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
-- * write large I/O's directly to disk bypassing the cache to avoid the extra
-- * memory copy hits. Small writes are writethrough cached. Suitable for devices
-- * lacking battery backup
-- */
--#define CACHE_SMARTTHROUGH 20
-+ return 0;
-
--/*
-- * Ioctl structures
-- */
-+ free_slab:
-+ kmem_cache_destroy(pool->slab);
-
--#define BLKI2OGRSTRAT _IOR('2', 1, int)
--#define BLKI2OGWSTRAT _IOR('2', 2, int)
--#define BLKI2OSRSTRAT _IOW('2', 3, int)
--#define BLKI2OSWSTRAT _IOW('2', 4, int)
-+ free_name:
-+ kfree(pool->name);
-
--/*
-- * I2O Function codes
-- */
-+ exit:
-+ return -ENOMEM;
-+};
-
- /*
-- * Executive Class
-+ * i2o_pool_free - Free slab cache and mempool again
-+ * @mempool: pointer to struct i2o_pool which should be freed
-+ *
-+ * Note that you have to return all objects to the mempool again before
-+ * calling i2o_pool_free().
- */
--#define I2O_CMD_ADAPTER_ASSIGN 0xB3
--#define I2O_CMD_ADAPTER_READ 0xB2
--#define I2O_CMD_ADAPTER_RELEASE 0xB5
--#define I2O_CMD_BIOS_INFO_SET 0xA5
--#define I2O_CMD_BOOT_DEVICE_SET 0xA7
--#define I2O_CMD_CONFIG_VALIDATE 0xBB
--#define I2O_CMD_CONN_SETUP 0xCA
--#define I2O_CMD_DDM_DESTROY 0xB1
--#define I2O_CMD_DDM_ENABLE 0xD5
--#define I2O_CMD_DDM_QUIESCE 0xC7
--#define I2O_CMD_DDM_RESET 0xD9
--#define I2O_CMD_DDM_SUSPEND 0xAF
--#define I2O_CMD_DEVICE_ASSIGN 0xB7
--#define I2O_CMD_DEVICE_RELEASE 0xB9
--#define I2O_CMD_HRT_GET 0xA8
--#define I2O_CMD_ADAPTER_CLEAR 0xBE
--#define I2O_CMD_ADAPTER_CONNECT 0xC9
--#define I2O_CMD_ADAPTER_RESET 0xBD
--#define I2O_CMD_LCT_NOTIFY 0xA2
--#define I2O_CMD_OUTBOUND_INIT 0xA1
--#define I2O_CMD_PATH_ENABLE 0xD3
--#define I2O_CMD_PATH_QUIESCE 0xC5
--#define I2O_CMD_PATH_RESET 0xD7
--#define I2O_CMD_STATIC_MF_CREATE 0xDD
--#define I2O_CMD_STATIC_MF_RELEASE 0xDF
--#define I2O_CMD_STATUS_GET 0xA0
--#define I2O_CMD_SW_DOWNLOAD 0xA9
--#define I2O_CMD_SW_UPLOAD 0xAB
--#define I2O_CMD_SW_REMOVE 0xAD
--#define I2O_CMD_SYS_ENABLE 0xD1
--#define I2O_CMD_SYS_MODIFY 0xC1
--#define I2O_CMD_SYS_QUIESCE 0xC3
--#define I2O_CMD_SYS_TAB_SET 0xA3
-+static inline void i2o_pool_free(struct i2o_pool *pool)
-+{
-+ mempool_destroy(pool->mempool);
-+ kmem_cache_destroy(pool->slab);
-+ kfree(pool->name);
-+};
-
--/*
-- * Utility Class
-- */
--#define I2O_CMD_UTIL_NOP 0x00
--#define I2O_CMD_UTIL_ABORT 0x01
--#define I2O_CMD_UTIL_CLAIM 0x09
--#define I2O_CMD_UTIL_RELEASE 0x0B
--#define I2O_CMD_UTIL_PARAMS_GET 0x06
--#define I2O_CMD_UTIL_PARAMS_SET 0x05
--#define I2O_CMD_UTIL_EVT_REGISTER 0x13
--#define I2O_CMD_UTIL_EVT_ACK 0x14
--#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
--#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
--#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
--#define I2O_CMD_UTIL_LOCK 0x17
--#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
--#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
-+/* I2O driver (OSM) functions */
-+extern int i2o_driver_register(struct i2o_driver *);
-+extern void i2o_driver_unregister(struct i2o_driver *);
-
--/*
-- * SCSI Host Bus Adapter Class
-+/**
-+ * i2o_driver_notify_controller_add - Send notification of added controller
-+ * to a single I2O driver
-+ *
-+ * Send notification of added controller to a single registered driver.
- */
--#define I2O_CMD_SCSI_EXEC 0x81
--#define I2O_CMD_SCSI_ABORT 0x83
--#define I2O_CMD_SCSI_BUSRESET 0x27
-+static inline void i2o_driver_notify_controller_add(struct i2o_driver *drv,
-+ struct i2o_controller *c)
-+{
-+ if (drv->notify_controller_add)
-+ drv->notify_controller_add(c);
-+};
-
--/*
-- * Random Block Storage Class
-+/**
-+ * i2o_driver_notify_controller_remove - Send notification of removed
-+ * controller to a single I2O driver
-+ *
-+ * Send notification of removed controller to a single registered driver.
- */
--#define I2O_CMD_BLOCK_READ 0x30
--#define I2O_CMD_BLOCK_WRITE 0x31
--#define I2O_CMD_BLOCK_CFLUSH 0x37
--#define I2O_CMD_BLOCK_MLOCK 0x49
--#define I2O_CMD_BLOCK_MUNLOCK 0x4B
--#define I2O_CMD_BLOCK_MMOUNT 0x41
--#define I2O_CMD_BLOCK_MEJECT 0x43
--#define I2O_CMD_BLOCK_POWER 0x70
--
--#define I2O_PRIVATE_MSG 0xFF
--
--/* Command status values */
--
--#define I2O_CMD_IN_PROGRESS 0x01
--#define I2O_CMD_REJECTED 0x02
--#define I2O_CMD_FAILED 0x03
--#define I2O_CMD_COMPLETED 0x04
--
--/* I2O API function return values */
--
--#define I2O_RTN_NO_ERROR 0
--#define I2O_RTN_NOT_INIT 1
--#define I2O_RTN_FREE_Q_EMPTY 2
--#define I2O_RTN_TCB_ERROR 3
--#define I2O_RTN_TRANSACTION_ERROR 4
--#define I2O_RTN_ADAPTER_ALREADY_INIT 5
--#define I2O_RTN_MALLOC_ERROR 6
--#define I2O_RTN_ADPTR_NOT_REGISTERED 7
--#define I2O_RTN_MSG_REPLY_TIMEOUT 8
--#define I2O_RTN_NO_STATUS 9
--#define I2O_RTN_NO_FIRM_VER 10
--#define I2O_RTN_NO_LINK_SPEED 11
--
--/* Reply message status defines for all messages */
--
--#define I2O_REPLY_STATUS_SUCCESS 0x00
--#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
--#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
--#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
--#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
--#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
--#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
--#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
--#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
--#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
--#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
--#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
-+static inline void i2o_driver_notify_controller_remove(struct i2o_driver *drv,
-+ struct i2o_controller *c)
-+{
-+ if (drv->notify_controller_remove)
-+ drv->notify_controller_remove(c);
-+};
-
--/* Status codes and Error Information for Parameter functions */
-+/**
-+ * i2o_driver_notify_device_add - Send notification of added device to a
-+ * single I2O driver
-+ *
-+ * Send notification of added device to a single registered driver.
-+ */
-+static inline void i2o_driver_notify_device_add(struct i2o_driver *drv,
-+ struct i2o_device *i2o_dev)
-+{
-+ if (drv->notify_device_add)
-+ drv->notify_device_add(i2o_dev);
-+};
-
--#define I2O_PARAMS_STATUS_SUCCESS 0x00
--#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
--#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
--#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
--#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
--#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
--#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
--#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
--#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
--#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
--#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
--#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
--#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
--#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
--#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
--#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
--#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
-+/**
-+ * i2o_driver_notify_device_remove - Send notification of removed device
-+ * to a single I2O driver
-+ *
-+ * Send notification of removed device to a single registered driver.
-+ */
-+static inline void i2o_driver_notify_device_remove(struct i2o_driver *drv,
-+ struct i2o_device *i2o_dev)
-+{
-+ if (drv->notify_device_remove)
-+ drv->notify_device_remove(i2o_dev);
-+};
-
--/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
-- * messages: Table 3-2 Detailed Status Codes.*/
-+extern void i2o_driver_notify_controller_add_all(struct i2o_controller *);
-+extern void i2o_driver_notify_controller_remove_all(struct i2o_controller *);
-+extern void i2o_driver_notify_device_add_all(struct i2o_device *);
-+extern void i2o_driver_notify_device_remove_all(struct i2o_device *);
-
--#define I2O_DSC_SUCCESS 0x0000
--#define I2O_DSC_BAD_KEY 0x0002
--#define I2O_DSC_TCL_ERROR 0x0003
--#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
--#define I2O_DSC_NO_SUCH_PAGE 0x0005
--#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
--#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
--#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
--#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
--#define I2O_DSC_DEVICE_LOCKED 0x000B
--#define I2O_DSC_DEVICE_RESET 0x000C
--#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
--#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
--#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
--#define I2O_DSC_INVALID_OFFSET 0x0010
--#define I2O_DSC_INVALID_PARAMETER 0x0011
--#define I2O_DSC_INVALID_REQUEST 0x0012
--#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
--#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
--#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
--#define I2O_DSC_MISSING_PARAMETER 0x0016
--#define I2O_DSC_TIMEOUT 0x0017
--#define I2O_DSC_UNKNOWN_ERROR 0x0018
--#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
--#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
--#define I2O_DSC_DEVICE_BUSY 0x001B
--#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
-+/* I2O device functions */
-+extern int i2o_device_claim(struct i2o_device *);
-+extern int i2o_device_claim_release(struct i2o_device *);
-
--/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
-- Status Codes.*/
-+/* Exec OSM functions */
-+extern int i2o_exec_lct_get(struct i2o_controller *);
-
--#define I2O_BSA_DSC_SUCCESS 0x0000
--#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
--#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
--#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
--#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
--#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
--#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
--#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
--#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
--#define I2O_BSA_DSC_BUS_FAILURE 0x0009
--#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
--#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
--#define I2O_BSA_DSC_DEVICE_RESET 0x000C
--#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
--#define I2O_BSA_DSC_TIMEOUT 0x000E
-+/* device / driver / kobject conversion functions */
-+#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
-+#define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
-+#define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device)
-+#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
-
--/* FailureStatusCodes, Table 3-3 Message Failure Codes */
-+/**
-+ * i2o_out_to_virt - Turn an I2O message to a virtual address
-+ * @c: controller
-+ * @m: message engine value
-+ *
-+ * Turn a receive message from an I2O controller bus address into
-+ * a Linux virtual address. The shared page frame is a linear block
-+ * so we simply have to shift the offset. This function does not
-+ * work for sender side messages as they are ioremap objects
-+ * provided by the I2O controller.
-+ */
-+static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
-+ u32 m)
-+{
-+ BUG_ON(m < c->out_queue.phys
-+ || m >= c->out_queue.phys + c->out_queue.len);
-
--#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
--#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
--#define I2O_FSC_TRANSPORT_CONGESTION 0x83
--#define I2O_FSC_TRANSPORT_FAILURE 0x84
--#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
--#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
--#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
--#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
--#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
--#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
--#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
--#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
--#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
--#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
--#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
--#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
-+ return c->out_queue.virt + (m - c->out_queue.phys);
-+};
-
--/* Device Claim Types */
--#define I2O_CLAIM_PRIMARY 0x01000000
--#define I2O_CLAIM_MANAGEMENT 0x02000000
--#define I2O_CLAIM_AUTHORIZED 0x03000000
--#define I2O_CLAIM_SECONDARY 0x04000000
-+/**
-+ * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
-+ * @c: controller
-+ * @m: message engine value
-+ *
-+ * Turn a send message from an I2O controller bus address into
-+ * a Linux virtual address. The shared page frame is a linear block
-+ * so we simply have to shift the offset. This function does not
-+ * work for receive side messages as they are kmalloc objects
-+ * in a different pool.
-+ */
-+static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
-+ i2o_controller *c,
-+ u32 m)
-+{
-+ return c->in_queue.virt + m;
-+};
-
--/* Message header defines for VersionOffset */
--#define I2OVER15 0x0001
--#define I2OVER20 0x0002
-+/**
-+ * i2o_msg_get - obtain an I2O message from the IOP
-+ * @c: I2O controller
-+ *
-+ * This function tries to get a message frame. If no message frame is
-+ * available do not wait until one is availabe (see also i2o_msg_get_wait).
-+ * The returned pointer to the message frame is not in I/O memory, it is
-+ * allocated from a mempool. But because a MFA is allocated from the
-+ * controller too it is guaranteed that i2o_msg_post() will never fail.
-+ *
-+ * On a success a pointer to the message frame is returned. If the message
-+ * queue is empty -EBUSY is returned and if no memory is available -ENOMEM
-+ * is returned.
-+ */
-+static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
-+{
-+ struct i2o_msg_mfa *mmsg = mempool_alloc(c->in_msg.mempool, GFP_ATOMIC);
-+ if (!mmsg)
-+ return ERR_PTR(-ENOMEM);
-
--/* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */
--#define I2OVERSION I2OVER15
-+ mmsg->mfa = readl(c->in_port);
-+ if (unlikely(mmsg->mfa >= c->in_queue.len)) {
-+ u32 mfa = mmsg->mfa;
-
--#define SGL_OFFSET_0 I2OVERSION
--#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
--#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
--#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
--#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
--#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
--#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
--#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
-+ mempool_free(mmsg, c->in_msg.mempool);
-
--#define TRL_OFFSET_5 (0x0050 | I2OVERSION)
--#define TRL_OFFSET_6 (0x0060 | I2OVERSION)
-+ if (mfa == I2O_QUEUE_EMPTY)
-+ return ERR_PTR(-EBUSY);
-+ return ERR_PTR(-EFAULT);
-+ }
-
--/* Transaction Reply Lists (TRL) Control Word structure */
--#define TRL_SINGLE_FIXED_LENGTH 0x00
--#define TRL_SINGLE_VARIABLE_LENGTH 0x40
--#define TRL_MULTIPLE_FIXED_LENGTH 0x80
-+ return &mmsg->msg;
-+};
-
-- /* msg header defines for MsgFlags */
--#define MSG_STATIC 0x0100
--#define MSG_64BIT_CNTXT 0x0200
--#define MSG_MULTI_TRANS 0x1000
--#define MSG_FAIL 0x2000
--#define MSG_FINAL 0x4000
--#define MSG_REPLY 0x8000
-+/**
-+ * i2o_msg_post - Post I2O message to I2O controller
-+ * @c: I2O controller to which the message should be send
-+ * @msg: message returned by i2o_msg_get()
-+ *
-+ * Post the message to the I2O controller and return immediately.
-+ */
-+static inline void i2o_msg_post(struct i2o_controller *c,
-+ struct i2o_message *msg)
-+{
-+ struct i2o_msg_mfa *mmsg;
-
-- /* minimum size msg */
--#define THREE_WORD_MSG_SIZE 0x00030000
--#define FOUR_WORD_MSG_SIZE 0x00040000
--#define FIVE_WORD_MSG_SIZE 0x00050000
--#define SIX_WORD_MSG_SIZE 0x00060000
--#define SEVEN_WORD_MSG_SIZE 0x00070000
--#define EIGHT_WORD_MSG_SIZE 0x00080000
--#define NINE_WORD_MSG_SIZE 0x00090000
--#define TEN_WORD_MSG_SIZE 0x000A0000
--#define ELEVEN_WORD_MSG_SIZE 0x000B0000
--#define I2O_MESSAGE_SIZE(x) ((x)<<16)
-+ mmsg = container_of(msg, struct i2o_msg_mfa, msg);
-+ memcpy_toio(i2o_msg_in_to_virt(c, mmsg->mfa), msg,
-+ (le32_to_cpu(msg->u.head[0]) >> 16) << 2);
-+ writel(mmsg->mfa, c->in_port);
-+ mempool_free(mmsg, c->in_msg.mempool);
-+};
-+
-+/**
-+ * i2o_msg_post_wait - Post and wait a message and wait until return
-+ * @c: controller
-+ * @m: message to post
-+ * @timeout: time in seconds to wait
-+ *
-+ * This API allows an OSM to post a message and then be told whether or
-+ * not the system received a successful reply. If the message times out
-+ * then the value '-ETIMEDOUT' is returned.
-+ *
-+ * Returns 0 on success or negative error code on failure.
-+ */
-+static inline int i2o_msg_post_wait(struct i2o_controller *c,
-+ struct i2o_message *msg,
-+ unsigned long timeout)
-+{
-+ return i2o_msg_post_wait_mem(c, msg, timeout, NULL);
-+};
-
--/* Special TID Assignments */
-+/**
-+ * i2o_msg_nop_mfa - Returns a fetched MFA back to the controller
-+ * @c: I2O controller from which the MFA was fetched
-+ * @mfa: MFA which should be returned
-+ *
-+ * This function must be used for preserved messages, because i2o_msg_nop()
-+ * also returns the allocated memory back to the msg_pool mempool.
-+ */
-+static inline void i2o_msg_nop_mfa(struct i2o_controller *c, u32 mfa)
-+{
-+ struct i2o_message __iomem *msg;
-+ u32 nop[3] = {
-+ THREE_WORD_MSG_SIZE | SGL_OFFSET_0,
-+ I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
-+ 0x00000000
-+ };
-+
-+ msg = i2o_msg_in_to_virt(c, mfa);
-+ memcpy_toio(msg, nop, sizeof(nop));
-+ writel(mfa, c->in_port);
-+};
-
--#define ADAPTER_TID 0
--#define HOST_TID 1
-+/**
-+ * i2o_msg_nop - Returns a message which is not used
-+ * @c: I2O controller from which the message was created
-+ * @msg: message which should be returned
-+ *
-+ * If you fetch a message via i2o_msg_get, and can't use it, you must
-+ * return the message with this function. Otherwise the MFA is lost as well
-+ * as the allocated memory from the mempool.
-+ */
-+static inline void i2o_msg_nop(struct i2o_controller *c,
-+ struct i2o_message *msg)
-+{
-+ struct i2o_msg_mfa *mmsg;
-+ mmsg = container_of(msg, struct i2o_msg_mfa, msg);
-
--#define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */
--#define REPLY_FRAME_SIZE 17
--#define SG_TABLESIZE 30
--#define NMBR_MSG_FRAMES 128
-+ i2o_msg_nop_mfa(c, mmsg->mfa);
-+ mempool_free(mmsg, c->in_msg.mempool);
-+};
-
--#define MSG_POOL_SIZE (MSG_FRAME_SIZE*NMBR_MSG_FRAMES*sizeof(u32))
-+/**
-+ * i2o_flush_reply - Flush reply from I2O controller
-+ * @c: I2O controller
-+ * @m: the message identifier
-+ *
-+ * The I2O controller must be informed that the reply message is not needed
-+ * anymore. If you forget to flush the reply, the message frame can't be
-+ * used by the controller anymore and is therefore lost.
-+ */
-+static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
-+{
-+ writel(m, c->out_port);
-+};
-
--#define I2O_POST_WAIT_OK 0
--#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
-+/*
-+ * Endian handling wrapped into the macro - keeps the core code
-+ * cleaner.
-+ */
-
--#define I2O_CONTEXT_LIST_MIN_LENGTH 15
--#define I2O_CONTEXT_LIST_USED 0x01
--#define I2O_CONTEXT_LIST_DELETED 0x02
-+#define i2o_raw_writel(val, mem) __raw_writel(cpu_to_le32(val), mem)
-
--/* timeouts */
--#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
--#define I2O_TIMEOUT_MESSAGE_GET 5
--#define I2O_TIMEOUT_RESET 30
--#define I2O_TIMEOUT_STATUS_GET 5
--#define I2O_TIMEOUT_LCT_GET 360
--#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
-+extern int i2o_parm_field_get(struct i2o_device *, int, int, void *, int);
-+extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
-+ void *, int);
-
--/* retries */
--#define I2O_HRT_GET_TRIES 3
--#define I2O_LCT_GET_TRIES 3
-+/* debugging and troubleshooting/diagnostic helpers. */
-+#define osm_printk(level, format, arg...) \
-+ printk(level "%s: " format, OSM_NAME , ## arg)
-+
-+#ifdef DEBUG
-+#define osm_debug(format, arg...) \
-+ osm_printk(KERN_DEBUG, format , ## arg)
-+#else
-+#define osm_debug(format, arg...) \
-+ do { } while (0)
-+#endif
-
--/* request queue sizes */
--#define I2O_MAX_SECTORS 1024
--#define I2O_MAX_SEGMENTS 128
-+#define osm_err(format, arg...) \
-+ osm_printk(KERN_ERR, format , ## arg)
-+#define osm_info(format, arg...) \
-+ osm_printk(KERN_INFO, format , ## arg)
-+#define osm_warn(format, arg...) \
-+ osm_printk(KERN_WARNING, format , ## arg)
-
--#define I2O_REQ_MEMPOOL_SIZE 32
-+/* debugging functions */
-+extern void i2o_report_status(const char *, const char *, struct i2o_message *);
-+extern void i2o_dump_message(struct i2o_message *);
-+extern void i2o_dump_hrt(struct i2o_controller *c);
-+extern void i2o_debug_state(struct i2o_controller *c);
-
- #endif /* __KERNEL__ */
- #endif /* _I2O_H */
diff --git a/openvz-sources/023.030/5135_linux-2.6.9-qla2xxx-8.01.05.patch b/openvz-sources/023.030/5135_linux-2.6.9-qla2xxx-8.01.05.patch
deleted file mode 100644
index 6f685a5..0000000
--- a/openvz-sources/023.030/5135_linux-2.6.9-qla2xxx-8.01.05.patch
+++ /dev/null
@@ -1,103977 +0,0 @@
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/Kconfig ./drivers/scsi/qla2xxx/Kconfig
---- ./drivers/scsi/qla2xxx.qla2xxx/Kconfig 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/Kconfig 2006-07-07 03:06:49.000000000 +0400
-@@ -3,17 +3,10 @@ config SCSI_QLA2XXX
- default (SCSI && PCI)
- depends on SCSI && PCI
-
--config QLA_IOCTLMOD
-- tristate
-- depends SCSI_QLA2XXX
-- ---help---
-- The ioctl interface for the Qlogic driver.
--
- config SCSI_QLA21XX
- tristate "QLogic ISP2100 host adapter family support"
- depends on SCSI_QLA2XXX
- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
- ---help---
- This driver supports the QLogic 21xx (ISP2100) host adapter family.
-
-@@ -21,41 +14,30 @@ config SCSI_QLA22XX
- tristate "QLogic ISP2200 host adapter family support"
- depends on SCSI_QLA2XXX
- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
- ---help---
- This driver supports the QLogic 22xx (ISP2200) host adapter family.
-
- config SCSI_QLA2300
-- tristate "QLogic ISP2300 host adapter family support"
-+ tristate "QLogic ISP2300/ISP6312 host adapter family support"
- depends on SCSI_QLA2XXX
- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
- ---help---
-- This driver supports the QLogic 2300 (ISP2300 and ISP2312) host
-- adapter family.
-+ This driver supports the QLogic 2300 (ISP2300, ISP2312 and
-+ ISP6312) host adapter family.
-
- config SCSI_QLA2322
-- tristate "QLogic ISP2322 host adapter family support"
-- depends on SCSI_QLA2XXX
-- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
-- ---help---
-- This driver supports the QLogic 2322 (ISP2322) host adapter family.
--
--config SCSI_QLA6312
-- tristate "QLogic ISP63xx host adapter family support"
-+ tristate "QLogic ISP2322/ISP6322 host adapter family support"
- depends on SCSI_QLA2XXX
- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
- ---help---
-- This driver supports the QLogic 63xx (ISP6312 and ISP6322) host
-+ This driver supports the QLogic 2322 (ISP2322 and ISP6322) host
- adapter family.
-
--config SCSI_QLA24XX
-- tristate "QLogic ISP24xx host adapter family support"
-+config SCSI_QLA2XXX_FAILOVER
-+ bool "QLogic ISP2xxx Driver-level Failover support"
- depends on SCSI_QLA2XXX
-- select SCSI_FC_ATTRS
-- select QLA_IOCTLMOD
- ---help---
-- This driver supports the QLogic 24xx (ISP2422 and ISP2432) host
-- adapter family.
-+ Compile the driver with failover support. Please review the driver
-+ documentation for further information on supported hosts and storage
-+ types.
-+
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/LICENSE.qla2xxx ./drivers/scsi/qla2xxx/LICENSE.qla2xxx
---- ./drivers/scsi/qla2xxx.qla2xxx/LICENSE.qla2xxx 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/LICENSE.qla2xxx 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,327 @@
-+Copyright (c) 2003-2006 QLogic Corporation
-+QLogic Linux Fibre Channel HBA Driver
-+
-+This program includes a device driver for Linux 2.6 that may be
-+distributed with QLogic hardware specific firmware binary file.
-+You may modify and redistribute the device driver code under the
-+GNU General Public License (a copy of which is attached hereto as
-+Exhibit A) published by the Free Software Foundation (version 2).
-+
-+You may redistribute the hardware specific firmware binary file
-+under the following terms:
-+
-+ 1. Redistribution of source code (only if applicable),
-+ must retain the above copyright notice, this list of
-+ conditions and the following disclaimer.
-+
-+ 2. Redistribution in binary form must reproduce the above
-+ copyright notice, this list of conditions and the
-+ following disclaimer in the documentation and/or other
-+ materials provided with the distribution.
-+
-+ 3. The name of QLogic Corporation may not be used to
-+ endorse or promote products derived from this software
-+ without specific prior written permission
-+
-+REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,
-+THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY
-+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-+POSSIBILITY OF SUCH DAMAGE.
-+
-+USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT
-+CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR
-+OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT,
-+TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN
-+ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN
-+COMBINATION WITH THIS PROGRAM.
-+
-+
-+EXHIBIT A
-+
-+ GNU GENERAL PUBLIC LICENSE
-+ Version 2, June 1991
-+
-+ Copyright (C) 1989, 1991 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.
-+
-+ Preamble
-+
-+ The licenses for most software are designed to take away your
-+freedom to share and change it. By contrast, the GNU General Public
-+License is intended to guarantee your freedom to share and change free
-+software--to make sure the software is free for all its users. This
-+General Public License applies to most of the Free Software
-+Foundation's software and to any other program whose authors commit to
-+using it. (Some other Free Software Foundation software is covered by
-+the GNU Lesser General Public License instead.) You can apply it to
-+your programs, too.
-+
-+ When we speak of free software, we are referring to freedom, 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 or use pieces of it
-+in new free programs; and that you know you can do these things.
-+
-+ To protect your rights, we need to make restrictions that forbid
-+anyone to deny you these rights or to ask you to surrender the rights.
-+These restrictions translate to certain responsibilities for you if you
-+distribute copies of the software, or if you modify it.
-+
-+ For example, if you distribute copies of such a program, whether
-+gratis or for a fee, you must give the recipients all the rights that
-+you have. You must make sure that they, too, receive or can get the
-+source code. And you must show them these terms so they know their
-+rights.
-+
-+ We protect your rights with two steps: (1) copyright the software, and
-+(2) offer you this license which gives you legal permission to copy,
-+distribute and/or modify the software.
-+
-+ Also, for each author's protection and ours, we want to make certain
-+that everyone understands that there is no warranty for this free
-+software. If the software is modified by someone else and passed on, we
-+want its recipients to know that what they have is not the original, so
-+that any problems introduced by others will not reflect on the original
-+authors' reputations.
-+
-+ Finally, any free program is threatened constantly by software
-+patents. We wish to avoid the danger that redistributors of a free
-+program will individually obtain patent licenses, in effect making the
-+program proprietary. To prevent this, we have made it clear that any
-+patent must be licensed for everyone's free use or not licensed at all.
-+
-+ The precise terms and conditions for copying, distribution and
-+modification follow.
-+
-+ GNU GENERAL PUBLIC LICENSE
-+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-+
-+ 0. This License applies to any program or other work which contains
-+a notice placed by the copyright holder saying it may be distributed
-+under the terms of this General Public License. The "Program", below,
-+refers to any such program or work, and a "work based on the Program"
-+means either the Program or any derivative work under copyright law:
-+that is to say, a work containing the Program or a portion of it,
-+either verbatim or with modifications and/or translated into another
-+language. (Hereinafter, translation is included without limitation in
-+the term "modification".) Each licensee is addressed as "you".
-+
-+Activities other than copying, distribution and modification are not
-+covered by this License; they are outside its scope. The act of
-+running the Program is not restricted, and the output from the Program
-+is covered only if its contents constitute a work based on the
-+Program (independent of having been made by running the Program).
-+Whether that is true depends on what the Program does.
-+
-+ 1. You may copy and distribute verbatim copies of the Program's
-+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 give any other recipients of the Program a copy of this License
-+along with the Program.
-+
-+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 Program or any portion
-+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
-+ stating that you changed the files and the date of any change.
-+
-+ b) You must cause any work that you distribute or publish, that in
-+ whole or in part contains or is derived from the Program or any
-+ part thereof, to be licensed as a whole at no charge to all third
-+ parties under the terms of this License.
-+
-+ c) If the modified program normally reads commands interactively
-+ when run, you must cause it, when started running for such
-+ interactive use in the most ordinary way, to print or display an
-+ announcement including an appropriate copyright notice and a
-+ notice that there is no warranty (or else, saying that you provide
-+ a warranty) and that users may redistribute the program under
-+ these conditions, and telling the user how to view a copy of this
-+ License. (Exception: if the Program itself is interactive but
-+ does not normally print such an announcement, your work based on
-+ the Program is not required to print an announcement.)
-+
-+These requirements apply to the modified work as a whole. If
-+identifiable sections of that work are not derived from the Program,
-+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 Program, 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 Program.
-+
-+In addition, mere aggregation of another work not based on the Program
-+with the Program (or with a work based on the Program) on a volume of
-+a storage or distribution medium does not bring the other work under
-+the scope of this License.
-+
-+ 3. You may copy and distribute the Program (or a work based on it,
-+under Section 2) in object code or executable form under the terms of
-+Sections 1 and 2 above provided that you also do one of the following:
-+
-+ a) 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; or,
-+
-+ b) Accompany it with a written offer, valid for at least three
-+ years, to give any third party, for a charge no more than your
-+ cost of physically performing source distribution, a complete
-+ machine-readable copy of the corresponding source code, to be
-+ distributed under the terms of Sections 1 and 2 above on a medium
-+ customarily used for software interchange; or,
-+
-+ c) Accompany it with the information you received as to the offer
-+ to distribute corresponding source code. (This alternative is
-+ allowed only for noncommercial distribution and only if you
-+ received the program in object code or executable form with such
-+ an offer, in accord with Subsection b above.)
-+
-+The source code for a work means the preferred form of the work for
-+making modifications to it. For an executable work, 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 executable. However, as a
-+special exception, the source code 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.
-+
-+If distribution of executable or 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 counts as
-+distribution of the source code, even though third parties are not
-+compelled to copy the source along with the object code.
-+
-+ 4. You may not copy, modify, sublicense, or distribute the Program
-+except as expressly provided under this License. Any attempt
-+otherwise to copy, modify, sublicense or distribute the Program 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.
-+
-+ 5. 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 Program or its derivative works. These actions are
-+prohibited by law if you do not accept this License. Therefore, by
-+modifying or distributing the Program (or any work based on the
-+Program), you indicate your acceptance of this License to do so, and
-+all its terms and conditions for copying, distributing or modifying
-+the Program or works based on it.
-+
-+ 6. Each time you redistribute the Program (or any work based on the
-+Program), the recipient automatically receives a license from the
-+original licensor to copy, distribute or modify the Program 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 to
-+this License.
-+
-+ 7. 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 Program at all. For example, if a patent
-+license would not permit royalty-free redistribution of the Program 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 Program.
-+
-+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.
-+
-+ 8. If the distribution and/or use of the Program is restricted in
-+certain countries either by patents or by copyrighted interfaces, the
-+original copyright holder who places the Program 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.
-+
-+ 9. The Free Software Foundation may publish revised and/or new versions
-+of the 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 Program
-+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 Program does not specify a version number of
-+this License, you may choose any version ever published by the Free Software
-+Foundation.
-+
-+ 10. If you wish to incorporate parts of the Program into other free
-+programs whose distribution conditions are different, 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
-+
-+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
-+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-+REPAIR OR CORRECTION.
-+
-+ 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
-+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-+POSSIBILITY OF SUCH DAMAGES.
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/Makefile ./drivers/scsi/qla2xxx/Makefile
---- ./drivers/scsi/qla2xxx.qla2xxx/Makefile 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/Makefile 2006-07-07 03:06:49.000000000 +0400
-@@ -1,23 +1,42 @@
- EXTRA_CFLAGS += -DUNIQUE_FW_NAME
-
--qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
-- qla_dbg.o qla_sup.o qla_rscn.o
-+# Force failover compilation
-+CONFIG_SCSI_QLA2XXX_FAILOVER=y
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA2XXX_FAILOVER
-+
-+# Handle all ISP2xxx builds.
-+CONFIG_SCSI_QLA21XX=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA21XX -DCONFIG_SCSI_QLA21XX_MODULE
-+CONFIG_SCSI_QLA22XX=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA22XX -DCONFIG_SCSI_QLA22XX_MODULE
-+CONFIG_SCSI_QLA2300=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA2300 -DCONFIG_SCSI_QLA2300_MODULE
-+CONFIG_SCSI_QLA2322=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA2322 -DCONFIG_SCSI_QLA2322_MODULE
-+CONFIG_SCSI_QLA24XX=m
-+EXTRA_CFLAGS += -DCONFIG_SCSI_QLA24XX -DCONFIG_SCSI_QLA24XX_MODULE
-
--qioctlmod-y := qim_os.o qim_xioct.o qim_mbx.o qim_sup.o qim_inioct.o \
-- qim_fo.o qim_32ioctl.o
-+qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
-+ qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o
-
-+qla2xxx-$(CONFIG_SCSI_QLA2XXX_FAILOVER) += qla_xioct.o qla_inioct.o \
-+ qla_fo.o qla_foln.o qla_cfg.o qla_cfgln.o qla_32ioctl.o qla_ip.o
-
- qla2100-y := ql2100.o ql2100_fw.o
- qla2200-y := ql2200.o ql2200_fw.o
- qla2300-y := ql2300.o ql2300_fw.o
- qla2322-y := ql2322.o ql2322_fw.o
--qla6312-y := ql6312.o ql2300_fw.o ql2322_fw.o
- qla2400-y := ql2400.o ql2400_fw.o
-
--obj-$(CONFIG_QLA_IOCTLMOD) += qioctlmod.o
-+host-progs := extras/qla_nvr extras/qla_opts
-+always := $(host-progs)
-+
- obj-$(CONFIG_SCSI_QLA21XX) += qla2xxx.o qla2100.o
- obj-$(CONFIG_SCSI_QLA22XX) += qla2xxx.o qla2200.o
- obj-$(CONFIG_SCSI_QLA2300) += qla2xxx.o qla2300.o
- obj-$(CONFIG_SCSI_QLA2322) += qla2xxx.o qla2322.o
--obj-$(CONFIG_SCSI_QLA6312) += qla2xxx.o qla6312.o
- obj-$(CONFIG_SCSI_QLA24XX) += qla2xxx.o qla2400.o
-+ifeq ($(CONFIG_SCSI_QLA2XXX_FAILOVER),y)
-+obj-m += qla2xxx_conf.o
-+obj-m += qla2xip.o
-+endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/exioct.h ./drivers/scsi/qla2xxx/exioct.h
---- ./drivers/scsi/qla2xxx.qla2xxx/exioct.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/exioct.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.4.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * File Name: exioct.h
-@@ -214,12 +202,18 @@
- * - Added new EXT_IOCTL structure definition and renamed old structure.
- *
- * Rev. 5.34 September 29, 2004
-- * RL - Packing the EXT_IOCTL structure.
-+ * RL - Packing the EXT_IOCTL structure.
- *
- * Rev. 5.35 February 18, 2005
-- * RL - Added DomainNr field in the EXT_CHIP structure to return PCI
-- * domain number used in Linux 2.6 kernel.
-+ * RL - Added DomainNr field in the EXT_CHIP structure to return PCI
-+ * domain number used in Linux 2.6 kernel.
- * - Added new PORTSPEED definitions.
-+ *
-+ * Rev. 5.36 October 11, 2005
-+ * RL - Added EXT_SC_GET_LUN_BY_Q subcode.
-+ *
-+ * Rev. 5.37 December 13, 2005
-+ * RL - Deleted EXT_DEF_ADDR_MODE define, which will no longer be used.
- */
-
- #ifndef _EXIOCT_H
-@@ -246,6 +240,9 @@
- #define EXT_DEF_MAX_STR_SIZE 128
- #define EXT_DEF_SCSI_PASSTHRU_CDB_LENGTH 16
-
-+/*
-+ * Addressing mode used by the user application
-+ */
- #define EXT_DEF_ADDR_MODE_32 1
- #define EXT_DEF_ADDR_MODE_64 2
-
-@@ -322,10 +319,6 @@ typedef struct {
- } __attribute__((packed)) EXT_IOCTL, *PEXT_IOCTL; /* 116 / 0x74 */
-
-
--/*
-- * Addressing mode used by the user application
-- */
--#define EXT_ADDR_MODE EXT_ADDR_MODE_OS
-
- /*
- * Status. These macros are being used for setting Status field in
-@@ -419,8 +412,6 @@ typedef struct {
- #define EXT_CC_RESERVED0H EXT_CC_RESERVED0H_OS
- #define EXT_CC_RESERVED0I EXT_CC_RESERVED0I_OS
- #define EXT_CC_RESERVED0J EXT_CC_RESERVED0J_OS
--#define EXT_CC_RESERVED0K EXT_CC_RESERVED0K_OS
--#define EXT_CC_RESERVED0L EXT_CC_RESERVED0L_OS
- #define EXT_CC_RESERVED0Z EXT_CC_RESERVED0Z_OS
-
-
-@@ -475,6 +466,7 @@ typedef struct {
- #define EXT_SC_GET_FLASH_RAM 7 /* for backward compatible */
- #define EXT_SC_GET_BEACON_STATE 8
- #define EXT_SC_GET_FC4_STATISTICS 9
-+#define EXT_SC_GET_LUN_BY_Q 10
-
- /* 100 - 199 FC_INTF_TYPE */
- #define EXT_SC_GET_LINK_STATUS 101 /* Currently Not Supported */
-@@ -787,8 +779,8 @@ typedef struct _EXT_CHIP {
- UINT16 ChipType; /* 2 */
- UINT16 InterruptLevel; /* 2 */
- UINT16 OutMbx[8]; /* 16 */
-- UINT16 PciDevFunc; /* 2 */
-- UINT16 DomainNr; /* 2 */
-+ UINT16 PciDevFunc; /* 2 */
-+ UINT16 DomainNr; /* 2 */
- UINT16 Reserved[14]; /* 28 */
- } EXT_CHIP, *PEXT_CHIP; /* 80 */
-
-@@ -1064,16 +1056,46 @@ typedef struct _EXT_ELS_PT_REQ {
- #define EXT_DEF_GRN_BLINK_ON 0x01ED0017
- #define EXT_DEF_GRN_BLINK_OFF 0x01ED00FF
-
--#define EXT_DEF_LED_COLOR_MASK 0x0000f000 /* all valid color bits */
--#define EXT_DEF_GRN_LED 0x00001000
--#define EXT_DEF_ORG_LED 0x00002000
--#define EXT_DEF_RED_LED 0x00004000
--
- typedef struct _EXT_BEACON_CONTROL {
- UINT32 State; /* 4 */
- UINT32 Reserved[3]; /* 12 */
- } EXT_BEACON_CONTROL , *PEXT_BEACON_CONTROL ; /* 16 */
-
-+#ifndef EXTERNAL_LUN_COUNT
-+#define EXTERNAL_LUN_COUNT 2048
-+#endif
-+
-+typedef struct _TGT_LUN_DATA_ENTRY {
-+ UINT8 NodeName[EXT_DEF_WWN_NAME_SIZE];
-+ UINT8 PortName[EXT_DEF_WWP_NAME_SIZE];
-+
-+ UINT16 LunCount; /* Valid entries in Data array. */
-+ UINT8 BusNumber;
-+ UINT8 TargetId;
-+ UINT8 DevType; /* Discovered target type */
-+ UINT8 LoopId;
-+ UINT16 Reserved3;
-+ UINT8 PortId[4];
-+ UINT32 Reserved5; /* Pad to 32-byte header.*/
-+
-+ UINT8 Data[EXTERNAL_LUN_COUNT];
-+} TGT_LUN_DATA_ENTRY, *PTGT_LUN_DATA_ENTRY;
-+
-+typedef struct _TGT_LUN_DATA_LIST {
-+ UINT16 Version; /* Should be LUN_DATA_REGISTRY_VERSION.*/
-+ UINT16 EntryCount; /* Number of DataEntry entries.*/
-+ UINT32 Reserved1;
-+ UINT32 Reserved2;
-+ UINT32 Reserved3;
-+ UINT32 Reserved4;
-+ UINT32 Reserved5;
-+ UINT32 Reserved6;
-+ UINT32 Reserved7; /* Pad to 32-byte header.*/
-+
-+ TGT_LUN_DATA_ENTRY DataEntry[1]; /* Variable-length data.*/
-+
-+} TGT_LUN_DATA_LIST, *PTGT_LUN_DATA_LIST;
-+
- #ifdef _MSC_VER
- #pragma pack()
- #endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/exioctln.h ./drivers/scsi/qla2xxx/exioctln.h
---- ./drivers/scsi/qla2xxx.qla2xxx/exioctln.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/exioctln.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,24 +1,20 @@
--/*****************************************************************************
--* QLOGIC LINUX SOFTWARE
--*
--* QLogic ISP2x00 device driver ioctl definition file
--* Copyright (C) 2005 QLogic Corporation
--* (www.qlogic.com)
--*
--* This program is free software; you can redistribute it and/or modify it
--* under the terms of the GNU General Public License as published by the
--* Free Software Foundation; either version 2, or (at your option) any
--* later version.
--*
--* This program is distributed in the hope that it will be useful, but
--* WITHOUT ANY WARRANTY; without even the implied warranty of
--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--* General Public License for more details.
--****************************************************************************/
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * File Name: exioctln.h
-
-+ Rev 25 December 13, 2005 RL
-+ - Deleted references to the EXT_ADDR_MODE_OS define, which
-+ will no longer be used.
-+
-+ Rev 24 October 06, 2005 RL
-+ - Added reserve internal ioctl command code for future use.
-+
- Rev 23 June 22, 2005 RL
- - Corrected assignment condition of EXT_ADDR_MODE_OS value.
-
-@@ -164,13 +160,6 @@
-
-
-
--#if __WORDSIZE == 64
--#define EXT_ADDR_MODE_OS EXT_DEF_ADDR_MODE_64
--#else
--#define EXT_ADDR_MODE_OS EXT_DEF_ADDR_MODE_32
--#endif
--
--
- #define QLMULTIPATH_MAGIC 'y'
-
- #define _QLBUILD /* for exioct.h to enable include of qinsdmgt.h */
-@@ -277,6 +266,8 @@
- QL_IOCTL_CMD(0x11)
- #define EXT_CC_RESERVED0K_OS \
- QL_IOCTL_CMD(0x12)
-+#define EXT_CC_RESERVED0L_OS \
-+ QL_IOCTL_CMD(0x13)
-
- #define EXT_CC_RESERVED0Z_OS \
- QL_IOCTL_CMD(0x21)
-@@ -319,7 +310,7 @@
- #define EXT_CC_DRIVER_SPECIFIC /* DRIVER_SPECIFIC */ \
- QL_IOCTL_CMD(0xfc)
-
--#define EXT_DEF_LN_SPC_CC_END_IDX 0xfb /* LN specific cmd end idx */
-+#define EXT_DEF_LN_SPC_CC_END_IDX 0xfc /* LN specific cmd end idx */
-
-
- /*
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/Kconfig.kernel ./drivers/scsi/qla2xxx/extras/Kconfig.kernel
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/Kconfig.kernel 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/Kconfig.kernel 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,49 @@
-+config SCSI_QLA2XXX
-+ tristate
-+ default (SCSI && PCI)
-+ depends on SCSI && PCI
-+
-+config SCSI_QLA21XX
-+ tristate "QLogic ISP2100 host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 21xx (ISP2100) host adapter family.
-+
-+config SCSI_QLA22XX
-+ tristate "QLogic ISP2200 host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 22xx (ISP2200) host adapter family.
-+
-+config SCSI_QLA2300
-+ tristate "QLogic ISP2300 host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 2300 (ISP2300 and ISP2312) host
-+ adapter family.
-+
-+config SCSI_QLA2322
-+ tristate "QLogic ISP2322 host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 2322 (ISP2322) host adapter family.
-+
-+config SCSI_QLA6312
-+ tristate "QLogic ISP63xx host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 63xx (ISP6312 and ISP6322) host
-+ adapter family.
-+
-+config SCSI_QLA24XX
-+ tristate "QLogic ISP24xx host adapter family support"
-+ depends on SCSI_QLA2XXX
-+ select SCSI_FC_ATTRS
-+ ---help---
-+ This driver supports the QLogic 24xx (ISP2422 and ISP2432) host
-+ adapter family.
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/Makefile.kernel ./drivers/scsi/qla2xxx/extras/Makefile.kernel
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/Makefile.kernel 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/Makefile.kernel 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,17 @@
-+EXTRA_CFLAGS += -DUNIQUE_FW_NAME
-+
-+qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
-+ qla_dbg.o qla_sup.o qla_rscn.o
-+
-+qla2100-y := ql2100.o ql2100_fw.o
-+qla2200-y := ql2200.o ql2200_fw.o
-+qla2300-y := ql2300.o ql2300_fw.o
-+qla2322-y := ql2322.o ql2322_fw.o
-+qla6312-y := ql6312.o ql6312_fw.o
-+
-+obj-$(CONFIG_SCSI_QLA21XX) += qla2xxx.o qla2100.o
-+obj-$(CONFIG_SCSI_QLA22XX) += qla2xxx.o qla2200.o
-+obj-$(CONFIG_SCSI_QLA2300) += qla2xxx.o qla2300.o
-+obj-$(CONFIG_SCSI_QLA2322) += qla2xxx.o qla2322.o
-+obj-$(CONFIG_SCSI_QLA6312) += qla2xxx.o qla6312.o
-+obj-$(CONFIG_SCSI_QLA24XX) += qla2xxx.o
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/build.sh ./drivers/scsi/qla2xxx/extras/build.sh
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/build.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/build.sh 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,869 @@
-+#!/bin/sh
-+
-+# QLogic ISP2xxx device driver build script
-+# Copyright (C) 2003-2004 QLogic Corporation
-+# (www.qlogic.com)
-+#
-+# This program is free software; you can redistribute it and/or modify it
-+# under the terms of the GNU General Public License as published by the
-+# Free Software Foundation; either version 2, or (at your option) any
-+# later version.
-+#
-+# This program is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# General Public License for more details.
-+#
-+
-+Q_NODE=QLA2XXX
-+Q_CONF_FILE=/etc/qla2xxx.conf
-+
-+UNAME=`uname -a`
-+K_VERSION=`uname -r`
-+K_MAJ_MIN=`echo $K_VERSION | cut -d . -f -2`
-+K_LIBS=/lib/modules/${K_VERSION}
-+K_BUILD_DIR=${K_LIBS}/build
-+K_SOURCE_DIR=${K_LIBS}/source
-+K_INSTALL_DIR=${K_LIBS}/kernel/drivers/scsi/qla2xxx/
-+K_THREADS=5
-+K_BLACK_LIST="/etc/hotplug/blacklist"
-+
-+SLES=/etc/SuSE-release
-+SYS_FILE=kernel
-+SLES_CONF=/etc/sysconfig/$SYS_FILE
-+SLES_CONF_KEY=INITRD_MODULES
-+RHEL=/etc/redhat-release
-+ASIANUX=/etc/asianux-release
-+BOOTDIR="/boot"
-+
-+if [ "`uname -m`" = "ia64" ]; then
-+ if [ -f "$ASIANUX" ]; then
-+ BOOTDIR="/boot/efi/efi/asianux"
-+ elif [ -f "$RHEL" ]; then
-+ BOOTDIR="/boot/efi/efi/redhat"
-+ fi
-+fi
-+
-+SLES_MODPROBE="modprobe.conf.local"
-+SLES_MPC=/etc/$SLES_MODPROBE
-+RHEL_MODPROBE="modprobe.conf"
-+RHEL_MPC=/etc/$RHEL_MODPROBE
-+
-+QLOGIC="qlogic"
-+# RPM spec file through the installer can update RPMVERSION
-+# if this is "" that means user is not running RPM package
-+RPMVERSION=""
-+QL_SOURCE=/usr/src/$QLOGIC/$RPMVERSION
-+QL_BACKUP=$QL_SOURCE/backup
-+QL_CONF_ENTRIES=$QL_BACKUP/ql_conf_entries
-+QL_KERNEL_ENTRIES=$QL_BACKUP/ql_kernel_entries # for SuSE /etc/sysconfig/kernel
-+QL_MOD_REMOVED=$QL_BACKUP/ql_mod_removed
-+
-+QL_TAKE_BACKUP=0
-+QL_NO_BACKUP=1
-+SAVING_STR="Saving copy of"
-+
-+QL_RENAMES_BKUP_DIR="/usr/local/tmp/qlogic/"
-+QL_RENAMES_FILE="/etc/modprobe.d/module-renames"
-+QL_RENAMES_FILE_BKUP="$QL_RENAMES_BKUP_DIR/module-renames-ql.bak"
-+QL_RENAMES_FILE_DATE="$QL_RENAMES_BKUP_DIR/module-renames-ql"
-+
-+#create only if user is root
-+#only root can come to this point
-+if [ $EUID -eq 0 ] && [ "${RPMVERSION}" != "" ]; then
-+ mkdir -p $QL_SOURCE
-+ mkdir -p $QL_BACKUP
-+fi
-+
-+
-+# --------------------------------------------------------- #
-+# invoke_cmd () #
-+# Invokes the shell command #
-+# Parameter: #
-+# $1 the command to be invoked #
-+# $2 the text output to the screen #
-+# $3 if set to "background", outputs "."s #
-+# while waiting for completion #
-+# #
-+# Returns: Commands exit value. #
-+# --------------------------------------------------------- #
-+function invoke_cmd() {
-+ exitval=0
-+ rm -f .tmp_exitval
-+ if [ -e .tmp_exitval ]; then
-+ echo $"invoke_command could not run!" >$std_err
-+ exit 1
-+ fi
-+ if [ "$2" != "" ]; then
-+ echo -en "$2..."
-+ fi
-+ if [ "$3" == background ]; then
-+ (eval $1; echo "exitval=$?" >> .tmp_exitval) &
-+ while ! [ -e .tmp_exitval ]
-+ do
-+ if [ "$4" == "progress" ]; then
-+ #echo -en '\E[34;44m '
-+ echo -en "|"
-+ echo -en "\b"
-+ sleep .08
-+ echo -en "/"
-+ echo -en "\b"
-+ sleep .08
-+ echo -en "-"
-+ echo -en "\b"
-+ sleep .08
-+ echo -en "\\"
-+ echo -en "\b"
-+ sleep .08
-+ else
-+ echo -en "."
-+ sleep 1
-+ fi
-+ done
-+ echo -en "\b"
-+ echo " "
-+ #tput sgr0
-+ . .tmp_exitval
-+ rm .tmp_exitval
-+ else
-+ eval $1; exitval=$?
-+ fi
-+ if [ $exitval -gt 0 ]; then
-+ echo -en "(bad exit status)"
-+ script_location=`dirname $0`
-+ echo "$1 failed to execute"
-+ echo $1 >> $script_location/.invoke_command.log
-+ fi
-+ echo -en "\n"
-+ return $exitval
-+}
-+
-+###
-+# drv_build -- Generic 'make' command for driver
-+# $1 -- directive
-+#
-+drv_build() {
-+ test -z "$1" && return 1
-+
-+ # Go with build...
-+ if [ "${RPMVERSION}" == "" ]; then # User running out of installer
-+ if test -f "${SLES}" ; then
-+ # SuSE -------------------------------------------------------
-+ make -j${K_THREADS} -C ${K_SOURCE_DIR} O=${K_BUILD_DIR} M=$PWD $1
-+ else
-+ # Redhat -----------------------------------------------------
-+ make -j${K_THREADS} -C ${K_BUILD_DIR} M=$PWD $1
-+ fi
-+ else
-+
-+ if test -f "${SLES}" ; then
-+ # SuSE -------------------------------------------------------
-+ invoke_cmd "make -j${K_THREADS} -C ${K_SOURCE_DIR} O=${K_BUILD_DIR} \
-+ M=$PWD $1 >& $QL_SOURCE/build.log" "" "background" "progress"
-+ else
-+ # Redhat -----------------------------------------------------
-+ invoke_cmd "make -j${K_THREADS} -C ${K_BUILD_DIR} M=$PWD $1 >& \
-+ $QL_SOURCE/build.log" "" "background" "progress"
-+ fi
-+ fi
-+}
-+
-+# --------------------------------------------------------- #
-+# add_modprobe_commands() #
-+# Adds the install/remove commands for qla2xxx #
-+# #
-+# Parameter: None #
-+# Returns: None #
-+# --------------------------------------------------------- #
-+function add_modprobe_commands()
-+{
-+ if test -f "${SLES}" ; then
-+ MPC=${SLES_MPC}
-+ else
-+ MPC=${RHEL_MPC}
-+ fi
-+
-+ #install command for qla2xxx, load qla2xxx_conf before qla2xxx
-+ if [ `grep -c "^install qla2xxx" ${MPC}` -eq 0 ]; then
-+ echo "install qla2xxx /sbin/modprobe qla2xxx_conf; /sbin/modprobe --ignore-install qla2xxx" >> ${MPC}
-+ if [ "${RPMVERSION}" != "" ]; then # in installer, store what was added, so as to remove on un-install
-+ echo "install qla2xxx /sbin/modprobe qla2xxx_conf; /sbin/modprobe --ignore-install qla2xxx" >> $QL_CONF_ENTRIES
-+ fi
-+ fi
-+
-+ # remove of qla2xxx_conf module
-+ if [ `grep -c "^remove qla2xxx" ${MPC}` -eq 0 ]; then
-+ echo "remove qla2xxx /sbin/modprobe -r --first-time --ignore-remove qla2xxx && { /sbin/modprobe -r --ignore-remove qla2xxx_conf; }" >> ${MPC}
-+
-+ if [ "${RPMVERSION}" != "" ]; then # in installer, store what was added, so as to remove on un-install
-+ echo "remove qla2xxx /sbin/modprobe -r --first-time --ignore-remove qla2xxx && { /sbin/modprobe -r --ignore-remove qla2xxx_conf; }" >> $QL_CONF_ENTRIES
-+ fi
-+ fi
-+}
-+
-+###
-+# drv_install -- Generic steps for installation
-+#
-+drv_install() {
-+ if test $EUID -ne 0 ; then
-+ echo "${Q_NODE} -- Must be root to install..."
-+ return 1
-+ fi
-+
-+ # Need to take backup of old driver
-+ backup_drivers
-+
-+ echo "${Q_NODE} -- Installing the qla2xxx modules to "
-+ echo "${K_INSTALL_DIR}..."
-+ install -d -o root -g root ${K_INSTALL_DIR}
-+ install -o root -g root -m 0644 *.ko ${K_INSTALL_DIR}
-+
-+ #add the remove and install commands for qla2xxx
-+ add_modprobe_commands
-+
-+ #update module-renames for SLES 10
-+ remove_module_renames >& /dev/null #no need to show any messages to user
-+
-+ # Update any existing qla2xxx_conf data
-+ if test -f "${Q_CONF_FILE}" ; then
-+ echo "${Q_NODE} -- Updating the qla2xxx_conf module..."
-+ ./extras/qla_opts -w qla2xxx_conf
-+ fi
-+ # depmod
-+ /sbin/depmod -a
-+}
-+
-+is_module_installed() {
-+ # Need to check in
-+ # /lib/modules/2.6.9-5.EL/kernel/drivers/scsi/qla2xxx/
-+ if [ -f "$K_INSTALL_DIR/${1}.ko" ]; then
-+ return 0
-+ fi
-+ return 1
-+}
-+
-+
-+###
-+# edit_modprobe -- Adds scsi_hostadapter entry in
-+# Adds the module in hotplug blacklist to avoid loading
-+# the driver using hotplug
-+# /etc/modprobe.conf
-+# $1 Name of the module
-+#
-+edit_modprobe () {
-+ test -z "$1" && return 1
-+
-+ is_module_installed $1
-+ if [ $? != 0 ]; then
-+ return 1
-+ fi
-+ DONE=0
-+ CNT=""
-+ SCSIHOSTADAPTER="scsi_hostadapter"
-+
-+ if test -f "${SLES}" ; then
-+ MPC=${SLES_MPC}
-+ return 1
-+ else
-+ MPC=${RHEL_MPC}
-+ # Check if the entry is already in the
-+ # /etc/modprobe.conf file
-+ grep "^[[:space:]]*alias[[:space:]]\+${SCSIHOSTADAPTER}.*${1}$" $MPC >& /dev/null
-+ if [ $? = 0 ]; then #Entry already in modprobe.conf
-+ return 1
-+ fi
-+
-+ # Get the hostadatper number
-+ while [ $DONE -eq 0 ]
-+ do
-+ TEXT=`cat ${MPC} | grep "^[[:space:]]*alias[[:space:]]\+${SCSIHOSTADAPTER}${CNT}"`
-+ if [ "$TEXT" = "" ]
-+ then
-+ DONE=1
-+ else
-+ if [ "$CNT" = "" ]; then
-+ CNT=0
-+ fi
-+ CNT=`expr $CNT + 1`
-+ fi
-+ done
-+ #echo "adding line: alias ${SCSIHOSTADAPTER}${CNT} $1 to $MPC"
-+ ENTRY_LINE="alias ${SCSIHOSTADAPTER}${CNT} $1"
-+ echo $ENTRY_LINE >> $MPC
-+ if [ "${RPMVERSION}" = "" ]; then # not in installer
-+ return 0
-+ fi
-+ # do not add if entry already in, as we might come back here
-+ # from the include driver in ramdisk option
-+ if [ -f $QL_CONF_ENTRIES ]; then
-+ grep "$ENTRY_LINE" $QL_CONF_ENTRIES >& /dev/null
-+ if [ $? = 0 ]; then
-+ return 0
-+ fi
-+ fi
-+ echo $ENTRY_LINE >> $QL_CONF_ENTRIES
-+ fi
-+ return 0
-+}
-+
-+
-+backup_blacklist() {
-+ # Create backup of the blacklist
-+ echo "Creating backup of $K_BLACK_LIST as $K_BLACK_LIST.ql.orig.bak...."
-+ cp --archive $K_BLACK_LIST $K_BLACK_LIST.ql.orig.bak
-+}
-+
-+function add_in_blacklist () {
-+ # Add our moudles in the blacklist
-+ grep "$1" $K_BLACK_LIST >& /dev/null
-+ if [ $? != 0 ]; then
-+ echo $1 >> $K_BLACK_LIST
-+ fi
-+}
-+
-+# --------------------------------------------------------- #
-+# backup_drivers () #
-+# Backup if any QLogic driver present in the #
-+# /lib/modules/<kernel ver>/driver/scsi/qla2xxx #
-+# Backup is created in the #
-+# /usr/src/qlogic/<driver-rpm ver>/backup #
-+# #
-+# Parameter: None #
-+# Returns: 0 on success, 1 on fail #
-+# --------------------------------------------------------- #
-+function backup_drivers () {
-+ if [ $EUID -eq 0 ] && [ "${RPMVERSION}" != "" ]; then
-+ cp -rf $K_INSTALL_DIR $QL_BACKUP
-+ return $?
-+ fi
-+ return 0 # return success, we did nothing
-+}
-+
-+function backup_modprobe () {
-+ MPC=""
-+ if [ -f $RHEL ]; then
-+ MPC=$RHEL_MPC
-+ elif [ -f $SLES ]; then
-+ MPC=$SLES_MPC
-+ fi
-+ BACKUP_FILE=$QL_BACKUP/$RHEL_MODPROBE-$K_VERSION-${1}.bak
-+ if [ -f $MPC ]; then
-+ echo "$SAVING_STR $MPC as"
-+ echo "$BACKUP_FILE"
-+ echo ""
-+ cp -f $MPC $BACKUP_FILE
-+ fi
-+}
-+
-+function backup_initrd () {
-+ # SLES or RHEL backup /boot/initrd-`uname -r`
-+ INITRD=$BOOTDIR/initrd-$K_VERSION
-+ BACKUP_FILE=""
-+ if [ -f $RHEL ] && [ -f ${INITRD}.img ]; then
-+ INITRD=${INITRD}.img
-+ BACKUP_FILE=$QL_BACKUP/initrd-$K_VERSION.img-${1}.bak
-+ elif [ -f $SLES ] && [ -f ${INITRD} ]; then
-+ BACKUP_FILE=$QL_BACKUP/initrd-$K_VERSION-${1}.bak
-+ fi
-+
-+ if [ "$BACKUP_FILE" != "" ]; then
-+ cp -f ${INITRD} ${BACKUP_FILE}
-+ echo "$SAVING_STR ${INITRD} as"
-+ echo "$BACKUP_FILE"
-+ echo ""
-+ fi
-+}
-+
-+function backup_sysconfig () {
-+ # Backup /etc/sysconfig/kernel
-+ echo "$SAVING_STR $SLES_CONF as"
-+ echo "$QL_BACKUP/$SYS_FILE-$K_VERSION-${1}.bak"
-+ cp -f $SLES_CONF $QL_BACKUP/$SYS_FILE-$K_VERSION-${1}.bak
-+}
-+
-+# --------------------------------------------------------- #
-+# restore_mod_conf() #
-+# Restore any modules that installer removed from the #
-+# modules configuration file during installation. #
-+# Parameter: #
-+# $1 None #
-+# Returns: None #
-+# --------------------------------------------------------- #
-+restore_mod_conf() {
-+ #get the entries from $QL_MOD_REMOVED
-+ # and put them back. Note this operation must
-+ # be performed after installer changes are removed
-+ # from modules conf. files
-+
-+ if [ -f $QL_MOD_REMOVED ]; then
-+ if [ -f $SLES ]; then
-+ local MODULES=`cat $SLES_CONF | grep "^INITRD_MODULES" |
-+ awk 'BEGIN {FS="="} {print $2}'| sed 's/\"//g'`
-+
-+ for MODULE in `cat $QL_MOD_REMOVED`
-+ do
-+ MODULES="$MODULES $MODULE"
-+ done
-+
-+ sed "s/^INITRD_MODULES.*/INITRD_MODULES=\"$MODULES\"/" $SLES_CONF >/tmp/kernel
-+ if [ -s /tmp/kernel ]; then
-+ mv -f /tmp/kernel $SLES_CONF
-+ fi
-+ else #RedHat/AsianUx
-+ cat $QL_MOD_REMOVED >> $RHEL_MPC
-+ fi
-+ fi
-+}
-+
-+function restore_original() {
-+ # Restore driver
-+ MSG_DISPLAYED=0
-+ BACKUP_DRIVER=$QL_BACKUP/qla2xxx
-+ echo -e "Restoring original QLogic drivers...."
-+ echo -e ""
-+
-+ # first remove the drivers from /lib/modules path
-+ if [ -e $K_INSTALL_DIR ]; then
-+ rm -f $K_INSTALL_DIR/*
-+ fi
-+
-+ # check if backup dir is not empty
-+ ls $BACKUP_DRIVER/* >& /dev/null
-+ if [ $? = 0 ]; then
-+ mv -f $BACKUP_DRIVER/* $K_INSTALL_DIR
-+ fi
-+
-+ # Restore modprobe
-+ if [ -f $QL_CONF_ENTRIES ]; then
-+ if test -f "${SLES}" ; then
-+ MPC=${SLES_MPC}
-+ else
-+ MPC=${RHEL_MPC}
-+ fi
-+ echo -e "Removing installation changes from $MPC...."
-+ echo -e ""
-+ grep -v -f $QL_CONF_ENTRIES $MPC > $QL_BACKUP/modprobe
-+ if [ -f "$QL_BACKUP/modprobe" ]; then
-+ mv -f $QL_BACKUP/modprobe $MPC
-+ else
-+ echo "Unable to update $MPC file"
-+ return;
-+ fi
-+ fi
-+
-+ # Restore kernel For SuSE
-+ # Restore initrd
-+ if [ -f $SLES ]; then
-+ #From the "INITRD_MODULES" line in the /etc/sysconfig/kernel
-+ # remove entries present in $QL_BACKUP_KERNEL
-+ if [ -f "$QL_KERNEL_ENTRIES" ]; then
-+ INITRD_LINE=`grep "^$SLES_CONF_KEY" $SLES_CONF`
-+
-+ for MODULES in `cat $QL_KERNEL_ENTRIES`
-+ do
-+ INITRD_LINE=`echo $INITRD_LINE | sed "s/$MODULES//"`
-+ done
-+ #echo "INITRD_LINE = $INITRD_LINE"
-+ echo -e "Removing installation changes from $SLES_CONF...."
-+ echo -e ""
-+ sed "s/^INITRD_MODULES.*/${INITRD_LINE}/" $SLES_CONF > /tmp/kernel
-+ if [ -s /tmp/kernel ]; then
-+ cp -f /tmp/kernel $SLES_CONF
-+ fi
-+ fi
-+ fi
-+
-+ #Put back origina here
-+ restore_mod_conf
-+
-+ #before creating the ramdisk do depmod
-+ echo -e "Building module dependency...."
-+ echo -e "depmod..."
-+ /sbin/depmod -a
-+ echo -e ""
-+
-+ create_ramdisk "" "$QL_NO_BACKUP"
-+}
-+
-+# --------------------------------------------------------- #
-+# edit_sysconfig () #
-+# Function to modify list of modules to be included #
-+# in the Ram Disk for SuSE Distribution. Edits the #
-+# /etc/sysconfig/kernel #
-+# #
-+# Parameter: #
-+# $* Space separated module list #
-+# Returns: None #
-+# --------------------------------------------------------- #
-+function edit_sysconfig() {
-+ MODLIST="$1"
-+ # check if Module already in the sysconfig/kernel
-+ grep -w "$MODLIST" $SLES_CONF >& /dev/null
-+ if [ $? = 0 ]; then
-+ # MODLIST already there, quit from here
-+ return 1
-+ fi
-+ MODULES=`cat $SLES_CONF | grep "^INITRD_MODULES" |
-+ awk 'BEGIN {FS="="} {print $2}'| sed 's/\"//g'`
-+ # need to be careful on the module sequence, qla2xxx_conf should be first
-+ # always
-+ MODULES="$MODULES $MODLIST"
-+ #echo "New module list: $MODULES"
-+ sed "s/^INITRD_MODULES.*/INITRD_MODULES=\"$MODULES\"/" $SLES_CONF>/tmp/kernel
-+ if [ -s /tmp/kernel ]; then
-+ mv -f /tmp/kernel $SLES_CONF
-+ fi
-+ if [ -f $QL_KERNEL_ENTRIES ]; then
-+ grep -w "$MODLIST" $QL_KERNEL_ENTRIES >& /dev/null
-+ if [ $? = 0 ]; then
-+ return 0
-+ fi
-+ fi
-+ echo "$MODLIST" >> $QL_KERNEL_ENTRIES
-+ return 0
-+}
-+
-+#
-+# $1 Module list to be added in modprobe
-+# $2 Create backup of original ramdisk
-+# $3 FORCE_REBUILD: #
-+# "YES": Build ramdisk always #
-+# "NO": Build ramdisk only if required #
-+function create_ramdisk() {
-+
-+ MODULE_LIST=(`echo "$1"`)
-+ BACKUP_DATE=`date +%m%d%y-%H%M%S`
-+ SAVING_STR="Saved copy of"
-+ BACKUP_FILE=""
-+ ORIGINAL_FILE=""
-+ BACKUP_FILE_MOD=""
-+ ORIGINAL_FILE_MOD=""
-+
-+ NEED_REBUILD=0
-+ ret_status=0
-+ FORCE_REBUILD=$3
-+
-+ if [ "$FORCE_REBUILD" = "" ]; then
-+ FORCE_REBUILD="YES"
-+ fi
-+
-+
-+ #LSC: Moved the backup logic to top-level qlinstall script
-+ # Need to backup sysconfig once
-+ #if [ -f $SLES ] && [ ${#MODULE_LIST[@]} -gt 0 ] && [ $2 != $QL_NO_BACKUP ]; then
-+ # #backup_sysconfig $BACKUP_DATE
-+ # BACKUP_FILE_K="$QL_BACKUP/$SYS_FILE-$K_VERSION-${BACKUP_DATE}.bak"
-+ # ORIGINAL_FILE_K=$SLES_CONF
-+ # #echo "$SAVING_STR $SLES_CONF as"
-+ # #echo "$QL_BACKUP/$SYS_FILE-$K_VERSION-${1}.bak"
-+ # cp -f $SLES_CONF $BACKUP_FILE_K
-+ #fi
-+
-+
-+ # Backup original modprobe.conf/modprobe.conf.local
-+ #if [ ${#MODULE_LIST[@]} -gt 0 ] && [ $2 != $QL_NO_BACKUP ]; then
-+ # #backup_modprobe $BACKUP_DATE
-+ # MPC=""
-+ # if [ -f $RHEL ]; then
-+ # MPC=$RHEL_MPC
-+ # elif [ -f $SLES ]; then
-+ # MPC=$SLES_MPC
-+ # fi
-+ # BACKUP_FILE_MOD=$QL_BACKUP/$RHEL_MODPROBE-$K_VERSION-${BACKUP_DATE}.bak
-+ # ORIGINAL_FILE_MOD=$MPC
-+ # if [ -f $MPC ]; then
-+ # cp -f $MPC $BACKUP_FILE_MOD
-+ # fi
-+ #fi
-+
-+
-+ if [ ${#MODULE_LIST[@]} -gt 0 ]; then
-+ add_modprobe_commands
-+
-+ # Always add qla2xxx_conf and qla2xxx in modprobe
-+ edit_modprobe "qla2xxx_conf"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+
-+ edit_modprobe "qla2xxx"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+
-+ if [ -f $SLES ]; then
-+ #Append $MODULE modules to the list in sysconfig/kernel.
-+ edit_sysconfig "qla2xxx_conf"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+
-+ edit_sysconfig "qla2xxx"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+
-+ fi
-+ fi
-+
-+ # mkinitrd
-+ # Add entry in the /etc/modprobe.conf
-+ for MODULE in ${MODULE_LIST[@]}
-+ do
-+ edit_modprobe "qla$MODULE"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+
-+ if [ -f $SLES ]; then
-+ #Append $MODULE modules to the list in sysconfig/kernel.
-+ edit_sysconfig "qla$MODULE"
-+ if [ $? = 0 ] ;then
-+ NEED_REBUILD=1
-+ fi
-+ fi
-+ done
-+
-+
-+ # If force rebuild is not yes then build ramdisk
-+ # only if NEED_REBUILD is set
-+ #if [ "$FORCE_REBUILD" = "NO" ] && [ $NEED_REBUILD = 0 ]; then
-+ # #do not rebuild
-+ # #delete any backup created, as it is not required
-+ # if [ -f "$BACKUP_FILE_K" ]; then
-+ # rm -f $BACKUP_FILE >& /dev/null
-+ # fi
-+ # if [ -f "$BACKUP_FILE_MOD" ]; then
-+ # rm -f $BACKUP_FILE_MOD >& /dev/null
-+ # fi
-+ # return 1
-+ #fi
-+
-+ #if [ -f "$BACKUP_FILE_K" ]; then
-+ # # Now give a late message of file saved
-+ # echo -e "$SAVING_STR $ORIGINAL_FILE_K as"
-+ # echo -e "$BACKUP_FILE_K"
-+ # echo -e ""
-+ #fi
-+ #if [ -f "$BACKUP_FILE_MOD" ]; then
-+ # # Now give a late message of file saved
-+ # echo -e "$SAVING_STR $ORIGINAL_FILE_MOD as"
-+ # echo -e "$BACKUP_FILE_MOD"
-+ # echo -e ""
-+ #fi
-+
-+
-+ if [ "$2" != "$QL_NO_BACKUP" ]; then
-+ backup_initrd $BACKUP_DATE
-+ fi
-+
-+ echo "${Q_NODE} -- Rebuilding ramdisk image..."
-+ # Any distribution specific steps
-+ if test -f "${SLES}" ; then
-+ /sbin/mk_initrd >& /dev/null
-+ ret_status=$?
-+ else
-+ # Red Hat initrd
-+ INITRD=initrd-$K_VERSION.img
-+ if [ -f "$BOOTDIR/$INITRD" ]; then
-+ /sbin/mkinitrd -f $BOOTDIR/$INITRD $K_VERSION
-+ ret_status=$?
-+ else
-+ /sbin/mkinitrd $BOOTDIR/$INITRD $K_VERSION
-+ ret_status=$?
-+ fi
-+ fi
-+ return $ret_status
-+}
-+
-+# --------------------------------------------------------- #
-+# remove_module_renames() #
-+# Removes any aliases to the module renames done in the #
-+# mdoule-renames files. This is applicable to SLES 10 only #
-+# Since on SLES 10,qla2300, qla2400 etc are renamed to #
-+# qla2xxx #
-+# Parameter: None #
-+# Returns: 0: In success, 1 on failure #
-+# --------------------------------------------------------- #
-+function remove_module_renames ()
-+{
-+ local BACKUP_DATE=`date +%m%d%y-%H%M%S`
-+ local TMP_RENAMES=/etc/modprobe.d/renames.ql
-+ local TMP_RESTORE=$QL_RENAMES_BKUP_DIR/renames.restore.ql
-+ #if this is SuSe and 2.6
-+ if [ "${K_MAJ_MIN}" = "2.6" ] && [ -f "${SLES}" ]; then
-+ #create the bakup dir
-+ mkdir -p $QL_RENAMES_BKUP_DIR >& /dev/null
-+ if [ $? -ne 0 ]; then
-+ echo "Warning: Unable to create backup dir for module renames."
-+ echo "Please update $QL_RENAMES_FILE manually to remove the qla2xxx alias."
-+ echo "This is required so that correct FW module gets loaded."
-+ return 1
-+ fi
-+ #Take backup of the file once
-+ if [ -f "${QL_RENAMES_FILE}" ]; then
-+ if [ ! -f $QL_RENAMES_FILE_BKUP ]; then
-+ cp -f $QL_RENAMES_FILE $QL_RENAMES_FILE_BKUP
-+ fi
-+ #also take date-wise backup
-+ rm -f ${QL_RENAMES_FILE_DATE}-* >& /dev/null
-+ cp -f $QL_RENAMES_FILE ${QL_RENAMES_FILE_DATE}-${BACKUP_DATE}
-+ #now remove the alias
-+ grep "^alias.*qla2xxx$" $QL_RENAMES_FILE | sed "s/^/#/" > $TMP_RESTORE
-+ cat $QL_RENAMES_FILE | sed "s/\(^alias.*qla2xxx$\)/#\1/" > $TMP_RENAMES
-+ if [ -s "$TMP_RENAMES" ]; then
-+ mv -f $TMP_RENAMES $QL_RENAMES_FILE
-+ fi
-+ fi
-+ else
-+ return 1
-+ fi
-+ return 0
-+}
-+
-+# --------------------------------------------------------- #
-+# restore_module_renames() #
-+# Restores the module renames #
-+# Parameter: None #
-+# Returns: 0: In success, 1 on failure #
-+# --------------------------------------------------------- #
-+function restore_module_renames ()
-+{
-+ local TMP_RENAMES=/etc/modprobe.d/renames.ql
-+ local TMP_RESTORE=$QL_RENAMES_BKUP_DIR/renames.restore.ql
-+ #if this is SuSe and 2.6
-+ if [ "${K_MAJ_MIN}" = "2.6" ] && [ -f "${SLES}" ]; then
-+ if [ -f "${TMP_RESTORE}" ]; then
-+ #first remove the lines that we commented
-+ grep -v -f $TMP_RESTORE $QL_RENAMES_FILE > $TMP_RENAMES
-+ if [ -s $TMP_RENAMES ]; then
-+ #now add the one tha we commented by un-commenting
-+ grep "^#alias.*qla2xxx" $TMP_RESTORE | sed "s/^#//" >> $TMP_RENAMES
-+
-+ if [ -s $TMP_RENAMES ]; then
-+ #the actual restore
-+ mv -f $TMP_RENAMES $QL_RENAMES_FILE
-+ #remove backup
-+ rm -f ${QL_RENAMES_FILE_DATE}-* >& /dev/null
-+ rm -f $TMP_RESTORE >& /dev/null
-+ fi
-+ fi
-+
-+ fi
-+ else
-+ return 1
-+ fi
-+ return 1
-+}
-+
-+
-+###
-+#
-+#
-+case "$1" in
-+ help)
-+ echo "QLogic Corporation -- qla2xxx build script"
-+ echo " build.sh <directive>"
-+ echo ""
-+ echo " # cd <driver source>"
-+ echo " # ./extras/build.sh"
-+ echo ""
-+ echo " Build the driver sources based on the standard SLES9/RHEL4"
-+ echo " build environment."
-+ echo ""
-+ echo " # ./extras/build.sh clean"
-+ echo ""
-+ echo " Clean driver source directory of all build files (i.e. "
-+ echo " *.ko, *.o, etc)."
-+ echo ""
-+ echo " # ./extras/build.sh new"
-+ echo ""
-+ echo " Rebuild the driver sources from scratch."
-+ echo " This is essentially a shortcut for:"
-+ echo ""
-+ echo " # ./build.sh clean"
-+ echo " # ./build.sh"
-+ echo ""
-+ echo " # ./extras/build.sh install"
-+ echo ""
-+ echo " Build and install the driver module files."
-+ echo " This command performs the following:"
-+ echo ""
-+ echo " 1. Builds the driver .ko files."
-+ echo " 2. Copies the .ko files to the appropriate "
-+ echo " /lib/modules/... directory."
-+ echo " 3. Adds the appropriate directive in the "
-+ echo " modprobe.conf[.local] to remove the qla2xxx_conf "
-+ echo " module when the qla2xxx module is unloaded."
-+ echo " 4. Updates the newly built qla2xxx_conf.ko module with "
-+ echo " any previously saved data in /etc/qla2xxx.conf."
-+ echo ""
-+ echo " # ./extras/build.sh remove-renames"
-+ echo ""
-+ echo " Removes the qla2xxx alias from the /etc/modprobe.d/module-renames"
-+ echo " on SLES 10. This is required to load the appropriate FW module."
-+ echo " For example, if alias qla2xxx is not removed, loading the qla2300"
-+ echo " module would load the qla2xxx module. That is on doing"
-+ echo " modprobe [qla2300|qla2400|qla2322] would load qla2xxx only."
-+ echo ""
-+ echo " # ./extras/build.sh restore-renames"
-+ echo ""
-+ echo " Restores the qla2xxx alias in /etc/modprobe.d/module-renames on SLES 10"
-+ echo " This is required in case the in-built qla2xxx module need to be loaded"
-+ ;;
-+ install)
-+ # QLA2XXX Specific
-+ echo ""
-+ echo "${Q_NODE} -- Building the qla2xxx driver..."
-+ drv_build modules
-+ echo ""
-+ drv_install
-+ ;;
-+ -d | --ramdisk)
-+ if [ "${RPMVERSION}" = "" ]; then
-+ echo "This option is available through qlinstall only."
-+ exit 1
-+ fi
-+ create_ramdisk "$2" $3 "$4"
-+ exit $?
-+ ;;
-+ restore)
-+ if [ "${RPMVERSION}" = "" ]; then
-+ echo "This option is available through qlinstall only."
-+ exit 1
-+ fi
-+
-+ # Restore all the backed up files
-+ # driver/modprobe/initrd/sysconfig
-+ restore_original
-+ ;;
-+ clean)
-+ echo "${Q_NODE} -- Cleaning driver build directory..."
-+ drv_build clean
-+ ;;
-+ new)
-+ echo "${Q_NODE} -- Clean rebuild of the qla2xxx driver..."
-+ drv_build clean
-+ drv_build modules
-+ ;;
-+ remove-renames)
-+ remove_module_renames
-+ if [ $? -ne 0 ]; then
-+ echo "This option is supported on SLES 10 only."
-+ else
-+ echo "Remove renames done."
-+ fi
-+ ;;
-+ restore-renames)
-+ restore_module_renames
-+ if [ $? -ne 0 ]; then
-+ echo "This option is supported on SLES 10 only."
-+ else
-+ echo "Restore renames done."
-+ fi
-+ ;;
-+ *)
-+ echo "${Q_NODE} -- Building the qla2xxx driver..."
-+ drv_build modules
-+ ;;
-+esac
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_dmp.sh ./drivers/scsi/qla2xxx/extras/qla_dmp.sh
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_dmp.sh 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/qla_dmp.sh 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,60 @@
-+#!/bin/sh
-+#
-+# QLogic ISP2x00 device driver dump reader
-+# Copyright (C) 2003-2004 QLogic Corporation
-+# (www.qlogic.com)
-+#
-+# This program is free software; you can redistribute it and/or modify it
-+# under the terms of the GNU General Public License as published by the
-+# Free Software Foundation; either version 2, or (at your option) any
-+# later version.
-+#
-+# This program is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# General Public License for more details.
-+#
-+version=1.039720
-+sysfs=/sys
-+qstats=${sysfs}/class/scsi_host/host${1}/device/stats
-+qfwd=${sysfs}/class/scsi_host/host${1}/device/fw_dump
-+dfile=fw_dump_${1}_`eval date +%Y%m%d_%H%M%S`.txt
-+
-+# Get host number
-+if [ -z "${1}" ] ; then
-+ echo "QLogic Firmware Dump Reader: ${version}"
-+ echo "Usage:"
-+ echo " `basename ${0}` <host_no>"
-+ exit 1
-+fi
-+
-+# Verify fw_dump binary-attribute file
-+if ! test -f ${qfwd} ; then
-+ echo "No firmware dump file at host ${1}!!!"
-+ exit 1
-+fi
-+
-+# Verify a firmware dump is available for the given host
-+#if ! test -f ${qstats} ; then
-+# echo "No device stats to verify firmware dump available at host ${1}!!!"
-+# exit 1
-+#fi
-+#do_dump=`eval cat ${qstats} | cut -d ' ' -f5`
-+#if [ "${do_dump}" = "0" ] ; then
-+# echo "No firmware dump available at host ${1}!!!"
-+# exit 1
-+#fi
-+
-+# Go with dump
-+echo 1 > ${qfwd}
-+cat ${qfwd} > ${dfile}
-+echo 0 > ${qfwd}
-+if ! test -s "${dfile}" ; then
-+ echo "No firmware dump available at host ${1}!!!"
-+ rm ${dfile}
-+ exit 1
-+fi
-+
-+echo "Firmware dumped to file ${dfile}."
-+
-+exit 0
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_nvr.c ./drivers/scsi/qla2xxx/extras/qla_nvr.c
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_nvr.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/qla_nvr.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,1042 @@
-+/********************************************************************************
-+* QLogic ISP2x00 NVRAM parser
-+* Copyright (C) 2003-2004 QLogic Corporation
-+* (www.qlogic.com)
-+*
-+* This program is free software; you can redistribute it and/or modify it
-+* under the terms of the GNU General Public License as published by the
-+* Free Software Foundation; either version 2, or (at your option) any
-+* later version.
-+*
-+* This program is distributed in the hope that it will be useful, but
-+* WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+* General Public License for more details.
-+*
-+******************************************************************************/
-+
-+#include <stdint.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <ctype.h>
-+#include <sys/fcntl.h>
-+#include <sys/errno.h>
-+
-+static char *qla_version = "1.00";
-+
-+#define MAX_STRINGS 16
-+#define MAX_PARAMS_SIZE 256
-+
-+/*
-+ * ISP2X00 NVRAM structure definition.
-+ */
-+typedef struct nvram {
-+ uint8_t id[4];
-+ uint8_t nvram_version;
-+ uint8_t reserved_0;
-+ uint8_t parameter_block_version;
-+ uint8_t reserved_1;
-+ uint8_t firmware_options[2];
-+ uint8_t max_frame_length[2];
-+ uint8_t max_iocb_allocation[2];
-+ uint8_t execution_throttle[2];
-+ uint8_t login_retry_count;
-+ uint8_t retry_delay;
-+ uint8_t port_name[8];
-+ uint8_t hard_address[2];
-+ uint8_t inquiry;
-+ uint8_t login_timeout;
-+ uint8_t node_name[8];
-+ uint8_t add_fw_opt[2];
-+ uint8_t response_accumulation_timer;
-+ uint8_t interrupt_delay_timer;
-+ uint8_t special_options[2];
-+ uint8_t reserved_4[26];
-+ uint8_t host_p[2];
-+ uint8_t boot_node_name[8];
-+ uint8_t boot_lun_number;
-+ uint8_t reset_delay;
-+ uint8_t port_down_retry_count;
-+ uint8_t boot_id_number;
-+ uint8_t maximum_luns_per_target[2];
-+ uint8_t boot_port_name[8];
-+ uint8_t reserved_6[6];
-+ uint8_t reserved_7[50];
-+ uint8_t reserved_8[50];
-+ uint8_t reserved_9[32];
-+ uint8_t adapter_features[2];
-+ uint8_t reserved_10[6];
-+ uint8_t reserved_11[4];
-+ uint8_t subsystem_vendor_id[2];
-+ uint8_t reserved_12[2];
-+ uint8_t subsystem_device_id[2];
-+ uint8_t subsystem_vendor_id_2200[2];
-+ uint8_t subsystem_device_id_2200[2];
-+ uint8_t reserved_13;
-+ uint8_t checksum;
-+} nvram_t;
-+
-+/*
-+ * Parameter types.
-+ */
-+typedef enum {
-+ BITS,
-+ NUMBER,
-+ STRING
-+} prm_t;
-+
-+typedef struct {
-+ prm_t type;
-+ uint8_t bits[MAX_STRINGS];
-+ uint8_t bytes;
-+ char *strings[MAX_STRINGS];
-+} nv_param_t;
-+
-+typedef struct {
-+ uint8_t *addr;
-+ nv_param_t *nvp;
-+} input_t;
-+
-+/*
-+ * Global data.
-+ */
-+nvram_t nv;
-+
-+nv_param_t nv_id = {
-+ STRING,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 4,
-+ {
-+ "\n; NVRAM header\n\n"
-+ "id [\"4 characters\"] = "
-+ }
-+};
-+nv_param_t nv_version = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "version [0-255] = "
-+ }
-+};
-+nv_param_t rsv_byte = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "reserved [0-255] = "
-+ }
-+};
-+nv_param_t p_version = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\n; RISC Parameter Block\n\n"
-+ "version [0-255] = "
-+ }
-+};
-+nv_param_t firmware_options = {
-+ BITS,
-+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, },
-+ 2,
-+ {
-+ "\n; Firmware options\n\nenable hard loop ID [0-1] = ",
-+ "enable fairness [0-1] = ",
-+ "enable full duplex [0-1] = ",
-+ "enable fast posting [0-1] = ",
-+ "enable target mode [0-1] = ",
-+ "disable initiator mode [0-1] = ",
-+ "Enable ADISC [0-1] = ",
-+ "Target Inquiry Data [0-1] = ",
-+ "Enable PDBC Notify [0-1] = ",
-+ "Non participating LIP [0-1] = ",
-+ "Descending Search LoopID [0-1] = ",
-+ "Acquire LoopID in LIPA [0-1] = ",
-+ "Stop PortQ on FullStatus [0-1] = ",
-+ "Full Login After LIP [0-1] = ",
-+ "Node Name option [0-1] = ",
-+ "Ext IFWCB enable bit [0-1] = "
-+ }
-+};
-+nv_param_t frame_payload_size = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nframe payload size [0-65535] = "
-+ }
-+};
-+nv_param_t max_iocb_allocation = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "max iocb allocation [0-65535] = "
-+ }
-+};
-+nv_param_t execution_throttle = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "execution throttle [0-65535] = "
-+ }
-+};
-+nv_param_t login_retry_count = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "login retry count [0-255] = "
-+ }
-+};
-+nv_param_t retry_delay = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "retry delay [0-255] = "
-+ }
-+};
-+nv_param_t port_name_0 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nport name 0 [0-255] = "
-+ }
-+};
-+nv_param_t port_name_1 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 1 (must be zero) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_2 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 2 (company ID) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_3 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 3 (company ID) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_4 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 4 (company ID) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_5 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 5 (serial number) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_6 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 6 (serial number) [0-255] = "
-+ }
-+};
-+nv_param_t port_name_7 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port name 7 (serial number) [0-255] = "
-+ }
-+};
-+nv_param_t hard_address = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nadapter hard loop ID [0-65535] = "
-+ }
-+};
-+nv_param_t inquiry = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "inquiry data [0-255] = "
-+ }
-+};
-+nv_param_t login_timeout = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "login timeout [0-255] = "
-+ }
-+};
-+nv_param_t node_name_0 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nnode name 0 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_1 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 1 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_2 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 2 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_3 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 3 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_4 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 4 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_5 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 5 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_6 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 6 [0-255] = "
-+ }
-+};
-+nv_param_t node_name_7 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "node name 7 [0-255] = "
-+ }
-+};
-+nv_param_t add_fw_opt = {
-+ BITS,
-+ { 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\n; Extended Parameter\n\nOperation Mode [0-15] = ",
-+ "Init Config Mode [0-7] = ",
-+ "Enable Non part on LIHA failure [0-1] = ",
-+ "Enable Class 2 [0-1] = ",
-+ "Enable Ack0 [0-1] = ",
-+ "Reserved [0-1] = ",
-+ "Reserved [0-1] = ",
-+ "Enable FC Tape [0-1] = ",
-+ "Enable FC Confirm [0-1] = ",
-+ "Enable Queueing [0-1] = ",
-+ "No Logo On Link Down [0-1] = "
-+ }
-+};
-+nv_param_t response_accumulation_timer = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nResponse Accumulation Timer [0-255] = "
-+ }
-+};
-+nv_param_t interrupt_delay_timer = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "Interrupt Delay Timer [0-255] = "
-+ }
-+};
-+nv_param_t special_options = {
-+ BITS,
-+ { 1, 1, 2, 2, 2, 5, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\n; special options\n\nenable read xfr rdy [0-1] = ",
-+ "not re-acquire ALPA during LIFA/LIPA [0-1] = ",
-+ "Reserved [0-3] = ",
-+ "FCP_RSP Payload Size [0-3] = ",
-+ "Reserved [0-3] = ",
-+ "Reserved [0-31] = ",
-+ "enable 50 ohm termination [0-1] = ",
-+ "Data Rate [0-3] = "
-+ }
-+};
-+nv_param_t rsv_word = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "reserved [0-65535] = "
-+ }
-+};
-+nv_param_t host_p = {
-+ BITS,
-+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, },
-+ 2,
-+ {
-+ "\n; HOST Parameter block\n\nunused [0-1] = ",
-+ "disable BIOS [0-1] = ",
-+ "disable LUNs [0-1] = ",
-+ "enable selectable boot [0-1] = ",
-+ "disable RISC code load [0-1] = ",
-+ "set cache line size 1 [0-1] = ",
-+ "PCI Parity Disable [0-1] = ",
-+ "enable extended logging [0-1] = ",
-+ "enable 64bit addressing [0-1] = ",
-+ "enable LIP reset [0-1] = ",
-+ "enable LIP full login [0-1] = ",
-+ "enable target reset [0-1] = ",
-+ "enable database storage [0-1] = ",
-+ "enable cache flush read [0-1] = ",
-+ "enable database load [0-1] = ",
-+ "unused [0-1] = "
-+ }
-+};
-+nv_param_t boot_node_name_0 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nboot node name 0 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_1 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 1 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_2 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 2 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_3 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 3 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_4 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 4 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_5 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 5 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_6 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 6 [0-255] = "
-+ }
-+};
-+nv_param_t boot_node_name_7 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot node name 7 [0-255] = "
-+ }
-+};
-+nv_param_t boot_lun_number = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot LUN number [0-255] = "
-+ }
-+};
-+nv_param_t reset_delay = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nreset delay [0-255] = "
-+ }
-+};
-+nv_param_t port_down_retry_count = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "port down retry count [0-255] = "
-+ }
-+};
-+nv_param_t boot_id_number = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot ID number [0-255] = "
-+ }
-+};
-+nv_param_t maximum_luns_per_target = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nmaximum LUNs per target [0-65535] = "
-+ }
-+};
-+nv_param_t boot_port_name_0 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nboot port name 0 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_1 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 1 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_2 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 2 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_3 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 3 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_4 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 4 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_5 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 5 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_6 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 6 [0-255] = "
-+ }
-+};
-+nv_param_t boot_port_name_7 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "boot port name 7 [0-255] = "
-+ }
-+};
-+nv_param_t adapter_features = {
-+ BITS,
-+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, },
-+ 2,
-+ {
-+ "\n; Adapter Features\n\nExternal GBIC [0-1] = ",
-+ "Risc RAM Parity [0-1] = ",
-+ "Buffer Plus Module [0-1] = ",
-+ "Multi Chip Adapter [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = ",
-+ "unused [0-1] = "
-+ }
-+};
-+nv_param_t subsystem_vendor_id = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nsubsystem vendor ID [0-65535] = "
-+ }
-+};
-+nv_param_t subsystem_device_id = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nsubsystem device ID [0-65535] = "
-+ }
-+};
-+nv_param_t subsystem_vendor_id_2200 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nsubsystem vendor ID 2 [0-65535] = "
-+ }
-+};
-+nv_param_t subsystem_device_id_2200 = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 2,
-+ {
-+ "\nsubsystem device ID 2 [0-65535] = "
-+ }
-+};
-+nv_param_t checksum = {
-+ NUMBER,
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-+ 1,
-+ {
-+ "\nchecksum [0-255] = "
-+ }
-+};
-+
-+input_t nvram_params[] = {
-+ { &nv.id[0], &nv_id },
-+ { &nv.nvram_version, &nv_version },
-+ { &nv.reserved_0, &rsv_byte },
-+ { &nv.parameter_block_version, &p_version },
-+ { &nv.reserved_1, &rsv_byte },
-+ { &nv.firmware_options[0], &firmware_options },
-+ { &nv.max_frame_length[0], &frame_payload_size },
-+ { &nv.max_iocb_allocation[0], &max_iocb_allocation },
-+ { &nv.execution_throttle[0], &execution_throttle },
-+ { &nv.login_retry_count, &login_retry_count },
-+ { &nv.retry_delay, &retry_delay },
-+ { &nv.port_name[0], &port_name_0 },
-+ { &nv.port_name[1], &port_name_1 },
-+ { &nv.port_name[2], &port_name_2 },
-+ { &nv.port_name[3], &port_name_3 },
-+ { &nv.port_name[4], &port_name_4 },
-+ { &nv.port_name[5], &port_name_5 },
-+ { &nv.port_name[6], &port_name_6 },
-+ { &nv.port_name[7], &port_name_7 },
-+ { &nv.hard_address[0], &hard_address },
-+ { &nv.inquiry, &inquiry },
-+ { &nv.login_timeout, &login_timeout },
-+ { &nv.node_name[0], &node_name_0 },
-+ { &nv.node_name[1], &node_name_1 },
-+ { &nv.node_name[2], &node_name_2 },
-+ { &nv.node_name[3], &node_name_3 },
-+ { &nv.node_name[4], &node_name_4 },
-+ { &nv.node_name[5], &node_name_5 },
-+ { &nv.node_name[6], &node_name_6 },
-+ { &nv.node_name[7], &node_name_7 },
-+ { &nv.add_fw_opt[0], &add_fw_opt },
-+ { &nv.response_accumulation_timer, &response_accumulation_timer },
-+ { &nv.interrupt_delay_timer, &interrupt_delay_timer },
-+ { &nv.special_options[0], &special_options },
-+ { &nv.reserved_4[0], &rsv_word },
-+ { &nv.reserved_4[2], &rsv_word },
-+ { &nv.reserved_4[4], &rsv_word },
-+ { &nv.reserved_4[6], &rsv_word },
-+ { &nv.reserved_4[8], &rsv_word },
-+ { &nv.reserved_4[10], &rsv_word },
-+ { &nv.reserved_4[12], &rsv_word },
-+ { &nv.reserved_4[14], &rsv_word },
-+ { &nv.reserved_4[16], &rsv_word },
-+ { &nv.reserved_4[18], &rsv_word },
-+ { &nv.reserved_4[20], &rsv_word },
-+ { &nv.reserved_4[22], &rsv_word },
-+ { &nv.reserved_4[24], &rsv_word },
-+ { &nv.host_p[0], &host_p },
-+ { &nv.boot_node_name[0], &boot_node_name_0 },
-+ { &nv.boot_node_name[1], &boot_node_name_1 },
-+ { &nv.boot_node_name[2], &boot_node_name_2 },
-+ { &nv.boot_node_name[3], &boot_node_name_3 },
-+ { &nv.boot_node_name[4], &boot_node_name_4 },
-+ { &nv.boot_node_name[5], &boot_node_name_5 },
-+ { &nv.boot_node_name[6], &boot_node_name_6 },
-+ { &nv.boot_node_name[7], &boot_node_name_7 },
-+ { &nv.boot_lun_number, &boot_lun_number },
-+ { &nv.reset_delay, &reset_delay },
-+ { &nv.port_down_retry_count, &port_down_retry_count },
-+ { &nv.boot_id_number, &boot_id_number },
-+ { &nv.maximum_luns_per_target[0], &maximum_luns_per_target },
-+ { &nv.boot_port_name[0], &boot_port_name_0 },
-+ { &nv.boot_port_name[1], &boot_port_name_1 },
-+ { &nv.boot_port_name[2], &boot_port_name_2 },
-+ { &nv.boot_port_name[3], &boot_port_name_3 },
-+ { &nv.boot_port_name[4], &boot_port_name_4 },
-+ { &nv.boot_port_name[5], &boot_port_name_5 },
-+ { &nv.boot_port_name[6], &boot_port_name_6 },
-+ { &nv.boot_port_name[7], &boot_port_name_7 },
-+ { &nv.reserved_6[0], &rsv_word },
-+ { &nv.reserved_6[2], &rsv_word },
-+ { &nv.reserved_6[4], &rsv_word },
-+ { &nv.reserved_7[0], &rsv_word }, /* 100 */
-+ { &nv.reserved_7[2], &rsv_word },
-+ { &nv.reserved_7[4], &rsv_word },
-+ { &nv.reserved_7[6], &rsv_word },
-+ { &nv.reserved_7[8], &rsv_word },
-+ { &nv.reserved_7[10], &rsv_word },
-+ { &nv.reserved_7[12], &rsv_word },
-+ { &nv.reserved_7[14], &rsv_word },
-+ { &nv.reserved_7[16], &rsv_word },
-+ { &nv.reserved_7[18], &rsv_word },
-+ { &nv.reserved_7[20], &rsv_word },
-+ { &nv.reserved_7[22], &rsv_word },
-+ { &nv.reserved_7[24], &rsv_word },
-+ { &nv.reserved_7[26], &rsv_word },
-+ { &nv.reserved_7[28], &rsv_word },
-+ { &nv.reserved_7[30], &rsv_word },
-+ { &nv.reserved_7[32], &rsv_word },
-+ { &nv.reserved_7[34], &rsv_word },
-+ { &nv.reserved_7[36], &rsv_word },
-+ { &nv.reserved_7[38], &rsv_word },
-+ { &nv.reserved_7[40], &rsv_word },
-+ { &nv.reserved_7[42], &rsv_word },
-+ { &nv.reserved_7[44], &rsv_word },
-+ { &nv.reserved_7[46], &rsv_word },
-+ { &nv.reserved_7[48], &rsv_word },
-+ { &nv.reserved_8[0], &rsv_word }, /* 150 */
-+ { &nv.reserved_8[2], &rsv_word },
-+ { &nv.reserved_8[4], &rsv_word },
-+ { &nv.reserved_8[6], &rsv_word },
-+ { &nv.reserved_8[8], &rsv_word },
-+ { &nv.reserved_8[10], &rsv_word },
-+ { &nv.reserved_8[12], &rsv_word },
-+ { &nv.reserved_8[14], &rsv_word },
-+ { &nv.reserved_8[16], &rsv_word },
-+ { &nv.reserved_8[18], &rsv_word },
-+ { &nv.reserved_8[20], &rsv_word },
-+ { &nv.reserved_8[22], &rsv_word },
-+ { &nv.reserved_8[24], &rsv_word },
-+ { &nv.reserved_8[26], &rsv_word },
-+ { &nv.reserved_8[28], &rsv_word },
-+ { &nv.reserved_8[30], &rsv_word },
-+ { &nv.reserved_8[32], &rsv_word },
-+ { &nv.reserved_8[34], &rsv_word },
-+ { &nv.reserved_8[36], &rsv_word },
-+ { &nv.reserved_8[38], &rsv_word },
-+ { &nv.reserved_8[40], &rsv_word },
-+ { &nv.reserved_8[42], &rsv_word },
-+ { &nv.reserved_8[44], &rsv_word },
-+ { &nv.reserved_8[46], &rsv_word },
-+ { &nv.reserved_8[48], &rsv_word },
-+ { &nv.reserved_9[0], &rsv_word }, /* 200 */
-+ { &nv.reserved_9[2], &rsv_word },
-+ { &nv.reserved_9[4], &rsv_word },
-+ { &nv.reserved_9[6], &rsv_word },
-+ { &nv.reserved_9[8], &rsv_word },
-+ { &nv.reserved_9[10], &rsv_word },
-+ { &nv.reserved_9[12], &rsv_word },
-+ { &nv.reserved_9[14], &rsv_word },
-+ { &nv.reserved_9[16], &rsv_word },
-+ { &nv.reserved_9[18], &rsv_word },
-+ { &nv.reserved_9[20], &rsv_word },
-+ { &nv.reserved_9[22], &rsv_word },
-+ { &nv.reserved_9[24], &rsv_word },
-+ { &nv.reserved_9[26], &rsv_word },
-+ { &nv.reserved_9[28], &rsv_word },
-+ { &nv.reserved_9[30], &rsv_word },
-+ { &nv.adapter_features[0], &adapter_features },
-+ { &nv.reserved_10[0], &rsv_word },
-+ { &nv.reserved_10[2], &rsv_word },
-+ { &nv.reserved_10[4], &rsv_word },
-+ { &nv.reserved_11[0], &rsv_word },
-+ { &nv.reserved_11[2], &rsv_word },
-+ { &nv.subsystem_vendor_id[0], &subsystem_vendor_id },
-+ { &nv.reserved_12[0], &rsv_word },
-+ { &nv.subsystem_device_id[0], &subsystem_device_id },
-+ { &nv.subsystem_vendor_id_2200[0], &subsystem_vendor_id_2200 },
-+ { &nv.subsystem_device_id_2200[0], &subsystem_device_id_2200 },
-+ { &nv.reserved_13, &rsv_byte },
-+ { &nv.checksum, &checksum }
-+};
-+
-+/*
-+ * Local function prototypes.
-+ */
-+static void usage(void);
-+static void bin2asc(void);
-+static void asc2bin(void);
-+static void get_param(input_t *);
-+static uint8_t calc_checksum(void);
-+static void dmp_param(input_t *);
-+
-+/*
-+ * Local functions.
-+ */
-+int
-+main(int argc, char *argv[])
-+{
-+ if (argc != 2) {
-+ usage();
-+ exit(3);
-+ }
-+
-+ if (strcmp(argv[1], "-a") == 0) {
-+ bin2asc();
-+ } else if (strcmp(argv[1], "-b") == 0) {
-+ asc2bin();
-+ } else {
-+ usage();
-+ exit(3);
-+ }
-+
-+ return 0;
-+}
-+
-+static void
-+usage(void)
-+{
-+ fprintf(stderr, "QLogic NVRAM Parser: %s\n", qla_version);
-+ fprintf(stderr, "Usage:\n");
-+ fprintf(stderr, " qla_nvr [-a] [-b] -\n");
-+ fprintf(stderr, " -a -- convert raw nvram to ASCII\n");
-+ fprintf(stderr, " -b -- convert ASCII to raw nvram\n\n");
-+}
-+
-+static void
-+bin2asc(void)
-+{
-+ int stat = 0;
-+ uint32_t i;
-+
-+ /* Get NVRAM data. */
-+ fread(&nv, sizeof(char), sizeof(nvram_t), stdin);
-+
-+ for (i = 0; nvram_params[i].nvp != &checksum; i++) {
-+ if (nvram_params[i].nvp == &rsv_word ||
-+ nvram_params[i].nvp == &rsv_byte) {
-+ if (stat == 0) {
-+ printf("\n");
-+ stat++;
-+ }
-+ } else {
-+ stat = 0;
-+ }
-+ dmp_param(&nvram_params[i]);
-+ }
-+
-+ if (calc_checksum() != 0) {
-+ fprintf(stderr, "qla_nvr: NVRAM checksum error!!!\n");
-+ exit(2);
-+ }
-+}
-+
-+static void
-+asc2bin(void)
-+{
-+ uint32_t i;
-+
-+ memset(&nv, 0, sizeof(nvram_t));
-+
-+ for (i = 0; nvram_params[i].nvp != &checksum; i++)
-+ get_param(&nvram_params[i]);
-+
-+ /* Check for proper port name. */
-+ if (nv.port_name[0] != 33 || nv.port_name[2] != 0 ||
-+ nv.port_name[3] != 224 || nv.port_name[4] != 139) {
-+ fprintf(stderr, "qla_nvr: Invalid port name!!!\n");
-+ exit(1);
-+ }
-+
-+ /* calculate checksum */
-+ nv.checksum = ~calc_checksum() + 1;
-+
-+ /* Write NVRAM data. */
-+ fwrite(&nv, sizeof(char), sizeof(nvram_t), stdout);
-+}
-+
-+static void
-+get_param(input_t *inp)
-+{
-+ char s[MAX_PARAMS_SIZE];
-+ uint32_t i;
-+ uint32_t n = 0;
-+ uint8_t bc = 0;
-+ uint8_t bp = 0;
-+ uint32_t b = 0;
-+
-+ while (fgets(s, MAX_PARAMS_SIZE, stdin) != NULL) {
-+ i = 0;
-+ while (isspace(s[i]))
-+ i++;
-+ if(s[i] == ';' || s[i] == '\0')
-+ continue;
-+
-+ while (s[i++] != '=')
-+ ;
-+ while (isspace(s[i]))
-+ i++;
-+
-+ /* Get decimal number. */
-+ n = 0;
-+ while (s[i] != '\0') {
-+ if (inp->nvp->type == STRING) {
-+ if (s[i] == '"') {
-+ i++;
-+ } else {
-+ n |= s[i++] << (bp++ * 8);
-+ if (bp == inp->nvp->bytes)
-+ break;
-+ }
-+ } else {
-+ n = atol(&s[i]);
-+ break;
-+ }
-+ }
-+
-+ /* If number or string, done. */
-+ if (inp->nvp->type == NUMBER || inp->nvp->type == STRING) {
-+ break;
-+ }
-+
-+ /* Bits. */
-+ b |= n << bc;
-+ bc += inp->nvp->bits[bp++];
-+ if (bp == inp->nvp->bytes * 8 || inp->nvp->bits[bp] == 0) {
-+ n = b;
-+ break;
-+ }
-+ }
-+
-+ /* Store input data. */
-+ for (i = 0; i < inp->nvp->bytes; i++) {
-+ inp->addr[i] = (uint8_t)n;
-+ n >>= 8;
-+ }
-+}
-+
-+static uint8_t
-+calc_checksum(void)
-+{
-+ uint32_t i;
-+ uint8_t rval = 0;
-+ uint8_t *nvp = (uint8_t *)&nv;
-+
-+ for (i = 0; i < sizeof (nvram_t); i++)
-+ rval += *nvp++;
-+
-+ return (rval);
-+}
-+
-+
-+static void
-+dmp_param(input_t *inp)
-+{
-+ uint32_t i;
-+ uint32_t n;
-+ uint32_t x;
-+ uint32_t b;
-+ uint8_t bc = 0;
-+ uint8_t bp = 0;
-+
-+ /* Get number. */
-+ n = 0;
-+ x = inp->nvp->bytes;
-+ while (x != 0) {
-+ n <<= 8;
-+ n |= inp->addr[--x];
-+ }
-+
-+ for (i = 0; i < MAX_STRINGS && inp->nvp->strings[i] != NULL; i++) {
-+ /* If number, done. */
-+ if (inp->nvp->type == NUMBER) {
-+ printf("%s%d\n", inp->nvp->strings[i], n);
-+ return;
-+ }
-+
-+ /* If string, done. */
-+ if (inp->nvp->type == STRING) {
-+ printf("%s\"", inp->nvp->strings[i]);
-+ for (x = 0; x < inp->nvp->bytes; x++) {
-+ bc = n & 0xff;
-+ n >>= 8;
-+ printf("%c", bc);
-+ }
-+ printf("\"\n");
-+ return;
-+ }
-+
-+ /* Make bit mask. */
-+ for (b = 0, x = 0; x < inp->nvp->bits[bp]; x++)
-+ b = b << 1 | 1;
-+
-+ /* Get masked data. */
-+ b = n >> bc & b;
-+ bc += inp->nvp->bits[bp++];
-+
-+ /* Output string and number. */
-+ printf("%s%d\n", inp->nvp->strings[i], b);
-+
-+ /* Test for last bit. */
-+ if (bp == inp->nvp->bytes * 8 || inp->nvp->bits[bp] == 0)
-+ break;
-+ }
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_opts.c ./drivers/scsi/qla2xxx/extras/qla_opts.c
---- ./drivers/scsi/qla2xxx.qla2xxx/extras/qla_opts.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/extras/qla_opts.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,997 @@
-+/*
-+ * Program to display or modify configuration data for an executable.
-+ * In order for this to work, the main application or a library it contains
-+ * must have been built using the data structures provided by the
-+ * include file "configprog.h".
-+ *
-+ * Copyright (c) 2003 by David I. Bell.
-+ * Permission is granted to copy, distribute, modify, and use this source
-+ * file provided that this copyright notice remains intact.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <limits.h>
-+#include <memory.h>
-+#include <string.h>
-+#define _GNU_SOURCE
-+#include <getopt.h>
-+#include <sys/stat.h>
-+#include <sys/types.h>
-+#include <sys/utsname.h>
-+
-+#include "../qla_opts.h"
-+
-+
-+/*
-+ * Make a typedef for our convenience.
-+ */
-+typedef config_entry_t ENTRY;
-+
-+
-+/*
-+ * Boolean definitions.
-+ */
-+typedef int BOOL;
-+
-+#define TRUE ((BOOL) 1)
-+#define FALSE ((BOOL) 0)
-+
-+
-+/*
-+ * Useful macros to examine table entries.
-+ */
-+#define TO_ENTRY(cp) ((ENTRY *) (cp))
-+#define TO_CONST_ENTRY(cp) ((const ENTRY *) (cp))
-+#define TO_CP(entry) ((char *) (entry))
-+#define NEXT_ENTRY(entry) TO_ENTRY(TO_CP(entry) + (entry)->next)
-+#define NEXT_CONST_ENTRY(entry) TO_CONST_ENTRY(TO_CP(entry) + (entry)->next)
-+#define IS_LAST(entry) ((entry)->next <= 0)
-+#define IS_PADDING(entry) (!IS_LAST(entry) && ((entry)->name[0] == '\0'))
-+#define IS_ID(entry) (!IS_LAST(entry) && (strcmp((entry)->name, CONFIG_ID_MAGIC) == 0))
-+
-+
-+/*
-+ * Sizes and other definitions.
-+ */
-+#define DEFAULT_TABLE "MAIN"
-+#define VALUE_SIZE sizeof(CONFIG_VALUE_MAGIC)
-+#define NULL_ENTRY ((ENTRY *) 0)
-+#define BUF_SIZE sizeof(config_table_def_t) + NAME_SIZE /* enough to read in whole config table */
-+#define ALIGNMENT 4
-+
-+
-+/*
-+ * Structure which holds information about one of the configuration
-+ * tables found in the executable. The table name is usually a
-+ * pointer into the table data, and so should not be freed.
-+ */
-+typedef struct TABLE TABLE;
-+
-+struct TABLE
-+{
-+ const char * name; /* name of this table */
-+ off_t offset; /* file offset of table */
-+ long size; /* size of the table */
-+ char * data; /* data for the table */
-+ TABLE * nextTable; /* next table in list */
-+};
-+
-+
-+void
-+qldbg_print(char *);
-+/*
-+ * Local function definitions.
-+ */
-+static void usage(int);
-+static void printValues(void);
-+static void setValues(void);
-+static void setTableValues(TABLE *);
-+static void printTableValues(const TABLE *);
-+static void openProgram(const char *, BOOL);
-+static void closeProgram(void);
-+static TABLE * getTable(const char *);
-+static void findTables(void);
-+static void readTable(TABLE *);
-+static int getTotalSpace(const TABLE *);
-+static ENTRY * findEntry(const TABLE *, const char *);
-+static int getEntrySize(const ENTRY *);
-+static int search(const char *, int);
-+static void fatalError(const char *);
-+static void systemError(const char *);
-+
-+
-+/*
-+ * Global variables.
-+ */
-+FILE * dbghandle = NULL;
-+char dbgstr[160];
-+static int fd; /* opened file descriptor */
-+static TABLE * tableList; /* linked list of configuration tables */
-+static const char * tableName; /* configuration table name to process */
-+
-+/*
-+ * Usage text for the program.
-+ * This array must be terminated by a null pointer.
-+ */
-+static const char * usageText[] =
-+{
-+ "",
-+ "qla_opts -- QLogic driver options utility -- v2",
-+ "",
-+ "Usage: qla_opts [OPTIONS]... MODULE",
-+ "",
-+ "Description:",
-+ " Configure/Display QLogic Driver option information for a MODULE.",
-+ "",
-+ " -f, --file=[FILE]",
-+ " use module FILE for operations",
-+ " -h, --help",
-+ " display this help and exit",
-+ " -p, --print",
-+ " display option data embedded in a module",
-+ " -v, --verbose",
-+ " display extra debug information during operations",
-+ " -w, --write",
-+ " write option data to a module",
-+ "",
-+ " MODULE must be 'qla2100_conf', 'qla2200_conf', 'qla2300_conf',",
-+ " 'qla200_conf', or 'qla2xxx_conf'.",
-+ "",
-+ "Option Data:",
-+ " Option data is read from one of the following files depending on the",
-+ " value of the MODULE parameter:",
-+ "",
-+ " FILE MODULE",
-+ " ----------------- -------",
-+ " /etc/qla2xxx.conf qla2xxx_conf",
-+ "",
-+ " By default, the following directory is used to specify the location of",
-+ " the modules to update:",
-+ "",
-+ " /lib/modules/`uname -r`/kernel/drivers/scsi/qla2xxx",
-+ "",
-+ " Where `uname -r` resolves to the release name of the currently running",
-+ " kernel.",
-+ "",
-+ " If a FILE is specified, MODULE instructs qla_opts to read option data ",
-+ " from the appropriate configuration file.",
-+ "",
-+ "Examples:",
-+ "",
-+ " Display option data for the default qla2xxx_conf module:",
-+ "",
-+ " # qla_opts --print qla2xxx_conf",
-+ "",
-+ " Write option data to the qla2xxx_conf module:",
-+ "",
-+ " # qla_opts --write qla2xxx_conf",
-+ "",
-+ " Write qla2xxx_conf type option data for a specified module:",
-+ "",
-+ " # qla_opts --write --file=/usr/smith/driver/qla2xxx_conf.o qla2xxx_conf",
-+ "",
-+ 0
-+};
-+
-+#define OPT_PRINT 0
-+#define OPT_WRITE 1
-+
-+#define MODULE_NONE 0
-+#define MODULE_QLA2XXX_CONF 5
-+struct module_info {
-+
-+ char *name;
-+ int id;
-+ char *conf_fname;
-+
-+};
-+static struct module_info modules[] = {
-+ { "qla2xxx_conf", MODULE_QLA2XXX_CONF, "/etc/qla2xxx.conf" },
-+ { NULL, 0, NULL }
-+};
-+struct module_info *module = NULL;
-+
-+int operation = OPT_PRINT;
-+int verbose;
-+struct utsname uts_info;
-+char def_module_path[PATH_MAX];
-+char module_name[PATH_MAX] = { 0 };
-+
-+int
-+main(int argc, char * const argv[])
-+{
-+ int next_opt;
-+ const char *short_opts = "f:hpvw";
-+ const struct option long_opts[] = {
-+
-+ { "file", 1, NULL, 'f' },
-+ { "help", 0, NULL, 'h' },
-+ { "print", 0, NULL, 'p' },
-+ { "verbose", 0, NULL, 'v' },
-+ { "write", 0, NULL, 'w' },
-+ { NULL, 0, NULL, 0 }
-+ };
-+ struct module_info *mod_iter;
-+
-+ if (uname(&uts_info)) {
-+ fprintf(stderr, "***Unable to retrieve uname() system information...exiting!\n");
-+ exit(1);
-+ }
-+
-+ /* Prepare update defaults */
-+ verbose = 0;
-+ sprintf(def_module_path, "/lib/modules/%s/kernel/drivers/scsi/qla2xxx",
-+ uts_info.release);
-+
-+ /* Scan through options */
-+ do {
-+ next_opt = getopt_long(argc, argv, short_opts, long_opts, NULL);
-+ switch (next_opt) {
-+ case 'f':
-+ /* Use alternate module
-+ *
-+ * -f <module file> or --file=<module file>
-+ */
-+ strcpy(module_name, optarg);
-+ break;
-+
-+ case 'h':
-+ /* Display usage
-+ *
-+ * -h or --help
-+ */
-+ usage(0);
-+ break;
-+
-+ case 'p':
-+ /* Display option information
-+ *
-+ * -p or --print
-+ */
-+ operation = OPT_PRINT;
-+ break;
-+
-+ case 'v':
-+ /* Verbose operations
-+ *
-+ * -v or --verbose
-+ */
-+ verbose++;
-+ break;
-+
-+ case 'w':
-+ /* Perform option write
-+ *
-+ * -w or --write
-+ */
-+ operation = OPT_WRITE;
-+ break;
-+
-+ case '?':
-+ /* Invalid option */
-+ usage(1);
-+ break;
-+
-+ case -1:
-+ /* Done with options */
-+ break;
-+
-+ default:
-+ /* Something bad happened! */
-+ abort();
-+ break;
-+ }
-+ } while (next_opt != -1);
-+
-+ /* Determine module */
-+ if (optind == argc) {
-+ printf("*** No MODULE specified!\n");
-+ usage(2);
-+ }
-+ module = NULL;
-+ for (mod_iter = modules; mod_iter->name; mod_iter++) {
-+ if (strcmp(argv[optind], mod_iter->name) == 0) {
-+ module = mod_iter;
-+ /* Default, if no module specified */
-+ if (!module_name[0])
-+ sprintf(module_name, "%s/%s.ko",
-+ def_module_path, mod_iter->name);
-+ break;
-+ }
-+ }
-+ if (module == MODULE_NONE) {
-+ printf("*** Invalid MODULE specified (%s)!\n", argv[optind]);
-+ usage(3);
-+ }
-+
-+ /* Determine operation */
-+ if (verbose)
-+ printf("Updating module: (%s)\n", module_name);
-+
-+ if (operation == OPT_PRINT)
-+ printValues();
-+ else if (operation == OPT_WRITE)
-+ setValues();
-+
-+ return 0;
-+}
-+
-+void
-+qldbg_print(char *string)
-+{
-+ if (dbghandle) {
-+ fprintf(dbghandle, string);
-+ }
-+}
-+
-+
-+/*
-+ * Print out the usage text and exit.
-+ */
-+static void
-+usage(int ret_code)
-+{
-+ const char ** cpp;
-+
-+ for (cpp = usageText; *cpp; cpp++)
-+ fprintf(stdout, "%s\n", *cpp);
-+
-+ exit(ret_code);
-+}
-+
-+
-+/*
-+ * Print out the configuration values in a program
-+ * for a table or all tables.
-+ */
-+static void
-+printValues(void)
-+{
-+ const TABLE * table;
-+
-+ openProgram(module_name, FALSE);
-+
-+ if (tableName == 0)
-+ {
-+ if ((tableList == 0) && verbose)
-+ {
-+ printf("No configuration tables are present\n");
-+
-+ return;
-+ }
-+
-+ for (table = tableList; table; table = table->nextTable)
-+ {
-+ if (verbose && (table != tableList))
-+ printf("\n");
-+
-+ printTableValues(table);
-+ }
-+ }
-+ else
-+ {
-+ table = getTable(tableName);
-+
-+ printTableValues(table);
-+ }
-+
-+ closeProgram();
-+}
-+
-+
-+/*
-+ * Set configuration values for one of the tables in a program.
-+ * Each value is of the form "name=value", where name must already
-+ * be present in the specified configuration table.
-+ */
-+static void
-+setValues(void)
-+{
-+ TABLE * table;
-+
-+ /*
-+ * Open the program for writing.
-+ */
-+ openProgram(module_name, TRUE);
-+
-+ if (tableName == 0)
-+ tableName = module->name;
-+
-+ table = getTable(tableName);
-+
-+ setTableValues(table);
-+
-+ closeProgram();
-+}
-+
-+
-+/*
-+ * Print the configuration values in the specified table.
-+ * This can be done in either brief or verbose format.
-+ */
-+static void
-+printTableValues(const TABLE * table)
-+{
-+ const ENTRY * entry;
-+ int totalSpace;
-+ const char * format;
-+
-+ format = "%s=%s\n";
-+
-+ if (verbose)
-+ {
-+ format = " %-16s %s\n";
-+
-+ totalSpace = getTotalSpace(table);
-+
-+ printf("Table \"%s\" (total %d bytes):\n",
-+ table->name, totalSpace);
-+ }
-+
-+ entry = TO_CONST_ENTRY(table->data);
-+ entry = NEXT_CONST_ENTRY(entry);
-+
-+ if (IS_ID(entry))
-+ entry = NEXT_CONST_ENTRY(entry);
-+
-+ while (!IS_LAST(entry))
-+ {
-+ if (!IS_PADDING(entry)) {
-+
-+ printf(format, entry->name, entry->value);
-+ }
-+
-+ entry = NEXT_CONST_ENTRY(entry);
-+ }
-+
-+}
-+
-+
-+/*
-+ * Set configuration values for the specified table in a program.
-+ * Each value is of the form "name=value", where name must already
-+ * be present in the specified configuration table.
-+ */
-+static void
-+setTableValues(TABLE * table)
-+{
-+ ENTRY * entry; /* current entry */
-+ int cc; /* amount of data written */
-+
-+ FILE *conf_file;
-+ int cnt;
-+ struct stat conf_stats;
-+ int mod_max_size;
-+ int data_size;
-+ char *conf_data;
-+
-+
-+ conf_file = fopen(module->conf_fname, "r");
-+ if (conf_file == NULL) {
-+ fprintf(stderr,
-+ "qla_opts: unable to load conf file (%s)!!!\n",
-+ module->conf_fname);
-+
-+ exit(1);
-+ }
-+
-+ if (verbose)
-+ printf("Using conf file: (%s)\n", module->conf_fname);
-+
-+ /* Determine max size to read */
-+ mod_max_size = getTotalSpace(table);
-+ fstat(fileno(conf_file), &conf_stats);
-+ data_size = conf_stats.st_size;
-+ if (conf_stats.st_size > mod_max_size) {
-+ fprintf(stderr,
-+ "qla_opts: reduce conf file size -- (max=%d)!!!\n",
-+ mod_max_size);
-+
-+ exit(1);
-+ }
-+
-+ conf_data = malloc(data_size+1);
-+ conf_data[data_size] = 0;
-+ cnt = fread(conf_data, sizeof(char), data_size, conf_file);
-+ if (cnt != data_size) {
-+ fprintf(stderr,
-+ "qla_opts: unable to read conf data!!!\n");
-+ free(conf_data);
-+
-+ exit(1);
-+ }
-+ fclose(conf_file);
-+
-+ if (verbose)
-+ printf("Read %d (%s)\n", cnt, conf_data);
-+
-+ readTable(table);
-+
-+ /*
-+ * Find the configuration entry with that name.
-+ */
-+ entry = findEntry(table, "OPTIONS");
-+ if (entry == NULL_ENTRY) {
-+ fprintf(stderr,
-+ "%s: configuration name \"%s\" undefined\n",
-+ module_name, "OPTIONS");
-+ free(conf_data);
-+
-+ exit(1);
-+ }
-+
-+ /*
-+ * Make sure the new value will fit, and then copy the
-+ * new value into the table.
-+ */
-+ if ((entry->value + strlen(conf_data)) >=
-+ (TO_CP(entry) + entry->next)) {
-+ free(conf_data);
-+ fatalError("Insufficient room in table for specified "
-+ "config values");
-+ }
-+
-+ strcpy(entry->value, conf_data);
-+
-+ free(conf_data);
-+
-+ /*
-+ * All new values have been set, now write back out the table.
-+ */
-+
-+ if (lseek(fd, table->offset, 0) < 0)
-+ systemError("lseek");
-+
-+ cc = write(fd, table->data, table->size);
-+
-+ if (cc < 0)
-+ systemError("write");
-+
-+ if (cc != table->size)
-+ fatalError("Short write");
-+
-+ if (verbose)
-+ printf("Successful update...\n");
-+}
-+
-+
-+/*
-+ * Find the entry corresponding to the specifed name.
-+ * Returns a pointer to the found configuration entry, or
-+ * NULL_ENTRY if there is no entry with that name.
-+ */
-+static ENTRY *
-+findEntry(const TABLE * table, const char * entryName)
-+{
-+ ENTRY * entry;
-+
-+ entry = TO_ENTRY(table->data);
-+ entry = NEXT_ENTRY(entry);
-+
-+ while (!IS_LAST(entry))
-+ {
-+ if (strcmp(entry->name, entryName) == 0)
-+ return entry;
-+
-+ entry = NEXT_ENTRY(entry);
-+ }
-+
-+ return NULL_ENTRY;
-+}
-+
-+
-+/*
-+ * Return the actual size of an entry based on its configuration value.
-+ * The size is rounded up to the next multiple of ALIGNMENT bytes.
-+ */
-+static int
-+getEntrySize(const ENTRY * entry)
-+{
-+ int valueSize; /* space used by config value */
-+ int entrySize; /* space used by whole entry */
-+
-+ valueSize = strlen(entry->value) + 1;
-+
-+ entrySize = CONFIG_NAME_SIZE + sizeof(int) + sizeof(int) + valueSize;
-+
-+ if (entrySize % ALIGNMENT)
-+ entrySize += ALIGNMENT - (entrySize % ALIGNMENT);
-+
-+ return entrySize;
-+}
-+
-+/*
-+ * Find out the amount of total space in the configuration table.
-+ */
-+static int
-+getTotalSpace(const TABLE * table)
-+{
-+ const ENTRY * entry;
-+ int totalSpace;
-+
-+ entry = TO_CONST_ENTRY(table->data);
-+
-+ totalSpace = entry->next;
-+
-+ entry = NEXT_CONST_ENTRY(entry);
-+
-+ while (!IS_LAST(entry))
-+ {
-+ totalSpace += entry->next;
-+
-+ entry = NEXT_CONST_ENTRY(entry);
-+ }
-+
-+ return totalSpace;
-+}
-+
-+/*
-+ * Return information about the specified table name.
-+ * Exits if the table is not present or is duplicated.
-+ */
-+static TABLE *
-+getTable(const char * tableName)
-+{
-+ TABLE * table;
-+ TABLE * foundTable;
-+
-+ foundTable = 0;
-+
-+ for (table = tableList; table; table = table->nextTable)
-+ {
-+ if (strcmp(table->name, tableName) == 0)
-+ {
-+ if (foundTable)
-+ {
-+ fprintf(stderr,
-+ "%s: Duplicate configuration "
-+ "table \"%s\"\n",
-+ module_name, tableName);
-+
-+ exit(1);
-+ }
-+
-+ foundTable = table;
-+ }
-+ }
-+
-+ if (foundTable == 0)
-+ {
-+ fprintf(stderr,
-+ "%s: Configuration table \"%s\" does not exist\n",
-+ module_name, tableName);
-+
-+ exit(1);
-+ }
-+
-+ /*
-+ * Return the unique table.
-+ */
-+ return foundTable;
-+}
-+
-+
-+/*
-+ * Search an opened file for the offsets of all of the configuration
-+ * tables in the opened file, and read those tables into memory.
-+ * The tricky part is handling strings which cross buffer boundaries.
-+ */
-+static void
-+findTables(void)
-+{
-+ TABLE * table; /* table entry */
-+ const char * data; /* data left to examine in buffer */
-+ int dataSize; /* amount of data left to examine */
-+ int cc; /* amount of data read */
-+ int searchIndex; /* index of found string */
-+ off_t currentOffset; /* current file position */
-+ off_t tableOffset; /* position of table */
-+ char *buffer;
-+ BOOL found = FALSE;
-+
-+ currentOffset = 0;
-+ buffer = malloc(BUF_SIZE + NAME_SIZE);
-+ if (buffer == NULL)
-+ fatalError("Memory allocation failed");
-+ memset(buffer, 0, NAME_SIZE);
-+
-+ /*
-+ * Read data from the file a buffer at a time and search it.
-+ * Keep copying the last bit of data from the end of the previous
-+ * buffer to the beginning of the next buffer so that the magic
-+ * string value can be found even across buffer boundaries.
-+ */
-+ while ((cc = read(fd, buffer + NAME_SIZE, BUF_SIZE)) > 0)
-+ {
-+ data = buffer;
-+ dataSize = cc + NAME_SIZE;
-+
-+ while ((searchIndex = search(data, dataSize)) >= 0)
-+ {
-+ table = (TABLE *) malloc(sizeof(TABLE));
-+
-+ if (table == 0)
-+ fatalError("Memory allocation failed");
-+
-+ tableOffset = currentOffset + (data - buffer) +
-+ searchIndex - NAME_SIZE;
-+
-+ table->name = "";
-+ table->offset = tableOffset;
-+ table->size = 0;
-+ table->nextTable = tableList;
-+
-+ tableList = table;
-+
-+ data += (searchIndex + NAME_SIZE);
-+ dataSize -= (searchIndex + NAME_SIZE);
-+
-+ found = TRUE;
-+ break;
-+ }
-+ if (found)
-+ break;
-+
-+ memcpy(buffer, buffer + BUF_SIZE, NAME_SIZE);
-+
-+ currentOffset += cc;
-+ }
-+
-+ free(buffer);
-+ if (cc < 0)
-+ systemError("read");
-+}
-+
-+
-+/*
-+ * Read in the complete table data for the specified table given
-+ * its beginning offset.
-+ */
-+static void
-+readTable(TABLE * table)
-+{
-+ const ENTRY * entry; /* current config entry */
-+ char * data; /* current table data */
-+ int dataSize; /* current table data size */
-+ int maxSize; /* current max size of table */
-+ int growSize; /* amount to grow table by */
-+ int cc; /* amount read */
-+
-+ /*
-+ * Allocate the initial buffer which will be reallocated as needed.
-+ */
-+ maxSize = BUF_SIZE;
-+
-+ data = malloc(BUF_SIZE);
-+ if (data == 0)
-+ fatalError("Cannot allocate table");
-+
-+ /*
-+ * Seek to the correct position and read the first bit of the table.
-+ * If the end of the file is reached early, then zero the buffer
-+ * and an error will be detected later.
-+ */
-+ if (lseek(fd, table->offset, 0) < 0)
-+ systemError("lseek");
-+
-+ cc = read(fd, data, BUF_SIZE);
-+
-+ if (cc < 0)
-+ systemError("read");
-+
-+ if (cc < BUF_SIZE)
-+ memset(data + cc, 0, BUF_SIZE - cc);
-+
-+ /*
-+ * Verify more completely that this is really a valid table.
-+ */
-+ entry = TO_ENTRY(data);
-+
-+ if (memcmp(entry->name, CONFIG_NAME_MAGIC, NAME_SIZE))
-+ fatalError("Bad table magic name");
-+
-+ if (memcmp(entry->value, CONFIG_VALUE_MAGIC, VALUE_SIZE))
-+ fatalError("Bad table magic value");
-+
-+ if (entry->next <= NAME_SIZE + VALUE_SIZE)
-+ fatalError("Bad next value or variable in table");
-+
-+ /*
-+ * Walk through the configuration table entries and check them
-+ * slightly, while keeping track of the total length, and reading
-+ * more of the file if necessary.
-+ */
-+ dataSize = 0;
-+ while (!IS_LAST(entry))
-+ {
-+ if (getEntrySize(entry) > entry->next)
-+ fatalError("Bad offset to next value");
-+
-+ dataSize += entry->next;
-+
-+ entry = NEXT_ENTRY(entry);
-+ growSize = dataSize + entry->next - maxSize;
-+
-+ if (growSize <= 0)
-+ continue;
-+
-+ /*
-+ * Getting near the end of our array.
-+ * Grow it some more and read in the next bit of the table.
-+ * Be sure to reposition the structure pointer since the
-+ * table may have moved.
-+ */
-+ growSize += (BUF_SIZE - growSize % BUF_SIZE);
-+
-+ data = realloc(data, maxSize + growSize);
-+
-+ if (data == 0)
-+ fatalError("Cannot reallocate table");
-+
-+ entry = TO_ENTRY(data + maxSize);
-+
-+ cc = read(fd, data + maxSize, growSize);
-+
-+ if (cc < 0)
-+ systemError("read");
-+
-+ if (cc < growSize)
-+ memset(data + maxSize + cc, 0, growSize - cc);
-+
-+ maxSize += growSize;
-+ }
-+
-+ /*
-+ * Verify that the end of the table looks reasonable.
-+ */
-+ if (strcmp(entry->name, CONFIG_END_NAME) ||
-+ entry->value[0])
-+ fatalError("Bad end of table");
-+
-+ /*
-+ * Save the table information.
-+ */
-+ table->data = data;
-+ table->size = dataSize;
-+
-+ /*
-+ * Find and save the table name if it is present.
-+ * This can only be done when we are done reading the table since
-+ * the table name is a pointer into the table data buffer.
-+ */
-+ entry = TO_ENTRY(data);
-+ entry = NEXT_ENTRY(entry);
-+
-+ if (IS_ID(entry))
-+ table->name = entry->value;
-+ else
-+ table->name = "unknown";
-+}
-+
-+
-+/*
-+ * Open the specified module_name for reading or writing, and read in all
-+ * of the configuration tables found in the program so that they can
-+ * be examined or updated.
-+ */
-+static void
-+openProgram(const char * module_name, BOOL writeFlag)
-+{
-+ TABLE * table;
-+ int openMode;
-+
-+ /*
-+ * Open the file for reading or writing as specified.
-+ */
-+ openMode = (writeFlag ? O_RDWR : O_RDONLY);
-+
-+ fd = open(module_name, openMode);
-+
-+ if (fd < 0)
-+ systemError("open");
-+
-+ /*
-+ * Find all of the tables in the program.
-+ */
-+ findTables();
-+
-+ /*
-+ * Read in all of the tables.
-+ */
-+ for (table = tableList; table; table = table->nextTable)
-+ readTable(table);
-+}
-+
-+
-+
-+/*
-+ * Close the program if necessary.
-+ * Doesn't return on an error.
-+ */
-+static void
-+closeProgram(void)
-+{
-+ TABLE * table;
-+ TABLE * nexttable;
-+
-+ if ((fd >= 0) && (close(fd) < 0))
-+ systemError("close");
-+
-+ for (table = tableList; table; table = nexttable) {
-+ nexttable = table->nextTable;
-+ free(table);
-+ }
-+}
-+
-+
-+/*
-+ * Search the specified buffer for the first instance of the magic
-+ * CONFIG_NAME_MAGIC string. Returns the index into the buffer of
-+ * the string, or -1 if it was not found.
-+ */
-+static int
-+search(const char * buffer, int bufferSize)
-+{
-+ const char * data; /* current location in buffer */
-+ const char * oldData; /* previous location in buffer */
-+
-+ data = buffer;
-+ oldData = buffer;
-+ bufferSize -= NAME_SIZE;
-+
-+ while (bufferSize > 0)
-+ {
-+ data = memchr(oldData, CONFIG_NAME_MAGIC[0], bufferSize);
-+
-+ if (data == NULL)
-+ return -1;
-+
-+ /*
-+ * Poking at internal layouts of structures in pre-compiled
-+ * module binaries is hacky at best. Compensate for varied
-+ * layouts by 'strengthening' the match to require the followup
-+ * size field to be equal to the config_s_entry_t size and the
-+ * 'reserved' field to be 0.
-+ */
-+ if ((data[1] == CONFIG_NAME_MAGIC[1]) &&
-+ (memcmp(data, CONFIG_NAME_MAGIC, NAME_SIZE) == 0) &&
-+ *((int *)&data[NAME_SIZE]) == sizeof(config_s_entry_t) &&
-+ *((int *)&data[NAME_SIZE+sizeof(int)]) == 0)
-+ return (data - buffer);
-+
-+ bufferSize -= (data - oldData) + 1;
-+ oldData = data + 1;
-+ }
-+
-+ return -1;
-+}
-+
-+
-+/*
-+ * Complain about something being wrong and exit.
-+ */
-+static void
-+fatalError(const char * msg)
-+{
-+ fprintf(stderr, "%s: %s\n", module_name, msg);
-+
-+ exit(1);
-+}
-+
-+
-+/*
-+ * Complain about an operating system error and exit.
-+ */
-+static void
-+systemError(const char * msg)
-+{
-+ fprintf(stderr, "%s: ", module_name);
-+ perror(msg);
-+
-+ exit(1);
-+}
-+
-+/* END CODE */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/inioct.h ./drivers/scsi/qla2xxx/inioct.h
---- ./drivers/scsi/qla2xxx.qla2xxx/inioct.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/inioct.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver ioctl definition file
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * File Name: inioct.h
-@@ -94,10 +82,9 @@
- #define INT_CC_GET_OPTION_ROM_LAYOUT EXT_CC_RESERVED0I_OS
- #define INT_CC_GET_VPD EXT_CC_RESERVED0J_OS
- #define INT_CC_UPDATE_VPD EXT_CC_RESERVED0K_OS
-+#define INT_CC_GET_SFP_DATA EXT_CC_RESERVED0L_OS
- #define INT_CC_LEGACY_LOOPBACK EXT_CC_RESERVED0Z_OS
-
--
--
- /* NVRAM */
- #define INT_SC_NVRAM_HARDWARE 0 /* Save */
- #define INT_SC_NVRAM_DRIVER 1 /* Driver (Apply) */
-@@ -292,6 +279,11 @@ typedef struct _OPT_ROM_TABLE
- INT_OPT_ROM_REGION Region;
- } OPT_ROM_TABLE, *POPT_ROM_TABLE;
-
-+typedef struct _INT_SFP_INFO {
-+ UINT8 SFPDataA0[256];
-+ UINT8 SFPDataA2[256];
-+} INT_SFP_INFO, *PINT_SFP_INFO;
-+
- #ifdef _MSC_VER
- #pragma pack()
- #endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_32ioctl.c ./drivers/scsi/qla2xxx/qim_32ioctl.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_32ioctl.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_32ioctl.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,153 +0,0 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--
--#include <linux/config.h>
--
--#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
--
--#include <linux/file.h>
--
--#include "exioct.h"
--#include "qlfoln.h"
--#include "qla_dbg.h"
--
--
--/* fs/ioctl.c */
--extern asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, void *);
--
--extern int register_ioctl32_conversion(unsigned int cmd,
-- int (*handler)(unsigned int, unsigned int, unsigned long, struct file *));
--extern int unregister_ioctl32_conversion(unsigned int cmd);
--
--
--int
--qim2xxx_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg,
-- struct file *pfile)
--{
-- return (sys_ioctl(fd, cmd, (void *)arg));
--}
--
--static int
--apidev_reg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
--{
-- int err = 0;
-- int i;
-- unsigned int cmd;
--
-- for (i = low_idx; i <= high_idx; i++) {
-- cmd = (unsigned int)QL_IOCTL_CMD(i);
-- err = register_ioctl32_conversion(cmd, qim2xxx_ioctl32);
-- if (err) {
-- DEBUG9(printk(
-- "%s: error registering cmd %x. err=%d.\n",
-- __func__, cmd, err);)
-- break;
-- }
-- DEBUG9(printk("%s: registered cmd %x.\n", __func__, cmd);)
-- }
--
-- return (err);
--}
--
--static int
--apidev_unreg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
--{
-- int err = 0;
-- int i;
-- unsigned int cmd;
--
-- for (i = low_idx; i <= high_idx; i++) {
-- cmd = (unsigned int)QL_IOCTL_CMD(i);
-- err = unregister_ioctl32_conversion(cmd);
-- if (err) {
-- DEBUG9(printk(
-- "%s: error unregistering cmd %x. err=%d.\n",
-- __func__, cmd, err);)
-- break;
-- }
-- DEBUG9(printk("%s: unregistered cmd %x.\n", __func__, cmd);)
-- }
--
-- return (err);
--}
--
--void
--apidev_init_32ioctl_reg(void)
--{
-- int err;
--
-- DEBUG9(printk("%s: going to register ioctl32 cmds.\n", __func__);)
--
-- /* regular external ioctl codes */
-- err = apidev_reg_increasing_idx(EXT_DEF_LN_REG_CC_START_IDX,
-- EXT_DEF_LN_REG_CC_END_IDX);
-- if (!err) {
-- /* regular internal ioctl codes */
-- err = apidev_reg_increasing_idx(EXT_DEF_LN_INT_CC_START_IDX,
-- EXT_DEF_LN_INT_CC_END_IDX);
-- }
-- if (!err) {
-- /* additional codes */
-- err = apidev_reg_increasing_idx(EXT_DEF_LN_ADD_CC_START_IDX,
-- EXT_DEF_LN_ADD_CC_END_IDX);
-- }
-- if (!err) {
-- /* QL FO specific codes */
-- err = apidev_reg_increasing_idx(FO_CC_START_IDX, FO_CC_END_IDX);
-- }
-- if (!err) {
-- /* LN Drvr specific codes are defined in decreasing order */
-- err = apidev_reg_increasing_idx(EXT_DEF_LN_SPC_CC_END_IDX,
-- EXT_DEF_LN_SPC_CC_START_IDX);
-- }
--}
--
--void
--apidev_cleanup_32ioctl_unreg(void)
--{
-- int err;
--
-- DEBUG9(printk("%s: going to unregister ioctl32 cmds.\n", __func__);)
--
-- /* regular external ioctl codes */
-- err = apidev_unreg_increasing_idx(EXT_DEF_LN_REG_CC_START_IDX,
-- EXT_DEF_LN_REG_CC_END_IDX);
-- if (!err) {
-- /* regular internal ioctl codes */
-- err = apidev_unreg_increasing_idx(EXT_DEF_LN_INT_CC_START_IDX,
-- EXT_DEF_LN_INT_CC_END_IDX);
-- }
-- if (!err) {
-- /* additional codes */
-- err = apidev_unreg_increasing_idx(EXT_DEF_LN_ADD_CC_START_IDX,
-- EXT_DEF_LN_ADD_CC_END_IDX);
-- }
-- if (!err) {
-- /* QL FO specific codes */
-- err = apidev_unreg_increasing_idx(FO_CC_START_IDX,
-- FO_CC_END_IDX);
-- }
-- if (!err) {
-- /* LN Drvr specific codes are defined in decreasing order */
-- err = apidev_unreg_increasing_idx(EXT_DEF_LN_SPC_CC_END_IDX,
-- EXT_DEF_LN_SPC_CC_START_IDX);
-- }
--}
--
--#endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_32ioctl.h ./drivers/scsi/qla2xxx/qim_32ioctl.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_32ioctl.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_32ioctl.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,25 +0,0 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--#ifndef _QIM_32IOCTL_H_
--#define _QIM_32IOCTL_H_
--
--extern void apidev_init_32ioctl_reg(void);
--extern void apidev_cleanup_32ioctl_unreg(void);
--
--#endif /* _QIM_32IOCTL_H_ */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_def.h ./drivers/scsi/qla2xxx/qim_def.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_def.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_def.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,138 +0,0 @@
--#ifndef __QIM_DEF_H__
--#define __QIM_DEF_H__
--
--#define CONFIG_SCSI_QLA21XX 1
--#define CONFIG_SCSI_QLA22XX 1
--#define CONFIG_SCSI_QLA24XX 1
--#define CONFIG_SCSI_QLA25XX 1
--#define CONFIG_SCSI_QLA2300 1
--#define CONFIG_SCSI_QLA2322 1
--#define CONFIG_SCSI_QLA6312 1
--
--#include "qla_def.h"
--
--extern struct list_head **qim_hostlist_ptr;
--extern rwlock_t **qim_hostlist_lock_ptr;
--extern rwlock_t qim_haioctl_list_lock;
--extern struct list_head qim_haioctl_list;
--
--#ifndef WWN_SIZE
--#define WWN_SIZE 8 /* Size of WWPN, & WWNN */
--#endif
--
--#ifndef MAX_STR_SIZE
--#define MAX_STR_SIZE 80
--#endif
--
--#ifndef MAX_FIBRE_DEVICES
--#define MAX_FIBRE_DEVICES 512
--#endif
--
--#ifndef MAX_FIBRE_LUNS
--#define MAX_FIBRE_LUNS 256
--#endif
--
--#ifndef MAX_RSCN_COUNT
--#define MAX_RSCN_COUNT 32
--#endif
--
--#ifndef MAX_HOST_COUNT
--#define MAX_HOST_COUNT 16
--#endif
--
--#ifndef FALSE
--#define FALSE 0
--#endif
--
--#ifndef TRUE
--#define TRUE 1
--#endif
--
--#define QIM_SUCCESS 0
--#define QIM_FAILED 1
--
--// Inbound or Outbound tranfer of data
--#define QLA2X00_UNKNOWN 0
--#define QLA2X00_READ 1
--#define QLA2X00_WRITE 2
--
--
--struct hba_ioctl {
-- /* Ioctl cmd serialization */
-- struct semaphore access_sem;
--
-- /* Passthru cmd/completion */
-- struct semaphore cmpl_sem;
-- struct timer_list cmpl_timer;
-- uint8_t ioctl_tov;
-- uint8_t SCSIPT_InProgress;
-- uint8_t MSIOCB_InProgress;
--
-- os_tgt_t *ioctl_tq;
-- os_lun_t *ioctl_lq;
--
--#if 0
--/* RLU: this need to be handled later */
-- /* AEN queue */
-- void *aen_tracking_queue;/* points to async events buffer */
-- uint8_t aen_q_head; /* index to the current head of q */
-- uint8_t aen_q_tail; /* index to the current tail of q */
--#endif
--
-- /* Misc. */
-- uint32_t flags;
--#define IOCTL_OPEN BIT_0
--#define IOCTL_AEN_TRACKING_ENABLE BIT_1
-- uint8_t *scrap_mem; /* per ha scrap buf for ioctl usage */
-- uint32_t scrap_mem_size; /* total size */
-- uint32_t scrap_mem_used; /* portion used */
--};
--
--struct qla_host_ioctl {
-- struct list_head list;
--
-- unsigned long host_no;
-- unsigned long instance;
-- uint8_t node_name[WWN_SIZE];
-- uint8_t port_name[WWN_SIZE];
--
-- uint8_t drv_ver_str[MAX_STR_SIZE];
-- uint8_t drv_major;
-- uint8_t drv_minor;
-- uint8_t drv_patch;
-- uint8_t drv_beta;
--
-- struct scsi_qla_host *dr_data;
--
-- struct hba_ioctl *ioctl;
--
-- void *ioctl_mem;
-- dma_addr_t ioctl_mem_phys;
-- uint32_t ioctl_mem_size;
--
-- struct scsi_cmnd *ioctl_err_cmd;
--
-- /* PCI expansion ROM image information. */
-- unsigned long code_types;
--#define ROM_CODE_TYPE_BIOS 0
--#define ROM_CODE_TYPE_FCODE 1
--#define ROM_CODE_TYPE_EFI 3
--
-- uint8_t bios_revision[2];
-- uint8_t efi_revision[2];
-- uint8_t fcode_revision[16];
-- uint32_t fw_revision[4];
--
-- /* Needed for BEACON */
-- uint8_t beacon_blink_led;
-- uint8_t beacon_color_state;
--#define QLA_LED_GRN_ON 0x01
--#define QLA_LED_YLW_ON 0x02
--#define QLA_LED_ABR_ON 0x04
--#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber */
--#define QLA_LED_RGA_ON 0x07 /* isp2322: red, green, amber */
--
--};
--
--#endif /* ifndef __QIM_DEF_H__ */
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_fo.c ./drivers/scsi/qla2xxx/qim_fo.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_fo.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_fo.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,1033 +0,0 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ioctl module for ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--
--
--#include "qim_ioctl.h"
--#include "qlfo.h"
--#include "qlfolimits.h"
--
--#define LUN_DATA_ENABLED BIT_7
--#define LUN_DATA_PREFERRED_PATH BIT_6
--
--
--/*
-- * Global variables
-- */
--SysFoParams_t qla_fo_params;
--
--
--/*
-- * qim_fo_init_params
-- * Gets driver configuration file failover properties to initalize
-- * the global failover parameters structure.
-- *
-- * Input:
-- * ha = adapter block pointer.
-- *
-- * Context:
-- * Kernel context.
-- */
--void
--qim_fo_init_params(void)
--{
-- DEBUG3(printk("%s: entered.\n", __func__);)
--
-- /* Return some hard-coded values for a non-failover driver. */
--
-- memset(&qla_fo_params, 0, sizeof(qla_fo_params));
--
-- qla_fo_params.MaxPathsPerDevice = 1 ;
-- qla_fo_params.MaxRetriesPerPath = FO_MAX_RETRIES_PER_PATH_DEF;
-- qla_fo_params.MaxRetriesPerIo = FO_MAX_RETRIES_PER_IO_DEF;
--
-- qla_fo_params.Flags = 0;
-- qla_fo_params.FailoverNotifyType = FO_NOTIFY_TYPE_NONE;
--
-- DEBUG3(printk("%s: exiting.\n", __func__);)
--}
--
--/*
-- * qim_fo_get_params
-- * Process an ioctl request to get system wide failover parameters.
-- *
-- * Input:
-- * pp = Pointer to FO_PARAMS structure.
-- *
-- * Returns:
-- * EXT_STATUS code.
-- *
-- * Context:
-- * Kernel context.
-- */
--static uint32_t
--qim_fo_get_params(PFO_PARAMS pp)
--{
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- pp->MaxPathsPerDevice = qla_fo_params.MaxPathsPerDevice;
-- pp->MaxRetriesPerPath = qla_fo_params.MaxRetriesPerPath;
-- pp->MaxRetriesPerIo = qla_fo_params.MaxRetriesPerIo;
-- pp->Flags = qla_fo_params.Flags;
-- pp->FailoverNotifyType = qla_fo_params.FailoverNotifyType;
-- pp->FailoverNotifyCdbLength = qla_fo_params.FailoverNotifyCdbLength;
-- memset(pp->FailoverNotifyCdb, 0, sizeof(pp->FailoverNotifyCdb));
-- memcpy(pp->FailoverNotifyCdb,
-- &qla_fo_params.FailoverNotifyCdb[0], sizeof(pp->FailoverNotifyCdb));
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return EXT_STATUS_OK;
--}
--
--/*
-- * qim_fo_set_params
-- * Process an ioctl request to set system wide failover parameters.
-- *
-- * Input:
-- * pp = Pointer to FO_PARAMS structure.
-- *
-- * Returns:
-- * EXT_STATUS code.
-- *
-- * Context:
-- * Kernel context.
-- */
--static uint32_t
--qim_fo_set_params(PFO_PARAMS pp)
--{
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- /* Check values for defined MIN and MAX */
-- if ((pp->MaxPathsPerDevice > SDM_DEF_MAX_PATHS_PER_DEVICE) ||
-- (pp->MaxRetriesPerPath < FO_MAX_RETRIES_PER_PATH_MIN) ||
-- (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_PATH_MAX) ||
-- (pp->MaxRetriesPerIo < FO_MAX_RETRIES_PER_IO_MIN) ||
-- (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_IO_MAX)) {
-- DEBUG2_9_10(printk("%s: got invalid params.\n", __func__);)
-- return EXT_STATUS_INVALID_PARAM;
-- }
--
-- /* Update the global structure. */
-- qla_fo_params.MaxPathsPerDevice = pp->MaxPathsPerDevice;
-- qla_fo_params.MaxRetriesPerPath = pp->MaxRetriesPerPath;
-- qla_fo_params.MaxRetriesPerIo = pp->MaxRetriesPerIo;
-- qla_fo_params.Flags = pp->Flags;
-- qla_fo_params.FailoverNotifyType = pp->FailoverNotifyType;
-- qla_fo_params.FailoverNotifyCdbLength = pp->FailoverNotifyCdbLength;
-- if (pp->FailoverNotifyType & FO_NOTIFY_TYPE_CDB) {
-- if (pp->FailoverNotifyCdbLength >
-- sizeof(qla_fo_params.FailoverNotifyCdb)) {
-- DEBUG2_9_10(printk("%s: got invalid cdb length.\n",
-- __func__);)
-- return EXT_STATUS_INVALID_PARAM;
-- }
--
-- memcpy(qla_fo_params.FailoverNotifyCdb,
-- pp->FailoverNotifyCdb,
-- sizeof(qla_fo_params.FailoverNotifyCdb));
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return EXT_STATUS_OK;
--}
--
--/*
-- * qim_get_hba
-- * Searches the hba structure chain for the requested instance
-- * aquires the mutex and returns a pointer to the hba structure.
-- *
-- * Input:
-- * inst = adapter instance number.
-- *
-- * Returns:
-- * Return value is a pointer to the adapter structure or
-- * NULL if instance not found.
-- *
-- * Context:
-- * Kernel context.
-- */
--scsi_qla_host_t *
--qim_get_hba(unsigned long instance)
--{
-- int found;
-- scsi_qla_host_t *ha;
--
-- ha = NULL;
-- found = 0;
-- read_lock(*qim_hostlist_lock_ptr);
-- list_for_each_entry(ha, *qim_hostlist_ptr, list) {
-- if (ha->instance == instance) {
-- found++;
-- break;
-- }
-- }
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- return (found ? ha : NULL);
--}
--
--/*
-- * qim_cfg_get_paths
-- * Get list of paths EXT_FO_GET_PATHS.
-- *
-- * Input:
-- * ha = pointer to adapter
-- * bp = pointer to buffer
-- * cmd = Pointer to kernel copy of EXT_IOCTL.
-- *
-- * Return;
-- * 0 on success or errno.
-- * driver ioctl errors are returned via cmd->Status.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_cfg_get_paths(EXT_IOCTL *cmd, FO_GET_PATHS *bp, int mode)
--{
--#define STD_MAX_PATH_CNT 1
--#define STD_VISIBLE_INDEX 0
--
-- int rval = 0;
--
-- FO_PATHS_INFO *paths, *u_paths;
-- FO_PATH_ENTRY *entry;
-- EXT_DEST_ADDR *sap = &bp->HbaAddr;
-- scsi_qla_host_t *ha = NULL;
-- int found;
-- fc_port_t *fcport = NULL;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- u_paths = (FO_PATHS_INFO *)Q64BIT_TO_PTR(cmd->ResponseAdr,
-- cmd->AddrMode);
-- ha = qim_get_hba((int)bp->HbaInstance);
--
-- if (!ha) {
-- DEBUG2_9_10(printk(KERN_INFO "%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (rval);
-- }
-- DEBUG9(printk("%s(%ld): found matching ha inst %d.\n",
-- __func__, ha->host_no, bp->HbaInstance);)
--
-- if (sap->DestType != EXT_DEF_DESTTYPE_WWNN &&
-- sap->DestType != EXT_DEF_DESTTYPE_WWPN) {
-- /* Scan for mp_dev by nodename or portname *ONLY* */
--
-- cmd->Status = EXT_STATUS_INVALID_PARAM;
-- cmd->DetailStatus = EXT_DSTATUS_TARGET;
-- return (rval);
-- }
--
-- paths = kmalloc(sizeof(FO_PATHS_INFO), GFP_KERNEL);
-- if (paths == NULL) {
-- DEBUG4(printk("%s: failed to allocate memory of size (%d)\n",
-- __func__, (int)sizeof(FO_PATHS_INFO));)
-- DEBUG9_10(printk("%s: failed allocate memory size(%d).\n",
-- __func__, (int)sizeof(FO_PATHS_INFO));)
--
-- cmd->Status = EXT_STATUS_NO_MEMORY;
--
-- return -ENOMEM;
-- }
-- DEBUG9(printk("%s(%ld): found matching ha inst %d.\n",
-- __func__, ha->host_no, bp->HbaInstance);)
--
-- memset(paths, 0, sizeof(FO_PATHS_INFO));
--
-- /* non-fo case. There's only one path. */
--
-- DEBUG9(printk("%s: non-fo case.\n", __func__);)
--
-- found = 0;
-- if (sap->DestType != EXT_DEF_DESTTYPE_WWNN) {
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (memcmp(fcport->node_name, sap->DestAddr.WWNN,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- found++;
-- break;
-- }
-- }
-- } else if (sap->DestType != EXT_DEF_DESTTYPE_WWPN) {
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (memcmp(fcport->port_name, sap->DestAddr.WWPN,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- found++;
-- break;
-- }
-- }
-- }
--
-- if (found) {
-- DEBUG9(printk("%s: found fcport:"
-- "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-- __func__,
-- sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-- sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-- sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-- sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7]);)
--
-- paths->HbaInstance = bp->HbaInstance;
-- paths->PathCount = STD_MAX_PATH_CNT;
-- paths->VisiblePathIndex = STD_VISIBLE_INDEX;
--
-- /* set current path value, which is the first one (0) for all
-- * LUNs.
-- */
-- memset(paths->CurrentPathIndex, 0,
-- sizeof(paths->CurrentPathIndex));
--
-- entry = &(paths->PathEntry[STD_VISIBLE_INDEX]);
--
-- entry->Visible = 1;
-- entry->HbaInstance = bp->HbaInstance;
--
-- memcpy(entry->PortName, fcport->port_name,
-- EXT_DEF_WWP_NAME_SIZE);
--
-- /* Copy data to user */
-- if (rval == 0)
-- rval = copy_to_user(&u_paths->PathCount,
-- &paths->PathCount, 4);
-- if (rval == 0)
-- rval = copy_to_user(&u_paths->CurrentPathIndex,
-- &paths->CurrentPathIndex,
-- sizeof(paths->CurrentPathIndex));
-- if (rval == 0)
-- rval = copy_to_user(&u_paths->PathEntry,
-- &paths->PathEntry,
-- sizeof(paths->PathEntry));
--
-- if (rval) { /* if any of the above failed */
-- DEBUG9_10(printk("%s: data copy failed.\n",
-- __func__);)
--
-- cmd->Status = EXT_STATUS_COPY_ERR;
-- }
-- } else {
-- cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-- cmd->DetailStatus = EXT_DSTATUS_TARGET;
--
-- DEBUG10(printk("%s: cannot find fcport "
-- "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-- __func__,
-- sap->DestAddr.WWNN[0],
-- sap->DestAddr.WWNN[1],
-- sap->DestAddr.WWNN[2],
-- sap->DestAddr.WWNN[3],
-- sap->DestAddr.WWNN[4],
-- sap->DestAddr.WWNN[5],
-- sap->DestAddr.WWNN[6],
-- sap->DestAddr.WWNN[7]);)
-- DEBUG4(printk("%s: cannot find fcport "
-- "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-- __func__,
-- sap->DestAddr.WWNN[0],
-- sap->DestAddr.WWNN[1],
-- sap->DestAddr.WWNN[2],
-- sap->DestAddr.WWNN[3],
-- sap->DestAddr.WWNN[4],
-- sap->DestAddr.WWNN[5],
-- sap->DestAddr.WWNN[6],
-- sap->DestAddr.WWNN[7]);)
-- }
--
-- kfree(paths);
--
-- DEBUG9(printk("%s: exiting. rval=%d.\n", __func__, rval);)
--
-- return rval;
--
--} /* qim_cfg_get_paths */
--
--/*
-- * qim_cfg_set_current_path
-- * Set the current failover path EXT_FO_GET_PATHS IOCTL call.
-- *
-- * Input:
-- * ha = pointer to adapter
-- * bp = pointer to buffer
-- * cmd = Pointer to kernel copy of EXT_IOCTL.
-- *
-- * Return;
-- * 0 on success or errno.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_cfg_set_current_path(EXT_IOCTL *cmd, FO_SET_CURRENT_PATH *bp, int mode )
--{
-- uint32_t rval = 0;
-- scsi_qla_host_t *ha;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- /* First find the adapter with the instance number. */
-- ha = qim_get_hba((int)bp->HbaInstance);
-- if (!ha) {
-- DEBUG2_9_10(printk(KERN_INFO "%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (rval);
-- }
--
-- /* non-failover mode. nothing to be done. */
-- DEBUG9_10(printk("%s(%ld): Assumed non-failover driver mode.\n",
-- __func__, ha->host_no);)
--
-- DEBUG9(printk("%s: exiting. rval = %d.\n", __func__, rval);)
--
-- return rval;
--}
--
--/*
-- * qim_fo_get_lun_data
-- * Get lun data from all devices attached to a HBA (FO_GET_LUN_DATA).
-- * Gets lun mask if failover not enabled.
-- *
-- * Input:
-- * ha = pointer to adapter
-- * bp = pointer to buffer
-- *
-- * Return;
-- * 0 on success or errno.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_fo_get_lun_data(EXT_IOCTL *pext, FO_LUN_DATA_INPUT *bp, int mode)
--{
-- scsi_qla_host_t *ha;
-- struct list_head *fcports;
-- fc_port_t *fcport;
-- int ret = 0;
-- os_tgt_t *ostgt;
-- uint16_t cnt;
-- uint16_t lun;
-- FO_EXTERNAL_LUN_DATA_ENTRY *u_entry, *entry;
-- FO_LUN_DATA_LIST *u_list, *list;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- ha = qim_get_hba((unsigned long)bp->HbaInstance);
--
-- if (!ha) {
-- DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-- __func__, ha->instance, bp);)
-- DEBUG4(printk("%s: hba %p, buff %p bp->HbaInstance(%x).\n",
-- __func__, ha, bp, (int)bp->HbaInstance));
--
-- list = kmalloc(sizeof(FO_LUN_DATA_LIST), GFP_KERNEL);
-- if (list == NULL) {
-- DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-- __func__, (int)sizeof(FO_LUN_DATA_LIST));)
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (-ENOMEM);
-- }
-- memset(list, 0, sizeof(FO_LUN_DATA_LIST));
--
-- entry = &list->DataEntry[0];
--
-- u_list = (FO_LUN_DATA_LIST *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
-- u_entry = &u_list->DataEntry[0];
--
-- /* assumed non-failover; get the fcport list */
-- fcports = &ha->fcports;
--
-- /* Check thru this adapter's fcport list */
-- fcport = NULL;
-- list_for_each_entry(fcport, fcports, list) {
-- if (fcport->port_type != FCT_TARGET)
-- continue;
--#if 0
-- if ((atomic_read(&fcport->state) != FCS_ONLINE) &&
-- !qla2x00_is_fcport_in_config(ha, fcport)) {
-- /* no need to report */
-- DEBUG2_9_10(printk("%s(%ld): not reporting fcport "
-- "%02x%02x%02x%02x%02x%02x%02x%02x. state=%i,"
-- " flags=%02x.\n",
-- __func__, ha->host_no, fcport->port_name[0],
-- fcport->port_name[1], fcport->port_name[2],
-- fcport->port_name[3], fcport->port_name[4],
-- fcport->port_name[5], fcport->port_name[6],
-- fcport->port_name[7], atomic_read(&fcport->state),
-- fcport->flags);)
-- continue;
-- }
--#endif
--
-- memcpy(entry->PortName,
-- fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
--
-- /*
-- * Failover disabled. Just return LUN mask info
-- * in lun data entry of this port.
-- */
-- memcpy(entry->NodeName,
-- fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-- entry->TargetId = 0;
-- for (cnt = 0; cnt < MAX_FIBRE_DEVICES; cnt++) {
-- if (!(ostgt = ha->otgt[cnt])) {
-- continue;
-- }
--
-- if (ostgt->fcport == fcport) {
-- entry->TargetId = cnt;
-- break;
-- }
-- }
-- if (cnt == MAX_FIBRE_DEVICES) {
-- /* Not found? For now just go to next port. */
--#if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_10)
-- uint8_t *tmp_name;
--
-- tmp_name = fcport->port_name;
--
-- printk("%s(%ld): ERROR - port "
-- "%02x%02x%02x%02x%02x%02x%02x%02x "
-- "not configured.\n",
-- __func__, ha->host_no,
-- tmp_name[0], tmp_name[1], tmp_name[2],
-- tmp_name[3], tmp_name[4], tmp_name[5],
-- tmp_name[6], tmp_name[7]);
--#endif /* DEBUG */
--
-- continue;
-- }
--
-- /* Got a valid port */
-- list->EntryCount++;
--
-- entry->LunCount = MAX_LUNS;
-- for (lun = 0; lun < MAX_LUNS; lun++) {
-- /* set MSB if masked */
-- entry->Data[lun] = LUN_DATA_PREFERRED_PATH;
-- if (!EXT_IS_LUN_BIT_SET(&(fcport->lun_mask),
-- lun)) {
-- entry->Data[lun] |= LUN_DATA_ENABLED;
-- }
-- }
--
-- DEBUG9(printk("%s: got lun_mask for tgt %d\n",
-- __func__, cnt);)
-- DEBUG9(qla2x00_dump_buffer((char *)&(fcport->lun_mask),
-- sizeof(lun_bit_mask_t));)
--
-- ret = copy_to_user(u_entry, entry,
-- sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
--
-- if (ret) {
-- /* error */
-- DEBUG9_10(printk("%s: u_entry %p copy "
-- "error. list->EntryCount=%d.\n",
-- __func__, u_entry, list->EntryCount);)
-- pext->Status = EXT_STATUS_COPY_ERR;
-- break;
-- }
--
-- /* Go to next port */
-- u_entry++;
-- continue;
-- }
--
-- DEBUG9(printk("%s: get_lun_data - entry count = [%d]\n",
-- __func__, list->EntryCount);)
-- DEBUG4(printk("%s: get_lun_data - entry count = [%d]\n",
-- __func__, list->EntryCount);)
--
-- if (ret == 0) {
-- /* copy number of entries */
-- ret = copy_to_user(&u_list->EntryCount, &list->EntryCount,
-- sizeof(list->EntryCount));
-- pext->ResponseLen = FO_LUN_DATA_LIST_MAX_SIZE;
-- }
--
-- kfree(list);
-- DEBUG9(printk("%s: exiting. ret=%d.\n", __func__, ret);)
-- return ret;
--}
--
--/*
-- * qim_fo_set_lun_data
-- * Set lun data for the specified device on the attached hba
-- * (FO_SET_LUN_DATA).
-- * Sets lun mask if failover not enabled.
-- *
-- * Input:
-- * bp = pointer to buffer
-- *
-- * Return;
-- * 0 on success or errno.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_fo_set_lun_data(EXT_IOCTL *pext, FO_LUN_DATA_INPUT *bp, int mode)
--{
-- scsi_qla_host_t *ha;
-- int ret = 0;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- ha = qim_get_hba((unsigned long)bp->HbaInstance);
--
-- if (!ha) {
-- DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-- __func__, ha->instance, bp);)
--
-- /* Assuming no persistent configuration is supported by driver. */
--
-- DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret);)
--
-- return ret;
--}
--
--static int
--qim_std_get_tgt(scsi_qla_host_t *ha, EXT_IOCTL *pext, FO_DEVICE_DATA *entry)
--{
-- int ret = 0;
-- uint16_t i, tgt;
-- uint32_t b;
-- fc_port_t *fcport;
-- os_tgt_t *ostgt;
-- FO_DEVICE_DATA *u_entry;
--
-- DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- u_entry = (FO_DEVICE_DATA *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
--
-- if (pext->ResponseLen < sizeof(FO_DEVICE_DATA)) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s: ERROR ResponseLen %d too small.\n",
-- __func__, pext->ResponseLen);)
--
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): user buffer size=%d. Copying fcport list\n",
-- __func__, ha->host_no, pext->ResponseLen);)
--
-- /* Loop through and return ports found. */
-- /* Check thru this adapter's fcport list */
-- i = 0;
-- fcport = NULL;
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (fcport->port_type != FCT_TARGET)
-- continue;
--
-- if (i >= MAX_TARGETS)
-- break;
--
-- /* clear for a new entry */
-- memset(entry, 0, sizeof(FO_DEVICE_DATA));
--
-- memcpy(entry->WorldWideName,
-- fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-- memcpy(entry->PortName,
-- fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
--
-- for (b = 0; b < 3 ; b++)
-- entry->PortId[b] = fcport->d_id.r.d_id[2-b];
--
-- DEBUG9(printk("%s(%ld): found fcport %p:%02x%02x%02x%02x"
-- "%02x%02x%02x%02x.\n",
-- __func__, ha->host_no,
-- fcport,
-- fcport->port_name[0],
-- fcport->port_name[1],
-- fcport->port_name[2],
-- fcport->port_name[3],
-- fcport->port_name[4],
-- fcport->port_name[5],
-- fcport->port_name[6],
-- fcport->port_name[7]);)
--
-- /*
-- * Just find the port and return target info.
-- */
-- for (tgt = 0; tgt < MAX_FIBRE_DEVICES; tgt++) {
-- if (!(ostgt = ha->otgt[tgt])) {
-- continue;
-- }
--
-- if (ostgt->fcport == fcport) {
-- DEBUG9(printk("%s(%ld): Found target %d.\n",
-- __func__, ha->host_no, tgt);)
--
-- entry->TargetId = tgt;
-- break;
-- }
-- }
--
-- entry->MultipathControl = 0; /* always configured */
--
-- ret = copy_to_user(u_entry, entry, sizeof(FO_DEVICE_DATA));
-- if (ret) {
-- /* error */
-- DEBUG2_9_10(printk("%s(%ld): u_entry %p copy "
-- "out err. tgt id = %d, port id=%02x%02x%02x.\n",
-- __func__, ha->host_no, u_entry, tgt,
-- fcport->d_id.r.d_id[2],
-- fcport->d_id.r.d_id[1],
-- fcport->d_id.r.d_id[0]);)
-- pext->Status = EXT_STATUS_COPY_ERR;
-- break;
-- }
--
-- u_entry++;
-- }
--
-- DEBUG9(printk("%s(%ld): done copying fcport list entries.\n",
-- __func__, ha->host_no);)
--
--
-- DEBUG9(printk("%s(%ld): exiting. ret = %d.\n",
-- __func__, ha->host_no, ret);)
--
-- return (ret);
--}
--
--/*
-- * qim_fo_get_target_data
-- * Get the target control byte for all devices attached to a HBA.
-- *
-- * Input:
-- * bp = pointer to buffer
-- *
-- * Return;
-- * 0 on success or errno.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_fo_get_target_data(EXT_IOCTL *pext, FO_TARGET_DATA_INPUT *bp, int mode)
--{
-- scsi_qla_host_t *ha;
-- int ret = 0;
-- FO_DEVICE_DATA *entry;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- ha = qim_get_hba((unsigned long)bp->HbaInstance);
--
-- if (!ha) {
-- DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-- __func__, ha->instance, bp);)
--
-- if ((entry = (FO_DEVICE_DATA *)kmalloc(sizeof(FO_DEVICE_DATA),
-- GFP_KERNEL)) == NULL) {
-- DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-- __func__, (int)sizeof(FO_DEVICE_DATA));)
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (-ENOMEM);
-- }
--
-- /* Return data assuming non-failover driver. */
-- ret = qim_std_get_tgt(ha, pext, entry);
--
--
-- if (ret == 0) {
-- pext->ResponseLen = sizeof(FO_DEVICE_DATABASE);
-- }
--
-- kfree(entry);
--
-- DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret);)
--
-- return (ret);
--}
--
--/*
-- * qim_fo_set_target_data
-- * Set multipath control byte for all devices on the attached hba
-- *
-- * Input:
-- * bp = pointer to buffer
-- *
-- * Return;
-- * 0 on success or errno.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_fo_set_target_data(EXT_IOCTL *pext, FO_TARGET_DATA_INPUT *bp, int mode)
--{
-- scsi_qla_host_t *ha;
-- int ret = 0;
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- ha = qim_get_hba((unsigned long)bp->HbaInstance);
--
-- if (!ha) {
-- DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-- __func__, bp->HbaInstance);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-- __func__, ha->instance, bp);)
--
-- /* Assume no persistent config is supported. nothing to be done. */
--
-- DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret);)
--
-- return (ret);
--
--}
--
--/*
-- * qim_fo_ioctl
-- * Provides functions for failover ioctl() calls.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * ioctl_code = ioctl function to perform
-- * arg = Address of application EXT_IOCTL cmd data
-- * mode = flags
-- *
-- * Returns:
-- * Return value is the ioctl rval_p return value.
-- * 0 = success
-- *
-- * Context:
-- * Kernel context.
-- */
--/* ARGSUSED */
--int
--qim_fo_ioctl(struct qla_host_ioctl *ha, int ioctl_code, EXT_IOCTL *pext,
-- int mode)
--{
-- int rval = 0;
-- size_t in_size, out_size;
-- union _buff {
-- FO_PARAMS params;
-- FO_GET_PATHS path;
-- FO_SET_CURRENT_PATH set_path;
-- FO_HBA_STAT_INPUT stat;
-- FO_LUN_DATA_INPUT lun_data;
-- FO_TARGET_DATA_INPUT target_data;
-- } buff;
--
-- ENTER("qim_fo_ioctl");
-- DEBUG9(printk("%s: entered. arg (%p):\n", __func__, pext);)
--
-- /*
-- * default case for this switch not needed,
-- * ioctl_code validated by caller.
-- */
-- in_size = out_size = 0;
-- switch (ioctl_code) {
-- case FO_CC_GET_PARAMS:
-- out_size = sizeof(FO_PARAMS);
-- break;
-- case FO_CC_SET_PARAMS:
-- in_size = sizeof(FO_PARAMS);
-- break;
-- case FO_CC_GET_PATHS:
-- in_size = sizeof(FO_GET_PATHS);
-- break;
-- case FO_CC_SET_CURRENT_PATH:
-- in_size = sizeof(FO_SET_CURRENT_PATH);
-- break;
-- /*
-- case FO_CC_GET_HBA_STAT:
-- case FO_CC_RESET_HBA_STAT:
-- in_size = sizeof(FO_HBA_STAT_INPUT);
-- break;
-- */
-- case FO_CC_GET_LUN_DATA:
-- in_size = sizeof(FO_LUN_DATA_INPUT);
-- break;
-- case FO_CC_SET_LUN_DATA:
-- in_size = sizeof(FO_LUN_DATA_INPUT);
-- break;
-- case FO_CC_GET_TARGET_DATA:
-- in_size = sizeof(FO_TARGET_DATA_INPUT);
-- break;
-- case FO_CC_SET_TARGET_DATA:
-- in_size = sizeof(FO_TARGET_DATA_INPUT);
-- break;
--
-- }
-- if (in_size != 0) {
-- if ((int)pext->RequestLen < in_size) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- pext->DetailStatus = EXT_DSTATUS_REQUEST_LEN;
-- DEBUG10(printk("%s: got invalie req len (%d).\n",
-- __func__, pext->RequestLen);)
--
-- } else {
-- rval = copy_from_user(&buff,
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode),
-- in_size);
-- if (rval) {
-- DEBUG2_9_10(printk("%s: req buf copy error. "
-- "size=%ld.\n",
-- __func__, (ulong)in_size);)
--
-- pext->Status = EXT_STATUS_COPY_ERR;
-- } else {
-- DEBUG9(printk("qim_fo_ioctl: req buf "
-- "copied ok.\n"));
-- }
-- }
-- } else if (out_size != 0 && (ulong)pext->ResponseLen < out_size) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- pext->DetailStatus = out_size;
-- DEBUG10(printk("%s: got invalie resp len (%d).\n",
-- __func__, pext->ResponseLen);)
-- }
--
-- if (rval != 0 || pext->Status != 0)
-- goto done_fo_ioctl;
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- switch (ioctl_code) {
-- case FO_CC_GET_PARAMS:
-- rval = qim_fo_get_params(&buff.params);
-- break;
-- case FO_CC_SET_PARAMS:
-- rval = qim_fo_set_params(&buff.params);
-- break;
-- case FO_CC_GET_PATHS:
-- rval = qim_cfg_get_paths(pext, &buff.path,mode);
-- if (rval != 0)
-- out_size = 0;
-- break;
-- case FO_CC_SET_CURRENT_PATH:
-- rval = qim_cfg_set_current_path(pext,
-- &buff.set_path,mode);
-- break;
-- /*
-- case FO_CC_RESET_HBA_STAT:
-- rval = qim_fo_stats(&buff.stat, 1);
-- break;
-- case FO_CC_GET_HBA_STAT:
-- rval = qim_fo_stats(&buff.stat, 0);
-- break;
-- */
-- case FO_CC_GET_LUN_DATA:
--
-- DEBUG4(printk("calling qim_fo_get_lun_data\n");)
-- DEBUG4(printk("pext->RequestAdr (%p):\n",
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode));)
--
-- rval = qim_fo_get_lun_data(pext,
-- &buff.lun_data, mode);
--
-- if (rval != 0)
-- out_size = 0;
-- break;
-- case FO_CC_SET_LUN_DATA:
--
-- DEBUG4(printk("calling qim_fo_set_lun_data\n");)
-- DEBUG4(printk(" pext->RequestAdr (%p):\n",
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode));)
--
-- rval = qim_fo_set_lun_data(pext,
-- &buff.lun_data, mode);
-- break;
-- case FO_CC_GET_TARGET_DATA:
-- DEBUG4(printk("calling qim_fo_get_target_data\n");)
-- DEBUG4(printk("pext->RequestAdr (%p):\n",
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode));)
--
-- rval = qim_fo_get_target_data(pext,
-- &buff.target_data, mode);
--
-- if (rval != 0) {
-- out_size = 0;
-- }
-- break;
-- case FO_CC_SET_TARGET_DATA:
-- DEBUG4(printk("calling qim_fo_set_target_data\n");)
-- DEBUG4(printk(" pext->RequestAdr (%p):\n",
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode));)
-- rval = qim_fo_set_target_data(pext,
-- &buff.target_data, mode);
-- break;
--
-- }
--
-- if (rval == 0) {
-- rval = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), &buff, out_size);
-- if (rval != 0) {
-- DEBUG10(printk("%s: resp buf copy error. size=%ld.\n",
-- __func__, (ulong)out_size);)
-- pext->Status = EXT_STATUS_COPY_ERR;
-- }
-- }
--
--done_fo_ioctl:
--
-- if (rval != 0) {
-- /*EMPTY*/
-- DEBUG10(printk("%s: **** FAILED ****\n", __func__);)
-- } else {
-- /*EMPTY*/
-- DEBUG9(printk("%s: exiting normally\n", __func__);)
-- }
--
-- return rval;
--}
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_inioct.c ./drivers/scsi/qla2xxx/qim_inioct.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_inioct.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_inioct.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,1062 +0,0 @@
--#include "qim_ioctl.h"
--
--
--/* Option ROM definitions. */
--INT_OPT_ROM_REGION OptionRomTable2312[] =
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_PHBIOS_FCODE_EFI_CFW, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--INT_OPT_ROM_REGION OptionRomTable6312[] = // 128k x20000
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_PHBIOS_CFW, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--INT_OPT_ROM_REGION OptionRomTableHp[] = // 128k x20000
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_PHEFI_PHECFW_PHVPD, INT_OPT_ROM_SIZE_2312,
-- 0, INT_OPT_ROM_SIZE_2312-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--INT_OPT_ROM_REGION OptionRomTable2322[] = // 1 M x100000
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2322,
-- 0, INT_OPT_ROM_SIZE_2322-1},
-- {INT_OPT_ROM_REGION_PHBIOS_PHFCODE_PHEFI_FW, INT_OPT_ROM_SIZE_2322,
-- 0, INT_OPT_ROM_SIZE_2322-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--INT_OPT_ROM_REGION OptionRomTable6322[] = // 1 M x100000
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2322,
-- 0, INT_OPT_ROM_SIZE_2322-1},
-- {INT_OPT_ROM_REGION_PHBIOS_FW, INT_OPT_ROM_SIZE_2322,
-- 0, INT_OPT_ROM_SIZE_2322-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--INT_OPT_ROM_REGION OptionRomTable2422[] = // 1 M x100000
--{
-- {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2422,
-- 0, INT_OPT_ROM_SIZE_2422-1},
-- {INT_OPT_ROM_REGION_PHBIOS_PHFCODE_PHEFI, 0x40000,
-- 0, 0x40000-1 },
-- {INT_OPT_ROM_REGION_FW, 0x80000,
-- 0x80000, INT_OPT_ROM_SIZE_2422-1},
-- {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
--};
--
--
--
--int
--qim_read_nvram(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- char *ptmp_buf;
-- uint32_t transfer_size;
-- unsigned long flags;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("qim_read_nvram: entered.\n");)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_buf,
-- dr_ha->nvram_size)) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- dr_ha->nvram_size);)
-- return (ret);
-- }
--
-- transfer_size = dr_ha->nvram_size;
-- if (pext->ResponseLen < dr_ha->nvram_size)
-- transfer_size = pext->ResponseLen;
--
-- /* Dump NVRAM. */
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
-- qim_read_nvram_data(dr_ha, (uint8_t *)ptmp_buf, dr_ha->nvram_base,
-- dr_ha->nvram_size);
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, flags);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_buf, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("qim_read_nvram: exiting.\n");)
--
-- return (ret);
--}
--
--/*
-- * qim_update_nvram
-- * Write data to NVRAM.
-- *
-- * Input:
-- * ha = adapter block pointer.
-- * pext = pointer to driver internal IOCTL structure.
-- *
-- * Returns:
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_update_nvram(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- uint8_t cnt;
-- uint8_t *usr_tmp, *kernel_tmp;
-- nvram_t *pnew_nv;
-- uint32_t transfer_size;
-- int ret = 0;
-- unsigned long flags;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("qim_update_nvram: entered.\n");)
--
-- if (pext->RequestLen < dr_ha->nvram_size)
-- transfer_size = pext->RequestLen;
-- else
-- transfer_size = dr_ha->nvram_size;
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pnew_nv,
-- dr_ha->nvram_size)) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%d.\n",
-- __func__, ha->host_no, ha->instance, dr_ha->nvram_size));
-- return (ret);
-- }
--
-- /* Read from user buffer */
-- kernel_tmp = (uint8_t *)pnew_nv;
-- usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
--
-- ret = copy_from_user(kernel_tmp, usr_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "qim_update_nvram: ERROR in buffer copy READ. "
-- "RequestAdr=%p\n", Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- /* Checksum NVRAM. */
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- uint32_t *iter;
-- uint32_t chksum;
--
-- iter = (uint32_t *)pnew_nv;
-- chksum = 0;
-- for (cnt = 0; cnt < ((dr_ha->nvram_size >> 2) - 1); cnt++)
-- chksum += le32_to_cpu(*iter++);
-- chksum = ~chksum + 1;
-- *iter = cpu_to_le32(chksum);
-- } else {
-- uint8_t *iter;
-- uint8_t chksum;
--
-- iter = (uint8_t *)pnew_nv;
-- chksum = 0;
-- for (cnt = 0; cnt < dr_ha->nvram_size - 1; cnt++)
-- chksum += *iter++;
-- chksum = ~chksum + 1;
-- *iter = chksum;
-- }
--
-- /* Write NVRAM. */
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
-- qim_write_nvram_data(dr_ha, (uint8_t *)pnew_nv, dr_ha->nvram_base,
-- transfer_size);
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, flags);
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("qim_update_nvram: exiting.\n");)
--
-- /* Schedule DPC to restart the RISC */
-- set_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags);
-- up(dr_ha->dpc_wait);
--
-- if (qim_wait_for_hba_online(dr_ha) != QLA_SUCCESS) {
-- pext->Status = EXT_STATUS_ERR;
-- }
--
-- return ret;
--}
--
--int
--qim_get_vpd(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint8_t *ptmp_buf;
-- uint32_t data_offset;
-- uint32_t transfer_size;
-- unsigned long flags;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- if (!(IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha))) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld not 24xx or 25xx. got %x. exiting.\n",
-- __func__, ha->host_no, ha->instance,
-- dr_ha->pdev->device));
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- transfer_size = FA_NVRAM_VPD_SIZE * 4; /* byte count */
-- if (pext->ResponseLen < transfer_size) {
-- pext->ResponseLen = transfer_size;
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld Response buffer too small.\n",
-- __func__, ha->host_no, ha->instance));
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_buf,
-- transfer_size)) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- dr_ha->nvram_size);)
-- return (ret);
-- }
--
-- if (PCI_FUNC(dr_ha->pdev->devfn))
-- data_offset = FA_NVRAM_VPD1_ADDR;
-- else
-- data_offset = FA_NVRAM_VPD0_ADDR;
--
-- /* Dump VPD region in NVRAM. */
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
-- qim_read_nvram_data(dr_ha, ptmp_buf, data_offset, transfer_size);
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, flags);
--
-- DEBUG9(printk("%s(%ld): inst=%ld offset=%x xfr_size=%d. vpd dump-\n",
-- __func__, ha->host_no, ha->instance, data_offset, transfer_size);)
-- DEBUG9(qim_dump_buffer((uint8_t *)ptmp_buf, transfer_size);)
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_buf, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no);)
--
-- return (ret);
--}
--
--int
--qim_update_vpd(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint8_t *usr_tmp, *kernel_tmp, *pnew_nv;
-- uint32_t data_offset;
-- uint32_t transfer_size;
-- unsigned long flags;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- if (!(IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha))) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld not 24xx or 25xx. exiting.\n",
-- __func__, ha->host_no, ha->instance));
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- transfer_size = FA_NVRAM_VPD_SIZE * 4; /* byte count */
-- if (pext->RequestLen < transfer_size)
-- transfer_size = pext->RequestLen;
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pnew_nv, transfer_size)) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%d.\n",
-- __func__, ha->host_no, ha->instance, transfer_size));
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): transfer_size=%d.\n",
-- __func__, ha->host_no, transfer_size);)
--
-- /* Read from user buffer */
-- kernel_tmp = (uint8_t *)pnew_nv;
-- usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
--
-- ret = copy_from_user(kernel_tmp, usr_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): ERROR in buffer copy READ. RequestAdr=%p\n",
-- __func__, ha->host_no, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- if (PCI_FUNC(dr_ha->pdev->devfn))
-- data_offset = FA_NVRAM_VPD1_ADDR;
-- else
-- data_offset = FA_NVRAM_VPD0_ADDR;
--
-- /* Write NVRAM. */
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
-- qim_write_nvram_data(dr_ha, pnew_nv, data_offset, transfer_size);
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, flags);
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no);)
--
-- /* No need to reset the 24xx. */
-- return ret;
--}
--
--static void
--qim_get_option_rom_table(scsi_qla_host_t *ha,
-- INT_OPT_ROM_REGION **pOptionRomTable, unsigned long *OptionRomTableSize)
--{
-- DEBUG9(printk("%s: entered.\n", __func__));
--
-- switch (ha->pdev->device) {
-- case PCI_DEVICE_ID_QLOGIC_ISP6312:
-- *pOptionRomTable = OptionRomTable6312;
-- *OptionRomTableSize = sizeof(OptionRomTable6312);
-- break;
-- case PCI_DEVICE_ID_QLOGIC_ISP2312:
-- /* HBA Model 6826A - is 2312 V3 Chip */
-- if (ha->pdev->subsystem_vendor == 0x103C &&
-- ha->pdev->subsystem_device == 0x12BA) {
-- *pOptionRomTable = OptionRomTableHp;
-- *OptionRomTableSize = sizeof(OptionRomTableHp);
-- } else {
-- *pOptionRomTable = OptionRomTable2312;
-- *OptionRomTableSize = sizeof(OptionRomTable2312);
-- }
-- break;
-- case PCI_DEVICE_ID_QLOGIC_ISP2322:
-- *pOptionRomTable = OptionRomTable2322;
-- *OptionRomTableSize = sizeof(OptionRomTable2322);
-- break;
-- case PCI_DEVICE_ID_QLOGIC_ISP6322:
-- *pOptionRomTable = OptionRomTable6322;
-- *OptionRomTableSize = sizeof(OptionRomTable6322);
-- break;
-- case PCI_DEVICE_ID_QLOGIC_ISP2422:
-- case PCI_DEVICE_ID_QLOGIC_ISP2432:
-- *pOptionRomTable = OptionRomTable2422;
-- *OptionRomTableSize = sizeof(OptionRomTable2422);
-- break;
-- default:
-- DEBUG9_10(printk("%s(%ld) Option Rom Table for device_id=0x%x "
-- "not defined\n", __func__, ha->host_no, ha->pdev->device));
-- break;
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--}
--
--int
--qim_get_option_rom_layout(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0, iter;
-- INT_OPT_ROM_REGION *OptionRomTable = NULL;
-- INT_OPT_ROM_LAYOUT *optrom_layout;
-- uint32_t no_regions;
-- unsigned long OptionRomTableSize;
-- unsigned long OptionRomLayoutSize;
-- struct scsi_qla_host *dr_ha;
--
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- dr_ha = ha->dr_data;
--
-- /* Pick the right OptionRom table based on device id */
-- qim_get_option_rom_table(dr_ha, &OptionRomTable, &OptionRomTableSize);
--
-- if (OptionRomTable == NULL) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld) Option Rom Table for device_id=0x%x "
-- "not defined\n", __func__, ha->host_no,
-- dr_ha->pdev->device));
-- return ret;
-- }
--
-- /* calculate exactly how many entries we got */
-- // Dont Count the NULL Entry.
-- no_regions = (UINT32)
-- (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION) - 1);
-- OptionRomLayoutSize = (8 + sizeof(INT_OPT_ROM_REGION) * no_regions);
--
-- if (pext->ResponseLen < OptionRomLayoutSize) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s(%ld) buffer too small: response_len = %d "
-- "optrom_table_len=%ld.\n", __func__, ha->host_no,
-- pext->ResponseLen, OptionRomTableSize));
-- return ret;
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&optrom_layout,
-- OptionRomLayoutSize)) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n", __func__, ha->host_no,
-- ha->instance, OptionRomTableSize));
-- return ret;
-- }
--
-- optrom_layout->NoOfRegions = no_regions;
--
-- for (iter = 0; iter < optrom_layout->NoOfRegions; iter++) {
-- optrom_layout->Region[iter].Region =
-- OptionRomTable[iter].Region;
-- optrom_layout->Region[iter].Size =
-- OptionRomTable[iter].Size;
-- optrom_layout->Region[iter].Beg =
-- OptionRomTable[iter].Beg;
-- optrom_layout->Region[iter].End =
-- OptionRomTable[iter].End;
--
-- if (OptionRomTable[iter].Region == INT_OPT_ROM_REGION_ALL)
-- optrom_layout->Size = OptionRomTable[iter].Size;
-- }
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- optrom_layout, OptionRomLayoutSize);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance));
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s: exiting.\n", __func__));
--
-- return ret;
--}
--
--int
--qim_read_option_rom_ext(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int iter, found;
-- int rval = 0;
-- uint8_t *image_ptr;
-- uint32_t saddr, length;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- found = 0;
-- saddr = length = 0;
--
-- /* Retrieve region or raw starting address. */
-- if (pext->SubCode == 0xFFFF) {
-- saddr = pext->Reserved1;
-- length = pext->RequestLen;
-- found++;
-- } else {
-- INT_OPT_ROM_REGION *OptionRomTable = NULL;
-- unsigned long OptionRomTableSize;
--
-- /* Pick the right OptionRom table based on device id */
-- qim_get_option_rom_table(dr_ha, &OptionRomTable,
-- &OptionRomTableSize);
--
-- for (iter = 0; OptionRomTable != NULL && iter <
-- (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION));
-- iter++) {
-- if (OptionRomTable[iter].Region == pext->SubCode) {
-- saddr = OptionRomTable[iter].Beg;
-- length = OptionRomTable[iter].Size;
-- DEBUG9(printk("%s: found region %x.\n",
-- __func__, pext->SubCode);)
-- found++;
-- break;
-- }
-- }
-- }
--
-- if (!found) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return rval;
-- }
--
-- if (pext->ResponseLen < length) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- return (-EFAULT);
-- }
--
-- image_ptr = vmalloc(length);
-- if (image_ptr == NULL) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- printk(KERN_WARNING
-- "%s: ERROR in flash allocation.\n", __func__);
-- return rval;
-- }
--
-- DEBUG9(printk("%s: done malloc. going to read.\n", __func__);)
--
-- /* Dump FLASH. */
-- if (qim_update_or_read_flash(dr_ha, image_ptr, saddr, length,
-- QLA2X00_READ)) {
-- pext->Status = EXT_STATUS_BUSY;
-- } else {
--
-- DEBUG9(printk("%s: done read. going to copy.\n", __func__);)
--
-- if (copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), image_ptr, length)) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance));
-- vfree(image_ptr);
-- return (-EFAULT);
-- }
-- }
--
-- vfree(image_ptr);
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return rval;
--}
--
--int
--qim_read_option_rom(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int rval = 0;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
-- uint8_t *image_ptr;
--
--
-- if (pext->SubCode)
-- return qim_read_option_rom_ext(ha, pext, mode);
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- /* These interfaces are not valid for 24xx and 25xx chips. */
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- return rval;
-- }
--
-- /* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-- if (IS_QLA2312(dr_ha) && dr_ha->product_id[3] == 0x2 &&
-- !dr_ha->pio_address) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- return rval;
-- }
--
-- if (pext->ResponseLen != FLASH_IMAGE_SIZE) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- return rval;
-- }
--
-- image_ptr = vmalloc(FLASH_IMAGE_SIZE);
-- if (image_ptr == NULL) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- printk(KERN_WARNING
-- "%s: ERROR in flash allocation.\n", __func__);
-- return rval;
-- }
--
-- /* Dump FLASH. This is for non-24xx/25xx */
-- if (qim_update_or_read_flash(dr_ha, image_ptr, 0, FLASH_IMAGE_SIZE,
-- QLA2X00_READ)) {
-- pext->Status = EXT_STATUS_BUSY;
-- } else if (copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), image_ptr, FLASH_IMAGE_SIZE)) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance));
-- rval = -EFAULT;
-- }
-- vfree(image_ptr);
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return rval;
--}
--
--int
--qim_update_option_rom_ext(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int iter, found;
-- int ret = 0;
-- uint16_t status;
-- uint8_t *usr_tmp;
-- uint8_t *kern_tmp;
-- uint8_t *ptmp_mem = NULL;
-- uint32_t saddr, length;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- found = 0;
-- saddr = length = 0;
-- /* Retrieve region or raw starting address. */
-- if (pext->SubCode == 0xFFFF) {
-- saddr = pext->Reserved1;
-- length = pext->RequestLen;
-- found++;
-- } else {
-- INT_OPT_ROM_REGION *OptionRomTable = NULL;
-- unsigned long OptionRomTableSize;
--
-- /* Pick the right OptionRom table based on device id */
-- qim_get_option_rom_table(dr_ha, &OptionRomTable,
-- &OptionRomTableSize);
--
-- for (iter = 0; OptionRomTable != NULL && iter <
-- (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION));
-- iter++) {
-- if (OptionRomTable[iter].Region == pext->SubCode) {
-- saddr = OptionRomTable[iter].Beg;
-- length = OptionRomTable[iter].Size;
-- found++;
-- break;
-- }
-- }
-- }
--
-- if (!found) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return ret;
-- }
--
-- if (pext->RequestLen < length) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- return ret;
-- }
--
-- /* Read from user buffer */
-- usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
--
-- kern_tmp = vmalloc(length);
-- if (kern_tmp == NULL) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- printk(KERN_WARNING
-- "%s: ERROR in flash allocation.\n", __func__);
-- return ret;
-- }
--
-- ret = copy_from_user(kern_tmp, usr_tmp, length);
-- if (ret) {
-- vfree(kern_tmp);
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s: ERROR in buffer copy READ. "
-- "RequestAdr=%p\n", __func__,
-- Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-- return (-EFAULT);
-- }
--
-- /* Go with update */
-- status = qim_update_or_read_flash(dr_ha, kern_tmp, saddr, length,
-- QLA2X00_WRITE);
--
-- vfree(kern_tmp);
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- if (status) {
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s: ERROR updating flash.\n", __func__);)
-- } else {
-- /* Update our db with the newly updated flash version values. */
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- DEBUG9(printk("%s(%ld): refresh flash versions.\n",
-- __func__, ha->host_no);)
--
-- if (qim_get_ioctl_scrap_mem(ha,
-- (void **)&ptmp_mem, sizeof(request_t))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not "
-- "big enough. size requested=%ld.\n",
-- __func__, ha->host_no,
-- ha->instance, (ulong)sizeof(request_t)));
-- } else if (qim24xx_refresh_flash_version(ha,
-- ptmp_mem)){
--
-- pext->Status = EXT_STATUS_ERR;
-- DEBUG9_10(printk( "%s: ERROR reading updated "
-- "flash versions.\n",
-- __func__);)
-- }
--
-- qim_free_ioctl_scrap_mem(ha);
-- }
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return ret;
--}
--
--int
--qim_update_option_rom(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int rval = 0;
-- uint8_t *usr_tmp;
-- uint8_t *kern_tmp;
-- uint16_t status;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s(%ld): inst=%ld ext ioctl struct dump-\n",
-- __func__, ha->host_no, ha->instance);)
-- DEBUG9(qim_dump_buffer((uint8_t *)pext,
-- sizeof(EXT_IOCTL));)
--
-- if (pext->SubCode)
-- return qim_update_option_rom_ext(ha, pext, mode);
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- /* These interfaces are not valid for 24xx and 25xx chips. */
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- return rval;
-- }
--
-- /* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-- if (IS_QLA2312(dr_ha) && dr_ha->product_id[3] == 0x2 &&
-- !dr_ha->pio_address) {
-- DEBUG10(printk("%s: got 2312 and no flash access via mmio.\n",
-- __func__);)
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- return rval;
-- }
--
-- if (pext->RequestLen != FLASH_IMAGE_SIZE) {
-- DEBUG10(printk("%s: wrong RequestLen=%d, should be %d.\n",
-- __func__, pext->RequestLen, FLASH_IMAGE_SIZE);)
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- return rval;
-- }
--
-- /* Read from user buffer */
-- kern_tmp = vmalloc(FLASH_IMAGE_SIZE);
-- if (kern_tmp == NULL) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG10(printk("%s: vmalloc failed.\n", __func__);)
-- printk(KERN_WARNING
-- "%s: ERROR in flash allocation.\n", __func__);
-- return rval;
-- }
--
-- usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
--
-- DEBUG9(printk("%s(%ld): going to copy from user.\n",
-- __func__, ha->host_no);)
--
-- rval = copy_from_user(kern_tmp, usr_tmp, FLASH_IMAGE_SIZE);
-- if (rval) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s: ERROR in buffer copy READ. "
-- "RequestAdr=%p\n",
-- __func__, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode));)
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s(%ld): done copy from user. data dump:\n",
-- __func__, ha->host_no);)
-- DEBUG9(qim_dump_buffer((uint8_t *)kern_tmp,
-- FLASH_IMAGE_SIZE);)
--
-- /* Go with update */
-- status = qim_update_or_read_flash(dr_ha, kern_tmp, 0, FLASH_IMAGE_SIZE,
-- QLA2X00_WRITE);
--
-- vfree(kern_tmp);
--
-- if (status) {
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s: ERROR updating flash.\n", __func__);)
-- } else {
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return rval;
--}
--
--int
--qim_send_loopback(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int rval = 0;
-- int status;
-- uint16_t ret_mb[MAILBOX_REGISTER_COUNT];
-- INT_LOOPBACK_REQ req;
-- INT_LOOPBACK_RSP rsp;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("qim_send_loopback: entered.\n");)
--
-- if (pext->RequestLen != sizeof(INT_LOOPBACK_REQ)) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk(
-- "qim_send_loopback: invalid RequestLen =%d.\n",
-- pext->RequestLen);)
-- return rval;
-- }
--
-- if (pext->ResponseLen != sizeof(INT_LOOPBACK_RSP)) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk(
-- "qim_send_loopback: invalid ResponseLen =%d.\n",
-- pext->ResponseLen);)
-- return rval;
-- }
--
-- status = copy_from_user(&req, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("qim_send_loopback: ERROR copy read of "
-- "request buffer.\n");)
-- return (-EFAULT);
-- }
--
-- status = copy_from_user(&rsp, Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), pext->ResponseLen);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("qim_send_loopback: ERROR copy read of "
-- "response buffer.\n");)
-- return (-EFAULT);
-- }
--
-- if (req.TransferCount > req.BufferLength ||
-- req.TransferCount > rsp.BufferLength) {
--
-- /* Buffer lengths not large enough. */
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- DEBUG9_10(printk(
-- "qim_send_loopback: invalid TransferCount =%d. "
-- "req BufferLength =%d rspBufferLength =%d.\n",
-- req.TransferCount, req.BufferLength, rsp.BufferLength);)
--
-- return rval;
-- }
--
-- status = copy_from_user(ha->ioctl_mem, Q64BIT_TO_PTR(req.BufferAddress,
-- pext->AddrMode), req.TransferCount);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("qim_send_loopback: ERROR copy read of "
-- "user loopback data buffer.\n");)
-- return (-EFAULT);
-- }
--
--
-- DEBUG9(printk("qim_send_loopback: req -- bufadr=%lx, buflen=%x, "
-- "xfrcnt=%x, rsp -- bufadr=%lx, buflen=%x.\n",
-- (unsigned long)req.BufferAddress, req.BufferLength,
-- req.TransferCount, (unsigned long)rsp.BufferAddress,
-- rsp.BufferLength);)
--
-- /*
-- * AV - the caller of this IOCTL expects the FW to handle
-- * a loopdown situation and return a good status for the
-- * call function and a LOOPDOWN status for the test operations
-- */
-- /*if (atomic_read(&ha->loop_state) != LOOP_READY || */
-- if (test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- dr_ha->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("qim_send_loopback(%ld): "
-- "loop not ready.\n", ha->host_no);)
-- return rval;
-- }
--
-- if (dr_ha->current_topology == ISP_CFG_F) {
-- if (IS_QLA2100(dr_ha) || IS_QLA2200(dr_ha)) {
-- pext->Status = EXT_STATUS_INVALID_REQUEST ;
-- DEBUG9_10(printk("qim_send_loopback: ERROR "
-- "command only supported for QLA23xx.\n");)
-- return rval;
-- }
-- status = qim_echo_test(ha, &req, ret_mb);
-- } else {
-- status = qim_loopback_test(ha, &req, ret_mb);
-- }
--
-- if (status) {
-- if (status == QLA_FUNCTION_TIMEOUT ) {
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("qim_send_loopback: ERROR "
-- "command timed out.\n");)
-- return rval;
-- } else {
-- /* EMPTY. Just proceed to copy back mailbox reg
-- * values for users to interpret.
-- */
-- pext->Status = EXT_STATUS_ERR;
-- DEBUG10(printk("qim_send_loopback: ERROR "
-- "loopback command failed 0x%x.\n", ret_mb[0]);)
-- }
-- }
--
-- DEBUG9(printk("qim_send_loopback: loopback mbx cmd ok. "
-- "copying data.\n");)
--
-- /* put loopback return data in user buffer */
-- status = copy_to_user(Q64BIT_TO_PTR(rsp.BufferAddress,
-- pext->AddrMode), ha->ioctl_mem, req.TransferCount);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("qim_send_loopback: ERROR copy "
-- "write of return data buffer.\n");)
-- return (-EFAULT);
-- }
--
-- rsp.CompletionStatus = ret_mb[0];
-- if (dr_ha->current_topology == ISP_CFG_F) {
-- rsp.CommandSent = INT_DEF_LB_ECHO_CMD;
-- } else {
-- if (rsp.CompletionStatus == INT_DEF_LB_COMPLETE ||
-- rsp.CompletionStatus == INT_DEF_LB_CMD_ERROR) {
-- rsp.CrcErrorCount = ret_mb[1];
-- rsp.DisparityErrorCount = ret_mb[2];
-- rsp.FrameLengthErrorCount = ret_mb[3];
-- rsp.IterationCountLastError =
-- (ret_mb[19] << 16) | ret_mb[18];
-- }
-- }
--
-- status = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), &rsp, pext->ResponseLen);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("qim_send_loopback: ERROR copy "
-- "write of response buffer.\n");)
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- DEBUG9(printk("qim_send_loopback: exiting.\n");)
--
-- return rval;
--}
--
--int
--qim_fw_dump(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int rval = 0;
-- int status;
-- uint32_t copy_len;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- if (dr_ha->fw_dump_buffer == NULL) {
-- DEBUG9_10(printk("%s(%ld): no fw dump.\n",
-- __func__, ha->host_no);)
-- printk("%s(%ld): no fw dump.\n", __func__, ha->host_no);
--
-- return 0;
-- }
--
-- DEBUG9(printk("%s(%ld): copying fw dump.\n", __func__, ha->host_no);)
-- printk("%s(%ld): copying fw dump.\n", __func__, ha->host_no);
--
-- copy_len = (dr_ha->fw_dump_buffer_len < pext->ResponseLen) ?
-- dr_ha->fw_dump_buffer_len : pext->ResponseLen;
-- status = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode), dr_ha->fw_dump_buffer, copy_len);
-- if (status) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s: ERROR copy "
-- "write of response buffer.\n", __func__);)
-- return (-EFAULT);
-- }
--
-- vfree(dr_ha->fw_dump_buffer);
-- dr_ha->fw_dump_buffer = NULL;
-- dr_ha->fw_dump_buffer_len = 0;
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no);)
--
-- return rval;
--}
--
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_ioctl.h ./drivers/scsi/qla2xxx/qim_ioctl.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_ioctl.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_ioctl.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,26 +0,0 @@
--#ifndef __QIM_IOCTL_H__
--#define __QIM_IOCTL_H__
--
--#include <linux/delay.h>
--#include <asm/uaccess.h>
--
--#include "qim_def.h"
--#include "exioct.h"
--#include "inioct.h"
--#include "qim_sup.h"
--#include "qim_mbx.h"
--
--extern int
--qim_get_ioctl_scrap_mem(struct qla_host_ioctl *, void **, uint32_t);
--
--extern void
--qim_free_ioctl_scrap_mem(struct qla_host_ioctl *);
--
--extern void *
--Q64BIT_TO_PTR(uint64_t, uint16_t);
--
--extern void
--qim_dump_buffer(uint8_t *, uint32_t);
--
--#endif /* ifndef __QIM_IOCTL_H__ */
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_mbx.c ./drivers/scsi/qla2xxx/qim_mbx.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_mbx.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_mbx.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,920 +0,0 @@
--/*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- */
--#include "qim_def.h"
--#include "exioctln.h"
--#include "inioct.h"
--
--#include <linux/delay.h>
--
--/* qim_sup.c */
--extern int
--qim_down_timeout(struct semaphore *, unsigned long);
--
--
--/*
-- * qim_mbx_sem_timeout
-- * Issue mailbox command and waits for completion.
-- *
-- * Input:
-- * ha = adapter block pointer.
-- * mcp = driver internal mbx struct pointer.
-- *
-- * Output:
-- * mb[MAX_MAILBOX_REGISTER_COUNT] = returned mailbox data.
-- *
-- * Returns:
-- * 0 : QLA_SUCCESS = cmd performed success
-- * 1 : QLA_FUNCTION_FAILED (error encountered)
-- * 6 : QLA_FUNCTION_TIMEOUT (timeout condition encountered)
-- *
-- * Context:
-- * Kernel context.
-- */
--static void
--qim_mbx_sem_timeout(unsigned long data)
--{
-- struct semaphore *sem_ptr = (struct semaphore *)data;
--
-- DEBUG11(printk("qim_sem_timeout: entered.\n");)
--
-- if (sem_ptr != NULL) {
-- up(sem_ptr);
-- }
--
-- DEBUG11(printk("qim_mbx_sem_timeout: exiting.\n");)
--}
--
--static int
--qim_mailbox_command(struct scsi_qla_host *dr_ha, mbx_cmd_t *mcp)
--{
-- int rval;
-- unsigned long flags = 0;
-- device_reg_t __iomem *reg = NULL;
-- struct device_reg_24xx __iomem *reg24 = NULL;
--
-- struct timer_list tmp_intr_timer;
-- uint8_t abort_active;
-- uint8_t io_lock_on = dr_ha->flags.init_done;
-- uint16_t command;
-- uint16_t *iptr;
-- uint16_t __iomem *optr;
-- uint32_t cnt;
-- uint32_t mboxes;
-- unsigned long mbx_flags = 0;
--
--
-- rval = QLA_SUCCESS;
-- abort_active = test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags);
--
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, dr_ha->host_no);)
--
-- /*
-- * Wait for active mailbox commands to finish by waiting at most tov
-- * seconds. This is to serialize actual issuing of mailbox cmds during
-- * non ISP abort time.
-- */
-- if (!abort_active) {
-- if (qim_down_timeout(&dr_ha->mbx_cmd_sem, mcp->tov * HZ)) {
-- /* Timeout occurred. Return error. */
-- DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
-- "Exiting.\n", __func__, dr_ha->host_no);)
-- return QLA_FUNCTION_TIMEOUT;
-- }
-- } else {
-- /* return error */
-- DEBUG2_3_11(printk("%s(%ld): abort in progress. "
-- "Exiting.\n", __func__, dr_ha->host_no);)
-- return QLA_BUSY;
-- }
--
-- dr_ha->flags.mbox_busy = 1;
-- /* Save mailbox command for debug */
-- dr_ha->mcp = mcp;
--
-- /* Try to get mailbox register access */
-- abort_active = test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags);
-- if (!abort_active && io_lock_on) {
-- spin_lock_irqsave(&dr_ha->mbx_reg_lock, mbx_flags);
-- } else {
-- /* return error */
-- DEBUG2_3_11(printk("%s(%ld): abort in progress. Exiting. "
-- "abort_active=%d.\n",
-- __func__, dr_ha->host_no, abort_active);)
-- return QLA_BUSY;
-- }
--
-- DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n",
-- dr_ha->host_no, mcp->mb[0]);)
--
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
--
-- /* Load mailbox registers. */
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- reg24 = (struct device_reg_24xx __iomem *)dr_ha->iobase;
-- optr = (uint16_t __iomem *)&reg24->mailbox0;
-- } else {
-- reg = dr_ha->iobase;
-- optr = (uint16_t __iomem *)MAILBOX_REG(dr_ha, reg, 0);
-- }
--
-- DEBUG11(printk("scsi(%ld): mbx_count = %d.\n",
-- dr_ha->host_no, dr_ha->mbx_count);)
--
-- iptr = mcp->mb;
-- command = mcp->mb[0];
-- mboxes = mcp->out_mb;
--
-- for (cnt = 0; cnt < dr_ha->mbx_count; cnt++) {
-- if (IS_QLA2200(dr_ha) && cnt == 8)
-- optr = (uint16_t __iomem *)MAILBOX_REG(dr_ha, reg, 8);
-- if (mboxes & BIT_0)
-- WRT_REG_WORD(optr, *iptr);
--
-- mboxes >>= 1;
-- optr++;
-- iptr++;
-- }
--
--#if 0
-- printk("%s(%ld): Loaded MBX registers (displayed in bytes) = \n",
-- __func__, dr_ha->host_no);
-- qim_dump_buffer((uint8_t *)mcp->mb, 16);
-- printk("\n");
-- qim_dump_buffer(((uint8_t *)mcp->mb + 0x10), 16);
-- printk("\n");
-- qim_dump_buffer(((uint8_t *)mcp->mb + 0x20), 8);
-- printk("\n");
-- printk("%s(%ld): I/O address = %p.\n", __func__, ha->host_no, optr);
-- qim_dump_regs(dr_ha);
--#endif
--
-- /* Issue set host interrupt command to send cmd out. */
-- dr_ha->flags.mbox_int = 0;
-- clear_bit(MBX_INTERRUPT, &dr_ha->mbx_cmd_flags);
--
-- /* Unlock mbx registers and wait for interrupt */
-- DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. "
-- "jiffies=%lx.\n", __func__, dr_ha->host_no, jiffies);)
--
-- /* Wait for mbx cmd completion until timeout */
--
-- /* sleep on completion semaphore */
-- DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n",
-- __func__, dr_ha->host_no);)
--
-- init_timer(&tmp_intr_timer);
-- tmp_intr_timer.data = (unsigned long)&dr_ha->mbx_intr_sem;
-- tmp_intr_timer.expires = jiffies + mcp->tov * HZ;
-- tmp_intr_timer.function =
-- (void (*)(unsigned long))qim_mbx_sem_timeout;
--
-- DEBUG11(printk("%s(%ld): Adding timer.\n", __func__,
-- dr_ha->host_no);)
-- add_timer(&tmp_intr_timer);
--
-- DEBUG11(printk("%s(%ld): going to unlock & sleep. "
-- "time=0x%lx.\n", __func__, dr_ha->host_no, jiffies);)
--
-- set_bit(MBX_INTR_WAIT, &dr_ha->mbx_cmd_flags);
--
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha))
-- WRT_REG_DWORD(&reg24->hccr, HCCRX_SET_HOST_INT);
-- else
-- WRT_REG_WORD(&reg->hccr, HCCR_SET_HOST_INT);
--
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, flags);
--
-- if (!abort_active)
-- spin_unlock_irqrestore(&dr_ha->mbx_reg_lock, mbx_flags);
--
-- /* Wait for either the timer to expire
-- * or the mbox completion interrupt
-- */
-- down(&dr_ha->mbx_intr_sem);
--
-- DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__,
-- dr_ha->host_no, jiffies);)
-- clear_bit(MBX_INTR_WAIT, &dr_ha->mbx_cmd_flags);
--
-- /* delete the timer */
-- del_timer(&tmp_intr_timer);
--
--
-- /* Check whether we timed out */
-- spin_lock_irqsave(&dr_ha->mbx_reg_lock, mbx_flags);
--
-- if (dr_ha->flags.mbox_int) {
-- uint16_t *iptr2;
--
-- DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__,
-- dr_ha->host_no, command);)
--
-- /* Got interrupt. Clear the flag. */
-- dr_ha->flags.mbox_int = 0;
-- clear_bit(MBX_INTERRUPT, &dr_ha->mbx_cmd_flags);
--
-- if (dr_ha->mailbox_out[0] != MBS_COMMAND_COMPLETE) {
-- /*
-- qim_stats.mboxerr++;
-- */
-- rval = QLA_FUNCTION_FAILED;
-- }
--
-- /* Load return mailbox registers. */
-- iptr2 = mcp->mb;
-- iptr = (uint16_t *)&dr_ha->mailbox_out[0];
-- mboxes = mcp->in_mb;
-- for (cnt = 0; cnt < dr_ha->mbx_count; cnt++) {
-- if (mboxes & BIT_0)
-- *iptr2 = *iptr;
--
-- mboxes >>= 1;
-- iptr2++;
-- iptr++;
-- }
-- } else {
--
-- uint16_t mb0;
-- uint32_t ictrl;
--
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- mb0 = RD_REG_WORD(&reg24->mailbox0);
-- ictrl = RD_REG_DWORD(&reg24->ictrl);
-- } else {
-- mb0 = RD_MAILBOX_REG(dr_ha, reg, 0);
-- ictrl = RD_REG_WORD(&reg->ictrl);
-- }
--
-- printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n",
-- __func__, dr_ha->host_no, command);
-- printk("%s(%ld): icontrol=%x jiffies=%lx\n", __func__,
-- dr_ha->host_no, ictrl, jiffies);
-- printk("%s(%ld): *** mailbox[0] = 0x%x ***\n", __func__,
-- dr_ha->host_no, mb0);
--#if 0
-- qim_dump_regs(dr_ha);
--#endif
--
-- /*
-- qim_stats.mboxtout++;
-- */
-- dr_ha->total_mbx_timeout++;
-- rval = QLA_FUNCTION_TIMEOUT;
-- }
--
-- spin_unlock_irqrestore(&dr_ha->mbx_reg_lock, mbx_flags);
--
-- dr_ha->flags.mbox_busy = 0;
--
-- /* Clean up */
-- dr_ha->mcp = NULL;
--
-- /* Allow next mbx cmd to come in. */
-- up(&dr_ha->mbx_cmd_sem);
--
-- if (rval) {
-- DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
-- "mbx2=%x, cmd=%x ****\n", __func__, dr_ha->host_no,
-- mcp->mb[0], mcp->mb[1], mcp->mb[2], command);)
-- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, dr_ha->host_no);)
-- }
--
-- return rval;
--}
--
--/*
-- * qim_get_link_status
-- *
-- * Input:
-- * ha = adapter block pointer.
-- * loop_id = device loop ID.
-- * ret_buf = pointer to link status return buffer.
-- *
-- * Returns:
-- * 0 = success.
-- * BIT_0 = mem alloc error.
-- * BIT_1 = mailbox error.
-- */
--uint8_t
--qim_get_link_status(struct qla_host_ioctl *ioctlha, uint16_t loop_id,
-- uint16_t optbits, link_stat_t *ret_buf, uint16_t *status)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
-- link_stat_t *stat_buf;
-- dma_addr_t stat_buf_dma;
-- struct scsi_qla_host *ha = ioctlha->dr_data;
--
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma);
-- if (stat_buf == NULL) {
-- DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
-- __func__, ha->host_no));
-- return BIT_0;
-- }
--
-- memset(stat_buf, 0, sizeof(link_stat_t));
-- DEBUG11(printk("%s(%ld): going to send mailbox cmd.\n",
-- __func__, ha->host_no);)
--
-- mcp->mb[0] = MBC_GET_LINK_STATUS;
-- mcp->mb[2] = MSW(stat_buf_dma);
-- mcp->mb[3] = LSW(stat_buf_dma);
-- mcp->mb[6] = MSW(MSD(stat_buf_dma));
-- mcp->mb[7] = LSW(MSD(stat_buf_dma));
-- mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-- mcp->in_mb = MBX_0;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- mcp->mb[1] = loop_id;
-- mcp->mb[4] = 0;
-- mcp->mb[10] = optbits;
-- mcp->out_mb |= MBX_10|MBX_4|MBX_1;
-- mcp->in_mb |= MBX_1;
-- } else if (HAS_EXTENDED_IDS(ha)) {
-- mcp->mb[1] = loop_id;
-- mcp->mb[10] = optbits;
-- mcp->out_mb |= MBX_10|MBX_1;
-- DEBUG11(printk(
-- "%s(%ld): extended id=%x mb1=%x mb6=%x mb10=%x.\n",
-- __func__, ha->host_no, loop_id, mcp->mb[1],
-- mcp->mb[6], mcp->mb[10]);)
-- } else {
-- mcp->mb[1] = (optbits & 0xff) | loop_id << 8;
-- mcp->out_mb |= MBX_1;
-- DEBUG11(printk("%s(%ld): id=%x.\n",
-- __func__, ha->host_no, mcp->mb[1]);)
-- }
--
-- mcp->tov = 30;
-- mcp->flags = IOCTL_CMD;
-- rval = qim_mailbox_command(ha, mcp);
--
-- if (rval != QLA_FUNCTION_TIMEOUT) {
-- if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-- DEBUG2_3_11(printk(
-- "%s(%ld): cmd failed=%x. mbx0=%x mbx1=%x.\n",
-- __func__, ha->host_no, rval, mcp->mb[0],
-- mcp->mb[1]);)
-- status[0] = mcp->mb[0];
-- rval = BIT_1;
-- } else {
-- /* copy over data -- firmware data is LE. */
-- ret_buf->link_fail_cnt =
-- le32_to_cpu(stat_buf->link_fail_cnt);
-- ret_buf->loss_sync_cnt =
-- le32_to_cpu(stat_buf->loss_sync_cnt);
-- ret_buf->loss_sig_cnt =
-- le32_to_cpu(stat_buf->loss_sig_cnt);
-- ret_buf->prim_seq_err_cnt =
-- le32_to_cpu(stat_buf->prim_seq_err_cnt);
-- ret_buf->inval_xmit_word_cnt =
-- le32_to_cpu(stat_buf->inval_xmit_word_cnt);
-- ret_buf->inval_crc_cnt =
-- le32_to_cpu(stat_buf->inval_crc_cnt);
--
-- DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d "
-- "loss_sync=%d loss_sig=%d seq_err=%d "
-- "inval_xmt_word=%d inval_crc=%d.\n", __func__,
-- ha->host_no, stat_buf->link_fail_cnt,
-- stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt,
-- stat_buf->prim_seq_err_cnt,
-- stat_buf->inval_xmit_word_cnt,
-- stat_buf->inval_crc_cnt);)
-- }
-- } else {
-- /* Failed. */
-- DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-- ha->host_no, rval);)
-- rval = BIT_1;
-- }
--
-- dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma);
--
-- return rval;
--}
--
--uint8_t
--qim_get_isp_stats(struct qla_host_ioctl *ioctlha, uint32_t *dwbuf,
-- uint32_t dwords, uint16_t optbits, uint16_t *status)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
-- uint32_t *sbuf, *siter;
-- dma_addr_t sbuf_dma;
-- struct scsi_qla_host *ha = ioctlha->dr_data;
--
--
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- if (dwords > (DMA_POOL_SIZE / 4)) {
-- DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs "
-- "(max %d).\n", __func__, ha->host_no, dwords,
-- DMA_POOL_SIZE / 4));
-- return BIT_0;
-- }
-- sbuf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &sbuf_dma);
-- if (sbuf == NULL) {
-- DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
-- __func__, ha->host_no));
-- return BIT_0;
-- }
-- memset(sbuf, 0, DMA_POOL_SIZE);
--
-- mcp->mb[0] = MBC_GET_LINK_PRIV_STATS;
-- mcp->mb[2] = MSW(sbuf_dma);
-- mcp->mb[3] = LSW(sbuf_dma);
-- mcp->mb[6] = MSW(MSD(sbuf_dma));
-- mcp->mb[7] = LSW(MSD(sbuf_dma));
-- mcp->mb[8] = dwords;
-- mcp->mb[10] = optbits;
-- mcp->out_mb = MBX_10|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-- mcp->in_mb = MBX_2|MBX_1|MBX_0;
-- mcp->tov = 30;
-- mcp->flags = IOCTL_CMD;
-- rval = qim_mailbox_command(ha, mcp);
--
-- if (rval != QLA_FUNCTION_TIMEOUT) {
-- if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-- DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
-- __func__, ha->host_no, mcp->mb[0]));
-- status[0] = mcp->mb[0];
-- rval = BIT_1;
-- } else {
-- /* Copy over data -- firmware data is LE. */
-- siter = sbuf;
-- while (dwords--)
-- *dwbuf++ = le32_to_cpu(*siter++);
-- }
-- } else {
-- /* Failed. */
-- DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-- ha->host_no, rval));
-- rval = BIT_1;
-- }
--
-- dma_pool_free(ha->s_dma_pool, sbuf, sbuf_dma);
--
-- return rval;
--}
--
--/*
-- * qim_issue_iocb
-- * Issue IOCB using mailbox command
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * buffer = buffer pointer.
-- * phys_addr = physical address of buffer.
-- * size = size of buffer.
-- * TARGET_QUEUE_LOCK must be released.
-- * ADAPTER_STATE_LOCK must be released.
-- *
-- * Returns:
-- * qla2x00 local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr,
-- size_t size)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- mcp->mb[0] = MBC_IOCB_COMMAND_A64;
-- mcp->mb[1] = 0;
-- mcp->mb[2] = MSW(phys_addr);
-- mcp->mb[3] = LSW(phys_addr);
-- mcp->mb[6] = MSW(MSD(phys_addr));
-- mcp->mb[7] = LSW(MSD(phys_addr));
-- mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-- mcp->in_mb = MBX_2|MBX_0;
-- mcp->tov = 30;
-- mcp->flags = 0;
-- rval = qim_mailbox_command(ha, mcp);
--
-- if (rval != QLA_SUCCESS) {
-- /*EMPTY*/
-- DEBUG2_11(printk("qim_issue_iocb(%ld): failed rval 0x%x\n",
-- ha->host_no,rval);)
-- } else {
-- sts_entry_t *sts_entry = (sts_entry_t *) buffer;
--
-- /* Mask reserved bits. */
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- sts_entry->entry_status &= RF_MASK_24XX;
-- else
-- sts_entry->entry_status &= RF_MASK;
-- }
--
-- return rval;
--}
--
--int
--qim24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
-- uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt)
--{
-- int rval;
--
-- struct logio_entry_24xx *lg;
-- dma_addr_t lg_dma;
-- uint32_t iop[2];
--
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
--
-- lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
-- if (lg == NULL) {
-- DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n",
-- __func__, ha->host_no));
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(lg, 0, sizeof(struct logio_entry_24xx));
--
-- lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
-- lg->entry_count = 1;
-- lg->nport_handle = cpu_to_le16(loop_id);
-- lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI);
-- if (opt & BIT_0)
-- lg->control_flags |= __constant_cpu_to_le16(LCF_COND_PLOGI);
-- lg->port_id[0] = al_pa;
-- lg->port_id[1] = area;
-- lg->port_id[2] = domain;
-- rval = qim_issue_iocb(ha, lg, lg_dma, 0);
-- if (rval != QLA_SUCCESS) {
-- DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-- } else if (lg->entry_status != 0) {
-- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-- "-- error status (%x).\n", __func__, ha->host_no,
-- lg->entry_status));
-- rval = QLA_FUNCTION_FAILED;
-- } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
-- iop[0] = le32_to_cpu(lg->io_parameter[0]);
-- iop[1] = le32_to_cpu(lg->io_parameter[1]);
--
-- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-- "-- completion status (%x) ioparam=%x/%x.\n", __func__,
-- ha->host_no, le16_to_cpu(lg->comp_status), iop[0],
-- iop[1]));
--
-- switch (iop[0]) {
-- case LSC_SCODE_PORTID_USED:
-- mb[0] = MBS_PORT_ID_USED;
-- mb[1] = LSW(iop[1]);
-- break;
-- case LSC_SCODE_NPORT_USED:
-- mb[0] = MBS_LOOP_ID_USED;
-- break;
-- case LSC_SCODE_NOLINK:
-- case LSC_SCODE_NOIOCB:
-- case LSC_SCODE_NOXCB:
-- case LSC_SCODE_CMD_FAILED:
-- case LSC_SCODE_NOFABRIC:
-- case LSC_SCODE_FW_NOT_READY:
-- case LSC_SCODE_NOT_LOGGED_IN:
-- case LSC_SCODE_NOPCB:
-- case LSC_SCODE_ELS_REJECT:
-- case LSC_SCODE_CMD_PARAM_ERR:
-- case LSC_SCODE_NONPORT:
-- case LSC_SCODE_LOGGED_IN:
-- case LSC_SCODE_NOFLOGI_ACC:
-- default:
-- mb[0] = MBS_COMMAND_ERROR;
-- break;
-- }
-- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
--
-- iop[0] = le32_to_cpu(lg->io_parameter[0]);
--
-- mb[0] = MBS_COMMAND_COMPLETE;
-- mb[1] = 0;
-- if (iop[0] & BIT_4) {
-- if (iop[0] & BIT_8)
-- mb[1] |= BIT_1;
-- } else
-- mb[1] = BIT_0;
-- }
--
-- dma_pool_free(ha->s_dma_pool, lg, lg_dma);
--
-- return rval;
--}
--
--/*
-- * qim_login_fabric
-- * Issue login fabric port mailbox command.
-- *
-- * Input:
-- * ha = adapter block pointer.
-- * loop_id = device loop ID.
-- * domain = device domain.
-- * area = device area.
-- * al_pa = device AL_PA.
-- * status = pointer for return status.
-- * opt = command options.
-- * TARGET_QUEUE_LOCK must be released.
-- * ADAPTER_STATE_LOCK must be released.
-- *
-- * Returns:
-- * qla2x00 local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
-- uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- return qim24xx_login_fabric(ha, loop_id, domain, area, al_pa,
-- mb, opt);
--
-- DEBUG11(printk("qim_login_fabric(%ld): entered.\n", ha->host_no);)
--
-- mcp->mb[0] = MBC_LOGIN_FABRIC_PORT;
-- mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
-- if (HAS_EXTENDED_IDS(ha)) {
-- mcp->mb[1] = loop_id;
-- mcp->mb[10] = opt;
-- mcp->out_mb |= MBX_10;
-- } else {
-- mcp->mb[1] = (loop_id << 8) | opt;
-- }
-- mcp->mb[2] = domain;
-- mcp->mb[3] = area << 8 | al_pa;
--
-- mcp->in_mb = MBX_7|MBX_6|MBX_2|MBX_1|MBX_0;
-- mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2);
-- mcp->flags = 0;
-- rval = qim_mailbox_command(ha, mcp);
--
-- /* Return mailbox statuses. */
-- if (mb != NULL) {
-- mb[0] = mcp->mb[0];
-- mb[1] = mcp->mb[1];
-- mb[2] = mcp->mb[2];
-- mb[6] = mcp->mb[6];
-- mb[7] = mcp->mb[7];
-- }
--
-- if (rval != QLA_SUCCESS) {
-- /* RLU tmp code: need to change main mailbox_command function to
-- * return ok even when the mailbox completion value is not
-- * SUCCESS. The caller needs to be responsible to interpret
-- * the return values of this mailbox command if we're not
-- * to change too much of the existing code.
-- */
-- if (mcp->mb[0] == 0x4001 || mcp->mb[0] == 0x4002 ||
-- mcp->mb[0] == 0x4003 || mcp->mb[0] == 0x4005 ||
-- mcp->mb[0] == 0x4006)
-- rval = QLA_SUCCESS;
--
-- /*EMPTY*/
-- DEBUG2_3_11(printk("qim_login_fabric(%ld): failed=%x "
-- "mb[0]=%x mb[1]=%x mb[2]=%x.\n", ha->host_no, rval,
-- mcp->mb[0], mcp->mb[1], mcp->mb[2]);)
-- } else {
-- /*EMPTY*/
-- DEBUG11(printk("qim_login_fabric(%ld): done.\n",
-- ha->host_no);)
-- }
--
-- return rval;
--}
--
--int
--qim_loopback_test(struct qla_host_ioctl *ha, INT_LOOPBACK_REQ *req,
-- uint16_t *ret_mb)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- DEBUG11(printk("qim_send_loopback: req.Options=%x iterations=%x "
-- "MAILBOX_CNT=%d.\n", req->Options, req->IterationCount,
-- MAILBOX_REGISTER_COUNT);)
--
-- memset(mcp->mb, 0 , sizeof(mcp->mb));
--
-- mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK;
-- mcp->mb[1] = req->Options | MBX_6;
-- mcp->mb[10] = LSW(req->TransferCount);
-- mcp->mb[11] = MSW(req->TransferCount);
-- mcp->mb[14] = LSW(ha->ioctl_mem_phys); /* send data address */
-- mcp->mb[15] = MSW(ha->ioctl_mem_phys);
-- mcp->mb[20] = LSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[21] = MSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[16] = LSW(ha->ioctl_mem_phys); /* rcv data address */
-- mcp->mb[17] = MSW(ha->ioctl_mem_phys);
-- mcp->mb[6] = LSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[7] = MSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[18] = LSW(req->IterationCount); /* iteration count lsb */
-- mcp->mb[19] = MSW(req->IterationCount); /* iteration count msb */
-- mcp->out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15|
-- MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_7|MBX_6|MBX_1|MBX_0;
-- mcp->in_mb = MBX_19|MBX_18|MBX_3|MBX_2|MBX_1|MBX_0;
-- mcp->buf_size = req->TransferCount;
-- mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
-- mcp->tov = 30;
-- rval = qim_mailbox_command(ha->dr_data, mcp);
--
-- /* Always copy back return mailbox values. */
-- memcpy((void *)ret_mb, (void *)mcp->mb, sizeof(mcp->mb));
--
-- if (rval != QLA_SUCCESS) {
-- /* Empty. */
-- DEBUG2_3_11(printk(
-- "qim_loopback_test(%ld): mailbox command FAILED=%x.\n",
-- ha->host_no, mcp->mb[0]);)
-- } else {
-- /* Empty. */
-- DEBUG11(printk(
-- "qim_loopback_test(%ld): done.\n", ha->host_no);)
-- }
--
-- return rval;
--}
--
--int
--qim_echo_test(struct qla_host_ioctl *ha, INT_LOOPBACK_REQ *req,
-- uint16_t *ret_mb)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- memset(mcp->mb, 0 , sizeof(mcp->mb));
--
-- mcp->mb[0] = MBC_DIAGNOSTIC_ECHO;
-- mcp->mb[1] = BIT_6; /* use 64bit DMA addr */
-- mcp->mb[10] = req->TransferCount;
-- mcp->mb[14] = LSW(ha->ioctl_mem_phys); /* send data address */
-- mcp->mb[15] = MSW(ha->ioctl_mem_phys);
-- mcp->mb[20] = LSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[21] = MSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[16] = LSW(ha->ioctl_mem_phys); /* rcv data address */
-- mcp->mb[17] = MSW(ha->ioctl_mem_phys);
-- mcp->mb[6] = LSW(MSD(ha->ioctl_mem_phys));
-- mcp->mb[7] = MSW(MSD(ha->ioctl_mem_phys));
-- mcp->out_mb = MBX_21|MBX_20|MBX_17|MBX_16|MBX_15|MBX_14|MBX_10|
-- MBX_7|MBX_6|MBX_1|MBX_0;
-- mcp->in_mb = MBX_1|MBX_0;
-- mcp->buf_size = req->TransferCount;
-- mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
-- mcp->tov = 30;
-- rval = qim_mailbox_command(ha->dr_data, mcp);
--
-- /* Always copy back return mailbox values. */
-- memcpy((void *)ret_mb, (void *)mcp->mb, sizeof(mcp->mb));
--
-- if (rval != QLA_SUCCESS) {
-- /* Empty. */
-- DEBUG2_3_11(printk(
-- "%s(%ld): mailbox command FAILED=%x/%x.\n", __func__,
-- ha->host_no, mcp->mb[0], mcp->mb[1]);)
-- } else {
-- /* Empty. */
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-- }
--
-- return rval;
--}
--
--/*
-- * qim_set_rnid_params_mbx
-- * Set RNID parameters using mailbox command
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * buffer = buffer pointer.
-- * buf_size = size of buffer.
-- * mb_reg = pointer to return mailbox registers.
-- *
-- * Returns:
-- * qla2x00 local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_set_rnid_params_mbx(scsi_qla_host_t *ha, dma_addr_t buf_phys_addr,
-- size_t buf_size, uint16_t *mb_reg)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- DEBUG11(printk("qim_set_rnid_params_mbx(%ld): entered.\n",
-- ha->host_no);)
--
-- mcp->mb[0] = MBC_SET_RNID_PARAMS;
-- mcp->mb[1] = 0;
-- mcp->mb[2] = MSW(buf_phys_addr);
-- mcp->mb[3] = LSW(buf_phys_addr);
-- mcp->mb[6] = MSW(MSD(buf_phys_addr));
-- mcp->mb[7] = LSW(MSD(buf_phys_addr));
-- mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-- mcp->in_mb = MBX_1|MBX_0;
-- mcp->buf_size = buf_size;
-- mcp->flags = MBX_DMA_OUT;
-- mcp->tov = 30;
-- rval = qim_mailbox_command(ha, mcp);
--
-- if (rval != QLA_SUCCESS) {
-- memcpy(mb_reg, mcp->mb, 2 * 2); /* 2 status regs */
--
-- DEBUG2_3_11(printk("qim_set_rnid_params_mbx(%ld): "
-- "failed=%x mb[1]=%x.\n", ha->host_no, mcp->mb[0],
-- mcp->mb[1]);)
-- } else {
-- /*EMPTY*/
-- DEBUG11(printk("qim_set_rnid_params_mbx(%ld): done.\n",
-- ha->host_no);)
-- }
--
-- return (rval);
--}
--
--/*
-- * qim_get_rnid_params_mbx
-- * Get RNID parameters using mailbox command
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * buffer = buffer pointer.
-- * buf_size = size of buffer.
-- * mb_reg = pointer to return mailbox registers.
-- *
-- * Returns:
-- * qla2x00 local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_get_rnid_params_mbx(scsi_qla_host_t *ha, dma_addr_t buf_phys_addr,
-- size_t buf_size, uint16_t *mb_reg)
--{
-- int rval;
-- mbx_cmd_t mc;
-- mbx_cmd_t *mcp = &mc;
--
-- DEBUG11(printk("qim_get_rnid_params_mbx(%ld): entered.\n",
-- ha->host_no);)
--
-- mcp->mb[0] = MBC_GET_RNID_PARAMS;
-- mcp->mb[1] = 0;
-- mcp->mb[2] = MSW(buf_phys_addr);
-- mcp->mb[3] = LSW(buf_phys_addr);
-- mcp->mb[6] = MSW(MSD(buf_phys_addr));
-- mcp->mb[7] = LSW(MSD(buf_phys_addr));
-- mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-- mcp->in_mb = MBX_1|MBX_0;
-- mcp->buf_size = buf_size;
-- mcp->flags = MBX_DMA_IN;
-- mcp->tov = 30;
-- rval = qim_mailbox_command(ha, mcp);
--
-- if (rval != QLA_SUCCESS) {
-- memcpy(mb_reg, mcp->mb, 2 * 2); /* 2 status regs */
--
-- DEBUG2_3_11(printk("qim_get_rnid_params_mbx(%ld): "
-- "failed=%x mb[1]=%x.\n", ha->host_no, mcp->mb[0],
-- mcp->mb[1]);)
-- } else {
-- /*EMPTY*/
-- DEBUG11(printk("qim_get_rnid_params_mbx(%ld): done.\n",
-- ha->host_no);)
-- }
--
-- return (rval);
--}
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_mbx.h ./drivers/scsi/qla2xxx/qim_mbx.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_mbx.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_mbx.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,28 +0,0 @@
--#ifndef __QIM_MBX_H__
--#define __QIM_MBX_H__
--
--/* mailbox commands */
--extern uint8_t
--qim_get_link_status(struct qla_host_ioctl *, uint16_t,
-- uint16_t, link_stat_t *, uint16_t *);
--extern uint8_t
--qim_get_isp_stats(struct qla_host_ioctl *, uint32_t *,
-- uint32_t, uint16_t, uint16_t *);
--extern int
--qim_login_fabric(scsi_qla_host_t *, uint16_t, uint8_t,
-- uint8_t, uint8_t, uint16_t *, uint8_t);
--extern int
--qim_loopback_test(struct qla_host_ioctl *, INT_LOOPBACK_REQ *,
-- uint16_t *);
--extern int
--qim_echo_test(struct qla_host_ioctl *, INT_LOOPBACK_REQ *,
-- uint16_t *);
--extern int
--qim_get_rnid_params_mbx(scsi_qla_host_t *, dma_addr_t, size_t, uint16_t *);
--extern int
--qim_set_rnid_params_mbx(scsi_qla_host_t *, dma_addr_t, size_t, uint16_t *);
--
--
--#endif /* ifndef __QIM_MBX_H__ */
--
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_os.c ./drivers/scsi/qla2xxx/qim_os.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_os.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_os.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,540 +0,0 @@
--#include "qim_def.h"
--#include "qim_sup.h"
--#include <linux/delay.h>
--#include <linux/version.h>
--
--#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
--#include "qim_32ioctl.h"
--#endif
--
--
--/* Restrict compilation to 2.6.0 or greater */
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
--#error "This module does not support kernel versions earlier than 2.6.0"
--#endif
--
--#define QAPIMOD_VERSION_STR "v1.0.01"
--#define QAPIMOD_VER_MAJOR 0
--#define QAPIMOD_VER_MINOR 0
--#define QAPIMOD_VER_PATCH 1
--#define QAPIMOD_VER_BETA 2
--
--LIST_HEAD(qim_haioctl_list);
--rwlock_t qim_haioctl_list_lock = RW_LOCK_UNLOCKED;
--atomic_t qim_open_cnt = ATOMIC_INIT(0);
--
--
--struct list_head **qim_hostlist_ptr = NULL;
--rwlock_t **qim_hostlist_lock_ptr = NULL;
--
--extern struct list_head *qla2xxx_hostlist_ptr;
--extern rwlock_t *qla2xxx_hostlist_lock_ptr;
--
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
--static struct class *qim_class;
--#else
--static struct class_simple *qim_class;
--#endif
--static int qim_major;
--
--/* extern functions */
--extern int
--qim_send_ioctl(struct scsi_device *, int, void *);
--
--extern int
--qim_alloc_ioctl_mem(struct qla_host_ioctl *);
--extern void
--qim_free_ioctl_mem(struct qla_host_ioctl *);
--
--extern void
--qim_fo_init_params(void);
--
--
--/* This function is called when a new ha is first discovered. */
--static void
--qim_init_drvr_data(struct scsi_qla_host *drvr_ha,
-- struct qla_host_ioctl *host_ioctl, uint8_t *ptmp_mem)
--{
-- int status;
-- uint32_t cnt;
-- unsigned long flags;
-- device_reg_t __iomem *reg = drvr_ha->iobase;
--
--
-- host_ioctl->host_no = drvr_ha->host_no;
-- host_ioctl->instance = drvr_ha->instance;
-- memcpy(host_ioctl->node_name, drvr_ha->node_name, WWN_SIZE);
-- memcpy(host_ioctl->port_name, drvr_ha->port_name, WWN_SIZE);
-- host_ioctl->dr_data = drvr_ha;
--
-- /* temp code: assign max value for now. */
-- strcpy(host_ioctl->drv_ver_str, drvr_ha->driver_verstr);
-- host_ioctl->drv_major = drvr_ha->driver_version[0];
-- host_ioctl->drv_minor = drvr_ha->driver_version[1];
-- host_ioctl->drv_patch = drvr_ha->driver_version[2];
-- host_ioctl->drv_beta = drvr_ha->driver_version[3];
--
-- DEBUG9(printk("%s(%ld): going to read flash version.\n",
-- __func__, drvr_ha->host_no);)
--
-- /* Get PCI expansion ROM image information. */
-- qim_suspend_all_target(drvr_ha);
--
-- /* wait for big hammer to complete if it fails */
-- status = qim_cmd_wait(drvr_ha);
--
-- if (status)
-- return;
--
-- /* Dont process mailbox cmd until flash operation is done */
-- set_bit(MBX_UPDATE_FLASH_ACTIVE, &drvr_ha->mbx_cmd_flags);
--
-- qim_disable_intrs(drvr_ha);
--
-- /* Pause RISC. */
-- if (!IS_QLA24XX(drvr_ha) && !IS_QLA54XX(drvr_ha)) {
-- spin_lock_irqsave(&drvr_ha->hardware_lock, flags);
-- WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-- RD_REG_WORD(&reg->hccr);
-- if (IS_QLA2100(drvr_ha) || IS_QLA2200(drvr_ha) ||
-- IS_QLA2300(drvr_ha)) {
-- for (cnt = 0; cnt < 30000; cnt++) {
-- if ((RD_REG_WORD(&reg->hccr) &
-- HCCR_RISC_PAUSE) != 0)
-- break;
-- udelay(100);
-- }
-- } else {
-- udelay(10);
-- }
-- spin_unlock_irqrestore(&drvr_ha->hardware_lock, flags);
-- }
--
-- qim_get_flash_version(host_ioctl, ptmp_mem);
--
-- /* Schedule DPC to restart the RISC */
-- if (!IS_QLA24XX(drvr_ha) && !IS_QLA54XX(drvr_ha)) {
-- set_bit(ISP_ABORT_NEEDED, &drvr_ha->dpc_flags);
-- up(drvr_ha->dpc_wait);
-- qim_wait_for_hba_online(drvr_ha);
-- } else {
-- qim_enable_intrs(drvr_ha);
-- }
--
-- clear_bit(MBX_UPDATE_FLASH_ACTIVE, &drvr_ha->mbx_cmd_flags);
--
-- qim_unsuspend_all_target(drvr_ha);
--
-- DEBUG9(printk("%s(%ld): exiting.\n",
-- __func__, drvr_ha->host_no);)
--
--}
--
--static int
--qim_rescan_hostlist(void)
--{
-- int ret = 0;
-- uint8_t found;
-- uint8_t *ptmp_mem;
-- struct list_head *hal;
-- struct list_head *ioctll;
-- struct qla_host_ioctl *tmp_haioctl;
-- struct scsi_qla_host *drvr_ha;
--
--
-- read_lock(*qim_hostlist_lock_ptr);
-- DEBUG9(printk("qim_rescan_hostlist: got hostlist lock.\n");)
--
-- /* allocate some memory for use. */
-- if ((ptmp_mem = vmalloc(sizeof(request_t))) == NULL) {
-- /* memory error */
-- return (-ENOMEM);
-- }
--
-- /* Allocate our host_ioctl list */
-- write_lock(&qim_haioctl_list_lock);
-- list_for_each(hal, *qim_hostlist_ptr) {
-- drvr_ha = list_entry(hal, struct scsi_qla_host, list);
-- found = FALSE;
-- list_for_each(ioctll, &qim_haioctl_list) {
-- tmp_haioctl = list_entry(ioctll, struct qla_host_ioctl,
-- list);
-- if (tmp_haioctl->host_no == drvr_ha->host_no) {
-- if (tmp_haioctl->instance ==
-- drvr_ha->instance &&
-- memcmp(tmp_haioctl->port_name,
-- drvr_ha->port_name, WWN_SIZE) == 0) {
-- /* found match */
-- found = TRUE;
-- } else {
-- /* something changed? remove this one */
-- list_del(&tmp_haioctl->list);
-- vfree(tmp_haioctl);
-- }
--
-- break;
-- }
-- }
--
-- if (!found) {
-- /* this is a new ha not found on our list. */
-- if ((tmp_haioctl = vmalloc(sizeof(struct
-- qla_host_ioctl)))) {
-- memset(tmp_haioctl, 0,
-- sizeof(struct qla_host_ioctl));
-- memset(ptmp_mem, 0, sizeof(request_t));
--
-- list_add_tail(&tmp_haioctl->list,
-- &qim_haioctl_list);
-- qim_init_drvr_data(drvr_ha, tmp_haioctl,
-- ptmp_mem);
-- } else {
-- /* memory error */
-- ret = -ENOMEM;
-- break;
-- }
-- }
-- }
-- write_unlock(&qim_haioctl_list_lock);
--
-- DEBUG9(printk("qim_rescan_hostlist: going to unlock.\n");)
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- vfree(ptmp_mem);
--
-- return (ret);
--}
--
--static int
--qim_open(struct inode *inode, struct file *fp)
--{
--
-- DEBUG9(printk("qim_open - entered.\n");)
--
-- if (atomic_read(&qim_open_cnt) == 0) {
-- /* first open. initialize some stuff. */
--
-- /*
-- DEBUG9(printk("qla_apimod: qim_open_cnt=%d.\n",
-- qim_open_cnt);)
-- */
--
-- qim_hostlist_lock_ptr =
-- (rwlock_t **) symbol_get(qla2xxx_hostlist_lock_ptr);
--
-- if (qim_hostlist_lock_ptr == NULL) {
-- DEBUG9(printk("qim_open: qla2xxx driver not "
-- "loaded.\n");)
-- return -ENODEV;
-- }
--
-- DEBUG9(printk("qim_open: got hostlist lock pointer %p, %p.\n",
-- qim_hostlist_lock_ptr, *qim_hostlist_lock_ptr);)
--
-- qim_hostlist_ptr =
-- (struct list_head **) symbol_get(qla2xxx_hostlist_ptr);
--
-- if (*qim_hostlist_ptr == NULL) {
-- DEBUG9(printk("qim_open: qla2xxx driver not "
-- "loaded.\n");)
-- return -ENODEV;
-- }
-- atomic_inc(&qim_open_cnt);
--
-- } else {
-- /*
-- DEBUG9(printk(
-- "qim_open: not first open. qim_open_cnt=%d.\n",
-- qim_open_cnt);)
-- */
-- }
--
-- if (qim_rescan_hostlist() != 0) {
-- DEBUG9(printk("qim_open: memory error.\n");)
-- return -ENOMEM;
-- }
--
-- DEBUG9(printk("qim_open: got hostlist pointer %p.\n",
-- qim_hostlist_ptr);)
--
-- return 0;
--}
--
--static int
--qim_release(struct inode *inode, struct file *fp)
--{
-- DEBUG9(printk("qla_apimod: qim_release - entered.\n");)
--
-- if (atomic_dec_and_test(&qim_open_cnt)) {
-- /* last close. clean up */
-- /*
-- DEBUG9(printk("qla_apimod: last close. qim_open_cnt=%d.\n",
-- qim_open_cnt);)
-- */
-- symbol_put(qla2xxx_hostlist_ptr);
-- symbol_put(qla2xxx_hostlist_lock_ptr);
-- } else {
-- /*
-- DEBUG9(printk("qla_apimod: not last close. qim_open_cnt=%d.\n",
-- qim_open_cnt);)
-- */
-- }
--
-- return 0;
--}
--
--static int
--qim_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
-- unsigned long arg)
--{
-- DEBUG9(printk("qim_ioctl - got cmd %x arg %lx.\n",
-- cmd, arg);)
-- return (qim_send_ioctl(NULL, (int)cmd, (void*)arg));
--}
--
--static struct file_operations qim_fops = {
-- .owner = THIS_MODULE,
-- .open = qim_open,
-- .release = qim_release,
-- .ioctl = qim_ioctl,
--};
--
--int
--qim_ioctl_initialize(void)
--{
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
-- qim_class = class_create(THIS_MODULE, "qla2xxx");
--#else
-- qim_class = class_simple_create(THIS_MODULE, "qla2xxx");
--#endif
-- if (IS_ERR(qim_class)) {
-- DEBUG9(printk("%s(): Unable to sysfs class for qla2xxx.\n",
-- __func__);)
--
-- qim_class = NULL;
-- return 1;
--
-- }
--
-- DEBUG9(printk("%s(): done class_create.\n", __func__);)
--
-- qim_major = register_chrdev(0, "qla2xxx", &qim_fops);
-- if (qim_major < 0) {
-- DEBUG9(printk("%s(): Unable to register CHAR device (%d)\n",
-- __func__, qim_major);)
--
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
-- class_destroy(qim_class);
--#else
-- class_simple_destroy(qim_class);
--#endif
-- qim_class = NULL;
--
-- return qim_major;
-- }
--
-- DEBUG9(printk("%s(): done register_chrdev.\n", __func__);)
--
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
-- class_device_create(qim_class, MKDEV(qim_major, 0), NULL,
-- "qla2xxx");
--#else
-- class_simple_device_add(qim_class, MKDEV(qim_major, 0), NULL,
-- "qla2xxx");
--#endif
--
--#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-- apidev_init_32ioctl_reg();
--#endif
--
-- DEBUG9(printk("qim_ioctl_init: exiting.\n");)
--
-- return 0;
--}
--
--int
--qim_ioctl_release(void)
--{
-- if (!qim_class)
-- return 1;
--
--#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-- apidev_cleanup_32ioctl_unreg();
--#endif
--
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
-- class_device_destroy(qim_class, MKDEV(qim_major, 0));
--#else
-- class_simple_device_remove(MKDEV(qim_major, 0));
--#endif
--
-- unregister_chrdev(qim_major, "qla2xxx");
--
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
-- class_destroy(qim_class);
--#else
-- class_simple_destroy(qim_class);
--#endif
--
-- qim_class = NULL;
--
-- return 0;
--}
--
--static void
--qim_ioctl_init(void)
--{
-- struct list_head *hal;
-- struct qla_host_ioctl *tmp_ha_ioctl;
--
-- DEBUG9(printk("qim_ioctl_init: entered.\n");)
-- qim_ioctl_initialize();
--
-- list_for_each(hal, &qim_haioctl_list) {
-- tmp_ha_ioctl = list_entry(hal, struct qla_host_ioctl, list);
-- qim_alloc_ioctl_mem(tmp_ha_ioctl);
-- }
--
-- DEBUG9(printk("qim_ioctl_init: exiting.\n");)
--}
--
--static void
--qim_ioctl_exit(void)
--{
-- struct list_head *hal;
-- struct qla_host_ioctl *tmp_ha_ioctl;
--
-- DEBUG9(printk("qim_ioctl_exit: entered.\n");)
-- list_for_each(hal, &qim_haioctl_list) {
-- tmp_ha_ioctl = list_entry(hal, struct qla_host_ioctl, list);
-- qim_free_ioctl_mem(tmp_ha_ioctl);
-- }
--
-- qim_ioctl_release();
-- DEBUG9(printk("qim_ioctl_exit: exiting.\n");)
--
--}
--
--static int
--qim_init(void)
--{
-- uint8_t *ptmp_mem;
-- struct list_head *hal = NULL;
-- struct qla_host_ioctl *tmp_haioctl = NULL;
-- struct scsi_qla_host *drvr_ha;
--
--
-- DEBUG9(printk("qim_init: entered.\n");)
--
-- qim_hostlist_lock_ptr =
-- (rwlock_t **) symbol_get(qla2xxx_hostlist_lock_ptr);
--
-- if (qim_hostlist_lock_ptr == NULL) {
-- DEBUG9(printk("apimod: qla2xxx driver not loaded.");)
-- return -ENODEV;
-- }
--
-- DEBUG9(printk("qim_init: got hostlist lock pointer %p, %p.\n",
-- qim_hostlist_lock_ptr, *qim_hostlist_lock_ptr);)
--
-- read_lock(*qim_hostlist_lock_ptr);
-- DEBUG9(printk("qim_init: got hostlist lock.\n");)
--
-- qim_hostlist_ptr =
-- (struct list_head **) symbol_get(qla2xxx_hostlist_ptr);
--
-- if (*qim_hostlist_ptr == NULL) {
-- read_unlock(*qim_hostlist_lock_ptr);
-- DEBUG9_10(printk("apimod: qla2xxx driver not loaded.");)
-- return -ENODEV;
-- }
--
-- DEBUG9(printk("qim_init: got hostlist pointer %p, %p.\n",
-- qim_hostlist_ptr, *qim_hostlist_ptr);)
--
-- /* allocate some memory for use. */
-- if ((ptmp_mem = vmalloc(sizeof(request_t))) == NULL) {
-- /* memory error */
-- return (-ENOMEM);
-- }
--
-- /* Allocate our host_ioctl list */
-- write_lock(&qim_haioctl_list_lock);
-- list_for_each(hal, *qim_hostlist_ptr) {
-- drvr_ha = list_entry(hal, struct scsi_qla_host, list);
-- if ((tmp_haioctl = vmalloc(sizeof(struct qla_host_ioctl)))) {
-- DEBUG9(printk("qim_init: got tmp_haioctl=%p.\n",
-- tmp_haioctl);)
-- memset(tmp_haioctl, 0, sizeof(struct qla_host_ioctl));
-- memset(ptmp_mem, 0, sizeof(request_t));
--
-- list_add_tail(&tmp_haioctl->list,
-- &qim_haioctl_list);
-- qim_init_drvr_data(drvr_ha, tmp_haioctl, ptmp_mem);
-- }
-- }
-- write_unlock(&qim_haioctl_list_lock);
-- vfree(ptmp_mem);
--
-- qim_ioctl_init();
-- qim_fo_init_params();
--
-- DEBUG9(printk("qim_init: going to put back hostlist ref.\n");)
--
-- symbol_put(qla2xxx_hostlist_ptr);
--
-- DEBUG9(printk("qim_init: going to unlock.\n");)
--
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- symbol_put(qla2xxx_hostlist_lock_ptr);
--
-- DEBUG9(printk("qim_init: exiting.\n");)
--
-- return 0;
--}
--
--static void __exit
--qim_exit(void)
--{
-- struct list_head *hal = NULL;
-- struct qla_host_ioctl *tmp_haioctl;
--
-- DEBUG9(printk("qim_exit: entered.\n");)
--
-- qim_ioctl_exit();
--
-- DEBUG9(printk("qim_exit: done ioctl_exit.\n");)
--
-- /* remove/free the list */
-- write_lock(&qim_haioctl_list_lock);
-- /* original list_for_each code:
-- for (pos = (head)->next; prefetch(pos->next), pos != (head);
-- pos = pos->next)
-- */
-- for (hal = (&qim_haioctl_list)->next; hal !=
-- (&qim_haioctl_list); ) {
-- DEBUG9(printk("qim_exit: going to get next tmp_haioctl.\n");)
-- tmp_haioctl = list_entry(hal, struct qla_host_ioctl, list);
-- DEBUG9(printk("qim_exit: going to del &tmp_haioctl->list=%p.\n",
-- &tmp_haioctl->list);)
-- hal = hal->next;
-- list_del(&tmp_haioctl->list);
-- DEBUG9(printk("qim_exit: going to free tmp_haioctl=%p.\n",
-- tmp_haioctl);)
-- vfree(tmp_haioctl);
-- DEBUG9(printk("qim_exit: freed tmp_haioctl.\n");)
-- }
-- write_unlock(&qim_haioctl_list_lock);
--
-- DEBUG9(printk("qim_exit: exiting.\n");)
--
--}
--
--module_init(qim_init);
--module_exit(qim_exit);
--
--MODULE_AUTHOR("QLogic Corporation");
--MODULE_DESCRIPTION("QLogic FC Driver ioctl Module");
--MODULE_VERSION(QAPIMOD_VERSION_STR);
--MODULE_LICENSE("GPL");
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_sup.c ./drivers/scsi/qla2xxx/qim_sup.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_sup.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_sup.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,2369 +0,0 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--
--#include "qim_def.h"
--#include <linux/delay.h>
--
--#if 0
--void
--qim24xx_ascii_fw_dump(scsi_qla_host_t *);
--
--static int qla_uprintf(char **, char *, ...);
--#endif
--
--/*
-- * The ISP2312 v2 chip cannot access the FLASH/GPIO registers via MMIO in an
-- * 133Mhz slot.
-- */
--#define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr))
--#define WRT_REG_WORD_PIO(addr, data) (outw(data,(unsigned long)addr))
--
--#define QIM_IS_OEM_001(ha) \
-- ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322 && \
-- (ha)->pdev->subsystem_vendor == 0x1028 && \
-- (ha)->pdev->subsystem_device == 0x0170)
--
--
--inline void
--qim_enable_intrs(scsi_qla_host_t *ha)
--{
-- unsigned long flags = 0;
-- device_reg_t __iomem *reg = ha->iobase;
-- struct device_reg_24xx __iomem *reg24;
--
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- reg24 = (struct device_reg_24xx __iomem *)ha->iobase;
-- WRT_REG_DWORD(&reg24->ictrl, ICRX_EN_RISC_INT);
-- RD_REG_DWORD(&reg24->ictrl);
-- } else {
-- WRT_REG_WORD(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC);
-- RD_REG_WORD(&reg->ictrl);
-- }
-- ha->interrupts_on = 1;
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
--}
--
--inline void
--qim_disable_intrs(scsi_qla_host_t *ha)
--{
-- unsigned long flags = 0;
-- device_reg_t __iomem *reg = ha->iobase;
-- struct device_reg_24xx __iomem *reg24;
--
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- ha->interrupts_on = 0;
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- reg24 = (struct device_reg_24xx __iomem *)ha->iobase;
-- WRT_REG_DWORD(&reg24->ictrl, 0);
-- RD_REG_DWORD(&reg24->ictrl);
--
-- } else {
-- WRT_REG_WORD(&reg->ictrl, 0);
-- RD_REG_WORD(&reg->ictrl);
-- }
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--}
--
--
--static __inline__ uint16_t qim_debounce_register(volatile uint16_t __iomem *);
--/*
-- * qim_debounce_register
-- * Debounce register.
-- *
-- * Input:
-- * port = register address.
-- *
-- * Returns:
-- * register value.
-- */
--static __inline__ uint16_t
--qim_debounce_register(volatile uint16_t __iomem *addr)
--{
-- volatile uint16_t first;
-- volatile uint16_t second;
--
-- do {
-- first = RD_REG_WORD(addr);
-- barrier();
-- cpu_relax();
-- second = RD_REG_WORD(addr);
-- } while (first != second);
--
-- return (first);
--}
--
--static inline uint32_t
--flash_conf_to_access_addr(uint32_t faddr)
--{
-- return FARX_ACCESS_FLASH_CONF | faddr;
--}
--
--static inline uint32_t
--flash_data_to_access_addr(uint32_t faddr)
--{
-- return FARX_ACCESS_FLASH_DATA | faddr;
--}
--
--/* qim_cmd_wait
-- * Stall driver until all outstanding commands are returned.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Return;
-- * 0 -- Done
-- * 1 -- cmds still outstanding
-- *
-- * Context:
-- * This routine must be called without hardware_lock held.
-- */
--int
--qim_cmd_wait(scsi_qla_host_t *ha)
--{
-- int status = 0;
-- int index = 0;
--#if 0
-- int wait_cnt = 30;
--#endif
-- unsigned long cpu_flags;
--
--
-- DEBUG(printk("%s(%ld): entered\n",__func__,ha->host_no));
-- printk("%s(%ld): entered\n",__func__,ha->host_no);
--
--#if 0
-- while (wait_cnt) {
--#endif
-- /* Find a command that hasn't completed. */
-- for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- if (ha->outstanding_cmds[index] != NULL) {
-- spin_unlock_irqrestore(&ha->hardware_lock,
-- cpu_flags);
-- break;
-- }
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-- }
--
-- /* If No Commands are pending return ok */
-- if (index != MAX_OUTSTANDING_COMMANDS)
-- status = 1;
--
--#if 0
-- /* If No Commands are pending wait is complete */
-- if (index == MAX_OUTSTANDING_COMMANDS)
-- break;
--
-- /*
-- * If we timed out on waiting for commands to come back Reset
-- * the ISP
-- */
-- wait_cnt--;
-- if (wait_cnt == 0) {
-- set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-- status = 1;
-- DEBUG(printk("%s(%ld): ISP abort - handle %d\n",
-- __func__, ha->host_no, index));
-- } else {
-- /* sleep a second */
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(HZ);
-- }
-- }
--#endif
--
-- DEBUG(printk("%s(%ld): Done waiting on commands - ind=%d\n",
-- __func__, ha->host_no, index));
-- printk("%s(%ld): exiting - ind=%d, status=%d.\n",
-- __func__, ha->host_no, index, status);
--
-- return status;
--}
--
--static inline uint32_t
--nvram_conf_to_access_addr(uint32_t naddr)
--{
-- return FARX_ACCESS_NVRAM_CONF | naddr;
--}
--
--static inline uint32_t
--nvram_data_to_access_addr(uint32_t naddr)
--{
-- return FARX_ACCESS_NVRAM_DATA | naddr;
--}
--
--static void
--qim_nv_deselect(scsi_qla_host_t *ha)
--{
-- device_reg_t __iomem *reg = ha->iobase;
--
-- WRT_REG_WORD(&reg->nvram, NVR_DESELECT);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
--}
--
--/* XXX(hch): crude hack to emulate a down_timeout() */
--int
--qim_down_timeout(struct semaphore *sema, unsigned long timeout)
--{
-- const unsigned int step = HZ/10;
--
-- do {
-- if (!down_trylock(sema))
-- return 0;
-- set_current_state(TASK_INTERRUPTIBLE);
-- if (schedule_timeout(step))
-- break;
-- } while ((timeout -= step) > 0);
--
-- return -ETIMEDOUT;
--}
--
--uint32_t
--qim24xx_read_flash_dword(scsi_qla_host_t *ha, uint32_t addr)
--{
-- int rval;
-- uint32_t cnt, data;
-- struct device_reg_24xx __iomem *reg =
-- (struct device_reg_24xx __iomem *)ha->iobase;
--
-- WRT_REG_DWORD(&reg->flash_addr, addr & ~FARX_DATA_FLAG);
-- /* Wait for READ cycle to complete. */
-- rval = QLA_SUCCESS;
-- for (cnt = 3000;
-- (RD_REG_DWORD(&reg->flash_addr) & FARX_DATA_FLAG) == 0 &&
-- rval == QLA_SUCCESS; cnt--) {
-- if (cnt)
-- udelay(10);
-- else
--{
--printk("%s: read reg %x timed out. addr=%x.\n",
-- __func__, addr & ~FARX_DATA_FLAG, addr);
-- rval = QLA_FUNCTION_TIMEOUT;
--}
-- }
--
-- /* TODO: What happens if we time out? */
-- data = 0xDEADDEAD;
-- if (rval == QLA_SUCCESS)
-- data = RD_REG_DWORD(&reg->flash_data);
--
-- return data;
--}
--
--int
--qim24xx_write_flash_dword(scsi_qla_host_t *ha, uint32_t addr, uint32_t data)
--{
-- int rval;
-- uint32_t cnt;
-- struct device_reg_24xx __iomem *reg =
-- (struct device_reg_24xx __iomem *)ha->iobase;
--
-- WRT_REG_DWORD(&reg->flash_data, data);
-- RD_REG_DWORD(&reg->flash_data); /* PCI Posting. */
-- WRT_REG_DWORD(&reg->flash_addr, addr | FARX_DATA_FLAG);
-- /* Wait for Write cycle to complete. */
-- rval = QLA_SUCCESS;
-- for (cnt = 500000; (RD_REG_DWORD(&reg->flash_addr) & FARX_DATA_FLAG) &&
-- rval == QLA_SUCCESS; cnt--) {
-- if (cnt)
-- udelay(10);
-- else
-- rval = QLA_FUNCTION_TIMEOUT;
-- }
-- return rval;
--}
--
--/**
-- * qim_nv_write() - Prepare for NVRAM read/write operation.
-- * @ha: HA context
-- * @data: Serial interface selector
-- */
--static void
--qim_nv_write(scsi_qla_host_t *ha, uint16_t data)
--{
-- device_reg_t __iomem *reg = ha->iobase;
--
-- WRT_REG_WORD(&reg->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
-- WRT_REG_WORD(&reg->nvram, data | NVR_SELECT| NVR_CLOCK |
-- NVR_WRT_ENABLE);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
-- WRT_REG_WORD(&reg->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
--}
--
--/**
-- * qim_nvram_request() - Sends read command to NVRAM and gets data from
-- * NVRAM.
-- * @ha: HA context
-- * @nv_cmd: NVRAM command
-- *
-- * Bit definitions for NVRAM command:
-- *
-- * Bit 26 = start bit
-- * Bit 25, 24 = opcode
-- * Bit 23-16 = address
-- * Bit 15-0 = write data
-- *
-- * Returns the word read from nvram @addr.
-- */
--static uint16_t
--qim_nvram_request(scsi_qla_host_t *ha, uint32_t nv_cmd)
--{
-- uint8_t cnt;
-- device_reg_t __iomem *reg = ha->iobase;
-- uint16_t data = 0;
-- uint16_t reg_data;
--
-- /* Send command to NVRAM. */
-- nv_cmd <<= 5;
-- for (cnt = 0; cnt < 11; cnt++) {
-- if (nv_cmd & BIT_31)
-- qim_nv_write(ha, NVR_DATA_OUT);
-- else
-- qim_nv_write(ha, 0);
--
-- nv_cmd <<= 1;
-- }
--
-- /* Read data from NVRAM. */
-- for (cnt = 0; cnt < 16; cnt++) {
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT | NVR_CLOCK);
-- NVRAM_DELAY();
-- data <<= 1;
-- reg_data = RD_REG_WORD(&reg->nvram);
-- if (reg_data & NVR_DATA_IN)
-- data |= BIT_0;
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
-- }
--
-- /* Deselect chip. */
-- WRT_REG_WORD(&reg->nvram, NVR_DESELECT);
-- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-- NVRAM_DELAY();
--
-- return (data);
--}
--
--/**
-- * qim_get_nvram_word() - Calculates word position in NVRAM and calls the
-- * request routine to get the word from NVRAM.
-- * @ha: HA context
-- * @addr: Address in NVRAM to read
-- *
-- * Returns the word read from nvram @addr.
-- */
--uint16_t
--qim_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr)
--{
-- uint16_t data;
-- uint32_t nv_cmd;
--
-- nv_cmd = addr << 16;
-- nv_cmd |= NV_READ_OP;
-- data = qim_nvram_request(ha, nv_cmd);
--
-- return (data);
--}
--
--/**
-- * qim_lock_nvram_access() -
-- * @ha: HA context
-- */
--void
--qim_lock_nvram_access(scsi_qla_host_t *ha)
--{
-- uint16_t data;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
-- data = RD_REG_WORD(&reg->nvram);
-- while (data & NVR_BUSY) {
-- udelay(100);
-- data = RD_REG_WORD(&reg->nvram);
-- }
--
-- /* Lock resource */
-- WRT_REG_WORD(&reg->u.isp2300.host_semaphore, 0x1);
-- RD_REG_WORD(&reg->u.isp2300.host_semaphore);
-- udelay(5);
-- data = RD_REG_WORD(&reg->u.isp2300.host_semaphore);
-- while ((data & BIT_0) == 0) {
-- /* Lock failed */
-- udelay(100);
-- WRT_REG_WORD(&reg->u.isp2300.host_semaphore, 0x1);
-- RD_REG_WORD(&reg->u.isp2300.host_semaphore);
-- udelay(5);
-- data = RD_REG_WORD(&reg->u.isp2300.host_semaphore);
-- }
-- }
--}
--
--/**
-- * qim_unlock_nvram_access() -
-- * @ha: HA context
-- */
--void
--qim_unlock_nvram_access(scsi_qla_host_t *ha)
--{
-- device_reg_t __iomem *reg = ha->iobase;
--
-- if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
-- WRT_REG_WORD(&reg->u.isp2300.host_semaphore, 0);
-- RD_REG_WORD(&reg->u.isp2300.host_semaphore);
-- }
--}
--
--static int
--qim_write_nvram_word_tmo(scsi_qla_host_t *ha, uint32_t addr, uint16_t data,
-- uint32_t tmo)
--{
-- int ret, count;
-- uint16_t word;
-- uint32_t nv_cmd;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- ret = QLA_SUCCESS;
--
-- qim_nv_write(ha, NVR_DATA_OUT);
-- qim_nv_write(ha, 0);
-- qim_nv_write(ha, 0);
--
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT);
--
-- qim_nv_deselect(ha);
--
-- /* Write data */
-- nv_cmd = (addr << 16) | NV_WRITE_OP;
-- nv_cmd |= data;
-- nv_cmd <<= 5;
-- for (count = 0; count < 27; count++) {
-- if (nv_cmd & BIT_31)
-- qim_nv_write(ha, NVR_DATA_OUT);
-- else
-- qim_nv_write(ha, 0);
--
-- nv_cmd <<= 1;
-- }
--
-- qim_nv_deselect(ha);
--
-- /* Wait for NVRAM to become ready */
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- do {
-- NVRAM_DELAY();
-- word = RD_REG_WORD(&reg->nvram);
-- if (!--tmo) {
-- ret = QLA_FUNCTION_FAILED;
-- break;
-- }
-- } while ((word & NVR_DATA_IN) == 0);
--
-- qim_nv_deselect(ha);
--
-- /* Disable writes */
-- qim_nv_write(ha, NVR_DATA_OUT);
-- for (count = 0; count < 10; count++)
-- qim_nv_write(ha, 0);
--
-- qim_nv_deselect(ha);
--
-- return ret;
--}
--
--/**
-- * qim_write_nvram_word() - Write NVRAM data.
-- * @ha: HA context
-- * @addr: Address in NVRAM to write
-- * @data: word to program
-- */
--void
--qim_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data)
--{
-- int count;
-- uint16_t word;
-- uint32_t nv_cmd;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- qim_nv_write(ha, NVR_DATA_OUT);
-- qim_nv_write(ha, 0);
-- qim_nv_write(ha, 0);
--
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT);
--
-- qim_nv_deselect(ha);
--
-- /* Write data */
-- nv_cmd = (addr << 16) | NV_WRITE_OP;
-- nv_cmd |= data;
-- nv_cmd <<= 5;
-- for (count = 0; count < 27; count++) {
-- if (nv_cmd & BIT_31)
-- qim_nv_write(ha, NVR_DATA_OUT);
-- else
-- qim_nv_write(ha, 0);
--
-- nv_cmd <<= 1;
-- }
--
-- qim_nv_deselect(ha);
--
-- /* Wait for NVRAM to become ready */
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- do {
-- NVRAM_DELAY();
-- word = RD_REG_WORD(&reg->nvram);
-- } while ((word & NVR_DATA_IN) == 0);
--
-- qim_nv_deselect(ha);
--
-- /* Disable writes */
-- qim_nv_write(ha, NVR_DATA_OUT);
-- for (count = 0; count < 10; count++)
-- qim_nv_write(ha, 0);
--
-- qim_nv_deselect(ha);
--}
--
--/**
-- * qim_clear_nvram_protection() -
-- * @ha: HA context
-- */
--static int
--qim_clear_nvram_protection(scsi_qla_host_t *ha)
--{
-- int ret, stat;
-- device_reg_t __iomem *reg;
-- uint32_t word;
-- uint16_t wprot, wprot_old;
--
-- reg = ha->iobase;
--
-- /* Clear NVRAM write protection. */
-- ret = QLA_FUNCTION_FAILED;
-- wprot_old = cpu_to_le16(qim_get_nvram_word(ha, 0));
-- stat = qim_write_nvram_word_tmo(ha, 0,
-- __constant_cpu_to_le16(0x1234), 100000);
-- wprot = cpu_to_le16(qim_get_nvram_word(ha, 0));
-- if (stat != QLA_SUCCESS || wprot != __constant_cpu_to_le16(0x1234)) {
-- /* Write enable. */
-- qim_nv_write(ha, NVR_DATA_OUT);
-- qim_nv_write(ha, 0);
-- qim_nv_write(ha, 0);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT);
--
-- qim_nv_deselect(ha);
--
-- /* Enable protection register. */
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- qim_nv_write(ha, NVR_PR_ENABLE);
-- qim_nv_write(ha, NVR_PR_ENABLE);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE);
--
-- qim_nv_deselect(ha);
--
-- /* Clear protection register (ffff is cleared). */
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE);
--
-- qim_nv_deselect(ha);
--
-- /* Wait for NVRAM to become ready. */
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- do {
-- NVRAM_DELAY();
-- word = RD_REG_WORD(&reg->nvram);
-- } while ((word & NVR_DATA_IN) == 0);
--
-- ret = QLA_SUCCESS;
-- } else
-- qim_write_nvram_word(ha, 0, wprot_old);
--
-- return ret;
--}
--
--static void
--qim_set_nvram_protection(scsi_qla_host_t *ha, int stat)
--{
-- device_reg_t __iomem *reg;
-- uint32_t word;
-- reg = ha->iobase;
--
-- if (stat != QLA_SUCCESS)
-- return;
--
-- /* Set NVRAM write protection. */
-- /* Write enable. */
-- qim_nv_write(ha, NVR_DATA_OUT);
-- qim_nv_write(ha, 0);
-- qim_nv_write(ha, 0);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT);
--
-- qim_nv_deselect(ha);
--
-- /* Enable protection register. */
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- qim_nv_write(ha, NVR_PR_ENABLE);
-- qim_nv_write(ha, NVR_PR_ENABLE);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE);
--
-- qim_nv_deselect(ha);
--
-- /* Enable protection register. */
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- qim_nv_write(ha, NVR_PR_ENABLE);
-- qim_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT);
-- for (word = 0; word < 8; word++)
-- qim_nv_write(ha, NVR_PR_ENABLE);
--
-- qim_nv_deselect(ha);
--
-- /* Wait for NVRAM to become ready. */
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- do {
-- NVRAM_DELAY();
-- word = RD_REG_WORD(&reg->nvram);
-- } while ((word & NVR_DATA_IN) == 0);
--}
--
--uint8_t *
--qim_read_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr,
-- uint32_t bytes)
--{
-- uint32_t i;
-- uint16_t *wptr;
-- uint32_t *dwptr;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- /* Dword reads to flash. */
-- dwptr = (uint32_t *)buf;
-- for (i = 0; i < bytes >> 2; i++, naddr++)
-- dwptr[i] = cpu_to_le32(qim24xx_read_flash_dword(ha,
-- nvram_data_to_access_addr(naddr)));
-- } else {
-- /* Word reads to NVRAM via registers. */
-- wptr = (uint16_t *)buf;
-- qim_lock_nvram_access(ha);
-- for (i = 0; i < bytes >> 1; i++, naddr++)
-- wptr[i] = cpu_to_le16(qim_get_nvram_word(ha,
-- naddr));
-- qim_unlock_nvram_access(ha);
-- }
-- return buf;
--}
--
--int
--qim_write_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr,
-- uint32_t bytes)
--{
-- int ret;
-- uint32_t i;
-- uint16_t *wptr;
-- uint32_t *dwptr;
-- struct device_reg_24xx __iomem *reg =
-- (struct device_reg_24xx __iomem *)ha->iobase;
--
-- ret = QLA_SUCCESS;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- /* Enable flash write. */
-- WRT_REG_DWORD(&reg->ctrl_status,
-- RD_REG_DWORD(&reg->ctrl_status) | CSRX_FLASH_ENABLE);
-- RD_REG_DWORD(&reg->ctrl_status); /* PCI Posting. */
--
-- /* Disable NVRAM write-protection. */
-- qim24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101),
-- 0);
-- qim24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101),
-- 0);
--
-- /* Dword writes to flash. */
-- dwptr = (uint32_t *)buf;
-- for (i = 0; i < bytes >> 2; i++, naddr++, dwptr++) {
-- ret = qim24xx_write_flash_dword(ha,
-- nvram_data_to_access_addr(naddr),
-- cpu_to_le32(*dwptr));
-- if (ret != QLA_SUCCESS) {
-- DEBUG9(printk("%s(%ld) Unable to program "
-- "nvram address=%x data=%x.\n", __func__,
-- ha->host_no, naddr, *dwptr));
-- break;
-- }
-- }
--
-- /* Enable NVRAM write-protection. */
-- qim24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101),
-- 0x8c);
--
-- /* Disable flash write. */
-- WRT_REG_DWORD(&reg->ctrl_status,
-- RD_REG_DWORD(&reg->ctrl_status) & ~CSRX_FLASH_ENABLE);
-- RD_REG_DWORD(&reg->ctrl_status); /* PCI Posting. */
-- } else {
-- int stat;
--
-- qim_lock_nvram_access(ha);
--
-- /* Disable NVRAM write-protection. */
-- stat = qim_clear_nvram_protection(ha);
--
-- wptr = (uint16_t *)buf;
-- for (i = 0; i < bytes >> 1; i++, naddr++) {
-- qim_write_nvram_word(ha, naddr,
-- cpu_to_le16(*wptr));
-- wptr++;
-- }
--
-- /* Enable NVRAM write-protection. */
-- qim_set_nvram_protection(ha, stat);
--
-- qim_unlock_nvram_access(ha);
-- }
--
-- return ret;
--}
--
--/*
-- * qim_wait_for_hba_online
-- * Wait till the HBA is online after going through
-- * <= MAX_RETRIES_OF_ISP_ABORT or
-- * finally HBA is disabled ie marked offline
-- *
-- * Input:
-- * ha - pointer to host adapter structure
-- *
-- * Note:
-- * Does context switching-Release SPIN_LOCK
-- * (if any) before calling this routine.
-- *
-- * Return:
-- * Success (Adapter is online) : 0
-- * Failed (Adapter is offline/disabled) : 1
-- */
--int
--qim_wait_for_hba_online(scsi_qla_host_t *ha)
--{
-- int return_status;
-- unsigned long wait_online;
--
-- wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ);
-- while (((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) ||
-- test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-- test_bit(ISP_ABORT_RETRY, &ha->dpc_flags) ||
-- ha->dpc_active) && time_before(jiffies, wait_online)) {
--
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(HZ);
-- }
-- if (ha->flags.online)
-- return_status = QLA_SUCCESS;
-- else
-- return_status = QLA_FUNCTION_FAILED;
--
-- DEBUG2(printk("%s return_status=%d\n",__func__,return_status));
--
-- return (return_status);
--}
--
--/**
-- * qim_flash_enable() - Setup flash for reading and writing.
-- * @ha: HA context
-- */
--void
--qim_flash_enable(scsi_qla_host_t *ha)
--{
-- uint16_t data;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- data = RD_REG_WORD(&reg->ctrl_status);
-- data |= CSR_FLASH_ENABLE;
-- WRT_REG_WORD(&reg->ctrl_status, data);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--}
--
--/**
-- * qim_flash_disable() - Disable flash and allow RISC to run.
-- * @ha: HA context
-- */
--void
--qim_flash_disable(scsi_qla_host_t *ha)
--{
-- uint16_t data;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- data = RD_REG_WORD(&reg->ctrl_status);
-- data &= ~(CSR_FLASH_ENABLE);
-- WRT_REG_WORD(&reg->ctrl_status, data);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--}
--
--/**
-- * qim_read_flash_byte() - Reads a byte from flash
-- * @ha: HA context
-- * @addr: Address in flash to read
-- *
-- * A word is read from the chip, but, only the lower byte is valid.
-- *
-- * Returns the byte read from flash @addr.
-- */
--uint8_t
--qim_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
--{
-- uint16_t data;
-- uint16_t bank_select;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- bank_select = RD_REG_WORD(&reg->ctrl_status);
--
-- if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-- /* Specify 64K address range: */
-- /* clear out Module Select and Flash Address bits [19:16]. */
-- bank_select &= ~0xf8;
-- bank_select |= addr >> 12 & 0xf0;
-- bank_select |= CSR_FLASH_64K_BANK;
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--
-- WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-- data = RD_REG_WORD(&reg->flash_data);
--
-- return ((uint8_t)data);
-- }
--
-- /* Setup bit 16 of flash address. */
-- if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-- bank_select |= CSR_FLASH_64K_BANK;
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- } else if (((addr & BIT_16) == 0) &&
-- (bank_select & CSR_FLASH_64K_BANK)) {
-- bank_select &= ~(CSR_FLASH_64K_BANK);
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- }
--
-- /* Always perform IO mapped accesses to the FLASH registers. */
-- if (ha->pio_address) {
-- uint16_t data2;
--
-- reg = (device_reg_t *)ha->pio_address;
-- WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
-- do {
-- data = RD_REG_WORD_PIO(&reg->flash_data);
-- barrier();
-- cpu_relax();
-- data2 = RD_REG_WORD_PIO(&reg->flash_data);
-- } while (data != data2);
-- } else {
-- WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-- data = qim_debounce_register(&reg->flash_data);
-- }
--
-- return ((uint8_t)data);
--}
--
--/**
-- * qim_write_flash_byte() - Write a byte to flash
-- * @ha: HA context
-- * @addr: Address in flash to write
-- * @data: Data to write
-- */
--static void
--qim_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
--{
-- uint16_t bank_select;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- bank_select = RD_REG_WORD(&reg->ctrl_status);
-- if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-- /* Specify 64K address range: */
-- /* clear out Module Select and Flash Address bits [19:16]. */
-- bank_select &= ~0xf8;
-- bank_select |= addr >> 12 & 0xf0;
-- bank_select |= CSR_FLASH_64K_BANK;
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--
-- WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--
-- return;
-- }
--
-- /* Setup bit 16 of flash address. */
-- if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-- bank_select |= CSR_FLASH_64K_BANK;
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- } else if (((addr & BIT_16) == 0) &&
-- (bank_select & CSR_FLASH_64K_BANK)) {
-- bank_select &= ~(CSR_FLASH_64K_BANK);
-- WRT_REG_WORD(&reg->ctrl_status, bank_select);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- }
--
-- /* Always perform IO mapped accesses to the FLASH registers. */
-- if (ha->pio_address) {
-- reg = (device_reg_t *)ha->pio_address;
-- WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
-- WRT_REG_WORD_PIO(&reg->flash_data, (uint16_t)data);
-- } else {
-- WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-- }
--}
--
--/**
-- * qim_poll_flash() - Polls flash for completion.
-- * @ha: HA context
-- * @addr: Address in flash to poll
-- * @poll_data: Data to be polled
-- * @man_id: Flash manufacturer ID
-- * @flash_id: Flash ID
-- *
-- * This function polls the device until bit 7 of what is read matches data
-- * bit 7 or until data bit 5 becomes a 1. If that hapens, the flash ROM timed
-- * out (a fatal error). The flash book recommeds reading bit 7 again after
-- * reading bit 5 as a 1.
-- *
-- * Returns 0 on success, else non-zero.
-- */
--static uint8_t
--qim_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data,
-- uint8_t man_id, uint8_t flash_id)
--{
-- uint8_t status;
-- uint8_t flash_data;
-- uint32_t cnt;
--
-- status = 1;
--
-- /* Wait for 30 seconds for command to finish. */
-- poll_data &= BIT_7;
-- for (cnt = 3000000; cnt; cnt--) {
-- flash_data = qim_read_flash_byte(ha, addr);
-- if ((flash_data & BIT_7) == poll_data) {
-- status = 0;
-- break;
-- }
--
-- if (man_id != 0x40 && man_id != 0xda) {
-- if ((flash_data & BIT_5) && cnt > 2)
-- cnt = 2;
-- }
-- udelay(10);
-- barrier();
-- }
-- return (status);
--}
--
--/**
-- * qim_program_flash_address() - Programs a flash address
-- * @ha: HA context
-- * @addr: Address in flash to program
-- * @data: Data to be written in flash
-- * @man_id: Flash manufacturer ID
-- * @flash_id: Flash ID
-- *
-- * Returns 0 on success, else non-zero.
-- */
--static uint8_t
--qim_program_flash_address(scsi_qla_host_t *ha, uint32_t addr, uint8_t data,
-- uint8_t man_id, uint8_t flash_id)
--{
-- /* Write Program Command Sequence */
-- if (QIM_IS_OEM_001(ha)) {
-- qim_write_flash_byte(ha, 0xaaa, 0xaa);
-- qim_write_flash_byte(ha, 0x555, 0x55);
-- qim_write_flash_byte(ha, 0xaaa, 0xa0);
-- qim_write_flash_byte(ha, addr, data);
-- } else {
-- if (man_id == 0xda && flash_id == 0xc1) {
-- qim_write_flash_byte(ha, addr, data);
-- if (addr & 0x7e)
-- return 0;
-- } else {
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0xa0);
-- qim_write_flash_byte(ha, addr, data);
-- }
-- }
--
-- udelay(150);
--
-- /* Wait for write to complete. */
-- return (qim_poll_flash(ha, addr, data, man_id, flash_id));
--}
--
--/**
-- * qim_erase_flash() - Erase the flash.
-- * @ha: HA context
-- * @man_id: Flash manufacturer ID
-- * @flash_id: Flash ID
-- *
-- * Returns 0 on success, else non-zero.
-- */
--static uint8_t
--qim_erase_flash(scsi_qla_host_t *ha, uint8_t man_id, uint8_t flash_id)
--{
-- /* Individual Sector Erase Command Sequence */
-- if (QIM_IS_OEM_001(ha)) {
-- qim_write_flash_byte(ha, 0xaaa, 0xaa);
-- qim_write_flash_byte(ha, 0x555, 0x55);
-- qim_write_flash_byte(ha, 0xaaa, 0x80);
-- qim_write_flash_byte(ha, 0xaaa, 0xaa);
-- qim_write_flash_byte(ha, 0x555, 0x55);
-- qim_write_flash_byte(ha, 0xaaa, 0x10);
-- } else {
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0x80);
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0x10);
-- }
--
-- udelay(150);
--
-- /* Wait for erase to complete. */
-- return (qim_poll_flash(ha, 0x00, 0x80, man_id, flash_id));
--}
--
--/**
-- * qim_erase_flash_sector() - Erase a flash sector.
-- * @ha: HA context
-- * @addr: Flash sector to erase
-- * @sec_mask: Sector address mask
-- * @man_id: Flash manufacturer ID
-- * @flash_id: Flash ID
-- *
-- * Returns 0 on success, else non-zero.
-- */
--static uint8_t
--qim_erase_flash_sector(scsi_qla_host_t *ha, uint32_t addr,
-- uint32_t sec_mask, uint8_t man_id, uint8_t flash_id)
--{
-- /* Individual Sector Erase Command Sequence */
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0x80);
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- if (man_id == 0x1f && flash_id == 0x13)
-- qim_write_flash_byte(ha, addr & sec_mask, 0x10);
-- else
-- qim_write_flash_byte(ha, addr & sec_mask, 0x30);
--
-- udelay(150);
--
-- /* Wait for erase to complete. */
-- return (qim_poll_flash(ha, addr, 0x80, man_id, flash_id));
--}
--
--/**
-- * qim_get_flash_manufacturer() - Read manufacturer ID from flash chip.
-- * @man_id: Flash manufacturer ID
-- * @flash_id: Flash ID
-- *
-- */
--void
--qim_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
-- uint8_t *flash_id)
--{
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0x90);
-- *man_id = qim_read_flash_byte(ha, 0x0000);
-- *flash_id = qim_read_flash_byte(ha, 0x0001);
-- qim_write_flash_byte(ha, 0x5555, 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa, 0x55);
-- qim_write_flash_byte(ha, 0x5555, 0xf0);
--}
--
--void
--qim24xx_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
-- uint8_t *flash_id)
--{
-- uint32_t ids;
--
-- ids = qim24xx_read_flash_dword(ha, flash_data_to_access_addr(0xd03ab));
-- *man_id = LSB(ids);
-- *flash_id = MSB(ids);
--}
--
--/**
-- * qim_set_flash_image() - Write image to flash chip.
-- * @ha: HA context
-- * @image: Source image to write to flash
-- *
-- * Returns 0 on success, else non-zero.
-- */
--uint16_t
--qim_set_flash_image(scsi_qla_host_t *ha, uint8_t *image, uint32_t saddr,
-- uint32_t length)
--{
-- uint16_t status;
-- uint32_t addr;
-- uint32_t liter;
-- uint32_t sec_mask;
-- uint32_t rest_addr;
-- uint8_t man_id, flash_id;
-- uint8_t sec_number;
-- uint8_t data;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- status = 0;
-- sec_number = 0;
--
-- /* Reset ISP chip. */
-- WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-- RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
--
-- qim_flash_enable(ha);
-- do { /* Loop once to provide quick error exit */
-- /* Structure of flash memory based on manufacturer */
-- if (QIM_IS_OEM_001(ha)) {
-- // OEM variant with special flash part.
-- man_id = flash_id = 0;
-- rest_addr = 0xffff;
-- sec_mask = 0x10000;
-- goto update_flash;
-- }
-- qim_get_flash_manufacturer(ha, &man_id, &flash_id);
-- DEBUG9(printk("%s(%ld): Flash man_id=%d flash_id=%d\n",
-- __func__, ha->host_no, man_id, flash_id));
-- switch (man_id) {
-- case 0x20: // ST flash
-- if (flash_id == 0xd2 || flash_id == 0xe3) {
-- // ST m29w008at part - 64kb sector size with
-- // 32kb,8kb,8kb,16kb sectors at memory address
-- // 0xf0000
-- rest_addr = 0xffff;
-- sec_mask = 0x10000;
-- break;
-- }
-- // ST m29w010b part - 16kb sector size
-- // Default to 16kb sectors
-- rest_addr = 0x3fff;
-- sec_mask = 0x1c000;
-- break;
-- case 0x40: // Mostel flash
-- // Mostel v29c51001 part - 512 byte sector size
-- rest_addr = 0x1ff;
-- sec_mask = 0x1fe00;
-- break;
-- case 0xbf: // SST flash
-- // SST39sf10 part - 4kb sector size
-- rest_addr = 0xfff;
-- sec_mask = 0x1f000;
-- break;
-- case 0xda: // Winbond flash
-- // Winbond W29EE011 part - 256 byte sector size
-- rest_addr = 0x7f;
-- sec_mask = 0x1ff80;
-- break;
-- case 0xc2: // Macronix flash
-- // 64k sector size
-- if (flash_id == 0x38 || flash_id == 0x4f) {
-- rest_addr = 0xffff;
-- sec_mask = 0x10000;
-- break;
-- }
-- // Fall through...
--
-- case 0x1f: // Atmel flash
-- // 512k sector size
-- if (flash_id == 0x13) {
-- rest_addr = 0x7fffffff;
-- sec_mask = 0x80000000;
-- break;
-- }
-- // Fall through...
--
-- case 0x01: // AMD flash
-- if (flash_id == 0x38 || flash_id == 0x40 ||
-- flash_id == 0x4f) {
-- // Am29LV081 part - 64kb sector size
-- // Am29LV002BT part - 64kb sector size
-- rest_addr = 0xffff;
-- sec_mask = 0x10000;
-- break;
-- } else if (flash_id == 0x3e) {
-- // Am29LV008b part - 64kb sector size with
-- // 32kb,8kb,8kb,16kb sector at memory address
-- // 0xf0000
-- rest_addr = 0xffff;
-- sec_mask = 0x10000;
-- break;
-- } else if (flash_id == 0x20 || flash_id == 0x6e) {
-- // Am29LV010 part or AM29f010 - 16kb sector
-- // size
-- rest_addr = 0x3fff;
-- sec_mask = 0x1c000;
-- break;
-- } else if (flash_id == 0x6d) {
-- // Am29LV001 part - 8kb sector size
-- rest_addr = 0x1fff;
-- sec_mask = 0x1e000;
-- break;
-- }
-- default:
-- // Default to 16 kb sector size
-- rest_addr = 0x3fff;
-- sec_mask = 0x1c000;
-- break;
-- }
--
--update_flash:
-- if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-- if (qim_erase_flash(ha, man_id, flash_id)) {
-- status = 1;
-- break;
-- }
-- }
--
-- for (addr = saddr, liter = 0; liter < length; liter++, addr++) {
-- data = image[liter];
-- /* Are we at the beginning of a sector? */
-- if ((addr & rest_addr) == 0) {
-- if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-- if (addr >= 0x10000UL) {
-- if (((addr >> 12) & 0xf0) &&
-- ((man_id == 0x01 && flash_id == 0x3e) ||
-- (man_id == 0x20 && flash_id == 0xd2))) {
-- sec_number++;
-- if (sec_number == 1) {
-- rest_addr = 0x7fff;
-- sec_mask = 0x18000;
-- } else if (sec_number == 2 ||
-- sec_number == 3) {
-- rest_addr = 0x1fff;
-- sec_mask = 0x1e000;
-- } else if (sec_number == 4) {
-- rest_addr = 0x3fff;
-- sec_mask = 0x1c000;
-- }
-- }
-- }
-- } else if (addr == FLASH_IMAGE_SIZE / 2) {
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- RD_REG_WORD(&reg->nvram);
-- }
--
-- if (flash_id == 0xda && man_id == 0xc1) {
-- qim_write_flash_byte(ha, 0x5555,
-- 0xaa);
-- qim_write_flash_byte(ha, 0x2aaa,
-- 0x55);
-- qim_write_flash_byte(ha, 0x5555,
-- 0xa0);
-- } else if (!IS_QLA2322(ha) && !IS_QLA6322(ha)) {
-- /* Then erase it */
-- if (qim_erase_flash_sector(ha, addr,
-- sec_mask, man_id, flash_id)) {
-- DEBUG9(printk("%s(%ld) Unable "
-- "to erase flash sector "
-- "addr=%x mask=%x.\n",
-- __func__, ha->host_no, addr,
-- sec_mask));
-- status = 1;
-- break;
-- }
-- if (man_id == 0x01 && flash_id == 0x6d)
-- sec_number++;
-- }
-- }
--
-- if (man_id == 0x01 && flash_id == 0x6d) {
-- if (sec_number == 1 &&
-- addr == (rest_addr - 1)) {
-- rest_addr = 0x0fff;
-- sec_mask = 0x1f000;
-- } else if (sec_number == 3 && (addr & 0x7ffe)) {
-- rest_addr = 0x3fff;
-- sec_mask = 0x1c000;
-- }
-- }
--
-- if (qim_program_flash_address(ha, addr, data,
-- man_id, flash_id)) {
-- DEBUG9(printk("%s(%ld) Unable to program flash "
-- "address=%x data=%x.\n", __func__,
-- ha->host_no, addr, data));
-- status = 1;
-- break;
-- }
-- }
-- } while (0);
-- qim_flash_disable(ha);
--
-- return (status);
--}
--
--/*
-- * qim_unsuspend_all_target
-- * Unsuspend all target.
-- *
-- * Input:
-- * ha = visable adapter block pointer.
-- *
-- * Return:
-- *
-- * Context:
-- * Process context.
-- */
--void
--qim_unsuspend_all_target(scsi_qla_host_t *ha)
--{
-- os_tgt_t *tq;
-- int t;
--
-- for (t = 0; t < ha->max_targets; t++) {
-- if ((tq = ha->otgt[t]) == NULL)
-- continue;
--
-- clear_bit(TQF_SUSPENDED, &tq->flags);
-- }
--}
--
--/*
-- * qim_suspend_target
-- * Suspend target
-- *
-- * Input:
-- * ha = visable adapter block pointer.
-- * target = target queue
-- * time = time in seconds
-- *
-- * Return:
-- * QL_STATUS_SUCCESS -- suspended lun
-- * QL_STATUS_ERROR -- Didn't suspend lun
-- *
-- * Context:
-- * Interrupt context.
-- */
--int
--qim_suspend_target(scsi_qla_host_t *ha, os_tgt_t *tq, int time)
--{
-- srb_t *sp, *sptemp;
-- unsigned long flags;
--
-- if (test_bit(TQF_SUSPENDED, &tq->flags))
-- return QLA_FUNCTION_FAILED;
--
-- /* now suspend the lun */
-- set_bit(TQF_SUSPENDED, &tq->flags);
--
-- DEBUG2(printk(KERN_INFO
-- "scsi%ld: Starting - suspend target for %d secs\n", ha->host_no,
-- time));
--
-- /*
-- * Remove all (TARGET) pending commands from request queue and put them
-- * in the scsi_retry queue.
-- */
-- spin_lock_irqsave(&ha->list_lock, flags);
-- list_for_each_entry_safe(sp, sptemp, &ha->pending_queue, list) {
-- if (sp->tgt_queue != tq)
-- continue;
--
-- DEBUG3(printk("scsi%ld: %s requeue for suspended target %p\n",
-- ha->host_no, __func__, sp));
--
-- __del_from_pending_queue(ha, sp);
-- __add_to_scsi_retry_queue(ha,sp);
-- }
-- spin_unlock_irqrestore(&ha->list_lock, flags);
--
-- return QLA_SUCCESS;
--}
--
--/*
-- * qim_suspend_all_target
-- * Suspend all target indefinitely. Caller need to make sure
-- * to explicitly unsuspend it later on.
-- *
-- * Input:
-- * ha = visable adapter block pointer.
-- * target = target queue
-- * time = time in seconds
-- *
-- * Return:
-- * QL_STATUS_SUCCESS -- suspended lun
-- * QL_STATUS_ERROR -- Didn't suspend lun
-- *
-- * Context:
-- * qim_suspend_target can be called in Interrupt context.
-- * Hold the hardware lock for synchronisation.
-- */
--int
--qim_suspend_all_target(scsi_qla_host_t *ha)
--{
-- int status = 0;
-- os_tgt_t *tq;
-- int t, time;
-- unsigned long cpu_flags = 0;
--
-- /* Suspend the Target until explicitly cleared */
-- time = 0;
--
-- for (t = 0; t < ha->max_targets; t++) {
-- if ((tq = ha->otgt[t]) == NULL)
-- continue;
--
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- status = qim_suspend_target(ha, tq, time);
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-- }
--
-- return status;
--}
--
--uint16_t
--qim_read_flash_image(scsi_qla_host_t *ha, uint8_t *kern_tmp, uint32_t saddr,
-- uint32_t length)
--{
-- device_reg_t __iomem *reg = ha->iobase;
-- uint32_t midpoint;
-- uint8_t data;
-- uint32_t ilength;
-- uint16_t status = 0;
--
-- midpoint = length / 2;
-- qim_flash_enable(ha);
-- WRT_REG_WORD(&reg->nvram, 0);
-- RD_REG_WORD(&reg->nvram);
-- for (ilength = 0; ilength < length; saddr++, ilength++, kern_tmp++) {
-- if (ilength == midpoint) {
-- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-- RD_REG_WORD(&reg->nvram);
-- }
-- data = qim_read_flash_byte(ha, saddr);
-- if (saddr % 100)
-- udelay(10);
-- *kern_tmp = data;
-- }
-- qim_flash_disable(ha);
--
-- return (status);
--}
--
--uint32_t *
--qim24xx_read_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
-- uint32_t dwords)
--{
-- uint32_t i;
--
-- /* Dword reads to flash. */
-- for (i = 0; i < dwords; i++, faddr++)
-- dwptr[i] = cpu_to_le32(qim24xx_read_flash_dword(ha,
-- flash_data_to_access_addr(faddr)));
--
-- return dwptr;
--}
--
--int
--qim24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
-- uint32_t dwords)
--{
-- int ret;
-- uint32_t liter;
-- uint32_t sec_mask, rest_addr, conf_addr;
-- uint32_t fdata;
-- uint8_t man_id, flash_id;
-- struct device_reg_24xx __iomem *reg =
-- (struct device_reg_24xx __iomem *)ha->iobase;
--
-- ret = QLA_SUCCESS;
--
-- qim24xx_get_flash_manufacturer(ha, &man_id, &flash_id);
-- DEBUG9(printk("%s(%ld): Flash man_id=%d flash_id=%d\n", __func__,
-- ha->host_no, man_id, flash_id));
--
-- conf_addr = flash_conf_to_access_addr(0x03d8);
-- switch (man_id) {
-- case 0xbf: // STT flash
-- rest_addr = 0x1fff;
-- sec_mask = 0x3e000;
-- if (flash_id == 0x80)
-- conf_addr = flash_conf_to_access_addr(0x0352);
-- break;
-- case 0x13: // ST M25P80
-- rest_addr = 0x3fff;
-- sec_mask = 0x3c000;
-- break;
-- default:
-- // Default to 64 kb sector size
-- rest_addr = 0x3fff;
-- sec_mask = 0x3c000;
-- break;
-- }
--
-- /* Enable flash write. */
-- WRT_REG_DWORD(&reg->ctrl_status,
-- RD_REG_DWORD(&reg->ctrl_status) | CSRX_FLASH_ENABLE);
-- RD_REG_DWORD(&reg->ctrl_status); /* PCI Posting. */
--
-- /* Disable flash write-protection. */
-- qim24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0);
--
-- do { /* Loop once to provide quick error exit. */
-- for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
-- /* Are we at the beginning of a sector? */
-- if ((faddr & rest_addr) == 0) {
-- fdata = (faddr & sec_mask) << 2;
-- ret = qim24xx_write_flash_dword(ha, conf_addr,
-- (fdata & 0xff00) |((fdata << 16) &
-- 0xff0000) | ((fdata >> 16) & 0xff));
-- if (ret != QLA_SUCCESS) {
-- DEBUG9(printk("%s(%ld) Unable to flash "
-- "sector: address=%x.\n", __func__,
-- ha->host_no, faddr));
-- break;
-- }
-- }
-- ret = qim24xx_write_flash_dword(ha,
-- flash_data_to_access_addr(faddr),
-- cpu_to_le32(*dwptr));
-- if (ret != QLA_SUCCESS) {
-- DEBUG9(printk("%s(%ld) Unable to program flash "
-- "address=%x data=%x.\n", __func__,
-- ha->host_no, faddr, *dwptr));
-- break;
-- }
-- }
-- } while (0);
--
-- /* Disable flash write. */
-- WRT_REG_DWORD(&reg->ctrl_status,
-- RD_REG_DWORD(&reg->ctrl_status) & ~CSRX_FLASH_ENABLE);
-- RD_REG_DWORD(&reg->ctrl_status); /* PCI Posting. */
--
-- return ret;
--}
--
--int
--qim24xx_get_flash_version(struct qla_host_ioctl *ha, uint8_t *ptmp_mem)
--{
-- int ret = QLA_SUCCESS;
-- uint32_t pcihdr, pcids;
-- uint32_t *dcode;
-- uint8_t *bcode;
-- uint8_t code_type, last_image;
-- int i;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- if (ptmp_mem == NULL) {
-- /* error */
-- return(QLA_FUNCTION_FAILED);
-- }
--
-- dcode = (uint32_t *)ptmp_mem;
--
-- /* Begin with first PCI expansion ROM header. */
-- pcihdr = 0;
-- last_image = 1;
-- do {
-- /* Verify PCI expansion ROM header. */
-- qim24xx_read_flash_data(dr_ha, dcode, pcihdr >> 2, 0x20);
-- bcode = (uint8_t *)ptmp_mem + (pcihdr % 4);
-- if (bcode[0x0] != 0x55 || bcode[0x1] != 0xaa) {
-- /* No signature */
-- DEBUG10(printk(
-- "scsi(%ld): No matching ROM signature.\n",
-- ha->host_no));
-- ret = QLA_FUNCTION_FAILED;
-- break;
-- }
--
-- /* Locate PCI data structure. */
-- pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]);
--
-- qim24xx_read_flash_data(dr_ha, dcode, pcids >> 2, 0x20);
-- bcode = (uint8_t *)ptmp_mem + (pcihdr % 4);
--
-- /* Validate signature of PCI data structure. */
-- if (bcode[0x0] != 'P' || bcode[0x1] != 'C' ||
-- bcode[0x2] != 'I' || bcode[0x3] != 'R') {
-- /* Incorrect header. */
-- DEBUG10(printk("%s(): PCI data struct not found "
-- "pcir_adr=%x.\n",
-- __func__, pcids));
-- ret = QLA_FUNCTION_FAILED;
-- break;
-- }
--
-- /* Read version */
-- code_type = bcode[0x14];
-- switch (code_type) {
-- case ROM_CODE_TYPE_BIOS:
-- /* Intel x86, PC-AT compatible. */
-- set_bit(ROM_CODE_TYPE_BIOS, &ha->code_types);
-- ha->bios_revision[0] = bcode[0x12];
-- ha->bios_revision[1] = bcode[0x13];
-- DEBUG9(printk("%s(): read BIOS %d.%d.\n", __func__,
-- ha->bios_revision[1], ha->bios_revision[0]));
-- break;
-- case ROM_CODE_TYPE_FCODE:
-- /* Open Firmware standard for PCI (FCode). */
-- set_bit(ROM_CODE_TYPE_FCODE, &ha->code_types);
-- ha->fcode_revision[0] = bcode[0x12];
-- ha->fcode_revision[1] = bcode[0x13];
-- DEBUG9(printk("%s(): read FCODE %d.%d.\n", __func__,
-- ha->fcode_revision[1], ha->fcode_revision[0]);)
-- break;
-- case ROM_CODE_TYPE_EFI:
-- /* Extensible Firmware Interface (EFI). */
-- set_bit(ROM_CODE_TYPE_EFI, &ha->code_types);
-- ha->efi_revision[0] = bcode[0x12];
-- ha->efi_revision[1] = bcode[0x13];
-- DEBUG9(printk("%s(): read EFI %d.%d.\n", __func__,
-- ha->efi_revision[1], ha->efi_revision[0]));
-- break;
-- default:
-- DEBUG10(printk("%s(): Unrecognized code type %x at "
-- "pcids %x.\n", __func__, code_type, pcids));
-- break;
-- }
--
-- last_image = bcode[0x15] & BIT_7;
--
-- /* Locate next PCI expansion ROM. */
-- pcihdr += ((bcode[0x11] << 8) | bcode[0x10]) * 512;
-- } while (!last_image);
--
-- /* Read firmware image information. */
-- memset(ha->fw_revision, 0, sizeof(ha->fw_revision));
-- dcode = (uint32_t *)ptmp_mem;
--
-- qim24xx_read_flash_data(dr_ha, dcode, FA_RISC_CODE_ADDR + 4, 4);
-- for (i = 0; i < 4; i++)
-- dcode[i] = be32_to_cpu(dcode[i]);
--
-- if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
-- dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
-- (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
-- dcode[3] == 0)) {
-- DEBUG10(printk("%s(): Unrecognized fw version at %x.\n",
-- __func__, FA_RISC_CODE_ADDR));
-- } else {
-- ha->fw_revision[0] = dcode[0];
-- ha->fw_revision[1] = dcode[1];
-- ha->fw_revision[2] = dcode[2];
-- ha->fw_revision[3] = dcode[3];
-- }
--
-- return ret;
--}
--
--int
--qim24xx_refresh_flash_version(struct qla_host_ioctl *ha, uint8_t *ptmp_mem)
--{
-- unsigned long flags;
-- int ret = 0;
-- int status;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- /* suspend targets */
-- qim_suspend_all_target(dr_ha);
--
-- /* wait for big hammer to complete if it fails */
-- status = qim_cmd_wait(dr_ha);
-- /*
-- if (status)
-- qla2x00_wait_for_hba_online(ha);
-- */
-- if (status)
-- return status;
--
-- /* Dont process mailbox cmd until flash
-- * operation is done.
-- */
-- set_bit(MBX_UPDATE_FLASH_ACTIVE, &dr_ha->mbx_cmd_flags);
--
-- qim_disable_intrs(dr_ha);
--
-- spin_lock_irqsave(&dr_ha->hardware_lock, flags);
-- if (qim24xx_get_flash_version(ha, ptmp_mem)) {
-- ret = QLA_FUNCTION_FAILED;
-- DEBUG9_10(printk( "%s: ERROR reading flash versions.\n",
-- __func__);)
-- }
-- spin_unlock_irqrestore(&dr_ha->hardware_lock,flags);
--
-- qim_enable_intrs(dr_ha);
-- clear_bit(MBX_UPDATE_FLASH_ACTIVE, &dr_ha->mbx_cmd_flags);
-- qim_unsuspend_all_target(dr_ha);
--
-- return (ret);
--}
--
--uint16_t
--qim24xx_update_or_read_flash(scsi_qla_host_t *ha, uint8_t *image,
-- uint32_t saddr, uint32_t length, uint8_t direction)
--{
-- uint32_t status;
--
-- /* Not setting the timer so that tgt remains unsuspended */
-- qim_suspend_all_target(ha);
--
-- /* wait for big hammer to complete if it fails */
-- status = qim_cmd_wait(ha);
-- /*
-- if (status)
-- qim_wait_for_hba_online(ha);
-- */
--
-- if (status)
-- /* just return busy since there's outstanding command */
-- return status;
--
-- /* Dont process mailbox cmd until flash operation is done */
-- set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
--
-- qim_disable_intrs(ha);
--
-- switch (direction) {
-- case QLA2X00_READ:
--
-- DEBUG9(printk("%s(%ld): Reading image=%p saddr=0x%x "
-- "length=0x%x\n", __func__, ha->host_no, image, saddr >> 2,
-- length >> 2));
-- qim24xx_read_flash_data(ha, (uint32_t *)image, saddr >> 2,
-- length >> 2);
-- break;
--
-- case QLA2X00_WRITE:
--
-- DEBUG9(printk("%s(%ld): Writing image=%p saddr=0x%x "
-- "length=0x%x\n", __func__, ha->host_no, image, saddr >> 2,
-- length >> 2));
-- status = qim24xx_write_flash_data(ha, (uint32_t *)image,
-- saddr >> 2, length >> 2);
-- break;
-- default:
-- printk(KERN_INFO "%s unknown operation\n", __func__);
-- break;
-- }
--
-- qim_enable_intrs(ha);
--
-- if (direction == QLA2X00_WRITE) {
-- /* Schedule DPC to restart the RISC */
-- set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-- up(ha->dpc_wait);
-- qim_wait_for_hba_online(ha);
-- }
--
-- clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
--
-- qim_unsuspend_all_target(ha);
--
-- return status;
--}
--
--uint16_t
--qim_update_or_read_flash(scsi_qla_host_t *ha, uint8_t *image,
-- uint32_t saddr, uint32_t length, uint8_t direction)
--{
-- uint16_t status;
-- unsigned long flags;
-- uint32_t cnt;
-- device_reg_t __iomem *reg = ha->iobase;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- return qim24xx_update_or_read_flash(ha, image, saddr, length,
-- direction);
--
-- /* Not setting the timer so that tgt remains unsuspended */
-- qim_suspend_all_target(ha);
--
-- /* wait for big hammer to complete if it fails */
-- status = qim_cmd_wait(ha);
-- /*
-- if (status)
-- status = qim_wait_for_hba_online(ha);
-- */
--
-- if (status)
-- return status;
--
-- /* Dont process mailbox cmd until flash operation is done */
-- set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
--
-- qim_disable_intrs(ha);
--
-- /* Pause RISC. */
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-- RD_REG_WORD(&reg->hccr);
-- if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
-- for (cnt = 0; cnt < 30000; cnt++) {
-- if ((RD_REG_WORD(&reg->hccr) &
-- HCCR_RISC_PAUSE) != 0)
-- break;
-- udelay(100);
-- }
-- } else {
-- udelay(10);
-- }
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- switch (direction) {
-- case QLA2X00_READ:
-- DEBUG9(printk("%s(%ld): Reading image=%p saddr=0x%x "
-- "length=0x%x\n", __func__, ha->host_no, image, saddr,
-- length));
-- status = qim_read_flash_image(ha, image, saddr, length);
-- break;
--
-- case QLA2X00_WRITE:
-- DEBUG9(printk("%s(%ld): Writing image=%p saddr=0x%x "
-- "length=0x%x\n", __func__, ha->host_no, image, saddr,
-- length));
-- status = qim_set_flash_image(ha, image, saddr, length);
-- break;
-- default:
-- printk(KERN_INFO "%s unknown operation\n", __func__);
-- break;
-- }
--
-- /* Schedule DPC to restart the RISC */
-- set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-- up(ha->dpc_wait);
-- qim_wait_for_hba_online(ha);
--
-- clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
--
-- qim_unsuspend_all_target(ha);
--
-- return status;
--}
--
--/**
-- * qim_get_fcode_version() - Determine an FCODE image's version.
-- * @ha: HA context
-- * @pcids: Pointer to the FCODE PCI data structure
-- *
-- * The process of retrieving the FCODE version information is at best
-- * described as interesting.
-- *
-- * Within the first 100h bytes of the image an ASCII string is present
-- * which contains several pieces of information including the FCODE
-- * version. Unfortunately it seems the only reliable way to retrieve
-- * the version is by scanning for another sentinel within the string,
-- * the FCODE build date:
-- *
-- * ... 2.00.02 10/17/02 ...
-- *
-- * Returns QLA_SUCCESS on successful retrieval of version.
-- */
--static int
--qim_get_fcode_version(struct qla_host_ioctl *ha, uint32_t pcids)
--{
-- int ret = QLA_FUNCTION_FAILED;
-- uint32_t istart, iend, iter, vend;
-- uint8_t do_next, rbyte, *vbyte;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- memset(ha->fcode_revision, 0, sizeof(ha->fcode_revision));
--
-- /* Skip the PCI data structure. */
-- istart = pcids +
-- ((qim_read_flash_byte(dr_ha, pcids + 0x0B) << 8) |
-- qim_read_flash_byte(dr_ha, pcids + 0x0A));
-- iend = istart + 0x100;
-- do {
-- /* Scan for the sentinel date string...eeewww. */
-- do_next = 0;
-- iter = istart;
-- while ((iter < iend) && !do_next) {
-- iter++;
-- if (qim_read_flash_byte(dr_ha, iter) == '/') {
-- if (qim_read_flash_byte(dr_ha, iter + 2) == '/')
-- do_next++;
-- else if (qim_read_flash_byte(dr_ha, iter + 3) ==
-- '/')
-- do_next++;
-- }
-- }
-- if (!do_next)
-- break;
--
-- /* Backtrack to previous ' ' (space). */
-- do_next = 0;
-- while ((iter > istart) && !do_next) {
-- iter--;
-- if (qim_read_flash_byte(dr_ha, iter) == ' ')
-- do_next++;
-- }
-- if (!do_next)
-- break;
--
-- /*
-- * Mark end of version tag, and find previous ' ' (space) or
-- * string length (recent FCODE images -- major hack ahead!!!).
-- */
-- vend = iter - 1;
-- do_next = 0;
-- while ((iter > istart) && !do_next) {
-- iter--;
-- rbyte = qim_read_flash_byte(dr_ha, iter);
-- if (rbyte == ' ' || rbyte == 0xd || rbyte == 0x10)
-- do_next++;
-- }
-- if (!do_next)
-- break;
--
-- /* Mark beginning of version tag, and copy data. */
-- iter++;
-- if ((vend - iter) &&
-- ((vend - iter) < sizeof(ha->fcode_revision))) {
-- vbyte = ha->fcode_revision;
-- while (iter <= vend) {
-- *vbyte++ = qim_read_flash_byte(dr_ha, iter);
-- iter++;
-- }
-- ret = QLA_SUCCESS;
-- }
-- } while (0);
--
-- return ret;
--}
--
--/**
-- * qim_get_flash_version() - Read version information from flash.
-- * @ha: HA context
-- *
-- * Returns QLA_SUCCESS on successful retrieval of flash version.
-- */
--int
--qim_get_flash_version(struct qla_host_ioctl *ha, uint8_t *ptmp_mem)
--{
-- int ret = QLA_SUCCESS;
-- uint8_t code_type, last_image;
-- uint32_t pcihdr, pcids;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha))
-- return qim24xx_get_flash_version(ha, ptmp_mem);
--
-- if (!dr_ha->pio_address)
-- return QLA_FUNCTION_FAILED;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance));
--
-- qim_flash_enable(dr_ha);
--
-- /* Begin with first PCI expansion ROM header. */
-- pcihdr = 0;
-- last_image = 1;
-- do {
-- /* Verify PCI expansion ROM header. */
-- if (qim_read_flash_byte(dr_ha, pcihdr) != 0x55 ||
-- qim_read_flash_byte(dr_ha, pcihdr + 0x01) != 0xaa) {
-- /* No signature */
-- DEBUG2(printk("scsi(%ld): No matching ROM signature.\n",
-- ha->host_no));
-- ret = QLA_FUNCTION_FAILED;
-- break;
-- }
--
-- /* Locate PCI data structure. */
-- pcids = pcihdr +
-- ((qim_read_flash_byte(dr_ha, pcihdr + 0x19) << 8) |
-- qim_read_flash_byte(dr_ha, pcihdr + 0x18));
--
-- /* Validate signature of PCI data structure. */
-- if (qim_read_flash_byte(dr_ha, pcids) != 'P' ||
-- qim_read_flash_byte(dr_ha, pcids + 0x1) != 'C' ||
-- qim_read_flash_byte(dr_ha, pcids + 0x2) != 'I' ||
-- qim_read_flash_byte(dr_ha, pcids + 0x3) != 'R') {
-- /* Incorrect header. */
-- DEBUG2(printk("%s(): PCI data struct not found "
-- "pcir_adr=%x.\n",
-- __func__, pcids));
-- ret = QLA_FUNCTION_FAILED;
-- break;
-- }
--
-- /* Read version */
-- code_type = qim_read_flash_byte(dr_ha, pcids + 0x14);
-- switch (code_type) {
-- case ROM_CODE_TYPE_BIOS:
-- /* Intel x86, PC-AT compatible. */
-- set_bit(ROM_CODE_TYPE_BIOS, &ha->code_types);
-- ha->bios_revision[0] =
-- qim_read_flash_byte(dr_ha, pcids + 0x12);
-- ha->bios_revision[1] =
-- qim_read_flash_byte(dr_ha, pcids + 0x13);
-- printk("%s(): read BIOS %d.%d.\n", __func__,
-- ha->bios_revision[1], ha->bios_revision[0]);
-- DEBUG9(printk("%s(): read BIOS %d.%d.\n", __func__,
-- ha->bios_revision[1], ha->bios_revision[0]);)
-- break;
-- case ROM_CODE_TYPE_FCODE:
-- /* Open Firmware standard for PCI (FCode). */
-- /* Eeeewww... */
-- if (qim_get_fcode_version(ha, pcids) == QLA_SUCCESS)
-- set_bit(ROM_CODE_TYPE_FCODE, &ha->code_types);
-- DEBUG9(printk("%s(): read FCODE %d.%d.%d.\n", __func__,
-- ha->bios_revision[1], ha->bios_revision[0]);)
-- break;
-- case ROM_CODE_TYPE_EFI:
-- /* Extensible Firmware Interface (EFI). */
-- set_bit(ROM_CODE_TYPE_EFI, &ha->code_types);
-- ha->efi_revision[0] =
-- qim_read_flash_byte(dr_ha, pcids + 0x12);
-- ha->efi_revision[1] =
-- qim_read_flash_byte(dr_ha, pcids + 0x13);
-- DEBUG3(printk("%s(): read EFI %d.%d.\n", __func__,
-- dr_ha->efi_revision[1], dr_ha->efi_revision[0]));
-- break;
-- default:
-- DEBUG2(printk("%s(): Unrecognized code type %x at "
-- "pcids %x.\n", __func__, code_type, pcids));
-- break;
-- }
--
-- last_image = qim_read_flash_byte(dr_ha, pcids + 0x15) & BIT_7;
--
-- /* Locate next PCI expansion ROM. */
-- pcihdr += ((qim_read_flash_byte(dr_ha, pcids + 0x11) << 8) |
-- qim_read_flash_byte(dr_ha, pcids + 0x10)) * 512;
-- } while (!last_image);
--
-- qim_flash_disable(dr_ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance));
--
-- return ret;
--}
--
--
--#if 0
--static int
--qla_uprintf(char **uiter, char *fmt, ...)
--{
-- int iter, len;
-- char buf[128];
-- va_list args;
--
-- va_start(args, fmt);
-- len = vsprintf(buf, fmt, args);
-- va_end(args);
--
-- for (iter = 0; iter < len; iter++, *uiter += 1)
-- *uiter[0] = buf[iter];
--
-- return (len);
--}
--
--void
--qim24xx_ascii_fw_dump(scsi_qla_host_t *ha)
--{
-- uint32_t cnt;
-- char *uiter;
-- struct qla24xx_fw_dump *fw;
-- uint32_t ext_mem_cnt;
--/* RLU
-- uint32_t dump_size;
--
-- dump_size = FW_DUMP_SIZE_24XX;
-- ha->fw_dump_buffer = (char *)vmalloc(dump_size);
-- if (ha->fw_dump_buffer == NULL) {
-- printk("%s: fw dump malloc failed.\n",
-- __func__);
-- return;
-- }
--*/
-- if (ha->fw_dump_buffer == NULL) {
-- printk("%s: fw dump buffer invalid.\n",
-- __func__);
-- return;
-- }
--
-- uiter = ha->fw_dump_buffer;
-- fw = ha->fw_dump24;
--
-- qla_uprintf(&uiter, "\n[BEGIN==>] ISP Debug Dump:\n");
-- qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n",
-- ha->fw_major_version, ha->fw_minor_version,
-- ha->fw_subminor_version, ha->fw_attributes);
--
-- qla_uprintf(&uiter, "\nHCCR Register\n%04x\n", fw->hccr);
--
-- qla_uprintf(&uiter, "\nHost Interface Registers");
-- for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->host_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nMailbox Registers");
-- for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->mailbox_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-2 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_2_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nCommand DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->cmd_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRequest0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->req0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nResponse0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->resp0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->resp0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRequest1 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->req1_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt1_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT2 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt2_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt2_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT3 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt3_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt3_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT4 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt4_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt4_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT Data DMA Common Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRCV Thread 0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt0_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rcvt0_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRCV Thread 1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt1_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rcvt1_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->risc_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->risc_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nShadow Registers");
-- for (cnt = 0; cnt < sizeof(fw->shadow_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->shadow_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nLMC Registers");
-- for (cnt = 0; cnt < sizeof(fw->lmc_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->lmc_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fpm_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->fpm_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFB Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fb_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->fb_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nCode RAM");
-- for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%08x: ", cnt + 0x20000);
-- }
-- qla_uprintf(&uiter, "%08x ", fw->code_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nExternal Memory");
-- ext_mem_cnt = ha->fw_memory_size - 0x100000 + 1;
-- for (cnt = 0; cnt < ext_mem_cnt; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%08x: ", cnt + 0x100000);
-- }
-- qla_uprintf(&uiter, "%08x ", fw->ext_mem[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n[<==END] ISP Debug Dump\n");
--
--//printk(KERN_INFO "%s\n", ha->fw_dump_buffer);
--}
--#endif
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_sup.h ./drivers/scsi/qla2xxx/qim_sup.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_sup.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_sup.h 1970-01-01 03:00:00.000000000 +0300
-@@ -1,56 +0,0 @@
--#ifndef __QIM_SUP_H__
--#define __QIM_SUP_H__
--
--
--extern void
--qim_dump_buffer(uint8_t *, uint32_t);
--
--extern int
--qim_down_timeout(struct semaphore *, unsigned long);
--
--extern int
--__qim_is_fcport_in_config(scsi_qla_host_t *, fc_port_t *);
--
--extern uint8_t *
--qim_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
-- uint32_t);
--extern int
--qim_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
-- uint32_t);
--
--extern int
--qim_cmd_wait(scsi_qla_host_t *);
--
--extern int
--qim_suspend_all_target(scsi_qla_host_t *);
--
--extern void
--qim_unsuspend_all_target(scsi_qla_host_t *);
--
--extern int
--qim_wait_for_hba_online(scsi_qla_host_t *);
--
--extern int
--qim_get_flash_version(struct qla_host_ioctl *, uint8_t *);
--
--extern int
--qim24xx_refresh_flash_version(struct qla_host_ioctl *, uint8_t *);
--
--extern uint16_t
--qim_update_or_read_flash(scsi_qla_host_t *, uint8_t *,
-- uint32_t, uint32_t, uint8_t);
--
--static __inline int
--qim_is_fcport_in_config(scsi_qla_host_t *ha, fc_port_t *fcport)
--{
-- if (fcport->flags & FCF_PERSISTENT_BOUND)
-- return 1;
--
-- return 0;
--}
--
--__inline__ void qim_enable_intrs(scsi_qla_host_t *);
--__inline__ void qim_disable_intrs(scsi_qla_host_t *);
--
--#endif /* ifndef __QIM_SUP_H__ */
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qim_xioct.c ./drivers/scsi/qla2xxx/qim_xioct.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qim_xioct.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qim_xioct.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,7565 +0,0 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ioctl module for ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--
--#include "qim_def.h"
--#include "exioct.h"
--#include "inioct.h"
--#include "qim_sup.h"
--#include "qim_mbx.h"
--#include "qlfo.h"
--
--#include <linux/version.h>
--#include <linux/blkdev.h>
--#include <linux/delay.h>
--#include <scsi/scsi_tcq.h>
--#include <asm/uaccess.h>
--
--
--#define QLA_PT_CMD_TOV 66
--int ql2xioctltimeout = QLA_PT_CMD_TOV;
--#define QLA_PT_CMD_DRV_TOV (ql2xioctltimeout + 1) /* drv timeout */
--#define QLA_IOCTL_ACCESS_WAIT_TIME (ql2xioctltimeout + 10) /* wait_q tov */
--#define QLA_INITIAL_IOCTLMEM_SIZE 8192
--#define QLA_IOCTL_SCRAP_SIZE 16384 /* scrap memory for local use. */
--
--/* ELS related defines */
--#define FC_HEADER_LEN 24
--#define ELS_RJT_LENGTH 0x08 /* 8 */
--#define ELS_RPS_ACC_LENGTH 0x40 /* 64 */
--#define ELS_RLS_ACC_LENGTH 0x1C /* 28 */
--
--/* ELS cmd Reply Codes */
--#define ELS_STAT_LS_RJT 0x01
--#define ELS_STAT_LS_ACC 0x02
--
--#define IOCTL_INVALID_STATUS 0xffff
--
--
--int extended_error_logging = 0;
--
--/*
-- * From qim_fo.c
-- */
--extern int
--qim_fo_ioctl(struct qla_host_ioctl *, int, EXT_IOCTL *, int);
--
--/*
-- * From qim_inioctl.c
-- */
--extern int qim_read_nvram(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_update_nvram(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_send_loopback(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_read_option_rom(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_update_option_rom(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_get_option_rom_layout(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_get_vpd(struct qla_host_ioctl *, EXT_IOCTL *, int);
--extern int qim_update_vpd(struct qla_host_ioctl *, EXT_IOCTL *, int);
--
--/*
-- * Local prototypes
-- */
--static int qim_get_new_ioctl_dma_mem(struct qla_host_ioctl *, uint32_t);
--
--static int qim_find_curr_ha(uint16_t, struct qla_host_ioctl **);
--
--static int qim_get_driver_specifics(EXT_IOCTL *, struct qla_host_ioctl *);
--
--#if 0
--static int qim_aen_reg(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_aen_get(struct qla_host_ioctl *, EXT_IOCTL *, int);
--#endif
--
--static int qim_query(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_hba_node(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_hba_port(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_disc_port(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_disc_tgt(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_chip(struct qla_host_ioctl *, EXT_IOCTL *, int);
--
--static int qim_get_data(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_get_statistics(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_get_fc_statistics(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_get_port_summary(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_get_fcport_summary(struct qla_host_ioctl *, EXT_DEVICEDATAENTRY *,
-- void *, uint32_t, uint32_t, uint32_t *, uint32_t *);
--/*
--static int qim_std_missing_port_summary(struct qla_host_ioctl *,
-- EXT_DEVICEDATAENTRY *, void *, uint32_t, uint32_t *, uint32_t *);
--*/
--static int qim_query_driver(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_query_fw(struct qla_host_ioctl *, EXT_IOCTL *, int);
--
--static int qim_msiocb_passthru(struct qla_host_ioctl *, EXT_IOCTL *, int, int);
--#if 0
--static int qim_send_els_passthru(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, fc_port_t *, fc_lun_t *, int);
--#endif
--static int qim_send_fcct(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, fc_port_t *, fc_lun_t *, int);
--static int qim_ioctl_ms_queuecommand(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, fc_port_t *, fc_lun_t *, EXT_ELS_PT_REQ *);
--static int qim_start_ms_cmd(struct qla_host_ioctl *, EXT_IOCTL *, srb_t *,
-- EXT_ELS_PT_REQ *);
--
--static int qim_wwpn_to_scsiaddr(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_scsi_passthru(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_sc_scsi_passthru(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, struct scsi_device *, int);
--static int qim_sc_fc_scsi_passthru(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, struct scsi_device *, int);
--#if 0
--static int qim_sc_scsi3_passthru(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, struct scsi_device *, int);
--#endif
--static int qim_ioctl_scsi_queuecommand(struct qla_host_ioctl *, EXT_IOCTL *,
-- struct scsi_cmnd *, struct scsi_device *, fc_port_t *, fc_lun_t *);
--
--static int qim_send_els_rnid(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_get_rnid_params(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_set_host_data(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_set_rnid_params(struct qla_host_ioctl *, EXT_IOCTL *, int);
--
--#if 0
--static int qim_get_led_state(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_set_led_state(struct qla_host_ioctl *, EXT_IOCTL *, int);
--static int qim_set_led_23xx(struct qla_host_ioctl *, EXT_BEACON_CONTROL *,
-- uint32_t *, uint32_t *);
--static int qim_set_led_24xx(struct qla_host_ioctl *, EXT_BEACON_CONTROL *,
-- uint32_t *, uint32_t *);
--#endif
--
--static srb_t *
--qim_get_new_sp(scsi_qla_host_t *);
--
--
--void *
--Q64BIT_TO_PTR(uint64_t buf_addr, uint16_t addr_mode)
--{
--#if (defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)) || !defined(CONFIG_64BIT)
-- union ql_doublelong {
-- struct {
-- uint32_t lsl;
-- uint32_t msl;
-- } longs;
-- uint64_t dl;
-- };
--
-- union ql_doublelong tmpval;
--
-- tmpval.dl = buf_addr;
--
--#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-- /* 32bit user - 64bit kernel */
-- if (addr_mode == EXT_DEF_ADDR_MODE_32) {
-- DEBUG9(printk("%s: got 32bit user address.\n", __func__);)
-- return((void *)(uint64_t)(tmpval.longs.lsl));
-- } else {
-- DEBUG9(printk("%s: got 64bit user address.\n", __func__);)
-- return((void *)buf_addr);
-- }
--#else
-- return((void *)(tmpval.longs.lsl));
--#endif
--#else
-- return((void *)buf_addr);
--#endif
--}
--
--void
--qim_dump_buffer(uint8_t * b, uint32_t size)
--{
-- uint32_t cnt;
-- uint8_t c;
--
-- printk(" 0 1 2 3 4 5 6 7 8 9 "
-- "Ah Bh Ch Dh Eh Fh\n");
-- printk("----------------------------------------"
-- "----------------------\n");
--
-- for (cnt = 0; cnt < size;) {
-- c = *b++;
-- printk("%02x",(uint32_t) c);
-- cnt++;
-- if (!(cnt % 16))
-- printk("\n");
-- else
-- printk(" ");
-- }
-- if (cnt % 16)
-- printk("\n");
--}
--
--/*****************************************************************************/
--
--/*
-- * qim_ioctl_sleep_done
-- *
-- * Description:
-- * This is the callback function to wakeup ioctl completion semaphore
-- * for the ioctl request that is waiting.
-- *
-- * Input:
-- * sem - pointer to the ioctl completion semaphore.
-- *
-- * Returns:
-- */
--static void
--qim_ioctl_sleep_done(struct semaphore * sem)
--{
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- if (sem != NULL){
-- DEBUG9(printk("ioctl_sleep: wake up sem.\n");)
-- up(sem);
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--}
--
--/*
-- * qim_ioctl_sem_init
-- *
-- * Description:
-- * Initialize the ioctl timer and semaphore used to wait for passthru
-- * completion.
-- *
-- * Input:
-- * ha - pointer to struct qla_host_ioctl structure used for initialization.
-- *
-- * Returns:
-- * None.
-- */
--static void
--qim_ioctl_sem_init(struct qla_host_ioctl *ha)
--{
-- init_MUTEX_LOCKED(&ha->ioctl->cmpl_sem);
-- init_timer(&(ha->ioctl->cmpl_timer));
-- ha->ioctl->cmpl_timer.data = (unsigned long)&ha->ioctl->cmpl_sem;
-- ha->ioctl->cmpl_timer.function =
-- (void (*)(unsigned long))qim_ioctl_sleep_done;
--}
--
--static uint32_t
--qim_match_drha_to_ha(struct scsi_qla_host *drha, struct qla_host_ioctl **ha)
--{
-- uint32_t found = FALSE;
-- struct qla_host_ioctl *tmp_ha;
-- struct list_head *ioctll;
--
-- list_for_each(ioctll, &qim_haioctl_list) {
-- tmp_ha = list_entry(ioctll, struct qla_host_ioctl, list);
-- if (tmp_ha->dr_data == drha) {
-- *ha = tmp_ha;
-- found = TRUE;
-- break;
-- }
-- }
--
-- DEBUG9(printk(
-- "qim_match_drha_to_ha: returning found=%d ha=%p.\n",
-- found, *ha);)
--
-- return (found);
--}
--
--/*
-- * qim_scsi_pt_done
-- *
-- * Description:
-- * Resets ioctl progress flag and wakes up the ioctl completion semaphore.
-- *
-- * Input:
-- * pscsi_cmd - pointer to the passthru Scsi cmd structure which has completed.
-- *
-- * Returns:
-- */
--static void
--qim_scsi_pt_done(struct scsi_cmnd *pscsi_cmd)
--{
-- struct Scsi_Host *host;
-- struct qla_host_ioctl *ha;
-- struct scsi_qla_host *dr_ha;
--
-- DEBUG9(printk("%s post function entered.\n", __func__);)
--
-- host = pscsi_cmd->device->host;
-- dr_ha = (struct scsi_qla_host *) host->hostdata;
--
-- DEBUG9(printk("%s post function going to match ha to drha %p.\n",
-- __func__, dr_ha);)
--
-- if (qim_match_drha_to_ha(dr_ha, &ha) == TRUE) {
--
-- DEBUG9(printk("%s(%ld): got ha=%p.\n",
-- __func__, ha->host_no, ha);)
--
-- /* save detail status for IOCTL reporting */
-- ha->ioctl->SCSIPT_InProgress = 0;
-- ha->ioctl->ioctl_tov = 0;
-- ha->ioctl_err_cmd = NULL;
--
-- DEBUG9(printk("%s post function going to signal wake up.\n",
-- __func__);)
-- up(&ha->ioctl->cmpl_sem);
-- }
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return;
--}
--
--/*
-- * qim_msiocb_done
-- *
-- * Description:
-- * Resets MSIOCB ioctl progress flag and wakes up the ioctl completion
-- * semaphore.
-- *
-- * Input:
-- * cmd - pointer to the passthru Scsi cmd structure which has completed.
-- *
-- * Returns:
-- */
--static void
--qim_msiocb_done(struct scsi_cmnd *pscsi_cmd)
--{
-- struct Scsi_Host *host;
-- struct qla_host_ioctl *ha;
--
-- host = pscsi_cmd->device->host;
-- ha = (struct qla_host_ioctl *) host->hostdata;
--
-- DEBUG9(printk("%s post function called OK\n", __func__);)
--
-- ha->ioctl->MSIOCB_InProgress = 0;
-- ha->ioctl->ioctl_tov = 0;
--
-- up(&ha->ioctl->cmpl_sem);
--
-- DEBUG9(printk("%s: exiting.\n", __func__);)
--
-- return;
--}
--
--static uint32_t
--qim_get_host_count(void)
--{
-- uint32_t host_count = 0;
-- struct list_head *hal;
--
-- list_for_each(hal, *qim_hostlist_ptr)
-- host_count++;
--
-- DEBUG9(printk(
-- "qim_get_host_count: returning host_count=%d.\n",
-- host_count);)
--
-- return (host_count);
--}
--
--static int
--qim_validate_hostptr(struct qla_host_ioctl *ha)
--{
-- int ret = 0;
-- struct list_head *hal;
-- struct scsi_qla_host *drvr_ha;
--
--
-- DEBUG9(printk(
-- "qim_validate_hostptr: entered. assumed got hostlist lock.\n");)
--
-- /* Allocate our host_ioctl list */
-- list_for_each(hal, *qim_hostlist_ptr) {
-- drvr_ha = list_entry(hal, struct scsi_qla_host, list);
-- if (drvr_ha == ha->dr_data &&
-- drvr_ha->host_no == ha->host_no) {
-- /* our dr_data is assumed still valid */
-- break;
-- }
-- }
--
-- if (hal == NULL) {
-- /* not found. our dr_data is assumed no longer valid */
-- ret = -1;
-- }
--
-- DEBUG9(printk("qim_validate_hostptr: exiting.\n");)
--
-- return (ret);
--}
--
--
--/*************************************************************************
-- * qim_send_ioctl
-- *
-- * Description:
-- * Performs additional ioctl requests not satisfied by the upper levels.
-- *
-- * Returns:
-- * ret = 0 Success
-- * ret != 0 Failed; detailed status copied to EXT_IOCTL structure
-- * if possible
-- *************************************************************************/
--int
--qim_send_ioctl(struct scsi_device *dev, int cmd, void *arg)
--{
-- int mode = 0;
-- int tmp_rval = 0;
-- int ret = -EINVAL;
--
-- uint8_t *temp;
-- uint8_t tempbuf[8];
-- uint8_t wait_cnt;
-- uint32_t i;
-- uint32_t num_hosts = 0;
-- uint32_t status;
--
-- EXT_IOCTL *pext;
--
-- struct qla_host_ioctl *ha;
--
--
-- DEBUG9(printk("%s: entry to command (%x), arg (%p)\n",
-- __func__, cmd, arg);)
--
-- /* Catch any non-exioct ioctls */
-- if (_IOC_TYPE(cmd) != QLMULTIPATH_MAGIC) {
-- return (ret);
-- }
--
-- /* Allocate ioctl structure buffer to support multiple concurrent
-- * entries.
-- */
-- pext = kmalloc(sizeof(EXT_IOCTL), GFP_KERNEL);
-- if (pext == NULL) {
-- /* error */
-- printk(KERN_WARNING
-- "qim: ERROR in main ioctl buffer allocation.\n");
-- return (-ENOMEM);
-- }
--
-- DEBUG9(printk("%s: going to copy from user.\n",
-- __func__);)
--
-- /* copy in application layer EXT_IOCTL */
-- ret = copy_from_user(pext, arg, sizeof(EXT_IOCTL));
-- if (ret) {
-- DEBUG9_10(printk("%s: ERROR COPY_FROM_USER "
-- "EXT_IOCTL sturct. cmd=%x arg=%p.\n",
-- __func__, cmd, arg);)
--
-- kfree(pext);
-- return (ret);
-- }
--
-- /* check signature of this ioctl */
-- temp = (uint8_t *) &pext->Signature;
--
-- for (i = 0; i < 4; i++, temp++)
-- tempbuf[i] = *temp;
--
-- if ((tempbuf[0] == 'Q') && (tempbuf[1] == 'L') &&
-- (tempbuf[2] == 'O') && (tempbuf[3] == 'G'))
-- status = 0;
-- else
-- status = 1;
--
-- if (status != 0) {
-- DEBUG9_10(printk("%s: signature did not match. "
-- "cmd=%x arg=%p.\n", __func__, cmd, arg);)
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0) {
-- ret = -EFAULT;
-- }
--
-- kfree(pext);
-- return (ret);
-- }
--
-- /* check version of this ioctl */
-- if (pext->Version > EXT_VERSION) {
-- printk(KERN_WARNING
-- "qim: ioctl interface version not supported = %d.\n",
-- pext->Version);
--
-- kfree(pext);
-- return (-EINVAL);
-- }
--
-- DEBUG9(printk("%s: verified to be QLOGIC ioctl cmd.\n",
-- __func__);)
--
-- if (!(pext->VendorSpecificData & EXT_DEF_USE_HBASELECT)) {
-- /* Not supported */
--
-- DEBUG9_10(printk("%s: ERROR user not using "
-- "EXT_DEF_USE_HBASELECT bit.\n",
-- __func__);)
--
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0) {
-- ret = -EFAULT;
-- }
--
-- kfree(pext);
-- return (ret);
-- }
--
-- /* check for special cmds used during application's setup time. */
-- switch (cmd) {
-- case EXT_CC_GET_HBA_CNT:
-- DEBUG9(printk("%s: got startioctl command.\n", __func__);)
--
-- read_lock(*qim_hostlist_lock_ptr);
-- num_hosts = qim_get_host_count();
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- pext->Instance = num_hosts;
-- pext->Status = EXT_STATUS_OK;
-- ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
--
-- kfree(pext);
-- return (ret);
--
-- case EXT_CC_SETINSTANCE:
-- /* This call is used to return the HBA's host number to
-- * ioctl caller. All subsequent ioctl commands will put
-- * the host number in HbaSelect field to tell us which
-- * HBA is the destination.
-- */
-- DEBUG9(printk("%s: got set_instance cmd.\n",
-- __func__);)
--
-- read_lock(*qim_hostlist_lock_ptr);
-- num_hosts = qim_get_host_count();
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- if (pext->Instance < num_hosts) {
-- /*
-- * Return host number via pext->HbaSelect for
-- * specified API instance number.
-- */
-- if (qim_find_curr_ha(pext->Instance, &ha) != 0) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- ret = copy_to_user(arg, pext,
-- sizeof(EXT_IOCTL));
-- DEBUG9_10(printk("%s: SETINSTANCE invalid inst "
-- "%d. num_hosts=%d ha=%p ret=%d.\n",
-- __func__, pext->Instance, num_hosts, ha,
-- ret);)
--
-- kfree(pext);
-- return (ret); /* ioctl completed ok */
-- }
--
-- pext->HbaSelect = ha->host_no;
-- pext->Status = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s: Matching instance %d to hba "
-- "%ld.\n", __func__, pext->Instance, ha->host_no);)
-- } else {
-- DEBUG9_10(printk("%s: ERROR EXT_SETINSTANCE."
-- " Instance=%d num_hosts=%d ha=%p.\n",
-- __func__, pext->Instance, num_hosts, ha);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- }
-- ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-- if (ret)
-- ret = -EFAULT;
-- kfree(pext);
--
-- DEBUG9(printk("%s: SETINSTANCE exiting. ret=%d.\n",
-- __func__, ret);)
--
-- return (ret);
--
-- case EXT_CC_DRIVER_SPECIFIC:
-- if (qim_find_curr_ha(pext->HbaSelect, &ha) != 0) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-- } else {
-- ret = qim_get_driver_specifics(pext, ha);
-- tmp_rval = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
--
-- if (ret == 0 && tmp_rval != 0) {
-- DEBUG9_10(printk("%s: DRIVER_SPECIFIC copy "
-- "error. tmp_rval=%d.\n",
-- __func__, tmp_rval);)
-- ret = -EFAULT;
-- }
-- }
--
-- DEBUG9(printk("%s: DRIVER_SPECIFIC exiting. ret=%d estat=%d.\n",
-- __func__, ret, pext->Status);)
--
-- kfree(pext);
-- return (ret);
--
-- default:
-- break;
-- }
--
--
-- /* Use HbaSelect value to get a matching ha instance
-- * for this ioctl command.
-- */
-- if (qim_find_curr_ha(pext->HbaSelect, &ha) != 0) {
--
-- DEBUG9_10(printk("%s: ERROR matching pext->HbaSelect "
-- "%d to an HBA Instance.\n",
-- __func__, pext->HbaSelect);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0) {
-- ret = -EFAULT;
-- }
--
-- kfree(pext);
-- return (ret);
-- }
--
-- DEBUG9(printk("%s: active host_inst=%ld CC=%x SC=%x.\n",
-- __func__, ha->instance, cmd, pext->SubCode);)
--
-- /*
-- * Get permission to process ioctl command. Only one will proceed
-- * at a time.
-- */
-- if (qim_down_timeout(&ha->ioctl->access_sem,
-- QLA_IOCTL_ACCESS_WAIT_TIME * HZ) != 0) {
-- /* error timed out */
-- DEBUG9_10(printk("%s: ERROR timeout getting ioctl "
-- "access. host no=%d.\n", __func__, pext->HbaSelect);)
--
-- pext->Status = EXT_STATUS_BUSY;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0)
-- ret = -EFAULT;
--
-- kfree(pext);
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): going to get read lock on %p.\n",
-- __func__, ha->host_no, *qim_hostlist_lock_ptr);)
-- read_lock(*qim_hostlist_lock_ptr);
--
-- if (qim_validate_hostptr(ha) != 0) {
-- /* error hba no longer present?? */
-- DEBUG9_10(printk("%s: ERROR HBA not found.\n",
-- __func__);)
--
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0)
-- ret = -EFAULT;
--
-- kfree(pext);
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): going to test for dpc_active.\n",
-- __func__, ha->host_no);)
-- wait_cnt = 0;
-- while (test_bit(CFG_ACTIVE, &ha->dr_data->cfg_flags) ||
-- ha->dr_data->dpc_active) {
-- if (signal_pending(current))
-- break; /* get out */
--
-- set_current_state(TASK_INTERRUPTIBLE);
-- schedule_timeout(HZ);
-- wait_cnt++;
--
-- if (wait_cnt >= 5)
-- break;
-- }
--
-- if (test_bit(CFG_ACTIVE, &ha->dr_data->cfg_flags) ||
-- ha->dr_data->dpc_active) {
-- /* error hba not ready */
-- DEBUG9_10(printk("%s: ERROR HBA not ready for ioctl "
-- "access. host no=%d.\n", __func__, pext->HbaSelect);)
--
-- read_unlock(*qim_hostlist_lock_ptr);
--
-- pext->Status = EXT_STATUS_HBA_NOT_READY;
-- if ((ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL))) != 0)
-- ret = -EFAULT;
--
-- kfree(pext);
-- return (ret);
-- }
--
-- switch (cmd) { /* switch on EXT IOCTL COMMAND CODE */
--
-- case EXT_CC_QUERY:
-- DEBUG9(printk("%s: got query command.\n", __func__);)
--
-- ret = qim_query(ha, pext, 0);
--
-- break;
--
-- case EXT_CC_GET_DATA:
-- DEBUG9(printk("%s: got get_data command.\n", __func__);)
--
-- ret = qim_get_data(ha, pext, 0);
--
-- break;
--
-- case EXT_CC_SEND_SCSI_PASSTHRU:
-- DEBUG9(printk("%s: got SCSI passthru cmd.\n", __func__));
--
-- ret = qim_scsi_passthru(ha, pext, mode);
--
-- break;
--
--#if 0
-- case EXT_CC_REG_AEN:
-- ret = qim_aen_reg(ha, pext, mode);
--
-- break;
--
-- case EXT_CC_GET_AEN:
-- ret = qim_aen_get(ha, pext, mode);
--
-- break;
--#endif
--
-- case EXT_CC_WWPN_TO_SCSIADDR:
-- ret = qim_wwpn_to_scsiaddr(ha, pext, 0);
-- break;
--
-- case EXT_CC_SEND_ELS_PASSTHRU:
-- if (IS_QLA2100(ha->dr_data) || IS_QLA2200(ha->dr_data))
-- goto fail;
-- /*FALLTHROUGH*/
-- case EXT_CC_SEND_FCCT_PASSTHRU:
-- ret = qim_msiocb_passthru(ha, pext, cmd, mode);
--
-- break;
--
-- case EXT_CC_SEND_ELS_RNID:
-- DEBUG9(printk("%s: got ELS RNID cmd.\n", __func__));
--
-- ret = qim_send_els_rnid(ha, pext, mode);
-- break;
--
-- case EXT_CC_SET_DATA:
-- ret = qim_set_host_data(ha, pext, mode);
-- break;
--
-- case INT_CC_READ_NVRAM:
-- ret = qim_read_nvram(ha, pext, mode);
-- break;
--
-- case INT_CC_UPDATE_NVRAM:
-- ret = qim_update_nvram(ha, pext, mode);
-- break;
--
-- case INT_CC_LOOPBACK:
-- ret = qim_send_loopback(ha, pext, mode);
-- break;
--
-- case INT_CC_READ_OPTION_ROM:
-- ret = qim_read_option_rom(ha, pext, mode);
-- break;
--
-- case INT_CC_UPDATE_OPTION_ROM:
-- ret = qim_update_option_rom(ha, pext, mode);
-- break;
--
-- case INT_CC_GET_OPTION_ROM_LAYOUT:
-- ret = qim_get_option_rom_layout(ha, pext, mode);
-- break;
--
-- case INT_CC_GET_VPD:
-- ret = qim_get_vpd(ha, pext, mode);
-- break;
--
-- case INT_CC_UPDATE_VPD:
-- ret = qim_update_vpd(ha, pext, mode);
-- break;
--
-- /* all others go here */
-- /*
-- case EXT_CC_PLATFORM_REG:
-- break;
-- */
--
-- /* Failover IOCTLs */
-- case FO_CC_GET_PARAMS:
-- case FO_CC_SET_PARAMS:
-- case FO_CC_GET_PATHS:
-- case FO_CC_SET_CURRENT_PATH:
-- /*
-- case FO_CC_RESET_HBA_STAT:
-- case FO_CC_GET_HBA_STAT:
-- */
-- case FO_CC_GET_LUN_DATA:
-- case FO_CC_SET_LUN_DATA:
-- case FO_CC_GET_TARGET_DATA:
-- case FO_CC_SET_TARGET_DATA:
-- DEBUG9(printk("%s: failover arg (%p):\n", __func__, arg);)
--
-- qim_fo_ioctl(ha, cmd, pext, mode);
--
-- break;
--
-- default:
-- fail:
-- pext->Status = EXT_STATUS_INVALID_REQUEST;
-- break;
--
-- } /* end of CC decode switch */
--
-- read_unlock(*qim_hostlist_lock_ptr);
-- DEBUG9(printk("%s(%ld): unlocked hostlist_lock_ptr.\n",
-- __func__, ha->host_no);)
--
-- /* Always try to copy values back regardless what happened before. */
-- tmp_rval = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
--
-- if (ret == 0 && tmp_rval != 0)
-- ret = -EFAULT;
--
-- DEBUG9(printk("%s: exiting. tmp_rval(%d) ret(%d)\n",
-- __func__, tmp_rval, ret);)
--
-- up(&ha->ioctl->access_sem);
--
-- kfree(pext);
-- return (ret);
--}
--
--/*
-- * qim_alloc_ioctl_mem
-- * Allocates memory needed by IOCTL code.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_alloc_ioctl_mem(struct qla_host_ioctl *ha)
--{
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_new_ioctl_dma_mem(ha, QLA_INITIAL_IOCTLMEM_SIZE) !=
-- QIM_SUCCESS) {
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl physical memory allocation\n");
--
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
--
-- /* Allocate context memory buffer */
-- ha->ioctl = kmalloc(sizeof(struct hba_ioctl), GFP_KERNEL);
-- if (ha->ioctl == NULL) {
-- /* error */
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl context allocation.\n");
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(ha->ioctl, 0, sizeof(struct hba_ioctl));
--
--#if 0
--/* RLU: this need to be handled later */
-- /* Allocate AEN tracking buffer */
-- ha->ioctl->aen_tracking_queue =
-- kmalloc(EXT_DEF_MAX_AEN_QUEUE * sizeof(EXT_ASYNC_EVENT), GFP_KERNEL);
-- if (ha->ioctl->aen_tracking_queue == NULL) {
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl aen_queue allocation.\n");
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(ha->ioctl->aen_tracking_queue, 0,
-- EXT_DEF_MAX_AEN_QUEUE * sizeof(EXT_ASYNC_EVENT));
--#endif
--
-- ha->ioctl->ioctl_tq = kmalloc(sizeof(os_tgt_t), GFP_KERNEL);
-- if (ha->ioctl->ioctl_tq == NULL) {
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl tgt queue allocation.\n");
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(ha->ioctl->ioctl_tq, 0, sizeof(os_tgt_t));
--
-- ha->ioctl->ioctl_lq = kmalloc(sizeof(os_lun_t), GFP_KERNEL);
-- if (ha->ioctl->ioctl_lq == NULL) {
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl lun queue allocation.\n");
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(ha->ioctl->ioctl_lq, 0, sizeof(os_lun_t));
--
-- /* Pick the largest size we'll need per ha of all ioctl cmds.
-- * Use this size when freeing.
-- */
-- ha->ioctl->scrap_mem = kmalloc(QLA_IOCTL_SCRAP_SIZE, GFP_KERNEL);
-- if (ha->ioctl->scrap_mem == NULL) {
-- printk(KERN_WARNING
-- "qim: ERROR in ioctl scrap_mem allocation.\n");
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- memset(ha->ioctl->scrap_mem, 0, QLA_IOCTL_SCRAP_SIZE);
--
-- ha->ioctl->scrap_mem_size = QLA_IOCTL_SCRAP_SIZE;
-- ha->ioctl->scrap_mem_used = 0;
-- DEBUG9(printk("%s(%ld): scrap_mem_size=%d.\n",
-- __func__, ha->host_no, ha->ioctl->scrap_mem_size);)
--
-- ha->ioctl->ioctl_lq->q_state = LUN_STATE_READY;
-- ha->ioctl->ioctl_lq->q_lock = SPIN_LOCK_UNLOCKED;
--
-- init_MUTEX(&ha->ioctl->access_sem);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return QIM_SUCCESS;
--}
--
--/*
-- * qim_get_new_ioctl_dma_mem
-- * Allocates dma memory of the specified size.
-- * This is done to replace any previously allocated ioctl dma buffer.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_new_ioctl_dma_mem(struct qla_host_ioctl *ha, uint32_t size)
--{
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s entered.\n", __func__);)
--
-- if (ha->ioctl_mem) {
-- DEBUG9(printk("%s: ioctl_mem was previously allocated. "
-- "Dealloc old buffer.\n", __func__);)
--
-- /* free the memory first */
-- pci_free_consistent(dr_ha->pdev, ha->ioctl_mem_size, ha->ioctl_mem,
-- ha->ioctl_mem_phys);
-- }
--
-- /* Get consistent memory allocated for ioctl I/O operations. */
-- ha->ioctl_mem = dma_alloc_coherent(&dr_ha->pdev->dev, size,
-- &ha->ioctl_mem_phys, GFP_KERNEL);
-- if (ha->ioctl_mem == NULL) {
-- printk(KERN_WARNING
-- "%s: ERROR in ioctl physical memory allocation. "
-- "Requested length=%x.\n", __func__, size);
--
-- ha->ioctl_mem_size = 0;
-- return QLA_MEMORY_ALLOC_FAILED;
-- }
-- ha->ioctl_mem_size = size;
--
-- DEBUG9(printk("%s exiting.\n", __func__);)
--
-- return QIM_SUCCESS;
--}
--
--/*
-- * qim_free_ioctl_mem
-- * Frees memory used by IOCTL code for the specified ha.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Context:
-- * Kernel context.
-- */
--void
--qim_free_ioctl_mem(struct qla_host_ioctl *ha)
--{
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (ha->ioctl) {
-- kfree(ha->ioctl->scrap_mem);
-- ha->ioctl->scrap_mem = NULL;
-- ha->ioctl->scrap_mem_size = 0;
--
-- kfree(ha->ioctl->ioctl_tq);
-- ha->ioctl->ioctl_tq = NULL;
--
-- kfree(ha->ioctl->ioctl_lq);
-- ha->ioctl->ioctl_lq = NULL;
--
--#if 0
--/* RLU: this need to be handled later */
-- kfree(ha->ioctl->aen_tracking_queue);
-- ha->ioctl->aen_tracking_queue = NULL;
--#endif
--
-- kfree(ha->ioctl);
-- ha->ioctl = NULL;
-- }
--
-- /* free memory allocated for ioctl operations */
-- dma_free_coherent(&dr_ha->pdev->dev, ha->ioctl_mem_size, ha->ioctl_mem,
-- ha->ioctl_mem_phys);
-- ha->ioctl_mem = NULL;
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
--}
--
--/*
-- * qim_get_ioctl_scrap_mem
-- * Returns pointer to memory of the specified size from the scrap buffer.
-- * This can be called multiple times before the free call as long
-- * as the memory is to be used by the same ioctl command and
-- * there's still memory left in the scrap buffer.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * ppmem = pointer to return a buffer pointer.
-- * size = size of buffer to return.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_get_ioctl_scrap_mem(struct qla_host_ioctl *ha, void **ppmem, uint32_t size)
--{
-- int ret = QIM_SUCCESS;
-- uint32_t free_mem;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered. size=%d.\n",
-- __func__, ha->host_no, ha->instance, size);)
--
-- free_mem = ha->ioctl->scrap_mem_size - ha->ioctl->scrap_mem_used;
-- if (free_mem >= size) {
-- *ppmem = ha->ioctl->scrap_mem + ha->ioctl->scrap_mem_used;
-- ha->ioctl->scrap_mem_used += size;
-- } else {
-- DEBUG10(printk("%s(%ld): no more scrap memory.\n",
-- __func__, ha->host_no);)
--
-- ret = QIM_FAILED;
-- }
--
-- DEBUG9(printk("%s(%ld): exiting. ret=%d.\n",
-- __func__, ha->host_no, ret);)
--
-- return (ret);
--}
--
--/*
-- * qim_free_ioctl_scrap_mem
-- * Makes the entire scrap buffer free for use.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- */
--void
--qim_free_ioctl_scrap_mem(struct qla_host_ioctl *ha)
--{
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- memset(ha->ioctl->scrap_mem, 0, ha->ioctl->scrap_mem_size);
-- ha->ioctl->scrap_mem_used = 0;
--
-- DEBUG9(printk("%s(%ld): exiting.\n",
-- __func__, ha->host_no);)
--}
--
--/*
-- * qim_find_curr_ha
-- * Searches and returns the pointer to the adapter host_no specified.
-- *
-- * Input:
-- * host_inst = driver internal adapter instance number to search.
-- * ha = adapter state pointer of the instance requested.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--int
--qim_find_curr_ha(uint16_t host_inst, struct qla_host_ioctl **ret_ha)
--{
-- int rval = QIM_SUCCESS;
-- int found;
-- struct list_head *ioctll;
-- struct qla_host_ioctl *search_ha = NULL;
--
-- /*
-- * Set ha context for this IOCTL by matching host_no.
-- */
-- found = 0;
-- read_lock(&qim_haioctl_list_lock);
-- list_for_each(ioctll, &qim_haioctl_list) {
-- search_ha = list_entry(ioctll, struct qla_host_ioctl, list);
--
-- if (search_ha->instance == host_inst) {
-- found++;
-- break;
-- }
-- }
-- read_unlock(&qim_haioctl_list_lock);
--
-- if (!found) {
-- DEBUG10(printk("%s: ERROR matching host_inst "
-- "%d to an HBA Instance.\n", __func__, host_inst);)
-- rval = QIM_FAILED;
-- } else {
-- DEBUG9(printk("%s: found matching host_inst "
-- "%d to an HBA Instance.\n", __func__, host_inst);)
-- *ret_ha = search_ha;
-- }
--
-- return rval;
--}
--
--/*
-- * qim_get_driver_specifics
-- * Returns driver specific data in the response buffer.
-- *
-- * Input:
-- * pext = pointer to EXT_IOCTL structure containing values from user.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_driver_specifics(EXT_IOCTL *pext, struct qla_host_ioctl *ha)
--{
-- int ret = 0;
-- EXT_LN_DRIVER_DATA data;
--
-- DEBUG9(printk("%s: entered.\n", __func__);)
--
-- if (pext->ResponseLen < sizeof(EXT_LN_DRIVER_DATA)) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s: ERROR ResponseLen too small.\n",
-- __func__);)
--
-- return (ret);
-- }
--
-- data.DrvVer.Major = ha->drv_major;
-- data.DrvVer.Minor = ha->drv_minor;
-- data.DrvVer.Patch = ha->drv_patch;
-- data.DrvVer.Beta = ha->drv_beta;
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- &data, sizeof(EXT_LN_DRIVER_DATA));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s: ERROR copy resp buf = %d.\n",
-- __func__, ret);)
-- ret = -EFAULT;
-- } else {
-- pext->Status = EXT_STATUS_OK;
-- }
--
-- DEBUG9(printk("%s: exiting. ret=%d.\n", __func__, ret);)
--
-- return (ret);
--}
--
--#if 0
--/*
-- * qim_aen_reg
-- * IOCTL management server Asynchronous Event Tracking Enable/Disable.
-- *
-- * Input:
-- * ha = pointer to the adapter struct of the adapter to register.
-- * cmd = pointer to EXT_IOCTL structure containing values from user.
-- * mode = flags. not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_aen_reg(struct qla_host_ioctl *ha, EXT_IOCTL *cmd, int mode)
--{
-- int rval = 0;
-- EXT_REG_AEN reg_struct;
--
-- DEBUG9(printk("%s(%ld): inst %ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- rval = copy_from_user(&reg_struct, Q64BIT_TO_PTR(cmd->RequestAdr,
-- cmd->AddrMode), sizeof(EXT_REG_AEN));
-- if (rval == 0) {
-- cmd->Status = EXT_STATUS_OK;
-- if (reg_struct.Enable) {
-- ha->ioctl->flags |= IOCTL_AEN_TRACKING_ENABLE;
-- } else {
-- ha->ioctl->flags &= ~IOCTL_AEN_TRACKING_ENABLE;
-- }
-- } else {
-- DEBUG9(printk("%s(%ld): inst %ld copy error=%d.\n",
-- __func__, ha->host_no, ha->instance, rval);)
--
-- cmd->Status = EXT_STATUS_COPY_ERR;
-- rval = -EFAULT;
-- }
--
-- DEBUG9(printk("%s(%ld): inst %ld reg_struct.Enable(%d) "
-- "ha->ioctl_flag(%x) cmd->Status(%d).",
-- __func__, ha->host_no, ha->instance, reg_struct.Enable,
-- ha->ioctl->flags, cmd->Status);)
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (rval);
--}
--
--/*
-- * qim_aen_get
-- * Asynchronous Event Record Transfer to user.
-- * The entire queue will be emptied and transferred back.
-- *
-- * Input:
-- * ha = pointer to the adapter struct of the specified adapter.
-- * pext = pointer to EXT_IOCTL structure containing values from user.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- *
-- * NOTE: Need to use hardware lock to protect the queues from updates
-- * via isr/enqueue_aen after we get rid of io_request_lock.
-- */
--static int
--qim_aen_get(struct qla_host_ioctl *ha, EXT_IOCTL *cmd, int mode)
--{
-- int rval = 0;
-- EXT_ASYNC_EVENT *tmp_q;
-- EXT_ASYNC_EVENT *paen;
-- uint8_t i;
-- uint8_t queue_cnt;
-- uint8_t request_cnt;
-- uint32_t stat = EXT_STATUS_OK;
-- uint32_t ret_len = 0;
-- unsigned long cpu_flags = 0;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- request_cnt = (uint8_t)(cmd->ResponseLen / sizeof(EXT_ASYNC_EVENT));
--
-- if (request_cnt < EXT_DEF_MAX_AEN_QUEUE) {
-- /* We require caller to alloc for the maximum request count */
-- cmd->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s(%ld): inst=%ld Buffer size %ld too small. "
-- "Exiting normally.",
-- __func__, ha->host_no, ha->instance,
-- (ulong)cmd->ResponseLen);)
--
-- return (rval);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&paen,
-- sizeof(EXT_ASYNC_EVENT) * EXT_DEF_MAX_AEN_QUEUE)) {
-- /* not enough memory */
-- cmd->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_ASYNC_EVENT)*EXT_DEF_MAX_AEN_QUEUE);)
-- return (rval);
-- }
--
-- /* 1st: Make a local copy of the entire queue content. */
-- tmp_q = (EXT_ASYNC_EVENT *)ha->ioctl->aen_tracking_queue;
-- queue_cnt = 0;
--
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- i = ha->ioctl->aen_q_head;
--
-- for (; queue_cnt < EXT_DEF_MAX_AEN_QUEUE;) {
-- if (tmp_q[i].AsyncEventCode != 0) {
-- memcpy(&paen[queue_cnt], &tmp_q[i],
-- sizeof(EXT_ASYNC_EVENT));
-- queue_cnt++;
-- tmp_q[i].AsyncEventCode = 0; /* empty out the slot */
-- }
--
-- if (i == ha->ioctl->aen_q_tail) {
-- /* done. */
-- break;
-- }
--
-- i++;
--
-- if (i == EXT_DEF_MAX_AEN_QUEUE) {
-- i = 0;
-- }
-- }
--
-- /* Empty the queue. */
-- ha->ioctl->aen_q_head = 0;
-- ha->ioctl->aen_q_tail = 0;
--
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
--
-- /* 2nd: Now transfer the queue content to user buffer */
-- /* Copy the entire queue to user's buffer. */
-- ret_len = (uint32_t)(queue_cnt * sizeof(EXT_ASYNC_EVENT));
-- if (queue_cnt != 0) {
-- rval = copy_to_user(Q64BIT_TO_PTR(cmd->ResponseAdr,
-- cmd->AddrMode), paen, ret_len);
-- }
-- cmd->ResponseLen = ret_len;
--
-- if (rval != 0) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld copy FAILED. error = %d\n",
-- __func__, ha->host_no, ha->instance, rval);)
-- rval = -EFAULT;
-- stat = EXT_STATUS_COPY_ERR;
-- } else {
-- stat = EXT_STATUS_OK;
-- }
--
-- cmd->Status = stat;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting. rval=%d.\n",
-- __func__, ha->host_no, ha->instance, rval);)
--
-- return (rval);
--}
--#endif
--
--#if 0
--/*
-- * qim_enqueue_aen
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * event_code = async event code of the event to add to queue.
-- * payload = event payload for the queue.
-- *
-- * Context:
-- * Interrupt context.
-- * NOTE: Need to hold the hardware lock to protect the queues from
-- * aen_get after we get rid of the io_request_lock.
-- */
--void
--qim_enqueue_aen(struct qla_host_ioctl *ha, uint16_t event_code, void *payload)
--{
-- uint8_t new_entry; /* index to current entry */
-- uint16_t *mbx;
-- EXT_ASYNC_EVENT *aen_queue;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (!(ha->ioctl->flags & IOCTL_AEN_TRACKING_ENABLE))
-- return;
--
-- aen_queue = (EXT_ASYNC_EVENT *)ha->ioctl->aen_tracking_queue;
-- if (aen_queue[ha->ioctl->aen_q_tail].AsyncEventCode != 0) {
-- /* Need to change queue pointers to make room. */
--
-- /* Increment tail for adding new entry. */
-- ha->ioctl->aen_q_tail++;
-- if (ha->ioctl->aen_q_tail == EXT_DEF_MAX_AEN_QUEUE) {
-- ha->ioctl->aen_q_tail = 0;
-- }
--
-- if (ha->ioctl->aen_q_head == ha->ioctl->aen_q_tail) {
-- /*
-- * We're overwriting the oldest entry, so need to
-- * update the head pointer.
-- */
-- ha->ioctl->aen_q_head++;
-- if (ha->ioctl->aen_q_head == EXT_DEF_MAX_AEN_QUEUE) {
-- ha->ioctl->aen_q_head = 0;
-- }
-- }
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld Adding code 0x%x to aen_q %p @ %d\n",
-- __func__, ha->host_no, ha->instance, event_code, aen_queue,
-- ha->ioctl->aen_q_tail);)
--
-- new_entry = ha->ioctl->aen_q_tail;
-- aen_queue[new_entry].AsyncEventCode = event_code;
--
-- /* Update payload */
-- switch (event_code) {
-- case MBA_LIP_OCCURRED:
-- case MBA_LOOP_UP:
-- case MBA_LOOP_DOWN:
-- case MBA_LIP_RESET:
-- case MBA_PORT_UPDATE:
-- /* empty */
-- break;
--
-- case MBA_RSCN_UPDATE:
-- mbx = (uint16_t *)payload;
-- aen_queue[new_entry].Payload.RSCN.AddrFormat = MSB(mbx[1]);
-- /* domain */
-- aen_queue[new_entry].Payload.RSCN.RSCNInfo[0] = LSB(mbx[1]);
-- /* area */
-- aen_queue[new_entry].Payload.RSCN.RSCNInfo[1] = MSB(mbx[2]);
-- /* al_pa */
-- aen_queue[new_entry].Payload.RSCN.RSCNInfo[2] = LSB(mbx[2]);
--
-- break;
--
-- default:
-- /* Not supported */
-- aen_queue[new_entry].AsyncEventCode = 0;
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--}
--#endif
--
--/*
-- * qim_query
-- * Handles all subcommands of the EXT_CC_QUERY command.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int rval = 0;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* All Query type ioctls are done here */
-- switch(pext->SubCode) {
--
-- case EXT_SC_QUERY_HBA_NODE:
-- /* fill in HBA NODE Information */
-- rval = qim_query_hba_node(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_HBA_PORT:
-- /* return HBA PORT related info */
-- rval = qim_query_hba_port(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_DISC_PORT:
-- /* return discovered port information */
-- rval = qim_query_disc_port(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_DISC_TGT:
-- /* return discovered target information */
-- rval = qim_query_disc_tgt(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_CHIP:
-- rval = qim_query_chip(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_DISC_LUN:
-- pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
--
-- default:
-- DEBUG9_10(printk("%s(%ld): inst=%ld unknown SubCode %d.\n",
-- __func__, ha->host_no, ha->instance, pext->SubCode);)
-- pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
-- return rval;
--}
--
--/*
-- * qim_query_hba_node
-- * Handles EXT_SC_QUERY_HBA_NODE subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_hba_node(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint32_t i, transfer_size;
-- EXT_HBA_NODE *ptmp_hba_node;
-- uint8_t *next_str;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_hba_node,
-- sizeof(EXT_HBA_NODE))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_HBA_NODE));)
-- return (ret);
-- }
--
-- /* fill all available HBA NODE Information */
-- for (i = 0; i < 8 ; i++)
-- ptmp_hba_node->WWNN[i] = ha->node_name[i];
--
-- sprintf((char *)(ptmp_hba_node->Manufacturer), "QLogic Corporation");
-- sprintf((char *)(ptmp_hba_node->Model), dr_ha->model_number);
--
-- ptmp_hba_node->SerialNum[0] = dr_ha->serial0;
-- ptmp_hba_node->SerialNum[1] = dr_ha->serial1;
-- ptmp_hba_node->SerialNum[2] = dr_ha->serial2;
-- sprintf((char *)(ptmp_hba_node->DriverVersion), "ioctl-%s",
-- dr_ha->driver_verstr);
--
-- sprintf((char *)(ptmp_hba_node->FWVersion),"%2d.%02d.%02d",
-- dr_ha->fw_major_version,
-- dr_ha->fw_minor_version,
-- dr_ha->fw_subminor_version);
--
-- DEBUG9(printk("%s(%ld): inst=%ld, returning fw ver str= %s.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_hba_node->FWVersion);)
--
-- /* Option ROM version string. */
-- memset(ptmp_hba_node->OptRomVersion, 0,
-- sizeof(ptmp_hba_node->OptRomVersion));
-- next_str = ptmp_hba_node->OptRomVersion;
-- sprintf(next_str, "0.00");
-- if (test_bit(ROM_CODE_TYPE_BIOS, &ha->code_types)) {
-- sprintf(next_str, "%d.%02d", ha->bios_revision[1],
-- ha->bios_revision[0]);
-- }
-- DEBUG9(printk("%s(%ld): inst=%ld, returning bios ver str= %s.\n",
-- __func__, ha->host_no, ha->instance,
-- next_str);)
--
-- /* Extended Option ROM versions. */
-- ptmp_hba_node->BIValid = 0;
-- memset(ptmp_hba_node->BIEfiVersion, 0,
-- sizeof(ptmp_hba_node->BIEfiVersion));
-- memset(ptmp_hba_node->BIFCodeVersion, 0,
-- sizeof(ptmp_hba_node->BIFCodeVersion));
-- if (test_bit(ROM_CODE_TYPE_FCODE, &ha->code_types)) {
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- ptmp_hba_node->BIValid |= EXT_HN_BI_FCODE_VALID;
-- ptmp_hba_node->BIFCodeVersion[0] = ha->fcode_revision[1];
-- ptmp_hba_node->BIFCodeVersion[1] = ha->fcode_revision[0];
-- } else {
-- unsigned int barray[3];
--
-- memset (barray, 0, sizeof(barray));
-- ptmp_hba_node->BIValid |= EXT_HN_BI_FCODE_VALID;
-- sscanf(ha->fcode_revision, "%u.%u.%u", &barray[0],
-- &barray[1], &barray[2]);
-- ptmp_hba_node->BIFCodeVersion[0] = barray[0];
-- ptmp_hba_node->BIFCodeVersion[1] = barray[1];
-- ptmp_hba_node->BIFCodeVersion[2] = barray[2];
-- }
-- DEBUG9(printk(
-- "%s(%ld): inst=%ld, opt rom: fcode version = %d.%d.%d.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_hba_node->BIFCodeVersion[0],
-- ptmp_hba_node->BIFCodeVersion[1],
-- ptmp_hba_node->BIFCodeVersion[2]);)
-- }
-- if (test_bit(ROM_CODE_TYPE_EFI, &ha->code_types)) {
-- ptmp_hba_node->BIValid |= EXT_HN_BI_EFI_VALID;
-- ptmp_hba_node->BIEfiVersion[0] = ha->efi_revision[1];
-- ptmp_hba_node->BIEfiVersion[1] = ha->efi_revision[0];
--
-- DEBUG9(printk(
-- "%s(%ld): inst=%ld, opt rom: efi revision = %d.%d.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_hba_node->BIEfiVersion[0],
-- ptmp_hba_node->BIEfiVersion[1]);)
-- }
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- ptmp_hba_node->BIValid |= EXT_HN_BI_FW_VALID;
-- ptmp_hba_node->BIFwVersion[0] = ha->fw_revision[0];
-- ptmp_hba_node->BIFwVersion[1] = ha->fw_revision[1];
-- ptmp_hba_node->BIFwVersion[2] = ha->fw_revision[2];
-- ptmp_hba_node->BIFwVersion[3] = ha->fw_revision[3];
--
-- DEBUG9(printk(
-- "%s(%ld): inst=%ld, opt rom: fw revision = %d.%d.%d.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_hba_node->BIFwVersion[0],
-- ptmp_hba_node->BIFwVersion[1],
-- ptmp_hba_node->BIFwVersion[2]);)
-- }
--
-- ptmp_hba_node->InterfaceType = EXT_DEF_FC_INTF_TYPE;
-- ptmp_hba_node->PortCount = 1;
-- ptmp_hba_node->DriverAttr = 0;
--
-- /* now copy up the HBA_NODE to user */
-- if (pext->ResponseLen < sizeof(EXT_HBA_NODE))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_HBA_NODE);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_hba_node, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
--}
--
--/*
-- * qim_query_hba_port
-- * Handles EXT_SC_QUERY_HBA_PORT subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_hba_port(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint32_t tgt_cnt, tgt, transfer_size;
-- uint32_t port_cnt;
-- fc_port_t *fcport;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
-- EXT_HBA_PORT *ptmp_hba_port;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_hba_port,
-- sizeof(EXT_HBA_PORT))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_HBA_PORT));)
-- return (ret);
-- }
--
-- /* reflect all HBA PORT related info */
-- ptmp_hba_port->WWPN[7] = ha->port_name[7];
-- ptmp_hba_port->WWPN[6] = ha->port_name[6];
-- ptmp_hba_port->WWPN[5] = ha->port_name[5];
-- ptmp_hba_port->WWPN[4] = ha->port_name[4];
-- ptmp_hba_port->WWPN[3] = ha->port_name[3];
-- ptmp_hba_port->WWPN[2] = ha->port_name[2];
-- ptmp_hba_port->WWPN[1] = ha->port_name[1];
-- ptmp_hba_port->WWPN[0] = ha->port_name[0];
-- ptmp_hba_port->Id[0] = 0;
-- ptmp_hba_port->Id[1] = dr_ha->d_id.r.d_id[2];
-- ptmp_hba_port->Id[2] = dr_ha->d_id.r.d_id[1];
-- ptmp_hba_port->Id[3] = dr_ha->d_id.r.d_id[0];
-- ptmp_hba_port->Type = EXT_DEF_INITIATOR_DEV;
--
-- switch (dr_ha->current_topology) {
-- case ISP_CFG_NL:
-- case ISP_CFG_FL:
-- ptmp_hba_port->Mode = EXT_DEF_LOOP_MODE;
-- break;
--
-- case ISP_CFG_N:
-- case ISP_CFG_F:
-- ptmp_hba_port->Mode = EXT_DEF_P2P_MODE;
-- break;
--
-- default:
-- ptmp_hba_port->Mode = EXT_DEF_UNKNOWN_MODE;
-- break;
-- }
--
-- port_cnt = 0;
-- list_for_each_entry(fcport, &dr_ha->fcports, list) {
-- if (fcport->port_type != FCT_TARGET) {
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld port "
-- "%02x%02x%02x%02x%02x%02x%02x%02x not target dev\n",
-- __func__, ha->host_no, ha->instance,
-- fcport->port_name[0], fcport->port_name[1],
-- fcport->port_name[2], fcport->port_name[3],
-- fcport->port_name[4], fcport->port_name[5],
-- fcport->port_name[6], fcport->port_name[7]));
-- continue;
-- }
--
-- /* if removed or missing */
-- if (atomic_read(&fcport->state) != FCS_ONLINE) {
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld port "
-- "%02x%02x%02x%02x%02x%02x%02x%02x not online\n",
-- __func__, ha->host_no, ha->instance,
-- fcport->port_name[0], fcport->port_name[1],
-- fcport->port_name[2], fcport->port_name[3],
-- fcport->port_name[4], fcport->port_name[5],
-- fcport->port_name[6], fcport->port_name[7]));
-- continue;
-- }
-- port_cnt++;
-- }
--
-- tgt_cnt = 0;
-- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-- if (dr_ha->otgt[tgt] == NULL) {
-- continue;
-- }
-- if (dr_ha->otgt[tgt]->fcport == NULL) {
-- /* port doesn't exist */
-- DEBUG9(printk("%s(%ld): tgt %d port not exist.\n",
-- __func__, ha->host_no, tgt);)
-- continue;
-- }
-- tgt_cnt++;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld disc_port cnt=%d, tgt cnt=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- port_cnt, tgt_cnt);)
--
-- ptmp_hba_port->DiscPortCount = port_cnt;
-- ptmp_hba_port->DiscTargetCount = tgt_cnt;
--
-- if (atomic_read(&dr_ha->loop_state) == LOOP_DOWN ||
-- atomic_read(&dr_ha->loop_state) == LOOP_DEAD) {
-- ptmp_hba_port->State = EXT_DEF_HBA_LOOP_DOWN;
-- } else if (atomic_read(&dr_ha->loop_state) != LOOP_READY ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags)) {
--
-- ptmp_hba_port->State = EXT_DEF_HBA_SUSPENDED;
-- } else {
-- ptmp_hba_port->State = EXT_DEF_HBA_OK;
-- }
--
-- ptmp_hba_port->DiscPortNameType = EXT_DEF_USE_PORT_NAME;
--
-- /* Return supported FC4 type depending on driver support. */
-- ptmp_hba_port->PortSupportedFC4Types = EXT_DEF_FC4_TYPE_SCSI;
-- ptmp_hba_port->PortActiveFC4Types = EXT_DEF_FC4_TYPE_SCSI;
-- if (!IS_QLA2100(dr_ha) && !IS_QLA2200(dr_ha)) {
-- ptmp_hba_port->PortSupportedFC4Types |= EXT_DEF_FC4_TYPE_IP;
-- ptmp_hba_port->PortActiveFC4Types |= EXT_DEF_FC4_TYPE_IP;
-- }
--
-- /* Return supported speed depending on adapter type */
-- if (IS_QLA2100(dr_ha) || IS_QLA2200(dr_ha))
-- ptmp_hba_port->PortSupportedSpeed = EXT_DEF_PORTSPEED_1GBIT;
-- else
-- ptmp_hba_port->PortSupportedSpeed = EXT_DEF_PORTSPEED_2GBIT;
--
-- switch (dr_ha->link_data_rate) {
-- case 0:
-- ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_1GBIT;
-- break;
-- case 1:
-- ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_2GBIT;
-- break;
-- case 3:
-- ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_4GBIT;
-- break;
-- case 4:
-- ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_10GBIT;
-- break;
-- default:
-- /* unknown */
-- ptmp_hba_port->PortSpeed = 0;
-- break;
-- }
--
-- /* now copy up the HBA_PORT to user */
-- if (pext->ResponseLen < sizeof(EXT_HBA_PORT))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_HBA_PORT);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_hba_port, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return ret;
--}
--
--/*
-- * qim_query_disc_port
-- * Handles EXT_SC_QUERY_DISC_PORT subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_disc_port(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- int found;
-- uint32_t tgt, transfer_size, inst;
-- fc_port_t *fcport;
-- os_tgt_t *tq;
-- EXT_DISC_PORT *ptmp_disc_port;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered. Port inst=%02d.\n",
-- __func__, ha->host_no, ha->instance, pext->Instance);)
--
-- inst = 0;
-- found = 0;
-- fcport = NULL;
-- list_for_each_entry(fcport, &dr_ha->fcports, list) {
-- if(fcport->port_type != FCT_TARGET)
-- continue;
--
-- if (atomic_read(&fcport->state) != FCS_ONLINE) {
-- /* port does not exist anymore */
-- DEBUG9(printk("%s(%ld): fcport marked lost. "
-- "port=%02x%02x%02x%02x%02x%02x%02x%02x "
-- "loop_id=%02x not online.\n",
-- __func__, ha->host_no,
-- fcport->port_name[0], fcport->port_name[1],
-- fcport->port_name[2], fcport->port_name[3],
-- fcport->port_name[4], fcport->port_name[5],
-- fcport->port_name[6], fcport->port_name[7],
-- fcport->loop_id);)
-- continue;
-- }
--
-- if (inst != pext->Instance) {
-- DEBUG9(printk("%s(%ld): found fcport %02d "
-- "d_id=%02x%02x%02x. Skipping.\n",
-- __func__, ha->host_no, inst,
-- fcport->d_id.b.domain,
-- fcport->d_id.b.area,
-- fcport->d_id.b.al_pa));
--
-- inst++;
-- continue;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld found matching fcport %02d "
-- "online. d_id=%02x%02x%02x loop_id=%02x online.\n",
-- __func__, ha->host_no, ha->instance, inst,
-- fcport->d_id.b.domain,
-- fcport->d_id.b.area,
-- fcport->d_id.b.al_pa,
-- fcport->loop_id);)
--
-- /* Found the matching port still connected. */
-- found++;
-- break;
-- }
--
-- if (!found) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld dev not found.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_disc_port,
-- sizeof(EXT_DISC_PORT))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_DISC_PORT));)
-- return (ret);
-- }
--
-- memcpy(ptmp_disc_port->WWNN, fcport->node_name, WWN_SIZE);
-- memcpy(ptmp_disc_port->WWPN, fcport->port_name, WWN_SIZE);
--
-- ptmp_disc_port->Id[0] = 0;
-- ptmp_disc_port->Id[1] = fcport->d_id.r.d_id[2];
-- ptmp_disc_port->Id[2] = fcport->d_id.r.d_id[1];
-- ptmp_disc_port->Id[3] = fcport->d_id.r.d_id[0];
--
-- /* Currently all devices on fcport list are target capable devices */
-- /* This default value may need to be changed after we add non target
-- * devices also to this list.
-- */
-- ptmp_disc_port->Type = EXT_DEF_TARGET_DEV;
--
-- if (fcport->flags & FCF_FABRIC_DEVICE) {
-- ptmp_disc_port->Type |= EXT_DEF_FABRIC_DEV;
-- }
-- if (fcport->flags & FCF_TAPE_PRESENT) {
-- ptmp_disc_port->Type |= EXT_DEF_TAPE_DEV;
-- }
-- if (fcport->port_type == FCT_INITIATOR) {
-- ptmp_disc_port->Type |= EXT_DEF_INITIATOR_DEV;
-- }
--
-- ptmp_disc_port->LoopID = fcport->loop_id;
-- ptmp_disc_port->Status = 0;
-- ptmp_disc_port->Bus = 0;
--
-- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-- if ((tq = dr_ha->otgt[tgt]) == NULL) {
-- continue;
-- }
--
-- if (tq->fcport == NULL) /* dg 08/14/01 */
-- continue;
--
-- if (memcmp(fcport->port_name, tq->fcport->port_name,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- ptmp_disc_port->TargetId = tgt;
-- break;
-- }
-- }
--
-- /* now copy up the DISC_PORT to user */
-- if (pext->ResponseLen < sizeof(EXT_DISC_PORT))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_DISC_PORT);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_disc_port, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_query_disc_tgt
-- * Handles EXT_SC_QUERY_DISC_TGT subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_disc_tgt(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint32_t tgt, transfer_size, inst;
-- uint32_t cnt, i;
-- fc_port_t *tgt_fcport;
-- os_tgt_t *tq;
-- EXT_DISC_TARGET *ptmp_disc_target;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered for tgt inst %d.\n",
-- __func__, ha->host_no, ha->instance, pext->Instance);)
--
-- tq = NULL;
-- for (tgt = 0, inst = 0; tgt < MAX_TARGETS; tgt++) {
-- if (dr_ha->otgt[tgt] == NULL) {
-- continue;
-- }
-- /* if wrong target id then skip to next entry */
-- if (inst != pext->Instance) {
-- inst++;
-- continue;
-- }
-- tq = dr_ha->otgt[tgt];
-- break;
-- }
--
-- if (tq == NULL || tgt == MAX_TARGETS) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld target dev not found. "
-- "tq=%p, tgt=%d.\n",
-- __func__, ha->host_no, ha->instance, tq, tgt);)
-- return (ret);
-- }
--
-- if (tq->fcport == NULL) { /* dg 08/14/01 */
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld target %d port not found. "
-- "tq=%p.\n",
-- __func__, ha->host_no, ha->instance, tgt, tq);)
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_disc_target,
-- sizeof(EXT_DISC_TARGET))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_DISC_TARGET));)
-- return (ret);
-- }
--
-- tgt_fcport = tq->fcport;
-- if (tgt_fcport->flags & FCF_XP_DEVICE)
-- memcpy(ptmp_disc_target->WWNN, tq->node_name, WWN_SIZE);
-- else
-- memcpy(ptmp_disc_target->WWNN, tgt_fcport->node_name, WWN_SIZE);
-- memcpy(ptmp_disc_target->WWPN, tgt_fcport->port_name, WWN_SIZE);
--
-- ptmp_disc_target->Id[0] = 0;
-- ptmp_disc_target->Id[1] = tgt_fcport->d_id.r.d_id[2];
-- ptmp_disc_target->Id[2] = tgt_fcport->d_id.r.d_id[1];
-- ptmp_disc_target->Id[3] = tgt_fcport->d_id.r.d_id[0];
--
-- /* All devices on dr_ha->otgt list are target capable devices. */
-- ptmp_disc_target->Type = EXT_DEF_TARGET_DEV;
--
-- if (tgt_fcport->flags & FCF_FABRIC_DEVICE) {
-- ptmp_disc_target->Type |= EXT_DEF_FABRIC_DEV;
-- }
-- if (tgt_fcport->flags & FCF_TAPE_PRESENT) {
-- ptmp_disc_target->Type |= EXT_DEF_TAPE_DEV;
-- }
-- if (tgt_fcport->port_type & FCT_INITIATOR) {
-- ptmp_disc_target->Type |= EXT_DEF_INITIATOR_DEV;
-- }
--
-- ptmp_disc_target->LoopID = tgt_fcport->loop_id;
-- ptmp_disc_target->Status = 0;
-- if (atomic_read(&tq->fcport->state) != FCS_ONLINE) {
-- ptmp_disc_target->Status |= EXT_DEF_TGTSTAT_OFFLINE;
-- }
-- if (qim_is_fcport_in_config(dr_ha, tq->fcport)) {
-- ptmp_disc_target->Status |= EXT_DEF_TGTSTAT_IN_CFG;
-- }
--
-- ptmp_disc_target->Bus = 0;
-- ptmp_disc_target->TargetId = tgt;
--
-- cnt = 0;
-- /* enumerate available LUNs under this TGT (if any) */
-- if (dr_ha->otgt[tgt] != NULL) {
-- for (i = 0; i < MAX_LUNS ; i++) {
-- if ((dr_ha->otgt[tgt])->olun[i] !=0)
-- cnt++;
-- }
-- }
--
-- ptmp_disc_target->LunCount = cnt;
--
-- DEBUG9(printk("%s(%ld): copying data for tgt id %d. ",
-- __func__, ha->host_no, tgt);)
-- DEBUG9(printk("port=%p:%02x%02x%02x%02x%02x%02x%02x%02x. "
-- "lun cnt=%d.\n",
-- tgt_fcport,
-- tgt_fcport->port_name[0],
-- tgt_fcport->port_name[1],
-- tgt_fcport->port_name[2],
-- tgt_fcport->port_name[3],
-- tgt_fcport->port_name[4],
-- tgt_fcport->port_name[5],
-- tgt_fcport->port_name[6],
-- tgt_fcport->port_name[7],
-- cnt);)
--
-- /* now copy up the DISC_PORT to user */
-- if (pext->ResponseLen < sizeof(EXT_DISC_PORT))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_DISC_TARGET);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_disc_target, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_query_chip
-- * Handles EXT_SC_QUERY_CHIP subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_chip(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint32_t transfer_size, i;
-- EXT_CHIP *ptmp_isp;
-- struct Scsi_Host *host;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_isp,
-- sizeof(EXT_CHIP))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_CHIP));)
-- return (ret);
-- }
--
-- host = dr_ha->host;
-- ptmp_isp->VendorId = dr_ha->pdev->vendor;
-- ptmp_isp->DeviceId = dr_ha->pdev->device;
-- ptmp_isp->SubVendorId = dr_ha->pdev->subsystem_vendor;
-- ptmp_isp->SubSystemId = dr_ha->pdev->subsystem_device;
-- ptmp_isp->PciBusNumber = dr_ha->pdev->bus->number;
-- ptmp_isp->PciDevFunc = dr_ha->pdev->devfn;
-- ptmp_isp->PciSlotNumber = PCI_SLOT(dr_ha->pdev->devfn);
-- ptmp_isp->DomainNr = pci_domain_nr(dr_ha->pdev->bus);
-- /* These values are not 64bit architecture safe. */
-- ptmp_isp->IoAddr = 0; //(UINT32)dr_ha->pio_address;
-- ptmp_isp->IoAddrLen = 0; //(UINT32)dr_ha->pio_length;
-- ptmp_isp->MemAddr = 0; //(UINT32)dr_ha->mmio_address;
-- ptmp_isp->MemAddrLen = 0; //(UINT32)dr_ha->mmio_length;
-- ptmp_isp->ChipType = 0; /* ? */
-- ptmp_isp->InterruptLevel = dr_ha->pdev->irq;
--
-- for (i = 0; i < 8; i++)
-- ptmp_isp->OutMbx[i] = 0;
--
-- /* now copy up the ISP to user */
-- if (pext->ResponseLen < sizeof(EXT_CHIP))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_CHIP);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ptmp_isp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_get_data
-- * Handles all subcommands of the EXT_CC_GET_DATA command.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_data(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int tmp_rval = 0;
--
-- switch(pext->SubCode) {
-- case EXT_SC_GET_STATISTICS:
-- tmp_rval = qim_get_statistics(ha, pext, mode);
-- break;
--
-- case EXT_SC_GET_FC_STATISTICS:
-- tmp_rval = qim_get_fc_statistics(ha, pext, mode);
-- break;
--
-- case EXT_SC_GET_PORT_SUMMARY:
-- tmp_rval = qim_get_port_summary(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_DRIVER:
-- tmp_rval = qim_query_driver(ha, pext, mode);
-- break;
--
-- case EXT_SC_QUERY_FW:
-- tmp_rval = qim_query_fw(ha, pext, mode);
-- break;
--
-- case EXT_SC_GET_RNID:
-- tmp_rval = qim_get_rnid_params(ha, pext, mode);
-- break;
--
--#if 0
--/* RLU: this need to be handled later */
-- case EXT_SC_GET_BEACON_STATE:
-- if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-- tmp_rval = qim_get_led_state(ha, pext, mode);
-- break;
-- }
-- /*FALLTHROUGH*/
--
--#endif
-- default:
-- DEBUG10(printk("%s(%ld): inst=%ld unknown SubCode %d.\n",
-- __func__, ha->host_no, ha->instance, pext->SubCode);)
-- pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
-- }
--
-- return (tmp_rval);
--}
--
--/*
-- * qim_get_statistics
-- * Issues get_link_status mbx cmd and returns statistics
-- * relavent to the specified adapter.
-- *
-- * Input:
-- * ha = pointer to adapter struct of the specified adapter.
-- * pext = pointer to EXT_IOCTL structure containing values from user.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_statistics(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- EXT_HBA_PORT_STAT *ptmp_stat;
-- int ret = 0;
-- link_stat_t stat_buf;
-- uint8_t rval;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint16_t mb_stat[1];
-- uint32_t transfer_size;
-- struct scsi_qla_host *dr_ha;
--
-- dr_ha = ha->dr_data;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on loop down */
-- if ((!IS_QLA24XX(ha->dr_data) && !IS_QLA54XX(ha->dr_data) &&
-- atomic_read(&ha->dr_data->loop_state) != LOOP_READY) ||
-- test_bit(CFG_ACTIVE, &ha->dr_data->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &ha->dr_data->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &ha->dr_data->dpc_flags) ||
-- ha->dr_data->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
-- printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);
--
-- return (ret);
-- }
--
-- /* Send mailbox cmd to get additional link stats. */
-- if (IS_QLA24XX(ha->dr_data) || IS_QLA54XX(ha->dr_data))
-- rval = qim_get_isp_stats(ha, (uint32_t *)&stat_buf,
-- sizeof(stat_buf) / 4, 0, mb_stat);
-- else
-- rval = qim_get_link_status(ha, ha->dr_data->loop_id, 0,
-- &stat_buf, mb_stat);
--
-- if (rval != QIM_SUCCESS) {
-- if (rval == BIT_0) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- } else if (rval == BIT_1) {
-- pext->Status = EXT_STATUS_MAILBOX;
-- pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-- } else {
-- pext->Status = EXT_STATUS_ERR;
-- }
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR mailbox failed. "
-- "mb[0]=%x.\n",
-- __func__, ha->host_no, ha->instance, mb_stat[0]);)
-- printk(KERN_WARNING
-- "%s(%ld): inst=%ld ERROR mailbox failed. mb[0]=%x.\n",
-- __func__, ha->host_no, ha->instance, mb_stat[0]);
--
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_stat,
-- sizeof(EXT_HBA_PORT_STAT))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_HBA_PORT_STAT));)
-- return (ret);
-- }
--
-- ptmp_stat->ControllerErrorCount = dr_ha->total_isp_aborts;
-- ptmp_stat->DeviceErrorCount = dr_ha->total_dev_errs;
-- ptmp_stat->TotalIoCount = dr_ha->total_ios;
-- ptmp_stat->TotalMBytes = dr_ha->total_bytes >> 20;
-- ptmp_stat->TotalLipResets = dr_ha->total_lip_cnt;
-- /*
-- ptmp_stat->TotalInterrupts = dr_ha->total_isr_cnt;
-- */
--
-- ptmp_stat->TotalLinkFailures = stat_buf.link_fail_cnt;
-- ptmp_stat->TotalLossOfSync = stat_buf.loss_sync_cnt;
-- ptmp_stat->TotalLossOfSignals = stat_buf.loss_sig_cnt;
-- ptmp_stat->PrimitiveSeqProtocolErrorCount = stat_buf.prim_seq_err_cnt;
-- ptmp_stat->InvalidTransmissionWordCount = stat_buf.inval_xmit_word_cnt;
-- ptmp_stat->InvalidCRCCount = stat_buf.inval_crc_cnt;
--
-- /* now copy up the STATISTICS to user */
-- if (pext->ResponseLen < sizeof(EXT_HBA_PORT_STAT))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_HBA_PORT_STAT);
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-- kernel_tmp = (uint8_t *)ptmp_stat;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_get_fc_statistics
-- * Issues get_link_status mbx cmd to the target device with
-- * the specified WWN and returns statistics relavent to the
-- * device.
-- *
-- * Input:
-- * ha = pointer to adapter struct of the specified device.
-- * pext = pointer to EXT_IOCTL structure containing values from user.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_fc_statistics(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- EXT_HBA_PORT_STAT *ptmp_stat;
-- EXT_DEST_ADDR addr_struct;
-- fc_port_t *fcport;
-- int port_found;
-- link_stat_t stat_buf;
-- int ret = 0;
-- uint8_t rval;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint8_t *req_name;
-- uint16_t mb_stat[1];
-- uint32_t transfer_size;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- ret = copy_from_user(&addr_struct, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy req buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s:(%ld): going to find loopid for port "
-- "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no,
-- addr_struct.DestAddr.WWPN[0],
-- addr_struct.DestAddr.WWPN[1],
-- addr_struct.DestAddr.WWPN[2],
-- addr_struct.DestAddr.WWPN[3],
-- addr_struct.DestAddr.WWPN[4],
-- addr_struct.DestAddr.WWPN[5],
-- addr_struct.DestAddr.WWPN[6],
-- addr_struct.DestAddr.WWPN[7]));
--
-- /* find the device's loop_id */
-- port_found = 0;
-- fcport = NULL;
-- switch (addr_struct.DestType) {
-- case EXT_DEF_DESTTYPE_WWPN:
-- req_name = addr_struct.DestAddr.WWPN;
-- list_for_each_entry(fcport, &dr_ha->fcports, list) {
-- if (memcmp(fcport->port_name, req_name,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- port_found = 1;
-- break;
-- }
-- }
-- break;
--
-- case EXT_DEF_DESTTYPE_WWNN:
-- case EXT_DEF_DESTTYPE_PORTID:
-- case EXT_DEF_DESTTYPE_FABRIC:
-- case EXT_DEF_DESTTYPE_SCSI:
-- default:
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR Unsupported subcode "
-- "address type.\n", __func__, ha->host_no, ha->instance);)
-- return (ret);
--
-- break;
-- }
--
-- if (!port_found) {
-- /* not found */
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- pext->DetailStatus = EXT_DSTATUS_TARGET;
-- return (ret);
-- }
--
-- /* check for suspended/lost device */
-- /*
-- if (ha->fcport is suspended/lost) {
-- pext->Status = EXT_STATUS_SUSPENDED;
-- pext->DetailStatus = EXT_DSTATUS_TARGET;
-- return pext->Status;
-- }
-- */
--
-- /* check on loop down */
-- if (atomic_read(&dr_ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- dr_ha->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- DEBUG9(printk("%s:(%ld): going to call get_link_status with "
-- "loopid=%x.\n", __func__, ha->host_no, fcport->loop_id));
--
-- /* Send mailbox cmd to get more. */
-- if ((rval = qim_get_link_status(ha, fcport->loop_id, 0,
-- &stat_buf, mb_stat)) != QIM_SUCCESS) {
-- /* try again with D_ID */
-- DEBUG10(printk(
-- "%s(%ld): inst=%ld ERROR 1st mailbox failed. mb[0]=%x.\n",
-- __func__, ha->host_no, ha->instance, mb_stat[0]);)
--
-- if ((qim_get_link_status(ha, fcport->loop_id, BIT_3,
-- &stat_buf, mb_stat)) != QIM_SUCCESS) {
--
-- if (rval == BIT_0) {
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- } else if (rval == BIT_1) {
-- pext->Status = EXT_STATUS_MAILBOX;
-- pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-- } else {
-- pext->Status = EXT_STATUS_ERR;
-- }
--
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR mailbox failed. "
-- "mb[0]=%x.\n",
-- __func__, ha->host_no, ha->instance, mb_stat[0]);)
-- return (ret);
-- }
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptmp_stat,
-- sizeof(EXT_HBA_PORT_STAT))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_HBA_PORT_STAT));)
-- return (ret);
-- }
--
-- ptmp_stat->ControllerErrorCount = dr_ha->total_isp_aborts;
-- ptmp_stat->DeviceErrorCount = dr_ha->total_dev_errs;
-- ptmp_stat->TotalIoCount = dr_ha->total_ios;
-- ptmp_stat->TotalMBytes = dr_ha->total_bytes >> 20;
-- ptmp_stat->TotalLipResets = dr_ha->total_lip_cnt;
-- /*
-- ptmp_stat->TotalInterrupts = dr_ha->total_isr_cnt;
-- */
--
-- ptmp_stat->TotalLinkFailures = stat_buf.link_fail_cnt;
-- ptmp_stat->TotalLossOfSync = stat_buf.loss_sync_cnt;
-- ptmp_stat->TotalLossOfSignals = stat_buf.loss_sig_cnt;
-- ptmp_stat->PrimitiveSeqProtocolErrorCount = stat_buf.prim_seq_err_cnt;
-- ptmp_stat->InvalidTransmissionWordCount = stat_buf.inval_xmit_word_cnt;
-- ptmp_stat->InvalidCRCCount = stat_buf.inval_crc_cnt;
--
-- /* now copy up the STATISTICS to user */
-- if (pext->ResponseLen < sizeof(EXT_HBA_PORT_STAT))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_HBA_PORT_STAT);
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-- kernel_tmp = (uint8_t *)ptmp_stat;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_get_port_summary
-- * Handles EXT_SC_GET_PORT_SUMMARY subcommand.
-- * Returns values of devicedata and dd_entry list.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_port_summary(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t entry_cnt = 0;
-- uint32_t port_cnt = 0;
-- uint32_t top_xfr_size;
-- uint32_t usr_no_of_entries = 0;
-- uint32_t device_types;
-- void *start_of_entry_list;
-- fc_port_t *fcport;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- EXT_DEVICEDATA *pdevicedata;
-- EXT_DEVICEDATAENTRY *pdd_entry;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pdevicedata,
-- sizeof(EXT_DEVICEDATA))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "pdevicedata requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_DEVICEDATA));)
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pdd_entry,
-- sizeof(EXT_DEVICEDATAENTRY))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "pdd_entry requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_DEVICEDATAENTRY));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- /* Get device types to query. */
-- device_types = 0;
-- ret = copy_from_user(&device_types, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), sizeof(device_types));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-- "copy_from_user() of struct failed ret=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- /* Get maximum number of entries allowed in response buf */
-- usr_no_of_entries = pext->ResponseLen / sizeof(EXT_DEVICEDATAENTRY);
--
-- /* reserve some spaces to be filled in later. */
-- top_xfr_size = sizeof(pdevicedata->ReturnListEntryCount) +
-- sizeof(pdevicedata->TotalDevices);
--
-- start_of_entry_list = Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode) +
-- top_xfr_size;
--
-- /* Start copying from devices that exist. */
-- ret = qim_get_fcport_summary(ha, pdd_entry, start_of_entry_list,
-- device_types, usr_no_of_entries, &entry_cnt, &pext->Status);
--
-- DEBUG9(printk("%s(%ld): after get_fcport_summary, entry_cnt=%d.\n",
-- __func__, ha->host_no, entry_cnt);)
--
--#if 0
-- /* If there's still space in user buffer, return devices found
-- * in config file which don't actually exist (missing).
-- */
-- if (ret == 0) {
-- if (!qim_failover_enabled(ha)) {
-- ret = qim_std_missing_port_summary(ha, pdd_entry,
-- start_of_entry_list, usr_no_of_entries,
-- &entry_cnt, &pext->Status);
-- } else {
-- ret = qim_fo_missing_port_summary(ha, pdd_entry,
-- start_of_entry_list, usr_no_of_entries,
-- &entry_cnt, &pext->Status);
--
-- }
-- }
--
-- DEBUG9(printk(
-- "%s(%ld): after get_missing_port_summary. entry_cnt=%d.\n",
-- __func__, ha->host_no, entry_cnt);)
--#endif
--
-- if (ret) {
-- DEBUG9_10(printk("%s(%ld): failed getting port info.\n",
-- __func__, ha->host_no);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- pdevicedata->ReturnListEntryCount = entry_cnt;
-- list_for_each_entry(fcport, &dr_ha->fcports, list) {
-- if (fcport->port_type != FCT_TARGET)
-- continue;
--
-- port_cnt++;
-- }
-- if (port_cnt > entry_cnt)
-- pdevicedata->TotalDevices = port_cnt;
-- else
-- pdevicedata->TotalDevices = entry_cnt;
--
-- DEBUG9(printk("%s(%ld): inst=%ld EXT_SC_GET_PORT_SUMMARY "
-- "return entry cnt=%d port_cnt=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- entry_cnt, port_cnt);)
--
-- /* copy top of devicedata, which is everything other than the
-- * actual entry list data.
-- */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-- kernel_tmp = (uint8_t *)pdevicedata;
-- ret = copy_to_user(usr_temp, kernel_tmp, top_xfr_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp "
-- "devicedata buffer=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_get_fcport_summary
-- * Returns port values in user's dd_entry list.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pdd_entry = pointer to a temporary EXT_DEVICEDATAENTRY struct
-- * pstart_of_entry_list = start of user addr of buffer for dd_entry entries
-- * max_entries = max number of entries allowed by user buffer
-- * pentry_cnt = pointer to total number of entries so far
-- * ret_status = pointer to ioctl status field
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_fcport_summary(struct qla_host_ioctl *ha,
-- EXT_DEVICEDATAENTRY *pdd_entry, void *pstart_of_entry_list,
-- uint32_t device_types, uint32_t max_entries, uint32_t *pentry_cnt,
-- uint32_t *ret_status)
--{
-- int ret = QIM_SUCCESS;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t b;
-- uint32_t current_offset;
-- uint32_t tgt;
-- uint32_t transfer_size;
-- fc_port_t *fcport;
-- os_tgt_t *tq;
-- /*
-- uint16_t idx;
-- mp_host_t *host = NULL;
-- mp_device_t *tmp_dp = NULL;
-- */
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- list_for_each_entry(fcport, &dr_ha->fcports, list) {
-- if (*pentry_cnt >= max_entries)
-- break;
-- if (fcport->port_type != FCT_TARGET) {
-- /* Don't report initiators or broadcast devices. */
-- DEBUG2_9_10(printk("%s(%ld): not reporting non-target "
-- "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-- "port_type=%x.\n",
-- __func__, ha->host_no, fcport->port_name[0],
-- fcport->port_name[1], fcport->port_name[2],
-- fcport->port_name[3], fcport->port_name[4],
-- fcport->port_name[5], fcport->port_name[6],
-- fcport->port_name[7], fcport->port_type));
-- continue;
-- }
--
-- /*
-- if ((atomic_read(&fcport->state) != FCS_ONLINE) &&
-- !qim_is_fcport_in_config(dr_ha, fcport)) {
-- */
-- if (atomic_read(&fcport->state) != FCS_ONLINE) {
-- /* no need to report */
-- DEBUG2_9_10(printk("%s(%ld): not reporting "
-- "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-- "state=%i, flags=%02x.\n",
-- __func__, ha->host_no, fcport->port_name[0],
-- fcport->port_name[1], fcport->port_name[2],
-- fcport->port_name[3], fcport->port_name[4],
-- fcport->port_name[5], fcport->port_name[6],
-- fcport->port_name[7], atomic_read(&fcport->state),
-- fcport->flags));
-- continue;
-- }
--
-- /* copy from fcport to dd_entry */
--
-- for (b = 0; b < 3 ; b++)
-- pdd_entry->PortID[b] = fcport->d_id.r.d_id[2-b];
--
-- if (fcport->flags & FCF_FABRIC_DEVICE) {
-- pdd_entry->ControlFlags = EXT_DEF_GET_FABRIC_DEVICE;
-- } else {
-- pdd_entry->ControlFlags = 0;
-- }
--
-- pdd_entry->TargetAddress.Bus = 0;
-- /* Retrieve 'Target' number for port */
-- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-- if ((tq = dr_ha->otgt[tgt]) == NULL) {
-- continue;
-- }
--
-- if (tq->fcport == NULL)
-- continue;
--
-- if (memcmp(fcport->port_name, tq->fcport->port_name,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- pdd_entry->TargetAddress.Target = tgt;
-- if ((fcport->flags & FCF_XP_DEVICE) &&
-- !(device_types &
-- EXT_DEF_GET_TRUE_NN_DEVICE)) {
-- memcpy(pdd_entry->NodeWWN,
-- tq->node_name, WWN_SIZE);
-- } else {
-- memcpy(pdd_entry->NodeWWN,
-- fcport->node_name, WWN_SIZE);
-- }
-- break;
-- }
-- }
-- if (tgt == MAX_TARGETS) {
--#if 0
-- if (qim_failover_enabled(ha)) {
-- if (((host = qim_cfg_find_host(ha)) !=
-- NULL) && (fcport->flags & FCF_XP_DEVICE) &&
-- !(device_types &
-- EXT_DEF_GET_TRUE_NN_DEVICE)) {
-- if ((tmp_dp =
-- qim_find_mp_dev_by_portname(
-- host, fcport->port_name,
-- &idx)) != NULL)
-- memcpy(pdd_entry->NodeWWN,
-- tmp_dp->nodename, WWN_SIZE);
-- } else
-- memcpy(pdd_entry->NodeWWN,
-- fcport->node_name, WWN_SIZE);
-- } else
--#endif
-- memcpy(pdd_entry->NodeWWN, fcport->node_name,
-- WWN_SIZE);
-- }
-- memcpy(pdd_entry->PortWWN, fcport->port_name, WWN_SIZE);
--
-- pdd_entry->TargetAddress.Lun = 0;
-- pdd_entry->DeviceFlags = 0;
-- pdd_entry->LoopID = fcport->loop_id;
-- pdd_entry->BaseLunNumber = 0;
--
-- DEBUG9_10(printk("%s(%ld): reporting "
-- "fcport %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no, fcport->port_name[0],
-- fcport->port_name[1], fcport->port_name[2],
-- fcport->port_name[3], fcport->port_name[4],
-- fcport->port_name[5], fcport->port_name[6],
-- fcport->port_name[7]));
--
-- current_offset = *pentry_cnt * sizeof(EXT_DEVICEDATAENTRY);
--
-- transfer_size = sizeof(EXT_DEVICEDATAENTRY);
--
-- /* now copy up this dd_entry to user */
-- usr_temp = (uint8_t *)pstart_of_entry_list + current_offset;
-- kernel_tmp = (uint8_t *)pdd_entry;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-- if (ret) {
-- *ret_status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp "
-- "entry list buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- return (-EFAULT);
-- }
--
-- *pentry_cnt += 1;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--#if 0
--/* RLU: this need to be handled later */
--/*
-- * qim_fo_missing_port_summary is in qla_fo.c
-- */
--
--static int
--qim_std_missing_port_summary(struct qla_host_ioctl *ha,
-- EXT_DEVICEDATAENTRY *pdd_entry, void *pstart_of_entry_list,
-- uint32_t max_entries, uint32_t *pentry_cnt, uint32_t *ret_status)
--{
-- int ret = QIM_SUCCESS;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint16_t idx;
-- uint32_t b;
-- uint32_t current_offset;
-- uint32_t transfer_size;
-- os_tgt_t *tq;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- for (idx = 0; idx < MAX_FIBRE_DEVICES && *pentry_cnt < max_entries;
-- idx++) {
-- if ((tq = TGT_Q(ha, idx)) == NULL)
-- continue;
--
-- /* Target present in configuration data but
-- * missing during device discovery*/
-- if (tq->fcport == NULL) {
-- DEBUG10(printk("%s: returning missing device "
-- "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__,
-- tq->port_name[0],tq->port_name[1],
-- tq->port_name[2],tq->port_name[3],
-- tq->port_name[4],tq->port_name[5],
-- tq->port_name[6],tq->port_name[7]);)
--
-- /* This device was not found. Return
-- * as unconfigured.
-- */
-- memcpy(pdd_entry->NodeWWN, tq->node_name, WWN_SIZE);
-- memcpy(pdd_entry->PortWWN, tq->port_name, WWN_SIZE);
--
-- for (b = 0; b < 3 ; b++)
-- pdd_entry->PortID[b] = 0;
--
-- /* assume fabric dev so api won't translate
-- * the portid from loopid */
-- pdd_entry->ControlFlags = EXT_DEF_GET_FABRIC_DEVICE;
--
-- pdd_entry->TargetAddress.Bus = 0;
-- pdd_entry->TargetAddress.Target = idx;
-- pdd_entry->TargetAddress.Lun = 0;
-- pdd_entry->DeviceFlags = 0;
-- pdd_entry->LoopID = 0;
-- pdd_entry->BaseLunNumber = 0;
--
-- current_offset = *pentry_cnt *
-- sizeof(EXT_DEVICEDATAENTRY);
--
-- transfer_size = sizeof(EXT_DEVICEDATAENTRY);
--
-- /* now copy up this dd_entry to user */
-- usr_temp = (uint8_t *)pstart_of_entry_list +
-- current_offset;
-- kernel_tmp = (uint8_t *)pdd_entry;
-- ret = copy_to_user(usr_temp, kernel_tmp,
-- transfer_size);
-- if (ret) {
-- *ret_status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld "
-- "ERROR copy rsp list buffer.\n",
-- __func__, ha->host_no,
-- ha->instance);)
-- ret = -EFAULT;
-- break;
-- } else {
-- *pentry_cnt+=1;
-- }
-- }
-- if (ret || *ret_status)
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting. ret=%d.\n", __func__,
-- ha->host_no, ha->instance, ret);)
--
-- return (ret);
--}
--#endif
--
--/*
-- * qim_query_driver
-- * Handles EXT_SC_QUERY_DRIVER subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_driver(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t transfer_size;
-- EXT_DRIVER *pdriver_prop;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pdriver_prop,
-- sizeof(EXT_DRIVER))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_DRIVER));)
-- return (ret);
-- }
--
-- sprintf(pdriver_prop->Version, dr_ha->driver_verstr);
-- pdriver_prop->NumOfBus = MAX_BUSES;
-- pdriver_prop->TargetsPerBus = MAX_FIBRE_DEVICES;
-- pdriver_prop->LunsPerTarget = MAX_LUNS;
-- pdriver_prop->MaxTransferLen = 0xffffffff;
-- pdriver_prop->MaxDataSegments = dr_ha->host->sg_tablesize;
--
-- if (dr_ha->flags.enable_64bit_addressing == 1)
-- pdriver_prop->DmaBitAddresses = 64;
-- else
-- pdriver_prop->DmaBitAddresses = 32;
--
-- if (pext->ResponseLen < sizeof(EXT_DRIVER))
-- transfer_size = pext->ResponseLen;
-- else
-- transfer_size = sizeof(EXT_DRIVER);
--
-- /* now copy up the ISP to user */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-- kernel_tmp = (uint8_t *)pdriver_prop;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_query_fw
-- * Handles EXT_SC_QUERY_FW subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_query_fw(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t transfer_size;
-- EXT_FW *pfw_prop;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pfw_prop,
-- sizeof(EXT_FW))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_FW));)
-- return (ret);
-- }
--
-- pfw_prop->Version[0] = dr_ha->fw_major_version;
-- pfw_prop->Version[1] = dr_ha->fw_minor_version;
-- pfw_prop->Version[2] = dr_ha->fw_subminor_version;
--
-- transfer_size = sizeof(EXT_FW);
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-- kernel_tmp = (uint8_t *)pfw_prop;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--static int
--qim_msiocb_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int cmd,
-- int mode)
--{
-- int ret = 0;
-- fc_lun_t *ptemp_fclun = NULL; /* buf from scrap mem */
-- fc_port_t *ptemp_fcport = NULL; /* buf from scrap mem */
-- struct scsi_cmnd *pscsi_cmd = NULL; /* buf from scrap mem */
-- struct scsi_device *pscsi_dev = NULL; /* buf from scrap mem */
-- struct request *request = NULL;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on current topology */
-- if ((dr_ha->current_topology != ISP_CFG_F) &&
-- (dr_ha->current_topology != ISP_CFG_FL)) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR not in F/FL mode\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- if (ha->ioctl_mem_size <= 0) {
-- if (qim_get_new_ioctl_dma_mem(ha,
-- QLA_INITIAL_IOCTLMEM_SIZE) != QIM_SUCCESS) {
--
-- DEBUG9_10(printk("%s: ERROR cannot alloc DMA "
-- "buffer size=%x.\n",
-- __func__, QLA_INITIAL_IOCTLMEM_SIZE);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
-- }
--
-- if (pext->ResponseLen > ha->ioctl_mem_size) {
-- if (qim_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-- QIM_SUCCESS) {
--
-- DEBUG9_10(printk("%s: ERROR cannot alloc requested"
-- "DMA buffer size %x.\n",
-- __func__, pext->ResponseLen);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld rsp buf length larger than "
-- "existing size. Additional mem alloc successful.\n",
-- __func__, ha->host_no, ha->instance);)
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld req buf verified.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi_cmd,
-- sizeof(struct scsi_cmnd))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "cmd size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct scsi_cmnd));)
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi_dev,
-- sizeof(struct scsi_device))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "cmd size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct scsi_device));)
-- return (ret);
-- }
--
-- pscsi_cmd->device = pscsi_dev;
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&request,
-- sizeof(struct request))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct request));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
-- pscsi_cmd->request = request;
-- pscsi_cmd->request->nr_hw_segments = 1;
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptemp_fcport,
-- sizeof(fc_port_t))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "fcport size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(fc_port_t));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&ptemp_fclun,
-- sizeof(fc_lun_t))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "fclun size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(fc_lun_t));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- /* initialize */
-- memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
--
-- switch (cmd) {
-- case EXT_CC_SEND_FCCT_PASSTHRU:
-- DEBUG9(printk("%s: got CT passthru cmd.\n", __func__));
-- ret = qim_send_fcct(ha, pext, pscsi_cmd, ptemp_fcport,
-- ptemp_fclun, mode);
-- break;
--#if 0
-- case EXT_CC_SEND_ELS_PASSTHRU:
-- DEBUG9(printk("%s: got ELS passthru cmd.\n", __func__));
-- if (!IS_QLA2100(dr_ha) && !IS_QLA2200(dr_ha)) {
-- ret = qim_send_els_passthru(ha, pext, pscsi_cmd,
-- ptemp_fcport, ptemp_fclun, mode);
-- break;
-- }
--#endif
-- /*FALLTHROUGH */
-- default:
-- DEBUG9_10(printk("%s: got invalid cmd.\n", __func__));
-- break;
-- }
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--#if 0
--/* RLU: this need to be handled later */
--/*
-- * qim_send_els_passthru
-- * Passes the ELS command down to firmware as MSIOCB and
-- * copies the response back when it completes.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_send_els_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi_cmd, fc_port_t *ptmp_fcport, fc_lun_t *ptmp_fclun,
-- int mode)
--{
-- int ret = 0;
--
-- uint8_t invalid_wwn = 0;
-- uint8_t *ptmp_stat;
-- uint8_t *pusr_req_buf;
-- uint8_t *presp_payload;
-- uint32_t payload_len;
-- uint32_t usr_req_len;
--
-- int found;
-- uint16_t next_loop_id;
-- fc_port_t *fcport;
--
-- EXT_ELS_PT_REQ *pels_pt_req;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- usr_req_len = pext->RequestLen - sizeof(EXT_ELS_PT_REQ);
-- if (usr_req_len > ha->ioctl_mem_size) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR ReqLen too big=%x.\n",
-- __func__, ha->host_no, ha->instance, pext->RequestLen);)
--
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pels_pt_req,
-- sizeof(EXT_ELS_PT_REQ))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "els_pt_req size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_ELS_PT_REQ));)
-- return (ret);
-- }
--
-- /* copy request buffer */
--
-- ret = copy_from_user(pels_pt_req, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), sizeof(EXT_ELS_PT_REQ));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-- "copy_from_user() of struct failed (%d).\n",
-- __func__, ha->host_no, ha->instance, ret);)
--
-- return (-EFAULT);
-- }
--
-- pusr_req_buf = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode) + sizeof(EXT_ELS_PT_REQ);
--
-- ret = copy_from_user(ha->ioctl_mem, pusr_req_buf, usr_req_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-- "copy_from_user() of request buf failed (%d).\n",
-- __func__, ha->host_no, ha->instance, ret);)
--
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld after copy request.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on loop down (1) */
-- if (atomic_read(&ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {
--
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld before dest port validation- loop not "
-- "ready; cannot proceed.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_BUSY;
--
-- return (ret);
-- }
--
-- /*********************************/
-- /* Validate the destination port */
-- /*********************************/
--
-- /* first: WWN cannot be zero if no PID is specified */
-- invalid_wwn = qim_is_wwn_zero(pels_pt_req->WWPN);
-- if (invalid_wwn && !(pels_pt_req->ValidMask & EXT_DEF_PID_VALID)) {
-- /* error: both are not set. */
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR no valid WWPN/PID\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
--
-- /* second: it cannot be the local/current HBA itself */
-- if (!invalid_wwn) {
-- if (memcmp(ha->port_name, pels_pt_req->WWPN,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
--
-- /* local HBA specified. */
--
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR local HBA's "
-- "WWPN found.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
-- } else { /* using PID */
-- if (pels_pt_req->Id[1] == ha->d_id.r.d_id[2]
-- && pels_pt_req->Id[2] == ha->d_id.r.d_id[1]
-- && pels_pt_req->Id[3] == ha->d_id.r.d_id[0]) {
--
-- /* local HBA specified. */
--
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR local HBA's "
-- "PID found.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
-- }
--
-- /************************/
-- /* Now find the loop ID */
-- /************************/
--
-- found = 0;
-- fcport = NULL;
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (fcport->port_type != FCT_INITIATOR ||
-- fcport->port_type != FCT_TARGET)
-- continue;
--
-- if (!invalid_wwn) {
-- /* search with WWPN */
-- if (memcmp(pels_pt_req->WWPN, fcport->port_name,
-- EXT_DEF_WWN_NAME_SIZE))
-- continue;
-- } else {
-- /* search with PID */
-- if (pels_pt_req->Id[1] != fcport->d_id.r.d_id[2]
-- || pels_pt_req->Id[2] != fcport->d_id.r.d_id[1]
-- || pels_pt_req->Id[3] != fcport->d_id.r.d_id[0])
-- continue;
-- }
--
-- found++;
-- }
--
-- if (!found) {
-- /* invalid WWN or PID specified */
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR WWPN/PID invalid.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
--
-- /* If this is for a host device, check if we need to perform login */
-- if (fcport->port_type == FCT_INITIATOR &&
-- fcport->loop_id >= ha->last_loop_id) {
--
-- next_loop_id = 0;
-- ret = qim_fabric_login(ha, fcport, &next_loop_id);
-- if (ret != QIM_SUCCESS) {
-- /* login failed. */
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR login to "
-- "host port failed. loop_id=%02x pid=%02x%02x%02x "
-- "ret=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- fcport->loop_id, fcport->d_id.b.domain,
-- fcport->d_id.b.area, fcport->d_id.b.al_pa, ret);)
--
-- return (ret);
-- }
-- }
--
-- /* queue command */
-- pels_pt_req->Lid = fcport->loop_id;
--
-- if ((ret = qim_ioctl_ms_queuecommand(ha, pext, pscsi_cmd,
-- ptmp_fcport, ptmp_fclun, pels_pt_req))) {
-- return (ret);
-- }
--
-- /* check on data returned */
-- ptmp_stat = (uint8_t *)ha->ioctl_mem + FC_HEADER_LEN;
--
-- if (*ptmp_stat == ELS_STAT_LS_RJT) {
-- payload_len = FC_HEADER_LEN + ELS_RJT_LENGTH;
--
-- } else if (*ptmp_stat == ELS_STAT_LS_ACC) {
-- payload_len = pext->ResponseLen - sizeof(EXT_ELS_PT_REQ);
--
-- } else {
-- /* invalid. just copy the status word. */
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid stat "
-- "returned =0x%x.\n",
-- __func__, ha->host_no, ha->instance, *ptmp_stat);)
--
-- payload_len = FC_HEADER_LEN + 4;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld data dump-\n",
-- __func__, ha->host_no, ha->instance);)
-- DEBUG9(qim_dump_buffer((uint8_t *)ptmp_stat,
-- pext->ResponseLen - sizeof(EXT_ELS_PT_REQ) - FC_HEADER_LEN);)
--
-- /* Verify response buffer to be written */
-- /* The data returned include FC frame header */
-- presp_payload = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode) + sizeof(EXT_ELS_PT_REQ);
--
-- /* copy back data returned to response buffer */
-- ret = copy_to_user(presp_payload, ha->ioctl_mem, payload_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--#endif
--
--/*
-- * qim_send_fcct
-- * Passes the FC CT command down to firmware as MSIOCB and
-- * copies the response back when it completes.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_send_fcct(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi_cmd, fc_port_t *ptmp_fcport, fc_lun_t *ptmp_fclun,
-- int mode)
--{
-- int ret = 0;
-- int tmp_rval = 0;
-- uint16_t mb[MAILBOX_REGISTER_COUNT];
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (pext->RequestLen > ha->ioctl_mem_size) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR ReqLen too big=%x.\n",
-- __func__, ha->host_no, ha->instance, pext->RequestLen);)
--
-- return (ret);
-- }
--
-- /* copy request buffer */
-- ret = copy_from_user(ha->ioctl_mem, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf. ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
--
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld after copy request.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on management server login status */
-- if (dr_ha->flags.management_server_logged_in == 0) {
-- /* login to management server device */
--
-- tmp_rval = qim_login_fabric(dr_ha, MANAGEMENT_SERVER,
-- 0xff, 0xff, 0xfa, &mb[0], BIT_1);
--
-- if (tmp_rval != 0 || mb[0] != 0x4000) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
--
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR login to MS.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
--
-- dr_ha->flags.management_server_logged_in = 1;
-- }
--
-- DEBUG9(printk("%s(%ld): success login to MS.\n",
-- __func__, ha->host_no);)
--
-- /* queue command */
-- if ((ret = qim_ioctl_ms_queuecommand(ha, pext, pscsi_cmd,
-- ptmp_fcport, ptmp_fclun, NULL))) {
-- return (ret);
-- }
--
-- if ((CMD_COMPL_STATUS(pscsi_cmd) != 0 &&
-- CMD_COMPL_STATUS(pscsi_cmd) != CS_DATA_UNDERRUN &&
-- CMD_COMPL_STATUS(pscsi_cmd) != CS_DATA_OVERRUN)||
-- CMD_ENTRY_STATUS(pscsi_cmd) != 0) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld cmd returned error=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi_cmd));)
-- pext->Status = EXT_STATUS_ERR;
-- return (ret);
-- }
--
-- /* sending back data returned from Management Server */
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ha->ioctl_mem, pext->ResponseLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--static int
--qim_ioctl_ms_queuecommand(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi_cmd, fc_port_t *pfcport, fc_lun_t *pfclun,
-- EXT_ELS_PT_REQ *pels_pt_req)
--{
-- int ret = 0;
-- int tmp_rval = 0;
-- os_lun_t *plq;
-- os_tgt_t *ptq;
-- srb_t *sp = NULL;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- /* alloc sp */
-- if ((sp = qim_get_new_sp(dr_ha)) == NULL) {
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s: ERROR cannot alloc sp %p.\n",
-- __func__, sp);)
--
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld after alloc sp.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- DEBUG9(printk("%s(%ld): ioctl_tq=%p ioctl_lq=%p.\n",
-- __func__, ha->host_no, ha->ioctl->ioctl_tq, ha->ioctl->ioctl_lq);)
--
-- /* setup sp for this command */
-- ptq = ha->ioctl->ioctl_tq;
-- plq = ha->ioctl->ioctl_lq;
--
-- DEBUG9(printk("%s(%ld): pfclun=%p pfcport=%p pscsi_cmd=%p.\n",
-- __func__, ha->host_no, pfclun, pfcport, pscsi_cmd);)
--
-- sp->cmd = pscsi_cmd;
-- sp->flags = SRB_IOCTL;
-- sp->lun_queue = plq;
-- sp->tgt_queue = ptq;
-- pfclun->fcport = pfcport;
-- pfclun->lun = 0;
-- plq->fclun = pfclun;
-- plq->fclun->fcport->ha = dr_ha;
--
-- DEBUG9(printk("%s(%ld): pscsi_cmd->device=%p.\n",
-- __func__, ha->host_no, pscsi_cmd->device);)
--
-- /* init scsi_cmd */
-- pscsi_cmd->device->host = dr_ha->host;
-- pscsi_cmd->scsi_done = qim_msiocb_done;
--
-- /* check on loop down (2)- check again just before sending cmd out. */
-- if (atomic_read(&dr_ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags)) {
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld before issue cmd- loop "
-- "not ready.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_BUSY;
--
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
--
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld going to issue command.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- tmp_rval = qim_start_ms_cmd(ha, pext, sp, pels_pt_req);
--
-- DEBUG9(printk("%s(%ld): inst=%ld after issue command.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (tmp_rval != 0) {
-- /* We waited and post function did not get called */
-- DEBUG9_10(printk("%s(%ld): inst=%ld command timed out.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_MS_NO_RESPONSE;
--
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
--
-- return (ret);
-- }
--
-- return (ret);
--}
--
--
--/*
-- * qim_start_ms_cmd
-- * Allocates an MSIOCB request pkt and sends out the passthru cmd.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- *
-- * Returns:
-- * qim local function return status code.
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_start_ms_cmd(struct qla_host_ioctl *ha, EXT_IOCTL *pext, srb_t *sp,
-- EXT_ELS_PT_REQ *pels_pt_req)
--{
--#define ELS_REQUEST_RCTL 0x22
--#define ELS_REPLY_RCTL 0x23
--
--#if 0
-- uint32_t usr_req_len;
-- uint32_t usr_resp_len;
--
-- ms_iocb_entry_t *pkt;
-- unsigned long cpu_flags = 0;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--#endif
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
--#if 0
-- /* get spin lock for this operation */
-- spin_lock_irqsave(&dr_ha->hardware_lock, cpu_flags);
--
-- /* Get MS request packet. */
-- pkt = (ms_iocb_entry_t *)qim_ms_req_pkt(dr_ha, sp);
-- if (pkt == NULL) {
-- /* release spin lock and return error. */
-- spin_unlock_irqrestore(&dr_ha->hardware_lock, cpu_flags);
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld MSIOCB PT - could not get "
-- "Request Packet.\n", __func__, ha->host_no, ha->instance);)
-- return (QLA_MEMORY_ALLOC_FAILED);
-- }
--
-- usr_req_len = pext->RequestLen;
-- usr_resp_len = pext->ResponseLen;
--
-- if (IS_QLA24XX(dr_ha) || IS_QLA54XX(dr_ha)) {
-- struct ct_entry_24xx *ct_pkt;
-- struct els_entry_24xx *els_pkt;
--
-- ct_pkt = (struct ct_entry_24xx *)pkt;
-- els_pkt = (struct els_entry_24xx *)pkt;
--
-- if (pels_pt_req != NULL) {
-- /* ELS Passthru */
-- usr_req_len -= sizeof(EXT_ELS_PT_REQ);
-- usr_resp_len -= sizeof(EXT_ELS_PT_REQ);
--
-- els_pkt->entry_type = ELS_IOCB_TYPE;
-- els_pkt->entry_count = 1;
-- els_pkt->nport_handle = cpu_to_le16(pels_pt_req->Lid);
-- els_pkt->tx_dsd_count = __constant_cpu_to_le16(1);
-- els_pkt->rx_dsd_count = __constant_cpu_to_le16(1);
-- els_pkt->rx_byte_count = cpu_to_le32(usr_resp_len);
-- els_pkt->tx_byte_count = cpu_to_le32(usr_req_len);
-- els_pkt->sof_type = EST_SOFI3; /* assume class 3 */
-- els_pkt->opcode = 0;
-- els_pkt->control_flags = 0;
--
-- if (pext->ResponseLen == 0) {
-- memcpy(els_pkt->port_id, &pels_pt_req->Id[1],
-- 3);
-- }
--
-- els_pkt->tx_address[0] =
-- cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- els_pkt->tx_address[1] =
-- cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- els_pkt->tx_len = els_pkt->tx_byte_count;
-- els_pkt->rx_address[0] =
-- cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- els_pkt->rx_address[1] =
-- cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- els_pkt->rx_len = els_pkt->rx_byte_count;
-- } else {
-- /* CT Passthru */
-- ct_pkt->entry_type = CT_IOCB_TYPE;
-- ct_pkt->entry_count = 1;
-- ct_pkt->nport_handle =
-- __constant_cpu_to_le16(NPH_SNS);
-- ct_pkt->timeout = cpu_to_le16(ql2xioctltimeout);
-- ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
-- ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
-- ct_pkt->rsp_byte_count = cpu_to_le32(usr_resp_len);
-- ct_pkt->cmd_byte_count = cpu_to_le32(usr_req_len);
-- ct_pkt->dseg_0_address[0] =
-- cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- ct_pkt->dseg_0_address[1] =
-- cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
-- ct_pkt->dseg_1_address[0] =
-- cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- ct_pkt->dseg_1_address[1] =
-- cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
-- }
-- } else {
-- pkt->entry_type = MS_IOCB_TYPE;
-- pkt->entry_count = 1;
--
-- if (pels_pt_req != NULL) {
-- /* process ELS passthru command */
-- usr_req_len -= sizeof(EXT_ELS_PT_REQ);
-- usr_resp_len -= sizeof(EXT_ELS_PT_REQ);
--
-- /* ELS passthru enabled */
-- pkt->control_flags = cpu_to_le16(BIT_15);
-- SET_TARGET_ID(dr_ha, pkt->loop_id, pels_pt_req->Lid);
-- pkt->type = 1; /* ELS frame */
--
-- if (pext->ResponseLen != 0) {
-- pkt->r_ctl = ELS_REQUEST_RCTL;
-- pkt->rx_id = 0;
-- } else {
-- pkt->r_ctl = ELS_REPLY_RCTL;
-- pkt->rx_id =
-- cpu_to_le16(pels_pt_req->Rxid);
-- }
-- } else {
-- usr_req_len = pext->RequestLen;
-- usr_resp_len = pext->ResponseLen;
-- SET_TARGET_ID(dr_ha, pkt->loop_id, MANAGEMENT_SERVER);
-- }
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld using loop_id=%02x "
-- "req_len=%d, resp_len=%d. Initializing pkt.\n",
-- __func__, ha->host_no, ha->instance,
-- pkt->loop_id.extended, usr_req_len, usr_resp_len);)
--
-- pkt->timeout = cpu_to_le16(ql2xioctltimeout);
-- pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
-- pkt->total_dsd_count = __constant_cpu_to_le16(2);
-- pkt->rsp_bytecount = cpu_to_le32(usr_resp_len);
-- pkt->req_bytecount = cpu_to_le32(usr_req_len);
--
-- /*
-- * Loading command payload address. user request is assumed
-- * to have been copied to ioctl_mem.
-- */
-- pkt->dseg_req_address[0] = cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- pkt->dseg_req_address[1] = cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- pkt->dseg_req_length = cpu_to_le32(usr_req_len);
--
-- /* loading response payload address */
-- pkt->dseg_rsp_address[0] = cpu_to_le32(LSD(ha->ioctl_mem_phys));
-- pkt->dseg_rsp_address[1] =cpu_to_le32(MSD(ha->ioctl_mem_phys));
-- pkt->dseg_rsp_length = cpu_to_le32(usr_resp_len);
-- }
--
-- /* set flag to indicate IOCTL MSIOCB cmd in progress */
-- ha->ioctl->MSIOCB_InProgress = 1;
-- ha->ioctl->ioctl_tov = pkt->timeout + 1; /* 1 second more */
--
-- /* prepare for receiving completion. */
-- qim_ioctl_sem_init(ha);
--
-- /* Issue command to ISP */
-- qim_isp_cmd(dr_ha);
--
-- ha->ioctl->cmpl_timer.expires = jiffies + ha->ioctl->ioctl_tov * HZ;
-- add_timer(&ha->ioctl->cmpl_timer);
--
-- DEBUG9(printk("%s(%ld): inst=%ld releasing hardware_lock.\n",
-- __func__, ha->host_no, ha->instance);)
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
--
-- DEBUG9(printk("%s(%ld): inst=%ld sleep for completion.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- down(&ha->ioctl->cmpl_sem);
--
-- del_timer(&ha->ioctl->cmpl_timer);
--
-- if (ha->ioctl->MSIOCB_InProgress == 1) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld timed out. exiting.\n",
-- __func__, ha->host_no, ha->instance);)
-- return QIM_FAILED;
-- }
--
--#endif
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return QIM_SUCCESS;
--}
--
--/*
-- * qim_wwpn_to_scsiaddr
-- * Handles the EXT_CC_WWPN_TO_SCSIADDR command.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_wwpn_to_scsiaddr(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- fc_port_t *tgt_fcport;
-- os_tgt_t *tq;
-- uint8_t tmp_wwpn[EXT_DEF_WWN_NAME_SIZE];
-- uint32_t b, tgt, l;
-- EXT_SCSI_ADDR tmp_addr;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (pext->RequestLen != EXT_DEF_WWN_NAME_SIZE ||
-- pext->ResponseLen < sizeof(EXT_SCSI_ADDR)) {
-- /* error */
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid WWN buffer size %d "
-- "received.\n",
-- __func__, ha->host_no, ha->instance, pext->ResponseLen);)
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- return (ret);
-- }
--
-- ret = copy_from_user(tmp_wwpn, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (ret) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy_from_user "
-- "failed(%d) on request buf.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- pext->Status = EXT_STATUS_COPY_ERR;
-- return (-EFAULT);
-- }
--
-- tq = NULL;
-- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-- if (dr_ha->otgt[tgt] == NULL) {
-- continue;
-- }
--
-- tq = dr_ha->otgt[tgt];
-- if (tq->fcport == NULL) {
-- break;
-- }
--
-- tgt_fcport = tq->fcport;
-- if (memcmp(tmp_wwpn, tgt_fcport->port_name,
-- EXT_DEF_WWN_NAME_SIZE) == 0) {
-- break;
-- }
-- }
--
-- if (tq == NULL || tgt >= MAX_TARGETS) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld target dev not found. "
-- "tq=%p, tgt=%x.\n", __func__, ha->host_no, ha->instance,
-- tq, tgt);)
-- return (ret);
-- }
--
-- if (tq->fcport == NULL) { /* dg 08/14/01 */
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld target port not found. "
-- "tq=%p, tgt=%x.\n",
-- __func__, ha->host_no, ha->instance, tq, tgt);)
-- return (ret);
-- }
--
-- /* Currently we only have bus 0 and no translation on LUN */
-- b = 0;
-- l = 0;
--
-- /*
-- * Return SCSI address. Currently no translation is done for
-- * LUN.
-- */
-- tmp_addr.Bus = b;
-- tmp_addr.Target = tgt;
-- tmp_addr.Lun = l;
-- if (pext->ResponseLen > sizeof(EXT_SCSI_ADDR))
-- pext->ResponseLen = sizeof(EXT_SCSI_ADDR);
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- &tmp_addr, pext->ResponseLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- DEBUG9(printk(KERN_INFO
-- "%s(%ld): Found t%d l%d for %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no,
-- tmp_addr.Target, tmp_addr.Lun,
-- tmp_wwpn[0], tmp_wwpn[1], tmp_wwpn[2], tmp_wwpn[3],
-- tmp_wwpn[4], tmp_wwpn[5], tmp_wwpn[6], tmp_wwpn[7]);)
--
-- pext->Status = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_scsi_passthru
-- * Handles all subcommands of the EXT_CC_SEND_SCSI_PASSTHRU command.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_scsi_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- struct scsi_cmnd *pscsi_cmd = NULL;
-- struct scsi_device *pscsi_device = NULL;
-- struct request *request = NULL;
--
-- DEBUG9(printk("%s(%ld): entered.\n",
-- __func__, ha->host_no);)
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi_cmd,
-- sizeof(struct scsi_cmnd))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct scsi_cmnd));)
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi_device,
-- sizeof(struct scsi_device))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct scsi_device));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
-- pscsi_cmd->device = pscsi_device;
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&request,
-- sizeof(struct request))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(struct request));)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
-- pscsi_cmd->request = request;
-- pscsi_cmd->request->nr_hw_segments = 1;
--
-- switch(pext->SubCode) {
-- case EXT_SC_SEND_SCSI_PASSTHRU:
-- DEBUG9(printk("%s(%ld): got SCSI passthru cmd.\n",
-- __func__, ha->host_no);)
-- ret = qim_sc_scsi_passthru(ha, pext, pscsi_cmd,
-- pscsi_device, mode);
-- break;
-- case EXT_SC_SEND_FC_SCSI_PASSTHRU:
-- DEBUG9(printk("%s(%ld): got FC SCSI passthru cmd.\n",
-- __func__, ha->host_no);)
-- ret = qim_sc_fc_scsi_passthru(ha, pext, pscsi_cmd,
-- pscsi_device, mode);
-- break;
--#if 0
--/* RLU: this need to be handled later */
-- case EXT_SC_SCSI3_PASSTHRU:
-- DEBUG9(printk("%s(%ld): got SCSI3 passthru cmd.\n",
-- __func__, ha->host_no);)
-- ret = qim_sc_scsi3_passthru(ha, pext, pscsi_cmd,
-- pscsi_device, mode);
-- break;
--#endif
-- default:
-- DEBUG9_10(printk("%s: got invalid cmd.\n", __func__));
-- break;
-- }
--
-- qim_free_ioctl_scrap_mem(ha);
--
-- DEBUG9(printk("%s(%ld): exiting.\n",
-- __func__, ha->host_no);)
--
-- return (ret);
--}
--
--/* RLU: this need to be handled later */
--/**************************************************************************
--* qim_check_tgt_status
--*
--* Description:
--* Checks to see if the target or loop is down.
--*
--* Input:
--* cmd - pointer to Scsi cmd structure
--*
--* Returns:
--* 1 - if target is present
--* 0 - if target is not present
--*
--**************************************************************************/
--static int
--qim_check_tgt_status(struct scsi_qla_host *dr_ha, struct scsi_cmnd *cmd)
--{
-- os_lun_t *lq;
-- unsigned int b, t, l;
-- fc_port_t *fcport;
--
-- /* Generate LU queue on bus, target, LUN */
-- b = cmd->device->channel;
-- t = cmd->device->id;
-- l = cmd->device->lun;
--
-- if ((lq = GET_LU_Q(dr_ha,t,l)) == NULL) {
-- return (QIM_FAILED);
-- }
--
-- fcport = lq->fclun->fcport;
--
-- if (TGT_Q(dr_ha, t) == NULL ||
-- l >= dr_ha->max_luns ||
-- atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-- atomic_read(&dr_ha->loop_state) == LOOP_DEAD ||
-- (!atomic_read(&dr_ha->loop_down_timer) &&
-- atomic_read(&dr_ha->loop_state) == LOOP_DOWN) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- atomic_read(&dr_ha->loop_state) != LOOP_READY) {
--
-- DEBUG(printk(KERN_INFO
-- "scsi(%ld:%2d:%2d:%2d): %s connection is down\n",
-- dr_ha->host_no,
-- b, t, l,
-- __func__));
--
-- cmd->result = DID_NO_CONNECT << 16;
-- return (QIM_FAILED);
-- }
-- return (QIM_SUCCESS);
--}
--
--/**************************************************************************
--* qim_check_port_status
--*
--* Description:
--* Checks to see if the port or loop is down.
--*
--* Input:
--* fcport - pointer to fc_port_t structure.
--*
--* Returns:
--* 1 - if port is present
--* 0 - if port is not present
--*
--**************************************************************************/
--static int
--qim_check_port_status(struct scsi_qla_host *dr_ha, fc_port_t *fcport)
--{
-- if (fcport == NULL) {
-- return (QIM_FAILED);
-- }
--
-- if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-- atomic_read(&dr_ha->loop_state) == LOOP_DEAD) {
-- return (QIM_FAILED);
-- }
--
-- if ((atomic_read(&fcport->state) != FCS_ONLINE) ||
-- (!atomic_read(&dr_ha->loop_down_timer) &&
-- atomic_read(&dr_ha->loop_state) == LOOP_DOWN) ||
-- (test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags)) ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- atomic_read(&dr_ha->loop_state) != LOOP_READY) {
--
-- DEBUG(printk(KERN_INFO
-- "scsi(%ld): Connection is down. fcport=%p.\n",
-- dr_ha->host_no, fcport));
--
-- return (QLA_BUSY);
-- }
--
-- return (QIM_SUCCESS);
--}
--
--/*
-- * This routine will allocate SP from the free queue
-- * input:
-- * scsi_qla_host_t *
-- * output:
-- * srb_t * or NULL
-- */
--static srb_t *
--qim_get_new_sp(scsi_qla_host_t *dr_ha)
--{
-- srb_t *sp;
--
-- sp = mempool_alloc(dr_ha->srb_mempool, GFP_ATOMIC);
-- if (sp)
-- atomic_set(&sp->ref_count, 1);
-- return (sp);
--}
--
--/**
-- * qim_req_pkt() - Retrieve a request packet from the request ring.
-- * @ha: HA context
-- *
-- * Note: The caller must hold the hardware lock before calling this routine.
-- *
-- * Returns NULL if function failed, else, a pointer to the request packet.
-- */
--static request_t *
--qim_req_pkt(scsi_qla_host_t *ha)
--{
-- device_reg_t __iomem *reg = ha->iobase;
-- struct device_reg_24xx __iomem *reg24 =
-- (struct device_reg_24xx __iomem *) ha->iobase;
-- request_t *pkt = NULL;
-- uint16_t cnt;
-- uint32_t *dword_ptr;
-- uint16_t req_cnt = 1;
--
--
-- if ((req_cnt + 2) >= ha->req_q_cnt) {
-- /* Calculate number of free request entries. */
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- cnt = (uint16_t)RD_REG_DWORD(&reg24->req_q_out);
-- else
-- cnt = qla2x00_debounce_register(
-- ISP_REQ_Q_OUT(ha, reg));
-- if (ha->req_ring_index < cnt)
-- ha->req_q_cnt = cnt - ha->req_ring_index;
-- else
-- ha->req_q_cnt = ha->request_q_length -
-- (ha->req_ring_index - cnt);
-- }
-- /* If room for request in request ring. */
-- if ((req_cnt + 2) < ha->req_q_cnt) {
-- ha->req_q_cnt--;
-- pkt = ha->request_ring_ptr;
--
-- /* Zero out packet. */
-- dword_ptr = (uint32_t *)pkt;
-- for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++)
-- *dword_ptr++ = 0;
--
-- /* Set system defined field. */
-- pkt->sys_define = (uint8_t)ha->req_ring_index;
--
-- /* Set entry count. */
-- pkt->entry_count = 1;
--
-- }
--
-- if (!pkt) {
-- DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
-- }
--
-- return (pkt);
--}
--
--/**
-- * qim_isp_cmd() - Modify the request ring pointer.
-- * @ha: HA context
-- *
-- * Note: The caller must hold the hardware lock before calling this routine.
-- */
--void
--qim_isp_cmd(scsi_qla_host_t *ha)
--{
-- device_reg_t __iomem *reg = ha->iobase;
--
--#if 0
-- DEBUG5(printk("%s(): IOCB data:\n", __func__));
-- DEBUG5(qim_dump_buffer(
-- (uint8_t *)ha->request_ring_ptr, REQUEST_ENTRY_SIZE));
--#endif
--
-- /* Adjust ring index. */
-- ha->req_ring_index++;
-- if (ha->req_ring_index == ha->request_q_length) {
-- ha->req_ring_index = 0;
-- ha->request_ring_ptr = ha->request_ring;
-- } else
-- ha->request_ring_ptr++;
--
-- /* Set chip new ring index. */
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- struct device_reg_24xx __iomem *reg24 =
-- (struct device_reg_24xx __iomem *) ha->iobase;
-- WRT_REG_DWORD(&reg24->req_q_in, ha->req_ring_index);
-- RD_REG_DWORD_RELAXED(&reg24->req_q_in); /* PCI Posting. */
-- } else {
-- WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
-- RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */
-- }
--
--}
--
--/**
-- * qim_marker() - Send a marker IOCB to the firmware.
-- * @ha: HA context
-- * @loop_id: loop ID
-- * @lun: LUN
-- * @type: marker modifier
-- *
-- * Can be called from both normal and interrupt context.
-- *
-- * Returns non-zero if a failure occured, else zero.
-- */
--int
--__qim_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
-- uint8_t type)
--{
-- mrk_entry_t *mrk;
-- struct mrk_entry_24xx *mrk24;
--
-- mrk24 = NULL;
-- mrk = (mrk_entry_t *)qim_req_pkt(ha);
-- if (mrk == NULL) {
-- DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n",
-- __func__, ha->host_no));
--
-- return (QLA_FUNCTION_FAILED);
-- }
--
-- mrk->entry_type = MARKER_TYPE;
-- mrk->modifier = type;
-- if (type != MK_SYNC_ALL) {
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- mrk24 = (struct mrk_entry_24xx *) mrk;
-- mrk24->nport_handle = cpu_to_le16(loop_id);
-- mrk24->lun[1] = LSB(lun);
-- mrk24->lun[2] = MSB(lun);
-- } else {
-- SET_TARGET_ID(ha, mrk->target, loop_id);
-- mrk->lun = cpu_to_le16(lun);
-- }
-- }
-- wmb();
--
-- qim_isp_cmd(ha);
--
-- return (QLA_SUCCESS);
--}
--
--int
--qim_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
-- uint8_t type)
--{
-- int ret;
-- unsigned long flags = 0;
--
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- ret = __qim_marker(ha, loop_id, lun, type);
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- return (ret);
--}
--
--static inline uint16_t
--qim24xx_calc_iocbs(uint16_t dsds)
--{
-- uint16_t iocbs;
--
-- iocbs = 1;
-- if (dsds > 1) {
-- iocbs += (dsds - 1) / 5;
-- if ((dsds - 1) % 5)
-- iocbs++;
-- }
-- return (iocbs);
--}
--
--static inline cont_a64_entry_t *
--qim_prep_cont_type1_iocb(scsi_qla_host_t *ha)
--{
-- cont_a64_entry_t *cont_pkt;
--
-- /* Adjust ring index. */
-- ha->req_ring_index++;
-- if (ha->req_ring_index == ha->request_q_length) {
-- ha->req_ring_index = 0;
-- ha->request_ring_ptr = ha->request_ring;
-- } else {
-- ha->request_ring_ptr++;
-- }
--
-- cont_pkt = (cont_a64_entry_t *)ha->request_ring_ptr;
--
-- /* Load packet defaults. */
-- *((uint32_t *)(&cont_pkt->entry_type)) =
-- __constant_cpu_to_le32(CONTINUE_A64_TYPE);
--
-- return (cont_pkt);
--}
--
--static inline void
--qim24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
-- uint16_t tot_dsds)
--{
-- uint16_t avail_dsds;
-- uint32_t *cur_dsd;
-- scsi_qla_host_t *ha;
-- struct scsi_cmnd *cmd;
--
-- cmd = sp->cmd;
--
-- /* Update entry type to indicate Command Type 3 IOCB */
-- *((uint32_t *)(&cmd_pkt->entry_type)) =
-- __constant_cpu_to_le32(COMMAND_TYPE_7);
--
-- /* No data transfer */
-- if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) {
-- cmd_pkt->byte_count = __constant_cpu_to_le32(0);
-- return;
-- }
--
-- ha = sp->ha;
--
-- /* Set transfer direction */
-- if (cmd->sc_data_direction == DMA_TO_DEVICE)
-- cmd_pkt->task_mgmt_flags =
-- __constant_cpu_to_le16(TMF_WRITE_DATA);
-- else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
-- cmd_pkt->task_mgmt_flags =
-- __constant_cpu_to_le16(TMF_READ_DATA);
--
-- /* One DSD is available in the Command Type 3 IOCB */
-- avail_dsds = 1;
-- cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
--
-- /* Load data segments */
-- if (cmd->use_sg != 0) {
-- struct scatterlist *cur_seg;
-- struct scatterlist *end_seg;
--
-- cur_seg = (struct scatterlist *)cmd->request_buffer;
-- end_seg = cur_seg + tot_dsds;
-- while (cur_seg < end_seg) {
-- dma_addr_t sle_dma;
-- cont_a64_entry_t *cont_pkt;
--
-- /* Allocate additional continuation packets? */
-- if (avail_dsds == 0) {
-- /*
-- * Five DSDs are available in the Continuation
-- * Type 1 IOCB.
-- */
-- cont_pkt = qim_prep_cont_type1_iocb(ha);
-- cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
-- avail_dsds = 5;
-- }
--
-- sle_dma = sg_dma_address(cur_seg);
-- *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
-- *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
-- *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
-- avail_dsds--;
--
-- cur_seg++;
-- }
-- } else {
-- dma_addr_t req_dma;
-- struct page *page;
-- unsigned long offset;
--
-- page = virt_to_page(cmd->request_buffer);
-- offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-- req_dma = pci_map_page(ha->pdev, page, offset,
-- cmd->request_bufflen, cmd->sc_data_direction);
--
-- sp->dma_handle = req_dma;
--
-- *cur_dsd++ = cpu_to_le32(LSD(req_dma));
-- *cur_dsd++ = cpu_to_le32(MSD(req_dma));
-- *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
-- }
--}
--
--int
--qim24xx_start_scsi(srb_t *sp)
--{
-- int ret;
-- unsigned long flags;
-- scsi_qla_host_t *ha;
-- fc_lun_t *fclun;
-- struct scsi_cmnd *cmd;
-- uint32_t *clr_ptr;
-- uint32_t index;
-- uint32_t handle;
-- struct cmd_type_7 *cmd_pkt;
-- uint32_t timeout;
-- struct scatterlist *sg;
-- uint16_t cnt;
-- uint16_t req_cnt;
-- uint16_t tot_dsds;
-- struct device_reg_24xx __iomem *reg;
-- char tag[2];
--
-- /* Setup device pointers. */
-- ret = 0;
-- fclun = sp->lun_queue->fclun;
-- ha = fclun->fcport->ha;
-- reg = (struct device_reg_24xx __iomem *)ha->iobase;
-- cmd = sp->cmd;
--
-- /* Send marker if required */
-- if (ha->marker_needed != 0) {
-- if (qim_marker(ha, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
-- return (QIM_FAILED);
-- }
-- ha->marker_needed = 0;
-- }
--
-- /* Acquire ring specific lock */
-- DEBUG9(printk("%s(%ld): inst=%ld getting hardware lock.\n",
-- __func__, ha->host_no, ha->instance);)
-- spin_lock_irqsave(&ha->hardware_lock, flags);
--
-- DEBUG9(printk("%s(%ld): inst=%ld got hardware lock.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Check for room in outstanding command list. */
-- handle = ha->current_outstanding_cmd;
-- for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-- handle++;
-- if (handle == MAX_OUTSTANDING_COMMANDS)
-- handle = 1;
-- if (ha->outstanding_cmds[handle] == 0)
-- break;
-- }
-- if (index == MAX_OUTSTANDING_COMMANDS)
-- goto queuing_error_24xx;
--
-- /* Calculate the number of request entries needed. */
-- tot_dsds = 0;
-- sg = NULL;
-- if (cmd->use_sg) {
-- sg = (struct scatterlist *) cmd->request_buffer;
-- tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- if (tot_dsds == 0)
-- goto queuing_error_24xx;
-- } else if (cmd->request_bufflen) {
-- tot_dsds++;
-- }
--
-- req_cnt = qim24xx_calc_iocbs(tot_dsds);
-- if (ha->req_q_cnt < (req_cnt + 2)) {
-- cnt = (uint16_t)RD_REG_DWORD_RELAXED(&reg->req_q_out);
-- if (ha->req_ring_index < cnt)
-- ha->req_q_cnt = cnt - ha->req_ring_index;
-- else
-- ha->req_q_cnt = ha->request_q_length -
-- (ha->req_ring_index - cnt);
-- }
-- if (ha->req_q_cnt < (req_cnt + 2)) {
-- if (cmd->use_sg)
-- pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- goto queuing_error_24xx;
-- }
--
-- /* Build command packet. */
-- ha->current_outstanding_cmd = handle;
-- ha->outstanding_cmds[handle] = sp;
-- sp->ha = ha;
-- sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
-- ha->req_q_cnt -= req_cnt;
--
-- cmd_pkt = (struct cmd_type_7 *)ha->request_ring_ptr;
-- cmd_pkt->handle = handle;
--
-- /* Zero out remaining portion of packet. */
-- clr_ptr = (uint32_t *)cmd_pkt + 2;
-- memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
--
-- cmd_pkt->nport_handle = cpu_to_le16(fclun->fcport->loop_id);
-- cmd_pkt->port_id[0] = fclun->fcport->d_id.b.al_pa;
-- cmd_pkt->port_id[1] = fclun->fcport->d_id.b.area;
-- cmd_pkt->port_id[2] = fclun->fcport->d_id.b.domain;
--
-- /* Update timeout. */
-- timeout = (uint32_t)(cmd->timeout_per_command / HZ);
-- if (timeout > FW_MAX_TIMEOUT)
-- cmd_pkt->timeout =
-- __constant_cpu_to_le16(FW_MAX_TIMEOUT);
-- else if (timeout > 25)
-- cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout -
-- (5 + QLA_CMD_TIMER_DELTA));
-- else
-- cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout);
--
-- cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
--
-- /* Set LUN number*/
-- cmd_pkt->lun[1] = LSB(fclun->lun);
-- cmd_pkt->lun[2] = MSB(fclun->lun);
-- host_to_fcp_swap(cmd_pkt->lun, sizeof(cmd_pkt->lun));
--
-- /* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */
-- if (scsi_populate_tag_msg(cmd, tag)) {
-- switch (tag[0]) {
-- case MSG_HEAD_TAG:
-- cmd_pkt->task = TSK_HEAD_OF_QUEUE;
-- break;
-- case MSG_ORDERED_TAG:
-- cmd_pkt->task = TSK_ORDERED;
-- break;
-- }
-- }
--
-- /* Load SCSI command packet. */
-- memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
-- host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb));
--
-- cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen);
--
-- /* Build IOCB segments */
-- qim24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds);
--
-- /* Set total data segment count. */
-- cmd_pkt->entry_count = (uint8_t)req_cnt;
--
-- DEBUG9(printk("%s(%ld): inst=%ld calling wmb.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- wmb();
--
-- DEBUG9(printk("%s(%ld): inst=%ld adjust ring index.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Adjust ring index. */
-- ha->req_ring_index++;
-- if (ha->req_ring_index == ha->request_q_length) {
-- ha->req_ring_index = 0;
-- ha->request_ring_ptr = ha->request_ring;
-- } else
-- ha->request_ring_ptr++;
--
-- ha->actthreads++;
-- ha->total_ios++;
-- sp->lun_queue->out_cnt++;
-- sp->flags |= SRB_DMA_VALID;
-- sp->state = SRB_ACTIVE_STATE;
-- sp->u_start = jiffies;
--
-- /* Set chip new ring index. */
-- WRT_REG_DWORD(&reg->req_q_in, ha->req_ring_index);
-- RD_REG_DWORD_RELAXED(&reg->req_q_in); /* PCI Posting. */
--
-- DEBUG9(printk("%s(%ld): inst=%ld releasing hardware lock and exit.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- return (QLA_SUCCESS);
--
--queuing_error_24xx:
-- DEBUG9(printk("%s(%ld): inst=%ld releasing hardware lock w/ error.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- return (QLA_FUNCTION_FAILED);
--}
--
--/**
-- * qim_start_scsi() - Send a SCSI command to the ISP
-- * @sp: command to send to the ISP
-- *
-- * Returns non-zero if a failure occured, else zero.
-- */
--int
--qim_start_scsi(srb_t *sp)
--{
-- unsigned long flags;
-- scsi_qla_host_t *ha;
-- fc_lun_t *fclun;
-- struct scsi_cmnd *cmd;
-- uint32_t *clr_ptr;
-- uint32_t index;
-- uint32_t handle;
-- cmd_entry_t *cmd_pkt;
-- uint32_t timeout;
-- struct scatterlist *sg;
-- uint16_t cnt;
-- uint16_t req_cnt;
-- uint16_t tot_dsds;
-- device_reg_t __iomem *reg;
-- char tag[2];
--
--
-- /* Setup device pointers. */
-- /* So we know we haven't pci_map'ed anything yet */
-- fclun = sp->lun_queue->fclun;
-- ha = fclun->fcport->ha;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- DEBUG9(printk("%s(%ld): inst=%ld calling qim24xx_start_scsi.\n",
-- __func__, ha->host_no, ha->instance);)
-- return qim24xx_start_scsi(sp);
-- }
--
-- tot_dsds = 0;
-- reg = ha->iobase;
-- cmd = sp->cmd;
--
-- /* Send marker if required */
-- if (ha->marker_needed != 0) {
-- if (qim_marker(ha, 0, 0, MK_SYNC_ALL) != QIM_SUCCESS) {
-- return (QIM_FAILED);
-- }
-- ha->marker_needed = 0;
-- }
--
-- /* Acquire ring specific lock */
-- DEBUG9(printk("%s(%ld): inst=%ld getting hardware lock.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- spin_lock_irqsave(&ha->hardware_lock, flags);
--
-- DEBUG9(printk("%s(%ld): inst=%ld got hardware lock.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Check for room in outstanding command list. */
-- handle = ha->current_outstanding_cmd;
-- for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-- handle++;
-- if (handle == MAX_OUTSTANDING_COMMANDS)
-- handle = 1;
-- if (ha->outstanding_cmds[handle] == 0)
-- break;
-- }
-- if (index == MAX_OUTSTANDING_COMMANDS)
-- goto queuing_error;
--
-- /* Map the sg table so we have an accurate count of sg entries needed */
-- if (cmd->use_sg) {
-- sg = (struct scatterlist *) cmd->request_buffer;
-- tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- if (tot_dsds == 0)
-- goto queuing_error;
-- } else if (cmd->request_bufflen) {
-- dma_addr_t req_dma;
-- struct page *page;
-- unsigned long offset;
--
-- page = virt_to_page(cmd->request_buffer);
-- offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-- req_dma = pci_map_page(ha->pdev, page, offset,
-- cmd->request_bufflen, cmd->sc_data_direction);
--
-- if (dma_mapping_error(req_dma))
-- goto queuing_error;
--
-- sp->dma_handle = req_dma;
-- tot_dsds = 1;
-- }
--
-- /* Calculate the number of request entries needed. */
-- req_cnt = (ha->calc_request_entries)(tot_dsds);
-- if (ha->req_q_cnt < (req_cnt + 2)) {
-- cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
-- if (ha->req_ring_index < cnt)
-- ha->req_q_cnt = cnt - ha->req_ring_index;
-- else
-- ha->req_q_cnt = ha->request_q_length -
-- (ha->req_ring_index - cnt);
-- }
-- if (ha->req_q_cnt < (req_cnt + 2))
-- goto queuing_error;
--
-- /* Build command packet */
-- ha->current_outstanding_cmd = handle;
-- ha->outstanding_cmds[handle] = sp;
-- sp->ha = ha;
-- sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
-- ha->req_q_cnt -= req_cnt;
--
-- cmd_pkt = (cmd_entry_t *)ha->request_ring_ptr;
-- cmd_pkt->handle = handle;
-- /* Zero out remaining portion of packet. */
-- clr_ptr = (uint32_t *)cmd_pkt + 2;
-- memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
-- cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
--
-- /* Set target ID */
-- SET_TARGET_ID(ha, cmd_pkt->target, fclun->fcport->loop_id);
--
-- /* Set LUN number*/
-- cmd_pkt->lun = cpu_to_le16(fclun->lun);
--
-- /* Update tagged queuing modifier */
-- cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
-- if (scsi_populate_tag_msg(cmd, tag)) {
-- switch (tag[0]) {
-- case MSG_HEAD_TAG:
-- cmd_pkt->control_flags =
-- __constant_cpu_to_le16(CF_HEAD_TAG);
-- break;
-- case MSG_ORDERED_TAG:
-- cmd_pkt->control_flags =
-- __constant_cpu_to_le16(CF_ORDERED_TAG);
-- break;
-- }
-- }
--
-- /*
-- * Allocate at least 5 (+ QLA_CMD_TIMER_DELTA) seconds for RISC timeout.
-- */
-- timeout = (uint32_t)(cmd->timeout_per_command / HZ);
-- if (timeout > 65535)
-- cmd_pkt->timeout = __constant_cpu_to_le16(0);
-- else if (timeout > 25)
-- cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout -
-- (5 + QLA_CMD_TIMER_DELTA));
-- else
-- cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout);
--
-- /* Load SCSI command packet. */
-- memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
-- cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen);
--
-- /* Build IOCB segments */
-- (ha->build_scsi_iocbs)(sp, cmd_pkt, tot_dsds);
--
-- /* Set total data segment count. */
-- cmd_pkt->entry_count = (uint8_t)req_cnt;
-- wmb();
--
-- /* Adjust ring index. */
-- ha->req_ring_index++;
-- if (ha->req_ring_index == ha->request_q_length) {
-- ha->req_ring_index = 0;
-- ha->request_ring_ptr = ha->request_ring;
-- } else
-- ha->request_ring_ptr++;
--
-- ha->actthreads++;
-- ha->total_ios++;
-- sp->lun_queue->out_cnt++;
-- sp->flags |= SRB_DMA_VALID;
-- sp->state = SRB_ACTIVE_STATE;
-- sp->u_start = jiffies;
--
-- /* Set chip new ring index. */
-- WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
-- RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */
--
-- DEBUG9(printk("%s(%ld): inst=%ld releasing hardware lock and exit.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
-- return (QIM_SUCCESS);
--
--queuing_error:
-- if (cmd->use_sg && tot_dsds) {
-- sg = (struct scatterlist *) cmd->request_buffer;
-- pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- } else if (tot_dsds) {
-- pci_unmap_page(ha->pdev, sp->dma_handle, cmd->request_bufflen,
-- cmd->sc_data_direction);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld releasing hardware lock w/ error.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- return (QIM_FAILED);
--}
--
--/**************************************************************************
--* qim_cmd_timeout
--*
--* Description:
--* Handles the command if it times out in any state.
--*
--* Input:
--* sp - pointer to validate
--*
--* Returns:
--* None.
--* Note:Need to add the support for if( sp->state == SRB_FAILOVER_STATE).
--**************************************************************************/
--void
--qim_cmd_timeout(srb_t *sp)
--{
-- int t, l;
-- int processed;
-- scsi_qla_host_t *vis_ha, *dest_ha;
-- struct scsi_cmnd *cmd;
-- unsigned long flags, cpu_flags;
-- fc_port_t *fcport;
--
-- cmd = sp->cmd;
-- vis_ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
--
-- DEBUG9(printk("cmd_timeout: Entering sp->state = %x\n", sp->state);)
-- printk("cmd_timeout: Entering sp->state = %x\n", sp->state);
--
-- t = cmd->device->id;
-- l = cmd->device->lun;
-- fcport = sp->fclun->fcport;
-- dest_ha = sp->ha;
--
-- /*
-- * If IO is found either in retry Queue
-- * OR in Lun Queue
-- * Return this IO back to host
-- */
-- spin_lock_irqsave(&vis_ha->list_lock, flags);
-- processed = 0;
-- if (sp->state == SRB_PENDING_STATE) {
-- __del_from_pending_queue(vis_ha, sp);
-- DEBUG10(printk("scsi(%ld): Found in Pending queue pid %ld, "
-- "State = %x., fcport state=%d sjiffs=%lx njiffs=%lx\n",
-- vis_ha->host_no, cmd->serial_number, sp->state,
-- atomic_read(&fcport->state), sp->r_start, jiffies));
--
-- /*
-- * If FC_DEVICE is marked as dead return the cmd with
-- * DID_NO_CONNECT status. Otherwise set the host_byte to
-- * DID_BUS_BUSY to let the OS retry this cmd.
-- */
-- if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-- atomic_read(&fcport->ha->loop_state) == LOOP_DEAD) {
-- cmd->result = DID_NO_CONNECT << 16;
-- if (atomic_read(&fcport->ha->loop_state) == LOOP_DOWN)
-- sp->err_id = SRB_ERR_LOOP;
-- else
-- sp->err_id = SRB_ERR_PORT;
-- } else {
-- cmd->result = DID_BUS_BUSY << 16;
-- }
-- __add_to_done_queue(vis_ha, sp);
-- processed++;
-- }
-- spin_unlock_irqrestore(&vis_ha->list_lock, flags);
--
-- if (processed) {
-- /*
-- printk("cmd_timeout: calling done().\n");
-- qla2x00_done(vis_ha);
-- */
-- printk("cmd_timeout: setting RESTART_Q flag.\n");
-- set_bit(RESTART_QUEUES_NEEDED, &vis_ha->dpc_flags);
-- up(vis_ha->dpc_wait);
-- return;
-- }
--
--#if 0
-- spin_lock_irqsave(&dest_ha->list_lock, flags);
-- if ((sp->state == SRB_RETRY_STATE) ||
-- (sp->state == SRB_SCSI_RETRY_STATE)) {
--
-- DEBUG10(printk("scsi(%ld): Found in (Scsi) Retry queue or "
-- "failover Q pid %ld, State = %x., fcport state=%d "
-- "jiffies=%lx retried=%d\n",
-- dest_ha->host_no, cmd->serial_number, sp->state,
-- atomic_read(&fcport->state), jiffies, cmd->retries));
--
-- if ((sp->state == SRB_RETRY_STATE)) {
-- __del_from_retry_queue(dest_ha, sp);
-- } else if ((sp->state == SRB_SCSI_RETRY_STATE)) {
-- __del_from_scsi_retry_queue(dest_ha, sp);
-- }
--
-- /*
-- * If FC_DEVICE is marked as dead return the cmd with
-- * DID_NO_CONNECT status. Otherwise set the host_byte to
-- * DID_BUS_BUSY to let the OS retry this cmd.
-- */
-- if ((atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
-- atomic_read(&dest_ha->loop_state) == LOOP_DEAD) {
-- qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT);
-- cmd->result = DID_NO_CONNECT << 16;
-- if (atomic_read(&dest_ha->loop_state) == LOOP_DOWN)
-- sp->err_id = SRB_ERR_LOOP;
-- else
-- sp->err_id = SRB_ERR_PORT;
-- } else {
-- cmd->result = DID_BUS_BUSY << 16;
-- }
--
-- __add_to_done_queue(dest_ha, sp);
-- processed++;
-- }
-- spin_unlock_irqrestore(&dest_ha->list_lock, flags);
--
-- if (processed) {
-- qla2x00_done(dest_ha);
-- return;
-- }
--#endif
--
-- spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
-- if (sp->state == SRB_DONE_STATE) {
-- /* IO in done_q -- leave it */
-- DEBUG9(printk("scsi(%ld): Found in Done queue pid %ld sp=%p.\n",
-- dest_ha->host_no, cmd->serial_number, sp));
-- printk("scsi(%ld): Found in Done queue pid %ld sp=%p.\n",
-- dest_ha->host_no, cmd->serial_number, sp);
-- } else if (sp->state == SRB_SUSPENDED_STATE) {
-- DEBUG9(printk("scsi(%ld): Found SP %p in suspended state "
-- "- pid %ld:\n",
-- dest_ha->host_no, sp, cmd->serial_number));
-- printk("scsi(%ld): Found SP %p in suspended state "
-- "- pid %ld:\n",
-- dest_ha->host_no, sp, cmd->serial_number);
--#if 0
-- DEBUG9(printk("scsi(%ld): Found SP %p in suspended state "
-- "- pid %ld:\n",
-- dest_ha->host_no, sp, cmd->serial_number));
-- DEBUG9(qim_dump_buffer((uint8_t *)sp, sizeof(srb_t));)
--#endif
-- } else if (sp->state == SRB_ACTIVE_STATE) {
-- /*
-- * IO is with ISP find the command in our active list.
-- */
-- spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
-- spin_lock_irqsave(&dest_ha->hardware_lock, flags);
--
-- if (sp == dest_ha->outstanding_cmds[
-- (unsigned long)sp->cmd->host_scribble]) {
--
-- DEBUG9(printk("scsi(%ld): Found in ISP pid=%ld "
-- "hdl=%ld\n", dest_ha->host_no, cmd->serial_number,
-- (unsigned long)sp->cmd->host_scribble));
-- printk("scsi(%ld): Found in ISP pid=%ld "
-- "hdl=%ld\n", dest_ha->host_no, cmd->serial_number,
-- (unsigned long)sp->cmd->host_scribble);
--
--#if 0
-- if (sp->flags & SRB_TAPE) {
-- /*
-- * We cannot allow the midlayer error handler
-- * to wakeup and begin the abort process.
-- * Extend the timer so that the firmware can
-- * properly return the IOCB.
-- */
-- DEBUG9(printk("cmd_timeout: Extending timeout "
-- "of FCP2 tape command!\n"));
-- qla2x00_extend_timeout(sp->cmd,
-- EXTEND_CMD_TIMEOUT);
-- }
--#endif
-- printk("cmd_timeout: setting ISP_ABORT_NEEDED flag.\n");
-- set_bit(ISP_ABORT_NEEDED, &dest_ha->dpc_flags);
--
-- sp->state = SRB_ACTIVE_TIMEOUT_STATE;
-- spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
-- up(dest_ha->dpc_wait);
-- } else {
-- spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
-- printk(KERN_INFO
-- "qla_cmd_timeout: State indicates it is with "
-- "ISP, But not in active array\n");
-- }
-- spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
-- } else if (sp->state == SRB_ACTIVE_TIMEOUT_STATE) {
-- DEBUG9(printk("qla2100%ld: Found in Active timeout state"
-- "pid %ld, State = %x., \n",
-- dest_ha->host_no,
-- sp->cmd->serial_number, sp->state);)
-- printk("qla2100%ld: Found in Active timeout state"
-- "pid %ld, State = %x., \n",
-- dest_ha->host_no,
-- sp->cmd->serial_number, sp->state);
-- } else {
-- /* EMPTY */
-- DEBUG10(printk("cmd_timeout%ld: LOST command state = "
-- "0x%x, sp=%p\n",
-- vis_ha->host_no, sp->state,sp);)
--
-- qla_printk(KERN_INFO, vis_ha,
-- "cmd_timeout: LOST command state = 0x%x\n", sp->state);
-- }
-- spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
--
-- DEBUG9(printk("cmd_timeout: Leaving\n");)
-- printk("cmd_timeout: Leaving\n");
--}
--
--static inline void
--qim_add_timer_to_cmd(srb_t *sp, int timeout)
--{
-- init_timer(&sp->timer);
-- sp->timer.expires = jiffies + timeout * HZ;
-- sp->timer.data = (unsigned long) sp;
-- sp->timer.function = (void (*) (unsigned long))qim_cmd_timeout;
-- add_timer(&sp->timer);
--}
--
--static inline void
--qim_delete_timer_from_cmd(srb_t *sp)
--{
-- if (sp->timer.function != NULL) {
-- del_timer(&sp->timer);
-- sp->timer.function = NULL;
-- sp->timer.data = (unsigned long) NULL;
-- }
--}
--
--static int
--qim_ioctl_scsi_queuecommand(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi_cmd, struct scsi_device *pscsi_dev,
-- fc_port_t *pfcport, fc_lun_t *pfclun)
--{
-- int ret = 0;
-- int ret2 = 0;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t lun = 0, tgt = 0;
--#if defined(QL_DEBUG_LEVEL_9)
-- uint32_t b, t, l;
--#endif
-- os_lun_t *lq = NULL;
-- os_tgt_t *tq = NULL;
-- srb_t *sp = NULL;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): entered.\n",
-- __func__, ha->host_no);)
--
-- if ((sp = qim_get_new_sp(dr_ha)) == NULL) {
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc sp.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (QIM_FAILED);
-- }
--
-- switch(pext->SubCode) {
-- case EXT_SC_SEND_SCSI_PASSTHRU:
--
-- tgt = pscsi_cmd->device->id;
-- lun = pscsi_cmd->device->lun;
--
-- tq = (os_tgt_t *)TGT_Q(dr_ha, tgt);
-- lq = (os_lun_t *)LUN_Q(dr_ha, tgt, lun);
--
-- break;
-- case EXT_SC_SEND_FC_SCSI_PASSTHRU:
-- if (pfcport == NULL || pfclun == NULL) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld received invalid "
-- "pointers. fcport=%p fclun=%p.\n",
-- __func__, ha->host_no, ha->instance, pfcport, pfclun);)
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
--
-- if (pscsi_cmd->cmd_len != 6 && pscsi_cmd->cmd_len != 0x0A &&
-- pscsi_cmd->cmd_len != 0x0C && pscsi_cmd->cmd_len != 0x10) {
-- DEBUG9_10(printk(KERN_WARNING
-- "%s(%ld): invalid Cdb Length 0x%x received.\n",
-- __func__, ha->host_no,
-- pscsi_cmd->cmd_len);)
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
-- tq = ha->ioctl->ioctl_tq;
-- lq = ha->ioctl->ioctl_lq;
--
-- break;
-- case EXT_SC_SCSI3_PASSTHRU:
-- if (pfcport == NULL || pfclun == NULL) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld received invalid "
-- "pointers. fcport=%p fclun=%p.\n",
-- __func__,
-- ha->host_no, ha->instance, pfcport, pfclun);)
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
--
-- tq = ha->ioctl->ioctl_tq;
-- lq = ha->ioctl->ioctl_lq;
--
-- break;
-- default:
-- break;
-- }
--
-- sp->ha = dr_ha;
-- sp->cmd = pscsi_cmd;
-- sp->flags = SRB_IOCTL;
--
-- /* set local fc_scsi_cmd's sp pointer to sp */
-- CMD_SP(pscsi_cmd) = (void *) sp;
--
-- if (pscsi_cmd->sc_data_direction == DMA_TO_DEVICE) {
-- /* sending user data from pext->ResponseAdr to device */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)ha->ioctl_mem;
-- ret = copy_from_user(kernel_tmp, usr_temp, pext->ResponseLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy "
-- "failed(%d) on rsp buf.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
--
-- return (-EFAULT);
-- }
-- }
--
-- pscsi_cmd->device->host = dr_ha->host;
--
-- /* mark this as a special delivery and collection command */
-- pscsi_cmd->scsi_done = qim_scsi_pt_done;
-- pscsi_cmd->device->tagged_supported = 0;
-- pscsi_cmd->use_sg = 0; /* no ScatterGather */
-- pscsi_cmd->request_bufflen = pext->ResponseLen;
-- pscsi_cmd->request_buffer = ha->ioctl_mem;
-- if (pscsi_cmd->timeout_per_command == 0)
-- pscsi_cmd->timeout_per_command = ql2xioctltimeout * HZ;
--
-- if (tq && lq) {
-- if (pext->SubCode == EXT_SC_SEND_SCSI_PASSTHRU) {
-- pfcport = lq->fclun->fcport;
-- pfclun = lq->fclun;
--
-- if (pfcport == NULL || pfclun == NULL) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scsi pt "
-- "rcvd invalid ptrs. fcport=%p fclun=%p.\n",
-- __func__, ha->host_no, ha->instance,
-- pfcport, pfclun);)
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
--
-- } else {
-- if (pext->SubCode == EXT_SC_SCSI3_PASSTHRU)
-- /* The LUN value is of FCP LUN format */
-- tq->olun[pfclun->lun & 0xff] = lq;
-- else
-- tq->olun[pfclun->lun] = lq;
--
-- tq->ha = dr_ha;
-- lq->fclun = pfclun;
-- }
--
-- sp->lun_queue = lq;
-- sp->tgt_queue = tq;
-- sp->fclun = pfclun;
-- } else {
-- /* cannot send command without a queue. force error. */
-- pfcport = NULL;
-- DEBUG9_10(printk("%s(%ld): error dev q not found. tq=%p lq=%p.\n",
-- __func__, ha->host_no, tq, lq);)
-- }
--
-- DEBUG9({
-- b = pscsi_cmd->device->channel;
-- t = pscsi_cmd->device->id;
-- l = pscsi_cmd->device->lun;
-- })
-- DEBUG9(printk("%s(%ld): ha instance=%ld tq=%p lq=%p "
-- "pfclun=%p pfcport=%p.\n",
-- __func__, ha->host_no, ha->instance, tq, lq, pfclun,
-- pfcport);)
-- DEBUG9(printk("\tCDB=%02x %02x %02x %02x; b=%x t=%x l=%x.\n",
-- pscsi_cmd->cmnd[0], pscsi_cmd->cmnd[1], pscsi_cmd->cmnd[2],
-- pscsi_cmd->cmnd[3], b, t, l);)
--
-- /*
-- * Check the status of the port
-- */
-- if (pext->SubCode == EXT_SC_SEND_SCSI_PASSTHRU) {
-- if (qim_check_tgt_status(dr_ha, pscsi_cmd)) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld check_tgt_status "
-- "failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
-- } else {
-- ret2 = qim_check_port_status(dr_ha, pfcport);
-- if (ret2 != QIM_SUCCESS) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld check_port_status "
-- "failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- if (ret2 == QLA_BUSY)
-- pext->Status = EXT_STATUS_BUSY;
-- else
-- pext->Status = EXT_STATUS_ERR;
-- atomic_set(&sp->ref_count, 0);
-- add_to_free_queue (dr_ha, sp);
-- return (QIM_FAILED);
-- }
-- }
--
-- /* set flag to indicate IOCTL SCSI PassThru in progress */
-- ha->ioctl->SCSIPT_InProgress = 1;
-- ha->ioctl->ioctl_tov = (int)QLA_PT_CMD_DRV_TOV;
--
-- /* prepare for receiving completion. */
-- qim_ioctl_sem_init(ha);
-- CMD_COMPL_STATUS(pscsi_cmd) = (int) IOCTL_INVALID_STATUS;
--
-- /* send command to adapter */
-- DEBUG9(printk("%s(%ld): inst=%ld sending command.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Time the command via our standard driver-timer */
-- if ((pscsi_cmd->timeout_per_command / HZ) > QLA_CMD_TIMER_DELTA)
-- qim_add_timer_to_cmd(sp,
-- (pscsi_cmd->timeout_per_command/HZ) - QLA_CMD_TIMER_DELTA);
-- else
-- qim_add_timer_to_cmd(sp, pscsi_cmd->timeout_per_command/HZ);
--
-- if (qim_start_scsi(sp) != QIM_SUCCESS) {
-- qim_delete_timer_from_cmd(sp);
-- pext->Status = EXT_STATUS_ERR;
-- ret = QIM_FAILED;
-- }
--#if 0
-- add_to_pending_queue(dr_ha, sp);
--
-- /*
-- qim_next(dr_ha);
-- */
--#endif
--
-- DEBUG9(printk("%s(%ld): exiting.\n",
-- __func__, ha->host_no);)
-- return (ret);
--}
--
--/*
-- * qim_sc_scsi_passthru
-- * Handles EXT_SC_SEND_SCSI_PASSTHRU subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_sc_scsi_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi_cmd, struct scsi_device *pscsi_device, int mode)
--{
-- int ret = 0;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t i;
-- uint32_t transfer_len;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- EXT_SCSI_PASSTHRU *pscsi_pass;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (test_bit(FAILOVER_EVENT_NEEDED, &dr_ha->dpc_flags) ||
-- test_bit(FAILOVER_EVENT, &dr_ha->dpc_flags) ||
-- test_bit(FAILOVER_NEEDED, &dr_ha->dpc_flags)) {
-- /* Stall intrusive passthru commands until failover complete */
-- DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-- "returning busy.\n",
-- __func__, ha->host_no, ha->instance);)
-- pext->Status = EXT_STATUS_BUSY;
-- return (ret);
-- }
--
-- if (pext->ResponseLen > ha->ioctl_mem_size) {
-- if (qim_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-- QIM_SUCCESS) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-- "requested DMA buffer size %x.\n",
-- __func__, ha->host_no, ha->instance,
-- pext->ResponseLen);)
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi_pass,
-- sizeof(EXT_SCSI_PASSTHRU))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_SCSI_PASSTHRU));)
-- return (ret);
-- }
--
-- /* clear ioctl_mem to be used */
-- memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
--
-- /* Copy request buffer */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pscsi_pass;
-- ret = copy_from_user(kernel_tmp, usr_temp, sizeof(EXT_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- return (-EFAULT);
-- }
--
-- /* set target coordinates */
-- pscsi_cmd->device->id = pscsi_pass->TargetAddr.Target;
-- pscsi_cmd->device->lun = pscsi_pass->TargetAddr.Lun;
--
-- /* Verify target exists */
-- if (TGT_Q(dr_ha, pscsi_cmd->device->id) == NULL) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR tgt %d not found.\n",
-- __func__,
-- ha->host_no, ha->instance, pscsi_cmd->device->id));
-- return (ret);
-- }
--
-- /* Copy over cdb */
--
-- if (pscsi_pass->CdbLength == 6) {
-- pscsi_cmd->cmd_len = 6;
--
-- } else if (pscsi_pass->CdbLength == 10) {
-- pscsi_cmd->cmd_len = 0x0A;
--
-- } else if (pscsi_pass->CdbLength == 12) {
-- pscsi_cmd->cmd_len = 0x0C;
--
-- } else {
-- printk(KERN_WARNING
-- "%s: Unsupported Cdb Length=%x.\n",
-- __func__, pscsi_pass->CdbLength);
--
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- return (ret);
-- }
--
-- memcpy(pscsi_cmd->data_cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
-- memcpy(pscsi_cmd->cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
--
-- DEBUG9(printk("%s Dump of cdb buffer:\n", __func__);)
-- DEBUG9(qim_dump_buffer((uint8_t *)&pscsi_cmd->data_cmnd[0],
-- pscsi_cmd->cmd_len);)
--
-- switch (pscsi_pass->Direction) {
-- case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-- pscsi_cmd->sc_data_direction = DMA_TO_DEVICE;
-- break;
-- case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-- pscsi_cmd->sc_data_direction = DMA_FROM_DEVICE;
-- break;
-- default :
-- pscsi_cmd->sc_data_direction = DMA_NONE;
-- break;
-- }
--
-- /* send command to adapter */
-- DEBUG9(printk("%s(%ld): inst=%ld sending command.\n",
-- __func__, ha->host_no, ha->instance);)
--
--// read_lock(&qim_haioctl_list_lock);
-- if ((ret = qim_ioctl_scsi_queuecommand(ha, pext, pscsi_cmd,
-- pscsi_device, NULL, NULL))) {
--// read_unlock(&qim_haioctl_list_lock);
-- if (ret > 0)
-- /* this is not a system error. only return system
-- * errors which are negative.
-- */
-- ret = 0;
--
-- return (ret);
-- }
--// read_unlock(&qim_haioctl_list_lock);
--
-- DEBUG9(printk("%s(%ld): inst=%ld waiting for completion.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Wait for completion */
-- down(&ha->ioctl->cmpl_sem);
--
-- DEBUG9(printk("%s(%ld): inst=%ld completed.\n",
-- __func__, ha->host_no, ha->instance);)
--
--#if 0
-- if (ha->ioctl->SCSIPT_InProgress == 1) {
--
-- printk(KERN_WARNING
-- "qim: scsi%ld ERROR passthru command timeout.\n",
-- ha->host_no);
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--#endif
--
-- if (CMD_COMPL_STATUS(pscsi_cmd) == (int)IOCTL_INVALID_STATUS) {
--
-- DEBUG10(printk("%s(%ld): inst=%ld ERROR - cmd not completed "
-- "or timed out.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_ERR;
-- return (ret);
-- }
--
-- switch (CMD_COMPL_STATUS(pscsi_cmd)) {
-- case CS_INCOMPLETE:
-- case CS_ABORTED:
-- case CS_PORT_UNAVAILABLE:
-- case CS_PORT_LOGGED_OUT:
-- case CS_PORT_CONFIG_CHG:
-- case CS_PORT_BUSY:
-- DEBUG9_10(printk("%s(%ld): inst=%ld cs err = %x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi_cmd));)
-- pext->Status = EXT_STATUS_BUSY;
--
-- return (ret);
-- }
--
-- if ((CMD_SCSI_STATUS(pscsi_cmd) & 0xff) != 0) {
--
-- /* have done the post function */
-- pext->Status = EXT_STATUS_SCSI_STATUS;
-- pext->DetailStatus = CMD_SCSI_STATUS(pscsi_cmd) & 0xff;
--
-- DEBUG9_10(printk(KERN_INFO "%s(%ld): inst=%ld scsi err. "
-- "host status =0x%x, scsi status = 0x%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi_cmd), CMD_SCSI_STATUS(pscsi_cmd));)
-- } else {
-- if (CMD_COMPL_STATUS(pscsi_cmd) == CS_DATA_OVERRUN) {
-- pext->Status = EXT_STATUS_DATA_OVERRUN;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld return overrun.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- } else if (CMD_COMPL_STATUS(pscsi_cmd) == CS_DATA_UNDERRUN &&
-- (CMD_SCSI_STATUS(pscsi_cmd) & SS_RESIDUAL_UNDER)) {
-- pext->Status = EXT_STATUS_DATA_UNDERRUN;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld return underrun.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- } else if (CMD_COMPL_STATUS(pscsi_cmd) != 0 ||
-- CMD_SCSI_STATUS(pscsi_cmd) != 0) {
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld, cs err=%x, scsi err=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi_cmd),
-- CMD_SCSI_STATUS(pscsi_cmd));)
--
-- return (ret);
-- }
-- }
--
-- /* copy up structure to make sense data available to user */
-- pscsi_pass->SenseLength = CMD_ACTUAL_SNSLEN(pscsi_cmd);
-- if (CMD_ACTUAL_SNSLEN(pscsi_cmd)) {
-- for (i = 0; i < CMD_ACTUAL_SNSLEN(pscsi_cmd); i++)
-- pscsi_pass->SenseData[i] = pscsi_cmd->sense_buffer[i];
--
-- DEBUG10(printk("%s: sense len = %d. Dump of sense buffer:\n",
-- __func__, pscsi_pass->SenseLength);)
-- DEBUG10(qim_dump_buffer(
-- (uint8_t *)&pscsi_pass->SenseData[0],
-- CMD_ACTUAL_SNSLEN(pscsi_cmd));)
--
-- }
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pscsi_pass;
-- ret = copy_to_user(usr_temp, kernel_tmp,
-- sizeof(EXT_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-- "buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- if (pscsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-- DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* now copy up the READ data to user */
-- if ((CMD_COMPL_STATUS(pscsi_cmd) == CS_DATA_UNDERRUN) &&
-- (CMD_RESID_LEN(pscsi_cmd))) {
--
-- transfer_len = pext->ResponseLen -
-- CMD_RESID_LEN(pscsi_cmd);
--
-- pext->ResponseLen = transfer_len;
-- } else {
-- transfer_len = pext->ResponseLen;
-- }
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): final transferlen=%d.\n",
-- __func__, ha->host_no, transfer_len);)
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)ha->ioctl_mem;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_sc_fc_scsi_passthru
-- * Handles EXT_SC_SEND_FC_SCSI_PASSTHRU subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_sc_fc_scsi_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pfc_scsi_cmd, struct scsi_device *pfc_scsi_device,
-- int mode)
--{
-- int ret = 0;
-- int port_found, lun_found;
-- fc_lun_t temp_fclun;
-- struct list_head *fcpl;
-- fc_port_t *fcport;
-- struct list_head *fcll;
-- fc_lun_t *fclun;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t i;
-- uint32_t transfer_len;
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
-- EXT_FC_SCSI_PASSTHRU *pfc_scsi_pass;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
-- DEBUG9_10(
-- if (!pfc_scsi_cmd || !pfc_scsi_device) {
-- printk("%s(%ld): invalid pointer received. "
-- "pfc_scsi_cmd=%p, pfc_scsi_device=%p.\n",
-- __func__, ha->host_no, pfc_scsi_cmd,
-- pfc_scsi_device);
-- return (ret);
-- }
-- )
--
-- if (test_bit(FAILOVER_EVENT_NEEDED, &dr_ha->dpc_flags) ||
-- test_bit(FAILOVER_EVENT, &dr_ha->dpc_flags) ||
-- test_bit(FAILOVER_NEEDED, &dr_ha->dpc_flags)) {
-- /* Stall intrusive passthru commands until failover complete */
-- DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-- "returning busy.\n",
-- __func__, ha->host_no, ha->instance);)
-- pext->Status = EXT_STATUS_BUSY;
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pfc_scsi_pass,
-- sizeof(EXT_FC_SCSI_PASSTHRU))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_FC_SCSI_PASSTHRU));)
-- return (ret);
-- }
--
-- if (pext->ResponseLen > ha->ioctl_mem_size) {
-- if (qim_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-- QIM_SUCCESS) {
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-- "requested DMA buffer size %x.\n",
-- __func__, ha->host_no, ha->instance,
-- pext->ResponseLen);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
-- }
--
-- /* clear ioctl_mem to be used */
-- memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
--
-- /* Copy request buffer */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pfc_scsi_pass;
-- ret = copy_from_user(kernel_tmp, usr_temp,
-- sizeof(EXT_FC_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
--
-- return (-EFAULT);
-- }
--
-- if (pfc_scsi_pass->FCScsiAddr.DestType != EXT_DEF_DESTTYPE_WWPN) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR -wrong Dest type. \n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld going to find fcport.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- fcport = NULL;
-- fclun = NULL;
-- port_found = lun_found = 0;
-- list_for_each(fcpl, &dr_ha->fcports) {
-- fcport = list_entry(fcpl, fc_port_t, list);
--
-- if (memcmp(fcport->port_name,
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN, 8) != 0) {
-- continue;
--
-- }
-- port_found++;
--
-- list_for_each(fcll, &fcport->fcluns) {
-- fclun = list_entry(fcll, fc_lun_t, list);
--
-- if (fclun->lun == pfc_scsi_pass->FCScsiAddr.Lun) {
-- /* Found the right LUN */
-- lun_found++;
-- break;
-- }
-- }
-- break;
-- }
--
-- if (!port_found) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld FC AddrFormat - DID NOT "
-- "FIND Port matching WWPN.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- /* v5.21b9 - use a temporary fclun */
-- if (!lun_found) {
-- fclun = &temp_fclun;
-- fclun->fcport = fcport;
-- fclun->lun = pfc_scsi_pass->FCScsiAddr.Lun;
-- }
--
-- /* set target coordinates */
-- pfc_scsi_cmd->device->id = 0xff; /* not used. just put something there. */
-- pfc_scsi_cmd->device->lun = pfc_scsi_pass->FCScsiAddr.Lun;
--
-- DEBUG9(printk("%s(%ld): inst=%ld got cmd for loopid=%04x L=%04x "
-- "WWPN=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no, ha->instance, fclun->fcport->loop_id,
-- pfc_scsi_cmd->device->lun,
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[0],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[1],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[2],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[3],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[4],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[5],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[6],
-- pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[7]);)
--
-- if (pfc_scsi_pass->CdbLength == 6) {
-- pfc_scsi_cmd->cmd_len = 6;
--
-- } else if (pfc_scsi_pass->CdbLength == 0x0A) {
-- pfc_scsi_cmd->cmd_len = 0x0A;
--
-- } else if (pfc_scsi_pass->CdbLength == 0x0C) {
-- pfc_scsi_cmd->cmd_len = 0x0C;
--
-- } else if (pfc_scsi_pass->CdbLength == 0x10) {
-- pfc_scsi_cmd->cmd_len = 0x10;
-- } else {
-- printk(KERN_WARNING
-- "qim_ioctl: FC_SCSI_PASSTHRU Unknown Cdb Length=%x.\n",
-- pfc_scsi_pass->CdbLength);
-- pext->Status = EXT_STATUS_INVALID_PARAM;
--
-- return (ret);
-- }
--
-- memcpy(pfc_scsi_cmd->data_cmnd, pfc_scsi_pass->Cdb,
-- pfc_scsi_cmd->cmd_len);
-- memcpy(pfc_scsi_cmd->cmnd, pfc_scsi_pass->Cdb,
-- pfc_scsi_cmd->cmd_len);
--
-- DEBUG9(printk("%s Dump of cdb buffer:\n", __func__);)
-- DEBUG9(qim_dump_buffer((uint8_t *)&pfc_scsi_cmd->data_cmnd[0], 16);)
--
-- switch (pfc_scsi_pass->Direction) {
-- case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-- pfc_scsi_cmd->sc_data_direction = DMA_TO_DEVICE;
-- break;
-- case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-- pfc_scsi_cmd->sc_data_direction = DMA_FROM_DEVICE;
-- break;
-- default :
-- pfc_scsi_cmd->sc_data_direction = DMA_NONE;
-- break;
-- }
--
-- /* send command to adapter */
-- DEBUG9(printk("%s(%ld): inst=%ld queuing command.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if ((ret = qim_ioctl_scsi_queuecommand(ha, pext, pfc_scsi_cmd,
-- pfc_scsi_device, fcport, fclun))) {
-- if (ret > 0)
-- /* this is not a system error. only return system
-- * errors which are negative.
-- */
-- ret = 0;
--
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld waiting for completion.\n",
-- __func__, ha->host_no, ha->instance);)
-- /* Wait for comletion */
-- down(&ha->ioctl->cmpl_sem);
--
-- DEBUG9(printk("%s(%ld): inst=%ld waking up.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (ha->ioctl->SCSIPT_InProgress == 1) {
--
-- printk(KERN_WARNING
-- "qim: scsi%ld ERROR passthru command timeout.\n",
-- ha->host_no);
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
-- }
--
-- if (CMD_COMPL_STATUS(pfc_scsi_cmd) == (int)IOCTL_INVALID_STATUS) {
--
-- DEBUG9(printk("%s(%ld): inst=%ld ERROR. cmd not completed "
-- "or timed out.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_ERR;
-- return (ret);
-- }
--
-- switch (CMD_COMPL_STATUS(pfc_scsi_cmd)) {
-- case CS_INCOMPLETE:
-- case CS_ABORTED:
-- case CS_PORT_UNAVAILABLE:
-- case CS_PORT_LOGGED_OUT:
-- case CS_PORT_CONFIG_CHG:
-- case CS_PORT_BUSY:
-- DEBUG9_10(printk("%s(%ld): inst=%ld cs err = %x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pfc_scsi_cmd));)
-- pext->Status = EXT_STATUS_BUSY;
--
-- return (ret);
-- }
--
-- if ((CMD_COMPL_STATUS(pfc_scsi_cmd) == CS_DATA_UNDERRUN) ||
-- (CMD_SCSI_STATUS(pfc_scsi_cmd) != 0)) {
--
-- /* have done the post function */
-- pext->Status = EXT_STATUS_SCSI_STATUS;
-- /* The SDMAPI is only concerned with the low-order byte */
-- pext->DetailStatus = CMD_SCSI_STATUS(pfc_scsi_cmd) & 0xff;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld data underrun or scsi err. "
-- "host status =0x%x, scsi status = 0x%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pfc_scsi_cmd),
-- CMD_SCSI_STATUS(pfc_scsi_cmd));)
--
-- } else if (CMD_COMPL_STATUS(pfc_scsi_cmd) != 0) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld cs err=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pfc_scsi_cmd));)
-- pext->Status = EXT_STATUS_ERR;
--
-- return (ret);
-- }
--
-- /* Process completed command */
-- DEBUG9(printk("%s(%ld): inst=%ld done. host status=0x%x, "
-- "scsi status=0x%x.\n",
-- __func__, ha->host_no, ha->instance, CMD_COMPL_STATUS(pfc_scsi_cmd),
-- CMD_SCSI_STATUS(pfc_scsi_cmd));)
--
-- /* copy up structure to make sense data available to user */
-- pfc_scsi_pass->SenseLength = CMD_ACTUAL_SNSLEN(pfc_scsi_cmd);
-- if (CMD_ACTUAL_SNSLEN(pfc_scsi_cmd)) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld sense[0]=%x sense[2]=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- pfc_scsi_cmd->sense_buffer[0],
-- pfc_scsi_cmd->sense_buffer[2]);)
--
-- for (i = 0; i < CMD_ACTUAL_SNSLEN(pfc_scsi_cmd); i++) {
-- pfc_scsi_pass->SenseData[i] =
-- pfc_scsi_cmd->sense_buffer[i];
-- }
--
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld copying sense buf to user.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pfc_scsi_pass;
-- ret = copy_to_user(usr_temp, kernel_tmp,
-- sizeof(EXT_FC_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-- "buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- if (pfc_scsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
--
-- DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* now copy up the READ data to user */
-- if ((CMD_COMPL_STATUS(pfc_scsi_cmd) == CS_DATA_UNDERRUN) &&
-- (CMD_RESID_LEN(pfc_scsi_cmd))) {
--
-- transfer_len = pext->ResponseLen -
-- CMD_RESID_LEN(pfc_scsi_cmd);
--
-- pext->ResponseLen = transfer_len;
-- } else {
-- transfer_len = pext->ResponseLen;
-- }
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)ha->ioctl_mem;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--#if 0
--/* RLU: this need to be handled later */
--/*
-- * qim_sc_scsi3_passthru
-- * Handles EXT_SC_SCSI3_PASSTHRU subcommand.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = EXT_IOCTL structure pointer.
-- * mode = not used.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_sc_scsi3_passthru(struct qla_host_ioctl *ha, EXT_IOCTL *pext,
-- struct scsi_cmnd *pscsi3_cmd, struct scsi_device *pscsi3_device, int mode)
--{
--#define MAX_SCSI3_CDB_LEN 16
--
-- int ret = 0;
-- int found;
-- fc_lun_t temp_fclun;
-- fc_lun_t *fclun = NULL;
-- struct list_head *fcpl;
-- fc_port_t *fcport;
-- uint8_t *usr_temp, *kernel_tmp;
-- uint32_t transfer_len;
-- uint32_t i;
--
-- EXT_FC_SCSI_PASSTHRU *pscsi3_pass;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
-- DEBUG9_10(
-- if (!pscsi3_cmd || !pscsi3_device) {
-- printk("%s(%ld): invalid pointer received. "
-- "pfc_scsi_cmd=%p, pfc_scsi_device=%p.\n",
-- __func__, ha->host_no, pscsi3_cmd,
-- pscsi3_device);
-- return (ret);
-- }
-- )
--
-- if (test_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags) ||
-- test_bit(FAILOVER_EVENT, &ha->dpc_flags) ||
-- test_bit(FAILOVER_NEEDED, &ha->dpc_flags)) {
-- /* Stall intrusive passthru commands until failover complete */
-- DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-- "returning busy.\n",
-- __func__, ha->host_no, ha->instance);)
-- pext->Status = EXT_STATUS_BUSY;
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&pscsi3_pass,
-- sizeof(EXT_FC_SCSI_PASSTHRU))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_FC_SCSI_PASSTHRU));)
-- return (ret);
-- }
--
--
-- if (pext->ResponseLen > ha->ioctl_mem_size) {
-- if (qim_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-- QIM_SUCCESS) {
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot "
-- "alloc requested DMA buffer size=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- pext->ResponseLen);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
-- }
--
-- /* clear ioctl_mem to be used */
-- memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
--
-- /* Copy request buffer */
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pscsi3_pass;
-- ret = copy_from_user(kernel_tmp, usr_temp,
-- sizeof(EXT_FC_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- return (-EFAULT);
-- }
--
-- if (pscsi3_pass->FCScsiAddr.DestType != EXT_DEF_DESTTYPE_WWPN) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR - wrong Dest type.\n",
-- __func__, ha->host_no, ha->instance);)
-- ret = EXT_STATUS_ERR;
--
-- return (ret);
-- }
--
-- /*
-- * For this ioctl command we always assume all 16 bytes are
-- * initialized.
-- */
-- if (pscsi3_pass->CdbLength != MAX_SCSI3_CDB_LEN) {
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR -wrong Cdb Len %d.\n",
-- __func__, ha->host_no, ha->instance,
-- pscsi3_pass->CdbLength);)
-- return (ret);
-- }
--
-- fcport = NULL;
-- found = 0;
-- list_for_each(fcpl, &ha->fcports) {
-- fcport = list_entry(fcpl, fc_port_t, list);
--
-- if (memcmp(fcport->port_name,
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN, 8) == 0) {
-- found++;
-- break;
-- }
-- }
-- if (!found) {
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld DID NOT FIND Port for WWPN "
-- "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no, ha->instance,
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[0],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[1],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[2],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[3],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[4],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[5],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[6],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[7]);)
--
-- return (ret);
-- }
--
-- /* Use a temporary fclun to send out the command. */
-- fclun = &temp_fclun;
-- fclun->fcport = fcport;
-- fclun->lun = pscsi3_pass->FCScsiAddr.Lun;
--
-- /* set target coordinates */
-- pscsi3_cmd->device->id = 0xff; /* not used. just put something there. */
-- pscsi3_cmd->device->lun = pscsi3_pass->FCScsiAddr.Lun;
--
-- DEBUG9(printk("%s(%ld): inst=%ld cmd for loopid=%04x L=%04x "
-- "WWPN=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-- __func__, ha->host_no, ha->instance,
-- fclun->fcport->loop_id, pscsi3_cmd->device->lun,
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[0],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[1],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[2],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[3],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[4],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[5],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[6],
-- pscsi3_pass->FCScsiAddr.DestAddr.WWPN[7]);)
--
-- pscsi3_cmd->cmd_len = MAX_SCSI3_CDB_LEN;
-- memcpy(pscsi3_cmd->data_cmnd, pscsi3_pass->Cdb, pscsi3_cmd->cmd_len);
-- memcpy(pscsi3_cmd->cmnd, pscsi3_pass->Cdb, pscsi3_cmd->cmd_len);
--
-- switch (pscsi3_pass->Direction) {
-- case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-- pscsi3_cmd->sc_data_direction = DMA_TO_DEVICE;
-- break;
-- case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-- pscsi3_cmd->sc_data_direction = DMA_FROM_DEVICE;
-- break;
-- default :
-- pscsi3_cmd->sc_data_direction = DMA_NONE;
-- break;
-- }
--
-- if (pscsi3_pass->Timeout)
-- pscsi3_cmd->timeout_per_command = pscsi3_pass->Timeout * HZ;
--
-- DEBUG9(printk("%s(%ld): inst=%ld cdb buffer dump:\n",
-- __func__, ha->host_no, ha->instance);)
-- DEBUG9(qim_dump_buffer((uint8_t *)&pscsi3_cmd->data_cmnd[0], 16);)
--
-- if ((ret = qim_ioctl_scsi_queuecommand(ha, pext, pscsi3_cmd,
-- pscsi3_device, fcport, fclun))) {
-- if (ret > 0)
-- /* this is not a system error. only return system
-- * errors which are negative.
-- */
-- ret = 0;
--
-- return (ret);
-- }
--
-- /* Wait for comletion */
-- down(&ha->ioctl->cmpl_sem);
--
-- if (ha->ioctl->SCSIPT_InProgress == 1) {
--
-- printk(KERN_WARNING
-- "qim: inst=%ld scsi%ld ERROR PT command timeout.\n",
-- ha->host_no, ha->instance);
--
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- return (ret);
--
-- }
-- if (CMD_COMPL_STATUS(pscsi3_cmd) == (int)IOCTL_INVALID_STATUS) {
--
-- DEBUG9(printk("%s(%ld): inst=%ld ERROR - cmd not completed.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- pext->Status = EXT_STATUS_ERR;
-- return (ret);
-- }
--
-- if ((CMD_SCSI_STATUS(pscsi3_cmd) & 0xff) != 0) {
--
-- /* have done the post function */
-- pext->Status = EXT_STATUS_SCSI_STATUS;
-- pext->DetailStatus = CMD_SCSI_STATUS(pscsi3_cmd) & 0xff;
--
-- DEBUG9_10(printk(KERN_INFO "%s(%ld): inst=%ld scsi err. "
-- "host status =0x%x, scsi status = 0x%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi3_cmd), CMD_SCSI_STATUS(pscsi3_cmd));)
--
-- } else {
-- if (CMD_COMPL_STATUS(pscsi3_cmd) == CS_DATA_OVERRUN) {
-- pext->Status = EXT_STATUS_DATA_OVERRUN;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld return overrun.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- } else if (CMD_COMPL_STATUS(pscsi3_cmd) == CS_DATA_UNDERRUN &&
-- (CMD_SCSI_STATUS(pscsi3_cmd) & SS_RESIDUAL_UNDER)) {
-- pext->Status = EXT_STATUS_DATA_UNDERRUN;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld return underrun.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- } else if (CMD_COMPL_STATUS(pscsi3_cmd) != 0 ||
-- CMD_SCSI_STATUS(pscsi3_cmd) != 0) {
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): inst=%ld, cs err=%x, scsi err=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- CMD_COMPL_STATUS(pscsi3_cmd),
-- CMD_SCSI_STATUS(pscsi3_cmd));)
--
-- return (ret);
-- }
-- }
--
-- /* Process completed command */
-- DEBUG9(printk("%s(%ld): inst=%ld done. host status=0x%x, "
-- "scsi status=0x%x.\n",
-- __func__, ha->host_no, ha->instance, CMD_COMPL_STATUS(pscsi3_cmd),
-- CMD_SCSI_STATUS(pscsi3_cmd));)
--
-- /* copy up structure to make sense data available to user */
-- pscsi3_pass->SenseLength = CMD_ACTUAL_SNSLEN(pscsi3_cmd);
-- if (CMD_ACTUAL_SNSLEN(pscsi3_cmd)) {
-- DEBUG9_10(printk("%s(%ld): inst=%ld sense[0]=%x sense[2]=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- pscsi3_cmd->sense_buffer[0],
-- pscsi3_cmd->sense_buffer[2]);)
--
-- for (i = 0; i < CMD_ACTUAL_SNSLEN(pscsi3_cmd); i++) {
-- pscsi3_pass->SenseData[i] =
-- pscsi3_cmd->sense_buffer[i];
-- }
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)pscsi3_pass;
-- ret = copy_to_user(usr_temp, kernel_tmp,
-- sizeof(EXT_FC_SCSI_PASSTHRU));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-- "buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
-- }
--
-- if (pscsi3_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
--
-- DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* now copy up the READ data to user */
-- if ((CMD_COMPL_STATUS(pscsi3_cmd) == CS_DATA_UNDERRUN) &&
-- (CMD_RESID_LEN(pscsi3_cmd))) {
--
-- transfer_len = pext->ResponseLen -
-- CMD_RESID_LEN(pscsi3_cmd);
--
-- pext->ResponseLen = transfer_len;
-- } else {
-- transfer_len = pext->ResponseLen;
-- }
--
-- DEBUG9_10(printk(KERN_INFO
-- "%s(%ld): final transferlen=%d.\n",
-- __func__, ha->host_no, transfer_len);)
--
-- usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-- pext->AddrMode);
-- kernel_tmp = (uint8_t *)ha->ioctl_mem;
-- ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--#endif
--
--/*
-- * qim_send_els_rnid
-- * IOCTL to send extended link service RNID command to a target.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_send_els_rnid(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
--#if 0
-- EXT_RNID_REQ *tmp_rnid;
-- uint16_t mb[MAILBOX_REGISTER_COUNT];
-- uint32_t copy_len;
-- int found;
-- uint16_t next_loop_id;
-- fc_port_t *fcport;
--#endif
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
--#if 0
--/* RLU: this need to be handled later */
-- if (ha->ioctl_mem_size < SEND_RNID_RSP_SIZE) {
-- if (qim_get_new_ioctl_dma_mem(ha,
-- SEND_RNID_RSP_SIZE) != QIM_SUCCESS) {
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-- "DMA buffer. size=%x.\n",
-- __func__, ha->host_no, ha->instance,
-- SEND_RNID_RSP_SIZE);)
--
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- return (ret);
-- }
-- }
--
-- if (pext->RequestLen != sizeof(EXT_RNID_REQ)) {
-- /* parameter error */
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid req length %d.\n",
-- __func__, ha->host_no, ha->instance, pext->RequestLen);)
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- return (ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&tmp_rnid,
-- sizeof(EXT_RNID_REQ))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_RNID_REQ));)
-- return (ret);
-- }
--
-- ret = copy_from_user(tmp_rnid, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- /* Find loop ID of the device */
-- found = 0;
-- fcport = NULL;
-- switch (tmp_rnid->Addr.Type) {
-- case EXT_DEF_TYPE_WWNN:
-- DEBUG9(printk("%s(%ld): inst=%ld got node name.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (fcport->port_type != FCT_INITIATOR ||
-- fcport->port_type != FCT_TARGET)
-- continue;
--
-- if (memcmp(tmp_rnid->Addr.FcAddr.WWNN,
-- fcport->node_name, EXT_DEF_WWN_NAME_SIZE))
-- continue;
--
-- if (fcport->port_type == FCT_TARGET) {
-- if (atomic_read(&fcport->state) != FCS_ONLINE)
-- continue;
-- } else { /* FCT_INITIATOR */
-- if (!fcport->d_id.b24)
-- continue;
-- }
--
-- found++;
-- }
-- break;
--
-- case EXT_DEF_TYPE_WWPN:
-- DEBUG9(printk("%s(%ld): inst=%ld got port name.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (fcport->port_type != FCT_INITIATOR ||
-- fcport->port_type != FCT_TARGET)
-- continue;
--
-- if (memcmp(tmp_rnid->Addr.FcAddr.WWPN,
-- fcport->port_name, EXT_DEF_WWN_NAME_SIZE))
-- continue;
--
-- if (fcport->port_type == FCT_TARGET) {
-- if (atomic_read(&fcport->state) != FCS_ONLINE)
-- continue;
-- } else { /* FCT_INITIATOR */
-- if (!fcport->d_id.b24)
-- continue;
-- }
--
-- found++;
-- }
-- break;
--
-- case EXT_DEF_TYPE_PORTID:
-- DEBUG9(printk("%s(%ld): inst=%ld got port ID.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- list_for_each_entry(fcport, &ha->fcports, list) {
-- if (fcport->port_type != FCT_INITIATOR ||
-- fcport->port_type != FCT_TARGET)
-- continue;
--
-- /* PORTID bytes entered must already be big endian */
-- if (memcmp(&tmp_rnid->Addr.FcAddr.Id[1],
-- &fcport->d_id, EXT_DEF_PORTID_SIZE_ACTUAL))
-- continue;
--
-- if (fcport->port_type == FCT_TARGET) {
-- if (atomic_read(&fcport->state) != FCS_ONLINE)
-- continue;
-- }
--
-- found++;
-- }
-- break;
-- default:
-- /* parameter error */
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid addressing type.\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- if (!found || (fcport->port_type == FCT_TARGET &&
-- fcport->loop_id > ha->last_loop_id)) {
-- /*
-- * No matching device or the target device is not configured;
-- * just return error.
-- */
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- /* check on loop down */
-- if (atomic_read(&ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || ha->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- /* If this is for a host device, check if we need to perform login */
-- if (fcport->port_type == FCT_INITIATOR &&
-- fcport->loop_id >= ha->last_loop_id) {
-- next_loop_id = 0;
-- ret = qim_fabric_login(ha, fcport, &next_loop_id);
-- if (ret != QIM_SUCCESS) {
-- /* login failed. */
-- pext->Status = EXT_STATUS_DEV_NOT_FOUND;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR login to "
-- "host port failed. loop_id=%02x pid=%02x%02x%02x "
-- "ret=%d.\n",
-- __func__, ha->host_no, ha->instance,
-- fcport->loop_id, fcport->d_id.b.domain,
-- fcport->d_id.b.area, fcport->d_id.b.al_pa, ret);)
--
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
-- }
--
-- /* Send command */
-- DEBUG9(printk("%s(%ld): inst=%ld sending rnid cmd.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- ret = qim_send_rnid_mbx(ha, fcport->loop_id,
-- (uint8_t)tmp_rnid->DataFormat, ha->ioctl_mem_phys,
-- SEND_RNID_RSP_SIZE, &mb[0]);
--
-- if (ret != QIM_SUCCESS) {
-- /* error */
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld FAILED. rval = %x.\n",
-- __func__, ha->host_no, ha->instance, mb[0]);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld rnid cmd sent ok.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* Copy the response */
-- copy_len = (pext->ResponseLen > SEND_RNID_RSP_SIZE) ?
-- SEND_RNID_RSP_SIZE : pext->ResponseLen;
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ha->ioctl_mem, copy_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-- __func__, ha->host_no, ha->instance);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- if (SEND_RNID_RSP_SIZE > pext->ResponseLen) {
-- pext->Status = EXT_STATUS_DATA_OVERRUN;
-- DEBUG9(printk("%s(%ld): inst=%ld data overrun. "
-- "exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- } else {
-- pext->Status = EXT_STATUS_OK;
-- DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- }
-- pext->ResponseLen = copy_len;
--
-- qim_free_ioctl_scrap_mem(ha);
--#endif
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
--}
--
--/*
-- * qim_get_rnid_params
-- * IOCTL to get RNID parameters of the adapter.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_rnid_params(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- int tmp_rval = 0;
-- uint32_t copy_len;
-- uint16_t mb[MAILBOX_REGISTER_COUNT];
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on loop down */
-- if (atomic_read(&dr_ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- dr_ha->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
--
-- /* Send command */
-- tmp_rval = qim_get_rnid_params_mbx(dr_ha, ha->ioctl_mem_phys,
-- sizeof(EXT_RNID_DATA), &mb[0]);
--
-- if (tmp_rval != QIM_SUCCESS) {
-- /* error */
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld cmd FAILED=%x.\n",
-- __func__, ha->host_no, ha->instance, mb[0]);)
-- return (ret);
-- }
--
-- /* Copy the response */
-- copy_len = (pext->ResponseLen > sizeof(EXT_RNID_DATA)) ?
-- (uint32_t)sizeof(EXT_RNID_DATA) : pext->ResponseLen;
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- ha->ioctl_mem, copy_len);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- pext->ResponseLen = copy_len;
-- if (copy_len < sizeof(EXT_RNID_DATA)) {
-- pext->Status = EXT_STATUS_DATA_OVERRUN;
-- DEBUG9_10(printk("%s(%ld): inst=%ld data overrun. "
-- "exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- } else if (pext->ResponseLen > sizeof(EXT_RNID_DATA)) {
-- pext->Status = EXT_STATUS_DATA_UNDERRUN;
-- DEBUG9_10(printk("%s(%ld): inst=%ld data underrun. "
-- "exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- } else {
-- pext->Status = EXT_STATUS_OK;
-- DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- }
--
-- return (ret);
--}
--
--#if 0
--/* RLU: this need to be handled later */
--/*
-- *qim_get_led_state
-- * IOCTL to get QLA2XXX HBA LED state
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_get_led_state(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- EXT_BEACON_CONTROL tmp_led_state;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (pext->ResponseLen < sizeof(EXT_BEACON_CONTROL)) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s: ERROR ResponseLen too small.\n",
-- __func__);)
--
-- return (ret);
-- }
--
-- if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- /* Return current state */
-- if (ha->beacon_blink_led) {
-- tmp_led_state.State = EXT_DEF_GRN_BLINK_ON;
-- } else {
-- tmp_led_state.State = EXT_DEF_GRN_BLINK_OFF;
-- }
--
-- ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-- &tmp_led_state, sizeof(EXT_BEACON_CONTROL));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (-EFAULT);
-- }
--
-- pext->Status = EXT_STATUS_OK;
-- pext->DetailStatus = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--
--}
--#endif
--
--/*
-- * qim_set_host_data
-- * IOCTL command to set host/adapter related data.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_set_host_data(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* switch on command subcode */
-- switch (pext->SubCode) {
-- case EXT_SC_SET_RNID:
-- ret = qim_set_rnid_params(ha, pext, mode);
-- break;
--#if 0
--/* RLU: this need to be handled later */
-- case EXT_SC_SET_BEACON_STATE:
-- if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-- ret = qim_set_led_state(ha, pext, mode);
-- break;
-- }
-- /*FALLTHROUGH*/
--#endif
-- default:
-- /* function not supported. */
-- pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--/*
-- * qim_set_rnid_params
-- * IOCTL to set RNID parameters of the adapter.
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_set_rnid_params(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- EXT_SET_RNID_REQ *tmp_set;
-- EXT_RNID_DATA *tmp_buf;
-- int ret = 0;
-- int tmp_rval = 0;
-- uint16_t mb[MAILBOX_REGISTER_COUNT];
-- struct scsi_qla_host *dr_ha = ha->dr_data;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- /* check on loop down */
-- if (atomic_read(&dr_ha->loop_state) != LOOP_READY ||
-- test_bit(CFG_ACTIVE, &dr_ha->cfg_flags) ||
-- test_bit(ABORT_ISP_ACTIVE, &dr_ha->dpc_flags) ||
-- test_bit(ISP_ABORT_NEEDED, &dr_ha->dpc_flags) ||
-- dr_ha->dpc_active) {
--
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
-- }
--
-- if (pext->RequestLen != sizeof(EXT_SET_RNID_REQ)) {
-- /* parameter error */
-- pext->Status = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid request length.\n",
-- __func__, ha->host_no, ha->instance);)
-- return(ret);
-- }
--
-- if (qim_get_ioctl_scrap_mem(ha, (void **)&tmp_set,
-- sizeof(EXT_SET_RNID_REQ))) {
-- /* not enough memory */
-- pext->Status = EXT_STATUS_NO_MEMORY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-- "size requested=%ld.\n",
-- __func__, ha->host_no, ha->instance,
-- (ulong)sizeof(EXT_SET_RNID_REQ));)
-- return (ret);
-- }
--
-- ret = copy_from_user(tmp_set, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), pext->RequestLen);
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (-EFAULT);
-- }
--
-- tmp_rval = qim_get_rnid_params_mbx(dr_ha, ha->ioctl_mem_phys,
-- sizeof(EXT_RNID_DATA), &mb[0]);
-- if (tmp_rval != QIM_SUCCESS) {
-- /* error */
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld read cmd FAILED=%x.\n",
-- __func__, ha->host_no, ha->instance, mb[0]);)
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
-- }
--
-- tmp_buf = (EXT_RNID_DATA *)ha->ioctl_mem;
--
-- /* Now set the params. */
-- memcpy(tmp_buf->IPVersion, tmp_set->IPVersion, 2);
-- memcpy(tmp_buf->UDPPortNumber, tmp_set->UDPPortNumber, 2);
-- memcpy(tmp_buf->IPAddress, tmp_set->IPAddress, 16);
--
-- tmp_rval = qim_set_rnid_params_mbx(dr_ha, ha->ioctl_mem_phys,
-- sizeof(EXT_RNID_DATA), &mb[0]);
--
-- if (tmp_rval != QIM_SUCCESS) {
-- /* error */
-- pext->Status = EXT_STATUS_ERR;
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld set cmd FAILED=%x.\n",
-- __func__, ha->host_no, ha->instance, mb[0]);)
-- } else {
-- pext->Status = EXT_STATUS_OK;
-- DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-- __func__, ha->host_no, ha->instance);)
-- }
--
-- qim_free_ioctl_scrap_mem(ha);
-- return (ret);
--}
--
--#if 0
--/* RLU: this need to be handled later */
--/*
-- *qim_set_led_state
-- * IOCTL to set QLA2XXX HBA LED state
-- *
-- * Input:
-- * ha = adapter state pointer.
-- * pext = User space CT arguments pointer.
-- * mode = flags.
-- *
-- * Returns:
-- * 0 = success
-- * others = errno value
-- *
-- * Context:
-- * Kernel context.
-- */
--static int
--qim_set_led_state(struct qla_host_ioctl *ha, EXT_IOCTL *pext, int mode)
--{
-- int ret = 0;
-- uint32_t tmp_ext_stat = 0;
-- uint32_t tmp_ext_dstat = 0;
-- EXT_BEACON_CONTROL tmp_led_state;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (pext->RequestLen < sizeof(EXT_BEACON_CONTROL)) {
-- pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-- DEBUG9_10(printk("%s: ERROR RequestLen too small.\n",
-- __func__);)
-- return (ret);
-- }
--
-- if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-- pext->Status = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- ret = copy_from_user(&tmp_led_state, Q64BIT_TO_PTR(pext->RequestAdr,
-- pext->AddrMode), sizeof(EXT_BEACON_CONTROL));
-- if (ret) {
-- pext->Status = EXT_STATUS_COPY_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy req buf=%d.\n",
-- __func__, ha->host_no, ha->instance, ret);)
-- return (-EFAULT);
-- }
--
-- if (IS_QLA23XX(ha)) {
-- ret = qim_set_led_23xx(ha, &tmp_led_state, &tmp_ext_stat,
-- &tmp_ext_dstat);
-- } else if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- ret = qim_set_led_24xx(ha, &tmp_led_state, &tmp_ext_stat,
-- &tmp_ext_dstat);
-- } else {
-- /* not supported */
-- tmp_ext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- }
--
-- pext->Status = tmp_ext_stat;
-- pext->DetailStatus = tmp_ext_dstat;
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--static int
--qim_set_led_23xx(struct qla_host_ioctl *ha, EXT_BEACON_CONTROL *ptmp_led_state,
-- uint32_t *pext_stat, uint32_t *pext_dstat)
--{
-- int ret = 0;
-- device_reg_t __iomem *reg = ha->iobase;
-- uint16_t gpio_enable, gpio_data;
-- unsigned long cpu_flags = 0;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (ptmp_led_state->State != EXT_DEF_GRN_BLINK_ON &&
-- ptmp_led_state->State != EXT_DEF_GRN_BLINK_OFF) {
-- *pext_stat = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld Unknown Led State set "
-- "operation recieved %x.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_led_state->State);)
-- return (ret);
-- }
--
-- if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-- *pext_stat = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (ret);
-- }
--
-- switch (ptmp_led_state->State) {
-- case EXT_DEF_GRN_BLINK_ON:
--
-- DEBUG9(printk("%s(%ld): inst=%ld start blinking led \n",
-- __func__, ha->host_no, ha->instance);)
--
-- DEBUG9(printk("%s(%ld): inst=%ld orig firmware options "
-- "fw_options1=0x%x fw_options2=0x%x fw_options3=0x%x.\n",
-- __func__, ha->host_no, ha->instance, ha->fw_options[1],
-- ha->fw_options[2], ha->fw_options[3]);)
--
-- ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-- ha->fw_options[1] |= FO1_DISABLE_GPIO6_7;
--
-- if (qim_set_fw_options(ha, ha->fw_options) != QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld set"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- if (ha->pio_address)
-- reg = (device_reg_t *)ha->pio_address;
--
-- /* Turn off LEDs */
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- if (ha->pio_address) {
-- gpio_enable = RD_REG_WORD_PIO(&reg->gpioe);
-- gpio_data = RD_REG_WORD_PIO(&reg->gpiod);
-- } else {
-- gpio_enable = RD_REG_WORD(&reg->gpioe);
-- gpio_data = RD_REG_WORD(&reg->gpiod);
-- }
-- gpio_enable |= GPIO_LED_MASK;
--
-- /* Set the modified gpio_enable values */
-- if (ha->pio_address)
-- WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable);
-- else {
-- WRT_REG_WORD(&reg->gpioe, gpio_enable);
-- RD_REG_WORD(&reg->gpioe);
-- }
--
-- /* Clear out previously set LED colour */
-- gpio_data &= ~GPIO_LED_MASK;
-- if (ha->pio_address)
-- WRT_REG_WORD_PIO(&reg->gpiod, gpio_data);
-- else {
-- WRT_REG_WORD(&reg->gpiod, gpio_data);
-- RD_REG_WORD(&reg->gpiod);
-- }
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
--
-- /* Let the per HBA timer kick off the blinking process based on
-- * the following flags. No need to do anything else now.
-- */
-- ha->beacon_blink_led = 1;
-- ha->beacon_color_state = 0;
--
-- /* end of if(ptmp_led_state.State == EXT_DEF_GRN_BLINK_ON) ) */
--
-- *pext_stat = EXT_STATUS_OK;
-- *pext_dstat = EXT_STATUS_OK;
-- break;
--
-- case EXT_DEF_GRN_BLINK_OFF:
-- DEBUG9(printk("%s(%ld): inst=%ld stop blinking led \n",
-- __func__, ha->host_no, ha->instance);)
--
-- ha->beacon_blink_led = 0;
-- /* Set the on flag so when it gets flipped it will be off */
-- if (IS_QLA2322(ha)) {
-- ha->beacon_color_state = QLA_LED_RGA_ON;
-- } else {
-- ha->beacon_color_state = QLA_LED_GRN_ON;
-- }
-- qla23xx_blink_led(ha); /* This turns green LED off */
--
-- DEBUG9(printk("%s(%ld): inst=%ld orig firmware"
-- " options fw_options1=0x%x fw_options2=0x%x "
-- "fw_options3=0x%x.\n",
-- __func__, ha->host_no, ha->instance, ha->fw_options[1],
-- ha->fw_options[2], ha->fw_options[3]);)
--
-- ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-- ha->fw_options[1] &= ~FO1_DISABLE_GPIO6_7;
--
-- if (qim_set_fw_options(ha, ha->fw_options) != QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_ERR;
-- DEBUG9_10(printk("%s(%ld): inst=%ld set"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- /* end of if(ptmp_led_state.State == EXT_DEF_GRN_BLINK_OFF) */
--
-- *pext_stat = EXT_STATUS_OK;
-- *pext_dstat = EXT_STATUS_OK;
-- break;
-- default:
-- *pext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (ret);
--}
--
--static int
--qim_set_led_24xx(struct qla_host_ioctl *ha,
-- EXT_BEACON_CONTROL *ptmp_led_state, uint32_t *pext_stat,
-- uint32_t *pext_dstat)
--{
-- int rval = 0;
-- struct device_reg_24xx __iomem *reg24 =
-- (struct device_reg_24xx __iomem *)ha->iobase;
-- uint32_t gpio_data;
-- uint32_t led_state;
-- unsigned long cpu_flags = 0;
--
--
-- DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- led_state = ptmp_led_state->State;
-- if (led_state != EXT_DEF_GRN_BLINK_ON &&
-- led_state != EXT_DEF_GRN_BLINK_OFF) {
-- *pext_stat = EXT_STATUS_INVALID_PARAM;
-- DEBUG9_10(printk(
-- "%s(%ld): inst=%ld Unknown Led State set "
-- "operation recieved %x.\n",
-- __func__, ha->host_no, ha->instance,
-- ptmp_led_state->State);)
-- return (rval);
-- }
--
-- if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-- *pext_stat = EXT_STATUS_BUSY;
-- DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-- __func__, ha->host_no, ha->instance);)
-- return (rval);
-- }
--
-- DEBUG9_10(printk("%s(%ld): inst=%ld orig firmware options "
-- "fw_options1=0x%x fw_options2=0x%x fw_options3=0x%x.\n",
-- __func__, ha->host_no, ha->instance, ha->fw_options[1],
-- ha->fw_options[2], ha->fw_options[3]);)
--
-- switch (led_state) {
-- case EXT_DEF_GRN_BLINK_ON:
--
-- DEBUG9(printk("%s(%ld): inst=%ld start blinking led \n",
-- __func__, ha->host_no, ha->instance);)
--
-- if (!ha->beacon_blink_led) {
-- /* Enable firmware for update */
-- ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL;
--
-- if (qim_set_fw_options(ha, ha->fw_options) !=
-- QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_MAILBOX;
-- *pext_dstat = ha->fw_options[0];
-- DEBUG9_10(printk("%s(%ld): inst=%ld set"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- if (qim_get_fw_options(ha, ha->fw_options) !=
-- QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_MAILBOX;
-- *pext_dstat = ha->fw_options[0];
-- DEBUG9_10(printk("%s(%ld): inst=%ld get"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- gpio_data = RD_REG_DWORD(&reg24->gpiod);
--
-- /* Enable the gpio_data reg for update */
-- gpio_data |= GPDX_LED_UPDATE_MASK;
-- WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-- RD_REG_DWORD(&reg24->gpiod);
--
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-- }
--
-- ha->beacon_color_state = 0; /* so all colors blink together */
--
-- /* Let the per HBA timer kick off the blinking process*/
-- ha->beacon_blink_led = 1;
--
-- *pext_stat = EXT_STATUS_OK;
-- *pext_dstat = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): inst=%ld LED setup to blink.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- break;
--
-- case EXT_DEF_GRN_BLINK_OFF:
-- DEBUG9(printk("%s(%ld): inst=%ld stop blinking led \n",
-- __func__, ha->host_no, ha->instance);)
--
-- ha->beacon_blink_led = 0;
-- ha->beacon_color_state = QLA_LED_ALL_ON;
-- qla24xx_blink_led(ha); /* will flip to all off */
--
-- /* give control back to firmware */
-- spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-- gpio_data = RD_REG_DWORD(&reg24->gpiod);
--
-- /* Disable the gpio_data reg for update */
-- gpio_data &= ~GPDX_LED_UPDATE_MASK;
-- WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-- RD_REG_DWORD(&reg24->gpiod);
-- spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
--
-- ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
--
-- if (qim_set_fw_options(ha, ha->fw_options) != QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_MAILBOX;
-- *pext_dstat = ha->fw_options[0];
-- DEBUG9_10(printk("%s(%ld): inst=%ld set"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- if (qim_get_fw_options(ha, ha->fw_options) !=
-- QIM_SUCCESS) {
-- *pext_stat = EXT_STATUS_MAILBOX;
-- *pext_dstat = ha->fw_options[0];
-- DEBUG9_10(printk("%s(%ld): inst=%ld get"
-- "firmware options failed.\n",
-- __func__, ha->host_no, ha->instance);)
-- break;
-- }
--
-- *pext_stat = EXT_STATUS_OK;
-- *pext_dstat = EXT_STATUS_OK;
--
-- DEBUG9(printk("%s(%ld): inst=%ld all LED blinking stopped.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- break;
--
-- default:
-- DEBUG9_10(printk("%s(%ld): inst=%ld invalid state received=%x.\n",
-- __func__, ha->host_no, ha->instance, led_state);)
--
-- *pext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-- break;
-- }
--
-- DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-- __func__, ha->host_no, ha->instance);)
--
-- return (rval);
--}
--#endif
--
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2100.c ./drivers/scsi/qla2xxx/ql2100.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2100.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2100.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,11 +1,10 @@
- /*
-- * QLogic ISP2100 device driver for Linux 2.6.x
-- * Copyright (C) 2003 Christoph Hellwig.
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (C) 2003 Christoph Hellwig.
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * Released under GPL v2.
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
--
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/pci.h>
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2100_fw.c ./drivers/scsi/qla2xxx/ql2100_fw.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2100_fw.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2100_fw.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- *************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * Firmware Version 1.19.25 (13:12 Dec 10, 2003)
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2200.c ./drivers/scsi/qla2xxx/ql2200.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2200.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2200.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,11 +1,10 @@
- /*
-- * QLogic ISP2200 device driver for Linux 2.6.x
-- * Copyright (C) 2003 Christoph Hellwig.
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (C) 2003 Christoph Hellwig.
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * Released under GPL v2.
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
--
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/pci.h>
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2200_fw.c ./drivers/scsi/qla2xxx/ql2200_fw.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2200_fw.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2200_fw.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- *************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * Firmware Version 2.02.08 (17:06 Mar 22, 2005)
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2300.c ./drivers/scsi/qla2xxx/ql2300.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2300.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2300.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,11 +1,10 @@
- /*
-- * QLogic ISP2300 device driver for Linux 2.6.x
-- * Copyright (C) 2003 Christoph Hellwig.
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (C) 2003 Christoph Hellwig.
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * Released under GPL v2.
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
--
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/pci.h>
-@@ -41,6 +40,11 @@ static struct qla_board_info qla_board_t
- .isp_name = "ISP2312",
- .fw_info = qla_fw_tbl,
- },
-+ {
-+ .drv_name = qla_driver_name,
-+ .isp_name = "ISP6312",
-+ .fw_info = qla_fw_tbl,
-+ },
- };
-
- static struct pci_device_id qla2300_pci_tbl[] = {
-@@ -58,6 +62,13 @@ static struct pci_device_id qla2300_pci_
- .subdevice = PCI_ANY_ID,
- .driver_data = (unsigned long)&qla_board_tbl[1],
- },
-+ {
-+ .vendor = PCI_VENDOR_ID_QLOGIC,
-+ .device = PCI_DEVICE_ID_QLOGIC_ISP6312,
-+ .subvendor = PCI_ANY_ID,
-+ .subdevice = PCI_ANY_ID,
-+ .driver_data = (unsigned long)&qla_board_tbl[2],
-+ },
- {0, 0},
- };
- MODULE_DEVICE_TABLE(pci, qla2300_pci_tbl);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2300_fw.c ./drivers/scsi/qla2xxx/ql2300_fw.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2300_fw.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2300_fw.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,24 +1,12 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
-- * Firmware Version 3.03.20 (15:39 Feb 01, 2006)
-+ * Firmware Version 3.03.19 (09:41 Nov 30, 2005)
- */
-
- #ifdef UNIQUE_FW_NAME
-@@ -28,15 +16,15 @@ unsigned short risc_code_version = 3*102
- #endif
-
- #ifdef UNIQUE_FW_NAME
--unsigned char fw2300ipx_version_str[] = {3, 3,20};
-+unsigned char fw2300ipx_version_str[] = {3, 3,19};
- #else
--unsigned char firmware_version[] = {3, 3,20};
-+unsigned char firmware_version[] = {3, 3,19};
- #endif
-
- #ifdef UNIQUE_FW_NAME
--#define fw2300ipx_VERSION_STRING "3.03.20"
-+#define fw2300ipx_VERSION_STRING "3.03.19"
- #else
--#define FW_VERSION_STRING "3.03.20"
-+#define FW_VERSION_STRING "3.03.19"
- #endif
-
- #ifdef UNIQUE_FW_NAME
-@@ -50,12 +38,12 @@ unsigned short fw2300ipx_code01[] = {
- #else
- unsigned short risc_code01[] = {
- #endif
-- 0x0470, 0x0000, 0x0000, 0xf091, 0x0000, 0x0003, 0x0003, 0x0014,
-+ 0x0470, 0x0000, 0x0000, 0xf08a, 0x0000, 0x0003, 0x0003, 0x0013,
- 0x0137, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
- 0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
- 0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
- 0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-- 0x332e, 0x3033, 0x2e32, 0x3020, 0x2020, 0x2020, 0x2400, 0x20a9,
-+ 0x332e, 0x3033, 0x2e31, 0x3920, 0x2020, 0x2020, 0x2400, 0x20a9,
- 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
- 0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
- 0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
-@@ -78,96 +66,96 @@ unsigned short risc_code01[] = {
- 0x1800, 0x810d, 0x810d, 0x810d, 0x810d, 0x810d, 0x918c, 0x001f,
- 0x2001, 0x0001, 0x9112, 0x20e9, 0x0001, 0x20a1, 0x0800, 0x900e,
- 0x20a9, 0x0800, 0x4104, 0x8211, 0x1dd8, 0x080c, 0x0f26, 0x080c,
-- 0x613c, 0x080c, 0xb269, 0x080c, 0x10dd, 0x080c, 0x12fc, 0x080c,
-+ 0x6135, 0x080c, 0xb262, 0x080c, 0x10dd, 0x080c, 0x12fc, 0x080c,
- 0x1bd7, 0x080c, 0x0d57, 0x080c, 0x1062, 0x080c, 0x34b6, 0x080c,
-- 0x7946, 0x080c, 0x6b7c, 0x080c, 0x8a69, 0x080c, 0x874a, 0x080c,
-- 0x24b7, 0x080c, 0x93a5, 0x080c, 0x8066, 0x080c, 0x22e8, 0x080c,
-+ 0x793f, 0x080c, 0x6b75, 0x080c, 0x8a62, 0x080c, 0x8743, 0x080c,
-+ 0x24b7, 0x080c, 0x939e, 0x080c, 0x805f, 0x080c, 0x22e8, 0x080c,
- 0x241c, 0x080c, 0x24ac, 0x2091, 0x3009, 0x7883, 0x0000, 0x1004,
- 0x091f, 0x7880, 0x9086, 0x0002, 0x1190, 0x7883, 0x4000, 0x7837,
- 0x4000, 0x7833, 0x0010, 0x0e04, 0x0913, 0x2091, 0x5000, 0x2091,
- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x2071,
- 0x1800, 0x7003, 0x0000, 0x2071, 0x1800, 0x7000, 0x908e, 0x0003,
-- 0x1178, 0x080c, 0x4d09, 0x080c, 0x34dd, 0x080c, 0x79b7, 0x080c,
-- 0x7122, 0x080c, 0x8b50, 0x080c, 0x8776, 0x080c, 0x2cdd, 0x0c58,
-+ 0x1178, 0x080c, 0x4d07, 0x080c, 0x34dd, 0x080c, 0x79b0, 0x080c,
-+ 0x711b, 0x080c, 0x8b49, 0x080c, 0x876f, 0x080c, 0x2cdd, 0x0c58,
- 0x000b, 0x0c78, 0x0944, 0x0945, 0x0ae0, 0x0942, 0x0ba0, 0x0d56,
- 0x0d56, 0x0d56, 0x080c, 0x0dc5, 0x0005, 0x0126, 0x00f6, 0x2091,
- 0x8000, 0x7000, 0x9086, 0x0001, 0x1904, 0x0ab3, 0x080c, 0x0e94,
-- 0x080c, 0x7637, 0x0150, 0x080c, 0x765a, 0x15a0, 0x2079, 0x0100,
-- 0x7828, 0x9085, 0x1800, 0x782a, 0x0468, 0x080c, 0x7563, 0x7000,
-+ 0x080c, 0x7630, 0x0150, 0x080c, 0x7653, 0x15a0, 0x2079, 0x0100,
-+ 0x7828, 0x9085, 0x1800, 0x782a, 0x0468, 0x080c, 0x755c, 0x7000,
- 0x9086, 0x0001, 0x1904, 0x0ab3, 0x7098, 0x9086, 0x0029, 0x1904,
-- 0x0ab3, 0x080c, 0x8733, 0x080c, 0x8725, 0x2001, 0x0161, 0x2003,
-+ 0x0ab3, 0x080c, 0x872c, 0x080c, 0x871e, 0x2001, 0x0161, 0x2003,
- 0x0001, 0x2079, 0x0100, 0x7827, 0xffff, 0x7a28, 0x9295, 0x5e2f,
-- 0x7a2a, 0x2011, 0x74b2, 0x080c, 0x883d, 0x2011, 0x74a5, 0x080c,
-- 0x8917, 0x2011, 0x5f97, 0x080c, 0x883d, 0x2011, 0x8030, 0x901e,
-- 0x7396, 0x04d0, 0x080c, 0x583f, 0x2079, 0x0100, 0x7844, 0x9005,
-- 0x1904, 0x0ab3, 0x2011, 0x5f97, 0x080c, 0x883d, 0x2011, 0x74b2,
-- 0x080c, 0x883d, 0x2011, 0x74a5, 0x080c, 0x8917, 0x2001, 0x0265,
-+ 0x7a2a, 0x2011, 0x74ab, 0x080c, 0x8836, 0x2011, 0x749e, 0x080c,
-+ 0x8910, 0x2011, 0x5f90, 0x080c, 0x8836, 0x2011, 0x8030, 0x901e,
-+ 0x7396, 0x04d0, 0x080c, 0x583d, 0x2079, 0x0100, 0x7844, 0x9005,
-+ 0x1904, 0x0ab3, 0x2011, 0x5f90, 0x080c, 0x8836, 0x2011, 0x74ab,
-+ 0x080c, 0x8836, 0x2011, 0x749e, 0x080c, 0x8910, 0x2001, 0x0265,
- 0x2001, 0x0205, 0x2003, 0x0000, 0x7840, 0x9084, 0xfffb, 0x7842,
- 0x2001, 0x19a7, 0x2004, 0x9005, 0x1140, 0x00c6, 0x2061, 0x0100,
-- 0x080c, 0x60e4, 0x00ce, 0x0804, 0x0ab3, 0x780f, 0x006b, 0x7a28,
-- 0x080c, 0x763f, 0x0118, 0x9295, 0x5e2f, 0x0010, 0x9295, 0x402f,
-+ 0x080c, 0x60dd, 0x00ce, 0x0804, 0x0ab3, 0x780f, 0x006b, 0x7a28,
-+ 0x080c, 0x7638, 0x0118, 0x9295, 0x5e2f, 0x0010, 0x9295, 0x402f,
- 0x7a2a, 0x2011, 0x8010, 0x73d8, 0x2001, 0x19a8, 0x2003, 0x0001,
-- 0x080c, 0x2b82, 0x080c, 0x4c44, 0x7248, 0xc284, 0x724a, 0x2001,
-- 0x180c, 0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x080c, 0xa9b0, 0x2011,
-- 0x0004, 0x080c, 0xd0e8, 0x080c, 0x6947, 0x080c, 0x7637, 0x1120,
-- 0x080c, 0x2bc6, 0x02e0, 0x0400, 0x080c, 0x60eb, 0x0140, 0x7097,
-- 0x0001, 0x70d3, 0x0000, 0x080c, 0x5a11, 0x0804, 0x0ab3, 0x080c,
-- 0x57d5, 0xd094, 0x0188, 0x2011, 0x180c, 0x2204, 0xc0cd, 0x2012,
-- 0x080c, 0x57d9, 0xd0d4, 0x1118, 0x080c, 0x2bc6, 0x1270, 0x2011,
-- 0x180c, 0x2204, 0xc0bc, 0x00a8, 0x080c, 0x57d9, 0xd0d4, 0x1db8,
-+ 0x080c, 0x2b82, 0x080c, 0x4c42, 0x7248, 0xc284, 0x724a, 0x2001,
-+ 0x180c, 0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x080c, 0xa9a9, 0x2011,
-+ 0x0004, 0x080c, 0xd0e1, 0x080c, 0x6940, 0x080c, 0x7630, 0x1120,
-+ 0x080c, 0x2bc6, 0x02e0, 0x0400, 0x080c, 0x60e4, 0x0140, 0x7097,
-+ 0x0001, 0x70d3, 0x0000, 0x080c, 0x5a0a, 0x0804, 0x0ab3, 0x080c,
-+ 0x57d3, 0xd094, 0x0188, 0x2011, 0x180c, 0x2204, 0xc0cd, 0x2012,
-+ 0x080c, 0x57d7, 0xd0d4, 0x1118, 0x080c, 0x2bc6, 0x1270, 0x2011,
-+ 0x180c, 0x2204, 0xc0bc, 0x00a8, 0x080c, 0x57d7, 0xd0d4, 0x1db8,
- 0x2011, 0x180c, 0x2204, 0xc0bd, 0x0060, 0x2011, 0x180c, 0x2204,
-- 0xc0bd, 0x2012, 0x080c, 0x6a9b, 0x1128, 0xd0a4, 0x0118, 0x2204,
-- 0xc0fd, 0x2012, 0x080c, 0x6a61, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
-- 0x00a8, 0x707f, 0x0000, 0x080c, 0x7637, 0x1130, 0x70b0, 0x9005,
-- 0x1168, 0x080c, 0xd52b, 0x0050, 0x080c, 0xd52b, 0x70dc, 0xd09c,
-- 0x1128, 0x70b0, 0x9005, 0x0110, 0x080c, 0x60c1, 0x70e7, 0x0000,
-+ 0xc0bd, 0x2012, 0x080c, 0x6a94, 0x1128, 0xd0a4, 0x0118, 0x2204,
-+ 0xc0fd, 0x2012, 0x080c, 0x6a5a, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
-+ 0x00a8, 0x707f, 0x0000, 0x080c, 0x7630, 0x1130, 0x70b0, 0x9005,
-+ 0x1168, 0x080c, 0xd524, 0x0050, 0x080c, 0xd524, 0x70dc, 0xd09c,
-+ 0x1128, 0x70b0, 0x9005, 0x0110, 0x080c, 0x60ba, 0x70e7, 0x0000,
- 0x70e3, 0x0000, 0x70a7, 0x0000, 0x080c, 0x2bce, 0x0228, 0x2011,
-- 0x0101, 0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x7637, 0x1178,
-+ 0x0101, 0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x7630, 0x1178,
- 0x9016, 0x0016, 0x080c, 0x298b, 0x2019, 0x196d, 0x211a, 0x001e,
- 0x705f, 0xffff, 0x7063, 0x00ef, 0x7083, 0x0000, 0x0020, 0x2019,
- 0x196d, 0x201b, 0x0000, 0x2079, 0x1847, 0x7804, 0xd0ac, 0x0108,
-- 0xc295, 0x72de, 0x080c, 0x7637, 0x0118, 0x9296, 0x0004, 0x0548,
-- 0x2011, 0x0001, 0x080c, 0xd0e8, 0x70ab, 0x0000, 0x70af, 0xffff,
-+ 0xc295, 0x72de, 0x080c, 0x7630, 0x0118, 0x9296, 0x0004, 0x0548,
-+ 0x2011, 0x0001, 0x080c, 0xd0e1, 0x70ab, 0x0000, 0x70af, 0xffff,
- 0x7003, 0x0002, 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085,
- 0x0003, 0x782a, 0x00fe, 0x080c, 0x3000, 0x2011, 0x0005, 0x080c,
-- 0xaabf, 0x080c, 0x9ab1, 0x080c, 0x7637, 0x0148, 0x00c6, 0x2061,
-+ 0xaab8, 0x080c, 0x9aaa, 0x080c, 0x7630, 0x0148, 0x00c6, 0x2061,
- 0x0100, 0x0016, 0x080c, 0x298b, 0x61e2, 0x001e, 0x00ce, 0x012e,
- 0x0420, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003, 0x0002, 0x00f6,
- 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085, 0x0003, 0x782a,
-- 0x00fe, 0x2011, 0x0005, 0x080c, 0xaabf, 0x080c, 0x9ab1, 0x080c,
-- 0x7637, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x298b,
-+ 0x00fe, 0x2011, 0x0005, 0x080c, 0xaab8, 0x080c, 0x9aaa, 0x080c,
-+ 0x7630, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x298b,
- 0x61e2, 0x001e, 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6,
-- 0x080c, 0x7637, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782,
-- 0x080c, 0x7637, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff,
-+ 0x080c, 0x7630, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782,
-+ 0x080c, 0x7630, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff,
- 0x0138, 0x9180, 0x1000, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0bc,
- 0x090c, 0x334c, 0x8108, 0x1f04, 0x0ac7, 0x707f, 0x0000, 0x7080,
- 0x9084, 0x00ff, 0x7082, 0x70b3, 0x0000, 0x00be, 0x00ce, 0x0005,
- 0x00b6, 0x0126, 0x2091, 0x8000, 0x7000, 0x9086, 0x0002, 0x1904,
- 0x0b9d, 0x70ac, 0x9086, 0xffff, 0x0130, 0x080c, 0x3000, 0x080c,
-- 0x9ab1, 0x0804, 0x0b9d, 0x70dc, 0xd0ac, 0x1110, 0xd09c, 0x0558,
-+ 0x9aaa, 0x0804, 0x0b9d, 0x70dc, 0xd0ac, 0x1110, 0xd09c, 0x0558,
- 0xd084, 0x0548, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e,
- 0xd08c, 0x0508, 0x080c, 0x33af, 0x11d0, 0x70e0, 0x9086, 0xffff,
-- 0x01b0, 0x080c, 0x31bc, 0x080c, 0x9ab1, 0x70dc, 0xd094, 0x1904,
-- 0x0b9d, 0x2011, 0x0001, 0x080c, 0xd7e3, 0x0110, 0x2011, 0x0003,
-- 0x901e, 0x080c, 0x31f6, 0x080c, 0x9ab1, 0x0804, 0x0b9d, 0x70e4,
-+ 0x01b0, 0x080c, 0x31bc, 0x080c, 0x9aaa, 0x70dc, 0xd094, 0x1904,
-+ 0x0b9d, 0x2011, 0x0001, 0x080c, 0xd7dc, 0x0110, 0x2011, 0x0003,
-+ 0x901e, 0x080c, 0x31f6, 0x080c, 0x9aaa, 0x0804, 0x0b9d, 0x70e4,
- 0x9005, 0x1904, 0x0b9d, 0x70a8, 0x9005, 0x1904, 0x0b9d, 0x70dc,
-- 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0b9d, 0x080c, 0x6a61, 0x1904,
-- 0x0b9d, 0x080c, 0x6ab4, 0x1904, 0x0b9d, 0x080c, 0x6a9b, 0x01c0,
-- 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6724,
-+ 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0b9d, 0x080c, 0x6a5a, 0x1904,
-+ 0x0b9d, 0x080c, 0x6aad, 0x1904, 0x0b9d, 0x080c, 0x6a94, 0x01c0,
-+ 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x671d,
- 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04, 0x0b3d,
- 0x00ce, 0x015e, 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804, 0x0b9d,
- 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0x2011, 0x19b4,
- 0x080c, 0x0f96, 0x2011, 0x19ce, 0x080c, 0x0f96, 0x7030, 0xc08c,
- 0x7032, 0x7003, 0x0003, 0x70af, 0xffff, 0x080c, 0x0e76, 0x9006,
-- 0x080c, 0x281c, 0x080c, 0x33af, 0x0118, 0x080c, 0x4de1, 0x0050,
-- 0x0036, 0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4dfb,
-- 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x765a, 0x0150,
-- 0x080c, 0x7637, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084,
-+ 0x080c, 0x281c, 0x080c, 0x33af, 0x0118, 0x080c, 0x4ddf, 0x0050,
-+ 0x0036, 0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4df9,
-+ 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x7653, 0x0150,
-+ 0x080c, 0x7630, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084,
- 0xffdf, 0x782a, 0x00fe, 0x2001, 0x19e9, 0x2004, 0x9086, 0x0005,
-- 0x1120, 0x2011, 0x0000, 0x080c, 0xaabf, 0x2011, 0x0000, 0x080c,
-- 0xaac9, 0x080c, 0x9ab1, 0x080c, 0x9bd3, 0x012e, 0x00be, 0x0005,
-+ 0x1120, 0x2011, 0x0000, 0x080c, 0xaab8, 0x2011, 0x0000, 0x080c,
-+ 0xaac2, 0x080c, 0x9aaa, 0x080c, 0x9bcc, 0x012e, 0x00be, 0x0005,
- 0x0016, 0x0046, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100,
-- 0x7904, 0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x60aa,
-+ 0x7904, 0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x60a3,
- 0x7940, 0x918c, 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0110, 0x7827,
- 0x0040, 0xd19c, 0x0110, 0x7827, 0x0008, 0x0006, 0x0036, 0x0156,
- 0x7954, 0xd1ac, 0x1904, 0x0c2d, 0x2001, 0x19a8, 0x2004, 0x9005,
-@@ -175,13 +163,13 @@ unsigned short risc_code01[] = {
- 0x2001, 0x0001, 0x080c, 0x2b94, 0x00b8, 0x080c, 0x2c51, 0x1138,
- 0x9006, 0x080c, 0x2bb1, 0x9006, 0x080c, 0x2b94, 0x0068, 0x080c,
- 0x2c59, 0x1d50, 0x2001, 0x1998, 0x2004, 0xd0fc, 0x0108, 0x0020,
-- 0x080c, 0x29bf, 0x0804, 0x0d0d, 0x080c, 0x7648, 0x0148, 0x080c,
-- 0x765a, 0x1118, 0x080c, 0x7941, 0x0050, 0x080c, 0x763f, 0x0dd0,
-- 0x080c, 0x793c, 0x080c, 0x7932, 0x080c, 0x7563, 0x0058, 0x080c,
-- 0x7637, 0x0140, 0x2009, 0x00f8, 0x080c, 0x60aa, 0x7843, 0x0090,
-+ 0x080c, 0x29bf, 0x0804, 0x0d0d, 0x080c, 0x7641, 0x0148, 0x080c,
-+ 0x7653, 0x1118, 0x080c, 0x793a, 0x0050, 0x080c, 0x7638, 0x0dd0,
-+ 0x080c, 0x7935, 0x080c, 0x792b, 0x080c, 0x755c, 0x0058, 0x080c,
-+ 0x7630, 0x0140, 0x2009, 0x00f8, 0x080c, 0x60a3, 0x7843, 0x0090,
- 0x7843, 0x0010, 0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c,
-- 0x7637, 0x0138, 0x7824, 0xd0ac, 0x1904, 0x0d12, 0x1f04, 0x0c0c,
-- 0x0070, 0x7824, 0x080c, 0x7651, 0x0118, 0xd0ac, 0x1904, 0x0d12,
-+ 0x7630, 0x0138, 0x7824, 0xd0ac, 0x1904, 0x0d12, 0x1f04, 0x0c0c,
-+ 0x0070, 0x7824, 0x080c, 0x764a, 0x0118, 0xd0ac, 0x1904, 0x0d12,
- 0x9084, 0x1800, 0x0d98, 0x7003, 0x0001, 0x0804, 0x0d12, 0x2001,
- 0x0001, 0x080c, 0x281c, 0x0804, 0x0d25, 0x2001, 0x19a8, 0x2004,
- 0x9005, 0x1518, 0x080c, 0x2c49, 0x1148, 0x2001, 0x0001, 0x080c,
-@@ -191,46 +179,46 @@ unsigned short risc_code01[] = {
- 0x0020, 0x080c, 0x29bf, 0x0804, 0x0d0d, 0x7850, 0x9085, 0x0040,
- 0x7852, 0x7938, 0x7850, 0x9084, 0xfbcf, 0x7852, 0x080c, 0x2c61,
- 0x9085, 0x2000, 0x7852, 0x793a, 0x20a9, 0x0046, 0x1d04, 0x0c66,
-- 0x080c, 0x88f7, 0x1f04, 0x0c66, 0x7850, 0x9085, 0x0400, 0x9084,
-- 0xdfbf, 0x7852, 0x793a, 0x080c, 0x7648, 0x0148, 0x080c, 0x765a,
-- 0x1118, 0x080c, 0x7941, 0x0050, 0x080c, 0x763f, 0x0dd0, 0x080c,
-- 0x793c, 0x080c, 0x7932, 0x080c, 0x7563, 0x0020, 0x2009, 0x00f8,
-- 0x080c, 0x60aa, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c8c, 0x7850,
-- 0x9085, 0x1400, 0x7852, 0x080c, 0x7637, 0x0120, 0x7843, 0x0090,
-- 0x7843, 0x0010, 0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x88f7,
-- 0x7820, 0xd09c, 0x1588, 0x080c, 0x7637, 0x0904, 0x0cf2, 0x7824,
-- 0xd0ac, 0x1904, 0x0d12, 0x080c, 0x765a, 0x1530, 0x0046, 0x2021,
-+ 0x080c, 0x88f0, 0x1f04, 0x0c66, 0x7850, 0x9085, 0x0400, 0x9084,
-+ 0xdfbf, 0x7852, 0x793a, 0x080c, 0x7641, 0x0148, 0x080c, 0x7653,
-+ 0x1118, 0x080c, 0x793a, 0x0050, 0x080c, 0x7638, 0x0dd0, 0x080c,
-+ 0x7935, 0x080c, 0x792b, 0x080c, 0x755c, 0x0020, 0x2009, 0x00f8,
-+ 0x080c, 0x60a3, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c8c, 0x7850,
-+ 0x9085, 0x1400, 0x7852, 0x080c, 0x7630, 0x0120, 0x7843, 0x0090,
-+ 0x7843, 0x0010, 0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x88f0,
-+ 0x7820, 0xd09c, 0x1588, 0x080c, 0x7630, 0x0904, 0x0cf2, 0x7824,
-+ 0xd0ac, 0x1904, 0x0d12, 0x080c, 0x7653, 0x1530, 0x0046, 0x2021,
- 0x0320, 0x8421, 0x1df0, 0x004e, 0x7827, 0x1800, 0x080c, 0x2c61,
- 0x7824, 0x9084, 0x1800, 0x1168, 0x9484, 0x0fff, 0x1140, 0x2001,
- 0x1810, 0x2004, 0x9084, 0x9000, 0x0110, 0x080c, 0x0d33, 0x8421,
-- 0x1158, 0x1d04, 0x0ccd, 0x080c, 0x88f7, 0x080c, 0x793c, 0x080c,
-- 0x7932, 0x7003, 0x0001, 0x04f0, 0x8319, 0x1940, 0x1d04, 0x0cda,
-- 0x080c, 0x88f7, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001,
-+ 0x1158, 0x1d04, 0x0ccd, 0x080c, 0x88f0, 0x080c, 0x7935, 0x080c,
-+ 0x792b, 0x7003, 0x0001, 0x04f0, 0x8319, 0x1940, 0x1d04, 0x0cda,
-+ 0x080c, 0x88f0, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001,
- 0x200a, 0x1178, 0x200b, 0x000a, 0x7827, 0x0048, 0x20a9, 0x0002,
- 0x080c, 0x2c42, 0x7924, 0x080c, 0x2c61, 0xd19c, 0x0110, 0x080c,
-- 0x2b82, 0x00d8, 0x080c, 0x7648, 0x1140, 0x94a2, 0x03e8, 0x1128,
-- 0x080c, 0x760f, 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, 0x080c,
-- 0x2c61, 0x7824, 0x080c, 0x7651, 0x0110, 0xd0ac, 0x1158, 0x9084,
-+ 0x2b82, 0x00d8, 0x080c, 0x7641, 0x1140, 0x94a2, 0x03e8, 0x1128,
-+ 0x080c, 0x7608, 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, 0x080c,
-+ 0x2c61, 0x7824, 0x080c, 0x764a, 0x0110, 0xd0ac, 0x1158, 0x9084,
- 0x1800, 0x0950, 0x7003, 0x0001, 0x0028, 0x2001, 0x0001, 0x080c,
- 0x281c, 0x0078, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904,
- 0x918d, 0x0002, 0x7906, 0x7827, 0x0048, 0x7828, 0x9085, 0x0028,
- 0x782a, 0x7850, 0x9085, 0x0400, 0x7852, 0x2001, 0x19a8, 0x2003,
- 0x0000, 0x9006, 0x78f2, 0x015e, 0x003e, 0x000e, 0x012e, 0x00fe,
- 0x004e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0036, 0x0046, 0x00b6,
-- 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, 0x88f7,
-+ 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, 0x88f0,
- 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e,
- 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x189e, 0x7004, 0x9086,
- 0x0001, 0x1110, 0x080c, 0x34dd, 0x00ee, 0x0005, 0x0005, 0x2a70,
-- 0x2061, 0x19ac, 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, 0x0014,
-+ 0x2061, 0x19ac, 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, 0x0013,
- 0x600f, 0x0137, 0x2001, 0x197c, 0x900e, 0x2102, 0x7196, 0x2001,
- 0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705f, 0xffff, 0x0008,
-- 0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xd52b, 0x70eb,
-+ 0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xd524, 0x70eb,
- 0x00c0, 0x2061, 0x196c, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
- 0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x001f, 0x611a, 0x601f,
- 0x07d0, 0x2061, 0x1974, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f,
- 0x0200, 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061,
- 0x1989, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f,
-- 0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x6724,
-+ 0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x671d,
- 0x1178, 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4,
- 0xff00, 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210,
- 0x8108, 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
-@@ -251,7 +239,7 @@ unsigned short risc_code01[] = {
- 0x015e, 0x2079, 0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001,
- 0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a1c, 0x2004, 0x9005,
- 0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a,
-- 0x2003, 0x0002, 0x2003, 0x1001, 0x080c, 0x57e4, 0x1108, 0x0099,
-+ 0x2003, 0x0002, 0x2003, 0x1001, 0x080c, 0x57e2, 0x1108, 0x0099,
- 0x0cd8, 0x0005, 0x918c, 0x03ff, 0x2001, 0x0003, 0x2004, 0x9084,
- 0x0600, 0x1118, 0x918d, 0x2800, 0x0010, 0x918d, 0x2000, 0x2001,
- 0x017f, 0x2102, 0x0005, 0x0026, 0x0126, 0x2011, 0x0080, 0x080c,
-@@ -317,7 +305,7 @@ unsigned short risc_code01[] = {
- 0x00e6, 0x0126, 0x2091, 0x8000, 0x0016, 0x890e, 0x810e, 0x810f,
- 0x9184, 0x003f, 0xa862, 0x9184, 0xffc0, 0xa85e, 0x001e, 0x0020,
- 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x702c, 0xa802,
-- 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x012e,
-+ 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e, 0x012e,
- 0x00ee, 0x0005, 0x2071, 0x1800, 0x9026, 0x2009, 0x0000, 0x2049,
- 0x0400, 0x2900, 0x702e, 0x8940, 0x2800, 0xa802, 0xa95e, 0xa863,
- 0x0001, 0x8420, 0x9886, 0x0440, 0x0120, 0x2848, 0x9188, 0x0040,
-@@ -382,15 +370,15 @@ unsigned short risc_code01[] = {
- 0x1117, 0x0005, 0x00de, 0x009e, 0x080c, 0x1117, 0x0005, 0xa8a8,
- 0xd08c, 0x0005, 0x0096, 0xa0a0, 0x904d, 0x090c, 0x0dc5, 0xa06c,
- 0x908e, 0x0100, 0x0130, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-- 0x4002, 0x080c, 0x6e92, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848,
-+ 0x4002, 0x080c, 0x6e8b, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848,
- 0x080c, 0x1040, 0x009e, 0x0005, 0x00a6, 0xa0a0, 0x904d, 0x090c,
- 0x0dc5, 0xa06c, 0x908e, 0x0100, 0x0128, 0xa87b, 0x0001, 0xa883,
- 0x0000, 0x00c0, 0xa80c, 0x2050, 0xb004, 0x9005, 0x0198, 0xa80e,
- 0x2050, 0x8006, 0x8006, 0x8007, 0x908c, 0x003f, 0x9084, 0xffc0,
- 0x9080, 0x0002, 0xa076, 0xa172, 0xb000, 0xa07a, 0x2810, 0x080c,
-- 0x10f8, 0x00e8, 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c, 0x6e92,
-+ 0x10f8, 0x00e8, 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c, 0x6e8b,
- 0x000e, 0x001e, 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060,
-- 0x080c, 0xb2d3, 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000, 0xa8a3,
-+ 0x080c, 0xb2cc, 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000, 0xa8a3,
- 0x0000, 0x080c, 0x1040, 0x7007, 0x0000, 0x080c, 0x1117, 0x00ae,
- 0x0005, 0x0126, 0x2091, 0x8000, 0x782b, 0x1001, 0x7007, 0x0005,
- 0x7000, 0xc094, 0x7002, 0x012e, 0x0005, 0x0096, 0x2001, 0x192f,
-@@ -399,12 +387,12 @@ unsigned short risc_code01[] = {
- 0x782b, 0x0041, 0x7007, 0x0003, 0x7000, 0xc084, 0x7002, 0x2900,
- 0x700a, 0x012e, 0x009e, 0x0005, 0x20e1, 0x0000, 0x2099, 0x0088,
- 0x782b, 0x0040, 0x0096, 0x2001, 0x192f, 0x204c, 0xaa7c, 0x009e,
-- 0x080c, 0x8d91, 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc, 0x200a,
-- 0x080c, 0x8bf3, 0x7007, 0x0000, 0x080c, 0x1128, 0x0005, 0x7007,
-+ 0x080c, 0x8d8a, 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc, 0x200a,
-+ 0x080c, 0x8bec, 0x7007, 0x0000, 0x080c, 0x1128, 0x0005, 0x7007,
- 0x0000, 0x080c, 0x1128, 0x0005, 0x0126, 0x2091, 0x2200, 0x2079,
- 0x0300, 0x2071, 0x1a65, 0x7003, 0x0000, 0x78bf, 0x00f6, 0x781b,
- 0x4800, 0x00c1, 0x7803, 0x0003, 0x780f, 0x0000, 0x20a9, 0x03ea,
-- 0x2061, 0xf0ae, 0x2c0d, 0x7912, 0xe104, 0x9ce0, 0x0002, 0x7916,
-+ 0x2061, 0xf0a7, 0x2c0d, 0x7912, 0xe104, 0x9ce0, 0x0002, 0x7916,
- 0x1f04, 0x1312, 0x7807, 0x0007, 0x7803, 0x0000, 0x7803, 0x0001,
- 0x012e, 0x0005, 0x00c6, 0x7803, 0x0000, 0x7808, 0xd09c, 0x0120,
- 0x7820, 0x080c, 0x1376, 0x0cc8, 0x2001, 0x1a66, 0x2003, 0x0000,
-@@ -418,9 +406,9 @@ unsigned short risc_code01[] = {
- 0x33b6, 0x0020, 0x9084, 0xc000, 0x783f, 0xb3b6, 0x604f, 0x193d,
- 0x2001, 0x1928, 0x2004, 0x6042, 0x00ce, 0x0005, 0x9086, 0x000d,
- 0x11d0, 0x7808, 0xd09c, 0x01b8, 0x7820, 0x0026, 0x2010, 0x080c,
-- 0xd0c6, 0x0180, 0x2260, 0x6000, 0x9086, 0x0004, 0x1158, 0x0016,
-+ 0xd0bf, 0x0180, 0x2260, 0x6000, 0x9086, 0x0004, 0x1158, 0x0016,
- 0x6120, 0x9186, 0x0009, 0x0108, 0x0020, 0x2009, 0x004c, 0x080c,
-- 0xb352, 0x001e, 0x002e, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
-+ 0xb34b, 0x001e, 0x002e, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
- 0x9184, 0x0070, 0x190c, 0x0dbe, 0xd19c, 0x0158, 0x7820, 0x908c,
- 0xf000, 0x15e8, 0x908a, 0x0024, 0x1a0c, 0x0dc5, 0x0023, 0x012e,
- 0x0005, 0x012e, 0x0005, 0x13cf, 0x13cf, 0x13e6, 0x13eb, 0x13ef,
-@@ -429,17 +417,17 @@ unsigned short risc_code01[] = {
- 0x13cf, 0x13cf, 0x13cf, 0x13cf, 0x13cf, 0x13cf, 0x13f6, 0x13cf,
- 0x13cf, 0x13cf, 0x13cf, 0x13cf, 0x13cf, 0x13d3, 0x13d1, 0x080c,
- 0x0dc5, 0x080c, 0x0dbe, 0x080c, 0x159b, 0x2009, 0x1a7e, 0x2104,
-- 0x8000, 0x200a, 0x080c, 0x813a, 0x080c, 0x1ad9, 0x0005, 0x2009,
-- 0x0048, 0x2060, 0x080c, 0xb352, 0x012e, 0x0005, 0x7004, 0xc085,
-+ 0x8000, 0x200a, 0x080c, 0x8133, 0x080c, 0x1ad9, 0x0005, 0x2009,
-+ 0x0048, 0x2060, 0x080c, 0xb34b, 0x012e, 0x0005, 0x7004, 0xc085,
- 0xc0b5, 0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c,
- 0x159b, 0x080c, 0x16fb, 0x0005, 0x080c, 0x0dc5, 0x080c, 0x159b,
- 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009,
-- 0x0048, 0x080c, 0xb352, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
-+ 0x0048, 0x080c, 0xb34b, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
- 0x03e8, 0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8,
- 0x2001, 0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x15a0, 0x2001,
- 0x0307, 0x2003, 0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005,
- 0x080c, 0x159b, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff,
-- 0x009e, 0x2009, 0x0048, 0x080c, 0xb352, 0x0005, 0x080c, 0x159b,
-+ 0x009e, 0x2009, 0x0048, 0x080c, 0xb34b, 0x0005, 0x080c, 0x159b,
- 0x080c, 0x0dc5, 0x080c, 0x159b, 0x080c, 0x14ea, 0x7827, 0x0018,
- 0x79ac, 0xd1dc, 0x0904, 0x149b, 0x7827, 0x0015, 0x7828, 0x782b,
- 0x0000, 0x9065, 0x0140, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003,
-@@ -455,14 +443,14 @@ unsigned short risc_code01[] = {
- 0x78ab, 0x0004, 0x7803, 0x0001, 0x080c, 0x1503, 0x2001, 0x020d,
- 0x2003, 0x0020, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c,
- 0x0dc5, 0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x01a8,
-- 0x080c, 0x813a, 0x080c, 0x1ad9, 0x080c, 0xd0d8, 0x0158, 0xa9ac,
-+ 0x080c, 0x8133, 0x080c, 0x1ad9, 0x080c, 0xd0d1, 0x0158, 0xa9ac,
- 0xa936, 0xa9b0, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880,
-- 0xc0bd, 0xa882, 0x080c, 0xccf3, 0x0005, 0x6020, 0x9086, 0x0009,
-- 0x1128, 0x2009, 0x004c, 0x080c, 0xb352, 0x0048, 0x6010, 0x00b6,
-- 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024, 0x190c, 0xd4c4, 0x2029,
-+ 0xc0bd, 0xa882, 0x080c, 0xccec, 0x0005, 0x6020, 0x9086, 0x0009,
-+ 0x1128, 0x2009, 0x004c, 0x080c, 0xb34b, 0x0048, 0x6010, 0x00b6,
-+ 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024, 0x190c, 0xd4bd, 0x2029,
- 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8,
-- 0x7dbc, 0x080c, 0xf057, 0xd5a4, 0x1118, 0x080c, 0x15a0, 0x0005,
-- 0x080c, 0x813a, 0x080c, 0x1ad9, 0x0005, 0x781f, 0x0300, 0x7803,
-+ 0x7dbc, 0x080c, 0xf050, 0xd5a4, 0x1118, 0x080c, 0x15a0, 0x0005,
-+ 0x080c, 0x8133, 0x080c, 0x1ad9, 0x0005, 0x781f, 0x0300, 0x7803,
- 0x0001, 0x0005, 0x0016, 0x0066, 0x0076, 0x00f6, 0x2079, 0x0300,
- 0x7908, 0x918c, 0x0007, 0x9186, 0x0003, 0x0120, 0x2001, 0x0016,
- 0x080c, 0x1611, 0x00fe, 0x007e, 0x006e, 0x001e, 0x0005, 0x7004,
-@@ -481,9 +469,9 @@ unsigned short risc_code01[] = {
- 0x020d, 0x2003, 0x0020, 0x080c, 0x1322, 0x7803, 0x0001, 0x00ee,
- 0x001e, 0x0005, 0x080c, 0x16de, 0x0dd0, 0x2001, 0x020d, 0x2003,
- 0x0050, 0x2003, 0x0020, 0x0461, 0x0c90, 0x0429, 0x2060, 0x2009,
-- 0x0053, 0x080c, 0xb352, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
-- 0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x90de,
-- 0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8ce2, 0x0cd0, 0x0005,
-+ 0x0053, 0x080c, 0xb34b, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
-+ 0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x90d7,
-+ 0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8cdb, 0x0cd0, 0x0005,
- 0x2001, 0x0036, 0x2009, 0x1820, 0x210c, 0x2011, 0x181f, 0x2214,
- 0x080c, 0x1611, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005,
- 0x080c, 0x14ea, 0x00d6, 0x2069, 0x0200, 0x2009, 0x01f4, 0x8109,
-@@ -493,7 +481,7 @@ unsigned short risc_code01[] = {
- 0x810c, 0x080c, 0x1603, 0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9,
- 0x6827, 0x0002, 0x04c1, 0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4,
- 0x1500, 0x6804, 0x9005, 0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0,
-- 0x080c, 0x813a, 0x080c, 0x1ad9, 0x0090, 0x7827, 0x0015, 0x782b,
-+ 0x080c, 0x8133, 0x080c, 0x1ad9, 0x0090, 0x7827, 0x0015, 0x782b,
- 0x0000, 0x7827, 0x0018, 0x782b, 0x0000, 0x2001, 0x020d, 0x2003,
- 0x0020, 0x2001, 0x0307, 0x2003, 0x0300, 0x7803, 0x0001, 0x00de,
- 0x0005, 0x682c, 0x9084, 0x5400, 0x9086, 0x5400, 0x0d30, 0x7827,
-@@ -510,7 +498,7 @@ unsigned short risc_code01[] = {
- 0x2001, 0x0109, 0x2004, 0xd08c, 0x01f0, 0x0006, 0x01c6, 0x01d6,
- 0x0136, 0x0146, 0x0156, 0x0126, 0x2091, 0x2800, 0x00f6, 0x0026,
- 0x0016, 0x2009, 0x1a81, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c,
-- 0x94b1, 0x001e, 0x002e, 0x00fe, 0x012e, 0x015e, 0x014e, 0x013e,
-+ 0x94aa, 0x001e, 0x002e, 0x00fe, 0x012e, 0x015e, 0x014e, 0x013e,
- 0x01de, 0x01ce, 0x000e, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x01d0,
- 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x00f6,
- 0x0016, 0x2009, 0x1a82, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c,
-@@ -519,7 +507,7 @@ unsigned short risc_code01[] = {
- 0x180c, 0x2004, 0xd0f4, 0x1528, 0x7a18, 0x9284, 0x0030, 0x0508,
- 0x9284, 0x0048, 0x9086, 0x0008, 0x11e0, 0x2001, 0x19f7, 0x2004,
- 0x9005, 0x01b8, 0x2001, 0x1a69, 0x2004, 0x9086, 0x0000, 0x0188,
-- 0x2009, 0x1a80, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0xa767,
-+ 0x2009, 0x1a80, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0xa760,
- 0x2009, 0x180c, 0x2104, 0xc0f5, 0x200a, 0x2009, 0xff00, 0x0804,
- 0x163a, 0x9085, 0x0001, 0x0005, 0x7832, 0x7936, 0x7a3a, 0x781b,
- 0x8080, 0x080c, 0x1633, 0x1108, 0x0005, 0x792c, 0x3900, 0x8000,
-@@ -528,22 +516,22 @@ unsigned short risc_code01[] = {
- 0x9186, 0x0500, 0x0110, 0x9085, 0x0001, 0x0005, 0x0006, 0x0046,
- 0x00e6, 0x2071, 0x0200, 0x7037, 0x0002, 0x7058, 0x9084, 0xff00,
- 0x8007, 0x9086, 0x00bc, 0x1158, 0x2021, 0x1a7f, 0x2404, 0x8000,
-- 0x0208, 0x2022, 0x080c, 0x813a, 0x080c, 0x1ad9, 0x9006, 0x00ee,
-+ 0x0208, 0x2022, 0x080c, 0x8133, 0x080c, 0x1ad9, 0x9006, 0x00ee,
- 0x004e, 0x000e, 0x0005, 0x0c11, 0x1108, 0x0005, 0x00e6, 0x0016,
- 0x2071, 0x0200, 0x0841, 0x6124, 0xd1dc, 0x01f8, 0x701c, 0xd08c,
- 0x0904, 0x175d, 0x7017, 0x0000, 0x2001, 0x0264, 0x2004, 0xd0bc,
- 0x0904, 0x175d, 0x2001, 0x0268, 0x00c6, 0x2064, 0x6104, 0x6038,
- 0x00ce, 0x918e, 0x0039, 0x1904, 0x175d, 0x9c06, 0x15f0, 0x0126,
-- 0x2091, 0x2600, 0x080c, 0x8081, 0x012e, 0x7358, 0x745c, 0x6014,
-+ 0x2091, 0x2600, 0x080c, 0x807a, 0x012e, 0x7358, 0x745c, 0x6014,
- 0x905d, 0x0598, 0x2b48, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-- 0xd0bc, 0x190c, 0xd49f, 0xab42, 0xac3e, 0x2001, 0x1869, 0x2004,
-+ 0xd0bc, 0x190c, 0xd498, 0xab42, 0xac3e, 0x2001, 0x1869, 0x2004,
- 0xd0b4, 0x1170, 0x601c, 0xd0e4, 0x1158, 0x6010, 0x00b6, 0x2058,
- 0xb800, 0x00be, 0xd0bc, 0x1120, 0xa83b, 0x7fff, 0xa837, 0xffff,
- 0x080c, 0x20e7, 0x1190, 0x080c, 0x195a, 0x2a00, 0xa816, 0x0130,
- 0x2800, 0xa80e, 0x2c05, 0xa80a, 0x2c00, 0xa812, 0x7037, 0x0020,
- 0x781f, 0x0300, 0x001e, 0x00ee, 0x0005, 0x7037, 0x0050, 0x7037,
- 0x0020, 0x001e, 0x00ee, 0x080c, 0x15a0, 0x0005, 0x080c, 0x0dc5,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x190c, 0x6b5e, 0x2ff0, 0x0126,
-+ 0x2001, 0x180d, 0x2004, 0xd08c, 0x190c, 0x6b57, 0x2ff0, 0x0126,
- 0x2091, 0x2200, 0x0016, 0x00c6, 0x3e60, 0x6014, 0x2048, 0x2940,
- 0x903e, 0x2730, 0xa864, 0x2068, 0xa81a, 0x9d84, 0x000f, 0x9088,
- 0x20c7, 0x2165, 0x0002, 0x179a, 0x1808, 0x179a, 0x179a, 0x179e,
-@@ -552,7 +540,7 @@ unsigned short risc_code01[] = {
- 0x0904, 0x17ff, 0x9085, 0x0001, 0x0804, 0x18eb, 0xa87c, 0xd0ac,
- 0x0dc8, 0x0804, 0x180f, 0xa87c, 0xd0ac, 0x0da0, 0x0804, 0x187a,
- 0xa898, 0x901d, 0x1108, 0xab9c, 0x9016, 0xaab2, 0xaa3e, 0xaa42,
-- 0x3e00, 0x9080, 0x0008, 0x2004, 0x9080, 0x933d, 0x2005, 0x9005,
-+ 0x3e00, 0x9080, 0x0008, 0x2004, 0x9080, 0x9336, 0x2005, 0x9005,
- 0x090c, 0x0dc5, 0x2004, 0xa8ae, 0x0804, 0x18d3, 0xa87c, 0xd0bc,
- 0x09c8, 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa888, 0x0804, 0x180f,
- 0xa87c, 0xd0bc, 0x0978, 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa888,
-@@ -593,7 +581,7 @@ unsigned short risc_code01[] = {
- 0x8109, 0xa916, 0x1160, 0x3e60, 0x601c, 0xc085, 0x601e, 0xa87c,
- 0xc0dd, 0xa87e, 0x9006, 0x00ce, 0x001e, 0x012e, 0x0005, 0x2800,
- 0xa80e, 0xab0a, 0x2c00, 0xa812, 0x0c70, 0x0804, 0x179a, 0x2001,
-- 0x180d, 0x2004, 0xd08c, 0x190c, 0x6b5e, 0x2ff0, 0x0126, 0x2091,
-+ 0x180d, 0x2004, 0xd08c, 0x190c, 0x6b57, 0x2ff0, 0x0126, 0x2091,
- 0x2200, 0x0016, 0x00c6, 0x3e60, 0x6014, 0x2048, 0x2940, 0xa80e,
- 0x2061, 0x20c2, 0xa813, 0x20c2, 0x2c05, 0xa80a, 0xa964, 0xa91a,
- 0xa87c, 0xd0ac, 0x090c, 0x0dc5, 0x9006, 0xa842, 0xa83e, 0x2c05,
-@@ -641,9 +629,9 @@ unsigned short risc_code01[] = {
- 0x810c, 0x810c, 0x81ff, 0x1118, 0xa887, 0x0001, 0x0008, 0xa986,
- 0x601b, 0x0002, 0xa874, 0x9084, 0x00ff, 0x9084, 0x0008, 0x0150,
- 0x00e9, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009, 0x0048, 0x080c,
-- 0xb352, 0x0005, 0xa974, 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c,
-+ 0xb34b, 0x0005, 0xa974, 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c,
- 0x9106, 0x1158, 0xa938, 0xa890, 0x9106, 0x1138, 0x601c, 0xc084,
-- 0x601e, 0x2009, 0x0048, 0x0804, 0xb352, 0x0005, 0x0126, 0x00c6,
-+ 0x601e, 0x2009, 0x0048, 0x0804, 0xb34b, 0x0005, 0x0126, 0x00c6,
- 0x2091, 0x2200, 0x00ce, 0x7908, 0x918c, 0x0007, 0x9186, 0x0000,
- 0x05b0, 0x9186, 0x0003, 0x0598, 0x6020, 0x6023, 0x0000, 0x0006,
- 0x2031, 0x0008, 0x00c6, 0x781f, 0x0808, 0x7808, 0xd09c, 0x0120,
-@@ -655,17 +643,17 @@ unsigned short risc_code01[] = {
- 0x1b65, 0x7827, 0x0015, 0x7828, 0x9c06, 0x1db8, 0x782b, 0x0000,
- 0x0ca0, 0x00f6, 0x2079, 0x0300, 0x7803, 0x0000, 0x78ab, 0x0004,
- 0x2001, 0xf000, 0x8001, 0x090c, 0x0dc5, 0x7aac, 0xd2ac, 0x1dd0,
-- 0x00fe, 0x080c, 0x7637, 0x1188, 0x2001, 0x0138, 0x2003, 0x0000,
-+ 0x00fe, 0x080c, 0x7630, 0x1188, 0x2001, 0x0138, 0x2003, 0x0000,
- 0x2001, 0x0160, 0x2003, 0x0000, 0x2011, 0x012c, 0xa001, 0xa001,
-- 0x8211, 0x1de0, 0x0059, 0x0804, 0x76e4, 0x0479, 0x0039, 0x2001,
-+ 0x8211, 0x1de0, 0x0059, 0x0804, 0x76dd, 0x0479, 0x0039, 0x2001,
- 0x0160, 0x2502, 0x2001, 0x0138, 0x2202, 0x0005, 0x00e6, 0x2071,
- 0x0200, 0x080c, 0x2c6d, 0x2009, 0x003c, 0x080c, 0x2409, 0x2001,
- 0x015d, 0x2003, 0x0000, 0x7000, 0x9084, 0x003c, 0x1de0, 0x080c,
-- 0x8725, 0x70a0, 0x70a2, 0x7098, 0x709a, 0x709c, 0x709e, 0x2001,
-+ 0x871e, 0x70a0, 0x70a2, 0x7098, 0x709a, 0x709c, 0x709e, 0x2001,
- 0x020d, 0x2003, 0x0020, 0x00f6, 0x2079, 0x0300, 0x080c, 0x1322,
- 0x7803, 0x0001, 0x00fe, 0x00ee, 0x0005, 0x2001, 0x0138, 0x2014,
- 0x2003, 0x0000, 0x2001, 0x0160, 0x202c, 0x2003, 0x0000, 0x080c,
-- 0x7637, 0x1108, 0x0005, 0x2021, 0x0260, 0x2001, 0x0141, 0x201c,
-+ 0x7630, 0x1108, 0x0005, 0x2021, 0x0260, 0x2001, 0x0141, 0x201c,
- 0xd3dc, 0x1168, 0x2001, 0x0109, 0x201c, 0x939c, 0x0048, 0x1160,
- 0x2001, 0x0111, 0x201c, 0x83ff, 0x1110, 0x8421, 0x1d70, 0x2001,
- 0x015d, 0x2003, 0x0000, 0x0005, 0x0046, 0x2021, 0x0019, 0x2003,
-@@ -776,13 +764,13 @@ unsigned short risc_code01[] = {
- 0x7126, 0xd184, 0x1d58, 0x0804, 0x1e40, 0x9006, 0x002e, 0x003e,
- 0x004e, 0x005e, 0x006e, 0x007e, 0x0005, 0x080c, 0x0dc5, 0x0026,
- 0x2001, 0x0105, 0x2003, 0x0010, 0x782b, 0x0004, 0x7003, 0x0000,
-- 0x7004, 0x2060, 0x6014, 0x2048, 0x080c, 0xd0d8, 0x0118, 0xa880,
-+ 0x7004, 0x2060, 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0118, 0xa880,
- 0xc0bd, 0xa882, 0x782c, 0xd0ac, 0x1de8, 0x080c, 0x1cef, 0x6020,
- 0x9086, 0x0006, 0x1180, 0x2061, 0x0100, 0x62c8, 0x2001, 0x00fa,
- 0x8001, 0x1df0, 0x60c8, 0x9206, 0x1dc0, 0x60c4, 0xa89a, 0x60c8,
-- 0xa896, 0x7004, 0x2060, 0x00c6, 0x080c, 0xccf3, 0x00ce, 0x2001,
-+ 0xa896, 0x7004, 0x2060, 0x00c6, 0x080c, 0xccec, 0x00ce, 0x2001,
- 0x19f7, 0x2004, 0x9c06, 0x1160, 0x2009, 0x0040, 0x080c, 0x2409,
-- 0x080c, 0xac2b, 0x2011, 0x0000, 0x080c, 0xaac9, 0x080c, 0x9bd3,
-+ 0x080c, 0xac24, 0x2011, 0x0000, 0x080c, 0xaac2, 0x080c, 0x9bcc,
- 0x002e, 0x0804, 0x202f, 0x0126, 0x2091, 0x2400, 0xa858, 0x2040,
- 0x792c, 0x782b, 0x0002, 0x9184, 0x0700, 0x1904, 0x1ea7, 0x7000,
- 0x0002, 0x202f, 0x1efd, 0x1f7d, 0x202d, 0x8001, 0x7002, 0x7027,
-@@ -827,7 +815,7 @@ unsigned short risc_code01[] = {
- 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a69, 0x7000, 0x9086, 0x0000,
- 0x0904, 0x207a, 0x2079, 0x0090, 0x2009, 0x0207, 0x210c, 0xd194,
- 0x01b8, 0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188, 0x080c,
-- 0xf0a0, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0dc5, 0x0016,
-+ 0xf099, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0dc5, 0x0016,
- 0x2009, 0x0040, 0x080c, 0x2409, 0x001e, 0x2001, 0x020c, 0x2102,
- 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120,
- 0x2009, 0x0040, 0x080c, 0x2409, 0x782c, 0xd0fc, 0x09a8, 0x080c,
-@@ -917,16 +905,16 @@ unsigned short risc_code01[] = {
- 0x001f, 0x7837, 0x0020, 0x7803, 0x1600, 0x012e, 0x0005, 0x2091,
- 0x2600, 0x781c, 0xd0a4, 0x190c, 0x2406, 0x7900, 0xd1dc, 0x1118,
- 0x9084, 0x0006, 0x001a, 0x9084, 0x000e, 0x0002, 0x232e, 0x2326,
-- 0x8081, 0x2326, 0x2328, 0x2328, 0x2328, 0x2328, 0x8067, 0x2326,
-+ 0x807a, 0x2326, 0x2328, 0x2328, 0x2328, 0x2328, 0x8060, 0x2326,
- 0x232a, 0x2326, 0x2328, 0x2326, 0x2328, 0x2326, 0x080c, 0x0dc5,
-- 0x0031, 0x0020, 0x080c, 0x8067, 0x080c, 0x8081, 0x0005, 0x0006,
-- 0x0016, 0x0026, 0x080c, 0xf0a0, 0x7930, 0x9184, 0x0003, 0x01c0,
-+ 0x0031, 0x0020, 0x080c, 0x8060, 0x080c, 0x807a, 0x0005, 0x0006,
-+ 0x0016, 0x0026, 0x080c, 0xf099, 0x7930, 0x9184, 0x0003, 0x01c0,
- 0x2001, 0x19f7, 0x2004, 0x9005, 0x0170, 0x2001, 0x0133, 0x2004,
- 0x9005, 0x090c, 0x0dc5, 0x00c6, 0x2001, 0x19f7, 0x2064, 0x080c,
-- 0xccf3, 0x00ce, 0x00f8, 0x2009, 0x0040, 0x080c, 0x2409, 0x00d0,
-+ 0xccec, 0x00ce, 0x00f8, 0x2009, 0x0040, 0x080c, 0x2409, 0x00d0,
- 0x9184, 0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c,
-- 0x7637, 0x1138, 0x080c, 0x7932, 0x080c, 0x612e, 0x080c, 0x7563,
-- 0x0010, 0x080c, 0x5fed, 0x080c, 0x8130, 0x0041, 0x0018, 0x9184,
-+ 0x7630, 0x1138, 0x080c, 0x792b, 0x080c, 0x6127, 0x080c, 0x755c,
-+ 0x0010, 0x080c, 0x5fe6, 0x080c, 0x8129, 0x0041, 0x0018, 0x9184,
- 0x9540, 0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x0036,
- 0x0046, 0x0056, 0x2071, 0x1a65, 0x080c, 0x1ad9, 0x005e, 0x004e,
- 0x003e, 0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071, 0x1800,
-@@ -977,96 +965,96 @@ unsigned short risc_code01[] = {
- 0x0082, 0x0016, 0x2001, 0x188b, 0x200c, 0xd184, 0x001e, 0x0d70,
- 0x0c98, 0x0016, 0x2001, 0x188b, 0x200c, 0xd194, 0x001e, 0x0d30,
- 0x0c58, 0x2513, 0x24f9, 0x24fc, 0x24ff, 0x2504, 0x2506, 0x250a,
-- 0x250e, 0x080c, 0x93e2, 0x00b8, 0x080c, 0x94b1, 0x00a0, 0x080c,
-- 0x94b1, 0x080c, 0x93e2, 0x0078, 0x0099, 0x0068, 0x080c, 0x93e2,
-- 0x0079, 0x0048, 0x080c, 0x94b1, 0x0059, 0x0028, 0x080c, 0x94b1,
-- 0x080c, 0x93e2, 0x0029, 0x002e, 0x001e, 0x000e, 0x012e, 0x0005,
-+ 0x250e, 0x080c, 0x93db, 0x00b8, 0x080c, 0x94aa, 0x00a0, 0x080c,
-+ 0x94aa, 0x080c, 0x93db, 0x0078, 0x0099, 0x0068, 0x080c, 0x93db,
-+ 0x0079, 0x0048, 0x080c, 0x94aa, 0x0059, 0x0028, 0x080c, 0x94aa,
-+ 0x080c, 0x93db, 0x0029, 0x002e, 0x001e, 0x000e, 0x012e, 0x0005,
- 0x00a6, 0x6124, 0x6028, 0xd09c, 0x0118, 0xd19c, 0x1904, 0x2784,
-- 0xd1f4, 0x190c, 0x0dbe, 0x080c, 0x7637, 0x0904, 0x256e, 0x080c,
-- 0xd7e3, 0x1120, 0x7000, 0x9086, 0x0003, 0x0570, 0x6024, 0x9084,
-- 0x1800, 0x0550, 0x080c, 0x765a, 0x0118, 0x080c, 0x7648, 0x1520,
-- 0x6027, 0x0020, 0x6043, 0x0000, 0x080c, 0xd7e3, 0x0168, 0x080c,
-- 0x765a, 0x1150, 0x2001, 0x19a8, 0x2003, 0x0001, 0x6027, 0x1800,
-- 0x080c, 0x74b2, 0x0804, 0x2787, 0x70a4, 0x9005, 0x1150, 0x70a7,
-- 0x0001, 0x00d6, 0x2069, 0x0140, 0x080c, 0x768b, 0x00de, 0x1904,
-- 0x2787, 0x080c, 0x793c, 0x0428, 0x080c, 0x765a, 0x1590, 0x6024,
-- 0x9084, 0x1800, 0x1108, 0x0468, 0x080c, 0x793c, 0x080c, 0x7932,
-- 0x080c, 0x612e, 0x080c, 0x7563, 0x0804, 0x2784, 0xd1ac, 0x1508,
-+ 0xd1f4, 0x190c, 0x0dbe, 0x080c, 0x7630, 0x0904, 0x256e, 0x080c,
-+ 0xd7dc, 0x1120, 0x7000, 0x9086, 0x0003, 0x0570, 0x6024, 0x9084,
-+ 0x1800, 0x0550, 0x080c, 0x7653, 0x0118, 0x080c, 0x7641, 0x1520,
-+ 0x6027, 0x0020, 0x6043, 0x0000, 0x080c, 0xd7dc, 0x0168, 0x080c,
-+ 0x7653, 0x1150, 0x2001, 0x19a8, 0x2003, 0x0001, 0x6027, 0x1800,
-+ 0x080c, 0x74ab, 0x0804, 0x2787, 0x70a4, 0x9005, 0x1150, 0x70a7,
-+ 0x0001, 0x00d6, 0x2069, 0x0140, 0x080c, 0x7684, 0x00de, 0x1904,
-+ 0x2787, 0x080c, 0x7935, 0x0428, 0x080c, 0x7653, 0x1590, 0x6024,
-+ 0x9084, 0x1800, 0x1108, 0x0468, 0x080c, 0x7935, 0x080c, 0x792b,
-+ 0x080c, 0x6127, 0x080c, 0x755c, 0x0804, 0x2784, 0xd1ac, 0x1508,
- 0x6024, 0xd0dc, 0x1170, 0xd0e4, 0x1178, 0xd0d4, 0x1190, 0xd0cc,
-- 0x0130, 0x7098, 0x9086, 0x0029, 0x1110, 0x080c, 0x7818, 0x0804,
-- 0x2784, 0x080c, 0x7937, 0x0048, 0x2001, 0x197d, 0x2003, 0x0002,
-- 0x0020, 0x080c, 0x7774, 0x0804, 0x2784, 0x080c, 0x78ba, 0x0804,
-+ 0x0130, 0x7098, 0x9086, 0x0029, 0x1110, 0x080c, 0x7811, 0x0804,
-+ 0x2784, 0x080c, 0x7930, 0x0048, 0x2001, 0x197d, 0x2003, 0x0002,
-+ 0x0020, 0x080c, 0x776d, 0x0804, 0x2784, 0x080c, 0x78b3, 0x0804,
- 0x2784, 0x6220, 0xd1bc, 0x0138, 0xd2bc, 0x1904, 0x27e1, 0xd2b4,
- 0x1904, 0x27f4, 0x0000, 0xd1ac, 0x0904, 0x2699, 0x0036, 0x6328,
-- 0xc3bc, 0x632a, 0x003e, 0x080c, 0x7637, 0x11c0, 0x6027, 0x0020,
-- 0x0006, 0x0026, 0x0036, 0x080c, 0x7651, 0x1158, 0x080c, 0x7932,
-- 0x080c, 0x612e, 0x080c, 0x7563, 0x003e, 0x002e, 0x000e, 0x00ae,
-- 0x0005, 0x003e, 0x002e, 0x000e, 0x080c, 0x760f, 0x0016, 0x0046,
-+ 0xc3bc, 0x632a, 0x003e, 0x080c, 0x7630, 0x11c0, 0x6027, 0x0020,
-+ 0x0006, 0x0026, 0x0036, 0x080c, 0x764a, 0x1158, 0x080c, 0x792b,
-+ 0x080c, 0x6127, 0x080c, 0x755c, 0x003e, 0x002e, 0x000e, 0x00ae,
-+ 0x0005, 0x003e, 0x002e, 0x000e, 0x080c, 0x7608, 0x0016, 0x0046,
- 0x00c6, 0x644c, 0x9486, 0xf0f0, 0x1138, 0x2061, 0x0100, 0x644a,
- 0x6043, 0x0090, 0x6043, 0x0010, 0x74da, 0x948c, 0xff00, 0x7038,
-- 0xd084, 0x0190, 0x080c, 0xd7e3, 0x1118, 0x9186, 0xf800, 0x1160,
-+ 0xd084, 0x0190, 0x080c, 0xd7dc, 0x1118, 0x9186, 0xf800, 0x1160,
- 0x7048, 0xd084, 0x1148, 0xc085, 0x704a, 0x0036, 0x2418, 0x2011,
-- 0x8016, 0x080c, 0x4c44, 0x003e, 0x080c, 0xd7dc, 0x1904, 0x2676,
-+ 0x8016, 0x080c, 0x4c42, 0x003e, 0x080c, 0xd7d5, 0x1904, 0x2676,
- 0x9196, 0xff00, 0x05a8, 0x7060, 0x9084, 0x00ff, 0x810f, 0x81ff,
- 0x0110, 0x9116, 0x0568, 0x7130, 0xd184, 0x1550, 0x080c, 0x33aa,
-- 0x0128, 0xc18d, 0x7132, 0x080c, 0x6a9b, 0x1510, 0x6240, 0x9294,
-+ 0x0128, 0xc18d, 0x7132, 0x080c, 0x6a94, 0x1510, 0x6240, 0x9294,
- 0x0010, 0x0130, 0x6248, 0x9294, 0xff00, 0x9296, 0xff00, 0x01c0,
- 0x7030, 0xd08c, 0x0904, 0x2676, 0x7038, 0xd08c, 0x1140, 0x2001,
- 0x180c, 0x200c, 0xd1ac, 0x1904, 0x2676, 0xc1ad, 0x2102, 0x0036,
-- 0x73d8, 0x2011, 0x8013, 0x080c, 0x4c44, 0x003e, 0x0804, 0x2676,
-+ 0x73d8, 0x2011, 0x8013, 0x080c, 0x4c42, 0x003e, 0x0804, 0x2676,
- 0x7038, 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904,
- 0x2676, 0xc1ad, 0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c,
-- 0x4c44, 0x003e, 0x7130, 0xc185, 0x7132, 0x2011, 0x1848, 0x220c,
-+ 0x4c42, 0x003e, 0x7130, 0xc185, 0x7132, 0x2011, 0x1848, 0x220c,
- 0xd1a4, 0x01f0, 0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c,
-- 0x8a50, 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xeba1,
-+ 0x8a49, 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xeb9a,
- 0x00ce, 0x9484, 0x00ff, 0x9080, 0x33b6, 0x200d, 0x918c, 0xff00,
-- 0x810f, 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xec31, 0x001e,
-+ 0x810f, 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xec2a, 0x001e,
- 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x321b, 0x001e,
-- 0x00a8, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6724,
-+ 0x00a8, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x671d,
- 0x1140, 0x7030, 0xd084, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c,
-- 0x6148, 0x8108, 0x1f04, 0x2666, 0x00be, 0x015e, 0x00ce, 0x004e,
-- 0x080c, 0xb244, 0x60e3, 0x0000, 0x001e, 0x2001, 0x1800, 0x2014,
-+ 0x6141, 0x8108, 0x1f04, 0x2666, 0x00be, 0x015e, 0x00ce, 0x004e,
-+ 0x080c, 0xb23d, 0x60e3, 0x0000, 0x001e, 0x2001, 0x1800, 0x2014,
- 0x9296, 0x0004, 0x1170, 0xd19c, 0x11a0, 0x2011, 0x180c, 0x2214,
- 0xd29c, 0x1120, 0x6204, 0x9295, 0x0002, 0x6206, 0x6228, 0xc29d,
- 0x622a, 0x2003, 0x0001, 0x2001, 0x1826, 0x2003, 0x0000, 0x6027,
- 0x0020, 0xd194, 0x0904, 0x2784, 0x0016, 0x6220, 0xd2b4, 0x0904,
-- 0x2721, 0x080c, 0x88c3, 0x080c, 0xa6e9, 0x6027, 0x0004, 0x00f6,
-+ 0x2721, 0x080c, 0x88bc, 0x080c, 0xa6e2, 0x6027, 0x0004, 0x00f6,
- 0x2019, 0x19f1, 0x2304, 0x907d, 0x0904, 0x26f0, 0x7804, 0x9086,
- 0x0032, 0x15f0, 0x00d6, 0x00c6, 0x00e6, 0x0096, 0x2069, 0x0140,
- 0x782c, 0x685e, 0x7808, 0x685a, 0x6043, 0x0002, 0x2001, 0x0003,
- 0x8001, 0x1df0, 0x6043, 0x0000, 0x2001, 0x003c, 0x8001, 0x1df0,
- 0x080c, 0x2d49, 0x2001, 0x001e, 0x8001, 0x0240, 0x20a9, 0x0009,
- 0x080c, 0x2c42, 0x6904, 0xd1dc, 0x1140, 0x0cb0, 0x2001, 0x0100,
-- 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x080c, 0x99a5, 0x080c,
-- 0x9ab1, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xb2d3,
-+ 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x080c, 0x999e, 0x080c,
-+ 0x9aaa, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xb2cc,
- 0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e, 0x00ae, 0x0005,
- 0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804, 0x9084, 0x4000, 0x0110,
- 0x080c, 0x2d49, 0x00de, 0x00c6, 0x2061, 0x19e8, 0x6028, 0x080c,
-- 0xd7e3, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
-- 0x1238, 0x8000, 0x602a, 0x00ce, 0x080c, 0xa6c5, 0x0804, 0x2783,
-- 0x2061, 0x0100, 0x62c0, 0x080c, 0xb0ca, 0x2019, 0x19f1, 0x2304,
-- 0x9065, 0x0120, 0x2009, 0x0027, 0x080c, 0xb352, 0x00ce, 0x0804,
-- 0x2783, 0xd2bc, 0x0904, 0x276a, 0x080c, 0x88d0, 0x6014, 0x9084,
-+ 0xd7dc, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
-+ 0x1238, 0x8000, 0x602a, 0x00ce, 0x080c, 0xa6be, 0x0804, 0x2783,
-+ 0x2061, 0x0100, 0x62c0, 0x080c, 0xb0c3, 0x2019, 0x19f1, 0x2304,
-+ 0x9065, 0x0120, 0x2009, 0x0027, 0x080c, 0xb34b, 0x00ce, 0x0804,
-+ 0x2783, 0xd2bc, 0x0904, 0x276a, 0x080c, 0x88c9, 0x6014, 0x9084,
- 0x1984, 0x9085, 0x0010, 0x6016, 0x6027, 0x0004, 0x00d6, 0x2069,
- 0x0140, 0x6804, 0x9084, 0x4000, 0x0110, 0x080c, 0x2d49, 0x00de,
-- 0x00c6, 0x2061, 0x19e8, 0x6044, 0x080c, 0xd7e3, 0x0120, 0x909a,
-+ 0x00c6, 0x2061, 0x19e8, 0x6044, 0x080c, 0xd7dc, 0x0120, 0x909a,
- 0x0003, 0x1658, 0x0018, 0x909a, 0x00c8, 0x1638, 0x8000, 0x6046,
-- 0x603c, 0x00ce, 0x9005, 0x05b8, 0x2009, 0x07d0, 0x080c, 0x88c8,
-+ 0x603c, 0x00ce, 0x9005, 0x05b8, 0x2009, 0x07d0, 0x080c, 0x88c1,
- 0x9080, 0x0008, 0x2004, 0x9086, 0x0006, 0x1138, 0x6114, 0x918c,
- 0x1984, 0x918d, 0x0012, 0x6116, 0x0430, 0x9080, 0x0008, 0x2004,
- 0x9086, 0x0009, 0x0d98, 0x6114, 0x918c, 0x1984, 0x918d, 0x0016,
- 0x6116, 0x00c8, 0x6027, 0x0004, 0x00b0, 0x0036, 0x2019, 0x0001,
-- 0x080c, 0xaa49, 0x003e, 0x2019, 0x19f7, 0x2304, 0x9065, 0x0150,
-+ 0x080c, 0xaa42, 0x003e, 0x2019, 0x19f7, 0x2304, 0x9065, 0x0150,
- 0x2009, 0x004f, 0x6020, 0x9086, 0x0009, 0x1110, 0x2009, 0x004f,
-- 0x080c, 0xb352, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x27dc, 0x7038,
-+ 0x080c, 0xb34b, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x27dc, 0x7038,
- 0xd0ac, 0x1538, 0x0016, 0x0156, 0x6027, 0x0008, 0x080c, 0x2d73,
- 0x20a9, 0x0028, 0xa001, 0x1f04, 0x2792, 0x6150, 0x9185, 0x1400,
-- 0x6052, 0x20a9, 0x0366, 0x1d04, 0x279b, 0x080c, 0x88f7, 0x6020,
-+ 0x6052, 0x20a9, 0x0366, 0x1d04, 0x279b, 0x080c, 0x88f0, 0x6020,
- 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e, 0x6027, 0x0008, 0x04a0,
- 0x080c, 0x2c29, 0x1f04, 0x279b, 0x015e, 0x6152, 0x001e, 0x6027,
-- 0x0008, 0x0016, 0x6028, 0xc09c, 0x602a, 0x080c, 0xb244, 0x60e3,
-- 0x0000, 0x080c, 0xf07f, 0x080c, 0xf09a, 0x080c, 0x57d9, 0xd0fc,
-- 0x1138, 0x080c, 0xd7dc, 0x1120, 0x9085, 0x0001, 0x080c, 0x767b,
-+ 0x0008, 0x0016, 0x6028, 0xc09c, 0x602a, 0x080c, 0xb23d, 0x60e3,
-+ 0x0000, 0x080c, 0xf078, 0x080c, 0xf093, 0x080c, 0x57d7, 0xd0fc,
-+ 0x1138, 0x080c, 0xd7d5, 0x1120, 0x9085, 0x0001, 0x080c, 0x7674,
- 0x9006, 0x080c, 0x2d39, 0x2009, 0x0002, 0x080c, 0x2c67, 0x00e6,
- 0x2071, 0x1800, 0x7003, 0x0004, 0x080c, 0x0ea3, 0x00ee, 0x6027,
- 0x0008, 0x080c, 0x0ba0, 0x001e, 0x918c, 0xffd0, 0x6126, 0x00ae,
-@@ -1082,33 +1070,33 @@ unsigned short risc_code01[] = {
- 0x70d2, 0x9116, 0x0904, 0x286b, 0x81ff, 0x01a0, 0x2009, 0x0000,
- 0x080c, 0x2c67, 0x2011, 0x8011, 0x2019, 0x010e, 0x231c, 0x939e,
- 0x0007, 0x1118, 0x2019, 0x0001, 0x0010, 0x2019, 0x0000, 0x080c,
-- 0x4c44, 0x0448, 0x2001, 0x19a9, 0x200c, 0x81ff, 0x1140, 0x2001,
-+ 0x4c42, 0x0448, 0x2001, 0x19a9, 0x200c, 0x81ff, 0x1140, 0x2001,
- 0x0109, 0x2004, 0xd0b4, 0x0118, 0x2019, 0x0003, 0x0008, 0x2118,
-- 0x2011, 0x8012, 0x080c, 0x4c44, 0x080c, 0x0ea3, 0x080c, 0x57d9,
-- 0xd0fc, 0x1188, 0x080c, 0xd7dc, 0x1170, 0x00c6, 0x080c, 0x2907,
-- 0x080c, 0xa9b0, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
-+ 0x2011, 0x8012, 0x080c, 0x4c42, 0x080c, 0x0ea3, 0x080c, 0x57d7,
-+ 0xd0fc, 0x1188, 0x080c, 0xd7d5, 0x1170, 0x00c6, 0x080c, 0x2907,
-+ 0x080c, 0xa9a9, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
- 0x080c, 0x321b, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e, 0x002e,
- 0x001e, 0x000e, 0x0005, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094,
- 0xff00, 0x11f0, 0x2011, 0x1837, 0x2214, 0xd2ac, 0x11c8, 0x81ff,
- 0x01e8, 0x2011, 0x181f, 0x2204, 0x9106, 0x1190, 0x2011, 0x1820,
- 0x2214, 0x9294, 0xff00, 0x9584, 0xff00, 0x9206, 0x1148, 0x2011,
- 0x1820, 0x2214, 0x9294, 0x00ff, 0x9584, 0x00ff, 0x9206, 0x1120,
-- 0x2500, 0x080c, 0x83a5, 0x0048, 0x9584, 0x00ff, 0x9080, 0x33b6,
-+ 0x2500, 0x080c, 0x839e, 0x0048, 0x9584, 0x00ff, 0x9080, 0x33b6,
- 0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080, 0x33b6,
- 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140, 0x2001,
- 0x1818, 0x2003, 0x00ef, 0x20a9, 0x0010, 0x9006, 0x6852, 0x6856,
- 0x1f04, 0x28b7, 0x00de, 0x0005, 0x0006, 0x00d6, 0x0026, 0x2069,
- 0x0140, 0x2001, 0x1818, 0x2102, 0x8114, 0x8214, 0x8214, 0x8214,
- 0x20a9, 0x0010, 0x6853, 0x0000, 0x9006, 0x82ff, 0x1128, 0x9184,
-- 0x000f, 0x9080, 0xf880, 0x2005, 0x6856, 0x8211, 0x1f04, 0x28cc,
-+ 0x000f, 0x9080, 0xf879, 0x2005, 0x6856, 0x8211, 0x1f04, 0x28cc,
- 0x002e, 0x00de, 0x000e, 0x0005, 0x00c6, 0x2061, 0x1800, 0x6030,
- 0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032, 0x00ce, 0x0005, 0x0156,
- 0x00d6, 0x0026, 0x0016, 0x0006, 0x2069, 0x0140, 0x6980, 0x9116,
- 0x0180, 0x9112, 0x1230, 0x8212, 0x8210, 0x22a8, 0x2001, 0x0402,
- 0x0018, 0x22a8, 0x2001, 0x0404, 0x680e, 0x1f04, 0x28fc, 0x680f,
- 0x0000, 0x000e, 0x001e, 0x002e, 0x00de, 0x015e, 0x0005, 0x080c,
-- 0x57d5, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
-- 0x2009, 0x002e, 0x080c, 0xec31, 0x004e, 0x0005, 0x00f6, 0x0016,
-+ 0x57d3, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
-+ 0x2009, 0x002e, 0x080c, 0xec2a, 0x004e, 0x0005, 0x00f6, 0x0016,
- 0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc, 0x0904, 0x2973, 0x080c,
- 0x2bc6, 0x0660, 0x9084, 0x0700, 0x908e, 0x0600, 0x1120, 0x2011,
- 0x4000, 0x900e, 0x0458, 0x908e, 0x0500, 0x1120, 0x2011, 0x8000,
-@@ -1117,9 +1105,9 @@ unsigned short risc_code01[] = {
- 0x908e, 0x0200, 0x1120, 0x9016, 0x2009, 0x0004, 0x0078, 0x908e,
- 0x0100, 0x1548, 0x9016, 0x2009, 0x0008, 0x0040, 0x9084, 0x0700,
- 0x908e, 0x0300, 0x1500, 0x2011, 0x0030, 0x0058, 0x2300, 0x9080,
-- 0x0020, 0x2018, 0x080c, 0x9375, 0x928c, 0xff00, 0x0110, 0x2011,
-+ 0x0020, 0x2018, 0x080c, 0x936e, 0x928c, 0xff00, 0x0110, 0x2011,
- 0x00ff, 0x2200, 0x8007, 0x9085, 0x004c, 0x78c2, 0x2009, 0x0138,
-- 0x220a, 0x080c, 0x7637, 0x1118, 0x2009, 0x196d, 0x220a, 0x002e,
-+ 0x220a, 0x080c, 0x7630, 0x1118, 0x2009, 0x196d, 0x220a, 0x002e,
- 0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126, 0x2091,
- 0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c, 0x8000,
- 0x2014, 0x9184, 0x0003, 0x0110, 0x080c, 0x0dbe, 0x002e, 0x001e,
-@@ -1136,17 +1124,17 @@ unsigned short risc_code01[] = {
- 0x2a4a, 0x2001, 0x0001, 0x080c, 0x281c, 0x080c, 0x2c24, 0x2001,
- 0x1992, 0x2003, 0x0000, 0x7828, 0x9084, 0xe1d7, 0x782a, 0x9006,
- 0x20a9, 0x0009, 0x080c, 0x2be2, 0x2001, 0x1990, 0x2003, 0x0006,
-- 0x2009, 0x001e, 0x2011, 0x2a4b, 0x080c, 0x88d5, 0x0005, 0x2009,
-+ 0x2009, 0x001e, 0x2011, 0x2a4b, 0x080c, 0x88ce, 0x0005, 0x2009,
- 0x1995, 0x200b, 0x0000, 0x2001, 0x199a, 0x2003, 0x0036, 0x2001,
- 0x1999, 0x2003, 0x002a, 0x2001, 0x1992, 0x2003, 0x0001, 0x9006,
- 0x080c, 0x2b94, 0x2001, 0xffff, 0x20a9, 0x0009, 0x080c, 0x2be2,
- 0x2001, 0x1990, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x2a4b,
-- 0x080c, 0x88d5, 0x0005, 0x080c, 0x0dc5, 0x2001, 0x199a, 0x2003,
-+ 0x080c, 0x88ce, 0x0005, 0x080c, 0x0dc5, 0x2001, 0x199a, 0x2003,
- 0x0036, 0x2001, 0x1992, 0x2003, 0x0003, 0x7a38, 0x9294, 0x0005,
- 0x9296, 0x0004, 0x0110, 0x9006, 0x0010, 0x2001, 0x0001, 0x080c,
- 0x2b94, 0x2001, 0x1996, 0x2003, 0x0000, 0x2001, 0xffff, 0x20a9,
- 0x0009, 0x080c, 0x2be2, 0x2001, 0x1990, 0x2003, 0x0006, 0x2009,
-- 0x001e, 0x2011, 0x2a4b, 0x080c, 0x88d5, 0x0005, 0x080c, 0x0dc5,
-+ 0x001e, 0x2011, 0x2a4b, 0x080c, 0x88ce, 0x0005, 0x080c, 0x0dc5,
- 0x080c, 0x0dc5, 0x0005, 0x0006, 0x0016, 0x0026, 0x00e6, 0x00f6,
- 0x0156, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x2001, 0x1992,
- 0x2004, 0x908a, 0x0007, 0x1a0c, 0x0dc5, 0x0043, 0x012e, 0x015e,
-@@ -1204,13 +1192,13 @@ unsigned short risc_code01[] = {
- 0x1118, 0x783b, 0x0007, 0x0090, 0x9186, 0x0001, 0x1118, 0x783b,
- 0x0006, 0x0060, 0x9186, 0x0002, 0x1118, 0x783b, 0x0005, 0x0030,
- 0x9186, 0x0003, 0x1118, 0x783b, 0x0004, 0x0000, 0x0006, 0x1d04,
-- 0x2c0f, 0x080c, 0x88f7, 0x1f04, 0x2c0f, 0x7850, 0x9085, 0x0400,
-+ 0x2c0f, 0x080c, 0x88f0, 0x1f04, 0x2c0f, 0x7850, 0x9085, 0x0400,
- 0x9084, 0xdfbf, 0x7852, 0x080c, 0x2c61, 0x9085, 0x1000, 0x7852,
- 0x000e, 0x001e, 0x012e, 0x0005, 0x7850, 0x9084, 0xffcf, 0x7852,
- 0x0005, 0x0006, 0x0156, 0x00f6, 0x2079, 0x0100, 0x20a9, 0x000a,
- 0x7854, 0xd0ac, 0x1130, 0x7820, 0xd0e4, 0x1140, 0x1f04, 0x2c33,
- 0x0028, 0x7854, 0xd08c, 0x1110, 0x1f04, 0x2c39, 0x00fe, 0x015e,
-- 0x000e, 0x0005, 0x1d04, 0x2c42, 0x080c, 0x88f7, 0x1f04, 0x2c42,
-+ 0x000e, 0x0005, 0x1d04, 0x2c42, 0x080c, 0x88f0, 0x1f04, 0x2c42,
- 0x0005, 0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0000, 0x000e,
- 0x0005, 0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0001, 0x000e,
- 0x0005, 0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0002, 0x000e,
-@@ -1241,16 +1229,16 @@ unsigned short risc_code01[] = {
- 0x2800, 0x0dc0, 0x001e, 0x919c, 0xffe4, 0x9184, 0x0001, 0x0118,
- 0x9385, 0x0009, 0x6016, 0x9184, 0x0002, 0x0118, 0x9385, 0x0012,
- 0x6016, 0x003e, 0x2001, 0x180c, 0x200c, 0xc1dc, 0x2102, 0x00ce,
-- 0x0005, 0x0016, 0x0026, 0x080c, 0x7651, 0x0108, 0xc0bc, 0x2009,
-+ 0x0005, 0x0016, 0x0026, 0x080c, 0x764a, 0x0108, 0xc0bc, 0x2009,
- 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a, 0x002e, 0x001e,
- 0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001,
- 0x9285, 0x1000, 0x200a, 0x220a, 0x002e, 0x001e, 0x0005, 0x0016,
- 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a,
- 0x002e, 0x001e, 0x0005, 0x0006, 0x0016, 0x2009, 0x0140, 0x2104,
-- 0x1128, 0x080c, 0x7651, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a,
-+ 0x1128, 0x080c, 0x764a, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a,
- 0x001e, 0x000e, 0x0005, 0x0006, 0x0156, 0x6050, 0x9085, 0x0040,
- 0x6052, 0x6050, 0x9084, 0xfbcf, 0x6052, 0x080c, 0x2c61, 0x9085,
-- 0x2000, 0x6052, 0x20a9, 0x0012, 0x1d04, 0x2d84, 0x080c, 0x88f7,
-+ 0x2000, 0x6052, 0x20a9, 0x0012, 0x1d04, 0x2d84, 0x080c, 0x88f0,
- 0x1f04, 0x2d84, 0x6050, 0x9085, 0x0400, 0x9084, 0xdfbf, 0x6052,
- 0x015e, 0x000e, 0x0005, 0x2fff, 0x2fff, 0x2e23, 0x2e23, 0x2e2f,
- 0x2e2f, 0x2e3b, 0x2e3b, 0x2e49, 0x2e49, 0x2e55, 0x2e55, 0x2e63,
-@@ -1330,12 +1318,12 @@ unsigned short risc_code01[] = {
- 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2976, 0x080c, 0x22cc,
- 0x080c, 0x24c0, 0x080c, 0x1394, 0x080c, 0x2307, 0x0000, 0x015e,
- 0x014e, 0x013e, 0x01de, 0x01ce, 0x012e, 0x000e, 0x010e, 0x000d,
-- 0x00b6, 0x00c6, 0x0026, 0x0046, 0x9026, 0x080c, 0x6a61, 0x1904,
-+ 0x00b6, 0x00c6, 0x0026, 0x0046, 0x9026, 0x080c, 0x6a5a, 0x1904,
- 0x3137, 0x72dc, 0x2001, 0x197c, 0x2004, 0x9005, 0x1110, 0xd29c,
- 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904, 0x3137, 0x080c, 0x313c,
-- 0x0804, 0x3137, 0xd2cc, 0x1904, 0x3137, 0x080c, 0x7637, 0x1120,
-+ 0x0804, 0x3137, 0xd2cc, 0x1904, 0x3137, 0x080c, 0x7630, 0x1120,
- 0x70af, 0xffff, 0x0804, 0x3137, 0xd294, 0x0120, 0x70af, 0xffff,
-- 0x0804, 0x3137, 0x080c, 0x33a5, 0x0160, 0x080c, 0xd7e3, 0x0128,
-+ 0x0804, 0x3137, 0x080c, 0x33a5, 0x0160, 0x080c, 0xd7dc, 0x0128,
- 0x2001, 0x1818, 0x203c, 0x0804, 0x30b0, 0x70af, 0xffff, 0x0804,
- 0x3137, 0x2001, 0x1818, 0x203c, 0x7294, 0xd284, 0x0904, 0x30b0,
- 0xd28c, 0x1904, 0x30b0, 0x0036, 0x73ac, 0x938e, 0xffff, 0x1110,
-@@ -1344,12 +1332,12 @@ unsigned short risc_code01[] = {
- 0x0904, 0x30a6, 0x908e, 0x0000, 0x0904, 0x30a6, 0x908e, 0x00ff,
- 0x1160, 0x7230, 0xd284, 0x1904, 0x30ab, 0x7294, 0xc28d, 0x7296,
- 0x70af, 0xffff, 0x003e, 0x0804, 0x30b0, 0x2009, 0x180d, 0x210c,
-- 0xd18c, 0x0150, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac7, 0x002e,
-+ 0xd18c, 0x0150, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac0, 0x002e,
- 0x0118, 0x70af, 0xffff, 0x0488, 0x900e, 0x080c, 0x2873, 0x080c,
-- 0x66b9, 0x1538, 0x9006, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148,
-- 0x00c6, 0x2060, 0x080c, 0x8cf7, 0x00ce, 0x090c, 0x9096, 0xb8af,
-- 0x0000, 0x080c, 0x6aa3, 0x1168, 0x7030, 0xd08c, 0x0130, 0xb800,
-- 0xd0bc, 0x0138, 0x080c, 0x6944, 0x0120, 0x080c, 0x3155, 0x0148,
-+ 0x66b2, 0x1538, 0x9006, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148,
-+ 0x00c6, 0x2060, 0x080c, 0x8cf0, 0x00ce, 0x090c, 0x908f, 0xb8af,
-+ 0x0000, 0x080c, 0x6a9c, 0x1168, 0x7030, 0xd08c, 0x0130, 0xb800,
-+ 0xd0bc, 0x0138, 0x080c, 0x693d, 0x0120, 0x080c, 0x3155, 0x0148,
- 0x0028, 0x080c, 0x3295, 0x080c, 0x3181, 0x0118, 0x8318, 0x0804,
- 0x304a, 0x73ae, 0x0010, 0x70af, 0xffff, 0x003e, 0x0804, 0x3137,
- 0x9780, 0x33b6, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e,
-@@ -1357,57 +1345,57 @@ unsigned short risc_code01[] = {
- 0x0220, 0x2008, 0x9802, 0x20a8, 0x0020, 0x70af, 0xffff, 0x0804,
- 0x3137, 0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x312c, 0x2001,
- 0x180d, 0x2004, 0xd08c, 0x0158, 0x0026, 0x2011, 0x0010, 0x080c,
-- 0x6ac7, 0x002e, 0x0120, 0x2009, 0xffff, 0x0804, 0x3134, 0xc484,
-- 0x080c, 0x6724, 0x0168, 0x080c, 0xd7e3, 0x1904, 0x312c, 0x080c,
-- 0x33a5, 0x1904, 0x312c, 0x080c, 0x66b9, 0x1904, 0x3134, 0x0008,
-+ 0x6ac0, 0x002e, 0x0120, 0x2009, 0xffff, 0x0804, 0x3134, 0xc484,
-+ 0x080c, 0x671d, 0x0168, 0x080c, 0xd7dc, 0x1904, 0x312c, 0x080c,
-+ 0x33a5, 0x1904, 0x312c, 0x080c, 0x66b2, 0x1904, 0x3134, 0x0008,
- 0xc485, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060,
-- 0x080c, 0x8cf7, 0x00ce, 0x090c, 0x9096, 0xb8af, 0x0000, 0x080c,
-- 0x6aa3, 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0,
-- 0x7294, 0xd28c, 0x0180, 0x080c, 0x6aa3, 0x9082, 0x0006, 0x02e0,
-- 0xd484, 0x1118, 0x080c, 0x66de, 0x0028, 0x080c, 0x3321, 0x01a0,
-- 0x080c, 0x334c, 0x0088, 0x080c, 0x3295, 0x080c, 0xd7e3, 0x1160,
-- 0x080c, 0x3181, 0x0188, 0x0040, 0x080c, 0xd7e3, 0x1118, 0x080c,
-+ 0x080c, 0x8cf0, 0x00ce, 0x090c, 0x908f, 0xb8af, 0x0000, 0x080c,
-+ 0x6a9c, 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0,
-+ 0x7294, 0xd28c, 0x0180, 0x080c, 0x6a9c, 0x9082, 0x0006, 0x02e0,
-+ 0xd484, 0x1118, 0x080c, 0x66d7, 0x0028, 0x080c, 0x3321, 0x01a0,
-+ 0x080c, 0x334c, 0x0088, 0x080c, 0x3295, 0x080c, 0xd7dc, 0x1160,
-+ 0x080c, 0x3181, 0x0188, 0x0040, 0x080c, 0xd7dc, 0x1118, 0x080c,
- 0x3321, 0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04,
- 0x30c9, 0x70af, 0xffff, 0x0018, 0x001e, 0x015e, 0x71ae, 0x004e,
- 0x002e, 0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70af, 0x0001,
-- 0x2009, 0x007e, 0x080c, 0x66b9, 0x1168, 0xb813, 0x00ff, 0xb817,
-+ 0x2009, 0x007e, 0x080c, 0x66b2, 0x1168, 0xb813, 0x00ff, 0xb817,
- 0xfffe, 0x080c, 0x3295, 0x04a9, 0x0128, 0x70dc, 0xc0bd, 0x70de,
-- 0x080c, 0xd52b, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6,
-+ 0x080c, 0xd524, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6,
- 0x00c6, 0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c,
-- 0xb325, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xd554, 0x6023, 0x0001,
-- 0x9006, 0x080c, 0x6656, 0x2001, 0x0000, 0x080c, 0x666a, 0x0126,
-+ 0xb31e, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xd54d, 0x6023, 0x0001,
-+ 0x9006, 0x080c, 0x664f, 0x2001, 0x0000, 0x080c, 0x6663, 0x0126,
- 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0004,
-- 0x080c, 0xb352, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e,
-+ 0x080c, 0xb34b, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e,
- 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004,
-- 0x9084, 0x00ff, 0xb842, 0x080c, 0xb325, 0x0548, 0x2b00, 0x6012,
-+ 0x9084, 0x00ff, 0xb842, 0x080c, 0xb31e, 0x0548, 0x2b00, 0x6012,
- 0xb800, 0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804,
- 0x9084, 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x3250, 0x080c,
-- 0xd554, 0x6023, 0x0001, 0x9006, 0x080c, 0x6656, 0x2001, 0x0002,
-- 0x080c, 0x666a, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa,
-- 0x012e, 0x2009, 0x0002, 0x080c, 0xb352, 0x9085, 0x0001, 0x00ce,
-+ 0xd54d, 0x6023, 0x0001, 0x9006, 0x080c, 0x664f, 0x2001, 0x0002,
-+ 0x080c, 0x6663, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa,
-+ 0x012e, 0x2009, 0x0002, 0x080c, 0xb34b, 0x9085, 0x0001, 0x00ce,
- 0x00de, 0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009,
-- 0x0080, 0x080c, 0x66b9, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc,
-+ 0x0080, 0x080c, 0x66b2, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc,
- 0x0039, 0x0110, 0x70e3, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005,
-- 0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c, 0xb27d, 0x01d0, 0x2b00,
-- 0x6012, 0x080c, 0xd554, 0x6023, 0x0001, 0x9006, 0x080c, 0x6656,
-- 0x2001, 0x0002, 0x080c, 0x666a, 0x0126, 0x2091, 0x8000, 0x70e4,
-- 0x8000, 0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xb352, 0x9085,
-+ 0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c, 0xb276, 0x01d0, 0x2b00,
-+ 0x6012, 0x080c, 0xd54d, 0x6023, 0x0001, 0x9006, 0x080c, 0x664f,
-+ 0x2001, 0x0002, 0x080c, 0x6663, 0x0126, 0x2091, 0x8000, 0x70e4,
-+ 0x8000, 0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xb34b, 0x9085,
- 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6,
-- 0x0126, 0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x66b9, 0x11b8,
-- 0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8cf, 0x0004, 0x080c, 0xb27d,
-+ 0x0126, 0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x66b2, 0x11b8,
-+ 0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8cf, 0x0004, 0x080c, 0xb276,
- 0x0170, 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c,
-- 0xd554, 0x2009, 0x0022, 0x080c, 0xb352, 0x9085, 0x0001, 0x012e,
-+ 0xd54d, 0x2009, 0x0022, 0x080c, 0xb34b, 0x9085, 0x0001, 0x012e,
- 0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026,
-- 0x00b6, 0x21f0, 0x080c, 0x96af, 0x080c, 0x962f, 0x080c, 0xb111,
-- 0x080c, 0xc2d3, 0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e,
-- 0x900e, 0x0018, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6724,
-+ 0x00b6, 0x21f0, 0x080c, 0x96a8, 0x080c, 0x9628, 0x080c, 0xb10a,
-+ 0x080c, 0xc2cc, 0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e,
-+ 0x900e, 0x0018, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x671d,
- 0x1140, 0x9686, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c,
-- 0x6148, 0x001e, 0x8108, 0x1f04, 0x3235, 0x9686, 0x0001, 0x190c,
-+ 0x6141, 0x001e, 0x8108, 0x1f04, 0x3235, 0x9686, 0x0001, 0x190c,
- 0x3379, 0x00be, 0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005,
- 0x00e6, 0x00c6, 0x0046, 0x0036, 0x0026, 0x0016, 0x00b6, 0x6210,
-- 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x96a4, 0x0076,
-- 0x2039, 0x0000, 0x080c, 0x9577, 0x2c08, 0x080c, 0xe91c, 0x007e,
-- 0x001e, 0xba10, 0xbb14, 0xbcc0, 0x080c, 0x6148, 0xba12, 0xbb16,
-+ 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x969d, 0x0076,
-+ 0x2039, 0x0000, 0x080c, 0x9570, 0x2c08, 0x080c, 0xe915, 0x007e,
-+ 0x001e, 0xba10, 0xbb14, 0xbcc0, 0x080c, 0x6141, 0xba12, 0xbb16,
- 0xbcc2, 0x00be, 0x001e, 0x002e, 0x003e, 0x004e, 0x00ce, 0x00ee,
- 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010, 0x2058, 0xb8a0, 0x00be,
- 0x9086, 0x0080, 0x0150, 0x2071, 0x1800, 0x70a8, 0x9005, 0x0110,
-@@ -1415,36 +1403,36 @@ unsigned short risc_code01[] = {
- 0x9005, 0x0dc0, 0x8001, 0x70e6, 0x0ca8, 0xb800, 0xc08c, 0xb802,
- 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6, 0x0046, 0x0036, 0x0026,
- 0x0016, 0x0156, 0x2178, 0x81ff, 0x1118, 0x20a9, 0x0001, 0x0078,
-- 0x080c, 0x57d5, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2020,
-- 0x2009, 0x002d, 0x080c, 0xec31, 0x20a9, 0x0800, 0x9016, 0x0026,
-+ 0x080c, 0x57d3, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2020,
-+ 0x2009, 0x002d, 0x080c, 0xec2a, 0x20a9, 0x0800, 0x9016, 0x0026,
- 0x928e, 0x007e, 0x0904, 0x3300, 0x928e, 0x007f, 0x0904, 0x3300,
- 0x928e, 0x0080, 0x05e8, 0x9288, 0x1000, 0x210c, 0x81ff, 0x05c0,
- 0x8fff, 0x1148, 0x2001, 0x198e, 0x0006, 0x2003, 0x0001, 0x04f1,
- 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001, 0x0001,
-- 0x080c, 0x6a6d, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c, 0x96a4,
-- 0x0076, 0x2039, 0x0000, 0x080c, 0x9577, 0x00b6, 0x00c6, 0x0026,
-+ 0x080c, 0x6a66, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c, 0x969d,
-+ 0x0076, 0x2039, 0x0000, 0x080c, 0x9570, 0x00b6, 0x00c6, 0x0026,
- 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118, 0xb807,
- 0x0404, 0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06, 0x002e,
-- 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c, 0xe91c, 0x001e, 0x007e,
-+ 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c, 0xe915, 0x001e, 0x007e,
- 0x002e, 0x8210, 0x1f04, 0x32b7, 0x015e, 0x001e, 0x002e, 0x003e,
- 0x004e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026,
-- 0x0016, 0x080c, 0x57d5, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006,
-- 0x2220, 0x2009, 0x0029, 0x080c, 0xec31, 0x001e, 0x002e, 0x004e,
-+ 0x0016, 0x080c, 0x57d3, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006,
-+ 0x2220, 0x2009, 0x0029, 0x080c, 0xec2a, 0x001e, 0x002e, 0x004e,
- 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7294, 0x82ff, 0x01e8,
-- 0x080c, 0x6a9b, 0x11d0, 0x2100, 0x080c, 0x28a6, 0x81ff, 0x01b8,
-+ 0x080c, 0x6a94, 0x11d0, 0x2100, 0x080c, 0x28a6, 0x81ff, 0x01b8,
- 0x2019, 0x0001, 0x8314, 0x92e0, 0x1c80, 0x2c04, 0xd384, 0x0120,
- 0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138,
- 0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce,
- 0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091,
- 0x8000, 0x0036, 0x2019, 0x0029, 0x00a9, 0x003e, 0x9180, 0x1000,
- 0x2004, 0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1ab7, 0x001e,
-- 0x6112, 0x080c, 0x3250, 0x001e, 0x080c, 0x66de, 0x012e, 0x00ce,
-- 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xac6c, 0x080c,
-- 0xef94, 0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc,
-- 0x0005, 0x00c6, 0x00b6, 0x080c, 0x7637, 0x1118, 0x20a9, 0x0800,
-- 0x0010, 0x20a9, 0x0782, 0x080c, 0x7637, 0x1110, 0x900e, 0x0010,
-+ 0x6112, 0x080c, 0x3250, 0x001e, 0x080c, 0x66d7, 0x012e, 0x00ce,
-+ 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xac65, 0x080c,
-+ 0xef8d, 0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc,
-+ 0x0005, 0x00c6, 0x00b6, 0x080c, 0x7630, 0x1118, 0x20a9, 0x0800,
-+ 0x0010, 0x20a9, 0x0782, 0x080c, 0x7630, 0x1110, 0x900e, 0x0010,
- 0x2009, 0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff,
-- 0x0110, 0xb800, 0xd0bc, 0x090c, 0x66de, 0x8108, 0x1f04, 0x338a,
-+ 0x0110, 0xb800, 0xd0bc, 0x090c, 0x66d7, 0x8108, 0x1f04, 0x338a,
- 0x2061, 0x1800, 0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082,
- 0x60b3, 0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004,
- 0xd0bc, 0x0005, 0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026,
-@@ -1498,22 +1486,22 @@ unsigned short risc_code01[] = {
- 0x1210, 0x61d0, 0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x35de,
- 0x61d0, 0x0804, 0x3573, 0x35b5, 0x35ed, 0x35de, 0x35f9, 0x3603,
- 0x3609, 0x360d, 0x361d, 0x3621, 0x3637, 0x363d, 0x3643, 0x364e,
-- 0x3659, 0x3668, 0x3677, 0x3685, 0x369c, 0x36b7, 0x35de, 0x3762,
-- 0x37a0, 0x3846, 0x3857, 0x387a, 0x35de, 0x35de, 0x35de, 0x38b2,
-- 0x38ce, 0x38d7, 0x3906, 0x390c, 0x35de, 0x3952, 0x35de, 0x35de,
-- 0x35de, 0x35de, 0x35de, 0x395d, 0x3966, 0x396e, 0x3970, 0x35de,
-- 0x35de, 0x35de, 0x35de, 0x35de, 0x35de, 0x399c, 0x35de, 0x35de,
-- 0x35de, 0x35de, 0x35de, 0x39b9, 0x3a40, 0x35de, 0x35de, 0x35de,
-- 0x35de, 0x35de, 0x35de, 0x0002, 0x3a6a, 0x3a6d, 0x3acc, 0x3ae5,
-- 0x3b15, 0x3db7, 0x35de, 0x5398, 0x35de, 0x35de, 0x35de, 0x35de,
-- 0x35de, 0x35de, 0x35de, 0x35de, 0x3637, 0x363d, 0x42ec, 0x57f9,
-- 0x430a, 0x5427, 0x5479, 0x5584, 0x35de, 0x55e6, 0x5622, 0x5653,
-- 0x575b, 0x5680, 0x56db, 0x35de, 0x430e, 0x44e1, 0x44f7, 0x451c,
-- 0x4581, 0x45f5, 0x4615, 0x468c, 0x46e8, 0x4744, 0x4747, 0x476c,
-- 0x4823, 0x4889, 0x4891, 0x49c6, 0x4b6e, 0x4ba2, 0x4e06, 0x35de,
-- 0x4e24, 0x4eeb, 0x4fd4, 0x502e, 0x35de, 0x50c1, 0x35de, 0x50d7,
-- 0x50f2, 0x4891, 0x5338, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c,
-- 0x4c20, 0x0126, 0x2091, 0x8000, 0x0e04, 0x35bf, 0x0010, 0x012e,
-+ 0x3659, 0x3668, 0x3677, 0x3685, 0x369c, 0x36b7, 0x35de, 0x3760,
-+ 0x379e, 0x3844, 0x3855, 0x3878, 0x35de, 0x35de, 0x35de, 0x38b0,
-+ 0x38cc, 0x38d5, 0x3904, 0x390a, 0x35de, 0x3950, 0x35de, 0x35de,
-+ 0x35de, 0x35de, 0x35de, 0x395b, 0x3964, 0x396c, 0x396e, 0x35de,
-+ 0x35de, 0x35de, 0x35de, 0x35de, 0x35de, 0x399a, 0x35de, 0x35de,
-+ 0x35de, 0x35de, 0x35de, 0x39b7, 0x3a3e, 0x35de, 0x35de, 0x35de,
-+ 0x35de, 0x35de, 0x35de, 0x0002, 0x3a68, 0x3a6b, 0x3aca, 0x3ae3,
-+ 0x3b13, 0x3db5, 0x35de, 0x5396, 0x35de, 0x35de, 0x35de, 0x35de,
-+ 0x35de, 0x35de, 0x35de, 0x35de, 0x3637, 0x363d, 0x42ea, 0x57f7,
-+ 0x4308, 0x5425, 0x5477, 0x5582, 0x35de, 0x55e4, 0x5620, 0x5651,
-+ 0x5759, 0x567e, 0x56d9, 0x35de, 0x430c, 0x44df, 0x44f5, 0x451a,
-+ 0x457f, 0x45f3, 0x4613, 0x468a, 0x46e6, 0x4742, 0x4745, 0x476a,
-+ 0x4821, 0x4887, 0x488f, 0x49c4, 0x4b6c, 0x4ba0, 0x4e04, 0x35de,
-+ 0x4e22, 0x4ee9, 0x4fd2, 0x502c, 0x35de, 0x50bf, 0x35de, 0x50d5,
-+ 0x50f0, 0x488f, 0x5336, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c,
-+ 0x4c1e, 0x0126, 0x2091, 0x8000, 0x0e04, 0x35bf, 0x0010, 0x012e,
- 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010,
- 0x7833, 0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080,
- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x7007, 0x0001,
-@@ -1521,12 +1509,12 @@ unsigned short risc_code01[] = {
- 0x08b0, 0x2021, 0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021,
- 0x4005, 0x0868, 0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e,
- 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x81ff, 0x0d98, 0x0804,
-- 0x4c2d, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
-- 0x7990, 0x0804, 0x4c30, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
-+ 0x4c2b, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
-+ 0x7990, 0x0804, 0x4c2e, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
- 0x35b5, 0x7984, 0x2114, 0x0804, 0x35b5, 0x20e1, 0x0000, 0x2099,
- 0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003,
- 0x7984, 0x7a88, 0x7b8c, 0x0804, 0x35b5, 0x7884, 0x2060, 0x0804,
-- 0x366a, 0x2009, 0x0003, 0x2011, 0x0003, 0x2019, 0x0014, 0x789b,
-+ 0x366a, 0x2009, 0x0003, 0x2011, 0x0003, 0x2019, 0x0013, 0x789b,
- 0x0137, 0x7893, 0xffff, 0x2001, 0x188f, 0x2004, 0x9005, 0x0118,
- 0x7896, 0x0804, 0x35b5, 0x7897, 0x0001, 0x0804, 0x35b5, 0x2039,
- 0x0001, 0x7d98, 0x7c9c, 0x0804, 0x35f1, 0x2039, 0x0001, 0x7d98,
-@@ -1541,6218 +1529,6217 @@ unsigned short risc_code01[] = {
- 0x7984, 0x2198, 0x4012, 0x0804, 0x35b5, 0x2069, 0x1847, 0x7884,
- 0x7990, 0x911a, 0x1a04, 0x35ea, 0x8019, 0x0904, 0x35ea, 0x684a,
- 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006, 0x685a, 0x685e,
-- 0x080c, 0x7963, 0x0804, 0x35b5, 0x2069, 0x1847, 0x7884, 0x7994,
-+ 0x080c, 0x795c, 0x0804, 0x35b5, 0x2069, 0x1847, 0x7884, 0x7994,
- 0x911a, 0x1a04, 0x35ea, 0x8019, 0x0904, 0x35ea, 0x684e, 0x6946,
- 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a, 0x686e, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x6bf8, 0x012e, 0x0804, 0x35b5, 0x902e,
-+ 0x2091, 0x8000, 0x080c, 0x6bf1, 0x012e, 0x0804, 0x35b5, 0x902e,
- 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7, 0x7984,
- 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1, 0x18a6,
-- 0x4101, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7,
-- 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c2d,
-+ 0x4101, 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7,
-+ 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c2b,
- 0x701f, 0x36db, 0x0005, 0xa864, 0x2008, 0x9084, 0x00ff, 0x9096,
- 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096, 0x0015, 0x0138,
- 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904, 0x35e7, 0x810f,
- 0x918c, 0x00ff, 0x0904, 0x35e7, 0x7112, 0x7010, 0x8001, 0x0560,
-- 0x7012, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7,
-+ 0x7012, 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7,
- 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598,
- 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000,
-- 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c2d, 0x701f, 0x3719,
-+ 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c2b, 0x701f, 0x3719,
- 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002, 0x0120, 0x9096,
-- 0x000a, 0x1904, 0x35e7, 0x0888, 0x0126, 0x2091, 0x8000, 0x7014,
-- 0x2048, 0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096,
-- 0x0029, 0x1148, 0xc2fd, 0xaa7a, 0x080c, 0x629f, 0x0138, 0xa87a,
-- 0xa982, 0x012e, 0x0060, 0x080c, 0x65cf, 0x1130, 0x7007, 0x0003,
-- 0x701f, 0x3747, 0x012e, 0x0005, 0x080c, 0x710b, 0x012e, 0x0126,
-- 0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6,
-- 0x400a, 0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
-- 0x0000, 0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60,
-- 0x0804, 0x4c30, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010,
-- 0x7883, 0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020,
-- 0x2009, 0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100,
-- 0x6200, 0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009,
-- 0x04fd, 0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001,
-- 0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a1c, 0x2004, 0x9005,
-- 0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a,
-- 0x2003, 0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427,
-- 0x81ff, 0x1904, 0x35e7, 0x7984, 0x080c, 0x6724, 0x1904, 0x35ea,
-- 0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x35ea, 0x7c88,
-- 0x7d8c, 0x080c, 0x6887, 0x080c, 0x6856, 0x0000, 0x1518, 0x2061,
-- 0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148,
-- 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506,
-- 0x0150, 0x012e, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
-- 0x1a04, 0x35e7, 0x0c30, 0x080c, 0xccf3, 0x012e, 0x0904, 0x35e7,
-- 0x0804, 0x35b5, 0x900e, 0x2001, 0x0005, 0x080c, 0x710b, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0xd3d4, 0x080c, 0x6e9f, 0x012e, 0x0804,
-- 0x35b5, 0x00a6, 0x2950, 0xb198, 0x080c, 0x6724, 0x1904, 0x3833,
-- 0xb6a4, 0x9684, 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0,
-- 0x080c, 0x6887, 0x080c, 0x6856, 0x1520, 0x2061, 0x1cd0, 0x0126,
-+ 0x000a, 0x1904, 0x35e7, 0x0888, 0x7014, 0x2048, 0xa868, 0xc0fd,
-+ 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029, 0x1160, 0xc2fd,
-+ 0xaa7a, 0x080c, 0x6298, 0x0150, 0x0126, 0x2091, 0x8000, 0xa87a,
-+ 0xa982, 0x012e, 0x0050, 0x080c, 0x65c8, 0x1128, 0x7007, 0x0003,
-+ 0x701f, 0x3745, 0x0005, 0x080c, 0x7104, 0x0126, 0x2091, 0x8000,
-+ 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6, 0x400a, 0x2100,
-+ 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c,
-+ 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60, 0x0804, 0x4c2e,
-+ 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010, 0x7883, 0x4000,
-+ 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020, 0x2009, 0x017f,
-+ 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100, 0x6200, 0x2061,
-+ 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009, 0x04fd, 0x2104,
-+ 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-+ 0xd084, 0x0180, 0x2001, 0x1a1c, 0x2004, 0x9005, 0x0128, 0x2001,
-+ 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002,
-+ 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427, 0x81ff, 0x1904,
-+ 0x35e7, 0x7984, 0x080c, 0x671d, 0x1904, 0x35ea, 0x7e98, 0x9684,
-+ 0x3fff, 0x9082, 0x4000, 0x1a04, 0x35ea, 0x7c88, 0x7d8c, 0x080c,
-+ 0x6880, 0x080c, 0x684f, 0x0000, 0x1518, 0x2061, 0x1cd0, 0x0126,
- 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d,
-- 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e,
-- 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d,
-- 0x12b0, 0x0c28, 0x080c, 0xccf3, 0x012e, 0x2009, 0x0003, 0x0178,
-- 0x00e0, 0x900e, 0x2001, 0x0005, 0x080c, 0x710b, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xd3d4, 0x080c, 0x6e92, 0x012e, 0x0070, 0xb097,
-- 0x4005, 0xb19a, 0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001,
-- 0x2001, 0x0030, 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006,
-- 0x918d, 0x0001, 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904,
-- 0x35e7, 0x080c, 0x4bfb, 0x0904, 0x35ea, 0x080c, 0x67eb, 0x0904,
-- 0x35e7, 0x080c, 0x688d, 0x0904, 0x35e7, 0x0804, 0x460c, 0x81ff,
-- 0x1904, 0x35e7, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x080c, 0x691b,
-- 0x0904, 0x35e7, 0x2019, 0x0005, 0x79a8, 0x080c, 0x68a8, 0x0904,
-- 0x35e7, 0x7888, 0x908a, 0x1000, 0x1a04, 0x35ea, 0x8003, 0x800b,
-- 0x810b, 0x9108, 0x080c, 0x884b, 0x79a8, 0xd184, 0x1904, 0x35b5,
-- 0x0804, 0x460c, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009,
-- 0x0001, 0x0450, 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8,
-- 0x2508, 0x080c, 0x6724, 0x11d8, 0x080c, 0x691b, 0x1128, 0x2009,
-- 0x0002, 0x62c0, 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c,
-- 0x68a8, 0x1118, 0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000,
-- 0x1270, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x884b, 0x8529,
-- 0x1ae0, 0x012e, 0x0804, 0x35b5, 0x012e, 0x0804, 0x35e7, 0x012e,
-- 0x0804, 0x35ea, 0x080c, 0x4bfb, 0x0904, 0x35ea, 0x080c, 0x67eb,
-- 0x0904, 0x35e7, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c,
-- 0x96a4, 0x0076, 0x903e, 0x080c, 0x9577, 0x900e, 0x080c, 0xe91c,
-- 0x007e, 0x00ce, 0x080c, 0x6887, 0x0804, 0x35b5, 0x080c, 0x4bfb,
-- 0x0904, 0x35ea, 0x080c, 0x6887, 0x2208, 0x0804, 0x35b5, 0x0156,
-- 0x00d6, 0x00e6, 0x2069, 0x1910, 0x6810, 0x6914, 0x910a, 0x1208,
-- 0x900e, 0x6816, 0x9016, 0x901e, 0x20a9, 0x007e, 0x2069, 0x1000,
-- 0x2d04, 0x905d, 0x0118, 0xb84c, 0x0059, 0x9210, 0x8d68, 0x1f04,
-- 0x38e8, 0x2300, 0x9218, 0x00ee, 0x00de, 0x015e, 0x0804, 0x35b5,
-- 0x00f6, 0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff,
-- 0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910,
-- 0x6910, 0x62bc, 0x0804, 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001,
-- 0x0804, 0x35e7, 0x0126, 0x2091, 0x8000, 0x080c, 0x57e9, 0x0128,
-- 0x2009, 0x0007, 0x012e, 0x0804, 0x35e7, 0x012e, 0x615c, 0x9190,
-- 0x33b6, 0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280,
-- 0x67dc, 0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001,
-- 0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003,
-- 0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002,
-- 0x0068, 0x080c, 0x7637, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c,
-- 0x0120, 0x2009, 0x0005, 0x0804, 0x35e7, 0x9036, 0x7e9a, 0x7f9e,
-- 0x0804, 0x35b5, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001,
-- 0x1987, 0x2004, 0x789a, 0x0804, 0x35b5, 0x0126, 0x2091, 0x8000,
-- 0x6138, 0x623c, 0x6340, 0x012e, 0x0804, 0x35b5, 0x080c, 0x4c17,
-- 0x0904, 0x35ea, 0xba44, 0xbb38, 0x0804, 0x35b5, 0x080c, 0x0dc5,
-- 0x080c, 0x4c17, 0x2110, 0x0904, 0x35ea, 0xb804, 0x908c, 0x00ff,
-- 0x918e, 0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009,
-- 0x0009, 0x1904, 0x35e7, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005,
-- 0x00c6, 0x9066, 0x080c, 0xac6c, 0x080c, 0x96a4, 0x0076, 0x903e,
-- 0x080c, 0x9577, 0x900e, 0x080c, 0xe91c, 0x007e, 0x00ce, 0xb807,
-- 0x0407, 0x012e, 0x0804, 0x35b5, 0x614c, 0x6250, 0x7884, 0x604e,
-- 0x7b88, 0x6352, 0x2069, 0x1847, 0x831f, 0x9305, 0x6816, 0x788c,
-- 0x2069, 0x1986, 0x2d1c, 0x206a, 0x7e98, 0x9682, 0x0014, 0x1210,
-- 0x2031, 0x07d0, 0x2069, 0x1987, 0x2d04, 0x266a, 0x789a, 0x0804,
-- 0x35b5, 0x0126, 0x2091, 0x8000, 0x6138, 0x7884, 0x603a, 0x910e,
-- 0xd1b4, 0x190c, 0x0ebe, 0xd094, 0x0148, 0x00e6, 0x2071, 0x19fb,
-- 0x79b4, 0x9192, 0x07d0, 0x1208, 0x713e, 0x00ee, 0xd0c4, 0x01a8,
-- 0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011, 0x199e,
-- 0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214,
-- 0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0xd0ec, 0x0178,
-- 0x6034, 0xc08d, 0x6036, 0x2001, 0x0050, 0x6076, 0x607a, 0x6056,
-- 0x606b, 0x2450, 0x00c6, 0x2061, 0x1ad1, 0x2062, 0x00ce, 0x2011,
-- 0x0114, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080, 0x0010,
-- 0x918c, 0xff7f, 0x2112, 0x603c, 0x7988, 0x613e, 0x6140, 0x910d,
-- 0x788c, 0x6042, 0x7a88, 0x9294, 0x1000, 0x9205, 0x910e, 0xd1e4,
-- 0x190c, 0x0ed4, 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046, 0x9084,
-- 0x0001, 0x090c, 0x42ec, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011,
-- 0x0114, 0x2012, 0x012e, 0x0804, 0x35b5, 0x00f6, 0x2079, 0x1800,
-- 0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf,
-- 0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897,
-- 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005,
-- 0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x35ea, 0x788c,
-- 0x902d, 0x0904, 0x35ea, 0x900e, 0x080c, 0x6724, 0x1120, 0xba44,
-- 0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0,
-- 0x080c, 0x4c17, 0x0904, 0x35ea, 0x7888, 0x900d, 0x0904, 0x35ea,
-- 0x788c, 0x9005, 0x0904, 0x35ea, 0xba44, 0xb946, 0xbb38, 0xb83a,
-- 0x0804, 0x35b5, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c,
-- 0x57e9, 0x1904, 0x35e7, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186,
-- 0x00ff, 0x1130, 0x2001, 0x1818, 0x2004, 0x9085, 0xff00, 0x0088,
-- 0x9182, 0x007f, 0x16e0, 0x9188, 0x33b6, 0x210d, 0x918c, 0x00ff,
-- 0x2001, 0x1818, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f,
-- 0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0xb27d, 0x000e,
-- 0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x66bf, 0x2b08,
-- 0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4be4, 0x01d0,
-- 0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a,
-- 0x701f, 0x3ac5, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0xb352,
-- 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x35e7, 0x00ce,
-- 0x0804, 0x35ea, 0x080c, 0xb2d3, 0x0cb0, 0xa830, 0x9086, 0x0100,
-- 0x0904, 0x35e7, 0x0804, 0x35b5, 0x2061, 0x1a74, 0x0126, 0x2091,
-- 0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800,
-- 0x6354, 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa, 0x012e,
-- 0x0804, 0x35b5, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x35e7,
-- 0x080c, 0x7637, 0x0904, 0x35e7, 0x0126, 0x2091, 0x8000, 0x6254,
-- 0x6074, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x28dc, 0x080c,
-- 0x5a11, 0x012e, 0x0804, 0x35b5, 0x012e, 0x0804, 0x35ea, 0x0006,
-- 0x0016, 0x00c6, 0x00e6, 0x2001, 0x19aa, 0x2070, 0x2061, 0x1847,
-- 0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x9375, 0x7206,
-- 0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000,
-- 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x35b7, 0x7884,
-- 0xd0fc, 0x0158, 0x2001, 0x002a, 0x2004, 0x9005, 0x0180, 0x9082,
-- 0x00e1, 0x0298, 0x012e, 0x0804, 0x35ea, 0x2001, 0x002a, 0x2004,
-- 0x9005, 0x0128, 0x2069, 0x1847, 0x6908, 0x9102, 0x1230, 0x012e,
-- 0x0804, 0x35ea, 0x012e, 0x0804, 0x35e7, 0x080c, 0xb23d, 0x0dd0,
-- 0x7884, 0xd0fc, 0x0904, 0x3b94, 0x00c6, 0x080c, 0x4be4, 0x00ce,
-- 0x0d88, 0xa867, 0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c,
-- 0xa812, 0x2001, 0x002e, 0x2004, 0xa81a, 0x2001, 0x002f, 0x2004,
-- 0xa81e, 0x2001, 0x0030, 0x2004, 0xa822, 0x2001, 0x0031, 0x2004,
-- 0xa826, 0x2001, 0x0034, 0x2004, 0xa82a, 0x2001, 0x0035, 0x2004,
-- 0xa82e, 0x2001, 0x002a, 0x2004, 0x9080, 0x0003, 0x9084, 0x00fc,
-- 0x8004, 0xa816, 0x080c, 0x3d1a, 0x0928, 0x7014, 0x2048, 0xad2c,
-- 0xac28, 0xab1c, 0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029,
-- 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-- 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4c2d, 0x701f, 0x3c57,
-- 0x7023, 0x0001, 0x012e, 0x0005, 0x0046, 0x0086, 0x0096, 0x00a6,
-- 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3aff, 0x2001,
-- 0x19a0, 0x2003, 0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104,
-- 0x0016, 0x60bb, 0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c,
-- 0x3d89, 0x080c, 0x3d48, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071,
-- 0x1a69, 0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4,
-- 0x0140, 0x2001, 0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004,
-- 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x4130, 0x008e, 0x00ee,
-- 0x00fe, 0x080c, 0x4052, 0x080c, 0x3f57, 0x05b8, 0x2001, 0x020b,
-- 0x2004, 0x9084, 0x0140, 0x1db8, 0x080c, 0x41a4, 0x00f6, 0x2079,
-- 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200,
-- 0x7037, 0x0000, 0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510,
-- 0x7037, 0x0001, 0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0,
-- 0x7037, 0x0000, 0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190,
-- 0x2001, 0x1820, 0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100,
-- 0x6024, 0x9084, 0x1e00, 0x00ce, 0x0138, 0x080c, 0x3f61, 0x080c,
-- 0x3d43, 0x0058, 0x080c, 0x3d43, 0x080c, 0x40c8, 0x080c, 0x4048,
-- 0x2001, 0x020b, 0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003,
-- 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011,
-- 0x020d, 0x2013, 0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf,
-- 0x0012, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c,
-- 0x12fc, 0x2009, 0x0028, 0x080c, 0x2409, 0x2001, 0x0227, 0x200c,
-- 0x2102, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-- 0x008e, 0x004e, 0x2001, 0x19a0, 0x2004, 0x9005, 0x1118, 0x012e,
-- 0x0804, 0x35b5, 0x012e, 0x2021, 0x400c, 0x0804, 0x35b7, 0x0016,
-- 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6,
-- 0x0156, 0x7014, 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804,
-- 0x9005, 0x0904, 0x3cb3, 0x2048, 0x1f04, 0x3c67, 0x7068, 0x2040,
-- 0xa28c, 0xa390, 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120,
-- 0x2029, 0x0000, 0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864,
-- 0x009e, 0x9086, 0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc,
-- 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4c2d, 0x701f,
-- 0x3c57, 0x00b0, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-- 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0,
-- 0x0006, 0x080c, 0x0f8b, 0x000e, 0x080c, 0x4c30, 0x701f, 0x3c57,
-- 0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e,
-- 0x002e, 0x001e, 0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103,
-- 0x1118, 0x701f, 0x3d18, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd,
-- 0xa86a, 0x2009, 0x007f, 0x080c, 0x66b9, 0x0110, 0x9006, 0x0030,
-- 0xb813, 0x00ff, 0xb817, 0xfffd, 0x080c, 0xd5a7, 0x015e, 0x00de,
-+ 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e,
-+ 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a04, 0x35e7,
-+ 0x0c30, 0x080c, 0xccec, 0x012e, 0x0904, 0x35e7, 0x0804, 0x35b5,
-+ 0x900e, 0x2001, 0x0005, 0x080c, 0x7104, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0xd3cd, 0x080c, 0x6e98, 0x012e, 0x0804, 0x35b5, 0x00a6,
-+ 0x2950, 0xb198, 0x080c, 0x671d, 0x1904, 0x3831, 0xb6a4, 0x9684,
-+ 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x6880,
-+ 0x080c, 0x684f, 0x1520, 0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000,
-+ 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c,
-+ 0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x0018,
-+ 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28,
-+ 0x080c, 0xccec, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e,
-+ 0x2001, 0x0005, 0x080c, 0x7104, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xd3cd, 0x080c, 0x6e8b, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a,
-+ 0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-+ 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001,
-+ 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x35e7, 0x080c,
-+ 0x4bf9, 0x0904, 0x35ea, 0x080c, 0x67e4, 0x0904, 0x35e7, 0x080c,
-+ 0x6886, 0x0904, 0x35e7, 0x0804, 0x460a, 0x81ff, 0x1904, 0x35e7,
-+ 0x080c, 0x4c15, 0x0904, 0x35ea, 0x080c, 0x6914, 0x0904, 0x35e7,
-+ 0x2019, 0x0005, 0x79a8, 0x080c, 0x68a1, 0x0904, 0x35e7, 0x7888,
-+ 0x908a, 0x1000, 0x1a04, 0x35ea, 0x8003, 0x800b, 0x810b, 0x9108,
-+ 0x080c, 0x8844, 0x79a8, 0xd184, 0x1904, 0x35b5, 0x0804, 0x460a,
-+ 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450,
-+ 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c,
-+ 0x671d, 0x11d8, 0x080c, 0x6914, 0x1128, 0x2009, 0x0002, 0x62c0,
-+ 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x68a1, 0x1118,
-+ 0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003,
-+ 0x800b, 0x810b, 0x9108, 0x080c, 0x8844, 0x8529, 0x1ae0, 0x012e,
-+ 0x0804, 0x35b5, 0x012e, 0x0804, 0x35e7, 0x012e, 0x0804, 0x35ea,
-+ 0x080c, 0x4bf9, 0x0904, 0x35ea, 0x080c, 0x67e4, 0x0904, 0x35e7,
-+ 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c, 0x969d, 0x0076,
-+ 0x903e, 0x080c, 0x9570, 0x900e, 0x080c, 0xe915, 0x007e, 0x00ce,
-+ 0x080c, 0x6880, 0x0804, 0x35b5, 0x080c, 0x4bf9, 0x0904, 0x35ea,
-+ 0x080c, 0x6880, 0x2208, 0x0804, 0x35b5, 0x0156, 0x00d6, 0x00e6,
-+ 0x2069, 0x1910, 0x6810, 0x6914, 0x910a, 0x1208, 0x900e, 0x6816,
-+ 0x9016, 0x901e, 0x20a9, 0x007e, 0x2069, 0x1000, 0x2d04, 0x905d,
-+ 0x0118, 0xb84c, 0x0059, 0x9210, 0x8d68, 0x1f04, 0x38e6, 0x2300,
-+ 0x9218, 0x00ee, 0x00de, 0x015e, 0x0804, 0x35b5, 0x00f6, 0x0016,
-+ 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110, 0x2178,
-+ 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910, 0x6910, 0x62bc,
-+ 0x0804, 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x57e7, 0x0128, 0x2009, 0x0007,
-+ 0x012e, 0x0804, 0x35e7, 0x012e, 0x615c, 0x9190, 0x33b6, 0x2215,
-+ 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280, 0x67dc, 0x97c4,
-+ 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001, 0x00e8, 0x97c4,
-+ 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003, 0x00a8, 0x97c4,
-+ 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002, 0x0068, 0x080c,
-+ 0x7630, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c, 0x0120, 0x2009,
-+ 0x0005, 0x0804, 0x35e7, 0x9036, 0x7e9a, 0x7f9e, 0x0804, 0x35b5,
-+ 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001, 0x1987, 0x2004,
-+ 0x789a, 0x0804, 0x35b5, 0x0126, 0x2091, 0x8000, 0x6138, 0x623c,
-+ 0x6340, 0x012e, 0x0804, 0x35b5, 0x080c, 0x4c15, 0x0904, 0x35ea,
-+ 0xba44, 0xbb38, 0x0804, 0x35b5, 0x080c, 0x0dc5, 0x080c, 0x4c15,
-+ 0x2110, 0x0904, 0x35ea, 0xb804, 0x908c, 0x00ff, 0x918e, 0x0006,
-+ 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009, 0x0009, 0x1904,
-+ 0x35e7, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005, 0x00c6, 0x9066,
-+ 0x080c, 0xac65, 0x080c, 0x969d, 0x0076, 0x903e, 0x080c, 0x9570,
-+ 0x900e, 0x080c, 0xe915, 0x007e, 0x00ce, 0xb807, 0x0407, 0x012e,
-+ 0x0804, 0x35b5, 0x614c, 0x6250, 0x7884, 0x604e, 0x7b88, 0x6352,
-+ 0x2069, 0x1847, 0x831f, 0x9305, 0x6816, 0x788c, 0x2069, 0x1986,
-+ 0x2d1c, 0x206a, 0x7e98, 0x9682, 0x0014, 0x1210, 0x2031, 0x07d0,
-+ 0x2069, 0x1987, 0x2d04, 0x266a, 0x789a, 0x0804, 0x35b5, 0x0126,
-+ 0x2091, 0x8000, 0x6138, 0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c,
-+ 0x0ebe, 0xd094, 0x0148, 0x00e6, 0x2071, 0x19fb, 0x79b4, 0x9192,
-+ 0x07d0, 0x1208, 0x713e, 0x00ee, 0xd0c4, 0x01a8, 0x00d6, 0x78a8,
-+ 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011, 0x199e, 0x2012, 0x2069,
-+ 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214, 0x6a5a, 0x0010,
-+ 0x210c, 0x695a, 0x00de, 0x7888, 0xd0ec, 0x0178, 0x6034, 0xc08d,
-+ 0x6036, 0x2001, 0x0050, 0x6076, 0x607a, 0x6056, 0x606b, 0x2450,
-+ 0x00c6, 0x2061, 0x1ad1, 0x2062, 0x00ce, 0x2011, 0x0114, 0x220c,
-+ 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080, 0x0010, 0x918c, 0xff7f,
-+ 0x2112, 0x603c, 0x7988, 0x613e, 0x6140, 0x910d, 0x788c, 0x6042,
-+ 0x7a88, 0x9294, 0x1000, 0x9205, 0x910e, 0xd1e4, 0x190c, 0x0ed4,
-+ 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046, 0x9084, 0x0001, 0x090c,
-+ 0x42ea, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011, 0x0114, 0x2012,
-+ 0x012e, 0x0804, 0x35b5, 0x00f6, 0x2079, 0x1800, 0x7a38, 0xa898,
-+ 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf, 0x8002, 0x9214,
-+ 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897, 0x4000, 0x900e,
-+ 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005, 0x7898, 0x9005,
-+ 0x01a8, 0x7888, 0x9025, 0x0904, 0x35ea, 0x788c, 0x902d, 0x0904,
-+ 0x35ea, 0x900e, 0x080c, 0x671d, 0x1120, 0xba44, 0xbb38, 0xbc46,
-+ 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0, 0x080c, 0x4c15,
-+ 0x0904, 0x35ea, 0x7888, 0x900d, 0x0904, 0x35ea, 0x788c, 0x9005,
-+ 0x0904, 0x35ea, 0xba44, 0xb946, 0xbb38, 0xb83a, 0x0804, 0x35b5,
-+ 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c, 0x57e7, 0x1904,
-+ 0x35e7, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186, 0x00ff, 0x1130,
-+ 0x2001, 0x1818, 0x2004, 0x9085, 0xff00, 0x0088, 0x9182, 0x007f,
-+ 0x16e0, 0x9188, 0x33b6, 0x210d, 0x918c, 0x00ff, 0x2001, 0x1818,
-+ 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f, 0x9105, 0x0126,
-+ 0x2091, 0x8000, 0x0006, 0x080c, 0xb276, 0x000e, 0x0510, 0x602e,
-+ 0x620a, 0x7984, 0x00b6, 0x080c, 0x66b8, 0x2b08, 0x00be, 0x1500,
-+ 0x6112, 0x6023, 0x0001, 0x080c, 0x4be2, 0x01d0, 0x9006, 0xa866,
-+ 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x701f, 0x3ac3,
-+ 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0xb34b, 0x012e, 0x00ce,
-+ 0x0005, 0x012e, 0x00ce, 0x0804, 0x35e7, 0x00ce, 0x0804, 0x35ea,
-+ 0x080c, 0xb2cc, 0x0cb0, 0xa830, 0x9086, 0x0100, 0x0904, 0x35e7,
-+ 0x0804, 0x35b5, 0x2061, 0x1a74, 0x0126, 0x2091, 0x8000, 0x6000,
-+ 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800, 0x6354, 0x6074,
-+ 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa, 0x012e, 0x0804, 0x35b5,
-+ 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x35e7, 0x080c, 0x7630,
-+ 0x0904, 0x35e7, 0x0126, 0x2091, 0x8000, 0x6254, 0x6074, 0x9202,
-+ 0x0248, 0x9085, 0x0001, 0x080c, 0x28dc, 0x080c, 0x5a0a, 0x012e,
-+ 0x0804, 0x35b5, 0x012e, 0x0804, 0x35ea, 0x0006, 0x0016, 0x00c6,
-+ 0x00e6, 0x2001, 0x19aa, 0x2070, 0x2061, 0x1847, 0x6008, 0x2072,
-+ 0x900e, 0x2011, 0x1400, 0x080c, 0x936e, 0x7206, 0x00ee, 0x00ce,
-+ 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0128,
-+ 0x012e, 0x2021, 0x400b, 0x0804, 0x35b7, 0x7884, 0xd0fc, 0x0158,
-+ 0x2001, 0x002a, 0x2004, 0x9005, 0x0180, 0x9082, 0x00e1, 0x0298,
-+ 0x012e, 0x0804, 0x35ea, 0x2001, 0x002a, 0x2004, 0x9005, 0x0128,
-+ 0x2069, 0x1847, 0x6908, 0x9102, 0x1230, 0x012e, 0x0804, 0x35ea,
-+ 0x012e, 0x0804, 0x35e7, 0x080c, 0xb236, 0x0dd0, 0x7884, 0xd0fc,
-+ 0x0904, 0x3b92, 0x00c6, 0x080c, 0x4be2, 0x00ce, 0x0d88, 0xa867,
-+ 0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812, 0x2001,
-+ 0x002e, 0x2004, 0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e, 0x2001,
-+ 0x0030, 0x2004, 0xa822, 0x2001, 0x0031, 0x2004, 0xa826, 0x2001,
-+ 0x0034, 0x2004, 0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e, 0x2001,
-+ 0x002a, 0x2004, 0x9080, 0x0003, 0x9084, 0x00fc, 0x8004, 0xa816,
-+ 0x080c, 0x3d18, 0x0928, 0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c,
-+ 0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021,
-+ 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-+ 0x9080, 0x001b, 0x080c, 0x4c2b, 0x701f, 0x3c55, 0x7023, 0x0001,
-+ 0x012e, 0x0005, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6,
-+ 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3afd, 0x2001, 0x19a0, 0x2003,
-+ 0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb,
-+ 0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3d87, 0x080c,
-+ 0x3d46, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x1a69, 0x2079,
-+ 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001,
-+ 0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de,
-+ 0x2011, 0x0001, 0x080c, 0x412e, 0x008e, 0x00ee, 0x00fe, 0x080c,
-+ 0x4050, 0x080c, 0x3f55, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084,
-+ 0x0140, 0x1db8, 0x080c, 0x41a2, 0x00f6, 0x2079, 0x0300, 0x78bc,
-+ 0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000,
-+ 0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001,
-+ 0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000,
-+ 0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x1820,
-+ 0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084,
-+ 0x1e00, 0x00ce, 0x0138, 0x080c, 0x3f5f, 0x080c, 0x3d41, 0x0058,
-+ 0x080c, 0x3d41, 0x080c, 0x40c6, 0x080c, 0x4046, 0x2001, 0x020b,
-+ 0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061,
-+ 0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013,
-+ 0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001,
-+ 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x12fc, 0x2009,
-+ 0x0028, 0x080c, 0x2409, 0x2001, 0x0227, 0x200c, 0x2102, 0x00fe,
-+ 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e,
-+ 0x2001, 0x19a0, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804, 0x35b5,
-+ 0x012e, 0x2021, 0x400c, 0x0804, 0x35b7, 0x0016, 0x0026, 0x0036,
-+ 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014,
-+ 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005, 0x0904,
-+ 0x3cb1, 0x2048, 0x1f04, 0x3c65, 0x7068, 0x2040, 0xa28c, 0xa390,
-+ 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
-+ 0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e, 0x9086,
-+ 0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x001b, 0x080c, 0x4c2b, 0x701f, 0x3c55, 0x00b0,
-+ 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-+ 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c,
-+ 0x0f8b, 0x000e, 0x080c, 0x4c2e, 0x701f, 0x3c55, 0x015e, 0x00de,
- 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
-- 0x0904, 0x35e7, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076,
-- 0x0086, 0x0096, 0x00d6, 0x0156, 0x701f, 0x3cea, 0x7007, 0x0003,
-- 0x0804, 0x3ca8, 0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904,
-- 0x35b7, 0x0076, 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808,
-- 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006,
-- 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8,
-- 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f8b, 0x000e,
-- 0x080c, 0x4c30, 0x007e, 0x701f, 0x3c57, 0x7023, 0x0001, 0x0005,
-- 0x0804, 0x35b5, 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218,
-- 0xa833, 0x001e, 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016,
-- 0x080c, 0x4be4, 0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a,
-- 0x2100, 0x0c58, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e,
-- 0x0005, 0x0006, 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044,
-- 0x00fe, 0x000e, 0x0005, 0x2001, 0x19a0, 0x2003, 0x0001, 0x0005,
-- 0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200, 0x2001, 0x19ab, 0x2004,
-- 0x601a, 0x2061, 0x0100, 0x2001, 0x19aa, 0x2004, 0x60ce, 0x6104,
-- 0xc1ac, 0x6106, 0x080c, 0x4be4, 0xa813, 0x0019, 0xa817, 0x0001,
-- 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f,
-- 0x2004, 0xa86a, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19aa,
-- 0x2004, 0x6036, 0x2009, 0x0040, 0x080c, 0x2409, 0x2001, 0x002a,
-- 0x2004, 0x9084, 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f,
-- 0x0000, 0x78ca, 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe,
-- 0x0005, 0x00e6, 0x080c, 0x4be4, 0x2940, 0xa013, 0x0019, 0xa017,
-- 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001,
-- 0x0031, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-- 0xa86e, 0xa873, 0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001,
-- 0x0300, 0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001,
-- 0x0004, 0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0x81ff, 0x0148, 0x080c, 0x2c59, 0x1130, 0x9006,
-- 0x080c, 0x2bb1, 0x9006, 0x080c, 0x2b94, 0x2001, 0x199f, 0x2003,
-- 0x0000, 0x7884, 0x9084, 0x0007, 0x0002, 0x3dd8, 0x3de1, 0x3dea,
-- 0x3dd5, 0x3dd5, 0x3dd5, 0x3dd5, 0x3dd5, 0x012e, 0x0804, 0x35ea,
-- 0x2009, 0x0114, 0x2104, 0x9085, 0x0800, 0x200a, 0x080c, 0x3fab,
-- 0x00c0, 0x2009, 0x0114, 0x2104, 0x9085, 0x4000, 0x200a, 0x080c,
-- 0x3fab, 0x0078, 0x080c, 0x7637, 0x1128, 0x012e, 0x2009, 0x0016,
-- 0x0804, 0x35e7, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804,
-- 0x35b7, 0x2001, 0x0141, 0x2004, 0xd0dc, 0x0db0, 0x0086, 0x0096,
-- 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3aff,
-- 0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068,
-- 0x2060, 0x2058, 0x080c, 0x427f, 0x080c, 0x41cf, 0x903e, 0x2720,
-- 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x1a69, 0x2079, 0x0090,
-- 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e,
-- 0x68d0, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x4130, 0x080c,
-- 0x2c61, 0x080c, 0x2c61, 0x080c, 0x2c61, 0x080c, 0x2c61, 0x080c,
-- 0x4130, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x4052, 0x2009, 0x9c40,
-- 0x8109, 0x11b0, 0x080c, 0x3f61, 0x2001, 0x0004, 0x200c, 0x918c,
-- 0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
-- 0x00ae, 0x009e, 0x008e, 0x2009, 0x0017, 0x080c, 0x35e7, 0x0cf8,
-- 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079,
-- 0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c,
-- 0x81ff, 0x0150, 0x080c, 0x4030, 0x2d00, 0x9c05, 0x9b05, 0x0120,
-- 0x080c, 0x3f61, 0x0804, 0x3f0e, 0x080c, 0x41a4, 0x080c, 0x40c8,
-- 0x080c, 0x4013, 0x080c, 0x4048, 0x00f6, 0x2079, 0x0100, 0x7824,
-- 0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3f61, 0x00fe, 0x0804, 0x3f0e,
-- 0x00fe, 0x080c, 0x3f57, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602,
-- 0x2001, 0x0033, 0x2502, 0x080c, 0x3f61, 0x0080, 0x87ff, 0x0138,
-- 0x2001, 0x0201, 0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001,
-- 0x1a65, 0x2004, 0x9086, 0x0000, 0x1904, 0x3e5e, 0x2001, 0x032f,
-- 0x2003, 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904,
-- 0x3f0e, 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904,
-- 0x3f0e, 0xa013, 0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884,
-- 0xd0ac, 0x1148, 0x2001, 0x1a65, 0x2003, 0x0003, 0x2001, 0x032a,
-- 0x2003, 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108,
-- 0xa016, 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c, 0x2409, 0x2900,
-- 0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000,
-- 0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001,
-- 0x0203, 0x2004, 0x1f04, 0x3ee5, 0x00ce, 0x0030, 0xa817, 0x0001,
-- 0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100,
-- 0x2061, 0x0090, 0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084,
-- 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6,
-- 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3e18, 0x001e, 0x00c6,
-- 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002,
-- 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c,
-- 0x918c, 0xfffd, 0x2102, 0x080c, 0x12fc, 0x7884, 0x9084, 0x0003,
-- 0x9086, 0x0002, 0x01a0, 0x2009, 0x0028, 0x080c, 0x2409, 0x2001,
-- 0x0227, 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ef, 0x6052, 0x602f,
-- 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010, 0x00ce,
-- 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee,
-- 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x1118, 0x012e,
-- 0x0804, 0x35b5, 0x012e, 0x2021, 0x400c, 0x0804, 0x35b7, 0x9085,
-- 0x0001, 0x1d04, 0x3f60, 0x2091, 0x6000, 0x8420, 0x9486, 0x0064,
-- 0x0005, 0x2001, 0x0105, 0x2003, 0x0010, 0x2001, 0x032a, 0x2003,
-- 0x0004, 0x2001, 0x1a65, 0x2003, 0x0000, 0x0071, 0x2009, 0x0048,
-- 0x080c, 0x2409, 0x2001, 0x0227, 0x2024, 0x2402, 0x2001, 0x0109,
-- 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a69,
-- 0x7000, 0x9086, 0x0000, 0x0520, 0x2079, 0x0090, 0x2009, 0x0206,
-- 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120, 0x2009, 0x0040,
-- 0x080c, 0x2409, 0x782c, 0xd0fc, 0x0d88, 0x080c, 0x41a4, 0x7000,
-- 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8,
-- 0x2009, 0x0040, 0x080c, 0x2409, 0x782b, 0x0002, 0x7003, 0x0000,
-- 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0100, 0x2001, 0x1818,
-- 0x200c, 0x7932, 0x7936, 0x080c, 0x28bc, 0x7850, 0x9084, 0xfbff,
-- 0x9085, 0x0030, 0x7852, 0x2019, 0x01f4, 0x8319, 0x1df0, 0x9084,
-- 0xffcf, 0x9085, 0x2000, 0x7852, 0x20a9, 0x0046, 0x1d04, 0x3fc6,
-- 0x2091, 0x6000, 0x1f04, 0x3fc6, 0x7850, 0x9085, 0x0400, 0x9084,
-- 0xdfff, 0x7852, 0x2001, 0x0021, 0x2004, 0x9084, 0x0003, 0x9086,
-- 0x0001, 0x1120, 0x7850, 0x9084, 0xdfff, 0x7852, 0x784b, 0xf7f7,
-- 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9, 0x0028, 0xa001, 0x1f04,
-- 0x3fe6, 0x7850, 0x9085, 0x1400, 0x7852, 0x2019, 0x61a8, 0x7854,
-- 0xa001, 0xa001, 0xd08c, 0x1110, 0x8319, 0x1dc8, 0x7827, 0x0048,
-- 0x7850, 0x9085, 0x0400, 0x7852, 0x7843, 0x0040, 0x2019, 0x01f4,
-- 0xa001, 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2d39,
-- 0x7827, 0x0020, 0x7843, 0x0000, 0x9006, 0x080c, 0x2d39, 0x7827,
-- 0x0048, 0x00fe, 0x0005, 0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6,
-- 0x2071, 0x1a65, 0x2079, 0x0320, 0x2001, 0x0201, 0x2004, 0x9005,
-- 0x0160, 0x7000, 0x9086, 0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108,
-- 0x8738, 0x7003, 0x0003, 0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005,
-- 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178,
-- 0x2009, 0x0032, 0x260a, 0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108,
-- 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005,
-- 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084, 0x0110, 0x7837, 0x0050,
-- 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100, 0x2001, 0x19ab, 0x2004,
-- 0x70e2, 0x080c, 0x3d39, 0x1188, 0x2001, 0x1820, 0x2004, 0x2009,
-- 0x181f, 0x210c, 0x918c, 0x00ff, 0x706e, 0x716a, 0x7066, 0x918d,
-- 0x3200, 0x7162, 0x7073, 0xe109, 0x0080, 0x702c, 0x9085, 0x0002,
-- 0x702e, 0x2009, 0x1818, 0x210c, 0x716e, 0x7063, 0x0100, 0x7166,
-- 0x719e, 0x706b, 0x0000, 0x7073, 0x0809, 0x7077, 0x0008, 0x7078,
-- 0x9080, 0x0100, 0x707a, 0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa,
-- 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af,
-- 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085, 0x0092, 0x7016, 0x080c,
-- 0x41a4, 0x00f6, 0x2071, 0x1a65, 0x2079, 0x0320, 0x00d6, 0x2069,
-- 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c, 0x780e, 0x6898, 0x780a,
-- 0x00de, 0x080c, 0x3d39, 0x0140, 0x2001, 0x199f, 0x200c, 0x2003,
-- 0x0001, 0x918e, 0x0001, 0x0120, 0x2009, 0x03e8, 0x8109, 0x1df0,
-- 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011, 0x080c,
-- 0x4130, 0x2011, 0x0001, 0x080c, 0x4130, 0x00fe, 0x00ee, 0x0005,
-- 0x00f6, 0x00e6, 0x2071, 0x1a65, 0x2079, 0x0320, 0x792c, 0xd1fc,
-- 0x0904, 0x412d, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904, 0x4129,
-- 0x7000, 0x0002, 0x412d, 0x40de, 0x410e, 0x4129, 0xd1bc, 0x1170,
-- 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c, 0x4130,
-- 0x0904, 0x412d, 0x080c, 0x4130, 0x0804, 0x412d, 0x00f6, 0x2079,
-- 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b, 0x0004,
-- 0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8, 0x080c,
-- 0x4030, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8, 0x00fe,
-- 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001, 0x7002,
-- 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x40d2, 0x2011,
-- 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086, 0x0015,
-- 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc, 0x1960,
-- 0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005,
-- 0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016, 0xa058,
-- 0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c, 0x938a,
-- 0x0007, 0x1a0c, 0x0dc5, 0x9398, 0x415e, 0x231d, 0x083f, 0x9080,
-- 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e, 0x908a,
-- 0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a, 0x2001,
-- 0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x419b, 0x4192,
-- 0x4189, 0x4180, 0x4177, 0x416e, 0x4165, 0xa964, 0x7902, 0xa968,
-- 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974, 0x7902,
-- 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005, 0xa984,
-- 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916, 0x0005,
-- 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0, 0x7916,
-- 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912, 0xa9b0,
-- 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc, 0x7912,
-- 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906, 0xa9cc,
-- 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086, 0x2071,
-- 0x1a69, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b, 0x0002,
-- 0x2940, 0x9026, 0x7000, 0x0002, 0x41cb, 0x41b7, 0x41c2, 0x8001,
-- 0x7002, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x4130, 0x190c,
-- 0x4130, 0x0048, 0x8001, 0x7002, 0x782c, 0xd0fc, 0x1d38, 0x2011,
-- 0x0001, 0x080c, 0x4130, 0x008e, 0x00ee, 0x00fe, 0x0005, 0x00f6,
-- 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x19ab, 0x2004,
-- 0x601a, 0x2061, 0x0100, 0x2001, 0x19aa, 0x2004, 0x60ce, 0x6104,
-- 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520, 0x2038,
-- 0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c, 0x4be4,
-- 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220,
-- 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858,
-- 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x4247, 0x1d68,
-- 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4be4, 0xa813, 0x0019, 0xa817,
-- 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001,
-- 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-- 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090, 0x2079,
-- 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c,
-- 0x2409, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006,
-- 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x9006,
-- 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
-- 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000, 0x2099,
-- 0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a, 0x700e,
-- 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041, 0x702c,
-- 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005, 0x7400,
-- 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086, 0x080c,
-- 0x4be4, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006, 0xa05a,
-- 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6,
-- 0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001, 0x0030,
-- 0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4be4, 0x2940, 0xa813,
-- 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138,
-- 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048,
-- 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x4247, 0x1d68, 0x2900,
-- 0xa85a, 0x00d8, 0x080c, 0x4be4, 0x2940, 0xa013, 0x0019, 0xa017,
-- 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066, 0x2001,
-- 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-- 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a, 0x2003,
-- 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c, 0x918d,
-- 0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a65, 0x2003, 0x0003,
-- 0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003, 0x0000,
-- 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d,
-- 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x20a9,
-- 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004, 0x20a9,
-- 0x0014, 0x20a1, 0xffec, 0x20e9, 0x0000, 0x9006, 0x4004, 0x2009,
-- 0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108, 0x0005,
-- 0x0804, 0x35b5, 0x7d98, 0x7c9c, 0x0804, 0x36b9, 0x080c, 0x7637,
-- 0x190c, 0x60f3, 0x6040, 0x9084, 0x0020, 0x09b1, 0x2069, 0x1847,
-- 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039,
-- 0x0001, 0x080c, 0x4c2d, 0x701f, 0x4326, 0x0005, 0x080c, 0x57e4,
-- 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095, 0x20d8, 0x21d0, 0x2069,
-- 0x1847, 0x6800, 0x9005, 0x0904, 0x35ea, 0x2001, 0x180d, 0x2004,
-- 0xd08c, 0x6804, 0x0118, 0xc0a4, 0xc0ac, 0x6806, 0xd0ac, 0x0118,
-- 0xd0a4, 0x0904, 0x35ea, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104,
-- 0x0138, 0x6200, 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010,
-- 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100,
-- 0x6104, 0x0118, 0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106,
-- 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x35ea,
-- 0x9288, 0x33b6, 0x210d, 0x918c, 0x00ff, 0x6166, 0xd0dc, 0x0130,
-- 0x6828, 0x908a, 0x007f, 0x1a04, 0x35ea, 0x605e, 0x6888, 0x9084,
-- 0x0030, 0x8004, 0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x19b2,
-- 0x9080, 0x29b7, 0x2005, 0x200a, 0x000e, 0x2009, 0x19b3, 0x9080,
-- 0x29bb, 0x2005, 0x200a, 0x6808, 0x908a, 0x0100, 0x0a04, 0x35ea,
-- 0x908a, 0x0841, 0x1a04, 0x35ea, 0x9084, 0x0007, 0x1904, 0x35ea,
-- 0x680c, 0x9005, 0x0904, 0x35ea, 0x6810, 0x9005, 0x0904, 0x35ea,
-- 0x6848, 0x6940, 0x910a, 0x1a04, 0x35ea, 0x8001, 0x0904, 0x35ea,
-- 0x684c, 0x6944, 0x910a, 0x1a04, 0x35ea, 0x8001, 0x0904, 0x35ea,
-- 0x2009, 0x1981, 0x200b, 0x0000, 0x2001, 0x1869, 0x2004, 0xd0c4,
-- 0x0140, 0x7884, 0x200a, 0x2008, 0x080c, 0x0e52, 0x3b00, 0xc085,
-- 0x20d8, 0x6814, 0x908c, 0x00ff, 0x614e, 0x8007, 0x9084, 0x00ff,
-- 0x6052, 0x080c, 0x7963, 0x080c, 0x6b8e, 0x080c, 0x6bf8, 0x6808,
-- 0x602a, 0x080c, 0x237b, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001,
-- 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08, 0x080c, 0x2916, 0x003e,
-- 0x6000, 0x9086, 0x0000, 0x1904, 0x44cf, 0x6818, 0x691c, 0x6a20,
-- 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e,
-- 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c,
-- 0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006,
-- 0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9,
-- 0x0004, 0x20a1, 0x19b4, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004,
-- 0x20a1, 0x19ce, 0x20e9, 0x0001, 0x4001, 0x080c, 0x8962, 0x00c6,
-- 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384, 0x0510, 0x0068, 0x2009,
-- 0x0100, 0x210c, 0x918e, 0x0008, 0x1110, 0x839d, 0x0010, 0x83f5,
-- 0x3e18, 0x12b0, 0x3508, 0x8109, 0x080c, 0x7f6f, 0x6878, 0x6016,
-- 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff,
-- 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001,
-- 0x1f04, 0x441f, 0x00ce, 0x00c6, 0x2061, 0x199c, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x11a8, 0x6a88, 0x9284, 0xc000, 0x2010, 0x9286,
-- 0x0000, 0x1158, 0x2063, 0x0000, 0x2001, 0x0001, 0x080c, 0x2bb1,
-- 0x2001, 0x0001, 0x080c, 0x2b94, 0x0088, 0x9286, 0x4000, 0x1148,
-- 0x2063, 0x0001, 0x9006, 0x080c, 0x2bb1, 0x9006, 0x080c, 0x2b94,
-- 0x0028, 0x9286, 0x8000, 0x1d30, 0x2063, 0x0002, 0x00ce, 0x00e6,
-- 0x2c70, 0x080c, 0x0ea3, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011,
-- 0x0114, 0x2204, 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284, 0x0030,
-- 0x9086, 0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82,
-- 0x2001, 0x197c, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170,
-- 0x928e, 0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa,
-- 0x080c, 0x298b, 0x2001, 0x196d, 0x2102, 0x0008, 0x2102, 0x00c6,
-- 0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c,
-- 0x7637, 0x0128, 0x080c, 0x50cb, 0x0110, 0x080c, 0x28dc, 0x60d4,
-- 0x9005, 0x01c0, 0x6003, 0x0001, 0x2009, 0x44b7, 0x00e0, 0x080c,
-- 0x7637, 0x1168, 0x2011, 0x74b2, 0x080c, 0x883d, 0x2011, 0x74a5,
-- 0x080c, 0x8917, 0x080c, 0x7937, 0x080c, 0x7563, 0x0040, 0x080c,
-- 0x5fed, 0x0028, 0x6003, 0x0004, 0x2009, 0x44cf, 0x0020, 0x080c,
-- 0x6a05, 0x0804, 0x35b5, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff,
-- 0x9086, 0x004c, 0x1118, 0x2091, 0x30bd, 0x0817, 0x2091, 0x303d,
-- 0x0817, 0x6000, 0x9086, 0x0000, 0x0904, 0x35e7, 0x2069, 0x1847,
-- 0x7890, 0x6842, 0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0804, 0x4c30, 0x9006,
-- 0x080c, 0x28dc, 0x81ff, 0x1904, 0x35e7, 0x080c, 0x7637, 0x11b0,
-- 0x080c, 0x7932, 0x080c, 0x612e, 0x080c, 0x33aa, 0x0118, 0x6130,
-- 0xc18d, 0x6132, 0x080c, 0xd7e3, 0x0130, 0x080c, 0x765a, 0x1118,
-- 0x080c, 0x760f, 0x0038, 0x080c, 0x7563, 0x0020, 0x080c, 0x60f3,
-- 0x080c, 0x5fed, 0x0804, 0x35b5, 0x81ff, 0x1904, 0x35e7, 0x080c,
-- 0x7637, 0x1110, 0x0804, 0x35e7, 0x0126, 0x2091, 0x8000, 0x6194,
-- 0x81ff, 0x0190, 0x704f, 0x0000, 0x2001, 0x1c80, 0x2009, 0x0040,
-- 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4c30,
-- 0x701f, 0x35b3, 0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069,
-- 0x1c80, 0x20a9, 0x0040, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x2019,
-- 0xffff, 0x4304, 0x655c, 0x9588, 0x33b6, 0x210d, 0x918c, 0x00ff,
-- 0x216a, 0x900e, 0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c,
-- 0x6724, 0x1190, 0xb814, 0x821c, 0x0238, 0x9398, 0x1c80, 0x9085,
-- 0xff00, 0x8007, 0x201a, 0x0038, 0x9398, 0x1c80, 0x2324, 0x94a4,
-- 0xff00, 0x9405, 0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208,
-- 0x0c18, 0x8201, 0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9,
-- 0x0040, 0x20a1, 0x1c80, 0x2099, 0x1c80, 0x080c, 0x607e, 0x0804,
-- 0x452c, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x080c, 0x4be4, 0x1120,
-- 0x2009, 0x0002, 0x0804, 0x35e7, 0x080c, 0x57d5, 0xd0b4, 0x0558,
-- 0x7884, 0x908e, 0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e,
-- 0x0080, 0x0508, 0x080c, 0x33a5, 0x1148, 0xb800, 0xd08c, 0x11d8,
-- 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000,
-- 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd2a3, 0x1120, 0x2009, 0x0003,
-- 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x45b7, 0x0005, 0x080c,
-- 0x4c17, 0x0904, 0x35ea, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8,
-- 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
-- 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8,
-- 0x9080, 0x0006, 0x2098, 0x080c, 0x0f8b, 0x0070, 0x20a9, 0x0004,
-- 0xa85c, 0x9080, 0x000a, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-- 0x000a, 0x2098, 0x080c, 0x0f8b, 0x8906, 0x8006, 0x8007, 0x90bc,
-- 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4c30, 0x81ff, 0x1904, 0x35e7,
-- 0x080c, 0x4bfb, 0x0904, 0x35ea, 0x080c, 0x6896, 0x0904, 0x35e7,
-- 0x0058, 0xa878, 0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x35e7,
-- 0xa974, 0xaa94, 0x0804, 0x35b5, 0x080c, 0x57dd, 0x0904, 0x35b5,
-- 0x701f, 0x4601, 0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x35e7,
-- 0x7888, 0x908a, 0x1000, 0x1a04, 0x35ea, 0x080c, 0x4c17, 0x0904,
-- 0x35ea, 0x080c, 0x6aa3, 0x0120, 0x080c, 0x6aab, 0x1904, 0x35ea,
-- 0x080c, 0x691b, 0x0904, 0x35e7, 0x2019, 0x0004, 0x900e, 0x080c,
-- 0x68a8, 0x0904, 0x35e7, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c,
-- 0x908a, 0x1000, 0x12f8, 0x080c, 0x4c15, 0x01e0, 0x080c, 0x6aa3,
-- 0x0118, 0x080c, 0x6aab, 0x11b0, 0x080c, 0x691b, 0x2009, 0x0002,
-- 0x0168, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x68a8, 0x2009,
-- 0x0003, 0x0120, 0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005,
-- 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-- 0x0030, 0x0005, 0xa897, 0x4000, 0x080c, 0x57dd, 0x0110, 0x9006,
-- 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186,
-- 0x00ff, 0x0110, 0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800,
-- 0x645c, 0x2400, 0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8,
-- 0x0005, 0x080c, 0x6724, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b,
-- 0x9108, 0x080c, 0x884b, 0x0005, 0x81ff, 0x1904, 0x35e7, 0x798c,
-- 0x2001, 0x1980, 0x918c, 0x8000, 0x2102, 0x080c, 0x4bfb, 0x0904,
-- 0x35ea, 0x080c, 0x6aa3, 0x0120, 0x080c, 0x6aab, 0x1904, 0x35ea,
-- 0x080c, 0x67eb, 0x0904, 0x35e7, 0x080c, 0x689f, 0x0904, 0x35e7,
-- 0x2001, 0x1980, 0x2004, 0xd0fc, 0x1904, 0x35b5, 0x0804, 0x460c,
-- 0xa9a0, 0x2001, 0x1980, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
-- 0x4c08, 0x01a0, 0x080c, 0x6aa3, 0x0118, 0x080c, 0x6aab, 0x1170,
-- 0x080c, 0x67eb, 0x2009, 0x0002, 0x0128, 0x080c, 0x689f, 0x1170,
-- 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-- 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-- 0x2001, 0x1980, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x57dd, 0x0110,
-- 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
-- 0x81ff, 0x1904, 0x35e7, 0x798c, 0x2001, 0x197f, 0x918c, 0x8000,
-- 0x2102, 0x080c, 0x4bfb, 0x0904, 0x35ea, 0x080c, 0x6aa3, 0x0120,
-- 0x080c, 0x6aab, 0x1904, 0x35ea, 0x080c, 0x67eb, 0x0904, 0x35e7,
-- 0x080c, 0x688d, 0x0904, 0x35e7, 0x2001, 0x197f, 0x2004, 0xd0fc,
-- 0x1904, 0x35b5, 0x0804, 0x460c, 0xa9a0, 0x2001, 0x197f, 0x918c,
-- 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c08, 0x01a0, 0x080c, 0x6aa3,
-- 0x0118, 0x080c, 0x6aab, 0x1170, 0x080c, 0x67eb, 0x2009, 0x0002,
-- 0x0128, 0x080c, 0x688d, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005,
-- 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-- 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197f, 0x2004, 0xd0fc,
-- 0x1128, 0x080c, 0x57dd, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
-- 0x0001, 0x2001, 0x0000, 0x0005, 0x6100, 0x0804, 0x35b5, 0x080c,
-- 0x4c17, 0x0904, 0x35ea, 0x080c, 0x57e9, 0x1904, 0x35e7, 0x79a8,
-- 0xd184, 0x1158, 0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a,
-- 0xbb2c, 0x831f, 0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e,
-- 0xb820, 0x8007, 0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900,
-- 0x918c, 0x0202, 0x0804, 0x35b5, 0x78a8, 0x909c, 0x0003, 0xd0ac,
-- 0x1158, 0xd0b4, 0x1148, 0x939a, 0x0003, 0x1a04, 0x35e7, 0x625c,
-- 0x7884, 0x9206, 0x1904, 0x47c7, 0x080c, 0x894c, 0x2001, 0xffec,
-- 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0000,
-- 0x0006, 0x78a8, 0x9084, 0x0080, 0x1528, 0x0006, 0x0036, 0x2001,
-- 0x1a83, 0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a84, 0x201c,
-- 0x7b9e, 0x2003, 0x0000, 0x2001, 0x1a85, 0x201c, 0x7bae, 0x2003,
-- 0x0000, 0x2001, 0x1a7f, 0x201c, 0x7baa, 0x2003, 0x0000, 0x2001,
-- 0x1a86, 0x201c, 0x7bb2, 0x2003, 0x0000, 0x003e, 0x000e, 0x000e,
-- 0x0804, 0x4c30, 0x000e, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44,
-- 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a,
-- 0x080c, 0x10f8, 0x7007, 0x0002, 0x701f, 0x47e7, 0x0005, 0x81ff,
-- 0x1904, 0x35e7, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x080c, 0x6aa3,
-- 0x1904, 0x35e7, 0x00c6, 0x080c, 0x4be4, 0x00ce, 0x0904, 0x35e7,
-- 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8, 0x080c, 0xd249,
-- 0x0904, 0x35e7, 0x7007, 0x0003, 0x701f, 0x480d, 0x0005, 0x080c,
-- 0x42ec, 0x0006, 0x0036, 0x2001, 0x1a83, 0x201c, 0x7b9a, 0x2003,
-- 0x0000, 0x2001, 0x1a84, 0x201c, 0x7b9e, 0x2003, 0x0000, 0x2001,
-- 0x1a85, 0x201c, 0x7bae, 0x2003, 0x0000, 0x2001, 0x1a7f, 0x201c,
-- 0x7baa, 0x2003, 0x0000, 0x2001, 0x1a86, 0x201c, 0x7bb2, 0x2003,
-- 0x0000, 0x003e, 0x000e, 0x0804, 0x35b5, 0xa830, 0x9086, 0x0100,
-- 0x0904, 0x35e7, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-- 0xffc0, 0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c,
-- 0x7d98, 0x0804, 0x4c30, 0x9006, 0x080c, 0x28dc, 0x78a8, 0x9084,
-- 0x00ff, 0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x35e7, 0x080c,
-- 0x7637, 0x0110, 0x080c, 0x60f3, 0x7888, 0x908a, 0x1000, 0x1a04,
-- 0x35ea, 0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04,
-- 0x35ea, 0x2100, 0x080c, 0x28a6, 0x0026, 0x00c6, 0x0126, 0x2091,
-- 0x8000, 0x2061, 0x19fb, 0x601b, 0x0000, 0x601f, 0x0000, 0x607b,
-- 0x0000, 0x607f, 0x0000, 0x080c, 0x7637, 0x1158, 0x080c, 0x7932,
-- 0x080c, 0x612e, 0x9085, 0x0001, 0x080c, 0x767b, 0x080c, 0x7563,
-- 0x00d0, 0x080c, 0xb244, 0x2061, 0x0100, 0x2001, 0x1818, 0x2004,
-- 0x9084, 0x00ff, 0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043,
-- 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011,
-- 0x6019, 0x080c, 0x88d5, 0x7984, 0x080c, 0x7637, 0x1110, 0x2009,
-- 0x00ff, 0x7a88, 0x080c, 0x466f, 0x012e, 0x00ce, 0x002e, 0x0804,
-- 0x35b5, 0x7984, 0x080c, 0x66b9, 0x2b08, 0x1904, 0x35ea, 0x0804,
-- 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7, 0x60dc,
-- 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x35e7,
-- 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x7984,
-- 0x81ff, 0x0904, 0x35ea, 0x9192, 0x0021, 0x1a04, 0x35ea, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0x702a, 0xaf60,
-- 0x7736, 0x080c, 0x4c2d, 0x701f, 0x48c4, 0x7880, 0x9086, 0x006e,
-- 0x0110, 0x701f, 0x527d, 0x0005, 0x2009, 0x0080, 0x080c, 0x6724,
-- 0x1118, 0x080c, 0x6aa3, 0x0120, 0x2021, 0x400a, 0x0804, 0x35b7,
-- 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70, 0xac74, 0xad78, 0xae7c,
-- 0xa884, 0x90be, 0x0100, 0x0904, 0x495d, 0x90be, 0x0112, 0x0904,
-- 0x495d, 0x90be, 0x0113, 0x0904, 0x495d, 0x90be, 0x0114, 0x0904,
-- 0x495d, 0x90be, 0x0117, 0x0904, 0x495d, 0x90be, 0x011a, 0x0904,
-- 0x495d, 0x90be, 0x011c, 0x0904, 0x495d, 0x90be, 0x0121, 0x0904,
-- 0x4944, 0x90be, 0x0131, 0x0904, 0x4944, 0x90be, 0x0171, 0x0904,
-- 0x495d, 0x90be, 0x0173, 0x0904, 0x495d, 0x90be, 0x01a1, 0x1128,
-- 0xa894, 0x8007, 0xa896, 0x0804, 0x4968, 0x90be, 0x0212, 0x0904,
-- 0x4951, 0x90be, 0x0213, 0x05e8, 0x90be, 0x0214, 0x0500, 0x90be,
-- 0x0217, 0x0188, 0x90be, 0x021a, 0x1120, 0xa89c, 0x8007, 0xa89e,
-- 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be, 0x0300, 0x05b0, 0x009e,
-- 0x00de, 0x0804, 0x35ea, 0x7028, 0x9080, 0x0010, 0x2098, 0x20a0,
-- 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007, 0x080c, 0x49a6, 0x7028,
-+ 0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118, 0x701f,
-+ 0x3d16, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009,
-+ 0x007f, 0x080c, 0x66b2, 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff,
-+ 0xb817, 0xfffd, 0x080c, 0xd5a0, 0x015e, 0x00de, 0x009e, 0x008e,
-+ 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904, 0x35e7,
-+ 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096,
-+ 0x00d6, 0x0156, 0x701f, 0x3ce8, 0x7007, 0x0003, 0x0804, 0x3ca6,
-+ 0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x35b7, 0x0076,
-+ 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120,
-+ 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc,
-+ 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098,
-+ 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f8b, 0x000e, 0x080c, 0x4c2e,
-+ 0x007e, 0x701f, 0x3c55, 0x7023, 0x0001, 0x0005, 0x0804, 0x35b5,
-+ 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833, 0x001e,
-+ 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c, 0x4be2,
-+ 0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58,
-+ 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006,
-+ 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e,
-+ 0x0005, 0x2001, 0x19a0, 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6,
-+ 0x00c6, 0x2061, 0x0200, 0x2001, 0x19ab, 0x2004, 0x601a, 0x2061,
-+ 0x0100, 0x2001, 0x19aa, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106,
-+ 0x080c, 0x4be2, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a,
-+ 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a,
-+ 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036,
-+ 0x2009, 0x0040, 0x080c, 0x2409, 0x2001, 0x002a, 0x2004, 0x9084,
-+ 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca,
-+ 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
-+ 0x080c, 0x4be2, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800,
-+ 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031, 0x2004,
-+ 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873,
-+ 0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300, 0x2003,
-+ 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c,
-+ 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x81ff, 0x0148, 0x080c, 0x2c59, 0x1130, 0x9006, 0x080c, 0x2bb1,
-+ 0x9006, 0x080c, 0x2b94, 0x2001, 0x199f, 0x2003, 0x0000, 0x7884,
-+ 0x9084, 0x0007, 0x0002, 0x3dd6, 0x3ddf, 0x3de8, 0x3dd3, 0x3dd3,
-+ 0x3dd3, 0x3dd3, 0x3dd3, 0x012e, 0x0804, 0x35ea, 0x2009, 0x0114,
-+ 0x2104, 0x9085, 0x0800, 0x200a, 0x080c, 0x3fa9, 0x00c0, 0x2009,
-+ 0x0114, 0x2104, 0x9085, 0x4000, 0x200a, 0x080c, 0x3fa9, 0x0078,
-+ 0x080c, 0x7630, 0x1128, 0x012e, 0x2009, 0x0016, 0x0804, 0x35e7,
-+ 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x35b7, 0x2001,
-+ 0x0141, 0x2004, 0xd0dc, 0x0db0, 0x0086, 0x0096, 0x00a6, 0x00b6,
-+ 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3afd, 0x2009, 0x0101,
-+ 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060, 0x2058,
-+ 0x080c, 0x427d, 0x080c, 0x41cd, 0x903e, 0x2720, 0x00f6, 0x00e6,
-+ 0x0086, 0x2940, 0x2071, 0x1a69, 0x2079, 0x0090, 0x00d6, 0x2069,
-+ 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0, 0x780a,
-+ 0x00de, 0x2011, 0x0001, 0x080c, 0x412e, 0x080c, 0x2c61, 0x080c,
-+ 0x2c61, 0x080c, 0x2c61, 0x080c, 0x2c61, 0x080c, 0x412e, 0x008e,
-+ 0x00ee, 0x00fe, 0x080c, 0x4050, 0x2009, 0x9c40, 0x8109, 0x11b0,
-+ 0x080c, 0x3f5f, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102,
-+ 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-+ 0x008e, 0x2009, 0x0017, 0x080c, 0x35e7, 0x0cf8, 0x2001, 0x020b,
-+ 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000, 0x7884,
-+ 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0150,
-+ 0x080c, 0x402e, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c, 0x3f5f,
-+ 0x0804, 0x3f0c, 0x080c, 0x41a2, 0x080c, 0x40c6, 0x080c, 0x4011,
-+ 0x080c, 0x4046, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac, 0x0130,
-+ 0x8b58, 0x080c, 0x3f5f, 0x00fe, 0x0804, 0x3f0c, 0x00fe, 0x080c,
-+ 0x3f55, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001, 0x0033,
-+ 0x2502, 0x080c, 0x3f5f, 0x0080, 0x87ff, 0x0138, 0x2001, 0x0201,
-+ 0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a65, 0x2004,
-+ 0x9086, 0x0000, 0x1904, 0x3e5c, 0x2001, 0x032f, 0x2003, 0x00f6,
-+ 0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3f0c, 0x7884,
-+ 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3f0c, 0xa013,
-+ 0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1148,
-+ 0x2001, 0x1a65, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009,
-+ 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016, 0x2800,
-+ 0xa05a, 0x2009, 0x0040, 0x080c, 0x2409, 0x2900, 0xa85a, 0xa813,
-+ 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6, 0x20a9,
-+ 0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203, 0x2004,
-+ 0x1f04, 0x3ee3, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0, 0x9005,
-+ 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061, 0x0090,
-+ 0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a,
-+ 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca,
-+ 0x00ce, 0x00fe, 0x0804, 0x3e16, 0x001e, 0x00c6, 0x2001, 0x032a,
-+ 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106, 0x2011,
-+ 0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd,
-+ 0x2102, 0x080c, 0x12fc, 0x7884, 0x9084, 0x0003, 0x9086, 0x0002,
-+ 0x01a0, 0x2009, 0x0028, 0x080c, 0x2409, 0x2001, 0x0227, 0x200c,
-+ 0x2102, 0x6050, 0x9084, 0xb7ef, 0x6052, 0x602f, 0x0000, 0x604b,
-+ 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010, 0x00ce, 0x2d08, 0x2c10,
-+ 0x2b18, 0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x00be, 0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x35b5,
-+ 0x012e, 0x2021, 0x400c, 0x0804, 0x35b7, 0x9085, 0x0001, 0x1d04,
-+ 0x3f5e, 0x2091, 0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001,
-+ 0x0105, 0x2003, 0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001,
-+ 0x1a65, 0x2003, 0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x2409,
-+ 0x2001, 0x0227, 0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000,
-+ 0x9026, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a69, 0x7000, 0x9086,
-+ 0x0000, 0x0520, 0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009,
-+ 0x0203, 0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x2409,
-+ 0x782c, 0xd0fc, 0x0d88, 0x080c, 0x41a2, 0x7000, 0x9086, 0x0000,
-+ 0x1d58, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040,
-+ 0x080c, 0x2409, 0x782b, 0x0002, 0x7003, 0x0000, 0x00ee, 0x00fe,
-+ 0x0005, 0x00f6, 0x2079, 0x0100, 0x2001, 0x1818, 0x200c, 0x7932,
-+ 0x7936, 0x080c, 0x28bc, 0x7850, 0x9084, 0xfbff, 0x9085, 0x0030,
-+ 0x7852, 0x2019, 0x01f4, 0x8319, 0x1df0, 0x9084, 0xffcf, 0x9085,
-+ 0x2000, 0x7852, 0x20a9, 0x0046, 0x1d04, 0x3fc4, 0x2091, 0x6000,
-+ 0x1f04, 0x3fc4, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfff, 0x7852,
-+ 0x2001, 0x0021, 0x2004, 0x9084, 0x0003, 0x9086, 0x0001, 0x1120,
-+ 0x7850, 0x9084, 0xdfff, 0x7852, 0x784b, 0xf7f7, 0x7843, 0x0090,
-+ 0x7843, 0x0010, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x3fe4, 0x7850,
-+ 0x9085, 0x1400, 0x7852, 0x2019, 0x61a8, 0x7854, 0xa001, 0xa001,
-+ 0xd08c, 0x1110, 0x8319, 0x1dc8, 0x7827, 0x0048, 0x7850, 0x9085,
-+ 0x0400, 0x7852, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001, 0xa001,
-+ 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2d39, 0x7827, 0x0020,
-+ 0x7843, 0x0000, 0x9006, 0x080c, 0x2d39, 0x7827, 0x0048, 0x00fe,
-+ 0x0005, 0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a65,
-+ 0x2079, 0x0320, 0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000,
-+ 0x9086, 0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003,
-+ 0x0003, 0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
-+ 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032,
-+ 0x260a, 0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac,
-+ 0x0108, 0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079,
-+ 0x0200, 0x781c, 0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005,
-+ 0x00e6, 0x2071, 0x0100, 0x2001, 0x19ab, 0x2004, 0x70e2, 0x080c,
-+ 0x3d37, 0x1188, 0x2001, 0x1820, 0x2004, 0x2009, 0x181f, 0x210c,
-+ 0x918c, 0x00ff, 0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162,
-+ 0x7073, 0xe109, 0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009,
-+ 0x1818, 0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b,
-+ 0x0000, 0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100,
-+ 0x707a, 0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a,
-+ 0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014,
-+ 0x9084, 0x1984, 0x9085, 0x0092, 0x7016, 0x080c, 0x41a2, 0x00f6,
-+ 0x2071, 0x1a65, 0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884,
-+ 0xd0b4, 0x0120, 0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x080c,
-+ 0x3d37, 0x0140, 0x2001, 0x199f, 0x200c, 0x2003, 0x0001, 0x918e,
-+ 0x0001, 0x0120, 0x2009, 0x03e8, 0x8109, 0x1df0, 0x792c, 0xd1fc,
-+ 0x0110, 0x782b, 0x0004, 0x2011, 0x0011, 0x080c, 0x412e, 0x2011,
-+ 0x0001, 0x080c, 0x412e, 0x00fe, 0x00ee, 0x0005, 0x00f6, 0x00e6,
-+ 0x2071, 0x1a65, 0x2079, 0x0320, 0x792c, 0xd1fc, 0x0904, 0x412b,
-+ 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904, 0x4127, 0x7000, 0x0002,
-+ 0x412b, 0x40dc, 0x410c, 0x4127, 0xd1bc, 0x1170, 0xd1dc, 0x1190,
-+ 0x8001, 0x7002, 0x2011, 0x0001, 0x080c, 0x412e, 0x0904, 0x412b,
-+ 0x080c, 0x412e, 0x0804, 0x412b, 0x00f6, 0x2079, 0x0300, 0x78bf,
-+ 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b, 0x0004, 0x7812, 0x7916,
-+ 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8, 0x080c, 0x402e, 0x2009,
-+ 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8, 0x00fe, 0xd0ec, 0x0110,
-+ 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001, 0x7002, 0x9184, 0x0880,
-+ 0x1140, 0x782c, 0xd0fc, 0x1904, 0x40d0, 0x2011, 0x0001, 0x00b1,
-+ 0x0090, 0xa010, 0x9092, 0x0004, 0x9086, 0x0015, 0x1120, 0xa000,
-+ 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc, 0x1960, 0x0828, 0x782b,
-+ 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005, 0xa014, 0x9005,
-+ 0x0550, 0x8001, 0x0036, 0x0096, 0xa016, 0xa058, 0x2048, 0xa010,
-+ 0x2009, 0x0031, 0x911a, 0x831c, 0x831c, 0x938a, 0x0007, 0x1a0c,
-+ 0x0dc5, 0x9398, 0x415c, 0x231d, 0x083f, 0x9080, 0x0004, 0x7a2a,
-+ 0x7100, 0x8108, 0x7102, 0x009e, 0x003e, 0x908a, 0x0035, 0x1140,
-+ 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a, 0x2001, 0x0019, 0x009e,
-+ 0xa012, 0x9085, 0x0001, 0x0005, 0x4199, 0x4190, 0x4187, 0x417e,
-+ 0x4175, 0x416c, 0x4163, 0xa964, 0x7902, 0xa968, 0x7906, 0xa96c,
-+ 0x7912, 0xa970, 0x7916, 0x0005, 0xa974, 0x7902, 0xa978, 0x7906,
-+ 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005, 0xa984, 0x7902, 0xa988,
-+ 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916, 0x0005, 0xa994, 0x7902,
-+ 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0, 0x7916, 0x0005, 0xa9a4,
-+ 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912, 0xa9b0, 0x7916, 0x0005,
-+ 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc, 0x7912, 0xa9c0, 0x7916,
-+ 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906, 0xa9cc, 0x7912, 0xa9d0,
-+ 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086, 0x2071, 0x1a69, 0x2079,
-+ 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b, 0x0002, 0x2940, 0x9026,
-+ 0x7000, 0x0002, 0x41c9, 0x41b5, 0x41c0, 0x8001, 0x7002, 0xd19c,
-+ 0x1180, 0x2011, 0x0001, 0x080c, 0x412e, 0x190c, 0x412e, 0x0048,
-+ 0x8001, 0x7002, 0x782c, 0xd0fc, 0x1d38, 0x2011, 0x0001, 0x080c,
-+ 0x412e, 0x008e, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00c6,
-+ 0x0086, 0x2061, 0x0200, 0x2001, 0x19ab, 0x2004, 0x601a, 0x2061,
-+ 0x0100, 0x2001, 0x19aa, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106,
-+ 0x2001, 0x002c, 0x2004, 0x9005, 0x0520, 0x2038, 0x2001, 0x002e,
-+ 0x2024, 0x2001, 0x002f, 0x201c, 0x080c, 0x4be2, 0xa813, 0x0019,
-+ 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138, 0x2009,
-+ 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048, 0xa85c,
-+ 0x9080, 0x0019, 0x009e, 0x080c, 0x4245, 0x1d68, 0x2900, 0xa85a,
-+ 0x00d0, 0x080c, 0x4be2, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900,
-+ 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004,
-+ 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0x2001,
-+ 0x002b, 0x2004, 0xa872, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001,
-+ 0x19aa, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c, 0x2409, 0x2001,
-+ 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b,
-+ 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x9006, 0x600a, 0x600e,
-+ 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0080,
-+ 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000, 0x2099, 0x0088, 0x702b,
-+ 0x0026, 0x7402, 0x7306, 0x9006, 0x700a, 0x700e, 0x810b, 0x810b,
-+ 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041, 0x702c, 0xd0fc, 0x0de8,
-+ 0x702b, 0x0002, 0x702b, 0x0040, 0x4005, 0x7400, 0x7304, 0x87ff,
-+ 0x0190, 0x0086, 0x0096, 0x2940, 0x0086, 0x080c, 0x4be2, 0x008e,
-+ 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006, 0xa05a, 0x00ae, 0x009e,
-+ 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x2001, 0x002d,
-+ 0x2004, 0x9005, 0x0528, 0x2038, 0x2001, 0x0030, 0x2024, 0x2001,
-+ 0x0031, 0x201c, 0x080c, 0x4be2, 0x2940, 0xa813, 0x0019, 0xaf16,
-+ 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138, 0x2009, 0x0007,
-+ 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048, 0xa85c, 0x9080,
-+ 0x0019, 0x009e, 0x080c, 0x4245, 0x1d68, 0x2900, 0xa85a, 0x00d8,
-+ 0x080c, 0x4be2, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800,
-+ 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066, 0x2001, 0x0031, 0x2004,
-+ 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa06e, 0x2001,
-+ 0x002b, 0x2004, 0xa072, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884,
-+ 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c, 0x918d, 0x0200, 0x2102,
-+ 0xa017, 0x0000, 0x2001, 0x1a65, 0x2003, 0x0003, 0x2001, 0x032a,
-+ 0x2003, 0x0009, 0x2001, 0x0300, 0x2003, 0x0000, 0x2001, 0x020d,
-+ 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d, 0x0002, 0x2102,
-+ 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0007, 0x20a1,
-+ 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004, 0x20a9, 0x0014, 0x20a1,
-+ 0xffec, 0x20e9, 0x0000, 0x9006, 0x4004, 0x2009, 0x013c, 0x200a,
-+ 0x012e, 0x7880, 0x9086, 0x0052, 0x0108, 0x0005, 0x0804, 0x35b5,
-+ 0x7d98, 0x7c9c, 0x0804, 0x36b9, 0x080c, 0x7630, 0x190c, 0x60ec,
-+ 0x6040, 0x9084, 0x0020, 0x09b1, 0x2069, 0x1847, 0x2d00, 0x2009,
-+ 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c,
-+ 0x4c2b, 0x701f, 0x4324, 0x0005, 0x080c, 0x57e2, 0x1130, 0x3b00,
-+ 0x3a08, 0xc194, 0xc095, 0x20d8, 0x21d0, 0x2069, 0x1847, 0x6800,
-+ 0x9005, 0x0904, 0x35ea, 0x2001, 0x180d, 0x2004, 0xd08c, 0x6804,
-+ 0x0118, 0xc0a4, 0xc0ac, 0x6806, 0xd0ac, 0x0118, 0xd0a4, 0x0904,
-+ 0x35ea, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0138, 0x6200,
-+ 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010, 0x918d, 0x0020,
-+ 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0118,
-+ 0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106, 0x00ce, 0xd084,
-+ 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x35ea, 0x9288, 0x33b6,
-+ 0x210d, 0x918c, 0x00ff, 0x6166, 0xd0dc, 0x0130, 0x6828, 0x908a,
-+ 0x007f, 0x1a04, 0x35ea, 0x605e, 0x6888, 0x9084, 0x0030, 0x8004,
-+ 0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x19b2, 0x9080, 0x29b7,
-+ 0x2005, 0x200a, 0x000e, 0x2009, 0x19b3, 0x9080, 0x29bb, 0x2005,
-+ 0x200a, 0x6808, 0x908a, 0x0100, 0x0a04, 0x35ea, 0x908a, 0x0841,
-+ 0x1a04, 0x35ea, 0x9084, 0x0007, 0x1904, 0x35ea, 0x680c, 0x9005,
-+ 0x0904, 0x35ea, 0x6810, 0x9005, 0x0904, 0x35ea, 0x6848, 0x6940,
-+ 0x910a, 0x1a04, 0x35ea, 0x8001, 0x0904, 0x35ea, 0x684c, 0x6944,
-+ 0x910a, 0x1a04, 0x35ea, 0x8001, 0x0904, 0x35ea, 0x2009, 0x1981,
-+ 0x200b, 0x0000, 0x2001, 0x1869, 0x2004, 0xd0c4, 0x0140, 0x7884,
-+ 0x200a, 0x2008, 0x080c, 0x0e52, 0x3b00, 0xc085, 0x20d8, 0x6814,
-+ 0x908c, 0x00ff, 0x614e, 0x8007, 0x9084, 0x00ff, 0x6052, 0x080c,
-+ 0x795c, 0x080c, 0x6b87, 0x080c, 0x6bf1, 0x6808, 0x602a, 0x080c,
-+ 0x237b, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001, 0xa001, 0x200b,
-+ 0x0000, 0x0036, 0x6b08, 0x080c, 0x2916, 0x003e, 0x6000, 0x9086,
-+ 0x0000, 0x1904, 0x44cd, 0x6818, 0x691c, 0x6a20, 0x6b24, 0x8007,
-+ 0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e, 0x6322, 0x6c04,
-+ 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c, 0x8007, 0x810f,
-+ 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006, 0x610a, 0x620e,
-+ 0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9, 0x0004, 0x20a1,
-+ 0x19b4, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004, 0x20a1, 0x19ce,
-+ 0x20e9, 0x0001, 0x4001, 0x080c, 0x895b, 0x00c6, 0x900e, 0x20a9,
-+ 0x0001, 0x6b70, 0xd384, 0x0510, 0x0068, 0x2009, 0x0100, 0x210c,
-+ 0x918e, 0x0008, 0x1110, 0x839d, 0x0010, 0x83f5, 0x3e18, 0x12b0,
-+ 0x3508, 0x8109, 0x080c, 0x7f68, 0x6878, 0x6016, 0x6874, 0x2008,
-+ 0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff, 0x6006, 0x8108,
-+ 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x1f04, 0x441d,
-+ 0x00ce, 0x00c6, 0x2061, 0x199c, 0x2001, 0x180d, 0x2004, 0xd08c,
-+ 0x11a8, 0x6a88, 0x9284, 0xc000, 0x2010, 0x9286, 0x0000, 0x1158,
-+ 0x2063, 0x0000, 0x2001, 0x0001, 0x080c, 0x2bb1, 0x2001, 0x0001,
-+ 0x080c, 0x2b94, 0x0088, 0x9286, 0x4000, 0x1148, 0x2063, 0x0001,
-+ 0x9006, 0x080c, 0x2bb1, 0x9006, 0x080c, 0x2b94, 0x0028, 0x9286,
-+ 0x8000, 0x1d30, 0x2063, 0x0002, 0x00ce, 0x00e6, 0x2c70, 0x080c,
-+ 0x0ea3, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114, 0x2204,
-+ 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086, 0x0030,
-+ 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001, 0x197c,
-+ 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170, 0x928e, 0x0010,
-+ 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c, 0x298b,
-+ 0x2001, 0x196d, 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061, 0x0100,
-+ 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c, 0x7630, 0x0128,
-+ 0x080c, 0x50c9, 0x0110, 0x080c, 0x28dc, 0x60d4, 0x9005, 0x01c0,
-+ 0x6003, 0x0001, 0x2009, 0x44b5, 0x00e0, 0x080c, 0x7630, 0x1168,
-+ 0x2011, 0x74ab, 0x080c, 0x8836, 0x2011, 0x749e, 0x080c, 0x8910,
-+ 0x080c, 0x7930, 0x080c, 0x755c, 0x0040, 0x080c, 0x5fe6, 0x0028,
-+ 0x6003, 0x0004, 0x2009, 0x44cd, 0x0020, 0x080c, 0x69fe, 0x0804,
-+ 0x35b5, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c,
-+ 0x1118, 0x2091, 0x30bd, 0x0817, 0x2091, 0x303d, 0x0817, 0x6000,
-+ 0x9086, 0x0000, 0x0904, 0x35e7, 0x2069, 0x1847, 0x7890, 0x6842,
-+ 0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0x2039, 0x0001, 0x0804, 0x4c2e, 0x9006, 0x080c, 0x28dc,
-+ 0x81ff, 0x1904, 0x35e7, 0x080c, 0x7630, 0x11b0, 0x080c, 0x792b,
-+ 0x080c, 0x6127, 0x080c, 0x33aa, 0x0118, 0x6130, 0xc18d, 0x6132,
-+ 0x080c, 0xd7dc, 0x0130, 0x080c, 0x7653, 0x1118, 0x080c, 0x7608,
-+ 0x0038, 0x080c, 0x755c, 0x0020, 0x080c, 0x60ec, 0x080c, 0x5fe6,
-+ 0x0804, 0x35b5, 0x81ff, 0x1904, 0x35e7, 0x080c, 0x7630, 0x1110,
-+ 0x0804, 0x35e7, 0x0126, 0x2091, 0x8000, 0x6194, 0x81ff, 0x0190,
-+ 0x704f, 0x0000, 0x2001, 0x1c80, 0x2009, 0x0040, 0x7a8c, 0x7b88,
-+ 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4c2e, 0x701f, 0x35b3,
-+ 0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1c80, 0x20a9,
-+ 0x0040, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x2019, 0xffff, 0x4304,
-+ 0x655c, 0x9588, 0x33b6, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e,
-+ 0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x671d, 0x1190,
-+ 0xb814, 0x821c, 0x0238, 0x9398, 0x1c80, 0x9085, 0xff00, 0x8007,
-+ 0x201a, 0x0038, 0x9398, 0x1c80, 0x2324, 0x94a4, 0xff00, 0x9405,
-+ 0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201,
-+ 0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1,
-+ 0x1c80, 0x2099, 0x1c80, 0x080c, 0x6077, 0x0804, 0x452a, 0x080c,
-+ 0x4c15, 0x0904, 0x35ea, 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002,
-+ 0x0804, 0x35e7, 0x080c, 0x57d3, 0xd0b4, 0x0558, 0x7884, 0x908e,
-+ 0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508,
-+ 0x080c, 0x33a5, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084,
-+ 0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd,
-+ 0xa86a, 0x080c, 0xd29c, 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7,
-+ 0x7007, 0x0003, 0x701f, 0x45b5, 0x0005, 0x080c, 0x4c15, 0x0904,
-+ 0x35ea, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-+ 0x9080, 0x0006, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006,
-+ 0x2098, 0x080c, 0x0f8b, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080,
-+ 0x000a, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098,
-+ 0x080c, 0x0f8b, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0x0804, 0x4c2e, 0x81ff, 0x1904, 0x35e7, 0x080c, 0x4bf9,
-+ 0x0904, 0x35ea, 0x080c, 0x688f, 0x0904, 0x35e7, 0x0058, 0xa878,
-+ 0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x35e7, 0xa974, 0xaa94,
-+ 0x0804, 0x35b5, 0x080c, 0x57db, 0x0904, 0x35b5, 0x701f, 0x45ff,
-+ 0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x35e7, 0x7888, 0x908a,
-+ 0x1000, 0x1a04, 0x35ea, 0x080c, 0x4c15, 0x0904, 0x35ea, 0x080c,
-+ 0x6a9c, 0x0120, 0x080c, 0x6aa4, 0x1904, 0x35ea, 0x080c, 0x6914,
-+ 0x0904, 0x35e7, 0x2019, 0x0004, 0x900e, 0x080c, 0x68a1, 0x0904,
-+ 0x35e7, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000,
-+ 0x12f8, 0x080c, 0x4c13, 0x01e0, 0x080c, 0x6a9c, 0x0118, 0x080c,
-+ 0x6aa4, 0x11b0, 0x080c, 0x6914, 0x2009, 0x0002, 0x0168, 0x2009,
-+ 0x0002, 0x2019, 0x0004, 0x080c, 0x68a1, 0x2009, 0x0003, 0x0120,
-+ 0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010,
-+ 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-+ 0xa897, 0x4000, 0x080c, 0x57db, 0x0110, 0x9006, 0x0018, 0x900e,
-+ 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110,
-+ 0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x645c, 0x2400,
-+ 0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c,
-+ 0x671d, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
-+ 0x8844, 0x0005, 0x81ff, 0x1904, 0x35e7, 0x798c, 0x2001, 0x1980,
-+ 0x918c, 0x8000, 0x2102, 0x080c, 0x4bf9, 0x0904, 0x35ea, 0x080c,
-+ 0x6a9c, 0x0120, 0x080c, 0x6aa4, 0x1904, 0x35ea, 0x080c, 0x67e4,
-+ 0x0904, 0x35e7, 0x080c, 0x6898, 0x0904, 0x35e7, 0x2001, 0x1980,
-+ 0x2004, 0xd0fc, 0x1904, 0x35b5, 0x0804, 0x460a, 0xa9a0, 0x2001,
-+ 0x1980, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c06, 0x01a0,
-+ 0x080c, 0x6a9c, 0x0118, 0x080c, 0x6aa4, 0x1170, 0x080c, 0x67e4,
-+ 0x2009, 0x0002, 0x0128, 0x080c, 0x6898, 0x1170, 0x2009, 0x0003,
-+ 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1980,
-+ 0x2004, 0xd0fc, 0x1128, 0x080c, 0x57db, 0x0110, 0x9006, 0x0018,
-+ 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904,
-+ 0x35e7, 0x798c, 0x2001, 0x197f, 0x918c, 0x8000, 0x2102, 0x080c,
-+ 0x4bf9, 0x0904, 0x35ea, 0x080c, 0x6a9c, 0x0120, 0x080c, 0x6aa4,
-+ 0x1904, 0x35ea, 0x080c, 0x67e4, 0x0904, 0x35e7, 0x080c, 0x6886,
-+ 0x0904, 0x35e7, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1904, 0x35b5,
-+ 0x0804, 0x460a, 0xa9a0, 0x2001, 0x197f, 0x918c, 0x8000, 0xc18d,
-+ 0x2102, 0x080c, 0x4c06, 0x01a0, 0x080c, 0x6a9c, 0x0118, 0x080c,
-+ 0x6aa4, 0x1170, 0x080c, 0x67e4, 0x2009, 0x0002, 0x0128, 0x080c,
-+ 0x6886, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010,
-+ 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-+ 0xa897, 0x4000, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1128, 0x080c,
-+ 0x57db, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001,
-+ 0x0000, 0x0005, 0x6100, 0x0804, 0x35b5, 0x080c, 0x4c15, 0x0904,
-+ 0x35ea, 0x080c, 0x57e7, 0x1904, 0x35e7, 0x79a8, 0xd184, 0x1158,
-+ 0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f,
-+ 0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007,
-+ 0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0202,
-+ 0x0804, 0x35b5, 0x78a8, 0x909c, 0x0003, 0xd0ac, 0x1158, 0xd0b4,
-+ 0x1148, 0x939a, 0x0003, 0x1a04, 0x35e7, 0x625c, 0x7884, 0x9206,
-+ 0x1904, 0x47c5, 0x080c, 0x8945, 0x2001, 0xffec, 0x2009, 0x000c,
-+ 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0000, 0x0006, 0x78a8,
-+ 0x9084, 0x0080, 0x1528, 0x0006, 0x0036, 0x2001, 0x1a83, 0x201c,
-+ 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a84, 0x201c, 0x7b9e, 0x2003,
-+ 0x0000, 0x2001, 0x1a85, 0x201c, 0x7bae, 0x2003, 0x0000, 0x2001,
-+ 0x1a7f, 0x201c, 0x7baa, 0x2003, 0x0000, 0x2001, 0x1a86, 0x201c,
-+ 0x7bb2, 0x2003, 0x0000, 0x003e, 0x000e, 0x000e, 0x0804, 0x4c2e,
-+ 0x000e, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a,
-+ 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10f8,
-+ 0x7007, 0x0002, 0x701f, 0x47e5, 0x0005, 0x81ff, 0x1904, 0x35e7,
-+ 0x080c, 0x4c15, 0x0904, 0x35ea, 0x080c, 0x6a9c, 0x1904, 0x35e7,
-+ 0x00c6, 0x080c, 0x4be2, 0x00ce, 0x0904, 0x35e7, 0xa867, 0x0000,
-+ 0xa868, 0xc0fd, 0xa86a, 0x7ea8, 0x080c, 0xd242, 0x0904, 0x35e7,
-+ 0x7007, 0x0003, 0x701f, 0x480b, 0x0005, 0x080c, 0x42ea, 0x0006,
-+ 0x0036, 0x2001, 0x1a83, 0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001,
-+ 0x1a84, 0x201c, 0x7b9e, 0x2003, 0x0000, 0x2001, 0x1a85, 0x201c,
-+ 0x7bae, 0x2003, 0x0000, 0x2001, 0x1a7f, 0x201c, 0x7baa, 0x2003,
-+ 0x0000, 0x2001, 0x1a86, 0x201c, 0x7bb2, 0x2003, 0x0000, 0x003e,
-+ 0x000e, 0x0804, 0x35b5, 0xa830, 0x9086, 0x0100, 0x0904, 0x35e7,
-+ 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-+ 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
-+ 0x4c2e, 0x9006, 0x080c, 0x28dc, 0x78a8, 0x9084, 0x00ff, 0x9086,
-+ 0x00ff, 0x0118, 0x81ff, 0x1904, 0x35e7, 0x080c, 0x7630, 0x0110,
-+ 0x080c, 0x60ec, 0x7888, 0x908a, 0x1000, 0x1a04, 0x35ea, 0x7984,
-+ 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x35ea, 0x2100,
-+ 0x080c, 0x28a6, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x2061,
-+ 0x19fb, 0x601b, 0x0000, 0x601f, 0x0000, 0x607b, 0x0000, 0x607f,
-+ 0x0000, 0x080c, 0x7630, 0x1158, 0x080c, 0x792b, 0x080c, 0x6127,
-+ 0x9085, 0x0001, 0x080c, 0x7674, 0x080c, 0x755c, 0x00d0, 0x080c,
-+ 0xb23d, 0x2061, 0x0100, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
-+ 0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
-+ 0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x6012, 0x080c,
-+ 0x88ce, 0x7984, 0x080c, 0x7630, 0x1110, 0x2009, 0x00ff, 0x7a88,
-+ 0x080c, 0x466d, 0x012e, 0x00ce, 0x002e, 0x0804, 0x35b5, 0x7984,
-+ 0x080c, 0x66b2, 0x2b08, 0x1904, 0x35ea, 0x0804, 0x35b5, 0x81ff,
-+ 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7, 0x60dc, 0xd0ac, 0x1130,
-+ 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x35e7, 0x080c, 0x4be2,
-+ 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x7984, 0x81ff, 0x0904,
-+ 0x35ea, 0x9192, 0x0021, 0x1a04, 0x35ea, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0xa85c, 0x9080, 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c,
-+ 0x4c2b, 0x701f, 0x48c2, 0x7880, 0x9086, 0x006e, 0x0110, 0x701f,
-+ 0x527b, 0x0005, 0x2009, 0x0080, 0x080c, 0x671d, 0x1118, 0x080c,
-+ 0x6a9c, 0x0120, 0x2021, 0x400a, 0x0804, 0x35b7, 0x00d6, 0x0096,
-+ 0xa964, 0xaa6c, 0xab70, 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be,
-+ 0x0100, 0x0904, 0x495b, 0x90be, 0x0112, 0x0904, 0x495b, 0x90be,
-+ 0x0113, 0x0904, 0x495b, 0x90be, 0x0114, 0x0904, 0x495b, 0x90be,
-+ 0x0117, 0x0904, 0x495b, 0x90be, 0x011a, 0x0904, 0x495b, 0x90be,
-+ 0x011c, 0x0904, 0x495b, 0x90be, 0x0121, 0x0904, 0x4942, 0x90be,
-+ 0x0131, 0x0904, 0x4942, 0x90be, 0x0171, 0x0904, 0x495b, 0x90be,
-+ 0x0173, 0x0904, 0x495b, 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007,
-+ 0xa896, 0x0804, 0x4966, 0x90be, 0x0212, 0x0904, 0x494f, 0x90be,
-+ 0x0213, 0x05e8, 0x90be, 0x0214, 0x0500, 0x90be, 0x0217, 0x0188,
-+ 0x90be, 0x021a, 0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be,
-+ 0x021f, 0x05c8, 0x90be, 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804,
-+ 0x35ea, 0x7028, 0x9080, 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0,
-+ 0x20e8, 0x20a9, 0x0007, 0x080c, 0x49a4, 0x7028, 0x9080, 0x000e,
-+ 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c,
-+ 0x49a4, 0x00c8, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034,
-+ 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x49b1, 0x00b8, 0x7028,
- 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
-- 0x0001, 0x080c, 0x49a6, 0x00c8, 0x7028, 0x9080, 0x000c, 0x2098,
-- 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x49b3,
-- 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0,
-- 0x20e8, 0x20a9, 0x0001, 0x080c, 0x49b3, 0x7028, 0x9080, 0x000c,
-- 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x04f1,
-- 0x00c6, 0x080c, 0x4be4, 0x0550, 0xa868, 0xc0fd, 0xa86a, 0xa867,
-- 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020, 0xa88b, 0x0001, 0x810b,
-- 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe, 0xadc2, 0xa9c6, 0xa8ca,
-- 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822, 0xa868, 0xc0fd, 0xa86a,
-- 0xa804, 0x2048, 0x080c, 0xd264, 0x1120, 0x2009, 0x0003, 0x0804,
-- 0x35e7, 0x7007, 0x0003, 0x701f, 0x499d, 0x0005, 0x00ce, 0x009e,
-- 0x00de, 0x2009, 0x0002, 0x0804, 0x35e7, 0xa820, 0x9086, 0x8001,
-- 0x1904, 0x35b5, 0x2009, 0x0004, 0x0804, 0x35e7, 0x0016, 0x0026,
-- 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104, 0x4004, 0x8211, 0x1dc8,
-- 0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x0036, 0x0046, 0x3520,
-- 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204, 0x4104, 0x4004, 0x8421,
-- 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x81ff, 0x0120,
-- 0x2009, 0x0001, 0x0804, 0x35e7, 0x60dc, 0xd0ac, 0x1188, 0x2009,
-- 0x180d, 0x210c, 0xd18c, 0x0130, 0xd09c, 0x0120, 0x2009, 0x0016,
-- 0x0804, 0x35e7, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x35e7,
-- 0x7984, 0x78a8, 0x2040, 0x080c, 0xb23d, 0x1120, 0x9182, 0x007f,
-- 0x0a04, 0x35ea, 0x9186, 0x00ff, 0x0904, 0x35ea, 0x9182, 0x0800,
-- 0x1a04, 0x35ea, 0x7a8c, 0x7b88, 0x607c, 0x9306, 0x1158, 0x6080,
-- 0x924e, 0x0904, 0x35ea, 0x080c, 0xb23d, 0x1120, 0x99cc, 0xff00,
-- 0x0904, 0x35ea, 0x0126, 0x2091, 0x8000, 0x2001, 0x180d, 0x2004,
-- 0xd08c, 0x0198, 0x9386, 0x00ff, 0x0180, 0x0026, 0x2011, 0x8008,
-- 0x080c, 0x6ac7, 0x002e, 0x0148, 0x918d, 0x8000, 0x080c, 0x6b11,
-- 0x1120, 0x2001, 0x4009, 0x0804, 0x4a64, 0x080c, 0x4af7, 0x0904,
-- 0x4a6a, 0x0086, 0x90c6, 0x4000, 0x008e, 0x1538, 0x00c6, 0x0006,
-- 0x0036, 0xb818, 0xbb1c, 0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305,
-- 0xbb28, 0x9305, 0xbb2c, 0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305,
-- 0x003e, 0x0570, 0xd88c, 0x1128, 0x080c, 0x6aa3, 0x0110, 0xc89d,
-- 0x0438, 0x900e, 0x080c, 0x6944, 0x1108, 0xc185, 0xb800, 0xd0bc,
-- 0x0108, 0xc18d, 0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110,
-- 0x2408, 0x0090, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060,
-- 0x90c6, 0x4009, 0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020,
-- 0x2001, 0x4005, 0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x35b7,
-- 0x000e, 0x00ce, 0x2b00, 0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6,
-- 0x2c70, 0x080c, 0xb325, 0x0904, 0x4abf, 0x2b00, 0x6012, 0x080c,
-- 0xd554, 0x2e58, 0x00ee, 0x00e6, 0x00c6, 0x080c, 0x4be4, 0x00ce,
-- 0x2b70, 0x1158, 0x080c, 0xb2d3, 0x00ee, 0x00ce, 0x00be, 0x001e,
-- 0x012e, 0x2009, 0x0002, 0x0804, 0x35e7, 0x900e, 0xa966, 0xa96a,
-- 0x2900, 0x6016, 0xa932, 0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5,
-- 0xa86a, 0xd89c, 0x1110, 0x080c, 0x3250, 0x6023, 0x0001, 0x9006,
-- 0x080c, 0x6656, 0xd89c, 0x0138, 0x2001, 0x0004, 0x080c, 0x666a,
-- 0x2009, 0x0003, 0x0030, 0x2001, 0x0002, 0x080c, 0x666a, 0x2009,
-- 0x0002, 0x080c, 0xb352, 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024,
-- 0x00e6, 0x2058, 0xb8cc, 0xc08d, 0xb8ce, 0x9085, 0x0001, 0x00ee,
-- 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003, 0x0804,
-- 0x35e7, 0x7007, 0x0003, 0x701f, 0x4ace, 0x0005, 0xa830, 0x2009,
-- 0x180d, 0x210c, 0xd18c, 0x0140, 0x2008, 0x918e, 0xdead, 0x1120,
-- 0x2021, 0x4009, 0x0804, 0x35b7, 0x9086, 0x0100, 0x7024, 0x2058,
-- 0x1138, 0x2009, 0x0004, 0xba04, 0x9294, 0x00ff, 0x0804, 0x5729,
-- 0x900e, 0xa868, 0xd0f4, 0x1904, 0x35b5, 0x080c, 0x6944, 0x1108,
-- 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x35b5, 0x00e6,
-- 0x00d6, 0x0096, 0x83ff, 0x0904, 0x4b46, 0x902e, 0x080c, 0xb23d,
-- 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071, 0x1000, 0x0030, 0x2021,
-- 0x007f, 0x20a9, 0x0781, 0x2071, 0x107f, 0x2e04, 0x9005, 0x11b8,
-- 0x2100, 0x9406, 0x1904, 0x4b57, 0x2428, 0x94ce, 0x007f, 0x1120,
-- 0x92ce, 0xfffd, 0x1558, 0x0030, 0x94ce, 0x0080, 0x1130, 0x92ce,
-- 0xfffc, 0x1520, 0x93ce, 0x00ff, 0x1508, 0xc5fd, 0x0480, 0x2058,
-- 0xbf10, 0x2700, 0x9306, 0x11e8, 0xbe14, 0x2600, 0x9206, 0x11c8,
-- 0x2400, 0x9106, 0x1180, 0xd884, 0x0598, 0xd894, 0x1588, 0x080c,
-- 0x6a43, 0x1570, 0x2001, 0x4000, 0x0460, 0x080c, 0x6aa3, 0x1540,
-- 0x2001, 0x4000, 0x0430, 0x2001, 0x4007, 0x0418, 0x2001, 0x4006,
-- 0x0400, 0x2400, 0x9106, 0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff,
-- 0x0918, 0x080c, 0xb23d, 0x1900, 0x2001, 0x4008, 0x0090, 0x8420,
-- 0x8e70, 0x1f04, 0x4b0d, 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048,
-- 0x2001, 0x0001, 0x0030, 0x080c, 0x66b9, 0x1dd0, 0xbb12, 0xba16,
-- 0x9006, 0x9005, 0x009e, 0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120,
-- 0x2009, 0x0001, 0x0804, 0x35e7, 0x080c, 0x4be4, 0x1120, 0x2009,
-- 0x0002, 0x0804, 0x35e7, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-- 0x7884, 0x9005, 0x0904, 0x35ea, 0x9096, 0x00ff, 0x0120, 0x9092,
-- 0x0004, 0x1a04, 0x35ea, 0x2010, 0x2918, 0x080c, 0x31f6, 0x1120,
-- 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x4b99,
-- 0x0005, 0xa830, 0x9086, 0x0100, 0x1904, 0x35b5, 0x2009, 0x0004,
-- 0x0804, 0x35e7, 0x7984, 0x080c, 0xb23d, 0x1120, 0x9182, 0x007f,
-- 0x0a04, 0x35ea, 0x9186, 0x00ff, 0x0904, 0x35ea, 0x9182, 0x0800,
-- 0x1a04, 0x35ea, 0x2001, 0x9400, 0x080c, 0x5784, 0x1904, 0x35e7,
-- 0x0804, 0x35b5, 0xa998, 0x080c, 0xb23d, 0x1118, 0x9182, 0x007f,
-- 0x0280, 0x9186, 0x00ff, 0x0168, 0x9182, 0x0800, 0x1250, 0x2001,
-- 0x9400, 0x080c, 0x5784, 0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a,
-- 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-- 0x0005, 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
-- 0x0005, 0x2009, 0x000a, 0x0c48, 0x080c, 0x100e, 0x0198, 0x9006,
-- 0xa802, 0x7014, 0x9005, 0x1120, 0x2900, 0x7016, 0x701a, 0x0040,
-- 0x7018, 0xa802, 0x0086, 0x2040, 0x2900, 0xa006, 0x701a, 0x008e,
-- 0x9085, 0x0001, 0x0005, 0x7984, 0x080c, 0x6724, 0x1130, 0x7e88,
-- 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005,
-- 0xa998, 0x080c, 0x6724, 0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082,
-- 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84,
-- 0x2608, 0x080c, 0x6724, 0x1108, 0x0008, 0x905e, 0x8bff, 0x0005,
-- 0x0016, 0x7114, 0x81ff, 0x0128, 0x2148, 0xa904, 0x080c, 0x1040,
-- 0x0cc8, 0x7116, 0x711a, 0x001e, 0x0005, 0x2031, 0x0001, 0x0010,
-- 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772,
-- 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10f8, 0x7007,
-- 0x0002, 0x701f, 0x35b5, 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000,
-- 0x2079, 0x0000, 0x2001, 0x18b0, 0x2004, 0x9005, 0x1190, 0x0e04,
-- 0x4c61, 0x7a36, 0x7833, 0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091,
-- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x0804,
-- 0x4cc7, 0x0016, 0x0086, 0x0096, 0x00c6, 0x00e6, 0x2071, 0x189e,
-- 0x7044, 0x9005, 0x1540, 0x7148, 0x9182, 0x0010, 0x0288, 0x7038,
-- 0x2060, 0x080c, 0x100e, 0x0904, 0x4cbf, 0xa84b, 0x0000, 0x2900,
-- 0x7046, 0x2001, 0x0002, 0x9080, 0x20c7, 0x2005, 0xa846, 0x0098,
-- 0x7038, 0x90e0, 0x0004, 0x2001, 0x18ba, 0x9c82, 0x18fa, 0x0210,
-- 0x2061, 0x18ba, 0x2c00, 0x703a, 0x7148, 0x81ff, 0x1108, 0x703e,
-- 0x8108, 0x714a, 0x0460, 0x7148, 0x8108, 0x714a, 0x7044, 0x2040,
-- 0xa144, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0dc5, 0x2060,
-- 0x001e, 0x8108, 0x2105, 0x9005, 0xa146, 0x1520, 0x080c, 0x100e,
-- 0x1130, 0x8109, 0xa946, 0x7148, 0x8109, 0x714a, 0x00d8, 0x9006,
-- 0xa806, 0xa84a, 0xa046, 0x2800, 0xa802, 0x2900, 0xa006, 0x7046,
-- 0x2001, 0x0002, 0x9080, 0x20c7, 0x2005, 0xa846, 0x0058, 0x2262,
-- 0x6306, 0x640a, 0x00ee, 0x00ce, 0x009e, 0x008e, 0x001e, 0x012e,
-- 0x00fe, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4ce9, 0x4ce9,
-- 0x4ceb, 0x4ce9, 0x4ce9, 0x4ce9, 0x4cef, 0x4ce9, 0x4ce9, 0x4ce9,
-- 0x4cf3, 0x4ce9, 0x4ce9, 0x4ce9, 0x4cf7, 0x4ce9, 0x4ce9, 0x4ce9,
-- 0x4cfb, 0x4ce9, 0x4ce9, 0x4ce9, 0x4cff, 0x4ce9, 0x4ce9, 0x4ce9,
-- 0x4d04, 0x080c, 0x0dc5, 0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286,
-- 0xa38a, 0xa48e, 0x0878, 0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6,
-- 0xa3aa, 0xa4ae, 0x0838, 0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6,
-- 0xa3ca, 0xa4ce, 0x0804, 0x4cc2, 0xa2d6, 0xa3da, 0xa4de, 0x0804,
-- 0x4cc2, 0x00e6, 0x2071, 0x189e, 0x7048, 0x9005, 0x0904, 0x4d9b,
-- 0x0126, 0x2091, 0x8000, 0x0e04, 0x4d9a, 0x00f6, 0x2079, 0x0000,
-- 0x00c6, 0x0096, 0x0086, 0x0076, 0x9006, 0x2038, 0x7040, 0x2048,
-- 0x9005, 0x0500, 0xa948, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c,
-- 0x0dc5, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa94a, 0x1904,
-- 0x4d9d, 0xa804, 0x9005, 0x090c, 0x0dc5, 0x7042, 0x2938, 0x2040,
-- 0xa003, 0x0000, 0x2001, 0x0002, 0x9080, 0x20c7, 0x2005, 0xa04a,
-- 0x0804, 0x4d9d, 0x703c, 0x2060, 0x2c14, 0x6304, 0x6408, 0x650c,
-- 0x2200, 0x7836, 0x7833, 0x0012, 0x7882, 0x2300, 0x7886, 0x2400,
-- 0x788a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-- 0x11aa, 0x87ff, 0x0118, 0x2748, 0x080c, 0x1040, 0x7048, 0x8001,
-- 0x704a, 0x9005, 0x1170, 0x7040, 0x2048, 0x9005, 0x0128, 0x080c,
-- 0x1040, 0x9006, 0x7042, 0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba,
-- 0x0420, 0x7040, 0x9005, 0x1508, 0x7238, 0x2c00, 0x9206, 0x0148,
-- 0x9c80, 0x0004, 0x90fa, 0x18fa, 0x0210, 0x2001, 0x18ba, 0x703e,
-- 0x00a0, 0x9006, 0x703e, 0x703a, 0x7044, 0x9005, 0x090c, 0x0dc5,
-- 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900, 0x7042, 0x2001, 0x0002,
-- 0x9080, 0x20c7, 0x2005, 0xa84a, 0x0000, 0x007e, 0x008e, 0x009e,
-- 0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b,
-- 0x0002, 0x4dbc, 0x4dbc, 0x4dbe, 0x4dbc, 0x4dbc, 0x4dbc, 0x4dc3,
-- 0x4dbc, 0x4dbc, 0x4dbc, 0x4dc8, 0x4dbc, 0x4dbc, 0x4dbc, 0x4dcd,
-- 0x4dbc, 0x4dbc, 0x4dbc, 0x4dd2, 0x4dbc, 0x4dbc, 0x4dbc, 0x4dd7,
-- 0x4dbc, 0x4dbc, 0x4dbc, 0x4ddc, 0x080c, 0x0dc5, 0xaa74, 0xab78,
-- 0xac7c, 0x0804, 0x4d48, 0xaa84, 0xab88, 0xac8c, 0x0804, 0x4d48,
-- 0xaa94, 0xab98, 0xac9c, 0x0804, 0x4d48, 0xaaa4, 0xaba8, 0xacac,
-- 0x0804, 0x4d48, 0xaab4, 0xabb8, 0xacbc, 0x0804, 0x4d48, 0xaac4,
-- 0xabc8, 0xaccc, 0x0804, 0x4d48, 0xaad4, 0xabd8, 0xacdc, 0x0804,
-- 0x4d48, 0x0016, 0x0026, 0x0036, 0x00b6, 0x00c6, 0x2009, 0x007e,
-- 0x080c, 0x6724, 0x2019, 0x0001, 0xb85c, 0xd0ac, 0x0110, 0x2019,
-- 0x0000, 0x2011, 0x801b, 0x080c, 0x4c44, 0x00ce, 0x00be, 0x003e,
-- 0x002e, 0x001e, 0x0005, 0x0026, 0x080c, 0x57d5, 0xd0c4, 0x0120,
-- 0x2011, 0x8014, 0x080c, 0x4c44, 0x002e, 0x0005, 0x81ff, 0x1904,
-- 0x35e7, 0x0126, 0x2091, 0x8000, 0x6030, 0xc08d, 0xc085, 0xc0ac,
-- 0x6032, 0x080c, 0x7637, 0x1158, 0x080c, 0x7932, 0x080c, 0x612e,
-- 0x9085, 0x0001, 0x080c, 0x767b, 0x080c, 0x7563, 0x0010, 0x080c,
-- 0x5fed, 0x012e, 0x0804, 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001,
-- 0x0804, 0x35e7, 0x080c, 0x57e9, 0x0120, 0x2009, 0x0007, 0x0804,
-- 0x35e7, 0x080c, 0x6a9b, 0x0120, 0x2009, 0x0008, 0x0804, 0x35e7,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x0178, 0x0026, 0x2011, 0x0010,
-- 0x080c, 0x6ac7, 0x002e, 0x0140, 0x7984, 0x080c, 0x6b11, 0x1120,
-- 0x2009, 0x4009, 0x0804, 0x35e7, 0x7984, 0x080c, 0x66b9, 0x1904,
-- 0x35ea, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x2b00, 0x7026, 0x080c,
-- 0x6aa3, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e, 0x080c,
-- 0x6944, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
-- 0x35b5, 0x080c, 0x4be4, 0x0904, 0x35e7, 0x9006, 0xa866, 0xa832,
-- 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd302, 0x0904, 0x35e7, 0x7888,
-- 0xd094, 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x7007, 0x0003, 0x701f,
-- 0x4ecb, 0x0005, 0x2061, 0x1800, 0x080c, 0x57e9, 0x2009, 0x0007,
-- 0x1560, 0x080c, 0x6a9b, 0x0118, 0x2009, 0x0008, 0x0430, 0xa998,
-- 0x080c, 0x66b9, 0x1530, 0x080c, 0x4c15, 0x0518, 0x080c, 0x6aa3,
-- 0xa89c, 0x1168, 0x9084, 0x0005, 0x1150, 0x900e, 0x080c, 0x6944,
-- 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868,
-- 0xc0fc, 0xa86a, 0x080c, 0xd302, 0x11e0, 0xa89c, 0xd094, 0x0118,
-- 0xb8cc, 0xc08d, 0xb8ce, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a,
-- 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-- 0x0005, 0xa897, 0x4000, 0xa99a, 0x9006, 0x918d, 0x0001, 0x2008,
-- 0x0005, 0x9006, 0x0005, 0xa830, 0x2009, 0x180d, 0x210c, 0xd18c,
-- 0x0140, 0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804,
-- 0x35b7, 0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x5729,
-- 0x900e, 0x080c, 0x6944, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-- 0xc18d, 0x0804, 0x35b5, 0x080c, 0x57e9, 0x0120, 0x2009, 0x0007,
-- 0x0804, 0x35e7, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c,
-- 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x900e, 0x2130,
-- 0x7126, 0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005,
-- 0x702a, 0x20a0, 0x080c, 0x6724, 0x1904, 0x4f81, 0x080c, 0x6aa3,
-- 0x0138, 0x080c, 0x6aab, 0x0120, 0x080c, 0x6a43, 0x1904, 0x4f81,
-- 0xd794, 0x1110, 0xd784, 0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-- 0x0006, 0x2098, 0x3400, 0xd794, 0x0198, 0x20a9, 0x0008, 0x4003,
-- 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c, 0x49b3,
-- 0x0080, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x3400,
-- 0x20a9, 0x0004, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c,
-- 0x49b3, 0x9186, 0x007e, 0x0170, 0x9186, 0x0080, 0x0158, 0x080c,
-- 0x6aa3, 0x90c2, 0x0006, 0x1210, 0xc1fd, 0x0020, 0x080c, 0x6944,
-- 0x1108, 0xc1fd, 0x4104, 0xc1fc, 0xd794, 0x0528, 0xb8c4, 0x20e0,
-- 0xb8c8, 0x2060, 0x9c80, 0x0000, 0x2098, 0x20a9, 0x0002, 0x4003,
-- 0x9c80, 0x0003, 0x2098, 0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004,
-- 0x2098, 0x3400, 0x20a9, 0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00,
-- 0x20e0, 0x080c, 0x49a6, 0x9c80, 0x0026, 0x2098, 0xb8c4, 0x20e0,
-- 0x20a9, 0x0002, 0x4003, 0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0,
-- 0x0005, 0x8108, 0x080c, 0xb23d, 0x0118, 0x9186, 0x0800, 0x0040,
-- 0xd78c, 0x0120, 0x9186, 0x0800, 0x0170, 0x0018, 0x9186, 0x007e,
-- 0x0150, 0xd794, 0x0118, 0x9686, 0x0020, 0x0010, 0x9686, 0x0028,
-- 0x0150, 0x0804, 0x4f0a, 0x86ff, 0x1120, 0x7124, 0x810b, 0x0804,
-- 0x35b5, 0x7033, 0x0001, 0x7122, 0x7024, 0x9600, 0x7026, 0x772e,
-- 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072,
-- 0x7028, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10f8,
-- 0x7007, 0x0002, 0x701f, 0x4fbd, 0x0005, 0x7030, 0x9005, 0x1180,
-- 0x7120, 0x7028, 0x20a0, 0x772c, 0x9036, 0x7034, 0x20e8, 0x2061,
-- 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x0804, 0x4f0a,
-- 0x7124, 0x810b, 0x0804, 0x35b5, 0x2029, 0x007e, 0x7984, 0x7a88,
-- 0x7b8c, 0x7c98, 0x9184, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04,
-- 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9184, 0x00ff, 0x90e2, 0x0020,
-- 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9284, 0xff00, 0x8007,
-- 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9284,
-- 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea,
-- 0x9384, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502,
-- 0x0a04, 0x35ea, 0x9384, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35ea,
-- 0x9502, 0x0a04, 0x35ea, 0x9484, 0xff00, 0x8007, 0x90e2, 0x0020,
-- 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9484, 0x00ff, 0x90e2,
-- 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x2061, 0x1989,
-- 0x6102, 0x6206, 0x630a, 0x640e, 0x0804, 0x35b5, 0x080c, 0x4be4,
-- 0x0904, 0x35e7, 0x2009, 0x0016, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-- 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c2d, 0x701f, 0x5041,
-- 0x0005, 0x20a9, 0x0016, 0x896e, 0x8d6e, 0x8d6f, 0x9d84, 0xffc0,
-- 0x9080, 0x0019, 0x2098, 0x9d84, 0x003f, 0x20e0, 0x2069, 0x1877,
-- 0x20e9, 0x0001, 0x2da0, 0x4003, 0x6800, 0x9005, 0x0904, 0x50a8,
-- 0x6804, 0x2008, 0x918c, 0xfff8, 0x1904, 0x50a8, 0x680c, 0x9005,
-- 0x0904, 0x50a8, 0x9082, 0xff01, 0x1a04, 0x50a8, 0x6810, 0x9082,
-- 0x005c, 0x06f0, 0x6824, 0x2008, 0x9082, 0x0008, 0x06c8, 0x9182,
-- 0x0400, 0x16b0, 0x0056, 0x2029, 0x0000, 0x080c, 0x8e80, 0x005e,
-- 0x6944, 0x6820, 0x9102, 0x0660, 0x6820, 0x9082, 0x0019, 0x1640,
-- 0x6828, 0x6944, 0x810c, 0x9102, 0x0618, 0x6840, 0x9082, 0x000f,
-- 0x12f8, 0x080c, 0x1027, 0x2900, 0x0590, 0x684e, 0x00e6, 0x2071,
-- 0x1931, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8d3c, 0x00be, 0x00ee,
-- 0x01e8, 0x080c, 0x8a84, 0x080c, 0x8ad3, 0x1160, 0x6857, 0x0000,
-- 0x00c6, 0x6b10, 0x2061, 0x1a65, 0x630a, 0x00ce, 0x0804, 0x35b5,
-- 0x0804, 0x35ea, 0x080c, 0x8acc, 0x00e6, 0x2071, 0x1931, 0x080c,
-- 0x8f00, 0x080c, 0x8f0f, 0x080c, 0x8d21, 0x00ee, 0x2001, 0x188a,
-- 0x204c, 0x080c, 0x1040, 0x2001, 0x188a, 0x2003, 0x0000, 0x0804,
-- 0x35e7, 0x0126, 0x2091, 0x8000, 0x080c, 0x92bf, 0x080c, 0x8acc,
-- 0x012e, 0x0804, 0x35b5, 0x0006, 0x080c, 0x57d5, 0xd0cc, 0x000e,
-- 0x0005, 0x0006, 0x080c, 0x57d9, 0xd0bc, 0x000e, 0x0005, 0x6174,
-- 0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x35b5, 0x83ff,
-- 0x1904, 0x35ea, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x35ea, 0x2019,
-- 0xffff, 0x6078, 0x9302, 0x9200, 0x0a04, 0x35ea, 0x7986, 0x6276,
-- 0x0804, 0x35b5, 0x080c, 0x57e9, 0x1904, 0x35e7, 0x7c88, 0x7d84,
-- 0x7e98, 0x7f8c, 0x080c, 0x4be4, 0x0904, 0x35e7, 0x900e, 0x901e,
-- 0x7326, 0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003,
-- 0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
-- 0x6aa3, 0x0118, 0x080c, 0x6aab, 0x1148, 0x20a9, 0x0001, 0xb814,
-- 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182,
-- 0x0800, 0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148,
-- 0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x9375, 0x2208, 0x0804,
-- 0x35b5, 0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061,
-- 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034,
-- 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10f8, 0x7007,
-- 0x0002, 0x701f, 0x514c, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120,
-- 0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44,
-- 0xa48c, 0xa590, 0xa694, 0xa798, 0x0804, 0x510a, 0x7224, 0x900e,
-- 0x2001, 0x0003, 0x080c, 0x9375, 0x2208, 0x0804, 0x35b5, 0x00f6,
-- 0x00e6, 0x080c, 0x57e9, 0x2009, 0x0007, 0x1904, 0x51df, 0x2071,
-- 0x189e, 0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x51df, 0xac9c,
-- 0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c, 0x1027, 0x2009, 0x0002,
-- 0x0904, 0x51df, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362,
-- 0xa860, 0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8,
-- 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6aa3, 0x0118, 0x080c,
-- 0x6aab, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004,
-+ 0x0001, 0x080c, 0x49b1, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0,
-+ 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c,
-+ 0x4be2, 0x0550, 0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006,
-+ 0xa882, 0xa87f, 0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2,
-+ 0xaab6, 0xabba, 0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e,
-+ 0x00de, 0xa866, 0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048,
-+ 0x080c, 0xd25d, 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007,
-+ 0x0003, 0x701f, 0x499b, 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009,
-+ 0x0002, 0x0804, 0x35e7, 0xa820, 0x9086, 0x8001, 0x1904, 0x35b5,
-+ 0x2009, 0x0004, 0x0804, 0x35e7, 0x0016, 0x0026, 0x3510, 0x20a9,
-+ 0x0002, 0x4002, 0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e,
-+ 0x0005, 0x0016, 0x0026, 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004,
-+ 0x4002, 0x4304, 0x4204, 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e,
-+ 0x003e, 0x002e, 0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
-+ 0x0804, 0x35e7, 0x60dc, 0xd0ac, 0x1188, 0x2009, 0x180d, 0x210c,
-+ 0xd18c, 0x0130, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804, 0x35e7,
-+ 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x35e7, 0x7984, 0x78a8,
-+ 0x2040, 0x080c, 0xb236, 0x1120, 0x9182, 0x007f, 0x0a04, 0x35ea,
-+ 0x9186, 0x00ff, 0x0904, 0x35ea, 0x9182, 0x0800, 0x1a04, 0x35ea,
-+ 0x7a8c, 0x7b88, 0x607c, 0x9306, 0x1158, 0x6080, 0x924e, 0x0904,
-+ 0x35ea, 0x080c, 0xb236, 0x1120, 0x99cc, 0xff00, 0x0904, 0x35ea,
-+ 0x0126, 0x2091, 0x8000, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0198,
-+ 0x9386, 0x00ff, 0x0180, 0x0026, 0x2011, 0x8008, 0x080c, 0x6ac0,
-+ 0x002e, 0x0148, 0x918d, 0x8000, 0x080c, 0x6b0a, 0x1120, 0x2001,
-+ 0x4009, 0x0804, 0x4a62, 0x080c, 0x4af5, 0x0904, 0x4a68, 0x0086,
-+ 0x90c6, 0x4000, 0x008e, 0x1538, 0x00c6, 0x0006, 0x0036, 0xb818,
-+ 0xbb1c, 0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305, 0xbb28, 0x9305,
-+ 0xbb2c, 0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305, 0x003e, 0x0570,
-+ 0xd88c, 0x1128, 0x080c, 0x6a9c, 0x0110, 0xc89d, 0x0438, 0x900e,
-+ 0x080c, 0x693d, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-+ 0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090,
-+ 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009,
-+ 0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005,
-+ 0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x35b7, 0x000e, 0x00ce,
-+ 0x2b00, 0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c,
-+ 0xb31e, 0x0904, 0x4abd, 0x2b00, 0x6012, 0x080c, 0xd54d, 0x2e58,
-+ 0x00ee, 0x00e6, 0x00c6, 0x080c, 0x4be2, 0x00ce, 0x2b70, 0x1158,
-+ 0x080c, 0xb2cc, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009,
-+ 0x0002, 0x0804, 0x35e7, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016,
-+ 0xa932, 0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0xd89c,
-+ 0x1110, 0x080c, 0x3250, 0x6023, 0x0001, 0x9006, 0x080c, 0x664f,
-+ 0xd89c, 0x0138, 0x2001, 0x0004, 0x080c, 0x6663, 0x2009, 0x0003,
-+ 0x0030, 0x2001, 0x0002, 0x080c, 0x6663, 0x2009, 0x0002, 0x080c,
-+ 0xb34b, 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024, 0x00e6, 0x2058,
-+ 0xb8cc, 0xc08d, 0xb8ce, 0x9085, 0x0001, 0x00ee, 0x00ce, 0x00be,
-+ 0x001e, 0x012e, 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007,
-+ 0x0003, 0x701f, 0x4acc, 0x0005, 0xa830, 0x2009, 0x180d, 0x210c,
-+ 0xd18c, 0x0140, 0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009,
-+ 0x0804, 0x35b7, 0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009,
-+ 0x0004, 0xba04, 0x9294, 0x00ff, 0x0804, 0x5727, 0x900e, 0xa868,
-+ 0xd0f4, 0x1904, 0x35b5, 0x080c, 0x693d, 0x1108, 0xc185, 0xb800,
-+ 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x35b5, 0x00e6, 0x00d6, 0x0096,
-+ 0x83ff, 0x0904, 0x4b44, 0x902e, 0x080c, 0xb236, 0x0130, 0x9026,
-+ 0x20a9, 0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9,
-+ 0x0781, 0x2071, 0x107f, 0x2e04, 0x9005, 0x11b8, 0x2100, 0x9406,
-+ 0x1904, 0x4b55, 0x2428, 0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd,
-+ 0x1558, 0x0030, 0x94ce, 0x0080, 0x1130, 0x92ce, 0xfffc, 0x1520,
-+ 0x93ce, 0x00ff, 0x1508, 0xc5fd, 0x0480, 0x2058, 0xbf10, 0x2700,
-+ 0x9306, 0x11e8, 0xbe14, 0x2600, 0x9206, 0x11c8, 0x2400, 0x9106,
-+ 0x1180, 0xd884, 0x0598, 0xd894, 0x1588, 0x080c, 0x6a3c, 0x1570,
-+ 0x2001, 0x4000, 0x0460, 0x080c, 0x6a9c, 0x1540, 0x2001, 0x4000,
-+ 0x0430, 0x2001, 0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400,
-+ 0x9106, 0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0918, 0x080c,
-+ 0xb236, 0x1900, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04,
-+ 0x4b0b, 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001,
-+ 0x0030, 0x080c, 0x66b2, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005,
-+ 0x009e, 0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
-+ 0x0804, 0x35e7, 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804,
-+ 0x35e7, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005,
-+ 0x0904, 0x35ea, 0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04,
-+ 0x35ea, 0x2010, 0x2918, 0x080c, 0x31f6, 0x1120, 0x2009, 0x0003,
-+ 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x4b97, 0x0005, 0xa830,
-+ 0x9086, 0x0100, 0x1904, 0x35b5, 0x2009, 0x0004, 0x0804, 0x35e7,
-+ 0x7984, 0x080c, 0xb236, 0x1120, 0x9182, 0x007f, 0x0a04, 0x35ea,
-+ 0x9186, 0x00ff, 0x0904, 0x35ea, 0x9182, 0x0800, 0x1a04, 0x35ea,
-+ 0x2001, 0x9400, 0x080c, 0x5782, 0x1904, 0x35e7, 0x0804, 0x35b5,
-+ 0xa998, 0x080c, 0xb236, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186,
-+ 0x00ff, 0x0168, 0x9182, 0x0800, 0x1250, 0x2001, 0x9400, 0x080c,
-+ 0x5782, 0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-+ 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-+ 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009,
-+ 0x000a, 0x0c48, 0x080c, 0x100e, 0x0198, 0x9006, 0xa802, 0x7014,
-+ 0x9005, 0x1120, 0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802,
-+ 0x0086, 0x2040, 0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001,
-+ 0x0005, 0x7984, 0x080c, 0x671d, 0x1130, 0x7e88, 0x9684, 0x3fff,
-+ 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c,
-+ 0x671d, 0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208,
-+ 0x905e, 0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c,
-+ 0x671d, 0x1108, 0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114,
-+ 0x81ff, 0x0128, 0x2148, 0xa904, 0x080c, 0x1040, 0x0cc8, 0x7116,
-+ 0x711a, 0x001e, 0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000,
-+ 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
-+ 0xa392, 0xa496, 0xa59a, 0x080c, 0x10f8, 0x7007, 0x0002, 0x701f,
-+ 0x35b5, 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000,
-+ 0x2001, 0x18b0, 0x2004, 0x9005, 0x1190, 0x0e04, 0x4c5f, 0x7a36,
-+ 0x7833, 0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001,
-+ 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x0804, 0x4cc5, 0x0016,
-+ 0x0086, 0x0096, 0x00c6, 0x00e6, 0x2071, 0x189e, 0x7044, 0x9005,
-+ 0x1540, 0x7148, 0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c,
-+ 0x100e, 0x0904, 0x4cbd, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001,
-+ 0x0002, 0x9080, 0x20c7, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0,
-+ 0x0004, 0x2001, 0x18ba, 0x9c82, 0x18fa, 0x0210, 0x2061, 0x18ba,
-+ 0x2c00, 0x703a, 0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a,
-+ 0x0460, 0x7148, 0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105,
-+ 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0dc5, 0x2060, 0x001e, 0x8108,
-+ 0x2105, 0x9005, 0xa146, 0x1520, 0x080c, 0x100e, 0x1130, 0x8109,
-+ 0xa946, 0x7148, 0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a,
-+ 0xa046, 0x2800, 0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002,
-+ 0x9080, 0x20c7, 0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a,
-+ 0x00ee, 0x00ce, 0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005,
-+ 0x2c00, 0x9082, 0x001b, 0x0002, 0x4ce7, 0x4ce7, 0x4ce9, 0x4ce7,
-+ 0x4ce7, 0x4ce7, 0x4ced, 0x4ce7, 0x4ce7, 0x4ce7, 0x4cf1, 0x4ce7,
-+ 0x4ce7, 0x4ce7, 0x4cf5, 0x4ce7, 0x4ce7, 0x4ce7, 0x4cf9, 0x4ce7,
-+ 0x4ce7, 0x4ce7, 0x4cfd, 0x4ce7, 0x4ce7, 0x4ce7, 0x4d02, 0x080c,
-+ 0x0dc5, 0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e,
-+ 0x0878, 0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae,
-+ 0x0838, 0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce,
-+ 0x0804, 0x4cc0, 0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4cc0, 0x00e6,
-+ 0x2071, 0x189e, 0x7048, 0x9005, 0x0904, 0x4d99, 0x0126, 0x2091,
-+ 0x8000, 0x0e04, 0x4d98, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096,
-+ 0x0086, 0x0076, 0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500,
-+ 0xa948, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0dc5, 0x2060,
-+ 0x001e, 0x8108, 0x2105, 0x9005, 0xa94a, 0x1904, 0x4d9b, 0xa804,
-+ 0x9005, 0x090c, 0x0dc5, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000,
-+ 0x2001, 0x0002, 0x9080, 0x20c7, 0x2005, 0xa04a, 0x0804, 0x4d9b,
-+ 0x703c, 0x2060, 0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836,
-+ 0x7833, 0x0012, 0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091,
-+ 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x87ff,
-+ 0x0118, 0x2748, 0x080c, 0x1040, 0x7048, 0x8001, 0x704a, 0x9005,
-+ 0x1170, 0x7040, 0x2048, 0x9005, 0x0128, 0x080c, 0x1040, 0x9006,
-+ 0x7042, 0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba, 0x0420, 0x7040,
-+ 0x9005, 0x1508, 0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004,
-+ 0x90fa, 0x18fa, 0x0210, 0x2001, 0x18ba, 0x703e, 0x00a0, 0x9006,
-+ 0x703e, 0x703a, 0x7044, 0x9005, 0x090c, 0x0dc5, 0x2048, 0xa800,
-+ 0x9005, 0x1de0, 0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x20c7,
-+ 0x2005, 0xa84a, 0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe,
-+ 0x012e, 0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4dba,
-+ 0x4dba, 0x4dbc, 0x4dba, 0x4dba, 0x4dba, 0x4dc1, 0x4dba, 0x4dba,
-+ 0x4dba, 0x4dc6, 0x4dba, 0x4dba, 0x4dba, 0x4dcb, 0x4dba, 0x4dba,
-+ 0x4dba, 0x4dd0, 0x4dba, 0x4dba, 0x4dba, 0x4dd5, 0x4dba, 0x4dba,
-+ 0x4dba, 0x4dda, 0x080c, 0x0dc5, 0xaa74, 0xab78, 0xac7c, 0x0804,
-+ 0x4d46, 0xaa84, 0xab88, 0xac8c, 0x0804, 0x4d46, 0xaa94, 0xab98,
-+ 0xac9c, 0x0804, 0x4d46, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x4d46,
-+ 0xaab4, 0xabb8, 0xacbc, 0x0804, 0x4d46, 0xaac4, 0xabc8, 0xaccc,
-+ 0x0804, 0x4d46, 0xaad4, 0xabd8, 0xacdc, 0x0804, 0x4d46, 0x0016,
-+ 0x0026, 0x0036, 0x00b6, 0x00c6, 0x2009, 0x007e, 0x080c, 0x671d,
-+ 0x2019, 0x0001, 0xb85c, 0xd0ac, 0x0110, 0x2019, 0x0000, 0x2011,
-+ 0x801b, 0x080c, 0x4c42, 0x00ce, 0x00be, 0x003e, 0x002e, 0x001e,
-+ 0x0005, 0x0026, 0x080c, 0x57d3, 0xd0c4, 0x0120, 0x2011, 0x8014,
-+ 0x080c, 0x4c42, 0x002e, 0x0005, 0x81ff, 0x1904, 0x35e7, 0x0126,
-+ 0x2091, 0x8000, 0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c,
-+ 0x7630, 0x1158, 0x080c, 0x792b, 0x080c, 0x6127, 0x9085, 0x0001,
-+ 0x080c, 0x7674, 0x080c, 0x755c, 0x0010, 0x080c, 0x5fe6, 0x012e,
-+ 0x0804, 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7,
-+ 0x080c, 0x57e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7, 0x080c,
-+ 0x6a94, 0x0120, 0x2009, 0x0008, 0x0804, 0x35e7, 0x2001, 0x180d,
-+ 0x2004, 0xd08c, 0x0178, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac0,
-+ 0x002e, 0x0140, 0x7984, 0x080c, 0x6b0a, 0x1120, 0x2009, 0x4009,
-+ 0x0804, 0x35e7, 0x7984, 0x080c, 0x66b2, 0x1904, 0x35ea, 0x080c,
-+ 0x4c15, 0x0904, 0x35ea, 0x2b00, 0x7026, 0x080c, 0x6a9c, 0x7888,
-+ 0x1170, 0x9084, 0x0005, 0x1158, 0x900e, 0x080c, 0x693d, 0x1108,
-+ 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x35b5, 0x080c,
-+ 0x4be2, 0x0904, 0x35e7, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd,
-+ 0xa86a, 0x080c, 0xd2fb, 0x0904, 0x35e7, 0x7888, 0xd094, 0x0118,
-+ 0xb8cc, 0xc08d, 0xb8ce, 0x7007, 0x0003, 0x701f, 0x4ec9, 0x0005,
-+ 0x2061, 0x1800, 0x080c, 0x57e7, 0x2009, 0x0007, 0x1560, 0x080c,
-+ 0x6a94, 0x0118, 0x2009, 0x0008, 0x0430, 0xa998, 0x080c, 0x66b2,
-+ 0x1530, 0x080c, 0x4c13, 0x0518, 0x080c, 0x6a9c, 0xa89c, 0x1168,
-+ 0x9084, 0x0005, 0x1150, 0x900e, 0x080c, 0x693d, 0x1108, 0xc185,
-+ 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a,
-+ 0x080c, 0xd2fb, 0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8cc, 0xc08d,
-+ 0xb8ce, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-+ 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-+ 0x4000, 0xa99a, 0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006,
-+ 0x0005, 0xa830, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0140, 0x2008,
-+ 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x35b7, 0x9086,
-+ 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x5727, 0x900e, 0x080c,
-+ 0x693d, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
-+ 0x35b5, 0x080c, 0x57e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7,
-+ 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4be2, 0x1120,
-+ 0x2009, 0x0002, 0x0804, 0x35e7, 0x900e, 0x2130, 0x7126, 0x7132,
-+ 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0,
-+ 0x080c, 0x671d, 0x1904, 0x4f7f, 0x080c, 0x6a9c, 0x0138, 0x080c,
-+ 0x6aa4, 0x0120, 0x080c, 0x6a3c, 0x1904, 0x4f7f, 0xd794, 0x1110,
-+ 0xd784, 0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098,
-+ 0x3400, 0xd794, 0x0198, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0,
-+ 0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c, 0x49b1, 0x0080, 0xb8c4,
-+ 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x3400, 0x20a9, 0x0004,
-+ 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x49b1, 0x9186,
-+ 0x007e, 0x0170, 0x9186, 0x0080, 0x0158, 0x080c, 0x6a9c, 0x90c2,
-+ 0x0006, 0x1210, 0xc1fd, 0x0020, 0x080c, 0x693d, 0x1108, 0xc1fd,
-+ 0x4104, 0xc1fc, 0xd794, 0x0528, 0xb8c4, 0x20e0, 0xb8c8, 0x2060,
-+ 0x9c80, 0x0000, 0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003,
-+ 0x2098, 0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400,
-+ 0x20a9, 0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c,
-+ 0x49a4, 0x9c80, 0x0026, 0x2098, 0xb8c4, 0x20e0, 0x20a9, 0x0002,
-+ 0x4003, 0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108,
-+ 0x080c, 0xb236, 0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120,
-+ 0x9186, 0x0800, 0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794,
-+ 0x0118, 0x9686, 0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804,
-+ 0x4f08, 0x86ff, 0x1120, 0x7124, 0x810b, 0x0804, 0x35b5, 0x7033,
-+ 0x0001, 0x7122, 0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18b8,
-+ 0x2c44, 0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076,
-+ 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10f8, 0x7007, 0x0002,
-+ 0x701f, 0x4fbb, 0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028,
-+ 0x20a0, 0x772c, 0x9036, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44,
-+ 0xa28c, 0xa390, 0xa494, 0xa598, 0x0804, 0x4f08, 0x7124, 0x810b,
-+ 0x0804, 0x35b5, 0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98,
-+ 0x9184, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502,
-+ 0x0a04, 0x35ea, 0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35ea,
-+ 0x9502, 0x0a04, 0x35ea, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020,
-+ 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9284, 0x00ff, 0x90e2,
-+ 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x9384, 0xff00,
-+ 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04, 0x35ea,
-+ 0x9384, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35ea, 0x9502, 0x0a04,
-+ 0x35ea, 0x9484, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35ea,
-+ 0x9502, 0x0a04, 0x35ea, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04,
-+ 0x35ea, 0x9502, 0x0a04, 0x35ea, 0x2061, 0x1989, 0x6102, 0x6206,
-+ 0x630a, 0x640e, 0x0804, 0x35b5, 0x080c, 0x4be2, 0x0904, 0x35e7,
-+ 0x2009, 0x0016, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
-+ 0x0019, 0xaf60, 0x080c, 0x4c2b, 0x701f, 0x503f, 0x0005, 0x20a9,
-+ 0x0016, 0x896e, 0x8d6e, 0x8d6f, 0x9d84, 0xffc0, 0x9080, 0x0019,
-+ 0x2098, 0x9d84, 0x003f, 0x20e0, 0x2069, 0x1877, 0x20e9, 0x0001,
-+ 0x2da0, 0x4003, 0x6800, 0x9005, 0x0904, 0x50a6, 0x6804, 0x2008,
-+ 0x918c, 0xfff8, 0x1904, 0x50a6, 0x680c, 0x9005, 0x0904, 0x50a6,
-+ 0x9082, 0xff01, 0x1a04, 0x50a6, 0x6810, 0x9082, 0x005c, 0x06f0,
-+ 0x6824, 0x2008, 0x9082, 0x0008, 0x06c8, 0x9182, 0x0400, 0x16b0,
-+ 0x0056, 0x2029, 0x0000, 0x080c, 0x8e79, 0x005e, 0x6944, 0x6820,
-+ 0x9102, 0x0660, 0x6820, 0x9082, 0x0019, 0x1640, 0x6828, 0x6944,
-+ 0x810c, 0x9102, 0x0618, 0x6840, 0x9082, 0x000f, 0x12f8, 0x080c,
-+ 0x1027, 0x2900, 0x0590, 0x684e, 0x00e6, 0x2071, 0x1931, 0x00b6,
-+ 0x2059, 0x0000, 0x080c, 0x8d35, 0x00be, 0x00ee, 0x01e8, 0x080c,
-+ 0x8a7d, 0x080c, 0x8acc, 0x1160, 0x6857, 0x0000, 0x00c6, 0x6b10,
-+ 0x2061, 0x1a65, 0x630a, 0x00ce, 0x0804, 0x35b5, 0x0804, 0x35ea,
-+ 0x080c, 0x8ac5, 0x00e6, 0x2071, 0x1931, 0x080c, 0x8ef9, 0x080c,
-+ 0x8f08, 0x080c, 0x8d1a, 0x00ee, 0x2001, 0x188a, 0x204c, 0x080c,
-+ 0x1040, 0x2001, 0x188a, 0x2003, 0x0000, 0x0804, 0x35e7, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x92b8, 0x080c, 0x8ac5, 0x012e, 0x0804,
-+ 0x35b5, 0x0006, 0x080c, 0x57d3, 0xd0cc, 0x000e, 0x0005, 0x0006,
-+ 0x080c, 0x57d7, 0xd0bc, 0x000e, 0x0005, 0x6174, 0x7a84, 0x6300,
-+ 0x82ff, 0x1118, 0x7986, 0x0804, 0x35b5, 0x83ff, 0x1904, 0x35ea,
-+ 0x2001, 0xfff0, 0x9200, 0x1a04, 0x35ea, 0x2019, 0xffff, 0x6078,
-+ 0x9302, 0x9200, 0x0a04, 0x35ea, 0x7986, 0x6276, 0x0804, 0x35b5,
-+ 0x080c, 0x57e7, 0x1904, 0x35e7, 0x7c88, 0x7d84, 0x7e98, 0x7f8c,
-+ 0x080c, 0x4be2, 0x0904, 0x35e7, 0x900e, 0x901e, 0x7326, 0x7332,
-+ 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0,
-+ 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6a9c, 0x0118,
-+ 0x080c, 0x6aa4, 0x1148, 0x20a9, 0x0001, 0xb814, 0x4004, 0xb810,
-+ 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120,
-+ 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e,
-+ 0x2001, 0x0003, 0x080c, 0x936e, 0x2208, 0x0804, 0x35b5, 0x7033,
-+ 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061, 0x18b8, 0x2c44,
-+ 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034, 0xa072, 0xa48e,
-+ 0xa592, 0xa696, 0xa79a, 0x080c, 0x10f8, 0x7007, 0x0002, 0x701f,
-+ 0x514a, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120, 0x7028, 0x20a0,
-+ 0x901e, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa48c, 0xa590,
-+ 0xa694, 0xa798, 0x0804, 0x5108, 0x7224, 0x900e, 0x2001, 0x0003,
-+ 0x080c, 0x936e, 0x2208, 0x0804, 0x35b5, 0x00f6, 0x00e6, 0x080c,
-+ 0x57e7, 0x2009, 0x0007, 0x1904, 0x51dd, 0x2071, 0x189e, 0x745c,
-+ 0x84ff, 0x2009, 0x000e, 0x1904, 0x51dd, 0xac9c, 0xad98, 0xaea4,
-+ 0xafa0, 0x0096, 0x080c, 0x1027, 0x2009, 0x0002, 0x0904, 0x51dd,
-+ 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362, 0xa860, 0x7066,
-+ 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c,
-+ 0x8bff, 0x0178, 0x080c, 0x6a9c, 0x0118, 0x080c, 0x6aa4, 0x1148,
-+ 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398,
-+ 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x01e8,
-+ 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c,
-+ 0x936e, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff,
-+ 0x090c, 0x0dc5, 0x2148, 0x080c, 0x1040, 0x9006, 0x705e, 0x918d,
-+ 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300,
-+ 0x7056, 0x2061, 0x18b9, 0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064,
-+ 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f, 0x51e9, 0x000e,
-+ 0xa0a2, 0x080c, 0x10f8, 0x9006, 0x0048, 0x009e, 0xa897, 0x4005,
-+ 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe,
-+ 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0dc5, 0x00e6, 0x2071,
-+ 0x189e, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b, 0x0030, 0xa883,
-+ 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005, 0x1158, 0x7150,
-+ 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694,
-+ 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-+ 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x936e, 0xaa9a, 0x715c,
-+ 0x81ff, 0x090c, 0x0dc5, 0x2148, 0x080c, 0x1040, 0x705f, 0x0000,
-+ 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e,
-+ 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8,
-+ 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6a9c, 0x0118, 0x080c,
-+ 0x6aa4, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004,
- 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386,
-- 0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001,
-- 0x0003, 0x080c, 0x9375, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a,
-- 0x715c, 0x81ff, 0x090c, 0x0dc5, 0x2148, 0x080c, 0x1040, 0x9006,
-- 0x705e, 0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152,
-- 0x7054, 0x9300, 0x7056, 0x2061, 0x18b9, 0x2c44, 0xa37a, 0x7058,
-- 0xa076, 0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f,
-- 0x51eb, 0x000e, 0xa0a2, 0x080c, 0x10f8, 0x9006, 0x0048, 0x009e,
-- 0xa897, 0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-- 0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0dc5,
-- 0x00e6, 0x2071, 0x189e, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b,
-- 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005,
-- 0x1158, 0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c,
-- 0xa590, 0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000,
-- 0xa897, 0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x9375,
-- 0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0dc5, 0x2148, 0x080c, 0x1040,
-- 0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x6e9f, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe,
-- 0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6aa3,
-- 0x0118, 0x080c, 0x6aab, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004,
-- 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800,
-- 0x0120, 0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154,
-- 0x810c, 0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0dc5,
-- 0x2148, 0x080c, 0x1040, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008,
-- 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e,
-- 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152,
-- 0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a,
-- 0x080c, 0x10f8, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be,
-- 0x7000, 0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118,
-- 0x009e, 0x0804, 0x35ea, 0xa884, 0xa988, 0x080c, 0x2873, 0x1518,
-- 0x080c, 0x66b9, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c,
-- 0x4be4, 0x01c8, 0x080c, 0x4be4, 0x01b0, 0x009e, 0xa867, 0x0000,
-- 0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c,
-- 0xd284, 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003,
-- 0x701f, 0x52b8, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x35e7,
-- 0x7124, 0x080c, 0x334c, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009,
-- 0x0004, 0x0804, 0x35e7, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048,
-- 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e,
-- 0x9080, 0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8,
-- 0x20a9, 0x002a, 0x080c, 0x0f8b, 0xaa6c, 0xab70, 0xac74, 0xad78,
-- 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6,
-- 0x7000, 0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600,
-- 0x2009, 0x0004, 0x000e, 0x007e, 0x0804, 0x4c30, 0x97c6, 0x7200,
-- 0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18b8,
-- 0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496,
-- 0xa59a, 0x080c, 0x10f8, 0x7007, 0x0002, 0x701f, 0x5314, 0x0005,
-- 0x000e, 0x007e, 0x0804, 0x35ea, 0x7020, 0x2048, 0xa804, 0x2048,
-- 0xa804, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-- 0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9,
-- 0x002a, 0x080c, 0x0f8b, 0x2100, 0x2238, 0x2061, 0x18b8, 0x2c44,
-- 0xa28c, 0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x4c30,
-- 0x81ff, 0x1904, 0x35e7, 0x798c, 0x2001, 0x197e, 0x918c, 0x8000,
-- 0x2102, 0x080c, 0x4bfb, 0x0904, 0x35ea, 0x080c, 0x6aa3, 0x0120,
-- 0x080c, 0x6aab, 0x1904, 0x35ea, 0x080c, 0x67eb, 0x0904, 0x35e7,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x68b1, 0x012e, 0x0904, 0x35e7,
-- 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1904, 0x35b5, 0x0804, 0x460c,
-- 0xa9a0, 0x2001, 0x197e, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
-- 0x4c08, 0x01a0, 0x080c, 0x6aa3, 0x0118, 0x080c, 0x6aab, 0x1170,
-- 0x080c, 0x67eb, 0x2009, 0x0002, 0x0128, 0x080c, 0x68b1, 0x1170,
-- 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-- 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-- 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x57dd, 0x0110,
-- 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
-- 0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904, 0x4581, 0x080c, 0x4c17,
-- 0x0904, 0x35ea, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804,
-- 0x35e7, 0x080c, 0x6aa3, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e,
-- 0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802,
-- 0x0028, 0x080c, 0x57d5, 0xd0b4, 0x0904, 0x45bb, 0x7884, 0x908e,
-- 0x007e, 0x0904, 0x45bb, 0x908e, 0x007f, 0x0904, 0x45bb, 0x908e,
-- 0x0080, 0x0904, 0x45bb, 0xb800, 0xd08c, 0x1904, 0x45bb, 0xa867,
-- 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd2a3, 0x1120, 0x2009,
-- 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x53e0, 0x0005,
-- 0x080c, 0x4c17, 0x0904, 0x35ea, 0x0804, 0x45bb, 0x080c, 0x33a5,
-- 0x0108, 0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x0120, 0x2009,
-- 0x0001, 0x0804, 0x35e7, 0x080c, 0x57e9, 0x0120, 0x2009, 0x0007,
-- 0x0804, 0x35e7, 0x080c, 0x6a9b, 0x0120, 0x2009, 0x0008, 0x0804,
-- 0x35e7, 0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x45bb, 0x9006,
-- 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd302, 0x1120,
-- 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x5419,
-- 0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804,
-- 0x5729, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x0804, 0x53b2, 0x81ff,
-- 0x2009, 0x0001, 0x1904, 0x35e7, 0x080c, 0x57e9, 0x2009, 0x0007,
-- 0x1904, 0x35e7, 0x080c, 0x6a9b, 0x0120, 0x2009, 0x0008, 0x0804,
-- 0x35e7, 0x080c, 0x4c17, 0x0904, 0x35ea, 0x080c, 0x6aa3, 0x2009,
-- 0x0009, 0x1904, 0x35e7, 0x080c, 0x4be4, 0x2009, 0x0002, 0x0904,
-- 0x35e7, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988,
-- 0xa95a, 0x9194, 0xfd00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128,
-- 0xc0ed, 0xa952, 0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904,
-- 0x35ea, 0xc0e5, 0xa952, 0xa956, 0xa83e, 0x080c, 0xd555, 0x2009,
-- 0x0003, 0x0904, 0x35e7, 0x7007, 0x0003, 0x701f, 0x5470, 0x0005,
-- 0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x35e7, 0x0804,
-- 0x35b5, 0x7aa8, 0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c,
-- 0x57e9, 0x1188, 0x2009, 0x0014, 0x0804, 0x35e7, 0xd2dc, 0x1578,
-- 0x81ff, 0x2009, 0x0001, 0x1904, 0x35e7, 0x080c, 0x57e9, 0x2009,
-- 0x0007, 0x1904, 0x35e7, 0xd2f4, 0x0138, 0x9284, 0x5000, 0xc0d5,
-- 0x080c, 0x57af, 0x0804, 0x35b5, 0xd2fc, 0x0160, 0x080c, 0x4c17,
-- 0x0904, 0x35ea, 0x7984, 0x9284, 0x9000, 0xc0d5, 0x080c, 0x5784,
-- 0x0804, 0x35b5, 0x080c, 0x4c17, 0x0904, 0x35ea, 0xb804, 0x9084,
-- 0x00ff, 0x9086, 0x0006, 0x2009, 0x0009, 0x1904, 0x555f, 0x080c,
-- 0x4be4, 0x2009, 0x0002, 0x0904, 0x555f, 0xa85c, 0x9080, 0x001b,
-- 0xaf60, 0x2009, 0x0008, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c,
-- 0x4c2d, 0x701f, 0x54cc, 0x0005, 0xa86c, 0x9086, 0x0500, 0x1138,
-- 0xa870, 0x9005, 0x1120, 0xa874, 0x9084, 0xff00, 0x0110, 0x1904,
-- 0x35ea, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4c17,
-- 0x1110, 0x0804, 0x35ea, 0x2009, 0x0043, 0x080c, 0xd5c1, 0x2009,
-- 0x0003, 0x0904, 0x555f, 0x7007, 0x0003, 0x701f, 0x54f0, 0x0005,
-- 0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x555f, 0x7984,
-- 0x7aa8, 0x9284, 0x1000, 0xc0d5, 0x080c, 0x5784, 0x0804, 0x35b5,
-- 0x00c6, 0xaab0, 0x9284, 0xc000, 0x0148, 0xd2ec, 0x0170, 0x080c,
-- 0x57e9, 0x1158, 0x2009, 0x0014, 0x0804, 0x554e, 0x2061, 0x1800,
-- 0x080c, 0x57e9, 0x2009, 0x0007, 0x15c8, 0xd2f4, 0x0130, 0x9284,
-- 0x5000, 0xc0d5, 0x080c, 0x57af, 0x0058, 0xd2fc, 0x0180, 0x080c,
-- 0x4c15, 0x0590, 0xa998, 0x9284, 0x9000, 0xc0d5, 0x080c, 0x5784,
-- 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438, 0x080c,
-- 0x4c15, 0x0510, 0x080c, 0x6aa3, 0x2009, 0x0009, 0x11b8, 0xa8c4,
-- 0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084,
-- 0xff00, 0x1190, 0x080c, 0x4c15, 0x1108, 0x0070, 0x2009, 0x004b,
-- 0x080c, 0xd5c1, 0x2009, 0x0003, 0x0108, 0x0078, 0x0431, 0x19c0,
-+ 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a,
-+ 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0dc5, 0x2148, 0x080c,
-+ 0x1040, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e, 0xa09f, 0x0000,
-+ 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300,
-+ 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10f8,
-+ 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be, 0x7000, 0x0148,
-+ 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118, 0x009e, 0x0804,
-+ 0x35ea, 0xa884, 0xa988, 0x080c, 0x2873, 0x1518, 0x080c, 0x66b2,
-+ 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4be2, 0x01c8,
-+ 0x080c, 0x4be2, 0x01b0, 0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd,
-+ 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c, 0xd27d, 0x1120,
-+ 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x52b6,
-+ 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x35e7, 0x7124, 0x080c,
-+ 0x334c, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009, 0x0004, 0x0804,
-+ 0x35e7, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048, 0x8906, 0x8006,
-+ 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e, 0x9080, 0x0002,
-+ 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a,
-+ 0x080c, 0x0f8b, 0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061, 0x18b8,
-+ 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118,
-+ 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600, 0x2009, 0x0004,
-+ 0x000e, 0x007e, 0x0804, 0x4c2e, 0x97c6, 0x7200, 0x11b8, 0x96c2,
-+ 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18b8, 0x2c44, 0xa076,
-+ 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c,
-+ 0x10f8, 0x7007, 0x0002, 0x701f, 0x5312, 0x0005, 0x000e, 0x007e,
-+ 0x0804, 0x35ea, 0x7020, 0x2048, 0xa804, 0x2048, 0xa804, 0x2048,
-+ 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-+ 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c,
-+ 0x0f8b, 0x2100, 0x2238, 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390,
-+ 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x4c2e, 0x81ff, 0x1904,
-+ 0x35e7, 0x798c, 0x2001, 0x197e, 0x918c, 0x8000, 0x2102, 0x080c,
-+ 0x4bf9, 0x0904, 0x35ea, 0x080c, 0x6a9c, 0x0120, 0x080c, 0x6aa4,
-+ 0x1904, 0x35ea, 0x080c, 0x67e4, 0x0904, 0x35e7, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x68aa, 0x012e, 0x0904, 0x35e7, 0x2001, 0x197e,
-+ 0x2004, 0xd0fc, 0x1904, 0x35b5, 0x0804, 0x460a, 0xa9a0, 0x2001,
-+ 0x197e, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c06, 0x01a0,
-+ 0x080c, 0x6a9c, 0x0118, 0x080c, 0x6aa4, 0x1170, 0x080c, 0x67e4,
-+ 0x2009, 0x0002, 0x0128, 0x080c, 0x68aa, 0x1170, 0x2009, 0x0003,
- 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-- 0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8,
-- 0xd2dc, 0x0904, 0x35e7, 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd,
-- 0x080c, 0x5784, 0x001e, 0x1904, 0x35e7, 0x0804, 0x35b5, 0x00f6,
-- 0x2d78, 0xaab0, 0x0021, 0x00fe, 0x0005, 0xaab0, 0xc2d5, 0xd2dc,
-- 0x0150, 0x0016, 0xa998, 0x9284, 0x1400, 0xc0fd, 0x080c, 0x5784,
-- 0x001e, 0x9085, 0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
-- 0x0804, 0x35e7, 0x080c, 0x57e9, 0x0120, 0x2009, 0x0007, 0x0804,
-- 0x35e7, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6724, 0x1904,
-- 0x35ea, 0x9186, 0x007f, 0x0138, 0x080c, 0x6aa3, 0x0120, 0x2009,
-- 0x0009, 0x0804, 0x35e7, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002,
-- 0x0804, 0x35e7, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001,
-- 0x0100, 0x8007, 0xa80a, 0x080c, 0xd2bd, 0x1120, 0x2009, 0x0003,
-- 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x55bf, 0x0005, 0xa808,
-- 0x8007, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x35e7,
-- 0xa8e0, 0xa866, 0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814,
-- 0x8007, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906,
-- 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004,
-- 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4c30, 0x080c, 0x4be4,
-- 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x7984, 0x9194, 0xff00,
-- 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x7023, 0x19b4, 0x0040,
-- 0x92c6, 0x0001, 0x1118, 0x7023, 0x19ce, 0x0010, 0x0804, 0x35ea,
-- 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
-- 0x0019, 0xaf60, 0x080c, 0x4c2d, 0x701f, 0x560f, 0x0005, 0x2001,
-- 0x182e, 0x2003, 0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860,
-- 0x20e0, 0x20a9, 0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003,
-- 0x0804, 0x35b5, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804,
-- 0x35e7, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff,
-- 0x1118, 0x2099, 0x19b4, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099,
-- 0x19ce, 0x0010, 0x0804, 0x35ea, 0xa85c, 0x9080, 0x0019, 0x20a0,
-- 0xa860, 0x20e8, 0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009,
-- 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019,
-- 0xaf60, 0x0804, 0x4c30, 0x7884, 0x908a, 0x1000, 0x1a04, 0x35ea,
-- 0x0126, 0x2091, 0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6,
-- 0x2061, 0x19fb, 0x614a, 0x00ce, 0x012e, 0x0804, 0x35b5, 0x00c6,
-- 0x080c, 0x7637, 0x1160, 0x080c, 0x7932, 0x080c, 0x612e, 0x9085,
-- 0x0001, 0x080c, 0x767b, 0x080c, 0x7563, 0x080c, 0x0dc5, 0x2061,
-- 0x1800, 0x6030, 0xc09d, 0x6032, 0x080c, 0x5fed, 0x00ce, 0x0005,
-- 0x00c6, 0x2001, 0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x35e7,
-- 0x7884, 0x9005, 0x0188, 0x7888, 0x2061, 0x199c, 0x2c0c, 0x2062,
-- 0x080c, 0x2c49, 0x01a0, 0x080c, 0x2c51, 0x0188, 0x080c, 0x2c59,
-- 0x0170, 0x2162, 0x0804, 0x35ea, 0x2061, 0x0100, 0x6038, 0x9086,
-- 0x0007, 0x1118, 0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884,
-- 0x9086, 0x0002, 0x1568, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a,
-- 0x0026, 0x2011, 0x0003, 0x080c, 0xaabf, 0x2011, 0x0002, 0x080c,
-- 0xaac9, 0x002e, 0x080c, 0xa9d3, 0x0036, 0x901e, 0x080c, 0xaa49,
-- 0x003e, 0x60e3, 0x0000, 0x080c, 0xf07f, 0x080c, 0xf09a, 0x9085,
-- 0x0001, 0x080c, 0x767b, 0x9006, 0x080c, 0x2d39, 0x2001, 0x1800,
-- 0x2003, 0x0004, 0x2001, 0x19a8, 0x2003, 0x0000, 0x6027, 0x0008,
-- 0x00ce, 0x0804, 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-- 0x35e7, 0x080c, 0x57e9, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7,
-- 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6724, 0x1904, 0x35ea,
-- 0x9186, 0x007f, 0x0138, 0x080c, 0x6aa3, 0x0120, 0x2009, 0x0009,
-- 0x0804, 0x35e7, 0x080c, 0x4be4, 0x1120, 0x2009, 0x0002, 0x0804,
-- 0x35e7, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd2c0,
-- 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f,
-- 0x5712, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004,
-- 0x0804, 0x35e7, 0xa8e0, 0xa866, 0xa834, 0x8007, 0x800c, 0xa85c,
-- 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xaf60, 0x0804,
-- 0x4c30, 0xa898, 0x9086, 0x000d, 0x1904, 0x35e7, 0x2021, 0x4005,
-- 0x0126, 0x2091, 0x8000, 0x0e04, 0x5736, 0x0010, 0x012e, 0x0cc0,
-- 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833,
-- 0x0010, 0x7883, 0x4005, 0xa998, 0x7986, 0xa9a4, 0x799a, 0xa9a8,
-- 0x799e, 0x080c, 0x4c20, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-- 0xd084, 0x190c, 0x11aa, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f,
-- 0x0000, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x00c6, 0x2061,
-- 0x19fb, 0x7984, 0x615a, 0x6156, 0x605f, 0x0000, 0x6053, 0x0009,
-- 0x7898, 0x6072, 0x789c, 0x606e, 0x7888, 0x606a, 0x788c, 0x6066,
-- 0x2001, 0x1a0b, 0x2044, 0x2001, 0x1a12, 0xa076, 0xa060, 0xa072,
-- 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b, 0x0000, 0xa09f, 0x0000,
-- 0x00ce, 0x012e, 0x0804, 0x35b5, 0x0126, 0x2091, 0x8000, 0x00b6,
-- 0x00c6, 0x90e4, 0xc000, 0x0168, 0x0006, 0xd0d4, 0x0130, 0x0036,
-- 0x2019, 0x0029, 0x080c, 0x336a, 0x003e, 0x080c, 0xd125, 0x000e,
-- 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004, 0x905d, 0x0160,
-- 0x080c, 0x6148, 0x080c, 0xb23d, 0x0110, 0xb817, 0x0000, 0x9006,
-- 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0126,
-- 0x2091, 0x8000, 0x0156, 0x2010, 0x900e, 0x20a9, 0x0800, 0x0016,
-- 0x9180, 0x1000, 0x2004, 0x9005, 0x0188, 0x9186, 0x007e, 0x0170,
-- 0x9186, 0x007f, 0x0158, 0x9186, 0x0080, 0x0140, 0x9186, 0x00ff,
-- 0x0128, 0x0026, 0x2200, 0x080c, 0x5784, 0x002e, 0x001e, 0x8108,
-- 0x1f04, 0x57b7, 0x015e, 0x012e, 0x0005, 0x2001, 0x1848, 0x2004,
-- 0x0005, 0x2001, 0x1867, 0x2004, 0x0005, 0x0006, 0x2001, 0x1810,
-- 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0b4,
-- 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x0005, 0x0016,
-- 0x00e6, 0x2071, 0x189e, 0x7108, 0x910d, 0x710a, 0x00ee, 0x001e,
-- 0x0005, 0x79a4, 0x81ff, 0x0904, 0x35ea, 0x9182, 0x0081, 0x1a04,
-- 0x35ea, 0x810c, 0x0016, 0x080c, 0x4be4, 0x0170, 0x080c, 0x0f16,
-- 0x2100, 0x2238, 0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c,
-- 0x4c2d, 0x701f, 0x5819, 0x0005, 0x001e, 0x2009, 0x0002, 0x0804,
-- 0x35e7, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4,
-- 0x810c, 0x2061, 0x18b8, 0x2c44, 0xa770, 0xa074, 0x2071, 0x189e,
-- 0x080c, 0x4c30, 0x701f, 0x582d, 0x0005, 0x2061, 0x18b8, 0x2c44,
-- 0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0f1e, 0x002e, 0x001e,
-- 0x080c, 0x0fcb, 0x9006, 0xa802, 0xa806, 0x0804, 0x35b5, 0x0126,
-- 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6,
-- 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800, 0x6044,
-- 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x59ed, 0x0068, 0xd08c,
-- 0x0118, 0x080c, 0x58f6, 0x0040, 0xd094, 0x0118, 0x080c, 0x58c6,
-- 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-- 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005, 0x0016,
-- 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68, 0x7030,
-- 0xd09c, 0x1120, 0x6004, 0x9085, 0x0002, 0x6006, 0x7098, 0x9005,
-- 0x0120, 0x709b, 0x0000, 0x7093, 0x0000, 0x624c, 0x9286, 0xf0f0,
-- 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130, 0x624a, 0x6043, 0x0090,
-- 0x6043, 0x0010, 0x0490, 0x9294, 0xff00, 0x9296, 0xf700, 0x0178,
-- 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295, 0x0100, 0x6242, 0x9294,
-- 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c, 0x60aa, 0x00f0, 0x6040,
-- 0x9084, 0x0010, 0x9085, 0x0140, 0x6042, 0x6043, 0x0000, 0x7087,
-- 0x0000, 0x70a3, 0x0001, 0x70c7, 0x0000, 0x70df, 0x0000, 0x2009,
-- 0x1c80, 0x200b, 0x0000, 0x7097, 0x0000, 0x708b, 0x000f, 0x2009,
-- 0x000f, 0x2011, 0x5f90, 0x080c, 0x88d5, 0x0005, 0x2001, 0x1869,
-- 0x2004, 0xd08c, 0x0110, 0x705f, 0xffff, 0x7088, 0x9005, 0x1528,
-- 0x2011, 0x5f90, 0x080c, 0x883d, 0x6040, 0x9094, 0x0010, 0x9285,
-- 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044, 0xd08c, 0x1168, 0x1f04,
-- 0x58dc, 0x6242, 0x709b, 0x0000, 0x6040, 0x9094, 0x0010, 0x9285,
-- 0x0080, 0x6042, 0x6242, 0x0048, 0x6242, 0x709b, 0x0000, 0x708f,
-- 0x0000, 0x9006, 0x080c, 0x6133, 0x0000, 0x0005, 0x708c, 0x908a,
-- 0x0003, 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0x5900, 0x5951, 0x59ec,
-- 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800, 0x708f, 0x0001, 0x2001,
-- 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc, 0x20a9, 0x0004, 0x6800,
-- 0x9084, 0x00fc, 0x0120, 0x1f04, 0x590f, 0x080c, 0x0dc5, 0x68a0,
-- 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a, 0xa001, 0x918d, 0x1600,
-- 0x6902, 0x001e, 0x6837, 0x0020, 0x080c, 0x610f, 0x2079, 0x1c00,
-- 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1, 0x0001, 0x2099, 0x1805,
-- 0x20e9, 0x0001, 0x20a1, 0x1c0e, 0x20a9, 0x0004, 0x4003, 0x080c,
-- 0xaf8e, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1,
-- 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x600f, 0x0000,
-- 0x080c, 0x5fc1, 0x00fe, 0x9006, 0x7092, 0x6043, 0x0008, 0x6042,
-- 0x0005, 0x00f6, 0x7090, 0x7093, 0x0000, 0x9025, 0x0904, 0x59c9,
-- 0x6020, 0xd0b4, 0x1904, 0x59c7, 0x71a0, 0x81ff, 0x0904, 0x59b5,
-- 0x9486, 0x000c, 0x1904, 0x59c2, 0x9480, 0x0018, 0x8004, 0x20a8,
-- 0x080c, 0x6108, 0x2011, 0x0260, 0x2019, 0x1c00, 0x220c, 0x2304,
-- 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04, 0x596e, 0x6043, 0x0004,
-- 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100,
-- 0x6043, 0x0006, 0x708f, 0x0002, 0x709b, 0x0002, 0x2009, 0x07d0,
-- 0x2011, 0x5f97, 0x080c, 0x88d5, 0x080c, 0x610f, 0x04c0, 0x080c,
-- 0x6108, 0x2079, 0x0260, 0x7930, 0x918e, 0x1101, 0x1558, 0x7834,
-- 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff, 0x1118, 0x7804, 0x9005,
-- 0x0190, 0x080c, 0x6108, 0x2011, 0x026e, 0x2019, 0x1805, 0x20a9,
-- 0x0004, 0x220c, 0x2304, 0x9102, 0x0230, 0x11a0, 0x8210, 0x8318,
-- 0x1f04, 0x59a9, 0x0078, 0x70a3, 0x0000, 0x080c, 0x6108, 0x20e1,
-- 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001, 0x20a1, 0x1c00, 0x20a9,
-- 0x0014, 0x4003, 0x6043, 0x0008, 0x6043, 0x0000, 0x0010, 0x00fe,
-- 0x0005, 0x6040, 0x9085, 0x0100, 0x6042, 0x6020, 0xd0b4, 0x1db8,
-- 0x080c, 0xaf8e, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000,
-- 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x2011,
-- 0x19f2, 0x2013, 0x0000, 0x7093, 0x0000, 0x60a3, 0x0056, 0x60a7,
-- 0x9575, 0x080c, 0xa6e0, 0x08d8, 0x0005, 0x7098, 0x908a, 0x001d,
-- 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0x5a1e, 0x5a31, 0x5a5a, 0x5a7a,
-- 0x5aa0, 0x5acf, 0x5af5, 0x5b2d, 0x5b53, 0x5b81, 0x5bbc, 0x5bf4,
-- 0x5c12, 0x5c3d, 0x5c5f, 0x5c7a, 0x5c84, 0x5cb8, 0x5cde, 0x5d0d,
-- 0x5d33, 0x5d6b, 0x5daf, 0x5dec, 0x5e0d, 0x5e66, 0x5e88, 0x5eb6,
-- 0x5eb6, 0x00c6, 0x2061, 0x1800, 0x6003, 0x0007, 0x2061, 0x0100,
-- 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce, 0x0005, 0x2061, 0x0140,
-- 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0002,
-- 0x709b, 0x0001, 0x2009, 0x07d0, 0x2011, 0x5f97, 0x080c, 0x88d5,
-- 0x0005, 0x00f6, 0x7090, 0x9086, 0x0014, 0x1510, 0x6042, 0x6020,
-- 0xd0b4, 0x11f0, 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296,
-- 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188, 0x7a38, 0xd2fc, 0x0128,
-- 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x2011, 0x5f97, 0x080c,
-- 0x883d, 0x709b, 0x0010, 0x080c, 0x5c84, 0x0010, 0x7093, 0x0000,
-- 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0003, 0x6043, 0x0004, 0x2011,
-- 0x5f97, 0x080c, 0x883d, 0x080c, 0x608c, 0x2079, 0x0240, 0x7833,
-- 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008, 0x9f88, 0x000e, 0x200b,
-- 0x0000, 0x8108, 0x1f04, 0x5a6f, 0x60c3, 0x0014, 0x080c, 0x5fc1,
-- 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5f97,
-- 0x080c, 0x883d, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6108, 0x2079,
-- 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178, 0x7834, 0x9005, 0x1160,
-- 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-- 0x709b, 0x0004, 0x0029, 0x0010, 0x080c, 0x60e4, 0x00fe, 0x0005,
-- 0x00f6, 0x709b, 0x0005, 0x080c, 0x608c, 0x2079, 0x0240, 0x7833,
-- 0x1103, 0x7837, 0x0000, 0x080c, 0x6108, 0x080c, 0x60eb, 0x1170,
-- 0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011,
-- 0x0008, 0x080c, 0x5f44, 0x0168, 0x080c, 0x60c1, 0x20a9, 0x0008,
-+ 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197e,
-+ 0x2004, 0xd0fc, 0x1128, 0x080c, 0x57db, 0x0110, 0x9006, 0x0018,
-+ 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c,
-+ 0x1118, 0xd084, 0x0904, 0x457f, 0x080c, 0x4c15, 0x0904, 0x35ea,
-+ 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x080c,
-+ 0x6a9c, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e, 0x0005, 0x15a0,
-+ 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802, 0x0028, 0x080c,
-+ 0x57d3, 0xd0b4, 0x0904, 0x45b9, 0x7884, 0x908e, 0x007e, 0x0904,
-+ 0x45b9, 0x908e, 0x007f, 0x0904, 0x45b9, 0x908e, 0x0080, 0x0904,
-+ 0x45b9, 0xb800, 0xd08c, 0x1904, 0x45b9, 0xa867, 0x0000, 0xa868,
-+ 0xc0fd, 0xa86a, 0x080c, 0xd29c, 0x1120, 0x2009, 0x0003, 0x0804,
-+ 0x35e7, 0x7007, 0x0003, 0x701f, 0x53de, 0x0005, 0x080c, 0x4c15,
-+ 0x0904, 0x35ea, 0x0804, 0x45b9, 0x080c, 0x33a5, 0x0108, 0x0005,
-+ 0x2009, 0x1834, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-+ 0x35e7, 0x080c, 0x57e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7,
-+ 0x080c, 0x6a94, 0x0120, 0x2009, 0x0008, 0x0804, 0x35e7, 0xb89c,
-+ 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x45b9, 0x9006, 0xa866, 0xa832,
-+ 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd2fb, 0x1120, 0x2009, 0x0003,
-+ 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x5417, 0x0005, 0xa830,
-+ 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x5727, 0x080c,
-+ 0x4c15, 0x0904, 0x35ea, 0x0804, 0x53b0, 0x81ff, 0x2009, 0x0001,
-+ 0x1904, 0x35e7, 0x080c, 0x57e7, 0x2009, 0x0007, 0x1904, 0x35e7,
-+ 0x080c, 0x6a94, 0x0120, 0x2009, 0x0008, 0x0804, 0x35e7, 0x080c,
-+ 0x4c15, 0x0904, 0x35ea, 0x080c, 0x6a9c, 0x2009, 0x0009, 0x1904,
-+ 0x35e7, 0x080c, 0x4be2, 0x2009, 0x0002, 0x0904, 0x35e7, 0x9006,
-+ 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988, 0xa95a, 0x9194,
-+ 0xfd00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952,
-+ 0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x35ea, 0xc0e5,
-+ 0xa952, 0xa956, 0xa83e, 0x080c, 0xd54e, 0x2009, 0x0003, 0x0904,
-+ 0x35e7, 0x7007, 0x0003, 0x701f, 0x546e, 0x0005, 0xa830, 0x9086,
-+ 0x0100, 0x2009, 0x0004, 0x0904, 0x35e7, 0x0804, 0x35b5, 0x7aa8,
-+ 0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x57e7, 0x1188,
-+ 0x2009, 0x0014, 0x0804, 0x35e7, 0xd2dc, 0x1578, 0x81ff, 0x2009,
-+ 0x0001, 0x1904, 0x35e7, 0x080c, 0x57e7, 0x2009, 0x0007, 0x1904,
-+ 0x35e7, 0xd2f4, 0x0138, 0x9284, 0x5000, 0xc0d5, 0x080c, 0x57ad,
-+ 0x0804, 0x35b5, 0xd2fc, 0x0160, 0x080c, 0x4c15, 0x0904, 0x35ea,
-+ 0x7984, 0x9284, 0x9000, 0xc0d5, 0x080c, 0x5782, 0x0804, 0x35b5,
-+ 0x080c, 0x4c15, 0x0904, 0x35ea, 0xb804, 0x9084, 0x00ff, 0x9086,
-+ 0x0006, 0x2009, 0x0009, 0x1904, 0x555d, 0x080c, 0x4be2, 0x2009,
-+ 0x0002, 0x0904, 0x555d, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009,
-+ 0x0008, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4c2b, 0x701f,
-+ 0x54ca, 0x0005, 0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005,
-+ 0x1120, 0xa874, 0x9084, 0xff00, 0x0110, 0x1904, 0x35ea, 0xa866,
-+ 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4c15, 0x1110, 0x0804,
-+ 0x35ea, 0x2009, 0x0043, 0x080c, 0xd5ba, 0x2009, 0x0003, 0x0904,
-+ 0x555d, 0x7007, 0x0003, 0x701f, 0x54ee, 0x0005, 0xa830, 0x9086,
-+ 0x0100, 0x2009, 0x0004, 0x0904, 0x555d, 0x7984, 0x7aa8, 0x9284,
-+ 0x1000, 0xc0d5, 0x080c, 0x5782, 0x0804, 0x35b5, 0x00c6, 0xaab0,
-+ 0x9284, 0xc000, 0x0148, 0xd2ec, 0x0170, 0x080c, 0x57e7, 0x1158,
-+ 0x2009, 0x0014, 0x0804, 0x554c, 0x2061, 0x1800, 0x080c, 0x57e7,
-+ 0x2009, 0x0007, 0x15c8, 0xd2f4, 0x0130, 0x9284, 0x5000, 0xc0d5,
-+ 0x080c, 0x57ad, 0x0058, 0xd2fc, 0x0180, 0x080c, 0x4c13, 0x0590,
-+ 0xa998, 0x9284, 0x9000, 0xc0d5, 0x080c, 0x5782, 0xa87b, 0x0000,
-+ 0xa883, 0x0000, 0xa897, 0x4000, 0x0438, 0x080c, 0x4c13, 0x0510,
-+ 0x080c, 0x6a9c, 0x2009, 0x0009, 0x11b8, 0xa8c4, 0x9086, 0x0500,
-+ 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084, 0xff00, 0x1190,
-+ 0x080c, 0x4c13, 0x1108, 0x0070, 0x2009, 0x004b, 0x080c, 0xd5ba,
-+ 0x2009, 0x0003, 0x0108, 0x0078, 0x0431, 0x19c0, 0xa897, 0x4005,
-+ 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-+ 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8, 0xd2dc, 0x0904,
-+ 0x35e7, 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5782,
-+ 0x001e, 0x1904, 0x35e7, 0x0804, 0x35b5, 0x00f6, 0x2d78, 0xaab0,
-+ 0x0021, 0x00fe, 0x0005, 0xaab0, 0xc2d5, 0xd2dc, 0x0150, 0x0016,
-+ 0xa998, 0x9284, 0x1400, 0xc0fd, 0x080c, 0x5782, 0x001e, 0x9085,
-+ 0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7,
-+ 0x080c, 0x57e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7, 0x7984,
-+ 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x671d, 0x1904, 0x35ea, 0x9186,
-+ 0x007f, 0x0138, 0x080c, 0x6a9c, 0x0120, 0x2009, 0x0009, 0x0804,
-+ 0x35e7, 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7,
-+ 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007,
-+ 0xa80a, 0x080c, 0xd2b6, 0x1120, 0x2009, 0x0003, 0x0804, 0x35e7,
-+ 0x7007, 0x0003, 0x701f, 0x55bd, 0x0005, 0xa808, 0x8007, 0x9086,
-+ 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x35e7, 0xa8e0, 0xa866,
-+ 0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084,
-+ 0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006, 0x8007,
-+ 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88,
-+ 0x7c9c, 0x7d98, 0x0804, 0x4c2e, 0x080c, 0x4be2, 0x1120, 0x2009,
-+ 0x0002, 0x0804, 0x35e7, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff,
-+ 0x8217, 0x82ff, 0x1118, 0x7023, 0x19b4, 0x0040, 0x92c6, 0x0001,
-+ 0x1118, 0x7023, 0x19ce, 0x0010, 0x0804, 0x35ea, 0x2009, 0x001a,
-+ 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60,
-+ 0x080c, 0x4c2b, 0x701f, 0x560d, 0x0005, 0x2001, 0x182e, 0x2003,
-+ 0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9,
-+ 0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804, 0x35b5,
-+ 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0x7984,
-+ 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099,
-+ 0x19b4, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x19ce, 0x0010,
-+ 0x0804, 0x35ea, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8,
-+ 0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c,
-+ 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804,
-+ 0x4c2e, 0x7884, 0x908a, 0x1000, 0x1a04, 0x35ea, 0x0126, 0x2091,
-+ 0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061, 0x19fb,
-+ 0x614a, 0x00ce, 0x012e, 0x0804, 0x35b5, 0x00c6, 0x080c, 0x7630,
-+ 0x1160, 0x080c, 0x792b, 0x080c, 0x6127, 0x9085, 0x0001, 0x080c,
-+ 0x7674, 0x080c, 0x755c, 0x080c, 0x0dc5, 0x2061, 0x1800, 0x6030,
-+ 0xc09d, 0x6032, 0x080c, 0x5fe6, 0x00ce, 0x0005, 0x00c6, 0x2001,
-+ 0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x35e7, 0x7884, 0x9005,
-+ 0x0188, 0x7888, 0x2061, 0x199c, 0x2c0c, 0x2062, 0x080c, 0x2c49,
-+ 0x01a0, 0x080c, 0x2c51, 0x0188, 0x080c, 0x2c59, 0x0170, 0x2162,
-+ 0x0804, 0x35ea, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007, 0x1118,
-+ 0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086, 0x0002,
-+ 0x1568, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x0026, 0x2011,
-+ 0x0003, 0x080c, 0xaab8, 0x2011, 0x0002, 0x080c, 0xaac2, 0x002e,
-+ 0x080c, 0xa9cc, 0x0036, 0x901e, 0x080c, 0xaa42, 0x003e, 0x60e3,
-+ 0x0000, 0x080c, 0xf078, 0x080c, 0xf093, 0x9085, 0x0001, 0x080c,
-+ 0x7674, 0x9006, 0x080c, 0x2d39, 0x2001, 0x1800, 0x2003, 0x0004,
-+ 0x2001, 0x19a8, 0x2003, 0x0000, 0x6027, 0x0008, 0x00ce, 0x0804,
-+ 0x35b5, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35e7, 0x080c,
-+ 0x57e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x35e7, 0x7984, 0x7ea8,
-+ 0x96b4, 0x00ff, 0x080c, 0x671d, 0x1904, 0x35ea, 0x9186, 0x007f,
-+ 0x0138, 0x080c, 0x6a9c, 0x0120, 0x2009, 0x0009, 0x0804, 0x35e7,
-+ 0x080c, 0x4be2, 0x1120, 0x2009, 0x0002, 0x0804, 0x35e7, 0xa867,
-+ 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd2b9, 0x1120, 0x2009,
-+ 0x0003, 0x0804, 0x35e7, 0x7007, 0x0003, 0x701f, 0x5710, 0x0005,
-+ 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x35e7,
-+ 0xa8e0, 0xa866, 0xa834, 0x8007, 0x800c, 0xa85c, 0x9080, 0x000c,
-+ 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xaf60, 0x0804, 0x4c2e, 0xa898,
-+ 0x9086, 0x000d, 0x1904, 0x35e7, 0x2021, 0x4005, 0x0126, 0x2091,
-+ 0x8000, 0x0e04, 0x5734, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486,
-+ 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7883,
-+ 0x4005, 0xa998, 0x7986, 0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c,
-+ 0x4c1e, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-+ 0x11aa, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e,
-+ 0x0005, 0x0126, 0x2091, 0x8000, 0x00c6, 0x2061, 0x19fb, 0x7984,
-+ 0x615a, 0x6156, 0x605f, 0x0000, 0x6053, 0x0009, 0x7898, 0x6072,
-+ 0x789c, 0x606e, 0x7888, 0x606a, 0x788c, 0x6066, 0x2001, 0x1a0b,
-+ 0x2044, 0x2001, 0x1a12, 0xa076, 0xa060, 0xa072, 0xa07b, 0x0001,
-+ 0xa07f, 0x0002, 0xa06b, 0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e,
-+ 0x0804, 0x35b5, 0x0126, 0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4,
-+ 0xc000, 0x0168, 0x0006, 0xd0d4, 0x0130, 0x0036, 0x2019, 0x0029,
-+ 0x080c, 0x336a, 0x003e, 0x080c, 0xd11e, 0x000e, 0x1198, 0xd0e4,
-+ 0x0160, 0x9180, 0x1000, 0x2004, 0x905d, 0x0160, 0x080c, 0x6141,
-+ 0x080c, 0xb236, 0x0110, 0xb817, 0x0000, 0x9006, 0x00ce, 0x00be,
-+ 0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000,
-+ 0x0156, 0x2010, 0x900e, 0x20a9, 0x0800, 0x0016, 0x9180, 0x1000,
-+ 0x2004, 0x9005, 0x0188, 0x9186, 0x007e, 0x0170, 0x9186, 0x007f,
-+ 0x0158, 0x9186, 0x0080, 0x0140, 0x9186, 0x00ff, 0x0128, 0x0026,
-+ 0x2200, 0x080c, 0x5782, 0x002e, 0x001e, 0x8108, 0x1f04, 0x57b5,
-+ 0x015e, 0x012e, 0x0005, 0x2001, 0x1848, 0x2004, 0x0005, 0x2001,
-+ 0x1867, 0x2004, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0d4,
-+ 0x000e, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0b4, 0x0005, 0x2001,
-+ 0x1800, 0x2004, 0x9086, 0x0003, 0x0005, 0x0016, 0x00e6, 0x2071,
-+ 0x189e, 0x7108, 0x910d, 0x710a, 0x00ee, 0x001e, 0x0005, 0x79a4,
-+ 0x81ff, 0x0904, 0x35ea, 0x9182, 0x0081, 0x1a04, 0x35ea, 0x810c,
-+ 0x0016, 0x080c, 0x4be2, 0x0170, 0x080c, 0x0f16, 0x2100, 0x2238,
-+ 0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x4c2b, 0x701f,
-+ 0x5817, 0x0005, 0x001e, 0x2009, 0x0002, 0x0804, 0x35e7, 0x2079,
-+ 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4, 0x810c, 0x2061,
-+ 0x18b8, 0x2c44, 0xa770, 0xa074, 0x2071, 0x189e, 0x080c, 0x4c2e,
-+ 0x701f, 0x582b, 0x0005, 0x2061, 0x18b8, 0x2c44, 0x0016, 0x0026,
-+ 0xa270, 0xa174, 0x080c, 0x0f1e, 0x002e, 0x001e, 0x080c, 0x0fcb,
-+ 0x9006, 0xa802, 0xa806, 0x0804, 0x35b5, 0x0126, 0x0156, 0x0136,
-+ 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2061,
-+ 0x0100, 0x2069, 0x0200, 0x2071, 0x1800, 0x6044, 0xd0a4, 0x11e8,
-+ 0xd084, 0x0118, 0x080c, 0x59e6, 0x0068, 0xd08c, 0x0118, 0x080c,
-+ 0x58ef, 0x0040, 0xd094, 0x0118, 0x080c, 0x58bf, 0x0018, 0xd09c,
-+ 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce,
-+ 0x014e, 0x013e, 0x015e, 0x012e, 0x0005, 0x0016, 0x6128, 0xd19c,
-+ 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68, 0x0006, 0x7098, 0x9005,
-+ 0x000e, 0x0120, 0x709b, 0x0000, 0x7093, 0x0000, 0x624c, 0x9286,
-+ 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130, 0x624a, 0x6043,
-+ 0x0090, 0x6043, 0x0010, 0x0490, 0x9294, 0xff00, 0x9296, 0xf700,
-+ 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295, 0x0100, 0x6242,
-+ 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c, 0x60a3, 0x00f0,
-+ 0x6040, 0x9084, 0x0010, 0x9085, 0x0140, 0x6042, 0x6043, 0x0000,
-+ 0x7087, 0x0000, 0x70a3, 0x0001, 0x70c7, 0x0000, 0x70df, 0x0000,
-+ 0x2009, 0x1c80, 0x200b, 0x0000, 0x7097, 0x0000, 0x708b, 0x000f,
-+ 0x2009, 0x000f, 0x2011, 0x5f89, 0x080c, 0x88ce, 0x0005, 0x2001,
-+ 0x1869, 0x2004, 0xd08c, 0x0110, 0x705f, 0xffff, 0x7088, 0x9005,
-+ 0x1528, 0x2011, 0x5f89, 0x080c, 0x8836, 0x6040, 0x9094, 0x0010,
-+ 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044, 0xd08c, 0x1168,
-+ 0x1f04, 0x58d5, 0x6242, 0x709b, 0x0000, 0x6040, 0x9094, 0x0010,
-+ 0x9285, 0x0080, 0x6042, 0x6242, 0x0048, 0x6242, 0x709b, 0x0000,
-+ 0x708f, 0x0000, 0x9006, 0x080c, 0x612c, 0x0000, 0x0005, 0x708c,
-+ 0x908a, 0x0003, 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0x58f9, 0x594a,
-+ 0x59e5, 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800, 0x708f, 0x0001,
-+ 0x2001, 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc, 0x20a9, 0x0004,
-+ 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04, 0x5908, 0x080c, 0x0dc5,
-+ 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a, 0xa001, 0x918d,
-+ 0x1600, 0x6902, 0x001e, 0x6837, 0x0020, 0x080c, 0x6108, 0x2079,
-+ 0x1c00, 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1, 0x0001, 0x2099,
-+ 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1c0e, 0x20a9, 0x0004, 0x4003,
-+ 0x080c, 0xaf87, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000,
-+ 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x600f,
-+ 0x0000, 0x080c, 0x5fba, 0x00fe, 0x9006, 0x7092, 0x6043, 0x0008,
-+ 0x6042, 0x0005, 0x00f6, 0x7090, 0x7093, 0x0000, 0x9025, 0x0904,
-+ 0x59c2, 0x6020, 0xd0b4, 0x1904, 0x59c0, 0x71a0, 0x81ff, 0x0904,
-+ 0x59ae, 0x9486, 0x000c, 0x1904, 0x59bb, 0x9480, 0x0018, 0x8004,
-+ 0x20a8, 0x080c, 0x6101, 0x2011, 0x0260, 0x2019, 0x1c00, 0x220c,
-+ 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04, 0x5967, 0x6043,
-+ 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061,
-+ 0x0100, 0x6043, 0x0006, 0x708f, 0x0002, 0x709b, 0x0002, 0x2009,
-+ 0x07d0, 0x2011, 0x5f90, 0x080c, 0x88ce, 0x080c, 0x6108, 0x04c0,
-+ 0x080c, 0x6101, 0x2079, 0x0260, 0x7930, 0x918e, 0x1101, 0x1558,
-+ 0x7834, 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff, 0x1118, 0x7804,
-+ 0x9005, 0x0190, 0x080c, 0x6101, 0x2011, 0x026e, 0x2019, 0x1805,
-+ 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102, 0x0230, 0x11a0, 0x8210,
-+ 0x8318, 0x1f04, 0x59a2, 0x0078, 0x70a3, 0x0000, 0x080c, 0x6101,
-+ 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001, 0x20a1, 0x1c00,
-+ 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008, 0x6043, 0x0000, 0x0010,
-+ 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100, 0x6042, 0x6020, 0xd0b4,
-+ 0x1db8, 0x080c, 0xaf87, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9,
-+ 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c,
-+ 0x2011, 0x19f2, 0x2013, 0x0000, 0x7093, 0x0000, 0x60a3, 0x0056,
-+ 0x60a7, 0x9575, 0x080c, 0xa6d9, 0x08d8, 0x0005, 0x7098, 0x908a,
-+ 0x001d, 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0x5a17, 0x5a2a, 0x5a53,
-+ 0x5a73, 0x5a99, 0x5ac8, 0x5aee, 0x5b26, 0x5b4c, 0x5b7a, 0x5bb5,
-+ 0x5bed, 0x5c0b, 0x5c36, 0x5c58, 0x5c73, 0x5c7d, 0x5cb1, 0x5cd7,
-+ 0x5d06, 0x5d2c, 0x5d64, 0x5da8, 0x5de5, 0x5e06, 0x5e5f, 0x5e81,
-+ 0x5eaf, 0x5eaf, 0x00c6, 0x2061, 0x1800, 0x6003, 0x0007, 0x2061,
-+ 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce, 0x0005, 0x2061,
-+ 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043,
-+ 0x0002, 0x709b, 0x0001, 0x2009, 0x07d0, 0x2011, 0x5f90, 0x080c,
-+ 0x88ce, 0x0005, 0x00f6, 0x7090, 0x9086, 0x0014, 0x1510, 0x6042,
-+ 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30,
-+ 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188, 0x7a38, 0xd2fc,
-+ 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x2011, 0x5f90,
-+ 0x080c, 0x8836, 0x709b, 0x0010, 0x080c, 0x5c7d, 0x0010, 0x7093,
-+ 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0003, 0x6043, 0x0004,
-+ 0x2011, 0x5f90, 0x080c, 0x8836, 0x080c, 0x6085, 0x2079, 0x0240,
-+ 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008, 0x9f88, 0x000e,
-+ 0x200b, 0x0000, 0x8108, 0x1f04, 0x5a68, 0x60c3, 0x0014, 0x080c,
-+ 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011,
-+ 0x5f90, 0x080c, 0x8836, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6101,
-+ 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178, 0x7834, 0x9005,
-+ 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-+ 0x0001, 0x709b, 0x0004, 0x0029, 0x0010, 0x080c, 0x60dd, 0x00fe,
-+ 0x0005, 0x00f6, 0x709b, 0x0005, 0x080c, 0x6085, 0x2079, 0x0240,
-+ 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x6101, 0x080c, 0x60e4,
-+ 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138,
-+ 0x2011, 0x0008, 0x080c, 0x5f3d, 0x0168, 0x080c, 0x60ba, 0x20a9,
-+ 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-+ 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5fba, 0x00fe, 0x0005,
-+ 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5f90, 0x080c, 0x8836,
-+ 0x9086, 0x0014, 0x11b8, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30,
-+ 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-+ 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0006,
-+ 0x0029, 0x0010, 0x080c, 0x60dd, 0x00fe, 0x0005, 0x00f6, 0x709b,
-+ 0x0007, 0x080c, 0x6085, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837,
-+ 0x0000, 0x080c, 0x6101, 0x080c, 0x60e4, 0x11b8, 0x7084, 0x9005,
-+ 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x33b6, 0x200d,
-+ 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5f3d, 0x0180,
-+ 0x080c, 0x50cf, 0x0110, 0x080c, 0x28dc, 0x20a9, 0x0008, 0x20e1,
-+ 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-+ 0x60c3, 0x0014, 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090,
-+ 0x9005, 0x0500, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0014,
-+ 0x11b8, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104,
-+ 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-+ 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0008, 0x0029, 0x0010,
-+ 0x080c, 0x60dd, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0009, 0x080c,
-+ 0x6085, 0x2079, 0x0240, 0x7833, 0x1105, 0x7837, 0x0100, 0x080c,
-+ 0x60e4, 0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5eb0, 0x1188,
-+ 0x9085, 0x0001, 0x080c, 0x28dc, 0x20a9, 0x0008, 0x080c, 0x6101,
- 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
-- 0x4003, 0x60c3, 0x0014, 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6,
-- 0x7090, 0x9005, 0x0500, 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086,
-- 0x0014, 0x11b8, 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296,
-- 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
-- 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0006, 0x0029,
-- 0x0010, 0x080c, 0x60e4, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0007,
-- 0x080c, 0x608c, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000,
-- 0x080c, 0x6108, 0x080c, 0x60eb, 0x11b8, 0x7084, 0x9005, 0x11a0,
-- 0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x33b6, 0x200d, 0x918c,
-- 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5f44, 0x0180, 0x080c,
-- 0x50d1, 0x0110, 0x080c, 0x28dc, 0x20a9, 0x0008, 0x20e1, 0x0000,
-- 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-- 0x0014, 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-- 0x0500, 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0014, 0x11b8,
-- 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178,
-- 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-- 0x1110, 0x70c7, 0x0001, 0x709b, 0x0008, 0x0029, 0x0010, 0x080c,
-- 0x60e4, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0009, 0x080c, 0x608c,
-- 0x2079, 0x0240, 0x7833, 0x1105, 0x7837, 0x0100, 0x080c, 0x60eb,
-- 0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5eb7, 0x1188, 0x9085,
-- 0x0001, 0x080c, 0x28dc, 0x20a9, 0x0008, 0x080c, 0x6108, 0x20e1,
-+ 0x4003, 0x60c3, 0x0014, 0x080c, 0x5fba, 0x0010, 0x080c, 0x5a0a,
-+ 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05a8, 0x2011, 0x5f90,
-+ 0x080c, 0x8836, 0x9086, 0x0014, 0x1560, 0x080c, 0x6101, 0x2079,
-+ 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834, 0x9084, 0x0100,
-+ 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-+ 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x000a, 0x00b1, 0x0098,
-+ 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
-+ 0x70c7, 0x0001, 0x7097, 0x0000, 0x709b, 0x000e, 0x080c, 0x5c58,
-+ 0x0010, 0x080c, 0x60dd, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000b,
-+ 0x2011, 0x1c0e, 0x20e9, 0x0001, 0x22a0, 0x20a9, 0x0040, 0x2019,
-+ 0xffff, 0x4304, 0x080c, 0x6085, 0x2079, 0x0240, 0x7833, 0x1106,
-+ 0x7837, 0x0000, 0x080c, 0x60e4, 0x0118, 0x2013, 0x0000, 0x0020,
-+ 0x7060, 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040, 0x2009, 0x024e,
-+ 0x2011, 0x1c0e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1128,
-+ 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5bda, 0x60c3,
-+ 0x0084, 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-+ 0x01c0, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0084, 0x1178,
-+ 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1138,
-+ 0x7834, 0x9005, 0x1120, 0x709b, 0x000c, 0x0029, 0x0010, 0x080c,
-+ 0x60dd, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000d, 0x080c, 0x6085,
-+ 0x2079, 0x0240, 0x7833, 0x1107, 0x7837, 0x0000, 0x080c, 0x6101,
-+ 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009, 0x024e, 0x220e, 0x8210,
-+ 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009,
-+ 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5c1e,
-+ 0x60c3, 0x0084, 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090,
-+ 0x9005, 0x01e0, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0084,
-+ 0x1198, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107,
-+ 0x1158, 0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x6057,
-+ 0x709b, 0x000e, 0x0029, 0x0010, 0x080c, 0x60dd, 0x00fe, 0x0005,
-+ 0x918d, 0x0001, 0x080c, 0x612c, 0x709b, 0x000f, 0x7093, 0x0000,
-+ 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5, 0x2061, 0x0100,
-+ 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0, 0x2011, 0x5f90,
-+ 0x080c, 0x882a, 0x0005, 0x7090, 0x9005, 0x0130, 0x2011, 0x5f90,
-+ 0x080c, 0x8836, 0x709b, 0x0000, 0x0005, 0x709b, 0x0011, 0x080c,
-+ 0xaf87, 0x080c, 0x6101, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-+ 0x0000, 0x20a1, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007,
-+ 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c, 0x60e4, 0x11a0,
-+ 0x717c, 0x81ff, 0x0188, 0x900e, 0x7080, 0x9084, 0x00ff, 0x0160,
-+ 0x080c, 0x2873, 0x9186, 0x007e, 0x0138, 0x9186, 0x0080, 0x0120,
-+ 0x2011, 0x0008, 0x080c, 0x5f3d, 0x60c3, 0x0014, 0x080c, 0x5fba,
-+ 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5f90, 0x080c,
-+ 0x8836, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6101, 0x2079, 0x0260,
-+ 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
-+ 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
-+ 0x0012, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6,
-+ 0x709b, 0x0013, 0x080c, 0x6093, 0x2079, 0x0240, 0x7833, 0x1103,
-+ 0x7837, 0x0000, 0x080c, 0x6101, 0x080c, 0x60e4, 0x1170, 0x7084,
-+ 0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008,
-+ 0x080c, 0x5f3d, 0x0168, 0x080c, 0x60ba, 0x20a9, 0x0008, 0x20e1,
- 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-- 0x60c3, 0x0014, 0x080c, 0x5fc1, 0x0010, 0x080c, 0x5a11, 0x00fe,
-- 0x0005, 0x00f6, 0x7090, 0x9005, 0x05a8, 0x2011, 0x5f97, 0x080c,
-- 0x883d, 0x9086, 0x0014, 0x1560, 0x080c, 0x6108, 0x2079, 0x0260,
-- 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834, 0x9084, 0x0100, 0x2011,
-- 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-- 0x1110, 0x70c7, 0x0001, 0x709b, 0x000a, 0x00b1, 0x0098, 0x9005,
-- 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-- 0x0001, 0x7097, 0x0000, 0x709b, 0x000e, 0x080c, 0x5c5f, 0x0010,
-- 0x080c, 0x60e4, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000b, 0x2011,
-- 0x1c0e, 0x20e9, 0x0001, 0x22a0, 0x20a9, 0x0040, 0x2019, 0xffff,
-- 0x4304, 0x080c, 0x608c, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837,
-- 0x0000, 0x080c, 0x60eb, 0x0118, 0x2013, 0x0000, 0x0020, 0x7060,
-- 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040, 0x2009, 0x024e, 0x2011,
-- 0x1c0e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810,
-- 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5be1, 0x60c3, 0x0084,
-- 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01c0,
-- 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0084, 0x1178, 0x080c,
-- 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1138, 0x7834,
-- 0x9005, 0x1120, 0x709b, 0x000c, 0x0029, 0x0010, 0x080c, 0x60e4,
-- 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000d, 0x080c, 0x608c, 0x2079,
-- 0x0240, 0x7833, 0x1107, 0x7837, 0x0000, 0x080c, 0x6108, 0x20a9,
-- 0x0040, 0x2011, 0x026e, 0x2009, 0x024e, 0x220e, 0x8210, 0x8108,
-- 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
-- 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5c25, 0x60c3,
-- 0x0084, 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-- 0x01e0, 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0084, 0x1198,
-- 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158,
-- 0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x605e, 0x709b,
-- 0x000e, 0x0029, 0x0010, 0x080c, 0x60e4, 0x00fe, 0x0005, 0x918d,
-- 0x0001, 0x080c, 0x6133, 0x709b, 0x000f, 0x7093, 0x0000, 0x2061,
-- 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5, 0x2061, 0x0100, 0x6043,
-- 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0, 0x2011, 0x5f97, 0x080c,
-- 0x8831, 0x0005, 0x7090, 0x9005, 0x0130, 0x2011, 0x5f97, 0x080c,
-- 0x883d, 0x709b, 0x0000, 0x0005, 0x709b, 0x0011, 0x080c, 0xaf8e,
-- 0x080c, 0x6108, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
-- 0x20a1, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084,
-- 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c, 0x60eb, 0x11a0, 0x717c,
-- 0x81ff, 0x0188, 0x900e, 0x7080, 0x9084, 0x00ff, 0x0160, 0x080c,
-- 0x2873, 0x9186, 0x007e, 0x0138, 0x9186, 0x0080, 0x0120, 0x2011,
-- 0x0008, 0x080c, 0x5f44, 0x60c3, 0x0014, 0x080c, 0x5fc1, 0x0005,
-- 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5f97, 0x080c, 0x883d,
-- 0x9086, 0x0014, 0x11b8, 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30,
-- 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-- 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0012,
-- 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
-- 0x0013, 0x080c, 0x609a, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837,
-- 0x0000, 0x080c, 0x6108, 0x080c, 0x60eb, 0x1170, 0x7084, 0x9005,
-- 0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c,
-- 0x5f44, 0x0168, 0x080c, 0x60c1, 0x20a9, 0x0008, 0x20e1, 0x0000,
-- 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-- 0x0014, 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-- 0x0500, 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0014, 0x11b8,
-- 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178,
-- 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-- 0x1110, 0x70c7, 0x0001, 0x709b, 0x0014, 0x0029, 0x0010, 0x7093,
-- 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0015, 0x080c, 0x609a,
-- 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x6108,
-- 0x080c, 0x60eb, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186,
-- 0xffff, 0x0180, 0x9180, 0x33b6, 0x200d, 0x918c, 0xff00, 0x810f,
-- 0x2011, 0x0008, 0x080c, 0x5f44, 0x0180, 0x080c, 0x50d1, 0x0110,
-- 0x080c, 0x28dc, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e,
-+ 0x60c3, 0x0014, 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090,
-+ 0x9005, 0x0500, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0014,
-+ 0x11b8, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104,
-+ 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-+ 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0014, 0x0029, 0x0010,
-+ 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0015, 0x080c,
-+ 0x6093, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c,
-+ 0x6101, 0x080c, 0x60e4, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164,
-+ 0x9186, 0xffff, 0x0180, 0x9180, 0x33b6, 0x200d, 0x918c, 0xff00,
-+ 0x810f, 0x2011, 0x0008, 0x080c, 0x5f3d, 0x0180, 0x080c, 0x50cf,
-+ 0x0110, 0x080c, 0x28dc, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099,
-+ 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014,
-+ 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05f0,
-+ 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0014, 0x15a8, 0x080c,
-+ 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1568, 0x7834,
-+ 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1168, 0x9085, 0x0001,
-+ 0x080c, 0x612c, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
-+ 0x70c7, 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38, 0xd2fc, 0x0128,
-+ 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x9085, 0x0001, 0x080c,
-+ 0x612c, 0x7097, 0x0000, 0x7a38, 0xd2f4, 0x0110, 0x70df, 0x0008,
-+ 0x709b, 0x0016, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005,
-+ 0x080c, 0xaf87, 0x080c, 0x6101, 0x20e1, 0x0000, 0x2099, 0x0260,
-+ 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e, 0x4003, 0x2011,
-+ 0x026d, 0x2204, 0x9084, 0x0100, 0x2011, 0x024d, 0x2012, 0x2011,
-+ 0x026e, 0x709b, 0x0017, 0x080c, 0x60e4, 0x1150, 0x7084, 0x9005,
-+ 0x1138, 0x080c, 0x5eb0, 0x1188, 0x9085, 0x0001, 0x080c, 0x28dc,
-+ 0x20a9, 0x0008, 0x080c, 0x6101, 0x20e1, 0x0000, 0x2099, 0x026e,
- 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c,
-- 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05f0, 0x2011,
-- 0x5f97, 0x080c, 0x883d, 0x9086, 0x0014, 0x15a8, 0x080c, 0x6108,
-- 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1568, 0x7834, 0x9084,
-- 0x0100, 0x2011, 0x0100, 0x921e, 0x1168, 0x9085, 0x0001, 0x080c,
-- 0x6133, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-- 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-- 0x9005, 0x1110, 0x70c7, 0x0001, 0x9085, 0x0001, 0x080c, 0x6133,
-- 0x7097, 0x0000, 0x7a38, 0xd2f4, 0x0110, 0x70df, 0x0008, 0x709b,
-- 0x0016, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x080c,
-- 0xaf8e, 0x080c, 0x6108, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-- 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e, 0x4003, 0x2011, 0x026d,
-- 0x2204, 0x9084, 0x0100, 0x2011, 0x024d, 0x2012, 0x2011, 0x026e,
-- 0x709b, 0x0017, 0x080c, 0x60eb, 0x1150, 0x7084, 0x9005, 0x1138,
-- 0x080c, 0x5eb7, 0x1188, 0x9085, 0x0001, 0x080c, 0x28dc, 0x20a9,
-- 0x0008, 0x080c, 0x6108, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-- 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5fc1,
-- 0x0010, 0x080c, 0x5a11, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01d8,
-- 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0084, 0x1190, 0x080c,
-- 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1150, 0x7834,
-- 0x9005, 0x1138, 0x9006, 0x080c, 0x6133, 0x709b, 0x0018, 0x0029,
-- 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0019,
-- 0x080c, 0x609a, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837, 0x0000,
-- 0x080c, 0x6108, 0x2009, 0x026e, 0x2039, 0x1c0e, 0x20a9, 0x0040,
-- 0x213e, 0x8738, 0x8108, 0x9186, 0x0280, 0x1128, 0x6814, 0x8000,
-- 0x6816, 0x2009, 0x0260, 0x1f04, 0x5e20, 0x2039, 0x1c0e, 0x080c,
-- 0x60eb, 0x11e8, 0x2728, 0x2514, 0x8207, 0x9084, 0x00ff, 0x8000,
-- 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205, 0x202a, 0x7060, 0x2310,
-- 0x8214, 0x92a0, 0x1c0e, 0x2414, 0x938c, 0x0001, 0x0118, 0x9294,
-- 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007, 0x9215, 0x2222, 0x20a9,
-- 0x0040, 0x2009, 0x024e, 0x270e, 0x8738, 0x8108, 0x9186, 0x0260,
-- 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5e53,
-- 0x60c3, 0x0084, 0x080c, 0x5fc1, 0x00fe, 0x0005, 0x00f6, 0x7090,
-- 0x9005, 0x01e0, 0x2011, 0x5f97, 0x080c, 0x883d, 0x9086, 0x0084,
-- 0x1198, 0x080c, 0x6108, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107,
-- 0x1158, 0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x605e,
-- 0x709b, 0x001a, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005,
-- 0x9085, 0x0001, 0x080c, 0x6133, 0x709b, 0x001b, 0x080c, 0xaf8e,
-- 0x080c, 0x6108, 0x2011, 0x0260, 0x2009, 0x0240, 0x7490, 0x9480,
-- 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x220e,
-- 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812,
-- 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04,
-- 0x5e9f, 0x60c3, 0x0084, 0x080c, 0x5fc1, 0x0005, 0x0005, 0x0086,
-- 0x0096, 0x2029, 0x1848, 0x252c, 0x20a9, 0x0008, 0x2041, 0x1c0e,
-- 0x20e9, 0x0001, 0x28a0, 0x080c, 0x6108, 0x20e1, 0x0000, 0x2099,
-- 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011, 0x0007, 0xd5d4, 0x0108,
-- 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6, 0xffff, 0x1148, 0xd5d4,
-- 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04, 0x5ed1, 0x0804, 0x5f40,
-- 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6, 0x3fff, 0x0d90, 0x0020,
-- 0x91a6, 0x3fff, 0x0904, 0x5f40, 0x918d, 0xc000, 0x20a9, 0x0010,
-- 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010, 0x2120, 0xd5d4,
-- 0x0110, 0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4, 0x0110, 0x8319,
-- 0x0008, 0x8318, 0x1f04, 0x5ef7, 0x04d8, 0x23a8, 0x2021, 0x0001,
-- 0x8426, 0x8425, 0x1f04, 0x5f09, 0x2328, 0x8529, 0x92be, 0x0007,
-- 0x0158, 0x0006, 0x2039, 0x0007, 0x2200, 0x973a, 0x000e, 0x27a8,
-- 0x95a8, 0x0010, 0x1f04, 0x5f18, 0x755e, 0x95c8, 0x33b6, 0x292d,
-- 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c,
-- 0x28bc, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018, 0x2304, 0x9405,
-- 0x201a, 0x7087, 0x0001, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x20e1,
-- 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003, 0x9085, 0x0001, 0x0008,
-- 0x9006, 0x009e, 0x008e, 0x0005, 0x0156, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-- 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e, 0x013e, 0x01de, 0x01ce,
-- 0x015e, 0x2118, 0x9026, 0x2001, 0x0007, 0x939a, 0x0010, 0x0218,
-- 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120, 0x939a, 0x0010,
-- 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118, 0x8423, 0x8319,
-- 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528, 0x2504, 0x942c, 0x11b8,
-- 0x9405, 0x203a, 0x715e, 0x91a0, 0x33b6, 0x242d, 0x95ac, 0x00ff,
-- 0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x28bc, 0x001e,
-- 0x60e7, 0x0000, 0x65ea, 0x7087, 0x0001, 0x9084, 0x0000, 0x0005,
-- 0x00e6, 0x2071, 0x1800, 0x708b, 0x0000, 0x00ee, 0x0005, 0x00e6,
-- 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140, 0x080c, 0x604d, 0x080c,
-- 0xa6e9, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2d49, 0x0126,
-- 0x2091, 0x8000, 0x2071, 0x1826, 0x2073, 0x0000, 0x7840, 0x0026,
-- 0x0016, 0x2009, 0x00f7, 0x080c, 0x60aa, 0x001e, 0x9094, 0x0010,
-- 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e, 0x012e, 0x00fe, 0x00ee,
-- 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x2bce, 0x0228, 0x2011,
-- 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011, 0x19f2, 0x2013, 0x0000,
-- 0x7093, 0x0000, 0x012e, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c,
-- 0xa6e0, 0x6144, 0xd184, 0x0120, 0x7198, 0x918d, 0x2000, 0x0018,
-- 0x718c, 0x918d, 0x1000, 0x2011, 0x1999, 0x2112, 0x2009, 0x07d0,
-- 0x2011, 0x5f97, 0x080c, 0x88d5, 0x0005, 0x0016, 0x0026, 0x00c6,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0xb244, 0x2009, 0x00f7, 0x080c,
-- 0x60aa, 0x2061, 0x19fb, 0x900e, 0x611a, 0x611e, 0x617a, 0x617e,
-- 0x2061, 0x1800, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090,
-- 0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d,
-- 0x2011, 0x6019, 0x080c, 0x8831, 0x012e, 0x00ce, 0x002e, 0x001e,
-- 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x0471, 0x2071,
-- 0x0100, 0x080c, 0xa6e9, 0x2071, 0x0140, 0x7004, 0x9084, 0x4000,
-- 0x0110, 0x080c, 0x2d49, 0x080c, 0x763f, 0x0188, 0x080c, 0x765a,
-- 0x1170, 0x080c, 0x793c, 0x0016, 0x080c, 0x298b, 0x2001, 0x196d,
-- 0x2102, 0x001e, 0x080c, 0x7937, 0x080c, 0x7563, 0x0050, 0x2009,
-- 0x0001, 0x080c, 0x2c67, 0x2001, 0x0001, 0x080c, 0x281c, 0x080c,
-- 0x5fed, 0x012e, 0x000e, 0x00ee, 0x0005, 0x2001, 0x180e, 0x2004,
-- 0xd0bc, 0x0158, 0x0026, 0x0036, 0x2011, 0x8017, 0x2001, 0x1999,
-- 0x201c, 0x080c, 0x4c44, 0x003e, 0x002e, 0x0005, 0x20a9, 0x0012,
-- 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x080c, 0x6108, 0x20e9, 0x0000,
-- 0x2099, 0x026e, 0x0099, 0x20a9, 0x0020, 0x080c, 0x6102, 0x2099,
-- 0x0260, 0x20a1, 0x1c92, 0x0051, 0x20a9, 0x000e, 0x080c, 0x6105,
-- 0x2099, 0x0260, 0x20a1, 0x1cb2, 0x0009, 0x0005, 0x0016, 0x0026,
-- 0x3410, 0x3308, 0x2104, 0x8007, 0x2012, 0x8108, 0x8210, 0x1f04,
-- 0x6082, 0x002e, 0x001e, 0x0005, 0x080c, 0xaf8e, 0x20e1, 0x0001,
-- 0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c,
-- 0x4003, 0x0005, 0x080c, 0xaf8e, 0x080c, 0x6108, 0x20e1, 0x0000,
-- 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c,
-- 0x4003, 0x0005, 0x00c6, 0x0006, 0x2061, 0x0100, 0x810f, 0x2001,
-- 0x1834, 0x2004, 0x9005, 0x1138, 0x2001, 0x1818, 0x2004, 0x9084,
-- 0x00ff, 0x9105, 0x0010, 0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce,
-- 0x0005, 0x0016, 0x0046, 0x080c, 0x6a9f, 0x0158, 0x9006, 0x2020,
-- 0x2009, 0x002a, 0x080c, 0xec31, 0x2001, 0x180c, 0x200c, 0xc195,
-- 0x2102, 0x2019, 0x002a, 0x900e, 0x080c, 0x321b, 0x080c, 0xd7e3,
-- 0x0140, 0x0036, 0x2019, 0xffff, 0x2021, 0x0007, 0x080c, 0x4dfb,
-- 0x003e, 0x004e, 0x001e, 0x0005, 0x080c, 0x5fed, 0x709b, 0x0000,
-- 0x7093, 0x0000, 0x0005, 0x0006, 0x2001, 0x180c, 0x2004, 0xd09c,
-- 0x0100, 0x000e, 0x0005, 0x0006, 0x0016, 0x0126, 0x2091, 0x8000,
-- 0x2001, 0x0101, 0x200c, 0x918d, 0x0006, 0x2102, 0x012e, 0x001e,
-- 0x000e, 0x0005, 0x2009, 0x0001, 0x0020, 0x2009, 0x0002, 0x0008,
-- 0x900e, 0x6814, 0x9084, 0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6,
-- 0x0156, 0x0146, 0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001,
-- 0x20a1, 0x1c00, 0x4004, 0x2079, 0x1c00, 0x7803, 0x2200, 0x7807,
-- 0x00ef, 0x780f, 0x00ef, 0x7813, 0x0138, 0x7823, 0xffff, 0x7827,
-- 0xffff, 0x01de, 0x014e, 0x015e, 0x00fe, 0x0005, 0x2001, 0x1800,
-- 0x2003, 0x0001, 0x0005, 0x2001, 0x19a7, 0x0118, 0x2003, 0x0001,
-- 0x0010, 0x2003, 0x0000, 0x0005, 0x0156, 0x20a9, 0x0800, 0x2009,
-- 0x1000, 0x9006, 0x200a, 0x8108, 0x1f04, 0x6142, 0x015e, 0x0005,
-- 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146, 0x2069, 0x1847, 0x9006,
-- 0xb802, 0xb8ce, 0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198,
-- 0x33b6, 0x231d, 0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026, 0xb8c2,
-- 0x080c, 0xb23d, 0x1120, 0x9192, 0x007e, 0x1208, 0xbbc2, 0x20a9,
-- 0x0004, 0xb8c4, 0x20e8, 0xb9c8, 0x9198, 0x0006, 0x9006, 0x23a0,
-- 0x4004, 0x20a9, 0x0004, 0x9198, 0x000a, 0x23a0, 0x4004, 0x002e,
-- 0x001e, 0xb83e, 0xb842, 0xb84e, 0xb852, 0xb856, 0xb85a, 0xb85e,
-- 0xb862, 0xb866, 0xb86a, 0xb86f, 0x0100, 0xb872, 0xb876, 0xb87a,
-- 0xb88a, 0xb88e, 0xb893, 0x0008, 0xb896, 0xb89a, 0xb89e, 0xb8be,
-- 0xb9a2, 0x0096, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x1040, 0xb8a7,
-- 0x0000, 0x009e, 0x9006, 0xb84a, 0x6810, 0xb83a, 0x680c, 0xb846,
-- 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0198, 0x00c6, 0x2060, 0x9c82,
-- 0x1cd0, 0x0a0c, 0x0dc5, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c,
-- 0x0dc5, 0x080c, 0x8cf7, 0x00ce, 0x090c, 0x9096, 0xb8af, 0x0000,
-- 0x6814, 0x9084, 0x00ff, 0xb842, 0x014e, 0x013e, 0x015e, 0x003e,
-- 0x00de, 0x0005, 0x0126, 0x2091, 0x8000, 0xa974, 0xae78, 0x9684,
-- 0x3fff, 0x9082, 0x4000, 0x1a04, 0x6230, 0x9182, 0x0800, 0x1a04,
-- 0x6234, 0x2001, 0x180c, 0x2004, 0x9084, 0x0003, 0x1904, 0x623a,
-- 0x9188, 0x1000, 0x2104, 0x905d, 0x0518, 0xb804, 0x9084, 0x00ff,
-- 0x908e, 0x0006, 0x1508, 0xb8a4, 0x900d, 0x1904, 0x624c, 0xb850,
-- 0x900d, 0x1148, 0xa802, 0x2900, 0xb852, 0xb84e, 0x080c, 0x951c,
-- 0x9006, 0x012e, 0x0005, 0x00a6, 0x2150, 0x2900, 0xb002, 0xa803,
-- 0x0000, 0x00ae, 0xb852, 0x0c90, 0x2001, 0x0005, 0x900e, 0x04b8,
-- 0x2001, 0x0028, 0x900e, 0x0498, 0x9082, 0x0006, 0x1290, 0x080c,
-- 0xb23d, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc,
-- 0x0990, 0x2001, 0x0029, 0x2009, 0x1000, 0x0408, 0x2001, 0x0028,
-- 0x00a8, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-- 0x0068, 0xd184, 0x0118, 0x2001, 0x0004, 0x0040, 0x2001, 0x0029,
-- 0xb900, 0xd1fc, 0x0118, 0x2009, 0x1000, 0x0048, 0x900e, 0x0038,
-- 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005,
-- 0x012e, 0x0005, 0x2001, 0x180c, 0x2004, 0xd084, 0x19d0, 0x9188,
-- 0x1000, 0x2104, 0x905d, 0x09a8, 0x080c, 0x6aa3, 0x1990, 0xb800,
-- 0xd0bc, 0x0978, 0x0804, 0x61e3, 0x080c, 0x68c0, 0x0904, 0x61fc,
-- 0x0804, 0x61e7, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa874,
-- 0x908e, 0x00ff, 0x1120, 0x2001, 0x196b, 0x205c, 0x0060, 0xa974,
-- 0x9182, 0x0800, 0x1690, 0x9188, 0x1000, 0x2104, 0x905d, 0x01d0,
-- 0x080c, 0x6a43, 0x11d0, 0x080c, 0xb27d, 0x0570, 0x2b00, 0x6012,
-- 0x2900, 0x6016, 0x6023, 0x0009, 0x600b, 0x0000, 0xa874, 0x908e,
-- 0x00ff, 0x1110, 0x600b, 0x8000, 0x2009, 0x0043, 0x080c, 0xb352,
-- 0x9006, 0x00b0, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c, 0x210c,
-- 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
-- 0x0004, 0x0010, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029, 0x9005,
-- 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0, 0x00b6,
-- 0x00e6, 0x0126, 0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04,
-- 0x631d, 0x9188, 0x1000, 0x2104, 0x905d, 0x0904, 0x62f5, 0xb8a0,
-- 0x9086, 0x007f, 0x0190, 0xa87c, 0xd0fc, 0x1178, 0x080c, 0x6aab,
-- 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e, 0x0004, 0x0130, 0x908e,
-- 0x0005, 0x0118, 0x080c, 0x6aa3, 0x1598, 0xa87c, 0xd0fc, 0x01e0,
-- 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026, 0x2010, 0x080c, 0xd0c6,
-- 0x002e, 0x1120, 0x2001, 0x0008, 0x0804, 0x631f, 0x6020, 0x9086,
-- 0x000a, 0x0120, 0x2001, 0x0008, 0x0804, 0x631f, 0x601a, 0x6003,
-- 0x0008, 0x2900, 0x6016, 0x0058, 0x080c, 0xb27d, 0x05e8, 0x2b00,
-- 0x6012, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0x2009,
-- 0x0003, 0x080c, 0xb352, 0x9006, 0x0458, 0x2001, 0x0028, 0x0438,
-- 0x9082, 0x0006, 0x1290, 0x080c, 0xb23d, 0x1160, 0xb8a0, 0x9084,
-- 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900, 0x2001, 0x0029, 0x2009,
-- 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c, 0x210c,
-- 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050, 0xd184, 0x0118, 0x2001,
-- 0x0004, 0x0028, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029, 0x9005,
-- 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0, 0x00f6,
-- 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0, 0x9005, 0x1550, 0xa8dc,
-- 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005, 0x1518, 0xa8c4, 0x9082,
-- 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800, 0x9182, 0x0800, 0x12e8,
-- 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98, 0xab94, 0xa878, 0x9084,
-- 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038,
-- 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x900e,
-- 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e,
-- 0x9006, 0x0008, 0x9005, 0x012e, 0x00be, 0x00fe, 0x0005, 0x63b4,
-- 0x636f, 0x6386, 0x63b4, 0x63b4, 0x63b4, 0x63b4, 0x63b4, 0x2100,
-- 0x9082, 0x007e, 0x1278, 0x080c, 0x66b9, 0x0148, 0x9046, 0xb810,
-- 0x9306, 0x1904, 0x63bc, 0xb814, 0x9206, 0x15f0, 0x0028, 0xbb12,
-- 0xba16, 0x0010, 0x080c, 0x4af7, 0x0150, 0x04b0, 0x080c, 0x6724,
-- 0x1598, 0xb810, 0x9306, 0x1580, 0xb814, 0x9206, 0x1568, 0x080c,
-- 0xb27d, 0x0530, 0x2b00, 0x6012, 0x080c, 0xd554, 0x2900, 0x6016,
-- 0x600b, 0xffff, 0x6023, 0x000a, 0xa878, 0x9086, 0x0001, 0x1170,
-- 0x080c, 0x3250, 0x9006, 0x080c, 0x6656, 0x2001, 0x0002, 0x080c,
-- 0x666a, 0x2001, 0x0200, 0xb86e, 0xb893, 0x0002, 0x2009, 0x0003,
-- 0x080c, 0xb352, 0x9006, 0x0068, 0x2001, 0x0001, 0x900e, 0x0038,
-- 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0028, 0x900e, 0x9005,
-- 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005, 0x00b6, 0x00f6, 0x00e6,
-- 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6, 0x0015, 0x0904, 0x65a7,
-- 0x90c6, 0x0056, 0x0904, 0x65ab, 0x90c6, 0x0066, 0x0904, 0x65af,
-- 0x90c6, 0x0067, 0x0904, 0x65b3, 0x90c6, 0x0068, 0x0904, 0x65b7,
-- 0x90c6, 0x0071, 0x0904, 0x65bb, 0x90c6, 0x0074, 0x0904, 0x65bf,
-- 0x90c6, 0x007c, 0x0904, 0x65c3, 0x90c6, 0x007e, 0x0904, 0x65c7,
-- 0x90c6, 0x0037, 0x0904, 0x65cb, 0x9016, 0x2079, 0x1800, 0xa974,
-- 0x9186, 0x00ff, 0x0904, 0x65a2, 0x9182, 0x0800, 0x1a04, 0x65a2,
-- 0x080c, 0x6724, 0x1198, 0xb804, 0x9084, 0x00ff, 0x9082, 0x0006,
-- 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148, 0x080c, 0xb23d, 0x1904,
-- 0x658b, 0xb8a0, 0x9084, 0xff80, 0x1904, 0x658b, 0xa894, 0x90c6,
-- 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904, 0x64eb, 0x90c6, 0x0064,
-- 0x0904, 0x6514, 0x2008, 0x0804, 0x64ad, 0xa998, 0xa8b0, 0x2040,
-- 0x080c, 0xb23d, 0x1120, 0x9182, 0x007f, 0x0a04, 0x64ad, 0x9186,
-- 0x00ff, 0x0904, 0x64ad, 0x9182, 0x0800, 0x1a04, 0x64ad, 0xaaa0,
-- 0xab9c, 0x787c, 0x9306, 0x11a8, 0x7880, 0x0096, 0x924e, 0x1128,
-- 0x2208, 0x2310, 0x009e, 0x0804, 0x64ad, 0x080c, 0xb23d, 0x1140,
-- 0x99cc, 0xff00, 0x009e, 0x1128, 0x2208, 0x2310, 0x0804, 0x64ad,
-- 0x009e, 0x080c, 0x4af7, 0x0904, 0x64b7, 0x900e, 0x9016, 0x90c6,
-- 0x4000, 0x15e0, 0x0006, 0x080c, 0x6944, 0x1108, 0xc185, 0xb800,
-- 0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
-- 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006,
-- 0x2098, 0x080c, 0x0f8b, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
-- 0x9080, 0x0035, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a,
-- 0x2098, 0x080c, 0x0f8b, 0xa8c4, 0xabc8, 0x9305, 0xabcc, 0x9305,
-- 0xabd0, 0x9305, 0xabd4, 0x9305, 0xabd8, 0x9305, 0xabdc, 0x9305,
-- 0xabe0, 0x9305, 0x9005, 0x0510, 0x000e, 0x00c8, 0x90c6, 0x4007,
-- 0x1110, 0x2408, 0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610,
-- 0x0070, 0x90c6, 0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138,
-- 0x2001, 0x4005, 0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896,
-- 0xa99a, 0xaa9e, 0x2001, 0x0030, 0x900e, 0x0478, 0x000e, 0x080c,
-- 0xb27d, 0x1130, 0x2001, 0x4005, 0x2009, 0x0003, 0x9016, 0x0c78,
-- 0x2b00, 0x6012, 0x080c, 0xd554, 0x2900, 0x6016, 0x6023, 0x0001,
-- 0xa868, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x3250, 0x012e, 0x9006, 0x080c, 0x6656, 0x2001, 0x0002,
-- 0x080c, 0x666a, 0x2009, 0x0002, 0x080c, 0xb352, 0xa8b0, 0xd094,
-- 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x9006, 0x9005, 0x012e, 0x00ee,
-- 0x00fe, 0x00be, 0x0005, 0x080c, 0x57e9, 0x0118, 0x2009, 0x0007,
-- 0x00f8, 0xa998, 0xaeb0, 0x080c, 0x6724, 0x1904, 0x64a8, 0x9186,
-- 0x007f, 0x0130, 0x080c, 0x6aa3, 0x0118, 0x2009, 0x0009, 0x0080,
-- 0x0096, 0x080c, 0x100e, 0x1120, 0x009e, 0x2009, 0x0002, 0x0040,
-- 0x2900, 0x009e, 0xa806, 0x080c, 0xd2c0, 0x19b0, 0x2009, 0x0003,
-- 0x2001, 0x4005, 0x0804, 0x64af, 0xa998, 0xaeb0, 0x080c, 0x6724,
-- 0x1904, 0x64a8, 0x0096, 0x080c, 0x100e, 0x1128, 0x009e, 0x2009,
-- 0x0002, 0x0804, 0x6568, 0x2900, 0x009e, 0xa806, 0x0096, 0x2048,
-- 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8,
-- 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080,
-- 0x0006, 0x20a0, 0xbbc8, 0x9398, 0x0006, 0x2398, 0x080c, 0x0f8b,
-- 0x009e, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xd684,
-- 0x1168, 0x080c, 0x57d5, 0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0,
-- 0xb800, 0xd08c, 0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c, 0x6aa3,
-- 0x0118, 0xa89b, 0x0009, 0x0080, 0x080c, 0x57e9, 0x0118, 0xa89b,
-- 0x0007, 0x0050, 0x080c, 0xd2a3, 0x1904, 0x64e4, 0x2009, 0x0003,
-- 0x2001, 0x4005, 0x0804, 0x64af, 0xa87b, 0x0030, 0xa897, 0x4005,
-- 0xa804, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-- 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4,
-- 0x2031, 0x0000, 0x2041, 0x1252, 0x080c, 0xb7f1, 0x1904, 0x64e4,
-- 0x2009, 0x0002, 0x08e8, 0x2001, 0x0028, 0x900e, 0x0804, 0x64e5,
-- 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038,
-- 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x900e,
-- 0x0804, 0x64e5, 0x2001, 0x0029, 0x900e, 0x0804, 0x64e5, 0x080c,
-- 0x37e9, 0x0804, 0x64e6, 0x080c, 0x5500, 0x0804, 0x64e6, 0x080c,
-- 0x4637, 0x0804, 0x64e6, 0x080c, 0x46b0, 0x0804, 0x64e6, 0x080c,
-- 0x470c, 0x0804, 0x64e6, 0x080c, 0x4bba, 0x0804, 0x64e6, 0x080c,
-- 0x4e82, 0x0804, 0x64e6, 0x080c, 0x5167, 0x0804, 0x64e6, 0x080c,
-- 0x5360, 0x0804, 0x64e6, 0x080c, 0x3a25, 0x0804, 0x64e6, 0x00b6,
-- 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1618, 0x9182,
-- 0x0800, 0x1268, 0x9188, 0x1000, 0x2104, 0x905d, 0x0140, 0x080c,
-- 0x6aa3, 0x1148, 0x00e9, 0x080c, 0x684f, 0x9006, 0x00b0, 0x2001,
-- 0x0028, 0x900e, 0x0090, 0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc,
-- 0x0d88, 0x2001, 0x0029, 0x2009, 0x1000, 0x0038, 0x2001, 0x0029,
-- 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x00be, 0x0005,
-- 0x0126, 0x2091, 0x8000, 0xb850, 0x900d, 0x0150, 0x2900, 0x0096,
-- 0x2148, 0xa802, 0x009e, 0xa803, 0x0000, 0xb852, 0x012e, 0x0005,
-- 0x2900, 0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x0126, 0x2091,
-- 0x8000, 0xb84c, 0x9005, 0x0170, 0x00e6, 0x2071, 0x19e8, 0x7004,
-- 0x9086, 0x0002, 0x0168, 0x00ee, 0xb84c, 0xa802, 0x2900, 0xb84e,
-- 0x012e, 0x0005, 0x2900, 0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0,
-- 0x701c, 0x9b06, 0x1d80, 0xb84c, 0x00a6, 0x2050, 0xb000, 0xa802,
-- 0x2900, 0xb002, 0x00ae, 0x00ee, 0x012e, 0x0005, 0x0126, 0x2091,
-- 0x8000, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108, 0xb852,
-- 0xb84e, 0x9905, 0x012e, 0x0005, 0xb84c, 0x904d, 0x0130, 0xa800,
-- 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905, 0x0005, 0x00b6, 0x0126,
-- 0x00c6, 0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005,
-- 0x0110, 0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e,
-- 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210,
-- 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac,
-- 0x0158, 0x080c, 0x6a9f, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086,
-- 0x0007, 0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215,
-- 0xba06, 0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c,
-- 0x0dc5, 0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126,
-- 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086,
-- 0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6a9b, 0x1138,
-- 0x9284, 0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e,
-- 0x9294, 0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be,
-- 0x0005, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6,
-- 0x0026, 0x9190, 0x1000, 0x2204, 0x905d, 0x1188, 0x0096, 0x080c,
-- 0x100e, 0x2958, 0x009e, 0x0168, 0x2b00, 0x2012, 0xb85c, 0xb8ca,
-- 0xb860, 0xb8c6, 0x9006, 0xb8a6, 0xb8ae, 0x080c, 0x6148, 0x9006,
-- 0x0010, 0x9085, 0x0001, 0x002e, 0x00de, 0x0005, 0x00b6, 0x0096,
-- 0x0126, 0x2091, 0x8000, 0x0026, 0x9182, 0x0800, 0x0218, 0x9085,
-- 0x0001, 0x04a8, 0x00d6, 0x9190, 0x1000, 0x2204, 0x905d, 0x0568,
-- 0x2013, 0x0000, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x1040, 0x00d6,
-- 0x00c6, 0xb8bc, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006, 0x6014,
-- 0x2048, 0x080c, 0xd0d8, 0x0110, 0x080c, 0x0fc0, 0x080c, 0xb2d3,
-- 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x00c6, 0xb8ac, 0x9065, 0x0128,
-- 0x621c, 0xd2c4, 0x0110, 0x080c, 0x9096, 0x00ce, 0x2b48, 0xb8c8,
-- 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x1050, 0x00de, 0x9006, 0x002e,
-- 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182, 0x0800, 0x0218,
-- 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104, 0x905d, 0x0dc0,
-- 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146, 0x9006,
-- 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c, 0x7637, 0x1510,
-- 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xb23d, 0x11d8, 0x0078,
-- 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982, 0x7048, 0x2062,
-- 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e, 0x00ce, 0x703c,
-- 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001, 0x6886, 0x2069,
-- 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862, 0x704c, 0xb866,
-- 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8, 0xb8c8, 0x9088,
-- 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099, 0x027a, 0x9088,
-- 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069, 0x0200, 0x6817,
-- 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048, 0xb872, 0x7050,
-- 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0, 0x9086, 0x007e,
-- 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218, 0x2009, 0x0008,
-- 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0, 0x9182,
-- 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182, 0x0349, 0x1218,
-- 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218, 0x2009, 0x0004,
-- 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010, 0x2009,
-- 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005, 0x0016,
-- 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896, 0x703c, 0xb89a,
-- 0x7054, 0xb89e, 0x0036, 0xbbcc, 0xc384, 0xba00, 0x2009, 0x1867,
-- 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad, 0x0008, 0xc2ac,
-- 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc, 0x0128, 0xd38c,
-- 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbce, 0x003e, 0x00ee,
-- 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4,
-- 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04, 0x9282, 0x0010,
-- 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906, 0x8006, 0x8007,
-- 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080, 0x0004, 0x2098,
-- 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086, 0xffff, 0x0120,
-- 0x8109, 0x1dd0, 0x080c, 0x0dc5, 0x3c00, 0x20e8, 0x3300, 0x8001,
-- 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce, 0x014e, 0x013e,
-- 0x0060, 0x080c, 0x100e, 0x0170, 0x2900, 0xb8a6, 0xa803, 0x0000,
-- 0x080c, 0x68e0, 0xa807, 0x0001, 0xae12, 0x9085, 0x0001, 0x012e,
-- 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091, 0x8000, 0x0096,
-- 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150, 0x080c, 0x68ef,
-- 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001, 0xa806, 0x0020,
-- 0x080c, 0x1040, 0xb8a7, 0x0000, 0x009e, 0x012e, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x951c, 0x012e, 0x0005, 0x901e, 0x0010,
-- 0x2019, 0x0001, 0x900e, 0x0126, 0x2091, 0x8000, 0xb84c, 0x2048,
-- 0xb800, 0xd0dc, 0x1170, 0x89ff, 0x0500, 0x83ff, 0x0120, 0xa878,
-- 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506,
-- 0x0120, 0x2908, 0xa800, 0x2048, 0x0c70, 0x080c, 0xaaf1, 0xaa00,
-- 0xb84c, 0x9906, 0x1110, 0xba4e, 0x0020, 0x00a6, 0x2150, 0xb202,
-- 0x00ae, 0x82ff, 0x1110, 0xb952, 0x89ff, 0x012e, 0x0005, 0x9016,
-- 0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c, 0x6944, 0x0128,
-- 0x080c, 0xd195, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6944,
-- 0x0128, 0x080c, 0xd13a, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c,
-- 0x6944, 0x0128, 0x080c, 0xd192, 0x0010, 0x9085, 0x0001, 0x0005,
-- 0x080c, 0x6944, 0x0128, 0x080c, 0xd159, 0x0010, 0x9085, 0x0001,
-- 0x0005, 0x080c, 0x6944, 0x0128, 0x080c, 0xd1d8, 0x0010, 0x9085,
-- 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085, 0x0001, 0x0005,
-+ 0x5fba, 0x0010, 0x080c, 0x5a0a, 0x0005, 0x00f6, 0x7090, 0x9005,
-+ 0x01d8, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086, 0x0084, 0x1190,
-+ 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1150,
-+ 0x7834, 0x9005, 0x1138, 0x9006, 0x080c, 0x612c, 0x709b, 0x0018,
-+ 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
-+ 0x0019, 0x080c, 0x6093, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837,
-+ 0x0000, 0x080c, 0x6101, 0x2009, 0x026e, 0x2039, 0x1c0e, 0x20a9,
-+ 0x0040, 0x213e, 0x8738, 0x8108, 0x9186, 0x0280, 0x1128, 0x6814,
-+ 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04, 0x5e19, 0x2039, 0x1c0e,
-+ 0x080c, 0x60e4, 0x11e8, 0x2728, 0x2514, 0x8207, 0x9084, 0x00ff,
-+ 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205, 0x202a, 0x7060,
-+ 0x2310, 0x8214, 0x92a0, 0x1c0e, 0x2414, 0x938c, 0x0001, 0x0118,
-+ 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007, 0x9215, 0x2222,
-+ 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e, 0x8738, 0x8108, 0x9186,
-+ 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04,
-+ 0x5e4c, 0x60c3, 0x0084, 0x080c, 0x5fba, 0x00fe, 0x0005, 0x00f6,
-+ 0x7090, 0x9005, 0x01e0, 0x2011, 0x5f90, 0x080c, 0x8836, 0x9086,
-+ 0x0084, 0x1198, 0x080c, 0x6101, 0x2079, 0x0260, 0x7a30, 0x9296,
-+ 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c,
-+ 0x6057, 0x709b, 0x001a, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe,
-+ 0x0005, 0x9085, 0x0001, 0x080c, 0x612c, 0x709b, 0x001b, 0x080c,
-+ 0xaf87, 0x080c, 0x6101, 0x2011, 0x0260, 0x2009, 0x0240, 0x7490,
-+ 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8,
-+ 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000,
-+ 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260,
-+ 0x1f04, 0x5e98, 0x60c3, 0x0084, 0x080c, 0x5fba, 0x0005, 0x0005,
-+ 0x0086, 0x0096, 0x2029, 0x1848, 0x252c, 0x20a9, 0x0008, 0x2041,
-+ 0x1c0e, 0x20e9, 0x0001, 0x28a0, 0x080c, 0x6101, 0x20e1, 0x0000,
-+ 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011, 0x0007, 0xd5d4,
-+ 0x0108, 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6, 0xffff, 0x1148,
-+ 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04, 0x5eca, 0x0804,
-+ 0x5f39, 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6, 0x3fff, 0x0d90,
-+ 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5f39, 0x918d, 0xc000, 0x20a9,
-+ 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010, 0x2120,
-+ 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4, 0x0110,
-+ 0x8319, 0x0008, 0x8318, 0x1f04, 0x5ef0, 0x04d8, 0x23a8, 0x2021,
-+ 0x0001, 0x8426, 0x8425, 0x1f04, 0x5f02, 0x2328, 0x8529, 0x92be,
-+ 0x0007, 0x0158, 0x0006, 0x2039, 0x0007, 0x2200, 0x973a, 0x000e,
-+ 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5f11, 0x755e, 0x95c8, 0x33b6,
-+ 0x292d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508,
-+ 0x080c, 0x28bc, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018, 0x2304,
-+ 0x9405, 0x201a, 0x7087, 0x0001, 0x20e9, 0x0000, 0x20a1, 0x024e,
-+ 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003, 0x9085, 0x0001,
-+ 0x0008, 0x9006, 0x009e, 0x008e, 0x0005, 0x0156, 0x01c6, 0x01d6,
-+ 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-+ 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e, 0x013e, 0x01de,
-+ 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001, 0x0007, 0x939a, 0x0010,
-+ 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120, 0x939a,
-+ 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118, 0x8423,
-+ 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528, 0x2504, 0x942c,
-+ 0x11b8, 0x9405, 0x203a, 0x715e, 0x91a0, 0x33b6, 0x242d, 0x95ac,
-+ 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x28bc,
-+ 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7087, 0x0001, 0x9084, 0x0000,
-+ 0x0005, 0x00e6, 0x2071, 0x1800, 0x708b, 0x0000, 0x00ee, 0x0005,
-+ 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140, 0x080c, 0x6046,
-+ 0x080c, 0xa6e2, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2d49,
-+ 0x0126, 0x2091, 0x8000, 0x2071, 0x1826, 0x2073, 0x0000, 0x7840,
-+ 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c, 0x60a3, 0x001e, 0x9094,
-+ 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e, 0x012e, 0x00fe,
-+ 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x2bce, 0x0228,
-+ 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011, 0x19f2, 0x2013,
-+ 0x0000, 0x7093, 0x0000, 0x012e, 0x60a3, 0x0056, 0x60a7, 0x9575,
-+ 0x080c, 0xa6d9, 0x6144, 0xd184, 0x0120, 0x7198, 0x918d, 0x2000,
-+ 0x0018, 0x718c, 0x918d, 0x1000, 0x2011, 0x1999, 0x2112, 0x2009,
-+ 0x07d0, 0x2011, 0x5f90, 0x080c, 0x88ce, 0x0005, 0x0016, 0x0026,
-+ 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb23d, 0x2009, 0x00f7,
-+ 0x080c, 0x60a3, 0x2061, 0x19fb, 0x900e, 0x611a, 0x611e, 0x617a,
-+ 0x617e, 0x2061, 0x1800, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043,
-+ 0x0090, 0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009,
-+ 0x002d, 0x2011, 0x6012, 0x080c, 0x882a, 0x012e, 0x00ce, 0x002e,
-+ 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x0471,
-+ 0x2071, 0x0100, 0x080c, 0xa6e2, 0x2071, 0x0140, 0x7004, 0x9084,
-+ 0x4000, 0x0110, 0x080c, 0x2d49, 0x080c, 0x7638, 0x0188, 0x080c,
-+ 0x7653, 0x1170, 0x080c, 0x7935, 0x0016, 0x080c, 0x298b, 0x2001,
-+ 0x196d, 0x2102, 0x001e, 0x080c, 0x7930, 0x080c, 0x755c, 0x0050,
-+ 0x2009, 0x0001, 0x080c, 0x2c67, 0x2001, 0x0001, 0x080c, 0x281c,
-+ 0x080c, 0x5fe6, 0x012e, 0x000e, 0x00ee, 0x0005, 0x2001, 0x180e,
-+ 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036, 0x2011, 0x8017, 0x2001,
-+ 0x1999, 0x201c, 0x080c, 0x4c42, 0x003e, 0x002e, 0x0005, 0x20a9,
-+ 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x080c, 0x6101, 0x20e9,
-+ 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9, 0x0020, 0x080c, 0x60fb,
-+ 0x2099, 0x0260, 0x20a1, 0x1c92, 0x0051, 0x20a9, 0x000e, 0x080c,
-+ 0x60fe, 0x2099, 0x0260, 0x20a1, 0x1cb2, 0x0009, 0x0005, 0x0016,
-+ 0x0026, 0x3410, 0x3308, 0x2104, 0x8007, 0x2012, 0x8108, 0x8210,
-+ 0x1f04, 0x607b, 0x002e, 0x001e, 0x0005, 0x080c, 0xaf87, 0x20e1,
-+ 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
-+ 0x000c, 0x4003, 0x0005, 0x080c, 0xaf87, 0x080c, 0x6101, 0x20e1,
-+ 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
-+ 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006, 0x2061, 0x0100, 0x810f,
-+ 0x2001, 0x1834, 0x2004, 0x9005, 0x1138, 0x2001, 0x1818, 0x2004,
-+ 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185, 0x00f7, 0x604a, 0x000e,
-+ 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c, 0x6a98, 0x0158, 0x9006,
-+ 0x2020, 0x2009, 0x002a, 0x080c, 0xec2a, 0x2001, 0x180c, 0x200c,
-+ 0xc195, 0x2102, 0x2019, 0x002a, 0x900e, 0x080c, 0x321b, 0x080c,
-+ 0xd7dc, 0x0140, 0x0036, 0x2019, 0xffff, 0x2021, 0x0007, 0x080c,
-+ 0x4df9, 0x003e, 0x004e, 0x001e, 0x0005, 0x080c, 0x5fe6, 0x709b,
-+ 0x0000, 0x7093, 0x0000, 0x0005, 0x0006, 0x2001, 0x180c, 0x2004,
-+ 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006, 0x0016, 0x0126, 0x2091,
-+ 0x8000, 0x2001, 0x0101, 0x200c, 0x918d, 0x0006, 0x2102, 0x012e,
-+ 0x001e, 0x000e, 0x0005, 0x2009, 0x0001, 0x0020, 0x2009, 0x0002,
-+ 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0, 0x910d, 0x6916, 0x0005,
-+ 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9,
-+ 0x0001, 0x20a1, 0x1c00, 0x4004, 0x2079, 0x1c00, 0x7803, 0x2200,
-+ 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813, 0x0138, 0x7823, 0xffff,
-+ 0x7827, 0xffff, 0x01de, 0x014e, 0x015e, 0x00fe, 0x0005, 0x2001,
-+ 0x1800, 0x2003, 0x0001, 0x0005, 0x2001, 0x19a7, 0x0118, 0x2003,
-+ 0x0001, 0x0010, 0x2003, 0x0000, 0x0005, 0x0156, 0x20a9, 0x0800,
-+ 0x2009, 0x1000, 0x9006, 0x200a, 0x8108, 0x1f04, 0x613b, 0x015e,
-+ 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146, 0x2069, 0x1847,
-+ 0x9006, 0xb802, 0xb8ce, 0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812,
-+ 0x9198, 0x33b6, 0x231d, 0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026,
-+ 0xb8c2, 0x080c, 0xb236, 0x1120, 0x9192, 0x007e, 0x1208, 0xbbc2,
-+ 0x20a9, 0x0004, 0xb8c4, 0x20e8, 0xb9c8, 0x9198, 0x0006, 0x9006,
-+ 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198, 0x000a, 0x23a0, 0x4004,
-+ 0x002e, 0x001e, 0xb83e, 0xb842, 0xb84e, 0xb852, 0xb856, 0xb85a,
-+ 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f, 0x0100, 0xb872, 0xb876,
-+ 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008, 0xb896, 0xb89a, 0xb89e,
-+ 0xb8be, 0xb9a2, 0x0096, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x1040,
-+ 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a, 0x6810, 0xb83a, 0x680c,
-+ 0xb846, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0198, 0x00c6, 0x2060,
-+ 0x9c82, 0x1cd0, 0x0a0c, 0x0dc5, 0x2001, 0x181a, 0x2004, 0x9c02,
-+ 0x1a0c, 0x0dc5, 0x080c, 0x8cf0, 0x00ce, 0x090c, 0x908f, 0xb8af,
-+ 0x0000, 0x6814, 0x9084, 0x00ff, 0xb842, 0x014e, 0x013e, 0x015e,
-+ 0x003e, 0x00de, 0x0005, 0x0126, 0x2091, 0x8000, 0xa974, 0xae78,
-+ 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x6229, 0x9182, 0x0800,
-+ 0x1a04, 0x622d, 0x2001, 0x180c, 0x2004, 0x9084, 0x0003, 0x1904,
-+ 0x6233, 0x9188, 0x1000, 0x2104, 0x905d, 0x0518, 0xb804, 0x9084,
-+ 0x00ff, 0x908e, 0x0006, 0x1508, 0xb8a4, 0x900d, 0x1904, 0x6245,
-+ 0xb850, 0x900d, 0x1148, 0xa802, 0x2900, 0xb852, 0xb84e, 0x080c,
-+ 0x9515, 0x9006, 0x012e, 0x0005, 0x00a6, 0x2150, 0x2900, 0xb002,
-+ 0xa803, 0x0000, 0x00ae, 0xb852, 0x0c90, 0x2001, 0x0005, 0x900e,
-+ 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498, 0x9082, 0x0006, 0x1290,
-+ 0x080c, 0xb236, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900,
-+ 0xd1fc, 0x0990, 0x2001, 0x0029, 0x2009, 0x1000, 0x0408, 0x2001,
-+ 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001,
-+ 0x0004, 0x0068, 0xd184, 0x0118, 0x2001, 0x0004, 0x0040, 0x2001,
-+ 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009, 0x1000, 0x0048, 0x900e,
-+ 0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e,
-+ 0x9005, 0x012e, 0x0005, 0x2001, 0x180c, 0x2004, 0xd084, 0x19d0,
-+ 0x9188, 0x1000, 0x2104, 0x905d, 0x09a8, 0x080c, 0x6a9c, 0x1990,
-+ 0xb800, 0xd0bc, 0x0978, 0x0804, 0x61dc, 0x080c, 0x68b9, 0x0904,
-+ 0x61f5, 0x0804, 0x61e0, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000,
-+ 0xa874, 0x908e, 0x00ff, 0x1120, 0x2001, 0x196b, 0x205c, 0x0060,
-+ 0xa974, 0x9182, 0x0800, 0x1690, 0x9188, 0x1000, 0x2104, 0x905d,
-+ 0x01d0, 0x080c, 0x6a3c, 0x11d0, 0x080c, 0xb276, 0x0570, 0x2b00,
-+ 0x6012, 0x2900, 0x6016, 0x6023, 0x0009, 0x600b, 0x0000, 0xa874,
-+ 0x908e, 0x00ff, 0x1110, 0x600b, 0x8000, 0x2009, 0x0043, 0x080c,
-+ 0xb34b, 0x9006, 0x00b0, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c,
-+ 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118,
-+ 0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029,
-+ 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0,
-+ 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa974, 0x9182, 0x0800,
-+ 0x1a04, 0x6316, 0x9188, 0x1000, 0x2104, 0x905d, 0x0904, 0x62ee,
-+ 0xb8a0, 0x9086, 0x007f, 0x0190, 0xa87c, 0xd0fc, 0x1178, 0x080c,
-+ 0x6aa4, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e, 0x0004, 0x0130,
-+ 0x908e, 0x0005, 0x0118, 0x080c, 0x6a9c, 0x1598, 0xa87c, 0xd0fc,
-+ 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026, 0x2010, 0x080c,
-+ 0xd0bf, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804, 0x6318, 0x6020,
-+ 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804, 0x6318, 0x601a,
-+ 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c, 0xb276, 0x05e8,
-+ 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a,
-+ 0x2009, 0x0003, 0x080c, 0xb34b, 0x9006, 0x0458, 0x2001, 0x0028,
-+ 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0xb236, 0x1160, 0xb8a0,
-+ 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900, 0x2001, 0x0029,
-+ 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c,
-+ 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050, 0xd184, 0x0118,
-+ 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029,
-+ 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0,
-+ 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0, 0x9005, 0x1550,
-+ 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005, 0x1518, 0xa8c4,
-+ 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800, 0x9182, 0x0800,
-+ 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98, 0xab94, 0xa878,
-+ 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118, 0x2001, 0x0004,
-+ 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
-+ 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0029,
-+ 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be, 0x00fe, 0x0005,
-+ 0x63ad, 0x6368, 0x637f, 0x63ad, 0x63ad, 0x63ad, 0x63ad, 0x63ad,
-+ 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x66b2, 0x0148, 0x9046,
-+ 0xb810, 0x9306, 0x1904, 0x63b5, 0xb814, 0x9206, 0x15f0, 0x0028,
-+ 0xbb12, 0xba16, 0x0010, 0x080c, 0x4af5, 0x0150, 0x04b0, 0x080c,
-+ 0x671d, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814, 0x9206, 0x1568,
-+ 0x080c, 0xb276, 0x0530, 0x2b00, 0x6012, 0x080c, 0xd54d, 0x2900,
-+ 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878, 0x9086, 0x0001,
-+ 0x1170, 0x080c, 0x3250, 0x9006, 0x080c, 0x664f, 0x2001, 0x0002,
-+ 0x080c, 0x6663, 0x2001, 0x0200, 0xb86e, 0xb893, 0x0002, 0x2009,
-+ 0x0003, 0x080c, 0xb34b, 0x9006, 0x0068, 0x2001, 0x0001, 0x900e,
-+ 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0028, 0x900e,
-+ 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005, 0x00b6, 0x00f6,
-+ 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6, 0x0015, 0x0904,
-+ 0x65a0, 0x90c6, 0x0056, 0x0904, 0x65a4, 0x90c6, 0x0066, 0x0904,
-+ 0x65a8, 0x90c6, 0x0067, 0x0904, 0x65ac, 0x90c6, 0x0068, 0x0904,
-+ 0x65b0, 0x90c6, 0x0071, 0x0904, 0x65b4, 0x90c6, 0x0074, 0x0904,
-+ 0x65b8, 0x90c6, 0x007c, 0x0904, 0x65bc, 0x90c6, 0x007e, 0x0904,
-+ 0x65c0, 0x90c6, 0x0037, 0x0904, 0x65c4, 0x9016, 0x2079, 0x1800,
-+ 0xa974, 0x9186, 0x00ff, 0x0904, 0x659b, 0x9182, 0x0800, 0x1a04,
-+ 0x659b, 0x080c, 0x671d, 0x1198, 0xb804, 0x9084, 0x00ff, 0x9082,
-+ 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148, 0x080c, 0xb236,
-+ 0x1904, 0x6584, 0xb8a0, 0x9084, 0xff80, 0x1904, 0x6584, 0xa894,
-+ 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904, 0x64e4, 0x90c6,
-+ 0x0064, 0x0904, 0x650d, 0x2008, 0x0804, 0x64a6, 0xa998, 0xa8b0,
-+ 0x2040, 0x080c, 0xb236, 0x1120, 0x9182, 0x007f, 0x0a04, 0x64a6,
-+ 0x9186, 0x00ff, 0x0904, 0x64a6, 0x9182, 0x0800, 0x1a04, 0x64a6,
-+ 0xaaa0, 0xab9c, 0x787c, 0x9306, 0x11a8, 0x7880, 0x0096, 0x924e,
-+ 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x64a6, 0x080c, 0xb236,
-+ 0x1140, 0x99cc, 0xff00, 0x009e, 0x1128, 0x2208, 0x2310, 0x0804,
-+ 0x64a6, 0x009e, 0x080c, 0x4af5, 0x0904, 0x64b0, 0x900e, 0x9016,
-+ 0x90c6, 0x4000, 0x15e0, 0x0006, 0x080c, 0x693d, 0x1108, 0xc185,
-+ 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-+ 0x0006, 0x2098, 0x080c, 0x0f8b, 0x20a9, 0x0004, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-+ 0x000a, 0x2098, 0x080c, 0x0f8b, 0xa8c4, 0xabc8, 0x9305, 0xabcc,
-+ 0x9305, 0xabd0, 0x9305, 0xabd4, 0x9305, 0xabd8, 0x9305, 0xabdc,
-+ 0x9305, 0xabe0, 0x9305, 0x9005, 0x0510, 0x000e, 0x00c8, 0x90c6,
-+ 0x4007, 0x1110, 0x2408, 0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708,
-+ 0x2610, 0x0070, 0x90c6, 0x4009, 0x1108, 0x0050, 0x90c6, 0x4006,
-+ 0x0138, 0x2001, 0x4005, 0x2009, 0x000a, 0x0010, 0x2001, 0x4006,
-+ 0xa896, 0xa99a, 0xaa9e, 0x2001, 0x0030, 0x900e, 0x0478, 0x000e,
-+ 0x080c, 0xb276, 0x1130, 0x2001, 0x4005, 0x2009, 0x0003, 0x9016,
-+ 0x0c78, 0x2b00, 0x6012, 0x080c, 0xd54d, 0x2900, 0x6016, 0x6023,
-+ 0x0001, 0xa868, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x3250, 0x012e, 0x9006, 0x080c, 0x664f, 0x2001,
-+ 0x0002, 0x080c, 0x6663, 0x2009, 0x0002, 0x080c, 0xb34b, 0xa8b0,
-+ 0xd094, 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x9006, 0x9005, 0x012e,
-+ 0x00ee, 0x00fe, 0x00be, 0x0005, 0x080c, 0x57e7, 0x0118, 0x2009,
-+ 0x0007, 0x00f8, 0xa998, 0xaeb0, 0x080c, 0x671d, 0x1904, 0x64a1,
-+ 0x9186, 0x007f, 0x0130, 0x080c, 0x6a9c, 0x0118, 0x2009, 0x0009,
-+ 0x0080, 0x0096, 0x080c, 0x100e, 0x1120, 0x009e, 0x2009, 0x0002,
-+ 0x0040, 0x2900, 0x009e, 0xa806, 0x080c, 0xd2b9, 0x19b0, 0x2009,
-+ 0x0003, 0x2001, 0x4005, 0x0804, 0x64a8, 0xa998, 0xaeb0, 0x080c,
-+ 0x671d, 0x1904, 0x64a1, 0x0096, 0x080c, 0x100e, 0x1128, 0x009e,
-+ 0x2009, 0x0002, 0x0804, 0x6561, 0x2900, 0x009e, 0xa806, 0x0096,
-+ 0x2048, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-+ 0x9080, 0x0006, 0x20a0, 0xbbc8, 0x9398, 0x0006, 0x2398, 0x080c,
-+ 0x0f8b, 0x009e, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-+ 0xd684, 0x1168, 0x080c, 0x57d3, 0xd0b4, 0x1118, 0xa89b, 0x000b,
-+ 0x00e0, 0xb800, 0xd08c, 0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c,
-+ 0x6a9c, 0x0118, 0xa89b, 0x0009, 0x0080, 0x080c, 0x57e7, 0x0118,
-+ 0xa89b, 0x0007, 0x0050, 0x080c, 0xd29c, 0x1904, 0x64dd, 0x2009,
-+ 0x0003, 0x2001, 0x4005, 0x0804, 0x64a8, 0xa87b, 0x0030, 0xa897,
-+ 0x4005, 0xa804, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8,
-+ 0xada4, 0x2031, 0x0000, 0x2041, 0x1252, 0x080c, 0xb7ea, 0x1904,
-+ 0x64dd, 0x2009, 0x0002, 0x08e8, 0x2001, 0x0028, 0x900e, 0x0804,
-+ 0x64de, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-+ 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
-+ 0x900e, 0x0804, 0x64de, 0x2001, 0x0029, 0x900e, 0x0804, 0x64de,
-+ 0x080c, 0x37e7, 0x0804, 0x64df, 0x080c, 0x54fe, 0x0804, 0x64df,
-+ 0x080c, 0x4635, 0x0804, 0x64df, 0x080c, 0x46ae, 0x0804, 0x64df,
-+ 0x080c, 0x470a, 0x0804, 0x64df, 0x080c, 0x4bb8, 0x0804, 0x64df,
-+ 0x080c, 0x4e80, 0x0804, 0x64df, 0x080c, 0x5165, 0x0804, 0x64df,
-+ 0x080c, 0x535e, 0x0804, 0x64df, 0x080c, 0x3a23, 0x0804, 0x64df,
-+ 0x00b6, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1618,
-+ 0x9182, 0x0800, 0x1268, 0x9188, 0x1000, 0x2104, 0x905d, 0x0140,
-+ 0x080c, 0x6a9c, 0x1148, 0x00e9, 0x080c, 0x6848, 0x9006, 0x00b0,
-+ 0x2001, 0x0028, 0x900e, 0x0090, 0x9082, 0x0006, 0x1240, 0xb900,
-+ 0xd1fc, 0x0d88, 0x2001, 0x0029, 0x2009, 0x1000, 0x0038, 0x2001,
-+ 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x00be,
-+ 0x0005, 0x0126, 0x2091, 0x8000, 0xb850, 0x900d, 0x0150, 0x2900,
-+ 0x0096, 0x2148, 0xa802, 0x009e, 0xa803, 0x0000, 0xb852, 0x012e,
-+ 0x0005, 0x2900, 0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x0126,
-+ 0x2091, 0x8000, 0xb84c, 0x9005, 0x0170, 0x00e6, 0x2071, 0x19e8,
-+ 0x7004, 0x9086, 0x0002, 0x0168, 0x00ee, 0xb84c, 0xa802, 0x2900,
-+ 0xb84e, 0x012e, 0x0005, 0x2900, 0xb852, 0xb84e, 0xa803, 0x0000,
-+ 0x0cc0, 0x701c, 0x9b06, 0x1d80, 0xb84c, 0x00a6, 0x2050, 0xb000,
-+ 0xa802, 0x2900, 0xb002, 0x00ae, 0x00ee, 0x012e, 0x0005, 0x0126,
-+ 0x2091, 0x8000, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108,
-+ 0xb852, 0xb84e, 0x9905, 0x012e, 0x0005, 0xb84c, 0x904d, 0x0130,
-+ 0xa800, 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905, 0x0005, 0x00b6,
-+ 0x0126, 0x00c6, 0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00,
-+ 0x9005, 0x0110, 0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce,
-+ 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000,
-+ 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c,
-+ 0xd0ac, 0x0158, 0x080c, 0x6a98, 0x0140, 0x9284, 0xff00, 0x8007,
-+ 0x9086, 0x0007, 0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00,
-+ 0x9215, 0xba06, 0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff,
-+ 0x090c, 0x0dc5, 0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6,
-+ 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006,
-+ 0x9086, 0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6a94,
-+ 0x1138, 0x9284, 0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006,
-+ 0x000e, 0x9294, 0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e,
-+ 0x00be, 0x0005, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005,
-+ 0x00d6, 0x0026, 0x9190, 0x1000, 0x2204, 0x905d, 0x1188, 0x0096,
-+ 0x080c, 0x100e, 0x2958, 0x009e, 0x0168, 0x2b00, 0x2012, 0xb85c,
-+ 0xb8ca, 0xb860, 0xb8c6, 0x9006, 0xb8a6, 0xb8ae, 0x080c, 0x6141,
-+ 0x9006, 0x0010, 0x9085, 0x0001, 0x002e, 0x00de, 0x0005, 0x00b6,
-+ 0x0096, 0x0126, 0x2091, 0x8000, 0x0026, 0x9182, 0x0800, 0x0218,
-+ 0x9085, 0x0001, 0x04a8, 0x00d6, 0x9190, 0x1000, 0x2204, 0x905d,
-+ 0x0568, 0x2013, 0x0000, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x1040,
-+ 0x00d6, 0x00c6, 0xb8bc, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006,
-+ 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0110, 0x080c, 0x0fc0, 0x080c,
-+ 0xb2cc, 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x00c6, 0xb8ac, 0x9065,
-+ 0x0128, 0x621c, 0xd2c4, 0x0110, 0x080c, 0x908f, 0x00ce, 0x2b48,
-+ 0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x1050, 0x00de, 0x9006,
-+ 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182, 0x0800,
-+ 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104, 0x905d,
-+ 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146,
-+ 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c, 0x7630,
-+ 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xb236, 0x11d8,
-+ 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982, 0x7048,
-+ 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e, 0x00ce,
-+ 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001, 0x6886,
-+ 0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862, 0x704c,
-+ 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8, 0xb8c8,
-+ 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099, 0x027a,
-+ 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069, 0x0200,
-+ 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048, 0xb872,
-+ 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0, 0x9086,
-+ 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218, 0x2009,
-+ 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0,
-+ 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182, 0x0349,
-+ 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218, 0x2009,
-+ 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010,
-+ 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005,
-+ 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896, 0x703c,
-+ 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbcc, 0xc384, 0xba00, 0x2009,
-+ 0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad, 0x0008,
-+ 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc, 0x0128,
-+ 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbce, 0x003e,
-+ 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000,
-+ 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04, 0x9282,
-+ 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906, 0x8006,
-+ 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080, 0x0004,
-+ 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086, 0xffff,
-+ 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0dc5, 0x3c00, 0x20e8, 0x3300,
-+ 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce, 0x014e,
-+ 0x013e, 0x0060, 0x080c, 0x100e, 0x0170, 0x2900, 0xb8a6, 0xa803,
-+ 0x0000, 0x080c, 0x68d9, 0xa807, 0x0001, 0xae12, 0x9085, 0x0001,
-+ 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091, 0x8000,
-+ 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150, 0x080c,
-+ 0x68e8, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001, 0xa806,
-+ 0x0020, 0x080c, 0x1040, 0xb8a7, 0x0000, 0x009e, 0x012e, 0x0005,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x9515, 0x012e, 0x0005, 0x901e,
-+ 0x0010, 0x2019, 0x0001, 0x900e, 0x0126, 0x2091, 0x8000, 0xb84c,
-+ 0x2048, 0xb800, 0xd0dc, 0x1170, 0x89ff, 0x0500, 0x83ff, 0x0120,
-+ 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870,
-+ 0x9506, 0x0120, 0x2908, 0xa800, 0x2048, 0x0c70, 0x080c, 0xaaea,
-+ 0xaa00, 0xb84c, 0x9906, 0x1110, 0xba4e, 0x0020, 0x00a6, 0x2150,
-+ 0xb202, 0x00ae, 0x82ff, 0x1110, 0xb952, 0x89ff, 0x012e, 0x0005,
-+ 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c, 0x693d,
-+ 0x0128, 0x080c, 0xd18e, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c,
-+ 0x693d, 0x0128, 0x080c, 0xd133, 0x0010, 0x9085, 0x0001, 0x0005,
-+ 0x080c, 0x693d, 0x0128, 0x080c, 0xd18b, 0x0010, 0x9085, 0x0001,
-+ 0x0005, 0x080c, 0x693d, 0x0128, 0x080c, 0xd152, 0x0010, 0x9085,
-+ 0x0001, 0x0005, 0x080c, 0x693d, 0x0128, 0x080c, 0xd1d1, 0x0010,
-+ 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085, 0x0001,
-+ 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e,
-+ 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004,
-+ 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128,
-+ 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006, 0x01ce, 0x013e,
-+ 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0004,
-+ 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104, 0x01de, 0x014e,
- 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e, 0x810f,
- 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004, 0x2098,
- 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128, 0x8109,
-- 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006, 0x01ce, 0x013e, 0x0005,
-- 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0004, 0x20a0,
-- 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104, 0x01de, 0x014e, 0x0136,
-- 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e, 0x810f, 0x9184,
-- 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004, 0x2098, 0x20a9,
-- 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128, 0x8109, 0x1dd8,
-- 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6, 0x3300, 0x8001, 0x20a0,
-- 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de, 0x014e, 0x9006,
-- 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4,
-- 0x904d, 0x1128, 0x080c, 0x100e, 0x0168, 0x2900, 0xb8a6, 0x080c,
-- 0x68e0, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085, 0x0001, 0x012e,
-- 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126, 0x2091, 0x8000,
-- 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c, 0x1040, 0x9085,
-- 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4, 0x0005, 0x00b6,
-- 0x00f6, 0x080c, 0x7637, 0x01b0, 0x71c4, 0x81ff, 0x1198, 0x71dc,
-- 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000, 0x2004, 0x905d,
-- 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1118, 0xb800,
-- 0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x01d0, 0x0156,
-- 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6724, 0x1168, 0xb804,
-- 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118, 0x9086, 0x0006,
-- 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108, 0x1f04, 0x696b,
-- 0x015e, 0x080c, 0x6a61, 0x0120, 0x2001, 0x1985, 0x200c, 0x0098,
-- 0x2079, 0x1847, 0x7804, 0xd0a4, 0x0190, 0x2009, 0x07d0, 0x2001,
-- 0x182c, 0x2004, 0x9005, 0x0138, 0x2001, 0x1867, 0x2004, 0xd0e4,
-- 0x0110, 0x2009, 0x5dc0, 0x2011, 0x69a2, 0x080c, 0x88d5, 0x00fe,
-- 0x00be, 0x0005, 0x00b6, 0x2011, 0x69a2, 0x080c, 0x883d, 0x080c,
-- 0x6a61, 0x01d8, 0x2001, 0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec,
-- 0xb902, 0x080c, 0x6a9f, 0x0130, 0x2009, 0x07d0, 0x2011, 0x69a2,
-- 0x080c, 0x88d5, 0x00e6, 0x2071, 0x1800, 0x9006, 0x707e, 0x7060,
-- 0x7082, 0x080c, 0x3000, 0x00ee, 0x04b0, 0x0156, 0x00c6, 0x20a9,
-- 0x007f, 0x900e, 0x0016, 0x080c, 0x6724, 0x1538, 0xb800, 0xd0ec,
-- 0x0520, 0x0046, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x0029, 0x080c,
-- 0xec31, 0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c, 0x6a9b, 0x2001,
-- 0x0707, 0x1128, 0xb804, 0x9084, 0x00ff, 0x9085, 0x0700, 0xb806,
-- 0x2019, 0x0029, 0x080c, 0x96a4, 0x0076, 0x903e, 0x080c, 0x9577,
-- 0x900e, 0x080c, 0xe91c, 0x007e, 0x004e, 0x001e, 0x8108, 0x1f04,
-- 0x69ca, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010, 0x2058,
-- 0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x0096,
-- 0x080c, 0x1027, 0x090c, 0x0dc5, 0x2958, 0x009e, 0x2001, 0x196b,
-- 0x2b02, 0x8b07, 0x8006, 0x8006, 0x908c, 0x003f, 0xb9c6, 0x908c,
-- 0xffc0, 0xb9ca, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x6148,
-- 0xb807, 0x0006, 0xb813, 0x00ff, 0xb817, 0xffff, 0xb86f, 0x0200,
-- 0xb86c, 0xb893, 0x0002, 0xb8bb, 0x0520, 0xb8a3, 0x00ff, 0xb8af,
-- 0x0000, 0x00ce, 0x00be, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb800,
-- 0x00be, 0xd0ac, 0x0005, 0x6010, 0x00b6, 0x905d, 0x0108, 0xb800,
-- 0x00be, 0xd0bc, 0x0005, 0x0006, 0x0016, 0x0026, 0xb804, 0x908c,
-- 0x00ff, 0x9196, 0x0006, 0x0188, 0x9196, 0x0004, 0x0170, 0x9196,
-- 0x0005, 0x0158, 0x908c, 0xff00, 0x810f, 0x9196, 0x0006, 0x0128,
-- 0x9196, 0x0004, 0x0110, 0x9196, 0x0005, 0x002e, 0x001e, 0x000e,
-- 0x0005, 0x00b6, 0x00f6, 0x2001, 0x107e, 0x2004, 0x905d, 0x0110,
-- 0xb800, 0xd0ec, 0x00fe, 0x00be, 0x0005, 0x0126, 0x0026, 0x2091,
-- 0x8000, 0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c,
-- 0x0dc5, 0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc,
-- 0xba02, 0x002e, 0x012e, 0x0005, 0x2011, 0x1837, 0x2204, 0xd0cc,
-- 0x0138, 0x2001, 0x1983, 0x200c, 0x2011, 0x6a91, 0x080c, 0x88d5,
-- 0x0005, 0x2011, 0x6a91, 0x080c, 0x883d, 0x2011, 0x1837, 0x2204,
-- 0xc0cc, 0x2012, 0x0005, 0x080c, 0x57d5, 0xd0ac, 0x0005, 0x080c,
-- 0x57d5, 0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e,
-- 0x0006, 0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007,
-- 0x908e, 0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xd7e3,
-- 0x0158, 0x70dc, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004,
-- 0x905d, 0x0110, 0xb8cc, 0xd094, 0x00fe, 0x00be, 0x0005, 0x0006,
-- 0x0016, 0x0036, 0x0046, 0x0076, 0x00b6, 0x2001, 0x1818, 0x203c,
-- 0x9780, 0x33b6, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006, 0x2018,
-- 0x2008, 0x9284, 0x8000, 0x0110, 0x2019, 0x0001, 0x9294, 0x7fff,
-- 0x2100, 0x9706, 0x0190, 0x91a0, 0x1000, 0x2404, 0x905d, 0x0168,
-- 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1138, 0x83ff, 0x0118,
-- 0xb89c, 0xd0a4, 0x0110, 0x8211, 0x0158, 0x8108, 0x83ff, 0x0120,
-- 0x9182, 0x0800, 0x0e28, 0x0068, 0x9182, 0x007e, 0x0e08, 0x0048,
-- 0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9085, 0x0001, 0x000e,
-- 0x0005, 0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9006, 0x000e,
-- 0x0005, 0x0046, 0x0056, 0x0076, 0x00b6, 0x2100, 0x9084, 0x7fff,
-- 0x9080, 0x1000, 0x2004, 0x905d, 0x0130, 0xb804, 0x9084, 0x00ff,
-- 0x9086, 0x0006, 0x0550, 0x9184, 0x8000, 0x0580, 0x2001, 0x1818,
-+ 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6, 0x3300, 0x8001,
-+ 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de, 0x014e,
-+ 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000,
-+ 0xb8a4, 0x904d, 0x1128, 0x080c, 0x100e, 0x0168, 0x2900, 0xb8a6,
-+ 0x080c, 0x68d9, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085, 0x0001,
-+ 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126, 0x2091,
-+ 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c, 0x1040,
-+ 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4, 0x0005,
-+ 0x00b6, 0x00f6, 0x080c, 0x7630, 0x01b0, 0x71c4, 0x81ff, 0x1198,
-+ 0x71dc, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000, 0x2004,
-+ 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1118,
-+ 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x01d0,
-+ 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x671d, 0x1168,
-+ 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118, 0x9086,
-+ 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108, 0x1f04,
-+ 0x6964, 0x015e, 0x080c, 0x6a5a, 0x0120, 0x2001, 0x1985, 0x200c,
-+ 0x0098, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x0190, 0x2009, 0x07d0,
-+ 0x2001, 0x182c, 0x2004, 0x9005, 0x0138, 0x2001, 0x1867, 0x2004,
-+ 0xd0e4, 0x0110, 0x2009, 0x5dc0, 0x2011, 0x699b, 0x080c, 0x88ce,
-+ 0x00fe, 0x00be, 0x0005, 0x00b6, 0x2011, 0x699b, 0x080c, 0x8836,
-+ 0x080c, 0x6a5a, 0x01d8, 0x2001, 0x107e, 0x2004, 0x2058, 0xb900,
-+ 0xc1ec, 0xb902, 0x080c, 0x6a98, 0x0130, 0x2009, 0x07d0, 0x2011,
-+ 0x699b, 0x080c, 0x88ce, 0x00e6, 0x2071, 0x1800, 0x9006, 0x707e,
-+ 0x7060, 0x7082, 0x080c, 0x3000, 0x00ee, 0x04b0, 0x0156, 0x00c6,
-+ 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x671d, 0x1538, 0xb800,
-+ 0xd0ec, 0x0520, 0x0046, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x0029,
-+ 0x080c, 0xec2a, 0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c, 0x6a94,
-+ 0x2001, 0x0707, 0x1128, 0xb804, 0x9084, 0x00ff, 0x9085, 0x0700,
-+ 0xb806, 0x2019, 0x0029, 0x080c, 0x969d, 0x0076, 0x903e, 0x080c,
-+ 0x9570, 0x900e, 0x080c, 0xe915, 0x007e, 0x004e, 0x001e, 0x8108,
-+ 0x1f04, 0x69c3, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010,
-+ 0x2058, 0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6,
-+ 0x0096, 0x080c, 0x1027, 0x090c, 0x0dc5, 0x2958, 0x009e, 0x2001,
-+ 0x196b, 0x2b02, 0x8b07, 0x8006, 0x8006, 0x908c, 0x003f, 0xb9c6,
-+ 0x908c, 0xffc0, 0xb9ca, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c,
-+ 0x6141, 0xb807, 0x0006, 0xb813, 0x00ff, 0xb817, 0xffff, 0xb86f,
-+ 0x0200, 0xb86c, 0xb893, 0x0002, 0xb8bb, 0x0520, 0xb8a3, 0x00ff,
-+ 0xb8af, 0x0000, 0x00ce, 0x00be, 0x0005, 0x7810, 0x00b6, 0x2058,
-+ 0xb800, 0x00be, 0xd0ac, 0x0005, 0x6010, 0x00b6, 0x905d, 0x0108,
-+ 0xb800, 0x00be, 0xd0bc, 0x0005, 0x0006, 0x0016, 0x0026, 0xb804,
-+ 0x908c, 0x00ff, 0x9196, 0x0006, 0x0188, 0x9196, 0x0004, 0x0170,
-+ 0x9196, 0x0005, 0x0158, 0x908c, 0xff00, 0x810f, 0x9196, 0x0006,
-+ 0x0128, 0x9196, 0x0004, 0x0110, 0x9196, 0x0005, 0x002e, 0x001e,
-+ 0x000e, 0x0005, 0x00b6, 0x00f6, 0x2001, 0x107e, 0x2004, 0x905d,
-+ 0x0110, 0xb800, 0xd0ec, 0x00fe, 0x00be, 0x0005, 0x0126, 0x0026,
-+ 0x2091, 0x8000, 0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06,
-+ 0x190c, 0x0dc5, 0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008,
-+ 0xc2fc, 0xba02, 0x002e, 0x012e, 0x0005, 0x2011, 0x1837, 0x2204,
-+ 0xd0cc, 0x0138, 0x2001, 0x1983, 0x200c, 0x2011, 0x6a8a, 0x080c,
-+ 0x88ce, 0x0005, 0x2011, 0x6a8a, 0x080c, 0x8836, 0x2011, 0x1837,
-+ 0x2204, 0xc0cc, 0x2012, 0x0005, 0x080c, 0x57d3, 0xd0ac, 0x0005,
-+ 0x080c, 0x57d3, 0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff,
-+ 0x908e, 0x0006, 0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00,
-+ 0x8007, 0x908e, 0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c,
-+ 0xd7dc, 0x0158, 0x70dc, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f,
-+ 0x2004, 0x905d, 0x0110, 0xb8cc, 0xd094, 0x00fe, 0x00be, 0x0005,
-+ 0x0006, 0x0016, 0x0036, 0x0046, 0x0076, 0x00b6, 0x2001, 0x1818,
- 0x203c, 0x9780, 0x33b6, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006,
-- 0x2020, 0x2400, 0x9706, 0x01a0, 0x94a8, 0x1000, 0x2504, 0x905d,
-- 0x0178, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1148, 0xb89c,
-- 0xd0a4, 0x0130, 0xb814, 0x9206, 0x1118, 0xb810, 0x9306, 0x0128,
-- 0x8420, 0x9482, 0x0800, 0x0e28, 0x0048, 0x918c, 0x7fff, 0x00be,
-- 0x007e, 0x005e, 0x004e, 0x9085, 0x0001, 0x0005, 0x918c, 0x7fff,
-- 0x00be, 0x007e, 0x005e, 0x004e, 0x9006, 0x0005, 0x0006, 0x2001,
-- 0x00a0, 0x8001, 0xa001, 0xa001, 0xa001, 0x1dd8, 0x000e, 0x0005,
-- 0x0006, 0x2001, 0x00f8, 0x8001, 0xa001, 0xa001, 0xa001, 0x1dd8,
-- 0x000e, 0x0005, 0x0006, 0x2001, 0x00e8, 0x8001, 0xa001, 0xa001,
-- 0xa001, 0x1dd8, 0x000e, 0x0005, 0x2071, 0x1910, 0x7003, 0x0001,
-- 0x7007, 0x0000, 0x9006, 0x7012, 0x7016, 0x701a, 0x701e, 0x700a,
-- 0x7046, 0x2001, 0x1922, 0x2003, 0x0000, 0x0005, 0x0016, 0x00e6,
-- 0x2071, 0x1948, 0x900e, 0x710a, 0x080c, 0x57d5, 0xd0fc, 0x1140,
-- 0x080c, 0x57d5, 0x900e, 0xd09c, 0x0108, 0x8108, 0x7102, 0x0470,
-- 0x2001, 0x1867, 0x200c, 0x9184, 0x0007, 0x0006, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x000e, 0x0108, 0x9006, 0x0002, 0x6b98, 0x6b98,
-- 0x6b98, 0x6b98, 0x6b98, 0x6bb6, 0x6bcb, 0x6bd9, 0x7003, 0x0003,
-- 0x2009, 0x1868, 0x210c, 0x9184, 0xff00, 0x908e, 0xff00, 0x0140,
-- 0x8007, 0x9005, 0x1110, 0x2001, 0x0002, 0x8003, 0x7006, 0x0030,
-- 0x7007, 0x0001, 0x0018, 0x7003, 0x0005, 0x0c50, 0x2071, 0x1910,
-- 0x704f, 0x0000, 0x2071, 0x1800, 0x70f3, 0x0001, 0x00ee, 0x001e,
-- 0x0005, 0x7003, 0x0000, 0x2071, 0x1910, 0x2009, 0x1868, 0x210c,
-- 0x9184, 0x7f00, 0x8007, 0x908c, 0x000f, 0x0160, 0x714e, 0x8004,
-- 0x8004, 0x8004, 0x8004, 0x2071, 0x1800, 0x908c, 0x0007, 0x0128,
-- 0x70f2, 0x0c20, 0x704f, 0x000f, 0x0c90, 0x70f3, 0x0005, 0x08f0,
-- 0x00e6, 0x2071, 0x0050, 0x684c, 0x9005, 0x1150, 0x00e6, 0x2071,
-- 0x1910, 0x7028, 0xc085, 0x702a, 0x00ee, 0x9085, 0x0001, 0x0488,
-- 0x6844, 0x9005, 0x0158, 0x080c, 0x79a4, 0x6a60, 0x9200, 0x7002,
-- 0x6864, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6860, 0x7002,
-- 0x6864, 0x7006, 0x6868, 0x700a, 0x686c, 0x700e, 0x6844, 0x9005,
-- 0x1110, 0x7012, 0x7016, 0x684c, 0x701a, 0x701c, 0x9085, 0x0040,
-- 0x701e, 0x7037, 0x0019, 0x702b, 0x0001, 0x00e6, 0x2071, 0x1910,
-- 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0x700b, 0x0000, 0x00ee,
-- 0x9006, 0x00ee, 0x0005, 0x00e6, 0x0026, 0x2071, 0x1948, 0x7000,
-- 0x9015, 0x0904, 0x6ea5, 0x9286, 0x0003, 0x0904, 0x6d3e, 0x9286,
-- 0x0005, 0x0904, 0x6d3e, 0x2071, 0x1877, 0xa87c, 0x9005, 0x0904,
-- 0x6c99, 0x7140, 0xa868, 0x9102, 0x0a04, 0x6ea5, 0xa878, 0xd084,
-- 0x15d8, 0xa853, 0x0019, 0x2001, 0x8023, 0xa84e, 0x2071, 0x1910,
-- 0x701c, 0x9005, 0x1904, 0x7073, 0x0e04, 0x70e1, 0x2071, 0x0000,
-- 0xa850, 0x7032, 0xa84c, 0x7082, 0xa870, 0x7086, 0xa86c, 0x708a,
-- 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6, 0x0156,
-- 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860, 0x20e0,
-- 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce, 0x013e,
-- 0x01de, 0x014e, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-- 0x190c, 0x11aa, 0x0804, 0x6d21, 0xa853, 0x001b, 0x2001, 0x8027,
-- 0x0820, 0x7004, 0xd08c, 0x1904, 0x6ea5, 0xa853, 0x001a, 0x2001,
-- 0x8024, 0x0804, 0x6c5d, 0x00e6, 0x0026, 0x2071, 0x1948, 0x7000,
-- 0x9015, 0x0904, 0x6ea5, 0x9286, 0x0003, 0x0904, 0x6d3e, 0x9286,
-- 0x0005, 0x0904, 0x6d3e, 0xa84f, 0x8022, 0xa853, 0x0018, 0x0804,
-- 0x6d06, 0xa868, 0xd0fc, 0x1508, 0x00e6, 0x0026, 0x2001, 0x1948,
-- 0x2004, 0x9015, 0x0904, 0x6ea5, 0xa978, 0xa874, 0x9105, 0x1904,
-- 0x6ea5, 0x9286, 0x0003, 0x0904, 0x6d3e, 0x9286, 0x0005, 0x0904,
-- 0x6d3e, 0xa87c, 0xd0bc, 0x1904, 0x6ea5, 0x2200, 0x0002, 0x6ea5,
-- 0x6d02, 0x6d3e, 0x6d3e, 0x6ea5, 0x6d3e, 0x0005, 0xa868, 0xd0fc,
-- 0x1500, 0x00e6, 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904,
-- 0x6ea5, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x6ea5,
-- 0x9186, 0x0003, 0x0904, 0x6d3e, 0x9186, 0x0005, 0x0904, 0x6d3e,
-- 0xa87c, 0xd0cc, 0x0904, 0x6ea5, 0xa84f, 0x8021, 0xa853, 0x0017,
-- 0x0028, 0x0005, 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1910,
-- 0x701c, 0x9005, 0x1904, 0x7073, 0x0e04, 0x70e1, 0x2071, 0x0000,
-- 0xa84c, 0x7082, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870,
-- 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-- 0x11aa, 0x2071, 0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c,
-- 0x1158, 0xa802, 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-- 0x8725, 0x002e, 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802,
-- 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000,
-- 0x00f6, 0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010,
-- 0x9005, 0x1904, 0x6e29, 0x782c, 0x908c, 0x0780, 0x190c, 0x722f,
-- 0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6d5c, 0x6e29,
-- 0x6d80, 0x6dc6, 0x080c, 0x0dc5, 0x2071, 0x1800, 0x2900, 0x7822,
-- 0xa804, 0x900d, 0x1168, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320,
-+ 0x2018, 0x2008, 0x9284, 0x8000, 0x0110, 0x2019, 0x0001, 0x9294,
-+ 0x7fff, 0x2100, 0x9706, 0x0190, 0x91a0, 0x1000, 0x2404, 0x905d,
-+ 0x0168, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1138, 0x83ff,
-+ 0x0118, 0xb89c, 0xd0a4, 0x0110, 0x8211, 0x0158, 0x8108, 0x83ff,
-+ 0x0120, 0x9182, 0x0800, 0x0e28, 0x0068, 0x9182, 0x007e, 0x0e08,
-+ 0x0048, 0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9085, 0x0001,
-+ 0x000e, 0x0005, 0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9006,
-+ 0x000e, 0x0005, 0x0046, 0x0056, 0x0076, 0x00b6, 0x2100, 0x9084,
-+ 0x7fff, 0x9080, 0x1000, 0x2004, 0x905d, 0x0130, 0xb804, 0x9084,
-+ 0x00ff, 0x9086, 0x0006, 0x0550, 0x9184, 0x8000, 0x0580, 0x2001,
-+ 0x1818, 0x203c, 0x9780, 0x33b6, 0x203d, 0x97bc, 0xff00, 0x873f,
-+ 0x9006, 0x2020, 0x2400, 0x9706, 0x01a0, 0x94a8, 0x1000, 0x2504,
-+ 0x905d, 0x0178, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1148,
-+ 0xb89c, 0xd0a4, 0x0130, 0xb814, 0x9206, 0x1118, 0xb810, 0x9306,
-+ 0x0128, 0x8420, 0x9482, 0x0800, 0x0e28, 0x0048, 0x918c, 0x7fff,
-+ 0x00be, 0x007e, 0x005e, 0x004e, 0x9085, 0x0001, 0x0005, 0x918c,
-+ 0x7fff, 0x00be, 0x007e, 0x005e, 0x004e, 0x9006, 0x0005, 0x0006,
-+ 0x2001, 0x00a0, 0x8001, 0xa001, 0xa001, 0xa001, 0x1dd8, 0x000e,
-+ 0x0005, 0x0006, 0x2001, 0x00f8, 0x8001, 0xa001, 0xa001, 0xa001,
-+ 0x1dd8, 0x000e, 0x0005, 0x0006, 0x2001, 0x00e8, 0x8001, 0xa001,
-+ 0xa001, 0xa001, 0x1dd8, 0x000e, 0x0005, 0x2071, 0x1910, 0x7003,
-+ 0x0001, 0x7007, 0x0000, 0x9006, 0x7012, 0x7016, 0x701a, 0x701e,
-+ 0x700a, 0x7046, 0x2001, 0x1922, 0x2003, 0x0000, 0x0005, 0x0016,
-+ 0x00e6, 0x2071, 0x1948, 0x900e, 0x710a, 0x080c, 0x57d3, 0xd0fc,
-+ 0x1140, 0x080c, 0x57d3, 0x900e, 0xd09c, 0x0108, 0x8108, 0x7102,
-+ 0x0470, 0x2001, 0x1867, 0x200c, 0x9184, 0x0007, 0x0006, 0x2001,
-+ 0x180d, 0x2004, 0xd08c, 0x000e, 0x0108, 0x9006, 0x0002, 0x6b91,
-+ 0x6b91, 0x6b91, 0x6b91, 0x6b91, 0x6baf, 0x6bc4, 0x6bd2, 0x7003,
-+ 0x0003, 0x2009, 0x1868, 0x210c, 0x9184, 0xff00, 0x908e, 0xff00,
-+ 0x0140, 0x8007, 0x9005, 0x1110, 0x2001, 0x0002, 0x8003, 0x7006,
-+ 0x0030, 0x7007, 0x0001, 0x0018, 0x7003, 0x0005, 0x0c50, 0x2071,
-+ 0x1910, 0x704f, 0x0000, 0x2071, 0x1800, 0x70f3, 0x0001, 0x00ee,
-+ 0x001e, 0x0005, 0x7003, 0x0000, 0x2071, 0x1910, 0x2009, 0x1868,
-+ 0x210c, 0x9184, 0x7f00, 0x8007, 0x908c, 0x000f, 0x0160, 0x714e,
-+ 0x8004, 0x8004, 0x8004, 0x8004, 0x2071, 0x1800, 0x908c, 0x0007,
-+ 0x0128, 0x70f2, 0x0c20, 0x704f, 0x000f, 0x0c90, 0x70f3, 0x0005,
-+ 0x08f0, 0x00e6, 0x2071, 0x0050, 0x684c, 0x9005, 0x1150, 0x00e6,
-+ 0x2071, 0x1910, 0x7028, 0xc085, 0x702a, 0x00ee, 0x9085, 0x0001,
-+ 0x0488, 0x6844, 0x9005, 0x0158, 0x080c, 0x799d, 0x6a60, 0x9200,
-+ 0x7002, 0x6864, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6860,
-+ 0x7002, 0x6864, 0x7006, 0x6868, 0x700a, 0x686c, 0x700e, 0x6844,
-+ 0x9005, 0x1110, 0x7012, 0x7016, 0x684c, 0x701a, 0x701c, 0x9085,
-+ 0x0040, 0x701e, 0x7037, 0x0019, 0x702b, 0x0001, 0x00e6, 0x2071,
-+ 0x1910, 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0x700b, 0x0000,
-+ 0x00ee, 0x9006, 0x00ee, 0x0005, 0x00e6, 0x0026, 0x2071, 0x1948,
-+ 0x7000, 0x9015, 0x0904, 0x6e9e, 0x9286, 0x0003, 0x0904, 0x6d37,
-+ 0x9286, 0x0005, 0x0904, 0x6d37, 0x2071, 0x1877, 0xa87c, 0x9005,
-+ 0x0904, 0x6c92, 0x7140, 0xa868, 0x9102, 0x0a04, 0x6e9e, 0xa878,
-+ 0xd084, 0x15d8, 0xa853, 0x0019, 0x2001, 0x8023, 0xa84e, 0x2071,
-+ 0x1910, 0x701c, 0x9005, 0x1904, 0x706c, 0x0e04, 0x70da, 0x2071,
-+ 0x0000, 0xa850, 0x7032, 0xa84c, 0x7082, 0xa870, 0x7086, 0xa86c,
-+ 0x708a, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6,
-+ 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860,
-+ 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce,
-+ 0x013e, 0x01de, 0x014e, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-+ 0xd084, 0x190c, 0x11aa, 0x0804, 0x6d1a, 0xa853, 0x001b, 0x2001,
-+ 0x8027, 0x0820, 0x7004, 0xd08c, 0x1904, 0x6e9e, 0xa853, 0x001a,
-+ 0x2001, 0x8024, 0x0804, 0x6c56, 0x00e6, 0x0026, 0x2071, 0x1948,
-+ 0x7000, 0x9015, 0x0904, 0x6e9e, 0x9286, 0x0003, 0x0904, 0x6d37,
-+ 0x9286, 0x0005, 0x0904, 0x6d37, 0xa84f, 0x8022, 0xa853, 0x0018,
-+ 0x0804, 0x6cff, 0xa868, 0xd0fc, 0x1508, 0x00e6, 0x0026, 0x2001,
-+ 0x1948, 0x2004, 0x9015, 0x0904, 0x6e9e, 0xa978, 0xa874, 0x9105,
-+ 0x1904, 0x6e9e, 0x9286, 0x0003, 0x0904, 0x6d37, 0x9286, 0x0005,
-+ 0x0904, 0x6d37, 0xa87c, 0xd0bc, 0x1904, 0x6e9e, 0x2200, 0x0002,
-+ 0x6e9e, 0x6cfb, 0x6d37, 0x6d37, 0x6e9e, 0x6d37, 0x0005, 0xa868,
-+ 0xd0fc, 0x1500, 0x00e6, 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff,
-+ 0x0904, 0x6e9e, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904,
-+ 0x6e9e, 0x9186, 0x0003, 0x0904, 0x6d37, 0x9186, 0x0005, 0x0904,
-+ 0x6d37, 0xa87c, 0xd0cc, 0x0904, 0x6e9e, 0xa84f, 0x8021, 0xa853,
-+ 0x0017, 0x0028, 0x0005, 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071,
-+ 0x1910, 0x701c, 0x9005, 0x1904, 0x706c, 0x0e04, 0x70da, 0x2071,
-+ 0x0000, 0xa84c, 0x7082, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
-+ 0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-+ 0x190c, 0x11aa, 0x2071, 0x1800, 0x2011, 0x0001, 0xa804, 0x900d,
-+ 0x702c, 0x1158, 0xa802, 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2,
-+ 0x080c, 0x871e, 0x002e, 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904,
-+ 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f,
-+ 0x0000, 0x00f6, 0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000,
-+ 0x7010, 0x9005, 0x1904, 0x6e22, 0x782c, 0x908c, 0x0780, 0x190c,
-+ 0x7228, 0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6d55,
-+ 0x6e22, 0x6d79, 0x6dbf, 0x080c, 0x0dc5, 0x2071, 0x1800, 0x2900,
-+ 0x7822, 0xa804, 0x900d, 0x1168, 0x2071, 0x19fb, 0x7044, 0x9005,
-+ 0x1320, 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee,
-+ 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-+ 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e,
-+ 0x0c18, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1578,
-+ 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1148, 0x2009,
-+ 0x1830, 0x210c, 0x918a, 0x0020, 0x0218, 0x7022, 0x00ee, 0x0058,
-+ 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000,
-+ 0x70c2, 0x080c, 0x871e, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228,
-+ 0xd0a4, 0x19f0, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001,
-+ 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
-+ 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-+ 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e, 0x0808, 0x0096,
-+ 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900,
-+ 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e, 0x782c, 0x9094,
-+ 0x0780, 0x190c, 0x7228, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094,
-+ 0x0780, 0x190c, 0x7228, 0xd09c, 0x1198, 0x009e, 0x2900, 0x7822,
-+ 0xa804, 0x900d, 0x1550, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320,
- 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005,
-- 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-- 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x0c18,
-- 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1578, 0x7824,
-- 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1148, 0x2009, 0x1830,
-- 0x210c, 0x918a, 0x0020, 0x0218, 0x7022, 0x00ee, 0x0058, 0x00ee,
-- 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2,
-- 0x080c, 0x8725, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4,
-- 0x19f0, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001, 0x1949,
-- 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
-- 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-- 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x0808, 0x0096, 0x00e6,
-- 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e,
-- 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x722f, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x722f, 0xd09c, 0x1198, 0x009e, 0x2900, 0x7822, 0xa804,
-- 0x900d, 0x1550, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001,
-- 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x009e,
-- 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
-- 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1168, 0x2071,
-- 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001, 0x1949, 0x2004, 0x7046,
-- 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
-- 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-- 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x00fe, 0x002e, 0x00ee,
-- 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-- 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904,
-- 0x6e7d, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd09c, 0x1198,
-- 0x701c, 0x904d, 0x0180, 0x7010, 0x8001, 0x7012, 0x1108, 0x701a,
-- 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094, 0x0780, 0x190c,
-- 0x722f, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f,
-- 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-- 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725,
-- 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4, 0x1d60, 0x00ee,
-+ 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-+ 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1168,
- 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001, 0x1949, 0x2004,
-- 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800,
-- 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-- 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x00ee,
-- 0x0804, 0x6e39, 0xa868, 0xd0fc, 0x1904, 0x6ef3, 0x0096, 0xa804,
-- 0xa807, 0x0000, 0x904d, 0x190c, 0x0fc0, 0x009e, 0x0020, 0xa868,
-- 0xd0fc, 0x1904, 0x6ef3, 0x00e6, 0x0026, 0xa84f, 0x0000, 0x00f6,
-- 0x2079, 0x0050, 0x2071, 0x1800, 0x70ec, 0x8001, 0x0558, 0x1a04,
-- 0x6ef0, 0x2071, 0x1910, 0xa803, 0x0000, 0xa864, 0x9084, 0x00ff,
-- 0x908e, 0x0016, 0x01a8, 0x7010, 0x9005, 0x1904, 0x6fef, 0x782c,
-- 0x908c, 0x0780, 0x190c, 0x722f, 0x8004, 0x8004, 0x8004, 0x9084,
-- 0x0003, 0x0002, 0x6ef4, 0x6fef, 0x6f0f, 0x6f80, 0x080c, 0x0dc5,
-- 0x2009, 0x1948, 0x2104, 0x0002, 0x6ebb, 0x6ebb, 0x6ebb, 0x6d47,
-- 0x6ebb, 0x6d47, 0x70ef, 0x0fa0, 0x71e8, 0x8107, 0x9106, 0x9094,
-- 0x00c0, 0x9184, 0xff3f, 0x9205, 0x70ea, 0x3b08, 0x3a00, 0x9104,
-- 0x918d, 0x00c0, 0x21d8, 0x9084, 0xff3f, 0x9205, 0x20d0, 0x0808,
-- 0x70ee, 0x0804, 0x6eb1, 0x0005, 0x2071, 0x1800, 0x2900, 0x7822,
-- 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
-- 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-- 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x0c60, 0x2071,
-- 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6f6f, 0x7830,
-- 0x8007, 0x908c, 0x001f, 0x70f0, 0x9102, 0x1220, 0x00fe, 0x002e,
-- 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c,
-- 0x1148, 0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218, 0x7022,
-- 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-- 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x722f, 0xd0a4, 0x19f0, 0x0e04, 0x6f66, 0x7838, 0x7938,
-- 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
-- 0x00de, 0x2001, 0x1921, 0x200c, 0xc184, 0x2102, 0x2091, 0x4080,
-- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x2001, 0x1922,
-- 0x2003, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001, 0x1921,
-- 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
-+ 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016,
- 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-- 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725, 0x0804, 0x6f22,
-- 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802,
-- 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4, 0x1d60, 0x00ee, 0x0e04,
-- 0x6fc2, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
-- 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046, 0x2091,
-- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x704b,
-- 0x0000, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd09c, 0x1170,
-- 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x11e0, 0x00fe, 0x002e,
-- 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x0c58, 0x009e, 0x2908,
-- 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902,
-- 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e,
-- 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
-- 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200,
-- 0x70c2, 0x080c, 0x8725, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908,
-- 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902,
-- 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904, 0x705e, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x722f, 0xd09c, 0x11b0, 0x701c, 0x904d,
-- 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010, 0x8001, 0x7012, 0x1108,
-+ 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e, 0x00fe, 0x002e,
-+ 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
-+ 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-+ 0x1904, 0x6e76, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd09c,
-+ 0x1198, 0x701c, 0x904d, 0x0180, 0x7010, 0x8001, 0x7012, 0x1108,
- 0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x722f, 0xd09c, 0x0d50, 0x782c, 0x9094, 0x0780, 0x190c,
-- 0x722f, 0xd0a4, 0x05b8, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
-+ 0x190c, 0x7228, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c,
-+ 0x7228, 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
- 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c,
-- 0x8725, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4, 0x1d60,
-- 0x00ee, 0x0e04, 0x7057, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
-- 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084,
-- 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-- 0x11aa, 0x704b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044,
-- 0xc085, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071,
-+ 0x871e, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd0a4, 0x1d60,
-+ 0x00ee, 0x2071, 0x19fb, 0x7044, 0x9005, 0x1320, 0x2001, 0x1949,
-+ 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071,
- 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-- 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725,
-- 0x00ee, 0x0804, 0x6fff, 0x2071, 0x1910, 0xa803, 0x0000, 0x2908,
-- 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902,
-- 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1128, 0x1e04, 0x709e,
-+ 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e,
-+ 0x00ee, 0x0804, 0x6e32, 0xa868, 0xd0fc, 0x1904, 0x6eec, 0x0096,
-+ 0xa804, 0xa807, 0x0000, 0x904d, 0x190c, 0x0fc0, 0x009e, 0x0020,
-+ 0xa868, 0xd0fc, 0x1904, 0x6eec, 0x00e6, 0x0026, 0xa84f, 0x0000,
-+ 0x00f6, 0x2079, 0x0050, 0x2071, 0x1800, 0x70ec, 0x8001, 0x0558,
-+ 0x1a04, 0x6ee9, 0x2071, 0x1910, 0xa803, 0x0000, 0xa864, 0x9084,
-+ 0x00ff, 0x908e, 0x0016, 0x01a8, 0x7010, 0x9005, 0x1904, 0x6fe8,
-+ 0x782c, 0x908c, 0x0780, 0x190c, 0x7228, 0x8004, 0x8004, 0x8004,
-+ 0x9084, 0x0003, 0x0002, 0x6eed, 0x6fe8, 0x6f08, 0x6f79, 0x080c,
-+ 0x0dc5, 0x2009, 0x1948, 0x2104, 0x0002, 0x6eb4, 0x6eb4, 0x6eb4,
-+ 0x6d40, 0x6eb4, 0x6d40, 0x70ef, 0x0fa0, 0x71e8, 0x8107, 0x9106,
-+ 0x9094, 0x00c0, 0x9184, 0xff3f, 0x9205, 0x70ea, 0x3b08, 0x3a00,
-+ 0x9104, 0x918d, 0x00c0, 0x21d8, 0x9084, 0xff3f, 0x9205, 0x20d0,
-+ 0x0808, 0x70ee, 0x0804, 0x6eaa, 0x0005, 0x2071, 0x1800, 0x2900,
-+ 0x7822, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005,
-+ 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-+ 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e, 0x0c60,
-+ 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6f68,
-+ 0x7830, 0x8007, 0x908c, 0x001f, 0x70f0, 0x9102, 0x1220, 0x00fe,
-+ 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c,
-+ 0xd19c, 0x1148, 0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218,
-+ 0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-+ 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e, 0x782c, 0x9094,
-+ 0x0780, 0x190c, 0x7228, 0xd0a4, 0x19f0, 0x0e04, 0x6f5f, 0x7838,
-+ 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
-+ 0x0013, 0x00de, 0x2001, 0x1921, 0x200c, 0xc184, 0x2102, 0x2091,
-+ 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x2001,
-+ 0x1922, 0x2003, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001,
-+ 0x1921, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005,
-+ 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-+ 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e, 0x0804,
-+ 0x6f1b, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-+ 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd0a4, 0x1d60, 0x00ee,
-+ 0x0e04, 0x6fbb, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
-+ 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046,
-+ 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa,
-+ 0x704b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd09c,
-+ 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x11e0, 0x00fe,
-+ 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x0c58, 0x009e,
-+ 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
-+ 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1120, 0x00fe,
- 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
- 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0,
-- 0x9200, 0x70c2, 0x080c, 0x8725, 0x0e04, 0x7088, 0x2071, 0x1910,
-- 0x701c, 0x2048, 0xa84c, 0x900d, 0x0d18, 0x2071, 0x0000, 0x7182,
-- 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0xa850,
-- 0x9082, 0x0019, 0x1278, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-- 0xd084, 0x190c, 0x11aa, 0x2071, 0x1910, 0x080c, 0x721b, 0x002e,
-- 0x00ee, 0x0005, 0xa850, 0x9082, 0x001c, 0x1e68, 0xa880, 0x708e,
-- 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000,
-- 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e,
-- 0x0890, 0x2071, 0x1910, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000,
-- 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e,
-- 0x2148, 0xa804, 0x900d, 0x1118, 0x002e, 0x00ee, 0x0005, 0x2071,
-- 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-- 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8725,
-- 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c, 0x0006, 0xa867, 0x0103,
-- 0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001d, 0x20a0,
-- 0x9006, 0x4004, 0x000e, 0x9084, 0x00ff, 0xa87e, 0x000e, 0xa87a,
-- 0xa982, 0x0005, 0x2071, 0x1910, 0x7004, 0x0002, 0x712e, 0x712f,
-- 0x721a, 0x712f, 0x712c, 0x721a, 0x080c, 0x0dc5, 0x0005, 0x2001,
-- 0x1948, 0x2004, 0x0002, 0x7139, 0x7139, 0x71b3, 0x71b4, 0x7139,
-- 0x71b4, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x723a, 0x701c, 0x904d,
-- 0x0508, 0xa84c, 0x9005, 0x0904, 0x7184, 0x0e04, 0x7162, 0xa94c,
-- 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
-- 0xa870, 0x708a, 0xa850, 0x9082, 0x0019, 0x1278, 0x2091, 0x4080,
-- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x2071, 0x1910,
-- 0x080c, 0x721b, 0x012e, 0x0804, 0x71b2, 0xa850, 0x9082, 0x001c,
-- 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6,
-- 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860,
-- 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce,
-- 0x013e, 0x01de, 0x014e, 0x0890, 0x2001, 0x005b, 0x2004, 0x9094,
-- 0x0780, 0x190c, 0x722f, 0xd09c, 0x2071, 0x1910, 0x1510, 0x2071,
-- 0x1910, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff, 0x9086, 0x0003,
-- 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108, 0x710e, 0x2900,
-- 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x2071, 0x1910, 0x701c,
-- 0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005, 0x1108,
-- 0x701a, 0x012e, 0x0005, 0x0005, 0x00d6, 0x2008, 0x2069, 0x19fb,
-- 0x6844, 0x9005, 0x0760, 0x0158, 0x9186, 0x0003, 0x0540, 0x2001,
-- 0x1815, 0x2004, 0x2009, 0x1ad1, 0x210c, 0x9102, 0x1500, 0x0126,
-- 0x2091, 0x8000, 0x2069, 0x0050, 0x693c, 0x6838, 0x9106, 0x0190,
-- 0x0e04, 0x71e6, 0x2069, 0x0000, 0x6837, 0x8040, 0x6833, 0x0012,
-- 0x6883, 0x8040, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-- 0x190c, 0x11aa, 0x2069, 0x19fb, 0x6847, 0xffff, 0x012e, 0x00de,
-- 0x0126, 0x2091, 0x8000, 0x1e0c, 0x72a5, 0x701c, 0x904d, 0x0540,
-- 0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x15c9, 0xd09c, 0x1500,
-+ 0x9200, 0x70c2, 0x080c, 0x871e, 0x00fe, 0x002e, 0x00ee, 0x0005,
-+ 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
-+ 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904, 0x7057,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd09c, 0x11b0, 0x701c,
-+ 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010, 0x8001, 0x7012,
-+ 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094,
-+ 0x0780, 0x190c, 0x7228, 0xd09c, 0x0d50, 0x782c, 0x9094, 0x0780,
-+ 0x190c, 0x7228, 0xd0a4, 0x05b8, 0x00e6, 0x7824, 0x2048, 0x2071,
-+ 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2,
-+ 0x080c, 0x871e, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd0a4,
-+ 0x1d60, 0x00ee, 0x0e04, 0x7050, 0x7838, 0x7938, 0x910e, 0x1de0,
-+ 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044,
-+ 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-+ 0x190c, 0x11aa, 0x704b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005,
-+ 0x7044, 0xc085, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6,
-+ 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
-+ 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-+ 0x871e, 0x00ee, 0x0804, 0x6ff8, 0x2071, 0x1910, 0xa803, 0x0000,
-+ 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
-+ 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1128, 0x1e04,
-+ 0x7097, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
-+ 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-+ 0x70c0, 0x9200, 0x70c2, 0x080c, 0x871e, 0x0e04, 0x7081, 0x2071,
-+ 0x1910, 0x701c, 0x2048, 0xa84c, 0x900d, 0x0d18, 0x2071, 0x0000,
-+ 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a,
-+ 0xa850, 0x9082, 0x0019, 0x1278, 0x2091, 0x4080, 0x2001, 0x0089,
-+ 0x2004, 0xd084, 0x190c, 0x11aa, 0x2071, 0x1910, 0x080c, 0x7214,
-+ 0x002e, 0x00ee, 0x0005, 0xa850, 0x9082, 0x001c, 0x1e68, 0xa880,
-+ 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9,
-+ 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c,
-+ 0x9080, 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce, 0x013e, 0x01de,
-+ 0x014e, 0x0890, 0x2071, 0x1910, 0xa803, 0x0000, 0x2908, 0x7010,
-+ 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008,
-+ 0x711e, 0x2148, 0xa804, 0x900d, 0x1118, 0x002e, 0x00ee, 0x0005,
-+ 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
-+ 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-+ 0x871e, 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c, 0x0006, 0xa867,
-+ 0x0103, 0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001d,
-+ 0x20a0, 0x9006, 0x4004, 0x000e, 0x9084, 0x00ff, 0xa87e, 0x000e,
-+ 0xa87a, 0xa982, 0x0005, 0x2071, 0x1910, 0x7004, 0x0002, 0x7127,
-+ 0x7128, 0x7213, 0x7128, 0x7125, 0x7213, 0x080c, 0x0dc5, 0x0005,
-+ 0x2001, 0x1948, 0x2004, 0x0002, 0x7132, 0x7132, 0x71ac, 0x71ad,
-+ 0x7132, 0x71ad, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x7233, 0x701c,
-+ 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x717d, 0x0e04, 0x715b,
-+ 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086,
-+ 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019, 0x1278, 0x2091,
-+ 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x2071,
-+ 0x1910, 0x080c, 0x7214, 0x012e, 0x0804, 0x71ab, 0xa850, 0x9082,
-+ 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136,
-+ 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8,
-+ 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003, 0x015e,
-+ 0x01ce, 0x013e, 0x01de, 0x014e, 0x0890, 0x2001, 0x005b, 0x2004,
-+ 0x9094, 0x0780, 0x190c, 0x7228, 0xd09c, 0x2071, 0x1910, 0x1510,
- 0x2071, 0x1910, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff, 0x9086,
- 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108, 0x710e,
-- 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x701c, 0x2048,
-- 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005, 0x1108, 0x701a,
-- 0x012e, 0x0005, 0x0005, 0x0126, 0x2091, 0x8000, 0x701c, 0x904d,
-- 0x0160, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005, 0x1108,
-- 0x701a, 0x012e, 0x080c, 0x1040, 0x0005, 0x012e, 0x0005, 0x2091,
-- 0x8000, 0x0e04, 0x7231, 0x0006, 0x0016, 0x2001, 0x8004, 0x0006,
-- 0x0804, 0x0dce, 0x0096, 0x00f6, 0x2079, 0x0050, 0x7044, 0xd084,
-- 0x01d0, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
-- 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091, 0x4080,
-- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x704b, 0x0000,
-- 0x00fe, 0x009e, 0x0005, 0x782c, 0x9094, 0x0780, 0x1981, 0xd0a4,
-- 0x0db8, 0x7148, 0x704c, 0x8108, 0x714a, 0x9102, 0x0e88, 0x00e6,
-- 0x2071, 0x1800, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c,
-- 0x1148, 0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218, 0x7022,
-- 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-- 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x722f, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e, 0x1de0,
-+ 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x2071, 0x1910,
-+ 0x701c, 0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005,
-+ 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x00d6, 0x2008, 0x2069,
-+ 0x19fb, 0x6844, 0x9005, 0x0760, 0x0158, 0x9186, 0x0003, 0x0540,
-+ 0x2001, 0x1815, 0x2004, 0x2009, 0x1ad1, 0x210c, 0x9102, 0x1500,
-+ 0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c, 0x6838, 0x9106,
-+ 0x0190, 0x0e04, 0x71df, 0x2069, 0x0000, 0x6837, 0x8040, 0x6833,
-+ 0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-+ 0xd084, 0x190c, 0x11aa, 0x2069, 0x19fb, 0x6847, 0xffff, 0x012e,
-+ 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x729e, 0x701c, 0x904d,
-+ 0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x15c9, 0xd09c,
-+ 0x1500, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff,
-+ 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108,
-+ 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x701c,
-+ 0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005, 0x1108,
-+ 0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091, 0x8000, 0x701c,
-+ 0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005,
-+ 0x1108, 0x701a, 0x012e, 0x080c, 0x1040, 0x0005, 0x012e, 0x0005,
-+ 0x2091, 0x8000, 0x0e04, 0x722a, 0x0006, 0x0016, 0x2001, 0x8004,
-+ 0x0006, 0x0804, 0x0dce, 0x0096, 0x00f6, 0x2079, 0x0050, 0x7044,
-+ 0xd084, 0x01d0, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e, 0x1de0,
- 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091,
-- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x00ee,
-- 0x704b, 0x0000, 0x00fe, 0x009e, 0x0005, 0x00f6, 0x2079, 0x0050,
-- 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e,
-+ 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa, 0x704b,
-+ 0x0000, 0x00fe, 0x009e, 0x0005, 0x782c, 0x9094, 0x0780, 0x1981,
-+ 0xd0a4, 0x0db8, 0x7148, 0x704c, 0x8108, 0x714a, 0x9102, 0x0e88,
-+ 0x00e6, 0x2071, 0x1800, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c,
-+ 0xd19c, 0x1148, 0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218,
-+ 0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-+ 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e, 0x782c, 0x9094,
-+ 0x0780, 0x190c, 0x7228, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e,
- 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de,
- 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11aa,
-- 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4,
-- 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824, 0x2048, 0x702c, 0xa802,
-- 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8725, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x722f, 0xd0a4, 0x1d70, 0x00d6, 0x2069,
-- 0x0050, 0x693c, 0x2069, 0x1948, 0x6808, 0x690a, 0x2069, 0x19fb,
-- 0x9102, 0x1118, 0x6844, 0x9005, 0x1320, 0x2001, 0x1949, 0x200c,
-- 0x6946, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x7098, 0x908a, 0x002a,
-- 0x1a0c, 0x0dc5, 0x9082, 0x001d, 0x001b, 0x6027, 0x1e00, 0x0005,
-- 0x73e6, 0x7353, 0x736f, 0x7399, 0x73d5, 0x7415, 0x7427, 0x736f,
-- 0x73fd, 0x730e, 0x733c, 0x73bf, 0x730d, 0x0005, 0x00d6, 0x2069,
-- 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005, 0x1518, 0x709b,
-- 0x0029, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x7774, 0x6028,
-- 0x9085, 0x0600, 0x602a, 0x00b0, 0x709b, 0x0029, 0x2069, 0x198f,
-- 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a, 0x00e6, 0x0036,
-- 0x0046, 0x0056, 0x2071, 0x1a65, 0x080c, 0x1ad9, 0x005e, 0x004e,
-- 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200, 0x6804,
-- 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x709b, 0x0029, 0x2069,
-- 0x198f, 0x2d04, 0x7002, 0x080c, 0x7818, 0x6028, 0x9085, 0x0600,
-- 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c, 0x2d39,
-- 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x7494, 0xd1d4, 0x1160,
-- 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x709b, 0x0020, 0x080c, 0x7494,
-- 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x2001,
-- 0x0088, 0x080c, 0x2d39, 0x6124, 0xd1cc, 0x11e8, 0xd1dc, 0x11c0,
-- 0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c, 0x1b06, 0x60e3,
-- 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x7663, 0x2001, 0x0080,
-- 0x080c, 0x2d39, 0x709b, 0x0029, 0x0058, 0x709b, 0x001e, 0x0040,
-- 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b, 0x001f,
-- 0x0005, 0x080c, 0x1b06, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e,
-- 0x080c, 0x7663, 0x2001, 0x0080, 0x080c, 0x2d39, 0x6124, 0xd1d4,
-- 0x1198, 0xd1dc, 0x1170, 0xd1e4, 0x1148, 0x9184, 0x1e00, 0x1118,
-- 0x709b, 0x0029, 0x0058, 0x709b, 0x0028, 0x0040, 0x709b, 0x001e,
-- 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x6124,
-- 0xd1d4, 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184, 0x1e00,
-- 0x1158, 0x709b, 0x0029, 0x0040, 0x709b, 0x001e, 0x0028, 0x709b,
-- 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x2001, 0x00a0, 0x080c,
-- 0x2d39, 0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c, 0x1b06,
-- 0x709b, 0x001e, 0x0010, 0x709b, 0x001d, 0x0005, 0x080c, 0x7517,
-- 0x6124, 0xd1dc, 0x1188, 0x080c, 0x7494, 0x0016, 0x080c, 0x1b06,
-- 0x001e, 0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x709b, 0x001e, 0x0020,
-- 0x709b, 0x001f, 0x080c, 0x7494, 0x0005, 0x0006, 0x2001, 0x00a0,
-- 0x080c, 0x2d39, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc, 0x1150,
-- 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028, 0x709b,
-- 0x001d, 0x0010, 0x709b, 0x0021, 0x0005, 0x080c, 0x7517, 0x6124,
-- 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e,
-- 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x0006,
-- 0x2001, 0x0090, 0x080c, 0x2d39, 0x000e, 0x6124, 0xd1d4, 0x1178,
-- 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x709b, 0x001e,
-+ 0x00ee, 0x704b, 0x0000, 0x00fe, 0x009e, 0x0005, 0x00f6, 0x2079,
-+ 0x0050, 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046, 0x7838, 0x7938,
-+ 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
-+ 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-+ 0x11aa, 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x7228,
-+ 0xd0a4, 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824, 0x2048, 0x702c,
-+ 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x871e,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7228, 0xd0a4, 0x1d70, 0x00d6,
-+ 0x2069, 0x0050, 0x693c, 0x2069, 0x1948, 0x6808, 0x690a, 0x2069,
-+ 0x19fb, 0x9102, 0x1118, 0x6844, 0x9005, 0x1320, 0x2001, 0x1949,
-+ 0x200c, 0x6946, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x7098, 0x908a,
-+ 0x002a, 0x1a0c, 0x0dc5, 0x9082, 0x001d, 0x001b, 0x6027, 0x1e00,
-+ 0x0005, 0x73df, 0x734c, 0x7368, 0x7392, 0x73ce, 0x740e, 0x7420,
-+ 0x7368, 0x73f6, 0x7307, 0x7335, 0x73b8, 0x7306, 0x0005, 0x00d6,
-+ 0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005, 0x1518,
-+ 0x709b, 0x0029, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x776d,
-+ 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x709b, 0x0029, 0x2069,
-+ 0x198f, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a, 0x00e6,
-+ 0x0036, 0x0046, 0x0056, 0x2071, 0x1a65, 0x080c, 0x1ad9, 0x005e,
-+ 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200,
-+ 0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x709b, 0x0029,
-+ 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x7811, 0x6028, 0x9085,
-+ 0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c,
-+ 0x2d39, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x748d, 0xd1d4,
-+ 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x709b, 0x0020, 0x080c,
-+ 0x748d, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
-+ 0x2001, 0x0088, 0x080c, 0x2d39, 0x6124, 0xd1cc, 0x11e8, 0xd1dc,
-+ 0x11c0, 0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c, 0x1b06,
-+ 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x765c, 0x2001,
-+ 0x0080, 0x080c, 0x2d39, 0x709b, 0x0029, 0x0058, 0x709b, 0x001e,
- 0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b,
-- 0x001f, 0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061,
-- 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x080c,
-- 0x7637, 0x11d8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01b0, 0xc1b4,
-- 0x2102, 0x6027, 0x0200, 0x080c, 0x2c61, 0x6024, 0xd0cc, 0x0148,
-- 0x2001, 0x00a0, 0x080c, 0x2d39, 0x080c, 0x7932, 0x080c, 0x612e,
-- 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x7651, 0x0150,
-- 0x080c, 0x7648, 0x1138, 0x2001, 0x0001, 0x080c, 0x281c, 0x080c,
-- 0x760f, 0x00a0, 0x080c, 0x7514, 0x0178, 0x2001, 0x0001, 0x080c,
-- 0x281c, 0x7098, 0x9086, 0x001e, 0x0120, 0x7098, 0x9086, 0x0022,
-- 0x1118, 0x709b, 0x0025, 0x0010, 0x709b, 0x0021, 0x012e, 0x00ee,
-- 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x74a5, 0x080c,
-- 0x8917, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x74a5,
-- 0x080c, 0x890e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016,
-- 0x080c, 0xa6e9, 0x2071, 0x1800, 0x080c, 0x7442, 0x001e, 0x00fe,
-- 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
-- 0x00f6, 0x0126, 0x2071, 0x1800, 0x080c, 0xa6e9, 0x2061, 0x0100,
-- 0x2069, 0x0140, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a, 0x2011,
-- 0x0003, 0x080c, 0xaabf, 0x2011, 0x0002, 0x080c, 0xaac9, 0x080c,
-- 0xa9d3, 0x080c, 0x88c3, 0x0036, 0x901e, 0x080c, 0xaa49, 0x003e,
-- 0x60e3, 0x0000, 0x080c, 0xf07f, 0x080c, 0xf09a, 0x2009, 0x0004,
-- 0x080c, 0x2c67, 0x080c, 0x2b82, 0x2001, 0x1800, 0x2003, 0x0004,
-- 0x6027, 0x0008, 0x2011, 0x74a5, 0x080c, 0x8917, 0x080c, 0x7651,
-- 0x0118, 0x9006, 0x080c, 0x2d39, 0x080c, 0x0ba0, 0x2001, 0x0001,
-- 0x080c, 0x281c, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e,
-- 0x002e, 0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x74b2, 0x2071,
-- 0x19fb, 0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085,
-- 0x0001, 0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800,
-- 0x9084, 0xfffe, 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0, 0x080c,
-- 0x2d39, 0x0156, 0x20a9, 0x002d, 0x1d04, 0x7524, 0x2091, 0x6000,
-- 0x1f04, 0x7524, 0x015e, 0x00d6, 0x2069, 0x1800, 0x689c, 0x8001,
-- 0x0220, 0x0118, 0x689e, 0x00de, 0x0005, 0x689f, 0x0014, 0x68e8,
-- 0xd0dc, 0x0dc8, 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x8923,
-- 0x0c90, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140,
-- 0x2071, 0x1800, 0x080c, 0x7941, 0x2001, 0x196d, 0x2003, 0x0000,
-- 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c, 0x28e7, 0x9006, 0x080c,
-- 0x2d39, 0x080c, 0x5fed, 0x6027, 0xffff, 0x602b, 0x182f, 0x00ee,
-- 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100,
-- 0x2069, 0x0140, 0x2071, 0x1800, 0x2001, 0x197d, 0x200c, 0x9186,
-- 0x0000, 0x0158, 0x9186, 0x0001, 0x0158, 0x9186, 0x0002, 0x0158,
-- 0x9186, 0x0003, 0x0158, 0x0804, 0x75ff, 0x709b, 0x0022, 0x0040,
-- 0x709b, 0x0021, 0x0028, 0x709b, 0x0023, 0x0010, 0x709b, 0x0024,
-- 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x28e7,
-- 0x0026, 0x080c, 0xb244, 0x002e, 0x7000, 0x908e, 0x0004, 0x0118,
-- 0x602b, 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091,
-- 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e,
-- 0x080c, 0xd7e3, 0x0118, 0x9006, 0x080c, 0x2d63, 0x0804, 0x760b,
-- 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2c61, 0x6904,
-- 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2d39, 0x1f04, 0x75a3,
-- 0x080c, 0x768b, 0x012e, 0x015e, 0x080c, 0x7648, 0x01d8, 0x6044,
-- 0x9005, 0x0198, 0x2011, 0x0114, 0x2204, 0x9085, 0x0100, 0x2012,
-- 0x6050, 0x0006, 0x9085, 0x0020, 0x6052, 0x080c, 0x768b, 0x9006,
-- 0x8001, 0x1df0, 0x000e, 0x6052, 0x0028, 0x6804, 0xd0d4, 0x1110,
-- 0x080c, 0x768b, 0x080c, 0xd7e3, 0x0118, 0x9006, 0x080c, 0x2d63,
-- 0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130, 0x2009, 0x00c8,
-- 0x2011, 0x74b2, 0x080c, 0x88d5, 0x002e, 0x001e, 0x080c, 0x871c,
-- 0x7034, 0xc085, 0x7036, 0x2001, 0x197d, 0x2003, 0x0004, 0x080c,
-- 0x72f5, 0x080c, 0x7648, 0x0138, 0x6804, 0xd0d4, 0x1120, 0xd0dc,
-- 0x1100, 0x080c, 0x7937, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6,
-- 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-- 0x080c, 0x8733, 0x080c, 0x8725, 0x080c, 0x7941, 0x2001, 0x196d,
-- 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c, 0x28e7,
-- 0x9006, 0x080c, 0x2d39, 0x6043, 0x0090, 0x6043, 0x0010, 0x6027,
-- 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006,
-- 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006,
-- 0x080c, 0x57d9, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005,
-- 0x0006, 0x080c, 0x57d9, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e,
-- 0x0005, 0x0006, 0x080c, 0x57d9, 0x9084, 0x0030, 0x9086, 0x0010,
-- 0x000e, 0x0005, 0x0006, 0x080c, 0x57d9, 0x9084, 0x0030, 0x9086,
-- 0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c, 0x2004,
-- 0x908c, 0x0013, 0x0168, 0x0020, 0x080c, 0x2907, 0x900e, 0x0010,
-- 0x2009, 0x0002, 0x2019, 0x0028, 0x080c, 0x321b, 0x9006, 0x0019,
-- 0x001e, 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130,
-- 0x080c, 0xd7dc, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef,
-- 0x2072, 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006, 0x600c,
-- 0x0006, 0x6004, 0x0006, 0x6028, 0x0006, 0x0016, 0x6138, 0x6050,
-- 0x9084, 0xfbff, 0x9085, 0x2000, 0x6052, 0x613a, 0x20a9, 0x0012,
-- 0x1d04, 0x76a0, 0x2091, 0x6000, 0x1f04, 0x76a0, 0x602f, 0x0100,
-- 0x602f, 0x0000, 0x6050, 0x9085, 0x0400, 0x9084, 0xdfff, 0x6052,
-- 0x613a, 0x001e, 0x602f, 0x0040, 0x602f, 0x0000, 0x000e, 0x602a,
-- 0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3, 0x0000,
-- 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x28e7, 0x2001, 0x00a0,
-- 0x0006, 0x080c, 0xd7e3, 0x000e, 0x0130, 0x080c, 0x2d57, 0x9006,
-- 0x080c, 0x2d63, 0x0010, 0x080c, 0x2d39, 0x000e, 0x6052, 0x6050,
-- 0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079, 0x0100, 0x080c, 0x2bd6,
-- 0x00fe, 0x000e, 0x6052, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
-+ 0x001f, 0x0005, 0x080c, 0x1b06, 0x60e3, 0x0001, 0x600c, 0xc0b4,
-+ 0x600e, 0x080c, 0x765c, 0x2001, 0x0080, 0x080c, 0x2d39, 0x6124,
-+ 0xd1d4, 0x1198, 0xd1dc, 0x1170, 0xd1e4, 0x1148, 0x9184, 0x1e00,
-+ 0x1118, 0x709b, 0x0029, 0x0058, 0x709b, 0x0028, 0x0040, 0x709b,
-+ 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
-+ 0x6124, 0xd1d4, 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184,
-+ 0x1e00, 0x1158, 0x709b, 0x0029, 0x0040, 0x709b, 0x001e, 0x0028,
-+ 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x2001, 0x00a0,
-+ 0x080c, 0x2d39, 0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c,
-+ 0x1b06, 0x709b, 0x001e, 0x0010, 0x709b, 0x001d, 0x0005, 0x080c,
-+ 0x7510, 0x6124, 0xd1dc, 0x1188, 0x080c, 0x748d, 0x0016, 0x080c,
-+ 0x1b06, 0x001e, 0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x709b, 0x001e,
-+ 0x0020, 0x709b, 0x001f, 0x080c, 0x748d, 0x0005, 0x0006, 0x2001,
-+ 0x00a0, 0x080c, 0x2d39, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc,
-+ 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028,
-+ 0x709b, 0x001d, 0x0010, 0x709b, 0x0021, 0x0005, 0x080c, 0x7510,
-+ 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b,
-+ 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
-+ 0x0006, 0x2001, 0x0090, 0x080c, 0x2d39, 0x000e, 0x6124, 0xd1d4,
-+ 0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x709b,
-+ 0x001e, 0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010,
-+ 0x709b, 0x001f, 0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126,
-+ 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000,
-+ 0x080c, 0x7630, 0x11d8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01b0,
-+ 0xc1b4, 0x2102, 0x6027, 0x0200, 0x080c, 0x2c61, 0x6024, 0xd0cc,
-+ 0x0148, 0x2001, 0x00a0, 0x080c, 0x2d39, 0x080c, 0x792b, 0x080c,
-+ 0x6127, 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x764a,
-+ 0x0150, 0x080c, 0x7641, 0x1138, 0x2001, 0x0001, 0x080c, 0x281c,
-+ 0x080c, 0x7608, 0x00a0, 0x080c, 0x750d, 0x0178, 0x2001, 0x0001,
-+ 0x080c, 0x281c, 0x7098, 0x9086, 0x001e, 0x0120, 0x7098, 0x9086,
-+ 0x0022, 0x1118, 0x709b, 0x0025, 0x0010, 0x709b, 0x0021, 0x012e,
-+ 0x00ee, 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x749e,
-+ 0x080c, 0x8910, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011,
-+ 0x749e, 0x080c, 0x8907, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6,
-+ 0x0016, 0x080c, 0xa6e2, 0x2071, 0x1800, 0x080c, 0x743b, 0x001e,
-+ 0x00fe, 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
-+ 0x00e6, 0x00f6, 0x0126, 0x2071, 0x1800, 0x080c, 0xa6e2, 0x2061,
-+ 0x0100, 0x2069, 0x0140, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a,
-+ 0x2011, 0x0003, 0x080c, 0xaab8, 0x2011, 0x0002, 0x080c, 0xaac2,
-+ 0x080c, 0xa9cc, 0x080c, 0x88bc, 0x0036, 0x901e, 0x080c, 0xaa42,
-+ 0x003e, 0x60e3, 0x0000, 0x080c, 0xf078, 0x080c, 0xf093, 0x2009,
-+ 0x0004, 0x080c, 0x2c67, 0x080c, 0x2b82, 0x2001, 0x1800, 0x2003,
-+ 0x0004, 0x6027, 0x0008, 0x2011, 0x749e, 0x080c, 0x8910, 0x080c,
-+ 0x764a, 0x0118, 0x9006, 0x080c, 0x2d39, 0x080c, 0x0ba0, 0x2001,
-+ 0x0001, 0x080c, 0x281c, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x74ab,
-+ 0x2071, 0x19fb, 0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110,
-+ 0x9085, 0x0001, 0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005,
-+ 0x6800, 0x9084, 0xfffe, 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0,
-+ 0x080c, 0x2d39, 0x0156, 0x20a9, 0x002d, 0x1d04, 0x751d, 0x2091,
-+ 0x6000, 0x1f04, 0x751d, 0x015e, 0x00d6, 0x2069, 0x1800, 0x689c,
-+ 0x8001, 0x0220, 0x0118, 0x689e, 0x00de, 0x0005, 0x689f, 0x0014,
-+ 0x68e8, 0xd0dc, 0x0dc8, 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c,
-+ 0x891c, 0x0c90, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
-+ 0x0140, 0x2071, 0x1800, 0x080c, 0x793a, 0x2001, 0x196d, 0x2003,
-+ 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c, 0x28e7, 0x9006,
-+ 0x080c, 0x2d39, 0x080c, 0x5fe6, 0x6027, 0xffff, 0x602b, 0x182f,
-+ 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061,
-+ 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001, 0x197d, 0x200c,
-+ 0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158, 0x9186, 0x0002,
-+ 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x75f8, 0x709b, 0x0022,
-+ 0x0040, 0x709b, 0x0021, 0x0028, 0x709b, 0x0023, 0x0010, 0x709b,
-+ 0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c,
-+ 0x28e7, 0x0026, 0x080c, 0xb23d, 0x002e, 0x7000, 0x908e, 0x0004,
-+ 0x0118, 0x602b, 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126,
-+ 0x2091, 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e,
-+ 0x015e, 0x080c, 0xd7dc, 0x0118, 0x9006, 0x080c, 0x2d63, 0x0804,
-+ 0x7604, 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2c61,
-+ 0x6904, 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2d39, 0x1f04,
-+ 0x759c, 0x080c, 0x7684, 0x012e, 0x015e, 0x080c, 0x7641, 0x01d8,
-+ 0x6044, 0x9005, 0x0198, 0x2011, 0x0114, 0x2204, 0x9085, 0x0100,
-+ 0x2012, 0x6050, 0x0006, 0x9085, 0x0020, 0x6052, 0x080c, 0x7684,
-+ 0x9006, 0x8001, 0x1df0, 0x000e, 0x6052, 0x0028, 0x6804, 0xd0d4,
-+ 0x1110, 0x080c, 0x7684, 0x080c, 0xd7dc, 0x0118, 0x9006, 0x080c,
-+ 0x2d63, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130, 0x2009,
-+ 0x00c8, 0x2011, 0x74ab, 0x080c, 0x88ce, 0x002e, 0x001e, 0x080c,
-+ 0x8715, 0x7034, 0xc085, 0x7036, 0x2001, 0x197d, 0x2003, 0x0004,
-+ 0x080c, 0x72ee, 0x080c, 0x7641, 0x0138, 0x6804, 0xd0d4, 0x1120,
-+ 0xd0dc, 0x1100, 0x080c, 0x7930, 0x00ee, 0x00de, 0x00ce, 0x0005,
- 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-- 0x1800, 0x6020, 0x9084, 0x0080, 0x0138, 0x2001, 0x180c, 0x200c,
-- 0xc1c5, 0x2102, 0x0804, 0x7766, 0x2001, 0x180c, 0x200c, 0xc1c4,
-- 0x2102, 0x6028, 0x9084, 0xe1ff, 0x602a, 0x6027, 0x0200, 0x2001,
-- 0x0090, 0x080c, 0x2d39, 0x20a9, 0x0366, 0x6024, 0xd0cc, 0x1518,
-- 0x1d04, 0x770d, 0x2091, 0x6000, 0x1f04, 0x770d, 0x2011, 0x0003,
-- 0x080c, 0xaabf, 0x2011, 0x0002, 0x080c, 0xaac9, 0x080c, 0xa9d3,
-- 0x901e, 0x080c, 0xaa49, 0x2001, 0x00a0, 0x080c, 0x2d39, 0x080c,
-- 0x7932, 0x080c, 0x612e, 0x080c, 0xd7e3, 0x0110, 0x080c, 0x0d33,
-- 0x9085, 0x0001, 0x04c8, 0x080c, 0x1b06, 0x60e3, 0x0000, 0x2001,
-- 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002, 0x1118, 0x2001, 0x196d,
-- 0x2004, 0x080c, 0x28e7, 0x60e2, 0x2001, 0x0080, 0x080c, 0x2d39,
-- 0x20a9, 0x0366, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c61,
-- 0x6024, 0x910c, 0x0140, 0x1d04, 0x774a, 0x2091, 0x6000, 0x1f04,
-- 0x774a, 0x0804, 0x7716, 0x6028, 0x9085, 0x1e00, 0x602a, 0x70b4,
-- 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xd7e3,
-- 0x0110, 0x080c, 0x0d33, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e,
-- 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
-- 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x7000,
-- 0x9086, 0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084, 0x5540,
-- 0x9086, 0x5540, 0x1128, 0x2069, 0x1a7c, 0x2d04, 0x8000, 0x206a,
-- 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884, 0x9005,
-- 0x1904, 0x77d9, 0x2001, 0x0088, 0x080c, 0x2d39, 0x9006, 0x60e2,
-- 0x6886, 0x080c, 0x28e7, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118,
-- 0x6808, 0x9005, 0x01c0, 0x6028, 0x9084, 0xfbff, 0x602a, 0x6027,
-- 0x0400, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b, 0x0026, 0x7003,
-- 0x0001, 0x20a9, 0x0002, 0x1d04, 0x77bb, 0x2091, 0x6000, 0x1f04,
-- 0x77bb, 0x0804, 0x7810, 0x2069, 0x0140, 0x20a9, 0x0384, 0x6027,
-- 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c61, 0x6024, 0x910c, 0x0508,
-- 0x9084, 0x1a00, 0x11f0, 0x1d04, 0x77c7, 0x2091, 0x6000, 0x1f04,
-- 0x77c7, 0x2011, 0x0003, 0x080c, 0xaabf, 0x2011, 0x0002, 0x080c,
-- 0xaac9, 0x080c, 0xa9d3, 0x901e, 0x080c, 0xaa49, 0x2001, 0x00a0,
-- 0x080c, 0x2d39, 0x080c, 0x7932, 0x080c, 0x612e, 0x9085, 0x0001,
-- 0x00f8, 0x080c, 0x1b06, 0x2001, 0x0080, 0x080c, 0x2d39, 0x2069,
-- 0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001,
-- 0x0008, 0x6886, 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002,
-- 0x1118, 0x2001, 0x196d, 0x2004, 0x080c, 0x28e7, 0x60e2, 0x9006,
-- 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
-- 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
-- 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0, 0x01c8, 0x2011,
-- 0x0003, 0x080c, 0xaabf, 0x2011, 0x0002, 0x080c, 0xaac9, 0x080c,
-- 0xa9d3, 0x901e, 0x080c, 0xaa49, 0x2069, 0x0140, 0x2001, 0x00a0,
-- 0x080c, 0x2d39, 0x080c, 0x7932, 0x080c, 0x612e, 0x0804, 0x78b2,
-- 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160, 0xc1b5, 0x2102, 0x080c,
-- 0x749a, 0x2069, 0x0140, 0x2001, 0x0080, 0x080c, 0x2d39, 0x60e3,
-- 0x0000, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005,
-- 0x0180, 0x6028, 0x9084, 0xfdff, 0x602a, 0x6027, 0x0200, 0x2069,
-- 0x198f, 0x7000, 0x206a, 0x709b, 0x0027, 0x7003, 0x0001, 0x0804,
-- 0x78b2, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c61, 0x6024,
-- 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x7869, 0x0006,
-- 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x8776, 0x00ee, 0x00de,
-- 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x19fb, 0x7078, 0x00ee,
-- 0x9005, 0x19f8, 0x0438, 0x0026, 0x2011, 0x74b2, 0x080c, 0x883d,
-- 0x2011, 0x74a5, 0x080c, 0x8917, 0x002e, 0x2069, 0x0140, 0x60e3,
-- 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886,
-+ 0x1800, 0x080c, 0x872c, 0x080c, 0x871e, 0x080c, 0x793a, 0x2001,
-+ 0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c,
-+ 0x28e7, 0x9006, 0x080c, 0x2d39, 0x6043, 0x0090, 0x6043, 0x0010,
-+ 0x6027, 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005,
-+ 0x0006, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005,
-+ 0x0006, 0x080c, 0x57d7, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e,
-+ 0x0005, 0x0006, 0x080c, 0x57d7, 0x9084, 0x0030, 0x9086, 0x0030,
-+ 0x000e, 0x0005, 0x0006, 0x080c, 0x57d7, 0x9084, 0x0030, 0x9086,
-+ 0x0010, 0x000e, 0x0005, 0x0006, 0x080c, 0x57d7, 0x9084, 0x0030,
-+ 0x9086, 0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c,
-+ 0x2004, 0x908c, 0x0013, 0x0168, 0x0020, 0x080c, 0x2907, 0x900e,
-+ 0x0010, 0x2009, 0x0002, 0x2019, 0x0028, 0x080c, 0x321b, 0x9006,
-+ 0x0019, 0x001e, 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04,
-+ 0x0130, 0x080c, 0xd7d5, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084,
-+ 0xffef, 0x2072, 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006,
-+ 0x600c, 0x0006, 0x6004, 0x0006, 0x6028, 0x0006, 0x0016, 0x6138,
-+ 0x6050, 0x9084, 0xfbff, 0x9085, 0x2000, 0x6052, 0x613a, 0x20a9,
-+ 0x0012, 0x1d04, 0x7699, 0x2091, 0x6000, 0x1f04, 0x7699, 0x602f,
-+ 0x0100, 0x602f, 0x0000, 0x6050, 0x9085, 0x0400, 0x9084, 0xdfff,
-+ 0x6052, 0x613a, 0x001e, 0x602f, 0x0040, 0x602f, 0x0000, 0x000e,
-+ 0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3,
-+ 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x28e7, 0x2001,
-+ 0x00a0, 0x0006, 0x080c, 0xd7dc, 0x000e, 0x0130, 0x080c, 0x2d57,
-+ 0x9006, 0x080c, 0x2d63, 0x0010, 0x080c, 0x2d39, 0x000e, 0x6052,
-+ 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079, 0x0100, 0x080c,
-+ 0x2bd6, 0x00fe, 0x000e, 0x6052, 0x0005, 0x0156, 0x0016, 0x0026,
-+ 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140,
-+ 0x2071, 0x1800, 0x6020, 0x9084, 0x0080, 0x0138, 0x2001, 0x180c,
-+ 0x200c, 0xc1c5, 0x2102, 0x0804, 0x775f, 0x2001, 0x180c, 0x200c,
-+ 0xc1c4, 0x2102, 0x6028, 0x9084, 0xe1ff, 0x602a, 0x6027, 0x0200,
-+ 0x2001, 0x0090, 0x080c, 0x2d39, 0x20a9, 0x0366, 0x6024, 0xd0cc,
-+ 0x1518, 0x1d04, 0x7706, 0x2091, 0x6000, 0x1f04, 0x7706, 0x2011,
-+ 0x0003, 0x080c, 0xaab8, 0x2011, 0x0002, 0x080c, 0xaac2, 0x080c,
-+ 0xa9cc, 0x901e, 0x080c, 0xaa42, 0x2001, 0x00a0, 0x080c, 0x2d39,
-+ 0x080c, 0x792b, 0x080c, 0x6127, 0x080c, 0xd7dc, 0x0110, 0x080c,
-+ 0x0d33, 0x9085, 0x0001, 0x04c8, 0x080c, 0x1b06, 0x60e3, 0x0000,
- 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002, 0x1118, 0x2001,
-- 0x196d, 0x2004, 0x080c, 0x28e7, 0x60e2, 0x2001, 0x180c, 0x200c,
-- 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-- 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6,
-- 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xd7dc, 0x1904,
-- 0x7920, 0x7130, 0xd184, 0x1170, 0x080c, 0x33aa, 0x0138, 0xc18d,
-- 0x7132, 0x2011, 0x1848, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c,
-- 0x0904, 0x7920, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538, 0x0016,
-- 0x2019, 0x000e, 0x080c, 0xeba1, 0x0156, 0x00b6, 0x20a9, 0x007f,
-- 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188, 0x080c,
-- 0x6724, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c,
-- 0xec31, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8a50, 0x001e,
-- 0x8108, 0x1f04, 0x78e9, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148,
-- 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x321b, 0x001e,
-- 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6724,
-- 0x1110, 0x080c, 0x6148, 0x8108, 0x1f04, 0x7916, 0x00be, 0x015e,
-- 0x080c, 0x1b06, 0x080c, 0xb244, 0x60e3, 0x0000, 0x080c, 0x612e,
-- 0x080c, 0x7563, 0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e, 0x001e,
-- 0x015e, 0x0005, 0x2001, 0x197d, 0x2003, 0x0001, 0x0005, 0x2001,
-- 0x197d, 0x2003, 0x0000, 0x0005, 0x2001, 0x197c, 0x2003, 0xaaaa,
-- 0x0005, 0x2001, 0x197c, 0x2003, 0x0000, 0x0005, 0x2071, 0x18fa,
-- 0x7003, 0x0000, 0x7007, 0x0000, 0x080c, 0x1027, 0x090c, 0x0dc5,
-- 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c, 0x1027, 0x090c, 0x0dc5,
-- 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000, 0xa86b, 0x0001,
-- 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071, 0x0040, 0x6848, 0x9005,
-- 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840, 0x9005, 0x0150, 0x04a1,
-- 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101, 0x7006, 0x9006, 0x7012,
-- 0x7016, 0x6850, 0x7002, 0x6854, 0x7006, 0x6858, 0x700a, 0x685c,
-- 0x700e, 0x6840, 0x9005, 0x1110, 0x7012, 0x7016, 0x6848, 0x701a,
-- 0x701c, 0x9085, 0x0040, 0x701e, 0x2001, 0x0019, 0x7036, 0x702b,
-- 0x0001, 0x2001, 0x0004, 0x200c, 0x918c, 0xfff7, 0x918d, 0x8000,
-- 0x2102, 0x00d6, 0x2069, 0x18fa, 0x6807, 0x0001, 0x00de, 0x080c,
-- 0x7f74, 0x9006, 0x00ee, 0x0005, 0x900e, 0x0156, 0x20a9, 0x0006,
-- 0x8003, 0x2011, 0x0100, 0x2214, 0x9296, 0x0008, 0x1110, 0x818d,
-- 0x0010, 0x81f5, 0x3e08, 0x1f04, 0x79a8, 0x015e, 0x0005, 0x2079,
-- 0x0040, 0x2071, 0x18fa, 0x7004, 0x0002, 0x79c7, 0x79c8, 0x7a00,
-- 0x7a5b, 0x7bbb, 0x79c5, 0x79c5, 0x7be5, 0x080c, 0x0dc5, 0x0005,
-- 0x2079, 0x0040, 0x782c, 0x908c, 0x0780, 0x190c, 0x8056, 0xd0a4,
-- 0x01f8, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084,
-- 0x00ff, 0x908a, 0x0040, 0x0610, 0x00c0, 0x2001, 0x1800, 0x200c,
-- 0x9186, 0x0003, 0x1168, 0x7004, 0x0002, 0x79f0, 0x79ca, 0x79f0,
-- 0x79ee, 0x79f0, 0x79f0, 0x79f0, 0x79f0, 0x79f0, 0x080c, 0x7a5b,
-- 0x782c, 0xd09c, 0x090c, 0x7f74, 0x0005, 0x9082, 0x005a, 0x1218,
-- 0x2100, 0x003b, 0x0c10, 0x080c, 0x7a91, 0x0c90, 0x00e3, 0x08e8,
-- 0x0005, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7ab3, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a9d, 0x7a91, 0x7cdb,
-- 0x7a91, 0x7a91, 0x7a91, 0x7ab3, 0x7a91, 0x7a9d, 0x7d1c, 0x7d5d,
-- 0x7da4, 0x7db8, 0x7a91, 0x7a91, 0x7ab3, 0x7a9d, 0x7ac7, 0x7a91,
-- 0x7b8f, 0x7e63, 0x7e7e, 0x7a91, 0x7ab3, 0x7a91, 0x7ac7, 0x7a91,
-- 0x7a91, 0x7b85, 0x7e7e, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7adb, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7a91, 0x7ffa, 0x7a91,
-- 0x7fa4, 0x7a91, 0x7fa4, 0x7a91, 0x7af0, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a91, 0x7a91, 0x7a91, 0x2079, 0x0040, 0x7004, 0x9086, 0x0003,
-- 0x1198, 0x782c, 0x080c, 0x7f9d, 0xd0a4, 0x0170, 0x7824, 0x2048,
-- 0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x001a,
-- 0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c, 0x7f74, 0x0005, 0x7a91,
-- 0x7a9d, 0x7cc7, 0x7a91, 0x7a9d, 0x7a91, 0x7a9d, 0x7a9d, 0x7a91,
-- 0x7a9d, 0x7cc7, 0x7a9d, 0x7a9d, 0x7a9d, 0x7a9d, 0x7a9d, 0x7a91,
-- 0x7a9d, 0x7cc7, 0x7a91, 0x7a91, 0x7a9d, 0x7a91, 0x7a91, 0x7a91,
-- 0x7a9d, 0x00e6, 0x2071, 0x18fa, 0x2009, 0x0400, 0x0071, 0x00ee,
-- 0x0005, 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000, 0x0029,
-- 0x0005, 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001, 0xa868,
-- 0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x6e9f, 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08,
-- 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7c64, 0x7007, 0x0003,
-- 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7c64, 0x0005, 0xa864,
-- 0x8007, 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007, 0x0001,
-- 0x0804, 0x7c7f, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a,
-- 0x704b, 0x7c7f, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0904,
-- 0x7a99, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7c9b, 0x7007,
-- 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7c9b, 0x0005,
-- 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x7a99,
-- 0x7007, 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1904, 0x7b5c,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x0904, 0x7b47, 0xa99c, 0x9186,
-- 0x00ff, 0x05e8, 0xa994, 0x9186, 0x006f, 0x0188, 0x9186, 0x0074,
-- 0x15b0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac7, 0x002e, 0x0578,
-- 0x0016, 0xa998, 0x080c, 0x6b11, 0x001e, 0x1548, 0x0400, 0x080c,
-- 0x7637, 0x0140, 0xa897, 0x4005, 0xa89b, 0x0016, 0x2001, 0x0030,
-- 0x900e, 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x6ac7, 0x002e,
-- 0x01b0, 0x0016, 0x0026, 0x0036, 0xa998, 0xaaa0, 0xab9c, 0x918d,
-- 0x8000, 0x080c, 0x6b11, 0x003e, 0x002e, 0x001e, 0x1140, 0xa897,
-- 0x4005, 0xa89b, 0x4009, 0x2001, 0x0030, 0x900e, 0x0050, 0xa868,
-- 0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x63c5, 0x1108,
-- 0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a, 0xa982,
-- 0x080c, 0x6e9f, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071, 0x0904,
-- 0x7b00, 0x9186, 0x0064, 0x0904, 0x7b00, 0x9186, 0x007c, 0x0904,
-- 0x7b00, 0x9186, 0x0028, 0x0904, 0x7b00, 0x9186, 0x0038, 0x0904,
-- 0x7b00, 0x9186, 0x0078, 0x0904, 0x7b00, 0x9186, 0x005f, 0x0904,
-- 0x7b00, 0x9186, 0x0056, 0x0904, 0x7b00, 0xa897, 0x4005, 0xa89b,
-- 0x0001, 0x2001, 0x0030, 0x900e, 0x0860, 0xa87c, 0x9084, 0x00c0,
-- 0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x7e95, 0x2900,
-- 0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080,
-- 0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401, 0x1a04,
-- 0x7aa1, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7aa1, 0x82ff, 0x1138,
-- 0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7c22, 0x0018, 0x9280,
-- 0x7c18, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7c03, 0x080c,
-- 0x1027, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022, 0x7054,
-- 0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004, 0x9100,
-- 0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e, 0x2200,
-- 0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108, 0x9108,
-- 0xa17a, 0x810b, 0xa17e, 0x080c, 0x10f8, 0xa06c, 0x908e, 0x0100,
-- 0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005, 0x7020,
-- 0x2048, 0x080c, 0x1040, 0x7014, 0x2048, 0x0804, 0x7aa1, 0x7020,
-- 0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048, 0xa906,
-- 0x711a, 0x0804, 0x7bbb, 0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4,
-- 0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864,
-- 0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x7e95, 0x0804, 0x7c64,
-- 0x7c1a, 0x7c1e, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a, 0x001b,
-- 0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076, 0x0066,
-- 0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de,
-- 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca,
-- 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2, 0xb7be,
-- 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094, 0xb09e,
-- 0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088, 0xb08a,
-- 0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e,
-- 0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055,
-- 0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1834, 0x210c, 0x81ff,
-- 0x1178, 0x080c, 0x61c2, 0x1108, 0x0005, 0x080c, 0x710b, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0xd3ce, 0x080c, 0x6e9f, 0x012e, 0x0ca0,
-- 0x080c, 0xd7dc, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70, 0x2009,
-- 0x1834, 0x210c, 0x81ff, 0x1188, 0xa888, 0x9005, 0x0188, 0xa883,
-- 0x0000, 0x080c, 0x6252, 0x1108, 0x0005, 0xa87a, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0x6e9f, 0x012e, 0x0cb8, 0x2001, 0x0028, 0x0ca8,
-- 0x2001, 0x0000, 0x0c90, 0x0419, 0x11d8, 0xa888, 0x9005, 0x01e0,
-- 0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x6327, 0x1138,
-- 0x0005, 0x9006, 0xa87a, 0x080c, 0x629f, 0x1108, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0xa87a, 0xa982, 0x080c, 0x6e9f, 0x012e, 0x0cb0,
-- 0x2001, 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x00c6,
-- 0x2061, 0x1800, 0x60d0, 0x9005, 0x0100, 0x00ce, 0x0005, 0x7018,
-- 0xa802, 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012,
-- 0x0118, 0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007, 0x0001,
-- 0x7048, 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878,
-- 0x9084, 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096,
-- 0x0001, 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160,
-- 0x9005, 0x11d8, 0xa974, 0x080c, 0x6724, 0x11b8, 0x0066, 0xae80,
-- 0x080c, 0x6834, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224,
-- 0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x6724, 0x1110, 0x080c,
-- 0x6934, 0x8108, 0x1f04, 0x7d04, 0x00ce, 0xa87c, 0xd084, 0x1120,
-- 0x080c, 0x1040, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x6e9f, 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007,
-- 0x0001, 0x080c, 0x6a9f, 0x0580, 0x2061, 0x1a74, 0x6100, 0xd184,
-- 0x0178, 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520,
-- 0x6004, 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8,
-- 0x2011, 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000,
-- 0x6016, 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007,
-- 0x9084, 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d,
-- 0x6202, 0x012e, 0x0804, 0x7f5e, 0x012e, 0x0804, 0x7f58, 0x012e,
-- 0x0804, 0x7f52, 0x012e, 0x0804, 0x7f55, 0x0126, 0x2091, 0x8000,
-- 0x7007, 0x0001, 0x080c, 0x6a9f, 0x05e0, 0x2061, 0x1a74, 0x6000,
-- 0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484,
-- 0x0003, 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100,
-- 0x9210, 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0,
-- 0x9484, 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082,
-- 0x0004, 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004,
-- 0x1168, 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000,
-- 0x6016, 0x6206, 0x630a, 0x012e, 0x0804, 0x7f5e, 0x012e, 0x0804,
-- 0x7f5b, 0x012e, 0x0804, 0x7f58, 0x0126, 0x2091, 0x8000, 0x7007,
-- 0x0001, 0x2061, 0x1a74, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318,
-- 0x0220, 0x630a, 0x012e, 0x0804, 0x7f6c, 0x012e, 0x0804, 0x7f5b,
-- 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c,
-- 0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a74, 0x6000, 0x9084, 0xfcff,
-- 0x6002, 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065,
-- 0x0598, 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c, 0xb306,
-- 0x0068, 0x6017, 0xf400, 0x605b, 0x0000, 0xa97c, 0xd1a4, 0x0110,
-- 0xa980, 0x615a, 0x2009, 0x0041, 0x080c, 0xb352, 0xa988, 0x918c,
-- 0xff00, 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff,
-- 0x080c, 0x8a50, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a74,
-- 0x6000, 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce,
-- 0x012e, 0x00be, 0x0804, 0x7f5e, 0x00ce, 0x012e, 0x00be, 0x0804,
-- 0x7f58, 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18,
-- 0x9186, 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c,
-- 0x200c, 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186,
-- 0x0029, 0x1d10, 0xa974, 0x080c, 0x6724, 0x1968, 0xb800, 0xc0e4,
-- 0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001,
-- 0x1986, 0x2004, 0x601a, 0x0804, 0x7df3, 0xa88c, 0x9065, 0x0960,
-- 0x00e6, 0xa890, 0x9075, 0x2001, 0x1834, 0x2004, 0x9005, 0x0150,
-- 0x080c, 0xb306, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xb306, 0x00ee,
-- 0x0804, 0x7df3, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007,
-- 0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e,
-- 0xa8a8, 0x6016, 0x6003, 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1,
-- 0x00ee, 0x0804, 0x7df3, 0x2061, 0x1a74, 0x6000, 0xd084, 0x0190,
-- 0xd08c, 0x1904, 0x7f6c, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210,
-- 0x0220, 0x6206, 0x012e, 0x0804, 0x7f6c, 0x012e, 0xa883, 0x0016,
-- 0x0804, 0x7f65, 0xa883, 0x0007, 0x0804, 0x7f65, 0xa864, 0x8007,
-- 0x9084, 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069,
-- 0x0005, 0x080c, 0x7a99, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900,
-- 0x7016, 0x701a, 0x704b, 0x7e95, 0x0005, 0x00b6, 0x00e6, 0x0126,
-- 0x2091, 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff, 0x1904,
-- 0x7f17, 0x6130, 0xd194, 0x1904, 0x7f41, 0xa878, 0x2070, 0x9e82,
-- 0x1cd0, 0x0a04, 0x7f0b, 0x6068, 0x9e02, 0x1a04, 0x7f0b, 0x7120,
-- 0x9186, 0x0006, 0x1904, 0x7efd, 0x7010, 0x905d, 0x0904, 0x7f17,
-- 0xb800, 0xd0e4, 0x1904, 0x7f3b, 0x2061, 0x1a74, 0x6100, 0x9184,
-- 0x0301, 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x7f44,
-- 0xa883, 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198,
-- 0x7116, 0xa87c, 0xd0f4, 0x1904, 0x7f47, 0x080c, 0x57d5, 0xd09c,
-- 0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x8970, 0x012e,
-- 0x00ee, 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902,
-- 0x2148, 0xa87c, 0xd0f4, 0x1904, 0x7f47, 0x012e, 0x00ee, 0x00be,
-- 0x0005, 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x7f65,
-- 0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x6724,
-- 0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118,
-- 0xa883, 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e,
-- 0x0460, 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c,
-- 0x57d9, 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1cd0, 0x02c0,
-- 0x6068, 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010,
-- 0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000,
-- 0x9086, 0x0007, 0x1904, 0x7ea1, 0x7003, 0x0002, 0x0804, 0x7ea1,
-- 0xa883, 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be,
-- 0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60,
-- 0x2019, 0x0002, 0x601b, 0x0014, 0x080c, 0xe754, 0x012e, 0x00ee,
-- 0x00be, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040,
-- 0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001,
-- 0xa884, 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x6e9f, 0x012e, 0x0005, 0x080c, 0x1040, 0x0005, 0x00d6,
-- 0x080c, 0x8967, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091,
-- 0x8000, 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780,
-- 0x190c, 0x8056, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0, 0x90ea,
-- 0x0020, 0x0278, 0x8001, 0x70c2, 0x702c, 0x2048, 0xa800, 0x702e,
-- 0x9006, 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c,
-- 0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780,
-- 0x190c, 0x8056, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003, 0x05a8,
-- 0x080c, 0xb27d, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084, 0x00ff,
-- 0x9086, 0x0035, 0x1138, 0x6008, 0xc0fd, 0x600a, 0x2001, 0x196b,
-- 0x2004, 0x0098, 0xa8a0, 0x9084, 0x00ff, 0xa99c, 0x918c, 0xff00,
-- 0x9105, 0xa99c, 0x918c, 0x00ff, 0x080c, 0x2873, 0x1540, 0x00b6,
-- 0x080c, 0x6724, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023, 0x0001,
-- 0x2009, 0x0040, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x0110,
-- 0x2009, 0x0041, 0x080c, 0xb352, 0x0005, 0xa87b, 0x0101, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e, 0x0005, 0xa87b, 0x002c,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e, 0x0005, 0xa87b,
-- 0x0028, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e, 0x080c,
-- 0xb2d3, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6,
-- 0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x8047, 0xa97c,
-- 0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140, 0x05e8,
-- 0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10,
-- 0x080c, 0xb27d, 0x1118, 0x080c, 0xb325, 0x05a8, 0x6212, 0xa874,
-- 0x0002, 0x8025, 0x802a, 0x802d, 0x8033, 0x2019, 0x0002, 0x080c,
-- 0xeba1, 0x0060, 0x080c, 0xeb38, 0x0048, 0x2019, 0x0002, 0xa980,
-- 0x080c, 0xeb53, 0x0018, 0xa980, 0x080c, 0xeb38, 0x080c, 0xb2d3,
-- 0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e,
-- 0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005, 0xa887,
-- 0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50,
-- 0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091, 0x8000,
-- 0x0e04, 0x8058, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804,
-- 0x0dce, 0x2001, 0x1834, 0x2004, 0x9005, 0x0005, 0x0005, 0x00f6,
-- 0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102,
-- 0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x15a0, 0x00fe,
-- 0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300, 0x00fe,
-- 0x0005, 0x781c, 0xd08c, 0x0904, 0x80d8, 0x68c0, 0x90aa, 0x0005,
-- 0x0a04, 0x871c, 0x7d44, 0x7c40, 0x9584, 0x00f6, 0x1510, 0x9484,
-- 0x7000, 0x0140, 0x908a, 0x2000, 0x1260, 0x9584, 0x0700, 0x8007,
-- 0x0804, 0x80df, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x0da8,
-- 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084, 0xff00, 0x9086,
-- 0x8100, 0x11c0, 0x080c, 0xf057, 0x080c, 0x8601, 0x7817, 0x0140,
-- 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x865f, 0x19c0, 0xd5a4,
-- 0x0148, 0x0046, 0x0056, 0x080c, 0x813a, 0x080c, 0x236e, 0x005e,
-- 0x004e, 0x0020, 0x080c, 0xf057, 0x7817, 0x0140, 0x080c, 0x7637,
-- 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x6893, 0x0000,
-- 0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000, 0x080c, 0x811b,
-- 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9ab1, 0x0005, 0x0002,
-- 0x80f1, 0x8409, 0x80e8, 0x80e8, 0x80e8, 0x80e8, 0x80e8, 0x80e8,
-- 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9ab1,
-- 0x0005, 0x7000, 0x908c, 0xff00, 0x9194, 0xf000, 0x810f, 0x9484,
-- 0x0fff, 0x6892, 0x9286, 0x2000, 0x1150, 0x6800, 0x9086, 0x0001,
-- 0x1118, 0x080c, 0x583f, 0x0070, 0x080c, 0x815a, 0x0058, 0x9286,
-- 0x3000, 0x1118, 0x080c, 0x8341, 0x0028, 0x9286, 0x8000, 0x1110,
-- 0x080c, 0x8528, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005,
-- 0x090c, 0x9ab1, 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0178,
-- 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1148, 0x0026, 0x0036,
-- 0x2011, 0x8048, 0x2518, 0x080c, 0x4c44, 0x003e, 0x002e, 0x0005,
-- 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe,
-- 0x7c30, 0x0050, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200,
-- 0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001, 0x1810, 0x2004, 0xd08c,
-- 0x0160, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1130, 0x0026,
-- 0x2011, 0x8048, 0x080c, 0x4c44, 0x002e, 0x00fe, 0x005e, 0x004e,
-- 0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00, 0x8007,
-- 0x9096, 0x0001, 0x0120, 0x9096, 0x0023, 0x1904, 0x8312, 0x9186,
-- 0x0023, 0x15c0, 0x080c, 0x85c6, 0x0904, 0x8312, 0x6120, 0x9186,
-- 0x0001, 0x0150, 0x9186, 0x0004, 0x0138, 0x9186, 0x0008, 0x0120,
-- 0x9186, 0x000a, 0x1904, 0x8312, 0x7124, 0x610a, 0x7030, 0x908e,
-- 0x0200, 0x1130, 0x2009, 0x0015, 0x080c, 0xb352, 0x0804, 0x8312,
-- 0x908e, 0x0214, 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015,
-- 0x080c, 0xb352, 0x0804, 0x8312, 0x908e, 0x0100, 0x1904, 0x8312,
-- 0x7034, 0x9005, 0x1904, 0x8312, 0x2009, 0x0016, 0x080c, 0xb352,
-- 0x0804, 0x8312, 0x9186, 0x0022, 0x1904, 0x8312, 0x7030, 0x908e,
-- 0x0300, 0x1580, 0x68dc, 0xd0a4, 0x0528, 0xc0b5, 0x68de, 0x7100,
-- 0x918c, 0x00ff, 0x697e, 0x7004, 0x6882, 0x00f6, 0x2079, 0x0100,
-- 0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008, 0x080c,
-- 0x28bc, 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x2873,
-- 0x695e, 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0x1800,
-- 0x70b6, 0x00ee, 0x7034, 0x9005, 0x1904, 0x8312, 0x2009, 0x0017,
-- 0x0804, 0x82c2, 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904,
-- 0x8312, 0x080c, 0x7637, 0x0120, 0x2009, 0x001d, 0x0804, 0x82c2,
-- 0x68dc, 0xc0a5, 0x68de, 0x2009, 0x0030, 0x0804, 0x82c2, 0x908e,
-- 0x0500, 0x1140, 0x7034, 0x9005, 0x1904, 0x8312, 0x2009, 0x0018,
-- 0x0804, 0x82c2, 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804,
-- 0x82c2, 0x908e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x82c2,
-- 0x908e, 0x5200, 0x1140, 0x7034, 0x9005, 0x1904, 0x8312, 0x2009,
-- 0x001b, 0x0804, 0x82c2, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005,
-- 0x1904, 0x8312, 0x2009, 0x001c, 0x0804, 0x82c2, 0x908e, 0x1300,
-- 0x1120, 0x2009, 0x0034, 0x0804, 0x82c2, 0x908e, 0x1200, 0x1140,
-- 0x7034, 0x9005, 0x1904, 0x8312, 0x2009, 0x0024, 0x0804, 0x82c2,
-- 0x908c, 0xff00, 0x918e, 0x2400, 0x1170, 0x2009, 0x002d, 0x2001,
-- 0x1810, 0x2004, 0xd09c, 0x0904, 0x82c2, 0x080c, 0xdf1a, 0x1904,
-- 0x8312, 0x0804, 0x82c0, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120,
-- 0x2009, 0x002a, 0x0804, 0x82c2, 0x908e, 0x0f00, 0x1120, 0x2009,
-- 0x0020, 0x0804, 0x82c2, 0x908e, 0x6104, 0x1530, 0x2029, 0x0205,
-- 0x2011, 0x026d, 0x8208, 0x2204, 0x9082, 0x0004, 0x8004, 0x8004,
-- 0x20a8, 0x2011, 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c,
-- 0x4c44, 0x004e, 0x8108, 0x0f04, 0x8276, 0x9186, 0x0280, 0x1d88,
-- 0x2504, 0x8000, 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b, 0x0000,
-- 0x2009, 0x0023, 0x0804, 0x82c2, 0x908e, 0x6000, 0x1120, 0x2009,
-- 0x003f, 0x0804, 0x82c2, 0x908e, 0x5400, 0x1138, 0x080c, 0x86cc,
-- 0x1904, 0x8312, 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500, 0x1148,
-- 0x080c, 0x86f4, 0x1118, 0x2009, 0x0041, 0x0460, 0x2009, 0x0042,
-- 0x0448, 0x908e, 0x7800, 0x1118, 0x2009, 0x0045, 0x0418, 0x908e,
-- 0x1000, 0x1118, 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300, 0x1118,
-- 0x2009, 0x004a, 0x00b8, 0x908c, 0xff00, 0x918e, 0x5600, 0x1118,
-- 0x2009, 0x004f, 0x0078, 0x908c, 0xff00, 0x918e, 0x5700, 0x1118,
-- 0x2009, 0x0050, 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110,
-- 0x2009, 0x004c, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-- 0x080c, 0x2873, 0x1904, 0x8315, 0x080c, 0x66b9, 0x1904, 0x8315,
-- 0xbe12, 0xbd16, 0x001e, 0x0016, 0x080c, 0x7637, 0x01c0, 0x68dc,
-- 0xd08c, 0x1148, 0x7000, 0x9084, 0x00ff, 0x1188, 0x7004, 0x9084,
-- 0xff00, 0x1168, 0x0040, 0x687c, 0x9606, 0x1148, 0x6880, 0x9506,
-- 0x9084, 0xff00, 0x1120, 0x9584, 0x00ff, 0xb8c2, 0x0080, 0xb8c0,
-- 0x9005, 0x1168, 0x9186, 0x0046, 0x1150, 0x687c, 0x9606, 0x1138,
-- 0x6880, 0x9506, 0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c,
-- 0xb27d, 0x01a8, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
-- 0x001e, 0x9186, 0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e,
-- 0x080c, 0xb352, 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001,
-- 0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4c44,
-- 0x080c, 0xb325, 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120,
-- 0x610a, 0x001e, 0x0016, 0x9186, 0x0017, 0x0118, 0x9186, 0x0030,
-- 0x1128, 0x6007, 0x0009, 0x6017, 0x2900, 0x0020, 0x6007, 0x0051,
-- 0x6017, 0x0000, 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x9547,
-- 0x08a0, 0x080c, 0x873b, 0x1158, 0x080c, 0x3374, 0x1140, 0x7010,
-- 0x9084, 0xff00, 0x8007, 0x908e, 0x0008, 0x1108, 0x0009, 0x0005,
-- 0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c, 0xff00, 0x810f, 0x9186,
-- 0x0033, 0x11e8, 0x080c, 0x85c6, 0x0904, 0x83a1, 0x7124, 0x610a,
-- 0x7030, 0x908e, 0x0200, 0x1140, 0x7034, 0x9005, 0x15d0, 0x2009,
-- 0x0015, 0x080c, 0xb352, 0x04a8, 0x908e, 0x0100, 0x1590, 0x7034,
-- 0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0xb352, 0x0450, 0x9186,
-- 0x0032, 0x1538, 0x7030, 0x908e, 0x1400, 0x1518, 0x2009, 0x0038,
-- 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2873,
-- 0x11b8, 0x080c, 0x66b9, 0x11a0, 0xbe12, 0xbd16, 0x080c, 0xb27d,
-- 0x0178, 0x2b08, 0x6112, 0x080c, 0xd554, 0x6023, 0x0004, 0x7120,
-- 0x610a, 0x001e, 0x080c, 0xb352, 0x080c, 0x9ab1, 0x0010, 0x00ce,
-- 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x0046, 0x00e6,
-- 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8, 0x9592, 0xfffc,
-- 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804, 0x8403,
-- 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804, 0x8403, 0x9596,
-- 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011, 0x0000, 0x2019,
-- 0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071,
-- 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f, 0x2071, 0x1081,
-- 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0, 0x9496, 0x00ff,
-- 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600, 0x9706, 0xb814,
-- 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745, 0x1148, 0x94c6,
-- 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6, 0x0080, 0x1d20,
-- 0x8420, 0x8e70, 0x1f04, 0x83d8, 0x82ff, 0x1118, 0x9085, 0x0001,
-- 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee, 0x004e, 0x00be,
-- 0x0005, 0x2001, 0x1837, 0x200c, 0x9184, 0x0080, 0x0110, 0xd18c,
-- 0x0138, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184, 0x000f, 0x004a,
-- 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9ab1,
-- 0x0005, 0x8431, 0x8431, 0x8431, 0x85d8, 0x8431, 0x843a, 0x8465,
-- 0x84f3, 0x8431, 0x8431, 0x8431, 0x8431, 0x8431, 0x8431, 0x8431,
-- 0x8431, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c,
-- 0x9ab1, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120, 0x2160,
-- 0x9c8c, 0x0007, 0x11c0, 0x9c8a, 0x1cd0, 0x02a8, 0x6868, 0x9c02,
-- 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106,
-- 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a, 0x2009,
-- 0x0046, 0x080c, 0xb352, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004,
-- 0x9005, 0x090c, 0x9ab1, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x9484,
-- 0x0fff, 0x0904, 0x84c9, 0x7110, 0xd1bc, 0x1904, 0x84c9, 0x7108,
-- 0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094, 0xff00, 0x15b0,
-- 0x81ff, 0x15a0, 0x9080, 0x33b6, 0x200d, 0x918c, 0xff00, 0x810f,
-- 0x2001, 0x0080, 0x9106, 0x0904, 0x84c9, 0x080c, 0x66b9, 0x1904,
-- 0x84c9, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04, 0x9294,
-- 0xff00, 0x9286, 0x0600, 0x11a0, 0x080c, 0xb27d, 0x05e8, 0x2b08,
-- 0x7028, 0x6046, 0x702c, 0x604a, 0x6112, 0x6023, 0x0006, 0x7120,
-- 0x610a, 0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xe192, 0x0408,
-- 0x080c, 0x6aa3, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c, 0x83a5,
-- 0x11c0, 0x0898, 0x080c, 0xb27d, 0x2b08, 0x0198, 0x6112, 0x6023,
-- 0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007, 0x0005,
-- 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9547, 0x080c,
-- 0x9ab1, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c,
-- 0x9ab1, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec,
-- 0x0120, 0x2011, 0x8049, 0x080c, 0x4c44, 0x080c, 0xb325, 0x0d48,
-- 0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x6156,
-- 0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7020,
-- 0x2060, 0x9c84, 0x0007, 0x11c0, 0x9c82, 0x1cd0, 0x02a8, 0x6868,
-+ 0x196d, 0x2004, 0x080c, 0x28e7, 0x60e2, 0x2001, 0x0080, 0x080c,
-+ 0x2d39, 0x20a9, 0x0366, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c,
-+ 0x2c61, 0x6024, 0x910c, 0x0140, 0x1d04, 0x7743, 0x2091, 0x6000,
-+ 0x1f04, 0x7743, 0x0804, 0x770f, 0x6028, 0x9085, 0x1e00, 0x602a,
-+ 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c,
-+ 0xd7dc, 0x0110, 0x080c, 0x0d33, 0x9006, 0x00ee, 0x00de, 0x00ce,
-+ 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
-+ 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800,
-+ 0x7000, 0x9086, 0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084,
-+ 0x5540, 0x9086, 0x5540, 0x1128, 0x2069, 0x1a7c, 0x2d04, 0x8000,
-+ 0x206a, 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884,
-+ 0x9005, 0x1904, 0x77d2, 0x2001, 0x0088, 0x080c, 0x2d39, 0x9006,
-+ 0x60e2, 0x6886, 0x080c, 0x28e7, 0x2069, 0x0200, 0x6804, 0x9005,
-+ 0x1118, 0x6808, 0x9005, 0x01c0, 0x6028, 0x9084, 0xfbff, 0x602a,
-+ 0x6027, 0x0400, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b, 0x0026,
-+ 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x77b4, 0x2091, 0x6000,
-+ 0x1f04, 0x77b4, 0x0804, 0x7809, 0x2069, 0x0140, 0x20a9, 0x0384,
-+ 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c61, 0x6024, 0x910c,
-+ 0x0508, 0x9084, 0x1a00, 0x11f0, 0x1d04, 0x77c0, 0x2091, 0x6000,
-+ 0x1f04, 0x77c0, 0x2011, 0x0003, 0x080c, 0xaab8, 0x2011, 0x0002,
-+ 0x080c, 0xaac2, 0x080c, 0xa9cc, 0x901e, 0x080c, 0xaa42, 0x2001,
-+ 0x00a0, 0x080c, 0x2d39, 0x080c, 0x792b, 0x080c, 0x6127, 0x9085,
-+ 0x0001, 0x00f8, 0x080c, 0x1b06, 0x2001, 0x0080, 0x080c, 0x2d39,
-+ 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887,
-+ 0x0001, 0x0008, 0x6886, 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001,
-+ 0x0002, 0x1118, 0x2001, 0x196d, 0x2004, 0x080c, 0x28e7, 0x60e2,
-+ 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e,
-+ 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
-+ 0x2061, 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0, 0x01c8,
-+ 0x2011, 0x0003, 0x080c, 0xaab8, 0x2011, 0x0002, 0x080c, 0xaac2,
-+ 0x080c, 0xa9cc, 0x901e, 0x080c, 0xaa42, 0x2069, 0x0140, 0x2001,
-+ 0x00a0, 0x080c, 0x2d39, 0x080c, 0x792b, 0x080c, 0x6127, 0x0804,
-+ 0x78ab, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160, 0xc1b5, 0x2102,
-+ 0x080c, 0x7493, 0x2069, 0x0140, 0x2001, 0x0080, 0x080c, 0x2d39,
-+ 0x60e3, 0x0000, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808,
-+ 0x9005, 0x0180, 0x6028, 0x9084, 0xfdff, 0x602a, 0x6027, 0x0200,
-+ 0x2069, 0x198f, 0x7000, 0x206a, 0x709b, 0x0027, 0x7003, 0x0001,
-+ 0x0804, 0x78ab, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c61,
-+ 0x6024, 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x7862,
-+ 0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x876f, 0x00ee,
-+ 0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x19fb, 0x7078,
-+ 0x00ee, 0x9005, 0x19f8, 0x0438, 0x0026, 0x2011, 0x74ab, 0x080c,
-+ 0x8836, 0x2011, 0x749e, 0x080c, 0x8910, 0x002e, 0x2069, 0x0140,
-+ 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008,
-+ 0x6886, 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002, 0x1118,
-+ 0x2001, 0x196d, 0x2004, 0x080c, 0x28e7, 0x60e2, 0x2001, 0x180c,
-+ 0x200c, 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e,
-+ 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046,
-+ 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xd7d5,
-+ 0x1904, 0x7919, 0x7130, 0xd184, 0x1170, 0x080c, 0x33aa, 0x0138,
-+ 0xc18d, 0x7132, 0x2011, 0x1848, 0x2214, 0xd2ac, 0x1120, 0x7030,
-+ 0xd08c, 0x0904, 0x7919, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538,
-+ 0x0016, 0x2019, 0x000e, 0x080c, 0xeb9a, 0x0156, 0x00b6, 0x20a9,
-+ 0x007f, 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188,
-+ 0x080c, 0x671d, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e,
-+ 0x080c, 0xec2a, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8a49,
-+ 0x001e, 0x8108, 0x1f04, 0x78e2, 0x00be, 0x015e, 0x001e, 0xd1ac,
-+ 0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x321b,
-+ 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c,
-+ 0x671d, 0x1110, 0x080c, 0x6141, 0x8108, 0x1f04, 0x790f, 0x00be,
-+ 0x015e, 0x080c, 0x1b06, 0x080c, 0xb23d, 0x60e3, 0x0000, 0x080c,
-+ 0x6127, 0x080c, 0x755c, 0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e,
-+ 0x001e, 0x015e, 0x0005, 0x2001, 0x197d, 0x2003, 0x0001, 0x0005,
-+ 0x2001, 0x197d, 0x2003, 0x0000, 0x0005, 0x2001, 0x197c, 0x2003,
-+ 0xaaaa, 0x0005, 0x2001, 0x197c, 0x2003, 0x0000, 0x0005, 0x2071,
-+ 0x18fa, 0x7003, 0x0000, 0x7007, 0x0000, 0x080c, 0x1027, 0x090c,
-+ 0x0dc5, 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c, 0x1027, 0x090c,
-+ 0x0dc5, 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000, 0xa86b,
-+ 0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071, 0x0040, 0x6848,
-+ 0x9005, 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840, 0x9005, 0x0150,
-+ 0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101, 0x7006, 0x9006,
-+ 0x7012, 0x7016, 0x6850, 0x7002, 0x6854, 0x7006, 0x6858, 0x700a,
-+ 0x685c, 0x700e, 0x6840, 0x9005, 0x1110, 0x7012, 0x7016, 0x6848,
-+ 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x2001, 0x0019, 0x7036,
-+ 0x702b, 0x0001, 0x2001, 0x0004, 0x200c, 0x918c, 0xfff7, 0x918d,
-+ 0x8000, 0x2102, 0x00d6, 0x2069, 0x18fa, 0x6807, 0x0001, 0x00de,
-+ 0x080c, 0x7f6d, 0x9006, 0x00ee, 0x0005, 0x900e, 0x0156, 0x20a9,
-+ 0x0006, 0x8003, 0x2011, 0x0100, 0x2214, 0x9296, 0x0008, 0x1110,
-+ 0x818d, 0x0010, 0x81f5, 0x3e08, 0x1f04, 0x79a1, 0x015e, 0x0005,
-+ 0x2079, 0x0040, 0x2071, 0x18fa, 0x7004, 0x0002, 0x79c0, 0x79c1,
-+ 0x79f9, 0x7a54, 0x7bb4, 0x79be, 0x79be, 0x7bde, 0x080c, 0x0dc5,
-+ 0x0005, 0x2079, 0x0040, 0x782c, 0x908c, 0x0780, 0x190c, 0x804f,
-+ 0xd0a4, 0x01f8, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864,
-+ 0x9084, 0x00ff, 0x908a, 0x0040, 0x0610, 0x00c0, 0x2001, 0x1800,
-+ 0x200c, 0x9186, 0x0003, 0x1168, 0x7004, 0x0002, 0x79e9, 0x79c3,
-+ 0x79e9, 0x79e7, 0x79e9, 0x79e9, 0x79e9, 0x79e9, 0x79e9, 0x080c,
-+ 0x7a54, 0x782c, 0xd09c, 0x090c, 0x7f6d, 0x0005, 0x9082, 0x005a,
-+ 0x1218, 0x2100, 0x003b, 0x0c10, 0x080c, 0x7a8a, 0x0c90, 0x00e3,
-+ 0x08e8, 0x0005, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7aac, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a96, 0x7a8a,
-+ 0x7cd4, 0x7a8a, 0x7a8a, 0x7a8a, 0x7aac, 0x7a8a, 0x7a96, 0x7d15,
-+ 0x7d56, 0x7d9d, 0x7db1, 0x7a8a, 0x7a8a, 0x7aac, 0x7a96, 0x7ac0,
-+ 0x7a8a, 0x7b88, 0x7e5c, 0x7e77, 0x7a8a, 0x7aac, 0x7a8a, 0x7ac0,
-+ 0x7a8a, 0x7a8a, 0x7b7e, 0x7e77, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7ad4, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x7ff3,
-+ 0x7a8a, 0x7f9d, 0x7a8a, 0x7f9d, 0x7a8a, 0x7ae9, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a8a, 0x7a8a, 0x7a8a, 0x2079, 0x0040, 0x7004, 0x9086,
-+ 0x0003, 0x1198, 0x782c, 0x080c, 0x7f96, 0xd0a4, 0x0170, 0x7824,
-+ 0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a,
-+ 0x001a, 0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c, 0x7f6d, 0x0005,
-+ 0x7a8a, 0x7a96, 0x7cc0, 0x7a8a, 0x7a96, 0x7a8a, 0x7a96, 0x7a96,
-+ 0x7a8a, 0x7a96, 0x7cc0, 0x7a96, 0x7a96, 0x7a96, 0x7a96, 0x7a96,
-+ 0x7a8a, 0x7a96, 0x7cc0, 0x7a8a, 0x7a8a, 0x7a96, 0x7a8a, 0x7a8a,
-+ 0x7a8a, 0x7a96, 0x00e6, 0x2071, 0x18fa, 0x2009, 0x0400, 0x0071,
-+ 0x00ee, 0x0005, 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000,
-+ 0x0029, 0x0005, 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001,
-+ 0xa868, 0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x6e98, 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
-+ 0x0d08, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7c5d, 0x7007,
-+ 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7c5d, 0x0005,
-+ 0xa864, 0x8007, 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007,
-+ 0x0001, 0x0804, 0x7c78, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
-+ 0x701a, 0x704b, 0x7c78, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
-+ 0x0904, 0x7a92, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7c94,
-+ 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7c94,
-+ 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904,
-+ 0x7a92, 0x7007, 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1904,
-+ 0x7b55, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0904, 0x7b40, 0xa99c,
-+ 0x9186, 0x00ff, 0x05e8, 0xa994, 0x9186, 0x006f, 0x0188, 0x9186,
-+ 0x0074, 0x15b0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac0, 0x002e,
-+ 0x0578, 0x0016, 0xa998, 0x080c, 0x6b0a, 0x001e, 0x1548, 0x0400,
-+ 0x080c, 0x7630, 0x0140, 0xa897, 0x4005, 0xa89b, 0x0016, 0x2001,
-+ 0x0030, 0x900e, 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x6ac0,
-+ 0x002e, 0x01b0, 0x0016, 0x0026, 0x0036, 0xa998, 0xaaa0, 0xab9c,
-+ 0x918d, 0x8000, 0x080c, 0x6b0a, 0x003e, 0x002e, 0x001e, 0x1140,
-+ 0xa897, 0x4005, 0xa89b, 0x4009, 0x2001, 0x0030, 0x900e, 0x0050,
-+ 0xa868, 0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x63be,
-+ 0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a,
-+ 0xa982, 0x080c, 0x6e98, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071,
-+ 0x0904, 0x7af9, 0x9186, 0x0064, 0x0904, 0x7af9, 0x9186, 0x007c,
-+ 0x0904, 0x7af9, 0x9186, 0x0028, 0x0904, 0x7af9, 0x9186, 0x0038,
-+ 0x0904, 0x7af9, 0x9186, 0x0078, 0x0904, 0x7af9, 0x9186, 0x005f,
-+ 0x0904, 0x7af9, 0x9186, 0x0056, 0x0904, 0x7af9, 0xa897, 0x4005,
-+ 0xa89b, 0x0001, 0x2001, 0x0030, 0x900e, 0x0860, 0xa87c, 0x9084,
-+ 0x00c0, 0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x7e8e,
-+ 0x2900, 0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c,
-+ 0x9080, 0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c,
-+ 0x9080, 0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401,
-+ 0x1a04, 0x7a9a, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7a9a, 0x82ff,
-+ 0x1138, 0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7c1b, 0x0018,
-+ 0x9280, 0x7c11, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7bfc,
-+ 0x080c, 0x1027, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022,
-+ 0x7054, 0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004,
-+ 0x9100, 0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e,
-+ 0x2200, 0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108,
-+ 0x9108, 0xa17a, 0x810b, 0xa17e, 0x080c, 0x10f8, 0xa06c, 0x908e,
-+ 0x0100, 0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005,
-+ 0x7020, 0x2048, 0x080c, 0x1040, 0x7014, 0x2048, 0x0804, 0x7a9a,
-+ 0x7020, 0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048,
-+ 0xa906, 0x711a, 0x0804, 0x7bb4, 0x7014, 0x2048, 0x7007, 0x0001,
-+ 0xa8b4, 0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9,
-+ 0xa864, 0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x7e8e, 0x0804,
-+ 0x7c5d, 0x7c13, 0x7c17, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a,
-+ 0x001b, 0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076,
-+ 0x0066, 0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc,
-+ 0xb0de, 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0,
-+ 0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2,
-+ 0xb7be, 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094,
-+ 0xb09e, 0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088,
-+ 0xb08a, 0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c,
-+ 0xb07e, 0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004,
-+ 0x9055, 0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1834, 0x210c,
-+ 0x81ff, 0x1178, 0x080c, 0x61bb, 0x1108, 0x0005, 0x080c, 0x7104,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0xd3c7, 0x080c, 0x6e98, 0x012e,
-+ 0x0ca0, 0x080c, 0xd7d5, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70,
-+ 0x2009, 0x1834, 0x210c, 0x81ff, 0x1188, 0xa888, 0x9005, 0x0188,
-+ 0xa883, 0x0000, 0x080c, 0x624b, 0x1108, 0x0005, 0xa87a, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e, 0x0cb8, 0x2001, 0x0028,
-+ 0x0ca8, 0x2001, 0x0000, 0x0c90, 0x0419, 0x11d8, 0xa888, 0x9005,
-+ 0x01e0, 0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x6320,
-+ 0x1138, 0x0005, 0x9006, 0xa87a, 0x080c, 0x6298, 0x1108, 0x0005,
-+ 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982, 0x080c, 0x6e98, 0x012e,
-+ 0x0cb0, 0x2001, 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80,
-+ 0x00c6, 0x2061, 0x1800, 0x60d0, 0x9005, 0x0100, 0x00ce, 0x0005,
-+ 0x7018, 0xa802, 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001,
-+ 0x7012, 0x0118, 0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007,
-+ 0x0001, 0x7048, 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974,
-+ 0xa878, 0x9084, 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001,
-+ 0x9096, 0x0001, 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002,
-+ 0x0160, 0x9005, 0x11d8, 0xa974, 0x080c, 0x671d, 0x11b8, 0x0066,
-+ 0xae80, 0x080c, 0x682d, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c,
-+ 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x671d, 0x1110,
-+ 0x080c, 0x692d, 0x8108, 0x1f04, 0x7cfd, 0x00ce, 0xa87c, 0xd084,
-+ 0x1120, 0x080c, 0x1040, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x6e98, 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x7007, 0x0001, 0x080c, 0x6a98, 0x0580, 0x2061, 0x1a74, 0x6100,
-+ 0xd184, 0x0178, 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084,
-+ 0x0520, 0x6004, 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000,
-+ 0x00c8, 0x2011, 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e,
-+ 0x8000, 0x6016, 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888,
-+ 0x8007, 0x9084, 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108,
-+ 0xc28d, 0x6202, 0x012e, 0x0804, 0x7f57, 0x012e, 0x0804, 0x7f51,
-+ 0x012e, 0x0804, 0x7f4b, 0x012e, 0x0804, 0x7f4e, 0x0126, 0x2091,
-+ 0x8000, 0x7007, 0x0001, 0x080c, 0x6a98, 0x05e0, 0x2061, 0x1a74,
-+ 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78,
-+ 0x9484, 0x0003, 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120,
-+ 0x2100, 0x9210, 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212,
-+ 0x02f0, 0x9484, 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff,
-+ 0x9082, 0x0004, 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082,
-+ 0x0004, 0x1168, 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110,
-+ 0x8000, 0x6016, 0x6206, 0x630a, 0x012e, 0x0804, 0x7f57, 0x012e,
-+ 0x0804, 0x7f54, 0x012e, 0x0804, 0x7f51, 0x0126, 0x2091, 0x8000,
-+ 0x7007, 0x0001, 0x2061, 0x1a74, 0x6300, 0xd38c, 0x1120, 0x6308,
-+ 0x8318, 0x0220, 0x630a, 0x012e, 0x0804, 0x7f65, 0x012e, 0x0804,
-+ 0x7f54, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001,
-+ 0xa87c, 0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a74, 0x6000, 0x9084,
-+ 0xfcff, 0x6002, 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c,
-+ 0x9065, 0x0598, 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c,
-+ 0xb2ff, 0x0068, 0x6017, 0xf400, 0x605b, 0x0000, 0xa97c, 0xd1a4,
-+ 0x0110, 0xa980, 0x615a, 0x2009, 0x0041, 0x080c, 0xb34b, 0xa988,
-+ 0x918c, 0xff00, 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011,
-+ 0xfdff, 0x080c, 0x8a49, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061,
-+ 0x1a74, 0x6000, 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a,
-+ 0x00ce, 0x012e, 0x00be, 0x0804, 0x7f57, 0x00ce, 0x012e, 0x00be,
-+ 0x0804, 0x7f51, 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d,
-+ 0x0d18, 0x9186, 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001,
-+ 0x180c, 0x200c, 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158,
-+ 0x9186, 0x0029, 0x1d10, 0xa974, 0x080c, 0x671d, 0x1968, 0xb800,
-+ 0xc0e4, 0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024,
-+ 0x2001, 0x1986, 0x2004, 0x601a, 0x0804, 0x7dec, 0xa88c, 0x9065,
-+ 0x0960, 0x00e6, 0xa890, 0x9075, 0x2001, 0x1834, 0x2004, 0x9005,
-+ 0x0150, 0x080c, 0xb2ff, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xb2ff,
-+ 0x00ee, 0x0804, 0x7dec, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60,
-+ 0x6007, 0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4,
-+ 0x602e, 0xa8a8, 0x6016, 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c,
-+ 0x9aaa, 0x00ee, 0x0804, 0x7dec, 0x2061, 0x1a74, 0x6000, 0xd084,
-+ 0x0190, 0xd08c, 0x1904, 0x7f65, 0x0126, 0x2091, 0x8000, 0x6204,
-+ 0x8210, 0x0220, 0x6206, 0x012e, 0x0804, 0x7f65, 0x012e, 0xa883,
-+ 0x0016, 0x0804, 0x7f5e, 0xa883, 0x0007, 0x0804, 0x7f5e, 0xa864,
-+ 0x8007, 0x9084, 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001,
-+ 0x0069, 0x0005, 0x080c, 0x7a92, 0x0040, 0x7007, 0x0003, 0x7012,
-+ 0x2900, 0x7016, 0x701a, 0x704b, 0x7e8e, 0x0005, 0x00b6, 0x00e6,
-+ 0x0126, 0x2091, 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff,
-+ 0x1904, 0x7f10, 0x6130, 0xd194, 0x1904, 0x7f3a, 0xa878, 0x2070,
-+ 0x9e82, 0x1cd0, 0x0a04, 0x7f04, 0x6068, 0x9e02, 0x1a04, 0x7f04,
-+ 0x7120, 0x9186, 0x0006, 0x1904, 0x7ef6, 0x7010, 0x905d, 0x0904,
-+ 0x7f10, 0xb800, 0xd0e4, 0x1904, 0x7f34, 0x2061, 0x1a74, 0x6100,
-+ 0x9184, 0x0301, 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904,
-+ 0x7f3d, 0xa883, 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005,
-+ 0x1198, 0x7116, 0xa87c, 0xd0f4, 0x1904, 0x7f40, 0x080c, 0x57d3,
-+ 0xd09c, 0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x8969,
-+ 0x012e, 0x00ee, 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0,
-+ 0xa902, 0x2148, 0xa87c, 0xd0f4, 0x1904, 0x7f40, 0x012e, 0x00ee,
-+ 0x00be, 0x0005, 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804,
-+ 0x7f5e, 0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c,
-+ 0x671d, 0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007,
-+ 0x1118, 0xa883, 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883,
-+ 0x000e, 0x0460, 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430,
-+ 0x080c, 0x57d7, 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1cd0,
-+ 0x02c0, 0x6068, 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188,
-+ 0x7010, 0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001,
-+ 0x7000, 0x9086, 0x0007, 0x1904, 0x7e9a, 0x7003, 0x0002, 0x0804,
-+ 0x7e9a, 0xa883, 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee,
-+ 0x00be, 0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0,
-+ 0x2e60, 0x2019, 0x0002, 0x601b, 0x0014, 0x080c, 0xe74d, 0x012e,
-+ 0x00ee, 0x00be, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004,
-+ 0x0040, 0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009,
-+ 0x0001, 0xa884, 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x6e98, 0x012e, 0x0005, 0x080c, 0x1040, 0x0005,
-+ 0x00d6, 0x080c, 0x8960, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126,
-+ 0x2091, 0x8000, 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c,
-+ 0x0780, 0x190c, 0x804f, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0,
-+ 0x90ea, 0x0020, 0x0278, 0x8001, 0x70c2, 0x702c, 0x2048, 0xa800,
-+ 0x702e, 0x9006, 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022,
-+ 0x702c, 0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084,
-+ 0x0780, 0x190c, 0x804f, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003,
-+ 0x05a8, 0x080c, 0xb276, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084,
-+ 0x00ff, 0x9086, 0x0035, 0x1138, 0x6008, 0xc0fd, 0x600a, 0x2001,
-+ 0x196b, 0x2004, 0x0098, 0xa8a0, 0x9084, 0x00ff, 0xa99c, 0x918c,
-+ 0xff00, 0x9105, 0xa99c, 0x918c, 0x00ff, 0x080c, 0x2873, 0x1540,
-+ 0x00b6, 0x080c, 0x671d, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023,
-+ 0x0001, 0x2009, 0x0040, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035,
-+ 0x0110, 0x2009, 0x0041, 0x080c, 0xb34b, 0x0005, 0xa87b, 0x0101,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e, 0x0005, 0xa87b,
-+ 0x002c, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e, 0x0005,
-+ 0xa87b, 0x0028, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e,
-+ 0x080c, 0xb2cc, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016,
-+ 0x00b6, 0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x8040,
-+ 0xa97c, 0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140,
-+ 0x05e8, 0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0,
-+ 0x2b10, 0x080c, 0xb276, 0x1118, 0x080c, 0xb31e, 0x05a8, 0x6212,
-+ 0xa874, 0x0002, 0x801e, 0x8023, 0x8026, 0x802c, 0x2019, 0x0002,
-+ 0x080c, 0xeb9a, 0x0060, 0x080c, 0xeb31, 0x0048, 0x2019, 0x0002,
-+ 0xa980, 0x080c, 0xeb4c, 0x0018, 0xa980, 0x080c, 0xeb31, 0x080c,
-+ 0xb2cc, 0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98,
-+ 0x012e, 0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005,
-+ 0xa887, 0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005,
-+ 0x0c50, 0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091,
-+ 0x8000, 0x0e04, 0x8051, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006,
-+ 0x0804, 0x0dce, 0x2001, 0x1834, 0x2004, 0x9005, 0x0005, 0x0005,
-+ 0x00f6, 0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc,
-+ 0x2102, 0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x15a0,
-+ 0x00fe, 0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300,
-+ 0x00fe, 0x0005, 0x781c, 0xd08c, 0x0904, 0x80d1, 0x68c0, 0x90aa,
-+ 0x0005, 0x0a04, 0x8715, 0x7d44, 0x7c40, 0x9584, 0x00f6, 0x1510,
-+ 0x9484, 0x7000, 0x0140, 0x908a, 0x2000, 0x1260, 0x9584, 0x0700,
-+ 0x8007, 0x0804, 0x80d8, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100,
-+ 0x0da8, 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084, 0xff00,
-+ 0x9086, 0x8100, 0x11c0, 0x080c, 0xf050, 0x080c, 0x85fa, 0x7817,
-+ 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x8658, 0x19c0,
-+ 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x8133, 0x080c, 0x236e,
-+ 0x005e, 0x004e, 0x0020, 0x080c, 0xf050, 0x7817, 0x0140, 0x080c,
-+ 0x7630, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x6893,
-+ 0x0000, 0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000, 0x080c,
-+ 0x8114, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9aaa, 0x0005,
-+ 0x0002, 0x80ea, 0x8402, 0x80e1, 0x80e1, 0x80e1, 0x80e1, 0x80e1,
-+ 0x80e1, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c,
-+ 0x9aaa, 0x0005, 0x7000, 0x908c, 0xff00, 0x9194, 0xf000, 0x810f,
-+ 0x9484, 0x0fff, 0x6892, 0x9286, 0x2000, 0x1150, 0x6800, 0x9086,
-+ 0x0001, 0x1118, 0x080c, 0x583d, 0x0070, 0x080c, 0x8153, 0x0058,
-+ 0x9286, 0x3000, 0x1118, 0x080c, 0x833a, 0x0028, 0x9286, 0x8000,
-+ 0x1110, 0x080c, 0x8521, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004,
-+ 0x9005, 0x090c, 0x9aaa, 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c,
-+ 0x0178, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1148, 0x0026,
-+ 0x0036, 0x2011, 0x8048, 0x2518, 0x080c, 0x4c42, 0x003e, 0x002e,
-+ 0x0005, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019,
-+ 0xfffe, 0x7c30, 0x0050, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079,
-+ 0x0200, 0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001, 0x1810, 0x2004,
-+ 0xd08c, 0x0160, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1130,
-+ 0x0026, 0x2011, 0x8048, 0x080c, 0x4c42, 0x002e, 0x00fe, 0x005e,
-+ 0x004e, 0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00,
-+ 0x8007, 0x9096, 0x0001, 0x0120, 0x9096, 0x0023, 0x1904, 0x830b,
-+ 0x9186, 0x0023, 0x15c0, 0x080c, 0x85bf, 0x0904, 0x830b, 0x6120,
-+ 0x9186, 0x0001, 0x0150, 0x9186, 0x0004, 0x0138, 0x9186, 0x0008,
-+ 0x0120, 0x9186, 0x000a, 0x1904, 0x830b, 0x7124, 0x610a, 0x7030,
-+ 0x908e, 0x0200, 0x1130, 0x2009, 0x0015, 0x080c, 0xb34b, 0x0804,
-+ 0x830b, 0x908e, 0x0214, 0x0118, 0x908e, 0x0210, 0x1130, 0x2009,
-+ 0x0015, 0x080c, 0xb34b, 0x0804, 0x830b, 0x908e, 0x0100, 0x1904,
-+ 0x830b, 0x7034, 0x9005, 0x1904, 0x830b, 0x2009, 0x0016, 0x080c,
-+ 0xb34b, 0x0804, 0x830b, 0x9186, 0x0022, 0x1904, 0x830b, 0x7030,
-+ 0x908e, 0x0300, 0x1580, 0x68dc, 0xd0a4, 0x0528, 0xc0b5, 0x68de,
-+ 0x7100, 0x918c, 0x00ff, 0x697e, 0x7004, 0x6882, 0x00f6, 0x2079,
-+ 0x0100, 0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008,
-+ 0x080c, 0x28bc, 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c,
-+ 0x2873, 0x695e, 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071,
-+ 0x1800, 0x70b6, 0x00ee, 0x7034, 0x9005, 0x1904, 0x830b, 0x2009,
-+ 0x0017, 0x0804, 0x82bb, 0x908e, 0x0400, 0x1190, 0x7034, 0x9005,
-+ 0x1904, 0x830b, 0x080c, 0x7630, 0x0120, 0x2009, 0x001d, 0x0804,
-+ 0x82bb, 0x68dc, 0xc0a5, 0x68de, 0x2009, 0x0030, 0x0804, 0x82bb,
-+ 0x908e, 0x0500, 0x1140, 0x7034, 0x9005, 0x1904, 0x830b, 0x2009,
-+ 0x0018, 0x0804, 0x82bb, 0x908e, 0x2010, 0x1120, 0x2009, 0x0019,
-+ 0x0804, 0x82bb, 0x908e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804,
-+ 0x82bb, 0x908e, 0x5200, 0x1140, 0x7034, 0x9005, 0x1904, 0x830b,
-+ 0x2009, 0x001b, 0x0804, 0x82bb, 0x908e, 0x5000, 0x1140, 0x7034,
-+ 0x9005, 0x1904, 0x830b, 0x2009, 0x001c, 0x0804, 0x82bb, 0x908e,
-+ 0x1300, 0x1120, 0x2009, 0x0034, 0x0804, 0x82bb, 0x908e, 0x1200,
-+ 0x1140, 0x7034, 0x9005, 0x1904, 0x830b, 0x2009, 0x0024, 0x0804,
-+ 0x82bb, 0x908c, 0xff00, 0x918e, 0x2400, 0x1170, 0x2009, 0x002d,
-+ 0x2001, 0x1810, 0x2004, 0xd09c, 0x0904, 0x82bb, 0x080c, 0xdf13,
-+ 0x1904, 0x830b, 0x0804, 0x82b9, 0x908c, 0xff00, 0x918e, 0x5300,
-+ 0x1120, 0x2009, 0x002a, 0x0804, 0x82bb, 0x908e, 0x0f00, 0x1120,
-+ 0x2009, 0x0020, 0x0804, 0x82bb, 0x908e, 0x6104, 0x1530, 0x2029,
-+ 0x0205, 0x2011, 0x026d, 0x8208, 0x2204, 0x9082, 0x0004, 0x8004,
-+ 0x8004, 0x20a8, 0x2011, 0x8015, 0x211c, 0x8108, 0x0046, 0x2124,
-+ 0x080c, 0x4c42, 0x004e, 0x8108, 0x0f04, 0x826f, 0x9186, 0x0280,
-+ 0x1d88, 0x2504, 0x8000, 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b,
-+ 0x0000, 0x2009, 0x0023, 0x0804, 0x82bb, 0x908e, 0x6000, 0x1120,
-+ 0x2009, 0x003f, 0x0804, 0x82bb, 0x908e, 0x5400, 0x1138, 0x080c,
-+ 0x86c5, 0x1904, 0x830b, 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500,
-+ 0x1148, 0x080c, 0x86ed, 0x1118, 0x2009, 0x0041, 0x0460, 0x2009,
-+ 0x0042, 0x0448, 0x908e, 0x7800, 0x1118, 0x2009, 0x0045, 0x0418,
-+ 0x908e, 0x1000, 0x1118, 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300,
-+ 0x1118, 0x2009, 0x004a, 0x00b8, 0x908c, 0xff00, 0x918e, 0x5600,
-+ 0x1118, 0x2009, 0x004f, 0x0078, 0x908c, 0xff00, 0x918e, 0x5700,
-+ 0x1118, 0x2009, 0x0050, 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4,
-+ 0x0110, 0x2009, 0x004c, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211,
-+ 0x220c, 0x080c, 0x2873, 0x1904, 0x830e, 0x080c, 0x66b2, 0x1904,
-+ 0x830e, 0xbe12, 0xbd16, 0x001e, 0x0016, 0x080c, 0x7630, 0x01c0,
-+ 0x68dc, 0xd08c, 0x1148, 0x7000, 0x9084, 0x00ff, 0x1188, 0x7004,
-+ 0x9084, 0xff00, 0x1168, 0x0040, 0x687c, 0x9606, 0x1148, 0x6880,
-+ 0x9506, 0x9084, 0xff00, 0x1120, 0x9584, 0x00ff, 0xb8c2, 0x0080,
-+ 0xb8c0, 0x9005, 0x1168, 0x9186, 0x0046, 0x1150, 0x687c, 0x9606,
-+ 0x1138, 0x6880, 0x9506, 0x9084, 0xff00, 0x1110, 0x001e, 0x0098,
-+ 0x080c, 0xb276, 0x01a8, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120,
-+ 0x610a, 0x001e, 0x9186, 0x004c, 0x1110, 0x6023, 0x000a, 0x0016,
-+ 0x001e, 0x080c, 0xb34b, 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8,
-+ 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c,
-+ 0x4c42, 0x080c, 0xb31e, 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004,
-+ 0x7120, 0x610a, 0x001e, 0x0016, 0x9186, 0x0017, 0x0118, 0x9186,
-+ 0x0030, 0x1128, 0x6007, 0x0009, 0x6017, 0x2900, 0x0020, 0x6007,
-+ 0x0051, 0x6017, 0x0000, 0x602f, 0x0009, 0x6003, 0x0001, 0x080c,
-+ 0x9540, 0x08a0, 0x080c, 0x8734, 0x1158, 0x080c, 0x3374, 0x1140,
-+ 0x7010, 0x9084, 0xff00, 0x8007, 0x908e, 0x0008, 0x1108, 0x0009,
-+ 0x0005, 0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c, 0xff00, 0x810f,
-+ 0x9186, 0x0033, 0x11e8, 0x080c, 0x85bf, 0x0904, 0x839a, 0x7124,
-+ 0x610a, 0x7030, 0x908e, 0x0200, 0x1140, 0x7034, 0x9005, 0x15d0,
-+ 0x2009, 0x0015, 0x080c, 0xb34b, 0x04a8, 0x908e, 0x0100, 0x1590,
-+ 0x7034, 0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0xb34b, 0x0450,
-+ 0x9186, 0x0032, 0x1538, 0x7030, 0x908e, 0x1400, 0x1518, 0x2009,
-+ 0x0038, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
-+ 0x2873, 0x11b8, 0x080c, 0x66b2, 0x11a0, 0xbe12, 0xbd16, 0x080c,
-+ 0xb276, 0x0178, 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023, 0x0004,
-+ 0x7120, 0x610a, 0x001e, 0x080c, 0xb34b, 0x080c, 0x9aaa, 0x0010,
-+ 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x0046,
-+ 0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8, 0x9592,
-+ 0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804,
-+ 0x83fc, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804, 0x83fc,
-+ 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011, 0x0000,
-+ 0x2019, 0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9, 0x0800,
-+ 0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f, 0x2071,
-+ 0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0, 0x9496,
-+ 0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600, 0x9706,
-+ 0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745, 0x1148,
-+ 0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6, 0x0080,
-+ 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x83d1, 0x82ff, 0x1118, 0x9085,
-+ 0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee, 0x004e,
-+ 0x00be, 0x0005, 0x2001, 0x1837, 0x200c, 0x9184, 0x0080, 0x0110,
-+ 0xd18c, 0x0138, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184, 0x000f,
-+ 0x004a, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c,
-+ 0x9aaa, 0x0005, 0x842a, 0x842a, 0x842a, 0x85d1, 0x842a, 0x8433,
-+ 0x845e, 0x84ec, 0x842a, 0x842a, 0x842a, 0x842a, 0x842a, 0x842a,
-+ 0x842a, 0x842a, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005,
-+ 0x090c, 0x9aaa, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120,
-+ 0x2160, 0x9c8c, 0x0007, 0x11c0, 0x9c8a, 0x1cd0, 0x02a8, 0x6868,
- 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910,
- 0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a,
-- 0x2009, 0x0045, 0x080c, 0xb352, 0x7817, 0x0140, 0x2001, 0x19f1,
-- 0x2004, 0x9005, 0x090c, 0x9ab1, 0x00be, 0x0005, 0x6120, 0x9186,
-- 0x0002, 0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005,
-- 0x080c, 0x873b, 0x1180, 0x080c, 0x3374, 0x1168, 0x7010, 0x9084,
-- 0xff00, 0x8007, 0x9086, 0x0000, 0x1130, 0x9184, 0x000f, 0x908a,
-- 0x0006, 0x1208, 0x000b, 0x0005, 0x8542, 0x8543, 0x8542, 0x8542,
-- 0x85a8, 0x85b7, 0x0005, 0x00b6, 0x700c, 0x7108, 0x080c, 0x2873,
-- 0x1904, 0x85a6, 0x080c, 0x66b9, 0x1904, 0x85a6, 0xbe12, 0xbd16,
-- 0x7110, 0xd1bc, 0x0540, 0x702c, 0xd084, 0x1120, 0xb800, 0xd0bc,
-- 0x1904, 0x85a6, 0x080c, 0x6aa3, 0x0148, 0x9086, 0x0004, 0x0130,
-- 0x080c, 0x6aab, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c,
-- 0x85c6, 0x00ce, 0x05d8, 0x080c, 0xb27d, 0x2b08, 0x05b8, 0x6112,
-- 0x080c, 0xd554, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088,
-- 0x080c, 0xb352, 0x0458, 0x080c, 0x6aa3, 0x0148, 0x9086, 0x0004,
-- 0x0130, 0x080c, 0x6aab, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c,
-- 0xb27d, 0x2b08, 0x01d8, 0x6112, 0x080c, 0xd554, 0x6023, 0x0005,
-- 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xb352, 0x0078, 0x080c,
-- 0xb27d, 0x2b08, 0x0158, 0x6112, 0x080c, 0xd554, 0x6023, 0x0004,
-- 0x7120, 0x610a, 0x2009, 0x0001, 0x080c, 0xb352, 0x00be, 0x0005,
-- 0x7110, 0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x851e, 0x1130,
-- 0x7124, 0x610a, 0x2009, 0x0089, 0x080c, 0xb352, 0x0005, 0x7110,
-- 0xd1bc, 0x0158, 0x0059, 0x0148, 0x080c, 0x851e, 0x1130, 0x7124,
-- 0x610a, 0x2009, 0x008a, 0x080c, 0xb352, 0x0005, 0x7020, 0x2060,
-- 0x9c84, 0x0007, 0x1158, 0x9c82, 0x1cd0, 0x0240, 0x2001, 0x181a,
-- 0x2004, 0x9c02, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8,
-- 0x00b6, 0x7110, 0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0007,
-- 0x11b0, 0x9c82, 0x1cd0, 0x0298, 0x6868, 0x9c02, 0x1280, 0x7008,
-- 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c,
-- 0xb914, 0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0xb352, 0x7817,
-- 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9ab1, 0x00be,
-- 0x0005, 0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049,
-- 0x0005, 0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009,
-- 0x0005, 0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086,
-- 0xc000, 0x05d0, 0x080c, 0xb27d, 0x05b8, 0x0066, 0x00c6, 0x0046,
-- 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2873, 0x15a0,
-- 0x080c, 0x66b9, 0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce,
-- 0x6012, 0x080c, 0xd554, 0x080c, 0x100e, 0x0510, 0x2900, 0x605a,
-- 0x9006, 0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9,
-- 0x000e, 0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003,
-- 0x006e, 0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001,
-- 0x080c, 0x9547, 0x080c, 0x9ab1, 0x00fe, 0x009e, 0x00ce, 0x0005,
-- 0x080c, 0xb2d3, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6,
-- 0x7000, 0x908c, 0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000,
-- 0x1904, 0x86b6, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004,
-- 0x9005, 0x1904, 0x86b8, 0x7030, 0x908e, 0x0400, 0x0904, 0x86b8,
-- 0x908e, 0x6000, 0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300,
-- 0x11d8, 0x2009, 0x1837, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580,
-- 0x080c, 0x6a61, 0x0588, 0x68b0, 0x9084, 0x00ff, 0x7100, 0x918c,
-- 0x00ff, 0x9106, 0x1518, 0x6880, 0x69b0, 0x918c, 0xff00, 0x9105,
-- 0x7104, 0x9106, 0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4,
-- 0x11a8, 0x908e, 0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e,
-- 0x5000, 0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x85c6,
-- 0x0128, 0x6004, 0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010,
-- 0x9085, 0x0001, 0x00ce, 0x0005, 0x7030, 0x908e, 0x0300, 0x0118,
-- 0x908e, 0x5200, 0x1d98, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009,
-- 0x9086, 0x0008, 0x0d68, 0x0c50, 0x0156, 0x0046, 0x0016, 0x0036,
-- 0x7038, 0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9,
-- 0x0004, 0x2019, 0x1805, 0x2011, 0x027a, 0x080c, 0xc365, 0x1178,
-- 0xd48c, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x027e,
-- 0x080c, 0xc365, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e,
-- 0x001e, 0x004e, 0x015e, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036,
-- 0x7038, 0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9,
-- 0x0004, 0x2019, 0x1805, 0x2011, 0x0272, 0x080c, 0xc365, 0x1178,
-- 0xd48c, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x0276,
-- 0x080c, 0xc365, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e,
-- 0x001e, 0x004e, 0x015e, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800,
-- 0xc0e5, 0xc0cc, 0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800,
-- 0x7834, 0xd084, 0x1130, 0x2079, 0x0200, 0x7800, 0x9085, 0x1200,
-- 0x7802, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084,
-- 0x7036, 0x00ee, 0x0005, 0x0016, 0x2001, 0x1837, 0x200c, 0x9184,
-- 0x0080, 0x0118, 0xd18c, 0x0118, 0x9006, 0x001e, 0x0005, 0x9085,
-- 0x0001, 0x0cd8, 0x2071, 0x19fb, 0x7003, 0x0003, 0x700f, 0x0361,
-- 0x9006, 0x701a, 0x707a, 0x7012, 0x7017, 0x1cd0, 0x7007, 0x0000,
-- 0x7026, 0x702b, 0xa6ff, 0x7032, 0x703a, 0x703f, 0x0064, 0x7037,
-- 0xa767, 0x7047, 0xffff, 0x704a, 0x704f, 0x5667, 0x7052, 0x7063,
-- 0x88de, 0x080c, 0x1027, 0x090c, 0x0dc5, 0x2900, 0x7042, 0xa867,
-- 0x0003, 0xa86f, 0x0100, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19fb,
-- 0x1d04, 0x882c, 0x2091, 0x6000, 0x700c, 0x8001, 0x700e, 0x1540,
-- 0x2001, 0x013c, 0x2004, 0x9005, 0x190c, 0x894c, 0x2001, 0x1869,
-- 0x2004, 0xd0c4, 0x0158, 0x3a00, 0xd08c, 0x1140, 0x20d1, 0x0000,
-- 0x20d1, 0x0001, 0x20d1, 0x0000, 0x080c, 0x0dc5, 0x700f, 0x0361,
-- 0x7007, 0x0001, 0x0126, 0x2091, 0x8000, 0x080c, 0x8923, 0x7048,
-- 0x900d, 0x0148, 0x8109, 0x714a, 0x1130, 0x704c, 0x080f, 0x0018,
-- 0x0126, 0x2091, 0x8000, 0x7024, 0x900d, 0x0188, 0x7020, 0x8001,
-- 0x7022, 0x1168, 0x7023, 0x0009, 0x8109, 0x7126, 0x9186, 0x03e8,
-- 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110, 0x7028, 0x080f, 0x7030,
-- 0x900d, 0x05a8, 0x702c, 0x8001, 0x702e, 0x1588, 0x0016, 0x2009,
-- 0x0306, 0x210c, 0x9184, 0x0030, 0x01e8, 0x9184, 0x0048, 0x9086,
-- 0x0008, 0x11c0, 0x7038, 0x9005, 0x01a8, 0x8001, 0x703a, 0x1190,
-- 0x080c, 0x7637, 0x0178, 0x00e6, 0x2071, 0x19e8, 0x080c, 0xa7f5,
-- 0x00ee, 0x1140, 0x2009, 0x1a86, 0x2104, 0x8000, 0x0208, 0x200a,
-- 0x001e, 0x0068, 0x001e, 0x702f, 0x0009, 0x8109, 0x7132, 0x0128,
-- 0x9184, 0x007f, 0x090c, 0xa8ab, 0x0010, 0x7034, 0x080f, 0x7044,
-- 0x9005, 0x0118, 0x0310, 0x8001, 0x7046, 0x7054, 0x900d, 0x0168,
-- 0x7050, 0x8001, 0x7052, 0x1148, 0x7053, 0x0009, 0x8109, 0x7156,
-- 0x1120, 0x7158, 0x7156, 0x7060, 0x080f, 0x7018, 0x900d, 0x01d8,
-- 0x0016, 0x7078, 0x900d, 0x0158, 0x7074, 0x8001, 0x7076, 0x1138,
-- 0x7077, 0x0009, 0x8109, 0x717a, 0x1110, 0x707c, 0x080f, 0x001e,
-- 0x7008, 0x8001, 0x700a, 0x1138, 0x700b, 0x0009, 0x8109, 0x711a,
-- 0x1110, 0x701c, 0x080f, 0x012e, 0x7004, 0x0002, 0x8854, 0x8855,
-- 0x8871, 0x00e6, 0x2071, 0x19fb, 0x7018, 0x9005, 0x1120, 0x711a,
-- 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071,
-- 0x19fb, 0x701c, 0x9206, 0x1120, 0x701a, 0x701e, 0x707a, 0x707e,
-- 0x000e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x19fb, 0xb888, 0x9102,
-- 0x0208, 0xb98a, 0x00ee, 0x0005, 0x0005, 0x00b6, 0x7110, 0x080c,
-- 0x6724, 0x1168, 0xb888, 0x8001, 0x0250, 0xb88a, 0x1140, 0x0126,
-- 0x2091, 0x8000, 0x0016, 0x080c, 0x9ab1, 0x001e, 0x012e, 0x8108,
-- 0x9182, 0x0800, 0x0218, 0x900e, 0x7007, 0x0002, 0x7112, 0x00be,
-- 0x0005, 0x7014, 0x2060, 0x0126, 0x2091, 0x8000, 0x6040, 0x9005,
-- 0x0128, 0x8001, 0x6042, 0x1110, 0x080c, 0xd3e5, 0x6018, 0x9005,
-- 0x0558, 0x8001, 0x601a, 0x1540, 0x6120, 0x9186, 0x0003, 0x0148,
-- 0x9186, 0x0006, 0x0130, 0x9186, 0x0009, 0x11e0, 0x611c, 0xd1c4,
-- 0x1100, 0x080c, 0xd0d8, 0x01b0, 0x6014, 0x2048, 0xa884, 0x908a,
-- 0x199a, 0x0280, 0x9082, 0x1999, 0xa886, 0x908a, 0x199a, 0x0210,
-- 0x2001, 0x1999, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c,
-- 0xd0e4, 0x0110, 0x080c, 0xcdbc, 0x012e, 0x9c88, 0x0018, 0x7116,
-- 0x2001, 0x181a, 0x2004, 0x9102, 0x0220, 0x7017, 0x1cd0, 0x7007,
-- 0x0000, 0x0005, 0x00e6, 0x2071, 0x19fb, 0x7027, 0x07d0, 0x7023,
-- 0x0009, 0x00ee, 0x0005, 0x2001, 0x1a04, 0x2003, 0x0000, 0x0005,
-- 0x00e6, 0x2071, 0x19fb, 0x7132, 0x702f, 0x0009, 0x00ee, 0x0005,
-- 0x2011, 0x1a07, 0x2013, 0x0000, 0x0005, 0x00e6, 0x2071, 0x19fb,
-- 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x0086, 0x0026,
-- 0x705c, 0x8000, 0x705e, 0x2001, 0x1a0b, 0x2044, 0xa06c, 0x9086,
-- 0x0000, 0x0150, 0x7070, 0xa09a, 0x706c, 0xa096, 0x7068, 0xa092,
-- 0x7064, 0xa08e, 0x080c, 0x10f8, 0x002e, 0x008e, 0x0005, 0x0006,
-- 0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-- 0x0156, 0x080c, 0x8776, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-- 0x00be, 0x00ae, 0x009e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071,
-- 0x19fb, 0x717a, 0x727e, 0x7077, 0x0009, 0x00ee, 0x0005, 0x00e6,
-- 0x0006, 0x2071, 0x19fb, 0x707c, 0x9206, 0x1110, 0x707a, 0x707e,
-- 0x000e, 0x00ee, 0x0005, 0x2069, 0x1800, 0x69e8, 0xd1e4, 0x1518,
-- 0x0026, 0xd1ec, 0x0140, 0x6a54, 0x6874, 0x9202, 0x0288, 0x8117,
-- 0x9294, 0x00c0, 0x0088, 0x9184, 0x0007, 0x01a0, 0x8109, 0x9184,
-- 0x0007, 0x0110, 0x69ea, 0x0070, 0x8107, 0x9084, 0x0007, 0x910d,
-- 0x8107, 0x9106, 0x9094, 0x00c0, 0x9184, 0xff3f, 0x9205, 0x68ea,
-- 0x080c, 0x0eee, 0x002e, 0x0005, 0x0016, 0x00c6, 0x2009, 0xfff4,
-- 0x210d, 0x2061, 0x0100, 0x60f0, 0x9100, 0x60f3, 0x0000, 0x2009,
-- 0xfff4, 0x200f, 0x1220, 0x8108, 0x2105, 0x8000, 0x200f, 0x00ce,
-- 0x001e, 0x0005, 0x00c6, 0x2061, 0x1a74, 0x00ce, 0x0005, 0x9184,
-- 0x000f, 0x8003, 0x8003, 0x8003, 0x9080, 0x1a74, 0x2060, 0x0005,
-- 0xa884, 0x908a, 0x199a, 0x1638, 0x9005, 0x1150, 0x00c6, 0x2061,
-- 0x1a74, 0x6014, 0x00ce, 0x9005, 0x1130, 0x2001, 0x001e, 0x0018,
-- 0x908e, 0xffff, 0x01b0, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a,
-- 0xa87c, 0x908c, 0x00c0, 0x918e, 0x00c0, 0x0904, 0x89fa, 0xd0b4,
-- 0x1168, 0xd0bc, 0x1904, 0x89d3, 0x2009, 0x0006, 0x080c, 0x8a27,
-- 0x0005, 0x900e, 0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc, 0x0160,
-- 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8a21, 0x908c,
-- 0x2020, 0x918e, 0x2020, 0x01a8, 0x6024, 0xd0d4, 0x11e8, 0x2009,
-- 0x1869, 0x2104, 0xd084, 0x1138, 0x87ff, 0x1120, 0x2009, 0x0043,
-- 0x0804, 0xb352, 0x0005, 0x87ff, 0x1de8, 0x2009, 0x0042, 0x0804,
-- 0xb352, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20,
-- 0x6024, 0xc0cd, 0x6026, 0x0c00, 0xc0d4, 0x6026, 0xa890, 0x602e,
-- 0xa88c, 0x6032, 0x08e0, 0xd0fc, 0x0160, 0x908c, 0x0003, 0x0120,
-- 0x918e, 0x0003, 0x1904, 0x8a21, 0x908c, 0x2020, 0x918e, 0x2020,
-- 0x0170, 0x0076, 0x00f6, 0x2c78, 0x080c, 0x1768, 0x00fe, 0x007e,
-- 0x87ff, 0x1120, 0x2009, 0x0042, 0x080c, 0xb352, 0x0005, 0x6110,
-- 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d58, 0x6124, 0xc1cd,
-- 0x6126, 0x0c38, 0xd0fc, 0x0188, 0x908c, 0x2020, 0x918e, 0x2020,
-- 0x01a8, 0x9084, 0x0003, 0x908e, 0x0002, 0x0148, 0x87ff, 0x1120,
-- 0x2009, 0x0041, 0x080c, 0xb352, 0x0005, 0x00b9, 0x0ce8, 0x87ff,
-- 0x1dd8, 0x2009, 0x0043, 0x080c, 0xb352, 0x0cb0, 0x6110, 0x00b6,
-- 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6124, 0xc1cd, 0x6126,
-- 0x0c00, 0x2009, 0x0004, 0x0019, 0x0005, 0x2009, 0x0001, 0x0096,
-- 0x080c, 0xd0d8, 0x0518, 0x6014, 0x2048, 0xa982, 0xa800, 0x6016,
-- 0x9186, 0x0001, 0x1188, 0xa97c, 0x918c, 0x8100, 0x918e, 0x8100,
-- 0x1158, 0x00c6, 0x2061, 0x1a74, 0x6200, 0xd28c, 0x1120, 0x6204,
-- 0x8210, 0x0208, 0x6206, 0x00ce, 0x080c, 0x6cde, 0x6014, 0x904d,
-- 0x0076, 0x2039, 0x0000, 0x190c, 0x8970, 0x007e, 0x009e, 0x0005,
-- 0x0156, 0x00c6, 0x2061, 0x1a74, 0x6000, 0x81ff, 0x0110, 0x9205,
-- 0x0008, 0x9204, 0x6002, 0x00ce, 0x015e, 0x0005, 0x6800, 0xd08c,
-- 0x1138, 0x6808, 0x9005, 0x0120, 0x8001, 0x680a, 0x9085, 0x0001,
-- 0x0005, 0x2071, 0x1924, 0x7003, 0x0006, 0x7007, 0x0000, 0x700f,
-- 0x0000, 0x7013, 0x0001, 0x080c, 0x1027, 0x090c, 0x0dc5, 0xa867,
-- 0x0006, 0xa86b, 0x0001, 0xa8ab, 0xdcb0, 0xa89f, 0x0000, 0x2900,
-- 0x702e, 0x7033, 0x0000, 0x0005, 0x0126, 0x2091, 0x8000, 0x0096,
-- 0x00e6, 0x2071, 0x1924, 0x702c, 0x2048, 0x6a2c, 0x721e, 0x6b30,
-- 0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a, 0xa89a, 0x6824,
-- 0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a, 0x9005, 0x0148,
-- 0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100, 0x9210, 0x1208,
-- 0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0168, 0xc084, 0x7007,
-- 0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x1ad1, 0x2104, 0x9082,
-- 0x0007, 0x200a, 0x000e, 0xc095, 0x7012, 0x2008, 0x2001, 0x003b,
-- 0x080c, 0x1611, 0x9006, 0x2071, 0x193d, 0x7002, 0x7006, 0x702a,
-- 0x00ee, 0x009e, 0x012e, 0x0005, 0x2009, 0x1ad1, 0x2104, 0x9080,
-- 0x0007, 0x200a, 0x0005, 0x00e6, 0x0126, 0x0156, 0x2091, 0x8000,
-- 0x2071, 0x1800, 0x7154, 0x2001, 0x0008, 0x910a, 0x0638, 0x2001,
-- 0x187d, 0x20ac, 0x9006, 0x9080, 0x0008, 0x1f04, 0x8ae3, 0x71c0,
-- 0x9102, 0x02e0, 0x2071, 0x1877, 0x20a9, 0x0007, 0x00c6, 0x080c,
-- 0xb27d, 0x6023, 0x0009, 0x6003, 0x0004, 0x601f, 0x0101, 0x0089,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x8c61, 0x012e, 0x1f04, 0x8aef,
-- 0x9006, 0x00ce, 0x015e, 0x012e, 0x00ee, 0x0005, 0x9085, 0x0001,
-- 0x0cc8, 0x00e6, 0x00b6, 0x0096, 0x0086, 0x0056, 0x0046, 0x0026,
-- 0x7118, 0x720c, 0x7620, 0x7004, 0xd084, 0x1128, 0x2021, 0x0024,
-- 0x2029, 0x0002, 0x0020, 0x2021, 0x002c, 0x2029, 0x000a, 0x080c,
-- 0x100e, 0x090c, 0x0dc5, 0x2900, 0x6016, 0x2058, 0xac66, 0x9006,
-- 0xa802, 0xa806, 0xa86a, 0xa87a, 0xa8aa, 0xa887, 0x0005, 0xa87f,
-- 0x0020, 0x7008, 0xa89a, 0x7010, 0xa89e, 0xae8a, 0xa8af, 0xffff,
-- 0xa8b3, 0x0000, 0x8109, 0x0160, 0x080c, 0x100e, 0x090c, 0x0dc5,
-- 0xad66, 0x2b00, 0xa802, 0x2900, 0xb806, 0x2058, 0x8109, 0x1da0,
-- 0x002e, 0x004e, 0x005e, 0x008e, 0x009e, 0x00be, 0x00ee, 0x0005,
-- 0x2079, 0x0000, 0x2071, 0x1924, 0x7004, 0x004b, 0x700c, 0x0002,
-- 0x8b5b, 0x8b54, 0x8b54, 0x0005, 0x8b65, 0x8bbb, 0x8bbb, 0x8bbb,
-- 0x8bbc, 0x8bcd, 0x8bcd, 0x700c, 0x0cba, 0x0126, 0x2091, 0x8000,
-- 0x78a0, 0x79a0, 0x9106, 0x1904, 0x8bad, 0x7814, 0xd0bc, 0x1904,
-- 0x8bb6, 0x012e, 0x7018, 0x910a, 0x1128, 0x7030, 0x9005, 0x1904,
-- 0x8bff, 0x0005, 0x1210, 0x7114, 0x910a, 0x9192, 0x000a, 0x0210,
-- 0x2009, 0x000a, 0x2001, 0x1888, 0x2014, 0x2001, 0x1936, 0x2004,
-- 0x9100, 0x9202, 0x0e50, 0x080c, 0x8d5c, 0x2200, 0x9102, 0x0208,
-- 0x2208, 0x0096, 0x702c, 0x2048, 0xa873, 0x0001, 0xa976, 0x080c,
-- 0x8e65, 0x2100, 0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126, 0x2091,
-- 0x8000, 0x2009, 0x1a1b, 0x2104, 0xc085, 0x200a, 0x700f, 0x0002,
-- 0x012e, 0x080c, 0x1117, 0x1de8, 0x0005, 0x78a0, 0x79a0, 0x9106,
-- 0x0904, 0x8b6d, 0x080c, 0x8d34, 0x012e, 0x0005, 0x7810, 0xc0c5,
-- 0x7812, 0x0804, 0x8b6d, 0x0005, 0x700c, 0x0002, 0x8bc1, 0x8bc4,
-- 0x8bc3, 0x080c, 0x8b63, 0x0005, 0x8001, 0x700e, 0x0096, 0x702c,
-- 0x2048, 0xa974, 0x009e, 0x0011, 0x0ca0, 0x0005, 0x0096, 0x702c,
-- 0x2048, 0x7018, 0x9100, 0x7214, 0x921a, 0x1130, 0x701c, 0xa88e,
-- 0x7020, 0xa892, 0x9006, 0x0068, 0x0006, 0x080c, 0x8e65, 0x2100,
-- 0xaa8c, 0x9210, 0xaa8e, 0x1220, 0xa890, 0x9081, 0x0000, 0xa892,
-- 0x000e, 0x009e, 0x0126, 0x2091, 0x8000, 0x78a2, 0x701a, 0x080c,
-- 0x8d34, 0x012e, 0x0005, 0x00e6, 0x2071, 0x1924, 0x700c, 0x0002,
-- 0x8bfd, 0x8bfd, 0x8bfb, 0x700f, 0x0001, 0x00ee, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0x7030, 0x9005, 0x0508, 0x2078, 0x7814, 0x2048,
-- 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8c6a, 0x00be, 0x01b0,
-- 0x00e6, 0x2071, 0x193d, 0x080c, 0x8cb1, 0x00ee, 0x0178, 0x0096,
-- 0x080c, 0x1027, 0x2900, 0x009e, 0x0148, 0xa8aa, 0x04b9, 0x0041,
-- 0x2001, 0x1947, 0x2003, 0x0000, 0x012e, 0x08c8, 0x012e, 0x0005,
-- 0x00d6, 0x00c6, 0x0086, 0x00a6, 0x2940, 0x2650, 0x2600, 0x9005,
-- 0x0180, 0xa864, 0x9084, 0x000f, 0x2068, 0x9d88, 0x20c7, 0x2165,
-- 0x0056, 0x2029, 0x0000, 0x080c, 0x8dea, 0x080c, 0x207f, 0x1dd8,
-- 0x005e, 0x00ae, 0x2001, 0x187f, 0x2004, 0xa88a, 0x080c, 0x1768,
-- 0x781f, 0x0101, 0x7813, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x8cc0, 0x012e, 0x008e, 0x00ce, 0x00de, 0x0005, 0x7030, 0x9005,
-- 0x0138, 0x2078, 0x780c, 0x7032, 0x2001, 0x1947, 0x2003, 0x0001,
-- 0x0005, 0x00e6, 0x2071, 0x1924, 0x7030, 0x600e, 0x2c00, 0x7032,
-- 0x00ee, 0x0005, 0x00d6, 0x00c6, 0x0026, 0x9b80, 0x8f33, 0x2005,
-- 0x906d, 0x090c, 0x0dc5, 0x9b80, 0x8f2b, 0x2005, 0x9065, 0x090c,
-- 0x0dc5, 0x6114, 0x2600, 0x9102, 0x0248, 0x6828, 0x9102, 0x02f0,
-- 0x9085, 0x0001, 0x002e, 0x00ce, 0x00de, 0x0005, 0x6804, 0xd094,
-- 0x0148, 0x6854, 0xd084, 0x1178, 0xc085, 0x6856, 0x2011, 0x8026,
-- 0x080c, 0x4c44, 0x684c, 0x0096, 0x904d, 0x090c, 0x0dc5, 0xa804,
-- 0x8000, 0xa806, 0x009e, 0x9006, 0x2030, 0x0c20, 0x6854, 0xd08c,
-- 0x1d08, 0xc08d, 0x6856, 0x2011, 0x8025, 0x080c, 0x4c44, 0x684c,
-- 0x0096, 0x904d, 0x090c, 0x0dc5, 0xa800, 0x8000, 0xa802, 0x009e,
-- 0x0888, 0x7000, 0x2019, 0x0008, 0x8319, 0x7104, 0x9102, 0x1118,
-- 0x2300, 0x9005, 0x0020, 0x0210, 0x9302, 0x0008, 0x8002, 0x0005,
-- 0x00d6, 0x7814, 0x9005, 0x090c, 0x0dc5, 0x781c, 0x9084, 0x0101,
-- 0x9086, 0x0101, 0x190c, 0x0dc5, 0x7827, 0x0000, 0x2069, 0x193d,
-- 0x6804, 0x9080, 0x193f, 0x2f08, 0x2102, 0x6904, 0x8108, 0x9182,
-- 0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193f, 0x2003, 0x0000,
-- 0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048, 0xa8a8,
-- 0x0096, 0x2048, 0x9005, 0x190c, 0x1040, 0x009e, 0xa8ab, 0x0000,
-- 0x080c, 0x0fc0, 0x080c, 0xb2d3, 0x00ce, 0x009e, 0x0005, 0x6020,
-- 0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006, 0x0005,
-- 0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178, 0x6010,
-- 0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x9067, 0x00be, 0x6013,
-- 0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005, 0x2009,
-- 0x1928, 0x210c, 0xd194, 0x0005, 0x2009, 0x1928, 0x210c, 0xd1c4,
-- 0x0005, 0x0126, 0x2091, 0x8000, 0x00e6, 0x2071, 0x1924, 0x7110,
-- 0xc194, 0xc185, 0x7007, 0x0000, 0x7112, 0x2001, 0x003b, 0x080c,
-- 0x1611, 0x00ee, 0x012e, 0x0005, 0x7814, 0xd0bc, 0x1108, 0x0005,
-- 0x7810, 0xc0c5, 0x7812, 0x0cc0, 0x0096, 0x00d6, 0x9006, 0x7006,
-- 0x700e, 0x701a, 0x701e, 0x7022, 0x7016, 0x702a, 0x7026, 0x702f,
-- 0x0000, 0x080c, 0x8eb3, 0x0170, 0x080c, 0x8ee8, 0x0158, 0x2900,
-- 0x7002, 0x700a, 0x701a, 0x7013, 0x0001, 0x701f, 0x000a, 0x00de,
-- 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096, 0x0086, 0x00d6,
-- 0x00c6, 0x2071, 0x1931, 0x721c, 0x2100, 0x9202, 0x1618, 0x080c,
-- 0x8ee8, 0x090c, 0x0dc5, 0x7018, 0x9005, 0x1160, 0x2900, 0x7002,
-- 0x700a, 0x701a, 0x9006, 0x7006, 0x700e, 0xa806, 0xa802, 0x7012,
-- 0x701e, 0x0038, 0x2040, 0xa806, 0x2900, 0xa002, 0x701a, 0xa803,
-- 0x0000, 0x7010, 0x8000, 0x7012, 0x701c, 0x9080, 0x000a, 0x701e,
-- 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e, 0x009e, 0x00ee,
-- 0x0005, 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6, 0x0126, 0x2091,
-- 0x8000, 0x2071, 0x1931, 0x7300, 0x831f, 0x831e, 0x831e, 0x9384,
-- 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003, 0x7104, 0x080c,
-- 0x8e65, 0x810c, 0x2100, 0x9318, 0x8003, 0x2228, 0x2021, 0x0078,
-- 0x9402, 0x9532, 0x0208, 0x2028, 0x2500, 0x8004, 0x20a8, 0x23a0,
-- 0xa001, 0xa001, 0x4005, 0x2508, 0x080c, 0x8e6e, 0x2130, 0x7014,
-- 0x9600, 0x7016, 0x2600, 0x711c, 0x9102, 0x701e, 0x7004, 0x9600,
-- 0x2008, 0x9082, 0x000a, 0x1190, 0x7000, 0x2048, 0xa800, 0x9005,
-- 0x1148, 0x2009, 0x0001, 0x0026, 0x080c, 0x8d5c, 0x002e, 0x7000,
-- 0x2048, 0xa800, 0x7002, 0x7007, 0x0000, 0x0008, 0x7106, 0x2500,
-- 0x9212, 0x1904, 0x8d9b, 0x012e, 0x00ee, 0x014e, 0x013e, 0x015e,
-- 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126, 0x2091, 0x8000,
-- 0x9580, 0x8f2b, 0x2005, 0x9075, 0x090c, 0x0dc5, 0x080c, 0x8e40,
-- 0x012e, 0x9580, 0x8f27, 0x2005, 0x9075, 0x090c, 0x0dc5, 0x0156,
-- 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e, 0x831e, 0x9384,
-- 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098, 0xa860, 0x20e8,
-- 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002, 0x4003, 0x2e0c,
-- 0x2d00, 0x0002, 0x8e2a, 0x8e2a, 0x8e2c, 0x8e2a, 0x8e2c, 0x8e2a,
-- 0x8e2a, 0x8e2a, 0x8e2a, 0x8e2a, 0x8e32, 0x8e2a, 0x8e32, 0x8e2a,
-- 0x8e2a, 0x8e2a, 0x080c, 0x0dc5, 0x4104, 0x20a9, 0x0002, 0x4002,
-- 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104, 0x4003, 0x01de,
-- 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e, 0x001e, 0x0005,
-- 0x0096, 0x7014, 0x8001, 0x7016, 0x710c, 0x2110, 0x00f1, 0x810c,
-- 0x9188, 0x0003, 0x7308, 0x8210, 0x9282, 0x000a, 0x1198, 0x7008,
-- 0x2048, 0xa800, 0x9005, 0x0158, 0x0006, 0x080c, 0x8ef7, 0x009e,
-- 0xa807, 0x0000, 0x2900, 0x700a, 0x7010, 0x8001, 0x7012, 0x700f,
-- 0x0000, 0x0008, 0x720e, 0x009e, 0x0005, 0x0006, 0x810b, 0x810b,
-- 0x2100, 0x810b, 0x9100, 0x2008, 0x000e, 0x0005, 0x0006, 0x0026,
-- 0x2100, 0x9005, 0x0158, 0x9092, 0x000c, 0x0240, 0x900e, 0x8108,
-- 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005, 0x900e, 0x0cd8,
-- 0x2d00, 0x90b8, 0x0008, 0x2031, 0x8eb1, 0x901e, 0x6808, 0x9005,
-- 0x0108, 0x8318, 0x690c, 0x910a, 0x0248, 0x0140, 0x8318, 0x6810,
-- 0x9112, 0x0220, 0x0118, 0x8318, 0x2208, 0x0cd0, 0x233a, 0x6804,
-- 0xd084, 0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967,
-- 0x0a67, 0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082,
-- 0x0002, 0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67,
-- 0x0cd0, 0x6c1a, 0x0005, 0x0096, 0x0046, 0x0126, 0x2091, 0x8000,
-- 0x2b00, 0x9080, 0x8f2f, 0x2005, 0x9005, 0x090c, 0x0dc5, 0x2004,
-- 0x90a0, 0x000a, 0x080c, 0x1027, 0x01d0, 0x2900, 0x7026, 0xa803,
-- 0x0000, 0xa807, 0x0000, 0x080c, 0x1027, 0x0188, 0x7024, 0xa802,
-- 0xa807, 0x0000, 0x2900, 0x7026, 0x94a2, 0x000a, 0x0110, 0x0208,
-- 0x0c90, 0x9085, 0x0001, 0x012e, 0x004e, 0x009e, 0x0005, 0x7024,
-- 0x9005, 0x0dc8, 0x2048, 0xac00, 0x080c, 0x1040, 0x2400, 0x0cc0,
-- 0x0126, 0x2091, 0x8000, 0x7024, 0x2048, 0x9005, 0x0130, 0xa800,
-- 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x012e, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0x7024, 0xa802, 0x2900, 0x7026, 0x012e, 0x0005,
-- 0x0096, 0x9e80, 0x0009, 0x2004, 0x9005, 0x0138, 0x2048, 0xa800,
-- 0x0006, 0x080c, 0x1040, 0x000e, 0x0cb8, 0x009e, 0x0005, 0x0096,
-- 0x7008, 0x9005, 0x0138, 0x2048, 0xa800, 0x0006, 0x080c, 0x1040,
-- 0x000e, 0x0cb8, 0x9006, 0x7002, 0x700a, 0x7006, 0x700e, 0x701a,
-- 0x701e, 0x7022, 0x702a, 0x7026, 0x702e, 0x009e, 0x0005, 0x1a67,
-- 0x0000, 0x0000, 0x0000, 0x1931, 0x0000, 0x0000, 0x0000, 0x1888,
-- 0x0000, 0x0000, 0x0000, 0x1877, 0x0000, 0x0000, 0x0000, 0x00e6,
-- 0x00c6, 0x00b6, 0x00a6, 0xa8a8, 0x2040, 0x2071, 0x1877, 0x080c,
-- 0x9053, 0xa067, 0x0023, 0x6010, 0x905d, 0x0904, 0x9028, 0xb814,
-- 0xa06e, 0xb910, 0xa172, 0xb9a0, 0xa176, 0x2001, 0x0003, 0xa07e,
-- 0xa834, 0xa082, 0xa07b, 0x0000, 0xa898, 0x9005, 0x0118, 0xa078,
-- 0xc085, 0xa07a, 0x2858, 0x2031, 0x0018, 0xa068, 0x908a, 0x0019,
-- 0x1a0c, 0x0dc5, 0x2020, 0x2050, 0x2940, 0xa864, 0x90bc, 0x00ff,
-- 0x908c, 0x000f, 0x91e0, 0x20c7, 0x2c65, 0x9786, 0x0024, 0x2c05,
-- 0x1590, 0x908a, 0x0036, 0x1a0c, 0x0dc5, 0x9082, 0x001b, 0x0002,
-- 0x8f93, 0x8f93, 0x8f95, 0x8f93, 0x8f93, 0x8f93, 0x8f97, 0x8f93,
-- 0x8f93, 0x8f93, 0x8f99, 0x8f93, 0x8f93, 0x8f93, 0x8f9b, 0x8f93,
-- 0x8f93, 0x8f93, 0x8f9d, 0x8f93, 0x8f93, 0x8f93, 0x8f9f, 0x8f93,
-- 0x8f93, 0x8f93, 0x8fa1, 0x080c, 0x0dc5, 0xa180, 0x04b8, 0xa190,
-- 0x04a8, 0xa1a0, 0x0498, 0xa1b0, 0x0488, 0xa1c0, 0x0478, 0xa1d0,
-- 0x0468, 0xa1e0, 0x0458, 0x908a, 0x0034, 0x1a0c, 0x0dc5, 0x9082,
-- 0x001b, 0x0002, 0x8fc5, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc3,
-- 0x8fc7, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc9, 0x8fc3,
-- 0x8fc3, 0x8fc3, 0x8fc3, 0x8fc3, 0x8fcb, 0x8fc3, 0x8fc3, 0x8fc3,
-- 0x8fc3, 0x8fc3, 0x8fcd, 0x080c, 0x0dc5, 0xa180, 0x0038, 0xa198,
-- 0x0028, 0xa1b0, 0x0018, 0xa1c8, 0x0008, 0xa1e0, 0x2600, 0x0002,
-- 0x8fe9, 0x8feb, 0x8fed, 0x8fef, 0x8ff1, 0x8ff3, 0x8ff5, 0x8ff7,
-- 0x8ff9, 0x8ffb, 0x8ffd, 0x8fff, 0x9001, 0x9003, 0x9005, 0x9007,
-- 0x9009, 0x900b, 0x900d, 0x900f, 0x9011, 0x9013, 0x9015, 0x9017,
-- 0x9019, 0x080c, 0x0dc5, 0xb9e2, 0x0468, 0xb9de, 0x0458, 0xb9da,
-- 0x0448, 0xb9d6, 0x0438, 0xb9d2, 0x0428, 0xb9ce, 0x0418, 0xb9ca,
-- 0x0408, 0xb9c6, 0x00f8, 0xb9c2, 0x00e8, 0xb9be, 0x00d8, 0xb9ba,
-- 0x00c8, 0xb9b6, 0x00b8, 0xb9b2, 0x00a8, 0xb9ae, 0x0098, 0xb9aa,
-- 0x0088, 0xb9a6, 0x0078, 0xb9a2, 0x0068, 0xb99e, 0x0058, 0xb99a,
-- 0x0048, 0xb996, 0x0038, 0xb992, 0x0028, 0xb98e, 0x0018, 0xb98a,
-- 0x0008, 0xb986, 0x8631, 0x8421, 0x0130, 0x080c, 0x207f, 0x090c,
-- 0x0dc5, 0x0804, 0x8f6d, 0x00ae, 0x00be, 0x00ce, 0x00ee, 0x0005,
-- 0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006, 0x0804,
-- 0x8f4f, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810, 0x9005,
-- 0x01b0, 0x2001, 0x1925, 0x2004, 0x9005, 0x0188, 0x2001, 0x1800,
-- 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0, 0x2021,
-- 0x0004, 0x2011, 0x8014, 0x080c, 0x4c44, 0x004e, 0x003e, 0x00be,
-- 0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a, 0xa936,
-- 0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0230, 0x0128, 0x7010,
-- 0x8210, 0x910a, 0x0208, 0x1de0, 0xaa8a, 0xa26a, 0x0005, 0x00f6,
-- 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b, 0x0200, 0x7818, 0xd094,
-- 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001, 0x7818, 0xd094, 0x1da0,
-- 0xb8ac, 0x906d, 0x0198, 0x2079, 0x0000, 0x9c1e, 0x1118, 0x680c,
-- 0xb8ae, 0x0050, 0x9c06, 0x0130, 0x2d78, 0x680c, 0x906d, 0x1dd0,
-- 0x080c, 0x0dc5, 0x6b0c, 0x7b0e, 0x600f, 0x0000, 0x2079, 0x0300,
-- 0x781b, 0x0200, 0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6,
-- 0x0096, 0x00c6, 0x0036, 0x0126, 0x2091, 0x8000, 0x0156, 0x20a9,
-- 0x01ff, 0x2071, 0x0300, 0x701b, 0x0200, 0x7018, 0xd094, 0x0110,
-- 0x1f04, 0x90a3, 0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094,
-- 0x1d90, 0xb8ac, 0x9065, 0x01f0, 0x600c, 0xb8ae, 0x6024, 0xc08d,
-- 0x6026, 0x6003, 0x0004, 0x601b, 0x0000, 0x6013, 0x0000, 0x601f,
-- 0x0101, 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa88b, 0x0000, 0xa8a8,
-- 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0dc5, 0x080c, 0x1040, 0x080c,
-- 0x8c61, 0x08f8, 0x2071, 0x0300, 0x701b, 0x0200, 0x015e, 0x012e,
-- 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x00b6,
-- 0x0016, 0x0006, 0x0156, 0x080c, 0x2873, 0x015e, 0x11b0, 0x080c,
-- 0x66b9, 0x190c, 0x0dc5, 0x000e, 0x001e, 0xb912, 0xb816, 0x080c,
-- 0xb27d, 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001, 0x2009, 0x0001,
-- 0x080c, 0xb352, 0x00be, 0x00ce, 0x0005, 0x000e, 0x001e, 0x0cd0,
-- 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e,
-- 0x0005, 0x9119, 0x9119, 0x9119, 0x911b, 0x916c, 0x9119, 0x9119,
-- 0x9119, 0x91e6, 0x9119, 0x9223, 0x9119, 0x9119, 0x9119, 0x9119,
-- 0x9119, 0x080c, 0x0dc5, 0x9182, 0x0040, 0x0002, 0x912e, 0x912e,
-- 0x912e, 0x912e, 0x912e, 0x912e, 0x912e, 0x912e, 0x912e, 0x9130,
-- 0x9145, 0x912e, 0x912e, 0x912e, 0x912e, 0x9158, 0x080c, 0x0dc5,
-- 0x0096, 0x080c, 0x9a61, 0x080c, 0x9bd3, 0x6114, 0x2148, 0xa87b,
-- 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c,
-- 0x6ca3, 0x080c, 0xb2d3, 0x009e, 0x0005, 0x080c, 0x9a61, 0x00d6,
-- 0x6114, 0x080c, 0xd0d8, 0x0130, 0x0096, 0x6114, 0x2148, 0x080c,
-- 0x6e9f, 0x009e, 0x00de, 0x080c, 0xb2d3, 0x080c, 0x9bd3, 0x0005,
-- 0x080c, 0x9a61, 0x080c, 0x3250, 0x6114, 0x0096, 0x2148, 0x080c,
-- 0xd0d8, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6e9f, 0x009e, 0x080c,
-- 0xb2d3, 0x080c, 0x9bd3, 0x0005, 0x601b, 0x0000, 0x9182, 0x0040,
-- 0x0096, 0x0002, 0x9187, 0x9187, 0x9187, 0x9187, 0x9187, 0x9187,
-- 0x9187, 0x9187, 0x9189, 0x9187, 0x9187, 0x9187, 0x91e2, 0x9187,
-- 0x9187, 0x9187, 0x9187, 0x9187, 0x9187, 0x9190, 0x9187, 0x080c,
-- 0x0dc5, 0x6114, 0x2148, 0xa938, 0x918e, 0xffff, 0x0904, 0x91e2,
-- 0x6024, 0xd08c, 0x15d8, 0x080c, 0x8d17, 0x05e0, 0x00e6, 0x6114,
-- 0x2148, 0x080c, 0x8f37, 0x0096, 0xa8a8, 0x2048, 0x080c, 0x6c3b,
-- 0x009e, 0xa8ab, 0x0000, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058,
-- 0x080c, 0x9067, 0x00be, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c,
-- 0x8c6a, 0x00be, 0x01e0, 0x2071, 0x193d, 0x080c, 0x8cb1, 0x01b8,
-- 0x9086, 0x0001, 0x1128, 0x2001, 0x1947, 0x2004, 0x9005, 0x1178,
-- 0x0096, 0x080c, 0x100e, 0x2900, 0x009e, 0x0148, 0xa8aa, 0x00f6,
-- 0x2c78, 0x080c, 0x8c28, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x080c,
-- 0x8c61, 0x0cd0, 0x080c, 0x8d1c, 0x1160, 0x6010, 0x9005, 0x0130,
-- 0x2058, 0xb8ac, 0x9005, 0x190c, 0x0dc5, 0x6012, 0x2c00, 0x080c,
-- 0x8ce2, 0x0005, 0x080c, 0x9290, 0x009e, 0x0005, 0x9182, 0x0040,
-- 0x0096, 0x0002, 0x91fa, 0x91fa, 0x91fa, 0x91fc, 0x91fa, 0x91fa,
-- 0x91fa, 0x9221, 0x91fa, 0x91fa, 0x91fa, 0x91fa, 0x91fa, 0x91fa,
-- 0x91fa, 0x91fa, 0x080c, 0x0dc5, 0x6003, 0x0003, 0x6106, 0x6014,
-- 0x2048, 0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0xa837, 0x0000, 0xa83b,
-- 0x0000, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
-- 0x8013, 0x8213, 0x9210, 0x621a, 0x2c10, 0x080c, 0x1be0, 0x080c,
-- 0x9564, 0x0126, 0x2091, 0x8000, 0x080c, 0x9bd3, 0x012e, 0x009e,
-- 0x0005, 0x080c, 0x0dc5, 0x080c, 0x9a61, 0x080c, 0x9bd3, 0x6114,
-- 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500,
-- 0x00be, 0x080c, 0x6e9f, 0x080c, 0xb2d3, 0x009e, 0x0005, 0x6000,
-- 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0096, 0x0013, 0x009e, 0x0005,
-- 0x9250, 0x9250, 0x9250, 0x9252, 0x9263, 0x9250, 0x9250, 0x9250,
-- 0x9250, 0x9250, 0x9250, 0x9250, 0x9250, 0x9250, 0x9250, 0x9250,
-- 0x080c, 0x0dc5, 0x080c, 0xac2b, 0x6114, 0x2148, 0xa87b, 0x0006,
-- 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6e9f,
-- 0x080c, 0xb2d3, 0x0005, 0x0461, 0x0005, 0x6000, 0x908a, 0x0010,
-- 0x1a0c, 0x0dc5, 0x0096, 0x0013, 0x009e, 0x0005, 0x927e, 0x927e,
-- 0x927e, 0x9280, 0x9290, 0x927e, 0x927e, 0x927e, 0x927e, 0x927e,
-- 0x927e, 0x927e, 0x927e, 0x927e, 0x927e, 0x927e, 0x080c, 0x0dc5,
-- 0x0036, 0x00e6, 0x2071, 0x19e8, 0x703c, 0x9c06, 0x1120, 0x2019,
-- 0x0000, 0x080c, 0xaa49, 0x080c, 0xac2b, 0x00ee, 0x003e, 0x0005,
-- 0x6024, 0xd08c, 0x11f0, 0x00f6, 0x00e6, 0x601b, 0x0000, 0x6014,
-- 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c, 0x9067,
-- 0x00be, 0x2071, 0x193d, 0x080c, 0x8cb1, 0x0160, 0x2001, 0x187f,
-- 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x8c28, 0x00ee,
-- 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048, 0x080c,
-- 0x1040, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8c61, 0x0c80, 0x2001,
-- 0x1925, 0x200c, 0x918e, 0x0000, 0x190c, 0x8d17, 0x05c8, 0x00e6,
-- 0x2071, 0x1924, 0x7110, 0xc1c5, 0x7112, 0x080c, 0x8d21, 0x00f6,
-- 0x00c6, 0x2071, 0x1000, 0x00b6, 0x2e04, 0x905d, 0x0138, 0xb8ac,
-- 0x9065, 0x0120, 0x080c, 0x8cf7, 0x090c, 0x9096, 0x8e70, 0x9e86,
-- 0x1800, 0x1d90, 0x00be, 0x00d6, 0x0096, 0x0046, 0x2061, 0x1cd0,
-- 0x2001, 0x181a, 0x2024, 0x6020, 0x9086, 0x0000, 0x1191, 0x9ce0,
-- 0x0018, 0x2400, 0x9c06, 0x1db8, 0x004e, 0x009e, 0x00de, 0x00d1,
-- 0x00ce, 0x00fe, 0x2071, 0x1924, 0x7110, 0xc1c4, 0x7112, 0x00ee,
-- 0x0005, 0x6020, 0x9086, 0x0009, 0x1160, 0x6100, 0x9186, 0x0004,
-- 0x1138, 0x6110, 0x81ff, 0x190c, 0x0dc5, 0x2c00, 0x080c, 0x8ce2,
-- 0x9006, 0x0005, 0x2071, 0x193f, 0x2073, 0x0000, 0x8e70, 0x9e86,
-- 0x1947, 0x1dd0, 0x2071, 0x193d, 0x7006, 0x7002, 0x2001, 0x1930,
-- 0x2064, 0x8cff, 0x0130, 0x6120, 0x918e, 0x0000, 0x190c, 0x0dc5,
-- 0x2102, 0x2001, 0x188a, 0x200c, 0x81ff, 0x0148, 0x0096, 0x2148,
-- 0x080c, 0x1040, 0x009e, 0x2001, 0x188a, 0x2003, 0x0000, 0x2071,
-- 0x1931, 0x080c, 0x8f00, 0x0804, 0x8f0f, 0x0000, 0x0000, 0x0000,
-- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x187a, 0x0000,
-- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0126, 0x2091, 0x8000,
-- 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006, 0x8004, 0x2019, 0x0100,
-- 0x231c, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020, 0x80f6,
-- 0x3e00, 0x81f6, 0x3e08, 0x1208, 0x9200, 0x1f04, 0x9356, 0x93a6,
-- 0x0008, 0x1118, 0x8086, 0x818e, 0x0020, 0x80f6, 0x3e00, 0x81f6,
-- 0x3e08, 0x004e, 0x003e, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
-- 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005, 0x0510, 0x911a, 0x1600,
-- 0x8213, 0x2039, 0x0100, 0x273c, 0x97be, 0x0008, 0x1110, 0x818d,
-- 0x0010, 0x81f5, 0x3e08, 0x0228, 0x911a, 0x1220, 0x1f04, 0x9380,
-- 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04, 0x9380, 0x0006, 0x3200,
-- 0x9084, 0xefff, 0x2080, 0x000e, 0x015e, 0x007e, 0x012e, 0x0005,
-- 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8, 0x0126, 0x2091, 0x2800,
-- 0x2079, 0x19e8, 0x012e, 0x00d6, 0x2069, 0x19e8, 0x6803, 0x0005,
-- 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000, 0x2069, 0x0200, 0x080c,
-- 0xaf8e, 0x0401, 0x080c, 0xaf79, 0x00e9, 0x080c, 0xaf7c, 0x00d1,
-- 0x080c, 0xaf7f, 0x00b9, 0x080c, 0xaf82, 0x00a1, 0x080c, 0xaf85,
-- 0x0089, 0x080c, 0xaf88, 0x0071, 0x080c, 0xaf8b, 0x0059, 0x01de,
-- 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04, 0x9085, 0x8001, 0x206a,
-- 0x00de, 0x0005, 0x20a9, 0x0020, 0x20a1, 0x0240, 0x2001, 0x0000,
-- 0x4004, 0x0005, 0x00c6, 0x6027, 0x0001, 0x7804, 0x9084, 0x0007,
-- 0x0002, 0x93f3, 0x9417, 0x9458, 0x93f9, 0x9417, 0x93f3, 0x93f1,
-- 0x93f1, 0x080c, 0x0dc5, 0x080c, 0x88c3, 0x080c, 0x9ab1, 0x00ce,
-- 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce, 0x0005, 0x2011, 0x5f97,
-- 0x080c, 0x883d, 0x7828, 0x9092, 0x00c8, 0x1228, 0x8000, 0x782a,
-- 0x080c, 0x5fd7, 0x0c88, 0x62c0, 0x080c, 0xb0ca, 0x080c, 0x5f97,
-- 0x7807, 0x0003, 0x7827, 0x0000, 0x782b, 0x0000, 0x0c28, 0x080c,
-- 0x88c3, 0x6220, 0xd2a4, 0x0170, 0xd2cc, 0x0160, 0x782b, 0x0000,
-- 0x7824, 0x9065, 0x090c, 0x0dc5, 0x2009, 0x0013, 0x080c, 0xb352,
-- 0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0dc5, 0x7828,
-- 0x9092, 0xc350, 0x12c0, 0x8000, 0x782a, 0x00ce, 0x080c, 0x2bce,
-- 0x0278, 0x00c6, 0x7924, 0x2160, 0x6010, 0x906d, 0x090c, 0x0dc5,
-- 0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x9ab1, 0x0c00,
-- 0x080c, 0xa6c5, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c, 0xb0ca,
-- 0x080c, 0xf094, 0x2009, 0x0014, 0x080c, 0xb352, 0x00ce, 0x0880,
-- 0x2001, 0x1a04, 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160, 0x782b,
-+ 0x2009, 0x0046, 0x080c, 0xb34b, 0x7817, 0x0140, 0x2001, 0x19f1,
-+ 0x2004, 0x9005, 0x090c, 0x9aaa, 0x00be, 0x0005, 0x00b6, 0x00c6,
-+ 0x9484, 0x0fff, 0x0904, 0x84c2, 0x7110, 0xd1bc, 0x1904, 0x84c2,
-+ 0x7108, 0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094, 0xff00,
-+ 0x15b0, 0x81ff, 0x15a0, 0x9080, 0x33b6, 0x200d, 0x918c, 0xff00,
-+ 0x810f, 0x2001, 0x0080, 0x9106, 0x0904, 0x84c2, 0x080c, 0x66b2,
-+ 0x1904, 0x84c2, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04,
-+ 0x9294, 0xff00, 0x9286, 0x0600, 0x11a0, 0x080c, 0xb276, 0x05e8,
-+ 0x2b08, 0x7028, 0x6046, 0x702c, 0x604a, 0x6112, 0x6023, 0x0006,
-+ 0x7120, 0x610a, 0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xe18b,
-+ 0x0408, 0x080c, 0x6a9c, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c,
-+ 0x839e, 0x11c0, 0x0898, 0x080c, 0xb276, 0x2b08, 0x0198, 0x6112,
-+ 0x6023, 0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007,
-+ 0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9540,
-+ 0x080c, 0x9aaa, 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005,
-+ 0x090c, 0x9aaa, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004,
-+ 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4c42, 0x080c, 0xb31e,
-+ 0x0d48, 0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130,
-+ 0x6156, 0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8,
-+ 0x7020, 0x2060, 0x9c84, 0x0007, 0x11c0, 0x9c82, 0x1cd0, 0x02a8,
-+ 0x6868, 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158,
-+ 0xb910, 0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124,
-+ 0x610a, 0x2009, 0x0045, 0x080c, 0xb34b, 0x7817, 0x0140, 0x2001,
-+ 0x19f1, 0x2004, 0x9005, 0x090c, 0x9aaa, 0x00be, 0x0005, 0x6120,
-+ 0x9186, 0x0002, 0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001,
-+ 0x0005, 0x080c, 0x8734, 0x1180, 0x080c, 0x3374, 0x1168, 0x7010,
-+ 0x9084, 0xff00, 0x8007, 0x9086, 0x0000, 0x1130, 0x9184, 0x000f,
-+ 0x908a, 0x0006, 0x1208, 0x000b, 0x0005, 0x853b, 0x853c, 0x853b,
-+ 0x853b, 0x85a1, 0x85b0, 0x0005, 0x00b6, 0x700c, 0x7108, 0x080c,
-+ 0x2873, 0x1904, 0x859f, 0x080c, 0x66b2, 0x1904, 0x859f, 0xbe12,
-+ 0xbd16, 0x7110, 0xd1bc, 0x0540, 0x702c, 0xd084, 0x1120, 0xb800,
-+ 0xd0bc, 0x1904, 0x859f, 0x080c, 0x6a9c, 0x0148, 0x9086, 0x0004,
-+ 0x0130, 0x080c, 0x6aa4, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6,
-+ 0x080c, 0x85bf, 0x00ce, 0x05d8, 0x080c, 0xb276, 0x2b08, 0x05b8,
-+ 0x6112, 0x080c, 0xd54d, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009,
-+ 0x0088, 0x080c, 0xb34b, 0x0458, 0x080c, 0x6a9c, 0x0148, 0x9086,
-+ 0x0004, 0x0130, 0x080c, 0x6aa4, 0x0118, 0x9086, 0x0004, 0x1180,
-+ 0x080c, 0xb276, 0x2b08, 0x01d8, 0x6112, 0x080c, 0xd54d, 0x6023,
-+ 0x0005, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xb34b, 0x0078,
-+ 0x080c, 0xb276, 0x2b08, 0x0158, 0x6112, 0x080c, 0xd54d, 0x6023,
-+ 0x0004, 0x7120, 0x610a, 0x2009, 0x0001, 0x080c, 0xb34b, 0x00be,
-+ 0x0005, 0x7110, 0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x8517,
-+ 0x1130, 0x7124, 0x610a, 0x2009, 0x0089, 0x080c, 0xb34b, 0x0005,
-+ 0x7110, 0xd1bc, 0x0158, 0x0059, 0x0148, 0x080c, 0x8517, 0x1130,
-+ 0x7124, 0x610a, 0x2009, 0x008a, 0x080c, 0xb34b, 0x0005, 0x7020,
-+ 0x2060, 0x9c84, 0x0007, 0x1158, 0x9c82, 0x1cd0, 0x0240, 0x2001,
-+ 0x181a, 0x2004, 0x9c02, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006,
-+ 0x0ce8, 0x00b6, 0x7110, 0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84,
-+ 0x0007, 0x11b0, 0x9c82, 0x1cd0, 0x0298, 0x6868, 0x9c02, 0x1280,
-+ 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1140,
-+ 0x700c, 0xb914, 0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0xb34b,
-+ 0x7817, 0x0140, 0x2001, 0x19f1, 0x2004, 0x9005, 0x090c, 0x9aaa,
-+ 0x00be, 0x0005, 0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206,
-+ 0x0049, 0x0005, 0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213,
-+ 0x0009, 0x0005, 0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000,
-+ 0x9086, 0xc000, 0x05d0, 0x080c, 0xb276, 0x05b8, 0x0066, 0x00c6,
-+ 0x0046, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2873,
-+ 0x15a0, 0x080c, 0x66b2, 0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e,
-+ 0x00ce, 0x6012, 0x080c, 0xd54d, 0x080c, 0x100e, 0x0510, 0x2900,
-+ 0x605a, 0x9006, 0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b,
-+ 0x20a9, 0x000e, 0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98,
-+ 0x4003, 0x006e, 0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003,
-+ 0x0001, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x00fe, 0x009e, 0x00ce,
-+ 0x0005, 0x080c, 0xb2cc, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8,
-+ 0x00c6, 0x7000, 0x908c, 0xff00, 0x9184, 0xf000, 0x810f, 0x9086,
-+ 0x2000, 0x1904, 0x86af, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111,
-+ 0x2004, 0x9005, 0x1904, 0x86b1, 0x7030, 0x908e, 0x0400, 0x0904,
-+ 0x86b1, 0x908e, 0x6000, 0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e,
-+ 0x0300, 0x11d8, 0x2009, 0x1837, 0x210c, 0xd18c, 0x1590, 0xd1a4,
-+ 0x1580, 0x080c, 0x6a5a, 0x0588, 0x68b0, 0x9084, 0x00ff, 0x7100,
-+ 0x918c, 0x00ff, 0x9106, 0x1518, 0x6880, 0x69b0, 0x918c, 0xff00,
-+ 0x9105, 0x7104, 0x9106, 0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c,
-+ 0xd1b4, 0x11a8, 0x908e, 0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0,
-+ 0x908e, 0x5000, 0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c,
-+ 0x85bf, 0x0128, 0x6004, 0x9086, 0x0002, 0x0118, 0x0000, 0x9006,
-+ 0x0010, 0x9085, 0x0001, 0x00ce, 0x0005, 0x7030, 0x908e, 0x0300,
-+ 0x0118, 0x908e, 0x5200, 0x1d98, 0x2001, 0x1837, 0x2004, 0x9084,
-+ 0x0009, 0x9086, 0x0008, 0x0d68, 0x0c50, 0x0156, 0x0046, 0x0016,
-+ 0x0036, 0x7038, 0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148,
-+ 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x027a, 0x080c, 0xc35e,
-+ 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011,
-+ 0x027e, 0x080c, 0xc35e, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001,
-+ 0x003e, 0x001e, 0x004e, 0x015e, 0x0005, 0x0156, 0x0046, 0x0016,
-+ 0x0036, 0x7038, 0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148,
-+ 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0272, 0x080c, 0xc35e,
-+ 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011,
-+ 0x0276, 0x080c, 0xc35e, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001,
-+ 0x003e, 0x001e, 0x004e, 0x015e, 0x0005, 0x00f6, 0x2079, 0x0200,
-+ 0x7800, 0xc0e5, 0xc0cc, 0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079,
-+ 0x1800, 0x7834, 0xd084, 0x1130, 0x2079, 0x0200, 0x7800, 0x9085,
-+ 0x1200, 0x7802, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7034,
-+ 0xc084, 0x7036, 0x00ee, 0x0005, 0x0016, 0x2001, 0x1837, 0x200c,
-+ 0x9184, 0x0080, 0x0118, 0xd18c, 0x0118, 0x9006, 0x001e, 0x0005,
-+ 0x9085, 0x0001, 0x0cd8, 0x2071, 0x19fb, 0x7003, 0x0003, 0x700f,
-+ 0x0361, 0x9006, 0x701a, 0x707a, 0x7012, 0x7017, 0x1cd0, 0x7007,
-+ 0x0000, 0x7026, 0x702b, 0xa6f8, 0x7032, 0x703a, 0x703f, 0x0064,
-+ 0x7037, 0xa760, 0x7047, 0xffff, 0x704a, 0x704f, 0x5665, 0x7052,
-+ 0x7063, 0x88d7, 0x080c, 0x1027, 0x090c, 0x0dc5, 0x2900, 0x7042,
-+ 0xa867, 0x0003, 0xa86f, 0x0100, 0xa8ab, 0xdcb0, 0x0005, 0x2071,
-+ 0x19fb, 0x1d04, 0x8825, 0x2091, 0x6000, 0x700c, 0x8001, 0x700e,
-+ 0x1540, 0x2001, 0x013c, 0x2004, 0x9005, 0x190c, 0x8945, 0x2001,
-+ 0x1869, 0x2004, 0xd0c4, 0x0158, 0x3a00, 0xd08c, 0x1140, 0x20d1,
-+ 0x0000, 0x20d1, 0x0001, 0x20d1, 0x0000, 0x080c, 0x0dc5, 0x700f,
-+ 0x0361, 0x7007, 0x0001, 0x0126, 0x2091, 0x8000, 0x080c, 0x891c,
-+ 0x7048, 0x900d, 0x0148, 0x8109, 0x714a, 0x1130, 0x704c, 0x080f,
-+ 0x0018, 0x0126, 0x2091, 0x8000, 0x7024, 0x900d, 0x0188, 0x7020,
-+ 0x8001, 0x7022, 0x1168, 0x7023, 0x0009, 0x8109, 0x7126, 0x9186,
-+ 0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110, 0x7028, 0x080f,
-+ 0x7030, 0x900d, 0x05a8, 0x702c, 0x8001, 0x702e, 0x1588, 0x0016,
-+ 0x2009, 0x0306, 0x210c, 0x9184, 0x0030, 0x01e8, 0x9184, 0x0048,
-+ 0x9086, 0x0008, 0x11c0, 0x7038, 0x9005, 0x01a8, 0x8001, 0x703a,
-+ 0x1190, 0x080c, 0x7630, 0x0178, 0x00e6, 0x2071, 0x19e8, 0x080c,
-+ 0xa7ee, 0x00ee, 0x1140, 0x2009, 0x1a86, 0x2104, 0x8000, 0x0208,
-+ 0x200a, 0x001e, 0x0068, 0x001e, 0x702f, 0x0009, 0x8109, 0x7132,
-+ 0x0128, 0x9184, 0x007f, 0x090c, 0xa8a4, 0x0010, 0x7034, 0x080f,
-+ 0x7044, 0x9005, 0x0118, 0x0310, 0x8001, 0x7046, 0x7054, 0x900d,
-+ 0x0168, 0x7050, 0x8001, 0x7052, 0x1148, 0x7053, 0x0009, 0x8109,
-+ 0x7156, 0x1120, 0x7158, 0x7156, 0x7060, 0x080f, 0x7018, 0x900d,
-+ 0x01d8, 0x0016, 0x7078, 0x900d, 0x0158, 0x7074, 0x8001, 0x7076,
-+ 0x1138, 0x7077, 0x0009, 0x8109, 0x717a, 0x1110, 0x707c, 0x080f,
-+ 0x001e, 0x7008, 0x8001, 0x700a, 0x1138, 0x700b, 0x0009, 0x8109,
-+ 0x711a, 0x1110, 0x701c, 0x080f, 0x012e, 0x7004, 0x0002, 0x884d,
-+ 0x884e, 0x886a, 0x00e6, 0x2071, 0x19fb, 0x7018, 0x9005, 0x1120,
-+ 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006,
-+ 0x2071, 0x19fb, 0x701c, 0x9206, 0x1120, 0x701a, 0x701e, 0x707a,
-+ 0x707e, 0x000e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x19fb, 0xb888,
-+ 0x9102, 0x0208, 0xb98a, 0x00ee, 0x0005, 0x0005, 0x00b6, 0x7110,
-+ 0x080c, 0x671d, 0x1168, 0xb888, 0x8001, 0x0250, 0xb88a, 0x1140,
-+ 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0x9aaa, 0x001e, 0x012e,
-+ 0x8108, 0x9182, 0x0800, 0x0218, 0x900e, 0x7007, 0x0002, 0x7112,
-+ 0x00be, 0x0005, 0x7014, 0x2060, 0x0126, 0x2091, 0x8000, 0x6040,
-+ 0x9005, 0x0128, 0x8001, 0x6042, 0x1110, 0x080c, 0xd3de, 0x6018,
-+ 0x9005, 0x0558, 0x8001, 0x601a, 0x1540, 0x6120, 0x9186, 0x0003,
-+ 0x0148, 0x9186, 0x0006, 0x0130, 0x9186, 0x0009, 0x11e0, 0x611c,
-+ 0xd1c4, 0x1100, 0x080c, 0xd0d1, 0x01b0, 0x6014, 0x2048, 0xa884,
-+ 0x908a, 0x199a, 0x0280, 0x9082, 0x1999, 0xa886, 0x908a, 0x199a,
-+ 0x0210, 0x2001, 0x1999, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a,
-+ 0xa87c, 0xd0e4, 0x0110, 0x080c, 0xcdb5, 0x012e, 0x9c88, 0x0018,
-+ 0x7116, 0x2001, 0x181a, 0x2004, 0x9102, 0x0220, 0x7017, 0x1cd0,
-+ 0x7007, 0x0000, 0x0005, 0x00e6, 0x2071, 0x19fb, 0x7027, 0x07d0,
-+ 0x7023, 0x0009, 0x00ee, 0x0005, 0x2001, 0x1a04, 0x2003, 0x0000,
-+ 0x0005, 0x00e6, 0x2071, 0x19fb, 0x7132, 0x702f, 0x0009, 0x00ee,
-+ 0x0005, 0x2011, 0x1a07, 0x2013, 0x0000, 0x0005, 0x00e6, 0x2071,
-+ 0x19fb, 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x0086,
-+ 0x0026, 0x705c, 0x8000, 0x705e, 0x2001, 0x1a0b, 0x2044, 0xa06c,
-+ 0x9086, 0x0000, 0x0150, 0x7070, 0xa09a, 0x706c, 0xa096, 0x7068,
-+ 0xa092, 0x7064, 0xa08e, 0x080c, 0x10f8, 0x002e, 0x008e, 0x0005,
-+ 0x0006, 0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6,
-+ 0x00f6, 0x0156, 0x080c, 0x876f, 0x015e, 0x00fe, 0x00ee, 0x00de,
-+ 0x00ce, 0x00be, 0x00ae, 0x009e, 0x001e, 0x000e, 0x0005, 0x00e6,
-+ 0x2071, 0x19fb, 0x717a, 0x727e, 0x7077, 0x0009, 0x00ee, 0x0005,
-+ 0x00e6, 0x0006, 0x2071, 0x19fb, 0x707c, 0x9206, 0x1110, 0x707a,
-+ 0x707e, 0x000e, 0x00ee, 0x0005, 0x2069, 0x1800, 0x69e8, 0xd1e4,
-+ 0x1518, 0x0026, 0xd1ec, 0x0140, 0x6a54, 0x6874, 0x9202, 0x0288,
-+ 0x8117, 0x9294, 0x00c0, 0x0088, 0x9184, 0x0007, 0x01a0, 0x8109,
-+ 0x9184, 0x0007, 0x0110, 0x69ea, 0x0070, 0x8107, 0x9084, 0x0007,
-+ 0x910d, 0x8107, 0x9106, 0x9094, 0x00c0, 0x9184, 0xff3f, 0x9205,
-+ 0x68ea, 0x080c, 0x0eee, 0x002e, 0x0005, 0x0016, 0x00c6, 0x2009,
-+ 0xfff4, 0x210d, 0x2061, 0x0100, 0x60f0, 0x9100, 0x60f3, 0x0000,
-+ 0x2009, 0xfff4, 0x200f, 0x1220, 0x8108, 0x2105, 0x8000, 0x200f,
-+ 0x00ce, 0x001e, 0x0005, 0x00c6, 0x2061, 0x1a74, 0x00ce, 0x0005,
-+ 0x9184, 0x000f, 0x8003, 0x8003, 0x8003, 0x9080, 0x1a74, 0x2060,
-+ 0x0005, 0xa884, 0x908a, 0x199a, 0x1638, 0x9005, 0x1150, 0x00c6,
-+ 0x2061, 0x1a74, 0x6014, 0x00ce, 0x9005, 0x1130, 0x2001, 0x001e,
-+ 0x0018, 0x908e, 0xffff, 0x01b0, 0x8003, 0x800b, 0x810b, 0x9108,
-+ 0x611a, 0xa87c, 0x908c, 0x00c0, 0x918e, 0x00c0, 0x0904, 0x89f3,
-+ 0xd0b4, 0x1168, 0xd0bc, 0x1904, 0x89cc, 0x2009, 0x0006, 0x080c,
-+ 0x8a20, 0x0005, 0x900e, 0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc,
-+ 0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8a1a,
-+ 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x6024, 0xd0d4, 0x11e8,
-+ 0x2009, 0x1869, 0x2104, 0xd084, 0x1138, 0x87ff, 0x1120, 0x2009,
-+ 0x0043, 0x0804, 0xb34b, 0x0005, 0x87ff, 0x1de8, 0x2009, 0x0042,
-+ 0x0804, 0xb34b, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
-+ 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00, 0xc0d4, 0x6026, 0xa890,
-+ 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc, 0x0160, 0x908c, 0x0003,
-+ 0x0120, 0x918e, 0x0003, 0x1904, 0x8a1a, 0x908c, 0x2020, 0x918e,
-+ 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78, 0x080c, 0x1768, 0x00fe,
-+ 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042, 0x080c, 0xb34b, 0x0005,
-+ 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d58, 0x6124,
-+ 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188, 0x908c, 0x2020, 0x918e,
-+ 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e, 0x0002, 0x0148, 0x87ff,
-+ 0x1120, 0x2009, 0x0041, 0x080c, 0xb34b, 0x0005, 0x00b9, 0x0ce8,
-+ 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c, 0xb34b, 0x0cb0, 0x6110,
-+ 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6124, 0xc1cd,
-+ 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019, 0x0005, 0x2009, 0x0001,
-+ 0x0096, 0x080c, 0xd0d1, 0x0518, 0x6014, 0x2048, 0xa982, 0xa800,
-+ 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c, 0x918c, 0x8100, 0x918e,
-+ 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a74, 0x6200, 0xd28c, 0x1120,
-+ 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce, 0x080c, 0x6cd7, 0x6014,
-+ 0x904d, 0x0076, 0x2039, 0x0000, 0x190c, 0x8969, 0x007e, 0x009e,
-+ 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a74, 0x6000, 0x81ff, 0x0110,
-+ 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce, 0x015e, 0x0005, 0x6800,
-+ 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120, 0x8001, 0x680a, 0x9085,
-+ 0x0001, 0x0005, 0x2071, 0x1924, 0x7003, 0x0006, 0x7007, 0x0000,
-+ 0x700f, 0x0000, 0x7013, 0x0001, 0x080c, 0x1027, 0x090c, 0x0dc5,
-+ 0xa867, 0x0006, 0xa86b, 0x0001, 0xa8ab, 0xdcb0, 0xa89f, 0x0000,
-+ 0x2900, 0x702e, 0x7033, 0x0000, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x0096, 0x00e6, 0x2071, 0x1924, 0x702c, 0x2048, 0x6a2c, 0x721e,
-+ 0x6b30, 0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a, 0xa89a,
-+ 0x6824, 0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a, 0x9005,
-+ 0x0148, 0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100, 0x9210,
-+ 0x1208, 0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0168, 0xc084,
-+ 0x7007, 0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x1ad1, 0x2104,
-+ 0x9082, 0x0007, 0x200a, 0x000e, 0xc095, 0x7012, 0x2008, 0x2001,
-+ 0x003b, 0x080c, 0x1611, 0x9006, 0x2071, 0x193d, 0x7002, 0x7006,
-+ 0x702a, 0x00ee, 0x009e, 0x012e, 0x0005, 0x2009, 0x1ad1, 0x2104,
-+ 0x9080, 0x0007, 0x200a, 0x0005, 0x00e6, 0x0126, 0x0156, 0x2091,
-+ 0x8000, 0x2071, 0x1800, 0x7154, 0x2001, 0x0008, 0x910a, 0x0638,
-+ 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080, 0x0008, 0x1f04, 0x8adc,
-+ 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877, 0x20a9, 0x0007, 0x00c6,
-+ 0x080c, 0xb276, 0x6023, 0x0009, 0x6003, 0x0004, 0x601f, 0x0101,
-+ 0x0089, 0x0126, 0x2091, 0x8000, 0x080c, 0x8c5a, 0x012e, 0x1f04,
-+ 0x8ae8, 0x9006, 0x00ce, 0x015e, 0x012e, 0x00ee, 0x0005, 0x9085,
-+ 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096, 0x0086, 0x0056, 0x0046,
-+ 0x0026, 0x7118, 0x720c, 0x7620, 0x7004, 0xd084, 0x1128, 0x2021,
-+ 0x0024, 0x2029, 0x0002, 0x0020, 0x2021, 0x002c, 0x2029, 0x000a,
-+ 0x080c, 0x100e, 0x090c, 0x0dc5, 0x2900, 0x6016, 0x2058, 0xac66,
-+ 0x9006, 0xa802, 0xa806, 0xa86a, 0xa87a, 0xa8aa, 0xa887, 0x0005,
-+ 0xa87f, 0x0020, 0x7008, 0xa89a, 0x7010, 0xa89e, 0xae8a, 0xa8af,
-+ 0xffff, 0xa8b3, 0x0000, 0x8109, 0x0160, 0x080c, 0x100e, 0x090c,
-+ 0x0dc5, 0xad66, 0x2b00, 0xa802, 0x2900, 0xb806, 0x2058, 0x8109,
-+ 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e, 0x009e, 0x00be, 0x00ee,
-+ 0x0005, 0x2079, 0x0000, 0x2071, 0x1924, 0x7004, 0x004b, 0x700c,
-+ 0x0002, 0x8b54, 0x8b4d, 0x8b4d, 0x0005, 0x8b5e, 0x8bb4, 0x8bb4,
-+ 0x8bb4, 0x8bb5, 0x8bc6, 0x8bc6, 0x700c, 0x0cba, 0x0126, 0x2091,
-+ 0x8000, 0x78a0, 0x79a0, 0x9106, 0x1904, 0x8ba6, 0x7814, 0xd0bc,
-+ 0x1904, 0x8baf, 0x012e, 0x7018, 0x910a, 0x1128, 0x7030, 0x9005,
-+ 0x1904, 0x8bf8, 0x0005, 0x1210, 0x7114, 0x910a, 0x9192, 0x000a,
-+ 0x0210, 0x2009, 0x000a, 0x2001, 0x1888, 0x2014, 0x2001, 0x1936,
-+ 0x2004, 0x9100, 0x9202, 0x0e50, 0x080c, 0x8d55, 0x2200, 0x9102,
-+ 0x0208, 0x2208, 0x0096, 0x702c, 0x2048, 0xa873, 0x0001, 0xa976,
-+ 0x080c, 0x8e5e, 0x2100, 0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126,
-+ 0x2091, 0x8000, 0x2009, 0x1a1b, 0x2104, 0xc085, 0x200a, 0x700f,
-+ 0x0002, 0x012e, 0x080c, 0x1117, 0x1de8, 0x0005, 0x78a0, 0x79a0,
-+ 0x9106, 0x0904, 0x8b66, 0x080c, 0x8d2d, 0x012e, 0x0005, 0x7810,
-+ 0xc0c5, 0x7812, 0x0804, 0x8b66, 0x0005, 0x700c, 0x0002, 0x8bba,
-+ 0x8bbd, 0x8bbc, 0x080c, 0x8b5c, 0x0005, 0x8001, 0x700e, 0x0096,
-+ 0x702c, 0x2048, 0xa974, 0x009e, 0x0011, 0x0ca0, 0x0005, 0x0096,
-+ 0x702c, 0x2048, 0x7018, 0x9100, 0x7214, 0x921a, 0x1130, 0x701c,
-+ 0xa88e, 0x7020, 0xa892, 0x9006, 0x0068, 0x0006, 0x080c, 0x8e5e,
-+ 0x2100, 0xaa8c, 0x9210, 0xaa8e, 0x1220, 0xa890, 0x9081, 0x0000,
-+ 0xa892, 0x000e, 0x009e, 0x0126, 0x2091, 0x8000, 0x78a2, 0x701a,
-+ 0x080c, 0x8d2d, 0x012e, 0x0005, 0x00e6, 0x2071, 0x1924, 0x700c,
-+ 0x0002, 0x8bf6, 0x8bf6, 0x8bf4, 0x700f, 0x0001, 0x00ee, 0x0005,
-+ 0x0126, 0x2091, 0x8000, 0x7030, 0x9005, 0x0508, 0x2078, 0x7814,
-+ 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8c63, 0x00be,
-+ 0x01b0, 0x00e6, 0x2071, 0x193d, 0x080c, 0x8caa, 0x00ee, 0x0178,
-+ 0x0096, 0x080c, 0x1027, 0x2900, 0x009e, 0x0148, 0xa8aa, 0x04b9,
-+ 0x0041, 0x2001, 0x1947, 0x2003, 0x0000, 0x012e, 0x08c8, 0x012e,
-+ 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6, 0x2940, 0x2650, 0x2600,
-+ 0x9005, 0x0180, 0xa864, 0x9084, 0x000f, 0x2068, 0x9d88, 0x20c7,
-+ 0x2165, 0x0056, 0x2029, 0x0000, 0x080c, 0x8de3, 0x080c, 0x207f,
-+ 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f, 0x2004, 0xa88a, 0x080c,
-+ 0x1768, 0x781f, 0x0101, 0x7813, 0x0000, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x8cb9, 0x012e, 0x008e, 0x00ce, 0x00de, 0x0005, 0x7030,
-+ 0x9005, 0x0138, 0x2078, 0x780c, 0x7032, 0x2001, 0x1947, 0x2003,
-+ 0x0001, 0x0005, 0x00e6, 0x2071, 0x1924, 0x7030, 0x600e, 0x2c00,
-+ 0x7032, 0x00ee, 0x0005, 0x00d6, 0x00c6, 0x0026, 0x9b80, 0x8f2c,
-+ 0x2005, 0x906d, 0x090c, 0x0dc5, 0x9b80, 0x8f24, 0x2005, 0x9065,
-+ 0x090c, 0x0dc5, 0x6114, 0x2600, 0x9102, 0x0248, 0x6828, 0x9102,
-+ 0x02f0, 0x9085, 0x0001, 0x002e, 0x00ce, 0x00de, 0x0005, 0x6804,
-+ 0xd094, 0x0148, 0x6854, 0xd084, 0x1178, 0xc085, 0x6856, 0x2011,
-+ 0x8026, 0x080c, 0x4c42, 0x684c, 0x0096, 0x904d, 0x090c, 0x0dc5,
-+ 0xa804, 0x8000, 0xa806, 0x009e, 0x9006, 0x2030, 0x0c20, 0x6854,
-+ 0xd08c, 0x1d08, 0xc08d, 0x6856, 0x2011, 0x8025, 0x080c, 0x4c42,
-+ 0x684c, 0x0096, 0x904d, 0x090c, 0x0dc5, 0xa800, 0x8000, 0xa802,
-+ 0x009e, 0x0888, 0x7000, 0x2019, 0x0008, 0x8319, 0x7104, 0x9102,
-+ 0x1118, 0x2300, 0x9005, 0x0020, 0x0210, 0x9302, 0x0008, 0x8002,
-+ 0x0005, 0x00d6, 0x7814, 0x9005, 0x090c, 0x0dc5, 0x781c, 0x9084,
-+ 0x0101, 0x9086, 0x0101, 0x190c, 0x0dc5, 0x7827, 0x0000, 0x2069,
-+ 0x193d, 0x6804, 0x9080, 0x193f, 0x2f08, 0x2102, 0x6904, 0x8108,
-+ 0x9182, 0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193f, 0x2003,
-+ 0x0000, 0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048,
-+ 0xa8a8, 0x0096, 0x2048, 0x9005, 0x190c, 0x1040, 0x009e, 0xa8ab,
-+ 0x0000, 0x080c, 0x0fc0, 0x080c, 0xb2cc, 0x00ce, 0x009e, 0x0005,
-+ 0x6020, 0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006,
-+ 0x0005, 0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178,
-+ 0x6010, 0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x9060, 0x00be,
-+ 0x6013, 0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005,
-+ 0x2009, 0x1928, 0x210c, 0xd194, 0x0005, 0x2009, 0x1928, 0x210c,
-+ 0xd1c4, 0x0005, 0x0126, 0x2091, 0x8000, 0x00e6, 0x2071, 0x1924,
-+ 0x7110, 0xc194, 0xc185, 0x7007, 0x0000, 0x7112, 0x2001, 0x003b,
-+ 0x080c, 0x1611, 0x00ee, 0x012e, 0x0005, 0x7814, 0xd0bc, 0x1108,
-+ 0x0005, 0x7810, 0xc0c5, 0x7812, 0x0cc0, 0x0096, 0x00d6, 0x9006,
-+ 0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x7016, 0x702a, 0x7026,
-+ 0x702f, 0x0000, 0x080c, 0x8eac, 0x0170, 0x080c, 0x8ee1, 0x0158,
-+ 0x2900, 0x7002, 0x700a, 0x701a, 0x7013, 0x0001, 0x701f, 0x000a,
-+ 0x00de, 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096, 0x0086,
-+ 0x00d6, 0x00c6, 0x2071, 0x1931, 0x721c, 0x2100, 0x9202, 0x1618,
-+ 0x080c, 0x8ee1, 0x090c, 0x0dc5, 0x7018, 0x9005, 0x1160, 0x2900,
-+ 0x7002, 0x700a, 0x701a, 0x9006, 0x7006, 0x700e, 0xa806, 0xa802,
-+ 0x7012, 0x701e, 0x0038, 0x2040, 0xa806, 0x2900, 0xa002, 0x701a,
-+ 0xa803, 0x0000, 0x7010, 0x8000, 0x7012, 0x701c, 0x9080, 0x000a,
-+ 0x701e, 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e, 0x009e,
-+ 0x00ee, 0x0005, 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6, 0x0126,
-+ 0x2091, 0x8000, 0x2071, 0x1931, 0x7300, 0x831f, 0x831e, 0x831e,
-+ 0x9384, 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003, 0x7104,
-+ 0x080c, 0x8e5e, 0x810c, 0x2100, 0x9318, 0x8003, 0x2228, 0x2021,
-+ 0x0078, 0x9402, 0x9532, 0x0208, 0x2028, 0x2500, 0x8004, 0x20a8,
-+ 0x23a0, 0xa001, 0xa001, 0x4005, 0x2508, 0x080c, 0x8e67, 0x2130,
-+ 0x7014, 0x9600, 0x7016, 0x2600, 0x711c, 0x9102, 0x701e, 0x7004,
-+ 0x9600, 0x2008, 0x9082, 0x000a, 0x1190, 0x7000, 0x2048, 0xa800,
-+ 0x9005, 0x1148, 0x2009, 0x0001, 0x0026, 0x080c, 0x8d55, 0x002e,
-+ 0x7000, 0x2048, 0xa800, 0x7002, 0x7007, 0x0000, 0x0008, 0x7106,
-+ 0x2500, 0x9212, 0x1904, 0x8d94, 0x012e, 0x00ee, 0x014e, 0x013e,
-+ 0x015e, 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126, 0x2091,
-+ 0x8000, 0x9580, 0x8f24, 0x2005, 0x9075, 0x090c, 0x0dc5, 0x080c,
-+ 0x8e39, 0x012e, 0x9580, 0x8f20, 0x2005, 0x9075, 0x090c, 0x0dc5,
-+ 0x0156, 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e, 0x831e,
-+ 0x9384, 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098, 0xa860,
-+ 0x20e8, 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002, 0x4003,
-+ 0x2e0c, 0x2d00, 0x0002, 0x8e23, 0x8e23, 0x8e25, 0x8e23, 0x8e25,
-+ 0x8e23, 0x8e23, 0x8e23, 0x8e23, 0x8e23, 0x8e2b, 0x8e23, 0x8e2b,
-+ 0x8e23, 0x8e23, 0x8e23, 0x080c, 0x0dc5, 0x4104, 0x20a9, 0x0002,
-+ 0x4002, 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104, 0x4003,
-+ 0x01de, 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e, 0x001e,
-+ 0x0005, 0x0096, 0x7014, 0x8001, 0x7016, 0x710c, 0x2110, 0x00f1,
-+ 0x810c, 0x9188, 0x0003, 0x7308, 0x8210, 0x9282, 0x000a, 0x1198,
-+ 0x7008, 0x2048, 0xa800, 0x9005, 0x0158, 0x0006, 0x080c, 0x8ef0,
-+ 0x009e, 0xa807, 0x0000, 0x2900, 0x700a, 0x7010, 0x8001, 0x7012,
-+ 0x700f, 0x0000, 0x0008, 0x720e, 0x009e, 0x0005, 0x0006, 0x810b,
-+ 0x810b, 0x2100, 0x810b, 0x9100, 0x2008, 0x000e, 0x0005, 0x0006,
-+ 0x0026, 0x2100, 0x9005, 0x0158, 0x9092, 0x000c, 0x0240, 0x900e,
-+ 0x8108, 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005, 0x900e,
-+ 0x0cd8, 0x2d00, 0x90b8, 0x0008, 0x2031, 0x8eaa, 0x901e, 0x6808,
-+ 0x9005, 0x0108, 0x8318, 0x690c, 0x910a, 0x0248, 0x0140, 0x8318,
-+ 0x6810, 0x9112, 0x0220, 0x0118, 0x8318, 0x2208, 0x0cd0, 0x233a,
-+ 0x6804, 0xd084, 0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003,
-+ 0x0967, 0x0a67, 0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0,
-+ 0x9082, 0x0002, 0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967,
-+ 0x0a67, 0x0cd0, 0x6c1a, 0x0005, 0x0096, 0x0046, 0x0126, 0x2091,
-+ 0x8000, 0x2b00, 0x9080, 0x8f28, 0x2005, 0x9005, 0x090c, 0x0dc5,
-+ 0x2004, 0x90a0, 0x000a, 0x080c, 0x1027, 0x01d0, 0x2900, 0x7026,
-+ 0xa803, 0x0000, 0xa807, 0x0000, 0x080c, 0x1027, 0x0188, 0x7024,
-+ 0xa802, 0xa807, 0x0000, 0x2900, 0x7026, 0x94a2, 0x000a, 0x0110,
-+ 0x0208, 0x0c90, 0x9085, 0x0001, 0x012e, 0x004e, 0x009e, 0x0005,
-+ 0x7024, 0x9005, 0x0dc8, 0x2048, 0xac00, 0x080c, 0x1040, 0x2400,
-+ 0x0cc0, 0x0126, 0x2091, 0x8000, 0x7024, 0x2048, 0x9005, 0x0130,
-+ 0xa800, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x012e, 0x0005,
-+ 0x0126, 0x2091, 0x8000, 0x7024, 0xa802, 0x2900, 0x7026, 0x012e,
-+ 0x0005, 0x0096, 0x9e80, 0x0009, 0x2004, 0x9005, 0x0138, 0x2048,
-+ 0xa800, 0x0006, 0x080c, 0x1040, 0x000e, 0x0cb8, 0x009e, 0x0005,
-+ 0x0096, 0x7008, 0x9005, 0x0138, 0x2048, 0xa800, 0x0006, 0x080c,
-+ 0x1040, 0x000e, 0x0cb8, 0x9006, 0x7002, 0x700a, 0x7006, 0x700e,
-+ 0x701a, 0x701e, 0x7022, 0x702a, 0x7026, 0x702e, 0x009e, 0x0005,
-+ 0x1a67, 0x0000, 0x0000, 0x0000, 0x1931, 0x0000, 0x0000, 0x0000,
-+ 0x1888, 0x0000, 0x0000, 0x0000, 0x1877, 0x0000, 0x0000, 0x0000,
-+ 0x00e6, 0x00c6, 0x00b6, 0x00a6, 0xa8a8, 0x2040, 0x2071, 0x1877,
-+ 0x080c, 0x904c, 0xa067, 0x0023, 0x6010, 0x905d, 0x0904, 0x9021,
-+ 0xb814, 0xa06e, 0xb910, 0xa172, 0xb9a0, 0xa176, 0x2001, 0x0003,
-+ 0xa07e, 0xa834, 0xa082, 0xa07b, 0x0000, 0xa898, 0x9005, 0x0118,
-+ 0xa078, 0xc085, 0xa07a, 0x2858, 0x2031, 0x0018, 0xa068, 0x908a,
-+ 0x0019, 0x1a0c, 0x0dc5, 0x2020, 0x2050, 0x2940, 0xa864, 0x90bc,
-+ 0x00ff, 0x908c, 0x000f, 0x91e0, 0x20c7, 0x2c65, 0x9786, 0x0024,
-+ 0x2c05, 0x1590, 0x908a, 0x0036, 0x1a0c, 0x0dc5, 0x9082, 0x001b,
-+ 0x0002, 0x8f8c, 0x8f8c, 0x8f8e, 0x8f8c, 0x8f8c, 0x8f8c, 0x8f90,
-+ 0x8f8c, 0x8f8c, 0x8f8c, 0x8f92, 0x8f8c, 0x8f8c, 0x8f8c, 0x8f94,
-+ 0x8f8c, 0x8f8c, 0x8f8c, 0x8f96, 0x8f8c, 0x8f8c, 0x8f8c, 0x8f98,
-+ 0x8f8c, 0x8f8c, 0x8f8c, 0x8f9a, 0x080c, 0x0dc5, 0xa180, 0x04b8,
-+ 0xa190, 0x04a8, 0xa1a0, 0x0498, 0xa1b0, 0x0488, 0xa1c0, 0x0478,
-+ 0xa1d0, 0x0468, 0xa1e0, 0x0458, 0x908a, 0x0034, 0x1a0c, 0x0dc5,
-+ 0x9082, 0x001b, 0x0002, 0x8fbe, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fbc,
-+ 0x8fbc, 0x8fc0, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fc2,
-+ 0x8fbc, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fbc, 0x8fc4, 0x8fbc, 0x8fbc,
-+ 0x8fbc, 0x8fbc, 0x8fbc, 0x8fc6, 0x080c, 0x0dc5, 0xa180, 0x0038,
-+ 0xa198, 0x0028, 0xa1b0, 0x0018, 0xa1c8, 0x0008, 0xa1e0, 0x2600,
-+ 0x0002, 0x8fe2, 0x8fe4, 0x8fe6, 0x8fe8, 0x8fea, 0x8fec, 0x8fee,
-+ 0x8ff0, 0x8ff2, 0x8ff4, 0x8ff6, 0x8ff8, 0x8ffa, 0x8ffc, 0x8ffe,
-+ 0x9000, 0x9002, 0x9004, 0x9006, 0x9008, 0x900a, 0x900c, 0x900e,
-+ 0x9010, 0x9012, 0x080c, 0x0dc5, 0xb9e2, 0x0468, 0xb9de, 0x0458,
-+ 0xb9da, 0x0448, 0xb9d6, 0x0438, 0xb9d2, 0x0428, 0xb9ce, 0x0418,
-+ 0xb9ca, 0x0408, 0xb9c6, 0x00f8, 0xb9c2, 0x00e8, 0xb9be, 0x00d8,
-+ 0xb9ba, 0x00c8, 0xb9b6, 0x00b8, 0xb9b2, 0x00a8, 0xb9ae, 0x0098,
-+ 0xb9aa, 0x0088, 0xb9a6, 0x0078, 0xb9a2, 0x0068, 0xb99e, 0x0058,
-+ 0xb99a, 0x0048, 0xb996, 0x0038, 0xb992, 0x0028, 0xb98e, 0x0018,
-+ 0xb98a, 0x0008, 0xb986, 0x8631, 0x8421, 0x0130, 0x080c, 0x207f,
-+ 0x090c, 0x0dc5, 0x0804, 0x8f66, 0x00ae, 0x00be, 0x00ce, 0x00ee,
-+ 0x0005, 0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006,
-+ 0x0804, 0x8f48, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810,
-+ 0x9005, 0x01b0, 0x2001, 0x1925, 0x2004, 0x9005, 0x0188, 0x2001,
-+ 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0,
-+ 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4c42, 0x004e, 0x003e,
-+ 0x00be, 0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a,
-+ 0xa936, 0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0230, 0x0128,
-+ 0x7010, 0x8210, 0x910a, 0x0208, 0x1de0, 0xaa8a, 0xa26a, 0x0005,
-+ 0x00f6, 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b, 0x0200, 0x7818,
-+ 0xd094, 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001, 0x7818, 0xd094,
-+ 0x1da0, 0xb8ac, 0x906d, 0x0198, 0x2079, 0x0000, 0x9c1e, 0x1118,
-+ 0x680c, 0xb8ae, 0x0050, 0x9c06, 0x0130, 0x2d78, 0x680c, 0x906d,
-+ 0x1dd0, 0x080c, 0x0dc5, 0x6b0c, 0x7b0e, 0x600f, 0x0000, 0x2079,
-+ 0x0300, 0x781b, 0x0200, 0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6,
-+ 0x00d6, 0x0096, 0x00c6, 0x0036, 0x0126, 0x2091, 0x8000, 0x0156,
-+ 0x20a9, 0x01ff, 0x2071, 0x0300, 0x701b, 0x0200, 0x7018, 0xd094,
-+ 0x0110, 0x1f04, 0x909c, 0x701b, 0x0202, 0xa001, 0xa001, 0x7018,
-+ 0xd094, 0x1d90, 0xb8ac, 0x9065, 0x01f0, 0x600c, 0xb8ae, 0x6024,
-+ 0xc08d, 0x6026, 0x6003, 0x0004, 0x601b, 0x0000, 0x6013, 0x0000,
-+ 0x601f, 0x0101, 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa88b, 0x0000,
-+ 0xa8a8, 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0dc5, 0x080c, 0x1040,
-+ 0x080c, 0x8c5a, 0x08f8, 0x2071, 0x0300, 0x701b, 0x0200, 0x015e,
-+ 0x012e, 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6,
-+ 0x00b6, 0x0016, 0x0006, 0x0156, 0x080c, 0x2873, 0x015e, 0x11b0,
-+ 0x080c, 0x66b2, 0x190c, 0x0dc5, 0x000e, 0x001e, 0xb912, 0xb816,
-+ 0x080c, 0xb276, 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001, 0x2009,
-+ 0x0001, 0x080c, 0xb34b, 0x00be, 0x00ce, 0x0005, 0x000e, 0x001e,
-+ 0x0cd0, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013,
-+ 0x006e, 0x0005, 0x9112, 0x9112, 0x9112, 0x9114, 0x9165, 0x9112,
-+ 0x9112, 0x9112, 0x91df, 0x9112, 0x921c, 0x9112, 0x9112, 0x9112,
-+ 0x9112, 0x9112, 0x080c, 0x0dc5, 0x9182, 0x0040, 0x0002, 0x9127,
-+ 0x9127, 0x9127, 0x9127, 0x9127, 0x9127, 0x9127, 0x9127, 0x9127,
-+ 0x9129, 0x913e, 0x9127, 0x9127, 0x9127, 0x9127, 0x9151, 0x080c,
-+ 0x0dc5, 0x0096, 0x080c, 0x9a5a, 0x080c, 0x9bcc, 0x6114, 0x2148,
-+ 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be,
-+ 0x080c, 0x6c9c, 0x080c, 0xb2cc, 0x009e, 0x0005, 0x080c, 0x9a5a,
-+ 0x00d6, 0x6114, 0x080c, 0xd0d1, 0x0130, 0x0096, 0x6114, 0x2148,
-+ 0x080c, 0x6e98, 0x009e, 0x00de, 0x080c, 0xb2cc, 0x080c, 0x9bcc,
-+ 0x0005, 0x080c, 0x9a5a, 0x080c, 0x3250, 0x6114, 0x0096, 0x2148,
-+ 0x080c, 0xd0d1, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6e98, 0x009e,
-+ 0x080c, 0xb2cc, 0x080c, 0x9bcc, 0x0005, 0x601b, 0x0000, 0x9182,
-+ 0x0040, 0x0096, 0x0002, 0x9180, 0x9180, 0x9180, 0x9180, 0x9180,
-+ 0x9180, 0x9180, 0x9180, 0x9182, 0x9180, 0x9180, 0x9180, 0x91db,
-+ 0x9180, 0x9180, 0x9180, 0x9180, 0x9180, 0x9180, 0x9189, 0x9180,
-+ 0x080c, 0x0dc5, 0x6114, 0x2148, 0xa938, 0x918e, 0xffff, 0x0904,
-+ 0x91db, 0x6024, 0xd08c, 0x15d8, 0x080c, 0x8d10, 0x05e0, 0x00e6,
-+ 0x6114, 0x2148, 0x080c, 0x8f30, 0x0096, 0xa8a8, 0x2048, 0x080c,
-+ 0x6c34, 0x009e, 0xa8ab, 0x0000, 0x6010, 0x9005, 0x0128, 0x00b6,
-+ 0x2058, 0x080c, 0x9060, 0x00be, 0xae88, 0x00b6, 0x2059, 0x0000,
-+ 0x080c, 0x8c63, 0x00be, 0x01e0, 0x2071, 0x193d, 0x080c, 0x8caa,
-+ 0x01b8, 0x9086, 0x0001, 0x1128, 0x2001, 0x1947, 0x2004, 0x9005,
-+ 0x1178, 0x0096, 0x080c, 0x100e, 0x2900, 0x009e, 0x0148, 0xa8aa,
-+ 0x00f6, 0x2c78, 0x080c, 0x8c21, 0x00fe, 0x00ee, 0x009e, 0x0005,
-+ 0x080c, 0x8c5a, 0x0cd0, 0x080c, 0x8d15, 0x1160, 0x6010, 0x9005,
-+ 0x0130, 0x2058, 0xb8ac, 0x9005, 0x190c, 0x0dc5, 0x6012, 0x2c00,
-+ 0x080c, 0x8cdb, 0x0005, 0x080c, 0x9289, 0x009e, 0x0005, 0x9182,
-+ 0x0040, 0x0096, 0x0002, 0x91f3, 0x91f3, 0x91f3, 0x91f5, 0x91f3,
-+ 0x91f3, 0x91f3, 0x921a, 0x91f3, 0x91f3, 0x91f3, 0x91f3, 0x91f3,
-+ 0x91f3, 0x91f3, 0x91f3, 0x080c, 0x0dc5, 0x6003, 0x0003, 0x6106,
-+ 0x6014, 0x2048, 0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0xa837, 0x0000,
-+ 0xa83b, 0x0000, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999,
-+ 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x2c10, 0x080c, 0x1be0,
-+ 0x080c, 0x955d, 0x0126, 0x2091, 0x8000, 0x080c, 0x9bcc, 0x012e,
-+ 0x009e, 0x0005, 0x080c, 0x0dc5, 0x080c, 0x9a5a, 0x080c, 0x9bcc,
-+ 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb,
-+ 0x0500, 0x00be, 0x080c, 0x6e98, 0x080c, 0xb2cc, 0x009e, 0x0005,
-+ 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0096, 0x0013, 0x009e,
-+ 0x0005, 0x9249, 0x9249, 0x9249, 0x924b, 0x925c, 0x9249, 0x9249,
-+ 0x9249, 0x9249, 0x9249, 0x9249, 0x9249, 0x9249, 0x9249, 0x9249,
-+ 0x9249, 0x080c, 0x0dc5, 0x080c, 0xac24, 0x6114, 0x2148, 0xa87b,
-+ 0x0006, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c,
-+ 0x6e98, 0x080c, 0xb2cc, 0x0005, 0x0461, 0x0005, 0x6000, 0x908a,
-+ 0x0010, 0x1a0c, 0x0dc5, 0x0096, 0x0013, 0x009e, 0x0005, 0x9277,
-+ 0x9277, 0x9277, 0x9279, 0x9289, 0x9277, 0x9277, 0x9277, 0x9277,
-+ 0x9277, 0x9277, 0x9277, 0x9277, 0x9277, 0x9277, 0x9277, 0x080c,
-+ 0x0dc5, 0x0036, 0x00e6, 0x2071, 0x19e8, 0x703c, 0x9c06, 0x1120,
-+ 0x2019, 0x0000, 0x080c, 0xaa42, 0x080c, 0xac24, 0x00ee, 0x003e,
-+ 0x0005, 0x6024, 0xd08c, 0x11f0, 0x00f6, 0x00e6, 0x601b, 0x0000,
-+ 0x6014, 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c,
-+ 0x9060, 0x00be, 0x2071, 0x193d, 0x080c, 0x8caa, 0x0160, 0x2001,
-+ 0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x8c21,
-+ 0x00ee, 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048,
-+ 0x080c, 0x1040, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8c5a, 0x0c80,
-+ 0x2001, 0x1925, 0x200c, 0x918e, 0x0000, 0x190c, 0x8d10, 0x05c8,
-+ 0x00e6, 0x2071, 0x1924, 0x7110, 0xc1c5, 0x7112, 0x080c, 0x8d1a,
-+ 0x00f6, 0x00c6, 0x2071, 0x1000, 0x00b6, 0x2e04, 0x905d, 0x0138,
-+ 0xb8ac, 0x9065, 0x0120, 0x080c, 0x8cf0, 0x090c, 0x908f, 0x8e70,
-+ 0x9e86, 0x1800, 0x1d90, 0x00be, 0x00d6, 0x0096, 0x0046, 0x2061,
-+ 0x1cd0, 0x2001, 0x181a, 0x2024, 0x6020, 0x9086, 0x0000, 0x1191,
-+ 0x9ce0, 0x0018, 0x2400, 0x9c06, 0x1db8, 0x004e, 0x009e, 0x00de,
-+ 0x00d1, 0x00ce, 0x00fe, 0x2071, 0x1924, 0x7110, 0xc1c4, 0x7112,
-+ 0x00ee, 0x0005, 0x6020, 0x9086, 0x0009, 0x1160, 0x6100, 0x9186,
-+ 0x0004, 0x1138, 0x6110, 0x81ff, 0x190c, 0x0dc5, 0x2c00, 0x080c,
-+ 0x8cdb, 0x9006, 0x0005, 0x2071, 0x193f, 0x2073, 0x0000, 0x8e70,
-+ 0x9e86, 0x1947, 0x1dd0, 0x2071, 0x193d, 0x7006, 0x7002, 0x2001,
-+ 0x1930, 0x2064, 0x8cff, 0x0130, 0x6120, 0x918e, 0x0000, 0x190c,
-+ 0x0dc5, 0x2102, 0x2001, 0x188a, 0x200c, 0x81ff, 0x0148, 0x0096,
-+ 0x2148, 0x080c, 0x1040, 0x009e, 0x2001, 0x188a, 0x2003, 0x0000,
-+ 0x2071, 0x1931, 0x080c, 0x8ef9, 0x0804, 0x8f08, 0x0000, 0x0000,
-+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x187a,
-+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0126, 0x2091,
-+ 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006, 0x8004, 0x2019,
-+ 0x0100, 0x231c, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020,
-+ 0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x1208, 0x9200, 0x1f04, 0x934f,
-+ 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020, 0x80f6, 0x3e00,
-+ 0x81f6, 0x3e08, 0x004e, 0x003e, 0x012e, 0x0005, 0x0126, 0x2091,
-+ 0x8000, 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005, 0x0510, 0x911a,
-+ 0x1600, 0x8213, 0x2039, 0x0100, 0x273c, 0x97be, 0x0008, 0x1110,
-+ 0x818d, 0x0010, 0x81f5, 0x3e08, 0x0228, 0x911a, 0x1220, 0x1f04,
-+ 0x9379, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04, 0x9379, 0x0006,
-+ 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e, 0x007e, 0x012e,
-+ 0x0005, 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8, 0x0126, 0x2091,
-+ 0x2800, 0x2079, 0x19e8, 0x012e, 0x00d6, 0x2069, 0x19e8, 0x6803,
-+ 0x0005, 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000, 0x2069, 0x0200,
-+ 0x080c, 0xaf87, 0x0401, 0x080c, 0xaf72, 0x00e9, 0x080c, 0xaf75,
-+ 0x00d1, 0x080c, 0xaf78, 0x00b9, 0x080c, 0xaf7b, 0x00a1, 0x080c,
-+ 0xaf7e, 0x0089, 0x080c, 0xaf81, 0x0071, 0x080c, 0xaf84, 0x0059,
-+ 0x01de, 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04, 0x9085, 0x8001,
-+ 0x206a, 0x00de, 0x0005, 0x20a9, 0x0020, 0x20a1, 0x0240, 0x2001,
-+ 0x0000, 0x4004, 0x0005, 0x00c6, 0x6027, 0x0001, 0x7804, 0x9084,
-+ 0x0007, 0x0002, 0x93ec, 0x9410, 0x9451, 0x93f2, 0x9410, 0x93ec,
-+ 0x93ea, 0x93ea, 0x080c, 0x0dc5, 0x080c, 0x88bc, 0x080c, 0x9aaa,
-+ 0x00ce, 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce, 0x0005, 0x2011,
-+ 0x5f90, 0x080c, 0x8836, 0x7828, 0x9092, 0x00c8, 0x1228, 0x8000,
-+ 0x782a, 0x080c, 0x5fd0, 0x0c88, 0x62c0, 0x080c, 0xb0c3, 0x080c,
-+ 0x5f90, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b, 0x0000, 0x0c28,
-+ 0x080c, 0x88bc, 0x6220, 0xd2a4, 0x0170, 0xd2cc, 0x0160, 0x782b,
- 0x0000, 0x7824, 0x9065, 0x090c, 0x0dc5, 0x2009, 0x0013, 0x080c,
-- 0xb3a4, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824, 0x9005,
-- 0x090c, 0x0dc5, 0x7828, 0x9092, 0xc350, 0x1648, 0x8000, 0x782a,
-- 0x00de, 0x00ce, 0x00be, 0x080c, 0x2bce, 0x02f0, 0x00b6, 0x00c6,
-- 0x00d6, 0x781c, 0x905d, 0x090c, 0x0dc5, 0xb800, 0xc0dc, 0xb802,
-- 0x7924, 0x2160, 0x080c, 0xb2d3, 0xb93c, 0x81ff, 0x090c, 0x0dc5,
-- 0x8109, 0xb93e, 0x7807, 0x0000, 0x7827, 0x0000, 0x00de, 0x00ce,
-- 0x00be, 0x080c, 0x9ab1, 0x0868, 0x080c, 0xa6c5, 0x0850, 0x2011,
-- 0x0130, 0x2214, 0x080c, 0xb0ca, 0x080c, 0xf094, 0x7824, 0x9065,
-- 0x2009, 0x0014, 0x080c, 0xb352, 0x00de, 0x00ce, 0x00be, 0x0804,
-- 0x9469, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c, 0x1eeb,
-- 0x6024, 0x6027, 0x0002, 0xd0f4, 0x15b8, 0x62c8, 0x60c4, 0x9205,
-- 0x1170, 0x783c, 0x9065, 0x0130, 0x2009, 0x0049, 0x080c, 0xb352,
-- 0x00ce, 0x0005, 0x2011, 0x1a07, 0x2013, 0x0000, 0x0cc8, 0x793c,
-- 0x81ff, 0x0dc0, 0x7944, 0x9192, 0x7530, 0x1628, 0x8108, 0x7946,
-- 0x793c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138, 0x6014,
-- 0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0c10, 0x793c, 0x9188,
-- 0x0008, 0x210c, 0x918e, 0x0009, 0x0d90, 0x6014, 0x9084, 0x1984,
-- 0x9085, 0x0016, 0x6016, 0x08a0, 0x793c, 0x2160, 0x2009, 0x004a,
-- 0x080c, 0xb352, 0x0868, 0x7848, 0xc085, 0x784a, 0x0848, 0x0006,
-- 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08,
-- 0x2061, 0x19e8, 0x6020, 0x8000, 0x6022, 0x6010, 0x9005, 0x0148,
-- 0x9080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce, 0x001e, 0x000e,
-- 0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069, 0x19e8, 0xb800,
-- 0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0x9086, 0x0001, 0x1110,
-- 0x2b00, 0x681e, 0x00de, 0x0804, 0x9ab1, 0x00de, 0x0005, 0xc0d5,
-- 0xb802, 0x6818, 0x9005, 0x0168, 0xb856, 0xb85b, 0x0000, 0x0086,
-- 0x0006, 0x2b00, 0x681a, 0x008e, 0xa05a, 0x008e, 0x2069, 0x19e8,
-- 0x0c08, 0xb856, 0xb85a, 0x2b00, 0x681a, 0x681e, 0x08d8, 0x0006,
-- 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08,
-- 0x2061, 0x19e8, 0x6020, 0x8000, 0x6022, 0x6008, 0x9005, 0x0148,
-- 0x9080, 0x0003, 0x2102, 0x610a, 0x012e, 0x00ce, 0x001e, 0x000e,
-- 0x0005, 0x610e, 0x610a, 0x0cc0, 0x00c6, 0x600f, 0x0000, 0x2c08,
-- 0x2061, 0x19e8, 0x6034, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102,
-- 0x6136, 0x00ce, 0x0005, 0x613a, 0x6136, 0x00ce, 0x0005, 0x00f6,
-- 0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066, 0x0056,
-- 0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071, 0x19e8,
-- 0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x95f3,
-- 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x95ee, 0x87ff, 0x0120,
-- 0x6054, 0x9106, 0x1904, 0x95ee, 0x703c, 0x9c06, 0x1178, 0x0036,
-- 0x2019, 0x0001, 0x080c, 0xaa49, 0x7033, 0x0000, 0x9006, 0x703e,
-- 0x7042, 0x7046, 0x704a, 0x003e, 0x2029, 0x0001, 0x7038, 0x9c36,
-- 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-- 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066,
-- 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-- 0x080c, 0xd0d8, 0x01f0, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003,
-- 0x15b8, 0x6004, 0x9086, 0x0040, 0x090c, 0xac1b, 0xa867, 0x0103,
-- 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0076, 0x080c, 0xd3ce,
-- 0x080c, 0xef85, 0x080c, 0x6e9f, 0x007e, 0x003e, 0x001e, 0x080c,
-- 0xd2c3, 0x080c, 0xb306, 0x00ce, 0x0804, 0x958d, 0x2c78, 0x600c,
-- 0x2060, 0x0804, 0x958d, 0x85ff, 0x0120, 0x0036, 0x080c, 0x9bd3,
-- 0x003e, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e, 0x005e, 0x006e,
-- 0x007e, 0x009e, 0x00be, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005,
-- 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0076, 0x080c,
-- 0xef85, 0x080c, 0xebd4, 0x007e, 0x003e, 0x001e, 0x0890, 0x6020,
-- 0x9086, 0x0009, 0x1168, 0xa87b, 0x0006, 0x0016, 0x0036, 0x0076,
-- 0x080c, 0x6e9f, 0x080c, 0xb2d3, 0x007e, 0x003e, 0x001e, 0x0818,
-- 0x6020, 0x9086, 0x000a, 0x0904, 0x95d8, 0x0804, 0x95d1, 0x0006,
-- 0x0066, 0x0096, 0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126, 0x2091,
-- 0x8000, 0x2079, 0x19e8, 0x7838, 0x9065, 0x0904, 0x9684, 0x600c,
-- 0x0006, 0x600f, 0x0000, 0x783c, 0x9c06, 0x1168, 0x0036, 0x2019,
-- 0x0001, 0x080c, 0xaa49, 0x7833, 0x0000, 0x901e, 0x7b3e, 0x7b42,
-- 0x7b46, 0x7b4a, 0x003e, 0x080c, 0xd0d8, 0x0548, 0x6014, 0x2048,
-- 0x6020, 0x9086, 0x0003, 0x1590, 0x3e08, 0x918e, 0x0002, 0x1188,
-- 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-- 0x0140, 0x6040, 0x9005, 0x11a8, 0x2001, 0x1988, 0x2004, 0x6042,
-- 0x0080, 0x6004, 0x9086, 0x0040, 0x090c, 0xac1b, 0xa867, 0x0103,
-- 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e92, 0x080c, 0xd2c3, 0x080c,
-- 0xb306, 0x000e, 0x0804, 0x963c, 0x7e3a, 0x7e36, 0x012e, 0x00fe,
-- 0x00de, 0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020, 0x9086,
-- 0x0006, 0x1118, 0x080c, 0xebd4, 0x0c50, 0x6020, 0x9086, 0x0009,
-- 0x1130, 0xab7a, 0x080c, 0x6e9f, 0x080c, 0xb2d3, 0x0c10, 0x6020,
-- 0x9086, 0x000a, 0x09a8, 0x0868, 0x0016, 0x0026, 0x0086, 0x9046,
-- 0x0099, 0x080c, 0x978f, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6,
-- 0x0126, 0x2079, 0x19e8, 0x2091, 0x8000, 0x080c, 0x9826, 0x080c,
-- 0x98b6, 0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x00e6,
-- 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006, 0x0126, 0x2091, 0x8000,
-- 0x2071, 0x19e8, 0x7614, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9754,
-- 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x974f, 0x88ff, 0x0120,
-- 0x6054, 0x9106, 0x1904, 0x974f, 0x7024, 0x9c06, 0x1568, 0x2069,
-- 0x0100, 0x6820, 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c, 0x88c3,
-- 0x080c, 0xa6e9, 0x68c3, 0x0000, 0x080c, 0xac1b, 0x7027, 0x0000,
-- 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
-- 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100,
-- 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0028, 0x6003,
-- 0x0009, 0x630a, 0x0804, 0x974f, 0x7014, 0x9c36, 0x1110, 0x660c,
-- 0x7616, 0x7010, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
-- 0x7012, 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-- 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048,
-- 0x080c, 0xd0d8, 0x01e8, 0x6020, 0x9086, 0x0003, 0x1580, 0x080c,
-- 0xd2e0, 0x1118, 0x080c, 0xbcb6, 0x0098, 0xa867, 0x0103, 0xab7a,
-- 0xa877, 0x0000, 0x0016, 0x0036, 0x0086, 0x080c, 0xd3ce, 0x080c,
-- 0xef85, 0x080c, 0x6e9f, 0x008e, 0x003e, 0x001e, 0x080c, 0xd2c3,
-- 0x080c, 0xb306, 0x080c, 0xaaf1, 0x00ce, 0x0804, 0x96cd, 0x2c78,
-- 0x600c, 0x2060, 0x0804, 0x96cd, 0x012e, 0x000e, 0x001e, 0x006e,
-- 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x00be, 0x0005, 0x6020,
-- 0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0086, 0x080c, 0xef85,
-- 0x080c, 0xebd4, 0x008e, 0x003e, 0x001e, 0x08d0, 0x080c, 0xbcb6,
-- 0x6020, 0x9086, 0x0002, 0x1160, 0x6004, 0x0006, 0x9086, 0x0085,
-- 0x000e, 0x0904, 0x9735, 0x9086, 0x008b, 0x0904, 0x9735, 0x0840,
-- 0x6020, 0x9086, 0x0005, 0x1920, 0x6004, 0x0006, 0x9086, 0x0085,
-- 0x000e, 0x09c8, 0x9086, 0x008b, 0x09b0, 0x0804, 0x9748, 0x00b6,
-- 0x00a6, 0x0096, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x9280,
-- 0x1000, 0x2004, 0x905d, 0x0904, 0x981f, 0x00f6, 0x00e6, 0x00d6,
-- 0x0066, 0x2071, 0x19e8, 0xbe54, 0x7018, 0x9b06, 0x1108, 0x761a,
-- 0x701c, 0x9b06, 0x1130, 0x86ff, 0x1118, 0x7018, 0x701e, 0x0008,
-- 0x761e, 0xb858, 0x904d, 0x0108, 0xae56, 0x96d5, 0x0000, 0x0110,
-- 0x2900, 0xb05a, 0xb857, 0x0000, 0xb85b, 0x0000, 0xb800, 0xc0d4,
-- 0xc0dc, 0xb802, 0x080c, 0x664c, 0x0904, 0x981b, 0x7624, 0x86ff,
-- 0x0904, 0x980a, 0x9680, 0x0005, 0x2004, 0x9906, 0x15d8, 0x00d6,
-- 0x2069, 0x0100, 0x68c0, 0x9005, 0x0560, 0x080c, 0x88c3, 0x080c,
-- 0xa6e9, 0x68c3, 0x0000, 0x080c, 0xac1b, 0x7027, 0x0000, 0x0036,
-- 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
-- 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100, 0x6824,
-- 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x00de, 0x00c6, 0xb83c,
-- 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0xb306, 0x00ce,
-- 0x0048, 0x00de, 0x00c6, 0x2660, 0x6003, 0x0009, 0x630a, 0x00ce,
-- 0x0804, 0x97c2, 0x89ff, 0x0158, 0xa867, 0x0103, 0xab7a, 0xa877,
-- 0x0000, 0x080c, 0xd3ce, 0x080c, 0xef85, 0x080c, 0x6e9f, 0x080c,
-- 0xaaf1, 0x0804, 0x97c2, 0x006e, 0x00de, 0x00ee, 0x00fe, 0x012e,
-- 0x000e, 0x00ce, 0x009e, 0x00ae, 0x00be, 0x0005, 0x0096, 0x0006,
-- 0x0066, 0x00c6, 0x00d6, 0x9036, 0x7814, 0x9065, 0x0904, 0x9889,
-- 0x600c, 0x0006, 0x600f, 0x0000, 0x7824, 0x9c06, 0x1580, 0x2069,
-- 0x0100, 0x6820, 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c, 0x88c3,
-- 0x080c, 0xa6e9, 0x68c3, 0x0000, 0x080c, 0xac1b, 0x7827, 0x0000,
-- 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
-- 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100,
-- 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040, 0x080c,
-- 0x6a3b, 0x1520, 0x6003, 0x0009, 0x630a, 0x2c30, 0x00f8, 0x6014,
-- 0x2048, 0x080c, 0xd0d6, 0x01b0, 0x6020, 0x9086, 0x0003, 0x1508,
-- 0x080c, 0xd2e0, 0x1118, 0x080c, 0xbcb6, 0x0060, 0x080c, 0x6a3b,
-- 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e9f,
-- 0x080c, 0xd2c3, 0x080c, 0xb306, 0x080c, 0xaaf1, 0x000e, 0x0804,
-- 0x982d, 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e, 0x000e, 0x009e,
-- 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xebd4, 0x0c50,
-- 0x080c, 0xbcb6, 0x6020, 0x9086, 0x0002, 0x1150, 0x6004, 0x0006,
-- 0x9086, 0x0085, 0x000e, 0x0990, 0x9086, 0x008b, 0x0978, 0x08d0,
-- 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004, 0x0006, 0x9086, 0x0085,
-- 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00, 0x0860, 0x0006, 0x0066,
-- 0x0096, 0x00b6, 0x00c6, 0x00d6, 0x7818, 0x905d, 0x0904, 0x9936,
-- 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a, 0xb800, 0xc0d4, 0xc0dc,
-- 0xb802, 0x080c, 0x664c, 0x0904, 0x9933, 0x7e24, 0x86ff, 0x0904,
-- 0x9926, 0x9680, 0x0005, 0x2004, 0x9906, 0x1904, 0x9926, 0x00d6,
-- 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x991d, 0x080c, 0x88c3,
-- 0x080c, 0xa6e9, 0x68c3, 0x0000, 0x080c, 0xac1b, 0x7827, 0x0000,
-+ 0xb34b, 0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0dc5,
-+ 0x7828, 0x9092, 0xc350, 0x12c0, 0x8000, 0x782a, 0x00ce, 0x080c,
-+ 0x2bce, 0x0278, 0x00c6, 0x7924, 0x2160, 0x6010, 0x906d, 0x090c,
-+ 0x0dc5, 0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x9aaa,
-+ 0x0c00, 0x080c, 0xa6be, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c,
-+ 0xb0c3, 0x080c, 0xf08d, 0x2009, 0x0014, 0x080c, 0xb34b, 0x00ce,
-+ 0x0880, 0x2001, 0x1a04, 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160,
-+ 0x782b, 0x0000, 0x7824, 0x9065, 0x090c, 0x0dc5, 0x2009, 0x0013,
-+ 0x080c, 0xb39d, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824,
-+ 0x9005, 0x090c, 0x0dc5, 0x7828, 0x9092, 0xc350, 0x1648, 0x8000,
-+ 0x782a, 0x00de, 0x00ce, 0x00be, 0x080c, 0x2bce, 0x02f0, 0x00b6,
-+ 0x00c6, 0x00d6, 0x781c, 0x905d, 0x090c, 0x0dc5, 0xb800, 0xc0dc,
-+ 0xb802, 0x7924, 0x2160, 0x080c, 0xb2cc, 0xb93c, 0x81ff, 0x090c,
-+ 0x0dc5, 0x8109, 0xb93e, 0x7807, 0x0000, 0x7827, 0x0000, 0x00de,
-+ 0x00ce, 0x00be, 0x080c, 0x9aaa, 0x0868, 0x080c, 0xa6be, 0x0850,
-+ 0x2011, 0x0130, 0x2214, 0x080c, 0xb0c3, 0x080c, 0xf08d, 0x7824,
-+ 0x9065, 0x2009, 0x0014, 0x080c, 0xb34b, 0x00de, 0x00ce, 0x00be,
-+ 0x0804, 0x9462, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c,
-+ 0x1eeb, 0x6024, 0x6027, 0x0002, 0xd0f4, 0x15b8, 0x62c8, 0x60c4,
-+ 0x9205, 0x1170, 0x783c, 0x9065, 0x0130, 0x2009, 0x0049, 0x080c,
-+ 0xb34b, 0x00ce, 0x0005, 0x2011, 0x1a07, 0x2013, 0x0000, 0x0cc8,
-+ 0x793c, 0x81ff, 0x0dc0, 0x7944, 0x9192, 0x7530, 0x1628, 0x8108,
-+ 0x7946, 0x793c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138,
-+ 0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0c10, 0x793c,
-+ 0x9188, 0x0008, 0x210c, 0x918e, 0x0009, 0x0d90, 0x6014, 0x9084,
-+ 0x1984, 0x9085, 0x0016, 0x6016, 0x08a0, 0x793c, 0x2160, 0x2009,
-+ 0x004a, 0x080c, 0xb34b, 0x0868, 0x7848, 0xc085, 0x784a, 0x0848,
-+ 0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000,
-+ 0x2c08, 0x2061, 0x19e8, 0x6020, 0x8000, 0x6022, 0x6010, 0x9005,
-+ 0x0148, 0x9080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce, 0x001e,
-+ 0x000e, 0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069, 0x19e8,
-+ 0xb800, 0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0x9086, 0x0001,
-+ 0x1110, 0x2b00, 0x681e, 0x00de, 0x0804, 0x9aaa, 0x00de, 0x0005,
-+ 0xc0d5, 0xb802, 0x6818, 0x9005, 0x0168, 0xb856, 0xb85b, 0x0000,
-+ 0x0086, 0x0006, 0x2b00, 0x681a, 0x008e, 0xa05a, 0x008e, 0x2069,
-+ 0x19e8, 0x0c08, 0xb856, 0xb85a, 0x2b00, 0x681a, 0x681e, 0x08d8,
-+ 0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000,
-+ 0x2c08, 0x2061, 0x19e8, 0x6020, 0x8000, 0x6022, 0x6008, 0x9005,
-+ 0x0148, 0x9080, 0x0003, 0x2102, 0x610a, 0x012e, 0x00ce, 0x001e,
-+ 0x000e, 0x0005, 0x610e, 0x610a, 0x0cc0, 0x00c6, 0x600f, 0x0000,
-+ 0x2c08, 0x2061, 0x19e8, 0x6034, 0x9005, 0x0130, 0x9080, 0x0003,
-+ 0x2102, 0x6136, 0x00ce, 0x0005, 0x613a, 0x6136, 0x00ce, 0x0005,
-+ 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066,
-+ 0x0056, 0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071,
-+ 0x19e8, 0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904,
-+ 0x95ec, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x95e7, 0x87ff,
-+ 0x0120, 0x6054, 0x9106, 0x1904, 0x95e7, 0x703c, 0x9c06, 0x1178,
-+ 0x0036, 0x2019, 0x0001, 0x080c, 0xaa42, 0x7033, 0x0000, 0x9006,
-+ 0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x2029, 0x0001, 0x7038,
-+ 0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00,
-+ 0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c,
-+ 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-+ 0x0000, 0x080c, 0xd0d1, 0x01f0, 0x6014, 0x2048, 0x6020, 0x9086,
-+ 0x0003, 0x15b8, 0x6004, 0x9086, 0x0040, 0x090c, 0xac14, 0xa867,
-+ 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0076, 0x080c,
-+ 0xd3c7, 0x080c, 0xef7e, 0x080c, 0x6e98, 0x007e, 0x003e, 0x001e,
-+ 0x080c, 0xd2bc, 0x080c, 0xb2ff, 0x00ce, 0x0804, 0x9586, 0x2c78,
-+ 0x600c, 0x2060, 0x0804, 0x9586, 0x85ff, 0x0120, 0x0036, 0x080c,
-+ 0x9bcc, 0x003e, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e, 0x005e,
-+ 0x006e, 0x007e, 0x009e, 0x00be, 0x00ce, 0x00de, 0x00ee, 0x00fe,
-+ 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0076,
-+ 0x080c, 0xef7e, 0x080c, 0xebcd, 0x007e, 0x003e, 0x001e, 0x0890,
-+ 0x6020, 0x9086, 0x0009, 0x1168, 0xa87b, 0x0006, 0x0016, 0x0036,
-+ 0x0076, 0x080c, 0x6e98, 0x080c, 0xb2cc, 0x007e, 0x003e, 0x001e,
-+ 0x0818, 0x6020, 0x9086, 0x000a, 0x0904, 0x95d1, 0x0804, 0x95ca,
-+ 0x0006, 0x0066, 0x0096, 0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126,
-+ 0x2091, 0x8000, 0x2079, 0x19e8, 0x7838, 0x9065, 0x0904, 0x967d,
-+ 0x600c, 0x0006, 0x600f, 0x0000, 0x783c, 0x9c06, 0x1168, 0x0036,
-+ 0x2019, 0x0001, 0x080c, 0xaa42, 0x7833, 0x0000, 0x901e, 0x7b3e,
-+ 0x7b42, 0x7b46, 0x7b4a, 0x003e, 0x080c, 0xd0d1, 0x0548, 0x6014,
-+ 0x2048, 0x6020, 0x9086, 0x0003, 0x1590, 0x3e08, 0x918e, 0x0002,
-+ 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058, 0xb800, 0x00be,
-+ 0xd0bc, 0x0140, 0x6040, 0x9005, 0x11a8, 0x2001, 0x1988, 0x2004,
-+ 0x6042, 0x0080, 0x6004, 0x9086, 0x0040, 0x090c, 0xac14, 0xa867,
-+ 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e8b, 0x080c, 0xd2bc,
-+ 0x080c, 0xb2ff, 0x000e, 0x0804, 0x9635, 0x7e3a, 0x7e36, 0x012e,
-+ 0x00fe, 0x00de, 0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020,
-+ 0x9086, 0x0006, 0x1118, 0x080c, 0xebcd, 0x0c50, 0x6020, 0x9086,
-+ 0x0009, 0x1130, 0xab7a, 0x080c, 0x6e98, 0x080c, 0xb2cc, 0x0c10,
-+ 0x6020, 0x9086, 0x000a, 0x09a8, 0x0868, 0x0016, 0x0026, 0x0086,
-+ 0x9046, 0x0099, 0x080c, 0x9788, 0x008e, 0x002e, 0x001e, 0x0005,
-+ 0x00f6, 0x0126, 0x2079, 0x19e8, 0x2091, 0x8000, 0x080c, 0x981f,
-+ 0x080c, 0x98af, 0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6,
-+ 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006, 0x0126, 0x2091,
-+ 0x8000, 0x2071, 0x19e8, 0x7614, 0x2660, 0x2678, 0x8cff, 0x0904,
-+ 0x974d, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x9748, 0x88ff,
-+ 0x0120, 0x6054, 0x9106, 0x1904, 0x9748, 0x7024, 0x9c06, 0x1568,
-+ 0x2069, 0x0100, 0x6820, 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c,
-+ 0x88bc, 0x080c, 0xa6e2, 0x68c3, 0x0000, 0x080c, 0xac14, 0x7027,
-+ 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
-+ 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069,
-+ 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0028,
-+ 0x6003, 0x0009, 0x630a, 0x0804, 0x9748, 0x7014, 0x9c36, 0x1110,
-+ 0x660c, 0x7616, 0x7010, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
-+ 0x2f00, 0x7012, 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00,
-+ 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014,
-+ 0x2048, 0x080c, 0xd0d1, 0x01e8, 0x6020, 0x9086, 0x0003, 0x1580,
-+ 0x080c, 0xd2d9, 0x1118, 0x080c, 0xbcaf, 0x0098, 0xa867, 0x0103,
-+ 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0086, 0x080c, 0xd3c7,
-+ 0x080c, 0xef7e, 0x080c, 0x6e98, 0x008e, 0x003e, 0x001e, 0x080c,
-+ 0xd2bc, 0x080c, 0xb2ff, 0x080c, 0xaaea, 0x00ce, 0x0804, 0x96c6,
-+ 0x2c78, 0x600c, 0x2060, 0x0804, 0x96c6, 0x012e, 0x000e, 0x001e,
-+ 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x00be, 0x0005,
-+ 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0086, 0x080c,
-+ 0xef7e, 0x080c, 0xebcd, 0x008e, 0x003e, 0x001e, 0x08d0, 0x080c,
-+ 0xbcaf, 0x6020, 0x9086, 0x0002, 0x1160, 0x6004, 0x0006, 0x9086,
-+ 0x0085, 0x000e, 0x0904, 0x972e, 0x9086, 0x008b, 0x0904, 0x972e,
-+ 0x0840, 0x6020, 0x9086, 0x0005, 0x1920, 0x6004, 0x0006, 0x9086,
-+ 0x0085, 0x000e, 0x09c8, 0x9086, 0x008b, 0x09b0, 0x0804, 0x9741,
-+ 0x00b6, 0x00a6, 0x0096, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000,
-+ 0x9280, 0x1000, 0x2004, 0x905d, 0x0904, 0x9818, 0x00f6, 0x00e6,
-+ 0x00d6, 0x0066, 0x2071, 0x19e8, 0xbe54, 0x7018, 0x9b06, 0x1108,
-+ 0x761a, 0x701c, 0x9b06, 0x1130, 0x86ff, 0x1118, 0x7018, 0x701e,
-+ 0x0008, 0x761e, 0xb858, 0x904d, 0x0108, 0xae56, 0x96d5, 0x0000,
-+ 0x0110, 0x2900, 0xb05a, 0xb857, 0x0000, 0xb85b, 0x0000, 0xb800,
-+ 0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x6645, 0x0904, 0x9814, 0x7624,
-+ 0x86ff, 0x0904, 0x9803, 0x9680, 0x0005, 0x2004, 0x9906, 0x15d8,
-+ 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0560, 0x080c, 0x88bc,
-+ 0x080c, 0xa6e2, 0x68c3, 0x0000, 0x080c, 0xac14, 0x7027, 0x0000,
- 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
- 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100,
- 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x00de, 0x00c6,
-- 0x3e08, 0x918e, 0x0002, 0x1168, 0xb800, 0xd0bc, 0x0150, 0x9680,
-- 0x0010, 0x200c, 0x81ff, 0x1518, 0x2009, 0x1988, 0x210c, 0x2102,
-- 0x00f0, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x600f,
-- 0x0000, 0x080c, 0xb306, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660,
-- 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x98c9, 0x89ff, 0x0138,
-- 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e9f, 0x080c,
-- 0xaaf1, 0x0804, 0x98c9, 0x000e, 0x0804, 0x98bd, 0x781e, 0x781a,
-- 0x00de, 0x00ce, 0x00be, 0x009e, 0x006e, 0x000e, 0x0005, 0x00e6,
-- 0x00d6, 0x0096, 0x0066, 0xb800, 0xd0dc, 0x01a0, 0xb84c, 0x904d,
-- 0x0188, 0xa878, 0x9606, 0x1170, 0x2071, 0x19e8, 0x7024, 0x9035,
-- 0x0148, 0x9080, 0x0005, 0x2004, 0x9906, 0x1120, 0xb800, 0xc0dc,
-- 0xb802, 0x0029, 0x006e, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00f6,
-- 0x2079, 0x0100, 0x78c0, 0x9005, 0x1138, 0x00c6, 0x2660, 0x6003,
-- 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c, 0xa6e9, 0x78c3, 0x0000,
-- 0x080c, 0xac1b, 0x7027, 0x0000, 0x0036, 0x2079, 0x0140, 0x7b04,
-- 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006,
-- 0x080c, 0x2d39, 0x2079, 0x0100, 0x7824, 0xd084, 0x0110, 0x7827,
-- 0x0001, 0x080c, 0xac1b, 0x003e, 0x080c, 0x664c, 0x00c6, 0xb83c,
-- 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0xb2d3, 0x00ce,
-- 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd3ce, 0x080c,
-- 0x6e9f, 0x080c, 0xaaf1, 0x00fe, 0x0005, 0x00b6, 0x00e6, 0x00c6,
-- 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x2001, 0x180c, 0x2014,
-- 0xc2e4, 0x2202, 0x2071, 0x19e8, 0x7004, 0x9084, 0x0007, 0x0002,
-- 0x99c2, 0x99c6, 0x99e4, 0x9a0d, 0x9a4b, 0x99c2, 0x99dd, 0x99c0,
-- 0x080c, 0x0dc5, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024, 0x9065,
-- 0x0148, 0x7020, 0x8001, 0x7022, 0x600c, 0x9015, 0x0158, 0x7216,
-- 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000, 0x00ce, 0x00ee,
-- 0x00be, 0x0005, 0x7216, 0x7212, 0x0ca8, 0x7007, 0x0000, 0x7027,
-- 0x0000, 0x7020, 0x9005, 0x0070, 0x6010, 0x2058, 0x080c, 0x664c,
-- 0xb800, 0xc0dc, 0xb802, 0x7007, 0x0000, 0x7027, 0x0000, 0x7020,
-- 0x8001, 0x7022, 0x1148, 0x2001, 0x180c, 0x2014, 0xd2ec, 0x1180,
-- 0x00ce, 0x00ee, 0x00be, 0x0005, 0xb854, 0x9015, 0x0120, 0x721e,
-- 0x080c, 0x9ab1, 0x0ca8, 0x7218, 0x721e, 0x080c, 0x9ab1, 0x0c80,
-- 0xc2ec, 0x2202, 0x080c, 0x9bd3, 0x0c58, 0x7024, 0x9065, 0x05b8,
-- 0x700c, 0x9c06, 0x1160, 0x080c, 0xaaf1, 0x600c, 0x9015, 0x0120,
-- 0x720e, 0x600f, 0x0000, 0x0448, 0x720e, 0x720a, 0x0430, 0x7014,
-- 0x9c06, 0x1160, 0x080c, 0xaaf1, 0x600c, 0x9015, 0x0120, 0x7216,
-- 0x600f, 0x0000, 0x00d0, 0x7216, 0x7212, 0x00b8, 0x6020, 0x9086,
-- 0x0003, 0x1198, 0x6010, 0x2058, 0x080c, 0x664c, 0xb800, 0xc0dc,
-- 0xb802, 0x080c, 0xaaf1, 0x701c, 0x9065, 0x0138, 0xb854, 0x9015,
-- 0x0110, 0x721e, 0x0010, 0x7218, 0x721e, 0x7027, 0x0000, 0x00ce,
-- 0x00ee, 0x00be, 0x0005, 0x7024, 0x9065, 0x0140, 0x080c, 0xaaf1,
-- 0x600c, 0x9015, 0x0158, 0x720e, 0x600f, 0x0000, 0x080c, 0xac1b,
-- 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x720e, 0x720a,
-- 0x0ca8, 0x00d6, 0x2069, 0x19e8, 0x6830, 0x9084, 0x0003, 0x0002,
-- 0x9a6e, 0x9a70, 0x9a94, 0x9a6c, 0x080c, 0x0dc5, 0x00de, 0x0005,
-- 0x00c6, 0x6840, 0x9086, 0x0001, 0x01b8, 0x683c, 0x9065, 0x0130,
-- 0x600c, 0x9015, 0x0170, 0x6a3a, 0x600f, 0x0000, 0x6833, 0x0000,
-- 0x683f, 0x0000, 0x2011, 0x1a07, 0x2013, 0x0000, 0x00ce, 0x00de,
-- 0x0005, 0x683a, 0x6836, 0x0c90, 0x6843, 0x0000, 0x6838, 0x9065,
-- 0x0d68, 0x6003, 0x0003, 0x0c50, 0x00c6, 0x9006, 0x6842, 0x6846,
-- 0x684a, 0x683c, 0x9065, 0x0160, 0x600c, 0x9015, 0x0130, 0x6a3a,
-- 0x600f, 0x0000, 0x683f, 0x0000, 0x0018, 0x683e, 0x683a, 0x6836,
-- 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c, 0x200c, 0xc1e5, 0x2102,
-- 0x0005, 0x2001, 0x180c, 0x200c, 0xd1ec, 0x0120, 0xc1ec, 0x2102,
-- 0x080c, 0x9bd3, 0x2001, 0x19f4, 0x2004, 0x9086, 0x0001, 0x0d58,
-- 0x00d6, 0x2069, 0x19e8, 0x6804, 0x9084, 0x0007, 0x0006, 0x9005,
-- 0x11c8, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1198, 0x2001,
-- 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0168, 0x2001, 0x188b, 0x2004,
-- 0xd08c, 0x1118, 0xd084, 0x1118, 0x0028, 0x080c, 0x9bd3, 0x000e,
-- 0x00de, 0x0005, 0x000e, 0x0002, 0x9aee, 0x9ba7, 0x9ba7, 0x9ba7,
-- 0x9ba7, 0x9ba9, 0x9ba7, 0x9aec, 0x080c, 0x0dc5, 0x6820, 0x9005,
-- 0x1110, 0x00de, 0x0005, 0x00c6, 0x680c, 0x9065, 0x01f0, 0x6104,
-- 0x918e, 0x0040, 0x1180, 0x2009, 0x1837, 0x210c, 0x918c, 0x0028,
-- 0x1150, 0x080c, 0x7637, 0x0138, 0x0006, 0x2009, 0x188b, 0x2104,
-- 0xc095, 0x200a, 0x000e, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000,
-- 0x080c, 0x9c7c, 0x00ce, 0x00de, 0x0005, 0x6814, 0x9065, 0x0150,
-- 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x9c7c, 0x00ce,
-- 0x00de, 0x0005, 0x00b6, 0x00e6, 0x6a1c, 0x92dd, 0x0000, 0x0904,
-- 0x9b91, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005, 0x01a0, 0xb854,
-- 0x905d, 0x0120, 0x920e, 0x0904, 0x9b91, 0x0028, 0x6818, 0x920e,
-- 0x0904, 0x9b91, 0x2058, 0xb84c, 0x900d, 0x0d88, 0xb888, 0x9005,
-- 0x1d70, 0x2b00, 0x681e, 0xbb3c, 0xb838, 0x9302, 0x1e40, 0x080c,
-- 0xb2aa, 0x0904, 0x9b91, 0x8318, 0xbb3e, 0x6116, 0x2b10, 0x6212,
-- 0x0096, 0x2148, 0xa880, 0x9084, 0x00ff, 0x605e, 0xa883, 0x0000,
-- 0xa884, 0x009e, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
-- 0x801b, 0x831b, 0x9318, 0x631a, 0x6114, 0x0096, 0x2148, 0xa964,
-- 0x009e, 0x918c, 0x00ff, 0x918e, 0x0048, 0x0538, 0x00f6, 0x2c78,
-- 0x2061, 0x0100, 0xbac0, 0x629a, 0x2069, 0x0200, 0x2071, 0x0240,
-- 0x080c, 0xa219, 0x2069, 0x19e8, 0xbb00, 0xc3dd, 0xbb02, 0x6807,
-- 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x7823, 0x0003, 0x7803,
-- 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00be, 0x00ce, 0x00de,
-- 0x0005, 0x00ee, 0x00be, 0x00ce, 0x0cd0, 0x6807, 0x0006, 0x2c18,
-- 0x6b26, 0x6820, 0x8001, 0x6822, 0x682b, 0x0000, 0x080c, 0x664c,
-- 0x080c, 0xb0ea, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005, 0x00de,
-- 0x0005, 0x00c6, 0x680c, 0x9065, 0x01d8, 0x6104, 0x918e, 0x0040,
-- 0x1180, 0x2009, 0x1837, 0x210c, 0x918c, 0x0028, 0x1150, 0x080c,
-- 0x7637, 0x0138, 0x0006, 0x2009, 0x188b, 0x2104, 0xc095, 0x200a,
-- 0x000e, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000, 0x080c, 0x9c7c,
-- 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c, 0x2014, 0xc2ed, 0x2202,
-- 0x00de, 0x00fe, 0x0005, 0x00f6, 0x00d6, 0x2069, 0x19e8, 0x6830,
-- 0x9086, 0x0000, 0x1570, 0x2001, 0x180c, 0x2014, 0xd2e4, 0x0130,
-- 0xc2e4, 0x2202, 0x080c, 0x9ac0, 0x2069, 0x19e8, 0x2001, 0x180c,
-- 0x200c, 0xd1c4, 0x1508, 0x6838, 0x907d, 0x01d8, 0x6a04, 0x9296,
-- 0x0000, 0x1904, 0x9c70, 0x7920, 0x918e, 0x0009, 0x0568, 0x6833,
-- 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000, 0x0126, 0x00f6,
-- 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x1158, 0x012e, 0x080c,
-- 0xa546, 0x00de, 0x00fe, 0x0005, 0xc1c4, 0x2102, 0x080c, 0x76e4,
-- 0x08d0, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002, 0x780c, 0x9015,
-- 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000, 0x683f, 0x0000,
-- 0x0c40, 0x683a, 0x6836, 0x0cc0, 0x7908, 0xd1fc, 0x1198, 0x6833,
-- 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000, 0x0126, 0x00f6,
-- 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x19d8, 0x012e, 0x080c,
-- 0xa4c7, 0x0878, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1188,
-- 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0158, 0x2001, 0x19e9,
-- 0x2004, 0x9005, 0x11f0, 0x2001, 0x188b, 0x200c, 0xc185, 0xc18c,
-- 0x2102, 0x2f00, 0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x684b,
-- 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79,
-- 0x1904, 0x9c11, 0x012e, 0x6a3c, 0x2278, 0x080c, 0xa451, 0x0804,
-- 0x9c09, 0x2011, 0x188b, 0x2204, 0xc08d, 0x2012, 0x0804, 0x9c09,
-- 0x6a04, 0x9296, 0x0006, 0x1904, 0x9bcb, 0x6a30, 0x9296, 0x0000,
-- 0x0904, 0x9bf3, 0x0804, 0x9bcb, 0x6020, 0x9084, 0x000f, 0x000b,
-- 0x0005, 0x9c90, 0x9c95, 0xa149, 0xa1e2, 0x9c95, 0xa149, 0xa1e2,
-- 0x9c90, 0x9c95, 0x9c90, 0x9c90, 0x9c90, 0x9c90, 0x9c90, 0x9c90,
-- 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x0005, 0x00b6, 0x0156, 0x0136,
-- 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069,
-- 0x0200, 0x2071, 0x0240, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dc5,
-- 0x6110, 0x2158, 0xb9c0, 0x2c78, 0x2061, 0x0100, 0x619a, 0x908a,
-- 0x0040, 0x1a04, 0x9d01, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-- 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x9eaa,
-- 0x9ee5, 0x9f0e, 0x9fd8, 0x9ffa, 0xa000, 0xa00d, 0xa015, 0xa021,
-- 0xa027, 0xa038, 0xa027, 0xa090, 0xa015, 0xa09c, 0xa0a2, 0xa021,
-- 0xa0a2, 0xa0ae, 0x9cff, 0x9cff, 0x9cff, 0x9cff, 0x9cff, 0x9cff,
-- 0x9cff, 0x9cff, 0x9cff, 0x9cff, 0x9cff, 0xa900, 0xa923, 0xa934,
-- 0xa954, 0xa986, 0xa00d, 0x9cff, 0xa00d, 0xa027, 0x9cff, 0x9f0e,
-- 0x9fd8, 0x9cff, 0xad12, 0xa027, 0x9cff, 0xad2e, 0xa027, 0x9cff,
-- 0xa021, 0x9ea4, 0x9d22, 0x9cff, 0xad4a, 0xadb7, 0xae92, 0x9cff,
-- 0xae9f, 0xa00a, 0xaeca, 0x9cff, 0xa990, 0xaef7, 0x9cff, 0x080c,
-- 0x0dc5, 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de,
-- 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0xaf92, 0xb044,
-- 0x9d20, 0x9d5a, 0x9e06, 0x9e11, 0x9d20, 0xa00d, 0x9d20, 0x9e6b,
-- 0x9e77, 0x9d75, 0x9d20, 0x9d90, 0x9dc4, 0xb1b1, 0xb1f6, 0xa027,
-- 0x080c, 0x0dc5, 0x00d6, 0x0096, 0x080c, 0xa0c1, 0x0026, 0x0036,
-- 0x7814, 0x2048, 0xa958, 0xd1cc, 0x1138, 0x2009, 0x2414, 0x2011,
-- 0x0018, 0x2019, 0x0018, 0x0030, 0x2009, 0x2410, 0x2011, 0x0014,
-- 0x2019, 0x0014, 0x7102, 0x7206, 0x700b, 0x0800, 0xa83c, 0x700e,
-- 0xa850, 0x7022, 0xa854, 0x7026, 0x63c2, 0x080c, 0xa6bd, 0x003e,
-- 0x002e, 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb8a0,
-- 0x00be, 0x080c, 0xb23d, 0x1118, 0x9084, 0xff80, 0x0110, 0x9085,
-- 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c, 0xa0c1, 0x7003, 0x0500,
-- 0x7814, 0x2048, 0xa874, 0x700a, 0xa878, 0x700e, 0xa87c, 0x7012,
-- 0xa880, 0x7016, 0xa884, 0x701a, 0xa888, 0x701e, 0x60c3, 0x0010,
-- 0x080c, 0xa6bd, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x080c,
-- 0xa0c1, 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a, 0xa8d0,
-- 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc, 0x701a, 0xa8e0,
-- 0x701e, 0x60c3, 0x0010, 0x080c, 0xa6bd, 0x009e, 0x00de, 0x0005,
-- 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0xa0c1, 0x20e9,
-- 0x0000, 0x2001, 0x19a4, 0x2003, 0x0000, 0x7814, 0x2048, 0xa814,
-- 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x001b, 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x2001, 0x0001,
-- 0x080c, 0x23ee, 0x080c, 0xde7c, 0x9006, 0x080c, 0x23ee, 0x001e,
-- 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c, 0xa6bd,
-- 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xa10c, 0x20e9, 0x0000, 0x2001, 0x19a4, 0x2003,
-- 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200, 0xa873, 0x0000, 0xa814,
-- 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x001b, 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x080c, 0xde7c,
-- 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051, 0x7814,
-- 0x2048, 0x080c, 0x0fc0, 0x080c, 0xa6bd, 0x012e, 0x009e, 0x00de,
-- 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003, 0x9005, 0x0130, 0x9082,
-- 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c, 0xa0c1,
-- 0x7003, 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008, 0x0804,
-- 0xa6bd, 0x00d6, 0x00e6, 0x080c, 0xa10c, 0x7814, 0x9084, 0xff00,
-- 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9096, 0xdf00, 0x0138, 0x9096,
-- 0xe000, 0x0120, 0x2073, 0x0010, 0x8e70, 0x0030, 0x9095, 0x0010,
-- 0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805, 0x20a9,
-- 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9e31, 0x2069, 0x1801,
-- 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9e3a, 0x9096,
-- 0xdf00, 0x0130, 0x9096, 0xe000, 0x0118, 0x60c3, 0x0018, 0x00f0,
-- 0x2069, 0x19b4, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19ce, 0x20a9,
-- 0x001a, 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010,
-- 0x8000, 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072,
-- 0x8d68, 0x8e70, 0x1f04, 0x9e51, 0x60c3, 0x004c, 0x080c, 0xa6bd,
-- 0x00ee, 0x00de, 0x0005, 0x080c, 0xa0c1, 0x7003, 0x6300, 0x7007,
-- 0x0028, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6bd, 0x00d6,
-- 0x0026, 0x0016, 0x080c, 0xa10c, 0x7003, 0x0200, 0x7814, 0x700e,
-- 0x00e6, 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2069,
-- 0x1924, 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70, 0x2073,
-- 0x0000, 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800, 0x8e70,
-- 0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0xa6bd,
-- 0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004, 0x609a,
-- 0x0804, 0xa6bd, 0x080c, 0xa0c1, 0x7003, 0x5200, 0x2069, 0x1847,
-- 0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x28a6, 0x710e,
-- 0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
-- 0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
-- 0x20a1, 0x0254, 0x4003, 0x080c, 0xb23d, 0x1120, 0xb8a0, 0x9082,
-- 0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001, 0x1820,
-- 0x2004, 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
-- 0x7036, 0x60c3, 0x001c, 0x0804, 0xa6bd, 0x080c, 0xa0c1, 0x7003,
-- 0x0500, 0x080c, 0xb23d, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
-- 0x2001, 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004, 0x700e,
-- 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9,
-- 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
-- 0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0xa6bd, 0x080c, 0xa0c1,
-- 0x9006, 0x080c, 0x6a6d, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2011,
-- 0x0240, 0x2013, 0x22ff, 0x2011, 0x0241, 0x2013, 0xfffe, 0x7003,
-- 0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d,
-- 0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300,
-- 0xb8a0, 0x9086, 0x007e, 0x1904, 0x9f98, 0x00d6, 0x2069, 0x196c,
-- 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a, 0x6808,
-- 0x9084, 0x2000, 0x7012, 0x080c, 0xb254, 0x680c, 0x7016, 0x701f,
-- 0x2710, 0x6818, 0x7022, 0x681c, 0x7026, 0x0428, 0x6800, 0x700a,
-- 0x6804, 0x700e, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0110, 0x2001,
-- 0x0002, 0x00f6, 0x2079, 0x0100, 0x080c, 0x7637, 0x1128, 0x78e3,
-- 0x0000, 0x080c, 0x28e7, 0x78e2, 0x00fe, 0x6808, 0x080c, 0x7637,
-- 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012, 0x080c,
-- 0xb254, 0x680c, 0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001,
-- 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9,
-- 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c,
-- 0xaf79, 0x2069, 0x1974, 0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002,
-- 0x080c, 0x57d9, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04e0,
-- 0x2001, 0x1837, 0x2004, 0xd0a4, 0x01a8, 0x0016, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x2009, 0x0002, 0x1118, 0x2001, 0x196d, 0x200c,
-- 0x60e0, 0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x28e7,
-- 0x61e2, 0x001e, 0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9, 0x0000,
-- 0x20a1, 0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099,
-- 0x1805, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
-- 0x20a1, 0x025a, 0x4003, 0x080c, 0xaf79, 0x20a1, 0x024e, 0x20a9,
-- 0x0008, 0x2099, 0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0xa6bd,
-- 0x080c, 0xa0c1, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800,
-- 0x700f, 0x2000, 0x9006, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe,
-- 0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010,
-- 0x9085, 0x0002, 0x00d6, 0x0804, 0xa071, 0x7026, 0x60c3, 0x0014,
-- 0x0804, 0xa6bd, 0x080c, 0xa0c1, 0x7003, 0x5000, 0x0804, 0x9f30,
-- 0x080c, 0xa0c1, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014,
-- 0x0804, 0xa6bd, 0x080c, 0xa103, 0x0010, 0x080c, 0xa10c, 0x7003,
-- 0x0200, 0x60c3, 0x0004, 0x0804, 0xa6bd, 0x080c, 0xa10c, 0x7003,
-- 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804,
-- 0xa6bd, 0x080c, 0xa10c, 0x7003, 0x0200, 0x0804, 0x9f30, 0x080c,
-- 0xa10c, 0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010,
-- 0x700b, 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6bd,
-- 0x00d6, 0x080c, 0xa10c, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b,
-- 0x0800, 0xb894, 0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030,
-- 0x0190, 0xb998, 0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f,
-- 0x2100, 0x0058, 0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028,
-- 0x700f, 0x0700, 0x0010, 0x700f, 0x0800, 0x00f6, 0x2079, 0x1847,
-- 0x7904, 0x00fe, 0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110,
-- 0x9085, 0x0010, 0x2009, 0x1869, 0x210c, 0xd184, 0x1110, 0x9085,
-- 0x0002, 0x0026, 0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5,
-- 0xbacc, 0xd28c, 0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010,
-- 0x0140, 0xd1ec, 0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108,
-- 0xc0bd, 0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0xa6bd,
-- 0x080c, 0xa10c, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100,
-- 0x60c3, 0x0014, 0x0804, 0xa6bd, 0x080c, 0xa10c, 0x7003, 0x0200,
-- 0x0804, 0x9eae, 0x080c, 0xa10c, 0x7003, 0x0100, 0x700b, 0x0003,
-- 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa6bd, 0x080c, 0xa10c,
-- 0x7003, 0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0xa6bd,
-- 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800,
-- 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021,
-- 0x0100, 0x080c, 0xaf8e, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006,
-- 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x9485, 0x0029,
-- 0x7012, 0x004e, 0x003e, 0x00de, 0x080c, 0xa6ab, 0x721a, 0x9f95,
-- 0x0000, 0x7222, 0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005,
-- 0x0026, 0x080c, 0xaf8e, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6,
-- 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x00de, 0x7013,
-- 0x2029, 0x0c10, 0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02,
-- 0x700f, 0x0000, 0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019,
-- 0x3300, 0x2021, 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046,
-- 0x2019, 0x2300, 0x2021, 0x0100, 0x080c, 0xaf8e, 0xb810, 0x9305,
-- 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140,
-- 0xb814, 0x9005, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020,
-- 0x687c, 0x700a, 0x6880, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012,
-- 0x004e, 0x003e, 0x00de, 0x080c, 0xa6ab, 0x721a, 0x7a08, 0x7222,
-- 0x2f10, 0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0xa6ab,
-- 0x721a, 0x7a08, 0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e,
-- 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200,
-- 0x2071, 0x0240, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5, 0x908a,
-- 0x0092, 0x1a0c, 0x0dc5, 0x6110, 0x2158, 0xb9c0, 0x2c78, 0x2061,
-- 0x0100, 0x619a, 0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de,
-- 0x00ce, 0x00be, 0x0005, 0xa17a, 0xa189, 0xa194, 0xa178, 0xa178,
-- 0xa178, 0xa17a, 0xa178, 0xa178, 0xa178, 0xa178, 0xa178, 0xa178,
-- 0x080c, 0x0dc5, 0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x2bce,
-- 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804,
-- 0xa6bd, 0x0431, 0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff,
-- 0x60c3, 0x000c, 0x0804, 0xa6bd, 0x04a1, 0x7003, 0x0003, 0x7007,
-- 0x0300, 0x60c3, 0x0004, 0x0804, 0xa6bd, 0x0026, 0x080c, 0xaf8e,
-- 0xb810, 0x9085, 0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-- 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0xa0dc,
-- 0x0026, 0x080c, 0xaf8e, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814,
-- 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001,
-- 0x0099, 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc, 0x7012, 0x0804,
-- 0xa13e, 0x0026, 0x080c, 0xaf8e, 0xb810, 0x9085, 0x8500, 0x7002,
-+ 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0xb2ff,
-+ 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660, 0x6003, 0x0009, 0x630a,
-+ 0x00ce, 0x0804, 0x97bb, 0x89ff, 0x0158, 0xa867, 0x0103, 0xab7a,
-+ 0xa877, 0x0000, 0x080c, 0xd3c7, 0x080c, 0xef7e, 0x080c, 0x6e98,
-+ 0x080c, 0xaaea, 0x0804, 0x97bb, 0x006e, 0x00de, 0x00ee, 0x00fe,
-+ 0x012e, 0x000e, 0x00ce, 0x009e, 0x00ae, 0x00be, 0x0005, 0x0096,
-+ 0x0006, 0x0066, 0x00c6, 0x00d6, 0x9036, 0x7814, 0x9065, 0x0904,
-+ 0x9882, 0x600c, 0x0006, 0x600f, 0x0000, 0x7824, 0x9c06, 0x1580,
-+ 0x2069, 0x0100, 0x6820, 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c,
-+ 0x88bc, 0x080c, 0xa6e2, 0x68c3, 0x0000, 0x080c, 0xac14, 0x7827,
-+ 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
-+ 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069,
-+ 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040,
-+ 0x080c, 0x6a34, 0x1520, 0x6003, 0x0009, 0x630a, 0x2c30, 0x00f8,
-+ 0x6014, 0x2048, 0x080c, 0xd0cf, 0x01b0, 0x6020, 0x9086, 0x0003,
-+ 0x1508, 0x080c, 0xd2d9, 0x1118, 0x080c, 0xbcaf, 0x0060, 0x080c,
-+ 0x6a34, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-+ 0x6e98, 0x080c, 0xd2bc, 0x080c, 0xb2ff, 0x080c, 0xaaea, 0x000e,
-+ 0x0804, 0x9826, 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e, 0x000e,
-+ 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xebcd,
-+ 0x0c50, 0x080c, 0xbcaf, 0x6020, 0x9086, 0x0002, 0x1150, 0x6004,
-+ 0x0006, 0x9086, 0x0085, 0x000e, 0x0990, 0x9086, 0x008b, 0x0978,
-+ 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004, 0x0006, 0x9086,
-+ 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00, 0x0860, 0x0006,
-+ 0x0066, 0x0096, 0x00b6, 0x00c6, 0x00d6, 0x7818, 0x905d, 0x0904,
-+ 0x992f, 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a, 0xb800, 0xc0d4,
-+ 0xc0dc, 0xb802, 0x080c, 0x6645, 0x0904, 0x992c, 0x7e24, 0x86ff,
-+ 0x0904, 0x991f, 0x9680, 0x0005, 0x2004, 0x9906, 0x1904, 0x991f,
-+ 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x9916, 0x080c,
-+ 0x88bc, 0x080c, 0xa6e2, 0x68c3, 0x0000, 0x080c, 0xac14, 0x7827,
-+ 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
-+ 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069,
-+ 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x00de,
-+ 0x00c6, 0x3e08, 0x918e, 0x0002, 0x1168, 0xb800, 0xd0bc, 0x0150,
-+ 0x9680, 0x0010, 0x200c, 0x81ff, 0x1518, 0x2009, 0x1988, 0x210c,
-+ 0x2102, 0x00f0, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660,
-+ 0x600f, 0x0000, 0x080c, 0xb2ff, 0x00ce, 0x0048, 0x00de, 0x00c6,
-+ 0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x98c2, 0x89ff,
-+ 0x0138, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e98,
-+ 0x080c, 0xaaea, 0x0804, 0x98c2, 0x000e, 0x0804, 0x98b6, 0x781e,
-+ 0x781a, 0x00de, 0x00ce, 0x00be, 0x009e, 0x006e, 0x000e, 0x0005,
-+ 0x00e6, 0x00d6, 0x0096, 0x0066, 0xb800, 0xd0dc, 0x01a0, 0xb84c,
-+ 0x904d, 0x0188, 0xa878, 0x9606, 0x1170, 0x2071, 0x19e8, 0x7024,
-+ 0x9035, 0x0148, 0x9080, 0x0005, 0x2004, 0x9906, 0x1120, 0xb800,
-+ 0xc0dc, 0xb802, 0x0029, 0x006e, 0x009e, 0x00de, 0x00ee, 0x0005,
-+ 0x00f6, 0x2079, 0x0100, 0x78c0, 0x9005, 0x1138, 0x00c6, 0x2660,
-+ 0x6003, 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c, 0xa6e2, 0x78c3,
-+ 0x0000, 0x080c, 0xac14, 0x7027, 0x0000, 0x0036, 0x2079, 0x0140,
-+ 0x7b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39,
-+ 0x9006, 0x080c, 0x2d39, 0x2079, 0x0100, 0x7824, 0xd084, 0x0110,
-+ 0x7827, 0x0001, 0x080c, 0xac14, 0x003e, 0x080c, 0x6645, 0x00c6,
-+ 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0xb2cc,
-+ 0x00ce, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd3c7,
-+ 0x080c, 0x6e98, 0x080c, 0xaaea, 0x00fe, 0x0005, 0x00b6, 0x00e6,
-+ 0x00c6, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x2001, 0x180c,
-+ 0x2014, 0xc2e4, 0x2202, 0x2071, 0x19e8, 0x7004, 0x9084, 0x0007,
-+ 0x0002, 0x99bb, 0x99bf, 0x99dd, 0x9a06, 0x9a44, 0x99bb, 0x99d6,
-+ 0x99b9, 0x080c, 0x0dc5, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024,
-+ 0x9065, 0x0148, 0x7020, 0x8001, 0x7022, 0x600c, 0x9015, 0x0158,
-+ 0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000, 0x00ce,
-+ 0x00ee, 0x00be, 0x0005, 0x7216, 0x7212, 0x0ca8, 0x7007, 0x0000,
-+ 0x7027, 0x0000, 0x7020, 0x9005, 0x0070, 0x6010, 0x2058, 0x080c,
-+ 0x6645, 0xb800, 0xc0dc, 0xb802, 0x7007, 0x0000, 0x7027, 0x0000,
-+ 0x7020, 0x8001, 0x7022, 0x1148, 0x2001, 0x180c, 0x2014, 0xd2ec,
-+ 0x1180, 0x00ce, 0x00ee, 0x00be, 0x0005, 0xb854, 0x9015, 0x0120,
-+ 0x721e, 0x080c, 0x9aaa, 0x0ca8, 0x7218, 0x721e, 0x080c, 0x9aaa,
-+ 0x0c80, 0xc2ec, 0x2202, 0x080c, 0x9bcc, 0x0c58, 0x7024, 0x9065,
-+ 0x05b8, 0x700c, 0x9c06, 0x1160, 0x080c, 0xaaea, 0x600c, 0x9015,
-+ 0x0120, 0x720e, 0x600f, 0x0000, 0x0448, 0x720e, 0x720a, 0x0430,
-+ 0x7014, 0x9c06, 0x1160, 0x080c, 0xaaea, 0x600c, 0x9015, 0x0120,
-+ 0x7216, 0x600f, 0x0000, 0x00d0, 0x7216, 0x7212, 0x00b8, 0x6020,
-+ 0x9086, 0x0003, 0x1198, 0x6010, 0x2058, 0x080c, 0x6645, 0xb800,
-+ 0xc0dc, 0xb802, 0x080c, 0xaaea, 0x701c, 0x9065, 0x0138, 0xb854,
-+ 0x9015, 0x0110, 0x721e, 0x0010, 0x7218, 0x721e, 0x7027, 0x0000,
-+ 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024, 0x9065, 0x0140, 0x080c,
-+ 0xaaea, 0x600c, 0x9015, 0x0158, 0x720e, 0x600f, 0x0000, 0x080c,
-+ 0xac14, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x720e,
-+ 0x720a, 0x0ca8, 0x00d6, 0x2069, 0x19e8, 0x6830, 0x9084, 0x0003,
-+ 0x0002, 0x9a67, 0x9a69, 0x9a8d, 0x9a65, 0x080c, 0x0dc5, 0x00de,
-+ 0x0005, 0x00c6, 0x6840, 0x9086, 0x0001, 0x01b8, 0x683c, 0x9065,
-+ 0x0130, 0x600c, 0x9015, 0x0170, 0x6a3a, 0x600f, 0x0000, 0x6833,
-+ 0x0000, 0x683f, 0x0000, 0x2011, 0x1a07, 0x2013, 0x0000, 0x00ce,
-+ 0x00de, 0x0005, 0x683a, 0x6836, 0x0c90, 0x6843, 0x0000, 0x6838,
-+ 0x9065, 0x0d68, 0x6003, 0x0003, 0x0c50, 0x00c6, 0x9006, 0x6842,
-+ 0x6846, 0x684a, 0x683c, 0x9065, 0x0160, 0x600c, 0x9015, 0x0130,
-+ 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000, 0x0018, 0x683e, 0x683a,
-+ 0x6836, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c, 0x200c, 0xc1e5,
-+ 0x2102, 0x0005, 0x2001, 0x180c, 0x200c, 0xd1ec, 0x0120, 0xc1ec,
-+ 0x2102, 0x080c, 0x9bcc, 0x2001, 0x19f4, 0x2004, 0x9086, 0x0001,
-+ 0x0d58, 0x00d6, 0x2069, 0x19e8, 0x6804, 0x9084, 0x0007, 0x0006,
-+ 0x9005, 0x11c8, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1198,
-+ 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0168, 0x2001, 0x188b,
-+ 0x2004, 0xd08c, 0x1118, 0xd084, 0x1118, 0x0028, 0x080c, 0x9bcc,
-+ 0x000e, 0x00de, 0x0005, 0x000e, 0x0002, 0x9ae7, 0x9ba0, 0x9ba0,
-+ 0x9ba0, 0x9ba0, 0x9ba2, 0x9ba0, 0x9ae5, 0x080c, 0x0dc5, 0x6820,
-+ 0x9005, 0x1110, 0x00de, 0x0005, 0x00c6, 0x680c, 0x9065, 0x01f0,
-+ 0x6104, 0x918e, 0x0040, 0x1180, 0x2009, 0x1837, 0x210c, 0x918c,
-+ 0x0028, 0x1150, 0x080c, 0x7630, 0x0138, 0x0006, 0x2009, 0x188b,
-+ 0x2104, 0xc095, 0x200a, 0x000e, 0x6807, 0x0004, 0x6826, 0x682b,
-+ 0x0000, 0x080c, 0x9c75, 0x00ce, 0x00de, 0x0005, 0x6814, 0x9065,
-+ 0x0150, 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x9c75,
-+ 0x00ce, 0x00de, 0x0005, 0x00b6, 0x00e6, 0x6a1c, 0x92dd, 0x0000,
-+ 0x0904, 0x9b8a, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005, 0x01a0,
-+ 0xb854, 0x905d, 0x0120, 0x920e, 0x0904, 0x9b8a, 0x0028, 0x6818,
-+ 0x920e, 0x0904, 0x9b8a, 0x2058, 0xb84c, 0x900d, 0x0d88, 0xb888,
-+ 0x9005, 0x1d70, 0x2b00, 0x681e, 0xbb3c, 0xb838, 0x9302, 0x1e40,
-+ 0x080c, 0xb2a3, 0x0904, 0x9b8a, 0x8318, 0xbb3e, 0x6116, 0x2b10,
-+ 0x6212, 0x0096, 0x2148, 0xa880, 0x9084, 0x00ff, 0x605e, 0xa883,
-+ 0x0000, 0xa884, 0x009e, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999,
-+ 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x6114, 0x0096, 0x2148,
-+ 0xa964, 0x009e, 0x918c, 0x00ff, 0x918e, 0x0048, 0x0538, 0x00f6,
-+ 0x2c78, 0x2061, 0x0100, 0xbac0, 0x629a, 0x2069, 0x0200, 0x2071,
-+ 0x0240, 0x080c, 0xa212, 0x2069, 0x19e8, 0xbb00, 0xc3dd, 0xbb02,
-+ 0x6807, 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x7823, 0x0003,
-+ 0x7803, 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00be, 0x00ce,
-+ 0x00de, 0x0005, 0x00ee, 0x00be, 0x00ce, 0x0cd0, 0x6807, 0x0006,
-+ 0x2c18, 0x6b26, 0x6820, 0x8001, 0x6822, 0x682b, 0x0000, 0x080c,
-+ 0x6645, 0x080c, 0xb0e3, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005,
-+ 0x00de, 0x0005, 0x00c6, 0x680c, 0x9065, 0x01d8, 0x6104, 0x918e,
-+ 0x0040, 0x1180, 0x2009, 0x1837, 0x210c, 0x918c, 0x0028, 0x1150,
-+ 0x080c, 0x7630, 0x0138, 0x0006, 0x2009, 0x188b, 0x2104, 0xc095,
-+ 0x200a, 0x000e, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000, 0x080c,
-+ 0x9c75, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c, 0x2014, 0xc2ed,
-+ 0x2202, 0x00de, 0x00fe, 0x0005, 0x00f6, 0x00d6, 0x2069, 0x19e8,
-+ 0x6830, 0x9086, 0x0000, 0x1570, 0x2001, 0x180c, 0x2014, 0xd2e4,
-+ 0x0130, 0xc2e4, 0x2202, 0x080c, 0x9ab9, 0x2069, 0x19e8, 0x2001,
-+ 0x180c, 0x200c, 0xd1c4, 0x1508, 0x6838, 0x907d, 0x01d8, 0x6a04,
-+ 0x9296, 0x0000, 0x1904, 0x9c69, 0x7920, 0x918e, 0x0009, 0x0568,
-+ 0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000, 0x0126,
-+ 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x1158, 0x012e,
-+ 0x080c, 0xa53f, 0x00de, 0x00fe, 0x0005, 0xc1c4, 0x2102, 0x080c,
-+ 0x76dd, 0x08d0, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002, 0x780c,
-+ 0x9015, 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000, 0x683f,
-+ 0x0000, 0x0c40, 0x683a, 0x6836, 0x0cc0, 0x7908, 0xd1fc, 0x1198,
-+ 0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000, 0x0126,
-+ 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x19d8, 0x012e,
-+ 0x080c, 0xa4c0, 0x0878, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028,
-+ 0x1188, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0158, 0x2001,
-+ 0x19e9, 0x2004, 0x9005, 0x11f0, 0x2001, 0x188b, 0x200c, 0xc185,
-+ 0xc18c, 0x2102, 0x2f00, 0x6833, 0x0001, 0x683e, 0x6847, 0x0000,
-+ 0x684b, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c,
-+ 0x1c79, 0x1904, 0x9c0a, 0x012e, 0x6a3c, 0x2278, 0x080c, 0xa44a,
-+ 0x0804, 0x9c02, 0x2011, 0x188b, 0x2204, 0xc08d, 0x2012, 0x0804,
-+ 0x9c02, 0x6a04, 0x9296, 0x0006, 0x1904, 0x9bc4, 0x6a30, 0x9296,
-+ 0x0000, 0x0904, 0x9bec, 0x0804, 0x9bc4, 0x6020, 0x9084, 0x000f,
-+ 0x000b, 0x0005, 0x9c89, 0x9c8e, 0xa142, 0xa1db, 0x9c8e, 0xa142,
-+ 0xa1db, 0x9c89, 0x9c8e, 0x9c89, 0x9c89, 0x9c89, 0x9c89, 0x9c89,
-+ 0x9c89, 0x080c, 0x999e, 0x080c, 0x9aaa, 0x0005, 0x00b6, 0x0156,
-+ 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-+ 0x2069, 0x0200, 0x2071, 0x0240, 0x6004, 0x908a, 0x0053, 0x1a0c,
-+ 0x0dc5, 0x6110, 0x2158, 0xb9c0, 0x2c78, 0x2061, 0x0100, 0x619a,
-+ 0x908a, 0x0040, 0x1a04, 0x9cfa, 0x005b, 0x00fe, 0x00ee, 0x00de,
-+ 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005,
-+ 0x9ea3, 0x9ede, 0x9f07, 0x9fd1, 0x9ff3, 0x9ff9, 0xa006, 0xa00e,
-+ 0xa01a, 0xa020, 0xa031, 0xa020, 0xa089, 0xa00e, 0xa095, 0xa09b,
-+ 0xa01a, 0xa09b, 0xa0a7, 0x9cf8, 0x9cf8, 0x9cf8, 0x9cf8, 0x9cf8,
-+ 0x9cf8, 0x9cf8, 0x9cf8, 0x9cf8, 0x9cf8, 0x9cf8, 0xa8f9, 0xa91c,
-+ 0xa92d, 0xa94d, 0xa97f, 0xa006, 0x9cf8, 0xa006, 0xa020, 0x9cf8,
-+ 0x9f07, 0x9fd1, 0x9cf8, 0xad0b, 0xa020, 0x9cf8, 0xad27, 0xa020,
-+ 0x9cf8, 0xa01a, 0x9e9d, 0x9d1b, 0x9cf8, 0xad43, 0xadb0, 0xae8b,
-+ 0x9cf8, 0xae98, 0xa003, 0xaec3, 0x9cf8, 0xa989, 0xaef0, 0x9cf8,
-+ 0x080c, 0x0dc5, 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0xaf8b,
-+ 0xb03d, 0x9d19, 0x9d53, 0x9dff, 0x9e0a, 0x9d19, 0xa006, 0x9d19,
-+ 0x9e64, 0x9e70, 0x9d6e, 0x9d19, 0x9d89, 0x9dbd, 0xb1aa, 0xb1ef,
-+ 0xa020, 0x080c, 0x0dc5, 0x00d6, 0x0096, 0x080c, 0xa0ba, 0x0026,
-+ 0x0036, 0x7814, 0x2048, 0xa958, 0xd1cc, 0x1138, 0x2009, 0x2414,
-+ 0x2011, 0x0018, 0x2019, 0x0018, 0x0030, 0x2009, 0x2410, 0x2011,
-+ 0x0014, 0x2019, 0x0014, 0x7102, 0x7206, 0x700b, 0x0800, 0xa83c,
-+ 0x700e, 0xa850, 0x7022, 0xa854, 0x7026, 0x63c2, 0x080c, 0xa6b6,
-+ 0x003e, 0x002e, 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058,
-+ 0xb8a0, 0x00be, 0x080c, 0xb236, 0x1118, 0x9084, 0xff80, 0x0110,
-+ 0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c, 0xa0ba, 0x7003,
-+ 0x0500, 0x7814, 0x2048, 0xa874, 0x700a, 0xa878, 0x700e, 0xa87c,
-+ 0x7012, 0xa880, 0x7016, 0xa884, 0x701a, 0xa888, 0x701e, 0x60c3,
-+ 0x0010, 0x080c, 0xa6b6, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096,
-+ 0x080c, 0xa0ba, 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a,
-+ 0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc, 0x701a,
-+ 0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0xa6b6, 0x009e, 0x00de,
-+ 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0xa0ba,
-+ 0x20e9, 0x0000, 0x2001, 0x19a4, 0x2003, 0x0000, 0x7814, 0x2048,
-+ 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c,
-+ 0x9080, 0x001b, 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x2001,
-+ 0x0001, 0x080c, 0x23ee, 0x080c, 0xde75, 0x9006, 0x080c, 0x23ee,
-+ 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c,
-+ 0xa6b6, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0xa105, 0x20e9, 0x0000, 0x2001, 0x19a4,
-+ 0x2003, 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200, 0xa873, 0x0000,
-+ 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c,
-+ 0x9080, 0x001b, 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x080c,
-+ 0xde75, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051,
-+ 0x7814, 0x2048, 0x080c, 0x0fc0, 0x080c, 0xa6b6, 0x012e, 0x009e,
-+ 0x00de, 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003, 0x9005, 0x0130,
-+ 0x9082, 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c,
-+ 0xa0ba, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008,
-+ 0x0804, 0xa6b6, 0x00d6, 0x00e6, 0x080c, 0xa105, 0x7814, 0x9084,
-+ 0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9096, 0xdf00, 0x0138,
-+ 0x9096, 0xe000, 0x0120, 0x2073, 0x0010, 0x8e70, 0x0030, 0x9095,
-+ 0x0010, 0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805,
-+ 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9e2a, 0x2069,
-+ 0x1801, 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9e33,
-+ 0x9096, 0xdf00, 0x0130, 0x9096, 0xe000, 0x0118, 0x60c3, 0x0018,
-+ 0x00f0, 0x2069, 0x19b4, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19ce,
-+ 0x20a9, 0x001a, 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200,
-+ 0x6010, 0x8000, 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007,
-+ 0x2072, 0x8d68, 0x8e70, 0x1f04, 0x9e4a, 0x60c3, 0x004c, 0x080c,
-+ 0xa6b6, 0x00ee, 0x00de, 0x0005, 0x080c, 0xa0ba, 0x7003, 0x6300,
-+ 0x7007, 0x0028, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6b6,
-+ 0x00d6, 0x0026, 0x0016, 0x080c, 0xa105, 0x7003, 0x0200, 0x7814,
-+ 0x700e, 0x00e6, 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c,
-+ 0x2069, 0x1924, 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70,
-+ 0x2073, 0x0000, 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800,
-+ 0x8e70, 0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c,
-+ 0xa6b6, 0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004,
-+ 0x609a, 0x0804, 0xa6b6, 0x080c, 0xa0ba, 0x7003, 0x5200, 0x2069,
-+ 0x1847, 0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x28a6,
-+ 0x710e, 0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805,
-+ 0x20e9, 0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099,
-+ 0x1801, 0x20a1, 0x0254, 0x4003, 0x080c, 0xb236, 0x1120, 0xb8a0,
-+ 0x9082, 0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001,
-+ 0x1820, 0x2004, 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084,
-+ 0x00ff, 0x7036, 0x60c3, 0x001c, 0x0804, 0xa6b6, 0x080c, 0xa0ba,
-+ 0x7003, 0x0500, 0x080c, 0xb236, 0x1120, 0xb8a0, 0x9082, 0x007f,
-+ 0x0248, 0x2001, 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004,
-+ 0x700e, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e,
-+ 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
-+ 0x20a1, 0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0xa6b6, 0x080c,
-+ 0xa0ba, 0x9006, 0x080c, 0x6a66, 0xb8a0, 0x9086, 0x007e, 0x1170,
-+ 0x2011, 0x0240, 0x2013, 0x22ff, 0x2011, 0x0241, 0x2013, 0xfffe,
-+ 0x7003, 0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096,
-+ 0x904d, 0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003,
-+ 0x0300, 0xb8a0, 0x9086, 0x007e, 0x1904, 0x9f91, 0x00d6, 0x2069,
-+ 0x196c, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a,
-+ 0x6808, 0x9084, 0x2000, 0x7012, 0x080c, 0xb24d, 0x680c, 0x7016,
-+ 0x701f, 0x2710, 0x6818, 0x7022, 0x681c, 0x7026, 0x0428, 0x6800,
-+ 0x700a, 0x6804, 0x700e, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0110,
-+ 0x2001, 0x0002, 0x00f6, 0x2079, 0x0100, 0x080c, 0x7630, 0x1128,
-+ 0x78e3, 0x0000, 0x080c, 0x28e7, 0x78e2, 0x00fe, 0x6808, 0x080c,
-+ 0x7630, 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012,
-+ 0x080c, 0xb24d, 0x680c, 0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1,
-+ 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003,
-+ 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6,
-+ 0x080c, 0xaf72, 0x2069, 0x1974, 0x2071, 0x024e, 0x6800, 0xc0dd,
-+ 0x7002, 0x080c, 0x57d7, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de,
-+ 0x04e0, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x01a8, 0x0016, 0x2001,
-+ 0x180d, 0x2004, 0xd08c, 0x2009, 0x0002, 0x1118, 0x2001, 0x196d,
-+ 0x200c, 0x60e0, 0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c,
-+ 0x28e7, 0x61e2, 0x001e, 0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9,
-+ 0x0000, 0x20a1, 0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004,
-+ 0x2099, 0x1805, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099,
-+ 0x1801, 0x20a1, 0x025a, 0x4003, 0x080c, 0xaf72, 0x20a1, 0x024e,
-+ 0x20a9, 0x0008, 0x2099, 0x1974, 0x4003, 0x60c3, 0x0074, 0x0804,
-+ 0xa6b6, 0x080c, 0xa0ba, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b,
-+ 0x0800, 0x700f, 0x2000, 0x9006, 0x00f6, 0x2079, 0x1847, 0x7904,
-+ 0x00fe, 0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085,
-+ 0x0010, 0x9085, 0x0002, 0x00d6, 0x0804, 0xa06a, 0x7026, 0x60c3,
-+ 0x0014, 0x0804, 0xa6b6, 0x080c, 0xa0ba, 0x7003, 0x5000, 0x0804,
-+ 0x9f29, 0x080c, 0xa0ba, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3,
-+ 0x0014, 0x0804, 0xa6b6, 0x080c, 0xa0fc, 0x0010, 0x080c, 0xa105,
-+ 0x7003, 0x0200, 0x60c3, 0x0004, 0x0804, 0xa6b6, 0x080c, 0xa105,
-+ 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008,
-+ 0x0804, 0xa6b6, 0x080c, 0xa105, 0x7003, 0x0200, 0x0804, 0x9f29,
-+ 0x080c, 0xa105, 0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a,
-+ 0x0010, 0x700b, 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804,
-+ 0xa6b6, 0x00d6, 0x080c, 0xa105, 0x7003, 0x0210, 0x7007, 0x0014,
-+ 0x700b, 0x0800, 0xb894, 0x9086, 0x0014, 0x1198, 0xb99c, 0x9184,
-+ 0x0030, 0x0190, 0xb998, 0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118,
-+ 0x700f, 0x2100, 0x0058, 0x700f, 0x0100, 0x0040, 0x700f, 0x0400,
-+ 0x0028, 0x700f, 0x0700, 0x0010, 0x700f, 0x0800, 0x00f6, 0x2079,
-+ 0x1847, 0x7904, 0x00fe, 0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4,
-+ 0x0110, 0x9085, 0x0010, 0x2009, 0x1869, 0x210c, 0xd184, 0x1110,
-+ 0x9085, 0x0002, 0x0026, 0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150,
-+ 0xc0c5, 0xbacc, 0xd28c, 0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296,
-+ 0x0010, 0x0140, 0xd1ec, 0x0130, 0x9094, 0x0030, 0x9296, 0x0010,
-+ 0x0108, 0xc0bd, 0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804,
-+ 0xa6b6, 0x080c, 0xa105, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f,
-+ 0x0100, 0x60c3, 0x0014, 0x0804, 0xa6b6, 0x080c, 0xa105, 0x7003,
-+ 0x0200, 0x0804, 0x9ea7, 0x080c, 0xa105, 0x7003, 0x0100, 0x700b,
-+ 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa6b6, 0x080c,
-+ 0xa105, 0x7003, 0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804,
-+ 0xa6b6, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3200, 0x2021,
-+ 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2200,
-+ 0x2021, 0x0100, 0x080c, 0xaf87, 0xb810, 0x9305, 0x7002, 0xb814,
-+ 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x9485,
-+ 0x0029, 0x7012, 0x004e, 0x003e, 0x00de, 0x080c, 0xa6a4, 0x721a,
-+ 0x9f95, 0x0000, 0x7222, 0x7027, 0xffff, 0x2071, 0x024c, 0x002e,
-+ 0x0005, 0x0026, 0x080c, 0xaf87, 0x7003, 0x02ff, 0x7007, 0xfffc,
-+ 0x00d6, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x00de,
-+ 0x7013, 0x2029, 0x0c10, 0x7003, 0x0100, 0x7007, 0x0000, 0x700b,
-+ 0xfc02, 0x700f, 0x0000, 0x0005, 0x0026, 0x00d6, 0x0036, 0x0046,
-+ 0x2019, 0x3300, 0x2021, 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036,
-+ 0x0046, 0x2019, 0x2300, 0x2021, 0x0100, 0x080c, 0xaf87, 0xb810,
-+ 0x9305, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0xb810, 0x9005,
-+ 0x1140, 0xb814, 0x9005, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe,
-+ 0x0020, 0x687c, 0x700a, 0x6880, 0x700e, 0x0000, 0x9485, 0x0098,
-+ 0x7012, 0x004e, 0x003e, 0x00de, 0x080c, 0xa6a4, 0x721a, 0x7a08,
-+ 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c,
-+ 0xa6a4, 0x721a, 0x7a08, 0x7222, 0x7814, 0x7026, 0x2071, 0x024c,
-+ 0x002e, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069,
-+ 0x0200, 0x2071, 0x0240, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5,
-+ 0x908a, 0x0092, 0x1a0c, 0x0dc5, 0x6110, 0x2158, 0xb9c0, 0x2c78,
-+ 0x2061, 0x0100, 0x619a, 0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee,
-+ 0x00de, 0x00ce, 0x00be, 0x0005, 0xa173, 0xa182, 0xa18d, 0xa171,
-+ 0xa171, 0xa171, 0xa173, 0xa171, 0xa171, 0xa171, 0xa171, 0xa171,
-+ 0xa171, 0x080c, 0x0dc5, 0x0411, 0x60c3, 0x0000, 0x0026, 0x080c,
-+ 0x2bce, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e,
-+ 0x0804, 0xa6b6, 0x0431, 0x7808, 0x700a, 0x7814, 0x700e, 0x7017,
-+ 0xffff, 0x60c3, 0x000c, 0x0804, 0xa6b6, 0x04a1, 0x7003, 0x0003,
-+ 0x7007, 0x0300, 0x60c3, 0x0004, 0x0804, 0xa6b6, 0x0026, 0x080c,
-+ 0xaf87, 0xb810, 0x9085, 0x8100, 0x7002, 0xb814, 0x7006, 0x2069,
-+ 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0009, 0x0804,
-+ 0xa0d5, 0x0026, 0x080c, 0xaf87, 0xb810, 0x9085, 0x8400, 0x7002,
- 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e,
- 0x2001, 0x0099, 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc, 0x7012,
-- 0x0804, 0xa13e, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2c78,
-- 0x2069, 0x0200, 0x2071, 0x0240, 0x7804, 0x908a, 0x0040, 0x0a0c,
-- 0x0dc5, 0x908a, 0x0054, 0x1a0c, 0x0dc5, 0x7910, 0x2158, 0xb9c0,
-- 0x2061, 0x0100, 0x619a, 0x9082, 0x0040, 0x0033, 0x00fe, 0x00ee,
-- 0x00de, 0x00ce, 0x00be, 0x0005, 0xa219, 0xa2e0, 0xa2b3, 0xa402,
-- 0xa217, 0xa217, 0xa217, 0xa217, 0xa217, 0xa217, 0xa217, 0xaad8,
-- 0xaadd, 0xaae2, 0xaae7, 0xa217, 0xaed6, 0xa217, 0xaad3, 0x080c,
-- 0x0dc5, 0x0096, 0x780b, 0xffff, 0x080c, 0xa284, 0x7914, 0x2148,
-- 0xa978, 0x7956, 0xae64, 0x96b4, 0x00ff, 0x9686, 0x0008, 0x1148,
-- 0xa8b4, 0x7032, 0xa8b8, 0x7036, 0xa8bc, 0x703a, 0xa8c0, 0x703e,
-- 0x0008, 0x7132, 0xa97c, 0x9184, 0x000f, 0x1118, 0x2001, 0x0005,
-- 0x0040, 0xd184, 0x0118, 0x2001, 0x0004, 0x0018, 0x9084, 0x0006,
-- 0x8004, 0x2010, 0x785c, 0x9084, 0x00ff, 0x8007, 0x9205, 0x7042,
-- 0xd1ac, 0x0158, 0x7047, 0x0002, 0x9686, 0x0008, 0x1118, 0x080c,
-- 0x18f7, 0x0010, 0x080c, 0x1768, 0x0050, 0xd1b4, 0x0118, 0x7047,
-- 0x0001, 0x0028, 0x7047, 0x0000, 0x9016, 0x2230, 0x0010, 0xaab0,
-- 0xaeac, 0x726a, 0x766e, 0x20a9, 0x0008, 0x20e9, 0x0000, 0xa860,
-- 0x20e0, 0xa85c, 0x9080, 0x0023, 0x2098, 0x20a1, 0x0252, 0x2069,
-- 0x0200, 0x6813, 0x0018, 0x4003, 0x6813, 0x0008, 0x60c3, 0x0020,
-- 0x6017, 0x0009, 0x2001, 0x1a04, 0x2003, 0x07d0, 0x2001, 0x1a03,
-- 0x2003, 0x0009, 0x009e, 0x0005, 0x6813, 0x0008, 0xba8c, 0x8210,
-- 0xb8cc, 0xd084, 0x0180, 0x2001, 0x1ad0, 0x200c, 0x8108, 0x2102,
-- 0x2001, 0x1acf, 0x201c, 0x1218, 0x8318, 0x2302, 0x0ea0, 0x794a,
-- 0x712e, 0x7b46, 0x732a, 0x9294, 0x00ff, 0xba8e, 0x8217, 0x721a,
-- 0xba10, 0x9295, 0x0600, 0x7202, 0xba14, 0x7206, 0x2069, 0x1800,
-- 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0829, 0x2f10, 0x7222,
-- 0x7027, 0xffff, 0x0005, 0x00d6, 0x0096, 0x0081, 0x7814, 0x2048,
-- 0xa890, 0x7002, 0xa88c, 0x7006, 0xa8b0, 0x700a, 0xa8ac, 0x700e,
-- 0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0xa6bd, 0x6813, 0x0008,
-- 0xb810, 0x9085, 0x0500, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-- 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0889, 0x080c, 0xa6ab,
-- 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x0005,
-- 0x00d6, 0x0096, 0x080c, 0xa3e0, 0x7814, 0x2048, 0x080c, 0xd0d6,
-- 0x1130, 0x7814, 0x9084, 0x0700, 0x8007, 0x0033, 0x0010, 0x9006,
-- 0x001b, 0x009e, 0x00de, 0x0005, 0xa2fe, 0xa367, 0xa377, 0xa39d,
-- 0xa3a9, 0xa3ba, 0xa3c2, 0xa2fc, 0x080c, 0x0dc5, 0x0016, 0x0036,
-- 0xa97c, 0x918c, 0x0003, 0x0118, 0x9186, 0x0003, 0x1198, 0xaba8,
-- 0x7824, 0xd0cc, 0x1168, 0x7316, 0xa898, 0x701a, 0xa894, 0x701e,
-- 0x003e, 0x001e, 0x2001, 0x19b2, 0x2004, 0x60c2, 0x0804, 0xa6bd,
-- 0xc3e5, 0x0c88, 0x9186, 0x0001, 0x190c, 0x0dc5, 0xaba8, 0x7824,
-- 0xd0cc, 0x1904, 0xa364, 0x7316, 0xa898, 0x701a, 0xa894, 0x701e,
-- 0xa8a4, 0x7026, 0xa8ac, 0x702e, 0x2009, 0x0018, 0x9384, 0x0300,
-- 0x0570, 0xd3c4, 0x0110, 0xa8ac, 0x9108, 0xd3cc, 0x0110, 0xa8a4,
-- 0x9108, 0x6810, 0x9085, 0x0010, 0x6812, 0x2011, 0x0258, 0x20e9,
-- 0x0000, 0x22a0, 0x0156, 0x20a9, 0x0008, 0xa860, 0x20e0, 0xa85c,
-- 0x9080, 0x002c, 0x2098, 0x4003, 0x6810, 0x8000, 0x6812, 0x2011,
-- 0x0240, 0x22a0, 0x20a9, 0x0005, 0x4003, 0x6810, 0xc0a4, 0x6812,
-- 0x015e, 0x9184, 0x0003, 0x0118, 0x2019, 0x0245, 0x201a, 0x61c2,
-- 0x003e, 0x001e, 0x0804, 0xa6bd, 0xc3e5, 0x0804, 0xa323, 0x2011,
-- 0x0008, 0x2001, 0x180f, 0x2004, 0xd0a4, 0x0110, 0x2011, 0x0028,
-- 0x7824, 0xd0cc, 0x1110, 0x7216, 0x0470, 0x0ce8, 0xc2e5, 0x2011,
-- 0x0302, 0x0016, 0x782c, 0x701a, 0x7930, 0x711e, 0x9105, 0x0108,
-- 0xc2dd, 0x001e, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216, 0x7027,
-- 0x0012, 0x702f, 0x0008, 0x7043, 0x7000, 0x7047, 0x0500, 0x704f,
-- 0x000a, 0x2069, 0x0200, 0x6813, 0x0009, 0x2071, 0x0240, 0x700b,
-- 0x2500, 0x60c3, 0x0032, 0x0804, 0xa6bd, 0x2011, 0x0028, 0x7824,
-- 0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804, 0xa6bd, 0x0cd0,
-- 0xc2e5, 0x2011, 0x0100, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
-- 0x702f, 0x0008, 0x7858, 0x9084, 0x00ff, 0x7036, 0x60c3, 0x0020,
-- 0x0804, 0xa6bd, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
-- 0x7216, 0x0c08, 0x0036, 0x7b14, 0x9384, 0xff00, 0x7816, 0x9384,
-- 0x00ff, 0x8001, 0x1138, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
-- 0x003e, 0x0888, 0x0046, 0x2021, 0x0800, 0x0006, 0x7824, 0xd0cc,
-- 0x000e, 0x0108, 0xc4e5, 0x7416, 0x004e, 0x701e, 0x003e, 0x0818,
-- 0x00d6, 0x6813, 0x0008, 0xb810, 0x9085, 0x0700, 0x7002, 0xb814,
-- 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7824,
-- 0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0xa6ab, 0x721a, 0x7a08,
-- 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005, 0x7013,
-- 0x0889, 0x0c90, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007, 0x0013,
-- 0x001e, 0x0005, 0xa412, 0xa412, 0xa414, 0xa412, 0xa412, 0xa412,
-- 0xa42e, 0xa412, 0x080c, 0x0dc5, 0x7914, 0x918c, 0x08ff, 0x918d,
-- 0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1847, 0x6804,
-- 0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010,
-- 0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0xa6bd, 0x2009, 0x0003,
-- 0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0xaf8e, 0x001e,
-- 0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-- 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0888, 0x918d, 0x0008,
-- 0x7116, 0x080c, 0xa6ab, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
-- 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046,
-- 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058,
-- 0x76dc, 0x96b4, 0x0028, 0x0110, 0x737c, 0x7480, 0x2500, 0x76dc,
-- 0x96b4, 0x0028, 0x0140, 0x2001, 0x04ff, 0x6062, 0x6067, 0xffff,
-- 0x636a, 0x646e, 0x0050, 0x2001, 0x00ff, 0x9085, 0x0400, 0x6062,
-- 0x6067, 0xffff, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6073, 0x0530,
-- 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007,
-- 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00, 0x6082, 0x6087,
-- 0xffff, 0x7814, 0x0096, 0x2048, 0xa838, 0x608a, 0xa834, 0x608e,
-- 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e, 0xb86c, 0x60ce, 0x60ab,
-- 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x2001, 0x1837, 0x2004,
-- 0x9084, 0x0028, 0x0128, 0x609f, 0x0000, 0x2001, 0x0092, 0x0048,
-- 0x6028, 0xc0bd, 0x602a, 0x609f, 0x00ff, 0x6027, 0xffff, 0x2001,
-- 0x00b2, 0x6016, 0x2009, 0x07d0, 0x080c, 0x88c8, 0x003e, 0x004e,
-- 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x00b6,
-- 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0036, 0x2061,
-- 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0xb8a0, 0x2028,
-- 0x76dc, 0xd6ac, 0x1168, 0x9582, 0x007e, 0x1250, 0x2500, 0x9094,
-- 0xff80, 0x1130, 0x9080, 0x33b6, 0x2015, 0x9294, 0x00ff, 0x0020,
-- 0xb910, 0xba14, 0x737c, 0x7480, 0x70dc, 0xd0ac, 0x1130, 0x9582,
-- 0x007e, 0x1218, 0x9584, 0xff80, 0x0138, 0x9185, 0x0400, 0x6062,
-- 0x6266, 0x636a, 0x646e, 0x0030, 0x6063, 0x0400, 0x6266, 0x606b,
-- 0x0000, 0x616e, 0xb8b8, 0x6072, 0x6077, 0x0000, 0xb864, 0xd0a4,
-- 0x0110, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-+ 0x0804, 0xa137, 0x0026, 0x080c, 0xaf87, 0xb810, 0x9085, 0x8500,
-+ 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880,
-+ 0x700e, 0x2001, 0x0099, 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc,
-+ 0x7012, 0x0804, 0xa137, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-+ 0x2c78, 0x2069, 0x0200, 0x2071, 0x0240, 0x7804, 0x908a, 0x0040,
-+ 0x0a0c, 0x0dc5, 0x908a, 0x0054, 0x1a0c, 0x0dc5, 0x7910, 0x2158,
-+ 0xb9c0, 0x2061, 0x0100, 0x619a, 0x9082, 0x0040, 0x0033, 0x00fe,
-+ 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005, 0xa212, 0xa2d9, 0xa2ac,
-+ 0xa3fb, 0xa210, 0xa210, 0xa210, 0xa210, 0xa210, 0xa210, 0xa210,
-+ 0xaad1, 0xaad6, 0xaadb, 0xaae0, 0xa210, 0xaecf, 0xa210, 0xaacc,
-+ 0x080c, 0x0dc5, 0x0096, 0x780b, 0xffff, 0x080c, 0xa27d, 0x7914,
-+ 0x2148, 0xa978, 0x7956, 0xae64, 0x96b4, 0x00ff, 0x9686, 0x0008,
-+ 0x1148, 0xa8b4, 0x7032, 0xa8b8, 0x7036, 0xa8bc, 0x703a, 0xa8c0,
-+ 0x703e, 0x0008, 0x7132, 0xa97c, 0x9184, 0x000f, 0x1118, 0x2001,
-+ 0x0005, 0x0040, 0xd184, 0x0118, 0x2001, 0x0004, 0x0018, 0x9084,
-+ 0x0006, 0x8004, 0x2010, 0x785c, 0x9084, 0x00ff, 0x8007, 0x9205,
-+ 0x7042, 0xd1ac, 0x0158, 0x7047, 0x0002, 0x9686, 0x0008, 0x1118,
-+ 0x080c, 0x18f7, 0x0010, 0x080c, 0x1768, 0x0050, 0xd1b4, 0x0118,
-+ 0x7047, 0x0001, 0x0028, 0x7047, 0x0000, 0x9016, 0x2230, 0x0010,
-+ 0xaab0, 0xaeac, 0x726a, 0x766e, 0x20a9, 0x0008, 0x20e9, 0x0000,
-+ 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023, 0x2098, 0x20a1, 0x0252,
-+ 0x2069, 0x0200, 0x6813, 0x0018, 0x4003, 0x6813, 0x0008, 0x60c3,
-+ 0x0020, 0x6017, 0x0009, 0x2001, 0x1a04, 0x2003, 0x07d0, 0x2001,
-+ 0x1a03, 0x2003, 0x0009, 0x009e, 0x0005, 0x6813, 0x0008, 0xba8c,
-+ 0x8210, 0xb8cc, 0xd084, 0x0180, 0x2001, 0x1ad0, 0x200c, 0x8108,
-+ 0x2102, 0x2001, 0x1acf, 0x201c, 0x1218, 0x8318, 0x2302, 0x0ea0,
-+ 0x794a, 0x712e, 0x7b46, 0x732a, 0x9294, 0x00ff, 0xba8e, 0x8217,
-+ 0x721a, 0xba10, 0x9295, 0x0600, 0x7202, 0xba14, 0x7206, 0x2069,
-+ 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0829, 0x2f10,
-+ 0x7222, 0x7027, 0xffff, 0x0005, 0x00d6, 0x0096, 0x0081, 0x7814,
-+ 0x2048, 0xa890, 0x7002, 0xa88c, 0x7006, 0xa8b0, 0x700a, 0xa8ac,
-+ 0x700e, 0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0xa6b6, 0x6813,
-+ 0x0008, 0xb810, 0x9085, 0x0500, 0x7002, 0xb814, 0x7006, 0x2069,
-+ 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0889, 0x080c,
-+ 0xa6a4, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c,
-+ 0x0005, 0x00d6, 0x0096, 0x080c, 0xa3d9, 0x7814, 0x2048, 0x080c,
-+ 0xd0cf, 0x1130, 0x7814, 0x9084, 0x0700, 0x8007, 0x0033, 0x0010,
-+ 0x9006, 0x001b, 0x009e, 0x00de, 0x0005, 0xa2f7, 0xa360, 0xa370,
-+ 0xa396, 0xa3a2, 0xa3b3, 0xa3bb, 0xa2f5, 0x080c, 0x0dc5, 0x0016,
-+ 0x0036, 0xa97c, 0x918c, 0x0003, 0x0118, 0x9186, 0x0003, 0x1198,
-+ 0xaba8, 0x7824, 0xd0cc, 0x1168, 0x7316, 0xa898, 0x701a, 0xa894,
-+ 0x701e, 0x003e, 0x001e, 0x2001, 0x19b2, 0x2004, 0x60c2, 0x0804,
-+ 0xa6b6, 0xc3e5, 0x0c88, 0x9186, 0x0001, 0x190c, 0x0dc5, 0xaba8,
-+ 0x7824, 0xd0cc, 0x1904, 0xa35d, 0x7316, 0xa898, 0x701a, 0xa894,
-+ 0x701e, 0xa8a4, 0x7026, 0xa8ac, 0x702e, 0x2009, 0x0018, 0x9384,
-+ 0x0300, 0x0570, 0xd3c4, 0x0110, 0xa8ac, 0x9108, 0xd3cc, 0x0110,
-+ 0xa8a4, 0x9108, 0x6810, 0x9085, 0x0010, 0x6812, 0x2011, 0x0258,
-+ 0x20e9, 0x0000, 0x22a0, 0x0156, 0x20a9, 0x0008, 0xa860, 0x20e0,
-+ 0xa85c, 0x9080, 0x002c, 0x2098, 0x4003, 0x6810, 0x8000, 0x6812,
-+ 0x2011, 0x0240, 0x22a0, 0x20a9, 0x0005, 0x4003, 0x6810, 0xc0a4,
-+ 0x6812, 0x015e, 0x9184, 0x0003, 0x0118, 0x2019, 0x0245, 0x201a,
-+ 0x61c2, 0x003e, 0x001e, 0x0804, 0xa6b6, 0xc3e5, 0x0804, 0xa31c,
-+ 0x2011, 0x0008, 0x2001, 0x180f, 0x2004, 0xd0a4, 0x0110, 0x2011,
-+ 0x0028, 0x7824, 0xd0cc, 0x1110, 0x7216, 0x0470, 0x0ce8, 0xc2e5,
-+ 0x2011, 0x0302, 0x0016, 0x782c, 0x701a, 0x7930, 0x711e, 0x9105,
-+ 0x0108, 0xc2dd, 0x001e, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
-+ 0x7027, 0x0012, 0x702f, 0x0008, 0x7043, 0x7000, 0x7047, 0x0500,
-+ 0x704f, 0x000a, 0x2069, 0x0200, 0x6813, 0x0009, 0x2071, 0x0240,
-+ 0x700b, 0x2500, 0x60c3, 0x0032, 0x0804, 0xa6b6, 0x2011, 0x0028,
-+ 0x7824, 0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804, 0xa6b6,
-+ 0x0cd0, 0xc2e5, 0x2011, 0x0100, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
-+ 0x7216, 0x702f, 0x0008, 0x7858, 0x9084, 0x00ff, 0x7036, 0x60c3,
-+ 0x0020, 0x0804, 0xa6b6, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0108,
-+ 0xc2e5, 0x7216, 0x0c08, 0x0036, 0x7b14, 0x9384, 0xff00, 0x7816,
-+ 0x9384, 0x00ff, 0x8001, 0x1138, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
-+ 0x7216, 0x003e, 0x0888, 0x0046, 0x2021, 0x0800, 0x0006, 0x7824,
-+ 0xd0cc, 0x000e, 0x0108, 0xc4e5, 0x7416, 0x004e, 0x701e, 0x003e,
-+ 0x0818, 0x00d6, 0x6813, 0x0008, 0xb810, 0x9085, 0x0700, 0x7002,
-+ 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e,
-+ 0x7824, 0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0xa6a4, 0x721a,
-+ 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005,
-+ 0x7013, 0x0889, 0x0c90, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007,
-+ 0x0013, 0x001e, 0x0005, 0xa40b, 0xa40b, 0xa40d, 0xa40b, 0xa40b,
-+ 0xa40b, 0xa427, 0xa40b, 0x080c, 0x0dc5, 0x7914, 0x918c, 0x08ff,
-+ 0x918d, 0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1847,
-+ 0x6804, 0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032,
-+ 0x0010, 0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0xa6b6, 0x2009,
-+ 0x0003, 0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0xaf87,
-+ 0x001e, 0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069,
-+ 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0888, 0x918d,
-+ 0x0008, 0x7116, 0x080c, 0xa6a4, 0x721a, 0x7a08, 0x7222, 0x2f10,
-+ 0x7226, 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056,
-+ 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810,
-+ 0x2058, 0x76dc, 0x96b4, 0x0028, 0x0110, 0x737c, 0x7480, 0x2500,
-+ 0x76dc, 0x96b4, 0x0028, 0x0140, 0x2001, 0x04ff, 0x6062, 0x6067,
-+ 0xffff, 0x636a, 0x646e, 0x0050, 0x2001, 0x00ff, 0x9085, 0x0400,
-+ 0x6062, 0x6067, 0xffff, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6073,
-+ 0x0530, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
- 0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00, 0x6082,
- 0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa838, 0x608a, 0xa834,
- 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e, 0xb86c, 0x60ce,
-- 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0, 0x629e,
-- 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe, 0x2009, 0x0092,
-- 0x6116, 0x2009, 0x07d0, 0x080c, 0x88c8, 0x003e, 0x004e, 0x005e,
-- 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x00b6, 0x0096,
-- 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046, 0x0036, 0x2061, 0x0100,
-- 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0, 0x2028, 0xb910, 0xba14,
-- 0x737c, 0x7480, 0x7820, 0x90be, 0x0006, 0x0904, 0xa61a, 0x90be,
-- 0x000a, 0x1904, 0xa5d6, 0xb8c0, 0x609e, 0x7814, 0x2048, 0xa87c,
-- 0xd0fc, 0x0558, 0xaf90, 0x9784, 0xff00, 0x9105, 0x6062, 0x873f,
-- 0x9784, 0xff00, 0x0006, 0x7814, 0x2048, 0xa878, 0xc0fc, 0x9005,
-- 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0198, 0x2039, 0x0098, 0x9705,
-- 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086, 0x0038, 0x9185, 0x2200,
-- 0x6062, 0x6073, 0x0129, 0x6077, 0x0000, 0xb8c0, 0x609e, 0x0050,
-- 0x2039, 0x0029, 0x9705, 0x6072, 0x0cc0, 0x9185, 0x0200, 0x6062,
-- 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94, 0x87ff, 0x1120,
-- 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a, 0x646e, 0x6077,
-- 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a,
-- 0x607f, 0x0000, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
-- 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
-- 0x080c, 0xaf73, 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005,
-- 0x0110, 0x2009, 0x1b58, 0x080c, 0x88c8, 0x003e, 0x004e, 0x005e,
-- 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005, 0x7804, 0x9086,
-- 0x0040, 0x0904, 0xa656, 0x9185, 0x0100, 0x6062, 0x6266, 0x636a,
-- 0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x60af, 0x95d5, 0x60d7,
-- 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a,
-- 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086, 0x7814, 0x2048,
-- 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca,
-- 0xb86c, 0x60ce, 0xbac0, 0x629e, 0x080c, 0xaf73, 0x2009, 0x07d0,
-- 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c,
-- 0x88c8, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e,
-- 0x00be, 0x0005, 0x7814, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086,
-- 0x0002, 0x0904, 0xa672, 0x9185, 0x0100, 0x6062, 0x6266, 0x636a,
-- 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084,
-- 0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838, 0x607e, 0x2f00, 0x6086,
-- 0x7808, 0x6082, 0xa890, 0x608a, 0xa88c, 0x608e, 0xa8b0, 0x60c6,
-- 0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108, 0x7932, 0xa8b0, 0x792c,
-- 0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
-- 0xbac0, 0x629e, 0x080c, 0xaf50, 0x0804, 0xa606, 0xb8cc, 0xd084,
-- 0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c, 0x784a, 0xa836, 0x2900,
-- 0xa83a, 0xb046, 0x9185, 0x0600, 0x6062, 0x6266, 0x636a, 0x646e,
-- 0x6073, 0x0829, 0x6077, 0x0000, 0x60af, 0x9575, 0x60d7, 0x0000,
-- 0x0804, 0xa5e9, 0x9185, 0x0700, 0x6062, 0x6266, 0x636a, 0x646e,
-- 0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073, 0x0889, 0x0010, 0x6073,
-- 0x0898, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-- 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086, 0x7808, 0x6082,
-- 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca,
-- 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0, 0x629e,
-- 0x7824, 0xd0cc, 0x0120, 0x080c, 0xaf73, 0x0804, 0xa606, 0x080c,
-- 0xaf50, 0x0804, 0xa606, 0x7a10, 0x00b6, 0x2258, 0xba8c, 0x8210,
-- 0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217, 0x0005, 0x00d6, 0x2069,
-- 0x19e8, 0x6843, 0x0001, 0x00de, 0x0005, 0x60a3, 0x0056, 0x60a7,
-- 0x9575, 0x00f1, 0x080c, 0x88ba, 0x0005, 0x0016, 0x2001, 0x180c,
-- 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128, 0x0089, 0x080c,
-- 0x88ba, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c, 0x2102, 0x2001,
-- 0x19e9, 0x2003, 0x0000, 0x2001, 0x19f1, 0x2003, 0x0000, 0x0c88,
-- 0x0006, 0x6014, 0x9084, 0x1804, 0x9085, 0x0009, 0x6016, 0x000e,
-- 0x0005, 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100, 0x61a4, 0x60a7,
-- 0x95f5, 0x6014, 0x9084, 0x1804, 0x9085, 0x0008, 0x6016, 0x000e,
-- 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005, 0x00c6,
-- 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c,
-- 0x7637, 0x11c0, 0x2001, 0x1a04, 0x2004, 0x9005, 0x15d0, 0x080c,
-- 0x76e4, 0x1160, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024,
-- 0xd084, 0x090c, 0x0dc5, 0x080c, 0x88ba, 0x0458, 0x00c6, 0x2061,
-- 0x19e8, 0x00c8, 0x6904, 0x9194, 0x4000, 0x0540, 0x0811, 0x080c,
-- 0x2d49, 0x00c6, 0x2061, 0x19e8, 0x6128, 0x9192, 0x0008, 0x1258,
-- 0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c, 0x88ba,
-- 0x080c, 0xa6e0, 0x0070, 0x6124, 0x91e5, 0x0000, 0x0140, 0x080c,
-- 0xf094, 0x080c, 0x88c3, 0x2009, 0x0014, 0x080c, 0xb352, 0x00ce,
-- 0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x1a04,
-- 0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19e8, 0x6128, 0x9192,
-- 0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce, 0x080c, 0x88ba, 0x080c,
-- 0x5fed, 0x2009, 0x1846, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096,
-- 0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x88d0, 0x2071,
-- 0x19e8, 0x713c, 0x81ff, 0x0904, 0xa7e9, 0x2061, 0x0100, 0x2069,
-- 0x0140, 0x080c, 0x7637, 0x11e0, 0x0036, 0x2019, 0x0002, 0x080c,
-- 0xaa49, 0x003e, 0x713c, 0x2160, 0x080c, 0xf094, 0x2009, 0x004a,
-- 0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006,
-- 0x2009, 0x004a, 0x080c, 0xb352, 0x080c, 0x76e4, 0x0804, 0xa7e9,
-- 0x080c, 0xa7f5, 0x0904, 0xa7e9, 0x6904, 0xd1f4, 0x0904, 0xa7f0,
-- 0x080c, 0x2d49, 0x00c6, 0x703c, 0x9065, 0x090c, 0x0dc5, 0x6020,
-- 0x00ce, 0x9086, 0x0006, 0x1528, 0x61c8, 0x60c4, 0x9105, 0x1508,
-- 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01e0, 0x6214, 0x9294, 0x1800,
-- 0x1128, 0x6224, 0x9294, 0x0002, 0x1560, 0x0030, 0xc0d4, 0x200a,
-- 0xd0cc, 0x0110, 0x080c, 0x2c7b, 0x6014, 0x9084, 0xe7fd, 0x9085,
-- 0x0010, 0x6016, 0x703c, 0x2060, 0x2009, 0x0049, 0x080c, 0xb352,
-- 0x00c0, 0x0036, 0x2019, 0x0001, 0x080c, 0xaa49, 0x003e, 0x713c,
-- 0x2160, 0x080c, 0xf094, 0x2009, 0x004a, 0x6220, 0x9296, 0x0009,
-- 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a, 0x080c,
-- 0xb352, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e, 0x0005,
-- 0xd1ec, 0x1904, 0xa7a0, 0x0804, 0xa7a2, 0x00d6, 0x00c6, 0x0096,
-- 0x703c, 0x9065, 0x090c, 0x0dc5, 0x2001, 0x0306, 0x200c, 0x9184,
-- 0x0030, 0x0904, 0xa8a8, 0x9184, 0x0048, 0x9086, 0x0008, 0x1904,
-- 0xa8a8, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
-- 0x1904, 0xa8a8, 0x2009, 0x022a, 0x2104, 0x2009, 0x022f, 0x210c,
-- 0x9116, 0x9084, 0x03ff, 0x918c, 0x03ff, 0x9294, 0x0400, 0x0110,
-- 0x9102, 0x0030, 0x2010, 0x2100, 0x9202, 0x2009, 0x0228, 0x9102,
-- 0x9082, 0x0005, 0x0250, 0x2008, 0x2001, 0x013b, 0x2004, 0x8004,
-- 0x8004, 0x8004, 0x9102, 0x1a04, 0xa8a8, 0x2009, 0x1a84, 0x2104,
-- 0x8000, 0x0208, 0x200a, 0x2069, 0x0100, 0x6914, 0x918c, 0x1984,
-- 0x918d, 0x0010, 0x6916, 0x69c8, 0x2011, 0x0020, 0x68c8, 0x9106,
-- 0x15c0, 0x8211, 0x1dd8, 0x2001, 0x0306, 0x2003, 0x4800, 0x2001,
-- 0x009a, 0x2003, 0x0004, 0x2001, 0x1a69, 0x2003, 0x0000, 0x2001,
-- 0x1a72, 0x2003, 0x0000, 0x6a88, 0x698c, 0x2200, 0x9105, 0x1170,
-- 0x0096, 0x6014, 0x2048, 0xa87c, 0xc0dc, 0xa87e, 0xa880, 0xc0fc,
-- 0xa882, 0x009e, 0x2c10, 0x080c, 0x1be0, 0x0040, 0x6014, 0x2048,
-- 0xaa3a, 0xa936, 0x6ac4, 0x69c8, 0xa946, 0xaa4a, 0x0126, 0x00c6,
-- 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x190c, 0x0dc5, 0x012e,
-- 0x0090, 0x2009, 0x1a85, 0x2104, 0x8000, 0x0208, 0x200a, 0x69c8,
-- 0x2011, 0x0020, 0x8211, 0x1df0, 0x68c8, 0x9106, 0x1dc0, 0x69c4,
-- 0x68c8, 0x9105, 0x0160, 0x6824, 0xd08c, 0x0110, 0x6827, 0x0002,
-- 0x7048, 0xc085, 0x704a, 0x0079, 0x7048, 0xc084, 0x704a, 0x2009,
-- 0x07d0, 0x080c, 0x88c8, 0x9006, 0x009e, 0x00ce, 0x00de, 0x0005,
-- 0x9085, 0x0001, 0x0cc8, 0x0026, 0x00e6, 0x2071, 0x19e8, 0x7048,
-- 0xd084, 0x01d8, 0x713c, 0x81ff, 0x01c0, 0x2071, 0x0100, 0x9188,
-- 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x7014, 0x9084, 0x1984,
-- 0x9085, 0x0012, 0x7016, 0x0048, 0x928e, 0x0009, 0x0db0, 0x7014,
-- 0x9084, 0x1984, 0x9085, 0x0016, 0x7016, 0x00ee, 0x002e, 0x0005,
-- 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0006,
-- 0x0126, 0x2091, 0x8000, 0x6010, 0x2058, 0xbca0, 0x2071, 0x19e8,
-- 0x7018, 0x2058, 0x8bff, 0x0190, 0xb8a0, 0x9406, 0x0118, 0xb854,
-- 0x2058, 0x0cc0, 0x6014, 0x0096, 0x2048, 0xac6c, 0xad70, 0xae78,
-- 0x009e, 0x080c, 0x6856, 0x0110, 0x9085, 0x0001, 0x012e, 0x000e,
-+ 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x2001, 0x1837,
-+ 0x2004, 0x9084, 0x0028, 0x0128, 0x609f, 0x0000, 0x2001, 0x0092,
-+ 0x0048, 0x6028, 0xc0bd, 0x602a, 0x609f, 0x00ff, 0x6027, 0xffff,
-+ 0x2001, 0x00b2, 0x6016, 0x2009, 0x07d0, 0x080c, 0x88c1, 0x003e,
- 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005,
-- 0x080c, 0xa0c1, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c, 0x7016,
-- 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005, 0x0130,
-- 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061, 0x1800,
-- 0x607c, 0x6180, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3,
-- 0x002c, 0x0804, 0xa6bd, 0x080c, 0xa0c1, 0x7003, 0x0f00, 0x7808,
-- 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814, 0x700e,
-- 0x60c3, 0x0008, 0x0804, 0xa6bd, 0x0156, 0x080c, 0xa10c, 0x7003,
-- 0x0200, 0x080c, 0x894c, 0x20a9, 0x0006, 0x2011, 0xffec, 0x2019,
-- 0xffed, 0x9ef0, 0x0002, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072,
-- 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xa943, 0x60c3,
-- 0x001c, 0x015e, 0x0804, 0xa6bd, 0x0016, 0x0026, 0x080c, 0xa0e8,
-- 0x080c, 0xa0fa, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814,
-- 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x0021, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x9192,
-- 0x0010, 0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2, 0x080c,
-- 0xa6bd, 0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003, 0x080c,
-- 0xaf79, 0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c, 0xa0c1,
-- 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6bd,
-- 0x0016, 0x0026, 0x080c, 0xa0c1, 0x20e9, 0x0000, 0x20a1, 0x024c,
-+ 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0036,
-+ 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0xb8a0,
-+ 0x2028, 0x76dc, 0xd6ac, 0x1168, 0x9582, 0x007e, 0x1250, 0x2500,
-+ 0x9094, 0xff80, 0x1130, 0x9080, 0x33b6, 0x2015, 0x9294, 0x00ff,
-+ 0x0020, 0xb910, 0xba14, 0x737c, 0x7480, 0x70dc, 0xd0ac, 0x1130,
-+ 0x9582, 0x007e, 0x1218, 0x9584, 0xff80, 0x0138, 0x9185, 0x0400,
-+ 0x6062, 0x6266, 0x636a, 0x646e, 0x0030, 0x6063, 0x0400, 0x6266,
-+ 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6072, 0x6077, 0x0000, 0xb864,
-+ 0xd0a4, 0x0110, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff,
-+ 0xb88e, 0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00,
-+ 0x6082, 0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa838, 0x608a,
-+ 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e, 0xb86c,
-+ 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0,
-+ 0x629e, 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe, 0x2009,
-+ 0x0092, 0x6116, 0x2009, 0x07d0, 0x080c, 0x88c1, 0x003e, 0x004e,
-+ 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x00b6,
-+ 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046, 0x0036, 0x2061,
-+ 0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0, 0x2028, 0xb910,
-+ 0xba14, 0x737c, 0x7480, 0x7820, 0x90be, 0x0006, 0x0904, 0xa613,
-+ 0x90be, 0x000a, 0x1904, 0xa5cf, 0xb8c0, 0x609e, 0x7814, 0x2048,
-+ 0xa87c, 0xd0fc, 0x0558, 0xaf90, 0x9784, 0xff00, 0x9105, 0x6062,
-+ 0x873f, 0x9784, 0xff00, 0x0006, 0x7814, 0x2048, 0xa878, 0xc0fc,
-+ 0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0198, 0x2039, 0x0098,
-+ 0x9705, 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086, 0x0038, 0x9185,
-+ 0x2200, 0x6062, 0x6073, 0x0129, 0x6077, 0x0000, 0xb8c0, 0x609e,
-+ 0x0050, 0x2039, 0x0029, 0x9705, 0x6072, 0x0cc0, 0x9185, 0x0200,
-+ 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94, 0x87ff,
-+ 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a, 0x646e,
-+ 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007,
-+ 0x607a, 0x607f, 0x0000, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848,
-+ 0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7,
-+ 0x0000, 0x080c, 0xaf6c, 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0,
-+ 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x88c1, 0x003e, 0x004e,
-+ 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005, 0x7804,
-+ 0x9086, 0x0040, 0x0904, 0xa64f, 0x9185, 0x0100, 0x6062, 0x6266,
-+ 0x636a, 0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x60af, 0x95d5,
-+ 0x60d7, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007,
-+ 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086, 0x7814,
-+ 0x2048, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844,
-+ 0x60ca, 0xb86c, 0x60ce, 0xbac0, 0x629e, 0x080c, 0xaf6c, 0x2009,
-+ 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58,
-+ 0x080c, 0x88c1, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee,
-+ 0x009e, 0x00be, 0x0005, 0x7814, 0x2048, 0xa87c, 0x9084, 0x0003,
-+ 0x9086, 0x0002, 0x0904, 0xa66b, 0x9185, 0x0100, 0x6062, 0x6266,
-+ 0x636a, 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0xb88c, 0x8000,
-+ 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838, 0x607e, 0x2f00,
-+ 0x6086, 0x7808, 0x6082, 0xa890, 0x608a, 0xa88c, 0x608e, 0xa8b0,
-+ 0x60c6, 0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108, 0x7932, 0xa8b0,
-+ 0x792c, 0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7,
-+ 0x0000, 0xbac0, 0x629e, 0x080c, 0xaf49, 0x0804, 0xa5ff, 0xb8cc,
-+ 0xd084, 0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c, 0x784a, 0xa836,
-+ 0x2900, 0xa83a, 0xb046, 0x9185, 0x0600, 0x6062, 0x6266, 0x636a,
-+ 0x646e, 0x6073, 0x0829, 0x6077, 0x0000, 0x60af, 0x9575, 0x60d7,
-+ 0x0000, 0x0804, 0xa5e2, 0x9185, 0x0700, 0x6062, 0x6266, 0x636a,
-+ 0x646e, 0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073, 0x0889, 0x0010,
-+ 0x6073, 0x0898, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff,
-+ 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086, 0x7808,
-+ 0x6082, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844,
-+ 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0,
-+ 0x629e, 0x7824, 0xd0cc, 0x0120, 0x080c, 0xaf6c, 0x0804, 0xa5ff,
-+ 0x080c, 0xaf49, 0x0804, 0xa5ff, 0x7a10, 0x00b6, 0x2258, 0xba8c,
-+ 0x8210, 0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217, 0x0005, 0x00d6,
-+ 0x2069, 0x19e8, 0x6843, 0x0001, 0x00de, 0x0005, 0x60a3, 0x0056,
-+ 0x60a7, 0x9575, 0x00f1, 0x080c, 0x88b3, 0x0005, 0x0016, 0x2001,
-+ 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128, 0x0089,
-+ 0x080c, 0x88b3, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c, 0x2102,
-+ 0x2001, 0x19e9, 0x2003, 0x0000, 0x2001, 0x19f1, 0x2003, 0x0000,
-+ 0x0c88, 0x0006, 0x6014, 0x9084, 0x1804, 0x9085, 0x0009, 0x6016,
-+ 0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100, 0x61a4,
-+ 0x60a7, 0x95f5, 0x6014, 0x9084, 0x1804, 0x9085, 0x0008, 0x6016,
-+ 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005,
-+ 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140,
-+ 0x080c, 0x7630, 0x11c0, 0x2001, 0x1a04, 0x2004, 0x9005, 0x15d0,
-+ 0x080c, 0x76dd, 0x1160, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120,
-+ 0x6024, 0xd084, 0x090c, 0x0dc5, 0x080c, 0x88b3, 0x0458, 0x00c6,
-+ 0x2061, 0x19e8, 0x00c8, 0x6904, 0x9194, 0x4000, 0x0540, 0x0811,
-+ 0x080c, 0x2d49, 0x00c6, 0x2061, 0x19e8, 0x6128, 0x9192, 0x0008,
-+ 0x1258, 0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c,
-+ 0x88b3, 0x080c, 0xa6d9, 0x0070, 0x6124, 0x91e5, 0x0000, 0x0140,
-+ 0x080c, 0xf08d, 0x080c, 0x88bc, 0x2009, 0x0014, 0x080c, 0xb34b,
-+ 0x00ce, 0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001,
-+ 0x1a04, 0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19e8, 0x6128,
-+ 0x9192, 0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce, 0x080c, 0x88b3,
-+ 0x080c, 0x5fe6, 0x2009, 0x1846, 0x2114, 0x8210, 0x220a, 0x0c10,
-+ 0x0096, 0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x88c9,
-+ 0x2071, 0x19e8, 0x713c, 0x81ff, 0x0904, 0xa7e2, 0x2061, 0x0100,
-+ 0x2069, 0x0140, 0x080c, 0x7630, 0x11e0, 0x0036, 0x2019, 0x0002,
-+ 0x080c, 0xaa42, 0x003e, 0x713c, 0x2160, 0x080c, 0xf08d, 0x2009,
-+ 0x004a, 0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b,
-+ 0x0006, 0x2009, 0x004a, 0x080c, 0xb34b, 0x080c, 0x76dd, 0x0804,
-+ 0xa7e2, 0x080c, 0xa7ee, 0x0904, 0xa7e2, 0x6904, 0xd1f4, 0x0904,
-+ 0xa7e9, 0x080c, 0x2d49, 0x00c6, 0x703c, 0x9065, 0x090c, 0x0dc5,
-+ 0x6020, 0x00ce, 0x9086, 0x0006, 0x1528, 0x61c8, 0x60c4, 0x9105,
-+ 0x1508, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01e0, 0x6214, 0x9294,
-+ 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1560, 0x0030, 0xc0d4,
-+ 0x200a, 0xd0cc, 0x0110, 0x080c, 0x2c7b, 0x6014, 0x9084, 0xe7fd,
-+ 0x9085, 0x0010, 0x6016, 0x703c, 0x2060, 0x2009, 0x0049, 0x080c,
-+ 0xb34b, 0x00c0, 0x0036, 0x2019, 0x0001, 0x080c, 0xaa42, 0x003e,
-+ 0x713c, 0x2160, 0x080c, 0xf08d, 0x2009, 0x004a, 0x6220, 0x9296,
-+ 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a,
-+ 0x080c, 0xb34b, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e,
-+ 0x0005, 0xd1ec, 0x1904, 0xa799, 0x0804, 0xa79b, 0x00d6, 0x00c6,
-+ 0x0096, 0x703c, 0x9065, 0x090c, 0x0dc5, 0x2001, 0x0306, 0x200c,
-+ 0x9184, 0x0030, 0x0904, 0xa8a1, 0x9184, 0x0048, 0x9086, 0x0008,
-+ 0x1904, 0xa8a1, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c,
-+ 0x9106, 0x1904, 0xa8a1, 0x2009, 0x022a, 0x2104, 0x2009, 0x022f,
-+ 0x210c, 0x9116, 0x9084, 0x03ff, 0x918c, 0x03ff, 0x9294, 0x0400,
-+ 0x0110, 0x9102, 0x0030, 0x2010, 0x2100, 0x9202, 0x2009, 0x0228,
-+ 0x9102, 0x9082, 0x0005, 0x0250, 0x2008, 0x2001, 0x013b, 0x2004,
-+ 0x8004, 0x8004, 0x8004, 0x9102, 0x1a04, 0xa8a1, 0x2009, 0x1a84,
-+ 0x2104, 0x8000, 0x0208, 0x200a, 0x2069, 0x0100, 0x6914, 0x918c,
-+ 0x1984, 0x918d, 0x0010, 0x6916, 0x69c8, 0x2011, 0x0020, 0x68c8,
-+ 0x9106, 0x15c0, 0x8211, 0x1dd8, 0x2001, 0x0306, 0x2003, 0x4800,
-+ 0x2001, 0x009a, 0x2003, 0x0004, 0x2001, 0x1a69, 0x2003, 0x0000,
-+ 0x2001, 0x1a72, 0x2003, 0x0000, 0x6a88, 0x698c, 0x2200, 0x9105,
-+ 0x1170, 0x0096, 0x6014, 0x2048, 0xa87c, 0xc0dc, 0xa87e, 0xa880,
-+ 0xc0fc, 0xa882, 0x009e, 0x2c10, 0x080c, 0x1be0, 0x0040, 0x6014,
-+ 0x2048, 0xaa3a, 0xa936, 0x6ac4, 0x69c8, 0xa946, 0xaa4a, 0x0126,
-+ 0x00c6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c79, 0x190c, 0x0dc5,
-+ 0x012e, 0x0090, 0x2009, 0x1a85, 0x2104, 0x8000, 0x0208, 0x200a,
-+ 0x69c8, 0x2011, 0x0020, 0x8211, 0x1df0, 0x68c8, 0x9106, 0x1dc0,
-+ 0x69c4, 0x68c8, 0x9105, 0x0160, 0x6824, 0xd08c, 0x0110, 0x6827,
-+ 0x0002, 0x7048, 0xc085, 0x704a, 0x0079, 0x7048, 0xc084, 0x704a,
-+ 0x2009, 0x07d0, 0x080c, 0x88c1, 0x9006, 0x009e, 0x00ce, 0x00de,
-+ 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0026, 0x00e6, 0x2071, 0x19e8,
-+ 0x7048, 0xd084, 0x01d8, 0x713c, 0x81ff, 0x01c0, 0x2071, 0x0100,
-+ 0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x7014, 0x9084,
-+ 0x1984, 0x9085, 0x0012, 0x7016, 0x0048, 0x928e, 0x0009, 0x0db0,
-+ 0x7014, 0x9084, 0x1984, 0x9085, 0x0016, 0x7016, 0x00ee, 0x002e,
-+ 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046,
-+ 0x0006, 0x0126, 0x2091, 0x8000, 0x6010, 0x2058, 0xbca0, 0x2071,
-+ 0x19e8, 0x7018, 0x2058, 0x8bff, 0x0190, 0xb8a0, 0x9406, 0x0118,
-+ 0xb854, 0x2058, 0x0cc0, 0x6014, 0x0096, 0x2048, 0xac6c, 0xad70,
-+ 0xae78, 0x009e, 0x080c, 0x684f, 0x0110, 0x9085, 0x0001, 0x012e,
-+ 0x000e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be,
-+ 0x0005, 0x080c, 0xa0ba, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c,
-+ 0x7016, 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005,
-+ 0x0130, 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061,
-+ 0x1800, 0x607c, 0x6180, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce,
-+ 0x60c3, 0x002c, 0x0804, 0xa6b6, 0x080c, 0xa0ba, 0x7003, 0x0f00,
-+ 0x7808, 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814,
-+ 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6b6, 0x0156, 0x080c, 0xa105,
-+ 0x7003, 0x0200, 0x080c, 0x8945, 0x20a9, 0x0006, 0x2011, 0xffec,
-+ 0x2019, 0xffed, 0x9ef0, 0x0002, 0x2305, 0x2072, 0x8e70, 0x2205,
-+ 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xa93c,
-+ 0x60c3, 0x001c, 0x015e, 0x0804, 0xa6b6, 0x0016, 0x0026, 0x080c,
-+ 0xa0e1, 0x080c, 0xa0f3, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0,
- 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c,
-- 0x9080, 0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8,
-- 0x4003, 0x8003, 0x60c2, 0x080c, 0xa6bd, 0x002e, 0x001e, 0x0005,
-- 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8,
-- 0x700c, 0x2060, 0x8cff, 0x0178, 0x080c, 0xd2e0, 0x1110, 0x080c,
-- 0xbcb6, 0x600c, 0x0006, 0x080c, 0xd54c, 0x080c, 0xb2d3, 0x080c,
-- 0xaaf1, 0x00ce, 0x0c78, 0x2c00, 0x700e, 0x700a, 0x012e, 0x000e,
-- 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6,
-- 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001,
-- 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079,
-- 0x0140, 0x2071, 0x19e8, 0x7024, 0x2060, 0x8cff, 0x01f8, 0x080c,
-- 0xa6e9, 0x6ac0, 0x68c3, 0x0000, 0x080c, 0x88c3, 0x00c6, 0x2061,
-- 0x0100, 0x080c, 0xb0ca, 0x00ce, 0x20a9, 0x01f4, 0x0461, 0x2009,
-- 0x0013, 0x080c, 0xb352, 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce,
-- 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x2001, 0x1800,
-- 0x2004, 0x9096, 0x0001, 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c,
-- 0x88c3, 0x6814, 0x9084, 0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817,
-- 0x0008, 0x68c3, 0x0000, 0x2011, 0x5f97, 0x080c, 0x883d, 0x20a9,
-- 0x01f4, 0x0009, 0x08c0, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004,
-- 0x7804, 0x9084, 0x4000, 0x190c, 0x2d49, 0x0090, 0xd084, 0x0118,
-- 0x6827, 0x4001, 0x0010, 0x1f04, 0xaa2b, 0x7804, 0x9084, 0x1000,
-+ 0x9080, 0x0021, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8,
-+ 0x9192, 0x0010, 0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2,
-+ 0x080c, 0xa6b6, 0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003,
-+ 0x080c, 0xaf72, 0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c,
-+ 0xa0ba, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804,
-+ 0xa6b6, 0x0016, 0x0026, 0x080c, 0xa0ba, 0x20e9, 0x0000, 0x20a1,
-+ 0x024c, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0,
-+ 0xa85c, 0x9080, 0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002,
-+ 0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0xa6b6, 0x002e, 0x001e,
-+ 0x0005, 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
-+ 0x19e8, 0x700c, 0x2060, 0x8cff, 0x0178, 0x080c, 0xd2d9, 0x1110,
-+ 0x080c, 0xbcaf, 0x600c, 0x0006, 0x080c, 0xd545, 0x080c, 0xb2cc,
-+ 0x080c, 0xaaea, 0x00ce, 0x0c78, 0x2c00, 0x700e, 0x700a, 0x012e,
-+ 0x000e, 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6,
-+ 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000,
-+ 0x2001, 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100,
-+ 0x2079, 0x0140, 0x2071, 0x19e8, 0x7024, 0x2060, 0x8cff, 0x01f8,
-+ 0x080c, 0xa6e2, 0x6ac0, 0x68c3, 0x0000, 0x080c, 0x88bc, 0x00c6,
-+ 0x2061, 0x0100, 0x080c, 0xb0c3, 0x00ce, 0x20a9, 0x01f4, 0x0461,
-+ 0x2009, 0x0013, 0x080c, 0xb34b, 0x000e, 0x001e, 0x002e, 0x006e,
-+ 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x2001,
-+ 0x1800, 0x2004, 0x9096, 0x0001, 0x0d78, 0x9096, 0x0004, 0x0d60,
-+ 0x080c, 0x88bc, 0x6814, 0x9084, 0x0001, 0x0110, 0x68a7, 0x95f5,
-+ 0x6817, 0x0008, 0x68c3, 0x0000, 0x2011, 0x5f90, 0x080c, 0x8836,
-+ 0x20a9, 0x01f4, 0x0009, 0x08c0, 0x6824, 0xd094, 0x0140, 0x6827,
-+ 0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2d49, 0x0090, 0xd084,
-+ 0x0118, 0x6827, 0x0001, 0x0010, 0x1f04, 0xaa24, 0x7804, 0x9084,
-+ 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c,
-+ 0x2d39, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
-+ 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c,
-+ 0x200c, 0x918c, 0xdbff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140,
-+ 0x2071, 0x19e8, 0x703c, 0x2060, 0x8cff, 0x0904, 0xaaad, 0x9386,
-+ 0x0002, 0x1128, 0x6814, 0x9084, 0x0002, 0x0904, 0xaaad, 0x68af,
-+ 0x95f5, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6,
-+ 0x68cb, 0x0008, 0x080c, 0x88c9, 0x080c, 0x2031, 0x2001, 0x0032,
-+ 0x6920, 0xd1bc, 0x0130, 0x8001, 0x1dd8, 0x692c, 0x918d, 0x0008,
-+ 0x692e, 0x20a9, 0x03e8, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004,
-+ 0x7804, 0x9084, 0x4000, 0x190c, 0x2d49, 0x0090, 0xd08c, 0x0118,
-+ 0x6827, 0x0002, 0x0010, 0x1f04, 0xaa83, 0x7804, 0x9084, 0x1000,
- 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39,
-- 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
-- 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c,
-- 0x918c, 0xdbff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071,
-- 0x19e8, 0x703c, 0x2060, 0x8cff, 0x0904, 0xaab4, 0x9386, 0x0002,
-- 0x1128, 0x6814, 0x9084, 0x0002, 0x0904, 0xaab4, 0x68af, 0x95f5,
-- 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb,
-- 0x0008, 0x080c, 0x88d0, 0x080c, 0x2031, 0x2001, 0x0032, 0x6920,
-- 0xd1bc, 0x0130, 0x8001, 0x1dd8, 0x692c, 0x918d, 0x0008, 0x692e,
-- 0x20a9, 0x03e8, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804,
-- 0x9084, 0x4000, 0x190c, 0x2d49, 0x0090, 0xd08c, 0x0118, 0x6827,
-- 0x0002, 0x0010, 0x1f04, 0xaa8a, 0x7804, 0x9084, 0x1000, 0x0138,
-- 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x6827,
-- 0x4000, 0x6824, 0x83ff, 0x1140, 0x2009, 0x0049, 0x6020, 0x9086,
-- 0x0009, 0x0110, 0x080c, 0xb352, 0x000e, 0x001e, 0x002e, 0x006e,
-- 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x00d6,
-- 0x0126, 0x2091, 0x8000, 0x2069, 0x19e8, 0x6a06, 0x012e, 0x00de,
-- 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19e8, 0x6a32,
-- 0x012e, 0x00de, 0x0005, 0x080c, 0xa284, 0x7047, 0x1000, 0x0098,
-- 0x080c, 0xa284, 0x7047, 0x4000, 0x0070, 0x080c, 0xa284, 0x7047,
-- 0x2000, 0x0048, 0x080c, 0xa284, 0x7047, 0x0400, 0x0020, 0x080c,
-- 0xa284, 0x7047, 0x0200, 0x7854, 0x7032, 0x60c3, 0x0020, 0x0804,
-- 0xa6bd, 0x00e6, 0x2071, 0x19e8, 0x7020, 0x9005, 0x0110, 0x8001,
-- 0x7022, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076,
-- 0x0066, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x7614,
-- 0x2660, 0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0xab96, 0x8cff,
-- 0x0904, 0xab96, 0x6020, 0x9086, 0x0006, 0x1904, 0xab91, 0x88ff,
-- 0x0138, 0x2800, 0x9c06, 0x1904, 0xab91, 0x2039, 0x0000, 0x0050,
-- 0x6010, 0x9b06, 0x1904, 0xab91, 0x85ff, 0x0120, 0x6054, 0x9106,
-- 0x1904, 0xab91, 0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0,
-- 0x9005, 0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001, 0x080c,
-- 0x88c3, 0x080c, 0xac1b, 0x7027, 0x0000, 0x0428, 0x080c, 0x88c3,
-- 0x6820, 0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3,
-- 0x0000, 0x080c, 0xac1b, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
-+ 0x6827, 0x4000, 0x6824, 0x83ff, 0x1140, 0x2009, 0x0049, 0x6020,
-+ 0x9086, 0x0009, 0x0110, 0x080c, 0xb34b, 0x000e, 0x001e, 0x002e,
-+ 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005,
-+ 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19e8, 0x6a06, 0x012e,
-+ 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19e8,
-+ 0x6a32, 0x012e, 0x00de, 0x0005, 0x080c, 0xa27d, 0x7047, 0x1000,
-+ 0x0098, 0x080c, 0xa27d, 0x7047, 0x4000, 0x0070, 0x080c, 0xa27d,
-+ 0x7047, 0x2000, 0x0048, 0x080c, 0xa27d, 0x7047, 0x0400, 0x0020,
-+ 0x080c, 0xa27d, 0x7047, 0x0200, 0x7854, 0x7032, 0x60c3, 0x0020,
-+ 0x0804, 0xa6b6, 0x00e6, 0x2071, 0x19e8, 0x7020, 0x9005, 0x0110,
-+ 0x8001, 0x7022, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
-+ 0x0076, 0x0066, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8,
-+ 0x7614, 0x2660, 0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0xab8f,
-+ 0x8cff, 0x0904, 0xab8f, 0x6020, 0x9086, 0x0006, 0x1904, 0xab8a,
-+ 0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904, 0xab8a, 0x2039, 0x0000,
-+ 0x0050, 0x6010, 0x9b06, 0x1904, 0xab8a, 0x85ff, 0x0120, 0x6054,
-+ 0x9106, 0x1904, 0xab8a, 0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100,
-+ 0x68c0, 0x9005, 0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001,
-+ 0x080c, 0x88bc, 0x080c, 0xac14, 0x7027, 0x0000, 0x0428, 0x080c,
-+ 0x88bc, 0x6820, 0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008,
-+ 0x68c3, 0x0000, 0x080c, 0xac14, 0x7027, 0x0000, 0x0036, 0x2069,
-+ 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-+ 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100, 0x6824, 0xd084,
-+ 0x0110, 0x6827, 0x0001, 0x003e, 0x7014, 0x9c36, 0x1110, 0x660c,
-+ 0x7616, 0x7010, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
-+ 0x7012, 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-+ 0x0110, 0x7e0e, 0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000,
-+ 0x6014, 0x0096, 0x2048, 0x080c, 0xd0cf, 0x0110, 0x080c, 0xebcd,
-+ 0x009e, 0x080c, 0xb2ff, 0x080c, 0xaaea, 0x88ff, 0x1190, 0x00ce,
-+ 0x0804, 0xab05, 0x2c78, 0x600c, 0x2060, 0x0804, 0xab05, 0x9006,
-+ 0x012e, 0x000e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
-+ 0x0005, 0x601b, 0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6,
-+ 0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126,
-+ 0x2091, 0x8000, 0x2071, 0x19e8, 0x7638, 0x2660, 0x2678, 0x8cff,
-+ 0x0904, 0xac03, 0x6020, 0x9086, 0x0006, 0x1904, 0xabfe, 0x87ff,
-+ 0x0128, 0x2700, 0x9c06, 0x1904, 0xabfe, 0x0040, 0x6010, 0x9b06,
-+ 0x15e8, 0x85ff, 0x0118, 0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06,
-+ 0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0xaa42, 0x7033, 0x0000,
-+ 0x9006, 0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x7038, 0x9c36,
-+ 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-+ 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066,
-+ 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-+ 0x6014, 0x2048, 0x080c, 0xd0cf, 0x0110, 0x080c, 0xebcd, 0x080c,
-+ 0xb2ff, 0x87ff, 0x1198, 0x00ce, 0x0804, 0xabaf, 0x2c78, 0x600c,
-+ 0x2060, 0x0804, 0xabaf, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e,
-+ 0x00ce, 0x009e, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000,
-+ 0x00ce, 0x97bd, 0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e8, 0x2001,
-+ 0x1800, 0x2004, 0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010,
-+ 0x7007, 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066,
-+ 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x2c10,
-+ 0x7638, 0x2660, 0x2678, 0x8cff, 0x0540, 0x2200, 0x9c06, 0x1508,
-+ 0x7038, 0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140,
-+ 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000,
-+ 0x660c, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-+ 0x0000, 0x6004, 0x9086, 0x0040, 0x090c, 0x999e, 0x9085, 0x0001,
-+ 0x0020, 0x2c78, 0x600c, 0x2060, 0x08b0, 0x012e, 0x000e, 0x002e,
-+ 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6,
-+ 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
-+ 0x2071, 0x19e8, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0904, 0xacfa,
-+ 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904, 0xacf5,
-+ 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904,
-+ 0xaccc, 0x080c, 0xa6e2, 0x68c3, 0x0000, 0x080c, 0xac14, 0x7027,
-+ 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
-+ 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069,
-+ 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x700c,
-+ 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008, 0x9c36, 0x1140, 0x2c00,
-+ 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000, 0x660c,
-+ 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-+ 0x0000, 0x080c, 0xd2c8, 0x1180, 0x080c, 0x3279, 0x080c, 0xd2d9,
-+ 0x1518, 0x080c, 0xbcaf, 0x0400, 0x080c, 0xac14, 0x6824, 0xd084,
-+ 0x09b0, 0x6827, 0x0001, 0x0898, 0x080c, 0xd2d9, 0x1118, 0x080c,
-+ 0xbcaf, 0x0090, 0x6014, 0x2048, 0x080c, 0xd0cf, 0x0168, 0x6020,
-+ 0x9086, 0x0003, 0x1508, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-+ 0x080c, 0x6e8b, 0x080c, 0xd2bc, 0x080c, 0xd545, 0x080c, 0xb2ff,
-+ 0x080c, 0xaaea, 0x00ce, 0x0804, 0xac75, 0x2c78, 0x600c, 0x2060,
-+ 0x0804, 0xac75, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de,
-+ 0x00ee, 0x00fe, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20,
-+ 0x080c, 0xebcd, 0x0c08, 0x00d6, 0x080c, 0xa105, 0x7003, 0x0200,
-+ 0x7007, 0x0014, 0x60c3, 0x0014, 0x20e1, 0x0001, 0x2099, 0x1989,
-+ 0x20e9, 0x0000, 0x20a1, 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023,
-+ 0x0004, 0x7027, 0x7878, 0x080c, 0xa6b6, 0x00de, 0x0005, 0x080c,
-+ 0xa105, 0x700b, 0x0800, 0x7814, 0x9084, 0xff00, 0x700e, 0x7814,
-+ 0x9084, 0x00ff, 0x7022, 0x782c, 0x7026, 0x7858, 0x9084, 0x00ff,
-+ 0x9085, 0x0200, 0x7002, 0x7858, 0x9084, 0xff00, 0x8007, 0x7006,
-+ 0x60c2, 0x0804, 0xa6b6, 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68,
-+ 0x2009, 0x0035, 0x080c, 0xd752, 0x00de, 0x1904, 0xada8, 0x080c,
-+ 0xa0ba, 0x7003, 0x1300, 0x782c, 0x080c, 0xaeae, 0x2068, 0x6820,
-+ 0x9086, 0x0003, 0x0560, 0x7810, 0x2058, 0xbaa0, 0x080c, 0xb236,
-+ 0x11d8, 0x9286, 0x007e, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe,
-+ 0x0498, 0x9286, 0x007f, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd,
-+ 0x0458, 0x9284, 0xff80, 0x0180, 0x9286, 0x0080, 0x1128, 0x700b,
-+ 0x00ff, 0x700f, 0xfffc, 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810,
-+ 0x700a, 0xb814, 0x700e, 0x00c0, 0x6098, 0x700e, 0x00a8, 0x080c,
-+ 0xb236, 0x1130, 0x7810, 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250,
-+ 0x00d6, 0x2069, 0x181f, 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e,
-+ 0x00de, 0x0010, 0x6034, 0x700e, 0x7838, 0x7012, 0x783c, 0x7016,
-+ 0x60c3, 0x000c, 0x001e, 0x00de, 0x080c, 0xa6b6, 0x00be, 0x0005,
-+ 0x781b, 0x0001, 0x7803, 0x0006, 0x001e, 0x00de, 0x00be, 0x0005,
-+ 0x792c, 0x9180, 0x0008, 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186,
-+ 0x0003, 0x0904, 0xae23, 0x9186, 0x0005, 0x0904, 0xae0b, 0x9186,
-+ 0x0004, 0x05d8, 0x9186, 0x0008, 0x0904, 0xae14, 0x7807, 0x0037,
-+ 0x782f, 0x0003, 0x7817, 0x1700, 0x080c, 0xae8b, 0x0005, 0x080c,
-+ 0xae4c, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6800,
-+ 0x0002, 0xadec, 0xadf7, 0xadee, 0xadf7, 0xadf3, 0xadec, 0xadec,
-+ 0xadf7, 0xadf7, 0xadf7, 0xadf7, 0xadec, 0xadec, 0xadec, 0xadec,
-+ 0xadec, 0xadf7, 0xadec, 0xadf7, 0x080c, 0x0dc5, 0x6824, 0xd0e4,
-+ 0x0110, 0xd0cc, 0x0110, 0x900e, 0x0010, 0x2009, 0x2000, 0x682c,
-+ 0x7022, 0x6830, 0x7026, 0x0804, 0xae45, 0x080c, 0xae4c, 0x00d6,
-+ 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6a00, 0x9286, 0x0002,
-+ 0x1108, 0x900e, 0x04d0, 0x080c, 0xae4c, 0x00d6, 0x0026, 0x792c,
-+ 0x2168, 0x2009, 0x4000, 0x0488, 0x04b9, 0x00d6, 0x0026, 0x792c,
-+ 0x2168, 0x2009, 0x4000, 0x9286, 0x0005, 0x0118, 0x9286, 0x0002,
-+ 0x1108, 0x900e, 0x0410, 0x0441, 0x00d6, 0x0026, 0x792c, 0x2168,
-+ 0x6814, 0x6924, 0xc185, 0x6926, 0x0096, 0x2048, 0xa9ac, 0xa834,
-+ 0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c,
-+ 0x9180, 0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004,
-+ 0x0118, 0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018,
-+ 0x002e, 0x00de, 0x0804, 0xa6b6, 0x00b6, 0x0036, 0x0046, 0x0056,
-+ 0x0066, 0x080c, 0xa105, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a,
-+ 0x793c, 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0xb236, 0x1118,
-+ 0x9092, 0x007e, 0x0268, 0x00d6, 0x2069, 0x181f, 0x2d2c, 0x8d68,
-+ 0x2d34, 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028,
-+ 0x901e, 0x6498, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008,
-+ 0x2004, 0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e,
-+ 0x0020, 0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e,
-+ 0x003e, 0x00be, 0x0005, 0x080c, 0xa105, 0x7003, 0x0100, 0x782c,
-+ 0x700a, 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6b6,
-+ 0x080c, 0xa0b1, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c,
-+ 0x700e, 0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff,
-+ 0x8007, 0x701a, 0x60c3, 0x0010, 0x0804, 0xa6b6, 0x00e6, 0x2071,
-+ 0x0240, 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8cc,
-+ 0xd084, 0x0120, 0x7844, 0x702a, 0x7848, 0x702e, 0x00be, 0x00fe,
-+ 0x000e, 0x00ee, 0x0005, 0x080c, 0xa0fc, 0x7003, 0x0100, 0x782c,
-+ 0x700a, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6b6, 0x0021,
-+ 0x60c3, 0x0000, 0x0804, 0xa6b6, 0x00d6, 0x080c, 0xaf87, 0xb810,
-+ 0x9085, 0x0300, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c,
-+ 0x700a, 0x6880, 0x700e, 0x7013, 0x0819, 0x080c, 0xa6a4, 0x721a,
-+ 0x2f10, 0x7222, 0x7a08, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005,
-+ 0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026,
-+ 0x080c, 0x2bce, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
-+ 0x002e, 0x080c, 0xa6d9, 0x080c, 0x88b3, 0x0005, 0x0036, 0x0096,
-+ 0x00d6, 0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294,
-+ 0x00fd, 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194,
-+ 0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384,
-+ 0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6,
-+ 0x2069, 0x0200, 0x080c, 0xaf87, 0x00de, 0x20e9, 0x0000, 0x20a1,
-+ 0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
-+ 0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286,
-+ 0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e,
-+ 0x0005, 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0,
-+ 0x9084, 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180,
-+ 0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140,
-+ 0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x19b3, 0x210c,
-+ 0x009e, 0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036,
-+ 0x6116, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088,
-+ 0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d,
-+ 0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009,
-+ 0x0008, 0x6912, 0x0005, 0x080c, 0xa0ba, 0x0016, 0x0026, 0x0096,
-+ 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x2001, 0x1837, 0x2004,
-+ 0x9084, 0x0028, 0x1138, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa,
-+ 0x1904, 0xb02c, 0x7003, 0x5400, 0x00c6, 0x2061, 0x1800, 0x607c,
-+ 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00, 0x9105, 0x700a,
-+ 0x6080, 0x700e, 0xa998, 0x918c, 0xff00, 0x7112, 0x20a9, 0x0004,
-+ 0x2009, 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104, 0x2012, 0x8108,
-+ 0x8210, 0x1f04, 0xafbd, 0x20a9, 0x0004, 0x2009, 0x1801, 0x2104,
-+ 0x2012, 0x8108, 0x8210, 0x1f04, 0xafc7, 0xa860, 0x20e0, 0xa85c,
-+ 0x9080, 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9, 0x0001, 0x4002,
-+ 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6, 0x2069, 0x0200,
-+ 0x080c, 0xaf72, 0x00de, 0x2071, 0x0240, 0x2011, 0x0240, 0x2009,
-+ 0x0002, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-+ 0x1dc0, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
-+ 0x8210, 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031, 0x2098, 0x2009,
-+ 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-+ 0x1dc0, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7, 0x9575,
-+ 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1168, 0x080c, 0x7630,
-+ 0x0150, 0x6028, 0xc0bd, 0x602a, 0x6014, 0x9084, 0x1804, 0x9085,
-+ 0x0029, 0x6016, 0x0010, 0x080c, 0xa6b6, 0x080c, 0x88b3, 0x00de,
-+ 0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0240, 0x2001,
-+ 0x2200, 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff, 0x2071, 0x0100,
-+ 0x709b, 0x00ff, 0x00ee, 0x0804, 0xafa2, 0x080c, 0xa0ba, 0x0016,
-+ 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x7003,
-+ 0x5500, 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c,
-+ 0xff00, 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00, 0xa8a0, 0x9084,
-+ 0x00ff, 0x9105, 0x700e, 0xa998, 0x918c, 0xff00, 0x2061, 0x1800,
-+ 0x607c, 0x9084, 0x00ff, 0x910d, 0x7112, 0x6180, 0x7116, 0x2009,
-+ 0x0008, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098, 0x2e10,
-+ 0x9290, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
-+ 0x8109, 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805, 0x2104, 0x2012,
-+ 0x8108, 0x8210, 0x1f04, 0xb07e, 0x20a9, 0x0002, 0x2009, 0x1801,
-+ 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xb088, 0x00d6, 0x0016,
-+ 0x2069, 0x0200, 0x080c, 0xaf72, 0x001e, 0x00de, 0x2071, 0x0240,
-+ 0x20a9, 0x0002, 0x2009, 0x1803, 0x2011, 0x0240, 0x2104, 0x2012,
-+ 0x8108, 0x8210, 0x1f04, 0xb09e, 0x2009, 0x0008, 0x4002, 0x8007,
-+ 0x2012, 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9, 0x0008, 0x2012,
-+ 0x8210, 0x1f04, 0xb0af, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056,
-+ 0x60a7, 0x9575, 0x080c, 0xa6b6, 0x080c, 0x88b3, 0x00de, 0x009e,
-+ 0x002e, 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9,
-+ 0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0,
-+ 0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1,
-+ 0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812,
-+ 0x0c60, 0x00de, 0x0005, 0x00d6, 0x0096, 0x6014, 0x2048, 0xa878,
-+ 0x6056, 0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946, 0xa84a, 0x6023,
-+ 0x0003, 0x6007, 0x0040, 0x6003, 0x0003, 0x600b, 0xffff, 0xa817,
-+ 0x0001, 0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813, 0x20c5, 0x080c,
-+ 0x955d, 0x0126, 0x2091, 0x8000, 0x080c, 0x9bcc, 0x012e, 0x009e,
-+ 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096,
-+ 0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x760c, 0x2660,
-+ 0x2678, 0x8cff, 0x0904, 0xb196, 0x7024, 0x9c06, 0x1520, 0x2069,
-+ 0x0100, 0x68c0, 0x9005, 0x0904, 0xb168, 0x080c, 0xa6e2, 0x68c3,
-+ 0x0000, 0x080c, 0xac14, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
- 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39,
- 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110,
-- 0x6827, 0x0001, 0x003e, 0x7014, 0x9c36, 0x1110, 0x660c, 0x7616,
-- 0x7010, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012,
-- 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-- 0x7e0e, 0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000, 0x6014,
-- 0x0096, 0x2048, 0x080c, 0xd0d6, 0x0110, 0x080c, 0xebd4, 0x009e,
-- 0x080c, 0xb306, 0x080c, 0xaaf1, 0x88ff, 0x1190, 0x00ce, 0x0804,
-- 0xab0c, 0x2c78, 0x600c, 0x2060, 0x0804, 0xab0c, 0x9006, 0x012e,
-- 0x000e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005,
-- 0x601b, 0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6,
-- 0x00d6, 0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
-- 0x8000, 0x2071, 0x19e8, 0x7638, 0x2660, 0x2678, 0x8cff, 0x0904,
-- 0xac0a, 0x6020, 0x9086, 0x0006, 0x1904, 0xac05, 0x87ff, 0x0128,
-- 0x2700, 0x9c06, 0x1904, 0xac05, 0x0040, 0x6010, 0x9b06, 0x15e8,
-- 0x85ff, 0x0118, 0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06, 0x1168,
-- 0x0036, 0x2019, 0x0001, 0x080c, 0xaa49, 0x7033, 0x0000, 0x9006,
-- 0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x7038, 0x9c36, 0x1110,
-- 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
-- 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066, 0x2c00,
-- 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014,
-- 0x2048, 0x080c, 0xd0d6, 0x0110, 0x080c, 0xebd4, 0x080c, 0xb306,
-- 0x87ff, 0x1198, 0x00ce, 0x0804, 0xabb6, 0x2c78, 0x600c, 0x2060,
-- 0x0804, 0xabb6, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce,
-- 0x009e, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce,
-- 0x97bd, 0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e8, 0x2001, 0x1800,
-- 0x2004, 0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010, 0x7007,
-- 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026,
-- 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x2c10, 0x7638,
-- 0x2660, 0x2678, 0x8cff, 0x0540, 0x2200, 0x9c06, 0x1508, 0x7038,
-- 0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00,
-- 0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c,
-- 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-- 0x6004, 0x9086, 0x0040, 0x090c, 0x99a5, 0x9085, 0x0001, 0x0020,
-- 0x2c78, 0x600c, 0x2060, 0x08b0, 0x012e, 0x000e, 0x002e, 0x006e,
-- 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6, 0x00d6,
-- 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
-- 0x19e8, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0904, 0xad01, 0x6010,
-- 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904, 0xacfc, 0x7024,
-- 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xacd3,
-- 0x080c, 0xa6e9, 0x68c3, 0x0000, 0x080c, 0xac1b, 0x7027, 0x0000,
-- 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
-- 0x0100, 0x080c, 0x2d39, 0x9006, 0x080c, 0x2d39, 0x2069, 0x0100,
-- 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x700c, 0x9c36,
-- 0x1110, 0x660c, 0x760e, 0x7008, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-- 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000, 0x660c, 0x0066,
-- 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-- 0x080c, 0xd2cf, 0x1180, 0x080c, 0x3279, 0x080c, 0xd2e0, 0x1518,
-- 0x080c, 0xbcb6, 0x0400, 0x080c, 0xac1b, 0x6824, 0xd084, 0x09b0,
-- 0x6827, 0x0001, 0x0898, 0x080c, 0xd2e0, 0x1118, 0x080c, 0xbcb6,
-- 0x0090, 0x6014, 0x2048, 0x080c, 0xd0d6, 0x0168, 0x6020, 0x9086,
-- 0x0003, 0x1508, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-- 0x6e92, 0x080c, 0xd2c3, 0x080c, 0xd54c, 0x080c, 0xb306, 0x080c,
-- 0xaaf1, 0x00ce, 0x0804, 0xac7c, 0x2c78, 0x600c, 0x2060, 0x0804,
-- 0xac7c, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee,
-- 0x00fe, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20, 0x080c,
-- 0xebd4, 0x0c08, 0x00d6, 0x080c, 0xa10c, 0x7003, 0x0200, 0x7007,
-- 0x0014, 0x60c3, 0x0014, 0x20e1, 0x0001, 0x2099, 0x1989, 0x20e9,
-- 0x0000, 0x20a1, 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023, 0x0004,
-- 0x7027, 0x7878, 0x080c, 0xa6bd, 0x00de, 0x0005, 0x080c, 0xa10c,
-- 0x700b, 0x0800, 0x7814, 0x9084, 0xff00, 0x700e, 0x7814, 0x9084,
-- 0x00ff, 0x7022, 0x782c, 0x7026, 0x7858, 0x9084, 0x00ff, 0x9085,
-- 0x0200, 0x7002, 0x7858, 0x9084, 0xff00, 0x8007, 0x7006, 0x60c2,
-- 0x0804, 0xa6bd, 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009,
-- 0x0035, 0x080c, 0xd759, 0x00de, 0x1904, 0xadaf, 0x080c, 0xa0c1,
-- 0x7003, 0x1300, 0x782c, 0x080c, 0xaeb5, 0x2068, 0x6820, 0x9086,
-- 0x0003, 0x0560, 0x7810, 0x2058, 0xbaa0, 0x080c, 0xb23d, 0x11d8,
-- 0x9286, 0x007e, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498,
-- 0x9286, 0x007f, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458,
-- 0x9284, 0xff80, 0x0180, 0x9286, 0x0080, 0x1128, 0x700b, 0x00ff,
-- 0x700f, 0xfffc, 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a,
-- 0xb814, 0x700e, 0x00c0, 0x6098, 0x700e, 0x00a8, 0x080c, 0xb23d,
-- 0x1130, 0x7810, 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6,
-- 0x2069, 0x181f, 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de,
-- 0x0010, 0x6034, 0x700e, 0x7838, 0x7012, 0x783c, 0x7016, 0x60c3,
-- 0x000c, 0x001e, 0x00de, 0x080c, 0xa6bd, 0x00be, 0x0005, 0x781b,
-- 0x0001, 0x7803, 0x0006, 0x001e, 0x00de, 0x00be, 0x0005, 0x792c,
-- 0x9180, 0x0008, 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186, 0x0003,
-- 0x0904, 0xae2a, 0x9186, 0x0005, 0x0904, 0xae12, 0x9186, 0x0004,
-- 0x05d8, 0x9186, 0x0008, 0x0904, 0xae1b, 0x7807, 0x0037, 0x782f,
-- 0x0003, 0x7817, 0x1700, 0x080c, 0xae92, 0x0005, 0x080c, 0xae53,
-- 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6800, 0x0002,
-- 0xadf3, 0xadfe, 0xadf5, 0xadfe, 0xadfa, 0xadf3, 0xadf3, 0xadfe,
-- 0xadfe, 0xadfe, 0xadfe, 0xadf3, 0xadf3, 0xadf3, 0xadf3, 0xadf3,
-- 0xadfe, 0xadf3, 0xadfe, 0x080c, 0x0dc5, 0x6824, 0xd0e4, 0x0110,
-- 0xd0cc, 0x0110, 0x900e, 0x0010, 0x2009, 0x2000, 0x682c, 0x7022,
-- 0x6830, 0x7026, 0x0804, 0xae4c, 0x080c, 0xae53, 0x00d6, 0x0026,
-- 0x792c, 0x2168, 0x2009, 0x4000, 0x6a00, 0x9286, 0x0002, 0x1108,
-- 0x900e, 0x04d0, 0x080c, 0xae53, 0x00d6, 0x0026, 0x792c, 0x2168,
-- 0x2009, 0x4000, 0x0488, 0x04b9, 0x00d6, 0x0026, 0x792c, 0x2168,
-- 0x2009, 0x4000, 0x9286, 0x0005, 0x0118, 0x9286, 0x0002, 0x1108,
-- 0x900e, 0x0410, 0x0441, 0x00d6, 0x0026, 0x792c, 0x2168, 0x6814,
-- 0x6924, 0xc185, 0x6926, 0x0096, 0x2048, 0xa9ac, 0xa834, 0x9112,
-- 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c, 0x9180,
-- 0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004, 0x0118,
-- 0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018, 0x002e,
-- 0x00de, 0x0804, 0xa6bd, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066,
-- 0x080c, 0xa10c, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c,
-- 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0xb23d, 0x1118, 0x9092,
-- 0x007e, 0x0268, 0x00d6, 0x2069, 0x181f, 0x2d2c, 0x8d68, 0x2d34,
-- 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e,
-- 0x6498, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008, 0x2004,
-- 0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e, 0x0020,
-- 0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e, 0x003e,
-- 0x00be, 0x0005, 0x080c, 0xa10c, 0x7003, 0x0100, 0x782c, 0x700a,
-- 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6bd, 0x080c,
-- 0xa0b8, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c, 0x700e,
-- 0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff, 0x8007,
-- 0x701a, 0x60c3, 0x0010, 0x0804, 0xa6bd, 0x00e6, 0x2071, 0x0240,
-- 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8cc, 0xd084,
-- 0x0120, 0x7844, 0x702a, 0x7848, 0x702e, 0x00be, 0x00fe, 0x000e,
-- 0x00ee, 0x0005, 0x080c, 0xa103, 0x7003, 0x0100, 0x782c, 0x700a,
-- 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa6bd, 0x0021, 0x60c3,
-- 0x0000, 0x0804, 0xa6bd, 0x00d6, 0x080c, 0xaf8e, 0xb810, 0x9085,
-- 0x0300, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a,
-- 0x6880, 0x700e, 0x7013, 0x0819, 0x080c, 0xa6ab, 0x721a, 0x2f10,
-- 0x7222, 0x7a08, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005, 0x00a9,
-- 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026, 0x080c,
-- 0x2bce, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e,
-- 0x080c, 0xa6e0, 0x080c, 0x88ba, 0x0005, 0x0036, 0x0096, 0x00d6,
-- 0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294, 0x00fd,
-- 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194, 0x00ff,
-- 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384, 0xff00,
-- 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6, 0x2069,
-- 0x0200, 0x080c, 0xaf8e, 0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240,
-- 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098,
-- 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286, 0x3000,
-- 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e, 0x0005,
-- 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0, 0x9084,
-- 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180, 0x7824,
-- 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140, 0x2001,
-- 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x19b3, 0x210c, 0x009e,
-- 0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036, 0x6116,
-- 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088, 0x2009,
-- 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d, 0x0040,
-- 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009, 0x0008,
-- 0x6912, 0x0005, 0x080c, 0xa0c1, 0x0016, 0x0026, 0x0096, 0x00d6,
-- 0x7814, 0x2048, 0x7013, 0x0138, 0x2001, 0x1837, 0x2004, 0x9084,
-- 0x0028, 0x1138, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x1904,
-- 0xb033, 0x7003, 0x5400, 0x00c6, 0x2061, 0x1800, 0x607c, 0x9084,
-- 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00, 0x9105, 0x700a, 0x6080,
-- 0x700e, 0xa998, 0x918c, 0xff00, 0x7112, 0x20a9, 0x0004, 0x2009,
-- 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104, 0x2012, 0x8108, 0x8210,
-- 0x1f04, 0xafc4, 0x20a9, 0x0004, 0x2009, 0x1801, 0x2104, 0x2012,
-- 0x8108, 0x8210, 0x1f04, 0xafce, 0xa860, 0x20e0, 0xa85c, 0x9080,
-- 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007,
-- 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6, 0x2069, 0x0200, 0x080c,
-- 0xaf79, 0x00de, 0x2071, 0x0240, 0x2011, 0x0240, 0x2009, 0x0002,
-- 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0,
-- 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
-- 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031, 0x2098, 0x2009, 0x0008,
-- 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0,
-- 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x2001,
-- 0x1837, 0x2004, 0x9084, 0x0028, 0x1168, 0x080c, 0x7637, 0x0150,
-- 0x6028, 0xc0bd, 0x602a, 0x6014, 0x9084, 0x1804, 0x9085, 0x0029,
-- 0x6016, 0x0010, 0x080c, 0xa6bd, 0x080c, 0x88ba, 0x00de, 0x009e,
-- 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0240, 0x2001, 0x2200,
-- 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff, 0x2071, 0x0100, 0x709b,
-- 0x00ff, 0x00ee, 0x0804, 0xafa9, 0x080c, 0xa0c1, 0x0016, 0x0026,
-- 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x7003, 0x5500,
-- 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00,
-- 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00, 0xa8a0, 0x9084, 0x00ff,
-- 0x9105, 0x700e, 0xa998, 0x918c, 0xff00, 0x2061, 0x1800, 0x607c,
-- 0x9084, 0x00ff, 0x910d, 0x7112, 0x6180, 0x7116, 0x2009, 0x0008,
-- 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098, 0x2e10, 0x9290,
-- 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-- 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805, 0x2104, 0x2012, 0x8108,
-- 0x8210, 0x1f04, 0xb085, 0x20a9, 0x0002, 0x2009, 0x1801, 0x2104,
-- 0x2012, 0x8108, 0x8210, 0x1f04, 0xb08f, 0x00d6, 0x0016, 0x2069,
-- 0x0200, 0x080c, 0xaf79, 0x001e, 0x00de, 0x2071, 0x0240, 0x20a9,
-- 0x0002, 0x2009, 0x1803, 0x2011, 0x0240, 0x2104, 0x2012, 0x8108,
-- 0x8210, 0x1f04, 0xb0a5, 0x2009, 0x0008, 0x4002, 0x8007, 0x2012,
-- 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9, 0x0008, 0x2012, 0x8210,
-- 0x1f04, 0xb0b6, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7,
-- 0x9575, 0x080c, 0xa6bd, 0x080c, 0x88ba, 0x00de, 0x009e, 0x002e,
-- 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9, 0x0000,
-- 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0, 0x0128,
-- 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1, 0x0240,
-- 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812, 0x0c60,
-- 0x00de, 0x0005, 0x00d6, 0x0096, 0x6014, 0x2048, 0xa878, 0x6056,
-- 0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946, 0xa84a, 0x6023, 0x0003,
-- 0x6007, 0x0040, 0x6003, 0x0003, 0x600b, 0xffff, 0xa817, 0x0001,
-- 0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813, 0x20c5, 0x080c, 0x9564,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x9bd3, 0x012e, 0x009e, 0x00de,
-- 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096, 0x0066,
-- 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x760c, 0x2660, 0x2678,
-- 0x8cff, 0x0904, 0xb19d, 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100,
-- 0x68c0, 0x9005, 0x0904, 0xb16f, 0x080c, 0xa6e9, 0x68c3, 0x0000,
-- 0x080c, 0xac1b, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
-- 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2d39, 0x9006,
-- 0x080c, 0x2d39, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827,
-- 0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008,
-- 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010,
-- 0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
-- 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xd2cf, 0x1180, 0x080c,
-- 0x3279, 0x080c, 0xd2e0, 0x1518, 0x080c, 0xbcb6, 0x0400, 0x080c,
-- 0xac1b, 0x6824, 0xd084, 0x09b0, 0x6827, 0x0001, 0x0898, 0x080c,
-- 0xd2e0, 0x1118, 0x080c, 0xbcb6, 0x0090, 0x6014, 0x2048, 0x080c,
-- 0xd0d6, 0x0168, 0x6020, 0x9086, 0x0003, 0x1520, 0xa867, 0x0103,
-- 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e9f, 0x080c, 0xd2c3, 0x080c,
-- 0xd54c, 0x080c, 0xb306, 0x080c, 0xaaf1, 0x00ce, 0x0804, 0xb120,
-- 0x2c78, 0x600c, 0x2060, 0x0804, 0xb120, 0x700f, 0x0000, 0x700b,
-- 0x0000, 0x012e, 0x006e, 0x009e, 0x00ae, 0x00ce, 0x00de, 0x00ee,
-- 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d08, 0x080c, 0xebd4,
-- 0x08f0, 0x00d6, 0x0156, 0x080c, 0xa10c, 0x7a14, 0x82ff, 0x0138,
-- 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0490, 0x7003,
-- 0x0200, 0x7007, 0x0000, 0x2069, 0x1800, 0x901e, 0x6800, 0x9086,
-- 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c, 0x7637, 0x1110, 0xc3ad,
-- 0x0008, 0xc3a5, 0x6adc, 0xd29c, 0x1110, 0xd2ac, 0x0108, 0xc39d,
-- 0x730e, 0x080c, 0x894c, 0x20a9, 0x0006, 0x2011, 0xffec, 0x2019,
-- 0xffed, 0x2071, 0x0250, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072,
-- 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xb1e3, 0x60c3,
-- 0x0020, 0x080c, 0xa6bd, 0x015e, 0x00de, 0x0005, 0x0156, 0x080c,
-- 0xa10c, 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff, 0x0118, 0x9282,
-- 0x000e, 0x1238, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008,
-- 0x0488, 0x7003, 0x0200, 0x7007, 0x001c, 0x700f, 0x0001, 0x2011,
-- 0x19be, 0x2204, 0x8007, 0x701a, 0x8210, 0x2204, 0x8007, 0x701e,
-- 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181f,
-- 0x2004, 0x7022, 0x2001, 0x1820, 0x2004, 0x7026, 0x0030, 0x2001,
-- 0x1818, 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004, 0x20e1,
-- 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003,
-- 0x60c3, 0x001c, 0x015e, 0x0804, 0xa6bd, 0x0006, 0x2001, 0x1837,
-- 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003, 0x080c, 0xaabf,
-- 0x2011, 0x0002, 0x080c, 0xaac9, 0x080c, 0xa9d3, 0x0036, 0x901e,
-- 0x080c, 0xaa49, 0x003e, 0x0005, 0x080c, 0x33af, 0x0188, 0x0016,
-- 0x00b6, 0x00c6, 0x7010, 0x9085, 0x0020, 0x7012, 0x2009, 0x007e,
-- 0x080c, 0x6724, 0xb85c, 0xc0ac, 0xb85e, 0x00ce, 0x00be, 0x001e,
-- 0x0005, 0x2071, 0x188d, 0x7000, 0x9005, 0x0140, 0x2001, 0x0976,
-- 0x2071, 0x1800, 0x7076, 0x707a, 0x706b, 0xffe0, 0x2071, 0x1800,
-- 0x7074, 0x7056, 0x705b, 0x1cd0, 0x0005, 0x00e6, 0x0126, 0x2071,
-- 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0010, 0x0608, 0x7058,
-- 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7068,
-- 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008,
-- 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230, 0x755a,
-- 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc0,
-- 0x9006, 0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7554, 0x9582, 0x0010,
-- 0x0600, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0,
-- 0x0018, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98,
-- 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502,
-- 0x1228, 0x755a, 0x9085, 0x0001, 0x00ee, 0x0005, 0x705b, 0x1cd0,
-- 0x0cc8, 0x9006, 0x0cc8, 0x9c82, 0x1cd0, 0x0a0c, 0x0dc5, 0x2001,
-- 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0dc5, 0x9006, 0x6006, 0x600a,
-- 0x600e, 0x6016, 0x601a, 0x6012, 0x6023, 0x0000, 0x6003, 0x0000,
-- 0x601e, 0x6056, 0x605a, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036,
-- 0x603a, 0x603e, 0x6042, 0x602a, 0x2061, 0x1800, 0x6054, 0x8000,
-- 0x6056, 0x9086, 0x0001, 0x0108, 0x0005, 0x0126, 0x2091, 0x8000,
-- 0x0016, 0x080c, 0x9ab1, 0x001e, 0x012e, 0x0cb0, 0x0006, 0x6000,
-- 0x9086, 0x0000, 0x01c0, 0x601c, 0xd084, 0x190c, 0x1a8e, 0x6017,
-- 0x0000, 0x6023, 0x0007, 0x2001, 0x1986, 0x2004, 0x0006, 0x9082,
-- 0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c, 0xee87, 0x6043,
-- 0x0000, 0x6013, 0x0000, 0x000e, 0x0005, 0x00e6, 0x0126, 0x2071,
-- 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001, 0x0608, 0x7058,
-- 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7068,
-- 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008,
-- 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230, 0x755a,
-- 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc0,
-- 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0xb365, 0xb36e,
-- 0xb389, 0xb3a4, 0xd82b, 0xd848, 0xd863, 0xb365, 0xb36e, 0x9100,
-- 0xb3bd, 0xb365, 0xb365, 0xb365, 0xb365, 0x9186, 0x0013, 0x1128,
-- 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x0005, 0x0005, 0x0066, 0x6000,
-- 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e, 0x0005, 0xb387,
-- 0xbb05, 0xbcfd, 0xb387, 0xbd93, 0xb6a0, 0xb387, 0xb387, 0xba87,
-- 0xc3b1, 0xb387, 0xb387, 0xb387, 0xb387, 0xb387, 0xb387, 0x080c,
-- 0x0dc5, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013,
-- 0x006e, 0x0005, 0xb3a2, 0xca7e, 0xb3a2, 0xb3a2, 0xb3a2, 0xb3a2,
-- 0xb3a2, 0xb3a2, 0xca15, 0xcc00, 0xb3a2, 0xcabf, 0xcb3e, 0xcabf,
-- 0xcb3e, 0xb3a2, 0x080c, 0x0dc5, 0x6000, 0x9082, 0x0010, 0x1a0c,
-- 0x0dc5, 0x6000, 0x0002, 0xb3bb, 0xc3f8, 0xc4c0, 0xc5f3, 0xc7a2,
-- 0xb3bb, 0xb3bb, 0xb3bb, 0xc3cc, 0xc9a1, 0xc9a4, 0xb3bb, 0xb3bb,
-- 0xb3bb, 0xb3bb, 0xc9d3, 0x080c, 0x0dc5, 0x0066, 0x6000, 0x90b2,
-- 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e, 0x0005, 0xb3d6, 0xb3d6,
-- 0xb419, 0xb4b8, 0xb54d, 0xb3d6, 0xb3d6, 0xb3d6, 0xb3d8, 0xb3d6,
-- 0xb3d6, 0xb3d6, 0xb3d6, 0xb3d6, 0xb3d6, 0xb3d6, 0x080c, 0x0dc5,
-- 0x9186, 0x004c, 0x0588, 0x9186, 0x0003, 0x190c, 0x0dc5, 0x0096,
-- 0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003, 0x6106, 0x6014, 0x2048,
-- 0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e, 0xa8ac, 0xa846, 0xa8b0,
-- 0xa84a, 0x9006, 0xa836, 0xa83a, 0xa884, 0x9092, 0x199a, 0x0210,
-- 0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x009e,
-- 0x2c10, 0x080c, 0x1be0, 0x080c, 0x9564, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x9bd3, 0x012e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0,
-- 0x00be, 0x2c00, 0x080c, 0xb56f, 0x080c, 0xd7fb, 0x6003, 0x0007,
-- 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079, 0x1800, 0x7a90, 0x6014,
-- 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc,
-- 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220,
-- 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b,
-- 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02, 0x0006, 0x0016, 0x0026,
-- 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400, 0x9005, 0x1108, 0x009a,
-- 0x2100, 0x9086, 0x0015, 0x1118, 0x2001, 0x0001, 0x0038, 0x2100,
-- 0x9086, 0x0016, 0x0118, 0x2001, 0x0001, 0x002a, 0x94a4, 0x0007,
-- 0x8423, 0x9405, 0x0002, 0xb480, 0xb480, 0xb47b, 0xb47e, 0xb480,
-- 0xb478, 0xb46b, 0xb46b, 0xb46b, 0xb46b, 0xb46b, 0xb46b, 0xb46b,
-- 0xb46b, 0xb46b, 0xb46b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e,
-- 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e, 0x00de, 0x080c, 0x0dc5,
-- 0x080c, 0xbfab, 0x0028, 0x080c, 0xc0e9, 0x0010, 0x080c, 0xc1df,
-- 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896,
-- 0x000e, 0x080c, 0xb62d, 0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050,
-- 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-- 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031,
-- 0x0000, 0x2041, 0x126c, 0x080c, 0xb7f1, 0x0160, 0x000e, 0x9005,
-- 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005, 0x00fe, 0x009e, 0x00de,
-- 0x0804, 0xb2d3, 0x2001, 0x002c, 0x900e, 0x080c, 0xb693, 0x0c70,
-- 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047,
-- 0x0a0c, 0x0dc5, 0x91b2, 0x0050, 0x1a0c, 0x0dc5, 0x9182, 0x0047,
-- 0x00ca, 0x2001, 0x0109, 0x2004, 0xd08c, 0x0198, 0x0126, 0x2091,
-- 0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x94b1, 0x002e, 0x001e,
-- 0x000e, 0x012e, 0xa001, 0x6000, 0x9086, 0x0002, 0x1110, 0x0804,
-- 0xb419, 0x0005, 0xb4eb, 0xb4eb, 0xb4ed, 0xb523, 0xb4eb, 0xb4eb,
-- 0xb4eb, 0xb4eb, 0xb536, 0x080c, 0x0dc5, 0x00d6, 0x0016, 0x0096,
-- 0x080c, 0x9a61, 0x080c, 0x9bd3, 0x6003, 0x0004, 0x6114, 0x2148,
-- 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894,
-- 0x9005, 0x0140, 0x2001, 0x0000, 0x900e, 0x080c, 0xb693, 0x080c,
-- 0xb2d3, 0x00a8, 0x6003, 0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178,
-- 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4,
-- 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e,
-- 0x001e, 0x00de, 0x0005, 0x080c, 0x9a61, 0x00d6, 0x0096, 0x6114,
-- 0x2148, 0x080c, 0xd0d8, 0x0120, 0xa87b, 0x0006, 0x080c, 0x6e9f,
-- 0x009e, 0x00de, 0x080c, 0xb2d3, 0x0804, 0x9bd3, 0x080c, 0x9a61,
-- 0x080c, 0x3250, 0x080c, 0xd7f8, 0x00d6, 0x0096, 0x6114, 0x2148,
-- 0x080c, 0xd0d8, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6e9f, 0x009e,
-- 0x00de, 0x080c, 0xb2d3, 0x0804, 0x9bd3, 0x9182, 0x0047, 0x0002,
-- 0xb55d, 0xb55f, 0xb55d, 0xb55d, 0xb55d, 0xb55d, 0xb55d, 0xb55d,
-- 0xb55d, 0xb55d, 0xb55d, 0xb55d, 0xb55f, 0x080c, 0x0dc5, 0x00d6,
-- 0x0096, 0x601f, 0x0000, 0x6114, 0x2148, 0xa87b, 0x0000, 0xa883,
-- 0x0000, 0x080c, 0x6e9f, 0x009e, 0x00de, 0x0804, 0xb2d3, 0x0026,
-- 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c,
-- 0x100e, 0x000e, 0x090c, 0x0dc5, 0xa960, 0x21e8, 0xa95c, 0x9188,
-- 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079,
-- 0x1800, 0x7990, 0x9188, 0x0018, 0x918c, 0x0fff, 0xa972, 0xac76,
-- 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003, 0x0000, 0x901e, 0x2029,
-- 0x0001, 0x9182, 0x0035, 0x1228, 0x2011, 0x001f, 0x080c, 0xcc85,
-- 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011, 0x001f, 0x080c, 0xcc85,
-- 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110, 0x080c, 0x0fc0, 0x080c,
-- 0x100e, 0x01d0, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920,
-- 0xb406, 0x968a, 0x003d, 0x1230, 0x2608, 0x2011, 0x001b, 0x080c,
-- 0xcc85, 0x00b8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011,
-- 0x001b, 0x080c, 0xcc85, 0x0c18, 0x2001, 0x0205, 0x2003, 0x0000,
-- 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072,
-- 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
-- 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807, 0x0000, 0x0006, 0x080c,
-- 0x6e9f, 0x000e, 0x2048, 0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e,
-- 0x006e, 0x005e, 0x003e, 0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096,
-- 0x0006, 0x080c, 0x100e, 0x000e, 0x090c, 0x0dc5, 0xa960, 0x21e8,
-- 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104,
-- 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990, 0x810c, 0x9188, 0x000c,
-- 0x9182, 0x001a, 0x0210, 0x2009, 0x001a, 0x21a8, 0x810b, 0xa972,
-- 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f, 0x20a0, 0x2001, 0x0205,
-- 0x200c, 0x918d, 0x0080, 0x2102, 0x4003, 0x2003, 0x0000, 0x080c,
-- 0x6e9f, 0x009e, 0x00fe, 0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6,
-- 0x0096, 0x0016, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102,
-- 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80,
-- 0x000c, 0x2098, 0x2021, 0x003e, 0x901e, 0x9282, 0x0020, 0x0218,
-- 0x2011, 0x0020, 0x2018, 0x9486, 0x003e, 0x1170, 0x0096, 0x080c,
-- 0x100e, 0x2900, 0x009e, 0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8,
-- 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300, 0x908e, 0x0260, 0x0140,
-- 0x2009, 0x0280, 0x9102, 0x920a, 0x0218, 0x2010, 0x2100, 0x9318,
-- 0x2200, 0x9402, 0x1228, 0x2400, 0x9202, 0x2410, 0x9318, 0x9006,
-- 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802, 0x20e1, 0x0000, 0x4003,
-- 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280, 0x1130, 0x7814, 0x8000,
-- 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310, 0x84ff, 0x0904, 0xb642,
-- 0x0804, 0xb644, 0x9085, 0x0001, 0x7817, 0x0000, 0x009e, 0x00fe,
-- 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036, 0x0096, 0x6314, 0x2348,
-- 0xa87a, 0xa982, 0x080c, 0x6e92, 0x009e, 0x003e, 0x00de, 0x0005,
-- 0x91b6, 0x0015, 0x1118, 0x080c, 0xb2d3, 0x0030, 0x91b6, 0x0016,
-- 0x190c, 0x0dc5, 0x080c, 0xb2d3, 0x0005, 0x20a9, 0x000e, 0x20e1,
-- 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c,
-- 0x20a0, 0x009e, 0x4003, 0x9196, 0x0016, 0x01f0, 0x0136, 0x9080,
-- 0x001b, 0x20a0, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418, 0x8318,
-- 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8, 0x2011,
-- 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003, 0x3418,
-- 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xd0d8, 0x0130,
-- 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e, 0x0804,
-- 0xb2d3, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200, 0x11a8,
-- 0x6010, 0x00b6, 0x2058, 0xb8cf, 0x0000, 0x00be, 0x6014, 0x9005,
-- 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32, 0x080c,
-- 0xb2d3, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8,
-- 0x0006, 0x0016, 0x080c, 0xd7e3, 0x0188, 0x6014, 0x9005, 0x1170,
-- 0x600b, 0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009, 0x0022,
-- 0x080c, 0xbadd, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085, 0x0001,
-- 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1,
-- 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080,
-- 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001, 0x2099,
-- 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804, 0x2048,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001,
-- 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020, 0x4003,
-- 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103,
-- 0x080c, 0xb2d3, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016, 0x900e,
-- 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff, 0x800c,
-- 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108, 0x810b,
-- 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c, 0xcc85,
-- 0x080c, 0xd0d8, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000, 0xa864,
-- 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb2d3, 0x001e, 0x009e, 0x0005,
-- 0x0016, 0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110, 0x2009,
-- 0x0001, 0x0096, 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa97a, 0x080c,
-- 0x6e9f, 0x009e, 0x080c, 0xb2d3, 0x001e, 0x0005, 0x0016, 0x0096,
-- 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010, 0x7034,
-- 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014, 0x2048,
-- 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xcc85, 0x009e,
-- 0x080c, 0xd0d8, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807, 0x0000,
-- 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb2d3, 0x009e, 0x001e,
-- 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100, 0x1118,
-- 0x080c, 0xbcb6, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806, 0x8006,
-- 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c, 0xa87b,
-- 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c, 0xaca8,
-- 0xada4, 0x2031, 0x0000, 0x2041, 0x1252, 0x0019, 0x0d08, 0x008e,
-- 0x0898, 0x0096, 0x0006, 0x080c, 0x100e, 0x000e, 0x01b0, 0xa8ab,
-- 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800, 0xa89e,
-- 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086, 0x2940,
-- 0x080c, 0x10f8, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005, 0x00e6,
-- 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258,
-- 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6, 0x2258,
-- 0xba14, 0x00be, 0x9206, 0x11e0, 0x6043, 0x0000, 0x2c68, 0x0016,
-- 0x2009, 0x0035, 0x080c, 0xd759, 0x001e, 0x1158, 0x622c, 0x2268,
-- 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386, 0x0006,
-- 0x0128, 0x080c, 0xb2d3, 0x0020, 0x0039, 0x0010, 0x080c, 0xb910,
-- 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048, 0x9186,
-- 0x0015, 0x0904, 0xb8f8, 0x918e, 0x0016, 0x1904, 0xb90e, 0x700c,
-- 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300, 0x1904,
-- 0xb8d2, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904, 0xb8b5,
-- 0x0804, 0xb90c, 0x6808, 0x9086, 0xffff, 0x1904, 0xb8fa, 0xa87c,
-- 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940, 0x9105,
-- 0x1904, 0xb8fa, 0x6824, 0xd084, 0x1904, 0xb8fa, 0xd0b4, 0x0158,
-- 0x0016, 0x2001, 0x1986, 0x200c, 0x6018, 0x9102, 0x9082, 0x0005,
-- 0x001e, 0x1a04, 0xb8fa, 0x080c, 0xd2c3, 0x685c, 0xa882, 0xa87c,
-- 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001,
-- 0x000a, 0x080c, 0x9375, 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86,
-- 0x82ff, 0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c, 0xcde3, 0x00ce,
-- 0x0804, 0xb90c, 0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c, 0x61c2,
-- 0x0010, 0x080c, 0x65cf, 0x00ce, 0x1904, 0xb8fa, 0x00c6, 0x2d60,
-- 0x080c, 0xb2d3, 0x00ce, 0x0804, 0xb90c, 0x00c6, 0x080c, 0xb325,
-- 0x0198, 0x6017, 0x0000, 0x6810, 0x6012, 0x080c, 0xd554, 0x6023,
-- 0x0003, 0x6904, 0x00c6, 0x2d60, 0x080c, 0xb2d3, 0x00ce, 0x080c,
-- 0xb352, 0x00ce, 0x0804, 0xb90c, 0x2001, 0x1988, 0x2004, 0x6842,
-- 0x00ce, 0x04d0, 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6,
-- 0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b,
-- 0x0003, 0x080c, 0xd79d, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-- 0x0002, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x00ce, 0x00e8, 0x700c,
-- 0x9086, 0x2a00, 0x1138, 0x2001, 0x1988, 0x2004, 0x6842, 0x00a0,
-- 0x0479, 0x00a0, 0x89ff, 0x090c, 0x0dc5, 0x00c6, 0x00d6, 0x2d60,
-- 0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x6cb9, 0x080c, 0xd2c3,
-- 0x080c, 0xb306, 0x00de, 0x00ce, 0x080c, 0xb2d3, 0x009e, 0x0005,
-- 0x9186, 0x0015, 0x1128, 0x2001, 0x1988, 0x2004, 0x6842, 0x0068,
-- 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c, 0xee87,
-- 0x080c, 0x8a25, 0x080c, 0xb2d3, 0x00ce, 0x080c, 0xb2d3, 0x0005,
-- 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130,
-- 0x2001, 0x1988, 0x2004, 0x6842, 0x0804, 0xb98a, 0x00c6, 0x2d60,
-- 0x080c, 0xcce6, 0x00ce, 0x6804, 0x9086, 0x0050, 0x1168, 0x00c6,
-- 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8,
-- 0x89ff, 0x090c, 0x0dc5, 0x6800, 0x9086, 0x0004, 0x1190, 0xa87c,
-- 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc,
-- 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001, 0x0007, 0x6832,
-- 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4,
-- 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68,
-- 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38, 0x7020, 0x683e,
-- 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c, 0xd44b, 0x080c,
-- 0x9ab1, 0x0010, 0x080c, 0xb2d3, 0x004e, 0x003e, 0x002e, 0x0005,
-+ 0x6827, 0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e,
-+ 0x7008, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a,
-+ 0x0010, 0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-+ 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xd2c8, 0x1180,
-+ 0x080c, 0x3279, 0x080c, 0xd2d9, 0x1518, 0x080c, 0xbcaf, 0x0400,
-+ 0x080c, 0xac14, 0x6824, 0xd084, 0x09b0, 0x6827, 0x0001, 0x0898,
-+ 0x080c, 0xd2d9, 0x1118, 0x080c, 0xbcaf, 0x0090, 0x6014, 0x2048,
-+ 0x080c, 0xd0cf, 0x0168, 0x6020, 0x9086, 0x0003, 0x1520, 0xa867,
-+ 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6e98, 0x080c, 0xd2bc,
-+ 0x080c, 0xd545, 0x080c, 0xb2ff, 0x080c, 0xaaea, 0x00ce, 0x0804,
-+ 0xb119, 0x2c78, 0x600c, 0x2060, 0x0804, 0xb119, 0x700f, 0x0000,
-+ 0x700b, 0x0000, 0x012e, 0x006e, 0x009e, 0x00ae, 0x00ce, 0x00de,
-+ 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d08, 0x080c,
-+ 0xebcd, 0x08f0, 0x00d6, 0x0156, 0x080c, 0xa105, 0x7a14, 0x82ff,
-+ 0x0138, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0490,
-+ 0x7003, 0x0200, 0x7007, 0x0000, 0x2069, 0x1800, 0x901e, 0x6800,
-+ 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c, 0x7630, 0x1110,
-+ 0xc3ad, 0x0008, 0xc3a5, 0x6adc, 0xd29c, 0x1110, 0xd2ac, 0x0108,
-+ 0xc39d, 0x730e, 0x080c, 0x8945, 0x20a9, 0x0006, 0x2011, 0xffec,
-+ 0x2019, 0xffed, 0x2071, 0x0250, 0x2305, 0x2072, 0x8e70, 0x2205,
-+ 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xb1dc,
-+ 0x60c3, 0x0020, 0x080c, 0xa6b6, 0x015e, 0x00de, 0x0005, 0x0156,
-+ 0x080c, 0xa105, 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff, 0x0118,
-+ 0x9282, 0x000e, 0x1238, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3,
-+ 0x0008, 0x0488, 0x7003, 0x0200, 0x7007, 0x001c, 0x700f, 0x0001,
-+ 0x2011, 0x19be, 0x2204, 0x8007, 0x701a, 0x8210, 0x2204, 0x8007,
-+ 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001,
-+ 0x181f, 0x2004, 0x7022, 0x2001, 0x1820, 0x2004, 0x7026, 0x0030,
-+ 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004,
-+ 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256,
-+ 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804, 0xa6b6, 0x0006, 0x2001,
-+ 0x1837, 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003, 0x080c,
-+ 0xaab8, 0x2011, 0x0002, 0x080c, 0xaac2, 0x080c, 0xa9cc, 0x0036,
-+ 0x901e, 0x080c, 0xaa42, 0x003e, 0x0005, 0x080c, 0x33af, 0x0188,
-+ 0x0016, 0x00b6, 0x00c6, 0x7010, 0x9085, 0x0020, 0x7012, 0x2009,
-+ 0x007e, 0x080c, 0x671d, 0xb85c, 0xc0ac, 0xb85e, 0x00ce, 0x00be,
-+ 0x001e, 0x0005, 0x2071, 0x188d, 0x7000, 0x9005, 0x0140, 0x2001,
-+ 0x0976, 0x2071, 0x1800, 0x7076, 0x707a, 0x706b, 0xffe0, 0x2071,
-+ 0x1800, 0x7074, 0x7056, 0x705b, 0x1cd0, 0x0005, 0x00e6, 0x0126,
-+ 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0010, 0x0608,
-+ 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018,
-+ 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003,
-+ 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230,
-+ 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0,
-+ 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7554, 0x9582,
-+ 0x0010, 0x0600, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148,
-+ 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0,
-+ 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068,
-+ 0x9502, 0x1228, 0x755a, 0x9085, 0x0001, 0x00ee, 0x0005, 0x705b,
-+ 0x1cd0, 0x0cc8, 0x9006, 0x0cc8, 0x9c82, 0x1cd0, 0x0a0c, 0x0dc5,
-+ 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0dc5, 0x9006, 0x6006,
-+ 0x600a, 0x600e, 0x6016, 0x601a, 0x6012, 0x6023, 0x0000, 0x6003,
-+ 0x0000, 0x601e, 0x6056, 0x605a, 0x6026, 0x602a, 0x602e, 0x6032,
-+ 0x6036, 0x603a, 0x603e, 0x6042, 0x602a, 0x2061, 0x1800, 0x6054,
-+ 0x8000, 0x6056, 0x9086, 0x0001, 0x0108, 0x0005, 0x0126, 0x2091,
-+ 0x8000, 0x0016, 0x080c, 0x9aaa, 0x001e, 0x012e, 0x0cb0, 0x0006,
-+ 0x6000, 0x9086, 0x0000, 0x01c0, 0x601c, 0xd084, 0x190c, 0x1a8e,
-+ 0x6017, 0x0000, 0x6023, 0x0007, 0x2001, 0x1986, 0x2004, 0x0006,
-+ 0x9082, 0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c, 0xee80,
-+ 0x6043, 0x0000, 0x6013, 0x0000, 0x000e, 0x0005, 0x00e6, 0x0126,
-+ 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001, 0x0608,
-+ 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018,
-+ 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003,
-+ 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230,
-+ 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0,
-+ 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0xb35e,
-+ 0xb367, 0xb382, 0xb39d, 0xd824, 0xd841, 0xd85c, 0xb35e, 0xb367,
-+ 0x90f9, 0xb3b6, 0xb35e, 0xb35e, 0xb35e, 0xb35e, 0x9186, 0x0013,
-+ 0x1128, 0x080c, 0x999e, 0x080c, 0x9aaa, 0x0005, 0x0005, 0x0066,
-+ 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e, 0x0005,
-+ 0xb380, 0xbafe, 0xbcf6, 0xb380, 0xbd8c, 0xb699, 0xb380, 0xb380,
-+ 0xba80, 0xc3aa, 0xb380, 0xb380, 0xb380, 0xb380, 0xb380, 0xb380,
-+ 0x080c, 0x0dc5, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5,
-+ 0x0013, 0x006e, 0x0005, 0xb39b, 0xca77, 0xb39b, 0xb39b, 0xb39b,
-+ 0xb39b, 0xb39b, 0xb39b, 0xca0e, 0xcbf9, 0xb39b, 0xcab8, 0xcb37,
-+ 0xcab8, 0xcb37, 0xb39b, 0x080c, 0x0dc5, 0x6000, 0x9082, 0x0010,
-+ 0x1a0c, 0x0dc5, 0x6000, 0x0002, 0xb3b4, 0xc3f1, 0xc4b9, 0xc5ec,
-+ 0xc79b, 0xb3b4, 0xb3b4, 0xb3b4, 0xc3c5, 0xc99a, 0xc99d, 0xb3b4,
-+ 0xb3b4, 0xb3b4, 0xb3b4, 0xc9cc, 0x080c, 0x0dc5, 0x0066, 0x6000,
-+ 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e, 0x0005, 0xb3cf,
-+ 0xb3cf, 0xb412, 0xb4b1, 0xb546, 0xb3cf, 0xb3cf, 0xb3cf, 0xb3d1,
-+ 0xb3cf, 0xb3cf, 0xb3cf, 0xb3cf, 0xb3cf, 0xb3cf, 0xb3cf, 0x080c,
-+ 0x0dc5, 0x9186, 0x004c, 0x0588, 0x9186, 0x0003, 0x190c, 0x0dc5,
-+ 0x0096, 0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003, 0x6106, 0x6014,
-+ 0x2048, 0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e, 0xa8ac, 0xa846,
-+ 0xa8b0, 0xa84a, 0x9006, 0xa836, 0xa83a, 0xa884, 0x9092, 0x199a,
-+ 0x0210, 0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a,
-+ 0x009e, 0x2c10, 0x080c, 0x1be0, 0x080c, 0x955d, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x9bcc, 0x012e, 0x0005, 0x6010, 0x00b6, 0x2058,
-+ 0xbca0, 0x00be, 0x2c00, 0x080c, 0xb568, 0x080c, 0xd7f4, 0x6003,
-+ 0x0007, 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079, 0x1800, 0x7a90,
-+ 0x6014, 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290, 0x0018, 0xac78,
-+ 0xc4fc, 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc, 0x921a, 0x0140,
-+ 0x0220, 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b, 0x0015, 0x0010,
-+ 0xa87b, 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02, 0x0006, 0x0016,
-+ 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400, 0x9005, 0x1108,
-+ 0x009a, 0x2100, 0x9086, 0x0015, 0x1118, 0x2001, 0x0001, 0x0038,
-+ 0x2100, 0x9086, 0x0016, 0x0118, 0x2001, 0x0001, 0x002a, 0x94a4,
-+ 0x0007, 0x8423, 0x9405, 0x0002, 0xb479, 0xb479, 0xb474, 0xb477,
-+ 0xb479, 0xb471, 0xb464, 0xb464, 0xb464, 0xb464, 0xb464, 0xb464,
-+ 0xb464, 0xb464, 0xb464, 0xb464, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x002e, 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e, 0x00de, 0x080c,
-+ 0x0dc5, 0x080c, 0xbfa4, 0x0028, 0x080c, 0xc0e2, 0x0010, 0x080c,
-+ 0xc1d8, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x2c00,
-+ 0xa896, 0x000e, 0x080c, 0xb626, 0x0530, 0xa804, 0xa80e, 0x00a6,
-+ 0x2050, 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f,
-+ 0x9084, 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0, 0xacd4, 0xadd8,
-+ 0x2031, 0x0000, 0x2041, 0x126c, 0x080c, 0xb7ea, 0x0160, 0x000e,
-+ 0x9005, 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005, 0x00fe, 0x009e,
-+ 0x00de, 0x0804, 0xb2cc, 0x2001, 0x002c, 0x900e, 0x080c, 0xb68c,
-+ 0x0c70, 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016, 0x0158, 0x91b2,
-+ 0x0047, 0x0a0c, 0x0dc5, 0x91b2, 0x0050, 0x1a0c, 0x0dc5, 0x9182,
-+ 0x0047, 0x00ca, 0x2001, 0x0109, 0x2004, 0xd08c, 0x0198, 0x0126,
-+ 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x94aa, 0x002e,
-+ 0x001e, 0x000e, 0x012e, 0xa001, 0x6000, 0x9086, 0x0002, 0x1110,
-+ 0x0804, 0xb412, 0x0005, 0xb4e4, 0xb4e4, 0xb4e6, 0xb51c, 0xb4e4,
-+ 0xb4e4, 0xb4e4, 0xb4e4, 0xb52f, 0x080c, 0x0dc5, 0x00d6, 0x0016,
-+ 0x0096, 0x080c, 0x9a5a, 0x080c, 0x9bcc, 0x6003, 0x0004, 0x6114,
-+ 0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc, 0x9005, 0x1158,
-+ 0xa894, 0x9005, 0x0140, 0x2001, 0x0000, 0x900e, 0x080c, 0xb68c,
-+ 0x080c, 0xb2cc, 0x00a8, 0x6003, 0x0002, 0xa8a4, 0xa9a8, 0x9105,
-+ 0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020, 0xa88c, 0xa88a,
-+ 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000, 0xa8cb, 0x0000,
-+ 0x009e, 0x001e, 0x00de, 0x0005, 0x080c, 0x9a5a, 0x00d6, 0x0096,
-+ 0x6114, 0x2148, 0x080c, 0xd0d1, 0x0120, 0xa87b, 0x0006, 0x080c,
-+ 0x6e98, 0x009e, 0x00de, 0x080c, 0xb2cc, 0x0804, 0x9bcc, 0x080c,
-+ 0x9a5a, 0x080c, 0x3250, 0x080c, 0xd7f1, 0x00d6, 0x0096, 0x6114,
-+ 0x2148, 0x080c, 0xd0d1, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6e98,
-+ 0x009e, 0x00de, 0x080c, 0xb2cc, 0x0804, 0x9bcc, 0x9182, 0x0047,
-+ 0x0002, 0xb556, 0xb558, 0xb556, 0xb556, 0xb556, 0xb556, 0xb556,
-+ 0xb556, 0xb556, 0xb556, 0xb556, 0xb556, 0xb558, 0x080c, 0x0dc5,
-+ 0x00d6, 0x0096, 0x601f, 0x0000, 0x6114, 0x2148, 0xa87b, 0x0000,
-+ 0xa883, 0x0000, 0x080c, 0x6e98, 0x009e, 0x00de, 0x0804, 0xb2cc,
-+ 0x0026, 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6, 0x00f6, 0x0006,
-+ 0x080c, 0x100e, 0x000e, 0x090c, 0x0dc5, 0xa960, 0x21e8, 0xa95c,
-+ 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xa87a,
-+ 0x2079, 0x1800, 0x7990, 0x9188, 0x0018, 0x918c, 0x0fff, 0xa972,
-+ 0xac76, 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003, 0x0000, 0x901e,
-+ 0x2029, 0x0001, 0x9182, 0x0035, 0x1228, 0x2011, 0x001f, 0x080c,
-+ 0xcc7e, 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011, 0x001f, 0x080c,
-+ 0xcc7e, 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110, 0x080c, 0x0fc0,
-+ 0x080c, 0x100e, 0x01d0, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000,
-+ 0x2920, 0xb406, 0x968a, 0x003d, 0x1230, 0x2608, 0x2011, 0x001b,
-+ 0x080c, 0xcc7e, 0x00b8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950,
-+ 0x2011, 0x001b, 0x080c, 0xcc7e, 0x0c18, 0x2001, 0x0205, 0x2003,
-+ 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0xb070, 0xc0fd,
-+ 0xb072, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
-+ 0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807, 0x0000, 0x0006,
-+ 0x080c, 0x6e98, 0x000e, 0x2048, 0x9005, 0x1db0, 0x00fe, 0x00ae,
-+ 0x009e, 0x006e, 0x005e, 0x003e, 0x002e, 0x0005, 0x00d6, 0x00f6,
-+ 0x0096, 0x0006, 0x080c, 0x100e, 0x000e, 0x090c, 0x0dc5, 0xa960,
-+ 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020,
-+ 0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990, 0x810c, 0x9188,
-+ 0x000c, 0x9182, 0x001a, 0x0210, 0x2009, 0x001a, 0x21a8, 0x810b,
-+ 0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f, 0x20a0, 0x2001,
-+ 0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x4003, 0x2003, 0x0000,
-+ 0x080c, 0x6e98, 0x009e, 0x00fe, 0x00de, 0x0005, 0x0016, 0x00d6,
-+ 0x00f6, 0x0096, 0x0016, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080,
-+ 0x2102, 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c, 0xd0ec, 0x0118,
-+ 0x9e80, 0x000c, 0x2098, 0x2021, 0x003e, 0x901e, 0x9282, 0x0020,
-+ 0x0218, 0x2011, 0x0020, 0x2018, 0x9486, 0x003e, 0x1170, 0x0096,
-+ 0x080c, 0x100e, 0x2900, 0x009e, 0x05c0, 0xa806, 0x2048, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300, 0x908e, 0x0260,
-+ 0x0140, 0x2009, 0x0280, 0x9102, 0x920a, 0x0218, 0x2010, 0x2100,
-+ 0x9318, 0x2200, 0x9402, 0x1228, 0x2400, 0x9202, 0x2410, 0x9318,
-+ 0x9006, 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802, 0x20e1, 0x0000,
-+ 0x4003, 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280, 0x1130, 0x7814,
-+ 0x8000, 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310, 0x84ff, 0x0904,
-+ 0xb63b, 0x0804, 0xb63d, 0x9085, 0x0001, 0x7817, 0x0000, 0x009e,
-+ 0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036, 0x0096, 0x6314,
-+ 0x2348, 0xa87a, 0xa982, 0x080c, 0x6e8b, 0x009e, 0x003e, 0x00de,
-+ 0x0005, 0x91b6, 0x0015, 0x1118, 0x080c, 0xb2cc, 0x0030, 0x91b6,
-+ 0x0016, 0x190c, 0x0dc5, 0x080c, 0xb2cc, 0x0005, 0x20a9, 0x000e,
-+ 0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048, 0xa860, 0x20e8,
-+ 0xa85c, 0x20a0, 0x009e, 0x4003, 0x9196, 0x0016, 0x01f0, 0x0136,
-+ 0x9080, 0x001b, 0x20a0, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418,
-+ 0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8,
-+ 0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003,
-+ 0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xd0d1,
-+ 0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e,
-+ 0x0804, 0xb2cc, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200,
-+ 0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8cf, 0x0000, 0x00be, 0x6014,
-+ 0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32,
-+ 0x080c, 0xb2cc, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48,
-+ 0x0cc8, 0x0006, 0x0016, 0x080c, 0xd7dc, 0x0188, 0x6014, 0x9005,
-+ 0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009,
-+ 0x0022, 0x080c, 0xbad6, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085,
-+ 0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c,
-+ 0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c,
-+ 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001,
-+ 0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804,
-+ 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
-+ 0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020,
-+ 0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
-+ 0x0103, 0x080c, 0xb2cc, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016,
-+ 0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff,
-+ 0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108,
-+ 0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c,
-+ 0xcc7e, 0x080c, 0xd0d1, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000,
-+ 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb2cc, 0x001e, 0x009e,
-+ 0x0005, 0x0016, 0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110,
-+ 0x2009, 0x0001, 0x0096, 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa97a,
-+ 0x080c, 0x6e98, 0x009e, 0x080c, 0xb2cc, 0x001e, 0x0005, 0x0016,
-+ 0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010,
-+ 0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014,
-+ 0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xcc7e,
-+ 0x009e, 0x080c, 0xd0d1, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807,
-+ 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb2cc, 0x009e,
-+ 0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100,
-+ 0x1118, 0x080c, 0xbcaf, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806,
-+ 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c,
-+ 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c,
-+ 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x1252, 0x0019, 0x0d08,
-+ 0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x100e, 0x000e, 0x01b0,
-+ 0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800,
-+ 0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086,
-+ 0x2940, 0x080c, 0x10f8, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005,
- 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6,
-- 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xb9f5, 0x700c, 0x6210,
-- 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904, 0xb9f5, 0x6038,
-- 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007, 0x0904,
-- 0xb9f5, 0x9286, 0x0002, 0x0904, 0xb9f5, 0x9286, 0x0000, 0x05e8,
-- 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c, 0x9186, 0x0015,
-- 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038, 0x2060, 0x6104,
-- 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186, 0x004d,
-- 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052, 0x0160, 0x6014,
-- 0x0096, 0x2048, 0x080c, 0xd0d8, 0x090c, 0x0dc5, 0xa87b, 0x0003,
-- 0x009e, 0x080c, 0xd79d, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-- 0x0002, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x00ce, 0x0030, 0x6038,
-- 0x2070, 0x2001, 0x1988, 0x2004, 0x7042, 0x080c, 0xb2d3, 0x002e,
-- 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048,
-- 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00,
-- 0xc48c, 0xbc02, 0x0470, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48,
-- 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004, 0x080c, 0xc379,
-- 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xba66, 0x0096, 0x0156,
-- 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9,
-- 0x0004, 0x080c, 0xc379, 0x002e, 0x003e, 0x015e, 0x009e, 0x15b0,
-- 0x7238, 0xba0a, 0x733c, 0xbb0e, 0x83ff, 0x0118, 0xbc00, 0xc48d,
-- 0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be, 0x0804,
-- 0xb6dc, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e, 0x8006,
-- 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-- 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-- 0x2041, 0x1252, 0x080c, 0xb7f1, 0x0130, 0x00fe, 0x009e, 0x080c,
-- 0xb2d3, 0x00be, 0x0005, 0x080c, 0xbcb6, 0x0cb8, 0x2b78, 0x00f6,
-- 0x080c, 0x3250, 0x080c, 0xd7f8, 0x00fe, 0x00c6, 0x080c, 0xb27d,
-- 0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
-- 0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x666a, 0x080c, 0x6696,
-- 0x080c, 0x9547, 0x080c, 0x9ab1, 0x00ce, 0x0804, 0xba39, 0x2100,
-- 0x91b2, 0x0053, 0x1a0c, 0x0dc5, 0x91b2, 0x0040, 0x1a04, 0xbaef,
-- 0x0002, 0xbadd, 0xbadd, 0xbad3, 0xbadd, 0xbadd, 0xbadd, 0xbad1,
-- 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1,
-- 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1,
-- 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1,
-- 0xbadd, 0xbad1, 0xbadd, 0xbadd, 0xbad1, 0xbad1, 0xbad1, 0xbad1,
-- 0xbad1, 0xbad3, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1,
-- 0xbad1, 0xbad1, 0xbad1, 0xbadd, 0xbadd, 0xbad1, 0xbad1, 0xbad1,
-- 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbad1, 0xbadd, 0xbad1,
-- 0xbad1, 0x080c, 0x0dc5, 0x0066, 0x00b6, 0x6610, 0x2658, 0xb8cc,
-- 0xc08c, 0xb8ce, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001, 0x6106,
-- 0x9186, 0x0032, 0x0118, 0x080c, 0x9547, 0x0010, 0x080c, 0x94ff,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x9ab1, 0x012e, 0x0005, 0x2600,
-- 0x0002, 0xbadd, 0xbadd, 0xbb03, 0xbadd, 0xbadd, 0xbb03, 0xbb03,
-- 0xbb03, 0xbb03, 0xbadd, 0xbb03, 0xbadd, 0xbb03, 0xbadd, 0xbb03,
-- 0xbb03, 0xbb03, 0xbb03, 0x080c, 0x0dc5, 0x6004, 0x90b2, 0x0053,
-- 0x1a0c, 0x0dc5, 0x91b6, 0x0013, 0x0904, 0xbbd8, 0x91b6, 0x0027,
-- 0x1904, 0xbb82, 0x080c, 0x99a5, 0x6004, 0x080c, 0xd2cf, 0x01b0,
-- 0x080c, 0xd2e0, 0x01a8, 0x908e, 0x0021, 0x0904, 0xbb7f, 0x908e,
-- 0x0022, 0x1130, 0x080c, 0xb708, 0x0904, 0xbb7b, 0x0804, 0xbb7c,
-- 0x908e, 0x003d, 0x0904, 0xbb7f, 0x0804, 0xbb75, 0x080c, 0x3279,
-- 0x2001, 0x0007, 0x080c, 0x666a, 0x6010, 0x00b6, 0x2058, 0xb9a0,
-- 0x00be, 0x080c, 0xbcb6, 0x9186, 0x007e, 0x1148, 0x2001, 0x1837,
-- 0x2014, 0xc285, 0x080c, 0x7637, 0x1108, 0xc2ad, 0x2202, 0x0036,
-- 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xef94, 0x002e, 0x003e,
-- 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028, 0x080c, 0x96a4,
-- 0x0076, 0x903e, 0x080c, 0x9577, 0x6010, 0x00b6, 0x905d, 0x0100,
-- 0x00be, 0x2c08, 0x080c, 0xe91c, 0x007e, 0x003e, 0x002e, 0x001e,
-- 0x080c, 0xd7f8, 0x0016, 0x080c, 0xd54c, 0x080c, 0xb2d3, 0x001e,
-- 0x080c, 0x334c, 0x080c, 0x9ab1, 0x0030, 0x080c, 0xd54c, 0x080c,
-- 0xb2d3, 0x080c, 0x9ab1, 0x0005, 0x080c, 0xbcb6, 0x0cb0, 0x080c,
-- 0xbcf2, 0x0c98, 0x9186, 0x0015, 0x0118, 0x9186, 0x0016, 0x1148,
-- 0x080c, 0xd809, 0x0d80, 0x6000, 0x9086, 0x0002, 0x0904, 0xbcfd,
-- 0x0c50, 0x9186, 0x0014, 0x1d38, 0x080c, 0x99a5, 0x6004, 0x908e,
-- 0x0022, 0x1118, 0x080c, 0xb708, 0x09f0, 0x080c, 0x3250, 0x080c,
-- 0xd7f8, 0x080c, 0xd2cf, 0x1198, 0x080c, 0x3279, 0x6010, 0x00b6,
-- 0x2058, 0xb9a0, 0x00be, 0x080c, 0xbcb6, 0x9186, 0x007e, 0x1128,
-- 0x2001, 0x1837, 0x200c, 0xc185, 0x2102, 0x0804, 0xbb75, 0x080c,
-- 0xd2e0, 0x1120, 0x080c, 0xbcb6, 0x0804, 0xbb75, 0x6004, 0x908e,
-- 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000,
-- 0x080c, 0x35e7, 0x00fe, 0x00ee, 0x0804, 0xbb75, 0x6004, 0x908e,
-- 0x0021, 0x0d40, 0x908e, 0x0022, 0x090c, 0xbcb6, 0x0804, 0xbb75,
-- 0x90b2, 0x0040, 0x1a04, 0xbc92, 0x2008, 0x0002, 0xbc20, 0xbc21,
-- 0xbc24, 0xbc27, 0xbc2a, 0xbc37, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e,
-- 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e,
-- 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e,
-- 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc3a, 0xbc47, 0xbc1e, 0xbc49,
-- 0xbc47, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc47, 0xbc47,
-- 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc1e,
-- 0xbc79, 0xbc47, 0xbc1e, 0xbc43, 0xbc1e, 0xbc1e, 0xbc1e, 0xbc44,
-- 0xbc1e, 0xbc1e, 0xbc1e, 0xbc47, 0xbc70, 0xbc1e, 0x080c, 0x0dc5,
-- 0x0430, 0x2001, 0x000b, 0x0470, 0x2001, 0x0003, 0x0458, 0x2001,
-- 0x0005, 0x0440, 0x6010, 0x00b6, 0x2058, 0xb804, 0x00be, 0x9084,
-- 0x00ff, 0x9086, 0x0000, 0x1500, 0x2001, 0x0001, 0x00d8, 0x2001,
-- 0x0009, 0x00c0, 0x080c, 0x99a5, 0x6003, 0x0005, 0x080c, 0xd7fb,
-- 0x080c, 0x9ab1, 0x0070, 0x0018, 0x0010, 0x080c, 0x666a, 0x0804,
-- 0xbc8a, 0x080c, 0x99a5, 0x080c, 0xd7fb, 0x6003, 0x0004, 0x080c,
-- 0x9ab1, 0x0005, 0x080c, 0x666a, 0x080c, 0x99a5, 0x6003, 0x0002,
-- 0x0036, 0x2019, 0x1852, 0x2304, 0x9084, 0xff00, 0x1120, 0x2001,
-- 0x1986, 0x201c, 0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003,
-- 0x801b, 0x831b, 0x9318, 0x631a, 0x003e, 0x080c, 0x9ab1, 0x0c08,
-- 0x080c, 0x99a5, 0x080c, 0xd54c, 0x080c, 0xb2d3, 0x080c, 0x9ab1,
-- 0x08c0, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000, 0x080c,
-- 0x35e7, 0x00fe, 0x00ee, 0x080c, 0x99a5, 0x080c, 0xb2d3, 0x080c,
-- 0x9ab1, 0x0838, 0x080c, 0x99a5, 0x6003, 0x0002, 0x080c, 0xd7fb,
-- 0x0804, 0x9ab1, 0x2600, 0x2008, 0x0002, 0xbca9, 0xbc8a, 0xbca7,
-- 0xbc8a, 0xbc8a, 0xbca7, 0xbca7, 0xbca7, 0xbca7, 0xbc8a, 0xbca7,
-- 0xbc8a, 0xbca7, 0xbc8a, 0xbca7, 0xbca7, 0xbca7, 0xbca7, 0x080c,
-- 0x0dc5, 0x080c, 0x99a5, 0x0096, 0x6014, 0x2048, 0x080c, 0x6e9f,
-- 0x009e, 0x080c, 0xb2d3, 0x080c, 0x9ab1, 0x0005, 0x00e6, 0x0096,
-- 0x0026, 0x0016, 0x080c, 0xd0d8, 0x0568, 0x6014, 0x2048, 0xa864,
-- 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148, 0x080c,
-- 0x556f, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x0028,
-- 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xd6bd, 0x0090,
-- 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004, 0x908e,
-- 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867, 0x0103,
-- 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005, 0x001e,
-- 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
-- 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610, 0x2658,
-- 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0dc5, 0x6604,
-- 0x96b6, 0x004d, 0x1120, 0x080c, 0xd5dc, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x0043, 0x1120, 0x080c, 0xd625, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x004b, 0x1120, 0x080c, 0xd651, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x0033, 0x1120, 0x080c, 0xd56e, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x0028, 0x1120, 0x080c, 0xd31e, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x0029, 0x1120, 0x080c, 0xd35f, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x001f, 0x1120, 0x080c, 0xb6ad, 0x0804, 0xbd82, 0x6604,
-- 0x96b6, 0x0000, 0x1118, 0x080c, 0xb9fb, 0x04e0, 0x6604, 0x96b6,
-- 0x0022, 0x1118, 0x080c, 0xb6e9, 0x04a8, 0x6604, 0x96b6, 0x0035,
-- 0x1118, 0x080c, 0xb80f, 0x0470, 0x6604, 0x96b6, 0x0039, 0x1118,
-- 0x080c, 0xb990, 0x0438, 0x6604, 0x96b6, 0x003d, 0x1118, 0x080c,
-- 0xb721, 0x0400, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c, 0xb75d,
-- 0x00c8, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xb79e, 0x0090,
-- 0x6604, 0x96b6, 0x0041, 0x1118, 0x080c, 0xb788, 0x0058, 0x91b6,
-- 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128, 0x00be,
-- 0x0804, 0xc08e, 0x00be, 0x0005, 0x080c, 0xb36d, 0x0cd8, 0xbd9f,
-- 0xbdad, 0xbd9f, 0xbdf4, 0xbd9f, 0xbfab, 0xc09b, 0xbd9f, 0xbd9f,
-- 0xc064, 0xbd9f, 0xc07a, 0x0096, 0x601f, 0x0000, 0x6014, 0x2048,
-- 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0xb2d3, 0xa001,
-- 0xa001, 0x0005, 0x6604, 0x96b6, 0x0004, 0x1130, 0x2001, 0x0001,
-- 0x080c, 0x6656, 0x0804, 0xb2d3, 0x0005, 0x00e6, 0x2071, 0x1800,
-- 0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xe8ed, 0x11b0, 0x6010,
-- 0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110,
-- 0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c, 0x666a,
-- 0x080c, 0x3279, 0x080c, 0xb2d3, 0x0098, 0x2001, 0x000a, 0x080c,
-- 0x666a, 0x080c, 0x3279, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-- 0x9547, 0x080c, 0x9ab1, 0x0020, 0x2001, 0x0001, 0x080c, 0xbf7b,
-- 0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006, 0x080c,
-- 0x6656, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001, 0x0006,
-- 0x080c, 0x6696, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6, 0x2011,
-- 0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xbf50, 0x6010, 0x2058,
-- 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xc1ea, 0x0804, 0xbebd,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x0904, 0xbe5f, 0x00d6, 0x080c,
-- 0x7637, 0x01a0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac7, 0x002e,
-- 0x0904, 0xbe5e, 0x080c, 0x57e9, 0x1598, 0x6014, 0x2048, 0xa807,
-- 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x0450, 0x6010, 0x00b6,
-- 0x2058, 0xb910, 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026, 0x2011,
-- 0x8008, 0x080c, 0x6ac7, 0x002e, 0x0548, 0x6014, 0x9005, 0x090c,
-- 0x0dc5, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140,
-- 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xd6bd, 0x0040,
-- 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead,
-- 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3279, 0x080c, 0xb2d3,
-- 0x001e, 0x080c, 0x334c, 0x00de, 0x0804, 0xbf55, 0x00de, 0x080c,
-- 0xc1df, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510, 0x6014,
-- 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-- 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd6bd,
-- 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x2001,
-- 0x0006, 0x080c, 0x666a, 0x080c, 0x3279, 0x080c, 0xb2d3, 0x0804,
-- 0xbf55, 0x080c, 0xbf63, 0x6014, 0x9005, 0x0190, 0x2048, 0xa868,
-- 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1d08,
-- 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd6bd, 0x08f8,
-- 0x080c, 0xbf59, 0x0160, 0x9006, 0x080c, 0x6656, 0x2001, 0x0004,
-- 0x080c, 0x6696, 0x2001, 0x0007, 0x080c, 0x666a, 0x08a0, 0x2001,
-- 0x0004, 0x080c, 0x666a, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c,
-- 0x9547, 0x080c, 0x9ab1, 0x0804, 0xbf55, 0xb85c, 0xd0e4, 0x0178,
-- 0x080c, 0xd4ee, 0x080c, 0x7637, 0x0118, 0xd0dc, 0x1904, 0xbe7f,
-- 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012, 0x0804, 0xbe7f, 0x080c,
-- 0xd52b, 0x2011, 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c,
-- 0xeab9, 0x000e, 0x1904, 0xbe7f, 0xc0b5, 0x2012, 0x2001, 0x0006,
-- 0x080c, 0x666a, 0x9006, 0x080c, 0x6656, 0x00c6, 0x2001, 0x180f,
-- 0x2004, 0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071,
-- 0x1800, 0x700c, 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010, 0x78ea,
-- 0x7082, 0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe,
-- 0x080c, 0x28bc, 0x00f6, 0x2100, 0x900e, 0x080c, 0x2873, 0x795e,
-- 0x00fe, 0x9186, 0x0081, 0x01f0, 0x2009, 0x0081, 0x00e0, 0x2009,
-- 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x78e7, 0x0000, 0x7932,
-- 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x28bc, 0x00f6,
-- 0x2079, 0x1800, 0x7982, 0x2100, 0x900e, 0x797e, 0x080c, 0x2873,
-- 0x795e, 0x00fe, 0x8108, 0x080c, 0x66b9, 0x2b00, 0x00ce, 0x1904,
-- 0xbe7f, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150, 0x2009,
-- 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d, 0x210c,
-- 0xb916, 0x2001, 0x0002, 0x080c, 0x666a, 0x6023, 0x0001, 0x6003,
-- 0x0001, 0x6007, 0x0002, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0028,
-- 0x080c, 0xbcb6, 0x2001, 0x0001, 0x0431, 0x00de, 0x009e, 0x00be,
-- 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001, 0x1848,
-- 0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xefed, 0x0190, 0x2071,
-- 0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284, 0xff00,
-- 0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912,
-- 0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158, 0x2001, 0x0007,
-- 0x080c, 0x666a, 0x080c, 0x57e9, 0x1120, 0x2001, 0x0007, 0x080c,
-- 0x6696, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048, 0xa868,
-- 0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058,
-- 0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4c44,
-- 0x004e, 0x003e, 0x080c, 0x3279, 0x6020, 0x9086, 0x000a, 0x1108,
-- 0x0005, 0x0804, 0xb2d3, 0x00b6, 0x00e6, 0x0026, 0x0016, 0x2071,
-- 0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xc05a, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x0904, 0xc00d, 0x00d6, 0x080c, 0x7637, 0x01a0,
-- 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac7, 0x002e, 0x0904, 0xc00c,
-- 0x080c, 0x57e9, 0x1598, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867,
-- 0x0103, 0xa833, 0xdead, 0x0450, 0x6010, 0x00b6, 0x2058, 0xb910,
-- 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026, 0x2011, 0x8008, 0x080c,
-- 0x6ac7, 0x002e, 0x0548, 0x6014, 0x9005, 0x090c, 0x0dc5, 0x2048,
-- 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0030,
-- 0x900e, 0x2011, 0x4009, 0x080c, 0xd6bd, 0x0040, 0x6014, 0x2048,
-- 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010, 0x2058,
-- 0xb9a0, 0x0016, 0x080c, 0x3279, 0x080c, 0xb2d3, 0x001e, 0x080c,
-- 0x334c, 0x00de, 0x0804, 0xc05f, 0x00de, 0x080c, 0x57e9, 0x1170,
-- 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0,
-- 0x2021, 0x0006, 0x080c, 0x4dfb, 0x004e, 0x003e, 0x00d6, 0x6010,
-- 0x2058, 0x080c, 0x67bf, 0x080c, 0xbde2, 0x00de, 0x080c, 0xc2b5,
-- 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001, 0x0006,
-- 0x080c, 0x666a, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864, 0x9084,
-- 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011,
-- 0x4000, 0x080c, 0xd6bd, 0x0060, 0xa864, 0x9084, 0x00ff, 0x9086,
-- 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-- 0x009e, 0x080c, 0x3279, 0x6020, 0x9086, 0x000a, 0x0140, 0x080c,
-- 0xb2d3, 0x0028, 0x080c, 0xbcb6, 0x9006, 0x080c, 0xbf7b, 0x001e,
-- 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1824, 0x2204, 0x9086,
-- 0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x666a, 0x6003, 0x0001,
-- 0x6007, 0x0001, 0x080c, 0x9547, 0x0804, 0x9ab1, 0x2001, 0x0001,
-- 0x0804, 0xbf7b, 0x2030, 0x2011, 0x1824, 0x2204, 0x9086, 0x0004,
-- 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007, 0x080c, 0x666a,
-- 0x0804, 0xb2d3, 0x2001, 0x0001, 0x0804, 0xbf7b, 0x0002, 0xbd9f,
-- 0xc0a6, 0xbd9f, 0xc0e9, 0xbd9f, 0xc196, 0xc09b, 0xbda2, 0xbd9f,
-- 0xc1aa, 0xbd9f, 0xc1bc, 0x6604, 0x9686, 0x0003, 0x0904, 0xbfab,
-- 0x96b6, 0x001e, 0x1110, 0x080c, 0xb2d3, 0x0005, 0x00b6, 0x00d6,
-- 0x00c6, 0x080c, 0xc1ce, 0x11a0, 0x9006, 0x080c, 0x6656, 0x080c,
-- 0x3250, 0x080c, 0xd7f8, 0x2001, 0x0002, 0x080c, 0x666a, 0x6003,
-- 0x0001, 0x6007, 0x0002, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0428,
-- 0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010, 0x2058,
-- 0xb840, 0x9084, 0x00ff, 0x9005, 0x0180, 0x8001, 0xb842, 0x601b,
-- 0x000a, 0x0098, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x908e,
-- 0x1900, 0x0158, 0x908e, 0x1e00, 0x0990, 0x080c, 0x3250, 0x080c,
-- 0xd7f8, 0x2001, 0x0001, 0x080c, 0xbf7b, 0x00ce, 0x00de, 0x00be,
-- 0x0005, 0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xc1dc, 0x00d6,
-- 0x2069, 0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0,
-- 0x9086, 0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000, 0x206a,
-- 0x00de, 0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x6656, 0x2001,
-- 0x0002, 0x080c, 0x666a, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
-- 0x9547, 0x080c, 0x9ab1, 0x0804, 0xc166, 0x080c, 0xd0d8, 0x01b0,
-- 0x6014, 0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007,
-- 0x0016, 0x2001, 0x0002, 0x080c, 0xd71a, 0x00b0, 0x6014, 0x2048,
-- 0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e,
-- 0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
-- 0x9005, 0x1110, 0x9006, 0x0c38, 0x080c, 0xbcb6, 0x2009, 0x026e,
-- 0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686, 0x000b,
-- 0x01c8, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686,
-- 0x0009, 0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0190,
-- 0x2001, 0x0004, 0x080c, 0x666a, 0x2001, 0x0028, 0x601a, 0x6007,
-- 0x0052, 0x0020, 0x2001, 0x0001, 0x080c, 0xbf7b, 0x002e, 0x00be,
-- 0x009e, 0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048, 0x080c,
-- 0xd0d8, 0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc,
-- 0x0108, 0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
-- 0x0138, 0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016, 0x08f0,
-- 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800, 0x080c,
-- 0x60c1, 0x00ee, 0x0010, 0x080c, 0x3250, 0x0860, 0x2001, 0x0004,
-- 0x080c, 0x666a, 0x080c, 0xc1dc, 0x1140, 0x6003, 0x0001, 0x6007,
-- 0x0003, 0x080c, 0x9547, 0x0804, 0x9ab1, 0x080c, 0xbcb6, 0x9006,
-- 0x0804, 0xbf7b, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c, 0x666a,
-- 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x9547, 0x0804, 0x9ab1,
-- 0x2001, 0x0001, 0x0804, 0xbf7b, 0x00f9, 0x1160, 0x2001, 0x000a,
-- 0x080c, 0x666a, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x9547,
-- 0x0804, 0x9ab1, 0x2001, 0x0001, 0x0804, 0xbf7b, 0x2009, 0x026e,
-- 0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084,
-- 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6,
-- 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x6733, 0x001e, 0x00ce,
-- 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016,
-- 0x6010, 0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003, 0x200a,
-- 0x080c, 0xc287, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd, 0x200a,
-- 0x080c, 0x6a9f, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c,
-- 0xec31, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a,
-- 0x2009, 0x0001, 0x080c, 0x321b, 0x00e6, 0x2071, 0x1800, 0x080c,
-- 0x3000, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f,
-- 0x080c, 0x334c, 0x8108, 0x1f04, 0xc220, 0x015e, 0x00ce, 0x080c,
-- 0xc1df, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001,
-- 0x1837, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118,
-- 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1837,
-- 0x2102, 0x9184, 0x0050, 0x9086, 0x0050, 0x05d0, 0x2079, 0x0100,
-- 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181f, 0x206a, 0x78e6, 0x0006,
-- 0x8e70, 0x2e04, 0x2069, 0x1820, 0x206a, 0x78ea, 0x7832, 0x7836,
-- 0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009, 0x182c, 0x200a,
-- 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x28bc, 0x080c, 0x7637,
-- 0x0170, 0x2071, 0x0260, 0x2069, 0x1982, 0x7048, 0x206a, 0x704c,
-- 0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c, 0xd4ee, 0x0040,
-- 0x2001, 0x0006, 0x080c, 0x666a, 0x080c, 0x3279, 0x080c, 0xb2d3,
-- 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x0096,
-- 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182c, 0x231c, 0x83ff,
-- 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff, 0x7004, 0x9084,
-- 0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276, 0x20a9, 0x0004,
-- 0x2b48, 0x2019, 0x000a, 0x080c, 0xc379, 0x1148, 0x2011, 0x027a,
-- 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xc379, 0x1100, 0x015e,
-- 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6, 0x2071, 0x0260,
-- 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086, 0x0800, 0x1188,
-- 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086, 0x0100, 0x1138,
-- 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010, 0x9085,
-- 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076, 0x0056,
-- 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2029, 0x19f1,
-- 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061, 0x1cd0, 0x2071, 0x1800,
-- 0x7254, 0x7074, 0x9202, 0x1a04, 0xc345, 0x080c, 0x8cf7, 0x0904,
-- 0xc33e, 0x080c, 0xec62, 0x0904, 0xc33e, 0x6720, 0x9786, 0x0007,
-- 0x0904, 0xc33e, 0x2500, 0x9c06, 0x0904, 0xc33e, 0x2400, 0x9c06,
-- 0x05e8, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130,
-- 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1580, 0x00c6, 0x6000,
-- 0x9086, 0x0004, 0x1110, 0x080c, 0x1a8e, 0x9786, 0x000a, 0x0148,
-- 0x080c, 0xd2e0, 0x1130, 0x00ce, 0x080c, 0xbcb6, 0x080c, 0xb306,
-- 0x00e8, 0x6014, 0x2048, 0x080c, 0xd0d8, 0x01a8, 0x9786, 0x0003,
-- 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878,
-- 0x2048, 0x080c, 0x0fc0, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c,
-- 0x6e92, 0x080c, 0xd2c3, 0x080c, 0xb306, 0x00ce, 0x9ce0, 0x0018,
-- 0x7068, 0x9c02, 0x1210, 0x0804, 0xc2e8, 0x012e, 0x000e, 0x002e,
-- 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005, 0x9786,
-- 0x0006, 0x1118, 0x080c, 0xebd4, 0x0c30, 0x9786, 0x0009, 0x1148,
-- 0x6000, 0x9086, 0x0004, 0x0d08, 0x2009, 0x004c, 0x080c, 0xb352,
-- 0x08e0, 0x9786, 0x000a, 0x0980, 0x0820, 0x220c, 0x2304, 0x9106,
-- 0x1130, 0x8210, 0x8318, 0x1f04, 0xc365, 0x9006, 0x0005, 0x2304,
-- 0x9102, 0x0218, 0x2001, 0x0001, 0x0008, 0x9006, 0x918d, 0x0001,
-- 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906, 0x8006, 0x8007, 0x908c,
-- 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300, 0x2098, 0x3518, 0x20a9,
-- 0x0001, 0x220c, 0x4002, 0x910e, 0x1140, 0x8210, 0x8319, 0x1dc8,
-- 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x9102, 0x0218,
-- 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0x918d, 0x0001, 0x001e,
-- 0x01ce, 0x013e, 0x0005, 0x220c, 0x810f, 0x2304, 0x9106, 0x1130,
-- 0x8210, 0x8318, 0x1f04, 0xc3a3, 0x9006, 0x0005, 0x918d, 0x0001,
-- 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dc5, 0x080c, 0xd2cf,
-- 0x0120, 0x080c, 0xd2e0, 0x0168, 0x0028, 0x080c, 0x3279, 0x080c,
-- 0xd2e0, 0x0138, 0x080c, 0x99a5, 0x080c, 0xb2d3, 0x080c, 0x9ab1,
-- 0x0005, 0x080c, 0xbcb6, 0x0cb0, 0x9182, 0x0054, 0x1220, 0x9182,
-- 0x0040, 0x0208, 0x000a, 0x0005, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3e8,
-- 0xc3e8, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3ea,
-- 0xc3ea, 0xc3ea, 0xc3ea, 0xc3e8, 0xc3e8, 0xc3e8, 0xc3ea, 0xc3e8,
-- 0x080c, 0x0dc5, 0x600b, 0xffff, 0x6003, 0x0001, 0x6106, 0x080c,
-- 0x94ff, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ab1, 0x012e, 0x0005,
-- 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0040, 0x0804, 0xc482,
-- 0x9186, 0x0027, 0x1520, 0x080c, 0x99a5, 0x080c, 0x3250, 0x080c,
-- 0xd7f8, 0x0096, 0x6114, 0x2148, 0x080c, 0xd0d8, 0x0198, 0x080c,
-- 0xd2e0, 0x1118, 0x080c, 0xbcb6, 0x0068, 0xa867, 0x0103, 0xa87b,
-- 0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x6e9f,
-- 0x080c, 0xd2c3, 0x009e, 0x080c, 0xb2d3, 0x0804, 0x9ab1, 0x9186,
-- 0x0014, 0x1120, 0x6004, 0x9082, 0x0040, 0x00b8, 0x9186, 0x0046,
-- 0x0150, 0x9186, 0x0045, 0x0138, 0x9186, 0x0053, 0x0120, 0x9186,
-- 0x0048, 0x190c, 0x0dc5, 0x080c, 0xd809, 0x0130, 0x6000, 0x9086,
-- 0x0002, 0x1110, 0x0804, 0xc4c0, 0x0005, 0x0002, 0xc45c, 0xc45a,
-- 0xc45a, 0xc45a, 0xc45a, 0xc45a, 0xc45a, 0xc45a, 0xc45a, 0xc45a,
-- 0xc45a, 0xc477, 0xc477, 0xc477, 0xc477, 0xc45a, 0xc477, 0xc45a,
-- 0xc477, 0xc45a, 0x080c, 0x0dc5, 0x080c, 0x99a5, 0x0096, 0x6114,
-- 0x2148, 0x080c, 0xd0d8, 0x0168, 0xa867, 0x0103, 0xa87b, 0x0006,
-- 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x6e9f, 0x080c,
-- 0xd2c3, 0x009e, 0x080c, 0xb2d3, 0x080c, 0x9ab1, 0x0005, 0x080c,
-- 0x99a5, 0x080c, 0xd2e0, 0x090c, 0xbcb6, 0x080c, 0xb2d3, 0x080c,
-- 0x9ab1, 0x0005, 0x0002, 0xc499, 0xc497, 0xc497, 0xc497, 0xc497,
-- 0xc497, 0xc497, 0xc497, 0xc497, 0xc497, 0xc497, 0xc4b0, 0xc4b0,
-- 0xc4b0, 0xc4b0, 0xc497, 0xc4ba, 0xc497, 0xc4b0, 0xc497, 0x080c,
-- 0x0dc5, 0x0096, 0x080c, 0x99a5, 0x6014, 0x2048, 0x2001, 0x1988,
-- 0x2004, 0x6042, 0xa97c, 0xd1ac, 0x0140, 0x6003, 0x0004, 0xa87c,
-- 0x9085, 0x0400, 0xa87e, 0x009e, 0x0005, 0x6003, 0x0002, 0x0cb8,
-- 0x080c, 0x99a5, 0x080c, 0xd7fb, 0x080c, 0xd800, 0x6003, 0x000f,
-- 0x0804, 0x9ab1, 0x080c, 0x99a5, 0x080c, 0xb2d3, 0x0804, 0x9ab1,
-- 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005,
-- 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4de, 0xc5be, 0xc4dc,
-- 0xc5f2, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc, 0xc4dc,
-- 0xc4dc, 0xc4dc, 0xc4dc, 0xc5f2, 0x080c, 0x0dc5, 0x00b6, 0x0096,
-- 0x6114, 0x2148, 0x7644, 0x96b4, 0x0fff, 0x86ff, 0x1528, 0x6010,
-- 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc5ad, 0xa87b, 0x0000, 0xa867,
-- 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-- 0x190c, 0xc78b, 0x080c, 0x6cb9, 0x6210, 0x2258, 0xba3c, 0x82ff,
-- 0x0110, 0x8211, 0xba3e, 0x7044, 0xd0e4, 0x1904, 0xc58e, 0x080c,
-- 0xb2d3, 0x009e, 0x00be, 0x0005, 0x968c, 0x0c00, 0x0150, 0x6010,
-- 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc592, 0x7348, 0xab92, 0x734c,
-- 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0508, 0x9186, 0x0028,
-- 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b, 0x0015,
-- 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0148,
-- 0x7048, 0x9106, 0x1118, 0x704c, 0x9206, 0x0118, 0xa992, 0xaa8e,
-- 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
-- 0x0000, 0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8, 0x9686,
-- 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804, 0xc4e5,
-- 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019,
-- 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c,
-- 0xcc85, 0x003e, 0xd6cc, 0x0904, 0xc4fa, 0x7154, 0xa98a, 0x81ff,
-- 0x0904, 0xc4fa, 0x9192, 0x0021, 0x1278, 0x8304, 0x9098, 0x0018,
-- 0x2011, 0x0029, 0x080c, 0xcc85, 0x2011, 0x0205, 0x2013, 0x0000,
-- 0x080c, 0xd786, 0x0804, 0xc4fa, 0xa868, 0xd0fc, 0x0120, 0x2009,
-- 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c, 0xcc24, 0x00ae,
-- 0x080c, 0xd786, 0x080c, 0xcc75, 0x0804, 0xc4fc, 0x080c, 0xd3d8,
-- 0x0804, 0xc509, 0xa87c, 0xd0ac, 0x0904, 0xc515, 0xa880, 0xd0bc,
-- 0x1904, 0xc515, 0x9684, 0x0400, 0x0130, 0xa838, 0xab34, 0x9305,
-- 0x0904, 0xc515, 0x00b8, 0x7348, 0xa838, 0x9306, 0x1198, 0x734c,
-- 0xa834, 0x931e, 0x0904, 0xc515, 0x0068, 0xa87c, 0xd0ac, 0x0904,
-- 0xc4ed, 0xa838, 0xa934, 0x9105, 0x0904, 0xc4ed, 0xa880, 0xd0bc,
-- 0x1904, 0xc4ed, 0x080c, 0xd412, 0x0804, 0xc509, 0x0096, 0x00f6,
-- 0x6003, 0x0003, 0x6007, 0x0043, 0x2079, 0x026c, 0x7c04, 0x7b00,
-- 0x7e0c, 0x7d08, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0140, 0x6003,
-- 0x0002, 0x00fe, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400,
-- 0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500,
-- 0x9203, 0x0e90, 0xac36, 0xab3a, 0xae46, 0xad4a, 0x00fe, 0x6043,
-- 0x0000, 0x2c10, 0x080c, 0x1be0, 0x080c, 0x9564, 0x080c, 0x9bd3,
-- 0x009e, 0x0005, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040,
-- 0x0208, 0x000a, 0x0005, 0xc60f, 0xc60f, 0xc60f, 0xc60f, 0xc60f,
-- 0xc611, 0xc6a7, 0xc60f, 0xc60f, 0xc6be, 0xc74e, 0xc60f, 0xc60f,
-- 0xc60f, 0xc60f, 0xc763, 0xc60f, 0xc60f, 0xc60f, 0xc60f, 0x080c,
-+ 0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6,
-+ 0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x6043, 0x0000, 0x2c68,
-+ 0x0016, 0x2009, 0x0035, 0x080c, 0xd752, 0x001e, 0x1158, 0x622c,
-+ 0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386,
-+ 0x0006, 0x0128, 0x080c, 0xb2cc, 0x0020, 0x0039, 0x0010, 0x080c,
-+ 0xb909, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048,
-+ 0x9186, 0x0015, 0x0904, 0xb8f1, 0x918e, 0x0016, 0x1904, 0xb907,
-+ 0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300,
-+ 0x1904, 0xb8cb, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904,
-+ 0xb8ae, 0x0804, 0xb905, 0x6808, 0x9086, 0xffff, 0x1904, 0xb8f3,
-+ 0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940,
-+ 0x9105, 0x1904, 0xb8f3, 0x6824, 0xd084, 0x1904, 0xb8f3, 0xd0b4,
-+ 0x0158, 0x0016, 0x2001, 0x1986, 0x200c, 0x6018, 0x9102, 0x9082,
-+ 0x0005, 0x001e, 0x1a04, 0xb8f3, 0x080c, 0xd2bc, 0x685c, 0xa882,
-+ 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18,
-+ 0x2001, 0x000a, 0x080c, 0x936e, 0xa884, 0x920a, 0x0208, 0x8011,
-+ 0xaa86, 0x82ff, 0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c, 0xcddc,
-+ 0x00ce, 0x0804, 0xb905, 0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c,
-+ 0x61bb, 0x0010, 0x080c, 0x65c8, 0x00ce, 0x1904, 0xb8f3, 0x00c6,
-+ 0x2d60, 0x080c, 0xb2cc, 0x00ce, 0x0804, 0xb905, 0x00c6, 0x080c,
-+ 0xb31e, 0x0198, 0x6017, 0x0000, 0x6810, 0x6012, 0x080c, 0xd54d,
-+ 0x6023, 0x0003, 0x6904, 0x00c6, 0x2d60, 0x080c, 0xb2cc, 0x00ce,
-+ 0x080c, 0xb34b, 0x00ce, 0x0804, 0xb905, 0x2001, 0x1988, 0x2004,
-+ 0x6842, 0x00ce, 0x04d0, 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010,
-+ 0x00b6, 0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60,
-+ 0xa87b, 0x0003, 0x080c, 0xd796, 0x6007, 0x0085, 0x6003, 0x000b,
-+ 0x6023, 0x0002, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00ce, 0x00e8,
-+ 0x700c, 0x9086, 0x2a00, 0x1138, 0x2001, 0x1988, 0x2004, 0x6842,
-+ 0x00a0, 0x0479, 0x00a0, 0x89ff, 0x090c, 0x0dc5, 0x00c6, 0x00d6,
-+ 0x2d60, 0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x6cb2, 0x080c,
-+ 0xd2bc, 0x080c, 0xb2ff, 0x00de, 0x00ce, 0x080c, 0xb2cc, 0x009e,
-+ 0x0005, 0x9186, 0x0015, 0x1128, 0x2001, 0x1988, 0x2004, 0x6842,
-+ 0x0068, 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c,
-+ 0xee80, 0x080c, 0x8a1e, 0x080c, 0xb2cc, 0x00ce, 0x080c, 0xb2cc,
-+ 0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4,
-+ 0x0130, 0x2001, 0x1988, 0x2004, 0x6842, 0x0804, 0xb983, 0x00c6,
-+ 0x2d60, 0x080c, 0xccdf, 0x00ce, 0x6804, 0x9086, 0x0050, 0x1168,
-+ 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f,
-+ 0x01a8, 0x89ff, 0x090c, 0x0dc5, 0x6800, 0x9086, 0x0004, 0x1190,
-+ 0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880,
-+ 0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001, 0x0007,
-+ 0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824,
-+ 0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec,
-+ 0x1d68, 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38, 0x7020,
-+ 0x683e, 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c, 0xd444,
-+ 0x080c, 0x9aaa, 0x0010, 0x080c, 0xb2cc, 0x004e, 0x003e, 0x002e,
-+ 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210,
-+ 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xb9ee, 0x700c,
-+ 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904, 0xb9ee,
-+ 0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007,
-+ 0x0904, 0xb9ee, 0x9286, 0x0002, 0x0904, 0xb9ee, 0x9286, 0x0000,
-+ 0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c, 0x9186,
-+ 0x0015, 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038, 0x2060,
-+ 0x6104, 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186,
-+ 0x004d, 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052, 0x0160,
-+ 0x6014, 0x0096, 0x2048, 0x080c, 0xd0d1, 0x090c, 0x0dc5, 0xa87b,
-+ 0x0003, 0x009e, 0x080c, 0xd796, 0x6007, 0x0085, 0x6003, 0x000b,
-+ 0x6023, 0x0002, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00ce, 0x0030,
-+ 0x6038, 0x2070, 0x2001, 0x1988, 0x2004, 0x7042, 0x080c, 0xb2cc,
-+ 0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014,
-+ 0x2048, 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c,
-+ 0xbc00, 0xc48c, 0xbc02, 0x0470, 0x0096, 0x0156, 0x0036, 0x0026,
-+ 0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004, 0x080c,
-+ 0xc372, 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xba5f, 0x0096,
-+ 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006,
-+ 0x20a9, 0x0004, 0x080c, 0xc372, 0x002e, 0x003e, 0x015e, 0x009e,
-+ 0x15b0, 0x7238, 0xba0a, 0x733c, 0xbb0e, 0x83ff, 0x0118, 0xbc00,
-+ 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be,
-+ 0x0804, 0xb6d5, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e,
-+ 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-+ 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031,
-+ 0x0000, 0x2041, 0x1252, 0x080c, 0xb7ea, 0x0130, 0x00fe, 0x009e,
-+ 0x080c, 0xb2cc, 0x00be, 0x0005, 0x080c, 0xbcaf, 0x0cb8, 0x2b78,
-+ 0x00f6, 0x080c, 0x3250, 0x080c, 0xd7f1, 0x00fe, 0x00c6, 0x080c,
-+ 0xb276, 0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007,
-+ 0x0001, 0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x6663, 0x080c,
-+ 0x668f, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x00ce, 0x0804, 0xba32,
-+ 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0dc5, 0x91b2, 0x0040, 0x1a04,
-+ 0xbae8, 0x0002, 0xbad6, 0xbad6, 0xbacc, 0xbad6, 0xbad6, 0xbad6,
-+ 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbad6, 0xbaca, 0xbad6, 0xbad6, 0xbaca, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbaca, 0xbacc, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbad6, 0xbad6, 0xbaca, 0xbaca,
-+ 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbaca, 0xbad6,
-+ 0xbaca, 0xbaca, 0x080c, 0x0dc5, 0x0066, 0x00b6, 0x6610, 0x2658,
-+ 0xb8cc, 0xc08c, 0xb8ce, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001,
-+ 0x6106, 0x9186, 0x0032, 0x0118, 0x080c, 0x9540, 0x0010, 0x080c,
-+ 0x94f8, 0x0126, 0x2091, 0x8000, 0x080c, 0x9aaa, 0x012e, 0x0005,
-+ 0x2600, 0x0002, 0xbad6, 0xbad6, 0xbafc, 0xbad6, 0xbad6, 0xbafc,
-+ 0xbafc, 0xbafc, 0xbafc, 0xbad6, 0xbafc, 0xbad6, 0xbafc, 0xbad6,
-+ 0xbafc, 0xbafc, 0xbafc, 0xbafc, 0x080c, 0x0dc5, 0x6004, 0x90b2,
-+ 0x0053, 0x1a0c, 0x0dc5, 0x91b6, 0x0013, 0x0904, 0xbbd1, 0x91b6,
-+ 0x0027, 0x1904, 0xbb7b, 0x080c, 0x999e, 0x6004, 0x080c, 0xd2c8,
-+ 0x01b0, 0x080c, 0xd2d9, 0x01a8, 0x908e, 0x0021, 0x0904, 0xbb78,
-+ 0x908e, 0x0022, 0x1130, 0x080c, 0xb701, 0x0904, 0xbb74, 0x0804,
-+ 0xbb75, 0x908e, 0x003d, 0x0904, 0xbb78, 0x0804, 0xbb6e, 0x080c,
-+ 0x3279, 0x2001, 0x0007, 0x080c, 0x6663, 0x6010, 0x00b6, 0x2058,
-+ 0xb9a0, 0x00be, 0x080c, 0xbcaf, 0x9186, 0x007e, 0x1148, 0x2001,
-+ 0x1837, 0x2014, 0xc285, 0x080c, 0x7630, 0x1108, 0xc2ad, 0x2202,
-+ 0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xef8d, 0x002e,
-+ 0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028, 0x080c,
-+ 0x969d, 0x0076, 0x903e, 0x080c, 0x9570, 0x6010, 0x00b6, 0x905d,
-+ 0x0100, 0x00be, 0x2c08, 0x080c, 0xe915, 0x007e, 0x003e, 0x002e,
-+ 0x001e, 0x080c, 0xd7f1, 0x0016, 0x080c, 0xd545, 0x080c, 0xb2cc,
-+ 0x001e, 0x080c, 0x334c, 0x080c, 0x9aaa, 0x0030, 0x080c, 0xd545,
-+ 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0005, 0x080c, 0xbcaf, 0x0cb0,
-+ 0x080c, 0xbceb, 0x0c98, 0x9186, 0x0015, 0x0118, 0x9186, 0x0016,
-+ 0x1148, 0x080c, 0xd802, 0x0d80, 0x6000, 0x9086, 0x0002, 0x0904,
-+ 0xbcf6, 0x0c50, 0x9186, 0x0014, 0x1d38, 0x080c, 0x999e, 0x6004,
-+ 0x908e, 0x0022, 0x1118, 0x080c, 0xb701, 0x09f0, 0x080c, 0x3250,
-+ 0x080c, 0xd7f1, 0x080c, 0xd2c8, 0x1198, 0x080c, 0x3279, 0x6010,
-+ 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xbcaf, 0x9186, 0x007e,
-+ 0x1128, 0x2001, 0x1837, 0x200c, 0xc185, 0x2102, 0x0804, 0xbb6e,
-+ 0x080c, 0xd2d9, 0x1120, 0x080c, 0xbcaf, 0x0804, 0xbb6e, 0x6004,
-+ 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079,
-+ 0x0000, 0x080c, 0x35e7, 0x00fe, 0x00ee, 0x0804, 0xbb6e, 0x6004,
-+ 0x908e, 0x0021, 0x0d40, 0x908e, 0x0022, 0x090c, 0xbcaf, 0x0804,
-+ 0xbb6e, 0x90b2, 0x0040, 0x1a04, 0xbc8b, 0x2008, 0x0002, 0xbc19,
-+ 0xbc1a, 0xbc1d, 0xbc20, 0xbc23, 0xbc30, 0xbc17, 0xbc17, 0xbc17,
-+ 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17,
-+ 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17,
-+ 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc33, 0xbc40, 0xbc17,
-+ 0xbc42, 0xbc40, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc40,
-+ 0xbc40, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17, 0xbc17,
-+ 0xbc17, 0xbc72, 0xbc40, 0xbc17, 0xbc3c, 0xbc17, 0xbc17, 0xbc17,
-+ 0xbc3d, 0xbc17, 0xbc17, 0xbc17, 0xbc40, 0xbc69, 0xbc17, 0x080c,
-+ 0x0dc5, 0x0430, 0x2001, 0x000b, 0x0470, 0x2001, 0x0003, 0x0458,
-+ 0x2001, 0x0005, 0x0440, 0x6010, 0x00b6, 0x2058, 0xb804, 0x00be,
-+ 0x9084, 0x00ff, 0x9086, 0x0000, 0x1500, 0x2001, 0x0001, 0x00d8,
-+ 0x2001, 0x0009, 0x00c0, 0x080c, 0x999e, 0x6003, 0x0005, 0x080c,
-+ 0xd7f4, 0x080c, 0x9aaa, 0x0070, 0x0018, 0x0010, 0x080c, 0x6663,
-+ 0x0804, 0xbc83, 0x080c, 0x999e, 0x080c, 0xd7f4, 0x6003, 0x0004,
-+ 0x080c, 0x9aaa, 0x0005, 0x080c, 0x6663, 0x080c, 0x999e, 0x6003,
-+ 0x0002, 0x0036, 0x2019, 0x1852, 0x2304, 0x9084, 0xff00, 0x1120,
-+ 0x2001, 0x1986, 0x201c, 0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0,
-+ 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x003e, 0x080c, 0x9aaa,
-+ 0x0c08, 0x080c, 0x999e, 0x080c, 0xd545, 0x080c, 0xb2cc, 0x080c,
-+ 0x9aaa, 0x08c0, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000,
-+ 0x080c, 0x35e7, 0x00fe, 0x00ee, 0x080c, 0x999e, 0x080c, 0xb2cc,
-+ 0x080c, 0x9aaa, 0x0838, 0x080c, 0x999e, 0x6003, 0x0002, 0x080c,
-+ 0xd7f4, 0x0804, 0x9aaa, 0x2600, 0x2008, 0x0002, 0xbca2, 0xbc83,
-+ 0xbca0, 0xbc83, 0xbc83, 0xbca0, 0xbca0, 0xbca0, 0xbca0, 0xbc83,
-+ 0xbca0, 0xbc83, 0xbca0, 0xbc83, 0xbca0, 0xbca0, 0xbca0, 0xbca0,
-+ 0x080c, 0x0dc5, 0x080c, 0x999e, 0x0096, 0x6014, 0x2048, 0x080c,
-+ 0x6e98, 0x009e, 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0005, 0x00e6,
-+ 0x0096, 0x0026, 0x0016, 0x080c, 0xd0d1, 0x0568, 0x6014, 0x2048,
-+ 0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148,
-+ 0x080c, 0x556d, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
-+ 0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xd6b6,
-+ 0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004,
-+ 0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867,
-+ 0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005,
-+ 0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048,
-+ 0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610,
-+ 0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0dc5,
-+ 0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xd5d5, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xd61e, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xd64a, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xd567, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xd317, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xd358, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x001f, 0x1120, 0x080c, 0xb6a6, 0x0804, 0xbd7b,
-+ 0x6604, 0x96b6, 0x0000, 0x1118, 0x080c, 0xb9f4, 0x04e0, 0x6604,
-+ 0x96b6, 0x0022, 0x1118, 0x080c, 0xb6e2, 0x04a8, 0x6604, 0x96b6,
-+ 0x0035, 0x1118, 0x080c, 0xb808, 0x0470, 0x6604, 0x96b6, 0x0039,
-+ 0x1118, 0x080c, 0xb989, 0x0438, 0x6604, 0x96b6, 0x003d, 0x1118,
-+ 0x080c, 0xb71a, 0x0400, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c,
-+ 0xb756, 0x00c8, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xb797,
-+ 0x0090, 0x6604, 0x96b6, 0x0041, 0x1118, 0x080c, 0xb781, 0x0058,
-+ 0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128,
-+ 0x00be, 0x0804, 0xc087, 0x00be, 0x0005, 0x080c, 0xb366, 0x0cd8,
-+ 0xbd98, 0xbda6, 0xbd98, 0xbded, 0xbd98, 0xbfa4, 0xc094, 0xbd98,
-+ 0xbd98, 0xc05d, 0xbd98, 0xc073, 0x0096, 0x601f, 0x0000, 0x6014,
-+ 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0xb2cc,
-+ 0xa001, 0xa001, 0x0005, 0x6604, 0x96b6, 0x0004, 0x1130, 0x2001,
-+ 0x0001, 0x080c, 0x664f, 0x0804, 0xb2cc, 0x0005, 0x00e6, 0x2071,
-+ 0x1800, 0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xe8e6, 0x11b0,
-+ 0x6010, 0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc,
-+ 0x0110, 0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c,
-+ 0x6663, 0x080c, 0x3279, 0x080c, 0xb2cc, 0x0098, 0x2001, 0x000a,
-+ 0x080c, 0x6663, 0x080c, 0x3279, 0x6003, 0x0001, 0x6007, 0x0001,
-+ 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0020, 0x2001, 0x0001, 0x080c,
-+ 0xbf74, 0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006,
-+ 0x080c, 0x664f, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001,
-+ 0x0006, 0x080c, 0x668f, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6,
-+ 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xbf49, 0x6010,
-+ 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xc1e3, 0x0804,
-+ 0xbeb6, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0904, 0xbe58, 0x00d6,
-+ 0x080c, 0x7630, 0x01a0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac0,
-+ 0x002e, 0x0904, 0xbe57, 0x080c, 0x57e7, 0x1598, 0x6014, 0x2048,
-+ 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x0450, 0x6010,
-+ 0x00b6, 0x2058, 0xb910, 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026,
-+ 0x2011, 0x8008, 0x080c, 0x6ac0, 0x002e, 0x0548, 0x6014, 0x9005,
-+ 0x090c, 0x0dc5, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-+ 0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xd6b6,
-+ 0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-+ 0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3279, 0x080c,
-+ 0xb2cc, 0x001e, 0x080c, 0x334c, 0x00de, 0x0804, 0xbf4e, 0x00de,
-+ 0x080c, 0xc1d8, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
-+ 0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
-+ 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
-+ 0xd6b6, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-+ 0x2001, 0x0006, 0x080c, 0x6663, 0x080c, 0x3279, 0x080c, 0xb2cc,
-+ 0x0804, 0xbf4e, 0x080c, 0xbf5c, 0x6014, 0x9005, 0x0190, 0x2048,
-+ 0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-+ 0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd6b6,
-+ 0x08f8, 0x080c, 0xbf52, 0x0160, 0x9006, 0x080c, 0x664f, 0x2001,
-+ 0x0004, 0x080c, 0x668f, 0x2001, 0x0007, 0x080c, 0x6663, 0x08a0,
-+ 0x2001, 0x0004, 0x080c, 0x6663, 0x6003, 0x0001, 0x6007, 0x0003,
-+ 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0804, 0xbf4e, 0xb85c, 0xd0e4,
-+ 0x0178, 0x080c, 0xd4e7, 0x080c, 0x7630, 0x0118, 0xd0dc, 0x1904,
-+ 0xbe78, 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012, 0x0804, 0xbe78,
-+ 0x080c, 0xd524, 0x2011, 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006,
-+ 0x080c, 0xeab2, 0x000e, 0x1904, 0xbe78, 0xc0b5, 0x2012, 0x2001,
-+ 0x0006, 0x080c, 0x6663, 0x9006, 0x080c, 0x664f, 0x00c6, 0x2001,
-+ 0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6,
-+ 0x2071, 0x1800, 0x700c, 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010,
-+ 0x78ea, 0x7082, 0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e,
-+ 0x00fe, 0x080c, 0x28bc, 0x00f6, 0x2100, 0x900e, 0x080c, 0x2873,
-+ 0x795e, 0x00fe, 0x9186, 0x0081, 0x01f0, 0x2009, 0x0081, 0x00e0,
-+ 0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x78e7, 0x0000,
-+ 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x28bc,
-+ 0x00f6, 0x2079, 0x1800, 0x7982, 0x2100, 0x900e, 0x797e, 0x080c,
-+ 0x2873, 0x795e, 0x00fe, 0x8108, 0x080c, 0x66b2, 0x2b00, 0x00ce,
-+ 0x1904, 0xbe78, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150,
-+ 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d,
-+ 0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x6663, 0x6023, 0x0001,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9540, 0x080c, 0x9aaa,
-+ 0x0028, 0x080c, 0xbcaf, 0x2001, 0x0001, 0x0431, 0x00de, 0x009e,
-+ 0x00be, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001,
-+ 0x1848, 0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xefe6, 0x0190,
-+ 0x2071, 0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284,
-+ 0xff00, 0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110,
-+ 0xb912, 0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158, 0x2001,
-+ 0x0007, 0x080c, 0x6663, 0x080c, 0x57e7, 0x1120, 0x2001, 0x0007,
-+ 0x080c, 0x668f, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048,
-+ 0xa868, 0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6,
-+ 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c,
-+ 0x4c42, 0x004e, 0x003e, 0x080c, 0x3279, 0x6020, 0x9086, 0x000a,
-+ 0x1108, 0x0005, 0x0804, 0xb2cc, 0x00b6, 0x00e6, 0x0026, 0x0016,
-+ 0x2071, 0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xc053, 0x2001,
-+ 0x180d, 0x2004, 0xd08c, 0x0904, 0xc006, 0x00d6, 0x080c, 0x7630,
-+ 0x01a0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6ac0, 0x002e, 0x0904,
-+ 0xc005, 0x080c, 0x57e7, 0x1598, 0x6014, 0x2048, 0xa807, 0x0000,
-+ 0xa867, 0x0103, 0xa833, 0xdead, 0x0450, 0x6010, 0x00b6, 0x2058,
-+ 0xb910, 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026, 0x2011, 0x8008,
-+ 0x080c, 0x6ac0, 0x002e, 0x0548, 0x6014, 0x9005, 0x090c, 0x0dc5,
-+ 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
-+ 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xd6b6, 0x0040, 0x6014,
-+ 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010,
-+ 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3279, 0x080c, 0xb2cc, 0x001e,
-+ 0x080c, 0x334c, 0x00de, 0x0804, 0xc058, 0x00de, 0x080c, 0x57e7,
-+ 0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-+ 0xbba0, 0x2021, 0x0006, 0x080c, 0x4df9, 0x004e, 0x003e, 0x00d6,
-+ 0x6010, 0x2058, 0x080c, 0x67b8, 0x080c, 0xbddb, 0x00de, 0x080c,
-+ 0xc2ae, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001,
-+ 0x0006, 0x080c, 0x6663, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864,
-+ 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e,
-+ 0x2011, 0x4000, 0x080c, 0xd6b6, 0x0060, 0xa864, 0x9084, 0x00ff,
-+ 0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-+ 0x0200, 0x009e, 0x080c, 0x3279, 0x6020, 0x9086, 0x000a, 0x0140,
-+ 0x080c, 0xb2cc, 0x0028, 0x080c, 0xbcaf, 0x9006, 0x080c, 0xbf74,
-+ 0x001e, 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1824, 0x2204,
-+ 0x9086, 0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x6663, 0x6003,
-+ 0x0001, 0x6007, 0x0001, 0x080c, 0x9540, 0x0804, 0x9aaa, 0x2001,
-+ 0x0001, 0x0804, 0xbf74, 0x2030, 0x2011, 0x1824, 0x2204, 0x9086,
-+ 0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007, 0x080c,
-+ 0x6663, 0x0804, 0xb2cc, 0x2001, 0x0001, 0x0804, 0xbf74, 0x0002,
-+ 0xbd98, 0xc09f, 0xbd98, 0xc0e2, 0xbd98, 0xc18f, 0xc094, 0xbd9b,
-+ 0xbd98, 0xc1a3, 0xbd98, 0xc1b5, 0x6604, 0x9686, 0x0003, 0x0904,
-+ 0xbfa4, 0x96b6, 0x001e, 0x1110, 0x080c, 0xb2cc, 0x0005, 0x00b6,
-+ 0x00d6, 0x00c6, 0x080c, 0xc1c7, 0x11a0, 0x9006, 0x080c, 0x664f,
-+ 0x080c, 0x3250, 0x080c, 0xd7f1, 0x2001, 0x0002, 0x080c, 0x6663,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9540, 0x080c, 0x9aaa,
-+ 0x0428, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010,
-+ 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0180, 0x8001, 0xb842,
-+ 0x601b, 0x000a, 0x0098, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-+ 0x908e, 0x1900, 0x0158, 0x908e, 0x1e00, 0x0990, 0x080c, 0x3250,
-+ 0x080c, 0xd7f1, 0x2001, 0x0001, 0x080c, 0xbf74, 0x00ce, 0x00de,
-+ 0x00be, 0x0005, 0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xc1d5,
-+ 0x00d6, 0x2069, 0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058,
-+ 0xb8a0, 0x9086, 0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000,
-+ 0x206a, 0x00de, 0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x664f,
-+ 0x2001, 0x0002, 0x080c, 0x6663, 0x6003, 0x0001, 0x6007, 0x0002,
-+ 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0804, 0xc15f, 0x080c, 0xd0d1,
-+ 0x01b0, 0x6014, 0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138,
-+ 0x6007, 0x0016, 0x2001, 0x0002, 0x080c, 0xd713, 0x00b0, 0x6014,
-+ 0x2048, 0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001,
-+ 0x180e, 0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084,
-+ 0x00ff, 0x9005, 0x1110, 0x9006, 0x0c38, 0x080c, 0xbcaf, 0x2009,
-+ 0x026e, 0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686,
-+ 0x000b, 0x01c8, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118,
-+ 0x9686, 0x0009, 0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009,
-+ 0x0190, 0x2001, 0x0004, 0x080c, 0x6663, 0x2001, 0x0028, 0x601a,
-+ 0x6007, 0x0052, 0x0020, 0x2001, 0x0001, 0x080c, 0xbf74, 0x002e,
-+ 0x00be, 0x009e, 0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048,
-+ 0x080c, 0xd0d1, 0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868,
-+ 0xd0fc, 0x0108, 0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
-+ 0x9005, 0x0138, 0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016,
-+ 0x08f0, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800,
-+ 0x080c, 0x60ba, 0x00ee, 0x0010, 0x080c, 0x3250, 0x0860, 0x2001,
-+ 0x0004, 0x080c, 0x6663, 0x080c, 0xc1d5, 0x1140, 0x6003, 0x0001,
-+ 0x6007, 0x0003, 0x080c, 0x9540, 0x0804, 0x9aaa, 0x080c, 0xbcaf,
-+ 0x9006, 0x0804, 0xbf74, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c,
-+ 0x6663, 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x9540, 0x0804,
-+ 0x9aaa, 0x2001, 0x0001, 0x0804, 0xbf74, 0x00f9, 0x1160, 0x2001,
-+ 0x000a, 0x080c, 0x6663, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-+ 0x9540, 0x0804, 0x9aaa, 0x2001, 0x0001, 0x0804, 0xbf74, 0x2009,
-+ 0x026e, 0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104,
-+ 0x9084, 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005,
-+ 0x00b6, 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x672c, 0x001e,
-+ 0x00ce, 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036,
-+ 0x0016, 0x6010, 0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003,
-+ 0x200a, 0x080c, 0xc280, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd,
-+ 0x200a, 0x080c, 0x6a98, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a,
-+ 0x080c, 0xec2a, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019,
-+ 0x002a, 0x2009, 0x0001, 0x080c, 0x321b, 0x00e6, 0x2071, 0x1800,
-+ 0x080c, 0x3000, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009,
-+ 0x007f, 0x080c, 0x334c, 0x8108, 0x1f04, 0xc219, 0x015e, 0x00ce,
-+ 0x080c, 0xc1d8, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001,
-+ 0x2001, 0x1837, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc,
-+ 0x0118, 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001,
-+ 0x1837, 0x2102, 0x9184, 0x0050, 0x9086, 0x0050, 0x05d0, 0x2079,
-+ 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181f, 0x206a, 0x78e6,
-+ 0x0006, 0x8e70, 0x2e04, 0x2069, 0x1820, 0x206a, 0x78ea, 0x7832,
-+ 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009, 0x182c,
-+ 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x28bc, 0x080c,
-+ 0x7630, 0x0170, 0x2071, 0x0260, 0x2069, 0x1982, 0x7048, 0x206a,
-+ 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c, 0xd4e7,
-+ 0x0040, 0x2001, 0x0006, 0x080c, 0x6663, 0x080c, 0x3279, 0x080c,
-+ 0xb2cc, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005,
-+ 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182c, 0x231c,
-+ 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff, 0x7004,
-+ 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276, 0x20a9,
-+ 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xc372, 0x1148, 0x2011,
-+ 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xc372, 0x1100,
-+ 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6, 0x2071,
-+ 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086, 0x0800,
-+ 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086, 0x0100,
-+ 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010,
-+ 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076,
-+ 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2029,
-+ 0x19f1, 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061, 0x1cd0, 0x2071,
-+ 0x1800, 0x7254, 0x7074, 0x9202, 0x1a04, 0xc33e, 0x080c, 0x8cf0,
-+ 0x0904, 0xc337, 0x080c, 0xec5b, 0x0904, 0xc337, 0x6720, 0x9786,
-+ 0x0007, 0x0904, 0xc337, 0x2500, 0x9c06, 0x0904, 0xc337, 0x2400,
-+ 0x9c06, 0x05e8, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005,
-+ 0x0130, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1580, 0x00c6,
-+ 0x6000, 0x9086, 0x0004, 0x1110, 0x080c, 0x1a8e, 0x9786, 0x000a,
-+ 0x0148, 0x080c, 0xd2d9, 0x1130, 0x00ce, 0x080c, 0xbcaf, 0x080c,
-+ 0xb2ff, 0x00e8, 0x6014, 0x2048, 0x080c, 0xd0d1, 0x01a8, 0x9786,
-+ 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096,
-+ 0xa878, 0x2048, 0x080c, 0x0fc0, 0x009e, 0xab7a, 0xa877, 0x0000,
-+ 0x080c, 0x6e8b, 0x080c, 0xd2bc, 0x080c, 0xb2ff, 0x00ce, 0x9ce0,
-+ 0x0018, 0x7068, 0x9c02, 0x1210, 0x0804, 0xc2e1, 0x012e, 0x000e,
-+ 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005,
-+ 0x9786, 0x0006, 0x1118, 0x080c, 0xebcd, 0x0c30, 0x9786, 0x0009,
-+ 0x1148, 0x6000, 0x9086, 0x0004, 0x0d08, 0x2009, 0x004c, 0x080c,
-+ 0xb34b, 0x08e0, 0x9786, 0x000a, 0x0980, 0x0820, 0x220c, 0x2304,
-+ 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xc35e, 0x9006, 0x0005,
-+ 0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008, 0x9006, 0x918d,
-+ 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906, 0x8006, 0x8007,
-+ 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300, 0x2098, 0x3518,
-+ 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140, 0x8210, 0x8319,
-+ 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x9102,
-+ 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0x918d, 0x0001,
-+ 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x810f, 0x2304, 0x9106,
-+ 0x1130, 0x8210, 0x8318, 0x1f04, 0xc39c, 0x9006, 0x0005, 0x918d,
-+ 0x0001, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dc5, 0x080c,
-+ 0xd2c8, 0x0120, 0x080c, 0xd2d9, 0x0168, 0x0028, 0x080c, 0x3279,
-+ 0x080c, 0xd2d9, 0x0138, 0x080c, 0x999e, 0x080c, 0xb2cc, 0x080c,
-+ 0x9aaa, 0x0005, 0x080c, 0xbcaf, 0x0cb0, 0x9182, 0x0054, 0x1220,
-+ 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xc3e1, 0xc3e1, 0xc3e1,
-+ 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e1,
-+ 0xc3e3, 0xc3e3, 0xc3e3, 0xc3e3, 0xc3e1, 0xc3e1, 0xc3e1, 0xc3e3,
-+ 0xc3e1, 0x080c, 0x0dc5, 0x600b, 0xffff, 0x6003, 0x0001, 0x6106,
-+ 0x080c, 0x94f8, 0x0126, 0x2091, 0x8000, 0x080c, 0x9aaa, 0x012e,
-+ 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0040, 0x0804,
-+ 0xc47b, 0x9186, 0x0027, 0x1520, 0x080c, 0x999e, 0x080c, 0x3250,
-+ 0x080c, 0xd7f1, 0x0096, 0x6114, 0x2148, 0x080c, 0xd0d1, 0x0198,
-+ 0x080c, 0xd2d9, 0x1118, 0x080c, 0xbcaf, 0x0068, 0xa867, 0x0103,
-+ 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c,
-+ 0x6e98, 0x080c, 0xd2bc, 0x009e, 0x080c, 0xb2cc, 0x0804, 0x9aaa,
-+ 0x9186, 0x0014, 0x1120, 0x6004, 0x9082, 0x0040, 0x00b8, 0x9186,
-+ 0x0046, 0x0150, 0x9186, 0x0045, 0x0138, 0x9186, 0x0053, 0x0120,
-+ 0x9186, 0x0048, 0x190c, 0x0dc5, 0x080c, 0xd802, 0x0130, 0x6000,
-+ 0x9086, 0x0002, 0x1110, 0x0804, 0xc4b9, 0x0005, 0x0002, 0xc455,
-+ 0xc453, 0xc453, 0xc453, 0xc453, 0xc453, 0xc453, 0xc453, 0xc453,
-+ 0xc453, 0xc453, 0xc470, 0xc470, 0xc470, 0xc470, 0xc453, 0xc470,
-+ 0xc453, 0xc470, 0xc453, 0x080c, 0x0dc5, 0x080c, 0x999e, 0x0096,
-+ 0x6114, 0x2148, 0x080c, 0xd0d1, 0x0168, 0xa867, 0x0103, 0xa87b,
-+ 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x6e98,
-+ 0x080c, 0xd2bc, 0x009e, 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0005,
-+ 0x080c, 0x999e, 0x080c, 0xd2d9, 0x090c, 0xbcaf, 0x080c, 0xb2cc,
-+ 0x080c, 0x9aaa, 0x0005, 0x0002, 0xc492, 0xc490, 0xc490, 0xc490,
-+ 0xc490, 0xc490, 0xc490, 0xc490, 0xc490, 0xc490, 0xc490, 0xc4a9,
-+ 0xc4a9, 0xc4a9, 0xc4a9, 0xc490, 0xc4b3, 0xc490, 0xc4a9, 0xc490,
-+ 0x080c, 0x0dc5, 0x0096, 0x080c, 0x999e, 0x6014, 0x2048, 0x2001,
-+ 0x1988, 0x2004, 0x6042, 0xa97c, 0xd1ac, 0x0140, 0x6003, 0x0004,
-+ 0xa87c, 0x9085, 0x0400, 0xa87e, 0x009e, 0x0005, 0x6003, 0x0002,
-+ 0x0cb8, 0x080c, 0x999e, 0x080c, 0xd7f4, 0x080c, 0xd7f9, 0x6003,
-+ 0x000f, 0x0804, 0x9aaa, 0x080c, 0x999e, 0x080c, 0xb2cc, 0x0804,
-+ 0x9aaa, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
-+ 0x0005, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d7, 0xc5b7,
-+ 0xc4d5, 0xc5eb, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5,
-+ 0xc4d5, 0xc4d5, 0xc4d5, 0xc4d5, 0xc5eb, 0x080c, 0x0dc5, 0x00b6,
-+ 0x0096, 0x6114, 0x2148, 0x7644, 0x96b4, 0x0fff, 0x86ff, 0x1528,
-+ 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc5a6, 0xa87b, 0x0000,
-+ 0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-+ 0x9115, 0x190c, 0xc784, 0x080c, 0x6cb2, 0x6210, 0x2258, 0xba3c,
-+ 0x82ff, 0x0110, 0x8211, 0xba3e, 0x7044, 0xd0e4, 0x1904, 0xc587,
-+ 0x080c, 0xb2cc, 0x009e, 0x00be, 0x0005, 0x968c, 0x0c00, 0x0150,
-+ 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc58b, 0x7348, 0xab92,
-+ 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0508, 0x9186,
-+ 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b,
-+ 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100, 0x9205,
-+ 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206, 0x0118, 0xa992,
-+ 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010,
-+ 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8,
-+ 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804,
-+ 0xc4de, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210,
-+ 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025,
-+ 0x080c, 0xcc7e, 0x003e, 0xd6cc, 0x0904, 0xc4f3, 0x7154, 0xa98a,
-+ 0x81ff, 0x0904, 0xc4f3, 0x9192, 0x0021, 0x1278, 0x8304, 0x9098,
-+ 0x0018, 0x2011, 0x0029, 0x080c, 0xcc7e, 0x2011, 0x0205, 0x2013,
-+ 0x0000, 0x080c, 0xd77f, 0x0804, 0xc4f3, 0xa868, 0xd0fc, 0x0120,
-+ 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c, 0xcc1d,
-+ 0x00ae, 0x080c, 0xd77f, 0x080c, 0xcc6e, 0x0804, 0xc4f5, 0x080c,
-+ 0xd3d1, 0x0804, 0xc502, 0xa87c, 0xd0ac, 0x0904, 0xc50e, 0xa880,
-+ 0xd0bc, 0x1904, 0xc50e, 0x9684, 0x0400, 0x0130, 0xa838, 0xab34,
-+ 0x9305, 0x0904, 0xc50e, 0x00b8, 0x7348, 0xa838, 0x9306, 0x1198,
-+ 0x734c, 0xa834, 0x931e, 0x0904, 0xc50e, 0x0068, 0xa87c, 0xd0ac,
-+ 0x0904, 0xc4e6, 0xa838, 0xa934, 0x9105, 0x0904, 0xc4e6, 0xa880,
-+ 0xd0bc, 0x1904, 0xc4e6, 0x080c, 0xd40b, 0x0804, 0xc502, 0x0096,
-+ 0x00f6, 0x6003, 0x0003, 0x6007, 0x0043, 0x2079, 0x026c, 0x7c04,
-+ 0x7b00, 0x7e0c, 0x7d08, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0140,
-+ 0x6003, 0x0002, 0x00fe, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058,
-+ 0x2400, 0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102,
-+ 0x2500, 0x9203, 0x0e90, 0xac36, 0xab3a, 0xae46, 0xad4a, 0x00fe,
-+ 0x6043, 0x0000, 0x2c10, 0x080c, 0x1be0, 0x080c, 0x955d, 0x080c,
-+ 0x9bcc, 0x009e, 0x0005, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182,
-+ 0x0040, 0x0208, 0x000a, 0x0005, 0xc608, 0xc608, 0xc608, 0xc608,
-+ 0xc608, 0xc60a, 0xc6a0, 0xc608, 0xc608, 0xc6b7, 0xc747, 0xc608,
-+ 0xc608, 0xc608, 0xc608, 0xc75c, 0xc608, 0xc608, 0xc608, 0xc608,
-+ 0x080c, 0x0dc5, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260,
-+ 0x6114, 0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5,
-+ 0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
-+ 0xba3e, 0x00be, 0x86ff, 0x0904, 0xc69b, 0x9694, 0xff00, 0x9284,
-+ 0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300,
-+ 0x0904, 0xc69b, 0x080c, 0x100e, 0x090c, 0x0dc5, 0x2900, 0xb07a,
-+ 0xb77c, 0xc7cd, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c,
-+ 0xa86e, 0xb070, 0xa872, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348,
-+ 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180,
-+ 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118,
-+ 0xa87b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010,
-+ 0xa87b, 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e,
-+ 0xd6c4, 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009,
-+ 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011,
-+ 0x0025, 0x080c, 0xcc7e, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a,
-+ 0x81ff, 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018,
-+ 0x2011, 0x0029, 0x080c, 0xcc7e, 0x2011, 0x0205, 0x2013, 0x0000,
-+ 0x0050, 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68,
-+ 0x2950, 0x080c, 0xcc1d, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005,
-+ 0x00f6, 0x00a6, 0x6003, 0x0003, 0x2079, 0x026c, 0x7c04, 0x7b00,
-+ 0x7e0c, 0x7d08, 0x6014, 0x2050, 0xb436, 0xb33a, 0xb646, 0xb54a,
-+ 0x00ae, 0x00fe, 0x2c10, 0x080c, 0x1be0, 0x0804, 0xa6af, 0x6003,
-+ 0x0002, 0x6004, 0x9086, 0x0040, 0x11c8, 0x0096, 0x6014, 0x2048,
-+ 0xa87c, 0xd0ac, 0x0160, 0x601c, 0xd084, 0x1130, 0x00f6, 0x2c00,
-+ 0x2078, 0x080c, 0x1768, 0x00fe, 0x6003, 0x0004, 0x0010, 0x6003,
-+ 0x0002, 0x009e, 0x080c, 0x999e, 0x080c, 0x9aaa, 0x0096, 0x2001,
-+ 0x1988, 0x2004, 0x6042, 0x080c, 0x9a5a, 0x080c, 0x9bcc, 0x6114,
-+ 0x2148, 0xa97c, 0xd1e4, 0x0904, 0xc742, 0xd1cc, 0x05c8, 0xa978,
-+ 0xa868, 0xd0fc, 0x0540, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006,
-+ 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x810e, 0x810e,
-+ 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0019,
-+ 0x2098, 0x0156, 0x20a9, 0x0020, 0x4003, 0x015e, 0x000e, 0xa882,
-+ 0x000e, 0xc0cc, 0xa87e, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c,
-+ 0x0fc0, 0x001e, 0x0458, 0x0016, 0x080c, 0x0fc0, 0x009e, 0xa87c,
-+ 0xc0cc, 0xa87e, 0xa974, 0x0016, 0x080c, 0xcc6e, 0x001e, 0x00f0,
-+ 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0180,
-+ 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd1dc, 0x0118,
-+ 0xa87b, 0x0015, 0x0038, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0010,
-+ 0xa87b, 0x0000, 0x0016, 0x080c, 0x6cb2, 0x001e, 0xd1e4, 0x1120,
-+ 0x080c, 0xb2cc, 0x009e, 0x0005, 0x080c, 0xd3d1, 0x0cd8, 0x6004,
-+ 0x9086, 0x0040, 0x1120, 0x080c, 0x999e, 0x080c, 0x9aaa, 0x2019,
-+ 0x0001, 0x080c, 0xaa42, 0x6003, 0x0002, 0x080c, 0xd7f9, 0x080c,
-+ 0x9a5a, 0x080c, 0x9bcc, 0x0005, 0x6004, 0x9086, 0x0040, 0x1120,
-+ 0x080c, 0x999e, 0x080c, 0x9aaa, 0x2019, 0x0001, 0x080c, 0xaa42,
-+ 0x080c, 0x9a5a, 0x080c, 0x3250, 0x080c, 0xd7f1, 0x0096, 0x6114,
-+ 0x2148, 0x080c, 0xd0d1, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029,
-+ 0xa877, 0x0000, 0x080c, 0x6e98, 0x080c, 0xd2bc, 0x009e, 0x080c,
-+ 0xb2cc, 0x080c, 0x9bcc, 0x0005, 0xa87b, 0x0015, 0xd1fc, 0x0180,
-+ 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006,
-+ 0x0016, 0x2009, 0x1a7d, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e,
-+ 0xa992, 0xa88e, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040,
-+ 0x0208, 0x000a, 0x0005, 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7,
-+ 0xc7b9, 0xc7b7, 0xc7b7, 0xc85f, 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7,
-+ 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7, 0xc7b7, 0xc991, 0x080c,
- 0x0dc5, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114,
- 0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e,
- 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
-- 0x00be, 0x86ff, 0x0904, 0xc6a2, 0x9694, 0xff00, 0x9284, 0x0c00,
-+ 0x00be, 0x86ff, 0x0904, 0xc858, 0x9694, 0xff00, 0x9284, 0x0c00,
- 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904,
-- 0xc6a2, 0x080c, 0x100e, 0x090c, 0x0dc5, 0x2900, 0xb07a, 0xb77c,
-- 0xc7cd, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e,
-- 0xb070, 0xa872, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92,
-- 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186,
-- 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b,
-- 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
-- 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4,
-- 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210,
-- 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025,
-- 0x080c, 0xcc85, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff,
-- 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011,
-- 0x0029, 0x080c, 0xcc85, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050,
-- 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950,
-- 0x080c, 0xcc24, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x00f6,
-- 0x00a6, 0x6003, 0x0003, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c,
-- 0x7d08, 0x6014, 0x2050, 0xb436, 0xb33a, 0xb646, 0xb54a, 0x00ae,
-- 0x00fe, 0x2c10, 0x080c, 0x1be0, 0x0804, 0xa6b6, 0x6003, 0x0002,
-- 0x6004, 0x9086, 0x0040, 0x11c8, 0x0096, 0x6014, 0x2048, 0xa87c,
-- 0xd0ac, 0x0160, 0x601c, 0xd084, 0x1130, 0x00f6, 0x2c00, 0x2078,
-- 0x080c, 0x1768, 0x00fe, 0x6003, 0x0004, 0x0010, 0x6003, 0x0002,
-- 0x009e, 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x0096, 0x2001, 0x1988,
-- 0x2004, 0x6042, 0x080c, 0x9a61, 0x080c, 0x9bd3, 0x6114, 0x2148,
-- 0xa97c, 0xd1e4, 0x0904, 0xc749, 0xd1cc, 0x05c8, 0xa978, 0xa868,
-- 0xd0fc, 0x0540, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0xa860,
-- 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x810e, 0x810e, 0x810f,
-- 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0019, 0x2098,
-- 0x0156, 0x20a9, 0x0020, 0x4003, 0x015e, 0x000e, 0xa882, 0x000e,
-- 0xc0cc, 0xa87e, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0fc0,
-- 0x001e, 0x0458, 0x0016, 0x080c, 0x0fc0, 0x009e, 0xa87c, 0xc0cc,
-- 0xa87e, 0xa974, 0x0016, 0x080c, 0xcc75, 0x001e, 0x00f0, 0xa867,
-- 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0180, 0x9086,
-- 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd1dc, 0x0118, 0xa87b,
-- 0x0015, 0x0038, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
-- 0x0000, 0x0016, 0x080c, 0x6cb9, 0x001e, 0xd1e4, 0x1120, 0x080c,
-- 0xb2d3, 0x009e, 0x0005, 0x080c, 0xd3d8, 0x0cd8, 0x6004, 0x9086,
-- 0x0040, 0x1120, 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x2019, 0x0001,
-- 0x080c, 0xaa49, 0x6003, 0x0002, 0x080c, 0xd800, 0x080c, 0x9a61,
-- 0x080c, 0x9bd3, 0x0005, 0x6004, 0x9086, 0x0040, 0x1120, 0x080c,
-- 0x99a5, 0x080c, 0x9ab1, 0x2019, 0x0001, 0x080c, 0xaa49, 0x080c,
-- 0x9a61, 0x080c, 0x3250, 0x080c, 0xd7f8, 0x0096, 0x6114, 0x2148,
-- 0x080c, 0xd0d8, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877,
-- 0x0000, 0x080c, 0x6e9f, 0x080c, 0xd2c3, 0x009e, 0x080c, 0xb2d3,
-- 0x080c, 0x9bd3, 0x0005, 0xa87b, 0x0015, 0xd1fc, 0x0180, 0xa87b,
-- 0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006, 0x0016,
-- 0x2009, 0x1a7d, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e, 0xa992,
-- 0xa88e, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
-- 0x000a, 0x0005, 0xc7be, 0xc7be, 0xc7be, 0xc7be, 0xc7be, 0xc7c0,
-- 0xc7be, 0xc7be, 0xc866, 0xc7be, 0xc7be, 0xc7be, 0xc7be, 0xc7be,
-- 0xc7be, 0xc7be, 0xc7be, 0xc7be, 0xc7be, 0xc998, 0x080c, 0x0dc5,
-- 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114, 0x2150,
-- 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210,
-- 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be,
-- 0x86ff, 0x0904, 0xc85f, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120,
-- 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xc85f,
-- 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0xb676,
-- 0x0c38, 0x080c, 0x100e, 0x090c, 0x0dc5, 0x2900, 0xb07a, 0xb77c,
-- 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c,
-- 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000, 0x9635, 0xae76,
-- 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c,
-- 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b,
-- 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4,
-- 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080,
-- 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86,
-- 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036,
-- 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xcc85, 0x003e,
-- 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021,
-- 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xcc85,
-- 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120,
-- 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xcc24, 0x080c,
-- 0x1a5a, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001, 0x1988,
-- 0x2004, 0x6042, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105,
-- 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002, 0xa97c, 0xd1e4,
-- 0x0904, 0xc993, 0x6043, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb800,
-- 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc962, 0xa978, 0xa868,
-- 0xd0fc, 0x0904, 0xc923, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006,
-- 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0904,
-- 0xc8f0, 0x9086, 0x0028, 0x1904, 0xc8dc, 0xa87b, 0x001c, 0xb07b,
-- 0x001c, 0x0804, 0xc8f8, 0x6024, 0xd0f4, 0x11d0, 0xa838, 0xaa34,
-- 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c, 0xaa34,
-- 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834, 0x9102,
-- 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5, 0x6026,
-- 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be, 0x9006,
-- 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc, 0x0140,
-- 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fc0, 0x009e,
-- 0x080c, 0xd412, 0x0804, 0xc993, 0xd1dc, 0x0158, 0xa87b, 0x0015,
-- 0xb07b, 0x0015, 0x080c, 0xd6a6, 0x0118, 0xb174, 0xc1dc, 0xb176,
-- 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040,
-- 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc78b,
-- 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860, 0x20e8,
-- 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06, 0x8006,
-- 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080, 0x0019,
-- 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e, 0xc0cc, 0xa87e,
-- 0x080c, 0xd786, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0fc0,
-- 0x001e, 0x0804, 0xc98f, 0x0016, 0x00a6, 0x2150, 0xb174, 0x9184,
-- 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128, 0xa87b,
-- 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b, 0x0015,
-- 0xb07b, 0x0015, 0x080c, 0xd6a6, 0x0118, 0xb174, 0xc1dc, 0xb176,
-- 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040,
-- 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc78b,
-- 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae, 0x080c,
-- 0x0fc0, 0x009e, 0x080c, 0xd786, 0xa974, 0x0016, 0x080c, 0xcc75,
-- 0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6,
-- 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00d0,
-- 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xd6a6, 0x0118, 0xa974,
-- 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0050,
-- 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-- 0x190c, 0xc78b, 0xa974, 0x0016, 0x080c, 0x6cb9, 0x001e, 0xd1e4,
-- 0x1120, 0x080c, 0xb2d3, 0x009e, 0x0005, 0x080c, 0xd3d8, 0x0cd8,
-- 0x6114, 0x0096, 0x2148, 0xa97c, 0xd1e4, 0x190c, 0x1a7a, 0x009e,
-- 0x0005, 0x080c, 0x99a5, 0x0010, 0x080c, 0x9a61, 0x080c, 0xd0d8,
-- 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c, 0xd2e0, 0x1118, 0x080c,
-- 0xbcb6, 0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c, 0xd18c,
-- 0x11b8, 0xd184, 0x1190, 0x6108, 0xa97a, 0x918e, 0x0029, 0x1110,
-- 0x080c, 0xef85, 0xa877, 0x0000, 0x080c, 0x6e9f, 0x009e, 0x080c,
-- 0xb2d3, 0x080c, 0x9ab1, 0x0804, 0x9bd3, 0xa87b, 0x0004, 0x0c90,
-- 0xa87b, 0x0004, 0x0c78, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040,
-- 0x0208, 0x000a, 0x0005, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef,
-- 0xc9f1, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef,
-- 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0xc9ef, 0x080c,
-- 0x0dc5, 0x080c, 0x57dd, 0x01f8, 0x6014, 0x7144, 0x918c, 0x0fff,
-- 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff, 0x0096, 0x904d,
-- 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139, 0x0128, 0xa867,
-- 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a, 0xaa9e,
-- 0x080c, 0x6e9f, 0x009e, 0x0804, 0xb2d3, 0x9182, 0x0085, 0x0002,
-- 0xca27, 0xca25, 0xca25, 0xca33, 0xca25, 0xca25, 0xca25, 0xca25,
-- 0xca25, 0xca25, 0xca25, 0xca25, 0xca25, 0x080c, 0x0dc5, 0x6003,
-- 0x0001, 0x6106, 0x080c, 0x94ff, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x9ab1, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6, 0x2071,
-- 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xd0c6, 0x01f8, 0x2268,
-- 0x6800, 0x9086, 0x0000, 0x01d0, 0x6010, 0x6d10, 0x952e, 0x11b0,
-- 0x00c6, 0x2d60, 0x00d6, 0x080c, 0xcce6, 0x00de, 0x00ce, 0x0158,
-- 0x702c, 0xd084, 0x1118, 0x080c, 0xccb0, 0x0010, 0x6803, 0x0002,
-- 0x6007, 0x0086, 0x0028, 0x080c, 0xccd2, 0x0d90, 0x6007, 0x0087,
-- 0x6003, 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x7220, 0x080c,
-- 0xd0c6, 0x0178, 0x6810, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-- 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2d60, 0x080c, 0xd412,
-- 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e, 0x0005, 0x9186, 0x0013,
-- 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5, 0x908a, 0x0092,
-- 0x1a0c, 0x0dc5, 0x9082, 0x0085, 0x00e2, 0x9186, 0x0027, 0x0120,
-- 0x9186, 0x0014, 0x190c, 0x0dc5, 0x080c, 0x99a5, 0x0096, 0x6014,
-- 0x2048, 0x080c, 0xd0d8, 0x0140, 0xa867, 0x0103, 0xa877, 0x0000,
-- 0xa87b, 0x0029, 0x080c, 0x6e9f, 0x009e, 0x080c, 0xb306, 0x0804,
-- 0x9ab1, 0xcab6, 0xcab8, 0xcab8, 0xcab6, 0xcab6, 0xcab6, 0xcab6,
-- 0xcab6, 0xcab6, 0xcab6, 0xcab6, 0xcab6, 0xcab6, 0x080c, 0x0dc5,
-- 0x080c, 0x99a5, 0x080c, 0xb306, 0x080c, 0x9ab1, 0x0005, 0x9186,
-- 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x04b8, 0x9186,
-- 0x0027, 0x11f8, 0x080c, 0x99a5, 0x080c, 0x3250, 0x080c, 0xd7f8,
-- 0x0096, 0x6014, 0x2048, 0x080c, 0xd0d8, 0x0150, 0xa867, 0x0103,
-- 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6e9f, 0x080c, 0xd2c3,
-- 0x009e, 0x080c, 0xb2d3, 0x080c, 0x9ab1, 0x0005, 0x080c, 0xb36d,
-- 0x0ce0, 0x9186, 0x0014, 0x1dd0, 0x080c, 0x99a5, 0x0096, 0x6014,
-- 0x2048, 0x080c, 0xd0d8, 0x0d60, 0xa867, 0x0103, 0xa877, 0x0000,
-- 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882, 0x08f0, 0x0002, 0xcb0e,
-- 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb26, 0xcb0c, 0xcb0c,
-- 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0x080c, 0x0dc5, 0x080c, 0x99a5,
-- 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186,
-- 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987, 0x2004,
-- 0x601a, 0x6003, 0x000c, 0x080c, 0x9ab1, 0x0005, 0x080c, 0x99a5,
-- 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186,
-- 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987, 0x2004,
-- 0x601a, 0x6003, 0x000e, 0x080c, 0x9ab1, 0x0005, 0x9182, 0x0092,
-- 0x1220, 0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0xb36d, 0xcb54,
-- 0xcb54, 0xcb54, 0xcb54, 0xcb56, 0xcba3, 0xcb54, 0xcb54, 0xcb54,
-- 0xcb54, 0xcb54, 0xcb54, 0xcb54, 0x080c, 0x0dc5, 0x0096, 0x6010,
-- 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034, 0x908c,
-+ 0xc858, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4,
-+ 0xb676, 0x0c38, 0x080c, 0x100e, 0x090c, 0x0dc5, 0x2900, 0xb07a,
-+ 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a,
-+ 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000, 0x9635,
-+ 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e,
-+ 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118,
-+ 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038,
-+ 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e,
-+ 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c,
-+ 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008,
-+ 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xcc7e,
-+ 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192,
-+ 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c,
-+ 0xcc7e, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc,
-+ 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xcc1d,
-+ 0x080c, 0x1a5a, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001,
-+ 0x1988, 0x2004, 0x6042, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940,
-+ 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002, 0xa97c,
-+ 0xd1e4, 0x0904, 0xc98c, 0x6043, 0x0000, 0x6010, 0x00b6, 0x2058,
-+ 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc95b, 0xa978,
-+ 0xa868, 0xd0fc, 0x0904, 0xc91c, 0x0016, 0xa87c, 0x0006, 0xa880,
-+ 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002,
-+ 0x0904, 0xc8e9, 0x9086, 0x0028, 0x1904, 0xc8d5, 0xa87b, 0x001c,
-+ 0xb07b, 0x001c, 0x0804, 0xc8f1, 0x6024, 0xd0f4, 0x11d0, 0xa838,
-+ 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c,
-+ 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834,
-+ 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5,
-+ 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be,
-+ 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc,
-+ 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fc0,
-+ 0x009e, 0x080c, 0xd40b, 0x0804, 0xc98c, 0xd1dc, 0x0158, 0xa87b,
-+ 0x0015, 0xb07b, 0x0015, 0x080c, 0xd69f, 0x0118, 0xb174, 0xc1dc,
-+ 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007,
-+ 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-+ 0xc784, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06,
-+ 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080,
-+ 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e, 0xc0cc,
-+ 0xa87e, 0x080c, 0xd77f, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c,
-+ 0x0fc0, 0x001e, 0x0804, 0xc988, 0x0016, 0x00a6, 0x2150, 0xb174,
-+ 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128,
-+ 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b,
-+ 0x0015, 0xb07b, 0x0015, 0x080c, 0xd69f, 0x0118, 0xb174, 0xc1dc,
-+ 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007,
-+ 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-+ 0xc784, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae,
-+ 0x080c, 0x0fc0, 0x009e, 0x080c, 0xd77f, 0xa974, 0x0016, 0x080c,
-+ 0xcc6e, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff,
-+ 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c,
-+ 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xd69f, 0x0118,
-+ 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007,
-+ 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-+ 0x9115, 0x190c, 0xc784, 0xa974, 0x0016, 0x080c, 0x6cb2, 0x001e,
-+ 0xd1e4, 0x1120, 0x080c, 0xb2cc, 0x009e, 0x0005, 0x080c, 0xd3d1,
-+ 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0xd1e4, 0x190c, 0x1a7a,
-+ 0x009e, 0x0005, 0x080c, 0x999e, 0x0010, 0x080c, 0x9a5a, 0x080c,
-+ 0xd0d1, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c, 0xd2d9, 0x1118,
-+ 0x080c, 0xbcaf, 0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c,
-+ 0xd18c, 0x11b8, 0xd184, 0x1190, 0x6108, 0xa97a, 0x918e, 0x0029,
-+ 0x1110, 0x080c, 0xef7e, 0xa877, 0x0000, 0x080c, 0x6e98, 0x009e,
-+ 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0804, 0x9bcc, 0xa87b, 0x0004,
-+ 0x0c90, 0xa87b, 0x0004, 0x0c78, 0x9182, 0x0054, 0x1220, 0x9182,
-+ 0x0040, 0x0208, 0x000a, 0x0005, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8,
-+ 0xc9e8, 0xc9ea, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8,
-+ 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8, 0xc9e8,
-+ 0x080c, 0x0dc5, 0x080c, 0x57db, 0x01f8, 0x6014, 0x7144, 0x918c,
-+ 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff, 0x0096,
-+ 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139, 0x0128,
-+ 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a,
-+ 0xaa9e, 0x080c, 0x6e98, 0x009e, 0x0804, 0xb2cc, 0x9182, 0x0085,
-+ 0x0002, 0xca20, 0xca1e, 0xca1e, 0xca2c, 0xca1e, 0xca1e, 0xca1e,
-+ 0xca1e, 0xca1e, 0xca1e, 0xca1e, 0xca1e, 0xca1e, 0x080c, 0x0dc5,
-+ 0x6003, 0x0001, 0x6106, 0x080c, 0x94f8, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x9aaa, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6,
-+ 0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xd0bf, 0x01f8,
-+ 0x2268, 0x6800, 0x9086, 0x0000, 0x01d0, 0x6010, 0x6d10, 0x952e,
-+ 0x11b0, 0x00c6, 0x2d60, 0x00d6, 0x080c, 0xccdf, 0x00de, 0x00ce,
-+ 0x0158, 0x702c, 0xd084, 0x1118, 0x080c, 0xcca9, 0x0010, 0x6803,
-+ 0x0002, 0x6007, 0x0086, 0x0028, 0x080c, 0xcccb, 0x0d90, 0x6007,
-+ 0x0087, 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x7220,
-+ 0x080c, 0xd0bf, 0x0178, 0x6810, 0x00b6, 0x2058, 0xb800, 0x00be,
-+ 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2d60, 0x080c,
-+ 0xd40b, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e, 0x0005, 0x9186,
-+ 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5, 0x908a,
-+ 0x0092, 0x1a0c, 0x0dc5, 0x9082, 0x0085, 0x00e2, 0x9186, 0x0027,
-+ 0x0120, 0x9186, 0x0014, 0x190c, 0x0dc5, 0x080c, 0x999e, 0x0096,
-+ 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0140, 0xa867, 0x0103, 0xa877,
-+ 0x0000, 0xa87b, 0x0029, 0x080c, 0x6e98, 0x009e, 0x080c, 0xb2ff,
-+ 0x0804, 0x9aaa, 0xcaaf, 0xcab1, 0xcab1, 0xcaaf, 0xcaaf, 0xcaaf,
-+ 0xcaaf, 0xcaaf, 0xcaaf, 0xcaaf, 0xcaaf, 0xcaaf, 0xcaaf, 0x080c,
-+ 0x0dc5, 0x080c, 0x999e, 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005,
-+ 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x04b8,
-+ 0x9186, 0x0027, 0x11f8, 0x080c, 0x999e, 0x080c, 0x3250, 0x080c,
-+ 0xd7f1, 0x0096, 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0150, 0xa867,
-+ 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6e98, 0x080c,
-+ 0xd2bc, 0x009e, 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0005, 0x080c,
-+ 0xb366, 0x0ce0, 0x9186, 0x0014, 0x1dd0, 0x080c, 0x999e, 0x0096,
-+ 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0d60, 0xa867, 0x0103, 0xa877,
-+ 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882, 0x08f0, 0x0002,
-+ 0xcb07, 0xcb05, 0xcb05, 0xcb05, 0xcb05, 0xcb05, 0xcb1f, 0xcb05,
-+ 0xcb05, 0xcb05, 0xcb05, 0xcb05, 0xcb05, 0x080c, 0x0dc5, 0x080c,
-+ 0x999e, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-+ 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987,
-+ 0x2004, 0x601a, 0x6003, 0x000c, 0x080c, 0x9aaa, 0x0005, 0x080c,
-+ 0x999e, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-+ 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987,
-+ 0x2004, 0x601a, 0x6003, 0x000e, 0x080c, 0x9aaa, 0x0005, 0x9182,
-+ 0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0xb366,
-+ 0xcb4d, 0xcb4d, 0xcb4d, 0xcb4d, 0xcb4f, 0xcb9c, 0xcb4d, 0xcb4d,
-+ 0xcb4d, 0xcb4d, 0xcb4d, 0xcb4d, 0xcb4d, 0x080c, 0x0dc5, 0x0096,
-+ 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034,
-+ 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035,
-+ 0x1118, 0x009e, 0x0804, 0xcbb0, 0x080c, 0xd0d1, 0x1118, 0x080c,
-+ 0xd2bc, 0x0068, 0x6014, 0x2048, 0xa87c, 0xd0e4, 0x1110, 0x080c,
-+ 0xd2bc, 0xa867, 0x0103, 0x080c, 0xd7bc, 0x080c, 0x6e98, 0x00d6,
-+ 0x2c68, 0x080c, 0xb276, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e,
-+ 0x600b, 0xffff, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f,
-+ 0x210c, 0x613e, 0x6910, 0x6112, 0x080c, 0xd54d, 0x6954, 0x6156,
-+ 0x6023, 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x2d60, 0x00de,
-+ 0x080c, 0xb2cc, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800,
-+ 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
-+ 0x0035, 0x0130, 0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538,
-+ 0x00d6, 0x2c68, 0x080c, 0xd752, 0x11f0, 0x080c, 0xb276, 0x01d8,
-+ 0x6106, 0x6003, 0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c,
-+ 0x612e, 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938,
-+ 0x613a, 0x693c, 0x613e, 0x6954, 0x6156, 0x080c, 0xd54d, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x2d60, 0x00de, 0x0804, 0xb2cc, 0x0096,
-+ 0x6014, 0x2048, 0x080c, 0xd0d1, 0x01c8, 0xa867, 0x0103, 0xa880,
-+ 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc,
-+ 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xd3cd,
-+ 0xa877, 0x0000, 0x080c, 0x6e98, 0x080c, 0xd2bc, 0x009e, 0x0804,
-+ 0xb2cc, 0x0016, 0x0096, 0x6014, 0x2048, 0x080c, 0xd0d1, 0x0140,
-+ 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x6e98,
-+ 0x009e, 0x001e, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130,
-+ 0x9186, 0x0027, 0x0118, 0x080c, 0xb366, 0x0030, 0x080c, 0x999e,
-+ 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005, 0x0056, 0x0066, 0x0096,
-+ 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010, 0x2009,
-+ 0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020, 0x2011,
-+ 0x0029, 0x080c, 0xcc7e, 0x96b2, 0x0020, 0xb004, 0x904d, 0x0110,
-+ 0x080c, 0x0fc0, 0x080c, 0x100e, 0x0520, 0x8528, 0xa867, 0x0110,
-+ 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228, 0x2608,
-+ 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c,
-+ 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205, 0x2003,
-+ 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000,
-+ 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
-+ 0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff,
-+ 0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c, 0x6e98,
-+ 0x2a48, 0x0cb8, 0x080c, 0x6e98, 0x00ae, 0x0005, 0x00f6, 0x2079,
-+ 0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108, 0x8108,
-+ 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0,
-+ 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318, 0x9386,
-+ 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814, 0x8000,
-+ 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe,
-+ 0x0005, 0x6920, 0x9186, 0x0003, 0x0118, 0x9186, 0x0002, 0x11d0,
-+ 0x00c6, 0x00d6, 0x00e6, 0x2d60, 0x0096, 0x6014, 0x2048, 0x080c,
-+ 0xd0d1, 0x0150, 0x2001, 0x0006, 0xa980, 0xc1d5, 0x080c, 0x7104,
-+ 0x080c, 0x6e8b, 0x080c, 0xd2bc, 0x009e, 0x080c, 0xb2ff, 0x00ee,
-+ 0x00de, 0x00ce, 0x0005, 0x00c6, 0x702c, 0xd084, 0x1170, 0x6008,
-+ 0x2060, 0x6020, 0x9086, 0x0002, 0x1140, 0x6104, 0x9186, 0x0085,
-+ 0x0118, 0x9186, 0x008b, 0x1108, 0x9006, 0x00ce, 0x0005, 0x0066,
-+ 0x0126, 0x2091, 0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f,
-+ 0x0083, 0x012e, 0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066,
-+ 0x2031, 0x0000, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e,
-+ 0x0005, 0xcd16, 0xcd16, 0xcd11, 0xcd38, 0xcd08, 0xcd11, 0xcd38,
-+ 0xcd11, 0xcd11, 0x925e, 0xcd11, 0xcd11, 0xcd11, 0xcd08, 0xcd08,
-+ 0x080c, 0x0dc5, 0x0036, 0x2019, 0x0010, 0x080c, 0xe73f, 0x003e,
-+ 0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff,
-+ 0x11d8, 0x6014, 0x2048, 0x080c, 0xd0d1, 0x01c0, 0xa864, 0x9086,
-+ 0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e,
-+ 0x2001, 0x0005, 0x080c, 0x7104, 0x080c, 0xd3cd, 0x080c, 0x6e8b,
-+ 0x080c, 0xb2ff, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0,
-+ 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0002, 0xcd4e, 0xcd7e,
-+ 0xcd50, 0xcd9f, 0xcd79, 0xcd4e, 0xcd11, 0xcd16, 0xcd16, 0xcd11,
-+ 0xcd11, 0xcd11, 0xcd11, 0xcd11, 0xcd11, 0xcd11, 0x080c, 0x0dc5,
-+ 0x86ff, 0x1520, 0x6020, 0x9086, 0x0006, 0x0500, 0x0096, 0x6014,
-+ 0x2048, 0x080c, 0xd0d1, 0x0168, 0xa87c, 0xd0cc, 0x0140, 0x0096,
-+ 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fc0, 0x009e, 0x080c,
-+ 0xd3cd, 0x009e, 0x080c, 0xd796, 0x6007, 0x0085, 0x6003, 0x000b,
-+ 0x6023, 0x0002, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x9085, 0x0001,
-+ 0x0005, 0x0066, 0x080c, 0x1a8e, 0x006e, 0x0890, 0x00e6, 0x2071,
-+ 0x19e8, 0x7024, 0x9c06, 0x1120, 0x080c, 0xa9cc, 0x00ee, 0x0840,
-+ 0x6020, 0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096,
-+ 0x2049, 0x0001, 0x2c40, 0x080c, 0xaaf4, 0x009e, 0x008e, 0x0010,
-+ 0x080c, 0xa8c9, 0x00ee, 0x1904, 0xcd50, 0x0804, 0xcd11, 0x0036,
-+ 0x00e6, 0x2071, 0x19e8, 0x703c, 0x9c06, 0x1138, 0x901e, 0x080c,
-+ 0xaa42, 0x00ee, 0x003e, 0x0804, 0xcd50, 0x080c, 0xac24, 0x00ee,
-+ 0x003e, 0x1904, 0xcd50, 0x0804, 0xcd11, 0x00c6, 0x6020, 0x9084,
-+ 0x000f, 0x0013, 0x00ce, 0x0005, 0xcdd2, 0xce9c, 0xd00a, 0xcddc,
-+ 0xb2ff, 0xcdd2, 0xe735, 0xd7fe, 0xce9c, 0x9230, 0xd096, 0xcdcb,
-+ 0xcdcb, 0xcdcb, 0xcdcb, 0x080c, 0x0dc5, 0x080c, 0xd2d9, 0x1110,
-+ 0x080c, 0xbcaf, 0x0005, 0x080c, 0x999e, 0x080c, 0x9aaa, 0x0804,
-+ 0xb2cc, 0x601b, 0x0001, 0x0005, 0x080c, 0xd0d1, 0x0130, 0x6014,
-+ 0x0096, 0x2048, 0x2c00, 0xa896, 0x009e, 0x6000, 0x908a, 0x0010,
-+ 0x1a0c, 0x0dc5, 0x0002, 0xcdfb, 0xcdfd, 0xce21, 0xce35, 0xce5b,
-+ 0xcdfb, 0xcdd2, 0xcdd2, 0xcdd2, 0xce35, 0xce35, 0xcdfb, 0xcdfb,
-+ 0xcdfb, 0xcdfb, 0xce3f, 0x080c, 0x0dc5, 0x00e6, 0x6014, 0x0096,
-+ 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19e8, 0x7024,
-+ 0x9c06, 0x01a0, 0x080c, 0xa8c9, 0x080c, 0xd796, 0x6007, 0x0085,
-+ 0x6003, 0x000b, 0x6023, 0x0002, 0x2001, 0x1987, 0x2004, 0x601a,
-+ 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00ee, 0x0005, 0x601b, 0x0001,
-+ 0x0cd8, 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e,
-+ 0x080c, 0xd796, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-+ 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0005, 0x0096, 0x601b, 0x0001,
-+ 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c,
-+ 0x57db, 0x01b8, 0x6014, 0x0096, 0x904d, 0x0190, 0xa864, 0xa867,
-+ 0x0103, 0xa87b, 0x0006, 0x9086, 0x0139, 0x1150, 0xa867, 0x0139,
-+ 0xa87b, 0x0030, 0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x6e98,
-+ 0x009e, 0x0804, 0xb2cc, 0x6014, 0x0096, 0x904d, 0x05c0, 0xa97c,
-+ 0xd1e4, 0x05a8, 0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e,
-+ 0x0005, 0xa884, 0x009e, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a,
-+ 0x2001, 0x0030, 0x2c08, 0x080c, 0x1611, 0x2001, 0x030c, 0x2004,
-+ 0x9086, 0x0041, 0x1198, 0x6014, 0x0096, 0x904d, 0x090c, 0x0dc5,
-+ 0xa880, 0xd0f4, 0x1130, 0xc0f5, 0xa882, 0x009e, 0x601b, 0x0002,
-+ 0x0068, 0x009e, 0x00c6, 0x080c, 0x236e, 0x00ce, 0x6000, 0x9086,
-+ 0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0xb34b, 0x0005, 0x009e,
-+ 0x080c, 0x1a8e, 0x0804, 0xce21, 0x6000, 0x908a, 0x0010, 0x1a0c,
-+ 0x0dc5, 0x000b, 0x0005, 0xceb3, 0xcdd9, 0xceb5, 0xceb3, 0xceb5,
-+ 0xceb5, 0xcdd3, 0xceb3, 0xcdcd, 0xcdcd, 0xceb3, 0xceb3, 0xceb3,
-+ 0xceb3, 0xceb3, 0xceb3, 0x080c, 0x0dc5, 0x6010, 0x00b6, 0x2058,
-+ 0xb804, 0x9084, 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0dc5,
-+ 0x00b6, 0x0013, 0x00be, 0x0005, 0xced0, 0xcfa1, 0xced2, 0xcf12,
-+ 0xced2, 0xcf12, 0xced2, 0xcee0, 0xced0, 0xcf12, 0xced0, 0xcf01,
-+ 0x080c, 0x0dc5, 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004,
-+ 0x05a8, 0x908e, 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xcf9d,
-+ 0x6004, 0x080c, 0xd2d9, 0x0904, 0xcfba, 0x908e, 0x0004, 0x1110,
-+ 0x080c, 0x3279, 0x908e, 0x0021, 0x0904, 0xcfbe, 0x908e, 0x0022,
-+ 0x0904, 0xd005, 0x908e, 0x003d, 0x0904, 0xcfbe, 0x908e, 0x0039,
-+ 0x0904, 0xcfc2, 0x908e, 0x0035, 0x0904, 0xcfc2, 0x908e, 0x001e,
-+ 0x0178, 0x908e, 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084,
-+ 0x00ff, 0x9086, 0x0006, 0x0110, 0x080c, 0x3250, 0x080c, 0xbcaf,
-+ 0x0804, 0xb2ff, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904,
-+ 0xcf8e, 0x9186, 0x0002, 0x1904, 0xcf63, 0x2001, 0x1837, 0x2004,
-+ 0xd08c, 0x11c8, 0x080c, 0x7630, 0x11b0, 0x080c, 0xd7dc, 0x0138,
-+ 0x080c, 0x7653, 0x1120, 0x080c, 0x753a, 0x0804, 0xcfee, 0x2001,
-+ 0x197d, 0x2003, 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c,
-+ 0x755c, 0x0804, 0xcfee, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x0080,
-+ 0x0130, 0x2001, 0x1837, 0x2004, 0xd0ac, 0x1904, 0xcfee, 0xb8a0,
-+ 0x9082, 0x0081, 0x1a04, 0xcfee, 0xb840, 0x9084, 0x00ff, 0x9005,
-+ 0x0190, 0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b,
-+ 0x0398, 0x6043, 0x0000, 0x080c, 0xb276, 0x0128, 0x2b00, 0x6012,
-+ 0x6023, 0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002,
-+ 0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009,
-+ 0x1837, 0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c,
-+ 0x60ba, 0x00ee, 0x080c, 0xbcaf, 0x0030, 0x080c, 0xbcaf, 0x080c,
-+ 0x3250, 0x080c, 0xd7f1, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x3279, 0x012e, 0x00ee, 0x080c, 0xb2ff, 0x0005, 0x2001, 0x0002,
-+ 0x080c, 0x6663, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9540,
-+ 0x080c, 0x9aaa, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x3279, 0x0804,
-+ 0xcf0e, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010,
-+ 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xcf63, 0x8001,
-+ 0xb842, 0x6003, 0x0001, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x00de,
-+ 0x00ce, 0x0898, 0x080c, 0xbcaf, 0x0804, 0xcf10, 0x080c, 0xbceb,
-+ 0x0804, 0xcf10, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xd752, 0x00de,
-+ 0x0118, 0x080c, 0xb2cc, 0x0408, 0x6004, 0x8007, 0x6134, 0x918c,
-+ 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-+ 0x0002, 0x603c, 0x600a, 0x2001, 0x1987, 0x2004, 0x601a, 0x602c,
-+ 0x2c08, 0x2060, 0x6024, 0xd0b4, 0x0108, 0xc085, 0xc0b5, 0x6026,
-+ 0x2160, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0005, 0x00de, 0x00ce,
-+ 0x080c, 0xbcaf, 0x080c, 0x3250, 0x00e6, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x3279, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398,
-+ 0x6043, 0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xb701, 0x1904,
-+ 0xcfba, 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0096,
-+ 0x00d6, 0x001b, 0x00de, 0x009e, 0x0005, 0xd025, 0xd025, 0xd025,
-+ 0xd025, 0xd025, 0xd025, 0xd025, 0xd025, 0xd025, 0xcdd2, 0xd025,
-+ 0xcdd9, 0xd027, 0xcdd9, 0xd041, 0xd025, 0x080c, 0x0dc5, 0x6004,
-+ 0x9086, 0x008b, 0x01b0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
-+ 0x0035, 0x1130, 0x602c, 0x9080, 0x0009, 0x200c, 0xc185, 0x2102,
-+ 0x6007, 0x008b, 0x6003, 0x000d, 0x080c, 0x94f8, 0x080c, 0x9aaa,
-+ 0x0005, 0x080c, 0xd7d0, 0x0118, 0x080c, 0xd7e3, 0x0010, 0x080c,
-+ 0xd7f1, 0x080c, 0xd2bc, 0x080c, 0xd0d1, 0x0570, 0x080c, 0x3250,
-+ 0x080c, 0xd0d1, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b,
-+ 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x6e98,
-+ 0x2c68, 0x080c, 0xb276, 0x0150, 0x6810, 0x6012, 0x080c, 0xd54d,
-+ 0x00c6, 0x2d60, 0x080c, 0xb2ff, 0x00ce, 0x0008, 0x2d60, 0x6017,
-+ 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
-+ 0x9540, 0x080c, 0x9aaa, 0x00c8, 0x080c, 0xd7d0, 0x0138, 0x6034,
-+ 0x9086, 0x4000, 0x1118, 0x080c, 0x3250, 0x08d0, 0x6034, 0x908c,
- 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
-- 0x009e, 0x0804, 0xcbb7, 0x080c, 0xd0d8, 0x1118, 0x080c, 0xd2c3,
-- 0x0068, 0x6014, 0x2048, 0xa87c, 0xd0e4, 0x1110, 0x080c, 0xd2c3,
-- 0xa867, 0x0103, 0x080c, 0xd7c3, 0x080c, 0x6e9f, 0x00d6, 0x2c68,
-- 0x080c, 0xb27d, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e, 0x600b,
-- 0xffff, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c,
-- 0x613e, 0x6910, 0x6112, 0x080c, 0xd554, 0x6954, 0x6156, 0x6023,
-- 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x2d60, 0x00de, 0x080c,
-- 0xb2d3, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-- 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035,
-- 0x0130, 0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538, 0x00d6,
-- 0x2c68, 0x080c, 0xd759, 0x11f0, 0x080c, 0xb27d, 0x01d8, 0x6106,
-- 0x6003, 0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c, 0x612e,
-- 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938, 0x613a,
-- 0x693c, 0x613e, 0x6954, 0x6156, 0x080c, 0xd554, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x2d60, 0x00de, 0x0804, 0xb2d3, 0x0096, 0x6014,
-- 0x2048, 0x080c, 0xd0d8, 0x01c8, 0xa867, 0x0103, 0xa880, 0xd0b4,
-- 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc, 0x0118,
-- 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xd3d4, 0xa877,
-- 0x0000, 0x080c, 0x6e9f, 0x080c, 0xd2c3, 0x009e, 0x0804, 0xb2d3,
-- 0x0016, 0x0096, 0x6014, 0x2048, 0x080c, 0xd0d8, 0x0140, 0xa867,
-- 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x6e9f, 0x009e,
-- 0x001e, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130, 0x9186,
-- 0x0027, 0x0118, 0x080c, 0xb36d, 0x0030, 0x080c, 0x99a5, 0x080c,
-- 0xb306, 0x080c, 0x9ab1, 0x0005, 0x0056, 0x0066, 0x0096, 0x00a6,
-- 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010, 0x2009, 0x0100,
-- 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020, 0x2011, 0x0029,
-- 0x080c, 0xcc85, 0x96b2, 0x0020, 0xb004, 0x904d, 0x0110, 0x080c,
-- 0x0fc0, 0x080c, 0x100e, 0x0520, 0x8528, 0xa867, 0x0110, 0xa86b,
-- 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228, 0x2608, 0x2011,
-- 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950,
-- 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205, 0x2003, 0x0000,
-- 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000, 0x0048,
-- 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003,
-- 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff, 0x0158,
-- 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c, 0x6e9f, 0x2a48,
-- 0x0cb8, 0x080c, 0x6e9f, 0x00ae, 0x0005, 0x00f6, 0x2079, 0x0200,
-- 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108, 0x8108, 0x810c,
-- 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0, 0x20e1,
-- 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318, 0x9386, 0x0020,
-- 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814, 0x8000, 0x9085,
-- 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe, 0x0005,
-- 0x6920, 0x9186, 0x0003, 0x0118, 0x9186, 0x0002, 0x11d0, 0x00c6,
-- 0x00d6, 0x00e6, 0x2d60, 0x0096, 0x6014, 0x2048, 0x080c, 0xd0d8,
-- 0x0150, 0x2001, 0x0006, 0xa980, 0xc1d5, 0x080c, 0x710b, 0x080c,
-- 0x6e92, 0x080c, 0xd2c3, 0x009e, 0x080c, 0xb306, 0x00ee, 0x00de,
-- 0x00ce, 0x0005, 0x00c6, 0x702c, 0xd084, 0x1170, 0x6008, 0x2060,
-- 0x6020, 0x9086, 0x0002, 0x1140, 0x6104, 0x9186, 0x0085, 0x0118,
-- 0x9186, 0x008b, 0x1108, 0x9006, 0x00ce, 0x0005, 0x0066, 0x0126,
-- 0x2091, 0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083,
-- 0x012e, 0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031,
-- 0x0000, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005,
-- 0xcd1d, 0xcd1d, 0xcd18, 0xcd3f, 0xcd0f, 0xcd18, 0xcd3f, 0xcd18,
-- 0xcd18, 0x9265, 0xcd18, 0xcd18, 0xcd18, 0xcd0f, 0xcd0f, 0x080c,
-- 0x0dc5, 0x0036, 0x2019, 0x0010, 0x080c, 0xe746, 0x003e, 0x0005,
-- 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff, 0x11d8,
-- 0x6014, 0x2048, 0x080c, 0xd0d8, 0x01c0, 0xa864, 0x9086, 0x0139,
-- 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e, 0x2001,
-- 0x0005, 0x080c, 0x710b, 0x080c, 0xd3d4, 0x080c, 0x6e92, 0x080c,
-- 0xb306, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0, 0x6000,
-- 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0002, 0xcd55, 0xcd85, 0xcd57,
-- 0xcda6, 0xcd80, 0xcd55, 0xcd18, 0xcd1d, 0xcd1d, 0xcd18, 0xcd18,
-- 0xcd18, 0xcd18, 0xcd18, 0xcd18, 0xcd18, 0x080c, 0x0dc5, 0x86ff,
-- 0x1520, 0x6020, 0x9086, 0x0006, 0x0500, 0x0096, 0x6014, 0x2048,
-- 0x080c, 0xd0d8, 0x0168, 0xa87c, 0xd0cc, 0x0140, 0x0096, 0xc0cc,
-- 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fc0, 0x009e, 0x080c, 0xd3d4,
-- 0x009e, 0x080c, 0xd79d, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-- 0x0002, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x9085, 0x0001, 0x0005,
-- 0x0066, 0x080c, 0x1a8e, 0x006e, 0x0890, 0x00e6, 0x2071, 0x19e8,
-- 0x7024, 0x9c06, 0x1120, 0x080c, 0xa9d3, 0x00ee, 0x0840, 0x6020,
-- 0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049,
-- 0x0001, 0x2c40, 0x080c, 0xaafb, 0x009e, 0x008e, 0x0010, 0x080c,
-- 0xa8d0, 0x00ee, 0x1904, 0xcd57, 0x0804, 0xcd18, 0x0036, 0x00e6,
-- 0x2071, 0x19e8, 0x703c, 0x9c06, 0x1138, 0x901e, 0x080c, 0xaa49,
-- 0x00ee, 0x003e, 0x0804, 0xcd57, 0x080c, 0xac2b, 0x00ee, 0x003e,
-- 0x1904, 0xcd57, 0x0804, 0xcd18, 0x00c6, 0x6020, 0x9084, 0x000f,
-- 0x0013, 0x00ce, 0x0005, 0xcdd9, 0xcea3, 0xd011, 0xcde3, 0xb306,
-- 0xcdd9, 0xe73c, 0xd805, 0xcea3, 0x9237, 0xd09d, 0xcdd2, 0xcdd2,
-- 0xcdd2, 0xcdd2, 0x080c, 0x0dc5, 0x080c, 0xd2e0, 0x1110, 0x080c,
-- 0xbcb6, 0x0005, 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x0804, 0xb2d3,
-- 0x601b, 0x0001, 0x0005, 0x080c, 0xd0d8, 0x0130, 0x6014, 0x0096,
-- 0x2048, 0x2c00, 0xa896, 0x009e, 0x6000, 0x908a, 0x0010, 0x1a0c,
-- 0x0dc5, 0x0002, 0xce02, 0xce04, 0xce28, 0xce3c, 0xce62, 0xce02,
-- 0xcdd9, 0xcdd9, 0xcdd9, 0xce3c, 0xce3c, 0xce02, 0xce02, 0xce02,
-- 0xce02, 0xce46, 0x080c, 0x0dc5, 0x00e6, 0x6014, 0x0096, 0x2048,
-- 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19e8, 0x7024, 0x9c06,
-- 0x01a0, 0x080c, 0xa8d0, 0x080c, 0xd79d, 0x6007, 0x0085, 0x6003,
-- 0x000b, 0x6023, 0x0002, 0x2001, 0x1987, 0x2004, 0x601a, 0x080c,
-- 0x94ff, 0x080c, 0x9ab1, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8,
-- 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c,
-- 0xd79d, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c,
-- 0x94ff, 0x080c, 0x9ab1, 0x0005, 0x0096, 0x601b, 0x0001, 0x6014,
-- 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c, 0x57dd,
-- 0x01b8, 0x6014, 0x0096, 0x904d, 0x0190, 0xa864, 0xa867, 0x0103,
-- 0xa87b, 0x0006, 0x9086, 0x0139, 0x1150, 0xa867, 0x0139, 0xa87b,
-- 0x0030, 0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x6e9f, 0x009e,
-- 0x0804, 0xb2d3, 0x6014, 0x0096, 0x904d, 0x05c0, 0xa97c, 0xd1e4,
-- 0x05a8, 0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005,
-- 0xa884, 0x009e, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0x2001,
-- 0x0030, 0x2c08, 0x080c, 0x1611, 0x2001, 0x030c, 0x2004, 0x9086,
-- 0x0041, 0x1198, 0x6014, 0x0096, 0x904d, 0x090c, 0x0dc5, 0xa880,
-- 0xd0f4, 0x1130, 0xc0f5, 0xa882, 0x009e, 0x601b, 0x0002, 0x0068,
-- 0x009e, 0x00c6, 0x080c, 0x236e, 0x00ce, 0x6000, 0x9086, 0x0004,
-- 0x1120, 0x2009, 0x0048, 0x080c, 0xb352, 0x0005, 0x009e, 0x080c,
-- 0x1a8e, 0x0804, 0xce28, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5,
-- 0x000b, 0x0005, 0xceba, 0xcde0, 0xcebc, 0xceba, 0xcebc, 0xcebc,
-- 0xcdda, 0xceba, 0xcdd4, 0xcdd4, 0xceba, 0xceba, 0xceba, 0xceba,
-- 0xceba, 0xceba, 0x080c, 0x0dc5, 0x6010, 0x00b6, 0x2058, 0xb804,
-- 0x9084, 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0dc5, 0x00b6,
-- 0x0013, 0x00be, 0x0005, 0xced7, 0xcfa8, 0xced9, 0xcf19, 0xced9,
-- 0xcf19, 0xced9, 0xcee7, 0xced7, 0xcf19, 0xced7, 0xcf08, 0x080c,
-- 0x0dc5, 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8,
-- 0x908e, 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xcfa4, 0x6004,
-- 0x080c, 0xd2e0, 0x0904, 0xcfc1, 0x908e, 0x0004, 0x1110, 0x080c,
-- 0x3279, 0x908e, 0x0021, 0x0904, 0xcfc5, 0x908e, 0x0022, 0x0904,
-- 0xd00c, 0x908e, 0x003d, 0x0904, 0xcfc5, 0x908e, 0x0039, 0x0904,
-- 0xcfc9, 0x908e, 0x0035, 0x0904, 0xcfc9, 0x908e, 0x001e, 0x0178,
-- 0x908e, 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084, 0x00ff,
-- 0x9086, 0x0006, 0x0110, 0x080c, 0x3250, 0x080c, 0xbcb6, 0x0804,
-- 0xb306, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904, 0xcf95,
-- 0x9186, 0x0002, 0x1904, 0xcf6a, 0x2001, 0x1837, 0x2004, 0xd08c,
-- 0x11c8, 0x080c, 0x7637, 0x11b0, 0x080c, 0xd7e3, 0x0138, 0x080c,
-- 0x765a, 0x1120, 0x080c, 0x7541, 0x0804, 0xcff5, 0x2001, 0x197d,
-- 0x2003, 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c, 0x7563,
-- 0x0804, 0xcff5, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x0080, 0x0130,
-- 0x2001, 0x1837, 0x2004, 0xd0ac, 0x1904, 0xcff5, 0xb8a0, 0x9082,
-- 0x0081, 0x1a04, 0xcff5, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0190,
-- 0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398,
-- 0x6043, 0x0000, 0x080c, 0xb27d, 0x0128, 0x2b00, 0x6012, 0x6023,
-- 0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0,
-- 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009, 0x1837,
-- 0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c, 0x60c1,
-- 0x00ee, 0x080c, 0xbcb6, 0x0030, 0x080c, 0xbcb6, 0x080c, 0x3250,
-- 0x080c, 0xd7f8, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x3279,
-- 0x012e, 0x00ee, 0x080c, 0xb306, 0x0005, 0x2001, 0x0002, 0x080c,
-- 0x666a, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9547, 0x080c,
-- 0x9ab1, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x3279, 0x0804, 0xcf15,
-- 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010, 0x2058,
-- 0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xcf6a, 0x8001, 0xb842,
-- 0x6003, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x00de, 0x00ce,
-- 0x0898, 0x080c, 0xbcb6, 0x0804, 0xcf17, 0x080c, 0xbcf2, 0x0804,
-- 0xcf17, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xd759, 0x00de, 0x0118,
-- 0x080c, 0xb2d3, 0x0408, 0x6004, 0x8007, 0x6134, 0x918c, 0x00ff,
-- 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-- 0x603c, 0x600a, 0x2001, 0x1987, 0x2004, 0x601a, 0x602c, 0x2c08,
-- 0x2060, 0x6024, 0xd0b4, 0x0108, 0xc085, 0xc0b5, 0x6026, 0x2160,
-- 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0005, 0x00de, 0x00ce, 0x080c,
-- 0xbcb6, 0x080c, 0x3250, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x3279, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x6043,
-- 0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xb708, 0x1904, 0xcfc1,
-- 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x0096, 0x00d6,
-- 0x001b, 0x00de, 0x009e, 0x0005, 0xd02c, 0xd02c, 0xd02c, 0xd02c,
-- 0xd02c, 0xd02c, 0xd02c, 0xd02c, 0xd02c, 0xcdd9, 0xd02c, 0xcde0,
-- 0xd02e, 0xcde0, 0xd048, 0xd02c, 0x080c, 0x0dc5, 0x6004, 0x9086,
-- 0x008b, 0x01b0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035,
-- 0x1130, 0x602c, 0x9080, 0x0009, 0x200c, 0xc185, 0x2102, 0x6007,
-- 0x008b, 0x6003, 0x000d, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0005,
-- 0x080c, 0xd7d7, 0x0118, 0x080c, 0xd7ea, 0x0010, 0x080c, 0xd7f8,
-- 0x080c, 0xd2c3, 0x080c, 0xd0d8, 0x0570, 0x080c, 0x3250, 0x080c,
-- 0xd0d8, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b, 0x0006,
-- 0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x6e9f, 0x2c68,
-- 0x080c, 0xb27d, 0x0150, 0x6810, 0x6012, 0x080c, 0xd554, 0x00c6,
-- 0x2d60, 0x080c, 0xb306, 0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000,
-- 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9547,
-- 0x080c, 0x9ab1, 0x00c8, 0x080c, 0xd7d7, 0x0138, 0x6034, 0x9086,
-- 0x4000, 0x1118, 0x080c, 0x3250, 0x08d0, 0x6034, 0x908c, 0xff00,
-- 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x080c,
-- 0x3250, 0x0868, 0x080c, 0xb306, 0x0005, 0x6000, 0x908a, 0x0010,
-- 0x1a0c, 0x0dc5, 0x0002, 0xd0b3, 0xd0b3, 0xd0b7, 0xd0b5, 0xd0c1,
-- 0xd0b3, 0xd0b3, 0xb306, 0xd0b3, 0xd0b3, 0xd0b3, 0xd0b3, 0xd0b3,
-- 0xd0b3, 0xd0b3, 0xd0b3, 0x080c, 0x0dc5, 0x080c, 0xac2b, 0x6114,
-- 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x6e9f, 0x009e, 0x0804,
-- 0xb2d3, 0x601c, 0xd084, 0x190c, 0x1a8e, 0x0c88, 0x9284, 0x0007,
-- 0x1158, 0x9282, 0x1cd0, 0x0240, 0x2001, 0x181a, 0x2004, 0x9202,
-- 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028,
-- 0x0096, 0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000,
-- 0x9086, 0xf000, 0x0110, 0x080c, 0x10b9, 0x000e, 0x009e, 0x0005,
-- 0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061,
-- 0x1cd0, 0x2071, 0x1800, 0x7354, 0x7074, 0x9302, 0x1640, 0x6020,
-- 0x9206, 0x11f8, 0x080c, 0xd7e3, 0x0180, 0x9286, 0x0001, 0x1168,
-- 0x6004, 0x9086, 0x0004, 0x1148, 0x080c, 0x3250, 0x080c, 0xd7f8,
-- 0x00c6, 0x080c, 0xb306, 0x00ce, 0x0060, 0x080c, 0xd4ce, 0x0148,
-- 0x080c, 0xd2e0, 0x1110, 0x080c, 0xbcb6, 0x00c6, 0x080c, 0xb2d3,
-- 0x00ce, 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1208, 0x08a0, 0x012e,
-- 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016,
-- 0x9188, 0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1ab7, 0x6112,
-- 0x080c, 0x3250, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce,
-- 0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb27d,
-- 0x01b0, 0x6656, 0x2b00, 0x6012, 0x080c, 0x57dd, 0x0118, 0x080c,
-- 0xd207, 0x0168, 0x080c, 0xd554, 0x6023, 0x0003, 0x2009, 0x004b,
-- 0x080c, 0xb352, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-- 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0xb325,
-- 0x0560, 0x6057, 0x0000, 0x2b00, 0x6012, 0x080c, 0xd554, 0x6023,
-- 0x0003, 0x0016, 0x080c, 0x96a4, 0x0076, 0x903e, 0x080c, 0x9577,
-- 0x2c08, 0x080c, 0xe91c, 0x007e, 0x001e, 0xd184, 0x0128, 0x080c,
-- 0xb2d3, 0x9085, 0x0001, 0x0070, 0x080c, 0x57dd, 0x0128, 0xd18c,
-- 0x1170, 0x080c, 0xd207, 0x0148, 0x2009, 0x004c, 0x080c, 0xb352,
-- 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900,
-- 0x6016, 0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6,
-- 0x00c6, 0x0046, 0x0016, 0x080c, 0xb27d, 0x2c78, 0x05a0, 0x7e56,
-- 0x2b00, 0x7812, 0x7823, 0x0003, 0x0016, 0x2021, 0x0005, 0x080c,
-- 0xd219, 0x001e, 0x9186, 0x004d, 0x0118, 0x9186, 0x004e, 0x0148,
-- 0x2001, 0x1980, 0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c, 0xb2d3,
-- 0x00d0, 0x2001, 0x197f, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c,
-- 0xb2d3, 0x0088, 0x2f60, 0x080c, 0x57dd, 0x0138, 0xd18c, 0x1118,
-- 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816, 0x001e, 0x0016, 0x080c,
-- 0xb352, 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe, 0x0005,
-- 0x00f6, 0x00c6, 0x0046, 0x080c, 0xb27d, 0x2c78, 0x0508, 0x7e56,
-- 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096, 0x2021, 0x0004, 0x0489,
-- 0x009e, 0x2001, 0x197e, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c,
-- 0xb2d3, 0x0060, 0x2f60, 0x080c, 0x57dd, 0x0120, 0xd18c, 0x1160,
-- 0x0071, 0x0130, 0x2009, 0x0052, 0x080c, 0xb352, 0x9085, 0x0001,
-- 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98, 0x00c6,
-- 0x080c, 0x4be4, 0x00ce, 0x1120, 0x080c, 0xb2d3, 0x9006, 0x0005,
-- 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016, 0x9085, 0x0001,
-- 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000, 0x080c, 0x6858,
-- 0x0158, 0x2001, 0xd21e, 0x0006, 0x900e, 0x2400, 0x080c, 0x710b,
-- 0x080c, 0x6e9f, 0x000e, 0x0807, 0x2418, 0x080c, 0x993f, 0xbaa0,
-- 0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c, 0x96bc,
-- 0x008e, 0x080c, 0x9577, 0x2f08, 0x2648, 0x080c, 0xe91c, 0xb93c,
-- 0x81ff, 0x090c, 0x978f, 0x080c, 0x9ab1, 0x012e, 0x007e, 0x009e,
-- 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb27d, 0x0190,
-- 0x660a, 0x2b08, 0x6112, 0x080c, 0xd554, 0x6023, 0x0001, 0x2900,
-- 0x6016, 0x2009, 0x001f, 0x080c, 0xb352, 0x9085, 0x0001, 0x012e,
-- 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0xb325, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c, 0xd554,
-- 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c, 0x1768,
-- 0x00fe, 0x2009, 0x0021, 0x080c, 0xb352, 0x9085, 0x0001, 0x012e,
-- 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6, 0x0126,
-- 0x0016, 0x2091, 0x8000, 0x080c, 0xb27d, 0x0198, 0x660a, 0x2b08,
-- 0x6112, 0x080c, 0xd554, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e,
-- 0x0016, 0x080c, 0xb352, 0x9085, 0x0001, 0x001e, 0x012e, 0x00ce,
-- 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0xb325, 0x0188, 0x2b08, 0x6112, 0x080c, 0xd554, 0x6023, 0x0001,
-- 0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0xb352, 0x9085, 0x0001,
-- 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044, 0x0830,
-- 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258, 0xba3c,
-- 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x002e, 0x0005, 0x0006,
-- 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003, 0x0128,
-- 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005,
-- 0x0006, 0x0086, 0x0096, 0x6020, 0x9086, 0x0004, 0x01a8, 0x6014,
-- 0x904d, 0x080c, 0xd0d8, 0x0180, 0xa864, 0x9086, 0x0139, 0x0170,
-- 0x6020, 0x90c6, 0x0003, 0x0140, 0x90c6, 0x0002, 0x0128, 0xa868,
-- 0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e, 0x008e,
-- 0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb325,
-- 0x0198, 0x2b08, 0x6112, 0x080c, 0xd554, 0x6023, 0x0001, 0x2900,
-- 0x6016, 0x080c, 0x3250, 0x2009, 0x0028, 0x080c, 0xb352, 0x9085,
-- 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015,
-- 0x11a8, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6,
-- 0x080c, 0xbf63, 0x00be, 0x080c, 0xc1df, 0x6003, 0x0001, 0x6007,
-- 0x0029, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0078, 0x6014, 0x0096,
-- 0x2048, 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c,
-- 0xd71a, 0x080c, 0xbcb6, 0x080c, 0xb2d3, 0x0005, 0x0096, 0x6014,
-- 0x904d, 0x090c, 0x0dc5, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-- 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x6e9f, 0x012e, 0x009e, 0x080c, 0xb2d3, 0x0c30, 0x0096,
-- 0x9186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x666a, 0x00e8,
-- 0x9186, 0x0015, 0x1510, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014,
-- 0x11e0, 0x6010, 0x00b6, 0x2058, 0x080c, 0x67bf, 0x00be, 0x080c,
-- 0xc2b5, 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005,
-- 0x0160, 0x2001, 0x0006, 0x080c, 0x666a, 0x6014, 0x2048, 0xa868,
-- 0xd0fc, 0x0170, 0x080c, 0xb6dc, 0x0048, 0x6014, 0x2048, 0xa868,
-- 0xd0fc, 0x0528, 0x080c, 0xbcb6, 0x080c, 0xb2d3, 0x009e, 0x0005,
-- 0x6014, 0x6310, 0x2358, 0x904d, 0x090c, 0x0dc5, 0xa87b, 0x0000,
-- 0xa883, 0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x6944, 0x1108,
-- 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0x6e9f, 0x012e, 0x080c, 0xb2d3, 0x08f8, 0x6014,
-- 0x904d, 0x090c, 0x0dc5, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-- 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x6e9f, 0x012e, 0x080c, 0xb2d3, 0x0840, 0xa878, 0x9086,
-- 0x0005, 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005,
-- 0x6043, 0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050,
-- 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0005, 0x00c6, 0x6010, 0x00b6,
-- 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0120, 0x6020, 0x9084, 0x000f,
-- 0x0013, 0x00ce, 0x0005, 0xcdd9, 0xd404, 0xd404, 0xd407, 0xec80,
-- 0xec9b, 0xec9e, 0xcdd9, 0xcdd9, 0xcdd9, 0xcdd9, 0xcdd9, 0xcdd9,
-- 0xcdd9, 0xcdd9, 0x080c, 0x0dc5, 0xa001, 0xa001, 0x0005, 0x0096,
-- 0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010,
-- 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-- 0x0550, 0x2001, 0x1834, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78,
-- 0x080c, 0xb27d, 0x0508, 0x7810, 0x6012, 0x080c, 0xd554, 0x7820,
-- 0x9086, 0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020,
-- 0x7808, 0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007,
-- 0x0035, 0x6003, 0x0001, 0x7954, 0x6156, 0x080c, 0x94ff, 0x080c,
-- 0x9ab1, 0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1988,
-- 0x2004, 0x6042, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0xa87c,
-- 0xd0e4, 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000,
-- 0xa88f, 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048,
-- 0x080c, 0x0fc0, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803,
-- 0x0002, 0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0,
-- 0x681c, 0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085,
-- 0x0c00, 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0,
-- 0x693c, 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc,
-- 0x683a, 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112,
-- 0x6954, 0x6156, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001,
-- 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x009e, 0x001e, 0x0005, 0x6024,
-- 0xd0d4, 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303,
-- 0x0230, 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a,
-- 0x633e, 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402,
-- 0xa836, 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024,
-- 0xc0d4, 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a,
-- 0xa840, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016,
-- 0x6004, 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e,
-- 0x0036, 0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158,
-- 0x908e, 0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b,
-- 0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016,
-- 0x0026, 0x0036, 0x00e6, 0x2001, 0x1982, 0x200c, 0x8000, 0x2014,
-- 0x2001, 0x0032, 0x080c, 0x9375, 0x2001, 0x1986, 0x82ff, 0x1110,
-- 0x2011, 0x0014, 0x2202, 0x2001, 0x1984, 0x200c, 0x8000, 0x2014,
-- 0x2071, 0x196c, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x9375,
-- 0x2001, 0x1987, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
-- 0x1988, 0x9288, 0x000a, 0x2102, 0x2001, 0x1a98, 0x2102, 0x2001,
-- 0x0032, 0x080c, 0x1611, 0x080c, 0x6a84, 0x00ee, 0x003e, 0x002e,
-- 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1986,
-- 0x2003, 0x0028, 0x2001, 0x1987, 0x2003, 0x0014, 0x2071, 0x196c,
-- 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001, 0x1988, 0x2009, 0x001e,
-- 0x2102, 0x2001, 0x1a98, 0x2102, 0x2001, 0x0032, 0x080c, 0x1611,
-- 0x00ee, 0x001e, 0x000e, 0x0005, 0x0096, 0x6058, 0x904d, 0x0110,
-- 0x080c, 0x1040, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xb27d, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023,
-- 0x0001, 0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0xb352, 0x9085,
-- 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6,
-- 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1520, 0x7090, 0x9086,
-- 0x0018, 0x0120, 0x7090, 0x9086, 0x0014, 0x11e0, 0x6014, 0x2048,
-- 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x9d4c, 0x01d8, 0x707c,
-- 0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206, 0x1140, 0x6210,
-- 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3299, 0x080c,
-- 0xb6dc, 0x0020, 0x080c, 0xbcb6, 0x080c, 0xb2d3, 0x00fe, 0x00ee,
-- 0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48, 0x0c80, 0x00c6,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0xb27d, 0x0188, 0x2b08, 0x6112,
-- 0x080c, 0xd554, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x004d,
-- 0x080c, 0xb352, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-- 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0xb27d,
-- 0x0180, 0x2b08, 0x6112, 0x080c, 0xd554, 0x6023, 0x0001, 0x2900,
-- 0x6016, 0x001e, 0x080c, 0xb352, 0x9085, 0x0001, 0x012e, 0x00ce,
-- 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036, 0x0046,
-- 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-- 0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814, 0x8003, 0x9106,
-- 0x1530, 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003, 0x0000, 0x6014,
-- 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094, 0x003f,
-- 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1,
-- 0x0016, 0x200c, 0x080c, 0xde2e, 0x001e, 0xa804, 0x9005, 0x0110,
-- 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010, 0x080c,
-- 0xbcb6, 0x080c, 0xb2d3, 0x00fe, 0x00ee, 0x009e, 0x006e, 0x005e,
-- 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6, 0x00f6,
-- 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090, 0x9086, 0x0004,
-- 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x9d4c, 0x01a8, 0x707c,
-- 0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206, 0x1110, 0x080c,
-- 0x3250, 0x080c, 0xb6dc, 0x0020, 0x080c, 0xbcb6, 0x080c, 0xb2d3,
-- 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78, 0x9206, 0x0d78,
-- 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
-- 0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048, 0x2c78,
-- 0x080c, 0x9d4c, 0x05f0, 0x707c, 0xaacc, 0x9206, 0x1180, 0x7080,
-- 0xaad0, 0x9206, 0x1160, 0x080c, 0x3250, 0x0016, 0xa998, 0xaab0,
-- 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5784, 0x001e, 0x0010, 0x080c,
-- 0x556f, 0x080c, 0xd0d8, 0x0508, 0xa87b, 0x0000, 0xa883, 0x0000,
-- 0xa897, 0x4000, 0x0080, 0x080c, 0xd0d8, 0x01b8, 0x6014, 0x2048,
-- 0x080c, 0x556f, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-- 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139,
-- 0x080c, 0x6e9f, 0x012e, 0x080c, 0xb2d3, 0x00fe, 0x00ee, 0x009e,
-- 0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016, 0x0026,
-- 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0150,
-- 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992, 0xaa8e,
-- 0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6, 0x0036,
-- 0x080c, 0xd0d8, 0x0904, 0xd716, 0x0096, 0x6314, 0x2348, 0xa87a,
-- 0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358, 0x2009,
-- 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x6944, 0x1108, 0xc185,
-- 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9, 0x0004,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0,
-- 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f8b, 0x20a9, 0x0004,
-- 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080, 0x000a, 0x2098,
-- 0x080c, 0x0f8b, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398, 0x0007,
-- 0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004, 0xaba2,
-- 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0xa868, 0xc0f4,
-- 0xa86a, 0x080c, 0x6e92, 0x6017, 0x0000, 0x009e, 0x003e, 0x00de,
-- 0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6,
-- 0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096, 0x0000,
-- 0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x2873, 0x2118,
-- 0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c,
-- 0x2011, 0x8018, 0x080c, 0x4c44, 0x00a8, 0x9096, 0x0001, 0x1148,
-- 0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa,
-- 0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6,
-- 0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e, 0x002e,
-- 0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110, 0x6a38,
-- 0x0008, 0x6a2c, 0x080c, 0xd0c6, 0x01f0, 0x2260, 0x6120, 0x9186,
-- 0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206, 0x0140,
-- 0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140, 0x0020,
-- 0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106, 0x001e,
-- 0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc,
-- 0x0198, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1170, 0xa9a8, 0x918c,
-- 0x000f, 0x918e, 0x0001, 0x1140, 0xa87c, 0xd0ac, 0x0128, 0xa834,
-- 0xa938, 0x9115, 0x190c, 0xc78b, 0x0005, 0x0036, 0x2019, 0x0001,
-- 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0, 0x080c, 0xd0d8, 0x01c8,
-- 0x080c, 0xd2c3, 0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096,
-- 0x2048, 0xa87c, 0x080c, 0xd2e0, 0x1118, 0x080c, 0xbcb6, 0x0040,
-- 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x6e9f,
-- 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006,
-- 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020,
-- 0xa87b, 0x0005, 0x080c, 0xd3d4, 0xa877, 0x0000, 0x0005, 0x2001,
-- 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004,
-- 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4,
-- 0x000e, 0x0005, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0,
-- 0x00be, 0x2021, 0x0007, 0x080c, 0x4dfb, 0x004e, 0x003e, 0x0005,
-- 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1986, 0x2004, 0x601a, 0x0005,
-- 0x2001, 0x1988, 0x2004, 0x6042, 0x0005, 0x080c, 0xb2d3, 0x0804,
-- 0x9ab1, 0x2001, 0x0109, 0x2004, 0xd084, 0x01e0, 0x0126, 0x2091,
-- 0x2800, 0x0006, 0x0016, 0x0026, 0x0036, 0x00f6, 0x00e6, 0x00c6,
-- 0x2079, 0x19e8, 0x2071, 0x1800, 0x2061, 0x0100, 0x080c, 0x93e2,
-- 0x00ce, 0x00ee, 0x00fe, 0x003e, 0x002e, 0x001e, 0x000e, 0x012e,
-- 0x9085, 0x0001, 0x0005, 0x00b6, 0x0066, 0x6000, 0x90b2, 0x0010,
-- 0x1a0c, 0x0dc5, 0x001b, 0x006e, 0x00be, 0x0005, 0xd846, 0xdf8d,
-- 0xe102, 0xd846, 0xd846, 0xd846, 0xd846, 0xd846, 0xd87d, 0xe186,
-- 0xd846, 0xd846, 0xd846, 0xd846, 0xd846, 0xd846, 0x080c, 0x0dc5,
-- 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013, 0x006e,
-- 0x0005, 0xd861, 0xe6d5, 0xd861, 0xd861, 0xd861, 0xd861, 0xd861,
-- 0xd861, 0xe682, 0xe729, 0xd861, 0xedb4, 0xedea, 0xedb4, 0xedea,
-- 0xd861, 0x080c, 0x0dc5, 0x6000, 0x9082, 0x0010, 0x1a0c, 0x0dc5,
-- 0x6000, 0x000a, 0x0005, 0xd87b, 0xe364, 0xe433, 0xe456, 0xe516,
-- 0xd87b, 0xe5f5, 0xe59e, 0xe192, 0xe658, 0xe66d, 0xd87b, 0xd87b,
-- 0xd87b, 0xd87b, 0xd87b, 0x080c, 0x0dc5, 0x91b2, 0x0053, 0x1a0c,
-- 0x0dc5, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xdcfd, 0x0002, 0xd8c7,
-- 0xdacb, 0xd8c7, 0xd8c7, 0xd8c7, 0xdad4, 0xd8c7, 0xd8c7, 0xd8c7,
-- 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7,
-- 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c9, 0xd92c,
-- 0xd93b, 0xd99f, 0xd9ca, 0xda43, 0xdab6, 0xd8c7, 0xd8c7, 0xdad7,
-- 0xd8c7, 0xd8c7, 0xdaec, 0xdaf9, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7,
-- 0xd8c7, 0xdb9f, 0xd8c7, 0xd8c7, 0xdbb3, 0xd8c7, 0xd8c7, 0xdb6e,
-- 0xd8c7, 0xd8c7, 0xd8c7, 0xdbcb, 0xd8c7, 0xd8c7, 0xd8c7, 0xdc48,
-- 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xd8c7, 0xdcc5, 0x080c,
-- 0x0dc5, 0x080c, 0x6a61, 0x1150, 0x2001, 0x1837, 0x2004, 0xd0cc,
-- 0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007, 0x0009,
-- 0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xdac4, 0x080c, 0x69fd,
-- 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0,
-- 0x0026, 0x2019, 0x0029, 0x080c, 0x96a4, 0x0076, 0x903e, 0x080c,
-- 0x9577, 0x2c08, 0x080c, 0xe91c, 0x007e, 0x001e, 0x001e, 0x002e,
-- 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658, 0x080c, 0x6733, 0xbe04,
-- 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268, 0x0016, 0x0026, 0x6210,
-- 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xf015, 0x002e,
-- 0x001e, 0x1178, 0x080c, 0xe84e, 0x1904, 0xd997, 0x080c, 0xe7ea,
-- 0x1120, 0x6007, 0x0008, 0x0804, 0xdac4, 0x6007, 0x0009, 0x0804,
-- 0xdac4, 0x080c, 0xeab9, 0x0128, 0x080c, 0xe84e, 0x0d78, 0x0804,
-- 0xd997, 0x6017, 0x1900, 0x0c88, 0x080c, 0x3374, 0x1904, 0xdcfa,
-- 0x6106, 0x080c, 0xe78e, 0x6007, 0x0006, 0x0804, 0xdac4, 0x6007,
-- 0x0007, 0x0804, 0xdac4, 0x080c, 0xee26, 0x1904, 0xdcfa, 0x080c,
-- 0x3374, 0x1904, 0xdcfa, 0x00d6, 0x6610, 0x2658, 0xbe04, 0x9684,
-- 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001, 0x0001, 0x080c, 0x6656,
-- 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0188, 0x9686, 0x0004,
-- 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140, 0x9686,
-- 0x0004, 0x0128, 0x9686, 0x0005, 0x0110, 0x00de, 0x0480, 0x00e6,
-- 0x2071, 0x0260, 0x7034, 0x9084, 0x0003, 0x1140, 0x7034, 0x9082,
-- 0x0014, 0x0220, 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee, 0x6017,
-- 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee, 0x080c, 0xe8b2, 0x1190,
-- 0x9686, 0x0006, 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e,
-- 0x080c, 0x3299, 0x002e, 0x080c, 0x67bf, 0x6007, 0x000a, 0x00de,
-- 0x0804, 0xdac4, 0x6007, 0x000b, 0x00de, 0x0804, 0xdac4, 0x080c,
-- 0x3250, 0x080c, 0xd7f8, 0x6007, 0x0001, 0x0804, 0xdac4, 0x080c,
-- 0xee26, 0x1904, 0xdcfa, 0x080c, 0x3374, 0x1904, 0xdcfa, 0x2071,
-- 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014, 0x0a30,
-- 0x7030, 0x9084, 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04, 0x9686,
-- 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c,
-- 0x3299, 0x002e, 0x6007, 0x000c, 0x2001, 0x0001, 0x080c, 0xeff4,
-- 0x0804, 0xdac4, 0x080c, 0x6a61, 0x1140, 0x2001, 0x1837, 0x2004,
-- 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd8d6, 0x080c,
-- 0x69fd, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006,
-- 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x6696, 0x002e,
-- 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686,
-- 0x0006, 0x1904, 0xd997, 0x080c, 0xe8bf, 0x1120, 0x6007, 0x000e,
-- 0x0804, 0xdac4, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c,
-- 0x3250, 0x080c, 0xd7f8, 0x004e, 0x0016, 0x9006, 0x2009, 0x1848,
-- 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xec31, 0x6010,
-- 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001,
-- 0x0804, 0xdac4, 0x2001, 0x0001, 0x080c, 0x6656, 0x0156, 0x0016,
-- 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0270,
-- 0x080c, 0xc365, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0168,
-- 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004, 0x0a04, 0xd997, 0x9682,
-- 0x0007, 0x0a04, 0xd9f3, 0x0804, 0xd997, 0x6017, 0x1900, 0x6007,
-- 0x0009, 0x0804, 0xdac4, 0x080c, 0x6a61, 0x1140, 0x2001, 0x1837,
-- 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd8d6,
-- 0x080c, 0x69fd, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x0006,
-- 0x0016, 0x908e, 0x0001, 0x0118, 0x908e, 0x0000, 0x1118, 0x001e,
-- 0x000e, 0x0080, 0x001e, 0x000e, 0x9082, 0x0006, 0x06a0, 0x0150,
-- 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006,
-- 0x1904, 0xd997, 0x080c, 0xe8ed, 0x1138, 0x080c, 0xe7ea, 0x1120,
-- 0x6007, 0x0010, 0x0804, 0xdac4, 0x0046, 0x6410, 0x2458, 0xbca0,
-- 0x0046, 0x080c, 0x3250, 0x080c, 0xd7f8, 0x004e, 0x0016, 0x9006,
-- 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c,
-- 0xec31, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e,
-- 0x6007, 0x0001, 0x0448, 0x080c, 0xeab9, 0x0198, 0x0016, 0x968c,
-- 0x00ff, 0x9186, 0x0002, 0x0160, 0x9186, 0x0003, 0x0148, 0x001e,
-- 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0920, 0x0804, 0xd997,
-- 0x001e, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c, 0x3374,
-- 0x1904, 0xdcfa, 0x080c, 0xee26, 0x1904, 0xdcfa, 0x080c, 0xdecb,
-- 0x1904, 0xd997, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c, 0x9547,
-- 0x080c, 0x9ab1, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
-- 0x9547, 0x080c, 0x9ab1, 0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c,
-- 0xee26, 0x1904, 0xdcfa, 0x080c, 0x3374, 0x1904, 0xdcfa, 0x080c,
-- 0xdecb, 0x1904, 0xd997, 0x6007, 0x0020, 0x6003, 0x0001, 0x080c,
-- 0x9547, 0x080c, 0x9ab1, 0x0005, 0x080c, 0x3374, 0x1904, 0xdcfa,
-- 0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1,
-- 0x0005, 0x080c, 0xee26, 0x1904, 0xdcfa, 0x080c, 0x3374, 0x1904,
-- 0xdcfa, 0x080c, 0xdecb, 0x1904, 0xd997, 0x0016, 0x0026, 0x00e6,
-- 0x2071, 0x0260, 0x2c08, 0x2011, 0x1820, 0x2214, 0x703c, 0x9206,
-- 0x11e0, 0x2011, 0x181f, 0x2214, 0x7038, 0x9084, 0x00ff, 0x9206,
-- 0x11a0, 0x7240, 0x080c, 0xd0c6, 0x0570, 0x2260, 0x6008, 0x9086,
-- 0xffff, 0x0120, 0x7244, 0x6008, 0x9206, 0x1528, 0x6020, 0x9086,
-- 0x0007, 0x1508, 0x080c, 0xb2d3, 0x04a0, 0x7244, 0x9286, 0xffff,
-- 0x0180, 0x2c08, 0x080c, 0xd0c6, 0x01b0, 0x2260, 0x7240, 0x6008,
-- 0x9206, 0x1188, 0x6010, 0x9190, 0x0004, 0x2214, 0x9206, 0x01b8,
-- 0x0050, 0x7240, 0x2c08, 0x9006, 0x080c, 0xebfb, 0x1180, 0x7244,
-- 0x9286, 0xffff, 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017, 0x1700,
-- 0x7214, 0x9296, 0xffff, 0x1180, 0x6007, 0x0025, 0x0068, 0x6020,
-- 0x9086, 0x0007, 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110, 0x080c,
-- 0xb2d3, 0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x080c, 0x9547,
-- 0x080c, 0x9ab1, 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001, 0x0001,
-- 0x080c, 0x6656, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004,
-- 0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xc365, 0x003e, 0x002e,
-- 0x001e, 0x015e, 0x0120, 0x6007, 0x0031, 0x0804, 0xdac4, 0x080c,
-- 0xbf7b, 0x080c, 0x7637, 0x1190, 0x0006, 0x0026, 0x0036, 0x080c,
-- 0x7651, 0x1138, 0x080c, 0x7932, 0x080c, 0x612e, 0x080c, 0x7563,
-- 0x0010, 0x080c, 0x760f, 0x003e, 0x002e, 0x000e, 0x0005, 0x080c,
-- 0x3374, 0x1904, 0xdcfa, 0x080c, 0xdecb, 0x1904, 0xd997, 0x6106,
-- 0x080c, 0xdee7, 0x1120, 0x6007, 0x002b, 0x0804, 0xdac4, 0x6007,
-- 0x002c, 0x0804, 0xdac4, 0x080c, 0xee26, 0x1904, 0xdcfa, 0x080c,
-- 0x3374, 0x1904, 0xdcfa, 0x080c, 0xdecb, 0x1904, 0xd997, 0x6106,
-- 0x080c, 0xdeec, 0x1120, 0x6007, 0x002e, 0x0804, 0xdac4, 0x6007,
-- 0x002f, 0x0804, 0xdac4, 0x080c, 0x3374, 0x1904, 0xdcfa, 0x00e6,
-- 0x00d6, 0x00c6, 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff, 0x9086,
-- 0x0006, 0x0158, 0x9184, 0xff00, 0x8007, 0x9086, 0x0006, 0x0128,
-- 0x00ce, 0x00de, 0x00ee, 0x0804, 0xdacb, 0x080c, 0x57d9, 0xd0e4,
-- 0x0904, 0xdc45, 0x2071, 0x026c, 0x7010, 0x603a, 0x7014, 0x603e,
-- 0x7108, 0x720c, 0x080c, 0x6a9f, 0x0140, 0x6010, 0x2058, 0xb810,
-- 0x9106, 0x1118, 0xb814, 0x9206, 0x0510, 0x080c, 0x6a9b, 0x15b8,
-- 0x2069, 0x1800, 0x6880, 0x9206, 0x1590, 0x687c, 0x9106, 0x1578,
-- 0x7210, 0x080c, 0xd0c6, 0x0590, 0x080c, 0xddb8, 0x0578, 0x080c,
-- 0xecad, 0x0560, 0x622e, 0x6007, 0x0036, 0x6003, 0x0001, 0x080c,
-- 0x94ff, 0x080c, 0x9ab1, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214,
-- 0x9286, 0xffff, 0x0150, 0x080c, 0xd0c6, 0x01c0, 0x9280, 0x0002,
-- 0x2004, 0x7110, 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085,
-- 0x0001, 0x080c, 0xebfb, 0x2c10, 0x2160, 0x0140, 0x0890, 0x6007,
-- 0x0037, 0x602f, 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007, 0x0037,
-- 0x602f, 0x0003, 0x6017, 0x1700, 0x0880, 0x6007, 0x0012, 0x0868,
-- 0x080c, 0x3374, 0x1904, 0xdcfa, 0x6010, 0x2058, 0xb804, 0x9084,
-- 0xff00, 0x8007, 0x9086, 0x0006, 0x1904, 0xdacb, 0x00e6, 0x00d6,
-- 0x00c6, 0x080c, 0x57d9, 0xd0e4, 0x0904, 0xdcbd, 0x2069, 0x1800,
-- 0x2071, 0x026c, 0x7008, 0x603a, 0x720c, 0x623e, 0x9286, 0xffff,
-- 0x1150, 0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c, 0xebfb,
-- 0x2c10, 0x00ce, 0x05e8, 0x080c, 0xd0c6, 0x05d0, 0x7108, 0x9280,
-- 0x0002, 0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c,
-- 0xcce6, 0x002e, 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f, 0x9186,
-- 0x0001, 0x0178, 0x9186, 0x0005, 0x0118, 0x9186, 0x0007, 0x1198,
-- 0x9280, 0x0005, 0x2004, 0x9005, 0x0170, 0x080c, 0xddb8, 0x0904,
-- 0xdc3e, 0x0056, 0x7510, 0x7614, 0x080c, 0xecc6, 0x005e, 0x00ce,
-- 0x00de, 0x00ee, 0x0005, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017,
-- 0x2a00, 0x6003, 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0c78,
-- 0x6007, 0x003b, 0x602f, 0x0003, 0x6017, 0x0300, 0x6003, 0x0001,
-- 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0c10, 0x6007, 0x003b, 0x602f,
-- 0x000b, 0x6017, 0x0000, 0x0804, 0xdc15, 0x00e6, 0x0026, 0x080c,
-- 0x6a61, 0x0550, 0x080c, 0x69fd, 0x080c, 0xee97, 0x1518, 0x2071,
-- 0x1800, 0x70dc, 0x9085, 0x0003, 0x70de, 0x00f6, 0x2079, 0x0100,
-- 0x72b0, 0x9284, 0x00ff, 0x707e, 0x78e6, 0x9284, 0xff00, 0x7280,
-- 0x9205, 0x7082, 0x78ea, 0x00fe, 0x70e7, 0x0000, 0x080c, 0x6a9f,
-- 0x0120, 0x2011, 0x1a01, 0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c,
-- 0x3000, 0x0010, 0x080c, 0xeecb, 0x002e, 0x00ee, 0x080c, 0xb2d3,
-- 0x0804, 0xdaca, 0x080c, 0xb2d3, 0x0005, 0x2600, 0x0002, 0xdd11,
-- 0xdd3f, 0xdd50, 0xdd11, 0xdd11, 0xdd13, 0xdd61, 0xdd11, 0xdd11,
-- 0xdd11, 0xdd2d, 0xdd11, 0xdd11, 0xdd11, 0xdd6c, 0xdd82, 0xddb3,
-- 0xdd11, 0x080c, 0x0dc5, 0x080c, 0xee26, 0x1d20, 0x080c, 0x3374,
-- 0x1d08, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001, 0x080c,
-- 0x9547, 0x0005, 0x080c, 0x3250, 0x080c, 0xd7f8, 0x6007, 0x0001,
-- 0x6003, 0x0001, 0x080c, 0x9547, 0x0005, 0x080c, 0xee26, 0x1950,
-- 0x080c, 0x3374, 0x1938, 0x080c, 0xdecb, 0x1d60, 0x703c, 0x6016,
-- 0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x9547, 0x0005, 0x080c,
-- 0x3374, 0x1904, 0xdcfa, 0x2009, 0x0041, 0x080c, 0xeed4, 0x6007,
-- 0x0047, 0x6003, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0005,
-- 0x080c, 0x3374, 0x1904, 0xdcfa, 0x2009, 0x0042, 0x080c, 0xeed4,
-- 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1,
-- 0x0005, 0x080c, 0x3374, 0x1904, 0xdcfa, 0x2009, 0x0046, 0x080c,
-- 0xeed4, 0x080c, 0xb2d3, 0x0005, 0x2001, 0x1824, 0x2004, 0x9082,
-- 0x00e1, 0x1268, 0x080c, 0xddd5, 0x0904, 0xdcfa, 0x6007, 0x004e,
-- 0x6003, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0005, 0x6007,
-- 0x0012, 0x0cb0, 0x6007, 0x004f, 0x6017, 0x0000, 0x7134, 0x918c,
-- 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001, 0x1160, 0x7140, 0x2001,
-- 0x19be, 0x2004, 0x9106, 0x11b0, 0x7144, 0x2001, 0x19bf, 0x2004,
-- 0x9106, 0x0190, 0x9186, 0x0002, 0x1168, 0x2011, 0x0276, 0x20a9,
-- 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xc379,
-- 0x009e, 0x0110, 0x6017, 0x0001, 0x6003, 0x0001, 0x080c, 0x9547,
-- 0x080c, 0x9ab1, 0x0005, 0x6007, 0x0050, 0x703c, 0x6016, 0x0ca0,
-- 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260, 0x6010,
-- 0x2058, 0xb8cc, 0xd084, 0x0150, 0x7128, 0x6044, 0x9106, 0x1120,
-- 0x712c, 0x6048, 0x9106, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001,
-- 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005, 0x0016, 0x0096, 0x0086,
-- 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800,
-- 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003, 0x0000, 0x080c, 0x1027,
-- 0x05a0, 0x2900, 0x6016, 0x7090, 0x8004, 0xa816, 0x908a, 0x001e,
-- 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c,
-- 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c, 0x0471,
-- 0x001e, 0x81ff, 0x01b8, 0x2940, 0x080c, 0x1027, 0x01b0, 0x2900,
-- 0xa006, 0x2100, 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c,
-- 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c, 0x00b1,
-- 0x001e, 0x0000, 0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x7093,
-- 0x0000, 0x6014, 0x2048, 0x080c, 0x0fc0, 0x9006, 0x012e, 0x01de,
-- 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016,
-- 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff, 0x11b0, 0x080c, 0x23e2,
-- 0x2099, 0x026c, 0x2001, 0x0014, 0x3518, 0x9312, 0x0108, 0x1218,
-- 0x23a8, 0x4003, 0x0400, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c,
-- 0x23e2, 0x2099, 0x0260, 0x0ca8, 0x080c, 0x23e2, 0x2061, 0x19a1,
-- 0x6004, 0x2098, 0x6008, 0x3518, 0x9312, 0x0108, 0x1218, 0x23a8,
-- 0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x23e2,
-- 0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a1, 0x2019, 0x0280, 0x3300,
-- 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0260, 0x6006, 0x8108,
-+ 0x080c, 0x3250, 0x0868, 0x080c, 0xb2ff, 0x0005, 0x6000, 0x908a,
-+ 0x0010, 0x1a0c, 0x0dc5, 0x0002, 0xd0ac, 0xd0ac, 0xd0b0, 0xd0ae,
-+ 0xd0ba, 0xd0ac, 0xd0ac, 0xb2ff, 0xd0ac, 0xd0ac, 0xd0ac, 0xd0ac,
-+ 0xd0ac, 0xd0ac, 0xd0ac, 0xd0ac, 0x080c, 0x0dc5, 0x080c, 0xac24,
-+ 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x6e98, 0x009e,
-+ 0x0804, 0xb2cc, 0x601c, 0xd084, 0x190c, 0x1a8e, 0x0c88, 0x9284,
-+ 0x0007, 0x1158, 0x9282, 0x1cd0, 0x0240, 0x2001, 0x181a, 0x2004,
-+ 0x9202, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096,
-+ 0x0028, 0x0096, 0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984,
-+ 0xf000, 0x9086, 0xf000, 0x0110, 0x080c, 0x10b9, 0x000e, 0x009e,
-+ 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000,
-+ 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7354, 0x7074, 0x9302, 0x1640,
-+ 0x6020, 0x9206, 0x11f8, 0x080c, 0xd7dc, 0x0180, 0x9286, 0x0001,
-+ 0x1168, 0x6004, 0x9086, 0x0004, 0x1148, 0x080c, 0x3250, 0x080c,
-+ 0xd7f1, 0x00c6, 0x080c, 0xb2ff, 0x00ce, 0x0060, 0x080c, 0xd4c7,
-+ 0x0148, 0x080c, 0xd2d9, 0x1110, 0x080c, 0xbcaf, 0x00c6, 0x080c,
-+ 0xb2cc, 0x00ce, 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1208, 0x08a0,
-+ 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6,
-+ 0x0016, 0x9188, 0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1ab7,
-+ 0x6112, 0x080c, 0x3250, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e,
-+ 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xb276, 0x01b0, 0x6656, 0x2b00, 0x6012, 0x080c, 0x57db, 0x0118,
-+ 0x080c, 0xd200, 0x0168, 0x080c, 0xd54d, 0x6023, 0x0003, 0x2009,
-+ 0x004b, 0x080c, 0xb34b, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-+ 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c,
-+ 0xb31e, 0x0560, 0x6057, 0x0000, 0x2b00, 0x6012, 0x080c, 0xd54d,
-+ 0x6023, 0x0003, 0x0016, 0x080c, 0x969d, 0x0076, 0x903e, 0x080c,
-+ 0x9570, 0x2c08, 0x080c, 0xe915, 0x007e, 0x001e, 0xd184, 0x0128,
-+ 0x080c, 0xb2cc, 0x9085, 0x0001, 0x0070, 0x080c, 0x57db, 0x0128,
-+ 0xd18c, 0x1170, 0x080c, 0xd200, 0x0148, 0x2009, 0x004c, 0x080c,
-+ 0xb34b, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-+ 0x2900, 0x6016, 0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e,
-+ 0x00f6, 0x00c6, 0x0046, 0x0016, 0x080c, 0xb276, 0x2c78, 0x05a0,
-+ 0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0016, 0x2021, 0x0005,
-+ 0x080c, 0xd212, 0x001e, 0x9186, 0x004d, 0x0118, 0x9186, 0x004e,
-+ 0x0148, 0x2001, 0x1980, 0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c,
-+ 0xb2cc, 0x00d0, 0x2001, 0x197f, 0x200c, 0xd1fc, 0x0120, 0x2f60,
-+ 0x080c, 0xb2cc, 0x0088, 0x2f60, 0x080c, 0x57db, 0x0138, 0xd18c,
-+ 0x1118, 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816, 0x001e, 0x0016,
-+ 0x080c, 0xb34b, 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe,
-+ 0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c, 0xb276, 0x2c78, 0x0508,
-+ 0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096, 0x2021, 0x0004,
-+ 0x0489, 0x009e, 0x2001, 0x197e, 0x200c, 0xd1fc, 0x0120, 0x2f60,
-+ 0x080c, 0xb2cc, 0x0060, 0x2f60, 0x080c, 0x57db, 0x0120, 0xd18c,
-+ 0x1160, 0x0071, 0x0130, 0x2009, 0x0052, 0x080c, 0xb34b, 0x9085,
-+ 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98,
-+ 0x00c6, 0x080c, 0x4be2, 0x00ce, 0x1120, 0x080c, 0xb2cc, 0x9006,
-+ 0x0005, 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016, 0x9085,
-+ 0x0001, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x6851, 0x0158, 0x2001, 0xd217, 0x0006, 0x900e, 0x2400, 0x080c,
-+ 0x7104, 0x080c, 0x6e98, 0x000e, 0x0807, 0x2418, 0x080c, 0x9938,
-+ 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c,
-+ 0x96b5, 0x008e, 0x080c, 0x9570, 0x2f08, 0x2648, 0x080c, 0xe915,
-+ 0xb93c, 0x81ff, 0x090c, 0x9788, 0x080c, 0x9aaa, 0x012e, 0x007e,
-+ 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb276,
-+ 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023, 0x0001,
-+ 0x2900, 0x6016, 0x2009, 0x001f, 0x080c, 0xb34b, 0x9085, 0x0001,
-+ 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0xb31e, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c,
-+ 0xd54d, 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c,
-+ 0x1768, 0x00fe, 0x2009, 0x0021, 0x080c, 0xb34b, 0x9085, 0x0001,
-+ 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6,
-+ 0x0126, 0x0016, 0x2091, 0x8000, 0x080c, 0xb276, 0x0198, 0x660a,
-+ 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023, 0x0001, 0x2900, 0x6016,
-+ 0x001e, 0x0016, 0x080c, 0xb34b, 0x9085, 0x0001, 0x001e, 0x012e,
-+ 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0xb31e, 0x0188, 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023,
-+ 0x0001, 0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0xb34b, 0x9085,
-+ 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044,
-+ 0x0830, 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258,
-+ 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x002e, 0x0005,
-+ 0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003,
-+ 0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e,
-+ 0x0005, 0x0006, 0x0086, 0x0096, 0x6020, 0x9086, 0x0004, 0x01a8,
-+ 0x6014, 0x904d, 0x080c, 0xd0d1, 0x0180, 0xa864, 0x9086, 0x0139,
-+ 0x0170, 0x6020, 0x90c6, 0x0003, 0x0140, 0x90c6, 0x0002, 0x0128,
-+ 0xa868, 0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e,
-+ 0x008e, 0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xb31e, 0x0198, 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023, 0x0001,
-+ 0x2900, 0x6016, 0x080c, 0x3250, 0x2009, 0x0028, 0x080c, 0xb34b,
-+ 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186,
-+ 0x0015, 0x11a8, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1178,
-+ 0x00b6, 0x080c, 0xbf5c, 0x00be, 0x080c, 0xc1d8, 0x6003, 0x0001,
-+ 0x6007, 0x0029, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0078, 0x6014,
-+ 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001,
-+ 0x080c, 0xd713, 0x080c, 0xbcaf, 0x080c, 0xb2cc, 0x0005, 0x0096,
-+ 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa87b, 0x0030, 0xa883, 0x0000,
-+ 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x6e98, 0x012e, 0x009e, 0x080c, 0xb2cc, 0x0c30,
-+ 0x0096, 0x9186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x6663,
-+ 0x00e8, 0x9186, 0x0015, 0x1510, 0x2011, 0x1824, 0x2204, 0x9086,
-+ 0x0014, 0x11e0, 0x6010, 0x00b6, 0x2058, 0x080c, 0x67b8, 0x00be,
-+ 0x080c, 0xc2ae, 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be,
-+ 0x9005, 0x0160, 0x2001, 0x0006, 0x080c, 0x6663, 0x6014, 0x2048,
-+ 0xa868, 0xd0fc, 0x0170, 0x080c, 0xb6d5, 0x0048, 0x6014, 0x2048,
-+ 0xa868, 0xd0fc, 0x0528, 0x080c, 0xbcaf, 0x080c, 0xb2cc, 0x009e,
-+ 0x0005, 0x6014, 0x6310, 0x2358, 0x904d, 0x090c, 0x0dc5, 0xa87b,
-+ 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x693d,
-+ 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x6e98, 0x012e, 0x080c, 0xb2cc, 0x08f8,
-+ 0x6014, 0x904d, 0x090c, 0x0dc5, 0xa87b, 0x0030, 0xa883, 0x0000,
-+ 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x6e98, 0x012e, 0x080c, 0xb2cc, 0x0840, 0xa878,
-+ 0x9086, 0x0005, 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882,
-+ 0x0005, 0x6043, 0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007,
-+ 0x0050, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0005, 0x00c6, 0x6010,
-+ 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0120, 0x6020, 0x9084,
-+ 0x000f, 0x0013, 0x00ce, 0x0005, 0xcdd2, 0xd3fd, 0xd3fd, 0xd400,
-+ 0xec79, 0xec94, 0xec97, 0xcdd2, 0xcdd2, 0xcdd2, 0xcdd2, 0xcdd2,
-+ 0xcdd2, 0xcdd2, 0xcdd2, 0x080c, 0x0dc5, 0xa001, 0xa001, 0x0005,
-+ 0x0096, 0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e,
-+ 0x0010, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-+ 0xd0bc, 0x0550, 0x2001, 0x1834, 0x2004, 0x9005, 0x1540, 0x00f6,
-+ 0x2c78, 0x080c, 0xb276, 0x0508, 0x7810, 0x6012, 0x080c, 0xd54d,
-+ 0x7820, 0x9086, 0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e,
-+ 0x0020, 0x7808, 0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001,
-+ 0x6007, 0x0035, 0x6003, 0x0001, 0x7954, 0x6156, 0x080c, 0x94f8,
-+ 0x080c, 0x9aaa, 0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001,
-+ 0x1988, 0x2004, 0x6042, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048,
-+ 0xa87c, 0xd0e4, 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893,
-+ 0x0000, 0xa88f, 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878,
-+ 0x2048, 0x080c, 0x0fc0, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148,
-+ 0x6803, 0x0002, 0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032,
-+ 0x00d0, 0x681c, 0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4,
-+ 0x9085, 0x0c00, 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102,
-+ 0xa8b0, 0x693c, 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084,
-+ 0xfffc, 0x683a, 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910,
-+ 0x6112, 0x6954, 0x6156, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003,
-+ 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x009e, 0x001e, 0x0005,
-+ 0x6024, 0xd0d4, 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c,
-+ 0x9303, 0x0230, 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098,
-+ 0x643a, 0x633e, 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac,
-+ 0x9402, 0xa836, 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e,
-+ 0x6024, 0xc0d4, 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c,
-+ 0x603a, 0xa840, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006,
-+ 0x0016, 0x6004, 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0,
-+ 0x908e, 0x0036, 0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038,
-+ 0x0158, 0x908e, 0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e,
-+ 0x003b, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006,
-+ 0x0016, 0x0026, 0x0036, 0x00e6, 0x2001, 0x1982, 0x200c, 0x8000,
-+ 0x2014, 0x2001, 0x0032, 0x080c, 0x936e, 0x2001, 0x1986, 0x82ff,
-+ 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1984, 0x200c, 0x8000,
-+ 0x2014, 0x2071, 0x196c, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c,
-+ 0x936e, 0x2001, 0x1987, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202,
-+ 0x2001, 0x1988, 0x9288, 0x000a, 0x2102, 0x2001, 0x1a98, 0x2102,
-+ 0x2001, 0x0032, 0x080c, 0x1611, 0x080c, 0x6a7d, 0x00ee, 0x003e,
-+ 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001,
-+ 0x1986, 0x2003, 0x0028, 0x2001, 0x1987, 0x2003, 0x0014, 0x2071,
-+ 0x196c, 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001, 0x1988, 0x2009,
-+ 0x001e, 0x2102, 0x2001, 0x1a98, 0x2102, 0x2001, 0x0032, 0x080c,
-+ 0x1611, 0x00ee, 0x001e, 0x000e, 0x0005, 0x0096, 0x6058, 0x904d,
-+ 0x0110, 0x080c, 0x1040, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0xb276, 0x0180, 0x2b08, 0x6112, 0x0ca9,
-+ 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0xb34b,
-+ 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096,
-+ 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1520, 0x7090,
-+ 0x9086, 0x0018, 0x0120, 0x7090, 0x9086, 0x0014, 0x11e0, 0x6014,
-+ 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x9d45, 0x01d8,
-+ 0x707c, 0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206, 0x1140,
-+ 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3299,
-+ 0x080c, 0xb6d5, 0x0020, 0x080c, 0xbcaf, 0x080c, 0xb2cc, 0x00fe,
-+ 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48, 0x0c80,
-+ 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb276, 0x0188, 0x2b08,
-+ 0x6112, 0x080c, 0xd54d, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
-+ 0x004d, 0x080c, 0xb34b, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-+ 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c,
-+ 0xb276, 0x0180, 0x2b08, 0x6112, 0x080c, 0xd54d, 0x6023, 0x0001,
-+ 0x2900, 0x6016, 0x001e, 0x080c, 0xb34b, 0x9085, 0x0001, 0x012e,
-+ 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036,
-+ 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800,
-+ 0x9186, 0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814, 0x8003,
-+ 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003, 0x0000,
-+ 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094,
-+ 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001,
-+ 0x19a1, 0x0016, 0x200c, 0x080c, 0xde27, 0x001e, 0xa804, 0x9005,
-+ 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010,
-+ 0x080c, 0xbcaf, 0x080c, 0xb2cc, 0x00fe, 0x00ee, 0x009e, 0x006e,
-+ 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6,
-+ 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090, 0x9086,
-+ 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x9d45, 0x01a8,
-+ 0x707c, 0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206, 0x1110,
-+ 0x080c, 0x3250, 0x080c, 0xb6d5, 0x0020, 0x080c, 0xbcaf, 0x080c,
-+ 0xb2cc, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78, 0x9206,
-+ 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-+ 0x0015, 0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048,
-+ 0x2c78, 0x080c, 0x9d45, 0x05f0, 0x707c, 0xaacc, 0x9206, 0x1180,
-+ 0x7080, 0xaad0, 0x9206, 0x1160, 0x080c, 0x3250, 0x0016, 0xa998,
-+ 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5782, 0x001e, 0x0010,
-+ 0x080c, 0x556d, 0x080c, 0xd0d1, 0x0508, 0xa87b, 0x0000, 0xa883,
-+ 0x0000, 0xa897, 0x4000, 0x0080, 0x080c, 0xd0d1, 0x01b8, 0x6014,
-+ 0x2048, 0x080c, 0x556d, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000,
-+ 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867,
-+ 0x0139, 0x080c, 0x6e98, 0x012e, 0x080c, 0xb2cc, 0x00fe, 0x00ee,
-+ 0x009e, 0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016,
-+ 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205,
-+ 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992,
-+ 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6,
-+ 0x0036, 0x080c, 0xd0d1, 0x0904, 0xd70f, 0x0096, 0x6314, 0x2348,
-+ 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358,
-+ 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x693d, 0x1108,
-+ 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9,
-+ 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4,
-+ 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f8b, 0x20a9,
-+ 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080, 0x000a,
-+ 0x2098, 0x080c, 0x0f8b, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398,
-+ 0x0007, 0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004,
-+ 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0xa868,
-+ 0xc0f4, 0xa86a, 0x080c, 0x6e8b, 0x6017, 0x0000, 0x009e, 0x003e,
-+ 0x00de, 0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096,
-+ 0x00f6, 0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096,
-+ 0x0000, 0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x2873,
-+ 0x2118, 0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d,
-+ 0x7c3c, 0x2011, 0x8018, 0x080c, 0x4c42, 0x00a8, 0x9096, 0x0001,
-+ 0x1148, 0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c,
-+ 0xa8aa, 0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838,
-+ 0xa8a6, 0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e,
-+ 0x002e, 0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110,
-+ 0x6a38, 0x0008, 0x6a2c, 0x080c, 0xd0bf, 0x01f0, 0x2260, 0x6120,
-+ 0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206,
-+ 0x0140, 0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140,
-+ 0x0020, 0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106,
-+ 0x001e, 0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974,
-+ 0xd1cc, 0x0198, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1170, 0xa9a8,
-+ 0x918c, 0x000f, 0x918e, 0x0001, 0x1140, 0xa87c, 0xd0ac, 0x0128,
-+ 0xa834, 0xa938, 0x9115, 0x190c, 0xc784, 0x0005, 0x0036, 0x2019,
-+ 0x0001, 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0, 0x080c, 0xd0d1,
-+ 0x01c8, 0x080c, 0xd2bc, 0x6037, 0x4000, 0x6014, 0x6017, 0x0000,
-+ 0x0096, 0x2048, 0xa87c, 0x080c, 0xd2d9, 0x1118, 0x080c, 0xbcaf,
-+ 0x0040, 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff, 0x1129, 0x080c,
-+ 0x6e98, 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b,
-+ 0x0006, 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002,
-+ 0x0020, 0xa87b, 0x0005, 0x080c, 0xd3cd, 0xa877, 0x0000, 0x0005,
-+ 0x2001, 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810,
-+ 0x2004, 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004,
-+ 0xd0e4, 0x000e, 0x0005, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058,
-+ 0xbba0, 0x00be, 0x2021, 0x0007, 0x080c, 0x4df9, 0x004e, 0x003e,
-+ 0x0005, 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1986, 0x2004, 0x601a,
-+ 0x0005, 0x2001, 0x1988, 0x2004, 0x6042, 0x0005, 0x080c, 0xb2cc,
-+ 0x0804, 0x9aaa, 0x2001, 0x0109, 0x2004, 0xd084, 0x01e0, 0x0126,
-+ 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x0036, 0x00f6, 0x00e6,
-+ 0x00c6, 0x2079, 0x19e8, 0x2071, 0x1800, 0x2061, 0x0100, 0x080c,
-+ 0x93db, 0x00ce, 0x00ee, 0x00fe, 0x003e, 0x002e, 0x001e, 0x000e,
-+ 0x012e, 0x9085, 0x0001, 0x0005, 0x00b6, 0x0066, 0x6000, 0x90b2,
-+ 0x0010, 0x1a0c, 0x0dc5, 0x001b, 0x006e, 0x00be, 0x0005, 0xd83f,
-+ 0xdf86, 0xe0fb, 0xd83f, 0xd83f, 0xd83f, 0xd83f, 0xd83f, 0xd876,
-+ 0xe17f, 0xd83f, 0xd83f, 0xd83f, 0xd83f, 0xd83f, 0xd83f, 0x080c,
-+ 0x0dc5, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0dc5, 0x0013,
-+ 0x006e, 0x0005, 0xd85a, 0xe6ce, 0xd85a, 0xd85a, 0xd85a, 0xd85a,
-+ 0xd85a, 0xd85a, 0xe67b, 0xe722, 0xd85a, 0xedad, 0xede3, 0xedad,
-+ 0xede3, 0xd85a, 0x080c, 0x0dc5, 0x6000, 0x9082, 0x0010, 0x1a0c,
-+ 0x0dc5, 0x6000, 0x000a, 0x0005, 0xd874, 0xe35d, 0xe42c, 0xe44f,
-+ 0xe50f, 0xd874, 0xe5ee, 0xe597, 0xe18b, 0xe651, 0xe666, 0xd874,
-+ 0xd874, 0xd874, 0xd874, 0xd874, 0x080c, 0x0dc5, 0x91b2, 0x0053,
-+ 0x1a0c, 0x0dc5, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xdcf6, 0x0002,
-+ 0xd8c0, 0xdac4, 0xd8c0, 0xd8c0, 0xd8c0, 0xdacd, 0xd8c0, 0xd8c0,
-+ 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0,
-+ 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c2,
-+ 0xd925, 0xd934, 0xd998, 0xd9c3, 0xda3c, 0xdaaf, 0xd8c0, 0xd8c0,
-+ 0xdad0, 0xd8c0, 0xd8c0, 0xdae5, 0xdaf2, 0xd8c0, 0xd8c0, 0xd8c0,
-+ 0xd8c0, 0xd8c0, 0xdb98, 0xd8c0, 0xd8c0, 0xdbac, 0xd8c0, 0xd8c0,
-+ 0xdb67, 0xd8c0, 0xd8c0, 0xd8c0, 0xdbc4, 0xd8c0, 0xd8c0, 0xd8c0,
-+ 0xdc41, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xd8c0, 0xdcbe,
-+ 0x080c, 0x0dc5, 0x080c, 0x6a5a, 0x1150, 0x2001, 0x1837, 0x2004,
-+ 0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007,
-+ 0x0009, 0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xdabd, 0x080c,
-+ 0x69f6, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258,
-+ 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x969d, 0x0076, 0x903e,
-+ 0x080c, 0x9570, 0x2c08, 0x080c, 0xe915, 0x007e, 0x001e, 0x001e,
-+ 0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658, 0x080c, 0x672c,
-+ 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268, 0x0016, 0x0026,
-+ 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xf00e,
-+ 0x002e, 0x001e, 0x1178, 0x080c, 0xe847, 0x1904, 0xd990, 0x080c,
-+ 0xe7e3, 0x1120, 0x6007, 0x0008, 0x0804, 0xdabd, 0x6007, 0x0009,
-+ 0x0804, 0xdabd, 0x080c, 0xeab2, 0x0128, 0x080c, 0xe847, 0x0d78,
-+ 0x0804, 0xd990, 0x6017, 0x1900, 0x0c88, 0x080c, 0x3374, 0x1904,
-+ 0xdcf3, 0x6106, 0x080c, 0xe787, 0x6007, 0x0006, 0x0804, 0xdabd,
-+ 0x6007, 0x0007, 0x0804, 0xdabd, 0x080c, 0xee1f, 0x1904, 0xdcf3,
-+ 0x080c, 0x3374, 0x1904, 0xdcf3, 0x00d6, 0x6610, 0x2658, 0xbe04,
-+ 0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001, 0x0001, 0x080c,
-+ 0x664f, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0188, 0x9686,
-+ 0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140,
-+ 0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110, 0x00de, 0x0480,
-+ 0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003, 0x1140, 0x7034,
-+ 0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee,
-+ 0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee, 0x080c, 0xe8ab,
-+ 0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0,
-+ 0x900e, 0x080c, 0x3299, 0x002e, 0x080c, 0x67b8, 0x6007, 0x000a,
-+ 0x00de, 0x0804, 0xdabd, 0x6007, 0x000b, 0x00de, 0x0804, 0xdabd,
-+ 0x080c, 0x3250, 0x080c, 0xd7f1, 0x6007, 0x0001, 0x0804, 0xdabd,
-+ 0x080c, 0xee1f, 0x1904, 0xdcf3, 0x080c, 0x3374, 0x1904, 0xdcf3,
-+ 0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014,
-+ 0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04,
-+ 0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e,
-+ 0x080c, 0x3299, 0x002e, 0x6007, 0x000c, 0x2001, 0x0001, 0x080c,
-+ 0xefed, 0x0804, 0xdabd, 0x080c, 0x6a5a, 0x1140, 0x2001, 0x1837,
-+ 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd8cf,
-+ 0x080c, 0x69f6, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-+ 0x0006, 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x668f,
-+ 0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120,
-+ 0x9686, 0x0006, 0x1904, 0xd990, 0x080c, 0xe8b8, 0x1120, 0x6007,
-+ 0x000e, 0x0804, 0xdabd, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046,
-+ 0x080c, 0x3250, 0x080c, 0xd7f1, 0x004e, 0x0016, 0x9006, 0x2009,
-+ 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xec2a,
-+ 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007,
-+ 0x0001, 0x0804, 0xdabd, 0x2001, 0x0001, 0x080c, 0x664f, 0x0156,
-+ 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-+ 0x0270, 0x080c, 0xc35e, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005,
-+ 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004, 0x0a04, 0xd990,
-+ 0x9682, 0x0007, 0x0a04, 0xd9ec, 0x0804, 0xd990, 0x6017, 0x1900,
-+ 0x6007, 0x0009, 0x0804, 0xdabd, 0x080c, 0x6a5a, 0x1140, 0x2001,
-+ 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804,
-+ 0xd8cf, 0x080c, 0x69f6, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff,
-+ 0x0006, 0x0016, 0x908e, 0x0001, 0x0118, 0x908e, 0x0000, 0x1118,
-+ 0x001e, 0x000e, 0x0080, 0x001e, 0x000e, 0x9082, 0x0006, 0x06a0,
-+ 0x0150, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686,
-+ 0x0006, 0x1904, 0xd990, 0x080c, 0xe8e6, 0x1138, 0x080c, 0xe7e3,
-+ 0x1120, 0x6007, 0x0010, 0x0804, 0xdabd, 0x0046, 0x6410, 0x2458,
-+ 0xbca0, 0x0046, 0x080c, 0x3250, 0x080c, 0xd7f1, 0x004e, 0x0016,
-+ 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029,
-+ 0x080c, 0xec2a, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e,
-+ 0x004e, 0x6007, 0x0001, 0x0448, 0x080c, 0xeab2, 0x0198, 0x0016,
-+ 0x968c, 0x00ff, 0x9186, 0x0002, 0x0160, 0x9186, 0x0003, 0x0148,
-+ 0x001e, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0920, 0x0804,
-+ 0xd990, 0x001e, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c,
-+ 0x3374, 0x1904, 0xdcf3, 0x080c, 0xee1f, 0x1904, 0xdcf3, 0x080c,
-+ 0xdec4, 0x1904, 0xd990, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c,
-+ 0x9540, 0x080c, 0x9aaa, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001,
-+ 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0cb0, 0x6007, 0x0005, 0x0c68,
-+ 0x080c, 0xee1f, 0x1904, 0xdcf3, 0x080c, 0x3374, 0x1904, 0xdcf3,
-+ 0x080c, 0xdec4, 0x1904, 0xd990, 0x6007, 0x0020, 0x6003, 0x0001,
-+ 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0005, 0x080c, 0x3374, 0x1904,
-+ 0xdcf3, 0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x9540, 0x080c,
-+ 0x9aaa, 0x0005, 0x080c, 0xee1f, 0x1904, 0xdcf3, 0x080c, 0x3374,
-+ 0x1904, 0xdcf3, 0x080c, 0xdec4, 0x1904, 0xd990, 0x0016, 0x0026,
-+ 0x00e6, 0x2071, 0x0260, 0x2c08, 0x2011, 0x1820, 0x2214, 0x703c,
-+ 0x9206, 0x11e0, 0x2011, 0x181f, 0x2214, 0x7038, 0x9084, 0x00ff,
-+ 0x9206, 0x11a0, 0x7240, 0x080c, 0xd0bf, 0x0570, 0x2260, 0x6008,
-+ 0x9086, 0xffff, 0x0120, 0x7244, 0x6008, 0x9206, 0x1528, 0x6020,
-+ 0x9086, 0x0007, 0x1508, 0x080c, 0xb2cc, 0x04a0, 0x7244, 0x9286,
-+ 0xffff, 0x0180, 0x2c08, 0x080c, 0xd0bf, 0x01b0, 0x2260, 0x7240,
-+ 0x6008, 0x9206, 0x1188, 0x6010, 0x9190, 0x0004, 0x2214, 0x9206,
-+ 0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006, 0x080c, 0xebf4, 0x1180,
-+ 0x7244, 0x9286, 0xffff, 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017,
-+ 0x1700, 0x7214, 0x9296, 0xffff, 0x1180, 0x6007, 0x0025, 0x0068,
-+ 0x6020, 0x9086, 0x0007, 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110,
-+ 0x080c, 0xb2cc, 0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x080c,
-+ 0x9540, 0x080c, 0x9aaa, 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001,
-+ 0x0001, 0x080c, 0x664f, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9,
-+ 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xc35e, 0x003e,
-+ 0x002e, 0x001e, 0x015e, 0x0120, 0x6007, 0x0031, 0x0804, 0xdabd,
-+ 0x080c, 0xbf74, 0x080c, 0x7630, 0x1190, 0x0006, 0x0026, 0x0036,
-+ 0x080c, 0x764a, 0x1138, 0x080c, 0x792b, 0x080c, 0x6127, 0x080c,
-+ 0x755c, 0x0010, 0x080c, 0x7608, 0x003e, 0x002e, 0x000e, 0x0005,
-+ 0x080c, 0x3374, 0x1904, 0xdcf3, 0x080c, 0xdec4, 0x1904, 0xd990,
-+ 0x6106, 0x080c, 0xdee0, 0x1120, 0x6007, 0x002b, 0x0804, 0xdabd,
-+ 0x6007, 0x002c, 0x0804, 0xdabd, 0x080c, 0xee1f, 0x1904, 0xdcf3,
-+ 0x080c, 0x3374, 0x1904, 0xdcf3, 0x080c, 0xdec4, 0x1904, 0xd990,
-+ 0x6106, 0x080c, 0xdee5, 0x1120, 0x6007, 0x002e, 0x0804, 0xdabd,
-+ 0x6007, 0x002f, 0x0804, 0xdabd, 0x080c, 0x3374, 0x1904, 0xdcf3,
-+ 0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff,
-+ 0x9086, 0x0006, 0x0158, 0x9184, 0xff00, 0x8007, 0x9086, 0x0006,
-+ 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804, 0xdac4, 0x080c, 0x57d7,
-+ 0xd0e4, 0x0904, 0xdc3e, 0x2071, 0x026c, 0x7010, 0x603a, 0x7014,
-+ 0x603e, 0x7108, 0x720c, 0x080c, 0x6a98, 0x0140, 0x6010, 0x2058,
-+ 0xb810, 0x9106, 0x1118, 0xb814, 0x9206, 0x0510, 0x080c, 0x6a94,
-+ 0x15b8, 0x2069, 0x1800, 0x6880, 0x9206, 0x1590, 0x687c, 0x9106,
-+ 0x1578, 0x7210, 0x080c, 0xd0bf, 0x0590, 0x080c, 0xddb1, 0x0578,
-+ 0x080c, 0xeca6, 0x0560, 0x622e, 0x6007, 0x0036, 0x6003, 0x0001,
-+ 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00ce, 0x00de, 0x00ee, 0x0005,
-+ 0x7214, 0x9286, 0xffff, 0x0150, 0x080c, 0xd0bf, 0x01c0, 0x9280,
-+ 0x0002, 0x2004, 0x7110, 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08,
-+ 0x9085, 0x0001, 0x080c, 0xebf4, 0x2c10, 0x2160, 0x0140, 0x0890,
-+ 0x6007, 0x0037, 0x602f, 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007,
-+ 0x0037, 0x602f, 0x0003, 0x6017, 0x1700, 0x0880, 0x6007, 0x0012,
-+ 0x0868, 0x080c, 0x3374, 0x1904, 0xdcf3, 0x6010, 0x2058, 0xb804,
-+ 0x9084, 0xff00, 0x8007, 0x9086, 0x0006, 0x1904, 0xdac4, 0x00e6,
-+ 0x00d6, 0x00c6, 0x080c, 0x57d7, 0xd0e4, 0x0904, 0xdcb6, 0x2069,
-+ 0x1800, 0x2071, 0x026c, 0x7008, 0x603a, 0x720c, 0x623e, 0x9286,
-+ 0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c,
-+ 0xebf4, 0x2c10, 0x00ce, 0x05e8, 0x080c, 0xd0bf, 0x05d0, 0x7108,
-+ 0x9280, 0x0002, 0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260,
-+ 0x080c, 0xccdf, 0x002e, 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f,
-+ 0x9186, 0x0001, 0x0178, 0x9186, 0x0005, 0x0118, 0x9186, 0x0007,
-+ 0x1198, 0x9280, 0x0005, 0x2004, 0x9005, 0x0170, 0x080c, 0xddb1,
-+ 0x0904, 0xdc37, 0x0056, 0x7510, 0x7614, 0x080c, 0xecbf, 0x005e,
-+ 0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007, 0x003b, 0x602f, 0x0009,
-+ 0x6017, 0x2a00, 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa,
-+ 0x0c78, 0x6007, 0x003b, 0x602f, 0x0003, 0x6017, 0x0300, 0x6003,
-+ 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0c10, 0x6007, 0x003b,
-+ 0x602f, 0x000b, 0x6017, 0x0000, 0x0804, 0xdc0e, 0x00e6, 0x0026,
-+ 0x080c, 0x6a5a, 0x0550, 0x080c, 0x69f6, 0x080c, 0xee90, 0x1518,
-+ 0x2071, 0x1800, 0x70dc, 0x9085, 0x0003, 0x70de, 0x00f6, 0x2079,
-+ 0x0100, 0x72b0, 0x9284, 0x00ff, 0x707e, 0x78e6, 0x9284, 0xff00,
-+ 0x7280, 0x9205, 0x7082, 0x78ea, 0x00fe, 0x70e7, 0x0000, 0x080c,
-+ 0x6a98, 0x0120, 0x2011, 0x1a01, 0x2013, 0x07d0, 0xd0ac, 0x1128,
-+ 0x080c, 0x3000, 0x0010, 0x080c, 0xeec4, 0x002e, 0x00ee, 0x080c,
-+ 0xb2cc, 0x0804, 0xdac3, 0x080c, 0xb2cc, 0x0005, 0x2600, 0x0002,
-+ 0xdd0a, 0xdd38, 0xdd49, 0xdd0a, 0xdd0a, 0xdd0c, 0xdd5a, 0xdd0a,
-+ 0xdd0a, 0xdd0a, 0xdd26, 0xdd0a, 0xdd0a, 0xdd0a, 0xdd65, 0xdd7b,
-+ 0xddac, 0xdd0a, 0x080c, 0x0dc5, 0x080c, 0xee1f, 0x1d20, 0x080c,
-+ 0x3374, 0x1d08, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001,
-+ 0x080c, 0x9540, 0x0005, 0x080c, 0x3250, 0x080c, 0xd7f1, 0x6007,
-+ 0x0001, 0x6003, 0x0001, 0x080c, 0x9540, 0x0005, 0x080c, 0xee1f,
-+ 0x1950, 0x080c, 0x3374, 0x1938, 0x080c, 0xdec4, 0x1d60, 0x703c,
-+ 0x6016, 0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x9540, 0x0005,
-+ 0x080c, 0x3374, 0x1904, 0xdcf3, 0x2009, 0x0041, 0x080c, 0xeecd,
-+ 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x9540, 0x080c, 0x9aaa,
-+ 0x0005, 0x080c, 0x3374, 0x1904, 0xdcf3, 0x2009, 0x0042, 0x080c,
-+ 0xeecd, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x9540, 0x080c,
-+ 0x9aaa, 0x0005, 0x080c, 0x3374, 0x1904, 0xdcf3, 0x2009, 0x0046,
-+ 0x080c, 0xeecd, 0x080c, 0xb2cc, 0x0005, 0x2001, 0x1824, 0x2004,
-+ 0x9082, 0x00e1, 0x1268, 0x080c, 0xddce, 0x0904, 0xdcf3, 0x6007,
-+ 0x004e, 0x6003, 0x0001, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x0005,
-+ 0x6007, 0x0012, 0x0cb0, 0x6007, 0x004f, 0x6017, 0x0000, 0x7134,
-+ 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001, 0x1160, 0x7140,
-+ 0x2001, 0x19be, 0x2004, 0x9106, 0x11b0, 0x7144, 0x2001, 0x19bf,
-+ 0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168, 0x2011, 0x0276,
-+ 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c,
-+ 0xc372, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003, 0x0001, 0x080c,
-+ 0x9540, 0x080c, 0x9aaa, 0x0005, 0x6007, 0x0050, 0x703c, 0x6016,
-+ 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260,
-+ 0x6010, 0x2058, 0xb8cc, 0xd084, 0x0150, 0x7128, 0x6044, 0x9106,
-+ 0x1120, 0x712c, 0x6048, 0x9106, 0x0110, 0x9006, 0x0010, 0x9085,
-+ 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005, 0x0016, 0x0096,
-+ 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091, 0x8000, 0x2071,
-+ 0x1800, 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003, 0x0000, 0x080c,
-+ 0x1027, 0x05a0, 0x2900, 0x6016, 0x7090, 0x8004, 0xa816, 0x908a,
-+ 0x001e, 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c,
-+ 0x0471, 0x001e, 0x81ff, 0x01b8, 0x2940, 0x080c, 0x1027, 0x01b0,
-+ 0x2900, 0xa006, 0x2100, 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c,
-+ 0x00b1, 0x001e, 0x0000, 0x9085, 0x0001, 0x0048, 0x2071, 0x1800,
-+ 0x7093, 0x0000, 0x6014, 0x2048, 0x080c, 0x0fc0, 0x9006, 0x012e,
-+ 0x01de, 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e, 0x0005, 0x0006,
-+ 0x0016, 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff, 0x11b0, 0x080c,
-+ 0x23e2, 0x2099, 0x026c, 0x2001, 0x0014, 0x3518, 0x9312, 0x0108,
-+ 0x1218, 0x23a8, 0x4003, 0x0400, 0x20a8, 0x4003, 0x22a8, 0x8108,
-+ 0x080c, 0x23e2, 0x2099, 0x0260, 0x0ca8, 0x080c, 0x23e2, 0x2061,
-+ 0x19a1, 0x6004, 0x2098, 0x6008, 0x3518, 0x9312, 0x0108, 0x1218,
-+ 0x23a8, 0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c,
-+ 0x23e2, 0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a1, 0x2019, 0x0280,
-+ 0x3300, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0260, 0x6006,
-+ 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce,
-+ 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026,
-+ 0x0036, 0x00c6, 0x81ff, 0x11b8, 0x080c, 0x23fa, 0x20a1, 0x024c,
-+ 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418,
-+ 0x20a8, 0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108, 0x080c, 0x23fa,
-+ 0x20a1, 0x0240, 0x0c98, 0x080c, 0x23fa, 0x2061, 0x19a4, 0x6004,
-+ 0x20a0, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058,
-+ 0x20a8, 0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108, 0x080c, 0x23fa,
-+ 0x20a1, 0x0240, 0x0c98, 0x2061, 0x19a4, 0x2019, 0x0260, 0x3400,
-+ 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0240, 0x6006, 0x8108,
- 0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e,
-- 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
-- 0x00c6, 0x81ff, 0x11b8, 0x080c, 0x23fa, 0x20a1, 0x024c, 0x2001,
-- 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8,
-- 0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108, 0x080c, 0x23fa, 0x20a1,
-- 0x0240, 0x0c98, 0x080c, 0x23fa, 0x2061, 0x19a4, 0x6004, 0x20a0,
-- 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8,
-- 0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108, 0x080c, 0x23fa, 0x20a1,
-- 0x0240, 0x0c98, 0x2061, 0x19a4, 0x2019, 0x0260, 0x3400, 0x931e,
-- 0x0110, 0x6006, 0x0020, 0x2001, 0x0240, 0x6006, 0x8108, 0x2162,
-- 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e,
-- 0x001e, 0x000e, 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04,
-- 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0170, 0x9686, 0x0004,
-- 0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128, 0x9686,
-- 0x0004, 0x0110, 0x9085, 0x0001, 0x006e, 0x00be, 0x0005, 0x00d6,
-- 0x080c, 0xdf63, 0x00de, 0x0005, 0x00d6, 0x080c, 0xdf70, 0x1520,
-- 0x680c, 0x908c, 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115, 0x6216,
-- 0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006, 0x080c, 0xeff4, 0x2009,
-- 0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff, 0x6824,
-- 0x080c, 0x2873, 0x1148, 0x2001, 0x0001, 0x080c, 0xeff4, 0x2110,
-- 0x900e, 0x080c, 0x3299, 0x0018, 0x9085, 0x0001, 0x0008, 0x9006,
-- 0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c, 0xb325, 0x05a8, 0x0016,
-- 0x0026, 0x00c6, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
-- 0x2873, 0x1578, 0x080c, 0x66b9, 0x1560, 0xbe12, 0xbd16, 0x00ce,
-- 0x002e, 0x001e, 0x2b00, 0x6012, 0x080c, 0xee26, 0x11d8, 0x080c,
-- 0x3374, 0x11c0, 0x080c, 0xdecb, 0x0510, 0x2001, 0x0007, 0x080c,
-- 0x666a, 0x2001, 0x0007, 0x080c, 0x6696, 0x6017, 0x0000, 0x6023,
-- 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9547, 0x080c,
-- 0x9ab1, 0x0010, 0x080c, 0xb2d3, 0x9085, 0x0001, 0x00ce, 0x00be,
-- 0x0005, 0x080c, 0xb2d3, 0x00ce, 0x002e, 0x001e, 0x0ca8, 0x080c,
-- 0xb2d3, 0x9006, 0x0c98, 0x2069, 0x026d, 0x6800, 0x9082, 0x0010,
-- 0x1228, 0x6017, 0x0000, 0x9085, 0x0001, 0x0008, 0x9006, 0x0005,
-- 0x6017, 0x0000, 0x2069, 0x026c, 0x6808, 0x9084, 0xff00, 0x9086,
-- 0x0800, 0x1190, 0x6904, 0x9186, 0x0018, 0x0118, 0x9186, 0x0014,
-- 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff, 0x910d, 0x615a, 0x908e,
-- 0x0014, 0x0110, 0x908e, 0x0010, 0x0005, 0x6004, 0x90b2, 0x0053,
-- 0x1a0c, 0x0dc5, 0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2, 0x0040,
-- 0x1a04, 0xe0d2, 0x040a, 0x91b6, 0x0027, 0x0198, 0x9186, 0x0015,
-- 0x0118, 0x9186, 0x0016, 0x1148, 0x080c, 0xd809, 0x0128, 0x6000,
-- 0x9086, 0x0002, 0x0904, 0xbcfd, 0x0005, 0x91b6, 0x0014, 0x190c,
-- 0x0dc5, 0x2001, 0x0007, 0x080c, 0x6696, 0x080c, 0x99a5, 0x080c,
-- 0xb306, 0x080c, 0x9ab1, 0x0005, 0xdffc, 0xdffe, 0xdffc, 0xdffc,
-- 0xdffc, 0xdffe, 0xe00d, 0xe0cb, 0xe051, 0xe0cb, 0xe079, 0xe0cb,
-- 0xe00d, 0xe0cb, 0xe0c3, 0xe0cb, 0xe0c3, 0xe0cb, 0xe0cb, 0xdffc,
-- 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0xdffc,
-- 0xdffc, 0xdffc, 0xdffe, 0xdffc, 0xe0cb, 0xdffc, 0xdffc, 0xe0cb,
-- 0xdffc, 0xe0c8, 0xe0cb, 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0xe0cb,
-- 0xe0cb, 0xdffc, 0xe0cb, 0xe0cb, 0xdffc, 0xe008, 0xdffc, 0xdffc,
-- 0xdffc, 0xdffc, 0xe0c7, 0xe0cb, 0xdffc, 0xdffc, 0xe0cb, 0xe0cb,
-- 0xdffc, 0xdffc, 0xdffc, 0xdffc, 0x080c, 0x0dc5, 0x080c, 0x99a5,
-- 0x080c, 0xd7fb, 0x6003, 0x0002, 0x080c, 0x9ab1, 0x0804, 0xe0d1,
-- 0x9006, 0x080c, 0x6656, 0x0804, 0xe0cb, 0x080c, 0x6a9b, 0x1904,
-- 0xe0cb, 0x9006, 0x080c, 0x6656, 0x6010, 0x2058, 0xb810, 0x9086,
-- 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa,
-- 0x00fe, 0x00b8, 0x6010, 0x2058, 0xb8c0, 0x9005, 0x0904, 0xe0cb,
-- 0x080c, 0x33a5, 0x1904, 0xe0cb, 0x2001, 0x1800, 0x2004, 0x9086,
-- 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa,
-- 0x00fe, 0x2001, 0x0002, 0x080c, 0x666a, 0x080c, 0x99a5, 0x6023,
-- 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9547, 0x080c,
-- 0x9ab1, 0x6110, 0x2158, 0x2009, 0x0001, 0x080c, 0x884b, 0x0804,
-- 0xe0d1, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686,
-- 0x0006, 0x0148, 0x9686, 0x0004, 0x0130, 0x080c, 0x9031, 0x2001,
-- 0x0004, 0x080c, 0x6696, 0x080c, 0xf043, 0x0904, 0xe0cb, 0x080c,
-- 0x99a5, 0x2001, 0x0004, 0x080c, 0x666a, 0x6023, 0x0001, 0x6003,
-- 0x0001, 0x6007, 0x0003, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x0804,
-- 0xe0d1, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036,
-- 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4dfb,
-- 0x004e, 0x003e, 0x2001, 0x0006, 0x080c, 0xe0ef, 0x6610, 0x2658,
-- 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x006e,
-- 0x0180, 0x2001, 0x0006, 0x080c, 0x6696, 0x9284, 0x00ff, 0x908e,
-- 0x0007, 0x0118, 0x908e, 0x0004, 0x1120, 0x2001, 0x0006, 0x080c,
-- 0x666a, 0x080c, 0x6a9b, 0x11f8, 0x2001, 0x1837, 0x2004, 0xd0a4,
-- 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0, 0x00f6,
-- 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0804, 0xe039,
-- 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0449, 0x0020, 0x0018,
-- 0x0010, 0x080c, 0x6696, 0x080c, 0x99a5, 0x080c, 0xb2d3, 0x080c,
-- 0x9ab1, 0x0005, 0x2600, 0x0002, 0xe0e6, 0xe0e6, 0xe0e6, 0xe0e6,
-- 0xe0e6, 0xe0e8, 0xe0e6, 0xe0e8, 0xe0e6, 0xe0e6, 0xe0e8, 0xe0e6,
-- 0xe0e6, 0xe0e6, 0xe0e8, 0xe0e8, 0xe0e8, 0xe0e8, 0x080c, 0x0dc5,
-- 0x080c, 0x99a5, 0x080c, 0xb2d3, 0x080c, 0x9ab1, 0x0005, 0x0016,
-- 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138, 0x080c,
-- 0x666a, 0x9006, 0x080c, 0x6656, 0x080c, 0x3279, 0x00de, 0x00be,
-- 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00, 0x8007,
-- 0x90b2, 0x000c, 0x1a0c, 0x0dc5, 0x91b6, 0x0015, 0x1110, 0x003b,
-- 0x0028, 0x91b6, 0x0016, 0x190c, 0x0dc5, 0x006b, 0x0005, 0xbd9f,
-- 0xbd9f, 0xbd9f, 0xbd9f, 0xe184, 0xbd9f, 0xe16e, 0xe12f, 0xbd9f,
-- 0xbd9f, 0xbd9f, 0xbd9f, 0xbd9f, 0xbd9f, 0xbd9f, 0xbd9f, 0xe184,
-- 0xbd9f, 0xe16e, 0xe175, 0xbd9f, 0xbd9f, 0xbd9f, 0xbd9f, 0x00f6,
-- 0x080c, 0x6a9b, 0x11d8, 0x080c, 0xd7e3, 0x11c0, 0x6010, 0x905d,
-- 0x01a8, 0xb8c0, 0x9005, 0x0190, 0x9006, 0x080c, 0x6656, 0x2001,
-- 0x0002, 0x080c, 0x666a, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-- 0x0002, 0x080c, 0x9547, 0x080c, 0x9ab1, 0x00f0, 0x2011, 0x0263,
-- 0x2204, 0x8211, 0x220c, 0x080c, 0x2873, 0x11b0, 0x080c, 0x6724,
-- 0x0118, 0x080c, 0xb2d3, 0x0080, 0xb810, 0x0006, 0xb814, 0x0006,
-- 0xb8c0, 0x0006, 0x080c, 0x6148, 0x000e, 0xb8c2, 0x000e, 0xb816,
-- 0x000e, 0xb812, 0x080c, 0xb2d3, 0x00fe, 0x0005, 0x6604, 0x96b6,
-- 0x001e, 0x1110, 0x080c, 0xb2d3, 0x0005, 0x080c, 0xc1dc, 0x1148,
-- 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x9547, 0x080c, 0x9ab1,
-- 0x0010, 0x080c, 0xb2d3, 0x0005, 0x0804, 0xb2d3, 0x6004, 0x908a,
-- 0x0053, 0x1a0c, 0x0dc5, 0x080c, 0x99a5, 0x080c, 0xb306, 0x080c,
-- 0x9ab1, 0x0005, 0x9182, 0x0040, 0x0002, 0xe1a9, 0xe1a9, 0xe1a9,
-- 0xe1a9, 0xe1ab, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9,
-- 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9, 0xe1a9,
-- 0xe1a9, 0x080c, 0x0dc5, 0x0096, 0x00b6, 0x00d6, 0x00e6, 0x00f6,
-- 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11a8, 0x6106,
-- 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xe211, 0x080c,
-- 0xefe8, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001, 0x2011,
-- 0x0200, 0x080c, 0x8a50, 0x0020, 0x9026, 0x080c, 0xee6b, 0x0c38,
-- 0x080c, 0x100e, 0x090c, 0x0dc5, 0x6003, 0x0007, 0xa867, 0x010d,
-- 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008, 0xa8e2,
-- 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876, 0xa87f,
-- 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x6e9f, 0x001e,
-- 0x080c, 0xefe8, 0x1904, 0xe271, 0x9486, 0x2000, 0x1130, 0x2019,
-- 0x0017, 0x080c, 0xeba1, 0x0804, 0xe271, 0x9486, 0x0200, 0x1120,
-- 0x080c, 0xeb38, 0x0804, 0xe271, 0x9486, 0x0400, 0x0120, 0x9486,
-- 0x1000, 0x1904, 0xe271, 0x2019, 0x0002, 0x080c, 0xeb53, 0x0804,
-- 0xe271, 0x2069, 0x1a74, 0x6a00, 0xd284, 0x0904, 0xe2db, 0x9284,
-- 0x0300, 0x1904, 0xe2d4, 0x6804, 0x9005, 0x0904, 0xe2bc, 0x2d78,
-- 0x6003, 0x0007, 0x080c, 0x1027, 0x0904, 0xe27d, 0x7800, 0xd08c,
-- 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001, 0x180f,
-- 0x2004, 0xd084, 0x1904, 0xe2df, 0x9006, 0xa802, 0xa867, 0x0116,
-- 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058, 0xb8a0,
-- 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be, 0xb930,
-- 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084, 0x0003,
-- 0x9080, 0xe279, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001, 0x0270,
-- 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080, 0x20e1,
-- 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b, 0x0000,
-- 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae, 0x080c,
-- 0x6e9f, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be, 0x009e,
-- 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810, 0x2004,
-- 0xd084, 0x0120, 0x080c, 0x100e, 0x1904, 0xe226, 0x6017, 0xf100,
-- 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x94ff, 0x080c, 0x9ab1,
-- 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086, 0x1200,
-- 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c, 0xf700,
-- 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043, 0x080c,
-- 0x94ff, 0x080c, 0x9ab1, 0x0828, 0x6868, 0x602e, 0x686c, 0x6032,
-- 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x0804, 0xe271, 0x2001, 0x180e, 0x2004, 0xd0ec,
-- 0x0120, 0x2011, 0x8049, 0x080c, 0x4c44, 0x6017, 0xf300, 0x0010,
-- 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x0804, 0xe271, 0x6017, 0xf500, 0x0c98, 0x6017,
-- 0xf600, 0x0804, 0xe291, 0x6017, 0xf200, 0x0804, 0xe291, 0xa867,
-- 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a, 0x7044,
-- 0x9084, 0x0003, 0x9080, 0xe279, 0x2005, 0xa87e, 0x2928, 0x6010,
-- 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e, 0xb830,
-- 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205, 0x2104,
-- 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210, 0x2214,
-- 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0dc5, 0x8210,
-- 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080,
-- 0x0029, 0x20a0, 0x2011, 0xe35b, 0x2041, 0x0001, 0x223d, 0x9784,
-- 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a, 0x0530,
-- 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260, 0x2098,
-- 0x0c68, 0x2950, 0x080c, 0x1027, 0x0170, 0x2900, 0xb002, 0xa867,
-- 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
-- 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118, 0x080c,
-- 0x1040, 0x0cc8, 0x080c, 0x1040, 0x0804, 0xe27d, 0x2548, 0x8847,
-- 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000, 0x080c,
-- 0xebd4, 0x0804, 0xe271, 0x8010, 0x0004, 0x801a, 0x0006, 0x8018,
-- 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160, 0x6004,
-- 0x908a, 0x0054, 0x1a0c, 0x0dc5, 0x9082, 0x0040, 0x0a0c, 0x0dc5,
-- 0x2008, 0x0804, 0xe3ea, 0x9186, 0x0051, 0x0108, 0x0048, 0x080c,
-- 0xd809, 0x0500, 0x6000, 0x9086, 0x0002, 0x11e0, 0x0804, 0xe433,
-- 0x9186, 0x0027, 0x0190, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014,
-- 0x0160, 0x190c, 0x0dc5, 0x080c, 0xd809, 0x0160, 0x6000, 0x9086,
-- 0x0004, 0x190c, 0x0dc5, 0x0804, 0xe516, 0x6004, 0x9082, 0x0040,
-- 0x2008, 0x001a, 0x080c, 0xb36d, 0x0005, 0xe3b1, 0xe3b3, 0xe3b3,
-- 0xe3da, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1,
-- 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1, 0xe3b1,
-- 0xe3b1, 0x080c, 0x0dc5, 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x0036,
-- 0x0096, 0x6014, 0x904d, 0x01d8, 0x080c, 0xd0d8, 0x01c0, 0x6003,
-- 0x0002, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178,
-- 0x2019, 0x0004, 0x080c, 0xebd4, 0x6017, 0x0000, 0x6018, 0x9005,
-- 0x1120, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x0007, 0x009e,
-- 0x003e, 0x0005, 0x0096, 0x080c, 0x99a5, 0x080c, 0x9ab1, 0x080c,
-- 0xd0d8, 0x0120, 0x6014, 0x2048, 0x080c, 0x1040, 0x080c, 0xb306,
-- 0x009e, 0x0005, 0x0002, 0xe3ff, 0xe416, 0xe401, 0xe42d, 0xe3ff,
-- 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff,
-- 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0xe3ff, 0x080c,
-- 0x0dc5, 0x0096, 0x080c, 0x99a5, 0x6014, 0x2048, 0xa87c, 0xd0b4,
-- 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c, 0xb352, 0x0010,
-- 0x6003, 0x0004, 0x080c, 0x9ab1, 0x009e, 0x0005, 0x080c, 0x99a5,
-- 0x080c, 0xd0d8, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c, 0x009e,
-- 0xd1ec, 0x1138, 0x080c, 0x8a25, 0x080c, 0xb2d3, 0x080c, 0x9ab1,
-- 0x0005, 0x080c, 0xee2f, 0x0db0, 0x0cc8, 0x080c, 0x99a5, 0x2009,
-- 0x0041, 0x0804, 0xe59e, 0x9182, 0x0040, 0x0002, 0xe44a, 0xe44c,
-- 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a,
-- 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44d,
-- 0xe44a, 0xe44a, 0x080c, 0x0dc5, 0x0005, 0x00d6, 0x080c, 0x8a25,
-- 0x00de, 0x080c, 0xee87, 0x080c, 0xb2d3, 0x0005, 0x9182, 0x0040,
-- 0x0002, 0xe46d, 0xe46d, 0xe46d, 0xe46d, 0xe46d, 0xe46d, 0xe46d,
-- 0xe46d, 0xe46d, 0xe46f, 0xe4de, 0xe46d, 0xe46d, 0xe46d, 0xe46d,
-- 0xe4de, 0xe46d, 0xe46d, 0xe46d, 0xe46d, 0x080c, 0x0dc5, 0x2001,
-- 0x0105, 0x2004, 0x9084, 0x1800, 0x01c8, 0x2001, 0x0132, 0x200c,
-- 0x2001, 0x0131, 0x2004, 0x9105, 0x1904, 0xe4de, 0x2009, 0x180c,
-- 0x2104, 0xd0d4, 0x0904, 0xe4de, 0xc0d4, 0x200a, 0x2009, 0x0105,
-- 0x2104, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a, 0x2001, 0x1867,
-- 0x2004, 0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c, 0x9a61, 0x6014,
-- 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c, 0x0003, 0x918e,
-- 0x0002, 0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4, 0x11e0, 0x080c,
-- 0x9bd3, 0x2009, 0x0041, 0x009e, 0x0804, 0xe59e, 0x080c, 0x9bd3,
-- 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8a25, 0x009e, 0x0005,
-- 0x2001, 0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8, 0x2001, 0x011f,
-- 0x2004, 0x603a, 0x0890, 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102,
-- 0xd1cc, 0x0110, 0x080c, 0x2c7b, 0x080c, 0x9bd3, 0x6014, 0x2048,
-- 0xa97c, 0xd1ec, 0x1130, 0x080c, 0x8a25, 0x080c, 0xb2d3, 0x009e,
-- 0x0005, 0x080c, 0xee2f, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c,
-- 0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x9a61, 0x080c, 0x9bd3,
-- 0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-- 0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140,
-- 0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e,
-- 0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xebd4, 0x6018,
-- 0x9005, 0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017,
-- 0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040,
-- 0x0002, 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe52d,
-- 0xe52d, 0xe52f, 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe52d,
-- 0xe52d, 0xe52d, 0xe52d, 0xe52d, 0xe57a, 0x080c, 0x0dc5, 0x6014,
-- 0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900,
-- 0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128,
-- 0x2009, 0x0041, 0x009e, 0x0804, 0xe59e, 0x6003, 0x0007, 0x601b,
-- 0x0000, 0x080c, 0x8a25, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58,
-- 0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030,
-- 0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8,
-- 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009,
-- 0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003,
-- 0x0006, 0x00e9, 0x080c, 0x8a27, 0x009e, 0x0005, 0x6003, 0x0002,
-- 0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x1608, 0x1904,
-- 0xe52f, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e,
-- 0x9105, 0x1120, 0x080c, 0x1608, 0x1904, 0xe52f, 0x0005, 0xd2fc,
-- 0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009,
-- 0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040,
-- 0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c,
-- 0x0dc5, 0x6024, 0xd0dc, 0x090c, 0x0dc5, 0x0005, 0xe5c2, 0xe5ce,
-- 0xe5da, 0xe5e6, 0xe5c2, 0xe5c2, 0xe5c2, 0xe5c2, 0xe5c9, 0xe5c4,
-- 0xe5c4, 0xe5c2, 0xe5c2, 0xe5c2, 0xe5c2, 0xe5c4, 0xe5c2, 0xe5c4,
-- 0xe5c2, 0xe5c9, 0x080c, 0x0dc5, 0x6024, 0xd0dc, 0x090c, 0x0dc5,
-- 0x0005, 0x6014, 0x9005, 0x190c, 0x0dc5, 0x0005, 0x6003, 0x0001,
-- 0x6106, 0x080c, 0x94ff, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ab1,
-- 0x012e, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x94ff, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x9ab1, 0x012e, 0x0005, 0x6003, 0x0003,
-- 0x6106, 0x2c10, 0x080c, 0x1be0, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x9564, 0x080c, 0x9bd3, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
-- 0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e,
-- 0x0005, 0xe615, 0xe617, 0xe629, 0xe643, 0xe615, 0xe615, 0xe615,
-- 0xe615, 0xe615, 0xe615, 0xe615, 0xe615, 0xe615, 0xe615, 0xe615,
-- 0xe615, 0xe615, 0xe615, 0xe615, 0xe615, 0x080c, 0x0dc5, 0x6014,
-- 0x2048, 0xa87c, 0xd0fc, 0x01f8, 0x909c, 0x0003, 0x939e, 0x0003,
-- 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c, 0x94ff, 0x080c, 0x9ab1,
-- 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c, 0x0003,
-- 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x080c, 0x94ff,
-- 0x080c, 0x9ab1, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019, 0x0004,
-- 0x080c, 0xebd4, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98,
-- 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003, 0x6106,
-- 0x2c10, 0x080c, 0x1be0, 0x080c, 0x9564, 0x080c, 0x9bd3, 0x0005,
-- 0x080c, 0x99a5, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c,
-- 0xef85, 0x0036, 0x2019, 0x0029, 0x080c, 0xebd4, 0x003e, 0x009e,
-- 0x080c, 0xb306, 0x080c, 0x9ab1, 0x0005, 0x080c, 0x9a61, 0x6114,
-- 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xef85, 0x0036, 0x2019,
-- 0x0029, 0x080c, 0xebd4, 0x003e, 0x009e, 0x080c, 0xb306, 0x080c,
-- 0x9bd3, 0x0005, 0x9182, 0x0085, 0x0002, 0xe694, 0xe692, 0xe692,
-- 0xe6a0, 0xe692, 0xe692, 0xe692, 0xe692, 0xe692, 0xe692, 0xe692,
-- 0xe692, 0xe692, 0x080c, 0x0dc5, 0x6003, 0x000b, 0x6106, 0x080c,
-- 0x94ff, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ab1, 0x012e, 0x0005,
-- 0x0026, 0x00e6, 0x080c, 0xee26, 0x0118, 0x080c, 0xb2d3, 0x0450,
-- 0x2071, 0x0260, 0x7224, 0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4,
-- 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011,
-- 0x014e, 0x080c, 0xb5f5, 0x7220, 0x080c, 0xea29, 0x0118, 0x6007,
-- 0x0086, 0x0040, 0x6007, 0x0087, 0x7224, 0x9296, 0xffff, 0x1110,
-- 0x6007, 0x0086, 0x6003, 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1,
-- 0x080c, 0x9bd3, 0x00ee, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160,
-- 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5, 0x908a, 0x0092, 0x1a0c,
-- 0x0dc5, 0x9082, 0x0085, 0x00a2, 0x9186, 0x0027, 0x0130, 0x9186,
-- 0x0014, 0x0118, 0x080c, 0xb36d, 0x0050, 0x2001, 0x0007, 0x080c,
-- 0x6696, 0x080c, 0x99a5, 0x080c, 0xb306, 0x080c, 0x9ab1, 0x0005,
-- 0xe705, 0xe707, 0xe707, 0xe705, 0xe705, 0xe705, 0xe705, 0xe705,
-- 0xe705, 0xe705, 0xe705, 0xe705, 0xe705, 0x080c, 0x0dc5, 0x080c,
-- 0x99a5, 0x080c, 0xb306, 0x080c, 0x9ab1, 0x0005, 0x9182, 0x0085,
-- 0x0a0c, 0x0dc5, 0x9182, 0x0092, 0x1a0c, 0x0dc5, 0x9182, 0x0085,
-- 0x0002, 0xe726, 0xe726, 0xe726, 0xe728, 0xe726, 0xe726, 0xe726,
-- 0xe726, 0xe726, 0xe726, 0xe726, 0xe726, 0xe726, 0x080c, 0x0dc5,
-- 0x0005, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130, 0x9186,
-- 0x0027, 0x0118, 0x080c, 0xb36d, 0x0030, 0x080c, 0x99a5, 0x080c,
-- 0xb306, 0x080c, 0x9ab1, 0x0005, 0x0036, 0x080c, 0xee87, 0x6043,
-- 0x0000, 0x2019, 0x000b, 0x0011, 0x003e, 0x0005, 0x6010, 0x0006,
-- 0x0059, 0x000e, 0x6012, 0x6023, 0x0006, 0x6003, 0x0007, 0x601b,
-- 0x0000, 0x6043, 0x0000, 0x0005, 0x0126, 0x0036, 0x2091, 0x8000,
-- 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xaafb, 0x009e, 0x008e,
-- 0x1550, 0x0076, 0x2c38, 0x080c, 0xaba6, 0x007e, 0x1520, 0x6000,
-- 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0, 0x0096,
-- 0x601c, 0xd084, 0x0140, 0x080c, 0xee87, 0x080c, 0xd7fb, 0x080c,
-- 0x1a8e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xd0d8, 0x0110,
-- 0x080c, 0xebd4, 0x009e, 0x6017, 0x0000, 0x080c, 0xee87, 0x6023,
-- 0x0007, 0x080c, 0xd7fb, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6,
-- 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c,
-- 0x2873, 0x1904, 0xe7e4, 0x0016, 0x00c6, 0x080c, 0x6724, 0x1904,
-- 0xe7e2, 0x001e, 0x00c6, 0x080c, 0xd7e3, 0x1130, 0xb8c0, 0x9005,
-- 0x0118, 0x080c, 0x33a5, 0x0148, 0x2b10, 0x2160, 0x6010, 0x0006,
-- 0x6212, 0x080c, 0xd7ea, 0x000e, 0x6012, 0x00ce, 0x002e, 0x0026,
-- 0x0016, 0x2019, 0x0029, 0x080c, 0xac6c, 0x080c, 0x96a4, 0x0076,
-- 0x903e, 0x080c, 0x9577, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c,
-- 0xe91c, 0x007e, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217, 0x9286,
-- 0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c, 0x330e,
-- 0x002e, 0xbcc0, 0x001e, 0x080c, 0x6148, 0xbe12, 0xbd16, 0xbcc2,
-- 0x9006, 0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce,
-- 0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1824,
-- 0x2104, 0x9086, 0x0074, 0x1904, 0xe843, 0x2069, 0x0260, 0x6944,
-- 0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xe840,
-- 0x2001, 0x197c, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb8c0,
-- 0x9005, 0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001,
-- 0x0648, 0x080c, 0xefed, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009,
-- 0x0205, 0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182,
-- 0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001,
-- 0x0288, 0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100,
-- 0x00a0, 0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070, 0x6017,
-- 0x0700, 0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028,
-- 0x6017, 0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008,
-- 0x9006, 0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6,
-- 0x0026, 0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff,
-- 0x9286, 0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00,
-- 0x8217, 0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c,
-- 0x6733, 0x0804, 0xe8ab, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096,
-- 0x2b48, 0x2019, 0x000a, 0x080c, 0xc379, 0x009e, 0x15a8, 0x2011,
-- 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c,
-- 0xc379, 0x009e, 0x1548, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006,
-- 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c,
-- 0xec31, 0xb800, 0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c, 0x96a4,
-- 0x0076, 0x2039, 0x0000, 0x080c, 0x9577, 0x2c08, 0x080c, 0xe91c,
-- 0x007e, 0x2001, 0x0007, 0x080c, 0x6696, 0x2001, 0x0007, 0x080c,
-- 0x666a, 0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be,
-- 0x00ce, 0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800,
-- 0x0118, 0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6,
-- 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930,
-- 0x7834, 0x080c, 0x2873, 0x11d0, 0x080c, 0x6724, 0x11b8, 0x2011,
-- 0x0270, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c,
-- 0xc379, 0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096,
-- 0x2b48, 0x2019, 0x0006, 0x080c, 0xc379, 0x009e, 0x015e, 0x003e,
-- 0x002e, 0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016,
-- 0x0026, 0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-- 0x080c, 0x2873, 0x11d0, 0x080c, 0x6724, 0x11b8, 0x2011, 0x0276,
-- 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xc379,
-- 0x009e, 0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48,
-- 0x2019, 0x0006, 0x080c, 0xc379, 0x009e, 0x015e, 0x003e, 0x002e,
-- 0x001e, 0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076,
-- 0x0066, 0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x2740,
-- 0x2029, 0x19f1, 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061, 0x1cd0,
-- 0x2071, 0x1800, 0x7654, 0x7074, 0x81ff, 0x0150, 0x0006, 0x9186,
-- 0x1ab7, 0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xe9ba, 0x0018,
-- 0x9606, 0x0904, 0xe9ba, 0x080c, 0x8cf7, 0x0904, 0xe9b1, 0x2100,
-- 0x9c06, 0x0904, 0xe9b1, 0x6720, 0x9786, 0x0007, 0x0904, 0xe9b1,
-- 0x080c, 0xec72, 0x1904, 0xe9b1, 0x080c, 0xf00b, 0x0904, 0xe9b1,
-- 0x080c, 0xec62, 0x0904, 0xe9b1, 0x6720, 0x9786, 0x0001, 0x1148,
-- 0x080c, 0x33a5, 0x0904, 0xe9f9, 0x6004, 0x9086, 0x0000, 0x1904,
-- 0xe9f9, 0x9786, 0x0004, 0x0904, 0xe9f9, 0x2500, 0x9c06, 0x0904,
-- 0xe9b1, 0x2400, 0x9c06, 0x05e8, 0x88ff, 0x0118, 0x6054, 0x9906,
-- 0x15c0, 0x0096, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c,
-- 0x1a8e, 0x001e, 0x9786, 0x000a, 0x0148, 0x080c, 0xd2e0, 0x1130,
-- 0x080c, 0xbcb6, 0x009e, 0x080c, 0xb306, 0x0418, 0x6014, 0x2048,
-- 0x080c, 0xd0d8, 0x01d8, 0x9786, 0x0003, 0x1570, 0xa867, 0x0103,
-- 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fc0,
-- 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xef85, 0x0016, 0x080c,
-- 0xd3ce, 0x080c, 0x6e92, 0x001e, 0x080c, 0xd2c3, 0x009e, 0x080c,
-- 0xb306, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210,
-- 0x0804, 0xe930, 0x012e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e,
-- 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1150, 0x9386,
-- 0x0005, 0x0128, 0x080c, 0xef85, 0x080c, 0xebd4, 0x08f8, 0x009e,
-- 0x0c00, 0x9786, 0x0009, 0x11f8, 0x6000, 0x9086, 0x0004, 0x01c0,
-- 0x6000, 0x9086, 0x0003, 0x11a0, 0x080c, 0x9a61, 0x0096, 0x6114,
-- 0x2148, 0x080c, 0xd0d8, 0x0118, 0x6010, 0x080c, 0x6e9f, 0x009e,
-- 0x00c6, 0x080c, 0xb2d3, 0x00ce, 0x0036, 0x080c, 0x9bd3, 0x003e,
-- 0x009e, 0x0804, 0xe9b1, 0x9786, 0x000a, 0x0904, 0xe9a1, 0x0804,
-- 0xe996, 0x81ff, 0x0904, 0xe9b1, 0x9180, 0x0001, 0x2004, 0x9086,
-- 0x0018, 0x0138, 0x9180, 0x0001, 0x2004, 0x9086, 0x002d, 0x1904,
-- 0xe9b1, 0x6000, 0x9086, 0x0002, 0x1904, 0xe9b1, 0x080c, 0xd2cf,
-- 0x0138, 0x080c, 0xd2e0, 0x1904, 0xe9b1, 0x080c, 0xbcb6, 0x0038,
-- 0x080c, 0x3279, 0x080c, 0xd2e0, 0x1110, 0x080c, 0xbcb6, 0x080c,
-- 0xb306, 0x0804, 0xe9b1, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-- 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006, 0x080c,
-- 0xebfb, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f, 0x001b, 0x00ee,
-- 0x00ce, 0x0005, 0xea48, 0xea48, 0xea48, 0xea48, 0xea48, 0xea48,
-- 0xea4a, 0xea48, 0xea48, 0xea48, 0xea73, 0xb306, 0xb306, 0xea48,
-- 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010, 0x00b6, 0x2058,
-- 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020, 0x080c, 0xec31, 0x001e,
-- 0x004e, 0x2019, 0x0002, 0x080c, 0xe754, 0x003e, 0x9085, 0x0001,
-- 0x0005, 0x0096, 0x080c, 0xd0d8, 0x0140, 0x6014, 0x904d, 0x080c,
-- 0xccf3, 0x687b, 0x0005, 0x080c, 0x6e9f, 0x009e, 0x080c, 0xb306,
-- 0x9085, 0x0001, 0x0005, 0x0019, 0x9085, 0x0001, 0x0005, 0x6000,
-- 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0xea8e, 0xea8e,
-- 0xeaa5, 0xea95, 0xeab4, 0xea8e, 0xea8e, 0xea90, 0xea8e, 0xea8e,
-- 0xea8e, 0xea8e, 0xea8e, 0xea8e, 0xea8e, 0xea8e, 0x080c, 0x0dc5,
-- 0x080c, 0xb306, 0x9085, 0x0001, 0x0005, 0x0036, 0x00e6, 0x2071,
-- 0x19e8, 0x703c, 0x9c06, 0x1128, 0x2019, 0x0001, 0x080c, 0xaa49,
-- 0x0010, 0x080c, 0xac2b, 0x00ee, 0x003e, 0x0096, 0x00d6, 0x6014,
-- 0x2048, 0xa87b, 0x0005, 0x080c, 0x6e9f, 0x080c, 0xb306, 0x00de,
-- 0x009e, 0x9085, 0x0001, 0x0005, 0x601c, 0xd084, 0x190c, 0x1a8e,
-- 0x0c60, 0x2001, 0x0001, 0x080c, 0x6656, 0x0156, 0x0016, 0x0026,
-- 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c,
-- 0xc365, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0005, 0x00f6,
-- 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x00b6, 0x0126, 0x2091,
-- 0x8000, 0x2740, 0x2061, 0x1cd0, 0x2079, 0x0001, 0x8fff, 0x0904,
-- 0xeb2b, 0x2071, 0x1800, 0x7654, 0x7074, 0x8001, 0x9602, 0x1a04,
-- 0xeb2b, 0x88ff, 0x0120, 0x2800, 0x9c06, 0x15a0, 0x2078, 0x080c,
-- 0xec62, 0x0580, 0x2400, 0x9c06, 0x0568, 0x6720, 0x9786, 0x0006,
-- 0x1548, 0x9786, 0x0007, 0x0530, 0x88ff, 0x1150, 0xd58c, 0x1118,
-- 0x6010, 0x9b06, 0x11f8, 0xd584, 0x0118, 0x6054, 0x9106, 0x11d0,
-- 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xee87, 0x080c, 0xd7fb,
-- 0x080c, 0x1a8e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xd0d8,
-- 0x0120, 0x0046, 0x080c, 0xebd4, 0x004e, 0x009e, 0x080c, 0xb306,
-- 0x88ff, 0x1198, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
-- 0x1210, 0x0804, 0xeade, 0x9006, 0x012e, 0x00be, 0x006e, 0x007e,
-- 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001, 0x0ca0,
-- 0x00b6, 0x0076, 0x0056, 0x0086, 0x9046, 0x2029, 0x0001, 0x2c20,
-- 0x2019, 0x0002, 0x6210, 0x2258, 0x0096, 0x904e, 0x080c, 0xaafb,
-- 0x009e, 0x008e, 0x903e, 0x080c, 0xaba6, 0x080c, 0xeacf, 0x005e,
-- 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6,
-- 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016, 0x0036,
-- 0x080c, 0x6724, 0x1180, 0x0056, 0x0086, 0x9046, 0x2508, 0x2029,
-- 0x0001, 0x0096, 0x904e, 0x080c, 0xaafb, 0x009e, 0x008e, 0x903e,
-- 0x080c, 0xaba6, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04, 0xeb5e,
-- 0x0036, 0x2508, 0x2029, 0x0003, 0x080c, 0xeacf, 0x003e, 0x015e,
-- 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x00b6, 0x0076,
-- 0x0056, 0x6210, 0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019,
-- 0x0048, 0x0096, 0x904e, 0x080c, 0xaafb, 0x009e, 0x008e, 0x903e,
-- 0x080c, 0xaba6, 0x2c20, 0x080c, 0xeacf, 0x005e, 0x007e, 0x00be,
-- 0x0005, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20,
-- 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x6724, 0x1190,
-- 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c, 0xee6b,
-- 0x004e, 0x0096, 0x904e, 0x080c, 0xaafb, 0x009e, 0x008e, 0x903e,
-- 0x080c, 0xaba6, 0x003e, 0x001e, 0x8108, 0x1f04, 0xebab, 0x0036,
-- 0x2029, 0x0002, 0x080c, 0xeacf, 0x003e, 0x015e, 0x00ce, 0x007e,
-- 0x005e, 0x004e, 0x00be, 0x0005, 0x0016, 0x00f6, 0x080c, 0xd0d6,
-- 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180, 0xa800,
-- 0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x6e9f, 0x2f48,
-- 0x0cb0, 0xab82, 0x080c, 0x6e9f, 0x00fe, 0x001e, 0x0005, 0xa800,
-- 0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x6e9f, 0x2f48, 0x0cb8,
-- 0x080c, 0x6e9f, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061, 0x1cd0,
-- 0x9005, 0x1138, 0x2071, 0x1800, 0x7454, 0x7074, 0x8001, 0x9402,
-- 0x12f8, 0x2100, 0x9c06, 0x0188, 0x6000, 0x9086, 0x0000, 0x0168,
-- 0x6008, 0x9206, 0x1150, 0x6320, 0x9386, 0x0009, 0x01b0, 0x6010,
-- 0x91a0, 0x0004, 0x2424, 0x9406, 0x0140, 0x9ce0, 0x0018, 0x2001,
-- 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c20, 0x9085, 0x0001, 0x0008,
-- 0x9006, 0x003e, 0x004e, 0x00ee, 0x0005, 0x631c, 0xd3c4, 0x1d68,
-- 0x0c30, 0x0096, 0x0006, 0x080c, 0x100e, 0x000e, 0x090c, 0x0dc5,
-- 0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010, 0x080c, 0xd0c6,
-- 0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0015, 0x2004, 0x002e,
-- 0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff, 0xa986, 0xac76,
-- 0xa87f, 0x0000, 0x2001, 0x198e, 0x2004, 0xa882, 0x9006, 0xa802,
-- 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e9f, 0x012e,
-- 0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158, 0x9786, 0x0001,
-- 0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009, 0x0110, 0x9085,
-- 0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138, 0x00b6, 0x2058,
-- 0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085, 0x0001, 0x0cd8,
-- 0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007, 0x6134, 0x918c,
-- 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-- 0x0005, 0x2001, 0x1987, 0x2004, 0x601a, 0x080c, 0x94ff, 0x080c,
-- 0x9ab1, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024, 0xd0e4,
-- 0x0158, 0xd0cc, 0x0118, 0x080c, 0xd412, 0x0030, 0x080c, 0xee87,
-- 0x080c, 0x8a25, 0x080c, 0xb2d3, 0x0005, 0x9280, 0x0008, 0x2004,
-- 0x9084, 0x000f, 0x0002, 0xecc1, 0xecc1, 0xecc1, 0xecc3, 0xecc1,
-- 0xecc3, 0xecc3, 0xecc1, 0xecc3, 0xecc1, 0xecc1, 0xecc1, 0xecc1,
-- 0xecc1, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280, 0x0008,
-- 0x2004, 0x9084, 0x000f, 0x0002, 0xecda, 0xecda, 0xecda, 0xecda,
-- 0xecda, 0xecda, 0xece7, 0xecda, 0xecda, 0xecda, 0xecda, 0xecda,
-- 0xecda, 0xecda, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00,
-- 0x6003, 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x0005, 0x0096,
-- 0x00c6, 0x2260, 0x080c, 0xee87, 0x6043, 0x0000, 0x6024, 0xc0f4,
-- 0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6, 0x2268, 0x9186,
-- 0x0007, 0x1904, 0xed40, 0x6814, 0x9005, 0x0138, 0x2048, 0xa87c,
-- 0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007, 0x003a, 0x6003,
-- 0x0001, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x00c6, 0x2d60, 0x6100,
-- 0x9186, 0x0002, 0x1904, 0xedb0, 0x6014, 0x9005, 0x1138, 0x6000,
-- 0x9086, 0x0007, 0x190c, 0x0dc5, 0x0804, 0xedb0, 0x2048, 0x080c,
-- 0xd0d8, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900,
-- 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x1168, 0xa87c,
-- 0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882, 0x2009, 0x0043,
-- 0x080c, 0xe59e, 0x0804, 0xedb0, 0x2009, 0x0041, 0x0804, 0xedaa,
-- 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc, 0x1120,
-- 0x00de, 0x009e, 0x0804, 0xecda, 0xd0b4, 0x0128, 0xd0fc, 0x090c,
-- 0x0dc5, 0x0804, 0xecfb, 0x6007, 0x003a, 0x6003, 0x0001, 0x080c,
-- 0x94ff, 0x080c, 0x9ab1, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002,
-- 0x0120, 0x9186, 0x0004, 0x1904, 0xedb0, 0x6814, 0x2048, 0xa97c,
-- 0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc, 0xa982, 0x00f6,
-- 0x2c78, 0x080c, 0x1768, 0x00fe, 0x2009, 0x0042, 0x0498, 0x0036,
-- 0x080c, 0x100e, 0x090c, 0x0dc5, 0xa867, 0x010d, 0x9006, 0xa802,
-- 0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887, 0x0045, 0x2c00, 0xa892,
-- 0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6010, 0x00b6,
-- 0x2058, 0xb8a0, 0x00be, 0x2004, 0x6354, 0xab7a, 0xa876, 0x9006,
-- 0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001, 0x080c, 0x6e9f,
-- 0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xe746, 0x2d00, 0x600a,
-- 0x003e, 0x0038, 0x6043, 0x0000, 0x6003, 0x0007, 0x080c, 0xe59e,
-- 0x00ce, 0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
-- 0x9082, 0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178, 0x080c,
-- 0x99a5, 0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004, 0x080c,
-- 0xebd4, 0x009e, 0x003e, 0x080c, 0x9ab1, 0x0005, 0x9186, 0x0014,
-- 0x0d70, 0x080c, 0xb36d, 0x0005, 0xede3, 0xede1, 0xede1, 0xede1,
-- 0xede1, 0xede1, 0xede3, 0xede1, 0xede1, 0xede1, 0xede1, 0xede1,
-- 0xede1, 0x080c, 0x0dc5, 0x080c, 0x99a5, 0x6003, 0x000c, 0x080c,
-- 0x9ab1, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
-- 0x001a, 0x080c, 0xb36d, 0x0005, 0xee01, 0xee01, 0xee01, 0xee01,
-- 0xee03, 0xee23, 0xee01, 0xee01, 0xee01, 0xee01, 0xee01, 0xee01,
-- 0xee01, 0x080c, 0x0dc5, 0x00d6, 0x2c68, 0x080c, 0xb27d, 0x01b0,
-- 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e, 0x210c, 0x613a,
-- 0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff, 0x6910, 0x6112,
-- 0x6023, 0x0004, 0x080c, 0x94ff, 0x080c, 0x9ab1, 0x2d60, 0x080c,
-- 0xb2d3, 0x00de, 0x0005, 0x080c, 0xb2d3, 0x0005, 0x00e6, 0x6010,
-- 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee, 0x0005, 0x2009,
-- 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002, 0x6024, 0xc0e5,
-- 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988, 0x2004, 0x6042, 0x2009,
-- 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009, 0x1867, 0x210c,
-- 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006, 0x00d8, 0x2001,
-- 0x1988, 0x200c, 0x2001, 0x1986, 0x2004, 0x9100, 0x9080, 0x000a,
-- 0x6042, 0x6010, 0x00b6, 0x2058, 0xb8bc, 0x00be, 0x0008, 0x2104,
-- 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a, 0x600f, 0x0000,
-- 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6, 0x6154, 0xb8bc,
-- 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x6054, 0x9106, 0x1138,
-- 0x600c, 0x2072, 0x080c, 0x8a25, 0x080c, 0xb2d3, 0x0010, 0x9cf0,
-- 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6,
-- 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x906d, 0x0130, 0x9c06, 0x0110,
-- 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de, 0x0005, 0x0026,
-- 0x0036, 0x0156, 0x2011, 0x182c, 0x2204, 0x9084, 0x00ff, 0x2019,
-- 0x026e, 0x2334, 0x96b4, 0x00ff, 0x9636, 0x1508, 0x8318, 0x2334,
-- 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011, 0x0270, 0x20a9,
-- 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xc379,
-- 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004, 0x6010, 0x0096,
-- 0x2048, 0x2019, 0x0006, 0x080c, 0xc379, 0x009e, 0x1100, 0x015e,
-- 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c, 0x60c1,
-- 0x080c, 0x3000, 0x00ee, 0x0005, 0x0096, 0x0026, 0x080c, 0x100e,
-- 0x090c, 0x0dc5, 0xa85c, 0x9080, 0x001a, 0x20a0, 0x20a9, 0x000c,
-- 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046, 0x1118, 0xa867,
-- 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041, 0x0110, 0xa87b,
-- 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294, 0xff00, 0x8007,
-- 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038, 0x9084, 0x00ff,
-- 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c, 0x9294, 0x00ff,
-- 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244, 0x9294, 0xff00,
-- 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2, 0x9186, 0x0046,
-- 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a, 0x2204, 0x8007,
-- 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210, 0x2204, 0x8007,
-- 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210, 0x9186, 0x0046,
-- 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6, 0x8210, 0x2204,
-- 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204,
-- 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013, 0x0001, 0x00b0,
-- 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210, 0x2204, 0x8007,
-- 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011, 0x0260, 0x2204,
-- 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x9186, 0x0046,
-- 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a, 0x0146, 0x01d6,
-- 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860, 0x20e8, 0xa85c,
-- 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004, 0x8210, 0x8319,
-- 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205, 0x2013, 0x0000,
-- 0x002e, 0x080c, 0x6e9f, 0x009e, 0x0005, 0x00e6, 0x6010, 0x00b6,
-- 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011, 0x00ee, 0x0005,
-- 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6, 0x00c6, 0x0076,
-- 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126, 0x2091, 0x8000,
-- 0x2029, 0x19f1, 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061, 0x1cd0,
-- 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578, 0x6720, 0x9786,
-- 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500, 0x9c06, 0x01e8,
-- 0x2400, 0x9c06, 0x01d0, 0x080c, 0xec62, 0x01b8, 0x080c, 0xec72,
-- 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1a8e,
-- 0x001e, 0x080c, 0xd2cf, 0x1110, 0x080c, 0x3279, 0x080c, 0xd2e0,
-- 0x1110, 0x080c, 0xbcb6, 0x080c, 0xb306, 0x9ce0, 0x0018, 0x2001,
-- 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e, 0x001e, 0x002e,
-- 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x0005,
-- 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006, 0x2001, 0x1837,
-- 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036, 0x0046, 0x080c,
-- 0xd7e3, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128, 0x6010, 0x00b6,
-- 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c, 0x4dfb, 0x004e,
-- 0x003e, 0x000e, 0x0005, 0x6004, 0x9086, 0x0001, 0x1128, 0x080c,
-- 0xac6c, 0x080c, 0xb306, 0x9006, 0x0005, 0x00e6, 0x00c6, 0x00b6,
-- 0x0046, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7454, 0x7074, 0x8001,
-- 0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086, 0x0000,
-- 0x0148, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1120, 0x6004, 0x9086,
-- 0x0002, 0x0140, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
-- 0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x004e, 0x00be,
-- 0x00ce, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0160,
-- 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0138, 0x2001, 0x1848, 0x2004,
-- 0xd0a4, 0x1118, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0126,
-- 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071, 0x1840, 0xd5a4,
-- 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118, 0x7000, 0x8000,
-- 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007, 0x908e, 0x0003,
-- 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x2071,
-- 0xfff6, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0126,
-- 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xffee, 0x0021, 0x00ee,
-- 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077, 0x1220, 0x8e70,
-- 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071, 0xffec, 0x0c99,
-- 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff0, 0x0c69, 0x00ee, 0x0005,
-- 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1840, 0x7014,
-- 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0003, 0x000b,
-- 0x07d2, 0x0000, 0xc000, 0x0001, 0x8064, 0x0008, 0x0010, 0x0000,
-- 0x8066, 0x0000, 0x0101, 0x0008, 0x4407, 0x0003, 0x8060, 0x0000,
-- 0x0400, 0x0000, 0x580d, 0x000b, 0x79c0, 0x0003, 0x5106, 0x0003,
-- 0x4c0a, 0x0003, 0xbac0, 0x0009, 0x008a, 0x0000, 0x0c0a, 0x000b,
-- 0x15fe, 0x0008, 0x340a, 0x0003, 0xc4c0, 0x0009, 0x7000, 0x0000,
-- 0xffa0, 0x0001, 0x2000, 0x0000, 0x1680, 0x000b, 0x808c, 0x0008,
-- 0x0001, 0x0000, 0x0000, 0x0007, 0x4028, 0x0000, 0x4047, 0x000a,
-- 0x808c, 0x0008, 0x0002, 0x0000, 0x0822, 0x0003, 0x4022, 0x0000,
-- 0x0028, 0x000b, 0x4122, 0x0008, 0x94c0, 0x0009, 0xff00, 0x0008,
-- 0xffe0, 0x0009, 0x0500, 0x0008, 0x0aab, 0x0003, 0x4447, 0x0002,
-- 0x0ea8, 0x000b, 0x0bfe, 0x0008, 0x11a0, 0x0001, 0x1286, 0x0003,
-- 0x0ca0, 0x0001, 0x1286, 0x0003, 0x9180, 0x0001, 0x0004, 0x0000,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000,
-- 0x0009, 0x0008, 0x4436, 0x000b, 0x808c, 0x0008, 0x0000, 0x0008,
-- 0x0060, 0x0008, 0x8062, 0x0008, 0x0004, 0x0000, 0x8066, 0x0000,
-- 0x0411, 0x0000, 0x443e, 0x0003, 0x03fe, 0x0000, 0x43e0, 0x0001,
-- 0x0e83, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008, 0x02e0, 0x0001,
-- 0x0e83, 0x000b, 0x9180, 0x0001, 0x0005, 0x0008, 0x8060, 0x0000,
-- 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0019, 0x0000,
-- 0x444d, 0x000b, 0x0240, 0x0002, 0x0a80, 0x0003, 0x00fe, 0x0000,
-- 0x3283, 0x000b, 0x0248, 0x000a, 0x085c, 0x0003, 0x9180, 0x0001,
-- 0x0006, 0x0008, 0x7f62, 0x0008, 0x8002, 0x0008, 0x0003, 0x0008,
-- 0x8066, 0x0000, 0x020a, 0x0000, 0x445b, 0x0003, 0x112a, 0x0000,
-- 0x002e, 0x0008, 0x022c, 0x0008, 0x3a44, 0x0002, 0x0c0a, 0x000b,
-- 0x808c, 0x0008, 0x0002, 0x0000, 0x1760, 0x0008, 0x8062, 0x0008,
-- 0x000f, 0x0008, 0x8066, 0x0000, 0x0011, 0x0008, 0x4468, 0x0003,
-- 0x01fe, 0x0008, 0x42e0, 0x0009, 0x0e74, 0x0003, 0x00fe, 0x0000,
-- 0x43e0, 0x0001, 0x0e74, 0x0003, 0x1734, 0x0000, 0x1530, 0x0000,
-- 0x1632, 0x0008, 0x0d2a, 0x0008, 0x9880, 0x0001, 0x0010, 0x0000,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000,
-- 0x1e0a, 0x0008, 0x447a, 0x0003, 0x808a, 0x0008, 0x0003, 0x0008,
-- 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002, 0x0000, 0x5880, 0x000b,
-- 0x8066, 0x0000, 0x3679, 0x0000, 0x4483, 0x0003, 0x5884, 0x0003,
-- 0x3efe, 0x0008, 0x7f4f, 0x0002, 0x088a, 0x000b, 0x0d00, 0x0000,
-- 0x0092, 0x000c, 0x8054, 0x0008, 0x0011, 0x0008, 0x8074, 0x0000,
-- 0x1010, 0x0008, 0x1efe, 0x0000, 0x300a, 0x000b, 0x00e0, 0x000c,
-- 0x000a, 0x000b, 0x00fe, 0x0000, 0x349a, 0x0003, 0x1a60, 0x0000,
-- 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0231, 0x0008,
-- 0x4499, 0x000b, 0x03fe, 0x0000, 0x04d0, 0x0001, 0x0cd4, 0x000b,
-- 0x82c0, 0x0001, 0x1f00, 0x0000, 0xffa0, 0x0001, 0x0400, 0x0000,
-- 0x08b2, 0x0003, 0x14dc, 0x0003, 0x01fe, 0x0008, 0x0580, 0x0009,
-- 0x7f06, 0x0000, 0x8690, 0x0009, 0x0000, 0x0008, 0x7f0c, 0x0000,
-- 0x02fe, 0x0008, 0xffc0, 0x0001, 0x00ff, 0x0008, 0x0680, 0x0009,
-- 0x10b2, 0x0003, 0x7f08, 0x0008, 0x84c0, 0x0001, 0xff00, 0x0008,
-- 0x08d4, 0x0003, 0xb9c0, 0x0009, 0x0030, 0x0008, 0x0cc3, 0x000b,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x80fe, 0x0008, 0x1a0a, 0x0009,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x0409, 0x0000, 0x44bc, 0x0003,
-- 0x80fe, 0x0008, 0x1a09, 0x0009, 0x7f62, 0x0008, 0x8066, 0x0000,
-- 0x040a, 0x0000, 0x44c2, 0x0003, 0x00fe, 0x0000, 0x34ca, 0x0003,
-- 0x8072, 0x0000, 0x1010, 0x0008, 0x3944, 0x0002, 0x08c5, 0x0003,
-- 0x00ce, 0x0003, 0x8072, 0x0000, 0x2020, 0x0008, 0x3945, 0x000a,
-- 0x08ca, 0x0003, 0x3946, 0x000a, 0x0cdb, 0x000b, 0x0000, 0x0007,
-- 0x3943, 0x000a, 0x08db, 0x0003, 0x00ce, 0x0003, 0x00fe, 0x0000,
-- 0x34d9, 0x000b, 0x8072, 0x0000, 0x1000, 0x0000, 0x00db, 0x000b,
-- 0x8072, 0x0000, 0x2000, 0x0000, 0x4000, 0x000f, 0x86c0, 0x0009,
-- 0xfc00, 0x0008, 0x08d4, 0x0003, 0x00b2, 0x000b, 0x1c60, 0x0000,
-- 0x1b62, 0x0000, 0x8066, 0x0000, 0x0231, 0x0008, 0x44e4, 0x000b,
-- 0x58e5, 0x000b, 0x0140, 0x0008, 0x0242, 0x0000, 0x1f43, 0x0002,
-- 0x0cf3, 0x000b, 0x0d44, 0x0000, 0x0d46, 0x0008, 0x0348, 0x0008,
-- 0x044a, 0x0008, 0x030a, 0x0008, 0x040c, 0x0000, 0x0d06, 0x0000,
-- 0x0d08, 0x0008, 0x00f7, 0x0003, 0x0344, 0x0008, 0x0446, 0x0008,
-- 0x0548, 0x0008, 0x064a, 0x0000, 0x1948, 0x000a, 0x08fa, 0x0003,
-- 0x0d4a, 0x0008, 0x58fa, 0x0003, 0x3efe, 0x0008, 0x7f4f, 0x0002,
-- 0x0901, 0x0003, 0x8000, 0x0000, 0x0001, 0x0000, 0x0092, 0x000c,
-- 0x8054, 0x0008, 0x0001, 0x0000, 0x8074, 0x0000, 0x2020, 0x0008,
-- 0x4000, 0x000f, 0x3a40, 0x000a, 0x0c0d, 0x0003, 0x2b24, 0x0008,
-- 0x2b24, 0x0008, 0x590a, 0x000b, 0x8054, 0x0008, 0x0002, 0x0000,
-- 0x1242, 0x0002, 0x0958, 0x0003, 0x3a45, 0x000a, 0x0947, 0x000b,
-- 0x8072, 0x0000, 0x1000, 0x0000, 0x3945, 0x000a, 0x0917, 0x000b,
-- 0x8072, 0x0000, 0x3010, 0x0000, 0x1e10, 0x000a, 0x7f3c, 0x0000,
-- 0x0942, 0x000b, 0x1d00, 0x0002, 0x7f3a, 0x0000, 0x0d60, 0x0000,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x4520, 0x000b,
-- 0x00fe, 0x0000, 0x353f, 0x000b, 0x1c60, 0x0000, 0x8062, 0x0008,
-- 0x0001, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x4528, 0x0003,
-- 0x00fe, 0x0000, 0x325b, 0x000b, 0x0038, 0x0000, 0x0060, 0x0008,
-- 0x8062, 0x0008, 0x0019, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008,
-- 0x4531, 0x000b, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f3e, 0x0008,
-- 0x0d60, 0x0000, 0x0efe, 0x0008, 0x1f80, 0x0001, 0x7f62, 0x0008,
-- 0x8066, 0x0000, 0x0009, 0x0008, 0x453b, 0x000b, 0x003a, 0x0008,
-- 0x1dfe, 0x0000, 0x011c, 0x000b, 0x0036, 0x0008, 0x00e0, 0x000c,
-- 0x0158, 0x000b, 0x8074, 0x0000, 0x2000, 0x0000, 0x8072, 0x0000,
-- 0x2000, 0x0000, 0x0158, 0x000b, 0x3a44, 0x0002, 0x0a89, 0x0003,
-- 0x8074, 0x0000, 0x1000, 0x0000, 0x8072, 0x0000, 0x1000, 0x0000,
-- 0x2d0e, 0x0000, 0x2d0e, 0x0000, 0x3658, 0x0003, 0x26fe, 0x0008,
-- 0x26fe, 0x0008, 0x2700, 0x0008, 0x2700, 0x0008, 0x00d0, 0x0009,
-- 0x0d6a, 0x0003, 0x8074, 0x0000, 0x4040, 0x0008, 0x5958, 0x0003,
-- 0x5106, 0x0003, 0x3a46, 0x000a, 0x0d6a, 0x0003, 0x3a47, 0x0002,
-- 0x0965, 0x000b, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074, 0x0000,
-- 0x8000, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x01b4, 0x0003,
-- 0x92c0, 0x0009, 0x0fc8, 0x0000, 0x080a, 0x0003, 0x1246, 0x000a,
-- 0x0e52, 0x000b, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002, 0x0000,
-- 0x8066, 0x0000, 0x362a, 0x0000, 0x456f, 0x0003, 0x2000, 0x0000,
-- 0x2000, 0x0000, 0x2102, 0x0000, 0x2102, 0x0000, 0x2204, 0x0000,
-- 0x2204, 0x0000, 0x2306, 0x0000, 0x2306, 0x0000, 0x2408, 0x0000,
-- 0x2408, 0x0000, 0x250a, 0x0000, 0x250a, 0x0000, 0x260c, 0x0000,
-- 0x260c, 0x0000, 0x270e, 0x0000, 0x270e, 0x0000, 0x2810, 0x0000,
-- 0x2810, 0x0000, 0x2912, 0x0000, 0x2912, 0x0000, 0x1a60, 0x0000,
-- 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0052, 0x0000,
-- 0x4589, 0x000b, 0x92c0, 0x0009, 0x0780, 0x0008, 0x0e6e, 0x000b,
-- 0x124b, 0x0002, 0x0992, 0x0003, 0x2e4d, 0x0002, 0x2e4d, 0x0002,
-- 0x0a58, 0x0003, 0x3a46, 0x000a, 0x0da2, 0x000b, 0x5994, 0x0003,
-- 0x8054, 0x0008, 0x0004, 0x0000, 0x1243, 0x000a, 0x09b0, 0x0003,
-- 0x8010, 0x0008, 0x000d, 0x0000, 0x0233, 0x000c, 0x1948, 0x000a,
-- 0x099f, 0x000b, 0x0228, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c,
-- 0x01b0, 0x000b, 0x1948, 0x000a, 0x09a6, 0x000b, 0x1243, 0x000a,
-- 0x0a5b, 0x0003, 0x194d, 0x000a, 0x09aa, 0x000b, 0x1243, 0x000a,
-- 0x0a62, 0x0003, 0x59aa, 0x000b, 0x8054, 0x0008, 0x0004, 0x0000,
-- 0x0228, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c, 0x8074, 0x0000,
-- 0xf000, 0x0008, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30, 0x0000,
-- 0x3a42, 0x0002, 0x0dba, 0x000b, 0x15fe, 0x0008, 0x3461, 0x000b,
-- 0x000a, 0x000b, 0x8074, 0x0000, 0x0501, 0x0000, 0x8010, 0x0008,
-- 0x000c, 0x0008, 0x0233, 0x000c, 0x000a, 0x000b, 0xbbe0, 0x0009,
-- 0x0030, 0x0008, 0x0dd0, 0x000b, 0x18fe, 0x0000, 0x3ce0, 0x0009,
-- 0x09cd, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x09cd, 0x0003,
-- 0x0223, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x0220, 0x000b,
-- 0x8076, 0x0008, 0x0041, 0x0008, 0x0220, 0x000b, 0xbbe0, 0x0009,
-- 0x0032, 0x0000, 0x0dd5, 0x000b, 0x3c1e, 0x0008, 0x0220, 0x000b,
-- 0xbbe0, 0x0009, 0x003b, 0x0000, 0x0dda, 0x000b, 0x3c20, 0x0000,
-- 0x0220, 0x000b, 0xbbe0, 0x0009, 0x0035, 0x0008, 0x0de0, 0x000b,
-- 0x8072, 0x0000, 0x8000, 0x0000, 0x039e, 0x0003, 0xbbe0, 0x0009,
-- 0x0036, 0x0008, 0x0abd, 0x000b, 0xbbe0, 0x0009, 0x0037, 0x0000,
-- 0x0e01, 0x000b, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0dcd, 0x000b,
-- 0x8076, 0x0008, 0x0040, 0x0000, 0x1a60, 0x0000, 0x8062, 0x0008,
-- 0x000d, 0x0000, 0x2604, 0x0008, 0x2604, 0x0008, 0x2706, 0x0008,
-- 0x2706, 0x0008, 0x2808, 0x0000, 0x2808, 0x0000, 0x290a, 0x0000,
-- 0x290a, 0x0000, 0x8066, 0x0000, 0x0422, 0x0000, 0x45f8, 0x000b,
-- 0x0228, 0x000c, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074, 0x0000,
-- 0xf000, 0x0008, 0x8072, 0x0000, 0xb000, 0x0000, 0x01b4, 0x0003,
-- 0xbbe0, 0x0009, 0x0038, 0x0000, 0x0e13, 0x000b, 0x18fe, 0x0000,
-- 0x3ce0, 0x0009, 0x0a10, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009,
-- 0x0dc9, 0x0003, 0x0223, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000,
-- 0x8072, 0x0000, 0x8000, 0x0000, 0x0280, 0x000b, 0x8076, 0x0008,
-- 0x0042, 0x0008, 0x0220, 0x000b, 0xbbe0, 0x0009, 0x0016, 0x0000,
-- 0x0e20, 0x000b, 0x8074, 0x0000, 0x0808, 0x0008, 0x3a44, 0x0002,
-- 0x0c0c, 0x000b, 0x8074, 0x0000, 0x0800, 0x0000, 0x8072, 0x0000,
-- 0x8000, 0x0000, 0x8000, 0x000f, 0x000a, 0x000b, 0x8072, 0x0000,
-- 0x8000, 0x0000, 0x000a, 0x000b, 0x3d30, 0x000a, 0x7f00, 0x0000,
-- 0xbc80, 0x0001, 0x0007, 0x0000, 0x022c, 0x000b, 0x1930, 0x000a,
-- 0x7f00, 0x0000, 0x9880, 0x0001, 0x0007, 0x0000, 0x8060, 0x0000,
-- 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x000a, 0x0008,
-- 0x4631, 0x000b, 0x4000, 0x000f, 0x2236, 0x000b, 0x0870, 0x0008,
-- 0x4000, 0x000f, 0x7e33, 0x000b, 0xbbe0, 0x0009, 0x0030, 0x0008,
-- 0x0e33, 0x0003, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0a44, 0x000b,
-- 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x0a44, 0x000b, 0x0223, 0x0004,
-- 0x8076, 0x0008, 0x0040, 0x0000, 0x0246, 0x000b, 0x8076, 0x0008,
-- 0x0041, 0x0008, 0x8072, 0x0000, 0x8000, 0x0000, 0x0233, 0x0003,
-- 0xbac0, 0x0009, 0x0090, 0x0008, 0x0a4f, 0x0003, 0x8074, 0x0000,
-- 0x0706, 0x0000, 0x0251, 0x000b, 0x8074, 0x0000, 0x0703, 0x0000,
-- 0x4000, 0x000f, 0x8010, 0x0008, 0x0023, 0x0000, 0x028e, 0x0003,
-- 0x8010, 0x0008, 0x0008, 0x0000, 0x028e, 0x0003, 0x8010, 0x0008,
-- 0x0022, 0x0008, 0x028e, 0x0003, 0x0228, 0x000c, 0x8010, 0x0008,
-- 0x0007, 0x0000, 0x0233, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c,
-- 0x029a, 0x0003, 0x0228, 0x000c, 0x8010, 0x0008, 0x001b, 0x0008,
-- 0x0233, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c, 0x8074, 0x0000,
-- 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30, 0x0000,
-- 0x000a, 0x000b, 0x8010, 0x0008, 0x0009, 0x0008, 0x028e, 0x0003,
-- 0x8010, 0x0008, 0x0005, 0x0008, 0x028e, 0x0003, 0x1648, 0x000a,
-- 0x0c6f, 0x000b, 0x808c, 0x0008, 0x0001, 0x0000, 0x8010, 0x0008,
-- 0x0004, 0x0000, 0x4143, 0x000a, 0x086f, 0x0003, 0x3a44, 0x0002,
-- 0x0c0a, 0x000b, 0x0d2a, 0x0008, 0x028e, 0x0003, 0x8010, 0x0008,
-- 0x0003, 0x0008, 0x0292, 0x000b, 0x8010, 0x0008, 0x000b, 0x0000,
-- 0x0292, 0x000b, 0x8010, 0x0008, 0x0002, 0x0000, 0x0292, 0x000b,
-- 0x3a47, 0x0002, 0x0d58, 0x000b, 0x8010, 0x0008, 0x0006, 0x0008,
-- 0x0292, 0x000b, 0x8074, 0x0000, 0xf000, 0x0008, 0x8072, 0x0000,
-- 0x3000, 0x0008, 0x0233, 0x000c, 0x0249, 0x0004, 0x3a40, 0x000a,
-- 0x080a, 0x0003, 0x8010, 0x0008, 0x000c, 0x0008, 0x0233, 0x000c,
-- 0x000a, 0x000b, 0x8074, 0x0000, 0xf080, 0x0000, 0x8072, 0x0000,
-- 0x3000, 0x0008, 0x0d30, 0x0000, 0x2e4d, 0x0002, 0x2e4d, 0x0002,
-- 0x0aa5, 0x000b, 0x8054, 0x0008, 0x0019, 0x0000, 0x000a, 0x000b,
-- 0x8054, 0x0008, 0x0009, 0x0008, 0x000a, 0x000b, 0x3a44, 0x0002,
-- 0x0c0a, 0x000b, 0x0283, 0x000b, 0x808c, 0x0008, 0x0000, 0x0008,
-- 0x4447, 0x0002, 0x0ad1, 0x000b, 0xc0c0, 0x0001, 0x00ff, 0x0008,
-- 0xffe0, 0x0009, 0x00ff, 0x0008, 0x0ea8, 0x000b, 0xc1e0, 0x0001,
-- 0xffff, 0x0008, 0x0ea8, 0x000b, 0x8010, 0x0008, 0x0013, 0x0000,
-- 0x0233, 0x000c, 0x8074, 0x0000, 0x0202, 0x0008, 0x000a, 0x000b,
-- 0x3a40, 0x000a, 0x0ece, 0x000b, 0x8074, 0x0000, 0x0200, 0x0000,
-- 0x3d00, 0x0000, 0x3cfe, 0x0000, 0x8072, 0x0000, 0x8000, 0x0000,
-- 0x43e0, 0x0001, 0x0ecc, 0x0003, 0x42fe, 0x0000, 0xffc0, 0x0001,
-- 0x00ff, 0x0008, 0x00e0, 0x0009, 0x0aa8, 0x0003, 0x0d08, 0x0008,
-- 0x0321, 0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x000a, 0x000b,
-- 0x03a7, 0x000c, 0x808c, 0x0008, 0x0001, 0x0000, 0x04fe, 0x0008,
-- 0x338a, 0x0003, 0x0460, 0x0000, 0x8062, 0x0008, 0x0001, 0x0000,
-- 0x8066, 0x0000, 0x0009, 0x0008, 0x46db, 0x0003, 0x0004, 0x0000,
-- 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000, 0x80e0, 0x0001,
-- 0x0004, 0x0000, 0x0af5, 0x000b, 0x80e0, 0x0001, 0x0005, 0x0008,
-- 0x0af5, 0x000b, 0x80e0, 0x0001, 0x0006, 0x0008, 0x0af5, 0x000b,
-- 0x82c0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008, 0x82e0, 0x0009,
-- 0x0600, 0x0008, 0x0af5, 0x000b, 0x82e0, 0x0009, 0x0500, 0x0008,
-- 0x0af5, 0x000b, 0x82e0, 0x0009, 0x0400, 0x0000, 0x0f8a, 0x0003,
-- 0xc4c0, 0x0009, 0x7000, 0x0000, 0xffe0, 0x0009, 0x1000, 0x0000,
-- 0x0b21, 0x0003, 0x0398, 0x000c, 0x3941, 0x0002, 0x0b00, 0x0003,
-- 0x8072, 0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x0460, 0x0000,
-- 0x80fe, 0x0008, 0x002b, 0x0008, 0x7f62, 0x0008, 0x8066, 0x0000,
-- 0x2209, 0x0008, 0x4706, 0x000b, 0x11fe, 0x0000, 0x331c, 0x0003,
-- 0x9180, 0x0001, 0x0002, 0x0000, 0x8060, 0x0000, 0x0400, 0x0000,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008, 0x4710, 0x0003,
-- 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008, 0x03e0, 0x0009,
-- 0x0f19, 0x0003, 0x8072, 0x0000, 0x0400, 0x0000, 0x0046, 0x0003,
-- 0x9180, 0x0001, 0x0003, 0x0008, 0x0303, 0x000b, 0x8072, 0x0000,
-- 0x0400, 0x0000, 0x8010, 0x0008, 0x0010, 0x0000, 0x037b, 0x000b,
-- 0x0398, 0x000c, 0x3941, 0x0002, 0x0b27, 0x0003, 0x8072, 0x0000,
-- 0x0400, 0x0000, 0x000a, 0x000b, 0x1042, 0x000a, 0x0b2c, 0x000b,
-- 0x0360, 0x0004, 0x11fe, 0x0000, 0x3731, 0x000b, 0x8072, 0x0000,
-- 0x0400, 0x0000, 0x8010, 0x0008, 0x000e, 0x0000, 0x037b, 0x000b,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x04fe, 0x0008, 0x3746, 0x000b,
-- 0x808c, 0x0008, 0x0000, 0x0008, 0x9180, 0x0001, 0x0005, 0x0008,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x473c, 0x000b,
-- 0x0060, 0x0008, 0x8062, 0x0008, 0x001b, 0x0008, 0x4304, 0x0008,
-- 0x4206, 0x0008, 0x8066, 0x0000, 0x0412, 0x0000, 0x4744, 0x000b,
-- 0x035d, 0x0003, 0x808c, 0x0008, 0x0001, 0x0000, 0x0460, 0x0000,
-- 0x8062, 0x0008, 0x002b, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008,
-- 0x474d, 0x000b, 0x8066, 0x0000, 0x220a, 0x0008, 0x4750, 0x000b,
-- 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x9180, 0x0001, 0x0002, 0x0000,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x041a, 0x0008, 0x475c, 0x000b,
-- 0x8072, 0x0000, 0x0400, 0x0000, 0x0046, 0x0003, 0x8060, 0x0000,
-- 0x0400, 0x0000, 0x1362, 0x0008, 0x8066, 0x0000, 0x0411, 0x0000,
-- 0x4765, 0x000b, 0x02fe, 0x0008, 0x03e0, 0x0009, 0x0f6b, 0x0003,
-- 0x0d22, 0x0000, 0x4000, 0x000f, 0x8280, 0x0009, 0x0002, 0x0000,
-- 0x1380, 0x0001, 0x7f62, 0x0008, 0x8066, 0x0000, 0x2209, 0x0008,
-- 0x4771, 0x000b, 0x0200, 0x000a, 0xffc0, 0x0001, 0x0007, 0x0000,
-- 0x7f06, 0x0000, 0x1362, 0x0008, 0x8066, 0x0000, 0x060a, 0x0008,
-- 0x4779, 0x0003, 0x4000, 0x000f, 0x3a44, 0x0002, 0x0c0a, 0x000b,
-- 0x2f44, 0x000a, 0x2f44, 0x000a, 0x0e83, 0x000b, 0x808a, 0x0008,
-- 0x0003, 0x0008, 0x8074, 0x0000, 0xf080, 0x0000, 0x8072, 0x0000,
-- 0x3000, 0x0008, 0x5b86, 0x000b, 0x8054, 0x0008, 0x0019, 0x0000,
-- 0x000a, 0x000b, 0x3a44, 0x0002, 0x0c0a, 0x000b, 0x808c, 0x0008,
-- 0x0000, 0x0008, 0x8010, 0x0008, 0x0011, 0x0008, 0x0233, 0x000c,
-- 0x42fe, 0x0000, 0xffc0, 0x0001, 0x00ff, 0x0008, 0x7f10, 0x0008,
-- 0x0233, 0x000c, 0x4310, 0x0008, 0x0292, 0x000b, 0x3941, 0x0002,
-- 0x0b9b, 0x000b, 0x4000, 0x000f, 0x8072, 0x0000, 0x0404, 0x0008,
-- 0x4000, 0x000f, 0x8010, 0x0008, 0x0012, 0x0008, 0x0233, 0x000c,
-- 0x0360, 0x0004, 0x1110, 0x0000, 0x0233, 0x000c, 0x11fe, 0x0000,
-- 0x37a1, 0x000b, 0x000a, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008,
-- 0x7f00, 0x0000, 0xc3c0, 0x0001, 0xff00, 0x0008, 0x00d0, 0x0009,
-- 0x0bcc, 0x0003, 0x0d0a, 0x0000, 0x8580, 0x0001, 0x1000, 0x0000,
-- 0x7f62, 0x0008, 0x8060, 0x0000, 0x0400, 0x0000, 0x8066, 0x0000,
-- 0x0809, 0x0000, 0x47b6, 0x0003, 0x04fe, 0x0008, 0x33c5, 0x000b,
-- 0x0460, 0x0000, 0x8062, 0x0008, 0x0004, 0x0000, 0x8066, 0x0000,
-- 0x0211, 0x0000, 0x47be, 0x000b, 0x01fe, 0x0008, 0x00e0, 0x0009,
-- 0x0fc5, 0x000b, 0x02fe, 0x0008, 0x43e0, 0x0001, 0x0bcb, 0x000b,
-- 0x0500, 0x0002, 0x7f0a, 0x0000, 0xffe0, 0x0009, 0x0800, 0x0000,
-- 0x0faf, 0x000b, 0x0d08, 0x0008, 0x4000, 0x000f, 0x43fe, 0x0008,
-- 0x3e80, 0x0001, 0xffc0, 0x0001, 0x7fff, 0x0000, 0x0d60, 0x0000,
-- 0x7f62, 0x0008, 0x8066, 0x0000, 0x0809, 0x0000, 0x47d4, 0x000b,
-- 0x8060, 0x0000, 0x0400, 0x0000, 0x84c0, 0x0001, 0xff00, 0x0008,
-- 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a,
-- 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a,
-- 0xff80, 0x0009, 0x1000, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000,
-- 0x0809, 0x0000, 0x47e6, 0x0003, 0x4000, 0x000f, 0x8d5b, 0xeac4,
-- 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
-- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000,
-- 0x12b0
-+ 0x002e, 0x001e, 0x000e, 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658,
-+ 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0170, 0x9686,
-+ 0x0004, 0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128,
-+ 0x9686, 0x0004, 0x0110, 0x9085, 0x0001, 0x006e, 0x00be, 0x0005,
-+ 0x00d6, 0x080c, 0xdf5c, 0x00de, 0x0005, 0x00d6, 0x080c, 0xdf69,
-+ 0x1520, 0x680c, 0x908c, 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115,
-+ 0x6216, 0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006, 0x080c, 0xefed,
-+ 0x2009, 0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff,
-+ 0x6824, 0x080c, 0x2873, 0x1148, 0x2001, 0x0001, 0x080c, 0xefed,
-+ 0x2110, 0x900e, 0x080c, 0x3299, 0x0018, 0x9085, 0x0001, 0x0008,
-+ 0x9006, 0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c, 0xb31e, 0x05a8,
-+ 0x0016, 0x0026, 0x00c6, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-+ 0x080c, 0x2873, 0x1578, 0x080c, 0x66b2, 0x1560, 0xbe12, 0xbd16,
-+ 0x00ce, 0x002e, 0x001e, 0x2b00, 0x6012, 0x080c, 0xee1f, 0x11d8,
-+ 0x080c, 0x3374, 0x11c0, 0x080c, 0xdec4, 0x0510, 0x2001, 0x0007,
-+ 0x080c, 0x6663, 0x2001, 0x0007, 0x080c, 0x668f, 0x6017, 0x0000,
-+ 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9540,
-+ 0x080c, 0x9aaa, 0x0010, 0x080c, 0xb2cc, 0x9085, 0x0001, 0x00ce,
-+ 0x00be, 0x0005, 0x080c, 0xb2cc, 0x00ce, 0x002e, 0x001e, 0x0ca8,
-+ 0x080c, 0xb2cc, 0x9006, 0x0c98, 0x2069, 0x026d, 0x6800, 0x9082,
-+ 0x0010, 0x1228, 0x6017, 0x0000, 0x9085, 0x0001, 0x0008, 0x9006,
-+ 0x0005, 0x6017, 0x0000, 0x2069, 0x026c, 0x6808, 0x9084, 0xff00,
-+ 0x9086, 0x0800, 0x1190, 0x6904, 0x9186, 0x0018, 0x0118, 0x9186,
-+ 0x0014, 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff, 0x910d, 0x615a,
-+ 0x908e, 0x0014, 0x0110, 0x908e, 0x0010, 0x0005, 0x6004, 0x90b2,
-+ 0x0053, 0x1a0c, 0x0dc5, 0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2,
-+ 0x0040, 0x1a04, 0xe0cb, 0x040a, 0x91b6, 0x0027, 0x0198, 0x9186,
-+ 0x0015, 0x0118, 0x9186, 0x0016, 0x1148, 0x080c, 0xd802, 0x0128,
-+ 0x6000, 0x9086, 0x0002, 0x0904, 0xbcf6, 0x0005, 0x91b6, 0x0014,
-+ 0x190c, 0x0dc5, 0x2001, 0x0007, 0x080c, 0x668f, 0x080c, 0x999e,
-+ 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005, 0xdff5, 0xdff7, 0xdff5,
-+ 0xdff5, 0xdff5, 0xdff7, 0xe006, 0xe0c4, 0xe04a, 0xe0c4, 0xe072,
-+ 0xe0c4, 0xe006, 0xe0c4, 0xe0bc, 0xe0c4, 0xe0bc, 0xe0c4, 0xe0c4,
-+ 0xdff5, 0xdff5, 0xdff5, 0xdff5, 0xdff5, 0xdff5, 0xdff5, 0xdff5,
-+ 0xdff5, 0xdff5, 0xdff5, 0xdff7, 0xdff5, 0xe0c4, 0xdff5, 0xdff5,
-+ 0xe0c4, 0xdff5, 0xe0c1, 0xe0c4, 0xdff5, 0xdff5, 0xdff5, 0xdff5,
-+ 0xe0c4, 0xe0c4, 0xdff5, 0xe0c4, 0xe0c4, 0xdff5, 0xe001, 0xdff5,
-+ 0xdff5, 0xdff5, 0xdff5, 0xe0c0, 0xe0c4, 0xdff5, 0xdff5, 0xe0c4,
-+ 0xe0c4, 0xdff5, 0xdff5, 0xdff5, 0xdff5, 0x080c, 0x0dc5, 0x080c,
-+ 0x999e, 0x080c, 0xd7f4, 0x6003, 0x0002, 0x080c, 0x9aaa, 0x0804,
-+ 0xe0ca, 0x9006, 0x080c, 0x664f, 0x0804, 0xe0c4, 0x080c, 0x6a94,
-+ 0x1904, 0xe0c4, 0x9006, 0x080c, 0x664f, 0x6010, 0x2058, 0xb810,
-+ 0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000,
-+ 0x78aa, 0x00fe, 0x00b8, 0x6010, 0x2058, 0xb8c0, 0x9005, 0x0904,
-+ 0xe0c4, 0x080c, 0x33a5, 0x1904, 0xe0c4, 0x2001, 0x1800, 0x2004,
-+ 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000,
-+ 0x78aa, 0x00fe, 0x2001, 0x0002, 0x080c, 0x6663, 0x080c, 0x999e,
-+ 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9540,
-+ 0x080c, 0x9aaa, 0x6110, 0x2158, 0x2009, 0x0001, 0x080c, 0x8844,
-+ 0x0804, 0xe0ca, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637,
-+ 0x9686, 0x0006, 0x0148, 0x9686, 0x0004, 0x0130, 0x080c, 0x902a,
-+ 0x2001, 0x0004, 0x080c, 0x668f, 0x080c, 0xf03c, 0x0904, 0xe0c4,
-+ 0x080c, 0x999e, 0x2001, 0x0004, 0x080c, 0x6663, 0x6023, 0x0001,
-+ 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x9540, 0x080c, 0x9aaa,
-+ 0x0804, 0xe0ca, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158,
-+ 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c,
-+ 0x4df9, 0x004e, 0x003e, 0x2001, 0x0006, 0x080c, 0xe0e8, 0x6610,
-+ 0x2658, 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
-+ 0x006e, 0x0180, 0x2001, 0x0006, 0x080c, 0x668f, 0x9284, 0x00ff,
-+ 0x908e, 0x0007, 0x0118, 0x908e, 0x0004, 0x1120, 0x2001, 0x0006,
-+ 0x080c, 0x6663, 0x080c, 0x6a94, 0x11f8, 0x2001, 0x1837, 0x2004,
-+ 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0,
-+ 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0804,
-+ 0xe032, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0449, 0x0020,
-+ 0x0018, 0x0010, 0x080c, 0x668f, 0x080c, 0x999e, 0x080c, 0xb2cc,
-+ 0x080c, 0x9aaa, 0x0005, 0x2600, 0x0002, 0xe0df, 0xe0df, 0xe0df,
-+ 0xe0df, 0xe0df, 0xe0e1, 0xe0df, 0xe0e1, 0xe0df, 0xe0df, 0xe0e1,
-+ 0xe0df, 0xe0df, 0xe0df, 0xe0e1, 0xe0e1, 0xe0e1, 0xe0e1, 0x080c,
-+ 0x0dc5, 0x080c, 0x999e, 0x080c, 0xb2cc, 0x080c, 0x9aaa, 0x0005,
-+ 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138,
-+ 0x080c, 0x6663, 0x9006, 0x080c, 0x664f, 0x080c, 0x3279, 0x00de,
-+ 0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00,
-+ 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0dc5, 0x91b6, 0x0015, 0x1110,
-+ 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0dc5, 0x006b, 0x0005,
-+ 0xbd98, 0xbd98, 0xbd98, 0xbd98, 0xe17d, 0xbd98, 0xe167, 0xe128,
-+ 0xbd98, 0xbd98, 0xbd98, 0xbd98, 0xbd98, 0xbd98, 0xbd98, 0xbd98,
-+ 0xe17d, 0xbd98, 0xe167, 0xe16e, 0xbd98, 0xbd98, 0xbd98, 0xbd98,
-+ 0x00f6, 0x080c, 0x6a94, 0x11d8, 0x080c, 0xd7dc, 0x11c0, 0x6010,
-+ 0x905d, 0x01a8, 0xb8c0, 0x9005, 0x0190, 0x9006, 0x080c, 0x664f,
-+ 0x2001, 0x0002, 0x080c, 0x6663, 0x6023, 0x0001, 0x6003, 0x0001,
-+ 0x6007, 0x0002, 0x080c, 0x9540, 0x080c, 0x9aaa, 0x00f0, 0x2011,
-+ 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2873, 0x11b0, 0x080c,
-+ 0x671d, 0x0118, 0x080c, 0xb2cc, 0x0080, 0xb810, 0x0006, 0xb814,
-+ 0x0006, 0xb8c0, 0x0006, 0x080c, 0x6141, 0x000e, 0xb8c2, 0x000e,
-+ 0xb816, 0x000e, 0xb812, 0x080c, 0xb2cc, 0x00fe, 0x0005, 0x6604,
-+ 0x96b6, 0x001e, 0x1110, 0x080c, 0xb2cc, 0x0005, 0x080c, 0xc1d5,
-+ 0x1148, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x9540, 0x080c,
-+ 0x9aaa, 0x0010, 0x080c, 0xb2cc, 0x0005, 0x0804, 0xb2cc, 0x6004,
-+ 0x908a, 0x0053, 0x1a0c, 0x0dc5, 0x080c, 0x999e, 0x080c, 0xb2ff,
-+ 0x080c, 0x9aaa, 0x0005, 0x9182, 0x0040, 0x0002, 0xe1a2, 0xe1a2,
-+ 0xe1a2, 0xe1a2, 0xe1a4, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2,
-+ 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2, 0xe1a2,
-+ 0xe1a2, 0xe1a2, 0x080c, 0x0dc5, 0x0096, 0x00b6, 0x00d6, 0x00e6,
-+ 0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11a8,
-+ 0x6106, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xe20a,
-+ 0x080c, 0xefe1, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001,
-+ 0x2011, 0x0200, 0x080c, 0x8a49, 0x0020, 0x9026, 0x080c, 0xee64,
-+ 0x0c38, 0x080c, 0x100e, 0x090c, 0x0dc5, 0x6003, 0x0007, 0xa867,
-+ 0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008,
-+ 0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876,
-+ 0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x6e98,
-+ 0x001e, 0x080c, 0xefe1, 0x1904, 0xe26a, 0x9486, 0x2000, 0x1130,
-+ 0x2019, 0x0017, 0x080c, 0xeb9a, 0x0804, 0xe26a, 0x9486, 0x0200,
-+ 0x1120, 0x080c, 0xeb31, 0x0804, 0xe26a, 0x9486, 0x0400, 0x0120,
-+ 0x9486, 0x1000, 0x1904, 0xe26a, 0x2019, 0x0002, 0x080c, 0xeb4c,
-+ 0x0804, 0xe26a, 0x2069, 0x1a74, 0x6a00, 0xd284, 0x0904, 0xe2d4,
-+ 0x9284, 0x0300, 0x1904, 0xe2cd, 0x6804, 0x9005, 0x0904, 0xe2b5,
-+ 0x2d78, 0x6003, 0x0007, 0x080c, 0x1027, 0x0904, 0xe276, 0x7800,
-+ 0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001,
-+ 0x180f, 0x2004, 0xd084, 0x1904, 0xe2d8, 0x9006, 0xa802, 0xa867,
-+ 0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058,
-+ 0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be,
-+ 0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084,
-+ 0x0003, 0x9080, 0xe272, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001,
-+ 0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080,
-+ 0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b,
-+ 0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae,
-+ 0x080c, 0x6e98, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be,
-+ 0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810,
-+ 0x2004, 0xd084, 0x0120, 0x080c, 0x100e, 0x1904, 0xe21f, 0x6017,
-+ 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x94f8, 0x080c,
-+ 0x9aaa, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086,
-+ 0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c,
-+ 0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043,
-+ 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0828, 0x6868, 0x602e, 0x686c,
-+ 0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x0804, 0xe26a, 0x2001, 0x180e, 0x2004,
-+ 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4c42, 0x6017, 0xf300,
-+ 0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x0804, 0xe26a, 0x6017, 0xf500, 0x0c98,
-+ 0x6017, 0xf600, 0x0804, 0xe28a, 0x6017, 0xf200, 0x0804, 0xe28a,
-+ 0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a,
-+ 0x7044, 0x9084, 0x0003, 0x9080, 0xe272, 0x2005, 0xa87e, 0x2928,
-+ 0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e,
-+ 0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205,
-+ 0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210,
-+ 0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0dc5,
-+ 0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c,
-+ 0x9080, 0x0029, 0x20a0, 0x2011, 0xe354, 0x2041, 0x0001, 0x223d,
-+ 0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a,
-+ 0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260,
-+ 0x2098, 0x0c68, 0x2950, 0x080c, 0x1027, 0x0170, 0x2900, 0xb002,
-+ 0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080,
-+ 0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118,
-+ 0x080c, 0x1040, 0x0cc8, 0x080c, 0x1040, 0x0804, 0xe276, 0x2548,
-+ 0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000,
-+ 0x080c, 0xebcd, 0x0804, 0xe26a, 0x8010, 0x0004, 0x801a, 0x0006,
-+ 0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160,
-+ 0x6004, 0x908a, 0x0054, 0x1a0c, 0x0dc5, 0x9082, 0x0040, 0x0a0c,
-+ 0x0dc5, 0x2008, 0x0804, 0xe3e3, 0x9186, 0x0051, 0x0108, 0x0048,
-+ 0x080c, 0xd802, 0x0500, 0x6000, 0x9086, 0x0002, 0x11e0, 0x0804,
-+ 0xe42c, 0x9186, 0x0027, 0x0190, 0x9186, 0x0048, 0x0128, 0x9186,
-+ 0x0014, 0x0160, 0x190c, 0x0dc5, 0x080c, 0xd802, 0x0160, 0x6000,
-+ 0x9086, 0x0004, 0x190c, 0x0dc5, 0x0804, 0xe50f, 0x6004, 0x9082,
-+ 0x0040, 0x2008, 0x001a, 0x080c, 0xb366, 0x0005, 0xe3aa, 0xe3ac,
-+ 0xe3ac, 0xe3d3, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa,
-+ 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa, 0xe3aa,
-+ 0xe3aa, 0xe3aa, 0x080c, 0x0dc5, 0x080c, 0x999e, 0x080c, 0x9aaa,
-+ 0x0036, 0x0096, 0x6014, 0x904d, 0x01d8, 0x080c, 0xd0d1, 0x01c0,
-+ 0x6003, 0x0002, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-+ 0x1178, 0x2019, 0x0004, 0x080c, 0xebcd, 0x6017, 0x0000, 0x6018,
-+ 0x9005, 0x1120, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x0007,
-+ 0x009e, 0x003e, 0x0005, 0x0096, 0x080c, 0x999e, 0x080c, 0x9aaa,
-+ 0x080c, 0xd0d1, 0x0120, 0x6014, 0x2048, 0x080c, 0x1040, 0x080c,
-+ 0xb2ff, 0x009e, 0x0005, 0x0002, 0xe3f8, 0xe40f, 0xe3fa, 0xe426,
-+ 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8,
-+ 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8, 0xe3f8,
-+ 0x080c, 0x0dc5, 0x0096, 0x080c, 0x999e, 0x6014, 0x2048, 0xa87c,
-+ 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c, 0xb34b,
-+ 0x0010, 0x6003, 0x0004, 0x080c, 0x9aaa, 0x009e, 0x0005, 0x080c,
-+ 0x999e, 0x080c, 0xd0d1, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c,
-+ 0x009e, 0xd1ec, 0x1138, 0x080c, 0x8a1e, 0x080c, 0xb2cc, 0x080c,
-+ 0x9aaa, 0x0005, 0x080c, 0xee28, 0x0db0, 0x0cc8, 0x080c, 0x999e,
-+ 0x2009, 0x0041, 0x0804, 0xe597, 0x9182, 0x0040, 0x0002, 0xe443,
-+ 0xe445, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443,
-+ 0xe443, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443, 0xe443,
-+ 0xe446, 0xe443, 0xe443, 0x080c, 0x0dc5, 0x0005, 0x00d6, 0x080c,
-+ 0x8a1e, 0x00de, 0x080c, 0xee80, 0x080c, 0xb2cc, 0x0005, 0x9182,
-+ 0x0040, 0x0002, 0xe466, 0xe466, 0xe466, 0xe466, 0xe466, 0xe466,
-+ 0xe466, 0xe466, 0xe466, 0xe468, 0xe4d7, 0xe466, 0xe466, 0xe466,
-+ 0xe466, 0xe4d7, 0xe466, 0xe466, 0xe466, 0xe466, 0x080c, 0x0dc5,
-+ 0x2001, 0x0105, 0x2004, 0x9084, 0x1800, 0x01c8, 0x2001, 0x0132,
-+ 0x200c, 0x2001, 0x0131, 0x2004, 0x9105, 0x1904, 0xe4d7, 0x2009,
-+ 0x180c, 0x2104, 0xd0d4, 0x0904, 0xe4d7, 0xc0d4, 0x200a, 0x2009,
-+ 0x0105, 0x2104, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a, 0x2001,
-+ 0x1867, 0x2004, 0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c, 0x9a5a,
-+ 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c, 0x0003,
-+ 0x918e, 0x0002, 0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4, 0x11e0,
-+ 0x080c, 0x9bcc, 0x2009, 0x0041, 0x009e, 0x0804, 0xe597, 0x080c,
-+ 0x9bcc, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8a1e, 0x009e,
-+ 0x0005, 0x2001, 0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8, 0x2001,
-+ 0x011f, 0x2004, 0x603a, 0x0890, 0x2001, 0x180c, 0x200c, 0xc1d4,
-+ 0x2102, 0xd1cc, 0x0110, 0x080c, 0x2c7b, 0x080c, 0x9bcc, 0x6014,
-+ 0x2048, 0xa97c, 0xd1ec, 0x1130, 0x080c, 0x8a1e, 0x080c, 0xb2cc,
-+ 0x009e, 0x0005, 0x080c, 0xee28, 0x0db8, 0x009e, 0x0005, 0x2001,
-+ 0x180c, 0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x9a5a, 0x080c,
-+ 0x9bcc, 0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800,
-+ 0x00be, 0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002,
-+ 0x0140, 0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b,
-+ 0x632e, 0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xebcd,
-+ 0x6018, 0x9005, 0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a,
-+ 0x6017, 0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182,
-+ 0x0040, 0x0002, 0xe526, 0xe526, 0xe526, 0xe526, 0xe526, 0xe526,
-+ 0xe526, 0xe526, 0xe528, 0xe526, 0xe526, 0xe526, 0xe526, 0xe526,
-+ 0xe526, 0xe526, 0xe526, 0xe526, 0xe526, 0xe573, 0x080c, 0x0dc5,
-+ 0x6014, 0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158,
-+ 0xb900, 0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc,
-+ 0x0128, 0x2009, 0x0041, 0x009e, 0x0804, 0xe597, 0x6003, 0x0007,
-+ 0x601b, 0x0000, 0x080c, 0x8a1e, 0x009e, 0x0005, 0x6124, 0xd1f4,
-+ 0x1d58, 0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b,
-+ 0x6030, 0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e,
-+ 0x08d8, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178,
-+ 0x2009, 0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010,
-+ 0x6003, 0x0006, 0x00e9, 0x080c, 0x8a20, 0x009e, 0x0005, 0x6003,
-+ 0x0002, 0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x1608,
-+ 0x1904, 0xe528, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938,
-+ 0x009e, 0x9105, 0x1120, 0x080c, 0x1608, 0x1904, 0xe528, 0x0005,
-+ 0xd2fc, 0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009,
-+ 0x0009, 0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182,
-+ 0x0040, 0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014,
-+ 0x190c, 0x0dc5, 0x6024, 0xd0dc, 0x090c, 0x0dc5, 0x0005, 0xe5bb,
-+ 0xe5c7, 0xe5d3, 0xe5df, 0xe5bb, 0xe5bb, 0xe5bb, 0xe5bb, 0xe5c2,
-+ 0xe5bd, 0xe5bd, 0xe5bb, 0xe5bb, 0xe5bb, 0xe5bb, 0xe5bd, 0xe5bb,
-+ 0xe5bd, 0xe5bb, 0xe5c2, 0x080c, 0x0dc5, 0x6024, 0xd0dc, 0x090c,
-+ 0x0dc5, 0x0005, 0x6014, 0x9005, 0x190c, 0x0dc5, 0x0005, 0x6003,
-+ 0x0001, 0x6106, 0x080c, 0x94f8, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x9aaa, 0x012e, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x94f8,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x9aaa, 0x012e, 0x0005, 0x6003,
-+ 0x0003, 0x6106, 0x2c10, 0x080c, 0x1be0, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x955d, 0x080c, 0x9bcc, 0x012e, 0x0005, 0x0126, 0x2091,
-+ 0x8000, 0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e,
-+ 0x012e, 0x0005, 0xe60e, 0xe610, 0xe622, 0xe63c, 0xe60e, 0xe60e,
-+ 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e,
-+ 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0xe60e, 0x080c, 0x0dc5,
-+ 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x01f8, 0x909c, 0x0003, 0x939e,
-+ 0x0003, 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c, 0x94f8, 0x080c,
-+ 0x9aaa, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c,
-+ 0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x080c,
-+ 0x94f8, 0x080c, 0x9aaa, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019,
-+ 0x0004, 0x080c, 0xebcd, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-+ 0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003,
-+ 0x6106, 0x2c10, 0x080c, 0x1be0, 0x080c, 0x955d, 0x080c, 0x9bcc,
-+ 0x0005, 0x080c, 0x999e, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148,
-+ 0x080c, 0xef7e, 0x0036, 0x2019, 0x0029, 0x080c, 0xebcd, 0x003e,
-+ 0x009e, 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005, 0x080c, 0x9a5a,
-+ 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xef7e, 0x0036,
-+ 0x2019, 0x0029, 0x080c, 0xebcd, 0x003e, 0x009e, 0x080c, 0xb2ff,
-+ 0x080c, 0x9bcc, 0x0005, 0x9182, 0x0085, 0x0002, 0xe68d, 0xe68b,
-+ 0xe68b, 0xe699, 0xe68b, 0xe68b, 0xe68b, 0xe68b, 0xe68b, 0xe68b,
-+ 0xe68b, 0xe68b, 0xe68b, 0x080c, 0x0dc5, 0x6003, 0x000b, 0x6106,
-+ 0x080c, 0x94f8, 0x0126, 0x2091, 0x8000, 0x080c, 0x9aaa, 0x012e,
-+ 0x0005, 0x0026, 0x00e6, 0x080c, 0xee1f, 0x0118, 0x080c, 0xb2cc,
-+ 0x0450, 0x2071, 0x0260, 0x7224, 0x6216, 0x2001, 0x180e, 0x2004,
-+ 0xd0e4, 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00,
-+ 0x2011, 0x014e, 0x080c, 0xb5ee, 0x7220, 0x080c, 0xea22, 0x0118,
-+ 0x6007, 0x0086, 0x0040, 0x6007, 0x0087, 0x7224, 0x9296, 0xffff,
-+ 0x1110, 0x6007, 0x0086, 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c,
-+ 0x9aaa, 0x080c, 0x9bcc, 0x00ee, 0x002e, 0x0005, 0x9186, 0x0013,
-+ 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dc5, 0x908a, 0x0092,
-+ 0x1a0c, 0x0dc5, 0x9082, 0x0085, 0x00a2, 0x9186, 0x0027, 0x0130,
-+ 0x9186, 0x0014, 0x0118, 0x080c, 0xb366, 0x0050, 0x2001, 0x0007,
-+ 0x080c, 0x668f, 0x080c, 0x999e, 0x080c, 0xb2ff, 0x080c, 0x9aaa,
-+ 0x0005, 0xe6fe, 0xe700, 0xe700, 0xe6fe, 0xe6fe, 0xe6fe, 0xe6fe,
-+ 0xe6fe, 0xe6fe, 0xe6fe, 0xe6fe, 0xe6fe, 0xe6fe, 0x080c, 0x0dc5,
-+ 0x080c, 0x999e, 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005, 0x9182,
-+ 0x0085, 0x0a0c, 0x0dc5, 0x9182, 0x0092, 0x1a0c, 0x0dc5, 0x9182,
-+ 0x0085, 0x0002, 0xe71f, 0xe71f, 0xe71f, 0xe721, 0xe71f, 0xe71f,
-+ 0xe71f, 0xe71f, 0xe71f, 0xe71f, 0xe71f, 0xe71f, 0xe71f, 0x080c,
-+ 0x0dc5, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130,
-+ 0x9186, 0x0027, 0x0118, 0x080c, 0xb366, 0x0030, 0x080c, 0x999e,
-+ 0x080c, 0xb2ff, 0x080c, 0x9aaa, 0x0005, 0x0036, 0x080c, 0xee80,
-+ 0x6043, 0x0000, 0x2019, 0x000b, 0x0011, 0x003e, 0x0005, 0x6010,
-+ 0x0006, 0x0059, 0x000e, 0x6012, 0x6023, 0x0006, 0x6003, 0x0007,
-+ 0x601b, 0x0000, 0x6043, 0x0000, 0x0005, 0x0126, 0x0036, 0x2091,
-+ 0x8000, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xaaf4, 0x009e,
-+ 0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0xab9f, 0x007e, 0x1520,
-+ 0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0,
-+ 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xee80, 0x080c, 0xd7f4,
-+ 0x080c, 0x1a8e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xd0d1,
-+ 0x0110, 0x080c, 0xebcd, 0x009e, 0x6017, 0x0000, 0x080c, 0xee80,
-+ 0x6023, 0x0007, 0x080c, 0xd7f4, 0x003e, 0x012e, 0x0005, 0x00f6,
-+ 0x00c6, 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c,
-+ 0x080c, 0x2873, 0x1904, 0xe7dd, 0x0016, 0x00c6, 0x080c, 0x671d,
-+ 0x1904, 0xe7db, 0x001e, 0x00c6, 0x080c, 0xd7dc, 0x1130, 0xb8c0,
-+ 0x9005, 0x0118, 0x080c, 0x33a5, 0x0148, 0x2b10, 0x2160, 0x6010,
-+ 0x0006, 0x6212, 0x080c, 0xd7e3, 0x000e, 0x6012, 0x00ce, 0x002e,
-+ 0x0026, 0x0016, 0x2019, 0x0029, 0x080c, 0xac65, 0x080c, 0x969d,
-+ 0x0076, 0x903e, 0x080c, 0x9570, 0x007e, 0x001e, 0x0076, 0x903e,
-+ 0x080c, 0xe915, 0x007e, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217,
-+ 0x9286, 0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c,
-+ 0x330e, 0x002e, 0xbcc0, 0x001e, 0x080c, 0x6141, 0xbe12, 0xbd16,
-+ 0xbcc2, 0x9006, 0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be,
-+ 0x00ce, 0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009,
-+ 0x1824, 0x2104, 0x9086, 0x0074, 0x1904, 0xe83c, 0x2069, 0x0260,
-+ 0x6944, 0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904,
-+ 0xe839, 0x2001, 0x197c, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058,
-+ 0xb8c0, 0x9005, 0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a,
-+ 0x0001, 0x0648, 0x080c, 0xefe6, 0x0118, 0x6978, 0xd1fc, 0x11b8,
-+ 0x2009, 0x0205, 0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944,
-+ 0x9182, 0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a,
-+ 0x0001, 0x0288, 0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017,
-+ 0x0100, 0x00a0, 0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070,
-+ 0x6017, 0x0700, 0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00,
-+ 0x0028, 0x6017, 0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001,
-+ 0x0008, 0x9006, 0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6,
-+ 0x00b6, 0x0026, 0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394,
-+ 0x00ff, 0x9286, 0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394,
-+ 0xff00, 0x8217, 0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120,
-+ 0x080c, 0x672c, 0x0804, 0xe8a4, 0x2011, 0x0276, 0x20a9, 0x0004,
-+ 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xc372, 0x009e, 0x15a8,
-+ 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006,
-+ 0x080c, 0xc372, 0x009e, 0x1548, 0x0046, 0x0016, 0xbaa0, 0x2220,
-+ 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029,
-+ 0x080c, 0xec2a, 0xb800, 0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c,
-+ 0x969d, 0x0076, 0x2039, 0x0000, 0x080c, 0x9570, 0x2c08, 0x080c,
-+ 0xe915, 0x007e, 0x2001, 0x0007, 0x080c, 0x668f, 0x2001, 0x0007,
-+ 0x080c, 0x6663, 0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e,
-+ 0x00be, 0x00ce, 0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086,
-+ 0x0800, 0x0118, 0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005,
-+ 0x00b6, 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c,
-+ 0x7930, 0x7834, 0x080c, 0x2873, 0x11d0, 0x080c, 0x671d, 0x11b8,
-+ 0x2011, 0x0270, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a,
-+ 0x080c, 0xc372, 0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004,
-+ 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xc372, 0x009e, 0x015e,
-+ 0x003e, 0x002e, 0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006,
-+ 0x0016, 0x0026, 0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211,
-+ 0x220c, 0x080c, 0x2873, 0x11d0, 0x080c, 0x671d, 0x11b8, 0x2011,
-+ 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c,
-+ 0xc372, 0x009e, 0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096,
-+ 0x2b48, 0x2019, 0x0006, 0x080c, 0xc372, 0x009e, 0x015e, 0x003e,
-+ 0x002e, 0x001e, 0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086,
-+ 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000,
-+ 0x2740, 0x2029, 0x19f1, 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061,
-+ 0x1cd0, 0x2071, 0x1800, 0x7654, 0x7074, 0x81ff, 0x0150, 0x0006,
-+ 0x9186, 0x1ab7, 0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xe9b3,
-+ 0x0018, 0x9606, 0x0904, 0xe9b3, 0x080c, 0x8cf0, 0x0904, 0xe9aa,
-+ 0x2100, 0x9c06, 0x0904, 0xe9aa, 0x6720, 0x9786, 0x0007, 0x0904,
-+ 0xe9aa, 0x080c, 0xec6b, 0x1904, 0xe9aa, 0x080c, 0xf004, 0x0904,
-+ 0xe9aa, 0x080c, 0xec5b, 0x0904, 0xe9aa, 0x6720, 0x9786, 0x0001,
-+ 0x1148, 0x080c, 0x33a5, 0x0904, 0xe9f2, 0x6004, 0x9086, 0x0000,
-+ 0x1904, 0xe9f2, 0x9786, 0x0004, 0x0904, 0xe9f2, 0x2500, 0x9c06,
-+ 0x0904, 0xe9aa, 0x2400, 0x9c06, 0x05e8, 0x88ff, 0x0118, 0x6054,
-+ 0x9906, 0x15c0, 0x0096, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016,
-+ 0x080c, 0x1a8e, 0x001e, 0x9786, 0x000a, 0x0148, 0x080c, 0xd2d9,
-+ 0x1130, 0x080c, 0xbcaf, 0x009e, 0x080c, 0xb2ff, 0x0418, 0x6014,
-+ 0x2048, 0x080c, 0xd0d1, 0x01d8, 0x9786, 0x0003, 0x1570, 0xa867,
-+ 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c,
-+ 0x0fc0, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xef7e, 0x0016,
-+ 0x080c, 0xd3c7, 0x080c, 0x6e8b, 0x001e, 0x080c, 0xd2bc, 0x009e,
-+ 0x080c, 0xb2ff, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
-+ 0x1210, 0x0804, 0xe929, 0x012e, 0x002e, 0x004e, 0x005e, 0x006e,
-+ 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1150,
-+ 0x9386, 0x0005, 0x0128, 0x080c, 0xef7e, 0x080c, 0xebcd, 0x08f8,
-+ 0x009e, 0x0c00, 0x9786, 0x0009, 0x11f8, 0x6000, 0x9086, 0x0004,
-+ 0x01c0, 0x6000, 0x9086, 0x0003, 0x11a0, 0x080c, 0x9a5a, 0x0096,
-+ 0x6114, 0x2148, 0x080c, 0xd0d1, 0x0118, 0x6010, 0x080c, 0x6e98,
-+ 0x009e, 0x00c6, 0x080c, 0xb2cc, 0x00ce, 0x0036, 0x080c, 0x9bcc,
-+ 0x003e, 0x009e, 0x0804, 0xe9aa, 0x9786, 0x000a, 0x0904, 0xe99a,
-+ 0x0804, 0xe98f, 0x81ff, 0x0904, 0xe9aa, 0x9180, 0x0001, 0x2004,
-+ 0x9086, 0x0018, 0x0138, 0x9180, 0x0001, 0x2004, 0x9086, 0x002d,
-+ 0x1904, 0xe9aa, 0x6000, 0x9086, 0x0002, 0x1904, 0xe9aa, 0x080c,
-+ 0xd2c8, 0x0138, 0x080c, 0xd2d9, 0x1904, 0xe9aa, 0x080c, 0xbcaf,
-+ 0x0038, 0x080c, 0x3279, 0x080c, 0xd2d9, 0x1110, 0x080c, 0xbcaf,
-+ 0x080c, 0xb2ff, 0x0804, 0xe9aa, 0xa864, 0x9084, 0x00ff, 0x9086,
-+ 0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006,
-+ 0x080c, 0xebf4, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f, 0x001b,
-+ 0x00ee, 0x00ce, 0x0005, 0xea41, 0xea41, 0xea41, 0xea41, 0xea41,
-+ 0xea41, 0xea43, 0xea41, 0xea41, 0xea41, 0xea6c, 0xb2ff, 0xb2ff,
-+ 0xea41, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010, 0x00b6,
-+ 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020, 0x080c, 0xec2a,
-+ 0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xe74d, 0x003e, 0x9085,
-+ 0x0001, 0x0005, 0x0096, 0x080c, 0xd0d1, 0x0140, 0x6014, 0x904d,
-+ 0x080c, 0xccec, 0x687b, 0x0005, 0x080c, 0x6e98, 0x009e, 0x080c,
-+ 0xb2ff, 0x9085, 0x0001, 0x0005, 0x0019, 0x9085, 0x0001, 0x0005,
-+ 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0dc5, 0x000b, 0x0005, 0xea87,
-+ 0xea87, 0xea9e, 0xea8e, 0xeaad, 0xea87, 0xea87, 0xea89, 0xea87,
-+ 0xea87, 0xea87, 0xea87, 0xea87, 0xea87, 0xea87, 0xea87, 0x080c,
-+ 0x0dc5, 0x080c, 0xb2ff, 0x9085, 0x0001, 0x0005, 0x0036, 0x00e6,
-+ 0x2071, 0x19e8, 0x703c, 0x9c06, 0x1128, 0x2019, 0x0001, 0x080c,
-+ 0xaa42, 0x0010, 0x080c, 0xac24, 0x00ee, 0x003e, 0x0096, 0x00d6,
-+ 0x6014, 0x2048, 0xa87b, 0x0005, 0x080c, 0x6e98, 0x080c, 0xb2ff,
-+ 0x00de, 0x009e, 0x9085, 0x0001, 0x0005, 0x601c, 0xd084, 0x190c,
-+ 0x1a8e, 0x0c60, 0x2001, 0x0001, 0x080c, 0x664f, 0x0156, 0x0016,
-+ 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276,
-+ 0x080c, 0xc35e, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0005,
-+ 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x00b6, 0x0126,
-+ 0x2091, 0x8000, 0x2740, 0x2061, 0x1cd0, 0x2079, 0x0001, 0x8fff,
-+ 0x0904, 0xeb24, 0x2071, 0x1800, 0x7654, 0x7074, 0x8001, 0x9602,
-+ 0x1a04, 0xeb24, 0x88ff, 0x0120, 0x2800, 0x9c06, 0x15a0, 0x2078,
-+ 0x080c, 0xec5b, 0x0580, 0x2400, 0x9c06, 0x0568, 0x6720, 0x9786,
-+ 0x0006, 0x1548, 0x9786, 0x0007, 0x0530, 0x88ff, 0x1150, 0xd58c,
-+ 0x1118, 0x6010, 0x9b06, 0x11f8, 0xd584, 0x0118, 0x6054, 0x9106,
-+ 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xee80, 0x080c,
-+ 0xd7f4, 0x080c, 0x1a8e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c,
-+ 0xd0d1, 0x0120, 0x0046, 0x080c, 0xebcd, 0x004e, 0x009e, 0x080c,
-+ 0xb2ff, 0x88ff, 0x1198, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004,
-+ 0x9c02, 0x1210, 0x0804, 0xead7, 0x9006, 0x012e, 0x00be, 0x006e,
-+ 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001,
-+ 0x0ca0, 0x00b6, 0x0076, 0x0056, 0x0086, 0x9046, 0x2029, 0x0001,
-+ 0x2c20, 0x2019, 0x0002, 0x6210, 0x2258, 0x0096, 0x904e, 0x080c,
-+ 0xaaf4, 0x009e, 0x008e, 0x903e, 0x080c, 0xab9f, 0x080c, 0xeac8,
-+ 0x005e, 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046, 0x0056, 0x0076,
-+ 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016,
-+ 0x0036, 0x080c, 0x671d, 0x1180, 0x0056, 0x0086, 0x9046, 0x2508,
-+ 0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0xaaf4, 0x009e, 0x008e,
-+ 0x903e, 0x080c, 0xab9f, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04,
-+ 0xeb57, 0x0036, 0x2508, 0x2029, 0x0003, 0x080c, 0xeac8, 0x003e,
-+ 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x00b6,
-+ 0x0076, 0x0056, 0x6210, 0x2258, 0x0086, 0x9046, 0x2029, 0x0001,
-+ 0x2019, 0x0048, 0x0096, 0x904e, 0x080c, 0xaaf4, 0x009e, 0x008e,
-+ 0x903e, 0x080c, 0xab9f, 0x2c20, 0x080c, 0xeac8, 0x005e, 0x007e,
-+ 0x00be, 0x0005, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156,
-+ 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x671d,
-+ 0x1190, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c,
-+ 0xee64, 0x004e, 0x0096, 0x904e, 0x080c, 0xaaf4, 0x009e, 0x008e,
-+ 0x903e, 0x080c, 0xab9f, 0x003e, 0x001e, 0x8108, 0x1f04, 0xeba4,
-+ 0x0036, 0x2029, 0x0002, 0x080c, 0xeac8, 0x003e, 0x015e, 0x00ce,
-+ 0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x0016, 0x00f6, 0x080c,
-+ 0xd0cf, 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180,
-+ 0xa800, 0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x6e98,
-+ 0x2f48, 0x0cb0, 0xab82, 0x080c, 0x6e98, 0x00fe, 0x001e, 0x0005,
-+ 0xa800, 0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x6e98, 0x2f48,
-+ 0x0cb8, 0x080c, 0x6e98, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061,
-+ 0x1cd0, 0x9005, 0x1138, 0x2071, 0x1800, 0x7454, 0x7074, 0x8001,
-+ 0x9402, 0x12f8, 0x2100, 0x9c06, 0x0188, 0x6000, 0x9086, 0x0000,
-+ 0x0168, 0x6008, 0x9206, 0x1150, 0x6320, 0x9386, 0x0009, 0x01b0,
-+ 0x6010, 0x91a0, 0x0004, 0x2424, 0x9406, 0x0140, 0x9ce0, 0x0018,
-+ 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c20, 0x9085, 0x0001,
-+ 0x0008, 0x9006, 0x003e, 0x004e, 0x00ee, 0x0005, 0x631c, 0xd3c4,
-+ 0x1d68, 0x0c30, 0x0096, 0x0006, 0x080c, 0x100e, 0x000e, 0x090c,
-+ 0x0dc5, 0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010, 0x080c,
-+ 0xd0bf, 0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0015, 0x2004,
-+ 0x002e, 0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff, 0xa986,
-+ 0xac76, 0xa87f, 0x0000, 0x2001, 0x198e, 0x2004, 0xa882, 0x9006,
-+ 0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6e98,
-+ 0x012e, 0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158, 0x9786,
-+ 0x0001, 0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009, 0x0110,
-+ 0x9085, 0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138, 0x00b6,
-+ 0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085, 0x0001,
-+ 0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007, 0x6134,
-+ 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b,
-+ 0x6023, 0x0005, 0x2001, 0x1987, 0x2004, 0x601a, 0x080c, 0x94f8,
-+ 0x080c, 0x9aaa, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024,
-+ 0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c, 0xd40b, 0x0030, 0x080c,
-+ 0xee80, 0x080c, 0x8a1e, 0x080c, 0xb2cc, 0x0005, 0x9280, 0x0008,
-+ 0x2004, 0x9084, 0x000f, 0x0002, 0xecba, 0xecba, 0xecba, 0xecbc,
-+ 0xecba, 0xecbc, 0xecbc, 0xecba, 0xecbc, 0xecba, 0xecba, 0xecba,
-+ 0xecba, 0xecba, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280,
-+ 0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xecd3, 0xecd3, 0xecd3,
-+ 0xecd3, 0xecd3, 0xecd3, 0xece0, 0xecd3, 0xecd3, 0xecd3, 0xecd3,
-+ 0xecd3, 0xecd3, 0xecd3, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017,
-+ 0x2a00, 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x0005,
-+ 0x0096, 0x00c6, 0x2260, 0x080c, 0xee80, 0x6043, 0x0000, 0x6024,
-+ 0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6, 0x2268,
-+ 0x9186, 0x0007, 0x1904, 0xed39, 0x6814, 0x9005, 0x0138, 0x2048,
-+ 0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007, 0x003a,
-+ 0x6003, 0x0001, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00c6, 0x2d60,
-+ 0x6100, 0x9186, 0x0002, 0x1904, 0xeda9, 0x6014, 0x9005, 0x1138,
-+ 0x6000, 0x9086, 0x0007, 0x190c, 0x0dc5, 0x0804, 0xeda9, 0x2048,
-+ 0x080c, 0xd0d1, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0,
-+ 0x2900, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x1168,
-+ 0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882, 0x2009,
-+ 0x0043, 0x080c, 0xe597, 0x0804, 0xeda9, 0x2009, 0x0041, 0x0804,
-+ 0xeda3, 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc,
-+ 0x1120, 0x00de, 0x009e, 0x0804, 0xecd3, 0xd0b4, 0x0128, 0xd0fc,
-+ 0x090c, 0x0dc5, 0x0804, 0xecf4, 0x6007, 0x003a, 0x6003, 0x0001,
-+ 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x00c6, 0x2d60, 0x6100, 0x9186,
-+ 0x0002, 0x0120, 0x9186, 0x0004, 0x1904, 0xeda9, 0x6814, 0x2048,
-+ 0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc, 0xa982,
-+ 0x00f6, 0x2c78, 0x080c, 0x1768, 0x00fe, 0x2009, 0x0042, 0x0498,
-+ 0x0036, 0x080c, 0x100e, 0x090c, 0x0dc5, 0xa867, 0x010d, 0x9006,
-+ 0xa802, 0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887, 0x0045, 0x2c00,
-+ 0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6010,
-+ 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004, 0x6354, 0xab7a, 0xa876,
-+ 0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001, 0x080c,
-+ 0x6e98, 0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xe73f, 0x2d00,
-+ 0x600a, 0x003e, 0x0038, 0x6043, 0x0000, 0x6003, 0x0007, 0x080c,
-+ 0xe597, 0x00ce, 0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128,
-+ 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178,
-+ 0x080c, 0x999e, 0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004,
-+ 0x080c, 0xebcd, 0x009e, 0x003e, 0x080c, 0x9aaa, 0x0005, 0x9186,
-+ 0x0014, 0x0d70, 0x080c, 0xb366, 0x0005, 0xeddc, 0xedda, 0xedda,
-+ 0xedda, 0xedda, 0xedda, 0xeddc, 0xedda, 0xedda, 0xedda, 0xedda,
-+ 0xedda, 0xedda, 0x080c, 0x0dc5, 0x080c, 0x999e, 0x6003, 0x000c,
-+ 0x080c, 0x9aaa, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085,
-+ 0x0208, 0x001a, 0x080c, 0xb366, 0x0005, 0xedfa, 0xedfa, 0xedfa,
-+ 0xedfa, 0xedfc, 0xee1c, 0xedfa, 0xedfa, 0xedfa, 0xedfa, 0xedfa,
-+ 0xedfa, 0xedfa, 0x080c, 0x0dc5, 0x00d6, 0x2c68, 0x080c, 0xb276,
-+ 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e, 0x210c,
-+ 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff, 0x6910,
-+ 0x6112, 0x6023, 0x0004, 0x080c, 0x94f8, 0x080c, 0x9aaa, 0x2d60,
-+ 0x080c, 0xb2cc, 0x00de, 0x0005, 0x080c, 0xb2cc, 0x0005, 0x00e6,
-+ 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee, 0x0005,
-+ 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002, 0x6024,
-+ 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988, 0x2004, 0x6042,
-+ 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009, 0x1867,
-+ 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006, 0x00d8,
-+ 0x2001, 0x1988, 0x200c, 0x2001, 0x1986, 0x2004, 0x9100, 0x9080,
-+ 0x000a, 0x6042, 0x6010, 0x00b6, 0x2058, 0xb8bc, 0x00be, 0x0008,
-+ 0x2104, 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a, 0x600f,
-+ 0x0000, 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6, 0x6154,
-+ 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x6054, 0x9106,
-+ 0x1138, 0x600c, 0x2072, 0x080c, 0x8a1e, 0x080c, 0xb2cc, 0x0010,
-+ 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e, 0x0005,
-+ 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x906d, 0x0130, 0x9c06,
-+ 0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de, 0x0005,
-+ 0x0026, 0x0036, 0x0156, 0x2011, 0x182c, 0x2204, 0x9084, 0x00ff,
-+ 0x2019, 0x026e, 0x2334, 0x96b4, 0x00ff, 0x9636, 0x1508, 0x8318,
-+ 0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011, 0x0270,
-+ 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c,
-+ 0xc372, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004, 0x6010,
-+ 0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xc372, 0x009e, 0x1100,
-+ 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c,
-+ 0x60ba, 0x080c, 0x3000, 0x00ee, 0x0005, 0x0096, 0x0026, 0x080c,
-+ 0x100e, 0x090c, 0x0dc5, 0xa85c, 0x9080, 0x001a, 0x20a0, 0x20a9,
-+ 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046, 0x1118,
-+ 0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041, 0x0110,
-+ 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294, 0xff00,
-+ 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038, 0x9084,
-+ 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c, 0x9294,
-+ 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244, 0x9294,
-+ 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2, 0x9186,
-+ 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a, 0x2204,
-+ 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210, 0x2204,
-+ 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210, 0x9186,
-+ 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6, 0x8210,
-+ 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be, 0x8210,
-+ 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013, 0x0001,
-+ 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210, 0x2204,
-+ 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011, 0x0260,
-+ 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x9186,
-+ 0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a, 0x0146,
-+ 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004, 0x8210,
-+ 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205, 0x2013,
-+ 0x0000, 0x002e, 0x080c, 0x6e98, 0x009e, 0x0005, 0x00e6, 0x6010,
-+ 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011, 0x00ee,
-+ 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6, 0x00c6,
-+ 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126, 0x2091,
-+ 0x8000, 0x2029, 0x19f1, 0x252c, 0x2021, 0x19f7, 0x2424, 0x2061,
-+ 0x1cd0, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578, 0x6720,
-+ 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500, 0x9c06,
-+ 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xec5b, 0x01b8, 0x080c,
-+ 0xec6b, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c,
-+ 0x1a8e, 0x001e, 0x080c, 0xd2c8, 0x1110, 0x080c, 0x3279, 0x080c,
-+ 0xd2d9, 0x1110, 0x080c, 0xbcaf, 0x080c, 0xb2ff, 0x9ce0, 0x0018,
-+ 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e, 0x001e,
-+ 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee,
-+ 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006, 0x2001,
-+ 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036, 0x0046,
-+ 0x080c, 0xd7dc, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128, 0x6010,
-+ 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c, 0x4df9,
-+ 0x004e, 0x003e, 0x000e, 0x0005, 0x6004, 0x9086, 0x0001, 0x1128,
-+ 0x080c, 0xac65, 0x080c, 0xb2ff, 0x9006, 0x0005, 0x00e6, 0x00c6,
-+ 0x00b6, 0x0046, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7454, 0x7074,
-+ 0x8001, 0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086,
-+ 0x0000, 0x0148, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1120, 0x6004,
-+ 0x9086, 0x0002, 0x0140, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004,
-+ 0x9c02, 0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x004e,
-+ 0x00be, 0x00ce, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4,
-+ 0x0160, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0138, 0x2001, 0x1848,
-+ 0x2004, 0xd0a4, 0x1118, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8,
-+ 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071, 0x1840,
-+ 0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118, 0x7000,
-+ 0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007, 0x908e,
-+ 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118,
-+ 0x2071, 0xfff6, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e, 0x0005,
-+ 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xffee, 0x0021,
-+ 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077, 0x1220,
-+ 0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071, 0xffec,
-+ 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff0, 0x0c69, 0x00ee,
-+ 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1840,
-+ 0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0003,
-+ 0x000b, 0x07d2, 0x0000, 0xc000, 0x0001, 0x8064, 0x0008, 0x0010,
-+ 0x0000, 0x8066, 0x0000, 0x0101, 0x0008, 0x4407, 0x0003, 0x8060,
-+ 0x0000, 0x0400, 0x0000, 0x580d, 0x000b, 0x79c0, 0x0003, 0x5106,
-+ 0x0003, 0x4c0a, 0x0003, 0xbac0, 0x0009, 0x008a, 0x0000, 0x0c0a,
-+ 0x000b, 0x15fe, 0x0008, 0x340a, 0x0003, 0xc4c0, 0x0009, 0x7000,
-+ 0x0000, 0xffa0, 0x0001, 0x2000, 0x0000, 0x1680, 0x000b, 0x808c,
-+ 0x0008, 0x0001, 0x0000, 0x0000, 0x0007, 0x4028, 0x0000, 0x4047,
-+ 0x000a, 0x808c, 0x0008, 0x0002, 0x0000, 0x0822, 0x0003, 0x4022,
-+ 0x0000, 0x0028, 0x000b, 0x4122, 0x0008, 0x94c0, 0x0009, 0xff00,
-+ 0x0008, 0xffe0, 0x0009, 0x0500, 0x0008, 0x0aab, 0x0003, 0x4447,
-+ 0x0002, 0x0ea8, 0x000b, 0x0bfe, 0x0008, 0x11a0, 0x0001, 0x1286,
-+ 0x0003, 0x0ca0, 0x0001, 0x1286, 0x0003, 0x9180, 0x0001, 0x0004,
-+ 0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066,
-+ 0x0000, 0x0009, 0x0008, 0x4436, 0x000b, 0x808c, 0x0008, 0x0000,
-+ 0x0008, 0x0060, 0x0008, 0x8062, 0x0008, 0x0004, 0x0000, 0x8066,
-+ 0x0000, 0x0411, 0x0000, 0x443e, 0x0003, 0x03fe, 0x0000, 0x43e0,
-+ 0x0001, 0x0e83, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008, 0x02e0,
-+ 0x0001, 0x0e83, 0x000b, 0x9180, 0x0001, 0x0005, 0x0008, 0x8060,
-+ 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0019,
-+ 0x0000, 0x444d, 0x000b, 0x0240, 0x0002, 0x0a80, 0x0003, 0x00fe,
-+ 0x0000, 0x3283, 0x000b, 0x0248, 0x000a, 0x085c, 0x0003, 0x9180,
-+ 0x0001, 0x0006, 0x0008, 0x7f62, 0x0008, 0x8002, 0x0008, 0x0003,
-+ 0x0008, 0x8066, 0x0000, 0x020a, 0x0000, 0x445b, 0x0003, 0x112a,
-+ 0x0000, 0x002e, 0x0008, 0x022c, 0x0008, 0x3a44, 0x0002, 0x0c0a,
-+ 0x000b, 0x808c, 0x0008, 0x0002, 0x0000, 0x1760, 0x0008, 0x8062,
-+ 0x0008, 0x000f, 0x0008, 0x8066, 0x0000, 0x0011, 0x0008, 0x4468,
-+ 0x0003, 0x01fe, 0x0008, 0x42e0, 0x0009, 0x0e74, 0x0003, 0x00fe,
-+ 0x0000, 0x43e0, 0x0001, 0x0e74, 0x0003, 0x1734, 0x0000, 0x1530,
-+ 0x0000, 0x1632, 0x0008, 0x0d2a, 0x0008, 0x9880, 0x0001, 0x0010,
-+ 0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066,
-+ 0x0000, 0x1e0a, 0x0008, 0x447a, 0x0003, 0x808a, 0x0008, 0x0003,
-+ 0x0008, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002, 0x0000, 0x5880,
-+ 0x000b, 0x8066, 0x0000, 0x3679, 0x0000, 0x4483, 0x0003, 0x5884,
-+ 0x0003, 0x3efe, 0x0008, 0x7f4f, 0x0002, 0x088a, 0x000b, 0x0d00,
-+ 0x0000, 0x0092, 0x000c, 0x8054, 0x0008, 0x0011, 0x0008, 0x8074,
-+ 0x0000, 0x1010, 0x0008, 0x1efe, 0x0000, 0x300a, 0x000b, 0x00e0,
-+ 0x000c, 0x000a, 0x000b, 0x00fe, 0x0000, 0x349a, 0x0003, 0x1a60,
-+ 0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0231,
-+ 0x0008, 0x4499, 0x000b, 0x03fe, 0x0000, 0x04d0, 0x0001, 0x0cd4,
-+ 0x000b, 0x82c0, 0x0001, 0x1f00, 0x0000, 0xffa0, 0x0001, 0x0400,
-+ 0x0000, 0x08b2, 0x0003, 0x14dc, 0x0003, 0x01fe, 0x0008, 0x0580,
-+ 0x0009, 0x7f06, 0x0000, 0x8690, 0x0009, 0x0000, 0x0008, 0x7f0c,
-+ 0x0000, 0x02fe, 0x0008, 0xffc0, 0x0001, 0x00ff, 0x0008, 0x0680,
-+ 0x0009, 0x10b2, 0x0003, 0x7f08, 0x0008, 0x84c0, 0x0001, 0xff00,
-+ 0x0008, 0x08d4, 0x0003, 0xb9c0, 0x0009, 0x0030, 0x0008, 0x0cc3,
-+ 0x000b, 0x8060, 0x0000, 0x0400, 0x0000, 0x80fe, 0x0008, 0x1a0a,
-+ 0x0009, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0409, 0x0000, 0x44bc,
-+ 0x0003, 0x80fe, 0x0008, 0x1a09, 0x0009, 0x7f62, 0x0008, 0x8066,
-+ 0x0000, 0x040a, 0x0000, 0x44c2, 0x0003, 0x00fe, 0x0000, 0x34ca,
-+ 0x0003, 0x8072, 0x0000, 0x1010, 0x0008, 0x3944, 0x0002, 0x08c5,
-+ 0x0003, 0x00ce, 0x0003, 0x8072, 0x0000, 0x2020, 0x0008, 0x3945,
-+ 0x000a, 0x08ca, 0x0003, 0x3946, 0x000a, 0x0cdb, 0x000b, 0x0000,
-+ 0x0007, 0x3943, 0x000a, 0x08db, 0x0003, 0x00ce, 0x0003, 0x00fe,
-+ 0x0000, 0x34d9, 0x000b, 0x8072, 0x0000, 0x1000, 0x0000, 0x00db,
-+ 0x000b, 0x8072, 0x0000, 0x2000, 0x0000, 0x4000, 0x000f, 0x86c0,
-+ 0x0009, 0xfc00, 0x0008, 0x08d4, 0x0003, 0x00b2, 0x000b, 0x1c60,
-+ 0x0000, 0x1b62, 0x0000, 0x8066, 0x0000, 0x0231, 0x0008, 0x44e4,
-+ 0x000b, 0x58e5, 0x000b, 0x0140, 0x0008, 0x0242, 0x0000, 0x1f43,
-+ 0x0002, 0x0cf3, 0x000b, 0x0d44, 0x0000, 0x0d46, 0x0008, 0x0348,
-+ 0x0008, 0x044a, 0x0008, 0x030a, 0x0008, 0x040c, 0x0000, 0x0d06,
-+ 0x0000, 0x0d08, 0x0008, 0x00f7, 0x0003, 0x0344, 0x0008, 0x0446,
-+ 0x0008, 0x0548, 0x0008, 0x064a, 0x0000, 0x1948, 0x000a, 0x08fa,
-+ 0x0003, 0x0d4a, 0x0008, 0x58fa, 0x0003, 0x3efe, 0x0008, 0x7f4f,
-+ 0x0002, 0x0901, 0x0003, 0x8000, 0x0000, 0x0001, 0x0000, 0x0092,
-+ 0x000c, 0x8054, 0x0008, 0x0001, 0x0000, 0x8074, 0x0000, 0x2020,
-+ 0x0008, 0x4000, 0x000f, 0x3a40, 0x000a, 0x0c0d, 0x0003, 0x2b24,
-+ 0x0008, 0x2b24, 0x0008, 0x590a, 0x000b, 0x8054, 0x0008, 0x0002,
-+ 0x0000, 0x1242, 0x0002, 0x0958, 0x0003, 0x3a45, 0x000a, 0x0947,
-+ 0x000b, 0x8072, 0x0000, 0x1000, 0x0000, 0x3945, 0x000a, 0x0917,
-+ 0x000b, 0x8072, 0x0000, 0x3010, 0x0000, 0x1e10, 0x000a, 0x7f3c,
-+ 0x0000, 0x0942, 0x000b, 0x1d00, 0x0002, 0x7f3a, 0x0000, 0x0d60,
-+ 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x4520,
-+ 0x000b, 0x00fe, 0x0000, 0x353f, 0x000b, 0x1c60, 0x0000, 0x8062,
-+ 0x0008, 0x0001, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x4528,
-+ 0x0003, 0x00fe, 0x0000, 0x325b, 0x000b, 0x0038, 0x0000, 0x0060,
-+ 0x0008, 0x8062, 0x0008, 0x0019, 0x0000, 0x8066, 0x0000, 0x0009,
-+ 0x0008, 0x4531, 0x000b, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f3e,
-+ 0x0008, 0x0d60, 0x0000, 0x0efe, 0x0008, 0x1f80, 0x0001, 0x7f62,
-+ 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x453b, 0x000b, 0x003a,
-+ 0x0008, 0x1dfe, 0x0000, 0x011c, 0x000b, 0x0036, 0x0008, 0x00e0,
-+ 0x000c, 0x0158, 0x000b, 0x8074, 0x0000, 0x2000, 0x0000, 0x8072,
-+ 0x0000, 0x2000, 0x0000, 0x0158, 0x000b, 0x3a44, 0x0002, 0x0a89,
-+ 0x0003, 0x8074, 0x0000, 0x1000, 0x0000, 0x8072, 0x0000, 0x1000,
-+ 0x0000, 0x2d0e, 0x0000, 0x2d0e, 0x0000, 0x3658, 0x0003, 0x26fe,
-+ 0x0008, 0x26fe, 0x0008, 0x2700, 0x0008, 0x2700, 0x0008, 0x00d0,
-+ 0x0009, 0x0d6a, 0x0003, 0x8074, 0x0000, 0x4040, 0x0008, 0x5958,
-+ 0x0003, 0x5106, 0x0003, 0x3a46, 0x000a, 0x0d6a, 0x0003, 0x3a47,
-+ 0x0002, 0x0965, 0x000b, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074,
-+ 0x0000, 0x8000, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x01b4,
-+ 0x0003, 0x92c0, 0x0009, 0x0fc8, 0x0000, 0x080a, 0x0003, 0x1246,
-+ 0x000a, 0x0e52, 0x000b, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002,
-+ 0x0000, 0x8066, 0x0000, 0x362a, 0x0000, 0x456f, 0x0003, 0x2000,
-+ 0x0000, 0x2000, 0x0000, 0x2102, 0x0000, 0x2102, 0x0000, 0x2204,
-+ 0x0000, 0x2204, 0x0000, 0x2306, 0x0000, 0x2306, 0x0000, 0x2408,
-+ 0x0000, 0x2408, 0x0000, 0x250a, 0x0000, 0x250a, 0x0000, 0x260c,
-+ 0x0000, 0x260c, 0x0000, 0x270e, 0x0000, 0x270e, 0x0000, 0x2810,
-+ 0x0000, 0x2810, 0x0000, 0x2912, 0x0000, 0x2912, 0x0000, 0x1a60,
-+ 0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0052,
-+ 0x0000, 0x4589, 0x000b, 0x92c0, 0x0009, 0x0780, 0x0008, 0x0e6e,
-+ 0x000b, 0x124b, 0x0002, 0x0992, 0x0003, 0x2e4d, 0x0002, 0x2e4d,
-+ 0x0002, 0x0a58, 0x0003, 0x3a46, 0x000a, 0x0da2, 0x000b, 0x5994,
-+ 0x0003, 0x8054, 0x0008, 0x0004, 0x0000, 0x1243, 0x000a, 0x09b0,
-+ 0x0003, 0x8010, 0x0008, 0x000d, 0x0000, 0x0233, 0x000c, 0x1948,
-+ 0x000a, 0x099f, 0x000b, 0x0228, 0x000c, 0x1810, 0x0000, 0x0233,
-+ 0x000c, 0x01b0, 0x000b, 0x1948, 0x000a, 0x09a6, 0x000b, 0x1243,
-+ 0x000a, 0x0a5b, 0x0003, 0x194d, 0x000a, 0x09aa, 0x000b, 0x1243,
-+ 0x000a, 0x0a62, 0x0003, 0x59aa, 0x000b, 0x8054, 0x0008, 0x0004,
-+ 0x0000, 0x0228, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c, 0x8074,
-+ 0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30,
-+ 0x0000, 0x3a42, 0x0002, 0x0dba, 0x000b, 0x15fe, 0x0008, 0x3461,
-+ 0x000b, 0x000a, 0x000b, 0x8074, 0x0000, 0x0501, 0x0000, 0x8010,
-+ 0x0008, 0x000c, 0x0008, 0x0233, 0x000c, 0x000a, 0x000b, 0xbbe0,
-+ 0x0009, 0x0030, 0x0008, 0x0dd0, 0x000b, 0x18fe, 0x0000, 0x3ce0,
-+ 0x0009, 0x09cd, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x09cd,
-+ 0x0003, 0x0223, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x0220,
-+ 0x000b, 0x8076, 0x0008, 0x0041, 0x0008, 0x0220, 0x000b, 0xbbe0,
-+ 0x0009, 0x0032, 0x0000, 0x0dd5, 0x000b, 0x3c1e, 0x0008, 0x0220,
-+ 0x000b, 0xbbe0, 0x0009, 0x003b, 0x0000, 0x0dda, 0x000b, 0x3c20,
-+ 0x0000, 0x0220, 0x000b, 0xbbe0, 0x0009, 0x0035, 0x0008, 0x0de0,
-+ 0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x039e, 0x0003, 0xbbe0,
-+ 0x0009, 0x0036, 0x0008, 0x0abd, 0x000b, 0xbbe0, 0x0009, 0x0037,
-+ 0x0000, 0x0e01, 0x000b, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0dcd,
-+ 0x000b, 0x8076, 0x0008, 0x0040, 0x0000, 0x1a60, 0x0000, 0x8062,
-+ 0x0008, 0x000d, 0x0000, 0x2604, 0x0008, 0x2604, 0x0008, 0x2706,
-+ 0x0008, 0x2706, 0x0008, 0x2808, 0x0000, 0x2808, 0x0000, 0x290a,
-+ 0x0000, 0x290a, 0x0000, 0x8066, 0x0000, 0x0422, 0x0000, 0x45f8,
-+ 0x000b, 0x0228, 0x000c, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074,
-+ 0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0xb000, 0x0000, 0x01b4,
-+ 0x0003, 0xbbe0, 0x0009, 0x0038, 0x0000, 0x0e13, 0x000b, 0x18fe,
-+ 0x0000, 0x3ce0, 0x0009, 0x0a10, 0x0003, 0x15fe, 0x0008, 0x3ce0,
-+ 0x0009, 0x0dc9, 0x0003, 0x0223, 0x0004, 0x8076, 0x0008, 0x0040,
-+ 0x0000, 0x8072, 0x0000, 0x8000, 0x0000, 0x0280, 0x000b, 0x8076,
-+ 0x0008, 0x0042, 0x0008, 0x0220, 0x000b, 0xbbe0, 0x0009, 0x0016,
-+ 0x0000, 0x0e20, 0x000b, 0x8074, 0x0000, 0x0808, 0x0008, 0x3a44,
-+ 0x0002, 0x0c0c, 0x000b, 0x8074, 0x0000, 0x0800, 0x0000, 0x8072,
-+ 0x0000, 0x8000, 0x0000, 0x8000, 0x000f, 0x000a, 0x000b, 0x8072,
-+ 0x0000, 0x8000, 0x0000, 0x000a, 0x000b, 0x3d30, 0x000a, 0x7f00,
-+ 0x0000, 0xbc80, 0x0001, 0x0007, 0x0000, 0x022c, 0x000b, 0x1930,
-+ 0x000a, 0x7f00, 0x0000, 0x9880, 0x0001, 0x0007, 0x0000, 0x8060,
-+ 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x000a,
-+ 0x0008, 0x4631, 0x000b, 0x4000, 0x000f, 0x2236, 0x000b, 0x0870,
-+ 0x0008, 0x4000, 0x000f, 0x7e33, 0x000b, 0xbbe0, 0x0009, 0x0030,
-+ 0x0008, 0x0e33, 0x0003, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0a44,
-+ 0x000b, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x0a44, 0x000b, 0x0223,
-+ 0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x0246, 0x000b, 0x8076,
-+ 0x0008, 0x0041, 0x0008, 0x8072, 0x0000, 0x8000, 0x0000, 0x0233,
-+ 0x0003, 0xbac0, 0x0009, 0x0090, 0x0008, 0x0a4f, 0x0003, 0x8074,
-+ 0x0000, 0x0706, 0x0000, 0x0251, 0x000b, 0x8074, 0x0000, 0x0703,
-+ 0x0000, 0x4000, 0x000f, 0x8010, 0x0008, 0x0023, 0x0000, 0x028e,
-+ 0x0003, 0x8010, 0x0008, 0x0008, 0x0000, 0x028e, 0x0003, 0x8010,
-+ 0x0008, 0x0022, 0x0008, 0x028e, 0x0003, 0x0228, 0x000c, 0x8010,
-+ 0x0008, 0x0007, 0x0000, 0x0233, 0x000c, 0x1810, 0x0000, 0x0233,
-+ 0x000c, 0x029a, 0x0003, 0x0228, 0x000c, 0x8010, 0x0008, 0x001b,
-+ 0x0008, 0x0233, 0x000c, 0x1810, 0x0000, 0x0233, 0x000c, 0x8074,
-+ 0x0000, 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30,
-+ 0x0000, 0x000a, 0x000b, 0x8010, 0x0008, 0x0009, 0x0008, 0x028e,
-+ 0x0003, 0x8010, 0x0008, 0x0005, 0x0008, 0x028e, 0x0003, 0x1648,
-+ 0x000a, 0x0c6f, 0x000b, 0x808c, 0x0008, 0x0001, 0x0000, 0x8010,
-+ 0x0008, 0x0004, 0x0000, 0x4143, 0x000a, 0x086f, 0x0003, 0x3a44,
-+ 0x0002, 0x0c0a, 0x000b, 0x0d2a, 0x0008, 0x028e, 0x0003, 0x8010,
-+ 0x0008, 0x0003, 0x0008, 0x0292, 0x000b, 0x8010, 0x0008, 0x000b,
-+ 0x0000, 0x0292, 0x000b, 0x8010, 0x0008, 0x0002, 0x0000, 0x0292,
-+ 0x000b, 0x3a47, 0x0002, 0x0d58, 0x000b, 0x8010, 0x0008, 0x0006,
-+ 0x0008, 0x0292, 0x000b, 0x8074, 0x0000, 0xf000, 0x0008, 0x8072,
-+ 0x0000, 0x3000, 0x0008, 0x0233, 0x000c, 0x0249, 0x0004, 0x3a40,
-+ 0x000a, 0x080a, 0x0003, 0x8010, 0x0008, 0x000c, 0x0008, 0x0233,
-+ 0x000c, 0x000a, 0x000b, 0x8074, 0x0000, 0xf080, 0x0000, 0x8072,
-+ 0x0000, 0x3000, 0x0008, 0x0d30, 0x0000, 0x2e4d, 0x0002, 0x2e4d,
-+ 0x0002, 0x0aa5, 0x000b, 0x8054, 0x0008, 0x0019, 0x0000, 0x000a,
-+ 0x000b, 0x8054, 0x0008, 0x0009, 0x0008, 0x000a, 0x000b, 0x3a44,
-+ 0x0002, 0x0c0a, 0x000b, 0x0283, 0x000b, 0x808c, 0x0008, 0x0000,
-+ 0x0008, 0x4447, 0x0002, 0x0ad1, 0x000b, 0xc0c0, 0x0001, 0x00ff,
-+ 0x0008, 0xffe0, 0x0009, 0x00ff, 0x0008, 0x0ea8, 0x000b, 0xc1e0,
-+ 0x0001, 0xffff, 0x0008, 0x0ea8, 0x000b, 0x8010, 0x0008, 0x0013,
-+ 0x0000, 0x0233, 0x000c, 0x8074, 0x0000, 0x0202, 0x0008, 0x000a,
-+ 0x000b, 0x3a40, 0x000a, 0x0ece, 0x000b, 0x8074, 0x0000, 0x0200,
-+ 0x0000, 0x3d00, 0x0000, 0x3cfe, 0x0000, 0x8072, 0x0000, 0x8000,
-+ 0x0000, 0x43e0, 0x0001, 0x0ecc, 0x0003, 0x42fe, 0x0000, 0xffc0,
-+ 0x0001, 0x00ff, 0x0008, 0x00e0, 0x0009, 0x0aa8, 0x0003, 0x0d08,
-+ 0x0008, 0x0321, 0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x000a,
-+ 0x000b, 0x03a7, 0x000c, 0x808c, 0x0008, 0x0001, 0x0000, 0x04fe,
-+ 0x0008, 0x338a, 0x0003, 0x0460, 0x0000, 0x8062, 0x0008, 0x0001,
-+ 0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x46db, 0x0003, 0x0004,
-+ 0x0000, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000, 0x80e0,
-+ 0x0001, 0x0004, 0x0000, 0x0af5, 0x000b, 0x80e0, 0x0001, 0x0005,
-+ 0x0008, 0x0af5, 0x000b, 0x80e0, 0x0001, 0x0006, 0x0008, 0x0af5,
-+ 0x000b, 0x82c0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008, 0x82e0,
-+ 0x0009, 0x0600, 0x0008, 0x0af5, 0x000b, 0x82e0, 0x0009, 0x0500,
-+ 0x0008, 0x0af5, 0x000b, 0x82e0, 0x0009, 0x0400, 0x0000, 0x0f8a,
-+ 0x0003, 0xc4c0, 0x0009, 0x7000, 0x0000, 0xffe0, 0x0009, 0x1000,
-+ 0x0000, 0x0b21, 0x0003, 0x0398, 0x000c, 0x3941, 0x0002, 0x0b00,
-+ 0x0003, 0x8072, 0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x0460,
-+ 0x0000, 0x80fe, 0x0008, 0x002b, 0x0008, 0x7f62, 0x0008, 0x8066,
-+ 0x0000, 0x2209, 0x0008, 0x4706, 0x000b, 0x11fe, 0x0000, 0x331c,
-+ 0x0003, 0x9180, 0x0001, 0x0002, 0x0000, 0x8060, 0x0000, 0x0400,
-+ 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008, 0x4710,
-+ 0x0003, 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008, 0x03e0,
-+ 0x0009, 0x0f19, 0x0003, 0x8072, 0x0000, 0x0400, 0x0000, 0x0046,
-+ 0x0003, 0x9180, 0x0001, 0x0003, 0x0008, 0x0303, 0x000b, 0x8072,
-+ 0x0000, 0x0400, 0x0000, 0x8010, 0x0008, 0x0010, 0x0000, 0x037b,
-+ 0x000b, 0x0398, 0x000c, 0x3941, 0x0002, 0x0b27, 0x0003, 0x8072,
-+ 0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x1042, 0x000a, 0x0b2c,
-+ 0x000b, 0x0360, 0x0004, 0x11fe, 0x0000, 0x3731, 0x000b, 0x8072,
-+ 0x0000, 0x0400, 0x0000, 0x8010, 0x0008, 0x000e, 0x0000, 0x037b,
-+ 0x000b, 0x8060, 0x0000, 0x0400, 0x0000, 0x04fe, 0x0008, 0x3746,
-+ 0x000b, 0x808c, 0x0008, 0x0000, 0x0008, 0x9180, 0x0001, 0x0005,
-+ 0x0008, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x473c,
-+ 0x000b, 0x0060, 0x0008, 0x8062, 0x0008, 0x001b, 0x0008, 0x4304,
-+ 0x0008, 0x4206, 0x0008, 0x8066, 0x0000, 0x0412, 0x0000, 0x4744,
-+ 0x000b, 0x035d, 0x0003, 0x808c, 0x0008, 0x0001, 0x0000, 0x0460,
-+ 0x0000, 0x8062, 0x0008, 0x002b, 0x0008, 0x8066, 0x0000, 0x0609,
-+ 0x0008, 0x474d, 0x000b, 0x8066, 0x0000, 0x220a, 0x0008, 0x4750,
-+ 0x000b, 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008, 0x7f04,
-+ 0x0008, 0x8060, 0x0000, 0x0400, 0x0000, 0x9180, 0x0001, 0x0002,
-+ 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x041a, 0x0008, 0x475c,
-+ 0x000b, 0x8072, 0x0000, 0x0400, 0x0000, 0x0046, 0x0003, 0x8060,
-+ 0x0000, 0x0400, 0x0000, 0x1362, 0x0008, 0x8066, 0x0000, 0x0411,
-+ 0x0000, 0x4765, 0x000b, 0x02fe, 0x0008, 0x03e0, 0x0009, 0x0f6b,
-+ 0x0003, 0x0d22, 0x0000, 0x4000, 0x000f, 0x8280, 0x0009, 0x0002,
-+ 0x0000, 0x1380, 0x0001, 0x7f62, 0x0008, 0x8066, 0x0000, 0x2209,
-+ 0x0008, 0x4771, 0x000b, 0x0200, 0x000a, 0xffc0, 0x0001, 0x0007,
-+ 0x0000, 0x7f06, 0x0000, 0x1362, 0x0008, 0x8066, 0x0000, 0x060a,
-+ 0x0008, 0x4779, 0x0003, 0x4000, 0x000f, 0x3a44, 0x0002, 0x0c0a,
-+ 0x000b, 0x2f44, 0x000a, 0x2f44, 0x000a, 0x0e83, 0x000b, 0x808a,
-+ 0x0008, 0x0003, 0x0008, 0x8074, 0x0000, 0xf080, 0x0000, 0x8072,
-+ 0x0000, 0x3000, 0x0008, 0x5b86, 0x000b, 0x8054, 0x0008, 0x0019,
-+ 0x0000, 0x000a, 0x000b, 0x3a44, 0x0002, 0x0c0a, 0x000b, 0x808c,
-+ 0x0008, 0x0000, 0x0008, 0x8010, 0x0008, 0x0011, 0x0008, 0x0233,
-+ 0x000c, 0x42fe, 0x0000, 0xffc0, 0x0001, 0x00ff, 0x0008, 0x7f10,
-+ 0x0008, 0x0233, 0x000c, 0x4310, 0x0008, 0x0292, 0x000b, 0x3941,
-+ 0x0002, 0x0b9b, 0x000b, 0x4000, 0x000f, 0x8072, 0x0000, 0x0404,
-+ 0x0008, 0x4000, 0x000f, 0x8010, 0x0008, 0x0012, 0x0008, 0x0233,
-+ 0x000c, 0x0360, 0x0004, 0x1110, 0x0000, 0x0233, 0x000c, 0x11fe,
-+ 0x0000, 0x37a1, 0x000b, 0x000a, 0x000b, 0xc2c0, 0x0009, 0x00ff,
-+ 0x0008, 0x7f00, 0x0000, 0xc3c0, 0x0001, 0xff00, 0x0008, 0x00d0,
-+ 0x0009, 0x0bcc, 0x0003, 0x0d0a, 0x0000, 0x8580, 0x0001, 0x1000,
-+ 0x0000, 0x7f62, 0x0008, 0x8060, 0x0000, 0x0400, 0x0000, 0x8066,
-+ 0x0000, 0x0809, 0x0000, 0x47b6, 0x0003, 0x04fe, 0x0008, 0x33c5,
-+ 0x000b, 0x0460, 0x0000, 0x8062, 0x0008, 0x0004, 0x0000, 0x8066,
-+ 0x0000, 0x0211, 0x0000, 0x47be, 0x000b, 0x01fe, 0x0008, 0x00e0,
-+ 0x0009, 0x0fc5, 0x000b, 0x02fe, 0x0008, 0x43e0, 0x0001, 0x0bcb,
-+ 0x000b, 0x0500, 0x0002, 0x7f0a, 0x0000, 0xffe0, 0x0009, 0x0800,
-+ 0x0000, 0x0faf, 0x000b, 0x0d08, 0x0008, 0x4000, 0x000f, 0x43fe,
-+ 0x0008, 0x3e80, 0x0001, 0xffc0, 0x0001, 0x7fff, 0x0000, 0x0d60,
-+ 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0809, 0x0000, 0x47d4,
-+ 0x000b, 0x8060, 0x0000, 0x0400, 0x0000, 0x84c0, 0x0001, 0xff00,
-+ 0x0008, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60,
-+ 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60,
-+ 0x000a, 0xff80, 0x0009, 0x1000, 0x0000, 0x7f62, 0x0008, 0x8066,
-+ 0x0000, 0x0809, 0x0000, 0x47e6, 0x0003, 0x4000, 0x000f, 0x8d5b,
-+ 0xeac4, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040,
-+ 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000,
-+ 0x8000, 0x8044
- };
- #ifdef UNIQUE_FW_NAME
--unsigned short fw2300ipx_length01 = 0xf091;
-+unsigned short fw2300ipx_length01 = 0xf08a;
- #else
--unsigned short risc_code_length01 = 0xf091;
-+unsigned short risc_code_length01 = 0xf08a;
- #endif
-
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2322.c ./drivers/scsi/qla2xxx/ql2322.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2322.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2322.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,10 +1,9 @@
- /*
-- * QLogic ISP2322 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * Released under GPL v2.
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
--
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/pci.h>
-@@ -53,6 +52,11 @@ static struct qla_board_info qla_board_t
- .isp_name = "ISP2322",
- .fw_info = qla_fw_tbl,
- },
-+ {
-+ .drv_name = qla_driver_name,
-+ .isp_name = "ISP6322",
-+ .fw_info = qla_fw_tbl,
-+ },
- };
-
- static struct pci_device_id qla2322_pci_tbl[] = {
-@@ -63,6 +67,13 @@ static struct pci_device_id qla2322_pci_
- .subdevice = PCI_ANY_ID,
- .driver_data = (unsigned long)&qla_board_tbl[0],
- },
-+ {
-+ .vendor = PCI_VENDOR_ID_QLOGIC,
-+ .device = PCI_DEVICE_ID_QLOGIC_ISP6322,
-+ .subvendor = PCI_ANY_ID,
-+ .subdevice = PCI_ANY_ID,
-+ .driver_data = (unsigned long)&qla_board_tbl[0],
-+ },
- {0, 0},
- };
- MODULE_DEVICE_TABLE(pci, qla2322_pci_tbl);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2322_fw.c ./drivers/scsi/qla2xxx/ql2322_fw.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2322_fw.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2322_fw.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,24 +1,12 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
-- * Firmware Version 3.03.20 (15:42 Feb 01, 2006)
-+ * Firmware Version 3.03.19 (09:43 Nov 30, 2005)
- */
-
- #ifdef UNIQUE_FW_NAME
-@@ -28,15 +16,15 @@ unsigned short risc_code_version = 3*102
- #endif
-
- #ifdef UNIQUE_FW_NAME
--unsigned char fw2322ipx_version_str[] = {3, 3,20};
-+unsigned char fw2322ipx_version_str[] = {3, 3,19};
- #else
--unsigned char firmware_version[] = {3, 3,20};
-+unsigned char firmware_version[] = {3, 3,19};
- #endif
-
- #ifdef UNIQUE_FW_NAME
--#define fw2322ipx_VERSION_STRING "3.03.20"
-+#define fw2322ipx_VERSION_STRING "3.03.19"
- #else
--#define FW_VERSION_STRING "3.03.20"
-+#define FW_VERSION_STRING "3.03.19"
- #endif
-
- #ifdef UNIQUE_FW_NAME
-@@ -50,12 +38,12 @@ unsigned short fw2322ipx_code01[] = {
- #else
- unsigned short risc_code01[] = {
- #endif
-- 0x0470, 0x0000, 0x0000, 0xe719, 0x0000, 0x0003, 0x0003, 0x0014,
-+ 0x0470, 0x0000, 0x0000, 0xe700, 0x0000, 0x0003, 0x0003, 0x0013,
- 0x0137, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
- 0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
- 0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
- 0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-- 0x332e, 0x3033, 0x2e32, 0x3020, 0x2020, 0x2020, 0x2400, 0x20a9,
-+ 0x332e, 0x3033, 0x2e31, 0x3920, 0x2020, 0x2020, 0x2400, 0x20a9,
- 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
- 0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
- 0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
-@@ -82,11 +70,11 @@ unsigned short risc_code01[] = {
- 0x20a8, 0x900e, 0x4104, 0x2009, 0x1800, 0x810d, 0x810d, 0x810d,
- 0x810d, 0x810d, 0x918c, 0x001f, 0x2001, 0x0001, 0x9112, 0x20e9,
- 0x0001, 0x20a1, 0x0800, 0x900e, 0x20a9, 0x0800, 0x4104, 0x8211,
-- 0x1dd8, 0x080c, 0x0f71, 0x080c, 0x61ab, 0x080c, 0xb102, 0x080c,
-- 0x1128, 0x080c, 0x1352, 0x080c, 0x1c1c, 0x080c, 0x9582, 0x080c,
-- 0x0d17, 0x080c, 0x10ad, 0x080c, 0x358e, 0x080c, 0x7aca, 0x080c,
-- 0x6cea, 0x080c, 0x8c5d, 0x080c, 0x88be, 0x080c, 0x22bf, 0x080c,
-- 0x81f5, 0x080c, 0x20f5, 0x080c, 0x2233, 0x080c, 0x22b4, 0x2091,
-+ 0x1dd8, 0x080c, 0x0f71, 0x080c, 0x61a4, 0x080c, 0xb0ed, 0x080c,
-+ 0x1128, 0x080c, 0x1352, 0x080c, 0x1c1c, 0x080c, 0x9572, 0x080c,
-+ 0x0d17, 0x080c, 0x10ad, 0x080c, 0x358e, 0x080c, 0x7aba, 0x080c,
-+ 0x6cda, 0x080c, 0x8c4d, 0x080c, 0x88ae, 0x080c, 0x22bf, 0x080c,
-+ 0x81e5, 0x080c, 0x20f5, 0x080c, 0x2233, 0x080c, 0x22b4, 0x2091,
- 0x3009, 0x7883, 0x0000, 0x1004, 0x0943, 0x7880, 0x9086, 0x0002,
- 0x1190, 0x7883, 0x4000, 0x7837, 0x4000, 0x7833, 0x0010, 0x0e04,
- 0x0937, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-@@ -94,57 +82,57 @@ unsigned short risc_code01[] = {
- 0x9084, 0x0030, 0x9086, 0x0020, 0x1168, 0x7034, 0xc08d, 0x7036,
- 0x2001, 0x0050, 0x7076, 0x707a, 0x7056, 0x606b, 0x269c, 0x2071,
- 0x1b73, 0x2072, 0x2071, 0x1800, 0x7000, 0x908e, 0x0003, 0x1168,
-- 0x080c, 0x4d66, 0x080c, 0x35b5, 0x080c, 0x7b32, 0x080c, 0x7275,
-- 0x080c, 0x8d44, 0x080c, 0x88e7, 0x0c68, 0x000b, 0x0c88, 0x0979,
-+ 0x080c, 0x4d64, 0x080c, 0x35b5, 0x080c, 0x7b22, 0x080c, 0x7265,
-+ 0x080c, 0x8d34, 0x080c, 0x88d7, 0x0c68, 0x000b, 0x0c88, 0x0979,
- 0x097a, 0x0b15, 0x0977, 0x0bcf, 0x0d16, 0x0d16, 0x0d16, 0x080c,
- 0x0d85, 0x0005, 0x0126, 0x00f6, 0x2091, 0x8000, 0x7000, 0x9086,
-- 0x0001, 0x1904, 0x0ae8, 0x080c, 0x0ec4, 0x080c, 0x779e, 0x0150,
-- 0x080c, 0x77c1, 0x15b0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800,
-- 0x782a, 0x0478, 0x080c, 0x76cd, 0x7000, 0x9086, 0x0001, 0x1904,
-- 0x0ae8, 0x7098, 0x9086, 0x0029, 0x1904, 0x0ae8, 0x080c, 0x88a7,
-- 0x080c, 0x8899, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079, 0x0100,
-+ 0x0001, 0x1904, 0x0ae8, 0x080c, 0x0ec4, 0x080c, 0x778e, 0x0150,
-+ 0x080c, 0x77b1, 0x15b0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800,
-+ 0x782a, 0x0478, 0x080c, 0x76bd, 0x7000, 0x9086, 0x0001, 0x1904,
-+ 0x0ae8, 0x7098, 0x9086, 0x0029, 0x1904, 0x0ae8, 0x080c, 0x8897,
-+ 0x080c, 0x8889, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079, 0x0100,
- 0x2011, 0xffff, 0x080c, 0x2ad3, 0x7a28, 0x9295, 0x5e2c, 0x7a2a,
-- 0x2011, 0x7612, 0x080c, 0x8993, 0x2011, 0x7605, 0x080c, 0x8a9f,
-- 0x2011, 0x6002, 0x080c, 0x8993, 0x2011, 0x8030, 0x901e, 0x7396,
-- 0x04d0, 0x080c, 0x58aa, 0x2079, 0x0100, 0x7844, 0x9005, 0x1904,
-- 0x0ae8, 0x2011, 0x6002, 0x080c, 0x8993, 0x2011, 0x7612, 0x080c,
-- 0x8993, 0x2011, 0x7605, 0x080c, 0x8a9f, 0x2001, 0x0265, 0x2001,
-+ 0x2011, 0x7602, 0x080c, 0x8983, 0x2011, 0x75f5, 0x080c, 0x8a8f,
-+ 0x2011, 0x5ffb, 0x080c, 0x8983, 0x2011, 0x8030, 0x901e, 0x7396,
-+ 0x04d0, 0x080c, 0x58a8, 0x2079, 0x0100, 0x7844, 0x9005, 0x1904,
-+ 0x0ae8, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x2011, 0x7602, 0x080c,
-+ 0x8983, 0x2011, 0x75f5, 0x080c, 0x8a8f, 0x2001, 0x0265, 0x2001,
- 0x0205, 0x2003, 0x0000, 0x7840, 0x9084, 0xfffb, 0x7842, 0x2001,
- 0x19a7, 0x2004, 0x9005, 0x1140, 0x00c6, 0x2061, 0x0100, 0x080c,
-- 0x6153, 0x00ce, 0x0804, 0x0ae8, 0x780f, 0x006b, 0x7a28, 0x080c,
-- 0x77a6, 0x0118, 0x9295, 0x5e2c, 0x0010, 0x9295, 0x402c, 0x7a2a,
-+ 0x614c, 0x00ce, 0x0804, 0x0ae8, 0x780f, 0x006b, 0x7a28, 0x080c,
-+ 0x7796, 0x0118, 0x9295, 0x5e2c, 0x0010, 0x9295, 0x402c, 0x7a2a,
- 0x2011, 0x8010, 0x73d8, 0x2001, 0x19a8, 0x2003, 0x0001, 0x080c,
-- 0x299b, 0x080c, 0x4ca1, 0x7248, 0xc284, 0x724a, 0x2001, 0x180c,
-+ 0x299b, 0x080c, 0x4c9f, 0x7248, 0xc284, 0x724a, 0x2001, 0x180c,
- 0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x2001, 0x0390, 0x2003, 0x0400,
-- 0x080c, 0xacfc, 0x080c, 0xa4f1, 0x2011, 0x0004, 0x080c, 0xcf2b,
-- 0x080c, 0xad18, 0x080c, 0x6ab1, 0x080c, 0x779e, 0x1120, 0x080c,
-- 0x29fc, 0x0600, 0x0420, 0x080c, 0x615a, 0x0140, 0x7097, 0x0001,
-- 0x70d3, 0x0000, 0x080c, 0x5a7c, 0x0804, 0x0ae8, 0x2001, 0x0390,
-- 0x2003, 0x0404, 0x080c, 0x5840, 0xd094, 0x0188, 0x2011, 0x180c,
-- 0x2204, 0xc0cd, 0x2012, 0x080c, 0x5844, 0xd0d4, 0x1118, 0x080c,
-+ 0x080c, 0xacec, 0x080c, 0xa4e1, 0x2011, 0x0004, 0x080c, 0xcf18,
-+ 0x080c, 0xad08, 0x080c, 0x6aa1, 0x080c, 0x778e, 0x1120, 0x080c,
-+ 0x29fc, 0x0600, 0x0420, 0x080c, 0x6153, 0x0140, 0x7097, 0x0001,
-+ 0x70d3, 0x0000, 0x080c, 0x5a75, 0x0804, 0x0ae8, 0x2001, 0x0390,
-+ 0x2003, 0x0404, 0x080c, 0x583e, 0xd094, 0x0188, 0x2011, 0x180c,
-+ 0x2204, 0xc0cd, 0x2012, 0x080c, 0x5842, 0xd0d4, 0x1118, 0x080c,
- 0x29fc, 0x1270, 0x2011, 0x180c, 0x2204, 0xc0bc, 0x00a8, 0x080c,
-- 0x5844, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x0060,
-- 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x6c09, 0x1128,
-- 0xd0a4, 0x0118, 0x2204, 0xc0fd, 0x2012, 0x080c, 0x6bcf, 0x0120,
-- 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8, 0x707f, 0x0000, 0x080c, 0x779e,
-- 0x1130, 0x70b0, 0x9005, 0x1168, 0x080c, 0xd389, 0x0050, 0x080c,
-- 0xd389, 0x70dc, 0xd09c, 0x1128, 0x70b0, 0x9005, 0x0110, 0x080c,
-- 0x6130, 0x70e7, 0x0000, 0x70e3, 0x0000, 0x70a7, 0x0000, 0x080c,
-+ 0x5842, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x0060,
-+ 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x6bf9, 0x1128,
-+ 0xd0a4, 0x0118, 0x2204, 0xc0fd, 0x2012, 0x080c, 0x6bbf, 0x0120,
-+ 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8, 0x707f, 0x0000, 0x080c, 0x778e,
-+ 0x1130, 0x70b0, 0x9005, 0x1168, 0x080c, 0xd376, 0x0050, 0x080c,
-+ 0xd376, 0x70dc, 0xd09c, 0x1128, 0x70b0, 0x9005, 0x0110, 0x080c,
-+ 0x6129, 0x70e7, 0x0000, 0x70e3, 0x0000, 0x70a7, 0x0000, 0x080c,
- 0x2a04, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x72dc,
-- 0x080c, 0x779e, 0x1178, 0x9016, 0x0016, 0x080c, 0x27a4, 0x2019,
-+ 0x080c, 0x778e, 0x1178, 0x9016, 0x0016, 0x080c, 0x27a4, 0x2019,
- 0x196d, 0x211a, 0x001e, 0x705f, 0xffff, 0x7063, 0x00ef, 0x7083,
- 0x0000, 0x0020, 0x2019, 0x196d, 0x201b, 0x0000, 0x2079, 0x1847,
-- 0x7804, 0xd0ac, 0x0108, 0xc295, 0x72de, 0x080c, 0x779e, 0x0118,
-- 0x9296, 0x0004, 0x0518, 0x2011, 0x0001, 0x080c, 0xcf2b, 0x70ab,
-+ 0x7804, 0xd0ac, 0x0108, 0xc295, 0x72de, 0x080c, 0x778e, 0x0118,
-+ 0x9296, 0x0004, 0x0518, 0x2011, 0x0001, 0x080c, 0xcf18, 0x70ab,
- 0x0000, 0x70af, 0xffff, 0x7003, 0x0002, 0x00fe, 0x080c, 0x30bf,
-- 0x080c, 0xacfc, 0x2011, 0x0005, 0x080c, 0xa62b, 0x080c, 0xad18,
-- 0x080c, 0x779e, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c,
-+ 0x080c, 0xacec, 0x2011, 0x0005, 0x080c, 0xa61b, 0x080c, 0xad08,
-+ 0x080c, 0x778e, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c,
- 0x27a4, 0x61e2, 0x001e, 0x00ce, 0x012e, 0x00e0, 0x70ab, 0x0000,
-- 0x70af, 0xffff, 0x7003, 0x0002, 0x080c, 0xacfc, 0x2011, 0x0005,
-- 0x080c, 0xa62b, 0x080c, 0xad18, 0x080c, 0x779e, 0x0148, 0x00c6,
-+ 0x70af, 0xffff, 0x7003, 0x0002, 0x080c, 0xacec, 0x2011, 0x0005,
-+ 0x080c, 0xa61b, 0x080c, 0xad08, 0x080c, 0x778e, 0x0148, 0x00c6,
- 0x2061, 0x0100, 0x0016, 0x080c, 0x27a4, 0x61e2, 0x001e, 0x00ce,
-- 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6, 0x080c, 0x779e, 0x1118,
-- 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c, 0x779e, 0x1110,
-+ 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6, 0x080c, 0x778e, 0x1118,
-+ 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c, 0x778e, 0x1110,
- 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff, 0x0138, 0x9180, 0x1000,
- 0x2004, 0x905d, 0x0110, 0xb800, 0xd0bc, 0x090c, 0x341e, 0x8108,
- 0x1f04, 0x0afc, 0x707f, 0x0000, 0x7080, 0x9084, 0x00ff, 0x7082,
-@@ -154,26 +142,26 @@ unsigned short risc_code01[] = {
- 0x1110, 0xd09c, 0x0538, 0xd084, 0x0528, 0x0006, 0x2001, 0x0103,
- 0x2003, 0x002b, 0x000e, 0xd08c, 0x01e8, 0x080c, 0x3487, 0x11b0,
- 0x70e0, 0x9086, 0xffff, 0x0190, 0x080c, 0x327b, 0x70dc, 0xd094,
-- 0x1904, 0x0bcc, 0x2011, 0x0001, 0x080c, 0xd645, 0x0110, 0x2011,
-+ 0x1904, 0x0bcc, 0x2011, 0x0001, 0x080c, 0xd632, 0x0110, 0x2011,
- 0x0003, 0x901e, 0x080c, 0x32b5, 0x0804, 0x0bcc, 0x70e4, 0x9005,
- 0x1904, 0x0bcc, 0x70a8, 0x9005, 0x1904, 0x0bcc, 0x70dc, 0xd0a4,
-- 0x0118, 0xd0b4, 0x0904, 0x0bcc, 0x080c, 0x6bcf, 0x1904, 0x0bcc,
-- 0x080c, 0x6c22, 0x1904, 0x0bcc, 0x080c, 0x6c09, 0x01c0, 0x0156,
-- 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67b4, 0x1118,
-+ 0x0118, 0xd0b4, 0x0904, 0x0bcc, 0x080c, 0x6bbf, 0x1904, 0x0bcc,
-+ 0x080c, 0x6c12, 0x1904, 0x0bcc, 0x080c, 0x6bf9, 0x01c0, 0x0156,
-+ 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67ad, 0x1118,
- 0xb800, 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04, 0x0b6c, 0x00ce,
- 0x015e, 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804, 0x0bcc, 0x0006,
- 0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0x2011, 0x19b4, 0x080c,
- 0x0fe1, 0x2011, 0x19ce, 0x080c, 0x0fe1, 0x7030, 0xc08c, 0x7032,
- 0x7003, 0x0003, 0x70af, 0xffff, 0x080c, 0x0e98, 0x9006, 0x080c,
-- 0x2631, 0x080c, 0x3487, 0x0118, 0x080c, 0x4e3e, 0x0050, 0x0036,
-- 0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4e58, 0x004e,
-- 0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x77c1, 0x0150, 0x080c,
-- 0x779e, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf,
-- 0x782a, 0x00fe, 0x080c, 0xacfc, 0x2001, 0x19e9, 0x2004, 0x9086,
-- 0x0005, 0x1120, 0x2011, 0x0000, 0x080c, 0xa62b, 0x2011, 0x0000,
-- 0x080c, 0xa635, 0x080c, 0xad18, 0x012e, 0x00be, 0x0005, 0x0016,
-+ 0x2631, 0x080c, 0x3487, 0x0118, 0x080c, 0x4e3c, 0x0050, 0x0036,
-+ 0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4e56, 0x004e,
-+ 0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x77b1, 0x0150, 0x080c,
-+ 0x778e, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf,
-+ 0x782a, 0x00fe, 0x080c, 0xacec, 0x2001, 0x19e9, 0x2004, 0x9086,
-+ 0x0005, 0x1120, 0x2011, 0x0000, 0x080c, 0xa61b, 0x2011, 0x0000,
-+ 0x080c, 0xa625, 0x080c, 0xad08, 0x012e, 0x00be, 0x0005, 0x0016,
- 0x0026, 0x0046, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100,
-- 0x7904, 0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x6119,
-+ 0x7904, 0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x6112,
- 0x7940, 0x918c, 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0120, 0x2011,
- 0x0040, 0x080c, 0x2ad3, 0xd19c, 0x0120, 0x2011, 0x0008, 0x080c,
- 0x2ad3, 0x0006, 0x0036, 0x0156, 0x0000, 0x2001, 0x19a8, 0x2004,
-@@ -182,26 +170,26 @@ unsigned short risc_code01[] = {
- 0x1138, 0x9006, 0x080c, 0x29ca, 0x9006, 0x080c, 0x29ad, 0x0068,
- 0x080c, 0x2a77, 0x1d50, 0x2001, 0x1998, 0x2004, 0xd0fc, 0x0108,
- 0x0020, 0x080c, 0x27d8, 0x0804, 0x0cc9, 0x20a9, 0x003a, 0x1d04,
-- 0x0c1f, 0x080c, 0x8a7f, 0x1f04, 0x0c1f, 0x080c, 0x77af, 0x0148,
-- 0x080c, 0x77c1, 0x1118, 0x080c, 0x7ac5, 0x0050, 0x080c, 0x77a6,
-- 0x0dd0, 0x080c, 0x7ac0, 0x080c, 0x7ab6, 0x080c, 0x76cd, 0x0020,
-- 0x2009, 0x00f8, 0x080c, 0x6119, 0x7850, 0xc0e5, 0x7852, 0x080c,
-- 0x779e, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
-- 0x2019, 0xea60, 0x0d0c, 0x8a7f, 0x7820, 0xd09c, 0x15a0, 0x080c,
-- 0x779e, 0x0904, 0x0cab, 0x7824, 0xd0ac, 0x1904, 0x0cce, 0x080c,
-- 0x77c1, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
-+ 0x0c1f, 0x080c, 0x8a6f, 0x1f04, 0x0c1f, 0x080c, 0x779f, 0x0148,
-+ 0x080c, 0x77b1, 0x1118, 0x080c, 0x7ab5, 0x0050, 0x080c, 0x7796,
-+ 0x0dd0, 0x080c, 0x7ab0, 0x080c, 0x7aa6, 0x080c, 0x76bd, 0x0020,
-+ 0x2009, 0x00f8, 0x080c, 0x6112, 0x7850, 0xc0e5, 0x7852, 0x080c,
-+ 0x778e, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
-+ 0x2019, 0xea60, 0x0d0c, 0x8a6f, 0x7820, 0xd09c, 0x15a0, 0x080c,
-+ 0x778e, 0x0904, 0x0cab, 0x7824, 0xd0ac, 0x1904, 0x0cce, 0x080c,
-+ 0x77b1, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
- 0x2011, 0x1800, 0x080c, 0x2ad3, 0x080c, 0x2a7f, 0x7824, 0x9084,
- 0x1800, 0x1168, 0x9484, 0x0fff, 0x1140, 0x2001, 0x1810, 0x2004,
- 0x9084, 0x9000, 0x0110, 0x080c, 0x0cf1, 0x8421, 0x1160, 0x1d04,
-- 0x0c7b, 0x080c, 0x8a7f, 0x080c, 0x7ac0, 0x080c, 0x7ab6, 0x7003,
-+ 0x0c7b, 0x080c, 0x8a6f, 0x080c, 0x7ab0, 0x080c, 0x7aa6, 0x7003,
- 0x0001, 0x0804, 0x0cce, 0x8319, 0x1928, 0x2001, 0x1810, 0x2004,
- 0x9084, 0x9000, 0x0110, 0x080c, 0x0cf1, 0x1d04, 0x0c91, 0x080c,
-- 0x8a7f, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
-+ 0x8a6f, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
- 0x1188, 0x200b, 0x000a, 0x2011, 0x0048, 0x080c, 0x2ad3, 0x20a9,
- 0x0002, 0x080c, 0x2a60, 0x7924, 0x080c, 0x2a7f, 0xd19c, 0x0110,
-- 0x080c, 0x299b, 0x00f0, 0x080c, 0x77af, 0x1140, 0x94a2, 0x03e8,
-- 0x1128, 0x080c, 0x7772, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
-- 0x080c, 0x2ad3, 0x080c, 0x2a7f, 0x7824, 0x080c, 0x77b8, 0x0110,
-+ 0x080c, 0x299b, 0x00f0, 0x080c, 0x779f, 0x1140, 0x94a2, 0x03e8,
-+ 0x1128, 0x080c, 0x7762, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
-+ 0x080c, 0x2ad3, 0x080c, 0x2a7f, 0x7824, 0x080c, 0x77a8, 0x0110,
- 0xd0ac, 0x1160, 0x9084, 0x1800, 0x0904, 0x0c83, 0x7003, 0x0001,
- 0x0028, 0x2001, 0x0001, 0x080c, 0x2631, 0x00a0, 0x7850, 0xc0e4,
- 0x7852, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d,
-@@ -209,20 +197,20 @@ unsigned short risc_code01[] = {
- 0x0028, 0x782a, 0x2001, 0x19a8, 0x2003, 0x0000, 0x9006, 0x78f2,
- 0x015e, 0x003e, 0x000e, 0x012e, 0x00fe, 0x004e, 0x002e, 0x001e,
- 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x00b6, 0x00c6,
-- 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x8a7f, 0x015e,
-+ 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x8a6f, 0x015e,
- 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e, 0x002e,
- 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x189e, 0x7004, 0x9086,
- 0x0001, 0x1110, 0x080c, 0x35b5, 0x00ee, 0x0005, 0x0005, 0x2a70,
-- 0x2061, 0x19ac, 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, 0x0014,
-+ 0x2061, 0x19ac, 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, 0x0013,
- 0x600f, 0x0137, 0x2001, 0x197c, 0x900e, 0x2102, 0x7196, 0x2001,
- 0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705f, 0xffff, 0x0008,
-- 0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xd389, 0x70ef,
-+ 0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xd376, 0x70ef,
- 0x00c0, 0x2061, 0x196c, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
- 0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x001f, 0x611a, 0x601f,
- 0x07d0, 0x2061, 0x1974, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f,
- 0x0200, 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061,
- 0x1989, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f,
-- 0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x67b4,
-+ 0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x67ad,
- 0x1178, 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4,
- 0xff00, 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210,
- 0x8108, 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
-@@ -244,11 +232,11 @@ unsigned short risc_code01[] = {
- 0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
- 0xd084, 0x0180, 0x2001, 0x1a25, 0x2004, 0x9005, 0x0128, 0x2001,
- 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002,
-- 0x2003, 0x1001, 0x080c, 0x584f, 0x1170, 0x080c, 0x0f32, 0x0110,
-- 0x080c, 0x0e85, 0x080c, 0x584f, 0x1130, 0x2071, 0x1800, 0x2011,
-+ 0x2003, 0x1001, 0x080c, 0x584d, 0x1170, 0x080c, 0x0f32, 0x0110,
-+ 0x080c, 0x0e85, 0x080c, 0x584d, 0x1130, 0x2071, 0x1800, 0x2011,
- 0x8000, 0x080c, 0x0f46, 0x0c70, 0x0005, 0x2001, 0x0382, 0x2004,
- 0x9084, 0x0007, 0x9086, 0x0001, 0x1120, 0x2001, 0x0015, 0x080c,
-- 0xaced, 0x2079, 0x0380, 0x2069, 0x1b0b, 0x7818, 0x6802, 0x781c,
-+ 0xacdd, 0x2079, 0x0380, 0x2069, 0x1b0b, 0x7818, 0x6802, 0x781c,
- 0x6806, 0x7840, 0x680a, 0x7844, 0x680e, 0x782c, 0x6812, 0x2019,
- 0x1b16, 0x9016, 0x7808, 0xd09c, 0x0150, 0x7820, 0x201a, 0x8210,
- 0x8318, 0x8210, 0x9282, 0x0011, 0x0ea8, 0x2011, 0xdead, 0x6a2a,
-@@ -327,7 +315,7 @@ unsigned short risc_code01[] = {
- 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0xa862, 0x9184, 0xffc0,
- 0xa85e, 0x001e, 0x0020, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071,
- 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2,
-- 0x080c, 0x8899, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9026,
-+ 0x080c, 0x8889, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9026,
- 0x2009, 0x0000, 0x2049, 0x0400, 0x2900, 0x702e, 0x8940, 0x2800,
- 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886, 0x0440, 0x0120,
- 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x188d, 0x7000, 0x9005,
-@@ -393,14 +381,14 @@ unsigned short risc_code01[] = {
- 0x00de, 0x009e, 0x080c, 0x116d, 0x0005, 0xa8a8, 0xd08c, 0x0005,
- 0x0096, 0xa0a0, 0x904d, 0x090c, 0x0d85, 0xa06c, 0x908e, 0x0100,
- 0x0130, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c,
-- 0x7006, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, 0x108b,
-+ 0x6ff6, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, 0x108b,
- 0x009e, 0x0005, 0x00a6, 0xa0a0, 0x904d, 0x090c, 0x0d85, 0xa06c,
- 0x908e, 0x0100, 0x0128, 0xa87b, 0x0001, 0xa883, 0x0000, 0x00c0,
- 0xa80c, 0x2050, 0xb004, 0x9005, 0x0198, 0xa80e, 0x2050, 0x8006,
- 0x8006, 0x8007, 0x908c, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
- 0xa076, 0xa172, 0xb000, 0xa07a, 0x2810, 0x080c, 0x114e, 0x00e8,
-- 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c, 0x7006, 0x000e, 0x001e,
-- 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0xb16c,
-+ 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c, 0x6ff6, 0x000e, 0x001e,
-+ 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0xb157,
- 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000, 0xa8a3, 0x0000, 0x080c,
- 0x108b, 0x7007, 0x0000, 0x080c, 0x116d, 0x00ae, 0x0005, 0x0126,
- 0x2091, 0x8000, 0x782b, 0x1001, 0x7007, 0x0005, 0x7000, 0xc094,
-@@ -409,8 +397,8 @@ unsigned short risc_code01[] = {
- 0x780e, 0x782b, 0x0020, 0x0126, 0x2091, 0x8000, 0x782b, 0x0041,
- 0x7007, 0x0003, 0x7000, 0xc084, 0x7002, 0x2900, 0x700a, 0x012e,
- 0x009e, 0x0005, 0x20e1, 0x0000, 0x2099, 0x0088, 0x782b, 0x0040,
-- 0x0096, 0x2001, 0x192f, 0x204c, 0xaa7c, 0x009e, 0x080c, 0x8f88,
-- 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc, 0x200a, 0x080c, 0x8de7,
-+ 0x0096, 0x2001, 0x192f, 0x204c, 0xaa7c, 0x009e, 0x080c, 0x8f78,
-+ 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc, 0x200a, 0x080c, 0x8dd7,
- 0x7007, 0x0000, 0x080c, 0x117e, 0x0005, 0x7007, 0x0000, 0x080c,
- 0x117e, 0x0005, 0x0126, 0x2091, 0x2200, 0x2079, 0x0300, 0x2071,
- 0x1a6e, 0x7003, 0x0000, 0x78bf, 0x00f6, 0x0041, 0x7807, 0x0007,
-@@ -426,15 +414,15 @@ unsigned short risc_code01[] = {
- 0x6007, 0x1aa1, 0x2061, 0x1aa1, 0x606f, 0x193d, 0x2001, 0x1928,
- 0x2004, 0x607a, 0x783f, 0x348e, 0x00ce, 0x0005, 0x9086, 0x000d,
- 0x11d0, 0x7808, 0xd09c, 0x01b8, 0x7820, 0x0026, 0x2010, 0x080c,
-- 0xcf09, 0x0180, 0x2260, 0x6000, 0x9086, 0x0004, 0x1158, 0x0016,
-+ 0xcef6, 0x0180, 0x2260, 0x6000, 0x9086, 0x0004, 0x1158, 0x0016,
- 0x6120, 0x9186, 0x0009, 0x0108, 0x0020, 0x2009, 0x004c, 0x080c,
-- 0xb20a, 0x001e, 0x002e, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
-+ 0xb1f5, 0x001e, 0x002e, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
- 0x9184, 0x0070, 0x190c, 0x0d7e, 0xd19c, 0x05a0, 0x7820, 0x908c,
- 0xf000, 0x0540, 0x2060, 0x6020, 0x9086, 0x0003, 0x1550, 0x6000,
- 0x9086, 0x0004, 0x1530, 0x6114, 0x2148, 0xa876, 0xa87a, 0xa867,
-- 0x0103, 0x080c, 0x6e27, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211,
-- 0x0208, 0xba3e, 0xb8d0, 0x9005, 0x190c, 0x68df, 0x00be, 0x6044,
-- 0xd0fc, 0x190c, 0xad25, 0x080c, 0xb195, 0x7808, 0xd09c, 0x19b0,
-+ 0x0103, 0x080c, 0x6e17, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211,
-+ 0x0208, 0xba3e, 0xb8d0, 0x9005, 0x190c, 0x68d8, 0x00be, 0x6044,
-+ 0xd0fc, 0x190c, 0xad15, 0x080c, 0xb180, 0x7808, 0xd09c, 0x19b0,
- 0x012e, 0x0005, 0x908a, 0x0024, 0x1a0c, 0x0d85, 0x002b, 0x012e,
- 0x0005, 0x04b0, 0x012e, 0x0005, 0x1438, 0x145e, 0x148e, 0x1493,
- 0x1497, 0x149c, 0x14c4, 0x14c8, 0x14d6, 0x14da, 0x1438, 0x15a7,
-@@ -442,25 +430,25 @@ unsigned short risc_code01[] = {
- 0x1438, 0x1438, 0x1438, 0x1438, 0x1438, 0x1438, 0x1438, 0x149e,
- 0x1438, 0x1466, 0x148b, 0x1452, 0x1438, 0x1472, 0x143c, 0x143a,
- 0x080c, 0x0d85, 0x080c, 0x0d7e, 0x080c, 0x1643, 0x2009, 0x1a7d,
-- 0x2104, 0x8000, 0x200a, 0x080c, 0x82b8, 0x080c, 0x1b1e, 0x0005,
-- 0x6044, 0xd0fc, 0x190c, 0xad25, 0x2009, 0x0055, 0x080c, 0xb20a,
-+ 0x2104, 0x8000, 0x200a, 0x080c, 0x82a8, 0x080c, 0x1b1e, 0x0005,
-+ 0x6044, 0xd0fc, 0x190c, 0xad15, 0x2009, 0x0055, 0x080c, 0xb1f5,
- 0x012e, 0x0005, 0x080c, 0x1643, 0x2060, 0x6044, 0xd0fc, 0x190c,
-- 0xad25, 0x2009, 0x0055, 0x080c, 0xb20a, 0x0005, 0x2009, 0x0048,
-- 0x080c, 0x1643, 0x2060, 0x080c, 0xb20a, 0x0005, 0x2009, 0x0054,
-- 0x080c, 0x1643, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xad25, 0x080c,
-- 0xb20a, 0x0005, 0x080c, 0x1643, 0x2060, 0x0056, 0x0066, 0x080c,
-+ 0xad15, 0x2009, 0x0055, 0x080c, 0xb1f5, 0x0005, 0x2009, 0x0048,
-+ 0x080c, 0x1643, 0x2060, 0x080c, 0xb1f5, 0x0005, 0x2009, 0x0054,
-+ 0x080c, 0x1643, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xad15, 0x080c,
-+ 0xb1f5, 0x0005, 0x080c, 0x1643, 0x2060, 0x0056, 0x0066, 0x080c,
- 0x1643, 0x2028, 0x080c, 0x1643, 0x2030, 0x0036, 0x0046, 0x2021,
-- 0x0000, 0x2418, 0x2009, 0x0056, 0x080c, 0xb20a, 0x004e, 0x003e,
-+ 0x0000, 0x2418, 0x2009, 0x0056, 0x080c, 0xb1f5, 0x004e, 0x003e,
- 0x006e, 0x005e, 0x0005, 0x080c, 0x1643, 0x0005, 0x7004, 0xc085,
- 0xc0b5, 0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c,
- 0x1643, 0x080c, 0x1740, 0x0005, 0x080c, 0x0d85, 0x080c, 0x1643,
- 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009,
-- 0x0048, 0x080c, 0xb20a, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
-+ 0x0048, 0x080c, 0xb1f5, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
- 0x03e8, 0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8,
- 0x2001, 0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x1648, 0x2001,
- 0x0307, 0x2003, 0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005,
- 0x080c, 0x1643, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff,
-- 0x009e, 0x2009, 0x0048, 0x080c, 0xb20a, 0x0005, 0x080c, 0x1643,
-+ 0x009e, 0x2009, 0x0048, 0x080c, 0xb1f5, 0x0005, 0x080c, 0x1643,
- 0x080c, 0x0d85, 0x080c, 0x1643, 0x080c, 0x1592, 0x7827, 0x0018,
- 0x79ac, 0xd1dc, 0x0904, 0x1543, 0x7827, 0x0015, 0x7828, 0x782b,
- 0x0000, 0x9065, 0x0140, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003,
-@@ -476,14 +464,14 @@ unsigned short risc_code01[] = {
- 0x78ab, 0x0004, 0x7803, 0x0001, 0x080c, 0x15ab, 0x2001, 0x020d,
- 0x2003, 0x0020, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c,
- 0x0d85, 0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x01a8,
-- 0x080c, 0x82b8, 0x080c, 0x1b1e, 0x080c, 0xcf1b, 0x0158, 0xa9ac,
-+ 0x080c, 0x82a8, 0x080c, 0x1b1e, 0x080c, 0xcf08, 0x0158, 0xa9ac,
- 0xa936, 0xa9b0, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880,
-- 0xc0bd, 0xa882, 0x080c, 0xcae9, 0x0005, 0x6020, 0x9086, 0x0009,
-- 0x1128, 0x2009, 0x004c, 0x080c, 0xb20a, 0x0048, 0x6010, 0x00b6,
-- 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024, 0x190c, 0xd31e, 0x2029,
-+ 0xc0bd, 0xa882, 0x080c, 0xcad4, 0x0005, 0x6020, 0x9086, 0x0009,
-+ 0x1128, 0x2009, 0x004c, 0x080c, 0xb1f5, 0x0048, 0x6010, 0x00b6,
-+ 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024, 0x190c, 0xd30b, 0x2029,
- 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8,
-- 0x7dbc, 0x080c, 0xeeb1, 0xd5a4, 0x1118, 0x080c, 0x1648, 0x0005,
-- 0x080c, 0x82b8, 0x080c, 0x1b1e, 0x0005, 0x781f, 0x0300, 0x7803,
-+ 0x7dbc, 0x080c, 0xee98, 0xd5a4, 0x1118, 0x080c, 0x1648, 0x0005,
-+ 0x080c, 0x82a8, 0x080c, 0x1b1e, 0x0005, 0x781f, 0x0300, 0x7803,
- 0x0001, 0x0005, 0x0016, 0x0066, 0x0076, 0x00f6, 0x2079, 0x0300,
- 0x7908, 0x918c, 0x0007, 0x9186, 0x0003, 0x0120, 0x2001, 0x0016,
- 0x080c, 0x16b9, 0x00fe, 0x007e, 0x006e, 0x001e, 0x0005, 0x7004,
-@@ -502,9 +490,9 @@ unsigned short risc_code01[] = {
- 0x020d, 0x2003, 0x0020, 0x080c, 0x1366, 0x7803, 0x0001, 0x00ee,
- 0x001e, 0x0005, 0x080c, 0x1723, 0x0dd0, 0x2001, 0x020d, 0x2003,
- 0x0050, 0x2003, 0x0020, 0x0461, 0x0c90, 0x0429, 0x2060, 0x2009,
-- 0x0053, 0x080c, 0xb20a, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
-- 0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x92d5,
-- 0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8ed9, 0x0cd0, 0x0005,
-+ 0x0053, 0x080c, 0xb1f5, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
-+ 0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x92c5,
-+ 0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8ec9, 0x0cd0, 0x0005,
- 0x2001, 0x0036, 0x2009, 0x1820, 0x210c, 0x2011, 0x181f, 0x2214,
- 0x080c, 0x16b9, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005,
- 0x080c, 0x1592, 0x00d6, 0x2069, 0x0200, 0x2009, 0x01f4, 0x8109,
-@@ -514,7 +502,7 @@ unsigned short risc_code01[] = {
- 0x810c, 0x080c, 0x16ab, 0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9,
- 0x6827, 0x0002, 0x04c1, 0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4,
- 0x1500, 0x6804, 0x9005, 0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0,
-- 0x080c, 0x82b8, 0x080c, 0x1b1e, 0x0090, 0x7827, 0x0015, 0x782b,
-+ 0x080c, 0x82a8, 0x080c, 0x1b1e, 0x0090, 0x7827, 0x0015, 0x782b,
- 0x0000, 0x7827, 0x0018, 0x782b, 0x0000, 0x2001, 0x020d, 0x2003,
- 0x0020, 0x2001, 0x0307, 0x2003, 0x0300, 0x7803, 0x0001, 0x00de,
- 0x0005, 0x682c, 0x9084, 0x5400, 0x9086, 0x5400, 0x0d30, 0x7827,
-@@ -537,14 +525,14 @@ unsigned short risc_code01[] = {
- 0x9085, 0x0001, 0x0005, 0x0006, 0x0046, 0x00e6, 0x2071, 0x0200,
- 0x7037, 0x0002, 0x7058, 0x9084, 0xff00, 0x8007, 0x9086, 0x00bc,
- 0x1158, 0x2021, 0x1a7e, 0x2404, 0x8000, 0x0208, 0x2022, 0x080c,
-- 0x82b8, 0x080c, 0x1b1e, 0x9006, 0x00ee, 0x004e, 0x000e, 0x0005,
-+ 0x82a8, 0x080c, 0x1b1e, 0x9006, 0x00ee, 0x004e, 0x000e, 0x0005,
- 0x0c11, 0x1108, 0x0005, 0x00e6, 0x0016, 0x2071, 0x0200, 0x0841,
- 0x6124, 0xd1dc, 0x01f8, 0x701c, 0xd08c, 0x0904, 0x17a2, 0x7017,
- 0x0000, 0x2001, 0x0264, 0x2004, 0xd0bc, 0x0904, 0x17a2, 0x2001,
- 0x0268, 0x00c6, 0x2064, 0x6104, 0x6038, 0x00ce, 0x918e, 0x0039,
- 0x1904, 0x17a2, 0x9c06, 0x15f0, 0x0126, 0x2091, 0x2600, 0x080c,
-- 0x8210, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d, 0x0598, 0x2b48,
-- 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x190c, 0xd2f9,
-+ 0x8200, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d, 0x0598, 0x2b48,
-+ 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x190c, 0xd2e6,
- 0xab42, 0xac3e, 0x2001, 0x1869, 0x2004, 0xd0b4, 0x1170, 0x601c,
- 0xd0e4, 0x1158, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
- 0x1120, 0xa83b, 0x7fff, 0xa837, 0xffff, 0x080c, 0x1ee1, 0x1190,
-@@ -552,7 +540,7 @@ unsigned short risc_code01[] = {
- 0xa80a, 0x2c00, 0xa812, 0x7037, 0x0020, 0x781f, 0x0300, 0x001e,
- 0x00ee, 0x0005, 0x7037, 0x0050, 0x7037, 0x0020, 0x001e, 0x00ee,
- 0x080c, 0x1648, 0x0005, 0x080c, 0x0d85, 0x2001, 0x180d, 0x2004,
-- 0xd08c, 0x190c, 0x6ccc, 0x2cf0, 0x0126, 0x2091, 0x2200, 0x0016,
-+ 0xd08c, 0x190c, 0x6cbc, 0x2cf0, 0x0126, 0x2091, 0x2200, 0x0016,
- 0x00c6, 0x3e60, 0x6014, 0x2048, 0x2940, 0x903e, 0x2730, 0xa864,
- 0x2068, 0xa81a, 0x9d84, 0x000f, 0x9088, 0x1ec1, 0x2165, 0x0002,
- 0x17df, 0x184d, 0x17df, 0x17df, 0x17e3, 0x182e, 0x17df, 0x1803,
-@@ -561,7 +549,7 @@ unsigned short risc_code01[] = {
- 0x0001, 0x0804, 0x1930, 0xa87c, 0xd0ac, 0x0dc8, 0x0804, 0x1854,
- 0xa87c, 0xd0ac, 0x0da0, 0x0804, 0x18bf, 0xa898, 0x901d, 0x1108,
- 0xab9c, 0x9016, 0xaab2, 0xaa3e, 0xaa42, 0x3e00, 0x9080, 0x0008,
-- 0x2004, 0x9080, 0x9536, 0x2005, 0x9005, 0x090c, 0x0d85, 0x2004,
-+ 0x2004, 0x9080, 0x9526, 0x2005, 0x9005, 0x090c, 0x0d85, 0x2004,
- 0xa8ae, 0x0804, 0x1918, 0xa87c, 0xd0bc, 0x09c8, 0xa890, 0xa842,
- 0xa88c, 0xa83e, 0xa888, 0x0804, 0x1854, 0xa87c, 0xd0bc, 0x0978,
- 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa888, 0x0804, 0x18bf, 0xa87c,
-@@ -602,7 +590,7 @@ unsigned short risc_code01[] = {
- 0x3e60, 0x601c, 0xc085, 0x601e, 0xa87c, 0xc0dd, 0xa87e, 0x9006,
- 0x00ce, 0x001e, 0x012e, 0x0005, 0x2800, 0xa80e, 0xab0a, 0x2c00,
- 0xa812, 0x0c70, 0x0804, 0x17df, 0x2001, 0x180d, 0x2004, 0xd08c,
-- 0x190c, 0x6ccc, 0x2ff0, 0x0126, 0x2091, 0x2200, 0x0016, 0x00c6,
-+ 0x190c, 0x6cbc, 0x2ff0, 0x0126, 0x2091, 0x2200, 0x0016, 0x00c6,
- 0x3e60, 0x6014, 0x2048, 0x2940, 0xa80e, 0x2061, 0x1ebc, 0xa813,
- 0x1ebc, 0x2c05, 0xa80a, 0xa964, 0xa91a, 0xa87c, 0xd0ac, 0x090c,
- 0x0d85, 0x9006, 0xa842, 0xa83e, 0x2c05, 0x908a, 0x0034, 0x1a0c,
-@@ -649,10 +637,10 @@ unsigned short risc_code01[] = {
- 0x2048, 0x6118, 0x81ff, 0x0148, 0x810c, 0x810c, 0x810c, 0x81ff,
- 0x1118, 0xa887, 0x0001, 0x0008, 0xa986, 0x601b, 0x0002, 0xa874,
- 0x9084, 0x00ff, 0x9084, 0x0008, 0x0150, 0x00e9, 0x6000, 0x9086,
-- 0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0xb20a, 0x0005, 0xa974,
-+ 0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0xb1f5, 0x0005, 0xa974,
- 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c, 0x9106, 0x1158, 0xa938,
- 0xa890, 0x9106, 0x1138, 0x601c, 0xc084, 0x601e, 0x2009, 0x0048,
-- 0x0804, 0xb20a, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200, 0x00ce,
-+ 0x0804, 0xb1f5, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200, 0x00ce,
- 0x7908, 0x918c, 0x0007, 0x9186, 0x0000, 0x05b0, 0x9186, 0x0003,
- 0x0598, 0x6020, 0x6023, 0x0000, 0x0006, 0x2031, 0x0008, 0x00c6,
- 0x781f, 0x0808, 0x7808, 0xd09c, 0x0120, 0x080c, 0x13d4, 0x8631,
-@@ -663,17 +651,17 @@ unsigned short risc_code01[] = {
- 0x000e, 0x6022, 0x012e, 0x0005, 0x080c, 0x1baa, 0x7827, 0x0015,
- 0x7828, 0x9c06, 0x1db8, 0x782b, 0x0000, 0x0ca0, 0x00f6, 0x2079,
- 0x0300, 0x7803, 0x0000, 0x78ab, 0x0004, 0x2001, 0xf000, 0x8001,
-- 0x090c, 0x0d85, 0x7aac, 0xd2ac, 0x1dd0, 0x00fe, 0x080c, 0x779e,
-+ 0x090c, 0x0d85, 0x7aac, 0xd2ac, 0x1dd0, 0x00fe, 0x080c, 0x778e,
- 0x1188, 0x2001, 0x0138, 0x2003, 0x0000, 0x2001, 0x0160, 0x2003,
- 0x0000, 0x2011, 0x012c, 0xa001, 0xa001, 0x8211, 0x1de0, 0x0059,
-- 0x0804, 0x7840, 0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001,
-+ 0x0804, 0x7830, 0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001,
- 0x0138, 0x2202, 0x0005, 0x00e6, 0x2071, 0x0200, 0x080c, 0x2a8b,
- 0x2009, 0x003c, 0x080c, 0x2220, 0x2001, 0x015d, 0x2003, 0x0000,
-- 0x7000, 0x9084, 0x003c, 0x1de0, 0x080c, 0x8899, 0x70a0, 0x70a2,
-+ 0x7000, 0x9084, 0x003c, 0x1de0, 0x080c, 0x8889, 0x70a0, 0x70a2,
- 0x7098, 0x709a, 0x709c, 0x709e, 0x2001, 0x020d, 0x2003, 0x0020,
- 0x00f6, 0x2079, 0x0300, 0x080c, 0x1366, 0x7803, 0x0001, 0x00fe,
- 0x00ee, 0x0005, 0x2001, 0x0138, 0x2014, 0x2003, 0x0000, 0x2001,
-- 0x0160, 0x202c, 0x2003, 0x0000, 0x080c, 0x779e, 0x1108, 0x0005,
-+ 0x0160, 0x202c, 0x2003, 0x0000, 0x080c, 0x778e, 0x1108, 0x0005,
- 0x2021, 0x0260, 0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001,
- 0x0109, 0x201c, 0x939c, 0x0048, 0x1160, 0x2001, 0x0111, 0x201c,
- 0x83ff, 0x1110, 0x8421, 0x1d70, 0x2001, 0x015d, 0x2003, 0x0000,
-@@ -750,12 +738,12 @@ unsigned short risc_code01[] = {
- 0x0804, 0x1d7a, 0x080c, 0x0d85, 0x00f6, 0x00e6, 0x0096, 0x00c6,
- 0x0026, 0x704c, 0x9c06, 0x190c, 0x0d85, 0x2079, 0x0090, 0x2001,
- 0x0105, 0x2003, 0x0010, 0x782b, 0x0004, 0x7057, 0x0000, 0x6014,
-- 0x2048, 0x080c, 0xcf1b, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020,
-+ 0x2048, 0x080c, 0xcf08, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020,
- 0x9086, 0x0006, 0x1170, 0x2061, 0x0100, 0x62c8, 0x2001, 0x00fa,
- 0x8001, 0x1df0, 0x60c8, 0x9206, 0x1dc0, 0x60c4, 0xa89a, 0x60c8,
-- 0xa896, 0x704c, 0x2060, 0x00c6, 0x080c, 0xcae9, 0x080c, 0xacfc,
-+ 0xa896, 0x704c, 0x2060, 0x00c6, 0x080c, 0xcad4, 0x080c, 0xacec,
- 0x00ce, 0x704c, 0x9c06, 0x1150, 0x2009, 0x0040, 0x080c, 0x2220,
-- 0x080c, 0xa7a1, 0x2011, 0x0000, 0x080c, 0xa635, 0x002e, 0x00ce,
-+ 0x080c, 0xa791, 0x2011, 0x0000, 0x080c, 0xa625, 0x002e, 0x00ce,
- 0x009e, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0090, 0x781c,
- 0x0006, 0x7818, 0x0006, 0x2079, 0x0100, 0x7a14, 0x9284, 0x1984,
- 0x9085, 0x0012, 0x7816, 0x2019, 0x1000, 0x8319, 0x090c, 0x0d85,
-@@ -765,12 +753,12 @@ unsigned short risc_code01[] = {
- 0x7057, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x19e8,
- 0x7054, 0x9086, 0x0000, 0x0904, 0x1e92, 0x2079, 0x0090, 0x2009,
- 0x0207, 0x210c, 0xd194, 0x01b8, 0x2009, 0x020c, 0x210c, 0x9184,
-- 0x0003, 0x0188, 0x080c, 0xeefa, 0x2001, 0x0133, 0x2004, 0x9005,
-+ 0x0003, 0x0188, 0x080c, 0xeee1, 0x2001, 0x0133, 0x2004, 0x9005,
- 0x090c, 0x0d85, 0x0016, 0x2009, 0x0040, 0x080c, 0x2220, 0x001e,
- 0x2001, 0x020c, 0x2102, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203,
- 0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x2220, 0x782c,
-- 0xd0fc, 0x09a8, 0x080c, 0xad18, 0x782c, 0xd0fc, 0x1de8, 0x080c,
-- 0xacfc, 0x7054, 0x9086, 0x0000, 0x1950, 0x782b, 0x0004, 0x782c,
-+ 0xd0fc, 0x09a8, 0x080c, 0xad08, 0x782c, 0xd0fc, 0x1de8, 0x080c,
-+ 0xacec, 0x7054, 0x9086, 0x0000, 0x1950, 0x782b, 0x0004, 0x782c,
- 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2220, 0x782b, 0x0002,
- 0x7057, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x080c, 0x0d85, 0x8c60,
- 0x2c05, 0x9005, 0x0110, 0x8a51, 0x0005, 0xa004, 0x9005, 0x0168,
-@@ -854,18 +842,18 @@ unsigned short risc_code01[] = {
- 0x200b, 0x0400, 0x781b, 0x0002, 0x783b, 0x001f, 0x7837, 0x0020,
- 0x7803, 0x1600, 0x012e, 0x0005, 0x2091, 0x2600, 0x781c, 0xd0a4,
- 0x190c, 0x221d, 0x7900, 0xd1dc, 0x1118, 0x9084, 0x0006, 0x001a,
-- 0x9084, 0x000e, 0x0002, 0x213b, 0x2133, 0x8210, 0x2133, 0x2135,
-- 0x2135, 0x2135, 0x2135, 0x81f6, 0x2133, 0x2137, 0x2133, 0x2135,
-+ 0x9084, 0x000e, 0x0002, 0x213b, 0x2133, 0x8200, 0x2133, 0x2135,
-+ 0x2135, 0x2135, 0x2135, 0x81e6, 0x2133, 0x2137, 0x2133, 0x2135,
- 0x2133, 0x2135, 0x2133, 0x080c, 0x0d85, 0x0031, 0x0020, 0x080c,
-- 0x81f6, 0x080c, 0x8210, 0x0005, 0x0006, 0x0016, 0x0026, 0x080c,
-- 0xeefa, 0x7930, 0x9184, 0x0003, 0x0510, 0x080c, 0xacfc, 0x2001,
-+ 0x81e6, 0x080c, 0x8200, 0x0005, 0x0006, 0x0016, 0x0026, 0x080c,
-+ 0xeee1, 0x7930, 0x9184, 0x0003, 0x0510, 0x080c, 0xacec, 0x2001,
- 0x19fb, 0x2004, 0x9005, 0x01a0, 0x2001, 0x0133, 0x2004, 0x9005,
-- 0x090c, 0x0d85, 0x00c6, 0x2001, 0x19fb, 0x2064, 0x080c, 0xad18,
-- 0x080c, 0xcae9, 0x2009, 0x0040, 0x080c, 0x2220, 0x00ce, 0x0408,
-- 0x2009, 0x0040, 0x080c, 0x2220, 0x080c, 0xad18, 0x00d0, 0x9184,
-- 0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x779e,
-- 0x1138, 0x080c, 0x7ab6, 0x080c, 0x619d, 0x080c, 0x76cd, 0x0010,
-- 0x080c, 0x6058, 0x080c, 0x82ae, 0x0041, 0x0018, 0x9184, 0x9540,
-+ 0x090c, 0x0d85, 0x00c6, 0x2001, 0x19fb, 0x2064, 0x080c, 0xad08,
-+ 0x080c, 0xcad4, 0x2009, 0x0040, 0x080c, 0x2220, 0x00ce, 0x0408,
-+ 0x2009, 0x0040, 0x080c, 0x2220, 0x080c, 0xad08, 0x00d0, 0x9184,
-+ 0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x778e,
-+ 0x1138, 0x080c, 0x7aa6, 0x080c, 0x6196, 0x080c, 0x76bd, 0x0010,
-+ 0x080c, 0x6051, 0x080c, 0x829e, 0x0041, 0x0018, 0x9184, 0x9540,
- 0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x0036, 0x0046,
- 0x0056, 0x2071, 0x1a6e, 0x080c, 0x1b1e, 0x005e, 0x004e, 0x003e,
- 0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071, 0x1800, 0x7128,
-@@ -916,57 +904,57 @@ unsigned short risc_code01[] = {
- 0x001e, 0x0d30, 0x0c58, 0x2306, 0x2303, 0x2303, 0x2303, 0x2305,
- 0x2303, 0x2303, 0x2303, 0x080c, 0x0d85, 0x0029, 0x002e, 0x001e,
- 0x000e, 0x012e, 0x0005, 0x00a6, 0x6124, 0x6028, 0xd09c, 0x0118,
-- 0xd19c, 0x1904, 0x258b, 0xd1f4, 0x190c, 0x0d7e, 0x080c, 0x779e,
-- 0x0904, 0x2363, 0x080c, 0xd645, 0x1120, 0x7000, 0x9086, 0x0003,
-- 0x0580, 0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x77c1, 0x0118,
-- 0x080c, 0x77af, 0x1530, 0x2011, 0x0020, 0x080c, 0x2ad3, 0x6043,
-- 0x0000, 0x080c, 0xd645, 0x0168, 0x080c, 0x77c1, 0x1150, 0x2001,
-- 0x19a8, 0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x7612, 0x0804,
-+ 0xd19c, 0x1904, 0x258b, 0xd1f4, 0x190c, 0x0d7e, 0x080c, 0x778e,
-+ 0x0904, 0x2363, 0x080c, 0xd632, 0x1120, 0x7000, 0x9086, 0x0003,
-+ 0x0580, 0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x77b1, 0x0118,
-+ 0x080c, 0x779f, 0x1530, 0x2011, 0x0020, 0x080c, 0x2ad3, 0x6043,
-+ 0x0000, 0x080c, 0xd632, 0x0168, 0x080c, 0x77b1, 0x1150, 0x2001,
-+ 0x19a8, 0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x7602, 0x0804,
- 0x258e, 0x70a4, 0x9005, 0x1150, 0x70a7, 0x0001, 0x00d6, 0x2069,
-- 0x0140, 0x080c, 0x77f2, 0x00de, 0x1904, 0x258e, 0x080c, 0x7ac0,
-- 0x0428, 0x080c, 0x77c1, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108,
-- 0x0468, 0x080c, 0x7ac0, 0x080c, 0x7ab6, 0x080c, 0x619d, 0x080c,
-- 0x76cd, 0x0804, 0x258b, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170,
-+ 0x0140, 0x080c, 0x77e2, 0x00de, 0x1904, 0x258e, 0x080c, 0x7ab0,
-+ 0x0428, 0x080c, 0x77b1, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108,
-+ 0x0468, 0x080c, 0x7ab0, 0x080c, 0x7aa6, 0x080c, 0x6196, 0x080c,
-+ 0x76bd, 0x0804, 0x258b, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170,
- 0xd0e4, 0x1178, 0xd0d4, 0x1190, 0xd0cc, 0x0130, 0x7098, 0x9086,
-- 0x0029, 0x1110, 0x080c, 0x7990, 0x0804, 0x258b, 0x080c, 0x7abb,
-- 0x0048, 0x2001, 0x197d, 0x2003, 0x0002, 0x0020, 0x080c, 0x78e4,
-- 0x0804, 0x258b, 0x080c, 0x7a3a, 0x0804, 0x258b, 0x6220, 0xd1bc,
-+ 0x0029, 0x1110, 0x080c, 0x7980, 0x0804, 0x258b, 0x080c, 0x7aab,
-+ 0x0048, 0x2001, 0x197d, 0x2003, 0x0002, 0x0020, 0x080c, 0x78d4,
-+ 0x0804, 0x258b, 0x080c, 0x7a2a, 0x0804, 0x258b, 0x6220, 0xd1bc,
- 0x0138, 0xd2bc, 0x1904, 0x25f6, 0xd2b4, 0x1904, 0x2608, 0x0000,
- 0xd1ac, 0x0904, 0x2498, 0x0036, 0x6328, 0xc3bc, 0x632a, 0x003e,
-- 0x080c, 0x779e, 0x11d0, 0x2011, 0x0020, 0x080c, 0x2ad3, 0x0006,
-- 0x0026, 0x0036, 0x080c, 0x77b8, 0x1158, 0x080c, 0x7ab6, 0x080c,
-- 0x619d, 0x080c, 0x76cd, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
-- 0x003e, 0x002e, 0x000e, 0x080c, 0x7772, 0x0016, 0x0046, 0x00c6,
-+ 0x080c, 0x778e, 0x11d0, 0x2011, 0x0020, 0x080c, 0x2ad3, 0x0006,
-+ 0x0026, 0x0036, 0x080c, 0x77a8, 0x1158, 0x080c, 0x7aa6, 0x080c,
-+ 0x6196, 0x080c, 0x76bd, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
-+ 0x003e, 0x002e, 0x000e, 0x080c, 0x7762, 0x0016, 0x0046, 0x00c6,
- 0x644c, 0x9486, 0xf0f0, 0x1138, 0x2061, 0x0100, 0x644a, 0x6043,
- 0x0090, 0x6043, 0x0010, 0x74da, 0x948c, 0xff00, 0x7038, 0xd084,
-- 0x0190, 0x080c, 0xd645, 0x1118, 0x9186, 0xf800, 0x1160, 0x7048,
-+ 0x0190, 0x080c, 0xd632, 0x1118, 0x9186, 0xf800, 0x1160, 0x7048,
- 0xd084, 0x1148, 0xc085, 0x704a, 0x0036, 0x2418, 0x2011, 0x8016,
-- 0x080c, 0x4ca1, 0x003e, 0x080c, 0xd63e, 0x1904, 0x246d, 0x9196,
-+ 0x080c, 0x4c9f, 0x003e, 0x080c, 0xd62b, 0x1904, 0x246d, 0x9196,
- 0xff00, 0x05a8, 0x7060, 0x9084, 0x00ff, 0x810f, 0x81ff, 0x0110,
- 0x9116, 0x0568, 0x7130, 0xd184, 0x1550, 0x080c, 0x3482, 0x0128,
-- 0xc18d, 0x7132, 0x080c, 0x6c09, 0x1510, 0x6240, 0x9294, 0x0010,
-+ 0xc18d, 0x7132, 0x080c, 0x6bf9, 0x1510, 0x6240, 0x9294, 0x0010,
- 0x0130, 0x6248, 0x9294, 0xff00, 0x9296, 0xff00, 0x01c0, 0x7030,
- 0xd08c, 0x0904, 0x246d, 0x7038, 0xd08c, 0x1140, 0x2001, 0x180c,
- 0x200c, 0xd1ac, 0x1904, 0x246d, 0xc1ad, 0x2102, 0x0036, 0x73d8,
-- 0x2011, 0x8013, 0x080c, 0x4ca1, 0x003e, 0x0804, 0x246d, 0x7038,
-+ 0x2011, 0x8013, 0x080c, 0x4c9f, 0x003e, 0x0804, 0x246d, 0x7038,
- 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904, 0x246d,
-- 0xc1ad, 0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c, 0x4ca1,
-+ 0xc1ad, 0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c, 0x4c9f,
- 0x003e, 0x7130, 0xc185, 0x7132, 0x2011, 0x1848, 0x220c, 0xd1a4,
-- 0x01f0, 0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8c44,
-- 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xe9f9, 0x00ce,
-+ 0x01f0, 0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8c34,
-+ 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xe9e0, 0x00ce,
- 0x9484, 0x00ff, 0x9080, 0x348e, 0x200d, 0x918c, 0xff00, 0x810f,
-- 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xea8d, 0x001e, 0x0016,
-+ 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xea74, 0x001e, 0x0016,
- 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x32da, 0x001e, 0x00a8,
-- 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x67b4, 0x1140,
-- 0x7030, 0xd084, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x61b7,
-+ 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x67ad, 0x1140,
-+ 0x7030, 0xd084, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x61b0,
- 0x8108, 0x1f04, 0x245d, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c,
-- 0xacfc, 0x080c, 0xafd2, 0x080c, 0xb09b, 0x080c, 0xad18, 0x60e3,
-+ 0xacec, 0x080c, 0xafbd, 0x080c, 0xb086, 0x080c, 0xad08, 0x60e3,
- 0x0000, 0x001e, 0x2001, 0x1800, 0x2014, 0x9296, 0x0004, 0x1170,
- 0xd19c, 0x11b0, 0x2011, 0x180c, 0x2214, 0xd29c, 0x1120, 0x6204,
- 0x9295, 0x0002, 0x6206, 0x6228, 0xc29d, 0x622a, 0x2003, 0x0001,
- 0x2001, 0x1826, 0x2003, 0x0000, 0x2011, 0x0020, 0x080c, 0x2ad3,
-- 0xd194, 0x0904, 0x258b, 0x0016, 0x080c, 0xacfc, 0x6220, 0xd2b4,
-- 0x0904, 0x2526, 0x080c, 0x8a4b, 0x080c, 0xa2a0, 0x2011, 0x0004,
-+ 0xd194, 0x0904, 0x258b, 0x0016, 0x080c, 0xacec, 0x6220, 0xd2b4,
-+ 0x0904, 0x2526, 0x080c, 0x8a3b, 0x080c, 0xa290, 0x2011, 0x0004,
- 0x080c, 0x2ad3, 0x00f6, 0x2019, 0x19f4, 0x2304, 0x907d, 0x0904,
- 0x24f3, 0x7804, 0x9086, 0x0032, 0x15f0, 0x00d6, 0x00c6, 0x00e6,
- 0x0096, 0x2069, 0x0140, 0x782c, 0x685e, 0x7808, 0x685a, 0x6043,
-@@ -974,38 +962,38 @@ unsigned short risc_code01[] = {
- 0x003c, 0x8001, 0x1df0, 0x080c, 0x2aa9, 0x2001, 0x001e, 0x8001,
- 0x0240, 0x20a9, 0x0009, 0x080c, 0x2a60, 0x6904, 0xd1dc, 0x1140,
- 0x0cb0, 0x2001, 0x0100, 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99,
-- 0x080c, 0x99ed, 0x080c, 0xad18, 0x7814, 0x2048, 0xa867, 0x0103,
-- 0x2f60, 0x080c, 0xb16c, 0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe,
-+ 0x080c, 0x99dd, 0x080c, 0xad08, 0x7814, 0x2048, 0xa867, 0x0103,
-+ 0x2f60, 0x080c, 0xb157, 0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe,
- 0x001e, 0x00ae, 0x0005, 0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804,
- 0x9084, 0x4000, 0x0110, 0x080c, 0x2aa9, 0x00de, 0x00c6, 0x2061,
-- 0x19e8, 0x6034, 0x080c, 0xd645, 0x0120, 0x909a, 0x0003, 0x1258,
-+ 0x19e8, 0x6034, 0x080c, 0xd632, 0x0120, 0x909a, 0x0003, 0x1258,
- 0x0018, 0x909a, 0x00c8, 0x1238, 0x8000, 0x6036, 0x00ce, 0x080c,
-- 0xa278, 0x0804, 0x2588, 0x2061, 0x0100, 0x62c0, 0x080c, 0xac2d,
-+ 0xa268, 0x0804, 0x2588, 0x2061, 0x0100, 0x62c0, 0x080c, 0xac1d,
- 0x2019, 0x19f4, 0x2304, 0x9065, 0x0130, 0x6003, 0x0001, 0x2009,
-- 0x0027, 0x080c, 0xb20a, 0x00ce, 0x0804, 0x2588, 0xd2bc, 0x0904,
-- 0x256b, 0x080c, 0x8a58, 0x2011, 0x0004, 0x080c, 0x2ad3, 0x00d6,
-+ 0x0027, 0x080c, 0xb1f5, 0x00ce, 0x0804, 0x2588, 0xd2bc, 0x0904,
-+ 0x256b, 0x080c, 0x8a48, 0x2011, 0x0004, 0x080c, 0x2ad3, 0x00d6,
- 0x2069, 0x0140, 0x6804, 0x9084, 0x4000, 0x0110, 0x080c, 0x2aa9,
-- 0x00de, 0x00c6, 0x2061, 0x19e8, 0x6050, 0x080c, 0xd645, 0x0120,
-+ 0x00de, 0x00c6, 0x2061, 0x19e8, 0x6050, 0x080c, 0xd632, 0x0120,
- 0x909a, 0x0003, 0x1668, 0x0018, 0x909a, 0x00c8, 0x1648, 0x8000,
- 0x6052, 0x604c, 0x00ce, 0x9005, 0x05d8, 0x2009, 0x07d0, 0x080c,
-- 0x8a50, 0x9080, 0x0008, 0x2004, 0x9086, 0x0006, 0x1138, 0x2009,
-+ 0x8a40, 0x9080, 0x0008, 0x2004, 0x9086, 0x0006, 0x1138, 0x2009,
- 0x1984, 0x2011, 0x0012, 0x080c, 0x2ae2, 0x0450, 0x9080, 0x0008,
- 0x2004, 0x9086, 0x0009, 0x0d98, 0x2009, 0x1984, 0x2011, 0x0016,
- 0x080c, 0x2ae2, 0x00e8, 0x2011, 0x0004, 0x080c, 0x2ad3, 0x00c0,
-- 0x0036, 0x2019, 0x0001, 0x080c, 0xa596, 0x003e, 0x2019, 0x19fb,
-+ 0x0036, 0x2019, 0x0001, 0x080c, 0xa586, 0x003e, 0x2019, 0x19fb,
- 0x2304, 0x9065, 0x0160, 0x2009, 0x004f, 0x6020, 0x9086, 0x0009,
-- 0x1110, 0x2009, 0x004f, 0x6003, 0x0003, 0x080c, 0xb20a, 0x00ce,
-- 0x080c, 0xad18, 0x001e, 0xd19c, 0x0904, 0x25ef, 0x7038, 0xd0ac,
-+ 0x1110, 0x2009, 0x004f, 0x6003, 0x0003, 0x080c, 0xb1f5, 0x00ce,
-+ 0x080c, 0xad08, 0x001e, 0xd19c, 0x0904, 0x25ef, 0x7038, 0xd0ac,
- 0x1558, 0x0016, 0x0156, 0x2011, 0x0008, 0x080c, 0x2ad3, 0x080c,
- 0x2af6, 0x080c, 0x2b29, 0x6050, 0xc0e5, 0x6052, 0x20a9, 0x0367,
-- 0x0f04, 0x25ba, 0x1d04, 0x25a2, 0x080c, 0x8a7f, 0x6020, 0xd09c,
-+ 0x0f04, 0x25ba, 0x1d04, 0x25a2, 0x080c, 0x8a6f, 0x6020, 0xd09c,
- 0x1db8, 0x00f6, 0x2079, 0x0100, 0x080c, 0x2a0c, 0x00fe, 0x1d80,
- 0x6050, 0xc0e4, 0x6052, 0x2011, 0x0008, 0x080c, 0x2ad3, 0x015e,
- 0x001e, 0x04a8, 0x015e, 0x001e, 0x0016, 0x6028, 0xc09c, 0x602a,
-- 0x080c, 0xacfc, 0x080c, 0xafd2, 0x080c, 0xb09b, 0x080c, 0xad18,
-- 0x60e3, 0x0000, 0x080c, 0xeed9, 0x080c, 0xeef4, 0x080c, 0x5844,
-- 0xd0fc, 0x1138, 0x080c, 0xd63e, 0x1120, 0x9085, 0x0001, 0x080c,
-- 0x77e2, 0x9006, 0x080c, 0x2a99, 0x2009, 0x0002, 0x080c, 0x2a85,
-+ 0x080c, 0xacec, 0x080c, 0xafbd, 0x080c, 0xb086, 0x080c, 0xad08,
-+ 0x60e3, 0x0000, 0x080c, 0xeec0, 0x080c, 0xeedb, 0x080c, 0x5842,
-+ 0xd0fc, 0x1138, 0x080c, 0xd62b, 0x1120, 0x9085, 0x0001, 0x080c,
-+ 0x77d2, 0x9006, 0x080c, 0x2a99, 0x2009, 0x0002, 0x080c, 0x2a85,
- 0x00e6, 0x2071, 0x1800, 0x7003, 0x0004, 0x080c, 0x0ed3, 0x00ee,
- 0x2011, 0x0008, 0x080c, 0x2ad3, 0x080c, 0x0bcf, 0x001e, 0x918c,
- 0xffd0, 0x2110, 0x080c, 0x2ad3, 0x00ae, 0x0005, 0x0016, 0x2001,
-@@ -1020,34 +1008,34 @@ unsigned short risc_code01[] = {
- 0x2091, 0x8000, 0x2071, 0x1800, 0x71d0, 0x70d2, 0x9116, 0x0904,
- 0x2684, 0x81ff, 0x01a0, 0x2009, 0x0000, 0x080c, 0x2a85, 0x2011,
- 0x8011, 0x2019, 0x010e, 0x231c, 0x939e, 0x0007, 0x1118, 0x2019,
-- 0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x4ca1, 0x0468, 0x2001,
-+ 0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x4c9f, 0x0468, 0x2001,
- 0x19a9, 0x200c, 0x81ff, 0x1140, 0x2001, 0x0109, 0x2004, 0xd0b4,
- 0x0118, 0x2019, 0x0003, 0x0008, 0x2118, 0x2011, 0x8012, 0x080c,
-- 0x4ca1, 0x080c, 0x0ed3, 0x080c, 0x5844, 0xd0fc, 0x11a8, 0x080c,
-- 0xd63e, 0x1190, 0x00c6, 0x080c, 0x2720, 0x080c, 0xacfc, 0x080c,
-- 0xa4f1, 0x080c, 0xad18, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009,
-+ 0x4c9f, 0x080c, 0x0ed3, 0x080c, 0x5842, 0xd0fc, 0x11a8, 0x080c,
-+ 0xd62b, 0x1190, 0x00c6, 0x080c, 0x2720, 0x080c, 0xacec, 0x080c,
-+ 0xa4e1, 0x080c, 0xad08, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009,
- 0x0002, 0x080c, 0x32da, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e,
- 0x002e, 0x001e, 0x000e, 0x0005, 0x2028, 0x918c, 0x00ff, 0x2130,
- 0x9094, 0xff00, 0x11f0, 0x2011, 0x1837, 0x2214, 0xd2ac, 0x11c8,
- 0x81ff, 0x01e8, 0x2011, 0x181f, 0x2204, 0x9106, 0x1190, 0x2011,
- 0x1820, 0x2214, 0x9294, 0xff00, 0x9584, 0xff00, 0x9206, 0x1148,
- 0x2011, 0x1820, 0x2214, 0x9294, 0x00ff, 0x9584, 0x00ff, 0x9206,
-- 0x1120, 0x2500, 0x080c, 0x8521, 0x0048, 0x9584, 0x00ff, 0x9080,
-+ 0x1120, 0x2500, 0x080c, 0x8511, 0x0048, 0x9584, 0x00ff, 0x9080,
- 0x348e, 0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080,
- 0x348e, 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140,
- 0x2001, 0x1818, 0x2003, 0x00ef, 0x20a9, 0x0010, 0x9006, 0x6852,
- 0x6856, 0x1f04, 0x26d0, 0x00de, 0x0005, 0x0006, 0x00d6, 0x0026,
- 0x2069, 0x0140, 0x2001, 0x1818, 0x2102, 0x8114, 0x8214, 0x8214,
- 0x8214, 0x20a9, 0x0010, 0x6853, 0x0000, 0x9006, 0x82ff, 0x1128,
-- 0x9184, 0x000f, 0x9080, 0xef08, 0x2005, 0x6856, 0x8211, 0x1f04,
-+ 0x9184, 0x000f, 0x9080, 0xeeef, 0x2005, 0x6856, 0x8211, 0x1f04,
- 0x26e5, 0x002e, 0x00de, 0x000e, 0x0005, 0x00c6, 0x2061, 0x1800,
- 0x6030, 0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032, 0x00ce, 0x0005,
- 0x0156, 0x00d6, 0x0026, 0x0016, 0x0006, 0x2069, 0x0140, 0x6980,
- 0x9116, 0x0180, 0x9112, 0x1230, 0x8212, 0x8210, 0x22a8, 0x2001,
- 0x0402, 0x0018, 0x22a8, 0x2001, 0x0404, 0x680e, 0x1f04, 0x2715,
- 0x680f, 0x0000, 0x000e, 0x001e, 0x002e, 0x00de, 0x015e, 0x0005,
-- 0x080c, 0x5840, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046,
-- 0x2020, 0x2009, 0x002e, 0x080c, 0xea8d, 0x004e, 0x0005, 0x00f6,
-+ 0x080c, 0x583e, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046,
-+ 0x2020, 0x2009, 0x002e, 0x080c, 0xea74, 0x004e, 0x0005, 0x00f6,
- 0x0016, 0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc, 0x0904, 0x278c,
- 0x080c, 0x29fc, 0x0660, 0x9084, 0x0700, 0x908e, 0x0600, 0x1120,
- 0x2011, 0x4000, 0x900e, 0x0458, 0x908e, 0x0500, 0x1120, 0x2011,
-@@ -1056,9 +1044,9 @@ unsigned short risc_code01[] = {
- 0x00b0, 0x908e, 0x0200, 0x1120, 0x9016, 0x2009, 0x0004, 0x0078,
- 0x908e, 0x0100, 0x1548, 0x9016, 0x2009, 0x0008, 0x0040, 0x9084,
- 0x0700, 0x908e, 0x0300, 0x1500, 0x2011, 0x0030, 0x0058, 0x2300,
-- 0x9080, 0x0020, 0x2018, 0x080c, 0x955b, 0x928c, 0xff00, 0x0110,
-+ 0x9080, 0x0020, 0x2018, 0x080c, 0x954b, 0x928c, 0xff00, 0x0110,
- 0x2011, 0x00ff, 0x2200, 0x8007, 0x9085, 0x004c, 0x78c2, 0x2009,
-- 0x0138, 0x220a, 0x080c, 0x779e, 0x1118, 0x2009, 0x196d, 0x220a,
-+ 0x0138, 0x220a, 0x080c, 0x778e, 0x1118, 0x2009, 0x196d, 0x220a,
- 0x002e, 0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126,
- 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c,
- 0x8000, 0x2014, 0x9184, 0x0003, 0x0110, 0x080c, 0x0d7e, 0x002e,
-@@ -1075,17 +1063,17 @@ unsigned short risc_code01[] = {
- 0x2861, 0x2863, 0x2001, 0x0001, 0x080c, 0x2631, 0x080c, 0x2a4a,
- 0x2001, 0x1992, 0x2003, 0x0000, 0x7828, 0x9084, 0xe1d7, 0x782a,
- 0x9006, 0x20a9, 0x0009, 0x080c, 0x2a18, 0x2001, 0x1990, 0x2003,
-- 0x0006, 0x2009, 0x001e, 0x2011, 0x2864, 0x080c, 0x8a5d, 0x0005,
-+ 0x0006, 0x2009, 0x001e, 0x2011, 0x2864, 0x080c, 0x8a4d, 0x0005,
- 0x2009, 0x1995, 0x200b, 0x0000, 0x2001, 0x199a, 0x2003, 0x0036,
- 0x2001, 0x1999, 0x2003, 0x002a, 0x2001, 0x1992, 0x2003, 0x0001,
- 0x9006, 0x080c, 0x29ad, 0x2001, 0xffff, 0x20a9, 0x0009, 0x080c,
- 0x2a18, 0x2001, 0x1990, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011,
-- 0x2864, 0x080c, 0x8a5d, 0x0005, 0x080c, 0x0d85, 0x2001, 0x199a,
-+ 0x2864, 0x080c, 0x8a4d, 0x0005, 0x080c, 0x0d85, 0x2001, 0x199a,
- 0x2003, 0x0036, 0x2001, 0x1992, 0x2003, 0x0003, 0x7a38, 0x9294,
- 0x0005, 0x9296, 0x0004, 0x0110, 0x9006, 0x0010, 0x2001, 0x0001,
- 0x080c, 0x29ad, 0x2001, 0x1996, 0x2003, 0x0000, 0x2001, 0xffff,
- 0x20a9, 0x0009, 0x080c, 0x2a18, 0x2001, 0x1990, 0x2003, 0x0006,
-- 0x2009, 0x001e, 0x2011, 0x2864, 0x080c, 0x8a5d, 0x0005, 0x080c,
-+ 0x2009, 0x001e, 0x2011, 0x2864, 0x080c, 0x8a4d, 0x0005, 0x080c,
- 0x0d85, 0x080c, 0x0d85, 0x0005, 0x0006, 0x0016, 0x0026, 0x00e6,
- 0x00f6, 0x0156, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x2001,
- 0x1992, 0x2004, 0x908a, 0x0007, 0x1a0c, 0x0d85, 0x0043, 0x012e,
-@@ -1145,25 +1133,25 @@ unsigned short risc_code01[] = {
- 0x0000, 0x1118, 0x783b, 0x0007, 0x0090, 0x9186, 0x0001, 0x1118,
- 0x783b, 0x0006, 0x0060, 0x9186, 0x0002, 0x1118, 0x783b, 0x0005,
- 0x0030, 0x9186, 0x0003, 0x1118, 0x783b, 0x0004, 0x0000, 0x0006,
-- 0x1d04, 0x2a38, 0x080c, 0x8a7f, 0x1f04, 0x2a38, 0x080c, 0x2af6,
-+ 0x1d04, 0x2a38, 0x080c, 0x8a6f, 0x1f04, 0x2a38, 0x080c, 0x2af6,
- 0x080c, 0x2b29, 0x7850, 0x9085, 0x1000, 0x7852, 0x000e, 0x001e,
- 0x012e, 0x0005, 0x080c, 0x2b29, 0x0005, 0x0006, 0x0156, 0x00f6,
- 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854, 0xd0ac, 0x1100, 0x7854,
- 0xd08c, 0x1110, 0x1f04, 0x2a57, 0x00fe, 0x015e, 0x000e, 0x0005,
-- 0x1d04, 0x2a60, 0x080c, 0x8a7f, 0x1f04, 0x2a60, 0x0005, 0x0006,
-+ 0x1d04, 0x2a60, 0x080c, 0x8a6f, 0x1f04, 0x2a60, 0x0005, 0x0006,
- 0x2001, 0x199c, 0x2004, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006,
- 0x2001, 0x199c, 0x2004, 0x9086, 0x0001, 0x000e, 0x0005, 0x0006,
- 0x2001, 0x199c, 0x2004, 0x9086, 0x0002, 0x000e, 0x0005, 0xa001,
- 0xa001, 0xa001, 0xa001, 0xa001, 0x0005, 0x0006, 0x2001, 0x19a9,
- 0x2102, 0x000e, 0x0005, 0x2009, 0x0171, 0x2104, 0xd0dc, 0x0140,
- 0x2009, 0x0170, 0x2104, 0x200b, 0x0080, 0xa001, 0xa001, 0x200a,
-- 0x0005, 0x0016, 0x0026, 0x080c, 0x77b8, 0x0108, 0xc0bc, 0x2009,
-+ 0x0005, 0x0016, 0x0026, 0x080c, 0x77a8, 0x0108, 0xc0bc, 0x2009,
- 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a, 0x002e, 0x001e,
- 0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001,
- 0x9285, 0x1000, 0x200a, 0x220a, 0x002e, 0x001e, 0x0005, 0x0016,
- 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a,
- 0x002e, 0x001e, 0x0005, 0x0006, 0x0016, 0x2009, 0x0140, 0x2104,
-- 0x1128, 0x080c, 0x77b8, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a,
-+ 0x1128, 0x080c, 0x77a8, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a,
- 0x001e, 0x000e, 0x0005, 0x00f6, 0x2079, 0x0380, 0x7843, 0x0101,
- 0x7844, 0xd084, 0x1de8, 0x2001, 0x0109, 0x2202, 0x7843, 0x0100,
- 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0380, 0x7843, 0x0202, 0x7844,
-@@ -1182,9 +1170,9 @@ unsigned short risc_code01[] = {
- 0x0006, 0x6004, 0x0006, 0xc0fc, 0x6006, 0x2009, 0x0800, 0x2001,
- 0x0338, 0x2003, 0x0301, 0x8109, 0x090c, 0x0d85, 0x2001, 0x0338,
- 0x2004, 0xd084, 0x1dc0, 0x6028, 0x0006, 0x60e0, 0x0006, 0x6888,
-- 0x0006, 0x688c, 0x0006, 0x6890, 0x0006, 0x080c, 0x779e, 0x1110,
-+ 0x0006, 0x688c, 0x0006, 0x6890, 0x0006, 0x080c, 0x778e, 0x1110,
- 0x6884, 0x0006, 0x602f, 0x0100, 0x602f, 0x0000, 0xa001, 0xa001,
-- 0xa001, 0xa001, 0x602f, 0x0040, 0x602f, 0x0000, 0x080c, 0x779e,
-+ 0xa001, 0xa001, 0x602f, 0x0040, 0x602f, 0x0000, 0x080c, 0x778e,
- 0x1120, 0x6803, 0x0080, 0x000e, 0x6886, 0x6897, 0x4198, 0x000e,
- 0x6892, 0x000e, 0x688e, 0x000e, 0x688a, 0x000e, 0x60e2, 0x000e,
- 0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee, 0x000e,
-@@ -1192,7 +1180,7 @@ unsigned short risc_code01[] = {
- 0x6032, 0x6036, 0x2008, 0x080c, 0x26d5, 0x000e, 0x00de, 0x00ce,
- 0x001e, 0x0005, 0x0006, 0x0156, 0x6050, 0x9085, 0x0040, 0x6052,
- 0x6050, 0x9084, 0xfbcf, 0x6052, 0x080c, 0x2a7f, 0x9085, 0x2000,
-- 0x6052, 0x20a9, 0x0012, 0x1d04, 0x2bb3, 0x080c, 0x8a7f, 0x1f04,
-+ 0x6052, 0x20a9, 0x0012, 0x1d04, 0x2bb3, 0x080c, 0x8a6f, 0x1f04,
- 0x2bb3, 0x6050, 0x9085, 0x0400, 0x9084, 0xdfbf, 0x6052, 0x015e,
- 0x000e, 0x0005, 0x30be, 0x30be, 0x2cc2, 0x2cc2, 0x2cce, 0x2cce,
- 0x2cda, 0x2cda, 0x2ce8, 0x2ce8, 0x2cf4, 0x2cf4, 0x2d02, 0x2d02,
-@@ -1286,80 +1274,80 @@ unsigned short risc_code01[] = {
- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f,
- 0x080c, 0x20ea, 0x080c, 0x22c8, 0x080c, 0x13d4, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0xad62, 0x0804, 0x30b6, 0x0106, 0x0006,
-- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xad62,
-+ 0x0146, 0x0156, 0x080c, 0xad52, 0x0804, 0x30b6, 0x0106, 0x0006,
-+ 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xad52,
- 0x080c, 0x22c8, 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6,
-- 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad62,
-+ 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad52,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8,
-+ 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0xad62, 0x080c, 0x2114, 0x0804, 0x30b6,
-+ 0x0146, 0x0156, 0x080c, 0xad52, 0x080c, 0x2114, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x2114, 0x0804, 0x30b6,
-+ 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x2114, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x2114, 0x0804, 0x30b6,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x2114, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x2114,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0xad62, 0x080c, 0x13d4, 0x0804, 0x30b6,
-+ 0x0146, 0x0156, 0x080c, 0xad52, 0x080c, 0x13d4, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x13d4, 0x0804, 0x30b6,
-+ 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x13d4, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x13d4, 0x0804, 0x30b6,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x13d4, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x13d4,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x13d4,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0xad62, 0x080c, 0x13d4, 0x080c, 0x2114,
-+ 0x0146, 0x0156, 0x080c, 0xad52, 0x080c, 0x13d4, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x13d4,
-+ 0x0146, 0x0156, 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x13d4,
- 0x080c, 0x2114, 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6,
-- 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad62,
-+ 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x20ea, 0x080c, 0xad52,
- 0x080c, 0x13d4, 0x080c, 0x2114, 0x0804, 0x30b6, 0x0106, 0x0006,
- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x20ea,
-- 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x13d4, 0x080c, 0x2114,
-+ 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x13d4, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x0804, 0x30b6,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x22c8, 0x0804, 0x30b6,
-+ 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x22c8, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad62, 0x0804, 0x30b6,
-+ 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad52, 0x0804, 0x30b6,
- 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-- 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8,
-+ 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x2114,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x22c8,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x22c8,
- 0x080c, 0x2114, 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6,
- 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0x20ea,
-- 0x080c, 0xad62, 0x080c, 0x2114, 0x0804, 0x30b6, 0x0106, 0x0006,
-+ 0x080c, 0xad52, 0x080c, 0x2114, 0x0804, 0x30b6, 0x0106, 0x0006,
- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x2114,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x2114,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x13d4,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x13d4,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x22c8,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x22c8,
- 0x080c, 0x13d4, 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6,
- 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0x20ea,
-- 0x080c, 0xad62, 0x080c, 0x13d4, 0x0804, 0x30b6, 0x0106, 0x0006,
-+ 0x080c, 0xad52, 0x080c, 0x13d4, 0x0804, 0x30b6, 0x0106, 0x0006,
- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f,
-- 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c, 0x22c8, 0x080c, 0x13d4,
-+ 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c, 0x22c8, 0x080c, 0x13d4,
- 0x0804, 0x30b6, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-- 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c, 0x13d4,
-+ 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c, 0x13d4,
- 0x080c, 0x2114, 0x04d8, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-- 0x0136, 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad62, 0x080c,
-+ 0x0136, 0x0146, 0x0156, 0x080c, 0x278f, 0x080c, 0xad52, 0x080c,
- 0x22c8, 0x080c, 0x13d4, 0x080c, 0x2114, 0x0440, 0x0106, 0x0006,
- 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x278f,
-- 0x080c, 0x20ea, 0x080c, 0x13d4, 0x080c, 0xad62, 0x080c, 0x2114,
-+ 0x080c, 0x20ea, 0x080c, 0x13d4, 0x080c, 0xad52, 0x080c, 0x2114,
- 0x00a8, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
-- 0x0156, 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad62, 0x080c,
-+ 0x0156, 0x080c, 0x278f, 0x080c, 0x20ea, 0x080c, 0xad52, 0x080c,
- 0x22c8, 0x080c, 0x13d4, 0x080c, 0x2114, 0x0000, 0x015e, 0x014e,
- 0x013e, 0x01de, 0x01ce, 0x012e, 0x000e, 0x010e, 0x000d, 0x00b6,
-- 0x00c6, 0x0026, 0x0046, 0x9026, 0x080c, 0x6bcf, 0x1904, 0x31f6,
-+ 0x00c6, 0x0026, 0x0046, 0x9026, 0x080c, 0x6bbf, 0x1904, 0x31f6,
- 0x72dc, 0x2001, 0x197c, 0x2004, 0x9005, 0x1110, 0xd29c, 0x0148,
- 0xd284, 0x1138, 0xd2bc, 0x1904, 0x31f6, 0x080c, 0x31fb, 0x0804,
-- 0x31f6, 0xd2cc, 0x1904, 0x31f6, 0x080c, 0x779e, 0x1120, 0x70af,
-+ 0x31f6, 0xd2cc, 0x1904, 0x31f6, 0x080c, 0x778e, 0x1120, 0x70af,
- 0xffff, 0x0804, 0x31f6, 0xd294, 0x0120, 0x70af, 0xffff, 0x0804,
-- 0x31f6, 0x080c, 0x347d, 0x0160, 0x080c, 0xd645, 0x0128, 0x2001,
-+ 0x31f6, 0x080c, 0x347d, 0x0160, 0x080c, 0xd632, 0x0128, 0x2001,
- 0x1818, 0x203c, 0x0804, 0x316f, 0x70af, 0xffff, 0x0804, 0x31f6,
- 0x2001, 0x1818, 0x203c, 0x7294, 0xd284, 0x0904, 0x316f, 0xd28c,
- 0x1904, 0x316f, 0x0036, 0x73ac, 0x938e, 0xffff, 0x1110, 0x2019,
-@@ -1368,110 +1356,110 @@ unsigned short risc_code01[] = {
- 0x3165, 0x908e, 0x0000, 0x0904, 0x3165, 0x908e, 0x00ff, 0x1160,
- 0x7230, 0xd284, 0x1904, 0x316a, 0x7294, 0xc28d, 0x7296, 0x70af,
- 0xffff, 0x003e, 0x0804, 0x316f, 0x2009, 0x180d, 0x210c, 0xd18c,
-- 0x0150, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c35, 0x002e, 0x0118,
-- 0x70af, 0xffff, 0x0488, 0x900e, 0x080c, 0x268c, 0x080c, 0x6749,
-+ 0x0150, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25, 0x002e, 0x0118,
-+ 0x70af, 0xffff, 0x0488, 0x900e, 0x080c, 0x268c, 0x080c, 0x6742,
- 0x1538, 0x9006, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6,
-- 0x2060, 0x080c, 0x8eee, 0x00ce, 0x090c, 0x928d, 0xb8af, 0x0000,
-- 0x080c, 0x6c11, 0x1168, 0x7030, 0xd08c, 0x0130, 0xb800, 0xd0bc,
-- 0x0138, 0x080c, 0x6aae, 0x0120, 0x080c, 0x3214, 0x0148, 0x0028,
-+ 0x2060, 0x080c, 0x8ede, 0x00ce, 0x090c, 0x927d, 0xb8af, 0x0000,
-+ 0x080c, 0x6c01, 0x1168, 0x7030, 0xd08c, 0x0130, 0xb800, 0xd0bc,
-+ 0x0138, 0x080c, 0x6a9e, 0x0120, 0x080c, 0x3214, 0x0148, 0x0028,
- 0x080c, 0x3360, 0x080c, 0x3240, 0x0118, 0x8318, 0x0804, 0x3109,
- 0x73ae, 0x0010, 0x70af, 0xffff, 0x003e, 0x0804, 0x31f6, 0x9780,
- 0x348e, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e, 0x70ac,
- 0x9096, 0xffff, 0x1118, 0x900e, 0x28a8, 0x0050, 0x9812, 0x0220,
- 0x2008, 0x9802, 0x20a8, 0x0020, 0x70af, 0xffff, 0x0804, 0x31f6,
- 0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x31eb, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x0158, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c35,
-+ 0x2004, 0xd08c, 0x0158, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25,
- 0x002e, 0x0120, 0x2009, 0xffff, 0x0804, 0x31f3, 0xc484, 0x080c,
-- 0x67b4, 0x0168, 0x080c, 0xd645, 0x1904, 0x31eb, 0x080c, 0x347d,
-- 0x1904, 0x31eb, 0x080c, 0x6749, 0x1904, 0x31f3, 0x0008, 0xc485,
-+ 0x67ad, 0x0168, 0x080c, 0xd632, 0x1904, 0x31eb, 0x080c, 0x347d,
-+ 0x1904, 0x31eb, 0x080c, 0x6742, 0x1904, 0x31f3, 0x0008, 0xc485,
- 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060, 0x080c,
-- 0x8eee, 0x00ce, 0x090c, 0x928d, 0xb8af, 0x0000, 0x080c, 0x6c11,
-+ 0x8ede, 0x00ce, 0x090c, 0x927d, 0xb8af, 0x0000, 0x080c, 0x6c01,
- 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0, 0x7294,
-- 0xd28c, 0x0180, 0x080c, 0x6c11, 0x9082, 0x0006, 0x02e0, 0xd484,
-- 0x1118, 0x080c, 0x676e, 0x0028, 0x080c, 0x33f3, 0x01a0, 0x080c,
-- 0x341e, 0x0088, 0x080c, 0x3360, 0x080c, 0xd645, 0x1160, 0x080c,
-- 0x3240, 0x0188, 0x0040, 0x080c, 0xd645, 0x1118, 0x080c, 0x33f3,
-+ 0xd28c, 0x0180, 0x080c, 0x6c01, 0x9082, 0x0006, 0x02e0, 0xd484,
-+ 0x1118, 0x080c, 0x6767, 0x0028, 0x080c, 0x33f3, 0x01a0, 0x080c,
-+ 0x341e, 0x0088, 0x080c, 0x3360, 0x080c, 0xd632, 0x1160, 0x080c,
-+ 0x3240, 0x0188, 0x0040, 0x080c, 0xd632, 0x1118, 0x080c, 0x33f3,
- 0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04, 0x3188,
- 0x70af, 0xffff, 0x0018, 0x001e, 0x015e, 0x71ae, 0x004e, 0x002e,
- 0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70af, 0x0001, 0x2009,
-- 0x007e, 0x080c, 0x6749, 0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe,
-+ 0x007e, 0x080c, 0x6742, 0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe,
- 0x080c, 0x3360, 0x04a9, 0x0128, 0x70dc, 0xc0bd, 0x70de, 0x080c,
-- 0xd389, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
-- 0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0xb1dd,
-- 0x01d0, 0x2b00, 0x6012, 0x080c, 0xd3b6, 0x6023, 0x0001, 0x9006,
-- 0x080c, 0x66e6, 0x2001, 0x0000, 0x080c, 0x66fa, 0x0126, 0x2091,
-+ 0xd376, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
-+ 0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0xb1c8,
-+ 0x01d0, 0x2b00, 0x6012, 0x080c, 0xd3a3, 0x6023, 0x0001, 0x9006,
-+ 0x080c, 0x66df, 0x2001, 0x0000, 0x080c, 0x66f3, 0x0126, 0x2091,
- 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0004, 0x080c,
-- 0xb20a, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
-+ 0xb1f5, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
- 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004, 0x9084,
-- 0x00ff, 0xb842, 0x080c, 0xb1dd, 0x0548, 0x2b00, 0x6012, 0xb800,
-+ 0x00ff, 0xb842, 0x080c, 0xb1c8, 0x0548, 0x2b00, 0x6012, 0xb800,
- 0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804, 0x9084,
-- 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x3315, 0x080c, 0xd3b6,
-- 0x6023, 0x0001, 0x9006, 0x080c, 0x66e6, 0x2001, 0x0002, 0x080c,
-- 0x66fa, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e,
-- 0x2009, 0x0002, 0x080c, 0xb20a, 0x9085, 0x0001, 0x00ce, 0x00de,
-+ 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x3315, 0x080c, 0xd3a3,
-+ 0x6023, 0x0001, 0x9006, 0x080c, 0x66df, 0x2001, 0x0002, 0x080c,
-+ 0x66f3, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e,
-+ 0x2009, 0x0002, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x00ce, 0x00de,
- 0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009, 0x0080,
-- 0x080c, 0x6749, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039,
-+ 0x080c, 0x6742, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039,
- 0x0110, 0x70e3, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005, 0x0016,
-- 0x0076, 0x00d6, 0x00c6, 0x080c, 0xb116, 0x01d0, 0x2b00, 0x6012,
-- 0x080c, 0xd3b6, 0x6023, 0x0001, 0x9006, 0x080c, 0x66e6, 0x2001,
-- 0x0002, 0x080c, 0x66fa, 0x0126, 0x2091, 0x8000, 0x70e4, 0x8000,
-- 0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xb20a, 0x9085, 0x0001,
-+ 0x0076, 0x00d6, 0x00c6, 0x080c, 0xb101, 0x01d0, 0x2b00, 0x6012,
-+ 0x080c, 0xd3a3, 0x6023, 0x0001, 0x9006, 0x080c, 0x66df, 0x2001,
-+ 0x0002, 0x080c, 0x66f3, 0x0126, 0x2091, 0x8000, 0x70e4, 0x8000,
-+ 0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xb1f5, 0x9085, 0x0001,
- 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126,
-- 0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x6749, 0x11b8, 0xb813,
-- 0x00ff, 0xb817, 0xfffd, 0xb8d7, 0x0004, 0x080c, 0xb116, 0x0170,
-- 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c, 0xd3b6,
-- 0x2009, 0x0022, 0x080c, 0xb20a, 0x9085, 0x0001, 0x012e, 0x00de,
-+ 0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x6742, 0x11b8, 0xb813,
-+ 0x00ff, 0xb817, 0xfffd, 0xb8d7, 0x0004, 0x080c, 0xb101, 0x0170,
-+ 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c, 0xd3a3,
-+ 0x2009, 0x0022, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00de,
- 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026, 0x00b6,
-- 0x21f0, 0x080c, 0xacfc, 0x0106, 0x080c, 0x97bb, 0x080c, 0x9727,
-- 0x080c, 0xac4d, 0x080c, 0xc179, 0x010e, 0x090c, 0xad18, 0x3e08,
-+ 0x21f0, 0x080c, 0xacec, 0x0106, 0x080c, 0x97ab, 0x080c, 0x9717,
-+ 0x080c, 0xac3d, 0x080c, 0xc164, 0x010e, 0x090c, 0xad08, 0x3e08,
- 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e, 0x0018, 0x20a9,
-- 0x007f, 0x900e, 0x0016, 0x080c, 0x67b4, 0x1140, 0x9686, 0x0002,
-- 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x61b7, 0x001e, 0x8108,
-+ 0x007f, 0x900e, 0x0016, 0x080c, 0x67ad, 0x1140, 0x9686, 0x0002,
-+ 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x61b0, 0x001e, 0x8108,
- 0x1f04, 0x32fa, 0x9686, 0x0001, 0x190c, 0x3451, 0x00be, 0x002e,
- 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0046,
-- 0x0036, 0x0026, 0x0016, 0x00b6, 0x080c, 0xacfc, 0x0106, 0x6210,
-- 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x97b0, 0x0076,
-- 0x2039, 0x0000, 0x080c, 0x966d, 0x2c08, 0x080c, 0xe75d, 0x007e,
-- 0x001e, 0x010e, 0x090c, 0xad18, 0xba10, 0xbb14, 0xbc84, 0x080c,
-- 0x61b7, 0xba12, 0xbb16, 0xbc86, 0x00be, 0x001e, 0x002e, 0x003e,
-+ 0x0036, 0x0026, 0x0016, 0x00b6, 0x080c, 0xacec, 0x0106, 0x6210,
-+ 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x97a0, 0x0076,
-+ 0x2039, 0x0000, 0x080c, 0x965d, 0x2c08, 0x080c, 0xe744, 0x007e,
-+ 0x001e, 0x010e, 0x090c, 0xad08, 0xba10, 0xbb14, 0xbc84, 0x080c,
-+ 0x61b0, 0xba12, 0xbb16, 0xbc86, 0x00be, 0x001e, 0x002e, 0x003e,
- 0x004e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010,
- 0x2058, 0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800,
- 0x70a8, 0x9005, 0x0110, 0x8001, 0x70aa, 0x000e, 0x00ee, 0x0005,
- 0x2071, 0x1800, 0x70e4, 0x9005, 0x0dc0, 0x8001, 0x70e6, 0x0ca8,
- 0xb800, 0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6,
-- 0x0046, 0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x080c, 0xacfc,
-- 0x0106, 0x81ff, 0x1118, 0x20a9, 0x0001, 0x0078, 0x080c, 0x5840,
-+ 0x0046, 0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x080c, 0xacec,
-+ 0x0106, 0x81ff, 0x1118, 0x20a9, 0x0001, 0x0078, 0x080c, 0x583e,
- 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2020, 0x2009, 0x002d,
-- 0x080c, 0xea8d, 0x20a9, 0x0800, 0x9016, 0x0026, 0x928e, 0x007e,
-+ 0x080c, 0xea74, 0x20a9, 0x0800, 0x9016, 0x0026, 0x928e, 0x007e,
- 0x0904, 0x33cf, 0x928e, 0x007f, 0x0904, 0x33cf, 0x928e, 0x0080,
- 0x05f0, 0x9288, 0x1000, 0x210c, 0x81ff, 0x05c8, 0x8fff, 0x1150,
- 0x2001, 0x198e, 0x0006, 0x2003, 0x0001, 0x080c, 0x33e0, 0x000e,
- 0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001, 0x0001, 0x080c,
-- 0x6bdb, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c, 0x97b0, 0x0076,
-- 0x2039, 0x0000, 0x080c, 0x966d, 0x00b6, 0x00c6, 0x0026, 0x2158,
-+ 0x6bcb, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c, 0x97a0, 0x0076,
-+ 0x2039, 0x0000, 0x080c, 0x965d, 0x00b6, 0x00c6, 0x0026, 0x2158,
- 0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118, 0xb807, 0x0404,
- 0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06, 0x002e, 0x00ce,
-- 0x00be, 0x0016, 0x2c08, 0x080c, 0xe75d, 0x001e, 0x007e, 0x002e,
-- 0x8210, 0x1f04, 0x3385, 0x010e, 0x090c, 0xad18, 0x015e, 0x001e,
-+ 0x00be, 0x0016, 0x2c08, 0x080c, 0xe744, 0x001e, 0x007e, 0x002e,
-+ 0x8210, 0x1f04, 0x3385, 0x010e, 0x090c, 0xad08, 0x015e, 0x001e,
- 0x002e, 0x003e, 0x004e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-- 0x0046, 0x0026, 0x0016, 0x080c, 0x5840, 0xd0c4, 0x0140, 0xd0a4,
-- 0x0130, 0x9006, 0x2220, 0x2009, 0x0029, 0x080c, 0xea8d, 0x001e,
-+ 0x0046, 0x0026, 0x0016, 0x080c, 0x583e, 0xd0c4, 0x0140, 0xd0a4,
-+ 0x0130, 0x9006, 0x2220, 0x2009, 0x0029, 0x080c, 0xea74, 0x001e,
- 0x002e, 0x004e, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7294,
-- 0x82ff, 0x01e8, 0x080c, 0x6c09, 0x11d0, 0x2100, 0x080c, 0x26bf,
-+ 0x82ff, 0x01e8, 0x080c, 0x6bf9, 0x11d0, 0x2100, 0x080c, 0x26bf,
- 0x81ff, 0x01b8, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1d80, 0x2c04,
- 0xd384, 0x0120, 0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff,
- 0x9116, 0x0138, 0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085,
- 0x0001, 0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0xacfc, 0x0106, 0x0036, 0x2019,
-- 0x0029, 0x00c1, 0x003e, 0x010e, 0x090c, 0xad18, 0x9180, 0x1000,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0xacec, 0x0106, 0x0036, 0x2019,
-+ 0x0029, 0x00c1, 0x003e, 0x010e, 0x090c, 0xad08, 0x9180, 0x1000,
- 0x2004, 0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1b39, 0x001e,
-- 0x6112, 0x080c, 0x3315, 0x001e, 0x080c, 0x676e, 0x012e, 0x00ce,
-- 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xa7e2, 0x080c,
-- 0xedee, 0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc,
-- 0x0005, 0x00c6, 0x00b6, 0x080c, 0x779e, 0x1118, 0x20a9, 0x0800,
-- 0x0010, 0x20a9, 0x0782, 0x080c, 0x779e, 0x1110, 0x900e, 0x0010,
-+ 0x6112, 0x080c, 0x3315, 0x001e, 0x080c, 0x6767, 0x012e, 0x00ce,
-+ 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xa7d2, 0x080c,
-+ 0xedd5, 0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc,
-+ 0x0005, 0x00c6, 0x00b6, 0x080c, 0x778e, 0x1118, 0x20a9, 0x0800,
-+ 0x0010, 0x20a9, 0x0782, 0x080c, 0x778e, 0x1110, 0x900e, 0x0010,
- 0x2009, 0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff,
-- 0x0110, 0xb800, 0xd0bc, 0x090c, 0x676e, 0x8108, 0x1f04, 0x3462,
-+ 0x0110, 0xb800, 0xd0bc, 0x090c, 0x6767, 0x8108, 0x1f04, 0x3462,
- 0x2061, 0x1800, 0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082,
- 0x60b3, 0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004,
- 0xd0bc, 0x0005, 0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026,
-@@ -1525,22 +1513,22 @@ unsigned short risc_code01[] = {
- 0x1210, 0x61d0, 0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x36b6,
- 0x61d0, 0x0804, 0x364b, 0x368d, 0x36c5, 0x36b6, 0x36d1, 0x36db,
- 0x36e1, 0x36e5, 0x36f5, 0x36f9, 0x370f, 0x3715, 0x371b, 0x3726,
-- 0x3731, 0x3740, 0x374f, 0x375d, 0x3774, 0x378f, 0x36b6, 0x383a,
-- 0x3878, 0x391d, 0x392e, 0x3951, 0x36b6, 0x36b6, 0x36b6, 0x3989,
-- 0x39a9, 0x39b2, 0x39de, 0x39e4, 0x36b6, 0x3a2a, 0x36b6, 0x36b6,
-- 0x36b6, 0x36b6, 0x36b6, 0x3a35, 0x3a3e, 0x3a46, 0x3a48, 0x36b6,
-- 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x3a78, 0x36b6, 0x36b6,
-- 0x36b6, 0x36b6, 0x36b6, 0x3a95, 0x3b19, 0x36b6, 0x36b6, 0x36b6,
-- 0x36b6, 0x36b6, 0x36b6, 0x0002, 0x3b43, 0x3b46, 0x3ba5, 0x3bbe,
-- 0x3bee, 0x3e94, 0x36b6, 0x53f5, 0x36b6, 0x36b6, 0x36b6, 0x36b6,
-- 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x370f, 0x3715, 0x4397, 0x5864,
-- 0x43b5, 0x5484, 0x54d6, 0x55e1, 0x36b6, 0x5643, 0x567f, 0x56b0,
-- 0x57c0, 0x56dd, 0x5740, 0x36b6, 0x43b9, 0x457f, 0x4595, 0x45ba,
-- 0x461f, 0x4693, 0x46b3, 0x472a, 0x4786, 0x47e2, 0x47e5, 0x480a,
-- 0x487c, 0x48e6, 0x48ee, 0x4a23, 0x4bcb, 0x4bff, 0x4e63, 0x36b6,
-- 0x4e81, 0x4f48, 0x5031, 0x508b, 0x36b6, 0x511e, 0x36b6, 0x5134,
-- 0x514f, 0x48ee, 0x5395, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c,
-- 0x4c7d, 0x0126, 0x2091, 0x8000, 0x0e04, 0x3697, 0x0010, 0x012e,
-+ 0x3731, 0x3740, 0x374f, 0x375d, 0x3774, 0x378f, 0x36b6, 0x3838,
-+ 0x3876, 0x391b, 0x392c, 0x394f, 0x36b6, 0x36b6, 0x36b6, 0x3987,
-+ 0x39a7, 0x39b0, 0x39dc, 0x39e2, 0x36b6, 0x3a28, 0x36b6, 0x36b6,
-+ 0x36b6, 0x36b6, 0x36b6, 0x3a33, 0x3a3c, 0x3a44, 0x3a46, 0x36b6,
-+ 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x3a76, 0x36b6, 0x36b6,
-+ 0x36b6, 0x36b6, 0x36b6, 0x3a93, 0x3b17, 0x36b6, 0x36b6, 0x36b6,
-+ 0x36b6, 0x36b6, 0x36b6, 0x0002, 0x3b41, 0x3b44, 0x3ba3, 0x3bbc,
-+ 0x3bec, 0x3e92, 0x36b6, 0x53f3, 0x36b6, 0x36b6, 0x36b6, 0x36b6,
-+ 0x36b6, 0x36b6, 0x36b6, 0x36b6, 0x370f, 0x3715, 0x4395, 0x5862,
-+ 0x43b3, 0x5482, 0x54d4, 0x55df, 0x36b6, 0x5641, 0x567d, 0x56ae,
-+ 0x57be, 0x56db, 0x573e, 0x36b6, 0x43b7, 0x457d, 0x4593, 0x45b8,
-+ 0x461d, 0x4691, 0x46b1, 0x4728, 0x4784, 0x47e0, 0x47e3, 0x4808,
-+ 0x487a, 0x48e4, 0x48ec, 0x4a21, 0x4bc9, 0x4bfd, 0x4e61, 0x36b6,
-+ 0x4e7f, 0x4f46, 0x502f, 0x5089, 0x36b6, 0x511c, 0x36b6, 0x5132,
-+ 0x514d, 0x48ec, 0x5393, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c,
-+ 0x4c7b, 0x0126, 0x2091, 0x8000, 0x0e04, 0x3697, 0x0010, 0x012e,
- 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010,
- 0x7833, 0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080,
- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x7007, 0x0001,
-@@ -1548,12 +1536,12 @@ unsigned short risc_code01[] = {
- 0x08b0, 0x2021, 0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021,
- 0x4005, 0x0868, 0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e,
- 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x81ff, 0x0d98, 0x0804,
-- 0x4c8a, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
-- 0x7990, 0x0804, 0x4c8d, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
-+ 0x4c88, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
-+ 0x7990, 0x0804, 0x4c8b, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
- 0x368d, 0x7984, 0x2114, 0x0804, 0x368d, 0x20e1, 0x0000, 0x2099,
- 0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003,
- 0x7984, 0x7a88, 0x7b8c, 0x0804, 0x368d, 0x7884, 0x2060, 0x0804,
-- 0x3742, 0x2009, 0x0003, 0x2011, 0x0003, 0x2019, 0x0014, 0x789b,
-+ 0x3742, 0x2009, 0x0003, 0x2011, 0x0003, 0x2019, 0x0013, 0x789b,
- 0x0137, 0x7893, 0xffff, 0x2001, 0x188f, 0x2004, 0x9005, 0x0118,
- 0x7896, 0x0804, 0x368d, 0x7897, 0x0001, 0x0804, 0x368d, 0x2039,
- 0x0001, 0x7d98, 0x7c9c, 0x0804, 0x36c9, 0x2039, 0x0001, 0x7d98,
-@@ -1568,1591 +1556,1589 @@ unsigned short risc_code01[] = {
- 0x7984, 0x2198, 0x4012, 0x0804, 0x368d, 0x2069, 0x1847, 0x7884,
- 0x7990, 0x911a, 0x1a04, 0x36c2, 0x8019, 0x0904, 0x36c2, 0x684a,
- 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006, 0x685a, 0x685e,
-- 0x080c, 0x7ae7, 0x0804, 0x368d, 0x2069, 0x1847, 0x7884, 0x7994,
-+ 0x080c, 0x7ad7, 0x0804, 0x368d, 0x2069, 0x1847, 0x7884, 0x7994,
- 0x911a, 0x1a04, 0x36c2, 0x8019, 0x0904, 0x36c2, 0x684e, 0x6946,
- 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a, 0x686e, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x6d66, 0x012e, 0x0804, 0x368d, 0x902e,
-+ 0x2091, 0x8000, 0x080c, 0x6d56, 0x012e, 0x0804, 0x368d, 0x902e,
- 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x7984,
- 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1, 0x18a6,
-- 0x4101, 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-- 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c8a,
-+ 0x4101, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c88,
- 0x701f, 0x37b3, 0x0005, 0xa864, 0x2008, 0x9084, 0x00ff, 0x9096,
- 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096, 0x0015, 0x0138,
- 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904, 0x36bf, 0x810f,
- 0x918c, 0x00ff, 0x0904, 0x36bf, 0x7112, 0x7010, 0x8001, 0x0560,
-- 0x7012, 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0x7012, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
- 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598,
- 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000,
-- 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c8a, 0x701f, 0x37f1,
-+ 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c88, 0x701f, 0x37f1,
- 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002, 0x0120, 0x9096,
-- 0x000a, 0x1904, 0x36bf, 0x0888, 0x0126, 0x2091, 0x8000, 0x7014,
-- 0x2048, 0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096,
-- 0x0029, 0x1148, 0xc2fd, 0xaa7a, 0x080c, 0x630a, 0x0138, 0xa87a,
-- 0xa982, 0x012e, 0x0060, 0x080c, 0x663a, 0x1130, 0x7007, 0x0003,
-- 0x701f, 0x381f, 0x012e, 0x0005, 0x080c, 0x725e, 0x012e, 0x0126,
-- 0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6,
-- 0x400a, 0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
-- 0x0000, 0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60,
-- 0x0804, 0x4c8d, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010,
-- 0x7883, 0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020,
-- 0x2009, 0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100,
-- 0x6200, 0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009,
-- 0x04fd, 0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001,
-- 0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a25, 0x2004, 0x9005,
-- 0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a,
-- 0x2003, 0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427,
-- 0x81ff, 0x1904, 0x36bf, 0x7984, 0x080c, 0x67b4, 0x1904, 0x36c2,
-- 0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x36c2, 0x7c88,
-- 0x7d8c, 0x080c, 0x69f1, 0x080c, 0x697e, 0x1518, 0x2061, 0x1ddc,
-- 0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014,
-- 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150,
-- 0x012e, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a04,
-- 0x36bf, 0x0c30, 0x080c, 0xcae9, 0x012e, 0x0904, 0x36bf, 0x0804,
-- 0x368d, 0x900e, 0x2001, 0x0005, 0x080c, 0x725e, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xd226, 0x080c, 0x7012, 0x012e, 0x0804, 0x368d,
-- 0x00a6, 0x2950, 0xb198, 0x080c, 0x67b4, 0x1904, 0x390a, 0xb6a4,
-- 0x9684, 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c,
-- 0x69f1, 0x080c, 0x697e, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091,
-+ 0x000a, 0x1904, 0x36bf, 0x0888, 0x7014, 0x2048, 0xa868, 0xc0fd,
-+ 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029, 0x1160, 0xc2fd,
-+ 0xaa7a, 0x080c, 0x6303, 0x0150, 0x0126, 0x2091, 0x8000, 0xa87a,
-+ 0xa982, 0x012e, 0x0050, 0x080c, 0x6633, 0x1128, 0x7007, 0x0003,
-+ 0x701f, 0x381d, 0x0005, 0x080c, 0x724e, 0x0126, 0x2091, 0x8000,
-+ 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6, 0x400a, 0x2100,
-+ 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c,
-+ 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60, 0x0804, 0x4c8b,
-+ 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010, 0x7883, 0x4000,
-+ 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020, 0x2009, 0x017f,
-+ 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100, 0x6200, 0x2061,
-+ 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009, 0x04fd, 0x2104,
-+ 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-+ 0xd084, 0x0180, 0x2001, 0x1a25, 0x2004, 0x9005, 0x0128, 0x2001,
-+ 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002,
-+ 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427, 0x81ff, 0x1904,
-+ 0x36bf, 0x7984, 0x080c, 0x67ad, 0x1904, 0x36c2, 0x7e98, 0x9684,
-+ 0x3fff, 0x9082, 0x4000, 0x1a04, 0x36c2, 0x7c88, 0x7d8c, 0x080c,
-+ 0x69e1, 0x080c, 0x696e, 0x1518, 0x2061, 0x1ddc, 0x0126, 0x2091,
- 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130,
-- 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0,
-- 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0,
-- 0x0c28, 0x080c, 0xcae9, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0,
-- 0x900e, 0x2001, 0x0005, 0x080c, 0x725e, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0xd226, 0x080c, 0x7006, 0x012e, 0x0070, 0xb097, 0x4005,
-- 0xb19a, 0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-- 0x0030, 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d,
-- 0x0001, 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x36bf,
-- 0x080c, 0x4c58, 0x0904, 0x36c2, 0x080c, 0x687b, 0x0904, 0x36bf,
-- 0x080c, 0x69f7, 0x0904, 0x36bf, 0x0804, 0x46aa, 0x81ff, 0x1904,
-- 0x36bf, 0x080c, 0x4c74, 0x0904, 0x36c2, 0x080c, 0x6a85, 0x0904,
-- 0x36bf, 0x2019, 0x0005, 0x79a8, 0x080c, 0x6a12, 0x0904, 0x36bf,
-- 0x7888, 0x908a, 0x1000, 0x1a04, 0x36c2, 0x8003, 0x800b, 0x810b,
-- 0x9108, 0x080c, 0x89a1, 0x79a8, 0xd184, 0x1904, 0x368d, 0x0804,
-- 0x46aa, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001,
-- 0x0450, 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8, 0x2508,
-- 0x080c, 0x67b4, 0x11d8, 0x080c, 0x6a85, 0x1128, 0x2009, 0x0002,
-- 0x62c0, 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x6a12,
-- 0x1118, 0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270,
-- 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x89a1, 0x8529, 0x1ae0,
-- 0x012e, 0x0804, 0x368d, 0x012e, 0x0804, 0x36bf, 0x012e, 0x0804,
-- 0x36c2, 0x080c, 0x4c58, 0x0904, 0x36c2, 0x080c, 0x687b, 0x0904,
-- 0x36bf, 0x080c, 0xacfc, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066,
-- 0x080c, 0x97b0, 0x0076, 0x903e, 0x080c, 0x966d, 0x900e, 0x080c,
-- 0xe75d, 0x007e, 0x00ce, 0x080c, 0xad18, 0x080c, 0x69f1, 0x0804,
-- 0x368d, 0x080c, 0x4c58, 0x0904, 0x36c2, 0x080c, 0x69f1, 0x2208,
-- 0x0804, 0x368d, 0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1910,
-- 0x6810, 0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e,
-- 0x2071, 0x19e8, 0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8,
-- 0x2300, 0x9218, 0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x368d,
-- 0x00f6, 0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff,
-- 0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910,
-- 0x6910, 0x62bc, 0x0804, 0x368d, 0x81ff, 0x0120, 0x2009, 0x0001,
-- 0x0804, 0x36bf, 0x0126, 0x2091, 0x8000, 0x080c, 0x5854, 0x0128,
-- 0x2009, 0x0007, 0x012e, 0x0804, 0x36bf, 0x012e, 0x615c, 0x9190,
-- 0x348e, 0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280,
-- 0x67dc, 0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001,
-- 0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003,
-- 0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002,
-- 0x0068, 0x080c, 0x779e, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c,
-- 0x0120, 0x2009, 0x0005, 0x0804, 0x36bf, 0x9036, 0x7e9a, 0x7f9e,
-- 0x0804, 0x368d, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001,
-- 0x1987, 0x2004, 0x789a, 0x0804, 0x368d, 0x0126, 0x2091, 0x8000,
-- 0x6138, 0x623c, 0x6340, 0x012e, 0x0804, 0x368d, 0x080c, 0x4c74,
-- 0x0904, 0x36c2, 0xba44, 0xbb38, 0x0804, 0x368d, 0x080c, 0x0d85,
-- 0x080c, 0x4c74, 0x2110, 0x0904, 0x36c2, 0xb804, 0x908c, 0x00ff,
-- 0x918e, 0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009,
-- 0x0009, 0x1904, 0x36bf, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005,
-- 0x00c6, 0x9066, 0x080c, 0xacfc, 0x080c, 0xa7e2, 0x080c, 0x97b0,
-- 0x0076, 0x903e, 0x080c, 0x966d, 0x900e, 0x080c, 0xe75d, 0x007e,
-- 0x00ce, 0x080c, 0xad18, 0xb807, 0x0407, 0x012e, 0x0804, 0x368d,
-- 0x614c, 0x6250, 0x7884, 0x604e, 0x7b88, 0x6352, 0x2069, 0x1847,
-- 0x831f, 0x9305, 0x6816, 0x788c, 0x2069, 0x1986, 0x2d1c, 0x206a,
-- 0x7e98, 0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1987,
-- 0x2d04, 0x266a, 0x789a, 0x0804, 0x368d, 0x0126, 0x2091, 0x8000,
-- 0x6138, 0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0eeb, 0xd0c4,
-- 0x01a8, 0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011,
-- 0x199e, 0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118,
-- 0x2214, 0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0xd0ec,
-- 0x0178, 0x6034, 0xc08d, 0x6036, 0x2001, 0x0050, 0x6076, 0x607a,
-- 0x6056, 0x606b, 0x269c, 0x00c6, 0x2061, 0x1b73, 0x2062, 0x00ce,
-- 0x2011, 0x0116, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040,
-- 0x0010, 0x918c, 0xff7f, 0x2112, 0x6134, 0xd18c, 0x2001, 0x0000,
-- 0x0108, 0x603c, 0x7988, 0x613e, 0x6140, 0x910d, 0x788c, 0x6042,
-- 0x6234, 0xd28c, 0x0120, 0x7a88, 0x9294, 0x1000, 0x9205, 0x910e,
-- 0xd1e4, 0x190c, 0x0f06, 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046,
-- 0x9084, 0x0001, 0x090c, 0x4397, 0x6040, 0xd0cc, 0x0120, 0x78b0,
-- 0x2011, 0x0114, 0x2012, 0x012e, 0x0804, 0x368d, 0x00f6, 0x2079,
-- 0x1800, 0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084,
-- 0xfebf, 0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a,
-- 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe,
-- 0x0005, 0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x36c2,
-- 0x788c, 0x902d, 0x0904, 0x36c2, 0x900e, 0x080c, 0x67b4, 0x1120,
-- 0xba44, 0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108,
-- 0x0ca0, 0x080c, 0x4c74, 0x0904, 0x36c2, 0x7888, 0x900d, 0x0904,
-- 0x36c2, 0x788c, 0x9005, 0x0904, 0x36c2, 0xba44, 0xb946, 0xbb38,
-- 0xb83a, 0x0804, 0x368d, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05,
-- 0x080c, 0x5854, 0x1904, 0x36bf, 0x00c6, 0x2061, 0x0100, 0x7984,
-- 0x9186, 0x00ff, 0x1130, 0x2001, 0x1818, 0x2004, 0x9085, 0xff00,
-- 0x0088, 0x9182, 0x007f, 0x16e0, 0x9188, 0x348e, 0x210d, 0x918c,
-- 0x00ff, 0x2001, 0x1818, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580,
-- 0x810f, 0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0xb116,
-- 0x000e, 0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x674f,
-- 0x2b08, 0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4c41,
-- 0x01d0, 0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd,
-- 0xa86a, 0x701f, 0x3b9e, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c,
-- 0xb20a, 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x36bf,
-- 0x00ce, 0x0804, 0x36c2, 0x080c, 0xb16c, 0x0cb0, 0xa830, 0x9086,
-- 0x0100, 0x0904, 0x36bf, 0x0804, 0x368d, 0x2061, 0x1a73, 0x0126,
-- 0x2091, 0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061,
-- 0x1800, 0x6354, 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa,
-- 0x012e, 0x0804, 0x368d, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904,
-- 0x36bf, 0x080c, 0x779e, 0x0904, 0x36bf, 0x0126, 0x2091, 0x8000,
-- 0x6254, 0x6074, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x26f5,
-- 0x080c, 0x5a7c, 0x012e, 0x0804, 0x368d, 0x012e, 0x0804, 0x36c2,
-- 0x0006, 0x0016, 0x00c6, 0x00e6, 0x2001, 0x19aa, 0x2070, 0x2061,
-- 0x1847, 0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x955b,
-- 0x7206, 0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091,
-- 0x8000, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x368f,
-- 0x7884, 0xd0fc, 0x0158, 0x2001, 0x002a, 0x2004, 0x9005, 0x0180,
-- 0x9082, 0x00e1, 0x0298, 0x012e, 0x0804, 0x36c2, 0x2001, 0x002a,
-- 0x2004, 0x9005, 0x0128, 0x2069, 0x1847, 0x6908, 0x9102, 0x1230,
-- 0x012e, 0x0804, 0x36c2, 0x012e, 0x0804, 0x36bf, 0x080c, 0xb094,
-- 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x3c6d, 0x00c6, 0x080c, 0x4c41,
-- 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e,
-- 0x789c, 0xa812, 0x2001, 0x002e, 0x2004, 0xa81a, 0x2001, 0x002f,
-- 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004, 0xa822, 0x2001, 0x0031,
-- 0x2004, 0xa826, 0x2001, 0x0034, 0x2004, 0xa82a, 0x2001, 0x0035,
-- 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004, 0x9080, 0x0003, 0x9084,
-- 0x00fc, 0x8004, 0xa816, 0x080c, 0x3df7, 0x0928, 0x7014, 0x2048,
-- 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120,
-- 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc,
-- 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4c8a, 0x701f,
-- 0x3d34, 0x7023, 0x0001, 0x012e, 0x0005, 0x080c, 0xacfc, 0x0046,
-- 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-- 0x080c, 0x3bd8, 0x2001, 0x19a0, 0x2003, 0x0000, 0x2021, 0x000a,
-- 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb, 0x0000, 0x60bf, 0x32e1,
-- 0x60bf, 0x0012, 0x080c, 0x3e66, 0x080c, 0x3e25, 0x00f6, 0x00e6,
-- 0x0086, 0x2940, 0x2071, 0x19e8, 0x2079, 0x0090, 0x00d6, 0x2069,
-- 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001, 0x0035, 0x2004, 0x780e,
-- 0x2001, 0x0034, 0x2004, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c,
-- 0x41db, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x40fd, 0x080c, 0x402a,
-- 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1db8, 0x080c,
-- 0x424f, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070,
-- 0x1560, 0x2071, 0x0200, 0x7037, 0x0000, 0x7050, 0x9084, 0xff00,
-- 0x9086, 0x3200, 0x1510, 0x7037, 0x0001, 0x7050, 0x9084, 0xff00,
-- 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000, 0x7054, 0x7037, 0x0000,
-- 0x715c, 0x9106, 0x1190, 0x2001, 0x1820, 0x2004, 0x9106, 0x1168,
-- 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084, 0x1e00, 0x00ce, 0x0138,
-- 0x080c, 0x4034, 0x080c, 0x3e20, 0x0058, 0x080c, 0x3e20, 0x080c,
-- 0x4173, 0x080c, 0x40f3, 0x2001, 0x020b, 0x2004, 0xd0e4, 0x0dd8,
-- 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002,
-- 0x001e, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x60bb, 0x0000,
-- 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001, 0x0004, 0x200c, 0x918c,
-- 0xfffd, 0x2102, 0x080c, 0x1352, 0x2009, 0x0028, 0x080c, 0x2220,
-- 0x2001, 0x0227, 0x200c, 0x2102, 0x080c, 0xad18, 0x00fe, 0x00ee,
-- 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e, 0x2001,
-- 0x19a0, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804, 0x368d, 0x012e,
-- 0x2021, 0x400c, 0x0804, 0x368f, 0x0016, 0x0026, 0x0036, 0x0046,
-- 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014, 0x2048,
-- 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005, 0x0904, 0x3d90,
-- 0x2048, 0x1f04, 0x3d44, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494,
-- 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021,
-- 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e, 0x9086, 0x0103,
-- 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-- 0x9080, 0x001b, 0x080c, 0x4c8a, 0x701f, 0x3d34, 0x00b0, 0x8906,
-+ 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e, 0x9ce0,
-+ 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a04, 0x36bf, 0x0c30,
-+ 0x080c, 0xcad4, 0x012e, 0x0904, 0x36bf, 0x0804, 0x368d, 0x900e,
-+ 0x2001, 0x0005, 0x080c, 0x724e, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xd213, 0x080c, 0x7002, 0x012e, 0x0804, 0x368d, 0x00a6, 0x2950,
-+ 0xb198, 0x080c, 0x67ad, 0x1904, 0x3908, 0xb6a4, 0x9684, 0x3fff,
-+ 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x69e1, 0x080c,
-+ 0x696e, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091, 0x8000, 0x6000,
-+ 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406,
-+ 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x001c, 0x2001,
-+ 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28, 0x080c,
-+ 0xcad4, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e, 0x2001,
-+ 0x0005, 0x080c, 0x724e, 0x0126, 0x2091, 0x8000, 0x080c, 0xd213,
-+ 0x080c, 0x6ff6, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a, 0x0010,
-+ 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x2a48,
-+ 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001, 0x2008,
-+ 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x4c56,
-+ 0x0904, 0x36c2, 0x080c, 0x6874, 0x0904, 0x36bf, 0x080c, 0x69e7,
-+ 0x0904, 0x36bf, 0x0804, 0x46a8, 0x81ff, 0x1904, 0x36bf, 0x080c,
-+ 0x4c72, 0x0904, 0x36c2, 0x080c, 0x6a75, 0x0904, 0x36bf, 0x2019,
-+ 0x0005, 0x79a8, 0x080c, 0x6a02, 0x0904, 0x36bf, 0x7888, 0x908a,
-+ 0x1000, 0x1a04, 0x36c2, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
-+ 0x8991, 0x79a8, 0xd184, 0x1904, 0x368d, 0x0804, 0x46a8, 0x0126,
-+ 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450, 0x2029,
-+ 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c, 0x67ad,
-+ 0x11d8, 0x080c, 0x6a75, 0x1128, 0x2009, 0x0002, 0x62c0, 0x2518,
-+ 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x6a02, 0x1118, 0x2009,
-+ 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003, 0x800b,
-+ 0x810b, 0x9108, 0x080c, 0x8991, 0x8529, 0x1ae0, 0x012e, 0x0804,
-+ 0x368d, 0x012e, 0x0804, 0x36bf, 0x012e, 0x0804, 0x36c2, 0x080c,
-+ 0x4c56, 0x0904, 0x36c2, 0x080c, 0x6874, 0x0904, 0x36bf, 0x080c,
-+ 0xacec, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c, 0x97a0,
-+ 0x0076, 0x903e, 0x080c, 0x965d, 0x900e, 0x080c, 0xe744, 0x007e,
-+ 0x00ce, 0x080c, 0xad08, 0x080c, 0x69e1, 0x0804, 0x368d, 0x080c,
-+ 0x4c56, 0x0904, 0x36c2, 0x080c, 0x69e1, 0x2208, 0x0804, 0x368d,
-+ 0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1910, 0x6810, 0x6914,
-+ 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x2071, 0x19e8,
-+ 0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8, 0x2300, 0x9218,
-+ 0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x368d, 0x00f6, 0x0016,
-+ 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110, 0x2178,
-+ 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910, 0x6910, 0x62bc,
-+ 0x0804, 0x368d, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x5852, 0x0128, 0x2009, 0x0007,
-+ 0x012e, 0x0804, 0x36bf, 0x012e, 0x615c, 0x9190, 0x348e, 0x2215,
-+ 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280, 0x67dc, 0x97c4,
-+ 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001, 0x00e8, 0x97c4,
-+ 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003, 0x00a8, 0x97c4,
-+ 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002, 0x0068, 0x080c,
-+ 0x778e, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c, 0x0120, 0x2009,
-+ 0x0005, 0x0804, 0x36bf, 0x9036, 0x7e9a, 0x7f9e, 0x0804, 0x368d,
-+ 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001, 0x1987, 0x2004,
-+ 0x789a, 0x0804, 0x368d, 0x0126, 0x2091, 0x8000, 0x6138, 0x623c,
-+ 0x6340, 0x012e, 0x0804, 0x368d, 0x080c, 0x4c72, 0x0904, 0x36c2,
-+ 0xba44, 0xbb38, 0x0804, 0x368d, 0x080c, 0x0d85, 0x080c, 0x4c72,
-+ 0x2110, 0x0904, 0x36c2, 0xb804, 0x908c, 0x00ff, 0x918e, 0x0006,
-+ 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009, 0x0009, 0x1904,
-+ 0x36bf, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005, 0x00c6, 0x9066,
-+ 0x080c, 0xacec, 0x080c, 0xa7d2, 0x080c, 0x97a0, 0x0076, 0x903e,
-+ 0x080c, 0x965d, 0x900e, 0x080c, 0xe744, 0x007e, 0x00ce, 0x080c,
-+ 0xad08, 0xb807, 0x0407, 0x012e, 0x0804, 0x368d, 0x614c, 0x6250,
-+ 0x7884, 0x604e, 0x7b88, 0x6352, 0x2069, 0x1847, 0x831f, 0x9305,
-+ 0x6816, 0x788c, 0x2069, 0x1986, 0x2d1c, 0x206a, 0x7e98, 0x9682,
-+ 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1987, 0x2d04, 0x266a,
-+ 0x789a, 0x0804, 0x368d, 0x0126, 0x2091, 0x8000, 0x6138, 0x7884,
-+ 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0eeb, 0xd0c4, 0x01a8, 0x00d6,
-+ 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011, 0x199e, 0x2012,
-+ 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214, 0x6a5a,
-+ 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0xd0ec, 0x0178, 0x6034,
-+ 0xc08d, 0x6036, 0x2001, 0x0050, 0x6076, 0x607a, 0x6056, 0x606b,
-+ 0x269c, 0x00c6, 0x2061, 0x1b73, 0x2062, 0x00ce, 0x2011, 0x0116,
-+ 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040, 0x0010, 0x918c,
-+ 0xff7f, 0x2112, 0x6134, 0xd18c, 0x2001, 0x0000, 0x0108, 0x603c,
-+ 0x7988, 0x613e, 0x6140, 0x910d, 0x788c, 0x6042, 0x6234, 0xd28c,
-+ 0x0120, 0x7a88, 0x9294, 0x1000, 0x9205, 0x910e, 0xd1e4, 0x190c,
-+ 0x0f06, 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046, 0x9084, 0x0001,
-+ 0x090c, 0x4395, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011, 0x0114,
-+ 0x2012, 0x012e, 0x0804, 0x368d, 0x00f6, 0x2079, 0x1800, 0x7a38,
-+ 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf, 0x8002,
-+ 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897, 0x4000,
-+ 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005, 0x7898,
-+ 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x36c2, 0x788c, 0x902d,
-+ 0x0904, 0x36c2, 0x900e, 0x080c, 0x67ad, 0x1120, 0xba44, 0xbb38,
-+ 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0, 0x080c,
-+ 0x4c72, 0x0904, 0x36c2, 0x7888, 0x900d, 0x0904, 0x36c2, 0x788c,
-+ 0x9005, 0x0904, 0x36c2, 0xba44, 0xb946, 0xbb38, 0xb83a, 0x0804,
-+ 0x368d, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c, 0x5852,
-+ 0x1904, 0x36bf, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186, 0x00ff,
-+ 0x1130, 0x2001, 0x1818, 0x2004, 0x9085, 0xff00, 0x0088, 0x9182,
-+ 0x007f, 0x16e0, 0x9188, 0x348e, 0x210d, 0x918c, 0x00ff, 0x2001,
-+ 0x1818, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f, 0x9105,
-+ 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0xb101, 0x000e, 0x0510,
-+ 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x6748, 0x2b08, 0x00be,
-+ 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4c3f, 0x01d0, 0x9006,
-+ 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x701f,
-+ 0x3b9c, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0xb1f5, 0x012e,
-+ 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x36bf, 0x00ce, 0x0804,
-+ 0x36c2, 0x080c, 0xb157, 0x0cb0, 0xa830, 0x9086, 0x0100, 0x0904,
-+ 0x36bf, 0x0804, 0x368d, 0x2061, 0x1a73, 0x0126, 0x2091, 0x8000,
-+ 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800, 0x6354,
-+ 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa, 0x012e, 0x0804,
-+ 0x368d, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x36bf, 0x080c,
-+ 0x778e, 0x0904, 0x36bf, 0x0126, 0x2091, 0x8000, 0x6254, 0x6074,
-+ 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x26f5, 0x080c, 0x5a75,
-+ 0x012e, 0x0804, 0x368d, 0x012e, 0x0804, 0x36c2, 0x0006, 0x0016,
-+ 0x00c6, 0x00e6, 0x2001, 0x19aa, 0x2070, 0x2061, 0x1847, 0x6008,
-+ 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x954b, 0x7206, 0x00ee,
-+ 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff,
-+ 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x368f, 0x7884, 0xd0fc,
-+ 0x0158, 0x2001, 0x002a, 0x2004, 0x9005, 0x0180, 0x9082, 0x00e1,
-+ 0x0298, 0x012e, 0x0804, 0x36c2, 0x2001, 0x002a, 0x2004, 0x9005,
-+ 0x0128, 0x2069, 0x1847, 0x6908, 0x9102, 0x1230, 0x012e, 0x0804,
-+ 0x36c2, 0x012e, 0x0804, 0x36bf, 0x080c, 0xb07f, 0x0dd0, 0x7884,
-+ 0xd0fc, 0x0904, 0x3c6b, 0x00c6, 0x080c, 0x4c3f, 0x00ce, 0x0d88,
-+ 0xa867, 0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812,
-+ 0x2001, 0x002e, 0x2004, 0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e,
-+ 0x2001, 0x0030, 0x2004, 0xa822, 0x2001, 0x0031, 0x2004, 0xa826,
-+ 0x2001, 0x0034, 0x2004, 0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e,
-+ 0x2001, 0x002a, 0x2004, 0x9080, 0x0003, 0x9084, 0x00fc, 0x8004,
-+ 0xa816, 0x080c, 0x3df5, 0x0928, 0x7014, 0x2048, 0xad2c, 0xac28,
-+ 0xab1c, 0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
-+ 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x001b, 0x080c, 0x4c88, 0x701f, 0x3d32, 0x7023,
-+ 0x0001, 0x012e, 0x0005, 0x080c, 0xacec, 0x0046, 0x0086, 0x0096,
-+ 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3bd6,
-+ 0x2001, 0x19a0, 0x2003, 0x0000, 0x2021, 0x000a, 0x2061, 0x0100,
-+ 0x6104, 0x0016, 0x60bb, 0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012,
-+ 0x080c, 0x3e64, 0x080c, 0x3e23, 0x00f6, 0x00e6, 0x0086, 0x2940,
-+ 0x2071, 0x19e8, 0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884,
-+ 0xd0b4, 0x0140, 0x2001, 0x0035, 0x2004, 0x780e, 0x2001, 0x0034,
-+ 0x2004, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x41d9, 0x008e,
-+ 0x00ee, 0x00fe, 0x080c, 0x40fb, 0x080c, 0x4028, 0x05b8, 0x2001,
-+ 0x020b, 0x2004, 0x9084, 0x0140, 0x1db8, 0x080c, 0x424d, 0x00f6,
-+ 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x1560, 0x2071,
-+ 0x0200, 0x7037, 0x0000, 0x7050, 0x9084, 0xff00, 0x9086, 0x3200,
-+ 0x1510, 0x7037, 0x0001, 0x7050, 0x9084, 0xff00, 0x9086, 0xe100,
-+ 0x11d0, 0x7037, 0x0000, 0x7054, 0x7037, 0x0000, 0x715c, 0x9106,
-+ 0x1190, 0x2001, 0x1820, 0x2004, 0x9106, 0x1168, 0x00c6, 0x2061,
-+ 0x0100, 0x6024, 0x9084, 0x1e00, 0x00ce, 0x0138, 0x080c, 0x4032,
-+ 0x080c, 0x3e1e, 0x0058, 0x080c, 0x3e1e, 0x080c, 0x4171, 0x080c,
-+ 0x40f1, 0x2001, 0x020b, 0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a,
-+ 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x001e, 0x6106,
-+ 0x2011, 0x020d, 0x2013, 0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108,
-+ 0x60bf, 0x0012, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102,
-+ 0x080c, 0x1352, 0x2009, 0x0028, 0x080c, 0x2220, 0x2001, 0x0227,
-+ 0x200c, 0x2102, 0x080c, 0xad08, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e, 0x2001, 0x19a0, 0x2004,
-+ 0x9005, 0x1118, 0x012e, 0x0804, 0x368d, 0x012e, 0x2021, 0x400c,
-+ 0x0804, 0x368f, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076,
-+ 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014, 0x2048, 0x7020, 0x20a8,
-+ 0x8000, 0x7022, 0xa804, 0x9005, 0x0904, 0x3d8e, 0x2048, 0x1f04,
-+ 0x3d42, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598, 0xa930,
-+ 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x0096,
-+ 0x7014, 0x2048, 0xa864, 0x009e, 0x9086, 0x0103, 0x0170, 0x8906,
- 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b,
-- 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0fd6,
-- 0x000e, 0x080c, 0x4c8d, 0x701f, 0x3d34, 0x015e, 0x00de, 0x009e,
-- 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005,
-- 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118, 0x701f, 0x3df5,
-- 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009, 0x007f,
-- 0x080c, 0x6749, 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff, 0xb817,
-- 0xfffd, 0x080c, 0xd409, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e,
-- 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904, 0x36bf, 0x0016,
-- 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6,
-- 0x0156, 0x701f, 0x3dc7, 0x7007, 0x0003, 0x0804, 0x3d85, 0xa830,
-- 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x368f, 0x0076, 0xad10,
-- 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029,
-- 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-- 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8,
-- 0x20a0, 0x0006, 0x080c, 0x0fd6, 0x000e, 0x080c, 0x4c8d, 0x007e,
-- 0x701f, 0x3d34, 0x7023, 0x0001, 0x0005, 0x0804, 0x368d, 0x0156,
-- 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833, 0x001e, 0x0010,
-- 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c, 0x4c41, 0x001e,
-- 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58, 0x9006,
-- 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006, 0x00f6,
-- 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e, 0x0005,
-- 0x2001, 0x19a0, 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6, 0x00c6,
-- 0x2061, 0x0200, 0x2001, 0x19ab, 0x2004, 0x601a, 0x2061, 0x0100,
-- 0x2001, 0x19aa, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x080c,
-- 0x4c41, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001,
-- 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2061,
-- 0x0090, 0x2079, 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036, 0x2009,
-- 0x0040, 0x080c, 0x2220, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-- 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca, 0x9006,
-- 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x080c,
-- 0x4c41, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a,
-- 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031, 0x2004, 0xa86a,
-- 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873, 0x0000,
-- 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300, 0x2003, 0x0000,
-- 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d,
-- 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff,
-- 0x0148, 0x080c, 0x2a77, 0x1130, 0x9006, 0x080c, 0x29ca, 0x9006,
-- 0x080c, 0x29ad, 0x2001, 0x199f, 0x2003, 0x0000, 0x7884, 0x9084,
-- 0x0007, 0x0002, 0x3eb5, 0x3eb6, 0x3eb7, 0x3eb2, 0x3eb2, 0x3eb2,
-- 0x3eb2, 0x3eb2, 0x012e, 0x0804, 0x36c2, 0x0ce0, 0x0cd8, 0x080c,
-- 0x779e, 0x1128, 0x012e, 0x2009, 0x0016, 0x0804, 0x36bf, 0x81ff,
-- 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x368f, 0x2001, 0x0141,
-- 0x2004, 0xd0dc, 0x0db0, 0x080c, 0xacfc, 0x0086, 0x0096, 0x00a6,
-- 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3bd8, 0x2009,
-- 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060,
-- 0x2058, 0x080c, 0x432a, 0x080c, 0x427a, 0x903e, 0x2720, 0x00f6,
-- 0x00e6, 0x0086, 0x2940, 0x2071, 0x19e8, 0x2079, 0x0090, 0x00d6,
-- 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0,
-- 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x41db, 0x080c, 0x2a7f,
-- 0x080c, 0x2a7f, 0x080c, 0x2a7f, 0x080c, 0x2a7f, 0x080c, 0x41db,
-- 0x008e, 0x00ee, 0x00fe, 0x080c, 0x40fd, 0x2009, 0x9c40, 0x8109,
-- 0x11b0, 0x080c, 0x4034, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd,
-- 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae,
-- 0x009e, 0x008e, 0x2009, 0x0017, 0x080c, 0x36bf, 0x0cf8, 0x2001,
-- 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000,
-- 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff,
-- 0x0150, 0x080c, 0x40db, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c,
-- 0x4034, 0x0804, 0x3fdd, 0x080c, 0x424f, 0x080c, 0x4173, 0x080c,
-- 0x40be, 0x080c, 0x40f3, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac,
-- 0x0130, 0x8b58, 0x080c, 0x4034, 0x00fe, 0x0804, 0x3fdd, 0x00fe,
-- 0x080c, 0x402a, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001,
-- 0x0033, 0x2502, 0x080c, 0x4034, 0x0080, 0x87ff, 0x0138, 0x2001,
-- 0x0201, 0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a6e,
-- 0x2004, 0x9086, 0x0000, 0x1904, 0x3f2d, 0x2001, 0x032f, 0x2003,
-- 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3fdd,
-- 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3fdd,
-- 0xa013, 0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac,
-- 0x1148, 0x2001, 0x1a6e, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003,
-- 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016,
-- 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c, 0x2220, 0x2900, 0xa85a,
-- 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6,
-- 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203,
-- 0x2004, 0x1f04, 0x3fb4, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0,
-- 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061,
-- 0x0090, 0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-- 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e,
-- 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3ee7, 0x001e, 0x00c6, 0x2001,
-- 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106,
-- 0x2011, 0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c,
-- 0xfffd, 0x2102, 0x080c, 0x1352, 0x7884, 0x9084, 0x0003, 0x9086,
-- 0x0002, 0x01b0, 0x2009, 0x0028, 0x080c, 0x2220, 0x2001, 0x0227,
-- 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ff, 0x080c, 0x2b29, 0x6052,
-- 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010,
-- 0x080c, 0xad18, 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05,
-- 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-- 0x008e, 0x1118, 0x012e, 0x0804, 0x368d, 0x012e, 0x2021, 0x400c,
-- 0x0804, 0x368f, 0x9085, 0x0001, 0x1d04, 0x4033, 0x2091, 0x6000,
-- 0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105, 0x2003, 0x0010,
-- 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a6e, 0x2003, 0x0000,
-- 0x0071, 0x2009, 0x0048, 0x080c, 0x2220, 0x2001, 0x0227, 0x2024,
-- 0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6,
-- 0x00e6, 0x2071, 0x19e8, 0x7054, 0x9086, 0x0000, 0x0520, 0x2079,
-- 0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
-- 0x1120, 0x2009, 0x0040, 0x080c, 0x2220, 0x782c, 0xd0fc, 0x0d88,
-- 0x080c, 0x424f, 0x7054, 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004,
-- 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2220, 0x782b,
-- 0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
-- 0x0100, 0x2001, 0x1818, 0x200c, 0x7932, 0x7936, 0x080c, 0x26d5,
-- 0x080c, 0x2af6, 0x080c, 0x2b29, 0x784b, 0xf7f7, 0x7843, 0x0090,
-- 0x7843, 0x0010, 0x7850, 0xc0e5, 0x7852, 0x2019, 0x61a8, 0x7820,
-- 0xd09c, 0x0110, 0x8319, 0x1dd8, 0x7850, 0xc0e4, 0x7852, 0x2011,
-- 0x0048, 0x080c, 0x2ad3, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001,
-- 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2a99, 0x2011,
-- 0x0020, 0x080c, 0x2ad3, 0x7843, 0x0000, 0x9006, 0x080c, 0x2a99,
-- 0x2011, 0x0048, 0x080c, 0x2ad3, 0x00fe, 0x0005, 0x7884, 0xd0ac,
-- 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a6e, 0x2079, 0x0320, 0x2001,
-- 0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086, 0x0000, 0x1140,
-- 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003, 0x782b, 0x0019,
-- 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe,
-- 0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a, 0x2009, 0x0033,
-- 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4,
-- 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084,
-- 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100,
-- 0x2001, 0x19ab, 0x2004, 0x70e2, 0x080c, 0x3e16, 0x1188, 0x2001,
-- 0x1820, 0x2004, 0x2009, 0x181f, 0x210c, 0x918c, 0x00ff, 0x706e,
-- 0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073, 0xe109, 0x0080,
-- 0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1818, 0x210c, 0x716e,
-- 0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000, 0x7073, 0x0809,
-- 0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a, 0x7080, 0x8000,
-- 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6,
-- 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085,
-- 0x0092, 0x7016, 0x080c, 0x424f, 0x00f6, 0x2071, 0x1a6e, 0x2079,
-- 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c,
-- 0x780e, 0x6898, 0x780a, 0x00de, 0x080c, 0x3e16, 0x0140, 0x2001,
-- 0x199f, 0x200c, 0x2003, 0x0001, 0x918e, 0x0001, 0x0120, 0x2009,
-- 0x03e8, 0x8109, 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004,
-- 0x2011, 0x0011, 0x080c, 0x41db, 0x2011, 0x0001, 0x080c, 0x41db,
-- 0x00fe, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a6e, 0x2079,
-- 0x0320, 0x792c, 0xd1fc, 0x0904, 0x41d8, 0x782b, 0x0002, 0x9026,
-- 0xd19c, 0x1904, 0x41d4, 0x7000, 0x0002, 0x41d8, 0x4189, 0x41b9,
-- 0x41d4, 0xd1bc, 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011,
-- 0x0001, 0x080c, 0x41db, 0x0904, 0x41d8, 0x080c, 0x41db, 0x0804,
-- 0x41d8, 0x00f6, 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810,
-- 0x7914, 0x782b, 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c,
-- 0x81ff, 0x0de8, 0x080c, 0x40db, 0x2009, 0x0001, 0x00f6, 0x2079,
-- 0x0300, 0x78b8, 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a,
-- 0x00f8, 0x8001, 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc,
-- 0x1904, 0x417d, 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092,
-- 0x0004, 0x9086, 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031,
-- 0xa212, 0xd1dc, 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000,
-- 0x00ee, 0x00fe, 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036,
-- 0x0096, 0xa016, 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a,
-- 0x831c, 0x831c, 0x938a, 0x0007, 0x1a0c, 0x0d85, 0x9398, 0x4209,
-- 0x231d, 0x083f, 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102,
-- 0x009e, 0x003e, 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048,
-- 0xa804, 0xa05a, 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001,
-- 0x0005, 0x4246, 0x423d, 0x4234, 0x422b, 0x4222, 0x4219, 0x4210,
-- 0xa964, 0x7902, 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916,
-- 0x0005, 0xa974, 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980,
-- 0x7916, 0x0005, 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912,
-- 0xa990, 0x7916, 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c,
-- 0x7912, 0xa9a0, 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906,
-- 0xa9ac, 0x7912, 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8,
-- 0x7906, 0xa9bc, 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902,
-- 0xa9c8, 0x7906, 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6,
-- 0x00e6, 0x0086, 0x2071, 0x19e8, 0x2079, 0x0090, 0x792c, 0xd1fc,
-- 0x01e8, 0x782b, 0x0002, 0x2940, 0x9026, 0x7054, 0x0002, 0x4276,
-- 0x4262, 0x426d, 0x8001, 0x7056, 0xd19c, 0x1180, 0x2011, 0x0001,
-- 0x080c, 0x41db, 0x190c, 0x41db, 0x0048, 0x8001, 0x7056, 0x782c,
-- 0xd0fc, 0x1d38, 0x2011, 0x0001, 0x080c, 0x41db, 0x008e, 0x00ee,
-- 0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200,
-+ 0x080c, 0x4c88, 0x701f, 0x3d32, 0x00b0, 0x8906, 0x8006, 0x8007,
-+ 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0,
-+ 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0fd6, 0x000e, 0x080c,
-+ 0x4c8b, 0x701f, 0x3d32, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e,
-+ 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x7014, 0x2048,
-+ 0xa864, 0x9086, 0x0103, 0x1118, 0x701f, 0x3df3, 0x0450, 0x7014,
-+ 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009, 0x007f, 0x080c, 0x6742,
-+ 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff, 0xb817, 0xfffd, 0x080c,
-+ 0xd3f6, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e,
-+ 0x003e, 0x002e, 0x001e, 0x0904, 0x36bf, 0x0016, 0x0026, 0x0036,
-+ 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x701f,
-+ 0x3dc5, 0x7007, 0x0003, 0x0804, 0x3d83, 0xa830, 0x9086, 0x0100,
-+ 0x2021, 0x400c, 0x0904, 0x368f, 0x0076, 0xad10, 0xac0c, 0xab24,
-+ 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021,
-+ 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-+ 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006,
-+ 0x080c, 0x0fd6, 0x000e, 0x080c, 0x4c8b, 0x007e, 0x701f, 0x3d32,
-+ 0x7023, 0x0001, 0x0005, 0x0804, 0x368d, 0x0156, 0x00c6, 0xa814,
-+ 0x908a, 0x001e, 0x0218, 0xa833, 0x001e, 0x0010, 0xa832, 0x0078,
-+ 0x81ff, 0x0168, 0x0016, 0x080c, 0x4c3f, 0x001e, 0x0130, 0xa800,
-+ 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58, 0x9006, 0x0010, 0x9085,
-+ 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006, 0x00f6, 0x2079, 0x0000,
-+ 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e, 0x0005, 0x2001, 0x19a0,
-+ 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200,
- 0x2001, 0x19ab, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19aa,
-- 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004,
-- 0x9005, 0x0520, 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f,
-- 0x201c, 0x080c, 0x4c41, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a,
-- 0x978a, 0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708,
-- 0x903e, 0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e,
-- 0x080c, 0x42f2, 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4c41,
-- 0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e,
-- 0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a,
-- 0x2004, 0x9084, 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872,
-- 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036,
-- 0x2009, 0x0040, 0x080c, 0x2220, 0x2001, 0x002a, 0x2004, 0x9084,
-- 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6,
-- 0x000e, 0x78ca, 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee,
-- 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0,
-- 0x20e1, 0x0000, 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306,
-- 0x9006, 0x700a, 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112,
-- 0x702b, 0x0041, 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b,
-- 0x0040, 0x4005, 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096,
-- 0x2940, 0x0086, 0x080c, 0x4c41, 0x008e, 0xa058, 0x00a6, 0x2050,
-- 0x2900, 0xb006, 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001,
-- 0x00ee, 0x0005, 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528,
-- 0x2038, 0x2001, 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c,
-- 0x4c41, 0x2940, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a,
-- 0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e,
-- 0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c,
-- 0x42f2, 0x1d68, 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4c41, 0x2940,
-+ 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x080c, 0x4c3f, 0xa813,
-+ 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004,
-+ 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2061, 0x0090, 0x2079,
-+ 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c,
-+ 0x2220, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0x601a,
-+ 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca, 0x9006, 0x600a, 0x600e,
-+ 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x080c, 0x4c3f, 0x2940,
- 0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030,
-- 0x2004, 0xa066, 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a,
-- 0x2004, 0x9084, 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072,
-- 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001,
-- 0x0101, 0x200c, 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001,
-- 0x1a6e, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001,
-- 0x0300, 0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001,
-- 0x0004, 0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001,
-- 0x9006, 0x4004, 0x20a9, 0x0014, 0x20a1, 0xffec, 0x20e9, 0x0000,
-- 0x9006, 0x4004, 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086,
-- 0x0052, 0x0108, 0x0005, 0x0804, 0x368d, 0x7d98, 0x7c9c, 0x0804,
-- 0x3791, 0x080c, 0x779e, 0x190c, 0x6162, 0x6040, 0x9084, 0x0020,
-- 0x09b1, 0x2069, 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88,
-- 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4c8a, 0x701f, 0x43d1,
-- 0x0005, 0x080c, 0x584f, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095,
-- 0x20d8, 0x21d0, 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x36c2,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x6804, 0x0118, 0xc0a4, 0xc0ac,
-- 0x6806, 0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x36c2, 0xd094, 0x00c6,
-- 0x2061, 0x0100, 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218,
-- 0x918c, 0xffdf, 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c,
-- 0x00c6, 0x2061, 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010,
-- 0x918c, 0xffef, 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a,
-- 0x007f, 0x1a04, 0x36c2, 0x9288, 0x348e, 0x210d, 0x918c, 0x00ff,
-- 0x6166, 0xd0dc, 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x36c2,
-- 0x605e, 0x6888, 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004,
-- 0x0006, 0x2009, 0x19b2, 0x9080, 0x27d0, 0x2005, 0x200a, 0x2008,
-- 0x2001, 0x0018, 0x080c, 0xaced, 0x2009, 0x0390, 0x200b, 0x0400,
-- 0x000e, 0x2009, 0x19b3, 0x9080, 0x27d4, 0x2005, 0x200a, 0x6808,
-- 0x908a, 0x0100, 0x0a04, 0x36c2, 0x908a, 0x0841, 0x1a04, 0x36c2,
-- 0x9084, 0x0007, 0x1904, 0x36c2, 0x680c, 0x9005, 0x0904, 0x36c2,
-- 0x6810, 0x9005, 0x0904, 0x36c2, 0x6848, 0x6940, 0x910a, 0x1a04,
-- 0x36c2, 0x8001, 0x0904, 0x36c2, 0x684c, 0x6944, 0x910a, 0x1a04,
-- 0x36c2, 0x8001, 0x0904, 0x36c2, 0x6814, 0x908c, 0x00ff, 0x614e,
-- 0x8007, 0x9084, 0x00ff, 0x6052, 0x080c, 0x7ae7, 0x080c, 0x6cfc,
-- 0x080c, 0x6d66, 0x6808, 0x602a, 0x080c, 0x2192, 0x2009, 0x0170,
-- 0x200b, 0x0080, 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08,
-- 0x080c, 0x272f, 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x456d,
-- 0x6818, 0x691c, 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f,
-- 0x6016, 0x611a, 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830,
-- 0x6934, 0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010,
-- 0x9084, 0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f,
-- 0x8217, 0x831f, 0x20a9, 0x0004, 0x20a1, 0x19b4, 0x20e9, 0x0001,
-- 0x4001, 0x20a9, 0x0004, 0x20a1, 0x19ce, 0x20e9, 0x0001, 0x4001,
-- 0x080c, 0x8b26, 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384,
-- 0x01c8, 0x0020, 0x839d, 0x12b0, 0x3508, 0x8109, 0x080c, 0x80fe,
-- 0x6878, 0x6016, 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a,
-- 0x9184, 0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010,
-- 0x6003, 0x0001, 0x1f04, 0x44c2, 0x00ce, 0x00c6, 0x2061, 0x199c,
-- 0x2001, 0x180d, 0x2004, 0xd08c, 0x11a8, 0x6a88, 0x9284, 0xc000,
-- 0x2010, 0x9286, 0x0000, 0x1158, 0x2063, 0x0000, 0x2001, 0x0001,
-- 0x080c, 0x29ca, 0x2001, 0x0001, 0x080c, 0x29ad, 0x0088, 0x9286,
-- 0x4000, 0x1148, 0x2063, 0x0001, 0x9006, 0x080c, 0x29ca, 0x9006,
-- 0x080c, 0x29ad, 0x0028, 0x9286, 0x8000, 0x1d30, 0x2063, 0x0002,
-- 0x00ce, 0x00e6, 0x2c70, 0x080c, 0x0ed3, 0x00ee, 0x080c, 0x2af6,
-- 0x080c, 0x2b29, 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114, 0x2204,
-- 0x9085, 0x0180, 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086, 0x0030,
-- 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001, 0x197c,
-- 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170, 0x928e, 0x0010,
-- 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c, 0x27a4,
-- 0x2001, 0x196d, 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061, 0x0100,
-- 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c, 0x779e, 0x0128,
-- 0x080c, 0x5128, 0x0110, 0x080c, 0x26f5, 0x60d4, 0x9005, 0x01c0,
-- 0x6003, 0x0001, 0x2009, 0x4555, 0x00e0, 0x080c, 0x779e, 0x1168,
-- 0x2011, 0x7612, 0x080c, 0x8993, 0x2011, 0x7605, 0x080c, 0x8a9f,
-- 0x080c, 0x7abb, 0x080c, 0x76cd, 0x0040, 0x080c, 0x6058, 0x0028,
-- 0x6003, 0x0004, 0x2009, 0x456d, 0x0020, 0x080c, 0x6b73, 0x0804,
-- 0x368d, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c,
-- 0x1118, 0x2091, 0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000,
-- 0x9086, 0x0000, 0x0904, 0x36bf, 0x2069, 0x1847, 0x7890, 0x6842,
-- 0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
-- 0x7d98, 0x2039, 0x0001, 0x0804, 0x4c8d, 0x9006, 0x080c, 0x26f5,
-- 0x81ff, 0x1904, 0x36bf, 0x080c, 0x779e, 0x11b0, 0x080c, 0x7ab6,
-- 0x080c, 0x619d, 0x080c, 0x3482, 0x0118, 0x6130, 0xc18d, 0x6132,
-- 0x080c, 0xd645, 0x0130, 0x080c, 0x77c1, 0x1118, 0x080c, 0x7772,
-- 0x0038, 0x080c, 0x76cd, 0x0020, 0x080c, 0x6162, 0x080c, 0x6058,
-- 0x0804, 0x368d, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x779e, 0x1110,
-- 0x0804, 0x36bf, 0x0126, 0x2091, 0x8000, 0x6194, 0x81ff, 0x0190,
-- 0x704f, 0x0000, 0x2001, 0x1d80, 0x2009, 0x0040, 0x7a8c, 0x7b88,
-- 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4c8d, 0x701f, 0x368b,
-- 0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9,
-- 0x0040, 0x20e9, 0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304,
-- 0x655c, 0x9588, 0x348e, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e,
-- 0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x67b4, 0x1190,
-- 0xb814, 0x821c, 0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007,
-- 0x201a, 0x0038, 0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405,
-- 0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201,
-- 0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1,
-- 0x1d80, 0x2099, 0x1d80, 0x080c, 0x60ed, 0x0804, 0x45ca, 0x080c,
-- 0x4c74, 0x0904, 0x36c2, 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002,
-- 0x0804, 0x36bf, 0x080c, 0x5840, 0xd0b4, 0x0558, 0x7884, 0x908e,
-- 0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508,
-- 0x080c, 0x347d, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084,
-- 0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd,
-- 0xa86a, 0x080c, 0xd0ec, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf,
-- 0x7007, 0x0003, 0x701f, 0x4655, 0x0005, 0x080c, 0x4c74, 0x0904,
-- 0x36c2, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860,
-- 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-- 0x9080, 0x0006, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006,
-- 0x2098, 0x080c, 0x0fd6, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080,
-- 0x000a, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098,
-- 0x080c, 0x0fd6, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-- 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c,
-- 0x7d98, 0x0804, 0x4c8d, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x4c58,
-- 0x0904, 0x36c2, 0x080c, 0x6a00, 0x0904, 0x36bf, 0x0058, 0xa878,
-- 0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x36bf, 0xa974, 0xaa94,
-- 0x0804, 0x368d, 0x080c, 0x5848, 0x0904, 0x368d, 0x701f, 0x469f,
-- 0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x7888, 0x908a,
-- 0x1000, 0x1a04, 0x36c2, 0x080c, 0x4c74, 0x0904, 0x36c2, 0x080c,
-- 0x6c11, 0x0120, 0x080c, 0x6c19, 0x1904, 0x36c2, 0x080c, 0x6a85,
-- 0x0904, 0x36bf, 0x2019, 0x0004, 0x900e, 0x080c, 0x6a12, 0x0904,
-- 0x36bf, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000,
-- 0x12f8, 0x080c, 0x4c72, 0x01e0, 0x080c, 0x6c11, 0x0118, 0x080c,
-- 0x6c19, 0x11b0, 0x080c, 0x6a85, 0x2009, 0x0002, 0x0168, 0x2009,
-- 0x0002, 0x2019, 0x0004, 0x080c, 0x6a12, 0x2009, 0x0003, 0x0120,
-- 0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010,
-- 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-- 0xa897, 0x4000, 0x080c, 0x5848, 0x0110, 0x9006, 0x0018, 0x900e,
-- 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110,
-- 0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x645c, 0x2400,
-- 0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c,
-- 0x67b4, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
-- 0x89a1, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x798c, 0x2001, 0x1980,
-- 0x918c, 0x8000, 0x2102, 0x080c, 0x4c58, 0x0904, 0x36c2, 0x080c,
-- 0x6c11, 0x0120, 0x080c, 0x6c19, 0x1904, 0x36c2, 0x080c, 0x687b,
-- 0x0904, 0x36bf, 0x080c, 0x6a09, 0x0904, 0x36bf, 0x2001, 0x1980,
-- 0x2004, 0xd0fc, 0x1904, 0x368d, 0x0804, 0x46aa, 0xa9a0, 0x2001,
-- 0x1980, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c65, 0x01a0,
-- 0x080c, 0x6c11, 0x0118, 0x080c, 0x6c19, 0x1170, 0x080c, 0x687b,
-- 0x2009, 0x0002, 0x0128, 0x080c, 0x6a09, 0x1170, 0x2009, 0x0003,
-- 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-- 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1980,
-- 0x2004, 0xd0fc, 0x1128, 0x080c, 0x5848, 0x0110, 0x9006, 0x0018,
-- 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904,
-- 0x36bf, 0x798c, 0x2001, 0x197f, 0x918c, 0x8000, 0x2102, 0x080c,
-- 0x4c58, 0x0904, 0x36c2, 0x080c, 0x6c11, 0x0120, 0x080c, 0x6c19,
-- 0x1904, 0x36c2, 0x080c, 0x687b, 0x0904, 0x36bf, 0x080c, 0x69f7,
-- 0x0904, 0x36bf, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1904, 0x368d,
-- 0x0804, 0x46aa, 0xa9a0, 0x2001, 0x197f, 0x918c, 0x8000, 0xc18d,
-- 0x2102, 0x080c, 0x4c65, 0x01a0, 0x080c, 0x6c11, 0x0118, 0x080c,
-- 0x6c19, 0x1170, 0x080c, 0x687b, 0x2009, 0x0002, 0x0128, 0x080c,
-- 0x69f7, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010,
-- 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-- 0xa897, 0x4000, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1128, 0x080c,
-- 0x5848, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001,
-- 0x0000, 0x0005, 0x6100, 0x0804, 0x368d, 0x080c, 0x4c74, 0x0904,
-- 0x36c2, 0x080c, 0x5854, 0x1904, 0x36bf, 0x79a8, 0xd184, 0x1158,
-- 0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f,
-- 0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007,
-- 0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0202,
-- 0x0804, 0x368d, 0x78a8, 0x909c, 0x0003, 0xd0ac, 0x1150, 0xd0b4,
-- 0x1140, 0x939a, 0x0003, 0x1a04, 0x36bf, 0x625c, 0x7884, 0x9206,
-- 0x1548, 0x080c, 0x8b10, 0x2001, 0xffec, 0x2009, 0x000c, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0000, 0x0006, 0x78a8, 0x9084,
-- 0x0080, 0x1118, 0x000e, 0x0804, 0x4c8d, 0x000e, 0x2031, 0x0000,
-- 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
-- 0xa392, 0xa496, 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f,
-- 0x4862, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x4c74, 0x0904,
-- 0x36c2, 0x080c, 0x6c11, 0x1904, 0x36bf, 0x00c6, 0x080c, 0x4c41,
-- 0x00ce, 0x0904, 0x36bf, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-- 0x7ea8, 0x080c, 0xd092, 0x0904, 0x36bf, 0x7007, 0x0003, 0x701f,
-- 0x4866, 0x0005, 0x080c, 0x4397, 0x0804, 0x368d, 0xa830, 0x9086,
-- 0x0100, 0x0904, 0x36bf, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-- 0x9084, 0xffc0, 0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88,
-- 0x7c9c, 0x7d98, 0x0804, 0x4c8d, 0x9006, 0x080c, 0x26f5, 0x78a8,
-- 0x9084, 0x00ff, 0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x36bf,
-- 0x080c, 0x779e, 0x0110, 0x080c, 0x6162, 0x7888, 0x908a, 0x1000,
-- 0x1a04, 0x36c2, 0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f,
-- 0x1a04, 0x36c2, 0x2100, 0x080c, 0x26bf, 0x0026, 0x00c6, 0x0126,
-- 0x2091, 0x8000, 0x2061, 0x1a04, 0x601b, 0x0000, 0x601f, 0x0000,
-- 0x607b, 0x0000, 0x607f, 0x0000, 0x080c, 0x779e, 0x1158, 0x080c,
-- 0x7ab6, 0x080c, 0x619d, 0x9085, 0x0001, 0x080c, 0x77e2, 0x080c,
-- 0x76cd, 0x00f0, 0x080c, 0xacfc, 0x080c, 0xb09b, 0x080c, 0xad18,
-- 0x2061, 0x0100, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x810f,
-- 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x1999,
-- 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x6088, 0x080c, 0x8a5d,
-- 0x7984, 0x080c, 0x779e, 0x1110, 0x2009, 0x00ff, 0x7a88, 0x080c,
-- 0x470d, 0x012e, 0x00ce, 0x002e, 0x0804, 0x368d, 0x7984, 0x080c,
-- 0x6749, 0x2b08, 0x1904, 0x36c2, 0x0804, 0x368d, 0x81ff, 0x0120,
-- 0x2009, 0x0001, 0x0804, 0x36bf, 0x60dc, 0xd0ac, 0x1130, 0xd09c,
-- 0x1120, 0x2009, 0x0005, 0x0804, 0x36bf, 0x080c, 0x4c41, 0x1120,
-- 0x2009, 0x0002, 0x0804, 0x36bf, 0x7984, 0x81ff, 0x0904, 0x36c2,
-- 0x9192, 0x0021, 0x1a04, 0x36c2, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-- 0xa85c, 0x9080, 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x4c8a,
-- 0x701f, 0x4921, 0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x52da,
-- 0x0005, 0x2009, 0x0080, 0x080c, 0x67b4, 0x1118, 0x080c, 0x6c11,
-- 0x0120, 0x2021, 0x400a, 0x0804, 0x368f, 0x00d6, 0x0096, 0xa964,
-- 0xaa6c, 0xab70, 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100,
-- 0x0904, 0x49ba, 0x90be, 0x0112, 0x0904, 0x49ba, 0x90be, 0x0113,
-- 0x0904, 0x49ba, 0x90be, 0x0114, 0x0904, 0x49ba, 0x90be, 0x0117,
-- 0x0904, 0x49ba, 0x90be, 0x011a, 0x0904, 0x49ba, 0x90be, 0x011c,
-- 0x0904, 0x49ba, 0x90be, 0x0121, 0x0904, 0x49a1, 0x90be, 0x0131,
-- 0x0904, 0x49a1, 0x90be, 0x0171, 0x0904, 0x49ba, 0x90be, 0x0173,
-- 0x0904, 0x49ba, 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896,
-- 0x0804, 0x49c5, 0x90be, 0x0212, 0x0904, 0x49ae, 0x90be, 0x0213,
-- 0x05e8, 0x90be, 0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be,
-- 0x021a, 0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f,
-- 0x05c8, 0x90be, 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x36c2,
-- 0x7028, 0x9080, 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-- 0x20a9, 0x0007, 0x080c, 0x4a03, 0x7028, 0x9080, 0x000e, 0x2098,
-- 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4a03,
-- 0x00c8, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0,
-- 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4a10, 0x00b8, 0x7028, 0x9080,
-- 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001,
-- 0x080c, 0x4a10, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034,
-- 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4c41,
-- 0x0550, 0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882,
-- 0xa87f, 0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6,
-- 0xabba, 0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de,
-- 0xa866, 0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c,
-- 0xd0ad, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003,
-- 0x701f, 0x49fa, 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002,
-- 0x0804, 0x36bf, 0xa820, 0x9086, 0x8001, 0x1904, 0x368d, 0x2009,
-- 0x0004, 0x0804, 0x36bf, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002,
-- 0x4002, 0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005,
-- 0x0016, 0x0026, 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002,
-- 0x4304, 0x4204, 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e,
-- 0x002e, 0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-- 0x36bf, 0x60dc, 0xd0ac, 0x1188, 0x2009, 0x180d, 0x210c, 0xd18c,
-- 0x0130, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804, 0x36bf, 0xd09c,
-- 0x1120, 0x2009, 0x0005, 0x0804, 0x36bf, 0x7984, 0x78a8, 0x2040,
-- 0x080c, 0xb094, 0x1120, 0x9182, 0x007f, 0x0a04, 0x36c2, 0x9186,
-- 0x00ff, 0x0904, 0x36c2, 0x9182, 0x0800, 0x1a04, 0x36c2, 0x7a8c,
-- 0x7b88, 0x607c, 0x9306, 0x1158, 0x6080, 0x924e, 0x0904, 0x36c2,
-- 0x080c, 0xb094, 0x1120, 0x99cc, 0xff00, 0x0904, 0x36c2, 0x0126,
-- 0x2091, 0x8000, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0198, 0x9386,
-- 0x00ff, 0x0180, 0x0026, 0x2011, 0x8008, 0x080c, 0x6c35, 0x002e,
-- 0x0148, 0x918d, 0x8000, 0x080c, 0x6c7f, 0x1120, 0x2001, 0x4009,
-- 0x0804, 0x4ac1, 0x080c, 0x4b54, 0x0904, 0x4ac7, 0x0086, 0x90c6,
-- 0x4000, 0x008e, 0x1538, 0x00c6, 0x0006, 0x0036, 0xb818, 0xbb1c,
-- 0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305, 0xbb28, 0x9305, 0xbb2c,
-- 0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305, 0x003e, 0x0570, 0xd88c,
-- 0x1128, 0x080c, 0x6c11, 0x0110, 0xc89d, 0x0438, 0x900e, 0x080c,
-- 0x6aae, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x000e,
-- 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090, 0x90c6,
-- 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009, 0x1108,
-- 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005, 0x2009,
-- 0x000a, 0x2020, 0x012e, 0x0804, 0x368f, 0x000e, 0x00ce, 0x2b00,
-- 0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0xb1dd,
-- 0x0904, 0x4b1c, 0x2b00, 0x6012, 0x080c, 0xd3b6, 0x2e58, 0x00ee,
-- 0x00e6, 0x00c6, 0x080c, 0x4c41, 0x00ce, 0x2b70, 0x1158, 0x080c,
-- 0xb16c, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002,
-- 0x0804, 0x36bf, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932,
-- 0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0xd89c, 0x1110,
-- 0x080c, 0x3315, 0x6023, 0x0001, 0x9006, 0x080c, 0x66e6, 0xd89c,
-- 0x0138, 0x2001, 0x0004, 0x080c, 0x66fa, 0x2009, 0x0003, 0x0030,
-- 0x2001, 0x0002, 0x080c, 0x66fa, 0x2009, 0x0002, 0x080c, 0xb20a,
-- 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024, 0x00e6, 0x2058, 0xb8d4,
-- 0xc08d, 0xb8d6, 0x9085, 0x0001, 0x00ee, 0x00ce, 0x00be, 0x001e,
-- 0x012e, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003,
-- 0x701f, 0x4b2b, 0x0005, 0xa830, 0x2009, 0x180d, 0x210c, 0xd18c,
-- 0x0140, 0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804,
-- 0x368f, 0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004,
-- 0xba04, 0x9294, 0x00ff, 0x0804, 0x578e, 0x900e, 0xa868, 0xd0f4,
-- 0x1904, 0x368d, 0x080c, 0x6aae, 0x1108, 0xc185, 0xb800, 0xd0bc,
-- 0x0108, 0xc18d, 0x0804, 0x368d, 0x00e6, 0x00d6, 0x0096, 0x83ff,
-- 0x0904, 0x4ba3, 0x902e, 0x080c, 0xb094, 0x0130, 0x9026, 0x20a9,
-- 0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781,
-- 0x2071, 0x107f, 0x2e04, 0x9005, 0x11b8, 0x2100, 0x9406, 0x1904,
-- 0x4bb4, 0x2428, 0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1558,
-- 0x0030, 0x94ce, 0x0080, 0x1130, 0x92ce, 0xfffc, 0x1520, 0x93ce,
-- 0x00ff, 0x1508, 0xc5fd, 0x0480, 0x2058, 0xbf10, 0x2700, 0x9306,
-- 0x11e8, 0xbe14, 0x2600, 0x9206, 0x11c8, 0x2400, 0x9106, 0x1180,
-- 0xd884, 0x0598, 0xd894, 0x1588, 0x080c, 0x6bb1, 0x1570, 0x2001,
-- 0x4000, 0x0460, 0x080c, 0x6c11, 0x1540, 0x2001, 0x4000, 0x0430,
-- 0x2001, 0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106,
-- 0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0918, 0x080c, 0xb094,
-- 0x1900, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x4b6a,
-- 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030,
-- 0x080c, 0x6749, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e,
-- 0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-- 0x36bf, 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-- 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904,
-- 0x36c2, 0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x36c2,
-- 0x2010, 0x2918, 0x080c, 0x32b5, 0x1120, 0x2009, 0x0003, 0x0804,
-- 0x36bf, 0x7007, 0x0003, 0x701f, 0x4bf6, 0x0005, 0xa830, 0x9086,
-- 0x0100, 0x1904, 0x368d, 0x2009, 0x0004, 0x0804, 0x36bf, 0x7984,
-- 0x080c, 0xb094, 0x1120, 0x9182, 0x007f, 0x0a04, 0x36c2, 0x9186,
-- 0x00ff, 0x0904, 0x36c2, 0x9182, 0x0800, 0x1a04, 0x36c2, 0x2001,
-- 0x9400, 0x080c, 0x57e9, 0x1904, 0x36bf, 0x0804, 0x368d, 0xa998,
-- 0x080c, 0xb094, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff,
-- 0x0168, 0x9182, 0x0800, 0x1250, 0x2001, 0x9400, 0x080c, 0x57e9,
-- 0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-+ 0x2004, 0xa866, 0x2001, 0x0031, 0x2004, 0xa86a, 0x2001, 0x002a,
-+ 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873, 0x0000, 0x2001, 0x032a,
-+ 0x2003, 0x0004, 0x2001, 0x0300, 0x2003, 0x0000, 0x2001, 0x020d,
-+ 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d, 0x0002, 0x2102,
-+ 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0148, 0x080c,
-+ 0x2a77, 0x1130, 0x9006, 0x080c, 0x29ca, 0x9006, 0x080c, 0x29ad,
-+ 0x2001, 0x199f, 0x2003, 0x0000, 0x7884, 0x9084, 0x0007, 0x0002,
-+ 0x3eb3, 0x3eb4, 0x3eb5, 0x3eb0, 0x3eb0, 0x3eb0, 0x3eb0, 0x3eb0,
-+ 0x012e, 0x0804, 0x36c2, 0x0ce0, 0x0cd8, 0x080c, 0x778e, 0x1128,
-+ 0x012e, 0x2009, 0x0016, 0x0804, 0x36bf, 0x81ff, 0x0128, 0x012e,
-+ 0x2021, 0x400b, 0x0804, 0x368f, 0x2001, 0x0141, 0x2004, 0xd0dc,
-+ 0x0db0, 0x080c, 0xacec, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6,
-+ 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3bd6, 0x2009, 0x0101, 0x210c,
-+ 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060, 0x2058, 0x080c,
-+ 0x4328, 0x080c, 0x4278, 0x903e, 0x2720, 0x00f6, 0x00e6, 0x0086,
-+ 0x2940, 0x2071, 0x19e8, 0x2079, 0x0090, 0x00d6, 0x2069, 0x0000,
-+ 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0, 0x780a, 0x00de,
-+ 0x2011, 0x0001, 0x080c, 0x41d9, 0x080c, 0x2a7f, 0x080c, 0x2a7f,
-+ 0x080c, 0x2a7f, 0x080c, 0x2a7f, 0x080c, 0x41d9, 0x008e, 0x00ee,
-+ 0x00fe, 0x080c, 0x40fb, 0x2009, 0x9c40, 0x8109, 0x11b0, 0x080c,
-+ 0x4032, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x001e,
-+ 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e,
-+ 0x2009, 0x0017, 0x080c, 0x36bf, 0x0cf8, 0x2001, 0x020b, 0x2004,
-+ 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000, 0x7884, 0x00fe,
-+ 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0150, 0x080c,
-+ 0x40d9, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c, 0x4032, 0x0804,
-+ 0x3fdb, 0x080c, 0x424d, 0x080c, 0x4171, 0x080c, 0x40bc, 0x080c,
-+ 0x40f1, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac, 0x0130, 0x8b58,
-+ 0x080c, 0x4032, 0x00fe, 0x0804, 0x3fdb, 0x00fe, 0x080c, 0x4028,
-+ 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001, 0x0033, 0x2502,
-+ 0x080c, 0x4032, 0x0080, 0x87ff, 0x0138, 0x2001, 0x0201, 0x2004,
-+ 0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a6e, 0x2004, 0x9086,
-+ 0x0000, 0x1904, 0x3f2b, 0x2001, 0x032f, 0x2003, 0x00f6, 0x8631,
-+ 0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3fdb, 0x7884, 0xd0bc,
-+ 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3fdb, 0xa013, 0x0019,
-+ 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1148, 0x2001,
-+ 0x1a6e, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x0030,
-+ 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016, 0x2800, 0xa05a,
-+ 0x2009, 0x0040, 0x080c, 0x2220, 0x2900, 0xa85a, 0xa813, 0x0019,
-+ 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6, 0x20a9, 0x0004,
-+ 0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203, 0x2004, 0x1f04,
-+ 0x3fb2, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0, 0x9005, 0x0108,
-+ 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061, 0x0090, 0x7827,
-+ 0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006,
-+ 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x00ce,
-+ 0x00fe, 0x0804, 0x3ee5, 0x001e, 0x00c6, 0x2001, 0x032a, 0x2003,
-+ 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106, 0x2011, 0x020d,
-+ 0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102,
-+ 0x080c, 0x1352, 0x7884, 0x9084, 0x0003, 0x9086, 0x0002, 0x01b0,
-+ 0x2009, 0x0028, 0x080c, 0x2220, 0x2001, 0x0227, 0x200c, 0x2102,
-+ 0x6050, 0x9084, 0xb7ff, 0x080c, 0x2b29, 0x6052, 0x602f, 0x0000,
-+ 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010, 0x080c, 0xad08,
-+ 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05, 0x9d05, 0x00fe,
-+ 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x1118,
-+ 0x012e, 0x0804, 0x368d, 0x012e, 0x2021, 0x400c, 0x0804, 0x368f,
-+ 0x9085, 0x0001, 0x1d04, 0x4031, 0x2091, 0x6000, 0x8420, 0x9486,
-+ 0x0064, 0x0005, 0x2001, 0x0105, 0x2003, 0x0010, 0x2001, 0x032a,
-+ 0x2003, 0x0004, 0x2001, 0x1a6e, 0x2003, 0x0000, 0x0071, 0x2009,
-+ 0x0048, 0x080c, 0x2220, 0x2001, 0x0227, 0x2024, 0x2402, 0x2001,
-+ 0x0109, 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6, 0x00e6, 0x2071,
-+ 0x19e8, 0x7054, 0x9086, 0x0000, 0x0520, 0x2079, 0x0090, 0x2009,
-+ 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120, 0x2009,
-+ 0x0040, 0x080c, 0x2220, 0x782c, 0xd0fc, 0x0d88, 0x080c, 0x424d,
-+ 0x7054, 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004, 0x782c, 0xd0ac,
-+ 0x1de8, 0x2009, 0x0040, 0x080c, 0x2220, 0x782b, 0x0002, 0x7057,
-+ 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0100, 0x2001,
-+ 0x1818, 0x200c, 0x7932, 0x7936, 0x080c, 0x26d5, 0x080c, 0x2af6,
-+ 0x080c, 0x2b29, 0x784b, 0xf7f7, 0x7843, 0x0090, 0x7843, 0x0010,
-+ 0x7850, 0xc0e5, 0x7852, 0x2019, 0x61a8, 0x7820, 0xd09c, 0x0110,
-+ 0x8319, 0x1dd8, 0x7850, 0xc0e4, 0x7852, 0x2011, 0x0048, 0x080c,
-+ 0x2ad3, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001, 0xa001, 0x8319,
-+ 0x1de0, 0x2001, 0x0100, 0x080c, 0x2a99, 0x2011, 0x0020, 0x080c,
-+ 0x2ad3, 0x7843, 0x0000, 0x9006, 0x080c, 0x2a99, 0x2011, 0x0048,
-+ 0x080c, 0x2ad3, 0x00fe, 0x0005, 0x7884, 0xd0ac, 0x11c8, 0x00f6,
-+ 0x00e6, 0x2071, 0x1a6e, 0x2079, 0x0320, 0x2001, 0x0201, 0x2004,
-+ 0x9005, 0x0160, 0x7000, 0x9086, 0x0000, 0x1140, 0x0051, 0xd0bc,
-+ 0x0108, 0x8738, 0x7003, 0x0003, 0x782b, 0x0019, 0x00ee, 0x00fe,
-+ 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070,
-+ 0x0178, 0x2009, 0x0032, 0x260a, 0x2009, 0x0033, 0x250a, 0xd0b4,
-+ 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4, 0x0108, 0x8b58,
-+ 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084, 0x0110, 0x7837,
-+ 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100, 0x2001, 0x19ab,
-+ 0x2004, 0x70e2, 0x080c, 0x3e14, 0x1188, 0x2001, 0x1820, 0x2004,
-+ 0x2009, 0x181f, 0x210c, 0x918c, 0x00ff, 0x706e, 0x716a, 0x7066,
-+ 0x918d, 0x3200, 0x7162, 0x7073, 0xe109, 0x0080, 0x702c, 0x9085,
-+ 0x0002, 0x702e, 0x2009, 0x1818, 0x210c, 0x716e, 0x7063, 0x0100,
-+ 0x7166, 0x719e, 0x706b, 0x0000, 0x7073, 0x0809, 0x7077, 0x0008,
-+ 0x7078, 0x9080, 0x0100, 0x707a, 0x7080, 0x8000, 0x7082, 0x7087,
-+ 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036,
-+ 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085, 0x0092, 0x7016,
-+ 0x080c, 0x424d, 0x00f6, 0x2071, 0x1a6e, 0x2079, 0x0320, 0x00d6,
-+ 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c, 0x780e, 0x6898,
-+ 0x780a, 0x00de, 0x080c, 0x3e14, 0x0140, 0x2001, 0x199f, 0x200c,
-+ 0x2003, 0x0001, 0x918e, 0x0001, 0x0120, 0x2009, 0x03e8, 0x8109,
-+ 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011,
-+ 0x080c, 0x41d9, 0x2011, 0x0001, 0x080c, 0x41d9, 0x00fe, 0x00ee,
-+ 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a6e, 0x2079, 0x0320, 0x792c,
-+ 0xd1fc, 0x0904, 0x41d6, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904,
-+ 0x41d2, 0x7000, 0x0002, 0x41d6, 0x4187, 0x41b7, 0x41d2, 0xd1bc,
-+ 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c,
-+ 0x41d9, 0x0904, 0x41d6, 0x080c, 0x41d9, 0x0804, 0x41d6, 0x00f6,
-+ 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b,
-+ 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8,
-+ 0x080c, 0x40d9, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8,
-+ 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001,
-+ 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x417b,
-+ 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086,
-+ 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc,
-+ 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe,
-+ 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016,
-+ 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c,
-+ 0x938a, 0x0007, 0x1a0c, 0x0d85, 0x9398, 0x4207, 0x231d, 0x083f,
-+ 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e,
-+ 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a,
-+ 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x4244,
-+ 0x423b, 0x4232, 0x4229, 0x4220, 0x4217, 0x420e, 0xa964, 0x7902,
-+ 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974,
-+ 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005,
-+ 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916,
-+ 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0,
-+ 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912,
-+ 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc,
-+ 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906,
-+ 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086,
-+ 0x2071, 0x19e8, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b,
-+ 0x0002, 0x2940, 0x9026, 0x7054, 0x0002, 0x4274, 0x4260, 0x426b,
-+ 0x8001, 0x7056, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x41d9,
-+ 0x190c, 0x41d9, 0x0048, 0x8001, 0x7056, 0x782c, 0xd0fc, 0x1d38,
-+ 0x2011, 0x0001, 0x080c, 0x41d9, 0x008e, 0x00ee, 0x00fe, 0x0005,
-+ 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x19ab,
-+ 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19aa, 0x2004, 0x60ce,
-+ 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520,
-+ 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c,
-+ 0x4c3f, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007,
-+ 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096,
-+ 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x42f0,
-+ 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4c3f, 0xa813, 0x0019,
-+ 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866,
-+ 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084,
-+ 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090,
-+ 0x2079, 0x0100, 0x2001, 0x19aa, 0x2004, 0x6036, 0x2009, 0x0040,
-+ 0x080c, 0x2220, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a,
-+ 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca,
-+ 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-+ 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000,
-+ 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a,
-+ 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041,
-+ 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005,
-+ 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086,
-+ 0x080c, 0x4c3f, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006,
-+ 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005,
-+ 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001,
-+ 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4c3f, 0x2940,
-+ 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220,
-+ 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858,
-+ 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x42f0, 0x1d68,
-+ 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4c3f, 0x2940, 0xa013, 0x0019,
-+ 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066,
-+ 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084,
-+ 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a,
-+ 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c,
-+ 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a6e, 0x2003,
-+ 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003,
-+ 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c,
-+ 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004,
-+ 0x20a9, 0x0014, 0x20a1, 0xffec, 0x20e9, 0x0000, 0x9006, 0x4004,
-+ 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108,
-+ 0x0005, 0x0804, 0x368d, 0x7d98, 0x7c9c, 0x0804, 0x3791, 0x080c,
-+ 0x778e, 0x190c, 0x615b, 0x6040, 0x9084, 0x0020, 0x09b1, 0x2069,
-+ 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-+ 0x2039, 0x0001, 0x080c, 0x4c88, 0x701f, 0x43cf, 0x0005, 0x080c,
-+ 0x584d, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095, 0x20d8, 0x21d0,
-+ 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x36c2, 0x2001, 0x180d,
-+ 0x2004, 0xd08c, 0x6804, 0x0118, 0xc0a4, 0xc0ac, 0x6806, 0xd0ac,
-+ 0x0118, 0xd0a4, 0x0904, 0x36c2, 0xd094, 0x00c6, 0x2061, 0x0100,
-+ 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf,
-+ 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061,
-+ 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010, 0x918c, 0xffef,
-+ 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04,
-+ 0x36c2, 0x9288, 0x348e, 0x210d, 0x918c, 0x00ff, 0x6166, 0xd0dc,
-+ 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x36c2, 0x605e, 0x6888,
-+ 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004, 0x0006, 0x2009,
-+ 0x19b2, 0x9080, 0x27d0, 0x2005, 0x200a, 0x2008, 0x2001, 0x0018,
-+ 0x080c, 0xacdd, 0x2009, 0x0390, 0x200b, 0x0400, 0x000e, 0x2009,
-+ 0x19b3, 0x9080, 0x27d4, 0x2005, 0x200a, 0x6808, 0x908a, 0x0100,
-+ 0x0a04, 0x36c2, 0x908a, 0x0841, 0x1a04, 0x36c2, 0x9084, 0x0007,
-+ 0x1904, 0x36c2, 0x680c, 0x9005, 0x0904, 0x36c2, 0x6810, 0x9005,
-+ 0x0904, 0x36c2, 0x6848, 0x6940, 0x910a, 0x1a04, 0x36c2, 0x8001,
-+ 0x0904, 0x36c2, 0x684c, 0x6944, 0x910a, 0x1a04, 0x36c2, 0x8001,
-+ 0x0904, 0x36c2, 0x6814, 0x908c, 0x00ff, 0x614e, 0x8007, 0x9084,
-+ 0x00ff, 0x6052, 0x080c, 0x7ad7, 0x080c, 0x6cec, 0x080c, 0x6d56,
-+ 0x6808, 0x602a, 0x080c, 0x2192, 0x2009, 0x0170, 0x200b, 0x0080,
-+ 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08, 0x080c, 0x272f,
-+ 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x456b, 0x6818, 0x691c,
-+ 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a,
-+ 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38,
-+ 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff,
-+ 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f,
-+ 0x20a9, 0x0004, 0x20a1, 0x19b4, 0x20e9, 0x0001, 0x4001, 0x20a9,
-+ 0x0004, 0x20a1, 0x19ce, 0x20e9, 0x0001, 0x4001, 0x080c, 0x8b16,
-+ 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384, 0x01c8, 0x0020,
-+ 0x839d, 0x12b0, 0x3508, 0x8109, 0x080c, 0x80ee, 0x6878, 0x6016,
-+ 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff,
-+ 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001,
-+ 0x1f04, 0x44c0, 0x00ce, 0x00c6, 0x2061, 0x199c, 0x2001, 0x180d,
-+ 0x2004, 0xd08c, 0x11a8, 0x6a88, 0x9284, 0xc000, 0x2010, 0x9286,
-+ 0x0000, 0x1158, 0x2063, 0x0000, 0x2001, 0x0001, 0x080c, 0x29ca,
-+ 0x2001, 0x0001, 0x080c, 0x29ad, 0x0088, 0x9286, 0x4000, 0x1148,
-+ 0x2063, 0x0001, 0x9006, 0x080c, 0x29ca, 0x9006, 0x080c, 0x29ad,
-+ 0x0028, 0x9286, 0x8000, 0x1d30, 0x2063, 0x0002, 0x00ce, 0x00e6,
-+ 0x2c70, 0x080c, 0x0ed3, 0x00ee, 0x080c, 0x2af6, 0x080c, 0x2b29,
-+ 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114, 0x2204, 0x9085, 0x0180,
-+ 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086, 0x0030, 0x1128, 0x9294,
-+ 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001, 0x197c, 0x6a80, 0x9294,
-+ 0x0030, 0x928e, 0x0000, 0x0170, 0x928e, 0x0010, 0x0118, 0x928e,
-+ 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c, 0x27a4, 0x2001, 0x196d,
-+ 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061, 0x0100, 0x602f, 0x0040,
-+ 0x602f, 0x0000, 0x00ce, 0x080c, 0x778e, 0x0128, 0x080c, 0x5126,
-+ 0x0110, 0x080c, 0x26f5, 0x60d4, 0x9005, 0x01c0, 0x6003, 0x0001,
-+ 0x2009, 0x4553, 0x00e0, 0x080c, 0x778e, 0x1168, 0x2011, 0x7602,
-+ 0x080c, 0x8983, 0x2011, 0x75f5, 0x080c, 0x8a8f, 0x080c, 0x7aab,
-+ 0x080c, 0x76bd, 0x0040, 0x080c, 0x6051, 0x0028, 0x6003, 0x0004,
-+ 0x2009, 0x456b, 0x0020, 0x080c, 0x6b63, 0x0804, 0x368d, 0x2001,
-+ 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c, 0x1118, 0x2091,
-+ 0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000, 0x9086, 0x0000,
-+ 0x0904, 0x36bf, 0x2069, 0x1847, 0x7890, 0x6842, 0x7894, 0x6846,
-+ 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039,
-+ 0x0001, 0x0804, 0x4c8b, 0x9006, 0x080c, 0x26f5, 0x81ff, 0x1904,
-+ 0x36bf, 0x080c, 0x778e, 0x11b0, 0x080c, 0x7aa6, 0x080c, 0x6196,
-+ 0x080c, 0x3482, 0x0118, 0x6130, 0xc18d, 0x6132, 0x080c, 0xd632,
-+ 0x0130, 0x080c, 0x77b1, 0x1118, 0x080c, 0x7762, 0x0038, 0x080c,
-+ 0x76bd, 0x0020, 0x080c, 0x615b, 0x080c, 0x6051, 0x0804, 0x368d,
-+ 0x81ff, 0x1904, 0x36bf, 0x080c, 0x778e, 0x1110, 0x0804, 0x36bf,
-+ 0x0126, 0x2091, 0x8000, 0x6194, 0x81ff, 0x0190, 0x704f, 0x0000,
-+ 0x2001, 0x1d80, 0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-+ 0x2039, 0x0001, 0x080c, 0x4c8b, 0x701f, 0x368b, 0x012e, 0x0005,
-+ 0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9, 0x0040, 0x20e9,
-+ 0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304, 0x655c, 0x9588,
-+ 0x348e, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e, 0x2011, 0x0002,
-+ 0x2100, 0x9506, 0x01a8, 0x080c, 0x67ad, 0x1190, 0xb814, 0x821c,
-+ 0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007, 0x201a, 0x0038,
-+ 0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405, 0x201a, 0x8210,
-+ 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007, 0x2d0c,
-+ 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0x1d80, 0x2099,
-+ 0x1d80, 0x080c, 0x60e6, 0x0804, 0x45c8, 0x080c, 0x4c72, 0x0904,
-+ 0x36c2, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0x080c, 0x583e, 0xd0b4, 0x0558, 0x7884, 0x908e, 0x007e, 0x0538,
-+ 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508, 0x080c, 0x347d,
-+ 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084, 0x00ff, 0x9086,
-+ 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c,
-+ 0xd0d9, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003,
-+ 0x701f, 0x4653, 0x0005, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x20a9,
-+ 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c,
-+ 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006,
-+ 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c,
-+ 0x0fd6, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x000a, 0x20a0,
-+ 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0fd6,
-+ 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-+ 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
-+ 0x4c8b, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x4c56, 0x0904, 0x36c2,
-+ 0x080c, 0x69f0, 0x0904, 0x36bf, 0x0058, 0xa878, 0x9005, 0x0120,
-+ 0x2009, 0x0004, 0x0804, 0x36bf, 0xa974, 0xaa94, 0x0804, 0x368d,
-+ 0x080c, 0x5846, 0x0904, 0x368d, 0x701f, 0x469d, 0x7007, 0x0003,
-+ 0x0005, 0x81ff, 0x1904, 0x36bf, 0x7888, 0x908a, 0x1000, 0x1a04,
-+ 0x36c2, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x080c, 0x6c01, 0x0120,
-+ 0x080c, 0x6c09, 0x1904, 0x36c2, 0x080c, 0x6a75, 0x0904, 0x36bf,
-+ 0x2019, 0x0004, 0x900e, 0x080c, 0x6a02, 0x0904, 0x36bf, 0x7984,
-+ 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000, 0x12f8, 0x080c,
-+ 0x4c70, 0x01e0, 0x080c, 0x6c01, 0x0118, 0x080c, 0x6c09, 0x11b0,
-+ 0x080c, 0x6a75, 0x2009, 0x0002, 0x0168, 0x2009, 0x0002, 0x2019,
-+ 0x0004, 0x080c, 0x6a02, 0x2009, 0x0003, 0x0120, 0xa998, 0xaa9c,
-+ 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
- 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-- 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a,
-- 0x0c48, 0x080c, 0x1059, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005,
-- 0x1120, 0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086,
-- 0x2040, 0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005,
-- 0x7984, 0x080c, 0x67b4, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082,
-- 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x67b4,
-- 0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e,
-- 0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x67b4,
-- 0x1108, 0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff,
-- 0x0128, 0x2148, 0xa904, 0x080c, 0x108b, 0x0cc8, 0x7116, 0x711a,
-- 0x001e, 0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061,
-- 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392,
-- 0xa496, 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x368d,
-- 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001,
-- 0x18b0, 0x2004, 0x9005, 0x1190, 0x0e04, 0x4cbe, 0x7a36, 0x7833,
-- 0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089,
-- 0x2004, 0xd084, 0x190c, 0x1200, 0x0804, 0x4d24, 0x0016, 0x0086,
-- 0x0096, 0x00c6, 0x00e6, 0x2071, 0x189e, 0x7044, 0x9005, 0x1540,
-- 0x7148, 0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x1059,
-- 0x0904, 0x4d1c, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002,
-- 0x9080, 0x1ec1, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004,
-- 0x2001, 0x18ba, 0x9c82, 0x18fa, 0x0210, 0x2061, 0x18ba, 0x2c00,
-- 0x703a, 0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460,
-- 0x7148, 0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016,
-- 0x908a, 0x0036, 0x1a0c, 0x0d85, 0x2060, 0x001e, 0x8108, 0x2105,
-- 0x9005, 0xa146, 0x1520, 0x080c, 0x1059, 0x1130, 0x8109, 0xa946,
-- 0x7148, 0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046,
-- 0x2800, 0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080,
-- 0x1ec1, 0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee,
-- 0x00ce, 0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00,
-- 0x9082, 0x001b, 0x0002, 0x4d46, 0x4d46, 0x4d48, 0x4d46, 0x4d46,
-- 0x4d46, 0x4d4c, 0x4d46, 0x4d46, 0x4d46, 0x4d50, 0x4d46, 0x4d46,
-- 0x4d46, 0x4d54, 0x4d46, 0x4d46, 0x4d46, 0x4d58, 0x4d46, 0x4d46,
-- 0x4d46, 0x4d5c, 0x4d46, 0x4d46, 0x4d46, 0x4d61, 0x080c, 0x0d85,
-- 0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878,
-- 0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838,
-- 0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804,
-- 0x4d1f, 0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4d1f, 0x00e6, 0x2071,
-- 0x189e, 0x7048, 0x9005, 0x0904, 0x4df8, 0x0126, 0x2091, 0x8000,
-- 0x0e04, 0x4df7, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086,
-- 0x0076, 0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948,
-- 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0d85, 0x2060, 0x001e,
-- 0x8108, 0x2105, 0x9005, 0xa94a, 0x1904, 0x4dfa, 0xa804, 0x9005,
-- 0x090c, 0x0d85, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001,
-- 0x0002, 0x9080, 0x1ec1, 0x2005, 0xa04a, 0x0804, 0x4dfa, 0x703c,
-- 0x2060, 0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833,
-- 0x0012, 0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080,
-- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x87ff, 0x0118,
-- 0x2748, 0x080c, 0x108b, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170,
-- 0x7040, 0x2048, 0x9005, 0x0128, 0x080c, 0x108b, 0x9006, 0x7042,
-- 0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba, 0x0420, 0x7040, 0x9005,
-- 0x1508, 0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa,
-- 0x18fa, 0x0210, 0x2001, 0x18ba, 0x703e, 0x00a0, 0x9006, 0x703e,
-- 0x703a, 0x7044, 0x9005, 0x090c, 0x0d85, 0x2048, 0xa800, 0x9005,
-- 0x1de0, 0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1ec1, 0x2005,
-- 0xa84a, 0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e,
-- 0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4e19, 0x4e19,
-- 0x4e1b, 0x4e19, 0x4e19, 0x4e19, 0x4e20, 0x4e19, 0x4e19, 0x4e19,
-- 0x4e25, 0x4e19, 0x4e19, 0x4e19, 0x4e2a, 0x4e19, 0x4e19, 0x4e19,
-- 0x4e2f, 0x4e19, 0x4e19, 0x4e19, 0x4e34, 0x4e19, 0x4e19, 0x4e19,
-- 0x4e39, 0x080c, 0x0d85, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x4da5,
-- 0xaa84, 0xab88, 0xac8c, 0x0804, 0x4da5, 0xaa94, 0xab98, 0xac9c,
-- 0x0804, 0x4da5, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x4da5, 0xaab4,
-- 0xabb8, 0xacbc, 0x0804, 0x4da5, 0xaac4, 0xabc8, 0xaccc, 0x0804,
-- 0x4da5, 0xaad4, 0xabd8, 0xacdc, 0x0804, 0x4da5, 0x0016, 0x0026,
-- 0x0036, 0x00b6, 0x00c6, 0x2009, 0x007e, 0x080c, 0x67b4, 0x2019,
-- 0x0001, 0xb85c, 0xd0ac, 0x0110, 0x2019, 0x0000, 0x2011, 0x801b,
-- 0x080c, 0x4ca1, 0x00ce, 0x00be, 0x003e, 0x002e, 0x001e, 0x0005,
-- 0x0026, 0x080c, 0x5840, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c,
-- 0x4ca1, 0x002e, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x0126, 0x2091,
-- 0x8000, 0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x779e,
-- 0x1158, 0x080c, 0x7ab6, 0x080c, 0x619d, 0x9085, 0x0001, 0x080c,
-- 0x77e2, 0x080c, 0x76cd, 0x0010, 0x080c, 0x6058, 0x012e, 0x0804,
-- 0x368d, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c,
-- 0x5854, 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x080c, 0x6c09,
-- 0x0120, 0x2009, 0x0008, 0x0804, 0x36bf, 0x2001, 0x180d, 0x2004,
-- 0xd08c, 0x0178, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c35, 0x002e,
-- 0x0140, 0x7984, 0x080c, 0x6c7f, 0x1120, 0x2009, 0x4009, 0x0804,
-- 0x36bf, 0x7984, 0x080c, 0x6749, 0x1904, 0x36c2, 0x080c, 0x4c74,
-- 0x0904, 0x36c2, 0x2b00, 0x7026, 0x080c, 0x6c11, 0x7888, 0x1170,
-- 0x9084, 0x0005, 0x1158, 0x900e, 0x080c, 0x6aae, 0x1108, 0xc185,
-- 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x368d, 0x080c, 0x4c41,
-- 0x0904, 0x36bf, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a,
-- 0x080c, 0xd154, 0x0904, 0x36bf, 0x7888, 0xd094, 0x0118, 0xb8d4,
-- 0xc08d, 0xb8d6, 0x7007, 0x0003, 0x701f, 0x4f28, 0x0005, 0x2061,
-- 0x1800, 0x080c, 0x5854, 0x2009, 0x0007, 0x1560, 0x080c, 0x6c09,
-- 0x0118, 0x2009, 0x0008, 0x0430, 0xa998, 0x080c, 0x6749, 0x1530,
-- 0x080c, 0x4c72, 0x0518, 0x080c, 0x6c11, 0xa89c, 0x1168, 0x9084,
-- 0x0005, 0x1150, 0x900e, 0x080c, 0x6aae, 0x1108, 0xc185, 0xb800,
-- 0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c,
-- 0xd154, 0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6,
-+ 0x080c, 0x5846, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001,
-+ 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110, 0x0071, 0x0060,
-+ 0x2029, 0x007e, 0x2061, 0x1800, 0x645c, 0x2400, 0x9506, 0x0110,
-+ 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c, 0x67ad, 0x1138,
-+ 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x8991, 0x0005,
-+ 0x81ff, 0x1904, 0x36bf, 0x798c, 0x2001, 0x1980, 0x918c, 0x8000,
-+ 0x2102, 0x080c, 0x4c56, 0x0904, 0x36c2, 0x080c, 0x6c01, 0x0120,
-+ 0x080c, 0x6c09, 0x1904, 0x36c2, 0x080c, 0x6874, 0x0904, 0x36bf,
-+ 0x080c, 0x69f9, 0x0904, 0x36bf, 0x2001, 0x1980, 0x2004, 0xd0fc,
-+ 0x1904, 0x368d, 0x0804, 0x46a8, 0xa9a0, 0x2001, 0x1980, 0x918c,
-+ 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c63, 0x01a0, 0x080c, 0x6c01,
-+ 0x0118, 0x080c, 0x6c09, 0x1170, 0x080c, 0x6874, 0x2009, 0x0002,
-+ 0x0128, 0x080c, 0x69f9, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005,
-+ 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-+ 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1980, 0x2004, 0xd0fc,
-+ 0x1128, 0x080c, 0x5846, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904, 0x36bf, 0x798c,
-+ 0x2001, 0x197f, 0x918c, 0x8000, 0x2102, 0x080c, 0x4c56, 0x0904,
-+ 0x36c2, 0x080c, 0x6c01, 0x0120, 0x080c, 0x6c09, 0x1904, 0x36c2,
-+ 0x080c, 0x6874, 0x0904, 0x36bf, 0x080c, 0x69e7, 0x0904, 0x36bf,
-+ 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1904, 0x368d, 0x0804, 0x46a8,
-+ 0xa9a0, 0x2001, 0x197f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
-+ 0x4c63, 0x01a0, 0x080c, 0x6c01, 0x0118, 0x080c, 0x6c09, 0x1170,
-+ 0x080c, 0x6874, 0x2009, 0x0002, 0x0128, 0x080c, 0x69e7, 0x1170,
- 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
- 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-- 0xa99a, 0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005,
-- 0xa830, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0140, 0x2008, 0x918e,
-- 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x368f, 0x9086, 0x0100,
-- 0x7024, 0x2058, 0x1110, 0x0804, 0x578e, 0x900e, 0x080c, 0x6aae,
-- 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x368d,
-- 0x080c, 0x5854, 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x7f84,
-- 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4c41, 0x1120, 0x2009,
-- 0x0002, 0x0804, 0x36bf, 0x900e, 0x2130, 0x7126, 0x7132, 0xa860,
-- 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0, 0x080c,
-- 0x67b4, 0x1904, 0x4fde, 0x080c, 0x6c11, 0x0138, 0x080c, 0x6c19,
-- 0x0120, 0x080c, 0x6bb1, 0x1904, 0x4fde, 0xd794, 0x1110, 0xd784,
-- 0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x3400,
-- 0xd794, 0x0198, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00,
-- 0x20e0, 0x20a9, 0x0002, 0x080c, 0x4a10, 0x0080, 0xb8c4, 0x20e0,
-- 0xb8c8, 0x9080, 0x000a, 0x2098, 0x3400, 0x20a9, 0x0004, 0x4003,
-- 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4a10, 0x9186, 0x007e,
-- 0x0170, 0x9186, 0x0080, 0x0158, 0x080c, 0x6c11, 0x90c2, 0x0006,
-- 0x1210, 0xc1fd, 0x0020, 0x080c, 0x6aae, 0x1108, 0xc1fd, 0x4104,
-- 0xc1fc, 0xd794, 0x0528, 0xb8c4, 0x20e0, 0xb8c8, 0x2060, 0x9c80,
-- 0x0000, 0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098,
-- 0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9,
-- 0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4a03,
-- 0x9c80, 0x0026, 0x2098, 0xb8c4, 0x20e0, 0x20a9, 0x0002, 0x4003,
-- 0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c,
-- 0xb094, 0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186,
-- 0x0800, 0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118,
-- 0x9686, 0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4f67,
-- 0x86ff, 0x1120, 0x7124, 0x810b, 0x0804, 0x368d, 0x7033, 0x0001,
-- 0x7122, 0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18b8, 0x2c44,
-- 0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e,
-- 0xa392, 0xa496, 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f,
-- 0x501a, 0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0,
-- 0x772c, 0x9036, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa28c,
-- 0xa390, 0xa494, 0xa598, 0x0804, 0x4f67, 0x7124, 0x810b, 0x0804,
-- 0x368d, 0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184,
-- 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04,
-- 0x36c2, 0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502,
-- 0x0a04, 0x36c2, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04,
-- 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9284, 0x00ff, 0x90e2, 0x0020,
-- 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9384, 0xff00, 0x8007,
-- 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9384,
-+ 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x5846, 0x0110,
-+ 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
-+ 0x6100, 0x0804, 0x368d, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x080c,
-+ 0x5852, 0x1904, 0x36bf, 0x79a8, 0xd184, 0x1158, 0xb834, 0x8007,
-+ 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f, 0xba28, 0x8217,
-+ 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007, 0x789a, 0xbb1c,
-+ 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0202, 0x0804, 0x368d,
-+ 0x78a8, 0x909c, 0x0003, 0xd0ac, 0x1150, 0xd0b4, 0x1140, 0x939a,
-+ 0x0003, 0x1a04, 0x36bf, 0x625c, 0x7884, 0x9206, 0x1548, 0x080c,
-+ 0x8b00, 0x2001, 0xffec, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0x2039, 0x0000, 0x0006, 0x78a8, 0x9084, 0x0080, 0x1118,
-+ 0x000e, 0x0804, 0x4c8b, 0x000e, 0x2031, 0x0000, 0x2061, 0x18b8,
-+ 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496,
-+ 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x4860, 0x0005,
-+ 0x81ff, 0x1904, 0x36bf, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x080c,
-+ 0x6c01, 0x1904, 0x36bf, 0x00c6, 0x080c, 0x4c3f, 0x00ce, 0x0904,
-+ 0x36bf, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8, 0x080c,
-+ 0xd07f, 0x0904, 0x36bf, 0x7007, 0x0003, 0x701f, 0x4864, 0x0005,
-+ 0x080c, 0x4395, 0x0804, 0x368d, 0xa830, 0x9086, 0x0100, 0x0904,
-+ 0x36bf, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-+ 0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-+ 0x0804, 0x4c8b, 0x9006, 0x080c, 0x26f5, 0x78a8, 0x9084, 0x00ff,
-+ 0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x36bf, 0x080c, 0x778e,
-+ 0x0110, 0x080c, 0x615b, 0x7888, 0x908a, 0x1000, 0x1a04, 0x36c2,
-+ 0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x36c2,
-+ 0x2100, 0x080c, 0x26bf, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000,
-+ 0x2061, 0x1a04, 0x601b, 0x0000, 0x601f, 0x0000, 0x607b, 0x0000,
-+ 0x607f, 0x0000, 0x080c, 0x778e, 0x1158, 0x080c, 0x7aa6, 0x080c,
-+ 0x6196, 0x9085, 0x0001, 0x080c, 0x77d2, 0x080c, 0x76bd, 0x00f0,
-+ 0x080c, 0xacec, 0x080c, 0xb086, 0x080c, 0xad08, 0x2061, 0x0100,
-+ 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x810f, 0x9105, 0x604a,
-+ 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000,
-+ 0x2009, 0x002d, 0x2011, 0x6081, 0x080c, 0x8a4d, 0x7984, 0x080c,
-+ 0x778e, 0x1110, 0x2009, 0x00ff, 0x7a88, 0x080c, 0x470b, 0x012e,
-+ 0x00ce, 0x002e, 0x0804, 0x368d, 0x7984, 0x080c, 0x6742, 0x2b08,
-+ 0x1904, 0x36c2, 0x0804, 0x368d, 0x81ff, 0x0120, 0x2009, 0x0001,
-+ 0x0804, 0x36bf, 0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009,
-+ 0x0005, 0x0804, 0x36bf, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002,
-+ 0x0804, 0x36bf, 0x7984, 0x81ff, 0x0904, 0x36c2, 0x9192, 0x0021,
-+ 0x1a04, 0x36c2, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
-+ 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x4c88, 0x701f, 0x491f,
-+ 0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x52d8, 0x0005, 0x2009,
-+ 0x0080, 0x080c, 0x67ad, 0x1118, 0x080c, 0x6c01, 0x0120, 0x2021,
-+ 0x400a, 0x0804, 0x368f, 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70,
-+ 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904, 0x49b8,
-+ 0x90be, 0x0112, 0x0904, 0x49b8, 0x90be, 0x0113, 0x0904, 0x49b8,
-+ 0x90be, 0x0114, 0x0904, 0x49b8, 0x90be, 0x0117, 0x0904, 0x49b8,
-+ 0x90be, 0x011a, 0x0904, 0x49b8, 0x90be, 0x011c, 0x0904, 0x49b8,
-+ 0x90be, 0x0121, 0x0904, 0x499f, 0x90be, 0x0131, 0x0904, 0x499f,
-+ 0x90be, 0x0171, 0x0904, 0x49b8, 0x90be, 0x0173, 0x0904, 0x49b8,
-+ 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804, 0x49c3,
-+ 0x90be, 0x0212, 0x0904, 0x49ac, 0x90be, 0x0213, 0x05e8, 0x90be,
-+ 0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a, 0x1120,
-+ 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be,
-+ 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x36c2, 0x7028, 0x9080,
-+ 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007,
-+ 0x080c, 0x4a01, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034,
-+ 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4a01, 0x00c8, 0x7028,
-+ 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
-+ 0x0001, 0x080c, 0x4a0e, 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098,
-+ 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4a0e,
-+ 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-+ 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4c3f, 0x0550, 0xa868,
-+ 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020,
-+ 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe,
-+ 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822,
-+ 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xd09a, 0x1120,
-+ 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003, 0x701f, 0x49f8,
-+ 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0xa820, 0x9086, 0x8001, 0x1904, 0x368d, 0x2009, 0x0004, 0x0804,
-+ 0x36bf, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104,
-+ 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026,
-+ 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204,
-+ 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e,
-+ 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x60dc,
-+ 0xd0ac, 0x1188, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0130, 0xd09c,
-+ 0x0120, 0x2009, 0x0016, 0x0804, 0x36bf, 0xd09c, 0x1120, 0x2009,
-+ 0x0005, 0x0804, 0x36bf, 0x7984, 0x78a8, 0x2040, 0x080c, 0xb07f,
-+ 0x1120, 0x9182, 0x007f, 0x0a04, 0x36c2, 0x9186, 0x00ff, 0x0904,
-+ 0x36c2, 0x9182, 0x0800, 0x1a04, 0x36c2, 0x7a8c, 0x7b88, 0x607c,
-+ 0x9306, 0x1158, 0x6080, 0x924e, 0x0904, 0x36c2, 0x080c, 0xb07f,
-+ 0x1120, 0x99cc, 0xff00, 0x0904, 0x36c2, 0x0126, 0x2091, 0x8000,
-+ 0x2001, 0x180d, 0x2004, 0xd08c, 0x0198, 0x9386, 0x00ff, 0x0180,
-+ 0x0026, 0x2011, 0x8008, 0x080c, 0x6c25, 0x002e, 0x0148, 0x918d,
-+ 0x8000, 0x080c, 0x6c6f, 0x1120, 0x2001, 0x4009, 0x0804, 0x4abf,
-+ 0x080c, 0x4b52, 0x0904, 0x4ac5, 0x0086, 0x90c6, 0x4000, 0x008e,
-+ 0x1538, 0x00c6, 0x0006, 0x0036, 0xb818, 0xbb1c, 0x9305, 0xbb20,
-+ 0x9305, 0xbb24, 0x9305, 0xbb28, 0x9305, 0xbb2c, 0x9305, 0xbb30,
-+ 0x9305, 0xbb34, 0x9305, 0x003e, 0x0570, 0xd88c, 0x1128, 0x080c,
-+ 0x6c01, 0x0110, 0xc89d, 0x0438, 0x900e, 0x080c, 0x6a9e, 0x1108,
-+ 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x000e, 0x00ce, 0x00b8,
-+ 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090, 0x90c6, 0x4008, 0x1118,
-+ 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009, 0x1108, 0x0040, 0x90c6,
-+ 0x4006, 0x1108, 0x0020, 0x2001, 0x4005, 0x2009, 0x000a, 0x2020,
-+ 0x012e, 0x0804, 0x368f, 0x000e, 0x00ce, 0x2b00, 0x7026, 0x0016,
-+ 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0xb1c8, 0x0904, 0x4b1a,
-+ 0x2b00, 0x6012, 0x080c, 0xd3a3, 0x2e58, 0x00ee, 0x00e6, 0x00c6,
-+ 0x080c, 0x4c3f, 0x00ce, 0x2b70, 0x1158, 0x080c, 0xb157, 0x00ee,
-+ 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932, 0xa868, 0xc0fd,
-+ 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0xd89c, 0x1110, 0x080c, 0x3315,
-+ 0x6023, 0x0001, 0x9006, 0x080c, 0x66df, 0xd89c, 0x0138, 0x2001,
-+ 0x0004, 0x080c, 0x66f3, 0x2009, 0x0003, 0x0030, 0x2001, 0x0002,
-+ 0x080c, 0x66f3, 0x2009, 0x0002, 0x080c, 0xb1f5, 0x78a8, 0xd094,
-+ 0x0138, 0x00ee, 0x7024, 0x00e6, 0x2058, 0xb8d4, 0xc08d, 0xb8d6,
-+ 0x9085, 0x0001, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120,
-+ 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003, 0x701f, 0x4b29,
-+ 0x0005, 0xa830, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0140, 0x2008,
-+ 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x368f, 0x9086,
-+ 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04, 0x9294,
-+ 0x00ff, 0x0804, 0x578c, 0x900e, 0xa868, 0xd0f4, 0x1904, 0x368d,
-+ 0x080c, 0x6a9e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-+ 0x0804, 0x368d, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904, 0x4ba1,
-+ 0x902e, 0x080c, 0xb07f, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071,
-+ 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071, 0x107f,
-+ 0x2e04, 0x9005, 0x11b8, 0x2100, 0x9406, 0x1904, 0x4bb2, 0x2428,
-+ 0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1558, 0x0030, 0x94ce,
-+ 0x0080, 0x1130, 0x92ce, 0xfffc, 0x1520, 0x93ce, 0x00ff, 0x1508,
-+ 0xc5fd, 0x0480, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11e8, 0xbe14,
-+ 0x2600, 0x9206, 0x11c8, 0x2400, 0x9106, 0x1180, 0xd884, 0x0598,
-+ 0xd894, 0x1588, 0x080c, 0x6ba1, 0x1570, 0x2001, 0x4000, 0x0460,
-+ 0x080c, 0x6c01, 0x1540, 0x2001, 0x4000, 0x0430, 0x2001, 0x4007,
-+ 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106, 0x1158, 0xbe14,
-+ 0x87ff, 0x1128, 0x86ff, 0x0918, 0x080c, 0xb07f, 0x1900, 0x2001,
-+ 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x4b68, 0x85ff, 0x1130,
-+ 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030, 0x080c, 0x6742,
-+ 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e, 0x00de, 0x00ee,
-+ 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c,
-+ 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0xa867, 0x0000,
-+ 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904, 0x36c2, 0x9096,
-+ 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x36c2, 0x2010, 0x2918,
-+ 0x080c, 0x32b5, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007,
-+ 0x0003, 0x701f, 0x4bf4, 0x0005, 0xa830, 0x9086, 0x0100, 0x1904,
-+ 0x368d, 0x2009, 0x0004, 0x0804, 0x36bf, 0x7984, 0x080c, 0xb07f,
-+ 0x1120, 0x9182, 0x007f, 0x0a04, 0x36c2, 0x9186, 0x00ff, 0x0904,
-+ 0x36c2, 0x9182, 0x0800, 0x1a04, 0x36c2, 0x2001, 0x9400, 0x080c,
-+ 0x57e7, 0x1904, 0x36bf, 0x0804, 0x368d, 0xa998, 0x080c, 0xb07f,
-+ 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff, 0x0168, 0x9182,
-+ 0x0800, 0x1250, 0x2001, 0x9400, 0x080c, 0x57e7, 0x11a8, 0x0060,
-+ 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a, 0x0c48, 0x080c,
-+ 0x1059, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005, 0x1120, 0x2900,
-+ 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086, 0x2040, 0x2900,
-+ 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005, 0x7984, 0x080c,
-+ 0x67ad, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208,
-+ 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x67ad, 0x1130, 0xae9c,
-+ 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005,
-+ 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x67ad, 0x1108, 0x0008,
-+ 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff, 0x0128, 0x2148,
-+ 0xa904, 0x080c, 0x108b, 0x0cc8, 0x7116, 0x711a, 0x001e, 0x0005,
-+ 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44,
-+ 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a,
-+ 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x368d, 0x0005, 0x00f6,
-+ 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001, 0x18b0, 0x2004,
-+ 0x9005, 0x1190, 0x0e04, 0x4cbc, 0x7a36, 0x7833, 0x0012, 0x7a82,
-+ 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-+ 0x190c, 0x1200, 0x0804, 0x4d22, 0x0016, 0x0086, 0x0096, 0x00c6,
-+ 0x00e6, 0x2071, 0x189e, 0x7044, 0x9005, 0x1540, 0x7148, 0x9182,
-+ 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x1059, 0x0904, 0x4d1a,
-+ 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002, 0x9080, 0x1ec1,
-+ 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004, 0x2001, 0x18ba,
-+ 0x9c82, 0x18fa, 0x0210, 0x2061, 0x18ba, 0x2c00, 0x703a, 0x7148,
-+ 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460, 0x7148, 0x8108,
-+ 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016, 0x908a, 0x0036,
-+ 0x1a0c, 0x0d85, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa146,
-+ 0x1520, 0x080c, 0x1059, 0x1130, 0x8109, 0xa946, 0x7148, 0x8109,
-+ 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046, 0x2800, 0xa802,
-+ 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080, 0x1ec1, 0x2005,
-+ 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee, 0x00ce, 0x009e,
-+ 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00, 0x9082, 0x001b,
-+ 0x0002, 0x4d44, 0x4d44, 0x4d46, 0x4d44, 0x4d44, 0x4d44, 0x4d4a,
-+ 0x4d44, 0x4d44, 0x4d44, 0x4d4e, 0x4d44, 0x4d44, 0x4d44, 0x4d52,
-+ 0x4d44, 0x4d44, 0x4d44, 0x4d56, 0x4d44, 0x4d44, 0x4d44, 0x4d5a,
-+ 0x4d44, 0x4d44, 0x4d44, 0x4d5f, 0x080c, 0x0d85, 0xa276, 0xa37a,
-+ 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878, 0xa296, 0xa39a,
-+ 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838, 0xa2b6, 0xa3ba,
-+ 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804, 0x4d1d, 0xa2d6,
-+ 0xa3da, 0xa4de, 0x0804, 0x4d1d, 0x00e6, 0x2071, 0x189e, 0x7048,
-+ 0x9005, 0x0904, 0x4df6, 0x0126, 0x2091, 0x8000, 0x0e04, 0x4df5,
-+ 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086, 0x0076, 0x9006,
-+ 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948, 0x2105, 0x0016,
-+ 0x908a, 0x0036, 0x1a0c, 0x0d85, 0x2060, 0x001e, 0x8108, 0x2105,
-+ 0x9005, 0xa94a, 0x1904, 0x4df8, 0xa804, 0x9005, 0x090c, 0x0d85,
-+ 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001, 0x0002, 0x9080,
-+ 0x1ec1, 0x2005, 0xa04a, 0x0804, 0x4df8, 0x703c, 0x2060, 0x2c14,
-+ 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833, 0x0012, 0x7882,
-+ 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080, 0x2001, 0x0089,
-+ 0x2004, 0xd084, 0x190c, 0x1200, 0x87ff, 0x0118, 0x2748, 0x080c,
-+ 0x108b, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170, 0x7040, 0x2048,
-+ 0x9005, 0x0128, 0x080c, 0x108b, 0x9006, 0x7042, 0x7046, 0x703b,
-+ 0x18ba, 0x703f, 0x18ba, 0x0420, 0x7040, 0x9005, 0x1508, 0x7238,
-+ 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa, 0x18fa, 0x0210,
-+ 0x2001, 0x18ba, 0x703e, 0x00a0, 0x9006, 0x703e, 0x703a, 0x7044,
-+ 0x9005, 0x090c, 0x0d85, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900,
-+ 0x7042, 0x2001, 0x0002, 0x9080, 0x1ec1, 0x2005, 0xa84a, 0x0000,
-+ 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005,
-+ 0x2c00, 0x9082, 0x001b, 0x0002, 0x4e17, 0x4e17, 0x4e19, 0x4e17,
-+ 0x4e17, 0x4e17, 0x4e1e, 0x4e17, 0x4e17, 0x4e17, 0x4e23, 0x4e17,
-+ 0x4e17, 0x4e17, 0x4e28, 0x4e17, 0x4e17, 0x4e17, 0x4e2d, 0x4e17,
-+ 0x4e17, 0x4e17, 0x4e32, 0x4e17, 0x4e17, 0x4e17, 0x4e37, 0x080c,
-+ 0x0d85, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x4da3, 0xaa84, 0xab88,
-+ 0xac8c, 0x0804, 0x4da3, 0xaa94, 0xab98, 0xac9c, 0x0804, 0x4da3,
-+ 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x4da3, 0xaab4, 0xabb8, 0xacbc,
-+ 0x0804, 0x4da3, 0xaac4, 0xabc8, 0xaccc, 0x0804, 0x4da3, 0xaad4,
-+ 0xabd8, 0xacdc, 0x0804, 0x4da3, 0x0016, 0x0026, 0x0036, 0x00b6,
-+ 0x00c6, 0x2009, 0x007e, 0x080c, 0x67ad, 0x2019, 0x0001, 0xb85c,
-+ 0xd0ac, 0x0110, 0x2019, 0x0000, 0x2011, 0x801b, 0x080c, 0x4c9f,
-+ 0x00ce, 0x00be, 0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x080c,
-+ 0x583e, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x4c9f, 0x002e,
-+ 0x0005, 0x81ff, 0x1904, 0x36bf, 0x0126, 0x2091, 0x8000, 0x6030,
-+ 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x778e, 0x1158, 0x080c,
-+ 0x7aa6, 0x080c, 0x6196, 0x9085, 0x0001, 0x080c, 0x77d2, 0x080c,
-+ 0x76bd, 0x0010, 0x080c, 0x6051, 0x012e, 0x0804, 0x368d, 0x81ff,
-+ 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c, 0x5852, 0x0120,
-+ 0x2009, 0x0007, 0x0804, 0x36bf, 0x080c, 0x6bf9, 0x0120, 0x2009,
-+ 0x0008, 0x0804, 0x36bf, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0178,
-+ 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25, 0x002e, 0x0140, 0x7984,
-+ 0x080c, 0x6c6f, 0x1120, 0x2009, 0x4009, 0x0804, 0x36bf, 0x7984,
-+ 0x080c, 0x6742, 0x1904, 0x36c2, 0x080c, 0x4c72, 0x0904, 0x36c2,
-+ 0x2b00, 0x7026, 0x080c, 0x6c01, 0x7888, 0x1170, 0x9084, 0x0005,
-+ 0x1158, 0x900e, 0x080c, 0x6a9e, 0x1108, 0xc185, 0xb800, 0xd0bc,
-+ 0x0108, 0xc18d, 0x0804, 0x368d, 0x080c, 0x4c3f, 0x0904, 0x36bf,
-+ 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd141,
-+ 0x0904, 0x36bf, 0x7888, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6,
-+ 0x7007, 0x0003, 0x701f, 0x4f26, 0x0005, 0x2061, 0x1800, 0x080c,
-+ 0x5852, 0x2009, 0x0007, 0x1560, 0x080c, 0x6bf9, 0x0118, 0x2009,
-+ 0x0008, 0x0430, 0xa998, 0x080c, 0x6742, 0x1530, 0x080c, 0x4c70,
-+ 0x0518, 0x080c, 0x6c01, 0xa89c, 0x1168, 0x9084, 0x0005, 0x1150,
-+ 0x900e, 0x080c, 0x6a9e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-+ 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xd141, 0x11e0,
-+ 0xa89c, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6, 0x2009, 0x0003,
-+ 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a, 0x9006,
-+ 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830, 0x2009,
-+ 0x180d, 0x210c, 0xd18c, 0x0140, 0x2008, 0x918e, 0xdead, 0x1120,
-+ 0x2021, 0x4009, 0x0804, 0x368f, 0x9086, 0x0100, 0x7024, 0x2058,
-+ 0x1110, 0x0804, 0x578c, 0x900e, 0x080c, 0x6a9e, 0x1108, 0xc185,
-+ 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x368d, 0x080c, 0x5852,
-+ 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x7f84, 0x7a8c, 0x7b88,
-+ 0x7c9c, 0x7d98, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804,
-+ 0x36bf, 0x900e, 0x2130, 0x7126, 0x7132, 0xa860, 0x20e8, 0x7036,
-+ 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0, 0x080c, 0x67ad, 0x1904,
-+ 0x4fdc, 0x080c, 0x6c01, 0x0138, 0x080c, 0x6c09, 0x0120, 0x080c,
-+ 0x6ba1, 0x1904, 0x4fdc, 0xd794, 0x1110, 0xd784, 0x01a8, 0xb8c4,
-+ 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x3400, 0xd794, 0x0198,
-+ 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x20a9,
-+ 0x0002, 0x080c, 0x4a0e, 0x0080, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-+ 0x000a, 0x2098, 0x3400, 0x20a9, 0x0004, 0x4003, 0x2098, 0x20a0,
-+ 0x3d00, 0x20e0, 0x080c, 0x4a0e, 0x9186, 0x007e, 0x0170, 0x9186,
-+ 0x0080, 0x0158, 0x080c, 0x6c01, 0x90c2, 0x0006, 0x1210, 0xc1fd,
-+ 0x0020, 0x080c, 0x6a9e, 0x1108, 0xc1fd, 0x4104, 0xc1fc, 0xd794,
-+ 0x0528, 0xb8c4, 0x20e0, 0xb8c8, 0x2060, 0x9c80, 0x0000, 0x2098,
-+ 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9, 0x0001,
-+ 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002, 0x4003,
-+ 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4a01, 0x9c80, 0x0026,
-+ 0x2098, 0xb8c4, 0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794, 0x0110,
-+ 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c, 0xb07f, 0x0118,
-+ 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186, 0x0800, 0x0170,
-+ 0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118, 0x9686, 0x0020,
-+ 0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4f65, 0x86ff, 0x1120,
-+ 0x7124, 0x810b, 0x0804, 0x368d, 0x7033, 0x0001, 0x7122, 0x7024,
-+ 0x9600, 0x7026, 0x772e, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000,
-+ 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e, 0xa392, 0xa496,
-+ 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x5018, 0x0005,
-+ 0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0, 0x772c, 0x9036,
-+ 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494,
-+ 0xa598, 0x0804, 0x4f65, 0x7124, 0x810b, 0x0804, 0x368d, 0x2029,
-+ 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00, 0x8007,
-+ 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9184,
- 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2,
-- 0x9484, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502,
-- 0x0a04, 0x36c2, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x36c2,
-- 0x9502, 0x0a04, 0x36c2, 0x2061, 0x1989, 0x6102, 0x6206, 0x630a,
-- 0x640e, 0x0804, 0x368d, 0x080c, 0x4c41, 0x0904, 0x36bf, 0x2009,
-- 0x0016, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019,
-- 0xaf60, 0x080c, 0x4c8a, 0x701f, 0x509e, 0x0005, 0x20a9, 0x0016,
-- 0x896e, 0x8d6e, 0x8d6f, 0x9d84, 0xffc0, 0x9080, 0x0019, 0x2098,
-- 0x9d84, 0x003f, 0x20e0, 0x2069, 0x1877, 0x20e9, 0x0001, 0x2da0,
-- 0x4003, 0x6800, 0x9005, 0x0904, 0x5105, 0x6804, 0x2008, 0x918c,
-- 0xfff8, 0x1904, 0x5105, 0x680c, 0x9005, 0x0904, 0x5105, 0x9082,
-- 0xff01, 0x1a04, 0x5105, 0x6810, 0x9082, 0x005c, 0x06f0, 0x6824,
-- 0x2008, 0x9082, 0x0008, 0x06c8, 0x9182, 0x0400, 0x16b0, 0x0056,
-- 0x2029, 0x0000, 0x080c, 0x9077, 0x005e, 0x6944, 0x6820, 0x9102,
-- 0x0660, 0x6820, 0x9082, 0x0019, 0x1640, 0x6828, 0x6944, 0x810c,
-- 0x9102, 0x0618, 0x6840, 0x9082, 0x000f, 0x12f8, 0x080c, 0x1072,
-- 0x2900, 0x0590, 0x684e, 0x00e6, 0x2071, 0x1931, 0x00b6, 0x2059,
-- 0x0000, 0x080c, 0x8f33, 0x00be, 0x00ee, 0x01e8, 0x080c, 0x8c78,
-- 0x080c, 0x8cc7, 0x1160, 0x6857, 0x0000, 0x00c6, 0x6b10, 0x2061,
-- 0x1a6e, 0x630e, 0x00ce, 0x0804, 0x368d, 0x0804, 0x36c2, 0x080c,
-- 0x8cc0, 0x00e6, 0x2071, 0x1931, 0x080c, 0x90f7, 0x080c, 0x9106,
-- 0x080c, 0x8f18, 0x00ee, 0x2001, 0x188a, 0x204c, 0x080c, 0x108b,
-- 0x2001, 0x188a, 0x2003, 0x0000, 0x0804, 0x36bf, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0x94b8, 0x080c, 0x8cc0, 0x012e, 0x0804, 0x368d,
-- 0x0006, 0x080c, 0x5840, 0xd0cc, 0x000e, 0x0005, 0x0006, 0x080c,
-- 0x5844, 0xd0bc, 0x000e, 0x0005, 0x6174, 0x7a84, 0x6300, 0x82ff,
-- 0x1118, 0x7986, 0x0804, 0x368d, 0x83ff, 0x1904, 0x36c2, 0x2001,
-- 0xfff0, 0x9200, 0x1a04, 0x36c2, 0x2019, 0xffff, 0x6078, 0x9302,
-- 0x9200, 0x0a04, 0x36c2, 0x7986, 0x6276, 0x0804, 0x368d, 0x080c,
-- 0x5854, 0x1904, 0x36bf, 0x7c88, 0x7d84, 0x7e98, 0x7f8c, 0x080c,
-- 0x4c41, 0x0904, 0x36bf, 0x900e, 0x901e, 0x7326, 0x7332, 0xa860,
-- 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0, 0x91d8,
-- 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6c11, 0x0118, 0x080c,
-- 0x6c19, 0x1148, 0x20a9, 0x0001, 0xb814, 0x4004, 0xb810, 0x4004,
-- 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386,
-- 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e, 0x2001,
-- 0x0003, 0x080c, 0x955b, 0x2208, 0x0804, 0x368d, 0x7033, 0x0001,
-- 0x7122, 0x7024, 0x9300, 0x7026, 0x2061, 0x18b8, 0x2c44, 0xa06b,
-- 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034, 0xa072, 0xa48e, 0xa592,
-- 0xa696, 0xa79a, 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x51a9,
-- 0x0005, 0x7030, 0x9005, 0x1178, 0x7120, 0x7028, 0x20a0, 0x901e,
-- 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa48c, 0xa590, 0xa694,
-- 0xa798, 0x0804, 0x5167, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c,
-- 0x955b, 0x2208, 0x0804, 0x368d, 0x00f6, 0x00e6, 0x080c, 0x5854,
-- 0x2009, 0x0007, 0x1904, 0x523c, 0x2071, 0x189e, 0x745c, 0x84ff,
-- 0x2009, 0x000e, 0x1904, 0x523c, 0xac9c, 0xad98, 0xaea4, 0xafa0,
-- 0x0096, 0x080c, 0x1072, 0x2009, 0x0002, 0x0904, 0x523c, 0x2900,
-- 0x705e, 0x900e, 0x901e, 0x7356, 0x7362, 0xa860, 0x7066, 0xa85c,
-- 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff,
-- 0x0178, 0x080c, 0x6c11, 0x0118, 0x080c, 0x6c19, 0x1148, 0xb814,
-+ 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502,
-+ 0x0a04, 0x36c2, 0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x36c2,
-+ 0x9502, 0x0a04, 0x36c2, 0x9384, 0xff00, 0x8007, 0x90e2, 0x0020,
-+ 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9384, 0x00ff, 0x90e2,
-+ 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2, 0x9484, 0xff00,
-+ 0x8007, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04, 0x36c2,
-+ 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x36c2, 0x9502, 0x0a04,
-+ 0x36c2, 0x2061, 0x1989, 0x6102, 0x6206, 0x630a, 0x640e, 0x0804,
-+ 0x368d, 0x080c, 0x4c3f, 0x0904, 0x36bf, 0x2009, 0x0016, 0x7a8c,
-+ 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
-+ 0x4c88, 0x701f, 0x509c, 0x0005, 0x20a9, 0x0016, 0x896e, 0x8d6e,
-+ 0x8d6f, 0x9d84, 0xffc0, 0x9080, 0x0019, 0x2098, 0x9d84, 0x003f,
-+ 0x20e0, 0x2069, 0x1877, 0x20e9, 0x0001, 0x2da0, 0x4003, 0x6800,
-+ 0x9005, 0x0904, 0x5103, 0x6804, 0x2008, 0x918c, 0xfff8, 0x1904,
-+ 0x5103, 0x680c, 0x9005, 0x0904, 0x5103, 0x9082, 0xff01, 0x1a04,
-+ 0x5103, 0x6810, 0x9082, 0x005c, 0x06f0, 0x6824, 0x2008, 0x9082,
-+ 0x0008, 0x06c8, 0x9182, 0x0400, 0x16b0, 0x0056, 0x2029, 0x0000,
-+ 0x080c, 0x9067, 0x005e, 0x6944, 0x6820, 0x9102, 0x0660, 0x6820,
-+ 0x9082, 0x0019, 0x1640, 0x6828, 0x6944, 0x810c, 0x9102, 0x0618,
-+ 0x6840, 0x9082, 0x000f, 0x12f8, 0x080c, 0x1072, 0x2900, 0x0590,
-+ 0x684e, 0x00e6, 0x2071, 0x1931, 0x00b6, 0x2059, 0x0000, 0x080c,
-+ 0x8f23, 0x00be, 0x00ee, 0x01e8, 0x080c, 0x8c68, 0x080c, 0x8cb7,
-+ 0x1160, 0x6857, 0x0000, 0x00c6, 0x6b10, 0x2061, 0x1a6e, 0x630e,
-+ 0x00ce, 0x0804, 0x368d, 0x0804, 0x36c2, 0x080c, 0x8cb0, 0x00e6,
-+ 0x2071, 0x1931, 0x080c, 0x90e7, 0x080c, 0x90f6, 0x080c, 0x8f08,
-+ 0x00ee, 0x2001, 0x188a, 0x204c, 0x080c, 0x108b, 0x2001, 0x188a,
-+ 0x2003, 0x0000, 0x0804, 0x36bf, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x94a8, 0x080c, 0x8cb0, 0x012e, 0x0804, 0x368d, 0x0006, 0x080c,
-+ 0x583e, 0xd0cc, 0x000e, 0x0005, 0x0006, 0x080c, 0x5842, 0xd0bc,
-+ 0x000e, 0x0005, 0x6174, 0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986,
-+ 0x0804, 0x368d, 0x83ff, 0x1904, 0x36c2, 0x2001, 0xfff0, 0x9200,
-+ 0x1a04, 0x36c2, 0x2019, 0xffff, 0x6078, 0x9302, 0x9200, 0x0a04,
-+ 0x36c2, 0x7986, 0x6276, 0x0804, 0x368d, 0x080c, 0x5852, 0x1904,
-+ 0x36bf, 0x7c88, 0x7d84, 0x7e98, 0x7f8c, 0x080c, 0x4c3f, 0x0904,
-+ 0x36bf, 0x900e, 0x901e, 0x7326, 0x7332, 0xa860, 0x20e8, 0x7036,
-+ 0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c,
-+ 0x8bff, 0x0178, 0x080c, 0x6c01, 0x0118, 0x080c, 0x6c09, 0x1148,
-+ 0x20a9, 0x0001, 0xb814, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398,
-+ 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0170,
-+ 0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c,
-+ 0x954b, 0x2208, 0x0804, 0x368d, 0x7033, 0x0001, 0x7122, 0x7024,
-+ 0x9300, 0x7026, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa37a,
-+ 0x7028, 0xa076, 0x7034, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a,
-+ 0x080c, 0x114e, 0x7007, 0x0002, 0x701f, 0x51a7, 0x0005, 0x7030,
-+ 0x9005, 0x1178, 0x7120, 0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8,
-+ 0x2061, 0x18b8, 0x2c44, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0804,
-+ 0x5165, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x954b, 0x2208,
-+ 0x0804, 0x368d, 0x00f6, 0x00e6, 0x080c, 0x5852, 0x2009, 0x0007,
-+ 0x1904, 0x523a, 0x2071, 0x189e, 0x745c, 0x84ff, 0x2009, 0x000e,
-+ 0x1904, 0x523a, 0xac9c, 0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c,
-+ 0x1072, 0x2009, 0x0002, 0x0904, 0x523a, 0x2900, 0x705e, 0x900e,
-+ 0x901e, 0x7356, 0x7362, 0xa860, 0x7066, 0xa85c, 0x9080, 0x0003,
-+ 0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
-+ 0x6c01, 0x0118, 0x080c, 0x6c09, 0x1148, 0xb814, 0x20a9, 0x0001,
-+ 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182,
-+ 0x0800, 0x0120, 0x9386, 0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0,
-+ 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x954b, 0x2208, 0x009e,
-+ 0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff, 0x090c, 0x0d85, 0x2148,
-+ 0x080c, 0x108b, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0x0418,
-+ 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0x2061, 0x18b9,
-+ 0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064, 0xa072, 0xa48e, 0xa592,
-+ 0xa696, 0xa79a, 0xa09f, 0x5246, 0x000e, 0xa0a2, 0x080c, 0x114e,
-+ 0x9006, 0x0048, 0x009e, 0xa897, 0x4005, 0xa99a, 0x900e, 0x9085,
-+ 0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0,
-+ 0x904d, 0x090c, 0x0d85, 0x00e6, 0x2071, 0x189e, 0xa06c, 0x908e,
-+ 0x0100, 0x0138, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002,
-+ 0x00d8, 0x7060, 0x9005, 0x1158, 0x7150, 0x7058, 0x20a0, 0x901e,
-+ 0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0428, 0xa87b,
-+ 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x7254, 0x900e, 0x2001,
-+ 0x0003, 0x080c, 0x954b, 0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0d85,
-+ 0x2148, 0x080c, 0x108b, 0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x7002, 0x012e, 0xa09f, 0x0000, 0xa0a3,
-+ 0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff,
-+ 0x0178, 0x080c, 0x6c01, 0x0118, 0x080c, 0x6c09, 0x1148, 0xb814,
- 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003,
-- 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x01e8, 0x0c20,
-- 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x955b,
-- 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff, 0x090c,
-- 0x0d85, 0x2148, 0x080c, 0x108b, 0x9006, 0x705e, 0x918d, 0x0001,
-- 0x2008, 0x0418, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056,
-- 0x2061, 0x18b9, 0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064, 0xa072,
-- 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f, 0x5248, 0x000e, 0xa0a2,
-- 0x080c, 0x114e, 0x9006, 0x0048, 0x009e, 0xa897, 0x4005, 0xa99a,
-- 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe, 0x0005,
-- 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0d85, 0x00e6, 0x2071, 0x189e,
-- 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b, 0x0030, 0xa883, 0x0000,
-- 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005, 0x1158, 0x7150, 0x7058,
-- 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694, 0xa798,
-- 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x7254,
-- 0x900e, 0x2001, 0x0003, 0x080c, 0x955b, 0xaa9a, 0x715c, 0x81ff,
-- 0x090c, 0x0d85, 0x2148, 0x080c, 0x108b, 0x705f, 0x0000, 0xa0a0,
-- 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0xa09f,
-- 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8, 0x1000,
-- 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6c11, 0x0118, 0x080c, 0x6c19,
-- 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104,
-- 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c,
-- 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a, 0xa897,
-- 0x4000, 0x715c, 0x81ff, 0x090c, 0x0d85, 0x2148, 0x080c, 0x108b,
-- 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0xa09f, 0x0000, 0xa0a3,
-- 0x0000, 0x0070, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056,
-- 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x114e, 0x9006,
-- 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be, 0x7000, 0x0148, 0x90be,
-- 0x7100, 0x0130, 0x90be, 0x7200, 0x0118, 0x009e, 0x0804, 0x36c2,
-- 0xa884, 0xa988, 0x080c, 0x268c, 0x1518, 0x080c, 0x6749, 0x1500,
-- 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4c41, 0x01c8, 0x080c,
-- 0x4c41, 0x01b0, 0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-- 0xa823, 0x0000, 0xa804, 0x2048, 0x080c, 0xd0cd, 0x1120, 0x2009,
-- 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003, 0x701f, 0x5315, 0x0005,
-- 0x009e, 0x2009, 0x0002, 0x0804, 0x36bf, 0x7124, 0x080c, 0x341e,
-- 0xa820, 0x9086, 0x8001, 0x1120, 0x2009, 0x0004, 0x0804, 0x36bf,
-- 0x2900, 0x7022, 0xa804, 0x0096, 0x2048, 0x8906, 0x8006, 0x8007,
-- 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e, 0x9080, 0x0002, 0x0076,
-- 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c,
-- 0x0fd6, 0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061, 0x18b8, 0x2c44,
-- 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118, 0x97c6,
-- 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600, 0x2009, 0x0004, 0x000e,
-- 0x007e, 0x0804, 0x4c8d, 0x97c6, 0x7200, 0x11b8, 0x96c2, 0x0054,
-- 0x02a0, 0x000e, 0x007e, 0x2061, 0x18b8, 0x2c44, 0xa076, 0xa772,
-- 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x114e,
-- 0x7007, 0x0002, 0x701f, 0x5371, 0x0005, 0x000e, 0x007e, 0x0804,
-- 0x36c2, 0x7020, 0x2048, 0xa804, 0x2048, 0xa804, 0x2048, 0x8906,
-- 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-- 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fd6,
-- 0x2100, 0x2238, 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494,
-- 0xa598, 0x2009, 0x002a, 0x0804, 0x4c8d, 0x81ff, 0x1904, 0x36bf,
-- 0x798c, 0x2001, 0x197e, 0x918c, 0x8000, 0x2102, 0x080c, 0x4c58,
-- 0x0904, 0x36c2, 0x080c, 0x6c11, 0x0120, 0x080c, 0x6c19, 0x1904,
-- 0x36c2, 0x080c, 0x687b, 0x0904, 0x36bf, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x6a1b, 0x012e, 0x0904, 0x36bf, 0x2001, 0x197e, 0x2004,
-- 0xd0fc, 0x1904, 0x368d, 0x0804, 0x46aa, 0xa9a0, 0x2001, 0x197e,
-- 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4c65, 0x01a0, 0x080c,
-- 0x6c11, 0x0118, 0x080c, 0x6c19, 0x1170, 0x080c, 0x687b, 0x2009,
-- 0x0002, 0x0128, 0x080c, 0x6a1b, 0x1170, 0x2009, 0x0003, 0xa897,
-- 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
-- 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197e, 0x2004,
-- 0xd0fc, 0x1128, 0x080c, 0x5848, 0x0110, 0x9006, 0x0018, 0x900e,
-- 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c, 0x1118,
-- 0xd084, 0x0904, 0x461f, 0x080c, 0x4c74, 0x0904, 0x36c2, 0x080c,
-- 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0x080c, 0x6c11,
-- 0x0130, 0x908e, 0x0004, 0x0118, 0x908e, 0x0005, 0x15a0, 0x78a8,
-- 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802, 0x0028, 0x080c, 0x5840,
-- 0xd0b4, 0x0904, 0x4659, 0x7884, 0x908e, 0x007e, 0x0904, 0x4659,
-- 0x908e, 0x007f, 0x0904, 0x4659, 0x908e, 0x0080, 0x0904, 0x4659,
-- 0xb800, 0xd08c, 0x1904, 0x4659, 0xa867, 0x0000, 0xa868, 0xc0fd,
-- 0xa86a, 0x080c, 0xd0ec, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf,
-- 0x7007, 0x0003, 0x701f, 0x543d, 0x0005, 0x080c, 0x4c74, 0x0904,
-- 0x36c2, 0x0804, 0x4659, 0x080c, 0x347d, 0x0108, 0x0005, 0x2009,
-- 0x1834, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf,
-- 0x080c, 0x5854, 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x080c,
-- 0x6c09, 0x0120, 0x2009, 0x0008, 0x0804, 0x36bf, 0xb89c, 0xd0a4,
-- 0x1118, 0xd0ac, 0x1904, 0x4659, 0x9006, 0xa866, 0xa832, 0xa868,
-- 0xc0fd, 0xa86a, 0x080c, 0xd154, 0x1120, 0x2009, 0x0003, 0x0804,
-- 0x36bf, 0x7007, 0x0003, 0x701f, 0x5476, 0x0005, 0xa830, 0x9086,
-- 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x578e, 0x080c, 0x4c74,
-- 0x0904, 0x36c2, 0x0804, 0x540f, 0x81ff, 0x2009, 0x0001, 0x1904,
-- 0x36bf, 0x080c, 0x5854, 0x2009, 0x0007, 0x1904, 0x36bf, 0x080c,
-- 0x6c09, 0x0120, 0x2009, 0x0008, 0x0804, 0x36bf, 0x080c, 0x4c74,
-- 0x0904, 0x36c2, 0x080c, 0x6c11, 0x2009, 0x0009, 0x1904, 0x36bf,
-- 0x080c, 0x4c41, 0x2009, 0x0002, 0x0904, 0x36bf, 0x9006, 0xa866,
-- 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988, 0xa95a, 0x9194, 0xfd00,
-- 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952, 0x798c,
-- 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x36c2, 0xc0e5, 0xa952,
-- 0xa956, 0xa83e, 0x080c, 0xd3b7, 0x2009, 0x0003, 0x0904, 0x36bf,
-- 0x7007, 0x0003, 0x701f, 0x54cd, 0x0005, 0xa830, 0x9086, 0x0100,
-- 0x2009, 0x0004, 0x0904, 0x36bf, 0x0804, 0x368d, 0x7aa8, 0x9284,
-- 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x5854, 0x1188, 0x2009,
-- 0x0014, 0x0804, 0x36bf, 0xd2dc, 0x1578, 0x81ff, 0x2009, 0x0001,
-- 0x1904, 0x36bf, 0x080c, 0x5854, 0x2009, 0x0007, 0x1904, 0x36bf,
-- 0xd2f4, 0x0138, 0x9284, 0x5000, 0xc0d5, 0x080c, 0x581a, 0x0804,
-- 0x368d, 0xd2fc, 0x0160, 0x080c, 0x4c74, 0x0904, 0x36c2, 0x7984,
-- 0x9284, 0x9000, 0xc0d5, 0x080c, 0x57e9, 0x0804, 0x368d, 0x080c,
-- 0x4c74, 0x0904, 0x36c2, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
-- 0x2009, 0x0009, 0x1904, 0x55bc, 0x080c, 0x4c41, 0x2009, 0x0002,
-- 0x0904, 0x55bc, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008,
-- 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4c8a, 0x701f, 0x5529,
-- 0x0005, 0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120,
-- 0xa874, 0x9084, 0xff00, 0x0110, 0x1904, 0x36c2, 0xa866, 0xa832,
-- 0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4c74, 0x1110, 0x0804, 0x36c2,
-- 0x2009, 0x0043, 0x080c, 0xd423, 0x2009, 0x0003, 0x0904, 0x55bc,
-- 0x7007, 0x0003, 0x701f, 0x554d, 0x0005, 0xa830, 0x9086, 0x0100,
-- 0x2009, 0x0004, 0x0904, 0x55bc, 0x7984, 0x7aa8, 0x9284, 0x1000,
-- 0xc0d5, 0x080c, 0x57e9, 0x0804, 0x368d, 0x00c6, 0xaab0, 0x9284,
-- 0xc000, 0x0148, 0xd2ec, 0x0170, 0x080c, 0x5854, 0x1158, 0x2009,
-- 0x0014, 0x0804, 0x55ab, 0x2061, 0x1800, 0x080c, 0x5854, 0x2009,
-- 0x0007, 0x15c8, 0xd2f4, 0x0130, 0x9284, 0x5000, 0xc0d5, 0x080c,
-- 0x581a, 0x0058, 0xd2fc, 0x0180, 0x080c, 0x4c72, 0x0590, 0xa998,
-- 0x9284, 0x9000, 0xc0d5, 0x080c, 0x57e9, 0xa87b, 0x0000, 0xa883,
-- 0x0000, 0xa897, 0x4000, 0x0438, 0x080c, 0x4c72, 0x0510, 0x080c,
-- 0x6c11, 0x2009, 0x0009, 0x11b8, 0xa8c4, 0x9086, 0x0500, 0x11c8,
-- 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084, 0xff00, 0x1190, 0x080c,
-- 0x4c72, 0x1108, 0x0070, 0x2009, 0x004b, 0x080c, 0xd423, 0x2009,
-- 0x0003, 0x0108, 0x0078, 0x0431, 0x19c0, 0xa897, 0x4005, 0xa99a,
-+ 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0518, 0x0c20,
-+ 0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a, 0xa897, 0x4000, 0x715c,
-+ 0x81ff, 0x090c, 0x0d85, 0x2148, 0x080c, 0x108b, 0x9006, 0x705e,
-+ 0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x7002, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070,
-+ 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e,
-+ 0xa592, 0xa696, 0xa79a, 0x080c, 0x114e, 0x9006, 0x00ee, 0x0005,
-+ 0x0096, 0xa88c, 0x90be, 0x7000, 0x0148, 0x90be, 0x7100, 0x0130,
-+ 0x90be, 0x7200, 0x0118, 0x009e, 0x0804, 0x36c2, 0xa884, 0xa988,
-+ 0x080c, 0x268c, 0x1518, 0x080c, 0x6742, 0x1500, 0x7126, 0xbe12,
-+ 0xbd16, 0xae7c, 0x080c, 0x4c3f, 0x01c8, 0x080c, 0x4c3f, 0x01b0,
-+ 0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000,
-+ 0xa804, 0x2048, 0x080c, 0xd0ba, 0x1120, 0x2009, 0x0003, 0x0804,
-+ 0x36bf, 0x7007, 0x0003, 0x701f, 0x5313, 0x0005, 0x009e, 0x2009,
-+ 0x0002, 0x0804, 0x36bf, 0x7124, 0x080c, 0x341e, 0xa820, 0x9086,
-+ 0x8001, 0x1120, 0x2009, 0x0004, 0x0804, 0x36bf, 0x2900, 0x7022,
-+ 0xa804, 0x0096, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-+ 0x9084, 0xffc0, 0x009e, 0x9080, 0x0002, 0x0076, 0x0006, 0x2098,
-+ 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fd6, 0xaa6c,
-+ 0xab70, 0xac74, 0xad78, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000,
-+ 0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118, 0x97c6, 0x7100, 0x1148,
-+ 0x96c2, 0x0004, 0x0600, 0x2009, 0x0004, 0x000e, 0x007e, 0x0804,
-+ 0x4c8b, 0x97c6, 0x7200, 0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e,
-+ 0x007e, 0x2061, 0x18b8, 0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a,
-+ 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x114e, 0x7007, 0x0002,
-+ 0x701f, 0x536f, 0x0005, 0x000e, 0x007e, 0x0804, 0x36c2, 0x7020,
-+ 0x2048, 0xa804, 0x2048, 0xa804, 0x2048, 0x8906, 0x8006, 0x8007,
-+ 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0,
-+ 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fd6, 0x2100, 0x2238,
-+ 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x2009,
-+ 0x002a, 0x0804, 0x4c8b, 0x81ff, 0x1904, 0x36bf, 0x798c, 0x2001,
-+ 0x197e, 0x918c, 0x8000, 0x2102, 0x080c, 0x4c56, 0x0904, 0x36c2,
-+ 0x080c, 0x6c01, 0x0120, 0x080c, 0x6c09, 0x1904, 0x36c2, 0x080c,
-+ 0x6874, 0x0904, 0x36bf, 0x0126, 0x2091, 0x8000, 0x080c, 0x6a0b,
-+ 0x012e, 0x0904, 0x36bf, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1904,
-+ 0x368d, 0x0804, 0x46a8, 0xa9a0, 0x2001, 0x197e, 0x918c, 0x8000,
-+ 0xc18d, 0x2102, 0x080c, 0x4c63, 0x01a0, 0x080c, 0x6c01, 0x0118,
-+ 0x080c, 0x6c09, 0x1170, 0x080c, 0x6874, 0x2009, 0x0002, 0x0128,
-+ 0x080c, 0x6a0b, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a,
- 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-- 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8, 0xd2dc, 0x0904, 0x36bf,
-- 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x57e9, 0x001e,
-- 0x1904, 0x36bf, 0x0804, 0x368d, 0x00f6, 0x2d78, 0xaab0, 0x0021,
-- 0x00fe, 0x0005, 0xaab0, 0xc2d5, 0xd2dc, 0x0150, 0x0016, 0xa998,
-- 0x9284, 0x1400, 0xc0fd, 0x080c, 0x57e9, 0x001e, 0x9085, 0x0001,
-- 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c,
-- 0x5854, 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x7984, 0x7ea8,
-- 0x96b4, 0x00ff, 0x080c, 0x67b4, 0x1904, 0x36c2, 0x9186, 0x007f,
-- 0x0138, 0x080c, 0x6c11, 0x0120, 0x2009, 0x0009, 0x0804, 0x36bf,
-- 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0xa867,
-- 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007, 0xa80a,
-- 0x080c, 0xd106, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007,
-- 0x0003, 0x701f, 0x561c, 0x0005, 0xa808, 0x8007, 0x9086, 0x0100,
-- 0x1120, 0x2009, 0x0004, 0x0804, 0x36bf, 0xa8e0, 0xa866, 0xa810,
-- 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084, 0x00ff,
-- 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006, 0x8007, 0x90bc,
-- 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88, 0x7c9c,
-- 0x7d98, 0x0804, 0x4c8d, 0x080c, 0x4c41, 0x1120, 0x2009, 0x0002,
-- 0x0804, 0x36bf, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217,
-- 0x82ff, 0x1118, 0x7023, 0x19b4, 0x0040, 0x92c6, 0x0001, 0x1118,
-- 0x7023, 0x19ce, 0x0010, 0x0804, 0x36c2, 0x2009, 0x001a, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
-- 0x4c8a, 0x701f, 0x566c, 0x0005, 0x2001, 0x182e, 0x2003, 0x0001,
-- 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9, 0x001a,
-- 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804, 0x368d, 0x080c,
-- 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0x7984, 0x9194,
-- 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099, 0x19b4,
-- 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x19ce, 0x0010, 0x0804,
-- 0x36c2, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8, 0x20a9,
-- 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c, 0x7b88,
-- 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804, 0x4c8d,
-- 0x7884, 0x908a, 0x1000, 0x1a04, 0x36c2, 0x0126, 0x2091, 0x8000,
-- 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061, 0x1a04, 0x614a,
-- 0x00ce, 0x012e, 0x0804, 0x368d, 0x00c6, 0x080c, 0x779e, 0x1160,
-- 0x080c, 0x7ab6, 0x080c, 0x619d, 0x9085, 0x0001, 0x080c, 0x77e2,
-- 0x080c, 0x76cd, 0x080c, 0x0d85, 0x2061, 0x1800, 0x6030, 0xc09d,
-- 0x6032, 0x080c, 0x6058, 0x00ce, 0x0005, 0x00c6, 0x2001, 0x1800,
-- 0x2004, 0x908e, 0x0000, 0x0904, 0x36bf, 0x7884, 0x9005, 0x0188,
-- 0x7888, 0x2061, 0x199c, 0x2c0c, 0x2062, 0x080c, 0x2a67, 0x01a0,
-- 0x080c, 0x2a6f, 0x0188, 0x080c, 0x2a77, 0x0170, 0x2162, 0x0804,
-- 0x36c2, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007, 0x1118, 0x2009,
-- 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086, 0x0002, 0x15a8,
-- 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x080c, 0xacfc, 0x0026,
-- 0x2011, 0x0003, 0x080c, 0xa62b, 0x2011, 0x0002, 0x080c, 0xa635,
-- 0x002e, 0x080c, 0xa516, 0x0036, 0x901e, 0x080c, 0xa596, 0x003e,
-- 0x080c, 0xad18, 0x60e3, 0x0000, 0x080c, 0xeed9, 0x080c, 0xeef4,
-- 0x9085, 0x0001, 0x080c, 0x77e2, 0x9006, 0x080c, 0x2a99, 0x2001,
-- 0x1800, 0x2003, 0x0004, 0x2001, 0x19a8, 0x2003, 0x0000, 0x0026,
-- 0x2011, 0x0008, 0x080c, 0x2ad3, 0x002e, 0x00ce, 0x0804, 0x368d,
-- 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c, 0x5854,
-- 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x7984, 0x7ea8, 0x96b4,
-- 0x00ff, 0x080c, 0x67b4, 0x1904, 0x36c2, 0x9186, 0x007f, 0x0138,
-- 0x080c, 0x6c11, 0x0120, 0x2009, 0x0009, 0x0804, 0x36bf, 0x080c,
-- 0x4c41, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0xa867, 0x0000,
-- 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xd109, 0x1120, 0x2009, 0x0003,
-- 0x0804, 0x36bf, 0x7007, 0x0003, 0x701f, 0x5777, 0x0005, 0xa830,
-- 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x36bf, 0xa8e0,
-- 0xa866, 0xa834, 0x8007, 0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c,
-- 0x7b88, 0x7c9c, 0x7d98, 0xaf60, 0x0804, 0x4c8d, 0xa898, 0x9086,
-- 0x000d, 0x1904, 0x36bf, 0x2021, 0x4005, 0x0126, 0x2091, 0x8000,
-- 0x0e04, 0x579b, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000,
-- 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7883, 0x4005,
-- 0xa998, 0x7986, 0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c, 0x4c7d,
-- 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200,
-- 0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005,
-- 0x0126, 0x2091, 0x8000, 0x00c6, 0x2061, 0x1a04, 0x7984, 0x615a,
-- 0x6156, 0x605f, 0x0000, 0x6053, 0x0009, 0x7898, 0x6072, 0x789c,
-- 0x606e, 0x7888, 0x606a, 0x788c, 0x6066, 0x2001, 0x1a14, 0x2044,
-- 0x2001, 0x1a1b, 0xa076, 0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f,
-- 0x0002, 0xa06b, 0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804,
-- 0x368d, 0x0126, 0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000,
-- 0x0198, 0x0006, 0xd0d4, 0x0160, 0x0036, 0x2019, 0x0029, 0x080c,
-- 0xacfc, 0x0106, 0x080c, 0x3442, 0x010e, 0x090c, 0xad18, 0x003e,
-- 0x080c, 0xcf68, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000,
-- 0x2004, 0x905d, 0x0160, 0x080c, 0x61b7, 0x080c, 0xb094, 0x0110,
-- 0xb817, 0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085,
-- 0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e,
-- 0x20a9, 0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0188,
-- 0x9186, 0x007e, 0x0170, 0x9186, 0x007f, 0x0158, 0x9186, 0x0080,
-- 0x0140, 0x9186, 0x00ff, 0x0128, 0x0026, 0x2200, 0x080c, 0x57e9,
-- 0x002e, 0x001e, 0x8108, 0x1f04, 0x5822, 0x015e, 0x012e, 0x0005,
-- 0x2001, 0x1848, 0x2004, 0x0005, 0x2001, 0x1867, 0x2004, 0x0005,
-- 0x0006, 0x2001, 0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001,
-- 0x180e, 0x2004, 0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086,
-- 0x0003, 0x0005, 0x0016, 0x00e6, 0x2071, 0x189e, 0x7108, 0x910d,
-- 0x710a, 0x00ee, 0x001e, 0x0005, 0x79a4, 0x81ff, 0x0904, 0x36c2,
-- 0x9182, 0x0081, 0x1a04, 0x36c2, 0x810c, 0x0016, 0x080c, 0x4c41,
-- 0x0170, 0x080c, 0x0f61, 0x2100, 0x2238, 0x7d84, 0x7c88, 0x7b8c,
-- 0x7a90, 0x001e, 0x080c, 0x4c8a, 0x701f, 0x5884, 0x0005, 0x001e,
-- 0x2009, 0x0002, 0x0804, 0x36bf, 0x2079, 0x0000, 0x7d94, 0x7c98,
-- 0x7ba8, 0x7aac, 0x79a4, 0x810c, 0x2061, 0x18b8, 0x2c44, 0xa770,
-- 0xa074, 0x2071, 0x189e, 0x080c, 0x4c8d, 0x701f, 0x5898, 0x0005,
-- 0x2061, 0x18b8, 0x2c44, 0x0016, 0x0026, 0xa270, 0xa174, 0x080c,
-- 0x0f69, 0x002e, 0x001e, 0x080c, 0x1016, 0x9006, 0xa802, 0xa806,
-- 0x0804, 0x368d, 0x0126, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6,
-- 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200,
-- 0x2071, 0x1800, 0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c,
-- 0x5a58, 0x0068, 0xd08c, 0x0118, 0x080c, 0x5961, 0x0040, 0xd094,
-- 0x0118, 0x080c, 0x5931, 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe,
-- 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e,
-- 0x012e, 0x0005, 0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a,
-- 0x001e, 0x0c68, 0x7030, 0xd09c, 0x1120, 0x6004, 0x9085, 0x0002,
-- 0x6006, 0x7098, 0x9005, 0x0120, 0x709b, 0x0000, 0x7093, 0x0000,
-- 0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130,
-- 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294, 0xff00,
-- 0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295,
-- 0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c,
-- 0x6119, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140, 0x6042,
-- 0x6043, 0x0000, 0x7087, 0x0000, 0x70a3, 0x0001, 0x70c7, 0x0000,
-- 0x70df, 0x0000, 0x2009, 0x1d80, 0x200b, 0x0000, 0x7097, 0x0000,
-- 0x708b, 0x000f, 0x2009, 0x000f, 0x2011, 0x5ffb, 0x080c, 0x8a5d,
-- 0x0005, 0x2001, 0x1869, 0x2004, 0xd08c, 0x0110, 0x705f, 0xffff,
-- 0x7088, 0x9005, 0x1528, 0x2011, 0x5ffb, 0x080c, 0x8993, 0x6040,
-- 0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044,
-- 0xd08c, 0x1168, 0x1f04, 0x5947, 0x6242, 0x709b, 0x0000, 0x6040,
-- 0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048, 0x6242,
-- 0x709b, 0x0000, 0x708f, 0x0000, 0x9006, 0x080c, 0x61a2, 0x0000,
-- 0x0005, 0x708c, 0x908a, 0x0003, 0x1a0c, 0x0d85, 0x000b, 0x0005,
-- 0x596b, 0x59bc, 0x5a57, 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800,
-- 0x708f, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc,
-- 0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04, 0x597a,
-- 0x080c, 0x0d85, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a,
-- 0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020, 0x080c,
-- 0x617e, 0x2079, 0x1d00, 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1,
-- 0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1d0e, 0x20a9,
-- 0x0004, 0x4003, 0x080c, 0xaaf1, 0x20e1, 0x0001, 0x2099, 0x1d00,
-- 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3,
-- 0x000c, 0x600f, 0x0000, 0x080c, 0x602c, 0x00fe, 0x9006, 0x7092,
-- 0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x7090, 0x7093, 0x0000,
-- 0x9025, 0x0904, 0x5a34, 0x6020, 0xd0b4, 0x1904, 0x5a32, 0x71a0,
-- 0x81ff, 0x0904, 0x5a20, 0x9486, 0x000c, 0x1904, 0x5a2d, 0x9480,
-- 0x0018, 0x8004, 0x20a8, 0x080c, 0x6177, 0x2011, 0x0260, 0x2019,
-- 0x1d00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04,
-- 0x59d9, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f,
-- 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708f, 0x0002, 0x709b,
-- 0x0002, 0x2009, 0x07d0, 0x2011, 0x6002, 0x080c, 0x8a5d, 0x080c,
-- 0x617e, 0x04c0, 0x080c, 0x6177, 0x2079, 0x0260, 0x7930, 0x918e,
-- 0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff,
-- 0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x6177, 0x2011, 0x026e,
-- 0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102, 0x0230,
-- 0x11a0, 0x8210, 0x8318, 0x1f04, 0x5a14, 0x0078, 0x70a3, 0x0000,
-- 0x080c, 0x6177, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001,
-- 0x20a1, 0x1d00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008, 0x6043,
-- 0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100, 0x6042,
-- 0x6020, 0xd0b4, 0x1db8, 0x080c, 0xaaf1, 0x20e1, 0x0001, 0x2099,
-+ 0x0005, 0xa897, 0x4000, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1128,
-+ 0x080c, 0x5846, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001,
-+ 0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904,
-+ 0x461d, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x080c, 0x4c3f, 0x1120,
-+ 0x2009, 0x0002, 0x0804, 0x36bf, 0x080c, 0x6c01, 0x0130, 0x908e,
-+ 0x0004, 0x0118, 0x908e, 0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120,
-+ 0xb800, 0xc08c, 0xb802, 0x0028, 0x080c, 0x583e, 0xd0b4, 0x0904,
-+ 0x4657, 0x7884, 0x908e, 0x007e, 0x0904, 0x4657, 0x908e, 0x007f,
-+ 0x0904, 0x4657, 0x908e, 0x0080, 0x0904, 0x4657, 0xb800, 0xd08c,
-+ 0x1904, 0x4657, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c,
-+ 0xd0d9, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003,
-+ 0x701f, 0x543b, 0x0005, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x0804,
-+ 0x4657, 0x080c, 0x347d, 0x0108, 0x0005, 0x2009, 0x1834, 0x210c,
-+ 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c, 0x5852,
-+ 0x0120, 0x2009, 0x0007, 0x0804, 0x36bf, 0x080c, 0x6bf9, 0x0120,
-+ 0x2009, 0x0008, 0x0804, 0x36bf, 0xb89c, 0xd0a4, 0x1118, 0xd0ac,
-+ 0x1904, 0x4657, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a,
-+ 0x080c, 0xd141, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007,
-+ 0x0003, 0x701f, 0x5474, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120,
-+ 0x2009, 0x0004, 0x0804, 0x578c, 0x080c, 0x4c72, 0x0904, 0x36c2,
-+ 0x0804, 0x540d, 0x81ff, 0x2009, 0x0001, 0x1904, 0x36bf, 0x080c,
-+ 0x5852, 0x2009, 0x0007, 0x1904, 0x36bf, 0x080c, 0x6bf9, 0x0120,
-+ 0x2009, 0x0008, 0x0804, 0x36bf, 0x080c, 0x4c72, 0x0904, 0x36c2,
-+ 0x080c, 0x6c01, 0x2009, 0x0009, 0x1904, 0x36bf, 0x080c, 0x4c3f,
-+ 0x2009, 0x0002, 0x0904, 0x36bf, 0x9006, 0xa866, 0xa832, 0xa868,
-+ 0xc0fd, 0xa86a, 0x7988, 0xa95a, 0x9194, 0xfd00, 0x918c, 0x00ff,
-+ 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952, 0x798c, 0xa956, 0x0038,
-+ 0x928e, 0x0100, 0x1904, 0x36c2, 0xc0e5, 0xa952, 0xa956, 0xa83e,
-+ 0x080c, 0xd3a4, 0x2009, 0x0003, 0x0904, 0x36bf, 0x7007, 0x0003,
-+ 0x701f, 0x54cb, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004,
-+ 0x0904, 0x36bf, 0x0804, 0x368d, 0x7aa8, 0x9284, 0xc000, 0x0148,
-+ 0xd2ec, 0x01a0, 0x080c, 0x5852, 0x1188, 0x2009, 0x0014, 0x0804,
-+ 0x36bf, 0xd2dc, 0x1578, 0x81ff, 0x2009, 0x0001, 0x1904, 0x36bf,
-+ 0x080c, 0x5852, 0x2009, 0x0007, 0x1904, 0x36bf, 0xd2f4, 0x0138,
-+ 0x9284, 0x5000, 0xc0d5, 0x080c, 0x5818, 0x0804, 0x368d, 0xd2fc,
-+ 0x0160, 0x080c, 0x4c72, 0x0904, 0x36c2, 0x7984, 0x9284, 0x9000,
-+ 0xc0d5, 0x080c, 0x57e7, 0x0804, 0x368d, 0x080c, 0x4c72, 0x0904,
-+ 0x36c2, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x2009, 0x0009,
-+ 0x1904, 0x55ba, 0x080c, 0x4c3f, 0x2009, 0x0002, 0x0904, 0x55ba,
-+ 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008, 0x7a8c, 0x7b88,
-+ 0x7c9c, 0x7d98, 0x080c, 0x4c88, 0x701f, 0x5527, 0x0005, 0xa86c,
-+ 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120, 0xa874, 0x9084,
-+ 0xff00, 0x0110, 0x1904, 0x36c2, 0xa866, 0xa832, 0xa868, 0xc0fd,
-+ 0xa86a, 0x080c, 0x4c72, 0x1110, 0x0804, 0x36c2, 0x2009, 0x0043,
-+ 0x080c, 0xd410, 0x2009, 0x0003, 0x0904, 0x55ba, 0x7007, 0x0003,
-+ 0x701f, 0x554b, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004,
-+ 0x0904, 0x55ba, 0x7984, 0x7aa8, 0x9284, 0x1000, 0xc0d5, 0x080c,
-+ 0x57e7, 0x0804, 0x368d, 0x00c6, 0xaab0, 0x9284, 0xc000, 0x0148,
-+ 0xd2ec, 0x0170, 0x080c, 0x5852, 0x1158, 0x2009, 0x0014, 0x0804,
-+ 0x55a9, 0x2061, 0x1800, 0x080c, 0x5852, 0x2009, 0x0007, 0x15c8,
-+ 0xd2f4, 0x0130, 0x9284, 0x5000, 0xc0d5, 0x080c, 0x5818, 0x0058,
-+ 0xd2fc, 0x0180, 0x080c, 0x4c70, 0x0590, 0xa998, 0x9284, 0x9000,
-+ 0xc0d5, 0x080c, 0x57e7, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897,
-+ 0x4000, 0x0438, 0x080c, 0x4c70, 0x0510, 0x080c, 0x6c01, 0x2009,
-+ 0x0009, 0x11b8, 0xa8c4, 0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005,
-+ 0x11b0, 0xa8cc, 0x9084, 0xff00, 0x1190, 0x080c, 0x4c70, 0x1108,
-+ 0x0070, 0x2009, 0x004b, 0x080c, 0xd410, 0x2009, 0x0003, 0x0108,
-+ 0x0078, 0x0431, 0x19c0, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-+ 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ce, 0x0005,
-+ 0x9006, 0x0ce0, 0x7aa8, 0xd2dc, 0x0904, 0x36bf, 0x0016, 0x7984,
-+ 0x9284, 0x1000, 0xc0fd, 0x080c, 0x57e7, 0x001e, 0x1904, 0x36bf,
-+ 0x0804, 0x368d, 0x00f6, 0x2d78, 0xaab0, 0x0021, 0x00fe, 0x0005,
-+ 0xaab0, 0xc2d5, 0xd2dc, 0x0150, 0x0016, 0xa998, 0x9284, 0x1400,
-+ 0xc0fd, 0x080c, 0x57e7, 0x001e, 0x9085, 0x0001, 0x0005, 0x81ff,
-+ 0x0120, 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c, 0x5852, 0x0120,
-+ 0x2009, 0x0007, 0x0804, 0x36bf, 0x7984, 0x7ea8, 0x96b4, 0x00ff,
-+ 0x080c, 0x67ad, 0x1904, 0x36c2, 0x9186, 0x007f, 0x0138, 0x080c,
-+ 0x6c01, 0x0120, 0x2009, 0x0009, 0x0804, 0x36bf, 0x080c, 0x4c3f,
-+ 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf, 0xa867, 0x0000, 0xa868,
-+ 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007, 0xa80a, 0x080c, 0xd0f3,
-+ 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf, 0x7007, 0x0003, 0x701f,
-+ 0x561a, 0x0005, 0xa808, 0x8007, 0x9086, 0x0100, 0x1120, 0x2009,
-+ 0x0004, 0x0804, 0x36bf, 0xa8e0, 0xa866, 0xa810, 0x8007, 0x9084,
-+ 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084, 0x00ff, 0x8004, 0x9080,
-+ 0x0002, 0x9108, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
-+ 0x4c8b, 0x080c, 0x4c3f, 0x1120, 0x2009, 0x0002, 0x0804, 0x36bf,
-+ 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118,
-+ 0x7023, 0x19b4, 0x0040, 0x92c6, 0x0001, 0x1118, 0x7023, 0x19ce,
-+ 0x0010, 0x0804, 0x36c2, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4c88, 0x701f,
-+ 0x566a, 0x0005, 0x2001, 0x182e, 0x2003, 0x0001, 0xa85c, 0x9080,
-+ 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9, 0x001a, 0x7020, 0x20a0,
-+ 0x20e9, 0x0001, 0x4003, 0x0804, 0x368d, 0x080c, 0x4c3f, 0x1120,
-+ 0x2009, 0x0002, 0x0804, 0x36bf, 0x7984, 0x9194, 0xff00, 0x918c,
-+ 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099, 0x19b4, 0x0040, 0x92c6,
-+ 0x0001, 0x1118, 0x2099, 0x19ce, 0x0010, 0x0804, 0x36c2, 0xa85c,
-+ 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8, 0x20a9, 0x001a, 0x20e1,
-+ 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-+ 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804, 0x4c8b, 0x7884, 0x908a,
-+ 0x1000, 0x1a04, 0x36c2, 0x0126, 0x2091, 0x8000, 0x8003, 0x800b,
-+ 0x810b, 0x9108, 0x00c6, 0x2061, 0x1a04, 0x614a, 0x00ce, 0x012e,
-+ 0x0804, 0x368d, 0x00c6, 0x080c, 0x778e, 0x1160, 0x080c, 0x7aa6,
-+ 0x080c, 0x6196, 0x9085, 0x0001, 0x080c, 0x77d2, 0x080c, 0x76bd,
-+ 0x080c, 0x0d85, 0x2061, 0x1800, 0x6030, 0xc09d, 0x6032, 0x080c,
-+ 0x6051, 0x00ce, 0x0005, 0x00c6, 0x2001, 0x1800, 0x2004, 0x908e,
-+ 0x0000, 0x0904, 0x36bf, 0x7884, 0x9005, 0x0188, 0x7888, 0x2061,
-+ 0x199c, 0x2c0c, 0x2062, 0x080c, 0x2a67, 0x01a0, 0x080c, 0x2a6f,
-+ 0x0188, 0x080c, 0x2a77, 0x0170, 0x2162, 0x0804, 0x36c2, 0x2061,
-+ 0x0100, 0x6038, 0x9086, 0x0007, 0x1118, 0x2009, 0x0001, 0x0010,
-+ 0x2009, 0x0000, 0x7884, 0x9086, 0x0002, 0x15a8, 0x2061, 0x0100,
-+ 0x6028, 0xc09c, 0x602a, 0x080c, 0xacec, 0x0026, 0x2011, 0x0003,
-+ 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c, 0xa625, 0x002e, 0x080c,
-+ 0xa506, 0x0036, 0x901e, 0x080c, 0xa586, 0x003e, 0x080c, 0xad08,
-+ 0x60e3, 0x0000, 0x080c, 0xeec0, 0x080c, 0xeedb, 0x9085, 0x0001,
-+ 0x080c, 0x77d2, 0x9006, 0x080c, 0x2a99, 0x2001, 0x1800, 0x2003,
-+ 0x0004, 0x2001, 0x19a8, 0x2003, 0x0000, 0x0026, 0x2011, 0x0008,
-+ 0x080c, 0x2ad3, 0x002e, 0x00ce, 0x0804, 0x368d, 0x81ff, 0x0120,
-+ 0x2009, 0x0001, 0x0804, 0x36bf, 0x080c, 0x5852, 0x0120, 0x2009,
-+ 0x0007, 0x0804, 0x36bf, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c,
-+ 0x67ad, 0x1904, 0x36c2, 0x9186, 0x007f, 0x0138, 0x080c, 0x6c01,
-+ 0x0120, 0x2009, 0x0009, 0x0804, 0x36bf, 0x080c, 0x4c3f, 0x1120,
-+ 0x2009, 0x0002, 0x0804, 0x36bf, 0xa867, 0x0000, 0xa868, 0xc0fd,
-+ 0xa86a, 0x080c, 0xd0f6, 0x1120, 0x2009, 0x0003, 0x0804, 0x36bf,
-+ 0x7007, 0x0003, 0x701f, 0x5775, 0x0005, 0xa830, 0x9086, 0x0100,
-+ 0x1120, 0x2009, 0x0004, 0x0804, 0x36bf, 0xa8e0, 0xa866, 0xa834,
-+ 0x8007, 0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c,
-+ 0x7d98, 0xaf60, 0x0804, 0x4c8b, 0xa898, 0x9086, 0x000d, 0x1904,
-+ 0x36bf, 0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x5799,
-+ 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833,
-+ 0x0011, 0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986,
-+ 0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c, 0x4c7b, 0x2091, 0x4080,
-+ 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x7007, 0x0001,
-+ 0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091,
-+ 0x8000, 0x00c6, 0x2061, 0x1a04, 0x7984, 0x615a, 0x6156, 0x605f,
-+ 0x0000, 0x6053, 0x0009, 0x7898, 0x6072, 0x789c, 0x606e, 0x7888,
-+ 0x606a, 0x788c, 0x6066, 0x2001, 0x1a14, 0x2044, 0x2001, 0x1a1b,
-+ 0xa076, 0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b,
-+ 0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x368d, 0x0126,
-+ 0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0198, 0x0006,
-+ 0xd0d4, 0x0160, 0x0036, 0x2019, 0x0029, 0x080c, 0xacec, 0x0106,
-+ 0x080c, 0x3442, 0x010e, 0x090c, 0xad08, 0x003e, 0x080c, 0xcf55,
-+ 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004, 0x905d,
-+ 0x0160, 0x080c, 0x61b0, 0x080c, 0xb07f, 0x0110, 0xb817, 0x0000,
-+ 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8,
-+ 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e, 0x20a9, 0x0800,
-+ 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0188, 0x9186, 0x007e,
-+ 0x0170, 0x9186, 0x007f, 0x0158, 0x9186, 0x0080, 0x0140, 0x9186,
-+ 0x00ff, 0x0128, 0x0026, 0x2200, 0x080c, 0x57e7, 0x002e, 0x001e,
-+ 0x8108, 0x1f04, 0x5820, 0x015e, 0x012e, 0x0005, 0x2001, 0x1848,
-+ 0x2004, 0x0005, 0x2001, 0x1867, 0x2004, 0x0005, 0x0006, 0x2001,
-+ 0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e, 0x2004,
-+ 0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x0005,
-+ 0x0016, 0x00e6, 0x2071, 0x189e, 0x7108, 0x910d, 0x710a, 0x00ee,
-+ 0x001e, 0x0005, 0x79a4, 0x81ff, 0x0904, 0x36c2, 0x9182, 0x0081,
-+ 0x1a04, 0x36c2, 0x810c, 0x0016, 0x080c, 0x4c3f, 0x0170, 0x080c,
-+ 0x0f61, 0x2100, 0x2238, 0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e,
-+ 0x080c, 0x4c88, 0x701f, 0x5882, 0x0005, 0x001e, 0x2009, 0x0002,
-+ 0x0804, 0x36bf, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac,
-+ 0x79a4, 0x810c, 0x2061, 0x18b8, 0x2c44, 0xa770, 0xa074, 0x2071,
-+ 0x189e, 0x080c, 0x4c8b, 0x701f, 0x5896, 0x0005, 0x2061, 0x18b8,
-+ 0x2c44, 0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0f69, 0x002e,
-+ 0x001e, 0x080c, 0x1016, 0x9006, 0xa802, 0xa806, 0x0804, 0x368d,
-+ 0x0126, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6,
-+ 0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800,
-+ 0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x5a51, 0x0068,
-+ 0xd08c, 0x0118, 0x080c, 0x595a, 0x0040, 0xd094, 0x0118, 0x080c,
-+ 0x592a, 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de,
-+ 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005,
-+ 0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68,
-+ 0x0006, 0x7098, 0x9005, 0x000e, 0x0120, 0x709b, 0x0000, 0x7093,
-+ 0x0000, 0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0,
-+ 0x0130, 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294,
-+ 0xff00, 0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240,
-+ 0x9295, 0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7,
-+ 0x080c, 0x6112, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140,
-+ 0x6042, 0x6043, 0x0000, 0x7087, 0x0000, 0x70a3, 0x0001, 0x70c7,
-+ 0x0000, 0x70df, 0x0000, 0x2009, 0x1d80, 0x200b, 0x0000, 0x7097,
-+ 0x0000, 0x708b, 0x000f, 0x2009, 0x000f, 0x2011, 0x5ff4, 0x080c,
-+ 0x8a4d, 0x0005, 0x2001, 0x1869, 0x2004, 0xd08c, 0x0110, 0x705f,
-+ 0xffff, 0x7088, 0x9005, 0x1528, 0x2011, 0x5ff4, 0x080c, 0x8983,
-+ 0x6040, 0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8,
-+ 0x6044, 0xd08c, 0x1168, 0x1f04, 0x5940, 0x6242, 0x709b, 0x0000,
-+ 0x6040, 0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048,
-+ 0x6242, 0x709b, 0x0000, 0x708f, 0x0000, 0x9006, 0x080c, 0x619b,
-+ 0x0000, 0x0005, 0x708c, 0x908a, 0x0003, 0x1a0c, 0x0d85, 0x000b,
-+ 0x0005, 0x5964, 0x59b5, 0x5a50, 0x00f6, 0x0016, 0x6900, 0x918c,
-+ 0x0800, 0x708f, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803,
-+ 0x00fc, 0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04,
-+ 0x5973, 0x080c, 0x0d85, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898,
-+ 0x689a, 0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020,
-+ 0x080c, 0x6177, 0x2079, 0x1d00, 0x7833, 0x1101, 0x7837, 0x0000,
-+ 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1d0e,
-+ 0x20a9, 0x0004, 0x4003, 0x080c, 0xaae1, 0x20e1, 0x0001, 0x2099,
- 0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003,
-- 0x60c3, 0x000c, 0x2011, 0x19f5, 0x2013, 0x0000, 0x7093, 0x0000,
-- 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa293, 0x08d8, 0x0005,
-- 0x7098, 0x908a, 0x001d, 0x1a0c, 0x0d85, 0x000b, 0x0005, 0x5a89,
-- 0x5a9c, 0x5ac5, 0x5ae5, 0x5b0b, 0x5b3a, 0x5b60, 0x5b98, 0x5bbe,
-- 0x5bec, 0x5c27, 0x5c5f, 0x5c7d, 0x5ca8, 0x5cca, 0x5ce5, 0x5cef,
-- 0x5d23, 0x5d49, 0x5d78, 0x5d9e, 0x5dd6, 0x5e1a, 0x5e57, 0x5e78,
-- 0x5ed1, 0x5ef3, 0x5f21, 0x5f21, 0x00c6, 0x2061, 0x1800, 0x6003,
-- 0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce,
-- 0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061,
-- 0x0100, 0x6043, 0x0002, 0x709b, 0x0001, 0x2009, 0x07d0, 0x2011,
-- 0x6002, 0x080c, 0x8a5d, 0x0005, 0x00f6, 0x7090, 0x9086, 0x0014,
-- 0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x6177, 0x2079,
-- 0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188,
-- 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-- 0x2011, 0x6002, 0x080c, 0x8993, 0x709b, 0x0010, 0x080c, 0x5cef,
-- 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0003,
-- 0x6043, 0x0004, 0x2011, 0x6002, 0x080c, 0x8993, 0x080c, 0x60fb,
-- 0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008,
-- 0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x5ada, 0x60c3,
-- 0x0014, 0x080c, 0x602c, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-- 0x0500, 0x2011, 0x6002, 0x080c, 0x8993, 0x9086, 0x0014, 0x11b8,
-- 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178,
-- 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-- 0x1110, 0x70c7, 0x0001, 0x709b, 0x0004, 0x0029, 0x0010, 0x080c,
-- 0x6153, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0005, 0x080c, 0x60fb,
-- 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x6177,
-- 0x080c, 0x615a, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186,
-- 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5faf, 0x0168, 0x080c,
-- 0x6130, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-- 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x602c,
-- 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x6002,
-- 0x080c, 0x8993, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6177, 0x2079,
-- 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160,
-- 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-- 0x709b, 0x0006, 0x0029, 0x0010, 0x080c, 0x6153, 0x00fe, 0x0005,
-- 0x00f6, 0x709b, 0x0007, 0x080c, 0x60fb, 0x2079, 0x0240, 0x7833,
-- 0x1104, 0x7837, 0x0000, 0x080c, 0x6177, 0x080c, 0x615a, 0x11b8,
-- 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180,
-- 0x348e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c,
-- 0x5faf, 0x0180, 0x080c, 0x512e, 0x0110, 0x080c, 0x26f5, 0x20a9,
-- 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-- 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x602c, 0x00fe, 0x0005,
-- 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x6002, 0x080c, 0x8993,
-- 0x9086, 0x0014, 0x11b8, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30,
-- 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-- 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0008,
-- 0x0029, 0x0010, 0x080c, 0x6153, 0x00fe, 0x0005, 0x00f6, 0x709b,
-- 0x0009, 0x080c, 0x60fb, 0x2079, 0x0240, 0x7833, 0x1105, 0x7837,
-- 0x0100, 0x080c, 0x615a, 0x1150, 0x7084, 0x9005, 0x1138, 0x080c,
-- 0x5f22, 0x1188, 0x9085, 0x0001, 0x080c, 0x26f5, 0x20a9, 0x0008,
-- 0x080c, 0x6177, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-- 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x602c, 0x0010,
-- 0x080c, 0x5a7c, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05a8,
-- 0x2011, 0x6002, 0x080c, 0x8993, 0x9086, 0x0014, 0x1560, 0x080c,
-- 0x6177, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834,
-- 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc,
-- 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x000a,
-- 0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-- 0x9005, 0x1110, 0x70c7, 0x0001, 0x7097, 0x0000, 0x709b, 0x000e,
-- 0x080c, 0x5cca, 0x0010, 0x080c, 0x6153, 0x00fe, 0x0005, 0x00f6,
-- 0x709b, 0x000b, 0x2011, 0x1d0e, 0x20e9, 0x0001, 0x22a0, 0x20a9,
-- 0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x60fb, 0x2079, 0x0240,
-- 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x615a, 0x0118, 0x2013,
-- 0x0000, 0x0020, 0x7060, 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040,
-- 0x2009, 0x024e, 0x2011, 0x1d0e, 0x220e, 0x8210, 0x8108, 0x9186,
-- 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04,
-- 0x5c4c, 0x60c3, 0x0084, 0x080c, 0x602c, 0x00fe, 0x0005, 0x00f6,
-- 0x7090, 0x9005, 0x01c0, 0x2011, 0x6002, 0x080c, 0x8993, 0x9086,
-- 0x0084, 0x1178, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30, 0x9296,
-- 0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x709b, 0x000c, 0x0029,
-- 0x0010, 0x080c, 0x6153, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000d,
-- 0x080c, 0x60fb, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837, 0x0000,
-- 0x080c, 0x6177, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009, 0x024e,
-- 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000,
-- 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260,
-- 0x1f04, 0x5c90, 0x60c3, 0x0084, 0x080c, 0x602c, 0x00fe, 0x0005,
-- 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x6002, 0x080c, 0x8993,
-- 0x9086, 0x0084, 0x1198, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30,
-- 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7097, 0x0001,
-- 0x080c, 0x60cd, 0x709b, 0x000e, 0x0029, 0x0010, 0x080c, 0x6153,
-- 0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x61a2, 0x709b, 0x000f,
-- 0x7093, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5,
-- 0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0,
-- 0x2011, 0x6002, 0x080c, 0x8987, 0x0005, 0x7090, 0x9005, 0x0130,
-- 0x2011, 0x6002, 0x080c, 0x8993, 0x709b, 0x0000, 0x0005, 0x709b,
-- 0x0011, 0x080c, 0xaaf1, 0x080c, 0x6177, 0x20e1, 0x0000, 0x2099,
-- 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x7490, 0x9480, 0x0018,
-- 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c,
-- 0x615a, 0x11a0, 0x717c, 0x81ff, 0x0188, 0x900e, 0x7080, 0x9084,
-- 0x00ff, 0x0160, 0x080c, 0x268c, 0x9186, 0x007e, 0x0138, 0x9186,
-- 0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5faf, 0x60c3, 0x0014,
-- 0x080c, 0x602c, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011,
-- 0x6002, 0x080c, 0x8993, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6177,
-+ 0x60c3, 0x000c, 0x600f, 0x0000, 0x080c, 0x6025, 0x00fe, 0x9006,
-+ 0x7092, 0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x7090, 0x7093,
-+ 0x0000, 0x9025, 0x0904, 0x5a2d, 0x6020, 0xd0b4, 0x1904, 0x5a2b,
-+ 0x71a0, 0x81ff, 0x0904, 0x5a19, 0x9486, 0x000c, 0x1904, 0x5a26,
-+ 0x9480, 0x0018, 0x8004, 0x20a8, 0x080c, 0x6170, 0x2011, 0x0260,
-+ 0x2019, 0x1d00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318,
-+ 0x1f04, 0x59d2, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94,
-+ 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708f, 0x0002,
-+ 0x709b, 0x0002, 0x2009, 0x07d0, 0x2011, 0x5ffb, 0x080c, 0x8a4d,
-+ 0x080c, 0x6177, 0x04c0, 0x080c, 0x6170, 0x2079, 0x0260, 0x7930,
-+ 0x918e, 0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c,
-+ 0x00ff, 0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x6170, 0x2011,
-+ 0x026e, 0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102,
-+ 0x0230, 0x11a0, 0x8210, 0x8318, 0x1f04, 0x5a0d, 0x0078, 0x70a3,
-+ 0x0000, 0x080c, 0x6170, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-+ 0x0001, 0x20a1, 0x1d00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008,
-+ 0x6043, 0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100,
-+ 0x6042, 0x6020, 0xd0b4, 0x1db8, 0x080c, 0xaae1, 0x20e1, 0x0001,
-+ 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014,
-+ 0x4003, 0x60c3, 0x000c, 0x2011, 0x19f5, 0x2013, 0x0000, 0x7093,
-+ 0x0000, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa283, 0x08d8,
-+ 0x0005, 0x7098, 0x908a, 0x001d, 0x1a0c, 0x0d85, 0x000b, 0x0005,
-+ 0x5a82, 0x5a95, 0x5abe, 0x5ade, 0x5b04, 0x5b33, 0x5b59, 0x5b91,
-+ 0x5bb7, 0x5be5, 0x5c20, 0x5c58, 0x5c76, 0x5ca1, 0x5cc3, 0x5cde,
-+ 0x5ce8, 0x5d1c, 0x5d42, 0x5d71, 0x5d97, 0x5dcf, 0x5e13, 0x5e50,
-+ 0x5e71, 0x5eca, 0x5eec, 0x5f1a, 0x5f1a, 0x00c6, 0x2061, 0x1800,
-+ 0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006,
-+ 0x00ce, 0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0,
-+ 0x2061, 0x0100, 0x6043, 0x0002, 0x709b, 0x0001, 0x2009, 0x07d0,
-+ 0x2011, 0x5ffb, 0x080c, 0x8a4d, 0x0005, 0x00f6, 0x7090, 0x9086,
-+ 0x0014, 0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x6170,
-+ 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005,
-+ 0x1188, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-+ 0x0001, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x709b, 0x0010, 0x080c,
-+ 0x5ce8, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
-+ 0x0003, 0x6043, 0x0004, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x080c,
-+ 0x60f4, 0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9,
-+ 0x0008, 0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x5ad3,
-+ 0x60c3, 0x0014, 0x080c, 0x6025, 0x00fe, 0x0005, 0x00f6, 0x7090,
-+ 0x9005, 0x0500, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x9086, 0x0014,
-+ 0x11b8, 0x080c, 0x6170, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102,
-+ 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-+ 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0004, 0x0029, 0x0010,
-+ 0x080c, 0x614c, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0005, 0x080c,
-+ 0x60f4, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c,
-+ 0x6170, 0x080c, 0x6153, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c,
-+ 0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5fa8, 0x0168,
-+ 0x080c, 0x6129, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e,
-+ 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c,
-+ 0x6025, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011,
-+ 0x5ffb, 0x080c, 0x8983, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6170,
- 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005,
- 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-- 0x0001, 0x709b, 0x0012, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe,
-- 0x0005, 0x00f6, 0x709b, 0x0013, 0x080c, 0x6109, 0x2079, 0x0240,
-- 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x6177, 0x080c, 0x615a,
-- 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138,
-- 0x2011, 0x0008, 0x080c, 0x5faf, 0x0168, 0x080c, 0x6130, 0x20a9,
-- 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-- 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x602c, 0x00fe, 0x0005,
-- 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x6002, 0x080c, 0x8993,
-- 0x9086, 0x0014, 0x11b8, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30,
-- 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-- 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0014,
-- 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
-- 0x0015, 0x080c, 0x6109, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837,
-- 0x0000, 0x080c, 0x6177, 0x080c, 0x615a, 0x11b8, 0x7084, 0x9005,
-- 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x348e, 0x200d,
-- 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5faf, 0x0180,
-- 0x080c, 0x512e, 0x0110, 0x080c, 0x26f5, 0x20a9, 0x0008, 0x20e1,
-- 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-- 0x60c3, 0x0014, 0x080c, 0x602c, 0x00fe, 0x0005, 0x00f6, 0x7090,
-- 0x9005, 0x05f0, 0x2011, 0x6002, 0x080c, 0x8993, 0x9086, 0x0014,
-- 0x15a8, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105,
-- 0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1168,
-- 0x9085, 0x0001, 0x080c, 0x61a2, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-- 0x9005, 0x1110, 0x70c7, 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38,
-- 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x9085,
-- 0x0001, 0x080c, 0x61a2, 0x7097, 0x0000, 0x7a38, 0xd2f4, 0x0110,
-- 0x70df, 0x0008, 0x709b, 0x0016, 0x0029, 0x0010, 0x7093, 0x0000,
-- 0x00fe, 0x0005, 0x080c, 0xaaf1, 0x080c, 0x6177, 0x20e1, 0x0000,
-- 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e,
-- 0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011, 0x024d,
-- 0x2012, 0x2011, 0x026e, 0x709b, 0x0017, 0x080c, 0x615a, 0x1150,
-- 0x7084, 0x9005, 0x1138, 0x080c, 0x5f22, 0x1188, 0x9085, 0x0001,
-- 0x080c, 0x26f5, 0x20a9, 0x0008, 0x080c, 0x6177, 0x20e1, 0x0000,
-- 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-- 0x0014, 0x080c, 0x602c, 0x0010, 0x080c, 0x5a7c, 0x0005, 0x00f6,
-- 0x7090, 0x9005, 0x01d8, 0x2011, 0x6002, 0x080c, 0x8993, 0x9086,
-- 0x0084, 0x1190, 0x080c, 0x6177, 0x2079, 0x0260, 0x7a30, 0x9296,
-- 0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c, 0x61a2,
-- 0x709b, 0x0018, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005,
-- 0x00f6, 0x709b, 0x0019, 0x080c, 0x6109, 0x2079, 0x0240, 0x7833,
-- 0x1106, 0x7837, 0x0000, 0x080c, 0x6177, 0x2009, 0x026e, 0x2039,
-- 0x1d0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186, 0x0280,
-- 0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04, 0x5e8b,
-- 0x2039, 0x1d0e, 0x080c, 0x615a, 0x11e8, 0x2728, 0x2514, 0x8207,
-- 0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205,
-- 0x202a, 0x7060, 0x2310, 0x8214, 0x92a0, 0x1d0e, 0x2414, 0x938c,
-- 0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007,
-- 0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e, 0x8738,
-- 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009,
-- 0x0240, 0x1f04, 0x5ebe, 0x60c3, 0x0084, 0x080c, 0x602c, 0x00fe,
-- 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x6002, 0x080c,
-- 0x8993, 0x9086, 0x0084, 0x1198, 0x080c, 0x6177, 0x2079, 0x0260,
-+ 0x0001, 0x709b, 0x0006, 0x0029, 0x0010, 0x080c, 0x614c, 0x00fe,
-+ 0x0005, 0x00f6, 0x709b, 0x0007, 0x080c, 0x60f4, 0x2079, 0x0240,
-+ 0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x6170, 0x080c, 0x6153,
-+ 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180,
-+ 0x9180, 0x348e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008,
-+ 0x080c, 0x5fa8, 0x0180, 0x080c, 0x512c, 0x0110, 0x080c, 0x26f5,
-+ 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-+ 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x6025, 0x00fe,
-+ 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5ffb, 0x080c,
-+ 0x8983, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6170, 0x2079, 0x0260,
-+ 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
-+ 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
-+ 0x0008, 0x0029, 0x0010, 0x080c, 0x614c, 0x00fe, 0x0005, 0x00f6,
-+ 0x709b, 0x0009, 0x080c, 0x60f4, 0x2079, 0x0240, 0x7833, 0x1105,
-+ 0x7837, 0x0100, 0x080c, 0x6153, 0x1150, 0x7084, 0x9005, 0x1138,
-+ 0x080c, 0x5f1b, 0x1188, 0x9085, 0x0001, 0x080c, 0x26f5, 0x20a9,
-+ 0x0008, 0x080c, 0x6170, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-+ 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x6025,
-+ 0x0010, 0x080c, 0x5a75, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-+ 0x05a8, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x9086, 0x0014, 0x1560,
-+ 0x080c, 0x6170, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520,
-+ 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38,
-+ 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
-+ 0x000a, 0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128,
-+ 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x7097, 0x0000, 0x709b,
-+ 0x000e, 0x080c, 0x5cc3, 0x0010, 0x080c, 0x614c, 0x00fe, 0x0005,
-+ 0x00f6, 0x709b, 0x000b, 0x2011, 0x1d0e, 0x20e9, 0x0001, 0x22a0,
-+ 0x20a9, 0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x60f4, 0x2079,
-+ 0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x6153, 0x0118,
-+ 0x2013, 0x0000, 0x0020, 0x7060, 0x9085, 0x0100, 0x2012, 0x20a9,
-+ 0x0040, 0x2009, 0x024e, 0x2011, 0x1d0e, 0x220e, 0x8210, 0x8108,
-+ 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
-+ 0x1f04, 0x5c45, 0x60c3, 0x0084, 0x080c, 0x6025, 0x00fe, 0x0005,
-+ 0x00f6, 0x7090, 0x9005, 0x01c0, 0x2011, 0x5ffb, 0x080c, 0x8983,
-+ 0x9086, 0x0084, 0x1178, 0x080c, 0x6170, 0x2079, 0x0260, 0x7a30,
-+ 0x9296, 0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x709b, 0x000c,
-+ 0x0029, 0x0010, 0x080c, 0x614c, 0x00fe, 0x0005, 0x00f6, 0x709b,
-+ 0x000d, 0x080c, 0x60f4, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837,
-+ 0x0000, 0x080c, 0x6170, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009,
-+ 0x024e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810,
-+ 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011,
-+ 0x0260, 0x1f04, 0x5c89, 0x60c3, 0x0084, 0x080c, 0x6025, 0x00fe,
-+ 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x5ffb, 0x080c,
-+ 0x8983, 0x9086, 0x0084, 0x1198, 0x080c, 0x6170, 0x2079, 0x0260,
- 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7097,
-- 0x0001, 0x080c, 0x60cd, 0x709b, 0x001a, 0x0029, 0x0010, 0x7093,
-- 0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x61a2, 0x709b,
-- 0x001b, 0x080c, 0xaaf1, 0x080c, 0x6177, 0x2011, 0x0260, 0x2009,
-- 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8,
-- 0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150,
-- 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816,
-- 0x2011, 0x0260, 0x1f04, 0x5f0a, 0x60c3, 0x0084, 0x080c, 0x602c,
-- 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1848, 0x252c, 0x20a9,
-- 0x0008, 0x2041, 0x1d0e, 0x20e9, 0x0001, 0x28a0, 0x080c, 0x6177,
-- 0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011,
-- 0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6,
-- 0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04,
-- 0x5f3c, 0x0804, 0x5fab, 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6,
-- 0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5fab, 0x918d,
-- 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019,
-- 0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424, 0x1240,
-- 0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5f62, 0x04d8,
-- 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5f74, 0x2328,
-- 0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007, 0x2200,
-- 0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5f83, 0x755e,
-- 0x95c8, 0x348e, 0x292d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536,
-- 0x0016, 0x2508, 0x080c, 0x26d5, 0x001e, 0x60e7, 0x0000, 0x65ea,
-- 0x2018, 0x2304, 0x9405, 0x201a, 0x7087, 0x0001, 0x20e9, 0x0000,
-- 0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003,
-- 0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005, 0x0156,
-- 0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099,
-- 0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e,
-- 0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001, 0x0007,
-- 0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff,
-- 0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff,
-- 0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528,
-- 0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715e, 0x91a0, 0x348e,
-- 0x242d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508,
-- 0x080c, 0x26d5, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7087, 0x0001,
-- 0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708b, 0x0000,
-- 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140,
-- 0x080c, 0x60bc, 0x080c, 0xa2a0, 0x7004, 0x9084, 0x4000, 0x0110,
-- 0x080c, 0x2aa9, 0x0126, 0x2091, 0x8000, 0x2071, 0x1826, 0x2073,
-- 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c, 0x6119,
-- 0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e,
-- 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x2a04, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011,
-- 0x19f5, 0x2013, 0x0000, 0x7093, 0x0000, 0x012e, 0x60a3, 0x0056,
-- 0x60a7, 0x9575, 0x080c, 0xa293, 0x6144, 0xd184, 0x0120, 0x7198,
-- 0x918d, 0x2000, 0x0018, 0x718c, 0x918d, 0x1000, 0x2011, 0x1999,
-- 0x2112, 0x2009, 0x07d0, 0x2011, 0x6002, 0x080c, 0x8a5d, 0x0005,
-- 0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xacfc,
-- 0x080c, 0xb09b, 0x080c, 0xad18, 0x2009, 0x00f7, 0x080c, 0x6119,
-- 0x2061, 0x1a04, 0x900e, 0x611a, 0x611e, 0x617a, 0x617e, 0x2061,
-- 0x1800, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090, 0x6043,
-- 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011,
-- 0x6088, 0x080c, 0x8987, 0x012e, 0x00ce, 0x002e, 0x001e, 0x0005,
-- 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x0471, 0x2071, 0x0100,
-- 0x080c, 0xa2a0, 0x2071, 0x0140, 0x7004, 0x9084, 0x4000, 0x0110,
-- 0x080c, 0x2aa9, 0x080c, 0x77a6, 0x0188, 0x080c, 0x77c1, 0x1170,
-- 0x080c, 0x7ac0, 0x0016, 0x080c, 0x27a4, 0x2001, 0x196d, 0x2102,
-- 0x001e, 0x080c, 0x7abb, 0x080c, 0x76cd, 0x0050, 0x2009, 0x0001,
-- 0x080c, 0x2a85, 0x2001, 0x0001, 0x080c, 0x2631, 0x080c, 0x6058,
-- 0x012e, 0x000e, 0x00ee, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc,
-- 0x0158, 0x0026, 0x0036, 0x2011, 0x8017, 0x2001, 0x1999, 0x201c,
-- 0x080c, 0x4ca1, 0x003e, 0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9,
-- 0x0001, 0x20a1, 0x1d80, 0x080c, 0x6177, 0x20e9, 0x0000, 0x2099,
-- 0x026e, 0x0099, 0x20a9, 0x0020, 0x080c, 0x6171, 0x2099, 0x0260,
-- 0x20a1, 0x1d92, 0x0051, 0x20a9, 0x000e, 0x080c, 0x6174, 0x2099,
-- 0x0260, 0x20a1, 0x1db2, 0x0009, 0x0005, 0x0016, 0x0026, 0x3410,
-- 0x3308, 0x2104, 0x8007, 0x2012, 0x8108, 0x8210, 0x1f04, 0x60f1,
-- 0x002e, 0x001e, 0x0005, 0x080c, 0xaaf1, 0x20e1, 0x0001, 0x2099,
-- 0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003,
-- 0x0005, 0x080c, 0xaaf1, 0x080c, 0x6177, 0x20e1, 0x0000, 0x2099,
-- 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003,
-- 0x0005, 0x00c6, 0x0006, 0x2061, 0x0100, 0x810f, 0x2001, 0x1834,
-- 0x2004, 0x9005, 0x1138, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
-- 0x9105, 0x0010, 0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005,
-- 0x0016, 0x0046, 0x080c, 0x6c0d, 0x0158, 0x9006, 0x2020, 0x2009,
-- 0x002a, 0x080c, 0xea8d, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102,
-- 0x2019, 0x002a, 0x900e, 0x080c, 0x32da, 0x080c, 0xd645, 0x0140,
-- 0x0036, 0x2019, 0xffff, 0x2021, 0x0007, 0x080c, 0x4e58, 0x003e,
-- 0x004e, 0x001e, 0x0005, 0x080c, 0x6058, 0x709b, 0x0000, 0x7093,
-- 0x0000, 0x0005, 0x0006, 0x2001, 0x180c, 0x2004, 0xd09c, 0x0100,
-- 0x000e, 0x0005, 0x0006, 0x0016, 0x0126, 0x2091, 0x8000, 0x2001,
-- 0x0101, 0x200c, 0x918d, 0x0006, 0x2102, 0x012e, 0x001e, 0x000e,
-- 0x0005, 0x2009, 0x0001, 0x0020, 0x2009, 0x0002, 0x0008, 0x900e,
-- 0x6814, 0x9084, 0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6, 0x0156,
-- 0x0146, 0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1,
-- 0x1d00, 0x4004, 0x2079, 0x1d00, 0x7803, 0x2200, 0x7807, 0x00ef,
-- 0x780f, 0x00ef, 0x7813, 0x0138, 0x7823, 0xffff, 0x7827, 0xffff,
-- 0x01de, 0x014e, 0x015e, 0x00fe, 0x0005, 0x2001, 0x1800, 0x2003,
-- 0x0001, 0x0005, 0x2001, 0x19a7, 0x0118, 0x2003, 0x0001, 0x0010,
-- 0x2003, 0x0000, 0x0005, 0x0156, 0x20a9, 0x0800, 0x2009, 0x1000,
-- 0x9006, 0x200a, 0x8108, 0x1f04, 0x61b1, 0x015e, 0x0005, 0x00d6,
-- 0x0036, 0x0156, 0x0136, 0x0146, 0x2069, 0x1847, 0x9006, 0xb802,
-- 0xb8d6, 0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198, 0x348e,
-- 0x231d, 0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026, 0xb886, 0x080c,
-- 0xb094, 0x1120, 0x9192, 0x007e, 0x1208, 0xbb86, 0x20a9, 0x0004,
-- 0xb8c4, 0x20e8, 0xb9c8, 0x9198, 0x0006, 0x9006, 0x23a0, 0x4004,
-- 0x20a9, 0x0004, 0x9198, 0x000a, 0x23a0, 0x4004, 0x002e, 0x001e,
-- 0xb83e, 0xb842, 0xb8ce, 0xb8d2, 0xb85e, 0xb862, 0xb866, 0xb86a,
-- 0xb86f, 0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893,
-- 0x0008, 0xb896, 0xb89a, 0xb89e, 0xb8be, 0xb9a2, 0x0096, 0xb8a4,
-- 0x904d, 0x0110, 0x080c, 0x108b, 0xb8a7, 0x0000, 0x009e, 0x9006,
-- 0xb84a, 0x6810, 0xb83a, 0x680c, 0xb846, 0xb8bb, 0x0520, 0xb8ac,
-- 0x9005, 0x0198, 0x00c6, 0x2060, 0x9c82, 0x1ddc, 0x0a0c, 0x0d85,
-- 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0d85, 0x080c, 0x8eee,
-- 0x00ce, 0x090c, 0x928d, 0xb8af, 0x0000, 0x6814, 0x9084, 0x00ff,
-- 0xb842, 0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126,
-- 0x2091, 0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000,
-- 0x1a04, 0x628d, 0x9182, 0x0800, 0x1a04, 0x6291, 0x2001, 0x180c,
-- 0x2004, 0x9084, 0x0003, 0x1904, 0x6297, 0x9188, 0x1000, 0x2104,
-- 0x905d, 0x0198, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1188,
-- 0xb8a4, 0x900d, 0x1904, 0x62a9, 0x080c, 0x6669, 0x9006, 0x012e,
-- 0x0005, 0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e,
-- 0x0498, 0x9082, 0x0006, 0x1290, 0x080c, 0xb094, 0x1160, 0xb8a0,
-- 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0d10, 0x2001, 0x0029,
-- 0x2009, 0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c,
-- 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118,
-- 0x2001, 0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118,
-- 0x2009, 0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e,
-- 0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001,
-- 0x180c, 0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x9065,
-- 0x09a8, 0x080c, 0x6c11, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804,
-- 0x6250, 0x080c, 0x6a2a, 0x0904, 0x6259, 0x0804, 0x6254, 0x00e6,
-- 0x2071, 0x19e8, 0x7004, 0x9086, 0x0002, 0x1128, 0x7030, 0x9080,
-- 0x0004, 0x2004, 0x9b06, 0x00ee, 0x0005, 0x00b6, 0x00e6, 0x0126,
-- 0x2091, 0x8000, 0xa874, 0x908e, 0x00ff, 0x1120, 0x2001, 0x196b,
-- 0x205c, 0x0060, 0xa974, 0x9182, 0x0800, 0x1690, 0x9188, 0x1000,
-- 0x2104, 0x905d, 0x01d0, 0x080c, 0x6bb1, 0x11d0, 0x080c, 0xb116,
-- 0x0570, 0x2b00, 0x6012, 0x2900, 0x6016, 0x6023, 0x0009, 0x602b,
-- 0x0000, 0xa874, 0x908e, 0x00ff, 0x1110, 0x602b, 0x8000, 0x2009,
-- 0x0043, 0x080c, 0xb20a, 0x9006, 0x00b0, 0x2001, 0x0028, 0x0090,
-- 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038,
-- 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x0010,
-- 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001,
-- 0x002c, 0x0cc0, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa974,
-- 0x9182, 0x0800, 0x1a04, 0x6388, 0x9188, 0x1000, 0x2104, 0x905d,
-- 0x0904, 0x6360, 0xb8a0, 0x9086, 0x007f, 0x0190, 0xa87c, 0xd0fc,
-- 0x1178, 0x080c, 0x6c19, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e,
-- 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6c11, 0x1598,
-- 0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026,
-- 0x2010, 0x080c, 0xcf09, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804,
-- 0x638a, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804,
-- 0x638a, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c,
-- 0xb116, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff,
-- 0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0xb20a, 0x9006, 0x0458,
-- 0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0xb094,
-- 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900,
-- 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090,
-- 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050,
-- 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010,
-- 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001,
-- 0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0,
-- 0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005,
-- 0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800,
-- 0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98,
-- 0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118,
-- 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010,
-- 0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
-- 0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be,
-- 0x00fe, 0x0005, 0x641f, 0x63da, 0x63f1, 0x641f, 0x641f, 0x641f,
-- 0x641f, 0x641f, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x6749,
-- 0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x6427, 0xb814, 0x9206,
-- 0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x4b54, 0x0150,
-- 0x04b0, 0x080c, 0x67b4, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814,
-- 0x9206, 0x1568, 0x080c, 0xb116, 0x0530, 0x2b00, 0x6012, 0x080c,
-- 0xd3b6, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878,
-- 0x9086, 0x0001, 0x1170, 0x080c, 0x3315, 0x9006, 0x080c, 0x66e6,
-- 0x2001, 0x0002, 0x080c, 0x66fa, 0x2001, 0x0200, 0xb86e, 0xb893,
-- 0x0002, 0x2009, 0x0003, 0x080c, 0xb20a, 0x9006, 0x0068, 0x2001,
-- 0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001,
-- 0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005,
-- 0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6,
-- 0x0015, 0x0904, 0x6612, 0x90c6, 0x0056, 0x0904, 0x6616, 0x90c6,
-- 0x0066, 0x0904, 0x661a, 0x90c6, 0x0067, 0x0904, 0x661e, 0x90c6,
-- 0x0068, 0x0904, 0x6622, 0x90c6, 0x0071, 0x0904, 0x6626, 0x90c6,
-- 0x0074, 0x0904, 0x662a, 0x90c6, 0x007c, 0x0904, 0x662e, 0x90c6,
-- 0x007e, 0x0904, 0x6632, 0x90c6, 0x0037, 0x0904, 0x6636, 0x9016,
-- 0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x660d, 0x9182,
-- 0x0800, 0x1a04, 0x660d, 0x080c, 0x67b4, 0x1198, 0xb804, 0x9084,
-- 0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148,
-- 0x080c, 0xb094, 0x1904, 0x65f6, 0xb8a0, 0x9084, 0xff80, 0x1904,
-- 0x65f6, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904,
-- 0x6556, 0x90c6, 0x0064, 0x0904, 0x657f, 0x2008, 0x0804, 0x6518,
-- 0xa998, 0xa8b0, 0x2040, 0x080c, 0xb094, 0x1120, 0x9182, 0x007f,
-- 0x0a04, 0x6518, 0x9186, 0x00ff, 0x0904, 0x6518, 0x9182, 0x0800,
-- 0x1a04, 0x6518, 0xaaa0, 0xab9c, 0x787c, 0x9306, 0x11a8, 0x7880,
-- 0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x6518,
-- 0x080c, 0xb094, 0x1140, 0x99cc, 0xff00, 0x009e, 0x1128, 0x2208,
-- 0x2310, 0x0804, 0x6518, 0x009e, 0x080c, 0x4b54, 0x0904, 0x6522,
-- 0x900e, 0x9016, 0x90c6, 0x4000, 0x15e0, 0x0006, 0x080c, 0x6aae,
-- 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0,
-- 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0fd6, 0x20a9, 0x0004,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c4, 0x20e0,
-- 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0fd6, 0xa8c4, 0xabc8,
-- 0x9305, 0xabcc, 0x9305, 0xabd0, 0x9305, 0xabd4, 0x9305, 0xabd8,
-- 0x9305, 0xabdc, 0x9305, 0xabe0, 0x9305, 0x9005, 0x0510, 0x000e,
-- 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x00a0, 0x90c6, 0x4008,
-- 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6, 0x4009, 0x1108, 0x0050,
-- 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005, 0x2009, 0x000a, 0x0010,
-- 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e, 0x2001, 0x0030, 0x900e,
-- 0x0478, 0x000e, 0x080c, 0xb116, 0x1130, 0x2001, 0x4005, 0x2009,
-- 0x0003, 0x9016, 0x0c78, 0x2b00, 0x6012, 0x080c, 0xd3b6, 0x2900,
-- 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108, 0xc0f5, 0xa86a,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x3315, 0x012e, 0x9006, 0x080c,
-- 0x66e6, 0x2001, 0x0002, 0x080c, 0x66fa, 0x2009, 0x0002, 0x080c,
-- 0xb20a, 0xa8b0, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6, 0x9006,
-- 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x080c, 0x5854,
-- 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0, 0x080c, 0x67b4,
-- 0x1904, 0x6513, 0x9186, 0x007f, 0x0130, 0x080c, 0x6c11, 0x0118,
-- 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x1059, 0x1120, 0x009e,
-- 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806, 0x080c, 0xd109,
-- 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x651a, 0xa998,
-- 0xaeb0, 0x080c, 0x67b4, 0x1904, 0x6513, 0x0096, 0x080c, 0x1059,
-- 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x65d3, 0x2900, 0x009e,
-- 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8,
-- 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
-- 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbc8, 0x9398, 0x0006,
-- 0x2398, 0x080c, 0x0fd6, 0x009e, 0xa87b, 0x0000, 0xa883, 0x0000,
-- 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x5840, 0xd0b4, 0x1118,
-- 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118, 0xa89b, 0x000c,
-- 0x00b0, 0x080c, 0x6c11, 0x0118, 0xa89b, 0x0009, 0x0080, 0x080c,
-- 0x5854, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c, 0xd0ec, 0x1904,
-- 0x654f, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x651a, 0xa87b,
-- 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006, 0x8007, 0x90bc,
-- 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0,
-- 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x12a8, 0x080c,
-- 0xb691, 0x1904, 0x654f, 0x2009, 0x0002, 0x08e8, 0x2001, 0x0028,
-- 0x900e, 0x0804, 0x6550, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118,
-- 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010,
-- 0x2001, 0x0029, 0x900e, 0x0804, 0x6550, 0x2001, 0x0029, 0x900e,
-- 0x0804, 0x6550, 0x080c, 0x38c0, 0x0804, 0x6551, 0x080c, 0x555d,
-- 0x0804, 0x6551, 0x080c, 0x46d5, 0x0804, 0x6551, 0x080c, 0x474e,
-- 0x0804, 0x6551, 0x080c, 0x47aa, 0x0804, 0x6551, 0x080c, 0x4c17,
-- 0x0804, 0x6551, 0x080c, 0x4edf, 0x0804, 0x6551, 0x080c, 0x51c4,
-- 0x0804, 0x6551, 0x080c, 0x53bd, 0x0804, 0x6551, 0x080c, 0x3afe,
-- 0x0804, 0x6551, 0x00b6, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082,
-- 0x4000, 0x1608, 0x9182, 0x0800, 0x1258, 0x9188, 0x1000, 0x2104,
-- 0x905d, 0x0130, 0x080c, 0x6c11, 0x1138, 0x00d9, 0x9006, 0x00b0,
-- 0x2001, 0x0028, 0x900e, 0x0090, 0x9082, 0x0006, 0x1240, 0xb900,
-- 0xd1fc, 0x0d98, 0x2001, 0x0029, 0x2009, 0x1000, 0x0038, 0x2001,
-- 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x00be,
-- 0x0005, 0xa877, 0x0000, 0xb8d0, 0x9005, 0x1904, 0x66da, 0xb888,
-- 0x9005, 0x1904, 0x66da, 0xb838, 0xb93c, 0x9102, 0x1a04, 0x66da,
-- 0x2b10, 0x080c, 0xb143, 0x0904, 0x66d6, 0x8108, 0xb93e, 0x6212,
-- 0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007, 0x0040,
-- 0xa878, 0x605e, 0xa880, 0x6066, 0xa883, 0x0000, 0xa87c, 0xd0ac,
-- 0x05b8, 0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1560, 0x2011, 0x180d,
-- 0x2214, 0xd28c, 0x190c, 0x6cd6, 0xa816, 0xa864, 0x9094, 0x00f7,
-- 0x9296, 0x0011, 0x11f8, 0x9084, 0x00ff, 0xc0bd, 0x601e, 0xa8ac,
-- 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x000f, 0x8001, 0x1df0, 0x2001,
-- 0x8004, 0x6003, 0x0004, 0x6046, 0x00f6, 0x2079, 0x0380, 0x7818,
-- 0xd0bc, 0x1de8, 0x7833, 0x0010, 0x2c00, 0x7836, 0x781b, 0x8080,
-- 0x00fe, 0x0005, 0x080c, 0x17ad, 0x601c, 0xc0bd, 0x601e, 0x0c38,
-- 0x2009, 0x180d, 0x210c, 0xd18c, 0x190c, 0x6ce0, 0xd0b4, 0x190c,
-- 0x1c9c, 0x2001, 0x8004, 0x6003, 0x0002, 0x08e8, 0x81ff, 0x1110,
-- 0xb88b, 0x0001, 0x2908, 0xb8cc, 0xb9ce, 0x9005, 0x1110, 0xb9d2,
-- 0x0020, 0x0096, 0x2048, 0xa902, 0x009e, 0x0005, 0x00b6, 0x0126,
-- 0x00c6, 0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005,
-- 0x0110, 0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e,
-- 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210,
-- 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac,
-- 0x0158, 0x080c, 0x6c0d, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086,
-- 0x0007, 0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215,
-- 0xba06, 0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c,
-- 0x0d85, 0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126,
-- 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086,
-- 0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6c09, 0x1138,
-- 0x9284, 0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e,
-- 0x9294, 0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be,
-- 0x0005, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6,
-- 0x0026, 0x9190, 0x1000, 0x2204, 0x905d, 0x1188, 0x0096, 0x080c,
-- 0x1059, 0x2958, 0x009e, 0x0168, 0x2b00, 0x2012, 0xb85c, 0xb8ca,
-- 0xb860, 0xb8c6, 0x9006, 0xb8a6, 0xb8ae, 0x080c, 0x61b7, 0x9006,
-- 0x0010, 0x9085, 0x0001, 0x002e, 0x00de, 0x0005, 0x00b6, 0x0096,
-- 0x0126, 0x2091, 0x8000, 0x0026, 0x9182, 0x0800, 0x0218, 0x9085,
-- 0x0001, 0x04a8, 0x00d6, 0x9190, 0x1000, 0x2204, 0x905d, 0x0568,
-- 0x2013, 0x0000, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x108b, 0x00d6,
-- 0x00c6, 0xb8bc, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006, 0x6014,
-- 0x2048, 0x080c, 0xcf1b, 0x0110, 0x080c, 0x100b, 0x080c, 0xb16c,
-- 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x00c6, 0xb8ac, 0x9065, 0x0128,
-- 0x621c, 0xd2c4, 0x0110, 0x080c, 0x928d, 0x00ce, 0x2b48, 0xb8c8,
-- 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x109b, 0x00de, 0x9006, 0x002e,
-- 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182, 0x0800, 0x0218,
-- 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104, 0x905d, 0x0dc0,
-- 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146, 0x9006,
-- 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c, 0x779e, 0x1510,
-- 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xb094, 0x11d8, 0x0078,
-- 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982, 0x7048, 0x2062,
-- 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e, 0x00ce, 0x703c,
-- 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001, 0x6886, 0x2069,
-- 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862, 0x704c, 0xb866,
-- 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8, 0xb8c8, 0x9088,
-- 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099, 0x027a, 0x9088,
-- 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069, 0x0200, 0x6817,
-- 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048, 0xb872, 0x7050,
-- 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0, 0x9086, 0x007e,
-- 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218, 0x2009, 0x0008,
-- 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0, 0x9182,
-- 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182, 0x0349, 0x1218,
-- 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218, 0x2009, 0x0004,
-- 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010, 0x2009,
-- 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005, 0x0016,
-- 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896, 0x703c, 0xb89a,
-- 0x7054, 0xb89e, 0x0036, 0xbbd4, 0xc384, 0xba00, 0x2009, 0x1867,
-- 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad, 0x0008, 0xc2ac,
-- 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc, 0x0128, 0xd38c,
-- 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbd6, 0x003e, 0x00ee,
-- 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4,
-- 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04, 0x9282, 0x0010,
-- 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906, 0x8006, 0x8007,
-- 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080, 0x0004, 0x2098,
-- 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086, 0xffff, 0x0120,
-- 0x8109, 0x1dd0, 0x080c, 0x0d85, 0x3c00, 0x20e8, 0x3300, 0x8001,
-- 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce, 0x014e, 0x013e,
-- 0x0060, 0x080c, 0x1059, 0x0170, 0x2900, 0xb8a6, 0xa803, 0x0000,
-- 0x080c, 0x6a4a, 0xa807, 0x0001, 0xae12, 0x9085, 0x0001, 0x012e,
-- 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091, 0x8000, 0x0096,
-- 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150, 0x080c, 0x6a59,
-- 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001, 0xa806, 0x0020,
-- 0x080c, 0x108b, 0xb8a7, 0x0000, 0x009e, 0x012e, 0x0005, 0x0096,
-- 0x00c6, 0xb888, 0x9005, 0x1904, 0x693f, 0xb8d0, 0x904d, 0x0904,
-- 0x693f, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001,
-- 0x1904, 0x693d, 0x080c, 0xb143, 0x0904, 0x693d, 0x8210, 0xba3e,
-+ 0x0001, 0x080c, 0x60c6, 0x709b, 0x000e, 0x0029, 0x0010, 0x080c,
-+ 0x614c, 0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x619b, 0x709b,
-+ 0x000f, 0x7093, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f,
-+ 0xb5b5, 0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009,
-+ 0x07d0, 0x2011, 0x5ffb, 0x080c, 0x8977, 0x0005, 0x7090, 0x9005,
-+ 0x0130, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x709b, 0x0000, 0x0005,
-+ 0x709b, 0x0011, 0x080c, 0xaae1, 0x080c, 0x6170, 0x20e1, 0x0000,
-+ 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x7490, 0x9480,
-+ 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003,
-+ 0x080c, 0x6153, 0x11a0, 0x717c, 0x81ff, 0x0188, 0x900e, 0x7080,
-+ 0x9084, 0x00ff, 0x0160, 0x080c, 0x268c, 0x9186, 0x007e, 0x0138,
-+ 0x9186, 0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5fa8, 0x60c3,
-+ 0x0014, 0x080c, 0x6025, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500,
-+ 0x2011, 0x5ffb, 0x080c, 0x8983, 0x9086, 0x0014, 0x11b8, 0x080c,
-+ 0x6170, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834,
-+ 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
-+ 0x70c7, 0x0001, 0x709b, 0x0012, 0x0029, 0x0010, 0x7093, 0x0000,
-+ 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0013, 0x080c, 0x6102, 0x2079,
-+ 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x6170, 0x080c,
-+ 0x6153, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff,
-+ 0x0138, 0x2011, 0x0008, 0x080c, 0x5fa8, 0x0168, 0x080c, 0x6129,
-+ 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-+ 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x6025, 0x00fe,
-+ 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5ffb, 0x080c,
-+ 0x8983, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6170, 0x2079, 0x0260,
-+ 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
-+ 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
-+ 0x0014, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6,
-+ 0x709b, 0x0015, 0x080c, 0x6102, 0x2079, 0x0240, 0x7833, 0x1104,
-+ 0x7837, 0x0000, 0x080c, 0x6170, 0x080c, 0x6153, 0x11b8, 0x7084,
-+ 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x348e,
-+ 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5fa8,
-+ 0x0180, 0x080c, 0x512c, 0x0110, 0x080c, 0x26f5, 0x20a9, 0x0008,
-+ 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
-+ 0x4003, 0x60c3, 0x0014, 0x080c, 0x6025, 0x00fe, 0x0005, 0x00f6,
-+ 0x7090, 0x9005, 0x05f0, 0x2011, 0x5ffb, 0x080c, 0x8983, 0x9086,
-+ 0x0014, 0x15a8, 0x080c, 0x6170, 0x2079, 0x0260, 0x7a30, 0x9296,
-+ 0x1105, 0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e,
-+ 0x1168, 0x9085, 0x0001, 0x080c, 0x619b, 0x7a38, 0xd2fc, 0x0128,
-+ 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x0080, 0x9005, 0x11b8,
-+ 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-+ 0x9085, 0x0001, 0x080c, 0x619b, 0x7097, 0x0000, 0x7a38, 0xd2f4,
-+ 0x0110, 0x70df, 0x0008, 0x709b, 0x0016, 0x0029, 0x0010, 0x7093,
-+ 0x0000, 0x00fe, 0x0005, 0x080c, 0xaae1, 0x080c, 0x6170, 0x20e1,
-+ 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
-+ 0x000e, 0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011,
-+ 0x024d, 0x2012, 0x2011, 0x026e, 0x709b, 0x0017, 0x080c, 0x6153,
-+ 0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5f1b, 0x1188, 0x9085,
-+ 0x0001, 0x080c, 0x26f5, 0x20a9, 0x0008, 0x080c, 0x6170, 0x20e1,
-+ 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-+ 0x60c3, 0x0014, 0x080c, 0x6025, 0x0010, 0x080c, 0x5a75, 0x0005,
-+ 0x00f6, 0x7090, 0x9005, 0x01d8, 0x2011, 0x5ffb, 0x080c, 0x8983,
-+ 0x9086, 0x0084, 0x1190, 0x080c, 0x6170, 0x2079, 0x0260, 0x7a30,
-+ 0x9296, 0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c,
-+ 0x619b, 0x709b, 0x0018, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe,
-+ 0x0005, 0x00f6, 0x709b, 0x0019, 0x080c, 0x6102, 0x2079, 0x0240,
-+ 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x6170, 0x2009, 0x026e,
-+ 0x2039, 0x1d0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186,
-+ 0x0280, 0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04,
-+ 0x5e84, 0x2039, 0x1d0e, 0x080c, 0x6153, 0x11e8, 0x2728, 0x2514,
-+ 0x8207, 0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007,
-+ 0x9205, 0x202a, 0x7060, 0x2310, 0x8214, 0x92a0, 0x1d0e, 0x2414,
-+ 0x938c, 0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff,
-+ 0x8007, 0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e,
-+ 0x8738, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812,
-+ 0x2009, 0x0240, 0x1f04, 0x5eb7, 0x60c3, 0x0084, 0x080c, 0x6025,
-+ 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x5ffb,
-+ 0x080c, 0x8983, 0x9086, 0x0084, 0x1198, 0x080c, 0x6170, 0x2079,
-+ 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140,
-+ 0x7097, 0x0001, 0x080c, 0x60c6, 0x709b, 0x001a, 0x0029, 0x0010,
-+ 0x7093, 0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x619b,
-+ 0x709b, 0x001b, 0x080c, 0xaae1, 0x080c, 0x6170, 0x2011, 0x0260,
-+ 0x2009, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084,
-+ 0x03f8, 0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260,
-+ 0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000,
-+ 0x6816, 0x2011, 0x0260, 0x1f04, 0x5f03, 0x60c3, 0x0084, 0x080c,
-+ 0x6025, 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1848, 0x252c,
-+ 0x20a9, 0x0008, 0x2041, 0x1d0e, 0x20e9, 0x0001, 0x28a0, 0x080c,
-+ 0x6170, 0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008,
-+ 0x2011, 0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c,
-+ 0x91a6, 0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211,
-+ 0x1f04, 0x5f35, 0x0804, 0x5fa4, 0x82ff, 0x1160, 0xd5d4, 0x0120,
-+ 0x91a6, 0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5fa4,
-+ 0x918d, 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110,
-+ 0x2019, 0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424,
-+ 0x1240, 0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5f5b,
-+ 0x04d8, 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5f6d,
-+ 0x2328, 0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007,
-+ 0x2200, 0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5f7c,
-+ 0x755e, 0x95c8, 0x348e, 0x292d, 0x95ac, 0x00ff, 0x7582, 0x6532,
-+ 0x6536, 0x0016, 0x2508, 0x080c, 0x26d5, 0x001e, 0x60e7, 0x0000,
-+ 0x65ea, 0x2018, 0x2304, 0x9405, 0x201a, 0x7087, 0x0001, 0x20e9,
-+ 0x0000, 0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008,
-+ 0x4003, 0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005,
-+ 0x0156, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000,
-+ 0x2099, 0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003,
-+ 0x014e, 0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001,
-+ 0x0007, 0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118,
-+ 0x84ff, 0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001,
-+ 0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e,
-+ 0x9528, 0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715e, 0x91a0,
-+ 0x348e, 0x242d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016,
-+ 0x2508, 0x080c, 0x26d5, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7087,
-+ 0x0001, 0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708b,
-+ 0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071,
-+ 0x0140, 0x080c, 0x60b5, 0x080c, 0xa290, 0x7004, 0x9084, 0x4000,
-+ 0x0110, 0x080c, 0x2aa9, 0x0126, 0x2091, 0x8000, 0x2071, 0x1826,
-+ 0x2073, 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c,
-+ 0x6112, 0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42,
-+ 0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x2a04, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
-+ 0x2011, 0x19f5, 0x2013, 0x0000, 0x7093, 0x0000, 0x012e, 0x60a3,
-+ 0x0056, 0x60a7, 0x9575, 0x080c, 0xa283, 0x6144, 0xd184, 0x0120,
-+ 0x7198, 0x918d, 0x2000, 0x0018, 0x718c, 0x918d, 0x1000, 0x2011,
-+ 0x1999, 0x2112, 0x2009, 0x07d0, 0x2011, 0x5ffb, 0x080c, 0x8a4d,
-+ 0x0005, 0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xacec, 0x080c, 0xb086, 0x080c, 0xad08, 0x2009, 0x00f7, 0x080c,
-+ 0x6112, 0x2061, 0x1a04, 0x900e, 0x611a, 0x611e, 0x617a, 0x617e,
-+ 0x2061, 0x1800, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090,
-+ 0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d,
-+ 0x2011, 0x6081, 0x080c, 0x8977, 0x012e, 0x00ce, 0x002e, 0x001e,
-+ 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x0471, 0x2071,
-+ 0x0100, 0x080c, 0xa290, 0x2071, 0x0140, 0x7004, 0x9084, 0x4000,
-+ 0x0110, 0x080c, 0x2aa9, 0x080c, 0x7796, 0x0188, 0x080c, 0x77b1,
-+ 0x1170, 0x080c, 0x7ab0, 0x0016, 0x080c, 0x27a4, 0x2001, 0x196d,
-+ 0x2102, 0x001e, 0x080c, 0x7aab, 0x080c, 0x76bd, 0x0050, 0x2009,
-+ 0x0001, 0x080c, 0x2a85, 0x2001, 0x0001, 0x080c, 0x2631, 0x080c,
-+ 0x6051, 0x012e, 0x000e, 0x00ee, 0x0005, 0x2001, 0x180e, 0x2004,
-+ 0xd0bc, 0x0158, 0x0026, 0x0036, 0x2011, 0x8017, 0x2001, 0x1999,
-+ 0x201c, 0x080c, 0x4c9f, 0x003e, 0x002e, 0x0005, 0x20a9, 0x0012,
-+ 0x20e9, 0x0001, 0x20a1, 0x1d80, 0x080c, 0x6170, 0x20e9, 0x0000,
-+ 0x2099, 0x026e, 0x0099, 0x20a9, 0x0020, 0x080c, 0x616a, 0x2099,
-+ 0x0260, 0x20a1, 0x1d92, 0x0051, 0x20a9, 0x000e, 0x080c, 0x616d,
-+ 0x2099, 0x0260, 0x20a1, 0x1db2, 0x0009, 0x0005, 0x0016, 0x0026,
-+ 0x3410, 0x3308, 0x2104, 0x8007, 0x2012, 0x8108, 0x8210, 0x1f04,
-+ 0x60ea, 0x002e, 0x001e, 0x0005, 0x080c, 0xaae1, 0x20e1, 0x0001,
-+ 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c,
-+ 0x4003, 0x0005, 0x080c, 0xaae1, 0x080c, 0x6170, 0x20e1, 0x0000,
-+ 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c,
-+ 0x4003, 0x0005, 0x00c6, 0x0006, 0x2061, 0x0100, 0x810f, 0x2001,
-+ 0x1834, 0x2004, 0x9005, 0x1138, 0x2001, 0x1818, 0x2004, 0x9084,
-+ 0x00ff, 0x9105, 0x0010, 0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce,
-+ 0x0005, 0x0016, 0x0046, 0x080c, 0x6bfd, 0x0158, 0x9006, 0x2020,
-+ 0x2009, 0x002a, 0x080c, 0xea74, 0x2001, 0x180c, 0x200c, 0xc195,
-+ 0x2102, 0x2019, 0x002a, 0x900e, 0x080c, 0x32da, 0x080c, 0xd632,
-+ 0x0140, 0x0036, 0x2019, 0xffff, 0x2021, 0x0007, 0x080c, 0x4e56,
-+ 0x003e, 0x004e, 0x001e, 0x0005, 0x080c, 0x6051, 0x709b, 0x0000,
-+ 0x7093, 0x0000, 0x0005, 0x0006, 0x2001, 0x180c, 0x2004, 0xd09c,
-+ 0x0100, 0x000e, 0x0005, 0x0006, 0x0016, 0x0126, 0x2091, 0x8000,
-+ 0x2001, 0x0101, 0x200c, 0x918d, 0x0006, 0x2102, 0x012e, 0x001e,
-+ 0x000e, 0x0005, 0x2009, 0x0001, 0x0020, 0x2009, 0x0002, 0x0008,
-+ 0x900e, 0x6814, 0x9084, 0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6,
-+ 0x0156, 0x0146, 0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001,
-+ 0x20a1, 0x1d00, 0x4004, 0x2079, 0x1d00, 0x7803, 0x2200, 0x7807,
-+ 0x00ef, 0x780f, 0x00ef, 0x7813, 0x0138, 0x7823, 0xffff, 0x7827,
-+ 0xffff, 0x01de, 0x014e, 0x015e, 0x00fe, 0x0005, 0x2001, 0x1800,
-+ 0x2003, 0x0001, 0x0005, 0x2001, 0x19a7, 0x0118, 0x2003, 0x0001,
-+ 0x0010, 0x2003, 0x0000, 0x0005, 0x0156, 0x20a9, 0x0800, 0x2009,
-+ 0x1000, 0x9006, 0x200a, 0x8108, 0x1f04, 0x61aa, 0x015e, 0x0005,
-+ 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146, 0x2069, 0x1847, 0x9006,
-+ 0xb802, 0xb8d6, 0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198,
-+ 0x348e, 0x231d, 0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026, 0xb886,
-+ 0x080c, 0xb07f, 0x1120, 0x9192, 0x007e, 0x1208, 0xbb86, 0x20a9,
-+ 0x0004, 0xb8c4, 0x20e8, 0xb9c8, 0x9198, 0x0006, 0x9006, 0x23a0,
-+ 0x4004, 0x20a9, 0x0004, 0x9198, 0x000a, 0x23a0, 0x4004, 0x002e,
-+ 0x001e, 0xb83e, 0xb842, 0xb8ce, 0xb8d2, 0xb85e, 0xb862, 0xb866,
-+ 0xb86a, 0xb86f, 0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e,
-+ 0xb893, 0x0008, 0xb896, 0xb89a, 0xb89e, 0xb8be, 0xb9a2, 0x0096,
-+ 0xb8a4, 0x904d, 0x0110, 0x080c, 0x108b, 0xb8a7, 0x0000, 0x009e,
-+ 0x9006, 0xb84a, 0x6810, 0xb83a, 0x680c, 0xb846, 0xb8bb, 0x0520,
-+ 0xb8ac, 0x9005, 0x0198, 0x00c6, 0x2060, 0x9c82, 0x1ddc, 0x0a0c,
-+ 0x0d85, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0d85, 0x080c,
-+ 0x8ede, 0x00ce, 0x090c, 0x927d, 0xb8af, 0x0000, 0x6814, 0x9084,
-+ 0x00ff, 0xb842, 0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005,
-+ 0x0126, 0x2091, 0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082,
-+ 0x4000, 0x1a04, 0x6286, 0x9182, 0x0800, 0x1a04, 0x628a, 0x2001,
-+ 0x180c, 0x2004, 0x9084, 0x0003, 0x1904, 0x6290, 0x9188, 0x1000,
-+ 0x2104, 0x905d, 0x0198, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006,
-+ 0x1188, 0xb8a4, 0x900d, 0x1904, 0x62a2, 0x080c, 0x6662, 0x9006,
-+ 0x012e, 0x0005, 0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028,
-+ 0x900e, 0x0498, 0x9082, 0x0006, 0x1290, 0x080c, 0xb07f, 0x1160,
-+ 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0d10, 0x2001,
-+ 0x0029, 0x2009, 0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009,
-+ 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184,
-+ 0x0118, 0x2001, 0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc,
-+ 0x0118, 0x2009, 0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029,
-+ 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005,
-+ 0x2001, 0x180c, 0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104,
-+ 0x9065, 0x09a8, 0x080c, 0x6c01, 0x1990, 0xb800, 0xd0bc, 0x0978,
-+ 0x0804, 0x6249, 0x080c, 0x6a1a, 0x0904, 0x6252, 0x0804, 0x624d,
-+ 0x00e6, 0x2071, 0x19e8, 0x7004, 0x9086, 0x0002, 0x1128, 0x7030,
-+ 0x9080, 0x0004, 0x2004, 0x9b06, 0x00ee, 0x0005, 0x00b6, 0x00e6,
-+ 0x0126, 0x2091, 0x8000, 0xa874, 0x908e, 0x00ff, 0x1120, 0x2001,
-+ 0x196b, 0x205c, 0x0060, 0xa974, 0x9182, 0x0800, 0x1690, 0x9188,
-+ 0x1000, 0x2104, 0x905d, 0x01d0, 0x080c, 0x6ba1, 0x11d0, 0x080c,
-+ 0xb101, 0x0570, 0x2b00, 0x6012, 0x2900, 0x6016, 0x6023, 0x0009,
-+ 0x602b, 0x0000, 0xa874, 0x908e, 0x00ff, 0x1110, 0x602b, 0x8000,
-+ 0x2009, 0x0043, 0x080c, 0xb1f5, 0x9006, 0x00b0, 0x2001, 0x0028,
-+ 0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-+ 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
-+ 0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005,
-+ 0x2001, 0x002c, 0x0cc0, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000,
-+ 0xa974, 0x9182, 0x0800, 0x1a04, 0x6381, 0x9188, 0x1000, 0x2104,
-+ 0x905d, 0x0904, 0x6359, 0xb8a0, 0x9086, 0x007f, 0x0190, 0xa87c,
-+ 0xd0fc, 0x1178, 0x080c, 0x6c09, 0x0160, 0xa994, 0x81ff, 0x0130,
-+ 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6c01,
-+ 0x1598, 0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060,
-+ 0x0026, 0x2010, 0x080c, 0xcef6, 0x002e, 0x1120, 0x2001, 0x0008,
-+ 0x0804, 0x6383, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008,
-+ 0x0804, 0x6383, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058,
-+ 0x080c, 0xb101, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b,
-+ 0xffff, 0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0xb1f5, 0x9006,
-+ 0x0458, 0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c,
-+ 0xb07f, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc,
-+ 0x0900, 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028,
-+ 0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-+ 0x0050, 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029,
-+ 0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005,
-+ 0x2001, 0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000,
-+ 0xa8e0, 0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8,
-+ 0x9005, 0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079,
-+ 0x1800, 0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130,
-+ 0xaa98, 0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c,
-+ 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
-+ 0x0010, 0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e,
-+ 0x0018, 0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e,
-+ 0x00be, 0x00fe, 0x0005, 0x6418, 0x63d3, 0x63ea, 0x6418, 0x6418,
-+ 0x6418, 0x6418, 0x6418, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c,
-+ 0x6742, 0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x6420, 0xb814,
-+ 0x9206, 0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x4b52,
-+ 0x0150, 0x04b0, 0x080c, 0x67ad, 0x1598, 0xb810, 0x9306, 0x1580,
-+ 0xb814, 0x9206, 0x1568, 0x080c, 0xb101, 0x0530, 0x2b00, 0x6012,
-+ 0x080c, 0xd3a3, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a,
-+ 0xa878, 0x9086, 0x0001, 0x1170, 0x080c, 0x3315, 0x9006, 0x080c,
-+ 0x66df, 0x2001, 0x0002, 0x080c, 0x66f3, 0x2001, 0x0200, 0xb86e,
-+ 0xb893, 0x0002, 0x2009, 0x0003, 0x080c, 0xb1f5, 0x9006, 0x0068,
-+ 0x2001, 0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
-+ 0x2001, 0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe,
-+ 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894,
-+ 0x90c6, 0x0015, 0x0904, 0x660b, 0x90c6, 0x0056, 0x0904, 0x660f,
-+ 0x90c6, 0x0066, 0x0904, 0x6613, 0x90c6, 0x0067, 0x0904, 0x6617,
-+ 0x90c6, 0x0068, 0x0904, 0x661b, 0x90c6, 0x0071, 0x0904, 0x661f,
-+ 0x90c6, 0x0074, 0x0904, 0x6623, 0x90c6, 0x007c, 0x0904, 0x6627,
-+ 0x90c6, 0x007e, 0x0904, 0x662b, 0x90c6, 0x0037, 0x0904, 0x662f,
-+ 0x9016, 0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x6606,
-+ 0x9182, 0x0800, 0x1a04, 0x6606, 0x080c, 0x67ad, 0x1198, 0xb804,
-+ 0x9084, 0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f,
-+ 0x0148, 0x080c, 0xb07f, 0x1904, 0x65ef, 0xb8a0, 0x9084, 0xff80,
-+ 0x1904, 0x65ef, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e,
-+ 0x0904, 0x654f, 0x90c6, 0x0064, 0x0904, 0x6578, 0x2008, 0x0804,
-+ 0x6511, 0xa998, 0xa8b0, 0x2040, 0x080c, 0xb07f, 0x1120, 0x9182,
-+ 0x007f, 0x0a04, 0x6511, 0x9186, 0x00ff, 0x0904, 0x6511, 0x9182,
-+ 0x0800, 0x1a04, 0x6511, 0xaaa0, 0xab9c, 0x787c, 0x9306, 0x11a8,
-+ 0x7880, 0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804,
-+ 0x6511, 0x080c, 0xb07f, 0x1140, 0x99cc, 0xff00, 0x009e, 0x1128,
-+ 0x2208, 0x2310, 0x0804, 0x6511, 0x009e, 0x080c, 0x4b52, 0x0904,
-+ 0x651b, 0x900e, 0x9016, 0x90c6, 0x4000, 0x15e0, 0x0006, 0x080c,
-+ 0x6a9e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x20a9,
-+ 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4,
-+ 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0fd6, 0x20a9,
-+ 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c4,
-+ 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0fd6, 0xa8c4,
-+ 0xabc8, 0x9305, 0xabcc, 0x9305, 0xabd0, 0x9305, 0xabd4, 0x9305,
-+ 0xabd8, 0x9305, 0xabdc, 0x9305, 0xabe0, 0x9305, 0x9005, 0x0510,
-+ 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x00a0, 0x90c6,
-+ 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6, 0x4009, 0x1108,
-+ 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005, 0x2009, 0x000a,
-+ 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e, 0x2001, 0x0030,
-+ 0x900e, 0x0478, 0x000e, 0x080c, 0xb101, 0x1130, 0x2001, 0x4005,
-+ 0x2009, 0x0003, 0x9016, 0x0c78, 0x2b00, 0x6012, 0x080c, 0xd3a3,
-+ 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108, 0xc0f5,
-+ 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x3315, 0x012e, 0x9006,
-+ 0x080c, 0x66df, 0x2001, 0x0002, 0x080c, 0x66f3, 0x2009, 0x0002,
-+ 0x080c, 0xb1f5, 0xa8b0, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6,
-+ 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x080c,
-+ 0x5852, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0, 0x080c,
-+ 0x67ad, 0x1904, 0x650c, 0x9186, 0x007f, 0x0130, 0x080c, 0x6c01,
-+ 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x1059, 0x1120,
-+ 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806, 0x080c,
-+ 0xd0f6, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x6513,
-+ 0xa998, 0xaeb0, 0x080c, 0x67ad, 0x1904, 0x650c, 0x0096, 0x080c,
-+ 0x1059, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x65cc, 0x2900,
-+ 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8c4, 0x20e0,
-+ 0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0,
-+ 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbc8, 0x9398,
-+ 0x0006, 0x2398, 0x080c, 0x0fd6, 0x009e, 0xa87b, 0x0000, 0xa883,
-+ 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x583e, 0xd0b4,
-+ 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118, 0xa89b,
-+ 0x000c, 0x00b0, 0x080c, 0x6c01, 0x0118, 0xa89b, 0x0009, 0x0080,
-+ 0x080c, 0x5852, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c, 0xd0d9,
-+ 0x1904, 0x6548, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x6513,
-+ 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006, 0x8007,
-+ 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b,
-+ 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x12a8,
-+ 0x080c, 0xb67c, 0x1904, 0x6548, 0x2009, 0x0002, 0x08e8, 0x2001,
-+ 0x0028, 0x900e, 0x0804, 0x6549, 0x2009, 0x180c, 0x210c, 0xd18c,
-+ 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
-+ 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x6549, 0x2001, 0x0029,
-+ 0x900e, 0x0804, 0x6549, 0x080c, 0x38be, 0x0804, 0x654a, 0x080c,
-+ 0x555b, 0x0804, 0x654a, 0x080c, 0x46d3, 0x0804, 0x654a, 0x080c,
-+ 0x474c, 0x0804, 0x654a, 0x080c, 0x47a8, 0x0804, 0x654a, 0x080c,
-+ 0x4c15, 0x0804, 0x654a, 0x080c, 0x4edd, 0x0804, 0x654a, 0x080c,
-+ 0x51c2, 0x0804, 0x654a, 0x080c, 0x53bb, 0x0804, 0x654a, 0x080c,
-+ 0x3afc, 0x0804, 0x654a, 0x00b6, 0xa974, 0xae78, 0x9684, 0x3fff,
-+ 0x9082, 0x4000, 0x1608, 0x9182, 0x0800, 0x1258, 0x9188, 0x1000,
-+ 0x2104, 0x905d, 0x0130, 0x080c, 0x6c01, 0x1138, 0x00d9, 0x9006,
-+ 0x00b0, 0x2001, 0x0028, 0x900e, 0x0090, 0x9082, 0x0006, 0x1240,
-+ 0xb900, 0xd1fc, 0x0d98, 0x2001, 0x0029, 0x2009, 0x1000, 0x0038,
-+ 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005,
-+ 0x00be, 0x0005, 0xa877, 0x0000, 0xb8d0, 0x9005, 0x1904, 0x66d3,
-+ 0xb888, 0x9005, 0x1904, 0x66d3, 0xb838, 0xb93c, 0x9102, 0x1a04,
-+ 0x66d3, 0x2b10, 0x080c, 0xb12e, 0x0904, 0x66cf, 0x8108, 0xb93e,
-+ 0x6212, 0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007,
-+ 0x0040, 0xa878, 0x605e, 0xa880, 0x6066, 0xa883, 0x0000, 0xa87c,
-+ 0xd0ac, 0x05b8, 0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1560, 0x2011,
-+ 0x180d, 0x2214, 0xd28c, 0x190c, 0x6cc6, 0xa816, 0xa864, 0x9094,
-+ 0x00f7, 0x9296, 0x0011, 0x11f8, 0x9084, 0x00ff, 0xc0bd, 0x601e,
-+ 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x000f, 0x8001, 0x1df0,
-+ 0x2001, 0x8004, 0x6003, 0x0004, 0x6046, 0x00f6, 0x2079, 0x0380,
-+ 0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0010, 0x2c00, 0x7836, 0x781b,
-+ 0x8080, 0x00fe, 0x0005, 0x080c, 0x17ad, 0x601c, 0xc0bd, 0x601e,
-+ 0x0c38, 0x2009, 0x180d, 0x210c, 0xd18c, 0x190c, 0x6cd0, 0xd0b4,
-+ 0x190c, 0x1c9c, 0x2001, 0x8004, 0x6003, 0x0002, 0x08e8, 0x81ff,
-+ 0x1110, 0xb88b, 0x0001, 0x2908, 0xb8cc, 0xb9ce, 0x9005, 0x1110,
-+ 0xb9d2, 0x0020, 0x0096, 0x2048, 0xa902, 0x009e, 0x0005, 0x00b6,
-+ 0x0126, 0x00c6, 0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00,
-+ 0x9005, 0x0110, 0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce,
-+ 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000,
-+ 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c,
-+ 0xd0ac, 0x0158, 0x080c, 0x6bfd, 0x0140, 0x9284, 0xff00, 0x8007,
-+ 0x9086, 0x0007, 0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00,
-+ 0x9215, 0xba06, 0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff,
-+ 0x090c, 0x0d85, 0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6,
-+ 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006,
-+ 0x9086, 0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6bf9,
-+ 0x1138, 0x9284, 0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006,
-+ 0x000e, 0x9294, 0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e,
-+ 0x00be, 0x0005, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005,
-+ 0x00d6, 0x0026, 0x9190, 0x1000, 0x2204, 0x905d, 0x1188, 0x0096,
-+ 0x080c, 0x1059, 0x2958, 0x009e, 0x0168, 0x2b00, 0x2012, 0xb85c,
-+ 0xb8ca, 0xb860, 0xb8c6, 0x9006, 0xb8a6, 0xb8ae, 0x080c, 0x61b0,
-+ 0x9006, 0x0010, 0x9085, 0x0001, 0x002e, 0x00de, 0x0005, 0x00b6,
-+ 0x0096, 0x0126, 0x2091, 0x8000, 0x0026, 0x9182, 0x0800, 0x0218,
-+ 0x9085, 0x0001, 0x04a8, 0x00d6, 0x9190, 0x1000, 0x2204, 0x905d,
-+ 0x0568, 0x2013, 0x0000, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x108b,
-+ 0x00d6, 0x00c6, 0xb8bc, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006,
-+ 0x6014, 0x2048, 0x080c, 0xcf08, 0x0110, 0x080c, 0x100b, 0x080c,
-+ 0xb157, 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x00c6, 0xb8ac, 0x9065,
-+ 0x0128, 0x621c, 0xd2c4, 0x0110, 0x080c, 0x927d, 0x00ce, 0x2b48,
-+ 0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x109b, 0x00de, 0x9006,
-+ 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182, 0x0800,
-+ 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104, 0x905d,
-+ 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146,
-+ 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c, 0x778e,
-+ 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xb07f, 0x11d8,
-+ 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982, 0x7048,
-+ 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e, 0x00ce,
-+ 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001, 0x6886,
-+ 0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862, 0x704c,
-+ 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8, 0xb8c8,
-+ 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099, 0x027a,
-+ 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069, 0x0200,
-+ 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048, 0xb872,
-+ 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0, 0x9086,
-+ 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218, 0x2009,
-+ 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0,
-+ 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182, 0x0349,
-+ 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218, 0x2009,
-+ 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010,
-+ 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005,
-+ 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896, 0x703c,
-+ 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbd4, 0xc384, 0xba00, 0x2009,
-+ 0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad, 0x0008,
-+ 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc, 0x0128,
-+ 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbd6, 0x003e,
-+ 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000,
-+ 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04, 0x9282,
-+ 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906, 0x8006,
-+ 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080, 0x0004,
-+ 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086, 0xffff,
-+ 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0d85, 0x3c00, 0x20e8, 0x3300,
-+ 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce, 0x014e,
-+ 0x013e, 0x0060, 0x080c, 0x1059, 0x0170, 0x2900, 0xb8a6, 0xa803,
-+ 0x0000, 0x080c, 0x6a3a, 0xa807, 0x0001, 0xae12, 0x9085, 0x0001,
-+ 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091, 0x8000,
-+ 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150, 0x080c,
-+ 0x6a49, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001, 0xa806,
-+ 0x0020, 0x080c, 0x108b, 0xb8a7, 0x0000, 0x009e, 0x012e, 0x0005,
-+ 0x0096, 0x00c6, 0xb888, 0x9005, 0x1904, 0x692f, 0xb8d0, 0x904d,
-+ 0x0904, 0x692f, 0x080c, 0xb12e, 0x0904, 0x692d, 0x8210, 0xba3e,
- 0xa800, 0xb8d2, 0x9005, 0x1108, 0xb8ce, 0x2b00, 0x6012, 0x2900,
- 0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007, 0x0040, 0xa878,
- 0x605e, 0xa880, 0x9084, 0x00ff, 0x6066, 0xa883, 0x0000, 0xa87c,
-@@ -3160,16 +3146,16 @@ unsigned short risc_code01[] = {
- 0xa864, 0x9094, 0x00f7, 0x9296, 0x0011, 0x1520, 0x9084, 0x00ff,
- 0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x8004,
- 0x6003, 0x0004, 0x0030, 0x080c, 0x1c9c, 0x2001, 0x8004, 0x6003,
-- 0x0002, 0x6046, 0x2001, 0x0010, 0x2c08, 0x080c, 0xaced, 0xb838,
-- 0xba3c, 0x9202, 0x0a04, 0x68e5, 0x0010, 0xb88b, 0x0001, 0x00ce,
-+ 0x0002, 0x6046, 0x2001, 0x0010, 0x2c08, 0x080c, 0xacdd, 0xb838,
-+ 0xba3c, 0x9202, 0x0a04, 0x68de, 0x0010, 0xb88b, 0x0001, 0x00ce,
- 0x009e, 0x0005, 0x080c, 0x17ad, 0x601c, 0xc0bd, 0x601e, 0x08f0,
- 0x00b6, 0x0096, 0x0016, 0x20a9, 0x0800, 0x900e, 0x0016, 0x080c,
-- 0x67b4, 0x1158, 0xb8d0, 0x904d, 0x0140, 0x3e00, 0x9086, 0x0002,
-+ 0x67ad, 0x1158, 0xb8d0, 0x904d, 0x0140, 0x3e00, 0x9086, 0x0002,
- 0x1118, 0xb800, 0xd0bc, 0x1108, 0x0041, 0x001e, 0x8108, 0x1f04,
-- 0x694e, 0x001e, 0x00be, 0x009e, 0x0005, 0x0096, 0x0016, 0xb8d0,
-+ 0x693e, 0x001e, 0x00be, 0x009e, 0x0005, 0x0096, 0x0016, 0xb8d0,
- 0x904d, 0x0188, 0xa800, 0xb8d2, 0x9005, 0x1108, 0xb8ce, 0x9006,
-- 0xa802, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd220,
-- 0x080c, 0x7012, 0x0c60, 0x001e, 0x009e, 0x0005, 0x0086, 0x9046,
-+ 0xa802, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd20d,
-+ 0x080c, 0x7002, 0x0c60, 0x001e, 0x009e, 0x0005, 0x0086, 0x9046,
- 0xb8d0, 0x904d, 0x01b0, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506,
- 0x0128, 0x2940, 0xa800, 0x904d, 0x0160, 0x0ca8, 0xa800, 0x88ff,
- 0x1128, 0xb8d2, 0x9005, 0x1118, 0xb8ce, 0x0008, 0xa002, 0xa803,
-@@ -3178,18 +3164,18 @@ unsigned short risc_code01[] = {
- 0x19e8, 0x9046, 0x7028, 0x9065, 0x01e8, 0x6014, 0x2068, 0x83ff,
- 0x0120, 0x605c, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118,
- 0xa870, 0x9506, 0x0120, 0x2c40, 0x600c, 0x2060, 0x0c60, 0x600c,
-- 0x0006, 0x0066, 0x2830, 0x080c, 0xa420, 0x006e, 0x000e, 0x83ff,
-+ 0x0006, 0x0066, 0x2830, 0x080c, 0xa410, 0x006e, 0x000e, 0x83ff,
- 0x0508, 0x0c08, 0x9046, 0xb8d0, 0x904d, 0x01e0, 0x83ff, 0x0120,
- 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870,
- 0x9506, 0x0120, 0x2940, 0xa800, 0x2048, 0x0c70, 0xb8d0, 0xaa00,
- 0x0026, 0x9906, 0x1110, 0xbad2, 0x0008, 0xa202, 0x000e, 0x83ff,
- 0x0108, 0x0c10, 0x002e, 0x008e, 0x00ce, 0x009e, 0x00ee, 0x012e,
- 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c,
-- 0x6aae, 0x0128, 0x080c, 0xcfdc, 0x0010, 0x9085, 0x0001, 0x0005,
-- 0x080c, 0x6aae, 0x0128, 0x080c, 0xcf7d, 0x0010, 0x9085, 0x0001,
-- 0x0005, 0x080c, 0x6aae, 0x0128, 0x080c, 0xcfd9, 0x0010, 0x9085,
-- 0x0001, 0x0005, 0x080c, 0x6aae, 0x0128, 0x080c, 0xcf9c, 0x0010,
-- 0x9085, 0x0001, 0x0005, 0x080c, 0x6aae, 0x0128, 0x080c, 0xd01f,
-+ 0x6a9e, 0x0128, 0x080c, 0xcfc9, 0x0010, 0x9085, 0x0001, 0x0005,
-+ 0x080c, 0x6a9e, 0x0128, 0x080c, 0xcf6a, 0x0010, 0x9085, 0x0001,
-+ 0x0005, 0x080c, 0x6a9e, 0x0128, 0x080c, 0xcfc6, 0x0010, 0x9085,
-+ 0x0001, 0x0005, 0x080c, 0x6a9e, 0x0128, 0x080c, 0xcf89, 0x0010,
-+ 0x9085, 0x0001, 0x0005, 0x080c, 0x6a9e, 0x0128, 0x080c, 0xd00c,
- 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085,
- 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e,
- 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080,
-@@ -3204,38 +3190,38 @@ unsigned short risc_code01[] = {
- 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de,
- 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091,
- 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x1059, 0x0168, 0x2900,
-- 0xb8a6, 0x080c, 0x6a4a, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085,
-+ 0xb8a6, 0x080c, 0x6a3a, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085,
- 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126,
- 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c,
- 0x108b, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4,
-- 0x0005, 0x00b6, 0x00f6, 0x080c, 0x779e, 0x01b0, 0x71c4, 0x81ff,
-+ 0x0005, 0x00b6, 0x00f6, 0x080c, 0x778e, 0x01b0, 0x71c4, 0x81ff,
- 0x1198, 0x71dc, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000,
- 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
- 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804, 0xd0a4,
-- 0x01d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67b4,
-+ 0x01d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67ad,
- 0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118,
- 0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108,
-- 0x1f04, 0x6ad5, 0x015e, 0x080c, 0x6bcf, 0x0120, 0x2001, 0x1985,
-+ 0x1f04, 0x6ac5, 0x015e, 0x080c, 0x6bbf, 0x0120, 0x2001, 0x1985,
- 0x200c, 0x0098, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x0190, 0x2009,
- 0x07d0, 0x2001, 0x182c, 0x2004, 0x9005, 0x0138, 0x2001, 0x1867,
-- 0x2004, 0xd0e4, 0x0110, 0x2009, 0x5dc0, 0x2011, 0x6b0c, 0x080c,
-- 0x8a5d, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x2011, 0x6b0c, 0x080c,
-- 0x8993, 0x080c, 0x6bcf, 0x01d8, 0x2001, 0x107e, 0x2004, 0x2058,
-- 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6c0d, 0x0130, 0x2009, 0x07d0,
-- 0x2011, 0x6b0c, 0x080c, 0x8a5d, 0x00e6, 0x2071, 0x1800, 0x9006,
-+ 0x2004, 0xd0e4, 0x0110, 0x2009, 0x5dc0, 0x2011, 0x6afc, 0x080c,
-+ 0x8a4d, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x2011, 0x6afc, 0x080c,
-+ 0x8983, 0x080c, 0x6bbf, 0x01d8, 0x2001, 0x107e, 0x2004, 0x2058,
-+ 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6bfd, 0x0130, 0x2009, 0x07d0,
-+ 0x2011, 0x6afc, 0x080c, 0x8a4d, 0x00e6, 0x2071, 0x1800, 0x9006,
- 0x707e, 0x7060, 0x7082, 0x080c, 0x30bf, 0x00ee, 0x04d0, 0x0156,
-- 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67b4, 0x1558,
-+ 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x67ad, 0x1558,
- 0xb800, 0xd0ec, 0x0540, 0x0046, 0xbaa0, 0x2220, 0x9006, 0x2009,
-- 0x0029, 0x080c, 0xea8d, 0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c,
-- 0x6c09, 0x2001, 0x0707, 0x1128, 0xb804, 0x9084, 0x00ff, 0x9085,
-- 0x0700, 0xb806, 0x080c, 0xacfc, 0x2019, 0x0029, 0x080c, 0x97b0,
-- 0x0076, 0x903e, 0x080c, 0x966d, 0x900e, 0x080c, 0xe75d, 0x007e,
-- 0x004e, 0x080c, 0xad18, 0x001e, 0x8108, 0x1f04, 0x6b34, 0x00ce,
-+ 0x0029, 0x080c, 0xea74, 0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c,
-+ 0x6bf9, 0x2001, 0x0707, 0x1128, 0xb804, 0x9084, 0x00ff, 0x9085,
-+ 0x0700, 0xb806, 0x080c, 0xacec, 0x2019, 0x0029, 0x080c, 0x97a0,
-+ 0x0076, 0x903e, 0x080c, 0x965d, 0x900e, 0x080c, 0xe744, 0x007e,
-+ 0x004e, 0x080c, 0xad08, 0x001e, 0x8108, 0x1f04, 0x6b24, 0x00ce,
- 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010, 0x2058, 0xb800, 0xc0ec,
- 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x0096, 0x080c, 0x1072,
- 0x090c, 0x0d85, 0x2958, 0x009e, 0x2001, 0x196b, 0x2b02, 0x8b07,
- 0x8006, 0x8006, 0x908c, 0x003f, 0xb9c6, 0x908c, 0xffc0, 0xb9ca,
-- 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x61b7, 0xb807, 0x0006,
-+ 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x61b0, 0xb807, 0x0006,
- 0xb813, 0x00ff, 0xb817, 0xffff, 0xb86f, 0x0200, 0xb86c, 0xb893,
- 0x0002, 0xb8bb, 0x0520, 0xb8a3, 0x00ff, 0xb8af, 0x0000, 0x00ce,
- 0x00be, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ac,
-@@ -3249,12 +3235,12 @@ unsigned short risc_code01[] = {
- 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c, 0x0d85, 0x000e,
- 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc, 0xba02, 0x002e,
- 0x012e, 0x0005, 0x2011, 0x1837, 0x2204, 0xd0cc, 0x0138, 0x2001,
-- 0x1983, 0x200c, 0x2011, 0x6bff, 0x080c, 0x8a5d, 0x0005, 0x2011,
-- 0x6bff, 0x080c, 0x8993, 0x2011, 0x1837, 0x2204, 0xc0cc, 0x2012,
-- 0x0005, 0x080c, 0x5840, 0xd0ac, 0x0005, 0x080c, 0x5840, 0xd0a4,
-+ 0x1983, 0x200c, 0x2011, 0x6bef, 0x080c, 0x8a4d, 0x0005, 0x2011,
-+ 0x6bef, 0x080c, 0x8983, 0x2011, 0x1837, 0x2204, 0xc0cc, 0x2012,
-+ 0x0005, 0x080c, 0x583e, 0xd0ac, 0x0005, 0x080c, 0x583e, 0xd0a4,
- 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e, 0x0006, 0x001e,
- 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007, 0x908e, 0x0006,
-- 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xd645, 0x0158, 0x70dc,
-+ 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xd632, 0x0158, 0x70dc,
- 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004, 0x905d, 0x0110,
- 0xb8d4, 0xd094, 0x00fe, 0x00be, 0x0005, 0x0006, 0x0016, 0x0036,
- 0x0046, 0x0076, 0x00b6, 0x2001, 0x1818, 0x203c, 0x9780, 0x348e,
-@@ -3282,11 +3268,11 @@ unsigned short risc_code01[] = {
- 0x000e, 0x0005, 0x2071, 0x1910, 0x7003, 0x0001, 0x7007, 0x0000,
- 0x9006, 0x7012, 0x7016, 0x701a, 0x701e, 0x700a, 0x7046, 0x2001,
- 0x1922, 0x2003, 0x0000, 0x0005, 0x0016, 0x00e6, 0x2071, 0x1948,
-- 0x900e, 0x710a, 0x080c, 0x5840, 0xd0fc, 0x1140, 0x080c, 0x5840,
-+ 0x900e, 0x710a, 0x080c, 0x583e, 0xd0fc, 0x1140, 0x080c, 0x583e,
- 0x900e, 0xd09c, 0x0108, 0x8108, 0x7102, 0x0470, 0x2001, 0x1867,
- 0x200c, 0x9184, 0x0007, 0x0006, 0x2001, 0x180d, 0x2004, 0xd08c,
-- 0x000e, 0x0108, 0x9006, 0x0002, 0x6d06, 0x6d06, 0x6d06, 0x6d06,
-- 0x6d06, 0x6d24, 0x6d39, 0x6d47, 0x7003, 0x0003, 0x2009, 0x1868,
-+ 0x000e, 0x0108, 0x9006, 0x0002, 0x6cf6, 0x6cf6, 0x6cf6, 0x6cf6,
-+ 0x6cf6, 0x6d14, 0x6d29, 0x6d37, 0x7003, 0x0003, 0x2009, 0x1868,
- 0x210c, 0x9184, 0xff00, 0x908e, 0xff00, 0x0140, 0x8007, 0x9005,
- 0x1110, 0x2001, 0x0002, 0x8003, 0x7006, 0x0030, 0x7007, 0x0001,
- 0x0018, 0x7003, 0x0005, 0x0c50, 0x2071, 0x1910, 0x704f, 0x0000,
-@@ -3297,66 +3283,66 @@ unsigned short risc_code01[] = {
- 0x704f, 0x000f, 0x0c90, 0x70f7, 0x0005, 0x08f0, 0x00e6, 0x2071,
- 0x0050, 0x684c, 0x9005, 0x1150, 0x00e6, 0x2071, 0x1910, 0x7028,
- 0xc085, 0x702a, 0x00ee, 0x9085, 0x0001, 0x0488, 0x6844, 0x9005,
-- 0x0158, 0x080c, 0x7b28, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101,
-+ 0x0158, 0x080c, 0x7b18, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101,
- 0x7006, 0x9006, 0x7012, 0x7016, 0x6860, 0x7002, 0x6864, 0x7006,
- 0x6868, 0x700a, 0x686c, 0x700e, 0x6844, 0x9005, 0x1110, 0x7012,
- 0x7016, 0x684c, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x7037,
- 0x0019, 0x702b, 0x0001, 0x00e6, 0x2071, 0x1910, 0x7028, 0xc084,
- 0x702a, 0x7007, 0x0001, 0x700b, 0x0000, 0x00ee, 0x9006, 0x00ee,
- 0x0005, 0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904,
-- 0x7017, 0x9286, 0x0003, 0x0904, 0x6eac, 0x9286, 0x0005, 0x0904,
-- 0x6eac, 0x2071, 0x1877, 0xa87c, 0x9005, 0x0904, 0x6e07, 0x7140,
-- 0xa868, 0x9102, 0x0a04, 0x7017, 0xa878, 0xd084, 0x15d8, 0xa853,
-+ 0x7007, 0x9286, 0x0003, 0x0904, 0x6e9c, 0x9286, 0x0005, 0x0904,
-+ 0x6e9c, 0x2071, 0x1877, 0xa87c, 0x9005, 0x0904, 0x6df7, 0x7140,
-+ 0xa868, 0x9102, 0x0a04, 0x7007, 0xa878, 0xd084, 0x15d8, 0xa853,
- 0x0019, 0x2001, 0x8023, 0xa84e, 0x2071, 0x1910, 0x701c, 0x9005,
-- 0x1904, 0x71c6, 0x0e04, 0x7234, 0x2071, 0x0000, 0xa850, 0x7032,
-+ 0x1904, 0x71b6, 0x0e04, 0x7224, 0x2071, 0x0000, 0xa850, 0x7032,
- 0xa84c, 0x7082, 0xa870, 0x7086, 0xa86c, 0x708a, 0xa880, 0x708e,
- 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000,
- 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080,
- 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e,
- 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200,
-- 0x0804, 0x6e8f, 0xa853, 0x001b, 0x2001, 0x8027, 0x0820, 0x7004,
-- 0xd08c, 0x1904, 0x7017, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804,
-- 0x6dcb, 0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904,
-- 0x7017, 0x9286, 0x0003, 0x0904, 0x6eac, 0x9286, 0x0005, 0x0904,
-- 0x6eac, 0xa84f, 0x8022, 0xa853, 0x0018, 0x0804, 0x6e74, 0xa868,
-+ 0x0804, 0x6e7f, 0xa853, 0x001b, 0x2001, 0x8027, 0x0820, 0x7004,
-+ 0xd08c, 0x1904, 0x7007, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804,
-+ 0x6dbb, 0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904,
-+ 0x7007, 0x9286, 0x0003, 0x0904, 0x6e9c, 0x9286, 0x0005, 0x0904,
-+ 0x6e9c, 0xa84f, 0x8022, 0xa853, 0x0018, 0x0804, 0x6e64, 0xa868,
- 0xd0fc, 0x1508, 0x00e6, 0x0026, 0x2001, 0x1948, 0x2004, 0x9015,
-- 0x0904, 0x7017, 0xa978, 0xa874, 0x9105, 0x1904, 0x7017, 0x9286,
-- 0x0003, 0x0904, 0x6eac, 0x9286, 0x0005, 0x0904, 0x6eac, 0xa87c,
-- 0xd0bc, 0x1904, 0x7017, 0x2200, 0x0002, 0x7017, 0x6e70, 0x6eac,
-- 0x6eac, 0x7017, 0x6eac, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6,
-- 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x7017, 0xa880,
-- 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x7017, 0x9186, 0x0003,
-- 0x0904, 0x6eac, 0x9186, 0x0005, 0x0904, 0x6eac, 0xa87c, 0xd0cc,
-- 0x0904, 0x7017, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005,
-+ 0x0904, 0x7007, 0xa978, 0xa874, 0x9105, 0x1904, 0x7007, 0x9286,
-+ 0x0003, 0x0904, 0x6e9c, 0x9286, 0x0005, 0x0904, 0x6e9c, 0xa87c,
-+ 0xd0bc, 0x1904, 0x7007, 0x2200, 0x0002, 0x7007, 0x6e60, 0x6e9c,
-+ 0x6e9c, 0x7007, 0x6e9c, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6,
-+ 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x7007, 0xa880,
-+ 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x7007, 0x9186, 0x0003,
-+ 0x0904, 0x6e9c, 0x9186, 0x0005, 0x0904, 0x6e9c, 0xa87c, 0xd0cc,
-+ 0x0904, 0x7007, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005,
- 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1910, 0x701c, 0x9005,
-- 0x1904, 0x71c6, 0x0e04, 0x7234, 0x2071, 0x0000, 0xa84c, 0x7082,
-+ 0x1904, 0x71b6, 0x0e04, 0x7224, 0x2071, 0x0000, 0xa84c, 0x7082,
- 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091,
- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x2071,
- 0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c, 0x1158, 0xa802,
-- 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899, 0x002e,
-+ 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889, 0x002e,
- 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
- 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000, 0x00f6, 0x2079,
- 0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904,
-- 0x6f9d, 0x782c, 0x908c, 0x0780, 0x190c, 0x7382, 0x8004, 0x8004,
-- 0x8004, 0x9084, 0x0003, 0x0002, 0x6eca, 0x6f9d, 0x6eee, 0x6f3a,
-+ 0x6f8d, 0x782c, 0x908c, 0x0780, 0x190c, 0x7372, 0x8004, 0x8004,
-+ 0x8004, 0x9084, 0x0003, 0x0002, 0x6eba, 0x6f8d, 0x6ede, 0x6f2a,
- 0x080c, 0x0d85, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
- 0x1168, 0x2071, 0x1a04, 0x7044, 0x9005, 0x1320, 0x2001, 0x1949,
- 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
- 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-- 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899, 0x0c18, 0x2071, 0x1800,
-+ 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889, 0x0c18, 0x2071, 0x1800,
- 0x2900, 0x7822, 0xa804, 0x900d, 0x15a0, 0x7824, 0x00e6, 0x2071,
- 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x1830, 0x210c, 0x918a,
- 0x0020, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108, 0x2102,
- 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-- 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8899, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x7382, 0xd0a4, 0x19c8, 0x2071, 0x1a04, 0x7044, 0x9005,
-+ 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8889, 0x782c, 0x9094, 0x0780,
-+ 0x190c, 0x7372, 0xd0a4, 0x19c8, 0x2071, 0x1a04, 0x7044, 0x9005,
- 0x1320, 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee,
- 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-- 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899,
-- 0x0804, 0x6ef5, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
-+ 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889,
-+ 0x0804, 0x6ee5, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
- 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c,
-- 0x8899, 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4, 0x1d60,
-- 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd09c, 0x1198,
-+ 0x8889, 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4, 0x1d60,
-+ 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd09c, 0x1198,
- 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x1550, 0x2071, 0x1a04,
- 0x7044, 0x9005, 0x1320, 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe,
- 0x002e, 0x00ee, 0x0005, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012,
-@@ -3365,86 +3351,86 @@ unsigned short risc_code01[] = {
- 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005,
- 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
- 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-- 0x8899, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000,
-+ 0x8889, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000,
- 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e,
-- 0x2148, 0xa804, 0x900d, 0x1904, 0x6ff1, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x7382, 0xd09c, 0x1198, 0x701c, 0x904d, 0x0180, 0x7010,
-+ 0x2148, 0xa804, 0x900d, 0x1904, 0x6fe1, 0x782c, 0x9094, 0x0780,
-+ 0x190c, 0x7372, 0xd09c, 0x1198, 0x701c, 0x904d, 0x0180, 0x7010,
- 0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822,
-- 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd09c, 0x0d68, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4, 0x01b0, 0x00e6, 0x7824,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd09c, 0x0d68, 0x782c,
-+ 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4, 0x01b0, 0x00e6, 0x7824,
- 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-- 0x8000, 0x70c2, 0x080c, 0x8899, 0x782c, 0x9094, 0x0780, 0x190c,
-- 0x7382, 0xd0a4, 0x1d60, 0x00ee, 0x2071, 0x1a04, 0x7044, 0x9005,
-+ 0x8000, 0x70c2, 0x080c, 0x8889, 0x782c, 0x9094, 0x0780, 0x190c,
-+ 0x7372, 0xd0a4, 0x1d60, 0x00ee, 0x2071, 0x1a04, 0x7044, 0x9005,
- 0x1320, 0x2001, 0x1949, 0x2004, 0x7046, 0x00fe, 0x002e, 0x00ee,
- 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
- 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200,
-- 0x70c2, 0x080c, 0x8899, 0x00ee, 0x0804, 0x6fad, 0xa868, 0xd0fc,
-+ 0x70c2, 0x080c, 0x8889, 0x00ee, 0x0804, 0x6f9d, 0xa868, 0xd0fc,
- 0x15e0, 0x0096, 0xa804, 0xa807, 0x0000, 0x904d, 0x190c, 0x100b,
- 0x009e, 0x0018, 0xa868, 0xd0fc, 0x1580, 0x00e6, 0x0026, 0xa84f,
- 0x0000, 0x00f6, 0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000,
- 0xa864, 0x9084, 0x00ff, 0x908e, 0x0016, 0x01a8, 0x7010, 0x9005,
-- 0x1904, 0x7142, 0x782c, 0x908c, 0x0780, 0x190c, 0x7382, 0x8004,
-- 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x7046, 0x7142, 0x7061,
-- 0x70d3, 0x080c, 0x0d85, 0x2009, 0x1948, 0x2104, 0x0002, 0x7026,
-- 0x7026, 0x7026, 0x6eb5, 0x7026, 0x6eb5, 0x0005, 0x2071, 0x1800,
-+ 0x1904, 0x7132, 0x782c, 0x908c, 0x0780, 0x190c, 0x7372, 0x8004,
-+ 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x7036, 0x7132, 0x7051,
-+ 0x70c3, 0x080c, 0x0d85, 0x2009, 0x1948, 0x2104, 0x0002, 0x7016,
-+ 0x7016, 0x7016, 0x6ea5, 0x7016, 0x6ea5, 0x0005, 0x2071, 0x1800,
- 0x2900, 0x7822, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee,
- 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-- 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899,
-+ 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889,
- 0x0c60, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904,
-- 0x70c2, 0x7830, 0xd0dc, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005,
-+ 0x70b2, 0x7830, 0xd0dc, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005,
- 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009,
- 0x1830, 0x210c, 0x918a, 0x0020, 0x0240, 0x7022, 0x2001, 0x1dc0,
- 0x200c, 0x8108, 0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c,
-- 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8899,
-- 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4, 0x19c8, 0x0e04,
-- 0x70b9, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
-+ 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8889,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4, 0x19c8, 0x0e04,
-+ 0x70a9, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
- 0x6836, 0x6833, 0x0013, 0x00de, 0x2001, 0x1921, 0x200c, 0xc184,
- 0x2102, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
- 0x1200, 0x2001, 0x1922, 0x2003, 0x0000, 0x00fe, 0x002e, 0x00ee,
- 0x0005, 0x2001, 0x1921, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e,
- 0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
- 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-- 0x8899, 0x0804, 0x7070, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071,
-+ 0x8889, 0x0804, 0x7060, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071,
- 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2,
-- 0x080c, 0x8899, 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4,
-- 0x1d60, 0x00ee, 0x0e04, 0x7115, 0x7838, 0x7938, 0x910e, 0x1de0,
-+ 0x080c, 0x8889, 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4,
-+ 0x1d60, 0x00ee, 0x0e04, 0x7105, 0x7838, 0x7938, 0x910e, 0x1de0,
- 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044,
- 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
- 0x190c, 0x1200, 0x704b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c,
-- 0x7382, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
-+ 0x7372, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
- 0x11e0, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046,
- 0x0c58, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
- 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
- 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016,
- 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-- 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899, 0x00fe, 0x002e,
-+ 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889, 0x00fe, 0x002e,
- 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
- 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-- 0x1904, 0x71b1, 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd09c,
-+ 0x1904, 0x71a1, 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd09c,
- 0x11b0, 0x701c, 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010,
- 0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822,
-- 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd09c, 0x0d50, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4, 0x05b8, 0x00e6, 0x7824,
-+ 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd09c, 0x0d50, 0x782c,
-+ 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4, 0x05b8, 0x00e6, 0x7824,
- 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-- 0x8000, 0x70c2, 0x080c, 0x8899, 0x782c, 0x9094, 0x0780, 0x190c,
-- 0x7382, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x71aa, 0x7838, 0x7938,
-+ 0x8000, 0x70c2, 0x080c, 0x8889, 0x782c, 0x9094, 0x0780, 0x190c,
-+ 0x7372, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x719a, 0x7838, 0x7938,
- 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
- 0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089,
- 0x2004, 0xd084, 0x190c, 0x1200, 0x704b, 0x0000, 0x00fe, 0x002e,
- 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x00fe, 0x002e, 0x00ee,
- 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
- 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200,
-- 0x70c2, 0x080c, 0x8899, 0x00ee, 0x0804, 0x7152, 0x2071, 0x1910,
-+ 0x70c2, 0x080c, 0x8889, 0x00ee, 0x0804, 0x7142, 0x2071, 0x1910,
- 0xa803, 0x0000, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
- 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-- 0x1128, 0x1e04, 0x71f1, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800,
-+ 0x1128, 0x1e04, 0x71e1, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800,
- 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-- 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8899, 0x0e04,
-- 0x71db, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c, 0x900d, 0x0d18,
-+ 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8889, 0x0e04,
-+ 0x71cb, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c, 0x900d, 0x0d18,
- 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
- 0xa870, 0x708a, 0xa850, 0x9082, 0x0019, 0x1278, 0x2091, 0x4080,
- 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x2071, 0x1910,
-- 0x080c, 0x736e, 0x002e, 0x00ee, 0x0005, 0xa850, 0x9082, 0x001c,
-+ 0x080c, 0x735e, 0x002e, 0x00ee, 0x0005, 0xa850, 0x9082, 0x001c,
- 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6, 0x0136, 0x01c6,
- 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868, 0x20a8, 0xa860,
- 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003, 0x015e, 0x01ce,
-@@ -3453,23 +3439,23 @@ unsigned short risc_code01[] = {
- 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1118, 0x002e,
- 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
- 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200,
-- 0x70c2, 0x080c, 0x8899, 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c,
-+ 0x70c2, 0x080c, 0x8889, 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c,
- 0x0006, 0xa867, 0x0103, 0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c,
- 0x9080, 0x001d, 0x20a0, 0x9006, 0x4004, 0x000e, 0x9084, 0x00ff,
- 0xa87e, 0x000e, 0xa87a, 0xa982, 0x0005, 0x2071, 0x1910, 0x7004,
-- 0x0002, 0x7281, 0x7282, 0x736d, 0x7282, 0x727f, 0x736d, 0x080c,
-- 0x0d85, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x728c, 0x728c,
-- 0x7306, 0x7307, 0x728c, 0x7307, 0x0126, 0x2091, 0x8000, 0x1e0c,
-- 0x738d, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x72d7,
-- 0x0e04, 0x72b5, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
-+ 0x0002, 0x7271, 0x7272, 0x735d, 0x7272, 0x726f, 0x735d, 0x080c,
-+ 0x0d85, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x727c, 0x727c,
-+ 0x72f6, 0x72f7, 0x727c, 0x72f7, 0x0126, 0x2091, 0x8000, 0x1e0c,
-+ 0x737d, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x72c7,
-+ 0x0e04, 0x72a5, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
- 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019,
- 0x1278, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-- 0x1200, 0x2071, 0x1910, 0x080c, 0x736e, 0x012e, 0x0804, 0x7305,
-+ 0x1200, 0x2071, 0x1910, 0x080c, 0x735e, 0x012e, 0x0804, 0x72f5,
- 0xa850, 0x9082, 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146,
- 0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a,
- 0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
- 0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e, 0x0890, 0x2001,
-- 0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x7382, 0xd09c, 0x2071,
-+ 0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x7372, 0xd09c, 0x2071,
- 0x1910, 0x1510, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964, 0x9184,
- 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101,
- 0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de,
-@@ -3478,10 +3464,10 @@ unsigned short risc_code01[] = {
- 0x2008, 0x2069, 0x1a04, 0x6844, 0x9005, 0x0760, 0x0158, 0x9186,
- 0x0003, 0x0540, 0x2001, 0x1815, 0x2004, 0x2009, 0x1b73, 0x210c,
- 0x9102, 0x1500, 0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c,
-- 0x6838, 0x9106, 0x0190, 0x0e04, 0x7339, 0x2069, 0x0000, 0x6837,
-+ 0x6838, 0x9106, 0x0190, 0x0e04, 0x7329, 0x2069, 0x0000, 0x6837,
- 0x8040, 0x6833, 0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001,
- 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x2069, 0x1a04, 0x6847,
-- 0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x73fd,
-+ 0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x73ed,
- 0x701c, 0x904d, 0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780,
- 0x15c9, 0xd09c, 0x1500, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964,
- 0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff,
-@@ -3490,7 +3476,7 @@ unsigned short risc_code01[] = {
- 0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091,
- 0x8000, 0x701c, 0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800,
- 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x080c, 0x108b, 0x0005,
-- 0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x7384, 0x0006, 0x0016,
-+ 0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x7374, 0x0006, 0x0016,
- 0x2001, 0x8004, 0x0006, 0x0804, 0x0d8e, 0x0096, 0x00f6, 0x2079,
- 0x0050, 0x7044, 0xd084, 0x01d0, 0xc084, 0x7046, 0x7838, 0x7938,
- 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
-@@ -3501,43 +3487,43 @@ unsigned short risc_code01[] = {
- 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x1830, 0x210c, 0x918a,
- 0x0020, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108, 0x2102,
- 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-- 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8899, 0x782c, 0x9094, 0x0780,
-- 0x190c, 0x7382, 0xd0a4, 0x19c8, 0x7838, 0x7938, 0x910e, 0x1de0,
-+ 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8889, 0x782c, 0x9094, 0x0780,
-+ 0x190c, 0x7372, 0xd0a4, 0x19c8, 0x7838, 0x7938, 0x910e, 0x1de0,
- 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091,
- 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200, 0x00ee,
- 0x704b, 0x0000, 0x00fe, 0x009e, 0x0005, 0x00f6, 0x2079, 0x0050,
- 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e,
- 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de,
- 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1200,
-- 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4,
-+ 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4,
- 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824, 0x2048, 0x702c, 0xa802,
-- 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8899, 0x782c,
-- 0x9094, 0x0780, 0x190c, 0x7382, 0xd0a4, 0x1d70, 0x00d6, 0x2069,
-+ 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8889, 0x782c,
-+ 0x9094, 0x0780, 0x190c, 0x7372, 0xd0a4, 0x1d70, 0x00d6, 0x2069,
- 0x0050, 0x693c, 0x2069, 0x1948, 0x6808, 0x690a, 0x2069, 0x1a04,
- 0x9102, 0x1118, 0x6844, 0x9005, 0x1320, 0x2001, 0x1949, 0x200c,
- 0x6946, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x7098, 0x908a, 0x002a,
- 0x1a0c, 0x0d85, 0x9082, 0x001d, 0x003b, 0x0026, 0x2011, 0x1e00,
-- 0x080c, 0x2ad3, 0x002e, 0x0005, 0x7542, 0x74af, 0x74cb, 0x74f5,
-- 0x7531, 0x7571, 0x7583, 0x74cb, 0x7559, 0x746a, 0x7498, 0x751b,
-- 0x7469, 0x0005, 0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1180,
-+ 0x080c, 0x2ad3, 0x002e, 0x0005, 0x7532, 0x749f, 0x74bb, 0x74e5,
-+ 0x7521, 0x7561, 0x7573, 0x74bb, 0x7549, 0x745a, 0x7488, 0x750b,
-+ 0x7459, 0x0005, 0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1180,
- 0x6808, 0x9005, 0x1518, 0x709b, 0x0029, 0x2069, 0x198f, 0x2d04,
-- 0x7002, 0x080c, 0x78e4, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0,
-+ 0x7002, 0x080c, 0x78d4, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0,
- 0x709b, 0x0029, 0x2069, 0x198f, 0x2d04, 0x7002, 0x6028, 0x9085,
- 0x0600, 0x602a, 0x00e6, 0x0036, 0x0046, 0x0056, 0x2071, 0x1a6e,
- 0x080c, 0x1b1e, 0x005e, 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005,
- 0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1178, 0x6808, 0x9005,
- 0x1160, 0x709b, 0x0029, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c,
-- 0x7990, 0x6028, 0x9085, 0x0600, 0x602a, 0x00de, 0x0005, 0x0006,
-+ 0x7980, 0x6028, 0x9085, 0x0600, 0x602a, 0x00de, 0x0005, 0x0006,
- 0x2001, 0x0090, 0x080c, 0x2a99, 0x000e, 0x6124, 0xd1e4, 0x1190,
-- 0x080c, 0x75f4, 0xd1d4, 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150,
-- 0x709b, 0x0020, 0x080c, 0x75f4, 0x0028, 0x709b, 0x001d, 0x0010,
-+ 0x080c, 0x75e4, 0xd1d4, 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150,
-+ 0x709b, 0x0020, 0x080c, 0x75e4, 0x0028, 0x709b, 0x001d, 0x0010,
- 0x709b, 0x001f, 0x0005, 0x2001, 0x0088, 0x080c, 0x2a99, 0x6124,
- 0xd1cc, 0x11e8, 0xd1dc, 0x11c0, 0xd1e4, 0x1198, 0x9184, 0x1e00,
- 0x11d8, 0x080c, 0x1b4b, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e,
-- 0x080c, 0x77ca, 0x2001, 0x0080, 0x080c, 0x2a99, 0x709b, 0x0029,
-+ 0x080c, 0x77ba, 0x2001, 0x0080, 0x080c, 0x2a99, 0x709b, 0x0029,
- 0x0058, 0x709b, 0x001e, 0x0040, 0x709b, 0x001d, 0x0028, 0x709b,
- 0x0020, 0x0010, 0x709b, 0x001f, 0x0005, 0x080c, 0x1b4b, 0x60e3,
-- 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x77ca, 0x2001, 0x0080,
-+ 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x77ba, 0x2001, 0x0080,
- 0x080c, 0x2a99, 0x6124, 0xd1d4, 0x1198, 0xd1dc, 0x1170, 0xd1e4,
- 0x1148, 0x9184, 0x1e00, 0x1118, 0x709b, 0x0029, 0x0058, 0x709b,
- 0x0028, 0x0040, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010,
-@@ -3546,139 +3532,139 @@ unsigned short risc_code01[] = {
- 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f,
- 0x0005, 0x2001, 0x00a0, 0x080c, 0x2a99, 0x6124, 0xd1dc, 0x1138,
- 0xd1e4, 0x0138, 0x080c, 0x1b4b, 0x709b, 0x001e, 0x0010, 0x709b,
-- 0x001d, 0x0005, 0x080c, 0x767d, 0x6124, 0xd1dc, 0x1188, 0x080c,
-- 0x75f4, 0x0016, 0x080c, 0x1b4b, 0x001e, 0xd1d4, 0x1128, 0xd1e4,
-- 0x0138, 0x709b, 0x001e, 0x0020, 0x709b, 0x001f, 0x080c, 0x75f4,
-+ 0x001d, 0x0005, 0x080c, 0x766d, 0x6124, 0xd1dc, 0x1188, 0x080c,
-+ 0x75e4, 0x0016, 0x080c, 0x1b4b, 0x001e, 0xd1d4, 0x1128, 0xd1e4,
-+ 0x0138, 0x709b, 0x001e, 0x0020, 0x709b, 0x001f, 0x080c, 0x75e4,
- 0x0005, 0x0006, 0x2001, 0x00a0, 0x080c, 0x2a99, 0x000e, 0x6124,
- 0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140,
- 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x0021,
-- 0x0005, 0x080c, 0x767d, 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128,
-+ 0x0005, 0x080c, 0x766d, 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128,
- 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010,
- 0x709b, 0x001f, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c, 0x2a99,
- 0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128,
- 0xd1e4, 0x0158, 0x709b, 0x001e, 0x0040, 0x709b, 0x001d, 0x0028,
- 0x709b, 0x0020, 0x0010, 0x709b, 0x001f, 0x0005, 0x0016, 0x00c6,
- 0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-- 0x1800, 0x2091, 0x8000, 0x080c, 0x779e, 0x11f8, 0x2001, 0x180c,
-+ 0x1800, 0x2091, 0x8000, 0x080c, 0x778e, 0x11f8, 0x2001, 0x180c,
- 0x200c, 0xd1b4, 0x01d0, 0xc1b4, 0x2102, 0x0026, 0x2011, 0x0200,
- 0x080c, 0x2ad3, 0x002e, 0x080c, 0x2a7f, 0x6024, 0xd0cc, 0x0148,
-- 0x2001, 0x00a0, 0x080c, 0x2a99, 0x080c, 0x7ab6, 0x080c, 0x619d,
-- 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x77b8, 0x0150,
-- 0x080c, 0x77af, 0x1138, 0x2001, 0x0001, 0x080c, 0x2631, 0x080c,
-- 0x7772, 0x00a0, 0x080c, 0x767a, 0x0178, 0x2001, 0x0001, 0x080c,
-+ 0x2001, 0x00a0, 0x080c, 0x2a99, 0x080c, 0x7aa6, 0x080c, 0x6196,
-+ 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x77a8, 0x0150,
-+ 0x080c, 0x779f, 0x1138, 0x2001, 0x0001, 0x080c, 0x2631, 0x080c,
-+ 0x7762, 0x00a0, 0x080c, 0x766a, 0x0178, 0x2001, 0x0001, 0x080c,
- 0x2631, 0x7098, 0x9086, 0x001e, 0x0120, 0x7098, 0x9086, 0x0022,
- 0x1118, 0x709b, 0x0025, 0x0010, 0x709b, 0x0021, 0x012e, 0x00ee,
-- 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x7605, 0x080c,
-- 0x8a9f, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x7605,
-- 0x080c, 0x8a96, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016,
-- 0x080c, 0xa2a0, 0x2071, 0x1800, 0x080c, 0x759e, 0x001e, 0x00fe,
-+ 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x75f5, 0x080c,
-+ 0x8a8f, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x75f5,
-+ 0x080c, 0x8a86, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016,
-+ 0x080c, 0xa290, 0x2071, 0x1800, 0x080c, 0x758e, 0x001e, 0x00fe,
- 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
-- 0x00f6, 0x0126, 0x2071, 0x1800, 0x080c, 0xa2a0, 0x2061, 0x0100,
-+ 0x00f6, 0x0126, 0x2071, 0x1800, 0x080c, 0xa290, 0x2061, 0x0100,
- 0x2069, 0x0140, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a, 0x080c,
-- 0xacfc, 0x2011, 0x0003, 0x080c, 0xa62b, 0x2011, 0x0002, 0x080c,
-- 0xa635, 0x080c, 0xa516, 0x080c, 0x8a4b, 0x0036, 0x901e, 0x080c,
-- 0xa596, 0x003e, 0x080c, 0xad18, 0x60e3, 0x0000, 0x080c, 0xeed9,
-- 0x080c, 0xeef4, 0x2009, 0x0004, 0x080c, 0x2a85, 0x080c, 0x299b,
-+ 0xacec, 0x2011, 0x0003, 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c,
-+ 0xa625, 0x080c, 0xa506, 0x080c, 0x8a3b, 0x0036, 0x901e, 0x080c,
-+ 0xa586, 0x003e, 0x080c, 0xad08, 0x60e3, 0x0000, 0x080c, 0xeec0,
-+ 0x080c, 0xeedb, 0x2009, 0x0004, 0x080c, 0x2a85, 0x080c, 0x299b,
- 0x2001, 0x1800, 0x2003, 0x0004, 0x2011, 0x0008, 0x080c, 0x2ad3,
-- 0x2011, 0x7605, 0x080c, 0x8a9f, 0x080c, 0x77b8, 0x0118, 0x9006,
-+ 0x2011, 0x75f5, 0x080c, 0x8a8f, 0x080c, 0x77a8, 0x0118, 0x9006,
- 0x080c, 0x2a99, 0x080c, 0x0bcf, 0x2001, 0x0001, 0x080c, 0x2631,
- 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-- 0x0005, 0x0026, 0x00e6, 0x2011, 0x7612, 0x2071, 0x1a04, 0x701c,
-+ 0x0005, 0x0026, 0x00e6, 0x2011, 0x7602, 0x2071, 0x1a04, 0x701c,
- 0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085, 0x0001, 0x00ee,
- 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800, 0x9084, 0xfffe,
- 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0, 0x080c, 0x2a99, 0x0156,
-- 0x20a9, 0x002d, 0x1d04, 0x768a, 0x2091, 0x6000, 0x1f04, 0x768a,
-+ 0x20a9, 0x002d, 0x1d04, 0x767a, 0x2091, 0x6000, 0x1f04, 0x767a,
- 0x015e, 0x00d6, 0x2069, 0x1800, 0x689c, 0x8001, 0x0220, 0x0118,
- 0x689e, 0x00de, 0x0005, 0x689f, 0x0014, 0x68ec, 0xd0dc, 0x0dc8,
-- 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x8aab, 0x0c90, 0x00c6,
-+ 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x8a9b, 0x0c90, 0x00c6,
- 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-- 0x080c, 0x7ac5, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006, 0x709a,
-+ 0x080c, 0x7ab5, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006, 0x709a,
- 0x60e2, 0x6886, 0x080c, 0x2700, 0x9006, 0x080c, 0x2a99, 0x080c,
-- 0x6058, 0x0026, 0x2011, 0xffff, 0x080c, 0x2ad3, 0x002e, 0x602b,
-+ 0x6051, 0x0026, 0x2011, 0xffff, 0x080c, 0x2ad3, 0x002e, 0x602b,
- 0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6,
- 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001, 0x197d,
- 0x200c, 0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158, 0x9186,
-- 0x0002, 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x7762, 0x709b,
-+ 0x0002, 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x7752, 0x709b,
- 0x0022, 0x0040, 0x709b, 0x0021, 0x0028, 0x709b, 0x0023, 0x0010,
- 0x709b, 0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001,
-- 0x080c, 0x2700, 0x080c, 0xacfc, 0x0026, 0x080c, 0xafd2, 0x080c,
-- 0xb09b, 0x002e, 0x080c, 0xad18, 0x7000, 0x908e, 0x0004, 0x0118,
-+ 0x080c, 0x2700, 0x080c, 0xacec, 0x0026, 0x080c, 0xafbd, 0x080c,
-+ 0xb086, 0x002e, 0x080c, 0xad08, 0x7000, 0x908e, 0x0004, 0x0118,
- 0x602b, 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091,
- 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e,
-- 0x080c, 0xd645, 0x0118, 0x9006, 0x080c, 0x2ac3, 0x0804, 0x776e,
-+ 0x080c, 0xd632, 0x0118, 0x9006, 0x080c, 0x2ac3, 0x0804, 0x775e,
- 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2a7f, 0x6904,
-- 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2a99, 0x1f04, 0x7713,
-- 0x080c, 0x77f2, 0x012e, 0x015e, 0x080c, 0x77af, 0x0170, 0x6044,
-- 0x9005, 0x0130, 0x080c, 0x77f2, 0x9006, 0x8001, 0x1df0, 0x0028,
-- 0x6804, 0xd0d4, 0x1110, 0x080c, 0x77f2, 0x080c, 0xd645, 0x0118,
-+ 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2a99, 0x1f04, 0x7703,
-+ 0x080c, 0x77e2, 0x012e, 0x015e, 0x080c, 0x779f, 0x0170, 0x6044,
-+ 0x9005, 0x0130, 0x080c, 0x77e2, 0x9006, 0x8001, 0x1df0, 0x0028,
-+ 0x6804, 0xd0d4, 0x1110, 0x080c, 0x77e2, 0x080c, 0xd632, 0x0118,
- 0x9006, 0x080c, 0x2ac3, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004,
-- 0x0130, 0x2009, 0x00c8, 0x2011, 0x7612, 0x080c, 0x8a5d, 0x002e,
-- 0x001e, 0x080c, 0x8890, 0x7034, 0xc085, 0x7036, 0x2001, 0x197d,
-- 0x2003, 0x0004, 0x080c, 0x744d, 0x080c, 0x77af, 0x0138, 0x6804,
-- 0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c, 0x7abb, 0x00ee, 0x00de,
-+ 0x0130, 0x2009, 0x00c8, 0x2011, 0x7602, 0x080c, 0x8a4d, 0x002e,
-+ 0x001e, 0x080c, 0x8880, 0x7034, 0xc085, 0x7036, 0x2001, 0x197d,
-+ 0x2003, 0x0004, 0x080c, 0x743d, 0x080c, 0x779f, 0x0138, 0x6804,
-+ 0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c, 0x7aab, 0x00ee, 0x00de,
- 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
-- 0x0140, 0x2071, 0x1800, 0x080c, 0x88a7, 0x080c, 0x8899, 0x080c,
-- 0x7ac5, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2,
-+ 0x0140, 0x2071, 0x1800, 0x080c, 0x8897, 0x080c, 0x8889, 0x080c,
-+ 0x7ab5, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2,
- 0x6886, 0x080c, 0x2700, 0x9006, 0x080c, 0x2a99, 0x6043, 0x0090,
- 0x6043, 0x0010, 0x0026, 0x2011, 0xffff, 0x080c, 0x2ad3, 0x002e,
- 0x602b, 0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006, 0x2001,
- 0x197c, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006, 0x080c,
-- 0x5844, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006,
-- 0x080c, 0x5844, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e, 0x0005,
-- 0x0006, 0x080c, 0x5844, 0x9084, 0x0030, 0x9086, 0x0010, 0x000e,
-- 0x0005, 0x0006, 0x080c, 0x5844, 0x9084, 0x0030, 0x9086, 0x0020,
-+ 0x5842, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006,
-+ 0x080c, 0x5842, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e, 0x0005,
-+ 0x0006, 0x080c, 0x5842, 0x9084, 0x0030, 0x9086, 0x0010, 0x000e,
-+ 0x0005, 0x0006, 0x080c, 0x5842, 0x9084, 0x0030, 0x9086, 0x0020,
- 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c, 0x2004, 0x908c,
- 0x0013, 0x0168, 0x0020, 0x080c, 0x2720, 0x900e, 0x0010, 0x2009,
- 0x0002, 0x2019, 0x0028, 0x080c, 0x32da, 0x9006, 0x0019, 0x001e,
- 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130, 0x080c,
-- 0xd63e, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef, 0x2072,
-+ 0xd62b, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef, 0x2072,
- 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006, 0x600c, 0x0006,
- 0x6004, 0x0006, 0x6028, 0x0006, 0x080c, 0x2af6, 0x080c, 0x2b29,
- 0x602f, 0x0100, 0x602f, 0x0000, 0x602f, 0x0040, 0x602f, 0x0000,
- 0x20a9, 0x0002, 0x080c, 0x2a60, 0x0026, 0x2011, 0x0040, 0x080c,
- 0x2ad3, 0x002e, 0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e,
- 0x000e, 0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001,
-- 0x080c, 0x2700, 0x2001, 0x00a0, 0x0006, 0x080c, 0xd645, 0x000e,
-+ 0x080c, 0x2700, 0x2001, 0x00a0, 0x0006, 0x080c, 0xd632, 0x000e,
- 0x0130, 0x080c, 0x2ab7, 0x9006, 0x080c, 0x2ac3, 0x0010, 0x080c,
- 0x2a99, 0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6,
- 0x2079, 0x0100, 0x080c, 0x2a0c, 0x00fe, 0x000e, 0x6052, 0x0005,
- 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
-- 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0xad5a, 0x0158,
-+ 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0xad4a, 0x0158,
- 0x2001, 0x0386, 0x2004, 0xd0b4, 0x1130, 0x2001, 0x0016, 0x080c,
-- 0xaced, 0x0804, 0x78d6, 0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102,
-+ 0xacdd, 0x0804, 0x78c6, 0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102,
- 0x6028, 0x9084, 0xe1ff, 0x602a, 0x2011, 0x0200, 0x080c, 0x2ad3,
- 0x2001, 0x0090, 0x080c, 0x2a99, 0x20a9, 0x0366, 0x6024, 0xd0cc,
-- 0x1560, 0x1d04, 0x786e, 0x2091, 0x6000, 0x1f04, 0x786e, 0x080c,
-- 0xacfc, 0x2011, 0x0003, 0x080c, 0xa62b, 0x2011, 0x0002, 0x080c,
-- 0xa635, 0x080c, 0xa516, 0x901e, 0x080c, 0xa596, 0x2001, 0x0386,
-- 0x2003, 0x7000, 0x080c, 0xad18, 0x2001, 0x00a0, 0x080c, 0x2a99,
-- 0x080c, 0x7ab6, 0x080c, 0x619d, 0x080c, 0xd645, 0x0110, 0x080c,
-- 0x0cf1, 0x9085, 0x0001, 0x0804, 0x78dc, 0x080c, 0x1b4b, 0x60e3,
-+ 0x1560, 0x1d04, 0x785e, 0x2091, 0x6000, 0x1f04, 0x785e, 0x080c,
-+ 0xacec, 0x2011, 0x0003, 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c,
-+ 0xa625, 0x080c, 0xa506, 0x901e, 0x080c, 0xa586, 0x2001, 0x0386,
-+ 0x2003, 0x7000, 0x080c, 0xad08, 0x2001, 0x00a0, 0x080c, 0x2a99,
-+ 0x080c, 0x7aa6, 0x080c, 0x6196, 0x080c, 0xd632, 0x0110, 0x080c,
-+ 0x0cf1, 0x9085, 0x0001, 0x0804, 0x78cc, 0x080c, 0x1b4b, 0x60e3,
- 0x0000, 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002, 0x1118,
- 0x2001, 0x196d, 0x2004, 0x080c, 0x2700, 0x60e2, 0x2001, 0x0080,
- 0x080c, 0x2a99, 0x20a9, 0x0366, 0x2011, 0x1e00, 0x080c, 0x2ad3,
- 0x2009, 0x1e00, 0x080c, 0x2a7f, 0x6024, 0x910c, 0x0140, 0x1d04,
-- 0x78b4, 0x2091, 0x6000, 0x1f04, 0x78b4, 0x0804, 0x7877, 0x2001,
-+ 0x78a4, 0x2091, 0x6000, 0x1f04, 0x78a4, 0x0804, 0x7867, 0x2001,
- 0x0386, 0x2003, 0x7000, 0x6028, 0x9085, 0x1e00, 0x602a, 0x70b4,
-- 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xd645,
-+ 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xd632,
- 0x0110, 0x080c, 0x0cf1, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e,
- 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
- 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x7000,
- 0x9086, 0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084, 0x5540,
- 0x9086, 0x5540, 0x1128, 0x2069, 0x1a7b, 0x2d04, 0x8000, 0x206a,
- 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884, 0x9005,
-- 0x1904, 0x794d, 0x2001, 0x0088, 0x080c, 0x2a99, 0x9006, 0x60e2,
-+ 0x1904, 0x793d, 0x2001, 0x0088, 0x080c, 0x2a99, 0x9006, 0x60e2,
- 0x6886, 0x080c, 0x2700, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118,
- 0x6808, 0x9005, 0x01d0, 0x6028, 0x9084, 0xfbff, 0x602a, 0x2011,
- 0x0400, 0x080c, 0x2ad3, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b,
-- 0x0026, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x792d, 0x2091,
-- 0x6000, 0x1f04, 0x792d, 0x0804, 0x7988, 0x2069, 0x0140, 0x20a9,
-+ 0x0026, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x791d, 0x2091,
-+ 0x6000, 0x1f04, 0x791d, 0x0804, 0x7978, 0x2069, 0x0140, 0x20a9,
- 0x0384, 0x2011, 0x1e00, 0x080c, 0x2ad3, 0x2009, 0x1e00, 0x080c,
- 0x2a7f, 0x6024, 0x910c, 0x0528, 0x9084, 0x1a00, 0x1510, 0x1d04,
-- 0x7939, 0x2091, 0x6000, 0x1f04, 0x7939, 0x080c, 0xacfc, 0x2011,
-- 0x0003, 0x080c, 0xa62b, 0x2011, 0x0002, 0x080c, 0xa635, 0x080c,
-- 0xa516, 0x901e, 0x080c, 0xa596, 0x080c, 0xad18, 0x2001, 0x00a0,
-- 0x080c, 0x2a99, 0x080c, 0x7ab6, 0x080c, 0x619d, 0x9085, 0x0001,
-+ 0x7929, 0x2091, 0x6000, 0x1f04, 0x7929, 0x080c, 0xacec, 0x2011,
-+ 0x0003, 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c, 0xa625, 0x080c,
-+ 0xa506, 0x901e, 0x080c, 0xa586, 0x080c, 0xad08, 0x2001, 0x00a0,
-+ 0x080c, 0x2a99, 0x080c, 0x7aa6, 0x080c, 0x6196, 0x9085, 0x0001,
- 0x00f8, 0x080c, 0x1b4b, 0x2001, 0x0080, 0x080c, 0x2a99, 0x2069,
- 0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001,
- 0x0008, 0x6886, 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002,
-@@ -3686,40 +3672,40 @@ unsigned short risc_code01[] = {
- 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
- 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
- 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0, 0x01e8, 0x080c,
-- 0xacfc, 0x2011, 0x0003, 0x080c, 0xa62b, 0x2011, 0x0002, 0x080c,
-- 0xa635, 0x080c, 0xa516, 0x901e, 0x080c, 0xa596, 0x080c, 0xad18,
-- 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2a99, 0x080c, 0x7ab6,
-- 0x080c, 0x619d, 0x0804, 0x7a32, 0x2001, 0x180c, 0x200c, 0xd1b4,
-- 0x1160, 0xc1b5, 0x2102, 0x080c, 0x75fa, 0x2069, 0x0140, 0x2001,
-+ 0xacec, 0x2011, 0x0003, 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c,
-+ 0xa625, 0x080c, 0xa506, 0x901e, 0x080c, 0xa586, 0x080c, 0xad08,
-+ 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2a99, 0x080c, 0x7aa6,
-+ 0x080c, 0x6196, 0x0804, 0x7a22, 0x2001, 0x180c, 0x200c, 0xd1b4,
-+ 0x1160, 0xc1b5, 0x2102, 0x080c, 0x75ea, 0x2069, 0x0140, 0x2001,
- 0x0080, 0x080c, 0x2a99, 0x60e3, 0x0000, 0x2069, 0x0200, 0x6804,
- 0x9005, 0x1118, 0x6808, 0x9005, 0x0190, 0x6028, 0x9084, 0xfdff,
- 0x602a, 0x2011, 0x0200, 0x080c, 0x2ad3, 0x2069, 0x198f, 0x7000,
-- 0x206a, 0x709b, 0x0027, 0x7003, 0x0001, 0x0804, 0x7a32, 0x2011,
-+ 0x206a, 0x709b, 0x0027, 0x7003, 0x0001, 0x0804, 0x7a22, 0x2011,
- 0x1e00, 0x080c, 0x2ad3, 0x2009, 0x1e00, 0x080c, 0x2a7f, 0x6024,
-- 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x79e7, 0x0006,
-- 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x88e7, 0x00ee, 0x00de,
-+ 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x79d7, 0x0006,
-+ 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x88d7, 0x00ee, 0x00de,
- 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x1a04, 0x7078, 0x00ee,
-- 0x9005, 0x19e8, 0x0438, 0x0026, 0x2011, 0x7612, 0x080c, 0x8993,
-- 0x2011, 0x7605, 0x080c, 0x8a9f, 0x002e, 0x2069, 0x0140, 0x60e3,
-+ 0x9005, 0x19e8, 0x0438, 0x0026, 0x2011, 0x7602, 0x080c, 0x8983,
-+ 0x2011, 0x75f5, 0x080c, 0x8a8f, 0x002e, 0x2069, 0x0140, 0x60e3,
- 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886,
- 0x2001, 0x180d, 0x2004, 0xd08c, 0x2001, 0x0002, 0x1118, 0x2001,
- 0x196d, 0x2004, 0x080c, 0x2700, 0x60e2, 0x2001, 0x180c, 0x200c,
- 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
- 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6,
-- 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xd63e, 0x1904,
-- 0x7aa0, 0x7130, 0xd184, 0x1170, 0x080c, 0x3482, 0x0138, 0xc18d,
-+ 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xd62b, 0x1904,
-+ 0x7a90, 0x7130, 0xd184, 0x1170, 0x080c, 0x3482, 0x0138, 0xc18d,
- 0x7132, 0x2011, 0x1848, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c,
-- 0x0904, 0x7aa0, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538, 0x0016,
-- 0x2019, 0x000e, 0x080c, 0xe9f9, 0x0156, 0x00b6, 0x20a9, 0x007f,
-+ 0x0904, 0x7a90, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538, 0x0016,
-+ 0x2019, 0x000e, 0x080c, 0xe9e0, 0x0156, 0x00b6, 0x20a9, 0x007f,
- 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188, 0x080c,
-- 0x67b4, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c,
-- 0xea8d, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8c44, 0x001e,
-- 0x8108, 0x1f04, 0x7a69, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148,
-+ 0x67ad, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c,
-+ 0xea74, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8c34, 0x001e,
-+ 0x8108, 0x1f04, 0x7a59, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148,
- 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x32da, 0x001e,
-- 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x67b4,
-- 0x1110, 0x080c, 0x61b7, 0x8108, 0x1f04, 0x7a96, 0x00be, 0x015e,
-- 0x080c, 0x1b4b, 0x080c, 0xacfc, 0x080c, 0xb09b, 0x080c, 0xad18,
-- 0x60e3, 0x0000, 0x080c, 0x619d, 0x080c, 0x76cd, 0x00ee, 0x00ce,
-+ 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x67ad,
-+ 0x1110, 0x080c, 0x61b0, 0x8108, 0x1f04, 0x7a86, 0x00be, 0x015e,
-+ 0x080c, 0x1b4b, 0x080c, 0xacec, 0x080c, 0xb086, 0x080c, 0xad08,
-+ 0x60e3, 0x0000, 0x080c, 0x6196, 0x080c, 0x76bd, 0x00ee, 0x00ce,
- 0x004e, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x197d,
- 0x2003, 0x0001, 0x0005, 0x2001, 0x197d, 0x2003, 0x0000, 0x0005,
- 0x2001, 0x197c, 0x2003, 0xaaaa, 0x0005, 0x2001, 0x197c, 0x2003,
-@@ -3734,88 +3720,88 @@ unsigned short risc_code01[] = {
- 0x7012, 0x7016, 0x6848, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e,
- 0x2001, 0x0019, 0x7036, 0x702b, 0x0001, 0x2001, 0x0004, 0x200c,
- 0x918c, 0xfff7, 0x918d, 0x8000, 0x2102, 0x00d6, 0x2069, 0x18fa,
-- 0x6807, 0x0001, 0x00de, 0x080c, 0x8103, 0x9006, 0x00ee, 0x0005,
-- 0x900e, 0x0156, 0x20a9, 0x0006, 0x8003, 0x818d, 0x1f04, 0x7b2c,
-+ 0x6807, 0x0001, 0x00de, 0x080c, 0x80f3, 0x9006, 0x00ee, 0x0005,
-+ 0x900e, 0x0156, 0x20a9, 0x0006, 0x8003, 0x818d, 0x1f04, 0x7b1c,
- 0x015e, 0x0005, 0x2079, 0x0040, 0x2071, 0x18fa, 0x7004, 0x0002,
-- 0x7b42, 0x7b43, 0x7b8f, 0x7bea, 0x7d4a, 0x7b40, 0x7b40, 0x7d74,
-+ 0x7b32, 0x7b33, 0x7b7f, 0x7bda, 0x7d3a, 0x7b30, 0x7b30, 0x7d64,
- 0x080c, 0x0d85, 0x0005, 0x2079, 0x0040, 0x2001, 0x1dc0, 0x2003,
-- 0x0000, 0x782c, 0x908c, 0x0780, 0x190c, 0x81e5, 0xd0a4, 0x0578,
-- 0x2001, 0x1dc0, 0x2004, 0x9082, 0x0080, 0x1648, 0x1d04, 0x7b60,
-+ 0x0000, 0x782c, 0x908c, 0x0780, 0x190c, 0x81d5, 0xd0a4, 0x0578,
-+ 0x2001, 0x1dc0, 0x2004, 0x9082, 0x0080, 0x1648, 0x1d04, 0x7b50,
- 0x2001, 0x1a07, 0x200c, 0x8109, 0x0510, 0x2091, 0x6000, 0x2102,
- 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff,
- 0x908a, 0x0040, 0x0610, 0x00c0, 0x2001, 0x1800, 0x200c, 0x9186,
-- 0x0003, 0x1168, 0x7004, 0x0002, 0x7b7f, 0x7b49, 0x7b7f, 0x7b7d,
-- 0x7b7f, 0x7b7f, 0x7b7f, 0x7b7f, 0x7b7f, 0x080c, 0x7bea, 0x782c,
-- 0xd09c, 0x090c, 0x8103, 0x0005, 0x9082, 0x005a, 0x1218, 0x2100,
-- 0x003b, 0x0c10, 0x080c, 0x7c20, 0x0c90, 0x00e3, 0x08e8, 0x0005,
-- 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c42, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c2c, 0x7c20, 0x7e6a, 0x7c20,
-- 0x7c20, 0x7c20, 0x7c42, 0x7c20, 0x7c2c, 0x7eab, 0x7eec, 0x7f33,
-- 0x7f47, 0x7c20, 0x7c20, 0x7c42, 0x7c2c, 0x7c56, 0x7c20, 0x7d1e,
-- 0x7ff2, 0x800d, 0x7c20, 0x7c42, 0x7c20, 0x7c56, 0x7c20, 0x7c20,
-- 0x7d14, 0x800d, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c20, 0x7c20, 0x7c20, 0x7c6a, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x7c20, 0x8189, 0x7c20, 0x8133,
-- 0x7c20, 0x8133, 0x7c20, 0x7c7f, 0x7c20, 0x7c20, 0x7c20, 0x7c20,
-- 0x7c20, 0x7c20, 0x2079, 0x0040, 0x7004, 0x9086, 0x0003, 0x1198,
-- 0x782c, 0x080c, 0x812c, 0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006,
-+ 0x0003, 0x1168, 0x7004, 0x0002, 0x7b6f, 0x7b39, 0x7b6f, 0x7b6d,
-+ 0x7b6f, 0x7b6f, 0x7b6f, 0x7b6f, 0x7b6f, 0x080c, 0x7bda, 0x782c,
-+ 0xd09c, 0x090c, 0x80f3, 0x0005, 0x9082, 0x005a, 0x1218, 0x2100,
-+ 0x003b, 0x0c10, 0x080c, 0x7c10, 0x0c90, 0x00e3, 0x08e8, 0x0005,
-+ 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c32, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c1c, 0x7c10, 0x7e5a, 0x7c10,
-+ 0x7c10, 0x7c10, 0x7c32, 0x7c10, 0x7c1c, 0x7e9b, 0x7edc, 0x7f23,
-+ 0x7f37, 0x7c10, 0x7c10, 0x7c32, 0x7c1c, 0x7c46, 0x7c10, 0x7d0e,
-+ 0x7fe2, 0x7ffd, 0x7c10, 0x7c32, 0x7c10, 0x7c46, 0x7c10, 0x7c10,
-+ 0x7d04, 0x7ffd, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c10, 0x7c10, 0x7c10, 0x7c5a, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x7c10, 0x8179, 0x7c10, 0x8123,
-+ 0x7c10, 0x8123, 0x7c10, 0x7c6f, 0x7c10, 0x7c10, 0x7c10, 0x7c10,
-+ 0x7c10, 0x7c10, 0x2079, 0x0040, 0x7004, 0x9086, 0x0003, 0x1198,
-+ 0x782c, 0x080c, 0x811c, 0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006,
- 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x001a, 0x1210,
-- 0x002b, 0x0c50, 0x00e9, 0x080c, 0x8103, 0x0005, 0x7c20, 0x7c2c,
-- 0x7e56, 0x7c20, 0x7c2c, 0x7c20, 0x7c2c, 0x7c2c, 0x7c20, 0x7c2c,
-- 0x7e56, 0x7c2c, 0x7c2c, 0x7c2c, 0x7c2c, 0x7c2c, 0x7c20, 0x7c2c,
-- 0x7e56, 0x7c20, 0x7c20, 0x7c2c, 0x7c20, 0x7c20, 0x7c20, 0x7c2c,
-+ 0x002b, 0x0c50, 0x00e9, 0x080c, 0x80f3, 0x0005, 0x7c10, 0x7c1c,
-+ 0x7e46, 0x7c10, 0x7c1c, 0x7c10, 0x7c1c, 0x7c1c, 0x7c10, 0x7c1c,
-+ 0x7e46, 0x7c1c, 0x7c1c, 0x7c1c, 0x7c1c, 0x7c1c, 0x7c10, 0x7c1c,
-+ 0x7e46, 0x7c10, 0x7c10, 0x7c1c, 0x7c10, 0x7c10, 0x7c10, 0x7c1c,
- 0x00e6, 0x2071, 0x18fa, 0x2009, 0x0400, 0x0071, 0x00ee, 0x0005,
- 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000, 0x0029, 0x0005,
- 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001, 0xa868, 0x9084,
-- 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x7012,
-+ 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x7002,
- 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08, 0x8001,
-- 0x1120, 0x7007, 0x0001, 0x0804, 0x7df3, 0x7007, 0x0003, 0x7012,
-- 0x2900, 0x7016, 0x701a, 0x704b, 0x7df3, 0x0005, 0xa864, 0x8007,
-+ 0x1120, 0x7007, 0x0001, 0x0804, 0x7de3, 0x7007, 0x0003, 0x7012,
-+ 0x2900, 0x7016, 0x701a, 0x704b, 0x7de3, 0x0005, 0xa864, 0x8007,
- 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804,
-- 0x7e0e, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b,
-- 0x7e0e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0904, 0x7c28,
-- 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7e2a, 0x7007, 0x0003,
-- 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7e2a, 0x0005, 0xa864,
-- 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x7c28, 0x7007,
-- 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1904, 0x7ceb, 0x2001,
-- 0x180d, 0x2004, 0xd08c, 0x0904, 0x7cd6, 0xa99c, 0x9186, 0x00ff,
-+ 0x7dfe, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b,
-+ 0x7dfe, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0904, 0x7c18,
-+ 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7e1a, 0x7007, 0x0003,
-+ 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7e1a, 0x0005, 0xa864,
-+ 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x7c18, 0x7007,
-+ 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1904, 0x7cdb, 0x2001,
-+ 0x180d, 0x2004, 0xd08c, 0x0904, 0x7cc6, 0xa99c, 0x9186, 0x00ff,
- 0x05e8, 0xa994, 0x9186, 0x006f, 0x0188, 0x9186, 0x0074, 0x15b0,
-- 0x0026, 0x2011, 0x0010, 0x080c, 0x6c35, 0x002e, 0x0578, 0x0016,
-- 0xa998, 0x080c, 0x6c7f, 0x001e, 0x1548, 0x0400, 0x080c, 0x779e,
-+ 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25, 0x002e, 0x0578, 0x0016,
-+ 0xa998, 0x080c, 0x6c6f, 0x001e, 0x1548, 0x0400, 0x080c, 0x778e,
- 0x0140, 0xa897, 0x4005, 0xa89b, 0x0016, 0x2001, 0x0030, 0x900e,
-- 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x6c35, 0x002e, 0x01b0,
-+ 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x6c25, 0x002e, 0x01b0,
- 0x0016, 0x0026, 0x0036, 0xa998, 0xaaa0, 0xab9c, 0x918d, 0x8000,
-- 0x080c, 0x6c7f, 0x003e, 0x002e, 0x001e, 0x1140, 0xa897, 0x4005,
-+ 0x080c, 0x6c6f, 0x003e, 0x002e, 0x001e, 0x1140, 0xa897, 0x4005,
- 0xa89b, 0x4009, 0x2001, 0x0030, 0x900e, 0x0050, 0xa868, 0x9084,
-- 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x6430, 0x1108, 0x0005,
-+ 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x6429, 0x1108, 0x0005,
- 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a, 0xa982, 0x080c,
-- 0x7012, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071, 0x0904, 0x7c8f,
-- 0x9186, 0x0064, 0x0904, 0x7c8f, 0x9186, 0x007c, 0x0904, 0x7c8f,
-- 0x9186, 0x0028, 0x0904, 0x7c8f, 0x9186, 0x0038, 0x0904, 0x7c8f,
-- 0x9186, 0x0078, 0x0904, 0x7c8f, 0x9186, 0x005f, 0x0904, 0x7c8f,
-- 0x9186, 0x0056, 0x0904, 0x7c8f, 0xa897, 0x4005, 0xa89b, 0x0001,
-+ 0x7002, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071, 0x0904, 0x7c7f,
-+ 0x9186, 0x0064, 0x0904, 0x7c7f, 0x9186, 0x007c, 0x0904, 0x7c7f,
-+ 0x9186, 0x0028, 0x0904, 0x7c7f, 0x9186, 0x0038, 0x0904, 0x7c7f,
-+ 0x9186, 0x0078, 0x0904, 0x7c7f, 0x9186, 0x005f, 0x0904, 0x7c7f,
-+ 0x9186, 0x0056, 0x0904, 0x7c7f, 0xa897, 0x4005, 0xa89b, 0x0001,
- 0x2001, 0x0030, 0x900e, 0x0860, 0xa87c, 0x9084, 0x00c0, 0x9086,
-- 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x8024, 0x2900, 0x7016,
-+ 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x8014, 0x2900, 0x7016,
- 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0030,
- 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080, 0x0023,
-- 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401, 0x1a04, 0x7c30,
-- 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7c30, 0x82ff, 0x1138, 0xa8b8,
-- 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7db1, 0x0018, 0x9280, 0x7da7,
-- 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7d92, 0x080c, 0x1072,
-+ 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401, 0x1a04, 0x7c20,
-+ 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7c20, 0x82ff, 0x1138, 0xa8b8,
-+ 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7da1, 0x0018, 0x9280, 0x7d97,
-+ 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7d82, 0x080c, 0x1072,
- 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022, 0x7054, 0x2060,
- 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004, 0x9100, 0xa076,
- 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e, 0x2200, 0x7112,
- 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108, 0x9108, 0xa17a,
- 0x810b, 0xa17e, 0x080c, 0x114e, 0xa06c, 0x908e, 0x0100, 0x0170,
- 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005, 0x7020, 0x2048,
-- 0x080c, 0x108b, 0x7014, 0x2048, 0x0804, 0x7c30, 0x7020, 0x2048,
-+ 0x080c, 0x108b, 0x7014, 0x2048, 0x0804, 0x7c20, 0x7020, 0x2048,
- 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048, 0xa906, 0x711a,
-- 0x0804, 0x7d4a, 0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005,
-+ 0x0804, 0x7d3a, 0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005,
- 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864, 0x9084,
-- 0x00ff, 0x9086, 0x001e, 0x0904, 0x8024, 0x0804, 0x7df3, 0x7da9,
-- 0x7dad, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a, 0x001b, 0x0005,
-+ 0x00ff, 0x9086, 0x001e, 0x0904, 0x8014, 0x0804, 0x7de3, 0x7d99,
-+ 0x7d9d, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a, 0x001b, 0x0005,
- 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076, 0x0066, 0xafb8,
- 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de, 0xb0b8,
- 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca, 0xb0ac,
-@@ -3825,16 +3811,16 @@ unsigned short risc_code01[] = {
- 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e, 0xb078,
- 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055, 0x1958,
- 0x006e, 0x007e, 0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1178,
-- 0x080c, 0x622f, 0x1108, 0x0005, 0x080c, 0x725e, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xd220, 0x080c, 0x7012, 0x012e, 0x0ca0, 0x080c,
-- 0xd63e, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70, 0x2009, 0x1834,
-+ 0x080c, 0x6228, 0x1108, 0x0005, 0x080c, 0x724e, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0xd20d, 0x080c, 0x7002, 0x012e, 0x0ca0, 0x080c,
-+ 0xd62b, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70, 0x2009, 0x1834,
- 0x210c, 0x81ff, 0x1188, 0xa888, 0x9005, 0x0188, 0xa883, 0x0000,
-- 0x080c, 0x62bd, 0x1108, 0x0005, 0xa87a, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x7012, 0x012e, 0x0cb8, 0x2001, 0x0028, 0x0ca8, 0x2001,
-+ 0x080c, 0x62b6, 0x1108, 0x0005, 0xa87a, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x7002, 0x012e, 0x0cb8, 0x2001, 0x0028, 0x0ca8, 0x2001,
- 0x0000, 0x0c90, 0x0419, 0x11d8, 0xa888, 0x9005, 0x01e0, 0xa883,
-- 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x6392, 0x1138, 0x0005,
-- 0x9006, 0xa87a, 0x080c, 0x630a, 0x1108, 0x0005, 0x0126, 0x2091,
-- 0x8000, 0xa87a, 0xa982, 0x080c, 0x7012, 0x012e, 0x0cb0, 0x2001,
-+ 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x638b, 0x1138, 0x0005,
-+ 0x9006, 0xa87a, 0x080c, 0x6303, 0x1108, 0x0005, 0x0126, 0x2091,
-+ 0x8000, 0xa87a, 0xa982, 0x080c, 0x7002, 0x012e, 0x0cb0, 0x2001,
- 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x00c6, 0x2061,
- 0x1800, 0x60d0, 0x9005, 0x0100, 0x00ce, 0x0005, 0x7018, 0xa802,
- 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012, 0x0118,
-@@ -3842,184 +3828,184 @@ unsigned short risc_code01[] = {
- 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878, 0x9084,
- 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096, 0x0001,
- 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160, 0x9005,
-- 0x11d8, 0xa974, 0x080c, 0x67b4, 0x11b8, 0x0066, 0xae80, 0x080c,
-- 0x68c4, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224, 0xc484,
-- 0x2412, 0x004e, 0x00c6, 0x080c, 0x67b4, 0x1110, 0x080c, 0x6a9e,
-- 0x8108, 0x1f04, 0x7e93, 0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c,
-- 0x108b, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x7012,
-+ 0x11d8, 0xa974, 0x080c, 0x67ad, 0x11b8, 0x0066, 0xae80, 0x080c,
-+ 0x68bd, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224, 0xc484,
-+ 0x2412, 0x004e, 0x00c6, 0x080c, 0x67ad, 0x1110, 0x080c, 0x6a8e,
-+ 0x8108, 0x1f04, 0x7e83, 0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c,
-+ 0x108b, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x7002,
- 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001,
-- 0x080c, 0x6c0d, 0x0580, 0x2061, 0x1a73, 0x6100, 0xd184, 0x0178,
-+ 0x080c, 0x6bfd, 0x0580, 0x2061, 0x1a73, 0x6100, 0xd184, 0x0178,
- 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520, 0x6004,
- 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8, 0x2011,
- 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000, 0x6016,
- 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007, 0x9084,
- 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d, 0x6202,
-- 0x012e, 0x0804, 0x80ed, 0x012e, 0x0804, 0x80e7, 0x012e, 0x0804,
-- 0x80e1, 0x012e, 0x0804, 0x80e4, 0x0126, 0x2091, 0x8000, 0x7007,
-- 0x0001, 0x080c, 0x6c0d, 0x05e0, 0x2061, 0x1a73, 0x6000, 0xd084,
-+ 0x012e, 0x0804, 0x80dd, 0x012e, 0x0804, 0x80d7, 0x012e, 0x0804,
-+ 0x80d1, 0x012e, 0x0804, 0x80d4, 0x0126, 0x2091, 0x8000, 0x7007,
-+ 0x0001, 0x080c, 0x6bfd, 0x05e0, 0x2061, 0x1a73, 0x6000, 0xd084,
- 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484, 0x0003,
- 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100, 0x9210,
- 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0, 0x9484,
- 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082, 0x0004,
- 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004, 0x1168,
- 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000, 0x6016,
-- 0x6206, 0x630a, 0x012e, 0x0804, 0x80ed, 0x012e, 0x0804, 0x80ea,
-- 0x012e, 0x0804, 0x80e7, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001,
-+ 0x6206, 0x630a, 0x012e, 0x0804, 0x80dd, 0x012e, 0x0804, 0x80da,
-+ 0x012e, 0x0804, 0x80d7, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001,
- 0x2061, 0x1a73, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318, 0x0220,
-- 0x630a, 0x012e, 0x0804, 0x80fb, 0x012e, 0x0804, 0x80ea, 0x00b6,
-+ 0x630a, 0x012e, 0x0804, 0x80eb, 0x012e, 0x0804, 0x80da, 0x00b6,
- 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c, 0xd0ac,
- 0x0148, 0x00c6, 0x2061, 0x1a73, 0x6000, 0x9084, 0xfcff, 0x6002,
- 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065, 0x0598,
-- 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c, 0xb1a7, 0x0068,
-+ 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c, 0xb192, 0x0068,
- 0x6017, 0xf400, 0x6063, 0x0000, 0xa97c, 0xd1a4, 0x0110, 0xa980,
-- 0x6162, 0x2009, 0x0041, 0x080c, 0xb20a, 0xa988, 0x918c, 0xff00,
-+ 0x6162, 0x2009, 0x0041, 0x080c, 0xb1f5, 0xa988, 0x918c, 0xff00,
- 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff, 0x080c,
-- 0x8c44, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a73, 0x6000,
-+ 0x8c34, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a73, 0x6000,
- 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce, 0x012e,
-- 0x00be, 0x0804, 0x80ed, 0x00ce, 0x012e, 0x00be, 0x0804, 0x80e7,
-+ 0x00be, 0x0804, 0x80dd, 0x00ce, 0x012e, 0x00be, 0x0804, 0x80d7,
- 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18, 0x9186,
- 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c, 0x200c,
- 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186, 0x0029,
-- 0x1d10, 0xa974, 0x080c, 0x67b4, 0x1968, 0xb800, 0xc0e4, 0xb802,
-+ 0x1d10, 0xa974, 0x080c, 0x67ad, 0x1968, 0xb800, 0xc0e4, 0xb802,
- 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001, 0x1986,
-- 0x2004, 0x601a, 0x0804, 0x7f82, 0xa88c, 0x9065, 0x0960, 0x00e6,
-+ 0x2004, 0x601a, 0x0804, 0x7f72, 0xa88c, 0x9065, 0x0960, 0x00e6,
- 0xa890, 0x9075, 0x2001, 0x1834, 0x2004, 0x9005, 0x0150, 0x080c,
-- 0xb1a7, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xb1a7, 0x00ee, 0x0804,
-- 0x7f82, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a,
-+ 0xb192, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xb192, 0x00ee, 0x0804,
-+ 0x7f72, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a,
- 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e, 0xa8a8,
-- 0x6016, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x00ee,
-- 0x0804, 0x7f82, 0x2061, 0x1a73, 0x6000, 0xd084, 0x0190, 0xd08c,
-- 0x1904, 0x80fb, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210, 0x0220,
-- 0x6206, 0x012e, 0x0804, 0x80fb, 0x012e, 0xa883, 0x0016, 0x0804,
-- 0x80f4, 0xa883, 0x0007, 0x0804, 0x80f4, 0xa864, 0x8007, 0x9084,
-+ 0x6016, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607, 0x00ee,
-+ 0x0804, 0x7f72, 0x2061, 0x1a73, 0x6000, 0xd084, 0x0190, 0xd08c,
-+ 0x1904, 0x80eb, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210, 0x0220,
-+ 0x6206, 0x012e, 0x0804, 0x80eb, 0x012e, 0xa883, 0x0016, 0x0804,
-+ 0x80e4, 0xa883, 0x0007, 0x0804, 0x80e4, 0xa864, 0x8007, 0x9084,
- 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069, 0x0005,
-- 0x080c, 0x7c28, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
-- 0x701a, 0x704b, 0x8024, 0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091,
-- 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff, 0x1904, 0x80a6,
-- 0x6130, 0xd194, 0x1904, 0x80d0, 0xa878, 0x2070, 0x9e82, 0x1ddc,
-- 0x0a04, 0x809a, 0x6068, 0x9e02, 0x1a04, 0x809a, 0x7120, 0x9186,
-- 0x0006, 0x1904, 0x808c, 0x7010, 0x905d, 0x0904, 0x80a6, 0xb800,
-- 0xd0e4, 0x1904, 0x80ca, 0x2061, 0x1a73, 0x6100, 0x9184, 0x0301,
-- 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x80d3, 0xa883,
-+ 0x080c, 0x7c18, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
-+ 0x701a, 0x704b, 0x8014, 0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091,
-+ 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff, 0x1904, 0x8096,
-+ 0x6130, 0xd194, 0x1904, 0x80c0, 0xa878, 0x2070, 0x9e82, 0x1ddc,
-+ 0x0a04, 0x808a, 0x6068, 0x9e02, 0x1a04, 0x808a, 0x7120, 0x9186,
-+ 0x0006, 0x1904, 0x807c, 0x7010, 0x905d, 0x0904, 0x8096, 0xb800,
-+ 0xd0e4, 0x1904, 0x80ba, 0x2061, 0x1a73, 0x6100, 0x9184, 0x0301,
-+ 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x80c3, 0xa883,
- 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198, 0x7116,
-- 0xa87c, 0xd0f4, 0x1904, 0x80d6, 0x080c, 0x5840, 0xd09c, 0x1118,
-- 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x8b34, 0x012e, 0x00ee,
-+ 0xa87c, 0xd0f4, 0x1904, 0x80c6, 0x080c, 0x583e, 0xd09c, 0x1118,
-+ 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x8b24, 0x012e, 0x00ee,
- 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902, 0x2148,
-- 0xa87c, 0xd0f4, 0x1904, 0x80d6, 0x012e, 0x00ee, 0x00be, 0x0005,
-- 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x80f4, 0xd184,
-- 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x67b4, 0x15d0,
-+ 0xa87c, 0xd0f4, 0x1904, 0x80c6, 0x012e, 0x00ee, 0x00be, 0x0005,
-+ 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x80e4, 0xd184,
-+ 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x67ad, 0x15d0,
- 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118, 0xa883,
- 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e, 0x0460,
-- 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c, 0x5844,
-+ 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c, 0x5842,
- 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1ddc, 0x02c0, 0x6068,
- 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010, 0x905d,
- 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000, 0x9086,
-- 0x0007, 0x1904, 0x8030, 0x7003, 0x0002, 0x0804, 0x8030, 0xa883,
-+ 0x0007, 0x1904, 0x8020, 0x7003, 0x0002, 0x0804, 0x8020, 0xa883,
- 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be, 0x0420,
- 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60, 0x2019,
-- 0x0002, 0x601b, 0x0014, 0x080c, 0xe586, 0x012e, 0x00ee, 0x00be,
-+ 0x0002, 0x601b, 0x0014, 0x080c, 0xe56d, 0x012e, 0x00ee, 0x00be,
- 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040, 0x2009,
- 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001, 0xa884,
- 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x7012, 0x012e, 0x0005, 0x080c, 0x108b, 0x0005, 0x00d6, 0x080c,
-- 0x8b2b, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000,
-+ 0x7002, 0x012e, 0x0005, 0x080c, 0x108b, 0x0005, 0x00d6, 0x080c,
-+ 0x8b1b, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000,
- 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780, 0x190c,
-- 0x81e5, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0, 0x90ea, 0x0020,
-+ 0x81d5, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0, 0x90ea, 0x0020,
- 0x0278, 0x8001, 0x70c2, 0x702c, 0x2048, 0xa800, 0x702e, 0x9006,
- 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c, 0x0c28,
- 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780, 0x190c,
-- 0x81e5, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003, 0x05a8, 0x080c,
-- 0xb116, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084, 0x00ff, 0x9086,
-+ 0x81d5, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003, 0x05a8, 0x080c,
-+ 0xb101, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084, 0x00ff, 0x9086,
- 0x0035, 0x1138, 0x6028, 0xc0fd, 0x602a, 0x2001, 0x196b, 0x2004,
- 0x0098, 0xa8a0, 0x9084, 0x00ff, 0xa99c, 0x918c, 0xff00, 0x9105,
- 0xa99c, 0x918c, 0x00ff, 0x080c, 0x268c, 0x1540, 0x00b6, 0x080c,
-- 0x67b4, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023, 0x0001, 0x2009,
-+ 0x67ad, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023, 0x0001, 0x2009,
- 0x0040, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x0110, 0x2009,
-- 0x0041, 0x080c, 0xb20a, 0x0005, 0xa87b, 0x0101, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0x7012, 0x012e, 0x0005, 0xa87b, 0x002c, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x0005, 0xa87b, 0x0028,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x080c, 0xb16c,
-+ 0x0041, 0x080c, 0xb1f5, 0x0005, 0xa87b, 0x0101, 0x0126, 0x2091,
-+ 0x8000, 0x080c, 0x7002, 0x012e, 0x0005, 0xa87b, 0x002c, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x7002, 0x012e, 0x0005, 0xa87b, 0x0028,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x7002, 0x012e, 0x080c, 0xb157,
- 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6, 0x7007,
-- 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x81d6, 0xa97c, 0x9188,
-+ 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x81c6, 0xa97c, 0x9188,
- 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140, 0x05e8, 0x8007,
- 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10, 0x080c,
-- 0xb116, 0x1118, 0x080c, 0xb1dd, 0x05a8, 0x6212, 0xa874, 0x0002,
-- 0x81b4, 0x81b9, 0x81bc, 0x81c2, 0x2019, 0x0002, 0x080c, 0xe9f9,
-- 0x0060, 0x080c, 0xe984, 0x0048, 0x2019, 0x0002, 0xa980, 0x080c,
-- 0xe9a3, 0x0018, 0xa980, 0x080c, 0xe984, 0x080c, 0xb16c, 0xa887,
-- 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x00be,
-+ 0xb101, 0x1118, 0x080c, 0xb1c8, 0x05a8, 0x6212, 0xa874, 0x0002,
-+ 0x81a4, 0x81a9, 0x81ac, 0x81b2, 0x2019, 0x0002, 0x080c, 0xe9e0,
-+ 0x0060, 0x080c, 0xe96b, 0x0048, 0x2019, 0x0002, 0xa980, 0x080c,
-+ 0xe98a, 0x0018, 0xa980, 0x080c, 0xe96b, 0x080c, 0xb157, 0xa887,
-+ 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x7002, 0x012e, 0x00be,
- 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005, 0xa887, 0x0006,
- 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50, 0xa887,
- 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091, 0x8000, 0x0e04,
-- 0x81e7, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804, 0x0d8e,
-+ 0x81d7, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804, 0x0d8e,
- 0x2001, 0x1834, 0x2004, 0x9005, 0x0005, 0x0005, 0x00f6, 0x2079,
- 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102, 0x2009,
- 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x1648, 0x00fe, 0x0005,
- 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300, 0x00fe, 0x0005,
-- 0x781c, 0xd08c, 0x0904, 0x8268, 0x68c0, 0x90aa, 0x0005, 0x0a04,
-- 0x8890, 0x7d44, 0x7c40, 0xd59c, 0x190c, 0x0d85, 0x9584, 0x00f6,
-+ 0x781c, 0xd08c, 0x0904, 0x8258, 0x68c0, 0x90aa, 0x0005, 0x0a04,
-+ 0x8880, 0x7d44, 0x7c40, 0xd59c, 0x190c, 0x0d85, 0x9584, 0x00f6,
- 0x1508, 0x9484, 0x7000, 0x0138, 0x908a, 0x2000, 0x1258, 0x9584,
- 0x0700, 0x8007, 0x04f0, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100,
- 0x0db0, 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084, 0xff00,
-- 0x9086, 0x8100, 0x11c0, 0x080c, 0xeeb1, 0x080c, 0x8777, 0x7817,
-- 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x87d3, 0x19c8,
-- 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x82b8, 0x080c, 0x2185,
-- 0x005e, 0x004e, 0x0020, 0x080c, 0xeeb1, 0x7817, 0x0140, 0x080c,
-- 0x779e, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x6893,
-+ 0x9086, 0x8100, 0x11c0, 0x080c, 0xee98, 0x080c, 0x8767, 0x7817,
-+ 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x87c3, 0x19c8,
-+ 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x82a8, 0x080c, 0x2185,
-+ 0x005e, 0x004e, 0x0020, 0x080c, 0xee98, 0x7817, 0x0140, 0x080c,
-+ 0x778e, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x6893,
- 0x0000, 0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000, 0x0489,
-- 0x0005, 0x0002, 0x8275, 0x8585, 0x8272, 0x8272, 0x8272, 0x8272,
-- 0x8272, 0x8272, 0x7817, 0x0140, 0x0005, 0x7000, 0x908c, 0xff00,
-+ 0x0005, 0x0002, 0x8265, 0x8575, 0x8262, 0x8262, 0x8262, 0x8262,
-+ 0x8262, 0x8262, 0x7817, 0x0140, 0x0005, 0x7000, 0x908c, 0xff00,
- 0x9194, 0xf000, 0x810f, 0x9484, 0x0fff, 0x6892, 0x9286, 0x2000,
-- 0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x58aa, 0x0070,
-- 0x080c, 0x82d8, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c, 0x84bf,
-- 0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x86a4, 0x7817, 0x0140,
-+ 0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x58a8, 0x0070,
-+ 0x080c, 0x82c8, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c, 0x84af,
-+ 0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x8694, 0x7817, 0x0140,
- 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0178, 0x2001, 0x1800,
- 0x2004, 0x9086, 0x0003, 0x1148, 0x0026, 0x0036, 0x2011, 0x8048,
-- 0x2518, 0x080c, 0x4ca1, 0x003e, 0x002e, 0x0005, 0x0036, 0x0046,
-+ 0x2518, 0x080c, 0x4c9f, 0x003e, 0x002e, 0x0005, 0x0036, 0x0046,
- 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe, 0x7c30, 0x0050,
- 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x7d44, 0x7c40,
- 0x2019, 0xffff, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0160, 0x2001,
- 0x1800, 0x2004, 0x9086, 0x0003, 0x1130, 0x0026, 0x2011, 0x8048,
-- 0x080c, 0x4ca1, 0x002e, 0x00fe, 0x005e, 0x004e, 0x003e, 0x0005,
-+ 0x080c, 0x4c9f, 0x002e, 0x00fe, 0x005e, 0x004e, 0x003e, 0x0005,
- 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00, 0x8007, 0x9096, 0x0001,
-- 0x0120, 0x9096, 0x0023, 0x1904, 0x8490, 0x9186, 0x0023, 0x15c0,
-- 0x080c, 0x8742, 0x0904, 0x8490, 0x6120, 0x9186, 0x0001, 0x0150,
-+ 0x0120, 0x9096, 0x0023, 0x1904, 0x8480, 0x9186, 0x0023, 0x15c0,
-+ 0x080c, 0x8732, 0x0904, 0x8480, 0x6120, 0x9186, 0x0001, 0x0150,
- 0x9186, 0x0004, 0x0138, 0x9186, 0x0008, 0x0120, 0x9186, 0x000a,
-- 0x1904, 0x8490, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1130,
-- 0x2009, 0x0015, 0x080c, 0xb20a, 0x0804, 0x8490, 0x908e, 0x0214,
-- 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c, 0xb20a,
-- 0x0804, 0x8490, 0x908e, 0x0100, 0x1904, 0x8490, 0x7034, 0x9005,
-- 0x1904, 0x8490, 0x2009, 0x0016, 0x080c, 0xb20a, 0x0804, 0x8490,
-- 0x9186, 0x0022, 0x1904, 0x8490, 0x7030, 0x908e, 0x0300, 0x1580,
-+ 0x1904, 0x8480, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1130,
-+ 0x2009, 0x0015, 0x080c, 0xb1f5, 0x0804, 0x8480, 0x908e, 0x0214,
-+ 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c, 0xb1f5,
-+ 0x0804, 0x8480, 0x908e, 0x0100, 0x1904, 0x8480, 0x7034, 0x9005,
-+ 0x1904, 0x8480, 0x2009, 0x0016, 0x080c, 0xb1f5, 0x0804, 0x8480,
-+ 0x9186, 0x0022, 0x1904, 0x8480, 0x7030, 0x908e, 0x0300, 0x1580,
- 0x68dc, 0xd0a4, 0x0528, 0xc0b5, 0x68de, 0x7100, 0x918c, 0x00ff,
- 0x697e, 0x7004, 0x6882, 0x00f6, 0x2079, 0x0100, 0x79e6, 0x78ea,
- 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008, 0x080c, 0x26d5, 0x7932,
- 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x268c, 0x695e, 0x703c,
- 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0x1800, 0x70b6, 0x00ee,
-- 0x7034, 0x9005, 0x1904, 0x8490, 0x2009, 0x0017, 0x0804, 0x8440,
-- 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904, 0x8490, 0x080c,
-- 0x779e, 0x0120, 0x2009, 0x001d, 0x0804, 0x8440, 0x68dc, 0xc0a5,
-- 0x68de, 0x2009, 0x0030, 0x0804, 0x8440, 0x908e, 0x0500, 0x1140,
-- 0x7034, 0x9005, 0x1904, 0x8490, 0x2009, 0x0018, 0x0804, 0x8440,
-- 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804, 0x8440, 0x908e,
-- 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x8440, 0x908e, 0x5200,
-- 0x1140, 0x7034, 0x9005, 0x1904, 0x8490, 0x2009, 0x001b, 0x0804,
-- 0x8440, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005, 0x1904, 0x8490,
-- 0x2009, 0x001c, 0x0804, 0x8440, 0x908e, 0x1300, 0x1120, 0x2009,
-- 0x0034, 0x0804, 0x8440, 0x908e, 0x1200, 0x1140, 0x7034, 0x9005,
-- 0x1904, 0x8490, 0x2009, 0x0024, 0x0804, 0x8440, 0x908c, 0xff00,
-+ 0x7034, 0x9005, 0x1904, 0x8480, 0x2009, 0x0017, 0x0804, 0x8430,
-+ 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904, 0x8480, 0x080c,
-+ 0x778e, 0x0120, 0x2009, 0x001d, 0x0804, 0x8430, 0x68dc, 0xc0a5,
-+ 0x68de, 0x2009, 0x0030, 0x0804, 0x8430, 0x908e, 0x0500, 0x1140,
-+ 0x7034, 0x9005, 0x1904, 0x8480, 0x2009, 0x0018, 0x0804, 0x8430,
-+ 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804, 0x8430, 0x908e,
-+ 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x8430, 0x908e, 0x5200,
-+ 0x1140, 0x7034, 0x9005, 0x1904, 0x8480, 0x2009, 0x001b, 0x0804,
-+ 0x8430, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005, 0x1904, 0x8480,
-+ 0x2009, 0x001c, 0x0804, 0x8430, 0x908e, 0x1300, 0x1120, 0x2009,
-+ 0x0034, 0x0804, 0x8430, 0x908e, 0x1200, 0x1140, 0x7034, 0x9005,
-+ 0x1904, 0x8480, 0x2009, 0x0024, 0x0804, 0x8430, 0x908c, 0xff00,
- 0x918e, 0x2400, 0x1170, 0x2009, 0x002d, 0x2001, 0x1810, 0x2004,
-- 0xd09c, 0x0904, 0x8440, 0x080c, 0xdd8d, 0x1904, 0x8490, 0x0804,
-- 0x843e, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120, 0x2009, 0x002a,
-- 0x0804, 0x8440, 0x908e, 0x0f00, 0x1120, 0x2009, 0x0020, 0x0804,
-- 0x8440, 0x908e, 0x6104, 0x1530, 0x2029, 0x0205, 0x2011, 0x026d,
-+ 0xd09c, 0x0904, 0x8430, 0x080c, 0xdd78, 0x1904, 0x8480, 0x0804,
-+ 0x842e, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120, 0x2009, 0x002a,
-+ 0x0804, 0x8430, 0x908e, 0x0f00, 0x1120, 0x2009, 0x0020, 0x0804,
-+ 0x8430, 0x908e, 0x6104, 0x1530, 0x2029, 0x0205, 0x2011, 0x026d,
- 0x8208, 0x2204, 0x9082, 0x0004, 0x8004, 0x8004, 0x20a8, 0x2011,
-- 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x4ca1, 0x004e,
-- 0x8108, 0x0f04, 0x83f4, 0x9186, 0x0280, 0x1d88, 0x2504, 0x8000,
-+ 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x4c9f, 0x004e,
-+ 0x8108, 0x0f04, 0x83e4, 0x9186, 0x0280, 0x1d88, 0x2504, 0x8000,
- 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b, 0x0000, 0x2009, 0x0023,
-- 0x0804, 0x8440, 0x908e, 0x6000, 0x1120, 0x2009, 0x003f, 0x0804,
-- 0x8440, 0x908e, 0x5400, 0x1138, 0x080c, 0x8840, 0x1904, 0x8490,
-- 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500, 0x1148, 0x080c, 0x8868,
-+ 0x0804, 0x8430, 0x908e, 0x6000, 0x1120, 0x2009, 0x003f, 0x0804,
-+ 0x8430, 0x908e, 0x5400, 0x1138, 0x080c, 0x8830, 0x1904, 0x8480,
-+ 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500, 0x1148, 0x080c, 0x8858,
- 0x1118, 0x2009, 0x0041, 0x0460, 0x2009, 0x0042, 0x0448, 0x908e,
- 0x7800, 0x1118, 0x2009, 0x0045, 0x0418, 0x908e, 0x1000, 0x1118,
- 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300, 0x1118, 0x2009, 0x004a,
-@@ -4027,72 +4013,72 @@ unsigned short risc_code01[] = {
- 0x0078, 0x908c, 0xff00, 0x918e, 0x5700, 0x1118, 0x2009, 0x0050,
- 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110, 0x2009, 0x004c,
- 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x268c,
-- 0x1904, 0x8493, 0x080c, 0x6749, 0x1904, 0x8493, 0xbe12, 0xbd16,
-- 0x001e, 0x0016, 0x080c, 0x779e, 0x01c0, 0x68dc, 0xd08c, 0x1148,
-+ 0x1904, 0x8483, 0x080c, 0x6742, 0x1904, 0x8483, 0xbe12, 0xbd16,
-+ 0x001e, 0x0016, 0x080c, 0x778e, 0x01c0, 0x68dc, 0xd08c, 0x1148,
- 0x7000, 0x9084, 0x00ff, 0x1188, 0x7004, 0x9084, 0xff00, 0x1168,
- 0x0040, 0x687c, 0x9606, 0x1148, 0x6880, 0x9506, 0x9084, 0xff00,
- 0x1120, 0x9584, 0x00ff, 0xb886, 0x0080, 0xb884, 0x9005, 0x1168,
- 0x9186, 0x0046, 0x1150, 0x687c, 0x9606, 0x1138, 0x6880, 0x9506,
-- 0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0xb116, 0x01a8,
-+ 0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0xb101, 0x01a8,
- 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x9186,
-- 0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0xb20a,
-+ 0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0xb1f5,
- 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001, 0x180e, 0x2004,
-- 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4ca1, 0x080c, 0xb1dd,
-+ 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4c9f, 0x080c, 0xb1c8,
- 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e,
- 0x0016, 0x9186, 0x0017, 0x0118, 0x9186, 0x0030, 0x1128, 0x6007,
- 0x0009, 0x6017, 0x2900, 0x0020, 0x6007, 0x0051, 0x6017, 0x0000,
-- 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x961e, 0x08a0, 0x080c,
-- 0x88af, 0x1158, 0x080c, 0x344c, 0x1140, 0x7010, 0x9084, 0xff00,
-+ 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x960e, 0x08a0, 0x080c,
-+ 0x889f, 0x1158, 0x080c, 0x344c, 0x1140, 0x7010, 0x9084, 0xff00,
- 0x8007, 0x908e, 0x0008, 0x1108, 0x0009, 0x0005, 0x00b6, 0x00c6,
- 0x0046, 0x7000, 0x908c, 0xff00, 0x810f, 0x9186, 0x0033, 0x11e8,
-- 0x080c, 0x8742, 0x0904, 0x851d, 0x7124, 0x610a, 0x7030, 0x908e,
-+ 0x080c, 0x8732, 0x0904, 0x850d, 0x7124, 0x610a, 0x7030, 0x908e,
- 0x0200, 0x1140, 0x7034, 0x9005, 0x15c0, 0x2009, 0x0015, 0x080c,
-- 0xb20a, 0x0498, 0x908e, 0x0100, 0x1580, 0x7034, 0x9005, 0x1568,
-- 0x2009, 0x0016, 0x080c, 0xb20a, 0x0440, 0x9186, 0x0032, 0x1528,
-+ 0xb1f5, 0x0498, 0x908e, 0x0100, 0x1580, 0x7034, 0x9005, 0x1568,
-+ 0x2009, 0x0016, 0x080c, 0xb1f5, 0x0440, 0x9186, 0x0032, 0x1528,
- 0x7030, 0x908e, 0x1400, 0x1508, 0x2009, 0x0038, 0x0016, 0x2011,
- 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x268c, 0x11a8, 0x080c,
-- 0x6749, 0x1190, 0xbe12, 0xbd16, 0x080c, 0xb116, 0x0168, 0x2b08,
-- 0x6112, 0x080c, 0xd3b6, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e,
-- 0x080c, 0xb20a, 0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be,
-+ 0x6742, 0x1190, 0xbe12, 0xbd16, 0x080c, 0xb101, 0x0168, 0x2b08,
-+ 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e,
-+ 0x080c, 0xb1f5, 0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be,
- 0x0005, 0x00b6, 0x0046, 0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696,
- 0x00ff, 0x11b8, 0x9592, 0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120,
-- 0x2009, 0x007f, 0x0804, 0x857f, 0x9596, 0xfffe, 0x1120, 0x2009,
-- 0x007e, 0x0804, 0x857f, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080,
-+ 0x2009, 0x007f, 0x0804, 0x856f, 0x9596, 0xfffe, 0x1120, 0x2009,
-+ 0x007e, 0x0804, 0x856f, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080,
- 0x04f0, 0x2011, 0x0000, 0x2019, 0x1837, 0x231c, 0xd3ac, 0x0130,
- 0x9026, 0x20a9, 0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x0081,
- 0x20a9, 0x077f, 0x2071, 0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140,
- 0x82ff, 0x11d0, 0x9496, 0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0,
- 0xbf10, 0x2600, 0x9706, 0xb814, 0x1120, 0x9546, 0x1110, 0x2408,
- 0x00b0, 0x9745, 0x1148, 0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f,
-- 0x0118, 0x94c6, 0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x8554,
-+ 0x0118, 0x94c6, 0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x8544,
- 0x82ff, 0x1118, 0x9085, 0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006,
- 0x00de, 0x00ee, 0x004e, 0x00be, 0x0005, 0x2001, 0x1837, 0x200c,
- 0x9184, 0x0080, 0x0110, 0xd18c, 0x0138, 0x7000, 0x908c, 0xff00,
-- 0x810f, 0x9184, 0x000f, 0x001a, 0x7817, 0x0140, 0x0005, 0x85a7,
-- 0x85a7, 0x85a7, 0x8754, 0x85a7, 0x85aa, 0x85cf, 0x8658, 0x85a7,
-- 0x85a7, 0x85a7, 0x85a7, 0x85a7, 0x85a7, 0x85a7, 0x85a7, 0x7817,
-+ 0x810f, 0x9184, 0x000f, 0x001a, 0x7817, 0x0140, 0x0005, 0x8597,
-+ 0x8597, 0x8597, 0x8744, 0x8597, 0x859a, 0x85bf, 0x8648, 0x8597,
-+ 0x8597, 0x8597, 0x8597, 0x8597, 0x8597, 0x8597, 0x8597, 0x7817,
- 0x0140, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120, 0x2160,
- 0x9c8c, 0x0003, 0x11c0, 0x9c8a, 0x1ddc, 0x02a8, 0x6868, 0x9c02,
- 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106,
- 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a, 0x2009,
-- 0x0046, 0x080c, 0xb20a, 0x7817, 0x0140, 0x00be, 0x0005, 0x00b6,
-- 0x00c6, 0x9484, 0x0fff, 0x0904, 0x8634, 0x7110, 0xd1bc, 0x1904,
-- 0x8634, 0x7108, 0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094,
-+ 0x0046, 0x080c, 0xb1f5, 0x7817, 0x0140, 0x00be, 0x0005, 0x00b6,
-+ 0x00c6, 0x9484, 0x0fff, 0x0904, 0x8624, 0x7110, 0xd1bc, 0x1904,
-+ 0x8624, 0x7108, 0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094,
- 0xff00, 0x15c8, 0x81ff, 0x15b8, 0x9080, 0x348e, 0x200d, 0x918c,
-- 0xff00, 0x810f, 0x2001, 0x0080, 0x9106, 0x0904, 0x8634, 0x9182,
-- 0x0801, 0x1a04, 0x8634, 0x9190, 0x1000, 0x2204, 0x905d, 0x05e0,
-+ 0xff00, 0x810f, 0x2001, 0x0080, 0x9106, 0x0904, 0x8624, 0x9182,
-+ 0x0801, 0x1a04, 0x8624, 0x9190, 0x1000, 0x2204, 0x905d, 0x05e0,
- 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15b8, 0xba04, 0x9294, 0xff00,
-- 0x9286, 0x0600, 0x1190, 0x080c, 0xb116, 0x0598, 0x2b08, 0x7028,
-+ 0x9286, 0x0600, 0x1190, 0x080c, 0xb101, 0x0598, 0x2b08, 0x7028,
- 0x604e, 0x702c, 0x6052, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a,
-- 0x7130, 0x615e, 0x080c, 0xe009, 0x00f8, 0x080c, 0x6c11, 0x1138,
-- 0xb807, 0x0606, 0x0c40, 0x190c, 0x8521, 0x11b0, 0x0880, 0x080c,
-- 0xb116, 0x2b08, 0x0188, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
-+ 0x7130, 0x615e, 0x080c, 0xdff4, 0x00f8, 0x080c, 0x6c01, 0x1138,
-+ 0xb807, 0x0606, 0x0c40, 0x190c, 0x8511, 0x11b0, 0x0880, 0x080c,
-+ 0xb101, 0x2b08, 0x0188, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
- 0x9286, 0x0400, 0x1118, 0x6007, 0x0005, 0x0010, 0x6007, 0x0001,
-- 0x6003, 0x0001, 0x080c, 0x961e, 0x7817, 0x0140, 0x00ce, 0x00be,
-+ 0x6003, 0x0001, 0x080c, 0x960e, 0x7817, 0x0140, 0x00ce, 0x00be,
- 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049,
-- 0x080c, 0x4ca1, 0x080c, 0xb1dd, 0x0d78, 0x2b08, 0x6112, 0x6023,
-+ 0x080c, 0x4c9f, 0x080c, 0xb1c8, 0x0d78, 0x2b08, 0x6112, 0x6023,
- 0x0006, 0x7120, 0x610a, 0x7130, 0x615e, 0x6017, 0xf300, 0x6003,
-- 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x9617, 0x08e0,
-+ 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x9607, 0x08e0,
- 0x00b6, 0x7110, 0xd1bc, 0x05d0, 0x7020, 0x2060, 0x9c84, 0x0003,
- 0x15a8, 0x9c82, 0x1ddc, 0x0690, 0x6868, 0x9c02, 0x1678, 0x9484,
- 0x0fff, 0x9082, 0x000c, 0x0650, 0x7008, 0x9084, 0x00ff, 0x6110,
-@@ -4100,69 +4086,69 @@ unsigned short risc_code01[] = {
- 0x7124, 0x610a, 0x601c, 0xd0fc, 0x11c8, 0x2001, 0x0271, 0x2004,
- 0x9005, 0x1180, 0x9484, 0x0fff, 0x9082, 0x000c, 0x0158, 0x0066,
- 0x2031, 0x0100, 0xa001, 0xa001, 0x8631, 0x1de0, 0x006e, 0x601c,
-- 0xd0fc, 0x1120, 0x2009, 0x0045, 0x080c, 0xb20a, 0x7817, 0x0140,
-+ 0xd0fc, 0x1120, 0x2009, 0x0045, 0x080c, 0xb1f5, 0x7817, 0x0140,
- 0x00be, 0x0005, 0x6120, 0x9186, 0x0002, 0x0128, 0x9186, 0x0005,
-- 0x0110, 0x9085, 0x0001, 0x0005, 0x080c, 0x88af, 0x1180, 0x080c,
-+ 0x0110, 0x9085, 0x0001, 0x0005, 0x080c, 0x889f, 0x1180, 0x080c,
- 0x344c, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086, 0x0000,
- 0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b, 0x0005,
-- 0x86be, 0x86bf, 0x86be, 0x86be, 0x8724, 0x8733, 0x0005, 0x00b6,
-- 0x700c, 0x7108, 0x080c, 0x268c, 0x1904, 0x8722, 0x080c, 0x6749,
-- 0x1904, 0x8722, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x0540, 0x702c,
-- 0xd084, 0x1120, 0xb800, 0xd0bc, 0x1904, 0x8722, 0x080c, 0x6c11,
-- 0x0148, 0x9086, 0x0004, 0x0130, 0x080c, 0x6c19, 0x0118, 0x9086,
-- 0x0004, 0x1588, 0x00c6, 0x080c, 0x8742, 0x00ce, 0x05d8, 0x080c,
-- 0xb116, 0x2b08, 0x05b8, 0x6112, 0x080c, 0xd3b6, 0x6023, 0x0002,
-- 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xb20a, 0x0458, 0x080c,
-- 0x6c11, 0x0148, 0x9086, 0x0004, 0x0130, 0x080c, 0x6c19, 0x0118,
-- 0x9086, 0x0004, 0x1180, 0x080c, 0xb116, 0x2b08, 0x01d8, 0x6112,
-- 0x080c, 0xd3b6, 0x6023, 0x0005, 0x7120, 0x610a, 0x2009, 0x0088,
-- 0x080c, 0xb20a, 0x0078, 0x080c, 0xb116, 0x2b08, 0x0158, 0x6112,
-- 0x080c, 0xd3b6, 0x6023, 0x0004, 0x7120, 0x610a, 0x2009, 0x0001,
-- 0x080c, 0xb20a, 0x00be, 0x0005, 0x7110, 0xd1bc, 0x0158, 0x00d1,
-- 0x0148, 0x080c, 0x869a, 0x1130, 0x7124, 0x610a, 0x2009, 0x0089,
-- 0x080c, 0xb20a, 0x0005, 0x7110, 0xd1bc, 0x0158, 0x0059, 0x0148,
-- 0x080c, 0x869a, 0x1130, 0x7124, 0x610a, 0x2009, 0x008a, 0x080c,
-- 0xb20a, 0x0005, 0x7020, 0x2060, 0x9c84, 0x0003, 0x1158, 0x9c82,
-+ 0x86ae, 0x86af, 0x86ae, 0x86ae, 0x8714, 0x8723, 0x0005, 0x00b6,
-+ 0x700c, 0x7108, 0x080c, 0x268c, 0x1904, 0x8712, 0x080c, 0x6742,
-+ 0x1904, 0x8712, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x0540, 0x702c,
-+ 0xd084, 0x1120, 0xb800, 0xd0bc, 0x1904, 0x8712, 0x080c, 0x6c01,
-+ 0x0148, 0x9086, 0x0004, 0x0130, 0x080c, 0x6c09, 0x0118, 0x9086,
-+ 0x0004, 0x1588, 0x00c6, 0x080c, 0x8732, 0x00ce, 0x05d8, 0x080c,
-+ 0xb101, 0x2b08, 0x05b8, 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0002,
-+ 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xb1f5, 0x0458, 0x080c,
-+ 0x6c01, 0x0148, 0x9086, 0x0004, 0x0130, 0x080c, 0x6c09, 0x0118,
-+ 0x9086, 0x0004, 0x1180, 0x080c, 0xb101, 0x2b08, 0x01d8, 0x6112,
-+ 0x080c, 0xd3a3, 0x6023, 0x0005, 0x7120, 0x610a, 0x2009, 0x0088,
-+ 0x080c, 0xb1f5, 0x0078, 0x080c, 0xb101, 0x2b08, 0x0158, 0x6112,
-+ 0x080c, 0xd3a3, 0x6023, 0x0004, 0x7120, 0x610a, 0x2009, 0x0001,
-+ 0x080c, 0xb1f5, 0x00be, 0x0005, 0x7110, 0xd1bc, 0x0158, 0x00d1,
-+ 0x0148, 0x080c, 0x868a, 0x1130, 0x7124, 0x610a, 0x2009, 0x0089,
-+ 0x080c, 0xb1f5, 0x0005, 0x7110, 0xd1bc, 0x0158, 0x0059, 0x0148,
-+ 0x080c, 0x868a, 0x1130, 0x7124, 0x610a, 0x2009, 0x008a, 0x080c,
-+ 0xb1f5, 0x0005, 0x7020, 0x2060, 0x9c84, 0x0003, 0x1158, 0x9c82,
- 0x1ddc, 0x0240, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1218, 0x9085,
- 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6, 0x7110, 0xd1bc, 0x11d8,
- 0x7024, 0x2060, 0x9c84, 0x0003, 0x11b0, 0x9c82, 0x1ddc, 0x0298,
- 0x6868, 0x9c02, 0x1280, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158,
- 0xb910, 0x9106, 0x1140, 0x700c, 0xb914, 0x9106, 0x1120, 0x2009,
-- 0x0051, 0x080c, 0xb20a, 0x7817, 0x0140, 0x00be, 0x0005, 0x2031,
-+ 0x0051, 0x080c, 0xb1f5, 0x7817, 0x0140, 0x00be, 0x0005, 0x2031,
- 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049, 0x0005, 0x2031,
- 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009, 0x0005, 0x00c6,
- 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086, 0xc000, 0x05c0,
-- 0x080c, 0xb116, 0x05a8, 0x0066, 0x00c6, 0x0046, 0x2011, 0x0263,
-- 0x2204, 0x8211, 0x220c, 0x080c, 0x268c, 0x1590, 0x080c, 0x6749,
-+ 0x080c, 0xb101, 0x05a8, 0x0066, 0x00c6, 0x0046, 0x2011, 0x0263,
-+ 0x2204, 0x8211, 0x220c, 0x080c, 0x268c, 0x1590, 0x080c, 0x6742,
- 0x1578, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce, 0x6012, 0x080c,
-- 0xd3b6, 0x080c, 0x1059, 0x0500, 0x2900, 0x6062, 0x9006, 0xa802,
-+ 0xd3a3, 0x080c, 0x1059, 0x0500, 0x2900, 0x6062, 0x9006, 0xa802,
- 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9, 0x000e, 0xa860,
- 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003, 0x006e, 0x6616,
-- 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001, 0x080c, 0x961e,
-- 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c, 0xb16c, 0x006e, 0x0cc0,
-+ 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001, 0x080c, 0x960e,
-+ 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c, 0xb157, 0x006e, 0x0cc0,
- 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000, 0x908c, 0xff00, 0x9184,
-- 0xf000, 0x810f, 0x9086, 0x2000, 0x1904, 0x882a, 0x9186, 0x0022,
-- 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005, 0x1904, 0x882c, 0x7030,
-- 0x908e, 0x0400, 0x0904, 0x882c, 0x908e, 0x6000, 0x05e8, 0x908e,
-+ 0xf000, 0x810f, 0x9086, 0x2000, 0x1904, 0x881a, 0x9186, 0x0022,
-+ 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005, 0x1904, 0x881c, 0x7030,
-+ 0x908e, 0x0400, 0x0904, 0x881c, 0x908e, 0x6000, 0x05e8, 0x908e,
- 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8, 0x2009, 0x1837, 0x210c,
-- 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c, 0x6bcf, 0x0588, 0x68b0,
-+ 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c, 0x6bbf, 0x0588, 0x68b0,
- 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff, 0x9106, 0x1518, 0x6880,
- 0x69b0, 0x918c, 0xff00, 0x9105, 0x7104, 0x9106, 0x11d8, 0x00e0,
- 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8, 0x908e, 0x5200, 0x09e8,
- 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000, 0x09b8, 0x0058, 0x9186,
-- 0x0023, 0x1140, 0x080c, 0x8742, 0x0128, 0x6004, 0x9086, 0x0002,
-+ 0x0023, 0x1140, 0x080c, 0x8732, 0x0128, 0x6004, 0x9086, 0x0002,
- 0x0118, 0x0000, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x0005,
- 0x7030, 0x908e, 0x0300, 0x0118, 0x908e, 0x5200, 0x1d98, 0x2001,
- 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x0d68, 0x0c50,
- 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020, 0x8427, 0x94a4,
- 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-- 0x027a, 0x080c, 0xc20e, 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004,
-- 0x2019, 0x1801, 0x2011, 0x027e, 0x080c, 0xc20e, 0x1120, 0xd494,
-+ 0x027a, 0x080c, 0xc1f9, 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004,
-+ 0x2019, 0x1801, 0x2011, 0x027e, 0x080c, 0xc1f9, 0x1120, 0xd494,
- 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e, 0x015e, 0x0005,
- 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020, 0x8427, 0x94a4,
- 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-- 0x0272, 0x080c, 0xc20e, 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004,
-- 0x2019, 0x1801, 0x2011, 0x0276, 0x080c, 0xc20e, 0x1120, 0xd494,
-+ 0x0272, 0x080c, 0xc1f9, 0x1178, 0xd48c, 0x0148, 0x20a9, 0x0004,
-+ 0x2019, 0x1801, 0x2011, 0x0276, 0x080c, 0xc1f9, 0x1120, 0xd494,
- 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e, 0x015e, 0x0005,
- 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5, 0xc0cc, 0x7802, 0x00fe,
- 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834, 0xd084, 0x1130, 0x2079,
-@@ -4171,53 +4157,53 @@ unsigned short risc_code01[] = {
- 0x2001, 0x1837, 0x200c, 0x9184, 0x0080, 0x0118, 0xd18c, 0x0118,
- 0x9006, 0x001e, 0x0005, 0x9085, 0x0001, 0x0cd8, 0x2071, 0x1a04,
- 0x7003, 0x0003, 0x700f, 0x0361, 0x9006, 0x701a, 0x707a, 0x7012,
-- 0x7017, 0x1ddc, 0x7007, 0x0000, 0x7026, 0x702b, 0xa2c0, 0x7032,
-- 0x7037, 0xa33d, 0x7047, 0xffff, 0x704a, 0x704f, 0x56c4, 0x7052,
-- 0x7063, 0x8a66, 0x080c, 0x1072, 0x090c, 0x0d85, 0x2900, 0x7042,
-+ 0x7017, 0x1ddc, 0x7007, 0x0000, 0x7026, 0x702b, 0xa2b0, 0x7032,
-+ 0x7037, 0xa32d, 0x7047, 0xffff, 0x704a, 0x704f, 0x56c2, 0x7052,
-+ 0x7063, 0x8a56, 0x080c, 0x1072, 0x090c, 0x0d85, 0x2900, 0x7042,
- 0xa867, 0x0003, 0xa86f, 0x0100, 0xa8ab, 0xdcb0, 0x0005, 0x2071,
-- 0x1a04, 0x1d04, 0x8982, 0x2091, 0x6000, 0x700c, 0x8001, 0x700e,
-- 0x1590, 0x2001, 0x013c, 0x2004, 0x9005, 0x190c, 0x8b10, 0x2001,
-+ 0x1a04, 0x1d04, 0x8972, 0x2091, 0x6000, 0x700c, 0x8001, 0x700e,
-+ 0x1590, 0x2001, 0x013c, 0x2004, 0x9005, 0x190c, 0x8b00, 0x2001,
- 0x1869, 0x2004, 0xd0c4, 0x0158, 0x3a00, 0xd08c, 0x1140, 0x20d1,
- 0x0000, 0x20d1, 0x0001, 0x20d1, 0x0000, 0x080c, 0x0d85, 0x700f,
- 0x0361, 0x7007, 0x0001, 0x0126, 0x2091, 0x8000, 0x2069, 0x1800,
-- 0x69ec, 0xd1e4, 0x1138, 0xd1dc, 0x1118, 0x080c, 0x8ad4, 0x0010,
-- 0x080c, 0x8aab, 0x7048, 0x900d, 0x0148, 0x8109, 0x714a, 0x1130,
-+ 0x69ec, 0xd1e4, 0x1138, 0xd1dc, 0x1118, 0x080c, 0x8ac4, 0x0010,
-+ 0x080c, 0x8a9b, 0x7048, 0x900d, 0x0148, 0x8109, 0x714a, 0x1130,
- 0x704c, 0x080f, 0x0018, 0x0126, 0x2091, 0x8000, 0x7024, 0x900d,
- 0x0188, 0x7020, 0x8001, 0x7022, 0x1168, 0x7023, 0x0009, 0x8109,
- 0x7126, 0x9186, 0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110,
- 0x7028, 0x080f, 0x7030, 0x900d, 0x0180, 0x702c, 0x8001, 0x702e,
- 0x1160, 0x702f, 0x0009, 0x8109, 0x7132, 0x0128, 0x9184, 0x007f,
-- 0x090c, 0xa3eb, 0x0010, 0x7034, 0x080f, 0x7044, 0x9005, 0x0118,
-+ 0x090c, 0xa3db, 0x0010, 0x7034, 0x080f, 0x7044, 0x9005, 0x0118,
- 0x0310, 0x8001, 0x7046, 0x7054, 0x900d, 0x0168, 0x7050, 0x8001,
- 0x7052, 0x1148, 0x7053, 0x0009, 0x8109, 0x7156, 0x1120, 0x7158,
- 0x7156, 0x7060, 0x080f, 0x7018, 0x900d, 0x01d8, 0x0016, 0x7078,
- 0x900d, 0x0158, 0x7074, 0x8001, 0x7076, 0x1138, 0x7077, 0x0009,
- 0x8109, 0x717a, 0x1110, 0x707c, 0x080f, 0x001e, 0x7008, 0x8001,
- 0x700a, 0x1138, 0x700b, 0x0009, 0x8109, 0x711a, 0x1110, 0x701c,
-- 0x080f, 0x012e, 0x7004, 0x0002, 0x89aa, 0x89ab, 0x89d5, 0x00e6,
-+ 0x080f, 0x012e, 0x7004, 0x0002, 0x899a, 0x899b, 0x89c5, 0x00e6,
- 0x2071, 0x1a04, 0x7018, 0x9005, 0x1120, 0x711a, 0x721e, 0x700b,
- 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x1a04, 0x701c,
- 0x9206, 0x1120, 0x701a, 0x701e, 0x707a, 0x707e, 0x000e, 0x00ee,
- 0x0005, 0x00e6, 0x2071, 0x1a04, 0xb888, 0x9102, 0x0208, 0xb98a,
- 0x00ee, 0x0005, 0x0005, 0x00b6, 0x2031, 0x0010, 0x7110, 0x080c,
-- 0x67b4, 0x11a8, 0xb888, 0x8001, 0x0290, 0xb88a, 0x1180, 0x0126,
-+ 0x67ad, 0x11a8, 0xb888, 0x8001, 0x0290, 0xb88a, 0x1180, 0x0126,
- 0x2091, 0x8000, 0x0066, 0xb8d0, 0x9005, 0x0138, 0x0026, 0xba3c,
-- 0x0016, 0x080c, 0x68df, 0x001e, 0x002e, 0x006e, 0x012e, 0x8108,
-+ 0x0016, 0x080c, 0x68d8, 0x001e, 0x002e, 0x006e, 0x012e, 0x8108,
- 0x9182, 0x0800, 0x1220, 0x8631, 0x0128, 0x7112, 0x0c00, 0x900e,
- 0x7007, 0x0002, 0x7112, 0x00be, 0x0005, 0x2031, 0x0010, 0x7014,
- 0x2060, 0x0126, 0x2091, 0x8000, 0x6048, 0x9005, 0x0128, 0x8001,
-- 0x604a, 0x1110, 0x080c, 0xd237, 0x6018, 0x9005, 0x0904, 0x8a2d,
-- 0x00f6, 0x2079, 0x0300, 0x7918, 0xd1b4, 0x1904, 0x8a40, 0x781b,
-+ 0x604a, 0x1110, 0x080c, 0xd224, 0x6018, 0x9005, 0x0904, 0x8a1d,
-+ 0x00f6, 0x2079, 0x0300, 0x7918, 0xd1b4, 0x1904, 0x8a30, 0x781b,
- 0x2020, 0xa001, 0x7918, 0xd1b4, 0x0120, 0x781b, 0x2000, 0x0804,
-- 0x8a40, 0x8001, 0x601a, 0x0106, 0x781b, 0x2000, 0xa001, 0x7918,
-+ 0x8a30, 0x8001, 0x601a, 0x0106, 0x781b, 0x2000, 0xa001, 0x7918,
- 0xd1ac, 0x1dd0, 0x010e, 0x00fe, 0x1540, 0x6120, 0x9186, 0x0003,
- 0x0148, 0x9186, 0x0006, 0x0130, 0x9186, 0x0009, 0x11e0, 0x611c,
-- 0xd1c4, 0x1100, 0x080c, 0xcf1b, 0x01b0, 0x6014, 0x2048, 0xa884,
-+ 0xd1c4, 0x1100, 0x080c, 0xcf08, 0x01b0, 0x6014, 0x2048, 0xa884,
- 0x908a, 0x199a, 0x0280, 0x9082, 0x1999, 0xa886, 0x908a, 0x199a,
- 0x0210, 0x2001, 0x1999, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a,
-- 0x080c, 0xd671, 0x0110, 0x080c, 0xcbd9, 0x012e, 0x9c88, 0x001c,
-+ 0x080c, 0xd65e, 0x0110, 0x080c, 0xcbc5, 0x012e, 0x9c88, 0x001c,
- 0x7116, 0x2001, 0x181a, 0x2004, 0x9102, 0x1228, 0x8631, 0x0138,
-- 0x2160, 0x0804, 0x89d9, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x0005,
-+ 0x2160, 0x0804, 0x89c9, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x0005,
- 0x00fe, 0x0c58, 0x00e6, 0x2071, 0x1a04, 0x7027, 0x07d0, 0x7023,
- 0x0009, 0x00ee, 0x0005, 0x2001, 0x1a0d, 0x2003, 0x0000, 0x0005,
- 0x00e6, 0x2071, 0x1a04, 0x7132, 0x702f, 0x0009, 0x00ee, 0x0005,
-@@ -4227,7 +4213,7 @@ unsigned short risc_code01[] = {
- 0x0000, 0x0150, 0x7070, 0xa09a, 0x706c, 0xa096, 0x7068, 0xa092,
- 0x7064, 0xa08e, 0x080c, 0x114e, 0x002e, 0x008e, 0x0005, 0x0006,
- 0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-- 0x0156, 0x080c, 0x88e7, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-+ 0x0156, 0x080c, 0x88d7, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
- 0x00be, 0x00ae, 0x009e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071,
- 0x1a04, 0x717a, 0x727e, 0x7077, 0x0009, 0x00ee, 0x0005, 0x00e6,
- 0x0006, 0x2071, 0x1a04, 0x707c, 0x9206, 0x1110, 0x707a, 0x707e,
-@@ -4252,8 +4238,8 @@ unsigned short risc_code01[] = {
- 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a73, 0x6014, 0x00ce, 0x9005,
- 0x1130, 0x2001, 0x001e, 0x0018, 0x908e, 0xffff, 0x01b0, 0x8003,
- 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0x908c, 0x00c0, 0x918e,
-- 0x00c0, 0x0904, 0x8bee, 0xd0b4, 0x1168, 0xd0bc, 0x1904, 0x8bc7,
-- 0x2009, 0x0006, 0x080c, 0x8c1b, 0x0005, 0x900e, 0x0c60, 0x2001,
-+ 0x00c0, 0x0904, 0x8bde, 0xd0b4, 0x1168, 0xd0bc, 0x1904, 0x8bb7,
-+ 0x2009, 0x0006, 0x080c, 0x8c0b, 0x0005, 0x900e, 0x0c60, 0x2001,
- 0x1999, 0x08b0, 0xd0fc, 0x05e0, 0x908c, 0x2023, 0x1568, 0x87ff,
- 0x1558, 0xa9a8, 0x81ff, 0x1540, 0x6124, 0x918c, 0x0500, 0x1520,
- 0x6100, 0x918e, 0x0007, 0x1500, 0x2009, 0x1869, 0x210c, 0xd184,
-@@ -4261,28 +4247,28 @@ unsigned short risc_code01[] = {
- 0x1c6f, 0xa87c, 0xc0dd, 0xa87e, 0x600f, 0x0000, 0x00f6, 0x2079,
- 0x0380, 0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0013, 0x2c00, 0x7836,
- 0x781b, 0x8080, 0x00fe, 0x0005, 0x908c, 0x0003, 0x0120, 0x918e,
-- 0x0003, 0x1904, 0x8c15, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8,
-+ 0x0003, 0x1904, 0x8c05, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8,
- 0x6024, 0xd0d4, 0x11e8, 0x2009, 0x1869, 0x2104, 0xd084, 0x1138,
-- 0x87ff, 0x1120, 0x2009, 0x0043, 0x0804, 0xb20a, 0x0005, 0x87ff,
-- 0x1de8, 0x2009, 0x0042, 0x0804, 0xb20a, 0x6110, 0x00b6, 0x2158,
-+ 0x87ff, 0x1120, 0x2009, 0x0043, 0x0804, 0xb1f5, 0x0005, 0x87ff,
-+ 0x1de8, 0x2009, 0x0042, 0x0804, 0xb1f5, 0x6110, 0x00b6, 0x2158,
- 0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00,
- 0xc0d4, 0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc,
-- 0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8c15,
-+ 0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8c05,
- 0x908c, 0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78,
- 0x080c, 0x17ad, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042,
-- 0x080c, 0xb20a, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
-+ 0x080c, 0xb1f5, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
- 0xd1ac, 0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188,
- 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e,
-- 0x0002, 0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0xb20a,
-+ 0x0002, 0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0xb1f5,
- 0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c,
-- 0xb20a, 0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
-+ 0xb1f5, 0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
- 0x0d20, 0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019,
-- 0x0005, 0x2009, 0x0001, 0x0096, 0x080c, 0xcf1b, 0x0518, 0x6014,
-+ 0x0005, 0x2009, 0x0001, 0x0096, 0x080c, 0xcf08, 0x0518, 0x6014,
- 0x2048, 0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c,
- 0x918c, 0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a73,
- 0x6200, 0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce,
-- 0x080c, 0x6e4c, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c,
-- 0x8b34, 0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a73,
-+ 0x080c, 0x6e3c, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c,
-+ 0x8b24, 0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a73,
- 0x6000, 0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce,
- 0x015e, 0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120,
- 0x8001, 0x680a, 0x9085, 0x0001, 0x0005, 0x2071, 0x1924, 0x7003,
-@@ -4301,10 +4287,10 @@ unsigned short risc_code01[] = {
- 0x2009, 0x1b73, 0x2104, 0x9080, 0x0007, 0x200a, 0x0005, 0x00e6,
- 0x0126, 0x0156, 0x2091, 0x8000, 0x2071, 0x1800, 0x7154, 0x2001,
- 0x0008, 0x910a, 0x0638, 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080,
-- 0x0008, 0x1f04, 0x8cd7, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877,
-- 0x20a9, 0x0007, 0x00c6, 0x080c, 0xb116, 0x6023, 0x0009, 0x6003,
-+ 0x0008, 0x1f04, 0x8cc7, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877,
-+ 0x20a9, 0x0007, 0x00c6, 0x080c, 0xb101, 0x6023, 0x0009, 0x6003,
- 0x0004, 0x601f, 0x0101, 0x0089, 0x0126, 0x2091, 0x8000, 0x080c,
-- 0x8e58, 0x012e, 0x1f04, 0x8ce3, 0x9006, 0x00ce, 0x015e, 0x012e,
-+ 0x8e48, 0x012e, 0x1f04, 0x8cd3, 0x9006, 0x00ce, 0x015e, 0x012e,
- 0x00ee, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096,
- 0x0086, 0x0056, 0x0046, 0x0026, 0x7118, 0x720c, 0x7620, 0x7004,
- 0xd084, 0x1128, 0x2021, 0x0024, 0x2029, 0x0002, 0x0020, 0x2021,
-@@ -4315,49 +4301,49 @@ unsigned short risc_code01[] = {
- 0x080c, 0x1059, 0x090c, 0x0d85, 0xad66, 0x2b00, 0xa802, 0x2900,
- 0xb806, 0x2058, 0x8109, 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e,
- 0x009e, 0x00be, 0x00ee, 0x0005, 0x2079, 0x0000, 0x2071, 0x1924,
-- 0x7004, 0x004b, 0x700c, 0x0002, 0x8d4f, 0x8d48, 0x8d48, 0x0005,
-- 0x8d59, 0x8daf, 0x8daf, 0x8daf, 0x8db0, 0x8dc1, 0x8dc1, 0x700c,
-+ 0x7004, 0x004b, 0x700c, 0x0002, 0x8d3f, 0x8d38, 0x8d38, 0x0005,
-+ 0x8d49, 0x8d9f, 0x8d9f, 0x8d9f, 0x8da0, 0x8db1, 0x8db1, 0x700c,
- 0x0cba, 0x0126, 0x2091, 0x8000, 0x78a0, 0x79a0, 0x9106, 0x1904,
-- 0x8da1, 0x7814, 0xd0bc, 0x1904, 0x8daa, 0x012e, 0x7018, 0x910a,
-- 0x1128, 0x7030, 0x9005, 0x1904, 0x8df3, 0x0005, 0x1210, 0x7114,
-+ 0x8d91, 0x7814, 0xd0bc, 0x1904, 0x8d9a, 0x012e, 0x7018, 0x910a,
-+ 0x1128, 0x7030, 0x9005, 0x1904, 0x8de3, 0x0005, 0x1210, 0x7114,
- 0x910a, 0x9192, 0x000a, 0x0210, 0x2009, 0x000a, 0x2001, 0x1888,
- 0x2014, 0x2001, 0x1936, 0x2004, 0x9100, 0x9202, 0x0e50, 0x080c,
-- 0x8f53, 0x2200, 0x9102, 0x0208, 0x2208, 0x0096, 0x702c, 0x2048,
-- 0xa873, 0x0001, 0xa976, 0x080c, 0x905c, 0x2100, 0xa87e, 0xa86f,
-+ 0x8f43, 0x2200, 0x9102, 0x0208, 0x2208, 0x0096, 0x702c, 0x2048,
-+ 0xa873, 0x0001, 0xa976, 0x080c, 0x904c, 0x2100, 0xa87e, 0xa86f,
- 0x0000, 0x009e, 0x0126, 0x2091, 0x8000, 0x2009, 0x1a24, 0x2104,
- 0xc085, 0x200a, 0x700f, 0x0002, 0x012e, 0x080c, 0x116d, 0x1de8,
-- 0x0005, 0x78a0, 0x79a0, 0x9106, 0x0904, 0x8d61, 0x080c, 0x8f2b,
-- 0x012e, 0x0005, 0x7810, 0xc0c5, 0x7812, 0x0804, 0x8d61, 0x0005,
-- 0x700c, 0x0002, 0x8db5, 0x8db8, 0x8db7, 0x080c, 0x8d57, 0x0005,
-+ 0x0005, 0x78a0, 0x79a0, 0x9106, 0x0904, 0x8d51, 0x080c, 0x8f1b,
-+ 0x012e, 0x0005, 0x7810, 0xc0c5, 0x7812, 0x0804, 0x8d51, 0x0005,
-+ 0x700c, 0x0002, 0x8da5, 0x8da8, 0x8da7, 0x080c, 0x8d47, 0x0005,
- 0x8001, 0x700e, 0x0096, 0x702c, 0x2048, 0xa974, 0x009e, 0x0011,
- 0x0ca0, 0x0005, 0x0096, 0x702c, 0x2048, 0x7018, 0x9100, 0x7214,
- 0x921a, 0x1130, 0x701c, 0xa88e, 0x7020, 0xa892, 0x9006, 0x0068,
-- 0x0006, 0x080c, 0x905c, 0x2100, 0xaa8c, 0x9210, 0xaa8e, 0x1220,
-+ 0x0006, 0x080c, 0x904c, 0x2100, 0xaa8c, 0x9210, 0xaa8e, 0x1220,
- 0xa890, 0x9081, 0x0000, 0xa892, 0x000e, 0x009e, 0x0126, 0x2091,
-- 0x8000, 0x78a2, 0x701a, 0x080c, 0x8f2b, 0x012e, 0x0005, 0x00e6,
-- 0x2071, 0x1924, 0x700c, 0x0002, 0x8df1, 0x8df1, 0x8def, 0x700f,
-+ 0x8000, 0x78a2, 0x701a, 0x080c, 0x8f1b, 0x012e, 0x0005, 0x00e6,
-+ 0x2071, 0x1924, 0x700c, 0x0002, 0x8de1, 0x8de1, 0x8ddf, 0x700f,
- 0x0001, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x7030, 0x9005,
- 0x0508, 0x2078, 0x7814, 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000,
-- 0x080c, 0x8e61, 0x00be, 0x01b0, 0x00e6, 0x2071, 0x193d, 0x080c,
-- 0x8ea8, 0x00ee, 0x0178, 0x0096, 0x080c, 0x1072, 0x2900, 0x009e,
-+ 0x080c, 0x8e51, 0x00be, 0x01b0, 0x00e6, 0x2071, 0x193d, 0x080c,
-+ 0x8e98, 0x00ee, 0x0178, 0x0096, 0x080c, 0x1072, 0x2900, 0x009e,
- 0x0148, 0xa8aa, 0x04d1, 0x0041, 0x2001, 0x1947, 0x2003, 0x0000,
- 0x012e, 0x08c8, 0x012e, 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6,
- 0x2940, 0x2650, 0x2600, 0x9005, 0x0180, 0xa864, 0x9084, 0x000f,
- 0x2068, 0x9d88, 0x1ec1, 0x2165, 0x0056, 0x2029, 0x0000, 0x080c,
-- 0x8fe1, 0x080c, 0x1e97, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f,
-+ 0x8fd1, 0x080c, 0x1e97, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f,
- 0x2004, 0xa88a, 0x00c6, 0x2f60, 0x080c, 0x17ad, 0x00ce, 0x781f,
-- 0x0101, 0x7813, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x8eb7,
-+ 0x0101, 0x7813, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x8ea7,
- 0x012e, 0x008e, 0x00ce, 0x00de, 0x0005, 0x7030, 0x9005, 0x0138,
- 0x2078, 0x780c, 0x7032, 0x2001, 0x1947, 0x2003, 0x0001, 0x0005,
- 0x00e6, 0x2071, 0x1924, 0x7030, 0x600e, 0x2c00, 0x7032, 0x00ee,
-- 0x0005, 0x00d6, 0x00c6, 0x0026, 0x9b80, 0x912a, 0x2005, 0x906d,
-- 0x090c, 0x0d85, 0x9b80, 0x9122, 0x2005, 0x9065, 0x090c, 0x0d85,
-+ 0x0005, 0x00d6, 0x00c6, 0x0026, 0x9b80, 0x911a, 0x2005, 0x906d,
-+ 0x090c, 0x0d85, 0x9b80, 0x9112, 0x2005, 0x9065, 0x090c, 0x0d85,
- 0x6114, 0x2600, 0x9102, 0x0248, 0x6828, 0x9102, 0x02f0, 0x9085,
- 0x0001, 0x002e, 0x00ce, 0x00de, 0x0005, 0x6804, 0xd094, 0x0148,
- 0x6854, 0xd084, 0x1178, 0xc085, 0x6856, 0x2011, 0x8026, 0x080c,
-- 0x4ca1, 0x684c, 0x0096, 0x904d, 0x090c, 0x0d85, 0xa804, 0x8000,
-+ 0x4c9f, 0x684c, 0x0096, 0x904d, 0x090c, 0x0d85, 0xa804, 0x8000,
- 0xa806, 0x009e, 0x9006, 0x2030, 0x0c20, 0x6854, 0xd08c, 0x1d08,
-- 0xc08d, 0x6856, 0x2011, 0x8025, 0x080c, 0x4ca1, 0x684c, 0x0096,
-+ 0xc08d, 0x6856, 0x2011, 0x8025, 0x080c, 0x4c9f, 0x684c, 0x0096,
- 0x904d, 0x090c, 0x0d85, 0xa800, 0x8000, 0xa802, 0x009e, 0x0888,
- 0x7000, 0x2019, 0x0008, 0x8319, 0x7104, 0x9102, 0x1118, 0x2300,
- 0x9005, 0x0020, 0x0210, 0x9302, 0x0008, 0x8002, 0x0005, 0x00d6,
-@@ -4367,10 +4353,10 @@ unsigned short risc_code01[] = {
- 0x0208, 0x900e, 0x6906, 0x9180, 0x193f, 0x2003, 0x0000, 0x00de,
- 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048, 0xa8a8, 0x0096,
- 0x2048, 0x9005, 0x190c, 0x108b, 0x009e, 0xa8ab, 0x0000, 0x080c,
-- 0x100b, 0x080c, 0xb16c, 0x00ce, 0x009e, 0x0005, 0x6020, 0x9086,
-+ 0x100b, 0x080c, 0xb157, 0x00ce, 0x009e, 0x0005, 0x6020, 0x9086,
- 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006, 0x0005, 0x9085,
- 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178, 0x6010, 0x9005,
-- 0x0150, 0x00b6, 0x2058, 0x080c, 0x925e, 0x00be, 0x6013, 0x0000,
-+ 0x0150, 0x00b6, 0x2058, 0x080c, 0x924e, 0x00be, 0x6013, 0x0000,
- 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005, 0x2009, 0x1928,
- 0x210c, 0xd194, 0x0005, 0x2009, 0x1928, 0x210c, 0xd1c4, 0x0005,
- 0x0126, 0x2091, 0x8000, 0x00e6, 0x2071, 0x1924, 0x7110, 0xc194,
-@@ -4378,10 +4364,10 @@ unsigned short risc_code01[] = {
- 0x00ee, 0x012e, 0x0005, 0x7814, 0xd0bc, 0x1108, 0x0005, 0x7810,
- 0xc0c5, 0x7812, 0x0cc0, 0x0096, 0x00d6, 0x9006, 0x7006, 0x700e,
- 0x701a, 0x701e, 0x7022, 0x7016, 0x702a, 0x7026, 0x702f, 0x0000,
-- 0x080c, 0x90aa, 0x0170, 0x080c, 0x90df, 0x0158, 0x2900, 0x7002,
-+ 0x080c, 0x909a, 0x0170, 0x080c, 0x90cf, 0x0158, 0x2900, 0x7002,
- 0x700a, 0x701a, 0x7013, 0x0001, 0x701f, 0x000a, 0x00de, 0x009e,
- 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096, 0x0086, 0x00d6, 0x00c6,
-- 0x2071, 0x1931, 0x721c, 0x2100, 0x9202, 0x1618, 0x080c, 0x90df,
-+ 0x2071, 0x1931, 0x721c, 0x2100, 0x9202, 0x1618, 0x080c, 0x90cf,
- 0x090c, 0x0d85, 0x7018, 0x9005, 0x1160, 0x2900, 0x7002, 0x700a,
- 0x701a, 0x9006, 0x7006, 0x700e, 0xa806, 0xa802, 0x7012, 0x701e,
- 0x0038, 0x2040, 0xa806, 0x2900, 0xa002, 0x701a, 0xa803, 0x0000,
-@@ -4389,42 +4375,42 @@ unsigned short risc_code01[] = {
- 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e, 0x009e, 0x00ee, 0x0005,
- 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6, 0x0126, 0x2091, 0x8000,
- 0x2071, 0x1931, 0x7300, 0x831f, 0x831e, 0x831e, 0x9384, 0x003f,
-- 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003, 0x7104, 0x080c, 0x905c,
-+ 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003, 0x7104, 0x080c, 0x904c,
- 0x810c, 0x2100, 0x9318, 0x8003, 0x2228, 0x2021, 0x0078, 0x9402,
- 0x9532, 0x0208, 0x2028, 0x2500, 0x8004, 0x20a8, 0x23a0, 0xa001,
-- 0xa001, 0x4005, 0x2508, 0x080c, 0x9065, 0x2130, 0x7014, 0x9600,
-+ 0xa001, 0x4005, 0x2508, 0x080c, 0x9055, 0x2130, 0x7014, 0x9600,
- 0x7016, 0x2600, 0x711c, 0x9102, 0x701e, 0x7004, 0x9600, 0x2008,
- 0x9082, 0x000a, 0x1190, 0x7000, 0x2048, 0xa800, 0x9005, 0x1148,
-- 0x2009, 0x0001, 0x0026, 0x080c, 0x8f53, 0x002e, 0x7000, 0x2048,
-+ 0x2009, 0x0001, 0x0026, 0x080c, 0x8f43, 0x002e, 0x7000, 0x2048,
- 0xa800, 0x7002, 0x7007, 0x0000, 0x0008, 0x7106, 0x2500, 0x9212,
-- 0x1904, 0x8f92, 0x012e, 0x00ee, 0x014e, 0x013e, 0x015e, 0x009e,
-+ 0x1904, 0x8f82, 0x012e, 0x00ee, 0x014e, 0x013e, 0x015e, 0x009e,
- 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126, 0x2091, 0x8000, 0x9580,
-- 0x9122, 0x2005, 0x9075, 0x090c, 0x0d85, 0x080c, 0x9037, 0x012e,
-- 0x9580, 0x911e, 0x2005, 0x9075, 0x090c, 0x0d85, 0x0156, 0x0136,
-+ 0x9112, 0x2005, 0x9075, 0x090c, 0x0d85, 0x080c, 0x9027, 0x012e,
-+ 0x9580, 0x910e, 0x2005, 0x9075, 0x090c, 0x0d85, 0x0156, 0x0136,
- 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e, 0x831e, 0x9384, 0x003f,
- 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098, 0xa860, 0x20e8, 0xa95c,
- 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002, 0x4003, 0x2e0c, 0x2d00,
-- 0x0002, 0x9021, 0x9021, 0x9023, 0x9021, 0x9023, 0x9021, 0x9021,
-- 0x9021, 0x9021, 0x9021, 0x9029, 0x9021, 0x9029, 0x9021, 0x9021,
-- 0x9021, 0x080c, 0x0d85, 0x4104, 0x20a9, 0x0002, 0x4002, 0x4003,
-+ 0x0002, 0x9011, 0x9011, 0x9013, 0x9011, 0x9013, 0x9011, 0x9011,
-+ 0x9011, 0x9011, 0x9011, 0x9019, 0x9011, 0x9019, 0x9011, 0x9011,
-+ 0x9011, 0x080c, 0x0d85, 0x4104, 0x20a9, 0x0002, 0x4002, 0x4003,
- 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104, 0x4003, 0x01de, 0x014e,
- 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096,
- 0x7014, 0x8001, 0x7016, 0x710c, 0x2110, 0x00f1, 0x810c, 0x9188,
- 0x0003, 0x7308, 0x8210, 0x9282, 0x000a, 0x1198, 0x7008, 0x2048,
-- 0xa800, 0x9005, 0x0158, 0x0006, 0x080c, 0x90ee, 0x009e, 0xa807,
-+ 0xa800, 0x9005, 0x0158, 0x0006, 0x080c, 0x90de, 0x009e, 0xa807,
- 0x0000, 0x2900, 0x700a, 0x7010, 0x8001, 0x7012, 0x700f, 0x0000,
- 0x0008, 0x720e, 0x009e, 0x0005, 0x0006, 0x810b, 0x810b, 0x2100,
- 0x810b, 0x9100, 0x2008, 0x000e, 0x0005, 0x0006, 0x0026, 0x2100,
- 0x9005, 0x0158, 0x9092, 0x000c, 0x0240, 0x900e, 0x8108, 0x9082,
- 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005, 0x900e, 0x0cd8, 0x2d00,
-- 0x90b8, 0x0008, 0x2031, 0x90a8, 0x901e, 0x6808, 0x9005, 0x0108,
-+ 0x90b8, 0x0008, 0x2031, 0x9098, 0x901e, 0x6808, 0x9005, 0x0108,
- 0x8318, 0x690c, 0x910a, 0x0248, 0x0140, 0x8318, 0x6810, 0x9112,
- 0x0220, 0x0118, 0x8318, 0x2208, 0x0cd0, 0x233a, 0x6804, 0xd084,
- 0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967, 0x0a67,
- 0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082, 0x0002,
- 0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67, 0x0cd0,
- 0x6c1a, 0x0005, 0x0096, 0x0046, 0x0126, 0x2091, 0x8000, 0x2b00,
-- 0x9080, 0x9126, 0x2005, 0x9005, 0x090c, 0x0d85, 0x2004, 0x90a0,
-+ 0x9080, 0x9116, 0x2005, 0x9005, 0x090c, 0x0d85, 0x2004, 0x90a0,
- 0x000a, 0x080c, 0x1072, 0x01d0, 0x2900, 0x7026, 0xa803, 0x0000,
- 0xa807, 0x0000, 0x080c, 0x1072, 0x0188, 0x7024, 0xa802, 0xa807,
- 0x0000, 0x2900, 0x7026, 0x94a2, 0x000a, 0x0110, 0x0208, 0x0c90,
-@@ -4440,28 +4426,28 @@ unsigned short risc_code01[] = {
- 0x7022, 0x702a, 0x7026, 0x702e, 0x009e, 0x0005, 0x1a71, 0x0000,
- 0x0000, 0x0000, 0x1931, 0x0000, 0x0000, 0x0000, 0x1888, 0x0000,
- 0x0000, 0x0000, 0x1877, 0x0000, 0x0000, 0x0000, 0x00e6, 0x00c6,
-- 0x00b6, 0x00a6, 0xa8a8, 0x2040, 0x2071, 0x1877, 0x080c, 0x924a,
-- 0xa067, 0x0023, 0x6010, 0x905d, 0x0904, 0x921f, 0xb814, 0xa06e,
-+ 0x00b6, 0x00a6, 0xa8a8, 0x2040, 0x2071, 0x1877, 0x080c, 0x923a,
-+ 0xa067, 0x0023, 0x6010, 0x905d, 0x0904, 0x920f, 0xb814, 0xa06e,
- 0xb910, 0xa172, 0xb9a0, 0xa176, 0x2001, 0x0003, 0xa07e, 0xa834,
- 0xa082, 0xa07b, 0x0000, 0xa898, 0x9005, 0x0118, 0xa078, 0xc085,
- 0xa07a, 0x2858, 0x2031, 0x0018, 0xa068, 0x908a, 0x0019, 0x1a0c,
- 0x0d85, 0x2020, 0x2050, 0x2940, 0xa864, 0x90bc, 0x00ff, 0x908c,
- 0x000f, 0x91e0, 0x1ec1, 0x2c65, 0x9786, 0x0024, 0x2c05, 0x1590,
-- 0x908a, 0x0036, 0x1a0c, 0x0d85, 0x9082, 0x001b, 0x0002, 0x918a,
-- 0x918a, 0x918c, 0x918a, 0x918a, 0x918a, 0x918e, 0x918a, 0x918a,
-- 0x918a, 0x9190, 0x918a, 0x918a, 0x918a, 0x9192, 0x918a, 0x918a,
-- 0x918a, 0x9194, 0x918a, 0x918a, 0x918a, 0x9196, 0x918a, 0x918a,
-- 0x918a, 0x9198, 0x080c, 0x0d85, 0xa180, 0x04b8, 0xa190, 0x04a8,
-+ 0x908a, 0x0036, 0x1a0c, 0x0d85, 0x9082, 0x001b, 0x0002, 0x917a,
-+ 0x917a, 0x917c, 0x917a, 0x917a, 0x917a, 0x917e, 0x917a, 0x917a,
-+ 0x917a, 0x9180, 0x917a, 0x917a, 0x917a, 0x9182, 0x917a, 0x917a,
-+ 0x917a, 0x9184, 0x917a, 0x917a, 0x917a, 0x9186, 0x917a, 0x917a,
-+ 0x917a, 0x9188, 0x080c, 0x0d85, 0xa180, 0x04b8, 0xa190, 0x04a8,
- 0xa1a0, 0x0498, 0xa1b0, 0x0488, 0xa1c0, 0x0478, 0xa1d0, 0x0468,
- 0xa1e0, 0x0458, 0x908a, 0x0034, 0x1a0c, 0x0d85, 0x9082, 0x001b,
-- 0x0002, 0x91bc, 0x91ba, 0x91ba, 0x91ba, 0x91ba, 0x91ba, 0x91be,
-- 0x91ba, 0x91ba, 0x91ba, 0x91ba, 0x91ba, 0x91c0, 0x91ba, 0x91ba,
-- 0x91ba, 0x91ba, 0x91ba, 0x91c2, 0x91ba, 0x91ba, 0x91ba, 0x91ba,
-- 0x91ba, 0x91c4, 0x080c, 0x0d85, 0xa180, 0x0038, 0xa198, 0x0028,
-- 0xa1b0, 0x0018, 0xa1c8, 0x0008, 0xa1e0, 0x2600, 0x0002, 0x91e0,
-+ 0x0002, 0x91ac, 0x91aa, 0x91aa, 0x91aa, 0x91aa, 0x91aa, 0x91ae,
-+ 0x91aa, 0x91aa, 0x91aa, 0x91aa, 0x91aa, 0x91b0, 0x91aa, 0x91aa,
-+ 0x91aa, 0x91aa, 0x91aa, 0x91b2, 0x91aa, 0x91aa, 0x91aa, 0x91aa,
-+ 0x91aa, 0x91b4, 0x080c, 0x0d85, 0xa180, 0x0038, 0xa198, 0x0028,
-+ 0xa1b0, 0x0018, 0xa1c8, 0x0008, 0xa1e0, 0x2600, 0x0002, 0x91d0,
-+ 0x91d2, 0x91d4, 0x91d6, 0x91d8, 0x91da, 0x91dc, 0x91de, 0x91e0,
- 0x91e2, 0x91e4, 0x91e6, 0x91e8, 0x91ea, 0x91ec, 0x91ee, 0x91f0,
- 0x91f2, 0x91f4, 0x91f6, 0x91f8, 0x91fa, 0x91fc, 0x91fe, 0x9200,
-- 0x9202, 0x9204, 0x9206, 0x9208, 0x920a, 0x920c, 0x920e, 0x9210,
- 0x080c, 0x0d85, 0xb9e2, 0x0468, 0xb9de, 0x0458, 0xb9da, 0x0448,
- 0xb9d6, 0x0438, 0xb9d2, 0x0428, 0xb9ce, 0x0418, 0xb9ca, 0x0408,
- 0xb9c6, 0x00f8, 0xb9c2, 0x00e8, 0xb9be, 0x00d8, 0xb9ba, 0x00c8,
-@@ -4469,12 +4455,12 @@ unsigned short risc_code01[] = {
- 0xb9a6, 0x0078, 0xb9a2, 0x0068, 0xb99e, 0x0058, 0xb99a, 0x0048,
- 0xb996, 0x0038, 0xb992, 0x0028, 0xb98e, 0x0018, 0xb98a, 0x0008,
- 0xb986, 0x8631, 0x8421, 0x0130, 0x080c, 0x1e97, 0x090c, 0x0d85,
-- 0x0804, 0x9164, 0x00ae, 0x00be, 0x00ce, 0x00ee, 0x0005, 0xa86c,
-- 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006, 0x0804, 0x9146,
-+ 0x0804, 0x9154, 0x00ae, 0x00be, 0x00ce, 0x00ee, 0x0005, 0xa86c,
-+ 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006, 0x0804, 0x9136,
- 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810, 0x9005, 0x01b0,
- 0x2001, 0x1925, 0x2004, 0x9005, 0x0188, 0x2001, 0x1800, 0x2004,
- 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0, 0x2021, 0x0004,
-- 0x2011, 0x8014, 0x080c, 0x4ca1, 0x004e, 0x003e, 0x00be, 0x001e,
-+ 0x2011, 0x8014, 0x080c, 0x4c9f, 0x004e, 0x003e, 0x00be, 0x001e,
- 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a, 0xa936, 0x7008,
- 0x9005, 0x0120, 0x8210, 0x910a, 0x0230, 0x0128, 0x7010, 0x8210,
- 0x910a, 0x0208, 0x1de0, 0xaa8a, 0xa26a, 0x0005, 0x00f6, 0x00d6,
-@@ -4486,104 +4472,104 @@ unsigned short risc_code01[] = {
- 0x0200, 0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6, 0x0096,
- 0x00c6, 0x0036, 0x0126, 0x2091, 0x8000, 0x0156, 0x20a9, 0x01ff,
- 0x2071, 0x0300, 0x701b, 0x0200, 0x7018, 0xd094, 0x0110, 0x1f04,
-- 0x929a, 0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90,
-+ 0x928a, 0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90,
- 0xb8ac, 0x9065, 0x01f0, 0x600c, 0xb8ae, 0x6024, 0xc08d, 0x6026,
- 0x6003, 0x0004, 0x601b, 0x0000, 0x6013, 0x0000, 0x601f, 0x0101,
- 0x6014, 0x904d, 0x090c, 0x0d85, 0xa88b, 0x0000, 0xa8a8, 0xa8ab,
-- 0x0000, 0x904d, 0x090c, 0x0d85, 0x080c, 0x108b, 0x080c, 0x8e58,
-+ 0x0000, 0x904d, 0x090c, 0x0d85, 0x080c, 0x108b, 0x080c, 0x8e48,
- 0x08f8, 0x2071, 0x0300, 0x701b, 0x0200, 0x015e, 0x012e, 0x003e,
- 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x00b6, 0x0016,
-- 0x0006, 0x0156, 0x080c, 0x268c, 0x015e, 0x11b0, 0x080c, 0x6749,
-- 0x190c, 0x0d85, 0x000e, 0x001e, 0xb912, 0xb816, 0x080c, 0xb116,
-+ 0x0006, 0x0156, 0x080c, 0x268c, 0x015e, 0x11b0, 0x080c, 0x6742,
-+ 0x190c, 0x0d85, 0x000e, 0x001e, 0xb912, 0xb816, 0x080c, 0xb101,
- 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001, 0x2009, 0x0001, 0x080c,
-- 0xb20a, 0x00be, 0x00ce, 0x0005, 0x000e, 0x001e, 0x0cd0, 0x0066,
-+ 0xb1f5, 0x00be, 0x00ce, 0x0005, 0x000e, 0x001e, 0x0cd0, 0x0066,
- 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x0013, 0x006e, 0x0005,
-- 0x9310, 0x9310, 0x9310, 0x9312, 0x935b, 0x9310, 0x9310, 0x9310,
-- 0x93d5, 0x9310, 0x940d, 0x9310, 0x9310, 0x9310, 0x9310, 0x9310,
-- 0x080c, 0x0d85, 0x9182, 0x0040, 0x0002, 0x9325, 0x9325, 0x9325,
-- 0x9325, 0x9325, 0x9325, 0x9325, 0x9325, 0x9325, 0x9327, 0x9338,
-- 0x9325, 0x9325, 0x9325, 0x9325, 0x9349, 0x080c, 0x0d85, 0x0096,
-+ 0x9300, 0x9300, 0x9300, 0x9302, 0x934b, 0x9300, 0x9300, 0x9300,
-+ 0x93c5, 0x9300, 0x93fd, 0x9300, 0x9300, 0x9300, 0x9300, 0x9300,
-+ 0x080c, 0x0d85, 0x9182, 0x0040, 0x0002, 0x9315, 0x9315, 0x9315,
-+ 0x9315, 0x9315, 0x9315, 0x9315, 0x9315, 0x9315, 0x9317, 0x9328,
-+ 0x9315, 0x9315, 0x9315, 0x9315, 0x9339, 0x080c, 0x0d85, 0x0096,
- 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb,
-- 0x0500, 0x00be, 0x080c, 0x6e11, 0x080c, 0xb16c, 0x009e, 0x0005,
-- 0x080c, 0x9a48, 0x00d6, 0x6114, 0x080c, 0xcf1b, 0x0130, 0x0096,
-- 0x6114, 0x2148, 0x080c, 0x7012, 0x009e, 0x00de, 0x080c, 0xb16c,
-- 0x0005, 0x080c, 0x9a48, 0x080c, 0x3315, 0x6114, 0x0096, 0x2148,
-- 0x080c, 0xcf1b, 0x0120, 0xa87b, 0x0029, 0x080c, 0x7012, 0x009e,
-- 0x080c, 0xb16c, 0x0005, 0x601b, 0x0000, 0x9182, 0x0040, 0x0096,
-- 0x0002, 0x9376, 0x9376, 0x9376, 0x9376, 0x9376, 0x9376, 0x9376,
-- 0x9376, 0x9378, 0x9376, 0x9376, 0x9376, 0x93d1, 0x9376, 0x9376,
-- 0x9376, 0x9376, 0x9376, 0x9376, 0x937f, 0x9376, 0x080c, 0x0d85,
-- 0x6114, 0x2148, 0xa938, 0x918e, 0xffff, 0x0904, 0x93d1, 0x6024,
-- 0xd08c, 0x15d8, 0x080c, 0x8f0e, 0x05e0, 0x00e6, 0x6114, 0x2148,
-- 0x080c, 0x912e, 0x0096, 0xa8a8, 0x2048, 0x080c, 0x6da9, 0x009e,
-+ 0x0500, 0x00be, 0x080c, 0x6e01, 0x080c, 0xb157, 0x009e, 0x0005,
-+ 0x080c, 0x9a38, 0x00d6, 0x6114, 0x080c, 0xcf08, 0x0130, 0x0096,
-+ 0x6114, 0x2148, 0x080c, 0x7002, 0x009e, 0x00de, 0x080c, 0xb157,
-+ 0x0005, 0x080c, 0x9a38, 0x080c, 0x3315, 0x6114, 0x0096, 0x2148,
-+ 0x080c, 0xcf08, 0x0120, 0xa87b, 0x0029, 0x080c, 0x7002, 0x009e,
-+ 0x080c, 0xb157, 0x0005, 0x601b, 0x0000, 0x9182, 0x0040, 0x0096,
-+ 0x0002, 0x9366, 0x9366, 0x9366, 0x9366, 0x9366, 0x9366, 0x9366,
-+ 0x9366, 0x9368, 0x9366, 0x9366, 0x9366, 0x93c1, 0x9366, 0x9366,
-+ 0x9366, 0x9366, 0x9366, 0x9366, 0x936f, 0x9366, 0x080c, 0x0d85,
-+ 0x6114, 0x2148, 0xa938, 0x918e, 0xffff, 0x0904, 0x93c1, 0x6024,
-+ 0xd08c, 0x15d8, 0x080c, 0x8efe, 0x05e0, 0x00e6, 0x6114, 0x2148,
-+ 0x080c, 0x911e, 0x0096, 0xa8a8, 0x2048, 0x080c, 0x6d99, 0x009e,
- 0xa8ab, 0x0000, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c,
-- 0x925e, 0x00be, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8e61,
-- 0x00be, 0x01e0, 0x2071, 0x193d, 0x080c, 0x8ea8, 0x01b8, 0x9086,
-+ 0x924e, 0x00be, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8e51,
-+ 0x00be, 0x01e0, 0x2071, 0x193d, 0x080c, 0x8e98, 0x01b8, 0x9086,
- 0x0001, 0x1128, 0x2001, 0x1947, 0x2004, 0x9005, 0x1178, 0x0096,
- 0x080c, 0x1059, 0x2900, 0x009e, 0x0148, 0xa8aa, 0x00f6, 0x2c78,
-- 0x080c, 0x8e1c, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x080c, 0x8e58,
-- 0x0cd0, 0x080c, 0x8f13, 0x1160, 0x6010, 0x9005, 0x0130, 0x2058,
-- 0xb8ac, 0x9005, 0x190c, 0x0d85, 0x6012, 0x2c00, 0x080c, 0x8ed9,
-- 0x0005, 0x080c, 0x9489, 0x009e, 0x0005, 0x9182, 0x0040, 0x0096,
-- 0x0002, 0x93e9, 0x93e9, 0x93e9, 0x93eb, 0x93e9, 0x93e9, 0x93e9,
-- 0x940b, 0x93e9, 0x93e9, 0x93e9, 0x93e9, 0x93e9, 0x93e9, 0x93e9,
-- 0x93e9, 0x080c, 0x0d85, 0x6003, 0x0003, 0x6106, 0x6014, 0x2048,
-+ 0x080c, 0x8e0c, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x080c, 0x8e48,
-+ 0x0cd0, 0x080c, 0x8f03, 0x1160, 0x6010, 0x9005, 0x0130, 0x2058,
-+ 0xb8ac, 0x9005, 0x190c, 0x0d85, 0x6012, 0x2c00, 0x080c, 0x8ec9,
-+ 0x0005, 0x080c, 0x9479, 0x009e, 0x0005, 0x9182, 0x0040, 0x0096,
-+ 0x0002, 0x93d9, 0x93d9, 0x93d9, 0x93db, 0x93d9, 0x93d9, 0x93d9,
-+ 0x93fb, 0x93d9, 0x93d9, 0x93d9, 0x93d9, 0x93d9, 0x93d9, 0x93d9,
-+ 0x93d9, 0x080c, 0x0d85, 0x6003, 0x0003, 0x6106, 0x6014, 0x2048,
- 0xa8ac, 0xa836, 0xa8b0, 0xa83a, 0xa847, 0x0000, 0xa84b, 0x0000,
- 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x8013,
- 0x8213, 0x9210, 0x621a, 0x080c, 0x1c26, 0x2009, 0x8030, 0x080c,
-- 0x965e, 0x009e, 0x0005, 0x080c, 0x0d85, 0x080c, 0x9a48, 0x6114,
-+ 0x964e, 0x009e, 0x0005, 0x080c, 0x0d85, 0x080c, 0x9a38, 0x6114,
- 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500,
-- 0x00be, 0x080c, 0x7012, 0x080c, 0xb16c, 0x009e, 0x0005, 0x080c,
-- 0xacfc, 0x6144, 0xd1fc, 0x0120, 0xd1ac, 0x1110, 0x6003, 0x0003,
-+ 0x00be, 0x080c, 0x7002, 0x080c, 0xb157, 0x009e, 0x0005, 0x080c,
-+ 0xacec, 0x6144, 0xd1fc, 0x0120, 0xd1ac, 0x1110, 0x6003, 0x0003,
- 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x0096, 0x0023, 0x009e,
-- 0x080c, 0xad18, 0x0005, 0x9443, 0x9443, 0x9443, 0x9445, 0x9456,
-- 0x9443, 0x9443, 0x9443, 0x9443, 0x9443, 0x9443, 0x9443, 0x9443,
-- 0x9443, 0x9443, 0x9443, 0x080c, 0x0d85, 0x080c, 0xaee3, 0x6114,
-+ 0x080c, 0xad08, 0x0005, 0x9433, 0x9433, 0x9433, 0x9435, 0x9446,
-+ 0x9433, 0x9433, 0x9433, 0x9433, 0x9433, 0x9433, 0x9433, 0x9433,
-+ 0x9433, 0x9433, 0x9433, 0x080c, 0x0d85, 0x080c, 0xaece, 0x6114,
- 0x2148, 0xa87b, 0x0006, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500,
-- 0x00be, 0x080c, 0x7012, 0x080c, 0xb16c, 0x0005, 0x0491, 0x0005,
-- 0x080c, 0xacfc, 0x6000, 0x6144, 0xd1fc, 0x0130, 0xd1ac, 0x1120,
-+ 0x00be, 0x080c, 0x7002, 0x080c, 0xb157, 0x0005, 0x0491, 0x0005,
-+ 0x080c, 0xacec, 0x6000, 0x6144, 0xd1fc, 0x0130, 0xd1ac, 0x1120,
- 0x6003, 0x0003, 0x2009, 0x0003, 0x908a, 0x0010, 0x1a0c, 0x0d85,
-- 0x0096, 0x0033, 0x009e, 0x0106, 0x080c, 0xad18, 0x010e, 0x0005,
-- 0x9480, 0x9480, 0x9480, 0x9482, 0x9489, 0x9480, 0x9480, 0x9480,
-- 0x9480, 0x9480, 0x9480, 0x9480, 0x9480, 0x9480, 0x9480, 0x9480,
-- 0x080c, 0x0d85, 0x0036, 0x00e6, 0x080c, 0xaee3, 0x00ee, 0x003e,
-+ 0x0096, 0x0033, 0x009e, 0x0106, 0x080c, 0xad08, 0x010e, 0x0005,
-+ 0x9470, 0x9470, 0x9470, 0x9472, 0x9479, 0x9470, 0x9470, 0x9470,
-+ 0x9470, 0x9470, 0x9470, 0x9470, 0x9470, 0x9470, 0x9470, 0x9470,
-+ 0x080c, 0x0d85, 0x0036, 0x00e6, 0x080c, 0xaece, 0x00ee, 0x003e,
- 0x0005, 0x6024, 0xd08c, 0x11f0, 0x00f6, 0x00e6, 0x601b, 0x0000,
- 0x6014, 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c,
-- 0x925e, 0x00be, 0x2071, 0x193d, 0x080c, 0x8ea8, 0x0160, 0x2001,
-- 0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x8e1c,
-+ 0x924e, 0x00be, 0x2071, 0x193d, 0x080c, 0x8e98, 0x0160, 0x2001,
-+ 0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x8e0c,
- 0x00ee, 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048,
-- 0x080c, 0x108b, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8e58, 0x0c80,
-- 0x2001, 0x1925, 0x200c, 0x918e, 0x0000, 0x190c, 0x8f0e, 0x05c8,
-- 0x00e6, 0x2071, 0x1924, 0x7110, 0xc1c5, 0x7112, 0x080c, 0x8f18,
-+ 0x080c, 0x108b, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8e48, 0x0c80,
-+ 0x2001, 0x1925, 0x200c, 0x918e, 0x0000, 0x190c, 0x8efe, 0x05c8,
-+ 0x00e6, 0x2071, 0x1924, 0x7110, 0xc1c5, 0x7112, 0x080c, 0x8f08,
- 0x00f6, 0x00c6, 0x2071, 0x1000, 0x00b6, 0x2e04, 0x905d, 0x0138,
-- 0xb8ac, 0x9065, 0x0120, 0x080c, 0x8eee, 0x090c, 0x928d, 0x8e70,
-+ 0xb8ac, 0x9065, 0x0120, 0x080c, 0x8ede, 0x090c, 0x927d, 0x8e70,
- 0x9e86, 0x1800, 0x1d90, 0x00be, 0x00d6, 0x0096, 0x0046, 0x2061,
- 0x1ddc, 0x2001, 0x181a, 0x2024, 0x6020, 0x9086, 0x0000, 0x1191,
- 0x9ce0, 0x001c, 0x2400, 0x9c06, 0x1db8, 0x004e, 0x009e, 0x00de,
- 0x00d1, 0x00ce, 0x00fe, 0x2071, 0x1924, 0x7110, 0xc1c4, 0x7112,
- 0x00ee, 0x0005, 0x6020, 0x9086, 0x0009, 0x1160, 0x6100, 0x9186,
- 0x0004, 0x1138, 0x6110, 0x81ff, 0x190c, 0x0d85, 0x2c00, 0x080c,
-- 0x8ed9, 0x9006, 0x0005, 0x2071, 0x193f, 0x2073, 0x0000, 0x8e70,
-+ 0x8ec9, 0x9006, 0x0005, 0x2071, 0x193f, 0x2073, 0x0000, 0x8e70,
- 0x9e86, 0x1947, 0x1dd0, 0x2071, 0x193d, 0x7006, 0x7002, 0x2001,
- 0x1930, 0x2064, 0x8cff, 0x0130, 0x6120, 0x918e, 0x0000, 0x190c,
- 0x0d85, 0x2102, 0x2001, 0x188a, 0x200c, 0x81ff, 0x0148, 0x0096,
- 0x2148, 0x080c, 0x108b, 0x009e, 0x2001, 0x188a, 0x2003, 0x0000,
-- 0x2071, 0x1931, 0x080c, 0x90f7, 0x0804, 0x9106, 0x0000, 0x0000,
-+ 0x2071, 0x1931, 0x080c, 0x90e7, 0x0804, 0x90f6, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x187a,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0126, 0x2091,
- 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006, 0x8004, 0x8086,
-- 0x818e, 0x1208, 0x9200, 0x1f04, 0x954f, 0x8086, 0x818e, 0x004e,
-+ 0x818e, 0x1208, 0x9200, 0x1f04, 0x953f, 0x8086, 0x818e, 0x004e,
- 0x003e, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0076, 0x0156,
- 0x20a9, 0x0010, 0x9005, 0x01c8, 0x911a, 0x12b8, 0x8213, 0x818d,
-- 0x0228, 0x911a, 0x1220, 0x1f04, 0x9566, 0x0028, 0x911a, 0x2308,
-- 0x8210, 0x1f04, 0x9566, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080,
-+ 0x0228, 0x911a, 0x1220, 0x1f04, 0x9556, 0x0028, 0x911a, 0x2308,
-+ 0x8210, 0x1f04, 0x9556, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080,
- 0x000e, 0x015e, 0x007e, 0x012e, 0x0005, 0x0006, 0x3200, 0x9085,
- 0x1000, 0x0ca8, 0x0126, 0x2091, 0x2800, 0x2079, 0x19e8, 0x012e,
- 0x00d6, 0x2069, 0x19e8, 0x6803, 0x0005, 0x0156, 0x0146, 0x01d6,
-- 0x20e9, 0x0000, 0x2069, 0x0200, 0x080c, 0xaaf1, 0x04c9, 0x080c,
-- 0xaadc, 0x04b1, 0x080c, 0xaadf, 0x0499, 0x080c, 0xaae2, 0x0481,
-- 0x080c, 0xaae5, 0x0469, 0x080c, 0xaae8, 0x0451, 0x080c, 0xaaeb,
-- 0x0439, 0x080c, 0xaaee, 0x0421, 0x01de, 0x014e, 0x015e, 0x6857,
-+ 0x20e9, 0x0000, 0x2069, 0x0200, 0x080c, 0xaae1, 0x04c9, 0x080c,
-+ 0xaacc, 0x04b1, 0x080c, 0xaacf, 0x0499, 0x080c, 0xaad2, 0x0481,
-+ 0x080c, 0xaad5, 0x0469, 0x080c, 0xaad8, 0x0451, 0x080c, 0xaadb,
-+ 0x0439, 0x080c, 0xaade, 0x0421, 0x01de, 0x014e, 0x015e, 0x6857,
- 0x0000, 0x00f6, 0x2079, 0x0380, 0x0419, 0x7807, 0x0003, 0x7803,
- 0x0000, 0x7803, 0x0001, 0x2069, 0x0004, 0x2d04, 0x9084, 0xfffe,
- 0x9085, 0x8000, 0x206a, 0x2069, 0x0100, 0x6828, 0x9084, 0xfffc,
-@@ -4597,274 +4583,274 @@ unsigned short risc_code01[] = {
- 0x01b0, 0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08, 0x2061, 0x19e8,
- 0x602c, 0x8000, 0x602e, 0x601c, 0x9005, 0x0130, 0x9080, 0x0003,
- 0x2102, 0x611e, 0x00ce, 0x0005, 0x6122, 0x611e, 0x0cd8, 0x6146,
-- 0x2c08, 0x2001, 0x0012, 0x080c, 0xaced, 0x0005, 0x0016, 0x2009,
-+ 0x2c08, 0x2001, 0x0012, 0x080c, 0xacdd, 0x0005, 0x0016, 0x2009,
- 0x8020, 0x6146, 0x2c08, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007,
-- 0x9086, 0x0001, 0x1128, 0x2001, 0x0019, 0x080c, 0xaced, 0x0088,
-+ 0x9086, 0x0001, 0x1128, 0x2001, 0x0019, 0x080c, 0xacdd, 0x0088,
- 0x00c6, 0x2061, 0x19e8, 0x602c, 0x8000, 0x602e, 0x600c, 0x9005,
- 0x0128, 0x9080, 0x0003, 0x2102, 0x610e, 0x0010, 0x6112, 0x610e,
- 0x00ce, 0x001e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007,
- 0x9086, 0x0001, 0x0198, 0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08,
- 0x2061, 0x19e8, 0x6044, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102,
- 0x6146, 0x00ce, 0x0005, 0x614a, 0x6146, 0x0cd8, 0x6146, 0x600f,
-- 0x0000, 0x2c08, 0x2001, 0x0013, 0x080c, 0xaced, 0x0005, 0x6044,
-- 0xd0dc, 0x0110, 0x080c, 0xa78a, 0x0005, 0x00f6, 0x00e6, 0x00d6,
-+ 0x0000, 0x2c08, 0x2001, 0x0013, 0x080c, 0xacdd, 0x0005, 0x6044,
-+ 0xd0dc, 0x0110, 0x080c, 0xa77a, 0x0005, 0x00f6, 0x00e6, 0x00d6,
- 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066, 0x0056, 0x0036, 0x0026,
- 0x0016, 0x0006, 0x0126, 0x902e, 0x2071, 0x19e8, 0x7648, 0x2660,
-- 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x96f1, 0x9c86, 0x1b55,
-- 0x0904, 0x96ec, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x96ec,
-- 0x87ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x96ec, 0x704c, 0x9c06,
-- 0x1188, 0x0036, 0x2019, 0x0001, 0x080c, 0xa596, 0x703f, 0x0000,
-- 0x9006, 0x704e, 0x706a, 0x7052, 0x706e, 0x080c, 0xaff4, 0x003e,
-- 0x2029, 0x0001, 0x080c, 0x9667, 0x7048, 0x9c36, 0x1110, 0x660c,
-+ 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x96e1, 0x9c86, 0x1b55,
-+ 0x0904, 0x96dc, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x96dc,
-+ 0x87ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x96dc, 0x704c, 0x9c06,
-+ 0x1188, 0x0036, 0x2019, 0x0001, 0x080c, 0xa586, 0x703f, 0x0000,
-+ 0x9006, 0x704e, 0x706a, 0x7052, 0x706e, 0x080c, 0xafdf, 0x003e,
-+ 0x2029, 0x0001, 0x080c, 0x9657, 0x7048, 0x9c36, 0x1110, 0x660c,
- 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
- 0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-- 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xcf1b,
-+ 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xcf08,
- 0x01f0, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1588, 0x6004,
-- 0x9086, 0x0040, 0x090c, 0xa78a, 0xa867, 0x0103, 0xab7a, 0xa877,
-- 0x0000, 0x0016, 0x0036, 0x0076, 0x080c, 0xd220, 0x080c, 0xeddf,
-- 0x080c, 0x7012, 0x007e, 0x003e, 0x001e, 0x080c, 0xd10c, 0x080c,
-- 0xb1a7, 0x00ce, 0x0804, 0x9683, 0x2c78, 0x600c, 0x2060, 0x0804,
-- 0x9683, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e, 0x005e, 0x006e,
-+ 0x9086, 0x0040, 0x090c, 0xa77a, 0xa867, 0x0103, 0xab7a, 0xa877,
-+ 0x0000, 0x0016, 0x0036, 0x0076, 0x080c, 0xd20d, 0x080c, 0xedc6,
-+ 0x080c, 0x7002, 0x007e, 0x003e, 0x001e, 0x080c, 0xd0f9, 0x080c,
-+ 0xb192, 0x00ce, 0x0804, 0x9673, 0x2c78, 0x600c, 0x2060, 0x0804,
-+ 0x9673, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e, 0x005e, 0x006e,
- 0x007e, 0x009e, 0x00be, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005,
- 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0076, 0x080c,
-- 0xeddf, 0x080c, 0xea30, 0x007e, 0x003e, 0x001e, 0x08c0, 0x6020,
-+ 0xedc6, 0x080c, 0xea17, 0x007e, 0x003e, 0x001e, 0x08c0, 0x6020,
- 0x9086, 0x0009, 0x1168, 0xa87b, 0x0006, 0x0016, 0x0036, 0x0076,
-- 0x080c, 0x7012, 0x080c, 0xb16c, 0x007e, 0x003e, 0x001e, 0x0848,
-- 0x6020, 0x9086, 0x000a, 0x0904, 0x96d6, 0x0804, 0x96cf, 0x0006,
-+ 0x080c, 0x7002, 0x080c, 0xb157, 0x007e, 0x003e, 0x001e, 0x0848,
-+ 0x6020, 0x9086, 0x000a, 0x0904, 0x96c6, 0x0804, 0x96bf, 0x0006,
- 0x0066, 0x0096, 0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126, 0x2091,
-- 0x8000, 0x2079, 0x19e8, 0x7848, 0x9065, 0x0904, 0x9790, 0x600c,
-+ 0x8000, 0x2079, 0x19e8, 0x7848, 0x9065, 0x0904, 0x9780, 0x600c,
- 0x0006, 0x600f, 0x0000, 0x784c, 0x9c06, 0x11b0, 0x0036, 0x2019,
-- 0x0001, 0x080c, 0xa596, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a,
-- 0x7b52, 0x7b6e, 0x080c, 0xaff4, 0x003e, 0x000e, 0x9005, 0x1118,
-+ 0x0001, 0x080c, 0xa586, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a,
-+ 0x7b52, 0x7b6e, 0x080c, 0xafdf, 0x003e, 0x000e, 0x9005, 0x1118,
- 0x600c, 0x600f, 0x0000, 0x0006, 0x9c86, 0x1b55, 0x05b0, 0x00e6,
-- 0x2f70, 0x080c, 0x9667, 0x00ee, 0x080c, 0xcf1b, 0x0548, 0x6014,
-+ 0x2f70, 0x080c, 0x9657, 0x00ee, 0x080c, 0xcf08, 0x0548, 0x6014,
- 0x2048, 0x6020, 0x9086, 0x0003, 0x15a8, 0x3e08, 0x918e, 0x0002,
- 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058, 0xb800, 0x00be,
- 0xd0bc, 0x0140, 0x6048, 0x9005, 0x11c0, 0x2001, 0x1988, 0x2004,
-- 0x604a, 0x0098, 0x6004, 0x9086, 0x0040, 0x090c, 0xa78a, 0xa867,
-- 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x7006, 0x080c, 0xd10c,
-- 0x6044, 0xc0fc, 0x6046, 0x080c, 0xb1a7, 0x000e, 0x0804, 0x9734,
-+ 0x604a, 0x0098, 0x6004, 0x9086, 0x0040, 0x090c, 0xa77a, 0xa867,
-+ 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6ff6, 0x080c, 0xd0f9,
-+ 0x6044, 0xc0fc, 0x6046, 0x080c, 0xb192, 0x000e, 0x0804, 0x9724,
- 0x7e4a, 0x7e46, 0x012e, 0x00fe, 0x00de, 0x00ce, 0x009e, 0x006e,
-- 0x000e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xea30,
-- 0x0c38, 0x6020, 0x9086, 0x0009, 0x1130, 0xab7a, 0x080c, 0x7012,
-- 0x080c, 0xb16c, 0x0c10, 0x6020, 0x9086, 0x000a, 0x0990, 0x0850,
-- 0x0016, 0x0026, 0x0086, 0x9046, 0x00a9, 0x080c, 0x98a3, 0x008e,
-+ 0x000e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xea17,
-+ 0x0c38, 0x6020, 0x9086, 0x0009, 0x1130, 0xab7a, 0x080c, 0x7002,
-+ 0x080c, 0xb157, 0x0c10, 0x6020, 0x9086, 0x000a, 0x0990, 0x0850,
-+ 0x0016, 0x0026, 0x0086, 0x9046, 0x00a9, 0x080c, 0x9893, 0x008e,
- 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126, 0x2079, 0x19e8, 0x2091,
-- 0x8000, 0x080c, 0x98ec, 0x080c, 0x9982, 0x080c, 0x6948, 0x012e,
-+ 0x8000, 0x080c, 0x98dc, 0x080c, 0x9972, 0x080c, 0x6938, 0x012e,
- 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
- 0x0066, 0x0016, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8,
-- 0x7620, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9868, 0x6010, 0x2058,
-- 0xb8a0, 0x9206, 0x1904, 0x9863, 0x88ff, 0x0120, 0x605c, 0x9106,
-- 0x1904, 0x9863, 0x7030, 0x9c06, 0x1580, 0x2069, 0x0100, 0x6820,
-- 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c, 0x8a4b, 0x080c, 0xa2a0,
-- 0x68c3, 0x0000, 0x080c, 0xa78a, 0x7033, 0x0000, 0x0036, 0x2069,
-+ 0x7620, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9858, 0x6010, 0x2058,
-+ 0xb8a0, 0x9206, 0x1904, 0x9853, 0x88ff, 0x0120, 0x605c, 0x9106,
-+ 0x1904, 0x9853, 0x7030, 0x9c06, 0x1580, 0x2069, 0x0100, 0x6820,
-+ 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c, 0x8a3b, 0x080c, 0xa290,
-+ 0x68c3, 0x0000, 0x080c, 0xa77a, 0x7033, 0x0000, 0x0036, 0x2069,
- 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
- 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069, 0x0100, 0x6824, 0xd084,
- 0x0110, 0x6827, 0x0001, 0x003e, 0x0040, 0x7008, 0xc0ad, 0x700a,
-- 0x6003, 0x0009, 0x630a, 0x0804, 0x9863, 0x7020, 0x9c36, 0x1110,
-+ 0x6003, 0x0009, 0x630a, 0x0804, 0x9853, 0x7020, 0x9c36, 0x1110,
- 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
- 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000, 0x660c, 0x0066, 0x2c00,
- 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6044,
-- 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c, 0xcf1b, 0x01e8, 0x6020,
-- 0x9086, 0x0003, 0x1580, 0x080c, 0xd132, 0x1118, 0x080c, 0xbb5c,
-+ 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c, 0xcf08, 0x01e8, 0x6020,
-+ 0x9086, 0x0003, 0x1580, 0x080c, 0xd11f, 0x1118, 0x080c, 0xbb47,
- 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036,
-- 0x0086, 0x080c, 0xd220, 0x080c, 0xeddf, 0x080c, 0x7012, 0x008e,
-- 0x003e, 0x001e, 0x080c, 0xd10c, 0x080c, 0xb1a7, 0x080c, 0xa65d,
-- 0x00ce, 0x0804, 0x97db, 0x2c78, 0x600c, 0x2060, 0x0804, 0x97db,
-+ 0x0086, 0x080c, 0xd20d, 0x080c, 0xedc6, 0x080c, 0x7002, 0x008e,
-+ 0x003e, 0x001e, 0x080c, 0xd0f9, 0x080c, 0xb192, 0x080c, 0xa64d,
-+ 0x00ce, 0x0804, 0x97cb, 0x2c78, 0x600c, 0x2060, 0x0804, 0x97cb,
- 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
- 0x009e, 0x00be, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016,
-- 0x0036, 0x0086, 0x080c, 0xeddf, 0x080c, 0xea30, 0x008e, 0x003e,
-- 0x001e, 0x08d0, 0x080c, 0xbb5c, 0x6020, 0x9086, 0x0002, 0x1160,
-- 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x9849, 0x9086,
-- 0x008b, 0x0904, 0x9849, 0x0840, 0x6020, 0x9086, 0x0005, 0x1920,
-+ 0x0036, 0x0086, 0x080c, 0xedc6, 0x080c, 0xea17, 0x008e, 0x003e,
-+ 0x001e, 0x08d0, 0x080c, 0xbb47, 0x6020, 0x9086, 0x0002, 0x1160,
-+ 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x9839, 0x9086,
-+ 0x008b, 0x0904, 0x9839, 0x0840, 0x6020, 0x9086, 0x0005, 0x1920,
- 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x09c8, 0x9086, 0x008b,
-- 0x09b0, 0x0804, 0x985c, 0x0006, 0x00f6, 0x00e6, 0x0096, 0x00b6,
-+ 0x09b0, 0x0804, 0x984c, 0x0006, 0x00f6, 0x00e6, 0x0096, 0x00b6,
- 0x00c6, 0x0066, 0x0016, 0x0126, 0x2091, 0x8000, 0x9280, 0x1000,
- 0x2004, 0x905d, 0x2079, 0x19e8, 0x9036, 0x7828, 0x2060, 0x8cff,
-- 0x0538, 0x6010, 0x9b06, 0x1500, 0x6043, 0xffff, 0x080c, 0xaf2e,
-- 0x01d8, 0x610c, 0x0016, 0x080c, 0xa420, 0x6014, 0x2048, 0xa867,
-+ 0x0538, 0x6010, 0x9b06, 0x1500, 0x6043, 0xffff, 0x080c, 0xaf19,
-+ 0x01d8, 0x610c, 0x0016, 0x080c, 0xa410, 0x6014, 0x2048, 0xa867,
- 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0086, 0x080c,
-- 0xd220, 0x080c, 0xeddf, 0x080c, 0x7012, 0x008e, 0x003e, 0x001e,
-- 0x080c, 0xb1a7, 0x00ce, 0x08d8, 0x2c30, 0x600c, 0x2060, 0x08b8,
-- 0x080c, 0x6965, 0x012e, 0x001e, 0x006e, 0x00ce, 0x00be, 0x009e,
-+ 0xd20d, 0x080c, 0xedc6, 0x080c, 0x7002, 0x008e, 0x003e, 0x001e,
-+ 0x080c, 0xb192, 0x00ce, 0x08d8, 0x2c30, 0x600c, 0x2060, 0x08b8,
-+ 0x080c, 0x6955, 0x012e, 0x001e, 0x006e, 0x00ce, 0x00be, 0x009e,
- 0x00ee, 0x00fe, 0x000e, 0x0005, 0x0096, 0x0006, 0x0066, 0x00c6,
-- 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904, 0x9955, 0x600c, 0x0006,
-+ 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904, 0x9945, 0x600c, 0x0006,
- 0x6044, 0xc0fc, 0x6046, 0x600f, 0x0000, 0x7830, 0x9c06, 0x1598,
- 0x2069, 0x0100, 0x6820, 0xd0a4, 0x0110, 0xd0cc, 0x1508, 0x080c,
-- 0x8a4b, 0x080c, 0xa2a0, 0x68c3, 0x0000, 0x080c, 0xa78a, 0x7833,
-+ 0x8a3b, 0x080c, 0xa290, 0x68c3, 0x0000, 0x080c, 0xa77a, 0x7833,
- 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
- 0x2001, 0x0100, 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069,
- 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0058,
-- 0x080c, 0x6ba9, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808, 0xc0ad,
-- 0x780a, 0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xcf19, 0x01b0,
-- 0x6020, 0x9086, 0x0003, 0x1508, 0x080c, 0xd132, 0x1118, 0x080c,
-- 0xbb5c, 0x0060, 0x080c, 0x6ba9, 0x1168, 0xa867, 0x0103, 0xab7a,
-- 0xa877, 0x0000, 0x080c, 0x7012, 0x080c, 0xd10c, 0x080c, 0xb1a7,
-- 0x080c, 0xa65d, 0x000e, 0x0804, 0x98f3, 0x7e22, 0x7e1e, 0x00de,
-+ 0x080c, 0x6b99, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808, 0xc0ad,
-+ 0x780a, 0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xcf06, 0x01b0,
-+ 0x6020, 0x9086, 0x0003, 0x1508, 0x080c, 0xd11f, 0x1118, 0x080c,
-+ 0xbb47, 0x0060, 0x080c, 0x6b99, 0x1168, 0xa867, 0x0103, 0xab7a,
-+ 0xa877, 0x0000, 0x080c, 0x7002, 0x080c, 0xd0f9, 0x080c, 0xb192,
-+ 0x080c, 0xa64d, 0x000e, 0x0804, 0x98e3, 0x7e22, 0x7e1e, 0x00de,
- 0x00ce, 0x006e, 0x000e, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006,
-- 0x1118, 0x080c, 0xea30, 0x0c50, 0x080c, 0xbb5c, 0x6020, 0x9086,
-+ 0x1118, 0x080c, 0xea17, 0x0c50, 0x080c, 0xbb47, 0x6020, 0x9086,
- 0x0002, 0x1150, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0990,
- 0x9086, 0x008b, 0x0978, 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0,
- 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b,
- 0x0d00, 0x0860, 0x0006, 0x0096, 0x00b6, 0x00c6, 0x0066, 0x9036,
- 0x7828, 0x9065, 0x0510, 0x6010, 0x2058, 0x600c, 0x0006, 0x3e08,
- 0x918e, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x11a8, 0x6043, 0xffff,
-- 0x080c, 0xaf2e, 0x0180, 0x610c, 0x080c, 0xa420, 0x6014, 0x2048,
-- 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x7012, 0x080c,
-- 0xb1a7, 0x000e, 0x08f0, 0x2c30, 0x0ce0, 0x006e, 0x00ce, 0x00be,
-+ 0x080c, 0xaf19, 0x0180, 0x610c, 0x080c, 0xa410, 0x6014, 0x2048,
-+ 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x7002, 0x080c,
-+ 0xb192, 0x000e, 0x08f0, 0x2c30, 0x0ce0, 0x006e, 0x00ce, 0x00be,
- 0x009e, 0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0x080c,
-- 0x62af, 0x11b0, 0x2071, 0x19e8, 0x7030, 0x9080, 0x0005, 0x2004,
-+ 0x62a8, 0x11b0, 0x2071, 0x19e8, 0x7030, 0x9080, 0x0005, 0x2004,
- 0x904d, 0x0170, 0xa878, 0x9606, 0x1158, 0x2071, 0x19e8, 0x7030,
- 0x9035, 0x0130, 0x9080, 0x0005, 0x2004, 0x9906, 0x1108, 0x0029,
- 0x006e, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x2660, 0x6043,
-- 0xffff, 0x080c, 0xaf2e, 0x0178, 0x080c, 0xa420, 0x6014, 0x2048,
-- 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd220, 0x080c,
-- 0x7012, 0x080c, 0xb1a7, 0x00ce, 0x0005, 0x00b6, 0x00e6, 0x00c6,
-- 0x080c, 0xacfc, 0x0106, 0x2071, 0x0101, 0x2e04, 0xc0c4, 0x2072,
-- 0x6044, 0xd0fc, 0x1138, 0x010e, 0x090c, 0xad18, 0x00ce, 0x00ee,
-+ 0xffff, 0x080c, 0xaf19, 0x0178, 0x080c, 0xa410, 0x6014, 0x2048,
-+ 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd20d, 0x080c,
-+ 0x7002, 0x080c, 0xb192, 0x00ce, 0x0005, 0x00b6, 0x00e6, 0x00c6,
-+ 0x080c, 0xacec, 0x0106, 0x2071, 0x0101, 0x2e04, 0xc0c4, 0x2072,
-+ 0x6044, 0xd0fc, 0x1138, 0x010e, 0x090c, 0xad08, 0x00ce, 0x00ee,
- 0x00be, 0x0005, 0x2071, 0x19e8, 0x7030, 0x9005, 0x0da0, 0x9c06,
-- 0x190c, 0x0d85, 0x7036, 0x080c, 0x8a4b, 0x7004, 0x9084, 0x0007,
-- 0x0002, 0x9a1b, 0x9a1d, 0x9a24, 0x9a2e, 0x9a3c, 0x9a1b, 0x9a29,
-- 0x9a19, 0x080c, 0x0d85, 0x0428, 0x0005, 0x080c, 0xaf19, 0x7007,
-- 0x0000, 0x7033, 0x0000, 0x00e8, 0x0066, 0x9036, 0x080c, 0xa420,
-- 0x006e, 0x7007, 0x0000, 0x7033, 0x0000, 0x0098, 0x080c, 0xaf04,
-- 0x0140, 0x080c, 0xaf19, 0x0128, 0x0066, 0x9036, 0x080c, 0xa420,
-- 0x006e, 0x7033, 0x0000, 0x0028, 0x080c, 0xaf04, 0x080c, 0xa78a,
-- 0x0000, 0x010e, 0x090c, 0xad18, 0x00ce, 0x00ee, 0x00be, 0x0005,
-- 0x00d6, 0x00c6, 0x080c, 0xacfc, 0x0106, 0x6044, 0xd0fc, 0x1130,
-- 0x010e, 0x090c, 0xad18, 0x00ce, 0x00de, 0x0005, 0x2069, 0x19e8,
-+ 0x190c, 0x0d85, 0x7036, 0x080c, 0x8a3b, 0x7004, 0x9084, 0x0007,
-+ 0x0002, 0x9a0b, 0x9a0d, 0x9a14, 0x9a1e, 0x9a2c, 0x9a0b, 0x9a19,
-+ 0x9a09, 0x080c, 0x0d85, 0x0428, 0x0005, 0x080c, 0xaf04, 0x7007,
-+ 0x0000, 0x7033, 0x0000, 0x00e8, 0x0066, 0x9036, 0x080c, 0xa410,
-+ 0x006e, 0x7007, 0x0000, 0x7033, 0x0000, 0x0098, 0x080c, 0xaeef,
-+ 0x0140, 0x080c, 0xaf04, 0x0128, 0x0066, 0x9036, 0x080c, 0xa410,
-+ 0x006e, 0x7033, 0x0000, 0x0028, 0x080c, 0xaeef, 0x080c, 0xa77a,
-+ 0x0000, 0x010e, 0x090c, 0xad08, 0x00ce, 0x00ee, 0x00be, 0x0005,
-+ 0x00d6, 0x00c6, 0x080c, 0xacec, 0x0106, 0x6044, 0xd0fc, 0x1130,
-+ 0x010e, 0x090c, 0xad08, 0x00ce, 0x00de, 0x0005, 0x2069, 0x19e8,
- 0x684c, 0x9005, 0x0da8, 0x9c06, 0x190c, 0x0d85, 0x6852, 0x00e6,
-- 0x2d70, 0x080c, 0x9667, 0x00ee, 0x080c, 0x8a58, 0x0016, 0x2009,
-+ 0x2d70, 0x080c, 0x9657, 0x00ee, 0x080c, 0x8a48, 0x0016, 0x2009,
- 0x0040, 0x080c, 0x2220, 0x001e, 0x683c, 0x9084, 0x0003, 0x0002,
-- 0x9a76, 0x9a77, 0x9a96, 0x9a74, 0x080c, 0x0d85, 0x0490, 0x6868,
-+ 0x9a66, 0x9a67, 0x9a86, 0x9a64, 0x080c, 0x0d85, 0x0490, 0x6868,
- 0x9086, 0x0001, 0x0198, 0x600c, 0x9015, 0x0168, 0x6a4a, 0x600f,
- 0x0000, 0x6044, 0x9084, 0x7f7f, 0x6046, 0x9006, 0x6842, 0x684e,
- 0x683f, 0x0000, 0x00f0, 0x684a, 0x6846, 0x0c98, 0x686b, 0x0000,
- 0x6848, 0x9065, 0x0d70, 0x6003, 0x0002, 0x0c58, 0x6044, 0x9084,
- 0x7f7f, 0x6046, 0x9006, 0x6842, 0x684e, 0x686a, 0x6852, 0x686e,
- 0x600c, 0x9015, 0x0120, 0x6a4a, 0x600f, 0x0000, 0x0010, 0x684a,
-- 0x6846, 0x080c, 0xaff4, 0x684f, 0x0000, 0x010e, 0x090c, 0xad18,
-+ 0x6846, 0x080c, 0xafdf, 0x684f, 0x0000, 0x010e, 0x090c, 0xad08,
- 0x00ce, 0x00de, 0x0005, 0x0005, 0x6020, 0x9084, 0x000f, 0x000b,
-- 0x0005, 0x9ac9, 0x9acc, 0x9f80, 0xa019, 0x9acc, 0x9f80, 0xa019,
-- 0x9ac9, 0x9acc, 0x9ac9, 0x9ac9, 0x9ac9, 0x9ac9, 0x9ac9, 0x9ac9,
-- 0x9ac9, 0x080c, 0x99ed, 0x0005, 0x00b6, 0x0156, 0x0136, 0x0146,
-+ 0x0005, 0x9ab9, 0x9abc, 0x9f70, 0xa009, 0x9abc, 0x9f70, 0xa009,
-+ 0x9ab9, 0x9abc, 0x9ab9, 0x9ab9, 0x9ab9, 0x9ab9, 0x9ab9, 0x9ab9,
-+ 0x9ab9, 0x080c, 0x99dd, 0x0005, 0x00b6, 0x0156, 0x0136, 0x0146,
- 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200,
- 0x2071, 0x0240, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d85, 0x6110,
- 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100, 0x619a, 0x908a, 0x0040,
-- 0x1a04, 0x9b38, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de,
-- 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x9ce1, 0x9d1c,
-- 0x9d45, 0x9e0f, 0x9e31, 0x9e37, 0x9e44, 0x9e4c, 0x9e58, 0x9e5e,
-- 0x9e6f, 0x9e5e, 0x9ec7, 0x9e4c, 0x9ed3, 0x9ed9, 0x9e58, 0x9ed9,
-- 0x9ee5, 0x9b36, 0x9b36, 0x9b36, 0x9b36, 0x9b36, 0x9b36, 0x9b36,
-- 0x9b36, 0x9b36, 0x9b36, 0x9b36, 0xa441, 0xa464, 0xa475, 0xa495,
-- 0xa4c7, 0x9e44, 0x9b36, 0x9e44, 0x9e5e, 0x9b36, 0x9d45, 0x9e0f,
-- 0x9b36, 0xa888, 0x9e5e, 0x9b36, 0xa8a4, 0x9e5e, 0x9b36, 0x9e58,
-- 0x9cdb, 0x9b59, 0x9b36, 0xa8c0, 0xa92d, 0xaa11, 0x9b36, 0xaa1e,
-- 0x9e41, 0xaa49, 0x9b36, 0xa4d1, 0xaa55, 0x9b36, 0x080c, 0x0d85,
-+ 0x1a04, 0x9b28, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de,
-+ 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x9cd1, 0x9d0c,
-+ 0x9d35, 0x9dff, 0x9e21, 0x9e27, 0x9e34, 0x9e3c, 0x9e48, 0x9e4e,
-+ 0x9e5f, 0x9e4e, 0x9eb7, 0x9e3c, 0x9ec3, 0x9ec9, 0x9e48, 0x9ec9,
-+ 0x9ed5, 0x9b26, 0x9b26, 0x9b26, 0x9b26, 0x9b26, 0x9b26, 0x9b26,
-+ 0x9b26, 0x9b26, 0x9b26, 0x9b26, 0xa431, 0xa454, 0xa465, 0xa485,
-+ 0xa4b7, 0x9e34, 0x9b26, 0x9e34, 0x9e4e, 0x9b26, 0x9d35, 0x9dff,
-+ 0x9b26, 0xa878, 0x9e4e, 0x9b26, 0xa894, 0x9e4e, 0x9b26, 0x9e48,
-+ 0x9ccb, 0x9b49, 0x9b26, 0xa8b0, 0xa91d, 0xaa01, 0x9b26, 0xaa0e,
-+ 0x9e31, 0xaa39, 0x9b26, 0xa4c1, 0xaa45, 0x9b26, 0x080c, 0x0d85,
- 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce,
-- 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0xaaf5, 0xaba7, 0x9b57,
-- 0x9b91, 0x9c3d, 0x9c48, 0x9b57, 0x9e44, 0x9b57, 0x9ca2, 0x9cae,
-- 0x9bac, 0x9b57, 0x9bc7, 0x9bfb, 0xb008, 0xb04d, 0x9e5e, 0x080c,
-- 0x0d85, 0x00d6, 0x0096, 0x080c, 0x9ef8, 0x0026, 0x0036, 0x7814,
-+ 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0xaae5, 0xab97, 0x9b47,
-+ 0x9b81, 0x9c2d, 0x9c38, 0x9b47, 0x9e34, 0x9b47, 0x9c92, 0x9c9e,
-+ 0x9b9c, 0x9b47, 0x9bb7, 0x9beb, 0xaff3, 0xb038, 0x9e4e, 0x080c,
-+ 0x0d85, 0x00d6, 0x0096, 0x080c, 0x9ee8, 0x0026, 0x0036, 0x7814,
- 0x2048, 0xa958, 0xd1cc, 0x1138, 0x2009, 0x2414, 0x2011, 0x0018,
- 0x2019, 0x0018, 0x0030, 0x2009, 0x2410, 0x2011, 0x0014, 0x2019,
- 0x0014, 0x7102, 0x7206, 0x700b, 0x0800, 0xa83c, 0x700e, 0xa850,
-- 0x7022, 0xa854, 0x7026, 0x63c2, 0x080c, 0xa270, 0x003e, 0x002e,
-+ 0x7022, 0xa854, 0x7026, 0x63c2, 0x080c, 0xa260, 0x003e, 0x002e,
- 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb8a0, 0x00be,
-- 0x080c, 0xb094, 0x1118, 0x9084, 0xff80, 0x0110, 0x9085, 0x0001,
-- 0x0005, 0x00d6, 0x0096, 0x080c, 0x9ef8, 0x7003, 0x0500, 0x7814,
-+ 0x080c, 0xb07f, 0x1118, 0x9084, 0xff80, 0x0110, 0x9085, 0x0001,
-+ 0x0005, 0x00d6, 0x0096, 0x080c, 0x9ee8, 0x7003, 0x0500, 0x7814,
- 0x2048, 0xa874, 0x700a, 0xa878, 0x700e, 0xa87c, 0x7012, 0xa880,
- 0x7016, 0xa884, 0x701a, 0xa888, 0x701e, 0x60c3, 0x0010, 0x080c,
-- 0xa270, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x080c, 0x9ef8,
-+ 0xa260, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x080c, 0x9ee8,
- 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a, 0xa8d0, 0x700e,
- 0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc, 0x701a, 0xa8e0, 0x701e,
-- 0x60c3, 0x0010, 0x080c, 0xa270, 0x009e, 0x00de, 0x0005, 0x00d6,
-- 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ef8, 0x20e9, 0x0000,
-+ 0x60c3, 0x0010, 0x080c, 0xa260, 0x009e, 0x00de, 0x0005, 0x00d6,
-+ 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ee8, 0x20e9, 0x0000,
- 0x2001, 0x19a4, 0x2003, 0x0000, 0x7814, 0x2048, 0xa814, 0x8003,
- 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
- 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x2001, 0x0001, 0x080c,
-- 0x2205, 0x080c, 0xdcef, 0x9006, 0x080c, 0x2205, 0x001e, 0xa804,
-- 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c, 0xa270, 0x012e,
-+ 0x2205, 0x080c, 0xdcda, 0x9006, 0x080c, 0x2205, 0x001e, 0xa804,
-+ 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c, 0xa260, 0x012e,
- 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0x9f43, 0x20e9, 0x0000, 0x2001, 0x19a4, 0x2003, 0x0000,
-+ 0x080c, 0x9f33, 0x20e9, 0x0000, 0x2001, 0x19a4, 0x2003, 0x0000,
- 0x7814, 0x2048, 0xa86f, 0x0200, 0xa873, 0x0000, 0xa814, 0x8003,
- 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
-- 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x080c, 0xdcef, 0x001e,
-+ 0x2098, 0x2001, 0x19a4, 0x0016, 0x200c, 0x080c, 0xdcda, 0x001e,
- 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051, 0x7814, 0x2048,
-- 0x080c, 0x100b, 0x080c, 0xa270, 0x012e, 0x009e, 0x00de, 0x0005,
-+ 0x080c, 0x100b, 0x080c, 0xa260, 0x012e, 0x009e, 0x00de, 0x0005,
- 0x60c0, 0x8004, 0x9084, 0x0003, 0x9005, 0x0130, 0x9082, 0x0004,
-- 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c, 0x9ef8, 0x7003,
-- 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008, 0x0804, 0xa270,
-- 0x00d6, 0x00e6, 0x080c, 0x9f43, 0x7814, 0x9084, 0xff00, 0x2073,
-+ 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c, 0x9ee8, 0x7003,
-+ 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008, 0x0804, 0xa260,
-+ 0x00d6, 0x00e6, 0x080c, 0x9f33, 0x7814, 0x9084, 0xff00, 0x2073,
- 0x0200, 0x8e70, 0x8e70, 0x9096, 0xdf00, 0x0138, 0x9096, 0xe000,
- 0x0120, 0x2073, 0x0010, 0x8e70, 0x0030, 0x9095, 0x0010, 0x2272,
- 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805, 0x20a9, 0x0004,
-- 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9c68, 0x2069, 0x1801, 0x20a9,
-- 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9c71, 0x9096, 0xdf00,
-+ 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9c58, 0x2069, 0x1801, 0x20a9,
-+ 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9c61, 0x9096, 0xdf00,
- 0x0130, 0x9096, 0xe000, 0x0118, 0x60c3, 0x0018, 0x00f0, 0x2069,
- 0x19b4, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19ce, 0x20a9, 0x001a,
- 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010, 0x8000,
- 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072, 0x8d68,
-- 0x8e70, 0x1f04, 0x9c88, 0x60c3, 0x004c, 0x080c, 0xa270, 0x00ee,
-- 0x00de, 0x0005, 0x080c, 0x9ef8, 0x7003, 0x6300, 0x7007, 0x0028,
-- 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa270, 0x00d6, 0x0026,
-- 0x0016, 0x080c, 0x9f43, 0x7003, 0x0200, 0x7814, 0x700e, 0x00e6,
-+ 0x8e70, 0x1f04, 0x9c78, 0x60c3, 0x004c, 0x080c, 0xa260, 0x00ee,
-+ 0x00de, 0x0005, 0x080c, 0x9ee8, 0x7003, 0x6300, 0x7007, 0x0028,
-+ 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa260, 0x00d6, 0x0026,
-+ 0x0016, 0x080c, 0x9f33, 0x7003, 0x0200, 0x7814, 0x700e, 0x00e6,
- 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2069, 0x1924,
- 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70, 0x2073, 0x0000,
- 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800, 0x8e70, 0x2073,
-- 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0xa270, 0x001e,
-+ 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0xa260, 0x001e,
- 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004, 0x609a, 0x0804,
-- 0xa270, 0x080c, 0x9ef8, 0x7003, 0x5200, 0x2069, 0x1847, 0x6804,
-+ 0xa260, 0x080c, 0x9ee8, 0x7003, 0x5200, 0x2069, 0x1847, 0x6804,
- 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x26bf, 0x710e, 0x001e,
- 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
- 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
-- 0x0254, 0x4003, 0x080c, 0xb094, 0x1120, 0xb8a0, 0x9082, 0x007f,
-+ 0x0254, 0x4003, 0x080c, 0xb07f, 0x1120, 0xb8a0, 0x9082, 0x007f,
- 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001, 0x1820, 0x2004,
- 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x7036,
-- 0x60c3, 0x001c, 0x0804, 0xa270, 0x080c, 0x9ef8, 0x7003, 0x0500,
-- 0x080c, 0xb094, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001,
-+ 0x60c3, 0x001c, 0x0804, 0xa260, 0x080c, 0x9ee8, 0x7003, 0x0500,
-+ 0x080c, 0xb07f, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001,
- 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004, 0x700e, 0x0030,
- 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9, 0x0004,
- 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0250,
-- 0x4003, 0x60c3, 0x0010, 0x0804, 0xa270, 0x080c, 0x9ef8, 0x9006,
-- 0x080c, 0x6bdb, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2011, 0x0240,
-+ 0x4003, 0x60c3, 0x0010, 0x0804, 0xa260, 0x080c, 0x9ee8, 0x9006,
-+ 0x080c, 0x6bcb, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2011, 0x0240,
- 0x2013, 0x22ff, 0x2011, 0x0241, 0x2013, 0xfffe, 0x7003, 0x0400,
- 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d, 0x0120,
- 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300, 0xb8a0,
-- 0x9086, 0x007e, 0x1904, 0x9dcf, 0x00d6, 0x2069, 0x196c, 0x2001,
-+ 0x9086, 0x007e, 0x1904, 0x9dbf, 0x00d6, 0x2069, 0x196c, 0x2001,
- 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a, 0x6808, 0x9084,
-- 0x2000, 0x7012, 0x080c, 0xb0ab, 0x680c, 0x7016, 0x701f, 0x2710,
-+ 0x2000, 0x7012, 0x080c, 0xb096, 0x680c, 0x7016, 0x701f, 0x2710,
- 0x6818, 0x7022, 0x681c, 0x7026, 0x0428, 0x6800, 0x700a, 0x6804,
- 0x700e, 0x2009, 0x180d, 0x210c, 0xd18c, 0x0110, 0x2001, 0x0002,
-- 0x00f6, 0x2079, 0x0100, 0x080c, 0x779e, 0x1128, 0x78e3, 0x0000,
-- 0x080c, 0x2700, 0x78e2, 0x00fe, 0x6808, 0x080c, 0x779e, 0x1118,
-- 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012, 0x080c, 0xb0ab,
-+ 0x00f6, 0x2079, 0x0100, 0x080c, 0x778e, 0x1128, 0x78e3, 0x0000,
-+ 0x080c, 0x2700, 0x78e2, 0x00fe, 0x6808, 0x080c, 0x778e, 0x1118,
-+ 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012, 0x080c, 0xb096,
- 0x680c, 0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099,
- 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004,
-- 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0xaadc,
-+ 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0xaacc,
- 0x2069, 0x1974, 0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c,
-- 0x5844, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04e0, 0x2001,
-+ 0x5842, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04e0, 0x2001,
- 0x1837, 0x2004, 0xd0a4, 0x01a8, 0x0016, 0x2001, 0x180d, 0x2004,
- 0xd08c, 0x2009, 0x0002, 0x1118, 0x2001, 0x196d, 0x200c, 0x60e0,
- 0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x2700, 0x61e2,
- 0x001e, 0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9, 0x0000, 0x20a1,
- 0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805,
- 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
-- 0x025a, 0x4003, 0x080c, 0xaadc, 0x20a1, 0x024e, 0x20a9, 0x0008,
-- 0x2099, 0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0xa270, 0x080c,
-- 0x9ef8, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f,
-+ 0x025a, 0x4003, 0x080c, 0xaacc, 0x20a1, 0x024e, 0x20a9, 0x0008,
-+ 0x2099, 0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0xa260, 0x080c,
-+ 0x9ee8, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f,
- 0x2000, 0x9006, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac,
- 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x9085,
-- 0x0002, 0x00d6, 0x0804, 0x9ea8, 0x7026, 0x60c3, 0x0014, 0x0804,
-- 0xa270, 0x080c, 0x9ef8, 0x7003, 0x5000, 0x0804, 0x9d67, 0x080c,
-- 0x9ef8, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804,
-- 0xa270, 0x080c, 0x9f3a, 0x0010, 0x080c, 0x9f43, 0x7003, 0x0200,
-- 0x60c3, 0x0004, 0x0804, 0xa270, 0x080c, 0x9f43, 0x7003, 0x0100,
-- 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa270,
-- 0x080c, 0x9f43, 0x7003, 0x0200, 0x0804, 0x9d67, 0x080c, 0x9f43,
-+ 0x0002, 0x00d6, 0x0804, 0x9e98, 0x7026, 0x60c3, 0x0014, 0x0804,
-+ 0xa260, 0x080c, 0x9ee8, 0x7003, 0x5000, 0x0804, 0x9d57, 0x080c,
-+ 0x9ee8, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804,
-+ 0xa260, 0x080c, 0x9f2a, 0x0010, 0x080c, 0x9f33, 0x7003, 0x0200,
-+ 0x60c3, 0x0004, 0x0804, 0xa260, 0x080c, 0x9f33, 0x7003, 0x0100,
-+ 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa260,
-+ 0x080c, 0x9f33, 0x7003, 0x0200, 0x0804, 0x9d57, 0x080c, 0x9f33,
- 0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b,
-- 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa270, 0x00d6,
-- 0x080c, 0x9f43, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800,
-+ 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa260, 0x00d6,
-+ 0x080c, 0x9f33, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800,
- 0xb894, 0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190,
- 0xb998, 0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100,
- 0x0058, 0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f,
-@@ -4874,71 +4860,71 @@ unsigned short risc_code01[] = {
- 0x0026, 0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbad4,
- 0xd28c, 0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140,
- 0xd1ec, 0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd,
-- 0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0xa270, 0x080c,
-- 0x9f43, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3,
-- 0x0014, 0x0804, 0xa270, 0x080c, 0x9f43, 0x7003, 0x0200, 0x0804,
-- 0x9ce5, 0x080c, 0x9f43, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f,
-- 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa270, 0x080c, 0x9f43, 0x7003,
-- 0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0xa270, 0x0026,
-+ 0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0xa260, 0x080c,
-+ 0x9f33, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3,
-+ 0x0014, 0x0804, 0xa260, 0x080c, 0x9f33, 0x7003, 0x0200, 0x0804,
-+ 0x9cd5, 0x080c, 0x9f33, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f,
-+ 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa260, 0x080c, 0x9f33, 0x7003,
-+ 0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0xa260, 0x0026,
- 0x00d6, 0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040,
- 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100,
-- 0x080c, 0xaaf1, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069,
-+ 0x080c, 0xaae1, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069,
- 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x9485, 0x0029, 0x7012,
-- 0x004e, 0x003e, 0x00de, 0x080c, 0xa264, 0x721a, 0x9f95, 0x0000,
-+ 0x004e, 0x003e, 0x00de, 0x080c, 0xa254, 0x721a, 0x9f95, 0x0000,
- 0x7222, 0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026,
-- 0x080c, 0xaaf1, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069,
-+ 0x080c, 0xaae1, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069,
- 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x00de, 0x7013, 0x2029,
- 0x0c10, 0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f,
- 0x0000, 0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300,
- 0x2021, 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019,
-- 0x2300, 0x2021, 0x0100, 0x080c, 0xaaf1, 0xb810, 0x9305, 0x7002,
-+ 0x2300, 0x2021, 0x0100, 0x080c, 0xaae1, 0xb810, 0x9305, 0x7002,
- 0xb814, 0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814,
- 0x9005, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x687c,
- 0x700a, 0x6880, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e,
-- 0x003e, 0x00de, 0x080c, 0xa264, 0x721a, 0x7a08, 0x7222, 0x2f10,
-- 0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0xa264, 0x721a,
-+ 0x003e, 0x00de, 0x080c, 0xa254, 0x721a, 0x7a08, 0x7222, 0x2f10,
-+ 0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0xa254, 0x721a,
- 0x7a08, 0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005,
- 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071,
- 0x0240, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d85, 0x908a, 0x0092,
- 0x1a0c, 0x0d85, 0x6110, 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100,
- 0x619a, 0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-- 0x00be, 0x0005, 0x9fb1, 0x9fc0, 0x9fcb, 0x9faf, 0x9faf, 0x9faf,
-- 0x9fb1, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x080c,
-+ 0x00be, 0x0005, 0x9fa1, 0x9fb0, 0x9fbb, 0x9f9f, 0x9f9f, 0x9f9f,
-+ 0x9fa1, 0x9f9f, 0x9f9f, 0x9f9f, 0x9f9f, 0x9f9f, 0x9f9f, 0x080c,
- 0x0d85, 0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x2a04, 0x0228,
-- 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0xa270,
-+ 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0xa260,
- 0x0431, 0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3,
-- 0x000c, 0x0804, 0xa270, 0x04a1, 0x7003, 0x0003, 0x7007, 0x0300,
-- 0x60c3, 0x0004, 0x0804, 0xa270, 0x0026, 0x080c, 0xaaf1, 0xb810,
-+ 0x000c, 0x0804, 0xa260, 0x04a1, 0x7003, 0x0003, 0x7007, 0x0300,
-+ 0x60c3, 0x0004, 0x0804, 0xa260, 0x0026, 0x080c, 0xaae1, 0xb810,
- 0x9085, 0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c,
-- 0x700a, 0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0x9f13, 0x0026,
-- 0x080c, 0xaaf1, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006,
-+ 0x700a, 0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0x9f03, 0x0026,
-+ 0x080c, 0xaae1, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006,
- 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001, 0x0099,
-- 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc, 0x7012, 0x0804, 0x9f75,
-- 0x0026, 0x080c, 0xaaf1, 0xb810, 0x9085, 0x8500, 0x7002, 0xb814,
-+ 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc, 0x7012, 0x0804, 0x9f65,
-+ 0x0026, 0x080c, 0xaae1, 0xb810, 0x9085, 0x8500, 0x7002, 0xb814,
- 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001,
- 0x0099, 0x7a20, 0x9296, 0x0005, 0x0108, 0xc0bc, 0x7012, 0x0804,
-- 0x9f75, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069,
-+ 0x9f65, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069,
- 0x0200, 0x2071, 0x0240, 0x7804, 0x908a, 0x0040, 0x0a0c, 0x0d85,
- 0x908a, 0x0057, 0x1a0c, 0x0d85, 0x7910, 0x2158, 0xb984, 0x2061,
- 0x0100, 0x619a, 0x9082, 0x0040, 0x0033, 0x00fe, 0x00ee, 0x00de,
-- 0x00ce, 0x00be, 0x0005, 0xa04e, 0xa04e, 0xa04e, 0xa07f, 0xa04e,
-- 0xa04e, 0xa04e, 0xa04e, 0xa04e, 0xa04e, 0xa04e, 0xa644, 0xa649,
-- 0xa64e, 0xa653, 0xa04e, 0xa04e, 0xa04e, 0xa63f, 0x080c, 0x0d85,
-+ 0x00ce, 0x00be, 0x0005, 0xa03e, 0xa03e, 0xa03e, 0xa06f, 0xa03e,
-+ 0xa03e, 0xa03e, 0xa03e, 0xa03e, 0xa03e, 0xa03e, 0xa634, 0xa639,
-+ 0xa63e, 0xa643, 0xa03e, 0xa03e, 0xa03e, 0xa62f, 0x080c, 0x0d85,
- 0x6813, 0x0008, 0xba8c, 0x8210, 0xb8d4, 0xd084, 0x0180, 0x2001,
- 0x1b72, 0x200c, 0x8108, 0x2102, 0x2001, 0x1b71, 0x201c, 0x1218,
- 0x8318, 0x2302, 0x0ea0, 0x7952, 0x712e, 0x7b4e, 0x732a, 0x9294,
- 0x00ff, 0xba8e, 0x8217, 0x721a, 0xba10, 0x9295, 0x0600, 0x7202,
- 0xba14, 0x7206, 0x2069, 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e,
- 0x7013, 0x0829, 0x2f10, 0x7222, 0x7027, 0xffff, 0x0005, 0x0016,
-- 0x7814, 0x9084, 0x0700, 0x8007, 0x0013, 0x001e, 0x0005, 0xa08f,
-- 0xa08f, 0xa091, 0xa08f, 0xa08f, 0xa08f, 0xa0ab, 0xa08f, 0x080c,
-+ 0x7814, 0x9084, 0x0700, 0x8007, 0x0013, 0x001e, 0x0005, 0xa07f,
-+ 0xa07f, 0xa081, 0xa07f, 0xa07f, 0xa07f, 0xa09b, 0xa07f, 0x080c,
- 0x0d85, 0x7914, 0x918c, 0x08ff, 0x918d, 0xf600, 0x7916, 0x2009,
- 0x0003, 0x00b9, 0x2069, 0x1847, 0x6804, 0xd0bc, 0x0130, 0x682c,
- 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010, 0x7033, 0x3f00, 0x60c3,
-- 0x0001, 0x0804, 0xa270, 0x2009, 0x0003, 0x0019, 0x7033, 0x7f00,
-- 0x0cb0, 0x0016, 0x080c, 0xaaf1, 0x001e, 0xb810, 0x9085, 0x0100,
-+ 0x0001, 0x0804, 0xa260, 0x2009, 0x0003, 0x0019, 0x7033, 0x7f00,
-+ 0x0cb0, 0x0016, 0x080c, 0xaae1, 0x001e, 0xb810, 0x9085, 0x0100,
- 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6a7c, 0x720a, 0x6a80,
-- 0x720e, 0x7013, 0x0888, 0x918d, 0x0008, 0x7116, 0x080c, 0xa264,
-+ 0x720e, 0x7013, 0x0888, 0x918d, 0x0008, 0x7116, 0x080c, 0xa254,
- 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x0005, 0x00b6, 0x00e6,
- 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0036, 0x2061, 0x0100,
- 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0x76dc, 0x96b4, 0x0028,
-@@ -4953,7 +4939,7 @@ unsigned short risc_code01[] = {
- 0x60d7, 0x0000, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x0128,
- 0x609f, 0x0000, 0x2001, 0x0092, 0x0058, 0x6028, 0xc0bd, 0x602a,
- 0x609f, 0x00ff, 0x2011, 0xffff, 0x080c, 0x2ad3, 0x2001, 0x00b2,
-- 0x2010, 0x900e, 0x080c, 0x2ae2, 0x2009, 0x07d0, 0x080c, 0x8a50,
-+ 0x2010, 0x900e, 0x080c, 0x2ae2, 0x2009, 0x07d0, 0x080c, 0x8a40,
- 0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be,
- 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046,
- 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058,
-@@ -4970,12 +4956,12 @@ unsigned short risc_code01[] = {
- 0xb86c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000,
- 0xba84, 0x629e, 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe,
- 0x900e, 0x2011, 0x0092, 0x080c, 0x2ae2, 0x2009, 0x07d0, 0x080c,
-- 0x8a50, 0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee,
-+ 0x8a40, 0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee,
- 0x00be, 0x0005, 0x00b6, 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056,
- 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7810, 0x2058,
- 0xb8a0, 0x2028, 0xb910, 0xba14, 0x737c, 0x7480, 0x7820, 0x0002,
-- 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef,
-- 0xa1ef, 0xa1ef, 0xa1f1, 0xa1ef, 0xa1ef, 0xa1ef, 0xa1ef, 0x080c,
-+ 0xa1df, 0xa1df, 0xa1df, 0xa1df, 0xa1df, 0xa1df, 0xa1df, 0xa1df,
-+ 0xa1df, 0xa1df, 0xa1e1, 0xa1df, 0xa1df, 0xa1df, 0xa1df, 0x080c,
- 0x0d85, 0xb884, 0x609e, 0x7814, 0x2048, 0xa87c, 0xd0fc, 0x0558,
- 0xaf90, 0x9784, 0xff00, 0x9105, 0x6062, 0x873f, 0x9784, 0xff00,
- 0x0006, 0x7814, 0x2048, 0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160,
-@@ -4987,59 +4973,59 @@ unsigned short risc_code01[] = {
- 0x7808, 0x6086, 0x6266, 0x636a, 0x646e, 0x6077, 0x0000, 0xb88c,
- 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000,
- 0xa848, 0x608a, 0xa844, 0x608e, 0xa838, 0x60c6, 0xa834, 0x60ca,
-- 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x080c, 0xaad1,
-+ 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x080c, 0xaac1,
- 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009,
-- 0x1b58, 0x080c, 0x8a50, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de,
-+ 0x1b58, 0x080c, 0x8a40, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de,
- 0x00ee, 0x009e, 0x00be, 0x0005, 0x7a40, 0x9294, 0x00ff, 0x8217,
- 0x0005, 0x00d6, 0x2069, 0x19e8, 0x686b, 0x0001, 0x00de, 0x0005,
-- 0x60a3, 0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x8a42, 0x0005,
-+ 0x60a3, 0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x8a32, 0x0005,
- 0x0016, 0x2001, 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600,
-- 0x0128, 0x0089, 0x080c, 0x8a42, 0x001e, 0x0005, 0xc1e5, 0x2001,
-+ 0x0128, 0x0089, 0x080c, 0x8a32, 0x001e, 0x0005, 0xc1e5, 0x2001,
- 0x180c, 0x2102, 0x2001, 0x19e9, 0x2003, 0x0000, 0x2001, 0x19f4,
- 0x2003, 0x0000, 0x0c88, 0x0006, 0x0016, 0x0026, 0x2009, 0x1804,
- 0x2011, 0x0009, 0x080c, 0x2ae2, 0x002e, 0x001e, 0x000e, 0x0005,
-- 0x0016, 0x00c6, 0x0006, 0x080c, 0xacfc, 0x0106, 0x2061, 0x0100,
-+ 0x0016, 0x00c6, 0x0006, 0x080c, 0xacec, 0x0106, 0x2061, 0x0100,
- 0x61a4, 0x60a7, 0x95f5, 0x0016, 0x0026, 0x2009, 0x1804, 0x2011,
-- 0x0008, 0x080c, 0x2ae2, 0x002e, 0x001e, 0x010e, 0x090c, 0xad18,
-+ 0x0008, 0x080c, 0x2ae2, 0x002e, 0x001e, 0x010e, 0x090c, 0xad08,
- 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005,
- 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140,
-- 0x080c, 0x779e, 0x1510, 0x2001, 0x1a0d, 0x2004, 0x9005, 0x1904,
-- 0xa31f, 0x080c, 0x7840, 0x11a8, 0x2069, 0x0380, 0x6843, 0x0101,
-+ 0x080c, 0x778e, 0x1510, 0x2001, 0x1a0d, 0x2004, 0x9005, 0x1904,
-+ 0xa30f, 0x080c, 0x7830, 0x11a8, 0x2069, 0x0380, 0x6843, 0x0101,
- 0x6844, 0xd084, 0x1de8, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120,
-- 0x6024, 0xd084, 0x090c, 0x0d85, 0x6843, 0x0100, 0x080c, 0x8a42,
-+ 0x6024, 0xd084, 0x090c, 0x0d85, 0x6843, 0x0100, 0x080c, 0x8a32,
- 0x04b0, 0x00c6, 0x2061, 0x19e8, 0x00f0, 0x6904, 0x9194, 0x4000,
-- 0x0598, 0x080c, 0xa2a0, 0x080c, 0x2aa9, 0x00c6, 0x2061, 0x19e8,
-- 0x6134, 0x9192, 0x0008, 0x1278, 0x8108, 0x6136, 0x080c, 0xacfc,
-- 0x6130, 0x080c, 0xad18, 0x00ce, 0x81ff, 0x01c8, 0x080c, 0x8a42,
-- 0x080c, 0xa293, 0x00a0, 0x080c, 0xacfc, 0x6130, 0x91e5, 0x0000,
-- 0x0150, 0x080c, 0xeeee, 0x080c, 0x8a4b, 0x6003, 0x0001, 0x2009,
-- 0x0014, 0x080c, 0xb20a, 0x080c, 0xad18, 0x00ce, 0x0000, 0x002e,
-+ 0x0598, 0x080c, 0xa290, 0x080c, 0x2aa9, 0x00c6, 0x2061, 0x19e8,
-+ 0x6134, 0x9192, 0x0008, 0x1278, 0x8108, 0x6136, 0x080c, 0xacec,
-+ 0x6130, 0x080c, 0xad08, 0x00ce, 0x81ff, 0x01c8, 0x080c, 0x8a32,
-+ 0x080c, 0xa283, 0x00a0, 0x080c, 0xacec, 0x6130, 0x91e5, 0x0000,
-+ 0x0150, 0x080c, 0xeed5, 0x080c, 0x8a3b, 0x6003, 0x0001, 0x2009,
-+ 0x0014, 0x080c, 0xb1f5, 0x080c, 0xad08, 0x00ce, 0x0000, 0x002e,
- 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x1a0d, 0x2004, 0x9005,
- 0x1db0, 0x00c6, 0x2061, 0x19e8, 0x6134, 0x9192, 0x0003, 0x1ad8,
-- 0x8108, 0x6136, 0x00ce, 0x080c, 0x8a42, 0x080c, 0x6058, 0x2009,
-+ 0x8108, 0x6136, 0x00ce, 0x080c, 0x8a32, 0x080c, 0x6051, 0x2009,
- 0x1846, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096, 0x00c6, 0x00d6,
-- 0x00e6, 0x0016, 0x0026, 0x080c, 0x8a58, 0x080c, 0xacfc, 0x2001,
-+ 0x00e6, 0x0016, 0x0026, 0x080c, 0x8a48, 0x080c, 0xacec, 0x2001,
- 0x0387, 0x2003, 0x0202, 0x2071, 0x19e8, 0x714c, 0x81ff, 0x0904,
-- 0xa3d9, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x779e, 0x1518,
-- 0x0036, 0x2019, 0x0002, 0x080c, 0xa596, 0x003e, 0x080c, 0xeeee,
-+ 0xa3c9, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x778e, 0x1518,
-+ 0x0036, 0x2019, 0x0002, 0x080c, 0xa586, 0x003e, 0x080c, 0xeed5,
- 0x704c, 0x9065, 0x0180, 0x2009, 0x004a, 0x6220, 0x9296, 0x0009,
- 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a, 0x6003,
-- 0x0003, 0x080c, 0xb20a, 0x2001, 0x0386, 0x2003, 0x5040, 0x080c,
-- 0x7840, 0x0804, 0xa3d9, 0x6904, 0xd1f4, 0x0904, 0xa3e6, 0x080c,
-+ 0x0003, 0x080c, 0xb1f5, 0x2001, 0x0386, 0x2003, 0x5040, 0x080c,
-+ 0x7830, 0x0804, 0xa3c9, 0x6904, 0xd1f4, 0x0904, 0xa3d6, 0x080c,
- 0x2aa9, 0x00c6, 0x704c, 0x9065, 0x090c, 0x0d85, 0x6020, 0x00ce,
- 0x9086, 0x0006, 0x1520, 0x61c8, 0x60c4, 0x9105, 0x1500, 0x714c,
- 0x9188, 0x0011, 0x2104, 0xd0e4, 0x01d0, 0x6214, 0x9294, 0x1800,
- 0x1128, 0x6224, 0x9294, 0x0002, 0x15e0, 0x0010, 0xc0e4, 0x200a,
- 0x6014, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x6016, 0x704c, 0x2060,
-- 0x080c, 0x9a48, 0x2009, 0x0049, 0x080c, 0xb20a, 0x0450, 0x080c,
-- 0xeeee, 0x704c, 0x9065, 0x9086, 0x1b55, 0x1158, 0x080c, 0xafd2,
-- 0x1500, 0x2061, 0x1b55, 0x6064, 0x8000, 0x6066, 0x080c, 0x6058,
-- 0x00c0, 0x0036, 0x2019, 0x0001, 0x080c, 0xa596, 0x003e, 0x714c,
-+ 0x080c, 0x9a38, 0x2009, 0x0049, 0x080c, 0xb1f5, 0x0450, 0x080c,
-+ 0xeed5, 0x704c, 0x9065, 0x9086, 0x1b55, 0x1158, 0x080c, 0xafbd,
-+ 0x1500, 0x2061, 0x1b55, 0x6064, 0x8000, 0x6066, 0x080c, 0x6051,
-+ 0x00c0, 0x0036, 0x2019, 0x0001, 0x080c, 0xa586, 0x003e, 0x714c,
- 0x2160, 0x2009, 0x004a, 0x6220, 0x9296, 0x0009, 0x1130, 0x6114,
- 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a, 0x6003, 0x0003, 0x080c,
-- 0xb20a, 0x2001, 0x0387, 0x2003, 0x0200, 0x080c, 0xad18, 0x002e,
-+ 0xb1f5, 0x2001, 0x0387, 0x2003, 0x0200, 0x080c, 0xad08, 0x002e,
- 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e, 0x0005, 0xd1ec, 0x1904,
-- 0xa37f, 0x0804, 0xa381, 0x0026, 0x00e6, 0x2071, 0x19e8, 0x706c,
-+ 0xa36f, 0x0804, 0xa371, 0x0026, 0x00e6, 0x2071, 0x19e8, 0x706c,
- 0xd084, 0x01e8, 0xc084, 0x706e, 0x714c, 0x81ff, 0x01c0, 0x2071,
- 0x0100, 0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x2009,
- 0x1984, 0x2011, 0x0012, 0x080c, 0x2ae2, 0x0048, 0x928e, 0x0009,
-@@ -5049,111 +5035,111 @@ unsigned short risc_code01[] = {
- 0x00f6, 0x2079, 0x19e8, 0x610c, 0x9006, 0x600e, 0x6044, 0xc0fc,
- 0x6046, 0x86ff, 0x1140, 0x7824, 0x9c06, 0x1118, 0x7826, 0x782a,
- 0x0050, 0x792a, 0x0040, 0x00c6, 0x2660, 0x610e, 0x00ce, 0x7824,
-- 0x9c06, 0x1108, 0x7e26, 0x080c, 0xa65d, 0x080c, 0xd10c, 0x00fe,
-- 0x0005, 0x080c, 0x9ef8, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c,
-+ 0x9c06, 0x1108, 0x7e26, 0x080c, 0xa64d, 0x080c, 0xd0f9, 0x00fe,
-+ 0x0005, 0x080c, 0x9ee8, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c,
- 0x7016, 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005,
- 0x0130, 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061,
- 0x1800, 0x607c, 0x6180, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce,
-- 0x60c3, 0x002c, 0x0804, 0xa270, 0x080c, 0x9ef8, 0x7003, 0x0f00,
-+ 0x60c3, 0x002c, 0x0804, 0xa260, 0x080c, 0x9ee8, 0x7003, 0x0f00,
- 0x7808, 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814,
-- 0x700e, 0x60c3, 0x0008, 0x0804, 0xa270, 0x0156, 0x080c, 0x9f43,
-- 0x7003, 0x0200, 0x080c, 0x8b10, 0x20a9, 0x0006, 0x2011, 0xffec,
-+ 0x700e, 0x60c3, 0x0008, 0x0804, 0xa260, 0x0156, 0x080c, 0x9f33,
-+ 0x7003, 0x0200, 0x080c, 0x8b00, 0x20a9, 0x0006, 0x2011, 0xffec,
- 0x2019, 0xffed, 0x9ef0, 0x0002, 0x2305, 0x2072, 0x8e70, 0x2205,
-- 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xa484,
-- 0x60c3, 0x001c, 0x015e, 0x0804, 0xa270, 0x0016, 0x0026, 0x080c,
-- 0x9f1f, 0x080c, 0x9f31, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0,
-+ 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xa474,
-+ 0x60c3, 0x001c, 0x015e, 0x0804, 0xa260, 0x0016, 0x0026, 0x080c,
-+ 0x9f0f, 0x080c, 0x9f21, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0,
- 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c,
- 0x9080, 0x0021, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8,
- 0x9192, 0x0010, 0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2,
-- 0x080c, 0xa270, 0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003,
-- 0x080c, 0xaadc, 0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c,
-- 0x9ef8, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804,
-- 0xa270, 0x0016, 0x0026, 0x080c, 0x9ef8, 0x20e9, 0x0000, 0x20a1,
-+ 0x080c, 0xa260, 0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003,
-+ 0x080c, 0xaacc, 0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c,
-+ 0x9ee8, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804,
-+ 0xa260, 0x0016, 0x0026, 0x080c, 0x9ee8, 0x20e9, 0x0000, 0x20a1,
- 0x024c, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0,
- 0xa85c, 0x9080, 0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002,
-- 0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0xa270, 0x002e, 0x001e,
-+ 0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0xa260, 0x002e, 0x001e,
- 0x0005, 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
-- 0x19e8, 0x7010, 0x2060, 0x8cff, 0x0188, 0x080c, 0xd132, 0x1110,
-- 0x080c, 0xbb5c, 0x600c, 0x0006, 0x080c, 0xd3ae, 0x600f, 0x0000,
-- 0x080c, 0xb16c, 0x080c, 0xa65d, 0x00ce, 0x0c68, 0x2c00, 0x7012,
-+ 0x19e8, 0x7010, 0x2060, 0x8cff, 0x0188, 0x080c, 0xd11f, 0x1110,
-+ 0x080c, 0xbb47, 0x600c, 0x0006, 0x080c, 0xd39b, 0x600f, 0x0000,
-+ 0x080c, 0xb157, 0x080c, 0xa64d, 0x00ce, 0x0c68, 0x2c00, 0x7012,
- 0x700e, 0x012e, 0x000e, 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156,
- 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006,
- 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102,
- 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19e8, 0x7030, 0x2060,
-- 0x8cff, 0x0548, 0x080c, 0xa2a0, 0x6ac0, 0x68c3, 0x0000, 0x080c,
-- 0x8a4b, 0x00c6, 0x2061, 0x0100, 0x080c, 0xac2d, 0x00ce, 0x20a9,
-- 0x01f4, 0x04b1, 0x080c, 0x99ed, 0x6044, 0xd0ac, 0x1128, 0x2001,
-- 0x1988, 0x2004, 0x604a, 0x0020, 0x2009, 0x0013, 0x080c, 0xb20a,
-+ 0x8cff, 0x0548, 0x080c, 0xa290, 0x6ac0, 0x68c3, 0x0000, 0x080c,
-+ 0x8a3b, 0x00c6, 0x2061, 0x0100, 0x080c, 0xac1d, 0x00ce, 0x20a9,
-+ 0x01f4, 0x04b1, 0x080c, 0x99dd, 0x6044, 0xd0ac, 0x1128, 0x2001,
-+ 0x1988, 0x2004, 0x604a, 0x0020, 0x2009, 0x0013, 0x080c, 0xb1f5,
- 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
- 0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004, 0x9096, 0x0001,
-- 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x8a4b, 0x6814, 0x9084,
-+ 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x8a3b, 0x6814, 0x9084,
- 0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
-- 0x2011, 0x6002, 0x080c, 0x8993, 0x20a9, 0x01f4, 0x0009, 0x08c0,
-+ 0x2011, 0x5ffb, 0x080c, 0x8983, 0x20a9, 0x01f4, 0x0009, 0x08c0,
- 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000,
-- 0x190c, 0x2aa9, 0x0090, 0xd084, 0x0118, 0x6827, 0x4001, 0x0010,
-- 0x1f04, 0xa578, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100,
-+ 0x190c, 0x2aa9, 0x0090, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010,
-+ 0x1f04, 0xa568, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100,
- 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99, 0x0005, 0x0126, 0x0156,
- 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006,
- 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xdbff, 0x2102,
- 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x0380, 0x701c, 0x0006,
- 0x701f, 0x0202, 0x2071, 0x19e8, 0x704c, 0x2060, 0x8cff, 0x0904,
-- 0xa619, 0x080c, 0xaf84, 0x0904, 0xa619, 0x9386, 0x0002, 0x1128,
-- 0x6814, 0x9084, 0x0002, 0x0904, 0xa619, 0x68af, 0x95f5, 0x6817,
-+ 0xa609, 0x080c, 0xaf6f, 0x0904, 0xa609, 0x9386, 0x0002, 0x1128,
-+ 0x6814, 0x9084, 0x0002, 0x0904, 0xa609, 0x68af, 0x95f5, 0x6817,
- 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb, 0x0008,
-- 0x080c, 0x8a58, 0x080c, 0x1e44, 0x2001, 0x0032, 0x6920, 0xd1bc,
-+ 0x080c, 0x8a48, 0x080c, 0x1e44, 0x2001, 0x0032, 0x6920, 0xd1bc,
- 0x0130, 0x8001, 0x1dd8, 0x692c, 0x918d, 0x0008, 0x692e, 0x0016,
- 0x2009, 0x0040, 0x080c, 0x2220, 0x001e, 0x20a9, 0x03e8, 0x6824,
- 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c,
- 0x2aa9, 0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010, 0x1f04,
-- 0xa5e7, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-+ 0xa5d7, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
- 0x2a99, 0x9006, 0x080c, 0x2a99, 0x6827, 0x4000, 0x6824, 0x83ff,
- 0x1180, 0x2009, 0x0049, 0x6020, 0x9086, 0x0009, 0x0150, 0x080c,
-- 0x9a48, 0x6044, 0xd0ac, 0x1118, 0x6003, 0x0002, 0x0010, 0x080c,
-- 0xb20a, 0x000e, 0x2071, 0x0380, 0xd08c, 0x1110, 0x701f, 0x0200,
-+ 0x9a38, 0x6044, 0xd0ac, 0x1118, 0x6003, 0x0002, 0x0010, 0x080c,
-+ 0xb1f5, 0x000e, 0x2071, 0x0380, 0xd08c, 0x1110, 0x701f, 0x0200,
- 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
- 0x015e, 0x012e, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
- 0x19e8, 0x6a06, 0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091,
- 0x8000, 0x2069, 0x19e8, 0x6a3e, 0x012e, 0x00de, 0x0005, 0x080c,
-- 0xa050, 0x7047, 0x1000, 0x0098, 0x080c, 0xa050, 0x7047, 0x4000,
-- 0x0070, 0x080c, 0xa050, 0x7047, 0x2000, 0x0048, 0x080c, 0xa050,
-- 0x7047, 0x0400, 0x0020, 0x080c, 0xa050, 0x7047, 0x0200, 0x785c,
-- 0x7032, 0x60c3, 0x0020, 0x0804, 0xa270, 0x00e6, 0x2071, 0x19e8,
-+ 0xa040, 0x7047, 0x1000, 0x0098, 0x080c, 0xa040, 0x7047, 0x4000,
-+ 0x0070, 0x080c, 0xa040, 0x7047, 0x2000, 0x0048, 0x080c, 0xa040,
-+ 0x7047, 0x0400, 0x0020, 0x080c, 0xa040, 0x7047, 0x0200, 0x785c,
-+ 0x7032, 0x60c3, 0x0020, 0x0804, 0xa260, 0x00e6, 0x2071, 0x19e8,
- 0x702c, 0x9005, 0x0110, 0x8001, 0x702e, 0x00ee, 0x0005, 0x00f6,
- 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0006, 0x0126, 0x2091,
- 0x8000, 0x2071, 0x19e8, 0x7620, 0x2660, 0x2678, 0x2039, 0x0001,
-- 0x87ff, 0x0904, 0xa702, 0x8cff, 0x0904, 0xa702, 0x6020, 0x9086,
-- 0x0006, 0x1904, 0xa6fd, 0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904,
-- 0xa6fd, 0x2039, 0x0000, 0x0050, 0x6010, 0x9b06, 0x1904, 0xa6fd,
-- 0x85ff, 0x0120, 0x605c, 0x9106, 0x1904, 0xa6fd, 0x7030, 0x9c06,
-+ 0x87ff, 0x0904, 0xa6f2, 0x8cff, 0x0904, 0xa6f2, 0x6020, 0x9086,
-+ 0x0006, 0x1904, 0xa6ed, 0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904,
-+ 0xa6ed, 0x2039, 0x0000, 0x0050, 0x6010, 0x9b06, 0x1904, 0xa6ed,
-+ 0x85ff, 0x0120, 0x605c, 0x9106, 0x1904, 0xa6ed, 0x7030, 0x9c06,
- 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005, 0x1160, 0x6824, 0xd084,
-- 0x0148, 0x6827, 0x0001, 0x080c, 0x8a4b, 0x080c, 0xa78a, 0x7033,
-- 0x0000, 0x0428, 0x080c, 0x8a4b, 0x6820, 0xd0b4, 0x0110, 0x68a7,
-- 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c, 0xa78a, 0x7033,
-+ 0x0148, 0x6827, 0x0001, 0x080c, 0x8a3b, 0x080c, 0xa77a, 0x7033,
-+ 0x0000, 0x0428, 0x080c, 0x8a3b, 0x6820, 0xd0b4, 0x0110, 0x68a7,
-+ 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c, 0xa77a, 0x7033,
- 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
- 0x2001, 0x0100, 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069,
- 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7020,
- 0x9c36, 0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00,
- 0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000, 0x660c,
- 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x89ff,
-- 0x1168, 0x600f, 0x0000, 0x6014, 0x0096, 0x2048, 0x080c, 0xcf19,
-- 0x0110, 0x080c, 0xea30, 0x009e, 0x080c, 0xb1a7, 0x080c, 0xa65d,
-- 0x88ff, 0x1190, 0x00ce, 0x0804, 0xa678, 0x2c78, 0x600c, 0x2060,
-- 0x0804, 0xa678, 0x9006, 0x012e, 0x000e, 0x006e, 0x007e, 0x00ce,
-+ 0x1168, 0x600f, 0x0000, 0x6014, 0x0096, 0x2048, 0x080c, 0xcf06,
-+ 0x0110, 0x080c, 0xea17, 0x009e, 0x080c, 0xb192, 0x080c, 0xa64d,
-+ 0x88ff, 0x1190, 0x00ce, 0x0804, 0xa668, 0x2c78, 0x600c, 0x2060,
-+ 0x0804, 0xa668, 0x9006, 0x012e, 0x000e, 0x006e, 0x007e, 0x00ce,
- 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x98c5,
- 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0066,
- 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x7648,
-- 0x2660, 0x2678, 0x8cff, 0x0904, 0xa779, 0x6020, 0x9086, 0x0006,
-- 0x1904, 0xa774, 0x87ff, 0x0128, 0x2700, 0x9c06, 0x1904, 0xa774,
-- 0x0048, 0x6010, 0x9b06, 0x1904, 0xa774, 0x85ff, 0x0118, 0x605c,
-+ 0x2660, 0x2678, 0x8cff, 0x0904, 0xa769, 0x6020, 0x9086, 0x0006,
-+ 0x1904, 0xa764, 0x87ff, 0x0128, 0x2700, 0x9c06, 0x1904, 0xa764,
-+ 0x0048, 0x6010, 0x9b06, 0x1904, 0xa764, 0x85ff, 0x0118, 0x605c,
- 0x9106, 0x15d0, 0x704c, 0x9c06, 0x1178, 0x0036, 0x2019, 0x0001,
-- 0x080c, 0xa596, 0x703f, 0x0000, 0x9006, 0x704e, 0x706a, 0x7052,
-- 0x706e, 0x080c, 0xaff4, 0x003e, 0x7048, 0x9c36, 0x1110, 0x660c,
-+ 0x080c, 0xa586, 0x703f, 0x0000, 0x9006, 0x704e, 0x706a, 0x7052,
-+ 0x706e, 0x080c, 0xafdf, 0x003e, 0x7048, 0x9c36, 0x1110, 0x660c,
- 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
- 0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
- 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048,
-- 0x080c, 0xcf19, 0x0110, 0x080c, 0xea30, 0x080c, 0xb1a7, 0x87ff,
-- 0x1198, 0x00ce, 0x0804, 0xa722, 0x2c78, 0x600c, 0x2060, 0x0804,
-- 0xa722, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e,
-+ 0x080c, 0xcf06, 0x0110, 0x080c, 0xea17, 0x080c, 0xb192, 0x87ff,
-+ 0x1198, 0x00ce, 0x0804, 0xa712, 0x2c78, 0x600c, 0x2060, 0x0804,
-+ 0xa712, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e,
- 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd,
- 0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e8, 0x9006, 0x7032, 0x700a,
- 0x7004, 0x9086, 0x0003, 0x0158, 0x2001, 0x1800, 0x2004, 0x9086,
-@@ -5164,62 +5150,62 @@ unsigned short risc_code01[] = {
- 0x660c, 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
- 0x2f00, 0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x2c00, 0x9f06,
- 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6004, 0x9086,
-- 0x0040, 0x090c, 0x99ed, 0x9085, 0x0001, 0x0020, 0x2c78, 0x600c,
-+ 0x0040, 0x090c, 0x99dd, 0x9085, 0x0001, 0x0020, 0x2c78, 0x600c,
- 0x2060, 0x08b0, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00ee,
- 0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
- 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e8, 0x7610,
-- 0x2660, 0x2678, 0x8cff, 0x0904, 0xa877, 0x6010, 0x00b6, 0x2058,
-- 0xb8a0, 0x00be, 0x9206, 0x1904, 0xa872, 0x7030, 0x9c06, 0x1520,
-- 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xa849, 0x080c, 0xa2a0,
-- 0x68c3, 0x0000, 0x080c, 0xa78a, 0x7033, 0x0000, 0x0036, 0x2069,
-+ 0x2660, 0x2678, 0x8cff, 0x0904, 0xa867, 0x6010, 0x00b6, 0x2058,
-+ 0xb8a0, 0x00be, 0x9206, 0x1904, 0xa862, 0x7030, 0x9c06, 0x1520,
-+ 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xa839, 0x080c, 0xa290,
-+ 0x68c3, 0x0000, 0x080c, 0xa77a, 0x7033, 0x0000, 0x0036, 0x2069,
- 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
- 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069, 0x0100, 0x6824, 0xd084,
- 0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36, 0x1110, 0x660c,
- 0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
- 0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-- 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xd121,
-- 0x1180, 0x080c, 0x3344, 0x080c, 0xd132, 0x1518, 0x080c, 0xbb5c,
-- 0x0400, 0x080c, 0xa78a, 0x6824, 0xd084, 0x09b0, 0x6827, 0x0001,
-- 0x0898, 0x080c, 0xd132, 0x1118, 0x080c, 0xbb5c, 0x0090, 0x6014,
-- 0x2048, 0x080c, 0xcf19, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508,
-- 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x7006, 0x080c,
-- 0xd10c, 0x080c, 0xd3ae, 0x080c, 0xb1a7, 0x080c, 0xa65d, 0x00ce,
-- 0x0804, 0xa7f2, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa7f2, 0x012e,
-+ 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xd10e,
-+ 0x1180, 0x080c, 0x3344, 0x080c, 0xd11f, 0x1518, 0x080c, 0xbb47,
-+ 0x0400, 0x080c, 0xa77a, 0x6824, 0xd084, 0x09b0, 0x6827, 0x0001,
-+ 0x0898, 0x080c, 0xd11f, 0x1118, 0x080c, 0xbb47, 0x0090, 0x6014,
-+ 0x2048, 0x080c, 0xcf06, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508,
-+ 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6ff6, 0x080c,
-+ 0xd0f9, 0x080c, 0xd39b, 0x080c, 0xb192, 0x080c, 0xa64d, 0x00ce,
-+ 0x0804, 0xa7e2, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa7e2, 0x012e,
- 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e,
-- 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xea30, 0x0c08,
-- 0x00d6, 0x080c, 0x9f43, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3,
-+ 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xea17, 0x0c08,
-+ 0x00d6, 0x080c, 0x9f33, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3,
- 0x0014, 0x20e1, 0x0001, 0x2099, 0x1989, 0x20e9, 0x0000, 0x20a1,
- 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023, 0x0004, 0x7027, 0x7878,
-- 0x080c, 0xa270, 0x00de, 0x0005, 0x080c, 0x9f43, 0x700b, 0x0800,
-+ 0x080c, 0xa260, 0x00de, 0x0005, 0x080c, 0x9f33, 0x700b, 0x0800,
- 0x7814, 0x9084, 0xff00, 0x700e, 0x7814, 0x9084, 0x00ff, 0x7022,
- 0x782c, 0x7026, 0x7860, 0x9084, 0x00ff, 0x9085, 0x0200, 0x7002,
-- 0x7860, 0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0xa270,
-+ 0x7860, 0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0xa260,
- 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c,
-- 0xd5bb, 0x00de, 0x1904, 0xa925, 0x080c, 0x9ef8, 0x7003, 0x1300,
-- 0x782c, 0x080c, 0xaa34, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560,
-- 0x7810, 0x2058, 0xbaa0, 0x080c, 0xb094, 0x11d8, 0x9286, 0x007e,
-+ 0xd5a8, 0x00de, 0x1904, 0xa915, 0x080c, 0x9ee8, 0x7003, 0x1300,
-+ 0x782c, 0x080c, 0xaa24, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560,
-+ 0x7810, 0x2058, 0xbaa0, 0x080c, 0xb07f, 0x11d8, 0x9286, 0x007e,
- 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286, 0x007f,
- 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284, 0xff80,
- 0x0180, 0x9286, 0x0080, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc,
- 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e,
-- 0x00c0, 0xb884, 0x700e, 0x00a8, 0x080c, 0xb094, 0x1130, 0x7810,
-+ 0x00c0, 0xb884, 0x700e, 0x00a8, 0x080c, 0xb07f, 0x1130, 0x7810,
- 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6, 0x2069, 0x181f,
- 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010, 0x6034,
- 0x700e, 0x7838, 0x7012, 0x783c, 0x7016, 0x60c3, 0x000c, 0x001e,
-- 0x00de, 0x080c, 0xa270, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803,
-+ 0x00de, 0x080c, 0xa260, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803,
- 0x0006, 0x001e, 0x00de, 0x00be, 0x0005, 0x792c, 0x9180, 0x0008,
-- 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0xa9a4,
-- 0x9186, 0x0005, 0x0904, 0xa98c, 0x9186, 0x0004, 0x05f0, 0x9186,
-- 0x0008, 0x0904, 0xa995, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817,
-- 0x1700, 0x080c, 0xaa11, 0x0005, 0x080c, 0xa9d2, 0x00d6, 0x0026,
-+ 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0xa994,
-+ 0x9186, 0x0005, 0x0904, 0xa97c, 0x9186, 0x0004, 0x05f0, 0x9186,
-+ 0x0008, 0x0904, 0xa985, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817,
-+ 0x1700, 0x080c, 0xaa01, 0x0005, 0x080c, 0xa9c2, 0x00d6, 0x0026,
- 0x792c, 0x2168, 0x2009, 0x4000, 0x6800, 0x6a44, 0xd2fc, 0x11f8,
-- 0x0002, 0xa96c, 0xa977, 0xa96e, 0xa977, 0xa973, 0xa96c, 0xa96c,
-- 0xa977, 0xa977, 0xa977, 0xa977, 0xa96c, 0xa96c, 0xa96c, 0xa96c,
-- 0xa96c, 0xa977, 0xa96c, 0xa977, 0x080c, 0x0d85, 0x6824, 0xd0e4,
-+ 0x0002, 0xa95c, 0xa967, 0xa95e, 0xa967, 0xa963, 0xa95c, 0xa95c,
-+ 0xa967, 0xa967, 0xa967, 0xa967, 0xa95c, 0xa95c, 0xa95c, 0xa95c,
-+ 0xa95c, 0xa967, 0xa95c, 0xa967, 0x080c, 0x0d85, 0x6824, 0xd0e4,
- 0x0110, 0xd0cc, 0x0110, 0x900e, 0x0010, 0x2009, 0x2000, 0x682c,
-- 0x7022, 0x6830, 0x7026, 0x0804, 0xa9cb, 0x080c, 0xa9d2, 0x00d6,
-+ 0x7022, 0x6830, 0x7026, 0x0804, 0xa9bb, 0x080c, 0xa9c2, 0x00d6,
- 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6a00, 0x9286, 0x0002,
-- 0x1108, 0x900e, 0x0804, 0xa9cb, 0x080c, 0xa9d2, 0x00d6, 0x0026,
-+ 0x1108, 0x900e, 0x0804, 0xa9bb, 0x080c, 0xa9c2, 0x00d6, 0x0026,
- 0x792c, 0x2168, 0x2009, 0x4000, 0x04b0, 0x04e1, 0x00d6, 0x0026,
- 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005, 0x0118, 0x9286,
- 0x0002, 0x1108, 0x900e, 0x0438, 0x0469, 0x00d6, 0x0026, 0x792c,
-@@ -5228,31 +5214,31 @@ unsigned short risc_code01[] = {
- 0x792c, 0x9180, 0x0011, 0x2004, 0xd0fc, 0x1148, 0x9180, 0x0000,
- 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004, 0x0118, 0x2009,
- 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018, 0x002e, 0x00de,
-- 0x0804, 0xa270, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066, 0x080c,
-- 0x9f43, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c, 0x710e,
-- 0x7810, 0x2058, 0xb8a0, 0x080c, 0xb094, 0x1118, 0x9092, 0x007e,
-+ 0x0804, 0xa260, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066, 0x080c,
-+ 0x9f33, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c, 0x710e,
-+ 0x7810, 0x2058, 0xb8a0, 0x080c, 0xb07f, 0x1118, 0x9092, 0x007e,
- 0x0268, 0x00d6, 0x2069, 0x181f, 0x2d2c, 0x8d68, 0x2d34, 0x90d8,
- 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e, 0xbc84,
- 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008, 0x2004, 0x9086,
- 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e, 0x0020, 0x7312,
- 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e, 0x003e, 0x00be,
-- 0x0005, 0x080c, 0x9f43, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814,
-- 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa270, 0x080c, 0x9eef,
-+ 0x0005, 0x080c, 0x9f33, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814,
-+ 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa260, 0x080c, 0x9edf,
- 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c, 0x700e, 0x782c,
- 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff, 0x8007, 0x701a,
-- 0x60c3, 0x0010, 0x0804, 0xa270, 0x00e6, 0x2071, 0x0240, 0x0006,
-+ 0x60c3, 0x0010, 0x0804, 0xa260, 0x00e6, 0x2071, 0x0240, 0x0006,
- 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8d4, 0xd084, 0x0120,
- 0x784c, 0x702a, 0x7850, 0x702e, 0x00be, 0x00fe, 0x000e, 0x00ee,
-- 0x0005, 0x080c, 0x9f3a, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814,
-- 0x700e, 0x60c3, 0x0008, 0x0804, 0xa270, 0x00a9, 0x7914, 0x712a,
-+ 0x0005, 0x080c, 0x9f2a, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814,
-+ 0x700e, 0x60c3, 0x0008, 0x0804, 0xa260, 0x00a9, 0x7914, 0x712a,
- 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026, 0x080c, 0x2a04, 0x0228,
-- 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x080c, 0xa293,
-- 0x080c, 0x8a42, 0x0005, 0x0036, 0x0096, 0x00d6, 0x00e6, 0x7860,
-+ 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x080c, 0xa283,
-+ 0x080c, 0x8a32, 0x0005, 0x0036, 0x0096, 0x00d6, 0x00e6, 0x7860,
- 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294, 0x00fd, 0xaa7e, 0xaa80,
- 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194, 0x00ff, 0xab74, 0x9384,
- 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384, 0xff00, 0x9215, 0xaa76,
- 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6, 0x2069, 0x0200, 0x080c,
-- 0xaaf1, 0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000a,
-+ 0xaae1, 0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000a,
- 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x4003, 0x60a3,
- 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286, 0x3000, 0x0110, 0x60a3,
- 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e, 0x0005, 0x900e, 0x7814,
-@@ -5264,30 +5250,30 @@ unsigned short risc_code01[] = {
- 0x080c, 0x2ae2, 0x002e, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009,
- 0x000a, 0x0088, 0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058,
- 0x2009, 0x000d, 0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f,
-- 0x0010, 0x2009, 0x0008, 0x6912, 0x0005, 0x080c, 0x9ef8, 0x0016,
-+ 0x0010, 0x2009, 0x0008, 0x6912, 0x0005, 0x080c, 0x9ee8, 0x0016,
- 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x2001,
- 0x1837, 0x2004, 0x9084, 0x0028, 0x1138, 0x2001, 0x197c, 0x2004,
-- 0x9086, 0xaaaa, 0x1904, 0xab96, 0x7003, 0x5400, 0x00c6, 0x2061,
-+ 0x9086, 0xaaaa, 0x1904, 0xab86, 0x7003, 0x5400, 0x00c6, 0x2061,
- 0x1800, 0x607c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00,
- 0x9105, 0x700a, 0x6080, 0x700e, 0xa998, 0x918c, 0xff00, 0x7112,
- 0x20a9, 0x0004, 0x2009, 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104,
-- 0x2012, 0x8108, 0x8210, 0x1f04, 0xab27, 0x20a9, 0x0004, 0x2009,
-- 0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xab31, 0xa860,
-+ 0x2012, 0x8108, 0x8210, 0x1f04, 0xab17, 0x20a9, 0x0004, 0x2009,
-+ 0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xab21, 0xa860,
- 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9,
- 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6,
-- 0x2069, 0x0200, 0x080c, 0xaadc, 0x00de, 0x2071, 0x0240, 0x2011,
-+ 0x2069, 0x0200, 0x080c, 0xaacc, 0x00de, 0x2071, 0x0240, 0x2011,
- 0x0240, 0x2009, 0x0002, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
- 0x8210, 0x8109, 0x1dc0, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002,
- 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031,
- 0x2098, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
- 0x8210, 0x8109, 0x1dc0, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056,
- 0x60a7, 0x9575, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1168,
-- 0x080c, 0x779e, 0x0150, 0x6028, 0xc0bd, 0x602a, 0x2009, 0x1804,
-- 0x2011, 0x0029, 0x080c, 0x2ae2, 0x0010, 0x080c, 0xa270, 0x080c,
-- 0x8a42, 0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071,
-+ 0x080c, 0x778e, 0x0150, 0x6028, 0xc0bd, 0x602a, 0x2009, 0x1804,
-+ 0x2011, 0x0029, 0x080c, 0x2ae2, 0x0010, 0x080c, 0xa260, 0x080c,
-+ 0x8a32, 0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071,
- 0x0240, 0x2001, 0x2200, 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff,
-- 0x2071, 0x0100, 0x709b, 0x00ff, 0x00ee, 0x0804, 0xab0c, 0x080c,
-- 0x9ef8, 0x0016, 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013,
-+ 0x2071, 0x0100, 0x709b, 0x00ff, 0x00ee, 0x0804, 0xaafc, 0x080c,
-+ 0x9ee8, 0x0016, 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013,
- 0x0138, 0x7003, 0x5500, 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998,
- 0x810f, 0x918c, 0xff00, 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00,
- 0xa8a0, 0x9084, 0x00ff, 0x9105, 0x700e, 0xa998, 0x918c, 0xff00,
-@@ -5295,39 +5281,39 @@ unsigned short risc_code01[] = {
- 0x7116, 0x2009, 0x0008, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029,
- 0x2098, 0x2e10, 0x9290, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007,
- 0x2012, 0x8210, 0x8109, 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805,
-- 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xabe8, 0x20a9, 0x0002,
-- 0x2009, 0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xabf2,
-- 0x00d6, 0x0016, 0x2069, 0x0200, 0x080c, 0xaadc, 0x001e, 0x00de,
-+ 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xabd8, 0x20a9, 0x0002,
-+ 0x2009, 0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xabe2,
-+ 0x00d6, 0x0016, 0x2069, 0x0200, 0x080c, 0xaacc, 0x001e, 0x00de,
- 0x2071, 0x0240, 0x20a9, 0x0002, 0x2009, 0x1803, 0x2011, 0x0240,
-- 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xac08, 0x2009, 0x0008,
-+ 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xabf8, 0x2009, 0x0008,
- 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9,
-- 0x0008, 0x2012, 0x8210, 0x1f04, 0xac19, 0x00ce, 0x60c3, 0x004c,
-- 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa270, 0x080c, 0x8a42,
-+ 0x0008, 0x2012, 0x8210, 0x1f04, 0xac09, 0x00ce, 0x60c3, 0x004c,
-+ 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa260, 0x080c, 0x8a32,
- 0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018,
- 0x8214, 0x20e9, 0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8,
- 0x9284, 0x00e0, 0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008,
- 0x9016, 0x20a1, 0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810,
- 0x8000, 0x6812, 0x0c60, 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6,
- 0x00c6, 0x00a6, 0x0096, 0x0066, 0x0126, 0x2091, 0x8000, 0x2071,
-- 0x19e8, 0x7610, 0x2660, 0x2678, 0x8cff, 0x0904, 0xacd9, 0x7030,
-- 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xacab,
-- 0x080c, 0xa2a0, 0x68c3, 0x0000, 0x080c, 0xa78a, 0x7033, 0x0000,
-+ 0x19e8, 0x7610, 0x2660, 0x2678, 0x8cff, 0x0904, 0xacc9, 0x7030,
-+ 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xac9b,
-+ 0x080c, 0xa290, 0x68c3, 0x0000, 0x080c, 0xa77a, 0x7033, 0x0000,
- 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
- 0x0100, 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069, 0x0100,
- 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36,
- 0x1110, 0x660c, 0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36,
- 0x0118, 0x2f00, 0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066,
- 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-- 0x080c, 0xd121, 0x1180, 0x080c, 0x3344, 0x080c, 0xd132, 0x1518,
-- 0x080c, 0xbb5c, 0x0400, 0x080c, 0xa78a, 0x6824, 0xd084, 0x09b0,
-- 0x6827, 0x0001, 0x0898, 0x080c, 0xd132, 0x1118, 0x080c, 0xbb5c,
-- 0x0090, 0x6014, 0x2048, 0x080c, 0xcf19, 0x0168, 0x6020, 0x9086,
-+ 0x080c, 0xd10e, 0x1180, 0x080c, 0x3344, 0x080c, 0xd11f, 0x1518,
-+ 0x080c, 0xbb47, 0x0400, 0x080c, 0xa77a, 0x6824, 0xd084, 0x09b0,
-+ 0x6827, 0x0001, 0x0898, 0x080c, 0xd11f, 0x1118, 0x080c, 0xbb47,
-+ 0x0090, 0x6014, 0x2048, 0x080c, 0xcf06, 0x0168, 0x6020, 0x9086,
- 0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-- 0x7012, 0x080c, 0xd10c, 0x080c, 0xd3ae, 0x080c, 0xb1a7, 0x080c,
-- 0xa65d, 0x00ce, 0x0804, 0xac5c, 0x2c78, 0x600c, 0x2060, 0x0804,
-- 0xac5c, 0x7013, 0x0000, 0x700f, 0x0000, 0x012e, 0x006e, 0x009e,
-+ 0x7002, 0x080c, 0xd0f9, 0x080c, 0xd39b, 0x080c, 0xb192, 0x080c,
-+ 0xa64d, 0x00ce, 0x0804, 0xac4c, 0x2c78, 0x600c, 0x2060, 0x0804,
-+ 0xac4c, 0x7013, 0x0000, 0x700f, 0x0000, 0x012e, 0x006e, 0x009e,
- 0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086,
-- 0x0006, 0x1d08, 0x080c, 0xea30, 0x08f0, 0x00f6, 0x0036, 0x2079,
-+ 0x0006, 0x1d08, 0x080c, 0xea17, 0x08f0, 0x00f6, 0x0036, 0x2079,
- 0x0380, 0x7b18, 0xd3bc, 0x1de8, 0x7832, 0x7936, 0x7a3a, 0x781b,
- 0x8080, 0x003e, 0x00fe, 0x0005, 0x0016, 0x2001, 0x0382, 0x2004,
- 0x9084, 0x0007, 0x9086, 0x0001, 0x1188, 0x2001, 0x0015, 0x0c29,
-@@ -5337,2120 +5323,2118 @@ unsigned short risc_code01[] = {
- 0x2001, 0x0380, 0x2003, 0x0001, 0x0005, 0x0156, 0x0016, 0x0026,
- 0x00e6, 0x900e, 0x2071, 0x19e8, 0x0469, 0x0106, 0x0190, 0x7004,
- 0x9086, 0x0003, 0x0148, 0x20a9, 0x1000, 0x6044, 0xd0fc, 0x01d8,
-- 0x1f04, 0xad35, 0x080c, 0x0d85, 0x080c, 0xacfc, 0x6044, 0xd0fc,
-- 0x0190, 0x7030, 0x9c06, 0x1148, 0x080c, 0x99ed, 0x6044, 0xd0dc,
-+ 0x1f04, 0xad25, 0x080c, 0x0d85, 0x080c, 0xacec, 0x6044, 0xd0fc,
-+ 0x0190, 0x7030, 0x9c06, 0x1148, 0x080c, 0x99dd, 0x6044, 0xd0dc,
- 0x0150, 0xc0dc, 0x6046, 0x700a, 0x7042, 0x704c, 0x9c06, 0x190c,
-- 0x0d85, 0x080c, 0x9a48, 0x010e, 0x1919, 0x00ee, 0x002e, 0x001e,
-+ 0x0d85, 0x080c, 0x9a38, 0x010e, 0x1919, 0x00ee, 0x002e, 0x001e,
- 0x015e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086,
- 0x0003, 0x0005, 0x0126, 0x2091, 0x2400, 0x7808, 0xd0a4, 0x190c,
- 0x0d7e, 0xd09c, 0x0128, 0x7820, 0x908c, 0xf000, 0x11b8, 0x0012,
-- 0x012e, 0x0005, 0xad82, 0xadc0, 0xadef, 0xae37, 0xae47, 0xae58,
-- 0xae67, 0xae75, 0xaea2, 0xaea6, 0xad82, 0xad82, 0xaea9, 0xaec5,
-- 0xad82, 0xad82, 0x080c, 0x0d85, 0x012e, 0x0005, 0x2060, 0x6044,
-+ 0x012e, 0x0005, 0xad72, 0xadb0, 0xadda, 0xae22, 0xae32, 0xae43,
-+ 0xae52, 0xae60, 0xae8d, 0xae91, 0xad72, 0xad72, 0xae94, 0xaeb0,
-+ 0xad72, 0xad72, 0x080c, 0x0d85, 0x012e, 0x0005, 0x2060, 0x6044,
- 0xd0bc, 0x0140, 0xc0bc, 0x6046, 0x6000, 0x908a, 0x0010, 0x1a0c,
-- 0x0d85, 0x0012, 0x012e, 0x0005, 0xada7, 0xada9, 0xada7, 0xadaf,
-- 0xada7, 0xada7, 0xada7, 0xada7, 0xada7, 0xada9, 0xada7, 0xada9,
-- 0xada7, 0xada9, 0xada7, 0xada7, 0xada7, 0xada9, 0xada7, 0x080c,
-- 0x0d85, 0x2009, 0x0013, 0x080c, 0xb20a, 0x012e, 0x0005, 0x6014,
-- 0x2048, 0xa87c, 0xd0dc, 0x0130, 0x080c, 0x8c19, 0x080c, 0xb16c,
-- 0x012e, 0x0005, 0x2009, 0x0049, 0x080c, 0xb20a, 0x012e, 0x0005,
-- 0x080c, 0xacfc, 0x2001, 0x1a0d, 0x2003, 0x0000, 0x7030, 0x9065,
-- 0x1130, 0x7004, 0x9086, 0x0003, 0x01e0, 0x080c, 0x0d85, 0x7034,
-- 0x9092, 0xc350, 0x1258, 0x8000, 0x7036, 0x7004, 0x9086, 0x0003,
-- 0x0110, 0x7007, 0x0000, 0x781f, 0x0808, 0x0058, 0x080c, 0xb0c0,
-- 0x0140, 0x080c, 0xeeee, 0x6003, 0x0001, 0x2009, 0x0014, 0x080c,
-- 0xb20a, 0x781f, 0x0100, 0x080c, 0xad18, 0x012e, 0x0005, 0x080c,
-- 0xacfc, 0x714c, 0x81ff, 0x1128, 0x2011, 0x1a10, 0x2013, 0x0000,
-- 0x04c0, 0x2061, 0x0100, 0x7150, 0x9192, 0x7530, 0x1678, 0x8108,
-- 0x7152, 0x714c, 0x9186, 0x1b55, 0x0120, 0x2001, 0x0391, 0x2003,
-- 0x0400, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1160, 0x6014,
-- 0x9084, 0x1984, 0x9085, 0x0012, 0x714c, 0x918e, 0x1b55, 0x1108,
-- 0xc0fd, 0x6016, 0x00b0, 0x714c, 0x9188, 0x0008, 0x210c, 0x918e,
-- 0x0009, 0x0d68, 0x6014, 0x9084, 0x1984, 0x9085, 0x0016, 0x714c,
-- 0x918e, 0x1b55, 0x1108, 0xc0fd, 0x6016, 0x0018, 0x706c, 0xc085,
-- 0x706e, 0x781f, 0x0200, 0x080c, 0xad18, 0x012e, 0x0005, 0x080c,
-- 0xacfc, 0x714c, 0x2160, 0x6003, 0x0003, 0x2009, 0x004a, 0x080c,
-- 0xb20a, 0x781f, 0x0200, 0x080c, 0xad18, 0x012e, 0x0005, 0x7808,
-- 0xd09c, 0x0de8, 0x7820, 0x2060, 0x6003, 0x0003, 0x080c, 0xacfc,
-- 0x080c, 0x1dcc, 0x781f, 0x0400, 0x080c, 0xad18, 0x012e, 0x0005,
-- 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x080c, 0xacfc, 0x080c,
-- 0x1e14, 0x781f, 0x0400, 0x080c, 0xad18, 0x012e, 0x0005, 0x7030,
-- 0x9065, 0x0148, 0x6044, 0xc0bc, 0x6046, 0x7104, 0x9186, 0x0003,
-- 0x0110, 0x080c, 0x9ab4, 0x012e, 0x0005, 0x00f6, 0x703c, 0x9086,
-- 0x0002, 0x0528, 0x704c, 0x907d, 0x0510, 0x7844, 0xc0bc, 0x7846,
-- 0x7820, 0x9086, 0x0009, 0x0118, 0x080c, 0xa1ca, 0x00c0, 0x7828,
-- 0xd0fc, 0x1118, 0x080c, 0xa149, 0x0090, 0x2001, 0x1837, 0x2004,
-- 0x9084, 0x0028, 0x1130, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa,
-- 0x1120, 0x2001, 0x0387, 0x2003, 0x1000, 0x080c, 0xa0ce, 0x00fe,
-- 0x012e, 0x0005, 0x080c, 0x7840, 0x012e, 0x0005, 0x080c, 0x0d85,
-- 0x0005, 0x2009, 0x1b66, 0x2104, 0xd0bc, 0x01a8, 0xc0bc, 0x200a,
-- 0x2009, 0x010b, 0x2104, 0x9085, 0x0002, 0x200a, 0x2009, 0x0101,
-- 0x2104, 0xc0ac, 0x200a, 0x2009, 0x0105, 0x2104, 0x9084, 0x1984,
-- 0x9085, 0x8092, 0x200a, 0x012e, 0x0005, 0x080c, 0x8a58, 0x2009,
-- 0x010b, 0x2104, 0xd08c, 0x01a8, 0xc08c, 0x200a, 0x2001, 0x1848,
-- 0x2004, 0xd094, 0x1130, 0x2009, 0x0101, 0x2104, 0x9085, 0x0020,
-- 0x200a, 0x2009, 0x1b66, 0x200b, 0x0000, 0x2001, 0x001b, 0x080c,
-- 0xaced, 0x012e, 0x0005, 0x00e6, 0x2071, 0x19e8, 0x6044, 0xc0bc,
-- 0x6046, 0xd0fc, 0x01b8, 0x704c, 0x9c06, 0x1190, 0x2019, 0x0001,
-- 0x080c, 0xa596, 0x704f, 0x0000, 0x2001, 0x0109, 0x2004, 0xd08c,
-- 0x1138, 0x2001, 0x0108, 0x2004, 0xd0bc, 0x1110, 0x703f, 0x0000,
-- 0x080c, 0xa7a1, 0x00ee, 0x0005, 0x0026, 0x7010, 0x9c06, 0x1178,
-- 0x080c, 0xa65d, 0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120,
-- 0x7212, 0x600f, 0x0000, 0x0010, 0x7212, 0x720e, 0x9006, 0x002e,
-- 0x0005, 0x0026, 0x7020, 0x9c06, 0x1178, 0x080c, 0xa65d, 0x6044,
-- 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120, 0x7222, 0x600f, 0x0000,
-- 0x0010, 0x7222, 0x721e, 0x9006, 0x002e, 0x0005, 0x00d6, 0x0036,
-- 0x7830, 0x9c06, 0x1558, 0x2069, 0x0100, 0x68c0, 0x9005, 0x01f8,
-- 0x080c, 0x8a4b, 0x080c, 0xa2a0, 0x68c3, 0x0000, 0x080c, 0xa78a,
-- 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
-- 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99, 0x2069, 0x0100, 0x6824,
-- 0xd084, 0x0110, 0x6827, 0x0001, 0x9085, 0x0001, 0x0038, 0x7808,
-- 0xc0ad, 0x780a, 0x6003, 0x0009, 0x630a, 0x9006, 0x003e, 0x00de,
-- 0x0005, 0x0016, 0x0026, 0x0036, 0x6100, 0x2019, 0x0100, 0x2001,
-- 0x0382, 0x2004, 0xd09c, 0x0190, 0x00c6, 0x0126, 0x2091, 0x2800,
-- 0x0016, 0x0036, 0x080c, 0xad62, 0x003e, 0x001e, 0x012e, 0x00ce,
-- 0x6200, 0x2200, 0x9106, 0x0d58, 0x2200, 0x0010, 0x8319, 0x1d38,
-- 0x003e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00d6, 0x00c6, 0x080c,
-- 0xacfc, 0x0106, 0x2071, 0x19e8, 0x2069, 0x0100, 0x704c, 0x2060,
-- 0x9086, 0x1b55, 0x15b8, 0x6814, 0xd08c, 0x0188, 0x6817, 0x0010,
-- 0x2009, 0x0019, 0x8109, 0x1df0, 0x2001, 0x0032, 0x6920, 0xd1bc,
-- 0x0130, 0x8001, 0x1dd8, 0x692c, 0x918d, 0x0008, 0x692e, 0x6824,
-- 0xd08c, 0x0110, 0x6827, 0x0002, 0x68d0, 0x9005, 0x0118, 0x9082,
-- 0x0005, 0x0238, 0x6060, 0x8000, 0x6062, 0x2001, 0x0391, 0x2003,
-- 0x0400, 0x080c, 0x9a48, 0x682c, 0x9084, 0xfffd, 0x682e, 0x2001,
-- 0x1848, 0x2004, 0xd094, 0x1120, 0x6804, 0x9085, 0x0020, 0x6806,
-- 0x2069, 0x0000, 0x010e, 0x090c, 0xad18, 0x8dff, 0x00ce, 0x00de,
-- 0x00ee, 0x0005, 0x00e6, 0x00d6, 0x00c6, 0x080c, 0xacfc, 0x0106,
-- 0x2071, 0x19e8, 0x2069, 0x0100, 0x080c, 0xaf84, 0x68d0, 0x9005,
-- 0x0158, 0x9082, 0x0005, 0x1240, 0x080c, 0x2b33, 0x2001, 0x0391,
-- 0x2003, 0x0400, 0x2069, 0x0000, 0x010e, 0x090c, 0xad18, 0x8dff,
-- 0x00ce, 0x00de, 0x00ee, 0x0005, 0x0016, 0x2001, 0x0134, 0x2004,
-- 0x9005, 0x0140, 0x9082, 0x0005, 0x1228, 0x2001, 0x0391, 0x2003,
-- 0x0404, 0x0020, 0x2001, 0x0391, 0x2003, 0x0400, 0x001e, 0x0005,
-- 0x00d6, 0x0156, 0x080c, 0x9f43, 0x7a14, 0x82ff, 0x0138, 0x7003,
-- 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0490, 0x7003, 0x0200,
-- 0x7007, 0x0000, 0x2069, 0x1800, 0x901e, 0x6800, 0x9086, 0x0004,
-- 0x1110, 0xc38d, 0x0060, 0x080c, 0x779e, 0x1110, 0xc3ad, 0x0008,
-- 0xc3a5, 0x6adc, 0xd29c, 0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e,
-- 0x080c, 0x8b10, 0x20a9, 0x0006, 0x2011, 0xffec, 0x2019, 0xffed,
-- 0x2071, 0x0250, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70,
-- 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0xb03a, 0x60c3, 0x0020,
-- 0x080c, 0xa270, 0x015e, 0x00de, 0x0005, 0x0156, 0x080c, 0x9f43,
-- 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff, 0x0118, 0x9282, 0x000e,
-- 0x1238, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0488,
-- 0x7003, 0x0200, 0x7007, 0x001c, 0x700f, 0x0001, 0x2011, 0x19be,
-- 0x2204, 0x8007, 0x701a, 0x8210, 0x2204, 0x8007, 0x701e, 0x0421,
-- 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181f, 0x2004,
-- 0x7022, 0x2001, 0x1820, 0x2004, 0x7026, 0x0030, 0x2001, 0x1818,
-- 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001,
-- 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3,
-- 0x001c, 0x015e, 0x0804, 0xa270, 0x0006, 0x2001, 0x1837, 0x2004,
-- 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003, 0x080c, 0xa62b, 0x2011,
-- 0x0002, 0x080c, 0xa635, 0x080c, 0xa516, 0x0036, 0x901e, 0x080c,
-- 0xa596, 0x003e, 0x0005, 0x080c, 0x3487, 0x0188, 0x0016, 0x00b6,
-- 0x00c6, 0x7010, 0x9085, 0x0020, 0x7012, 0x2009, 0x007e, 0x080c,
-- 0x67b4, 0xb85c, 0xc0ac, 0xb85e, 0x00ce, 0x00be, 0x001e, 0x0005,
-- 0x00d6, 0x00f6, 0x7104, 0x9186, 0x0004, 0x1130, 0x7410, 0x9e90,
-- 0x0004, 0x9e98, 0x0003, 0x0088, 0x9186, 0x0001, 0x1130, 0x7420,
-- 0x9e90, 0x0008, 0x9e98, 0x0007, 0x0040, 0x9186, 0x0002, 0x1538,
-- 0x7428, 0x9e90, 0x000a, 0x9e98, 0x0009, 0x6110, 0x2468, 0x680c,
-- 0x907d, 0x01e8, 0x7810, 0x9106, 0x1128, 0x2f68, 0x780c, 0x907d,
-- 0x1dc8, 0x00a8, 0x780c, 0x680e, 0x7c0e, 0x2f12, 0x2304, 0x9f06,
-- 0x1108, 0x2d1a, 0x9006, 0x7032, 0x7036, 0x7004, 0x9086, 0x0003,
-- 0x0110, 0x7007, 0x0000, 0x9006, 0x00fe, 0x00de, 0x0005, 0x9085,
-- 0x0001, 0x0cd0, 0x2071, 0x188d, 0x7000, 0x9005, 0x0140, 0x2001,
-- 0x0812, 0x2071, 0x1800, 0x7076, 0x707a, 0x706b, 0xffd4, 0x2071,
-- 0x1800, 0x7074, 0x7056, 0x705b, 0x1ddc, 0x0005, 0x00e6, 0x0126,
-- 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0010, 0x0608,
-- 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c,
-- 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003,
-- 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068, 0x9502, 0x1230,
-- 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1ddc,
-- 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7554, 0x9582,
-- 0x0010, 0x0600, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148,
-+ 0x0d85, 0x0012, 0x012e, 0x0005, 0xad97, 0xad99, 0xad97, 0xad9f,
-+ 0xad97, 0xad97, 0xad97, 0xad97, 0xad97, 0xad99, 0xad97, 0xad99,
-+ 0xad97, 0xad99, 0xad97, 0xad97, 0xad97, 0xad99, 0xad97, 0x080c,
-+ 0x0d85, 0x2009, 0x0013, 0x080c, 0xb1f5, 0x012e, 0x0005, 0x6014,
-+ 0x2048, 0xa87c, 0xd0dc, 0x0130, 0x080c, 0x8c09, 0x080c, 0xb157,
-+ 0x012e, 0x0005, 0x2009, 0x0049, 0x080c, 0xb1f5, 0x012e, 0x0005,
-+ 0x080c, 0xacec, 0x2001, 0x1a0d, 0x2003, 0x0000, 0x7030, 0x9065,
-+ 0x090c, 0x0d85, 0x7034, 0x9092, 0xc350, 0x1258, 0x8000, 0x7036,
-+ 0x7004, 0x9086, 0x0003, 0x0110, 0x7007, 0x0000, 0x781f, 0x0808,
-+ 0x0058, 0x080c, 0xb0ab, 0x0140, 0x080c, 0xeed5, 0x6003, 0x0001,
-+ 0x2009, 0x0014, 0x080c, 0xb1f5, 0x781f, 0x0100, 0x080c, 0xad08,
-+ 0x012e, 0x0005, 0x080c, 0xacec, 0x714c, 0x81ff, 0x1128, 0x2011,
-+ 0x1a10, 0x2013, 0x0000, 0x04c0, 0x2061, 0x0100, 0x7150, 0x9192,
-+ 0x7530, 0x1678, 0x8108, 0x7152, 0x714c, 0x9186, 0x1b55, 0x0120,
-+ 0x2001, 0x0391, 0x2003, 0x0400, 0x9188, 0x0008, 0x210c, 0x918e,
-+ 0x0006, 0x1160, 0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x714c,
-+ 0x918e, 0x1b55, 0x1108, 0xc0fd, 0x6016, 0x00b0, 0x714c, 0x9188,
-+ 0x0008, 0x210c, 0x918e, 0x0009, 0x0d68, 0x6014, 0x9084, 0x1984,
-+ 0x9085, 0x0016, 0x714c, 0x918e, 0x1b55, 0x1108, 0xc0fd, 0x6016,
-+ 0x0018, 0x706c, 0xc085, 0x706e, 0x781f, 0x0200, 0x080c, 0xad08,
-+ 0x012e, 0x0005, 0x080c, 0xacec, 0x714c, 0x2160, 0x6003, 0x0003,
-+ 0x2009, 0x004a, 0x080c, 0xb1f5, 0x781f, 0x0200, 0x080c, 0xad08,
-+ 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x6003,
-+ 0x0003, 0x080c, 0xacec, 0x080c, 0x1dcc, 0x781f, 0x0400, 0x080c,
-+ 0xad08, 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060,
-+ 0x080c, 0xacec, 0x080c, 0x1e14, 0x781f, 0x0400, 0x080c, 0xad08,
-+ 0x012e, 0x0005, 0x7030, 0x9065, 0x0148, 0x6044, 0xc0bc, 0x6046,
-+ 0x7104, 0x9186, 0x0003, 0x0110, 0x080c, 0x9aa4, 0x012e, 0x0005,
-+ 0x00f6, 0x703c, 0x9086, 0x0002, 0x0528, 0x704c, 0x907d, 0x0510,
-+ 0x7844, 0xc0bc, 0x7846, 0x7820, 0x9086, 0x0009, 0x0118, 0x080c,
-+ 0xa1ba, 0x00c0, 0x7828, 0xd0fc, 0x1118, 0x080c, 0xa139, 0x0090,
-+ 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1130, 0x2001, 0x197c,
-+ 0x2004, 0x9086, 0xaaaa, 0x1120, 0x2001, 0x0387, 0x2003, 0x1000,
-+ 0x080c, 0xa0be, 0x00fe, 0x012e, 0x0005, 0x080c, 0x7830, 0x012e,
-+ 0x0005, 0x080c, 0x0d85, 0x0005, 0x2009, 0x1b66, 0x2104, 0xd0bc,
-+ 0x01a8, 0xc0bc, 0x200a, 0x2009, 0x010b, 0x2104, 0x9085, 0x0002,
-+ 0x200a, 0x2009, 0x0101, 0x2104, 0xc0ac, 0x200a, 0x2009, 0x0105,
-+ 0x2104, 0x9084, 0x1984, 0x9085, 0x8092, 0x200a, 0x012e, 0x0005,
-+ 0x080c, 0x8a48, 0x2009, 0x010b, 0x2104, 0xd08c, 0x01a8, 0xc08c,
-+ 0x200a, 0x2001, 0x1848, 0x2004, 0xd094, 0x1130, 0x2009, 0x0101,
-+ 0x2104, 0x9085, 0x0020, 0x200a, 0x2009, 0x1b66, 0x200b, 0x0000,
-+ 0x2001, 0x001b, 0x080c, 0xacdd, 0x012e, 0x0005, 0x00e6, 0x2071,
-+ 0x19e8, 0x6044, 0xc0bc, 0x6046, 0xd0fc, 0x01b8, 0x704c, 0x9c06,
-+ 0x1190, 0x2019, 0x0001, 0x080c, 0xa586, 0x704f, 0x0000, 0x2001,
-+ 0x0109, 0x2004, 0xd08c, 0x1138, 0x2001, 0x0108, 0x2004, 0xd0bc,
-+ 0x1110, 0x703f, 0x0000, 0x080c, 0xa791, 0x00ee, 0x0005, 0x0026,
-+ 0x7010, 0x9c06, 0x1178, 0x080c, 0xa64d, 0x6044, 0xc0fc, 0x6046,
-+ 0x600c, 0x9015, 0x0120, 0x7212, 0x600f, 0x0000, 0x0010, 0x7212,
-+ 0x720e, 0x9006, 0x002e, 0x0005, 0x0026, 0x7020, 0x9c06, 0x1178,
-+ 0x080c, 0xa64d, 0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120,
-+ 0x7222, 0x600f, 0x0000, 0x0010, 0x7222, 0x721e, 0x9006, 0x002e,
-+ 0x0005, 0x00d6, 0x0036, 0x7830, 0x9c06, 0x1558, 0x2069, 0x0100,
-+ 0x68c0, 0x9005, 0x01f8, 0x080c, 0x8a3b, 0x080c, 0xa290, 0x68c3,
-+ 0x0000, 0x080c, 0xa77a, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-+ 0x0138, 0x2001, 0x0100, 0x080c, 0x2a99, 0x9006, 0x080c, 0x2a99,
-+ 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x9085,
-+ 0x0001, 0x0038, 0x7808, 0xc0ad, 0x780a, 0x6003, 0x0009, 0x630a,
-+ 0x9006, 0x003e, 0x00de, 0x0005, 0x0016, 0x0026, 0x0036, 0x6100,
-+ 0x2019, 0x0100, 0x2001, 0x0382, 0x2004, 0xd09c, 0x0190, 0x00c6,
-+ 0x0126, 0x2091, 0x2800, 0x0016, 0x0036, 0x080c, 0xad52, 0x003e,
-+ 0x001e, 0x012e, 0x00ce, 0x6200, 0x2200, 0x9106, 0x0d58, 0x2200,
-+ 0x0010, 0x8319, 0x1d38, 0x003e, 0x002e, 0x001e, 0x0005, 0x00e6,
-+ 0x00d6, 0x00c6, 0x080c, 0xacec, 0x0106, 0x2071, 0x19e8, 0x2069,
-+ 0x0100, 0x704c, 0x2060, 0x9086, 0x1b55, 0x15b8, 0x6814, 0xd08c,
-+ 0x0188, 0x6817, 0x0010, 0x2009, 0x0019, 0x8109, 0x1df0, 0x2001,
-+ 0x0032, 0x6920, 0xd1bc, 0x0130, 0x8001, 0x1dd8, 0x692c, 0x918d,
-+ 0x0008, 0x692e, 0x6824, 0xd08c, 0x0110, 0x6827, 0x0002, 0x68d0,
-+ 0x9005, 0x0118, 0x9082, 0x0005, 0x0238, 0x6060, 0x8000, 0x6062,
-+ 0x2001, 0x0391, 0x2003, 0x0400, 0x080c, 0x9a38, 0x682c, 0x9084,
-+ 0xfffd, 0x682e, 0x2001, 0x1848, 0x2004, 0xd094, 0x1120, 0x6804,
-+ 0x9085, 0x0020, 0x6806, 0x2069, 0x0000, 0x010e, 0x090c, 0xad08,
-+ 0x8dff, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x00e6, 0x00d6, 0x00c6,
-+ 0x080c, 0xacec, 0x0106, 0x2071, 0x19e8, 0x2069, 0x0100, 0x080c,
-+ 0xaf6f, 0x68d0, 0x9005, 0x0158, 0x9082, 0x0005, 0x1240, 0x080c,
-+ 0x2b33, 0x2001, 0x0391, 0x2003, 0x0400, 0x2069, 0x0000, 0x010e,
-+ 0x090c, 0xad08, 0x8dff, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x0016,
-+ 0x2001, 0x0134, 0x2004, 0x9005, 0x0140, 0x9082, 0x0005, 0x1228,
-+ 0x2001, 0x0391, 0x2003, 0x0404, 0x0020, 0x2001, 0x0391, 0x2003,
-+ 0x0400, 0x001e, 0x0005, 0x00d6, 0x0156, 0x080c, 0x9f33, 0x7a14,
-+ 0x82ff, 0x0138, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008,
-+ 0x0490, 0x7003, 0x0200, 0x7007, 0x0000, 0x2069, 0x1800, 0x901e,
-+ 0x6800, 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c, 0x778e,
-+ 0x1110, 0xc3ad, 0x0008, 0xc3a5, 0x6adc, 0xd29c, 0x1110, 0xd2ac,
-+ 0x0108, 0xc39d, 0x730e, 0x080c, 0x8b00, 0x20a9, 0x0006, 0x2011,
-+ 0xffec, 0x2019, 0xffed, 0x2071, 0x0250, 0x2305, 0x2072, 0x8e70,
-+ 0x2205, 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04,
-+ 0xb025, 0x60c3, 0x0020, 0x080c, 0xa260, 0x015e, 0x00de, 0x0005,
-+ 0x0156, 0x080c, 0x9f33, 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff,
-+ 0x0118, 0x9282, 0x000e, 0x1238, 0x7003, 0x0100, 0x700b, 0x0003,
-+ 0x60c3, 0x0008, 0x0488, 0x7003, 0x0200, 0x7007, 0x001c, 0x700f,
-+ 0x0001, 0x2011, 0x19be, 0x2204, 0x8007, 0x701a, 0x8210, 0x2204,
-+ 0x8007, 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
-+ 0x2001, 0x181f, 0x2004, 0x7022, 0x2001, 0x1820, 0x2004, 0x7026,
-+ 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9,
-+ 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
-+ 0x0256, 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804, 0xa260, 0x0006,
-+ 0x2001, 0x1837, 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003,
-+ 0x080c, 0xa61b, 0x2011, 0x0002, 0x080c, 0xa625, 0x080c, 0xa506,
-+ 0x0036, 0x901e, 0x080c, 0xa586, 0x003e, 0x0005, 0x080c, 0x3487,
-+ 0x0188, 0x0016, 0x00b6, 0x00c6, 0x7010, 0x9085, 0x0020, 0x7012,
-+ 0x2009, 0x007e, 0x080c, 0x67ad, 0xb85c, 0xc0ac, 0xb85e, 0x00ce,
-+ 0x00be, 0x001e, 0x0005, 0x00d6, 0x00f6, 0x7104, 0x9186, 0x0004,
-+ 0x1130, 0x7410, 0x9e90, 0x0004, 0x9e98, 0x0003, 0x0088, 0x9186,
-+ 0x0001, 0x1130, 0x7420, 0x9e90, 0x0008, 0x9e98, 0x0007, 0x0040,
-+ 0x9186, 0x0002, 0x1538, 0x7428, 0x9e90, 0x000a, 0x9e98, 0x0009,
-+ 0x6110, 0x2468, 0x680c, 0x907d, 0x01e8, 0x7810, 0x9106, 0x1128,
-+ 0x2f68, 0x780c, 0x907d, 0x1dc8, 0x00a8, 0x780c, 0x680e, 0x7c0e,
-+ 0x2f12, 0x2304, 0x9f06, 0x1108, 0x2d1a, 0x9006, 0x7032, 0x7036,
-+ 0x7004, 0x9086, 0x0003, 0x0110, 0x7007, 0x0000, 0x9006, 0x00fe,
-+ 0x00de, 0x0005, 0x9085, 0x0001, 0x0cd0, 0x2071, 0x188d, 0x7000,
-+ 0x9005, 0x0140, 0x2001, 0x0812, 0x2071, 0x1800, 0x7076, 0x707a,
-+ 0x706b, 0xffd4, 0x2071, 0x1800, 0x7074, 0x7056, 0x705b, 0x1ddc,
-+ 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554,
-+ 0x9582, 0x0010, 0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000,
-+ 0x0148, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061,
-+ 0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c,
-+ 0x7068, 0x9502, 0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee,
-+ 0x0005, 0x705b, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071,
-+ 0x1800, 0x7554, 0x9582, 0x0010, 0x0600, 0x7058, 0x2060, 0x6000,
-+ 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208,
-+ 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556,
-+ 0x9ca8, 0x001c, 0x7068, 0x9502, 0x1228, 0x755a, 0x9085, 0x0001,
-+ 0x00ee, 0x0005, 0x705b, 0x1ddc, 0x0cc8, 0x9006, 0x0cc8, 0x9c82,
-+ 0x1ddc, 0x0a0c, 0x0d85, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c,
-+ 0x0d85, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016, 0x601a, 0x6012,
-+ 0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x605e, 0x6062, 0x6026,
-+ 0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e, 0x604a, 0x602a,
-+ 0x6046, 0x6042, 0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x0005,
-+ 0x9006, 0x600e, 0x6016, 0x601a, 0x6012, 0x6022, 0x6002, 0x601e,
-+ 0x605e, 0x6062, 0x604a, 0x6046, 0x2061, 0x1800, 0x6054, 0x8000,
-+ 0x6056, 0x0005, 0x0006, 0x6000, 0x9086, 0x0000, 0x01d8, 0x601c,
-+ 0xd084, 0x190c, 0x1ad3, 0x6023, 0x0007, 0x2001, 0x1986, 0x2004,
-+ 0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c,
-+ 0xecc8, 0x604b, 0x0000, 0x6044, 0xd0fc, 0x1131, 0x9006, 0x6046,
-+ 0x6016, 0x6012, 0x000e, 0x0005, 0x080c, 0xacec, 0x0106, 0x2001,
-+ 0x19fb, 0x2004, 0x9c06, 0x1130, 0x0036, 0x2019, 0x0001, 0x080c,
-+ 0xa586, 0x003e, 0x080c, 0xa791, 0x010e, 0x090c, 0xad08, 0x0005,
-+ 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582,
-+ 0x0001, 0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148,
- 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc,
- 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068,
-- 0x9502, 0x1228, 0x755a, 0x9085, 0x0001, 0x00ee, 0x0005, 0x705b,
-- 0x1ddc, 0x0cc8, 0x9006, 0x0cc8, 0x9c82, 0x1ddc, 0x0a0c, 0x0d85,
-- 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0d85, 0x9006, 0x6006,
-- 0x600a, 0x600e, 0x6016, 0x601a, 0x6012, 0x6023, 0x0000, 0x6003,
-- 0x0000, 0x601e, 0x605e, 0x6062, 0x6026, 0x602a, 0x602e, 0x6032,
-- 0x6036, 0x603a, 0x603e, 0x604a, 0x602a, 0x6046, 0x6042, 0x2061,
-- 0x1800, 0x6054, 0x8000, 0x6056, 0x0005, 0x9006, 0x600e, 0x6016,
-- 0x601a, 0x6012, 0x6022, 0x6002, 0x601e, 0x605e, 0x6062, 0x604a,
-- 0x6046, 0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x0005, 0x0006,
-- 0x6000, 0x9086, 0x0000, 0x01d8, 0x601c, 0xd084, 0x190c, 0x1ad3,
-- 0x6023, 0x0007, 0x2001, 0x1986, 0x2004, 0x0006, 0x9082, 0x0051,
-- 0x000e, 0x0208, 0x8004, 0x601a, 0x080c, 0xece1, 0x604b, 0x0000,
-- 0x6044, 0xd0fc, 0x1131, 0x9006, 0x6046, 0x6016, 0x6012, 0x000e,
-- 0x0005, 0x080c, 0xacfc, 0x0106, 0x2001, 0x19fb, 0x2004, 0x9c06,
-- 0x1130, 0x0036, 0x2019, 0x0001, 0x080c, 0xa596, 0x003e, 0x080c,
-- 0xa7a1, 0x010e, 0x090c, 0xad18, 0x0005, 0x00e6, 0x0126, 0x2071,
-- 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001, 0x0608, 0x7058,
-- 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7068,
-- 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008,
-- 0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068, 0x9502, 0x1230, 0x755a,
-- 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1ddc, 0x0cc0,
-- 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0xb21e, 0xb228,
-- 0xb243, 0xb25e, 0xd69a, 0xd6b7, 0xd6d2, 0xb21e, 0xb228, 0x92f7,
-- 0xb277, 0xb21e, 0xb21e, 0xb21e, 0xb21e, 0xb21e, 0x9186, 0x0013,
-- 0x1130, 0x6044, 0xd0fc, 0x0110, 0x080c, 0x99ed, 0x0005, 0x0005,
-- 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x0013, 0x006e,
-- 0x0005, 0xb241, 0xb9bc, 0xbba3, 0xb241, 0xbc39, 0xb540, 0xb241,
-- 0xb241, 0xb93e, 0xc25a, 0xb241, 0xb241, 0xb241, 0xb241, 0xb241,
-- 0xb241, 0x080c, 0x0d85, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c,
-- 0x0d85, 0x0013, 0x006e, 0x0005, 0xb25c, 0xc875, 0xb25c, 0xb25c,
-- 0xb25c, 0xb25c, 0xb25c, 0xb25c, 0xc80c, 0xc9f8, 0xb25c, 0xc8b2,
-- 0xc936, 0xc8b2, 0xc936, 0xb25c, 0x080c, 0x0d85, 0x6000, 0x9082,
-- 0x0010, 0x1a0c, 0x0d85, 0x6000, 0x0002, 0xb275, 0xc2a4, 0xc33e,
-- 0xc4c1, 0xc530, 0xb275, 0xb275, 0xb275, 0xc273, 0xc78d, 0xc790,
-- 0xb275, 0xb275, 0xb275, 0xb275, 0xc7c0, 0x080c, 0x0d85, 0x0066,
-- 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x0013, 0x006e, 0x0005,
-- 0xb290, 0xb290, 0xb2ce, 0xb36d, 0xb3ed, 0xb290, 0xb290, 0xb290,
-- 0xb292, 0xb290, 0xb290, 0xb290, 0xb290, 0xb290, 0xb290, 0xb290,
-- 0x080c, 0x0d85, 0x9186, 0x004c, 0x0560, 0x9186, 0x0003, 0x190c,
-- 0x0d85, 0x0096, 0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003, 0x6106,
-- 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e, 0xa8ac,
-- 0xa836, 0xa8b0, 0xa83a, 0x9006, 0xa846, 0xa84a, 0xa884, 0x9092,
-- 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210,
-- 0x621a, 0x009e, 0x080c, 0x1c26, 0x2009, 0x8030, 0x080c, 0x965e,
-- 0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c,
-- 0xb40f, 0x080c, 0xd65d, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096,
-- 0x00f6, 0x2079, 0x1800, 0x7a90, 0x6014, 0x2048, 0xa87c, 0xd0ec,
-- 0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005,
-- 0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010,
-- 0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883,
-- 0x0000, 0xaa02, 0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6,
-- 0x00f6, 0x2400, 0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015,
-- 0x1118, 0x2001, 0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118,
-- 0x2001, 0x0001, 0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002,
-- 0xb335, 0xb335, 0xb330, 0xb333, 0xb335, 0xb32d, 0xb320, 0xb320,
-- 0xb320, 0xb320, 0xb320, 0xb320, 0xb320, 0xb320, 0xb320, 0xb320,
-- 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e,
-- 0x00fe, 0x009e, 0x00de, 0x080c, 0x0d85, 0x080c, 0xbe51, 0x0028,
-- 0x080c, 0xbf8f, 0x0010, 0x080c, 0xc085, 0x00fe, 0x00ee, 0x00de,
-- 0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0xb4cd,
-- 0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006,
-- 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-- 0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x12c2,
-- 0x080c, 0xb691, 0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e,
-- 0x00de, 0x0005, 0x00fe, 0x009e, 0x00de, 0x0804, 0xb16c, 0x2001,
-- 0x002c, 0x900e, 0x080c, 0xb533, 0x0c70, 0x91b6, 0x0015, 0x0170,
-- 0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0d85, 0x91b2,
-- 0x0050, 0x1a0c, 0x0d85, 0x9182, 0x0047, 0x0042, 0x080c, 0xaf61,
-- 0x0120, 0x9086, 0x0002, 0x0904, 0xb2ce, 0x0005, 0xb38f, 0xb38f,
-- 0xb391, 0xb3c3, 0xb38f, 0xb38f, 0xb38f, 0xb38f, 0xb3d6, 0x080c,
-- 0x0d85, 0x00d6, 0x0016, 0x0096, 0x6003, 0x0004, 0x6114, 0x2148,
-- 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894,
-- 0x9005, 0x0140, 0x2001, 0x0000, 0x900e, 0x080c, 0xb533, 0x080c,
-- 0xb16c, 0x00a8, 0x6003, 0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178,
-- 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4,
-- 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e,
-- 0x001e, 0x00de, 0x0005, 0x080c, 0x9a48, 0x00d6, 0x0096, 0x6114,
-- 0x2148, 0x080c, 0xcf1b, 0x0120, 0xa87b, 0x0006, 0x080c, 0x7012,
-- 0x009e, 0x00de, 0x080c, 0xb16c, 0x0804, 0x9ab3, 0x080c, 0x9a48,
-- 0x080c, 0x3315, 0x080c, 0xd65a, 0x00d6, 0x0096, 0x6114, 0x2148,
-- 0x080c, 0xcf1b, 0x0120, 0xa87b, 0x0029, 0x080c, 0x7012, 0x009e,
-- 0x00de, 0x080c, 0xb16c, 0x0804, 0x9ab3, 0x9182, 0x0047, 0x0002,
-- 0xb3fd, 0xb3ff, 0xb3fd, 0xb3fd, 0xb3fd, 0xb3fd, 0xb3fd, 0xb3fd,
-- 0xb3fd, 0xb3fd, 0xb3fd, 0xb3fd, 0xb3ff, 0x080c, 0x0d85, 0x00d6,
-- 0x0096, 0x601f, 0x0000, 0x6114, 0x2148, 0xa87b, 0x0000, 0xa883,
-- 0x0000, 0x080c, 0x7012, 0x009e, 0x00de, 0x0804, 0xb16c, 0x0026,
-- 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c,
-- 0x1059, 0x000e, 0x090c, 0x0d85, 0xa960, 0x21e8, 0xa95c, 0x9188,
-- 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079,
-- 0x1800, 0x7990, 0x9188, 0x0018, 0x918c, 0x0fff, 0xa972, 0xac76,
-- 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003, 0x0000, 0x901e, 0x2029,
-- 0x0001, 0x9182, 0x0035, 0x1228, 0x2011, 0x001f, 0x080c, 0xca7b,
-- 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011, 0x001f, 0x080c, 0xca7b,
-- 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110, 0x080c, 0x100b, 0x080c,
-- 0x1059, 0x01d0, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920,
-- 0xb406, 0x968a, 0x003d, 0x1230, 0x2608, 0x2011, 0x001b, 0x080c,
-- 0xca7b, 0x00b8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011,
-- 0x001b, 0x080c, 0xca7b, 0x0c18, 0x2001, 0x0205, 0x2003, 0x0000,
-- 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072,
-- 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
-- 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807, 0x0000, 0x0006, 0x080c,
-- 0x7012, 0x000e, 0x2048, 0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e,
-- 0x006e, 0x005e, 0x003e, 0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096,
-- 0x0006, 0x080c, 0x1059, 0x000e, 0x090c, 0x0d85, 0xa960, 0x21e8,
-- 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104,
-- 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990, 0x810c, 0x9188, 0x000c,
-- 0x9182, 0x001a, 0x0210, 0x2009, 0x001a, 0x21a8, 0x810b, 0xa972,
-- 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f, 0x20a0, 0x2001, 0x0205,
-- 0x200c, 0x918d, 0x0080, 0x2102, 0x4003, 0x2003, 0x0000, 0x080c,
-- 0x7012, 0x009e, 0x00fe, 0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6,
-- 0x0096, 0x0016, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102,
-- 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80,
-- 0x000c, 0x2098, 0x2021, 0x003e, 0x901e, 0x9282, 0x0020, 0x0218,
-- 0x2011, 0x0020, 0x2018, 0x9486, 0x003e, 0x1170, 0x0096, 0x080c,
-- 0x1059, 0x2900, 0x009e, 0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8,
-- 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300, 0x908e, 0x0260, 0x0140,
-- 0x2009, 0x0280, 0x9102, 0x920a, 0x0218, 0x2010, 0x2100, 0x9318,
-- 0x2200, 0x9402, 0x1228, 0x2400, 0x9202, 0x2410, 0x9318, 0x9006,
-- 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802, 0x20e1, 0x0000, 0x4003,
-- 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280, 0x1130, 0x7814, 0x8000,
-- 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310, 0x84ff, 0x0904, 0xb4e2,
-- 0x0804, 0xb4e4, 0x9085, 0x0001, 0x7817, 0x0000, 0x009e, 0x00fe,
-- 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036, 0x0096, 0x6314, 0x2348,
-- 0xa87a, 0xa982, 0x080c, 0x7006, 0x009e, 0x003e, 0x00de, 0x0005,
-- 0x91b6, 0x0015, 0x1118, 0x080c, 0xb16c, 0x0030, 0x91b6, 0x0016,
-- 0x190c, 0x0d85, 0x080c, 0xb16c, 0x0005, 0x20a9, 0x000e, 0x20e1,
-- 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c,
-- 0x20a0, 0x009e, 0x4003, 0x9196, 0x0016, 0x01f0, 0x0136, 0x9080,
-- 0x001b, 0x20a0, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418, 0x8318,
-- 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8, 0x2011,
-- 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003, 0x3418,
-- 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xcf1b, 0x0130,
-- 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e, 0x0804,
-- 0xb16c, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200, 0x11a8,
-- 0x6010, 0x00b6, 0x2058, 0xb8d7, 0x0000, 0x00be, 0x6014, 0x9005,
-- 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32, 0x080c,
-- 0xb16c, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8,
-- 0x0006, 0x0016, 0x080c, 0xd645, 0x0188, 0x6014, 0x9005, 0x1170,
-- 0x600b, 0x0003, 0x601b, 0x0000, 0x604b, 0x0000, 0x2009, 0x0022,
-- 0x080c, 0xb994, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085, 0x0001,
-- 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1,
-- 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080,
-- 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001, 0x2099,
-- 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804, 0x2048,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001,
-- 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020, 0x4003,
-- 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103,
-- 0x080c, 0xb16c, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016, 0x900e,
-- 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff, 0x800c,
-- 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108, 0x810b,
-- 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c, 0xca7b,
-- 0x080c, 0xcf1b, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000, 0xa864,
-- 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb16c, 0x001e, 0x009e, 0x0005,
-- 0x0016, 0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110, 0x2009,
-- 0x0001, 0x0096, 0x6014, 0x904d, 0x090c, 0x0d85, 0xa97a, 0x080c,
-- 0x7012, 0x009e, 0x080c, 0xb16c, 0x001e, 0x0005, 0x0016, 0x0096,
-- 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010, 0x7034,
-- 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014, 0x2048,
-- 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xca7b, 0x009e,
-- 0x080c, 0xcf1b, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807, 0x0000,
-- 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb16c, 0x009e, 0x001e,
-- 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100, 0x1118,
-- 0x080c, 0xbb5c, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806, 0x8006,
-- 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c, 0xa87b,
-- 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c, 0xaca8,
-- 0xada4, 0x2031, 0x0000, 0x2041, 0x12a8, 0x0019, 0x0d08, 0x008e,
-- 0x0898, 0x0096, 0x0006, 0x080c, 0x1059, 0x000e, 0x01b0, 0xa8ab,
-- 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800, 0xa89e,
-- 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086, 0x2940,
-- 0x080c, 0x114e, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005, 0x00e6,
-- 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258,
-- 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6, 0x2258,
-- 0xba14, 0x00be, 0x9206, 0x11e0, 0x604b, 0x0000, 0x2c68, 0x0016,
-- 0x2009, 0x0035, 0x080c, 0xd5bb, 0x001e, 0x1158, 0x622c, 0x2268,
-- 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386, 0x0006,
-- 0x0128, 0x080c, 0xb16c, 0x0020, 0x0039, 0x0010, 0x080c, 0xb7c7,
-- 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048, 0x9186,
-- 0x0015, 0x0904, 0xb7a6, 0x918e, 0x0016, 0x1904, 0xb7c5, 0x700c,
-- 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300, 0x1904,
-- 0xb780, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904, 0xb762,
-- 0x0804, 0xb7c3, 0x6808, 0x9086, 0xffff, 0x1904, 0xb7a8, 0xa87c,
-- 0x9084, 0x0060, 0x9086, 0x0020, 0x1150, 0xa8ac, 0xa934, 0x9106,
-- 0x1904, 0xb7a8, 0xa8b0, 0xa938, 0x9106, 0x1904, 0xb7a8, 0x6824,
-- 0xd084, 0x1904, 0xb7a8, 0xd0b4, 0x0158, 0x0016, 0x2001, 0x1986,
-- 0x200c, 0x6018, 0x9102, 0x9082, 0x0005, 0x001e, 0x1a04, 0xb7a8,
-- 0x080c, 0xd10c, 0x6810, 0x0096, 0x2048, 0xa9a0, 0x009e, 0x685c,
-- 0xa87a, 0xa976, 0x6864, 0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4,
-- 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c, 0x955b,
-- 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138,
-- 0x00c6, 0x2d60, 0x080c, 0xcc01, 0x00ce, 0x0804, 0xb7c3, 0x00c6,
-- 0xa868, 0xd0fc, 0x1118, 0x080c, 0x622f, 0x0010, 0x080c, 0x663a,
-- 0x00ce, 0x1904, 0xb7a8, 0x00c6, 0x2d60, 0x080c, 0xb16c, 0x00ce,
-- 0x0804, 0xb7c3, 0x00c6, 0x080c, 0xb1dd, 0x0198, 0x6017, 0x0000,
-- 0x6810, 0x6012, 0x080c, 0xd3b6, 0x6023, 0x0003, 0x6904, 0x00c6,
-- 0x2d60, 0x080c, 0xb16c, 0x00ce, 0x080c, 0xb20a, 0x00ce, 0x0804,
-- 0xb7c3, 0x2001, 0x1988, 0x2004, 0x684a, 0x00ce, 0x0804, 0xb7c3,
-- 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900,
-- 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c,
-- 0xd5ff, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009,
-- 0x8020, 0x080c, 0x9617, 0x00ce, 0x0430, 0x700c, 0x9086, 0x2a00,
-- 0x1138, 0x2001, 0x1988, 0x2004, 0x684a, 0x00e8, 0x04c1, 0x00e8,
-- 0x89ff, 0x090c, 0x0d85, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103,
-- 0xa87b, 0x0003, 0x080c, 0x6e27, 0x080c, 0xd10c, 0x080c, 0xb1a7,
-- 0x0026, 0x6010, 0x00b6, 0x2058, 0xba3c, 0x080c, 0x68df, 0x00be,
-- 0x002e, 0x00de, 0x00ce, 0x080c, 0xb16c, 0x009e, 0x0005, 0x9186,
-- 0x0015, 0x1128, 0x2001, 0x1988, 0x2004, 0x684a, 0x0068, 0x918e,
-- 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c, 0xece1, 0x080c,
-- 0x8c19, 0x080c, 0xb16c, 0x00ce, 0x080c, 0xb16c, 0x0005, 0x0026,
-- 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001,
-- 0x1988, 0x2004, 0x684a, 0x0804, 0xb841, 0x00c6, 0x2d60, 0x080c,
-- 0xcadc, 0x00ce, 0x6804, 0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00,
-- 0x2060, 0x6003, 0x0001, 0x6007, 0x0050, 0x2009, 0x8023, 0x080c,
-- 0x9617, 0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff,
-- 0x090c, 0x0d85, 0x6800, 0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac,
-- 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882,
-- 0x2001, 0x0001, 0x6832, 0x0400, 0x2001, 0x0007, 0x6832, 0x00e0,
-- 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48,
-- 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024,
-- 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38, 0x7020, 0x683e, 0x7024,
-- 0x683a, 0x2001, 0x0005, 0x6832, 0x080c, 0xd2a0, 0x080c, 0x9ab3,
-- 0x0010, 0x080c, 0xb16c, 0x004e, 0x003e, 0x002e, 0x0005, 0x00e6,
-- 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258,
-- 0xba10, 0x00be, 0x9206, 0x1904, 0xb8ac, 0x700c, 0x6210, 0x00b6,
-- 0x2258, 0xba14, 0x00be, 0x9206, 0x1904, 0xb8ac, 0x6038, 0x2068,
-- 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007, 0x0904, 0xb8ac,
-- 0x9286, 0x0002, 0x0904, 0xb8ac, 0x9286, 0x0000, 0x05e8, 0x6808,
-- 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c, 0x9186, 0x0015, 0x0570,
-- 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038, 0x2060, 0x6104, 0x9186,
-- 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186, 0x004d, 0x0190,
-- 0x9186, 0x004e, 0x0178, 0x9186, 0x0052, 0x0160, 0x6014, 0x0096,
-- 0x2048, 0x080c, 0xcf1b, 0x090c, 0x0d85, 0xa87b, 0x0003, 0x009e,
-- 0x080c, 0xd5ff, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-- 0x2009, 0x8020, 0x080c, 0x9617, 0x00ce, 0x0030, 0x6038, 0x2070,
-- 0x2001, 0x1988, 0x2004, 0x704a, 0x080c, 0xb16c, 0x002e, 0x00de,
-- 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048, 0x6010,
-- 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c,
-- 0xbc02, 0x0470, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90,
-- 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004, 0x080c, 0xc222, 0x002e,
-- 0x003e, 0x015e, 0x009e, 0x1904, 0xb91d, 0x0096, 0x0156, 0x0036,
-- 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9, 0x0004,
-- 0x080c, 0xc222, 0x002e, 0x003e, 0x015e, 0x009e, 0x15b0, 0x7238,
-- 0xba0a, 0x733c, 0xbb0e, 0x83ff, 0x0118, 0xbc00, 0xc48d, 0xbc02,
-- 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be, 0x0804, 0xb57c,
-- 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e, 0x8006, 0x8006,
-- 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009,
-- 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
-- 0x12a8, 0x080c, 0xb691, 0x0130, 0x00fe, 0x009e, 0x080c, 0xb16c,
-- 0x00be, 0x0005, 0x080c, 0xbb5c, 0x0cb8, 0x2b78, 0x00f6, 0x080c,
-- 0x3315, 0x080c, 0xd65a, 0x00fe, 0x00c6, 0x080c, 0xb116, 0x2f00,
-- 0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003,
-- 0x0001, 0x2001, 0x0007, 0x080c, 0x66fa, 0x080c, 0x6726, 0x080c,
-- 0x961e, 0x080c, 0x9ab3, 0x00ce, 0x0804, 0xb8f0, 0x2100, 0x91b2,
-- 0x0053, 0x1a0c, 0x0d85, 0x91b2, 0x0040, 0x1a04, 0xb9a6, 0x0002,
-- 0xb994, 0xb994, 0xb98a, 0xb994, 0xb994, 0xb994, 0xb988, 0xb988,
-- 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988,
-- 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988,
-- 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb994,
-- 0xb988, 0xb994, 0xb994, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988,
-- 0xb98a, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb988,
-- 0xb988, 0xb988, 0xb994, 0xb994, 0xb988, 0xb988, 0xb988, 0xb988,
-- 0xb988, 0xb988, 0xb988, 0xb988, 0xb988, 0xb994, 0xb988, 0xb988,
-- 0x080c, 0x0d85, 0x0066, 0x00b6, 0x6610, 0x2658, 0xb8d4, 0xc08c,
-- 0xb8d6, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001, 0x6106, 0x9186,
-- 0x0032, 0x0118, 0x080c, 0x961e, 0x0010, 0x080c, 0x9617, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x9ab3, 0x012e, 0x0005, 0x2600, 0x0002,
-- 0xb994, 0xb994, 0xb9ba, 0xb994, 0xb994, 0xb9ba, 0xb9ba, 0xb9ba,
-- 0xb9ba, 0xb994, 0xb9ba, 0xb994, 0xb9ba, 0xb994, 0xb9ba, 0xb9ba,
-- 0xb9ba, 0xb9ba, 0x080c, 0x0d85, 0x6004, 0x90b2, 0x0053, 0x1a0c,
-- 0x0d85, 0x91b6, 0x0013, 0x0904, 0xba91, 0x91b6, 0x0027, 0x1904,
-- 0xba3d, 0x080c, 0x99ed, 0x6004, 0x080c, 0xd121, 0x01b0, 0x080c,
-- 0xd132, 0x01a8, 0x908e, 0x0021, 0x0904, 0xba3a, 0x908e, 0x0022,
-- 0x1130, 0x080c, 0xb5a8, 0x0904, 0xba36, 0x0804, 0xba37, 0x908e,
-- 0x003d, 0x0904, 0xba3a, 0x0804, 0xba30, 0x080c, 0x3344, 0x2001,
-- 0x0007, 0x080c, 0x66fa, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be,
-- 0x080c, 0xbb5c, 0x9186, 0x007e, 0x1148, 0x2001, 0x1837, 0x2014,
-- 0xc285, 0x080c, 0x779e, 0x1108, 0xc2ad, 0x2202, 0x080c, 0xacfc,
-- 0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xedee, 0x002e,
-- 0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028, 0x080c,
-- 0x97b0, 0x0076, 0x903e, 0x080c, 0x966d, 0x6010, 0x00b6, 0x905d,
-- 0x0100, 0x00be, 0x2c08, 0x080c, 0xe75d, 0x007e, 0x003e, 0x002e,
-- 0x001e, 0x080c, 0xad18, 0x080c, 0xd65a, 0x0016, 0x080c, 0xd3ae,
-- 0x080c, 0xb16c, 0x001e, 0x080c, 0x341e, 0x080c, 0x9ab3, 0x0030,
-- 0x080c, 0xd3ae, 0x080c, 0xb16c, 0x080c, 0x9ab3, 0x0005, 0x080c,
-- 0xbb5c, 0x0cb0, 0x080c, 0xbb98, 0x0c98, 0x9186, 0x0015, 0x0118,
-- 0x9186, 0x0016, 0x1140, 0x080c, 0xaf61, 0x0d80, 0x9086, 0x0002,
-- 0x0904, 0xbba3, 0x0c58, 0x9186, 0x0014, 0x1d40, 0x080c, 0x99ed,
-- 0x6004, 0x908e, 0x0022, 0x1118, 0x080c, 0xb5a8, 0x09f8, 0x080c,
-- 0x3315, 0x080c, 0xd65a, 0x080c, 0xd121, 0x1190, 0x080c, 0x3344,
-- 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xbb5c, 0x9186,
-- 0x007e, 0x1128, 0x2001, 0x1837, 0x200c, 0xc185, 0x2102, 0x0800,
-- 0x080c, 0xd132, 0x1120, 0x080c, 0xbb5c, 0x0804, 0xba30, 0x6004,
-- 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079,
-- 0x0000, 0x080c, 0x36bf, 0x00fe, 0x00ee, 0x0804, 0xba30, 0x6004,
-- 0x908e, 0x0021, 0x0d40, 0x908e, 0x0022, 0x090c, 0xbb5c, 0x0804,
-- 0xba30, 0x90b2, 0x0040, 0x1a04, 0xbb3c, 0x2008, 0x0002, 0xbad9,
-- 0xbada, 0xbadd, 0xbae0, 0xbae3, 0xbaf0, 0xbad7, 0xbad7, 0xbad7,
-- 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7,
-- 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7,
-- 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbaf3, 0xbafe, 0xbad7,
-- 0xbaff, 0xbafe, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbafe,
-- 0xbafe, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7, 0xbad7,
-- 0xbad7, 0xbb27, 0xbafe, 0xbad7, 0xbafa, 0xbad7, 0xbad7, 0xbad7,
-- 0xbafb, 0xbad7, 0xbad7, 0xbad7, 0xbafe, 0xbb22, 0xbad7, 0x080c,
-- 0x0d85, 0x0420, 0x2001, 0x000b, 0x0448, 0x2001, 0x0003, 0x0430,
-- 0x2001, 0x0005, 0x0418, 0x6010, 0x00b6, 0x2058, 0xb804, 0x00be,
-- 0x9084, 0x00ff, 0x9086, 0x0000, 0x11d8, 0x2001, 0x0001, 0x00b0,
-- 0x2001, 0x0009, 0x0098, 0x6003, 0x0005, 0x080c, 0xd65d, 0x080c,
-- 0x9ab3, 0x0058, 0x0018, 0x0010, 0x080c, 0x66fa, 0x04b8, 0x080c,
-- 0xd65d, 0x6003, 0x0004, 0x080c, 0x9ab3, 0x0005, 0x080c, 0x66fa,
-- 0x6003, 0x0002, 0x0036, 0x2019, 0x1852, 0x2304, 0x9084, 0xff00,
-- 0x1120, 0x2001, 0x1986, 0x201c, 0x0040, 0x8007, 0x909a, 0x0004,
-- 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x003e, 0x080c,
-- 0x9ab3, 0x0c18, 0x080c, 0xd3ae, 0x080c, 0xb16c, 0x08f0, 0x00e6,
-- 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000, 0x080c, 0x36bf, 0x00fe,
-- 0x00ee, 0x080c, 0x99ed, 0x080c, 0xb16c, 0x0878, 0x6003, 0x0002,
-- 0x080c, 0xd65d, 0x0804, 0x9ab3, 0x2600, 0x2008, 0x0002, 0xbb53,
-- 0xbb36, 0xbb51, 0xbb36, 0xbb36, 0xbb51, 0xbb51, 0xbb51, 0xbb51,
-- 0xbb36, 0xbb51, 0xbb36, 0xbb51, 0xbb36, 0xbb51, 0xbb51, 0xbb51,
-- 0xbb51, 0x080c, 0x0d85, 0x0096, 0x6014, 0x2048, 0x080c, 0x7012,
-- 0x009e, 0x080c, 0xb16c, 0x0005, 0x00e6, 0x0096, 0x0026, 0x0016,
-- 0x080c, 0xcf1b, 0x0568, 0x6014, 0x2048, 0xa864, 0x9086, 0x0139,
-- 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148, 0x080c, 0x55cc, 0x0130,
-- 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x0028, 0x2001, 0x0030,
-- 0x900e, 0x2011, 0x4005, 0x080c, 0xd51f, 0x0090, 0xa868, 0xd0fc,
-- 0x0178, 0xa807, 0x0000, 0x0016, 0x6004, 0x908e, 0x0021, 0x0168,
-- 0x908e, 0x003d, 0x0150, 0x001e, 0xa867, 0x0103, 0xa833, 0x0100,
-- 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005, 0x001e, 0x0009, 0x0cc0,
-- 0x0096, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0xa823,
-- 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610, 0x2658, 0xb804, 0x9084,
-- 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0d85, 0x6604, 0x96b6, 0x004d,
-- 0x1120, 0x080c, 0xd43e, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x0043,
-- 0x1120, 0x080c, 0xd487, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x004b,
-- 0x1120, 0x080c, 0xd4b3, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x0033,
-- 0x1120, 0x080c, 0xd3d0, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x0028,
-- 0x1120, 0x080c, 0xd170, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x0029,
-- 0x1120, 0x080c, 0xd1b1, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x001f,
-- 0x1120, 0x080c, 0xb54d, 0x0804, 0xbc28, 0x6604, 0x96b6, 0x0000,
-- 0x1118, 0x080c, 0xb8b2, 0x04e0, 0x6604, 0x96b6, 0x0022, 0x1118,
-- 0x080c, 0xb589, 0x04a8, 0x6604, 0x96b6, 0x0035, 0x1118, 0x080c,
-- 0xb6af, 0x0470, 0x6604, 0x96b6, 0x0039, 0x1118, 0x080c, 0xb847,
-- 0x0438, 0x6604, 0x96b6, 0x003d, 0x1118, 0x080c, 0xb5c1, 0x0400,
-- 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c, 0xb5fd, 0x00c8, 0x6604,
-- 0x96b6, 0x0049, 0x1118, 0x080c, 0xb63e, 0x0090, 0x6604, 0x96b6,
-- 0x0041, 0x1118, 0x080c, 0xb628, 0x0058, 0x91b6, 0x0015, 0x1110,
-- 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128, 0x00be, 0x0804, 0xbf34,
-- 0x00be, 0x0005, 0x080c, 0xb227, 0x0cd8, 0xbc45, 0xbc53, 0xbc45,
-- 0xbc9a, 0xbc45, 0xbe51, 0xbf41, 0xbc45, 0xbc45, 0xbf0a, 0xbc45,
-- 0xbf20, 0x0096, 0x601f, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048,
-- 0xa867, 0x0103, 0x009e, 0x0804, 0xb16c, 0xa001, 0xa001, 0x0005,
-- 0x6604, 0x96b6, 0x0004, 0x1130, 0x2001, 0x0001, 0x080c, 0x66e6,
-- 0x0804, 0xb16c, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7090, 0x9086,
-- 0x0074, 0x1540, 0x080c, 0xe72e, 0x11b0, 0x6010, 0x00b6, 0x2058,
-- 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110, 0xc0c5, 0xb802,
-- 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c, 0x66fa, 0x080c, 0x3344,
-- 0x080c, 0xb16c, 0x0098, 0x2001, 0x000a, 0x080c, 0x66fa, 0x080c,
-- 0x3344, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x961e, 0x080c,
-- 0x9ab3, 0x0020, 0x2001, 0x0001, 0x080c, 0xbe21, 0x00ee, 0x0005,
-- 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006, 0x080c, 0x66e6, 0x2069,
-- 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001, 0x0006, 0x080c, 0x6726,
-- 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6, 0x2011, 0x1824, 0x2204,
-- 0x9086, 0x0074, 0x1904, 0xbdf6, 0x6010, 0x2058, 0xbaa0, 0x9286,
-- 0x007e, 0x1120, 0x080c, 0xc090, 0x0804, 0xbd63, 0x2001, 0x180d,
-- 0x2004, 0xd08c, 0x0904, 0xbd05, 0x00d6, 0x080c, 0x779e, 0x01a0,
-- 0x0026, 0x2011, 0x0010, 0x080c, 0x6c35, 0x002e, 0x0904, 0xbd04,
-- 0x080c, 0x5854, 0x1598, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867,
-- 0x0103, 0xa833, 0xdead, 0x0450, 0x6010, 0x00b6, 0x2058, 0xb910,
-- 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026, 0x2011, 0x8008, 0x080c,
-- 0x6c35, 0x002e, 0x0548, 0x6014, 0x9005, 0x090c, 0x0d85, 0x2048,
-- 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0030,
-- 0x900e, 0x2011, 0x4009, 0x080c, 0xd51f, 0x0040, 0x6014, 0x2048,
-- 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010, 0x2058,
-- 0xb9a0, 0x0016, 0x080c, 0x3344, 0x080c, 0xb16c, 0x001e, 0x080c,
-- 0x341e, 0x00de, 0x0804, 0xbdfb, 0x00de, 0x080c, 0xc085, 0x6010,
-- 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510, 0x6014, 0x9005, 0x01a8,
-- 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
-- 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd51f, 0x0030, 0xa807,
-- 0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x2001, 0x0006, 0x080c,
-- 0x66fa, 0x080c, 0x3344, 0x080c, 0xb16c, 0x0804, 0xbdfb, 0x080c,
-- 0xbe09, 0x6014, 0x9005, 0x0190, 0x2048, 0xa868, 0xd0f4, 0x01e8,
-- 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1d08, 0x2001, 0x0000,
-- 0x900e, 0x2011, 0x4000, 0x080c, 0xd51f, 0x08f8, 0x080c, 0xbdff,
-- 0x0160, 0x9006, 0x080c, 0x66e6, 0x2001, 0x0004, 0x080c, 0x6726,
-- 0x2001, 0x0007, 0x080c, 0x66fa, 0x08a0, 0x2001, 0x0004, 0x080c,
-- 0x66fa, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x961e, 0x080c,
-- 0x9ab3, 0x0804, 0xbdfb, 0xb85c, 0xd0e4, 0x0178, 0x080c, 0xd348,
-- 0x080c, 0x779e, 0x0118, 0xd0dc, 0x1904, 0xbd25, 0x2011, 0x1837,
-- 0x2204, 0xc0ad, 0x2012, 0x0804, 0xbd25, 0x080c, 0xd389, 0x2011,
-- 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c, 0xe905, 0x000e,
-- 0x1904, 0xbd25, 0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x66fa,
-- 0x9006, 0x080c, 0x66e6, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c,
-- 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c,
-- 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010, 0x78ea, 0x7082, 0x908c,
-- 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x26d5,
-- 0x00f6, 0x2100, 0x900e, 0x080c, 0x268c, 0x795e, 0x00fe, 0x9186,
-- 0x0081, 0x01f0, 0x2009, 0x0081, 0x00e0, 0x2009, 0x00ef, 0x00f6,
-- 0x2079, 0x0100, 0x79ea, 0x78e7, 0x0000, 0x7932, 0x7936, 0x780c,
-- 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x26d5, 0x00f6, 0x2079, 0x1800,
-- 0x7982, 0x2100, 0x900e, 0x797e, 0x080c, 0x268c, 0x795e, 0x00fe,
-- 0x8108, 0x080c, 0x6749, 0x2b00, 0x00ce, 0x1904, 0xbd25, 0x6012,
-- 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150, 0x2009, 0x027c, 0x210c,
-- 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d, 0x210c, 0xb916, 0x2001,
-- 0x0002, 0x080c, 0x66fa, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-- 0x0002, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0028, 0x080c, 0xbb5c,
-- 0x2001, 0x0001, 0x0431, 0x00de, 0x009e, 0x00be, 0x0005, 0x2001,
-- 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001, 0x1848, 0x2004, 0xd0ac,
-- 0x0005, 0x00e6, 0x080c, 0xee47, 0x0190, 0x2071, 0x0260, 0x7108,
-- 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284, 0xff00, 0x0140, 0x6010,
-- 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912, 0xba16, 0x00ee,
-- 0x0005, 0x2030, 0x9005, 0x0158, 0x2001, 0x0007, 0x080c, 0x66fa,
-- 0x080c, 0x5854, 0x1120, 0x2001, 0x0007, 0x080c, 0x6726, 0x2600,
-- 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc,
-- 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be,
-- 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4ca1, 0x004e, 0x003e,
-- 0x080c, 0x3344, 0x6020, 0x9086, 0x000a, 0x1108, 0x0005, 0x0804,
-- 0xb16c, 0x00b6, 0x00e6, 0x0026, 0x0016, 0x2071, 0x1800, 0x7090,
-- 0x9086, 0x0014, 0x1904, 0xbf00, 0x2001, 0x180d, 0x2004, 0xd08c,
-- 0x0904, 0xbeb3, 0x00d6, 0x080c, 0x779e, 0x01a0, 0x0026, 0x2011,
-- 0x0010, 0x080c, 0x6c35, 0x002e, 0x0904, 0xbeb2, 0x080c, 0x5854,
-- 0x1598, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-- 0xdead, 0x0450, 0x6010, 0x00b6, 0x2058, 0xb910, 0x00be, 0x9186,
-- 0x00ff, 0x0580, 0x0026, 0x2011, 0x8008, 0x080c, 0x6c35, 0x002e,
-- 0x0548, 0x6014, 0x9005, 0x090c, 0x0d85, 0x2048, 0xa864, 0x9084,
-- 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0030, 0x900e, 0x2011,
-- 0x4009, 0x080c, 0xd51f, 0x0040, 0x6014, 0x2048, 0xa807, 0x0000,
-- 0xa867, 0x0103, 0xa833, 0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016,
-- 0x080c, 0x3344, 0x080c, 0xb16c, 0x001e, 0x080c, 0x341e, 0x00de,
-- 0x0804, 0xbf05, 0x00de, 0x080c, 0x5854, 0x1170, 0x6014, 0x9005,
-- 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006,
-- 0x080c, 0x4e58, 0x004e, 0x003e, 0x00d6, 0x6010, 0x2058, 0x080c,
-- 0x684f, 0x080c, 0xbc88, 0x00de, 0x080c, 0xc15b, 0x1588, 0x6010,
-- 0x2058, 0xb890, 0x9005, 0x0560, 0x2001, 0x0006, 0x080c, 0x66fa,
-- 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864, 0x9084, 0x00ff, 0x9086,
-+ 0x9502, 0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005,
-+ 0x705b, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f,
-+ 0x0002, 0xb209, 0xb213, 0xb22e, 0xb249, 0xd685, 0xd6a2, 0xd6bd,
-+ 0xb209, 0xb213, 0x92e7, 0xb262, 0xb209, 0xb209, 0xb209, 0xb209,
-+ 0xb209, 0x9186, 0x0013, 0x1130, 0x6044, 0xd0fc, 0x0110, 0x080c,
-+ 0x99dd, 0x0005, 0x0005, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c,
-+ 0x0d85, 0x0013, 0x006e, 0x0005, 0xb22c, 0xb9a7, 0xbb8e, 0xb22c,
-+ 0xbc24, 0xb52b, 0xb22c, 0xb22c, 0xb929, 0xc245, 0xb22c, 0xb22c,
-+ 0xb22c, 0xb22c, 0xb22c, 0xb22c, 0x080c, 0x0d85, 0x0066, 0x6000,
-+ 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x0013, 0x006e, 0x0005, 0xb247,
-+ 0xc860, 0xb247, 0xb247, 0xb247, 0xb247, 0xb247, 0xb247, 0xc7f7,
-+ 0xc9e3, 0xb247, 0xc89d, 0xc921, 0xc89d, 0xc921, 0xb247, 0x080c,
-+ 0x0d85, 0x6000, 0x9082, 0x0010, 0x1a0c, 0x0d85, 0x6000, 0x0002,
-+ 0xb260, 0xc28f, 0xc329, 0xc4ac, 0xc51b, 0xb260, 0xb260, 0xb260,
-+ 0xc25e, 0xc778, 0xc77b, 0xb260, 0xb260, 0xb260, 0xb260, 0xc7ab,
-+ 0x080c, 0x0d85, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85,
-+ 0x0013, 0x006e, 0x0005, 0xb27b, 0xb27b, 0xb2b9, 0xb358, 0xb3d8,
-+ 0xb27b, 0xb27b, 0xb27b, 0xb27d, 0xb27b, 0xb27b, 0xb27b, 0xb27b,
-+ 0xb27b, 0xb27b, 0xb27b, 0x080c, 0x0d85, 0x9186, 0x004c, 0x0560,
-+ 0x9186, 0x0003, 0x190c, 0x0d85, 0x0096, 0x601c, 0xc0ed, 0x601e,
-+ 0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000,
-+ 0xc0b5, 0xa87e, 0xa8ac, 0xa836, 0xa8b0, 0xa83a, 0x9006, 0xa846,
-+ 0xa84a, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
-+ 0x8013, 0x8213, 0x9210, 0x621a, 0x009e, 0x080c, 0x1c26, 0x2009,
-+ 0x8030, 0x080c, 0x964e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0,
-+ 0x00be, 0x2c00, 0x080c, 0xb3fa, 0x080c, 0xd64a, 0x6003, 0x0007,
-+ 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079, 0x1800, 0x7a90, 0x6014,
-+ 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc,
-+ 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220,
-+ 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b,
-+ 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02, 0x0006, 0x0016, 0x0026,
-+ 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400, 0x9005, 0x1108, 0x009a,
-+ 0x2100, 0x9086, 0x0015, 0x1118, 0x2001, 0x0001, 0x0038, 0x2100,
-+ 0x9086, 0x0016, 0x0118, 0x2001, 0x0001, 0x002a, 0x94a4, 0x0007,
-+ 0x8423, 0x9405, 0x0002, 0xb320, 0xb320, 0xb31b, 0xb31e, 0xb320,
-+ 0xb318, 0xb30b, 0xb30b, 0xb30b, 0xb30b, 0xb30b, 0xb30b, 0xb30b,
-+ 0xb30b, 0xb30b, 0xb30b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e,
-+ 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e, 0x00de, 0x080c, 0x0d85,
-+ 0x080c, 0xbe3c, 0x0028, 0x080c, 0xbf7a, 0x0010, 0x080c, 0xc070,
-+ 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896,
-+ 0x000e, 0x080c, 0xb4b8, 0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050,
-+ 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-+ 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031,
-+ 0x0000, 0x2041, 0x12c2, 0x080c, 0xb67c, 0x0160, 0x000e, 0x9005,
-+ 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005, 0x00fe, 0x009e, 0x00de,
-+ 0x0804, 0xb157, 0x2001, 0x002c, 0x900e, 0x080c, 0xb51e, 0x0c70,
-+ 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047,
-+ 0x0a0c, 0x0d85, 0x91b2, 0x0050, 0x1a0c, 0x0d85, 0x9182, 0x0047,
-+ 0x0042, 0x080c, 0xaf4c, 0x0120, 0x9086, 0x0002, 0x0904, 0xb2b9,
-+ 0x0005, 0xb37a, 0xb37a, 0xb37c, 0xb3ae, 0xb37a, 0xb37a, 0xb37a,
-+ 0xb37a, 0xb3c1, 0x080c, 0x0d85, 0x00d6, 0x0016, 0x0096, 0x6003,
-+ 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc,
-+ 0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001, 0x0000, 0x900e,
-+ 0x080c, 0xb51e, 0x080c, 0xb157, 0x00a8, 0x6003, 0x0002, 0xa8a4,
-+ 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020,
-+ 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000,
-+ 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005, 0x080c, 0x9a38,
-+ 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xcf08, 0x0120, 0xa87b,
-+ 0x0006, 0x080c, 0x7002, 0x009e, 0x00de, 0x080c, 0xb157, 0x0804,
-+ 0x9aa3, 0x080c, 0x9a38, 0x080c, 0x3315, 0x080c, 0xd647, 0x00d6,
-+ 0x0096, 0x6114, 0x2148, 0x080c, 0xcf08, 0x0120, 0xa87b, 0x0029,
-+ 0x080c, 0x7002, 0x009e, 0x00de, 0x080c, 0xb157, 0x0804, 0x9aa3,
-+ 0x9182, 0x0047, 0x0002, 0xb3e8, 0xb3ea, 0xb3e8, 0xb3e8, 0xb3e8,
-+ 0xb3e8, 0xb3e8, 0xb3e8, 0xb3e8, 0xb3e8, 0xb3e8, 0xb3e8, 0xb3ea,
-+ 0x080c, 0x0d85, 0x00d6, 0x0096, 0x601f, 0x0000, 0x6114, 0x2148,
-+ 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x7002, 0x009e, 0x00de,
-+ 0x0804, 0xb157, 0x0026, 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6,
-+ 0x00f6, 0x0006, 0x080c, 0x1059, 0x000e, 0x090c, 0x0d85, 0xa960,
-+ 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020,
-+ 0x4104, 0xa87a, 0x2079, 0x1800, 0x7990, 0x9188, 0x0018, 0x918c,
-+ 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003,
-+ 0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0035, 0x1228, 0x2011,
-+ 0x001f, 0x080c, 0xca66, 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011,
-+ 0x001f, 0x080c, 0xca66, 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110,
-+ 0x080c, 0x100b, 0x080c, 0x1059, 0x01d0, 0x8528, 0xa867, 0x0110,
-+ 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1230, 0x2608,
-+ 0x2011, 0x001b, 0x080c, 0xca66, 0x00b8, 0x96b2, 0x003c, 0x2009,
-+ 0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xca66, 0x0c18, 0x2001,
-+ 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566,
-+ 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000,
-+ 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807,
-+ 0x0000, 0x0006, 0x080c, 0x7002, 0x000e, 0x2048, 0x9005, 0x1db0,
-+ 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e, 0x002e, 0x0005,
-+ 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x1059, 0x000e, 0x090c,
-+ 0x0d85, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
-+ 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990,
-+ 0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210, 0x2009, 0x001a,
-+ 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f,
-+ 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x4003,
-+ 0x2003, 0x0000, 0x080c, 0x7002, 0x009e, 0x00fe, 0x00de, 0x0005,
-+ 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001, 0x0205, 0x200c,
-+ 0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c,
-+ 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021, 0x003e, 0x901e,
-+ 0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018, 0x9486, 0x003e,
-+ 0x1170, 0x0096, 0x080c, 0x1059, 0x2900, 0x009e, 0x05c0, 0xa806,
-+ 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300,
-+ 0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102, 0x920a, 0x0218,
-+ 0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228, 0x2400, 0x9202,
-+ 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802,
-+ 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280,
-+ 0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310,
-+ 0x84ff, 0x0904, 0xb4cd, 0x0804, 0xb4cf, 0x9085, 0x0001, 0x7817,
-+ 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036,
-+ 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c, 0x6ff6, 0x009e,
-+ 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118, 0x080c, 0xb157,
-+ 0x0030, 0x91b6, 0x0016, 0x190c, 0x0d85, 0x080c, 0xb157, 0x0005,
-+ 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048,
-+ 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003, 0x9196, 0x0016,
-+ 0x01f0, 0x0136, 0x9080, 0x001b, 0x20a0, 0x2011, 0x0006, 0x20a9,
-+ 0x0001, 0x3418, 0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398,
-+ 0x8211, 0x1db8, 0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318,
-+ 0x2398, 0x4003, 0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096,
-+ 0x080c, 0xcf08, 0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867,
-+ 0x0103, 0x009e, 0x0804, 0xb157, 0x0096, 0x00d6, 0x0036, 0x7330,
-+ 0x9386, 0x0200, 0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8d7, 0x0000,
-+ 0x00be, 0x6014, 0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867,
-+ 0x0103, 0xab32, 0x080c, 0xb157, 0x003e, 0x00de, 0x009e, 0x0005,
-+ 0x0011, 0x1d48, 0x0cc8, 0x0006, 0x0016, 0x080c, 0xd632, 0x0188,
-+ 0x6014, 0x9005, 0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x604b,
-+ 0x0000, 0x2009, 0x0022, 0x080c, 0xb97f, 0x9006, 0x001e, 0x000e,
-+ 0x0005, 0x9085, 0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014,
-+ 0x9e80, 0x000c, 0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205,
-+ 0x2003, 0x0001, 0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9,
-+ 0x000a, 0xa804, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
-+ 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260,
-+ 0x20a9, 0x0020, 0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800,
-+ 0x2048, 0xa867, 0x0103, 0x080c, 0xb157, 0x001e, 0x009e, 0x0005,
-+ 0x0096, 0x0016, 0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038,
-+ 0x9084, 0x00ff, 0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080,
-+ 0x0004, 0x9108, 0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014,
-+ 0x2048, 0x080c, 0xca66, 0x080c, 0xcf08, 0x0140, 0x6014, 0x2048,
-+ 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xb157,
-+ 0x001e, 0x009e, 0x0005, 0x0016, 0x2009, 0x0000, 0x7030, 0x9086,
-+ 0x0200, 0x0110, 0x2009, 0x0001, 0x0096, 0x6014, 0x904d, 0x090c,
-+ 0x0d85, 0xa97a, 0x080c, 0x7002, 0x009e, 0x080c, 0xb157, 0x001e,
-+ 0x0005, 0x0016, 0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009,
-+ 0x0004, 0x0010, 0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019,
-+ 0x000c, 0x6014, 0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048,
-+ 0x080c, 0xca66, 0x009e, 0x080c, 0xcf08, 0x0148, 0xa804, 0x9005,
-+ 0x1158, 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c,
-+ 0xb157, 0x009e, 0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007,
-+ 0x9086, 0x0100, 0x1118, 0x080c, 0xbb47, 0x00e0, 0xa034, 0x8007,
-+ 0x800c, 0x8806, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-+ 0x9080, 0x000c, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-+ 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x12a8,
-+ 0x0019, 0x0d08, 0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x1059,
-+ 0x000e, 0x01b0, 0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006,
-+ 0xae6a, 0x2800, 0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96,
-+ 0xad9a, 0x0086, 0x2940, 0x080c, 0x114e, 0x008e, 0x9085, 0x0001,
-+ 0x009e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff,
-+ 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c,
-+ 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x604b,
-+ 0x0000, 0x2c68, 0x0016, 0x2009, 0x0035, 0x080c, 0xd5a8, 0x001e,
-+ 0x1158, 0x622c, 0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003,
-+ 0x0130, 0x9386, 0x0006, 0x0128, 0x080c, 0xb157, 0x0020, 0x0039,
-+ 0x0010, 0x080c, 0xb7b2, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096,
-+ 0x6814, 0x2048, 0x9186, 0x0015, 0x0904, 0xb791, 0x918e, 0x0016,
-+ 0x1904, 0xb7b0, 0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120,
-+ 0x9186, 0x0300, 0x1904, 0xb76b, 0x89ff, 0x1138, 0x6800, 0x9086,
-+ 0x000f, 0x0904, 0xb74d, 0x0804, 0xb7ae, 0x6808, 0x9086, 0xffff,
-+ 0x1904, 0xb793, 0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1150,
-+ 0xa8ac, 0xa934, 0x9106, 0x1904, 0xb793, 0xa8b0, 0xa938, 0x9106,
-+ 0x1904, 0xb793, 0x6824, 0xd084, 0x1904, 0xb793, 0xd0b4, 0x0158,
-+ 0x0016, 0x2001, 0x1986, 0x200c, 0x6018, 0x9102, 0x9082, 0x0005,
-+ 0x001e, 0x1a04, 0xb793, 0x080c, 0xd0f9, 0x6810, 0x0096, 0x2048,
-+ 0xa9a0, 0x009e, 0x685c, 0xa87a, 0xa976, 0x6864, 0xa882, 0xa87c,
-+ 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001,
-+ 0x000a, 0x080c, 0x954b, 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86,
-+ 0x82ff, 0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c, 0xcbed, 0x00ce,
-+ 0x0804, 0xb7ae, 0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c, 0x6228,
-+ 0x0010, 0x080c, 0x6633, 0x00ce, 0x1904, 0xb793, 0x00c6, 0x2d60,
-+ 0x080c, 0xb157, 0x00ce, 0x0804, 0xb7ae, 0x00c6, 0x080c, 0xb1c8,
-+ 0x0198, 0x6017, 0x0000, 0x6810, 0x6012, 0x080c, 0xd3a3, 0x6023,
-+ 0x0003, 0x6904, 0x00c6, 0x2d60, 0x080c, 0xb157, 0x00ce, 0x080c,
-+ 0xb1f5, 0x00ce, 0x0804, 0xb7ae, 0x2001, 0x1988, 0x2004, 0x684a,
-+ 0x00ce, 0x0804, 0xb7ae, 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010,
-+ 0x00b6, 0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60,
-+ 0xa87b, 0x0003, 0x080c, 0xd5ec, 0x6007, 0x0085, 0x6003, 0x000b,
-+ 0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x9607, 0x00ce, 0x0430,
-+ 0x700c, 0x9086, 0x2a00, 0x1138, 0x2001, 0x1988, 0x2004, 0x684a,
-+ 0x00e8, 0x04c1, 0x00e8, 0x89ff, 0x090c, 0x0d85, 0x00c6, 0x00d6,
-+ 0x2d60, 0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x6e17, 0x080c,
-+ 0xd0f9, 0x080c, 0xb192, 0x0026, 0x6010, 0x00b6, 0x2058, 0xba3c,
-+ 0x080c, 0x68d8, 0x00be, 0x002e, 0x00de, 0x00ce, 0x080c, 0xb157,
-+ 0x009e, 0x0005, 0x9186, 0x0015, 0x1128, 0x2001, 0x1988, 0x2004,
-+ 0x684a, 0x0068, 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060,
-+ 0x080c, 0xecc8, 0x080c, 0x8c09, 0x080c, 0xb157, 0x00ce, 0x080c,
-+ 0xb157, 0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac,
-+ 0xd2f4, 0x0130, 0x2001, 0x1988, 0x2004, 0x684a, 0x0804, 0xb82c,
-+ 0x00c6, 0x2d60, 0x080c, 0xcac7, 0x00ce, 0x6804, 0x9086, 0x0050,
-+ 0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050,
-+ 0x2009, 0x8023, 0x080c, 0x9607, 0x00ce, 0x04f0, 0x6800, 0x9086,
-+ 0x000f, 0x01a8, 0x89ff, 0x090c, 0x0d85, 0x6800, 0x9086, 0x0004,
-+ 0x1190, 0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff,
-+ 0xa880, 0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001,
-+ 0x0007, 0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8,
-+ 0x6824, 0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20,
-+ 0xd2ec, 0x1d68, 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38,
-+ 0x7020, 0x683e, 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c,
-+ 0xd28d, 0x080c, 0x9aa3, 0x0010, 0x080c, 0xb157, 0x004e, 0x003e,
-+ 0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff,
-+ 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xb897,
-+ 0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904,
-+ 0xb897, 0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286,
-+ 0x0007, 0x0904, 0xb897, 0x9286, 0x0002, 0x0904, 0xb897, 0x9286,
-+ 0x0000, 0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c,
-+ 0x9186, 0x0015, 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038,
-+ 0x2060, 0x6104, 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8,
-+ 0x9186, 0x004d, 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052,
-+ 0x0160, 0x6014, 0x0096, 0x2048, 0x080c, 0xcf08, 0x090c, 0x0d85,
-+ 0xa87b, 0x0003, 0x009e, 0x080c, 0xd5ec, 0x6007, 0x0085, 0x6003,
-+ 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x9607, 0x00ce,
-+ 0x0030, 0x6038, 0x2070, 0x2001, 0x1988, 0x2004, 0x704a, 0x080c,
-+ 0xb157, 0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6,
-+ 0x6014, 0x2048, 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08,
-+ 0xbb0c, 0xbc00, 0xc48c, 0xbc02, 0x0470, 0x0096, 0x0156, 0x0036,
-+ 0x0026, 0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004,
-+ 0x080c, 0xc20d, 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xb908,
-+ 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019,
-+ 0x0006, 0x20a9, 0x0004, 0x080c, 0xc20d, 0x002e, 0x003e, 0x015e,
-+ 0x009e, 0x15b0, 0x7238, 0xba0a, 0x733c, 0xbb0e, 0x83ff, 0x0118,
-+ 0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e,
-+ 0x00be, 0x0804, 0xb567, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a,
-+ 0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-+ 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4,
-+ 0x2031, 0x0000, 0x2041, 0x12a8, 0x080c, 0xb67c, 0x0130, 0x00fe,
-+ 0x009e, 0x080c, 0xb157, 0x00be, 0x0005, 0x080c, 0xbb47, 0x0cb8,
-+ 0x2b78, 0x00f6, 0x080c, 0x3315, 0x080c, 0xd647, 0x00fe, 0x00c6,
-+ 0x080c, 0xb101, 0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001,
-+ 0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x66f3,
-+ 0x080c, 0x671f, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x00ce, 0x0804,
-+ 0xb8db, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0d85, 0x91b2, 0x0040,
-+ 0x1a04, 0xb991, 0x0002, 0xb97f, 0xb97f, 0xb975, 0xb97f, 0xb97f,
-+ 0xb97f, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973,
-+ 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973,
-+ 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973,
-+ 0xb973, 0xb973, 0xb97f, 0xb973, 0xb97f, 0xb97f, 0xb973, 0xb973,
-+ 0xb973, 0xb973, 0xb973, 0xb975, 0xb973, 0xb973, 0xb973, 0xb973,
-+ 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb97f, 0xb97f, 0xb973,
-+ 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973, 0xb973,
-+ 0xb97f, 0xb973, 0xb973, 0x080c, 0x0d85, 0x0066, 0x00b6, 0x6610,
-+ 0x2658, 0xb8d4, 0xc08c, 0xb8d6, 0x00be, 0x006e, 0x0000, 0x6003,
-+ 0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c, 0x960e, 0x0010,
-+ 0x080c, 0x9607, 0x0126, 0x2091, 0x8000, 0x080c, 0x9aa3, 0x012e,
-+ 0x0005, 0x2600, 0x0002, 0xb97f, 0xb97f, 0xb9a5, 0xb97f, 0xb97f,
-+ 0xb9a5, 0xb9a5, 0xb9a5, 0xb9a5, 0xb97f, 0xb9a5, 0xb97f, 0xb9a5,
-+ 0xb97f, 0xb9a5, 0xb9a5, 0xb9a5, 0xb9a5, 0x080c, 0x0d85, 0x6004,
-+ 0x90b2, 0x0053, 0x1a0c, 0x0d85, 0x91b6, 0x0013, 0x0904, 0xba7c,
-+ 0x91b6, 0x0027, 0x1904, 0xba28, 0x080c, 0x99dd, 0x6004, 0x080c,
-+ 0xd10e, 0x01b0, 0x080c, 0xd11f, 0x01a8, 0x908e, 0x0021, 0x0904,
-+ 0xba25, 0x908e, 0x0022, 0x1130, 0x080c, 0xb593, 0x0904, 0xba21,
-+ 0x0804, 0xba22, 0x908e, 0x003d, 0x0904, 0xba25, 0x0804, 0xba1b,
-+ 0x080c, 0x3344, 0x2001, 0x0007, 0x080c, 0x66f3, 0x6010, 0x00b6,
-+ 0x2058, 0xb9a0, 0x00be, 0x080c, 0xbb47, 0x9186, 0x007e, 0x1148,
-+ 0x2001, 0x1837, 0x2014, 0xc285, 0x080c, 0x778e, 0x1108, 0xc2ad,
-+ 0x2202, 0x080c, 0xacec, 0x0036, 0x0026, 0x2019, 0x0028, 0x2110,
-+ 0x080c, 0xedd5, 0x002e, 0x003e, 0x0016, 0x0026, 0x0036, 0x2110,
-+ 0x2019, 0x0028, 0x080c, 0x97a0, 0x0076, 0x903e, 0x080c, 0x965d,
-+ 0x6010, 0x00b6, 0x905d, 0x0100, 0x00be, 0x2c08, 0x080c, 0xe744,
-+ 0x007e, 0x003e, 0x002e, 0x001e, 0x080c, 0xad08, 0x080c, 0xd647,
-+ 0x0016, 0x080c, 0xd39b, 0x080c, 0xb157, 0x001e, 0x080c, 0x341e,
-+ 0x080c, 0x9aa3, 0x0030, 0x080c, 0xd39b, 0x080c, 0xb157, 0x080c,
-+ 0x9aa3, 0x0005, 0x080c, 0xbb47, 0x0cb0, 0x080c, 0xbb83, 0x0c98,
-+ 0x9186, 0x0015, 0x0118, 0x9186, 0x0016, 0x1140, 0x080c, 0xaf4c,
-+ 0x0d80, 0x9086, 0x0002, 0x0904, 0xbb8e, 0x0c58, 0x9186, 0x0014,
-+ 0x1d40, 0x080c, 0x99dd, 0x6004, 0x908e, 0x0022, 0x1118, 0x080c,
-+ 0xb593, 0x09f8, 0x080c, 0x3315, 0x080c, 0xd647, 0x080c, 0xd10e,
-+ 0x1190, 0x080c, 0x3344, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be,
-+ 0x080c, 0xbb47, 0x9186, 0x007e, 0x1128, 0x2001, 0x1837, 0x200c,
-+ 0xc185, 0x2102, 0x0800, 0x080c, 0xd11f, 0x1120, 0x080c, 0xbb47,
-+ 0x0804, 0xba1b, 0x6004, 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6,
-+ 0x2071, 0x189e, 0x2079, 0x0000, 0x080c, 0x36bf, 0x00fe, 0x00ee,
-+ 0x0804, 0xba1b, 0x6004, 0x908e, 0x0021, 0x0d40, 0x908e, 0x0022,
-+ 0x090c, 0xbb47, 0x0804, 0xba1b, 0x90b2, 0x0040, 0x1a04, 0xbb27,
-+ 0x2008, 0x0002, 0xbac4, 0xbac5, 0xbac8, 0xbacb, 0xbace, 0xbadb,
-+ 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2,
-+ 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2,
-+ 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbac2,
-+ 0xbade, 0xbae9, 0xbac2, 0xbaea, 0xbae9, 0xbac2, 0xbac2, 0xbac2,
-+ 0xbac2, 0xbac2, 0xbae9, 0xbae9, 0xbac2, 0xbac2, 0xbac2, 0xbac2,
-+ 0xbac2, 0xbac2, 0xbac2, 0xbac2, 0xbb12, 0xbae9, 0xbac2, 0xbae5,
-+ 0xbac2, 0xbac2, 0xbac2, 0xbae6, 0xbac2, 0xbac2, 0xbac2, 0xbae9,
-+ 0xbb0d, 0xbac2, 0x080c, 0x0d85, 0x0420, 0x2001, 0x000b, 0x0448,
-+ 0x2001, 0x0003, 0x0430, 0x2001, 0x0005, 0x0418, 0x6010, 0x00b6,
-+ 0x2058, 0xb804, 0x00be, 0x9084, 0x00ff, 0x9086, 0x0000, 0x11d8,
-+ 0x2001, 0x0001, 0x00b0, 0x2001, 0x0009, 0x0098, 0x6003, 0x0005,
-+ 0x080c, 0xd64a, 0x080c, 0x9aa3, 0x0058, 0x0018, 0x0010, 0x080c,
-+ 0x66f3, 0x04b8, 0x080c, 0xd64a, 0x6003, 0x0004, 0x080c, 0x9aa3,
-+ 0x0005, 0x080c, 0x66f3, 0x6003, 0x0002, 0x0036, 0x2019, 0x1852,
-+ 0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1986, 0x201c, 0x0040,
-+ 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318,
-+ 0x631a, 0x003e, 0x080c, 0x9aa3, 0x0c18, 0x080c, 0xd39b, 0x080c,
-+ 0xb157, 0x08f0, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000,
-+ 0x080c, 0x36bf, 0x00fe, 0x00ee, 0x080c, 0x99dd, 0x080c, 0xb157,
-+ 0x0878, 0x6003, 0x0002, 0x080c, 0xd64a, 0x0804, 0x9aa3, 0x2600,
-+ 0x2008, 0x0002, 0xbb3e, 0xbb21, 0xbb3c, 0xbb21, 0xbb21, 0xbb3c,
-+ 0xbb3c, 0xbb3c, 0xbb3c, 0xbb21, 0xbb3c, 0xbb21, 0xbb3c, 0xbb21,
-+ 0xbb3c, 0xbb3c, 0xbb3c, 0xbb3c, 0x080c, 0x0d85, 0x0096, 0x6014,
-+ 0x2048, 0x080c, 0x7002, 0x009e, 0x080c, 0xb157, 0x0005, 0x00e6,
-+ 0x0096, 0x0026, 0x0016, 0x080c, 0xcf08, 0x0568, 0x6014, 0x2048,
-+ 0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148,
-+ 0x080c, 0x55ca, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
-+ 0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xd50c,
-+ 0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004,
-+ 0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867,
-+ 0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005,
-+ 0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048,
-+ 0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610,
-+ 0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0d85,
-+ 0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xd42b, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xd474, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xd4a0, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xd3bd, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xd15d, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xd19e, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x001f, 0x1120, 0x080c, 0xb538, 0x0804, 0xbc13,
-+ 0x6604, 0x96b6, 0x0000, 0x1118, 0x080c, 0xb89d, 0x04e0, 0x6604,
-+ 0x96b6, 0x0022, 0x1118, 0x080c, 0xb574, 0x04a8, 0x6604, 0x96b6,
-+ 0x0035, 0x1118, 0x080c, 0xb69a, 0x0470, 0x6604, 0x96b6, 0x0039,
-+ 0x1118, 0x080c, 0xb832, 0x0438, 0x6604, 0x96b6, 0x003d, 0x1118,
-+ 0x080c, 0xb5ac, 0x0400, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c,
-+ 0xb5e8, 0x00c8, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xb629,
-+ 0x0090, 0x6604, 0x96b6, 0x0041, 0x1118, 0x080c, 0xb613, 0x0058,
-+ 0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128,
-+ 0x00be, 0x0804, 0xbf1f, 0x00be, 0x0005, 0x080c, 0xb212, 0x0cd8,
-+ 0xbc30, 0xbc3e, 0xbc30, 0xbc85, 0xbc30, 0xbe3c, 0xbf2c, 0xbc30,
-+ 0xbc30, 0xbef5, 0xbc30, 0xbf0b, 0x0096, 0x601f, 0x0000, 0x6014,
-+ 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0xb157,
-+ 0xa001, 0xa001, 0x0005, 0x6604, 0x96b6, 0x0004, 0x1130, 0x2001,
-+ 0x0001, 0x080c, 0x66df, 0x0804, 0xb157, 0x0005, 0x00e6, 0x2071,
-+ 0x1800, 0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xe715, 0x11b0,
-+ 0x6010, 0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc,
-+ 0x0110, 0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c,
-+ 0x66f3, 0x080c, 0x3344, 0x080c, 0xb157, 0x0098, 0x2001, 0x000a,
-+ 0x080c, 0x66f3, 0x080c, 0x3344, 0x6003, 0x0001, 0x6007, 0x0001,
-+ 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0020, 0x2001, 0x0001, 0x080c,
-+ 0xbe0c, 0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006,
-+ 0x080c, 0x66df, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001,
-+ 0x0006, 0x080c, 0x671f, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6,
-+ 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xbde1, 0x6010,
-+ 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xc07b, 0x0804,
-+ 0xbd4e, 0x2001, 0x180d, 0x2004, 0xd08c, 0x0904, 0xbcf0, 0x00d6,
-+ 0x080c, 0x778e, 0x01a0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25,
-+ 0x002e, 0x0904, 0xbcef, 0x080c, 0x5852, 0x1598, 0x6014, 0x2048,
-+ 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x0450, 0x6010,
-+ 0x00b6, 0x2058, 0xb910, 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026,
-+ 0x2011, 0x8008, 0x080c, 0x6c25, 0x002e, 0x0548, 0x6014, 0x9005,
-+ 0x090c, 0x0d85, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-+ 0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xd50c,
-+ 0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-+ 0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3344, 0x080c,
-+ 0xb157, 0x001e, 0x080c, 0x341e, 0x00de, 0x0804, 0xbde6, 0x00de,
-+ 0x080c, 0xc070, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
-+ 0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
- 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
-- 0xd51f, 0x0060, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0029, 0x0130,
-- 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x009e, 0x080c,
-- 0x3344, 0x6020, 0x9086, 0x000a, 0x0140, 0x080c, 0xb16c, 0x0028,
-- 0x080c, 0xbb5c, 0x9006, 0x080c, 0xbe21, 0x001e, 0x002e, 0x00ee,
-- 0x00be, 0x0005, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014, 0x1160,
-- 0x2001, 0x0002, 0x080c, 0x66fa, 0x6003, 0x0001, 0x6007, 0x0001,
-- 0x080c, 0x961e, 0x0804, 0x9ab3, 0x2001, 0x0001, 0x0804, 0xbe21,
-- 0x2030, 0x2011, 0x1824, 0x2204, 0x9086, 0x0004, 0x1148, 0x96b6,
-- 0x000b, 0x1120, 0x2001, 0x0007, 0x080c, 0x66fa, 0x0804, 0xb16c,
-- 0x2001, 0x0001, 0x0804, 0xbe21, 0x0002, 0xbc45, 0xbf4c, 0xbc45,
-- 0xbf8f, 0xbc45, 0xc03c, 0xbf41, 0xbc48, 0xbc45, 0xc050, 0xbc45,
-- 0xc062, 0x6604, 0x9686, 0x0003, 0x0904, 0xbe51, 0x96b6, 0x001e,
-- 0x1110, 0x080c, 0xb16c, 0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c,
-- 0xc074, 0x11a0, 0x9006, 0x080c, 0x66e6, 0x080c, 0x3315, 0x080c,
-- 0xd65a, 0x2001, 0x0002, 0x080c, 0x66fa, 0x6003, 0x0001, 0x6007,
-- 0x0002, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0428, 0x2009, 0x026e,
-- 0x2104, 0x9086, 0x0009, 0x1160, 0x6010, 0x2058, 0xb840, 0x9084,
-- 0x00ff, 0x9005, 0x0180, 0x8001, 0xb842, 0x601b, 0x000a, 0x0098,
-- 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x908e, 0x1900, 0x0158,
-- 0x908e, 0x1e00, 0x0990, 0x080c, 0x3315, 0x080c, 0xd65a, 0x2001,
-- 0x0001, 0x080c, 0xbe21, 0x00ce, 0x00de, 0x00be, 0x0005, 0x0096,
-- 0x00b6, 0x0026, 0x9016, 0x080c, 0xc082, 0x00d6, 0x2069, 0x197c,
-- 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e,
-- 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000, 0x206a, 0x00de, 0x0010,
-- 0x00de, 0x0088, 0x9006, 0x080c, 0x66e6, 0x2001, 0x0002, 0x080c,
-- 0x66fa, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x961e, 0x080c,
-- 0x9ab3, 0x0804, 0xc00c, 0x080c, 0xcf1b, 0x01b0, 0x6014, 0x2048,
-- 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007, 0x0016, 0x2001,
-- 0x0002, 0x080c, 0xd57c, 0x00b0, 0x6014, 0x2048, 0xa864, 0xd0fc,
-- 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004, 0xd0dc,
-- 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x1110,
-- 0x9006, 0x0c38, 0x080c, 0xbb5c, 0x2009, 0x026e, 0x2134, 0x96b4,
-- 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686, 0x000b, 0x01c8, 0x2009,
-- 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686, 0x0009, 0x01c0,
-- 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0190, 0x2001, 0x0004,
-- 0x080c, 0x66fa, 0x2001, 0x0028, 0x601a, 0x6007, 0x0052, 0x0020,
-- 0x2001, 0x0001, 0x080c, 0xbe21, 0x002e, 0x00be, 0x009e, 0x0005,
-- 0x9286, 0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xcf1b, 0x0140,
-- 0xa864, 0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108, 0x0c40,
-- 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138, 0x8001,
-- 0xb842, 0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0, 0x9086,
-- 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x6130, 0x00ee,
-- 0x0010, 0x080c, 0x3315, 0x0860, 0x2001, 0x0004, 0x080c, 0x66fa,
-- 0x080c, 0xc082, 0x1140, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c,
-- 0x961e, 0x0804, 0x9ab3, 0x080c, 0xbb5c, 0x9006, 0x0804, 0xbe21,
-- 0x0489, 0x1160, 0x2001, 0x0008, 0x080c, 0x66fa, 0x6003, 0x0001,
-- 0x6007, 0x0005, 0x080c, 0x961e, 0x0804, 0x9ab3, 0x2001, 0x0001,
-- 0x0804, 0xbe21, 0x00f9, 0x1160, 0x2001, 0x000a, 0x080c, 0x66fa,
-- 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x961e, 0x0804, 0x9ab3,
-- 0x2001, 0x0001, 0x0804, 0xbe21, 0x2009, 0x026e, 0x2104, 0x9086,
-- 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x9086,
-- 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6, 0x00c6, 0x0016,
-- 0x6110, 0x2158, 0x080c, 0x67c3, 0x001e, 0x00ce, 0x00be, 0x0005,
-- 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016, 0x6010, 0x2058,
-- 0x2009, 0x1837, 0x2104, 0x9085, 0x0003, 0x200a, 0x080c, 0xc12d,
-- 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd, 0x200a, 0x080c, 0x6c0d,
-- 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xea8d, 0x2001,
-- 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x2009, 0x0001,
-- 0x080c, 0x32da, 0x00e6, 0x2071, 0x1800, 0x080c, 0x30bf, 0x00ee,
-- 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f, 0x080c, 0x341e,
-- 0x8108, 0x1f04, 0xc0c6, 0x015e, 0x00ce, 0x080c, 0xc085, 0x2071,
-- 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001, 0x1837, 0x200c,
-- 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118, 0x7038, 0xd0dc,
-- 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1837, 0x2102, 0x9184,
-- 0x0050, 0x9086, 0x0050, 0x05d0, 0x2079, 0x0100, 0x2e04, 0x9084,
-- 0x00ff, 0x2069, 0x181f, 0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04,
-- 0x2069, 0x1820, 0x206a, 0x78ea, 0x7832, 0x7836, 0x2010, 0x9084,
-- 0xff00, 0x001e, 0x9105, 0x2009, 0x182c, 0x200a, 0x2200, 0x9084,
-- 0x00ff, 0x2008, 0x080c, 0x26d5, 0x080c, 0x779e, 0x0170, 0x2071,
-- 0x0260, 0x2069, 0x1982, 0x7048, 0x206a, 0x704c, 0x6806, 0x7050,
-- 0x680a, 0x7054, 0x680e, 0x080c, 0xd348, 0x0040, 0x2001, 0x0006,
-- 0x080c, 0x66fa, 0x080c, 0x3344, 0x080c, 0xb16c, 0x001e, 0x003e,
-- 0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x0096, 0x0026, 0x0036,
-- 0x00e6, 0x0156, 0x2019, 0x182c, 0x231c, 0x83ff, 0x01f0, 0x2071,
-- 0x0260, 0x7200, 0x9294, 0x00ff, 0x7004, 0x9084, 0xff00, 0x9205,
-- 0x9306, 0x1198, 0x2011, 0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019,
-- 0x000a, 0x080c, 0xc222, 0x1148, 0x2011, 0x027a, 0x20a9, 0x0004,
-- 0x2019, 0x0006, 0x080c, 0xc222, 0x1100, 0x015e, 0x00ee, 0x003e,
-- 0x002e, 0x009e, 0x0005, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9086,
-- 0x0014, 0x11a8, 0x7038, 0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec,
-- 0x0160, 0x9084, 0x0f00, 0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4,
-- 0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ee,
-- 0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076, 0x0056, 0x0046, 0x0026,
-- 0x0006, 0x0126, 0x2091, 0x8000, 0x2029, 0x19f4, 0x252c, 0x2021,
-- 0x19fb, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7254, 0x7074,
-- 0x9202, 0x1a04, 0xc1ee, 0x080c, 0x8eee, 0x0904, 0xc1e7, 0x080c,
-- 0xeabe, 0x0904, 0xc1e7, 0x6720, 0x9786, 0x0007, 0x0904, 0xc1e7,
-- 0x2500, 0x9c06, 0x0904, 0xc1e7, 0x2400, 0x9c06, 0x0904, 0xc1e7,
-- 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130, 0x00b6,
-- 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1590, 0x00c6, 0x6043, 0xffff,
-- 0x6000, 0x9086, 0x0004, 0x1110, 0x080c, 0x1ad3, 0x9786, 0x000a,
-- 0x0148, 0x080c, 0xd132, 0x1130, 0x00ce, 0x080c, 0xbb5c, 0x080c,
-- 0xb1a7, 0x00e8, 0x6014, 0x2048, 0x080c, 0xcf1b, 0x01a8, 0x9786,
-- 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096,
-- 0xa878, 0x2048, 0x080c, 0x100b, 0x009e, 0xab7a, 0xa877, 0x0000,
-- 0x080c, 0x7006, 0x080c, 0xd10c, 0x080c, 0xb1a7, 0x00ce, 0x9ce0,
-- 0x001c, 0x7068, 0x9c02, 0x1210, 0x0804, 0xc18e, 0x012e, 0x000e,
-- 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005,
-- 0x9786, 0x0006, 0x1118, 0x080c, 0xea30, 0x0c30, 0x9786, 0x0009,
-- 0x1148, 0x6000, 0x9086, 0x0004, 0x0d08, 0x2009, 0x004c, 0x080c,
-- 0xb20a, 0x08e0, 0x9786, 0x000a, 0x0980, 0x0820, 0x220c, 0x2304,
-- 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xc20e, 0x9006, 0x0005,
-- 0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008, 0x9006, 0x918d,
-- 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906, 0x8006, 0x8007,
-- 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300, 0x2098, 0x3518,
-- 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140, 0x8210, 0x8319,
-- 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x9102,
-- 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0x918d, 0x0001,
-- 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x810f, 0x2304, 0x9106,
-- 0x1130, 0x8210, 0x8318, 0x1f04, 0xc24c, 0x9006, 0x0005, 0x918d,
-- 0x0001, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d85, 0x080c,
-- 0xd121, 0x0120, 0x080c, 0xd132, 0x0158, 0x0028, 0x080c, 0x3344,
-- 0x080c, 0xd132, 0x0128, 0x080c, 0x99ed, 0x080c, 0xb16c, 0x0005,
-- 0x080c, 0xbb5c, 0x0cc0, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
-- 0x0208, 0x000a, 0x0005, 0xc292, 0xc292, 0xc292, 0xc292, 0xc292,
-- 0xc292, 0xc292, 0xc292, 0xc292, 0xc292, 0xc292, 0xc294, 0xc294,
-- 0xc294, 0xc294, 0xc292, 0xc292, 0xc292, 0xc294, 0xc292, 0xc292,
-- 0xc292, 0xc292, 0x080c, 0x0d85, 0x600b, 0xffff, 0x6003, 0x000f,
-- 0x6106, 0x0126, 0x2091, 0x8000, 0x080c, 0xd65d, 0x2009, 0x8000,
-- 0x080c, 0x9617, 0x012e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
-- 0x9082, 0x0040, 0x0804, 0xc31c, 0x9186, 0x0027, 0x1520, 0x080c,
-- 0x99ed, 0x080c, 0x3315, 0x080c, 0xd65a, 0x0096, 0x6114, 0x2148,
-- 0x080c, 0xcf1b, 0x0198, 0x080c, 0xd132, 0x1118, 0x080c, 0xbb5c,
-- 0x0068, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c,
-- 0xc1c5, 0xa97e, 0x080c, 0x7012, 0x080c, 0xd10c, 0x009e, 0x080c,
-- 0xb16c, 0x0804, 0x9ab3, 0x9186, 0x0014, 0x1120, 0x6004, 0x9082,
-- 0x0040, 0x0030, 0x9186, 0x0053, 0x0110, 0x080c, 0x0d85, 0x0005,
-- 0x0002, 0xc2fa, 0xc2f8, 0xc2f8, 0xc2f8, 0xc2f8, 0xc2f8, 0xc2f8,
-- 0xc2f8, 0xc2f8, 0xc2f8, 0xc2f8, 0xc313, 0xc313, 0xc313, 0xc313,
-- 0xc2f8, 0xc313, 0xc2f8, 0xc313, 0xc2f8, 0xc2f8, 0xc2f8, 0xc2f8,
-- 0x080c, 0x0d85, 0x080c, 0x99ed, 0x0096, 0x6114, 0x2148, 0x080c,
-- 0xcf1b, 0x0168, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877, 0x0000,
-- 0xa880, 0xc0ec, 0xa882, 0x080c, 0x7012, 0x080c, 0xd10c, 0x009e,
-- 0x080c, 0xb16c, 0x0005, 0x080c, 0x99ed, 0x080c, 0xd132, 0x090c,
-- 0xbb5c, 0x080c, 0xb16c, 0x0005, 0x0002, 0xc336, 0xc334, 0xc334,
-- 0xc334, 0xc334, 0xc334, 0xc334, 0xc334, 0xc334, 0xc334, 0xc334,
-- 0xc338, 0xc338, 0xc338, 0xc338, 0xc334, 0xc33a, 0xc334, 0xc338,
-- 0xc334, 0xc334, 0xc334, 0xc334, 0x080c, 0x0d85, 0x080c, 0x0d85,
-- 0x080c, 0x0d85, 0x080c, 0xb16c, 0x0804, 0x9ab3, 0x9182, 0x0057,
-- 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xc35d, 0xc35d,
-- 0xc35d, 0xc35d, 0xc35d, 0xc396, 0xc488, 0xc35d, 0xc494, 0xc35d,
-- 0xc35d, 0xc35d, 0xc35d, 0xc35d, 0xc35d, 0xc35d, 0xc35d, 0xc35d,
-- 0xc35d, 0xc494, 0xc35f, 0xc35d, 0xc492, 0x080c, 0x0d85, 0x00b6,
-- 0x0096, 0x6114, 0x2148, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1508,
-- 0xa87b, 0x0000, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87c, 0xd0ac,
-- 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc519, 0x080c, 0x6e27,
-- 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8d0,
-- 0x9005, 0x0110, 0x080c, 0x68df, 0x080c, 0xb16c, 0x009e, 0x00be,
-- 0x0005, 0xa87c, 0xd0ac, 0x09e0, 0xa838, 0xa934, 0x9105, 0x09c0,
-- 0xa880, 0xd0bc, 0x19a8, 0x080c, 0xd267, 0x0c80, 0x00b6, 0x0096,
-- 0x6114, 0x2148, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008, 0x9036,
-- 0x96b4, 0x0fff, 0x86ff, 0x1590, 0x6010, 0x2058, 0xb800, 0xd0bc,
-- 0x1904, 0xc477, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0xa87c,
-- 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc519, 0x080c,
-- 0x6e27, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
-- 0xb8d0, 0x9005, 0x0110, 0x080c, 0x68df, 0x601c, 0xd0fc, 0x1148,
-- 0x7044, 0xd0e4, 0x1904, 0xc458, 0x080c, 0xb16c, 0x009e, 0x00be,
-- 0x0005, 0x2009, 0x0211, 0x210c, 0x080c, 0x0d85, 0x968c, 0x0c00,
-- 0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc45c, 0x7348,
-- 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0508,
-- 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0,
-- 0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100,
-- 0x9205, 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206, 0x0118,
-- 0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007,
-- 0x0010, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4,
-- 0x01d8, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4,
-- 0x0804, 0xc3a2, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009,
-- 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011,
-- 0x0025, 0x080c, 0xca7b, 0x003e, 0xd6cc, 0x0904, 0xc3b7, 0x7154,
-- 0xa98a, 0x81ff, 0x0904, 0xc3b7, 0x9192, 0x0021, 0x1278, 0x8304,
-- 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xca7b, 0x2011, 0x0205,
-- 0x2013, 0x0000, 0x080c, 0xd5e8, 0x0804, 0xc3b7, 0xa868, 0xd0fc,
-- 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c,
-- 0xca1a, 0x00ae, 0x080c, 0xd5e8, 0x080c, 0xca6b, 0x0804, 0xc3b9,
-- 0x080c, 0xd22a, 0x0804, 0xc3ce, 0xa87c, 0xd0ac, 0x0904, 0xc3df,
-- 0xa880, 0xd0bc, 0x1904, 0xc3df, 0x9684, 0x0400, 0x0130, 0xa838,
-- 0xab34, 0x9305, 0x0904, 0xc3df, 0x00b8, 0x7348, 0xa838, 0x9306,
-- 0x1198, 0x734c, 0xa834, 0x931e, 0x0904, 0xc3df, 0x0068, 0xa87c,
-- 0xd0ac, 0x0904, 0xc3aa, 0xa838, 0xa934, 0x9105, 0x0904, 0xc3aa,
-- 0xa880, 0xd0bc, 0x1904, 0xc3aa, 0x080c, 0xd267, 0x0804, 0xc3ce,
-- 0x00f6, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x00fe,
-- 0x0021, 0x0005, 0x0011, 0x0005, 0x0005, 0x0096, 0x6003, 0x0002,
-- 0x6007, 0x0043, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0128, 0x009e,
-- 0x0005, 0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a, 0x2300,
-- 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500, 0x9203, 0x0e90, 0xac46,
-- 0xab4a, 0xae36, 0xad3a, 0x6044, 0xd0fc, 0x190c, 0xad25, 0x604b,
-- 0x0000, 0x080c, 0x1c9c, 0x1118, 0x6144, 0x080c, 0x9643, 0x009e,
-- 0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
-- 0x0005, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0,
-- 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e2, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0,
-- 0xc4f3, 0xc4e0, 0xc4e0, 0xc4e0, 0xc4e0, 0xc517, 0xc4e0, 0xc4e0,
-- 0x080c, 0x0d85, 0x6004, 0x9086, 0x0040, 0x1110, 0x080c, 0x99ed,
-- 0x2019, 0x0001, 0x080c, 0xa596, 0x6003, 0x0002, 0x080c, 0xd662,
-- 0x080c, 0x9a48, 0x0005, 0x6004, 0x9086, 0x0040, 0x1110, 0x080c,
-- 0x99ed, 0x2019, 0x0001, 0x080c, 0xa596, 0x080c, 0x9a48, 0x080c,
-- 0x3315, 0x080c, 0xd65a, 0x0096, 0x6114, 0x2148, 0x080c, 0xcf1b,
-- 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0x080c,
-- 0x7012, 0x080c, 0xd10c, 0x009e, 0x080c, 0xb16c, 0x0005, 0x080c,
-- 0x0d85, 0xa87b, 0x0015, 0xd1fc, 0x0180, 0xa87b, 0x0007, 0x8002,
-- 0x8000, 0x810a, 0x9189, 0x0000, 0x0006, 0x0016, 0x2009, 0x1a7c,
-- 0x2104, 0x8000, 0x200a, 0x001e, 0x000e, 0xa992, 0xa88e, 0x0005,
-- 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005,
-- 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc551, 0xc54f, 0xc54f,
-- 0xc60e, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc54f,
-- 0xc54f, 0xc54f, 0xc54f, 0xc74e, 0xc54f, 0xc758, 0xc54f, 0x080c,
-- 0x0d85, 0x601c, 0xd0bc, 0x0178, 0xd084, 0x0168, 0xd0f4, 0x0120,
-- 0xc084, 0x601e, 0x0804, 0xc33e, 0x6114, 0x0096, 0x2148, 0xa87c,
-- 0xc0e5, 0xa87e, 0x009e, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071,
-- 0x0260, 0x6114, 0x2150, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008,
-- 0x9036, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210,
-- 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be,
-- 0x86ff, 0x0904, 0xc607, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120,
-- 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xc607,
-- 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0xb676,
-- 0x0c38, 0x080c, 0x1059, 0x090c, 0x0d85, 0x2900, 0xb07a, 0xb77c,
-- 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c,
-- 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000, 0x9635, 0xae76,
-- 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c,
-- 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b,
-- 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4,
-- 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080,
-- 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86,
-- 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036,
-- 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xca7b, 0x003e,
-- 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021,
-- 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xca7b,
-- 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120,
-- 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xca1a, 0x080c,
-- 0x1a9f, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001, 0x1988,
-- 0x2004, 0x604a, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105,
-- 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002, 0x080c, 0xd66b,
-- 0x0904, 0xc749, 0x604b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb800,
-- 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc70d, 0xa978, 0xa868,
-- 0xd0fc, 0x0904, 0xc6ce, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006,
-- 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0904,
-- 0xc69b, 0x9086, 0x0028, 0x1904, 0xc687, 0xa87b, 0x001c, 0xb07b,
-- 0x001c, 0x0804, 0xc6a3, 0x6024, 0xd0f4, 0x11d0, 0xa838, 0xaa34,
-- 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c, 0xaa34,
-- 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834, 0x9102,
-- 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5, 0x6026,
-- 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be, 0x601c,
-- 0xc0fc, 0x601e, 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4,
-- 0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048,
-- 0x080c, 0x100b, 0x009e, 0x080c, 0xd267, 0x0804, 0xc749, 0xd1dc,
-- 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xd508, 0x0118,
-- 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007,
-- 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-- 0x9115, 0x190c, 0xc519, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c,
-- 0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9,
-- 0x0020, 0x8a06, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084,
-- 0xffc0, 0x9080, 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882,
-- 0x000e, 0xc0cc, 0xa87e, 0x080c, 0xd5e8, 0x001e, 0xa874, 0x0006,
-- 0x2148, 0x080c, 0x100b, 0x001e, 0x0804, 0xc73a, 0x0016, 0x00a6,
-- 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086,
-- 0x0028, 0x1128, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc,
-- 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xd508, 0x0118,
-- 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007,
-- 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-- 0x9115, 0x190c, 0xc519, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c,
-- 0xb07e, 0x00ae, 0x080c, 0x100b, 0x009e, 0x080c, 0xd5e8, 0xa974,
-- 0x0016, 0x080c, 0xca6b, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974,
-- 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118,
-- 0xa87b, 0x001c, 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c,
-- 0xd508, 0x0118, 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118,
-- 0xa87b, 0x0007, 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128,
-- 0xa834, 0xa938, 0x9115, 0x190c, 0xc519, 0xa974, 0x0016, 0x080c,
-- 0x6e27, 0x001e, 0x6010, 0x00b6, 0x2058, 0xba3c, 0xb8d0, 0x0016,
-- 0x9005, 0x190c, 0x68df, 0x001e, 0x00be, 0xd1e4, 0x1120, 0x080c,
-- 0xb16c, 0x009e, 0x0005, 0x080c, 0xd22a, 0x0cd8, 0x6114, 0x0096,
-- 0x2148, 0xa97c, 0x080c, 0xd66b, 0x190c, 0x1abf, 0x009e, 0x0005,
-- 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105, 0x01e8, 0xa877,
-- 0x0000, 0xa87b, 0x0000, 0xa867, 0x0103, 0x00b6, 0x6010, 0x2058,
-- 0xa834, 0xa938, 0x9115, 0x11a0, 0x080c, 0x6e27, 0xba3c, 0x8211,
-- 0x0208, 0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c, 0x68df, 0x080c,
-- 0xb16c, 0x00be, 0x009e, 0x0005, 0xa87c, 0xc0dc, 0xa87e, 0x08f8,
-- 0xb800, 0xd0bc, 0x1120, 0xa834, 0x080c, 0xc519, 0x0c28, 0xa880,
-- 0xd0bc, 0x1dc8, 0x080c, 0xd267, 0x0c60, 0x080c, 0x99ed, 0x0010,
-- 0x080c, 0x9a48, 0x601c, 0xd084, 0x0110, 0x080c, 0x1ad3, 0x080c,
-- 0xcf1b, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c, 0xd132, 0x1118,
-- 0x080c, 0xbb5c, 0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c,
-- 0xd18c, 0x1198, 0xd184, 0x1170, 0x6108, 0xa97a, 0x918e, 0x0029,
-- 0x1110, 0x080c, 0xeddf, 0xa877, 0x0000, 0x080c, 0x7012, 0x009e,
-- 0x0804, 0xb1a7, 0xa87b, 0x0004, 0x0cb0, 0xa87b, 0x0004, 0x0c98,
-- 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005,
-- 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7e1, 0xc7df, 0xc7df,
-- 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc7df,
-- 0xc7df, 0xc7df, 0xc7df, 0xc7df, 0xc805, 0xc7df, 0xc7df, 0x080c,
-- 0x0d85, 0x080c, 0x5848, 0x01f8, 0x6014, 0x7144, 0x918c, 0x0fff,
-- 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff, 0x0096, 0x904d,
-- 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139, 0x0128, 0xa867,
-- 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a, 0xaa9e,
-- 0x080c, 0x7012, 0x009e, 0x0804, 0xb16c, 0x080c, 0x5848, 0x0dd8,
-- 0x6014, 0x900e, 0x9016, 0x0c10, 0x9182, 0x0085, 0x0002, 0xc81e,
-- 0xc81c, 0xc81c, 0xc82a, 0xc81c, 0xc81c, 0xc81c, 0xc81c, 0xc81c,
-- 0xc81c, 0xc81c, 0xc81c, 0xc81c, 0x080c, 0x0d85, 0x6003, 0x0001,
-- 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0x8020, 0x080c, 0x9617,
-- 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6, 0x2071, 0x0260,
-- 0x7224, 0x6216, 0x7220, 0x080c, 0xcf09, 0x01f8, 0x2268, 0x6800,
-- 0x9086, 0x0000, 0x01d0, 0x6010, 0x6d10, 0x952e, 0x11b0, 0x00c6,
-- 0x2d60, 0x00d6, 0x080c, 0xcadc, 0x00de, 0x00ce, 0x0158, 0x702c,
-- 0xd084, 0x1118, 0x080c, 0xcaa6, 0x0010, 0x6803, 0x0002, 0x6007,
-- 0x0086, 0x0028, 0x080c, 0xcac8, 0x0d90, 0x6007, 0x0087, 0x6003,
-- 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x7220, 0x080c, 0xcf09,
-- 0x0178, 0x6810, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140,
-- 0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2d60, 0x080c, 0xd267, 0x00ce,
-- 0x00ee, 0x00de, 0x005e, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160,
-- 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d85, 0x908a, 0x0092, 0x1a0c,
-- 0x0d85, 0x9082, 0x0085, 0x00e2, 0x9186, 0x0027, 0x0120, 0x9186,
-- 0x0014, 0x190c, 0x0d85, 0x080c, 0x99ed, 0x0096, 0x6014, 0x2048,
-- 0x080c, 0xcf1b, 0x0140, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b,
-- 0x0029, 0x080c, 0x7012, 0x009e, 0x080c, 0xb1a7, 0x0804, 0x9ab3,
-- 0xc8ad, 0xc8af, 0xc8af, 0xc8ad, 0xc8ad, 0xc8ad, 0xc8ad, 0xc8ad,
-- 0xc8ad, 0xc8ad, 0xc8ad, 0xc8ad, 0xc8ad, 0x080c, 0x0d85, 0x080c,
-- 0xb1a7, 0x0005, 0x9186, 0x0013, 0x1130, 0x6004, 0x9082, 0x0085,
-- 0x2008, 0x0804, 0xc8fe, 0x9186, 0x0027, 0x1558, 0x080c, 0x99ed,
-- 0x080c, 0x3315, 0x080c, 0xd65a, 0x0096, 0x6014, 0x2048, 0x080c,
-- 0xcf1b, 0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029,
-- 0x080c, 0x7012, 0x080c, 0xd10c, 0x009e, 0x080c, 0xb16c, 0x0005,
-- 0x9186, 0x0089, 0x0118, 0x9186, 0x008a, 0x1140, 0x080c, 0xaf61,
-- 0x0128, 0x9086, 0x000c, 0x0904, 0xc936, 0x0000, 0x080c, 0xb227,
-- 0x0c70, 0x9186, 0x0014, 0x1d60, 0x080c, 0x99ed, 0x0096, 0x6014,
-- 0x2048, 0x080c, 0xcf1b, 0x0d00, 0xa867, 0x0103, 0xa877, 0x0000,
-- 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882, 0x0890, 0x0002, 0xc90e,
-- 0xc90c, 0xc90c, 0xc90c, 0xc90c, 0xc90c, 0xc922, 0xc90c, 0xc90c,
-- 0xc90c, 0xc90c, 0xc90c, 0xc90c, 0x080c, 0x0d85, 0x6034, 0x908c,
-- 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
-- 0x2001, 0x1986, 0x0010, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003,
-- 0x000c, 0x0005, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-- 0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001,
-- 0x1987, 0x2004, 0x601a, 0x6003, 0x000e, 0x0005, 0x9182, 0x0092,
-- 0x1220, 0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0xb227, 0xc94c,
-- 0xc94c, 0xc94c, 0xc94c, 0xc94e, 0xc99b, 0xc94c, 0xc94c, 0xc94c,
-- 0xc94c, 0xc94c, 0xc94c, 0xc94c, 0x080c, 0x0d85, 0x0096, 0x6010,
-- 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034, 0x908c,
-- 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
-- 0x009e, 0x0804, 0xc9af, 0x080c, 0xcf1b, 0x1118, 0x080c, 0xd10c,
-- 0x0068, 0x6014, 0x2048, 0x080c, 0xd671, 0x1110, 0x080c, 0xd10c,
-- 0xa867, 0x0103, 0x080c, 0xd625, 0x080c, 0x7012, 0x00d6, 0x2c68,
-- 0x080c, 0xb116, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e, 0x600b,
-- 0xffff, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c,
-- 0x613e, 0x6910, 0x6112, 0x080c, 0xd3b6, 0x695c, 0x615e, 0x6023,
-- 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x2d60, 0x00de, 0x080c,
-- 0xb16c, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-- 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035,
-- 0x0130, 0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538, 0x00d6,
-- 0x2c68, 0x080c, 0xd5bb, 0x11f0, 0x080c, 0xb116, 0x01d8, 0x6106,
-- 0x6003, 0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c, 0x612e,
-- 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938, 0x613a,
-- 0x693c, 0x613e, 0x695c, 0x615e, 0x080c, 0xd3b6, 0x2009, 0x8020,
-- 0x080c, 0x9617, 0x2d60, 0x00de, 0x0804, 0xb16c, 0x0096, 0x6014,
-- 0x2048, 0x080c, 0xcf1b, 0x01c8, 0xa867, 0x0103, 0xa880, 0xd0b4,
-- 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc, 0x0118,
-- 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xd226, 0xa877,
-- 0x0000, 0x080c, 0x7012, 0x080c, 0xd10c, 0x009e, 0x0804, 0xb16c,
-- 0x0016, 0x0096, 0x6014, 0x2048, 0x080c, 0xcf1b, 0x0140, 0xa867,
-- 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x7012, 0x009e,
-- 0x001e, 0x9186, 0x0013, 0x0158, 0x9186, 0x0014, 0x0130, 0x9186,
-- 0x0027, 0x0118, 0x080c, 0xb227, 0x0020, 0x080c, 0x99ed, 0x080c,
-- 0xb1a7, 0x0005, 0x0056, 0x0066, 0x0096, 0x00a6, 0x2029, 0x0001,
-- 0x9182, 0x0101, 0x1208, 0x0010, 0x2009, 0x0100, 0x2130, 0x8304,
-- 0x9098, 0x0018, 0x2009, 0x0020, 0x2011, 0x0029, 0x080c, 0xca7b,
-- 0x96b2, 0x0020, 0xb004, 0x904d, 0x0110, 0x080c, 0x100b, 0x080c,
-- 0x1059, 0x0520, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920,
-- 0xb406, 0x968a, 0x003d, 0x1228, 0x2608, 0x2011, 0x001b, 0x0499,
-- 0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b,
-- 0x0451, 0x0c28, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
-- 0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000, 0x0048, 0x2001, 0x0205,
-- 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x009e,
-- 0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055,
-- 0x0130, 0xa807, 0x0000, 0x080c, 0x7012, 0x2a48, 0x0cb8, 0x080c,
-- 0x7012, 0x00ae, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7814, 0x9085,
-- 0x0080, 0x7816, 0xd184, 0x0108, 0x8108, 0x810c, 0x20a9, 0x0001,
-- 0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300,
-- 0x9e00, 0x2098, 0x4003, 0x8318, 0x9386, 0x0020, 0x1148, 0x2018,
-- 0x2300, 0x9e00, 0x2098, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816,
-- 0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe, 0x0005, 0x6920, 0x9186,
-- 0x0003, 0x0118, 0x9186, 0x0002, 0x11d0, 0x00c6, 0x00d6, 0x00e6,
-- 0x2d60, 0x0096, 0x6014, 0x2048, 0x080c, 0xcf1b, 0x0150, 0x2001,
-- 0x0006, 0xa980, 0xc1d5, 0x080c, 0x725e, 0x080c, 0x7006, 0x080c,
-- 0xd10c, 0x009e, 0x080c, 0xb1a7, 0x00ee, 0x00de, 0x00ce, 0x0005,
-- 0x00c6, 0x702c, 0xd084, 0x1170, 0x6008, 0x2060, 0x6020, 0x9086,
-- 0x0002, 0x1140, 0x6104, 0x9186, 0x0085, 0x0118, 0x9186, 0x008b,
-- 0x1108, 0x9006, 0x00ce, 0x0005, 0x0066, 0x0126, 0x2091, 0x8000,
-- 0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083, 0x012e, 0x006e,
-- 0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031, 0x0000, 0x6020,
-- 0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005, 0xcb2a, 0xcb2a,
-- 0xcb25, 0xcb4e, 0xcb06, 0xcb25, 0xcb08, 0xcb25, 0xcb25, 0x9458,
-- 0xcb25, 0xcb25, 0xcb25, 0xcb06, 0xcb06, 0xcb06, 0x080c, 0x0d85,
-- 0x6010, 0x9080, 0x0000, 0x2004, 0xd0bc, 0x190c, 0xcb4e, 0x0036,
-- 0x6014, 0x0096, 0x2048, 0xa880, 0x009e, 0xd0cc, 0x0118, 0x2019,
-- 0x000c, 0x0038, 0xd094, 0x0118, 0x2019, 0x000d, 0x0010, 0x2019,
-- 0x0010, 0x080c, 0xe578, 0x003e, 0x0005, 0x9006, 0x0005, 0x9085,
-- 0x0001, 0x0005, 0x0096, 0x86ff, 0x11e8, 0x6014, 0x2048, 0x080c,
-- 0xcf1b, 0x01d0, 0x6043, 0xffff, 0xa864, 0x9086, 0x0139, 0x1128,
-- 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e, 0x2001, 0x0005,
-- 0x080c, 0x725e, 0x080c, 0xd226, 0x080c, 0x7006, 0x080c, 0xb1a7,
-- 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0, 0x080c, 0xacfc,
-- 0x080c, 0xd67f, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x002b, 0x0106,
-- 0x080c, 0xad18, 0x010e, 0x0005, 0xcb6c, 0xcb9c, 0xcb6e, 0xcbc3,
-- 0xcb97, 0xcb6c, 0xcb25, 0xcb2a, 0xcb2a, 0xcb25, 0xcb25, 0xcb25,
-- 0xcb25, 0xcb25, 0xcb25, 0xcb25, 0x080c, 0x0d85, 0x86ff, 0x1520,
-- 0x6020, 0x9086, 0x0006, 0x0500, 0x0096, 0x6014, 0x2048, 0x080c,
-- 0xcf1b, 0x0168, 0xa87c, 0xd0cc, 0x0140, 0x0096, 0xc0cc, 0xa87e,
-- 0xa878, 0x2048, 0x080c, 0x100b, 0x009e, 0x080c, 0xd226, 0x009e,
-- 0x080c, 0xd5ff, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-- 0x2009, 0x8020, 0x080c, 0x95f9, 0x9085, 0x0001, 0x0005, 0x0066,
-- 0x080c, 0x1ad3, 0x006e, 0x0890, 0x00e6, 0x2071, 0x19e8, 0x7030,
-- 0x9c06, 0x1120, 0x080c, 0xa516, 0x00ee, 0x0840, 0x6020, 0x9084,
-- 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049, 0x0001,
-- 0x2c40, 0x080c, 0xa667, 0x009e, 0x008e, 0x0040, 0x0066, 0x080c,
-- 0xa412, 0x190c, 0x0d85, 0x080c, 0xa420, 0x006e, 0x00ee, 0x1904,
-- 0xcb6e, 0x0804, 0xcb25, 0x0036, 0x00e6, 0x2071, 0x19e8, 0x704c,
-- 0x9c06, 0x1138, 0x901e, 0x080c, 0xa596, 0x00ee, 0x003e, 0x0804,
-- 0xcb6e, 0x080c, 0xa7a1, 0x00ee, 0x003e, 0x1904, 0xcb6e, 0x0804,
-- 0xcb25, 0x00c6, 0x0066, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e,
-- 0x00ce, 0x0005, 0xcbf9, 0xcce2, 0xce50, 0xcc01, 0xb1a7, 0xcbf9,
-- 0xe56e, 0xd667, 0xcce2, 0x941f, 0xcedc, 0xcbf2, 0xcbf2, 0xcbf2,
-- 0xcbf2, 0xcbf2, 0x080c, 0x0d85, 0x080c, 0xd132, 0x1110, 0x080c,
-- 0xbb5c, 0x0005, 0x080c, 0x99ed, 0x0804, 0xb16c, 0x601b, 0x0001,
-- 0x0005, 0x080c, 0xcf1b, 0x0130, 0x6014, 0x0096, 0x2048, 0x2c00,
-- 0xa896, 0x009e, 0x080c, 0xacfc, 0x080c, 0xd67f, 0x908a, 0x0010,
-- 0x1a0c, 0x0d85, 0x0013, 0x0804, 0xad18, 0xcc25, 0xcc27, 0xcc51,
-- 0xcc65, 0xcc92, 0xcc25, 0xcbf9, 0xcbf9, 0xcbf9, 0xcc6c, 0xcc6c,
-- 0xcc25, 0xcc25, 0xcc25, 0xcc25, 0xcc76, 0x080c, 0x0d85, 0x00e6,
-- 0x6014, 0x0096, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071,
-- 0x19e8, 0x7030, 0x9c06, 0x01d0, 0x0066, 0x080c, 0xa412, 0x190c,
-- 0x0d85, 0x080c, 0xa420, 0x006e, 0x080c, 0xd5ff, 0x6007, 0x0085,
-- 0x6003, 0x000b, 0x6023, 0x0002, 0x2001, 0x1987, 0x2004, 0x601a,
-- 0x2009, 0x8020, 0x080c, 0x95f9, 0x00ee, 0x0005, 0x601b, 0x0001,
-- 0x0cd8, 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e,
-- 0x080c, 0xd5ff, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-- 0x2009, 0x8020, 0x080c, 0x95f9, 0x0005, 0x080c, 0xacfc, 0x080c,
-- 0xaee3, 0x080c, 0xad18, 0x0c28, 0x0096, 0x601b, 0x0001, 0x6014,
-- 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c, 0x5848,
-- 0x01b8, 0x6014, 0x0096, 0x904d, 0x0190, 0xa864, 0xa867, 0x0103,
-- 0xa87b, 0x0006, 0x9086, 0x0139, 0x1150, 0xa867, 0x0139, 0xa87b,
-- 0x0030, 0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x7012, 0x009e,
-- 0x0804, 0xb16c, 0x6014, 0x0096, 0x904d, 0x0904, 0xccdd, 0xa97c,
-- 0xd1e4, 0x1160, 0x611c, 0xd1fc, 0x0904, 0xccdd, 0x6110, 0x00b6,
-- 0x2158, 0xb93c, 0x8109, 0x0208, 0xb93e, 0x00be, 0x080c, 0xad18,
-- 0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884,
-- 0x009e, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0030,
-- 0x2c08, 0x080c, 0x16b9, 0x2001, 0x030c, 0x2004, 0x9086, 0x0041,
-- 0x1198, 0x6014, 0x0096, 0x904d, 0x090c, 0x0d85, 0xa880, 0xd0f4,
-- 0x1130, 0xc0f5, 0xa882, 0x009e, 0x601b, 0x0002, 0x0068, 0x009e,
-- 0x00c6, 0x080c, 0x2185, 0x00ce, 0x6000, 0x9086, 0x0004, 0x1120,
-- 0x2009, 0x0048, 0x080c, 0xb20a, 0x0005, 0x009e, 0x080c, 0x1ad3,
-- 0x0804, 0xcc51, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x000b,
-- 0x0005, 0xccf9, 0xcbfe, 0xccfb, 0xccf9, 0xccfb, 0xccfb, 0xcbfa,
-- 0xccf9, 0xcbf4, 0xcbf4, 0xccf9, 0xccf9, 0xccf9, 0xccf9, 0xccf9,
-- 0xccf9, 0x080c, 0x0d85, 0x6010, 0x00b6, 0x2058, 0xb804, 0x9084,
-- 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0d85, 0x00b6, 0x0013,
-- 0x00be, 0x0005, 0xcd16, 0xcde7, 0xcd18, 0xcd58, 0xcd18, 0xcd58,
-- 0xcd18, 0xcd26, 0xcd16, 0xcd58, 0xcd16, 0xcd47, 0x080c, 0x0d85,
-- 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e,
-- 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xcde3, 0x6004, 0x080c,
-- 0xd132, 0x0904, 0xce00, 0x908e, 0x0004, 0x1110, 0x080c, 0x3344,
-- 0x908e, 0x0021, 0x0904, 0xce04, 0x908e, 0x0022, 0x0904, 0xce4b,
-- 0x908e, 0x003d, 0x0904, 0xce04, 0x908e, 0x0039, 0x0904, 0xce08,
-- 0x908e, 0x0035, 0x0904, 0xce08, 0x908e, 0x001e, 0x0178, 0x908e,
-- 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084, 0x00ff, 0x9086,
-- 0x0006, 0x0110, 0x080c, 0x3315, 0x080c, 0xbb5c, 0x0804, 0xb1a7,
-- 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904, 0xcdd4, 0x9186,
-- 0x0002, 0x1904, 0xcda9, 0x2001, 0x1837, 0x2004, 0xd08c, 0x11c8,
-- 0x080c, 0x779e, 0x11b0, 0x080c, 0xd645, 0x0138, 0x080c, 0x77c1,
-- 0x1120, 0x080c, 0x76a7, 0x0804, 0xce34, 0x2001, 0x197d, 0x2003,
-- 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c, 0x76cd, 0x0804,
-- 0xce34, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x0080, 0x0130, 0x2001,
-- 0x1837, 0x2004, 0xd0ac, 0x1904, 0xce34, 0xb8a0, 0x9082, 0x0081,
-- 0x1a04, 0xce34, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0190, 0x8001,
-- 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x604b,
-- 0x0000, 0x080c, 0xb116, 0x0128, 0x2b00, 0x6012, 0x6023, 0x0001,
-- 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0, 0x6010,
-- 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009, 0x1837, 0x2104,
-- 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c, 0x6130, 0x00ee,
-- 0x080c, 0xbb5c, 0x0030, 0x080c, 0xbb5c, 0x080c, 0x3315, 0x080c,
-- 0xd65a, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x3344, 0x012e,
-- 0x00ee, 0x080c, 0xb1a7, 0x0005, 0x2001, 0x0002, 0x080c, 0x66fa,
-- 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x961e, 0x080c, 0x9ab3,
-- 0x00de, 0x00ce, 0x0c80, 0x080c, 0x3344, 0x0804, 0xcd54, 0x00c6,
-- 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010, 0x2058, 0xb840,
-- 0x9084, 0x00ff, 0x9005, 0x0904, 0xcda9, 0x8001, 0xb842, 0x6003,
-- 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x00de, 0x00ce, 0x0898,
-- 0x080c, 0xbb5c, 0x0804, 0xcd56, 0x080c, 0xbb98, 0x0804, 0xcd56,
-- 0x00d6, 0x2c68, 0x6104, 0x080c, 0xd5bb, 0x00de, 0x0118, 0x080c,
-- 0xb16c, 0x0408, 0x6004, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105,
-- 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x603c,
-- 0x600a, 0x2001, 0x1987, 0x2004, 0x601a, 0x602c, 0x2c08, 0x2060,
-- 0x6024, 0xd0b4, 0x0108, 0xc085, 0xc0b5, 0x6026, 0x2160, 0x2009,
-- 0x8020, 0x080c, 0x9617, 0x0005, 0x00de, 0x00ce, 0x080c, 0xbb5c,
-- 0x080c, 0x3315, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x3344,
-- 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000,
-- 0x012e, 0x00ee, 0x0005, 0x080c, 0xb5a8, 0x1904, 0xce00, 0x0005,
-- 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x0096, 0x00d6, 0x001b,
-- 0x00de, 0x009e, 0x0005, 0xce6b, 0xce6b, 0xce6b, 0xce6b, 0xce6b,
-- 0xce6b, 0xce6b, 0xce6b, 0xce6b, 0xcbf9, 0xce6b, 0xcbfe, 0xce6d,
-- 0xcbfe, 0xce87, 0xce6b, 0x080c, 0x0d85, 0x6004, 0x9086, 0x008b,
-- 0x01b0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035, 0x1130,
-- 0x602c, 0x9080, 0x0009, 0x200c, 0xc185, 0x2102, 0x6007, 0x008b,
-- 0x6003, 0x000d, 0x2009, 0x8020, 0x080c, 0x9617, 0x0005, 0x080c,
-- 0xd639, 0x0118, 0x080c, 0xd64c, 0x0010, 0x080c, 0xd65a, 0x080c,
-- 0xd10c, 0x080c, 0xcf1b, 0x0570, 0x080c, 0x3315, 0x080c, 0xcf1b,
-- 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877,
-- 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x7012, 0x2c68, 0x080c,
-- 0xb116, 0x0150, 0x6810, 0x6012, 0x080c, 0xd3b6, 0x00c6, 0x2d60,
-- 0x080c, 0xb1a7, 0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000, 0x6023,
-- 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x961e, 0x080c,
-- 0x9ab3, 0x00c8, 0x080c, 0xd639, 0x0138, 0x6034, 0x9086, 0x4000,
-- 0x1118, 0x080c, 0x3315, 0x08d0, 0x6034, 0x908c, 0xff00, 0x810f,
-- 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x080c, 0x3315,
-- 0x0868, 0x080c, 0xb1a7, 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c,
-- 0x0d85, 0x0002, 0xcef2, 0xcef2, 0xcefa, 0xcef4, 0xcf04, 0xcef2,
-- 0xcef2, 0xb1a7, 0xcef2, 0xcef2, 0xcef2, 0xcef2, 0xcef2, 0xcef2,
-- 0xcef2, 0xcef2, 0x080c, 0x0d85, 0x080c, 0xacfc, 0x080c, 0xaee3,
-- 0x080c, 0xad18, 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c,
-- 0x7012, 0x009e, 0x0804, 0xb16c, 0x601c, 0xd084, 0x190c, 0x1ad3,
-- 0x0c88, 0x9284, 0x0003, 0x1158, 0x9282, 0x1ddc, 0x0240, 0x2001,
-- 0x181a, 0x2004, 0x9202, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006,
-- 0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006, 0x6014, 0x2048, 0x000e,
-- 0x0006, 0x9984, 0xf000, 0x9086, 0xf000, 0x0110, 0x080c, 0x1104,
-- 0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126,
-- 0x2091, 0x8000, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7354, 0x7074,
-- 0x9302, 0x1640, 0x6020, 0x9206, 0x11f8, 0x080c, 0xd645, 0x0180,
-- 0x9286, 0x0001, 0x1168, 0x6004, 0x9086, 0x0004, 0x1148, 0x080c,
-- 0x3315, 0x080c, 0xd65a, 0x00c6, 0x080c, 0xb1a7, 0x00ce, 0x0060,
-- 0x080c, 0xd328, 0x0148, 0x080c, 0xd132, 0x1110, 0x080c, 0xbb5c,
-- 0x00c6, 0x080c, 0xb16c, 0x00ce, 0x9ce0, 0x001c, 0x7068, 0x9c02,
-- 0x1208, 0x08a0, 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005,
-- 0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000, 0x210c, 0x81ff, 0x0128,
-- 0x2061, 0x1b39, 0x6112, 0x080c, 0x3315, 0x9006, 0x0010, 0x9085,
-- 0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xb116, 0x01b0, 0x665e, 0x2b00, 0x6012, 0x080c,
-- 0x5848, 0x0118, 0x080c, 0xd04e, 0x0168, 0x080c, 0xd3b6, 0x6023,
-- 0x0003, 0x2009, 0x004b, 0x080c, 0xb20a, 0x9085, 0x0001, 0x012e,
-- 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-- 0xbaa0, 0x080c, 0xb1dd, 0x0580, 0x605f, 0x0000, 0x2b00, 0x6012,
-- 0x080c, 0xd3b6, 0x6023, 0x0003, 0x0016, 0x080c, 0xacfc, 0x080c,
-- 0x97b0, 0x0076, 0x903e, 0x080c, 0x966d, 0x2c08, 0x080c, 0xe75d,
-- 0x007e, 0x080c, 0xad18, 0x001e, 0xd184, 0x0128, 0x080c, 0xb16c,
-- 0x9085, 0x0001, 0x0070, 0x080c, 0x5848, 0x0128, 0xd18c, 0x1170,
-- 0x080c, 0xd04e, 0x0148, 0x2009, 0x004c, 0x080c, 0xb20a, 0x9085,
-- 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016,
-- 0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6,
-- 0x0046, 0x0016, 0x080c, 0xb116, 0x2c78, 0x05a0, 0x7e5e, 0x2b00,
-- 0x7812, 0x7823, 0x0003, 0x0016, 0x2021, 0x0005, 0x080c, 0xd060,
-- 0x001e, 0x9186, 0x004d, 0x0118, 0x9186, 0x004e, 0x0148, 0x2001,
-- 0x1980, 0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c, 0xb16c, 0x00d0,
-- 0x2001, 0x197f, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xb16c,
-- 0x0088, 0x2f60, 0x080c, 0x5848, 0x0138, 0xd18c, 0x1118, 0x04f1,
-- 0x0148, 0x0010, 0x2900, 0x7816, 0x001e, 0x0016, 0x080c, 0xb20a,
-- 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6,
-- 0x00c6, 0x0046, 0x080c, 0xb116, 0x2c78, 0x0508, 0x7e5e, 0x2b00,
-- 0x7812, 0x7823, 0x0003, 0x0096, 0x2021, 0x0004, 0x0489, 0x009e,
-- 0x2001, 0x197e, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xb16c,
-- 0x0060, 0x2f60, 0x080c, 0x5848, 0x0120, 0xd18c, 0x1160, 0x0071,
-- 0x0130, 0x2009, 0x0052, 0x080c, 0xb20a, 0x9085, 0x0001, 0x004e,
-- 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c,
-- 0x4c41, 0x00ce, 0x1120, 0x080c, 0xb16c, 0x9006, 0x0005, 0xa867,
-- 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016, 0x9085, 0x0001, 0x0005,
-- 0x0096, 0x0076, 0x0126, 0x2091, 0x8000, 0x080c, 0xacfc, 0x080c,
-- 0x699d, 0x0158, 0x2001, 0xd067, 0x0006, 0x900e, 0x2400, 0x080c,
-- 0x725e, 0x080c, 0x7012, 0x000e, 0x0807, 0x2418, 0x080c, 0x99b3,
-- 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c,
-- 0x97ca, 0x008e, 0x080c, 0x966d, 0x2f08, 0x2648, 0x080c, 0xe75d,
-- 0xb93c, 0x81ff, 0x090c, 0x98a3, 0x080c, 0xad18, 0x012e, 0x007e,
-- 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb116,
-- 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023, 0x0001,
-- 0x2900, 0x6016, 0x2009, 0x001f, 0x080c, 0xb20a, 0x9085, 0x0001,
-- 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0xb1dd, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c,
-- 0xd3b6, 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c,
-- 0x17ad, 0x00fe, 0x2009, 0x0021, 0x080c, 0xb20a, 0x9085, 0x0001,
-- 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6,
-- 0x0126, 0x0016, 0x2091, 0x8000, 0x080c, 0xb116, 0x0198, 0x660a,
-- 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023, 0x0001, 0x2900, 0x6016,
-- 0x001e, 0x0016, 0x080c, 0xb20a, 0x9085, 0x0001, 0x001e, 0x012e,
-- 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0xb1dd, 0x0188, 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023,
-- 0x0001, 0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0xb20a, 0x9085,
-- 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044,
-- 0x0830, 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258,
-- 0xba3c, 0x82ff, 0x0118, 0x8211, 0xba3e, 0x1140, 0xb8d0, 0x9005,
-- 0x0128, 0xb888, 0x9005, 0x1110, 0xb88b, 0x0001, 0x00be, 0x002e,
-- 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e,
-- 0x0003, 0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e,
-- 0x000e, 0x0005, 0x0006, 0x0086, 0x0096, 0x6020, 0x9086, 0x0004,
-- 0x01a8, 0x6014, 0x904d, 0x080c, 0xcf1b, 0x0180, 0xa864, 0x9086,
-- 0x0139, 0x0170, 0x6020, 0x90c6, 0x0003, 0x0140, 0x90c6, 0x0002,
-- 0x0128, 0xa868, 0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001,
-- 0x009e, 0x008e, 0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0xb1dd, 0x0198, 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023,
-- 0x0001, 0x2900, 0x6016, 0x080c, 0x3315, 0x2009, 0x0028, 0x080c,
-- 0xb20a, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-- 0x9186, 0x0015, 0x11a8, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074,
-- 0x1178, 0x00b6, 0x080c, 0xbe09, 0x00be, 0x080c, 0xc085, 0x6003,
-- 0x0001, 0x6007, 0x0029, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0078,
-- 0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001,
-- 0x0001, 0x080c, 0xd57c, 0x080c, 0xbb5c, 0x080c, 0xb16c, 0x0005,
-- 0x0096, 0x6014, 0x904d, 0x090c, 0x0d85, 0xa87b, 0x0030, 0xa883,
-- 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x009e, 0x080c, 0xb16c,
-- 0x0c30, 0x0096, 0x9186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c,
-- 0x66fa, 0x00e8, 0x9186, 0x0015, 0x1510, 0x2011, 0x1824, 0x2204,
-- 0x9086, 0x0014, 0x11e0, 0x6010, 0x00b6, 0x2058, 0x080c, 0x684f,
-- 0x00be, 0x080c, 0xc15b, 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890,
-- 0x00be, 0x9005, 0x0160, 0x2001, 0x0006, 0x080c, 0x66fa, 0x6014,
-- 0x2048, 0xa868, 0xd0fc, 0x0170, 0x080c, 0xb57c, 0x0048, 0x6014,
-- 0x2048, 0xa868, 0xd0fc, 0x0528, 0x080c, 0xbb5c, 0x080c, 0xb16c,
-- 0x009e, 0x0005, 0x6014, 0x6310, 0x2358, 0x904d, 0x090c, 0x0d85,
-- 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x900e, 0x080c,
-- 0x6aae, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x080c, 0xb16c,
-- 0x08f8, 0x6014, 0x904d, 0x090c, 0x0d85, 0xa87b, 0x0030, 0xa883,
-- 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126,
-- 0x2091, 0x8000, 0x080c, 0x7012, 0x012e, 0x080c, 0xb16c, 0x0840,
-- 0xa878, 0x9086, 0x0005, 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad,
-- 0xa882, 0x0005, 0x604b, 0x0000, 0x6017, 0x0000, 0x6003, 0x0001,
-- 0x6007, 0x0050, 0x2009, 0x8023, 0x080c, 0x9617, 0x0005, 0x00c6,
-- 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0130, 0x0066,
-- 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x00ce, 0x0005, 0xcbf9,
-- 0xd259, 0xd259, 0xd25c, 0xeadc, 0xeaf7, 0xeafa, 0xcbf9, 0xcbf9,
-- 0xcbf9, 0xcbf9, 0xcbf9, 0xcbf9, 0xcbf9, 0xcbf9, 0xcbf9, 0x080c,
-- 0x0d85, 0xa001, 0xa001, 0x0005, 0x0096, 0x6014, 0x904d, 0x0118,
-- 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e, 0x0005, 0x6010,
-- 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550, 0x2001, 0x1834,
-- 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c, 0xb116, 0x0508,
-- 0x7810, 0x6012, 0x080c, 0xd3b6, 0x7820, 0x9086, 0x0003, 0x0128,
-- 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020, 0x7808, 0x603e, 0x2f00,
-- 0x603a, 0x602e, 0x6023, 0x0001, 0x6007, 0x0035, 0x6003, 0x0001,
-- 0x795c, 0x615e, 0x2009, 0x8020, 0x080c, 0x9617, 0x2f60, 0x00fe,
-- 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1988, 0x2004, 0x604a, 0x0005,
-- 0x0016, 0x0096, 0x6814, 0x2048, 0x681c, 0xd0fc, 0xc0fc, 0x681e,
-- 0xa87c, 0x1108, 0xd0e4, 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000,
-- 0xa893, 0x0000, 0xa88f, 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e,
-- 0xa878, 0x2048, 0x080c, 0x100b, 0x6830, 0x6036, 0x908e, 0x0001,
-- 0x0148, 0x6803, 0x0002, 0x9086, 0x0005, 0x0170, 0x9006, 0x602e,
-- 0x6032, 0x00d0, 0x681c, 0xc085, 0x681e, 0x6803, 0x0004, 0x6824,
-- 0xc0f4, 0x9085, 0x0c00, 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938,
-- 0x9102, 0xa8b0, 0x693c, 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838,
-- 0x9084, 0xfffc, 0x683a, 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e,
-- 0x6910, 0x6112, 0x695c, 0x615e, 0x6023, 0x0001, 0x6007, 0x0039,
-- 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x009e, 0x001e,
-- 0x0005, 0x6024, 0xd0d4, 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a,
-- 0x603c, 0x9303, 0x0230, 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5,
-- 0x0098, 0x643a, 0x633e, 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400,
-- 0xacac, 0x9402, 0xa836, 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e,
-- 0x004e, 0x6024, 0xc0d4, 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138,
-- 0xa83c, 0x603a, 0xa840, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005,
-- 0x0006, 0x0016, 0x6004, 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035,
-- 0x01a0, 0x908e, 0x0036, 0x0188, 0x908e, 0x0037, 0x0170, 0x908e,
-- 0x0038, 0x0158, 0x908e, 0x0039, 0x0140, 0x908e, 0x003a, 0x0128,
-- 0x908e, 0x003b, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005,
-- 0x0006, 0x0016, 0x0026, 0x0036, 0x00e6, 0x2001, 0x1982, 0x200c,
-- 0x8000, 0x2014, 0x2001, 0x0032, 0x080c, 0x955b, 0x2001, 0x1986,
-- 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1984, 0x200c,
-- 0x8000, 0x2014, 0x2071, 0x196c, 0x711a, 0x721e, 0x2001, 0x0064,
-- 0x080c, 0x955b, 0x2001, 0x1987, 0x82ff, 0x1110, 0x2011, 0x0014,
-- 0x2202, 0x2001, 0x1988, 0x9288, 0x000a, 0x2102, 0x2001, 0x0017,
-- 0x080c, 0xaced, 0x2001, 0x1a90, 0x2102, 0x2001, 0x0032, 0x080c,
-- 0x16b9, 0x080c, 0x6bf2, 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e,
-- 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1986, 0x2003, 0x0028,
-- 0x2001, 0x1987, 0x2003, 0x0014, 0x2071, 0x196c, 0x701b, 0x0000,
-- 0x701f, 0x07d0, 0x2001, 0x1988, 0x2009, 0x001e, 0x2102, 0x2001,
-- 0x0017, 0x080c, 0xaced, 0x2001, 0x1a90, 0x2102, 0x2001, 0x0032,
-- 0x080c, 0x16b9, 0x00ee, 0x001e, 0x000e, 0x0005, 0x0096, 0x6060,
-- 0x904d, 0x0110, 0x080c, 0x108b, 0x009e, 0x0005, 0x0005, 0x00c6,
-- 0x0126, 0x2091, 0x8000, 0x080c, 0xb116, 0x0180, 0x2b08, 0x6112,
-- 0x0ca9, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0033, 0x080c,
-- 0xb20a, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-- 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1520,
-- 0x7090, 0x9086, 0x0018, 0x0120, 0x7090, 0x9086, 0x0014, 0x11e0,
-- 0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x9b83,
-- 0x01d8, 0x707c, 0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206,
-- 0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c,
-- 0x3364, 0x080c, 0xb57c, 0x0020, 0x080c, 0xbb5c, 0x080c, 0xb16c,
-- 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48,
-- 0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb116, 0x0188,
-- 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023, 0x0001, 0x2900, 0x6016,
-- 0x2009, 0x004d, 0x080c, 0xb20a, 0x9085, 0x0001, 0x012e, 0x00ce,
-- 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016,
-- 0x080c, 0xb116, 0x0180, 0x2b08, 0x6112, 0x080c, 0xd3b6, 0x6023,
-- 0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0xb20a, 0x9085, 0x0001,
-- 0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026,
-- 0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071,
-- 0x1800, 0x9186, 0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814,
-- 0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003,
-- 0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007,
-- 0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0,
-- 0x2001, 0x19a1, 0x0016, 0x200c, 0x080c, 0xdca1, 0x001e, 0xa804,
-- 0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103,
-- 0x0010, 0x080c, 0xbb5c, 0x080c, 0xb16c, 0x00fe, 0x00ee, 0x009e,
-- 0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096,
-- 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090,
-- 0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x9b83,
-- 0x01a8, 0x707c, 0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206,
-- 0x1110, 0x080c, 0x3315, 0x080c, 0xb57c, 0x0020, 0x080c, 0xbb5c,
-- 0x080c, 0xb16c, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78,
-- 0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800,
-- 0x9186, 0x0015, 0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014,
-- 0x2048, 0x2c78, 0x080c, 0x9b83, 0x05f0, 0x707c, 0xaacc, 0x9206,
-- 0x1180, 0x7080, 0xaad0, 0x9206, 0x1160, 0x080c, 0x3315, 0x0016,
-- 0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x57e9, 0x001e,
-- 0x0010, 0x080c, 0x55cc, 0x080c, 0xcf1b, 0x0508, 0xa87b, 0x0000,
-- 0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c, 0xcf1b, 0x01b8,
-- 0x6014, 0x2048, 0x080c, 0x55cc, 0x1d70, 0xa87b, 0x0030, 0xa883,
-- 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000,
-- 0xa867, 0x0139, 0x080c, 0x7012, 0x012e, 0x080c, 0xb16c, 0x00fe,
-- 0x00ee, 0x009e, 0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888,
-- 0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100,
-- 0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120,
-- 0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6,
-- 0x00d6, 0x0036, 0x080c, 0xcf1b, 0x0904, 0xd578, 0x0096, 0x6314,
-- 0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6,
-- 0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x6aae,
-- 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a,
-- 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0,
-- 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0fd6,
-- 0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080,
-- 0x000a, 0x2098, 0x080c, 0x0fd6, 0x00ce, 0x0090, 0xaa96, 0x3918,
-- 0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b,
-- 0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e,
-- 0xa868, 0xc0f4, 0xa86a, 0x080c, 0x7006, 0x6017, 0x0000, 0x009e,
-- 0x003e, 0x00de, 0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6,
-- 0x0096, 0x00f6, 0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260,
-- 0x9096, 0x0000, 0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c,
-- 0x268c, 0x2118, 0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff,
-- 0x931d, 0x7c3c, 0x2011, 0x8018, 0x080c, 0x4ca1, 0x00a8, 0x9096,
-- 0x0001, 0x1148, 0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6,
-- 0x783c, 0xa8aa, 0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d,
-- 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e,
-- 0x003e, 0x002e, 0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035,
-- 0x0110, 0x6a38, 0x0008, 0x6a2c, 0x080c, 0xcf09, 0x01f0, 0x2260,
-- 0x6120, 0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838,
-- 0x9206, 0x0140, 0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106,
-- 0x1140, 0x0020, 0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910,
-- 0x9106, 0x001e, 0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8,
-- 0xa974, 0xd1cc, 0x0198, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1170,
-- 0xa9a8, 0x918c, 0x000f, 0x918e, 0x0001, 0x1140, 0xa87c, 0xd0ac,
-- 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc519, 0x0005, 0x0036,
-- 0x2019, 0x0001, 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0, 0x080c,
-- 0xcf1b, 0x01c8, 0x080c, 0xd10c, 0x6037, 0x4000, 0x6014, 0x6017,
-- 0x0000, 0x0096, 0x2048, 0xa87c, 0x080c, 0xd132, 0x1118, 0x080c,
-- 0xbb5c, 0x0040, 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff, 0x1129,
-- 0x080c, 0x7012, 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128,
-- 0xa87b, 0x0006, 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b,
-- 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xd226, 0xa877, 0x0000,
-- 0x0005, 0x2001, 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001,
-- 0x1810, 0x2004, 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001, 0x1810,
-- 0x2004, 0xd0e4, 0x000e, 0x0005, 0x0036, 0x0046, 0x6010, 0x00b6,
-- 0x2058, 0xbba0, 0x00be, 0x2021, 0x0007, 0x080c, 0x4e58, 0x004e,
-- 0x003e, 0x0005, 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1986, 0x2004,
-- 0x601a, 0x0005, 0x2001, 0x1988, 0x2004, 0x604a, 0x0005, 0x080c,
-- 0xb16c, 0x0804, 0x9ab3, 0x611c, 0xd1fc, 0xa97c, 0x1108, 0xd1e4,
-- 0x0005, 0x601c, 0xd0fc, 0xa87c, 0x1108, 0xd0e4, 0x0005, 0x601c,
-- 0xd0fc, 0xc0fc, 0x601e, 0xa87c, 0x1108, 0xd0e4, 0x0005, 0x6044,
-- 0xd0fc, 0x1138, 0xd0bc, 0x01a0, 0xc0bc, 0x6046, 0x2001, 0x0002,
-- 0x0080, 0xd0ac, 0x1168, 0xd0dc, 0x1128, 0x908c, 0x000f, 0x9186,
-- 0x0005, 0x1118, 0x2001, 0x0003, 0x0020, 0x2001, 0x0001, 0x0008,
-- 0x6000, 0x0005, 0x00b6, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c,
-- 0x0d85, 0x001b, 0x006e, 0x00be, 0x0005, 0xd6b5, 0xddfe, 0xdf62,
-- 0xd6b5, 0xd6b5, 0xd6b5, 0xd6b5, 0xd6b5, 0xd6ec, 0xdfe6, 0xd6b5,
-- 0xd6b5, 0xd6b5, 0xd6b5, 0xd6b5, 0xd6b5, 0x080c, 0x0d85, 0x0066,
-- 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x0013, 0x006e, 0x0005,
-- 0xd6d0, 0xe50b, 0xd6d0, 0xd6d0, 0xd6d0, 0xd6d0, 0xd6d0, 0xd6d0,
-- 0xe4ba, 0xe55d, 0xd6d0, 0xec10, 0xec44, 0xec10, 0xec44, 0xd6d0,
-- 0x080c, 0x0d85, 0x6000, 0x9082, 0x0010, 0x1a0c, 0x0d85, 0x6000,
-- 0x000a, 0x0005, 0xd6ea, 0xe1c3, 0xe28e, 0xe2b1, 0xe32d, 0xd6ea,
-- 0xe42a, 0xe3b5, 0xdff0, 0xe492, 0xe4a7, 0xd6ea, 0xd6ea, 0xd6ea,
-- 0xd6ea, 0xd6ea, 0x080c, 0x0d85, 0x91b2, 0x0053, 0x1a0c, 0x0d85,
-- 0x2100, 0x91b2, 0x0040, 0x1a04, 0xdb70, 0x0002, 0xd736, 0xd93e,
-- 0xd736, 0xd736, 0xd736, 0xd947, 0xd736, 0xd736, 0xd736, 0xd736,
-- 0xd736, 0xd736, 0xd736, 0xd736, 0xd736, 0xd736, 0xd736, 0xd736,
-- 0xd736, 0xd736, 0xd736, 0xd736, 0xd736, 0xd738, 0xd79f, 0xd7ae,
-- 0xd812, 0xd83d, 0xd8b6, 0xd929, 0xd736, 0xd736, 0xd94a, 0xd736,
-- 0xd736, 0xd95f, 0xd96c, 0xd736, 0xd736, 0xd736, 0xd736, 0xd736,
-- 0xda12, 0xd736, 0xd736, 0xda26, 0xd736, 0xd736, 0xd9e1, 0xd736,
-- 0xd736, 0xd736, 0xda3e, 0xd736, 0xd736, 0xd736, 0xdabb, 0xd736,
-- 0xd736, 0xd736, 0xd736, 0xd736, 0xd736, 0xdb38, 0x080c, 0x0d85,
-- 0x080c, 0x6bcf, 0x1150, 0x2001, 0x1837, 0x2004, 0xd0cc, 0x1128,
-- 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007, 0x0009, 0x602f,
-- 0x0009, 0x6017, 0x0000, 0x0804, 0xd937, 0x080c, 0x6b6b, 0x00e6,
-- 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0, 0x0026,
-- 0x2019, 0x0029, 0x080c, 0xacfc, 0x080c, 0x97b0, 0x0076, 0x903e,
-- 0x080c, 0x966d, 0x2c08, 0x080c, 0xe75d, 0x007e, 0x001e, 0x080c,
-- 0xad18, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658,
-- 0x080c, 0x67c3, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268,
-- 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08,
-- 0x080c, 0xee6f, 0x002e, 0x001e, 0x1178, 0x080c, 0xe68b, 0x1904,
-- 0xd80a, 0x080c, 0xe627, 0x1120, 0x6007, 0x0008, 0x0804, 0xd937,
-- 0x6007, 0x0009, 0x0804, 0xd937, 0x080c, 0xe905, 0x0128, 0x080c,
-- 0xe68b, 0x0d78, 0x0804, 0xd80a, 0x6017, 0x1900, 0x0c88, 0x080c,
-- 0x344c, 0x1904, 0xdb6d, 0x6106, 0x080c, 0xe5c7, 0x6007, 0x0006,
-- 0x0804, 0xd937, 0x6007, 0x0007, 0x0804, 0xd937, 0x080c, 0xec80,
-- 0x1904, 0xdb6d, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x00d6, 0x6610,
-- 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001,
-- 0x0001, 0x080c, 0x66e6, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
-- 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686,
-- 0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110,
-- 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003,
-- 0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003,
-- 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee,
-- 0x080c, 0xe6f3, 0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210,
-- 0x2258, 0xbaa0, 0x900e, 0x080c, 0x3364, 0x002e, 0x080c, 0x684f,
-- 0x6007, 0x000a, 0x00de, 0x0804, 0xd937, 0x6007, 0x000b, 0x00de,
-- 0x0804, 0xd937, 0x080c, 0x3315, 0x080c, 0xd65a, 0x6007, 0x0001,
-- 0x0804, 0xd937, 0x080c, 0xec80, 0x1904, 0xdb6d, 0x080c, 0x344c,
-- 0x1904, 0xdb6d, 0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948,
-- 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610,
-- 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258,
-- 0xbaa0, 0x900e, 0x080c, 0x3364, 0x002e, 0x6007, 0x000c, 0x2001,
-- 0x0001, 0x080c, 0xee4e, 0x0804, 0xd937, 0x080c, 0x6bcf, 0x1140,
-- 0x2001, 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110,
-- 0x0804, 0xd745, 0x080c, 0x6b6b, 0x6610, 0x2658, 0xbe04, 0x9684,
-- 0x00ff, 0x9082, 0x0006, 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006,
-- 0x080c, 0x6726, 0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686,
-- 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xd80a, 0x080c, 0xe700,
-- 0x1120, 0x6007, 0x000e, 0x0804, 0xd937, 0x0046, 0x6410, 0x2458,
-- 0xbca0, 0x0046, 0x080c, 0x3315, 0x080c, 0xd65a, 0x004e, 0x0016,
-- 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029,
-- 0x080c, 0xea8d, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e,
-- 0x004e, 0x6007, 0x0001, 0x0804, 0xd937, 0x2001, 0x0001, 0x080c,
-- 0x66e6, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
-- 0x1805, 0x2011, 0x0270, 0x080c, 0xc20e, 0x003e, 0x002e, 0x001e,
-- 0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004,
-- 0x0a04, 0xd80a, 0x9682, 0x0007, 0x0a04, 0xd866, 0x0804, 0xd80a,
-- 0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xd937, 0x080c, 0x6bcf,
-- 0x1140, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
-- 0x1110, 0x0804, 0xd745, 0x080c, 0x6b6b, 0x6610, 0x2658, 0xbe04,
-- 0x9684, 0x00ff, 0x0006, 0x0016, 0x908e, 0x0001, 0x0118, 0x908e,
-- 0x0000, 0x1118, 0x001e, 0x000e, 0x0080, 0x001e, 0x000e, 0x9082,
-- 0x0006, 0x06a0, 0x0150, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004,
-- 0x0120, 0x9686, 0x0006, 0x1904, 0xd80a, 0x080c, 0xe72e, 0x1138,
-- 0x080c, 0xe627, 0x1120, 0x6007, 0x0010, 0x0804, 0xd937, 0x0046,
-- 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x3315, 0x080c, 0xd65a,
-- 0x004e, 0x0016, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148,
-- 0x2009, 0x0029, 0x080c, 0xea8d, 0x6010, 0x2058, 0xb800, 0xc0e5,
-- 0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x0448, 0x080c, 0xe905,
-- 0x0198, 0x0016, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0160, 0x9186,
-- 0x0003, 0x0148, 0x001e, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
-- 0x0920, 0x0804, 0xd80a, 0x001e, 0x6017, 0x1900, 0x6007, 0x0009,
-- 0x0070, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x080c, 0xec80, 0x1904,
-- 0xdb6d, 0x080c, 0xdd3e, 0x1904, 0xd80a, 0x6007, 0x0012, 0x6003,
-- 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0005, 0x6007, 0x0001,
-- 0x6003, 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0cb0, 0x6007,
-- 0x0005, 0x0c68, 0x080c, 0xec80, 0x1904, 0xdb6d, 0x080c, 0x344c,
-- 0x1904, 0xdb6d, 0x080c, 0xdd3e, 0x1904, 0xd80a, 0x6007, 0x0020,
-- 0x6003, 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0005, 0x080c,
-- 0x344c, 0x1904, 0xdb6d, 0x6007, 0x0023, 0x6003, 0x0001, 0x080c,
-- 0x961e, 0x080c, 0x9ab3, 0x0005, 0x080c, 0xec80, 0x1904, 0xdb6d,
-- 0x080c, 0x344c, 0x1904, 0xdb6d, 0x080c, 0xdd3e, 0x1904, 0xd80a,
-- 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x2c08, 0x2011, 0x1820,
-- 0x2214, 0x703c, 0x9206, 0x11e0, 0x2011, 0x181f, 0x2214, 0x7038,
-- 0x9084, 0x00ff, 0x9206, 0x11a0, 0x7240, 0x080c, 0xcf09, 0x0570,
-- 0x2260, 0x6008, 0x9086, 0xffff, 0x0120, 0x7244, 0x6008, 0x9206,
-- 0x1528, 0x6020, 0x9086, 0x0007, 0x1508, 0x080c, 0xb16c, 0x04a0,
-- 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08, 0x080c, 0xcf09, 0x01b0,
-- 0x2260, 0x7240, 0x6008, 0x9206, 0x1188, 0x6010, 0x9190, 0x0004,
-- 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006, 0x080c,
-- 0xea57, 0x1180, 0x7244, 0x9286, 0xffff, 0x01b0, 0x2160, 0x6007,
-- 0x0026, 0x6017, 0x1700, 0x7214, 0x9296, 0xffff, 0x1180, 0x6007,
-- 0x0025, 0x0068, 0x6020, 0x9086, 0x0007, 0x1d80, 0x6004, 0x9086,
-- 0x0024, 0x1110, 0x080c, 0xb16c, 0x2160, 0x6007, 0x0025, 0x6003,
-- 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x00ee, 0x002e, 0x001e,
-- 0x0005, 0x2001, 0x0001, 0x080c, 0x66e6, 0x0156, 0x0016, 0x0026,
-- 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c,
-- 0xc20e, 0x003e, 0x002e, 0x001e, 0x015e, 0x0120, 0x6007, 0x0031,
-- 0x0804, 0xd937, 0x080c, 0xbe21, 0x080c, 0x779e, 0x1190, 0x0006,
-- 0x0026, 0x0036, 0x080c, 0x77b8, 0x1138, 0x080c, 0x7ab6, 0x080c,
-- 0x619d, 0x080c, 0x76cd, 0x0010, 0x080c, 0x7772, 0x003e, 0x002e,
-- 0x000e, 0x0005, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x080c, 0xdd3e,
-- 0x1904, 0xd80a, 0x6106, 0x080c, 0xdd5a, 0x1120, 0x6007, 0x002b,
-- 0x0804, 0xd937, 0x6007, 0x002c, 0x0804, 0xd937, 0x080c, 0xec80,
-- 0x1904, 0xdb6d, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x080c, 0xdd3e,
-- 0x1904, 0xd80a, 0x6106, 0x080c, 0xdd5f, 0x1120, 0x6007, 0x002e,
-- 0x0804, 0xd937, 0x6007, 0x002f, 0x0804, 0xd937, 0x080c, 0x344c,
-- 0x1904, 0xdb6d, 0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058, 0xb904,
-- 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158, 0x9184, 0xff00, 0x8007,
-- 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804, 0xd93e,
-- 0x080c, 0x5844, 0xd0e4, 0x0904, 0xdab8, 0x2071, 0x026c, 0x7010,
-- 0x603a, 0x7014, 0x603e, 0x7108, 0x720c, 0x080c, 0x6c0d, 0x0140,
-- 0x6010, 0x2058, 0xb810, 0x9106, 0x1118, 0xb814, 0x9206, 0x0510,
-- 0x080c, 0x6c09, 0x15b8, 0x2069, 0x1800, 0x6880, 0x9206, 0x1590,
-- 0x687c, 0x9106, 0x1578, 0x7210, 0x080c, 0xcf09, 0x0590, 0x080c,
-- 0xdc2b, 0x0578, 0x080c, 0xeb09, 0x0560, 0x622e, 0x6007, 0x0036,
-- 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x00ce, 0x00de,
-- 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff, 0x0150, 0x080c, 0xcf09,
-- 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110, 0x9106, 0x1190, 0x08e0,
-- 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c, 0xea57, 0x2c10, 0x2160,
-- 0x0140, 0x0890, 0x6007, 0x0037, 0x602f, 0x0009, 0x6017, 0x1500,
-- 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003, 0x6017, 0x1700, 0x0880,
-- 0x6007, 0x0012, 0x0868, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x6010,
-- 0x2058, 0xb804, 0x9084, 0xff00, 0x8007, 0x9086, 0x0006, 0x1904,
-- 0xd93e, 0x00e6, 0x00d6, 0x00c6, 0x080c, 0x5844, 0xd0e4, 0x0904,
-- 0xdb30, 0x2069, 0x1800, 0x2071, 0x026c, 0x7008, 0x603a, 0x720c,
-- 0x623e, 0x9286, 0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08, 0x9085,
-- 0x0001, 0x080c, 0xea57, 0x2c10, 0x00ce, 0x05e8, 0x080c, 0xcf09,
-- 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004, 0x9106, 0x15a0, 0x00c6,
-- 0x0026, 0x2260, 0x080c, 0xcadc, 0x002e, 0x00ce, 0x7118, 0x918c,
-- 0xff00, 0x810f, 0x9186, 0x0001, 0x0178, 0x9186, 0x0005, 0x0118,
-- 0x9186, 0x0007, 0x1198, 0x9280, 0x0005, 0x2004, 0x9005, 0x0170,
-- 0x080c, 0xdc2b, 0x0904, 0xdab1, 0x0056, 0x7510, 0x7614, 0x080c,
-- 0xeb22, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007, 0x003b,
-- 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020,
-- 0x080c, 0x9617, 0x0c78, 0x6007, 0x003b, 0x602f, 0x0003, 0x6017,
-- 0x0300, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x0c10,
-- 0x6007, 0x003b, 0x602f, 0x000b, 0x6017, 0x0000, 0x0804, 0xda88,
-- 0x00e6, 0x0026, 0x080c, 0x6bcf, 0x0550, 0x080c, 0x6b6b, 0x080c,
-- 0xecf1, 0x1518, 0x2071, 0x1800, 0x70dc, 0x9085, 0x0003, 0x70de,
-- 0x00f6, 0x2079, 0x0100, 0x72b0, 0x9284, 0x00ff, 0x707e, 0x78e6,
-- 0x9284, 0xff00, 0x7280, 0x9205, 0x7082, 0x78ea, 0x00fe, 0x70e7,
-- 0x0000, 0x080c, 0x6c0d, 0x0120, 0x2011, 0x1a0a, 0x2013, 0x07d0,
-- 0xd0ac, 0x1128, 0x080c, 0x30bf, 0x0010, 0x080c, 0xed25, 0x002e,
-- 0x00ee, 0x080c, 0xb16c, 0x0804, 0xd93d, 0x080c, 0xb16c, 0x0005,
-- 0x2600, 0x0002, 0xdb84, 0xdbb2, 0xdbc3, 0xdb84, 0xdb84, 0xdb86,
-- 0xdbd4, 0xdb84, 0xdb84, 0xdb84, 0xdba0, 0xdb84, 0xdb84, 0xdb84,
-- 0xdbdf, 0xdbf5, 0xdc26, 0xdb84, 0x080c, 0x0d85, 0x080c, 0xec80,
-- 0x1d20, 0x080c, 0x344c, 0x1d08, 0x7038, 0x6016, 0x6007, 0x0045,
-- 0x6003, 0x0001, 0x080c, 0x961e, 0x0005, 0x080c, 0x3315, 0x080c,
-- 0xd65a, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x961e, 0x0005,
-- 0x080c, 0xec80, 0x1950, 0x080c, 0x344c, 0x1938, 0x080c, 0xdd3e,
-- 0x1d60, 0x703c, 0x6016, 0x6007, 0x004a, 0x6003, 0x0001, 0x080c,
-- 0x961e, 0x0005, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x2009, 0x0041,
-- 0x080c, 0xed2e, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x961e,
-- 0x080c, 0x9ab3, 0x0005, 0x080c, 0x344c, 0x1904, 0xdb6d, 0x2009,
-- 0x0042, 0x080c, 0xed2e, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c,
-- 0x961e, 0x080c, 0x9ab3, 0x0005, 0x080c, 0x344c, 0x1904, 0xdb6d,
-- 0x2009, 0x0046, 0x080c, 0xed2e, 0x080c, 0xb16c, 0x0005, 0x2001,
-- 0x1824, 0x2004, 0x9082, 0x00e1, 0x1268, 0x080c, 0xdc48, 0x0904,
-- 0xdb6d, 0x6007, 0x004e, 0x6003, 0x0001, 0x080c, 0x961e, 0x080c,
-- 0x9ab3, 0x0005, 0x6007, 0x0012, 0x0cb0, 0x6007, 0x004f, 0x6017,
-- 0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001,
-- 0x1160, 0x7140, 0x2001, 0x19be, 0x2004, 0x9106, 0x11b0, 0x7144,
-- 0x2001, 0x19bf, 0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168,
-- 0x2011, 0x0276, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019,
-- 0x000a, 0x080c, 0xc222, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003,
-- 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x0005, 0x6007, 0x0050,
-- 0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6,
-- 0x00c6, 0x2260, 0x6010, 0x2058, 0xb8d4, 0xd084, 0x0150, 0x7128,
-- 0x604c, 0x9106, 0x1120, 0x712c, 0x6050, 0x9106, 0x0110, 0x9006,
-- 0x0010, 0x9085, 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005,
-- 0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091,
-- 0x8000, 0x2071, 0x1800, 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003,
-- 0x0000, 0x080c, 0x1072, 0x05a0, 0x2900, 0x6016, 0x7090, 0x8004,
-- 0xa816, 0x908a, 0x001e, 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1,
-- 0x0016, 0x200c, 0x0471, 0x001e, 0x81ff, 0x01b8, 0x2940, 0x080c,
-- 0x1072, 0x01b0, 0x2900, 0xa006, 0x2100, 0x0c18, 0xa832, 0x20a8,
-- 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1,
-- 0x0016, 0x200c, 0x00b1, 0x001e, 0x0000, 0x9085, 0x0001, 0x0048,
-- 0x2071, 0x1800, 0x7093, 0x0000, 0x6014, 0x2048, 0x080c, 0x100b,
-- 0x9006, 0x012e, 0x01de, 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e,
-- 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff,
-- 0x11b0, 0x080c, 0x21f9, 0x2099, 0x026c, 0x2001, 0x0014, 0x3518,
-- 0x9312, 0x0108, 0x1218, 0x23a8, 0x4003, 0x0400, 0x20a8, 0x4003,
-- 0x22a8, 0x8108, 0x080c, 0x21f9, 0x2099, 0x0260, 0x0ca8, 0x080c,
-- 0x21f9, 0x2061, 0x19a1, 0x6004, 0x2098, 0x6008, 0x3518, 0x9312,
-- 0x0108, 0x1218, 0x23a8, 0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8,
-- 0x8108, 0x080c, 0x21f9, 0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a1,
-- 0x2019, 0x0280, 0x3300, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001,
-- 0x0260, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff,
-- 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006,
-- 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff, 0x11b8, 0x080c, 0x2211,
-- 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8,
-- 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108,
-- 0x080c, 0x2211, 0x20a1, 0x0240, 0x0c98, 0x080c, 0x2211, 0x2061,
-- 0x19a4, 0x6004, 0x20a0, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8,
-- 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108,
-- 0x080c, 0x2211, 0x20a1, 0x0240, 0x0c98, 0x2061, 0x19a4, 0x2019,
-- 0x0260, 0x3400, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0240,
-- 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a,
-- 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x00b6, 0x0066,
-+ 0xd50c, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-+ 0x2001, 0x0006, 0x080c, 0x66f3, 0x080c, 0x3344, 0x080c, 0xb157,
-+ 0x0804, 0xbde6, 0x080c, 0xbdf4, 0x6014, 0x9005, 0x0190, 0x2048,
-+ 0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-+ 0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd50c,
-+ 0x08f8, 0x080c, 0xbdea, 0x0160, 0x9006, 0x080c, 0x66df, 0x2001,
-+ 0x0004, 0x080c, 0x671f, 0x2001, 0x0007, 0x080c, 0x66f3, 0x08a0,
-+ 0x2001, 0x0004, 0x080c, 0x66f3, 0x6003, 0x0001, 0x6007, 0x0003,
-+ 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0804, 0xbde6, 0xb85c, 0xd0e4,
-+ 0x0178, 0x080c, 0xd335, 0x080c, 0x778e, 0x0118, 0xd0dc, 0x1904,
-+ 0xbd10, 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012, 0x0804, 0xbd10,
-+ 0x080c, 0xd376, 0x2011, 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006,
-+ 0x080c, 0xe8ec, 0x000e, 0x1904, 0xbd10, 0xc0b5, 0x2012, 0x2001,
-+ 0x0006, 0x080c, 0x66f3, 0x9006, 0x080c, 0x66df, 0x00c6, 0x2001,
-+ 0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6,
-+ 0x2071, 0x1800, 0x700c, 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010,
-+ 0x78ea, 0x7082, 0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e,
-+ 0x00fe, 0x080c, 0x26d5, 0x00f6, 0x2100, 0x900e, 0x080c, 0x268c,
-+ 0x795e, 0x00fe, 0x9186, 0x0081, 0x01f0, 0x2009, 0x0081, 0x00e0,
-+ 0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x78e7, 0x0000,
-+ 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x26d5,
-+ 0x00f6, 0x2079, 0x1800, 0x7982, 0x2100, 0x900e, 0x797e, 0x080c,
-+ 0x268c, 0x795e, 0x00fe, 0x8108, 0x080c, 0x6742, 0x2b00, 0x00ce,
-+ 0x1904, 0xbd10, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150,
-+ 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d,
-+ 0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x66f3, 0x6023, 0x0001,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x0028, 0x080c, 0xbb47, 0x2001, 0x0001, 0x0431, 0x00de, 0x009e,
-+ 0x00be, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001,
-+ 0x1848, 0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xee2e, 0x0190,
-+ 0x2071, 0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284,
-+ 0xff00, 0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110,
-+ 0xb912, 0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158, 0x2001,
-+ 0x0007, 0x080c, 0x66f3, 0x080c, 0x5852, 0x1120, 0x2001, 0x0007,
-+ 0x080c, 0x671f, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048,
-+ 0xa868, 0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6,
-+ 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c,
-+ 0x4c9f, 0x004e, 0x003e, 0x080c, 0x3344, 0x6020, 0x9086, 0x000a,
-+ 0x1108, 0x0005, 0x0804, 0xb157, 0x00b6, 0x00e6, 0x0026, 0x0016,
-+ 0x2071, 0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xbeeb, 0x2001,
-+ 0x180d, 0x2004, 0xd08c, 0x0904, 0xbe9e, 0x00d6, 0x080c, 0x778e,
-+ 0x01a0, 0x0026, 0x2011, 0x0010, 0x080c, 0x6c25, 0x002e, 0x0904,
-+ 0xbe9d, 0x080c, 0x5852, 0x1598, 0x6014, 0x2048, 0xa807, 0x0000,
-+ 0xa867, 0x0103, 0xa833, 0xdead, 0x0450, 0x6010, 0x00b6, 0x2058,
-+ 0xb910, 0x00be, 0x9186, 0x00ff, 0x0580, 0x0026, 0x2011, 0x8008,
-+ 0x080c, 0x6c25, 0x002e, 0x0548, 0x6014, 0x9005, 0x090c, 0x0d85,
-+ 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
-+ 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xd50c, 0x0040, 0x6014,
-+ 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010,
-+ 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3344, 0x080c, 0xb157, 0x001e,
-+ 0x080c, 0x341e, 0x00de, 0x0804, 0xbef0, 0x00de, 0x080c, 0x5852,
-+ 0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-+ 0xbba0, 0x2021, 0x0006, 0x080c, 0x4e56, 0x004e, 0x003e, 0x00d6,
-+ 0x6010, 0x2058, 0x080c, 0x6848, 0x080c, 0xbc73, 0x00de, 0x080c,
-+ 0xc146, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001,
-+ 0x0006, 0x080c, 0x66f3, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864,
-+ 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e,
-+ 0x2011, 0x4000, 0x080c, 0xd50c, 0x0060, 0xa864, 0x9084, 0x00ff,
-+ 0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-+ 0x0200, 0x009e, 0x080c, 0x3344, 0x6020, 0x9086, 0x000a, 0x0140,
-+ 0x080c, 0xb157, 0x0028, 0x080c, 0xbb47, 0x9006, 0x080c, 0xbe0c,
-+ 0x001e, 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1824, 0x2204,
-+ 0x9086, 0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x66f3, 0x6003,
-+ 0x0001, 0x6007, 0x0001, 0x080c, 0x960e, 0x0804, 0x9aa3, 0x2001,
-+ 0x0001, 0x0804, 0xbe0c, 0x2030, 0x2011, 0x1824, 0x2204, 0x9086,
-+ 0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007, 0x080c,
-+ 0x66f3, 0x0804, 0xb157, 0x2001, 0x0001, 0x0804, 0xbe0c, 0x0002,
-+ 0xbc30, 0xbf37, 0xbc30, 0xbf7a, 0xbc30, 0xc027, 0xbf2c, 0xbc33,
-+ 0xbc30, 0xc03b, 0xbc30, 0xc04d, 0x6604, 0x9686, 0x0003, 0x0904,
-+ 0xbe3c, 0x96b6, 0x001e, 0x1110, 0x080c, 0xb157, 0x0005, 0x00b6,
-+ 0x00d6, 0x00c6, 0x080c, 0xc05f, 0x11a0, 0x9006, 0x080c, 0x66df,
-+ 0x080c, 0x3315, 0x080c, 0xd647, 0x2001, 0x0002, 0x080c, 0x66f3,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x0428, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010,
-+ 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0180, 0x8001, 0xb842,
-+ 0x601b, 0x000a, 0x0098, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-+ 0x908e, 0x1900, 0x0158, 0x908e, 0x1e00, 0x0990, 0x080c, 0x3315,
-+ 0x080c, 0xd647, 0x2001, 0x0001, 0x080c, 0xbe0c, 0x00ce, 0x00de,
-+ 0x00be, 0x0005, 0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xc06d,
-+ 0x00d6, 0x2069, 0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058,
-+ 0xb8a0, 0x9086, 0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000,
-+ 0x206a, 0x00de, 0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x66df,
-+ 0x2001, 0x0002, 0x080c, 0x66f3, 0x6003, 0x0001, 0x6007, 0x0002,
-+ 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0804, 0xbff7, 0x080c, 0xcf08,
-+ 0x01b0, 0x6014, 0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138,
-+ 0x6007, 0x0016, 0x2001, 0x0002, 0x080c, 0xd569, 0x00b0, 0x6014,
-+ 0x2048, 0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001,
-+ 0x180e, 0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084,
-+ 0x00ff, 0x9005, 0x1110, 0x9006, 0x0c38, 0x080c, 0xbb47, 0x2009,
-+ 0x026e, 0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686,
-+ 0x000b, 0x01c8, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118,
-+ 0x9686, 0x0009, 0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009,
-+ 0x0190, 0x2001, 0x0004, 0x080c, 0x66f3, 0x2001, 0x0028, 0x601a,
-+ 0x6007, 0x0052, 0x0020, 0x2001, 0x0001, 0x080c, 0xbe0c, 0x002e,
-+ 0x00be, 0x009e, 0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048,
-+ 0x080c, 0xcf08, 0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868,
-+ 0xd0fc, 0x0108, 0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
-+ 0x9005, 0x0138, 0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016,
-+ 0x08f0, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800,
-+ 0x080c, 0x6129, 0x00ee, 0x0010, 0x080c, 0x3315, 0x0860, 0x2001,
-+ 0x0004, 0x080c, 0x66f3, 0x080c, 0xc06d, 0x1140, 0x6003, 0x0001,
-+ 0x6007, 0x0003, 0x080c, 0x960e, 0x0804, 0x9aa3, 0x080c, 0xbb47,
-+ 0x9006, 0x0804, 0xbe0c, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c,
-+ 0x66f3, 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x960e, 0x0804,
-+ 0x9aa3, 0x2001, 0x0001, 0x0804, 0xbe0c, 0x00f9, 0x1160, 0x2001,
-+ 0x000a, 0x080c, 0x66f3, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-+ 0x960e, 0x0804, 0x9aa3, 0x2001, 0x0001, 0x0804, 0xbe0c, 0x2009,
-+ 0x026e, 0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104,
-+ 0x9084, 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005,
-+ 0x00b6, 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x67bc, 0x001e,
-+ 0x00ce, 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036,
-+ 0x0016, 0x6010, 0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003,
-+ 0x200a, 0x080c, 0xc118, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd,
-+ 0x200a, 0x080c, 0x6bfd, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a,
-+ 0x080c, 0xea74, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019,
-+ 0x002a, 0x2009, 0x0001, 0x080c, 0x32da, 0x00e6, 0x2071, 0x1800,
-+ 0x080c, 0x30bf, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009,
-+ 0x007f, 0x080c, 0x341e, 0x8108, 0x1f04, 0xc0b1, 0x015e, 0x00ce,
-+ 0x080c, 0xc070, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001,
-+ 0x2001, 0x1837, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc,
-+ 0x0118, 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001,
-+ 0x1837, 0x2102, 0x9184, 0x0050, 0x9086, 0x0050, 0x05d0, 0x2079,
-+ 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181f, 0x206a, 0x78e6,
-+ 0x0006, 0x8e70, 0x2e04, 0x2069, 0x1820, 0x206a, 0x78ea, 0x7832,
-+ 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009, 0x182c,
-+ 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x26d5, 0x080c,
-+ 0x778e, 0x0170, 0x2071, 0x0260, 0x2069, 0x1982, 0x7048, 0x206a,
-+ 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c, 0xd335,
-+ 0x0040, 0x2001, 0x0006, 0x080c, 0x66f3, 0x080c, 0x3344, 0x080c,
-+ 0xb157, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005,
-+ 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182c, 0x231c,
-+ 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff, 0x7004,
-+ 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276, 0x20a9,
-+ 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xc20d, 0x1148, 0x2011,
-+ 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xc20d, 0x1100,
-+ 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6, 0x2071,
-+ 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086, 0x0800,
-+ 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086, 0x0100,
-+ 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010,
-+ 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076,
-+ 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2029,
-+ 0x19f4, 0x252c, 0x2021, 0x19fb, 0x2424, 0x2061, 0x1ddc, 0x2071,
-+ 0x1800, 0x7254, 0x7074, 0x9202, 0x1a04, 0xc1d9, 0x080c, 0x8ede,
-+ 0x0904, 0xc1d2, 0x080c, 0xeaa5, 0x0904, 0xc1d2, 0x6720, 0x9786,
-+ 0x0007, 0x0904, 0xc1d2, 0x2500, 0x9c06, 0x0904, 0xc1d2, 0x2400,
-+ 0x9c06, 0x0904, 0xc1d2, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010,
-+ 0x9005, 0x0130, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1590,
-+ 0x00c6, 0x6043, 0xffff, 0x6000, 0x9086, 0x0004, 0x1110, 0x080c,
-+ 0x1ad3, 0x9786, 0x000a, 0x0148, 0x080c, 0xd11f, 0x1130, 0x00ce,
-+ 0x080c, 0xbb47, 0x080c, 0xb192, 0x00e8, 0x6014, 0x2048, 0x080c,
-+ 0xcf08, 0x01a8, 0x9786, 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c,
-+ 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x100b, 0x009e,
-+ 0xab7a, 0xa877, 0x0000, 0x080c, 0x6ff6, 0x080c, 0xd0f9, 0x080c,
-+ 0xb192, 0x00ce, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1210, 0x0804,
-+ 0xc179, 0x012e, 0x000e, 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce,
-+ 0x009e, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1118, 0x080c, 0xea17,
-+ 0x0c30, 0x9786, 0x0009, 0x1148, 0x6000, 0x9086, 0x0004, 0x0d08,
-+ 0x2009, 0x004c, 0x080c, 0xb1f5, 0x08e0, 0x9786, 0x000a, 0x0980,
-+ 0x0820, 0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04,
-+ 0xc1f9, 0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001,
-+ 0x0008, 0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016,
-+ 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0,
-+ 0x9300, 0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e,
-+ 0x1140, 0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e,
-+ 0x0005, 0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001,
-+ 0x0000, 0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c,
-+ 0x810f, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xc237,
-+ 0x9006, 0x0005, 0x918d, 0x0001, 0x0005, 0x6004, 0x908a, 0x0053,
-+ 0x1a0c, 0x0d85, 0x080c, 0xd10e, 0x0120, 0x080c, 0xd11f, 0x0158,
-+ 0x0028, 0x080c, 0x3344, 0x080c, 0xd11f, 0x0128, 0x080c, 0x99dd,
-+ 0x080c, 0xb157, 0x0005, 0x080c, 0xbb47, 0x0cc0, 0x9182, 0x0057,
-+ 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xc27d, 0xc27d,
-+ 0xc27d, 0xc27d, 0xc27d, 0xc27d, 0xc27d, 0xc27d, 0xc27d, 0xc27d,
-+ 0xc27d, 0xc27f, 0xc27f, 0xc27f, 0xc27f, 0xc27d, 0xc27d, 0xc27d,
-+ 0xc27f, 0xc27d, 0xc27d, 0xc27d, 0xc27d, 0x080c, 0x0d85, 0x600b,
-+ 0xffff, 0x6003, 0x000f, 0x6106, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xd64a, 0x2009, 0x8000, 0x080c, 0x9607, 0x012e, 0x0005, 0x9186,
-+ 0x0013, 0x1128, 0x6004, 0x9082, 0x0040, 0x0804, 0xc307, 0x9186,
-+ 0x0027, 0x1520, 0x080c, 0x99dd, 0x080c, 0x3315, 0x080c, 0xd647,
-+ 0x0096, 0x6114, 0x2148, 0x080c, 0xcf08, 0x0198, 0x080c, 0xd11f,
-+ 0x1118, 0x080c, 0xbb47, 0x0068, 0xa867, 0x0103, 0xa87b, 0x0029,
-+ 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x7002, 0x080c,
-+ 0xd0f9, 0x009e, 0x080c, 0xb157, 0x0804, 0x9aa3, 0x9186, 0x0014,
-+ 0x1120, 0x6004, 0x9082, 0x0040, 0x0030, 0x9186, 0x0053, 0x0110,
-+ 0x080c, 0x0d85, 0x0005, 0x0002, 0xc2e5, 0xc2e3, 0xc2e3, 0xc2e3,
-+ 0xc2e3, 0xc2e3, 0xc2e3, 0xc2e3, 0xc2e3, 0xc2e3, 0xc2e3, 0xc2fe,
-+ 0xc2fe, 0xc2fe, 0xc2fe, 0xc2e3, 0xc2fe, 0xc2e3, 0xc2fe, 0xc2e3,
-+ 0xc2e3, 0xc2e3, 0xc2e3, 0x080c, 0x0d85, 0x080c, 0x99dd, 0x0096,
-+ 0x6114, 0x2148, 0x080c, 0xcf08, 0x0168, 0xa867, 0x0103, 0xa87b,
-+ 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x7002,
-+ 0x080c, 0xd0f9, 0x009e, 0x080c, 0xb157, 0x0005, 0x080c, 0x99dd,
-+ 0x080c, 0xd11f, 0x090c, 0xbb47, 0x080c, 0xb157, 0x0005, 0x0002,
-+ 0xc321, 0xc31f, 0xc31f, 0xc31f, 0xc31f, 0xc31f, 0xc31f, 0xc31f,
-+ 0xc31f, 0xc31f, 0xc31f, 0xc323, 0xc323, 0xc323, 0xc323, 0xc31f,
-+ 0xc325, 0xc31f, 0xc323, 0xc31f, 0xc31f, 0xc31f, 0xc31f, 0x080c,
-+ 0x0d85, 0x080c, 0x0d85, 0x080c, 0x0d85, 0x080c, 0xb157, 0x0804,
-+ 0x9aa3, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
-+ 0x0005, 0xc348, 0xc348, 0xc348, 0xc348, 0xc348, 0xc381, 0xc473,
-+ 0xc348, 0xc47f, 0xc348, 0xc348, 0xc348, 0xc348, 0xc348, 0xc348,
-+ 0xc348, 0xc348, 0xc348, 0xc348, 0xc47f, 0xc34a, 0xc348, 0xc47d,
-+ 0x080c, 0x0d85, 0x00b6, 0x0096, 0x6114, 0x2148, 0x6010, 0x2058,
-+ 0xb800, 0xd0bc, 0x1508, 0xa87b, 0x0000, 0xa867, 0x0103, 0xa877,
-+ 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-+ 0xc504, 0x080c, 0x6e17, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110,
-+ 0x8211, 0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c, 0x68d8, 0x080c,
-+ 0xb157, 0x009e, 0x00be, 0x0005, 0xa87c, 0xd0ac, 0x09e0, 0xa838,
-+ 0xa934, 0x9105, 0x09c0, 0xa880, 0xd0bc, 0x19a8, 0x080c, 0xd254,
-+ 0x0c80, 0x00b6, 0x0096, 0x6114, 0x2148, 0x601c, 0xd0fc, 0x1110,
-+ 0x7644, 0x0008, 0x9036, 0x96b4, 0x0fff, 0x86ff, 0x1590, 0x6010,
-+ 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc462, 0xa87b, 0x0000, 0xa867,
-+ 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-+ 0x190c, 0xc504, 0x080c, 0x6e17, 0x6210, 0x2258, 0xba3c, 0x82ff,
-+ 0x0110, 0x8211, 0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c, 0x68d8,
-+ 0x601c, 0xd0fc, 0x1148, 0x7044, 0xd0e4, 0x1904, 0xc443, 0x080c,
-+ 0xb157, 0x009e, 0x00be, 0x0005, 0x2009, 0x0211, 0x210c, 0x080c,
-+ 0x0d85, 0x968c, 0x0c00, 0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc,
-+ 0x1904, 0xc447, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff,
-+ 0x9186, 0x0002, 0x0508, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c,
-+ 0x00e8, 0xd6dc, 0x01a0, 0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170,
-+ 0xa938, 0xaa34, 0x2100, 0x9205, 0x0148, 0x7048, 0x9106, 0x1118,
-+ 0x704c, 0x9206, 0x0118, 0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4,
-+ 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xa867, 0x0103,
-+ 0xae76, 0x901e, 0xd6c4, 0x01d8, 0x9686, 0x0100, 0x1130, 0x7064,
-+ 0x9005, 0x1118, 0xc6c4, 0x0804, 0xc38d, 0x735c, 0xab86, 0x83ff,
-+ 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308,
-+ 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xca66, 0x003e, 0xd6cc,
-+ 0x0904, 0xc3a2, 0x7154, 0xa98a, 0x81ff, 0x0904, 0xc3a2, 0x9192,
-+ 0x0021, 0x1278, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c,
-+ 0xca66, 0x2011, 0x0205, 0x2013, 0x0000, 0x080c, 0xd5d5, 0x0804,
-+ 0xc3a2, 0xa868, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50,
-+ 0x00a6, 0x2950, 0x080c, 0xca05, 0x00ae, 0x080c, 0xd5d5, 0x080c,
-+ 0xca56, 0x0804, 0xc3a4, 0x080c, 0xd217, 0x0804, 0xc3b9, 0xa87c,
-+ 0xd0ac, 0x0904, 0xc3ca, 0xa880, 0xd0bc, 0x1904, 0xc3ca, 0x9684,
-+ 0x0400, 0x0130, 0xa838, 0xab34, 0x9305, 0x0904, 0xc3ca, 0x00b8,
-+ 0x7348, 0xa838, 0x9306, 0x1198, 0x734c, 0xa834, 0x931e, 0x0904,
-+ 0xc3ca, 0x0068, 0xa87c, 0xd0ac, 0x0904, 0xc395, 0xa838, 0xa934,
-+ 0x9105, 0x0904, 0xc395, 0xa880, 0xd0bc, 0x1904, 0xc395, 0x080c,
-+ 0xd254, 0x0804, 0xc3b9, 0x00f6, 0x2079, 0x026c, 0x7c04, 0x7b00,
-+ 0x7e0c, 0x7d08, 0x00fe, 0x0021, 0x0005, 0x0011, 0x0005, 0x0005,
-+ 0x0096, 0x6003, 0x0002, 0x6007, 0x0043, 0x6014, 0x2048, 0xa87c,
-+ 0xd0ac, 0x0128, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400,
-+ 0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500,
-+ 0x9203, 0x0e90, 0xac46, 0xab4a, 0xae36, 0xad3a, 0x6044, 0xd0fc,
-+ 0x190c, 0xad15, 0x604b, 0x0000, 0x080c, 0x1c9c, 0x1118, 0x6144,
-+ 0x080c, 0x9633, 0x009e, 0x0005, 0x9182, 0x0057, 0x1220, 0x9182,
-+ 0x0040, 0x0208, 0x000a, 0x0005, 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cb,
-+ 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cd, 0xc4cb,
-+ 0xc4cb, 0xc4cb, 0xc4cb, 0xc4de, 0xc4cb, 0xc4cb, 0xc4cb, 0xc4cb,
-+ 0xc502, 0xc4cb, 0xc4cb, 0x080c, 0x0d85, 0x6004, 0x9086, 0x0040,
-+ 0x1110, 0x080c, 0x99dd, 0x2019, 0x0001, 0x080c, 0xa586, 0x6003,
-+ 0x0002, 0x080c, 0xd64f, 0x080c, 0x9a38, 0x0005, 0x6004, 0x9086,
-+ 0x0040, 0x1110, 0x080c, 0x99dd, 0x2019, 0x0001, 0x080c, 0xa586,
-+ 0x080c, 0x9a38, 0x080c, 0x3315, 0x080c, 0xd647, 0x0096, 0x6114,
-+ 0x2148, 0x080c, 0xcf08, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029,
-+ 0xa877, 0x0000, 0x080c, 0x7002, 0x080c, 0xd0f9, 0x009e, 0x080c,
-+ 0xb157, 0x0005, 0x080c, 0x0d85, 0xa87b, 0x0015, 0xd1fc, 0x0180,
-+ 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006,
-+ 0x0016, 0x2009, 0x1a7c, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e,
-+ 0xa992, 0xa88e, 0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
-+ 0x0208, 0x000a, 0x0005, 0xc53a, 0xc53a, 0xc53a, 0xc53a, 0xc53a,
-+ 0xc53c, 0xc53a, 0xc53a, 0xc5f9, 0xc53a, 0xc53a, 0xc53a, 0xc53a,
-+ 0xc53a, 0xc53a, 0xc53a, 0xc53a, 0xc53a, 0xc53a, 0xc739, 0xc53a,
-+ 0xc743, 0xc53a, 0x080c, 0x0d85, 0x601c, 0xd0bc, 0x0178, 0xd084,
-+ 0x0168, 0xd0f4, 0x0120, 0xc084, 0x601e, 0x0804, 0xc329, 0x6114,
-+ 0x0096, 0x2148, 0xa87c, 0xc0e5, 0xa87e, 0x009e, 0x0076, 0x00a6,
-+ 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114, 0x2150, 0x601c, 0xd0fc,
-+ 0x1110, 0x7644, 0x0008, 0x9036, 0xb676, 0x96b4, 0x0fff, 0xb77c,
-+ 0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110,
-+ 0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904, 0xc5f2, 0x9694, 0xff00,
-+ 0x9284, 0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284,
-+ 0x0300, 0x0904, 0xc5f2, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005,
-+ 0x1118, 0xc6c4, 0xb676, 0x0c38, 0x080c, 0x1059, 0x090c, 0x0d85,
-+ 0x2900, 0xb07a, 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103,
-+ 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084,
-+ 0xf000, 0x9635, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92,
-+ 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186,
-+ 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b,
-+ 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
-+ 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4,
-+ 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210,
-+ 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025,
-+ 0x080c, 0xca66, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff,
-+ 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011,
-+ 0x0029, 0x080c, 0xca66, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050,
-+ 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950,
-+ 0x080c, 0xca05, 0x080c, 0x1a9f, 0x009e, 0x00ee, 0x00ae, 0x007e,
-+ 0x0005, 0x2001, 0x1988, 0x2004, 0x604a, 0x0096, 0x6114, 0x2148,
-+ 0xa83c, 0xa940, 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003,
-+ 0x0002, 0x080c, 0xd658, 0x0904, 0xc734, 0x604b, 0x0000, 0x6010,
-+ 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904,
-+ 0xc6f8, 0xa978, 0xa868, 0xd0fc, 0x0904, 0xc6b9, 0x0016, 0xa87c,
-+ 0x0006, 0xa880, 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff,
-+ 0x90b6, 0x0002, 0x0904, 0xc686, 0x9086, 0x0028, 0x1904, 0xc672,
-+ 0xa87b, 0x001c, 0xb07b, 0x001c, 0x0804, 0xc68e, 0x6024, 0xd0f4,
-+ 0x11d0, 0xa838, 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206,
-+ 0x1120, 0xa88c, 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148,
-+ 0xa9ac, 0xa834, 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e,
-+ 0x6024, 0xc0f5, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000,
-+ 0xb83e, 0x00be, 0x601c, 0xc0fc, 0x601e, 0x9006, 0xa876, 0xa892,
-+ 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e,
-+ 0x0096, 0xa878, 0x2048, 0x080c, 0x100b, 0x009e, 0x080c, 0xd254,
-+ 0x0804, 0xc734, 0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015,
-+ 0x080c, 0xd4f5, 0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4,
-+ 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac,
-+ 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc504, 0xa87c, 0xb07e,
-+ 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080,
-+ 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06, 0x8006, 0x8007, 0x9094,
-+ 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080, 0x0019, 0x2098, 0x4003,
-+ 0x00ae, 0x000e, 0xa882, 0x000e, 0xc0cc, 0xa87e, 0x080c, 0xd5d5,
-+ 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x100b, 0x001e, 0x0804,
-+ 0xc725, 0x0016, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6,
-+ 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128, 0xa87b, 0x001c, 0xb07b,
-+ 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015,
-+ 0x080c, 0xd4f5, 0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4,
-+ 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac,
-+ 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc504, 0xa890, 0xb092,
-+ 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae, 0x080c, 0x100b, 0x009e,
-+ 0x080c, 0xd5d5, 0xa974, 0x0016, 0x080c, 0xca56, 0x001e, 0x0468,
-+ 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01b0,
-+ 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00d0, 0xd1dc, 0x0148,
-+ 0xa87b, 0x0015, 0x080c, 0xd4f5, 0x0118, 0xa974, 0xc1dc, 0xa976,
-+ 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0050, 0xa87b, 0x0000,
-+ 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc504,
-+ 0xa974, 0x0016, 0x080c, 0x6e17, 0x001e, 0x6010, 0x00b6, 0x2058,
-+ 0xba3c, 0xb8d0, 0x0016, 0x9005, 0x190c, 0x68d8, 0x001e, 0x00be,
-+ 0xd1e4, 0x1120, 0x080c, 0xb157, 0x009e, 0x0005, 0x080c, 0xd217,
-+ 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0x080c, 0xd658, 0x190c,
-+ 0x1abf, 0x009e, 0x0005, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940,
-+ 0x9105, 0x01e8, 0xa877, 0x0000, 0xa87b, 0x0000, 0xa867, 0x0103,
-+ 0x00b6, 0x6010, 0x2058, 0xa834, 0xa938, 0x9115, 0x11a0, 0x080c,
-+ 0x6e17, 0xba3c, 0x8211, 0x0208, 0xba3e, 0xb8d0, 0x9005, 0x0110,
-+ 0x080c, 0x68d8, 0x080c, 0xb157, 0x00be, 0x009e, 0x0005, 0xa87c,
-+ 0xc0dc, 0xa87e, 0x08f8, 0xb800, 0xd0bc, 0x1120, 0xa834, 0x080c,
-+ 0xc504, 0x0c28, 0xa880, 0xd0bc, 0x1dc8, 0x080c, 0xd254, 0x0c60,
-+ 0x080c, 0x99dd, 0x0010, 0x080c, 0x9a38, 0x601c, 0xd084, 0x0110,
-+ 0x080c, 0x1ad3, 0x080c, 0xcf08, 0x01f0, 0x0096, 0x6114, 0x2148,
-+ 0x080c, 0xd11f, 0x1118, 0x080c, 0xbb47, 0x00a0, 0xa867, 0x0103,
-+ 0x2009, 0x180c, 0x210c, 0xd18c, 0x1198, 0xd184, 0x1170, 0x6108,
-+ 0xa97a, 0x918e, 0x0029, 0x1110, 0x080c, 0xedc6, 0xa877, 0x0000,
-+ 0x080c, 0x7002, 0x009e, 0x0804, 0xb192, 0xa87b, 0x0004, 0x0cb0,
-+ 0xa87b, 0x0004, 0x0c98, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
-+ 0x0208, 0x000a, 0x0005, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca,
-+ 0xc7cc, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca,
-+ 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7ca, 0xc7f0,
-+ 0xc7ca, 0xc7ca, 0x080c, 0x0d85, 0x080c, 0x5846, 0x01f8, 0x6014,
-+ 0x7144, 0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294,
-+ 0x00ff, 0x0096, 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086,
-+ 0x0139, 0x0128, 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897,
-+ 0x4000, 0xa99a, 0xaa9e, 0x080c, 0x7002, 0x009e, 0x0804, 0xb157,
-+ 0x080c, 0x5846, 0x0dd8, 0x6014, 0x900e, 0x9016, 0x0c10, 0x9182,
-+ 0x0085, 0x0002, 0xc809, 0xc807, 0xc807, 0xc815, 0xc807, 0xc807,
-+ 0xc807, 0xc807, 0xc807, 0xc807, 0xc807, 0xc807, 0xc807, 0x080c,
-+ 0x0d85, 0x6003, 0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009,
-+ 0x8020, 0x080c, 0x9607, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6,
-+ 0x00e6, 0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xcef6,
-+ 0x01f8, 0x2268, 0x6800, 0x9086, 0x0000, 0x01d0, 0x6010, 0x6d10,
-+ 0x952e, 0x11b0, 0x00c6, 0x2d60, 0x00d6, 0x080c, 0xcac7, 0x00de,
-+ 0x00ce, 0x0158, 0x702c, 0xd084, 0x1118, 0x080c, 0xca91, 0x0010,
-+ 0x6803, 0x0002, 0x6007, 0x0086, 0x0028, 0x080c, 0xcab3, 0x0d90,
-+ 0x6007, 0x0087, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607,
-+ 0x7220, 0x080c, 0xcef6, 0x0178, 0x6810, 0x00b6, 0x2058, 0xb800,
-+ 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2d60,
-+ 0x080c, 0xd254, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e, 0x0005,
-+ 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d85,
-+ 0x908a, 0x0092, 0x1a0c, 0x0d85, 0x9082, 0x0085, 0x00e2, 0x9186,
-+ 0x0027, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d85, 0x080c, 0x99dd,
-+ 0x0096, 0x6014, 0x2048, 0x080c, 0xcf08, 0x0140, 0xa867, 0x0103,
-+ 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x7002, 0x009e, 0x080c,
-+ 0xb192, 0x0804, 0x9aa3, 0xc898, 0xc89a, 0xc89a, 0xc898, 0xc898,
-+ 0xc898, 0xc898, 0xc898, 0xc898, 0xc898, 0xc898, 0xc898, 0xc898,
-+ 0x080c, 0x0d85, 0x080c, 0xb192, 0x0005, 0x9186, 0x0013, 0x1130,
-+ 0x6004, 0x9082, 0x0085, 0x2008, 0x0804, 0xc8e9, 0x9186, 0x0027,
-+ 0x1558, 0x080c, 0x99dd, 0x080c, 0x3315, 0x080c, 0xd647, 0x0096,
-+ 0x6014, 0x2048, 0x080c, 0xcf08, 0x0150, 0xa867, 0x0103, 0xa877,
-+ 0x0000, 0xa87b, 0x0029, 0x080c, 0x7002, 0x080c, 0xd0f9, 0x009e,
-+ 0x080c, 0xb157, 0x0005, 0x9186, 0x0089, 0x0118, 0x9186, 0x008a,
-+ 0x1140, 0x080c, 0xaf4c, 0x0128, 0x9086, 0x000c, 0x0904, 0xc921,
-+ 0x0000, 0x080c, 0xb212, 0x0c70, 0x9186, 0x0014, 0x1d60, 0x080c,
-+ 0x99dd, 0x0096, 0x6014, 0x2048, 0x080c, 0xcf08, 0x0d00, 0xa867,
-+ 0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882,
-+ 0x0890, 0x0002, 0xc8f9, 0xc8f7, 0xc8f7, 0xc8f7, 0xc8f7, 0xc8f7,
-+ 0xc90d, 0xc8f7, 0xc8f7, 0xc8f7, 0xc8f7, 0xc8f7, 0xc8f7, 0x080c,
-+ 0x0d85, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-+ 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987,
-+ 0x2004, 0x601a, 0x6003, 0x000c, 0x0005, 0x6034, 0x908c, 0xff00,
-+ 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001,
-+ 0x1986, 0x0010, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x000e,
-+ 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x0012,
-+ 0x0804, 0xb212, 0xc937, 0xc937, 0xc937, 0xc937, 0xc939, 0xc986,
-+ 0xc937, 0xc937, 0xc937, 0xc937, 0xc937, 0xc937, 0xc937, 0x080c,
-+ 0x0d85, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-+ 0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-+ 0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xc99a, 0x080c, 0xcf08,
-+ 0x1118, 0x080c, 0xd0f9, 0x0068, 0x6014, 0x2048, 0x080c, 0xd65e,
-+ 0x1110, 0x080c, 0xd0f9, 0xa867, 0x0103, 0x080c, 0xd612, 0x080c,
-+ 0x7002, 0x00d6, 0x2c68, 0x080c, 0xb101, 0x01d0, 0x6003, 0x0001,
-+ 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e, 0x210c, 0x613a,
-+ 0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112, 0x080c, 0xd3a3,
-+ 0x695c, 0x615e, 0x6023, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607,
-+ 0x2d60, 0x00de, 0x080c, 0xb157, 0x009e, 0x0005, 0x6010, 0x00b6,
-+ 0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00,
-+ 0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e, 0x0118, 0x9186,
-+ 0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xd5a8, 0x11f0, 0x080c,
-+ 0xb101, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023, 0x0001, 0x6910,
-+ 0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff,
-+ 0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x695c, 0x615e, 0x080c,
-+ 0xd3a3, 0x2009, 0x8020, 0x080c, 0x9607, 0x2d60, 0x00de, 0x0804,
-+ 0xb157, 0x0096, 0x6014, 0x2048, 0x080c, 0xcf08, 0x01c8, 0xa867,
-+ 0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006,
-+ 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005,
-+ 0x080c, 0xd213, 0xa877, 0x0000, 0x080c, 0x7002, 0x080c, 0xd0f9,
-+ 0x009e, 0x0804, 0xb157, 0x0016, 0x0096, 0x6014, 0x2048, 0x080c,
-+ 0xcf08, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000,
-+ 0x080c, 0x7002, 0x009e, 0x001e, 0x9186, 0x0013, 0x0158, 0x9186,
-+ 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xb212, 0x0020,
-+ 0x080c, 0x99dd, 0x080c, 0xb192, 0x0005, 0x0056, 0x0066, 0x0096,
-+ 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010, 0x2009,
-+ 0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020, 0x2011,
-+ 0x0029, 0x080c, 0xca66, 0x96b2, 0x0020, 0xb004, 0x904d, 0x0110,
-+ 0x080c, 0x100b, 0x080c, 0x1059, 0x0520, 0x8528, 0xa867, 0x0110,
-+ 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228, 0x2608,
-+ 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c,
-+ 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205, 0x2003,
-+ 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000,
-+ 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
-+ 0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff,
-+ 0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c, 0x7002,
-+ 0x2a48, 0x0cb8, 0x080c, 0x7002, 0x00ae, 0x0005, 0x00f6, 0x2079,
-+ 0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108, 0x8108,
-+ 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0,
-+ 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318, 0x9386,
-+ 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814, 0x8000,
-+ 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe,
-+ 0x0005, 0x6920, 0x9186, 0x0003, 0x0118, 0x9186, 0x0002, 0x11d0,
-+ 0x00c6, 0x00d6, 0x00e6, 0x2d60, 0x0096, 0x6014, 0x2048, 0x080c,
-+ 0xcf08, 0x0150, 0x2001, 0x0006, 0xa980, 0xc1d5, 0x080c, 0x724e,
-+ 0x080c, 0x6ff6, 0x080c, 0xd0f9, 0x009e, 0x080c, 0xb192, 0x00ee,
-+ 0x00de, 0x00ce, 0x0005, 0x00c6, 0x702c, 0xd084, 0x1170, 0x6008,
-+ 0x2060, 0x6020, 0x9086, 0x0002, 0x1140, 0x6104, 0x9186, 0x0085,
-+ 0x0118, 0x9186, 0x008b, 0x1108, 0x9006, 0x00ce, 0x0005, 0x0066,
-+ 0x0126, 0x2091, 0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f,
-+ 0x0083, 0x012e, 0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066,
-+ 0x2031, 0x0000, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e,
-+ 0x0005, 0xcb15, 0xcb15, 0xcb10, 0xcb39, 0xcaf1, 0xcb10, 0xcaf3,
-+ 0xcb10, 0xcb10, 0x9448, 0xcb10, 0xcb10, 0xcb10, 0xcaf1, 0xcaf1,
-+ 0xcaf1, 0x080c, 0x0d85, 0x6010, 0x9080, 0x0000, 0x2004, 0xd0bc,
-+ 0x190c, 0xcb39, 0x0036, 0x6014, 0x0096, 0x2048, 0xa880, 0x009e,
-+ 0xd0cc, 0x0118, 0x2019, 0x000c, 0x0038, 0xd094, 0x0118, 0x2019,
-+ 0x000d, 0x0010, 0x2019, 0x0010, 0x080c, 0xe55f, 0x003e, 0x0005,
-+ 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff, 0x11e8,
-+ 0x6014, 0x2048, 0x080c, 0xcf08, 0x01d0, 0x6043, 0xffff, 0xa864,
-+ 0x9086, 0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028,
-+ 0x900e, 0x2001, 0x0005, 0x080c, 0x724e, 0x080c, 0xd213, 0x080c,
-+ 0x6ff6, 0x080c, 0xb192, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006,
-+ 0x0ce0, 0x080c, 0xacec, 0x080c, 0xd66c, 0x6000, 0x908a, 0x0010,
-+ 0x1a0c, 0x0d85, 0x002b, 0x0106, 0x080c, 0xad08, 0x010e, 0x0005,
-+ 0xcb58, 0xcb88, 0xcb5a, 0xcbaf, 0xcb83, 0xcb58, 0xcb10, 0xcb15,
-+ 0xcb15, 0xcb10, 0xcb10, 0xcb10, 0xcb10, 0xcb10, 0xcb10, 0xcb10,
-+ 0x080c, 0x0d85, 0x86ff, 0x1520, 0x6020, 0x9086, 0x0006, 0x0500,
-+ 0x0096, 0x6014, 0x2048, 0x080c, 0xcf08, 0x0168, 0xa87c, 0xd0cc,
-+ 0x0140, 0x0096, 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x100b,
-+ 0x009e, 0x080c, 0xd213, 0x009e, 0x080c, 0xd5ec, 0x6007, 0x0085,
-+ 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x95e9,
-+ 0x9085, 0x0001, 0x0005, 0x0066, 0x080c, 0x1ad3, 0x006e, 0x0890,
-+ 0x00e6, 0x2071, 0x19e8, 0x7030, 0x9c06, 0x1120, 0x080c, 0xa506,
-+ 0x00ee, 0x0840, 0x6020, 0x9084, 0x000f, 0x9086, 0x0006, 0x1150,
-+ 0x0086, 0x0096, 0x2049, 0x0001, 0x2c40, 0x080c, 0xa657, 0x009e,
-+ 0x008e, 0x0040, 0x0066, 0x080c, 0xa402, 0x190c, 0x0d85, 0x080c,
-+ 0xa410, 0x006e, 0x00ee, 0x1904, 0xcb5a, 0x0804, 0xcb10, 0x0036,
-+ 0x00e6, 0x2071, 0x19e8, 0x704c, 0x9c06, 0x1138, 0x901e, 0x080c,
-+ 0xa586, 0x00ee, 0x003e, 0x0804, 0xcb5a, 0x080c, 0xa791, 0x00ee,
-+ 0x003e, 0x1904, 0xcb5a, 0x0804, 0xcb10, 0x00c6, 0x0066, 0x6020,
-+ 0x9084, 0x000f, 0x001b, 0x006e, 0x00ce, 0x0005, 0xcbe5, 0xcccf,
-+ 0xce3d, 0xcbed, 0xb192, 0xcbe5, 0xe555, 0xd654, 0xcccf, 0x940f,
-+ 0xcec9, 0xcbde, 0xcbde, 0xcbde, 0xcbde, 0xcbde, 0x080c, 0x0d85,
-+ 0x080c, 0xd11f, 0x1110, 0x080c, 0xbb47, 0x0005, 0x080c, 0x99dd,
-+ 0x0804, 0xb157, 0x601b, 0x0001, 0x0005, 0x080c, 0xcf08, 0x0130,
-+ 0x6014, 0x0096, 0x2048, 0x2c00, 0xa896, 0x009e, 0x080c, 0xacec,
-+ 0x080c, 0xd66c, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x0013,
-+ 0x0804, 0xad08, 0xcc12, 0xcc14, 0xcc3e, 0xcc52, 0xcc7f, 0xcc12,
-+ 0xcbe5, 0xcbe5, 0xcbe5, 0xcc59, 0xcc59, 0xcc12, 0xcc12, 0xcc12,
-+ 0xcc12, 0xcc63, 0x080c, 0x0d85, 0x00e6, 0x6014, 0x0096, 0x2048,
-+ 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19e8, 0x7030, 0x9c06,
-+ 0x01d0, 0x0066, 0x080c, 0xa402, 0x190c, 0x0d85, 0x080c, 0xa410,
-+ 0x006e, 0x080c, 0xd5ec, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-+ 0x0002, 0x2001, 0x1987, 0x2004, 0x601a, 0x2009, 0x8020, 0x080c,
-+ 0x95e9, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8, 0x0096, 0x6014,
-+ 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c, 0xd5ec, 0x6007,
-+ 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c,
-+ 0x95e9, 0x0005, 0x080c, 0xacec, 0x080c, 0xaece, 0x080c, 0xad08,
-+ 0x0c28, 0x0096, 0x601b, 0x0001, 0x6014, 0x2048, 0xa880, 0xc0b5,
-+ 0xa882, 0x009e, 0x0005, 0x080c, 0x5846, 0x01b8, 0x6014, 0x0096,
-+ 0x904d, 0x0190, 0xa864, 0xa867, 0x0103, 0xa87b, 0x0006, 0x9086,
-+ 0x0139, 0x1150, 0xa867, 0x0139, 0xa87b, 0x0030, 0xa897, 0x4005,
-+ 0xa89b, 0x0004, 0x080c, 0x7002, 0x009e, 0x0804, 0xb157, 0x6014,
-+ 0x0096, 0x904d, 0x0904, 0xccca, 0xa97c, 0xd1e4, 0x1160, 0x611c,
-+ 0xd1fc, 0x0904, 0xccca, 0x6110, 0x00b6, 0x2158, 0xb93c, 0x8109,
-+ 0x0208, 0xb93e, 0x00be, 0x080c, 0xad08, 0x2001, 0x180f, 0x2004,
-+ 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884, 0x009e, 0x8003, 0x800b,
-+ 0x810b, 0x9108, 0x611a, 0x2001, 0x0030, 0x2c08, 0x080c, 0x16b9,
-+ 0x2001, 0x030c, 0x2004, 0x9086, 0x0041, 0x1198, 0x6014, 0x0096,
-+ 0x904d, 0x090c, 0x0d85, 0xa880, 0xd0f4, 0x1130, 0xc0f5, 0xa882,
-+ 0x009e, 0x601b, 0x0002, 0x0068, 0x009e, 0x00c6, 0x080c, 0x2185,
-+ 0x00ce, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009, 0x0048, 0x080c,
-+ 0xb1f5, 0x0005, 0x009e, 0x080c, 0x1ad3, 0x0804, 0xcc3e, 0x6000,
-+ 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x000b, 0x0005, 0xcce6, 0xcbea,
-+ 0xcce8, 0xcce6, 0xcce8, 0xcce8, 0xcbe6, 0xcce6, 0xcbe0, 0xcbe0,
-+ 0xcce6, 0xcce6, 0xcce6, 0xcce6, 0xcce6, 0xcce6, 0x080c, 0x0d85,
-+ 0x6010, 0x00b6, 0x2058, 0xb804, 0x9084, 0x00ff, 0x00be, 0x908a,
-+ 0x000c, 0x1a0c, 0x0d85, 0x00b6, 0x0013, 0x00be, 0x0005, 0xcd03,
-+ 0xcdd4, 0xcd05, 0xcd45, 0xcd05, 0xcd45, 0xcd05, 0xcd13, 0xcd03,
-+ 0xcd45, 0xcd03, 0xcd34, 0x080c, 0x0d85, 0x6004, 0x908e, 0x0016,
-+ 0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e, 0x0002, 0x0590, 0x908e,
-+ 0x0052, 0x0904, 0xcdd0, 0x6004, 0x080c, 0xd11f, 0x0904, 0xcded,
-+ 0x908e, 0x0004, 0x1110, 0x080c, 0x3344, 0x908e, 0x0021, 0x0904,
-+ 0xcdf1, 0x908e, 0x0022, 0x0904, 0xce38, 0x908e, 0x003d, 0x0904,
-+ 0xcdf1, 0x908e, 0x0039, 0x0904, 0xcdf5, 0x908e, 0x0035, 0x0904,
-+ 0xcdf5, 0x908e, 0x001e, 0x0178, 0x908e, 0x0001, 0x1140, 0x6010,
-+ 0x2058, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0110, 0x080c,
-+ 0x3315, 0x080c, 0xbb47, 0x0804, 0xb192, 0x00c6, 0x00d6, 0x6104,
-+ 0x9186, 0x0016, 0x0904, 0xcdc1, 0x9186, 0x0002, 0x1904, 0xcd96,
-+ 0x2001, 0x1837, 0x2004, 0xd08c, 0x11c8, 0x080c, 0x778e, 0x11b0,
-+ 0x080c, 0xd632, 0x0138, 0x080c, 0x77b1, 0x1120, 0x080c, 0x7697,
-+ 0x0804, 0xce21, 0x2001, 0x197d, 0x2003, 0x0001, 0x2001, 0x1800,
-+ 0x2003, 0x0001, 0x080c, 0x76bd, 0x0804, 0xce21, 0x6010, 0x2058,
-+ 0xb8a0, 0x9086, 0x0080, 0x0130, 0x2001, 0x1837, 0x2004, 0xd0ac,
-+ 0x1904, 0xce21, 0xb8a0, 0x9082, 0x0081, 0x1a04, 0xce21, 0xb840,
-+ 0x9084, 0x00ff, 0x9005, 0x0190, 0x8001, 0xb842, 0x6017, 0x0000,
-+ 0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x080c, 0xb101,
-+ 0x0128, 0x2b00, 0x6012, 0x6023, 0x0001, 0x0458, 0x00de, 0x00ce,
-+ 0x6004, 0x908e, 0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086,
-+ 0x007e, 0x1170, 0x2009, 0x1837, 0x2104, 0xc085, 0x200a, 0x00e6,
-+ 0x2071, 0x1800, 0x080c, 0x6129, 0x00ee, 0x080c, 0xbb47, 0x0030,
-+ 0x080c, 0xbb47, 0x080c, 0x3315, 0x080c, 0xd647, 0x00e6, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0x3344, 0x012e, 0x00ee, 0x080c, 0xb192,
-+ 0x0005, 0x2001, 0x0002, 0x080c, 0x66f3, 0x6003, 0x0001, 0x6007,
-+ 0x0002, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x00de, 0x00ce, 0x0c80,
-+ 0x080c, 0x3344, 0x0804, 0xcd41, 0x00c6, 0x00d6, 0x6104, 0x9186,
-+ 0x0016, 0x0d38, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
-+ 0x0904, 0xcd96, 0x8001, 0xb842, 0x6003, 0x0001, 0x080c, 0x960e,
-+ 0x080c, 0x9aa3, 0x00de, 0x00ce, 0x0898, 0x080c, 0xbb47, 0x0804,
-+ 0xcd43, 0x080c, 0xbb83, 0x0804, 0xcd43, 0x00d6, 0x2c68, 0x6104,
-+ 0x080c, 0xd5a8, 0x00de, 0x0118, 0x080c, 0xb157, 0x0408, 0x6004,
-+ 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085,
-+ 0x6003, 0x000b, 0x6023, 0x0002, 0x603c, 0x600a, 0x2001, 0x1987,
-+ 0x2004, 0x601a, 0x602c, 0x2c08, 0x2060, 0x6024, 0xd0b4, 0x0108,
-+ 0xc085, 0xc0b5, 0x6026, 0x2160, 0x2009, 0x8020, 0x080c, 0x9607,
-+ 0x0005, 0x00de, 0x00ce, 0x080c, 0xbb47, 0x080c, 0x3315, 0x00e6,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0x3344, 0x6017, 0x0000, 0x6023,
-+ 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x012e, 0x00ee, 0x0005,
-+ 0x080c, 0xb593, 0x1904, 0xcded, 0x0005, 0x6000, 0x908a, 0x0010,
-+ 0x1a0c, 0x0d85, 0x0096, 0x00d6, 0x001b, 0x00de, 0x009e, 0x0005,
-+ 0xce58, 0xce58, 0xce58, 0xce58, 0xce58, 0xce58, 0xce58, 0xce58,
-+ 0xce58, 0xcbe5, 0xce58, 0xcbea, 0xce5a, 0xcbea, 0xce74, 0xce58,
-+ 0x080c, 0x0d85, 0x6004, 0x9086, 0x008b, 0x01b0, 0x6034, 0x908c,
-+ 0xff00, 0x810f, 0x9186, 0x0035, 0x1130, 0x602c, 0x9080, 0x0009,
-+ 0x200c, 0xc185, 0x2102, 0x6007, 0x008b, 0x6003, 0x000d, 0x2009,
-+ 0x8020, 0x080c, 0x9607, 0x0005, 0x080c, 0xd626, 0x0118, 0x080c,
-+ 0xd639, 0x0010, 0x080c, 0xd647, 0x080c, 0xd0f9, 0x080c, 0xcf08,
-+ 0x0570, 0x080c, 0x3315, 0x080c, 0xcf08, 0x0168, 0x6014, 0x2048,
-+ 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed,
-+ 0xa882, 0x080c, 0x7002, 0x2c68, 0x080c, 0xb101, 0x0150, 0x6810,
-+ 0x6012, 0x080c, 0xd3a3, 0x00c6, 0x2d60, 0x080c, 0xb192, 0x00ce,
-+ 0x0008, 0x2d60, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
-+ 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x00c8, 0x080c,
-+ 0xd626, 0x0138, 0x6034, 0x9086, 0x4000, 0x1118, 0x080c, 0x3315,
-+ 0x08d0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-+ 0x9186, 0x0035, 0x1118, 0x080c, 0x3315, 0x0868, 0x080c, 0xb192,
-+ 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x0002, 0xcedf,
-+ 0xcedf, 0xcee7, 0xcee1, 0xcef1, 0xcedf, 0xcedf, 0xb192, 0xcedf,
-+ 0xcedf, 0xcedf, 0xcedf, 0xcedf, 0xcedf, 0xcedf, 0xcedf, 0x080c,
-+ 0x0d85, 0x080c, 0xacec, 0x080c, 0xaece, 0x080c, 0xad08, 0x6114,
-+ 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x7002, 0x009e, 0x0804,
-+ 0xb157, 0x601c, 0xd084, 0x190c, 0x1ad3, 0x0c88, 0x9284, 0x0003,
-+ 0x1158, 0x9282, 0x1ddc, 0x0240, 0x2001, 0x181a, 0x2004, 0x9202,
-+ 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028,
-+ 0x0096, 0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000,
-+ 0x9086, 0xf000, 0x0110, 0x080c, 0x1104, 0x000e, 0x009e, 0x0005,
-+ 0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061,
-+ 0x1ddc, 0x2071, 0x1800, 0x7354, 0x7074, 0x9302, 0x1640, 0x6020,
-+ 0x9206, 0x11f8, 0x080c, 0xd632, 0x0180, 0x9286, 0x0001, 0x1168,
-+ 0x6004, 0x9086, 0x0004, 0x1148, 0x080c, 0x3315, 0x080c, 0xd647,
-+ 0x00c6, 0x080c, 0xb192, 0x00ce, 0x0060, 0x080c, 0xd315, 0x0148,
-+ 0x080c, 0xd11f, 0x1110, 0x080c, 0xbb47, 0x00c6, 0x080c, 0xb157,
-+ 0x00ce, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208, 0x08a0, 0x012e,
-+ 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016,
-+ 0x9188, 0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1b39, 0x6112,
-+ 0x080c, 0x3315, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce,
-+ 0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb101,
-+ 0x01b0, 0x665e, 0x2b00, 0x6012, 0x080c, 0x5846, 0x0118, 0x080c,
-+ 0xd03b, 0x0168, 0x080c, 0xd3a3, 0x6023, 0x0003, 0x2009, 0x004b,
-+ 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-+ 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0xb1c8,
-+ 0x0580, 0x605f, 0x0000, 0x2b00, 0x6012, 0x080c, 0xd3a3, 0x6023,
-+ 0x0003, 0x0016, 0x080c, 0xacec, 0x080c, 0x97a0, 0x0076, 0x903e,
-+ 0x080c, 0x965d, 0x2c08, 0x080c, 0xe744, 0x007e, 0x080c, 0xad08,
-+ 0x001e, 0xd184, 0x0128, 0x080c, 0xb157, 0x9085, 0x0001, 0x0070,
-+ 0x080c, 0x5846, 0x0128, 0xd18c, 0x1170, 0x080c, 0xd03b, 0x0148,
-+ 0x2009, 0x004c, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce,
-+ 0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90, 0x2009, 0x004d,
-+ 0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046, 0x0016, 0x080c,
-+ 0xb101, 0x2c78, 0x05a0, 0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003,
-+ 0x0016, 0x2021, 0x0005, 0x080c, 0xd04d, 0x001e, 0x9186, 0x004d,
-+ 0x0118, 0x9186, 0x004e, 0x0148, 0x2001, 0x1980, 0x200c, 0xd1fc,
-+ 0x0168, 0x2f60, 0x080c, 0xb157, 0x00d0, 0x2001, 0x197f, 0x200c,
-+ 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xb157, 0x0088, 0x2f60, 0x080c,
-+ 0x5846, 0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148, 0x0010, 0x2900,
-+ 0x7816, 0x001e, 0x0016, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x001e,
-+ 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c,
-+ 0xb101, 0x2c78, 0x0508, 0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003,
-+ 0x0096, 0x2021, 0x0004, 0x0489, 0x009e, 0x2001, 0x197e, 0x200c,
-+ 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xb157, 0x0060, 0x2f60, 0x080c,
-+ 0x5846, 0x0120, 0xd18c, 0x1160, 0x0071, 0x0130, 0x2009, 0x0052,
-+ 0x080c, 0xb1f5, 0x9085, 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005,
-+ 0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c, 0x4c3f, 0x00ce, 0x1120,
-+ 0x080c, 0xb157, 0x9006, 0x0005, 0xa867, 0x0000, 0xa86b, 0x8000,
-+ 0x2900, 0x6016, 0x9085, 0x0001, 0x0005, 0x0096, 0x0076, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0xacec, 0x080c, 0x698d, 0x0158, 0x2001,
-+ 0xd054, 0x0006, 0x900e, 0x2400, 0x080c, 0x724e, 0x080c, 0x7002,
-+ 0x000e, 0x0807, 0x2418, 0x080c, 0x99a3, 0xbaa0, 0x0086, 0x2041,
-+ 0x0001, 0x2039, 0x0001, 0x2608, 0x080c, 0x97ba, 0x008e, 0x080c,
-+ 0x965d, 0x2f08, 0x2648, 0x080c, 0xe744, 0xb93c, 0x81ff, 0x090c,
-+ 0x9893, 0x080c, 0xad08, 0x012e, 0x007e, 0x009e, 0x0005, 0x00c6,
-+ 0x0126, 0x2091, 0x8000, 0x080c, 0xb101, 0x0190, 0x660a, 0x2b08,
-+ 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
-+ 0x001f, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-+ 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb1c8,
-+ 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0008,
-+ 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c, 0x17ad, 0x00fe, 0x2009,
-+ 0x0021, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-+ 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6, 0x0126, 0x0016, 0x2091,
-+ 0x8000, 0x080c, 0xb101, 0x0198, 0x660a, 0x2b08, 0x6112, 0x080c,
-+ 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x0016, 0x080c,
-+ 0xb1f5, 0x9085, 0x0001, 0x001e, 0x012e, 0x00ce, 0x0005, 0x9006,
-+ 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb1c8, 0x0188,
-+ 0x2b08, 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016,
-+ 0x2009, 0x0000, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce,
-+ 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044, 0x0830, 0x2009, 0x0049,
-+ 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0118,
-+ 0x8211, 0xba3e, 0x1140, 0xb8d0, 0x9005, 0x0128, 0xb888, 0x9005,
-+ 0x1110, 0xb88b, 0x0001, 0x00be, 0x002e, 0x0005, 0x0006, 0x0016,
-+ 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003, 0x0128, 0x908e,
-+ 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006,
-+ 0x0086, 0x0096, 0x6020, 0x9086, 0x0004, 0x01a8, 0x6014, 0x904d,
-+ 0x080c, 0xcf08, 0x0180, 0xa864, 0x9086, 0x0139, 0x0170, 0x6020,
-+ 0x90c6, 0x0003, 0x0140, 0x90c6, 0x0002, 0x0128, 0xa868, 0xd0fc,
-+ 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e, 0x008e, 0x000e,
-+ 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xb1c8, 0x0198,
-+ 0x2b08, 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016,
-+ 0x080c, 0x3315, 0x2009, 0x0028, 0x080c, 0xb1f5, 0x9085, 0x0001,
-+ 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8,
-+ 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6, 0x080c,
-+ 0xbdf4, 0x00be, 0x080c, 0xc070, 0x6003, 0x0001, 0x6007, 0x0029,
-+ 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0078, 0x6014, 0x0096, 0x2048,
-+ 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c, 0xd569,
-+ 0x080c, 0xbb47, 0x080c, 0xb157, 0x0005, 0x0096, 0x6014, 0x904d,
-+ 0x090c, 0x0d85, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
-+ 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x7002, 0x012e, 0x009e, 0x080c, 0xb157, 0x0c30, 0x0096, 0x9186,
-+ 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x66f3, 0x00e8, 0x9186,
-+ 0x0015, 0x1510, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014, 0x11e0,
-+ 0x6010, 0x00b6, 0x2058, 0x080c, 0x6848, 0x00be, 0x080c, 0xc146,
-+ 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005, 0x0160,
-+ 0x2001, 0x0006, 0x080c, 0x66f3, 0x6014, 0x2048, 0xa868, 0xd0fc,
-+ 0x0170, 0x080c, 0xb567, 0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc,
-+ 0x0528, 0x080c, 0xbb47, 0x080c, 0xb157, 0x009e, 0x0005, 0x6014,
-+ 0x6310, 0x2358, 0x904d, 0x090c, 0x0d85, 0xa87b, 0x0000, 0xa883,
-+ 0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x6a9e, 0x1108, 0xc185,
-+ 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x7002, 0x012e, 0x080c, 0xb157, 0x08f8, 0x6014, 0x904d,
-+ 0x090c, 0x0d85, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
-+ 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0x7002, 0x012e, 0x080c, 0xb157, 0x0840, 0xa878, 0x9086, 0x0005,
-+ 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005, 0x604b,
-+ 0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050, 0x2009,
-+ 0x8023, 0x080c, 0x9607, 0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058,
-+ 0xb800, 0x00be, 0xd0bc, 0x0130, 0x0066, 0x6020, 0x9084, 0x000f,
-+ 0x001b, 0x006e, 0x00ce, 0x0005, 0xcbe5, 0xd246, 0xd246, 0xd249,
-+ 0xeac3, 0xeade, 0xeae1, 0xcbe5, 0xcbe5, 0xcbe5, 0xcbe5, 0xcbe5,
-+ 0xcbe5, 0xcbe5, 0xcbe5, 0xcbe5, 0x080c, 0x0d85, 0xa001, 0xa001,
-+ 0x0005, 0x0096, 0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110,
-+ 0x009e, 0x0010, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800,
-+ 0x00be, 0xd0bc, 0x0550, 0x2001, 0x1834, 0x2004, 0x9005, 0x1540,
-+ 0x00f6, 0x2c78, 0x080c, 0xb101, 0x0508, 0x7810, 0x6012, 0x080c,
-+ 0xd3a3, 0x7820, 0x9086, 0x0003, 0x0128, 0x7808, 0x603a, 0x2f00,
-+ 0x603e, 0x0020, 0x7808, 0x603e, 0x2f00, 0x603a, 0x602e, 0x6023,
-+ 0x0001, 0x6007, 0x0035, 0x6003, 0x0001, 0x795c, 0x615e, 0x2009,
-+ 0x8020, 0x080c, 0x9607, 0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe,
-+ 0x2001, 0x1988, 0x2004, 0x604a, 0x0005, 0x0016, 0x0096, 0x6814,
-+ 0x2048, 0x681c, 0xd0fc, 0xc0fc, 0x681e, 0xa87c, 0x1108, 0xd0e4,
-+ 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000, 0xa88f,
-+ 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c,
-+ 0x100b, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803, 0x0002,
-+ 0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0, 0x681c,
-+ 0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00,
-+ 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c,
-+ 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc, 0x683a,
-+ 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112, 0x695c,
-+ 0x615e, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001, 0x2009,
-+ 0x8020, 0x080c, 0x9607, 0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4,
-+ 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303, 0x0230,
-+ 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e,
-+ 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402, 0xa836,
-+ 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4,
-+ 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840,
-+ 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016, 0x6004,
-+ 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e, 0x0036,
-+ 0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158, 0x908e,
-+ 0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b, 0x0110,
-+ 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026,
-+ 0x0036, 0x00e6, 0x2001, 0x1982, 0x200c, 0x8000, 0x2014, 0x2001,
-+ 0x0032, 0x080c, 0x954b, 0x2001, 0x1986, 0x82ff, 0x1110, 0x2011,
-+ 0x0014, 0x2202, 0x2001, 0x1984, 0x200c, 0x8000, 0x2014, 0x2071,
-+ 0x196c, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x954b, 0x2001,
-+ 0x1987, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1988,
-+ 0x9288, 0x000a, 0x2102, 0x2001, 0x0017, 0x080c, 0xacdd, 0x2001,
-+ 0x1a90, 0x2102, 0x2001, 0x0032, 0x080c, 0x16b9, 0x080c, 0x6be2,
-+ 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016,
-+ 0x00e6, 0x2001, 0x1986, 0x2003, 0x0028, 0x2001, 0x1987, 0x2003,
-+ 0x0014, 0x2071, 0x196c, 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001,
-+ 0x1988, 0x2009, 0x001e, 0x2102, 0x2001, 0x0017, 0x080c, 0xacdd,
-+ 0x2001, 0x1a90, 0x2102, 0x2001, 0x0032, 0x080c, 0x16b9, 0x00ee,
-+ 0x001e, 0x000e, 0x0005, 0x0096, 0x6060, 0x904d, 0x0110, 0x080c,
-+ 0x108b, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0xb101, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001,
-+ 0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0xb1f5, 0x9085, 0x0001,
-+ 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6,
-+ 0x2071, 0x1800, 0x9186, 0x0015, 0x1520, 0x7090, 0x9086, 0x0018,
-+ 0x0120, 0x7090, 0x9086, 0x0014, 0x11e0, 0x6014, 0x2048, 0xaa3c,
-+ 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x9b73, 0x01d8, 0x707c, 0xaa50,
-+ 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206, 0x1140, 0x6210, 0x00b6,
-+ 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3364, 0x080c, 0xb567,
-+ 0x0020, 0x080c, 0xbb47, 0x080c, 0xb157, 0x00fe, 0x00ee, 0x009e,
-+ 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48, 0x0c80, 0x00c6, 0x0126,
-+ 0x2091, 0x8000, 0x080c, 0xb101, 0x0188, 0x2b08, 0x6112, 0x080c,
-+ 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x004d, 0x080c,
-+ 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-+ 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0xb101, 0x0180,
-+ 0x2b08, 0x6112, 0x080c, 0xd3a3, 0x6023, 0x0001, 0x2900, 0x6016,
-+ 0x001e, 0x080c, 0xb1f5, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-+ 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056,
-+ 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
-+ 0x1568, 0x7190, 0x6014, 0x2048, 0xa814, 0x8003, 0x9106, 0x1530,
-+ 0x20e1, 0x0000, 0x2001, 0x19a1, 0x2003, 0x0000, 0x6014, 0x2048,
-+ 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e8,
-+ 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a1, 0x0016,
-+ 0x200c, 0x080c, 0xdc8c, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048,
-+ 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010, 0x080c, 0xbb47,
-+ 0x080c, 0xb157, 0x00fe, 0x00ee, 0x009e, 0x006e, 0x005e, 0x004e,
-+ 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6, 0x00f6, 0x2071,
-+ 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090, 0x9086, 0x0004, 0x1198,
-+ 0x6014, 0x2048, 0x2c78, 0x080c, 0x9b73, 0x01a8, 0x707c, 0xaa74,
-+ 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206, 0x1110, 0x080c, 0x3315,
-+ 0x080c, 0xb567, 0x0020, 0x080c, 0xbb47, 0x080c, 0xb157, 0x00fe,
-+ 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78, 0x9206, 0x0d78, 0x0c80,
-+ 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1550,
-+ 0x7090, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048, 0x2c78, 0x080c,
-+ 0x9b73, 0x05f0, 0x707c, 0xaacc, 0x9206, 0x1180, 0x7080, 0xaad0,
-+ 0x9206, 0x1160, 0x080c, 0x3315, 0x0016, 0xa998, 0xaab0, 0x9284,
-+ 0x1000, 0xc0fd, 0x080c, 0x57e7, 0x001e, 0x0010, 0x080c, 0x55ca,
-+ 0x080c, 0xcf08, 0x0508, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897,
-+ 0x4000, 0x0080, 0x080c, 0xcf08, 0x01b8, 0x6014, 0x2048, 0x080c,
-+ 0x55ca, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
-+ 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0x080c,
-+ 0x7002, 0x012e, 0x080c, 0xb157, 0x00fe, 0x00ee, 0x009e, 0x0005,
-+ 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016, 0x0026, 0xa87c,
-+ 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0150, 0xa890,
-+ 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992, 0xaa8e, 0x9085,
-+ 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6, 0x0036, 0x080c,
-+ 0xcf08, 0x0904, 0xd565, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982,
-+ 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358, 0x2009, 0x0000,
-+ 0xa868, 0xd0f4, 0x1140, 0x080c, 0x6a9e, 0x1108, 0xc185, 0xb800,
-+ 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9, 0x0004, 0xa860,
-+ 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8,
-+ 0x9080, 0x0006, 0x2098, 0x080c, 0x0fd6, 0x20a9, 0x0004, 0xa85c,
-+ 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c,
-+ 0x0fd6, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398, 0x0007, 0x231c,
-+ 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004, 0xaba2, 0x6310,
-+ 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0xa868, 0xc0f4, 0xa86a,
-+ 0x080c, 0x6ff6, 0x6017, 0x0000, 0x009e, 0x003e, 0x00de, 0x00be,
-+ 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6, 0x6214,
-+ 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096, 0x0000, 0x11a0,
-+ 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x268c, 0x2118, 0x831f,
-+ 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c, 0x2011,
-+ 0x8018, 0x080c, 0x4c9f, 0x00a8, 0x9096, 0x0001, 0x1148, 0x89ff,
-+ 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x0048,
-+ 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c,
-+ 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e, 0x002e, 0x0005,
-+ 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110, 0x6a38, 0x0008,
-+ 0x6a2c, 0x080c, 0xcef6, 0x01f0, 0x2260, 0x6120, 0x9186, 0x0003,
-+ 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206, 0x0140, 0x683c,
-+ 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140, 0x0020, 0x6008,
-+ 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106, 0x001e, 0x002e,
-+ 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc, 0x0198,
-+ 0x918c, 0x00ff, 0x918e, 0x0002, 0x1170, 0xa9a8, 0x918c, 0x000f,
-+ 0x918e, 0x0001, 0x1140, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-+ 0x9115, 0x190c, 0xc504, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010,
-+ 0x0036, 0x901e, 0x0499, 0x01e0, 0x080c, 0xcf08, 0x01c8, 0x080c,
-+ 0xd0f9, 0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048,
-+ 0xa87c, 0x080c, 0xd11f, 0x1118, 0x080c, 0xbb47, 0x0040, 0xa867,
-+ 0x0103, 0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x7002, 0x009e,
-+ 0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec,
-+ 0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
-+ 0x0005, 0x080c, 0xd213, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810,
-+ 0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4,
-+ 0x000e, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e,
-+ 0x0005, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be,
-+ 0x2021, 0x0007, 0x080c, 0x4e56, 0x004e, 0x003e, 0x0005, 0x0c51,
-+ 0x1d81, 0x0005, 0x2001, 0x1986, 0x2004, 0x601a, 0x0005, 0x2001,
-+ 0x1988, 0x2004, 0x604a, 0x0005, 0x080c, 0xb157, 0x0804, 0x9aa3,
-+ 0x611c, 0xd1fc, 0xa97c, 0x1108, 0xd1e4, 0x0005, 0x601c, 0xd0fc,
-+ 0xa87c, 0x1108, 0xd0e4, 0x0005, 0x601c, 0xd0fc, 0xc0fc, 0x601e,
-+ 0xa87c, 0x1108, 0xd0e4, 0x0005, 0x6044, 0xd0fc, 0x1138, 0xd0bc,
-+ 0x0198, 0xc0bc, 0x6046, 0x6003, 0x0002, 0x0070, 0xd0ac, 0x1160,
-+ 0xd0dc, 0x1128, 0x908c, 0x000f, 0x9186, 0x0005, 0x1118, 0x6003,
-+ 0x0003, 0x0010, 0x6003, 0x0001, 0x0005, 0x00b6, 0x0066, 0x6000,
-+ 0x90b2, 0x0010, 0x1a0c, 0x0d85, 0x001b, 0x006e, 0x00be, 0x0005,
-+ 0xd6a0, 0xdde9, 0xdf4d, 0xd6a0, 0xd6a0, 0xd6a0, 0xd6a0, 0xd6a0,
-+ 0xd6d7, 0xdfd1, 0xd6a0, 0xd6a0, 0xd6a0, 0xd6a0, 0xd6a0, 0xd6a0,
-+ 0x080c, 0x0d85, 0x0066, 0x6000, 0x90b2, 0x0010, 0x1a0c, 0x0d85,
-+ 0x0013, 0x006e, 0x0005, 0xd6bb, 0xe4f2, 0xd6bb, 0xd6bb, 0xd6bb,
-+ 0xd6bb, 0xd6bb, 0xd6bb, 0xe4a1, 0xe544, 0xd6bb, 0xebf7, 0xec2b,
-+ 0xebf7, 0xec2b, 0xd6bb, 0x080c, 0x0d85, 0x6000, 0x9082, 0x0010,
-+ 0x1a0c, 0x0d85, 0x6000, 0x000a, 0x0005, 0xd6d5, 0xe1ae, 0xe279,
-+ 0xe29c, 0xe318, 0xd6d5, 0xe413, 0xe3a0, 0xdfdb, 0xe479, 0xe48e,
-+ 0xd6d5, 0xd6d5, 0xd6d5, 0xd6d5, 0xd6d5, 0x080c, 0x0d85, 0x91b2,
-+ 0x0053, 0x1a0c, 0x0d85, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xdb5b,
-+ 0x0002, 0xd721, 0xd929, 0xd721, 0xd721, 0xd721, 0xd932, 0xd721,
-+ 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721,
-+ 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721,
-+ 0xd723, 0xd78a, 0xd799, 0xd7fd, 0xd828, 0xd8a1, 0xd914, 0xd721,
-+ 0xd721, 0xd935, 0xd721, 0xd721, 0xd94a, 0xd957, 0xd721, 0xd721,
-+ 0xd721, 0xd721, 0xd721, 0xd9fd, 0xd721, 0xd721, 0xda11, 0xd721,
-+ 0xd721, 0xd9cc, 0xd721, 0xd721, 0xd721, 0xda29, 0xd721, 0xd721,
-+ 0xd721, 0xdaa6, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721, 0xd721,
-+ 0xdb23, 0x080c, 0x0d85, 0x080c, 0x6bbf, 0x1150, 0x2001, 0x1837,
-+ 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140,
-+ 0x6007, 0x0009, 0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xd922,
-+ 0x080c, 0x6b5b, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210,
-+ 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0xacec, 0x080c,
-+ 0x97a0, 0x0076, 0x903e, 0x080c, 0x965d, 0x2c08, 0x080c, 0xe744,
-+ 0x007e, 0x001e, 0x080c, 0xad08, 0x001e, 0x002e, 0x003e, 0x00ce,
-+ 0x00ee, 0x6610, 0x2658, 0x080c, 0x67bc, 0xbe04, 0x9684, 0x00ff,
-+ 0x9082, 0x0006, 0x1268, 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258,
-+ 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xee56, 0x002e, 0x001e, 0x1178,
-+ 0x080c, 0xe672, 0x1904, 0xd7f5, 0x080c, 0xe60e, 0x1120, 0x6007,
-+ 0x0008, 0x0804, 0xd922, 0x6007, 0x0009, 0x0804, 0xd922, 0x080c,
-+ 0xe8ec, 0x0128, 0x080c, 0xe672, 0x0d78, 0x0804, 0xd7f5, 0x6017,
-+ 0x1900, 0x0c88, 0x080c, 0x344c, 0x1904, 0xdb58, 0x6106, 0x080c,
-+ 0xe5ae, 0x6007, 0x0006, 0x0804, 0xd922, 0x6007, 0x0007, 0x0804,
-+ 0xd922, 0x080c, 0xec67, 0x1904, 0xdb58, 0x080c, 0x344c, 0x1904,
-+ 0xdb58, 0x00d6, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-+ 0x0006, 0x1220, 0x2001, 0x0001, 0x080c, 0x66df, 0x96b4, 0xff00,
-+ 0x8637, 0x9686, 0x0006, 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04,
-+ 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140, 0x9686, 0x0004, 0x0128,
-+ 0x9686, 0x0005, 0x0110, 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260,
-+ 0x7034, 0x9084, 0x0003, 0x1140, 0x7034, 0x9082, 0x0014, 0x0220,
-+ 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f,
-+ 0x0007, 0x00b0, 0x00ee, 0x080c, 0xe6da, 0x1190, 0x9686, 0x0006,
-+ 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x3364,
-+ 0x002e, 0x080c, 0x6848, 0x6007, 0x000a, 0x00de, 0x0804, 0xd922,
-+ 0x6007, 0x000b, 0x00de, 0x0804, 0xd922, 0x080c, 0x3315, 0x080c,
-+ 0xd647, 0x6007, 0x0001, 0x0804, 0xd922, 0x080c, 0xec67, 0x1904,
-+ 0xdb58, 0x080c, 0x344c, 0x1904, 0xdb58, 0x2071, 0x0260, 0x7034,
-+ 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084,
-+ 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8,
-+ 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x3364, 0x002e,
-+ 0x6007, 0x000c, 0x2001, 0x0001, 0x080c, 0xee35, 0x0804, 0xd922,
-+ 0x080c, 0x6bbf, 0x1140, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009,
-+ 0x9086, 0x0008, 0x1110, 0x0804, 0xd730, 0x080c, 0x6b5b, 0x6610,
-+ 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x06c8, 0x1138,
-+ 0x0026, 0x2001, 0x0006, 0x080c, 0x671f, 0x002e, 0x0050, 0x96b4,
-+ 0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904,
-+ 0xd7f5, 0x080c, 0xe6e7, 0x1120, 0x6007, 0x000e, 0x0804, 0xd922,
-+ 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x3315, 0x080c,
-+ 0xd647, 0x004e, 0x0016, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4,
-+ 0x0148, 0x2009, 0x0029, 0x080c, 0xea74, 0x6010, 0x2058, 0xb800,
-+ 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x0804, 0xd922,
-+ 0x2001, 0x0001, 0x080c, 0x66df, 0x0156, 0x0016, 0x0026, 0x0036,
-+ 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0270, 0x080c, 0xc1f9,
-+ 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0168, 0x96b4, 0xff00,
-+ 0x8637, 0x9682, 0x0004, 0x0a04, 0xd7f5, 0x9682, 0x0007, 0x0a04,
-+ 0xd851, 0x0804, 0xd7f5, 0x6017, 0x1900, 0x6007, 0x0009, 0x0804,
-+ 0xd922, 0x080c, 0x6bbf, 0x1140, 0x2001, 0x1837, 0x2004, 0x9084,
-+ 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd730, 0x080c, 0x6b5b,
-+ 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x0006, 0x0016, 0x908e,
-+ 0x0001, 0x0118, 0x908e, 0x0000, 0x1118, 0x001e, 0x000e, 0x0080,
-+ 0x001e, 0x000e, 0x9082, 0x0006, 0x06a0, 0x0150, 0x96b4, 0xff00,
-+ 0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xd7f5,
-+ 0x080c, 0xe715, 0x1138, 0x080c, 0xe60e, 0x1120, 0x6007, 0x0010,
-+ 0x0804, 0xd922, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c,
-+ 0x3315, 0x080c, 0xd647, 0x004e, 0x0016, 0x9006, 0x2009, 0x1848,
-+ 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xea74, 0x6010,
-+ 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001,
-+ 0x0448, 0x080c, 0xe8ec, 0x0198, 0x0016, 0x968c, 0x00ff, 0x9186,
-+ 0x0002, 0x0160, 0x9186, 0x0003, 0x0148, 0x001e, 0x96b4, 0xff00,
-+ 0x8637, 0x9686, 0x0006, 0x0920, 0x0804, 0xd7f5, 0x001e, 0x6017,
-+ 0x1900, 0x6007, 0x0009, 0x0070, 0x080c, 0x344c, 0x1904, 0xdb58,
-+ 0x080c, 0xec67, 0x1904, 0xdb58, 0x080c, 0xdd29, 0x1904, 0xd7f5,
-+ 0x6007, 0x0012, 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x960e, 0x080c,
-+ 0x9aa3, 0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c, 0xec67, 0x1904,
-+ 0xdb58, 0x080c, 0x344c, 0x1904, 0xdb58, 0x080c, 0xdd29, 0x1904,
-+ 0xd7f5, 0x6007, 0x0020, 0x6003, 0x0001, 0x080c, 0x960e, 0x080c,
-+ 0x9aa3, 0x0005, 0x080c, 0x344c, 0x1904, 0xdb58, 0x6007, 0x0023,
-+ 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0005, 0x080c,
-+ 0xec67, 0x1904, 0xdb58, 0x080c, 0x344c, 0x1904, 0xdb58, 0x080c,
-+ 0xdd29, 0x1904, 0xd7f5, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260,
-+ 0x2c08, 0x2011, 0x1820, 0x2214, 0x703c, 0x9206, 0x11e0, 0x2011,
-+ 0x181f, 0x2214, 0x7038, 0x9084, 0x00ff, 0x9206, 0x11a0, 0x7240,
-+ 0x080c, 0xcef6, 0x0570, 0x2260, 0x6008, 0x9086, 0xffff, 0x0120,
-+ 0x7244, 0x6008, 0x9206, 0x1528, 0x6020, 0x9086, 0x0007, 0x1508,
-+ 0x080c, 0xb157, 0x04a0, 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08,
-+ 0x080c, 0xcef6, 0x01b0, 0x2260, 0x7240, 0x6008, 0x9206, 0x1188,
-+ 0x6010, 0x9190, 0x0004, 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240,
-+ 0x2c08, 0x9006, 0x080c, 0xea3e, 0x1180, 0x7244, 0x9286, 0xffff,
-+ 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017, 0x1700, 0x7214, 0x9296,
-+ 0xffff, 0x1180, 0x6007, 0x0025, 0x0068, 0x6020, 0x9086, 0x0007,
-+ 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110, 0x080c, 0xb157, 0x2160,
-+ 0x6007, 0x0025, 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001, 0x0001, 0x080c, 0x66df,
-+ 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805,
-+ 0x2011, 0x0276, 0x080c, 0xc1f9, 0x003e, 0x002e, 0x001e, 0x015e,
-+ 0x0120, 0x6007, 0x0031, 0x0804, 0xd922, 0x080c, 0xbe0c, 0x080c,
-+ 0x778e, 0x1190, 0x0006, 0x0026, 0x0036, 0x080c, 0x77a8, 0x1138,
-+ 0x080c, 0x7aa6, 0x080c, 0x6196, 0x080c, 0x76bd, 0x0010, 0x080c,
-+ 0x7762, 0x003e, 0x002e, 0x000e, 0x0005, 0x080c, 0x344c, 0x1904,
-+ 0xdb58, 0x080c, 0xdd29, 0x1904, 0xd7f5, 0x6106, 0x080c, 0xdd45,
-+ 0x1120, 0x6007, 0x002b, 0x0804, 0xd922, 0x6007, 0x002c, 0x0804,
-+ 0xd922, 0x080c, 0xec67, 0x1904, 0xdb58, 0x080c, 0x344c, 0x1904,
-+ 0xdb58, 0x080c, 0xdd29, 0x1904, 0xd7f5, 0x6106, 0x080c, 0xdd4a,
-+ 0x1120, 0x6007, 0x002e, 0x0804, 0xd922, 0x6007, 0x002f, 0x0804,
-+ 0xd922, 0x080c, 0x344c, 0x1904, 0xdb58, 0x00e6, 0x00d6, 0x00c6,
-+ 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158,
-+ 0x9184, 0xff00, 0x8007, 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de,
-+ 0x00ee, 0x0804, 0xd929, 0x080c, 0x5842, 0xd0e4, 0x0904, 0xdaa3,
-+ 0x2071, 0x026c, 0x7010, 0x603a, 0x7014, 0x603e, 0x7108, 0x720c,
-+ 0x080c, 0x6bfd, 0x0140, 0x6010, 0x2058, 0xb810, 0x9106, 0x1118,
-+ 0xb814, 0x9206, 0x0510, 0x080c, 0x6bf9, 0x15b8, 0x2069, 0x1800,
-+ 0x6880, 0x9206, 0x1590, 0x687c, 0x9106, 0x1578, 0x7210, 0x080c,
-+ 0xcef6, 0x0590, 0x080c, 0xdc16, 0x0578, 0x080c, 0xeaf0, 0x0560,
-+ 0x622e, 0x6007, 0x0036, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c,
-+ 0x9607, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff,
-+ 0x0150, 0x080c, 0xcef6, 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110,
-+ 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c,
-+ 0xea3e, 0x2c10, 0x2160, 0x0140, 0x0890, 0x6007, 0x0037, 0x602f,
-+ 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003,
-+ 0x6017, 0x1700, 0x0880, 0x6007, 0x0012, 0x0868, 0x080c, 0x344c,
-+ 0x1904, 0xdb58, 0x6010, 0x2058, 0xb804, 0x9084, 0xff00, 0x8007,
-+ 0x9086, 0x0006, 0x1904, 0xd929, 0x00e6, 0x00d6, 0x00c6, 0x080c,
-+ 0x5842, 0xd0e4, 0x0904, 0xdb1b, 0x2069, 0x1800, 0x2071, 0x026c,
-+ 0x7008, 0x603a, 0x720c, 0x623e, 0x9286, 0xffff, 0x1150, 0x7208,
-+ 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c, 0xea3e, 0x2c10, 0x00ce,
-+ 0x05e8, 0x080c, 0xcef6, 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004,
-+ 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c, 0xcac7, 0x002e,
-+ 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f, 0x9186, 0x0001, 0x0178,
-+ 0x9186, 0x0005, 0x0118, 0x9186, 0x0007, 0x1198, 0x9280, 0x0005,
-+ 0x2004, 0x9005, 0x0170, 0x080c, 0xdc16, 0x0904, 0xda9c, 0x0056,
-+ 0x7510, 0x7614, 0x080c, 0xeb09, 0x005e, 0x00ce, 0x00de, 0x00ee,
-+ 0x0005, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003,
-+ 0x0001, 0x2009, 0x8020, 0x080c, 0x9607, 0x0c78, 0x6007, 0x003b,
-+ 0x602f, 0x0003, 0x6017, 0x0300, 0x6003, 0x0001, 0x2009, 0x8020,
-+ 0x080c, 0x9607, 0x0c10, 0x6007, 0x003b, 0x602f, 0x000b, 0x6017,
-+ 0x0000, 0x0804, 0xda73, 0x00e6, 0x0026, 0x080c, 0x6bbf, 0x0550,
-+ 0x080c, 0x6b5b, 0x080c, 0xecd8, 0x1518, 0x2071, 0x1800, 0x70dc,
-+ 0x9085, 0x0003, 0x70de, 0x00f6, 0x2079, 0x0100, 0x72b0, 0x9284,
-+ 0x00ff, 0x707e, 0x78e6, 0x9284, 0xff00, 0x7280, 0x9205, 0x7082,
-+ 0x78ea, 0x00fe, 0x70e7, 0x0000, 0x080c, 0x6bfd, 0x0120, 0x2011,
-+ 0x1a0a, 0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x30bf, 0x0010,
-+ 0x080c, 0xed0c, 0x002e, 0x00ee, 0x080c, 0xb157, 0x0804, 0xd928,
-+ 0x080c, 0xb157, 0x0005, 0x2600, 0x0002, 0xdb6f, 0xdb9d, 0xdbae,
-+ 0xdb6f, 0xdb6f, 0xdb71, 0xdbbf, 0xdb6f, 0xdb6f, 0xdb6f, 0xdb8b,
-+ 0xdb6f, 0xdb6f, 0xdb6f, 0xdbca, 0xdbe0, 0xdc11, 0xdb6f, 0x080c,
-+ 0x0d85, 0x080c, 0xec67, 0x1d20, 0x080c, 0x344c, 0x1d08, 0x7038,
-+ 0x6016, 0x6007, 0x0045, 0x6003, 0x0001, 0x080c, 0x960e, 0x0005,
-+ 0x080c, 0x3315, 0x080c, 0xd647, 0x6007, 0x0001, 0x6003, 0x0001,
-+ 0x080c, 0x960e, 0x0005, 0x080c, 0xec67, 0x1950, 0x080c, 0x344c,
-+ 0x1938, 0x080c, 0xdd29, 0x1d60, 0x703c, 0x6016, 0x6007, 0x004a,
-+ 0x6003, 0x0001, 0x080c, 0x960e, 0x0005, 0x080c, 0x344c, 0x1904,
-+ 0xdb58, 0x2009, 0x0041, 0x080c, 0xed15, 0x6007, 0x0047, 0x6003,
-+ 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0005, 0x080c, 0x344c,
-+ 0x1904, 0xdb58, 0x2009, 0x0042, 0x080c, 0xed15, 0x6007, 0x0047,
-+ 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0005, 0x080c,
-+ 0x344c, 0x1904, 0xdb58, 0x2009, 0x0046, 0x080c, 0xed15, 0x080c,
-+ 0xb157, 0x0005, 0x2001, 0x1824, 0x2004, 0x9082, 0x00e1, 0x1268,
-+ 0x080c, 0xdc33, 0x0904, 0xdb58, 0x6007, 0x004e, 0x6003, 0x0001,
-+ 0x080c, 0x960e, 0x080c, 0x9aa3, 0x0005, 0x6007, 0x0012, 0x0cb0,
-+ 0x6007, 0x004f, 0x6017, 0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff,
-+ 0x0508, 0x9186, 0x0001, 0x1160, 0x7140, 0x2001, 0x19be, 0x2004,
-+ 0x9106, 0x11b0, 0x7144, 0x2001, 0x19bf, 0x2004, 0x9106, 0x0190,
-+ 0x9186, 0x0002, 0x1168, 0x2011, 0x0276, 0x20a9, 0x0004, 0x6010,
-+ 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xc20d, 0x009e, 0x0110,
-+ 0x6017, 0x0001, 0x6003, 0x0001, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x0005, 0x6007, 0x0050, 0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6,
-+ 0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260, 0x6010, 0x2058, 0xb8d4,
-+ 0xd084, 0x0150, 0x7128, 0x604c, 0x9106, 0x1120, 0x712c, 0x6050,
-+ 0x9106, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x00be,
-+ 0x00ee, 0x001e, 0x0005, 0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6,
-+ 0x01d6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x20e1, 0x0000,
-+ 0x2001, 0x19a1, 0x2003, 0x0000, 0x080c, 0x1072, 0x05a0, 0x2900,
-+ 0x6016, 0x7090, 0x8004, 0xa816, 0x908a, 0x001e, 0x02d0, 0xa833,
-+ 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
-+ 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c, 0x0471, 0x001e, 0x81ff,
-+ 0x01b8, 0x2940, 0x080c, 0x1072, 0x01b0, 0x2900, 0xa006, 0x2100,
-+ 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
-+ 0x20a0, 0x2001, 0x19a1, 0x0016, 0x200c, 0x00b1, 0x001e, 0x0000,
-+ 0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x7093, 0x0000, 0x6014,
-+ 0x2048, 0x080c, 0x100b, 0x9006, 0x012e, 0x01de, 0x01ce, 0x00ee,
-+ 0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
-+ 0x00c6, 0x918c, 0xffff, 0x11b0, 0x080c, 0x21f9, 0x2099, 0x026c,
-+ 0x2001, 0x0014, 0x3518, 0x9312, 0x0108, 0x1218, 0x23a8, 0x4003,
-+ 0x0400, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x21f9, 0x2099,
-+ 0x0260, 0x0ca8, 0x080c, 0x21f9, 0x2061, 0x19a1, 0x6004, 0x2098,
-+ 0x6008, 0x3518, 0x9312, 0x0108, 0x1218, 0x23a8, 0x4003, 0x0048,
-+ 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x21f9, 0x2099, 0x0260,
-+ 0x0ca8, 0x2061, 0x19a1, 0x2019, 0x0280, 0x3300, 0x931e, 0x0110,
-+ 0x6006, 0x0020, 0x2001, 0x0260, 0x6006, 0x8108, 0x2162, 0x9292,
-+ 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e,
-+ 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff,
-+ 0x11b8, 0x080c, 0x2211, 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518,
-+ 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff,
-+ 0x01f8, 0x22a8, 0x8108, 0x080c, 0x2211, 0x20a1, 0x0240, 0x0c98,
-+ 0x080c, 0x2211, 0x2061, 0x19a4, 0x6004, 0x20a0, 0x6008, 0x3518,
-+ 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff,
-+ 0x0138, 0x22a8, 0x8108, 0x080c, 0x2211, 0x20a1, 0x0240, 0x0c98,
-+ 0x2061, 0x19a4, 0x2019, 0x0260, 0x3400, 0x931e, 0x0110, 0x6006,
-+ 0x0020, 0x2001, 0x0240, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021,
-+ 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e,
-+ 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00,
-+ 0x8637, 0x9686, 0x0006, 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04,
-+ 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128, 0x9686, 0x0004, 0x0110,
-+ 0x9085, 0x0001, 0x006e, 0x00be, 0x0005, 0x00d6, 0x080c, 0xddbf,
-+ 0x00de, 0x0005, 0x00d6, 0x080c, 0xddcc, 0x1520, 0x680c, 0x908c,
-+ 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e,
-+ 0xd1e4, 0x0130, 0x9006, 0x080c, 0xee35, 0x2009, 0x0001, 0x0078,
-+ 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff, 0x6824, 0x080c, 0x268c,
-+ 0x1148, 0x2001, 0x0001, 0x080c, 0xee35, 0x2110, 0x900e, 0x080c,
-+ 0x3364, 0x0018, 0x9085, 0x0001, 0x0008, 0x9006, 0x00de, 0x0005,
-+ 0x00b6, 0x00c6, 0x080c, 0xb1c8, 0x0598, 0x0016, 0x0026, 0x00c6,
-+ 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x268c, 0x1568,
-+ 0x080c, 0x6742, 0x1550, 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e,
-+ 0x2b00, 0x6012, 0x080c, 0xec67, 0x11c8, 0x080c, 0x344c, 0x11b0,
-+ 0x080c, 0xdd29, 0x0500, 0x2001, 0x0007, 0x080c, 0x66f3, 0x2001,
-+ 0x0007, 0x080c, 0x671f, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007,
-+ 0x0001, 0x6003, 0x0001, 0x080c, 0x960e, 0x0010, 0x080c, 0xb157,
-+ 0x9085, 0x0001, 0x00ce, 0x00be, 0x0005, 0x080c, 0xb157, 0x00ce,
-+ 0x002e, 0x001e, 0x0ca8, 0x080c, 0xb157, 0x9006, 0x0c98, 0x2069,
-+ 0x026d, 0x6800, 0x9082, 0x0010, 0x1228, 0x6017, 0x0000, 0x9085,
-+ 0x0001, 0x0008, 0x9006, 0x0005, 0x6017, 0x0000, 0x2069, 0x026c,
-+ 0x6808, 0x9084, 0xff00, 0x9086, 0x0800, 0x1190, 0x6904, 0x9186,
-+ 0x0018, 0x0118, 0x9186, 0x0014, 0x1158, 0x810f, 0x6800, 0x9084,
-+ 0x00ff, 0x910d, 0x6162, 0x908e, 0x0014, 0x0110, 0x908e, 0x0010,
-+ 0x0005, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d85, 0x91b6, 0x0013,
-+ 0x1130, 0x2008, 0x91b2, 0x0040, 0x1a04, 0xdf21, 0x0402, 0x91b6,
-+ 0x0027, 0x0190, 0x9186, 0x0015, 0x0118, 0x9186, 0x0016, 0x1140,
-+ 0x080c, 0xaf4c, 0x0120, 0x9086, 0x0002, 0x0904, 0xbb8e, 0x0005,
-+ 0x91b6, 0x0014, 0x190c, 0x0d85, 0x2001, 0x0007, 0x080c, 0x671f,
-+ 0x080c, 0x99dd, 0x080c, 0xb192, 0x080c, 0x9aa3, 0x0005, 0xde57,
-+ 0xde59, 0xde57, 0xde57, 0xde57, 0xde59, 0xde66, 0xdf1e, 0xdea8,
-+ 0xdf1e, 0xdecc, 0xdf1e, 0xde66, 0xdf1e, 0xdf16, 0xdf1e, 0xdf16,
-+ 0xdf1e, 0xdf1e, 0xde57, 0xde57, 0xde57, 0xde57, 0xde57, 0xde57,
-+ 0xde57, 0xde57, 0xde57, 0xde57, 0xde57, 0xde59, 0xde57, 0xdf1e,
-+ 0xde57, 0xde57, 0xdf1e, 0xde57, 0xdf1b, 0xdf1e, 0xde57, 0xde57,
-+ 0xde57, 0xde57, 0xdf1e, 0xdf1e, 0xde57, 0xdf1e, 0xdf1e, 0xde57,
-+ 0xde61, 0xde57, 0xde57, 0xde57, 0xde57, 0xdf1a, 0xdf1e, 0xde57,
-+ 0xde57, 0xdf1e, 0xdf1e, 0xde57, 0xde57, 0xde57, 0xde57, 0x080c,
-+ 0x0d85, 0x080c, 0xd64a, 0x6003, 0x0002, 0x080c, 0x9aa3, 0x0804,
-+ 0xdf20, 0x9006, 0x080c, 0x66df, 0x0804, 0xdf1e, 0x080c, 0x6bf9,
-+ 0x1904, 0xdf1e, 0x9006, 0x080c, 0x66df, 0x6010, 0x2058, 0xb810,
-+ 0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000,
-+ 0x78aa, 0x00fe, 0x00b8, 0x6010, 0x2058, 0xb884, 0x9005, 0x0904,
-+ 0xdf1e, 0x080c, 0x347d, 0x1904, 0xdf1e, 0x2001, 0x1800, 0x2004,
-+ 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000,
-+ 0x78aa, 0x00fe, 0x2001, 0x0002, 0x080c, 0x66f3, 0x6023, 0x0001,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x6110, 0x2158, 0x2009, 0x0001, 0x080c, 0x8991, 0x0804, 0xdf20,
- 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
-- 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686,
-- 0x0006, 0x0128, 0x9686, 0x0004, 0x0110, 0x9085, 0x0001, 0x006e,
-- 0x00be, 0x0005, 0x00d6, 0x080c, 0xddd4, 0x00de, 0x0005, 0x00d6,
-- 0x080c, 0xdde1, 0x1520, 0x680c, 0x908c, 0xff00, 0x6820, 0x9084,
-- 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006,
-- 0x080c, 0xee4e, 0x2009, 0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920,
-- 0x918c, 0x00ff, 0x6824, 0x080c, 0x268c, 0x1148, 0x2001, 0x0001,
-- 0x080c, 0xee4e, 0x2110, 0x900e, 0x080c, 0x3364, 0x0018, 0x9085,
-- 0x0001, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c,
-- 0xb1dd, 0x0598, 0x0016, 0x0026, 0x00c6, 0x2011, 0x0263, 0x2204,
-- 0x8211, 0x220c, 0x080c, 0x268c, 0x1568, 0x080c, 0x6749, 0x1550,
-- 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e, 0x2b00, 0x6012, 0x080c,
-- 0xec80, 0x11c8, 0x080c, 0x344c, 0x11b0, 0x080c, 0xdd3e, 0x0500,
-- 0x2001, 0x0007, 0x080c, 0x66fa, 0x2001, 0x0007, 0x080c, 0x6726,
-- 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001,
-- 0x080c, 0x961e, 0x0010, 0x080c, 0xb16c, 0x9085, 0x0001, 0x00ce,
-- 0x00be, 0x0005, 0x080c, 0xb16c, 0x00ce, 0x002e, 0x001e, 0x0ca8,
-- 0x080c, 0xb16c, 0x9006, 0x0c98, 0x2069, 0x026d, 0x6800, 0x9082,
-- 0x0010, 0x1228, 0x6017, 0x0000, 0x9085, 0x0001, 0x0008, 0x9006,
-- 0x0005, 0x6017, 0x0000, 0x2069, 0x026c, 0x6808, 0x9084, 0xff00,
-- 0x9086, 0x0800, 0x1190, 0x6904, 0x9186, 0x0018, 0x0118, 0x9186,
-- 0x0014, 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff, 0x910d, 0x6162,
-- 0x908e, 0x0014, 0x0110, 0x908e, 0x0010, 0x0005, 0x6004, 0x90b2,
-- 0x0053, 0x1a0c, 0x0d85, 0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2,
-- 0x0040, 0x1a04, 0xdf36, 0x0402, 0x91b6, 0x0027, 0x0190, 0x9186,
-- 0x0015, 0x0118, 0x9186, 0x0016, 0x1140, 0x080c, 0xaf61, 0x0120,
-- 0x9086, 0x0002, 0x0904, 0xbba3, 0x0005, 0x91b6, 0x0014, 0x190c,
-- 0x0d85, 0x2001, 0x0007, 0x080c, 0x6726, 0x080c, 0x99ed, 0x080c,
-- 0xb1a7, 0x080c, 0x9ab3, 0x0005, 0xde6c, 0xde6e, 0xde6c, 0xde6c,
-- 0xde6c, 0xde6e, 0xde7b, 0xdf33, 0xdebd, 0xdf33, 0xdee1, 0xdf33,
-- 0xde7b, 0xdf33, 0xdf2b, 0xdf33, 0xdf2b, 0xdf33, 0xdf33, 0xde6c,
-- 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0xde6c,
-- 0xde6c, 0xde6c, 0xde6e, 0xde6c, 0xdf33, 0xde6c, 0xde6c, 0xdf33,
-- 0xde6c, 0xdf30, 0xdf33, 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0xdf33,
-- 0xdf33, 0xde6c, 0xdf33, 0xdf33, 0xde6c, 0xde76, 0xde6c, 0xde6c,
-- 0xde6c, 0xde6c, 0xdf2f, 0xdf33, 0xde6c, 0xde6c, 0xdf33, 0xdf33,
-- 0xde6c, 0xde6c, 0xde6c, 0xde6c, 0x080c, 0x0d85, 0x080c, 0xd65d,
-- 0x6003, 0x0002, 0x080c, 0x9ab3, 0x0804, 0xdf35, 0x9006, 0x080c,
-- 0x66e6, 0x0804, 0xdf33, 0x080c, 0x6c09, 0x1904, 0xdf33, 0x9006,
-- 0x080c, 0x66e6, 0x6010, 0x2058, 0xb810, 0x9086, 0x00ff, 0x1140,
-- 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x00b8,
-- 0x6010, 0x2058, 0xb884, 0x9005, 0x0904, 0xdf33, 0x080c, 0x347d,
-- 0x1904, 0xdf33, 0x2001, 0x1800, 0x2004, 0x9086, 0x0002, 0x1138,
-- 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x2001,
-- 0x0002, 0x080c, 0x66fa, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-- 0x0002, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x6110, 0x2158, 0x2009,
-- 0x0001, 0x080c, 0x89a1, 0x0804, 0xdf35, 0x6610, 0x2658, 0xbe04,
-- 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0148, 0x9686, 0x0004,
-- 0x0130, 0x080c, 0x9228, 0x2001, 0x0004, 0x080c, 0x6726, 0x080c,
-- 0xee9d, 0x0904, 0xdf33, 0x2001, 0x0004, 0x080c, 0x66fa, 0x6023,
-- 0x0001, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x961e, 0x0804,
-- 0xdf35, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036,
-- 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4e58,
-- 0x004e, 0x003e, 0x2001, 0x0006, 0x080c, 0xdf4f, 0x6610, 0x2658,
-- 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x006e,
-- 0x0180, 0x2001, 0x0006, 0x080c, 0x6726, 0x9284, 0x00ff, 0x908e,
-- 0x0007, 0x0118, 0x908e, 0x0004, 0x1120, 0x2001, 0x0006, 0x080c,
-- 0x66fa, 0x080c, 0x6c09, 0x11f8, 0x2001, 0x1837, 0x2004, 0xd0a4,
-- 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0, 0x00f6,
-- 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0804, 0xdea7,
-- 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0409, 0x0020, 0x0018,
-- 0x0010, 0x080c, 0x6726, 0x080c, 0xb16c, 0x0005, 0x2600, 0x0002,
-- 0xdf4a, 0xdf4a, 0xdf4a, 0xdf4a, 0xdf4a, 0xdf4c, 0xdf4a, 0xdf4c,
-- 0xdf4a, 0xdf4a, 0xdf4c, 0xdf4a, 0xdf4a, 0xdf4a, 0xdf4c, 0xdf4c,
-- 0xdf4c, 0xdf4c, 0x080c, 0x0d85, 0x080c, 0xb16c, 0x0005, 0x0016,
-- 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138, 0x080c,
-- 0x66fa, 0x9006, 0x080c, 0x66e6, 0x080c, 0x3344, 0x00de, 0x00be,
-- 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00, 0x8007,
-- 0x90b2, 0x000c, 0x1a0c, 0x0d85, 0x91b6, 0x0015, 0x1110, 0x003b,
-- 0x0028, 0x91b6, 0x0016, 0x190c, 0x0d85, 0x006b, 0x0005, 0xbc45,
-- 0xbc45, 0xbc45, 0xbc45, 0xdfe4, 0xbc45, 0xdfce, 0xdf8f, 0xbc45,
-- 0xbc45, 0xbc45, 0xbc45, 0xbc45, 0xbc45, 0xbc45, 0xbc45, 0xdfe4,
-- 0xbc45, 0xdfce, 0xdfd5, 0xbc45, 0xbc45, 0xbc45, 0xbc45, 0x00f6,
-- 0x080c, 0x6c09, 0x11d8, 0x080c, 0xd645, 0x11c0, 0x6010, 0x905d,
-- 0x01a8, 0xb884, 0x9005, 0x0190, 0x9006, 0x080c, 0x66e6, 0x2001,
-- 0x0002, 0x080c, 0x66fa, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-- 0x0002, 0x080c, 0x961e, 0x080c, 0x9ab3, 0x00f0, 0x2011, 0x0263,
-- 0x2204, 0x8211, 0x220c, 0x080c, 0x268c, 0x11b0, 0x080c, 0x67b4,
-- 0x0118, 0x080c, 0xb16c, 0x0080, 0xb810, 0x0006, 0xb814, 0x0006,
-- 0xb884, 0x0006, 0x080c, 0x61b7, 0x000e, 0xb886, 0x000e, 0xb816,
-- 0x000e, 0xb812, 0x080c, 0xb16c, 0x00fe, 0x0005, 0x6604, 0x96b6,
-- 0x001e, 0x1110, 0x080c, 0xb16c, 0x0005, 0x080c, 0xc082, 0x1148,
-- 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x961e, 0x080c, 0x9ab3,
-- 0x0010, 0x080c, 0xb16c, 0x0005, 0x0804, 0xb16c, 0x6004, 0x908a,
-- 0x0053, 0x1a0c, 0x0d85, 0x080c, 0x99ed, 0x080c, 0xb1a7, 0x0005,
-- 0x9182, 0x0040, 0x0002, 0xe007, 0xe007, 0xe007, 0xe007, 0xe009,
-- 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0xe007,
-- 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0xe007, 0x080c,
-- 0x0d85, 0x0096, 0x00b6, 0x00d6, 0x00e6, 0x00f6, 0x0046, 0x0026,
-- 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11b0, 0x6007, 0x0044, 0x2071,
-- 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xe070, 0x080c, 0xee42,
-- 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001, 0x2011, 0x0200,
-- 0x080c, 0x8c44, 0x0020, 0x9026, 0x080c, 0xecc5, 0x0c30, 0x080c,
-- 0x1059, 0x090c, 0x0d85, 0x6003, 0x0007, 0xa867, 0x010d, 0x9006,
-- 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008, 0xa8e2, 0x6010,
-- 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876, 0xa87f, 0x0000,
-- 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x7012, 0x001e, 0x080c,
-- 0xee42, 0x1904, 0xe0d0, 0x9486, 0x2000, 0x1130, 0x2019, 0x0017,
-- 0x080c, 0xe9f9, 0x0804, 0xe0d0, 0x9486, 0x0200, 0x1120, 0x080c,
-- 0xe984, 0x0804, 0xe0d0, 0x9486, 0x0400, 0x0120, 0x9486, 0x1000,
-- 0x1904, 0xe0d0, 0x2019, 0x0002, 0x080c, 0xe9a3, 0x0804, 0xe0d0,
-- 0x2069, 0x1a73, 0x6a00, 0xd284, 0x0904, 0xe13a, 0x9284, 0x0300,
-- 0x1904, 0xe133, 0x6804, 0x9005, 0x0904, 0xe11b, 0x2d78, 0x6003,
-- 0x0007, 0x080c, 0x1072, 0x0904, 0xe0dc, 0x7800, 0xd08c, 0x1118,
-- 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001, 0x180f, 0x2004,
-- 0xd084, 0x1904, 0xe13e, 0x9006, 0xa802, 0xa867, 0x0116, 0xa86a,
-- 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058, 0xb8a0, 0x7130,
-- 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be, 0xb930, 0xa9c2,
-- 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084, 0x0003, 0x9080,
-- 0xe0d8, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001, 0x0270, 0xaa5c,
-- 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080, 0x20e1, 0x0000,
-- 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b, 0x0000, 0x2001,
-- 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae, 0x080c, 0x7015,
-- 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be, 0x009e, 0x0005,
-- 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810, 0x2004, 0xd084,
-- 0x0120, 0x080c, 0x1059, 0x1904, 0xe085, 0x6017, 0xf100, 0x6003,
-- 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x9617, 0x0c00,
-- 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086, 0x1200, 0x1198,
-- 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c, 0xf700, 0x910d,
-- 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043, 0x2009, 0xa025,
-- 0x080c, 0x9617, 0x0828, 0x6868, 0x602e, 0x686c, 0x6032, 0x6017,
-- 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c,
-- 0x9617, 0x0804, 0xe0d0, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120,
-- 0x2011, 0x8049, 0x080c, 0x4ca1, 0x6017, 0xf300, 0x0010, 0x6017,
-- 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c,
-- 0x9617, 0x0804, 0xe0d0, 0x6017, 0xf500, 0x0c98, 0x6017, 0xf600,
-- 0x0804, 0xe0f0, 0x6017, 0xf200, 0x0804, 0xe0f0, 0xa867, 0x0146,
-- 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a, 0x7044, 0x9084,
-- 0x0003, 0x9080, 0xe0d8, 0x2005, 0xa87e, 0x2928, 0x6010, 0x2058,
-- 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e, 0xb830, 0xa892,
-- 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205, 0x2104, 0x9085,
-- 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210, 0x2214, 0x9294,
-- 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0d85, 0x8210, 0x821c,
-- 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0029,
-- 0x20a0, 0x2011, 0xe1ba, 0x2041, 0x0001, 0x223d, 0x9784, 0x00ff,
-- 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a, 0x0530, 0x8210,
-- 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260, 0x2098, 0x0c68,
-- 0x2950, 0x080c, 0x1072, 0x0170, 0x2900, 0xb002, 0xa867, 0x0147,
-- 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0,
-- 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118, 0x080c, 0x108b,
-- 0x0cc8, 0x080c, 0x108b, 0x0804, 0xe0dc, 0x2548, 0x8847, 0x9885,
-- 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000, 0x080c, 0xea30,
-- 0x0804, 0xe0d0, 0x8010, 0x0004, 0x801a, 0x0006, 0x8018, 0x0008,
-- 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a,
-- 0x0057, 0x1a0c, 0x0d85, 0x9082, 0x0040, 0x0a0c, 0x0d85, 0x2008,
-- 0x0804, 0xe246, 0x9186, 0x0051, 0x0108, 0x0040, 0x080c, 0xaf61,
-- 0x01e8, 0x9086, 0x0002, 0x0904, 0xe28e, 0x00c0, 0x9186, 0x0027,
-- 0x0180, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014, 0x0150, 0x190c,
-- 0x0d85, 0x080c, 0xaf61, 0x0150, 0x9086, 0x0004, 0x0904, 0xe32d,
-- 0x0028, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a, 0x080c, 0xb227,
-- 0x0005, 0xe20d, 0xe20f, 0xe20f, 0xe236, 0xe20d, 0xe20d, 0xe20d,
-- 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0xe20d,
-- 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0xe20d, 0x080c, 0x0d85, 0x080c,
-- 0x99ed, 0x080c, 0x9ab3, 0x0036, 0x0096, 0x6014, 0x904d, 0x01d8,
-- 0x080c, 0xcf1b, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6, 0x2058,
-- 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c, 0xea30,
-- 0x6017, 0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1987, 0x2004,
-- 0x601a, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x0096, 0x080c,
-- 0x99ed, 0x080c, 0x9ab3, 0x080c, 0xcf1b, 0x0120, 0x6014, 0x2048,
-- 0x080c, 0x108b, 0x080c, 0xb1a7, 0x009e, 0x0005, 0x0002, 0xe25b,
-- 0xe270, 0xe25d, 0xe285, 0xe25b, 0xe25b, 0xe25b, 0xe25b, 0xe25b,
-- 0xe25b, 0xe25b, 0xe25b, 0xe25b, 0xe25b, 0xe25b, 0xe25b, 0xe25b,
-- 0xe25b, 0xe25b, 0xe25b, 0x080c, 0x0d85, 0x0096, 0x6014, 0x2048,
-- 0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c,
-- 0xb20a, 0x0010, 0x6003, 0x0004, 0x080c, 0x9ab3, 0x009e, 0x0005,
-- 0x080c, 0xcf1b, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c, 0x009e,
-- 0xd1ec, 0x1138, 0x080c, 0x8c19, 0x080c, 0xb16c, 0x080c, 0x9ab3,
-- 0x0005, 0x080c, 0xec89, 0x0db0, 0x0cc8, 0x6003, 0x0001, 0x6007,
-- 0x0041, 0x2009, 0xa022, 0x080c, 0x9617, 0x0005, 0x9182, 0x0040,
-- 0x0002, 0xe2a5, 0xe2a7, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5,
-- 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5, 0xe2a5,
-- 0xe2a5, 0xe2a5, 0xe2a8, 0xe2a5, 0xe2a5, 0x080c, 0x0d85, 0x0005,
-- 0x00d6, 0x080c, 0x8c19, 0x00de, 0x080c, 0xece1, 0x080c, 0xb16c,
-- 0x0005, 0x9182, 0x0040, 0x0002, 0xe2c8, 0xe2c8, 0xe2c8, 0xe2c8,
-- 0xe2c8, 0xe2c8, 0xe2c8, 0xe2c8, 0xe2c8, 0xe2ca, 0xe2f5, 0xe2c8,
-- 0xe2c8, 0xe2c8, 0xe2c8, 0xe2f5, 0xe2c8, 0xe2c8, 0xe2c8, 0xe2c8,
-- 0x080c, 0x0d85, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0168,
-- 0x908c, 0x0003, 0x918e, 0x0002, 0x0180, 0x6144, 0xd1e4, 0x1168,
-- 0x2009, 0x0041, 0x009e, 0x0804, 0xe3b5, 0x6003, 0x0007, 0x601b,
-- 0x0000, 0x080c, 0x8c19, 0x009e, 0x0005, 0x6014, 0x2048, 0xa97c,
-- 0xd1ec, 0x1130, 0x080c, 0x8c19, 0x080c, 0xb16c, 0x009e, 0x0005,
-- 0x080c, 0xec89, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c, 0x200c,
-- 0xc1d4, 0x2102, 0x0036, 0x080c, 0x9a48, 0x080c, 0x9ab3, 0x6014,
-- 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-- 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140, 0xa8ac,
-- 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e, 0x6003,
-- 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xea30, 0x6018, 0x9005,
-- 0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017, 0x0000,
-- 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002,
-- 0xe344, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344,
-- 0xe346, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344, 0xe344,
-- 0xe344, 0xe344, 0xe344, 0xe391, 0x080c, 0x0d85, 0x6014, 0x0096,
-- 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
-- 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128, 0x2009,
-- 0x0041, 0x009e, 0x0804, 0xe3b5, 0x6003, 0x0007, 0x601b, 0x0000,
-- 0x080c, 0x8c19, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58, 0x0006,
-- 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030, 0x9420,
-- 0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8, 0x6110,
-- 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009, 0x180e,
-- 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003, 0x0006,
-- 0x00e9, 0x080c, 0x8c1b, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e,
-- 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x16b0, 0x1904, 0xe346,
-- 0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e, 0x9105,
-- 0x1120, 0x080c, 0x16b0, 0x1904, 0xe346, 0x0005, 0xd2fc, 0x0140,
-- 0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009, 0x0010,
-- 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040, 0x0208,
-- 0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d85,
-- 0x6024, 0xd0dc, 0x090c, 0x0d85, 0x0005, 0xe3d9, 0xe3e5, 0xe3f1,
-- 0xe3fd, 0xe3d9, 0xe3d9, 0xe3d9, 0xe3d9, 0xe3e0, 0xe3db, 0xe3db,
-- 0xe3d9, 0xe3d9, 0xe3d9, 0xe3d9, 0xe3db, 0xe3d9, 0xe3db, 0xe3d9,
-- 0xe3e0, 0x080c, 0x0d85, 0x6024, 0xd0dc, 0x090c, 0x0d85, 0x0005,
-- 0x6014, 0x9005, 0x190c, 0x0d85, 0x0005, 0x6003, 0x0001, 0x6106,
-- 0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x95f9, 0x012e,
-- 0x0005, 0x6003, 0x0004, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009,
-- 0xa001, 0x080c, 0x9617, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106,
-- 0x6047, 0x0000, 0x080c, 0x1c6f, 0x0126, 0x2091, 0x8000, 0x6014,
-- 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x9084, 0x0003, 0x9086,
-- 0x0002, 0x01a0, 0x6024, 0xd0cc, 0x1148, 0xd0c4, 0x1138, 0xa8a8,
-- 0x9005, 0x1120, 0x6144, 0x918d, 0xb035, 0x0018, 0x6144, 0x918d,
-- 0xa035, 0x009e, 0x080c, 0x965e, 0x012e, 0x0005, 0x6144, 0x918d,
-- 0xa032, 0x0cb8, 0x0126, 0x2091, 0x8000, 0x0036, 0x0096, 0x9182,
-- 0x0040, 0x0023, 0x009e, 0x003e, 0x012e, 0x0005, 0xe44a, 0xe44c,
-- 0xe461, 0xe47b, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a,
-- 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a, 0xe44a,
-- 0xe44a, 0xe44a, 0x080c, 0x0d85, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-- 0x0510, 0x909c, 0x0003, 0x939e, 0x0003, 0x01e8, 0x6003, 0x0001,
-- 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x9617,
-- 0x0480, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c, 0x0003,
-- 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x2009, 0xa001,
-- 0x080c, 0x9617, 0x00f0, 0x901e, 0x6316, 0x631a, 0x2019, 0x0004,
-- 0x080c, 0xea30, 0x00b0, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98,
-- 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003, 0x6106,
-- 0x6047, 0x0000, 0x080c, 0x1c6f, 0x6144, 0x918d, 0xa035, 0x080c,
-- 0x965e, 0x0005, 0x080c, 0x99ed, 0x6114, 0x81ff, 0x0158, 0x0096,
-- 0x2148, 0x080c, 0xeddf, 0x0036, 0x2019, 0x0029, 0x080c, 0xea30,
-- 0x003e, 0x009e, 0x080c, 0xb1a7, 0x080c, 0x9ab3, 0x0005, 0x080c,
-- 0x9a48, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xeddf,
-- 0x0036, 0x2019, 0x0029, 0x080c, 0xea30, 0x003e, 0x009e, 0x080c,
-- 0xb1a7, 0x0005, 0x9182, 0x0085, 0x0002, 0xe4cc, 0xe4ca, 0xe4ca,
-- 0xe4d8, 0xe4ca, 0xe4ca, 0xe4ca, 0xe4ca, 0xe4ca, 0xe4ca, 0xe4ca,
-- 0xe4ca, 0xe4ca, 0x080c, 0x0d85, 0x6003, 0x000b, 0x6106, 0x0126,
-- 0x2091, 0x8000, 0x2009, 0x8020, 0x080c, 0x9617, 0x012e, 0x0005,
-- 0x0026, 0x00e6, 0x080c, 0xec80, 0x0118, 0x080c, 0xb16c, 0x0440,
-- 0x2071, 0x0260, 0x7224, 0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4,
-- 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011,
-- 0x014e, 0x080c, 0xb495, 0x7220, 0x080c, 0xe875, 0x0118, 0x6007,
-- 0x0086, 0x0040, 0x6007, 0x0087, 0x7224, 0x9296, 0xffff, 0x1110,
-- 0x6007, 0x0086, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617,
-- 0x00ee, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a,
-- 0x0085, 0x0a0c, 0x0d85, 0x908a, 0x0092, 0x1a0c, 0x0d85, 0x9082,
-- 0x0085, 0x00a2, 0x9186, 0x0027, 0x0130, 0x9186, 0x0014, 0x0118,
-- 0x080c, 0xb227, 0x0050, 0x2001, 0x0007, 0x080c, 0x6726, 0x080c,
-- 0x99ed, 0x080c, 0xb1a7, 0x080c, 0x9ab3, 0x0005, 0xe53b, 0xe53d,
-- 0xe53d, 0xe53b, 0xe53b, 0xe53b, 0xe53b, 0xe53b, 0xe53b, 0xe53b,
-- 0xe53b, 0xe53b, 0xe53b, 0x080c, 0x0d85, 0x080c, 0xb1a7, 0x080c,
-- 0x9ab3, 0x0005, 0x9182, 0x0085, 0x0a0c, 0x0d85, 0x9182, 0x0092,
-- 0x1a0c, 0x0d85, 0x9182, 0x0085, 0x0002, 0xe55a, 0xe55a, 0xe55a,
-- 0xe55c, 0xe55a, 0xe55a, 0xe55a, 0xe55a, 0xe55a, 0xe55a, 0xe55a,
-- 0xe55a, 0xe55a, 0x080c, 0x0d85, 0x0005, 0x9186, 0x0013, 0x0148,
-- 0x9186, 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xb227,
-- 0x0020, 0x080c, 0x99ed, 0x080c, 0xb1a7, 0x0005, 0x0036, 0x080c,
-- 0xece1, 0x604b, 0x0000, 0x2019, 0x000b, 0x0011, 0x003e, 0x0005,
-- 0x6010, 0x0006, 0x0059, 0x000e, 0x6012, 0x6023, 0x0006, 0x6003,
-- 0x0007, 0x601b, 0x0000, 0x604b, 0x0000, 0x0005, 0x0126, 0x0036,
-- 0x2091, 0x8000, 0x080c, 0xacfc, 0x0106, 0x0086, 0x2c40, 0x0096,
-- 0x904e, 0x080c, 0xa667, 0x009e, 0x008e, 0x1558, 0x0076, 0x2c38,
-- 0x080c, 0xa712, 0x007e, 0x1528, 0x6000, 0x9086, 0x0000, 0x0508,
-- 0x6020, 0x9086, 0x0007, 0x01e8, 0x0096, 0x601c, 0xd084, 0x0140,
-- 0x080c, 0xece1, 0x080c, 0xd65d, 0x080c, 0x1ad3, 0x6023, 0x0007,
-- 0x6014, 0x2048, 0x080c, 0xcf1b, 0x0110, 0x080c, 0xea30, 0x009e,
-- 0x9006, 0x6046, 0x6016, 0x080c, 0xece1, 0x6023, 0x0007, 0x080c,
-- 0xd65d, 0x010e, 0x090c, 0xad18, 0x003e, 0x012e, 0x0005, 0x00f6,
-- 0x00c6, 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c,
-- 0x080c, 0x268c, 0x1904, 0xe621, 0x0016, 0x00c6, 0x080c, 0x67b4,
-- 0x1904, 0xe61f, 0x001e, 0x00c6, 0x080c, 0xd645, 0x1130, 0xb884,
-- 0x9005, 0x0118, 0x080c, 0x347d, 0x0148, 0x2b10, 0x2160, 0x6010,
-- 0x0006, 0x6212, 0x080c, 0xd64c, 0x000e, 0x6012, 0x00ce, 0x002e,
-- 0x0026, 0x0016, 0x080c, 0xacfc, 0x2019, 0x0029, 0x080c, 0xa7e2,
-- 0x080c, 0x97b0, 0x0076, 0x903e, 0x080c, 0x966d, 0x007e, 0x001e,
-- 0x0076, 0x903e, 0x080c, 0xe75d, 0x007e, 0x080c, 0xad18, 0x0026,
-- 0xba04, 0x9294, 0xff00, 0x8217, 0x9286, 0x0006, 0x0118, 0x9286,
-- 0x0004, 0x1118, 0xbaa0, 0x080c, 0x33e0, 0x002e, 0xbc84, 0x001e,
-- 0x080c, 0x61b7, 0xbe12, 0xbd16, 0xbc86, 0x9006, 0x0010, 0x00ce,
-- 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce, 0x00fe, 0x0005, 0x00c6,
-- 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1824, 0x2104, 0x9086, 0x0074,
-- 0x1904, 0xe680, 0x2069, 0x0260, 0x6944, 0x9182, 0x0100, 0x06e0,
-- 0x6940, 0x9184, 0x8000, 0x0904, 0xe67d, 0x2001, 0x197c, 0x2004,
-- 0x9005, 0x1140, 0x6010, 0x2058, 0xb884, 0x9005, 0x0118, 0x9184,
-- 0x0800, 0x0598, 0x6948, 0x918a, 0x0001, 0x0648, 0x080c, 0xee47,
-- 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009, 0x0205, 0x200b, 0x0001,
-- 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182, 0x0100, 0x02a8, 0x6940,
-- 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001, 0x0288, 0x6950, 0x918a,
-- 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100, 0x00a0, 0x6017, 0x0300,
-- 0x0088, 0x6017, 0x0500, 0x0070, 0x6017, 0x0700, 0x0058, 0x6017,
-- 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028, 0x6017, 0x0f00, 0x0010,
-- 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008, 0x9006, 0x001e, 0x00be,
-- 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6, 0x0026, 0x0036, 0x0156,
-- 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff, 0x9286, 0x0006, 0x0180,
-- 0x9286, 0x0004, 0x0168, 0x9394, 0xff00, 0x8217, 0x9286, 0x0006,
-- 0x0138, 0x9286, 0x0004, 0x0120, 0x080c, 0x67c3, 0x0804, 0xe6ec,
-- 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a,
-- 0x080c, 0xc222, 0x009e, 0x15c8, 0x2011, 0x027a, 0x20a9, 0x0004,
-- 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xc222, 0x009e, 0x1568,
-- 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x1848, 0x210c,
-- 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c, 0xea8d, 0xb800, 0xc0e5,
-- 0xb802, 0x080c, 0xacfc, 0x2019, 0x0029, 0x080c, 0x97b0, 0x0076,
-- 0x2039, 0x0000, 0x080c, 0x966d, 0x2c08, 0x080c, 0xe75d, 0x007e,
-- 0x080c, 0xad18, 0x2001, 0x0007, 0x080c, 0x6726, 0x2001, 0x0007,
-- 0x080c, 0x66fa, 0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e,
-- 0x00be, 0x00ce, 0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086,
-- 0x0800, 0x0118, 0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005,
-- 0x00b6, 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c,
-- 0x7930, 0x7834, 0x080c, 0x268c, 0x11d0, 0x080c, 0x67b4, 0x11b8,
-- 0x2011, 0x0270, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a,
-- 0x080c, 0xc222, 0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004,
-- 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xc222, 0x009e, 0x015e,
-- 0x003e, 0x002e, 0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006,
-- 0x0016, 0x0026, 0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211,
-- 0x220c, 0x080c, 0x268c, 0x11d0, 0x080c, 0x67b4, 0x11b8, 0x2011,
-+ 0x0148, 0x9686, 0x0004, 0x0130, 0x080c, 0x9218, 0x2001, 0x0004,
-+ 0x080c, 0x671f, 0x080c, 0xee84, 0x0904, 0xdf1e, 0x2001, 0x0004,
-+ 0x080c, 0x66f3, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0003,
-+ 0x080c, 0x960e, 0x0804, 0xdf20, 0x2001, 0x1800, 0x2004, 0x9086,
-+ 0x0003, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021,
-+ 0x0006, 0x080c, 0x4e56, 0x004e, 0x003e, 0x2001, 0x0006, 0x080c,
-+ 0xdf3a, 0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637,
-+ 0x9686, 0x0006, 0x006e, 0x0180, 0x2001, 0x0006, 0x080c, 0x671f,
-+ 0x9284, 0x00ff, 0x908e, 0x0007, 0x0118, 0x908e, 0x0004, 0x1120,
-+ 0x2001, 0x0006, 0x080c, 0x66f3, 0x080c, 0x6bf9, 0x11f8, 0x2001,
-+ 0x1837, 0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686,
-+ 0x0006, 0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa,
-+ 0x00fe, 0x0804, 0xde92, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006,
-+ 0x0409, 0x0020, 0x0018, 0x0010, 0x080c, 0x671f, 0x080c, 0xb157,
-+ 0x0005, 0x2600, 0x0002, 0xdf35, 0xdf35, 0xdf35, 0xdf35, 0xdf35,
-+ 0xdf37, 0xdf35, 0xdf37, 0xdf35, 0xdf35, 0xdf37, 0xdf35, 0xdf35,
-+ 0xdf35, 0xdf37, 0xdf37, 0xdf37, 0xdf37, 0x080c, 0x0d85, 0x080c,
-+ 0xb157, 0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900,
-+ 0xd184, 0x0138, 0x080c, 0x66f3, 0x9006, 0x080c, 0x66df, 0x080c,
-+ 0x3344, 0x00de, 0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804,
-+ 0x9084, 0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0d85, 0x91b6,
-+ 0x0015, 0x1110, 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0d85,
-+ 0x006b, 0x0005, 0xbc30, 0xbc30, 0xbc30, 0xbc30, 0xdfcf, 0xbc30,
-+ 0xdfb9, 0xdf7a, 0xbc30, 0xbc30, 0xbc30, 0xbc30, 0xbc30, 0xbc30,
-+ 0xbc30, 0xbc30, 0xdfcf, 0xbc30, 0xdfb9, 0xdfc0, 0xbc30, 0xbc30,
-+ 0xbc30, 0xbc30, 0x00f6, 0x080c, 0x6bf9, 0x11d8, 0x080c, 0xd632,
-+ 0x11c0, 0x6010, 0x905d, 0x01a8, 0xb884, 0x9005, 0x0190, 0x9006,
-+ 0x080c, 0x66df, 0x2001, 0x0002, 0x080c, 0x66f3, 0x6023, 0x0001,
-+ 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x960e, 0x080c, 0x9aa3,
-+ 0x00f0, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x268c,
-+ 0x11b0, 0x080c, 0x67ad, 0x0118, 0x080c, 0xb157, 0x0080, 0xb810,
-+ 0x0006, 0xb814, 0x0006, 0xb884, 0x0006, 0x080c, 0x61b0, 0x000e,
-+ 0xb886, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c, 0xb157, 0x00fe,
-+ 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c, 0xb157, 0x0005,
-+ 0x080c, 0xc06d, 0x1148, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-+ 0x960e, 0x080c, 0x9aa3, 0x0010, 0x080c, 0xb157, 0x0005, 0x0804,
-+ 0xb157, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d85, 0x080c, 0x99dd,
-+ 0x080c, 0xb192, 0x0005, 0x9182, 0x0040, 0x0002, 0xdff2, 0xdff2,
-+ 0xdff2, 0xdff2, 0xdff4, 0xdff2, 0xdff2, 0xdff2, 0xdff2, 0xdff2,
-+ 0xdff2, 0xdff2, 0xdff2, 0xdff2, 0xdff2, 0xdff2, 0xdff2, 0xdff2,
-+ 0xdff2, 0xdff2, 0x080c, 0x0d85, 0x0096, 0x00b6, 0x00d6, 0x00e6,
-+ 0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11b0,
-+ 0x6007, 0x0044, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904,
-+ 0xe05b, 0x080c, 0xee29, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009,
-+ 0x0001, 0x2011, 0x0200, 0x080c, 0x8c34, 0x0020, 0x9026, 0x080c,
-+ 0xecac, 0x0c30, 0x080c, 0x1059, 0x090c, 0x0d85, 0x6003, 0x0007,
-+ 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e,
-+ 0x6008, 0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016,
-+ 0xa876, 0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c,
-+ 0x7002, 0x001e, 0x080c, 0xee29, 0x1904, 0xe0bb, 0x9486, 0x2000,
-+ 0x1130, 0x2019, 0x0017, 0x080c, 0xe9e0, 0x0804, 0xe0bb, 0x9486,
-+ 0x0200, 0x1120, 0x080c, 0xe96b, 0x0804, 0xe0bb, 0x9486, 0x0400,
-+ 0x0120, 0x9486, 0x1000, 0x1904, 0xe0bb, 0x2019, 0x0002, 0x080c,
-+ 0xe98a, 0x0804, 0xe0bb, 0x2069, 0x1a73, 0x6a00, 0xd284, 0x0904,
-+ 0xe125, 0x9284, 0x0300, 0x1904, 0xe11e, 0x6804, 0x9005, 0x0904,
-+ 0xe106, 0x2d78, 0x6003, 0x0007, 0x080c, 0x1072, 0x0904, 0xe0c7,
-+ 0x7800, 0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000,
-+ 0x2001, 0x180f, 0x2004, 0xd084, 0x1904, 0xe129, 0x9006, 0xa802,
-+ 0xa867, 0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010,
-+ 0x2058, 0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c,
-+ 0xa9be, 0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044,
-+ 0x9084, 0x0003, 0x9080, 0xe0c3, 0x2005, 0xa87e, 0x20a9, 0x000a,
-+ 0x2001, 0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b,
-+ 0x0080, 0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003,
-+ 0x200b, 0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c,
-+ 0xa9ae, 0x080c, 0x7005, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de,
-+ 0x00be, 0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001,
-+ 0x1810, 0x2004, 0xd084, 0x0120, 0x080c, 0x1059, 0x1904, 0xe070,
-+ 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022,
-+ 0x080c, 0x9607, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00,
-+ 0x9086, 0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114,
-+ 0x918c, 0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007,
-+ 0x0043, 0x2009, 0xa025, 0x080c, 0x9607, 0x0828, 0x6868, 0x602e,
-+ 0x686c, 0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041,
-+ 0x2009, 0xa022, 0x080c, 0x9607, 0x0804, 0xe0bb, 0x2001, 0x180e,
-+ 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4c9f, 0x6017,
-+ 0xf300, 0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041,
-+ 0x2009, 0xa022, 0x080c, 0x9607, 0x0804, 0xe0bb, 0x6017, 0xf500,
-+ 0x0c98, 0x6017, 0xf600, 0x0804, 0xe0db, 0x6017, 0xf200, 0x0804,
-+ 0xe0db, 0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00,
-+ 0xa87a, 0x7044, 0x9084, 0x0003, 0x9080, 0xe0c3, 0x2005, 0xa87e,
-+ 0x2928, 0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c,
-+ 0xa88e, 0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009,
-+ 0x0205, 0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011,
-+ 0x0210, 0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c,
-+ 0x0d85, 0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x0029, 0x20a0, 0x2011, 0xe1a5, 0x2041, 0x0001,
-+ 0x223d, 0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003,
-+ 0x931a, 0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001,
-+ 0x0260, 0x2098, 0x0c68, 0x2950, 0x080c, 0x1072, 0x0170, 0x2900,
-+ 0xb002, 0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c,
-+ 0x9080, 0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d,
-+ 0x0118, 0x080c, 0x108b, 0x0cc8, 0x080c, 0x108b, 0x0804, 0xe0c7,
-+ 0x2548, 0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b,
-+ 0x0000, 0x080c, 0xea17, 0x0804, 0xe0bb, 0x8010, 0x0004, 0x801a,
-+ 0x0006, 0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013,
-+ 0x1160, 0x6004, 0x908a, 0x0057, 0x1a0c, 0x0d85, 0x9082, 0x0040,
-+ 0x0a0c, 0x0d85, 0x2008, 0x0804, 0xe231, 0x9186, 0x0051, 0x0108,
-+ 0x0040, 0x080c, 0xaf4c, 0x01e8, 0x9086, 0x0002, 0x0904, 0xe279,
-+ 0x00c0, 0x9186, 0x0027, 0x0180, 0x9186, 0x0048, 0x0128, 0x9186,
-+ 0x0014, 0x0150, 0x190c, 0x0d85, 0x080c, 0xaf4c, 0x0150, 0x9086,
-+ 0x0004, 0x0904, 0xe318, 0x0028, 0x6004, 0x9082, 0x0040, 0x2008,
-+ 0x001a, 0x080c, 0xb212, 0x0005, 0xe1f8, 0xe1fa, 0xe1fa, 0xe221,
-+ 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8,
-+ 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8, 0xe1f8,
-+ 0x080c, 0x0d85, 0x080c, 0x99dd, 0x080c, 0x9aa3, 0x0036, 0x0096,
-+ 0x6014, 0x904d, 0x01d8, 0x080c, 0xcf08, 0x01c0, 0x6003, 0x0002,
-+ 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019,
-+ 0x0004, 0x080c, 0xea17, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120,
-+ 0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x0007, 0x009e, 0x003e,
-+ 0x0005, 0x0096, 0x080c, 0x99dd, 0x080c, 0x9aa3, 0x080c, 0xcf08,
-+ 0x0120, 0x6014, 0x2048, 0x080c, 0x108b, 0x080c, 0xb192, 0x009e,
-+ 0x0005, 0x0002, 0xe246, 0xe25b, 0xe248, 0xe270, 0xe246, 0xe246,
-+ 0xe246, 0xe246, 0xe246, 0xe246, 0xe246, 0xe246, 0xe246, 0xe246,
-+ 0xe246, 0xe246, 0xe246, 0xe246, 0xe246, 0xe246, 0x080c, 0x0d85,
-+ 0x0096, 0x6014, 0x2048, 0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007,
-+ 0x2009, 0x0043, 0x080c, 0xb1f5, 0x0010, 0x6003, 0x0004, 0x080c,
-+ 0x9aa3, 0x009e, 0x0005, 0x080c, 0xcf08, 0x0138, 0x6114, 0x0096,
-+ 0x2148, 0xa97c, 0x009e, 0xd1ec, 0x1138, 0x080c, 0x8c09, 0x080c,
-+ 0xb157, 0x080c, 0x9aa3, 0x0005, 0x080c, 0xec70, 0x0db0, 0x0cc8,
-+ 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x9607,
-+ 0x0005, 0x9182, 0x0040, 0x0002, 0xe290, 0xe292, 0xe290, 0xe290,
-+ 0xe290, 0xe290, 0xe290, 0xe290, 0xe290, 0xe290, 0xe290, 0xe290,
-+ 0xe290, 0xe290, 0xe290, 0xe290, 0xe290, 0xe293, 0xe290, 0xe290,
-+ 0x080c, 0x0d85, 0x0005, 0x00d6, 0x080c, 0x8c09, 0x00de, 0x080c,
-+ 0xecc8, 0x080c, 0xb157, 0x0005, 0x9182, 0x0040, 0x0002, 0xe2b3,
-+ 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3,
-+ 0xe2b5, 0xe2e0, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2b3, 0xe2e0, 0xe2b3,
-+ 0xe2b3, 0xe2b3, 0xe2b3, 0x080c, 0x0d85, 0x6014, 0x0096, 0x2048,
-+ 0xa87c, 0xd0fc, 0x0168, 0x908c, 0x0003, 0x918e, 0x0002, 0x0180,
-+ 0x6144, 0xd1e4, 0x1168, 0x2009, 0x0041, 0x009e, 0x0804, 0xe3a0,
-+ 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8c09, 0x009e, 0x0005,
-+ 0x6014, 0x2048, 0xa97c, 0xd1ec, 0x1130, 0x080c, 0x8c09, 0x080c,
-+ 0xb157, 0x009e, 0x0005, 0x080c, 0xec70, 0x0db8, 0x009e, 0x0005,
-+ 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x9a38,
-+ 0x080c, 0x9aa3, 0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058,
-+ 0xb800, 0x00be, 0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086,
-+ 0x0002, 0x0140, 0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c,
-+ 0x931b, 0x632e, 0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c,
-+ 0xea17, 0x6018, 0x9005, 0x1128, 0x2001, 0x1987, 0x2004, 0x8003,
-+ 0x601a, 0x6017, 0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005,
-+ 0x9182, 0x0040, 0x0002, 0xe32f, 0xe32f, 0xe32f, 0xe32f, 0xe32f,
-+ 0xe32f, 0xe32f, 0xe32f, 0xe331, 0xe32f, 0xe32f, 0xe32f, 0xe32f,
-+ 0xe32f, 0xe32f, 0xe32f, 0xe32f, 0xe32f, 0xe32f, 0xe37c, 0x080c,
-+ 0x0d85, 0x6014, 0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6,
-+ 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c,
-+ 0xd0fc, 0x0128, 0x2009, 0x0041, 0x009e, 0x0804, 0xe3a0, 0x6003,
-+ 0x0007, 0x601b, 0x0000, 0x080c, 0x8c09, 0x009e, 0x0005, 0x6124,
-+ 0xd1f4, 0x1d58, 0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200,
-+ 0x910b, 0x6030, 0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e,
-+ 0x000e, 0x08d8, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc,
-+ 0x1178, 0x2009, 0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007,
-+ 0x0010, 0x6003, 0x0006, 0x00e9, 0x080c, 0x8c0b, 0x009e, 0x0005,
-+ 0x6003, 0x0002, 0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c,
-+ 0x16b0, 0x1904, 0xe331, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834,
-+ 0xa938, 0x009e, 0x9105, 0x1120, 0x080c, 0x16b0, 0x1904, 0xe331,
-+ 0x0005, 0xd2fc, 0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000,
-+ 0x2009, 0x0009, 0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005,
-+ 0x9182, 0x0040, 0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186,
-+ 0x0014, 0x190c, 0x0d85, 0x6024, 0xd0dc, 0x090c, 0x0d85, 0x0005,
-+ 0xe3c4, 0xe3d0, 0xe3dc, 0xe3e8, 0xe3c4, 0xe3c4, 0xe3c4, 0xe3c4,
-+ 0xe3cb, 0xe3c6, 0xe3c6, 0xe3c4, 0xe3c4, 0xe3c4, 0xe3c4, 0xe3c6,
-+ 0xe3c4, 0xe3c6, 0xe3c4, 0xe3cb, 0x080c, 0x0d85, 0x6024, 0xd0dc,
-+ 0x090c, 0x0d85, 0x0005, 0x6014, 0x9005, 0x190c, 0x0d85, 0x0005,
-+ 0x6003, 0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa022,
-+ 0x080c, 0x95e9, 0x012e, 0x0005, 0x6003, 0x0004, 0x6106, 0x0126,
-+ 0x2091, 0x8000, 0x2009, 0xa001, 0x080c, 0x9607, 0x012e, 0x0005,
-+ 0x6003, 0x0003, 0x6106, 0x080c, 0x1c6f, 0x0126, 0x2091, 0x8000,
-+ 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x9084, 0x0003,
-+ 0x9086, 0x0002, 0x01a0, 0x6024, 0xd0cc, 0x1148, 0xd0c4, 0x1138,
-+ 0xa8a8, 0x9005, 0x1120, 0x6144, 0x918d, 0xb035, 0x0018, 0x6144,
-+ 0x918d, 0xa035, 0x009e, 0x080c, 0x964e, 0x012e, 0x0005, 0x6144,
-+ 0x918d, 0xa032, 0x0cb8, 0x0126, 0x2091, 0x8000, 0x0036, 0x0096,
-+ 0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e, 0x0005, 0xe433,
-+ 0xe435, 0xe44a, 0xe464, 0xe433, 0xe433, 0xe433, 0xe433, 0xe433,
-+ 0xe433, 0xe433, 0xe433, 0xe433, 0xe433, 0xe433, 0xe433, 0xe433,
-+ 0xe433, 0xe433, 0xe433, 0x080c, 0x0d85, 0x6014, 0x2048, 0xa87c,
-+ 0xd0fc, 0x0510, 0x909c, 0x0003, 0x939e, 0x0003, 0x01e8, 0x6003,
-+ 0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c,
-+ 0x9607, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c,
-+ 0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x2009,
-+ 0xa001, 0x080c, 0x9607, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019,
-+ 0x0004, 0x080c, 0xea17, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-+ 0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003,
-+ 0x6106, 0x080c, 0x1c6f, 0x6144, 0x918d, 0xa035, 0x080c, 0x964e,
-+ 0x0005, 0x080c, 0x99dd, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148,
-+ 0x080c, 0xedc6, 0x0036, 0x2019, 0x0029, 0x080c, 0xea17, 0x003e,
-+ 0x009e, 0x080c, 0xb192, 0x080c, 0x9aa3, 0x0005, 0x080c, 0x9a38,
-+ 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xedc6, 0x0036,
-+ 0x2019, 0x0029, 0x080c, 0xea17, 0x003e, 0x009e, 0x080c, 0xb192,
-+ 0x0005, 0x9182, 0x0085, 0x0002, 0xe4b3, 0xe4b1, 0xe4b1, 0xe4bf,
-+ 0xe4b1, 0xe4b1, 0xe4b1, 0xe4b1, 0xe4b1, 0xe4b1, 0xe4b1, 0xe4b1,
-+ 0xe4b1, 0x080c, 0x0d85, 0x6003, 0x000b, 0x6106, 0x0126, 0x2091,
-+ 0x8000, 0x2009, 0x8020, 0x080c, 0x9607, 0x012e, 0x0005, 0x0026,
-+ 0x00e6, 0x080c, 0xec67, 0x0118, 0x080c, 0xb157, 0x0440, 0x2071,
-+ 0x0260, 0x7224, 0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4, 0x0150,
-+ 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e,
-+ 0x080c, 0xb480, 0x7220, 0x080c, 0xe85c, 0x0118, 0x6007, 0x0086,
-+ 0x0040, 0x6007, 0x0087, 0x7224, 0x9296, 0xffff, 0x1110, 0x6007,
-+ 0x0086, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607, 0x00ee,
-+ 0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085,
-+ 0x0a0c, 0x0d85, 0x908a, 0x0092, 0x1a0c, 0x0d85, 0x9082, 0x0085,
-+ 0x00a2, 0x9186, 0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c,
-+ 0xb212, 0x0050, 0x2001, 0x0007, 0x080c, 0x671f, 0x080c, 0x99dd,
-+ 0x080c, 0xb192, 0x080c, 0x9aa3, 0x0005, 0xe522, 0xe524, 0xe524,
-+ 0xe522, 0xe522, 0xe522, 0xe522, 0xe522, 0xe522, 0xe522, 0xe522,
-+ 0xe522, 0xe522, 0x080c, 0x0d85, 0x080c, 0xb192, 0x080c, 0x9aa3,
-+ 0x0005, 0x9182, 0x0085, 0x0a0c, 0x0d85, 0x9182, 0x0092, 0x1a0c,
-+ 0x0d85, 0x9182, 0x0085, 0x0002, 0xe541, 0xe541, 0xe541, 0xe543,
-+ 0xe541, 0xe541, 0xe541, 0xe541, 0xe541, 0xe541, 0xe541, 0xe541,
-+ 0xe541, 0x080c, 0x0d85, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186,
-+ 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xb212, 0x0020,
-+ 0x080c, 0x99dd, 0x080c, 0xb192, 0x0005, 0x0036, 0x080c, 0xecc8,
-+ 0x604b, 0x0000, 0x2019, 0x000b, 0x0011, 0x003e, 0x0005, 0x6010,
-+ 0x0006, 0x0059, 0x000e, 0x6012, 0x6023, 0x0006, 0x6003, 0x0007,
-+ 0x601b, 0x0000, 0x604b, 0x0000, 0x0005, 0x0126, 0x0036, 0x2091,
-+ 0x8000, 0x080c, 0xacec, 0x0106, 0x0086, 0x2c40, 0x0096, 0x904e,
-+ 0x080c, 0xa657, 0x009e, 0x008e, 0x1558, 0x0076, 0x2c38, 0x080c,
-+ 0xa702, 0x007e, 0x1528, 0x6000, 0x9086, 0x0000, 0x0508, 0x6020,
-+ 0x9086, 0x0007, 0x01e8, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c,
-+ 0xecc8, 0x080c, 0xd64a, 0x080c, 0x1ad3, 0x6023, 0x0007, 0x6014,
-+ 0x2048, 0x080c, 0xcf08, 0x0110, 0x080c, 0xea17, 0x009e, 0x9006,
-+ 0x6046, 0x6016, 0x080c, 0xecc8, 0x6023, 0x0007, 0x080c, 0xd64a,
-+ 0x010e, 0x090c, 0xad08, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6,
-+ 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c,
-+ 0x268c, 0x1904, 0xe608, 0x0016, 0x00c6, 0x080c, 0x67ad, 0x1904,
-+ 0xe606, 0x001e, 0x00c6, 0x080c, 0xd632, 0x1130, 0xb884, 0x9005,
-+ 0x0118, 0x080c, 0x347d, 0x0148, 0x2b10, 0x2160, 0x6010, 0x0006,
-+ 0x6212, 0x080c, 0xd639, 0x000e, 0x6012, 0x00ce, 0x002e, 0x0026,
-+ 0x0016, 0x080c, 0xacec, 0x2019, 0x0029, 0x080c, 0xa7d2, 0x080c,
-+ 0x97a0, 0x0076, 0x903e, 0x080c, 0x965d, 0x007e, 0x001e, 0x0076,
-+ 0x903e, 0x080c, 0xe744, 0x007e, 0x080c, 0xad08, 0x0026, 0xba04,
-+ 0x9294, 0xff00, 0x8217, 0x9286, 0x0006, 0x0118, 0x9286, 0x0004,
-+ 0x1118, 0xbaa0, 0x080c, 0x33e0, 0x002e, 0xbc84, 0x001e, 0x080c,
-+ 0x61b0, 0xbe12, 0xbd16, 0xbc86, 0x9006, 0x0010, 0x00ce, 0x001e,
-+ 0x015e, 0x003e, 0x00be, 0x00ce, 0x00fe, 0x0005, 0x00c6, 0x00d6,
-+ 0x00b6, 0x0016, 0x2009, 0x1824, 0x2104, 0x9086, 0x0074, 0x1904,
-+ 0xe667, 0x2069, 0x0260, 0x6944, 0x9182, 0x0100, 0x06e0, 0x6940,
-+ 0x9184, 0x8000, 0x0904, 0xe664, 0x2001, 0x197c, 0x2004, 0x9005,
-+ 0x1140, 0x6010, 0x2058, 0xb884, 0x9005, 0x0118, 0x9184, 0x0800,
-+ 0x0598, 0x6948, 0x918a, 0x0001, 0x0648, 0x080c, 0xee2e, 0x0118,
-+ 0x6978, 0xd1fc, 0x11b8, 0x2009, 0x0205, 0x200b, 0x0001, 0x693c,
-+ 0x81ff, 0x1198, 0x6944, 0x9182, 0x0100, 0x02a8, 0x6940, 0x81ff,
-+ 0x1178, 0x6948, 0x918a, 0x0001, 0x0288, 0x6950, 0x918a, 0x0001,
-+ 0x0298, 0x00d0, 0x6017, 0x0100, 0x00a0, 0x6017, 0x0300, 0x0088,
-+ 0x6017, 0x0500, 0x0070, 0x6017, 0x0700, 0x0058, 0x6017, 0x0900,
-+ 0x0040, 0x6017, 0x0b00, 0x0028, 0x6017, 0x0f00, 0x0010, 0x6017,
-+ 0x2d00, 0x9085, 0x0001, 0x0008, 0x9006, 0x001e, 0x00be, 0x00de,
-+ 0x00ce, 0x0005, 0x00c6, 0x00b6, 0x0026, 0x0036, 0x0156, 0x6210,
-+ 0x2258, 0xbb04, 0x9394, 0x00ff, 0x9286, 0x0006, 0x0180, 0x9286,
-+ 0x0004, 0x0168, 0x9394, 0xff00, 0x8217, 0x9286, 0x0006, 0x0138,
-+ 0x9286, 0x0004, 0x0120, 0x080c, 0x67bc, 0x0804, 0xe6d3, 0x2011,
- 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c,
-- 0xc222, 0x009e, 0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096,
-- 0x2b48, 0x2019, 0x0006, 0x080c, 0xc222, 0x009e, 0x015e, 0x003e,
-- 0x002e, 0x001e, 0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086,
-- 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000,
-- 0x080c, 0xad5a, 0x0106, 0x190c, 0xacfc, 0x2740, 0x2029, 0x19f4,
-- 0x252c, 0x2021, 0x19fb, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800,
-- 0x7654, 0x7074, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1b39, 0x000e,
-- 0x0128, 0x8001, 0x9602, 0x1a04, 0xe803, 0x0018, 0x9606, 0x0904,
-- 0xe803, 0x080c, 0x8eee, 0x0904, 0xe7fa, 0x2100, 0x9c06, 0x0904,
-- 0xe7fa, 0x6720, 0x9786, 0x0007, 0x0904, 0xe7fa, 0x080c, 0xeace,
-- 0x1904, 0xe7fa, 0x080c, 0xee65, 0x0904, 0xe7fa, 0x080c, 0xeabe,
-- 0x0904, 0xe7fa, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x347d,
-- 0x0904, 0xe845, 0x6004, 0x9086, 0x0000, 0x1904, 0xe845, 0x9786,
-- 0x0004, 0x0904, 0xe845, 0x2500, 0x9c06, 0x0904, 0xe7fa, 0x2400,
-- 0x9c06, 0x0904, 0xe7fa, 0x88ff, 0x0118, 0x605c, 0x9906, 0x15d0,
-- 0x0096, 0x6043, 0xffff, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016,
-- 0x080c, 0x1ad3, 0x001e, 0x9786, 0x000a, 0x0148, 0x080c, 0xd132,
-- 0x1130, 0x080c, 0xbb5c, 0x009e, 0x080c, 0xb1a7, 0x0418, 0x6014,
-- 0x2048, 0x080c, 0xcf1b, 0x01d8, 0x9786, 0x0003, 0x1588, 0xa867,
-- 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c,
-- 0x100b, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xeddf, 0x0016,
-- 0x080c, 0xd220, 0x080c, 0x7006, 0x001e, 0x080c, 0xd10c, 0x009e,
-- 0x080c, 0xb1a7, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02,
-- 0x1210, 0x0804, 0xe776, 0x010e, 0x190c, 0xad18, 0x012e, 0x002e,
-- 0x004e, 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005,
-- 0x9786, 0x0006, 0x1150, 0x9386, 0x0005, 0x0128, 0x080c, 0xeddf,
-- 0x080c, 0xea30, 0x08e0, 0x009e, 0x08e8, 0x9786, 0x0009, 0x11f8,
-- 0x6000, 0x9086, 0x0004, 0x01c0, 0x6000, 0x9086, 0x0003, 0x11a0,
-- 0x080c, 0x9a48, 0x0096, 0x6114, 0x2148, 0x080c, 0xcf1b, 0x0118,
-- 0x6010, 0x080c, 0x7012, 0x009e, 0x00c6, 0x080c, 0xb16c, 0x00ce,
-- 0x0036, 0x080c, 0x9ab3, 0x003e, 0x009e, 0x0804, 0xe7fa, 0x9786,
-- 0x000a, 0x0904, 0xe7ea, 0x0804, 0xe7df, 0x81ff, 0x0904, 0xe7fa,
-- 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0138, 0x9180, 0x0001,
-- 0x2004, 0x9086, 0x002d, 0x1904, 0xe7fa, 0x6000, 0x9086, 0x0002,
-- 0x1904, 0xe7fa, 0x080c, 0xd121, 0x0138, 0x080c, 0xd132, 0x1904,
-- 0xe7fa, 0x080c, 0xbb5c, 0x0038, 0x080c, 0x3344, 0x080c, 0xd132,
-- 0x1110, 0x080c, 0xbb5c, 0x080c, 0xb1a7, 0x0804, 0xe7fa, 0xa864,
-- 0x9084, 0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016,
-- 0x2c08, 0x2170, 0x9006, 0x080c, 0xea57, 0x001e, 0x0120, 0x6020,
-- 0x9084, 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005, 0xe894, 0xe894,
-- 0xe894, 0xe894, 0xe894, 0xe894, 0xe896, 0xe894, 0xe894, 0xe894,
-- 0xe8bf, 0xb1a7, 0xb1a7, 0xe894, 0x9006, 0x0005, 0x0036, 0x0046,
-- 0x0016, 0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009,
-- 0x0020, 0x080c, 0xea8d, 0x001e, 0x004e, 0x2019, 0x0002, 0x080c,
-- 0xe586, 0x003e, 0x9085, 0x0001, 0x0005, 0x0096, 0x080c, 0xcf1b,
-- 0x0140, 0x6014, 0x904d, 0x080c, 0xcae9, 0x687b, 0x0005, 0x080c,
-- 0x7012, 0x009e, 0x080c, 0xb1a7, 0x9085, 0x0001, 0x0005, 0x0019,
-- 0x9085, 0x0001, 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85,
-- 0x000b, 0x0005, 0xe8da, 0xe8da, 0xe8f1, 0xe8e1, 0xe900, 0xe8da,
-- 0xe8da, 0xe8dc, 0xe8da, 0xe8da, 0xe8da, 0xe8da, 0xe8da, 0xe8da,
-- 0xe8da, 0xe8da, 0x080c, 0x0d85, 0x080c, 0xb1a7, 0x9085, 0x0001,
-- 0x0005, 0x0036, 0x00e6, 0x2071, 0x19e8, 0x704c, 0x9c06, 0x1128,
-- 0x2019, 0x0001, 0x080c, 0xa596, 0x0010, 0x080c, 0xa7a1, 0x00ee,
-- 0x003e, 0x0096, 0x00d6, 0x6014, 0x2048, 0xa87b, 0x0005, 0x080c,
-- 0x7012, 0x080c, 0xb1a7, 0x00de, 0x009e, 0x9085, 0x0001, 0x0005,
-- 0x601c, 0xd084, 0x190c, 0x1ad3, 0x0c60, 0x2001, 0x0001, 0x080c,
-- 0x66e6, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
-- 0x1805, 0x2011, 0x0276, 0x080c, 0xc20e, 0x003e, 0x002e, 0x001e,
-- 0x015e, 0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076,
-- 0x0066, 0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061, 0x1ddc,
-- 0x2079, 0x0001, 0x8fff, 0x0904, 0xe977, 0x2071, 0x1800, 0x7654,
-- 0x7074, 0x8001, 0x9602, 0x1a04, 0xe977, 0x88ff, 0x0120, 0x2800,
-- 0x9c06, 0x15a0, 0x2078, 0x080c, 0xeabe, 0x0580, 0x2400, 0x9c06,
-- 0x0568, 0x6720, 0x9786, 0x0006, 0x1548, 0x9786, 0x0007, 0x0530,
-- 0x88ff, 0x1150, 0xd58c, 0x1118, 0x6010, 0x9b06, 0x11f8, 0xd584,
-- 0x0118, 0x605c, 0x9106, 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140,
-- 0x080c, 0xece1, 0x080c, 0xd65d, 0x080c, 0x1ad3, 0x6023, 0x0007,
-- 0x6014, 0x2048, 0x080c, 0xcf1b, 0x0120, 0x0046, 0x080c, 0xea30,
-- 0x004e, 0x009e, 0x080c, 0xb1a7, 0x88ff, 0x1198, 0x9ce0, 0x001c,
-- 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe92a, 0x9006,
-- 0x012e, 0x00be, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe,
-- 0x0005, 0x98c5, 0x0001, 0x0ca0, 0x080c, 0xacfc, 0x00b6, 0x0076,
-- 0x0056, 0x0086, 0x9046, 0x2029, 0x0001, 0x2c20, 0x2019, 0x0002,
-- 0x6210, 0x2258, 0x0096, 0x904e, 0x080c, 0xa667, 0x009e, 0x008e,
-- 0x903e, 0x080c, 0xa712, 0x080c, 0xe91b, 0x005e, 0x007e, 0x00be,
-- 0x080c, 0xad18, 0x0005, 0x080c, 0xacfc, 0x00b6, 0x0046, 0x0056,
-- 0x0076, 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e,
-- 0x0016, 0x0036, 0x080c, 0x67b4, 0x1180, 0x0056, 0x0086, 0x9046,
-- 0x2508, 0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0xa667, 0x009e,
-- 0x008e, 0x903e, 0x080c, 0xa712, 0x005e, 0x003e, 0x001e, 0x8108,
-- 0x1f04, 0xe9b0, 0x0036, 0x2508, 0x2029, 0x0003, 0x080c, 0xe91b,
-- 0x003e, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c,
-- 0xad18, 0x0005, 0x080c, 0xacfc, 0x00b6, 0x0076, 0x0056, 0x6210,
-- 0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019, 0x0048, 0x0096,
-- 0x904e, 0x080c, 0xa667, 0x009e, 0x008e, 0x903e, 0x080c, 0xa712,
-- 0x2c20, 0x080c, 0xe91b, 0x005e, 0x007e, 0x00be, 0x080c, 0xad18,
-- 0x0005, 0x080c, 0xacfc, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6,
-- 0x0156, 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c,
-- 0x67b4, 0x1190, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001,
-- 0x080c, 0xecc5, 0x004e, 0x0096, 0x904e, 0x080c, 0xa667, 0x009e,
-- 0x008e, 0x903e, 0x080c, 0xa712, 0x003e, 0x001e, 0x8108, 0x1f04,
-- 0xea05, 0x0036, 0x2029, 0x0002, 0x080c, 0xe91b, 0x003e, 0x015e,
-- 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c, 0xad18, 0x0005,
-- 0x0016, 0x00f6, 0x080c, 0xcf19, 0x0198, 0xa864, 0x9084, 0x00ff,
-- 0x9086, 0x0046, 0x0180, 0xa800, 0x907d, 0x0138, 0xa803, 0x0000,
-- 0xab82, 0x080c, 0x7012, 0x2f48, 0x0cb0, 0xab82, 0x080c, 0x7012,
-- 0x00fe, 0x001e, 0x0005, 0xa800, 0x907d, 0x0130, 0xa803, 0x0000,
-- 0x080c, 0x7012, 0x2f48, 0x0cb8, 0x080c, 0x7012, 0x0c88, 0x00e6,
-- 0x0046, 0x0036, 0x2061, 0x1ddc, 0x9005, 0x1138, 0x2071, 0x1800,
-- 0x7454, 0x7074, 0x8001, 0x9402, 0x12f8, 0x2100, 0x9c06, 0x0188,
-- 0x6000, 0x9086, 0x0000, 0x0168, 0x6008, 0x9206, 0x1150, 0x6320,
-- 0x9386, 0x0009, 0x01b0, 0x6010, 0x91a0, 0x0004, 0x2424, 0x9406,
-- 0x0140, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220,
-- 0x0c20, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e, 0x00ee,
-- 0x0005, 0x631c, 0xd3c4, 0x1d68, 0x0c30, 0x0096, 0x0006, 0x080c,
-- 0x1059, 0x000e, 0x090c, 0x0d85, 0xaae2, 0xa867, 0x010d, 0xa88e,
-- 0x0026, 0x2010, 0x080c, 0xcf09, 0x2001, 0x0000, 0x0120, 0x2200,
-- 0x9080, 0x0017, 0x2004, 0x002e, 0xa87a, 0x9186, 0x0020, 0x0110,
-- 0xa8e3, 0xffff, 0xa986, 0xac76, 0xa87f, 0x0000, 0x2001, 0x198e,
-- 0x2004, 0xa882, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091,
-- 0x8000, 0x080c, 0x7012, 0x012e, 0x009e, 0x0005, 0x6700, 0x9786,
-- 0x0000, 0x0158, 0x9786, 0x0001, 0x0140, 0x9786, 0x000a, 0x0128,
-- 0x9786, 0x0009, 0x0110, 0x9085, 0x0001, 0x0005, 0x00e6, 0x6010,
-- 0x9075, 0x0138, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee,
-- 0x0005, 0x9085, 0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e,
-- 0x11a0, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007,
-- 0x0085, 0x6003, 0x000b, 0x6023, 0x0005, 0x2001, 0x1987, 0x2004,
-- 0x601a, 0x2009, 0x8020, 0x080c, 0x9617, 0x001e, 0x0005, 0xa001,
-- 0xa001, 0x0005, 0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c,
-- 0xd267, 0x0030, 0x080c, 0xece1, 0x080c, 0x8c19, 0x080c, 0xb16c,
-+ 0xc20d, 0x009e, 0x15c8, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096,
-+ 0x2b48, 0x2019, 0x0006, 0x080c, 0xc20d, 0x009e, 0x1568, 0x0046,
-+ 0x0016, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4,
-+ 0x0138, 0x2009, 0x0029, 0x080c, 0xea74, 0xb800, 0xc0e5, 0xb802,
-+ 0x080c, 0xacec, 0x2019, 0x0029, 0x080c, 0x97a0, 0x0076, 0x2039,
-+ 0x0000, 0x080c, 0x965d, 0x2c08, 0x080c, 0xe744, 0x007e, 0x080c,
-+ 0xad08, 0x2001, 0x0007, 0x080c, 0x671f, 0x2001, 0x0007, 0x080c,
-+ 0x66f3, 0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be,
-+ 0x00ce, 0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800,
-+ 0x0118, 0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6,
-+ 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930,
-+ 0x7834, 0x080c, 0x268c, 0x11d0, 0x080c, 0x67ad, 0x11b8, 0x2011,
-+ 0x0270, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c,
-+ 0xc20d, 0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096,
-+ 0x2b48, 0x2019, 0x0006, 0x080c, 0xc20d, 0x009e, 0x015e, 0x003e,
-+ 0x002e, 0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016,
-+ 0x0026, 0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-+ 0x080c, 0x268c, 0x11d0, 0x080c, 0x67ad, 0x11b8, 0x2011, 0x0276,
-+ 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xc20d,
-+ 0x009e, 0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48,
-+ 0x2019, 0x0006, 0x080c, 0xc20d, 0x009e, 0x015e, 0x003e, 0x002e,
-+ 0x001e, 0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076,
-+ 0x0066, 0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x080c,
-+ 0xad4a, 0x0106, 0x190c, 0xacec, 0x2740, 0x2029, 0x19f4, 0x252c,
-+ 0x2021, 0x19fb, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7654,
-+ 0x7074, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1b39, 0x000e, 0x0128,
-+ 0x8001, 0x9602, 0x1a04, 0xe7ea, 0x0018, 0x9606, 0x0904, 0xe7ea,
-+ 0x080c, 0x8ede, 0x0904, 0xe7e1, 0x2100, 0x9c06, 0x0904, 0xe7e1,
-+ 0x6720, 0x9786, 0x0007, 0x0904, 0xe7e1, 0x080c, 0xeab5, 0x1904,
-+ 0xe7e1, 0x080c, 0xee4c, 0x0904, 0xe7e1, 0x080c, 0xeaa5, 0x0904,
-+ 0xe7e1, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x347d, 0x0904,
-+ 0xe82c, 0x6004, 0x9086, 0x0000, 0x1904, 0xe82c, 0x9786, 0x0004,
-+ 0x0904, 0xe82c, 0x2500, 0x9c06, 0x0904, 0xe7e1, 0x2400, 0x9c06,
-+ 0x0904, 0xe7e1, 0x88ff, 0x0118, 0x605c, 0x9906, 0x15d0, 0x0096,
-+ 0x6043, 0xffff, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c,
-+ 0x1ad3, 0x001e, 0x9786, 0x000a, 0x0148, 0x080c, 0xd11f, 0x1130,
-+ 0x080c, 0xbb47, 0x009e, 0x080c, 0xb192, 0x0418, 0x6014, 0x2048,
-+ 0x080c, 0xcf08, 0x01d8, 0x9786, 0x0003, 0x1588, 0xa867, 0x0103,
-+ 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x100b,
-+ 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xedc6, 0x0016, 0x080c,
-+ 0xd20d, 0x080c, 0x6ff6, 0x001e, 0x080c, 0xd0f9, 0x009e, 0x080c,
-+ 0xb192, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210,
-+ 0x0804, 0xe75d, 0x010e, 0x190c, 0xad08, 0x012e, 0x002e, 0x004e,
-+ 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786,
-+ 0x0006, 0x1150, 0x9386, 0x0005, 0x0128, 0x080c, 0xedc6, 0x080c,
-+ 0xea17, 0x08e0, 0x009e, 0x08e8, 0x9786, 0x0009, 0x11f8, 0x6000,
-+ 0x9086, 0x0004, 0x01c0, 0x6000, 0x9086, 0x0003, 0x11a0, 0x080c,
-+ 0x9a38, 0x0096, 0x6114, 0x2148, 0x080c, 0xcf08, 0x0118, 0x6010,
-+ 0x080c, 0x7002, 0x009e, 0x00c6, 0x080c, 0xb157, 0x00ce, 0x0036,
-+ 0x080c, 0x9aa3, 0x003e, 0x009e, 0x0804, 0xe7e1, 0x9786, 0x000a,
-+ 0x0904, 0xe7d1, 0x0804, 0xe7c6, 0x81ff, 0x0904, 0xe7e1, 0x9180,
-+ 0x0001, 0x2004, 0x9086, 0x0018, 0x0138, 0x9180, 0x0001, 0x2004,
-+ 0x9086, 0x002d, 0x1904, 0xe7e1, 0x6000, 0x9086, 0x0002, 0x1904,
-+ 0xe7e1, 0x080c, 0xd10e, 0x0138, 0x080c, 0xd11f, 0x1904, 0xe7e1,
-+ 0x080c, 0xbb47, 0x0038, 0x080c, 0x3344, 0x080c, 0xd11f, 0x1110,
-+ 0x080c, 0xbb47, 0x080c, 0xb192, 0x0804, 0xe7e1, 0xa864, 0x9084,
-+ 0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08,
-+ 0x2170, 0x9006, 0x080c, 0xea3e, 0x001e, 0x0120, 0x6020, 0x9084,
-+ 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005, 0xe87b, 0xe87b, 0xe87b,
-+ 0xe87b, 0xe87b, 0xe87b, 0xe87d, 0xe87b, 0xe87b, 0xe87b, 0xe8a6,
-+ 0xb192, 0xb192, 0xe87b, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016,
-+ 0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020,
-+ 0x080c, 0xea74, 0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xe56d,
-+ 0x003e, 0x9085, 0x0001, 0x0005, 0x0096, 0x080c, 0xcf08, 0x0140,
-+ 0x6014, 0x904d, 0x080c, 0xcad4, 0x687b, 0x0005, 0x080c, 0x7002,
-+ 0x009e, 0x080c, 0xb192, 0x9085, 0x0001, 0x0005, 0x0019, 0x9085,
-+ 0x0001, 0x0005, 0x6000, 0x908a, 0x0010, 0x1a0c, 0x0d85, 0x000b,
-+ 0x0005, 0xe8c1, 0xe8c1, 0xe8d8, 0xe8c8, 0xe8e7, 0xe8c1, 0xe8c1,
-+ 0xe8c3, 0xe8c1, 0xe8c1, 0xe8c1, 0xe8c1, 0xe8c1, 0xe8c1, 0xe8c1,
-+ 0xe8c1, 0x080c, 0x0d85, 0x080c, 0xb192, 0x9085, 0x0001, 0x0005,
-+ 0x0036, 0x00e6, 0x2071, 0x19e8, 0x704c, 0x9c06, 0x1128, 0x2019,
-+ 0x0001, 0x080c, 0xa586, 0x0010, 0x080c, 0xa791, 0x00ee, 0x003e,
-+ 0x0096, 0x00d6, 0x6014, 0x2048, 0xa87b, 0x0005, 0x080c, 0x7002,
-+ 0x080c, 0xb192, 0x00de, 0x009e, 0x9085, 0x0001, 0x0005, 0x601c,
-+ 0xd084, 0x190c, 0x1ad3, 0x0c60, 0x2001, 0x0001, 0x080c, 0x66df,
-+ 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805,
-+ 0x2011, 0x0276, 0x080c, 0xc1f9, 0x003e, 0x002e, 0x001e, 0x015e,
-+ 0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
-+ 0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061, 0x1ddc, 0x2079,
-+ 0x0001, 0x8fff, 0x0904, 0xe95e, 0x2071, 0x1800, 0x7654, 0x7074,
-+ 0x8001, 0x9602, 0x1a04, 0xe95e, 0x88ff, 0x0120, 0x2800, 0x9c06,
-+ 0x15a0, 0x2078, 0x080c, 0xeaa5, 0x0580, 0x2400, 0x9c06, 0x0568,
-+ 0x6720, 0x9786, 0x0006, 0x1548, 0x9786, 0x0007, 0x0530, 0x88ff,
-+ 0x1150, 0xd58c, 0x1118, 0x6010, 0x9b06, 0x11f8, 0xd584, 0x0118,
-+ 0x605c, 0x9106, 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c,
-+ 0xecc8, 0x080c, 0xd64a, 0x080c, 0x1ad3, 0x6023, 0x0007, 0x6014,
-+ 0x2048, 0x080c, 0xcf08, 0x0120, 0x0046, 0x080c, 0xea17, 0x004e,
-+ 0x009e, 0x080c, 0xb192, 0x88ff, 0x1198, 0x9ce0, 0x001c, 0x2001,
-+ 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe911, 0x9006, 0x012e,
-+ 0x00be, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-+ 0x98c5, 0x0001, 0x0ca0, 0x080c, 0xacec, 0x00b6, 0x0076, 0x0056,
-+ 0x0086, 0x9046, 0x2029, 0x0001, 0x2c20, 0x2019, 0x0002, 0x6210,
-+ 0x2258, 0x0096, 0x904e, 0x080c, 0xa657, 0x009e, 0x008e, 0x903e,
-+ 0x080c, 0xa702, 0x080c, 0xe902, 0x005e, 0x007e, 0x00be, 0x080c,
-+ 0xad08, 0x0005, 0x080c, 0xacec, 0x00b6, 0x0046, 0x0056, 0x0076,
-+ 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016,
-+ 0x0036, 0x080c, 0x67ad, 0x1180, 0x0056, 0x0086, 0x9046, 0x2508,
-+ 0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0xa657, 0x009e, 0x008e,
-+ 0x903e, 0x080c, 0xa702, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04,
-+ 0xe997, 0x0036, 0x2508, 0x2029, 0x0003, 0x080c, 0xe902, 0x003e,
-+ 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c, 0xad08,
-+ 0x0005, 0x080c, 0xacec, 0x00b6, 0x0076, 0x0056, 0x6210, 0x2258,
-+ 0x0086, 0x9046, 0x2029, 0x0001, 0x2019, 0x0048, 0x0096, 0x904e,
-+ 0x080c, 0xa657, 0x009e, 0x008e, 0x903e, 0x080c, 0xa702, 0x2c20,
-+ 0x080c, 0xe902, 0x005e, 0x007e, 0x00be, 0x080c, 0xad08, 0x0005,
-+ 0x080c, 0xacec, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156,
-+ 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x67ad,
-+ 0x1190, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c,
-+ 0xecac, 0x004e, 0x0096, 0x904e, 0x080c, 0xa657, 0x009e, 0x008e,
-+ 0x903e, 0x080c, 0xa702, 0x003e, 0x001e, 0x8108, 0x1f04, 0xe9ec,
-+ 0x0036, 0x2029, 0x0002, 0x080c, 0xe902, 0x003e, 0x015e, 0x00ce,
-+ 0x007e, 0x005e, 0x004e, 0x00be, 0x080c, 0xad08, 0x0005, 0x0016,
-+ 0x00f6, 0x080c, 0xcf06, 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086,
-+ 0x0046, 0x0180, 0xa800, 0x907d, 0x0138, 0xa803, 0x0000, 0xab82,
-+ 0x080c, 0x7002, 0x2f48, 0x0cb0, 0xab82, 0x080c, 0x7002, 0x00fe,
-+ 0x001e, 0x0005, 0xa800, 0x907d, 0x0130, 0xa803, 0x0000, 0x080c,
-+ 0x7002, 0x2f48, 0x0cb8, 0x080c, 0x7002, 0x0c88, 0x00e6, 0x0046,
-+ 0x0036, 0x2061, 0x1ddc, 0x9005, 0x1138, 0x2071, 0x1800, 0x7454,
-+ 0x7074, 0x8001, 0x9402, 0x12f8, 0x2100, 0x9c06, 0x0188, 0x6000,
-+ 0x9086, 0x0000, 0x0168, 0x6008, 0x9206, 0x1150, 0x6320, 0x9386,
-+ 0x0009, 0x01b0, 0x6010, 0x91a0, 0x0004, 0x2424, 0x9406, 0x0140,
-+ 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c20,
-+ 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e, 0x00ee, 0x0005,
-+ 0x631c, 0xd3c4, 0x1d68, 0x0c30, 0x0096, 0x0006, 0x080c, 0x1059,
-+ 0x000e, 0x090c, 0x0d85, 0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026,
-+ 0x2010, 0x080c, 0xcef6, 0x2001, 0x0000, 0x0120, 0x2200, 0x9080,
-+ 0x0017, 0x2004, 0x002e, 0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3,
-+ 0xffff, 0xa986, 0xac76, 0xa87f, 0x0000, 0x2001, 0x198e, 0x2004,
-+ 0xa882, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000,
-+ 0x080c, 0x7002, 0x012e, 0x009e, 0x0005, 0x6700, 0x9786, 0x0000,
-+ 0x0158, 0x9786, 0x0001, 0x0140, 0x9786, 0x000a, 0x0128, 0x9786,
-+ 0x0009, 0x0110, 0x9085, 0x0001, 0x0005, 0x00e6, 0x6010, 0x9075,
-+ 0x0138, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005,
-+ 0x9085, 0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e, 0x11a0,
-+ 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085,
-+ 0x6003, 0x000b, 0x6023, 0x0005, 0x2001, 0x1987, 0x2004, 0x601a,
-+ 0x2009, 0x8020, 0x080c, 0x9607, 0x001e, 0x0005, 0xa001, 0xa001,
-+ 0x0005, 0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c, 0xd254,
-+ 0x0030, 0x080c, 0xecc8, 0x080c, 0x8c09, 0x080c, 0xb157, 0x0005,
-+ 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xeb04, 0xeb04,
-+ 0xeb04, 0xeb06, 0xeb04, 0xeb06, 0xeb06, 0xeb04, 0xeb06, 0xeb04,
-+ 0xeb04, 0xeb04, 0xeb04, 0xeb04, 0x9006, 0x0005, 0x9085, 0x0001,
- 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xeb1d,
-- 0xeb1d, 0xeb1d, 0xeb1f, 0xeb1d, 0xeb1f, 0xeb1f, 0xeb1d, 0xeb1f,
-- 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0x9006, 0x0005, 0x9085,
-- 0x0001, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002,
-- 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0xeb43, 0xeb36,
-- 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0xeb36, 0x6007, 0x003b,
-- 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020,
-- 0x080c, 0x9617, 0x0005, 0x0096, 0x00c6, 0x2260, 0x080c, 0xece1,
-- 0x604b, 0x0000, 0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000,
-- 0x00ce, 0x00d6, 0x2268, 0x9186, 0x0007, 0x1904, 0xeb9c, 0x6814,
-- 0x9005, 0x0138, 0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e,
-- 0x08a8, 0x6007, 0x003a, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c,
-- 0x9617, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x1904, 0xec0c,
-- 0x6014, 0x9005, 0x1138, 0x6000, 0x9086, 0x0007, 0x190c, 0x0d85,
-- 0x0804, 0xec0c, 0x2048, 0x080c, 0xcf1b, 0x1130, 0x0028, 0x2048,
-- 0xa800, 0x9005, 0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084, 0x0003,
-- 0x9086, 0x0002, 0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880,
-- 0xc0fc, 0xa882, 0x2009, 0x0043, 0x080c, 0xe3b5, 0x0804, 0xec0c,
-- 0x2009, 0x0041, 0x0804, 0xec06, 0x9186, 0x0005, 0x15a0, 0x6814,
-- 0x2048, 0xa87c, 0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804, 0xeb36,
-- 0xd0b4, 0x0128, 0xd0fc, 0x090c, 0x0d85, 0x0804, 0xeb57, 0x6007,
-- 0x003a, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9617, 0x00c6,
-- 0x2d60, 0x6100, 0x9186, 0x0002, 0x0120, 0x9186, 0x0004, 0x1904,
-- 0xec0c, 0x6814, 0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980,
-- 0xc1fc, 0xc1bc, 0xa982, 0x00f6, 0x2c78, 0x080c, 0x17ad, 0x00fe,
-- 0x2009, 0x0042, 0x0498, 0x0036, 0x080c, 0x1059, 0x090c, 0x0d85,
-- 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18, 0xab8e,
-- 0xa887, 0x0045, 0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024,
-- 0xc0dd, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004,
-- 0x635c, 0xab7a, 0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96,
-- 0xa89f, 0x0001, 0x080c, 0x7012, 0x2019, 0x0045, 0x6008, 0x2068,
-- 0x080c, 0xe578, 0x2d00, 0x600a, 0x003e, 0x0038, 0x604b, 0x0000,
-- 0x6003, 0x0007, 0x080c, 0xe3b5, 0x00ce, 0x00de, 0x009e, 0x0005,
-- 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2,
-- 0x9186, 0x0027, 0x1178, 0x080c, 0x99ed, 0x0036, 0x0096, 0x6014,
-- 0x2048, 0x2019, 0x0004, 0x080c, 0xea30, 0x009e, 0x003e, 0x080c,
-- 0x9ab3, 0x0005, 0x9186, 0x0014, 0x0d70, 0x080c, 0xb227, 0x0005,
-- 0xec3f, 0xec3d, 0xec3d, 0xec3d, 0xec3d, 0xec3d, 0xec3f, 0xec3d,
-- 0xec3d, 0xec3d, 0xec3d, 0xec3d, 0xec3d, 0x080c, 0x0d85, 0x6003,
-- 0x000c, 0x080c, 0x9ab3, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182,
-- 0x0085, 0x0208, 0x001a, 0x080c, 0xb227, 0x0005, 0xec5b, 0xec5b,
-- 0xec5b, 0xec5b, 0xec5d, 0xec7d, 0xec5b, 0xec5b, 0xec5b, 0xec5b,
-- 0xec5b, 0xec5b, 0xec5b, 0x080c, 0x0d85, 0x00d6, 0x2c68, 0x080c,
-- 0xb116, 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e,
-- 0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff,
-- 0x6910, 0x6112, 0x6023, 0x0004, 0x2009, 0x8020, 0x080c, 0x9617,
-- 0x2d60, 0x080c, 0xb16c, 0x00de, 0x0005, 0x080c, 0xb16c, 0x0005,
-- 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee,
-- 0x0005, 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002,
-- 0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988, 0x2004,
-- 0x604a, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009,
-- 0x1867, 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006,
-- 0x00d8, 0x2001, 0x1988, 0x200c, 0x2001, 0x1986, 0x2004, 0x9100,
-- 0x9080, 0x000a, 0x604a, 0x6010, 0x00b6, 0x2058, 0xb8bc, 0x00be,
-- 0x0008, 0x2104, 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a,
-- 0x600f, 0x0000, 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6,
-- 0x615c, 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x605c,
-- 0x9106, 0x1138, 0x600c, 0x2072, 0x080c, 0x8c19, 0x080c, 0xb16c,
-- 0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e,
-- 0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x906d, 0x0130,
-- 0x9c06, 0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de,
-- 0x0005, 0x0026, 0x0036, 0x0156, 0x2011, 0x182c, 0x2204, 0x9084,
-- 0x00ff, 0x2019, 0x026e, 0x2334, 0x96b4, 0x00ff, 0x9636, 0x1508,
-- 0x8318, 0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011,
-- 0x0270, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a,
-- 0x080c, 0xc222, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004,
-- 0x6010, 0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xc222, 0x009e,
-- 0x1100, 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800,
-- 0x080c, 0x6130, 0x080c, 0x30bf, 0x00ee, 0x0005, 0x0096, 0x0026,
-- 0x080c, 0x1059, 0x090c, 0x0d85, 0xa85c, 0x9080, 0x001a, 0x20a0,
-- 0x20a9, 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046,
-- 0x1118, 0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041,
-- 0x0110, 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294,
-- 0xff00, 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038,
-- 0x9084, 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c,
-- 0x9294, 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244,
-- 0x9294, 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2,
-- 0x9186, 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a,
-- 0x2204, 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210,
-- 0x2204, 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210,
-- 0x9186, 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6,
-- 0x8210, 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be,
-- 0x8210, 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013,
-- 0x0001, 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210,
-- 0x2204, 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011,
-- 0x0260, 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2,
-- 0x9186, 0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a,
-- 0x0146, 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860,
-- 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004,
-- 0x8210, 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205,
-- 0x2013, 0x0000, 0x002e, 0x080c, 0x7012, 0x009e, 0x0005, 0x00e6,
-- 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011,
-- 0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6,
-- 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126,
-- 0x2091, 0x8000, 0x2029, 0x19f4, 0x252c, 0x2021, 0x19fb, 0x2424,
-- 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578,
-- 0x6720, 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500,
-- 0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xeabe, 0x01b8,
-- 0x080c, 0xeace, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016,
-- 0x080c, 0x1ad3, 0x001e, 0x080c, 0xd121, 0x1110, 0x080c, 0x3344,
-- 0x080c, 0xd132, 0x1110, 0x080c, 0xbb5c, 0x080c, 0xb1a7, 0x9ce0,
-- 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e,
-- 0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de,
-- 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006,
-- 0x2001, 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036,
-- 0x0046, 0x080c, 0xd645, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128,
-- 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c,
-- 0x4e58, 0x004e, 0x003e, 0x000e, 0x0005, 0x6004, 0x9086, 0x0001,
-- 0x1128, 0x080c, 0xa7e2, 0x080c, 0xb1a7, 0x9006, 0x0005, 0x00e6,
-- 0x00c6, 0x00b6, 0x0046, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7454,
-- 0x7074, 0x8001, 0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000,
-- 0x9086, 0x0000, 0x0148, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1120,
-- 0x6004, 0x9086, 0x0002, 0x0140, 0x9ce0, 0x001c, 0x2001, 0x181a,
-- 0x2004, 0x9c02, 0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006,
-- 0x004e, 0x00be, 0x00ce, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004,
-- 0xd0a4, 0x0160, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0138, 0x2001,
-- 0x1848, 0x2004, 0xd0a4, 0x1118, 0x9085, 0x0001, 0x0005, 0x9006,
-- 0x0ce8, 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071,
-- 0x1840, 0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118,
-- 0x7000, 0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007,
-- 0x908e, 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005,
-- 0x0118, 0x2071, 0xfff6, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e,
-- 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xffee,
-- 0x0021, 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077,
-- 0x1220, 0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071,
-- 0xffec, 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff0, 0x0c69,
-- 0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071,
-- 0x1840, 0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005,
-- 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
-- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000,
-- 0xaa6e
-+ 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0xeb2a, 0xeb1d, 0xeb1d,
-+ 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0xeb1d, 0x6007, 0x003b, 0x602f,
-+ 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c,
-+ 0x9607, 0x0005, 0x0096, 0x00c6, 0x2260, 0x080c, 0xecc8, 0x604b,
-+ 0x0000, 0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce,
-+ 0x00d6, 0x2268, 0x9186, 0x0007, 0x1904, 0xeb83, 0x6814, 0x9005,
-+ 0x0138, 0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8,
-+ 0x6007, 0x003a, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607,
-+ 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x1904, 0xebf3, 0x6014,
-+ 0x9005, 0x1138, 0x6000, 0x9086, 0x0007, 0x190c, 0x0d85, 0x0804,
-+ 0xebf3, 0x2048, 0x080c, 0xcf08, 0x1130, 0x0028, 0x2048, 0xa800,
-+ 0x9005, 0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086,
-+ 0x0002, 0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc,
-+ 0xa882, 0x2009, 0x0043, 0x080c, 0xe3a0, 0x0804, 0xebf3, 0x2009,
-+ 0x0041, 0x0804, 0xebed, 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048,
-+ 0xa87c, 0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804, 0xeb1d, 0xd0b4,
-+ 0x0128, 0xd0fc, 0x090c, 0x0d85, 0x0804, 0xeb3e, 0x6007, 0x003a,
-+ 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x9607, 0x00c6, 0x2d60,
-+ 0x6100, 0x9186, 0x0002, 0x0120, 0x9186, 0x0004, 0x1904, 0xebf3,
-+ 0x6814, 0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc,
-+ 0xc1bc, 0xa982, 0x00f6, 0x2c78, 0x080c, 0x17ad, 0x00fe, 0x2009,
-+ 0x0042, 0x0498, 0x0036, 0x080c, 0x1059, 0x090c, 0x0d85, 0xa867,
-+ 0x010d, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887,
-+ 0x0045, 0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd,
-+ 0x6026, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004, 0x635c,
-+ 0xab7a, 0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f,
-+ 0x0001, 0x080c, 0x7002, 0x2019, 0x0045, 0x6008, 0x2068, 0x080c,
-+ 0xe55f, 0x2d00, 0x600a, 0x003e, 0x0038, 0x604b, 0x0000, 0x6003,
-+ 0x0007, 0x080c, 0xe3a0, 0x00ce, 0x00de, 0x009e, 0x0005, 0x9186,
-+ 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2, 0x9186,
-+ 0x0027, 0x1178, 0x080c, 0x99dd, 0x0036, 0x0096, 0x6014, 0x2048,
-+ 0x2019, 0x0004, 0x080c, 0xea17, 0x009e, 0x003e, 0x080c, 0x9aa3,
-+ 0x0005, 0x9186, 0x0014, 0x0d70, 0x080c, 0xb212, 0x0005, 0xec26,
-+ 0xec24, 0xec24, 0xec24, 0xec24, 0xec24, 0xec26, 0xec24, 0xec24,
-+ 0xec24, 0xec24, 0xec24, 0xec24, 0x080c, 0x0d85, 0x6003, 0x000c,
-+ 0x080c, 0x9aa3, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085,
-+ 0x0208, 0x001a, 0x080c, 0xb212, 0x0005, 0xec42, 0xec42, 0xec42,
-+ 0xec42, 0xec44, 0xec64, 0xec42, 0xec42, 0xec42, 0xec42, 0xec42,
-+ 0xec42, 0xec42, 0x080c, 0x0d85, 0x00d6, 0x2c68, 0x080c, 0xb101,
-+ 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e, 0x210c,
-+ 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff, 0x6910,
-+ 0x6112, 0x6023, 0x0004, 0x2009, 0x8020, 0x080c, 0x9607, 0x2d60,
-+ 0x080c, 0xb157, 0x00de, 0x0005, 0x080c, 0xb157, 0x0005, 0x00e6,
-+ 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee, 0x0005,
-+ 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002, 0x6024,
-+ 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988, 0x2004, 0x604a,
-+ 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009, 0x1867,
-+ 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006, 0x00d8,
-+ 0x2001, 0x1988, 0x200c, 0x2001, 0x1986, 0x2004, 0x9100, 0x9080,
-+ 0x000a, 0x604a, 0x6010, 0x00b6, 0x2058, 0xb8bc, 0x00be, 0x0008,
-+ 0x2104, 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a, 0x600f,
-+ 0x0000, 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6, 0x615c,
-+ 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x605c, 0x9106,
-+ 0x1138, 0x600c, 0x2072, 0x080c, 0x8c09, 0x080c, 0xb157, 0x0010,
-+ 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e, 0x0005,
-+ 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x906d, 0x0130, 0x9c06,
-+ 0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de, 0x0005,
-+ 0x0026, 0x0036, 0x0156, 0x2011, 0x182c, 0x2204, 0x9084, 0x00ff,
-+ 0x2019, 0x026e, 0x2334, 0x96b4, 0x00ff, 0x9636, 0x1508, 0x8318,
-+ 0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011, 0x0270,
-+ 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c,
-+ 0xc20d, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004, 0x6010,
-+ 0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xc20d, 0x009e, 0x1100,
-+ 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c,
-+ 0x6129, 0x080c, 0x30bf, 0x00ee, 0x0005, 0x0096, 0x0026, 0x080c,
-+ 0x1059, 0x090c, 0x0d85, 0xa85c, 0x9080, 0x001a, 0x20a0, 0x20a9,
-+ 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046, 0x1118,
-+ 0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041, 0x0110,
-+ 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294, 0xff00,
-+ 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038, 0x9084,
-+ 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c, 0x9294,
-+ 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244, 0x9294,
-+ 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2, 0x9186,
-+ 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a, 0x2204,
-+ 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210, 0x2204,
-+ 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210, 0x9186,
-+ 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6, 0x8210,
-+ 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be, 0x8210,
-+ 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013, 0x0001,
-+ 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210, 0x2204,
-+ 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011, 0x0260,
-+ 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x9186,
-+ 0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a, 0x0146,
-+ 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860, 0x20e8,
-+ 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004, 0x8210,
-+ 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205, 0x2013,
-+ 0x0000, 0x002e, 0x080c, 0x7002, 0x009e, 0x0005, 0x00e6, 0x6010,
-+ 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011, 0x00ee,
-+ 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6, 0x00c6,
-+ 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126, 0x2091,
-+ 0x8000, 0x2029, 0x19f4, 0x252c, 0x2021, 0x19fb, 0x2424, 0x2061,
-+ 0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578, 0x6720,
-+ 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500, 0x9c06,
-+ 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xeaa5, 0x01b8, 0x080c,
-+ 0xeab5, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c,
-+ 0x1ad3, 0x001e, 0x080c, 0xd10e, 0x1110, 0x080c, 0x3344, 0x080c,
-+ 0xd11f, 0x1110, 0x080c, 0xbb47, 0x080c, 0xb192, 0x9ce0, 0x001c,
-+ 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e, 0x001e,
-+ 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee,
-+ 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006, 0x2001,
-+ 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036, 0x0046,
-+ 0x080c, 0xd632, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128, 0x6010,
-+ 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c, 0x4e56,
-+ 0x004e, 0x003e, 0x000e, 0x0005, 0x6004, 0x9086, 0x0001, 0x1128,
-+ 0x080c, 0xa7d2, 0x080c, 0xb192, 0x9006, 0x0005, 0x00e6, 0x00c6,
-+ 0x00b6, 0x0046, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7454, 0x7074,
-+ 0x8001, 0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086,
-+ 0x0000, 0x0148, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1120, 0x6004,
-+ 0x9086, 0x0002, 0x0140, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004,
-+ 0x9c02, 0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x004e,
-+ 0x00be, 0x00ce, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4,
-+ 0x0160, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0138, 0x2001, 0x1848,
-+ 0x2004, 0xd0a4, 0x1118, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8,
-+ 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071, 0x1840,
-+ 0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118, 0x7000,
-+ 0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007, 0x908e,
-+ 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118,
-+ 0x2071, 0xfff6, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e, 0x0005,
-+ 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xffee, 0x0021,
-+ 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077, 0x1220,
-+ 0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071, 0xffec,
-+ 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff0, 0x0c69, 0x00ee,
-+ 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1840,
-+ 0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0001,
-+ 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100,
-+ 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x8d49
- };
- #ifdef UNIQUE_FW_NAME
--unsigned short fw2322ipx_length01 = 0xe719;
-+unsigned short fw2322ipx_length01 = 0xe700;
- #else
--unsigned short risc_code_length01 = 0xe719;
-+unsigned short risc_code_length01 = 0xe700;
- #endif
-
- /*
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2400.c ./drivers/scsi/qla2xxx/ql2400.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2400.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2400.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,10 +1,9 @@
- /*
-- * QLogic ISP24XX device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * Released under GPL v2.
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
--
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/pci.h>
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql2400_fw.c ./drivers/scsi/qla2xxx/ql2400_fw.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql2400_fw.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql2400_fw.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,26 +1,13 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
--
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #include <linux/types.h>
-
- /*
-- * Firmware Version 4.00.18 (14:53 Jan 30, 2006)
-+ * Firmware Version 4.00.23 (09:32 Jun 27, 2006)
- */
-
- #ifdef UNIQUE_FW_NAME
-@@ -30,15 +17,15 @@ uint32_t risc_code_version = 4*1024+0;
- #endif
-
- #ifdef UNIQUE_FW_NAME
--uint32_t fw2400_version_str[] = {4, 0,18};
-+uint32_t fw2400_version_str[] = {4, 0,23};
- #else
--uint32_t firmware_version[] = {4, 0,18};
-+uint32_t firmware_version[] = {4, 0,23};
- #endif
-
- #ifdef UNIQUE_FW_NAME
--#define fw2400_VERSION_STRING "4.00.18"
-+#define fw2400_VERSION_STRING "4.00.23"
- #else
--#define FW_VERSION_STRING "4.00.18"
-+#define FW_VERSION_STRING "4.00.23"
- #endif
-
- #ifdef UNIQUE_FW_NAME
-@@ -52,19 +39,19 @@ uint32_t fw2400_code01[] = {
- #else
- uint32_t risc_code01[] = {
- #endif
-- 0x0401f17c, 0x0010d000, 0x00100000, 0x0000a971,
-- 0x00000004, 0x00000000, 0x00000012, 0x00000002,
-+ 0x0401f198, 0x0010e000, 0x00100000, 0x0000a363,
-+ 0x00000004, 0x00000000, 0x00000017, 0x00000002,
- 0x00000003, 0x00000000, 0x20434f50, 0x59524947,
- 0x48542032, 0x30303520, 0x514c4f47, 0x49432043,
- 0x4f52504f, 0x52415449, 0x4f4e2020, 0x20495350,
- 0x32347878, 0x20466972, 0x6d776172, 0x65202020,
-- 0x56657273, 0x696f6e20, 0x342e302e, 0x31382020,
-+ 0x56657273, 0x696f6e20, 0x342e302e, 0x32332020,
- 0x20202024, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-- 0x42001800, 0x0010014f, 0x42002000, 0x0010b6fd,
-+ 0x42001800, 0x0010014f, 0x42002000, 0x0010b0cd,
- 0x500c0800, 0x800c1800, 0x500c1000, 0x800c1800,
- 0x54042000, 0x80102000, 0x80040800, 0x80081040,
- 0x040207fc, 0x500c0800, 0x800409c0, 0x040207f6,
-@@ -147,443 +134,377 @@ uint32_t risc_code01[] = {
- 0x00000010, 0x00006130, 0x00000010, 0x00006150,
- 0x00000010, 0x00006170, 0x00000010, 0x00006190,
- 0x00000010, 0x000061b0, 0x00000010, 0x00000000,
-- 0x42000000, 0x00000100, 0x4202f000, 0x00000000,
-- 0x42000800, 0x00021f00, 0x45780800, 0x80040800,
-- 0x80000040, 0x040207fd, 0x4203f000, 0x00021fff,
-- 0x40000000, 0x4203e000, 0x90000100, 0x40000000,
-- 0x0201f800, 0x00100743, 0x42000000, 0x00001000,
-- 0x50000000, 0x82000480, 0x24320002, 0x04020015,
-- 0x42000800, 0x00000064, 0x80040840, 0x04000007,
-- 0x4a030000, 0x00000001, 0x40000000, 0x59800000,
-- 0x8c000500, 0x040007f9, 0x04000008, 0x42000800,
-- 0x00007a17, 0x50040000, 0x8c00050e, 0x04020003,
-- 0x8400054e, 0x44000800, 0x4a030000, 0x00000000,
-- 0x4a03c020, 0x00000004, 0x4203e000, 0x6000000f,
-- 0x59e00023, 0x8c000500, 0x04020039, 0x42000000,
-- 0x00100001, 0x50000800, 0x82040c00, 0x00000004,
-- 0x58042003, 0x42001000, 0xffffffff, 0x0201f800,
-- 0x0010073a, 0x0402004e, 0x58042003, 0x42001000,
-- 0xffffffff, 0x0201f800, 0x0010073a, 0x04020048,
-- 0x58042003, 0x42001000, 0x00ffffff, 0x0201f800,
-- 0x0010073a, 0x04020042, 0x58042003, 0x42001000,
-- 0x00ffffff, 0x0201f800, 0x0010073a, 0x0402003c,
-- 0x42000000, 0x00100001, 0x5000a000, 0x8250a400,
-- 0x00000004, 0x4200a800, 0x00020000, 0x5850b003,
-- 0x0201f800, 0x0010a93e, 0x8250a400, 0x00000005,
-- 0x4a0370e8, 0x00000003, 0x4200a800, 0x0000c000,
-- 0x5850b003, 0x0201f800, 0x0010a93e, 0x4a0378e8,
-- 0x00000003, 0x4200a800, 0x00008000, 0x5850b003,
-- 0x0201f800, 0x0010a93e, 0x0401f02b, 0x42000800,
-- 0x00020000, 0x58042003, 0x42001000, 0xffffffff,
-- 0x0201f800, 0x0010073a, 0x04020019, 0x4a0370e8,
-- 0x00000003, 0x42000800, 0x0000c000, 0x58042003,
-- 0x82102500, 0x00ffffff, 0x42001000, 0x00ffffff,
-- 0x0201f800, 0x0010073a, 0x0402000d, 0x4a0378e8,
-- 0x00000003, 0x42000800, 0x00008000, 0x58042003,
-- 0x82102500, 0x00ffffff, 0x42001000, 0x00ffffff,
-- 0x0201f800, 0x0010073a, 0x0400000b, 0x4a03c020,
-+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-+ 0x00100000, 0x00100000, 0x0000a363, 0xffffffff,
-+ 0x0010e004, 0x00020000, 0x000008fe, 0xffffffff,
-+ 0x0010e902, 0x0010ca00, 0x00000aa3, 0xffffffff,
-+ 0x0010f3a5, 0x0000c000, 0x00000742, 0x00ffffff,
-+ 0x0010fae7, 0x00008000, 0x00000542, 0x00ffffff,
-+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-+ 0x4203f000, 0x00021fff, 0x40000000, 0x4203e000,
-+ 0x90000100, 0x40000000, 0x42000000, 0x00000100,
-+ 0x4202f000, 0x00000000, 0x42000800, 0x00021f00,
-+ 0x45780800, 0x80040800, 0x80000040, 0x040207fd,
-+ 0x42000800, 0x000208ff, 0x45780800, 0x80040800,
-+ 0x82040480, 0x00020919, 0x040017fc, 0x0201f800,
-+ 0x00100625, 0x42000000, 0x00001000, 0x50000000,
-+ 0x82000480, 0x24320002, 0x04020015, 0x42000800,
-+ 0x00000064, 0x80040840, 0x04000007, 0x4a030000,
-+ 0x00000001, 0x40000000, 0x59800000, 0x8c000500,
-+ 0x040007f9, 0x04000008, 0x42000800, 0x00007a17,
-+ 0x50040000, 0x8c00050e, 0x04020003, 0x8400054e,
-+ 0x44000800, 0x4a030000, 0x00000000, 0x4a03c020,
-+ 0x00000004, 0x4203e000, 0x6000000f, 0x59e00023,
-+ 0x8c000500, 0x04020021, 0x4a0370e8, 0x00000003,
-+ 0x4a0378e8, 0x00000003, 0x42002800, 0x00100180,
-+ 0x58140800, 0x800409c0, 0x04000009, 0x58142002,
-+ 0x58141003, 0x0201f800, 0x0010061c, 0x04020024,
-+ 0x82142c00, 0x00000004, 0x0401f7f6, 0x42002800,
-+ 0x00100180, 0x5814a000, 0x8050a1c0, 0x0400000b,
-+ 0x5814a801, 0x40500000, 0x80540480, 0x04000004,
-+ 0x5814b002, 0x0201f800, 0x0010a330, 0x82142c00,
-+ 0x00000004, 0x0401f7f4, 0x4a0370e8, 0x00000003,
-+ 0x4a0378e8, 0x00000003, 0x42002800, 0x00100180,
-+ 0x58140801, 0x800409c0, 0x04000013, 0x58142002,
-+ 0x58141003, 0x0201f800, 0x0010061c, 0x04020004,
-+ 0x82142c00, 0x00000004, 0x0401f7f6, 0x4a03c020,
- 0x00004010, 0x4a03c011, 0x40100011, 0x04006000,
- 0x4203e000, 0x40000000, 0x4203e000, 0x30000001,
-- 0x0401f000, 0x0201f800, 0x001007d7, 0x42001000,
-- 0x0010a971, 0x40080000, 0x80140480, 0x82001d00,
-- 0xffffff00, 0x04020003, 0x40001800, 0x0401f003,
-- 0x42001800, 0x000000ff, 0x480bc840, 0x480fc842,
-- 0x04011000, 0x400c0000, 0x80081400, 0x40140000,
-- 0x80080580, 0x040207f0, 0x4817500d, 0x45782800,
-- 0x59c40000, 0x82000500, 0xffff0000, 0x80000120,
-- 0x82000580, 0x00002422, 0x04020005, 0x59a8006f,
-- 0x84000540, 0x4803506f, 0x0401f00a, 0x59e00003,
-- 0x82000500, 0x00030000, 0x82000580, 0x00010000,
-- 0x04020004, 0x59a8006f, 0x84000542, 0x4803506f,
-- 0x42000800, 0x00000040, 0x59a8006f, 0x8c000502,
-- 0x0402000e, 0x42000800, 0x00001000, 0x82141480,
-- 0x0017ffff, 0x04021009, 0x80040902, 0x82141480,
-- 0x0013ffff, 0x04021005, 0x80040902, 0x82141480,
-- 0x0011ffff, 0x04001bc8, 0x4807500e, 0x42001000,
-- 0x00000024, 0x0201f800, 0x001063cf, 0x82040c00,
-- 0x0010cfc0, 0x4807500b, 0x4a03c810, 0x00100000,
-- 0x4a03c811, 0x0010a971, 0x4a03c829, 0x00000004,
-- 0x59e40001, 0x82000540, 0x0003001d, 0x4803c801,
-- 0x4a03c014, 0x001c001c, 0x42001000, 0x0000001c,
-- 0x0201f800, 0x00100728, 0x4202c000, 0x0010cfc0,
-- 0x59aab00b, 0x59aaa00b, 0x59aaa80b, 0x59aac80e,
-- 0x49675069, 0x59a8000b, 0x4803500c, 0x0201f800,
-- 0x001006a3, 0x0201f800, 0x0010768a, 0x0201f800,
-- 0x00100804, 0x0201f800, 0x0010084d, 0x0201f800,
-- 0x00101a60, 0x0201f800, 0x001013a4, 0x0201f800,
-- 0x001009b6, 0x0201f800, 0x001013a4, 0x0201f800,
-- 0x00100f9a, 0x0201f800, 0x0010640f, 0x0401fb54,
-- 0x0201f800, 0x00101fb5, 0x0201f800, 0x0010508b,
-- 0x0201f800, 0x00104b36, 0x0201f800, 0x00105ecd,
-- 0x0201f800, 0x00105c61, 0x0201f800, 0x0010143d,
-- 0x0201f800, 0x001012bf, 0x4203e000, 0xf0000001,
-- 0x4a035070, 0x00000014, 0x4a035071, 0x0000000b,
-- 0x4a035072, 0x00000001, 0x4a035073, 0x00000000,
-- 0x42000000, 0x00001000, 0x50000000, 0x82000480,
-- 0x24220001, 0x0400004a, 0x59e00002, 0x8c00051e,
-+ 0x0401f000, 0x0201f800, 0x0010ca04, 0x0201f800,
-+ 0x001006b9, 0x4c140000, 0x42002800, 0x0010ca00,
-+ 0x42001000, 0x0010a363, 0x40080000, 0x80140480,
-+ 0x82001d00, 0xffffff00, 0x04020003, 0x40001800,
-+ 0x0401f003, 0x42001800, 0x000000ff, 0x480bc840,
-+ 0x480fc842, 0x04011000, 0x400c0000, 0x80081400,
-+ 0x40140000, 0x80080580, 0x040207f0, 0x5c002800,
-+ 0x42001000, 0x0010d4a3, 0x40080000, 0x80140480,
-+ 0x82001d00, 0xffffff00, 0x04020003, 0x40001800,
-+ 0x0401f003, 0x42001800, 0x000000ff, 0x480bc840,
-+ 0x480fc842, 0x04011000, 0x400c0000, 0x80081400,
-+ 0x40140000, 0x80080580, 0x040207f0, 0x4817500c,
-+ 0x45782800, 0x4a03c014, 0x001c001c, 0x42000000,
-+ 0x00001000, 0x50000000, 0x82000480, 0x24220001,
-+ 0x04000aab, 0x42000000, 0x00001000, 0x50000000,
-+ 0x82000480, 0x24320001, 0x04000aa5, 0x59c40000,
-+ 0x82000500, 0xffff0000, 0x80000120, 0x82000580,
-+ 0x00002422, 0x04020005, 0x59a8006c, 0x84000540,
-+ 0x4803506c, 0x0401f00a, 0x59e00003, 0x82000500,
-+ 0x00030000, 0x82000580, 0x00010000, 0x04020004,
-+ 0x59a8006c, 0x84000542, 0x4803506c, 0x42000800,
-+ 0x00001000, 0x82141480, 0x0017ffff, 0x04021009,
-+ 0x80040902, 0x82141480, 0x0013ffff, 0x04021005,
-+ 0x80040902, 0x82141480, 0x0011ffff, 0x04001a84,
-+ 0x4807500d, 0x42001000, 0x00000024, 0x0201f800,
-+ 0x00106298, 0x82040c00, 0x0010d8d4, 0x4807500a,
-+ 0x4a03c810, 0x00100000, 0x4a03c811, 0x0010a363,
-+ 0x4a03c812, 0x0010ca00, 0x4a03c813, 0x0010d4a2,
-+ 0x4a03c829, 0x00000004, 0x59e40001, 0x82000540,
-+ 0x0003401d, 0x4803c801, 0x42001000, 0x0000001c,
-+ 0x0401fb86, 0x4202c000, 0x0010d8d4, 0x59aab00a,
-+ 0x59aaa00a, 0x59aaa80a, 0x59aac80d, 0x49675066,
-+ 0x59a8000a, 0x4803500b, 0x0401faef, 0x0201f800,
-+ 0x0010717f, 0x0201f800, 0x001006ea, 0x0201f800,
-+ 0x00100745, 0x0201f800, 0x0010194d, 0x0201f800,
-+ 0x00101274, 0x0201f800, 0x001008ac, 0x0201f800,
-+ 0x00101274, 0x0201f800, 0x00100e93, 0x0201f800,
-+ 0x001062d8, 0x0401fa0d, 0x0201f800, 0x00101ddd,
-+ 0x0201f800, 0x00104f3c, 0x0201f800, 0x00104a35,
-+ 0x0201f800, 0x00105d7b, 0x0201f800, 0x00105b02,
-+ 0x0201f800, 0x0010130d, 0x0201f800, 0x0010118b,
-+ 0x4203e000, 0xf0000001, 0x4a03506d, 0x00000026,
-+ 0x4a03506e, 0x0000001d, 0x4a03506f, 0x00000001,
-+ 0x4a035070, 0x00000000, 0x59e00002, 0x8c00051e,
- 0x42000000, 0x7ffe00fe, 0x04000003, 0x42000000,
-- 0x7ffe01fe, 0x50000800, 0x48075058, 0x80040920,
-- 0x82040580, 0x0000013e, 0x0402000b, 0x59a8006f,
-- 0x84000548, 0x4803506f, 0x4a035070, 0x00000055,
-- 0x4a035071, 0x00000051, 0x4a035073, 0x0000000f,
-- 0x0401f033, 0x82040580, 0x0000013f, 0x0402000b,
-- 0x59a8006f, 0x8400054a, 0x4803506f, 0x4a035070,
-- 0x00000055, 0x4a035071, 0x00000051, 0x4a035073,
-- 0x0000000f, 0x0401f026, 0x59e00003, 0x82000500,
-- 0x00030000, 0x82000580, 0x00000000, 0x04020020,
-- 0x82040580, 0x00000147, 0x04000010, 0x82040580,
-- 0x00000145, 0x0402001a, 0x59a8006f, 0x84000546,
-- 0x4803506f, 0x4a035070, 0x00000033, 0x4a035071,
-- 0x00000030, 0x4a035072, 0x00000020, 0x4a035073,
-- 0x00000001, 0x0401f00c, 0x59a8006f, 0x84000544,
-- 0x4803506f, 0x4a035070, 0x00000033, 0x4a035071,
-- 0x00000030, 0x4a035072, 0x00000020, 0x4a035073,
-- 0x00000001, 0x4a0378e4, 0x000c0000, 0x59a8006f,
-- 0x8c000502, 0x04000004, 0x82000500, 0x00000030,
-- 0x04000b25, 0x4a03c018, 0x0000000f, 0x4203e000,
-- 0x20000511, 0x4203e000, 0x50010000, 0x4a03c020,
-- 0x00000000, 0x04027013, 0x59e00020, 0x82000580,
-- 0x00000002, 0x0402000f, 0x4a03c020, 0x00004000,
-- 0x4a03c011, 0x40000010, 0x04006000, 0x4203e000,
-- 0x40000000, 0x59e00017, 0x8c000508, 0x04000003,
-- 0x4a03c017, 0x00000000, 0x4203e000, 0x30000001,
-- 0x4202d800, 0x00000000, 0x4203e000, 0xb0600000,
-- 0x59a80873, 0x4007f800, 0x0201f000, 0x00020004,
-- 0x4df00000, 0x4203e000, 0x50000000, 0x416c0000,
-- 0x82000c80, 0x00000008, 0x04021afb, 0x0c01f804,
-- 0x5c03e000, 0x0201f000, 0x00020008, 0x00100328,
-- 0x0010033b, 0x00100411, 0x00100327, 0x0010048c,
-- 0x00100327, 0x00100327, 0x001005d0, 0x0401faee,
-- 0x42000800, 0x0010b2a0, 0x5804001d, 0x4803c857,
-- 0x8c000500, 0x0400000d, 0x84000500, 0x4800081d,
-- 0x4202d800, 0x00000004, 0x0401fbe8, 0x49f3c857,
-- 0x5c000800, 0x5c000000, 0x82000540, 0x00003e00,
-- 0x4c000000, 0x4c040000, 0x1c01f000, 0x0401fbd2,
-- 0x0201f800, 0x00104e0d, 0x04000010, 0x0201f800,
-- 0x00104e23, 0x04020035, 0x59940023, 0x82000580,
-- 0x0010401b, 0x04020004, 0x59940022, 0x800001c0,
-- 0x0402002e, 0x59c40006, 0x82000540, 0x000000c0,
-- 0x48038806, 0x0401f029, 0x0201f800, 0x00104d76,
-- 0x836c0580, 0x00000001, 0x040200be, 0x59a80017,
-- 0x82000580, 0x00000009, 0x040200ba, 0x497b5010,
-- 0x4a038893, 0x00000001, 0x42001000, 0x000000f0,
-- 0x0201f800, 0x001019aa, 0x0201f800, 0x00104e1b,
-- 0x59c41006, 0x04020006, 0x82081540, 0x000000f1,
-- 0x82081500, 0xbbffffff, 0x0401f003, 0x82081540,
-- 0x440000f1, 0x480b8806, 0x0201f800, 0x00105de2,
-- 0x0201f800, 0x001069b8, 0x42000000, 0x0010b638,
-- 0x0201f800, 0x0010a86e, 0x42001000, 0x00008030,
-- 0x497b5013, 0x0401f037, 0x0201f800, 0x00103951,
-- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000480,
-- 0x00000007, 0x04021093, 0x0201f800, 0x00105de2,
-- 0x59c400a3, 0x82000500, 0xffefffff, 0x480388a3,
-- 0x59a8004b, 0x800001c0, 0x04020004, 0x0201f800,
-- 0x00103f53, 0x0401f087, 0x59a80015, 0x84000546,
-- 0x48035015, 0x0201f800, 0x00104e13, 0x59c41006,
-- 0x04020006, 0x82081540, 0x44000001, 0x82081500,
-- 0xffffff0f, 0x0401f003, 0x82081540, 0x440000f1,
-- 0x480b8806, 0x497b9005, 0x4a038802, 0x0000ffff,
-- 0x4a0378e4, 0x00003000, 0x4a0378e4, 0x000c0000,
-- 0x42000000, 0x0010b60a, 0x0201f800, 0x0010a86e,
-- 0x59a81010, 0x42000800, 0x00000003, 0x0201f800,
-- 0x001069af, 0x42001000, 0x00008010, 0x59a8180a,
-- 0x0201f800, 0x00103857, 0x0201f800, 0x00101886,
-- 0x59a80805, 0x82040d00, 0xffffffdf, 0x48075005,
-- 0x0201f800, 0x0010468b, 0x0201f800, 0x00104e0d,
-- 0x0400000a, 0x0201f800, 0x00103f58, 0x04000007,
-- 0x4a035013, 0x00000001, 0x497b5021, 0x0201f800,
-- 0x00103a9f, 0x0401f04f, 0x0201f800, 0x0010473b,
-- 0x04000005, 0x59c41002, 0x8408150c, 0x480b8802,
-- 0x0401f012, 0x0201f800, 0x00104e0d, 0x04020006,
-- 0x59a8001d, 0x80000540, 0x02000800, 0x001090d5,
-- 0x0401f00a, 0x0201f800, 0x001090d5, 0x59a80026,
-- 0x8c000506, 0x04020005, 0x59a8001d, 0x80000540,
-- 0x02020800, 0x00104075, 0x497b5028, 0x497b5027,
-- 0x497b5018, 0x0201f800, 0x00104e0d, 0x59a81026,
-- 0x0402000a, 0x0201f800, 0x00101694, 0x80001580,
-- 0x59a8002a, 0x82000500, 0xffff0000, 0x80040d40,
-- 0x4807502a, 0x0401f005, 0x59a8002a, 0x82000500,
-- 0xffff0000, 0x4803502a, 0x599c0017, 0x8c00050a,
-- 0x04000002, 0x84081544, 0x480b5026, 0x0201f800,
-- 0x00104e0d, 0x04000004, 0x0201f800, 0x00101694,
-- 0x48078880, 0x42001000, 0x00000005, 0x0201f800,
-- 0x00106e07, 0x497b5028, 0x497b501b, 0x4a03501c,
-- 0x0000ffff, 0x4a0378e4, 0x000000c0, 0x4202d800,
-- 0x00000002, 0x0201f800, 0x00104e0d, 0x04000007,
-- 0x59a80026, 0x82000500, 0x0000000c, 0x82000580,
-- 0x00000004, 0x04000003, 0x0201f800, 0x00101bf0,
-- 0x1c01f000, 0x59a8001c, 0x82000580, 0x0000ffff,
-- 0x04000004, 0x0201f800, 0x00101bf0, 0x0401f074,
-- 0x59a80026, 0x8c00050a, 0x04020003, 0x8c000506,
-- 0x0400001c, 0x8c000500, 0x0400001a, 0x4a038802,
-- 0x0000ffbf, 0x8c000502, 0x04000016, 0x599c0018,
-- 0x8c000516, 0x04020010, 0x59a80027, 0x82000580,
-- 0x0000ffff, 0x0400000c, 0x0201f800, 0x00101d45,
-- 0x59a80026, 0x8c000504, 0x0402005d, 0x42001000,
-- 0x00000003, 0x417a5800, 0x0201f800, 0x00101d6a,
-- 0x0401f057, 0x59a80028, 0x80000540, 0x04020054,
-- 0x59a80026, 0x8c000508, 0x04020005, 0x59a8001b,
-- 0x80000540, 0x0402004e, 0x0401f003, 0x8c000516,
-- 0x0400004b, 0x0201f800, 0x0010473b, 0x04020048,
-- 0x599c0018, 0x8c000516, 0x04020004, 0x0201f800,
-- 0x00104abe, 0x04020042, 0x599c0017, 0x8c00050a,
-- 0x0400000d, 0x4200b000, 0x000007f0, 0x417a8800,
-- 0x0201f800, 0x00020267, 0x04020004, 0x59340200,
-- 0x8c00051a, 0x04020036, 0x81468800, 0x8058b040,
-- 0x040207f8, 0x4a038802, 0x0000ffff, 0x42001800,
-- 0x0010b2e7, 0x0401fb98, 0x42001800, 0x0010b2f4,
-- 0x0401fb95, 0x59a80005, 0x84000502, 0x48035005,
-- 0x4a0378e4, 0x00000080, 0x4202d800, 0x00000003,
-- 0x4a03501c, 0x0000ffff, 0x0401fa8b, 0x80000580,
-- 0x0201f800, 0x001015fa, 0x599c0018, 0x8c000516,
-- 0x04000004, 0x0201f800, 0x00103929, 0x0401f009,
-- 0x42001800, 0x0000ffff, 0x42002000, 0x00000006,
-- 0x42003000, 0x00000000, 0x0201f800, 0x001038c7,
-- 0x0201f800, 0x00104e23, 0x0400000b, 0x59c40006,
-- 0x0201f800, 0x00104e0d, 0x04000004, 0x82000500,
-- 0xffffff0f, 0x0401f003, 0x82000500, 0xfbffffff,
-- 0x48038806, 0x0201f800, 0x00106c8a, 0x1c01f000,
-- 0x4c040000, 0x4c080000, 0x4c100000, 0x59a8003e,
-- 0x82000c80, 0x00000004, 0x04021983, 0x0c01f805,
-- 0x5c002000, 0x5c001000, 0x5c000800, 0x1c01f000,
-- 0x0010049c, 0x00100527, 0x00100553, 0x001005b4,
-- 0x42000000, 0x00000001, 0x0201f800, 0x001015fa,
-- 0x0201f800, 0x00105de2, 0x59c408a3, 0x82040d00,
-- 0xfffffff7, 0x480788a3, 0x0201f800, 0x00104e13,
-- 0x0400000e, 0x0201f800, 0x00104e23, 0x0400000b,
-- 0x0201f800, 0x00104e1b, 0x04020967, 0x59c400a3,
-- 0x84000532, 0x84000570, 0x480388a3, 0x4a038808,
-- 0x00000008, 0x0401f013, 0x59c400a3, 0x84000530,
-- 0x82000500, 0xbf7fffff, 0x480388a3, 0x42000800,
-- 0x000000f8, 0x0201f800, 0x00104030, 0x59c400a3,
-- 0x82000540, 0x00018000, 0x8400051c, 0x480388a3,
-- 0x82000500, 0xfffeffff, 0x480388a3, 0x497b8808,
-- 0x59c40006, 0x82000500, 0xfbffff0e, 0x48038806,
-- 0x497b2822, 0x497b2823, 0x42000800, 0x000001f4,
-- 0x42001000, 0x001005ce, 0x0201f800, 0x00105cbc,
-- 0x59c40805, 0x42001000, 0x00000001, 0x0201f800,
-- 0x001019aa, 0x0201f800, 0x001016ac, 0x0402000a,
-- 0x42000000, 0x00000001, 0x0201f800, 0x001018fa,
-- 0x42000000, 0x00000001, 0x0201f800, 0x00101892,
-- 0x0401f022, 0x0201f800, 0x001016b3, 0x04020008,
-- 0x41780000, 0x0201f800, 0x001018fa, 0x41780000,
-- 0x0201f800, 0x00101892, 0x0401f018, 0x0201f800,
-- 0x001016ba, 0x0402000a, 0x42000000, 0x00000002,
-- 0x0201f800, 0x001018fa, 0x42000000, 0x00000002,
-- 0x0201f800, 0x00101892, 0x0401f00c, 0x0201f800,
-- 0x001016c1, 0x04020918, 0x59a80049, 0x800001c0,
-- 0x04000006, 0x0201f800, 0x001016c7, 0x4a03503e,
-- 0x00000001, 0x0401f021, 0x0201f800, 0x00101994,
-- 0x4a03503e, 0x00000001, 0x0201f800, 0x00104e13,
-- 0x0400000c, 0x0201f800, 0x00104e23, 0x04000009,
-- 0x0201f800, 0x00104e1b, 0x04020903, 0x4a035033,
-- 0x00000001, 0x0201f800, 0x00104d76, 0x0401f00f,
-- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-- 0x00000008, 0x04000003, 0x4a038805, 0x04000000,
-- 0x59c400a3, 0x82000540, 0x0001c000, 0x480388a3,
-- 0x84000520, 0x480388a3, 0x1c01f000, 0x0401f8a3,
-- 0x04020004, 0x4a03503e, 0x00000003, 0x0401f027,
-- 0x0201f800, 0x001016c1, 0x04020011, 0x59a80049,
-- 0x800001c0, 0x0400000e, 0x0201f800, 0x001016c7,
-- 0x59a80048, 0x8c00051e, 0x0400001c, 0x0201f800,
-- 0x00104e1b, 0x04020009, 0x4a035033, 0x00000001,
-- 0x0201f800, 0x00104d76, 0x0401f004, 0x0201f800,
-- 0x00101941, 0x04020011, 0x0201f800, 0x00101886,
-- 0x4a03503e, 0x00000002, 0x497b5049, 0x59c400a3,
-- 0x84000520, 0x480388a3, 0x497b2822, 0x497b2823,
-- 0x42000800, 0x0000002d, 0x42001000, 0x001005ce,
-- 0x0201f800, 0x00105cbc, 0x1c01f000, 0x0401f877,
-- 0x04020004, 0x4a03503e, 0x00000003, 0x0401f05b,
-- 0x4a038805, 0x000000f0, 0x0201f800, 0x00101941,
-- 0x04020050, 0x0201f800, 0x00104e1b, 0x04000044,
-- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-- 0x00000008, 0x04000020, 0x59c40005, 0x8c000534,
-- 0x0402001d, 0x59940022, 0x82000580, 0x00000001,
-- 0x04020046, 0x0201f800, 0x00104e23, 0x04020043,
-- 0x4a038805, 0x000000f0, 0x0201f800, 0x00104e67,
-- 0x4a035032, 0x0000aaaa, 0x4a035033, 0x00000000,
-- 0x59c408a3, 0x82040d40, 0x00000008, 0x480788a3,
-- 0x4202d800, 0x00000001, 0x4a03503e, 0x00000000,
-- 0x4a038805, 0x00000001, 0x497b2822, 0x497b2823,
-- 0x0401f01f, 0x0201f800, 0x00104e23, 0x04020007,
-- 0x59a80032, 0x82000580, 0x0000aaaa, 0x04020003,
-- 0x4a035010, 0x00ffffff, 0x497b5032, 0x59c40006,
-- 0x82000540, 0x04000001, 0x48038806, 0x59a80805,
-- 0x8c040d06, 0x04020005, 0x59c408a3, 0x82040d40,
-- 0x00000008, 0x480788a3, 0x4202d800, 0x00000001,
-- 0x4a03503e, 0x00000000, 0x4a038805, 0x00000001,
-- 0x497b2822, 0x497b2823, 0x0401f010, 0x59c40005,
-- 0x82000500, 0x000000c0, 0x0400000c, 0x59c40006,
-- 0x82000540, 0x000000f1, 0x48038806, 0x0401f7ef,
-- 0x0201f800, 0x001016c1, 0x04020004, 0x59a80049,
-- 0x800001c0, 0x040207a4, 0x497b8885, 0x1c01f000,
-- 0x4803c856, 0x42000000, 0x00000001, 0x0201f800,
-- 0x001015fa, 0x4a03503e, 0x00000000, 0x0201f800,
-- 0x001016c1, 0x0402000b, 0x59a80052, 0x800001c0,
-- 0x04000004, 0x80000040, 0x48035052, 0x04020005,
-- 0x4a035052, 0x0000000a, 0x4a035049, 0x00000001,
-- 0x497b8885, 0x0401f0f6, 0x59940022, 0x59940823,
-- 0x80040540, 0x1c01f000, 0x497b2823, 0x1c01f000,
-- 0x4c080000, 0x42001000, 0x000000f0, 0x0201f800,
-- 0x001019aa, 0x5c001000, 0x1c01f000, 0x4a03505c,
-- 0x00000004, 0x4a03505d, 0x00000000, 0x4a03505e,
-- 0x00000012, 0x4a03505f, 0x00000002, 0x4a035010,
-- 0x00ffffff, 0x0201f800, 0x001090d5, 0x4a03502a,
-- 0x20200000, 0x4a03502b, 0x88000200, 0x4a03502c,
-- 0x00ff001f, 0x4a03502d, 0x000007d0, 0x4a03502e,
-- 0x80000000, 0x4a03502f, 0x00000200, 0x4a035030,
-- 0x00ff0000, 0x4a035031, 0x00010000, 0x4a03503a,
-- 0x514c4f47, 0x4a03503b, 0x49432020, 0x1c01f000,
-- 0x4d440000, 0x417a8800, 0x41780800, 0x0201f800,
-- 0x00020267, 0x04020005, 0x0201f800, 0x00104836,
-- 0x04020002, 0x80040800, 0x81468800, 0x83440580,
-- 0x000007f0, 0x040207f6, 0x5c028800, 0x1c01f000,
-- 0x4803c857, 0x5c000000, 0x4c000000, 0x4803c857,
-- 0x0401f809, 0x485fc857, 0x4203e000, 0x50000000,
-- 0x5c000000, 0x4d780000, 0x4200b800, 0x00008002,
-- 0x0401f006, 0x485fc857, 0x4203e000, 0x50000000,
-- 0x4200b800, 0x00008002, 0x04006000, 0x4c000000,
-- 0x4c040000, 0x59bc00ea, 0x82000500, 0x00000007,
-- 0x82000580, 0x00000001, 0x04020005, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001069a3, 0x5c000800,
-- 0x4807c025, 0x80040920, 0x4807c026, 0x5c000000,
-- 0x4803c023, 0x80000120, 0x4803c024, 0x5c000000,
-- 0x4803c857, 0x4803c021, 0x80000120, 0x4803c022,
-- 0x41f80000, 0x4803c027, 0x80000120, 0x4803c028,
-- 0x42000000, 0x00001000, 0x50000000, 0x82000480,
-- 0x24320001, 0x4803c857, 0x04001053, 0x42000800,
-- 0x00000064, 0x80040840, 0x04000007, 0x4a030000,
-- 0x00000001, 0x40000000, 0x59800000, 0x8c000500,
-- 0x040007f9, 0x04000046, 0x42000800, 0x0010bfa2,
-- 0x46000800, 0xfaceface, 0x80040800, 0x4c080000,
-- 0x4c0c0000, 0x42001000, 0x00007a00, 0x58080013,
-- 0x44000800, 0x80040800, 0x58080019, 0x44000800,
-- 0x80040800, 0x5808001a, 0x44000800, 0x80040800,
-- 0x5808001b, 0x44000800, 0x80040800, 0x5808001c,
-- 0x44000800, 0x80040800, 0x5808001f, 0x44000800,
-- 0x80040800, 0x42001000, 0x00007a40, 0x42001800,
-- 0x0000000b, 0x50080000, 0x44000800, 0x80081000,
-- 0x80040800, 0x800c1840, 0x040207fb, 0x42001800,
-- 0x00000003, 0x42001000, 0x00007b00, 0x480c1003,
-- 0x58080005, 0x44000800, 0x80040800, 0x800c1840,
-- 0x040217fb, 0x42001000, 0x00007c00, 0x58080002,
-- 0x44000800, 0x80040800, 0x58080003, 0x44000800,
-- 0x80040800, 0x58080020, 0x44000800, 0x80040800,
-- 0x58080021, 0x44000800, 0x80040800, 0x58080022,
-- 0x44000800, 0x80040800, 0x58080023, 0x44000800,
-- 0x80040800, 0x5c001800, 0x5c001000, 0x4a030000,
-- 0x00000000, 0x485fc020, 0x905cb9c0, 0x825cbd40,
-- 0x00000012, 0x485fc011, 0x4203e000, 0x40000000,
-- 0x4202d800, 0x00000005, 0x59e00017, 0x8c000508,
-- 0x04000003, 0x4a03c017, 0x00000002, 0x4203e000,
-- 0x30000001, 0x0401f81f, 0x0401f7ff, 0x4a03c850,
-- 0x0010bfbe, 0x4a03c851, 0x0010cfbd, 0x4a03c853,
-- 0x00000800, 0x4a03c855, 0x0001eb5a, 0x59e40001,
-- 0x82000540, 0x00003f00, 0x4803c801, 0x4a03b104,
-- 0x70000002, 0x4a03a804, 0x70000002, 0x4a03b004,
-- 0x70000002, 0x42000000, 0x0010b6eb, 0x49780001,
-- 0x49780002, 0x1c01f000, 0x5c036000, 0x4db00000,
-- 0x49b3c857, 0x4803c857, 0x1c01f000, 0x1c01f000,
-- 0x59a8006b, 0x8c000530, 0x040207fe, 0x4c080000,
-- 0x42001000, 0x00000004, 0x0401f862, 0x5c001000,
-- 0x4201d000, 0x00028b0a, 0x0201f800, 0x00105dd2,
-- 0x4c080000, 0x42001000, 0x00000008, 0x0401f859,
-- 0x5c001000, 0x4201d000, 0x00028b0a, 0x0201f800,
-- 0x00105dd2, 0x4c080000, 0x42001000, 0x00000010,
-- 0x0401f850, 0x5c001000, 0x4201d000, 0x00028b0a,
-- 0x0201f800, 0x00105dd2, 0x0401f7e2, 0x8c00050c,
-- 0x59a8086b, 0x04020003, 0x84040d30, 0x0401f006,
-- 0x84040d70, 0x4807506b, 0x42001000, 0x00000000,
-- 0x0401f040, 0x4807506b, 0x836c0500, 0x00000007,
-- 0x0c01f001, 0x00100727, 0x0010070d, 0x0010070d,
-- 0x001006f5, 0x0010071a, 0x0010070d, 0x0010070d,
-- 0x0010071a, 0x59a8006f, 0x8c000502, 0x04020013,
-- 0x59c40801, 0x82040d00, 0x00018000, 0x82040580,
-- 0x00010000, 0x0400000a, 0x82040580, 0x00008000,
-- 0x04000004, 0x42001000, 0x42004000, 0x0401f006,
-- 0x42001000, 0x22002000, 0x0401f003, 0x42001000,
-- 0x12001000, 0x0401f025, 0x42001000, 0x00001004,
-- 0x0401f022, 0x59a8006f, 0x8c000502, 0x04020008,
-- 0x59a8006b, 0x8c000534, 0x04020004, 0x42001000,
-- 0x74057005, 0x0401f819, 0x1c01f000, 0x42001000,
-- 0x00002008, 0x0401f7fc, 0x59a8006b, 0x8c000534,
-- 0x0402000a, 0x59a8006f, 0x8c000502, 0x04000004,
-- 0x42001000, 0x24052005, 0x0401f00c, 0x42001000,
-- 0x74057005, 0x0401f009, 0x1c01f000, 0x1c01f000,
-- 0x82081500, 0x0000001c, 0x82081540, 0x001c0000,
-- 0x480bc013, 0x1c01f000, 0x59a8006b, 0x8c000530,
-- 0x04000002, 0x84081570, 0x480b506b, 0x8c000530,
-- 0x04020005, 0x82081500, 0x00007000, 0x80081114,
-- 0x0401fff0, 0x1c01f000, 0x41780000, 0x50041800,
-- 0x800c0400, 0x80040800, 0x80102040, 0x040207fc,
-- 0x80080500, 0x80000540, 0x1c01f000, 0x4202f000,
-- 0x00000000, 0x41780000, 0x41780800, 0x41781000,
-- 0x41781800, 0x41782000, 0x41782800, 0x41783000,
-- 0x41783800, 0x41784000, 0x41784800, 0x41785000,
-- 0x41785800, 0x41786000, 0x41786800, 0x41787000,
-- 0x41787800, 0x41788000, 0x41788800, 0x41789000,
-- 0x41789800, 0x4178a000, 0x4178a800, 0x4178b000,
-- 0x4178b800, 0x4178c000, 0x4178c800, 0x4178d000,
-- 0x4178d800, 0x4178e000, 0x4178e800, 0x4178f000,
-- 0x4178f800, 0x41790000, 0x41790800, 0x41791000,
-- 0x41791800, 0x41792000, 0x41792800, 0x41793000,
-- 0x41793800, 0x41794000, 0x41794800, 0x41795000,
-- 0x41795800, 0x41796000, 0x41796800, 0x41797000,
-- 0x41797800, 0x41798000, 0x41798800, 0x42019000,
-- 0x0010b333, 0x42019800, 0x0010b30a, 0x4179a000,
-- 0x4179a800, 0x4179b000, 0x4179b800, 0x4179c800,
-- 0x4179c000, 0x4179d000, 0x4179d800, 0x4179e000,
-- 0x4179e800, 0x4179f000, 0x4179f800, 0x417a0000,
-- 0x417a0800, 0x417a1000, 0x417a1800, 0x417a2000,
-- 0x42022800, 0x00006100, 0x417a3000, 0x417a3800,
-- 0x417a4000, 0x417a4800, 0x417a5000, 0x417a5800,
-- 0x417a6000, 0x417a6800, 0x417a7000, 0x417a7800,
-- 0x417a8000, 0x417a8800, 0x417a9000, 0x417a9800,
-- 0x417ae800, 0x417af800, 0x42030000, 0x00007c00,
-- 0x42031000, 0x0010b604, 0x42031800, 0x0000bf1d,
-- 0x42032000, 0x0000bf32, 0x42032800, 0x0010b5cc,
-- 0x42033000, 0x0010b274, 0x42034000, 0x0010b2a0,
-- 0x42033800, 0x0010b2bf, 0x42034800, 0x0010b342,
-- 0x42035000, 0x0010b200, 0x42035800, 0x0010aa00,
-- 0x42030800, 0x0010b301, 0x417b6000, 0x42036800,
-- 0x00006f00, 0x4203c800, 0x00003000, 0x42037000,
-- 0x0000ff00, 0x42037800, 0x0000bf00, 0x42038000,
-- 0x00007700, 0x42038800, 0x00004000, 0x42039000,
-- 0x00006000, 0x42039800, 0x0010bcda, 0x4203a000,
-- 0x00007600, 0x4203a800, 0x00007400, 0x4203b000,
-- 0x00007200, 0x4203b800, 0x00007100, 0x4203c000,
-- 0x00007000, 0x4203d000, 0x00000000, 0x4203e800,
-- 0x000200f9, 0x417bd800, 0x1c01f000, 0x42000800,
-- 0x00100000, 0x50040000, 0x4c000000, 0x42000000,
-- 0x0000aaaa, 0x44000800, 0x42001800, 0x00005555,
-- 0x41782000, 0x82102400, 0x00010000, 0x40100000,
-- 0x80042c00, 0x440c2800, 0x42003000, 0x0000000a,
-- 0x80183040, 0x040207ff, 0x50140000, 0x800c0580,
-- 0x04020004, 0x50040000, 0x800c0580, 0x040207f2,
-- 0x5c000000, 0x44000800, 0x80142840, 0x4817c861,
-- 0x1c01f000, 0x59a8081f, 0x800409c0, 0x04020009,
-- 0x49781c0c, 0x4a001a0c, 0x00000200, 0x4a001804,
-- 0x07000000, 0x59a80010, 0x9c0001c0, 0x48001805,
-- 0x0401fdf8, 0x9c0409c0, 0x48041806, 0x1c01f000,
-- 0x59a8080c, 0x4006d000, 0x4202b800, 0x00000001,
-- 0x59a8180d, 0x480fc857, 0x82041400, 0x00000014,
-- 0x82082400, 0x00000014, 0x40100000, 0x800c0480,
-- 0x04001006, 0x44080800, 0x40080800, 0x40101000,
-- 0x815eb800, 0x0401f7f7, 0x45780800, 0x495f5020,
-- 0x1c01f000, 0x835c0480, 0x00000020, 0x04001009,
-- 0x496bc857, 0x815eb840, 0x416a5800, 0x592ed000,
-- 0x497a5800, 0x497a5801, 0x812e59c0, 0x1c01f000,
-- 0x42000000, 0x0010b652, 0x0201f800, 0x0010a86e,
-- 0x417a5800, 0x0401f7f9, 0x815eb840, 0x04001008,
-+ 0x7ffe01fe, 0x50000800, 0x48075055, 0x80040920,
-+ 0x82040580, 0x0000013e, 0x0402000b, 0x59a8006c,
-+ 0x84000548, 0x4803506c, 0x4a03506d, 0x0000005a,
-+ 0x4a03506e, 0x00000058, 0x4a035070, 0x0000000f,
-+ 0x0401f03c, 0x82040580, 0x0000013f, 0x0400000a,
-+ 0x82040580, 0x0000014e, 0x04000007, 0x82040580,
-+ 0x00000155, 0x04000004, 0x82040580, 0x00000156,
-+ 0x0402000b, 0x59a8006c, 0x8400054a, 0x4803506c,
-+ 0x4a03506d, 0x00000055, 0x4a03506e, 0x00000052,
-+ 0x4a035070, 0x00000009, 0x0401f026, 0x59e00003,
-+ 0x82000500, 0x00030000, 0x82000580, 0x00000000,
-+ 0x04020020, 0x82040580, 0x00000147, 0x04000010,
-+ 0x82040580, 0x00000145, 0x0402001a, 0x59a8006c,
-+ 0x84000546, 0x4803506c, 0x4a03506d, 0x00000043,
-+ 0x4a03506e, 0x0000003e, 0x4a03506f, 0x00000025,
-+ 0x4a035070, 0x00000001, 0x0401f00c, 0x59a8006c,
-+ 0x84000544, 0x4803506c, 0x4a03506d, 0x00000043,
-+ 0x4a03506e, 0x0000003e, 0x4a03506f, 0x00000025,
-+ 0x4a035070, 0x00000001, 0x4a0378e4, 0x000c0000,
-+ 0x59a8006c, 0x8c000502, 0x04000004, 0x82000500,
-+ 0x00000030, 0x040009de, 0x4a03c018, 0x0000000f,
-+ 0x4203e000, 0x20000511, 0x4203e000, 0x50010000,
-+ 0x4a03c020, 0x00000000, 0x04027013, 0x59e00020,
-+ 0x82000580, 0x00000002, 0x0402000f, 0x4a03c020,
-+ 0x00004000, 0x4a03c011, 0x40000010, 0x04006000,
-+ 0x4203e000, 0x40000000, 0x59e00017, 0x8c000508,
-+ 0x04000003, 0x4a03c017, 0x00000000, 0x4203e000,
-+ 0x30000001, 0x4202d800, 0x00000000, 0x4203e000,
-+ 0xb0600000, 0x59a80870, 0x4007f800, 0x0201f000,
-+ 0x00020004, 0x4df00000, 0x4203e000, 0x50000000,
-+ 0x416c0000, 0x82000c80, 0x00000008, 0x040219b4,
-+ 0x0c01f804, 0x5c03e000, 0x0201f000, 0x00020008,
-+ 0x00100349, 0x0010035c, 0x0010042c, 0x00100348,
-+ 0x0010d471, 0x00100348, 0x00100348, 0x001004ab,
-+ 0x0401f9a7, 0x42000800, 0x0010ac71, 0x5804001d,
-+ 0x4803c857, 0x8c000500, 0x0400000d, 0x84000500,
-+ 0x4800081d, 0x4202d800, 0x00000004, 0x0401faa9,
-+ 0x49f3c857, 0x5c000800, 0x5c000000, 0x82000540,
-+ 0x00003e00, 0x4c000000, 0x4c040000, 0x1c01f000,
-+ 0x0401fa8f, 0x0201f800, 0x00104ca6, 0x04000010,
-+ 0x0201f800, 0x00104ce4, 0x04020033, 0x59940023,
-+ 0x82000580, 0x00103eab, 0x04020004, 0x59940022,
-+ 0x800001c0, 0x0402002c, 0x59c40006, 0x82000540,
-+ 0x000000c0, 0x48038806, 0x0401f027, 0x0201f800,
-+ 0x00104c16, 0x836c0580, 0x00000001, 0x040200b8,
-+ 0x59a80016, 0x82000580, 0x00000009, 0x040200b4,
-+ 0x497b500f, 0x4a038893, 0x00000001, 0x4a038805,
-+ 0x000000f0, 0x0201f800, 0x00104cd3, 0x59c41006,
-+ 0x04020006, 0x82081540, 0x000000f1, 0x82081500,
-+ 0xbbffffff, 0x0401f003, 0x82081540, 0x440000f1,
-+ 0x480b8806, 0x0201f800, 0x00105c8c, 0x0201f800,
-+ 0x001064a2, 0x42000000, 0x0010b008, 0x0201f800,
-+ 0x0010a260, 0x42001000, 0x00008030, 0x497b5012,
-+ 0x0401f037, 0x0201f800, 0x001037ea, 0x59c400a4,
-+ 0x82000500, 0x0000000f, 0x82000480, 0x00000007,
-+ 0x0402108f, 0x0201f800, 0x00105c8c, 0x59c400a3,
-+ 0x82000500, 0xffefffff, 0x480388a3, 0x59a80048,
-+ 0x800001c0, 0x04020004, 0x0201f800, 0x00103de7,
-+ 0x0401f083, 0x59a80014, 0x84000546, 0x48035014,
-+ 0x0201f800, 0x00104cc2, 0x59c41006, 0x04020006,
-+ 0x82081540, 0x44000001, 0x82081500, 0xffffff0f,
-+ 0x0401f003, 0x82081540, 0x440000f1, 0x480b8806,
-+ 0x497b9005, 0x4a038802, 0x0000ffff, 0x4a0378e4,
-+ 0x00003000, 0x4a0378e4, 0x000c0000, 0x42000000,
-+ 0x0010afda, 0x0201f800, 0x0010a260, 0x59a8100f,
-+ 0x42000800, 0x00000003, 0x0201f800, 0x00106499,
-+ 0x42001000, 0x00008010, 0x59a81809, 0x0201f800,
-+ 0x001036f4, 0x0201f800, 0x0010177f, 0x850e1d0a,
-+ 0x0201f800, 0x0010455a, 0x0201f800, 0x00104ca6,
-+ 0x04000009, 0x8d0e1d06, 0x04000007, 0x4a035012,
-+ 0x00000001, 0x850e1d0e, 0x0201f800, 0x00103938,
-+ 0x0401f04f, 0x0201f800, 0x00104614, 0x04000005,
-+ 0x59c41002, 0x8408150c, 0x480b8802, 0x0401f012,
-+ 0x0201f800, 0x00104ca6, 0x04020006, 0x59a8001c,
-+ 0x80000540, 0x02000800, 0x00108b49, 0x0401f00a,
-+ 0x0201f800, 0x00108b49, 0x59a80023, 0x8c000506,
-+ 0x04020005, 0x59a8001c, 0x80000540, 0x02020800,
-+ 0x00103f0a, 0x497b5025, 0x497b5024, 0x497b5017,
-+ 0x0201f800, 0x00104ca6, 0x59a81023, 0x0402000a,
-+ 0x0201f800, 0x00101559, 0x80001580, 0x59a80027,
-+ 0x82000500, 0xffff0000, 0x80040d40, 0x48075027,
-+ 0x0401f005, 0x59a80027, 0x82000500, 0xffff0000,
-+ 0x48035027, 0x599c0017, 0x8c00050a, 0x04000002,
-+ 0x84081544, 0x480b5023, 0x0201f800, 0x00104ca6,
-+ 0x04000004, 0x0201f800, 0x00101559, 0x48078880,
-+ 0x42001000, 0x00000005, 0x0201f800, 0x001068fb,
-+ 0x497b5025, 0x497b501a, 0x4a03501b, 0x0000ffff,
-+ 0x4a0378e4, 0x000000c0, 0x4202d800, 0x00000002,
-+ 0x0201f800, 0x00104ca6, 0x04000007, 0x59a80023,
-+ 0x82000500, 0x0000000c, 0x82000580, 0x00000004,
-+ 0x04000003, 0x0201f800, 0x00101add, 0x1c01f000,
-+ 0x59a8001b, 0x82000580, 0x0000ffff, 0x04000004,
-+ 0x0201f800, 0x00101add, 0x0401f072, 0x59a80023,
-+ 0x8c00050a, 0x04020003, 0x8c000506, 0x0400001c,
-+ 0x8c000500, 0x0400001a, 0x4a038802, 0x0000ffbf,
-+ 0x8c000502, 0x04000016, 0x599c0018, 0x8c000516,
-+ 0x04020010, 0x59a80024, 0x82000580, 0x0000ffff,
-+ 0x0400000c, 0x0201f800, 0x00101be7, 0x59a80023,
-+ 0x8c000504, 0x0402005b, 0x42001000, 0x00000003,
-+ 0x417a5800, 0x0201f800, 0x00101c0c, 0x0401f055,
-+ 0x59a80025, 0x80000540, 0x04020052, 0x59a80023,
-+ 0x8c000508, 0x04020005, 0x59a8001a, 0x80000540,
-+ 0x0402004c, 0x0401f003, 0x8c000516, 0x04000049,
-+ 0x0201f800, 0x00104614, 0x04020046, 0x599c0018,
-+ 0x8c000516, 0x04020004, 0x0201f800, 0x001049b0,
-+ 0x04020040, 0x599c0017, 0x8c00050a, 0x0400000d,
-+ 0x4200b000, 0x000007f0, 0x417a8800, 0x0201f800,
-+ 0x0002025a, 0x04020004, 0x59340200, 0x8c00051a,
-+ 0x04020034, 0x81468800, 0x8058b040, 0x040207f8,
-+ 0x4a038802, 0x0000ffff, 0x42001800, 0x0010acb8,
-+ 0x0401fa5f, 0x42001800, 0x0010acc5, 0x0401fa5c,
-+ 0x850e1d02, 0x4a0378e4, 0x00000080, 0x4202d800,
-+ 0x00000003, 0x4a03501b, 0x0000ffff, 0x0401f950,
-+ 0x80000580, 0x0201f800, 0x001014c3, 0x599c0018,
-+ 0x8c000516, 0x04000004, 0x0201f800, 0x001037c5,
-+ 0x0401f009, 0x42001800, 0x0000ffff, 0x42002000,
-+ 0x00000006, 0x42003000, 0x00000000, 0x0201f800,
-+ 0x00103764, 0x0201f800, 0x00104ce4, 0x0400000b,
-+ 0x59c40006, 0x0201f800, 0x00104ca6, 0x04000004,
-+ 0x82000500, 0xffffff0f, 0x0401f003, 0x82000500,
-+ 0xfbffffff, 0x48038806, 0x0201f800, 0x0010677d,
-+ 0x1c01f000, 0x59940022, 0x59940823, 0x80040540,
-+ 0x1c01f000, 0x497b2823, 0x1c01f000, 0x4a038805,
-+ 0x000000f0, 0x1c01f000, 0x4a035059, 0x00000004,
-+ 0x4a03505a, 0x00000000, 0x4a03505b, 0x00000017,
-+ 0x4a03505c, 0x00000002, 0x4a03500f, 0x00ffffff,
-+ 0x0201f800, 0x00108b49, 0x4a035027, 0x20200000,
-+ 0x4a035028, 0x88000200, 0x4a035029, 0x00ff001f,
-+ 0x4a03502a, 0x000007d0, 0x4a03502b, 0x80000000,
-+ 0x4a03502c, 0x00000200, 0x4a03502d, 0x00ff0000,
-+ 0x4a03502e, 0x00010000, 0x4a035037, 0x514c4f47,
-+ 0x4a035038, 0x49432020, 0x1c01f000, 0x4d440000,
-+ 0x417a8800, 0x41780800, 0x0201f800, 0x0002025a,
-+ 0x04020005, 0x0201f800, 0x00104719, 0x04020002,
-+ 0x80040800, 0x81468800, 0x83440580, 0x000007f0,
-+ 0x040207f6, 0x5c028800, 0x1c01f000, 0x4803c857,
-+ 0x5c000000, 0x4c000000, 0x4803c857, 0x0401f80c,
-+ 0x485fc857, 0x4203e000, 0x50000000, 0x5c000000,
-+ 0x4d780000, 0x4200b800, 0x00008002, 0x0401f009,
-+ 0x40680000, 0x406c0800, 0x40701000, 0x485fc857,
-+ 0x4203e000, 0x50000000, 0x4200b800, 0x00008002,
-+ 0x04006000, 0x4c000000, 0x4c040000, 0x59bc00ea,
-+ 0x82000500, 0x00000007, 0x82000580, 0x00000001,
-+ 0x04020005, 0x42000800, 0x00000000, 0x0201f800,
-+ 0x0010648d, 0x5c000800, 0x4807c025, 0x80040920,
-+ 0x4807c026, 0x5c000000, 0x4803c023, 0x80000120,
-+ 0x4803c024, 0x5c000000, 0x4803c857, 0x4803c021,
-+ 0x80000120, 0x4803c022, 0x41f80000, 0x4803c027,
-+ 0x80000120, 0x4803c028, 0x42000000, 0x00001000,
-+ 0x50000000, 0x82000480, 0x24320001, 0x4803c857,
-+ 0x04001053, 0x42000800, 0x00000064, 0x80040840,
-+ 0x04000007, 0x4a030000, 0x00000001, 0x40000000,
-+ 0x59800000, 0x8c000500, 0x040007f9, 0x04000046,
-+ 0x42000800, 0x0010b972, 0x46000800, 0xfaceface,
-+ 0x80040800, 0x4c080000, 0x4c0c0000, 0x42001000,
-+ 0x00007a00, 0x58080013, 0x44000800, 0x80040800,
-+ 0x58080019, 0x44000800, 0x80040800, 0x5808001a,
-+ 0x44000800, 0x80040800, 0x5808001b, 0x44000800,
-+ 0x80040800, 0x5808001c, 0x44000800, 0x80040800,
-+ 0x5808001f, 0x44000800, 0x80040800, 0x42001000,
-+ 0x00007a40, 0x42001800, 0x0000000b, 0x50080000,
-+ 0x44000800, 0x80081000, 0x80040800, 0x800c1840,
-+ 0x040207fb, 0x42001800, 0x00000003, 0x42001000,
-+ 0x00007b00, 0x480c1003, 0x58080005, 0x44000800,
-+ 0x80040800, 0x800c1840, 0x040217fb, 0x42001000,
-+ 0x00007c00, 0x58080002, 0x44000800, 0x80040800,
-+ 0x58080003, 0x44000800, 0x80040800, 0x58080020,
-+ 0x44000800, 0x80040800, 0x58080021, 0x44000800,
-+ 0x80040800, 0x58080022, 0x44000800, 0x80040800,
-+ 0x58080023, 0x44000800, 0x80040800, 0x5c001800,
-+ 0x5c001000, 0x4a030000, 0x00000000, 0x485fc020,
-+ 0x905cb9c0, 0x825cbd40, 0x00000012, 0x485fc011,
-+ 0x4203e000, 0x40000000, 0x4202d800, 0x00000005,
-+ 0x59e00017, 0x8c000508, 0x04000003, 0x4a03c017,
-+ 0x00000002, 0x4203e000, 0x30000001, 0x0401f823,
-+ 0x0401f7ff, 0x4a03c850, 0x0010b98e, 0x4a03c851,
-+ 0x0010c98d, 0x4a03c853, 0x00000800, 0x4a03c855,
-+ 0x0001eb5a, 0x59e40001, 0x82000540, 0x00003f00,
-+ 0x4803c801, 0x4a03b104, 0x70000002, 0x4a03a804,
-+ 0x70000002, 0x4a03b004, 0x70000002, 0x42000000,
-+ 0x0010b0bb, 0x49780001, 0x49780002, 0x1c01f000,
-+ 0x5c036000, 0x4db00000, 0x49b3c857, 0x4803c857,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x1c01f000, 0x59a80068, 0x8c000530,
-+ 0x040207fe, 0x4c080000, 0x42001000, 0x00000004,
-+ 0x0401f866, 0x5c001000, 0x4201d000, 0x00028b0a,
-+ 0x0201f800, 0x00105c78, 0x4c080000, 0x42001000,
-+ 0x00000008, 0x0401f85d, 0x5c001000, 0x4201d000,
-+ 0x00028b0a, 0x0201f800, 0x00105c78, 0x4c080000,
-+ 0x42001000, 0x00000010, 0x0401f854, 0x5c001000,
-+ 0x4201d000, 0x00028b0a, 0x0201f800, 0x00105c78,
-+ 0x0401f7e2, 0x8c00050c, 0x59a80868, 0x04020003,
-+ 0x84040d30, 0x0401f006, 0x84040d70, 0x48075068,
-+ 0x42001000, 0x00000000, 0x0401f044, 0x48075068,
-+ 0x836c0500, 0x00000007, 0x0c01f001, 0x00100609,
-+ 0x001005eb, 0x001005eb, 0x001005d3, 0x001005fc,
-+ 0x001005eb, 0x001005eb, 0x001005fc, 0x59a8006c,
-+ 0x8c000502, 0x04020013, 0x59c40801, 0x82040d00,
-+ 0x00018000, 0x82040580, 0x00010000, 0x0400000a,
-+ 0x82040580, 0x00008000, 0x04000004, 0x42001000,
-+ 0x42004000, 0x0401f006, 0x42001000, 0x22002000,
-+ 0x0401f003, 0x42001000, 0x12001000, 0x0401f029,
-+ 0x42001000, 0x00001004, 0x0401f026, 0x59a8006c,
-+ 0x8c000502, 0x04020008, 0x59a80068, 0x8c000534,
-+ 0x04020004, 0x42001000, 0x74057005, 0x0401f81d,
-+ 0x1c01f000, 0x42001000, 0x00002008, 0x0401f7fc,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x59a80068, 0x8c000534, 0x0402000a, 0x59a8006c,
-+ 0x8c000502, 0x04000004, 0x42001000, 0x24052005,
-+ 0x0401f00c, 0x42001000, 0x74057005, 0x0401f009,
-+ 0x1c01f000, 0x1c01f000, 0x82081500, 0x0000001c,
-+ 0x82081540, 0x001c0000, 0x480bc013, 0x1c01f000,
-+ 0x59a80068, 0x8c000530, 0x04000002, 0x84081570,
-+ 0x480b5068, 0x8c000530, 0x04020005, 0x82081500,
-+ 0x00007000, 0x80081114, 0x0401fff0, 0x1c01f000,
-+ 0x41780000, 0x50041800, 0x800c0400, 0x80040800,
-+ 0x80102040, 0x040207fc, 0x80080500, 0x80000540,
-+ 0x1c01f000, 0x4202f000, 0x00000000, 0x41780000,
-+ 0x41780800, 0x41781000, 0x41781800, 0x41782000,
-+ 0x41782800, 0x41783000, 0x41783800, 0x41784000,
-+ 0x41784800, 0x41785000, 0x41785800, 0x41786000,
-+ 0x41786800, 0x41787000, 0x41787800, 0x41788000,
-+ 0x41788800, 0x41789000, 0x41789800, 0x4178a000,
-+ 0x4178a800, 0x4178b000, 0x4178b800, 0x4178c000,
-+ 0x4178c800, 0x4178d000, 0x4178d800, 0x4178e000,
-+ 0x4178e800, 0x4178f000, 0x4178f800, 0x41790000,
-+ 0x41790800, 0x41791000, 0x41791800, 0x41792000,
-+ 0x41792800, 0x41793000, 0x41793800, 0x41794000,
-+ 0x41794800, 0x41795000, 0x41795800, 0x41796000,
-+ 0x41796800, 0x41797000, 0x41797800, 0x41798000,
-+ 0x41798800, 0x42019000, 0x0010ad04, 0x42019800,
-+ 0x0010acdb, 0x4179a000, 0x4179a800, 0x4179b000,
-+ 0x4179b800, 0x4179c800, 0x4179c000, 0x4179d000,
-+ 0x4179d800, 0x4179e000, 0x4179e800, 0x4179f000,
-+ 0x4179f800, 0x417a0000, 0x417a0800, 0x417a1000,
-+ 0x417a1800, 0x417a2000, 0x42022800, 0x00006100,
-+ 0x417a3000, 0x417a3800, 0x417a4000, 0x417a4800,
-+ 0x417a5000, 0x417a5800, 0x417a6000, 0x417a6800,
-+ 0x417a7000, 0x417a7800, 0x417a8000, 0x417a8800,
-+ 0x417a9000, 0x417a9800, 0x417ae800, 0x417af800,
-+ 0x42030000, 0x00007c00, 0x42031000, 0x0010afd4,
-+ 0x42031800, 0x0000bf1d, 0x42032000, 0x0000bf32,
-+ 0x42032800, 0x0010af9c, 0x42033000, 0x000208ff,
-+ 0x42034000, 0x0010ac71, 0x42033800, 0x0010ac90,
-+ 0x42034800, 0x0010ad12, 0x42035000, 0x0010ac00,
-+ 0x42035800, 0x0010a400, 0x42030800, 0x0010acd2,
-+ 0x417b6000, 0x42036800, 0x00006f00, 0x4203c800,
-+ 0x00003000, 0x42037000, 0x0000ff00, 0x42037800,
-+ 0x0000bf00, 0x42038000, 0x00007700, 0x42038800,
-+ 0x00004000, 0x42039000, 0x00006000, 0x42039800,
-+ 0x0010b6aa, 0x4203a000, 0x00007600, 0x4203a800,
-+ 0x00007400, 0x4203b000, 0x00007200, 0x4203b800,
-+ 0x00007100, 0x4203c000, 0x00007000, 0x4203d000,
-+ 0x00000000, 0x4203e800, 0x000200eb, 0x417bd800,
-+ 0x1c01f000, 0x42000800, 0x00100000, 0x50040000,
-+ 0x4c000000, 0x42000000, 0x0000aaaa, 0x44000800,
-+ 0x42001800, 0x00005555, 0x41782000, 0x82102400,
-+ 0x00010000, 0x40100000, 0x80042c00, 0x440c2800,
-+ 0x42003000, 0x0000000a, 0x80183040, 0x040207ff,
-+ 0x50140000, 0x800c0580, 0x04020004, 0x50040000,
-+ 0x800c0580, 0x040207f2, 0x5c000000, 0x44000800,
-+ 0x80142840, 0x4817c861, 0x1c01f000, 0x59a8081e,
-+ 0x800409c0, 0x04020009, 0x49781c0c, 0x4a001a0c,
-+ 0x00000200, 0x4a001804, 0x07000000, 0x59a8000f,
-+ 0x9c0001c0, 0x48001805, 0x0401fded, 0x9c0409c0,
-+ 0x48041806, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x59a8080b, 0x4006d000,
-+ 0x4202b800, 0x00000001, 0x59a8180c, 0x480fc857,
-+ 0x82041400, 0x00000014, 0x82082400, 0x00000014,
-+ 0x40100000, 0x800c0480, 0x04001006, 0x44080800,
-+ 0x40080800, 0x40101000, 0x815eb800, 0x0401f7f7,
-+ 0x45780800, 0x495f501f, 0x1c01f000, 0x4c000000,
-+ 0x0401f804, 0x412d8800, 0x5c000000, 0x1c01f000,
-+ 0x835c0480, 0x00000020, 0x04001009, 0x496bc857,
-+ 0x815eb840, 0x416a5800, 0x592ed000, 0x497a5800,
-+ 0x497a5801, 0x812e59c0, 0x1c01f000, 0x42000000,
-+ 0x0010b022, 0x0201f800, 0x0010a260, 0x417a5800,
-+ 0x0401f7f9, 0x4c000000, 0x0401f804, 0x412d8800,
-+ 0x5c000000, 0x1c01f000, 0x815eb840, 0x04001008,
- 0x416a5800, 0x492fc857, 0x592ed000, 0x497a5800,
- 0x497a5801, 0x812e59c0, 0x1c01f000, 0x42000000,
-- 0x0010b652, 0x0201f800, 0x0010a86e, 0x417ab800,
-- 0x417a5800, 0x0401f7f8, 0x492fc857, 0x496a5800,
-+ 0x0010b022, 0x0201f800, 0x0010a260, 0x417ab800,
-+ 0x417a5800, 0x0401f7f8, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x492fc857, 0x496a5800,
- 0x412ed000, 0x815eb800, 0x59c80000, 0x82000540,
-- 0x00001200, 0x48039000, 0x1c01f000, 0x492fc857,
-+ 0x00001200, 0x48039000, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x492fc857,
- 0x812e59c0, 0x04000007, 0x592c0001, 0x497a5801,
-- 0x4c000000, 0x0401fff1, 0x5c025800, 0x0401f7f9,
-- 0x1c01f000, 0x4807c856, 0x42007000, 0x0010b5f6,
-+ 0x4c000000, 0x0401ffed, 0x5c025800, 0x0401f7f9,
-+ 0x1c01f000, 0x4807c856, 0x42007000, 0x0010afc6,
- 0x4a007001, 0x00000000, 0x59e00003, 0x82000540,
- 0x00008080, 0x4803c003, 0x4a03b805, 0x90000001,
- 0x59dc0006, 0x4a03b805, 0x70000000, 0x59dc0006,
-@@ -594,621 +515,610 @@ uint32_t risc_code01[] = {
- 0x4a03b805, 0x70000001, 0x59dc0006, 0x4a03b805,
- 0x30000002, 0x4200b000, 0x00000020, 0x497bb807,
- 0x8058b040, 0x040207fe, 0x4a03b805, 0x30000000,
-- 0x59dc0006, 0x4a03b805, 0x60000001, 0x0401ff9e,
-- 0x04000d99, 0x42001000, 0x0010b5f4, 0x452c1000,
-+ 0x59dc0006, 0x4a03b805, 0x60000001, 0x0401ff91,
-+ 0x04000d7b, 0x42001000, 0x0010afc4, 0x452c1000,
- 0x4a025801, 0x00000001, 0x4a025802, 0x00000100,
-- 0x4a025809, 0x00106eac, 0x497a580a, 0x497a580b,
-- 0x497a580c, 0x0401ff90, 0x04000d8b, 0x42001000,
-- 0x0010b5f5, 0x452c1000, 0x4a025801, 0x00000000,
-- 0x4a025802, 0x00000100, 0x4a025809, 0x0010120c,
-+ 0x4a025809, 0x001069a6, 0x497a580a, 0x497a580b,
-+ 0x497a580c, 0x0401ff83, 0x04000d6d, 0x42001000,
-+ 0x0010afc5, 0x452c1000, 0x4a025801, 0x00000000,
-+ 0x4a025802, 0x00000100, 0x4a025809, 0x001010d8,
- 0x497a5803, 0x497a5807, 0x497a5808, 0x497a580a,
-- 0x59a8006f, 0x8c000500, 0x04000006, 0x4a03b805,
-+ 0x59a8006c, 0x8c000500, 0x04000006, 0x4a03b805,
- 0xe0000001, 0x59dc0006, 0x8c000522, 0x040007fc,
-- 0x1c01f000, 0x4df00000, 0x4203e000, 0x50000000,
-- 0x4c380000, 0x40087000, 0x4a007002, 0x00000000,
-- 0x42007000, 0x0010b5f6, 0x82080400, 0x00000000,
-- 0x45780000, 0x58380005, 0x48087005, 0x80000540,
-- 0x04000006, 0x480bc857, 0x82000400, 0x00000000,
-- 0x44080000, 0x0401f003, 0x480bc857, 0x48087006,
-- 0x58380001, 0x80000540, 0x0400080c, 0x5c007000,
-- 0x5c03e000, 0x1c01f000, 0x4c380000, 0x42007000,
-- 0x0010b5f6, 0x58380001, 0x80000540, 0x04000803,
-- 0x5c007000, 0x1c01f000, 0x42007000, 0x0010b5f6,
-- 0x58380001, 0x82000580, 0x00000000, 0x04020012,
-- 0x58380000, 0x0c01f001, 0x001008d7, 0x001008d6,
-- 0x001008d6, 0x001008d6, 0x001008d6, 0x001008d6,
-- 0x001008d6, 0x001008d6, 0x0401fd3f, 0x58380808,
-- 0x800409c0, 0x04020027, 0x58380006, 0x80000540,
-- 0x04020002, 0x1c01f000, 0x4803c857, 0x48007002,
-- 0x40006800, 0x58340000, 0x80000540, 0x04020002,
-- 0x48007005, 0x48007006, 0x4a03b805, 0x20000000,
-- 0x59dc0006, 0x4a03b805, 0x30000000, 0x58340007,
-- 0x4803b800, 0x4803c857, 0x58340008, 0x4803b801,
-- 0x4803c857, 0x58340004, 0x48007003, 0x58340003,
-- 0x48007004, 0x4803b803, 0x4803c857, 0x58340001,
-- 0x8c000500, 0x04000004, 0x4a007001, 0x00000001,
-- 0x0401f028, 0x4a007001, 0x00000002, 0x0401f03e,
-- 0x0201f800, 0x001091b3, 0x0201f800, 0x0010a4b8,
-- 0x04000017, 0x4a03b805, 0x20000000, 0x59dc0006,
-- 0x4a03b805, 0x30000000, 0x4807b800, 0x480bb801,
-- 0x4a007003, 0x00000010, 0x480c7009, 0x42001000,
-- 0x001008be, 0x0201f800, 0x00105cd3, 0x58380008,
-- 0x82000400, 0x00000004, 0x48007004, 0x4803b803,
-- 0x4a007001, 0x00000007, 0x0401f023, 0x0201f800,
-- 0x001091cb, 0x42000800, 0x00000001, 0x42001000,
-- 0x001008be, 0x0201f800, 0x00105caf, 0x0401f7b7,
-- 0x4c040000, 0x4c080000, 0x58380803, 0x42001000,
-- 0x00003fff, 0x82040480, 0x00003fff, 0x04021003,
-- 0x40041000, 0x80000580, 0x48007003, 0x4803c857,
-- 0x800800c4, 0x4803b802, 0x4a03b805, 0x30000002,
-+ 0x1c01f000, 0x4c000000, 0x40681000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4df00000, 0x4203e000,
-+ 0x50000000, 0x4c380000, 0x40087000, 0x4a007002,
-+ 0x00000000, 0x42007000, 0x0010afc6, 0x82080400,
-+ 0x00000000, 0x45780000, 0x58380005, 0x48087005,
-+ 0x80000540, 0x04000006, 0x480bc857, 0x82000400,
-+ 0x00000000, 0x44080000, 0x0401f003, 0x480bc857,
-+ 0x48087006, 0x58380001, 0x80000540, 0x0400080c,
-+ 0x5c007000, 0x5c03e000, 0x1c01f000, 0x4c380000,
-+ 0x42007000, 0x0010afc6, 0x58380001, 0x80000540,
-+ 0x04000803, 0x5c007000, 0x1c01f000, 0x42007000,
-+ 0x0010afc6, 0x58380001, 0x82000580, 0x00000000,
-+ 0x04020012, 0x58380000, 0x0c01f001, 0x001007d4,
-+ 0x001007d3, 0x001007d3, 0x001007d3, 0x001007d3,
-+ 0x001007d3, 0x001007d3, 0x001007d3, 0x0401fd1c,
-+ 0x58380808, 0x800409c0, 0x04020027, 0x58380006,
-+ 0x80000540, 0x04020002, 0x1c01f000, 0x4803c857,
-+ 0x48007002, 0x40006800, 0x58340000, 0x80000540,
-+ 0x04020002, 0x48007005, 0x48007006, 0x4a03b805,
-+ 0x20000000, 0x59dc0006, 0x4a03b805, 0x30000000,
-+ 0x58340007, 0x4803b800, 0x4803c857, 0x58340008,
-+ 0x4803b801, 0x4803c857, 0x58340005, 0x48007003,
-+ 0x58340003, 0x48007004, 0x4803b803, 0x4803c857,
-+ 0x58340001, 0x8c000500, 0x04000004, 0x4a007001,
-+ 0x00000001, 0x0401f028, 0x4a007001, 0x00000002,
-+ 0x0401f03d, 0x0201f800, 0x00108c2f, 0x0201f800,
-+ 0x00109e89, 0x04000017, 0x4a03b805, 0x20000000,
-+ 0x59dc0006, 0x4a03b805, 0x30000000, 0x4807b800,
-+ 0x480bb801, 0x4a007003, 0x00000040, 0x480c7009,
-+ 0x42001000, 0x001007bb, 0x0201f800, 0x00105b79,
-+ 0x58380008, 0x82000400, 0x00000004, 0x48007004,
-+ 0x4803b803, 0x4a007001, 0x00000007, 0x0401f022,
-+ 0x0201f800, 0x00108c47, 0x42000800, 0x00000001,
-+ 0x42001000, 0x001007bb, 0x0201f800, 0x00105b50,
-+ 0x0401f7b7, 0x4c040000, 0x4c080000, 0x58380803,
-+ 0x42001000, 0x0000ffff, 0x82040480, 0x0000ffff,
-+ 0x04021003, 0x40041000, 0x80000580, 0x48007003,
-+ 0x480bc857, 0x480bb802, 0x4a03b805, 0x30000002,
- 0x59dc0006, 0x4a03b805, 0x70000001, 0x59dc0006,
- 0x4a03b805, 0x10000000, 0x5c001000, 0x5c000800,
- 0x1c01f000, 0x483bc857, 0x4c040000, 0x4c080000,
-- 0x58380803, 0x42001000, 0x00003fff, 0x82040480,
-- 0x00003fff, 0x04021003, 0x40041000, 0x80000580,
-- 0x48007003, 0x800800c4, 0x4803b802, 0x4803c857,
-- 0x4a03b805, 0x10000002, 0x5c001000, 0x5c000800,
-- 0x1c01f000, 0x4c040000, 0x4c380000, 0x42007000,
-- 0x0010b5f6, 0x59dc0806, 0x4807c857, 0x4a03b805,
-- 0x20000000, 0x8c040d3e, 0x04000007, 0x8c040d08,
-- 0x04020cb9, 0x58380001, 0x82000500, 0x00000007,
-- 0x0c01f804, 0x5c007000, 0x5c000800, 0x1c01f000,
-- 0x001008c6, 0x0010096c, 0x0010097c, 0x00100615,
-- 0x00100615, 0x00100615, 0x00100615, 0x0010123a,
-- 0x4807c856, 0x82040d00, 0x43000f80, 0x04020009,
-- 0x58380003, 0x80000540, 0x0400001c, 0x59dc0000,
-- 0x4803b800, 0x59dc0001, 0x4803b801, 0x0401f7ad,
-- 0x58380802, 0x4a000802, 0x00000200, 0x0401f01d,
-- 0x4807c856, 0x82040d00, 0x43000f80, 0x04020009,
-- 0x58380003, 0x80000540, 0x0400000c, 0x59dc0000,
-- 0x4803b800, 0x59dc0001, 0x4803b801, 0x0401f7b6,
-- 0x58380002, 0x82000400, 0x00000002, 0x46000000,
-- 0x00000200, 0x0401f00b, 0x4c340000, 0x58386802,
-- 0x59dc0000, 0x4803c857, 0x48006807, 0x59dc0001,
-- 0x48006808, 0x4a006802, 0x00000100, 0x5c006800,
-- 0x4a007001, 0x00000000, 0x4c300000, 0x58386002,
-- 0x4833c857, 0x0401f80c, 0x04000009, 0x58300009,
-- 0x82000c80, 0x0010a971, 0x04021c73, 0x82000c80,
-- 0x00020000, 0x04001c70, 0x0801f800, 0x5c006000,
-- 0x0401f71e, 0x803061c0, 0x04000009, 0x59a8000c,
-- 0x80300480, 0x04001007, 0x59a8000d, 0x80300480,
-- 0x04021004, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x80000580, 0x1c01f000, 0x4803c856, 0x4dc00000,
-- 0x42007000, 0x0010b601, 0x4a007400, 0x00000000,
-- 0x49787001, 0x42038000, 0x00007720, 0x4a038006,
-- 0x60000001, 0x4a038009, 0xf4f60000, 0x42038000,
-- 0x00007700, 0x4a038006, 0x60000001, 0x4a038009,
-- 0xf4f60000, 0x4a03c822, 0x00000010, 0x4a0370e8,
-- 0x00000000, 0x0401f809, 0x4a0370e9, 0x00003a0f,
-- 0x4a0370e8, 0x00000000, 0x4a0370e8, 0x00000001,
-- 0x5c038000, 0x1c01f000, 0x4c5c0000, 0x4178b800,
-- 0x0401f80a, 0x5c00b800, 0x1c01f000, 0x4803c856,
-- 0x4c5c0000, 0x825cbd40, 0x00000001, 0x0401f803,
-- 0x5c00b800, 0x1c01f000, 0x4803c856, 0x4dc00000,
-- 0x4c500000, 0x4c580000, 0x4c540000, 0x4a0370e8,
-- 0x00000000, 0x805cb9c0, 0x04000009, 0x4a038807,
-- 0x00000004, 0x59b800ea, 0x8c000510, 0x04000004,
-- 0x59b800e0, 0x0401f87b, 0x0401f7fb, 0x42038000,
-- 0x00007720, 0x0201f800, 0x00100f0f, 0x59c00007,
-- 0x4a038006, 0x20000000, 0x59c00007, 0x4a038006,
-- 0x8000000a, 0x59c00007, 0x4a038006, 0x8000000b,
-- 0x59c00007, 0x4a038006, 0x40000001, 0x83c00580,
-- 0x00007700, 0x04000004, 0x42038000, 0x00007700,
-- 0x0401f7ed, 0x42038000, 0x00007720, 0x42000800,
-- 0x00000800, 0x59c00007, 0x8c00051e, 0x04000006,
-- 0x4a038006, 0x90000001, 0x80040840, 0x040207fa,
-- 0x0401fc01, 0x83c00580, 0x00007700, 0x04000004,
-- 0x42038000, 0x00007700, 0x0401f7f1, 0x805cb9c0,
-- 0x0402001d, 0x4200b000, 0x00000020, 0x83b8ac00,
-- 0x00000020, 0x0201f800, 0x0010a947, 0x4a0370fb,
-- 0x00000001, 0x4a037020, 0x0010110d, 0x59a80039,
-- 0x82000500, 0x0000ffff, 0x48037021, 0x4a037035,
-- 0x0010bbda, 0x4a037030, 0x0010b210, 0x4a037031,
-- 0x0010aa00, 0x4a037032, 0x0010b315, 0x4a037036,
-- 0x0010b320, 0x59840002, 0x48037034, 0x4a037038,
-- 0x00101104, 0x4a0370fb, 0x00000001, 0x4178a000,
-- 0x4200b000, 0x00000020, 0x83b8ac00, 0x00000000,
-- 0x0201f800, 0x0010a947, 0x4200b000, 0x00000040,
-- 0x83b8ac00, 0x00000040, 0x0201f800, 0x0010a947,
-- 0x805cb9c0, 0x04020004, 0x4a0370e4, 0xaaaaaaaa,
-- 0x0401f003, 0x4a0370e4, 0xa2aaaa82, 0x4a0370e5,
-- 0xaaaaaaaa, 0x4a0370e6, 0xaaaaaaaa, 0x4a0370fb,
-- 0x00000000, 0x4a0370e6, 0xaaaaaaaa, 0x42038000,
-- 0x00007720, 0x4a038006, 0x90000000, 0x59c00007,
-- 0x8c00051e, 0x02020800, 0x00100615, 0x42038000,
-- 0x00007700, 0x4a038006, 0x90000000, 0x59c00007,
-- 0x8c00051e, 0x02020800, 0x00100615, 0x5c00a800,
-- 0x5c00b000, 0x5c00a000, 0x5c038000, 0x1c01f000,
-- 0x4d300000, 0x4d380000, 0x40026000, 0x82000500,
-- 0x7f000000, 0x82000580, 0x00000003, 0x0402000f,
-- 0x83326500, 0x00ffffff, 0x59300203, 0x82000580,
-- 0x00000004, 0x04020009, 0x59300c06, 0x82040580,
-- 0x00000009, 0x04020005, 0x42027000, 0x00000047,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x5c026000,
-- 0x1c01f000, 0x4d300000, 0x4d2c0000, 0x4d340000,
-- 0x4d400000, 0x4cfc0000, 0x4d380000, 0x4d3c0000,
-- 0x4d440000, 0x4d4c0000, 0x4d480000, 0x4c5c0000,
-- 0x4c600000, 0x4c640000, 0x4d040000, 0x4cc80000,
-- 0x4ccc0000, 0x4cf40000, 0x4cf80000, 0x4cfc0000,
-- 0x0201f800, 0x00020016, 0x5c01f800, 0x5c01f000,
-- 0x5c01e800, 0x5c019800, 0x5c019000, 0x5c020800,
-- 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x5c029000,
-- 0x5c029800, 0x5c028800, 0x5c027800, 0x5c027000,
-- 0x5c01f800, 0x5c028000, 0x5c026800, 0x5c025800,
-- 0x5c026000, 0x1c01f000, 0x493bc857, 0x0201f000,
-- 0x00020045, 0x83300500, 0x1f000000, 0x04000008,
-- 0x81326580, 0x80000130, 0x82000c80, 0x00000014,
-- 0x02021800, 0x00100615, 0x0c01f013, 0x83300500,
-- 0x000000ff, 0x82000c80, 0x00000007, 0x02021800,
-- 0x00100615, 0x0c01f025, 0x1c01f000, 0x82000d00,
-- 0xc0000038, 0x02020800, 0x0010060d, 0x0201f800,
-- 0x00100615, 0x00000000, 0x00000048, 0x00000054,
-- 0x00000053, 0x00100ae4, 0x00100b08, 0x00100b03,
-- 0x00100b28, 0x00100aef, 0x00100afb, 0x00100ae4,
-- 0x00100b23, 0x00100b64, 0x00100ae4, 0x00100ae4,
-- 0x00100ae4, 0x00100ae4, 0x00100b67, 0x00100b6d,
-- 0x00100b7e, 0x00100b8f, 0x00100ae4, 0x00100b98,
-- 0x00100ba4, 0x00100ae4, 0x00100ae4, 0x00100ae4,
-- 0x0201f800, 0x00100615, 0x00100aed, 0x00100c3f,
-- 0x00100b35, 0x00100b59, 0x00100aed, 0x00100aed,
-- 0x00100aed, 0x0201f800, 0x00100615, 0x4803c856,
-- 0x59300004, 0x8c00053e, 0x04020005, 0x42027000,
-- 0x00000055, 0x0201f000, 0x000208d8, 0x0201f800,
-- 0x00106cb4, 0x040007fa, 0x1c01f000, 0x4803c856,
-- 0x0401f8aa, 0x40002800, 0x41782000, 0x42027000,
-- 0x00000056, 0x0201f000, 0x000208d8, 0x4803c856,
-- 0x42027000, 0x00000057, 0x0201f000, 0x000208d8,
-- 0x4803c856, 0x59300007, 0x8c00051a, 0x04020010,
-- 0x59325808, 0x812e59c0, 0x04000014, 0x592c0408,
-- 0x8c00051c, 0x04020003, 0x4a026011, 0xffffffff,
-- 0x59300004, 0x8c00053e, 0x04020009, 0x42027000,
-- 0x00000048, 0x0201f000, 0x000208d8, 0x59325808,
-- 0x4a025a06, 0x00000007, 0x0401f7f4, 0x0201f800,
-- 0x00106cb4, 0x040007f6, 0x1c01f000, 0x4803c856,
-- 0x83300500, 0x00ffffff, 0x0201f000, 0x0010620f,
-- 0x1c01f000, 0x4c040000, 0x59b808ea, 0x82040d00,
-- 0x00000007, 0x82040580, 0x00000003, 0x04000004,
-- 0x42000000, 0x60000000, 0x0401f8ac, 0x5c000800,
-- 0x1c01f000, 0x0401f8fa, 0x0400001b, 0x59325808,
-- 0x812e59c0, 0x04000018, 0x592c0204, 0x82000500,
-- 0x000000ff, 0x82000d80, 0x00000029, 0x04020012,
-- 0x59300203, 0x82000580, 0x00000003, 0x0400000b,
-- 0x59300807, 0x84040d26, 0x48066007, 0x0201f800,
-- 0x00020087, 0x4a03900d, 0x00000040, 0x4a0370e5,
-- 0x00000008, 0x1c01f000, 0x0201f800, 0x00106cb4,
-- 0x040007f4, 0x59880053, 0x80000000, 0x48031053,
-- 0x4a03900d, 0x00000040, 0x42000000, 0xc0000000,
-- 0x0401f05a, 0x42007800, 0x0010bbe1, 0x42002000,
-- 0x00003000, 0x42003000, 0x00000105, 0x0201f800,
-- 0x00105b3d, 0x4a0370e4, 0x02000000, 0x1c01f000,
-- 0x4933c857, 0x0201f000, 0x000208b4, 0x41300800,
-- 0x800409c0, 0x02020800, 0x00100615, 0x0201f800,
-- 0x0010060d, 0x4933c857, 0x813261c0, 0x02000800,
-- 0x00100615, 0x0401f835, 0x40002800, 0x0201f800,
-- 0x0010a7c3, 0x0401f8ae, 0x04000007, 0x59326809,
-- 0x59340200, 0x8c00050e, 0x59300414, 0x02020800,
-- 0x00109094, 0x1c01f000, 0x4933c857, 0x813261c0,
-- 0x02000800, 0x00100615, 0x0401f8a1, 0x0400000b,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x04000007,
-- 0x592c0208, 0x8400054e, 0x48025a08, 0x417a7800,
-- 0x0201f800, 0x00108997, 0x1c01f000, 0x485fc857,
-- 0x5c000000, 0x4d780000, 0x4203e000, 0x50000000,
-- 0x4200b800, 0x00008005, 0x0201f000, 0x0010061a,
-- 0x4933c857, 0x83300480, 0x00000020, 0x02021800,
-- 0x00100615, 0x83300c00, 0x0010b6cb, 0x50040000,
-- 0x80000000, 0x04001002, 0x44000800, 0x1c01f000,
-- 0x4933c857, 0x0401f7f4, 0x4807c856, 0x59b800ea,
-- 0x8c000510, 0x040007fd, 0x59b800e0, 0x4803c857,
-- 0x1c01f000, 0x4803c856, 0x42000000, 0x10000000,
-- 0x41300800, 0x0401f02d, 0x82000500, 0xf0000000,
-- 0x82040d00, 0x0fffffff, 0x80040d40, 0x4807c857,
-- 0x59b800ea, 0x8c000516, 0x04020003, 0x480770e1,
-- 0x1c01f000, 0x8c000510, 0x040007fa, 0x4c040000,
-- 0x0401f809, 0x5c000800, 0x82100480, 0x00000008,
-- 0x040017f4, 0x4c040000, 0x0401febf, 0x5c000800,
-- 0x0401f7f0, 0x59b800e2, 0x59b820e2, 0x80100580,
-- 0x040207fd, 0x80102114, 0x0401f006, 0x59b800e2,
-- 0x59b820e2, 0x80100580, 0x040207fd, 0x0401f001,
-- 0x40101800, 0x800c190a, 0x82100500, 0x0000001f,
-- 0x820c1d00, 0x0000001f, 0x800c2480, 0x82102500,
-- 0x0000001f, 0x1c01f000, 0x82000500, 0xf0000000,
-- 0x82040d00, 0x0fffffff, 0x80040d40, 0x4807c857,
-- 0x42001000, 0x0010b602, 0x50080000, 0x80000540,
-- 0x04020005, 0x4a0370e5, 0x00000003, 0x4a0370e4,
-- 0x00000300, 0x80000000, 0x44001000, 0x42001000,
-- 0x00000400, 0x59b800ea, 0x8c000510, 0x0400000c,
-- 0x0401ffd5, 0x82100480, 0x00000008, 0x04001007,
-- 0x4c040000, 0x4c080000, 0x0401fe8b, 0x5c001000,
-- 0x5c000800, 0x0401f020, 0x59b800ea, 0x8c000516,
-- 0x0402001d, 0x4a0370e4, 0x00300000, 0x480770e1,
-- 0x42001000, 0x0000ff00, 0x80081040, 0x04000012,
-- 0x59b808e4, 0x8c040d28, 0x040207fc, 0x42001000,
-- 0x0010b602, 0x50080000, 0x80000040, 0x04020005,
-- 0x4a0370e5, 0x00000002, 0x4a0370e4, 0x00000200,
-- 0x02001800, 0x00100615, 0x44001000, 0x8c040d2c,
-- 0x1c01f000, 0x41f80000, 0x50000000, 0x0201f800,
-- 0x00100615, 0x80081040, 0x040207d3, 0x41f80000,
-- 0x50000000, 0x0201f800, 0x00100615, 0x4d380000,
-- 0x59300c06, 0x82040580, 0x00000009, 0x04020006,
-- 0x42027000, 0x00000047, 0x0201f800, 0x000208d8,
-- 0x80000580, 0x5c027000, 0x1c01f000, 0x4c500000,
-- 0x4a03900d, 0x00000001, 0x59c8a020, 0x4a03900d,
-- 0x00000002, 0x59c80820, 0x8c50a52e, 0x04000002,
-- 0x900409c0, 0x82040d00, 0x0000ffff, 0x0201f800,
-- 0x00105b0f, 0x5c00a000, 0x1c01f000, 0x0401fff0,
-- 0x04000045, 0x4933c857, 0x59300406, 0x82000580,
-- 0x00000000, 0x04000040, 0x59c82021, 0x4a03900d,
-- 0x00000001, 0x59c82821, 0x82142d00, 0x0000ffff,
-- 0x59325808, 0x812e59c0, 0x04000037, 0x59326809,
-- 0x0201f800, 0x00104728, 0x02020800, 0x0010907c,
-- 0x599c0019, 0x8c00050c, 0x04020018, 0x0201f800,
-- 0x00104728, 0x04020015, 0x59300811, 0x4807c857,
-- 0x592c0408, 0x8c00051c, 0x0402000e, 0x8400055c,
-- 0x48025c08, 0x592c0a04, 0x82040d00, 0x000000ff,
-- 0x82040580, 0x00000048, 0x04000004, 0x82040580,
-- 0x00000018, 0x04020003, 0x59300811, 0x48065803,
-- 0x4a026011, 0x7fffffff, 0x48166013, 0x0201f800,
-- 0x0010112d, 0x04020014, 0x0401fa07, 0x40280000,
-- 0x4802600d, 0x04000005, 0x4832600b, 0x50200000,
-- 0x4802600a, 0x4822600c, 0x59300414, 0x8c00051c,
-- 0x04020004, 0x599c0019, 0x8c00050c, 0x0402086e,
-+ 0x58380803, 0x42001000, 0x0000ffff, 0x82040480,
-+ 0x0000ffff, 0x04021003, 0x40041000, 0x80000580,
-+ 0x48007003, 0x480bb802, 0x4803c857, 0x4a03b805,
-+ 0x10000002, 0x5c001000, 0x5c000800, 0x1c01f000,
-+ 0x4c040000, 0x4c380000, 0x42007000, 0x0010afc6,
-+ 0x59dc0806, 0x4807c857, 0x4a03b805, 0x20000000,
-+ 0x8c040d3e, 0x04000007, 0x8c040d08, 0x04020c98,
-+ 0x58380001, 0x82000500, 0x00000007, 0x0c01f804,
-+ 0x5c007000, 0x5c000800, 0x1c01f000, 0x001007c3,
-+ 0x00100867, 0x00100877, 0x001004ef, 0x001004ef,
-+ 0x001004ef, 0x001004ef, 0x00101106, 0x4807c856,
-+ 0x82040d00, 0x43000f80, 0x04020009, 0x58380003,
-+ 0x80000540, 0x0400001c, 0x59dc0000, 0x4803b800,
-+ 0x59dc0001, 0x4803b801, 0x0401f7af, 0x58380802,
-+ 0x4a000802, 0x00000200, 0x0401f01d, 0x4807c856,
-+ 0x82040d00, 0x43000f80, 0x04020009, 0x58380003,
-+ 0x80000540, 0x0400000c, 0x59dc0000, 0x4803b800,
-+ 0x59dc0001, 0x4803b801, 0x0401f7b7, 0x58380002,
-+ 0x82000400, 0x00000002, 0x46000000, 0x00000200,
-+ 0x0401f00b, 0x4c340000, 0x58386802, 0x59dc0000,
-+ 0x4803c857, 0x48006807, 0x59dc0001, 0x48006808,
-+ 0x4a006802, 0x00000100, 0x5c006800, 0x4a007001,
-+ 0x00000000, 0x4c300000, 0x58386002, 0x4833c857,
-+ 0x0401f807, 0x04000004, 0x58300009, 0x4030d000,
-+ 0x0801f800, 0x5c006000, 0x0401f725, 0x803061c0,
-+ 0x04000009, 0x59a8000b, 0x80300480, 0x04001007,
-+ 0x59a8000c, 0x80300480, 0x04021004, 0x82000540,
-+ 0x00000001, 0x1c01f000, 0x80000580, 0x1c01f000,
-+ 0x4803c856, 0x4dc00000, 0x42007000, 0x0010afd1,
-+ 0x4a007400, 0x00000000, 0x49787001, 0x42038000,
-+ 0x00007720, 0x4a038006, 0x60000001, 0x4a038009,
-+ 0xf4f60000, 0x42038000, 0x00007700, 0x4a038006,
-+ 0x60000001, 0x4a038009, 0xf4f60000, 0x4a03c822,
-+ 0x00000010, 0x4a0370e8, 0x00000000, 0x0401f809,
-+ 0x4a0370e9, 0x00003a0f, 0x4a0370e8, 0x00000000,
-+ 0x4a0370e8, 0x00000001, 0x5c038000, 0x1c01f000,
-+ 0x4c5c0000, 0x4178b800, 0x0401f80a, 0x5c00b800,
-+ 0x1c01f000, 0x4803c856, 0x4c5c0000, 0x825cbd40,
-+ 0x00000001, 0x0401f803, 0x5c00b800, 0x1c01f000,
-+ 0x4803c856, 0x4dc00000, 0x4c500000, 0x4c580000,
-+ 0x4c540000, 0x4a0370e8, 0x00000000, 0x805cb9c0,
-+ 0x04000009, 0x4a038807, 0x00000004, 0x59b800ea,
-+ 0x8c000510, 0x04000004, 0x59b800e0, 0x0401f87c,
-+ 0x0401f7fb, 0x42038000, 0x00007720, 0x0201f800,
-+ 0x00100e08, 0x59c00007, 0x4a038006, 0x20000000,
-+ 0x59c00007, 0x4a038006, 0x8000000a, 0x59c00007,
-+ 0x4a038006, 0x8000000b, 0x59c00007, 0x4a038006,
-+ 0x40000001, 0x83c00580, 0x00007700, 0x04000004,
-+ 0x42038000, 0x00007700, 0x0401f7ed, 0x42038000,
-+ 0x00007720, 0x42000800, 0x00000800, 0x59c00007,
-+ 0x8c00051e, 0x04000007, 0x4a038006, 0x90000001,
-+ 0x80040840, 0x040207fa, 0x0201f800, 0x001004ef,
-+ 0x83c00580, 0x00007700, 0x04000004, 0x42038000,
-+ 0x00007700, 0x0401f7f0, 0x805cb9c0, 0x0402001d,
-+ 0x4200b000, 0x00000020, 0x83b8ac00, 0x00000020,
-+ 0x0201f800, 0x0010a339, 0x4a0370fb, 0x00000001,
-+ 0x4a037020, 0x00100fd8, 0x59a80036, 0x82000500,
-+ 0x0000ffff, 0x48037021, 0x4a037035, 0x0010b5aa,
-+ 0x4a037030, 0x0010ac0f, 0x4a037031, 0x0010a400,
-+ 0x4a037032, 0x0010ace6, 0x4a037036, 0x0010acf1,
-+ 0x59840002, 0x48037034, 0x4a037038, 0x00100fcf,
-+ 0x4a0370fb, 0x00000001, 0x4178a000, 0x4200b000,
-+ 0x00000020, 0x83b8ac00, 0x00000000, 0x0201f800,
-+ 0x0010a339, 0x4200b000, 0x00000040, 0x83b8ac00,
-+ 0x00000040, 0x0201f800, 0x0010a339, 0x805cb9c0,
-+ 0x04020004, 0x4a0370e4, 0xaaaaaaaa, 0x0401f003,
-+ 0x4a0370e4, 0xa2aaaa82, 0x4a0370e5, 0xaaaaaaaa,
-+ 0x4a0370e6, 0xaaaaaaaa, 0x4a0370fb, 0x00000000,
-+ 0x4a0370e6, 0xaaaaaaaa, 0x42038000, 0x00007720,
-+ 0x4a038006, 0x90000000, 0x59c00007, 0x8c00051e,
-+ 0x02020800, 0x001004ef, 0x42038000, 0x00007700,
-+ 0x4a038006, 0x90000000, 0x59c00007, 0x8c00051e,
-+ 0x02020800, 0x001004ef, 0x5c00a800, 0x5c00b000,
-+ 0x5c00a000, 0x5c038000, 0x1c01f000, 0x4d300000,
-+ 0x4d380000, 0x40026000, 0x82000500, 0x7f000000,
-+ 0x82000580, 0x00000003, 0x0402000f, 0x83326500,
-+ 0x00ffffff, 0x59300203, 0x82000580, 0x00000004,
-+ 0x04020009, 0x59300c06, 0x82040580, 0x00000009,
-+ 0x04020005, 0x42027000, 0x00000047, 0x0201f800,
-+ 0x000207df, 0x5c027000, 0x5c026000, 0x1c01f000,
-+ 0x4d300000, 0x4d2c0000, 0x4d340000, 0x4d400000,
-+ 0x4cfc0000, 0x4d380000, 0x4d3c0000, 0x4d440000,
-+ 0x4d4c0000, 0x4d480000, 0x4c5c0000, 0x4c600000,
-+ 0x4c640000, 0x4d040000, 0x4cc80000, 0x4ccc0000,
-+ 0x4cf40000, 0x4cf80000, 0x4cfc0000, 0x0201f800,
-+ 0x00020016, 0x5c01f800, 0x5c01f000, 0x5c01e800,
-+ 0x5c019800, 0x5c019000, 0x5c020800, 0x5c00c800,
-+ 0x5c00c000, 0x5c00b800, 0x5c029000, 0x5c029800,
-+ 0x5c028800, 0x5c027800, 0x5c027000, 0x5c01f800,
-+ 0x5c028000, 0x5c026800, 0x5c025800, 0x5c026000,
-+ 0x1c01f000, 0x493bc857, 0x0201f000, 0x0002003d,
-+ 0x83300500, 0x1f000000, 0x04000008, 0x81326580,
-+ 0x80000130, 0x82000c80, 0x00000014, 0x02021800,
-+ 0x001004ef, 0x0c01f013, 0x83300500, 0x000000ff,
-+ 0x82000c80, 0x00000007, 0x02021800, 0x001004ef,
-+ 0x0c01f025, 0x1c01f000, 0x82000d00, 0xc0000038,
-+ 0x02020800, 0x001004e4, 0x0201f800, 0x001004ef,
-+ 0x00000000, 0x00000048, 0x00000054, 0x00000053,
-+ 0x001009db, 0x001009ff, 0x001009fa, 0x00100a1f,
-+ 0x001009e6, 0x001009f2, 0x001009db, 0x00100a1a,
-+ 0x00100a5b, 0x001009db, 0x001009db, 0x001009db,
-+ 0x001009db, 0x00100a5e, 0x00100a64, 0x00100a75,
-+ 0x00100a86, 0x001009db, 0x00100a8f, 0x00100a9b,
-+ 0x001009db, 0x001009db, 0x001009db, 0x0201f800,
-+ 0x001004ef, 0x001009e4, 0x00100b36, 0x00100a2c,
-+ 0x00100a50, 0x001009e4, 0x001009e4, 0x001009e4,
-+ 0x0201f800, 0x001004ef, 0x4803c856, 0x59300004,
-+ 0x8c00053e, 0x04020005, 0x42027000, 0x00000055,
-+ 0x0201f000, 0x000207df, 0x0201f800, 0x001067a7,
-+ 0x040007fa, 0x1c01f000, 0x4803c856, 0x0401f8aa,
-+ 0x40002800, 0x41782000, 0x42027000, 0x00000056,
-+ 0x0201f000, 0x000207df, 0x4803c856, 0x42027000,
-+ 0x00000057, 0x0201f000, 0x000207df, 0x4803c856,
-+ 0x59300007, 0x8c00051a, 0x04020010, 0x59325808,
-+ 0x812e59c0, 0x04000014, 0x592c0408, 0x8c00051c,
-+ 0x04020003, 0x4a026011, 0xffffffff, 0x59300004,
-+ 0x8c00053e, 0x04020009, 0x42027000, 0x00000048,
-+ 0x0201f000, 0x000207df, 0x59325808, 0x4a025a06,
-+ 0x00000007, 0x0401f7f4, 0x0201f800, 0x001067a7,
-+ 0x040007f6, 0x1c01f000, 0x4803c856, 0x83300500,
-+ 0x00ffffff, 0x0201f000, 0x001060d6, 0x1c01f000,
-+ 0x4c040000, 0x59b808ea, 0x82040d00, 0x00000007,
-+ 0x82040580, 0x00000003, 0x04000004, 0x42000000,
-+ 0x60000000, 0x0401f8ac, 0x5c000800, 0x1c01f000,
-+ 0x0401f8fa, 0x0400001b, 0x59325808, 0x812e59c0,
-+ 0x04000018, 0x592c0204, 0x82000500, 0x000000ff,
-+ 0x82000d80, 0x00000029, 0x04020012, 0x59300203,
-+ 0x82000580, 0x00000003, 0x0400000b, 0x59300807,
-+ 0x84040d26, 0x48066007, 0x0201f800, 0x0002007b,
- 0x4a03900d, 0x00000040, 0x4a0370e5, 0x00000008,
-- 0x1c01f000, 0x59880053, 0x80000000, 0x48031053,
-- 0x4a03900d, 0x00000040, 0x42000000, 0xc0000000,
-- 0x0401f726, 0x4cf80000, 0x58f40000, 0x8001f540,
-- 0x0401f820, 0x41781800, 0x0401f8e7, 0x04020014,
-- 0x44140800, 0x0401f82a, 0x04000011, 0x40043800,
-- 0x42001800, 0x00000001, 0x40142000, 0x0401f8de,
-- 0x0402000b, 0x801c3800, 0x501c0000, 0x44000800,
-- 0x0401f810, 0x801c0580, 0x04000004, 0x44103800,
-- 0x801c3840, 0x44143800, 0x0401f819, 0x5c01f000,
-- 0x1c01f000, 0x80f9f1c0, 0x04020003, 0x58f41202,
-- 0x0401f003, 0x42001000, 0x00000007, 0x1c01f000,
-- 0x80f9f1c0, 0x04020006, 0x58f40401, 0x82000480,
-- 0x00000002, 0x80f40400, 0x0401f005, 0x58f80401,
-- 0x82000480, 0x00000002, 0x80f80400, 0x50002800,
-- 0x80000000, 0x50002000, 0x1c01f000, 0x80f9f1c0,
-- 0x04020008, 0x58f40401, 0x82000480, 0x00000002,
-- 0x02001800, 0x00100615, 0x4801ec01, 0x0401f00b,
-- 0x58f80401, 0x82000480, 0x00000002, 0x02001800,
-- 0x00100615, 0x4801f401, 0x82000580, 0x00000002,
-- 0x04020002, 0x0401f809, 0x58f40202, 0x80000040,
-- 0x4801ea02, 0x02000800, 0x00100615, 0x82000580,
-- 0x00000001, 0x1c01f000, 0x4d2c0000, 0x40fa5800,
-- 0x0201f800, 0x0010083a, 0x4979e800, 0x4179f000,
-- 0x5c025800, 0x1c01f000, 0x80f5e9c0, 0x04000009,
-- 0x80f9f1c0, 0x04020ff5, 0x4d2c0000, 0x40f65800,
-- 0x0201f800, 0x0010083a, 0x4179e800, 0x5c025800,
-- 0x1c01f000, 0x4cf40000, 0x0201f800, 0x00104728,
-- 0x04020036, 0x59300807, 0x82040500, 0x00003100,
-- 0x04020032, 0x8c040d22, 0x04000032, 0x5930001f,
-- 0x8001ed40, 0x02000800, 0x00100615, 0x82000580,
-- 0xffffffff, 0x04000029, 0x58f40201, 0x82000580,
-- 0x0000dcb3, 0x02020800, 0x00100615, 0x58f40a02,
-- 0x82040500, 0x0000fffe, 0x04000003, 0x0401ff86,
-- 0x58f40a02, 0x82040480, 0x0000000f, 0x04021059,
-- 0x80040800, 0x4805ea02, 0x82040580, 0x00000008,
-- 0x0400005d, 0x82040480, 0x00000008, 0x0400100a,
-- 0x58f40000, 0x8001ed40, 0x02000800, 0x00100615,
-- 0x58f40201, 0x82000580, 0x0000ddb9, 0x02020800,
-- 0x00100615, 0x58f40401, 0x82000c00, 0x00000002,
-- 0x4805ec01, 0x80f40400, 0x59300812, 0x44040000,
-- 0x80000000, 0x45780000, 0x5c01e800, 0x1c01f000,
-- 0x42001000, 0x00000400, 0x59b800e4, 0x8c000524,
-- 0x04020023, 0x4a0370e4, 0x00030000, 0x40000000,
-- 0x59b800e4, 0x8c000524, 0x0402001b, 0x59300807,
-- 0x84040d62, 0x48066007, 0x4a0370e4, 0x00020000,
-- 0x4d2c0000, 0x0201f800, 0x00100819, 0x04000025,
-- 0x492e601f, 0x4a025a01, 0x0000dcb3, 0x59300008,
-- 0x80001d40, 0x02000800, 0x00100615, 0x580c080f,
-- 0x48065803, 0x59301811, 0x40040000, 0x800c0580,
-- 0x0402000d, 0x497a5a02, 0x4a025c01, 0x00000004,
-- 0x0401f011, 0x4a0370e4, 0x00020000, 0x40000000,
-- 0x40000000, 0x80081040, 0x02000800, 0x00100615,
-- 0x0401f7d6, 0x4a025a02, 0x00000001, 0x4a025c01,
-- 0x00000006, 0x497a5804, 0x400c0000, 0x80040480,
-- 0x48025805, 0x412de800, 0x5c025800, 0x0401f7a9,
-- 0x5c025800, 0x4a02601f, 0xffffffff, 0x0401f7c3,
-- 0x4d2c0000, 0x58f65800, 0x0201f800, 0x0010083a,
-- 0x40f65800, 0x0201f800, 0x0010083a, 0x5c025800,
-- 0x0401f7f5, 0x4d2c0000, 0x0201f800, 0x00100819,
-- 0x040007f8, 0x4a025a01, 0x0000ddb9, 0x4a025c01,
-- 0x00000002, 0x492de800, 0x412de800, 0x5c025800,
-- 0x0401f7a5, 0x0401ff30, 0x82f40400, 0x00000004,
-- 0x800c0400, 0x40000800, 0x50040000, 0x80100580,
-- 0x04000016, 0x82040c00, 0x00000002, 0x80081040,
-- 0x040207fa, 0x80f9f1c0, 0x04000011, 0x58f41202,
-- 0x82081480, 0x00000007, 0x82f80400, 0x00000002,
-- 0x800c0400, 0x40000800, 0x50040000, 0x80100580,
-- 0x04000006, 0x82040c00, 0x00000002, 0x80081040,
-- 0x040207fa, 0x0401f002, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401f7fd, 0x4cf40000, 0x4cf80000,
-- 0x4001e800, 0x592c0a06, 0x800409c0, 0x04020021,
-- 0x82f40580, 0xffffffff, 0x0400001b, 0x58f40201,
-- 0x82000580, 0x0000dcb3, 0x02020800, 0x00100615,
-- 0x58f40000, 0x8001f540, 0x04000006, 0x58f80201,
-- 0x82000580, 0x0000ddb9, 0x02020800, 0x00100615,
-- 0x41783800, 0x58f44003, 0x0401f83d, 0x04020009,
-- 0x0401ff2e, 0x497a601f, 0x59300807, 0x84040d22,
-- 0x48066007, 0x5c01f000, 0x5c01e800, 0x1c01f000,
-- 0x0401ff26, 0x4a025a06, 0x00000011, 0x0401f7f6,
-- 0x82f40580, 0xffffffff, 0x04020f20, 0x0401f7f2,
-- 0x4cf40000, 0x4cf80000, 0x4001e800, 0x82040580,
-- 0x00000001, 0x04020020, 0x82f40580, 0xffffffff,
-- 0x0400001a, 0x58f40201, 0x82000580, 0x0000dcb3,
-- 0x02020800, 0x00100615, 0x58f40000, 0x8001f540,
-- 0x04000006, 0x58f80201, 0x82000580, 0x0000ddb9,
-- 0x02020800, 0x00100615, 0x41783800, 0x58f44003,
-- 0x0401f813, 0x04020008, 0x0401ff04, 0x42000800,
-- 0x00000001, 0x497a601f, 0x5c01f000, 0x5c01e800,
-- 0x1c01f000, 0x0401fefd, 0x42000800, 0x00000011,
-- 0x0401f7f9, 0x4c040000, 0x82f40580, 0xffffffff,
-- 0x04020ef6, 0x5c000800, 0x0401f7f3, 0x4803c856,
-- 0x401c2000, 0x41781800, 0x4c200000, 0x0401ff86,
-- 0x5c004000, 0x0402002c, 0x40202000, 0x42001800,
-- 0x00000001, 0x0401ff80, 0x04020027, 0x0401feae,
-- 0x40082800, 0x82f40400, 0x00000004, 0x40003000,
-- 0x50182000, 0x40100000, 0x801c0580, 0x04000005,
-- 0x42001800, 0x00000001, 0x0401ff73, 0x0402001a,
-- 0x82183400, 0x00000002, 0x80142840, 0x040207f5,
-- 0x80f9f1c0, 0x04000013, 0x58f42a02, 0x82142c80,
-- 0x00000007, 0x82f80400, 0x00000003, 0x40003000,
-- 0x50182000, 0x40100000, 0x801c0580, 0x04000005,
-- 0x42001800, 0x00000001, 0x0401ff5f, 0x04020006,
-- 0x82183400, 0x00000002, 0x80142840, 0x040207f5,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fd,
-- 0x0201f800, 0x00100615, 0x58380207, 0x8c000502,
-- 0x040007fc, 0x50200000, 0x80387c00, 0x583c2800,
-- 0x583c2001, 0x58380404, 0x80001540, 0x04020002,
-- 0x58381407, 0x58c83401, 0x58380c08, 0x59303807,
-- 0x497a6012, 0x497a6013, 0x0201f000, 0x000200bf,
-- 0x592c0408, 0x8c000502, 0x040007ea, 0x592c0409,
-- 0x80000540, 0x040007e7, 0x82000c80, 0x00000002,
-- 0x04001011, 0x58380001, 0x80007540, 0x02000800,
-- 0x00100615, 0x58380204, 0x82000500, 0x0000000f,
-- 0x82000400, 0x0010110d, 0x50004000, 0x40040000,
-- 0x800409c0, 0x04000005, 0x82040c80, 0x00000005,
-- 0x040217f1, 0x80204400, 0x50200000, 0x80387c00,
-- 0x583c2800, 0x583c2001, 0x583c1002, 0x592c0a07,
-- 0x592c4c08, 0x592c300d, 0x59303807, 0x497a6012,
-- 0x497a6013, 0x4816600e, 0x4812600f, 0x480a6010,
-- 0x481a6011, 0x80040840, 0x4806600d, 0x02000000,
-- 0x000200c7, 0x80204000, 0x50201800, 0x800c19c0,
-- 0x0402000c, 0x58380001, 0x80007540, 0x02000800,
-- 0x00100615, 0x58380204, 0x82000500, 0x0000000f,
-- 0x82000400, 0x0010110d, 0x50004000, 0x50201800,
-- 0x483a600b, 0x480e600a, 0x4822600c, 0x0201f000,
-- 0x000200c7, 0x4803c856, 0x592c0208, 0x8c00051e,
-- 0x04020017, 0x50200000, 0x80306c00, 0x40240000,
-- 0x0c01f001, 0x00100e91, 0x00100e91, 0x00100e9a,
-- 0x00100e91, 0x00100e91, 0x00100e91, 0x00100e91,
-- 0x00100e91, 0x00100e9a, 0x00100e91, 0x00100e9a,
-- 0x00100e91, 0x00100e91, 0x00100e9a, 0x00100e91,
-- 0x00100e91, 0x0201f800, 0x00100615, 0x8400051e,
-- 0x48025a08, 0x50200000, 0x80306c00, 0x58343801,
-- 0x481e600f, 0x0401f007, 0x58341802, 0x58342800,
-- 0x58343801, 0x480e6010, 0x4816600e, 0x481e600f,
-- 0x0401f24b, 0x4933c857, 0x5931f808, 0x59300a06,
-- 0x800409c0, 0x04000005, 0x80040906, 0x04020002,
-- 0x80040800, 0x4805fc06, 0x4a026206, 0x00000002,
-- 0x592c0409, 0x82000500, 0x00000008, 0x0400000b,
-- 0x0401f834, 0x59300203, 0x82000580, 0x00000004,
-- 0x04020005, 0x42027000, 0x00000048, 0x0201f800,
-- 0x000208d8, 0x1c01f000, 0x4cfc0000, 0x58fc0204,
-- 0x82000500, 0x000000ff, 0x82000580, 0x00000048,
-- 0x0402000c, 0x58fc000b, 0x800001c0, 0x04000009,
-- 0x58fc0407, 0x800001c0, 0x04000006, 0x58fc080b,
-- 0x8c040d16, 0x04000017, 0x58fc0007, 0x0401f00a,
-- 0x58fc0408, 0x8c000512, 0x04020014, 0x58fc0c09,
-- 0x8c040d16, 0x04020003, 0x5c01f800, 0x1c01f000,
-- 0x58fc000a, 0x59300811, 0x80040580, 0x04020009,
-- 0x59300007, 0x84000500, 0x48026007, 0x42027000,
-- 0x00000048, 0x5c01f800, 0x0201f000, 0x000208d8,
-- 0x5c01f800, 0x1c01f000, 0x58fdf809, 0x0401f7ec,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4933c857,
-- 0x59b808ea, 0x82040d00, 0x00000007, 0x82040580,
-- 0x00000000, 0x0400001e, 0x82040580, 0x00000003,
-- 0x0400001b, 0x59300406, 0x4c000000, 0x4a026406,
-- 0x00000000, 0x42003000, 0x00000041, 0x42000000,
-- 0x50000000, 0x41300800, 0x4c180000, 0x0401fce3,
-- 0x5c003000, 0x0400000b, 0x42000000, 0x0000001e,
-- 0x80000040, 0x040207ff, 0x80183040, 0x040207f4,
-- 0x42000000, 0x40000000, 0x41300800, 0x0401fcd7,
-- 0x5c000000, 0x48026406, 0x1c01f000, 0x59300007,
-- 0x84000500, 0x48026007, 0x0401f7fc, 0x59c00007,
-- 0x4a038006, 0x30000000, 0x40000000, 0x59c00007,
-- 0x8c00050a, 0x040207fe, 0x1c01f000, 0x5c000000,
-- 0x4c000000, 0x4803c857, 0x4dc00000, 0x4a0370e8,
-- 0x00000000, 0x42038000, 0x00007720, 0x0401fff0,
-- 0x42038000, 0x00007700, 0x0401ffed, 0x0201f800,
-- 0x00104e0d, 0x04020013, 0x4a038891, 0x0000ffff,
-- 0x497b8880, 0x497b8892, 0x42001000, 0x00000190,
-- 0x40000000, 0x40000000, 0x80081040, 0x040207fd,
-- 0x42000000, 0x0010b6a5, 0x0201f800, 0x0010a86e,
-- 0x0401f80e, 0x5c038000, 0x0201f000, 0x00104f29,
-- 0x0401f82d, 0x42000000, 0x0010b6a6, 0x0201f800,
-- 0x0010a86e, 0x0401f805, 0x48178892, 0x480b8880,
-- 0x5c038000, 0x1c01f000, 0x496fc857, 0x836c0580,
-- 0x00000003, 0x0402000b, 0x4c080000, 0x4c0c0000,
-- 0x42001000, 0x00008048, 0x42001800, 0x0000ffff,
-- 0x0201f800, 0x00103857, 0x5c001800, 0x5c001000,
-- 0x42000800, 0x0000003c, 0x0201f800, 0x00101395,
-- 0x59a8006c, 0x80000540, 0x04000006, 0x59a8106d,
-- 0x800811c0, 0x04000003, 0x0201f800, 0x00101b0a,
-- 0x4a038891, 0x0000ffff, 0x4a03900d, 0x00000040,
-- 0x0201f800, 0x001009db, 0x4a0370e8, 0x00000001,
-+ 0x1c01f000, 0x0201f800, 0x001067a7, 0x040007f4,
-+ 0x59880053, 0x80000000, 0x48031053, 0x4a03900d,
-+ 0x00000040, 0x42000000, 0xc0000000, 0x0401f05a,
-+ 0x42007800, 0x0010b5b1, 0x42002000, 0x00003000,
-+ 0x42003000, 0x00000105, 0x0201f800, 0x001059d8,
-+ 0x4a0370e4, 0x02000000, 0x1c01f000, 0x4933c857,
-+ 0x0201f000, 0x000207bb, 0x41300800, 0x800409c0,
-+ 0x02020800, 0x001004ef, 0x0201f800, 0x001004e4,
-+ 0x4933c857, 0x813261c0, 0x02000800, 0x001004ef,
-+ 0x0401f835, 0x40002800, 0x0201f800, 0x0010a1b4,
-+ 0x0401f8ae, 0x04000007, 0x59326809, 0x59340200,
-+ 0x8c00050e, 0x59300414, 0x02020800, 0x00108afb,
-+ 0x1c01f000, 0x4933c857, 0x813261c0, 0x02000800,
-+ 0x001004ef, 0x0401f8a1, 0x0400000b, 0x0201f800,
-+ 0x0010883d, 0x04000008, 0x59325808, 0x592c0208,
-+ 0x8400054e, 0x48025a08, 0x417a7800, 0x0201f800,
-+ 0x001083e0, 0x1c01f000, 0x485fc857, 0x5c000000,
-+ 0x4d780000, 0x4203e000, 0x50000000, 0x4200b800,
-+ 0x00008005, 0x0201f000, 0x001004f4, 0x4933c857,
-+ 0x83300480, 0x00000020, 0x02021800, 0x001004ef,
-+ 0x83300c00, 0x0010b09b, 0x50040000, 0x80000000,
-+ 0x04001002, 0x44000800, 0x1c01f000, 0x4933c857,
-+ 0x0401f7f4, 0x4807c856, 0x59b800ea, 0x8c000510,
-+ 0x040007fd, 0x59b800e0, 0x4803c857, 0x1c01f000,
-+ 0x4803c856, 0x42000000, 0x10000000, 0x41300800,
-+ 0x0401f02d, 0x82000500, 0xf0000000, 0x82040d00,
-+ 0x0fffffff, 0x80040d40, 0x4807c857, 0x59b800ea,
-+ 0x8c000516, 0x04020003, 0x480770e1, 0x1c01f000,
-+ 0x8c000510, 0x040007fa, 0x4c040000, 0x0401f809,
-+ 0x5c000800, 0x82100480, 0x00000008, 0x040017f4,
-+ 0x4c040000, 0x0401febf, 0x5c000800, 0x0401f7f0,
-+ 0x59b800e2, 0x59b820e2, 0x80100580, 0x040207fd,
-+ 0x80102114, 0x0401f006, 0x59b800e2, 0x59b820e2,
-+ 0x80100580, 0x040207fd, 0x0401f001, 0x40101800,
-+ 0x800c190a, 0x82100500, 0x0000001f, 0x820c1d00,
-+ 0x0000001f, 0x800c2480, 0x82102500, 0x0000001f,
-+ 0x1c01f000, 0x82000500, 0xf0000000, 0x82040d00,
-+ 0x0fffffff, 0x80040d40, 0x4807c857, 0x42001000,
-+ 0x0010afd2, 0x50080000, 0x80000540, 0x04020005,
-+ 0x4a0370e5, 0x00000003, 0x4a0370e4, 0x00000300,
-+ 0x80000000, 0x44001000, 0x42001000, 0x00000400,
-+ 0x59b800ea, 0x8c000510, 0x0400000c, 0x0401ffd5,
-+ 0x82100480, 0x00000008, 0x04001007, 0x4c040000,
-+ 0x4c080000, 0x0401fe8b, 0x5c001000, 0x5c000800,
-+ 0x0401f020, 0x59b800ea, 0x8c000516, 0x0402001d,
-+ 0x4a0370e4, 0x00300000, 0x480770e1, 0x42001000,
-+ 0x0000ff00, 0x80081040, 0x04000012, 0x59b808e4,
-+ 0x8c040d28, 0x040207fc, 0x42001000, 0x0010afd2,
-+ 0x50080000, 0x80000040, 0x04020005, 0x4a0370e5,
-+ 0x00000002, 0x4a0370e4, 0x00000200, 0x02001800,
-+ 0x001004ef, 0x44001000, 0x8c040d2c, 0x1c01f000,
-+ 0x41f80000, 0x50000000, 0x0201f800, 0x001004ef,
-+ 0x80081040, 0x040207d3, 0x41f80000, 0x50000000,
-+ 0x0201f800, 0x001004ef, 0x4d380000, 0x59300c06,
-+ 0x82040580, 0x00000009, 0x04020006, 0x42027000,
-+ 0x00000047, 0x0201f800, 0x000207df, 0x80000580,
-+ 0x5c027000, 0x1c01f000, 0x4c500000, 0x4a03900d,
-+ 0x00000001, 0x59c8a020, 0x4a03900d, 0x00000002,
-+ 0x59c80820, 0x8c50a52e, 0x04000002, 0x900409c0,
-+ 0x82040d00, 0x0000ffff, 0x0201f800, 0x001059aa,
-+ 0x5c00a000, 0x1c01f000, 0x0401fff0, 0x04000045,
-+ 0x4933c857, 0x59300406, 0x82000580, 0x00000000,
-+ 0x04000040, 0x59c82021, 0x4a03900d, 0x00000001,
-+ 0x59c82821, 0x82142d00, 0x0000ffff, 0x59325808,
-+ 0x812e59c0, 0x04000037, 0x59326809, 0x0201f800,
-+ 0x001045f8, 0x02020800, 0x00108ae3, 0x599c0019,
-+ 0x8c00050c, 0x04020018, 0x0201f800, 0x001045f8,
-+ 0x04020015, 0x59300811, 0x4807c857, 0x592c0408,
-+ 0x8c00051c, 0x0402000e, 0x8400055c, 0x48025c08,
-+ 0x592c0a04, 0x82040d00, 0x000000ff, 0x82040580,
-+ 0x00000048, 0x04000004, 0x82040580, 0x00000018,
-+ 0x04020003, 0x59300811, 0x48065803, 0x4a026011,
-+ 0x7fffffff, 0x48166013, 0x0201f800, 0x00100ff8,
-+ 0x04020014, 0x0401fa07, 0x40280000, 0x4802600d,
-+ 0x04000005, 0x4832600b, 0x50200000, 0x4802600a,
-+ 0x4822600c, 0x59300414, 0x8c00051c, 0x04020004,
-+ 0x599c0019, 0x8c00050c, 0x0402086e, 0x4a03900d,
-+ 0x00000040, 0x4a0370e5, 0x00000008, 0x1c01f000,
-+ 0x59880053, 0x80000000, 0x48031053, 0x4a03900d,
-+ 0x00000040, 0x42000000, 0xc0000000, 0x0401f726,
-+ 0x4cf80000, 0x58f40000, 0x8001f540, 0x0401f820,
-+ 0x41781800, 0x0401f8e7, 0x04020014, 0x44140800,
-+ 0x0401f82a, 0x04000011, 0x40043800, 0x42001800,
-+ 0x00000001, 0x40142000, 0x0401f8de, 0x0402000b,
-+ 0x801c3800, 0x501c0000, 0x44000800, 0x0401f810,
-+ 0x801c0580, 0x04000004, 0x44103800, 0x801c3840,
-+ 0x44143800, 0x0401f819, 0x5c01f000, 0x1c01f000,
-+ 0x80f9f1c0, 0x04020003, 0x58f41202, 0x0401f003,
-+ 0x42001000, 0x00000007, 0x1c01f000, 0x80f9f1c0,
-+ 0x04020006, 0x58f40401, 0x82000480, 0x00000002,
-+ 0x80f40400, 0x0401f005, 0x58f80401, 0x82000480,
-+ 0x00000002, 0x80f80400, 0x50002800, 0x80000000,
-+ 0x50002000, 0x1c01f000, 0x80f9f1c0, 0x04020008,
-+ 0x58f40401, 0x82000480, 0x00000002, 0x02001800,
-+ 0x001004ef, 0x4801ec01, 0x0401f00b, 0x58f80401,
-+ 0x82000480, 0x00000002, 0x02001800, 0x001004ef,
-+ 0x4801f401, 0x82000580, 0x00000002, 0x04020002,
-+ 0x0401f809, 0x58f40202, 0x80000040, 0x4801ea02,
-+ 0x02000800, 0x001004ef, 0x82000580, 0x00000001,
-+ 0x1c01f000, 0x4d2c0000, 0x40fa5800, 0x0201f800,
-+ 0x0010072e, 0x4979e800, 0x4179f000, 0x5c025800,
-+ 0x1c01f000, 0x80f5e9c0, 0x04000009, 0x80f9f1c0,
-+ 0x04020ff5, 0x4d2c0000, 0x40f65800, 0x0201f800,
-+ 0x0010072e, 0x4179e800, 0x5c025800, 0x1c01f000,
-+ 0x4cf40000, 0x0201f800, 0x001045f8, 0x04020036,
-+ 0x59300807, 0x82040500, 0x00003100, 0x04020032,
-+ 0x8c040d22, 0x04000032, 0x5930001f, 0x8001ed40,
-+ 0x02000800, 0x001004ef, 0x82000580, 0xffffffff,
-+ 0x04000029, 0x58f40201, 0x82000580, 0x0000dcb3,
-+ 0x02020800, 0x001004ef, 0x58f40a02, 0x82040500,
-+ 0x0000fffe, 0x04000003, 0x0401ff86, 0x58f40a02,
-+ 0x82040480, 0x0000000f, 0x04021059, 0x80040800,
-+ 0x4805ea02, 0x82040580, 0x00000008, 0x0400005d,
-+ 0x82040480, 0x00000008, 0x0400100a, 0x58f40000,
-+ 0x8001ed40, 0x02000800, 0x001004ef, 0x58f40201,
-+ 0x82000580, 0x0000ddb9, 0x02020800, 0x001004ef,
-+ 0x58f40401, 0x82000c00, 0x00000002, 0x4805ec01,
-+ 0x80f40400, 0x59300812, 0x44040000, 0x80000000,
-+ 0x45780000, 0x5c01e800, 0x1c01f000, 0x42001000,
-+ 0x00000400, 0x59b800e4, 0x8c000524, 0x04020023,
-+ 0x4a0370e4, 0x00030000, 0x40000000, 0x59b800e4,
-+ 0x8c000524, 0x0402001b, 0x59300807, 0x84040d62,
-+ 0x48066007, 0x4a0370e4, 0x00020000, 0x4d2c0000,
-+ 0x0201f800, 0x00100704, 0x04000025, 0x492e601f,
-+ 0x4a025a01, 0x0000dcb3, 0x59300008, 0x80001d40,
-+ 0x02000800, 0x001004ef, 0x580c080f, 0x48065803,
-+ 0x59301811, 0x40040000, 0x800c0580, 0x0402000d,
-+ 0x497a5a02, 0x4a025c01, 0x00000004, 0x0401f011,
-+ 0x4a0370e4, 0x00020000, 0x40000000, 0x40000000,
-+ 0x80081040, 0x02000800, 0x001004ef, 0x0401f7d6,
-+ 0x4a025a02, 0x00000001, 0x4a025c01, 0x00000006,
-+ 0x497a5804, 0x400c0000, 0x80040480, 0x48025805,
-+ 0x412de800, 0x5c025800, 0x0401f7a9, 0x5c025800,
-+ 0x4a02601f, 0xffffffff, 0x0401f7c3, 0x4d2c0000,
-+ 0x58f65800, 0x0201f800, 0x0010072e, 0x40f65800,
-+ 0x0201f800, 0x0010072e, 0x5c025800, 0x0401f7f5,
-+ 0x4d2c0000, 0x0201f800, 0x00100704, 0x040007f8,
-+ 0x4a025a01, 0x0000ddb9, 0x4a025c01, 0x00000002,
-+ 0x492de800, 0x412de800, 0x5c025800, 0x0401f7a5,
-+ 0x0401ff30, 0x82f40400, 0x00000004, 0x800c0400,
-+ 0x40000800, 0x50040000, 0x80100580, 0x04000016,
-+ 0x82040c00, 0x00000002, 0x80081040, 0x040207fa,
-+ 0x80f9f1c0, 0x04000011, 0x58f41202, 0x82081480,
-+ 0x00000007, 0x82f80400, 0x00000002, 0x800c0400,
-+ 0x40000800, 0x50040000, 0x80100580, 0x04000006,
-+ 0x82040c00, 0x00000002, 0x80081040, 0x040207fa,
-+ 0x0401f002, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x0401f7fd, 0x4cf40000, 0x4cf80000, 0x4001e800,
-+ 0x592c0a06, 0x800409c0, 0x04020021, 0x82f40580,
-+ 0xffffffff, 0x0400001b, 0x58f40201, 0x82000580,
-+ 0x0000dcb3, 0x02020800, 0x001004ef, 0x58f40000,
-+ 0x8001f540, 0x04000006, 0x58f80201, 0x82000580,
-+ 0x0000ddb9, 0x02020800, 0x001004ef, 0x41783800,
-+ 0x58f44003, 0x0401f83d, 0x04020009, 0x0401ff2e,
-+ 0x497a601f, 0x59300807, 0x84040d22, 0x48066007,
-+ 0x5c01f000, 0x5c01e800, 0x1c01f000, 0x0401ff26,
-+ 0x4a025a06, 0x00000011, 0x0401f7f6, 0x82f40580,
-+ 0xffffffff, 0x04020f20, 0x0401f7f2, 0x4cf40000,
-+ 0x4cf80000, 0x4001e800, 0x82040580, 0x00000001,
-+ 0x04020020, 0x82f40580, 0xffffffff, 0x0400001a,
-+ 0x58f40201, 0x82000580, 0x0000dcb3, 0x02020800,
-+ 0x001004ef, 0x58f40000, 0x8001f540, 0x04000006,
-+ 0x58f80201, 0x82000580, 0x0000ddb9, 0x02020800,
-+ 0x001004ef, 0x41783800, 0x58f44003, 0x0401f813,
-+ 0x04020008, 0x0401ff04, 0x42000800, 0x00000001,
-+ 0x497a601f, 0x5c01f000, 0x5c01e800, 0x1c01f000,
-+ 0x0401fefd, 0x42000800, 0x00000011, 0x0401f7f9,
-+ 0x4c040000, 0x82f40580, 0xffffffff, 0x04020ef6,
-+ 0x5c000800, 0x0401f7f3, 0x4803c856, 0x401c2000,
-+ 0x41781800, 0x4c200000, 0x0401ff86, 0x5c004000,
-+ 0x0402002c, 0x40202000, 0x42001800, 0x00000001,
-+ 0x0401ff80, 0x04020027, 0x0401feae, 0x40082800,
-+ 0x82f40400, 0x00000004, 0x40003000, 0x50182000,
-+ 0x40100000, 0x801c0580, 0x04000005, 0x42001800,
-+ 0x00000001, 0x0401ff73, 0x0402001a, 0x82183400,
-+ 0x00000002, 0x80142840, 0x040207f5, 0x80f9f1c0,
-+ 0x04000013, 0x58f42a02, 0x82142c80, 0x00000007,
-+ 0x82f80400, 0x00000003, 0x40003000, 0x50182000,
-+ 0x40100000, 0x801c0580, 0x04000005, 0x42001800,
-+ 0x00000001, 0x0401ff5f, 0x04020006, 0x82183400,
-+ 0x00000002, 0x80142840, 0x040207f5, 0x1c01f000,
-+ 0x82000540, 0x00000001, 0x0401f7fd, 0x0201f800,
-+ 0x001004ef, 0x58380207, 0x8c000502, 0x040007fc,
-+ 0x50200000, 0x80387c00, 0x583c2800, 0x583c2001,
-+ 0x58380404, 0x80001540, 0x04020002, 0x58381407,
-+ 0x58c83401, 0x58380c08, 0x59303807, 0x497a6012,
-+ 0x497a6013, 0x0201f000, 0x000200b3, 0x592c0408,
-+ 0x8c000502, 0x040007ea, 0x592c0409, 0x80000540,
-+ 0x040007e7, 0x82000c80, 0x00000002, 0x04001011,
-+ 0x58380001, 0x80007540, 0x02000800, 0x001004ef,
-+ 0x58380204, 0x82000500, 0x0000000f, 0x82000400,
-+ 0x00100fd8, 0x50004000, 0x40040000, 0x800409c0,
-+ 0x04000005, 0x82040c80, 0x00000005, 0x040217f1,
-+ 0x80204400, 0x50200000, 0x80387c00, 0x583c2800,
-+ 0x583c2001, 0x583c1002, 0x592c0a07, 0x592c4c08,
-+ 0x592c300d, 0x59303807, 0x497a6012, 0x497a6013,
-+ 0x4816600e, 0x4812600f, 0x480a6010, 0x481a6011,
-+ 0x80040840, 0x4806600d, 0x02000000, 0x000200bb,
-+ 0x80204000, 0x50201800, 0x800c19c0, 0x0402000c,
-+ 0x58380001, 0x80007540, 0x02000800, 0x001004ef,
-+ 0x58380204, 0x82000500, 0x0000000f, 0x82000400,
-+ 0x00100fd8, 0x50004000, 0x50201800, 0x483a600b,
-+ 0x480e600a, 0x4822600c, 0x0201f000, 0x000200bb,
-+ 0x4803c856, 0x592c0208, 0x8c00051e, 0x04020017,
-+ 0x50200000, 0x80306c00, 0x40240000, 0x0c01f001,
-+ 0x00100d88, 0x00100d88, 0x00100d91, 0x00100d88,
-+ 0x00100d88, 0x00100d88, 0x00100d88, 0x00100d88,
-+ 0x00100d91, 0x00100d88, 0x00100d91, 0x00100d88,
-+ 0x00100d88, 0x00100d91, 0x00100d88, 0x00100d88,
-+ 0x0201f800, 0x001004ef, 0x8400051e, 0x48025a08,
-+ 0x50200000, 0x80306c00, 0x58343801, 0x481e600f,
-+ 0x0401f007, 0x58341802, 0x58342800, 0x58343801,
-+ 0x480e6010, 0x4816600e, 0x481e600f, 0x0401f21f,
-+ 0x4933c857, 0x5931f808, 0x59300a06, 0x800409c0,
-+ 0x04000005, 0x80040906, 0x04020002, 0x80040800,
-+ 0x4805fc06, 0x4a026206, 0x00000002, 0x592c0409,
-+ 0x82000500, 0x00000008, 0x0400000b, 0x0401f836,
-+ 0x59300203, 0x82000580, 0x00000004, 0x04020005,
-+ 0x42027000, 0x00000048, 0x0201f800, 0x000207df,
-+ 0x1c01f000, 0x4cfc0000, 0x58fc0204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000048, 0x0402000c,
-+ 0x58fc000b, 0x800001c0, 0x04000009, 0x58fc0407,
-+ 0x800001c0, 0x04000006, 0x58fc080b, 0x8c040d16,
-+ 0x04000017, 0x58fc0007, 0x0401f00a, 0x58fc0408,
-+ 0x8c000512, 0x04020014, 0x58fc0c09, 0x8c040d16,
-+ 0x04020003, 0x5c01f800, 0x1c01f000, 0x58fc000a,
-+ 0x59300811, 0x80040580, 0x04020009, 0x59300007,
-+ 0x84000500, 0x48026007, 0x42027000, 0x00000048,
-+ 0x5c01f800, 0x0201f000, 0x000207df, 0x5c01f800,
-+ 0x1c01f000, 0x58fdf809, 0x0401f7ec, 0x0401f802,
- 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-- 0x59c41080, 0x497b8880, 0x59c42892, 0x497b8892,
-- 0x0201f800, 0x00104e0d, 0x04020002, 0x1c01f000,
-- 0x42002000, 0x00000260, 0x59c418a4, 0x820c1d00,
-- 0x0000000f, 0x820c0580, 0x00000000, 0x04000010,
-- 0x59c41805, 0x820c1d00, 0x00000001, 0x0402000e,
-- 0x59c418a4, 0x820c1d00, 0x0000000f, 0x820c0480,
-- 0x00000007, 0x04001004, 0x820c0480, 0x0000000c,
-- 0x04001003, 0x80102040, 0x040207ec, 0x497b8891,
-- 0x1c01f000, 0x4c100000, 0x42002000, 0x00000019,
-- 0x46000000, 0x00000001, 0x0201f800, 0x001019a4,
-- 0x50001800, 0x820c1d00, 0x00000001, 0x04000005,
-- 0x80102040, 0x040207f7, 0x5c002000, 0x0401f7f0,
-- 0x5c002000, 0x0401f7ec, 0x4803c856, 0x1c01f000,
-- 0x4d2c0000, 0x59325808, 0x592c0a04, 0x4807c857,
-- 0x82040d00, 0x000000ff, 0x82040500, 0x0000000f,
-- 0x0c01f001, 0x00100fb5, 0x00100fb5, 0x00100fb5,
-- 0x00100fcd, 0x00100fb5, 0x00100fb5, 0x00100fb5,
-- 0x00100fb5, 0x00100fb5, 0x00100fcd, 0x00100fb5,
-- 0x00100fb7, 0x00100fb5, 0x00100fb5, 0x00100fb5,
-- 0x00100fb5, 0x0201f800, 0x00100615, 0x82040580,
-- 0x0000003b, 0x02020800, 0x00100615, 0x592c020a,
-- 0x8c000500, 0x0400005f, 0x592c1a07, 0x82040500,
-- 0x0000000f, 0x82000400, 0x0010110d, 0x50001000,
-- 0x50080000, 0x59302013, 0x4802600a, 0x492e600b,
-- 0x480a600c, 0x480e600d, 0x48126012, 0x5c025800,
-- 0x1c01f000, 0x82040500, 0x0000000f, 0x82000400,
-- 0x0010110d, 0x50001000, 0x50080000, 0x592c1a07,
-- 0x4802600a, 0x492e600b, 0x480a600c, 0x480e600d,
-- 0x497a6012, 0x0401f7f2, 0x8c040d00, 0x04020041,
-- 0x82040d00, 0x00000080, 0x0400003e, 0x0201f000,
-- 0x000200d0, 0x59300013, 0x59301012, 0x80080580,
-- 0x0402000c, 0x42007800, 0x80000005, 0x592c1208,
-- 0x82080500, 0xffff7fff, 0x48025a08, 0x8c08151e,
-- 0x0402002d, 0x823c7d40, 0x00000020, 0x0401f02a,
-- 0x480bc857, 0x42000000, 0x0010b64f, 0x0201f800,
-- 0x0010a86e, 0x59300414, 0x4803c857, 0x8c000514,
-- 0x04020007, 0x599c1819, 0x8c0c1d12, 0x04020004,
-- 0x820c1d40, 0x00000001, 0x0401f01d, 0x59302013,
-- 0x0401f92d, 0x0402001a, 0x42007800, 0x80000005,
-- 0x5930500d, 0x592c0208, 0x4803c857, 0x8c00051e,
-- 0x04020005, 0x823c7d40, 0x00000020, 0x5930400c,
-- 0x0401f004, 0x8400051e, 0x48025a08, 0x0401f8dc,
-- 0x50201800, 0x480e600a, 0x4832600b, 0x4822600c,
-- 0x482a600d, 0x480fc857, 0x4833c857, 0x4823c857,
-- 0x482bc857, 0x80000580, 0x483e6004, 0x1c01f000,
-- 0x0201f800, 0x00100615, 0x4933c857, 0x4d2c0000,
-- 0x59900004, 0x81300580, 0x02020800, 0x00100615,
-- 0x0201f800, 0x00108df4, 0x02000800, 0x00100615,
-- 0x59325808, 0x4d3c0000, 0x4d400000, 0x59300004,
-- 0x4803c857, 0x4c000000, 0x0201f800, 0x00106b13,
-- 0x0201f800, 0x001068c1, 0x5c000000, 0x8c000516,
-- 0x04000010, 0x592c000f, 0x4803c857, 0x48025807,
-- 0x41780800, 0x42028000, 0x00000002, 0x0201f800,
-- 0x00104bee, 0x4a025c06, 0x0000ffff, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00107698, 0x0401f015,
-- 0x4a026203, 0x00000002, 0x592c0208, 0x8400054e,
-- 0x48025a08, 0x59300406, 0x82000580, 0x00000006,
-- 0x04020009, 0x811800ca, 0x81c80c00, 0x58040939,
-- 0x592c000d, 0x80040480, 0x592c080f, 0x80040480,
-- 0x4802580b, 0x417a7800, 0x0201f800, 0x00108997,
-- 0x5c028000, 0x5c027800, 0x5c025800, 0x1c01f000,
-- 0x4933c857, 0x4d2c0000, 0x59900004, 0x81300580,
-- 0x02020800, 0x00100615, 0x0201f800, 0x00108df4,
-- 0x02000800, 0x00100615, 0x59325808, 0x592c0208,
-- 0x84000540, 0x48025a08, 0x0401f7bf, 0x491bc857,
-- 0x49d3c857, 0x4dd00000, 0x41780800, 0x8007a0ca,
-- 0x83d3a400, 0x00007600, 0x4a03a005, 0x80000002,
-- 0x42000000, 0x00001000, 0x50000000, 0x82000480,
-- 0x24220001, 0x04020029, 0x59d01006, 0x82080500,
-- 0x00006000, 0x82000580, 0x00006000, 0x04000031,
-- 0x82080500, 0x40008000, 0x040007f8, 0x800409c0,
-- 0x0402002c, 0x811a31c0, 0x0400002a, 0x42000000,
-- 0x00001002, 0x50001000, 0x46000000, 0x00000512,
-- 0x42001800, 0x0000000a, 0x59e00000, 0x8c00051a,
-- 0x040207fc, 0x800c1840, 0x040207fc, 0x42000000,
-- 0x00001002, 0x46000000, 0x00000514, 0x42001800,
-- 0x0000000a, 0x59e00000, 0x8c00053a, 0x040207fc,
-- 0x800c1840, 0x040207fc, 0x42000000, 0x00001002,
-- 0x44080000, 0x0401f00f, 0x02004800, 0x000207c8,
-- 0x59d01006, 0x82080500, 0x00006000, 0x82000580,
-- 0x00006000, 0x04000007, 0x8c08151e, 0x040007f7,
-- 0x59d01006, 0x82080500, 0x00006000, 0x040207f3,
-- 0x83d3a400, 0x00000020, 0x80040800, 0x82040480,
-- 0x00000005, 0x040017bd, 0x5c03a000, 0x1c01f000,
-+ 0x4933c857, 0x59b808ea, 0x82040d00, 0x00000007,
-+ 0x82040580, 0x00000000, 0x0400001e, 0x82040580,
-+ 0x00000003, 0x0400001b, 0x59300406, 0x4c000000,
-+ 0x4a026406, 0x00000000, 0x42003000, 0x00000041,
-+ 0x42000000, 0x50000000, 0x41300800, 0x4c180000,
-+ 0x0401fce1, 0x5c003000, 0x0400000b, 0x42000000,
-+ 0x0000001e, 0x80000040, 0x040207ff, 0x80183040,
-+ 0x040207f4, 0x42000000, 0x40000000, 0x41300800,
-+ 0x0401fcd5, 0x5c000000, 0x48026406, 0x1c01f000,
-+ 0x59300007, 0x84000500, 0x48026007, 0x0401f7fc,
-+ 0x59c00007, 0x4a038006, 0x30000000, 0x40000000,
-+ 0x59c00007, 0x8c00050a, 0x040207fe, 0x1c01f000,
-+ 0x5c000000, 0x4c000000, 0x4803c857, 0x4dc00000,
-+ 0x4a0370e8, 0x00000000, 0x42038000, 0x00007720,
-+ 0x0401fff0, 0x42038000, 0x00007700, 0x0401ffed,
-+ 0x0201f800, 0x00104ca6, 0x04020013, 0x4a038891,
-+ 0x0000ffff, 0x497b8880, 0x497b8892, 0x42001000,
-+ 0x00000190, 0x40000000, 0x40000000, 0x80081040,
-+ 0x040207fd, 0x42000000, 0x0010b075, 0x0201f800,
-+ 0x0010a260, 0x0401f80e, 0x5c038000, 0x0201f000,
-+ 0x00104de0, 0x0401f82d, 0x42000000, 0x0010b076,
-+ 0x0201f800, 0x0010a260, 0x0401f805, 0x48178892,
-+ 0x480b8880, 0x5c038000, 0x1c01f000, 0x496fc857,
-+ 0x836c0580, 0x00000003, 0x0402000b, 0x4c080000,
-+ 0x4c0c0000, 0x42001000, 0x00008048, 0x42001800,
-+ 0x0000ffff, 0x0201f800, 0x001036f4, 0x5c001800,
-+ 0x5c001000, 0x42000800, 0x0000003c, 0x0201f800,
-+ 0x00101265, 0x59a80069, 0x80000540, 0x04000006,
-+ 0x59a8106a, 0x800811c0, 0x04000003, 0x0201f800,
-+ 0x001019f7, 0x4a038891, 0x0000ffff, 0x4a03900d,
-+ 0x00000040, 0x0201f800, 0x001008d1, 0x4a0370e8,
-+ 0x00000001, 0x1c01f000, 0x5c000000, 0x4c000000,
-+ 0x4803c857, 0x59c41080, 0x497b8880, 0x59c42892,
-+ 0x497b8892, 0x0201f800, 0x00104ca6, 0x04020002,
-+ 0x1c01f000, 0x42002000, 0x00000260, 0x59c418a4,
-+ 0x820c1d00, 0x0000000f, 0x820c0580, 0x00000000,
-+ 0x04000010, 0x59c41805, 0x820c1d00, 0x00000001,
-+ 0x0402000e, 0x59c418a4, 0x820c1d00, 0x0000000f,
-+ 0x820c0480, 0x00000007, 0x04001004, 0x820c0480,
-+ 0x0000000c, 0x04001003, 0x80102040, 0x040207ec,
-+ 0x497b8891, 0x1c01f000, 0x4c100000, 0x42002000,
-+ 0x00000019, 0x46000000, 0x00000001, 0x0201f800,
-+ 0x00101892, 0x50001800, 0x820c1d00, 0x00000001,
-+ 0x04000005, 0x80102040, 0x040207f7, 0x5c002000,
-+ 0x0401f7f0, 0x5c002000, 0x0401f7ec, 0x4803c856,
-+ 0x1c01f000, 0x4d2c0000, 0x59325808, 0x592c0a04,
-+ 0x4807c857, 0x82040d00, 0x000000ff, 0x82040500,
-+ 0x0000000f, 0x0c01f001, 0x00100eae, 0x00100eae,
-+ 0x00100eae, 0x00100ec6, 0x00100eae, 0x00100eae,
-+ 0x00100eae, 0x00100eae, 0x00100eae, 0x00100ec6,
-+ 0x00100eae, 0x00100eb0, 0x00100eae, 0x00100eae,
-+ 0x00100eae, 0x00100eae, 0x0201f800, 0x001004ef,
-+ 0x82040580, 0x0000003b, 0x02020800, 0x001004ef,
-+ 0x592c020a, 0x8c000500, 0x0400005f, 0x592c1a07,
-+ 0x82040500, 0x0000000f, 0x82000400, 0x00100fd8,
-+ 0x50001000, 0x50080000, 0x59302013, 0x4802600a,
-+ 0x492e600b, 0x480a600c, 0x480e600d, 0x48126012,
-+ 0x5c025800, 0x1c01f000, 0x82040500, 0x0000000f,
-+ 0x82000400, 0x00100fd8, 0x50001000, 0x50080000,
-+ 0x592c1a07, 0x4802600a, 0x492e600b, 0x480a600c,
-+ 0x480e600d, 0x497a6012, 0x0401f7f2, 0x8c040d00,
-+ 0x04020041, 0x82040d00, 0x00000080, 0x0400003e,
-+ 0x0201f000, 0x000200c4, 0x59300013, 0x59301012,
-+ 0x80080580, 0x0402000c, 0x42007800, 0x80000005,
-+ 0x592c1208, 0x82080500, 0xffff7fff, 0x48025a08,
-+ 0x8c08151e, 0x0402002d, 0x823c7d40, 0x00000020,
-+ 0x0401f02a, 0x480bc857, 0x42000000, 0x0010b01f,
-+ 0x0201f800, 0x0010a260, 0x59300414, 0x4803c857,
-+ 0x8c000514, 0x04020007, 0x599c1819, 0x8c0c1d12,
-+ 0x04020004, 0x820c1d40, 0x00000001, 0x0401f01d,
-+ 0x59302013, 0x0401f8ff, 0x0402001a, 0x42007800,
-+ 0x80000005, 0x5930500d, 0x592c0208, 0x4803c857,
-+ 0x8c00051e, 0x04020005, 0x823c7d40, 0x00000020,
-+ 0x5930400c, 0x0401f004, 0x8400051e, 0x48025a08,
-+ 0x0401f8ae, 0x50201800, 0x480e600a, 0x4832600b,
-+ 0x4822600c, 0x482a600d, 0x480fc857, 0x4833c857,
-+ 0x4823c857, 0x482bc857, 0x80000580, 0x483e6004,
-+ 0x1c01f000, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x4d2c0000, 0x59900004, 0x81300580, 0x02020800,
-+ 0x001004ef, 0x0201f800, 0x0010883d, 0x02000800,
-+ 0x001004ef, 0x59325808, 0x4d3c0000, 0x4d400000,
-+ 0x59300004, 0x4803c857, 0x4c000000, 0x0201f800,
-+ 0x00106606, 0x0201f800, 0x001063a4, 0x5c000000,
-+ 0x8c000516, 0x04000010, 0x592c000f, 0x4803c857,
-+ 0x48025807, 0x41780800, 0x42028000, 0x00000002,
-+ 0x0201f800, 0x00104a8e, 0x4a025c06, 0x0000ffff,
-+ 0x0201f800, 0x000202e9, 0x0201f800, 0x0010719c,
-+ 0x0401f015, 0x4a026203, 0x00000002, 0x592c0208,
-+ 0x8400054e, 0x48025a08, 0x59300406, 0x82000580,
-+ 0x00000006, 0x04020009, 0x811800ca, 0x81c80c00,
-+ 0x58040939, 0x592c000d, 0x80040480, 0x592c080f,
-+ 0x80040480, 0x4802580b, 0x417a7800, 0x0201f800,
-+ 0x001083e0, 0x5c028000, 0x5c027800, 0x5c025800,
-+ 0x1c01f000, 0x4933c857, 0x4d2c0000, 0x59900004,
-+ 0x81300580, 0x02020800, 0x001004ef, 0x0201f800,
-+ 0x0010883d, 0x02000800, 0x001004ef, 0x59325808,
-+ 0x592c0208, 0x84000540, 0x48025a08, 0x0401f7bf,
- 0x491bc857, 0x49d3c857, 0x4dd00000, 0x41780800,
- 0x8007a0ca, 0x83d3a400, 0x00007600, 0x4a03a005,
-- 0x80000001, 0x59d00006, 0x83d3a400, 0x00000020,
-- 0x80040800, 0x82040480, 0x00000005, 0x040017f8,
-- 0x5c03a000, 0x1c01f000, 0x59d00006, 0x8c00053e,
-- 0x0400001e, 0x59902804, 0x4817c857, 0x801429c0,
-- 0x04000013, 0x5990000a, 0x5990080b, 0x5990100c,
-- 0x5990180d, 0x4800280a, 0x4804280b, 0x4808280c,
-- 0x480c280d, 0x59d00000, 0x59d00801, 0x59d01002,
-- 0x59d01803, 0x59d02004, 0x4800280e, 0x4804280f,
-- 0x48082810, 0x480c2811, 0x48102812, 0x59900006,
-- 0x82000500, 0xffff0000, 0x48032006, 0x4a03a005,
-- 0x30000000, 0x59d00006, 0x1c01f000, 0x4803c856,
-- 0x80204000, 0x50200000, 0x80000540, 0x04000003,
-- 0x80285040, 0x1c01f000, 0x58300001, 0x80000540,
-- 0x0400000e, 0x4802600b, 0x40006000, 0x58300204,
-- 0x82000500, 0x0000000f, 0x82000400, 0x0010110d,
-- 0x50004000, 0x802041c0, 0x02000800, 0x00100615,
-- 0x80285040, 0x1c01f000, 0x40005000, 0x1c01f000,
-- 0x00000005, 0x00000008, 0x0000000b, 0x0000000e,
-- 0x00000011, 0x00000000, 0x00000000, 0x0000000b,
-- 0x00000000, 0x00000000, 0x00000000, 0x00101108,
-- 0x00101107, 0x00000000, 0x00000000, 0x00000000,
-- 0x00000000, 0x00101108, 0x00101107, 0x00101104,
-- 0x00101108, 0x00101107, 0x00000000, 0x00000000,
-- 0x00000000, 0x00000000, 0x00000000, 0x00101108,
-+ 0x80000002, 0x02004800, 0x000206cf, 0x59d01006,
-+ 0x82080500, 0x00006000, 0x82000580, 0x00006000,
-+ 0x04000007, 0x8c08151e, 0x040007f7, 0x59d01006,
-+ 0x82080500, 0x00006000, 0x040207f3, 0x83d3a400,
-+ 0x00000020, 0x80040800, 0x82040480, 0x00000005,
-+ 0x040017eb, 0x5c03a000, 0x1c01f000, 0x491bc857,
-+ 0x49d3c857, 0x4dd00000, 0x41780800, 0x8007a0ca,
-+ 0x83d3a400, 0x00007600, 0x4a03a005, 0x80000001,
-+ 0x59d00006, 0x83d3a400, 0x00000020, 0x80040800,
-+ 0x82040480, 0x00000005, 0x040017f8, 0x5c03a000,
-+ 0x1c01f000, 0x59d00006, 0x8c00053e, 0x0400001e,
-+ 0x59902804, 0x4817c857, 0x801429c0, 0x04000013,
-+ 0x5990000a, 0x5990080b, 0x5990100c, 0x5990180d,
-+ 0x4800280a, 0x4804280b, 0x4808280c, 0x480c280d,
-+ 0x59d00000, 0x59d00801, 0x59d01002, 0x59d01803,
-+ 0x59d02004, 0x4800280e, 0x4804280f, 0x48082810,
-+ 0x480c2811, 0x48102812, 0x59900006, 0x82000500,
-+ 0xffff0000, 0x48032006, 0x4a03a005, 0x30000000,
-+ 0x59d00006, 0x1c01f000, 0x4803c856, 0x80204000,
-+ 0x50200000, 0x80000540, 0x04000003, 0x80285040,
-+ 0x1c01f000, 0x58300001, 0x80000540, 0x0400000e,
-+ 0x4802600b, 0x40006000, 0x58300204, 0x82000500,
-+ 0x0000000f, 0x82000400, 0x00100fd8, 0x50004000,
-+ 0x802041c0, 0x02000800, 0x001004ef, 0x80285040,
-+ 0x1c01f000, 0x40005000, 0x1c01f000, 0x00000005,
-+ 0x00000008, 0x0000000b, 0x0000000e, 0x00000011,
-+ 0x00000000, 0x00000000, 0x0000000b, 0x00000000,
-+ 0x00000000, 0x00000000, 0x00100fd3, 0x00100fd2,
-+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-+ 0x00100fd3, 0x00100fd2, 0x00100fcf, 0x00100fd3,
-+ 0x00100fd2, 0x00000000, 0x00000000, 0x00000000,
-+ 0x00000000, 0x00000000, 0x00100fd3, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-- 0x00000000, 0x00101108, 0x00101108, 0x00101108,
-- 0x00000000, 0x00101108, 0x00000000, 0x00000000,
-- 0x00000000, 0x4813c857, 0x492fc857, 0x4933c857,
-- 0x48126012, 0x592c5207, 0x802851c0, 0x0400004a,
-- 0x412c6000, 0x0401f84b, 0x04000009, 0x82240580,
-- 0x00000002, 0x04020003, 0x5830000d, 0x80102480,
-- 0x50200000, 0x80004540, 0x0400003f, 0x50200000,
-- 0x80000540, 0x0400000b, 0x80301400, 0x58080002,
-- 0x80102480, 0x0400101e, 0x801021c0, 0x04000009,
-- 0x80285040, 0x04000034, 0x80204000, 0x0401f7f4,
-- 0x58300001, 0x80006540, 0x0400002f, 0x0401f7e6,
-- 0x80285040, 0x0400002c, 0x80204000, 0x50200000,
-- 0x80000540, 0x0402000a, 0x58300001, 0x80006540,
-- 0x04000025, 0x58300204, 0x82004d00, 0x0000000f,
-- 0x82244400, 0x0010110d, 0x50204000, 0x592c0208,
-- 0x8400051e, 0x48025a08, 0x0401f013, 0x80102080,
-- 0x80102000, 0x48126010, 0x4813c857, 0x58080802,
-- 0x40100000, 0x80042480, 0x02001800, 0x00100615,
-- 0x58080000, 0x58081801, 0x80102400, 0x4812600e,
-- 0x480e600f, 0x4813c857, 0x592c0208, 0x8400055e,
-- 0x48025a08, 0x4833c857, 0x4823c857, 0x482bc857,
-- 0x4832600b, 0x4822600c, 0x482a600d, 0x80000580,
-- 0x0401f003, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x00100fd3, 0x00100fd3, 0x00100fd3, 0x00000000,
-+ 0x00100fd3, 0x00000000, 0x00000000, 0x00000000,
-+ 0x4813c857, 0x492fc857, 0x4933c857, 0x48126012,
-+ 0x592c5207, 0x802851c0, 0x0400004a, 0x412c6000,
-+ 0x0401f84b, 0x04000009, 0x82240580, 0x00000002,
-+ 0x04020003, 0x5830000d, 0x80102480, 0x50200000,
-+ 0x80004540, 0x0400003f, 0x50200000, 0x80000540,
-+ 0x0400000b, 0x80301400, 0x58080002, 0x80102480,
-+ 0x0400101e, 0x801021c0, 0x04000009, 0x80285040,
-+ 0x04000034, 0x80204000, 0x0401f7f4, 0x58300001,
-+ 0x80006540, 0x0400002f, 0x0401f7e6, 0x80285040,
-+ 0x0400002c, 0x80204000, 0x50200000, 0x80000540,
-+ 0x0402000a, 0x58300001, 0x80006540, 0x04000025,
- 0x58300204, 0x82004d00, 0x0000000f, 0x82244400,
-- 0x0010110d, 0x82000500, 0x000000ff, 0x82000580,
-- 0x00000029, 0x0402001b, 0x50204000, 0x592c0409,
-- 0x80000540, 0x02000800, 0x00100615, 0x82000c80,
-- 0x00000002, 0x04001011, 0x58300001, 0x80006540,
-- 0x02000800, 0x00100615, 0x58300204, 0x82000500,
-- 0x0000000f, 0x82000400, 0x0010110d, 0x50004000,
-- 0x40040000, 0x800409c0, 0x04000006, 0x82040c80,
-- 0x00000005, 0x040217f1, 0x80204400, 0x80000580,
-- 0x1c01f000, 0x59e00004, 0x8c00050e, 0x02020000,
-- 0x00100951, 0x1c01f000, 0x4c5c0000, 0x59e4b800,
-- 0x485fc857, 0x825c0500, 0x0000001f, 0x04000004,
-- 0x59e40862, 0x0201f800, 0x00100615, 0x825c0500,
-- 0x000000e0, 0x02000800, 0x00100615, 0x8c5cbd0e,
-- 0x04020807, 0x8c5cbd0c, 0x04020809, 0x8c5cbd0a,
-- 0x04020878, 0x5c00b800, 0x1c01f000, 0x4803c856,
-- 0x4a03c800, 0x00000080, 0x1c01f000, 0x4d2c0000,
-- 0x42007800, 0x0010b6eb, 0x583c0001, 0x583c0802,
-- 0x80040540, 0x0400003f, 0x42000800, 0x0010b5f5,
-- 0x50065800, 0x592c0002, 0x82000580, 0x00000000,
-- 0x0400000e, 0x59e40850, 0x59e41853, 0x400c0000,
-- 0x80040400, 0x59e40852, 0x4807c857, 0x80041480,
-- 0x04021008, 0x40001000, 0x480bc857, 0x4a007800,
-- 0x00000001, 0x0401f006, 0x4803c857, 0x0401f029,
-- 0x59e41050, 0x480bc857, 0x49787800, 0x480bc857,
-- 0x480fc857, 0x592c0003, 0x80000540, 0x04000006,
-- 0x80080580, 0x04020004, 0x592c0003, 0x4803c857,
-- 0x480bc857, 0x480a5803, 0x592c0007, 0x800001c0,
-- 0x04000007, 0x592c1007, 0x480bc857, 0x583c0003,
-- 0x4803c857, 0x80080480, 0x04001003, 0x583c1001,
-- 0x480bc857, 0x583c0802, 0x480bc857, 0x4807c857,
-- 0x4a025801, 0x00000000, 0x4a025809, 0x0010120c,
-- 0x480a5807, 0x48065808, 0x59e40053, 0x48025804,
-- 0x412c1000, 0x492fc857, 0x0201f800, 0x001008a1,
-+ 0x00100fd8, 0x50204000, 0x592c0208, 0x8400051e,
-+ 0x48025a08, 0x0401f013, 0x80102080, 0x80102000,
-+ 0x48126010, 0x4813c857, 0x58080802, 0x40100000,
-+ 0x80042480, 0x02001800, 0x001004ef, 0x58080000,
-+ 0x58081801, 0x80102400, 0x4812600e, 0x480e600f,
-+ 0x4813c857, 0x592c0208, 0x8400055e, 0x48025a08,
-+ 0x4833c857, 0x4823c857, 0x482bc857, 0x4832600b,
-+ 0x4822600c, 0x482a600d, 0x80000580, 0x0401f003,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x58300204,
-+ 0x82004d00, 0x0000000f, 0x82244400, 0x00100fd8,
-+ 0x82000500, 0x000000ff, 0x82000580, 0x00000029,
-+ 0x0402001b, 0x50204000, 0x592c0409, 0x80000540,
-+ 0x02000800, 0x001004ef, 0x82000c80, 0x00000002,
-+ 0x04001011, 0x58300001, 0x80006540, 0x02000800,
-+ 0x001004ef, 0x58300204, 0x82000500, 0x0000000f,
-+ 0x82000400, 0x00100fd8, 0x50004000, 0x40040000,
-+ 0x800409c0, 0x04000006, 0x82040c80, 0x00000005,
-+ 0x040217f1, 0x80204400, 0x80000580, 0x1c01f000,
-+ 0x59e00004, 0x8c00050e, 0x02020000, 0x0010084c,
-+ 0x1c01f000, 0x4c5c0000, 0x59e4b800, 0x485fc857,
-+ 0x825c0500, 0x0000001f, 0x04000004, 0x59e40862,
-+ 0x0201f800, 0x001004ef, 0x825c0500, 0x000000e0,
-+ 0x02000800, 0x001004ef, 0x8c5cbd0e, 0x04020807,
-+ 0x8c5cbd0c, 0x04020809, 0x8c5cbd0a, 0x04020879,
-+ 0x5c00b800, 0x1c01f000, 0x4803c856, 0x4a03c800,
-+ 0x00000080, 0x1c01f000, 0x4d2c0000, 0x42007800,
-+ 0x0010b0bb, 0x583c0001, 0x583c0802, 0x80040540,
-+ 0x04000040, 0x42000800, 0x0010afc5, 0x50065800,
-+ 0x592c0002, 0x82000580, 0x00000000, 0x0400000e,
-+ 0x59e40850, 0x59e41853, 0x400c0000, 0x80040400,
-+ 0x59e40852, 0x4807c857, 0x80041480, 0x04021008,
-+ 0x40001000, 0x480bc857, 0x4a007800, 0x00000001,
-+ 0x0401f006, 0x4803c857, 0x0401f02a, 0x59e41050,
-+ 0x480bc857, 0x49787800, 0x480bc857, 0x480fc857,
-+ 0x592c0003, 0x80000540, 0x04000006, 0x80080580,
-+ 0x04020004, 0x592c0003, 0x4803c857, 0x480bc857,
-+ 0x480a5803, 0x592c0007, 0x800001c0, 0x04000007,
-+ 0x592c1007, 0x480bc857, 0x583c0003, 0x4803c857,
-+ 0x80080480, 0x04001003, 0x583c1001, 0x480bc857,
-+ 0x583c0802, 0x480bc857, 0x4807c857, 0x4a025801,
-+ 0x00000000, 0x4a025809, 0x001010d8, 0x480a5807,
-+ 0x48065808, 0x59e40053, 0x800000c4, 0x48025805,
-+ 0x412c1000, 0x492fc857, 0x0201f800, 0x0010079e,
- 0x5c025800, 0x4a03c800, 0x00000040, 0x1c01f000,
-- 0x42007800, 0x0010b5f5, 0x503c7800, 0x4a007802,
-- 0x00000100, 0x42007800, 0x0010b6eb, 0x583c0000,
-+ 0x42007800, 0x0010afc5, 0x503c7800, 0x4a007802,
-+ 0x00000100, 0x42007800, 0x0010b0bb, 0x583c0000,
- 0x4803c857, 0x82000d80, 0x00000001, 0x04000004,
- 0x80000000, 0x48007800, 0x0401f019, 0x49787800,
- 0x583c1806, 0x583c0005, 0x800c1800, 0x480c7806,
-@@ -1216,124 +1126,125 @@ uint32_t risc_code01[] = {
- 0x800409c0, 0x0400000e, 0x583c0008, 0x80000000,
- 0x48007808, 0x80040580, 0x04020009, 0x49787808,
- 0x583c2006, 0x42001800, 0x00000001, 0x42001000,
-- 0x00008028, 0x0201f800, 0x00103857, 0x1c01f000,
-- 0x4a03c800, 0x00000020, 0x0201f800, 0x0010a867,
-+ 0x00008028, 0x0201f800, 0x001036f4, 0x1c01f000,
-+ 0x4a03c800, 0x00000020, 0x0201f800, 0x0010a258,
- 0x59e40000, 0x1c01f000, 0x4d2c0000, 0x4a007001,
- 0x00000000, 0x82040d00, 0x43000f80, 0x02020800,
-- 0x00100615, 0x58380009, 0x4803c00f, 0x0201f800,
-- 0x001091cb, 0x583a5808, 0x592c0000, 0x48007008,
-+ 0x001004ef, 0x58380009, 0x4803c00f, 0x0201f800,
-+ 0x00108c47, 0x583a5808, 0x592c0000, 0x48007008,
- 0x800001c0, 0x04020002, 0x49787007, 0x0201f800,
-- 0x0010083a, 0x5c025800, 0x0201f000, 0x001008c6,
-+ 0x0010072e, 0x5c025800, 0x0201f000, 0x001007c3,
- 0x4803c856, 0x4c3c0000, 0x4d2c0000, 0x4d300000,
-- 0x5830000a, 0x80025d40, 0x02000800, 0x00100615,
-- 0x592e6008, 0x4c300000, 0x0201f800, 0x001091e3,
-- 0x5c006000, 0x02000800, 0x00100615, 0x58300002,
-+ 0x5830000a, 0x80025d40, 0x02000800, 0x001004ef,
-+ 0x592e6008, 0x4c300000, 0x0201f800, 0x00108c60,
-+ 0x5c006000, 0x02000800, 0x001004ef, 0x58300002,
- 0x82000580, 0x00000100, 0x04020010, 0x5930780b,
- 0x583c0001, 0x80000540, 0x0400000e, 0x4802600b,
- 0x40007800, 0x82000400, 0x00000002, 0x48006003,
-- 0x583c0000, 0x48006004, 0x40301000, 0x0201f800,
-- 0x001008a1, 0x0401f00c, 0x4a025a06, 0x00000002,
-- 0x4c300000, 0x0201f800, 0x00020381, 0x5c006000,
-- 0x40325800, 0x0201f800, 0x0010083a, 0x0201f800,
-- 0x000208b4, 0x5c026000, 0x5c025800, 0x5c007800,
-+ 0x583c0000, 0x48006005, 0x40301000, 0x0201f800,
-+ 0x0010079e, 0x0401f00c, 0x4a025a06, 0x00000002,
-+ 0x4c300000, 0x0201f800, 0x000202e9, 0x5c006000,
-+ 0x40325800, 0x0201f800, 0x0010072e, 0x0201f800,
-+ 0x000207bb, 0x5c026000, 0x5c025800, 0x5c007800,
- 0x1c01f000, 0x4803c856, 0x4d2c0000, 0x4d300000,
-- 0x42007000, 0x0010b5f6, 0x58380801, 0x82040580,
-+ 0x42007000, 0x0010afc6, 0x58380801, 0x82040580,
- 0x00000002, 0x04020011, 0x58386002, 0x5830000a,
- 0x812c0580, 0x0402000d, 0x59e00004, 0x8c00050e,
- 0x040007fe, 0x59dc0006, 0x4803c857, 0x4a03b805,
- 0x20000000, 0x8c00053e, 0x040007f8, 0x4a007001,
- 0x00000000, 0x0401f019, 0x58386006, 0x40305000,
-- 0x803061c0, 0x02000800, 0x00100615, 0x5830000a,
-+ 0x803061c0, 0x02000800, 0x001004ef, 0x5830000a,
- 0x812c0580, 0x04000004, 0x40305000, 0x58306000,
- 0x0401f7f8, 0x40280000, 0x80300580, 0x58300000,
- 0x04000006, 0x48005000, 0x800001c0, 0x04020007,
- 0x48287005, 0x0401f005, 0x800001c0, 0x04020002,
- 0x48007005, 0x48007006, 0x40325800, 0x0201f800,
-- 0x0010083a, 0x42007000, 0x0010b5f6, 0x58380001,
-- 0x82000580, 0x00000000, 0x02000800, 0x001008c6,
-+ 0x0010072e, 0x42007000, 0x0010afc6, 0x58380001,
-+ 0x82000580, 0x00000000, 0x02000800, 0x001007c3,
- 0x5c026000, 0x5c025800, 0x1c01f000, 0x4803c856,
- 0x42000800, 0x0000003c, 0x48079000, 0x59c80000,
- 0x80040500, 0x040207fe, 0x497b9005, 0x4a039035,
-- 0x00880200, 0x59a8000e, 0x800000e0, 0x4803900e,
-- 0x4a039011, 0x00000024, 0x4a03900f, 0x0010cfc0,
-- 0x4a039010, 0x0010cfc0, 0x4a039015, 0x0000007f,
-+ 0x00880200, 0x59a8000d, 0x800000e0, 0x4803900e,
-+ 0x4a039011, 0x00000024, 0x4a03900f, 0x0010d8d4,
-+ 0x4a039010, 0x0010d8d4, 0x4a039015, 0x0000007f,
- 0x4a03900d, 0x00000040, 0x4a039000, 0x00001600,
-- 0x1c01f000, 0x59c80007, 0x8c000508, 0x040208b7,
-+ 0x1c01f000, 0x59c80007, 0x8c000508, 0x040208ba,
- 0x59c80800, 0x8c040d16, 0x04020004, 0x82000500,
- 0x00000006, 0x0c01f005, 0x4807c857, 0x82000500,
-- 0x0000000e, 0x0c01f001, 0x001012f8, 0x001012f6,
-- 0x0010567d, 0x001012f6, 0x001012fa, 0x001012f6,
-- 0x001012fa, 0x001012fa, 0x001012f6, 0x001012f6,
-- 0x001012f6, 0x001012f6, 0x001012fa, 0x001012f6,
-- 0x001012fa, 0x001012f6, 0x0201f800, 0x00100615,
-+ 0x0000000e, 0x0c01f001, 0x001011c4, 0x001011c2,
-+ 0x00105512, 0x001011c2, 0x001011c6, 0x001011c2,
-+ 0x001011c6, 0x001011c6, 0x001011c2, 0x001011c2,
-+ 0x001011c2, 0x001011c2, 0x001011c6, 0x001011c2,
-+ 0x001011c6, 0x001011c2, 0x0201f800, 0x001004ef,
- 0x4803c857, 0x1c01f000, 0x59c8080c, 0x4807c857,
- 0x82040500, 0x00006000, 0x04000004, 0x0201f800,
-- 0x0010a82a, 0x0401f006, 0x82040500, 0x007f0000,
-- 0x04000006, 0x0201f800, 0x0010a7fc, 0x0201f800,
-- 0x00106c07, 0x0401f02b, 0x82040500, 0x00000014,
-- 0x04000014, 0x0201f800, 0x0010a859, 0x836c0580,
-- 0x00000003, 0x0400000d, 0x0201f800, 0x00104e0d,
-- 0x04000004, 0x0201f800, 0x00103f37, 0x0401f007,
-- 0x4a035033, 0x00000001, 0x4202d800, 0x00000001,
-- 0x0201f800, 0x00104d76, 0x0401f817, 0x0401f015,
-+ 0x0010a21b, 0x0401f006, 0x82040500, 0x007f0000,
-+ 0x04000006, 0x0201f800, 0x0010a1ed, 0x0201f800,
-+ 0x001066fa, 0x0401f02b, 0x82040500, 0x00000014,
-+ 0x04000014, 0x0201f800, 0x0010a24a, 0x836c0580,
-+ 0x00000003, 0x0400000d, 0x0201f800, 0x00104ca6,
-+ 0x04000004, 0x0201f800, 0x00103dcb, 0x0401f007,
-+ 0x4a035030, 0x00000001, 0x4202d800, 0x00000001,
-+ 0x0201f800, 0x00104c16, 0x0401f817, 0x0401f015,
- 0x82040500, 0x00001c00, 0x04000005, 0x0201f800,
-- 0x0010a838, 0x0401f810, 0x0401f00e, 0x82040500,
-- 0x00000140, 0x04000005, 0x0201f800, 0x0010a84b,
-+ 0x0010a229, 0x0401f810, 0x0401f00e, 0x82040500,
-+ 0x00000140, 0x04000005, 0x0201f800, 0x0010a23c,
- 0x0401f809, 0x0401f007, 0x82040500, 0x00008000,
-- 0x04000004, 0x0201f800, 0x0010a823, 0x0401f802,
-+ 0x04000004, 0x0201f800, 0x0010a214, 0x0401f802,
- 0x1c01f000, 0x4c0c0000, 0x4c100000, 0x4c140000,
-- 0x0201f800, 0x00100f17, 0x5c002800, 0x5c002000,
-- 0x5c001800, 0x1c01f000, 0x4803c856, 0x59a80804,
-- 0x59a8002b, 0x82000500, 0xfffff000, 0x80040540,
-- 0x4803502b, 0x59a8002f, 0x82000500, 0xfffff000,
-- 0x80040540, 0x4803502f, 0x48078882, 0x82041c00,
-- 0x0000000f, 0x800c1908, 0x820c1c00, 0x00000004,
-- 0x400c2000, 0x901029c0, 0x82040480, 0x000001e4,
-- 0x04021005, 0x42001000, 0x00000008, 0x801020c6,
-- 0x0401f031, 0x82040480, 0x00000230, 0x04021009,
-- 0x42001000, 0x00000007, 0x801000c2, 0x800000c2,
-- 0x80100400, 0x80100400, 0x80102400, 0x0401f026,
-- 0x82040480, 0x00000298, 0x04021008, 0x42001000,
-- 0x00000006, 0x801000c2, 0x800000c2, 0x80100400,
-- 0x80102400, 0x0401f01c, 0x82040480, 0x00000328,
-- 0x04021007, 0x42001000, 0x00000005, 0x801000c2,
-- 0x800000c2, 0x80102400, 0x0401f013, 0x82040480,
-- 0x00000404, 0x04021005, 0x42001000, 0x00000004,
-- 0x801020c4, 0x0401f00c, 0x82040480, 0x0000056c,
-- 0x04021006, 0x42001000, 0x00000003, 0x801000c2,
-- 0x80102400, 0x0401f004, 0x42001000, 0x00000002,
-- 0x801020c2, 0x82100480, 0x00000110, 0x80000080,
-- 0x80002000, 0x800800d0, 0x80140540, 0x80100540,
-- 0x48039035, 0x1c01f000, 0x59c80815, 0x0201f800,
-- 0x0010060d, 0x82040d00, 0x0000007c, 0x48079000,
-+ 0x0401fc0c, 0x5c002800, 0x5c002000, 0x5c001800,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4803c856, 0x59a80804, 0x59a80028,
-+ 0x82000500, 0xfffff000, 0x80040540, 0x48035028,
-+ 0x59a8002c, 0x82000500, 0xfffff000, 0x80040540,
-+ 0x4803502c, 0x48078882, 0x82041c00, 0x0000000f,
-+ 0x800c1908, 0x820c1c00, 0x00000004, 0x400c2000,
-+ 0x901029c0, 0x82040480, 0x000001e4, 0x04021005,
-+ 0x42001000, 0x00000008, 0x801020c6, 0x0401f031,
-+ 0x82040480, 0x00000230, 0x04021009, 0x42001000,
-+ 0x00000007, 0x801000c2, 0x800000c2, 0x80100400,
-+ 0x80100400, 0x80102400, 0x0401f026, 0x82040480,
-+ 0x00000298, 0x04021008, 0x42001000, 0x00000006,
-+ 0x801000c2, 0x800000c2, 0x80100400, 0x80102400,
-+ 0x0401f01c, 0x82040480, 0x00000328, 0x04021007,
-+ 0x42001000, 0x00000005, 0x801000c2, 0x800000c2,
-+ 0x80102400, 0x0401f013, 0x82040480, 0x00000404,
-+ 0x04021005, 0x42001000, 0x00000004, 0x801020c4,
-+ 0x0401f00c, 0x82040480, 0x0000056c, 0x04021006,
-+ 0x42001000, 0x00000003, 0x801000c2, 0x80102400,
-+ 0x0401f004, 0x42001000, 0x00000002, 0x801020c2,
-+ 0x82100480, 0x00000110, 0x80000080, 0x80002000,
-+ 0x800800d0, 0x80140540, 0x80100540, 0x48039035,
-+ 0x1c01f000, 0x59c80815, 0x0201f800, 0x001004e4,
-+ 0x40680800, 0x82040d00, 0x0000007c, 0x48079000,
- 0x59c80000, 0x80040500, 0x040207fe, 0x8c040d04,
- 0x04000003, 0x59c80035, 0x48039035, 0x59c80000,
- 0x82000540, 0x00001200, 0x48039000, 0x1c01f000,
- 0x4803c856, 0x497b88a9, 0x4a038807, 0x00000001,
- 0x497b8807, 0x59c40005, 0x48038805, 0x0201f800,
-- 0x00101886, 0x4201d000, 0x000001f4, 0x0201f800,
-- 0x00105dd2, 0x497b880e, 0x4200b000, 0x000001f4,
-+ 0x0010177f, 0x4201d000, 0x000001f4, 0x0201f800,
-+ 0x00105c78, 0x497b880e, 0x4200b000, 0x000001f4,
- 0x42000000, 0x00000001, 0x42000800, 0x00000014,
-- 0x0201f800, 0x001019b1, 0x42000800, 0x00000014,
-- 0x0201f800, 0x001019ac, 0x8c040d00, 0x04000005,
-- 0x8058b040, 0x040207f3, 0x0201f800, 0x00100615,
-+ 0x0201f800, 0x001018a5, 0x42000800, 0x00000014,
-+ 0x0201f800, 0x00101899, 0x8c040d00, 0x04000005,
-+ 0x8058b040, 0x040207f3, 0x0201f800, 0x001004ef,
- 0x4200b000, 0x00000032, 0x42000000, 0x00000001,
-- 0x42000800, 0x000000b4, 0x0201f800, 0x001019b1,
-- 0x42000800, 0x000000b4, 0x0201f800, 0x001019ac,
-+ 0x42000800, 0x000000b4, 0x0201f800, 0x001018a5,
-+ 0x42000800, 0x000000b4, 0x0201f800, 0x00101899,
- 0x8c040d00, 0x04000005, 0x8058b040, 0x040207f3,
-- 0x0201f800, 0x00100615, 0x59c40005, 0x48038805,
-- 0x42000000, 0x00000089, 0x800008d0, 0x48075054,
-- 0x48075055, 0x48075056, 0x42000800, 0x000000e0,
-- 0x0201f800, 0x001019b1, 0x42000800, 0x000000f4,
-- 0x0201f800, 0x001019ac, 0x82040500, 0xffffffd1,
-+ 0x0201f800, 0x001004ef, 0x59c40005, 0x48038805,
-+ 0x42000000, 0x00000089, 0x800008d0, 0x48075051,
-+ 0x48075052, 0x48075053, 0x42000800, 0x000000e0,
-+ 0x0201f800, 0x001018a5, 0x42000800, 0x000000f4,
-+ 0x0201f800, 0x00101899, 0x82040500, 0xffffffd1,
- 0x82000540, 0x00000002, 0x42000800, 0x000000f4,
-- 0x0201f800, 0x001019b1, 0x42000800, 0x000000a0,
-- 0x0201f800, 0x001019ac, 0x82040540, 0x00000001,
-- 0x42000800, 0x000000a0, 0x0201f800, 0x001019b1,
-- 0x42000800, 0x00000000, 0x0201f800, 0x001019ac,
-+ 0x0201f800, 0x001018a5, 0x42000800, 0x000000a0,
-+ 0x0201f800, 0x00101899, 0x82040540, 0x00000001,
-+ 0x42000800, 0x000000a0, 0x0201f800, 0x001018a5,
-+ 0x42000800, 0x00000000, 0x0201f800, 0x00101899,
- 0x82040540, 0x00000001, 0x42000800, 0x00000000,
-- 0x0201f800, 0x001019b1, 0x4201d000, 0x0001d4c0,
-- 0x0201f800, 0x00105dd2, 0x0401fa45, 0x4a0388a7,
-+ 0x0201f800, 0x001018a5, 0x4201d000, 0x0001d4c0,
-+ 0x0201f800, 0x00105c78, 0x0401fa3e, 0x4a0388a7,
- 0x0000f7f7, 0x4a0388a3, 0x8000403c, 0x4a0388ae,
- 0x000061a8, 0x4a038801, 0x00032063, 0x4a038810,
- 0x00410108, 0x4a038811, 0x00520608, 0x4a038812,
-@@ -1344,358 +1255,367 @@ uint32_t risc_code01[] = {
- 0x00800000, 0x4a038852, 0x80000708, 0x4a038862,
- 0x00800000, 0x4a038872, 0x00800000, 0x4a038853,
- 0x80000608, 0x497b8863, 0x4a038873, 0x00800000,
-- 0x4a038882, 0x00000840, 0x4a0388a5, 0x0000001e,
-+ 0x4a038882, 0x00000840, 0x4a0388a5, 0x000000ff,
- 0x4a0388a6, 0x0000001e, 0x4a0388b0, 0x00007530,
- 0x4a038802, 0x0000ffff, 0x4a038806, 0xc0e00800,
-- 0x1c01f000, 0x497b5022, 0x4a035021, 0x00000001,
-- 0x42000800, 0x00000040, 0x0201f800, 0x001019ac,
-- 0x82040500, 0xffffffaf, 0x82000540, 0x00000000,
-- 0x42000800, 0x00000040, 0x0201f800, 0x001019b1,
-- 0x42000800, 0x000000f4, 0x0201f800, 0x001019ac,
-- 0x4c040000, 0x40040000, 0x84000548, 0x42000800,
-- 0x000000f4, 0x0201f800, 0x001019b1, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019ac, 0x82040500,
-- 0xffffffc1, 0x82000540, 0x00000038, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019b1, 0x5c000000,
-- 0x42000800, 0x000000f4, 0x0201f000, 0x001019b1,
-- 0x59c40805, 0x59c40006, 0x80040d00, 0x02000800,
-- 0x00100615, 0x82040500, 0x00e00800, 0x04020004,
-- 0x8c040d3e, 0x040208df, 0x0401f007, 0x82040500,
-- 0x00800800, 0x02020800, 0x0010060d, 0x0201f800,
-- 0x00100615, 0x4c5c0000, 0x4c600000, 0x59c4b805,
-- 0x59c40006, 0x8c000500, 0x04000003, 0x8c5cbd00,
-- 0x04020095, 0x485fc857, 0x0201f800, 0x00104e0d,
-- 0x0400001e, 0x59c40005, 0x82000500, 0x000000c0,
-- 0x0400004b, 0x0201f800, 0x00104e23, 0x04020048,
-- 0x59c40006, 0x82000500, 0x000000f0, 0x04020004,
-- 0x4a038805, 0x000000c0, 0x0401f041, 0x59a80015,
-- 0x84000506, 0x48035015, 0x42006000, 0xff203fff,
-- 0x42006800, 0x40000000, 0x0201f800, 0x001040ad,
-- 0x42000800, 0x00000010, 0x42001000, 0x00104020,
-- 0x0201f800, 0x00105dc7, 0x8c5cbd34, 0x04020030,
-- 0x4a035032, 0x0000aaaa, 0x59c40005, 0x8c00050c,
-- 0x04020012, 0x8c00050e, 0x0402001c, 0x8c00050a,
-- 0x0402001d, 0x8c000508, 0x0400000b, 0x59a80017,
-- 0x82000580, 0x00000009, 0x04020007, 0x42000000,
-- 0x0010b642, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x00104fe9, 0x0401f05a, 0x0201f800, 0x00104e23,
-- 0x04020007, 0x42000800, 0x0000000f, 0x42001000,
-- 0x00103f37, 0x0201f800, 0x00105da7, 0x4a035033,
-- 0x00000000, 0x0401f00b, 0x4a035033, 0x00000002,
-- 0x0401f008, 0x42000000, 0x0010b644, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00104f93, 0x0401f044,
-- 0x0201f800, 0x00105049, 0x0401f041, 0x8c5cbd34,
-- 0x0400003d, 0x59c40005, 0x8c00053a, 0x04020005,
-- 0x42000000, 0x0010b616, 0x0201f800, 0x0010a86e,
-- 0x4a038805, 0x02000000, 0x0201f800, 0x00104e0d,
-- 0x04020010, 0x4a038805, 0x04000000, 0x0201f800,
-- 0x00104e1b, 0x04020008, 0x4a035033, 0x00000001,
-- 0x4202d800, 0x00000001, 0x0201f800, 0x00104d76,
-- 0x0401f061, 0x41780000, 0x0201f800, 0x00104de5,
-- 0x0201f800, 0x00101a59, 0x4000c000, 0x0201f800,
-- 0x001019d0, 0x836c1580, 0x00000004, 0x0402000d,
-- 0x8c5cbd00, 0x04020018, 0x59a81005, 0x8c081506,
-+ 0x1c01f000, 0x850e1d4e, 0x42000800, 0x00000040,
-+ 0x0201f800, 0x00101899, 0x82040500, 0xffffffaf,
-+ 0x82000540, 0x00000000, 0x42000800, 0x00000040,
-+ 0x0201f800, 0x001018a5, 0x42000800, 0x000000f4,
-+ 0x0201f800, 0x00101899, 0x4c040000, 0x40040000,
-+ 0x84000548, 0x42000800, 0x000000f4, 0x0201f800,
-+ 0x001018a5, 0x42000800, 0x00000000, 0x0201f800,
-+ 0x00101899, 0x82040500, 0xffffffc1, 0x82000540,
-+ 0x00000038, 0x42000800, 0x00000000, 0x0201f800,
-+ 0x001018a5, 0x5c000000, 0x42000800, 0x000000f4,
-+ 0x0201f000, 0x001018a5, 0x59c40805, 0x59c40006,
-+ 0x80040d00, 0x02000800, 0x001004ef, 0x82040500,
-+ 0x00e00800, 0x04020004, 0x8c040d3e, 0x040208d5,
-+ 0x0401f007, 0x82040500, 0x00800800, 0x02020800,
-+ 0x001004e4, 0x0201f800, 0x001004ef, 0x4c5c0000,
-+ 0x4c600000, 0x59c4b805, 0x59c40006, 0x8c000500,
-+ 0x04000003, 0x8c5cbd00, 0x0402008b, 0x485fc857,
-+ 0x0201f800, 0x00104ca6, 0x0400001e, 0x59c40005,
-+ 0x82000500, 0x000000c0, 0x04000042, 0x0201f800,
-+ 0x00104ce4, 0x0402003f, 0x59c40006, 0x82000500,
-+ 0x000000f0, 0x04020004, 0x4a038805, 0x000000c0,
-+ 0x0401f038, 0x59a80014, 0x84000506, 0x48035014,
-+ 0x42006000, 0xff203fff, 0x42006800, 0x40000000,
-+ 0x0201f800, 0x00103f44, 0x42000800, 0x00000010,
-+ 0x42001000, 0x00103eb0, 0x0201f800, 0x00105c6d,
-+ 0x8c5cbd34, 0x04020027, 0x4a03502f, 0x0000aaaa,
-+ 0x59c40005, 0x8c00050c, 0x04020012, 0x8c00050e,
-+ 0x04020013, 0x8c00050a, 0x04020014, 0x8c000508,
-+ 0x0400000b, 0x59a80016, 0x82000580, 0x00000009,
-+ 0x04020007, 0x42000000, 0x0010b012, 0x0201f800,
-+ 0x0010a260, 0x0201f800, 0x00104ea0, 0x0401f050,
-+ 0x4a035030, 0x00000000, 0x0401f00b, 0x4a035030,
-+ 0x00000002, 0x0401f008, 0x42000000, 0x0010b014,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x00104e4a,
-+ 0x0401f043, 0x0201f800, 0x00104efc, 0x0401f040,
-+ 0x8c5cbd34, 0x0400003c, 0x59c40005, 0x8c00053a,
-+ 0x04020005, 0x42000000, 0x0010afe6, 0x0201f800,
-+ 0x0010a260, 0x4a038805, 0x02000000, 0x0201f800,
-+ 0x00104ca6, 0x04020010, 0x4a038805, 0x04000000,
-+ 0x0201f800, 0x00104cd3, 0x04020008, 0x4a035030,
-+ 0x00000001, 0x4202d800, 0x00000001, 0x0201f800,
-+ 0x00104c16, 0x0401f060, 0x41780000, 0x0201f800,
-+ 0x00104c7e, 0x0201f800, 0x00101946, 0x4000c000,
-+ 0x0201f800, 0x001018c4, 0x836c1580, 0x00000004,
-+ 0x0402000c, 0x8c5cbd00, 0x04020017, 0x8d0e1d06,
- 0x04020005, 0x59c410a3, 0x82081540, 0x00000008,
- 0x480b88a3, 0x59c41006, 0x84081540, 0x480b8806,
- 0x4a038805, 0x04000000, 0x4202d800, 0x00000001,
-- 0x497b5014, 0x59a80005, 0x8c000518, 0x04020004,
-- 0x0401f95c, 0x0201f800, 0x00103f5c, 0x0201f800,
-- 0x00103951, 0x8c5cbd3c, 0x04020858, 0x8c5cbd00,
-- 0x04000036, 0x42000000, 0x0010b6c9, 0x0201f800,
-- 0x0010a86e, 0x4a038805, 0x00000001, 0x4200b000,
-+ 0x497b5013, 0x8d0e1d18, 0x04020005, 0x4803c856,
-+ 0x850e1d06, 0x0201f800, 0x00103dec, 0x0201f800,
-+ 0x001037ea, 0x8c5cbd3c, 0x04020858, 0x8c5cbd00,
-+ 0x04000036, 0x42000000, 0x0010b099, 0x0201f800,
-+ 0x0010a260, 0x4a038805, 0x00000001, 0x4200b000,
- 0x00000352, 0x4201d000, 0x00000064, 0x4c580000,
-- 0x0201f800, 0x00105dd2, 0x0201f800, 0x00101941,
-+ 0x0201f800, 0x00105c78, 0x0201f800, 0x0010184d,
- 0x5c00b000, 0x04000004, 0x8058b040, 0x040207f6,
- 0x0401f004, 0x4a038805, 0x00000001, 0x0401f01f,
- 0x59c40006, 0x84000500, 0x48038806, 0x0201f800,
-- 0x00106c32, 0x497b8880, 0x0201f800, 0x0010a7e7,
-- 0x59c4000d, 0x8c000500, 0x02020800, 0x0010a7f5,
-+ 0x00106725, 0x497b8880, 0x0201f800, 0x0010a1d8,
-+ 0x59c4000d, 0x8c000500, 0x02020800, 0x0010a1e6,
- 0x59c400a3, 0x82000500, 0xfcf8ffff, 0x480388a3,
-- 0x4a03504c, 0x00000002, 0x4202d800, 0x00000004,
-- 0x4a038805, 0x00000001, 0x0201f800, 0x0010071a,
-- 0x0401fb42, 0x497b5052, 0x4a035049, 0x00000001,
-- 0x0201f800, 0x0010048c, 0x825cbd00, 0xbbfffffe,
-+ 0x4a035049, 0x00000002, 0x4202d800, 0x00000004,
-+ 0x4a038805, 0x00000001, 0x0201f800, 0x001005fc,
-+ 0x0401fb77, 0x497b504f, 0x4a035046, 0x00000001,
-+ 0x0201f800, 0x0010d471, 0x825cbd00, 0xbbfffffe,
- 0x485f8805, 0x5c00c000, 0x5c00b800, 0x1c01f000,
- 0x59c41004, 0x480bc857, 0x8c081500, 0x04000006,
-- 0x4803c856, 0x497b2807, 0x0201f800, 0x00106cf9,
-+ 0x4803c856, 0x497b2807, 0x0201f800, 0x001067ed,
- 0x0401f00a, 0x82080500, 0x000001f0, 0x04000007,
-- 0x4803c856, 0x417a3000, 0x0201f800, 0x00105d9b,
-- 0x0201f800, 0x00106d1b, 0x4a038805, 0x80000000,
-+ 0x4803c856, 0x417a3000, 0x0201f800, 0x00105c41,
-+ 0x0201f800, 0x0010680f, 0x4a038805, 0x80000000,
- 0x1c01f000, 0x59c408a3, 0x4807c857, 0x84040d40,
- 0x480788a3, 0x1c01f000, 0x4d900000, 0x4dd00000,
- 0x4da40000, 0x4d140000, 0x4a038805, 0x40000000,
-- 0x42000000, 0x0010b6c5, 0x0201f800, 0x0010a86e,
-- 0x0201f800, 0x0010698c, 0x59c41004, 0x8c081500,
-- 0x04000054, 0x598e600d, 0x497b2807, 0x813261c0,
-+ 0x42000000, 0x0010b095, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x00106476, 0x59c41004, 0x8c081500,
-+ 0x04000055, 0x598e600d, 0x497b2807, 0x813261c0,
- 0x04000032, 0x59300403, 0x82000580, 0x00000032,
- 0x0402002e, 0x5930001c, 0x48038833, 0x4a038807,
- 0x00018000, 0x4201d000, 0x00000002, 0x0201f800,
-- 0x00105dd2, 0x497b8807, 0x4201d000, 0x00000002,
-- 0x0201f800, 0x00105dd2, 0x0201f800, 0x00106b71,
-- 0x4201d000, 0x00007530, 0x0201f800, 0x00105dd2,
-+ 0x00105c78, 0x497b8807, 0x4201d000, 0x00000002,
-+ 0x0201f800, 0x00105c78, 0x0201f800, 0x00106664,
-+ 0x4201d000, 0x00007530, 0x0201f800, 0x00105c78,
- 0x59c408a4, 0x82040d00, 0x0000000f, 0x82040d80,
- 0x00000000, 0x04000005, 0x42000000, 0x00200000,
-- 0x0201f800, 0x001019b6, 0x0201f800, 0x001068f6,
-- 0x59300008, 0x80000540, 0x02000800, 0x00100615,
-+ 0x0201f800, 0x001018aa, 0x0201f800, 0x001063c4,
-+ 0x59300008, 0x80000540, 0x02000800, 0x001004ef,
- 0x40025800, 0x4a025a04, 0x00000103, 0x5931d821,
- 0x58ef400b, 0x58ec0009, 0x0801f800, 0x0201f800,
-- 0x000208b4, 0x0401f047, 0x598c000f, 0x82001c80,
-- 0x000000c8, 0x0402100f, 0x80000000, 0x4803180f,
-+ 0x000207bb, 0x0401f047, 0x598c000f, 0x82001c80,
-+ 0x000000c8, 0x04021010, 0x80000000, 0x4803180f,
-+ 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-+ 0x00000002, 0x04020005, 0x42000000, 0x00200000,
-+ 0x0201f800, 0x001018aa, 0x0201f800, 0x00105c2c,
-+ 0x0401f034, 0x4933c857, 0x0201f800, 0x00106664,
-+ 0x813261c0, 0x0400002f, 0x4a026203, 0x00000001,
-+ 0x42027000, 0x00000027, 0x0201f800, 0x000207df,
-+ 0x0401f028, 0x8c081508, 0x04000026, 0x417a3000,
-+ 0x0201f800, 0x0010692b, 0x0201f800, 0x00105c41,
-+ 0x59926004, 0x813261c0, 0x04000013, 0x42001800,
-+ 0x000000c8, 0x0201f800, 0x001068ef, 0x0402000e,
- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-- 0x00000002, 0x04020004, 0x42000000, 0x00200000,
-- 0x0401fbfa, 0x0201f800, 0x00105d86, 0x0401f035,
-- 0x4933c857, 0x0201f800, 0x00106b71, 0x813261c0,
-- 0x04000030, 0x4a026203, 0x00000001, 0x42027000,
-- 0x00000027, 0x0201f800, 0x000208d8, 0x0401f029,
-- 0x8c081508, 0x04000027, 0x417a3000, 0x0201f800,
-- 0x00106e2f, 0x42032000, 0x0000bf32, 0x0201f800,
-- 0x00105d9b, 0x59926004, 0x813261c0, 0x04000012,
-- 0x42001800, 0x000000c8, 0x0201f800, 0x00106dfb,
-- 0x0402000d, 0x59c400a4, 0x82000500, 0x0000000f,
-- 0x82000580, 0x00000002, 0x04020004, 0x42000000,
-- 0x00200000, 0x0401fbd1, 0x0201f800, 0x00105d8b,
-- 0x0401f00c, 0x4933c857, 0x0201f800, 0x00106b13,
-+ 0x00000002, 0x04020005, 0x42000000, 0x00200000,
-+ 0x0201f800, 0x001018aa, 0x0201f800, 0x00105c31,
-+ 0x0401f00c, 0x4933c857, 0x0201f800, 0x00106606,
- 0x813261c0, 0x04000007, 0x42027000, 0x0000004f,
-- 0x4a026203, 0x00000003, 0x0201f800, 0x000208d8,
-+ 0x4a026203, 0x00000003, 0x0201f800, 0x000207df,
- 0x5c022800, 0x5c034800, 0x5c03a000, 0x5c032000,
-- 0x0201f000, 0x00106982, 0x4803c857, 0x59a80821,
-- 0x48035021, 0x80041580, 0x04000045, 0x800409c0,
-- 0x04000023, 0x497b504c, 0x42000000, 0x0010b60b,
-- 0x0201f800, 0x0010a86e, 0x0201f800, 0x0010a920,
-- 0x42001000, 0x00008011, 0x59c40001, 0x82000500,
-- 0x00018000, 0x82001d80, 0x00000000, 0x04000009,
-- 0x82001d80, 0x00008000, 0x04000009, 0x82001d80,
-- 0x00010000, 0x04000009, 0x0201f800, 0x00100615,
-- 0x42001800, 0x00000000, 0x0401f006, 0x42001800,
-- 0x00000001, 0x0401f003, 0x42001800, 0x00000003,
-- 0x0201f800, 0x00103857, 0x0401f021, 0x59a8084c,
-- 0x800409c0, 0x04020007, 0x59c4000d, 0x8c000520,
-- 0x04000004, 0x42001800, 0x00000003, 0x0401f002,
-- 0x40041800, 0x0201f800, 0x0010a904, 0x42001000,
-- 0x00008012, 0x0201f800, 0x00103857, 0x0201f800,
-- 0x0010071a, 0x0201f800, 0x0010a95a, 0x0402000c,
-- 0x0401f853, 0x4d400000, 0x4d3c0000, 0x42028000,
-- 0x00000028, 0x42027800, 0x00000008, 0x0201f800,
-- 0x00101d90, 0x5c027800, 0x5c028000, 0x1c01f000,
-- 0x4803c857, 0x82000400, 0x00101eb5, 0x50000800,
-- 0x82040d00, 0x000000ff, 0x1c01f000, 0x4803c856,
-- 0x4c580000, 0x4200b000, 0x00000010, 0x497b88ac,
-- 0x497b88ad, 0x8058b040, 0x040207fe, 0x5c00b000,
-- 0x1c01f000, 0x4807c857, 0x48075010, 0x80041108,
-- 0x4200b000, 0x00000010, 0x497b88ac, 0x80000580,
-- 0x800811c0, 0x04020006, 0x82040500, 0x0000000f,
-- 0x82000400, 0x0010a95f, 0x50000000, 0x480388ad,
-- 0x80081040, 0x8058b040, 0x040207f5, 0x1c01f000,
-- 0x59a80005, 0x04000003, 0x84000546, 0x0401f002,
-- 0x84000506, 0x48035005, 0x4803c857, 0x1c01f000,
-- 0x4803c857, 0x4c080000, 0x4c040000, 0x4c000000,
-- 0x59c40892, 0x4807c857, 0x80041580, 0x04000010,
-- 0x80041480, 0x04021007, 0x80081080, 0x80081000,
-- 0x4008b000, 0x42000000, 0x00000201, 0x0401f004,
-- 0x4008b000, 0x42000000, 0x00000210, 0x48038886,
-- 0x8058b040, 0x040207fe, 0x497b8886, 0x5c000000,
-- 0x5c000800, 0x5c001000, 0x1c01f000, 0x4803c856,
-- 0x0201f800, 0x0010393e, 0x04000005, 0x42028000,
-- 0x0000002e, 0x0201f000, 0x0010a25b, 0x1c01f000,
-- 0x59a8086f, 0x82040500, 0x00000010, 0x04000004,
-- 0x42000800, 0x00000002, 0x0401f010, 0x82040500,
-- 0x00000020, 0x42000800, 0x00000002, 0x0402000b,
-- 0x59c80835, 0x82040d00, 0x00001f00, 0x80040910,
-- 0x80040800, 0x59a8006c, 0x80000540, 0x04000003,
-- 0x42000800, 0x0000025a, 0x4807c857, 0x1c01f000,
-- 0x4c000000, 0x59a80053, 0x4803c857, 0x82000580,
-- 0x00000000, 0x5c000000, 0x1c01f000, 0x4c000000,
-- 0x59a80053, 0x4803c857, 0x82000580, 0x00000001,
-- 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80053,
-+ 0x0201f000, 0x00106463, 0x4c000000, 0x40680000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x810c0d80,
-+ 0x8c040d0e, 0x04000047, 0x4803c857, 0x8d0e1d0e,
-+ 0x04000023, 0x850e1d0e, 0x497b5049, 0x42000000,
-+ 0x0010afdb, 0x0201f800, 0x0010a260, 0x0201f800,
-+ 0x0010a312, 0x42001000, 0x00008011, 0x59c40001,
-+ 0x82000500, 0x00018000, 0x82001d80, 0x00000000,
-+ 0x04000009, 0x82001d80, 0x00008000, 0x04000009,
-+ 0x82001d80, 0x00010000, 0x04000009, 0x0201f800,
-+ 0x001004ef, 0x42001800, 0x00000000, 0x0401f006,
-+ 0x42001800, 0x00000001, 0x0401f003, 0x42001800,
-+ 0x00000003, 0x0201f000, 0x001036f4, 0x850e1d4e,
-+ 0x59a80849, 0x800409c0, 0x04020007, 0x59c4000d,
-+ 0x8c000520, 0x04000004, 0x42001800, 0x00000003,
-+ 0x0401f002, 0x40041800, 0x0201f800, 0x0010a2f6,
-+ 0x42001000, 0x00008012, 0x0201f800, 0x001036f4,
-+ 0x0201f800, 0x001005fc, 0x0201f800, 0x0010a34c,
-+ 0x0402000c, 0x0401f850, 0x4d400000, 0x4d3c0000,
-+ 0x42028000, 0x00000028, 0x42027800, 0x00000008,
-+ 0x0201f800, 0x0010ca42, 0x5c027800, 0x5c028000,
-+ 0x1c01f000, 0x4803c857, 0x82000400, 0x00101cdd,
-+ 0x50000800, 0x82040d00, 0x000000ff, 0x1c01f000,
-+ 0x4803c856, 0x4c580000, 0x4200b000, 0x00000010,
-+ 0x497b88ac, 0x497b88ad, 0x8058b040, 0x040207fe,
-+ 0x5c00b000, 0x1c01f000, 0x4807c857, 0x4807500f,
-+ 0x80041108, 0x4200b000, 0x00000010, 0x497b88ac,
-+ 0x80000580, 0x800811c0, 0x04020006, 0x82040500,
-+ 0x0000000f, 0x82000400, 0x0010a351, 0x50000000,
-+ 0x480388ad, 0x80081040, 0x8058b040, 0x040207f5,
-+ 0x1c01f000, 0x4c000000, 0x40680800, 0x0401ffeb,
-+ 0x5c000000, 0x1c01f000, 0x4803c857, 0x4c080000,
-+ 0x4c040000, 0x4c000000, 0x59c40892, 0x4807c857,
-+ 0x80041580, 0x04000010, 0x80041480, 0x04021007,
-+ 0x80081080, 0x80081000, 0x4008b000, 0x42000000,
-+ 0x00000201, 0x0401f004, 0x4008b000, 0x42000000,
-+ 0x00000210, 0x48038886, 0x8058b040, 0x040207fe,
-+ 0x497b8886, 0x5c000000, 0x5c000800, 0x5c001000,
-+ 0x1c01f000, 0x4803c856, 0x8d0e1d20, 0x04000005,
-+ 0x42028000, 0x0000002e, 0x0201f000, 0x00109c1f,
-+ 0x1c01f000, 0x59a8086c, 0x82040500, 0x00000010,
-+ 0x04000004, 0x42000800, 0x00000002, 0x0401f010,
-+ 0x82040500, 0x00000020, 0x42000800, 0x00000002,
-+ 0x0402000b, 0x59c80835, 0x82040d00, 0x00001f00,
-+ 0x80040910, 0x80040800, 0x59a80069, 0x80000540,
-+ 0x04000003, 0x42000800, 0x0000025a, 0x4807c857,
-+ 0x1c01f000, 0x4c000000, 0x59c98835, 0x82c58d00,
-+ 0x00001f00, 0x80c58910, 0x48c7c857, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80050,
-+ 0x4803c857, 0x82000580, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80050,
-+ 0x4803c857, 0x82000580, 0x00000001, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80050,
- 0x4803c857, 0x82000580, 0x00000003, 0x5c000000,
-- 0x1c01f000, 0x4c000000, 0x59a80053, 0x82000580,
-- 0x00000002, 0x5c000000, 0x1c01f000, 0x4c000000,
-- 0x4c040000, 0x4c080000, 0x4c380000, 0x59a80040,
-- 0x82000c80, 0x00000007, 0x02021800, 0x00100615,
-- 0x0c01f806, 0x5c007000, 0x5c001000, 0x5c000800,
-- 0x5c000000, 0x1c01f000, 0x001016dd, 0x001016f0,
-- 0x00101704, 0x00101706, 0x0010172d, 0x0010172f,
-- 0x00101731, 0x4803c856, 0x4a035042, 0x00000000,
-- 0x42000000, 0x00000002, 0x0401fa18, 0x42000000,
-- 0x00000002, 0x0401f9ad, 0x0401faae, 0x4803c856,
-- 0x4a035040, 0x00000006, 0x42000800, 0x0000001e,
-- 0x42001000, 0x00101732, 0x0201f000, 0x00105da7,
-- 0x497b5045, 0x4a035050, 0x00000036, 0x4a03504f,
-- 0x0000002a, 0x4803c856, 0x4a035042, 0x00000001,
-- 0x42000000, 0x00000002, 0x0401f998, 0x4803c856,
-- 0x4a035040, 0x00000006, 0x42000800, 0x0000001e,
-- 0x42001000, 0x00101732, 0x0201f000, 0x00105da7,
-- 0x0201f800, 0x00100615, 0x4a035050, 0x00000036,
-- 0x4803c856, 0x4a035042, 0x00000003, 0x42000800,
-- 0x00000000, 0x0401fa9f, 0x82040d00, 0x00000090,
-- 0x82040580, 0x00000090, 0x04000009, 0x82040580,
-- 0x00000010, 0x04000009, 0x82040580, 0x00000000,
-- 0x04000008, 0x0201f800, 0x00100615, 0x42000000,
-- 0x00000001, 0x0401f005, 0x41780000, 0x0401f003,
-- 0x42000000, 0x00000002, 0x0401f970, 0x497b5046,
-- 0x4803c856, 0x4a035040, 0x00000006, 0x42000800,
-- 0x0000001e, 0x42001000, 0x00101732, 0x0201f000,
-- 0x00105da7, 0x0201f800, 0x00100615, 0x0201f800,
-- 0x00100615, 0x1c01f000, 0x4c000000, 0x4c040000,
-- 0x4c080000, 0x4c380000, 0x59a80042, 0x82000c80,
-- 0x00000007, 0x02021800, 0x00100615, 0x0c01f806,
-- 0x5c007000, 0x5c001000, 0x5c000800, 0x5c000000,
-- 0x1c01f000, 0x00101748, 0x00101767, 0x001017bb,
-- 0x001017d2, 0x001017e9, 0x001017f2, 0x001017f4,
-- 0x0401f9f9, 0x0402001b, 0x59a81048, 0x42000800,
-- 0x00000000, 0x0401fa5f, 0x82040d00, 0x00000090,
-- 0x82040580, 0x00000090, 0x04000009, 0x82040580,
-- 0x00000010, 0x04000008, 0x82040580, 0x00000000,
-- 0x04000007, 0x0201f800, 0x00100615, 0x84081540,
-- 0x0401f004, 0x84081542, 0x0401f002, 0x84081544,
-- 0x480b5048, 0x4a035040, 0x00000001, 0x0401f003,
-- 0x0401f8cb, 0x0401ff82, 0x1c01f000, 0x0401f88f,
-- 0x04000052, 0x0401f9d8, 0x0402002a, 0x42000800,
-- 0x00000000, 0x0401fa3f, 0x82040d00, 0x00000090,
-- 0x82040580, 0x00000000, 0x04000044, 0x82040580,
-- 0x00000010, 0x04000006, 0x82040580, 0x00000090,
-- 0x04000009, 0x0201f800, 0x00100615, 0x59c40801,
-- 0x82040d00, 0x00018000, 0x82040580, 0x00000000,
-- 0x04000036, 0x42000800, 0x00000000, 0x0401fa29,
-- 0x82040d00, 0x00000090, 0x82040580, 0x00000010,
-- 0x04000006, 0x82040580, 0x00000090, 0x04000006,
-- 0x02020800, 0x00100615, 0x59a80048, 0x84000542,
-- 0x0401f003, 0x59a80048, 0x84000540, 0x48035048,
-- 0x59a80045, 0x80000000, 0x48035045, 0x82000580,
-- 0x00000005, 0x04000003, 0x0401f861, 0x0401f01e,
-- 0x497b5045, 0x59c40801, 0x82040d00, 0x00018000,
-- 0x82040580, 0x00000000, 0x04000009, 0x82040580,
-- 0x00008000, 0x04000009, 0x82040580, 0x00010000,
-- 0x04000008, 0x0201f800, 0x00100615, 0x42000000,
-- 0x00000001, 0x0401f005, 0x41780000, 0x0401f003,
-- 0x42000000, 0x00000002, 0x0401f948, 0x4a035042,
-- 0x00000002, 0x0401f004, 0x4a035040, 0x00000003,
-- 0x0401f002, 0x0401ff42, 0x1c01f000, 0x0401f83b,
-- 0x04000015, 0x59a8004f, 0x80000040, 0x4803504f,
-- 0x0401f981, 0x04020005, 0x4a035040, 0x00000003,
-- 0x497b5041, 0x0401f00c, 0x59a8004f, 0x80000540,
-- 0x04020003, 0x0401f89e, 0x0401f002, 0x0401f84b,
-- 0x0401f82f, 0x497b5045, 0x4a035042, 0x00000001,
-- 0x0401ff2b, 0x1c01f000, 0x0401f824, 0x04000015,
-- 0x0401f96d, 0x0402000f, 0x59a80046, 0x80000000,
-- 0x48035046, 0x82000580, 0x00000007, 0x0402000c,
-- 0x4a035052, 0x0000000a, 0x497b5049, 0x59a80048,
-- 0x8400055e, 0x48035048, 0x4803c857, 0x0401f005,
-- 0x0401f817, 0x4a035042, 0x00000004, 0x0401ff3d,
-- 0x1c01f000, 0x0401f80d, 0x04000007, 0x0401f956,
-- 0x04020003, 0x0401ff1b, 0x0401f003, 0x0401f80c,
-- 0x0401ff34, 0x1c01f000, 0x0201f800, 0x00100615,
-- 0x0201f800, 0x00100615, 0x59a80050, 0x80000040,
-- 0x48035050, 0x0400088d, 0x1c01f000, 0x4c040000,
-- 0x42000800, 0x00000000, 0x0401f9ae, 0x82040d00,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80050,
-+ 0x82000580, 0x00000002, 0x5c000000, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4c000000, 0x4c040000, 0x4c080000, 0x4c380000,
-+ 0x59a8003d, 0x82000c80, 0x00000007, 0x02021800,
-+ 0x001004ef, 0x0c01f806, 0x5c007000, 0x5c001000,
-+ 0x5c000800, 0x5c000000, 0x1c01f000, 0x001015d2,
-+ 0x001015e5, 0x001015f9, 0x001015fb, 0x00101622,
-+ 0x00101624, 0x00101626, 0x4803c856, 0x4a03503f,
-+ 0x00000000, 0x42000000, 0x00000002, 0x0401fa21,
-+ 0x42000000, 0x00000002, 0x0401f9b1, 0x0401faa7,
-+ 0x4803c856, 0x4a03503d, 0x00000006, 0x42000800,
-+ 0x0000001e, 0x42001000, 0x00101627, 0x0201f000,
-+ 0x00105c4d, 0x497b5042, 0x4a03504d, 0x00000036,
-+ 0x4a03504c, 0x0000002a, 0x4803c856, 0x4a03503f,
-+ 0x00000001, 0x42000000, 0x00000002, 0x0401f99c,
-+ 0x4803c856, 0x4a03503d, 0x00000006, 0x42000800,
-+ 0x0000001e, 0x42001000, 0x00101627, 0x0201f000,
-+ 0x00105c4d, 0x0201f800, 0x001004ef, 0x4a03504d,
-+ 0x00000036, 0x4803c856, 0x4a03503f, 0x00000003,
-+ 0x42000800, 0x00000000, 0x0401fa97, 0x82040d00,
- 0x00000090, 0x82040580, 0x00000090, 0x04000009,
- 0x82040580, 0x00000010, 0x04000009, 0x82040580,
-- 0x00000000, 0x04000009, 0x0201f800, 0x00100615,
-- 0x42000000, 0x00000002, 0x0401f005, 0x42000000,
-- 0x00000001, 0x0401f002, 0x41780000, 0x0401f8e7,
-- 0x5c000800, 0x1c01f000, 0x4c040000, 0x59c40801,
-- 0x82040d00, 0x00018000, 0x82040580, 0x00000000,
-- 0x04000009, 0x82040580, 0x00008000, 0x04000009,
-- 0x82040580, 0x00010000, 0x04000009, 0x0201f800,
-- 0x00100615, 0x42000000, 0x00000002, 0x0401f005,
-- 0x42000000, 0x00000001, 0x0401f002, 0x41780000,
-- 0x0401f866, 0x5c000800, 0x1c01f000, 0x4c040000,
-- 0x59a80045, 0x80000000, 0x48035045, 0x82000580,
-- 0x00000005, 0x04020018, 0x497b5045, 0x59c40801,
-- 0x82040d00, 0x00018000, 0x82040580, 0x00000000,
-- 0x04000009, 0x82040580, 0x00008000, 0x04000009,
-- 0x82040580, 0x00010000, 0x04000009, 0x0201f800,
-- 0x00100615, 0x42000000, 0x00000002, 0x0401f005,
-- 0x42000000, 0x00000001, 0x0401f002, 0x41780000,
-- 0x0401f846, 0x42000800, 0x00000000, 0x0401f95d,
-+ 0x00000000, 0x04000008, 0x0201f800, 0x001004ef,
-+ 0x42000000, 0x00000001, 0x0401f005, 0x41780000,
-+ 0x0401f003, 0x42000000, 0x00000002, 0x0401f974,
-+ 0x497b5043, 0x4803c856, 0x4a03503d, 0x00000006,
-+ 0x42000800, 0x0000001e, 0x42001000, 0x00101627,
-+ 0x0201f000, 0x00105c4d, 0x0201f800, 0x001004ef,
-+ 0x0201f800, 0x001004ef, 0x1c01f000, 0x4c000000,
-+ 0x4c040000, 0x4c080000, 0x4c380000, 0x59a8003f,
-+ 0x82000c80, 0x00000007, 0x02021800, 0x001004ef,
-+ 0x0c01f806, 0x5c007000, 0x5c001000, 0x5c000800,
-+ 0x5c000000, 0x1c01f000, 0x0010163d, 0x0010165c,
-+ 0x001016b0, 0x001016c7, 0x001016de, 0x001016e7,
-+ 0x001016e9, 0x0401fa10, 0x0402001b, 0x59a81045,
-+ 0x42000800, 0x00000000, 0x0401fa57, 0x82040d00,
-+ 0x00000090, 0x82040580, 0x00000090, 0x04000009,
-+ 0x82040580, 0x00000010, 0x04000008, 0x82040580,
-+ 0x00000000, 0x04000007, 0x0201f800, 0x001004ef,
-+ 0x84081540, 0x0401f004, 0x84081542, 0x0401f002,
-+ 0x84081544, 0x480b5045, 0x4a03503d, 0x00000001,
-+ 0x0401f003, 0x0401f8cb, 0x0401ff82, 0x1c01f000,
-+ 0x0401f88f, 0x04000052, 0x0401f9ef, 0x0402002a,
-+ 0x42000800, 0x00000000, 0x0401fa37, 0x82040d00,
-+ 0x00000090, 0x82040580, 0x00000000, 0x04000044,
-+ 0x82040580, 0x00000010, 0x04000006, 0x82040580,
-+ 0x00000090, 0x04000009, 0x0201f800, 0x001004ef,
-+ 0x59c40801, 0x82040d00, 0x00018000, 0x82040580,
-+ 0x00000000, 0x04000036, 0x42000800, 0x00000000,
-+ 0x0401fa21, 0x82040d00, 0x00000090, 0x82040580,
-+ 0x00000010, 0x04000006, 0x82040580, 0x00000090,
-+ 0x04000006, 0x02020800, 0x001004ef, 0x59a80045,
-+ 0x84000542, 0x0401f003, 0x59a80045, 0x84000540,
-+ 0x48035045, 0x59a80042, 0x80000000, 0x48035042,
-+ 0x82000580, 0x00000005, 0x04000003, 0x0401f861,
-+ 0x0401f01e, 0x497b5042, 0x59c40801, 0x82040d00,
-+ 0x00018000, 0x82040580, 0x00000000, 0x04000009,
-+ 0x82040580, 0x00008000, 0x04000009, 0x82040580,
-+ 0x00010000, 0x04000008, 0x0201f800, 0x001004ef,
-+ 0x42000000, 0x00000001, 0x0401f005, 0x41780000,
-+ 0x0401f003, 0x42000000, 0x00000002, 0x0401f951,
-+ 0x4a03503f, 0x00000002, 0x0401f004, 0x4a03503d,
-+ 0x00000003, 0x0401f002, 0x0401ff42, 0x1c01f000,
-+ 0x0401f83b, 0x04000015, 0x59a8004c, 0x80000040,
-+ 0x4803504c, 0x0401f998, 0x04020005, 0x4a03503d,
-+ 0x00000003, 0x497b503e, 0x0401f00c, 0x59a8004c,
-+ 0x80000540, 0x04020003, 0x0401f89e, 0x0401f002,
-+ 0x0401f84b, 0x0401f82f, 0x497b5042, 0x4a03503f,
-+ 0x00000001, 0x0401ff2b, 0x1c01f000, 0x0401f824,
-+ 0x04000015, 0x0401f984, 0x0402000f, 0x59a80043,
-+ 0x80000000, 0x48035043, 0x82000580, 0x00000007,
-+ 0x0402000c, 0x4a03504f, 0x0000000a, 0x497b5046,
-+ 0x59a80045, 0x8400055e, 0x48035045, 0x4803c857,
-+ 0x0401f005, 0x0401f817, 0x4a03503f, 0x00000004,
-+ 0x0401ff3d, 0x1c01f000, 0x0401f80d, 0x04000007,
-+ 0x0401f96d, 0x04020003, 0x0401ff1b, 0x0401f003,
-+ 0x0401f80c, 0x0401ff34, 0x1c01f000, 0x0201f800,
-+ 0x001004ef, 0x0201f800, 0x001004ef, 0x59a8004d,
-+ 0x80000040, 0x4803504d, 0x04000891, 0x1c01f000,
-+ 0x4c040000, 0x42000800, 0x00000000, 0x0401f9a6,
- 0x82040d00, 0x00000090, 0x82040580, 0x00000090,
- 0x04000009, 0x82040580, 0x00000010, 0x04000009,
- 0x82040580, 0x00000000, 0x04000009, 0x0201f800,
-- 0x00100615, 0x42000000, 0x00000002, 0x0401f005,
-+ 0x001004ef, 0x42000000, 0x00000002, 0x0401f005,
- 0x42000000, 0x00000001, 0x0401f002, 0x41780000,
-- 0x0401f896, 0x5c000800, 0x1c01f000, 0x4c200000,
-- 0x59a80048, 0x82000500, 0x00007fff, 0x02000800,
-- 0x00100615, 0x59a84047, 0x80204102, 0x02001800,
-- 0x00100615, 0x48235047, 0x80204500, 0x040007fa,
-- 0x8c000504, 0x04020007, 0x8c000502, 0x04020008,
-- 0x8c000500, 0x04020008, 0x0201f800, 0x00100615,
-- 0x42000000, 0x00000002, 0x0401f005, 0x41780000,
-- 0x0401f003, 0x42000000, 0x00000001, 0x0401f80f,
-- 0x5c004000, 0x1c01f000, 0x04011000, 0x4a03c840,
-- 0x0010b240, 0x4a03c842, 0x00000009, 0x40000000,
-- 0x040117ff, 0x4a035047, 0x00000004, 0x4a03503e,
-- 0x00000000, 0x1c01f000, 0x59a80858, 0x82040d80,
-- 0x01391077, 0x04020008, 0x59e00813, 0x8c040d00,
-- 0x04000005, 0x82000d80, 0x00000002, 0x04020002,
-- 0x41780000, 0x800001c0, 0x04000040, 0x82000d80,
-- 0x00000001, 0x0402001d, 0x42000800, 0x000000a0,
-- 0x0401f908, 0x82040540, 0x00000004, 0x42000800,
-- 0x000000a0, 0x0401f908, 0x42000800, 0x000000c0,
-- 0x0401f900, 0x82040540, 0x00000020, 0x42000800,
-- 0x000000c0, 0x0401f900, 0x59c40001, 0x82000500,
-- 0xfffe7fff, 0x82000540, 0x00000000, 0x48038801,
-- 0x59a80054, 0x80000110, 0x42000800, 0x000000e0,
-- 0x0401f8f5, 0x0401f03c, 0x82000d80, 0x00000002,
-- 0x02020800, 0x00100615, 0x42000800, 0x000000a0,
-- 0x0401f8e8, 0x82040500, 0xfffffffb, 0x42000800,
-- 0x000000a0, 0x0401f8e8, 0x42000800, 0x000000c0,
-- 0x0401f8e0, 0x82040500, 0xffffffdf, 0x42000800,
-- 0x000000c0, 0x0401f8e0, 0x59c40001, 0x82000500,
-- 0xfffe7fff, 0x82000540, 0x00010000, 0x48038801,
-- 0x59a80056, 0x80000110, 0x42000800, 0x000000e0,
-- 0x0401f8d5, 0x0401f01c, 0x42000800, 0x000000a0,
-- 0x0401f8cc, 0x82040540, 0x00000004, 0x42000800,
-- 0x000000a0, 0x0401f8cc, 0x42000800, 0x000000c0,
-- 0x0401f8c4, 0x82040500, 0xffffffdf, 0x42000800,
-- 0x000000c0, 0x0401f8c4, 0x59c40001, 0x82000500,
-- 0xfffe7fff, 0x82000540, 0x00008000, 0x48038801,
-- 0x59a80055, 0x80000110, 0x42000800, 0x000000e0,
-- 0x0401f8b9, 0x1c01f000, 0x4803c857, 0x59a80858,
-+ 0x0401f8f0, 0x5c000800, 0x1c01f000, 0x4c040000,
-+ 0x59c40801, 0x82040d00, 0x00018000, 0x82040580,
-+ 0x00000000, 0x04000009, 0x82040580, 0x00008000,
-+ 0x04000009, 0x82040580, 0x00010000, 0x04000009,
-+ 0x0201f800, 0x001004ef, 0x42000000, 0x00000002,
-+ 0x0401f005, 0x42000000, 0x00000001, 0x0401f002,
-+ 0x41780000, 0x0401f86a, 0x5c000800, 0x1c01f000,
-+ 0x4c040000, 0x59a80042, 0x80000000, 0x48035042,
-+ 0x82000580, 0x00000005, 0x04020018, 0x497b5042,
-+ 0x59c40801, 0x82040d00, 0x00018000, 0x82040580,
-+ 0x00000000, 0x04000009, 0x82040580, 0x00008000,
-+ 0x04000009, 0x82040580, 0x00010000, 0x04000009,
-+ 0x0201f800, 0x001004ef, 0x42000000, 0x00000002,
-+ 0x0401f005, 0x42000000, 0x00000001, 0x0401f002,
-+ 0x41780000, 0x0401f84a, 0x42000800, 0x00000000,
-+ 0x0401f955, 0x82040d00, 0x00000090, 0x82040580,
-+ 0x00000090, 0x04000009, 0x82040580, 0x00000010,
-+ 0x04000009, 0x82040580, 0x00000000, 0x04000009,
-+ 0x0201f800, 0x001004ef, 0x42000000, 0x00000002,
-+ 0x0401f005, 0x42000000, 0x00000001, 0x0401f002,
-+ 0x41780000, 0x0401f89f, 0x5c000800, 0x1c01f000,
-+ 0x4c200000, 0x59a80045, 0x82000500, 0x00007fff,
-+ 0x02000800, 0x001004ef, 0x59a84044, 0x80204102,
-+ 0x02001800, 0x001004ef, 0x48235044, 0x80204500,
-+ 0x040007fa, 0x8c000504, 0x04020007, 0x8c000502,
-+ 0x04020008, 0x8c000500, 0x04020008, 0x0201f800,
-+ 0x001004ef, 0x42000000, 0x00000002, 0x0401f005,
-+ 0x41780000, 0x0401f003, 0x42000000, 0x00000001,
-+ 0x0401f813, 0x5c004000, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x04011000,
-+ 0x4a03c840, 0x0010ac3d, 0x4a03c842, 0x00000009,
-+ 0x40000000, 0x040117ff, 0x4a035044, 0x00000004,
-+ 0x4a03503b, 0x00000000, 0x1c01f000, 0x59a80855,
- 0x82040d80, 0x01391077, 0x04020008, 0x59e00813,
- 0x8c040d00, 0x04000005, 0x82000d80, 0x00000002,
-- 0x04020002, 0x41780000, 0x4c000000, 0x0401f942,
-- 0x5c000000, 0x800001c0, 0x04000026, 0x82000d80,
-- 0x00000001, 0x04020010, 0x59a8006c, 0x80000540,
-- 0x04000004, 0x42001000, 0x00000000, 0x0401f9f7,
-- 0x42000800, 0x00000000, 0x0401f896, 0x82040540,
-- 0x00000090, 0x42000800, 0x00000000, 0x0401f896,
-- 0x0401f024, 0x82000d80, 0x00000002, 0x02020800,
-- 0x00100615, 0x59a8006c, 0x80000540, 0x04000004,
-- 0x42001000, 0x00010000, 0x0401f9e4, 0x42000800,
-- 0x00000000, 0x0401f883, 0x82040500, 0xffffff6f,
-- 0x42000800, 0x00000000, 0x0401f883, 0x0401f011,
-- 0x59a8006c, 0x80000540, 0x04000004, 0x42001000,
-- 0x00008000, 0x0401f9d5, 0x42000800, 0x00000000,
-- 0x0401f874, 0x82040500, 0xffffff6f, 0x82000540,
-- 0x00000010, 0x42000800, 0x00000000, 0x0401f872,
-- 0x0401f111, 0x4c580000, 0x4200b000, 0x00000014,
-- 0x8058b040, 0x04000042, 0x59c4000d, 0x8c000520,
-- 0x040207fc, 0x0401f85b, 0x59c4000d, 0x8c000520,
-+ 0x04020002, 0x41780000, 0x800001c0, 0x04000040,
-+ 0x82000d80, 0x00000001, 0x0402001d, 0x42000800,
-+ 0x000000a0, 0x0401f8fc, 0x82040540, 0x00000004,
-+ 0x42000800, 0x000000a0, 0x0401f903, 0x42000800,
-+ 0x000000c0, 0x0401f8f4, 0x82040540, 0x00000020,
-+ 0x42000800, 0x000000c0, 0x0401f8fb, 0x59c40001,
-+ 0x82000500, 0xfffe7fff, 0x82000540, 0x00000000,
-+ 0x48038801, 0x59a80051, 0x80000110, 0x42000800,
-+ 0x000000e0, 0x0401f8f0, 0x0401f03c, 0x82000d80,
-+ 0x00000002, 0x02020800, 0x001004ef, 0x42000800,
-+ 0x000000a0, 0x0401f8dc, 0x82040500, 0xfffffffb,
-+ 0x42000800, 0x000000a0, 0x0401f8e3, 0x42000800,
-+ 0x000000c0, 0x0401f8d4, 0x82040500, 0xffffffdf,
-+ 0x42000800, 0x000000c0, 0x0401f8db, 0x59c40001,
-+ 0x82000500, 0xfffe7fff, 0x82000540, 0x00010000,
-+ 0x48038801, 0x59a80053, 0x80000110, 0x42000800,
-+ 0x000000e0, 0x0401f8d0, 0x0401f01c, 0x42000800,
-+ 0x000000a0, 0x0401f8c0, 0x82040540, 0x00000004,
-+ 0x42000800, 0x000000a0, 0x0401f8c7, 0x42000800,
-+ 0x000000c0, 0x0401f8b8, 0x82040500, 0xffffffdf,
-+ 0x42000800, 0x000000c0, 0x0401f8bf, 0x59c40001,
-+ 0x82000500, 0xfffe7fff, 0x82000540, 0x00008000,
-+ 0x48038801, 0x59a80052, 0x80000110, 0x42000800,
-+ 0x000000e0, 0x0401f8b4, 0x1c01f000, 0x4c000000,
-+ 0x40680000, 0x0401ff96, 0x5c000000, 0x1c01f000,
-+ 0x4803c857, 0x59a80855, 0x82040d80, 0x01391077,
-+ 0x04020008, 0x59e00813, 0x8c040d00, 0x04000005,
-+ 0x82000d80, 0x00000002, 0x04020002, 0x41780000,
-+ 0x4c000000, 0x0401f931, 0x5c000000, 0x800001c0,
-+ 0x04000026, 0x82000d80, 0x00000001, 0x04020010,
-+ 0x59a80069, 0x80000540, 0x04000004, 0x42001000,
-+ 0x00000000, 0x0401f9e6, 0x42000800, 0x00000000,
-+ 0x0401f885, 0x82040540, 0x00000090, 0x42000800,
-+ 0x00000000, 0x0401f88c, 0x0401f024, 0x82000d80,
-+ 0x00000002, 0x02020800, 0x001004ef, 0x59a80069,
-+ 0x80000540, 0x04000004, 0x42001000, 0x00010000,
-+ 0x0401f9d3, 0x42000800, 0x00000000, 0x0401f872,
-+ 0x82040500, 0xffffff6f, 0x42000800, 0x00000000,
-+ 0x0401f879, 0x0401f011, 0x59a80069, 0x80000540,
-+ 0x04000004, 0x42001000, 0x00008000, 0x0401f9c4,
-+ 0x42000800, 0x00000000, 0x0401f863, 0x82040500,
-+ 0xffffff6f, 0x82000540, 0x00000010, 0x42000800,
-+ 0x00000000, 0x0401f868, 0x0401f100, 0x4c000000,
-+ 0x40680000, 0x0401ffb7, 0x5c000000, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x4c580000, 0x4200b000, 0x00000014,
-+ 0x8058b040, 0x04000029, 0x59c4000d, 0x8c000520,
-+ 0x040207fc, 0x0401f83d, 0x59c4000d, 0x8c000520,
- 0x040207f8, 0x59c40808, 0x84040d50, 0x48078808,
- 0x4200b000, 0x000000c8, 0x8058b040, 0x040207ff,
-- 0x4200b000, 0x00000014, 0x8058b040, 0x04000030,
-- 0x59c4000d, 0x8c000520, 0x0402002d, 0x42000800,
-- 0x00001000, 0x50040800, 0x82040c80, 0x24220001,
-- 0x04020003, 0x8c000504, 0x040007f4, 0x0401f841,
-- 0x59c4000d, 0x8c000520, 0x04020021, 0x42000800,
-- 0x00001000, 0x50040800, 0x82040c80, 0x24220001,
-- 0x04020003, 0x8c000504, 0x040007e8, 0x4200b000,
-- 0x0000000a, 0x8058b040, 0x04000003, 0x0401f831,
-+ 0x4200b000, 0x00000014, 0x8058b040, 0x04000017,
-+ 0x59c4000d, 0x8c000520, 0x04020014, 0x0401f82b,
-+ 0x59c4000d, 0x8c000520, 0x04020010, 0x4200b000,
-+ 0x0000000a, 0x8058b040, 0x04000003, 0x0401f823,
- 0x0401f7fd, 0x4200b000, 0x00000064, 0x59c4000d,
-- 0x8c00051e, 0x0400000e, 0x8058b040, 0x040207fc,
-- 0x42000000, 0x00001000, 0x50000000, 0x82000480,
-- 0x24220001, 0x04020004, 0x59c40808, 0x84040d10,
-- 0x48078808, 0x80000580, 0x0401f00c, 0x42000000,
-- 0x00001000, 0x50000000, 0x82000480, 0x24220001,
-- 0x04020004, 0x59c40808, 0x84040d10, 0x48078808,
-- 0x82000540, 0x00000001, 0x5c00b000, 0x1c01f000,
-- 0x42000800, 0x000000a0, 0x0401f816, 0x82040500,
-- 0xfffffffe, 0x42000800, 0x000000a0, 0x0401f816,
-- 0x42000800, 0x00000000, 0x0401f80e, 0x82040500,
-- 0xfffffffe, 0x42000800, 0x00000000, 0x0401f00e,
-- 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-- 0x40000000, 0x1c01f000, 0x480b8805, 0x1c01f000,
-- 0x4807880e, 0x59c4080f, 0x82040d00, 0x000000ff,
-+ 0x8c00051e, 0x04000005, 0x8058b040, 0x040207fc,
-+ 0x80000580, 0x0401f003, 0x82000540, 0x00000001,
-+ 0x5c00b000, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x42000800, 0x000000a0,
-+ 0x0401f815, 0x82040500, 0xfffffffe, 0x42000800,
-+ 0x000000a0, 0x0401f81c, 0x42000800, 0x00000000,
-+ 0x0401f80d, 0x82040500, 0xfffffffe, 0x42000800,
-+ 0x00000000, 0x0401f014, 0x40000000, 0x40000000,
-+ 0x40000000, 0x40000000, 0x40000000, 0x1c01f000,
-+ 0x40680800, 0x4807880e, 0x59c4080f, 0x82040d00,
-+ 0x000000ff, 0x40058800, 0x1c01f000, 0x4c000000,
-+ 0x40680800, 0x406c0000, 0x0401f803, 0x5c000000,
- 0x1c01f000, 0x900001c0, 0x80040d40, 0x84040d40,
- 0x4807880e, 0x1c01f000, 0x82000d80, 0x00200000,
- 0x04000009, 0x82000d80, 0x02000000, 0x04000006,
-@@ -1705,318 +1625,267 @@ uint32_t risc_code01[] = {
- 0x480788a3, 0x1c01f000, 0x59c400a3, 0x84000556,
- 0x480388a3, 0x84000516, 0x480388a3, 0x1c01f000,
- 0x485fc857, 0x4863c857, 0x4c640000, 0x4d3c0000,
-- 0x4d400000, 0x0201f800, 0x00106c32, 0x4863500a,
-- 0x0201f800, 0x0010a95a, 0x0402006a, 0x82600d00,
-+ 0x4d400000, 0x0201f800, 0x00106725, 0x48635009,
-+ 0x0201f800, 0x0010a34c, 0x04020063, 0x82600d00,
- 0x0000ff00, 0x800409c0, 0x0400000c, 0x4200c800,
-- 0x00000001, 0x59a80010, 0x82000500, 0x000000ff,
-- 0x80041110, 0x80081580, 0x04000021, 0x82041580,
-+ 0x00000001, 0x59a8000f, 0x82000500, 0x000000ff,
-+ 0x80041110, 0x80081580, 0x0400001f, 0x82041580,
- 0x0000ff00, 0x0400000a, 0x59c410a3, 0x82081500,
- 0x00008000, 0x04000009, 0x59c410a7, 0x82081500,
- 0x0000ff00, 0x82081580, 0x0000ff00, 0x4200c800,
-- 0x00000000, 0x04000012, 0x59a80005, 0x8c000502,
-- 0x04020008, 0x8c000500, 0x0402000d, 0x599c1017,
-- 0x8c08151a, 0x0400003c, 0x84000542, 0x48035005,
-- 0x4200c800, 0x00000002, 0x42028000, 0x00000004,
-- 0x42027800, 0x00000008, 0x0401f007, 0x59a80805,
-- 0x84040d40, 0x48075005, 0x42028000, 0x00000004,
-- 0x417a7800, 0x59a80006, 0x8c000502, 0x04020006,
-- 0x59a80805, 0x8c040d0a, 0x04020032, 0x84040d4a,
-- 0x48075005, 0x42000000, 0x0010b610, 0x0201f800,
-- 0x0010a86e, 0x59a8180a, 0x42001000, 0x00008013,
-- 0x0201f800, 0x00103857, 0x0201f800, 0x0010393e,
-- 0x04000015, 0x4d400000, 0x82600500, 0x000000ff,
-- 0x42028800, 0x0000ffff, 0x40643000, 0x42028000,
-- 0x0000000e, 0x0201f800, 0x0010a258, 0x42000800,
-- 0x00000001, 0x42001000, 0x00000100, 0x0201f800,
-- 0x00105ec4, 0x5c028000, 0x599c0817, 0x8c040d0a,
-- 0x04020010, 0x493fc857, 0x4943c857, 0x0401fb59,
-- 0x0401f00c, 0x0201f800, 0x0010393e, 0x04000009,
-- 0x42028000, 0x0000000f, 0x42028800, 0x0000ffff,
-- 0x42003000, 0x00000000, 0x0201f800, 0x0010a25b,
-- 0x497b8880, 0x5c028000, 0x5c027800, 0x5c00c800,
-- 0x1c01f000, 0x42000800, 0x00000000, 0x0401ff61,
-- 0x82040540, 0x00000002, 0x42000800, 0x00000000,
-- 0x0401f761, 0x42000800, 0x00000000, 0x0401ff59,
-- 0x82040500, 0xfffffffd, 0x42000800, 0x00000000,
-- 0x0401f759, 0x59c408a8, 0x0401ff4a, 0x0401ff49,
-- 0x59c400a8, 0x80040d80, 0x040207fb, 0x1c01f000,
-- 0x4803c856, 0x4a038807, 0x00000001, 0x497b8807,
-- 0x59c40005, 0x48038805, 0x497b506c, 0x497b506d,
-- 0x41785800, 0x42006000, 0x00000001, 0x42006800,
-- 0x00000003, 0x0401f824, 0x0401f82f, 0x40400000,
-- 0x4803c857, 0x82408580, 0x00000000, 0x0402001d,
-- 0x41785800, 0x42006000, 0x0000001e, 0x42006800,
-- 0x00000014, 0x0401f818, 0x0401f823, 0x40400000,
-- 0x4803c857, 0x82408580, 0x00000800, 0x04020011,
-- 0x42005800, 0x00000001, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000014, 0x0401f80b, 0x0401f816,
-- 0x40400000, 0x4803c857, 0x82408580, 0x0000ffff,
-- 0x04020004, 0x4a03506c, 0x00000001, 0x4803c856,
-- 0x1c01f000, 0x41785000, 0x0401f812, 0x0401f838,
-- 0x40347000, 0x40340800, 0x0401f03d, 0x42005000,
-- 0x00000001, 0x0401f80b, 0x0401f831, 0x40340800,
-- 0x0401f037, 0x42005000, 0x00000002, 0x0401f805,
-- 0x0401f81d, 0x0401f835, 0x40048000, 0x1c01f000,
-- 0x0401f808, 0x0401f814, 0x40280800, 0x0401f826,
-- 0x402c0800, 0x0401f827, 0x40300800, 0x0401f025,
-- 0x42000800, 0x0000ffff, 0x42001000, 0x00000001,
-- 0x0401f829, 0x42001000, 0x00000010, 0x0401f826,
-- 0x42000800, 0x0000ffff, 0x42001000, 0x00000010,
-- 0x0401f021, 0x41780800, 0x42001000, 0x00000002,
-- 0x0401f01d, 0x0401f92e, 0x4a03d000, 0x00050004,
-- 0x0401f92b, 0x4a03d000, 0x00050005, 0x0401f928,
-- 0x4a03d000, 0x00050004, 0x42000800, 0x00000001,
-- 0x42001000, 0x00000001, 0x0401f00f, 0x42000800,
-- 0x00000002, 0x42001000, 0x00000002, 0x0401f00a,
-- 0x42001000, 0x00000005, 0x0401f007, 0x42001000,
-- 0x00000010, 0x0401f004, 0x42001000, 0x00000010,
-- 0x0401f01b, 0x0401f912, 0x82082c00, 0x0010a95f,
-- 0x50142800, 0x82081500, 0xffffffff, 0x04000013,
-- 0x0401f90b, 0x80081040, 0x80142902, 0x40040000,
-- 0x80140500, 0x04000007, 0x4a03d000, 0x00070006,
-- 0x0401f903, 0x4a03d000, 0x00070007, 0x0401f006,
-- 0x4a03d000, 0x00070004, 0x0401f8fd, 0x4a03d000,
-- 0x00070005, 0x0401f7ec, 0x1c01f000, 0x41780800,
-- 0x82082c00, 0x0010a95f, 0x50142800, 0x82081500,
-- 0xffffffff, 0x04000010, 0x0401f8f1, 0x4a03d000,
-- 0x00050001, 0x0401f8ee, 0x59e81800, 0x80081040,
-- 0x80142902, 0x8c0c1d06, 0x04000004, 0x40140000,
-- 0x80040d40, 0x0401f8e6, 0x4a03d000, 0x00070000,
-- 0x0401f7ef, 0x1c01f000, 0x480bc857, 0x480b506d,
-- 0x59c40001, 0x82000500, 0xffffefff, 0x48038801,
-- 0x41781800, 0x0401f8c4, 0x41785800, 0x42006000,
-- 0x0000001e, 0x42006800, 0x00000004, 0x0401ff7a,
-- 0x42006800, 0x0000003c, 0x0401ff7d, 0x41785800,
-+ 0x00000000, 0x04000010, 0x8d0e1d02, 0x04020007,
-+ 0x8d0e1d00, 0x0402000c, 0x599c1017, 0x8c08151a,
-+ 0x04000037, 0x850e1d42, 0x4200c800, 0x00000002,
-+ 0x42028000, 0x00000004, 0x42027800, 0x00000008,
-+ 0x0401f005, 0x850e1d40, 0x42028000, 0x00000004,
-+ 0x417a7800, 0x59a80005, 0x8c000502, 0x04020004,
-+ 0x8d0e1d0a, 0x04020030, 0x850e1d4a, 0x42000000,
-+ 0x0010afe0, 0x0201f800, 0x0010a260, 0x59a81809,
-+ 0x42001000, 0x00008013, 0x0201f800, 0x001036f4,
-+ 0x8d0e1d20, 0x04000015, 0x4d400000, 0x82600500,
-+ 0x000000ff, 0x42028800, 0x0000ffff, 0x40643000,
-+ 0x42028000, 0x0000000e, 0x0201f800, 0x00109c1c,
-+ 0x42000800, 0x00000001, 0x42001000, 0x00000100,
-+ 0x0201f800, 0x00105d72, 0x5c028000, 0x599c0817,
-+ 0x8c040d0a, 0x04020010, 0x493fc857, 0x4943c857,
-+ 0x0201f800, 0x0010ca42, 0x0401f00b, 0x8d0e1d20,
-+ 0x04000009, 0x42028000, 0x0000000f, 0x42028800,
-+ 0x0000ffff, 0x42003000, 0x00000000, 0x0201f800,
-+ 0x00109c1f, 0x497b8880, 0x5c028000, 0x5c027800,
-+ 0x5c00c800, 0x1c01f000, 0x42000800, 0x00000000,
-+ 0x0401ff61, 0x82040540, 0x00000002, 0x42000800,
-+ 0x00000000, 0x0401f768, 0x42000800, 0x00000000,
-+ 0x0401ff59, 0x82040500, 0xfffffffd, 0x42000800,
-+ 0x00000000, 0x0401f760, 0x59c408a8, 0x0401ff4b,
-+ 0x0401ff4a, 0x59c400a8, 0x80040d80, 0x040207fb,
-+ 0x1c01f000, 0x4803c856, 0x4a038807, 0x00000001,
-+ 0x497b8807, 0x59c40005, 0x48038805, 0x497b5069,
-+ 0x497b506a, 0x41785800, 0x42006000, 0x00000001,
-+ 0x42006800, 0x00000003, 0x0401f824, 0x0401f82f,
-+ 0x40400000, 0x4803c857, 0x82408580, 0x00000000,
-+ 0x0402001d, 0x41785800, 0x42006000, 0x0000001e,
-+ 0x42006800, 0x00000014, 0x0401f818, 0x0401f823,
-+ 0x40400000, 0x4803c857, 0x82408580, 0x00000800,
-+ 0x04020011, 0x42005800, 0x00000001, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000014, 0x0401f80b,
-+ 0x0401f816, 0x40400000, 0x4803c857, 0x82408580,
-+ 0x0000ffff, 0x04020004, 0x4a035069, 0x00000001,
-+ 0x4803c856, 0x1c01f000, 0x41785000, 0x0401f812,
-+ 0x0401f838, 0x40347000, 0x40340800, 0x0401f03d,
-+ 0x42005000, 0x00000001, 0x0401f80b, 0x0401f831,
-+ 0x40340800, 0x0401f037, 0x42005000, 0x00000002,
-+ 0x0401f805, 0x0401f81d, 0x0401f835, 0x40048000,
-+ 0x1c01f000, 0x0401f808, 0x0401f814, 0x40280800,
-+ 0x0401f826, 0x402c0800, 0x0401f827, 0x40300800,
-+ 0x0401f025, 0x42000800, 0x0000ffff, 0x42001000,
-+ 0x00000001, 0x0401f829, 0x42001000, 0x00000010,
-+ 0x0401f826, 0x42000800, 0x0000ffff, 0x42001000,
-+ 0x00000010, 0x0401f021, 0x41780800, 0x42001000,
-+ 0x00000002, 0x0401f01d, 0x0401f92e, 0x4a03d000,
-+ 0x00050004, 0x0401f92b, 0x4a03d000, 0x00050005,
-+ 0x0401f928, 0x4a03d000, 0x00050004, 0x42000800,
-+ 0x00000001, 0x42001000, 0x00000001, 0x0401f00f,
-+ 0x42000800, 0x00000002, 0x42001000, 0x00000002,
-+ 0x0401f00a, 0x42001000, 0x00000005, 0x0401f007,
-+ 0x42001000, 0x00000010, 0x0401f004, 0x42001000,
-+ 0x00000010, 0x0401f01b, 0x0401f912, 0x82082c00,
-+ 0x0010a351, 0x50142800, 0x82081500, 0xffffffff,
-+ 0x04000013, 0x0401f90b, 0x80081040, 0x80142902,
-+ 0x40040000, 0x80140500, 0x04000007, 0x4a03d000,
-+ 0x00070006, 0x0401f903, 0x4a03d000, 0x00070007,
-+ 0x0401f006, 0x4a03d000, 0x00070004, 0x0401f8fd,
-+ 0x4a03d000, 0x00070005, 0x0401f7ec, 0x1c01f000,
-+ 0x41780800, 0x82082c00, 0x0010a351, 0x50142800,
-+ 0x82081500, 0xffffffff, 0x04000010, 0x0401f8f1,
-+ 0x4a03d000, 0x00050001, 0x0401f8ee, 0x59e81800,
-+ 0x80081040, 0x80142902, 0x8c0c1d06, 0x04000004,
-+ 0x40140000, 0x80040d40, 0x0401f8e6, 0x4a03d000,
-+ 0x00070000, 0x0401f7ef, 0x1c01f000, 0x480bc857,
-+ 0x480b506a, 0x59c40001, 0x82000500, 0xffffefff,
-+ 0x48038801, 0x41781800, 0x0401f8c4, 0x41785800,
- 0x42006000, 0x0000001e, 0x42006800, 0x00000004,
-- 0x0401ff71, 0x41786800, 0x0401ff75, 0x41785800,
-- 0x42006000, 0x0000001e, 0x41786800, 0x0401ff6a,
-- 0x42006800, 0x00000002, 0x0401ff6d, 0x42006800,
-- 0x00000001, 0x0401ff64, 0x42006800, 0x000000f5,
-- 0x0401ff67, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000004, 0x0401ff5b, 0x42006800,
-- 0x00000020, 0x0401ff5e, 0x59a8106d, 0x0401f865,
-- 0x42001800, 0x000200f5, 0x0401f897, 0x59a8106d,
-- 0x0401f879, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000004, 0x0401ff4b, 0x41786800,
-- 0x0401ff4f, 0x59c40001, 0x82000540, 0x00001000,
-- 0x48038801, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000015, 0x0401ff3f, 0x0401ff4a,
-- 0x40400000, 0x82000540, 0x00000002, 0x4c000000,
-- 0x41785800, 0x42006000, 0x0000001e, 0x42006800,
-- 0x00000015, 0x0401ff34, 0x5c000000, 0x40006800,
-- 0x0401ff37, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000015, 0x0401ff2b, 0x0401ff36,
-- 0x40400000, 0x82000500, 0x0000fffd, 0x4c000000,
-+ 0x0401ff7a, 0x42006800, 0x0000003c, 0x0401ff7d,
- 0x41785800, 0x42006000, 0x0000001e, 0x42006800,
-- 0x00000015, 0x0401ff20, 0x5c000000, 0x40006800,
-- 0x0401ff23, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000014, 0x0401ff17, 0x0401ff22,
-- 0x40400000, 0x82000540, 0x00000040, 0x4c000000,
-- 0x41785800, 0x42006000, 0x0000001e, 0x42006800,
-- 0x00000014, 0x0401ff0c, 0x5c000000, 0x40006800,
-- 0x0401ff0f, 0x41785800, 0x42006000, 0x0000001e,
-- 0x42006800, 0x00000014, 0x0401ff03, 0x0401ff0e,
-- 0x40400000, 0x82000500, 0x0000ffbf, 0x4c000000,
-- 0x41785800, 0x42006000, 0x0000001e, 0x42006800,
-- 0x00000014, 0x0401fef8, 0x5c000000, 0x40006800,
-- 0x0401fefb, 0x4a038886, 0x00002020, 0x0401f04c,
-- 0x480bc857, 0x82080580, 0x00010000, 0x04020007,
-- 0x82040d40, 0x00010000, 0x42001800, 0x00000001,
-- 0x0401f82d, 0x0401f00f, 0x82080580, 0x00008000,
-- 0x04000007, 0x82040d40, 0x00000000, 0x42001800,
-- 0x00900001, 0x0401f824, 0x0401f006, 0x82040d40,
-- 0x00008000, 0x42001800, 0x00100001, 0x0401f81e,
-- 0x1c01f000, 0x480bc857, 0x82080580, 0x00010000,
-- 0x04020008, 0x42001800, 0x000000a1, 0x0401f816,
-- 0x42001800, 0x000000c1, 0x0401f813, 0x0401f011,
-- 0x82080580, 0x00008000, 0x04000008, 0x42001800,
-- 0x000400a1, 0x0401f80c, 0x42001800, 0x002000c1,
-- 0x0401f809, 0x0401f007, 0x42001800, 0x000400a1,
-- 0x0401f805, 0x42001800, 0x000000c1, 0x0401f802,
-- 0x1c01f000, 0x480fc857, 0x41785800, 0x42006000,
-- 0x0000001e, 0x41786800, 0x0401feb7, 0x400c6800,
-- 0x80346960, 0x0401feba, 0x42006800, 0x00000001,
-- 0x0401feb1, 0x400c6800, 0x0401feb5, 0x42006800,
-- 0x00000003, 0x0401feac, 0x0401feb7, 0x40400000,
-- 0x8c000504, 0x040207fc, 0x1c01f000, 0x42000000,
-- 0x00000064, 0x80000040, 0x040207ff, 0x1c01f000,
-- 0x4c5c0000, 0x4c600000, 0x4178b800, 0x0201f800,
-- 0x0010473b, 0x040200fd, 0x59a8c026, 0x0201f800,
-- 0x00104e0d, 0x04000003, 0x8c60c506, 0x0400000e,
-- 0x8c60c500, 0x04020004, 0x8c60c50e, 0x040008f6,
-- 0x0401f0f2, 0x0401faaf, 0x040200f0, 0x0201f800,
-- 0x00104e0d, 0x04020004, 0x4a03501c, 0x0000ffff,
-- 0x0401f0ea, 0x8c60c504, 0x04000004, 0x4a03501c,
-- 0x0000ffff, 0x0401f0e5, 0x59a8c010, 0x8260c500,
-- 0x000000ff, 0x59a81013, 0x8c081500, 0x0400005d,
-- 0x8c081502, 0x0402005b, 0x59a8b81c, 0x825c0d80,
-- 0x0000ffff, 0x04020003, 0x4200b800, 0x00000001,
-- 0x805c1104, 0x82086400, 0x0010bc20, 0x50300800,
-- 0x825c0500, 0x00000003, 0x0c01f001, 0x00101c2c,
-- 0x00101c27, 0x00101c2b, 0x00101c29, 0x80040910,
-- 0x0401f004, 0x80040930, 0x0401f002, 0x80040920,
-- 0x82040500, 0x000000ff, 0x82000d80, 0x000000ff,
-- 0x0400000f, 0x4c000000, 0x82000400, 0x00101eb5,
-- 0x50000800, 0x80040910, 0x82040580, 0x00000080,
-- 0x5c000000, 0x04000030, 0x80600d80, 0x0400002e,
-- 0x80000540, 0x0400002c, 0x0401f00b, 0x59a81005,
-- 0x82081500, 0x00000003, 0x0402002b, 0x59a81013,
-- 0x84081542, 0x480b5013, 0x4a03501c, 0x0000ffff,
-- 0x0401f028, 0x4c000000, 0x59a8006f, 0x8c000502,
-- 0x42001000, 0x00000010, 0x02020800, 0x00104ada,
-- 0x5c000000, 0x0402001c, 0x417a8800, 0x0201f800,
-- 0x001059b9, 0x04020016, 0x0201f800, 0x0010443b,
-- 0x04000006, 0x0201f800, 0x00104acf, 0x0401f8b1,
-- 0x0400000f, 0x0401f00c, 0x599c0019, 0x8c00050e,
-- 0x04020009, 0x0201f800, 0x001043fc, 0x04020008,
-- 0x0201f800, 0x00104acf, 0x0401f9dd, 0x0401f8be,
-- 0x04000003, 0x805cb800, 0x0401f7b2, 0x485f501c,
-- 0x0401f086, 0x4a03501c, 0x0000ffff, 0x0401f083,
-- 0x42003000, 0x0000007e, 0x59a8001c, 0x82001580,
-+ 0x00000004, 0x0401ff71, 0x41786800, 0x0401ff75,
-+ 0x41785800, 0x42006000, 0x0000001e, 0x41786800,
-+ 0x0401ff6a, 0x42006800, 0x00000002, 0x0401ff6d,
-+ 0x42006800, 0x00000001, 0x0401ff64, 0x42006800,
-+ 0x000000f5, 0x0401ff67, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000004, 0x0401ff5b,
-+ 0x42006800, 0x00000020, 0x0401ff5e, 0x59a8106a,
-+ 0x0401f865, 0x42001800, 0x000200f5, 0x0401f897,
-+ 0x59a8106a, 0x0401f879, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000004, 0x0401ff4b,
-+ 0x41786800, 0x0401ff4f, 0x59c40001, 0x82000540,
-+ 0x00001000, 0x48038801, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000015, 0x0401ff3f,
-+ 0x0401ff4a, 0x40400000, 0x82000540, 0x00000002,
-+ 0x4c000000, 0x41785800, 0x42006000, 0x0000001e,
-+ 0x42006800, 0x00000015, 0x0401ff34, 0x5c000000,
-+ 0x40006800, 0x0401ff37, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000015, 0x0401ff2b,
-+ 0x0401ff36, 0x40400000, 0x82000500, 0x0000fffd,
-+ 0x4c000000, 0x41785800, 0x42006000, 0x0000001e,
-+ 0x42006800, 0x00000015, 0x0401ff20, 0x5c000000,
-+ 0x40006800, 0x0401ff23, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000014, 0x0401ff17,
-+ 0x0401ff22, 0x40400000, 0x82000540, 0x00000040,
-+ 0x4c000000, 0x41785800, 0x42006000, 0x0000001e,
-+ 0x42006800, 0x00000014, 0x0401ff0c, 0x5c000000,
-+ 0x40006800, 0x0401ff0f, 0x41785800, 0x42006000,
-+ 0x0000001e, 0x42006800, 0x00000014, 0x0401ff03,
-+ 0x0401ff0e, 0x40400000, 0x82000500, 0x0000ffbf,
-+ 0x4c000000, 0x41785800, 0x42006000, 0x0000001e,
-+ 0x42006800, 0x00000014, 0x0401fef8, 0x5c000000,
-+ 0x40006800, 0x0401fefb, 0x4a038886, 0x00002020,
-+ 0x0401f04c, 0x480bc857, 0x82080580, 0x00010000,
-+ 0x04020007, 0x82040d40, 0x00010000, 0x42001800,
-+ 0x00000001, 0x0401f82d, 0x0401f00f, 0x82080580,
-+ 0x00008000, 0x04000007, 0x82040d40, 0x00000000,
-+ 0x42001800, 0x00900001, 0x0401f824, 0x0401f006,
-+ 0x82040d40, 0x00008000, 0x42001800, 0x00100001,
-+ 0x0401f81e, 0x1c01f000, 0x480bc857, 0x82080580,
-+ 0x00010000, 0x04020008, 0x42001800, 0x000000a1,
-+ 0x0401f816, 0x42001800, 0x000000c1, 0x0401f813,
-+ 0x0401f011, 0x82080580, 0x00008000, 0x04000008,
-+ 0x42001800, 0x000400a1, 0x0401f80c, 0x42001800,
-+ 0x002000c1, 0x0401f809, 0x0401f007, 0x42001800,
-+ 0x000400a1, 0x0401f805, 0x42001800, 0x000000c1,
-+ 0x0401f802, 0x1c01f000, 0x480fc857, 0x41785800,
-+ 0x42006000, 0x0000001e, 0x41786800, 0x0401feb7,
-+ 0x400c6800, 0x80346960, 0x0401feba, 0x42006800,
-+ 0x00000001, 0x0401feb1, 0x400c6800, 0x0401feb5,
-+ 0x42006800, 0x00000003, 0x0401feac, 0x0401feb7,
-+ 0x40400000, 0x8c000504, 0x040207fc, 0x1c01f000,
-+ 0x42000000, 0x00000064, 0x80000040, 0x040207ff,
-+ 0x1c01f000, 0x4c5c0000, 0x4c600000, 0x4178b800,
-+ 0x0201f800, 0x00104614, 0x04020102, 0x59a8c023,
-+ 0x0201f800, 0x00104ca6, 0x04000003, 0x8c60c506,
-+ 0x0400000f, 0x8c60c500, 0x04020005, 0x8c60c50e,
-+ 0x02000800, 0x0010cb0c, 0x0401f0f6, 0x0401f9e9,
-+ 0x040200f4, 0x0201f800, 0x00104ca6, 0x04020004,
-+ 0x4a03501b, 0x0000ffff, 0x0401f0ee, 0x8c60c504,
-+ 0x04000004, 0x4a03501b, 0x0000ffff, 0x0401f0e9,
-+ 0x59a8c00f, 0x8260c500, 0x000000ff, 0x59a81012,
-+ 0x8c081500, 0x0400005f, 0x8c081502, 0x0402005d,
-+ 0x59a8b81b, 0x825c0d80, 0x0000ffff, 0x04020003,
-+ 0x4200b800, 0x00000001, 0x805c1104, 0x82086400,
-+ 0x0010b5f0, 0x50300800, 0x825c0500, 0x00000003,
-+ 0x0c01f001, 0x00101b1a, 0x00101b15, 0x00101b19,
-+ 0x00101b17, 0x80040910, 0x0401f004, 0x80040930,
-+ 0x0401f002, 0x80040920, 0x82040500, 0x000000ff,
-+ 0x82000d80, 0x000000ff, 0x0400000f, 0x4c000000,
-+ 0x82000400, 0x00101cdd, 0x50000800, 0x80040910,
-+ 0x82040580, 0x00000080, 0x5c000000, 0x04000032,
-+ 0x80600d80, 0x04000030, 0x80000540, 0x0400002e,
-+ 0x0401f00a, 0x830c1500, 0x00000003, 0x0402002e,
-+ 0x59a81012, 0x84081542, 0x480b5012, 0x4a03501b,
-+ 0x0000ffff, 0x0401f02b, 0x4c000000, 0x59a8006c,
-+ 0x8c000502, 0x42001000, 0x00000010, 0x02020800,
-+ 0x001049da, 0x5c000000, 0x0402001f, 0x417a8800,
-+ 0x0201f800, 0x00105854, 0x04020019, 0x0201f800,
-+ 0x001042f9, 0x04000007, 0x0201f800, 0x001049c5,
-+ 0x0201f800, 0x0010ca23, 0x04000011, 0x0401f00e,
-+ 0x599c0019, 0x8c00050e, 0x0402000b, 0x0201f800,
-+ 0x001042b1, 0x0402000a, 0x0201f800, 0x001049c5,
-+ 0x0201f800, 0x0010ca1e, 0x0201f800, 0x0010cae7,
-+ 0x04000003, 0x805cb800, 0x0401f7b0, 0x485f501b,
-+ 0x0401f088, 0x4a03501b, 0x0000ffff, 0x0401f085,
-+ 0x42003000, 0x0000007e, 0x59a8001b, 0x82001580,
- 0x0000ffff, 0x04020005, 0x80000d80, 0x4018b000,
- 0x4803c856, 0x0401f009, 0x8018b480, 0x04001004,
-- 0x40000800, 0x4803c856, 0x0401f004, 0x4a03501c,
-- 0x0000ffff, 0x0401f071, 0x4c040000, 0x4c580000,
-- 0x82040400, 0x00101eb5, 0x50000000, 0x82000500,
-- 0x000000ff, 0x80604580, 0x0400005c, 0x0201f800,
-- 0x001059ba, 0x04020061, 0x59a8006f, 0x8c000502,
-- 0x42001000, 0x00000010, 0x02020800, 0x00104ada,
-+ 0x40000800, 0x4803c856, 0x0401f004, 0x4a03501b,
-+ 0x0000ffff, 0x0401f073, 0x4c040000, 0x4c580000,
-+ 0x82040400, 0x00101cdd, 0x50000000, 0x82000500,
-+ 0x000000ff, 0x80604580, 0x0400005e, 0x0201f800,
-+ 0x00105855, 0x04020063, 0x59a8006c, 0x8c000502,
-+ 0x42001000, 0x00000010, 0x02020800, 0x001049da,
- 0x5c00b000, 0x5c000800, 0x040207d7, 0x4c040000,
-- 0x4c580000, 0x845cbd00, 0x0201f800, 0x00020267,
-- 0x04000008, 0x599c0019, 0x8c00050e, 0x04020047,
-- 0x0201f800, 0x00104401, 0x0402004c, 0x0401f002,
-- 0x845cbd40, 0x0201f800, 0x00104acf, 0x0201f800,
-- 0x00104836, 0x04020007, 0x59a80005, 0x8c000502,
-- 0x04000033, 0x59340200, 0x8c00050e, 0x04020030,
-- 0x59a81013, 0x8c081502, 0x04000025, 0x0201f800,
-- 0x00104858, 0x04000031, 0x8c5cbd00, 0x04020004,
-- 0x0201f800, 0x00104455, 0x0401f02c, 0x0401f9c8,
-- 0x0400002a, 0x42026000, 0x0010bbe8, 0x49366009,
-- 0x497a6008, 0x417a7800, 0x0401f920, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x0010393e, 0x0400001d, 0x41782800, 0x42003000,
-- 0x00000008, 0x4d400000, 0x4d440000, 0x59368c03,
-- 0x42028000, 0x00000029, 0x0201f800, 0x0010a258,
-- 0x5c028800, 0x5c028000, 0x0401f010, 0x4937c857,
-- 0x599c0019, 0x8c00050e, 0x0402000c, 0x0401f968,
-- 0x0401f849, 0x04000011, 0x0401f008, 0x59a80013,
-- 0x8c000500, 0x04000003, 0x0401f9a1, 0x04000003,
-- 0x0401f828, 0x04000009, 0x5c00b000, 0x5c000800,
-- 0x80040800, 0x8058b040, 0x04020798, 0x4a03501c,
-- 0x0000ffff, 0x0401f005, 0x4937c857, 0x5c00b000,
-- 0x5c000800, 0x4807501c, 0x5c00c000, 0x5c00b800,
-- 0x1c01f000, 0x4803c856, 0x4a03501c, 0x00000001,
-- 0x42028800, 0x000007fe, 0x42003000, 0x00fffffe,
-- 0x0201f800, 0x001043fc, 0x0402000c, 0x0401f944,
-- 0x0401f825, 0x04000009, 0x59a80026, 0x8400054e,
-- 0x48035026, 0x0201f800, 0x001090d5, 0x82000540,
-- 0x00000001, 0x1c01f000, 0x80000580, 0x0401f7fe,
-- 0x4937c857, 0x0201f800, 0x001076c9, 0x04000015,
-+ 0x4c580000, 0x845cbd00, 0x0201f800, 0x0002025a,
-+ 0x04000008, 0x599c0019, 0x8c00050e, 0x04020049,
-+ 0x0201f800, 0x001042b6, 0x0402004e, 0x0401f002,
-+ 0x845cbd40, 0x0201f800, 0x001049c5, 0x0201f800,
-+ 0x00104719, 0x04020006, 0x8d0e1d02, 0x04000035,
-+ 0x59340200, 0x8c00050e, 0x04020032, 0x59a81012,
-+ 0x8c081502, 0x04000025, 0x0201f800, 0x00104744,
-+ 0x04000034, 0x8c5cbd00, 0x04020004, 0x0201f800,
-+ 0x00104313, 0x0401f02f, 0x0401f8f8, 0x0400002d,
-+ 0x42026000, 0x0010b5b8, 0x49366009, 0x497a6008,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x8d0e1d20,
-+ 0x04000020, 0x41782800, 0x42003000, 0x00000008,
-+ 0x4d400000, 0x4d440000, 0x59368c03, 0x42028000,
-+ 0x00000029, 0x0201f800, 0x00109c1c, 0x5c028800,
-+ 0x5c028000, 0x0401f013, 0x4937c857, 0x599c0019,
-+ 0x8c00050e, 0x0402000f, 0x0201f800, 0x0010ca1e,
-+ 0x0201f800, 0x0010cae7, 0x04000012, 0x0401f009,
-+ 0x59a80012, 0x8c000500, 0x04000003, 0x0401f8cf,
-+ 0x04000004, 0x0201f800, 0x0010ca23, 0x04000009,
-+ 0x5c00b000, 0x5c000800, 0x80040800, 0x8058b040,
-+ 0x04020796, 0x4a03501b, 0x0000ffff, 0x0401f005,
-+ 0x4937c857, 0x5c00b000, 0x5c000800, 0x4807501b,
-+ 0x5c00c000, 0x5c00b800, 0x1c01f000, 0x4803c856,
-+ 0x42028800, 0x000007fc, 0x42003000, 0x00fffffc,
-+ 0x0201f800, 0x001042b1, 0x04020005, 0x0401f805,
-+ 0x04000003, 0x4a035024, 0x0000ffff, 0x1c01f000,
-+ 0x4937c857, 0x0201f800, 0x001071d5, 0x04000014,
- 0x49366009, 0x4a026406, 0x00000001, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x59a8001b, 0x80000000,
-- 0x4803501b, 0x42027000, 0x00000004, 0x599c0019,
-- 0x8c00050e, 0x04000003, 0x42027000, 0x00000000,
-- 0x0201f800, 0x000208d8, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x4937c857, 0x0201f800, 0x001076c9,
-- 0x0400001c, 0x49366009, 0x59340403, 0x82000580,
-- 0x000007fe, 0x04000005, 0x4d3c0000, 0x417a7800,
-- 0x0401f8b2, 0x5c027800, 0x4a026406, 0x00000001,
-- 0x417a7800, 0x0201f800, 0x001043bd, 0x42000800,
-- 0x00000003, 0x0201f800, 0x001043c7, 0x59a8001b,
-- 0x80000000, 0x4803501b, 0x42027000, 0x00000002,
-- 0x0201f800, 0x000208d8, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x4803c856, 0x42028800, 0x000007fc,
-- 0x42003000, 0x00fffffc, 0x0201f800, 0x001043fc,
-- 0x04020005, 0x0401f805, 0x04000003, 0x4a035027,
-- 0x0000ffff, 0x1c01f000, 0x4937c857, 0x0201f800,
-- 0x001076c9, 0x04000014, 0x49366009, 0x4a026406,
-- 0x00000001, 0x417a7800, 0x0201f800, 0x001043bd,
-- 0x42000800, 0x00000003, 0x0201f800, 0x001043c7,
-- 0x59a80028, 0x80000000, 0x48035028, 0x42027000,
-- 0x00000002, 0x0201f800, 0x000208d8, 0x82000540,
-- 0x00000001, 0x1c01f000, 0x480bc857, 0x492fc857,
-- 0x4c5c0000, 0x4008b800, 0x42028800, 0x000007fd,
-- 0x42003000, 0x00fffffd, 0x0201f800, 0x001043fc,
-- 0x0402001a, 0x0201f800, 0x00020892, 0x04000017,
-- 0x49366009, 0x5934000a, 0x84000544, 0x4802680a,
-- 0x812e59c0, 0x04000005, 0x592c0404, 0x8c00051e,
-- 0x04000002, 0x48ee6021, 0x492e6008, 0x4a026406,
-- 0x00000001, 0x485e601c, 0x42027000, 0x00000022,
-- 0x0201f800, 0x000208d8, 0x82000540, 0x00000001,
-- 0x5c00b800, 0x1c01f000, 0x80000580, 0x0401f7fd,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4943c857,
-- 0x493fc857, 0x4d340000, 0x4d440000, 0x4c580000,
-- 0x4d2c0000, 0x4c5c0000, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x0201f800, 0x0010673a, 0x0201f800,
-- 0x001067ee, 0x0201f800, 0x0010647f, 0x0201f800,
-- 0x0010822b, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x4200b000, 0x000007f0, 0x417a8800, 0x0201f800,
-- 0x00020267, 0x0402001a, 0x8d3e7d06, 0x04000004,
-- 0x59340200, 0x8c00050e, 0x04020015, 0x8d3e7d18,
-- 0x04000010, 0x5934b80f, 0x805cb9c0, 0x04000009,
-- 0x49425a06, 0x592cb800, 0x0201f800, 0x00020381,
-- 0x805cb9c0, 0x040207fb, 0x497a680f, 0x497a6810,
-- 0x4937c857, 0x4a026c00, 0x00000707, 0x0401f004,
-- 0x4937c857, 0x0201f800, 0x001040e4, 0x81468800,
-- 0x8058b040, 0x040207e2, 0x8d3e7d02, 0x04000011,
-- 0x497b501d, 0x42028800, 0x000007f0, 0x4200b000,
-- 0x00000010, 0x0201f800, 0x00020267, 0x04020006,
-- 0x4937c857, 0x4a026c00, 0x00000707, 0x0201f800,
-- 0x001040e4, 0x81468800, 0x8058b040, 0x040207f6,
-- 0x5c00b800, 0x5c025800, 0x5c00b000, 0x5c028800,
-- 0x5c026800, 0x1c01f000, 0x5c000000, 0x4c000000,
-- 0x4803c857, 0x4933c857, 0x493fc857, 0x4d340000,
-- 0x4d400000, 0x4d440000, 0x4d2c0000, 0x4c5c0000,
-- 0x0201f800, 0x0010698c, 0x4df00000, 0x59326809,
-- 0x813669c0, 0x04000021, 0x59368c03, 0x42028000,
-- 0x00000029, 0x0201f800, 0x0010679b, 0x0201f800,
-- 0x001067f6, 0x0201f800, 0x00106543, 0x0201f800,
-- 0x0010a0da, 0x4937c857, 0x8d3e7d18, 0x04000011,
-- 0x5934b80f, 0x805cb9c0, 0x0400000a, 0x405e5800,
-- 0x49425a06, 0x592cb800, 0x0201f800, 0x00020381,
-- 0x805cb9c0, 0x040207fa, 0x497a680f, 0x497a6810,
-- 0x4937c857, 0x4a026c00, 0x00000707, 0x0401f003,
-- 0x0201f800, 0x001040e4, 0x5c03e000, 0x02000800,
-- 0x00106982, 0x5c00b800, 0x5c025800, 0x5c028800,
-- 0x5c028000, 0x5c026800, 0x1c01f000, 0x4933c857,
-- 0x59a80026, 0x8c000508, 0x04020012, 0x59305009,
-- 0x482bc857, 0x836c0580, 0x00000002, 0x0402000d,
-- 0x0401f813, 0x0402000b, 0x58280403, 0x82000580,
-- 0x000007fc, 0x04000008, 0x59a8001b, 0x80000040,
-- 0x4803c857, 0x02001800, 0x00100615, 0x4803501b,
-- 0x1c01f000, 0x59a80028, 0x80000040, 0x4803c857,
-- 0x040017fc, 0x48035028, 0x1c01f000, 0x59300008,
-- 0x800001c0, 0x04020009, 0x59300403, 0x82000580,
-- 0x00000001, 0x04020004, 0x82000540, 0x00000001,
-- 0x0401f002, 0x80000580, 0x1c01f000, 0x4937c857,
-- 0x59340200, 0x84000502, 0x48026a00, 0x1c01f000,
-- 0x4933c857, 0x493fc857, 0x4947c857, 0x4d400000,
-- 0x4d340000, 0x4d440000, 0x4c580000, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x8060c1c0, 0x04020004,
-- 0x4200b000, 0x00000001, 0x0401f004, 0x4200b000,
-- 0x000007f0, 0x417a8800, 0x41440000, 0x81ac0400,
-- 0x50000000, 0x80026d40, 0x0400001a, 0x4d3c0000,
-- 0x42027800, 0x00000001, 0x0201f800, 0x00104745,
-- 0x5c027800, 0x42028000, 0x00000029, 0x0201f800,
-- 0x0010679b, 0x0201f800, 0x001067f6, 0x0201f800,
-- 0x00106543, 0x0201f800, 0x00104836, 0x04020005,
-- 0x4937c857, 0x4a026c00, 0x00000404, 0x0401f003,
-- 0x0201f800, 0x00104863, 0x0201f800, 0x0010a0da,
-- 0x81468800, 0x8058b040, 0x040207e0, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x5c00b000, 0x5c028800,
-- 0x5c026800, 0x5c028000, 0x1c01f000, 0x4937c857,
-- 0x4947c857, 0x4c5c0000, 0x4c600000, 0x4c640000,
-- 0x59a80013, 0x8c000500, 0x0400001f, 0x599c0017,
-- 0x8c00050a, 0x0402001c, 0x5934ba02, 0x825cbd00,
-- 0x000000ff, 0x485fc857, 0x4178c000, 0x4178c800,
-- 0x82600400, 0x0010bc20, 0x50002000, 0x8060c1c0,
-- 0x04000008, 0x82100500, 0x000000ff, 0x82002d80,
-- 0x000000ff, 0x0400000c, 0x805c0580, 0x0400000d,
-- 0x80102110, 0x8064c800, 0x82640580, 0x00000004,
-- 0x040207f5, 0x8060c000, 0x82600580, 0x00000020,
-- 0x040207eb, 0x4813c857, 0x82000540, 0x00000001,
-- 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x1c01f000,
-- 0x59a80026, 0x8c000512, 0x02020800, 0x001006ba,
-+ 0x0201f800, 0x0010425d, 0x42000800, 0x00000003,
-+ 0x0201f800, 0x0010426c, 0x59a80025, 0x80000000,
-+ 0x48035025, 0x42027000, 0x00000002, 0x0201f800,
-+ 0x000207df, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x480bc857, 0x492fc857, 0x4c5c0000, 0x4008b800,
-+ 0x42028800, 0x000007fd, 0x42003000, 0x00fffffd,
-+ 0x0201f800, 0x001042b1, 0x0402001a, 0x0201f800,
-+ 0x00020799, 0x04000017, 0x49366009, 0x5934000a,
-+ 0x84000544, 0x4802680a, 0x812e59c0, 0x04000005,
-+ 0x592c0404, 0x8c00051e, 0x04000002, 0x48ee6021,
-+ 0x492e6008, 0x4a026406, 0x00000001, 0x485e601c,
-+ 0x42027000, 0x00000022, 0x0201f800, 0x000207df,
-+ 0x82000540, 0x00000001, 0x5c00b800, 0x1c01f000,
-+ 0x80000580, 0x0401f7fd, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4933c857, 0x59a80023,
-+ 0x8c000508, 0x04020012, 0x59305009, 0x482bc857,
-+ 0x836c0580, 0x00000002, 0x0402000d, 0x0401f813,
-+ 0x0402000b, 0x58280403, 0x82000580, 0x000007fc,
-+ 0x04000008, 0x59a8001a, 0x80000040, 0x4803c857,
-+ 0x02001800, 0x001004ef, 0x4803501a, 0x1c01f000,
-+ 0x59a80025, 0x80000040, 0x4803c857, 0x040017fc,
-+ 0x48035025, 0x1c01f000, 0x59300008, 0x800001c0,
-+ 0x04020009, 0x59300403, 0x82000580, 0x00000001,
-+ 0x04020004, 0x82000540, 0x00000001, 0x0401f002,
-+ 0x80000580, 0x1c01f000, 0x4933c857, 0x493fc857,
-+ 0x4947c857, 0x4d400000, 0x4d340000, 0x4d440000,
-+ 0x4c580000, 0x0201f800, 0x00106476, 0x4df00000,
-+ 0x8060c1c0, 0x04020004, 0x4200b000, 0x00000001,
-+ 0x0401f004, 0x4200b000, 0x000007f0, 0x417a8800,
-+ 0x41440000, 0x81ac0400, 0x50000000, 0x80026d40,
-+ 0x0400001a, 0x4d3c0000, 0x42027800, 0x00000001,
-+ 0x0201f800, 0x0010461e, 0x5c027800, 0x42028000,
-+ 0x00000029, 0x0201f800, 0x0010ce09, 0x0201f800,
-+ 0x0010cef7, 0x0201f800, 0x0010cf9c, 0x0201f800,
-+ 0x00104719, 0x04020005, 0x4937c857, 0x4a026c00,
-+ 0x00000404, 0x0401f003, 0x0201f800, 0x0010474f,
-+ 0x0201f800, 0x0010d28a, 0x81468800, 0x8058b040,
-+ 0x040207e0, 0x5c03e000, 0x02000800, 0x00106463,
-+ 0x5c00b000, 0x5c028800, 0x5c026800, 0x5c028000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4937c857, 0x4947c857,
-+ 0x4c5c0000, 0x4c600000, 0x4c640000, 0x59a80012,
-+ 0x8c000500, 0x0400001f, 0x599c0017, 0x8c00050a,
-+ 0x0402001c, 0x5934ba02, 0x825cbd00, 0x000000ff,
-+ 0x485fc857, 0x4178c000, 0x4178c800, 0x82600400,
-+ 0x0010b5f0, 0x50002000, 0x8060c1c0, 0x04000008,
-+ 0x82100500, 0x000000ff, 0x82002d80, 0x000000ff,
-+ 0x0400000c, 0x805c0580, 0x0400000d, 0x80102110,
-+ 0x8064c800, 0x82640580, 0x00000004, 0x040207f5,
-+ 0x8060c000, 0x82600580, 0x00000020, 0x040207eb,
-+ 0x4813c857, 0x82000540, 0x00000001, 0x5c00c800,
-+ 0x5c00c000, 0x5c00b800, 0x1c01f000, 0x4c000000,
-+ 0x0401f808, 0x42018800, 0x00000001, 0x04020003,
-+ 0x42018800, 0x00000000, 0x5c000000, 0x1c01f000,
-+ 0x59a80023, 0x8c000512, 0x02020800, 0x00100594,
- 0x1c01f000, 0x00007eef, 0x00007de8, 0x00007ce4,
- 0x000080e2, 0x00007be1, 0x000080e0, 0x000080dc,
- 0x000080da, 0x00007ad9, 0x000080d6, 0x000080d5,
-@@ -2081,267 +1950,267 @@ uint32_t risc_code01[] = {
- 0x00008000, 0x00008000, 0x00008000, 0x00008000,
- 0x00008000, 0x00008000, 0x00008000, 0x00008000,
- 0x00008000, 0x00008000, 0x00008000, 0x00008000,
-- 0x00008000, 0x0201f800, 0x00100819, 0x02000800,
-- 0x00100615, 0x492f4016, 0x1c01f000, 0x83a0ac00,
-- 0x00000006, 0x83a00580, 0x0010b2a0, 0x0400000c,
-- 0x492fc857, 0x812e59c0, 0x02000800, 0x00100615,
-+ 0x00008000, 0x0201f800, 0x00100704, 0x02000800,
-+ 0x001004ef, 0x492f4016, 0x1c01f000, 0x83a0ac00,
-+ 0x00000006, 0x83a00580, 0x0010ac71, 0x0400000c,
-+ 0x492fc857, 0x812e59c0, 0x02000800, 0x001004ef,
- 0x832ca400, 0x00000006, 0x4200b000, 0x0000000d,
-- 0x0201f800, 0x0010a93e, 0x0401f00f, 0x4200b000,
-+ 0x0201f800, 0x0010a330, 0x0401f00f, 0x4200b000,
- 0x00000010, 0x83e0a400, 0x00000020, 0x50500000,
- 0x8050a000, 0x50500800, 0x900409c0, 0x80040540,
- 0x4400a800, 0x8050a000, 0x8054a800, 0x8058b040,
- 0x040207f7, 0x1c01f000, 0x59a00206, 0x82000c80,
-- 0x0000007f, 0x040210c9, 0x59a80821, 0x0c01f001,
-- 0x00102066, 0x001020a6, 0x001020a6, 0x001020f0,
-- 0x00102112, 0x001020a6, 0x00102066, 0x00102134,
-- 0x00102145, 0x001020a6, 0x001020a6, 0x00102152,
-- 0x0010216a, 0x00102182, 0x001020a6, 0x001021b1,
-- 0x001021e3, 0x001020a6, 0x0010220c, 0x001020a6,
-- 0x00102269, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001020a6, 0x00102280, 0x001022b9, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001022ee, 0x001020a6, 0x00102340, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x00102345,
-- 0x001023be, 0x001020a6, 0x001023c5, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001023c7, 0x00102445, 0x00102585, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x00102594, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001025b1, 0x00102604, 0x00102660, 0x00102674,
-- 0x00102696, 0x001028d1, 0x00102c60, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001020a6, 0x001020a6, 0x001020a6, 0x00102d9f,
-- 0x00102e13, 0x001020a6, 0x001020a6, 0x00102e81,
-- 0x001020a6, 0x00102f1f, 0x00102fd1, 0x001020a6,
-- 0x001020a6, 0x00103008, 0x00103064, 0x001020a6,
-- 0x001030bc, 0x00103220, 0x001020a6, 0x00103234,
-- 0x001032bf, 0x001020a6, 0x001020a6, 0x001020a6,
-- 0x001020a6, 0x0010332f, 0x00103333, 0x00103352,
-- 0x001020a6, 0x001033f4, 0x001020a6, 0x001020a6,
-- 0x00103421, 0x001020a6, 0x0010344f, 0x001020a6,
-- 0x001020a6, 0x001034b6, 0x001035c3, 0x00103620,
-- 0x001020a6, 0x00103686, 0x001020a6, 0x001020a6,
-- 0x001036db, 0x0010373e, 0x001020a6, 0x48efc857,
-- 0x4031d800, 0x58ef400b, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x04000045, 0x48efc857, 0x4a034206,
-- 0x00004000, 0x0201f800, 0x0010382f, 0x83a00580,
-- 0x0010b2a0, 0x0400000d, 0x58ee580a, 0x4d2c0000,
-- 0x0401f856, 0x41a25800, 0x0201f800, 0x0010083a,
-- 0x40ee5800, 0x0201f800, 0x0010083a, 0x5c025800,
-- 0x0201f000, 0x00020381, 0x04026007, 0x59a0001d,
-- 0x84000542, 0x4803401d, 0x4a01d809, 0x0010207a,
-- 0x1c01f000, 0x59a00206, 0x82000d80, 0x00004000,
-- 0x04000006, 0x900001c0, 0x82000540, 0x00000011,
-- 0x4803c011, 0x0401f005, 0x900001c0, 0x82000540,
-- 0x00000010, 0x4803c011, 0x0401f844, 0x59e00017,
-- 0x8c000508, 0x0402000c, 0x4203e000, 0x30000001,
-- 0x4203e000, 0x40000000, 0x40ee5800, 0x0201f800,
-- 0x0010083a, 0x59a0001d, 0x84000504, 0x4803401d,
-- 0x1c01f000, 0x4a03c017, 0x00000000, 0x59a00206,
-- 0x82000d80, 0x00004000, 0x040007f0, 0x4a03c017,
-- 0x00000001, 0x0401f7ed, 0x4803c856, 0x4a034206,
-- 0x00004001, 0x0401f7c0, 0x4803c856, 0x4a034206,
-- 0x00004002, 0x0401f7bc, 0x4803c856, 0x4a034206,
-- 0x00004003, 0x0401f7b8, 0x4803c856, 0x4a034206,
-- 0x00004005, 0x0401f7b4, 0x4803c856, 0x4a034206,
-- 0x00004006, 0x0401f7b0, 0x4803c856, 0x4a034206,
-- 0x0000400b, 0x0401f7ac, 0x4803c856, 0x4a034206,
-- 0x0000400c, 0x0401f7a8, 0x4803c856, 0x4a034206,
-- 0x0000400c, 0x0401f7a4, 0x58eca80a, 0x8054a9c0,
-- 0x02000800, 0x00100615, 0x83a0a400, 0x00000006,
-- 0x8254ac00, 0x00000006, 0x4200b000, 0x0000000d,
-- 0x0201f000, 0x0010a93e, 0x59a00206, 0x4803c857,
-- 0x59a00406, 0x4803c857, 0x59a00207, 0x4803c857,
-- 0x59a00407, 0x4803c857, 0x59a00208, 0x4803c857,
-- 0x59a00408, 0x4803c857, 0x59a00209, 0x4803c857,
-- 0x83e0ac00, 0x00000020, 0x83a0a400, 0x00000006,
-- 0x4200b000, 0x00000010, 0x50500000, 0x4400a800,
-- 0x8054a800, 0x900001c0, 0x4400a800, 0x8054a800,
-- 0x8050a000, 0x8058b040, 0x040207f8, 0x1c01f000,
-- 0x59a00406, 0x800000c2, 0x59a00a07, 0x900409c0,
-- 0x80040540, 0x84000540, 0x59a00c07, 0x8c040d00,
-- 0x04000018, 0x59a8086f, 0x8c040d00, 0x040207bb,
-- 0x42000800, 0x00000064, 0x80040840, 0x04000007,
-- 0x4a030000, 0x00000001, 0x40000000, 0x59801000,
-- 0x8c081500, 0x040007f9, 0x04000005, 0x48030004,
-- 0x4a030000, 0x00000000, 0x0401f75c, 0x4a030000,
-- 0x00000000, 0x4a034406, 0x00000004, 0x040007a3,
-- 0x4803880e, 0x0401f755, 0x59a00406, 0x800000c2,
-- 0x59a00c07, 0x8c040d00, 0x0400001a, 0x59a8086f,
-- 0x8c040d00, 0x0402079d, 0x42000800, 0x00000064,
-- 0x80040840, 0x04000007, 0x4a030000, 0x00000001,
-- 0x40000000, 0x59801000, 0x8c081500, 0x040007f9,
-- 0x04000007, 0x48030004, 0x59800805, 0x48074406,
-- 0x4a030000, 0x00000000, 0x0401f73c, 0x4a030000,
-- 0x00000000, 0x4a034406, 0x00000004, 0x04000783,
-- 0x4803880e, 0x59c4080f, 0x48074406, 0x0401f733,
-- 0x59a01c06, 0x59a00207, 0x900c19c0, 0x800c1d40,
-- 0x580c0803, 0x80000580, 0x500c1000, 0x80080400,
-- 0x800c1800, 0x80040840, 0x040207fc, 0x48034406,
-- 0x900001c0, 0x48034207, 0x800001c0, 0x04000723,
-- 0x0401f76a, 0x4a034406, 0x00000004, 0x4a034207,
-- 0x00000000, 0x4a034407, 0x00000012, 0x59a8000d,
-- 0x48034208, 0x900001c0, 0x48034408, 0x4a034209,
-- 0x00000002, 0x0401f715, 0x59a00407, 0x59a01207,
-- 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
-- 0x900c19c0, 0x800c1d40, 0x59a00a08, 0x59a00408,
-- 0x900409c0, 0x80040d40, 0x59a0020a, 0x82002480,
-- 0x00000010, 0x04001755, 0x59a02406, 0x900001c0,
-- 0x80100540, 0x59a8280d, 0x80142480, 0x0400174f,
-- 0x0201f000, 0x0010383e, 0x59a00407, 0x59a01207,
-- 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
-- 0x900c19c0, 0x800c1d40, 0x59a00a08, 0x59a00408,
-- 0x900409c0, 0x80040d40, 0x59a0020a, 0x82002480,
-- 0x00000010, 0x0400173d, 0x59a02406, 0x900001c0,
-- 0x80100540, 0x59a8280d, 0x80142480, 0x04001737,
-- 0x0201f000, 0x00103841, 0x59a02407, 0x59a00207,
-- 0x901021c0, 0x80102540, 0x59a01a0a, 0x59a00406,
-- 0x900c19c0, 0x800c1d40, 0x41781000, 0x42000000,
-- 0x00001000, 0x50000000, 0x82000480, 0x24320001,
-- 0x04001016, 0x820c0580, 0x00007c00, 0x04000013,
-- 0x820c0480, 0x00007a00, 0x04001010, 0x820c0480,
-- 0x00007cff, 0x0402100d, 0x42000800, 0x00000064,
-- 0x80040840, 0x04000007, 0x4a030000, 0x00000001,
-- 0x40000000, 0x59800000, 0x8c000500, 0x040007f9,
-- 0x04000008, 0x80081000, 0x44101800, 0x800811c0,
-- 0x040006be, 0x4a030000, 0x00000000, 0x0401f6bb,
-- 0x4a030000, 0x00000000, 0x4a034406, 0x00000004,
-- 0x0401f702, 0x59a01a0a, 0x59a00406, 0x900c19c0,
-+ 0x0000007f, 0x040210c8, 0x0c01f001, 0x00101e8d,
-+ 0x00101ecd, 0x00101ecd, 0x00101f17, 0x00101f39,
-+ 0x00101ecd, 0x00101e8d, 0x00101f5b, 0x00101f6c,
-+ 0x00101ecd, 0x00101ecd, 0x00101f79, 0x00101f91,
-+ 0x00101fa9, 0x00101ecd, 0x00101fd8, 0x0010200a,
-+ 0x00101ecd, 0x00102033, 0x00101ecd, 0x0010208e,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x00101ecd,
-+ 0x001020a5, 0x001020d6, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x0010210b,
-+ 0x00101ecd, 0x0010215d, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00102162, 0x001021e6,
-+ 0x00101ecd, 0x001021ed, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x001021ef,
-+ 0x0010226d, 0x001023ad, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x001023bc,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x001023d9,
-+ 0x0010242c, 0x00102488, 0x0010249b, 0x001024b9,
-+ 0x001026fd, 0x00102a86, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x00101ecd,
-+ 0x00101ecd, 0x00101ecd, 0x00102bc5, 0x00102c39,
-+ 0x00101ecd, 0x00101ecd, 0x00102ca7, 0x00101ecd,
-+ 0x00102d45, 0x00102df5, 0x00101ecd, 0x00101ecd,
-+ 0x00102e2c, 0x00102e84, 0x00101ecd, 0x00102edc,
-+ 0x00103042, 0x00101ecd, 0x00103056, 0x001030e1,
-+ 0x00101ecd, 0x00101ecd, 0x00101ecd, 0x00101ecd,
-+ 0x00103151, 0x00103155, 0x00103174, 0x00101ecd,
-+ 0x00103216, 0x00101ecd, 0x00101ecd, 0x00103243,
-+ 0x00101ecd, 0x00103272, 0x00101ecd, 0x00101ecd,
-+ 0x001032d7, 0x00103430, 0x0010348d, 0x00101ecd,
-+ 0x001034f3, 0x00101ecd, 0x00101ecd, 0x00103548,
-+ 0x001035da, 0x00101ecd, 0x48efc857, 0x4031d800,
-+ 0x58ef400b, 0x58ec0002, 0x82000580, 0x00000200,
-+ 0x04000045, 0x48efc857, 0x4a034206, 0x00004000,
-+ 0x0201f800, 0x001036cb, 0x83a00580, 0x0010ac71,
-+ 0x0400000d, 0x58ee580a, 0x4d2c0000, 0x0401f856,
-+ 0x41a25800, 0x0201f800, 0x0010072e, 0x40ee5800,
-+ 0x0201f800, 0x0010072e, 0x5c025800, 0x0201f000,
-+ 0x000202e9, 0x04026007, 0x59a0001d, 0x84000542,
-+ 0x4803401d, 0x4a01d809, 0x00101ea1, 0x1c01f000,
-+ 0x59a00206, 0x82000d80, 0x00004000, 0x04000006,
-+ 0x900001c0, 0x82000540, 0x00000011, 0x4803c011,
-+ 0x0401f005, 0x900001c0, 0x82000540, 0x00000010,
-+ 0x4803c011, 0x0401f844, 0x59e00017, 0x8c000508,
-+ 0x0402000c, 0x4203e000, 0x30000001, 0x4203e000,
-+ 0x40000000, 0x40ee5800, 0x0201f800, 0x0010072e,
-+ 0x59a0001d, 0x84000504, 0x4803401d, 0x1c01f000,
-+ 0x4a03c017, 0x00000000, 0x59a00206, 0x82000d80,
-+ 0x00004000, 0x040007f0, 0x4a03c017, 0x00000001,
-+ 0x0401f7ed, 0x4803c856, 0x4a034206, 0x00004001,
-+ 0x0401f7c0, 0x4803c856, 0x4a034206, 0x00004002,
-+ 0x0401f7bc, 0x4803c856, 0x4a034206, 0x00004003,
-+ 0x0401f7b8, 0x4803c856, 0x4a034206, 0x00004005,
-+ 0x0401f7b4, 0x4803c856, 0x4a034206, 0x00004006,
-+ 0x0401f7b0, 0x4803c856, 0x4a034206, 0x0000400b,
-+ 0x0401f7ac, 0x4803c856, 0x4a034206, 0x0000400c,
-+ 0x0401f7a8, 0x4803c856, 0x4a034206, 0x0000400c,
-+ 0x0401f7a4, 0x58eca80a, 0x8054a9c0, 0x02000800,
-+ 0x001004ef, 0x83a0a400, 0x00000006, 0x8254ac00,
-+ 0x00000006, 0x4200b000, 0x0000000d, 0x0201f000,
-+ 0x0010a330, 0x59a00206, 0x4803c857, 0x59a00406,
-+ 0x4803c857, 0x59a00207, 0x4803c857, 0x59a00407,
-+ 0x4803c857, 0x59a00208, 0x4803c857, 0x59a00408,
-+ 0x4803c857, 0x59a00209, 0x4803c857, 0x83e0ac00,
-+ 0x00000020, 0x83a0a400, 0x00000006, 0x4200b000,
-+ 0x00000010, 0x50500000, 0x4400a800, 0x8054a800,
-+ 0x900001c0, 0x4400a800, 0x8054a800, 0x8050a000,
-+ 0x8058b040, 0x040207f8, 0x1c01f000, 0x59a00406,
-+ 0x800000c2, 0x59a00a07, 0x900409c0, 0x80040540,
-+ 0x84000540, 0x59a00c07, 0x8c040d00, 0x04000018,
-+ 0x59a8086c, 0x8c040d00, 0x040207bb, 0x42000800,
-+ 0x00000064, 0x80040840, 0x04000007, 0x4a030000,
-+ 0x00000001, 0x40000000, 0x59801000, 0x8c081500,
-+ 0x040007f9, 0x04000005, 0x48030004, 0x4a030000,
-+ 0x00000000, 0x0401f75c, 0x4a030000, 0x00000000,
-+ 0x4a034406, 0x00000004, 0x040007a3, 0x4803880e,
-+ 0x0401f755, 0x59a00406, 0x800000c2, 0x59a00c07,
-+ 0x8c040d00, 0x0400001a, 0x59a8086c, 0x8c040d00,
-+ 0x0402079d, 0x42000800, 0x00000064, 0x80040840,
-+ 0x04000007, 0x4a030000, 0x00000001, 0x40000000,
-+ 0x59801000, 0x8c081500, 0x040007f9, 0x04000007,
-+ 0x48030004, 0x59800805, 0x48074406, 0x4a030000,
-+ 0x00000000, 0x0401f73c, 0x4a030000, 0x00000000,
-+ 0x4a034406, 0x00000004, 0x04000783, 0x4803880e,
-+ 0x59c4080f, 0x48074406, 0x0401f733, 0x59a01c06,
-+ 0x59a00207, 0x900c19c0, 0x800c1d40, 0x580c0803,
-+ 0x80000580, 0x500c1000, 0x80080400, 0x800c1800,
-+ 0x80040840, 0x040207fc, 0x48034406, 0x900001c0,
-+ 0x48034207, 0x800001c0, 0x04000723, 0x0401f76a,
-+ 0x4a034406, 0x00000004, 0x4a034207, 0x00000000,
-+ 0x4a034407, 0x00000017, 0x59a8000c, 0x48034208,
-+ 0x900001c0, 0x48034408, 0x4a034209, 0x00000002,
-+ 0x0401f715, 0x59a00407, 0x59a01207, 0x900811c0,
-+ 0x80081540, 0x59a00409, 0x59a01a09, 0x900c19c0,
-+ 0x800c1d40, 0x59a00a08, 0x59a00408, 0x900409c0,
-+ 0x80040d40, 0x59a0020a, 0x82002480, 0x00000010,
-+ 0x04001755, 0x59a02406, 0x900001c0, 0x80100540,
-+ 0x59a8280c, 0x80142480, 0x0400174f, 0x0201f000,
-+ 0x001036da, 0x59a00407, 0x59a01207, 0x900811c0,
-+ 0x80081540, 0x59a00409, 0x59a01a09, 0x900c19c0,
-+ 0x800c1d40, 0x59a00a08, 0x59a00408, 0x900409c0,
-+ 0x80040d40, 0x59a0020a, 0x82002480, 0x00000010,
-+ 0x0400173d, 0x59a02406, 0x900001c0, 0x80100540,
-+ 0x59a8280c, 0x80142480, 0x04001737, 0x0201f000,
-+ 0x001036dd, 0x59a02407, 0x59a00207, 0x901021c0,
-+ 0x80102540, 0x59a01a0a, 0x59a00406, 0x900c19c0,
- 0x800c1d40, 0x41781000, 0x42000000, 0x00001000,
- 0x50000000, 0x82000480, 0x24320001, 0x04001016,
- 0x820c0580, 0x00007c00, 0x04000013, 0x820c0480,
- 0x00007a00, 0x04001010, 0x820c0480, 0x00007cff,
- 0x0402100d, 0x42000800, 0x00000064, 0x80040840,
- 0x04000007, 0x4a030000, 0x00000001, 0x40000000,
-- 0x59800000, 0x8c000500, 0x040007f9, 0x0400000f,
-- 0x80081000, 0x500c0000, 0x82000d00, 0x0000ffff,
-- 0x48074207, 0x82000d00, 0xffff0000, 0x900409c0,
-- 0x48074407, 0x800811c0, 0x0400068c, 0x4a030000,
-- 0x00000000, 0x0401f689, 0x4a030000, 0x00000000,
-- 0x4a034406, 0x00000004, 0x0401f6d0, 0x59a00406,
-- 0x8c000500, 0x04000020, 0x59a01207, 0x59a01c07,
-- 0x59a02208, 0x480b5054, 0x480f5055, 0x48135056,
-- 0x59c40801, 0x82040d00, 0x00018000, 0x82040580,
-- 0x00000000, 0x04000009, 0x82040580, 0x00008000,
-- 0x04000008, 0x82040580, 0x00010000, 0x04000007,
-- 0x0201f800, 0x00100615, 0x40080000, 0x0401f004,
-- 0x400c0000, 0x0401f002, 0x40100000, 0x80000110,
-- 0x42000800, 0x000000e0, 0x0201f800, 0x001019b1,
-- 0x0401f007, 0x59a81054, 0x59a81855, 0x59a82056,
-- 0x480b4207, 0x480f4407, 0x48134208, 0x0401f65b,
-- 0x4d2c0000, 0x4d340000, 0x4d300000, 0x4d440000,
-- 0x59a28c06, 0x0201f800, 0x00020267, 0x04000006,
-+ 0x59800000, 0x8c000500, 0x040007f9, 0x04000008,
-+ 0x80081000, 0x44101800, 0x800811c0, 0x040006be,
-+ 0x4a030000, 0x00000000, 0x0401f6bb, 0x4a030000,
-+ 0x00000000, 0x4a034406, 0x00000004, 0x0401f702,
-+ 0x59a01a0a, 0x59a00406, 0x900c19c0, 0x800c1d40,
-+ 0x41781000, 0x42000000, 0x00001000, 0x50000000,
-+ 0x82000480, 0x24320001, 0x04001016, 0x820c0580,
-+ 0x00007c00, 0x04000013, 0x820c0480, 0x00007a00,
-+ 0x04001010, 0x820c0480, 0x00007cff, 0x0402100d,
-+ 0x42000800, 0x00000064, 0x80040840, 0x04000007,
-+ 0x4a030000, 0x00000001, 0x40000000, 0x59800000,
-+ 0x8c000500, 0x040007f9, 0x0400000f, 0x80081000,
-+ 0x500c0000, 0x82000d00, 0x0000ffff, 0x48074207,
-+ 0x82000d00, 0xffff0000, 0x900409c0, 0x48074407,
-+ 0x800811c0, 0x0400068c, 0x4a030000, 0x00000000,
-+ 0x0401f689, 0x4a030000, 0x00000000, 0x4a034406,
-+ 0x00000004, 0x0401f6d0, 0x59a00406, 0x8c000500,
-+ 0x04000020, 0x59a01207, 0x59a01c07, 0x59a02208,
-+ 0x480b5051, 0x480f5052, 0x48135053, 0x59c40801,
-+ 0x82040d00, 0x00018000, 0x82040580, 0x00000000,
-+ 0x04000009, 0x82040580, 0x00008000, 0x04000008,
-+ 0x82040580, 0x00010000, 0x04000007, 0x0201f800,
-+ 0x001004ef, 0x40080000, 0x0401f004, 0x400c0000,
-+ 0x0401f002, 0x40100000, 0x80000110, 0x42000800,
-+ 0x000000e0, 0x0201f800, 0x001018a5, 0x0401f007,
-+ 0x59a81051, 0x59a81852, 0x59a82053, 0x480b4207,
-+ 0x480f4407, 0x48134208, 0x0401f65b, 0x4d2c0000,
-+ 0x4d340000, 0x4d300000, 0x4d440000, 0x59a28c06,
-+ 0x0201f800, 0x0002025a, 0x04000006, 0x5c028800,
-+ 0x5c026000, 0x5c026800, 0x5c025800, 0x0401f69e,
-+ 0x59a04407, 0x59a00207, 0x900001c0, 0x80204540,
-+ 0x0401f81e, 0x04000009, 0x4a034208, 0x00000001,
-+ 0x4a034406, 0x0000ffff, 0x4a034207, 0x0000ffff,
-+ 0x497b4407, 0x0401f00b, 0x0401f822, 0x0400000e,
-+ 0x4a034208, 0x00000002, 0x59300402, 0x48034406,
-+ 0x59300202, 0x48034207, 0x59300206, 0x48034407,
- 0x5c028800, 0x5c026000, 0x5c026800, 0x5c025800,
-- 0x0401f69e, 0x59a04407, 0x59a00207, 0x900001c0,
-- 0x80204540, 0x0401f81e, 0x04000009, 0x4a034208,
-- 0x00000001, 0x4a034406, 0x0000ffff, 0x4a034207,
-- 0x0000ffff, 0x497b4407, 0x0401f00b, 0x0401f822,
-- 0x0400000e, 0x4a034208, 0x00000002, 0x59300402,
-- 0x48034406, 0x59300202, 0x48034207, 0x59300206,
-- 0x48034407, 0x5c028800, 0x5c026000, 0x5c026800,
-- 0x5c025800, 0x0401f631, 0x5c028800, 0x5c026000,
-- 0x5c026800, 0x5c025800, 0x0401f678, 0x4937c856,
-- 0x4823c856, 0x4d2c0000, 0x5934000f, 0x80025d40,
-- 0x04000007, 0x592c0005, 0x80200580, 0x592c0000,
-- 0x040207fb, 0x82000540, 0x00000001, 0x5c025800,
-- 0x1c01f000, 0x4823c857, 0x4d2c0000, 0x4d300000,
-- 0x42026000, 0x0010cfc0, 0x59300406, 0x82000d80,
-- 0x00000003, 0x04000004, 0x82000d80, 0x00000006,
-- 0x04020007, 0x59325808, 0x812e59c0, 0x04000004,
-- 0x592c0005, 0x80200580, 0x0400000a, 0x83326400,
-- 0x00000024, 0x41580000, 0x81300480, 0x040017ef,
-- 0x80000580, 0x5c026000, 0x5c025800, 0x1c01f000,
-- 0x82000540, 0x00000001, 0x5c026000, 0x5c025800,
-- 0x1c01f000, 0x83a00580, 0x0010b2a0, 0x0402063b,
-- 0x59a8006f, 0x8c000500, 0x04020003, 0x4a030000,
-- 0x00000000, 0x4a034206, 0x00004000, 0x4a03c011,
-- 0x40000010, 0x0401fe5d, 0x59e00017, 0x8c000508,
-- 0x04000003, 0x4a03c017, 0x00000000, 0x4203e000,
-- 0x30000001, 0x4203e000, 0x40000000, 0x0401f000,
-- 0x59a00c06, 0x800409c0, 0x04000007, 0x836c0580,
-- 0x00000000, 0x04000004, 0x4a034406, 0x0000001a,
-- 0x0401f62a, 0x42007000, 0x0010b33f, 0x58381c01,
-- 0x58382202, 0x8c040d00, 0x0400000b, 0x59a01207,
-- 0x82080500, 0x0000f003, 0x04020624, 0x82080480,
-- 0x00000841, 0x04021621, 0x82080480, 0x00000100,
-- 0x0400161e, 0x8c040d06, 0x04000003, 0x4a0378e4,
-- 0x000c0000, 0x8c040d04, 0x0400000c, 0x42000000,
-- 0x00001000, 0x50000000, 0x82000480, 0x24220001,
-- 0x04020003, 0x84040d04, 0x0401f004, 0x59e00002,
-- 0x84000548, 0x4803c002, 0x8c040d02, 0x04000005,
-- 0x42002800, 0x00007600, 0x4a002805, 0xd0000000,
-- 0x40040000, 0x800c0540, 0x48007401, 0x8c040d00,
-- 0x04000002, 0x48087202, 0x480f4406, 0x48134207,
-- 0x0401f5ae, 0x4d440000, 0x4d340000, 0x59a28c06,
-- 0x0201f800, 0x00020267, 0x04020009, 0x0201f800,
-- 0x00104842, 0x04000009, 0x4a034406, 0x00000009,
-- 0x5c026800, 0x5c028800, 0x0401f5ec, 0x5c026800,
-- 0x5c028800, 0x0401f5ed, 0x59a01207, 0x59a01c07,
-- 0x5934400a, 0x82203d00, 0x0000e000, 0x801c391a,
-- 0x8c081500, 0x04000019, 0x820c0d00, 0x00000007,
-- 0x82040580, 0x00000000, 0x04000007, 0x82040580,
-- 0x00000001, 0x04000004, 0x82040580, 0x00000003,
-- 0x040207eb, 0x82204500, 0xffff1fff, 0x800400da,
-- 0x80200540, 0x4802680a, 0x4c1c0000, 0x0201f800,
-- 0x0010698c, 0x0201f800, 0x00104afd, 0x0201f800,
-- 0x00106982, 0x5c003800, 0x481f4407, 0x5c026800,
-- 0x5c028800, 0x0401f579, 0x800409c0, 0x04000004,
-- 0x4a034406, 0x00000001, 0x0401f5c0, 0x836c0580,
-- 0x00000003, 0x04020010, 0x59a80010, 0x497b4406,
-- 0x0201f800, 0x00104e0d, 0x0400000f, 0x82000d00,
-- 0x00ffff00, 0x0402000c, 0x82000c00, 0x00101eb5,
-- 0x50040800, 0x80040910, 0x82041580, 0x00000080,
-- 0x04020004, 0x4a034406, 0x00000007, 0x0401f5ab,
-- 0x48074406, 0x82000d00, 0x0000ffff, 0x48074207,
-- 0x80000120, 0x48034407, 0x59a80026, 0x82001500,
-- 0x00000100, 0x480b4409, 0x8c000502, 0x0400001f,
-- 0x8c000506, 0x04000009, 0x82000d00, 0x0000000a,
-- 0x82040d80, 0x0000000a, 0x04020004, 0x4a034209,
-- 0x00000001, 0x0401f022, 0x8c00050a, 0x04000009,
-- 0x82000d00, 0x00000022, 0x82040d80, 0x00000022,
-- 0x04020004, 0x4a034209, 0x00000003, 0x0401f018,
-- 0x8c000508, 0x04000009, 0x82000d00, 0x00000012,
-- 0x82040d80, 0x00000012, 0x04020004, 0x4a034209,
-- 0x00000002, 0x0401f00e, 0x0201f800, 0x00104e0d,
-- 0x04020004, 0x4a034209, 0x00000004, 0x0401f52f,
-- 0x8c000506, 0x04000004, 0x4a034406, 0x00000005,
-- 0x0401f576, 0x4a034209, 0x00000000, 0x0401f527,
-- 0x59a80037, 0x48034407, 0x59a80038, 0x48034209,
-- 0x0401f522, 0x42007800, 0x0010b6eb, 0x59a00406,
-- 0x4803c857, 0x82000c80, 0x00000007, 0x0402156b,
-- 0x0c01f001, 0x00102354, 0x00102355, 0x00102363,
-- 0x00102376, 0x00102397, 0x00102354, 0x00102354,
-- 0x0401f562, 0x836c0580, 0x00000000, 0x0400055b,
-- 0x59a00a07, 0x59a00407, 0x900001c0, 0x80040d40,
-- 0x4807c857, 0x59a00a08, 0x59a00408, 0x900001c0,
-- 0x80040d40, 0x4807c857, 0x0401f056, 0x836c0580,
-- 0x00000000, 0x0400054d, 0x59a00407, 0x59a01207,
-- 0x900001c0, 0x80081540, 0x59a00408, 0x59a01a08,
-- 0x900001c0, 0x800c1d40, 0x42000000, 0x0010bfbe,
-- 0x480fc857, 0x480bc857, 0x42000800, 0x00001000,
-- 0x0201f000, 0x00103841, 0x59a00a07, 0x59a00407,
-- 0x900001c0, 0x80041d40, 0x820c0c80, 0x0010a971,
-- 0x0402153a, 0x820c0c80, 0x00100000, 0x04001537,
-- 0x480fc857, 0x823c7c00, 0x00000009, 0x503c0800,
-- 0x800409c0, 0x04000006, 0x823c0580, 0x0000000d,
-- 0x0400052e, 0x803c7800, 0x0401f7f9, 0x59e41001,
-- 0x82080d00, 0xfffeffcf, 0x4807c801, 0x440c7800,
-- 0x46001800, 0x0201f800, 0x800c1800, 0x46001800,
-- 0x00100608, 0x480bc801, 0x0401f022, 0x59a01a07,
-- 0x59a00407, 0x900001c0, 0x800c1d40, 0x480c7801,
-- 0x59a02208, 0x59a00408, 0x900001c0, 0x80102540,
-- 0x48107802, 0x59a00209, 0x80000040, 0x04001513,
-- 0x48007806, 0x80000000, 0x48007805, 0x42000800,
-- 0x00004000, 0x40001000, 0x0201f800, 0x001063cf,
-- 0x80000540, 0x04000003, 0x49787801, 0x0401f507,
-- 0x40040000, 0x800c1c00, 0x04001504, 0x480c7803,
-+ 0x0401f631, 0x5c028800, 0x5c026000, 0x5c026800,
-+ 0x5c025800, 0x0401f678, 0x4937c856, 0x4823c856,
-+ 0x4d2c0000, 0x5934000f, 0x80025d40, 0x04000007,
-+ 0x592c0005, 0x80200580, 0x592c0000, 0x040207fb,
-+ 0x82000540, 0x00000001, 0x5c025800, 0x1c01f000,
-+ 0x4823c857, 0x4d2c0000, 0x42026000, 0x0010d8d4,
-+ 0x59300406, 0x82000d80, 0x00000003, 0x04000004,
-+ 0x82000d80, 0x00000006, 0x04020007, 0x59325808,
-+ 0x812e59c0, 0x04000004, 0x592c0005, 0x80200580,
-+ 0x0400000a, 0x83326400, 0x00000024, 0x59a8000a,
-+ 0x81300480, 0x040017ef, 0x417a6000, 0x80000580,
-+ 0x5c025800, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x5c025800, 0x1c01f000, 0x83a00580, 0x0010ac71,
-+ 0x0402063d, 0x59a8006c, 0x8c000500, 0x04020003,
-+ 0x4a030000, 0x00000000, 0x4a034206, 0x00004000,
-+ 0x4a03c011, 0x40000010, 0x0401fe5f, 0x59e00017,
-+ 0x8c000508, 0x04000003, 0x4a03c017, 0x00000000,
-+ 0x4203e000, 0x30000001, 0x4203e000, 0x40000000,
-+ 0x0401f000, 0x59a00c06, 0x800409c0, 0x04000007,
-+ 0x836c0580, 0x00000000, 0x04000004, 0x4a034406,
-+ 0x0000001a, 0x0401f62c, 0x42007000, 0x0010ad10,
-+ 0x58381c01, 0x58382201, 0x8c040d00, 0x0400000b,
-+ 0x59a01207, 0x82080500, 0x0000f003, 0x04020626,
-+ 0x82080480, 0x00000841, 0x04021623, 0x82080480,
-+ 0x00000100, 0x04001620, 0x8c040d06, 0x04000003,
-+ 0x4a0378e4, 0x000c0000, 0x8c040d04, 0x04000004,
-+ 0x59e00002, 0x84000548, 0x4803c002, 0x8c040d02,
-+ 0x04000005, 0x42002800, 0x00007600, 0x4a002805,
-+ 0xd0000000, 0x40040000, 0x800c0540, 0x48007401,
-+ 0x8c040d00, 0x04000002, 0x48087201, 0x480f4406,
-+ 0x48134207, 0x0401f5b8, 0x4d440000, 0x4d340000,
-+ 0x59a28c06, 0x0201f800, 0x0002025a, 0x04020009,
-+ 0x0201f800, 0x00104725, 0x04000009, 0x4a034406,
-+ 0x00000009, 0x5c026800, 0x5c028800, 0x0401f5f6,
-+ 0x5c026800, 0x5c028800, 0x0401f5f7, 0x59a01207,
-+ 0x59a01c07, 0x5934400a, 0x82203d00, 0x0000e000,
-+ 0x801c391a, 0x8c081500, 0x04000019, 0x820c0d00,
-+ 0x00000007, 0x82040580, 0x00000000, 0x04000007,
-+ 0x82040580, 0x00000001, 0x04000004, 0x82040580,
-+ 0x00000003, 0x040207eb, 0x82204500, 0xffff1fff,
-+ 0x800400da, 0x80200540, 0x4802680a, 0x4c1c0000,
-+ 0x0201f800, 0x00106476, 0x0201f800, 0x001049fd,
-+ 0x0201f800, 0x00106463, 0x5c003800, 0x481f4407,
-+ 0x5c026800, 0x5c028800, 0x0401f583, 0x8d0e1d0e,
-+ 0x04000004, 0x4a034406, 0x00000001, 0x0401f5ca,
-+ 0x836c0580, 0x00000003, 0x04020010, 0x59a8000f,
-+ 0x497b4406, 0x0201f800, 0x00104ca6, 0x0400000f,
-+ 0x82000d00, 0x00ffff00, 0x0402000c, 0x82000c00,
-+ 0x00101cdd, 0x50040800, 0x80040910, 0x82041580,
-+ 0x00000080, 0x04020004, 0x4a034406, 0x00000007,
-+ 0x0401f5b5, 0x48074406, 0x82000d00, 0x0000ffff,
-+ 0x48074207, 0x80000120, 0x48034407, 0x59a80023,
-+ 0x82001500, 0x00000100, 0x480b4409, 0x8c000502,
-+ 0x0400001f, 0x8c000506, 0x04000009, 0x82000d00,
-+ 0x0000000a, 0x82040d80, 0x0000000a, 0x04020004,
-+ 0x4a034209, 0x00000001, 0x0401f022, 0x8c00050a,
-+ 0x04000009, 0x82000d00, 0x00000022, 0x82040d80,
-+ 0x00000022, 0x04020004, 0x4a034209, 0x00000003,
-+ 0x0401f018, 0x8c000508, 0x04000009, 0x82000d00,
-+ 0x00000012, 0x82040d80, 0x00000012, 0x04020004,
-+ 0x4a034209, 0x00000002, 0x0401f00e, 0x0201f800,
-+ 0x00104ca6, 0x04020004, 0x4a034209, 0x00000004,
-+ 0x0401f539, 0x8c000506, 0x04000004, 0x4a034406,
-+ 0x00000005, 0x0401f580, 0x4a034209, 0x00000000,
-+ 0x0401f531, 0x59a80034, 0x48034407, 0x59a80035,
-+ 0x48034209, 0x0401f52c, 0x42007800, 0x0010b0bb,
-+ 0x59a00406, 0x4803c857, 0x82000c80, 0x00000007,
-+ 0x04021575, 0x0c01f001, 0x00102171, 0x00102172,
-+ 0x00102180, 0x00102193, 0x001021b4, 0x001021da,
-+ 0x00102171, 0x0401f56c, 0x836c0580, 0x00000000,
-+ 0x04000565, 0x59a00a07, 0x59a00407, 0x900001c0,
-+ 0x80040d40, 0x4807c857, 0x59a00a08, 0x59a00408,
-+ 0x900001c0, 0x80040d40, 0x4807c857, 0x0401f05a,
-+ 0x836c0580, 0x00000000, 0x04000557, 0x59a00407,
-+ 0x59a01207, 0x900001c0, 0x80081540, 0x59a00408,
-+ 0x59a01a08, 0x900001c0, 0x800c1d40, 0x42000000,
-+ 0x0010b98e, 0x480fc857, 0x480bc857, 0x42000800,
-+ 0x00001000, 0x0201f000, 0x001036dd, 0x59a00a07,
-+ 0x59a00407, 0x900001c0, 0x80041d40, 0x820c0c80,
-+ 0x0010a363, 0x04021544, 0x820c0c80, 0x00100000,
-+ 0x04001541, 0x480fc857, 0x823c7c00, 0x00000009,
-+ 0x503c0800, 0x800409c0, 0x04000006, 0x823c0580,
-+ 0x0000000d, 0x04000538, 0x803c7800, 0x0401f7f9,
-+ 0x59e41001, 0x82080d00, 0xfffeffcf, 0x4807c801,
-+ 0x440c7800, 0x46001800, 0x0201f800, 0x800c1800,
-+ 0x46001800, 0x001004df, 0x480bc801, 0x0401f026,
-+ 0x59a01a07, 0x59a00407, 0x900001c0, 0x800c1d40,
-+ 0x480c7801, 0x59a02208, 0x59a00408, 0x900001c0,
-+ 0x80102540, 0x48107802, 0x59a00209, 0x80000040,
-+ 0x0400151d, 0x48007806, 0x80000000, 0x48007805,
-+ 0x42000800, 0x00004000, 0x40001000, 0x0201f800,
-+ 0x00106298, 0x80000540, 0x04000002, 0x0401f512,
-+ 0x40040000, 0x800c1c00, 0x0400150f, 0x480c7803,
- 0x48107804, 0x49787808, 0x59a00409, 0x48007807,
- 0x59e40001, 0x4803c857, 0x82000540, 0x00040000,
-- 0x4803c801, 0x0401f4a9, 0x59a80006, 0x48034406,
-- 0x59a80007, 0x48034207, 0x59a80008, 0x48034407,
-- 0x0401f4a2, 0x0201f800, 0x00100615, 0x4803c856,
-+ 0x4803c801, 0x0401f4b4, 0x49787801, 0x49787802,
-+ 0x49787806, 0x49787805, 0x49787801, 0x49787803,
-+ 0x49787804, 0x49787808, 0x49787807, 0x59e40001,
-+ 0x84000524, 0x0401f7f3, 0x59a80005, 0x48034406,
-+ 0x59a80006, 0x48034207, 0x59a80007, 0x48034407,
-+ 0x0401f4a1, 0x0201f800, 0x001004ef, 0x4803c856,
- 0x4a03c013, 0x03800300, 0x4a03c014, 0x03800380,
- 0x59a00c06, 0x82040580, 0x000000a0, 0x04000004,
- 0x82040580, 0x000000a2, 0x04020028, 0x59a0140a,
-@@ -2351,12 +2220,12 @@ uint32_t risc_code01[] = {
- 0x82040c00, 0x00000003, 0x82040d00, 0x000000fc,
- 0x80040904, 0x59a00407, 0x59a01207, 0x900811c0,
- 0x80081540, 0x59a00409, 0x59a01a09, 0x900c19c0,
-- 0x800c1d40, 0x0201f800, 0x0010381a, 0x04020006,
-+ 0x800c1d40, 0x0201f800, 0x001036b6, 0x04020006,
- 0x4a034406, 0x00000002, 0x4a03c014, 0x03800000,
-- 0x0401f4be, 0x0201f800, 0x0010383e, 0x4a01d809,
-- 0x001023fd, 0x1c01f000, 0x4a03c014, 0x03800000,
-- 0x0401f4ba, 0x4031d800, 0x58ef400b, 0x58ee580d,
-- 0x58ec0002, 0x82000580, 0x00000200, 0x040004a7,
-+ 0x0401f4bd, 0x0201f800, 0x001036da, 0x4a01d809,
-+ 0x00102225, 0x1c01f000, 0x4a03c014, 0x03800000,
-+ 0x0401f4b9, 0x4031d800, 0x58ef400b, 0x58ee580d,
-+ 0x58ec0002, 0x82000580, 0x00000200, 0x040004a6,
- 0x59a00c06, 0x59a0140a, 0x59a0020b, 0x8c000500,
- 0x04020031, 0x832e5c00, 0x00000004, 0x41783800,
- 0x59a04a0a, 0x401c0000, 0x812c0400, 0x50004000,
-@@ -2372,16 +2241,16 @@ uint32_t risc_code01[] = {
- 0x80244840, 0x0400000a, 0x80081000, 0x801c3800,
- 0x0401f7d5, 0x59a0020a, 0x82000500, 0x000000ff,
- 0x40001800, 0x0401f885, 0x04000004, 0x4a03c014,
-- 0x03800000, 0x0401f425, 0x4a03c014, 0x03800000,
-- 0x0401f46e, 0x4803c856, 0x4a03c013, 0x03800300,
-+ 0x03800000, 0x0401f424, 0x4a03c014, 0x03800000,
-+ 0x0401f46d, 0x4803c856, 0x4a03c013, 0x03800300,
- 0x4a03c014, 0x03800380, 0x59a00c06, 0x82040580,
- 0x000000a0, 0x04000004, 0x82040580, 0x000000a2,
- 0x0402006e, 0x59a0140a, 0x82080480, 0x00000100,
- 0x0402106a, 0x59a0020b, 0x8c000500, 0x0402005c,
- 0x59a01a0a, 0x800c19c0, 0x04000064, 0x820c0480,
-- 0x00000041, 0x04021061, 0x0201f800, 0x0010381a,
-+ 0x00000041, 0x04021061, 0x0201f800, 0x001036b6,
- 0x04020006, 0x4a034406, 0x00000002, 0x4a03c014,
-- 0x03800000, 0x0401f44d, 0x832e5c00, 0x00000004,
-+ 0x03800000, 0x0401f44c, 0x832e5c00, 0x00000004,
- 0x41783800, 0x59a04a0a, 0x401c0000, 0x812c0400,
- 0x40004000, 0x4c040000, 0x4c080000, 0x0401f877,
- 0x5c001000, 0x5c000800, 0x04000048, 0x44144000,
-@@ -2400,11 +2269,11 @@ uint32_t risc_code01[] = {
- 0x000000fc, 0x80040904, 0x59a00407, 0x59a01207,
- 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
- 0x900c19c0, 0x800c1d40, 0x4a03c014, 0x03800000,
-- 0x412c0000, 0x0201f000, 0x00103841, 0x0401f833,
-+ 0x412c0000, 0x0201f000, 0x001036dd, 0x0401f833,
- 0x04000006, 0x48174406, 0x4a03c014, 0x03800000,
-- 0x0201f000, 0x00102066, 0x4a03c014, 0x03800000,
-- 0x0201f000, 0x001020b2, 0x4a03c014, 0x03800000,
-- 0x0201f000, 0x001020b6, 0x0401f836, 0x04000010,
-+ 0x0201f000, 0x00101e8d, 0x4a03c014, 0x03800000,
-+ 0x0201f000, 0x00101ed9, 0x4a03c014, 0x03800000,
-+ 0x0201f000, 0x00101edd, 0x0401f836, 0x04000010,
- 0x0401f862, 0x0402000f, 0x40080800, 0x0401f85f,
- 0x0402000c, 0x400c0800, 0x0401f85c, 0x04020009,
- 0x0401f84b, 0x42000000, 0x00030d40, 0x80000040,
-@@ -2453,1196 +2322,1225 @@ uint32_t risc_code01[] = {
- 0x42000000, 0x00000064, 0x80000040, 0x040207ff,
- 0x4a03c013, 0x02000200, 0x42000000, 0x00000064,
- 0x80000040, 0x040207ff, 0x4a03c013, 0x02000000,
-- 0x1c01f000, 0x59a00407, 0x59a80837, 0x48035037,
-+ 0x1c01f000, 0x59a00407, 0x59a80834, 0x48035034,
- 0x48074407, 0x59a00a09, 0x82040480, 0x00000014,
-- 0x04021003, 0x42000800, 0x000007d0, 0x59a80038,
-- 0x48075038, 0x48034209, 0x0201f000, 0x00102066,
-- 0x836c0580, 0x00000000, 0x0400000e, 0x59a80006,
-+ 0x04021003, 0x42000800, 0x000007d0, 0x59a80035,
-+ 0x48075035, 0x48034209, 0x0201f000, 0x00101e8d,
-+ 0x836c0580, 0x00000000, 0x0400000e, 0x59a80005,
- 0x59a00c06, 0x80041580, 0x82081500, 0x00000040,
-- 0x02000000, 0x00102066, 0x80080580, 0x48035006,
-- 0x0201f800, 0x001006df, 0x0201f000, 0x00102066,
-- 0x59a00406, 0x59a80806, 0x48035006, 0x80040d80,
-- 0x8c040d0c, 0x02020800, 0x001006df, 0x59a00207,
-- 0x48035007, 0x59a00407, 0x48035008, 0x0201f000,
-- 0x00102066, 0x800409c0, 0x04000005, 0x4a034406,
-- 0x00000001, 0x0201f000, 0x001020b2, 0x0201f800,
-- 0x00104e0d, 0x04020005, 0x4a034406, 0x00000016,
-- 0x0201f000, 0x001020b2, 0x836c0580, 0x00000003,
-+ 0x02000000, 0x00101e8d, 0x80080580, 0x48035005,
-+ 0x0201f800, 0x001005bd, 0x0201f000, 0x00101e8d,
-+ 0x59a00406, 0x59a80805, 0x48035005, 0x80040d80,
-+ 0x8c040d0c, 0x02020800, 0x001005bd, 0x59a00207,
-+ 0x48035006, 0x59a00407, 0x48035007, 0x0201f000,
-+ 0x00101e8d, 0x8d0e1d0e, 0x04000005, 0x4a034406,
-+ 0x00000001, 0x0201f000, 0x00101ed9, 0x0201f800,
-+ 0x00104ca6, 0x04020005, 0x4a034406, 0x00000016,
-+ 0x0201f000, 0x00101ed9, 0x836c0580, 0x00000003,
- 0x04000005, 0x4a034406, 0x00000007, 0x0201f000,
-- 0x001020b2, 0x59a00c06, 0x82040500, 0xffffff00,
-- 0x02020000, 0x001020b6, 0x82041580, 0x000000ff,
-- 0x04020007, 0x59a80010, 0x82000500, 0x000000ff,
-+ 0x00101ed9, 0x59a00c06, 0x82040500, 0xffffff00,
-+ 0x02020000, 0x00101edd, 0x82041580, 0x000000ff,
-+ 0x04020007, 0x59a8000f, 0x82000500, 0x000000ff,
- 0x82001540, 0x0000ff00, 0x0401f011, 0x82040400,
-- 0x00101eb5, 0x50000000, 0x80000110, 0x82000580,
-- 0x00000080, 0x02000000, 0x001020b6, 0x59a80010,
-+ 0x00101cdd, 0x50000000, 0x80000110, 0x82000580,
-+ 0x00000080, 0x02000000, 0x00101edd, 0x59a8000f,
- 0x82000500, 0x000000ff, 0x80041580, 0x02000000,
-- 0x001020b6, 0x840409c0, 0x80041540, 0x0201f800,
-- 0x00020892, 0x04020005, 0x4a034406, 0x00000003,
-- 0x0201f000, 0x001020b2, 0x48ee6021, 0x480a621c,
-+ 0x00101edd, 0x840409c0, 0x80041540, 0x0201f800,
-+ 0x00020799, 0x04020005, 0x4a034406, 0x00000003,
-+ 0x0201f000, 0x00101ed9, 0x48ee6021, 0x480a621c,
- 0x4a02641c, 0x0000bc09, 0x4a026406, 0x00000001,
-- 0x0201f800, 0x0010381a, 0x04020007, 0x0201f800,
-- 0x000208b4, 0x4a034406, 0x00000002, 0x0201f000,
-- 0x001020b2, 0x497a5a04, 0x497a5805, 0x4a025c04,
-- 0x00008000, 0x4a01d809, 0x00102657, 0x492e6008,
-- 0x42027000, 0x00000032, 0x0201f000, 0x000208d8,
-- 0x800409c0, 0x04000005, 0x4a034406, 0x00000001,
-- 0x0201f000, 0x001020b2, 0x0201f800, 0x00104e0d,
-+ 0x0201f800, 0x001036b6, 0x04020007, 0x0201f800,
-+ 0x000207bb, 0x4a034406, 0x00000002, 0x0201f000,
-+ 0x00101ed9, 0x497a5a04, 0x497a5805, 0x4a025c04,
-+ 0x00008000, 0x4a01d809, 0x0010247f, 0x492e6008,
-+ 0x42027000, 0x00000032, 0x0201f000, 0x000207df,
-+ 0x8d0e1d0e, 0x04000005, 0x4a034406, 0x00000001,
-+ 0x0201f000, 0x00101ed9, 0x0201f800, 0x00104ca6,
- 0x04020005, 0x4a034406, 0x00000016, 0x0201f000,
-- 0x001020b2, 0x836c0580, 0x00000003, 0x04000005,
-- 0x4a034406, 0x00000007, 0x0201f000, 0x001020b2,
-+ 0x00101ed9, 0x836c0580, 0x00000003, 0x04000005,
-+ 0x4a034406, 0x00000007, 0x0201f000, 0x00101ed9,
- 0x59a00c06, 0x82040500, 0xffffff00, 0x02020000,
-- 0x001020b6, 0x82041580, 0x000000ff, 0x04020007,
-- 0x59a80010, 0x82000500, 0x000000ff, 0x82001540,
-- 0x0000ff00, 0x0401f011, 0x82040400, 0x00101eb5,
-+ 0x00101edd, 0x82041580, 0x000000ff, 0x04020007,
-+ 0x59a8000f, 0x82000500, 0x000000ff, 0x82001540,
-+ 0x0000ff00, 0x0401f011, 0x82040400, 0x00101cdd,
- 0x50000000, 0x80000110, 0x82000580, 0x00000080,
-- 0x02000000, 0x001020b6, 0x59a80010, 0x82000500,
-- 0x000000ff, 0x80041580, 0x02000000, 0x001020b6,
-- 0x840409c0, 0x80041540, 0x0201f800, 0x00020892,
-+ 0x02000000, 0x00101edd, 0x59a8000f, 0x82000500,
-+ 0x000000ff, 0x80041580, 0x02000000, 0x00101edd,
-+ 0x840409c0, 0x80041540, 0x0201f800, 0x00020799,
- 0x04020005, 0x4a034406, 0x00000003, 0x0201f000,
-- 0x001020b2, 0x48ee6021, 0x480a621c, 0x4a02641c,
-+ 0x00101ed9, 0x48ee6021, 0x480a621c, 0x4a02641c,
- 0x0000bc05, 0x4a026406, 0x00000001, 0x0201f800,
-- 0x0010381a, 0x04020007, 0x0201f800, 0x000208b4,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-+ 0x001036b6, 0x04020007, 0x0201f800, 0x000207bb,
-+ 0x4a034406, 0x00000002, 0x0201f000, 0x00101ed9,
- 0x497a5a04, 0x497a5805, 0x4a025c04, 0x00008000,
-- 0x4a01d809, 0x00102657, 0x492e6008, 0x42027000,
-- 0x00000032, 0x0201f000, 0x000208d8, 0x592c0005,
-- 0x82000580, 0x01000000, 0x02020000, 0x00102066,
-- 0x4a034406, 0x00000004, 0x0201f000, 0x001020b2,
-- 0x497b4406, 0x497b4207, 0x0201f800, 0x0010393e,
-- 0x04000008, 0x59a80066, 0x59a8086a, 0x80040480,
-- 0x59a80867, 0x48074406, 0x80041480, 0x480b4207,
-- 0x49674407, 0x59a8000e, 0x48034209, 0x495f4409,
-- 0x59a80020, 0x4803420b, 0x0201f000, 0x00102066,
-- 0x800409c0, 0x04000005, 0x4a034406, 0x00000001,
-- 0x0201f000, 0x001020b2, 0x59a00406, 0x8c000500,
-- 0x0402000f, 0x59a80069, 0x81640480, 0x04001008,
-- 0x59a8000b, 0x81500580, 0x04000009, 0x59a8006a,
-- 0x59a81066, 0x80080580, 0x04000005, 0x4a034406,
-- 0x00000018, 0x0201f000, 0x001020b2, 0x59a80005,
-- 0x84000558, 0x48035005, 0x82000540, 0x00000001,
-- 0x0201f800, 0x00101668, 0x0201f800, 0x00103a9f,
-- 0x0201f000, 0x00102066, 0x4803c856, 0x800409c0,
-- 0x02020000, 0x001020ba, 0x59a00406, 0x8c00051e,
-- 0x04000008, 0x4803c856, 0x59a0020b, 0x82000480,
-- 0x00000800, 0x04001015, 0x0201f000, 0x001020b6,
-- 0x4803c856, 0x59a0020b, 0x599c0a01, 0x80040480,
-- 0x04021003, 0x0201f000, 0x001020b6, 0x59a8000e,
-- 0x81640580, 0x04000009, 0x4a034406, 0x00000018,
-- 0x0201f000, 0x001020b2, 0x4a034406, 0x00000005,
-- 0x0201f000, 0x001020b2, 0x59a80026, 0x8c00050a,
-- 0x040007fa, 0x59a00406, 0x8c00051e, 0x04000036,
-- 0x0201f800, 0x00020892, 0x040007f4, 0x0201f800,
-- 0x0010381a, 0x040007f1, 0x497a5a04, 0x59a00406,
-- 0x4802620a, 0x59a00209, 0x4802640a, 0x59a00409,
-- 0x4802620b, 0x59a0020d, 0x4802620c, 0x59a0040d,
-- 0x4802640c, 0x59a0020e, 0x4802620d, 0x59a0040e,
-- 0x4802640d, 0x59a00210, 0x4802620e, 0x59a00410,
-- 0x4802640e, 0x59a0020b, 0x82000500, 0x0000fffc,
-- 0x80000104, 0x4802640b, 0x0401f9d9, 0x040007d7,
-- 0x48ee6021, 0x58ee580d, 0x5930020e, 0x59301c0e,
-- 0x900c19c0, 0x800c1d40, 0x5930020c, 0x5930140c,
-- 0x900811c0, 0x80081540, 0x592c0a05, 0x832c0400,
-- 0x00000006, 0x0201f800, 0x0010383e, 0x4a01d809,
-- 0x00102846, 0x4a034000, 0x00000001, 0x49334001,
-- 0x1c01f000, 0x0201f800, 0x0010698c, 0x0201f800,
-- 0x00100b29, 0x0401f86d, 0x497b5057, 0x4201d000,
-- 0x00002710, 0x0201f800, 0x00105e06, 0x59c40880,
-- 0x4c040000, 0x59c408a3, 0x4c040000, 0x497b4002,
-- 0x0401f876, 0x0401f893, 0x4a03a005, 0x10000000,
-- 0x0401f8b4, 0x0401f901, 0x04000048, 0x59c80001,
-- 0x800001c0, 0x040007fc, 0x59c80018, 0x82000500,
-- 0xf0000000, 0x59c00808, 0x82040d00, 0x0fffffff,
-- 0x80040540, 0x48038008, 0x0201f800, 0x00100f0f,
-- 0x59c00006, 0x4a038006, 0x10000000, 0x59c00009,
-- 0x82000d00, 0x00e00000, 0x04020024, 0x4a03900d,
-- 0x00000000, 0x59c80020, 0x82000500, 0xff000000,
-- 0x82000580, 0x32000000, 0x0402001c, 0x4a03900d,
-- 0x00000001, 0x59c80020, 0x82000500, 0xff000000,
-- 0x82000580, 0xe1000000, 0x04020014, 0x4a03900d,
-- 0x00000000, 0x59c80020, 0x82000500, 0x00ffffff,
-- 0x4a03900d, 0x00000000, 0x59c80821, 0x82040d00,
-- 0x00ffffff, 0x80040580, 0x04020008, 0x59a80010,
-- 0x80040580, 0x04020005, 0x59c40005, 0x82000500,
-- 0x000000f0, 0x04000006, 0x4803c856, 0x0401f8d7,
-- 0x4a035057, 0x00000001, 0x0401f002, 0x0401f8e1,
-- 0x42000000, 0x00000064, 0x80000040, 0x02000800,
-- 0x00100615, 0x59c00807, 0x82040d00, 0x0000000c,
-- 0x040007fa, 0x0401f003, 0x4a035057, 0x00000001,
-- 0x0401f8da, 0x0201f800, 0x00106c8a, 0x0401f818,
-- 0x4201d000, 0x000186a0, 0x0201f800, 0x00105e06,
-- 0x5c000800, 0x480788a3, 0x5c000800, 0x48078880,
-- 0x59a80057, 0x800001c0, 0x02000000, 0x00102066,
-- 0x0201f000, 0x001020be, 0x599c0201, 0x48035059,
-- 0x41780800, 0x42001000, 0x00003b10, 0x0201f800,
-- 0x001063ee, 0x480b505a, 0x1c01f000, 0x0201f800,
-- 0x00106982, 0x59b800ea, 0x82000500, 0x00000007,
-- 0x82000580, 0x00000003, 0x04020003, 0x4a0370e8,
-- 0x00000001, 0x1c01f000, 0x42038000, 0x00007700,
-- 0x4a038006, 0x30000000, 0x59c00007, 0x8c00050a,
-- 0x040207fe, 0x59c00006, 0x59a00209, 0x59a00c09,
-- 0x900409c0, 0x80040d40, 0x48078001, 0x59a0020e,
-- 0x59a00c0e, 0x900409c0, 0x80040d40, 0x48078000,
-- 0x59a0020b, 0x82000500, 0x0000fffc, 0x48038002,
-- 0x48038003, 0x48038005, 0x497b9009, 0x59e00003,
-- 0x82000540, 0x00008060, 0x4803c003, 0x1c01f000,
-- 0x41780800, 0x8007a0ca, 0x83d3a400, 0x00007600,
-- 0x42000800, 0x00000040, 0x0201f800, 0x00101395,
-- 0x4a03a00a, 0x00000001, 0x4a03a005, 0x20000000,
-- 0x59d00006, 0x4a03a005, 0x30000000, 0x59d00006,
-- 0x8c00050a, 0x040207fe, 0x59d00005, 0x59a00210,
-- 0x59a00c10, 0x900409c0, 0x80040d40, 0x4807a001,
-- 0x59a0020d, 0x59a00c0d, 0x900409c0, 0x80040d40,
-- 0x4807a000, 0x59a0020b, 0x82000500, 0x0000fffc,
-- 0x4803a003, 0x4803a002, 0x4803a008, 0x1c01f000,
-- 0x59a00002, 0x4803c857, 0x800001c0, 0x0402004a,
-- 0x59a8005a, 0x48038880, 0x59c400a3, 0x82000540,
-- 0x00002008, 0x8400053a, 0x480388a3, 0x59c40008,
-- 0x8400054e, 0x82000500, 0xffffffe1, 0x48038808,
-- 0x59c80040, 0x84000534, 0x48039040, 0x0401f902,
-- 0x04020013, 0x59a80010, 0x800000d0, 0x82000540,
-- 0x00000011, 0x48039120, 0x59a80010, 0x82000500,
-- 0x00ffffff, 0x82000540, 0x32000000, 0x48039121,
-- 0x4a039123, 0xe1290008, 0x59a80010, 0x82000500,
-- 0x00ffffff, 0x48039122, 0x0401f016, 0x59a80010,
-- 0x82000500, 0x000000ff, 0x900009c0, 0x840001c0,
-- 0x80040540, 0x82000540, 0x00000000, 0x48039120,
-- 0x59a80010, 0x82000500, 0x000000ff, 0x82000540,
-- 0x01000000, 0x48039121, 0x4a039123, 0x08210008,
-- 0x59a80010, 0x82000500, 0x000000ff, 0x48039122,
-- 0x497b9124, 0x59a80c5b, 0x80040800, 0x4807545b,
-- 0x900409c0, 0x82040540, 0x0000aaaa, 0x48039125,
-- 0x497b9126, 0x497b9127, 0x0401f8cf, 0x04020004,
-- 0x4a039100, 0x0000e980, 0x0401f003, 0x4a039100,
-- 0x0000e9a0, 0x1c01f000, 0x82000540, 0x00000001,
-- 0x0402500d, 0x4203e000, 0x80000000, 0x40e81000,
-- 0x41780800, 0x42000000, 0x00000064, 0x0201f800,
-- 0x001063ee, 0x59940024, 0x80080400, 0x48032824,
-- 0x80000580, 0x1c01f000, 0x4d900000, 0x4dd00000,
-- 0x4da40000, 0x4d140000, 0x417a3000, 0x0201f800,
-- 0x00106e2f, 0x0201f800, 0x00106b13, 0x5c022800,
-- 0x5c034800, 0x5c03a000, 0x5c032000, 0x1c01f000,
-- 0x59c80007, 0x8c000500, 0x04000003, 0x4a03900d,
-- 0x00000030, 0x1c01f000, 0x4a038805, 0x00020000,
-- 0x42000800, 0x0000003c, 0x0201f800, 0x00101395,
-- 0x4a038891, 0x0000ffff, 0x59c80035, 0x48039035,
-- 0x4a03900d, 0x00000040, 0x42038000, 0x00007700,
-- 0x0201f800, 0x00100f0f, 0x42038000, 0x00007720,
-- 0x0201f800, 0x00100f0f, 0x4a03a005, 0x20000000,
-- 0x4a03a005, 0x30000000, 0x59d00806, 0x8c040d0a,
-- 0x040207fe, 0x1c01f000, 0x4d300000, 0x4031d800,
-- 0x58ef400b, 0x58ee580d, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x5c026000, 0x02000000, 0x001020aa,
-- 0x4d300000, 0x59a26001, 0x59a00000, 0x4000b000,
-- 0x80000000, 0x48034000, 0x592c0001, 0x80000540,
-- 0x0400001e, 0x40025800, 0x8058b040, 0x040207fb,
-- 0x58ec1007, 0x58ec1808, 0x592c0a05, 0x4d2c0000,
-- 0x58ec000d, 0x40025800, 0x592c0204, 0x5c025800,
-- 0x82000580, 0x00000103, 0x04000008, 0x832c0400,
-- 0x00000006, 0x0201f800, 0x0010383e, 0x4a01d809,
-- 0x00102846, 0x0401f007, 0x832c0400, 0x00000006,
-- 0x0201f800, 0x00103841, 0x4a01d809, 0x00102846,
-- 0x5c026000, 0x1c01f000, 0x58ec000d, 0x40025800,
-- 0x592c0204, 0x82000580, 0x00000103, 0x04020006,
-- 0x0201f800, 0x000208b4, 0x5c026000, 0x0201f000,
-- 0x00102066, 0x58ec000d, 0x40025800, 0x592c0404,
-- 0x8400055e, 0x48025c04, 0x42028800, 0x000007fd,
-- 0x42003000, 0x00fffffd, 0x0201f800, 0x001043fc,
-- 0x04000003, 0x80000580, 0x0401f004, 0x59a26001,
-- 0x0201f800, 0x00109146, 0x5c026000, 0x02000000,
-- 0x001020b2, 0x4d300000, 0x4a01d809, 0x00102899,
-- 0x0401f7dc, 0x592c0005, 0x82000580, 0x01000000,
-- 0x02000000, 0x001020be, 0x4d300000, 0x59a26001,
-- 0x5930020b, 0x59301c0a, 0x900001c0, 0x800c1d40,
-- 0x5930040d, 0x5930120d, 0x900001c0, 0x80081540,
-- 0x592c0a05, 0x832c0400, 0x00000006, 0x0201f800,
-- 0x00103841, 0x4a01d809, 0x00102846, 0x4a034000,
-- 0x00000001, 0x5c026000, 0x1c01f000, 0x4933c857,
-- 0x4c300000, 0x5930040b, 0x82000c80, 0x0000000e,
-- 0x04001004, 0x4a025a05, 0x0000000e, 0x0401f003,
-- 0x48025a05, 0x0401f00c, 0x800409c0, 0x0400000a,
-- 0x4c040000, 0x0201f800, 0x0010381a, 0x5c000800,
-- 0x04000003, 0x40040000, 0x0401f7f0, 0x80000580,
-- 0x0401f003, 0x82000540, 0x00000001, 0x5c006000,
-+ 0x4a01d809, 0x0010247f, 0x492e6008, 0x42027000,
-+ 0x00000032, 0x0201f000, 0x000207df, 0x592c0005,
-+ 0x82000580, 0x01000000, 0x02020000, 0x00101e8d,
-+ 0x4a034406, 0x00000004, 0x0201f000, 0x00101ed9,
-+ 0x497b4406, 0x497b4207, 0x8d0e1d20, 0x04000008,
-+ 0x59a80063, 0x59a80867, 0x80040480, 0x59a80864,
-+ 0x48074406, 0x80041480, 0x480b4207, 0x49674407,
-+ 0x59a8000d, 0x48034209, 0x495f4409, 0x59a8001f,
-+ 0x4803420b, 0x0201f000, 0x00101e8d, 0x8d0e1d0e,
-+ 0x04000005, 0x4a034406, 0x00000001, 0x0201f000,
-+ 0x00101ed9, 0x59a00406, 0x8c000500, 0x0402000f,
-+ 0x59a80066, 0x81640480, 0x04001008, 0x59a8000a,
-+ 0x81500580, 0x04000009, 0x59a80067, 0x59a81063,
-+ 0x80080580, 0x04000005, 0x4a034406, 0x00000018,
-+ 0x0201f000, 0x00101ed9, 0x850e1d58, 0x4803c856,
-+ 0x850e1d46, 0x0201f800, 0x00103938, 0x0201f000,
-+ 0x00101e8d, 0x4803c856, 0x8d0e1d0e, 0x02020000,
-+ 0x00101ee1, 0x59a00406, 0x8c00051e, 0x04000008,
-+ 0x4803c856, 0x59a0020b, 0x82000480, 0x00000800,
-+ 0x04001015, 0x0201f000, 0x00101edd, 0x4803c856,
-+ 0x59a0020b, 0x599c0a01, 0x80040480, 0x04021003,
-+ 0x0201f000, 0x00101edd, 0x59a8000d, 0x81640580,
-+ 0x04000009, 0x4a034406, 0x00000018, 0x0201f000,
-+ 0x00101ed9, 0x4a034406, 0x00000005, 0x0201f000,
-+ 0x00101ed9, 0x59a80023, 0x8c00050a, 0x040007fa,
-+ 0x59a00406, 0x8c00051e, 0x04000040, 0x0201f800,
-+ 0x00020799, 0x04020005, 0x4a034406, 0x00000003,
-+ 0x0201f000, 0x00101ed9, 0x0201f800, 0x001036b6,
-+ 0x04020007, 0x0201f800, 0x000207bb, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x497a5a04,
-+ 0x59a00406, 0x4802620a, 0x59a00209, 0x4802640a,
-+ 0x59a00409, 0x4802620b, 0x59a0020d, 0x4802620c,
-+ 0x59a0040d, 0x4802640c, 0x59a0020e, 0x4802620d,
-+ 0x59a0040e, 0x4802640d, 0x59a00210, 0x4802620e,
-+ 0x59a00410, 0x4802640e, 0x59a0020b, 0x82000500,
-+ 0x0000fffc, 0x80000104, 0x4802640b, 0x0401f9da,
-+ 0x040007e1, 0x48ee6021, 0x58ee580d, 0x5930020e,
-+ 0x59301c0e, 0x900c19c0, 0x800c1d40, 0x5930020c,
-+ 0x5930140c, 0x900811c0, 0x80081540, 0x592c0a05,
-+ 0x832c0400, 0x00000006, 0x0201f800, 0x001036da,
-+ 0x4a01d809, 0x00102673, 0x4a034000, 0x00000001,
-+ 0x49334001, 0x1c01f000, 0x0201f800, 0x00106476,
-+ 0x0201f800, 0x00100a20, 0x0401f86d, 0x497b5054,
-+ 0x4201d000, 0x00002710, 0x0201f800, 0x00105cb0,
-+ 0x59c40880, 0x4c040000, 0x59c408a3, 0x4c040000,
-+ 0x497b4002, 0x0401f876, 0x0401f893, 0x4a03a005,
-+ 0x10000000, 0x0401f8b4, 0x0401f901, 0x04000048,
-+ 0x59c80001, 0x800001c0, 0x040007fc, 0x59c80018,
-+ 0x82000500, 0xf0000000, 0x59c00808, 0x82040d00,
-+ 0x0fffffff, 0x80040540, 0x48038008, 0x0201f800,
-+ 0x00100e08, 0x59c00006, 0x4a038006, 0x10000000,
-+ 0x59c00009, 0x82000d00, 0x00e00000, 0x04020024,
-+ 0x4a03900d, 0x00000000, 0x59c80020, 0x82000500,
-+ 0xff000000, 0x82000580, 0x32000000, 0x0402001c,
-+ 0x4a03900d, 0x00000001, 0x59c80020, 0x82000500,
-+ 0xff000000, 0x82000580, 0xe1000000, 0x04020014,
-+ 0x4a03900d, 0x00000000, 0x59c80020, 0x82000500,
-+ 0x00ffffff, 0x4a03900d, 0x00000000, 0x59c80821,
-+ 0x82040d00, 0x00ffffff, 0x80040580, 0x04020008,
-+ 0x59a8000f, 0x80040580, 0x04020005, 0x59c40005,
-+ 0x82000500, 0x000000f0, 0x04000006, 0x4803c856,
-+ 0x0401f8d7, 0x4a035054, 0x00000001, 0x0401f002,
-+ 0x0401f8e1, 0x42000000, 0x00000064, 0x80000040,
-+ 0x02000800, 0x001004ef, 0x59c00807, 0x82040d00,
-+ 0x0000000c, 0x040007fa, 0x0401f003, 0x4a035054,
-+ 0x00000001, 0x0401f8da, 0x0201f800, 0x0010677d,
-+ 0x0401f818, 0x4201d000, 0x000186a0, 0x0201f800,
-+ 0x00105cb0, 0x5c000800, 0x480788a3, 0x5c000800,
-+ 0x48078880, 0x59a80054, 0x800001c0, 0x02000000,
-+ 0x00101e8d, 0x0201f000, 0x00101ee5, 0x599c0201,
-+ 0x48035056, 0x41780800, 0x42001000, 0x00003b10,
-+ 0x0201f800, 0x001062b7, 0x480b5057, 0x1c01f000,
-+ 0x0201f800, 0x00106463, 0x59b800ea, 0x82000500,
-+ 0x00000007, 0x82000580, 0x00000003, 0x04020003,
-+ 0x4a0370e8, 0x00000001, 0x1c01f000, 0x42038000,
-+ 0x00007700, 0x4a038006, 0x30000000, 0x59c00007,
-+ 0x8c00050a, 0x040207fe, 0x59c00006, 0x59a00209,
-+ 0x59a00c09, 0x900409c0, 0x80040d40, 0x48078001,
-+ 0x59a0020e, 0x59a00c0e, 0x900409c0, 0x80040d40,
-+ 0x48078000, 0x59a0020b, 0x82000500, 0x0000fffc,
-+ 0x48038002, 0x48038003, 0x48038005, 0x497b9009,
-+ 0x59e00003, 0x82000540, 0x00008060, 0x4803c003,
-+ 0x1c01f000, 0x41780800, 0x8007a0ca, 0x83d3a400,
-+ 0x00007600, 0x42000800, 0x00000040, 0x0201f800,
-+ 0x00101265, 0x4a03a00a, 0x00000001, 0x4a03a005,
-+ 0x20000000, 0x59d00006, 0x4a03a005, 0x30000000,
-+ 0x59d00006, 0x8c00050a, 0x040207fe, 0x59d00005,
-+ 0x59a00210, 0x59a00c10, 0x900409c0, 0x80040d40,
-+ 0x4807a001, 0x59a0020d, 0x59a00c0d, 0x900409c0,
-+ 0x80040d40, 0x4807a000, 0x59a0020b, 0x82000500,
-+ 0x0000fffc, 0x4803a003, 0x4803a002, 0x4803a008,
-+ 0x1c01f000, 0x59a00002, 0x4803c857, 0x800001c0,
-+ 0x0402004a, 0x59a80057, 0x48038880, 0x59c400a3,
-+ 0x82000540, 0x00002008, 0x8400053a, 0x480388a3,
-+ 0x59c40008, 0x8400054e, 0x82000500, 0xffffffe1,
-+ 0x48038808, 0x59c80040, 0x84000534, 0x48039040,
-+ 0x0401f901, 0x04020013, 0x59a8000f, 0x800000d0,
-+ 0x82000540, 0x00000011, 0x48039120, 0x59a8000f,
-+ 0x82000500, 0x00ffffff, 0x82000540, 0x32000000,
-+ 0x48039121, 0x4a039123, 0xe1290008, 0x59a8000f,
-+ 0x82000500, 0x00ffffff, 0x48039122, 0x0401f016,
-+ 0x59a8000f, 0x82000500, 0x000000ff, 0x900009c0,
-+ 0x840001c0, 0x80040540, 0x82000540, 0x00000000,
-+ 0x48039120, 0x59a8000f, 0x82000500, 0x000000ff,
-+ 0x82000540, 0x01000000, 0x48039121, 0x4a039123,
-+ 0x08210008, 0x59a8000f, 0x82000500, 0x000000ff,
-+ 0x48039122, 0x497b9124, 0x59a80c58, 0x80040800,
-+ 0x48075458, 0x900409c0, 0x82040540, 0x0000aaaa,
-+ 0x48039125, 0x497b9126, 0x497b9127, 0x0401f8ce,
-+ 0x04020004, 0x4a039100, 0x0000e980, 0x0401f003,
-+ 0x4a039100, 0x0000e9a0, 0x1c01f000, 0x82000540,
-+ 0x00000001, 0x0402500d, 0x4203e000, 0x80000000,
-+ 0x40e81000, 0x41780800, 0x42000000, 0x00000064,
-+ 0x0201f800, 0x001062b7, 0x59940024, 0x80080400,
-+ 0x48032824, 0x80000580, 0x1c01f000, 0x4d900000,
-+ 0x4dd00000, 0x4da40000, 0x4d140000, 0x417a3000,
-+ 0x0201f800, 0x0010692b, 0x0201f800, 0x00106606,
-+ 0x5c022800, 0x5c034800, 0x5c03a000, 0x5c032000,
-+ 0x1c01f000, 0x59c80007, 0x8c000500, 0x04000003,
-+ 0x4a03900d, 0x00000030, 0x1c01f000, 0x4a038805,
-+ 0x00020000, 0x42000800, 0x0000003c, 0x0201f800,
-+ 0x00101265, 0x4a038891, 0x0000ffff, 0x59c80035,
-+ 0x48039035, 0x4a03900d, 0x00000040, 0x42038000,
-+ 0x00007700, 0x0201f800, 0x00100e08, 0x42038000,
-+ 0x00007720, 0x0201f800, 0x00100e08, 0x4a03a005,
-+ 0x20000000, 0x4a03a005, 0x30000000, 0x59d00806,
-+ 0x8c040d0a, 0x040207fe, 0x1c01f000, 0x4d300000,
-+ 0x4031d800, 0x58ef400b, 0x58ee580d, 0x58ec0002,
-+ 0x82000580, 0x00000200, 0x5c026000, 0x02000000,
-+ 0x00101ed1, 0x4d300000, 0x59a26001, 0x59a00000,
-+ 0x4000b000, 0x80000000, 0x48034000, 0x592c0001,
-+ 0x80000540, 0x0400001e, 0x40025800, 0x8058b040,
-+ 0x040207fb, 0x58ec1007, 0x58ec1808, 0x592c0a05,
-+ 0x4d2c0000, 0x58ec000d, 0x40025800, 0x592c0204,
-+ 0x5c025800, 0x82000580, 0x00000103, 0x04000008,
-+ 0x832c0400, 0x00000006, 0x0201f800, 0x001036da,
-+ 0x4a01d809, 0x00102673, 0x0401f007, 0x832c0400,
-+ 0x00000006, 0x0201f800, 0x001036dd, 0x4a01d809,
-+ 0x00102673, 0x5c026000, 0x1c01f000, 0x58ec000d,
-+ 0x40025800, 0x592c0204, 0x82000580, 0x00000103,
-+ 0x04020006, 0x0201f800, 0x000207bb, 0x5c026000,
-+ 0x0201f000, 0x00101e8d, 0x58ec000d, 0x40025800,
-+ 0x592c0404, 0x8400055e, 0x48025c04, 0x42028800,
-+ 0x000007fd, 0x42003000, 0x00fffffd, 0x0201f800,
-+ 0x001042b1, 0x59a26001, 0x04000007, 0x0201f800,
-+ 0x000207bb, 0x497b4406, 0x5c026000, 0x0201f000,
-+ 0x00101ed9, 0x0201f800, 0x00108bbe, 0x040007f8,
-+ 0x4a01d809, 0x001026c7, 0x0401f7db, 0x592c0005,
-+ 0x82000580, 0x01000000, 0x02000000, 0x00101ee5,
-+ 0x4d300000, 0x59a26001, 0x5930020b, 0x59301c0a,
-+ 0x900001c0, 0x800c1d40, 0x5930040d, 0x5930120d,
-+ 0x900001c0, 0x80081540, 0x592c0a05, 0x832c0400,
-+ 0x00000006, 0x0201f800, 0x001036dd, 0x4a01d809,
-+ 0x00102673, 0x4a034000, 0x00000001, 0x5c026000,
-+ 0x1c01f000, 0x4933c857, 0x4c300000, 0x5930040b,
-+ 0x82000c80, 0x0000000e, 0x04001004, 0x4a025a05,
-+ 0x0000000e, 0x0401f003, 0x48025a05, 0x0401f00a,
-+ 0x800409c0, 0x04000008, 0x4c040000, 0x0201f800,
-+ 0x001036b6, 0x5c000800, 0x04000005, 0x40040000,
-+ 0x0401f7f0, 0x82000540, 0x00000001, 0x5c006000,
- 0x1c01f000, 0x59a00206, 0x82000580, 0x00000044,
-- 0x1c01f000, 0x4807c857, 0x800409c0, 0x0400000c,
-- 0x0201f800, 0x001016c1, 0x04020009, 0x42000000,
-- 0x00000002, 0x0201f800, 0x001018fa, 0x42000000,
-- 0x00000002, 0x0201f800, 0x00101892, 0x59a00406,
-- 0x82000500, 0x00000007, 0x0c01f001, 0x001028ed,
-- 0x00102902, 0x00102918, 0x001028eb, 0x001028eb,
-- 0x001028eb, 0x001028eb, 0x001028eb, 0x0201f000,
-- 0x001020b6, 0x42000800, 0x000000c0, 0x0201f800,
-- 0x001019ac, 0x82040540, 0x00000002, 0x42000800,
-- 0x000000c0, 0x0201f800, 0x001019b1, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019ac, 0x82040540,
-+ 0x1c01f000, 0x490fc857, 0x8d0e1d0e, 0x0400000c,
-+ 0x0201f800, 0x001015b2, 0x04020009, 0x42000000,
-+ 0x00000002, 0x0201f800, 0x001017f8, 0x42000000,
-+ 0x00000002, 0x0201f800, 0x0010178b, 0x59a00406,
-+ 0x82000500, 0x00000007, 0x0c01f001, 0x00102719,
-+ 0x0010272e, 0x00102744, 0x00102717, 0x00102717,
-+ 0x00102717, 0x00102717, 0x00102717, 0x0201f000,
-+ 0x00101edd, 0x42000800, 0x000000c0, 0x0201f800,
-+ 0x00101899, 0x82040540, 0x00000002, 0x42000800,
-+ 0x000000c0, 0x0201f800, 0x001018a5, 0x42000800,
-+ 0x00000000, 0x0201f800, 0x00101899, 0x82040540,
- 0x00000008, 0x42000800, 0x00000000, 0x0201f800,
-- 0x001019b1, 0x0401f00b, 0x42000800, 0x000000c0,
-- 0x0201f800, 0x001019ac, 0x82040540, 0x00000001,
-- 0x42000800, 0x000000c0, 0x0201f800, 0x001019b1,
-- 0x59c80040, 0x4c000000, 0x59a80010, 0x4c000000,
-+ 0x001018a5, 0x0401f00b, 0x42000800, 0x000000c0,
-+ 0x0201f800, 0x00101899, 0x82040540, 0x00000001,
-+ 0x42000800, 0x000000c0, 0x0201f800, 0x001018a5,
-+ 0x59c80040, 0x4c000000, 0x59a8000f, 0x4c000000,
- 0x59c400a3, 0x4c000000, 0x59c40008, 0x4c000000,
-- 0x0401f911, 0x04000021, 0x0201f800, 0x00100615,
-- 0x59a80821, 0x800409c0, 0x02020000, 0x001020ba,
-- 0x0201f800, 0x00104e0d, 0x04020005, 0x4a034406,
-- 0x00000016, 0x0201f000, 0x001020b2, 0x836c0580,
-- 0x00000003, 0x02020000, 0x001020ba, 0x59c408a4,
-- 0x82040d00, 0x0000000f, 0x82040580, 0x00000000,
-- 0x02020000, 0x001020ba, 0x59c80040, 0x4c000000,
-- 0x59a80010, 0x4c000000, 0x59c400a3, 0x4c000000,
-- 0x59c40008, 0x4c000000, 0x59c40080, 0x4c000000,
-- 0x59a0020f, 0x59a0bc0f, 0x905cb9c0, 0x805cbd40,
-- 0x41784800, 0x41785000, 0x41785800, 0x41789000,
-- 0x41789800, 0x0401fe21, 0x0201f800, 0x0010698c,
-- 0x0201f800, 0x00100b29, 0x4178c000, 0x497b4002,
-- 0x0401f95c, 0x0401f9aa, 0x59a0020c, 0x59a00c0c,
-- 0x80040d40, 0x04000002, 0x0401f9fb, 0x0401f9fa,
-- 0x0401fe68, 0x8060c1c0, 0x04020014, 0x0401fa98,
-- 0x0401feb2, 0x0402000e, 0x0201f800, 0x00101941,
-- 0x04020008, 0x4a034406, 0x00000017, 0x0201f800,
-- 0x001020b2, 0x4203e000, 0x50000000, 0x0401f000,
-- 0x42005800, 0x0000aaaa, 0x0401f058, 0x59c80001,
-- 0x800001c0, 0x040007ee, 0x59c80801, 0x800409c0,
-- 0x04000006, 0x0401fa70, 0x40240000, 0x80280540,
-- 0x802c0540, 0x0402004d, 0x59a00002, 0x82000580,
-- 0xfeedbeef, 0x04000004, 0x42008800, 0x10000000,
-- 0x0401f003, 0x42008800, 0x10000004, 0x0401fa19,
-- 0x4a034002, 0xfeedbeef, 0x0401fa71, 0x0401fa97,
-- 0x0401fea8, 0x59c40005, 0x8c000534, 0x04000004,
-- 0x42005800, 0x0000bbbb, 0x0401f038, 0x0401fe83,
-- 0x04020007, 0x42005800, 0x0000cccc, 0x485f420f,
-- 0x905cb9c0, 0x485f440f, 0x0401f030, 0x59a0040c,
-- 0x800001c0, 0x0400000e, 0x59a26000, 0x5930000d,
-- 0x800001c0, 0x040207be, 0x59a26001, 0x5930080d,
-- 0x800409c0, 0x040207ba, 0x804891c0, 0x040207b8,
-- 0x804c99c0, 0x040207b6, 0x0401f87a, 0x805cb840,
-- 0x04000005, 0x40240000, 0x80280540, 0x802c0540,
-- 0x0402001a, 0x42000000, 0x00030d40, 0x80000040,
-- 0x04020012, 0x59c00007, 0x82000500, 0x000501c0,
-- 0x0402000b, 0x0201f800, 0x00101941, 0x04020008,
-- 0x4a034406, 0x00000017, 0x0201f800, 0x001020b2,
-+ 0x0401f910, 0x04000020, 0x0201f800, 0x001004ef,
-+ 0x8d0e1d0e, 0x02020000, 0x00101ee1, 0x0201f800,
-+ 0x00104ca6, 0x04020005, 0x4a034406, 0x00000016,
-+ 0x0201f000, 0x00101ed9, 0x836c0580, 0x00000003,
-+ 0x02020000, 0x00101ee1, 0x59c408a4, 0x82040d00,
-+ 0x0000000f, 0x82040580, 0x00000000, 0x02020000,
-+ 0x00101ee1, 0x59c80040, 0x4c000000, 0x59a8000f,
-+ 0x4c000000, 0x59c400a3, 0x4c000000, 0x59c40008,
-+ 0x4c000000, 0x59c40080, 0x4c000000, 0x59a0020f,
-+ 0x59a0bc0f, 0x905cb9c0, 0x805cbd40, 0x41784800,
-+ 0x41785000, 0x41785800, 0x41789000, 0x41789800,
-+ 0x0401fe23, 0x0201f800, 0x00106476, 0x0201f800,
-+ 0x00100a20, 0x4178c000, 0x497b4002, 0x0401f95a,
-+ 0x0401f9a8, 0x59a0020c, 0x59a00c0c, 0x80040d40,
-+ 0x04000002, 0x0401f9f9, 0x0401f9f8, 0x0401fe6a,
-+ 0x8060c1c0, 0x04020014, 0x0401fa96, 0x0401feb4,
-+ 0x0402000e, 0x0201f800, 0x0010184d, 0x04020008,
-+ 0x4a034406, 0x00000017, 0x0201f800, 0x00101ed9,
- 0x4203e000, 0x50000000, 0x0401f000, 0x42005800,
-- 0x0000dddd, 0x0401f005, 0x59c00807, 0x82040d00,
-- 0x0000000c, 0x040007ea, 0x0401fe5c, 0x59a0040c,
-- 0x800001c0, 0x04000002, 0x0401f856, 0x0401fe6b,
-- 0x40240000, 0x80280540, 0x802c0540, 0x04020003,
-- 0x805cb9c0, 0x04020781, 0x0201f800, 0x00106c8a,
-- 0x0401fda3, 0x4201d000, 0x000186a0, 0x0201f800,
-- 0x00105e06, 0x5c000800, 0x48078880, 0x5c000800,
-- 0x48078808, 0x5c000800, 0x480788a3, 0x5c000800,
-- 0x48075010, 0x5c000800, 0x48079040, 0x0201f800,
-- 0x001009b6, 0x59a00406, 0x82000500, 0x00000003,
-- 0x82000580, 0x00000002, 0x0400002c, 0x42000800,
-- 0x000000c0, 0x0201f800, 0x001019ac, 0x82040500,
-- 0xfffffffc, 0x42000800, 0x000000c0, 0x0201f800,
-- 0x001019b1, 0x42000800, 0x00000000, 0x0201f800,
-- 0x001019ac, 0x82040500, 0xfffffff7, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019b1, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019ac, 0x82040500,
-- 0xfffffffb, 0x42000800, 0x00000000, 0x0201f800,
-- 0x001019b1, 0x4a0388a7, 0x0000f7f7, 0x42006000,
-- 0xbeffffff, 0x42006800, 0x80018000, 0x0201f800,
-- 0x001040ad, 0x42006000, 0xfffeffff, 0x41786800,
-- 0x0201f800, 0x001040ad, 0x402c0000, 0x80280540,
-- 0x80240540, 0x02000000, 0x00102066, 0x48274406,
-- 0x482b4207, 0x482f4407, 0x0201f000, 0x001020c2,
-- 0x59a26000, 0x813261c0, 0x0400000e, 0x59325808,
-- 0x812e59c0, 0x0400000b, 0x0201f800, 0x000208b4,
-- 0x0201f800, 0x00100843, 0x59a26001, 0x59325808,
-- 0x0201f800, 0x000208b4, 0x0201f800, 0x00100843,
-- 0x1c01f000, 0x42000800, 0x000000ef, 0x0201f800,
-- 0x00101655, 0x59c400a3, 0x8400055a, 0x8400053a,
-- 0x480388a3, 0x0201f800, 0x001016ac, 0x0402000a,
-- 0x42000000, 0x00000001, 0x0201f800, 0x001018fa,
-- 0x42000000, 0x00000001, 0x0201f800, 0x00101892,
-- 0x0401f013, 0x0201f800, 0x001016b3, 0x04020008,
-- 0x41780000, 0x0201f800, 0x001018fa, 0x41780000,
-- 0x0201f800, 0x00101892, 0x0401f009, 0x42000000,
-- 0x00000002, 0x0201f800, 0x001018fa, 0x42000000,
-- 0x00000002, 0x0201f800, 0x00101892, 0x42000800,
-- 0x00000000, 0x0201f800, 0x001019ac, 0x82040540,
-- 0x00000004, 0x42000800, 0x00000000, 0x0201f800,
-- 0x001019b1, 0x4201d000, 0x00000014, 0x0201f800,
-- 0x00105dd2, 0x59c40008, 0x8400054e, 0x82000500,
-- 0xffffffe1, 0x48038808, 0x4a0388a7, 0x0000f7f7,
-- 0x42001000, 0x04000001, 0x0201f800, 0x001019aa,
-- 0x42006000, 0xbe20bfff, 0x42006800, 0x80018000,
-- 0x0201f800, 0x001040ad, 0x42006000, 0xfffeffff,
-- 0x41786800, 0x0201f800, 0x001040ad, 0x4200b000,
-- 0x00001388, 0x4201d000, 0x00000014, 0x4c580000,
-- 0x0201f800, 0x00105dd2, 0x0201f800, 0x00101941,
-- 0x5c00b000, 0x04000004, 0x8058b040, 0x040207f6,
-- 0x0401f025, 0x59c40005, 0x8c000534, 0x04020007,
-+ 0x0000aaaa, 0x0401f058, 0x59c80001, 0x800001c0,
-+ 0x040007ee, 0x59c80801, 0x800409c0, 0x04000006,
-+ 0x0401fa6e, 0x40240000, 0x80280540, 0x802c0540,
-+ 0x0402004d, 0x59a00002, 0x82000580, 0xfeedbeef,
-+ 0x04000004, 0x42008800, 0x10000000, 0x0401f003,
-+ 0x42008800, 0x10000004, 0x0401fa17, 0x4a034002,
-+ 0xfeedbeef, 0x0401fa6f, 0x0401fa92, 0x0401feaa,
-+ 0x59c40005, 0x8c000534, 0x04000004, 0x42005800,
-+ 0x0000bbbb, 0x0401f038, 0x0401fe85, 0x04020007,
-+ 0x42005800, 0x0000cccc, 0x485f420f, 0x905cb9c0,
-+ 0x485f440f, 0x0401f030, 0x59a0040c, 0x800001c0,
-+ 0x0400000e, 0x59a26000, 0x5930000d, 0x800001c0,
-+ 0x040207be, 0x59a26001, 0x5930080d, 0x800409c0,
-+ 0x040207ba, 0x804891c0, 0x040207b8, 0x804c99c0,
-+ 0x040207b6, 0x0401f87a, 0x805cb840, 0x04000005,
-+ 0x40240000, 0x80280540, 0x802c0540, 0x0402001a,
-+ 0x42000000, 0x00030d40, 0x80000040, 0x04020012,
-+ 0x59c00007, 0x82000500, 0x000501c0, 0x0402000b,
-+ 0x0201f800, 0x0010184d, 0x04020008, 0x4a034406,
-+ 0x00000017, 0x0201f800, 0x00101ed9, 0x4203e000,
-+ 0x50000000, 0x0401f000, 0x42005800, 0x0000dddd,
-+ 0x0401f005, 0x59c00807, 0x82040d00, 0x0000000c,
-+ 0x040007ea, 0x0401fe5e, 0x59a0040c, 0x800001c0,
-+ 0x04000002, 0x0401f856, 0x0401fe6d, 0x40240000,
-+ 0x80280540, 0x802c0540, 0x04020003, 0x805cb9c0,
-+ 0x04020781, 0x0201f800, 0x0010677d, 0x0401fda5,
-+ 0x4201d000, 0x000186a0, 0x0201f800, 0x00105cb0,
-+ 0x5c000800, 0x48078880, 0x5c000800, 0x48078808,
-+ 0x5c000800, 0x480788a3, 0x5c000800, 0x4807500f,
-+ 0x5c000800, 0x48079040, 0x0201f800, 0x001008ac,
-+ 0x59a00406, 0x82000500, 0x00000003, 0x82000580,
-+ 0x00000002, 0x0400002c, 0x42000800, 0x000000c0,
-+ 0x0201f800, 0x00101899, 0x82040500, 0xfffffffc,
-+ 0x42000800, 0x000000c0, 0x0201f800, 0x001018a5,
-+ 0x42000800, 0x00000000, 0x0201f800, 0x00101899,
-+ 0x82040500, 0xfffffff7, 0x42000800, 0x00000000,
-+ 0x0201f800, 0x001018a5, 0x42000800, 0x00000000,
-+ 0x0201f800, 0x00101899, 0x82040500, 0xfffffffb,
-+ 0x42000800, 0x00000000, 0x0201f800, 0x001018a5,
-+ 0x4a0388a7, 0x0000f7f7, 0x42006000, 0xbeffffff,
-+ 0x42006800, 0x80018000, 0x0201f800, 0x00103f44,
-+ 0x42006000, 0xfffeffff, 0x41786800, 0x0201f800,
-+ 0x00103f44, 0x402c0000, 0x80280540, 0x80240540,
-+ 0x02000000, 0x00101e8d, 0x48274406, 0x482b4207,
-+ 0x482f4407, 0x0201f000, 0x00101ee9, 0x59a26000,
-+ 0x813261c0, 0x0400000e, 0x59325808, 0x812e59c0,
-+ 0x0400000b, 0x0201f800, 0x000207bb, 0x0201f800,
-+ 0x0010073b, 0x59a26001, 0x59325808, 0x0201f800,
-+ 0x000207bb, 0x0201f800, 0x0010073b, 0x1c01f000,
-+ 0x42000800, 0x000000ef, 0x0201f800, 0x0010151e,
-+ 0x59c400a3, 0x8400055a, 0x8400053a, 0x480388a3,
-+ 0x0201f800, 0x00101582, 0x0402000a, 0x42000000,
-+ 0x00000001, 0x0201f800, 0x001017f8, 0x42000000,
-+ 0x00000001, 0x0201f800, 0x0010178b, 0x0401f013,
-+ 0x0201f800, 0x00101592, 0x04020008, 0x41780000,
-+ 0x0201f800, 0x001017f8, 0x41780000, 0x0201f800,
-+ 0x0010178b, 0x0401f009, 0x42000000, 0x00000002,
-+ 0x0201f800, 0x001017f8, 0x42000000, 0x00000002,
-+ 0x0201f800, 0x0010178b, 0x42000800, 0x00000000,
-+ 0x0201f800, 0x00101899, 0x82040540, 0x00000004,
-+ 0x42000800, 0x00000000, 0x0201f800, 0x001018a5,
-+ 0x4201d000, 0x00000014, 0x0201f800, 0x00105c78,
-+ 0x59c40008, 0x8400054e, 0x82000500, 0xffffffe1,
-+ 0x48038808, 0x4a0388a7, 0x0000f7f7, 0x4a038805,
-+ 0x04000001, 0x42006000, 0xbe20bfff, 0x42006800,
-+ 0x80018000, 0x0201f800, 0x00103f44, 0x42006000,
-+ 0xfffeffff, 0x41786800, 0x0201f800, 0x00103f44,
-+ 0x4200b000, 0x00001388, 0x4201d000, 0x00000014,
-+ 0x4c580000, 0x0201f800, 0x00105c78, 0x0201f800,
-+ 0x0010184d, 0x5c00b000, 0x04000004, 0x8058b040,
-+ 0x040207f6, 0x0401f025, 0x59c40005, 0x8c000534,
-+ 0x04020007, 0x59c400a4, 0x82000500, 0x0000000f,
-+ 0x82000580, 0x00000008, 0x0402001c, 0x42006000,
-+ 0x00020000, 0x0201f800, 0x00103f4a, 0x4201d000,
-+ 0x00000064, 0x0201f800, 0x00105c78, 0x42006000,
-+ 0xfeffffff, 0x42006800, 0x02000000, 0x0201f800,
-+ 0x00103f44, 0x42006000, 0xfdffffff, 0x41786800,
-+ 0x0201f800, 0x00103f44, 0x4a038805, 0x04000001,
- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-- 0x00000008, 0x0402001c, 0x42006000, 0x00020000,
-- 0x0201f800, 0x001040b2, 0x4201d000, 0x00000064,
-- 0x0201f800, 0x00105dd2, 0x42006000, 0xfeffffff,
-- 0x42006800, 0x02000000, 0x0201f800, 0x001040ad,
-- 0x42006000, 0xfdffffff, 0x41786800, 0x0201f800,
-- 0x001040ad, 0x4a038805, 0x04000001, 0x59c400a4,
-- 0x82000500, 0x0000000f, 0x82000580, 0x00000000,
-- 0x04000003, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x4803c856, 0x42038000, 0x00007700, 0x0201f800,
-- 0x00100f0f, 0x59c00006, 0x59a0040c, 0x800001c0,
-- 0x0400003f, 0x59a03c0c, 0x59a00209, 0x59a01c09,
-- 0x900c19c0, 0x800c1d40, 0x59a0020e, 0x59a0240e,
-- 0x901021c0, 0x80102540, 0x59a0020b, 0x82000500,
-- 0x0000fffc, 0x59a0140b, 0x900811c0, 0x80081540,
-- 0x480b8003, 0x0201f800, 0x00020892, 0x02000800,
-- 0x00100615, 0x49334000, 0x0201f800, 0x0010082a,
-- 0x4a025a04, 0x00000018, 0x4a025805, 0x00abcdef,
-- 0x492e6008, 0x492e600b, 0x481e600d, 0x4a02600c,
-- 0x00000004, 0x832c0400, 0x00000011, 0x4802600a,
-- 0x42001000, 0x0000000c, 0x821c0d80, 0x00000001,
-- 0x04000004, 0x801c3840, 0x0401f963, 0x0401f004,
-- 0x41783800, 0x0401f960, 0x0401f011, 0x821c0c80,
-- 0x00000005, 0x04001005, 0x40043800, 0x42001000,
-- 0x0000003c, 0x0401f006, 0x80001580, 0x82081400,
-- 0x0000000c, 0x801c3840, 0x040207fd, 0x832c0400,
-- 0x00000005, 0x0401f950, 0x040207f1, 0x497b9009,
-- 0x59e00003, 0x82000540, 0x00008060, 0x4803c003,
-- 0x4a038009, 0x00e00000, 0x1c01f000, 0x4803c856,
-- 0x41780800, 0x8007a0ca, 0x83d3a400, 0x00007600,
-- 0x42000800, 0x00000040, 0x0201f800, 0x00101395,
-- 0x4a03a00a, 0x00000001, 0x4a03a005, 0x20000000,
-- 0x59d00006, 0x4a03a005, 0x30000000, 0x59d00006,
-- 0x8c00050a, 0x040207fe, 0x59d00005, 0x59a0020c,
-- 0x800001c0, 0x0400003f, 0x59a03a0c, 0x59a00210,
-- 0x59a01c10, 0x900c19c0, 0x800c1d40, 0x59a0020d,
-- 0x59a0240d, 0x901021c0, 0x80102540, 0x59a0120b,
-- 0x82081500, 0x0000fffc, 0x59a0040b, 0x900001c0,
-- 0x80081540, 0x480ba003, 0x0201f800, 0x00020892,
-- 0x02000800, 0x00100615, 0x49334001, 0x0201f800,
-- 0x0010082a, 0x4a025a04, 0x00000018, 0x4a025805,
-+ 0x00000000, 0x04000003, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x4803c856, 0x42038000, 0x00007700,
-+ 0x0201f800, 0x00100e08, 0x59c00006, 0x59a0040c,
-+ 0x800001c0, 0x0400003f, 0x59a03c0c, 0x59a00209,
-+ 0x59a01c09, 0x900c19c0, 0x800c1d40, 0x59a0020e,
-+ 0x59a0240e, 0x901021c0, 0x80102540, 0x59a0020b,
-+ 0x82000500, 0x0000fffc, 0x59a0140b, 0x900811c0,
-+ 0x80081540, 0x480b8003, 0x0201f800, 0x00020799,
-+ 0x02000800, 0x001004ef, 0x49334000, 0x0201f800,
-+ 0x0010071a, 0x4a025a04, 0x00000018, 0x4a025805,
- 0x00abcdef, 0x492e6008, 0x492e600b, 0x481e600d,
- 0x4a02600c, 0x00000004, 0x832c0400, 0x00000011,
- 0x4802600a, 0x42001000, 0x0000000c, 0x821c0d80,
-- 0x00000001, 0x04000004, 0x801c3840, 0x0401f906,
-- 0x0401f004, 0x41783800, 0x0401f903, 0x0401f011,
-+ 0x00000001, 0x04000004, 0x801c3840, 0x0401f960,
-+ 0x0401f004, 0x41783800, 0x0401f95d, 0x0401f011,
- 0x821c0c80, 0x00000005, 0x04001005, 0x40043800,
- 0x42001000, 0x0000003c, 0x0401f006, 0x80001580,
- 0x82081400, 0x0000000c, 0x801c3840, 0x040207fd,
-- 0x832c0400, 0x00000005, 0x0401f8f3, 0x040207f1,
-- 0x1c01f000, 0x4803c856, 0x59a0020c, 0x800001c0,
-- 0x04000024, 0x824c0580, 0x00000002, 0x04000040,
-- 0x59a26001, 0x5930380d, 0x801c39c0, 0x0400003c,
-+ 0x832c0400, 0x00000005, 0x0401f94d, 0x040207f1,
-+ 0x497b9009, 0x59e00003, 0x82000540, 0x00008060,
-+ 0x4803c003, 0x4a038009, 0x00e00000, 0x1c01f000,
-+ 0x4803c856, 0x41780800, 0x8007a0ca, 0x83d3a400,
-+ 0x00007600, 0x42000800, 0x00000040, 0x0201f800,
-+ 0x00101265, 0x4a03a00a, 0x00000001, 0x4a03a005,
-+ 0x20000000, 0x59d00006, 0x4a03a005, 0x30000000,
-+ 0x59d00006, 0x8c00050a, 0x040207fe, 0x59d00005,
-+ 0x59a0020c, 0x800001c0, 0x0400003f, 0x59a03a0c,
-+ 0x59a00210, 0x59a01c10, 0x900c19c0, 0x800c1d40,
-+ 0x59a0020d, 0x59a0240d, 0x901021c0, 0x80102540,
-+ 0x59a0120b, 0x82081500, 0x0000fffc, 0x59a0040b,
-+ 0x900001c0, 0x80081540, 0x480ba003, 0x0201f800,
-+ 0x00020799, 0x02000800, 0x001004ef, 0x49334001,
-+ 0x0201f800, 0x0010071a, 0x4a025a04, 0x00000018,
-+ 0x4a025805, 0x00abcdef, 0x492e6008, 0x492e600b,
-+ 0x481e600d, 0x4a02600c, 0x00000004, 0x832c0400,
-+ 0x00000011, 0x4802600a, 0x42001000, 0x0000000c,
-+ 0x821c0d80, 0x00000001, 0x04000004, 0x801c3840,
-+ 0x0401f903, 0x0401f004, 0x41783800, 0x0401f900,
-+ 0x0401f011, 0x821c0c80, 0x00000005, 0x04001005,
-+ 0x40043800, 0x42001000, 0x0000003c, 0x0401f006,
-+ 0x80001580, 0x82081400, 0x0000000c, 0x801c3840,
-+ 0x040207fd, 0x832c0400, 0x00000005, 0x0401f8f0,
-+ 0x040207f1, 0x1c01f000, 0x4803c856, 0x59a0020c,
-+ 0x800001c0, 0x04000024, 0x824c0580, 0x00000002,
-+ 0x04000040, 0x59a26001, 0x5930380d, 0x801c39c0,
-+ 0x0400003c, 0x801c3840, 0x481e600d, 0x5932580b,
-+ 0x5930080a, 0x50042000, 0x58041801, 0x58041002,
-+ 0x82081500, 0xfffffffc, 0x5930000c, 0x80000000,
-+ 0x82000d80, 0x00000005, 0x04020009, 0x497a600c,
-+ 0x592e5801, 0x812e59c0, 0x0400001a, 0x492e600b,
-+ 0x832c0c00, 0x00000005, 0x0401f005, 0x4802600c,
-+ 0x5930080a, 0x82040c00, 0x00000003, 0x4806600a,
-+ 0x0401f010, 0x59a0120b, 0x82081500, 0x0000fffc,
-+ 0x59a0040b, 0x900001c0, 0x80081540, 0x480ba003,
-+ 0x59a0020d, 0x59a0240d, 0x901021c0, 0x80102540,
-+ 0x59a00210, 0x59a01c10, 0x900c19c0, 0x800c1d40,
-+ 0x4201d000, 0x00003a98, 0x0201f800, 0x00105cb0,
-+ 0x480ba002, 0x59a80056, 0x4803a008, 0x4813a000,
-+ 0x480fa001, 0x4a03a005, 0x10000000, 0x02005800,
-+ 0x001004ef, 0x804c9800, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x4847c857, 0x59a0040c, 0x800001c0,
-+ 0x04000024, 0x82480580, 0x00000002, 0x04000042,
-+ 0x59a26000, 0x5930380d, 0x801c39c0, 0x0400003e,
- 0x801c3840, 0x481e600d, 0x5932580b, 0x5930080a,
- 0x50042000, 0x58041801, 0x58041002, 0x82081500,
- 0xfffffffc, 0x5930000c, 0x80000000, 0x82000d80,
- 0x00000005, 0x04020009, 0x497a600c, 0x592e5801,
-- 0x812e59c0, 0x0400001a, 0x492e600b, 0x832c0c00,
-+ 0x812e59c0, 0x0400001d, 0x492e600b, 0x832c0c00,
- 0x00000005, 0x0401f005, 0x4802600c, 0x5930080a,
-- 0x82040c00, 0x00000003, 0x4806600a, 0x0401f010,
-- 0x59a0120b, 0x82081500, 0x0000fffc, 0x59a0040b,
-- 0x900001c0, 0x80081540, 0x480ba003, 0x59a0020d,
-- 0x59a0240d, 0x901021c0, 0x80102540, 0x59a00210,
-- 0x59a01c10, 0x900c19c0, 0x800c1d40, 0x4201d000,
-- 0x00003a98, 0x0201f800, 0x00105e06, 0x480ba002,
-- 0x59a80059, 0x4803a008, 0x4813a000, 0x480fa001,
-- 0x4a03a005, 0x10000000, 0x02005800, 0x00100615,
-- 0x804c9800, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x4847c857, 0x59a0040c, 0x800001c0, 0x04000024,
-- 0x82480580, 0x00000002, 0x04000042, 0x59a26000,
-- 0x5930380d, 0x801c39c0, 0x0400003e, 0x801c3840,
-- 0x481e600d, 0x5932580b, 0x5930080a, 0x50042000,
-- 0x58041801, 0x58041002, 0x82081500, 0xfffffffc,
-- 0x5930000c, 0x80000000, 0x82000d80, 0x00000005,
-- 0x04020009, 0x497a600c, 0x592e5801, 0x812e59c0,
-- 0x0400001d, 0x492e600b, 0x832c0c00, 0x00000005,
-- 0x0401f005, 0x4802600c, 0x5930080a, 0x82040c00,
-- 0x00000003, 0x4806600a, 0x0401f013, 0x82440580,
-- 0x10000000, 0x0402001f, 0x59a0020e, 0x59a0240e,
-- 0x901021c0, 0x80102540, 0x59a00209, 0x59a01c09,
-- 0x900c19c0, 0x800c1d40, 0x59a0020b, 0x82000500,
-- 0x0000fffc, 0x59a0140b, 0x900811c0, 0x80081540,
-- 0x480b8003, 0x48138000, 0x480f8001, 0x480b8002,
-- 0x59c80018, 0x82000500, 0xf0000000, 0x59c02008,
-- 0x82102500, 0x0fffffff, 0x80100540, 0x48038008,
-- 0x48478006, 0x80489000, 0x8260c540, 0x00000001,
-- 0x1c01f000, 0x59c00009, 0x4803c857, 0x82000d00,
-- 0x00e00000, 0x0400000d, 0x485f420f, 0x905cb9c0,
-- 0x485f440f, 0x8c00052e, 0x04000002, 0x80285000,
-- 0x8c00052c, 0x04000002, 0x80244800, 0x8c00052a,
-- 0x04000002, 0x802c5800, 0x1c01f000, 0x59a0020c,
-- 0x800001c0, 0x04000024, 0x59d00806, 0x4807c857,
-- 0x8c040d3e, 0x04000020, 0x4a03a005, 0x20000000,
-- 0x4a03a005, 0x30000000, 0x59d00806, 0x8c040d0a,
-- 0x040207fe, 0x824c0480, 0x00000003, 0x02021800,
-- 0x00100615, 0x404c0000, 0x0c01f001, 0x00102c02,
-- 0x00102c04, 0x00102c0a, 0x0201f800, 0x00100615,
-- 0x80000040, 0x40009800, 0x0401ff43, 0x0400000a,
-- 0x0401ff41, 0x0401f008, 0x80000040, 0x40009800,
-- 0x59d00806, 0x4807c857, 0x8c040d3e, 0x040207e3,
-- 0x0401ff39, 0x1c01f000, 0x59a0040c, 0x800001c0,
-- 0x04000024, 0x59c00807, 0x4807c857, 0x8c040d3e,
-- 0x04000020, 0x59c00807, 0x4a038006, 0x20000000,
-- 0x82480480, 0x00000003, 0x02021800, 0x00100615,
-- 0x40480000, 0x0c01f001, 0x00102c25, 0x00102c27,
-- 0x00102c2f, 0x0201f800, 0x00100615, 0x80000040,
-- 0x40009000, 0x42008800, 0x10000004, 0x0401ff65,
-- 0x0400000c, 0x0401ff63, 0x0401f00a, 0x80000040,
-- 0x40009000, 0x59c00807, 0x4807c857, 0x8c040d3e,
-- 0x040207e5, 0x42008800, 0x10000004, 0x0401ff59,
-- 0x1c01f000, 0x492fc857, 0x4000a800, 0x4a03b805,
-- 0x20000000, 0x59dc0006, 0x4a03b805, 0x30000000,
-- 0x4813b800, 0x480fb801, 0x480bb802, 0x4857b803,
-- 0x4a03b805, 0x30000002, 0x59dc0006, 0x4a03b805,
-- 0x70000001, 0x59dc0006, 0x4a03b805, 0x10000000,
-- 0x59dc0006, 0x8c00053e, 0x040007fe, 0x4a03b805,
-- 0x20000000, 0x59dc0006, 0x59dc2000, 0x59dc1801,
-- 0x801c39c0, 0x0400000a, 0x4d2c0000, 0x0201f800,
-- 0x0010082a, 0x5c000800, 0x02000800, 0x00100615,
-- 0x4a025a04, 0x0000000a, 0x492c0801, 0x1c01f000,
-- 0x42006000, 0x00102d9d, 0x42000800, 0x0000007c,
-- 0x0201f800, 0x00101395, 0x4a03902c, 0x00200000,
-- 0x4200b000, 0x000001f4, 0x59c8002c, 0x8c00052c,
-- 0x04000007, 0x8058b040, 0x040207fc, 0x42000000,
-- 0x00004003, 0x41781000, 0x0401f11e, 0x50301000,
-- 0x41784800, 0x4a03902d, 0x00008000, 0x4200b000,
-- 0x000001f4, 0x59c8002c, 0x8c000534, 0x04000007,
-- 0x8058b040, 0x040207fc, 0x42000000, 0x00004003,
-- 0x41781000, 0x0401f10f, 0x0401f895, 0x80244800,
-- 0x82240580, 0x000003b1, 0x040207fc, 0x0401f911,
-- 0x41784800, 0x0401f8bb, 0x80244800, 0x82240580,
-- 0x000003b1, 0x040207fc, 0x80306000, 0x82300580,
-- 0x00102d9f, 0x040207e2, 0x59a80863, 0x800409c0,
-+ 0x82040c00, 0x00000003, 0x4806600a, 0x0401f013,
-+ 0x82440580, 0x10000000, 0x0402001f, 0x59a0020e,
-+ 0x59a0240e, 0x901021c0, 0x80102540, 0x59a00209,
-+ 0x59a01c09, 0x900c19c0, 0x800c1d40, 0x59a0020b,
-+ 0x82000500, 0x0000fffc, 0x59a0140b, 0x900811c0,
-+ 0x80081540, 0x480b8003, 0x48138000, 0x480f8001,
-+ 0x480b8002, 0x59c80018, 0x82000500, 0xf0000000,
-+ 0x59c02008, 0x82102500, 0x0fffffff, 0x80100540,
-+ 0x48038008, 0x48478006, 0x80489000, 0x8260c540,
-+ 0x00000001, 0x1c01f000, 0x59c00009, 0x4803c857,
-+ 0x82000d00, 0x00e00000, 0x0400000d, 0x485f420f,
-+ 0x905cb9c0, 0x485f440f, 0x8c00052e, 0x04000002,
-+ 0x80285000, 0x8c00052c, 0x04000002, 0x80244800,
-+ 0x8c00052a, 0x04000002, 0x802c5800, 0x1c01f000,
-+ 0x59a0020c, 0x800001c0, 0x04000021, 0x59d00806,
-+ 0x4807c857, 0x8c040d3e, 0x0400001d, 0x8c040d04,
-+ 0x0400001b, 0x4a03a005, 0x20000000, 0x824c0480,
-+ 0x00000003, 0x02021800, 0x001004ef, 0x404c0000,
-+ 0x0c01f001, 0x00102a28, 0x00102a2a, 0x00102a30,
-+ 0x0201f800, 0x001004ef, 0x80000040, 0x40009800,
-+ 0x0401ff46, 0x0400000a, 0x0401ff44, 0x0401f008,
-+ 0x80000040, 0x40009800, 0x59d00806, 0x4807c857,
-+ 0x8c040d3e, 0x040207e8, 0x0401ff3c, 0x1c01f000,
-+ 0x59a0040c, 0x800001c0, 0x04000024, 0x59c00807,
-+ 0x4807c857, 0x8c040d3e, 0x04000020, 0x59c00807,
-+ 0x4a038006, 0x20000000, 0x82480480, 0x00000003,
-+ 0x02021800, 0x001004ef, 0x40480000, 0x0c01f001,
-+ 0x00102a4b, 0x00102a4d, 0x00102a55, 0x0201f800,
-+ 0x001004ef, 0x80000040, 0x40009000, 0x42008800,
-+ 0x10000004, 0x0401ff68, 0x0400000c, 0x0401ff66,
-+ 0x0401f00a, 0x80000040, 0x40009000, 0x59c00807,
-+ 0x4807c857, 0x8c040d3e, 0x040207e5, 0x42008800,
-+ 0x10000004, 0x0401ff5c, 0x1c01f000, 0x492fc857,
-+ 0x4000a800, 0x4a03b805, 0x20000000, 0x59dc0006,
-+ 0x4a03b805, 0x30000000, 0x4813b800, 0x480fb801,
-+ 0x480bb802, 0x4857b803, 0x4a03b805, 0x30000002,
-+ 0x59dc0006, 0x4a03b805, 0x70000001, 0x59dc0006,
-+ 0x4a03b805, 0x10000000, 0x59dc0006, 0x8c00053e,
-+ 0x040007fe, 0x4a03b805, 0x20000000, 0x59dc0006,
-+ 0x59dc2000, 0x59dc1801, 0x801c39c0, 0x0400000a,
-+ 0x4d2c0000, 0x0201f800, 0x0010071a, 0x5c000800,
-+ 0x02000800, 0x001004ef, 0x4a025a04, 0x0000000a,
-+ 0x492c0801, 0x1c01f000, 0x42006000, 0x00102bc3,
-+ 0x42000800, 0x0000007c, 0x0201f800, 0x00101265,
-+ 0x4a03902c, 0x00200000, 0x4200b000, 0x000001f4,
-+ 0x59c8002c, 0x8c00052c, 0x04000007, 0x8058b040,
-+ 0x040207fc, 0x42000000, 0x00004003, 0x41781000,
-+ 0x0401f11e, 0x50301000, 0x41784800, 0x4a03902d,
-+ 0x00008000, 0x4200b000, 0x000001f4, 0x59c8002c,
-+ 0x8c000534, 0x04000007, 0x8058b040, 0x040207fc,
-+ 0x42000000, 0x00004003, 0x41781000, 0x0401f10f,
-+ 0x0401f895, 0x80244800, 0x82240580, 0x000003b1,
-+ 0x040207fc, 0x0401f911, 0x41784800, 0x0401f8bb,
-+ 0x80244800, 0x82240580, 0x000003b1, 0x040207fc,
-+ 0x80306000, 0x82300580, 0x00102bc5, 0x040207e2,
-+ 0x59a80860, 0x800409c0, 0x04000007, 0x42000000,
-+ 0x00004004, 0x42001000, 0x00000002, 0x59a8185f,
-+ 0x0401f0f6, 0x42006000, 0x00102bc3, 0x50301000,
-+ 0x41784800, 0x4a03902d, 0x00000800, 0x0401f876,
-+ 0x80244800, 0x82240580, 0x00000018, 0x040207fc,
-+ 0x0401f8f2, 0x41784800, 0x0401f89c, 0x80244800,
-+ 0x82240580, 0x00000018, 0x040207fc, 0x80306000,
-+ 0x82300580, 0x00102bc5, 0x040207ed, 0x59a80860,
-+ 0x800409c0, 0x04000007, 0x42000000, 0x00004004,
-+ 0x42001000, 0x00000010, 0x59a8185f, 0x0401f0d7,
-+ 0x42006000, 0x00102bc3, 0x50301000, 0x41784800,
-+ 0x4a03902d, 0x00000400, 0x0401f857, 0x80244800,
-+ 0x82240580, 0x00000088, 0x040207fc, 0x0401f8d3,
-+ 0x41784800, 0x0401f87d, 0x80244800, 0x82240580,
-+ 0x00000088, 0x040207fc, 0x80306000, 0x82300580,
-+ 0x00102bc5, 0x040207ed, 0x59a80860, 0x800409c0,
- 0x04000007, 0x42000000, 0x00004004, 0x42001000,
-- 0x00000002, 0x59a81862, 0x0401f0f6, 0x42006000,
-- 0x00102d9d, 0x50301000, 0x41784800, 0x4a03902d,
-- 0x00000800, 0x0401f876, 0x80244800, 0x82240580,
-- 0x00000018, 0x040207fc, 0x0401f8f2, 0x41784800,
-- 0x0401f89c, 0x80244800, 0x82240580, 0x00000018,
-- 0x040207fc, 0x80306000, 0x82300580, 0x00102d9f,
-- 0x040207ed, 0x59a80863, 0x800409c0, 0x04000007,
-- 0x42000000, 0x00004004, 0x42001000, 0x00000010,
-- 0x59a81862, 0x0401f0d7, 0x42006000, 0x00102d9d,
-- 0x50301000, 0x41784800, 0x4a03902d, 0x00000400,
-- 0x0401f857, 0x80244800, 0x82240580, 0x00000088,
-- 0x040207fc, 0x0401f8d3, 0x41784800, 0x0401f87d,
-- 0x80244800, 0x82240580, 0x00000088, 0x040207fc,
-- 0x80306000, 0x82300580, 0x00102d9f, 0x040207ed,
-- 0x59a80863, 0x800409c0, 0x04000007, 0x42000000,
-- 0x00004004, 0x42001000, 0x00000008, 0x59a81862,
-- 0x0401f0b8, 0x42006000, 0x00102d9d, 0x50301000,
-- 0x41784800, 0x4a03902d, 0x00002000, 0x4200b000,
-- 0x000001f4, 0x59c8002c, 0x8c000530, 0x04000007,
-+ 0x00000008, 0x59a8185f, 0x0401f0b8, 0x42006000,
-+ 0x00102bc3, 0x50301000, 0x41784800, 0x4a03902d,
-+ 0x00002000, 0x4200b000, 0x000001f4, 0x59c8002c,
-+ 0x8c000530, 0x04000007, 0x8058b040, 0x040207fc,
-+ 0x42000000, 0x00004003, 0x41781000, 0x0401f0a7,
-+ 0x59c8002c, 0x82000500, 0xffe0ffff, 0x82080d00,
-+ 0x001f0000, 0x80040540, 0x4803902c, 0x0401f826,
-+ 0x80244800, 0x82240580, 0x00000110, 0x040207fc,
-+ 0x0401f8a2, 0x41784800, 0x0401f84c, 0x59c80034,
-+ 0x82080d00, 0x001f0000, 0x82000500, 0x001f0000,
-+ 0x80040580, 0x04000006, 0x59a80060, 0x80000000,
-+ 0x48035060, 0x40240000, 0x4803505f, 0x80244800,
-+ 0x82240580, 0x00000110, 0x040207f0, 0x80306000,
-+ 0x82300580, 0x00102bc5, 0x040207cf, 0x59a80860,
-+ 0x800409c0, 0x04000006, 0x42000000, 0x00004004,
-+ 0x42001000, 0x00000020, 0x59a8185f, 0x0201f000,
-+ 0x00101e8d, 0x59c8002c, 0x82000500, 0xffff0000,
-+ 0x82080d00, 0x0000ffff, 0x80040540, 0x4803902c,
-+ 0x480b9028, 0x480b9029, 0x59a80061, 0x82000580,
-+ 0x00000004, 0x04000003, 0x480b902a, 0x480b902b,
-+ 0x59c8002d, 0x82000500, 0xfffffc00, 0x80240540,
-+ 0x4803902d, 0x4200b000, 0x000001f4, 0x59c8002c,
-+ 0x82000500, 0x18000000, 0x04000007, 0x8058b040,
-+ 0x040207fb, 0x42000000, 0x00004003, 0x41781000,
-+ 0x0401f05a, 0x4a03902e, 0x00000001, 0x4200b000,
-+ 0x000001f4, 0x59c8002e, 0x8c000500, 0x04000006,
- 0x8058b040, 0x040207fc, 0x42000000, 0x00004003,
-- 0x41781000, 0x0401f0a7, 0x59c8002c, 0x82000500,
-- 0xffe0ffff, 0x82080d00, 0x001f0000, 0x80040540,
-- 0x4803902c, 0x0401f826, 0x80244800, 0x82240580,
-- 0x00000110, 0x040207fc, 0x0401f8a2, 0x41784800,
-- 0x0401f84c, 0x59c80034, 0x82080d00, 0x001f0000,
-- 0x82000500, 0x001f0000, 0x80040580, 0x04000006,
-- 0x59a80063, 0x80000000, 0x48035063, 0x40240000,
-- 0x48035062, 0x80244800, 0x82240580, 0x00000110,
-- 0x040207f0, 0x80306000, 0x82300580, 0x00102d9f,
-- 0x040207cf, 0x59a80863, 0x800409c0, 0x04000006,
-- 0x42000000, 0x00004004, 0x42001000, 0x00000020,
-- 0x59a81862, 0x0201f000, 0x00102066, 0x59c8002c,
-- 0x82000500, 0xffff0000, 0x82080d00, 0x0000ffff,
-- 0x80040540, 0x4803902c, 0x480b9028, 0x480b9029,
-- 0x59a80064, 0x82000580, 0x00000004, 0x04000003,
-- 0x480b902a, 0x480b902b, 0x59c8002d, 0x82000500,
-- 0xfffffc00, 0x80240540, 0x4803902d, 0x4200b000,
-- 0x000001f4, 0x59c8002c, 0x82000500, 0x18000000,
-- 0x04000007, 0x8058b040, 0x040207fb, 0x42000000,
-- 0x00004003, 0x41781000, 0x0401f05a, 0x4a03902e,
-- 0x00000001, 0x4200b000, 0x000001f4, 0x59c8002e,
-- 0x8c000500, 0x04000006, 0x8058b040, 0x040207fc,
-- 0x42000000, 0x00004003, 0x0401f04e, 0x1c01f000,
-- 0x41783800, 0x59c8002d, 0x82000500, 0xfffffc00,
-- 0x80240d40, 0x4807902d, 0x4200b000, 0x000001f4,
-- 0x59c8002c, 0x82000500, 0x18000000, 0x04000007,
-- 0x8058b040, 0x040207fb, 0x42000000, 0x00004003,
-- 0x41781000, 0x0401f03b, 0x59c81830, 0x59c80030,
-- 0x800c0d80, 0x040207fd, 0x80080d80, 0x04000002,
-- 0x801c3800, 0x59c82031, 0x59c80031, 0x80100d80,
-+ 0x0401f04e, 0x1c01f000, 0x41783800, 0x59c8002d,
-+ 0x82000500, 0xfffffc00, 0x80240d40, 0x4807902d,
-+ 0x4200b000, 0x000001f4, 0x59c8002c, 0x82000500,
-+ 0x18000000, 0x04000007, 0x8058b040, 0x040207fb,
-+ 0x42000000, 0x00004003, 0x41781000, 0x0401f03b,
-+ 0x59c81830, 0x59c80030, 0x800c0d80, 0x040207fd,
-+ 0x80080d80, 0x04000002, 0x801c3800, 0x59c82031,
-+ 0x59c80031, 0x80100d80, 0x040207fd, 0x80080d80,
-+ 0x04000002, 0x801c3800, 0x59a80061, 0x82000580,
-+ 0x00000004, 0x04000019, 0x59c82832, 0x59c80032,
-+ 0x80140d80, 0x040207fd, 0x80080d80, 0x04000002,
-+ 0x801c3800, 0x59c83033, 0x59c80033, 0x80180d80,
- 0x040207fd, 0x80080d80, 0x04000002, 0x801c3800,
-- 0x59a80064, 0x82000580, 0x00000004, 0x04000019,
-- 0x59c82832, 0x59c80032, 0x80140d80, 0x040207fd,
-- 0x80080d80, 0x04000002, 0x801c3800, 0x59c83033,
-- 0x59c80033, 0x80180d80, 0x040207fd, 0x80080d80,
-- 0x04000002, 0x801c3800, 0x59c80034, 0x59c80834,
-- 0x80040d80, 0x040207fd, 0x80080d80, 0x82040d00,
-- 0x0000ffff, 0x0400000c, 0x801c3800, 0x0401f00a,
- 0x59c80034, 0x59c80834, 0x80040d80, 0x040207fd,
-- 0x80080d80, 0x82040d00, 0x000000ff, 0x04000002,
-- 0x801c3800, 0x801c39c0, 0x04000005, 0x59a80063,
-- 0x801c0400, 0x48035063, 0x48275062, 0x1c01f000,
-- 0x48034206, 0x48074406, 0x480b4207, 0x480f4407,
-- 0x48134208, 0x48174408, 0x0201f000, 0x00102069,
-- 0x42000000, 0x00600000, 0x80000040, 0x040207ff,
-- 0x1c01f000, 0x5a5a5a5a, 0xa5a5a5a5, 0x59a00c0a,
-- 0x800409c0, 0x02000000, 0x001020b6, 0x82040480,
-- 0x00000021, 0x02021000, 0x001020b6, 0x82040480,
-- 0x00000011, 0x04001003, 0x42000800, 0x00000010,
-- 0x59a00208, 0x59a01407, 0x900811c0, 0x80081540,
-- 0x59a00207, 0x59a01c06, 0x900c19c0, 0x800c1d40,
-- 0x0201f800, 0x0010381a, 0x04000006, 0x0201f800,
-- 0x0010383e, 0x4a01d809, 0x00102dc0, 0x1c01f000,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-- 0x4031d800, 0x58ef400b, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x59a00c0a,
-- 0x82040480, 0x00000011, 0x04001003, 0x42000800,
-+ 0x80080d80, 0x82040d00, 0x0000ffff, 0x0400000c,
-+ 0x801c3800, 0x0401f00a, 0x59c80034, 0x59c80834,
-+ 0x80040d80, 0x040207fd, 0x80080d80, 0x82040d00,
-+ 0x000000ff, 0x04000002, 0x801c3800, 0x801c39c0,
-+ 0x04000005, 0x59a80060, 0x801c0400, 0x48035060,
-+ 0x4827505f, 0x1c01f000, 0x48034206, 0x48074406,
-+ 0x480b4207, 0x480f4407, 0x48134208, 0x48174408,
-+ 0x0201f000, 0x00101e90, 0x42000000, 0x00600000,
-+ 0x80000040, 0x040207ff, 0x1c01f000, 0x5a5a5a5a,
-+ 0xa5a5a5a5, 0x59a00c0a, 0x800409c0, 0x02000000,
-+ 0x00101edd, 0x82040480, 0x00000021, 0x02021000,
-+ 0x00101edd, 0x82040480, 0x00000011, 0x04001003,
-+ 0x42000800, 0x00000010, 0x59a00208, 0x59a01407,
-+ 0x900811c0, 0x80081540, 0x59a00207, 0x59a01c06,
-+ 0x900c19c0, 0x800c1d40, 0x0201f800, 0x001036b6,
-+ 0x04000006, 0x0201f800, 0x001036da, 0x4a01d809,
-+ 0x00102be6, 0x1c01f000, 0x4a034406, 0x00000002,
-+ 0x0201f000, 0x00101ed9, 0x4031d800, 0x58ef400b,
-+ 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-+ 0x00101ed1, 0x59a00c0a, 0x82040480, 0x00000011,
-+ 0x04001003, 0x42000800, 0x00000010, 0x59a0040b,
-+ 0x59a0120b, 0x900811c0, 0x80081540, 0x59a00209,
-+ 0x59a01c08, 0x900c19c0, 0x800c1d40, 0x58ec0003,
-+ 0x0201f800, 0x001036dd, 0x4a01d809, 0x00102c01,
-+ 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ec0002,
-+ 0x82000580, 0x00000200, 0x02000000, 0x00101ed1,
-+ 0x59a00c0a, 0x82040480, 0x00000011, 0x02001000,
-+ 0x00101e8d, 0x82040c80, 0x00000010, 0x59a00208,
-+ 0x59a01407, 0x900811c0, 0x80081540, 0x59a00207,
-+ 0x59a01c06, 0x900c19c0, 0x800c1d40, 0x82081400,
-+ 0x00000040, 0x58ec0003, 0x0201f800, 0x001036da,
-+ 0x4a01d809, 0x00102c1f, 0x1c01f000, 0x4031d800,
-+ 0x58ef400b, 0x58ec0002, 0x82000580, 0x00000200,
-+ 0x02000000, 0x00101ed1, 0x59a0040a, 0x82000c80,
- 0x00000010, 0x59a0040b, 0x59a0120b, 0x900811c0,
- 0x80081540, 0x59a00209, 0x59a01c08, 0x900c19c0,
-- 0x800c1d40, 0x58ec0003, 0x0201f800, 0x00103841,
-- 0x4a01d809, 0x00102ddb, 0x1c01f000, 0x4031d800,
-- 0x58ef400b, 0x58ec0002, 0x82000580, 0x00000200,
-- 0x02000000, 0x001020aa, 0x59a00c0a, 0x82040480,
-- 0x00000011, 0x02001000, 0x00102066, 0x82040c80,
-- 0x00000010, 0x59a00208, 0x59a01407, 0x900811c0,
-- 0x80081540, 0x59a00207, 0x59a01c06, 0x900c19c0,
- 0x800c1d40, 0x82081400, 0x00000040, 0x58ec0003,
-- 0x0201f800, 0x0010383e, 0x4a01d809, 0x00102df9,
-- 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ec0002,
-- 0x82000580, 0x00000200, 0x02000000, 0x001020aa,
-- 0x59a0040a, 0x82000c80, 0x00000010, 0x59a0040b,
-- 0x59a0120b, 0x900811c0, 0x80081540, 0x59a00209,
-- 0x59a01c08, 0x900c19c0, 0x800c1d40, 0x82081400,
-- 0x00000040, 0x58ec0003, 0x0201f800, 0x00103841,
-- 0x4a01d809, 0x0010205f, 0x1c01f000, 0x48efc857,
-- 0x59a00207, 0x59a01407, 0x900001c0, 0x80081540,
-- 0x59a00209, 0x59a01c09, 0x900001c0, 0x800c1d40,
-- 0x59a00406, 0x48034000, 0x480b4001, 0x480f4002,
-- 0x0201f800, 0x0010381a, 0x04020005, 0x4a034406,
-- 0x00000002, 0x0201f000, 0x001020b2, 0x42000800,
-- 0x00000010, 0x0201f800, 0x0010383e, 0x4a01d809,
-- 0x00102e2e, 0x1c01f000, 0x4031d800, 0x58ef400b,
-- 0x58ee580d, 0x58ec0002, 0x82000580, 0x00000200,
-- 0x02000000, 0x001020aa, 0x48efc857, 0x49a3c857,
-- 0x492fc857, 0x592c0a04, 0x80040910, 0x04020005,
-- 0x4a034406, 0x00000019, 0x0201f000, 0x001020b2,
-- 0x4805d80c, 0x0401f00a, 0x4031d800, 0x58ef400b,
-- 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-- 0x001020aa, 0x48efc857, 0x49a3c857, 0x48efc857,
-- 0x49a3c857, 0x58ec000c, 0x80000040, 0x04000012,
-- 0x4801d80c, 0x0201f800, 0x0010381a, 0x04020005,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-- 0x42000800, 0x00000010, 0x58ec1007, 0x58ec1808,
-- 0x0201f800, 0x0010383e, 0x4a01d809, 0x00102e42,
-- 0x1c01f000, 0x58ee580d, 0x48efc857, 0x49a3c857,
-- 0x492fc857, 0x492f3006, 0x592c0404, 0x8400055e,
-- 0x48025c04, 0x4a01d809, 0x00102e6c, 0x1c01f000,
-- 0x4d2c0000, 0x58ee580d, 0x48efc857, 0x49a3c857,
-- 0x492fc857, 0x592c0404, 0x8400051e, 0x48025c04,
-- 0x59a00000, 0x59a01001, 0x59a01802, 0x80081400,
-- 0x820c1c40, 0x00000000, 0x832c0400, 0x00000004,
-- 0x42000800, 0x00000010, 0x5c025800, 0x0201f000,
-- 0x00103841, 0x800409c0, 0x04000005, 0x4a034406,
-- 0x00000001, 0x0201f000, 0x001020b2, 0x836c0580,
-- 0x00000003, 0x04000005, 0x4a034406, 0x00000007,
-- 0x0201f000, 0x001020b2, 0x59a0320b, 0x82183500,
-- 0x000000ff, 0x59a28c06, 0x0201f800, 0x00020267,
-- 0x02020000, 0x001020b6, 0x83440580, 0x000007fd,
-- 0x04000008, 0x0201f800, 0x00104836, 0x04000005,
-- 0x4a034406, 0x00000009, 0x0201f000, 0x001020b2,
-- 0x0201f800, 0x0010381a, 0x04020005, 0x4a034406,
-- 0x00000002, 0x0201f000, 0x001020b2, 0x801831c0,
-- 0x0400000a, 0x412c0800, 0x0201f800, 0x0010381a,
-+ 0x0201f800, 0x001036dd, 0x4a01d809, 0x00101e86,
-+ 0x1c01f000, 0x48efc857, 0x59a00207, 0x59a01407,
-+ 0x900001c0, 0x80081540, 0x59a00209, 0x59a01c09,
-+ 0x900001c0, 0x800c1d40, 0x59a00406, 0x48034000,
-+ 0x480b4001, 0x480f4002, 0x0201f800, 0x001036b6,
- 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-- 0x001020b2, 0x40065800, 0x4a025c04, 0x00008000,
-- 0x497a5a04, 0x0201f800, 0x00108ebd, 0x04020005,
-- 0x4a034406, 0x00000003, 0x0201f000, 0x001020b2,
-- 0x4a01d809, 0x00102ebf, 0x1c01f000, 0x592c0005,
-- 0x82000580, 0x01000000, 0x04020005, 0x4a034406,
-- 0x00000004, 0x0201f000, 0x001020b2, 0x592c0406,
-- 0x82002d00, 0x0000ff00, 0x82000500, 0x000000ff,
-- 0x80000904, 0x80040800, 0x82040480, 0x00000006,
-- 0x04001003, 0x42000800, 0x00000005, 0x4c500000,
-- 0x4c540000, 0x4c580000, 0x832ca400, 0x00000006,
-- 0x4050a800, 0x4004b000, 0x0201f800, 0x0010a94f,
-- 0x59a00407, 0x59a01207, 0x900811c0, 0x80081540,
-- 0x59a00409, 0x59a01a09, 0x900c19c0, 0x800c1d40,
-- 0x832c0400, 0x00000006, 0x4c140000, 0x0201f800,
-- 0x00103841, 0x5c002800, 0x801429c0, 0x04000003,
-- 0x4a01d809, 0x00102ef2, 0x5c00b000, 0x5c00a800,
-- 0x5c00a000, 0x1c01f000, 0x4031d800, 0x58ef400b,
-- 0x58ee580d, 0x58ec0002, 0x82000580, 0x00000200,
-- 0x02000000, 0x001020aa, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x592c0006, 0x82000500, 0xff000000,
-- 0x80000904, 0x800409c0, 0x02000000, 0x001020aa,
-- 0x82040480, 0x0000000e, 0x04001003, 0x42000800,
-- 0x0000000d, 0x592e5801, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x4c500000, 0x4c540000, 0x4c580000,
-- 0x832ca400, 0x00000005, 0x4050a800, 0x4004b000,
-- 0x0201f800, 0x0010a94f, 0x5c00b000, 0x5c00a800,
-- 0x5c00a000, 0x58ec1007, 0x58ec1808, 0x832c0400,
-- 0x00000005, 0x0201f000, 0x00103841, 0x0201f800,
-- 0x0010381a, 0x04020005, 0x4a034406, 0x00000002,
-- 0x0201f000, 0x001020b2, 0x59a00c06, 0x82040500,
-- 0x0000ff00, 0x840001c0, 0x82001480, 0x00000007,
-- 0x02021000, 0x001020b6, 0x0c01f001, 0x00102f36,
-- 0x00102f3d, 0x00102f44, 0x00102f44, 0x00102f44,
-- 0x00102f46, 0x00102f4b, 0x42000800, 0x0000000d,
-- 0x42003800, 0x00102f5f, 0x4a034000, 0x0010b2e7,
-- 0x0401f013, 0x42000800, 0x0000000d, 0x42003800,
-- 0x00102f5f, 0x4a034000, 0x0010b2f4, 0x0401f00c,
-- 0x0201f000, 0x001020b6, 0x42000800, 0x00000008,
-- 0x42003800, 0x00102f72, 0x0401f005, 0x42000800,
-- 0x00000004, 0x42003800, 0x00102fbc, 0x59a00207,
-- 0x59a01407, 0x900001c0, 0x80081540, 0x59a00209,
-- 0x59a01c09, 0x900001c0, 0x800c1d40, 0x832c0400,
-- 0x00000005, 0x4c1c0000, 0x0201f800, 0x0010383e,
-- 0x5c003800, 0x481dd809, 0x1c01f000, 0x4031d800,
-- 0x58ef400b, 0x58ee580d, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x4a03501f,
-- 0x00000001, 0x4200b000, 0x0000000d, 0x59a0a800,
-- 0x832ca400, 0x00000005, 0x0201f800, 0x0010a93e,
-- 0x0201f000, 0x00102066, 0x4031d800, 0x58ef400b,
-- 0x58ee580d, 0x58ec0002, 0x82000580, 0x00000200,
-- 0x02000000, 0x001020aa, 0x832ca400, 0x00000005,
-- 0x50500000, 0x82001500, 0x000c0016, 0x02020000,
-- 0x001020b6, 0x82500c00, 0x00000003, 0x50040000,
-- 0x82001500, 0x00000001, 0x02020000, 0x001020b6,
-- 0x50500000, 0x82001500, 0x00000028, 0x0400001d,
-- 0x82081580, 0x00000028, 0x02020000, 0x001020b6,
-- 0x80500800, 0x50040000, 0x82001500, 0x00000013,
-- 0x82081580, 0x00000013, 0x02020000, 0x001020b6,
-- 0x80040800, 0x50040000, 0x82001500, 0x00010000,
-- 0x82081580, 0x00010000, 0x02020000, 0x001020b6,
-- 0x836c0580, 0x00000000, 0x04000012, 0x599c0019,
-- 0x8c00050e, 0x0402000f, 0x0201f000, 0x001020b6,
-- 0x80500800, 0x50040000, 0x82001500, 0x00000013,
-- 0x02020000, 0x001020b6, 0x80040800, 0x50040000,
-- 0x82001500, 0x00010000, 0x02020000, 0x001020b6,
-- 0x4200b000, 0x00000008, 0x4200a800, 0x0010b2df,
-- 0x0201f800, 0x0010a93e, 0x0201f000, 0x00102066,
-+ 0x00101ed9, 0x42000800, 0x00000010, 0x0201f800,
-+ 0x001036da, 0x4a01d809, 0x00102c54, 0x1c01f000,
-+ 0x4031d800, 0x58ef400b, 0x58ee580d, 0x58ec0002,
-+ 0x82000580, 0x00000200, 0x02000000, 0x00101ed1,
-+ 0x48efc857, 0x49a3c857, 0x492fc857, 0x592c0a04,
-+ 0x80040910, 0x04020005, 0x4a034406, 0x00000019,
-+ 0x0201f000, 0x00101ed9, 0x4805d80c, 0x0401f00a,
-+ 0x4031d800, 0x58ef400b, 0x58ec0002, 0x82000580,
-+ 0x00000200, 0x02000000, 0x00101ed1, 0x48efc857,
-+ 0x49a3c857, 0x48efc857, 0x49a3c857, 0x58ec000c,
-+ 0x80000040, 0x04000012, 0x4801d80c, 0x0201f800,
-+ 0x001036b6, 0x04020005, 0x4a034406, 0x00000002,
-+ 0x0201f000, 0x00101ed9, 0x42000800, 0x00000010,
-+ 0x58ec1007, 0x58ec1808, 0x0201f800, 0x001036da,
-+ 0x4a01d809, 0x00102c68, 0x1c01f000, 0x58ee580d,
-+ 0x48efc857, 0x49a3c857, 0x492fc857, 0x492f3004,
-+ 0x592c0404, 0x8400055e, 0x48025c04, 0x4a01d809,
-+ 0x00102c92, 0x1c01f000, 0x4d2c0000, 0x58ee580d,
-+ 0x48efc857, 0x49a3c857, 0x492fc857, 0x592c0404,
-+ 0x8400051e, 0x48025c04, 0x59a00000, 0x59a01001,
-+ 0x59a01802, 0x80081400, 0x820c1c40, 0x00000000,
-+ 0x832c0400, 0x00000004, 0x42000800, 0x00000010,
-+ 0x5c025800, 0x0201f000, 0x001036dd, 0x8d0e1d0e,
-+ 0x04000005, 0x4a034406, 0x00000001, 0x0201f000,
-+ 0x00101ed9, 0x836c0580, 0x00000003, 0x04000005,
-+ 0x4a034406, 0x00000007, 0x0201f000, 0x00101ed9,
-+ 0x59a0320b, 0x82183500, 0x000000ff, 0x59a28c06,
-+ 0x0201f800, 0x0002025a, 0x02020000, 0x00101edd,
-+ 0x83440580, 0x000007fd, 0x04000008, 0x0201f800,
-+ 0x00104719, 0x04000005, 0x4a034406, 0x00000009,
-+ 0x0201f000, 0x00101ed9, 0x0201f800, 0x001036b6,
-+ 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-+ 0x00101ed9, 0x801831c0, 0x0400000a, 0x412c0800,
-+ 0x0201f800, 0x001036b6, 0x04020005, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x40065800,
-+ 0x4a025c04, 0x00008000, 0x497a5a04, 0x0201f800,
-+ 0x00108914, 0x04020005, 0x4a034406, 0x00000003,
-+ 0x0201f000, 0x00101ed9, 0x4a01d809, 0x00102ce5,
-+ 0x1c01f000, 0x592c0005, 0x82000580, 0x01000000,
-+ 0x04020005, 0x4a034406, 0x00000004, 0x0201f000,
-+ 0x00101ed9, 0x592c0406, 0x82002d00, 0x0000ff00,
-+ 0x82000500, 0x000000ff, 0x80000904, 0x80040800,
-+ 0x82040480, 0x00000006, 0x04001003, 0x42000800,
-+ 0x00000005, 0x4c500000, 0x4c540000, 0x4c580000,
-+ 0x832ca400, 0x00000006, 0x4050a800, 0x4004b000,
-+ 0x0201f800, 0x0010a341, 0x59a00407, 0x59a01207,
-+ 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
-+ 0x900c19c0, 0x800c1d40, 0x832c0400, 0x00000006,
-+ 0x4c140000, 0x0201f800, 0x001036dd, 0x5c002800,
-+ 0x801429c0, 0x04000003, 0x4a01d809, 0x00102d18,
-+ 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x1c01f000,
-+ 0x4031d800, 0x58ef400b, 0x58ee580d, 0x58ec0002,
-+ 0x82000580, 0x00000200, 0x02000000, 0x00101ed1,
-+ 0x812e59c0, 0x02000800, 0x001004ef, 0x592c0006,
-+ 0x82000500, 0xff000000, 0x80000904, 0x800409c0,
-+ 0x02000000, 0x00101ed1, 0x82040480, 0x0000000e,
-+ 0x04001003, 0x42000800, 0x0000000d, 0x592e5801,
-+ 0x812e59c0, 0x02000800, 0x001004ef, 0x4c500000,
-+ 0x4c540000, 0x4c580000, 0x832ca400, 0x00000005,
-+ 0x4050a800, 0x4004b000, 0x0201f800, 0x0010a341,
-+ 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x58ec1007,
-+ 0x58ec1808, 0x832c0400, 0x00000005, 0x0201f000,
-+ 0x001036dd, 0x0201f800, 0x001036b6, 0x04020005,
-+ 0x4a034406, 0x00000002, 0x0201f000, 0x00101ed9,
-+ 0x59a00c06, 0x82040500, 0x0000ff00, 0x840001c0,
-+ 0x82001480, 0x00000007, 0x02021000, 0x00101edd,
-+ 0x0c01f001, 0x00102d5c, 0x00102d63, 0x00102d6a,
-+ 0x00102d6a, 0x00102d6a, 0x00102d6c, 0x00102d71,
-+ 0x42000800, 0x0000000d, 0x42003800, 0x00102d85,
-+ 0x4a034000, 0x0010acb8, 0x0401f013, 0x42000800,
-+ 0x0000000d, 0x42003800, 0x00102d85, 0x4a034000,
-+ 0x0010acc5, 0x0401f00c, 0x0201f000, 0x00101edd,
-+ 0x42000800, 0x00000008, 0x42003800, 0x00102d98,
-+ 0x0401f005, 0x42000800, 0x00000004, 0x42003800,
-+ 0x00102de2, 0x59a00207, 0x59a01407, 0x900001c0,
-+ 0x80081540, 0x59a00209, 0x59a01c09, 0x900001c0,
-+ 0x800c1d40, 0x832c0400, 0x00000005, 0x4c1c0000,
-+ 0x0201f800, 0x001036da, 0x5c003800, 0x481dd809,
-+ 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ee580d,
-+ 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-+ 0x00101ed1, 0x4a03501e, 0x00000001, 0x4200b000,
-+ 0x0000000d, 0x59a0a800, 0x832ca400, 0x00000005,
-+ 0x0201f800, 0x0010a330, 0x0201f000, 0x00101e8d,
- 0x4031d800, 0x58ef400b, 0x58ee580d, 0x58ec0002,
-- 0x82000580, 0x00000200, 0x02000000, 0x001020aa,
-- 0x4200b000, 0x00000004, 0x4200a800, 0x0010b6f9,
-- 0x832ca400, 0x00000005, 0x0201f800, 0x0010a93e,
-- 0x59a80005, 0x84000550, 0x48035005, 0x0201f000,
-- 0x00102066, 0x0201f800, 0x0010381a, 0x04020005,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-+ 0x82000580, 0x00000200, 0x02000000, 0x00101ed1,
-+ 0x832ca400, 0x00000005, 0x50500000, 0x82001500,
-+ 0x000c0016, 0x02020000, 0x00101edd, 0x82500c00,
-+ 0x00000003, 0x50040000, 0x82001500, 0x00000001,
-+ 0x02020000, 0x00101edd, 0x50500000, 0x82001500,
-+ 0x00000028, 0x0400001d, 0x82081580, 0x00000028,
-+ 0x02020000, 0x00101edd, 0x80500800, 0x50040000,
-+ 0x82001500, 0x00000013, 0x82081580, 0x00000013,
-+ 0x02020000, 0x00101edd, 0x80040800, 0x50040000,
-+ 0x82001500, 0x00010000, 0x82081580, 0x00010000,
-+ 0x02020000, 0x00101edd, 0x836c0580, 0x00000000,
-+ 0x04000012, 0x599c0019, 0x8c00050e, 0x0402000f,
-+ 0x0201f000, 0x00101edd, 0x80500800, 0x50040000,
-+ 0x82001500, 0x00000013, 0x02020000, 0x00101edd,
-+ 0x80040800, 0x50040000, 0x82001500, 0x00010000,
-+ 0x02020000, 0x00101edd, 0x4200b000, 0x00000008,
-+ 0x4200a800, 0x0010acb0, 0x0201f800, 0x0010a330,
-+ 0x0201f000, 0x00101e8d, 0x4031d800, 0x58ef400b,
-+ 0x58ee580d, 0x58ec0002, 0x82000580, 0x00000200,
-+ 0x02000000, 0x00101ed1, 0x4200b000, 0x00000004,
-+ 0x4200a800, 0x0010b0c9, 0x832ca400, 0x00000005,
-+ 0x0201f800, 0x0010a330, 0x850e1d50, 0x0201f000,
-+ 0x00101e8d, 0x0201f800, 0x001036b6, 0x04020005,
-+ 0x4a034406, 0x00000002, 0x0201f000, 0x00101ed9,
- 0x59a00c06, 0x82040500, 0x0000ff00, 0x840001c0,
-- 0x82001480, 0x00000006, 0x02021000, 0x001020b6,
-- 0x0c01f001, 0x00102fe7, 0x00102fec, 0x00102ff1,
-- 0x00102ff1, 0x00102ff1, 0x00102ff3, 0x42000800,
-- 0x0000000d, 0x4200a000, 0x0010b2e7, 0x0401f00c,
-- 0x42000800, 0x0000000d, 0x4200a000, 0x0010b2f4,
-- 0x0401f007, 0x0201f000, 0x001020b6, 0x42000800,
-- 0x00000008, 0x4200a000, 0x0010b2df, 0x4004b000,
-- 0x832cac00, 0x00000005, 0x0201f800, 0x0010a93e,
-+ 0x82001480, 0x00000006, 0x02021000, 0x00101edd,
-+ 0x0c01f001, 0x00102e0b, 0x00102e10, 0x00102e15,
-+ 0x00102e15, 0x00102e15, 0x00102e17, 0x42000800,
-+ 0x0000000d, 0x4200a000, 0x0010acb8, 0x0401f00c,
-+ 0x42000800, 0x0000000d, 0x4200a000, 0x0010acc5,
-+ 0x0401f007, 0x0201f000, 0x00101edd, 0x42000800,
-+ 0x00000008, 0x4200a000, 0x0010acb0, 0x4004b000,
-+ 0x832cac00, 0x00000005, 0x0201f800, 0x0010a330,
- 0x59a00207, 0x59a01407, 0x900001c0, 0x80081540,
- 0x59a00209, 0x59a01c09, 0x900001c0, 0x800c1d40,
-- 0x832c0400, 0x00000005, 0x0201f000, 0x00103841,
-+ 0x832c0400, 0x00000005, 0x0201f000, 0x001036dd,
- 0x836c0580, 0x00000000, 0x04020005, 0x4a034406,
-- 0x00000007, 0x0201f000, 0x001020b2, 0x59a01406,
-+ 0x00000007, 0x0201f000, 0x00101ed9, 0x59a01406,
- 0x800811c0, 0x04020017, 0x59c40801, 0x82040d00,
- 0x00018000, 0x82040580, 0x00000000, 0x04020004,
-- 0x4a034406, 0x00000000, 0x0401f048, 0x82040580,
-+ 0x4a034406, 0x00000000, 0x0401f044, 0x82040580,
- 0x00008000, 0x04020004, 0x4a034406, 0x00000001,
-- 0x0401f042, 0x82040580, 0x00010000, 0x02020800,
-- 0x00100615, 0x4a034406, 0x00000003, 0x0401f03b,
-- 0x59a8006f, 0x8c000508, 0x04000005, 0x42000000,
-+ 0x0401f03e, 0x82040580, 0x00010000, 0x02020800,
-+ 0x001004ef, 0x4a034406, 0x00000003, 0x0401f037,
-+ 0x59a8006c, 0x8c000508, 0x04000005, 0x42000000,
- 0x00000001, 0x40000800, 0x0401f003, 0x59a00207,
-- 0x59a80853, 0x48035053, 0x0201f800, 0x001016ac,
-- 0x0400000d, 0x0201f800, 0x001016b3, 0x0400000a,
-- 0x0201f800, 0x001016ba, 0x04000007, 0x0201f800,
-- 0x001016c1, 0x04000004, 0x48075053, 0x0201f000,
-- 0x001020b6, 0x82080580, 0x00000002, 0x0402001f,
-+ 0x59a80850, 0x48035050, 0x0201f800, 0x00101582,
-+ 0x0400000d, 0x0201f800, 0x00101592, 0x0400000a,
-+ 0x0201f800, 0x001015a2, 0x04000007, 0x0201f800,
-+ 0x001015b2, 0x04000004, 0x48075050, 0x0201f000,
-+ 0x00101edd, 0x82080580, 0x00000002, 0x0402001b,
- 0x59c40006, 0x84000500, 0x48038806, 0x0201f800,
-- 0x00106c32, 0x497b8880, 0x0201f800, 0x0010a7e7,
-- 0x0201f800, 0x0010a7f5, 0x42000000, 0x0010b6c9,
-- 0x0201f800, 0x0010a86e, 0x82000540, 0x00000001,
-- 0x0201f800, 0x00104e5d, 0x4a038808, 0x00000000,
-- 0x4202d800, 0x00000004, 0x42001000, 0x00000001,
-- 0x0201f800, 0x001019aa, 0x4a035049, 0x00000001,
-- 0x0201f800, 0x0010071a, 0x0201f000, 0x00102066,
-- 0x800409c0, 0x04000005, 0x4a034406, 0x00000001,
-- 0x0201f000, 0x001020b2, 0x836c0580, 0x00000003,
-+ 0x00106725, 0x497b8880, 0x0201f800, 0x0010a1d8,
-+ 0x0201f800, 0x0010a1e6, 0x42000000, 0x0010b099,
-+ 0x0201f800, 0x0010a260, 0x4803c856, 0x850e1d48,
-+ 0x4a038808, 0x00000000, 0x4202d800, 0x00000004,
-+ 0x4a038805, 0x00000001, 0x4a035046, 0x00000001,
-+ 0x0201f800, 0x001005fc, 0x0201f000, 0x00101e8d,
-+ 0x8d0e1d0e, 0x04000005, 0x4a034406, 0x00000001,
-+ 0x0201f000, 0x00101ed9, 0x836c0580, 0x00000003,
- 0x04000005, 0x4a034406, 0x00000007, 0x0201f000,
-- 0x001020b2, 0x59a28c06, 0x59a0320b, 0x82183500,
-- 0x000000ff, 0x0201f800, 0x00020267, 0x02020000,
-- 0x001020b6, 0x83440580, 0x000007fd, 0x04000008,
-- 0x0201f800, 0x00104836, 0x04000005, 0x42000800,
-- 0x00000009, 0x0201f000, 0x001020b2, 0x0201f800,
-- 0x0010381a, 0x04020005, 0x4a034406, 0x00000002,
-- 0x0201f000, 0x001020b2, 0x497a5a04, 0x4a025c04,
-- 0x00008000, 0x0201f800, 0x00108ed2, 0x04020005,
-- 0x4a034406, 0x00000003, 0x0201f000, 0x001020b2,
-- 0x4a01d809, 0x00103097, 0x1c01f000, 0x592c0005,
-+ 0x00101ed9, 0x59a28c06, 0x59a0320b, 0x82183500,
-+ 0x000000ff, 0x0201f800, 0x0002025a, 0x02020000,
-+ 0x00101edd, 0x83440580, 0x000007fd, 0x04000008,
-+ 0x0201f800, 0x00104719, 0x04000005, 0x42000800,
-+ 0x00000009, 0x0201f000, 0x00101ed9, 0x0201f800,
-+ 0x001036b6, 0x04020005, 0x4a034406, 0x00000002,
-+ 0x0201f000, 0x00101ed9, 0x497a5a04, 0x4a025c04,
-+ 0x00008000, 0x0201f800, 0x00108929, 0x04020005,
-+ 0x4a034406, 0x00000003, 0x0201f000, 0x00101ed9,
-+ 0x4a01d809, 0x00102eb7, 0x1c01f000, 0x592c0005,
- 0x82000d00, 0x0000ffff, 0x82000500, 0xffff0000,
- 0x82000580, 0x01000000, 0x04020005, 0x4a034406,
-- 0x00000004, 0x0201f000, 0x001020b2, 0x80040904,
-+ 0x00000004, 0x0201f000, 0x00101ed9, 0x80040904,
- 0x4c500000, 0x4c540000, 0x4c580000, 0x832ca400,
- 0x00000005, 0x4050a800, 0x4004b000, 0x0201f800,
-- 0x0010a94f, 0x5c00b000, 0x5c00a800, 0x5c00a000,
-+ 0x0010a341, 0x5c00b000, 0x5c00a800, 0x5c00a000,
- 0x59a00207, 0x59a01407, 0x900001c0, 0x80081540,
- 0x59a00209, 0x59a01c09, 0x900001c0, 0x800c1d40,
-- 0x832c0400, 0x00000005, 0x0201f000, 0x00103841,
-+ 0x832c0400, 0x00000005, 0x0201f000, 0x001036dd,
- 0x496fc857, 0x836c0580, 0x00000000, 0x04000005,
-- 0x4a034406, 0x0000001a, 0x0201f000, 0x001020b2,
-- 0x0201f800, 0x00104e0d, 0x02020800, 0x00103f5c,
-+ 0x4a034406, 0x0000001a, 0x0201f000, 0x00101ed9,
-+ 0x0201f800, 0x00104ca6, 0x02020800, 0x00103dec,
- 0x42000800, 0x00000020, 0x59a00407, 0x59a01207,
- 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
- 0x900c19c0, 0x800c1d40, 0x419c0000, 0x49a3c857,
-- 0x0201f800, 0x0010383e, 0x4a01d809, 0x001030d9,
-+ 0x0201f800, 0x001036da, 0x4a01d809, 0x00102ef9,
- 0x1c01f000, 0x4833c857, 0x4031d800, 0x58ef400b,
- 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-- 0x001020aa, 0x599c0200, 0x800001c0, 0x02000000,
-- 0x001020b6, 0x59a8006f, 0x8c000504, 0x04020003,
-+ 0x00101ed1, 0x599c0200, 0x800001c0, 0x02000000,
-+ 0x00101edd, 0x59a8006c, 0x8c000504, 0x04020003,
- 0x8c000506, 0x04000004, 0x599c0019, 0x8400050c,
-- 0x48033819, 0x0201f800, 0x001095a3, 0x59a8006f,
-+ 0x48033819, 0x0201f800, 0x0010902b, 0x59a8006c,
- 0x8c000502, 0x04000004, 0x599c0017, 0x84000508,
-- 0x48033817, 0x0201f800, 0x0010393e, 0x04020004,
-- 0x8c00050a, 0x02020000, 0x001020b6, 0x4803c857,
-- 0x8c000504, 0x04020004, 0x59c408a3, 0x84040d7a,
-- 0x480788a3, 0x8c000502, 0x04020004, 0x59c408a3,
-- 0x84040d08, 0x480788a3, 0x599c0c02, 0x8c000500,
-- 0x04020004, 0x8c000516, 0x04000012, 0x0401f001,
-- 0x82041480, 0x0000007f, 0x02021000, 0x001020b6,
-- 0x82041400, 0x00101eb5, 0x50081000, 0x82081500,
-- 0x000000ff, 0x8c000500, 0x04020006, 0x480b5010,
-- 0x42000800, 0x00000003, 0x0201f800, 0x001069af,
-- 0x599c0019, 0x8c000506, 0x04000003, 0x4a03b805,
-- 0x90000000, 0x8c00050e, 0x0402000b, 0x59a80806,
-- 0x8c040d14, 0x04000008, 0x42000800, 0x0010b2df,
-- 0x50040800, 0x82040d00, 0x00000028, 0x02020000,
-- 0x001020b6, 0x82000500, 0x00000030, 0x04000003,
-- 0x80000108, 0x0401f003, 0x42000000, 0x00000002,
-- 0x48039040, 0x42000800, 0x00000002, 0x82000400,
-- 0x0010321c, 0x50001000, 0x0201f800, 0x001069af,
-- 0x599c0201, 0x82000c80, 0x00000100, 0x02001000,
-- 0x001020b6, 0x82000c80, 0x00000841, 0x02021000,
-- 0x001020b6, 0x82000500, 0x00000007, 0x02020000,
-- 0x001020b6, 0x599c0401, 0x80000540, 0x02000000,
-- 0x001020b6, 0x599c0409, 0x599c0c07, 0x80040c80,
-- 0x02021000, 0x001020b6, 0x80000040, 0x02000000,
-- 0x001020b6, 0x599c0209, 0x599c0a07, 0x80040c80,
-- 0x02021000, 0x001020b6, 0x80000040, 0x02000000,
-- 0x001020b6, 0x0201f800, 0x0010509d, 0x0201f800,
-- 0x00104b53, 0x599c0201, 0x48035004, 0x0201f800,
-- 0x0010133e, 0x599c020a, 0x800001c0, 0x04000003,
-- 0x4803504d, 0x0401f003, 0x4a03504d, 0x000000c8,
-- 0x0201f800, 0x0010393e, 0x04000004, 0x0201f800,
-- 0x00105e18, 0x417a5000, 0x836c0580, 0x00000000,
-- 0x0402009a, 0x599c0003, 0x599c0804, 0x9c0001c0,
-- 0x9c0409c0, 0x48035002, 0x48075003, 0x599c1017,
-- 0x8c08151c, 0x04000006, 0x599c0005, 0x599c0806,
-- 0x9c0001c0, 0x9c0409c0, 0x0401f003, 0x82000500,
-- 0xf0ffffff, 0x48035000, 0x48075001, 0x42001000,
-- 0x0010b2e7, 0x48001000, 0x48041001, 0x42001000,
-- 0x0010b2f4, 0x48001000, 0x48041001, 0x59a8006f,
-- 0x8c000508, 0x04020017, 0x8c00050a, 0x04020021,
-- 0x599c1019, 0x82081500, 0x0000e000, 0x82080580,
-- 0x00000000, 0x0402000c, 0x4a035053, 0x00000000,
-- 0x42000000, 0x00000001, 0x0201f800, 0x001018fa,
-- 0x42000000, 0x00000001, 0x0201f800, 0x00101892,
-- 0x0401f02b, 0x82080580, 0x00002000, 0x0402000a,
-- 0x4a035053, 0x00000001, 0x41780000, 0x0201f800,
-- 0x001018fa, 0x41780000, 0x0201f800, 0x00101892,
-- 0x0401f01f, 0x82080580, 0x00004000, 0x04020006,
-- 0x4a035053, 0x00000002, 0x4a035049, 0x00000001,
-- 0x0401f017, 0x82080580, 0x00006000, 0x02020000,
-- 0x001020b6, 0x59a80858, 0x82040d80, 0x01391077,
-- 0x04020005, 0x59e00813, 0x8c040d00, 0x02020000,
-- 0x001020b6, 0x4a035053, 0x00000003, 0x42000000,
-- 0x00000002, 0x0201f800, 0x001018fa, 0x42000000,
-- 0x00000002, 0x0201f800, 0x00101892, 0x599c0019,
-- 0x8c000520, 0x0400000d, 0x42000000, 0x00000004,
-- 0x42000800, 0x00000040, 0x0201f800, 0x001019b1,
-- 0x42000000, 0x00000010, 0x42000800, 0x000000c0,
-- 0x0201f800, 0x001019b1, 0x4a035032, 0x0000aaaa,
-- 0x599c1018, 0x82081500, 0x00000030, 0x59a8006c,
-- 0x80000540, 0x0400000c, 0x82080580, 0x00000000,
-- 0x02000000, 0x001020b6, 0x599c1018, 0x82081500,
-- 0xffffffcf, 0x82081540, 0x00000010, 0x480b3818,
-- 0x0401f010, 0x82080d80, 0x00000000, 0x04000007,
-- 0x82080d80, 0x00000010, 0x0400000a, 0x82080d80,
-- 0x00000020, 0x04020002, 0x48075032, 0x0201f800,
-- 0x001038d3, 0x04000008, 0x0201f800, 0x00101668,
-- 0x0201f800, 0x00101694, 0x59a8002a, 0x80040540,
-- 0x4803502a, 0x49f3c857, 0x42001000, 0x00104d39,
-- 0x0201f800, 0x00105cc9, 0x42001000, 0x00104d2c,
-- 0x0201f800, 0x00105dbd, 0x4a038805, 0xffffffff,
-- 0x4a03c014, 0x00400040, 0x4a03c013, 0x00400000,
-- 0x0201f800, 0x00104717, 0x59a0001d, 0x84000540,
-- 0x4803401d, 0x49f3c857, 0x0201f000, 0x00102066,
-- 0x00000018, 0x0000000c, 0x00000018, 0x00000020,
-- 0x836c0580, 0x00000000, 0x04020005, 0x42000800,
-- 0x00000007, 0x0201f000, 0x001020b2, 0x42000800,
-+ 0x48033817, 0x850e1d20, 0x599c0017, 0x8c000508,
-+ 0x04000003, 0x850e1d60, 0x0401f004, 0x8c00050a,
-+ 0x02020000, 0x00101edd, 0x4803c857, 0x8c000504,
-+ 0x04020004, 0x59c408a3, 0x84040d7a, 0x480788a3,
-+ 0x8c000502, 0x04020004, 0x59c408a3, 0x84040d08,
-+ 0x480788a3, 0x599c0c02, 0x8c000500, 0x04020004,
-+ 0x8c000516, 0x04000012, 0x0401f001, 0x82041480,
-+ 0x0000007f, 0x02021000, 0x00101edd, 0x82041400,
-+ 0x00101cdd, 0x50081000, 0x82081500, 0x000000ff,
-+ 0x8c000500, 0x04020006, 0x480b500f, 0x42000800,
-+ 0x00000003, 0x0201f800, 0x00106499, 0x599c0019,
-+ 0x8c000506, 0x04000003, 0x4a03b805, 0x90000000,
-+ 0x8c00050e, 0x0402000b, 0x59a80805, 0x8c040d14,
-+ 0x04000008, 0x42000800, 0x0010acb0, 0x50040800,
-+ 0x82040d00, 0x00000028, 0x02020000, 0x00101edd,
-+ 0x82000500, 0x00000030, 0x04000003, 0x80000108,
-+ 0x0401f003, 0x42000000, 0x00000002, 0x48039040,
-+ 0x42000800, 0x00000002, 0x82000400, 0x0010303e,
-+ 0x50001000, 0x0201f800, 0x00106499, 0x599c0201,
-+ 0x82000c80, 0x00000100, 0x02001000, 0x00101edd,
-+ 0x82000c80, 0x00000841, 0x02021000, 0x00101edd,
-+ 0x82000500, 0x00000007, 0x02020000, 0x00101edd,
-+ 0x599c0401, 0x80000540, 0x02000000, 0x00101edd,
-+ 0x599c0409, 0x599c0c07, 0x80040c80, 0x02021000,
-+ 0x00101edd, 0x80000040, 0x02000000, 0x00101edd,
-+ 0x599c0209, 0x599c0a07, 0x80040c80, 0x02021000,
-+ 0x00101edd, 0x80000040, 0x02000000, 0x00101edd,
-+ 0x0201f800, 0x00104f4b, 0x0201f800, 0x00104a4f,
-+ 0x599c0201, 0x48035004, 0x0201f800, 0x0010120d,
-+ 0x599c020a, 0x800001c0, 0x04000003, 0x4803504a,
-+ 0x0401f003, 0x4a03504a, 0x000000c8, 0x8d0e1d20,
-+ 0x04000004, 0x0201f800, 0x00105cc6, 0x417a5000,
-+ 0x836c0580, 0x00000000, 0x0402009a, 0x599c0003,
-+ 0x599c0804, 0x9c0001c0, 0x9c0409c0, 0x48035002,
-+ 0x48075003, 0x599c1017, 0x8c08151c, 0x04000006,
-+ 0x599c0005, 0x599c0806, 0x9c0001c0, 0x9c0409c0,
-+ 0x0401f003, 0x82000500, 0xf0ffffff, 0x48035000,
-+ 0x48075001, 0x42001000, 0x0010acb8, 0x48001000,
-+ 0x48041001, 0x42001000, 0x0010acc5, 0x48001000,
-+ 0x48041001, 0x59a8006c, 0x8c000508, 0x04020017,
-+ 0x8c00050a, 0x04020021, 0x599c1019, 0x82081500,
-+ 0x0000e000, 0x82080580, 0x00000000, 0x0402000c,
-+ 0x4a035050, 0x00000000, 0x42000000, 0x00000001,
-+ 0x0201f800, 0x001017f8, 0x42000000, 0x00000001,
-+ 0x0201f800, 0x0010178b, 0x0401f02b, 0x82080580,
-+ 0x00002000, 0x0402000a, 0x4a035050, 0x00000001,
-+ 0x41780000, 0x0201f800, 0x001017f8, 0x41780000,
-+ 0x0201f800, 0x0010178b, 0x0401f01f, 0x82080580,
-+ 0x00004000, 0x04020006, 0x4a035050, 0x00000002,
-+ 0x4a035046, 0x00000001, 0x0401f017, 0x82080580,
-+ 0x00006000, 0x02020000, 0x00101edd, 0x59a80855,
-+ 0x82040d80, 0x01391077, 0x04020005, 0x59e00813,
-+ 0x8c040d00, 0x02020000, 0x00101edd, 0x4a035050,
-+ 0x00000003, 0x42000000, 0x00000002, 0x0201f800,
-+ 0x001017f8, 0x42000000, 0x00000002, 0x0201f800,
-+ 0x0010178b, 0x599c0019, 0x8c000520, 0x0400000d,
-+ 0x42000000, 0x00000004, 0x42000800, 0x00000040,
-+ 0x0201f800, 0x001018a5, 0x42000000, 0x00000010,
-+ 0x42000800, 0x000000c0, 0x0201f800, 0x001018a5,
-+ 0x4a03502f, 0x0000aaaa, 0x599c1018, 0x82081500,
-+ 0x00000030, 0x59a80069, 0x80000540, 0x0400000c,
-+ 0x82080580, 0x00000000, 0x02000000, 0x00101edd,
-+ 0x599c1018, 0x82081500, 0xffffffcf, 0x82081540,
-+ 0x00000010, 0x480b3818, 0x0401f010, 0x82080d80,
-+ 0x00000000, 0x04000007, 0x82080d80, 0x00000010,
-+ 0x0400000a, 0x82080d80, 0x00000020, 0x04020002,
-+ 0x4807502f, 0x0201f800, 0x00103770, 0x04000008,
-+ 0x4803c856, 0x850e1d46, 0x0201f800, 0x00101559,
-+ 0x59a80027, 0x80040540, 0x48035027, 0x49f3c857,
-+ 0x42001000, 0x00104bd9, 0x0201f800, 0x00105b6f,
-+ 0x42001000, 0x00104bc8, 0x0201f800, 0x00105c63,
-+ 0x4a038805, 0xffffffff, 0x4a03c014, 0x00400040,
-+ 0x4a03c013, 0x00400000, 0x0201f800, 0x001045e7,
-+ 0x59a0001d, 0x84000540, 0x4803401d, 0x49f3c857,
-+ 0x0201f000, 0x00101e8d, 0x00000018, 0x0000000c,
-+ 0x00000018, 0x00000020, 0x836c0580, 0x00000000,
-+ 0x04020005, 0x42000800, 0x00000007, 0x0201f000,
-+ 0x00101ed9, 0x42000800, 0x00000020, 0x59a00407,
-+ 0x59a01207, 0x900811c0, 0x80081540, 0x59a00409,
-+ 0x59a01a09, 0x900c19c0, 0x800c1d40, 0x419c0000,
-+ 0x0201f000, 0x001036dd, 0x8d0e1d0e, 0x04000005,
-+ 0x4a034406, 0x00000001, 0x0201f000, 0x00101ed9,
-+ 0x0201f800, 0x00104ca6, 0x04020005, 0x4a034406,
-+ 0x00000016, 0x0201f000, 0x00101ed9, 0x59a80012,
-+ 0x8c000500, 0x04000011, 0x4a034406, 0x00000000,
-+ 0x42000800, 0x00000020, 0x59a00407, 0x59a01207,
-+ 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
-+ 0x900c19c0, 0x800c1d40, 0x42000000, 0x0010b5f0,
-+ 0x0201f000, 0x001036dd, 0x4a034406, 0x00000001,
-+ 0x4200b000, 0x00000020, 0x4200a800, 0x0010b5f0,
-+ 0x4200a000, 0xffffffff, 0x4450a800, 0x8054a800,
-+ 0x8058b040, 0x040207fd, 0x4d440000, 0x4d340000,
-+ 0x42028800, 0xffffffff, 0x42002000, 0xffffffff,
-+ 0x42003000, 0x00000001, 0x42003800, 0x00000001,
-+ 0x42001800, 0x0010b5f0, 0x59a8100f, 0x82081500,
-+ 0x000000ff, 0x40180000, 0x0c01f001, 0x00103097,
-+ 0x0010309a, 0x0010309e, 0x001030a2, 0x82102500,
-+ 0xffffff00, 0x0401f014, 0x82102500, 0xffff00ff,
-+ 0x840811c0, 0x0401f010, 0x82102500, 0xff00ffff,
-+ 0x900811c0, 0x0401f00c, 0x82102500, 0x00ffffff,
-+ 0x9c0801c0, 0x80102540, 0x44101800, 0x42003000,
-+ 0xffffffff, 0x42002000, 0xffffffff, 0x800c1800,
-+ 0x0401f003, 0x40080000, 0x80102540, 0x81468800,
-+ 0x83442c80, 0x0000007f, 0x04021014, 0x4c080000,
-+ 0x4c0c0000, 0x4c180000, 0x4c1c0000, 0x0201f800,
-+ 0x0002025a, 0x5c003800, 0x5c003000, 0x5c001800,
-+ 0x5c001000, 0x040207f2, 0x0201f800, 0x00104725,
-+ 0x040207ef, 0x80183000, 0x801c3800, 0x59341202,
-+ 0x40180000, 0x0c01f7ce, 0x82100580, 0xffffffff,
-+ 0x04000002, 0x44101800, 0x42001800, 0x0010b5f0,
-+ 0x500c0000, 0x82000500, 0xffffff00, 0x801c0540,
-+ 0x44001800, 0x5c026800, 0x5c028800, 0x42000800,
- 0x00000020, 0x59a00407, 0x59a01207, 0x900811c0,
- 0x80081540, 0x59a00409, 0x59a01a09, 0x900c19c0,
-- 0x800c1d40, 0x419c0000, 0x0201f000, 0x00103841,
-- 0x800409c0, 0x04000005, 0x4a034406, 0x00000001,
-- 0x0201f000, 0x001020b2, 0x0201f800, 0x00104e0d,
-- 0x04020005, 0x4a034406, 0x00000016, 0x0201f000,
-- 0x001020b2, 0x59a80013, 0x8c000500, 0x04000011,
-- 0x4a034406, 0x00000000, 0x42000800, 0x00000020,
-- 0x59a00407, 0x59a01207, 0x900811c0, 0x80081540,
-- 0x59a00409, 0x59a01a09, 0x900c19c0, 0x800c1d40,
-- 0x42000000, 0x0010bc20, 0x0201f000, 0x00103841,
-- 0x4a034406, 0x00000001, 0x4200b000, 0x00000020,
-- 0x4200a800, 0x0010bc20, 0x4200a000, 0xffffffff,
-- 0x4450a800, 0x8054a800, 0x8058b040, 0x040207fd,
-- 0x4d440000, 0x4d340000, 0x42028800, 0xffffffff,
-- 0x42002000, 0xffffffff, 0x42003000, 0x00000001,
-- 0x42003800, 0x00000001, 0x42001800, 0x0010bc20,
-- 0x59a81010, 0x82081500, 0x000000ff, 0x40180000,
-- 0x0c01f001, 0x00103275, 0x00103278, 0x0010327c,
-- 0x00103280, 0x82102500, 0xffffff00, 0x0401f014,
-- 0x82102500, 0xffff00ff, 0x840811c0, 0x0401f010,
-- 0x82102500, 0xff00ffff, 0x900811c0, 0x0401f00c,
-- 0x82102500, 0x00ffffff, 0x9c0801c0, 0x80102540,
-- 0x44101800, 0x42003000, 0xffffffff, 0x42002000,
-- 0xffffffff, 0x800c1800, 0x0401f003, 0x40080000,
-- 0x80102540, 0x81468800, 0x83442c80, 0x0000007f,
-- 0x04021014, 0x4c080000, 0x4c0c0000, 0x4c180000,
-- 0x4c1c0000, 0x0201f800, 0x00020267, 0x5c003800,
-- 0x5c003000, 0x5c001800, 0x5c001000, 0x040207f2,
-- 0x0201f800, 0x00104842, 0x040207ef, 0x80183000,
-- 0x801c3800, 0x59341202, 0x40180000, 0x0c01f7ce,
-- 0x82100580, 0xffffffff, 0x04000002, 0x44101800,
-- 0x42001800, 0x0010bc20, 0x500c0000, 0x82000500,
-- 0xffffff00, 0x801c0540, 0x44001800, 0x5c026800,
-- 0x5c028800, 0x42000800, 0x00000020, 0x59a00407,
-- 0x59a01207, 0x900811c0, 0x80081540, 0x59a00409,
-- 0x59a01a09, 0x900c19c0, 0x800c1d40, 0x42000000,
-- 0x0010bc20, 0x0201f000, 0x00103841, 0x59a28c06,
-- 0x59a0020b, 0x8c000500, 0x0400000e, 0x59a01208,
-- 0x59a00408, 0x82000500, 0x000000ff, 0x900001c0,
-- 0x80081540, 0x41784000, 0x0201f800, 0x00104768,
-- 0x04000008, 0x48034406, 0x0201f000, 0x001020b6,
-- 0x0201f800, 0x00020267, 0x02020000, 0x001020b6,
-- 0x0201f800, 0x0010381a, 0x04020005, 0x4a034406,
-- 0x00000002, 0x0201f000, 0x001020b2, 0x59a0020b,
-- 0x8c000500, 0x04000005, 0x0201f800, 0x00104842,
-- 0x02020000, 0x001038dd, 0x59a0020b, 0x8c000502,
-- 0x04000019, 0x83440480, 0x000007f0, 0x04021016,
-- 0x0201f800, 0x0010484b, 0x04020013, 0x497a5a04,
-- 0x4a025c04, 0x00008000, 0x0201f800, 0x00108ea3,
-- 0x04020005, 0x4a034406, 0x00000003, 0x0201f000,
-- 0x001020b2, 0x4a01d809, 0x001032f8, 0x1c01f000,
-- 0x59a28c06, 0x0201f800, 0x00020267, 0x02020000,
-- 0x001020b6, 0x4c580000, 0x4c500000, 0x4c540000,
-- 0x4200b000, 0x0000000a, 0x4134a000, 0x832e5c00,
-- 0x00000002, 0x412ca800, 0x0201f800, 0x0010a93e,
-- 0x832cac00, 0x00000006, 0x4054a000, 0x4200b000,
-- 0x00000004, 0x0201f800, 0x0010a94f, 0x5c00a800,
-- 0x5c00a000, 0x5c00b000, 0x592c0802, 0x82040500,
-- 0x00ff00ff, 0x900001c0, 0x82041500, 0xff00ff00,
-- 0x80080540, 0x48025802, 0x592c0801, 0x82040500,
-- 0x00ff00ff, 0x900001c0, 0x82041500, 0xff00ff00,
-- 0x80080540, 0x48025801, 0x42000800, 0x0000000a,
-- 0x59a00407, 0x59a01207, 0x900811c0, 0x80081540,
-- 0x59a00409, 0x59a01a09, 0x900c19c0, 0x800c1d40,
-- 0x412c0000, 0x0201f000, 0x00103841, 0x496fc857,
-- 0x496f4406, 0x0201f000, 0x00102066, 0x59a28c06,
-- 0x0201f800, 0x00020267, 0x02020000, 0x001020b6,
-- 0x836c0580, 0x00000003, 0x04000005, 0x4a034406,
-- 0x00000007, 0x0201f000, 0x001020b2, 0x83340c00,
-- 0x00000006, 0x59a0020b, 0x8c000500, 0x04000003,
-- 0x83340c00, 0x00000008, 0x58040001, 0x48034409,
-- 0x900001c0, 0x48034209, 0x50040000, 0x48034407,
-- 0x900001c0, 0x48034207, 0x59340200, 0x48034406,
-- 0x0201f000, 0x00102066, 0x800409c0, 0x04000005,
-- 0x4a034406, 0x00000001, 0x0201f000, 0x001020b2,
-- 0x59a0220b, 0x8c102500, 0x0402002e, 0x8c102506,
-- 0x04020006, 0x59a03208, 0x82180480, 0x00000003,
-- 0x02021000, 0x001020b6, 0x59a28c06, 0x0201f800,
-- 0x00020267, 0x02020000, 0x001020b6, 0x0201f800,
-- 0x00104836, 0x04000005, 0x4a034406, 0x00000009,
-- 0x0201f000, 0x001020b2, 0x0201f800, 0x0010381a,
-+ 0x800c1d40, 0x42000000, 0x0010b5f0, 0x0201f000,
-+ 0x001036dd, 0x59a28c06, 0x59a0020b, 0x8c000500,
-+ 0x0400000e, 0x59a01208, 0x59a00408, 0x82000500,
-+ 0x000000ff, 0x900001c0, 0x80081540, 0x41784000,
-+ 0x0201f800, 0x00104641, 0x04000008, 0x48034406,
-+ 0x0201f000, 0x00101edd, 0x0201f800, 0x0002025a,
-+ 0x02020000, 0x00101edd, 0x0201f800, 0x001036b6,
- 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-- 0x001020b2, 0x59a0220b, 0x8c102506, 0x04000004,
-- 0x59343002, 0x82183500, 0x00ffffff, 0x497a5a04,
-- 0x4a025c04, 0x00008000, 0x0201f800, 0x00108e65,
-- 0x04020005, 0x4a034406, 0x00000003, 0x0201f000,
-- 0x001020b2, 0x4a01d809, 0x001033de, 0x1c01f000,
-- 0x59a28c06, 0x0201f800, 0x00020267, 0x02020000,
-- 0x001020b6, 0x0201f800, 0x00104836, 0x04000005,
-- 0x4a034406, 0x00000009, 0x0201f000, 0x001020b2,
-- 0x0201f800, 0x0010381a, 0x04020005, 0x4a034406,
-- 0x00000002, 0x0201f000, 0x001020b2, 0x497a5a04,
-- 0x4a025c04, 0x00008000, 0x0201f800, 0x0010381a,
-+ 0x00101ed9, 0x59a0020b, 0x8c000500, 0x04000005,
-+ 0x0201f800, 0x00104725, 0x02020000, 0x0010377a,
-+ 0x59a0020b, 0x8c000502, 0x04000019, 0x83440480,
-+ 0x000007f0, 0x04021016, 0x0201f800, 0x0010472e,
-+ 0x04020013, 0x497a5a04, 0x4a025c04, 0x00008000,
-+ 0x0201f800, 0x001088fa, 0x04020005, 0x4a034406,
-+ 0x00000003, 0x0201f000, 0x00101ed9, 0x4a01d809,
-+ 0x0010311a, 0x1c01f000, 0x59a28c06, 0x0201f800,
-+ 0x0002025a, 0x02020000, 0x00101edd, 0x4c580000,
-+ 0x4c500000, 0x4c540000, 0x4200b000, 0x0000000a,
-+ 0x4134a000, 0x832e5c00, 0x00000002, 0x412ca800,
-+ 0x0201f800, 0x0010a330, 0x832cac00, 0x00000006,
-+ 0x4054a000, 0x4200b000, 0x00000004, 0x0201f800,
-+ 0x0010a341, 0x5c00a800, 0x5c00a000, 0x5c00b000,
-+ 0x592c0802, 0x82040500, 0x00ff00ff, 0x900001c0,
-+ 0x82041500, 0xff00ff00, 0x80080540, 0x48025802,
-+ 0x592c0801, 0x82040500, 0x00ff00ff, 0x900001c0,
-+ 0x82041500, 0xff00ff00, 0x80080540, 0x48025801,
-+ 0x42000800, 0x0000000a, 0x59a00407, 0x59a01207,
-+ 0x900811c0, 0x80081540, 0x59a00409, 0x59a01a09,
-+ 0x900c19c0, 0x800c1d40, 0x412c0000, 0x0201f000,
-+ 0x001036dd, 0x496fc857, 0x496f4406, 0x0201f000,
-+ 0x00101e8d, 0x59a28c06, 0x0201f800, 0x0002025a,
-+ 0x02020000, 0x00101edd, 0x836c0580, 0x00000003,
-+ 0x04000005, 0x4a034406, 0x00000007, 0x0201f000,
-+ 0x00101ed9, 0x83340c00, 0x00000006, 0x59a0020b,
-+ 0x8c000500, 0x04000003, 0x83340c00, 0x00000008,
-+ 0x58040001, 0x48034409, 0x900001c0, 0x48034209,
-+ 0x50040000, 0x48034407, 0x900001c0, 0x48034207,
-+ 0x59340200, 0x48034406, 0x0201f000, 0x00101e8d,
-+ 0x8d0e1d0e, 0x04000005, 0x4a034406, 0x00000001,
-+ 0x0201f000, 0x00101ed9, 0x59a0220b, 0x8c102500,
-+ 0x0402002e, 0x8c102506, 0x04020006, 0x59a03208,
-+ 0x82180480, 0x00000003, 0x02021000, 0x00101edd,
-+ 0x59a28c06, 0x0201f800, 0x0002025a, 0x02020000,
-+ 0x00101edd, 0x0201f800, 0x00104719, 0x04000005,
-+ 0x4a034406, 0x00000009, 0x0201f000, 0x00101ed9,
-+ 0x0201f800, 0x001036b6, 0x04020005, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x59a0220b,
-+ 0x8c102506, 0x04000004, 0x59343002, 0x82183500,
-+ 0x00ffffff, 0x497a5a04, 0x4a025c04, 0x00008000,
-+ 0x0201f800, 0x001088bc, 0x04020005, 0x4a034406,
-+ 0x00000003, 0x0201f000, 0x00101ed9, 0x4a01d809,
-+ 0x00103200, 0x1c01f000, 0x59a28c06, 0x0201f800,
-+ 0x0002025a, 0x02020000, 0x00101edd, 0x0201f800,
-+ 0x00104719, 0x04000005, 0x4a034406, 0x00000009,
-+ 0x0201f000, 0x00101ed9, 0x0201f800, 0x001036b6,
- 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-- 0x001020b2, 0x592e5800, 0x0201f800, 0x00108e7a,
-- 0x04020005, 0x4a034406, 0x00000003, 0x0201f000,
-- 0x001020b2, 0x4a01d809, 0x001033b0, 0x1c01f000,
-- 0x592c2805, 0x82140d80, 0x01000000, 0x04020005,
-- 0x4a034406, 0x00000004, 0x0201f000, 0x001020b2,
-- 0x42000800, 0x00000008, 0x59a00207, 0x59a01407,
-- 0x900001c0, 0x80081540, 0x59a00209, 0x59a01c09,
-- 0x900001c0, 0x800c1d40, 0x832c0400, 0x00000005,
-- 0x0201f800, 0x00103841, 0x8c142d00, 0x04000003,
-- 0x4a01d809, 0x001033cb, 0x1c01f000, 0x4031d800,
-- 0x58ef400b, 0x58ee580e, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x812e59c0,
-- 0x02000800, 0x00100615, 0x42000800, 0x00000008,
-- 0x832c0400, 0x00000005, 0x58ec1007, 0x58ec1808,
-- 0x0201f000, 0x00103841, 0x592c0005, 0x82000580,
-+ 0x00101ed9, 0x497a5a04, 0x4a025c04, 0x00008000,
-+ 0x0201f800, 0x001036b6, 0x04020005, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x592e5800,
-+ 0x0201f800, 0x001088d1, 0x04020005, 0x4a034406,
-+ 0x00000003, 0x0201f000, 0x00101ed9, 0x4a01d809,
-+ 0x001031d2, 0x1c01f000, 0x592c2805, 0x82140d80,
- 0x01000000, 0x04020005, 0x4a034406, 0x00000004,
-- 0x0201f000, 0x001020b2, 0x59a00207, 0x59a01407,
-- 0x900001c0, 0x80081540, 0x59a00209, 0x59a01c09,
-- 0x900001c0, 0x800c1d40, 0x42000800, 0x00000006,
-- 0x832c0400, 0x00000006, 0x0201f000, 0x00103841,
-- 0x59a00a0a, 0x800409c0, 0x02000000, 0x001020b6,
-- 0x82040480, 0x000000e8, 0x04001003, 0x42000800,
-- 0x000000e7, 0x59a00207, 0x59a01407, 0x900001c0,
-- 0x80081540, 0x59a00209, 0x59a01c09, 0x900001c0,
-- 0x800c1d40, 0x83880400, 0x00000000, 0x0201f800,
-- 0x00103841, 0x4a01d809, 0x0010340c, 0x1c01f000,
-- 0x4031d800, 0x58ef400b, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x59a0020b,
-- 0x8c000500, 0x04000008, 0x83880400, 0x00000000,
-- 0x4803c840, 0x4a03c842, 0x00000006, 0x04011000,
-- 0x497b8885, 0x4a034207, 0x000000e7, 0x0201f000,
-- 0x00102066, 0x800409c0, 0x04000005, 0x4a034406,
-- 0x00000001, 0x0201f000, 0x001020b2, 0x0401fbf3,
-- 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-- 0x001020b2, 0x497a5a04, 0x4a025c04, 0x00008000,
-- 0x59a00406, 0x800001c0, 0x02000000, 0x001020b6,
-- 0x82001580, 0x000000ff, 0x04000005, 0x82001480,
-- 0x00000004, 0x02021000, 0x001020b6, 0x40001000,
-- 0x0201f800, 0x00101d6a, 0x04020005, 0x4a034406,
-- 0x00000003, 0x0201f000, 0x001020b2, 0x4a01d809,
-- 0x00103446, 0x1c01f000, 0x592c0005, 0x82000580,
-- 0x01000000, 0x02020000, 0x00102066, 0x4a034406,
-- 0x00000004, 0x0201f000, 0x001020b2, 0x59a01406,
-- 0x8c081508, 0x04020007, 0x800409c0, 0x04000005,
-- 0x4a034406, 0x00000001, 0x0201f000, 0x001020b2,
-- 0x59a01c07, 0x820c0480, 0x00001000, 0x02021000,
-- 0x001020b6, 0x497b2804, 0x497b2805, 0x497b281c,
-- 0x497b281d, 0x497b281f, 0x497b2820, 0x497b2822,
-- 0x497b2823, 0x80000580, 0x0201f800, 0x00101668,
-- 0x59a80805, 0x8c081500, 0x04000004, 0x82040d40,
-- 0x00000011, 0x0401f004, 0x8c081506, 0x04000002,
-- 0x84040d42, 0x84040d0a, 0x48075005, 0x4202d800,
-- 0x00000001, 0x82081500, 0x000000e0, 0x8008010a,
-- 0x0c020036, 0x0201f800, 0x00104e0d, 0x04020009,
-- 0x4a035033, 0x00000001, 0x0201f800, 0x00104d76,
-- 0x0401f01f, 0x4a035033, 0x00000000, 0x0401f7fb,
-- 0x497b5032, 0x0201f800, 0x00103f5c, 0x0201f800,
-- 0x0010698c, 0x0201f800, 0x00106c32, 0x0201f800,
-- 0x00106982, 0x59a00a07, 0x480788a7, 0x59c400a3,
-- 0x82000500, 0xfeffffff, 0x82000540, 0x80018000,
-- 0x40000800, 0x84040d20, 0x480388a3, 0x480788a3,
-- 0x497b504e, 0x42000800, 0x0000002d, 0x42001000,
-- 0x00103fe4, 0x0201f800, 0x00105ca2, 0x59a00407,
-- 0x800000c2, 0x800008c4, 0x8005d400, 0x42000000,
-- 0x0000ffff, 0x0201f800, 0x00104e0d, 0x04000003,
-- 0x59a00207, 0x80000110, 0x0201f800, 0x00103915,
-- 0x0201f000, 0x00102066, 0x00103479, 0x0010347c,
-- 0x00103484, 0x001020b6, 0x00103481, 0x001020b6,
-- 0x001020b6, 0x001020b6, 0x836c0580, 0x00000003,
-- 0x04000005, 0x4a034406, 0x00000007, 0x0201f000,
-- 0x001020b2, 0x59a03c06, 0x59a00407, 0x59a04a07,
-- 0x902449c0, 0x80244d40, 0x59a00409, 0x59a05209,
-- 0x902851c0, 0x80285540, 0x0401fb54, 0x04020005,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-- 0x417a8800, 0x41783000, 0x497b4001, 0x497b4004,
-- 0x832c4400, 0x00000005, 0x48234002, 0x8c1c3d04,
-- 0x04020078, 0x0201f800, 0x00020267, 0x0402002a,
-- 0x0201f800, 0x00104836, 0x04000004, 0x0201f800,
-- 0x00104732, 0x04020024, 0x8c1c3d00, 0x04000008,
-- 0x59340009, 0x44004000, 0x59340008, 0x80204000,
-- 0x44004000, 0x80204000, 0x0401f007, 0x59340007,
-- 0x44004000, 0x59340006, 0x80204000, 0x44004000,
-- 0x80204000, 0x83440580, 0x000007fe, 0x0400000d,
-- 0x83440580, 0x000007fc, 0x0400000a, 0x0201f800,
-- 0x00104842, 0x04000003, 0x85468d5e, 0x0401f005,
-- 0x0201f800, 0x00104686, 0x04020002, 0x85468d5e,
-- 0x45444000, 0x85468d1e, 0x80204000, 0x82183400,
-- 0x00000003, 0x81468800, 0x83440480, 0x000007f0,
-- 0x0400100e, 0x8c1c3d06, 0x04000010, 0x83440580,
-- 0x000007f0, 0x04020004, 0x42028800, 0x000007fe,
-- 0x0401f006, 0x83440580, 0x000007ff, 0x04020007,
-- 0x42028800, 0x000007fc, 0x82180580, 0x0000000f,
-- 0x0400000b, 0x0401f7c0, 0x801831c0, 0x04020006,
-- 0x59a00801, 0x800408c4, 0x48074406, 0x0201f000,
-- 0x00102066, 0x4a034004, 0x00000001, 0x49474000,
-- 0x59a00001, 0x80180400, 0x48034001, 0x481f4003,
-- 0x4a01d801, 0x00000000, 0x4819d804, 0x59a00002,
-- 0x4801d803, 0x4825d807, 0x4829d808, 0x4000a800,
-- 0x4000a000, 0x4018b000, 0x0201f800, 0x0010a93e,
-- 0x40ec1000, 0x0201f800, 0x001008a1, 0x4a01d809,
-- 0x00103536, 0x1c01f000, 0x4031d800, 0x58ef400b,
-+ 0x0201f000, 0x00101ed9, 0x42000800, 0x00000008,
-+ 0x59a00207, 0x59a01407, 0x900001c0, 0x80081540,
-+ 0x59a00209, 0x59a01c09, 0x900001c0, 0x800c1d40,
-+ 0x832c0400, 0x00000005, 0x0201f800, 0x001036dd,
-+ 0x8c142d00, 0x04000003, 0x4a01d809, 0x001031ed,
-+ 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ee580e,
- 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-- 0x001020aa, 0x59a00004, 0x80000540, 0x04020008,
-- 0x59a28800, 0x59a04002, 0x59a03803, 0x41783000,
-- 0x58ec4807, 0x58ec5008, 0x0401f78f, 0x59a00801,
-- 0x800408c4, 0x48074406, 0x0201f000, 0x00102066,
-- 0x0201f800, 0x00020267, 0x0402002f, 0x0201f800,
-- 0x00104836, 0x04000004, 0x0201f800, 0x00104732,
-- 0x04020029, 0x83440580, 0x000007fe, 0x04000011,
-- 0x83440580, 0x000007fc, 0x0400000e, 0x0201f800,
-- 0x00104842, 0x04000005, 0x59340403, 0x8400055e,
-- 0x48026c03, 0x0401f007, 0x0201f800, 0x00104686,
-- 0x04020004, 0x59340403, 0x8400055e, 0x48026c03,
-- 0x4134a000, 0x4020a800, 0x4200b000, 0x00000006,
-- 0x0201f800, 0x0010a93e, 0x59340007, 0x4400a800,
-- 0x59340006, 0x4800a801, 0x59340009, 0x4800a802,
-- 0x59340008, 0x4800a803, 0x59340403, 0x8400051e,
-- 0x48026c03, 0x82204400, 0x0000000a, 0x82183400,
-- 0x0000000a, 0x81468800, 0x83440480, 0x000007f0,
-- 0x0400100e, 0x8c1c3d06, 0x04000010, 0x83440580,
-- 0x000007f0, 0x04020004, 0x42028800, 0x000007fe,
-- 0x0401f006, 0x83440580, 0x000007ff, 0x04020007,
-- 0x42028800, 0x000007fc, 0x82180580, 0x0000000a,
-- 0x0400000b, 0x0401f7bb, 0x801831c0, 0x04020006,
-- 0x59a00801, 0x800408c4, 0x48074406, 0x0201f000,
-- 0x00102066, 0x4a034004, 0x00000001, 0x49474000,
-- 0x59a00001, 0x80180400, 0x48034001, 0x481f4003,
-- 0x4a01d801, 0x00000000, 0x4819d804, 0x59a00002,
-- 0x4801d803, 0x4825d807, 0x4829d808, 0x40ec1000,
-- 0x0201f800, 0x001008a1, 0x4a01d809, 0x001035ad,
-- 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ec0002,
-- 0x82000580, 0x00000200, 0x02000000, 0x001020aa,
-- 0x59a00004, 0x80000540, 0x04020008, 0x59a28800,
-- 0x59a04002, 0x59a03803, 0x41783000, 0x58ec4807,
-- 0x58ec5008, 0x0401f78f, 0x59a00801, 0x800408c4,
-- 0x48074406, 0x0201f000, 0x00102066, 0x42002800,
-- 0x0000007e, 0x59a00c06, 0x59a01207, 0x59a01c07,
-- 0x59a02209, 0x82040500, 0x0000ff00, 0x840001c0,
-- 0x82003480, 0x00000020, 0x02001000, 0x001020b6,
-- 0x80140480, 0x02001000, 0x001020b6, 0x82040500,
-- 0x000000ff, 0x82003480, 0x00000020, 0x02001000,
-- 0x001020b6, 0x80140480, 0x02001000, 0x001020b6,
-- 0x82080500, 0x0000ff00, 0x840001c0, 0x82003480,
-- 0x00000020, 0x02001000, 0x001020b6, 0x80140480,
-- 0x02001000, 0x001020b6, 0x82080500, 0x000000ff,
-- 0x82003480, 0x00000020, 0x02001000, 0x001020b6,
-- 0x80140480, 0x02001000, 0x001020b6, 0x820c0500,
-- 0x0000ff00, 0x840001c0, 0x82003480, 0x00000020,
-- 0x02001000, 0x001020b6, 0x80140480, 0x02001000,
-- 0x001020b6, 0x820c0500, 0x000000ff, 0x82003480,
-- 0x00000020, 0x02001000, 0x001020b6, 0x80140480,
-- 0x02001000, 0x001020b6, 0x82100500, 0x0000ff00,
-- 0x840001c0, 0x82003480, 0x00000020, 0x02001000,
-- 0x001020b6, 0x80140480, 0x02001000, 0x001020b6,
-- 0x82100500, 0x000000ff, 0x82003480, 0x00000020,
-- 0x02001000, 0x001020b6, 0x80140480, 0x02001000,
-- 0x001020b6, 0x900401c0, 0x80080d40, 0x900c01c0,
-- 0x80101d40, 0x83a83400, 0x0000003a, 0x44043000,
-- 0x80183000, 0x440c3000, 0x0201f000, 0x00102066,
-- 0x0401f9fa, 0x04020005, 0x4a034406, 0x00000002,
-- 0x0201f000, 0x001020b2, 0x42000800, 0x0000000c,
-- 0x0401f853, 0x4a01d809, 0x0010362c, 0x1c01f000,
-- 0x4031d800, 0x58ee580d, 0x58ef400b, 0x58ec0002,
-- 0x82000580, 0x00000200, 0x02000000, 0x001020aa,
-- 0x832ca400, 0x00000004, 0x4200b000, 0x0000000c,
-- 0x40c8a800, 0x0201f800, 0x0010a93e, 0x58c80200,
-- 0x80000540, 0x04000034, 0x58c80400, 0x82000500,
-- 0xfffffffb, 0x04020030, 0x58c80401, 0x80000540,
-- 0x0400002d, 0x82000480, 0x0000ff01, 0x0402102a,
-- 0x58c80202, 0x82000480, 0x0000005c, 0x04001026,
-- 0x0201f800, 0x001060db, 0x58c80c08, 0x58c80204,
-- 0x80040480, 0x04001020, 0x58c80204, 0x82000480,
-- 0x00000005, 0x0402101c, 0x58c80205, 0x58c80c08,
-- 0x80040902, 0x80040480, 0x04001017, 0x58c80c08,
-- 0x0201f800, 0x0010602a, 0x0400001b, 0x0201f800,
-- 0x00105ef2, 0x04020012, 0x4979940b, 0x59c408a3,
-- 0x82040d40, 0x00000002, 0x480788a3, 0x4a038830,
-- 0x00000001, 0x4a038832, 0x01ffffff, 0x58c80202,
-- 0x48030804, 0x0201f800, 0x00105ed4, 0x0201f000,
-- 0x00102066, 0x0201f000, 0x001020b6, 0x0201f800,
-- 0x0010612d, 0x0201f800, 0x0010613a, 0x0201f800,
-- 0x0010601d, 0x0201f000, 0x001020b2, 0x4c000000,
-- 0x59a01207, 0x59a00407, 0x900811c0, 0x80081540,
-- 0x59a01a09, 0x59a00409, 0x900c19c0, 0x800c1d40,
-- 0x5c000000, 0x0401f1b9, 0x59840000, 0x82000580,
-- 0x00000000, 0x04000050, 0x59840002, 0x8c000504,
-- 0x0400004d, 0x84000546, 0x48030802, 0x0201f800,
-- 0x0010601d, 0x59c408a3, 0x82040d00, 0xfffffffd,
-- 0x480788a3, 0x4c5c0000, 0x4200b800, 0x0010aa00,
-- 0x505e6800, 0x813669c0, 0x04000008, 0x5936600e,
-- 0x813261c0, 0x04000005, 0x0201f800, 0x0010600e,
-- 0x02000800, 0x001061e5, 0x805cb800, 0x825c0580,
-- 0x0010b1f0, 0x040207f3, 0x59866003, 0x813261c0,
-- 0x0400000b, 0x59300406, 0x82000580, 0x00000009,
-- 0x02020800, 0x00100615, 0x5930b800, 0x0201f800,
-- 0x00105ffa, 0x405e6000, 0x0401f7f5, 0x497b0803,
-- 0x4200b800, 0x0010b317, 0x505e6000, 0x813261c0,
-- 0x04000011, 0x59300406, 0x82000580, 0x00000009,
-- 0x0402000d, 0x59300203, 0x82000580, 0x00000004,
-- 0x04020009, 0x59326809, 0x813669c0, 0x02020800,
-- 0x00100615, 0x0201f800, 0x00100ee4, 0x0201f800,
-- 0x00105ffa, 0x4578b800, 0x805cb800, 0x825c0580,
-- 0x0010b31f, 0x040207e9, 0x42000800, 0x0010b315,
-- 0x49780801, 0x49780800, 0x0201f800, 0x0010612d,
-- 0x0201f800, 0x0010613a, 0x5c00b800, 0x0201f800,
-- 0x00105eed, 0x0201f000, 0x00102066, 0x836c0580,
-+ 0x00101ed1, 0x812e59c0, 0x02000800, 0x001004ef,
-+ 0x42000800, 0x00000008, 0x832c0400, 0x00000005,
-+ 0x58ec1007, 0x58ec1808, 0x0201f000, 0x001036dd,
-+ 0x592c0005, 0x82000580, 0x01000000, 0x04020005,
-+ 0x4a034406, 0x00000004, 0x0201f000, 0x00101ed9,
-+ 0x59a00207, 0x59a01407, 0x900001c0, 0x80081540,
-+ 0x59a00209, 0x59a01c09, 0x900001c0, 0x800c1d40,
-+ 0x42000800, 0x00000006, 0x832c0400, 0x00000006,
-+ 0x0201f000, 0x001036dd, 0x59a00a0a, 0x800409c0,
-+ 0x02000000, 0x00101edd, 0x82040480, 0x000000e8,
-+ 0x04001003, 0x42000800, 0x000000e7, 0x59a00207,
-+ 0x59a01407, 0x900001c0, 0x80081540, 0x59a00209,
-+ 0x59a01c09, 0x900001c0, 0x800c1d40, 0x83880400,
-+ 0x00000000, 0x0201f800, 0x001036dd, 0x4a01d809,
-+ 0x0010322e, 0x1c01f000, 0x4031d800, 0x58ef400b,
-+ 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-+ 0x00101ed1, 0x59a0020b, 0x8c000500, 0x04000008,
-+ 0x83880400, 0x00000000, 0x4803c840, 0x4a03c842,
-+ 0x00000006, 0x04011000, 0x497b8885, 0x4a034207,
-+ 0x000000e7, 0x0201f000, 0x00101e8d, 0x8d0e1d0e,
-+ 0x04000005, 0x4a034406, 0x00000001, 0x0201f000,
-+ 0x00101ed9, 0x0201f800, 0x001036b6, 0x04020005,
-+ 0x4a034406, 0x00000002, 0x0201f000, 0x00101ed9,
-+ 0x497a5a04, 0x4a025c04, 0x00008000, 0x59a00406,
-+ 0x800001c0, 0x02000000, 0x00101edd, 0x82001580,
-+ 0x000000ff, 0x04000005, 0x82001480, 0x00000004,
-+ 0x02021000, 0x00101edd, 0x40001000, 0x0201f800,
-+ 0x00101c0c, 0x04020005, 0x4a034406, 0x00000003,
-+ 0x0201f000, 0x00101ed9, 0x4a01d809, 0x00103269,
-+ 0x1c01f000, 0x592c0005, 0x82000580, 0x01000000,
-+ 0x02020000, 0x00101e8d, 0x4a034406, 0x00000004,
-+ 0x0201f000, 0x00101ed9, 0x59a01406, 0x8c081508,
-+ 0x04020007, 0x8d0e1d0e, 0x04000005, 0x4a034406,
-+ 0x00000001, 0x0201f000, 0x00101ed9, 0x59a01c07,
-+ 0x820c0480, 0x00001000, 0x02021000, 0x00101edd,
-+ 0x497b2804, 0x497b2805, 0x497b281c, 0x497b281d,
-+ 0x497b281f, 0x497b2820, 0x497b2822, 0x497b2823,
-+ 0x4803c856, 0x850e1d06, 0x8c081500, 0x04000005,
-+ 0x4803c856, 0x830e1d40, 0x00000011, 0x0401f004,
-+ 0x8c081506, 0x04000002, 0x850e1d42, 0x850e1d0a,
-+ 0x4202d800, 0x00000001, 0x82081500, 0x000000e0,
-+ 0x8008010a, 0x0c020036, 0x0201f800, 0x00104ca6,
-+ 0x04020009, 0x4a035030, 0x00000001, 0x0201f800,
-+ 0x00104c16, 0x0401f01f, 0x4a035030, 0x00000000,
-+ 0x0401f7fb, 0x497b502f, 0x0201f800, 0x00103dec,
-+ 0x0201f800, 0x00106476, 0x0201f800, 0x00106725,
-+ 0x0201f800, 0x00106463, 0x59a00a07, 0x480788a7,
-+ 0x59c400a3, 0x82000500, 0xfeffffff, 0x82000540,
-+ 0x80018000, 0x40000800, 0x84040d20, 0x480388a3,
-+ 0x480788a3, 0x497b504b, 0x42000800, 0x0000002d,
-+ 0x42001000, 0x00103e74, 0x0201f800, 0x00105b43,
-+ 0x59a00407, 0x800000c2, 0x800008c4, 0x8005d400,
-+ 0x42000000, 0x0000ffff, 0x0201f800, 0x00104ca6,
-+ 0x04000003, 0x59a00207, 0x80000110, 0x0201f800,
-+ 0x001037b1, 0x0201f000, 0x00101e8d, 0x0010329a,
-+ 0x0010329d, 0x001032a5, 0x00101edd, 0x001032a2,
-+ 0x00101edd, 0x00101edd, 0x00101edd, 0x836c0580,
- 0x00000003, 0x04000005, 0x4a034406, 0x00000007,
-- 0x0201f000, 0x001020b2, 0x59a00407, 0x59a02207,
-- 0x901021c0, 0x80102540, 0x59a00409, 0x59a02a09,
-- 0x901429c0, 0x80142d40, 0x0401f930, 0x04020005,
-- 0x4a034406, 0x00000002, 0x0201f000, 0x001020b2,
-- 0x417a8800, 0x41781800, 0x497b4001, 0x497b4003,
-- 0x832c3400, 0x00000004, 0x481b4002, 0x41440000,
-- 0x81ac0400, 0x50026800, 0x813669c0, 0x0400000b,
-- 0x0201f800, 0x00104836, 0x04020008, 0x59340002,
-- 0x48003000, 0x49443001, 0x82183400, 0x00000002,
-- 0x820c1c00, 0x00000002, 0x81468800, 0x83440480,
-- 0x00000800, 0x04000005, 0x820c0480, 0x00000010,
-- 0x0402100b, 0x0401f7ea, 0x800c19c0, 0x04020006,
-- 0x59a00801, 0x80040902, 0x48074406, 0x0201f000,
-- 0x00102066, 0x4a034003, 0x00000001, 0x49474000,
-- 0x59a00001, 0x800c0400, 0x48034001, 0x40ec1000,
-- 0x4a001001, 0x00000000, 0x480c1004, 0x59a00002,
-- 0x48001003, 0x48101007, 0x48141008, 0x0201f800,
-- 0x001008a1, 0x4a01d809, 0x00103728, 0x1c01f000,
-+ 0x0201f000, 0x00101ed9, 0x59a00407, 0x59a00a07,
-+ 0x900409c0, 0x80040d40, 0x4805d807, 0x59a00409,
-+ 0x59a00a09, 0x900409c0, 0x80040d40, 0x4805d808,
-+ 0x4a01d801, 0x00000000, 0x0401fbcc, 0x04020005,
-+ 0x4a034406, 0x00000002, 0x0201f000, 0x00101ed9,
-+ 0x417a8800, 0x497b4001, 0x832c0400, 0x00000005,
-+ 0x48034002, 0x59a00406, 0x8c000504, 0x0402009a,
-+ 0x4c5c0000, 0x4c600000, 0x4c640000, 0x4178b800,
-+ 0x59a0c406, 0x59a0c802, 0x0201f800, 0x0002025a,
-+ 0x0402002c, 0x0201f800, 0x00104719, 0x04000004,
-+ 0x0201f800, 0x00104602, 0x04020026, 0x8c60c53e,
-+ 0x04020022, 0x8c60c500, 0x04000008, 0x59340009,
-+ 0x4400c800, 0x8064c800, 0x59340008, 0x4400c800,
-+ 0x8064c800, 0x0401f007, 0x59340007, 0x4400c800,
-+ 0x8064c800, 0x59340006, 0x4400c800, 0x8064c800,
-+ 0x83440580, 0x000007fe, 0x0400000d, 0x83440580,
-+ 0x000007fc, 0x0400000a, 0x0201f800, 0x00104725,
-+ 0x04000003, 0x85468d5e, 0x0401f005, 0x0201f800,
-+ 0x00104555, 0x04020002, 0x85468d5e, 0x4544c800,
-+ 0x85468d1e, 0x8064c800, 0x825cbc00, 0x0000000c,
-+ 0x81468800, 0x83440480, 0x000007f0, 0x0400100e,
-+ 0x8c60c506, 0x04000029, 0x83440580, 0x000007f0,
-+ 0x04020004, 0x42028800, 0x000007fe, 0x0401f006,
-+ 0x83440580, 0x000007ff, 0x04020020, 0x42028800,
-+ 0x000007fc, 0x825c0580, 0x0000003c, 0x040207bf,
-+ 0x59a00001, 0x805c0400, 0x48034001, 0x8c60c53e,
-+ 0x04020007, 0x59a00a0a, 0x800409c0, 0x04000006,
-+ 0x80040480, 0x04021004, 0x8460c57e, 0x4178b800,
-+ 0x0401f7b2, 0x49474000, 0x485dd805, 0x59a00002,
-+ 0x4801d803, 0x40ec1000, 0x0201f800, 0x0010079e,
-+ 0x4a01d809, 0x00103388, 0x5c00c800, 0x5c00c000,
-+ 0x5c00b800, 0x1c01f000, 0x8c60c53e, 0x0402001a,
-+ 0x805cb9c0, 0x04000024, 0x59a00001, 0x805c0400,
-+ 0x48034001, 0x59a00a0a, 0x800409c0, 0x04000005,
-+ 0x80040480, 0x04021003, 0x4178b800, 0x0401f00e,
-+ 0x59a00801, 0x48074406, 0x485dd805, 0x59a00002,
-+ 0x4801d803, 0x4a01d809, 0x00101e86, 0x40ec1000,
-+ 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x0201f000,
-+ 0x0010079e, 0x59a00001, 0x805c0c00, 0x59a0020a,
-+ 0x80040480, 0x48034207, 0x4a034406, 0x0000000a,
-+ 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x0201f000,
-+ 0x00101ed9, 0x59a00801, 0x48074406, 0x5c00c800,
-+ 0x5c00c000, 0x5c00b800, 0x0201f000, 0x00101e8d,
- 0x4031d800, 0x58ef400b, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x59a00003,
-- 0x80000540, 0x04020008, 0x59a28800, 0x59a03002,
-- 0x41781800, 0x40ec1000, 0x58082007, 0x58082808,
-- 0x0401f7bf, 0x59a00801, 0x80040902, 0x48074406,
-- 0x0201f000, 0x00102066, 0x800409c0, 0x04000005,
-- 0x4a034406, 0x00000001, 0x0201f000, 0x001020b2,
-- 0x59a80026, 0x8c00050a, 0x04020007, 0x8c000506,
-+ 0x00000200, 0x02000000, 0x00101ed1, 0x59a28800,
-+ 0x0401f768, 0x4c5c0000, 0x4c600000, 0x4c640000,
-+ 0x4178b800, 0x59a0c406, 0x59a0c802, 0x0201f800,
-+ 0x0002025a, 0x04020031, 0x0201f800, 0x00104719,
-+ 0x04000004, 0x0201f800, 0x00104602, 0x0402002b,
-+ 0x8c60c53e, 0x04020027, 0x83440580, 0x000007fe,
-+ 0x04000011, 0x83440580, 0x000007fc, 0x0400000e,
-+ 0x0201f800, 0x00104725, 0x04000005, 0x59340403,
-+ 0x8400055e, 0x48026c03, 0x0401f007, 0x0201f800,
-+ 0x00104555, 0x04020004, 0x59340403, 0x8400055e,
-+ 0x48026c03, 0x4134a000, 0x4064a800, 0x4200b000,
-+ 0x00000006, 0x0201f800, 0x0010a330, 0x59340007,
-+ 0x4400a800, 0x59340006, 0x4800a801, 0x59340009,
-+ 0x4800a802, 0x59340008, 0x4800a803, 0x59340403,
-+ 0x8400051e, 0x48026c03, 0x8264cc00, 0x0000000a,
-+ 0x825cbc00, 0x00000028, 0x81468800, 0x83440480,
-+ 0x000007f0, 0x0400100e, 0x8c60c506, 0x0400002a,
-+ 0x83440580, 0x000007f0, 0x04020004, 0x42028800,
-+ 0x000007fe, 0x0401f006, 0x83440580, 0x000007ff,
-+ 0x04020021, 0x42028800, 0x000007fc, 0x825c0580,
-+ 0x00000028, 0x04000002, 0x0401f7b9, 0x59a00001,
-+ 0x805c0400, 0x48034001, 0x8c60c53e, 0x04020007,
-+ 0x59a00a0a, 0x800409c0, 0x04000006, 0x80040480,
-+ 0x04021004, 0x8460c57e, 0x4178b800, 0x0401f7ac,
-+ 0x49474000, 0x485dd805, 0x59a00002, 0x4801d803,
-+ 0x40ec1000, 0x0201f800, 0x0010079e, 0x4a01d809,
-+ 0x00103427, 0x5c00c800, 0x5c00c000, 0x5c00b800,
-+ 0x1c01f000, 0x8c60c53e, 0x0402001a, 0x805cb9c0,
-+ 0x04000024, 0x59a00001, 0x805c0400, 0x48034001,
-+ 0x59a00a0a, 0x800409c0, 0x04000005, 0x80040480,
-+ 0x04021003, 0x4178b800, 0x0401f00e, 0x59a00801,
-+ 0x48074406, 0x485dd805, 0x59a00002, 0x4801d803,
-+ 0x4a01d809, 0x00101e86, 0x40ec1000, 0x5c00c800,
-+ 0x5c00c000, 0x5c00b800, 0x0201f000, 0x0010079e,
-+ 0x59a00001, 0x805c0c00, 0x59a0020a, 0x80040480,
-+ 0x48034207, 0x4a034406, 0x0000000a, 0x5c00c800,
-+ 0x5c00c000, 0x5c00b800, 0x0201f000, 0x00101ed9,
-+ 0x59a00801, 0x48074406, 0x5c00c800, 0x5c00c000,
-+ 0x5c00b800, 0x0201f000, 0x00101e8d, 0x4031d800,
-+ 0x58ef400b, 0x58ec0002, 0x82000580, 0x00000200,
-+ 0x02000000, 0x00101ed1, 0x59a28800, 0x0401f762,
-+ 0x42002800, 0x0000007e, 0x59a00c06, 0x59a01207,
-+ 0x59a01c07, 0x59a02209, 0x82040500, 0x0000ff00,
-+ 0x840001c0, 0x82003480, 0x00000020, 0x02001000,
-+ 0x00101edd, 0x80140480, 0x02001000, 0x00101edd,
-+ 0x82040500, 0x000000ff, 0x82003480, 0x00000020,
-+ 0x02001000, 0x00101edd, 0x80140480, 0x02001000,
-+ 0x00101edd, 0x82080500, 0x0000ff00, 0x840001c0,
-+ 0x82003480, 0x00000020, 0x02001000, 0x00101edd,
-+ 0x80140480, 0x02001000, 0x00101edd, 0x82080500,
-+ 0x000000ff, 0x82003480, 0x00000020, 0x02001000,
-+ 0x00101edd, 0x80140480, 0x02001000, 0x00101edd,
-+ 0x820c0500, 0x0000ff00, 0x840001c0, 0x82003480,
-+ 0x00000020, 0x02001000, 0x00101edd, 0x80140480,
-+ 0x02001000, 0x00101edd, 0x820c0500, 0x000000ff,
-+ 0x82003480, 0x00000020, 0x02001000, 0x00101edd,
-+ 0x80140480, 0x02001000, 0x00101edd, 0x82100500,
-+ 0x0000ff00, 0x840001c0, 0x82003480, 0x00000020,
-+ 0x02001000, 0x00101edd, 0x80140480, 0x02001000,
-+ 0x00101edd, 0x82100500, 0x000000ff, 0x82003480,
-+ 0x00000020, 0x02001000, 0x00101edd, 0x80140480,
-+ 0x02001000, 0x00101edd, 0x900401c0, 0x80080d40,
-+ 0x900c01c0, 0x80101d40, 0x83a83400, 0x00000037,
-+ 0x44043000, 0x80183000, 0x440c3000, 0x0201f000,
-+ 0x00101e8d, 0x0401fa29, 0x04020005, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x42000800,
-+ 0x0000000c, 0x0401f853, 0x4a01d809, 0x00103499,
-+ 0x1c01f000, 0x4031d800, 0x58ee580d, 0x58ef400b,
-+ 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-+ 0x00101ed1, 0x832ca400, 0x00000004, 0x4200b000,
-+ 0x0000000c, 0x40c8a800, 0x0201f800, 0x0010a330,
-+ 0x58c80200, 0x80000540, 0x04000034, 0x58c80400,
-+ 0x82000500, 0xfffffffb, 0x04020030, 0x58c80401,
-+ 0x80000540, 0x0400002d, 0x82000480, 0x0000ff01,
-+ 0x0402102a, 0x58c80202, 0x82000480, 0x0000005c,
-+ 0x04001026, 0x0201f800, 0x00105f96, 0x58c80c08,
-+ 0x58c80204, 0x80040480, 0x04001020, 0x58c80204,
-+ 0x82000480, 0x00000005, 0x0402101c, 0x58c80205,
-+ 0x58c80c08, 0x80040902, 0x80040480, 0x04001017,
-+ 0x58c80c08, 0x0201f800, 0x00105ee1, 0x0400001b,
-+ 0x0201f800, 0x00105da0, 0x04020012, 0x4979940b,
-+ 0x59c408a3, 0x82040d40, 0x00000002, 0x480788a3,
-+ 0x4a038830, 0x00000001, 0x4a038832, 0x01ffffff,
-+ 0x58c80202, 0x48030804, 0x0201f800, 0x00105d82,
-+ 0x0201f000, 0x00101e8d, 0x0201f000, 0x00101edd,
-+ 0x0201f800, 0x00105fec, 0x0201f800, 0x00105ffd,
-+ 0x0201f800, 0x00105ed4, 0x0201f000, 0x00101ed9,
-+ 0x4c000000, 0x59a01207, 0x59a00407, 0x900811c0,
-+ 0x80081540, 0x59a01a09, 0x59a00409, 0x900c19c0,
-+ 0x800c1d40, 0x5c000000, 0x0401f1e8, 0x59840000,
-+ 0x82000580, 0x00000000, 0x04000050, 0x59840002,
-+ 0x8c000504, 0x0400004d, 0x84000546, 0x48030802,
-+ 0x0201f800, 0x00105ed4, 0x59c408a3, 0x82040d00,
-+ 0xfffffffd, 0x480788a3, 0x4c5c0000, 0x4200b800,
-+ 0x0010a400, 0x505e6800, 0x813669c0, 0x04000008,
-+ 0x5936600e, 0x813261c0, 0x04000005, 0x0201f800,
-+ 0x00105ec5, 0x02000800, 0x001060ac, 0x805cb800,
-+ 0x825c0580, 0x0010abf0, 0x040207f3, 0x59866003,
-+ 0x813261c0, 0x0400000b, 0x59300406, 0x82000580,
-+ 0x00000009, 0x02020800, 0x001004ef, 0x5930b800,
-+ 0x0201f800, 0x00105ea8, 0x405e6000, 0x0401f7f5,
-+ 0x497b0803, 0x4200b800, 0x0010ace8, 0x505e6000,
-+ 0x813261c0, 0x04000011, 0x59300406, 0x82000580,
-+ 0x00000009, 0x0402000d, 0x59300203, 0x82000580,
-+ 0x00000004, 0x04020009, 0x59326809, 0x813669c0,
-+ 0x02020800, 0x001004ef, 0x0201f800, 0x00100ddd,
-+ 0x0201f800, 0x00105ea8, 0x4578b800, 0x805cb800,
-+ 0x825c0580, 0x0010acf0, 0x040207e9, 0x42000800,
-+ 0x0010ace6, 0x49780801, 0x49780800, 0x0201f800,
-+ 0x00105fec, 0x0201f800, 0x00105ffd, 0x5c00b800,
-+ 0x0201f800, 0x00105d9b, 0x0201f000, 0x00101e8d,
-+ 0x836c0580, 0x00000003, 0x04000005, 0x4a034406,
-+ 0x00000007, 0x0201f000, 0x00101ed9, 0x59a00407,
-+ 0x59a00a07, 0x900409c0, 0x80040d40, 0x4805d807,
-+ 0x59a00409, 0x59a00a09, 0x900409c0, 0x80040d40,
-+ 0x4805d808, 0x4a01d801, 0x00000000, 0x0401f95b,
-+ 0x04020005, 0x4a034406, 0x00000002, 0x0201f000,
-+ 0x00101ed9, 0x417a8800, 0x497b4001, 0x832c0400,
-+ 0x00000004, 0x48034002, 0x4c5c0000, 0x4c600000,
-+ 0x4c640000, 0x4178b800, 0x4178c800, 0x59a0c002,
-+ 0x41440000, 0x81ac0400, 0x50026800, 0x813669c0,
-+ 0x0400000d, 0x0201f800, 0x00104719, 0x0402000a,
-+ 0x8c64cd3e, 0x04020006, 0x59340002, 0x4800c000,
-+ 0x4944c001, 0x8260c400, 0x00000002, 0x825cbc00,
-+ 0x00000008, 0x81468800, 0x83440480, 0x00000800,
-+ 0x04021021, 0x825c0480, 0x00000040, 0x04021002,
-+ 0x0401f7e8, 0x59a00001, 0x805c0400, 0x48034001,
-+ 0x8c64cd3e, 0x04000003, 0x4178b800, 0x0401f7e1,
-+ 0x59a00a0a, 0x800409c0, 0x04000006, 0x80040480,
-+ 0x04021004, 0x4178b800, 0x8464cd7e, 0x0401f7d9,
-+ 0x49474000, 0x485dd805, 0x59a00002, 0x4801d803,
-+ 0x40ec1000, 0x0201f800, 0x0010079e, 0x4a01d809,
-+ 0x001035d1, 0x5c00c800, 0x5c00c000, 0x5c00b800,
-+ 0x1c01f000, 0x8c64cd3e, 0x0402001b, 0x805cb9c0,
-+ 0x04000025, 0x59a00001, 0x805c0400, 0x48034001,
-+ 0x59a00a0a, 0x800409c0, 0x04000005, 0x80040480,
-+ 0x04021003, 0x4178b800, 0x0401f00f, 0x59a00801,
-+ 0x80040906, 0x48074406, 0x485dd805, 0x59a00002,
-+ 0x4801d803, 0x4a01d809, 0x00101e86, 0x40ec1000,
-+ 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x0201f000,
-+ 0x0010079e, 0x59a00001, 0x805c0c00, 0x59a0020a,
-+ 0x80040480, 0x48034207, 0x4a034406, 0x0000000a,
-+ 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x0201f000,
-+ 0x00101ed9, 0x59a00801, 0x80040906, 0x48074406,
-+ 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x0201f000,
-+ 0x00101e8d, 0x4031d800, 0x58ef400b, 0x58ec0002,
-+ 0x82000580, 0x00000200, 0x02000000, 0x00101ed1,
-+ 0x59a28800, 0x0401f78d, 0x8d0e1d0e, 0x04000005,
-+ 0x4a034406, 0x00000001, 0x0201f000, 0x00101ed9,
-+ 0x59a80023, 0x8c00050a, 0x04020007, 0x8c000506,
- 0x04020005, 0x4a034406, 0x00000016, 0x0201f000,
-- 0x001020b2, 0x0401f8cd, 0x04020005, 0x4a034406,
-- 0x00000002, 0x0201f000, 0x001020b2, 0x59a00c06,
-+ 0x00101ed9, 0x0401f8cd, 0x04020005, 0x4a034406,
-+ 0x00000002, 0x0201f000, 0x00101ed9, 0x59a00c06,
- 0x80040902, 0x59a00407, 0x59a01207, 0x900811c0,
- 0x80081540, 0x59a00409, 0x59a01a09, 0x900c19c0,
- 0x800c1d40, 0x832c0400, 0x00000005, 0x0401f8df,
-- 0x4a01d809, 0x00103763, 0x1c01f000, 0x4031d800,
-+ 0x4a01d809, 0x001035ff, 0x1c01f000, 0x4031d800,
- 0x58ef400b, 0x58ee580d, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x592c0009,
-- 0x0201f800, 0x001059b9, 0x02000800, 0x001043fc,
-- 0x02020000, 0x001020b6, 0x49474001, 0x481a6802,
-+ 0x00000200, 0x02000000, 0x00101ed1, 0x592c0009,
-+ 0x0201f800, 0x00105854, 0x02000800, 0x001042b1,
-+ 0x02020000, 0x00101edd, 0x49474001, 0x481a6802,
- 0x592c000a, 0x82001d80, 0x70000000, 0x04020007,
- 0x0401f8a2, 0x04020011, 0x4a034406, 0x00000002,
-- 0x0201f000, 0x001020b2, 0x82001d80, 0x72000000,
-- 0x02020000, 0x001020b6, 0x0401f898, 0x04020897,
-+ 0x0201f000, 0x00101ed9, 0x82001d80, 0x72000000,
-+ 0x02020000, 0x00101edd, 0x0401f898, 0x04020897,
- 0x04020896, 0x04020005, 0x4a034406, 0x00000002,
-- 0x0201f000, 0x001020b2, 0x58ee580d, 0x4a025c04,
-+ 0x0201f000, 0x00101ed9, 0x58ee580d, 0x4a025c04,
- 0x00008000, 0x497a5a04, 0x592c3208, 0x80183102,
- 0x592c1801, 0x4a001805, 0x01000000, 0x0201f800,
-- 0x00108e8e, 0x04020005, 0x4a034406, 0x00000003,
-- 0x0201f000, 0x001020b2, 0x4a01d809, 0x0010379d,
-+ 0x001088e5, 0x04020005, 0x4a034406, 0x00000003,
-+ 0x0201f000, 0x00101ed9, 0x4a01d809, 0x00103639,
- 0x1c01f000, 0x592c4000, 0x592c0005, 0x82000580,
- 0x01000000, 0x04020005, 0x4a034406, 0x00000004,
-- 0x0201f000, 0x001020b2, 0x4c580000, 0x4c500000,
-+ 0x0201f000, 0x00101ed9, 0x4c580000, 0x4c500000,
- 0x4c540000, 0x832c3c00, 0x00000005, 0x401ca000,
- 0x401ca800, 0x5820280a, 0x4200b000, 0x00000002,
- 0x82143580, 0x70000000, 0x04000003, 0x4200b000,
-- 0x0000000f, 0x0201f800, 0x0010a94f, 0x5c00a800,
-+ 0x0000000f, 0x0201f800, 0x0010a341, 0x5c00a800,
- 0x5c00a000, 0x5c00b000, 0x401c0000, 0x58201006,
- 0x58201807, 0x58202205, 0x80102102, 0x82143580,
- 0x70000000, 0x04020008, 0x82103480, 0x00000002,
-- 0x02001000, 0x001020b6, 0x42000800, 0x00000002,
-+ 0x02001000, 0x00101edd, 0x42000800, 0x00000002,
- 0x0401f079, 0x82143580, 0x72000000, 0x02020000,
-- 0x001020b6, 0x82103480, 0x0000002a, 0x02001000,
-- 0x001020b6, 0x42000800, 0x0000000f, 0x0401f86e,
-- 0x4a01d809, 0x001037d7, 0x1c01f000, 0x4031d800,
-+ 0x00101edd, 0x82103480, 0x0000002a, 0x02001000,
-+ 0x00101edd, 0x42000800, 0x0000000f, 0x0401f86e,
-+ 0x4a01d809, 0x00103673, 0x1c01f000, 0x4031d800,
- 0x58ef400b, 0x58ee580e, 0x58ec0002, 0x82000580,
-- 0x00000200, 0x02000000, 0x001020aa, 0x592e5800,
-+ 0x00000200, 0x02000000, 0x00101ed1, 0x592e5800,
- 0x832c0c00, 0x00000005, 0x4c580000, 0x4c500000,
- 0x4c540000, 0x4004a000, 0x4004a800, 0x4200b000,
-- 0x0000000f, 0x0201f800, 0x0010a94f, 0x5c00a800,
-+ 0x0000000f, 0x0201f800, 0x0010a341, 0x5c00a800,
- 0x5c00a000, 0x5c00b000, 0x40ec1000, 0x4a001001,
-- 0x00000000, 0x4a001004, 0x0000000f, 0x48041003,
-- 0x0201f800, 0x001008a1, 0x4a01d809, 0x001037f9,
-+ 0x00000000, 0x4a001005, 0x0000003c, 0x48041003,
-+ 0x0201f800, 0x0010079e, 0x4a01d809, 0x00103695,
- 0x1c01f000, 0x4031d800, 0x58ef400b, 0x58ee580e,
- 0x58ec0002, 0x82000580, 0x00000200, 0x02000000,
-- 0x001020aa, 0x832c0c00, 0x00000005, 0x4c580000,
-+ 0x00101ed1, 0x832c0c00, 0x00000005, 0x4c580000,
- 0x4c500000, 0x4c540000, 0x4004a000, 0x4004a800,
-- 0x4200b000, 0x0000000c, 0x0201f800, 0x0010a94f,
-+ 0x4200b000, 0x0000000c, 0x0201f800, 0x0010a341,
- 0x5c00a800, 0x5c00a000, 0x5c00b000, 0x40ec1000,
-- 0x4a001001, 0x00000000, 0x4a001004, 0x0000000c,
-- 0x48041003, 0x0201f800, 0x001008a1, 0x4a01d809,
-- 0x0010205f, 0x1c01f000, 0x0201f800, 0x0010082a,
-+ 0x4a001001, 0x00000000, 0x4a001005, 0x00000030,
-+ 0x48041003, 0x0201f800, 0x0010079e, 0x4a01d809,
-+ 0x00101e86, 0x1c01f000, 0x0201f800, 0x0010071a,
- 0x04000010, 0x497a5800, 0x58ec000d, 0x80000540,
- 0x04020004, 0x492dd80d, 0x492dd80e, 0x0401f007,
- 0x58ec000e, 0x48025800, 0x82000400, 0x00000001,
-@@ -3650,408 +3548,406 @@ uint32_t risc_code01[] = {
- 0x492fc857, 0x4803c857, 0x1c01f000, 0x4d2c0000,
- 0x58ec400d, 0x802041c0, 0x04000008, 0x4823c857,
- 0x40225800, 0x592c4001, 0x497a5801, 0x0201f800,
-- 0x0010083a, 0x0401f7f8, 0x4979d80d, 0x4979d80e,
-+ 0x0010072e, 0x0401f7f8, 0x4979d80d, 0x4979d80e,
- 0x5c025800, 0x1c01f000, 0x42003000, 0x00000001,
- 0x0401f003, 0x42003000, 0x00000000, 0x4803c857,
- 0x4807c857, 0x480bc857, 0x480fc857, 0x481bc857,
- 0x48efc857, 0x4819d801, 0x800409c0, 0x02000800,
-- 0x00100615, 0x4805d804, 0x4801d803, 0x4809d807,
-- 0x480dd808, 0x40ec1000, 0x0201f800, 0x001008a1,
-- 0x4a01d809, 0x0010205f, 0x1c01f000, 0x80002d80,
-- 0x480bc857, 0x480fc857, 0x4813c857, 0x4817c857,
-- 0x4d2c0000, 0x4da00000, 0x42034000, 0x0010b2a0,
-- 0x59a00017, 0x800001c0, 0x04020013, 0x04006012,
-- 0x480bc020, 0x480fc021, 0x4813c022, 0x4817c023,
-- 0x900811c0, 0x82081540, 0x00000012, 0x480bc011,
-- 0x59e00017, 0x8c000508, 0x04020004, 0x4203e000,
-- 0x30000001, 0x0401f053, 0x4a03c017, 0x00000002,
-- 0x0401f7fb, 0x4c040000, 0x4c1c0000, 0x80000800,
-- 0x48074017, 0x59a0381a, 0x481fc857, 0x801c39c0,
-- 0x04020027, 0x82000480, 0x0000000a, 0x04021010,
-- 0x59a00018, 0x80000000, 0x48034018, 0x59a00219,
-- 0x82000400, 0x00000002, 0x82000c80, 0x00000013,
-- 0x48034219, 0x04001003, 0x497b4219, 0x41780000,
-- 0x59a03816, 0x801c3c00, 0x0401f030, 0x4803c856,
-- 0x0201f800, 0x0010082a, 0x04000007, 0x492f401a,
-- 0x492f401b, 0x412c3800, 0x497b421c, 0x497a5813,
-- 0x0401f026, 0x59880052, 0x80000000, 0x48031052,
-- 0x59a00017, 0x80000040, 0x48034017, 0x59a00219,
-- 0x59a03816, 0x801c3c00, 0x0401f01c, 0x59a0021c,
-- 0x82000400, 0x00000002, 0x82000c80, 0x00000012,
-- 0x04021004, 0x4803421c, 0x801c3c00, 0x0401f013,
-- 0x0201f800, 0x0010082a, 0x0402000b, 0x59880052,
-- 0x80000000, 0x48031052, 0x59a00017, 0x80000040,
-- 0x48034017, 0x4803c856, 0x59a0021c, 0x801c3c00,
-- 0x0401f006, 0x492f401a, 0x492c3813, 0x412c3800,
-- 0x497b421c, 0x497a5813, 0x48083c00, 0x480c3a00,
-- 0x48103c01, 0x48143a01, 0x5c003800, 0x5c000800,
-- 0x5c034000, 0x5c025800, 0x1c01f000, 0x480fc857,
-- 0x4813c857, 0x481bc857, 0x42000000, 0x0010b611,
-- 0x0201f800, 0x0010a86e, 0x801800d0, 0x40002800,
-- 0x42001000, 0x00008014, 0x0401f786, 0x4c000000,
-- 0x599c0017, 0x8c000512, 0x5c000000, 0x1c01f000,
-- 0x4c000000, 0x599c0018, 0x8c00050e, 0x5c000000,
-- 0x1c01f000, 0x59a80821, 0x800409c0, 0x04000005,
-- 0x4a034406, 0x00000001, 0x0201f000, 0x001020b2,
-+ 0x001004ef, 0x800408c4, 0x4805d805, 0x4801d803,
-+ 0x4809d807, 0x480dd808, 0x40ec1000, 0x0201f800,
-+ 0x0010079e, 0x4a01d809, 0x00101e86, 0x1c01f000,
-+ 0x80002d80, 0x480bc857, 0x480fc857, 0x4813c857,
-+ 0x4817c857, 0x4d2c0000, 0x4da00000, 0x42034000,
-+ 0x0010ac71, 0x59a00017, 0x800001c0, 0x04020013,
-+ 0x04006012, 0x480bc020, 0x480fc021, 0x4813c022,
-+ 0x4817c023, 0x900811c0, 0x82081540, 0x00000012,
-+ 0x480bc011, 0x59e00017, 0x8c000508, 0x04020004,
-+ 0x4203e000, 0x30000001, 0x0401f053, 0x4a03c017,
-+ 0x00000002, 0x0401f7fb, 0x4c040000, 0x4c1c0000,
-+ 0x80000800, 0x48074017, 0x59a0381a, 0x481fc857,
-+ 0x801c39c0, 0x04020027, 0x82000480, 0x0000000a,
-+ 0x04021010, 0x59a00018, 0x80000000, 0x48034018,
-+ 0x59a00219, 0x82000400, 0x00000002, 0x82000c80,
-+ 0x00000013, 0x48034219, 0x04001003, 0x497b4219,
-+ 0x41780000, 0x59a03816, 0x801c3c00, 0x0401f030,
-+ 0x4803c856, 0x0201f800, 0x0010071a, 0x04000007,
-+ 0x492f401a, 0x492f401b, 0x412c3800, 0x497b421c,
-+ 0x497a5813, 0x0401f026, 0x59880052, 0x80000000,
-+ 0x48031052, 0x59a00017, 0x80000040, 0x48034017,
-+ 0x59a00219, 0x59a03816, 0x801c3c00, 0x0401f01c,
-+ 0x59a0021c, 0x82000400, 0x00000002, 0x82000c80,
-+ 0x00000012, 0x04021004, 0x4803421c, 0x801c3c00,
-+ 0x0401f013, 0x0201f800, 0x0010071a, 0x0402000b,
-+ 0x59880052, 0x80000000, 0x48031052, 0x59a00017,
-+ 0x80000040, 0x48034017, 0x4803c856, 0x59a0021c,
-+ 0x801c3c00, 0x0401f006, 0x492f401a, 0x492c3813,
-+ 0x412c3800, 0x497b421c, 0x497a5813, 0x48083c00,
-+ 0x480c3a00, 0x48103c01, 0x48143a01, 0x5c003800,
-+ 0x5c000800, 0x5c034000, 0x5c025800, 0x1c01f000,
-+ 0x480fc857, 0x4813c857, 0x481bc857, 0x42000000,
-+ 0x0010afe1, 0x0201f800, 0x0010a260, 0x801800d0,
-+ 0x40002800, 0x42001000, 0x00008014, 0x0401f786,
-+ 0x4c000000, 0x599c0017, 0x8c000512, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x599c0018, 0x8c00050e,
-+ 0x5c000000, 0x1c01f000, 0x8d0e1d0e, 0x04000005,
-+ 0x4a034406, 0x00000001, 0x0201f000, 0x00101ed9,
- 0x836c0580, 0x00000003, 0x04000005, 0x4a034406,
-- 0x00000007, 0x0201f000, 0x001020b2, 0x599c0017,
-+ 0x00000007, 0x0201f000, 0x00101ed9, 0x599c0017,
- 0x8c00050a, 0x04000005, 0x4a034406, 0x00000008,
-- 0x0201f000, 0x001020b2, 0x59340405, 0x8c000508,
-- 0x04020004, 0x8c00050a, 0x02020000, 0x001032e2,
-+ 0x0201f000, 0x00101ed9, 0x59340405, 0x8c000508,
-+ 0x04020004, 0x8c00050a, 0x02020000, 0x00103104,
- 0x497a5a04, 0x497a5805, 0x4a025c04, 0x00008000,
-- 0x0201f800, 0x00108f2d, 0x04020005, 0x4a034406,
-- 0x00000003, 0x0201f000, 0x001020b2, 0x4a01d809,
-- 0x00103906, 0x1c01f000, 0x592c0005, 0x82000580,
-+ 0x0201f800, 0x00108991, 0x04020005, 0x4a034406,
-+ 0x00000003, 0x0201f000, 0x00101ed9, 0x4a01d809,
-+ 0x001037a2, 0x1c01f000, 0x592c0005, 0x82000580,
- 0x01000000, 0x04020005, 0x4a034406, 0x00000004,
-- 0x0201f000, 0x001020b2, 0x59a28c06, 0x0201f800,
-- 0x00020267, 0x02020000, 0x001020b6, 0x0201f000,
-- 0x001032e2, 0x82001580, 0x0000ffff, 0x04000009,
-- 0x0201f800, 0x001059b9, 0x02000800, 0x00020267,
-- 0x0402000c, 0x0201f800, 0x00105ce7, 0x0401f009,
-- 0x42028800, 0x000007ef, 0x0201f800, 0x00020267,
-- 0x02000800, 0x00105ce7, 0x81468840, 0x040217fb,
-+ 0x0201f000, 0x00101ed9, 0x59a28c06, 0x0201f800,
-+ 0x0002025a, 0x02020000, 0x00101edd, 0x0201f000,
-+ 0x00103104, 0x82001580, 0x0000ffff, 0x04000009,
-+ 0x0201f800, 0x00105854, 0x02000800, 0x0002025a,
-+ 0x0402000c, 0x0201f800, 0x00105b8d, 0x0401f009,
-+ 0x42028800, 0x000007ef, 0x0201f800, 0x0002025a,
-+ 0x02000800, 0x00105b8d, 0x81468840, 0x040217fb,
- 0x1c01f000, 0x4803c856, 0x4c0c0000, 0x4d340000,
- 0x4d440000, 0x42028800, 0x000007fe, 0x0201f800,
-- 0x00020267, 0x04020009, 0x5934180a, 0x820c1d00,
-+ 0x0002025a, 0x04020009, 0x5934180a, 0x820c1d00,
- 0x00000001, 0x820c1d80, 0x00000001, 0x42001000,
-- 0x0000801b, 0x0401ff1e, 0x5c028800, 0x5c026800,
-- 0x5c001800, 0x1c01f000, 0x599c0017, 0x8c000508,
-- 0x1c01f000, 0x48efc857, 0x04011000, 0x48efc840,
-- 0x4a03c842, 0x00000011, 0x40000000, 0x040117ff,
-- 0x4a01d80f, 0xbeefbeef, 0x1c01f000, 0x497b4000,
-- 0x497b4001, 0x497b4002, 0x497b4003, 0x497b4004,
-- 0x1c01f000, 0x59c400a4, 0x4c580000, 0x4c500000,
-- 0x4c540000, 0x82000500, 0x0000000f, 0x82000480,
-- 0x00000007, 0x0400100a, 0x82006c80, 0x00000007,
-- 0x02021800, 0x00100615, 0x0c01f807, 0x5c00a800,
-- 0x5c00a000, 0x5c00b000, 0x1c01f000, 0x0401f90c,
-- 0x0401f7fb, 0x0010396c, 0x00103972, 0x00103997,
-- 0x001039b9, 0x00103a78, 0x0010396b, 0x1c01f000,
-- 0x59c40806, 0x8c040d00, 0x04020003, 0x84040d40,
-- 0x48078806, 0x1c01f000, 0x59c40005, 0x8c000534,
-- 0x02020000, 0x001040ce, 0x4a038805, 0xffffffff,
-- 0x42006000, 0x00020000, 0x0201f800, 0x001040b2,
-- 0x59a80015, 0x82000500, 0xfffffffa, 0x84000542,
-- 0x48035015, 0x497b5026, 0x42000800, 0x0010bc20,
-- 0x45780800, 0x497b5013, 0x42006000, 0xffefffff,
-- 0x42006800, 0x40000000, 0x0201f800, 0x001040ad,
-- 0x59c40006, 0x82000500, 0xffffff0f, 0x48038806,
-- 0x42000800, 0x00000010, 0x42001000, 0x0010401b,
-- 0x0201f800, 0x00105cbc, 0x0401f001, 0x42006000,
-- 0xffffffff, 0x42006800, 0x00800000, 0x0201f800,
-- 0x001040ad, 0x4200b000, 0x000000c8, 0x59c400a4,
-- 0x82000500, 0x0000000f, 0x82000580, 0x0000000a,
-- 0x0400000f, 0x8058b040, 0x040207f9, 0x497b5014,
-- 0x42006000, 0xbf7fffff, 0x42006800, 0x00018000,
-- 0x0201f800, 0x001040ad, 0x42006000, 0xfffeffff,
-- 0x41786800, 0x0201f000, 0x001040ad, 0x497b5014,
-- 0x4a035012, 0x00000000, 0x80000580, 0x0201f000,
-- 0x001040b9, 0x4a038805, 0xffffffff, 0x59a80012,
-- 0x82000c80, 0x00000004, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x001039c4, 0x001039f1, 0x00103a6e,
-- 0x4803c856, 0x59c400a3, 0x8400051e, 0x480388a3,
-- 0x4a035012, 0x00000001, 0x59c40008, 0x8400054e,
-- 0x48038808, 0x0201f800, 0x00104093, 0x42007800,
-- 0x0010b34a, 0x4a007806, 0x11010000, 0x4200a000,
-- 0x0010b202, 0x4200a800, 0x0010b351, 0x4200b000,
-- 0x00000002, 0x0201f800, 0x0010a93e, 0x497b8802,
-- 0x42000800, 0x00000003, 0x497b504a, 0x0201f800,
-- 0x00103f8e, 0x4a03504a, 0x00000001, 0x497b5016,
-- 0x0201f800, 0x001040c0, 0x42006000, 0xffffffff,
-- 0x42006800, 0x00080000, 0x0201f800, 0x001040ad,
-- 0x42006000, 0xfff7ffff, 0x41786800, 0x0201f000,
-- 0x001040ad, 0x59a80016, 0x497b5016, 0x80002540,
-- 0x0400006a, 0x59c40004, 0x82000500, 0x00000003,
-- 0x04020075, 0x59a80815, 0x8c040d02, 0x0400004f,
-- 0x82100580, 0x0000000c, 0x04020053, 0x82100400,
-- 0x00000018, 0x8000b104, 0x41cc1000, 0x42001800,
-- 0x0010b34a, 0x50080800, 0x500c0000, 0x80040580,
-- 0x0402001e, 0x80081000, 0x800c1800, 0x8058b040,
-- 0x040207f9, 0x0201f800, 0x001040c0, 0x42006000,
-- 0xffffffff, 0x42006800, 0x00500000, 0x0201f800,
-- 0x001040ad, 0x4a035012, 0x00000002, 0x4a035014,
-- 0x00000002, 0x0201f800, 0x0010164b, 0x42000800,
-- 0x000007d0, 0x42001000, 0x00103f62, 0x0201f800,
-- 0x00105da7, 0x59a80015, 0x84000506, 0x48035015,
-- 0x0201f000, 0x00104093, 0x59cc0806, 0x82040d80,
-- 0x11010000, 0x04020028, 0x59cc0800, 0x82040500,
-- 0x00ffffff, 0x0400001a, 0x82000580, 0x000000ef,
-- 0x04020017, 0x59cc0801, 0x82040500, 0x00ffffff,
-- 0x82000580, 0x000000ef, 0x04020011, 0x83cca400,
-- 0x00000007, 0x4200a800, 0x0010b202, 0x4200b000,
-- 0x00000002, 0x50500800, 0x50540000, 0x80040480,
-- 0x04001007, 0x04020010, 0x8050a000, 0x8054a800,
-- 0x8058b040, 0x040207f8, 0x0401f00b, 0x59a80015,
-- 0x84000502, 0x48035015, 0x41cca000, 0x4200a800,
-- 0x0010b34a, 0x4200b000, 0x00000009, 0x0201f800,
-- 0x0010a93e, 0x0201f800, 0x001040c0, 0x42006000,
-+ 0x0000801b, 0x0401ff1f, 0x5c028800, 0x5c026800,
-+ 0x5c001800, 0x1c01f000, 0x48efc857, 0x04011000,
-+ 0x48efc840, 0x4a03c842, 0x00000011, 0x40000000,
-+ 0x040117ff, 0x4a01d80f, 0xbeefbeef, 0x1c01f000,
-+ 0x497b4000, 0x497b4001, 0x497b4002, 0x497b4003,
-+ 0x497b4004, 0x1c01f000, 0x59c400a4, 0x4c580000,
-+ 0x4c500000, 0x4c540000, 0x82000500, 0x0000000f,
-+ 0x82000480, 0x00000007, 0x0400100a, 0x82006c80,
-+ 0x00000007, 0x02021800, 0x001004ef, 0x0c01f807,
-+ 0x5c00a800, 0x5c00a000, 0x5c00b000, 0x1c01f000,
-+ 0x0401f90c, 0x0401f7fb, 0x00103805, 0x0010380b,
-+ 0x00103830, 0x00103852, 0x00103911, 0x00103804,
-+ 0x1c01f000, 0x59c40806, 0x8c040d00, 0x04020003,
-+ 0x84040d40, 0x48078806, 0x1c01f000, 0x59c40005,
-+ 0x8c000534, 0x02020000, 0x00103f66, 0x4a038805,
-+ 0xffffffff, 0x42006000, 0x00020000, 0x0201f800,
-+ 0x00103f4a, 0x59a80014, 0x82000500, 0xfffffffa,
-+ 0x84000542, 0x48035014, 0x497b5023, 0x42000800,
-+ 0x0010b5f0, 0x45780800, 0x497b5012, 0x42006000,
-+ 0xffefffff, 0x42006800, 0x40000000, 0x0201f800,
-+ 0x00103f44, 0x59c40006, 0x82000500, 0xffffff0f,
-+ 0x48038806, 0x42000800, 0x00000010, 0x42001000,
-+ 0x00103eab, 0x0201f800, 0x00105b62, 0x0401f001,
-+ 0x42006000, 0xffffffff, 0x42006800, 0x00800000,
-+ 0x0201f800, 0x00103f44, 0x4200b000, 0x000000c8,
-+ 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
-+ 0x0000000a, 0x0400000f, 0x8058b040, 0x040207f9,
-+ 0x497b5013, 0x42006000, 0xbf7fffff, 0x42006800,
-+ 0x00018000, 0x0201f800, 0x00103f44, 0x42006000,
-+ 0xfffeffff, 0x41786800, 0x0201f000, 0x00103f44,
-+ 0x497b5013, 0x4a035011, 0x00000000, 0x80000580,
-+ 0x0201f000, 0x00103f51, 0x4a038805, 0xffffffff,
-+ 0x59a80011, 0x82000c80, 0x00000004, 0x02021800,
-+ 0x001004ef, 0x0c01f001, 0x0010385d, 0x0010388a,
-+ 0x00103907, 0x4803c856, 0x59c400a3, 0x8400051e,
-+ 0x480388a3, 0x4a035011, 0x00000001, 0x59c40008,
-+ 0x8400054e, 0x48038808, 0x0201f800, 0x00103f28,
-+ 0x42007800, 0x0010ad1a, 0x4a007806, 0x11010000,
-+ 0x4200a000, 0x0010ac02, 0x4200a800, 0x0010ad21,
-+ 0x4200b000, 0x00000002, 0x0201f800, 0x0010a330,
-+ 0x497b8802, 0x42000800, 0x00000003, 0x497b5047,
-+ 0x0201f800, 0x00103e1e, 0x4a035047, 0x00000001,
-+ 0x497b5015, 0x0201f800, 0x00103f58, 0x42006000,
- 0xffffffff, 0x42006800, 0x00080000, 0x0201f800,
-- 0x001040ad, 0x42006000, 0xfff7ffff, 0x41786800,
-- 0x0201f800, 0x001040ad, 0x42006000, 0xffffffff,
-- 0x42006800, 0x00004000, 0x0201f800, 0x001040ad,
-- 0x59c40004, 0x82000500, 0x00000003, 0x04020006,
-- 0x497b5016, 0x42000800, 0x00000003, 0x0201f000,
-- 0x00103f8e, 0x1c01f000, 0x1c01f000, 0x59a80014,
-- 0x82006d80, 0x0000000f, 0x04000005, 0x82000580,
-- 0x0000001b, 0x02020800, 0x00103f53, 0x1c01f000,
-- 0x59a80015, 0x84000506, 0x48035015, 0x497b504a,
-- 0x59a80014, 0x82000c80, 0x0000001e, 0x02021800,
-- 0x00100615, 0x0c01f001, 0x00103ab6, 0x00103acd,
-- 0x00103af6, 0x00103b11, 0x00103b34, 0x00103b65,
-- 0x00103b87, 0x00103bba, 0x00103bdc, 0x00103c00,
-- 0x00103c3c, 0x00103c63, 0x00103c79, 0x00103c8b,
-- 0x00103ca3, 0x00103cba, 0x00103cbf, 0x00103ce7,
-- 0x00103d0a, 0x00103d30, 0x00103d53, 0x00103d86,
-- 0x00103dc8, 0x00103df2, 0x00103e0a, 0x00103e4a,
-- 0x00103e63, 0x00103e76, 0x00103e77, 0x4803c856,
-- 0x4202d800, 0x00000007, 0x0201f800, 0x00104e0d,
-- 0x04000007, 0x42006000, 0xffffffd7, 0x41786800,
-- 0x0201f800, 0x001040ad, 0x0401f00b, 0x59c40006,
-- 0x82000500, 0xffffff0f, 0x48038806, 0x42001000,
-- 0x000000f0, 0x0201f800, 0x001019aa, 0x0201f800,
-- 0x00104d6c, 0x1c01f000, 0x4803c856, 0x42006000,
-- 0xbf7fffff, 0x42006800, 0x00400000, 0x0201f800,
-- 0x001040ad, 0x0201f800, 0x0010164b, 0x4a035014,
-- 0x00000001, 0x42001000, 0x0010401b, 0x0201f800,
-- 0x00105cdd, 0x0201f800, 0x00104024, 0x42000800,
-- 0x000007d0, 0x42001000, 0x00103f62, 0x0201f000,
-- 0x00105da7, 0x59a80016, 0x82000580, 0x00000014,
-- 0x04020023, 0x4803c857, 0x42006000, 0xffbfffff,
-- 0x41786800, 0x0201f800, 0x001040ad, 0x59c40004,
-- 0x82000500, 0x00000003, 0x04020019, 0x42001000,
-- 0x00103f62, 0x0201f800, 0x00105cc9, 0x59cc1006,
-- 0x82081580, 0x11020000, 0x04020012, 0x59cc1007,
-- 0x8c08153e, 0x0400000b, 0x59a80015, 0x8c000504,
-- 0x04020008, 0x42000000, 0x0010b63d, 0x0201f800,
-- 0x0010a86e, 0x59a80015, 0x84000544, 0x48035015,
-- 0x4a035014, 0x00000010, 0x0401f1cd, 0x1c01f000,
-- 0x0201f000, 0x00103f53, 0x4803c856, 0x4a035014,
-- 0x00000003, 0x42006000, 0xbf3fffff, 0x42006800,
-- 0x00100000, 0x0201f800, 0x001040ad, 0x42001000,
-- 0x0010401b, 0x0201f800, 0x00105cdd, 0x0201f800,
-- 0x00104024, 0x42001000, 0x00103f62, 0x0201f800,
-- 0x00105cc9, 0x42007800, 0x0010b350, 0x46007800,
-- 0x11020000, 0x42000800, 0x00000005, 0x0201f000,
-- 0x00103f8e, 0x59a80016, 0x80000540, 0x0400001e,
-- 0x4803c857, 0x42001000, 0x00103f62, 0x0201f800,
-- 0x00105cc9, 0x59a80016, 0x82000580, 0x00000014,
-- 0x04020016, 0x59cc1006, 0x82081580, 0x11020000,
-- 0x04020012, 0x59cc1007, 0x8c08153e, 0x0400000b,
-- 0x59a80015, 0x8c000504, 0x04020008, 0x42000000,
-- 0x0010b63d, 0x0201f800, 0x0010a86e, 0x59a80015,
-- 0x84000544, 0x48035015, 0x4a035014, 0x00000004,
-- 0x0401f004, 0x1c01f000, 0x0201f000, 0x00103f53,
-- 0x4803c856, 0x4a035014, 0x00000005, 0x83cca400,
-- 0x00000006, 0x4200a800, 0x0010b350, 0x4200b000,
-- 0x00000005, 0x0201f800, 0x0010a93e, 0x42007800,
-- 0x0010b350, 0x46007800, 0x11030000, 0x0201f800,
-- 0x00103f58, 0x04020014, 0x59a80015, 0x8c000500,
-- 0x04020011, 0x59a80810, 0x82040580, 0x00ffffff,
-- 0x0400000d, 0x82040d00, 0x000000ff, 0x82040400,
-- 0x00101eb5, 0x50000800, 0x80040910, 0x42001000,
-- 0x00000004, 0x0401fb95, 0x0400000b, 0x0201f800,
-- 0x0010403d, 0x4200b000, 0x00000004, 0x83cca400,
-- 0x00000007, 0x4200a800, 0x0010b351, 0x0201f800,
-- 0x0010a93e, 0x42000800, 0x00000005, 0x0201f000,
-- 0x00103f8e, 0x59a80016, 0x80000540, 0x0400001e,
-- 0x4803c857, 0x42001000, 0x00103f62, 0x0201f800,
-- 0x00105cc9, 0x59a80016, 0x82000580, 0x00000014,
-- 0x04020016, 0x59cc1006, 0x82081580, 0x11030000,
-- 0x04020012, 0x59cc1007, 0x8c08153e, 0x0400000b,
-- 0x59a80015, 0x8c000504, 0x04020008, 0x42000000,
-- 0x0010b63d, 0x0201f800, 0x0010a86e, 0x59a80015,
-- 0x84000544, 0x48035015, 0x4a035014, 0x00000006,
-- 0x0401f003, 0x1c01f000, 0x0401f3cd, 0x4803c856,
-- 0x4a035014, 0x00000007, 0x83cca400, 0x00000006,
-- 0x4200a800, 0x0010b350, 0x4200b000, 0x00000005,
-- 0x0201f800, 0x0010a93e, 0x42007800, 0x0010b350,
-- 0x46007800, 0x11040000, 0x0401fbc2, 0x04020020,
-- 0x59a80015, 0x8c000500, 0x0402001d, 0x599c0017,
-- 0x8c000500, 0x0400001a, 0x599c1402, 0x82080480,
-- 0x0000007f, 0x02021800, 0x00100615, 0x4c080000,
-- 0x82081400, 0x00101eb5, 0x50081000, 0x82081500,
-- 0x000000ff, 0x480b5010, 0x42000800, 0x00000003,
-- 0x0201f800, 0x001069af, 0x5c000800, 0x42001000,
-- 0x00000004, 0x0401fb39, 0x04000005, 0x0401fd25,
-- 0x04000003, 0x0201f800, 0x00101668, 0x42000800,
-- 0x00000005, 0x0401f3d5, 0x59a80016, 0x80000540,
-- 0x0400001e, 0x4803c857, 0x42001000, 0x00103f62,
-- 0x0201f800, 0x00105cc9, 0x59a80016, 0x82000580,
-- 0x00000014, 0x04020016, 0x59cc1006, 0x82081580,
-- 0x11040000, 0x04020012, 0x59cc1007, 0x8c08153e,
-- 0x0400000b, 0x59a80015, 0x8c000504, 0x04020008,
-- 0x42000000, 0x0010b63d, 0x0201f800, 0x0010a86e,
-- 0x59a80015, 0x84000544, 0x48035015, 0x4a035014,
-- 0x00000008, 0x0401f003, 0x1c01f000, 0x0401f378,
-- 0x4803c856, 0x4a035014, 0x00000009, 0x83cca400,
-- 0x00000006, 0x4200a800, 0x0010b350, 0x4200b000,
-- 0x00000005, 0x0201f800, 0x0010a93e, 0x42007800,
-- 0x0010b350, 0x46007800, 0x11050100, 0x0401fb6d,
-- 0x0402000a, 0x59a80015, 0x8c000500, 0x04020007,
-- 0x0401fa88, 0x04020005, 0x82000540, 0x00000001,
-- 0x0201f800, 0x00101668, 0x42000800, 0x00000005,
-- 0x0401fb96, 0x4d3c0000, 0x42027800, 0x00000001,
-- 0x0201f800, 0x00109640, 0x5c027800, 0x1c01f000,
-- 0x59a80016, 0x80000540, 0x04000038, 0x4803c857,
-- 0x42001000, 0x00103f62, 0x0201f800, 0x00105cc9,
-- 0x59a80016, 0x82000580, 0x00000014, 0x04020030,
-+ 0x00103f44, 0x42006000, 0xfff7ffff, 0x41786800,
-+ 0x0201f000, 0x00103f44, 0x59a80015, 0x497b5015,
-+ 0x80002540, 0x0400006a, 0x59c40004, 0x82000500,
-+ 0x00000003, 0x04020075, 0x59a80814, 0x8c040d02,
-+ 0x0400004f, 0x82100580, 0x0000000c, 0x04020053,
-+ 0x82100400, 0x00000018, 0x8000b104, 0x41cc1000,
-+ 0x42001800, 0x0010ad1a, 0x50080800, 0x500c0000,
-+ 0x80040580, 0x0402001e, 0x80081000, 0x800c1800,
-+ 0x8058b040, 0x040207f9, 0x0201f800, 0x00103f58,
-+ 0x42006000, 0xffffffff, 0x42006800, 0x00500000,
-+ 0x0201f800, 0x00103f44, 0x4a035011, 0x00000002,
-+ 0x4a035013, 0x00000002, 0x0201f800, 0x00101514,
-+ 0x42000800, 0x000007d0, 0x42001000, 0x00103df2,
-+ 0x0201f800, 0x00105c4d, 0x59a80014, 0x84000506,
-+ 0x48035014, 0x0201f000, 0x00103f28, 0x59cc0806,
-+ 0x82040d80, 0x11010000, 0x04020028, 0x59cc0800,
-+ 0x82040500, 0x00ffffff, 0x0400001a, 0x82000580,
-+ 0x000000ef, 0x04020017, 0x59cc0801, 0x82040500,
-+ 0x00ffffff, 0x82000580, 0x000000ef, 0x04020011,
-+ 0x83cca400, 0x00000007, 0x4200a800, 0x0010ac02,
-+ 0x4200b000, 0x00000002, 0x50500800, 0x50540000,
-+ 0x80040480, 0x04001007, 0x04020010, 0x8050a000,
-+ 0x8054a800, 0x8058b040, 0x040207f8, 0x0401f00b,
-+ 0x59a80014, 0x84000502, 0x48035014, 0x41cca000,
-+ 0x4200a800, 0x0010ad1a, 0x4200b000, 0x00000009,
-+ 0x0201f800, 0x0010a330, 0x0201f800, 0x00103f58,
-+ 0x42006000, 0xffffffff, 0x42006800, 0x00080000,
-+ 0x0201f800, 0x00103f44, 0x42006000, 0xfff7ffff,
-+ 0x41786800, 0x0201f800, 0x00103f44, 0x42006000,
-+ 0xffffffff, 0x42006800, 0x00004000, 0x0201f800,
-+ 0x00103f44, 0x59c40004, 0x82000500, 0x00000003,
-+ 0x04020006, 0x497b5015, 0x42000800, 0x00000003,
-+ 0x0201f000, 0x00103e1e, 0x1c01f000, 0x1c01f000,
-+ 0x59a80013, 0x82006d80, 0x0000000f, 0x04000005,
-+ 0x82000580, 0x0000001b, 0x02020800, 0x00103de7,
-+ 0x1c01f000, 0x59a80014, 0x84000506, 0x48035014,
-+ 0x497b5047, 0x59a80013, 0x82000c80, 0x0000001e,
-+ 0x02021800, 0x001004ef, 0x0c01f001, 0x0010394d,
-+ 0x00103964, 0x0010398d, 0x001039a8, 0x001039cb,
-+ 0x001039fb, 0x00103a1d, 0x00103a50, 0x00103a72,
-+ 0x00103a94, 0x00103ad0, 0x00103af7, 0x00103b0d,
-+ 0x00103b1f, 0x00103b37, 0x00103b4f, 0x00103b54,
-+ 0x00103b7c, 0x00103b9f, 0x00103bc5, 0x00103be8,
-+ 0x00103c1c, 0x00103c5e, 0x00103c86, 0x00103c9e,
-+ 0x00103cde, 0x00103cf7, 0x00103d0a, 0x00103d0b,
-+ 0x4803c856, 0x4202d800, 0x00000007, 0x0201f800,
-+ 0x00104ca6, 0x04000007, 0x42006000, 0xffffffd7,
-+ 0x41786800, 0x0201f800, 0x00103f44, 0x0401f009,
-+ 0x59c40006, 0x82000500, 0xffffff0f, 0x48038806,
-+ 0x4a038805, 0x000000f0, 0x0201f800, 0x00104c0c,
-+ 0x1c01f000, 0x4803c856, 0x42006000, 0xbf7fffff,
-+ 0x42006800, 0x00400000, 0x0201f800, 0x00103f44,
-+ 0x0201f800, 0x00101514, 0x4a035013, 0x00000001,
-+ 0x42001000, 0x00103eab, 0x0201f800, 0x00105b83,
-+ 0x0201f800, 0x00103eb4, 0x42000800, 0x000007d0,
-+ 0x42001000, 0x00103df2, 0x0201f000, 0x00105c4d,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020023,
-+ 0x4803c857, 0x42006000, 0xffbfffff, 0x41786800,
-+ 0x0201f800, 0x00103f44, 0x59c40004, 0x82000500,
-+ 0x00000003, 0x04020019, 0x42001000, 0x00103df2,
-+ 0x0201f800, 0x00105b6f, 0x59cc1006, 0x82081580,
-+ 0x11020000, 0x04020012, 0x59cc1007, 0x8c08153e,
-+ 0x0400000b, 0x59a80014, 0x8c000504, 0x04020008,
-+ 0x42000000, 0x0010b00d, 0x0201f800, 0x0010a260,
-+ 0x59a80014, 0x84000544, 0x48035014, 0x4a035013,
-+ 0x00000010, 0x0401f1cb, 0x1c01f000, 0x0201f000,
-+ 0x00103de7, 0x4803c856, 0x4a035013, 0x00000003,
-+ 0x42006000, 0xbf3fffff, 0x42006800, 0x00100000,
-+ 0x0201f800, 0x00103f44, 0x42001000, 0x00103eab,
-+ 0x0201f800, 0x00105b83, 0x0201f800, 0x00103eb4,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x42007800, 0x0010ad20, 0x46007800, 0x11020000,
-+ 0x42000800, 0x00000005, 0x0201f000, 0x00103e1e,
-+ 0x59a80015, 0x80000540, 0x0400001e, 0x4803c857,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020016,
-+ 0x59cc1006, 0x82081580, 0x11020000, 0x04020012,
-+ 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80014,
-+ 0x8c000504, 0x04020008, 0x42000000, 0x0010b00d,
-+ 0x0201f800, 0x0010a260, 0x59a80014, 0x84000544,
-+ 0x48035014, 0x4a035013, 0x00000004, 0x0401f004,
-+ 0x1c01f000, 0x0201f000, 0x00103de7, 0x4803c856,
-+ 0x4a035013, 0x00000005, 0x83cca400, 0x00000006,
-+ 0x4200a800, 0x0010ad20, 0x4200b000, 0x00000005,
-+ 0x0201f800, 0x0010a330, 0x42007800, 0x0010ad20,
-+ 0x46007800, 0x11030000, 0x8d0e1d06, 0x04020014,
-+ 0x59a80014, 0x8c000500, 0x04020011, 0x59a8080f,
-+ 0x82040580, 0x00ffffff, 0x0400000d, 0x82040d00,
-+ 0x000000ff, 0x82040400, 0x00101cdd, 0x50000800,
-+ 0x80040910, 0x42001000, 0x00000004, 0x0401fb93,
-+ 0x0400000b, 0x0201f800, 0x00103ed2, 0x4200b000,
-+ 0x00000004, 0x83cca400, 0x00000007, 0x4200a800,
-+ 0x0010ad21, 0x0201f800, 0x0010a330, 0x42000800,
-+ 0x00000005, 0x0201f000, 0x00103e1e, 0x59a80015,
-+ 0x80000540, 0x0400001e, 0x4803c857, 0x42001000,
-+ 0x00103df2, 0x0201f800, 0x00105b6f, 0x59a80015,
-+ 0x82000580, 0x00000014, 0x04020016, 0x59cc1006,
-+ 0x82081580, 0x11030000, 0x04020012, 0x59cc1007,
-+ 0x8c08153e, 0x0400000b, 0x59a80014, 0x8c000504,
-+ 0x04020008, 0x42000000, 0x0010b00d, 0x0201f800,
-+ 0x0010a260, 0x59a80014, 0x84000544, 0x48035014,
-+ 0x4a035013, 0x00000006, 0x0401f003, 0x1c01f000,
-+ 0x0401f3cb, 0x4803c856, 0x4a035013, 0x00000007,
-+ 0x83cca400, 0x00000006, 0x4200a800, 0x0010ad20,
-+ 0x4200b000, 0x00000005, 0x0201f800, 0x0010a330,
-+ 0x42007800, 0x0010ad20, 0x46007800, 0x11040000,
-+ 0x8d0e1d06, 0x04020020, 0x59a80014, 0x8c000500,
-+ 0x0402001d, 0x599c0017, 0x8c000500, 0x0400001a,
-+ 0x599c1402, 0x82080480, 0x0000007f, 0x02021800,
-+ 0x001004ef, 0x4c080000, 0x82081400, 0x00101cdd,
-+ 0x50081000, 0x82081500, 0x000000ff, 0x480b500f,
-+ 0x42000800, 0x00000003, 0x0201f800, 0x00106499,
-+ 0x5c000800, 0x42001000, 0x00000004, 0x0401fb37,
-+ 0x04000005, 0x0401fd2c, 0x04000003, 0x4803c856,
-+ 0x850e1d46, 0x42000800, 0x00000005, 0x0401f3cf,
-+ 0x59a80015, 0x80000540, 0x0400001e, 0x4803c857,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020016,
-+ 0x59cc1006, 0x82081580, 0x11040000, 0x04020012,
-+ 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80014,
-+ 0x8c000504, 0x04020008, 0x42000000, 0x0010b00d,
-+ 0x0201f800, 0x0010a260, 0x59a80014, 0x84000544,
-+ 0x48035014, 0x4a035013, 0x00000008, 0x0401f003,
-+ 0x1c01f000, 0x0401f376, 0x4803c856, 0x4a035013,
-+ 0x00000009, 0x83cca400, 0x00000006, 0x4200a800,
-+ 0x0010ad20, 0x4200b000, 0x00000005, 0x0201f800,
-+ 0x0010a330, 0x42007800, 0x0010ad20, 0x46007800,
-+ 0x11050100, 0x8d0e1d06, 0x04020008, 0x59a80014,
-+ 0x8c000500, 0x04020005, 0x0401fa86, 0x04020003,
-+ 0x4803c856, 0x850e1d46, 0x42000800, 0x00000005,
-+ 0x0401fb92, 0x4d3c0000, 0x42027800, 0x00000001,
-+ 0x0201f800, 0x001090c7, 0x5c027800, 0x1c01f000,
-+ 0x59a80015, 0x80000540, 0x04000038, 0x4803c857,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020030,
- 0x59cc1006, 0x82080500, 0x11050000, 0x82000580,
- 0x11050000, 0x0402002a, 0x8c081510, 0x04000014,
-- 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80015,
-- 0x8c000504, 0x04020008, 0x42000000, 0x0010b63d,
-- 0x0201f800, 0x0010a86e, 0x59a80015, 0x84000544,
-- 0x48035015, 0x4a035013, 0x00000001, 0x4a035014,
-+ 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80014,
-+ 0x8c000504, 0x04020008, 0x42000000, 0x0010b00d,
-+ 0x0201f800, 0x0010a260, 0x59a80014, 0x84000544,
-+ 0x48035014, 0x4a035012, 0x00000001, 0x4a035013,
- 0x0000000a, 0x0401f817, 0x0401f014, 0x80000540,
- 0x04020013, 0x59cc1007, 0x8c08153e, 0x0400000b,
-- 0x59a80015, 0x8c000504, 0x04020008, 0x42000000,
-- 0x0010b63d, 0x0201f800, 0x0010a86e, 0x59a80015,
-- 0x84000544, 0x48035015, 0x497b5013, 0x4a035014,
-+ 0x59a80014, 0x8c000504, 0x04020008, 0x42000000,
-+ 0x0010b00d, 0x0201f800, 0x0010a260, 0x59a80014,
-+ 0x84000544, 0x48035014, 0x497b5012, 0x4a035013,
- 0x0000000e, 0x0401f06a, 0x1c01f000, 0x0401f318,
-- 0x4803c856, 0x4a035014, 0x0000000b, 0x42001000,
-- 0x0010b351, 0x4008a800, 0x4200b000, 0x00000020,
-+ 0x4803c856, 0x4a035013, 0x0000000b, 0x42001000,
-+ 0x0010ad21, 0x4008a800, 0x4200b000, 0x00000020,
- 0x4600a800, 0xffffffff, 0x8054a800, 0x8058b040,
-- 0x040207fc, 0x42007800, 0x0010b350, 0x46007800,
-- 0x11060000, 0x42001000, 0x0010b351, 0x0401fb09,
-+ 0x040207fc, 0x42007800, 0x0010ad20, 0x46007800,
-+ 0x11060000, 0x42001000, 0x0010ad21, 0x8d0e1d06,
- 0x04000005, 0x50080000, 0x46001000, 0x00ffffff,
- 0x0401f00c, 0x50080800, 0x82040d00, 0x0000ffff,
-- 0x59a80010, 0x82000500, 0x000000ff, 0x82000540,
-+ 0x59a8000f, 0x82000500, 0x000000ff, 0x82000540,
- 0x00000100, 0x800000e0, 0x80040d40, 0x44041000,
-- 0x42000800, 0x00000021, 0x0401f32c, 0x59a80016,
-- 0x80000540, 0x04000012, 0x4803c857, 0x59a80016,
-- 0x42001000, 0x00103f62, 0x0201f800, 0x00105cc9,
-- 0x59a80016, 0x82000580, 0x00000084, 0x04020009,
-+ 0x42000800, 0x00000021, 0x0401f328, 0x59a80015,
-+ 0x80000540, 0x04000012, 0x4803c857, 0x59a80015,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000084, 0x04020009,
- 0x59cc1006, 0x82081580, 0x11060000, 0x04020005,
-- 0x4a035014, 0x0000000c, 0x0401f003, 0x1c01f000,
-- 0x0401f2db, 0x4803c856, 0x4a035014, 0x0000000d,
-- 0x83cca400, 0x00000006, 0x4200a800, 0x0010b350,
-- 0x4200b000, 0x00000021, 0x0201f800, 0x0010a93e,
-- 0x42007800, 0x0010b350, 0x46007800, 0x11070000,
-- 0x42000800, 0x00000021, 0x0401f304, 0x59a80016,
-- 0x80000540, 0x04000014, 0x4803c857, 0x59a80016,
-- 0x42001000, 0x00103f62, 0x0201f800, 0x00105cc9,
-+ 0x4a035013, 0x0000000c, 0x0401f003, 0x1c01f000,
-+ 0x0401f2db, 0x4803c856, 0x4a035013, 0x0000000d,
-+ 0x83cca400, 0x00000006, 0x4200a800, 0x0010ad20,
-+ 0x4200b000, 0x00000021, 0x0201f800, 0x0010a330,
-+ 0x42007800, 0x0010ad20, 0x46007800, 0x11070000,
-+ 0x42000800, 0x00000021, 0x0401f300, 0x59a80015,
-+ 0x80000540, 0x04000014, 0x4803c857, 0x59a80015,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
- 0x82000580, 0x00000084, 0x0402000c, 0x59cc1006,
-- 0x82081580, 0x11070000, 0x04020008, 0x4a035013,
-- 0x00000001, 0x0401fa91, 0x4a035014, 0x0000000e,
-+ 0x82081580, 0x11070000, 0x04020008, 0x4a035012,
-+ 0x00000001, 0x0401fa91, 0x4a035013, 0x0000000e,
- 0x0401f003, 0x1c01f000, 0x0401f2b1, 0x4803c856,
-- 0x82040d40, 0x00000001, 0x0201f800, 0x001040b9,
-- 0x4a035014, 0x0000000f, 0x497b5016, 0x42006000,
-- 0xffffffff, 0x42006800, 0x00300000, 0x0401fbfe,
-- 0x42006000, 0xffdfffff, 0x41786800, 0x0401fbfa,
-- 0x42000800, 0x000007d0, 0x42001000, 0x00103f62,
-- 0x0201f000, 0x00105ca2, 0x4803c856, 0x59a80016,
-- 0x80000540, 0x04020296, 0x1c01f000, 0x4803c856,
-- 0x4a035014, 0x00000011, 0x83cca400, 0x00000006,
-- 0x4200a800, 0x0010b350, 0x4200b000, 0x00000005,
-- 0x0201f800, 0x0010a93e, 0x4200a800, 0x0010b350,
-- 0x4600a800, 0x11020000, 0x0401fa8a, 0x04020015,
-- 0x59a80010, 0x82000d00, 0xffff0000, 0x04000011,
-- 0x82000500, 0x000000ff, 0x0400000e, 0x82000c00,
-- 0x00101eb5, 0x50040800, 0x80040910, 0x82040580,
-- 0x0000007e, 0x04000007, 0x82040580, 0x00000080,
-- 0x04000004, 0x42001000, 0x00000004, 0x0401fa07,
-- 0x42000800, 0x00000005, 0x0401f2a8, 0x59a80016,
-- 0x80000540, 0x04000020, 0x4803c857, 0x42001000,
-- 0x00103f62, 0x0201f800, 0x00105cc9, 0x59a80016,
-- 0x82000580, 0x00000014, 0x04020016, 0x59cc1006,
-- 0x82081580, 0x11030000, 0x04020012, 0x59cc1007,
-- 0x8c08153e, 0x0400000b, 0x59a80015, 0x8c000504,
-- 0x04020008, 0x42000000, 0x0010b63d, 0x0201f800,
-- 0x0010a86e, 0x59a80015, 0x84000544, 0x48035015,
-- 0x4a035014, 0x00000012, 0x0401f804, 0x0401f002,
-- 0x0401fa4b, 0x1c01f000, 0x4803c856, 0x4a035014,
-- 0x00000013, 0x83cca400, 0x00000006, 0x4200a800,
-- 0x0010b350, 0x4200b000, 0x00000005, 0x0201f800,
-- 0x0010a93e, 0x4200a800, 0x0010b350, 0x4600a800,
-- 0x11030000, 0x0401fa3f, 0x04020013, 0x59a80015,
-- 0x8c000500, 0x04020010, 0x59a80810, 0x82040580,
-- 0x00ffffff, 0x0400000c, 0x82040d00, 0x000000ff,
-- 0x82040400, 0x00101eb5, 0x50000800, 0x80040910,
-- 0x42001000, 0x00000004, 0x0401f9c0, 0x04000002,
-- 0x0401fb11, 0x42000800, 0x00000005, 0x0401f25f,
-- 0x59a80016, 0x80000540, 0x04000020, 0x4803c857,
-- 0x42001000, 0x00103f62, 0x0201f800, 0x00105cc9,
-- 0x59a80016, 0x82000580, 0x00000014, 0x04020016,
-- 0x59cc1006, 0x82081580, 0x11040000, 0x04020012,
-- 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80015,
-- 0x8c000504, 0x04020008, 0x42000000, 0x0010b63d,
-- 0x0201f800, 0x0010a86e, 0x59a80015, 0x84000544,
-- 0x48035015, 0x4a035014, 0x00000014, 0x0401f804,
-- 0x0401f002, 0x0401fa02, 0x1c01f000, 0x4803c856,
-- 0x4a035014, 0x00000015, 0x83cca400, 0x00000006,
-- 0x4200a800, 0x0010b350, 0x4200b000, 0x00000005,
-- 0x0201f800, 0x0010a93e, 0x4200a800, 0x0010b350,
-- 0x4600a800, 0x11040000, 0x0401f9f6, 0x04020020,
-- 0x59a80015, 0x8c000500, 0x0402001d, 0x599c0017,
-- 0x8c000500, 0x0400001a, 0x599c1402, 0x82080480,
-- 0x0000007f, 0x02021800, 0x00100615, 0x4c080000,
-- 0x82081400, 0x00101eb5, 0x50081000, 0x82081500,
-- 0x000000ff, 0x480b5010, 0x42000800, 0x00000003,
-- 0x0201f800, 0x001069af, 0x5c000800, 0x42001000,
-- 0x00000004, 0x0401f96d, 0x04000005, 0x0201f800,
-- 0x001038d8, 0x02020800, 0x00101668, 0x42000800,
-- 0x00000005, 0x0401f209, 0x59a80016, 0x80000540,
-- 0x0400003f, 0x4803c857, 0x42001000, 0x00103f62,
-- 0x0201f800, 0x00105cc9, 0x59a80016, 0x82000580,
-- 0x00000014, 0x04020035, 0x59cc1006, 0x82080500,
-- 0x11050000, 0x82000580, 0x11050000, 0x0402002f,
-- 0x8c081510, 0x04000010, 0x0401fb1f, 0x59cc1007,
-- 0x8c08153e, 0x0400000b, 0x59a80015, 0x8c000504,
-- 0x04020008, 0x42000000, 0x0010b63d, 0x0201f800,
-- 0x0010a86e, 0x59a80015, 0x84000544, 0x48035015,
-- 0x0401f013, 0x59cc1007, 0x8c08153e, 0x0400000b,
-- 0x59a80015, 0x8c000504, 0x04020008, 0x42000000,
-- 0x0010b63d, 0x0201f800, 0x0010a86e, 0x59a80015,
-- 0x84000544, 0x48035015, 0x82000540, 0x00000001,
-- 0x0401fb01, 0x497b5013, 0x0401f003, 0x4a035013,
-- 0x00000001, 0x59cc1007, 0x8c08153c, 0x04000003,
-- 0x4a035026, 0x00000008, 0x4a035014, 0x00000016,
-- 0x0401f804, 0x0401f002, 0x0401f98d, 0x1c01f000,
-- 0x4803c856, 0x83cca400, 0x00000006, 0x4200a800,
-- 0x0010b350, 0x4200b000, 0x00000005, 0x0201f800,
-- 0x0010a93e, 0x4a035014, 0x00000017, 0x59a80013,
-- 0x8c000500, 0x04000006, 0x42001000, 0x0010b350,
-- 0x46001000, 0x11050100, 0x0401f003, 0x4a035014,
-- 0x0000001b, 0x0401f97b, 0x0402000a, 0x59a80015,
-- 0x8c000500, 0x04020007, 0x0401f896, 0x04020005,
-- 0x82000540, 0x00000001, 0x0201f800, 0x00101668,
-- 0x42000800, 0x00000005, 0x0401f9a4, 0x4d3c0000,
-- 0x42027800, 0x00000001, 0x0201f800, 0x00109640,
-- 0x5c027800, 0x1c01f000, 0x59a80016, 0x80000540,
-- 0x04000015, 0x4803c857, 0x42001000, 0x00103f62,
-- 0x0201f800, 0x00105cc9, 0x59a80016, 0x82000580,
-+ 0x82040d40, 0x00000001, 0x0201f800, 0x00103f51,
-+ 0x4a035013, 0x0000000f, 0x497b5015, 0x42006000,
-+ 0xffffffff, 0x42006800, 0x00300000, 0x0201f800,
-+ 0x00103f44, 0x42006000, 0xffdfffff, 0x41786800,
-+ 0x0401fbfc, 0x42000800, 0x000007d0, 0x42001000,
-+ 0x00103df2, 0x0201f000, 0x00105b43, 0x4803c856,
-+ 0x59a80015, 0x80000540, 0x04020295, 0x1c01f000,
-+ 0x4803c856, 0x4a035013, 0x00000011, 0x83cca400,
-+ 0x00000006, 0x4200a800, 0x0010ad20, 0x4200b000,
-+ 0x00000005, 0x0201f800, 0x0010a330, 0x4200a800,
-+ 0x0010ad20, 0x4600a800, 0x11020000, 0x8d0e1d06,
-+ 0x04020015, 0x59a8000f, 0x82000d00, 0xffff0000,
-+ 0x04000011, 0x82000500, 0x000000ff, 0x0400000e,
-+ 0x82000c00, 0x00101cdd, 0x50040800, 0x80040910,
-+ 0x82040580, 0x0000007e, 0x04000007, 0x82040580,
-+ 0x00000080, 0x04000004, 0x42001000, 0x00000004,
-+ 0x0401fa06, 0x42000800, 0x00000005, 0x0401f2a3,
-+ 0x59a80015, 0x80000540, 0x04000020, 0x4803c857,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020016,
-+ 0x59cc1006, 0x82081580, 0x11030000, 0x04020012,
-+ 0x59cc1007, 0x8c08153e, 0x0400000b, 0x59a80014,
-+ 0x8c000504, 0x04020008, 0x42000000, 0x0010b00d,
-+ 0x0201f800, 0x0010a260, 0x59a80014, 0x84000544,
-+ 0x48035014, 0x4a035013, 0x00000012, 0x0401f804,
-+ 0x0401f002, 0x0401fa4a, 0x1c01f000, 0x4803c856,
-+ 0x4a035013, 0x00000013, 0x83cca400, 0x00000006,
-+ 0x4200a800, 0x0010ad20, 0x4200b000, 0x00000005,
-+ 0x0201f800, 0x0010a330, 0x4200a800, 0x0010ad20,
-+ 0x4600a800, 0x11030000, 0x8d0e1d06, 0x04020013,
-+ 0x59a80014, 0x8c000500, 0x04020010, 0x59a8080f,
-+ 0x82040580, 0x00ffffff, 0x0400000c, 0x82040d00,
-+ 0x000000ff, 0x82040400, 0x00101cdd, 0x50000800,
-+ 0x80040910, 0x42001000, 0x00000004, 0x0401f9bf,
-+ 0x04000002, 0x0401fb11, 0x42000800, 0x00000005,
-+ 0x0401f25a, 0x59a80015, 0x80000540, 0x04000020,
-+ 0x4803c857, 0x42001000, 0x00103df2, 0x0201f800,
-+ 0x00105b6f, 0x59a80015, 0x82000580, 0x00000014,
-+ 0x04020016, 0x59cc1006, 0x82081580, 0x11040000,
-+ 0x04020012, 0x59cc1007, 0x8c08153e, 0x0400000b,
-+ 0x59a80014, 0x8c000504, 0x04020008, 0x42000000,
-+ 0x0010b00d, 0x0201f800, 0x0010a260, 0x59a80014,
-+ 0x84000544, 0x48035014, 0x4a035013, 0x00000014,
-+ 0x0401f804, 0x0401f002, 0x0401fa01, 0x1c01f000,
-+ 0x4803c856, 0x4a035013, 0x00000015, 0x83cca400,
-+ 0x00000006, 0x4200a800, 0x0010ad20, 0x4200b000,
-+ 0x00000005, 0x0201f800, 0x0010a330, 0x4200a800,
-+ 0x0010ad20, 0x4600a800, 0x11040000, 0x8d0e1d06,
-+ 0x04020021, 0x59a80014, 0x8c000500, 0x0402001e,
-+ 0x599c0017, 0x8c000500, 0x0400001b, 0x599c1402,
-+ 0x82080480, 0x0000007f, 0x02021800, 0x001004ef,
-+ 0x4c080000, 0x82081400, 0x00101cdd, 0x50081000,
-+ 0x82081500, 0x000000ff, 0x480b500f, 0x42000800,
-+ 0x00000003, 0x0201f800, 0x00106499, 0x5c000800,
-+ 0x42001000, 0x00000004, 0x0401f96c, 0x04000006,
-+ 0x0201f800, 0x00103775, 0x04000003, 0x4803c856,
-+ 0x850e1d46, 0x42000800, 0x00000005, 0x0401f203,
-+ 0x59a80015, 0x80000540, 0x0400003f, 0x4803c857,
-+ 0x42001000, 0x00103df2, 0x0201f800, 0x00105b6f,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x04020035,
-+ 0x59cc1006, 0x82080500, 0x11050000, 0x82000580,
-+ 0x11050000, 0x0402002f, 0x8c081510, 0x04000010,
-+ 0x0401fb21, 0x59cc1007, 0x8c08153e, 0x0400000b,
-+ 0x59a80014, 0x8c000504, 0x04020008, 0x42000000,
-+ 0x0010b00d, 0x0201f800, 0x0010a260, 0x59a80014,
-+ 0x84000544, 0x48035014, 0x0401f013, 0x59cc1007,
-+ 0x8c08153e, 0x0400000b, 0x59a80014, 0x8c000504,
-+ 0x04020008, 0x42000000, 0x0010b00d, 0x0201f800,
-+ 0x0010a260, 0x59a80014, 0x84000544, 0x48035014,
-+ 0x82000540, 0x00000001, 0x0401fb03, 0x497b5012,
-+ 0x0401f003, 0x4a035012, 0x00000001, 0x59cc1007,
-+ 0x8c08153c, 0x04000003, 0x4a035023, 0x00000008,
-+ 0x4a035013, 0x00000016, 0x0401f804, 0x0401f002,
-+ 0x0401f98b, 0x1c01f000, 0x4803c856, 0x83cca400,
-+ 0x00000006, 0x4200a800, 0x0010ad20, 0x4200b000,
-+ 0x00000005, 0x0201f800, 0x0010a330, 0x4a035013,
-+ 0x00000017, 0x59a80012, 0x8c000500, 0x04000006,
-+ 0x42001000, 0x0010ad20, 0x46001000, 0x11050100,
-+ 0x0401f003, 0x4a035013, 0x0000001b, 0x8d0e1d06,
-+ 0x04020008, 0x59a80014, 0x8c000500, 0x04020005,
-+ 0x0401f894, 0x04020003, 0x4803c856, 0x850e1d46,
-+ 0x42000800, 0x00000005, 0x0401f9a0, 0x4d3c0000,
-+ 0x42027800, 0x00000001, 0x0201f800, 0x001090c7,
-+ 0x5c027800, 0x1c01f000, 0x59a80015, 0x80000540,
-+ 0x04000015, 0x4803c857, 0x42001000, 0x00103df2,
-+ 0x0201f800, 0x00105b6f, 0x59a80015, 0x82000580,
- 0x00000084, 0x0402000b, 0x59cc1006, 0x82081580,
-- 0x11060000, 0x04020007, 0x80000580, 0x0401fab6,
-- 0x4a035014, 0x00000018, 0x0401f804, 0x0401f002,
-- 0x0401f94b, 0x1c01f000, 0x4803c856, 0x4a035014,
-+ 0x11060000, 0x04020007, 0x80000580, 0x0401faba,
-+ 0x4a035013, 0x00000018, 0x0401f804, 0x0401f002,
-+ 0x0401f94b, 0x1c01f000, 0x4803c856, 0x4a035013,
- 0x00000019, 0x83cca400, 0x00000006, 0x4200a800,
-- 0x0010b350, 0x4200b000, 0x00000021, 0x0201f800,
-- 0x0010a93e, 0x42003800, 0x0010b351, 0x0401f941,
-+ 0x0010ad20, 0x4200b000, 0x00000021, 0x0201f800,
-+ 0x0010a330, 0x42003800, 0x0010ad21, 0x8d0e1d06,
- 0x04020018, 0x401c2800, 0x50141000, 0x80080130,
- 0x80000000, 0x40001800, 0x82081500, 0x00ffffff,
-- 0x800000f0, 0x80080540, 0x44002800, 0x59a80810,
-+ 0x800000f0, 0x80080540, 0x44002800, 0x59a8080f,
- 0x82040d00, 0x000000ff, 0x400c1000, 0x80081104,
-- 0x82082400, 0x0010b351, 0x50101000, 0x820c0500,
-+ 0x82082400, 0x0010ad21, 0x50101000, 0x820c0500,
- 0x00000003, 0x0c01f806, 0x80081540, 0x44082000,
-- 0x42000800, 0x00000021, 0x0401f15c, 0x00103e37,
-- 0x00103e3c, 0x00103e41, 0x00103e46, 0x800408f0,
-+ 0x42000800, 0x00000021, 0x0401f158, 0x00103ccb,
-+ 0x00103cd0, 0x00103cd5, 0x00103cda, 0x800408f0,
- 0x40040000, 0x82081500, 0x00ffffff, 0x1c01f000,
- 0x800408e0, 0x40040000, 0x82081500, 0xff00ffff,
- 0x1c01f000, 0x800408d0, 0x40040000, 0x82081500,
- 0xffff00ff, 0x1c01f000, 0x40040000, 0x82081500,
-- 0xffffff00, 0x1c01f000, 0x59a80016, 0x80000540,
-- 0x04000016, 0x4803c857, 0x42001000, 0x00103f62,
-- 0x0201f800, 0x00105cc9, 0x59a80016, 0x82000580,
-+ 0xffffff00, 0x1c01f000, 0x59a80015, 0x80000540,
-+ 0x04000016, 0x4803c857, 0x42001000, 0x00103df2,
-+ 0x0201f800, 0x00105b6f, 0x59a80015, 0x82000580,
- 0x00000084, 0x0402000c, 0x59cc1006, 0x82081580,
-- 0x11070000, 0x04020008, 0x4a035013, 0x00000001,
-- 0x0401f8d2, 0x4a035014, 0x0000001a, 0x0401f804,
-+ 0x11070000, 0x04020008, 0x4a035012, 0x00000001,
-+ 0x0401f8d2, 0x4a035013, 0x0000001a, 0x0401f804,
- 0x0401f002, 0x0401f8f2, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401fa54, 0x4a035014, 0x0000001b,
-- 0x83cca400, 0x00000006, 0x4200a800, 0x0010b350,
-- 0x59a82016, 0x40100000, 0x8000b104, 0x40580800,
-+ 0x00000001, 0x0401fa58, 0x4a035013, 0x0000001b,
-+ 0x83cca400, 0x00000006, 0x4200a800, 0x0010ad20,
-+ 0x59a82015, 0x40100000, 0x8000b104, 0x40580800,
- 0x5450a800, 0x8050a000, 0x8054a800, 0x8058b040,
-- 0x040207fc, 0x0401f119, 0x1c01f000, 0x1c01f000,
-+ 0x040207fc, 0x0401f115, 0x1c01f000, 0x1c01f000,
- 0x4803c856, 0x42003000, 0x00000004, 0x42004000,
-- 0x0010b351, 0x599c2817, 0x8c142d14, 0x0402001f,
-+ 0x0010ad21, 0x599c2817, 0x8c142d14, 0x0402001f,
- 0x42001000, 0x00000003, 0x40200000, 0x80080400,
- 0x50000800, 0x82042580, 0xffffffff, 0x04020005,
- 0x80081040, 0x80183040, 0x040207f8, 0x0401f05e,
-@@ -4067,20 +3963,20 @@ uint32_t risc_code01[] = {
- 0x80000000, 0x40042000, 0x801020c2, 0x04021007,
- 0x800c1902, 0x8058b000, 0x82580480, 0x00000021,
- 0x040017fa, 0x0401f02f, 0x40200000, 0x80082400,
-- 0x50100000, 0x800c0540, 0x44002000, 0x59a80015,
-- 0x84000540, 0x48035015, 0x40580000, 0x42002800,
-+ 0x50100000, 0x800c0540, 0x44002000, 0x59a80014,
-+ 0x84000540, 0x48035014, 0x40580000, 0x42002800,
- 0x00000020, 0x80142c80, 0x40080000, 0x42003800,
- 0x00000003, 0x801c0480, 0x800000ca, 0x80142d40,
-- 0x82144c00, 0x00101eb5, 0x50242800, 0x82142d00,
-- 0x000000ff, 0x48175010, 0x4c040000, 0x40140800,
-- 0x0201f800, 0x00101655, 0x5c000800, 0x40001800,
-- 0x500c0000, 0x80100540, 0x44001800, 0x59a80015,
-- 0x84000540, 0x48035015, 0x4200a800, 0x0010b351,
-+ 0x82144c00, 0x00101cdd, 0x50242800, 0x82142d00,
-+ 0x000000ff, 0x4817500f, 0x4c040000, 0x40140800,
-+ 0x0201f800, 0x0010151e, 0x5c000800, 0x40001800,
-+ 0x500c0000, 0x80100540, 0x44001800, 0x59a80014,
-+ 0x84000540, 0x48035014, 0x4200a800, 0x0010ad21,
- 0x4020a000, 0x4200b000, 0x00000004, 0x0201f800,
-- 0x0010a93e, 0x82000540, 0x00000001, 0x0401f002,
-+ 0x0010a330, 0x82000540, 0x00000001, 0x0401f002,
- 0x80000580, 0x1c01f000, 0x4807c857, 0x480bc857,
- 0x4008b000, 0x83cca400, 0x00000007, 0x4200a800,
-- 0x0010b351, 0x40541000, 0x0201f800, 0x0010a93e,
-+ 0x0010ad21, 0x40541000, 0x0201f800, 0x0010a330,
- 0x40041800, 0x41782000, 0x42000000, 0x00000003,
- 0x820c1c80, 0x00000020, 0x04001004, 0x80102000,
- 0x80000040, 0x0401f7fb, 0x40041800, 0x801021c0,
-@@ -4089,290 +3985,292 @@ uint32_t risc_code01[] = {
- 0x04000004, 0x801020c2, 0x800c1840, 0x040207fe,
- 0x80083c00, 0x83cc2c00, 0x00000007, 0x80142c00,
- 0x50140000, 0x80102d00, 0x04020012, 0x80100540,
-- 0x44003800, 0x82042400, 0x00101eb5, 0x50102800,
-- 0x82142d00, 0x000000ff, 0x48175010, 0x4c040000,
-- 0x40140800, 0x0201f800, 0x00101655, 0x5c000800,
-- 0x59a80015, 0x84000540, 0x48035015, 0x80000580,
-+ 0x44003800, 0x82042400, 0x00101cdd, 0x50102800,
-+ 0x82142d00, 0x000000ff, 0x4817500f, 0x4c040000,
-+ 0x40140800, 0x0201f800, 0x0010151e, 0x5c000800,
-+ 0x59a80014, 0x84000540, 0x48035014, 0x80000580,
- 0x1c01f000, 0x4807c856, 0x42001000, 0x00008017,
-- 0x59a8184e, 0x0201f800, 0x0010a876, 0x0201f800,
-- 0x00103857, 0x1c01f000, 0x4807c856, 0x4200b000,
-+ 0x59a8184b, 0x0201f800, 0x0010a268, 0x0201f800,
-+ 0x001036f4, 0x1c01f000, 0x4807c856, 0x4200b000,
- 0x00000020, 0x83cca400, 0x00000007, 0x4200a800,
-- 0x0010bc20, 0x0201f000, 0x0010a94f, 0x4807c856,
-- 0x0201f800, 0x00106c32, 0x42000800, 0x000000f7,
-- 0x0401f8f4, 0x497b2804, 0x497b2805, 0x497b281c,
-+ 0x0010b5f0, 0x0201f000, 0x0010a341, 0x4807c856,
-+ 0x0201f800, 0x00106725, 0x42000800, 0x000000f7,
-+ 0x0401f8f5, 0x497b2804, 0x497b2805, 0x497b281c,
- 0x497b281d, 0x4202d800, 0x00000001, 0x42006000,
-- 0xbf7fffff, 0x42006800, 0x00018000, 0x0401f966,
-- 0x42006000, 0xfffeffff, 0x41786800, 0x0401f962,
-- 0x497b504e, 0x42000800, 0x0000002d, 0x42001000,
-- 0x00103fe4, 0x0201f000, 0x00105ca2, 0x4807c856,
-- 0x0401ffe3, 0x497b5014, 0x497b5016, 0x1c01f000,
-- 0x4807c856, 0x59a80005, 0x8c000506, 0x1c01f000,
-+ 0xbf7fffff, 0x42006800, 0x00018000, 0x0401f969,
-+ 0x42006000, 0xfffeffff, 0x41786800, 0x0401f965,
-+ 0x497b504b, 0x42000800, 0x0000002d, 0x42001000,
-+ 0x00103e74, 0x0201f000, 0x00105b43, 0x4807c856,
-+ 0x0401ffe3, 0x497b5013, 0x497b5015, 0x1c01f000,
- 0x4807c856, 0x42006000, 0xffffffff, 0x42006800,
-- 0x00000028, 0x0401f14c, 0x4807c856, 0x0401ffc2,
-- 0x0201f800, 0x0010698c, 0x4df00000, 0x0201f800,
-- 0x00106b71, 0x5c03e000, 0x02000800, 0x00106982,
-+ 0x00000028, 0x0401f153, 0x4807c856, 0x0401ffc6,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x0201f800,
-+ 0x00106664, 0x5c03e000, 0x02000800, 0x00106463,
- 0x59c400a4, 0x82000500, 0x0000000f, 0x82000580,
- 0x00000002, 0x0402000a, 0x42006000, 0xffffffff,
-- 0x42006800, 0x00200000, 0x0401f937, 0x42006000,
-- 0xffdfffff, 0x41786800, 0x0401f933, 0x497b5014,
-- 0x42000800, 0x000000f7, 0x0401f8b2, 0x59c400a3,
-+ 0x42006800, 0x00200000, 0x0401f93e, 0x42006000,
-+ 0xffdfffff, 0x41786800, 0x0401f93a, 0x497b5013,
-+ 0x42000800, 0x000000f7, 0x0401f8b7, 0x59c400a3,
- 0x82000500, 0xbf20bfff, 0x82000540, 0x0001c000,
-- 0x480388a3, 0x84000520, 0x480388a3, 0x497b504e,
-- 0x42000800, 0x0000002d, 0x42001000, 0x00103fe4,
-- 0x0201f000, 0x00105ca2, 0x497b5016, 0x59b400f5,
-+ 0x480388a3, 0x84000520, 0x480388a3, 0x497b504b,
-+ 0x42000800, 0x0000002d, 0x42001000, 0x00103e74,
-+ 0x0201f000, 0x00105b43, 0x497b5015, 0x59b400f5,
- 0x8c000500, 0x04020004, 0x82000540, 0x00000001,
- 0x480368f5, 0x800400c4, 0x82000400, 0x00002000,
- 0x4803910a, 0x59b400f6, 0x82000500, 0x00000018,
-- 0x040207fd, 0x4a0368f0, 0x0010b349, 0x42000000,
-- 0x0010b350, 0x4c040000, 0x50000800, 0x82040d80,
-+ 0x040207fd, 0x4a0368f0, 0x0010ad19, 0x42000000,
-+ 0x0010ad20, 0x4c040000, 0x50000800, 0x82040d80,
- 0x11010000, 0x04000003, 0x50000800, 0x4807c857,
- 0x5c000800, 0x480368f1, 0x82040400, 0x0000dc00,
- 0x480368f3, 0x59c400a4, 0x82000500, 0x0000000f,
- 0x82000580, 0x00000008, 0x04020017, 0x4c5c0000,
- 0x4c600000, 0x59c4b805, 0x8c5cbd3a, 0x04020005,
-- 0x42000000, 0x0010b616, 0x0201f800, 0x0010a86e,
-- 0x4a038805, 0x02000000, 0x0201f800, 0x00101a59,
-- 0x4000c000, 0x0201f800, 0x001019d0, 0x4202d800,
-- 0x00000001, 0x497b5014, 0x5c00c000, 0x5c00b800,
-+ 0x42000000, 0x0010afe6, 0x0201f800, 0x0010a260,
-+ 0x4a038805, 0x02000000, 0x0201f800, 0x00101946,
-+ 0x4000c000, 0x0201f800, 0x001018c4, 0x4202d800,
-+ 0x00000001, 0x497b5013, 0x5c00c000, 0x5c00b800,
- 0x1c01f000, 0x59c8010b, 0x8c000502, 0x040007e2,
- 0x59c408a4, 0x82040d00, 0x0000000f, 0x82040d80,
-- 0x0000000b, 0x04020005, 0x59a80814, 0x82040d40,
-- 0x00002000, 0x0401f004, 0x59a80812, 0x82040d40,
-- 0x00001000, 0x4807504e, 0x59a8084a, 0x800409c0,
-+ 0x0000000b, 0x04020005, 0x59a80813, 0x82040d40,
-+ 0x00002000, 0x0401f004, 0x59a80811, 0x82040d40,
-+ 0x00001000, 0x4807504b, 0x59a80847, 0x800409c0,
- 0x04020007, 0x42000800, 0x000007d0, 0x42001000,
-- 0x00103f62, 0x0201f800, 0x00105da7, 0x1c01f000,
-- 0x4807c856, 0x0401ff40, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x0201f800, 0x00106b71, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x59c400a4, 0x82000500,
-+ 0x00103df2, 0x0201f800, 0x00105c4d, 0x1c01f000,
-+ 0x4807c856, 0x0401ff44, 0x0201f800, 0x00106476,
-+ 0x4df00000, 0x0201f800, 0x00106664, 0x5c03e000,
-+ 0x02000800, 0x00106463, 0x59c400a4, 0x82000500,
- 0x0000000f, 0x82000580, 0x00000002, 0x0402000a,
- 0x42006000, 0xffffffff, 0x42006800, 0x00200000,
-- 0x0401f8b5, 0x42006000, 0xffdfffff, 0x41786800,
-- 0x0401f8b1, 0x0201f800, 0x00104e13, 0x04000014,
-- 0x0201f800, 0x00104e23, 0x04020011, 0x4a035032,
-- 0x0000aaaa, 0x4c040000, 0x0201f800, 0x00101694,
-- 0x59a8002a, 0x82000500, 0xffff0000, 0x80040540,
-- 0x4803502a, 0x5c000800, 0x4a035033, 0x00000000,
-- 0x0201f800, 0x00104d76, 0x0401f008, 0x4a03504c,
-- 0x00000005, 0x42000000, 0x00000001, 0x0201f800,
-- 0x001015fa, 0x0401ff1e, 0x1c01f000, 0x0401f809,
-- 0x42006000, 0xbf7f7fff, 0x41786800, 0x0401f08e,
-- 0x42006000, 0xbf7f7fff, 0x41786800, 0x0401f08a,
-- 0x0201f800, 0x00104e23, 0x04020009, 0x59c40006,
-+ 0x0401f8bc, 0x42006000, 0xffdfffff, 0x41786800,
-+ 0x0401f8b8, 0x0201f800, 0x00104cc2, 0x04000014,
-+ 0x0201f800, 0x00104ce4, 0x04020011, 0x4a03502f,
-+ 0x0000aaaa, 0x4c040000, 0x0201f800, 0x00101559,
-+ 0x59a80027, 0x82000500, 0xffff0000, 0x80040540,
-+ 0x48035027, 0x5c000800, 0x4a035030, 0x00000000,
-+ 0x0201f800, 0x00104c16, 0x0401f008, 0x4a035049,
-+ 0x00000005, 0x42000000, 0x00000080, 0x0201f800,
-+ 0x001014c3, 0x0401ff22, 0x1c01f000, 0x0401f809,
-+ 0x42006000, 0xbf7f7fff, 0x41786800, 0x0401f095,
-+ 0x42006000, 0xbf7f7fff, 0x41786800, 0x0401f091,
-+ 0x0201f800, 0x00104ce4, 0x04020009, 0x59c40006,
- 0x82000540, 0x000000f0, 0x48038806, 0x42006000,
-- 0xbfffffff, 0x41786800, 0x0401f87f, 0x1c01f000,
-- 0x800408d0, 0x59a80015, 0x8c000506, 0x04000006,
-- 0x59a80010, 0x82000500, 0x000000ff, 0x80040540,
-- 0x0401f003, 0x82040540, 0x000000f7, 0x480388a7,
-- 0x1c01f000, 0x4807c856, 0x42000000, 0x0010b639,
-- 0x0201f800, 0x0010a86e, 0x42003000, 0x00000005,
-- 0x4d3c0000, 0x4c180000, 0x42003000, 0x0000000d,
-- 0x42027800, 0x00000002, 0x0401f038, 0x4807c856,
-- 0x42000000, 0x0010b66a, 0x0201f800, 0x0010a86e,
-- 0x42003000, 0x00000000, 0x4d3c0000, 0x4c180000,
-- 0x42003000, 0x0000000f, 0x42027800, 0x00000002,
-- 0x0401f02a, 0x4807c856, 0x42000000, 0x0010b669,
-- 0x0201f800, 0x0010a86e, 0x42003000, 0x00000003,
-- 0x4d3c0000, 0x4c180000, 0x42003000, 0x0000000e,
-- 0x42027800, 0x00000202, 0x0401f01c, 0x4807c856,
-- 0x42000000, 0x0010b668, 0x0201f800, 0x0010a86e,
-- 0x42003000, 0x00000004, 0x4d3c0000, 0x4c180000,
-- 0x42003000, 0x00000010, 0x42027800, 0x00000202,
-- 0x0401f00e, 0x4807c856, 0x42000000, 0x0010b63c,
-- 0x0201f800, 0x0010a86e, 0x42003000, 0x00000001,
-- 0x4d3c0000, 0x4c180000, 0x42003000, 0x0000000c,
-- 0x42027800, 0x00000202, 0x42001800, 0x0000ffff,
-- 0x42002000, 0x00000007, 0x0201f800, 0x001038c7,
-- 0x5c003000, 0x4d400000, 0x0201f800, 0x0010a784,
-- 0x42028000, 0x0000002a, 0x0201f800, 0x00101d90,
-- 0x5c028000, 0x5c027800, 0x1c01f000, 0x4807c856,
-- 0x04011000, 0x4a03c840, 0x0010b349, 0x4a03c842,
-- 0x00000040, 0x40000000, 0x040117ff, 0x42007800,
-- 0x0010b349, 0x46007800, 0x00000011, 0x803c7800,
-- 0x4a007800, 0x220000ef, 0x4a007801, 0x000000ef,
-- 0x4a007802, 0x01380000, 0x4a007803, 0x00000000,
-- 0x4a007804, 0xffffffff, 0x4a007805, 0x00000000,
-- 0x1c01f000, 0x59c400a3, 0x80300500, 0x80340540,
-- 0x480388a3, 0x1c01f000, 0x4833c857, 0x59c400a3,
-+ 0xbfffffff, 0x41786800, 0x0401f886, 0x1c01f000,
-+ 0x4c000000, 0x40680800, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x800408d0, 0x59a80014, 0x8c000506,
-+ 0x04000006, 0x59a8000f, 0x82000500, 0x000000ff,
-+ 0x80040540, 0x0401f003, 0x82040540, 0x000000f7,
-+ 0x480388a7, 0x1c01f000, 0x4807c856, 0x42000000,
-+ 0x0010b009, 0x0201f800, 0x0010a260, 0x42003000,
-+ 0x00000005, 0x4d3c0000, 0x4c180000, 0x42003000,
-+ 0x0000000d, 0x42027800, 0x00000002, 0x0401f038,
-+ 0x4807c856, 0x42000000, 0x0010b03a, 0x0201f800,
-+ 0x0010a260, 0x42003000, 0x00000000, 0x4d3c0000,
-+ 0x4c180000, 0x42003000, 0x0000000f, 0x42027800,
-+ 0x00000002, 0x0401f02a, 0x4807c856, 0x42000000,
-+ 0x0010b039, 0x0201f800, 0x0010a260, 0x42003000,
-+ 0x00000003, 0x4d3c0000, 0x4c180000, 0x42003000,
-+ 0x0000000e, 0x42027800, 0x00000202, 0x0401f01c,
-+ 0x4807c856, 0x42000000, 0x0010b038, 0x0201f800,
-+ 0x0010a260, 0x42003000, 0x00000004, 0x4d3c0000,
-+ 0x4c180000, 0x42003000, 0x00000010, 0x42027800,
-+ 0x00000202, 0x0401f00e, 0x4807c856, 0x42000000,
-+ 0x0010b00c, 0x0201f800, 0x0010a260, 0x42003000,
-+ 0x00000001, 0x4d3c0000, 0x4c180000, 0x42003000,
-+ 0x0000000c, 0x42027800, 0x00000002, 0x42001800,
-+ 0x0000ffff, 0x42002000, 0x00000007, 0x0201f800,
-+ 0x00103764, 0x5c003000, 0x4d400000, 0x0201f800,
-+ 0x0010a155, 0x42028000, 0x0000002a, 0x0201f800,
-+ 0x0010ca42, 0x5c028000, 0x5c027800, 0x1c01f000,
-+ 0x4807c856, 0x04011000, 0x4a03c840, 0x0010ad19,
-+ 0x4a03c842, 0x00000040, 0x40000000, 0x040117ff,
-+ 0x42007800, 0x0010ad19, 0x46007800, 0x00000011,
-+ 0x803c7800, 0x4a007800, 0x220000ef, 0x4a007801,
-+ 0x000000ef, 0x4a007802, 0x01380000, 0x4a007803,
-+ 0x00000000, 0x4a007804, 0xffffffff, 0x4a007805,
-+ 0x00000000, 0x1c01f000, 0x40686000, 0x406c6800,
-+ 0x59c400a3, 0x80300500, 0x80340540, 0x480388a3,
-+ 0x1c01f000, 0x40686000, 0x4833c857, 0x59c400a3,
- 0x80300540, 0x480388a3, 0x80300580, 0x480388a3,
-- 0x1c01f000, 0x4803c856, 0x04000004, 0x4a03504b,
-- 0x00000001, 0x0401f002, 0x497b504b, 0x1c01f000,
-+ 0x1c01f000, 0x4803c856, 0x04000004, 0x4a035048,
-+ 0x00000001, 0x0401f002, 0x497b5048, 0x1c01f000,
- 0x4803c856, 0x59c80002, 0x80000540, 0x0400000a,
- 0x80000040, 0x04000008, 0x4a039005, 0x00000140,
- 0x42000000, 0x00000006, 0x80000040, 0x040207ff,
- 0x0401f7f4, 0x1c01f000, 0x4c5c0000, 0x4c600000,
- 0x59c4b805, 0x485fc856, 0x8c5cbd3a, 0x04020005,
-- 0x42000000, 0x0010b616, 0x0201f800, 0x0010a86e,
-- 0x4a038805, 0x02000000, 0x0201f800, 0x00101a59,
-- 0x4000c000, 0x0201f800, 0x001019d0, 0x4a038805,
-+ 0x42000000, 0x0010afe6, 0x0201f800, 0x0010a260,
-+ 0x4a038805, 0x02000000, 0x0201f800, 0x00101946,
-+ 0x4000c000, 0x0201f800, 0x001018c4, 0x4a038805,
- 0x04000000, 0x5c00c000, 0x5c00b800, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
- 0x497a6a00, 0x4a026c00, 0x00000707, 0x497a6801,
- 0x497a6808, 0x497a6809, 0x497a6806, 0x497a6807,
-- 0x497a6c0b, 0x497a680c, 0x0201f800, 0x0010393e,
-- 0x04020006, 0x5934080f, 0x59340010, 0x80040540,
-- 0x02020800, 0x00100615, 0x4a026a04, 0x00000100,
-- 0x497a6a03, 0x59340402, 0x82000500, 0x000000ff,
-- 0x48026c02, 0x497a6c04, 0x497a6a05, 0x497a6c05,
-- 0x497a6811, 0x4d2c0000, 0x5934000d, 0x49466c03,
-- 0x80025d40, 0x04000004, 0x0201f800, 0x00100843,
-- 0x497a680d, 0x5c025800, 0x599c0401, 0x48026a0b,
-+ 0x497a6c0b, 0x497a680c, 0x8d0e1d20, 0x04020006,
-+ 0x5934080f, 0x59340010, 0x80040540, 0x02020800,
-+ 0x001004ef, 0x4a026a04, 0x00000100, 0x497a6a03,
-+ 0x59340402, 0x82000500, 0x000000ff, 0x48026c02,
-+ 0x497a6c04, 0x497a6a05, 0x497a6c05, 0x497a6811,
-+ 0x4d2c0000, 0x5934000d, 0x49466c03, 0x80025d40,
-+ 0x04000004, 0x0201f800, 0x0010073b, 0x497a680d,
-+ 0x5c025800, 0x59a8006c, 0x8c000502, 0x42000000,
-+ 0x00000010, 0x04020002, 0x599c0401, 0x48026a0b,
- 0x599c0208, 0x48026c12, 0x4a02680a, 0x00006000,
-- 0x0201f000, 0x00104acf, 0x42000000, 0x00000005,
-- 0x80000d80, 0x0401f02d, 0x0201f800, 0x00104858,
-- 0x04020017, 0x59a80026, 0x8c00050a, 0x04020010,
-+ 0x0201f000, 0x001049c5, 0x42000000, 0x00000005,
-+ 0x80000d80, 0x0401f02c, 0x0201f800, 0x00104744,
-+ 0x04020017, 0x59a80023, 0x8c00050a, 0x04020010,
- 0x59340212, 0x82000500, 0x0000ff00, 0x4803c857,
- 0x0400000b, 0x59340a00, 0x8c040d1e, 0x02000000,
-- 0x000201f8, 0x42000000, 0x00000029, 0x42000800,
-- 0x00001000, 0x492fc857, 0x0401f018, 0x492fc857,
-- 0x42000000, 0x00000028, 0x0401f012, 0x59a80805,
-- 0x8c040d02, 0x04020003, 0x8c040d00, 0x04000004,
-- 0x42000000, 0x00000004, 0x0401f00a, 0x42000000,
-- 0x00000029, 0x59340a00, 0x8c040d1e, 0x04000005,
-- 0x492fc857, 0x42000800, 0x00001000, 0x0401f003,
-- 0x492fc857, 0x80000d80, 0x4803c857, 0x80028540,
-- 0x1c01f000, 0x4803c857, 0x59a80005, 0x8c000500,
-- 0x040207ec, 0x0201f800, 0x00104836, 0x040207e4,
-- 0x59340200, 0x8c00050e, 0x040007e1, 0x0201f000,
-- 0x000201f8, 0x0201f800, 0x00104639, 0x040007bf,
-- 0x0201f000, 0x000201fc, 0x592c0206, 0x492fc857,
-- 0x82000d80, 0x000007ff, 0x04020006, 0x4a025c0a,
-- 0x00000030, 0x42026800, 0x0010b320, 0x0401f021,
-- 0x82000c80, 0x000007f0, 0x04021046, 0x81ac0400,
-- 0x50000000, 0x80026d40, 0x04000038, 0x0201f800,
-- 0x00104732, 0x04020038, 0x592c040a, 0x8c00050a,
-- 0x04020014, 0x592e6009, 0x83300480, 0x0010cfc0,
-- 0x0400103b, 0x41580000, 0x81300480, 0x04021038,
-- 0x59300c06, 0x82040580, 0x00000009, 0x04020037,
-- 0x4a025a06, 0x00000000, 0x497a5800, 0x59300008,
-- 0x80000540, 0x04020018, 0x492e6008, 0x0401f010,
-- 0x0201f800, 0x00020892, 0x04000019, 0x592c0206,
-- 0x49366009, 0x492e6008, 0x4a026406, 0x00000009,
-- 0x497a6015, 0x49325809, 0x82000d80, 0x000007ff,
-- 0x04020003, 0x4a026015, 0x00008000, 0x42027000,
-- 0x00000043, 0x0201f800, 0x000208d8, 0x80000580,
-- 0x0401f020, 0x40000800, 0x58040000, 0x80000d40,
-- 0x040207fd, 0x492c0800, 0x0401f01a, 0x42000000,
-- 0x0000002c, 0x0401f016, 0x42000000, 0x00000028,
-- 0x0401f013, 0x59a80805, 0x82040500, 0x00000003,
-- 0x04000004, 0x42000000, 0x00000004, 0x0401f00c,
-- 0x42000000, 0x00000029, 0x0401f009, 0x42000000,
-- 0x00000008, 0x0401f006, 0x82040580, 0x00000007,
-- 0x040207fb, 0x42000000, 0x00000005, 0x80000540,
-- 0x1c01f000, 0x492fc857, 0x592e8c06, 0x83440d80,
-- 0x000007fc, 0x04000004, 0x83440480, 0x000007f0,
-- 0x04021014, 0x0201f800, 0x00020267, 0x04020011,
-- 0x0201f800, 0x00104842, 0x04020011, 0x0201f800,
-- 0x00020892, 0x0400001c, 0x49366009, 0x492e6008,
-- 0x4a026406, 0x0000000a, 0x42027000, 0x00000040,
-- 0x0201f800, 0x000208d8, 0x80000580, 0x0401f011,
-- 0x42000000, 0x00000028, 0x0401f00d, 0x0201f800,
-- 0x00104858, 0x040007fb, 0x59a80805, 0x82040d00,
-+ 0x000201e9, 0x42000000, 0x00000029, 0x42000800,
-+ 0x00001000, 0x492fc857, 0x0401f017, 0x492fc857,
-+ 0x42000000, 0x00000028, 0x0401f011, 0x8d0e1d02,
-+ 0x04020003, 0x8d0e1d00, 0x04000004, 0x42000000,
-+ 0x00000004, 0x0401f00a, 0x42000000, 0x00000029,
-+ 0x59340a00, 0x8c040d1e, 0x04000005, 0x492fc857,
-+ 0x42000800, 0x00001000, 0x0401f003, 0x492fc857,
-+ 0x80000d80, 0x4803c857, 0x80028540, 0x1c01f000,
-+ 0x490fc857, 0x8d0e1d00, 0x040207ed, 0x0201f800,
-+ 0x00104719, 0x040207e6, 0x59340200, 0x8c00050e,
-+ 0x040007e3, 0x0201f000, 0x000201e9, 0x0201f800,
-+ 0x00104507, 0x040007c1, 0x0201f000, 0x000201ed,
-+ 0x592c0206, 0x492fc857, 0x82000d80, 0x000007ff,
-+ 0x04020006, 0x4a025c0a, 0x00000030, 0x42026800,
-+ 0x0010acf1, 0x0401f021, 0x82000c80, 0x000007f0,
-+ 0x04021045, 0x81ac0400, 0x50000000, 0x80026d40,
-+ 0x04000038, 0x0201f800, 0x00104602, 0x04020038,
-+ 0x592c040a, 0x8c00050a, 0x04020014, 0x592e6009,
-+ 0x83300480, 0x0010d8d4, 0x0400103a, 0x41580000,
-+ 0x81300480, 0x04021037, 0x59300c06, 0x82040580,
-+ 0x00000009, 0x04020036, 0x4a025a06, 0x00000000,
-+ 0x497a5800, 0x59300008, 0x80000540, 0x04020018,
-+ 0x492e6008, 0x0401f010, 0x0201f800, 0x00020799,
-+ 0x04000019, 0x592c0206, 0x49366009, 0x492e6008,
-+ 0x4a026406, 0x00000009, 0x497a6015, 0x49325809,
-+ 0x82000d80, 0x000007ff, 0x04020003, 0x4a026015,
-+ 0x00008000, 0x42027000, 0x00000043, 0x0201f800,
-+ 0x000207df, 0x80000580, 0x0401f01f, 0x40000800,
-+ 0x58040000, 0x80000d40, 0x040207fd, 0x492c0800,
-+ 0x0401f019, 0x42000000, 0x0000002c, 0x0401f015,
-+ 0x42000000, 0x00000028, 0x0401f012, 0x830c0500,
-+ 0x00000003, 0x04000004, 0x42000000, 0x00000004,
-+ 0x0401f00c, 0x42000000, 0x00000029, 0x0401f009,
-+ 0x42000000, 0x00000008, 0x0401f006, 0x82040580,
-+ 0x00000007, 0x040207fb, 0x42000000, 0x00000005,
-+ 0x80000540, 0x1c01f000, 0x492fc857, 0x592e8c06,
-+ 0x83440d80, 0x000007fc, 0x04000004, 0x83440480,
-+ 0x000007f0, 0x04021014, 0x0201f800, 0x0002025a,
-+ 0x04020011, 0x0201f800, 0x00104725, 0x04020011,
-+ 0x0201f800, 0x00020799, 0x0400001b, 0x49366009,
-+ 0x492e6008, 0x4a026406, 0x0000000a, 0x42027000,
-+ 0x00000040, 0x0201f800, 0x000207df, 0x80000580,
-+ 0x0401f010, 0x42000000, 0x00000028, 0x0401f00c,
-+ 0x0201f800, 0x00104744, 0x040007fb, 0x830c0d00,
- 0x00000003, 0x04000004, 0x42000000, 0x00000004,
- 0x0401f003, 0x42000000, 0x00000029, 0x80000540,
- 0x1c01f000, 0x42000000, 0x0000002c, 0x0401f7fc,
- 0x492fc857, 0x592e8c06, 0x4947c857, 0x83440c80,
- 0x00000800, 0x42000000, 0x0000000a, 0x0402119c,
- 0x592c4207, 0x4823c857, 0x82200500, 0x0000000f,
-- 0x0c01f001, 0x00104205, 0x0010428d, 0x001042dd,
-- 0x001042e8, 0x001042f3, 0x00104201, 0x00104201,
-- 0x00104201, 0x00104303, 0x00104361, 0x00104386,
-- 0x00104201, 0x00104201, 0x00104201, 0x00104201,
-- 0x00104201, 0x4803c857, 0x42000000, 0x0000000c,
-+ 0x0c01f001, 0x001040a1, 0x00104129, 0x00104179,
-+ 0x00104184, 0x0010418f, 0x0010409d, 0x0010409d,
-+ 0x0010409d, 0x0010419f, 0x001041fd, 0x00104222,
-+ 0x0010409d, 0x0010409d, 0x0010409d, 0x0010409d,
-+ 0x0010409d, 0x4803c857, 0x42000000, 0x0000000c,
- 0x0401f183, 0x592c1008, 0x82081500, 0x00ffffff,
-- 0x59a80010, 0x80084d80, 0x42000000, 0x00000010,
-- 0x0400017b, 0x0201f800, 0x00104768, 0x04000036,
-+ 0x59a8000f, 0x80084d80, 0x42000000, 0x00000010,
-+ 0x0400017b, 0x0201f800, 0x00104641, 0x04000036,
- 0x4803c857, 0x82004d80, 0x0000001d, 0x0402001a,
-- 0x0201f800, 0x00105439, 0x59340405, 0x4c000000,
-- 0x0201f800, 0x00104836, 0x5c000000, 0x04000004,
-+ 0x0201f800, 0x001052d5, 0x59340405, 0x4c000000,
-+ 0x0201f800, 0x00104719, 0x5c000000, 0x04000004,
- 0x8c20450a, 0x04000028, 0x80000580, 0x44002800,
- 0x59340008, 0x48002802, 0x59340009, 0x48002801,
- 0x59340006, 0x48002804, 0x59340007, 0x48002803,
-- 0x4200b000, 0x00000005, 0x0201f800, 0x00109328,
-+ 0x4200b000, 0x00000005, 0x0201f800, 0x00108da5,
- 0x0401f18c, 0x4803c857, 0x82004d80, 0x0000001a,
- 0x04020003, 0x40101000, 0x0401f15c, 0x4803c857,
- 0x82004d80, 0x0000001b, 0x04020003, 0x40181000,
- 0x0401f156, 0x4803c857, 0x82004d80, 0x0000001c,
- 0x04000157, 0x82004d80, 0x00000019, 0x42000000,
- 0x0000000a, 0x04000146, 0x42000000, 0x0000000a,
-- 0x0402015d, 0x59a8006f, 0x8c000502, 0x0400001b,
-- 0x0201f800, 0x00104836, 0x04000018, 0x59340212,
-+ 0x0402015d, 0x59a8006c, 0x8c000502, 0x0400001b,
-+ 0x0201f800, 0x00104719, 0x04000018, 0x59340212,
- 0x82000500, 0x0000ff00, 0x42001000, 0x00000010,
-- 0x0402000c, 0x42001000, 0x00000008, 0x59a80026,
-+ 0x0402000c, 0x42001000, 0x00000008, 0x59a80023,
- 0x8c000506, 0x04020009, 0x59340002, 0x82000500,
- 0x00ff0000, 0x82000580, 0x00ff0000, 0x04000007,
-- 0x0201f800, 0x00104ada, 0x42000000, 0x0000001c,
-- 0x40181000, 0x0402012d, 0x0201f800, 0x00020892,
-+ 0x0201f800, 0x001049da, 0x42000000, 0x0000001c,
-+ 0x40181000, 0x0402012d, 0x0201f800, 0x00020799,
- 0x04000137, 0x49366009, 0x492e6008, 0x4a026406,
- 0x00000001, 0x8c20450a, 0x04000004, 0x592c0404,
- 0x8400055c, 0x48025c04, 0x4c200000, 0x4d3c0000,
-- 0x42027800, 0x00001800, 0x0201f800, 0x00101de2,
-+ 0x42027800, 0x00001800, 0x0201f800, 0x0010caa0,
- 0x5c027800, 0x5c004000, 0x8c204512, 0x0400000b,
- 0x599c0018, 0x8c000518, 0x04000008, 0x592c0009,
- 0x82000500, 0x00000380, 0x5934080a, 0x80040d40,
-- 0x84040d54, 0x4806680a, 0x417a7800, 0x0401f93a,
-- 0x42000800, 0x00000003, 0x0401f941, 0x42027000,
-- 0x00000002, 0x0201f800, 0x000208d8, 0x80000580,
-- 0x0401f130, 0x0201f800, 0x00020267, 0x04020112,
-- 0x0201f800, 0x0010483c, 0x0400000c, 0x0201f800,
-- 0x00104836, 0x04020112, 0x4c600000, 0x4178c000,
-+ 0x84040d54, 0x4806680a, 0x417a7800, 0x0401f93e,
-+ 0x42000800, 0x00000003, 0x0401f94a, 0x42027000,
-+ 0x00000002, 0x0201f800, 0x000207df, 0x80000580,
-+ 0x0401f130, 0x0201f800, 0x0002025a, 0x04020112,
-+ 0x0201f800, 0x0010471f, 0x0400000c, 0x0201f800,
-+ 0x00104719, 0x04020112, 0x4c600000, 0x4178c000,
- 0x42027800, 0x00001800, 0x417a6000, 0x0201f800,
-- 0x00101e48, 0x5c00c000, 0x59a8006f, 0x8c000502,
-- 0x0400001b, 0x0201f800, 0x00104836, 0x04000018,
-+ 0x00101c5e, 0x5c00c000, 0x59a8006c, 0x8c000502,
-+ 0x0400001b, 0x0201f800, 0x00104719, 0x04000018,
- 0x59340212, 0x82000500, 0x0000ff00, 0x42001000,
- 0x00000010, 0x0402000c, 0x42001000, 0x00000008,
-- 0x59a80026, 0x8c000506, 0x04020009, 0x59340002,
-+ 0x59a80023, 0x8c000506, 0x04020009, 0x59340002,
- 0x82000500, 0x00ff0000, 0x82000580, 0x00ff0000,
-- 0x04000007, 0x0201f800, 0x00104ada, 0x42000000,
-+ 0x04000007, 0x0201f800, 0x001049da, 0x42000000,
- 0x0000001c, 0x40181000, 0x040200d4, 0x0201f800,
-- 0x00020892, 0x040000de, 0x5934080a, 0x8c204512,
-+ 0x00020799, 0x040000de, 0x5934080a, 0x8c204512,
- 0x0400000c, 0x599c0018, 0x8c000518, 0x04000009,
- 0x592c0009, 0x82000500, 0x00000380, 0x82041500,
- 0xfffffc7f, 0x80080d40, 0x84040d54, 0x0401f002,
- 0x84040d14, 0x4806680a, 0x49366009, 0x492e6008,
-- 0x4a026406, 0x00000001, 0x417a7800, 0x0401f8ea,
-- 0x42000800, 0x00000005, 0x0401f8f1, 0x42027000,
-- 0x00000003, 0x0201f800, 0x000208d8, 0x80000580,
-- 0x0401f0e0, 0x0201f800, 0x00020267, 0x040200c2,
-- 0x0201f800, 0x0010484b, 0x040200c5, 0x0201f800,
-- 0x001092e0, 0x040000b6, 0x80000580, 0x0401f0d5,
-- 0x0201f800, 0x00020267, 0x040200b7, 0x0201f800,
-- 0x0010484b, 0x040200ba, 0x0201f800, 0x00108ea3,
-+ 0x4a026406, 0x00000001, 0x417a7800, 0x0401f8ee,
-+ 0x42000800, 0x00000005, 0x0401f8fa, 0x42027000,
-+ 0x00000003, 0x0201f800, 0x000207df, 0x80000580,
-+ 0x0401f0e0, 0x0201f800, 0x0002025a, 0x040200c2,
-+ 0x0201f800, 0x0010472e, 0x040200c5, 0x0201f800,
-+ 0x00108d5d, 0x040000b6, 0x80000580, 0x0401f0d5,
-+ 0x0201f800, 0x0002025a, 0x040200b7, 0x0201f800,
-+ 0x0010472e, 0x040200ba, 0x0201f800, 0x001088fa,
- 0x040000ab, 0x80000580, 0x0401f0ca, 0x0201f800,
-- 0x00020267, 0x040200ac, 0x83444d80, 0x000007fe,
-+ 0x0002025a, 0x040200ac, 0x83444d80, 0x000007fe,
- 0x42000000, 0x0000000a, 0x0402008d, 0x0201f800,
-- 0x00104836, 0x040200aa, 0x0201f800, 0x001092f8,
-+ 0x00104719, 0x040200aa, 0x0201f800, 0x00108d75,
- 0x0400009b, 0x80000580, 0x0401f0ba, 0x82200500,
- 0x00000070, 0x04020005, 0x8c20450e, 0x42000000,
- 0x0000000c, 0x0402007e, 0x8c20450a, 0x0400000d,
- 0x4d3c0000, 0x42027800, 0x00001000, 0x8c20450e,
- 0x04020002, 0x853e7d56, 0x82200500, 0x000000a0,
-- 0x0201f800, 0x00104822, 0x5c027800, 0x0401f0a1,
-+ 0x0201f800, 0x001046fc, 0x5c027800, 0x0401f0a1,
- 0x8c204508, 0x04020024, 0x592c1008, 0x82081500,
-- 0x00ffffff, 0x59a80010, 0x80084d80, 0x42000000,
-- 0x00000010, 0x04000066, 0x0201f800, 0x00104768,
-+ 0x00ffffff, 0x59a8000f, 0x80084d80, 0x42000000,
-+ 0x00000010, 0x04000066, 0x0201f800, 0x00104641,
- 0x0400002b, 0x4803c857, 0x82004d80, 0x0000001a,
- 0x04020003, 0x40101000, 0x0401f064, 0x4803c857,
- 0x82004d80, 0x0000001b, 0x04020003, 0x40181000,
- 0x0401f05e, 0x4803c857, 0x82004d80, 0x0000001c,
- 0x0400005f, 0x82004d80, 0x00000019, 0x42000000,
- 0x0000000a, 0x0400004e, 0x42000000, 0x0000000a,
-- 0x0401f065, 0x0201f800, 0x00020267, 0x04020062,
-+ 0x0401f065, 0x0201f800, 0x0002025a, 0x04020062,
- 0x4d3c0000, 0x42027800, 0x00001000, 0x8c20450e,
- 0x04020002, 0x853e7d56, 0x82200500, 0x00000090,
-- 0x0201f800, 0x0010480a, 0x5c027800, 0x42000000,
-+ 0x0201f800, 0x001046e4, 0x5c027800, 0x42000000,
- 0x0000000a, 0x0402003a, 0x0401f06a, 0x836c0580,
- 0x00000003, 0x42000800, 0x00000007, 0x04020006,
-- 0x0201f800, 0x0010928e, 0x04000007, 0x80000580,
-- 0x0401f064, 0x0201f800, 0x00104871, 0x04000059,
-- 0x0401f05c, 0x0201f800, 0x00104871, 0x0400003c,
-- 0x0401f058, 0x0201f800, 0x00020267, 0x0402003e,
-+ 0x0201f800, 0x00108d0b, 0x04000007, 0x80000580,
-+ 0x0401f064, 0x0201f800, 0x0010475d, 0x04000059,
-+ 0x0401f05c, 0x0201f800, 0x0010475d, 0x0400003c,
-+ 0x0401f058, 0x0201f800, 0x0002025a, 0x0402003e,
- 0x836c0580, 0x00000003, 0x04020048, 0x8c204508,
- 0x0400000a, 0x4c600000, 0x4178c000, 0x42027800,
-- 0x00001800, 0x417a6000, 0x0201f800, 0x00101e48,
-- 0x5c00c000, 0x0401f047, 0x0201f800, 0x0010483c,
-- 0x0400000c, 0x0201f800, 0x00104836, 0x04020030,
-+ 0x00001800, 0x417a6000, 0x0201f800, 0x00101c5e,
-+ 0x5c00c000, 0x0401f047, 0x0201f800, 0x0010471f,
-+ 0x0400000c, 0x0201f800, 0x00104719, 0x04020030,
- 0x4c600000, 0x4178c000, 0x42027800, 0x00001800,
-- 0x417a6000, 0x0201f800, 0x00101e48, 0x5c00c000,
-- 0x480bc856, 0x0201f800, 0x001090f8, 0x04000018,
-+ 0x417a6000, 0x0201f800, 0x00101c5e, 0x5c00c000,
-+ 0x480bc856, 0x0201f800, 0x00108b70, 0x04000018,
- 0x80000580, 0x0401f037, 0x0401f7db, 0x480bc857,
- 0x42000800, 0x00000019, 0x40001000, 0x4200b000,
- 0x00000002, 0x0401f00a, 0x480bc857, 0x40000800,
-@@ -4387,301 +4285,321 @@ uint32_t risc_code01[] = {
- 0x00000007, 0x4200b000, 0x00000001, 0x0401f7e4,
- 0x480bc857, 0x4200b000, 0x00000001, 0x0401f7e0,
- 0x80028580, 0x4178b000, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
- 0x1c01f000, 0x4937c857, 0x59326809, 0x59341200,
- 0x813e79c0, 0x04000003, 0x84081540, 0x0401f002,
-- 0x84081500, 0x480a6a00, 0x1c01f000, 0x59326809,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4937c857,
-- 0x82040580, 0x00000006, 0x04020004, 0x42000000,
-- 0x00000606, 0x0401f021, 0x82040580, 0x00000004,
-- 0x04020004, 0x42000000, 0x00000404, 0x0401f01b,
-- 0x82040580, 0x00000007, 0x42000000, 0x00000707,
-- 0x04000016, 0x82040580, 0x00000003, 0x42000000,
-- 0x00000703, 0x04000011, 0x82040580, 0x00000005,
-- 0x42000000, 0x00000405, 0x0400000c, 0x82040580,
-- 0x00000009, 0x42000000, 0x00000409, 0x04000007,
-- 0x82040580, 0x0000000b, 0x42000000, 0x0000070b,
-- 0x02020800, 0x00100615, 0x4803c857, 0x48026c00,
-- 0x82040d80, 0x00000006, 0x04020005, 0x59341404,
-- 0x800811c0, 0x02000800, 0x00100615, 0x1c01f000,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4947c857,
-- 0x481bc857, 0x83440480, 0x00000800, 0x04021034,
-- 0x83441400, 0x0010aa00, 0x50080000, 0x80026d40,
-- 0x04020011, 0x4c180000, 0x4d2c0000, 0x0201f800,
-- 0x00100819, 0x412e6800, 0x5c025800, 0x5c003000,
-- 0x04000027, 0x45341000, 0x497a680d, 0x497a6810,
-- 0x497a680f, 0x497a680e, 0x4c180000, 0x0401fccd,
-- 0x5c003000, 0x59340a12, 0x4c040000, 0x0201f800,
-- 0x00104e0d, 0x5c000800, 0x04000009, 0x82180500,
-- 0x00ffff00, 0x04000008, 0x59a81010, 0x82081500,
-- 0x00ffff00, 0x80080580, 0x04000003, 0x80000580,
-- 0x0401f004, 0x82180500, 0x000000ff, 0x800000d0,
-- 0x80040d80, 0x04000003, 0x4803c857, 0x48026a12,
-- 0x59340002, 0x80180580, 0x04000003, 0x481bc857,
-- 0x481a6802, 0x80000580, 0x1c01f000, 0x4803c856,
-- 0x82000540, 0x00000001, 0x0401f7fc, 0x4947c857,
-- 0x83440480, 0x00000800, 0x04021011, 0x83441400,
-- 0x0010aa00, 0x50080000, 0x80026d40, 0x0400000b,
-- 0x0401fbf2, 0x0402000a, 0x59a80005, 0x8c000502,
-- 0x04000004, 0x59340200, 0x8c00050e, 0x04000004,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x80000580,
-- 0x0401f7fe, 0x5c000000, 0x4c000000, 0x4803c857,
-- 0x4947c857, 0x4d2c0000, 0x4d300000, 0x83440480,
-- 0x00000800, 0x04021024, 0x83441400, 0x0010aa00,
-- 0x50080000, 0x80026d40, 0x0400001b, 0x45781000,
-- 0x5934000d, 0x80025d40, 0x02020800, 0x00100843,
-- 0x59366011, 0x813261c0, 0x0400000e, 0x4c640000,
-- 0x5930c800, 0x59325808, 0x0201f800, 0x00108df4,
-- 0x02020800, 0x00100843, 0x0201f800, 0x000208b4,
-- 0x82666540, 0x00000000, 0x040207f6, 0x5c00c800,
-- 0x0201f800, 0x00104acf, 0x41365800, 0x0201f800,
-- 0x0010083b, 0x80000580, 0x5c026000, 0x5c025800,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fb,
-- 0x4937c857, 0x4c580000, 0x59cc0001, 0x82000500,
-- 0x00ffffff, 0x48026802, 0x497a6c01, 0x497a6a01,
-- 0x59340200, 0x84000502, 0x48026a00, 0x0201f800,
-- 0x00104e0d, 0x04020017, 0x59340403, 0x82000580,
-- 0x000007fe, 0x04000005, 0x59a80026, 0x8c00050a,
-- 0x04020010, 0x0401f008, 0x59cc0408, 0x8c000518,
-- 0x0400000c, 0x59cc0009, 0x48035035, 0x59cc000a,
-- 0x48035036, 0x59cc0207, 0x80000540, 0x04020003,
-- 0x42000000, 0x00000001, 0x48038893, 0x4803501e,
-- 0x59cc0a09, 0x82040d00, 0x00000010, 0x59cc0408,
-- 0x82000500, 0x00000020, 0x04000002, 0x84040d40,
-- 0x5934000a, 0x82000500, 0xffffffee, 0x80040540,
-- 0x4802680a, 0x83cca400, 0x0000000b, 0x8334ac00,
-- 0x00000006, 0x4200b000, 0x00000002, 0x0201f800,
-- 0x0010a93e, 0x83cca400, 0x0000000d, 0x8334ac00,
-- 0x00000008, 0x4200b000, 0x00000002, 0x0201f800,
-- 0x0010a93e, 0x59cc0a18, 0x82040480, 0x00000800,
-- 0x0402100c, 0x82040480, 0x00000400, 0x04001004,
-- 0x42000800, 0x00000400, 0x0401f006, 0x82040480,
-- 0x00000200, 0x04001003, 0x42000800, 0x00000200,
-- 0x42001000, 0x0010b33f, 0x58080202, 0x80041480,
-- 0x04001002, 0x40000800, 0x48066a04, 0x59340403,
-- 0x82000580, 0x000007fe, 0x04020003, 0x59cc0a08,
-- 0x48066a04, 0x0201f800, 0x00104afd, 0x5c00b000,
-- 0x1c01f000, 0x4937c857, 0x59a80026, 0x8c000508,
-- 0x04000004, 0x84000556, 0x4803c857, 0x48035026,
-- 0x59cc0207, 0x4803c857, 0x48026a05, 0x59cc020a,
-- 0x4803c857, 0x48026c05, 0x59341200, 0x599c0818,
-- 0x5934180a, 0x4807c857, 0x480bc857, 0x480fc857,
-- 0x59cc2006, 0x82102500, 0xff000000, 0x82102580,
-- 0x02000000, 0x04000007, 0x8c00050e, 0x04000009,
-- 0x8c0c1d14, 0x04000003, 0x8c0c1d0e, 0x04000005,
-- 0x8c040d18, 0x04000003, 0x8408154a, 0x0401f002,
-- 0x8408150a, 0x8c000510, 0x04000009, 0x8c0c1d14,
-- 0x04000003, 0x8c0c1d10, 0x04000005, 0x8c040d18,
-- 0x04000003, 0x8408154e, 0x0401f002, 0x8408150e,
-- 0x8c000512, 0x04000009, 0x8c0c1d14, 0x04000003,
-- 0x8c0c1d12, 0x04000005, 0x8c040d18, 0x04000003,
-- 0x8408155c, 0x0401f002, 0x8408151c, 0x480a6a00,
-- 0x1c01f000, 0x4803c856, 0x4c5c0000, 0x4d2c0000,
-- 0x4c580000, 0x5934000d, 0x80025d40, 0x04000029,
-- 0x592c0003, 0x82000480, 0x00000008, 0x0400100b,
-- 0x412cb800, 0x592c0001, 0x80025d40, 0x040207f9,
-- 0x0201f800, 0x0010082a, 0x04000037, 0x492fc857,
-- 0x492cb801, 0x0401f020, 0x832c0c00, 0x00000004,
-- 0x4200b000, 0x00000008, 0x50040000, 0x82000580,
-- 0xffffffff, 0x04020006, 0x80041000, 0x50080000,
-- 0x82000580, 0xffffffff, 0x04000007, 0x82040c00,
-- 0x00000002, 0x8058b040, 0x040207f4, 0x0201f800,
-- 0x00100615, 0x45480800, 0x454c1000, 0x592c1803,
-- 0x800c1800, 0x480e5803, 0x480fc857, 0x0401f014,
-- 0x0201f800, 0x0010082a, 0x04000017, 0x492fc857,
-- 0x492e680d, 0x497a5802, 0x4a025803, 0x00000001,
-- 0x494a5804, 0x494e5805, 0x832c0c00, 0x00000006,
-- 0x4200b000, 0x0000000e, 0x46000800, 0xffffffff,
-- 0x80040800, 0x8058b040, 0x040207fc, 0x82000540,
-- 0x00000001, 0x5c00b000, 0x5c025800, 0x5c00b800,
-- 0x1c01f000, 0x80000580, 0x0401f7fb, 0x4803c856,
-- 0x4d3c0000, 0x4d2c0000, 0x5934000d, 0x80025d40,
-- 0x0400001f, 0x592c0002, 0x80000540, 0x0402001f,
-- 0x412e7800, 0x0401f8c8, 0x0402001c, 0x46000800,
-- 0xffffffff, 0x46001000, 0xffffffff, 0x4813c857,
-- 0x480fc857, 0x580c0003, 0x82000c80, 0x00000002,
-- 0x04021014, 0x480fc857, 0x400c0000, 0x812c0580,
-- 0x04020004, 0x580c0001, 0x4802680d, 0x0401f003,
-- 0x580c0001, 0x48002001, 0x400e5800, 0x0201f800,
-- 0x0010083a, 0x82000540, 0x00000001, 0x5c025800,
-- 0x5c027800, 0x1c01f000, 0x80000580, 0x0401f7fc,
-- 0x80000040, 0x48001803, 0x4803c857, 0x0401f7f6,
-- 0x0201f800, 0x00020087, 0x59300007, 0x8400054e,
-- 0x48026007, 0x592c1a04, 0x820c1d00, 0x000000ff,
-- 0x820c0580, 0x00000048, 0x04000013, 0x0201f000,
-- 0x000202b0, 0x8c000500, 0x02020800, 0x000200e6,
-- 0x4a026203, 0x00000002, 0x592c1a04, 0x820c1d00,
-- 0x000000ff, 0x820c0580, 0x00000018, 0x02000000,
-- 0x000202b0, 0x820c0580, 0x00000048, 0x02020000,
-- 0x000202b0, 0x42000800, 0x80000804, 0x0201f800,
-- 0x00106466, 0x0201f000, 0x000202b9, 0x4a025a06,
-- 0x00000008, 0x0201f000, 0x00020381, 0x4a025a06,
-- 0x00000029, 0x0201f000, 0x00020381, 0x4a025a06,
-- 0x0000002a, 0x0201f000, 0x00020381, 0x4a025a06,
-- 0x00000028, 0x0201f000, 0x00020381, 0x4943c857,
-- 0x4d440000, 0x4d340000, 0x4d2c0000, 0x4c580000,
-+ 0x84081500, 0x480a6a00, 0x1c01f000, 0x4c000000,
-+ 0x40680800, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x59326809, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x4937c857, 0x82040580, 0x00000006, 0x04020004,
-+ 0x42000000, 0x00000606, 0x0401f021, 0x82040580,
-+ 0x00000004, 0x04020004, 0x42000000, 0x00000404,
-+ 0x0401f01b, 0x82040580, 0x00000007, 0x42000000,
-+ 0x00000707, 0x04000016, 0x82040580, 0x00000003,
-+ 0x42000000, 0x00000703, 0x04000011, 0x82040580,
-+ 0x00000005, 0x42000000, 0x00000405, 0x0400000c,
-+ 0x82040580, 0x00000009, 0x42000000, 0x00000409,
-+ 0x04000007, 0x82040580, 0x0000000b, 0x42000000,
-+ 0x0000070b, 0x02020800, 0x001004ef, 0x4803c857,
-+ 0x48026c00, 0x82040d80, 0x00000006, 0x04020005,
-+ 0x59341404, 0x800811c0, 0x02000800, 0x001004ef,
-+ 0x1c01f000, 0x4c000000, 0x40683000, 0x0401f80e,
-+ 0x41358800, 0x04000002, 0x41798800, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x40683000, 0x0401f80b,
-+ 0x41358800, 0x04000002, 0x41798800, 0x5c000000,
-+ 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x4947c857, 0x481bc857, 0x83440480, 0x00000800,
-+ 0x04021034, 0x83441400, 0x0010a400, 0x50080000,
-+ 0x80026d40, 0x04020011, 0x4c180000, 0x4d2c0000,
-+ 0x0201f800, 0x00100704, 0x412e6800, 0x5c025800,
-+ 0x5c003000, 0x04000027, 0x45341000, 0x497a680d,
-+ 0x497a6810, 0x497a680f, 0x497a680e, 0x4c180000,
-+ 0x0401fcb4, 0x5c003000, 0x59340a12, 0x4c040000,
-+ 0x0201f800, 0x00104ca6, 0x5c000800, 0x04000009,
-+ 0x82180500, 0x00ffff00, 0x04000008, 0x59a8100f,
-+ 0x82081500, 0x00ffff00, 0x80080580, 0x04000003,
-+ 0x80000580, 0x0401f004, 0x82180500, 0x000000ff,
-+ 0x800000d0, 0x80040d80, 0x04000003, 0x4803c857,
-+ 0x48026a12, 0x59340002, 0x80180580, 0x04000003,
-+ 0x481bc857, 0x481a6802, 0x80000580, 0x1c01f000,
-+ 0x4803c856, 0x82000540, 0x00000001, 0x0401f7fc,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04020003, 0x42018800, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x4947c857, 0x83440480, 0x00000800,
-+ 0x04021011, 0x83441400, 0x0010a400, 0x50080000,
-+ 0x80026d40, 0x0400000b, 0x0201f800, 0x00104719,
-+ 0x04020009, 0x8d0e1d02, 0x04000004, 0x59340200,
-+ 0x8c00050e, 0x04000004, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x80000580, 0x0401f7fe, 0x5c000000,
-+ 0x4c000000, 0x4803c857, 0x4947c857, 0x4d2c0000,
-+ 0x4d300000, 0x83440480, 0x00000800, 0x04021024,
-+ 0x83441400, 0x0010a400, 0x50080000, 0x80026d40,
-+ 0x0400001b, 0x45781000, 0x5934000d, 0x80025d40,
-+ 0x02020800, 0x0010073b, 0x59366011, 0x813261c0,
-+ 0x0400000e, 0x4c640000, 0x5930c800, 0x59325808,
-+ 0x0201f800, 0x0010883d, 0x02020800, 0x0010073b,
-+ 0x0201f800, 0x000207bb, 0x82666540, 0x00000000,
-+ 0x040207f6, 0x5c00c800, 0x0201f800, 0x001049c5,
-+ 0x41365800, 0x0201f800, 0x0010072f, 0x80000580,
-+ 0x5c026000, 0x5c025800, 0x1c01f000, 0x82000540,
-+ 0x00000001, 0x0401f7fb, 0x4c000000, 0x0201f800,
-+ 0x0002025a, 0x41358800, 0x04000002, 0x41798800,
-+ 0x5c000000, 0x1c01f000, 0x4c580000, 0x59cc0001,
-+ 0x4937c857, 0x82000500, 0x00ffffff, 0x48026802,
-+ 0x497a6c01, 0x497a6a01, 0x59340200, 0x84000502,
-+ 0x48026a00, 0x0201f800, 0x00104ca6, 0x04020017,
-+ 0x59340403, 0x82000580, 0x000007fe, 0x04000005,
-+ 0x59a80023, 0x8c00050a, 0x04020010, 0x0401f008,
-+ 0x59cc0408, 0x8c000518, 0x0400000c, 0x59cc0009,
-+ 0x48035032, 0x59cc000a, 0x48035033, 0x59cc0207,
-+ 0x80000540, 0x04020003, 0x42000000, 0x00000001,
-+ 0x48038893, 0x4803501d, 0x59cc0a09, 0x82040d00,
-+ 0x00000010, 0x59cc0408, 0x82000500, 0x00000020,
-+ 0x04000002, 0x84040d40, 0x5934000a, 0x82000500,
-+ 0xffffffee, 0x80040540, 0x4802680a, 0x83cca400,
-+ 0x0000000b, 0x8334ac00, 0x00000006, 0x4200b000,
-+ 0x00000002, 0x0201f800, 0x0010a330, 0x83cca400,
-+ 0x0000000d, 0x8334ac00, 0x00000008, 0x4200b000,
-+ 0x00000002, 0x0201f800, 0x0010a330, 0x59cc0a18,
-+ 0x82040480, 0x00000800, 0x0402100c, 0x82040480,
-+ 0x00000400, 0x04001004, 0x42000800, 0x00000400,
-+ 0x0401f006, 0x82040480, 0x00000200, 0x04001003,
-+ 0x42000800, 0x00000200, 0x42001000, 0x0010ad10,
-+ 0x58080201, 0x80041480, 0x04001002, 0x40000800,
-+ 0x48066a04, 0x59340403, 0x82000580, 0x000007fe,
-+ 0x04020003, 0x59cc0a08, 0x48066a04, 0x0201f800,
-+ 0x001049fd, 0x5c00b000, 0x1c01f000, 0x59a80023,
-+ 0x4937c857, 0x8c000508, 0x04000004, 0x84000556,
-+ 0x4803c857, 0x48035023, 0x59cc0207, 0x4803c857,
-+ 0x48026a05, 0x59cc020a, 0x4803c857, 0x48026c05,
-+ 0x59341200, 0x599c0818, 0x5934180a, 0x4807c857,
-+ 0x480bc857, 0x480fc857, 0x59cc2006, 0x82102500,
-+ 0xff000000, 0x82102580, 0x02000000, 0x04000007,
-+ 0x8c00050e, 0x04000009, 0x8c0c1d14, 0x04000003,
-+ 0x8c0c1d0e, 0x04000005, 0x8c040d18, 0x04000003,
-+ 0x8408154a, 0x0401f002, 0x8408150a, 0x8c000510,
-+ 0x04000009, 0x8c0c1d14, 0x04000003, 0x8c0c1d10,
-+ 0x04000005, 0x8c040d18, 0x04000003, 0x8408154e,
-+ 0x0401f002, 0x8408150e, 0x8c000512, 0x04000009,
-+ 0x8c0c1d14, 0x04000003, 0x8c0c1d12, 0x04000005,
-+ 0x8c040d18, 0x04000003, 0x8408155c, 0x0401f002,
-+ 0x8408151c, 0x480a6a00, 0x1c01f000, 0x4803c856,
-+ 0x4c5c0000, 0x4d2c0000, 0x4c580000, 0x5934000d,
-+ 0x80025d40, 0x04000029, 0x592c0003, 0x82000480,
-+ 0x00000008, 0x0400100b, 0x412cb800, 0x592c0001,
-+ 0x80025d40, 0x040207f9, 0x0201f800, 0x0010071a,
-+ 0x04000037, 0x492fc857, 0x492cb801, 0x0401f020,
-+ 0x832c0c00, 0x00000004, 0x4200b000, 0x00000008,
-+ 0x50040000, 0x82000580, 0xffffffff, 0x04020006,
-+ 0x80041000, 0x50080000, 0x82000580, 0xffffffff,
-+ 0x04000007, 0x82040c00, 0x00000002, 0x8058b040,
-+ 0x040207f4, 0x0201f800, 0x001004ef, 0x45480800,
-+ 0x454c1000, 0x592c1803, 0x800c1800, 0x480e5803,
-+ 0x480fc857, 0x0401f014, 0x0201f800, 0x0010071a,
-+ 0x04000017, 0x492fc857, 0x492e680d, 0x497a5802,
-+ 0x4a025803, 0x00000001, 0x494a5804, 0x494e5805,
-+ 0x832c0c00, 0x00000006, 0x4200b000, 0x0000000e,
-+ 0x46000800, 0xffffffff, 0x80040800, 0x8058b040,
-+ 0x040207fc, 0x82000540, 0x00000001, 0x5c00b000,
-+ 0x5c025800, 0x5c00b800, 0x1c01f000, 0x80000580,
-+ 0x0401f7fb, 0x4803c856, 0x4d3c0000, 0x4d2c0000,
-+ 0x5934000d, 0x80025d40, 0x0400001f, 0x592c0002,
-+ 0x80000540, 0x0402001f, 0x412e7800, 0x0401f8d0,
-+ 0x0402001c, 0x46000800, 0xffffffff, 0x46001000,
-+ 0xffffffff, 0x4813c857, 0x480fc857, 0x580c0003,
-+ 0x82000c80, 0x00000002, 0x04021014, 0x480fc857,
-+ 0x400c0000, 0x812c0580, 0x04020004, 0x580c0001,
-+ 0x4802680d, 0x0401f003, 0x580c0001, 0x48002001,
-+ 0x400e5800, 0x0201f800, 0x0010072e, 0x82000540,
-+ 0x00000001, 0x5c025800, 0x5c027800, 0x1c01f000,
-+ 0x80000580, 0x0401f7fc, 0x80000040, 0x48001803,
-+ 0x4803c857, 0x0401f7f6, 0x0201f800, 0x0002007b,
-+ 0x59300007, 0x8400054e, 0x48026007, 0x592c1a04,
-+ 0x820c1d00, 0x000000ff, 0x820c0580, 0x00000048,
-+ 0x04000013, 0x0201f000, 0x000202a3, 0x8c000500,
-+ 0x02020800, 0x000200da, 0x4a026203, 0x00000002,
-+ 0x592c1a04, 0x820c1d00, 0x000000ff, 0x820c0580,
-+ 0x00000018, 0x02000000, 0x000202a3, 0x820c0580,
-+ 0x00000048, 0x02020000, 0x000202a3, 0x42000800,
-+ 0x80000804, 0x0201f800, 0x0010632f, 0x0201f000,
-+ 0x000202ac, 0x4a025a06, 0x00000008, 0x0201f000,
-+ 0x000202e9, 0x4a025a06, 0x00000029, 0x0201f000,
-+ 0x000202e9, 0x4a025a06, 0x0000002a, 0x0201f000,
-+ 0x000202e9, 0x4a025a06, 0x00000028, 0x0201f000,
-+ 0x000202e9, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4943c857, 0x4d440000, 0x4d340000,
-+ 0x4d2c0000, 0x4c580000, 0x4200b000, 0x000007f0,
-+ 0x417a8800, 0x0201f800, 0x0002025a, 0x04020007,
-+ 0x8d3e7d06, 0x04000004, 0x59340200, 0x8c00050e,
-+ 0x04020002, 0x0401f817, 0x81468800, 0x8058b040,
-+ 0x040207f5, 0x83440480, 0x00000800, 0x04021008,
-+ 0x8d3e7d02, 0x04000006, 0x42028800, 0x000007f0,
-+ 0x4200b000, 0x00000010, 0x0401f7eb, 0x5c00b000,
-+ 0x5c025800, 0x5c026800, 0x5c028800, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4d2c0000, 0x41783000, 0x5936580f, 0x812e59c0,
-+ 0x04000029, 0x592c0204, 0x82000500, 0x000000ff,
-+ 0x82000580, 0x00000012, 0x04000020, 0x8d3e7d00,
-+ 0x04000003, 0x0401f83c, 0x0402001c, 0x592c2000,
-+ 0x497a5800, 0x801831c0, 0x04020009, 0x59340010,
-+ 0x812c0580, 0x04020004, 0x497a680f, 0x497a6810,
-+ 0x0401f008, 0x4812680f, 0x0401f006, 0x48103000,
-+ 0x59340010, 0x812c0580, 0x04020002, 0x481a6810,
-+ 0x4a025a04, 0x00000103, 0x49425a06, 0x497a5809,
-+ 0x0201f800, 0x001089e5, 0x0201f800, 0x000202e9,
-+ 0x40125800, 0x0401f7da, 0x412c3000, 0x592e5800,
-+ 0x0401f7d7, 0x5c025800, 0x1c01f000, 0x4803c856,
-+ 0x41781800, 0x5934000f, 0x80025d40, 0x04000010,
-+ 0x592c0005, 0x80200580, 0x592c0000, 0x04000003,
-+ 0x412c1800, 0x0401f7f9, 0x497a5800, 0x800c19c0,
-+ 0x04000008, 0x48001800, 0x80000540, 0x04020004,
-+ 0x480e6810, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x4802680f, 0x80000540, 0x040207fd, 0x497a6810,
-+ 0x0401f7f9, 0x592c0008, 0x81480580, 0x04020003,
-+ 0x592c0009, 0x814c0580, 0x1c01f000, 0x4803c856,
-+ 0x4c580000, 0x413c1800, 0x400c2000, 0x593c0002,
-+ 0x80000540, 0x04020018, 0x4200b000, 0x00000008,
-+ 0x820c0c00, 0x00000004, 0x50040000, 0x81480580,
-+ 0x04020005, 0x80041000, 0x50080000, 0x814c0580,
-+ 0x0400000d, 0x82040c00, 0x00000002, 0x8058b040,
-+ 0x040207f6, 0x400c2000, 0x580c0001, 0x80001d40,
-+ 0x040207ee, 0x82000540, 0x00000001, 0x5c00b000,
-+ 0x1c01f000, 0x80000580, 0x0401f7fd, 0x4937c857,
-+ 0x4c580000, 0x4d2c0000, 0x5934000d, 0x80025d40,
-+ 0x04020016, 0x0201f800, 0x0010071a, 0x04000010,
-+ 0x492e680d, 0x4a025802, 0x00000001, 0x497a5803,
-+ 0x832c0c00, 0x00000004, 0x4200b000, 0x00000010,
-+ 0x46000800, 0xffffffff, 0x80040800, 0x8058b040,
-+ 0x040207fc, 0x82000540, 0x00000001, 0x5c025800,
-+ 0x5c00b000, 0x1c01f000, 0x4d2c0000, 0x592e5801,
-+ 0x0201f800, 0x0010073b, 0x5c025800, 0x497a5801,
-+ 0x0401f7e9, 0x4d2c0000, 0x5936580d, 0x812e59c0,
-+ 0x04000007, 0x4937c857, 0x497a680d, 0x0201f800,
-+ 0x0010073b, 0x82000540, 0x00000001, 0x5c025800,
-+ 0x1c01f000, 0x59340405, 0x4937c857, 0x4803c857,
-+ 0x8c000508, 0x1c01f000, 0x4803c856, 0x0201f800,
-+ 0x00104ca6, 0x04000011, 0x59a80814, 0x8c040d04,
-+ 0x0402000e, 0x59a80823, 0x8c040d06, 0x0400000b,
-+ 0x83ac0400, 0x000007fe, 0x50000000, 0x80026d40,
-+ 0x04000006, 0x0401f9bc, 0x04020004, 0x59340200,
-+ 0x8400055a, 0x48026a00, 0x8d0e1d20, 0x04000015,
- 0x4200b000, 0x000007f0, 0x417a8800, 0x0201f800,
-- 0x00020267, 0x04020007, 0x8d3e7d06, 0x04000004,
-- 0x59340200, 0x8c00050e, 0x04020002, 0x0401f813,
-- 0x81468800, 0x8058b040, 0x040207f5, 0x83440480,
-- 0x00000800, 0x04021008, 0x8d3e7d02, 0x04000006,
-- 0x42028800, 0x000007f0, 0x4200b000, 0x00000010,
-- 0x0401f7eb, 0x5c00b000, 0x5c025800, 0x5c026800,
-- 0x5c028800, 0x1c01f000, 0x4d2c0000, 0x41783000,
-- 0x5936580f, 0x812e59c0, 0x04000029, 0x592c0204,
-- 0x82000500, 0x000000ff, 0x82000580, 0x00000012,
-- 0x04000020, 0x8d3e7d00, 0x04000003, 0x0401f83c,
-- 0x0402001c, 0x592c2000, 0x497a5800, 0x801831c0,
-- 0x04020009, 0x59340010, 0x812c0580, 0x04020004,
-- 0x497a680f, 0x497a6810, 0x0401f008, 0x4812680f,
-- 0x0401f006, 0x48103000, 0x59340010, 0x812c0580,
-- 0x04020002, 0x481a6810, 0x4a025a04, 0x00000103,
-- 0x49425a06, 0x497a5c09, 0x0201f800, 0x00108f7d,
-- 0x0201f800, 0x00020381, 0x40125800, 0x0401f7da,
-- 0x412c3000, 0x592e5800, 0x0401f7d7, 0x5c025800,
-- 0x1c01f000, 0x4803c856, 0x41781800, 0x5934000f,
-- 0x80025d40, 0x04000010, 0x592c0005, 0x80200580,
-- 0x592c0000, 0x04000003, 0x412c1800, 0x0401f7f9,
-- 0x497a5800, 0x800c19c0, 0x04000008, 0x48001800,
-- 0x80000540, 0x04020004, 0x480e6810, 0x82000540,
-- 0x00000001, 0x1c01f000, 0x4802680f, 0x80000540,
-- 0x040207fd, 0x497a6810, 0x0401f7f9, 0x592c0008,
-- 0x81480580, 0x04020003, 0x592c0009, 0x814c0580,
-- 0x1c01f000, 0x4803c856, 0x4c580000, 0x413c1800,
-- 0x400c2000, 0x593c0002, 0x80000540, 0x04020018,
-- 0x4200b000, 0x00000008, 0x820c0c00, 0x00000004,
-- 0x50040000, 0x81480580, 0x04020005, 0x80041000,
-- 0x50080000, 0x814c0580, 0x0400000d, 0x82040c00,
-- 0x00000002, 0x8058b040, 0x040207f6, 0x400c2000,
-- 0x580c0001, 0x80001d40, 0x040207ee, 0x82000540,
-- 0x00000001, 0x5c00b000, 0x1c01f000, 0x80000580,
-- 0x0401f7fd, 0x4937c857, 0x4c580000, 0x4d2c0000,
-- 0x5934000d, 0x80025d40, 0x04020016, 0x0201f800,
-- 0x0010082a, 0x04000010, 0x492e680d, 0x4a025802,
-- 0x00000001, 0x497a5803, 0x832c0c00, 0x00000004,
-- 0x4200b000, 0x00000010, 0x46000800, 0xffffffff,
-- 0x80040800, 0x8058b040, 0x040207fc, 0x82000540,
-- 0x00000001, 0x5c025800, 0x5c00b000, 0x1c01f000,
-- 0x4d2c0000, 0x592e5801, 0x0201f800, 0x00100843,
-- 0x5c025800, 0x0401f7ea, 0x4d2c0000, 0x5936580d,
-- 0x812e59c0, 0x04000007, 0x4937c857, 0x497a680d,
-- 0x0201f800, 0x00100843, 0x82000540, 0x00000001,
-- 0x5c025800, 0x1c01f000, 0x59340405, 0x4937c857,
-- 0x4803c857, 0x8c000508, 0x1c01f000, 0x4803c856,
-- 0x0201f800, 0x00104e0d, 0x04000011, 0x59a80815,
-- 0x8c040d04, 0x0402000e, 0x59a80826, 0x8c040d06,
-- 0x0400000b, 0x83ac0400, 0x000007fe, 0x50000000,
-- 0x80026d40, 0x04000006, 0x0401f9a8, 0x04020004,
-- 0x59340200, 0x8400055a, 0x48026a00, 0x599c0017,
-- 0x8c000508, 0x04000015, 0x4200b000, 0x000007f0,
-- 0x417a8800, 0x0201f800, 0x00020267, 0x0402000c,
-- 0x0401f99a, 0x0402000a, 0x59a80010, 0x59340802,
-- 0x80040580, 0x82000500, 0x00ffff00, 0x04020004,
-- 0x59340200, 0x8400055a, 0x48026a00, 0x81468800,
-- 0x8058b040, 0x040207f0, 0x0401f885, 0x04000003,
-- 0x59a80836, 0x0401f006, 0x599c0017, 0x8c000508,
-- 0x04000007, 0x42000800, 0x000007d0, 0x42001000,
-- 0x001046c4, 0x0201f800, 0x00105da7, 0x1c01f000,
-- 0x4803c856, 0x4d300000, 0x4d340000, 0x4d440000,
-- 0x4d3c0000, 0x4c580000, 0x42001000, 0x001046c4,
-- 0x0201f800, 0x00105cc9, 0x59a80826, 0x8c040d06,
-- 0x04000015, 0x0401f86a, 0x04000013, 0x83ae6c00,
-- 0x000007fe, 0x51366800, 0x59340200, 0x8400051a,
-- 0x48026a00, 0x599c0017, 0x8c000508, 0x04000007,
-- 0x42000800, 0x000007d0, 0x42001000, 0x001046c4,
-- 0x0201f800, 0x00105da7, 0x0201f800, 0x00101bf0,
-- 0x0401f027, 0x4200b000, 0x000007f0, 0x80028d80,
-- 0x0201f800, 0x00020267, 0x0402001e, 0x59340200,
-- 0x8c00051a, 0x0400001b, 0x59368c03, 0x417a7800,
-+ 0x0002025a, 0x0402000c, 0x0401f9af, 0x0402000a,
-+ 0x59a8000f, 0x59340802, 0x80040580, 0x82000500,
-+ 0x00ffff00, 0x04020004, 0x59340200, 0x8400055a,
-+ 0x48026a00, 0x81468800, 0x8058b040, 0x040207f0,
-+ 0x0401f890, 0x04000003, 0x59a80833, 0x0401f005,
-+ 0x8d0e1d20, 0x04000007, 0x42000800, 0x000007d0,
-+ 0x42001000, 0x00104591, 0x0201f800, 0x00105c4d,
-+ 0x1c01f000, 0x4803c856, 0x4d300000, 0x4d340000,
-+ 0x4d440000, 0x4d3c0000, 0x4c580000, 0x42001000,
-+ 0x00104591, 0x0201f800, 0x00105b6f, 0x59a80823,
-+ 0x8c040d06, 0x04000014, 0x0401f876, 0x04000012,
-+ 0x83ae6c00, 0x000007fe, 0x51366800, 0x59340200,
-+ 0x8400051a, 0x48026a00, 0x8d0e1d20, 0x04000007,
-+ 0x42000800, 0x000007d0, 0x42001000, 0x00104591,
-+ 0x0201f800, 0x00105c4d, 0x0201f800, 0x00101add,
-+ 0x0401f02b, 0x4200b000, 0x000007f0, 0x80028d80,
-+ 0x0201f800, 0x0002025a, 0x04020022, 0x59340200,
-+ 0x8c00051a, 0x0400001f, 0x59368c03, 0x417a7800,
- 0x42028000, 0x00000029, 0x41783000, 0x0201f800,
-- 0x0010a258, 0x59340200, 0x84000558, 0x8400051a,
-+ 0x00109c1c, 0x59340200, 0x84000558, 0x8400051a,
- 0x48026a00, 0x4937c857, 0x4a026c00, 0x00000707,
-- 0x42028000, 0x00000029, 0x0201f800, 0x001067f6,
-- 0x417a7800, 0x0201f800, 0x00106543, 0x417a6000,
-- 0x0201f800, 0x0010a0da, 0x0201f800, 0x00106982,
-- 0x81468800, 0x8058b040, 0x040207de, 0x5c00b000,
-+ 0x42028000, 0x00000029, 0x0201f800, 0x00106476,
-+ 0x4df00000, 0x0201f800, 0x0010cef7, 0x417a7800,
-+ 0x0201f800, 0x0010cf9c, 0x417a6000, 0x0201f800,
-+ 0x0010d28a, 0x5c03e000, 0x02000800, 0x00106463,
-+ 0x81468800, 0x8058b040, 0x040207da, 0x5c00b000,
- 0x5c027800, 0x5c028800, 0x5c026800, 0x5c026000,
- 0x1c01f000, 0x4933c857, 0x59303809, 0x581c0200,
- 0x8400051a, 0x48003a00, 0x1c01f000, 0x42026800,
-- 0x0010b320, 0x497a680e, 0x42028800, 0x000007ff,
-- 0x0201f800, 0x001040e4, 0x4937c857, 0x4a026c00,
-+ 0x0010acf1, 0x497a680e, 0x42028800, 0x000007ff,
-+ 0x0201f800, 0x00103f80, 0x4937c857, 0x4a026c00,
- 0x00000606, 0x4a026802, 0x00ffffff, 0x4a026a04,
- 0x00000200, 0x4a026c04, 0x00000002, 0x1c01f000,
- 0x59300009, 0x50000000, 0x4933c857, 0x4803c857,
- 0x8c00050e, 0x1c01f000, 0x59300009, 0x50000000,
-- 0x8c00050a, 0x1c01f000, 0x4933c856, 0x0401f90f,
-+ 0x8c00050a, 0x1c01f000, 0x4933c856, 0x0401f922,
- 0x04000006, 0x59340400, 0x82000d00, 0x000000ff,
-- 0x82041580, 0x00000005, 0x1c01f000, 0x4d340000,
-- 0x83ac0400, 0x000007fe, 0x50000000, 0x80026d40,
-- 0x04000003, 0x59340200, 0x8c00051a, 0x5c026800,
-- 0x1c01f000, 0x4937c857, 0x493fc857, 0x59340403,
-- 0x81ac0400, 0x50000000, 0x81340580, 0x02020800,
-- 0x00100615, 0x59341200, 0x813e79c0, 0x04000003,
-- 0x8408155e, 0x0401f002, 0x8408151e, 0x480a6a00,
-- 0x1c01f000, 0x4937c857, 0x0201f800, 0x00101eb0,
-- 0x04000006, 0x59a80835, 0x42001000, 0x0010475f,
-- 0x0201f800, 0x00105da7, 0x1c01f000, 0x4937c857,
-- 0x42001000, 0x0010475f, 0x0201f800, 0x00105cc9,
-- 0x59a81026, 0x84081512, 0x480b5026, 0x1c01f000,
-- 0x4c380000, 0x4c340000, 0x4c240000, 0x4c600000,
-- 0x4008c000, 0x83440480, 0x00000800, 0x04021045,
-- 0x80002d80, 0x41442000, 0x83447400, 0x0010aa00,
-- 0x4200b000, 0x000007f0, 0x83444c80, 0x000007f0,
-- 0x04001003, 0x4200b000, 0x00000010, 0x50380000,
-- 0x80000540, 0x0402001e, 0x41440000, 0x80100580,
-- 0x04020043, 0x40102800, 0x82104c80, 0x000007f0,
-- 0x04001015, 0x82104d80, 0x000007fc, 0x04020005,
-- 0x82604d80, 0x00fffffc, 0x0402002a, 0x0401f00e,
-- 0x82104d80, 0x000007fd, 0x04020005, 0x82604d80,
-- 0x00fffffd, 0x04020023, 0x0401f007, 0x82104d80,
-- 0x000007ff, 0x0402001f, 0x82604d80, 0x00ffffff,
-- 0x0402001c, 0x84142d5e, 0x0401f029, 0x40006800,
-- 0x58343002, 0x82183500, 0x00ffffff, 0x40180000,
-- 0x80600580, 0x04020019, 0x40100000, 0x81440580,
-- 0x0402000a, 0x40366800, 0x8c204508, 0x04000053,
-- 0x0401ff8a, 0x04020051, 0x4947c857, 0x42000000,
-- 0x0000001d, 0x0401f04e, 0x4947c857, 0x480bc857,
-- 0x4823c857, 0x42000000, 0x0000001a, 0x0401f048,
-- 0x4947c857, 0x4863c857, 0x4813c857, 0x42000000,
-- 0x00000019, 0x0401f042, 0x40100000, 0x81440580,
-- 0x04020007, 0x58343002, 0x4947c857, 0x481bc857,
-- 0x42000000, 0x0000001b, 0x0401f039, 0x80102000,
-- 0x80387000, 0x83444c80, 0x000007f0, 0x04001009,
-- 0x82104d80, 0x00000800, 0x0402000c, 0x42002000,
-- 0x000007f0, 0x42007000, 0x0010b1f0, 0x0401f007,
-- 0x82104d80, 0x000007f0, 0x04020004, 0x41782000,
-- 0x42007000, 0x0010aa00, 0x8058b040, 0x040207a4,
-- 0x801429c0, 0x04020007, 0x0201f800, 0x00100615,
-- 0x4947c857, 0x42000000, 0x0000000a, 0x0401f01c,
-- 0x4d2c0000, 0x4c180000, 0x40603000, 0x0401fc19,
-- 0x4947c857, 0x4937c857, 0x5c003000, 0x5c025800,
-- 0x040207f4, 0x497a6a12, 0x59a80026, 0x8c00050a,
-- 0x0402000d, 0x82600500, 0x00ffff00, 0x04000006,
-- 0x59a84810, 0x82244d00, 0x00ffff00, 0x80240580,
-- 0x04020005, 0x82600500, 0x000000ff, 0x800000d0,
-- 0x48026a12, 0x48626802, 0x80000580, 0x80000540,
-- 0x5c00c000, 0x5c004800, 0x5c006800, 0x5c007000,
-- 0x1c01f000, 0x5934000f, 0x5934140b, 0x80081040,
-- 0x04001002, 0x480a6c0b, 0x80000540, 0x02020800,
-- 0x00020275, 0x1c01f000, 0x4803c857, 0x4947c857,
-- 0x4c300000, 0x82006500, 0x00000030, 0x04000006,
-- 0x4c000000, 0x0201f800, 0x001091f3, 0x5c000000,
-- 0x0402000b, 0x8c00050e, 0x04000006, 0x0201f800,
-- 0x00020267, 0x04020006, 0x4937c857, 0x0401fc36,
-- 0x80000580, 0x5c006000, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401f7fc, 0x4803c857, 0x4c580000,
-- 0x4d440000, 0x40001000, 0x80000d80, 0x4200b000,
-- 0x000007f0, 0x4c040000, 0x40068800, 0x4c080000,
-- 0x40080000, 0x0401ffdd, 0x5c001000, 0x5c000800,
-- 0x80040800, 0x8058b040, 0x040207f7, 0x5c028800,
-- 0x5c00b000, 0x1c01f000, 0x4c5c0000, 0x59340400,
-- 0x8200bd80, 0x00000606, 0x5c00b800, 0x1c01f000,
-- 0x4c5c0000, 0x59340400, 0x8200bd80, 0x00000404,
-- 0x5c00b800, 0x1c01f000, 0x4c5c0000, 0x59340400,
-- 0x8200bd80, 0x00000404, 0x04000003, 0x8200bd80,
-+ 0x82041580, 0x00000005, 0x1c01f000, 0x4c000000,
-+ 0x0401f808, 0x42018800, 0x00000001, 0x04020003,
-+ 0x42018800, 0x00000000, 0x5c000000, 0x1c01f000,
-+ 0x4d340000, 0x83ac0400, 0x000007fe, 0x50000000,
-+ 0x80026d40, 0x04000003, 0x59340200, 0x8c00051a,
-+ 0x5c026800, 0x1c01f000, 0x4937c857, 0x493fc857,
-+ 0x59340403, 0x81ac0400, 0x50000000, 0x81340580,
-+ 0x02020800, 0x001004ef, 0x59341200, 0x813e79c0,
-+ 0x04000003, 0x8408155e, 0x0401f002, 0x8408151e,
-+ 0x480a6a00, 0x1c01f000, 0x4937c857, 0x0201f800,
-+ 0x00101cd8, 0x04000006, 0x59a80832, 0x42001000,
-+ 0x00104638, 0x0201f800, 0x00105c4d, 0x1c01f000,
-+ 0x4937c857, 0x42001000, 0x00104638, 0x0201f800,
-+ 0x00105b6f, 0x59a81023, 0x84081512, 0x480b5023,
-+ 0x1c01f000, 0x4c380000, 0x4c340000, 0x4c240000,
-+ 0x4c600000, 0x4008c000, 0x83440480, 0x00000800,
-+ 0x04021045, 0x80002d80, 0x41442000, 0x83447400,
-+ 0x0010a400, 0x4200b000, 0x000007f0, 0x83444c80,
-+ 0x000007f0, 0x04001003, 0x4200b000, 0x00000010,
-+ 0x50380000, 0x80000540, 0x0402001e, 0x41440000,
-+ 0x80100580, 0x04020043, 0x40102800, 0x82104c80,
-+ 0x000007f0, 0x04001015, 0x82104d80, 0x000007fc,
-+ 0x04020005, 0x82604d80, 0x00fffffc, 0x0402002a,
-+ 0x0401f00e, 0x82104d80, 0x000007fd, 0x04020005,
-+ 0x82604d80, 0x00fffffd, 0x04020023, 0x0401f007,
-+ 0x82104d80, 0x000007ff, 0x0402001f, 0x82604d80,
-+ 0x00ffffff, 0x0402001c, 0x84142d5e, 0x0401f029,
-+ 0x40006800, 0x58343002, 0x82183500, 0x00ffffff,
-+ 0x40180000, 0x80600580, 0x04020019, 0x40100000,
-+ 0x81440580, 0x0402000a, 0x40366800, 0x8c204508,
-+ 0x04000054, 0x0401ff81, 0x04020052, 0x4947c857,
-+ 0x42000000, 0x0000001d, 0x0401f04f, 0x4947c857,
-+ 0x480bc857, 0x4823c857, 0x42000000, 0x0000001a,
-+ 0x0401f049, 0x4947c857, 0x4863c857, 0x4813c857,
-+ 0x42000000, 0x00000019, 0x0401f043, 0x40100000,
-+ 0x81440580, 0x04020007, 0x58343002, 0x4947c857,
-+ 0x481bc857, 0x42000000, 0x0000001b, 0x0401f03a,
-+ 0x80102000, 0x80387000, 0x83444c80, 0x000007f0,
-+ 0x04001009, 0x82104d80, 0x00000800, 0x0402000c,
-+ 0x42002000, 0x000007f0, 0x42007000, 0x0010abf0,
-+ 0x0401f007, 0x82104d80, 0x000007f0, 0x04020004,
-+ 0x41782000, 0x42007000, 0x0010a400, 0x8058b040,
-+ 0x040207a4, 0x801429c0, 0x04020007, 0x0201f800,
-+ 0x001004ef, 0x4947c857, 0x42000000, 0x0000000a,
-+ 0x0401f01d, 0x4d2c0000, 0x4c180000, 0x40603000,
-+ 0x0201f800, 0x001042b1, 0x4947c857, 0x4937c857,
-+ 0x5c003000, 0x5c025800, 0x040207f3, 0x497a6a12,
-+ 0x59a80023, 0x8c00050a, 0x0402000d, 0x82600500,
-+ 0x00ffff00, 0x04000006, 0x59a8480f, 0x82244d00,
-+ 0x00ffff00, 0x80240580, 0x04020005, 0x82600500,
-+ 0x000000ff, 0x800000d0, 0x48026a12, 0x48626802,
-+ 0x80000580, 0x80000540, 0x5c00c000, 0x5c004800,
-+ 0x5c006800, 0x5c007000, 0x1c01f000, 0x5934000f,
-+ 0x5934140b, 0x80081040, 0x04001002, 0x480a6c0b,
-+ 0x80000540, 0x02020800, 0x00020268, 0x1c01f000,
-+ 0x4803c857, 0x4947c857, 0x4c300000, 0x82006500,
-+ 0x00000030, 0x04000006, 0x4c000000, 0x0201f800,
-+ 0x00108c70, 0x5c000000, 0x0402000b, 0x8c00050e,
-+ 0x04000006, 0x0201f800, 0x0002025a, 0x04020006,
-+ 0x4937c857, 0x0401fc1a, 0x80000580, 0x5c006000,
-+ 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fc,
-+ 0x4803c857, 0x4c580000, 0x4d440000, 0x40001000,
-+ 0x80000d80, 0x4200b000, 0x000007f0, 0x4c040000,
-+ 0x40068800, 0x4c080000, 0x40080000, 0x0401ffdd,
-+ 0x5c001000, 0x5c000800, 0x80040800, 0x8058b040,
-+ 0x040207f7, 0x5c028800, 0x5c00b000, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x4c5c0000, 0x59340400, 0x8200bd80,
- 0x00000606, 0x5c00b800, 0x1c01f000, 0x4c5c0000,
-- 0x4c600000, 0x59340400, 0x8200bd00, 0x0000ff00,
-- 0x825cc580, 0x00000400, 0x04000003, 0x825cc580,
-- 0x00000600, 0x5c00c000, 0x5c00b800, 0x1c01f000,
-+ 0x59340400, 0x8200bd80, 0x00000404, 0x5c00b800,
-+ 0x1c01f000, 0x4c5c0000, 0x59340400, 0x8200bd80,
-+ 0x00000404, 0x04000003, 0x8200bd80, 0x00000606,
-+ 0x5c00b800, 0x1c01f000, 0x4c5c0000, 0x4c600000,
-+ 0x59340400, 0x8200bd00, 0x0000ff00, 0x825cc580,
-+ 0x00000400, 0x04000003, 0x825cc580, 0x00000600,
-+ 0x5c00c000, 0x5c00b800, 0x1c01f000, 0x4c000000,
-+ 0x0401f808, 0x42018800, 0x00000001, 0x04000003,
-+ 0x42018800, 0x00000000, 0x5c000000, 0x1c01f000,
- 0x4c5c0000, 0x59340400, 0x82000500, 0x000000ff,
- 0x8200bd80, 0x00000003, 0x04000003, 0x8200bd80,
- 0x00000005, 0x5c00b800, 0x1c01f000, 0x5c000000,
-@@ -4691,23 +4609,23 @@ uint32_t risc_code01[] = {
- 0x1c01f000, 0x4c040000, 0x4c080000, 0x592c0207,
- 0x8c00050c, 0x0400000f, 0x592e8c06, 0x82000500,
- 0x00000080, 0x84000548, 0x4d3c0000, 0x42027800,
-- 0x00001000, 0x0401ff8d, 0x5c027800, 0x82000540,
-+ 0x00001000, 0x0401ff7b, 0x5c027800, 0x82000540,
- 0x00000001, 0x5c001000, 0x5c000800, 0x1c01f000,
- 0x80000580, 0x0401f7fc, 0x592c040b, 0x82000500,
- 0x0000e000, 0x82000580, 0x00006000, 0x04000019,
- 0x836c0580, 0x00000003, 0x04000016, 0x836c0580,
-- 0x00000002, 0x04020106, 0x59a80026, 0x82000d00,
-- 0x00000038, 0x04020005, 0x59a80832, 0x800409c0,
-+ 0x00000002, 0x04020106, 0x59a80023, 0x82000d00,
-+ 0x00000038, 0x04020005, 0x59a8082f, 0x800409c0,
- 0x0400000c, 0x0401f0fe, 0x82000d00, 0x00000003,
- 0x82040d80, 0x00000003, 0x040200f9, 0x82000d00,
- 0x00000028, 0x04020003, 0x8c00050c, 0x040000f4,
- 0x592c100a, 0x82080500, 0xff000000, 0x040200d2,
-- 0x59a80010, 0x80080580, 0x040000cc, 0x592c0c0b,
-+ 0x59a8000f, 0x80080580, 0x040000cc, 0x592c0c0b,
- 0x82040d00, 0x0000e000, 0x82040480, 0x00008000,
- 0x040210cc, 0x592e8c06, 0x83440480, 0x00000800,
- 0x04001007, 0x83440580, 0x0000ffff, 0x040200b3,
- 0x800409c0, 0x040200fe, 0x0401f0b0, 0x800409c0,
-- 0x040200fb, 0x41784000, 0x0401feaa, 0x040200e2,
-+ 0x040200fb, 0x41784000, 0x0401fe97, 0x040200e2,
- 0x59342204, 0x592c000d, 0x80100480, 0x040010bc,
- 0x42027000, 0x00000053, 0x592c2409, 0x82100500,
- 0xffffff00, 0x040200aa, 0x4813c857, 0x592c000c,
-@@ -4719,37 +4637,37 @@ uint32_t risc_code01[] = {
- 0x82100580, 0x00000050, 0x04000037, 0x82100580,
- 0x00000052, 0x04000031, 0x82100580, 0x00000005,
- 0x0402006b, 0x42027000, 0x00000001, 0x0401f01b,
-- 0x42027000, 0x00000002, 0x59a8006f, 0x8c000502,
-- 0x04000016, 0x0401ff45, 0x04000014, 0x59340212,
-+ 0x42027000, 0x00000002, 0x59a8006c, 0x8c000502,
-+ 0x04000016, 0x0401ff3c, 0x04000014, 0x59340212,
- 0x82000500, 0x0000ff00, 0x42001000, 0x00000010,
-- 0x0402000c, 0x59a80026, 0x8c000506, 0x0402006f,
-+ 0x0402000c, 0x59a80023, 0x8c000506, 0x0402006f,
- 0x42001000, 0x00000008, 0x59340002, 0x82000500,
- 0x00ff0000, 0x82000580, 0x00ff0000, 0x04000003,
-- 0x0401f9d6, 0x04020065, 0x0201f800, 0x00020892,
-+ 0x0401f9ea, 0x04020065, 0x0201f800, 0x00020799,
- 0x04000081, 0x4a026406, 0x00000010, 0x49366009,
- 0x42000800, 0x00000003, 0x83380580, 0x00000002,
- 0x04000003, 0x42000800, 0x0000000b, 0x0201f800,
-- 0x001043c7, 0x0401f044, 0x42027000, 0x00000000,
-- 0x0401f003, 0x42027000, 0x00000004, 0x0401ff30,
-+ 0x0010426c, 0x0401f044, 0x42027000, 0x00000000,
-+ 0x0401f003, 0x42027000, 0x00000004, 0x0401ff27,
- 0x04020074, 0x0401f036, 0x42027000, 0x00000033,
- 0x0401f006, 0x42027000, 0x00000005, 0x0401f003,
-- 0x42027000, 0x00000003, 0x0401ff1c, 0x04020069,
-- 0x59a8006f, 0x8c000502, 0x04000016, 0x0401ff0b,
-+ 0x42027000, 0x00000003, 0x0401ff13, 0x04020069,
-+ 0x59a8006c, 0x8c000502, 0x04000016, 0x0401ff02,
- 0x04000014, 0x59340212, 0x82000500, 0x0000ff00,
-- 0x42001000, 0x00000010, 0x0402000c, 0x59a80026,
-+ 0x42001000, 0x00000010, 0x0402000c, 0x59a80023,
- 0x8c000506, 0x04020035, 0x42001000, 0x00000008,
- 0x59340002, 0x82000500, 0x00ff0000, 0x82000580,
-- 0x00ff0000, 0x04000003, 0x0401f99c, 0x0402002b,
-- 0x0201f800, 0x00020892, 0x04000047, 0x4a026406,
-+ 0x00ff0000, 0x04000003, 0x0401f9b0, 0x0402002b,
-+ 0x0201f800, 0x00020799, 0x04000047, 0x4a026406,
- 0x00000010, 0x49366009, 0x42000800, 0x00000005,
- 0x83380580, 0x00000003, 0x04000003, 0x42000800,
-- 0x00000009, 0x0201f800, 0x001043c7, 0x0401f00a,
-+ 0x00000009, 0x0201f800, 0x0010426c, 0x0401f00a,
- 0x82102580, 0x00000011, 0x04020030, 0x0201f800,
-- 0x00020892, 0x04000034, 0x4a026406, 0x00000010,
-+ 0x00020799, 0x04000034, 0x4a026406, 0x00000010,
- 0x49366009, 0x492e6008, 0x49325808, 0x813669c0,
- 0x04000007, 0x592c0c0b, 0x8c040d18, 0x04000004,
- 0x59340200, 0x84000514, 0x48026a00, 0x0201f800,
-- 0x000208d8, 0x80000580, 0x1c01f000, 0x82000540,
-+ 0x000207df, 0x80000580, 0x1c01f000, 0x82000540,
- 0x00000001, 0x0401f7fd, 0x42001000, 0x0000000a,
- 0x0401f018, 0x42001000, 0x00000010, 0x0401f015,
- 0x42001000, 0x00000016, 0x0401f012, 0x42001000,
-@@ -4765,16 +4683,16 @@ uint32_t risc_code01[] = {
- 0x00000007, 0x416c1000, 0x0401f7ec, 0x41780800,
- 0x41781000, 0x0401f7ca, 0x42028000, 0x00000000,
- 0x0401f7fb, 0x82004d80, 0x0000001d, 0x02000800,
-- 0x00100615, 0x82004d80, 0x0000001a, 0x04020004,
-+ 0x001004ef, 0x82004d80, 0x0000001a, 0x04020004,
- 0x40101000, 0x40000800, 0x0401f7dc, 0x82004d80,
- 0x0000001b, 0x04020003, 0x40181000, 0x0401f7fa,
- 0x82004d80, 0x0000001c, 0x040007f7, 0x82004d80,
- 0x00000019, 0x040007b5, 0x0401f7d6, 0x592e6008,
-- 0x0201f800, 0x001091e3, 0x040007b3, 0x59300c06,
-+ 0x0201f800, 0x00108c60, 0x040007b3, 0x59300c06,
- 0x82040580, 0x00000011, 0x040207d6, 0x83440580,
- 0x0000ffff, 0x04020005, 0x59326809, 0x813669c0,
- 0x0400000e, 0x0401f7cf, 0x592c100a, 0x82081500,
-- 0x00ffffff, 0x41784000, 0x0401fd9e, 0x040207d6,
-+ 0x00ffffff, 0x41784000, 0x0401fd8b, 0x040207d6,
- 0x59300009, 0x800001c0, 0x04000003, 0x81340580,
- 0x040207c4, 0x49366009, 0x592c0c0b, 0x82041500,
- 0x0000e000, 0x82080580, 0x00006000, 0x04000011,
-@@ -4782,2311 +4700,2057 @@ uint32_t risc_code01[] = {
- 0x59340a04, 0x592c000d, 0x80040480, 0x040017a0,
- 0x59300a03, 0x82040580, 0x00000007, 0x040207b1,
- 0x492e6008, 0x42027000, 0x00000054, 0x0401f774,
-- 0x0201f800, 0x0010a6e6, 0x040007b4, 0x0401f7a9,
-+ 0x0201f800, 0x0010a0b6, 0x040007b4, 0x0401f7a9,
- 0x492fc857, 0x592e6008, 0x4933c857, 0x0201f800,
-- 0x001091e3, 0x04000047, 0x59301406, 0x82080580,
-- 0x00000005, 0x04020061, 0x592c0207, 0x8c000500,
-- 0x04020085, 0x59a80021, 0x800001c0, 0x0402006a,
-- 0x59301203, 0x82080580, 0x00000007, 0x04020057,
-- 0x592e8c06, 0x83440480, 0x00000800, 0x04021032,
-- 0x41784000, 0x592c1009, 0x82081500, 0x00ffffff,
-- 0x0401fd60, 0x0402005f, 0x59300009, 0x800001c0,
-- 0x04000003, 0x81340580, 0x04020048, 0x4d300000,
-- 0x592e6013, 0x4933c857, 0x83300580, 0xffffffff,
-- 0x0400000d, 0x0201f800, 0x001091e3, 0x5c026000,
-- 0x04000029, 0x591c1406, 0x82080580, 0x00000006,
-- 0x04000046, 0x82080580, 0x00000011, 0x04000043,
-- 0x0401f002, 0x5c026000, 0x59a80010, 0x592c100a,
-- 0x82081500, 0x00ffffff, 0x80081580, 0x04020017,
-- 0x592c1009, 0x82081500, 0x00ffffff, 0x80081580,
-- 0x0400000f, 0x49366009, 0x492e6008, 0x42027000,
-- 0x00000092, 0x0201f800, 0x000208d8, 0x80000580,
-- 0x1c01f000, 0x42001000, 0x0000000a, 0x0401f00c,
-- 0x42001000, 0x00000010, 0x0401f009, 0x42001000,
-- 0x00000014, 0x0401f006, 0x42001000, 0x00000018,
-- 0x0401f003, 0x42001000, 0x0000003c, 0x492fc857,
-- 0x480bc857, 0x42000800, 0x00000019, 0x42028000,
-- 0x00000031, 0x82000540, 0x00000001, 0x0401f7e9,
-- 0x492fc857, 0x4803c857, 0x480bc857, 0x40000800,
-- 0x0401f7f7, 0x492fc857, 0x42000800, 0x0000000a,
-- 0x41781000, 0x0401f7f2, 0x4933c857, 0x59300406,
-- 0x4803c857, 0x59300203, 0x4803c857, 0x59300009,
-- 0x4803c857, 0x42028000, 0x00000008, 0x41780800,
-- 0x41781000, 0x0401f7e8, 0x42000800, 0x0000001e,
-- 0x0401f7f0, 0x42000800, 0x00000001, 0x0401f7ed,
-- 0x82004d80, 0x0000001d, 0x02000800, 0x00100615,
-- 0x82004d80, 0x0000001a, 0x04020003, 0x40101000,
-- 0x0401f7dc, 0x82004d80, 0x0000001b, 0x04020003,
-- 0x40181000, 0x0401f7d7, 0x82004d80, 0x0000001c,
-- 0x040007d4, 0x82004d80, 0x00000019, 0x040007d1,
-- 0x0401f7d5, 0x0201f800, 0x0010a6e6, 0x040207d7,
-- 0x42028000, 0x00000000, 0x0401f7dd, 0x5c000000,
-- 0x4c000000, 0x4803c857, 0x59302009, 0x801021c0,
-- 0x04000035, 0x58101400, 0x4813c857, 0x480bc857,
-- 0x82081d00, 0x000000ff, 0x59300c03, 0x82040580,
-- 0x00000008, 0x04000022, 0x82040580, 0x0000000a,
-- 0x04000017, 0x82040580, 0x0000000c, 0x04000010,
-- 0x82040580, 0x00000002, 0x04000019, 0x82040580,
-- 0x00000001, 0x04000012, 0x82040580, 0x00000003,
-- 0x0400000b, 0x82040580, 0x00000005, 0x04000004,
-- 0x82040580, 0x00000033, 0x04020017, 0x820c0580,
-- 0x00000009, 0x0400000d, 0x0401f013, 0x820c0580,
-- 0x00000005, 0x04000009, 0x0401f00f, 0x820c0580,
-- 0x0000000b, 0x04000005, 0x0401f00b, 0x820c0580,
-- 0x00000003, 0x04020008, 0x82081d00, 0xffffff00,
-- 0x840c01c0, 0x800c0540, 0x4807c857, 0x4803c857,
-- 0x48002400, 0x1c01f000, 0x599c0017, 0x8c00050a,
-- 0x04000003, 0x80000580, 0x1c01f000, 0x59a80026,
-- 0x82000500, 0x00000028, 0x04000008, 0x42028800,
-- 0x000007fd, 0x0201f800, 0x00020267, 0x04020003,
-- 0x5934000a, 0x8c000504, 0x1c01f000, 0x4d300000,
-- 0x5934000e, 0x80026540, 0x04000006, 0x0201f800,
-- 0x0010600e, 0x02000800, 0x001061e5, 0x497a680e,
-- 0x5c026000, 0x1c01f000, 0x4d440000, 0x4d340000,
-+ 0x00108c60, 0x0400004a, 0x59301406, 0x82080580,
-+ 0x00000005, 0x04020067, 0x592c0207, 0x8c000500,
-+ 0x0402008b, 0x8d0e1d0e, 0x04020071, 0x59301203,
-+ 0x82080580, 0x00000007, 0x0402005e, 0x592e8c06,
-+ 0x83440480, 0x00000800, 0x04021036, 0x41784000,
-+ 0x592c1009, 0x82081500, 0x00ffffff, 0x0401fd4e,
-+ 0x04020066, 0x59300009, 0x800001c0, 0x04000003,
-+ 0x81340580, 0x0402004f, 0x4d300000, 0x592e6013,
-+ 0x4933c857, 0x83300580, 0xffffffff, 0x0400000d,
-+ 0x0201f800, 0x00108c60, 0x5c026000, 0x04000030,
-+ 0x591c1406, 0x82080580, 0x00000006, 0x0400004d,
-+ 0x82080580, 0x00000011, 0x0400004a, 0x0401f002,
-+ 0x5c026000, 0x59a8000f, 0x592c100a, 0x82081500,
-+ 0x00ffffff, 0x80081580, 0x0402001e, 0x592c0809,
-+ 0x82041500, 0x00ffffff, 0x80081580, 0x04000013,
-+ 0x80040932, 0x82040580, 0x00000042, 0x04020012,
-+ 0x49366009, 0x492e6008, 0x42027000, 0x00000092,
-+ 0x0201f800, 0x000207df, 0x80000580, 0x1c01f000,
-+ 0x42001000, 0x0000000a, 0x0401f00f, 0x42001000,
-+ 0x00000010, 0x0401f00c, 0x42001000, 0x00000014,
-+ 0x0401f009, 0x42001000, 0x00000017, 0x0401f006,
-+ 0x42001000, 0x00000018, 0x0401f003, 0x42001000,
-+ 0x0000003c, 0x492fc857, 0x480bc857, 0x42000800,
-+ 0x00000019, 0x42028000, 0x00000031, 0x82000540,
-+ 0x00000001, 0x0401f7e6, 0x492fc857, 0x4803c857,
-+ 0x480bc857, 0x40000800, 0x0401f7f7, 0x492fc857,
-+ 0x42000800, 0x0000000a, 0x41781000, 0x0401f7f2,
-+ 0x4933c857, 0x59300406, 0x4803c857, 0x59300203,
-+ 0x4803c857, 0x59300009, 0x4803c857, 0x42028000,
-+ 0x00000008, 0x41780800, 0x41781000, 0x0401f7e8,
-+ 0x42000800, 0x0000001e, 0x0401f7f0, 0x42000800,
-+ 0x00000001, 0x0401f7ed, 0x82004d80, 0x0000001d,
-+ 0x02000800, 0x001004ef, 0x82004d80, 0x0000001a,
-+ 0x04020003, 0x40101000, 0x0401f7dc, 0x82004d80,
-+ 0x0000001b, 0x04020003, 0x40181000, 0x0401f7d7,
-+ 0x82004d80, 0x0000001c, 0x040007d4, 0x82004d80,
-+ 0x00000019, 0x040007d1, 0x0401f7d5, 0x0201f800,
-+ 0x0010a0b6, 0x040207d7, 0x42028000, 0x00000000,
-+ 0x0401f7dd, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x59302009, 0x801021c0, 0x04000035, 0x58101400,
-+ 0x4813c857, 0x480bc857, 0x82081d00, 0x000000ff,
-+ 0x59300c03, 0x82040580, 0x00000008, 0x04000022,
-+ 0x82040580, 0x0000000a, 0x04000017, 0x82040580,
-+ 0x0000000c, 0x04000010, 0x82040580, 0x00000002,
-+ 0x04000019, 0x82040580, 0x00000001, 0x04000012,
-+ 0x82040580, 0x00000003, 0x0400000b, 0x82040580,
-+ 0x00000005, 0x04000004, 0x82040580, 0x00000033,
-+ 0x04020017, 0x820c0580, 0x00000009, 0x0400000d,
-+ 0x0401f013, 0x820c0580, 0x00000005, 0x04000009,
-+ 0x0401f00f, 0x820c0580, 0x0000000b, 0x04000005,
-+ 0x0401f00b, 0x820c0580, 0x00000003, 0x04020008,
-+ 0x82081d00, 0xffffff00, 0x840c01c0, 0x800c0540,
-+ 0x4807c857, 0x4803c857, 0x48002400, 0x1c01f000,
-+ 0x599c0017, 0x8c00050a, 0x04000003, 0x80000580,
-+ 0x1c01f000, 0x59a80023, 0x82000500, 0x00000028,
-+ 0x04000008, 0x42028800, 0x000007fd, 0x0201f800,
-+ 0x0002025a, 0x04020003, 0x5934000a, 0x8c000504,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4d300000, 0x5934000e, 0x80026540,
-+ 0x04000006, 0x0201f800, 0x00105ec5, 0x02000800,
-+ 0x001060ac, 0x497a680e, 0x5c026000, 0x1c01f000,
-+ 0x4c000000, 0x40681000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04020003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4d440000, 0x4d340000,
- 0x80000580, 0x40001800, 0x40028800, 0x82080580,
- 0x00000008, 0x04020003, 0x42001800, 0x00000001,
-- 0x0201f800, 0x00020267, 0x0402000a, 0x0401fd4f,
-+ 0x0201f800, 0x0002025a, 0x0402000a, 0x0401fd32,
- 0x04020008, 0x800c19c0, 0x04000004, 0x59340405,
- 0x8c000508, 0x04000003, 0x80081040, 0x04000009,
- 0x81468800, 0x83440480, 0x00000800, 0x040017f1,
- 0x80000580, 0x5c026800, 0x5c028800, 0x1c01f000,
- 0x82000540, 0x00000001, 0x5c026800, 0x5c028800,
-- 0x1c01f000, 0x42000800, 0x00000001, 0x0401fb0e,
-- 0x04020034, 0x59a80026, 0x8c000508, 0x04020031,
-- 0x5934100a, 0x82081500, 0x0000e000, 0x42007000,
-- 0x0010b33f, 0x58380401, 0x8c000504, 0x0402001c,
-- 0x42000800, 0x00000001, 0x82080580, 0x00006000,
-- 0x04000024, 0x59341a04, 0x820c0480, 0x00000800,
-- 0x04001004, 0x42000800, 0x00000a00, 0x0401f009,
-- 0x820c0480, 0x00000400, 0x04001004, 0x42000800,
-- 0x00000500, 0x0401f003, 0x42000800, 0x00000200,
-- 0x82080580, 0x00002000, 0x04000002, 0x800408c2,
-- 0x82040d40, 0x00000001, 0x0401f00e, 0x42000800,
-- 0x00000008, 0x82080580, 0x00002000, 0x04020004,
-- 0x42000800, 0x00000004, 0x0401f006, 0x82080580,
-- 0x00000000, 0x04020003, 0x42000800, 0x00000002,
-- 0x48066c04, 0x1c01f000, 0x4a033020, 0x00000000,
-- 0x4a03b104, 0x80000000, 0x497b3026, 0x497b3027,
-- 0x497b3028, 0x497b3029, 0x497b302b, 0x497b3021,
-- 0x4a03b104, 0x60000001, 0x1c01f000, 0x599c0018,
-- 0x4803c856, 0x497b3024, 0x497b3025, 0x82000500,
-- 0x0000000f, 0x48033022, 0x04000008, 0x599c0216,
-- 0x82000500, 0x0000ffff, 0x04020003, 0x42000000,
-- 0x00000002, 0x48033023, 0x1c01f000, 0x0401fff0,
-+ 0x1c01f000, 0x42000800, 0x00000008, 0x59bc00e4,
-+ 0x8c000524, 0x04020032, 0x59a80023, 0x8c000508,
-+ 0x0402002f, 0x5934100a, 0x82081500, 0x0000e000,
-+ 0x42007000, 0x0010ad10, 0x58380401, 0x8c000504,
-+ 0x0402001a, 0x82080580, 0x00006000, 0x04000024,
-+ 0x59341a04, 0x820c0480, 0x00000800, 0x04001004,
-+ 0x42000800, 0x00000a00, 0x0401f009, 0x820c0480,
-+ 0x00000400, 0x04001004, 0x42000800, 0x00000500,
-+ 0x0401f003, 0x42000800, 0x00000200, 0x82080580,
-+ 0x00002000, 0x04000002, 0x800408c2, 0x82040d40,
-+ 0x00000001, 0x0401f00e, 0x42000800, 0x00000008,
-+ 0x82080580, 0x00002000, 0x04020004, 0x42000800,
-+ 0x00000004, 0x0401f006, 0x82080580, 0x00000000,
-+ 0x04020003, 0x42000800, 0x00000002, 0x48066c04,
-+ 0x1c01f000, 0x4a033012, 0x00000000, 0x4a03b104,
-+ 0x80000000, 0x497b3017, 0x497b3018, 0x4a03b104,
-+ 0x60000001, 0x1c01f000, 0x599c0018, 0x4803c856,
-+ 0x497b3015, 0x497b3016, 0x82000500, 0x0000000f,
-+ 0x48033013, 0x04000009, 0x599c0216, 0x82000500,
-+ 0x0000ffff, 0x04020003, 0x42000000, 0x00000002,
-+ 0x48033014, 0x850e1d62, 0x1c01f000, 0x0401ffef,
- 0x4a03c826, 0x00000004, 0x599c0209, 0x80000540,
-- 0x0400001f, 0x599c0207, 0x80000540, 0x04000007,
-+ 0x0400001e, 0x599c0207, 0x80000540, 0x04000007,
- 0x800000cc, 0x599c080d, 0x80040400, 0x4803b100,
- 0x497bb102, 0x59d80101, 0x599c000d, 0x4803b100,
- 0x599c000e, 0x4803b101, 0x599c0207, 0x80000540,
- 0x04020002, 0x497bb102, 0x599c0a09, 0x82040540,
-- 0x00400000, 0x59980822, 0x4803b103, 0x4a03b109,
-- 0x00000004, 0x4a03b104, 0x10000001, 0x800409c0,
-- 0x04020004, 0x4a033020, 0x00000001, 0x1c01f000,
-- 0x4a033020, 0x00000002, 0x0401f7fd, 0x592c0204,
-+ 0x00400000, 0x4803b103, 0x4a03b109, 0x00000004,
-+ 0x4a03b104, 0x10000001, 0x8d0e1d22, 0x04020004,
-+ 0x4a033012, 0x00000001, 0x1c01f000, 0x4a033012,
-+ 0x00000002, 0x0401f7fd, 0x4c000000, 0x0201f800,
-+ 0x000202e9, 0x5c000000, 0x1c01f000, 0x592c0204,
- 0x492fc857, 0x80000540, 0x04000008, 0x42034000,
-- 0x0010b2a0, 0x59a1d81e, 0x80edd9c0, 0x02000800,
-- 0x00100615, 0x0401f003, 0x5931d821, 0x58ef400b,
-- 0x58ec0009, 0x800001c0, 0x08020000, 0x0201f800,
-- 0x00100615, 0x5998002b, 0x84000540, 0x4803302b,
-- 0x0201f000, 0x00020403, 0x42000000, 0x0010b654,
-- 0x0201f800, 0x0010a86e, 0x492fc857, 0x59980026,
-- 0x59980828, 0x80000000, 0x48033026, 0x800409c0,
-- 0x492f3028, 0x04000003, 0x492c0800, 0x0401f002,
-- 0x492f3029, 0x592c0001, 0x80000d40, 0x02020000,
-- 0x000202fb, 0x1c01f000, 0x59980026, 0x59980828,
-- 0x80000000, 0x48033026, 0x492fc857, 0x800409c0,
-- 0x492f3028, 0x04000003, 0x492c0800, 0x0401f002,
-- 0x492f3029, 0x592c0001, 0x80000d40, 0x02020800,
-- 0x000202fb, 0x0402d00e, 0x59980029, 0x80025d40,
-- 0x0400000f, 0x59980026, 0x80000040, 0x48033026,
-- 0x04020002, 0x48033028, 0x592c0000, 0x48033029,
-- 0x492fc857, 0x492fb107, 0x0400d7f4, 0x42000000,
-- 0x0010b654, 0x0201f800, 0x0010a86e, 0x0402e01d,
-- 0x59da5908, 0x496a5800, 0x412ed000, 0x815eb800,
-- 0x0400e7fc, 0x59c80000, 0x82000540, 0x00001200,
-- 0x48039000, 0x04006019, 0x59d8010a, 0x59d8090a,
-- 0x80040d80, 0x040207fd, 0x900001c0, 0x82000540,
-- 0x00000013, 0x4803c011, 0x5998002b, 0x84000500,
-- 0x4803302b, 0x59e00017, 0x8c000508, 0x04000003,
-- 0x4a03c017, 0x00000003, 0x4203e000, 0x30000001,
-- 0x59d80105, 0x82000500, 0x00018780, 0x02020000,
-- 0x00020482, 0x1c01f000, 0x5998002b, 0x84000540,
-- 0x4803302b, 0x0401f7f7, 0x5c000000, 0x4c000000,
-+ 0x0010ac71, 0x59a1d81e, 0x80edd9c0, 0x02000800,
-+ 0x001004ef, 0x0401f003, 0x5931d821, 0x58ef400b,
-+ 0x58ec0009, 0x800001c0, 0x02000800, 0x001004ef,
-+ 0x0801f800, 0x1c01f000, 0x5c000000, 0x4c000000,
- 0x4803c857, 0x492fc857, 0x4943c857, 0x4807c857,
- 0x4a025a04, 0x00000103, 0x49425a06, 0x48065a08,
- 0x4a025c06, 0x0000ffff, 0x813261c0, 0x04000003,
- 0x59300402, 0x48025c06, 0x832c0400, 0x00000009,
- 0x04011000, 0x4803c840, 0x4a03c842, 0x0000000b,
-- 0x04011000, 0x1c01f000, 0x42000000, 0x0010b654,
-- 0x0201f800, 0x0010a86e, 0x0201f000, 0x00020464,
-- 0x59a80017, 0x82000c80, 0x0000000a, 0x02021800,
-- 0x00100615, 0x0c01f809, 0x4a038805, 0x000000f0,
-- 0x59c400a3, 0x82000500, 0x02870000, 0x02020800,
-- 0x00100615, 0x1c01f000, 0x00104c99, 0x00104c25,
-- 0x00104c40, 0x00104c69, 0x00104c8c, 0x00104cc6,
-- 0x00104cd8, 0x00104c40, 0x00104caa, 0x00104c24,
-- 0x1c01f000, 0x4a038808, 0x00000004, 0x0401f8f9,
-- 0x0201f800, 0x0010507b, 0x59c40805, 0x8c040d0e,
-- 0x04020013, 0x8c040d0a, 0x0402000b, 0x8c040d0c,
-- 0x04020006, 0x8c040d08, 0x0400000d, 0x4a035017,
-- 0x00000003, 0x0401f00a, 0x4a035017, 0x00000000,
-- 0x0401f007, 0x42000000, 0x0010b642, 0x0201f800,
-- 0x0010a86e, 0x4a035017, 0x00000002, 0x1c01f000,
-- 0x4a038808, 0x00000002, 0x0401f8de, 0x59c40805,
-- 0x8c040d08, 0x04020021, 0x8c040d0c, 0x0402001c,
-- 0x8c040d0e, 0x04020017, 0x82040500, 0x000000f0,
-- 0x0402001c, 0x0201f800, 0x0010507b, 0x4a038808,
-- 0x00000080, 0x59c40002, 0x8400050c, 0x48038802,
-- 0x0401f9d7, 0x4d3c0000, 0x42027800, 0x00000001,
-- 0x0201f800, 0x00109640, 0x5c027800, 0x4a038808,
-- 0x00000080, 0x4a035017, 0x00000009, 0x0401f009,
-- 0x4a035017, 0x00000001, 0x0401f006, 0x4a035017,
-- 0x00000000, 0x0401f003, 0x4a035017, 0x00000003,
-- 0x1c01f000, 0x0401f8b7, 0x4a038808, 0x00000080,
-- 0x59c40805, 0x8c040d0a, 0x0402001b, 0x8c040d0c,
-- 0x04020016, 0x8c040d0e, 0x04020011, 0x82040500,
-- 0x000000f0, 0x04020016, 0x59c40002, 0x8400050c,
-- 0x48038802, 0x0401f9b2, 0x4d3c0000, 0x42027800,
-- 0x00000001, 0x0201f800, 0x00109640, 0x5c027800,
-- 0x4a035017, 0x00000009, 0x0401f009, 0x4a035017,
-- 0x00000001, 0x0401f006, 0x4a035017, 0x00000000,
-- 0x0401f003, 0x4a035017, 0x00000002, 0x1c01f000,
-- 0x4a038808, 0x00000008, 0x59c40805, 0x8c040d0c,
-- 0x04020006, 0x8c040d0e, 0x04000006, 0x4a035017,
-- 0x00000001, 0x0401f003, 0x4a035017, 0x00000000,
-- 0x1c01f000, 0x0401f8d3, 0x59c40805, 0x8c040d0c,
-- 0x0402000d, 0x4c040000, 0x0401f882, 0x5c000800,
-- 0x8c040d0a, 0x04020006, 0x8c040d0e, 0x04000006,
-- 0x4a035017, 0x00000001, 0x0401f003, 0x4a035017,
-+ 0x04011000, 0x1c01f000, 0x59a80016, 0x82000c80,
-+ 0x0000000a, 0x02021800, 0x001004ef, 0x0c01f809,
-+ 0x4a038805, 0x000000f0, 0x59c400a3, 0x82000500,
-+ 0x02870000, 0x02020800, 0x001004ef, 0x1c01f000,
-+ 0x00104b33, 0x00104abf, 0x00104ada, 0x00104b03,
-+ 0x00104b26, 0x00104b60, 0x00104b72, 0x00104ada,
-+ 0x00104b44, 0x00104abe, 0x1c01f000, 0x4a038808,
-+ 0x00000004, 0x0401f8f7, 0x0201f800, 0x00104f2c,
-+ 0x59c40805, 0x8c040d0e, 0x04020013, 0x8c040d0a,
-+ 0x0402000b, 0x8c040d0c, 0x04020006, 0x8c040d08,
-+ 0x0400000d, 0x4a035016, 0x00000003, 0x0401f00a,
-+ 0x4a035016, 0x00000000, 0x0401f007, 0x42000000,
-+ 0x0010b012, 0x0201f800, 0x0010a260, 0x4a035016,
-+ 0x00000002, 0x1c01f000, 0x4a038808, 0x00000002,
-+ 0x0401f8dc, 0x59c40805, 0x8c040d08, 0x04020021,
-+ 0x8c040d0c, 0x0402001c, 0x8c040d0e, 0x04020017,
-+ 0x82040500, 0x000000f0, 0x0402001c, 0x0201f800,
-+ 0x00104f2c, 0x4a038808, 0x00000080, 0x59c40002,
-+ 0x8400050c, 0x48038802, 0x0401f9fe, 0x4d3c0000,
-+ 0x42027800, 0x00000001, 0x0201f800, 0x001090c7,
-+ 0x5c027800, 0x4a038808, 0x00000080, 0x4a035016,
-+ 0x00000009, 0x0401f009, 0x4a035016, 0x00000001,
-+ 0x0401f006, 0x4a035016, 0x00000000, 0x0401f003,
-+ 0x4a035016, 0x00000003, 0x1c01f000, 0x0401f8b5,
-+ 0x4a038808, 0x00000080, 0x59c40805, 0x8c040d0a,
-+ 0x0402001b, 0x8c040d0c, 0x04020016, 0x8c040d0e,
-+ 0x04020011, 0x82040500, 0x000000f0, 0x04020016,
-+ 0x59c40002, 0x8400050c, 0x48038802, 0x0401f9d9,
-+ 0x4d3c0000, 0x42027800, 0x00000001, 0x0201f800,
-+ 0x001090c7, 0x5c027800, 0x4a035016, 0x00000009,
-+ 0x0401f009, 0x4a035016, 0x00000001, 0x0401f006,
-+ 0x4a035016, 0x00000000, 0x0401f003, 0x4a035016,
- 0x00000002, 0x1c01f000, 0x4a038808, 0x00000008,
-- 0x42001000, 0x00104d2c, 0x0201f800, 0x00105dbd,
-- 0x59c40805, 0x8c040d0a, 0x0402000d, 0x8c040d08,
-+ 0x59c40805, 0x8c040d0c, 0x04020006, 0x8c040d0e,
-+ 0x04000006, 0x4a035016, 0x00000001, 0x0401f003,
-+ 0x4a035016, 0x00000000, 0x1c01f000, 0x0401f8d9,
-+ 0x59c40805, 0x8c040d0c, 0x0402000d, 0x4c040000,
-+ 0x0401f880, 0x5c000800, 0x8c040d0a, 0x04020006,
-+ 0x8c040d0e, 0x04000006, 0x4a035016, 0x00000001,
-+ 0x0401f003, 0x4a035016, 0x00000002, 0x1c01f000,
-+ 0x4a038808, 0x00000008, 0x42001000, 0x00104bc8,
-+ 0x0201f800, 0x00105c63, 0x59c40805, 0x8c040d0a,
-+ 0x0402000d, 0x8c040d08, 0x0402000b, 0x8c040d0c,
-+ 0x04020006, 0x8c040d0e, 0x0400000d, 0x4a035016,
-+ 0x00000001, 0x0401f00a, 0x4a035016, 0x00000000,
-+ 0x0401f007, 0x42000000, 0x0010b012, 0x0201f800,
-+ 0x0010a260, 0x4a035016, 0x00000004, 0x1c01f000,
-+ 0x0401f8ac, 0x0401f857, 0x59c40805, 0x8c040d0a,
- 0x0402000b, 0x8c040d0c, 0x04020006, 0x8c040d0e,
-- 0x0400000d, 0x4a035017, 0x00000001, 0x0401f00a,
-- 0x4a035017, 0x00000000, 0x0401f007, 0x42000000,
-- 0x0010b642, 0x0201f800, 0x0010a86e, 0x4a035017,
-- 0x00000004, 0x1c01f000, 0x0401f8a6, 0x0401f859,
-- 0x59c40805, 0x8c040d0a, 0x0402000b, 0x8c040d0c,
-- 0x04020006, 0x8c040d0e, 0x04000009, 0x4a035017,
-- 0x00000001, 0x0401f006, 0x4a035017, 0x00000000,
-- 0x0401f003, 0x4a035017, 0x00000002, 0x1c01f000,
-- 0x4a038808, 0x00000004, 0x0401f846, 0x59c40805,
-- 0x8c040d0a, 0x04020010, 0x8c040d08, 0x0402000b,
-- 0x8c040d0c, 0x04020006, 0x8c040d0e, 0x0400000c,
-- 0x4a035017, 0x00000001, 0x0401f009, 0x4a035017,
-- 0x00000000, 0x0401f006, 0x4a035017, 0x00000003,
-- 0x0401f003, 0x4a035017, 0x00000002, 0x1c01f000,
-- 0x0401f91d, 0x02020800, 0x00100615, 0x59a80805,
-- 0x8c040d0c, 0x04000015, 0x84040d0c, 0x48075005,
-- 0x4a038805, 0x00000010, 0x0201f800, 0x001019a4,
-+ 0x04000009, 0x4a035016, 0x00000001, 0x0401f006,
-+ 0x4a035016, 0x00000000, 0x0401f003, 0x4a035016,
-+ 0x00000002, 0x1c01f000, 0x4a038808, 0x00000004,
-+ 0x0401f844, 0x59c40805, 0x8c040d0a, 0x04020010,
-+ 0x8c040d08, 0x0402000b, 0x8c040d0c, 0x04020006,
-+ 0x8c040d0e, 0x0400000c, 0x4a035016, 0x00000001,
-+ 0x0401f009, 0x4a035016, 0x00000000, 0x0401f006,
-+ 0x4a035016, 0x00000003, 0x0401f003, 0x4a035016,
-+ 0x00000002, 0x1c01f000, 0x0401f91c, 0x02020800,
-+ 0x001004ef, 0x8d0e1d0c, 0x04000014, 0x850e1d0c,
-+ 0x4a038805, 0x00000010, 0x0201f800, 0x00101892,
- 0x59c40005, 0x8c000508, 0x04000008, 0x4a038808,
-- 0x00000008, 0x4a035033, 0x00000001, 0x4202d800,
-+ 0x00000008, 0x4a035030, 0x00000001, 0x4202d800,
- 0x00000001, 0x0401f01a, 0x59c40006, 0x84000548,
-- 0x48038806, 0x0401f016, 0x59a80017, 0x82000580,
-- 0x00000001, 0x0400000c, 0x59a80017, 0x82000580,
-- 0x00000005, 0x0402000c, 0x42000000, 0x0010b642,
-- 0x0201f800, 0x0010a86e, 0x4a035017, 0x00000008,
-- 0x0401f007, 0x42000000, 0x0010b642, 0x0201f800,
-- 0x0010a86e, 0x4a035017, 0x00000004, 0x1c01f000,
-+ 0x48038806, 0x0401f016, 0x59a80016, 0x82000580,
-+ 0x00000001, 0x0400000c, 0x59a80016, 0x82000580,
-+ 0x00000005, 0x0402000c, 0x42000000, 0x0010b012,
-+ 0x0201f800, 0x0010a260, 0x4a035016, 0x00000008,
-+ 0x0401f007, 0x42000000, 0x0010b012, 0x0201f800,
-+ 0x0010a260, 0x4a035016, 0x00000004, 0x1c01f000,
- 0x4803c856, 0x4c040000, 0x4c080000, 0x42000800,
-- 0x00000064, 0x42001000, 0x00104d2c, 0x0201f800,
-- 0x00105db2, 0x5c001000, 0x5c000800, 0x1c01f000,
-- 0x4803c856, 0x4c040000, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x0201f800, 0x00106b71, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x0401ffba, 0x5c000800,
-+ 0x00000064, 0x42001000, 0x00104bc8, 0x0201f800,
-+ 0x00105c58, 0x5c001000, 0x5c000800, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4803c856, 0x4c040000, 0x0201f800, 0x00106476,
-+ 0x4df00000, 0x0201f800, 0x00106664, 0x5c03e000,
-+ 0x02000800, 0x00106463, 0x0401ffb8, 0x5c000800,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
- 0x1c01f000, 0x4803c856, 0x4c040000, 0x4c080000,
-- 0x0201f800, 0x0010698c, 0x4df00000, 0x0201f800,
-- 0x00106b71, 0x5c03e000, 0x02000800, 0x00106982,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x0201f800,
-+ 0x00106664, 0x5c03e000, 0x02000800, 0x00106463,
- 0x59c40006, 0x84000500, 0x48038806, 0x0201f800,
-- 0x00106c32, 0x497b8880, 0x0201f800, 0x0010a7e7,
-- 0x0201f800, 0x0010a7f5, 0x0201f800, 0x00101886,
-- 0x4a03504c, 0x00000004, 0x4202d800, 0x00000004,
-- 0x4a038805, 0x00000001, 0x42001000, 0x00104d2c,
-- 0x0201f800, 0x00105dbd, 0x0201f800, 0x0010071a,
-- 0x0401f8bf, 0x04000006, 0x42006000, 0xfeffffff,
-- 0x41786800, 0x0201f800, 0x001040ad, 0x0201f800,
-- 0x0010048c, 0x42000000, 0x00000001, 0x0201f800,
-- 0x001015fa, 0x5c001000, 0x5c000800, 0x1c01f000,
-+ 0x00106725, 0x497b8880, 0x0201f800, 0x0010a1d8,
-+ 0x0201f800, 0x0010a1e6, 0x0201f800, 0x0010177f,
-+ 0x4a035049, 0x00000004, 0x4202d800, 0x00000004,
-+ 0x4a038805, 0x00000001, 0x42001000, 0x00104bc8,
-+ 0x0201f800, 0x00105c63, 0x0201f800, 0x001005fc,
-+ 0x0401f8d7, 0x04000006, 0x42006000, 0xfeffffff,
-+ 0x41786800, 0x0201f800, 0x00103f44, 0x0201f800,
-+ 0x0010d471, 0x42000000, 0x00000080, 0x0201f800,
-+ 0x001014c3, 0x5c001000, 0x5c000800, 0x1c01f000,
- 0x59c40008, 0x8c000508, 0x04020007, 0x4a038808,
- 0x00000010, 0x4201d000, 0x00001388, 0x0201f800,
-- 0x00105dd2, 0x1c01f000, 0x4c040000, 0x59a80833,
-- 0x82040580, 0x00000000, 0x0400000b, 0x82040580,
-- 0x00000001, 0x0400000b, 0x82040580, 0x00000002,
-- 0x0400000b, 0x82040580, 0x00000003, 0x0400000b,
-- 0x0401f055, 0x4a035017, 0x00000000, 0x0401f009,
-- 0x4a035017, 0x00000004, 0x0401f006, 0x4a035017,
-- 0x00000001, 0x0401f003, 0x4a035017, 0x00000007,
-- 0x497b8880, 0x4a038893, 0x00000001, 0x41780000,
-- 0x0201f800, 0x00101670, 0x0201f800, 0x00106c32,
-- 0x836c0d80, 0x00000004, 0x04000008, 0x59c40006,
-- 0x82000500, 0xffffff0f, 0x82000540, 0x04000001,
-- 0x48038806, 0x0401f007, 0x59c40006, 0x82000500,
-- 0xffffff0f, 0x82000540, 0x04000000, 0x48038806,
-- 0x0401f873, 0x04020005, 0x59c40806, 0x82040d00,
-- 0xfbffff0f, 0x48078806, 0x59c40005, 0x8c000534,
-- 0x04020033, 0x42006000, 0xfc18ffff, 0x42006800,
-- 0x01000000, 0x0201f800, 0x001040ad, 0x0201f800,
-- 0x001019a4, 0x59c408a4, 0x82040d00, 0x0000000f,
-- 0x82040d80, 0x0000000c, 0x040208a9, 0x0401f85c,
-- 0x04000006, 0x42006000, 0xfeffffff, 0x41786800,
-- 0x0201f800, 0x001040ad, 0x836c0d80, 0x00000004,
-- 0x0400000f, 0x0401f85a, 0x04020008, 0x59940005,
-- 0x82000580, 0x00103f37, 0x04020004, 0x59940004,
-- 0x800001c0, 0x04020006, 0x59a8084d, 0x42001000,
-- 0x00104d39, 0x0201f800, 0x00105da7, 0x4a035033,
-- 0x00000004, 0x0401fe33, 0x0401f841, 0x04020008,
-+ 0x00105c78, 0x1c01f000, 0x4c000000, 0x4c040000,
-+ 0x59a80830, 0x82040580, 0x00000000, 0x0400000b,
-+ 0x82040580, 0x00000001, 0x0400000b, 0x82040580,
-+ 0x00000002, 0x0400000b, 0x82040580, 0x00000003,
-+ 0x0400000b, 0x0401f04c, 0x4a035016, 0x00000000,
-+ 0x0401f009, 0x4a035016, 0x00000004, 0x0401f006,
-+ 0x4a035016, 0x00000001, 0x0401f003, 0x4a035016,
-+ 0x00000007, 0x497b8880, 0x4a038893, 0x00000001,
-+ 0x41780000, 0x0201f800, 0x00101536, 0x0201f800,
-+ 0x00106725, 0x836c0d80, 0x00000004, 0x04000008,
-+ 0x59c40006, 0x82000500, 0xffffff0f, 0x82000540,
-+ 0x04000001, 0x48038806, 0x0401f007, 0x59c40006,
-+ 0x82000500, 0xffffff0f, 0x82000540, 0x04000000,
-+ 0x48038806, 0x0401f88a, 0x04020005, 0x59c40806,
-+ 0x82040d00, 0xfbffff0f, 0x48078806, 0x59c40005,
-+ 0x8c000534, 0x0402002a, 0x42006000, 0xfc18ffff,
-+ 0x42006800, 0x01000000, 0x0201f800, 0x00103f44,
-+ 0x0201f800, 0x00101892, 0x59c408a4, 0x82040d00,
-+ 0x0000000f, 0x82040d80, 0x0000000c, 0x040208bf,
-+ 0x0401f873, 0x04000006, 0x42006000, 0xfeffffff,
-+ 0x41786800, 0x0201f800, 0x00103f44, 0x836c0d80,
-+ 0x00000004, 0x04000006, 0x59a8084a, 0x42001000,
-+ 0x00104bd9, 0x0201f800, 0x00105c4d, 0x4a035030,
-+ 0x00000004, 0x0401fe35, 0x0401f861, 0x04020008,
- 0x59c408a4, 0x82040d00, 0x0000000f, 0x82040580,
-- 0x0000000c, 0x02020800, 0x00100615, 0x5c000800,
-- 0x1c01f000, 0x4803c856, 0x4c000000, 0x0201f800,
-- 0x00105de2, 0x4a035010, 0x00ffffff, 0x497b5032,
-- 0x59a8002a, 0x82000500, 0xffff0000, 0x4803502a,
-- 0x497b8880, 0x497b8893, 0x41780000, 0x0201f800,
-- 0x00101670, 0x59c40001, 0x82000500, 0xfffffcff,
-- 0x48038801, 0x42006000, 0xfc18ffff, 0x41786800,
-- 0x0201f800, 0x001040ad, 0x4a038808, 0x00000000,
-- 0x5c000000, 0x800001c0, 0x02020800, 0x00103f37,
-- 0x4a038805, 0x040000f0, 0x59c40006, 0x82000500,
-- 0xffffffcf, 0x82000540, 0x440000c1, 0x48038806,
-- 0x1c01f000, 0x4c5c0000, 0x59a8b832, 0x825cbd80,
-- 0x0000aaaa, 0x5c00b800, 0x1c01f000, 0x4c5c0000,
-+ 0x0000000c, 0x02020800, 0x001004ef, 0x5c000800,
-+ 0x5c000000, 0x1c01f000, 0x4803c856, 0x4c000000,
-+ 0x0201f800, 0x00105c8c, 0x4a03500f, 0x00ffffff,
-+ 0x497b502f, 0x59a80027, 0x82000500, 0xffff0000,
-+ 0x48035027, 0x497b8880, 0x497b8893, 0x41780000,
-+ 0x0201f800, 0x00101536, 0x59c40001, 0x82000500,
-+ 0xfffffcff, 0x48038801, 0x42006000, 0xfc18ffff,
-+ 0x41786800, 0x0201f800, 0x00103f44, 0x4a038808,
-+ 0x00000000, 0x5c000000, 0x800001c0, 0x02020800,
-+ 0x00103dcb, 0x4a038805, 0x040000f0, 0x59c40006,
-+ 0x82000500, 0xffffffcf, 0x82000540, 0x440000c1,
-+ 0x48038806, 0x1c01f000, 0x4c5c0000, 0x59a8b82f,
-+ 0x825cbd80, 0x0000aaaa, 0x5c00b800, 0x1c01f000,
-+ 0x4c000000, 0x4c5c0000, 0x59a8b82f, 0x825cbd80,
-+ 0x0000aaaa, 0x42018800, 0x00000001, 0x04000003,
-+ 0x42018800, 0x00000000, 0x5c00b800, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x4c5c0000, 0x599cb818,
-+ 0x825cbd00, 0x00000030, 0x825cbd80, 0x00000000,
-+ 0x5c00b800, 0x1c01f000, 0x4c000000, 0x0401f808,
-+ 0x42018800, 0x00000001, 0x04000003, 0x42018800,
-+ 0x00000000, 0x5c000000, 0x1c01f000, 0x4c5c0000,
- 0x599cb818, 0x825cbd00, 0x00000030, 0x825cbd80,
-- 0x00000000, 0x5c00b800, 0x1c01f000, 0x4c5c0000,
-- 0x599cb818, 0x825cbd00, 0x00000030, 0x825cbd80,
-- 0x00000010, 0x5c00b800, 0x1c01f000, 0x4c5c0000,
-- 0x599cb818, 0x825cbd00, 0x00000030, 0x825cbd80,
-- 0x00000020, 0x5c00b800, 0x1c01f000, 0x59a80005,
-- 0x4803c857, 0x82000d00, 0x00000013, 0x04000024,
-- 0x599c1017, 0x4d3c0000, 0x82000500, 0x00000011,
-- 0x04000006, 0x417a7800, 0x0201f800, 0x0010393e,
-- 0x0402000a, 0x0401f012, 0x42027800, 0x00000008,
-- 0x0201f800, 0x0010393e, 0x0400000d, 0x42003000,
-- 0x00000003, 0x0401f003, 0x42003000, 0x00000004,
-- 0x42028000, 0x0000000e, 0x0201f800, 0x0010a25b,
-- 0x599c1017, 0x8c08150a, 0x04020007, 0x42028000,
-- 0x00000004, 0x0201f800, 0x00101d90, 0x80000580,
-- 0x0401f80d, 0x5c027800, 0x0401f00a, 0x0201f800,
-- 0x0010393e, 0x04000007, 0x42028000, 0x0000000f,
-- 0x42003000, 0x00000001, 0x0201f800, 0x0010a25b,
-- 0x1c01f000, 0x59a80005, 0x04000004, 0x82000540,
-- 0x00000010, 0x0401f003, 0x82000500, 0xffffffef,
-- 0x48035005, 0x4803c857, 0x1c01f000, 0x4803c856,
-- 0x4c580000, 0x42000000, 0x0010b6ca, 0x0201f800,
-- 0x0010a86e, 0x42000800, 0x0010bef0, 0x59c40003,
-- 0x44000800, 0x59c40004, 0x48000801, 0x59c4000b,
-- 0x48000802, 0x59c4008e, 0x48000803, 0x59c4008f,
-- 0x48000804, 0x59c40090, 0x48000805, 0x59c40091,
-- 0x48000806, 0x59c40092, 0x48000807, 0x59c40093,
-- 0x48000808, 0x59c40099, 0x48000809, 0x59c4009e,
-- 0x4800080a, 0x59c400aa, 0x4800080b, 0x59c400af,
-- 0x4800080c, 0x59c400b2, 0x4800080d, 0x59c400b1,
-- 0x4800080e, 0x82040c00, 0x0000000f, 0x41c41800,
-- 0x4200b000, 0x00000030, 0x580c0050, 0x44000800,
-+ 0x00000010, 0x5c00b800, 0x1c01f000, 0x4c000000,
-+ 0x0401f808, 0x42018800, 0x00000001, 0x04000003,
-+ 0x42018800, 0x00000000, 0x5c000000, 0x1c01f000,
-+ 0x4c5c0000, 0x599cb818, 0x825cbd00, 0x00000030,
-+ 0x825cbd80, 0x00000020, 0x5c00b800, 0x1c01f000,
-+ 0x490fc857, 0x830c0d00, 0x00000013, 0x04000022,
-+ 0x599c1017, 0x4d3c0000, 0x830c0500, 0x00000011,
-+ 0x04000005, 0x417a7800, 0x8d0e1d20, 0x04020009,
-+ 0x0401f011, 0x42027800, 0x00000008, 0x8d0e1d20,
-+ 0x0400000d, 0x42003000, 0x00000003, 0x0401f003,
-+ 0x42003000, 0x00000004, 0x42028000, 0x0000000e,
-+ 0x0201f800, 0x00109c1f, 0x599c1017, 0x8c08150a,
-+ 0x04020007, 0x42028000, 0x00000004, 0x0201f800,
-+ 0x0010ca42, 0x4803c856, 0x850e1d08, 0x5c027800,
-+ 0x0401f009, 0x8d0e1d20, 0x04000007, 0x42028000,
-+ 0x0000000f, 0x42003000, 0x00000001, 0x0201f800,
-+ 0x00109c1f, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4803c856, 0x4c580000,
-+ 0x42000000, 0x0010b09a, 0x0201f800, 0x0010a260,
-+ 0x42000800, 0x0010b8c0, 0x59c40003, 0x44000800,
-+ 0x59c40004, 0x48000801, 0x59c4000b, 0x48000802,
-+ 0x59c4008e, 0x48000803, 0x59c4008f, 0x48000804,
-+ 0x59c40090, 0x48000805, 0x59c40091, 0x48000806,
-+ 0x59c40092, 0x48000807, 0x59c40093, 0x48000808,
-+ 0x59c40099, 0x48000809, 0x59c4009e, 0x4800080a,
-+ 0x59c400aa, 0x4800080b, 0x59c400af, 0x4800080c,
-+ 0x59c400b2, 0x4800080d, 0x59c400b1, 0x4800080e,
-+ 0x82040c00, 0x0000000f, 0x41c41800, 0x4200b000,
-+ 0x00000030, 0x580c0050, 0x44000800, 0x80040800,
-+ 0x800c1800, 0x8058b040, 0x040207fb, 0x41c41800,
-+ 0x4200b000, 0x00000020, 0x580c0010, 0x44000800,
-+ 0x80040800, 0x800c1800, 0x8058b040, 0x040207fb,
-+ 0x497b8830, 0x4200b000, 0x00000040, 0x59c40031,
-+ 0x44000800, 0x80040800, 0x8058b040, 0x040207fc,
-+ 0x497b88ac, 0x4200b000, 0x00000010, 0x59c400ad,
-+ 0x44000800, 0x80040800, 0x8058b040, 0x040207fc,
-+ 0x59c41001, 0x4c080000, 0x8408150c, 0x480b8801,
-+ 0x4a0370e4, 0x00000300, 0x4a0370e5, 0xb0000000,
-+ 0x42000800, 0x00000800, 0x80040840, 0x02000800,
-+ 0x001004ef, 0x59b800e5, 0x8c000538, 0x040207fb,
-+ 0x4a0370e4, 0x00000200, 0x42006000, 0xffffffff,
-+ 0x42006800, 0x80000000, 0x0201f800, 0x00103f44,
-+ 0x4a038807, 0x00000001, 0x497b8807, 0x4a038808,
-+ 0x00000010, 0x42006000, 0xfcf8ffff, 0x42006800,
-+ 0x01000000, 0x0201f800, 0x00103f44, 0x5c001000,
-+ 0x480b8801, 0x42000800, 0x0010b8c0, 0x50040000,
-+ 0x48038803, 0x58040001, 0x48038804, 0x58040002,
-+ 0x4803880b, 0x58040003, 0x4803888e, 0x58040004,
-+ 0x4803888f, 0x58040005, 0x48038890, 0x58040006,
-+ 0x48038891, 0x58040007, 0x48038892, 0x58040008,
-+ 0x48038893, 0x58040009, 0x48038899, 0x5804000a,
-+ 0x4803889e, 0x5804000b, 0x480388aa, 0x5804000c,
-+ 0x480388af, 0x5804000d, 0x480388b2, 0x5804000e,
-+ 0x480388b1, 0x82040c00, 0x0000000f, 0x41c41800,
-+ 0x4200b000, 0x00000030, 0x50040000, 0x48001850,
- 0x80040800, 0x800c1800, 0x8058b040, 0x040207fb,
-- 0x41c41800, 0x4200b000, 0x00000020, 0x580c0010,
-- 0x44000800, 0x80040800, 0x800c1800, 0x8058b040,
-+ 0x41c41800, 0x4200b000, 0x00000020, 0x50040000,
-+ 0x48001810, 0x80040800, 0x800c1800, 0x8058b040,
- 0x040207fb, 0x497b8830, 0x4200b000, 0x00000040,
-- 0x59c40031, 0x44000800, 0x80040800, 0x8058b040,
-+ 0x50040000, 0x48038831, 0x80040800, 0x8058b040,
- 0x040207fc, 0x497b88ac, 0x4200b000, 0x00000010,
-- 0x59c400ad, 0x44000800, 0x80040800, 0x8058b040,
-- 0x040207fc, 0x59c41001, 0x4c080000, 0x8408150c,
-- 0x480b8801, 0x4a0370e4, 0x00000300, 0x4a0370e5,
-- 0xb0000000, 0x42000800, 0x00000800, 0x80040840,
-- 0x02000800, 0x00100615, 0x59b800e5, 0x8c000538,
-- 0x040207fb, 0x4a0370e4, 0x00000200, 0x42006000,
-- 0xffffffff, 0x42006800, 0x80000000, 0x0201f800,
-- 0x001040ad, 0x4a038807, 0x00000001, 0x497b8807,
-- 0x4a038808, 0x00000010, 0x42006000, 0xfcf8ffff,
-- 0x42006800, 0x01000000, 0x0201f800, 0x001040ad,
-- 0x5c001000, 0x480b8801, 0x42000800, 0x0010bef0,
-- 0x50040000, 0x48038803, 0x58040001, 0x48038804,
-- 0x58040002, 0x4803880b, 0x58040003, 0x4803888e,
-- 0x58040004, 0x4803888f, 0x58040005, 0x48038890,
-- 0x58040006, 0x48038891, 0x58040007, 0x48038892,
-- 0x58040008, 0x48038893, 0x58040009, 0x48038899,
-- 0x5804000a, 0x4803889e, 0x5804000b, 0x480388aa,
-- 0x5804000c, 0x480388af, 0x5804000d, 0x480388b2,
-- 0x5804000e, 0x480388b1, 0x82040c00, 0x0000000f,
-- 0x41c41800, 0x4200b000, 0x00000030, 0x50040000,
-- 0x48001850, 0x80040800, 0x800c1800, 0x8058b040,
-- 0x040207fb, 0x41c41800, 0x4200b000, 0x00000020,
-- 0x50040000, 0x48001810, 0x80040800, 0x800c1800,
-- 0x8058b040, 0x040207fb, 0x497b8830, 0x4200b000,
-- 0x00000040, 0x50040000, 0x48038831, 0x80040800,
-- 0x8058b040, 0x040207fc, 0x497b88ac, 0x4200b000,
-- 0x00000010, 0x50040000, 0x480388ad, 0x80040800,
-- 0x8058b040, 0x040207fc, 0x497b8880, 0x41780000,
-- 0x0201f800, 0x00101670, 0x59c408a4, 0x82040d00,
-- 0x0000000f, 0x82040580, 0x0000000c, 0x02020800,
-- 0x00100615, 0x4a038805, 0x04000000, 0x5c00b000,
-- 0x1c01f000, 0x4803c856, 0x4c580000, 0x4ce80000,
-- 0x42000000, 0x0010b643, 0x0201f800, 0x0010a86e,
-- 0x59c41008, 0x4c080000, 0x82080500, 0xffffff7f,
-- 0x48038808, 0x59c40004, 0x82000500, 0x00003e02,
-- 0x04000005, 0x4201d000, 0x00000014, 0x0201f800,
-- 0x00105dd2, 0x59c40006, 0x82000500, 0xffffff0f,
-- 0x48038806, 0x4a038805, 0x00000010, 0x4a038808,
-- 0x00000004, 0x4200b000, 0x00000065, 0x59c40005,
-- 0x8c000508, 0x04020012, 0x4201d000, 0x000003e8,
-- 0x0201f800, 0x00105dd2, 0x8058b040, 0x040207f8,
-- 0x0201f800, 0x00106c32, 0x4a038808, 0x00000008,
-- 0x4a035033, 0x00000001, 0x4202d800, 0x00000001,
-- 0x82000540, 0x00000001, 0x0401f030, 0x0201f800,
-- 0x00100b29, 0x42000000, 0x0010b6a7, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00100f42, 0x497b8880,
-- 0x59a8002a, 0x82000500, 0x0000ffff, 0x4c000000,
-- 0x0201f800, 0x00101670, 0x5c000000, 0x48038880,
-- 0x4a038808, 0x00000000, 0x4200b000, 0x00000065,
-- 0x4a038805, 0x000000f0, 0x0201f800, 0x001019a4,
-- 0x42000800, 0x000000f0, 0x59c40005, 0x80040d00,
-- 0x04000008, 0x4201d000, 0x000003e8, 0x0201f800,
-- 0x00105dd2, 0x8058b040, 0x040207f2, 0x0401f7d1,
-- 0x59c40006, 0x82000540, 0x000000f0, 0x48038806,
-- 0x59a8001e, 0x80000540, 0x04020002, 0x80000000,
-- 0x48038893, 0x80000580, 0x5c001000, 0x4df00000,
-- 0x0201f800, 0x001019ca, 0x5c03e000, 0x480b8808,
-- 0x5c01d000, 0x5c00b000, 0x1c01f000, 0x4803c856,
-- 0x4c580000, 0x4ce80000, 0x59c41008, 0x82080500,
-- 0xffffff7f, 0x48038808, 0x4c080000, 0x59c40004,
-- 0x82000500, 0x00003e02, 0x04000005, 0x4201d000,
-- 0x00000014, 0x0201f800, 0x00105dd2, 0x0201f800,
-- 0x00100b29, 0x42000000, 0x0010b6a8, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00100f42, 0x4a038808,
-- 0x00000002, 0x80000580, 0x48038880, 0x48038893,
-- 0x0201f800, 0x00101670, 0x4200b000, 0x00000384,
-- 0x4a038805, 0x000000f0, 0x0201f800, 0x001019a4,
-- 0x42000800, 0x000000f0, 0x59c40005, 0x80040d00,
-- 0x04000015, 0x82000500, 0x000000d0, 0x04020012,
-- 0x4201d000, 0x00000067, 0x0201f800, 0x00105dd2,
-- 0x8058b040, 0x040207ef, 0x0201f800, 0x00106c32,
-- 0x4a038808, 0x00000008, 0x4a035033, 0x00000001,
-- 0x4202d800, 0x00000001, 0x82000540, 0x00000001,
-- 0x0401f010, 0x497b8880, 0x59a8001e, 0x80000540,
-- 0x04020002, 0x80000000, 0x48038893, 0x59a8002a,
-+ 0x50040000, 0x480388ad, 0x80040800, 0x8058b040,
-+ 0x040207fc, 0x497b8880, 0x41780000, 0x0201f800,
-+ 0x00101536, 0x59c408a4, 0x82040d00, 0x0000000f,
-+ 0x82040580, 0x0000000c, 0x02020800, 0x001004ef,
-+ 0x4a038805, 0x04000000, 0x5c00b000, 0x1c01f000,
-+ 0x4803c856, 0x4c580000, 0x4ce80000, 0x42000000,
-+ 0x0010b013, 0x0201f800, 0x0010a260, 0x59c41008,
-+ 0x4c080000, 0x82080500, 0xffffff7f, 0x48038808,
-+ 0x59c40004, 0x82000500, 0x00003e02, 0x04000005,
-+ 0x4201d000, 0x00000014, 0x0201f800, 0x00105c78,
-+ 0x59c40006, 0x82000500, 0xffffff0f, 0x48038806,
-+ 0x4a038805, 0x00000010, 0x4a038808, 0x00000004,
-+ 0x4200b000, 0x00000065, 0x59c40005, 0x8c000508,
-+ 0x04020012, 0x4201d000, 0x000003e8, 0x0201f800,
-+ 0x00105c78, 0x8058b040, 0x040207f8, 0x0201f800,
-+ 0x00106725, 0x4a038808, 0x00000008, 0x4a035030,
-+ 0x00000001, 0x4202d800, 0x00000001, 0x82000540,
-+ 0x00000001, 0x0401f030, 0x0201f800, 0x00100a20,
-+ 0x42000000, 0x0010b077, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x00100e3b, 0x497b8880, 0x59a80027,
-+ 0x82000500, 0x0000ffff, 0x4c000000, 0x0201f800,
-+ 0x00101536, 0x5c000000, 0x48038880, 0x4a038808,
-+ 0x00000000, 0x4200b000, 0x00000065, 0x4a038805,
-+ 0x000000f0, 0x0201f800, 0x00101892, 0x42000800,
-+ 0x000000f0, 0x59c40005, 0x80040d00, 0x04000008,
-+ 0x4201d000, 0x000003e8, 0x0201f800, 0x00105c78,
-+ 0x8058b040, 0x040207f2, 0x0401f7d1, 0x59c40006,
-+ 0x82000540, 0x000000f0, 0x48038806, 0x59a8001d,
-+ 0x80000540, 0x04020002, 0x80000000, 0x48038893,
-+ 0x80000580, 0x5c001000, 0x4df00000, 0x0201f800,
-+ 0x001018be, 0x5c03e000, 0x480b8808, 0x5c01d000,
-+ 0x5c00b000, 0x1c01f000, 0x4803c856, 0x4c580000,
-+ 0x4ce80000, 0x59c41008, 0x82080500, 0xffffff7f,
-+ 0x48038808, 0x4c080000, 0x59c40004, 0x82000500,
-+ 0x00003e02, 0x04000005, 0x4201d000, 0x00000014,
-+ 0x0201f800, 0x00105c78, 0x0201f800, 0x00100a20,
-+ 0x42000000, 0x0010b078, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x00100e3b, 0x4a038808, 0x00000002,
-+ 0x80000580, 0x48038880, 0x48038893, 0x0201f800,
-+ 0x00101536, 0x4200b000, 0x00000384, 0x4a038805,
-+ 0x000000f0, 0x0201f800, 0x00101892, 0x42000800,
-+ 0x000000f0, 0x59c40005, 0x80040d00, 0x04000015,
-+ 0x82000500, 0x000000d0, 0x04020012, 0x4201d000,
-+ 0x00000067, 0x0201f800, 0x00105c78, 0x8058b040,
-+ 0x040207ef, 0x0201f800, 0x00106725, 0x4a038808,
-+ 0x00000008, 0x4a035030, 0x00000001, 0x4202d800,
-+ 0x00000001, 0x82000540, 0x00000001, 0x0401f010,
-+ 0x497b8880, 0x59a8001d, 0x80000540, 0x04020002,
-+ 0x80000000, 0x48038893, 0x59a80027, 0x82000500,
-+ 0x0000ffff, 0x4c000000, 0x0201f800, 0x00101536,
-+ 0x5c000000, 0x48038880, 0x80000580, 0x5c001000,
-+ 0x4df00000, 0x0201f800, 0x001018be, 0x5c03e000,
-+ 0x480b8808, 0x5c01d000, 0x5c00b000, 0x1c01f000,
-+ 0x4803c856, 0x59c40004, 0x82000500, 0x00003e02,
-+ 0x0400000a, 0x0201f800, 0x00106725, 0x4a038808,
-+ 0x00000008, 0x4a035030, 0x00000001, 0x4202d800,
-+ 0x00000001, 0x0401f04e, 0x0201f800, 0x00100a20,
-+ 0x42000000, 0x0010b079, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x00100e3b, 0x59c40006, 0x84000508,
-+ 0x48038806, 0x4a038805, 0x00000010, 0x850e1d4c,
-+ 0x42000800, 0x00000064, 0x42001000, 0x00104bc8,
-+ 0x0201f800, 0x00105c4d, 0x4a038808, 0x00000000,
-+ 0x497b8880, 0x4a038805, 0x000000f0, 0x0201f800,
-+ 0x00101892, 0x42000800, 0x000000f0, 0x59c40005,
-+ 0x80040d00, 0x0400000e, 0x82000500, 0x000000e0,
-+ 0x0402000b, 0x4201d000, 0x000003e8, 0x0201f800,
-+ 0x00105c78, 0x0201f800, 0x00105b22, 0x59940004,
-+ 0x80000540, 0x040207ec, 0x0401f021, 0x4c080000,
-+ 0x42001000, 0x00104bd9, 0x0201f800, 0x00105b6f,
-+ 0x42001000, 0x00104bc8, 0x0201f800, 0x00105c63,
-+ 0x5c001000, 0x497b8880, 0x59a8001d, 0x80000540,
-+ 0x04020002, 0x80000000, 0x48038893, 0x59a80027,
- 0x82000500, 0x0000ffff, 0x4c000000, 0x0201f800,
-- 0x00101670, 0x5c000000, 0x48038880, 0x80000580,
-- 0x5c001000, 0x4df00000, 0x0201f800, 0x001019ca,
-- 0x5c03e000, 0x480b8808, 0x5c01d000, 0x5c00b000,
-- 0x1c01f000, 0x4803c856, 0x59c40004, 0x82000500,
-- 0x00003e02, 0x0400000a, 0x0201f800, 0x00106c32,
-- 0x4a038808, 0x00000008, 0x4a035033, 0x00000001,
-- 0x4202d800, 0x00000001, 0x0401f052, 0x0201f800,
-- 0x00100b29, 0x42000000, 0x0010b6a9, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00100f42, 0x59c40006,
-- 0x84000508, 0x48038806, 0x4a038805, 0x00000010,
-- 0x59a80805, 0x84040d4c, 0x48075005, 0x42000800,
-- 0x00000064, 0x42001000, 0x00104d2c, 0x0201f800,
-- 0x00105da7, 0x4a038808, 0x00000000, 0x497b8880,
-- 0x4a038805, 0x000000f0, 0x0201f800, 0x001019a4,
-- 0x42000800, 0x000000f0, 0x59c40005, 0x80040d00,
-- 0x0400000e, 0x82000500, 0x000000e0, 0x0402000b,
-- 0x4201d000, 0x000003e8, 0x0201f800, 0x00105dd2,
-- 0x0201f800, 0x00105c81, 0x59940004, 0x80000540,
-- 0x040207ec, 0x0401f023, 0x4c080000, 0x42001000,
-- 0x00104d39, 0x0201f800, 0x00105cc9, 0x42001000,
-- 0x00104d2c, 0x0201f800, 0x00105dbd, 0x5c001000,
-- 0x497b8880, 0x59a8001e, 0x80000540, 0x04020002,
-- 0x80000000, 0x48038893, 0x59a8002a, 0x82000500,
-- 0x0000ffff, 0x4c000000, 0x0201f800, 0x00101670,
-- 0x5c000000, 0x48038880, 0x59a80805, 0x84040d0c,
-- 0x48075005, 0x59c40006, 0x84000548, 0x48038806,
-- 0x0201f800, 0x001019ca, 0x4a038808, 0x00000080,
-- 0x1c01f000, 0x4803c856, 0x4d400000, 0x4d3c0000,
-- 0x0201f800, 0x00106c32, 0x0201f800, 0x0010a95a,
-- 0x04020024, 0x599c1017, 0x59a80805, 0x8c040d00,
-- 0x0402000c, 0x8c08151a, 0x0400001e, 0x84040d42,
-- 0x48075005, 0x42028000, 0x00000004, 0x42027800,
-- 0x00000008, 0x8c081508, 0x04020007, 0x0401f011,
-- 0x42028000, 0x00000004, 0x417a7800, 0x8c081508,
-- 0x0400000c, 0x4d400000, 0x42028000, 0x0000000e,
-- 0x42028800, 0x0000ffff, 0x0201f800, 0x0010a258,
-- 0x5c028000, 0x599c0817, 0x8c040d0a, 0x04020005,
-- 0x4943c857, 0x493fc857, 0x0201f800, 0x00101d90,
-- 0x497b8880, 0x4202d800, 0x00000001, 0x0401fcff,
-- 0x5c027800, 0x5c028000, 0x1c01f000, 0x0201f800,
-- 0x00100b29, 0x42000000, 0x0010b6aa, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00100f42, 0x42000000,
-- 0x00000001, 0x0201f800, 0x00101670, 0x4a038880,
-- 0x00000001, 0x0201f000, 0x001019ca, 0x4202e000,
-- 0x00000000, 0x4a033015, 0x00000001, 0x497b301d,
-- 0x497b3006, 0x4a03b004, 0x60000001, 0x59d80005,
-- 0x4a03b004, 0x90000001, 0x4a03a804, 0x60000001,
-- 0x59d40005, 0x4a03a804, 0x90000001, 0x0201f000,
-- 0x00105667, 0x4a03c825, 0x00000004, 0x4a03c827,
-- 0x00000004, 0x599c0409, 0x80000d40, 0x04000020,
-- 0x599c0407, 0x80000540, 0x04000007, 0x800000cc,
-- 0x599c100b, 0x80080400, 0x4803b000, 0x497bb002,
-- 0x59d80001, 0x599c000b, 0x4803b000, 0x599c000c,
-- 0x4803b001, 0x599c0407, 0x80000540, 0x04020002,
-- 0x497bb002, 0x599c0c09, 0x82040540, 0x00400000,
-- 0x4803b003, 0x4a03b009, 0x00000004, 0x4a03b004,
-- 0x10000001, 0x59e00803, 0x82040d00, 0xfffffeff,
-- 0x82040d40, 0x00008000, 0x4807c003, 0x599c040a,
-- 0x80000540, 0x04000020, 0x599c0408, 0x80000540,
-- 0x04000007, 0x800000cc, 0x599c100f, 0x80080400,
-- 0x4803a800, 0x497ba802, 0x59d40001, 0x599c000f,
-- 0x4803a800, 0x599c0010, 0x4803a801, 0x599c0408,
-- 0x80000540, 0x04020002, 0x497ba802, 0x599c0c0a,
-- 0x82040540, 0x00400000, 0x4803a803, 0x4a03a809,
-- 0x00000004, 0x4a03a804, 0x10000001, 0x59e00803,
-- 0x82040d00, 0xfffffbff, 0x82040d40, 0x00008000,
-- 0x4807c003, 0x800409c0, 0x04000007, 0x4202e000,
-- 0x00000001, 0x0200b800, 0x00020685, 0x0200f000,
-- 0x0002069a, 0x1c01f000, 0x0201f800, 0x00100615,
-- 0x1c01f000, 0x4df00000, 0x4203e000, 0x50000000,
-- 0x59981005, 0x800811c0, 0x0400001e, 0x58080005,
-- 0x82000d00, 0x43018780, 0x02020000, 0x0010552a,
-- 0x8c000508, 0x04000015, 0x580a5808, 0x592c0204,
-- 0x497a5800, 0x497a5801, 0x82000500, 0x000000ff,
-- 0x82000c80, 0x0000004b, 0x0402100b, 0x0c01f80f,
-- 0x5c03e000, 0x83700580, 0x00000003, 0x040007e6,
-- 0x0200f800, 0x0002069a, 0x0200b000, 0x00020685,
-- 0x1c01f000, 0x0401f850, 0x5c03e000, 0x0401f7f9,
-- 0x0401f8ee, 0x0401f7fd, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105171, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x001051f9, 0x00105161, 0x00105161, 0x00105171,
-- 0x00105171, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x492fc857, 0x42000000, 0x0010b65d,
-- 0x0201f800, 0x0010a86e, 0x42000000, 0x00000400,
-- 0x0401f019, 0x492fc857, 0x42000000, 0x0010b65c,
-- 0x0201f800, 0x0010a86e, 0x42000000, 0x00001000,
-- 0x0401f011, 0x492fc857, 0x42000000, 0x0010b65b,
-- 0x0201f800, 0x0010a86e, 0x42000000, 0x00002000,
-- 0x0401f009, 0x492fc857, 0x42000000, 0x0010b65e,
-- 0x0201f800, 0x0010a86e, 0x42000000, 0x00000800,
-- 0x0401f001, 0x4803c857, 0x4202e000, 0x00000001,
-- 0x592c0c04, 0x82040d00, 0xffff80ff, 0x80040540,
-- 0x48025c04, 0x0201f000, 0x00020381, 0x592c0204,
-- 0x492fc857, 0x80000110, 0x040007db, 0x80000040,
-- 0x04000035, 0x48033002, 0x492f3003, 0x492f3004,
-- 0x4a033008, 0x001051c5, 0x4202e000, 0x00000003,
-- 0x1c01f000, 0x592c0204, 0x492fc857, 0x80000110,
-- 0x040007cd, 0x80000040, 0x04000043, 0x48033002,
-- 0x492f3003, 0x492f3004, 0x4a033008, 0x001051e1,
-- 0x4202e000, 0x00000003, 0x1c01f000, 0x492fc857,
-- 0x0201f800, 0x0010a95a, 0x02020000, 0x0002060c,
-+ 0x00101536, 0x5c000000, 0x48038880, 0x850e1d0c,
-+ 0x59c40006, 0x84000548, 0x48038806, 0x0201f800,
-+ 0x001018be, 0x4a038808, 0x00000080, 0x1c01f000,
-+ 0x4803c856, 0x4d400000, 0x4d3c0000, 0x0201f800,
-+ 0x00106725, 0x0201f800, 0x0010a34c, 0x04020022,
-+ 0x599c1017, 0x8d0e1d00, 0x0402000b, 0x8c08151a,
-+ 0x0400001d, 0x850e1d42, 0x42028000, 0x00000004,
-+ 0x42027800, 0x00000008, 0x8d0e1d20, 0x04020007,
-+ 0x0401f011, 0x42028000, 0x00000004, 0x417a7800,
-+ 0x8d0e1d20, 0x0400000c, 0x4d400000, 0x42028000,
-+ 0x0000000e, 0x42028800, 0x0000ffff, 0x0201f800,
-+ 0x00109c1c, 0x5c028000, 0x599c0817, 0x8c040d0a,
-+ 0x04020005, 0x4943c857, 0x493fc857, 0x0201f800,
-+ 0x0010ca42, 0x497b8880, 0x4202d800, 0x00000001,
-+ 0x0401fcee, 0x5c027800, 0x5c028000, 0x1c01f000,
-+ 0x0201f800, 0x00100a20, 0x42000000, 0x0010b07a,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x00100e3b,
-+ 0x42000000, 0x00000001, 0x0201f800, 0x00101536,
-+ 0x4a038880, 0x00000001, 0x0201f000, 0x001018be,
-+ 0x4202e000, 0x00000000, 0x497b3004, 0x4a03b004,
-+ 0x60000001, 0x59d80005, 0x4a03b004, 0x90000001,
-+ 0x4a03a804, 0x60000001, 0x59d40005, 0x4a03a804,
-+ 0x90000001, 0x0201f000, 0x001054fc, 0x4a03c825,
-+ 0x00000004, 0x4a03c827, 0x00000004, 0x599c0409,
-+ 0x80000d40, 0x04000020, 0x599c0407, 0x80000540,
-+ 0x04000007, 0x800000cc, 0x599c100b, 0x80080400,
-+ 0x4803b000, 0x497bb002, 0x59d80001, 0x599c000b,
-+ 0x4803b000, 0x599c000c, 0x4803b001, 0x599c0407,
-+ 0x80000540, 0x04020002, 0x497bb002, 0x599c0c09,
-+ 0x82040540, 0x00400000, 0x4803b003, 0x4a03b009,
-+ 0x00000004, 0x4a03b004, 0x10000001, 0x59e00803,
-+ 0x82040d00, 0xfffffeff, 0x82040d40, 0x00008000,
-+ 0x4807c003, 0x599c040a, 0x80000540, 0x04000020,
-+ 0x599c0408, 0x80000540, 0x04000007, 0x800000cc,
-+ 0x599c100f, 0x80080400, 0x4803a800, 0x497ba802,
-+ 0x59d40001, 0x599c000f, 0x4803a800, 0x599c0010,
-+ 0x4803a801, 0x599c0408, 0x80000540, 0x04020002,
-+ 0x497ba802, 0x599c0c0a, 0x82040540, 0x00400000,
-+ 0x4803a803, 0x4a03a809, 0x00000004, 0x4a03a804,
-+ 0x10000001, 0x59e00803, 0x82040d00, 0xfffffbff,
-+ 0x82040d40, 0x00008000, 0x4807c003, 0x800409c0,
-+ 0x04000007, 0x4202e000, 0x00000001, 0x0200b800,
-+ 0x000205a6, 0x0200f000, 0x000205bb, 0x1c01f000,
-+ 0x0201f800, 0x001004ef, 0x1c01f000, 0x4df00000,
-+ 0x4203e000, 0x50000000, 0x59981003, 0x800811c0,
-+ 0x0400001e, 0x58080005, 0x82000d00, 0x43018780,
-+ 0x02020000, 0x001053c6, 0x8c000508, 0x04000015,
-+ 0x580a5808, 0x592c0204, 0x497a5800, 0x497a5801,
-+ 0x82000500, 0x000000ff, 0x82000c80, 0x0000004b,
-+ 0x0402100b, 0x0c01f80f, 0x5c03e000, 0x83700580,
-+ 0x00000003, 0x040007e6, 0x0200f800, 0x000205bb,
-+ 0x0200b000, 0x000205a6, 0x1c01f000, 0x0401f850,
-+ 0x5c03e000, 0x0401f7f9, 0x0401f8e2, 0x0401f7fd,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010501f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010509b, 0x0010500f,
-+ 0x0010500f, 0x0010501f, 0x0010501f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x492fc857,
-+ 0x42000000, 0x0010b02d, 0x0201f800, 0x0010a260,
-+ 0x42000000, 0x00000400, 0x0401f019, 0x492fc857,
-+ 0x42000000, 0x0010b02c, 0x0201f800, 0x0010a260,
-+ 0x42000000, 0x00001000, 0x0401f011, 0x492fc857,
-+ 0x42000000, 0x0010b02b, 0x0201f800, 0x0010a260,
-+ 0x42000000, 0x00002000, 0x0401f009, 0x492fc857,
-+ 0x42000000, 0x0010b02e, 0x0201f800, 0x0010a260,
-+ 0x42000000, 0x00000800, 0x0401f001, 0x4803c857,
-+ 0x4202e000, 0x00000001, 0x592c0c04, 0x82040d00,
-+ 0xffff80ff, 0x80040540, 0x48025c04, 0x0201f000,
-+ 0x000202e9, 0x492fc857, 0x80140110, 0x80000040,
-+ 0x0400002d, 0x040017da, 0x4a033006, 0x00105069,
-+ 0x0201f000, 0x00020528, 0x492fc857, 0x80140110,
-+ 0x040007d3, 0x80000040, 0x0400003e, 0x4a033006,
-+ 0x00105084, 0x0201f000, 0x00020528, 0x492fc857,
-+ 0x0201f800, 0x0010a34c, 0x02020000, 0x00020536,
- 0x492fc857, 0x592e8a06, 0x83440c80, 0x000007f0,
-- 0x0402100b, 0x83440400, 0x0010aa00, 0x50000000,
-+ 0x0402100b, 0x83440400, 0x0010a400, 0x50000000,
- 0x80026d40, 0x04000006, 0x4937c857, 0x59340200,
-- 0x8c00050e, 0x02020000, 0x0002060c, 0x42028000,
-+ 0x8c00050e, 0x02020000, 0x00020536, 0x42028000,
- 0x00000028, 0x41780800, 0x417a6000, 0x0201f800,
-- 0x00104bee, 0x0201f800, 0x00108f7d, 0x0201f000,
-- 0x00020381, 0x592c0a0a, 0x8c040d02, 0x04020016,
-- 0x59a80021, 0x492fc857, 0x80000540, 0x0402000f,
-- 0x592c0207, 0x80000540, 0x04000005, 0x0201f800,
-- 0x00104156, 0x04020004, 0x1c01f000, 0x42000000,
-- 0x00000000, 0x592c0a06, 0x48065c06, 0x48025a06,
-- 0x0201f000, 0x00020381, 0x42000000, 0x00000028,
-- 0x0401f7f9, 0x42000800, 0x00000009, 0x0201f000,
-- 0x001063a9, 0x592c0208, 0x492fc857, 0x82000c80,
-- 0x0000199a, 0x04021794, 0x592c0408, 0x80000540,
-- 0x04020791, 0x59a80821, 0x800409c0, 0x04020009,
-- 0x592c0207, 0x80000540, 0x0400078b, 0x497a5a06,
-- 0x0201f800, 0x001041b5, 0x04020004, 0x1c01f000,
-- 0x42000000, 0x00000028, 0x48025a06, 0x0201f000,
-- 0x00020381, 0x59980804, 0x59980002, 0x48065800,
-- 0x492c0801, 0x492f3004, 0x80000040, 0x48033002,
-- 0x04000002, 0x1c01f000, 0x599a5803, 0x59980008,
-- 0x4202e000, 0x00000001, 0x0801f000, 0x592e8a06,
-- 0x592c0406, 0x4803c856, 0x82000500, 0x000000ff,
-- 0x4200b800, 0x00000001, 0x82000d80, 0x00000001,
-- 0x04000015, 0x417a8800, 0x4200b800, 0x000007f0,
-- 0x82000d80, 0x00000002, 0x0400000f, 0x80000540,
-- 0x02020000, 0x00020381, 0x592e8a06, 0x0201f800,
-- 0x00020267, 0x02020000, 0x00020381, 0x592e9008,
-- 0x592e9809, 0x0201f800, 0x00104567, 0x0201f000,
-- 0x00020381, 0x59a80805, 0x84040d00, 0x48075005,
-- 0x0201f800, 0x00020267, 0x02000800, 0x0010467a,
-- 0x81468800, 0x805cb840, 0x040207fa, 0x0201f000,
-- 0x00020381, 0x592c0a08, 0x4807c857, 0x82040580,
-- 0x0000000e, 0x04000045, 0x82040580, 0x00000046,
-- 0x04000046, 0x82040580, 0x00000045, 0x04000020,
-- 0x82040580, 0x00000029, 0x04000010, 0x82040580,
-- 0x0000002a, 0x04000009, 0x82040580, 0x0000000f,
-- 0x04000200, 0x82040580, 0x0000002e, 0x040001fd,
-- 0x4807c856, 0x0401f1f6, 0x59a80805, 0x84040d04,
-- 0x48075005, 0x0401f1f7, 0x592e8a06, 0x0201f800,
-- 0x00020267, 0x040201f3, 0x59340200, 0x84000518,
-- 0x48026a00, 0x592e6009, 0x4933c857, 0x83300580,
-- 0xffffffff, 0x0402002a, 0x0401f1ea, 0x592c1407,
-- 0x480bc857, 0x0201f800, 0x001091d9, 0x411e6000,
-- 0x04020003, 0x4803c856, 0x0401f1dd, 0x592e3809,
-- 0x591c1414, 0x84081516, 0x84081554, 0x480a3c14,
-- 0x4a026403, 0x0000003a, 0x592c040b, 0x80000540,
-- 0x04000007, 0x4a026403, 0x0000003b, 0x592c020c,
-- 0x4802641a, 0x592c040c, 0x4802621a, 0x4a026203,
-- 0x00000001, 0x42000800, 0x80000040, 0x0201f800,
-- 0x00020855, 0x0401f1cb, 0x59a80068, 0x84000510,
-- 0x48035068, 0x0401f1c7, 0x592c1207, 0x8c081500,
-- 0x040201c4, 0x592e8a06, 0x592e6009, 0x0201f800,
-- 0x001091e3, 0x04020003, 0x4803c856, 0x0401f1b8,
-- 0x59300c06, 0x82040580, 0x00000004, 0x04000003,
-- 0x4803c856, 0x0401f1b2, 0x59300a03, 0x82040580,
-- 0x00000007, 0x04000003, 0x4803c856, 0x0401f1ac,
-- 0x59300c03, 0x82040580, 0x00000001, 0x04000025,
-- 0x82040580, 0x00000003, 0x0400001a, 0x82040580,
-- 0x00000006, 0x04000024, 0x82040580, 0x00000008,
-- 0x04000019, 0x82040580, 0x0000000a, 0x0400000a,
-- 0x82040580, 0x0000000c, 0x04000004, 0x82040580,
-- 0x0000002e, 0x0402001c, 0x42000800, 0x00000009,
-- 0x0401f017, 0x59326809, 0x0201f800, 0x0010484b,
-- 0x04020015, 0x42000800, 0x00000005, 0x0401f010,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x4a026406,
-- 0x00000001, 0x42000800, 0x00000003, 0x0401f008,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x4a026406,
-- 0x00000001, 0x42000800, 0x0000000b, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x0201f800,
-- 0x00106470, 0x0401f17b, 0x40000800, 0x58040000,
-- 0x80000540, 0x040207fd, 0x492c0800, 0x1c01f000,
-- 0x492fc857, 0x59300c06, 0x82040580, 0x00000006,
-- 0x04020094, 0x0201f800, 0x00104836, 0x04020005,
-- 0x59340200, 0x8c00051a, 0x02000000, 0x00020667,
-- 0x59340200, 0x8c00050e, 0x0400008a, 0x59300203,
-- 0x42027800, 0x00000001, 0x82000580, 0x00000007,
-- 0x02020000, 0x00020667, 0x4a026203, 0x00000002,
-- 0x0201f000, 0x00020667, 0x42028000, 0x00000002,
-- 0x4a026206, 0x00000014, 0x4d2c0000, 0x0201f800,
-- 0x00109fc0, 0x5c025800, 0x59300c06, 0x4807c857,
-- 0x82040580, 0x00000007, 0x04020063, 0x492fc857,
-- 0x4a025a06, 0x00000001, 0x0201f000, 0x00020381,
-- 0x592c240a, 0x492fc857, 0x4813c857, 0x8c10251c,
-- 0x04020016, 0x8c10251a, 0x04000003, 0x8c10250a,
-- 0x04000069, 0x59340a00, 0x8c040d0e, 0x04000003,
-- 0x8c10251e, 0x04000064, 0x0201f800, 0x00020892,
-- 0x0400006b, 0x592c240a, 0x49366009, 0x49325809,
-- 0x4a026406, 0x00000006, 0x4a026203, 0x00000007,
-- 0x0201f000, 0x00020663, 0x592c0a0c, 0x5934000f,
-- 0x41784000, 0x80001540, 0x0400006d, 0x58080204,
-- 0x82000500, 0x000000ff, 0x82000580, 0x00000012,
-- 0x04020004, 0x5808020c, 0x80040580, 0x04000004,
-- 0x58080000, 0x40084000, 0x0401f7f3, 0x58080000,
-- 0x49781000, 0x802041c0, 0x04000006, 0x48004000,
-- 0x80000540, 0x04020007, 0x48226810, 0x0401f005,
-- 0x4802680f, 0x80000540, 0x04020002, 0x497a6810,
-- 0x4d2c0000, 0x400a5800, 0x4a025a06, 0x00000002,
-- 0x0201f800, 0x00020381, 0x5c025800, 0x0401f7bc,
-- 0x592c040a, 0x8c00051c, 0x04000016, 0x592c0206,
-- 0x82000580, 0x0000ffff, 0x04020012, 0x592e6009,
-- 0x83300580, 0xffffffff, 0x040007b1, 0x83300480,
-- 0x0010cfc0, 0x04001010, 0x59a8000b, 0x81300480,
-- 0x0402100d, 0x59300008, 0x800001c0, 0x04020005,
-- 0x59300203, 0x82000580, 0x00000007, 0x04000797,
-- 0x492fc857, 0x4a025a06, 0x00000029, 0x0201f000,
-- 0x00020381, 0x492fc857, 0x4a025a06, 0x00000008,
-- 0x0201f000, 0x00020381, 0x492fc857, 0x4a025a06,
-- 0x00000045, 0x0201f000, 0x00020381, 0x492fc857,
-- 0x4a025a06, 0x0000002a, 0x0201f000, 0x00020381,
-- 0x492fc857, 0x4a025a06, 0x00000028, 0x0201f000,
-- 0x00020381, 0x492fc857, 0x4a025a06, 0x00000006,
-- 0x0201f000, 0x00020381, 0x492fc857, 0x4a025a06,
-- 0x0000000e, 0x0201f000, 0x00020381, 0x59340010,
-- 0x492e6810, 0x492fc857, 0x80000d40, 0x04000003,
-- 0x492c0800, 0x1c01f000, 0x5934040b, 0x492e680f,
-- 0x492fc857, 0x4803c857, 0x80000540, 0x04020003,
-- 0x4a026a03, 0x00000001, 0x1c01f000, 0x59a8000e,
-- 0x81640480, 0x0402176e, 0x42026000, 0x0010cfc0,
-- 0x59300009, 0x81340580, 0x04020004, 0x59300202,
-- 0x80040580, 0x04000759, 0x83326400, 0x00000024,
-- 0x41580000, 0x81300480, 0x040017f6, 0x0401f760,
-- 0x492fc857, 0x592c0407, 0x82000c80, 0x0000199a,
-- 0x040215dd, 0x592c0204, 0x80000112, 0x040205ca,
-- 0x592e8a06, 0x0201f800, 0x00020267, 0x04020059,
-- 0x0201f800, 0x00104836, 0x04020059, 0x592e780a,
-- 0x493fc857, 0x8d3e7d3e, 0x04020007, 0x59a80021,
-- 0x80000540, 0x0402004f, 0x0201f800, 0x00104686,
-- 0x040005c9, 0x833c1d00, 0x0000001f, 0x040005c6,
-- 0x592c0207, 0x82000c80, 0x00001000, 0x040215c2,
-- 0x800000c2, 0x800008c4, 0x8005d400, 0x592e9008,
-- 0x592e9809, 0x5934080d, 0x800409c0, 0x0402002e,
-- 0x833c1d00, 0x0000001f, 0x81780040, 0x80000000,
-- 0x800c1902, 0x040217fe, 0x040205b3, 0x0c01f001,
-- 0x001053cd, 0x001053d0, 0x001053dd, 0x001053e0,
-- 0x001053e3, 0x0201f800, 0x00108dfb, 0x0401f01a,
-- 0x0201f800, 0x00104659, 0x04000027, 0x80e9d1c0,
-- 0x02020800, 0x00105ce7, 0x42028000, 0x00000005,
-- 0x417a9000, 0x417a9800, 0x0201f800, 0x00108e0b,
-- 0x0401f00d, 0x42027000, 0x0000004d, 0x0401f006,
-- 0x42027000, 0x0000004e, 0x0401f003, 0x42027000,
-- 0x00000052, 0x0201f800, 0x0010451d, 0x02020800,
-- 0x00108e3b, 0x04000010, 0x8d3e7d3e, 0x04020017,
-- 0x1c01f000, 0x58040002, 0x80000540, 0x04020007,
-- 0x4d3c0000, 0x40067800, 0x0201f800, 0x00104639,
-- 0x5c027800, 0x040207cb, 0x4a025a06, 0x00000030,
-- 0x0401f00d, 0x4a025a06, 0x0000002c, 0x0401f00a,
-- 0x4a025a06, 0x00000028, 0x0401f007, 0x4a025a06,
-- 0x00000029, 0x0401f004, 0x497a5c09, 0x4a025a06,
-- 0x00000000, 0x4a025a04, 0x00000103, 0x0201f000,
-- 0x00020381, 0x492fc857, 0x592c0204, 0x80000110,
-- 0x80000040, 0x04000002, 0x0401f55b, 0x592c0207,
-- 0x82000500, 0x000003ff, 0x48025a07, 0x8c000506,
-- 0x04000004, 0x82000500, 0x00000070, 0x04020004,
-- 0x59a80821, 0x800409c0, 0x04020018, 0x4a025a06,
-+ 0x00104a8e, 0x0201f800, 0x001089e5, 0x0201f000,
-+ 0x000202e9, 0x592c0a0a, 0x8c040d02, 0x04020015,
-+ 0x492fc857, 0x8d0e1d0e, 0x0402000f, 0x592c0207,
-+ 0x80000540, 0x04000005, 0x0201f800, 0x00103ff4,
-+ 0x04020004, 0x1c01f000, 0x42000000, 0x00000000,
-+ 0x592c0a06, 0x48065c06, 0x48025a06, 0x0201f000,
-+ 0x000202e9, 0x42000000, 0x00000028, 0x0401f7f9,
-+ 0x42000800, 0x00000009, 0x0201f000, 0x00106272,
-+ 0x592c0208, 0x492fc857, 0x82000c80, 0x0000199a,
-+ 0x0402179f, 0x592c0408, 0x80000540, 0x0402079c,
-+ 0x8d0e1d0e, 0x04020009, 0x592c0207, 0x80000540,
-+ 0x04000797, 0x497a5a06, 0x0201f800, 0x00104052,
-+ 0x04020004, 0x1c01f000, 0x42000000, 0x00000028,
-+ 0x48025a06, 0x0201f000, 0x000202e9, 0x59980802,
-+ 0x59980000, 0x48065800, 0x492c0801, 0x492f3002,
-+ 0x80000040, 0x48033000, 0x04000002, 0x1c01f000,
-+ 0x599a5801, 0x59980006, 0x4202e000, 0x00000001,
-+ 0x0801f800, 0x1c01f000, 0x592e8a06, 0x592c0406,
-+ 0x4803c856, 0x82000500, 0x000000ff, 0x4200b800,
-+ 0x00000001, 0x82000d80, 0x00000001, 0x04000015,
-+ 0x417a8800, 0x4200b800, 0x000007f0, 0x82000d80,
-+ 0x00000002, 0x0400000f, 0x80000540, 0x02020000,
-+ 0x000202e9, 0x592e8a06, 0x0201f800, 0x0002025a,
-+ 0x02020000, 0x000202e9, 0x592e9008, 0x592e9809,
-+ 0x0201f800, 0x0010442d, 0x0201f000, 0x000202e9,
-+ 0x850e1d00, 0x0201f800, 0x0002025a, 0x02000800,
-+ 0x00104549, 0x81468800, 0x805cb840, 0x040207fa,
-+ 0x0201f000, 0x000202e9, 0x592c0a08, 0x4807c857,
-+ 0x82040580, 0x0000000e, 0x04000043, 0x82040580,
-+ 0x00000046, 0x04000044, 0x82040580, 0x00000045,
-+ 0x0400001e, 0x82040580, 0x00000029, 0x0400000e,
-+ 0x82040580, 0x0000002a, 0x04000009, 0x82040580,
-+ 0x0000000f, 0x040001fb, 0x82040580, 0x0000002e,
-+ 0x040001f8, 0x4807c856, 0x0401f1f1, 0x850e1d04,
-+ 0x0401f1f4, 0x592e8a06, 0x0201f800, 0x0002025a,
-+ 0x040201f0, 0x59340200, 0x84000518, 0x48026a00,
-+ 0x592e6009, 0x4933c857, 0x83300580, 0xffffffff,
-+ 0x0402002a, 0x0401f1e7, 0x592c1407, 0x480bc857,
-+ 0x0201f800, 0x00108c55, 0x411e6000, 0x04020003,
-+ 0x4803c856, 0x0401f1da, 0x592e3809, 0x591c1414,
-+ 0x84081516, 0x84081554, 0x480a3c14, 0x4a026403,
-+ 0x0000003a, 0x592c040b, 0x80000540, 0x04000007,
-+ 0x4a026403, 0x0000003b, 0x592c020c, 0x4802641a,
-+ 0x592c040c, 0x4802621a, 0x4a026203, 0x00000001,
-+ 0x42000800, 0x80000040, 0x0201f800, 0x0002075c,
-+ 0x0401f1c8, 0x59a80065, 0x84000510, 0x48035065,
-+ 0x0401f1c4, 0x592c1207, 0x8c081500, 0x040201c1,
-+ 0x592e8a06, 0x592e6009, 0x0201f800, 0x00108c60,
-+ 0x04020003, 0x4803c856, 0x0401f1b5, 0x59300c06,
-+ 0x82040580, 0x00000004, 0x04000003, 0x4803c856,
-+ 0x0401f1af, 0x59300a03, 0x82040580, 0x00000007,
-+ 0x04000003, 0x4803c856, 0x0401f1a9, 0x59300c03,
-+ 0x82040580, 0x00000001, 0x04000025, 0x82040580,
-+ 0x00000002, 0x0400001a, 0x82040580, 0x00000006,
-+ 0x04000024, 0x82040580, 0x00000008, 0x04000019,
-+ 0x82040580, 0x0000000a, 0x0400000a, 0x82040580,
-+ 0x0000000c, 0x04000004, 0x82040580, 0x0000002e,
-+ 0x0402001c, 0x42000800, 0x00000009, 0x0401f017,
-+ 0x59326809, 0x0201f800, 0x0010472e, 0x04020015,
-+ 0x42000800, 0x00000005, 0x0401f010, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x4a026406, 0x00000001,
-+ 0x42000800, 0x00000003, 0x0401f008, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x4a026406, 0x00000001,
-+ 0x42000800, 0x0000000b, 0x0201f800, 0x0010426c,
-+ 0x4a026203, 0x00000001, 0x0201f800, 0x00106339,
-+ 0x0401f178, 0x40000800, 0x58040000, 0x80000540,
-+ 0x040207fd, 0x492c0800, 0x1c01f000, 0x492fc857,
-+ 0x59300c06, 0x82040580, 0x00000006, 0x04020094,
-+ 0x0201f800, 0x00104719, 0x04020005, 0x59340200,
-+ 0x8c00051a, 0x02000000, 0x00020589, 0x59340200,
-+ 0x8c00050e, 0x0400008a, 0x59300203, 0x42027800,
-+ 0x00000001, 0x82000580, 0x00000007, 0x02020000,
-+ 0x00020589, 0x4a026203, 0x00000002, 0x0201f000,
-+ 0x00020589, 0x42028000, 0x00000002, 0x4a026206,
-+ 0x00000014, 0x4d2c0000, 0x0201f800, 0x00109a5d,
-+ 0x5c025800, 0x59300c06, 0x4807c857, 0x82040580,
-+ 0x00000007, 0x04020063, 0x492fc857, 0x4a025a06,
-+ 0x00000001, 0x0201f000, 0x000202e9, 0x592c240a,
-+ 0x492fc857, 0x4813c857, 0x8c10251c, 0x04020016,
-+ 0x8c10251a, 0x04000003, 0x8c10250a, 0x04000069,
-+ 0x59340a00, 0x8c040d0e, 0x04000003, 0x8c10251e,
-+ 0x04000064, 0x0201f800, 0x00020799, 0x0400006b,
-+ 0x592c240a, 0x49366009, 0x49325809, 0x4a026406,
-+ 0x00000006, 0x4a026203, 0x00000007, 0x0201f000,
-+ 0x00020586, 0x592c0a0c, 0x5934000f, 0x41784000,
-+ 0x80001540, 0x0400006d, 0x58080204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000012, 0x04020004,
-+ 0x5808020c, 0x80040580, 0x04000004, 0x58080000,
-+ 0x40084000, 0x0401f7f3, 0x58080000, 0x49781000,
-+ 0x802041c0, 0x04000006, 0x48004000, 0x80000540,
-+ 0x04020007, 0x48226810, 0x0401f005, 0x4802680f,
-+ 0x80000540, 0x04020002, 0x497a6810, 0x4d2c0000,
-+ 0x400a5800, 0x4a025a06, 0x00000002, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x0401f7bc, 0x592c040a,
-+ 0x8c00051c, 0x04000016, 0x592c0206, 0x82000580,
-+ 0x0000ffff, 0x04020012, 0x592e6009, 0x83300580,
-+ 0xffffffff, 0x040007b1, 0x83300480, 0x0010d8d4,
-+ 0x04001010, 0x59a8000a, 0x81300480, 0x0402100d,
-+ 0x59300008, 0x800001c0, 0x04020005, 0x59300203,
-+ 0x82000580, 0x00000007, 0x04000797, 0x492fc857,
-+ 0x4a025a06, 0x00000029, 0x0201f000, 0x000202e9,
-+ 0x492fc857, 0x4a025a06, 0x00000008, 0x0201f000,
-+ 0x000202e9, 0x492fc857, 0x4a025a06, 0x00000045,
-+ 0x0201f000, 0x000202e9, 0x492fc857, 0x4a025a06,
-+ 0x0000002a, 0x0201f000, 0x000202e9, 0x492fc857,
-+ 0x4a025a06, 0x00000028, 0x0201f000, 0x000202e9,
-+ 0x492fc857, 0x4a025a06, 0x00000006, 0x0201f000,
-+ 0x000202e9, 0x492fc857, 0x4a025a06, 0x0000000e,
-+ 0x0201f000, 0x000202e9, 0x59340010, 0x492e6810,
-+ 0x492fc857, 0x80000d40, 0x04000003, 0x492c0800,
-+ 0x1c01f000, 0x5934040b, 0x492e680f, 0x492fc857,
-+ 0x4803c857, 0x80000540, 0x04020003, 0x4a026a03,
-+ 0x00000001, 0x1c01f000, 0x59a8000d, 0x81640480,
-+ 0x0402176e, 0x42026000, 0x0010d8d4, 0x59300009,
-+ 0x81340580, 0x04020004, 0x59300202, 0x80040580,
-+ 0x04000759, 0x83326400, 0x00000024, 0x41580000,
-+ 0x81300480, 0x040017f6, 0x0401f760, 0x492fc857,
-+ 0x592c0407, 0x82000c80, 0x0000199a, 0x040215ec,
-+ 0x592c0204, 0x80000112, 0x040205d9, 0x592e8a06,
-+ 0x0201f800, 0x0002025a, 0x04020058, 0x0201f800,
-+ 0x00104719, 0x04020058, 0x592e780a, 0x493fc857,
-+ 0x8d3e7d3e, 0x04020006, 0x8d0e1d0e, 0x0402004f,
-+ 0x0201f800, 0x00104555, 0x040005d9, 0x833c1d00,
-+ 0x0000001f, 0x040005d6, 0x592c0207, 0x82000c80,
-+ 0x00001000, 0x040215d2, 0x800000c2, 0x800008c4,
-+ 0x8005d400, 0x592e9008, 0x592e9809, 0x5934080d,
-+ 0x800409c0, 0x0402002e, 0x833c1d00, 0x0000001f,
-+ 0x81780040, 0x80000000, 0x800c1902, 0x040217fe,
-+ 0x040205c3, 0x0c01f001, 0x0010526b, 0x0010526e,
-+ 0x0010527b, 0x0010527e, 0x00105281, 0x0201f800,
-+ 0x0010884d, 0x0401f01a, 0x0201f800, 0x00104527,
-+ 0x04000027, 0x80e9d1c0, 0x02020800, 0x00105b8d,
-+ 0x42028000, 0x00000005, 0x417a9000, 0x417a9800,
-+ 0x0201f800, 0x0010885d, 0x0401f00d, 0x42027000,
-+ 0x0000004d, 0x0401f006, 0x42027000, 0x0000004e,
-+ 0x0401f003, 0x42027000, 0x00000052, 0x0201f800,
-+ 0x001043e3, 0x02020800, 0x0010888f, 0x04000010,
-+ 0x8d3e7d3e, 0x04020017, 0x1c01f000, 0x58040002,
-+ 0x80000540, 0x04020007, 0x4d3c0000, 0x40067800,
-+ 0x0201f800, 0x00104507, 0x5c027800, 0x040207cb,
-+ 0x4a025a06, 0x00000030, 0x0401f00d, 0x4a025a06,
-+ 0x0000002c, 0x0401f00a, 0x4a025a06, 0x00000028,
-+ 0x0401f007, 0x4a025a06, 0x00000029, 0x0401f004,
-+ 0x497a5809, 0x4a025a06, 0x00000000, 0x4a025a04,
-+ 0x00000103, 0x0201f000, 0x000202e9, 0x492fc857,
-+ 0x80140110, 0x80000040, 0x04000002, 0x0401f56c,
-+ 0x592c0207, 0x82000500, 0x000003ff, 0x48025a07,
-+ 0x8c000506, 0x04000004, 0x82000500, 0x00000070,
-+ 0x04020003, 0x8d0e1d0e, 0x04020018, 0x4a025a06,
- 0x0000dead, 0x592c0408, 0x82000500, 0x0000f0ff,
-- 0x48025c08, 0x0201f800, 0x001041e4, 0x04020002,
-+ 0x48025c08, 0x0201f800, 0x00104080, 0x04020002,
- 0x1c01f000, 0x49425a06, 0x8058b1c0, 0x04000009,
-- 0x0201f800, 0x00109328, 0x0401f80f, 0x44042800,
-+ 0x0201f800, 0x00108da5, 0x0401f80f, 0x44042800,
- 0x82580580, 0x00000002, 0x04020002, 0x48082801,
-- 0x0201f000, 0x00020381, 0x42028000, 0x00000031,
-+ 0x0201f000, 0x000202e9, 0x42028000, 0x00000031,
- 0x42000800, 0x00000001, 0x4200b000, 0x00000001,
- 0x0401f7ed, 0x592c0408, 0x80000118, 0x832c2c00,
- 0x00000009, 0x80142c00, 0x1c01f000, 0x492fc857,
-- 0x4a025a08, 0x00000006, 0x0201f000, 0x00020381,
-+ 0x4a025a08, 0x00000006, 0x0201f000, 0x000202e9,
- 0x492fc857, 0x4a025a08, 0x00000001, 0x0201f000,
-- 0x00020381, 0x492fc857, 0x592c040a, 0x82000500,
-- 0x00000003, 0x04000020, 0x0201f800, 0x00020892,
-+ 0x000202e9, 0x492fc857, 0x592c040a, 0x82000500,
-+ 0x00000003, 0x04000020, 0x0201f800, 0x00020799,
- 0x04000021, 0x592c0204, 0x492e6008, 0x82000500,
- 0x000000ff, 0x82000580, 0x00000045, 0x0400000e,
-- 0x592c000b, 0x0201f800, 0x001059b9, 0x02000800,
-- 0x00020267, 0x04020018, 0x42027000, 0x00000041,
-+ 0x592c000b, 0x0201f800, 0x00105854, 0x02000800,
-+ 0x0002025a, 0x04020018, 0x42027000, 0x00000041,
- 0x49366009, 0x4a026406, 0x00000001, 0x0201f000,
-- 0x000208d8, 0x59300015, 0x8400055e, 0x48026015,
-- 0x42026800, 0x0010b320, 0x42027000, 0x00000040,
-+ 0x000207df, 0x59300015, 0x8400055e, 0x48026015,
-+ 0x42026800, 0x0010acf1, 0x42027000, 0x00000040,
- 0x0401f7f4, 0x4a025a06, 0x00000101, 0x0201f000,
-- 0x00020381, 0x4a025a06, 0x0000002c, 0x0201f000,
-- 0x00020381, 0x4a025a06, 0x00000028, 0x0201f800,
-- 0x00020381, 0x0201f000, 0x000208b4, 0x492fc857,
-- 0x0201f800, 0x0010601a, 0x0400000b, 0x592c0204,
-- 0x80000110, 0x80000040, 0x040204e7, 0x592c0c06,
-+ 0x000202e9, 0x4a025a06, 0x0000002c, 0x0201f000,
-+ 0x000202e9, 0x4a025a06, 0x00000028, 0x0201f800,
-+ 0x000202e9, 0x0201f000, 0x000207bb, 0x492fc857,
-+ 0x0201f800, 0x00105ed1, 0x0400000b, 0x592c0204,
-+ 0x80000110, 0x80000040, 0x040204f9, 0x592c0c06,
- 0x800409c0, 0x04000009, 0x42000000, 0x00000102,
- 0x0401f003, 0x42000000, 0x00000104, 0x48025a06,
-- 0x0201f000, 0x00020381, 0x592c0c07, 0x800409c0,
-+ 0x0201f000, 0x000202e9, 0x592c0c07, 0x800409c0,
- 0x04000024, 0x82040480, 0x00000005, 0x04021021,
-- 0x4c040000, 0x80040800, 0x0201f800, 0x0010603f,
-+ 0x4c040000, 0x80040800, 0x0201f800, 0x00105ef6,
- 0x5c001000, 0x04020018, 0x832c0400, 0x00000008,
-- 0x4000a000, 0x0201f800, 0x00106068, 0x04020012,
-- 0x592c1207, 0x82cc0580, 0x0010b30a, 0x04020009,
-+ 0x4000a000, 0x0201f800, 0x00105f1f, 0x04020012,
-+ 0x592c1207, 0x82cc0580, 0x0010acdb, 0x04020009,
- 0x58c80c0b, 0x84040d00, 0x84040d02, 0x8c081500,
- 0x04000002, 0x84040d5e, 0x4805940b, 0x0401f001,
- 0x42000000, 0x00000000, 0x48025a06, 0x0201f000,
-- 0x00020381, 0x42000000, 0x00000103, 0x0401f7fb,
-+ 0x000202e9, 0x42000000, 0x00000103, 0x0401f7fb,
- 0x42000000, 0x00000102, 0x0401f7f8, 0x492fc857,
- 0x592e7c06, 0x833c0500, 0xfffffffe, 0x04020043,
-- 0x592c4007, 0x42026000, 0x0010cfc0, 0x41581800,
-+ 0x592c4007, 0x42026000, 0x0010d8d4, 0x41581800,
- 0x400c0000, 0x81300480, 0x04021023, 0x59300203,
- 0x82000580, 0x00000000, 0x04000007, 0x59300008,
- 0x80000d40, 0x04000004, 0x58040005, 0x80200580,
- 0x04000004, 0x83326400, 0x00000024, 0x0401f7f1,
- 0x58040204, 0x82000500, 0x000000ff, 0x82000d80,
- 0x00000053, 0x04000007, 0x82000d80, 0x00000048,
-- 0x04000004, 0x82000580, 0x00000018, 0x04020023,
-- 0x4d2c0000, 0x0201f800, 0x00108997, 0x5c025800,
-+ 0x04000004, 0x82000d80, 0x00000018, 0x04020023,
-+ 0x4d2c0000, 0x0201f800, 0x001083e0, 0x5c025800,
- 0x0400001e, 0x4a025a06, 0x00000000, 0x0201f000,
-- 0x00020381, 0x592e8a06, 0x83440480, 0x000007f0,
-- 0x04021016, 0x83440400, 0x0010aa00, 0x50000000,
-+ 0x000202e9, 0x592e8a06, 0x83440480, 0x000007f0,
-+ 0x04021016, 0x83440400, 0x0010a400, 0x50000000,
- 0x80026d40, 0x04000011, 0x4d2c0000, 0x0201f800,
-- 0x00104619, 0x0400000c, 0x42028000, 0x00000005,
-- 0x592c0a08, 0x0201f800, 0x00104bee, 0x0201f800,
-- 0x00108f83, 0x0201f800, 0x00020381, 0x5c025800,
-+ 0x001044e7, 0x0400000c, 0x42028000, 0x00000005,
-+ 0x592c0a08, 0x0201f800, 0x00104a8e, 0x0201f800,
-+ 0x001089eb, 0x0201f800, 0x000202e9, 0x5c025800,
- 0x0401f7e5, 0x5c025800, 0x4a025a06, 0x00000031,
-- 0x0201f000, 0x00020381, 0x492fc857, 0x4d2c0000,
-- 0x0201f800, 0x0010082a, 0x04000016, 0x492fc857,
-- 0x412f4000, 0x0201f800, 0x0010082a, 0x0400000e,
-- 0x492fc857, 0x412dd800, 0x0201f800, 0x00103941,
-- 0x0201f800, 0x0010394b, 0x49a1d80b, 0x5c025800,
-- 0x492dd80a, 0x0201f800, 0x00101fbb, 0x0201f000,
-- 0x00101fda, 0x41a25800, 0x0201f800, 0x0010083a,
-+ 0x0201f000, 0x000202e9, 0x492fc857, 0x4d2c0000,
-+ 0x0201f800, 0x0010071a, 0x04000016, 0x492fc857,
-+ 0x412f4000, 0x0201f800, 0x0010071a, 0x0400000e,
-+ 0x492fc857, 0x412dd800, 0x0201f800, 0x001037da,
-+ 0x0201f800, 0x001037e4, 0x49a1d80b, 0x5c025800,
-+ 0x492dd80a, 0x0201f800, 0x00101de3, 0x0201f000,
-+ 0x00101e02, 0x41a25800, 0x0201f800, 0x0010072e,
- 0x5c025800, 0x4a025a06, 0x00004005, 0x4a025c06,
-- 0x00000002, 0x0201f000, 0x00020381, 0x4807c857,
-+ 0x00000002, 0x0201f000, 0x000202e9, 0x4807c857,
- 0x485fc857, 0x4200b800, 0x00000001, 0x5c000800,
- 0x4c5c0000, 0x0401f005, 0x4807c857, 0x485fc857,
- 0x5c000800, 0x4d780000, 0x4803c857, 0x492fc857,
-- 0x8c00050e, 0x02020800, 0x0010060d, 0x4203e000,
-+ 0x8c00050e, 0x02020800, 0x001004e4, 0x4203e000,
- 0x50000000, 0x4200b800, 0x00008003, 0x0201f000,
-- 0x0010061a, 0x592c0204, 0x80000110, 0x80000040,
-- 0x0402042d, 0x0201f800, 0x00104886, 0x04020002,
-- 0x1c01f000, 0x49425a06, 0x4806580d, 0x480a580e,
-- 0x4943c857, 0x4807c857, 0x480bc857, 0x0201f000,
-- 0x00020381, 0x592c0204, 0x80000110, 0x80000040,
-- 0x0402041d, 0x0201f800, 0x001049ec, 0x04020002,
-- 0x1c01f000, 0x49425a06, 0x48065811, 0x480a5812,
-- 0x0201f000, 0x00020381, 0x592c0204, 0x80000110,
-- 0x04000411, 0x80000040, 0x0402000c, 0x4202e000,
-- 0x00000001, 0x592c020a, 0x8c000504, 0x02000000,
-- 0x00020603, 0x592c0207, 0x82000c80, 0x00001001,
-- 0x04021415, 0x0401f009, 0x4202e000, 0x00000003,
-- 0x48033002, 0x492f3003, 0x492f3004, 0x4a033008,
-- 0x00020603, 0x1c01f000, 0x4202e000, 0x00000002,
-- 0x42000000, 0x0010bcd9, 0x50007000, 0x492c700b,
-- 0x4978700e, 0x4978700c, 0x592c0011, 0x592c0812,
-- 0x48007007, 0x48047008, 0x592c1013, 0x82080500,
-- 0xffff0000, 0x04000003, 0x0201f800, 0x00100615,
-- 0x4978700d, 0x82080480, 0x00000180, 0x4803c857,
-- 0x04001007, 0x4800700f, 0x4a007005, 0x00000180,
-- 0x4a007004, 0x00000060, 0x0401f005, 0x4978700f,
-- 0x48087005, 0x80081104, 0x48087004, 0x5838000a,
-- 0x48007003, 0x40381000, 0x0201f000, 0x001008a1,
-- 0x0201f800, 0x00100819, 0x04000003, 0x59980007,
-- 0x0801f000, 0x1c01f000, 0x40307000, 0x5838000b,
-- 0x80025d40, 0x0400001b, 0x58380002, 0x82000580,
-- 0x00000100, 0x0400001d, 0x4c380000, 0x592c0204,
-- 0x82000500, 0x000000ff, 0x82000580, 0x00000012,
-- 0x0400000b, 0x592c0208, 0x8400054e, 0x48025a08,
-- 0x4a025a06, 0x00000002, 0x4a025a04, 0x00000103,
-- 0x0201f800, 0x00020381, 0x0401f005, 0x4a025a06,
-- 0x00000010, 0x0201f800, 0x00020381, 0x5c007000,
-- 0x4202e000, 0x00000001, 0x4a007002, 0x00000100,
-- 0x49787010, 0x1c01f000, 0x58380004, 0x82000480,
-- 0x00000003, 0x04000087, 0x58380010, 0x8c000500,
-- 0x04020019, 0x4200b000, 0x00000003, 0x832cac00,
-- 0x00000011, 0x5838000a, 0x5838100d, 0x8008a400,
-- 0x4c380000, 0x0201f800, 0x0010a93e, 0x5c007000,
-- 0x5838000d, 0x82000400, 0x00000003, 0x4800700d,
-- 0x4a007010, 0x00000001, 0x58380004, 0x82000480,
-- 0x00000003, 0x48007004, 0x82000580, 0x00000003,
-- 0x0400006c, 0x5838000e, 0x80001d40, 0x04020020,
-- 0x4c380000, 0x0201f800, 0x00100819, 0x5c007000,
-- 0x04000010, 0x4a025a04, 0x0000010a, 0x42001800,
-- 0x00000005, 0x480c700e, 0x5838000c, 0x80000540,
-- 0x04020002, 0x5838000b, 0x40000800, 0x492c0801,
-- 0x492c700c, 0x42000800, 0x0000000f, 0x0401f011,
-- 0x4202e000, 0x00000008, 0x4a033007, 0x001055f9,
-- 0x1c01f000, 0x4202e000, 0x00000002, 0x42000000,
-- 0x0010bcd9, 0x50007000, 0x0401f7e7, 0x583a580c,
-- 0x400c0000, 0x42000800, 0x00000014, 0x80040c80,
-- 0x58381004, 0x5838000f, 0x41783000, 0x80000540,
-- 0x04020005, 0x84183540, 0x82081480, 0x00000003,
-- 0x0400003c, 0x40080000, 0x80040480, 0x04001002,
-- 0x40080800, 0x4004b000, 0x412c0000, 0x800c0400,
-- 0x4000a800, 0x5838000a, 0x5838100d, 0x8008a400,
-- 0x4c080000, 0x4c040000, 0x4c0c0000, 0x4c380000,
-- 0x0201f800, 0x0010a93e, 0x5c007000, 0x5c001800,
-- 0x5c000800, 0x40040000, 0x58381004, 0x80080480,
-- 0x48007004, 0x82000580, 0x00000003, 0x04000002,
-- 0x84183500, 0x5c000000, 0x80041400, 0x82080480,
-- 0x00000060, 0x04020003, 0x84183542, 0x41781000,
-- 0x400c0000, 0x80041c00, 0x820c0480, 0x00000014,
-- 0x04020003, 0x84183544, 0x40001800, 0x40080800,
-- 0x4804700d, 0x480c700e, 0x40180000, 0x0c01f001,
-- 0x00105644, 0x00105648, 0x00105646, 0x00105644,
-- 0x001055e0, 0x00105648, 0x00105646, 0x00105644,
-- 0x0201f800, 0x00100615, 0x5838100f, 0x0401f739,
-- 0x5838080d, 0x82040400, 0x00000002, 0x5838100a,
-- 0x80080400, 0x50001000, 0x800811c0, 0x0402000f,
-- 0x4202e000, 0x00000001, 0x583a580b, 0x4978700b,
-- 0x49787010, 0x592c0204, 0x82000500, 0x000000ff,
-- 0x82000580, 0x00000012, 0x02000000, 0x0002063b,
-- 0x0201f000, 0x00020603, 0x5838000a, 0x80040c00,
-- 0x82381c00, 0x00000007, 0x54041800, 0x80040800,
-- 0x800c1800, 0x54041800, 0x0401f71a, 0x0201f800,
-- 0x00100819, 0x02000800, 0x00100615, 0x4a02580a,
-- 0x0010bc78, 0x42000800, 0x0010bcd9, 0x452c0800,
-- 0x497a580b, 0x497a580c, 0x497a580d, 0x497a580e,
-- 0x497a580f, 0x4a025809, 0x0010559a, 0x497a5810,
-- 0x4a025802, 0x00000100, 0x4a025801, 0x00000001,
-- 0x1c01f000, 0x59c80007, 0x8c000502, 0x04000071,
-- 0x835c2c80, 0x00000005, 0x02001000, 0x00105c5c,
-- 0x59c82817, 0x4817506e, 0x497b9005, 0x82140500,
-- 0x00e00000, 0x0402004f, 0x82140500, 0x000003ff,
-- 0x82001c00, 0x00000006, 0x41cc2000, 0x42003000,
-- 0x00006080, 0x820c0480, 0x00000040, 0x04001006,
-- 0x42001000, 0x00000040, 0x820c1c80, 0x00000040,
-- 0x0401f003, 0x400c1000, 0x41781800, 0x54182000,
-- 0x80102000, 0x80183000, 0x80081040, 0x040207fc,
-- 0x800c19c0, 0x04000005, 0x59c80005, 0x80000000,
-- 0x48039005, 0x0401f7ea, 0x82140500, 0x01f60000,
-- 0x04020029, 0x82140500, 0x0000f000, 0x0400000b,
-- 0x82000c80, 0x00002000, 0x0402100f, 0x4a039005,
-- 0x00000140, 0x82140500, 0x0e000000, 0x80000132,
-- 0x0c01f83e, 0x1c01f000, 0x59cc0400, 0x82000500,
-- 0x0000ff00, 0x82000580, 0x00008100, 0x040007f4,
-- 0x0401f01c, 0x4817c857, 0x82140500, 0x000003ff,
-- 0x04020007, 0x59cc0400, 0x82000500, 0x0000ff00,
-- 0x82000580, 0x00008100, 0x04020012, 0x42000000,
-- 0x0010b6bc, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x00105b32, 0x4803c856, 0x4a039005, 0x00000140,
-- 0x0401f020, 0x4817c857, 0x82140500, 0x00f60000,
-- 0x04020004, 0x0201f800, 0x00105b6e, 0x040207d2,
-- 0x0201f800, 0x00104e0d, 0x04000010, 0x59c400a4,
-- 0x4803c857, 0x82000500, 0x0000000f, 0x82000580,
-- 0x0000000a, 0x04020009, 0x497b5016, 0x59c400a3,
-- 0x82000540, 0x00080000, 0x480388a3, 0x82000500,
-- 0xfff7ffff, 0x480388a3, 0x4817c856, 0x0201f800,
-- 0x0010a79f, 0x4a039005, 0x00000140, 0x0401f842,
-- 0x4803c856, 0x1c01f000, 0x00105702, 0x00105a13,
-- 0x001056fa, 0x001056fa, 0x001056fa, 0x001056fa,
-- 0x001056fa, 0x001056fa, 0x4803c857, 0x42000000,
-- 0x0010b659, 0x0201f800, 0x0010a86e, 0x4a039005,
-- 0x00000140, 0x1c01f000, 0x59cc0400, 0x82000d00,
-- 0x0000ff00, 0x82041500, 0x0000f000, 0x840409c0,
-- 0x82140500, 0x000003ff, 0x800018c4, 0x8c142d14,
-- 0x04000005, 0x59cc0002, 0x82000500, 0x00000003,
-- 0x800c1c80, 0x480f5016, 0x82080580, 0x00002000,
-- 0x04020013, 0x836c0580, 0x00000001, 0x0402000e,
-- 0x59cc0006, 0x82000500, 0xff000000, 0x82000580,
-- 0x11000000, 0x02020800, 0x001006ba, 0x04020011,
-- 0x0201f800, 0x00103951, 0x0201f800, 0x00105c81,
-- 0x0401f00c, 0x0401f81f, 0x0401f00a, 0x82080580,
-- 0x00003000, 0x04020003, 0x0401fa40, 0x0401f005,
-- 0x82080580, 0x00008000, 0x04020002, 0x0401fb36,
-- 0x1c01f000, 0x4817c857, 0x42000000, 0x0010b658,
-- 0x0201f800, 0x0010a86e, 0x836c0580, 0x00000003,
-- 0x0402000b, 0x4c080000, 0x4c0c0000, 0x42001000,
-- 0x00008048, 0x40141800, 0x80142120, 0x0201f800,
-- 0x00103857, 0x5c001800, 0x5c001000, 0x1c01f000,
-- 0x59cc0002, 0x82000500, 0xff000000, 0x82001580,
-- 0x01000000, 0x04000006, 0x82001580, 0x23000000,
-- 0x02020800, 0x001006ba, 0x040201c9, 0x82040580,
-- 0x00000023, 0x04020055, 0x59cc0004, 0x4803c857,
-- 0x59cc0006, 0x82000500, 0xff000000, 0x59cc0801,
-- 0x82040d00, 0x00ffffff, 0x80040540, 0x4803c857,
-- 0x0401fbb2, 0x02000800, 0x001006ba, 0x040001b8,
-- 0x59300c06, 0x82040580, 0x00000010, 0x04000012,
-- 0x82040580, 0x00000011, 0x0400000f, 0x82040580,
-- 0x00000001, 0x0400000c, 0x82040580, 0x00000004,
-- 0x04000009, 0x82040580, 0x00000008, 0x04000006,
-- 0x82040580, 0x0000000a, 0x02020800, 0x001006ba,
-- 0x040201a3, 0x59300004, 0x82000500, 0x80010000,
-- 0x04000006, 0x0201f800, 0x00106cb4, 0x02020800,
-- 0x001006ba, 0x0402019a, 0x59cc0a04, 0x48066202,
-- 0x59a80016, 0x800001c0, 0x02000800, 0x001006ba,
-- 0x04000193, 0x59cc0006, 0x82000500, 0xffff0000,
-- 0x82000d80, 0x02000000, 0x04020005, 0x42027000,
-- 0x00000015, 0x0201f000, 0x000208d8, 0x82000d80,
-- 0x02140000, 0x040007fa, 0x82000d80, 0x02100000,
-- 0x040007f7, 0x82000d80, 0x02100000, 0x040007f4,
-- 0x82000d80, 0x01000000, 0x02020800, 0x001006ba,
-- 0x0402017b, 0x59cc0006, 0x82000500, 0x0000ffff,
-- 0x02020800, 0x001006ba, 0x04020175, 0x42027000,
-- 0x00000016, 0x0401f7e8, 0x82040580, 0x00000022,
-- 0x02020800, 0x001006ba, 0x0402016d, 0x59cc0004,
-- 0x4803c857, 0x59cc0006, 0x4803c857, 0x59cc0001,
-- 0x4803c857, 0x59a80016, 0x800001c0, 0x02000800,
-- 0x001006ba, 0x04000162, 0x59a80806, 0x8c040d14,
-- 0x04000011, 0x0401f97d, 0x0402000f, 0x0401f993,
-- 0x0400000d, 0x42027000, 0x0000004c, 0x59cc0001,
-- 0x82000500, 0x00ffffff, 0x0201f800, 0x00105c25,
-- 0x0400013e, 0x42028800, 0x0000ffff, 0x417a6800,
-- 0x0401f13a, 0x59cc0006, 0x82000500, 0xffff0000,
-- 0x82000d80, 0x03000000, 0x04020023, 0x59a80026,
-- 0x8c000508, 0x04000017, 0x8400054c, 0x48035026,
-- 0x59cc0800, 0x82040d00, 0x00ffffff, 0x48075010,
-- 0x497b8830, 0x84040d70, 0x48078832, 0x59c40802,
-- 0x84040d4c, 0x48078802, 0x59cc0007, 0x82000500,
-- 0x0000ffff, 0x48038893, 0x4803501e, 0x42000800,
-- 0x00000003, 0x59a81010, 0x0201f800, 0x001069af,
-+ 0x001004f4, 0x80140110, 0x80000040, 0x04020440,
-+ 0x0201f800, 0x00104772, 0x04020002, 0x1c01f000,
-+ 0x49425a06, 0x4806580d, 0x480a580e, 0x4943c857,
-+ 0x4807c857, 0x480bc857, 0x0201f000, 0x000202e9,
-+ 0x80140110, 0x80000040, 0x04020431, 0x0201f800,
-+ 0x001048d8, 0x04020002, 0x1c01f000, 0x49425a06,
-+ 0x48065811, 0x480a5812, 0x0201f000, 0x000202e9,
-+ 0x80140110, 0x04000426, 0x80000040, 0x0402000c,
-+ 0x4202e000, 0x00000001, 0x592c020a, 0x8c000504,
-+ 0x02000000, 0x0002052e, 0x592c0207, 0x82000c80,
-+ 0x00001001, 0x0402142a, 0x0401f005, 0x4a033006,
-+ 0x0002052e, 0x0201f000, 0x00020528, 0x4202e000,
-+ 0x00000002, 0x42000000, 0x0010b6a9, 0x50007000,
-+ 0x492c700b, 0x4978700e, 0x4978700c, 0x592c0011,
-+ 0x592c0812, 0x48007007, 0x48047008, 0x592c1013,
-+ 0x82080500, 0xffff0000, 0x04000003, 0x0201f800,
-+ 0x001004ef, 0x4978700d, 0x82080480, 0x00000180,
-+ 0x4803c857, 0x04001007, 0x4800700f, 0x4a007005,
-+ 0x00000180, 0x4a007004, 0x00000060, 0x0401f005,
-+ 0x4978700f, 0x48087005, 0x80081104, 0x48087004,
-+ 0x5838000a, 0x48007003, 0x40381000, 0x0201f000,
-+ 0x0010079e, 0x0201f800, 0x00100704, 0x04000003,
-+ 0x59980005, 0x0801f800, 0x1c01f000, 0x40307000,
-+ 0x5838000b, 0x80025d40, 0x0400001b, 0x58380002,
-+ 0x82000580, 0x00000100, 0x0400001d, 0x4c380000,
-+ 0x592c0204, 0x82000500, 0x000000ff, 0x82000580,
-+ 0x00000012, 0x0400000b, 0x592c0208, 0x8400054e,
-+ 0x48025a08, 0x4a025a06, 0x00000002, 0x4a025a04,
-+ 0x00000103, 0x0201f800, 0x000202e9, 0x0401f005,
-+ 0x4a025a06, 0x00000010, 0x0201f800, 0x000202e9,
-+ 0x5c007000, 0x4202e000, 0x00000001, 0x4a007002,
-+ 0x00000100, 0x49787010, 0x1c01f000, 0x58380004,
-+ 0x82000480, 0x00000003, 0x04000087, 0x58380010,
-+ 0x8c000500, 0x04020019, 0x4200b000, 0x00000003,
-+ 0x832cac00, 0x00000011, 0x5838000a, 0x5838100d,
-+ 0x8008a400, 0x4c380000, 0x0201f800, 0x0010a330,
-+ 0x5c007000, 0x5838000d, 0x82000400, 0x00000003,
-+ 0x4800700d, 0x4a007010, 0x00000001, 0x58380004,
-+ 0x82000480, 0x00000003, 0x48007004, 0x82000580,
-+ 0x00000003, 0x0400006c, 0x5838000e, 0x80001d40,
-+ 0x04020020, 0x4c380000, 0x0201f800, 0x00100704,
-+ 0x5c007000, 0x04000010, 0x4a025a04, 0x0000010a,
-+ 0x42001800, 0x00000005, 0x480c700e, 0x5838000c,
-+ 0x80000540, 0x04020002, 0x5838000b, 0x40000800,
-+ 0x492c0801, 0x492c700c, 0x42000800, 0x0000000f,
-+ 0x0401f011, 0x4202e000, 0x00000008, 0x4a033005,
-+ 0x0010548e, 0x1c01f000, 0x4202e000, 0x00000002,
-+ 0x42000000, 0x0010b6a9, 0x50007000, 0x0401f7e7,
-+ 0x583a580c, 0x400c0000, 0x42000800, 0x00000014,
-+ 0x80040c80, 0x58381004, 0x5838000f, 0x41783000,
-+ 0x80000540, 0x04020005, 0x84183540, 0x82081480,
-+ 0x00000003, 0x0400003c, 0x40080000, 0x80040480,
-+ 0x04001002, 0x40080800, 0x4004b000, 0x412c0000,
-+ 0x800c0400, 0x4000a800, 0x5838000a, 0x5838100d,
-+ 0x8008a400, 0x4c080000, 0x4c040000, 0x4c0c0000,
-+ 0x4c380000, 0x0201f800, 0x0010a330, 0x5c007000,
-+ 0x5c001800, 0x5c000800, 0x40040000, 0x58381004,
-+ 0x80080480, 0x48007004, 0x82000580, 0x00000003,
-+ 0x04000002, 0x84183500, 0x5c000000, 0x80041400,
-+ 0x82080480, 0x00000060, 0x04020003, 0x84183542,
-+ 0x41781000, 0x400c0000, 0x80041c00, 0x820c0480,
-+ 0x00000014, 0x04020003, 0x84183544, 0x40001800,
-+ 0x40080800, 0x4804700d, 0x480c700e, 0x40180000,
-+ 0x0c01f001, 0x001054d9, 0x001054dd, 0x001054db,
-+ 0x001054d9, 0x00105475, 0x001054dd, 0x001054db,
-+ 0x001054d9, 0x0201f800, 0x001004ef, 0x5838100f,
-+ 0x0401f739, 0x5838080d, 0x82040400, 0x00000002,
-+ 0x5838100a, 0x80080400, 0x50001000, 0x800811c0,
-+ 0x0402000f, 0x4202e000, 0x00000001, 0x583a580b,
-+ 0x4978700b, 0x49787010, 0x592c0204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000012, 0x02000000,
-+ 0x0002055e, 0x0201f000, 0x0002052e, 0x5838000a,
-+ 0x80040c00, 0x82381c00, 0x00000007, 0x54041800,
-+ 0x80040800, 0x800c1800, 0x54041800, 0x0401f71a,
-+ 0x0201f800, 0x00100704, 0x02000800, 0x001004ef,
-+ 0x4a02580a, 0x0010b648, 0x42000800, 0x0010b6a9,
-+ 0x452c0800, 0x497a580b, 0x497a580c, 0x497a580d,
-+ 0x497a580e, 0x497a580f, 0x4a025809, 0x0010542f,
-+ 0x497a5810, 0x4a025802, 0x00000100, 0x4a025801,
-+ 0x00000001, 0x1c01f000, 0x59c80007, 0x8c000502,
-+ 0x04000071, 0x835c2c80, 0x00000005, 0x02001000,
-+ 0x00105afd, 0x59c82817, 0x4817506b, 0x497b9005,
-+ 0x82140500, 0x00e00000, 0x0402004f, 0x82140500,
-+ 0x000003ff, 0x82001c00, 0x00000006, 0x41cc2000,
-+ 0x42003000, 0x00006080, 0x820c0480, 0x00000040,
-+ 0x04001006, 0x42001000, 0x00000040, 0x820c1c80,
-+ 0x00000040, 0x0401f003, 0x400c1000, 0x41781800,
-+ 0x54182000, 0x80102000, 0x80183000, 0x80081040,
-+ 0x040207fc, 0x800c19c0, 0x04000005, 0x59c80005,
-+ 0x80000000, 0x48039005, 0x0401f7ea, 0x82140500,
-+ 0x01f60000, 0x04020029, 0x82140500, 0x0000f000,
-+ 0x0400000b, 0x82000c80, 0x00002000, 0x0402100f,
-+ 0x4a039005, 0x00000140, 0x82140500, 0x0e000000,
-+ 0x80000132, 0x0c01f83e, 0x1c01f000, 0x59cc0400,
-+ 0x82000500, 0x0000ff00, 0x82000580, 0x00008100,
-+ 0x040007f4, 0x0401f01c, 0x4817c857, 0x82140500,
-+ 0x000003ff, 0x04020007, 0x59cc0400, 0x82000500,
-+ 0x0000ff00, 0x82000580, 0x00008100, 0x04020012,
-+ 0x42000000, 0x0010b08c, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x001059cd, 0x4803c856, 0x4a039005,
-+ 0x00000140, 0x0401f020, 0x4817c857, 0x82140500,
-+ 0x00f60000, 0x04020004, 0x0201f800, 0x00105a09,
-+ 0x040207d2, 0x0201f800, 0x00104ca6, 0x04000010,
-+ 0x59c400a4, 0x4803c857, 0x82000500, 0x0000000f,
-+ 0x82000580, 0x0000000a, 0x04020009, 0x497b5015,
-+ 0x59c400a3, 0x82000540, 0x00080000, 0x480388a3,
-+ 0x82000500, 0xfff7ffff, 0x480388a3, 0x4817c856,
-+ 0x0201f800, 0x0010a190, 0x4a039005, 0x00000140,
-+ 0x0401f842, 0x4803c856, 0x1c01f000, 0x00105597,
-+ 0x001058ae, 0x0010558f, 0x0010558f, 0x0010558f,
-+ 0x0010558f, 0x0010558f, 0x0010558f, 0x4803c857,
-+ 0x42000000, 0x0010b029, 0x0201f800, 0x0010a260,
-+ 0x4a039005, 0x00000140, 0x1c01f000, 0x59cc0400,
-+ 0x82000d00, 0x0000ff00, 0x82041500, 0x0000f000,
-+ 0x840409c0, 0x82140500, 0x000003ff, 0x800018c4,
-+ 0x8c142d14, 0x04000005, 0x59cc0002, 0x82000500,
-+ 0x00000003, 0x800c1c80, 0x480f5015, 0x82080580,
-+ 0x00002000, 0x04020013, 0x836c0580, 0x00000001,
-+ 0x0402000e, 0x59cc0006, 0x82000500, 0xff000000,
-+ 0x82000580, 0x11000000, 0x02020800, 0x00100594,
-+ 0x04020011, 0x0201f800, 0x001037ea, 0x0201f800,
-+ 0x00105b22, 0x0401f00c, 0x0401f81f, 0x0401f00a,
-+ 0x82080580, 0x00003000, 0x04020003, 0x0401fa46,
-+ 0x0401f005, 0x82080580, 0x00008000, 0x04020002,
-+ 0x0401fb3c, 0x1c01f000, 0x4817c857, 0x42000000,
-+ 0x0010b028, 0x0201f800, 0x0010a260, 0x836c0580,
-+ 0x00000003, 0x0402000b, 0x4c080000, 0x4c0c0000,
-+ 0x42001000, 0x00008048, 0x40141800, 0x80142120,
-+ 0x0201f800, 0x001036f4, 0x5c001800, 0x5c001000,
-+ 0x1c01f000, 0x59cc0002, 0x82000500, 0xff000000,
-+ 0x82001580, 0x01000000, 0x04000006, 0x82001580,
-+ 0x23000000, 0x02020800, 0x00100594, 0x040201cf,
-+ 0x82040580, 0x00000023, 0x04020055, 0x59cc0004,
-+ 0x4803c857, 0x59cc0006, 0x82000500, 0xff000000,
-+ 0x59cc0801, 0x82040d00, 0x00ffffff, 0x80040540,
-+ 0x4803c857, 0x0401fbb8, 0x02000800, 0x00100594,
-+ 0x040001be, 0x59300c06, 0x82040580, 0x00000010,
-+ 0x04000012, 0x82040580, 0x00000011, 0x0400000f,
-+ 0x82040580, 0x00000001, 0x0400000c, 0x82040580,
-+ 0x00000004, 0x04000009, 0x82040580, 0x00000008,
-+ 0x04000006, 0x82040580, 0x0000000a, 0x02020800,
-+ 0x00100594, 0x040201a9, 0x59300004, 0x82000500,
-+ 0x80010000, 0x04000006, 0x0201f800, 0x001067a7,
-+ 0x02020800, 0x00100594, 0x040201a0, 0x59cc0a04,
-+ 0x48066202, 0x59a80015, 0x800001c0, 0x02000800,
-+ 0x00100594, 0x04000199, 0x59cc0006, 0x82000500,
-+ 0xffff0000, 0x82000d80, 0x02000000, 0x04020005,
-+ 0x42027000, 0x00000015, 0x0201f000, 0x000207df,
-+ 0x82000d80, 0x02140000, 0x040007fa, 0x82000d80,
-+ 0x02100000, 0x040007f7, 0x82000d80, 0x02100000,
-+ 0x040007f4, 0x82000d80, 0x01000000, 0x02020800,
-+ 0x00100594, 0x04020181, 0x59cc0006, 0x82000500,
-+ 0x0000ffff, 0x02020800, 0x00100594, 0x0402017b,
-+ 0x42027000, 0x00000016, 0x0401f7e8, 0x82040580,
-+ 0x00000022, 0x02020800, 0x00100594, 0x04020173,
-+ 0x59cc0004, 0x4803c857, 0x59cc0006, 0x4803c857,
-+ 0x59cc0001, 0x4803c857, 0x59a80015, 0x800001c0,
-+ 0x02000800, 0x00100594, 0x04000168, 0x59a80805,
-+ 0x8c040d14, 0x04000011, 0x0401f983, 0x0402000f,
-+ 0x0401f999, 0x0400000d, 0x42027000, 0x0000004c,
-+ 0x59cc0001, 0x82000500, 0x00ffffff, 0x0201f800,
-+ 0x00105ac6, 0x04000144, 0x42028800, 0x0000ffff,
-+ 0x417a6800, 0x0401f140, 0x59cc0006, 0x82000500,
-+ 0xffff0000, 0x82000d80, 0x03000000, 0x04020029,
-+ 0x59a80023, 0x8c000508, 0x04000020, 0x8400054c,
-+ 0x48035023, 0x59cc0800, 0x82040d00, 0x00ffffff,
-+ 0x4807500f, 0x497b8830, 0x84040d70, 0x48078832,
-+ 0x59c40802, 0x84040d4c, 0x48078802, 0x59cc0007,
-+ 0x82000500, 0x0000ffff, 0x48038893, 0x4803501d,
-+ 0x42000800, 0x00000003, 0x59a8100f, 0x0201f800,
-+ 0x00106499, 0x59cc0006, 0x82000500, 0x0000ffff,
-+ 0x02020800, 0x00100594, 0x04020130, 0x42027000,
-+ 0x00000017, 0x0401f0eb, 0x0201f800, 0x00104ca6,
-+ 0x040207f5, 0x8c000502, 0x040207f3, 0x0401f127,
-+ 0x82000d80, 0x04000000, 0x04020013, 0x59cc0006,
-+ 0x82000500, 0x0000ffff, 0x02020800, 0x00100594,
-+ 0x0402011e, 0x0201f800, 0x00104ca6, 0x04000004,
-+ 0x42027000, 0x0000001d, 0x0401f0d6, 0x59a80023,
-+ 0x84000548, 0x48035023, 0x42027000, 0x00000030,
-+ 0x0401f0d0, 0x82000d80, 0x05000000, 0x0402000a,
- 0x59cc0006, 0x82000500, 0x0000ffff, 0x02020800,
-- 0x001006ba, 0x0402012a, 0x42027000, 0x00000017,
-- 0x0401f0e5, 0x82000d80, 0x04000000, 0x04020013,
-+ 0x00100594, 0x04020109, 0x42027000, 0x00000018,
-+ 0x0401f0c4, 0x82000d80, 0x20100000, 0x04020004,
-+ 0x42027000, 0x00000019, 0x0401f0be, 0x82000d80,
-+ 0x21100000, 0x04020004, 0x42027000, 0x0000001a,
-+ 0x0401f0b8, 0x82000d80, 0x52000000, 0x0402000a,
- 0x59cc0006, 0x82000500, 0x0000ffff, 0x02020800,
-- 0x001006ba, 0x0402011e, 0x0201f800, 0x00104e0d,
-- 0x04000004, 0x42027000, 0x0000001d, 0x0401f0d6,
-- 0x59a80026, 0x84000548, 0x48035026, 0x42027000,
-- 0x00000030, 0x0401f0d0, 0x82000d80, 0x05000000,
-- 0x0402000a, 0x59cc0006, 0x82000500, 0x0000ffff,
-- 0x02020800, 0x001006ba, 0x04020109, 0x42027000,
-- 0x00000018, 0x0401f0c4, 0x82000d80, 0x20100000,
-- 0x04020004, 0x42027000, 0x00000019, 0x0401f0be,
-- 0x82000d80, 0x21100000, 0x04020004, 0x42027000,
-- 0x0000001a, 0x0401f0b8, 0x82000d80, 0x52000000,
-- 0x0402000a, 0x59cc0006, 0x82000500, 0x0000ffff,
-- 0x02020800, 0x001006ba, 0x040200f1, 0x42027000,
-- 0x0000001b, 0x0401f0ac, 0x82000d80, 0x50000000,
-- 0x0402000a, 0x59cc0006, 0x82000500, 0x0000ffff,
-- 0x02020800, 0x001006ba, 0x040200e5, 0x42027000,
-- 0x0000001c, 0x0401f0a0, 0x82000d80, 0x13000000,
-- 0x04020004, 0x42027000, 0x00000034, 0x0401f09a,
-- 0x82000d80, 0x12000000, 0x0402000a, 0x59cc0006,
-- 0x82000500, 0x0000ffff, 0x02020800, 0x001006ba,
-- 0x040200d3, 0x42027000, 0x00000024, 0x0401f08e,
-- 0x82000d00, 0xff000000, 0x82040d80, 0x24000000,
-- 0x04020004, 0x42027000, 0x0000002d, 0x0401f086,
-- 0x82000d00, 0xff000000, 0x82040d80, 0x53000000,
-- 0x04020004, 0x42027000, 0x0000002a, 0x0401f07e,
-- 0x82000d80, 0x0f000000, 0x04020004, 0x42027000,
-- 0x00000020, 0x0401f078, 0x82000d80, 0x61040000,
-- 0x04020036, 0x83cc1400, 0x00000006, 0x80080800,
-- 0x50080000, 0x82000500, 0x0000ffff, 0x82000480,
-- 0x00000004, 0x4c580000, 0x8000b104, 0x8058b1c0,
-- 0x04000026, 0x4c100000, 0x50041800, 0x820c1500,
-- 0x03000000, 0x80081130, 0x42000000, 0x0010b615,
-- 0x82082580, 0x00000000, 0x04020004, 0x42000000,
-- 0x0010b612, 0x0401f00c, 0x82082580, 0x00000001,
-- 0x04020004, 0x42000000, 0x0010b613, 0x0401f006,
-- 0x82082580, 0x00000002, 0x04020003, 0x42000000,
-- 0x0010b614, 0x0201f800, 0x0010a86e, 0x42001000,
-- 0x00008015, 0x820c2500, 0x0000ffff, 0x800c1920,
-- 0x0201f800, 0x00103857, 0x5c002000, 0x80040800,
-- 0x8058b040, 0x040207da, 0x5c00b000, 0x42027000,
-- 0x00000023, 0x0401f040, 0x82000d80, 0x60000000,
-- 0x04020004, 0x42027000, 0x0000003f, 0x0401f03a,
-- 0x82000d80, 0x54000000, 0x04020008, 0x0401fb36,
-- 0x02020800, 0x001006ba, 0x04020075, 0x42027000,
-- 0x00000046, 0x0401f030, 0x82000d80, 0x55000000,
-- 0x04020009, 0x0401fb54, 0x04020004, 0x42027000,
-- 0x00000041, 0x0401f028, 0x42027000, 0x00000042,
-- 0x0401f025, 0x82000d80, 0x78000000, 0x04020004,
-- 0x42027000, 0x00000045, 0x0401f01f, 0x82000d80,
-- 0x10000000, 0x04020004, 0x42027000, 0x0000004e,
-- 0x0401f019, 0x82000d80, 0x63000000, 0x04020004,
-- 0x42027000, 0x0000004a, 0x0401f013, 0x82000d00,
-- 0xff000000, 0x82040d80, 0x56000000, 0x04020004,
-- 0x42027000, 0x0000004f, 0x0401f00b, 0x82000d00,
-- 0xff000000, 0x82040d80, 0x57000000, 0x04020004,
-- 0x42027000, 0x00000050, 0x0401f003, 0x42027000,
-- 0x0000001d, 0x59cc3800, 0x821c3d00, 0x00ffffff,
-- 0x821c0580, 0x00fffffe, 0x59cc0001, 0x04020005,
-- 0x40003000, 0x42028800, 0x000007fe, 0x0401f005,
-- 0x0401f8da, 0x02020800, 0x001006ba, 0x04020034,
-- 0x0201f800, 0x00104401, 0x02020800, 0x001006ba,
-- 0x0402002f, 0x83380580, 0x00000046, 0x04020006,
-- 0x59a80010, 0x80180580, 0x02000800, 0x001006ba,
-- 0x04000027, 0x59340200, 0x8c000514, 0x0400000f,
-- 0x83380580, 0x00000030, 0x0400000c, 0x83380580,
-- 0x0000003f, 0x04000009, 0x83380580, 0x00000034,
-- 0x04000006, 0x83380580, 0x00000024, 0x04000003,
-- 0x42027000, 0x0000004c, 0x0201f800, 0x00020892,
-- 0x04000018, 0x49366009, 0x4a026406, 0x00000004,
-- 0x59cc0c04, 0x48066202, 0x83380580, 0x0000004c,
-- 0x04020009, 0x4a026406, 0x00000011, 0x813669c0,
-- 0x04020005, 0x59cc0001, 0x82000500, 0x00ffffff,
-- 0x4802601e, 0x0201f000, 0x000208d8, 0x59880053,
-- 0x4803c857, 0x80000000, 0x48031053, 0x1c01f000,
-- 0x42001000, 0x00008049, 0x59cc1806, 0x800c1930,
-- 0x0201f800, 0x00103857, 0x0201f800, 0x001076c9,
-- 0x02000800, 0x001006ba, 0x040007f1, 0x49366009,
-- 0x4a026406, 0x00000004, 0x59cc0c04, 0x48066202,
-- 0x4a026403, 0x00000009, 0x4a02641a, 0x00000009,
-- 0x4a02621a, 0x00002900, 0x4a026203, 0x00000001,
-- 0x0201f000, 0x00106470, 0x59a80026, 0x4803c857,
-- 0x8c000508, 0x04000010, 0x59cc0006, 0x82000500,
-- 0xff000000, 0x82000d80, 0x03000000, 0x0400000c,
-- 0x82000d80, 0x20000000, 0x04000009, 0x82000d80,
-- 0x05000000, 0x04000006, 0x82000d80, 0x21000000,
-- 0x04000003, 0x80000580, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401f7fd, 0x59cc2006, 0x82102500,
-- 0xff000000, 0x9c1021c0, 0x0401f807, 0x820c1c00,
-- 0x0010b2df, 0x500c1800, 0x800c0500, 0x4803c857,
-- 0x1c01f000, 0x40100800, 0x41781800, 0x82040480,
-- 0x00000020, 0x04001004, 0x800c1800, 0x40000800,
-- 0x0401f7fb, 0x82040500, 0x0000000f, 0x82000400,
-- 0x0010a95f, 0x50000000, 0x8c040d08, 0x04000002,
-- 0x900001c0, 0x1c01f000, 0x4803c856, 0x0401fadd,
-- 0x0402000a, 0x0201f800, 0x00101eb0, 0x04020007,
-- 0x59cc0002, 0x82000500, 0xff000000, 0x82000d80,
-- 0x08000000, 0x04000802, 0x1c01f000, 0x4803c856,
-- 0x59cc0400, 0x82000d00, 0x0000ff00, 0x840409c0,
-- 0x82040580, 0x00000033, 0x0402001f, 0x0401f98f,
-- 0x04000038, 0x59cc0a04, 0x48066202, 0x59cc0006,
-- 0x4803c857, 0x82000500, 0xffff0000, 0x82000d80,
-- 0x02000000, 0x04020009, 0x59cc0006, 0x82000500,
-- 0x0000ffff, 0x0402002b, 0x42027000, 0x00000015,
-- 0x0201f000, 0x000208d8, 0x82000d80, 0x01000000,
-- 0x04020024, 0x59cc0006, 0x82000500, 0x0000ffff,
-- 0x04020020, 0x42027000, 0x00000016, 0x0201f000,
-- 0x000208d8, 0x82040580, 0x00000032, 0x04020019,
-- 0x59cc0006, 0x82000500, 0xffff0000, 0x82000d80,
-- 0x14000000, 0x04020013, 0x42027000, 0x00000038,
-- 0x59cc0001, 0x0401f810, 0x0402000e, 0x0201f800,
-- 0x001043fc, 0x0402000b, 0x0201f800, 0x00020892,
-- 0x04000008, 0x49366009, 0x4a026406, 0x00000004,
-- 0x59cc0c04, 0x48066202, 0x0201f000, 0x000208d8,
-- 0x1c01f000, 0x4803c857, 0x4c580000, 0x4c100000,
-- 0x4c380000, 0x4c340000, 0x82003500, 0x00ffffff,
-- 0x82181500, 0x00ff0000, 0x82081580, 0x00ff0000,
-- 0x04020016, 0x82181480, 0x00fffffc, 0x04001013,
-- 0x82181580, 0x00fffffd, 0x04020004, 0x42028800,
-- 0x000007fd, 0x0401f040, 0x82181580, 0x00fffffe,
-- 0x04020004, 0x42028800, 0x000007fe, 0x0401f03a,
-- 0x82181580, 0x00fffffc, 0x04020004, 0x42028800,
-- 0x000007fc, 0x0401f034, 0x41781000, 0x42002000,
-- 0x00000000, 0x4200b000, 0x000007f0, 0x41ac7000,
-- 0x50380000, 0x80006d40, 0x04020005, 0x800811c0,
-- 0x0402001e, 0x8410155e, 0x0401f01c, 0x58340212,
-- 0x82000500, 0x0000ff00, 0x04000011, 0x59a84010,
-- 0x82204500, 0x00ffff00, 0x82180500, 0x00ffff00,
-- 0x04000002, 0x80200580, 0x58340002, 0x0402000f,
-- 0x82000500, 0x000000ff, 0x82184500, 0x000000ff,
-- 0x80204580, 0x04020009, 0x0401f006, 0x58340002,
-- 0x82000500, 0x00ffffff, 0x80184580, 0x04020003,
-- 0x40128800, 0x0401f00c, 0x80102000, 0x80387000,
-- 0x8058b040, 0x040207db, 0x800811c0, 0x04020005,
-- 0x481bc857, 0x82000540, 0x00000001, 0x0401f003,
-- 0x840a8d1e, 0x80000580, 0x5c006800, 0x5c007000,
-- 0x5c002000, 0x5c00b000, 0x1c01f000, 0x59a80026,
-- 0x8c00050e, 0x04000003, 0x8c000502, 0x04000006,
-- 0x59cc0c00, 0x80040910, 0x82040500, 0x0000000f,
-- 0x0c01f002, 0x1c01f000, 0x00105a2e, 0x00105a2e,
-- 0x00105a2e, 0x00105b1d, 0x00105a2e, 0x00105a30,
-- 0x00105a48, 0x00105a4b, 0x00105a2e, 0x00105a2e,
-- 0x00105a2e, 0x00105a2e, 0x00105a2e, 0x00105a2e,
-- 0x00105a2e, 0x00105a2e, 0x4803c856, 0x1c01f000,
-- 0x0401f8de, 0x04000014, 0x82140500, 0x000003ff,
-- 0x800000c4, 0x82000480, 0x00000008, 0x0400100e,
-- 0x59cc0001, 0x59326809, 0x59340802, 0x80040580,
-- 0x82000500, 0x00ffffff, 0x04020007, 0x59cc0a04,
-- 0x48066202, 0x42027000, 0x00000046, 0x0201f000,
-- 0x000208d8, 0x59cc0004, 0x4803c857, 0x1c01f000,
-- 0x59cc0004, 0x4803c857, 0x1c01f000, 0x0401f8c3,
-- 0x04000016, 0x82140500, 0x000003ff, 0x800000c4,
-- 0x82000480, 0x0000000c, 0x04001010, 0x59cc0001,
-- 0x82000500, 0x00ffffff, 0x59326809, 0x59340802,
-- 0x82040d00, 0x00ffffff, 0x80040580, 0x04020007,
-- 0x59cc0a04, 0x48066202, 0x42027000, 0x00000045,
-- 0x0201f000, 0x000208d8, 0x59cc0004, 0x4803c857,
-- 0x1c01f000, 0x59cc0004, 0x4803c857, 0x59cc0000,
-- 0x82000500, 0xff000000, 0x59cc1001, 0x82081500,
-- 0x00ffffff, 0x80080540, 0x4803c857, 0x4817c857,
-- 0x0401f9d8, 0x02020800, 0x001006ba, 0x04020016,
-- 0x0201f800, 0x00101eb0, 0x02020800, 0x001006ba,
-- 0x04020011, 0x59cc0002, 0x82000500, 0xff000000,
-- 0x82000580, 0x00000000, 0x02020800, 0x001006ba,
-- 0x04020009, 0x82040500, 0x0000000f, 0x82000c80,
-- 0x00000006, 0x02021800, 0x001006ba, 0x04021002,
-- 0x0c01f003, 0x4803c856, 0x1c01f000, 0x00105a91,
-- 0x00105a93, 0x00105a91, 0x00105a91, 0x00105aec,
-- 0x00105afb, 0x4803c856, 0x1c01f000, 0x59a80016,
-- 0x800001c0, 0x02020800, 0x001006ba, 0x040207fa,
-- 0x59cc0802, 0x4807c856, 0x8c040d2e, 0x0402001d,
-- 0x0201f800, 0x001076c9, 0x02000800, 0x00100615,
-- 0x59cc0001, 0x0401ff18, 0x0402000d, 0x0201f800,
-- 0x00020267, 0x0402000a, 0x4a026406, 0x00000005,
-- 0x49366009, 0x59cc0804, 0x4806601c, 0x42027000,
-- 0x00000088, 0x0201f000, 0x000208d8, 0x4803c857,
-- 0x42028800, 0x0000ffff, 0x417a6800, 0x59cc0001,
-- 0x82000500, 0x00ffffff, 0x4802601e, 0x0401f7ef,
-- 0x59cc0001, 0x4803c857, 0x0401feff, 0x02020800,
-- 0x001006ba, 0x040207d4, 0x0201f800, 0x001043fc,
-- 0x02020800, 0x001006ba, 0x040207cf, 0x59cc0005,
-- 0x8c000500, 0x04020006, 0x59340200, 0x8c00050e,
-- 0x02020800, 0x001006ba, 0x040207c7, 0x0201f800,
-- 0x00104842, 0x04020013, 0x0401f840, 0x02000800,
-- 0x001006ba, 0x040007c0, 0x0201f800, 0x00020892,
-- 0x02000800, 0x001006ba, 0x040007bb, 0x49366009,
-- 0x4a026406, 0x00000002, 0x59cc0804, 0x4806601c,
-- 0x42027000, 0x00000088, 0x0201f000, 0x000208d8,
-- 0x0201f800, 0x00020892, 0x040007af, 0x49366009,
-- 0x4a026406, 0x00000004, 0x59cc0c04, 0x48066202,
-- 0x42027000, 0x00000001, 0x0201f000, 0x000208d8,
-- 0x59cc0802, 0x8c040d2e, 0x0400000b, 0x0401f81f,
-- 0x04000009, 0x0401f961, 0x04020007, 0x59cc0a04,
-- 0x48066202, 0x42027000, 0x00000089, 0x0201f000,
-- 0x000208d8, 0x4933c857, 0x1c01f000, 0x59cc0004,
-- 0x4803c857, 0x59cc0802, 0x8c040d2e, 0x0400000b,
-- 0x0401f80e, 0x04000009, 0x0401f950, 0x04020007,
-- 0x59cc0a04, 0x48066202, 0x42027000, 0x0000008a,
-- 0x0201f000, 0x000208d8, 0x4933c857, 0x1c01f000,
-- 0x59cc0a04, 0x0401f002, 0x59cc0c04, 0x59a8000e,
-- 0x59a81067, 0x80080400, 0x80040480, 0x04021008,
-- 0x40040000, 0x800000c4, 0x800408ca, 0x80040c00,
-- 0x82066400, 0x0010cfc0, 0x1c01f000, 0x80000580,
-- 0x0401f7fe, 0x59cc0802, 0x8c040d2e, 0x04020010,
-- 0x0401ffec, 0x0400000e, 0x59cc0001, 0x82000500,
-+ 0x00100594, 0x040200f1, 0x42027000, 0x0000001b,
-+ 0x0401f0ac, 0x82000d80, 0x50000000, 0x0402000a,
-+ 0x59cc0006, 0x82000500, 0x0000ffff, 0x02020800,
-+ 0x00100594, 0x040200e5, 0x42027000, 0x0000001c,
-+ 0x0401f0a0, 0x82000d80, 0x13000000, 0x04020004,
-+ 0x42027000, 0x00000034, 0x0401f09a, 0x82000d80,
-+ 0x12000000, 0x0402000a, 0x59cc0006, 0x82000500,
-+ 0x0000ffff, 0x02020800, 0x00100594, 0x040200d3,
-+ 0x42027000, 0x00000024, 0x0401f08e, 0x82000d00,
-+ 0xff000000, 0x82040d80, 0x24000000, 0x04020004,
-+ 0x42027000, 0x0000002d, 0x0401f086, 0x82000d00,
-+ 0xff000000, 0x82040d80, 0x53000000, 0x04020004,
-+ 0x42027000, 0x0000002a, 0x0401f07e, 0x82000d80,
-+ 0x0f000000, 0x04020004, 0x42027000, 0x00000020,
-+ 0x0401f078, 0x82000d80, 0x61040000, 0x04020036,
-+ 0x83cc1400, 0x00000006, 0x80080800, 0x50080000,
-+ 0x82000500, 0x0000ffff, 0x82000480, 0x00000004,
-+ 0x4c580000, 0x8000b104, 0x8058b1c0, 0x04000026,
-+ 0x4c100000, 0x50041800, 0x820c1500, 0x03000000,
-+ 0x80081130, 0x42000000, 0x0010afe5, 0x82082580,
-+ 0x00000000, 0x04020004, 0x42000000, 0x0010afe2,
-+ 0x0401f00c, 0x82082580, 0x00000001, 0x04020004,
-+ 0x42000000, 0x0010afe3, 0x0401f006, 0x82082580,
-+ 0x00000002, 0x04020003, 0x42000000, 0x0010afe4,
-+ 0x0201f800, 0x0010a260, 0x42001000, 0x00008015,
-+ 0x820c2500, 0x0000ffff, 0x800c1920, 0x0201f800,
-+ 0x001036f4, 0x5c002000, 0x80040800, 0x8058b040,
-+ 0x040207da, 0x5c00b000, 0x42027000, 0x00000023,
-+ 0x0401f040, 0x82000d80, 0x60000000, 0x04020004,
-+ 0x42027000, 0x0000003f, 0x0401f03a, 0x82000d80,
-+ 0x54000000, 0x04020008, 0x0401fb3c, 0x02020800,
-+ 0x00100594, 0x04020075, 0x42027000, 0x00000046,
-+ 0x0401f030, 0x82000d80, 0x55000000, 0x04020009,
-+ 0x0401fb5a, 0x04020004, 0x42027000, 0x00000041,
-+ 0x0401f028, 0x42027000, 0x00000042, 0x0401f025,
-+ 0x82000d80, 0x78000000, 0x04020004, 0x42027000,
-+ 0x00000045, 0x0401f01f, 0x82000d80, 0x10000000,
-+ 0x04020004, 0x42027000, 0x0000004e, 0x0401f019,
-+ 0x82000d80, 0x63000000, 0x04020004, 0x42027000,
-+ 0x0000004a, 0x0401f013, 0x82000d00, 0xff000000,
-+ 0x82040d80, 0x56000000, 0x04020004, 0x42027000,
-+ 0x0000004f, 0x0401f00b, 0x82000d00, 0xff000000,
-+ 0x82040d80, 0x57000000, 0x04020004, 0x42027000,
-+ 0x00000050, 0x0401f003, 0x42027000, 0x0000001d,
-+ 0x59cc3800, 0x821c3d00, 0x00ffffff, 0x821c0580,
-+ 0x00fffffe, 0x59cc0001, 0x04020005, 0x40003000,
-+ 0x42028800, 0x000007fe, 0x0401f005, 0x0401f8da,
-+ 0x02020800, 0x00100594, 0x04020034, 0x0201f800,
-+ 0x001042b6, 0x02020800, 0x00100594, 0x0402002f,
-+ 0x83380580, 0x00000046, 0x04020006, 0x59a8000f,
-+ 0x80180580, 0x02000800, 0x00100594, 0x04000027,
-+ 0x59340200, 0x8c000514, 0x0400000f, 0x83380580,
-+ 0x00000030, 0x0400000c, 0x83380580, 0x0000003f,
-+ 0x04000009, 0x83380580, 0x00000034, 0x04000006,
-+ 0x83380580, 0x00000024, 0x04000003, 0x42027000,
-+ 0x0000004c, 0x0201f800, 0x00020799, 0x04000018,
-+ 0x49366009, 0x4a026406, 0x00000004, 0x59cc0c04,
-+ 0x48066202, 0x83380580, 0x0000004c, 0x04020009,
-+ 0x4a026406, 0x00000011, 0x813669c0, 0x04020005,
-+ 0x59cc0001, 0x82000500, 0x00ffffff, 0x4802601e,
-+ 0x0201f000, 0x000207df, 0x59880053, 0x4803c857,
-+ 0x80000000, 0x48031053, 0x1c01f000, 0x42001000,
-+ 0x00008049, 0x59cc1806, 0x800c1930, 0x0201f800,
-+ 0x001036f4, 0x0201f800, 0x001071d5, 0x02000800,
-+ 0x00100594, 0x040007f1, 0x49366009, 0x4a026406,
-+ 0x00000004, 0x59cc0c04, 0x48066202, 0x4a026403,
-+ 0x00000009, 0x4a02641a, 0x00000009, 0x4a02621a,
-+ 0x00002900, 0x4a026203, 0x00000001, 0x0201f000,
-+ 0x00106339, 0x59a80023, 0x4803c857, 0x8c000508,
-+ 0x04000010, 0x59cc0006, 0x82000500, 0xff000000,
-+ 0x82000d80, 0x03000000, 0x0400000c, 0x82000d80,
-+ 0x20000000, 0x04000009, 0x82000d80, 0x05000000,
-+ 0x04000006, 0x82000d80, 0x21000000, 0x04000003,
-+ 0x80000580, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x0401f7fd, 0x59cc2006, 0x82102500, 0xff000000,
-+ 0x9c1021c0, 0x0401f807, 0x820c1c00, 0x0010acb0,
-+ 0x500c1800, 0x800c0500, 0x4803c857, 0x1c01f000,
-+ 0x40100800, 0x41781800, 0x82040480, 0x00000020,
-+ 0x04001004, 0x800c1800, 0x40000800, 0x0401f7fb,
-+ 0x82040500, 0x0000000f, 0x82000400, 0x0010a351,
-+ 0x50000000, 0x8c040d08, 0x04000002, 0x900001c0,
-+ 0x1c01f000, 0x4803c856, 0x0401fae3, 0x0402000a,
-+ 0x0201f800, 0x00101cd8, 0x04020007, 0x59cc0002,
-+ 0x82000500, 0xff000000, 0x82000d80, 0x08000000,
-+ 0x04000802, 0x1c01f000, 0x4803c856, 0x59cc0400,
-+ 0x82000d00, 0x0000ff00, 0x840409c0, 0x82040580,
-+ 0x00000033, 0x0402001f, 0x0401f98f, 0x04000038,
-+ 0x59cc0a04, 0x48066202, 0x59cc0006, 0x4803c857,
-+ 0x82000500, 0xffff0000, 0x82000d80, 0x02000000,
-+ 0x04020009, 0x59cc0006, 0x82000500, 0x0000ffff,
-+ 0x0402002b, 0x42027000, 0x00000015, 0x0201f000,
-+ 0x000207df, 0x82000d80, 0x01000000, 0x04020024,
-+ 0x59cc0006, 0x82000500, 0x0000ffff, 0x04020020,
-+ 0x42027000, 0x00000016, 0x0201f000, 0x000207df,
-+ 0x82040580, 0x00000032, 0x04020019, 0x59cc0006,
-+ 0x82000500, 0xffff0000, 0x82000d80, 0x14000000,
-+ 0x04020013, 0x42027000, 0x00000038, 0x59cc0001,
-+ 0x0401f810, 0x0402000e, 0x0201f800, 0x001042b1,
-+ 0x0402000b, 0x0201f800, 0x00020799, 0x04000008,
-+ 0x49366009, 0x4a026406, 0x00000004, 0x59cc0c04,
-+ 0x48066202, 0x0201f000, 0x000207df, 0x1c01f000,
-+ 0x4803c857, 0x4c580000, 0x4c100000, 0x4c380000,
-+ 0x4c340000, 0x82003500, 0x00ffffff, 0x82181500,
-+ 0x00ff0000, 0x82081580, 0x00ff0000, 0x04020016,
-+ 0x82181480, 0x00fffffc, 0x04001013, 0x82181580,
-+ 0x00fffffd, 0x04020004, 0x42028800, 0x000007fd,
-+ 0x0401f040, 0x82181580, 0x00fffffe, 0x04020004,
-+ 0x42028800, 0x000007fe, 0x0401f03a, 0x82181580,
-+ 0x00fffffc, 0x04020004, 0x42028800, 0x000007fc,
-+ 0x0401f034, 0x41781000, 0x42002000, 0x00000000,
-+ 0x4200b000, 0x000007f0, 0x41ac7000, 0x50380000,
-+ 0x80006d40, 0x04020005, 0x800811c0, 0x0402001e,
-+ 0x8410155e, 0x0401f01c, 0x58340212, 0x82000500,
-+ 0x0000ff00, 0x04000011, 0x59a8400f, 0x82204500,
-+ 0x00ffff00, 0x82180500, 0x00ffff00, 0x04000002,
-+ 0x80200580, 0x58340002, 0x0402000f, 0x82000500,
-+ 0x000000ff, 0x82184500, 0x000000ff, 0x80204580,
-+ 0x04020009, 0x0401f006, 0x58340002, 0x82000500,
-+ 0x00ffffff, 0x80184580, 0x04020003, 0x40128800,
-+ 0x0401f00c, 0x80102000, 0x80387000, 0x8058b040,
-+ 0x040207db, 0x800811c0, 0x04020005, 0x481bc857,
-+ 0x82000540, 0x00000001, 0x0401f003, 0x840a8d1e,
-+ 0x80000580, 0x5c006800, 0x5c007000, 0x5c002000,
-+ 0x5c00b000, 0x1c01f000, 0x59a80023, 0x8c00050e,
-+ 0x04000003, 0x8c000502, 0x04000006, 0x59cc0c00,
-+ 0x80040910, 0x82040500, 0x0000000f, 0x0c01f002,
-+ 0x1c01f000, 0x001058c9, 0x001058c9, 0x001058c9,
-+ 0x001059b8, 0x001058c9, 0x001058cb, 0x001058e3,
-+ 0x001058e6, 0x001058c9, 0x001058c9, 0x001058c9,
-+ 0x001058c9, 0x001058c9, 0x001058c9, 0x001058c9,
-+ 0x001058c9, 0x4803c856, 0x1c01f000, 0x0401f8de,
-+ 0x04000014, 0x82140500, 0x000003ff, 0x800000c4,
-+ 0x82000480, 0x00000008, 0x0400100e, 0x59cc0001,
-+ 0x59326809, 0x59340802, 0x80040580, 0x82000500,
-+ 0x00ffffff, 0x04020007, 0x59cc0a04, 0x48066202,
-+ 0x42027000, 0x00000046, 0x0201f000, 0x000207df,
-+ 0x59cc0004, 0x4803c857, 0x1c01f000, 0x59cc0004,
-+ 0x4803c857, 0x1c01f000, 0x0401f8c3, 0x04000016,
-+ 0x82140500, 0x000003ff, 0x800000c4, 0x82000480,
-+ 0x0000000c, 0x04001010, 0x59cc0001, 0x82000500,
- 0x00ffffff, 0x59326809, 0x59340802, 0x82040d00,
-- 0x00ffffff, 0x80040580, 0x04020005, 0x42027000,
-- 0x00000051, 0x0201f000, 0x000208d8, 0x59cc0004,
-- 0x4803c857, 0x1c01f000, 0x4803c856, 0x42003000,
-- 0x00000105, 0x0401f001, 0x4803c856, 0x4c3c0000,
-- 0x41cc7800, 0x40142000, 0x0401f803, 0x5c007800,
-- 0x1c01f000, 0x4803c856, 0x4c580000, 0x583c0400,
-- 0x82000500, 0x0000f000, 0x82000580, 0x0000c000,
-- 0x04000024, 0x0201f800, 0x00020892, 0x04000021,
-- 0x4c180000, 0x583c0001, 0x0401fe6f, 0x0402001f,
-- 0x0201f800, 0x001043fc, 0x0402001c, 0x49366009,
-- 0x0201f800, 0x0010082a, 0x04000018, 0x492e6017,
-- 0x497a5800, 0x497a5a04, 0x48125c04, 0x832cac00,
-- 0x00000005, 0x4200b000, 0x00000007, 0x403ca000,
-- 0x0201f800, 0x0010a93e, 0x5c003000, 0x481a641a,
-- 0x4a026403, 0x0000003e, 0x4a026406, 0x00000001,
-- 0x4a026203, 0x00000001, 0x0201f800, 0x00106470,
-- 0x5c00b000, 0x1c01f000, 0x0201f800, 0x000208b4,
-- 0x5c003000, 0x0401f7fb, 0x4803c856, 0x59cc0400,
-- 0x82000d00, 0x0000ff00, 0x82040500, 0x0000f000,
-- 0x840409c0, 0x82000580, 0x00002000, 0x04020049,
-- 0x82040580, 0x00000022, 0x0402003a, 0x59c400a4,
-- 0x82000500, 0x0000000f, 0x82000c80, 0x00000007,
-- 0x04001004, 0x82000480, 0x0000000c, 0x0400103f,
-- 0x59cc0006, 0x82000500, 0xffff0000, 0x82000d80,
-- 0x04000000, 0x04000039, 0x82000d80, 0x60000000,
-- 0x04000036, 0x82000d80, 0x54000000, 0x04000033,
-- 0x82000d80, 0x03000000, 0x04020015, 0x59a80826,
-- 0x8c040d02, 0x0402002d, 0x8c040d08, 0x0402002b,
-- 0x0201f800, 0x0010473b, 0x0400002b, 0x59a8001d,
-- 0x800000d0, 0x59a80810, 0x82040d00, 0x000000ff,
-- 0x80040540, 0x59cc0800, 0x82040d00, 0x00ffffff,
-- 0x80040580, 0x0402001b, 0x0401f01c, 0x59c40802,
-- 0x8c040d0c, 0x04020017, 0x82000d80, 0x52000000,
-- 0x040007ec, 0x82000d80, 0x05000000, 0x040007e9,
-- 0x82000d80, 0x50000000, 0x040007e6, 0x0401f00d,
-- 0x82040580, 0x00000023, 0x0402000a, 0x0401ff57,
-- 0x04000008, 0x59300c03, 0x82040580, 0x00000002,
-- 0x04000006, 0x82040580, 0x00000051, 0x04000003,
-- 0x80000580, 0x0401f003, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x59cc0006, 0x82000500, 0xffff0000,
-- 0x82000d80, 0x03000000, 0x04000004, 0x82000d80,
-- 0x52000000, 0x040207f3, 0x59a80026, 0x82000500,
-- 0x00000009, 0x82000580, 0x00000008, 0x040007ef,
-- 0x0401f7ec, 0x4803c856, 0x4c5c0000, 0x4c580000,
-- 0x59a80016, 0x82000580, 0x0000004c, 0x0402001f,
-- 0x59ccb807, 0x9c5cb9c0, 0x825cbd00, 0x00000007,
-- 0x8c5cbd00, 0x0400000a, 0x4200b000, 0x00000002,
-- 0x83a81c00, 0x00000002, 0x83cc1400, 0x0000000d,
-- 0x0201f800, 0x001082ff, 0x04020010, 0x8c5cbd02,
-- 0x0400000a, 0x4200b000, 0x00000002, 0x83a81c00,
-- 0x00000000, 0x83cc1400, 0x0000000f, 0x0201f800,
-- 0x001082ff, 0x04020005, 0x8c5cbd04, 0x04000003,
-- 0x82000540, 0x00000001, 0x5c00b000, 0x5c00b800,
-- 0x1c01f000, 0x4803c856, 0x4c5c0000, 0x4c580000,
-- 0x59a80016, 0x82000580, 0x0000004c, 0x0402001f,
-- 0x59ccb807, 0x9c5cb9c0, 0x825cbd00, 0x00000007,
-- 0x8c5cbd00, 0x0400000a, 0x4200b000, 0x00000002,
-- 0x83a81c00, 0x00000002, 0x83cc1400, 0x00000009,
-- 0x0201f800, 0x001082ff, 0x04020010, 0x8c5cbd02,
-- 0x0400000a, 0x4200b000, 0x00000002, 0x83a81c00,
-- 0x00000000, 0x83cc1400, 0x0000000b, 0x0201f800,
-- 0x001082ff, 0x04020005, 0x8c5cbd04, 0x04000003,
-- 0x82000540, 0x00000001, 0x5c00b000, 0x5c00b800,
-- 0x1c01f000, 0x4803c857, 0x4c580000, 0x40003000,
-- 0x42002000, 0x000007f0, 0x4200b000, 0x00000010,
-- 0x83ac7400, 0x000007f0, 0x50380000, 0x80026d40,
-- 0x04000006, 0x59340002, 0x82000500, 0x00ffffff,
-- 0x80180580, 0x04000010, 0x80102000, 0x80387000,
-- 0x8058b040, 0x040207f5, 0x82100480, 0x00000800,
-- 0x42002000, 0x00000000, 0x4200b000, 0x000007f0,
-- 0x41ac7000, 0x040217ed, 0x82000540, 0x00000001,
-- 0x0401f002, 0x40128800, 0x5c00b000, 0x1c01f000,
-- 0x59a80026, 0x8c00050e, 0x04000004, 0x8c000502,
-- 0x04000003, 0x80000580, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401f7fd, 0x59300c06, 0x82040580,
-- 0x00000002, 0x04000006, 0x82040580, 0x00000005,
-- 0x04000003, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x59c80000, 0x84000558, 0x84000512, 0x48039000,
-- 0x1c01f000, 0x4a03281a, 0x000003e8, 0x4a032802,
-- 0x0010cfc0, 0x4a032800, 0x00000000, 0x4a032808,
-- 0x00106d9f, 0x42000000, 0x00000005, 0x83947c00,
-- 0x00000009, 0x49787801, 0x4a007802, 0x00106d54,
-- 0x823c7c00, 0x00000003, 0x80000040, 0x040207fa,
-- 0x4a032819, 0xffff0000, 0x4201d000, 0x00000064,
-- 0x0401f97c, 0x4201d000, 0x000186a0, 0x0401f18b,
-- 0x00000000, 0x00000003, 0x00000006, 0x00000009,
-- 0x0000000c, 0x4d300000, 0x4d2c0000, 0x4d340000,
-- 0x4d400000, 0x4cfc0000, 0x4d380000, 0x4d3c0000,
-- 0x4d440000, 0x4d4c0000, 0x4d480000, 0x4c5c0000,
-- 0x4c600000, 0x4c640000, 0x4cc80000, 0x4ccc0000,
-- 0x0201f800, 0x000206af, 0x5c019800, 0x5c019000,
-- 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x5c029000,
-- 0x5c029800, 0x5c028800, 0x5c027800, 0x5c027000,
-- 0x5c01f800, 0x5c028000, 0x5c026800, 0x5c025800,
-- 0x5c026000, 0x1c01f000, 0x59940004, 0x80000540,
-- 0x0402000a, 0x59940025, 0x80040400, 0x02001800,
-- 0x00100615, 0x48032804, 0x480b2805, 0x4a032803,
-- 0x0000000a, 0x80000580, 0x1c01f000, 0x5994001f,
-+ 0x00ffffff, 0x80040580, 0x04020007, 0x59cc0a04,
-+ 0x48066202, 0x42027000, 0x00000045, 0x0201f000,
-+ 0x000207df, 0x59cc0004, 0x4803c857, 0x1c01f000,
-+ 0x59cc0004, 0x4803c857, 0x59cc0000, 0x82000500,
-+ 0xff000000, 0x59cc1001, 0x82081500, 0x00ffffff,
-+ 0x80080540, 0x4803c857, 0x4817c857, 0x0401f9de,
-+ 0x02020800, 0x00100594, 0x04020016, 0x0201f800,
-+ 0x00101cd8, 0x02020800, 0x00100594, 0x04020011,
-+ 0x59cc0002, 0x82000500, 0xff000000, 0x82000580,
-+ 0x00000000, 0x02020800, 0x00100594, 0x04020009,
-+ 0x82040500, 0x0000000f, 0x82000c80, 0x00000006,
-+ 0x02021800, 0x00100594, 0x04021002, 0x0c01f003,
-+ 0x4803c856, 0x1c01f000, 0x0010592c, 0x0010592e,
-+ 0x0010592c, 0x0010592c, 0x00105987, 0x00105996,
-+ 0x4803c856, 0x1c01f000, 0x59a80015, 0x800001c0,
-+ 0x02020800, 0x00100594, 0x040207fa, 0x59cc0802,
-+ 0x4807c856, 0x8c040d2e, 0x0402001d, 0x0201f800,
-+ 0x001071d5, 0x02000800, 0x001004ef, 0x59cc0001,
-+ 0x0401ff18, 0x0402000d, 0x0201f800, 0x0002025a,
-+ 0x0402000a, 0x4a026406, 0x00000005, 0x49366009,
-+ 0x59cc0804, 0x4806601c, 0x42027000, 0x00000088,
-+ 0x0201f000, 0x000207df, 0x4803c857, 0x42028800,
-+ 0x0000ffff, 0x417a6800, 0x59cc0001, 0x82000500,
-+ 0x00ffffff, 0x4802601e, 0x0401f7ef, 0x59cc0001,
-+ 0x4803c857, 0x0401feff, 0x02020800, 0x00100594,
-+ 0x040207d4, 0x0201f800, 0x001042b1, 0x02020800,
-+ 0x00100594, 0x040207cf, 0x59cc0005, 0x8c000500,
-+ 0x04020006, 0x59340200, 0x8c00050e, 0x02020800,
-+ 0x00100594, 0x040207c7, 0x0201f800, 0x00104725,
-+ 0x04020013, 0x0401f840, 0x02000800, 0x00100594,
-+ 0x040007c0, 0x0201f800, 0x00020799, 0x02000800,
-+ 0x00100594, 0x040007bb, 0x49366009, 0x4a026406,
-+ 0x00000002, 0x59cc0804, 0x4806601c, 0x42027000,
-+ 0x00000088, 0x0201f000, 0x000207df, 0x0201f800,
-+ 0x00020799, 0x040007af, 0x49366009, 0x4a026406,
-+ 0x00000004, 0x59cc0c04, 0x48066202, 0x42027000,
-+ 0x00000001, 0x0201f000, 0x000207df, 0x59cc0802,
-+ 0x8c040d2e, 0x0400000b, 0x0401f81f, 0x04000009,
-+ 0x0401f967, 0x04020007, 0x59cc0a04, 0x48066202,
-+ 0x42027000, 0x00000089, 0x0201f000, 0x000207df,
-+ 0x4933c857, 0x1c01f000, 0x59cc0004, 0x4803c857,
-+ 0x59cc0802, 0x8c040d2e, 0x0400000b, 0x0401f80e,
-+ 0x04000009, 0x0401f956, 0x04020007, 0x59cc0a04,
-+ 0x48066202, 0x42027000, 0x0000008a, 0x0201f000,
-+ 0x000207df, 0x4933c857, 0x1c01f000, 0x59cc0a04,
-+ 0x0401f002, 0x59cc0c04, 0x59a8000d, 0x59a81064,
-+ 0x80080400, 0x80040480, 0x04021008, 0x40040000,
-+ 0x800000c4, 0x800408ca, 0x80040c00, 0x82066400,
-+ 0x0010d8d4, 0x1c01f000, 0x80000580, 0x0401f7fe,
-+ 0x59cc0802, 0x8c040d2e, 0x04020010, 0x0401ffec,
-+ 0x0400000e, 0x59cc0001, 0x82000500, 0x00ffffff,
-+ 0x59326809, 0x59340802, 0x82040d00, 0x00ffffff,
-+ 0x80040580, 0x04020005, 0x42027000, 0x00000051,
-+ 0x0201f000, 0x000207df, 0x59cc0004, 0x4803c857,
-+ 0x1c01f000, 0x4803c856, 0x42003000, 0x00000105,
-+ 0x0401f001, 0x4803c856, 0x4c3c0000, 0x41cc7800,
-+ 0x40142000, 0x0401f803, 0x5c007800, 0x1c01f000,
-+ 0x4803c856, 0x4c580000, 0x583c0400, 0x82000500,
-+ 0x0000f000, 0x82000580, 0x0000c000, 0x04000024,
-+ 0x0201f800, 0x00020799, 0x04000021, 0x4c180000,
-+ 0x583c0001, 0x0401fe6f, 0x0402001f, 0x0201f800,
-+ 0x001042b1, 0x0402001c, 0x49366009, 0x0201f800,
-+ 0x0010071a, 0x04000018, 0x492e6017, 0x497a5800,
-+ 0x497a5a04, 0x48125c04, 0x832cac00, 0x00000005,
-+ 0x4200b000, 0x00000007, 0x403ca000, 0x0201f800,
-+ 0x0010a330, 0x5c003000, 0x481a641a, 0x4a026403,
-+ 0x0000003e, 0x4a026406, 0x00000001, 0x4a026203,
-+ 0x00000001, 0x0201f800, 0x00106339, 0x5c00b000,
-+ 0x1c01f000, 0x0201f800, 0x000207bb, 0x5c003000,
-+ 0x0401f7fb, 0x4803c856, 0x59cc0400, 0x82000d00,
-+ 0x0000ff00, 0x82040500, 0x0000f000, 0x840409c0,
-+ 0x82000580, 0x00002000, 0x0402004f, 0x82040580,
-+ 0x00000022, 0x04020040, 0x59c400a4, 0x82000500,
-+ 0x0000000f, 0x82000c80, 0x00000007, 0x04001004,
-+ 0x82000480, 0x0000000c, 0x04001045, 0x59cc0006,
-+ 0x82000500, 0xffff0000, 0x82000d80, 0x04000000,
-+ 0x0400003f, 0x82000d80, 0x60000000, 0x0400003c,
-+ 0x82000d80, 0x54000000, 0x04000039, 0x82000d80,
-+ 0x03000000, 0x0402001b, 0x59a80823, 0x8c040d02,
-+ 0x04020033, 0x8c040d08, 0x04020031, 0x82000d80,
-+ 0x03000000, 0x04020004, 0x0201f800, 0x00104ca6,
-+ 0x0400002b, 0x0201f800, 0x00104614, 0x0400002b,
-+ 0x59a8001c, 0x800000d0, 0x59a8080f, 0x82040d00,
-+ 0x000000ff, 0x80040540, 0x59cc0800, 0x82040d00,
-+ 0x00ffffff, 0x80040580, 0x0402001b, 0x0401f01c,
-+ 0x59c40802, 0x8c040d0c, 0x04020017, 0x82000d80,
-+ 0x52000000, 0x040007ec, 0x82000d80, 0x05000000,
-+ 0x040007e9, 0x82000d80, 0x50000000, 0x040007e6,
-+ 0x0401f00d, 0x82040580, 0x00000023, 0x0402000a,
-+ 0x0401ff51, 0x04000008, 0x59300c03, 0x82040580,
-+ 0x00000002, 0x04000006, 0x82040580, 0x00000051,
-+ 0x04000003, 0x80000580, 0x0401f003, 0x82000540,
-+ 0x00000001, 0x1c01f000, 0x59cc0006, 0x82000500,
-+ 0xffff0000, 0x82000d80, 0x03000000, 0x04000004,
-+ 0x82000d80, 0x52000000, 0x040207f3, 0x59a80023,
-+ 0x82000500, 0x00000009, 0x82000580, 0x00000008,
-+ 0x040007ef, 0x0401f7ec, 0x4803c856, 0x4c5c0000,
-+ 0x4c580000, 0x59a80015, 0x82000580, 0x0000004c,
-+ 0x0402001f, 0x59ccb807, 0x9c5cb9c0, 0x825cbd00,
-+ 0x00000007, 0x8c5cbd00, 0x0400000a, 0x4200b000,
-+ 0x00000002, 0x83a81c00, 0x00000002, 0x83cc1400,
-+ 0x0000000d, 0x0201f800, 0x00107d41, 0x04020010,
-+ 0x8c5cbd02, 0x0400000a, 0x4200b000, 0x00000002,
-+ 0x83a81c00, 0x00000000, 0x83cc1400, 0x0000000f,
-+ 0x0201f800, 0x00107d41, 0x04020005, 0x8c5cbd04,
-+ 0x04000003, 0x82000540, 0x00000001, 0x5c00b000,
-+ 0x5c00b800, 0x1c01f000, 0x4803c856, 0x4c5c0000,
-+ 0x4c580000, 0x59a80015, 0x82000580, 0x0000004c,
-+ 0x0402001f, 0x59ccb807, 0x9c5cb9c0, 0x825cbd00,
-+ 0x00000007, 0x8c5cbd00, 0x0400000a, 0x4200b000,
-+ 0x00000002, 0x83a81c00, 0x00000002, 0x83cc1400,
-+ 0x00000009, 0x0201f800, 0x00107d41, 0x04020010,
-+ 0x8c5cbd02, 0x0400000a, 0x4200b000, 0x00000002,
-+ 0x83a81c00, 0x00000000, 0x83cc1400, 0x0000000b,
-+ 0x0201f800, 0x00107d41, 0x04020005, 0x8c5cbd04,
-+ 0x04000003, 0x82000540, 0x00000001, 0x5c00b000,
-+ 0x5c00b800, 0x1c01f000, 0x4803c857, 0x4c580000,
-+ 0x40003000, 0x42002000, 0x000007f0, 0x4200b000,
-+ 0x00000010, 0x83ac7400, 0x000007f0, 0x50380000,
-+ 0x80026d40, 0x04000006, 0x59340002, 0x82000500,
-+ 0x00ffffff, 0x80180580, 0x04000010, 0x80102000,
-+ 0x80387000, 0x8058b040, 0x040207f5, 0x82100480,
-+ 0x00000800, 0x42002000, 0x00000000, 0x4200b000,
-+ 0x000007f0, 0x41ac7000, 0x040217ed, 0x82000540,
-+ 0x00000001, 0x0401f002, 0x40128800, 0x5c00b000,
-+ 0x1c01f000, 0x59a80023, 0x8c00050e, 0x04000004,
-+ 0x8c000502, 0x04000003, 0x80000580, 0x1c01f000,
-+ 0x82000540, 0x00000001, 0x0401f7fd, 0x59300c06,
-+ 0x82040580, 0x00000002, 0x04000006, 0x82040580,
-+ 0x00000005, 0x04000003, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x59c80000, 0x84000558, 0x84000512,
-+ 0x48039000, 0x1c01f000, 0x4a03281a, 0x000003e8,
-+ 0x4a032802, 0x0010d8d4, 0x4a032800, 0x00000000,
-+ 0x4a032808, 0x00106893, 0x42000000, 0x00000005,
-+ 0x83947c00, 0x00000009, 0x49787801, 0x4a007802,
-+ 0x00106848, 0x823c7c00, 0x00000003, 0x80000040,
-+ 0x040207fa, 0x4a032819, 0xffff0000, 0x4201d000,
-+ 0x00000064, 0x0401f985, 0x4201d000, 0x000186a0,
-+ 0x0401f194, 0x00000000, 0x00000003, 0x00000006,
-+ 0x00000009, 0x0000000c, 0x4d300000, 0x4d2c0000,
-+ 0x4d340000, 0x4d400000, 0x4cfc0000, 0x4d380000,
-+ 0x4d3c0000, 0x4d440000, 0x4d4c0000, 0x4d480000,
-+ 0x4c5c0000, 0x4c600000, 0x4c640000, 0x4cc80000,
-+ 0x4ccc0000, 0x0201f800, 0x000205d0, 0x5c019800,
-+ 0x5c019000, 0x5c00c800, 0x5c00c000, 0x5c00b800,
-+ 0x5c029000, 0x5c029800, 0x5c028800, 0x5c027800,
-+ 0x5c027000, 0x5c01f800, 0x5c028000, 0x5c026800,
-+ 0x5c025800, 0x5c026000, 0x1c01f000, 0x59940004,
- 0x80000540, 0x0402000a, 0x59940025, 0x80040400,
-- 0x02001800, 0x00100615, 0x4803281f, 0x480b2820,
-- 0x4a03281e, 0x00000001, 0x80000580, 0x1c01f000,
-- 0x59940022, 0x80000540, 0x0402000a, 0x59940025,
-- 0x80040400, 0x02001800, 0x00100615, 0x48032822,
-- 0x480b2823, 0x4a032821, 0x0000000a, 0x80000580,
-- 0x1c01f000, 0x4c000000, 0x59940005, 0x4803c857,
-- 0x480bc857, 0x80080580, 0x04020003, 0x497b2804,
-- 0x497b2805, 0x5c000000, 0x1c01f000, 0x4c000000,
-- 0x59940020, 0x4803c857, 0x480bc857, 0x80080580,
-- 0x04020003, 0x497b281f, 0x497b2820, 0x5c000000,
-- 0x1c01f000, 0x4c000000, 0x59940023, 0x4803c857,
-- 0x480bc857, 0x80080580, 0x04020003, 0x497b2822,
-- 0x497b2823, 0x5c000000, 0x1c01f000, 0x4937c857,
-- 0x48ebc857, 0x59340203, 0x80e80480, 0x04001002,
-- 0x48ea6a03, 0x1c01f000, 0x5c03e000, 0x1c01f000,
-- 0x4d440000, 0x42007800, 0x00000010, 0x59968801,
-- 0x0201f800, 0x00020267, 0x04020012, 0x59341a03,
-- 0x800c1840, 0x0400100f, 0x59940027, 0x800c0480,
-- 0x04000003, 0x48026a03, 0x0402100a, 0x5934000f,
-- 0x497a6a03, 0x80000540, 0x04000006, 0x4c3c0000,
-- 0x5934140b, 0x0201f800, 0x00020275, 0x5c007800,
-- 0x81468800, 0x83440480, 0x00000800, 0x04021007,
-- 0x803c7840, 0x040207e7, 0x49472801, 0x5c028800,
-- 0x5c03e000, 0x1c01f000, 0x4a032800, 0x00000002,
-- 0x497b2801, 0x0401f7fa, 0x42007800, 0x00000010,
-- 0x59966002, 0x59300205, 0x80000d40, 0x04000006,
-- 0x59940027, 0x80040480, 0x48026205, 0x0400102d,
-- 0x0400002c, 0x59300206, 0x80000d40, 0x04000014,
-- 0x59b800e4, 0x8c000524, 0x04020011, 0x4a0370e4,
-- 0x00030000, 0x40000000, 0x59b800e4, 0x8c000524,
-- 0x04000004, 0x4a0370e4, 0x00020000, 0x0401f008,
-- 0x59940027, 0x80040480, 0x48026206, 0x4a0370e4,
-- 0x00020000, 0x0400101c, 0x0400001b, 0x83326400,
-- 0x00000024, 0x49332802, 0x41540000, 0x81300480,
-- 0x04021005, 0x803c7840, 0x040207db, 0x5c03e000,
-- 0x1c01f000, 0x59940026, 0x48032827, 0x4a032802,
-- 0x0010cfc0, 0x497b2826, 0x80000540, 0x0400000f,
-- 0x4a032800, 0x00000001, 0x5c03e000, 0x1c01f000,
-- 0x4c3c0000, 0x0201f800, 0x00108f92, 0x5c007800,
-- 0x0401f7d1, 0x4c3c0000, 0x0201f800, 0x00108b11,
-- 0x5c007800, 0x0401f7e2, 0x4a032800, 0x00000000,
-- 0x5c03e000, 0x1c01f000, 0x59a8086b, 0x8c040d30,
-- 0x04020029, 0x8c040d32, 0x0400000f, 0x59a80069,
-- 0x81640480, 0x04001019, 0x59a8000b, 0x81500580,
-- 0x04000005, 0x59a8006a, 0x59a81066, 0x80080580,
-- 0x04020012, 0x900411c0, 0x82081500, 0x00007000,
-- 0x0401f012, 0x82040500, 0x0000001f, 0x04000016,
-- 0x80040840, 0x82040500, 0x0000001f, 0x04000003,
-- 0x4807506b, 0x0401f010, 0x900401c0, 0x82000500,
-- 0x0000001f, 0x80040d40, 0x900401c0, 0x80040580,
-- 0x82001500, 0x00007000, 0x82040500, 0xffff8fff,
-- 0x80080540, 0x4803506b, 0x80081114, 0x0201f800,
-- 0x00100728, 0x1c01f000, 0x4a032807, 0x000007d0,
-- 0x4a032806, 0x0000000a, 0x1c01f000, 0x42000800,
-- 0x000007d0, 0x83180480, 0x00000005, 0x02021800,
-- 0x00100615, 0x83947c00, 0x00000009, 0x83180400,
-- 0x00105c7c, 0x50000000, 0x803c7c00, 0x48047801,
-- 0x4a007800, 0x0000000a, 0x1c01f000, 0x83180480,
-- 0x00000005, 0x02021800, 0x00100615, 0x83947c00,
-- 0x00000009, 0x83180400, 0x00105c7c, 0x50000000,
-- 0x803c7c00, 0x49787801, 0x1c01f000, 0x4807c857,
-- 0x480bc857, 0x59940025, 0x80040400, 0x02001800,
-- 0x00100615, 0x48032804, 0x480b2805, 0x4a032803,
-- 0x0000000a, 0x1c01f000, 0x4807c857, 0x480bc857,
-- 0x59940025, 0x80040400, 0x02001800, 0x00100615,
-- 0x4803281c, 0x480b281d, 0x4a03281b, 0x0000000a,
-- 0x1c01f000, 0x4c000000, 0x5994001d, 0x4803c857,
-- 0x480bc857, 0x80080580, 0x04020003, 0x4803281c,
-- 0x4803281d, 0x5c000000, 0x1c01f000, 0x4807c857,
-- 0x480bc857, 0x59940025, 0x80040400, 0x02001800,
-- 0x00100615, 0x48032822, 0x480b2823, 0x4a032821,
-- 0x0000000a, 0x1c01f000, 0x80e9d1c0, 0x0400000e,
-- 0x0401f832, 0x04025000, 0x4203e000, 0x80000000,
-- 0x40e81000, 0x41780800, 0x42000000, 0x00000064,
-- 0x0201f800, 0x001063ee, 0x59940024, 0x80080400,
-- 0x48032824, 0x1c01f000, 0x42001000, 0x00104d39,
-- 0x0401fee5, 0x42001000, 0x00104d2c, 0x0401ffd6,
-- 0x42001000, 0x00103f62, 0x0401fedf, 0x42001000,
-- 0x00103fe4, 0x0401fedc, 0x42001000, 0x00103f37,
-- 0x0401fed9, 0x42001000, 0x0010401b, 0x0401f6ea,
-- 0x4203e000, 0x70000000, 0x4203e000, 0xb0300000,
-- 0x40ebf800, 0x42000000, 0x0000003c, 0x04004004,
-+ 0x02001800, 0x001004ef, 0x48032804, 0x480b2805,
-+ 0x4a032803, 0x0000000a, 0x80000580, 0x1c01f000,
-+ 0x5994001f, 0x80000540, 0x0402000a, 0x59940025,
-+ 0x80040400, 0x02001800, 0x001004ef, 0x4803281f,
-+ 0x480b2820, 0x4a03281e, 0x00000001, 0x80000580,
-+ 0x1c01f000, 0x4c000000, 0x40680800, 0x406c1000,
-+ 0x0401f802, 0x5c000000, 0x59940022, 0x80000540,
-+ 0x0402000a, 0x59940025, 0x80040400, 0x02001800,
-+ 0x001004ef, 0x48032822, 0x480b2823, 0x4a032821,
-+ 0x0000000a, 0x80000580, 0x1c01f000, 0x4c000000,
-+ 0x59940005, 0x4803c857, 0x480bc857, 0x80080580,
-+ 0x04020003, 0x497b2804, 0x497b2805, 0x5c000000,
-+ 0x1c01f000, 0x4c000000, 0x59940020, 0x4803c857,
-+ 0x480bc857, 0x80080580, 0x04020003, 0x497b281f,
-+ 0x497b2820, 0x5c000000, 0x1c01f000, 0x4c000000,
-+ 0x59940023, 0x4803c857, 0x480bc857, 0x80080580,
-+ 0x04020003, 0x497b2822, 0x497b2823, 0x5c000000,
-+ 0x1c01f000, 0x4937c857, 0x48ebc857, 0x59340203,
-+ 0x80e80480, 0x04001002, 0x48ea6a03, 0x1c01f000,
-+ 0x5c03e000, 0x1c01f000, 0x4d440000, 0x42007800,
-+ 0x00000010, 0x59968801, 0x0201f800, 0x0002025a,
-+ 0x04020012, 0x59341a03, 0x800c1840, 0x0400100f,
-+ 0x59940027, 0x800c0480, 0x04000003, 0x48026a03,
-+ 0x0402100a, 0x5934000f, 0x497a6a03, 0x80000540,
-+ 0x04000006, 0x4c3c0000, 0x5934140b, 0x0201f800,
-+ 0x00020268, 0x5c007800, 0x81468800, 0x83440480,
-+ 0x00000800, 0x04021007, 0x803c7840, 0x040207e7,
-+ 0x49472801, 0x5c028800, 0x5c03e000, 0x1c01f000,
-+ 0x4a032800, 0x00000002, 0x497b2801, 0x0401f7fa,
-+ 0x42007800, 0x00000010, 0x59966002, 0x59300205,
-+ 0x80000d40, 0x04000006, 0x59940027, 0x80040480,
-+ 0x48026205, 0x0400102d, 0x0400002c, 0x59300206,
-+ 0x80000d40, 0x04000014, 0x59b800e4, 0x8c000524,
-+ 0x04020011, 0x4a0370e4, 0x00030000, 0x40000000,
-+ 0x59b800e4, 0x8c000524, 0x04000004, 0x4a0370e4,
-+ 0x00020000, 0x0401f008, 0x59940027, 0x80040480,
-+ 0x48026206, 0x4a0370e4, 0x00020000, 0x0400101c,
-+ 0x0400001b, 0x83326400, 0x00000024, 0x49332802,
-+ 0x41540000, 0x81300480, 0x04021005, 0x803c7840,
-+ 0x040207db, 0x5c03e000, 0x1c01f000, 0x59940026,
-+ 0x48032827, 0x4a032802, 0x0010d8d4, 0x497b2826,
-+ 0x80000540, 0x0400000f, 0x4a032800, 0x00000001,
-+ 0x5c03e000, 0x1c01f000, 0x4c3c0000, 0x0201f800,
-+ 0x001089fa, 0x5c007800, 0x0401f7d1, 0x4c3c0000,
-+ 0x0201f800, 0x0010855e, 0x5c007800, 0x0401f7e2,
-+ 0x4a032800, 0x00000000, 0x5c03e000, 0x1c01f000,
-+ 0x59a80868, 0x8c040d30, 0x04020029, 0x8c040d32,
-+ 0x0400000f, 0x59a80066, 0x81640480, 0x04001019,
-+ 0x59a8000a, 0x81500580, 0x04000005, 0x59a80067,
-+ 0x59a81063, 0x80080580, 0x04020012, 0x900411c0,
-+ 0x82081500, 0x00007000, 0x0401f012, 0x82040500,
-+ 0x0000001f, 0x04000016, 0x80040840, 0x82040500,
-+ 0x0000001f, 0x04000003, 0x48075068, 0x0401f010,
-+ 0x900401c0, 0x82000500, 0x0000001f, 0x80040d40,
-+ 0x900401c0, 0x80040580, 0x82001500, 0x00007000,
-+ 0x82040500, 0xffff8fff, 0x80080540, 0x48035068,
-+ 0x80081114, 0x0201f800, 0x0010060a, 0x1c01f000,
-+ 0x4a032807, 0x000007d0, 0x4a032806, 0x0000000a,
-+ 0x1c01f000, 0x42000800, 0x000007d0, 0x83180480,
-+ 0x00000005, 0x02021800, 0x001004ef, 0x83947c00,
-+ 0x00000009, 0x83180400, 0x00105b1d, 0x50000000,
-+ 0x803c7c00, 0x48047801, 0x4a007800, 0x0000000a,
-+ 0x1c01f000, 0x83180480, 0x00000005, 0x02021800,
-+ 0x001004ef, 0x83947c00, 0x00000009, 0x83180400,
-+ 0x00105b1d, 0x50000000, 0x803c7c00, 0x49787801,
-+ 0x1c01f000, 0x4807c857, 0x480bc857, 0x59940025,
-+ 0x80040400, 0x02001800, 0x001004ef, 0x48032804,
-+ 0x480b2805, 0x4a032803, 0x0000000a, 0x1c01f000,
-+ 0x4807c857, 0x480bc857, 0x59940025, 0x80040400,
-+ 0x02001800, 0x001004ef, 0x4803281c, 0x480b281d,
-+ 0x4a03281b, 0x0000000a, 0x1c01f000, 0x4c000000,
-+ 0x5994001d, 0x4803c857, 0x480bc857, 0x80080580,
-+ 0x04020003, 0x4803281c, 0x4803281d, 0x5c000000,
-+ 0x1c01f000, 0x4807c857, 0x480bc857, 0x59940025,
-+ 0x80040400, 0x02001800, 0x001004ef, 0x48032822,
-+ 0x480b2823, 0x4a032821, 0x0000000a, 0x1c01f000,
-+ 0x80e9d1c0, 0x0400000e, 0x0401f836, 0x04025000,
-+ 0x4203e000, 0x80000000, 0x40e81000, 0x41780800,
-+ 0x42000000, 0x00000064, 0x0201f800, 0x001062b7,
-+ 0x59940024, 0x80080400, 0x48032824, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x42001000, 0x00104bd9, 0x0401fee1, 0x42001000,
-+ 0x00104bc8, 0x0401ffd2, 0x42001000, 0x00103df2,
-+ 0x0401fedb, 0x42001000, 0x00103e74, 0x0401fed8,
-+ 0x42001000, 0x00103dcb, 0x0401fed5, 0x42001000,
-+ 0x00103eab, 0x0401f6e6, 0x4203e000, 0x70000000,
-+ 0x4203e000, 0xb0300000, 0x40ebf800, 0x42000000,
-+ 0x0000003c, 0x04004004, 0x80000040, 0x040207fe,
-+ 0x0401f007, 0x4203e000, 0x70000000, 0x42000000,
-+ 0x0010b04d, 0x0201f800, 0x0010a260, 0x1c01f000,
-+ 0x4203e000, 0x80000000, 0x4203e000, 0xb0400000,
-+ 0x40ebf800, 0x42000000, 0x0000003c, 0x04005004,
- 0x80000040, 0x040207fe, 0x0401f007, 0x4203e000,
-- 0x70000000, 0x42000000, 0x0010b67d, 0x0201f800,
-- 0x0010a86e, 0x1c01f000, 0x4203e000, 0x80000000,
-- 0x4203e000, 0xb0400000, 0x40ebf800, 0x42000000,
-- 0x0000003c, 0x04005004, 0x80000040, 0x040207fe,
-- 0x0401f007, 0x4203e000, 0x80000000, 0x42000000,
-- 0x0010b67e, 0x0201f800, 0x0010a86e, 0x1c01f000,
-- 0x59a8000e, 0x82000480, 0x00000100, 0x599c0a02,
-- 0x800409c0, 0x04020002, 0x80040800, 0x80041480,
-- 0x04001002, 0x40000800, 0x48075067, 0x59a8100e,
-- 0x40040000, 0x800acc80, 0x4967500e, 0x49675069,
-- 0x59aaa80b, 0x41640800, 0x42001000, 0x00000024,
-- 0x0201f800, 0x001063cf, 0x8206a400, 0x0010cfc0,
-- 0x49535065, 0x4152b000, 0x42006000, 0x0010bc64,
-- 0x4a006004, 0x0000012c, 0x4a006005, 0xda10da10,
-- 0x4a006008, 0x00000011, 0x4a006009, 0x0010bc64,
-- 0x4a00600a, 0x00101108, 0x599c0014, 0x48006011,
-- 0x599c0015, 0x48006012, 0x42006000, 0x0010bc40,
-- 0x4a006203, 0x00000008, 0x4a006406, 0x00000006,
-- 0x4a006002, 0xffff0000, 0x4a006008, 0x0010bc64,
-- 0x4a006014, 0x0010bc64, 0x599c0014, 0x48006015,
-- 0x599c0015, 0x48006016, 0x599c0413, 0x48006017,
-- 0x49506018, 0x49546019, 0x59a80067, 0x4800601a,
-- 0x4a00601b, 0x0010b265, 0x4a00601c, 0x0010b266,
-- 0x4a00601d, 0x0010b26a, 0x42000000, 0xb0000000,
-- 0x42000800, 0x0010bc40, 0x0201f800, 0x00100bb2,
-- 0x1c01f000, 0x82000d00, 0x000000c0, 0x04000004,
-- 0x82040d80, 0x000000c0, 0x04020055, 0x82000d00,
-- 0x00002020, 0x59300414, 0x84000512, 0x82040d80,
-- 0x00002020, 0x0400000b, 0x8c000514, 0x0402000f,
-- 0x48026414, 0x813e79c0, 0x02020000, 0x00020804,
-- 0x42027000, 0x00000043, 0x0201f000, 0x000208d8,
-- 0x59326809, 0x59340a00, 0x8c040d0a, 0x040007f3,
-- 0x84000552, 0x0401f7f1, 0x84000514, 0x592c080d,
-- 0x48066015, 0x0401f7ef, 0x59326809, 0x59340a00,
-- 0x8c040d0a, 0x02000000, 0x00020817, 0x59300c14,
-- 0x84040d52, 0x48066414, 0x0201f000, 0x00020817,
-- 0x0201f800, 0x00020087, 0x813e79c0, 0x02020000,
-- 0x00020804, 0x0201f000, 0x00020825, 0x8c00051e,
-- 0x02000000, 0x00020831, 0x82000d00, 0x00002020,
-- 0x82040d80, 0x00002020, 0x04000014, 0x82000500,
-- 0x000000c0, 0x82000d80, 0x00000080, 0x04000008,
-- 0x813e79c0, 0x02020000, 0x00020804, 0x42027000,
-- 0x00000041, 0x0201f000, 0x000208d8, 0x813e79c0,
-- 0x02020000, 0x00020804, 0x42027000, 0x00000043,
-- 0x0201f000, 0x000208d8, 0x59326809, 0x59340a00,
-- 0x8c040d0a, 0x040007ea, 0x59300c14, 0x84040d52,
-- 0x48066414, 0x0401f7e6, 0x492fc857, 0x42000800,
-- 0x00000006, 0x0201f000, 0x0002082c, 0x492fc857,
-- 0x42000800, 0x00000004, 0x0201f000, 0x0002082c,
-- 0x4807c856, 0x59a80068, 0x800409c0, 0x04000003,
-- 0x80080540, 0x0401f002, 0x80080500, 0x48035068,
-- 0x1c01f000, 0x4a030800, 0x00000000, 0x4a030802,
-- 0x00000001, 0x497b0803, 0x497b0804, 0x1c01f000,
-- 0x59840002, 0x8c000500, 0x04000004, 0x84000500,
-- 0x4a030800, 0x00000001, 0x84000544, 0x84000506,
-- 0x48030802, 0x82000d00, 0x0fffffff, 0x42000000,
-- 0x90000000, 0x0201f800, 0x00100bde, 0x59a80069,
-- 0x82000480, 0x00000007, 0x48035069, 0x80000580,
-- 0x42000800, 0x0010b315, 0x48000800, 0x48000801,
-- 0x1c01f000, 0x59a80069, 0x82000400, 0x00000007,
-- 0x48035069, 0x1c01f000, 0x83640480, 0x00000008,
-- 0x0400101b, 0x58c80a03, 0x80000580, 0x82000400,
-- 0x00000008, 0x80040840, 0x040207fd, 0x815c0480,
-- 0x04001013, 0x4200b000, 0x00000007, 0x0201f800,
-- 0x00020892, 0x4a026203, 0x00000004, 0x4a026406,
-- 0x00000009, 0x4a026203, 0x00000004, 0x4a026007,
-- 0x00000101, 0x0401f809, 0x0401f880, 0x8058b040,
-- 0x040207f3, 0x80000580, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x0401f7fd, 0x0201f800, 0x0010082a,
-- 0x492e6008, 0x58c80a03, 0x4a025a04, 0x0000002c,
-- 0x497a5800, 0x497a5801, 0x497a5c04, 0x497a5c06,
-- 0x497a5805, 0x4a025a08, 0x00000005, 0x4a025a07,
-- 0x00000002, 0x58c80201, 0x48025c04, 0x58c80202,
-- 0x48025c07, 0x58c80204, 0x48025c08, 0x4a02580d,
-- 0x0000ffff, 0x80040840, 0x0400000c, 0x412c2000,
-- 0x0201f800, 0x0010082a, 0x4a025a04, 0x0000000a,
-- 0x497a5c04, 0x48125800, 0x492c2001, 0x412c2000,
-- 0x80040840, 0x040207f7, 0x1c01f000, 0x4d7c0000,
-- 0x4202f800, 0x00000010, 0x4df00000, 0x4203e000,
-- 0x50000000, 0x59847803, 0x803c79c0, 0x0400001e,
-- 0x4c5c0000, 0x583cb808, 0x585c3408, 0x801831c0,
-- 0x0400000b, 0x0401f84a, 0x04000016, 0x42001000,
-- 0x0010b315, 0x0401f87f, 0x04000012, 0x0201f800,
-- 0x00100819, 0x0400000f, 0x492cb805, 0x585c0005,
-- 0x80000540, 0x02000800, 0x00100615, 0x0401f830,
-- 0x585c5408, 0x0401f80b, 0x5c00b800, 0x5c03e000,
-- 0x817ef840, 0x040207e1, 0x5c02f800, 0x1c01f000,
-- 0x5c00b800, 0x5c03e000, 0x5c02f800, 0x1c01f000,
-- 0x4803c856, 0x405c6000, 0x802851c0, 0x04000018,
-- 0x585c0204, 0x82000d00, 0x0000000f, 0x82040c00,
-- 0x0010110d, 0x50044000, 0x4c600000, 0x4c640000,
-- 0x4d040000, 0x4020c000, 0x40320800, 0x5984c804,
-- 0x4c280000, 0x0401f934, 0x5c005000, 0x40604000,
-- 0x41046000, 0x0201f800, 0x001010eb, 0x040207f6,
-- 0x5c020800, 0x5c00c800, 0x5c00c000, 0x58c80204,
-- 0x4800bc08, 0x0201f800, 0x00020087, 0x4a026007,
-- 0x00000101, 0x497a6009, 0x0401f055, 0x4803c856,
-- 0x59840003, 0x80026540, 0x04000003, 0x59300000,
-- 0x48030803, 0x1c01f000, 0x4803c856, 0x59840003,
-- 0x48026000, 0x49330803, 0x1c01f000, 0x58cc0805,
-- 0x40180000, 0x80040480, 0x0400100d, 0x82cc0580,
-- 0x0010b30a, 0x02020800, 0x00100615, 0x58c80205,
-- 0x80040480, 0x0400101d, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x80003580, 0x0401f7fe, 0x82cc0580,
-- 0x0010b30a, 0x02020800, 0x00100615, 0x58c80400,
-- 0x8c000504, 0x040007f8, 0x58c8040b, 0x8c00051e,
-- 0x040007f5, 0x8c000500, 0x040207f3, 0x84000540,
-- 0x4801940b, 0x42000000, 0x0010b637, 0x0201f800,
-- 0x0010a86e, 0x42001000, 0x00008026, 0x0201f800,
-- 0x00103857, 0x0401f7e8, 0x58c8040b, 0x8c00051e,
-- 0x040007e2, 0x8c000502, 0x040207e0, 0x84000542,
-- 0x4801940b, 0x42000000, 0x0010b636, 0x0201f800,
-- 0x0010a86e, 0x42001000, 0x00008025, 0x42001800,
-- 0x00000000, 0x0201f800, 0x00103857, 0x0401f7d3,
-- 0x4803c856, 0x58080000, 0x42001800, 0x00000007,
-- 0x58080801, 0x80040480, 0x04020004, 0x400c0000,
-- 0x80000540, 0x0401f005, 0x04001003, 0x800c0480,
-- 0x0401f002, 0x80000080, 0x1c01f000, 0x4803c856,
-- 0x59300008, 0x80000d40, 0x02000800, 0x00100615,
-- 0x58040005, 0x80000540, 0x02000800, 0x00100615,
-- 0x59300007, 0x82000500, 0x00000101, 0x82000580,
-- 0x00000101, 0x02020800, 0x00100615, 0x42001000,
-- 0x0010b315, 0x58080801, 0x82040400, 0x0010b317,
-- 0x497a6414, 0x4a026015, 0x0000ffff, 0x45300000,
-- 0x80040800, 0x82040480, 0x00000008, 0x04001002,
-- 0x80000d80, 0x48041001, 0x82040400, 0x0010b317,
-- 0x45780000, 0x1c01f000, 0x4933c857, 0x59300808,
-- 0x800409c0, 0x02000800, 0x00100615, 0x4d2c0000,
-- 0x58065805, 0x812e59c0, 0x02020800, 0x0010083a,
-- 0x49780805, 0x40065800, 0x0201f800, 0x00100843,
-- 0x5c025800, 0x4d300000, 0x0201f800, 0x000208b4,
-- 0x5c026000, 0x1c01f000, 0x59300406, 0x82000580,
-- 0x00000009, 0x04020006, 0x59300007, 0x8c000510,
-- 0x04000003, 0x80000580, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x1c01f000, 0x59840802, 0x8c040d04,
-- 0x1c01f000, 0x4803c856, 0x59840802, 0x84040d04,
-- 0x84040d40, 0x4a030800, 0x00000000, 0x48070802,
-- 0x82040d00, 0x0fffffff, 0x42000000, 0x90000000,
-- 0x0201f000, 0x00100bde, 0x4807c857, 0x4805980a,
-- 0x49799801, 0x49799803, 0x49799806, 0x49799807,
-- 0x49799808, 0x49799805, 0x49799809, 0x0401f8c8,
-- 0x0400000a, 0x0401f8ea, 0x04000008, 0x48359800,
-- 0x48359802, 0x48359806, 0x4a019804, 0x00000001,
-- 0x4a019807, 0x00000005, 0x1c01f000, 0x4807c857,
-- 0x58cc1007, 0x40040000, 0x80080480, 0x04021020,
-- 0x4c040000, 0x4c080000, 0x0401f8d9, 0x5c001000,
-- 0x5c000800, 0x0400001c, 0x58cc0006, 0x80006540,
-- 0x0402000b, 0x48359800, 0x48359802, 0x48359806,
-- 0x49799801, 0x49799803, 0x49786801, 0x49786800,
-- 0x49799804, 0x49799807, 0x0401f005, 0x48306801,
-- 0x48346000, 0x48359806, 0x49786800, 0x58cc0004,
-- 0x58cc1007, 0x80000000, 0x82081400, 0x00000005,
-- 0x48019804, 0x48099807, 0x0401f7df, 0x80000580,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x480bc857, 0x4c500000, 0x4c540000, 0x4c580000,
-- 0x40083000, 0x58cc0801, 0x82040480, 0x00000005,
-- 0x02021800, 0x00100615, 0x82040400, 0x00106150,
-- 0x50000000, 0x58cca800, 0x8054ac00, 0x42001800,
-- 0x00000005, 0x40040000, 0x800c0480, 0x80082480,
-- 0x04021002, 0x40080000, 0x8000b0c2, 0x8058b400,
-- 0x5450a800, 0x8050a000, 0x8054a800, 0x8058b040,
-- 0x040207fc, 0x40001000, 0x58cc2805, 0x58cc0807,
-- 0x58cc2001, 0x80142c00, 0x80040c80, 0x80102400,
-- 0x48159805, 0x48059807, 0x48119801, 0x82100580,
-- 0x00000005, 0x0400000c, 0x48119801, 0x40080000,
-- 0x80181480, 0x40083000, 0x04000003, 0x040217d6,
-- 0x80000580, 0x5c00b000, 0x5c00a800, 0x5c00a000,
-- 0x1c01f000, 0x58cc0800, 0x800409c0, 0x02000800,
-- 0x00100615, 0x58040800, 0x48059800, 0x41782000,
-- 0x0401f7ee, 0x0401f812, 0x50600000, 0x81041c00,
-- 0x585c0204, 0x4803c857, 0x82000580, 0x0000002c,
-- 0x02020800, 0x00100615, 0x58040202, 0x800000e0,
-- 0x80640540, 0x48001802, 0x58040000, 0x48001800,
-- 0x58040001, 0x48001801, 0x1c01f000, 0x4807c856,
-- 0x58cc0005, 0x80000040, 0x02001800, 0x00100615,
-- 0x48019805, 0x58cc1003, 0x82080480, 0x00000005,
-- 0x02021800, 0x00100615, 0x82080400, 0x00106150,
-- 0x50000000, 0x58cc0802, 0x80040c00, 0x80081000,
-- 0x82080480, 0x00000005, 0x0402000f, 0x58cc2002,
-- 0x58100000, 0x80006d40, 0x04000009, 0x4c340000,
-- 0x0401f858, 0x5c006800, 0x49786801, 0x48359802,
-- 0x58cc0004, 0x80000040, 0x48019804, 0x49799803,
-- 0x0401f002, 0x48099803, 0x1c01f000, 0x4807c856,
-- 0x41781800, 0x58c80201, 0x80000540, 0x04000002,
-- 0x800c1800, 0x58c80c01, 0x80040c80, 0x0400100a,
-- 0x04000009, 0x800c1800, 0x58c80202, 0x80041480,
-- 0x04001005, 0x04000004, 0x800c1800, 0x40080800,
-- 0x0401f7fb, 0x480d9204, 0x400c0000, 0x42002000,
-- 0x00000001, 0x80000040, 0x04000007, 0x04001006,
-- 0x80102000, 0x82000480, 0x00000005, 0x04000002,
-- 0x040217fc, 0x48119203, 0x1c01f000, 0x4807c856,
-- 0x4d2c0000, 0x58cc000a, 0x80000540, 0x02000800,
-- 0x00100615, 0x82002400, 0x00000005, 0x0201f800,
-- 0x00100819, 0x04000012, 0x492d9809, 0x497a5800,
-- 0x497a5801, 0x0201f800, 0x00100819, 0x0400000c,
-- 0x58cc0009, 0x48025800, 0x497a5801, 0x492d9809,
-- 0x82102480, 0x00000005, 0x040217f7, 0x82000540,
-- 0x00000001, 0x5c025800, 0x1c01f000, 0x58cc0009,
-- 0x80025d40, 0x040007fc, 0x592c2000, 0x0201f800,
-- 0x0010083a, 0x40100000, 0x0401f7fa, 0x58cc0009,
-- 0x48cfc857, 0x80006d40, 0x04000005, 0x50340000,
-- 0x48019809, 0x49786800, 0x49786801, 0x1c01f000,
-- 0x4813c857, 0x58cc0009, 0x48002000, 0x48119809,
-- 0x1c01f000, 0x4807c856, 0x4d2c0000, 0x58cc0009,
-- 0x80025d40, 0x04000007, 0x592c0000, 0x4c000000,
-- 0x0201f800, 0x0010083a, 0x5c000000, 0x0401f7f9,
-- 0x5c025800, 0x1c01f000, 0x4807c856, 0x4d2c0000,
-- 0x58cc0002, 0x80025d40, 0x04000007, 0x592c0000,
-- 0x4c000000, 0x0201f800, 0x0010083a, 0x5c000000,
-- 0x0401f7f9, 0x49799800, 0x49799802, 0x49799801,
-+ 0x80000000, 0x42000000, 0x0010b04e, 0x0201f800,
-+ 0x0010a260, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x59a8000d, 0x82000480,
-+ 0x00000100, 0x599c0a02, 0x800409c0, 0x04020002,
-+ 0x80040800, 0x80041480, 0x04001002, 0x40000800,
-+ 0x48075064, 0x59a8100d, 0x40040000, 0x800acc80,
-+ 0x4967500d, 0x49675066, 0x59aaa80a, 0x41640800,
-+ 0x42001000, 0x00000024, 0x0201f800, 0x00106298,
-+ 0x8206a400, 0x0010d8d4, 0x49535062, 0x4152b000,
-+ 0x42006000, 0x0010b634, 0x4a006004, 0x0000012c,
-+ 0x4a006005, 0xda10da10, 0x4a006008, 0x00000011,
-+ 0x4a006009, 0x0010b634, 0x4a00600a, 0x00100fd3,
-+ 0x599c0014, 0x48006011, 0x599c0015, 0x48006012,
-+ 0x42006000, 0x0010b610, 0x4a006203, 0x00000008,
-+ 0x4a006406, 0x00000006, 0x4a006002, 0xffff0000,
-+ 0x4a006008, 0x0010b634, 0x4a006014, 0x0010b634,
-+ 0x599c0014, 0x48006015, 0x599c0015, 0x48006016,
-+ 0x599c0413, 0x48006017, 0x49506018, 0x49546019,
-+ 0x59a80064, 0x4800601a, 0x4a00601b, 0x0010ac62,
-+ 0x4a00601c, 0x0010ac63, 0x4a00601d, 0x0010ac67,
-+ 0x42000000, 0xb0000000, 0x42000800, 0x0010b610,
-+ 0x0201f800, 0x00100aa9, 0x1c01f000, 0x82000d00,
-+ 0x000000c0, 0x04000004, 0x82040d80, 0x000000c0,
-+ 0x04020055, 0x82000d00, 0x00002020, 0x59300414,
-+ 0x84000512, 0x82040d80, 0x00002020, 0x0400000b,
-+ 0x8c000514, 0x0402000f, 0x48026414, 0x813e79c0,
-+ 0x02020000, 0x0002070b, 0x42027000, 0x00000043,
-+ 0x0201f000, 0x000207df, 0x59326809, 0x59340a00,
-+ 0x8c040d0a, 0x040007f3, 0x84000552, 0x0401f7f1,
-+ 0x84000514, 0x592c080d, 0x48066015, 0x0401f7ef,
-+ 0x59326809, 0x59340a00, 0x8c040d0a, 0x02000000,
-+ 0x0002071e, 0x59300c14, 0x84040d52, 0x48066414,
-+ 0x0201f000, 0x0002071e, 0x0201f800, 0x0002007b,
-+ 0x813e79c0, 0x02020000, 0x0002070b, 0x0201f000,
-+ 0x0002072c, 0x8c00051e, 0x02000000, 0x00020738,
-+ 0x82000d00, 0x00002020, 0x82040d80, 0x00002020,
-+ 0x04000014, 0x82000500, 0x000000c0, 0x82000d80,
-+ 0x00000080, 0x04000008, 0x813e79c0, 0x02020000,
-+ 0x0002070b, 0x42027000, 0x00000041, 0x0201f000,
-+ 0x000207df, 0x813e79c0, 0x02020000, 0x0002070b,
-+ 0x42027000, 0x00000043, 0x0201f000, 0x000207df,
-+ 0x59326809, 0x59340a00, 0x8c040d0a, 0x040007ea,
-+ 0x59300c14, 0x84040d52, 0x48066414, 0x0401f7e6,
-+ 0x492fc857, 0x42000800, 0x00000006, 0x0201f000,
-+ 0x00020733, 0x492fc857, 0x42000800, 0x00000004,
-+ 0x0201f000, 0x00020733, 0x4807c856, 0x59a80065,
-+ 0x800409c0, 0x04000003, 0x80080540, 0x0401f002,
-+ 0x80080500, 0x48035065, 0x1c01f000, 0x4a030800,
-+ 0x00000000, 0x4a030802, 0x00000001, 0x497b0803,
-+ 0x497b0804, 0x1c01f000, 0x59840002, 0x8c000500,
-+ 0x04000004, 0x84000500, 0x4a030800, 0x00000001,
-+ 0x84000544, 0x84000506, 0x48030802, 0x82000d00,
-+ 0x0fffffff, 0x42000000, 0x90000000, 0x0201f800,
-+ 0x00100ad5, 0x59a80066, 0x82000480, 0x00000007,
-+ 0x48035066, 0x80000580, 0x42000800, 0x0010ace6,
-+ 0x48000800, 0x48000801, 0x1c01f000, 0x59a80066,
-+ 0x82000400, 0x00000007, 0x48035066, 0x1c01f000,
-+ 0x83640480, 0x00000008, 0x0400101b, 0x58c80a03,
-+ 0x80000580, 0x82000400, 0x00000008, 0x80040840,
-+ 0x040207fd, 0x815c0480, 0x04001013, 0x4200b000,
-+ 0x00000007, 0x0201f800, 0x00020799, 0x4a026203,
-+ 0x00000004, 0x4a026406, 0x00000009, 0x4a026203,
-+ 0x00000004, 0x4a026007, 0x00000101, 0x0401f809,
-+ 0x0401f880, 0x8058b040, 0x040207f3, 0x80000580,
-+ 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fd,
-+ 0x0201f800, 0x0010071a, 0x492e6008, 0x58c80a03,
-+ 0x4a025a04, 0x0000002c, 0x497a5800, 0x497a5801,
-+ 0x497a5c04, 0x497a5c06, 0x497a5805, 0x4a025a08,
-+ 0x00000005, 0x4a025a07, 0x00000002, 0x58c80201,
-+ 0x48025c04, 0x58c80202, 0x48025c07, 0x58c80204,
-+ 0x48025c08, 0x4a02580d, 0x0000ffff, 0x80040840,
-+ 0x0400000c, 0x412c2000, 0x0201f800, 0x0010071a,
-+ 0x4a025a04, 0x0000000a, 0x497a5c04, 0x48125800,
-+ 0x492c2001, 0x412c2000, 0x80040840, 0x040207f7,
-+ 0x1c01f000, 0x4d7c0000, 0x4202f800, 0x00000010,
-+ 0x4df00000, 0x4203e000, 0x50000000, 0x59847803,
-+ 0x803c79c0, 0x0400001e, 0x4c5c0000, 0x583cb808,
-+ 0x585c3408, 0x801831c0, 0x0400000b, 0x0401f84a,
-+ 0x04000016, 0x42001000, 0x0010ace6, 0x0401f87f,
-+ 0x04000012, 0x0201f800, 0x00100704, 0x0400000f,
-+ 0x492cb805, 0x585c0005, 0x80000540, 0x02000800,
-+ 0x001004ef, 0x0401f830, 0x585c5408, 0x0401f80b,
-+ 0x5c00b800, 0x5c03e000, 0x817ef840, 0x040207e1,
-+ 0x5c02f800, 0x1c01f000, 0x5c00b800, 0x5c03e000,
-+ 0x5c02f800, 0x1c01f000, 0x4803c856, 0x405c6000,
-+ 0x802851c0, 0x04000018, 0x585c0204, 0x82000d00,
-+ 0x0000000f, 0x82040c00, 0x00100fd8, 0x50044000,
-+ 0x4c600000, 0x4c640000, 0x4d040000, 0x4020c000,
-+ 0x40320800, 0x5984c804, 0x4c280000, 0x0401f93d,
-+ 0x5c005000, 0x40604000, 0x41046000, 0x0201f800,
-+ 0x00100fb6, 0x040207f6, 0x5c020800, 0x5c00c800,
-+ 0x5c00c000, 0x58c80204, 0x4800bc08, 0x0201f800,
-+ 0x0002007b, 0x4a026007, 0x00000101, 0x497a6009,
-+ 0x0401f055, 0x4803c856, 0x59840003, 0x80026540,
-+ 0x04000003, 0x59300000, 0x48030803, 0x1c01f000,
-+ 0x4803c856, 0x59840003, 0x48026000, 0x49330803,
-+ 0x1c01f000, 0x58cc0805, 0x40180000, 0x80040480,
-+ 0x0400100d, 0x82cc0580, 0x0010acdb, 0x02020800,
-+ 0x001004ef, 0x58c80205, 0x80040480, 0x0400101d,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x80003580,
-+ 0x0401f7fe, 0x82cc0580, 0x0010acdb, 0x02020800,
-+ 0x001004ef, 0x58c80400, 0x8c000504, 0x040007f8,
-+ 0x58c8040b, 0x8c00051e, 0x040007f5, 0x8c000500,
-+ 0x040207f3, 0x84000540, 0x4801940b, 0x42000000,
-+ 0x0010b007, 0x0201f800, 0x0010a260, 0x42001000,
-+ 0x00008026, 0x0201f800, 0x001036f4, 0x0401f7e8,
-+ 0x58c8040b, 0x8c00051e, 0x040007e2, 0x8c000502,
-+ 0x040207e0, 0x84000542, 0x4801940b, 0x42000000,
-+ 0x0010b006, 0x0201f800, 0x0010a260, 0x42001000,
-+ 0x00008025, 0x42001800, 0x00000000, 0x0201f800,
-+ 0x001036f4, 0x0401f7d3, 0x4803c856, 0x58080000,
-+ 0x42001800, 0x00000007, 0x58080801, 0x80040480,
-+ 0x04020004, 0x400c0000, 0x80000540, 0x0401f005,
-+ 0x04001003, 0x800c0480, 0x0401f002, 0x80000080,
-+ 0x1c01f000, 0x4803c856, 0x59300008, 0x80000d40,
-+ 0x02000800, 0x001004ef, 0x58040005, 0x80000540,
-+ 0x02000800, 0x001004ef, 0x59300007, 0x82000500,
-+ 0x00000101, 0x82000580, 0x00000101, 0x02020800,
-+ 0x001004ef, 0x42001000, 0x0010ace6, 0x58080801,
-+ 0x82040400, 0x0010ace8, 0x497a6414, 0x4a026015,
-+ 0x0000ffff, 0x45300000, 0x80040800, 0x82040480,
-+ 0x00000008, 0x04001002, 0x80000d80, 0x48041001,
-+ 0x82040400, 0x0010ace8, 0x45780000, 0x1c01f000,
-+ 0x4933c857, 0x59300808, 0x800409c0, 0x02000800,
-+ 0x001004ef, 0x4d2c0000, 0x58065805, 0x812e59c0,
-+ 0x02020800, 0x0010072e, 0x49780805, 0x40065800,
-+ 0x0201f800, 0x0010073b, 0x5c025800, 0x4d300000,
-+ 0x0201f800, 0x000207bb, 0x5c026000, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x59300406, 0x82000580, 0x00000009,
-+ 0x04020006, 0x59300007, 0x8c000510, 0x04000003,
-+ 0x80000580, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x59840802, 0x8c040d04, 0x1c01f000,
-+ 0x4803c856, 0x59840802, 0x84040d04, 0x84040d40,
-+ 0x4a030800, 0x00000000, 0x48070802, 0x82040d00,
-+ 0x0fffffff, 0x42000000, 0x90000000, 0x0201f000,
-+ 0x00100ad5, 0x4807c857, 0x4805980a, 0x49799801,
- 0x49799803, 0x49799806, 0x49799807, 0x49799808,
-- 0x49799809, 0x4979980a, 0x5c025800, 0x1c01f000,
-- 0x00000003, 0x00000006, 0x00000009, 0x0000000c,
-- 0x0000000f, 0x00000012, 0x4803c856, 0x0401f857,
-- 0x4a00c204, 0x0000003c, 0x59301009, 0x82080580,
-- 0x0010b320, 0x04000013, 0x58080802, 0x82040d00,
-- 0x00ffffff, 0x58080403, 0x4804c005, 0x4800c406,
-- 0x4a00c207, 0x00000003, 0x59300811, 0x585c0404,
-- 0x4978c206, 0x4804c407, 0x80000540, 0x0400000d,
-- 0x58600206, 0x84000540, 0x4800c206, 0x0401f009,
-- 0x585c080a, 0x82040d00, 0x00ffffff, 0x4804c005,
-- 0x4a00c406, 0x000007ff, 0x4978c207, 0x0401f7ef,
-- 0x82603c00, 0x00000008, 0x58605404, 0x40282000,
-- 0x405c6000, 0x585c0a04, 0x82040d00, 0x0000000f,
-- 0x82040c00, 0x0010110d, 0x50044000, 0x80004d80,
-- 0x50200000, 0x80307400, 0x58380402, 0x8c244d00,
-- 0x04020003, 0x48003a00, 0x0401f003, 0x48003c00,
-- 0x801c3800, 0x80244800, 0x80102040, 0x04000006,
-- 0x0201f800, 0x001010eb, 0x02000800, 0x00100615,
-- 0x0401f7f0, 0x1c01f000, 0x4803c856, 0x4d340000,
-- 0x59300009, 0x80026d40, 0x02000800, 0x00100615,
-- 0x59340401, 0x80000540, 0x0400000e, 0x59840000,
-- 0x80000540, 0x0400000b, 0x836c0580, 0x00000003,
-- 0x04020008, 0x59341c03, 0x42002000, 0x00000004,
-- 0x42003000, 0x00000004, 0x0201f800, 0x001038c7,
-- 0x5c026800, 0x1c01f000, 0x4803c856, 0x80001580,
-- 0x58c80c01, 0x59300011, 0x80040c80, 0x48066011,
-- 0x58c80201, 0x80000540, 0x04000005, 0x80081000,
-- 0x80040c80, 0x04001007, 0x04000006, 0x58c80202,
-- 0x80081000, 0x80040c80, 0x04001002, 0x040207fd,
-- 0x4808bc08, 0x4808c404, 0x1c01f000, 0x4803c856,
-- 0x4a0370e5, 0x00020000, 0x59b800e5, 0x8c000524,
-- 0x040207fc, 0x4a0370e5, 0x00030000, 0x40000000,
-- 0x40000000, 0x59b800e5, 0x8c000524, 0x040207f5,
-- 0x5934000e, 0x80006d40, 0x04000010, 0x81300580,
-- 0x04020004, 0x58340000, 0x4802680e, 0x0401f00a,
-- 0x40347800, 0x58340000, 0x80006d40, 0x02000800,
-- 0x00100615, 0x81300580, 0x040207fa, 0x58340000,
-- 0x48007800, 0x497a6000, 0x4a0370e5, 0x00020000,
-- 0x1c01f000, 0x4803c856, 0x4d300000, 0x4d2c0000,
-- 0x42000800, 0x000003ff, 0x4a0370e5, 0x00020000,
-- 0x59b800e5, 0x8c000524, 0x04000005, 0x80040840,
-- 0x040207fa, 0x0201f800, 0x00100615, 0x4a0370e5,
-- 0x00030000, 0x40000000, 0x40000000, 0x59b800e5,
-- 0x8c000524, 0x040207f1, 0x5934000e, 0x80026540,
-- 0x0400000e, 0x4933c857, 0x59300000, 0x4802680e,
-- 0x4a026203, 0x00000004, 0x497a6206, 0x497a6009,
-- 0x4a026007, 0x00000101, 0x59325808, 0x497a5c08,
-- 0x0401fd82, 0x0401f7f1, 0x4a0370e5, 0x00020000,
-- 0x5c025800, 0x5c026000, 0x1c01f000, 0x4803c856,
-- 0x4c000000, 0x0201f800, 0x001059b9, 0x04020011,
-- 0x0201f800, 0x001043fc, 0x02020800, 0x00100615,
-- 0x5c000000, 0x48026802, 0x0201f800, 0x00020892,
-- 0x04000009, 0x49366009, 0x4a026406, 0x00000001,
-- 0x42027000, 0x00000001, 0x0201f000, 0x000208d8,
-- 0x5c000000, 0x1c01f000, 0x59300203, 0x82000c80,
-- 0x0000000e, 0x02021800, 0x00100615, 0x4803c857,
-- 0x0c01f001, 0x0010623b, 0x0010623b, 0x0010623b,
-- 0x0010623d, 0x0010629d, 0x0010623b, 0x0010623b,
-- 0x001062ef, 0x001062f0, 0x0010623b, 0x0010623b,
-- 0x0010623b, 0x0010623b, 0x0010623b, 0x0201f800,
-- 0x00100615, 0x493bc857, 0x83380480, 0x00000050,
-- 0x02021800, 0x00100615, 0x83380480, 0x00000049,
-- 0x02001800, 0x00100615, 0x0c01f001, 0x00106250,
-- 0x00106272, 0x0010624e, 0x0010624e, 0x0010624e,
-- 0x0010624e, 0x00106281, 0x0201f800, 0x00100615,
-- 0x4d2c0000, 0x59325808, 0x592c0206, 0x48025c06,
-- 0x4a025a06, 0x00000000, 0x4c5c0000, 0x592cbc0a,
-- 0x592c0000, 0x48026008, 0x0201f800, 0x00020385,
-- 0x59300008, 0x80000540, 0x04000008, 0x4a026203,
-- 0x00000007, 0x42027000, 0x00000043, 0x5c00b800,
-- 0x5c025800, 0x0401f08a, 0x8c5cbd08, 0x04020006,
-- 0x4a026203, 0x00000007, 0x497a6206, 0x497a6008,
-- 0x0401f003, 0x0201f800, 0x000208b4, 0x5c00b800,
-- 0x5c025800, 0x1c01f000, 0x0201f800, 0x001068c1,
-- 0x4d2c0000, 0x59325808, 0x0201f800, 0x00108df4,
-- 0x04000006, 0x4d400000, 0x42028000, 0x00000001,
-- 0x0401f90e, 0x5c028000, 0x5c025800, 0x0201f000,
-- 0x000208b4, 0x0201f800, 0x001068c1, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x42003000, 0x00000014, 0x0201f800, 0x0010a766,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-- 0x4d2c0000, 0x59325808, 0x0201f800, 0x00108df4,
-- 0x04000006, 0x4d400000, 0x42028000, 0x00000029,
-- 0x0401f8f2, 0x5c028000, 0x5c025800, 0x0201f000,
-- 0x000208b4, 0x493bc857, 0x497a6206, 0x83380480,
-- 0x00000054, 0x02021800, 0x00100615, 0x83380480,
-- 0x00000047, 0x02001800, 0x00100615, 0x0c01f001,
-- 0x001062ee, 0x001062b7, 0x001062b5, 0x001062b5,
-- 0x001062b5, 0x001062b5, 0x001062b5, 0x001062b5,
-- 0x001062b5, 0x001062b5, 0x001062b5, 0x001062b5,
-- 0x001062bb, 0x0201f800, 0x00100615, 0x59300011,
-- 0x82000500, 0xffff0000, 0x04020034, 0x59840802,
-- 0x8c040d04, 0x04000025, 0x59300009, 0x80026d40,
-- 0x0400001f, 0x4c5c0000, 0x4c600000, 0x497a6206,
-- 0x5930b808, 0x585c0005, 0x8000c540, 0x02000800,
-- 0x00100615, 0x0401fe8d, 0x40625800, 0x0201f800,
-- 0x00020385, 0x4978b805, 0x0401fef5, 0x497a6009,
-- 0x585c3408, 0x0401fcbe, 0x0400000e, 0x42001000,
-- 0x0010b315, 0x0401fcf3, 0x0400000a, 0x0201f800,
-- 0x0010082a, 0x04000007, 0x492cb805, 0x585c5408,
-- 0x0401fc84, 0x5c00c000, 0x5c00b800, 0x1c01f000,
-- 0x0401fcaa, 0x0401f7fc, 0x8c040d06, 0x040207fc,
-- 0x59300009, 0x80026d40, 0x04000006, 0x5934000e,
-- 0x80000540, 0x02020800, 0x00100615, 0x497a6009,
-- 0x0401fd0e, 0x0401f7f2, 0x0401f085, 0x4803c856,
-- 0x4803c856, 0x83380580, 0x00000043, 0x02020800,
-- 0x00100615, 0x4a026203, 0x00000003, 0x493a6403,
-- 0x59325808, 0x592c000f, 0x48026011, 0x497a6013,
-- 0x592c0406, 0x800000c2, 0x800010c4, 0x80081400,
-- 0x480a6206, 0x0201f800, 0x00100f9c, 0x42000800,
-- 0x80000060, 0x0401f161, 0x42000000, 0x0010b674,
-- 0x0201f800, 0x0010a86e, 0x59300203, 0x82000c80,
-- 0x0000000e, 0x02021800, 0x00100615, 0x4803c857,
-- 0x82000d80, 0x00000003, 0x04000006, 0x82000d80,
-- 0x00000004, 0x0400005b, 0x0201f800, 0x00100615,
-- 0x0201f800, 0x0010698c, 0x59300004, 0x8c00053e,
-- 0x04020007, 0x0201f800, 0x001068a3, 0x02020800,
-- 0x00100615, 0x0201f000, 0x00106982, 0x0401f9d3,
-- 0x0201f800, 0x00106982, 0x59325808, 0x42028000,
-- 0x00000006, 0x0401f861, 0x0201f000, 0x000208b4,
-- 0x4803c856, 0x59300203, 0x82000c80, 0x0000000e,
-- 0x02021800, 0x00100615, 0x82000d80, 0x00000002,
-- 0x04000009, 0x82000d80, 0x00000003, 0x04000019,
-- 0x82000d80, 0x00000004, 0x04000036, 0x0201f800,
-- 0x00100615, 0x4933c857, 0x4d2c0000, 0x59325808,
-- 0x812e59c0, 0x02000800, 0x00100615, 0x592c1a08,
-- 0x8c0c1d0e, 0x02000800, 0x00100615, 0x4d400000,
-- 0x42028000, 0x00000001, 0x0401f840, 0x0201f800,
-- 0x00107698, 0x5c028000, 0x5c025800, 0x1c01f000,
-- 0x4933c857, 0x0201f800, 0x0010698c, 0x4df00000,
-- 0x59300004, 0x8c00053e, 0x04020006, 0x0201f800,
-- 0x00106cb4, 0x02020800, 0x00100615, 0x0401f010,
-- 0x0201f800, 0x00108a8a, 0x04020004, 0x0201f800,
-- 0x00106bb2, 0x0402000a, 0x0401f994, 0x02020800,
-- 0x00100615, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x80000580, 0x1c01f000,
-- 0x4933c857, 0x0201f800, 0x00100ee4, 0x4933c857,
-- 0x4c5c0000, 0x4d340000, 0x497a6206, 0x5930b808,
-- 0x59300009, 0x80026d40, 0x04020e49, 0x42001000,
-- 0x0010b315, 0x0401fc4b, 0x04000009, 0x58c80204,
-- 0x4800bc08, 0x41785000, 0x0201f800, 0x00105f60,
-- 0x5c026800, 0x5c00b800, 0x1c01f000, 0x4978bc08,
-- 0x0401fc02, 0x0401f7fb, 0x4803c856, 0x0201f800,
-- 0x00108df4, 0x0400000f, 0x592c0000, 0x80000d40,
-- 0x04000009, 0x497a5800, 0x49425a06, 0x4c040000,
-- 0x0201f800, 0x00020381, 0x5c000800, 0x40065800,
-- 0x0401f7f6, 0x49425a06, 0x0201f800, 0x00020381,
-- 0x1c01f000, 0x4933c857, 0x59300c06, 0x82040580,
-- 0x0000000e, 0x04000004, 0x82040580, 0x00000009,
-- 0x04020004, 0x0401ffe5, 0x497a6008, 0x80000580,
-- 0x1c01f000, 0x592e6009, 0x83300480, 0x0010cfc0,
-- 0x04001016, 0x41580000, 0x81300480, 0x04021013,
-- 0x40040000, 0x59300c06, 0x80040580, 0x04020012,
-- 0x59300a03, 0x82040580, 0x00000007, 0x02020800,
-- 0x00100615, 0x59300008, 0x80000540, 0x02020800,
-- 0x00100615, 0x0201f800, 0x000208b4, 0x42000000,
-- 0x00000000, 0x0401f009, 0x42000000, 0x00000008,
-- 0x0401f006, 0x82040580, 0x00000007, 0x040207fb,
-- 0x42000000, 0x00000005, 0x592c0a06, 0x48065c06,
-- 0x48025a06, 0x0201f000, 0x00020381, 0x4c0c0000,
-- 0x4c100000, 0x4c140000, 0x4c180000, 0x80001d80,
-- 0x80002580, 0x42003000, 0x00000020, 0x82040500,
-- 0x00000001, 0x04000003, 0x40080000, 0x800c1c00,
-- 0x400c2800, 0x800c1902, 0x80102102, 0x82140500,
-- 0x00000001, 0x04000003, 0x82102540, 0x80000000,
-- 0x80040902, 0x80183040, 0x040207f1, 0x40100800,
-- 0x400c0000, 0x5c003000, 0x5c002800, 0x5c002000,
-- 0x5c001800, 0x1c01f000, 0x4c580000, 0x4200b000,
-- 0x00000020, 0x80000540, 0x04000018, 0x80041c80,
-- 0x04021016, 0x800810c2, 0x80040982, 0x04001006,
-- 0x80041c80, 0x04021005, 0x8058b040, 0x040207fa,
-- 0x0401f006, 0x80041c80, 0x400c0800, 0x80081000,
-- 0x8058b040, 0x040207f4, 0x4c000000, 0x41f00000,
-- 0x82000500, 0xf7ffffff, 0x4003e000, 0x5c000000,
-- 0x5c00b000, 0x1c01f000, 0x4c000000, 0x41f00000,
-- 0x82000540, 0x08000000, 0x0401f7f8, 0x42007000,
-- 0x0010b33f, 0x4a007000, 0x00000005, 0x4a007401,
-- 0x00000000, 0x4a007202, 0x00000840, 0x4a0378e8,
-- 0x00000000, 0x4a03c821, 0x00000010, 0x4a03c823,
-- 0x00000004, 0x0401f81d, 0x4a0378e9, 0x00003a0d,
-- 0x4a0378e8, 0x00000001, 0x42000800, 0x00000005,
-- 0x4203a000, 0x00007600, 0x4a03a005, 0xd0000001,
-- 0x59d00006, 0x4a03a005, 0x90000001, 0x83d3a400,
-- 0x00000020, 0x80040840, 0x040207fa, 0x59e00003,
-- 0x82000500, 0xffffffe0, 0x82000540, 0x00008000,
-- 0x4803c003, 0x59c40006, 0x82000500, 0xfffcffff,
-- 0x48038806, 0x1c01f000, 0x4d900000, 0x4d180000,
-- 0x4a0378e7, 0xaaaaaaaa, 0x4a0378e6, 0xaaaaaaaa,
-- 0x4a0378e5, 0xaaaaaaaa, 0x4a0378e4, 0xaaaaaaaa,
-- 0x4a03781a, 0x0010b5d2, 0x4a03781b, 0x0010110d,
-- 0x4a03781c, 0x0010111d, 0x4a031800, 0x00000000,
-- 0x4a031801, 0x0010b342, 0x4a031802, 0x0010b349,
-- 0x42000800, 0x0010b5d5, 0x417a3000, 0x811b20c8,
-- 0x83932400, 0x0000bf32, 0x48072000, 0x4a032001,
-- 0x00000000, 0x83180400, 0x00106e41, 0x50000000,
-- 0x48032002, 0x82040c00, 0x00000003, 0x811a3000,
-- 0x83180480, 0x00000005, 0x040017f1, 0x5c023000,
-- 0x5c032000, 0x1c01f000, 0x48066004, 0x497a6000,
-- 0x497a6001, 0x59bc00ea, 0x8c000516, 0x040207fe,
-- 0x83300400, 0xa0000000, 0x480378e1, 0x1c01f000,
-- 0x4933c857, 0x59300804, 0x82040d00, 0x00000100,
-- 0x82040d40, 0x80000040, 0x48066004, 0x497a6000,
-- 0x59bc00ea, 0x8c000516, 0x040207fe, 0x83300400,
-- 0x60000000, 0x480378e1, 0x1c01f000, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x4d300000, 0x4d340000,
-- 0x4d2c0000, 0x4d180000, 0x4c5c0000, 0x4c600000,
-- 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-- 0x42003000, 0x0000bf2e, 0x581a6001, 0x813261c0,
-- 0x0400002c, 0x41302800, 0x4178c000, 0x59300000,
-- 0x4c000000, 0x59326809, 0x5930b801, 0x59300406,
-- 0x82000d80, 0x00000006, 0x04020003, 0x8d3e7d18,
-- 0x04000010, 0x8d3e7d06, 0x04000007, 0x82000580,
-- 0x00000003, 0x04020004, 0x59340200, 0x8c00050e,
-- 0x04020008, 0x0401f92d, 0x4c0c0000, 0x4c140000,
-- 0x0401fb59, 0x5c002800, 0x5c001800, 0x0401f005,
-- 0x41301800, 0x8060c1c0, 0x04020002, 0x400cc000,
-- 0x805cb9c0, 0x04000003, 0x405e6000, 0x0401f7e3,
-- 0x5c026000, 0x813261c0, 0x04000006, 0x8060c1c0,
-- 0x04000002, 0x40602800, 0x4178c000, 0x0401f7d8,
-- 0x417a3000, 0x0201f800, 0x00106e2f, 0x59926004,
-- 0x813261c0, 0x04000023, 0x59326809, 0x4130c000,
-- 0x59300001, 0x8000bd40, 0x04000016, 0x40026000,
-- 0x40602800, 0x5930b801, 0x59300406, 0x82000d80,
-- 0x00000006, 0x0400000e, 0x8d3e7d06, 0x04000007,
-- 0x82000580, 0x00000003, 0x04020004, 0x59340200,
-- 0x8c00050e, 0x04020006, 0x0401f8da, 0x4c140000,
-- 0x0401fb29, 0x5c002800, 0x0401f002, 0x41302800,
-- 0x405e6000, 0x813261c0, 0x040207eb, 0x8060c1c0,
-- 0x04000004, 0x40626000, 0x4178c000, 0x0401f7e7,
-- 0x811a3000, 0x83180480, 0x00000005, 0x040017d6,
-+ 0x49799805, 0x49799809, 0x0401f8cc, 0x0400000a,
-+ 0x0401f8ee, 0x04000008, 0x48359800, 0x48359802,
-+ 0x48359806, 0x4a019804, 0x00000001, 0x4a019807,
-+ 0x00000005, 0x1c01f000, 0x4807c857, 0x58cc1007,
-+ 0x40040000, 0x80080480, 0x04021020, 0x4c040000,
-+ 0x4c080000, 0x0401f8dd, 0x5c001000, 0x5c000800,
-+ 0x0400001c, 0x58cc0006, 0x80006540, 0x0402000b,
-+ 0x48359800, 0x48359802, 0x48359806, 0x49799801,
-+ 0x49799803, 0x49786801, 0x49786800, 0x49799804,
-+ 0x49799807, 0x0401f005, 0x48306801, 0x48346000,
-+ 0x48359806, 0x49786800, 0x58cc0004, 0x58cc1007,
-+ 0x80000000, 0x82081400, 0x00000005, 0x48019804,
-+ 0x48099807, 0x0401f7df, 0x80000580, 0x1c01f000,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x480bc857,
-+ 0x4c500000, 0x4c540000, 0x4c580000, 0x40083000,
-+ 0x58cc0801, 0x82040480, 0x00000005, 0x02021800,
-+ 0x001004ef, 0x82040400, 0x00106013, 0x50000000,
-+ 0x58cca800, 0x8054ac00, 0x42001800, 0x00000005,
-+ 0x40040000, 0x800c0480, 0x80082480, 0x04021002,
-+ 0x40080000, 0x8000b0c2, 0x8058b400, 0x5450a800,
-+ 0x8050a000, 0x8054a800, 0x8058b040, 0x040207fc,
-+ 0x40001000, 0x58cc2805, 0x58cc0807, 0x58cc2001,
-+ 0x80142c00, 0x80040c80, 0x80102400, 0x48159805,
-+ 0x48059807, 0x48119801, 0x82100580, 0x00000005,
-+ 0x0400000c, 0x48119801, 0x40080000, 0x80181480,
-+ 0x40083000, 0x04000003, 0x040217d6, 0x80000580,
-+ 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x1c01f000,
-+ 0x58cc0800, 0x800409c0, 0x02000800, 0x001004ef,
-+ 0x58040800, 0x48059800, 0x41782000, 0x0401f7ee,
-+ 0x0401f812, 0x50600000, 0x81041c00, 0x585c0204,
-+ 0x4803c857, 0x82000580, 0x0000002c, 0x02020800,
-+ 0x001004ef, 0x58040202, 0x800000e0, 0x80640540,
-+ 0x48001802, 0x58040000, 0x48001800, 0x58040001,
-+ 0x48001801, 0x1c01f000, 0x4807c856, 0x58cc0005,
-+ 0x80000040, 0x02001800, 0x001004ef, 0x48019805,
-+ 0x58cc1003, 0x82080480, 0x00000005, 0x02021800,
-+ 0x001004ef, 0x82080400, 0x00106013, 0x50000000,
-+ 0x58cc0802, 0x80040c00, 0x80081000, 0x82080480,
-+ 0x00000005, 0x0402000f, 0x58cc2002, 0x58100000,
-+ 0x80006d40, 0x04000009, 0x4c340000, 0x0401f85c,
-+ 0x5c006800, 0x49786801, 0x48359802, 0x58cc0004,
-+ 0x80000040, 0x48019804, 0x49799803, 0x0401f002,
-+ 0x48099803, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4807c856, 0x41781800,
-+ 0x58c80201, 0x80000540, 0x04000002, 0x800c1800,
-+ 0x58c80c01, 0x80040c80, 0x0400100a, 0x04000009,
-+ 0x800c1800, 0x58c80202, 0x80041480, 0x04001005,
-+ 0x04000004, 0x800c1800, 0x40080800, 0x0401f7fb,
-+ 0x480d9204, 0x400c0000, 0x42002000, 0x00000001,
-+ 0x80000040, 0x04000007, 0x04001006, 0x80102000,
-+ 0x82000480, 0x00000005, 0x04000002, 0x040217fc,
-+ 0x48119203, 0x1c01f000, 0x4807c856, 0x4d2c0000,
-+ 0x58cc000a, 0x80000540, 0x02000800, 0x001004ef,
-+ 0x82002400, 0x00000005, 0x0201f800, 0x00100704,
-+ 0x04000012, 0x492d9809, 0x497a5800, 0x497a5801,
-+ 0x0201f800, 0x00100704, 0x0400000c, 0x58cc0009,
-+ 0x48025800, 0x497a5801, 0x492d9809, 0x82102480,
-+ 0x00000005, 0x040217f7, 0x82000540, 0x00000001,
-+ 0x5c025800, 0x1c01f000, 0x58cc0009, 0x80025d40,
-+ 0x040007fc, 0x592c2000, 0x0201f800, 0x0010072e,
-+ 0x40100000, 0x0401f7fa, 0x58cc0009, 0x48cfc857,
-+ 0x80006d40, 0x04000005, 0x50340000, 0x48019809,
-+ 0x49786800, 0x49786801, 0x1c01f000, 0x4813c857,
-+ 0x58cc0009, 0x48002000, 0x48119809, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4807c856, 0x4d2c0000, 0x58cc0009, 0x80025d40,
-+ 0x04000007, 0x592c0000, 0x4c000000, 0x0201f800,
-+ 0x0010072e, 0x5c000000, 0x0401f7f9, 0x5c025800,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4807c856, 0x4d2c0000, 0x58cc0002,
-+ 0x80025d40, 0x04000007, 0x592c0000, 0x4c000000,
-+ 0x0201f800, 0x0010072e, 0x5c000000, 0x0401f7f9,
-+ 0x49799800, 0x49799802, 0x49799801, 0x49799803,
-+ 0x49799806, 0x49799807, 0x49799808, 0x49799809,
-+ 0x4979980a, 0x5c025800, 0x1c01f000, 0x00000003,
-+ 0x00000006, 0x00000009, 0x0000000c, 0x0000000f,
-+ 0x00000012, 0x4803c856, 0x0401f857, 0x4a00c204,
-+ 0x0000003c, 0x59301009, 0x82080580, 0x0010acf1,
-+ 0x04000013, 0x58080802, 0x82040d00, 0x00ffffff,
-+ 0x58080403, 0x4804c005, 0x4800c406, 0x4a00c207,
-+ 0x00000003, 0x59300811, 0x585c0404, 0x4978c206,
-+ 0x4804c407, 0x80000540, 0x0400000d, 0x58600206,
-+ 0x84000540, 0x4800c206, 0x0401f009, 0x585c080a,
-+ 0x82040d00, 0x00ffffff, 0x4804c005, 0x4a00c406,
-+ 0x000007ff, 0x4978c207, 0x0401f7ef, 0x82603c00,
-+ 0x00000008, 0x58605404, 0x40282000, 0x405c6000,
-+ 0x585c0a04, 0x82040d00, 0x0000000f, 0x82040c00,
-+ 0x00100fd8, 0x50044000, 0x80004d80, 0x50200000,
-+ 0x80307400, 0x58380402, 0x8c244d00, 0x04020003,
-+ 0x48003a00, 0x0401f003, 0x48003c00, 0x801c3800,
-+ 0x80244800, 0x80102040, 0x04000006, 0x0201f800,
-+ 0x00100fb6, 0x02000800, 0x001004ef, 0x0401f7f0,
-+ 0x1c01f000, 0x4803c856, 0x4d340000, 0x59300009,
-+ 0x80026d40, 0x02000800, 0x001004ef, 0x59340401,
-+ 0x80000540, 0x0400000e, 0x59840000, 0x80000540,
-+ 0x0400000b, 0x836c0580, 0x00000003, 0x04020008,
-+ 0x59341c03, 0x42002000, 0x00000004, 0x42003000,
-+ 0x00000004, 0x0201f800, 0x00103764, 0x5c026800,
-+ 0x1c01f000, 0x4803c856, 0x80001580, 0x58c80c01,
-+ 0x59300011, 0x80040c80, 0x48066011, 0x58c80201,
-+ 0x80000540, 0x04000005, 0x80081000, 0x80040c80,
-+ 0x04001007, 0x04000006, 0x58c80202, 0x80081000,
-+ 0x80040c80, 0x04001002, 0x040207fd, 0x4808bc08,
-+ 0x4808c404, 0x1c01f000, 0x4803c856, 0x4a0370e5,
-+ 0x00020000, 0x59b800e5, 0x8c000524, 0x040207fc,
-+ 0x4a0370e5, 0x00030000, 0x40000000, 0x40000000,
-+ 0x59b800e5, 0x8c000524, 0x040207f5, 0x5934000e,
-+ 0x80006d40, 0x04000010, 0x81300580, 0x04020004,
-+ 0x58340000, 0x4802680e, 0x0401f00a, 0x40347800,
-+ 0x58340000, 0x80006d40, 0x02000800, 0x001004ef,
-+ 0x81300580, 0x040207fa, 0x58340000, 0x48007800,
-+ 0x497a6000, 0x4a0370e5, 0x00020000, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4803c856, 0x4d300000, 0x4d2c0000, 0x42000800,
-+ 0x000003ff, 0x4a0370e5, 0x00020000, 0x59b800e5,
-+ 0x8c000524, 0x04000005, 0x80040840, 0x040207fa,
-+ 0x0201f800, 0x001004ef, 0x4a0370e5, 0x00030000,
-+ 0x40000000, 0x40000000, 0x59b800e5, 0x8c000524,
-+ 0x040207f1, 0x5934000e, 0x80026540, 0x0400000e,
-+ 0x4933c857, 0x59300000, 0x4802680e, 0x4a026203,
-+ 0x00000004, 0x497a6206, 0x497a6009, 0x4a026007,
-+ 0x00000101, 0x59325808, 0x497a5c08, 0x0401fd69,
-+ 0x0401f7f1, 0x4a0370e5, 0x00020000, 0x5c025800,
-+ 0x5c026000, 0x1c01f000, 0x4803c856, 0x4c000000,
-+ 0x0201f800, 0x00105854, 0x04020011, 0x0201f800,
-+ 0x001042b1, 0x02020800, 0x001004ef, 0x5c000000,
-+ 0x48026802, 0x0201f800, 0x00020799, 0x04000009,
-+ 0x49366009, 0x4a026406, 0x00000001, 0x42027000,
-+ 0x00000001, 0x0201f000, 0x000207df, 0x5c000000,
-+ 0x1c01f000, 0x59300203, 0x82000c80, 0x0000000e,
-+ 0x02021800, 0x001004ef, 0x4803c857, 0x0c01f001,
-+ 0x00106102, 0x00106102, 0x00106102, 0x00106104,
-+ 0x00106162, 0x00106102, 0x00106102, 0x001061b4,
-+ 0x001061b5, 0x00106102, 0x00106102, 0x00106102,
-+ 0x00106102, 0x00106102, 0x0201f800, 0x001004ef,
-+ 0x493bc857, 0x83380480, 0x00000050, 0x02021800,
-+ 0x001004ef, 0x83380480, 0x00000049, 0x02001800,
-+ 0x001004ef, 0x0c01f001, 0x00106117, 0x00106139,
-+ 0x00106115, 0x00106115, 0x00106115, 0x00106115,
-+ 0x00106147, 0x0201f800, 0x001004ef, 0x4d2c0000,
-+ 0x59325808, 0x592c0206, 0x48025c06, 0x4a025a06,
-+ 0x00000000, 0x4c5c0000, 0x592cbc0a, 0x592c0000,
-+ 0x48026008, 0x0201f800, 0x000202ed, 0x59300008,
-+ 0x80000540, 0x04000008, 0x4a026203, 0x00000007,
-+ 0x42027000, 0x00000043, 0x5c00b800, 0x5c025800,
-+ 0x0401f088, 0x8c5cbd08, 0x04020006, 0x4a026203,
-+ 0x00000007, 0x497a6206, 0x497a6008, 0x0401f003,
-+ 0x0201f800, 0x000207bb, 0x5c00b800, 0x5c025800,
-+ 0x1c01f000, 0x0401fa6b, 0x4d2c0000, 0x59325808,
-+ 0x0201f800, 0x0010883d, 0x04000006, 0x4d400000,
-+ 0x42028000, 0x00000001, 0x0401f90a, 0x5c028000,
-+ 0x5c025800, 0x0201f000, 0x000207bb, 0x0401fa5d,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010caa0,
-+ 0x5c027800, 0x42003000, 0x00000014, 0x0201f800,
-+ 0x0010a137, 0x42000000, 0x0010b033, 0x0201f800,
-+ 0x0010a260, 0x4d2c0000, 0x59325808, 0x0201f800,
-+ 0x0010883d, 0x04000006, 0x4d400000, 0x42028000,
-+ 0x00000029, 0x0401f8ef, 0x5c028000, 0x5c025800,
-+ 0x0201f000, 0x000207bb, 0x493bc857, 0x497a6206,
-+ 0x83380480, 0x00000054, 0x02021800, 0x001004ef,
-+ 0x83380480, 0x00000047, 0x02001800, 0x001004ef,
-+ 0x0c01f001, 0x001061b3, 0x0010617c, 0x0010617a,
-+ 0x0010617a, 0x0010617a, 0x0010617a, 0x0010617a,
-+ 0x0010617a, 0x0010617a, 0x0010617a, 0x0010617a,
-+ 0x0010617a, 0x00106180, 0x0201f800, 0x001004ef,
-+ 0x59300011, 0x82000500, 0xffff0000, 0x04020034,
-+ 0x59840802, 0x8c040d04, 0x04000025, 0x59300009,
-+ 0x80026d40, 0x0400001f, 0x4c5c0000, 0x4c600000,
-+ 0x497a6206, 0x5930b808, 0x585c0005, 0x8000c540,
-+ 0x02000800, 0x001004ef, 0x0401fe8b, 0x40625800,
-+ 0x0201f800, 0x000202ed, 0x4978b805, 0x0401fef3,
-+ 0x497a6009, 0x585c3408, 0x0401fca7, 0x0400000e,
-+ 0x42001000, 0x0010ace6, 0x0401fcdc, 0x0400000a,
-+ 0x0201f800, 0x0010071a, 0x04000007, 0x492cb805,
-+ 0x585c5408, 0x0401fc6d, 0x5c00c000, 0x5c00b800,
-+ 0x1c01f000, 0x0401fc93, 0x0401f7fc, 0x8c040d06,
-+ 0x040207fc, 0x59300009, 0x80026d40, 0x04000006,
-+ 0x5934000e, 0x80000540, 0x02020800, 0x001004ef,
-+ 0x497a6009, 0x0401fcf7, 0x0401f7f2, 0x0401f081,
-+ 0x4803c856, 0x4803c856, 0x83380580, 0x00000043,
-+ 0x02020800, 0x001004ef, 0x4a026203, 0x00000003,
-+ 0x493a6403, 0x59325808, 0x592c000f, 0x48026011,
-+ 0x497a6013, 0x592c0406, 0x800000c2, 0x800010c4,
-+ 0x80081400, 0x480a6206, 0x0201f800, 0x00100e95,
-+ 0x42000800, 0x80000060, 0x0401f165, 0x42000000,
-+ 0x0010b044, 0x0201f800, 0x0010a260, 0x59300203,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x4803c857, 0x82000d80, 0x00000003, 0x04000006,
-+ 0x82000d80, 0x00000004, 0x04000057, 0x0201f800,
-+ 0x001004ef, 0x0401fa99, 0x59300004, 0x8c00053e,
-+ 0x04020005, 0x0401f998, 0x02020800, 0x001004ef,
-+ 0x0401f27f, 0x0201f800, 0x0010cb83, 0x0401fa7c,
-+ 0x59325808, 0x42028000, 0x00000006, 0x0401f861,
-+ 0x0201f000, 0x000207bb, 0x4803c856, 0x59300203,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x82000d80, 0x00000002, 0x04000009, 0x82000d80,
-+ 0x00000003, 0x04000019, 0x82000d80, 0x00000004,
-+ 0x04000035, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x4d2c0000, 0x59325808, 0x812e59c0, 0x02000800,
-+ 0x001004ef, 0x592c1a08, 0x8c0c1d0e, 0x02000800,
-+ 0x001004ef, 0x4d400000, 0x42028000, 0x00000001,
-+ 0x0401f840, 0x0201f800, 0x0010719c, 0x5c028000,
-+ 0x5c025800, 0x1c01f000, 0x4933c857, 0x0401fa63,
-+ 0x4df00000, 0x59300004, 0x8c00053e, 0x04020006,
-+ 0x0201f800, 0x001067a7, 0x02020800, 0x001004ef,
-+ 0x0401f011, 0x0201f800, 0x001084d5, 0x04020004,
-+ 0x0201f800, 0x001066a5, 0x0402000b, 0x0201f800,
-+ 0x0010cb83, 0x80c40040, 0x02020800, 0x001004ef,
-+ 0x5c03e000, 0x04000a3a, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x5c03e000, 0x04000a35, 0x80000580,
-+ 0x1c01f000, 0x4933c857, 0x0201f800, 0x00100ddd,
-+ 0x4933c857, 0x4c5c0000, 0x4d340000, 0x497a6206,
-+ 0x5930b808, 0x59300009, 0x80026d40, 0x04020e4b,
-+ 0x42001000, 0x0010ace6, 0x0401fc38, 0x04000009,
-+ 0x58c80204, 0x4800bc08, 0x41785000, 0x0201f800,
-+ 0x00105e0e, 0x5c026800, 0x5c00b800, 0x1c01f000,
-+ 0x4978bc08, 0x0201f800, 0x00105e38, 0x0401f7fa,
-+ 0x4803c856, 0x0201f800, 0x0010883d, 0x0400000f,
-+ 0x592c0000, 0x80000d40, 0x04000009, 0x497a5800,
-+ 0x49425a06, 0x4c040000, 0x0201f800, 0x000202e9,
-+ 0x5c000800, 0x40065800, 0x0401f7f6, 0x49425a06,
-+ 0x0201f800, 0x000202e9, 0x1c01f000, 0x0401f807,
-+ 0x42018800, 0x00000001, 0x04000003, 0x42018800,
-+ 0x00000000, 0x1c01f000, 0x4933c857, 0x59300c06,
-+ 0x82040580, 0x0000000e, 0x04000004, 0x82040580,
-+ 0x00000009, 0x04020004, 0x0401ffde, 0x497a6008,
-+ 0x80000580, 0x1c01f000, 0x592e6009, 0x83300480,
-+ 0x0010d8d4, 0x04001016, 0x41580000, 0x81300480,
-+ 0x04021013, 0x40040000, 0x59300c06, 0x80040580,
-+ 0x04020012, 0x59300a03, 0x82040580, 0x00000007,
-+ 0x02020800, 0x001004ef, 0x59300008, 0x80000540,
-+ 0x02020800, 0x001004ef, 0x0201f800, 0x000207bb,
-+ 0x42000000, 0x00000000, 0x0401f009, 0x42000000,
-+ 0x00000008, 0x0401f006, 0x82040580, 0x00000007,
-+ 0x040207fb, 0x42000000, 0x00000005, 0x592c0a06,
-+ 0x48065c06, 0x48025a06, 0x0201f000, 0x000202e9,
-+ 0x4c0c0000, 0x4c100000, 0x4c140000, 0x4c180000,
-+ 0x80001d80, 0x80002580, 0x42003000, 0x00000020,
-+ 0x82040500, 0x00000001, 0x04000003, 0x40080000,
-+ 0x800c1c00, 0x400c2800, 0x800c1902, 0x80102102,
-+ 0x82140500, 0x00000001, 0x04000003, 0x82102540,
-+ 0x80000000, 0x80040902, 0x80183040, 0x040207f1,
-+ 0x40100800, 0x400c0000, 0x5c003000, 0x5c002800,
-+ 0x5c002000, 0x5c001800, 0x1c01f000, 0x4c580000,
-+ 0x4200b000, 0x00000020, 0x80000540, 0x04000018,
-+ 0x80041c80, 0x04021016, 0x800810c2, 0x80040982,
-+ 0x04001006, 0x80041c80, 0x04021005, 0x8058b040,
-+ 0x040207fa, 0x0401f006, 0x80041c80, 0x400c0800,
-+ 0x80081000, 0x8058b040, 0x040207f4, 0x4c000000,
-+ 0x41f00000, 0x82000500, 0xf7ffffff, 0x4003e000,
-+ 0x5c000000, 0x5c00b000, 0x1c01f000, 0x4c000000,
-+ 0x41f00000, 0x82000540, 0x08000000, 0x0401f7f8,
-+ 0x42007000, 0x0010ad10, 0x4a007000, 0x00000005,
-+ 0x4a007401, 0x00000000, 0x4a007201, 0x00000840,
-+ 0x4a0378e8, 0x00000000, 0x4a03c821, 0x00000010,
-+ 0x4a03c823, 0x00000004, 0x0401f81d, 0x4a0378e9,
-+ 0x00003a0d, 0x4a0378e8, 0x00000001, 0x42000800,
-+ 0x00000005, 0x4203a000, 0x00007600, 0x4a03a005,
-+ 0xd0000001, 0x59d00006, 0x4a03a005, 0x90000001,
-+ 0x83d3a400, 0x00000020, 0x80040840, 0x040207fa,
-+ 0x59e00003, 0x82000500, 0xffffffe0, 0x82000540,
-+ 0x00008000, 0x4803c003, 0x59c40006, 0x82000500,
-+ 0xfffcffff, 0x48038806, 0x1c01f000, 0x4d900000,
-+ 0x4d180000, 0x4a0378e7, 0xaaaaaaaa, 0x4a0378e6,
-+ 0xaaaaaaaa, 0x4a0378e5, 0xaaaaaaaa, 0x4a0378e4,
-+ 0xaaaaaaaa, 0x4a03781a, 0x0010afa2, 0x4a03781b,
-+ 0x00100fd8, 0x4a03781c, 0x00100fe8, 0x4a031800,
-+ 0x00000000, 0x4a031801, 0x0010ad12, 0x4a031802,
-+ 0x0010ad19, 0x42000800, 0x0010afa5, 0x417a3000,
-+ 0x811b20c8, 0x83932400, 0x0000bf32, 0x48072000,
-+ 0x4a032001, 0x00000000, 0x83180400, 0x0010693d,
-+ 0x50000000, 0x48032002, 0x82040c00, 0x00000003,
-+ 0x811a3000, 0x83180480, 0x00000005, 0x040017f1,
-+ 0x5c023000, 0x5c032000, 0x1c01f000, 0x48066004,
-+ 0x497a6000, 0x497a6001, 0x59bc00ea, 0x8c000516,
-+ 0x040207fe, 0x83300400, 0xa0000000, 0x480378e1,
-+ 0x1c01f000, 0x4933c857, 0x59300804, 0x82040d00,
-+ 0x00000100, 0x82040d40, 0x80000040, 0x48066004,
-+ 0x497a6000, 0x59bc00ea, 0x8c000516, 0x040207fe,
-+ 0x83300400, 0x60000000, 0x480378e1, 0x1c01f000,
-+ 0x59300800, 0x497a6000, 0x0401f8f8, 0x801831c0,
-+ 0x04020009, 0x598c0004, 0x81300580, 0x04020004,
-+ 0x48031804, 0x48031805, 0x0401f008, 0x48071805,
-+ 0x0401f006, 0x48043000, 0x598c0004, 0x81300580,
-+ 0x04020002, 0x481b1804, 0x0401f0fe, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x598c000d,
-+ 0x81300580, 0x04000003, 0x497a6007, 0x1c01f000,
-+ 0x59c40004, 0x82000500, 0x0000000c, 0x04000005,
-+ 0x4a038804, 0x0000000c, 0x497b2807, 0x0401f00a,
-+ 0x0401faf8, 0x59300403, 0x82000d80, 0x00000040,
-+ 0x04000004, 0x82000580, 0x00000042, 0x04020002,
-+ 0x497a6007, 0x0201f800, 0x00106908, 0x80000580,
-+ 0x1c01f000, 0x59300804, 0x8c040d20, 0x04020004,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x4933c857,
-+ 0x4d380000, 0x59300804, 0x84040d20, 0x48066004,
-+ 0x42027000, 0x00000049, 0x59300203, 0x82000580,
-+ 0x00000003, 0x04000003, 0x42027000, 0x00000013,
-+ 0x0201f800, 0x000207df, 0x80000580, 0x5c027000,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x59300017, 0x81480580,
-+ 0x04020003, 0x59300018, 0x814c0580, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4d2c0000, 0x4d300000, 0x0401f8d0, 0x4df00000,
-+ 0x0201f800, 0x00105c41, 0x59900001, 0x82000500,
-+ 0x00000003, 0x0c01f001, 0x001063bf, 0x001063b4,
-+ 0x001063b2, 0x001063b2, 0x0201f800, 0x001004ef,
-+ 0x59926004, 0x0401f880, 0x813261c0, 0x04000008,
-+ 0x59300004, 0x8c000516, 0x04000004, 0x59325808,
-+ 0x497a5808, 0x497a5809, 0x0401f884, 0x5c03e000,
-+ 0x040008a3, 0x5c026000, 0x5c025800, 0x1c01f000,
-+ 0x5c000000, 0x4c000000, 0x4803c857, 0x4d300000,
-+ 0x497b2807, 0x0401f8ad, 0x4df00000, 0x598c0000,
-+ 0x82000500, 0x00000007, 0x4803c857, 0x0c01f001,
-+ 0x001063f7, 0x001063da, 0x001063e3, 0x001063e7,
-+ 0x001063f2, 0x001063f7, 0x001063d8, 0x001063d8,
-+ 0x0201f800, 0x001004ef, 0x598c000d, 0x80026540,
-+ 0x04000004, 0x0401f81e, 0x02020800, 0x001004ef,
-+ 0x0201f800, 0x00106908, 0x0401f015, 0x0401f827,
-+ 0x0201f800, 0x00106908, 0x0401f011, 0x598c000d,
-+ 0x80026540, 0x0400000e, 0x0401f838, 0x04000004,
-+ 0x0401f80f, 0x04000002, 0x0401f81c, 0x0201f800,
-+ 0x00106908, 0x0401f006, 0x0401f830, 0x02020800,
-+ 0x001004ef, 0x0201f800, 0x00106908, 0x5c03e000,
-+ 0x0400086b, 0x5c026000, 0x1c01f000, 0x598c0009,
-+ 0x81300580, 0x0402000c, 0x0401f85a, 0x0401f843,
-+ 0x59300000, 0x800001c0, 0x04000004, 0x48031809,
-+ 0x497a6000, 0x0401f003, 0x497b1809, 0x497b1808,
-+ 0x80000580, 0x1c01f000, 0x4d2c0000, 0x59300406,
-+ 0x82000580, 0x00000003, 0x04020012, 0x598c000b,
-+ 0x81300580, 0x0402000f, 0x0401f846, 0x59325808,
-+ 0x497a5808, 0x497a5809, 0x0401f82c, 0x59300000,
-+ 0x800001c0, 0x04000004, 0x4803180b, 0x497a6000,
-+ 0x0401f003, 0x497b180a, 0x497b180b, 0x80000580,
-+ 0x5c025800, 0x1c01f000, 0x598c0005, 0x81300580,
-+ 0x0402000c, 0x0401f833, 0x0401f81c, 0x59300000,
-+ 0x800001c0, 0x04000004, 0x48031805, 0x497a6000,
-+ 0x0401f003, 0x497b1805, 0x497b1804, 0x80000580,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4a032001, 0x00000000, 0x497b2004,
-+ 0x497b2005, 0x59900006, 0x82000500, 0x0000ffff,
-+ 0x48032006, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4c040000, 0x59300004,
-+ 0x82000500, 0x7ffeffff, 0x48026004, 0x59bc00e4,
-+ 0x8c000514, 0x04000009, 0x42000800, 0x0000bf00,
-+ 0x58040012, 0x81300580, 0x04020004, 0x49780812,
-+ 0x4a0378e4, 0x00000800, 0x5c000800, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4803c856, 0x598c000c, 0x80000540, 0x04000003,
-+ 0x80000040, 0x4803180c, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x59bc00ea,
-+ 0x82000500, 0x00000007, 0x82000580, 0x00000003,
-+ 0x04020004, 0x4803c856, 0x4a0378e8, 0x00000001,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x59bc00ea, 0x82000500,
-+ 0x00000007, 0x82000580, 0x00000001, 0x04020011,
-+ 0x4803c856, 0x42000800, 0x00000000, 0x0401f80e,
-+ 0x42000800, 0x00001000, 0x59bc00ea, 0x82000500,
-+ 0x00000007, 0x82000580, 0x00000003, 0x04000005,
-+ 0x80040840, 0x040207f9, 0x0201f800, 0x001004ef,
-+ 0x1c01f000, 0x59bc00ea, 0x82000500, 0x00000007,
-+ 0x82000580, 0x00000001, 0x02020800, 0x001004ef,
-+ 0x59bc00ea, 0x8c000516, 0x040207fe, 0x480778e1,
-+ 0x1c01f000, 0x59bc00ea, 0x8c000516, 0x040207fe,
-+ 0x480778e1, 0x59bc00ea, 0x8c000516, 0x040207fe,
-+ 0x480b78e1, 0x1c01f000, 0x4a0378e4, 0x00002000,
-+ 0x59a8006c, 0x82000500, 0x0000000c, 0x04020008,
-+ 0x42007000, 0x0010ad10, 0x58380401, 0x8c000506,
-+ 0x04020003, 0x4a0378e4, 0x00080000, 0x1c01f000,
-+ 0x82000d00, 0x80000018, 0x02020800, 0x001004e4,
-+ 0x0201f800, 0x001004ef, 0x001064c6, 0x0010656b,
-+ 0x00106585, 0x001064c6, 0x001064c8, 0x001064e9,
-+ 0x00106508, 0x0010653d, 0x001064c6, 0x00106569,
-+ 0x001064c6, 0x001064c6, 0x001064c6, 0x001064c6,
-+ 0x001064c6, 0x001064c6, 0x0201f800, 0x001004ef,
-+ 0x4d300000, 0x4d900000, 0x4dd00000, 0x4da40000,
-+ 0x4d140000, 0x0201f800, 0x0010692b, 0x59bc00ea,
-+ 0x8c000510, 0x040007fe, 0x59be60e0, 0x59300004,
-+ 0x8c000520, 0x04000011, 0x82000500, 0xfffefeff,
-+ 0x48026004, 0x4a026203, 0x00000003, 0x0401ff9b,
-+ 0x0201f800, 0x00100f17, 0x5c022800, 0x5c034800,
-+ 0x5c03a000, 0x5c032000, 0x5c026000, 0x4a0378e4,
-+ 0x00000008, 0x0401f77e, 0x84000510, 0x48026004,
-+ 0x0401f7f6, 0x4d300000, 0x4d900000, 0x4dd00000,
-+ 0x4da40000, 0x4d140000, 0x0201f800, 0x0010692b,
-+ 0x59bc00ea, 0x8c000510, 0x040007fe, 0x59be60e0,
-+ 0x59300004, 0x8c000520, 0x0400000f, 0x82000500,
-+ 0xfffefeff, 0x48026004, 0x0401ff7c, 0x0201f800,
-+ 0x00100f55, 0x5c022800, 0x5c034800, 0x5c03a000,
-+ 0x5c032000, 0x5c026000, 0x4a0378e4, 0x00000008,
-+ 0x0401f75f, 0x84000510, 0x48026004, 0x0401f7f6,
-+ 0x4d300000, 0x4d2c0000, 0x4d340000, 0x4da40000,
-+ 0x4cd00000, 0x59bc00ea, 0x8c000510, 0x040007fe,
-+ 0x59be60e0, 0x813261c0, 0x02000800, 0x001004ef,
-+ 0x59300004, 0x8c000520, 0x0400001e, 0x82000500,
-+ 0xfffefeff, 0x48026004, 0x59326809, 0x42034800,
-+ 0x0010ad12, 0x04011000, 0x4a03c840, 0x0010ad19,
-+ 0x4a03c842, 0x00000012, 0x04011000, 0x4a03c840,
-+ 0x0010ad2b, 0x4a03c842, 0x000000ff, 0x04011000,
-+ 0x4a03c840, 0x0010ae2a, 0x4a03c842, 0x000000ff,
-+ 0x0201f800, 0x00106942, 0x5c01a000, 0x5c034800,
-+ 0x5c026800, 0x5c025800, 0x5c026000, 0x1c01f000,
-+ 0x84000510, 0x48026004, 0x5c01a000, 0x5c034800,
-+ 0x5c026800, 0x5c025800, 0x5c026000, 0x1c01f000,
-+ 0x1c01f000, 0x4d300000, 0x4d2c0000, 0x4d340000,
-+ 0x4cd00000, 0x4d900000, 0x4dd00000, 0x4da40000,
-+ 0x4d140000, 0x0401fbe6, 0x59bc00ea, 0x8c000510,
-+ 0x040007fe, 0x59be60e0, 0x813261c0, 0x02000800,
-+ 0x001004ef, 0x59300004, 0x8c000520, 0x0400000f,
-+ 0x82000500, 0xfffefeff, 0x48026004, 0x0201f800,
-+ 0x001070ae, 0x5c022800, 0x5c034800, 0x5c03a000,
-+ 0x5c032000, 0x5c01a000, 0x5c026800, 0x5c025800,
-+ 0x5c026000, 0x1c01f000, 0x84000510, 0x48026004,
- 0x5c022800, 0x5c034800, 0x5c03a000, 0x5c032000,
-- 0x5c00c000, 0x5c00b800, 0x5c023000, 0x5c025800,
-- 0x5c026800, 0x5c026000, 0x5c03e000, 0x02000800,
-- 0x00106982, 0x1c01f000, 0x4933c857, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x4d340000, 0x4d180000,
-- 0x4d900000, 0x42003000, 0x0000bf2e, 0x59326809,
-- 0x58182001, 0x40102800, 0x801021c0, 0x04000016,
-- 0x41300000, 0x80100580, 0x04000011, 0x58100009,
-- 0x81340580, 0x0402000b, 0x40101800, 0x58102001,
-- 0x41300000, 0x801021c0, 0x0400000b, 0x80100d80,
-- 0x04000007, 0x40101800, 0x58102001, 0x0401f7fa,
-- 0x40102800, 0x58102000, 0x0401f7ec, 0x0401f8bb,
-- 0x0401f01a, 0x42032000, 0x0000bf32, 0x417a3000,
-- 0x59902004, 0x40102800, 0x801021c0, 0x0400000b,
-- 0x58100009, 0x81340580, 0x04020008, 0x41300000,
-- 0x80100580, 0x0400000c, 0x40102800, 0x58102001,
-- 0x801021c0, 0x040207fa, 0x811a3000, 0x83180480,
-- 0x00000005, 0x0402100d, 0x83932400, 0x00000010,
-- 0x0401f7ec, 0x0401f87f, 0x5c032000, 0x5c023000,
-- 0x5c026800, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x80000580, 0x1c01f000, 0x5c032000, 0x5c023000,
-- 0x5c026800, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x4d300000, 0x4d340000,
-- 0x4d180000, 0x4d2c0000, 0x4c5c0000, 0x4c600000,
-+ 0x5c01a000, 0x5c026800, 0x5c025800, 0x5c026000,
-+ 0x1c01f000, 0x0201f800, 0x001004ef, 0x4d300000,
-+ 0x4d380000, 0x42000000, 0x0010b093, 0x0201f800,
-+ 0x0010a260, 0x0401ff05, 0x598e600d, 0x59c40004,
-+ 0x8c000506, 0x04000004, 0x0401f8ee, 0x4a038804,
-+ 0x00000008, 0x813261c0, 0x04000006, 0x0401fba6,
-+ 0x42027000, 0x00000014, 0x0201f800, 0x000207df,
-+ 0x4a0378e4, 0x00000002, 0x5c027000, 0x5c026000,
-+ 0x0401f6df, 0x4d180000, 0x4d300000, 0x4d380000,
- 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-- 0x42003000, 0x0000bf2e, 0x581a6001, 0x813261c0,
-- 0x04000023, 0x41302800, 0x5930b800, 0x59326809,
-- 0x59340403, 0x81440580, 0x04000006, 0x805cb9c0,
-- 0x0400001b, 0x41302800, 0x405e6000, 0x0401f7f7,
-- 0x5930b801, 0x8d3e7d00, 0x04000003, 0x0401fb58,
-- 0x0402000e, 0x59300406, 0x82000580, 0x00000006,
-- 0x04020003, 0x8d3e7d18, 0x04000008, 0x0401f867,
-- 0x4c0c0000, 0x4c140000, 0x0401fa93, 0x5c002800,
-- 0x5c001800, 0x0401f002, 0x41301800, 0x405e6000,
-- 0x813261c0, 0x040207eb, 0x0401f02d, 0x417a3000,
-- 0x0201f800, 0x00106e2f, 0x59926004, 0x813261c0,
-- 0x04000005, 0x59326809, 0x59340403, 0x81440580,
-- 0x04000006, 0x811a3000, 0x83180480, 0x00000005,
-- 0x040017f4, 0x0401f01e, 0x4130c000, 0x59300001,
-- 0x8000bd40, 0x04000012, 0x40026000, 0x40602800,
-- 0x5930b801, 0x8d3e7d00, 0x04000003, 0x0401fb2c,
-- 0x0402000a, 0x59300406, 0x82000580, 0x00000006,
-- 0x04000006, 0x0401f81b, 0x4c140000, 0x0401fa6a,
-- 0x5c002800, 0x0401f002, 0x41302800, 0x405e6000,
-- 0x813261c0, 0x040207ef, 0x8060c1c0, 0x04000004,
-- 0x40626000, 0x4178c000, 0x0401f7eb, 0x5c022800,
-- 0x5c034800, 0x5c03a000, 0x5c032000, 0x5c00c000,
-- 0x5c00b800, 0x5c025800, 0x5c023000, 0x5c026800,
-- 0x5c026000, 0x5c03e000, 0x04000bd4, 0x1c01f000,
-- 0x0401fbb9, 0x59900004, 0x81300580, 0x04020018,
-- 0x4c140000, 0x0201f800, 0x00106b13, 0x0401fba9,
-- 0x5c002800, 0x59300001, 0x800001c0, 0x04020003,
-- 0x497a680c, 0x1c01f000, 0x42003000, 0x0000bf2e,
-- 0x497a6001, 0x58180801, 0x800409c0, 0x04020004,
-- 0x48003000, 0x48003001, 0x1c01f000, 0x58180800,
-- 0x48000800, 0x48003000, 0x1c01f000, 0x59300001,
-- 0x48002801, 0x800001c0, 0x04020002, 0x4816680c,
-- 0x497a6001, 0x1c01f000, 0x0401fb97, 0x42003000,
-- 0x0000bf2e, 0x58180001, 0x81300580, 0x0402001c,
-- 0x59300801, 0x800409c0, 0x0400000e, 0x59300000,
-- 0x800001c0, 0x04020005, 0x48043001, 0x48043000,
-- 0x497a6001, 0x1c01f000, 0x59300000, 0x48000800,
-- 0x48043001, 0x497a6000, 0x497a6001, 0x1c01f000,
-- 0x59300800, 0x800409c0, 0x04020005, 0x49783001,
-- 0x49783000, 0x497a680c, 0x1c01f000, 0x48043001,
-- 0x497a6000, 0x497a680c, 0x1c01f000, 0x58180000,
-- 0x81300580, 0x0402000c, 0x59300001, 0x800001c0,
-- 0x04020005, 0x48143000, 0x49782800, 0x497a680c,
-- 0x1c01f000, 0x48003000, 0x48002800, 0x497a6001,
-- 0x1c01f000, 0x59300000, 0x800001c0, 0x04020008,
-- 0x59300001, 0x48001801, 0x800001c0, 0x04020002,
-- 0x480e680c, 0x497a6001, 0x1c01f000, 0x59300801,
-- 0x800409c0, 0x04020006, 0x59300800, 0x48042800,
-- 0x497a6000, 0x497a680c, 0x1c01f000, 0x59300000,
-- 0x48000800, 0x48042800, 0x497a6000, 0x497a6001,
-- 0x1c01f000, 0x0401fb73, 0x4df00000, 0x0401f83a,
-- 0x040208c7, 0x0402094a, 0x04020005, 0x5c03e000,
-- 0x04000b62, 0x80000580, 0x1c01f000, 0x5c03e000,
-- 0x04000b5e, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x4d2c0000, 0x4d340000, 0x4d300000, 0x41783000,
-- 0x598e6009, 0x813261c0, 0x04000023, 0x59300406,
-- 0x82000580, 0x00000006, 0x04020004, 0x8d3e7d18,
-- 0x0402000c, 0x0401f019, 0x82040580, 0x00000005,
-- 0x04020008, 0x8d3e7d18, 0x04000003, 0x8d3e7d16,
-- 0x04000004, 0x59300420, 0x8c000500, 0x0402000f,
-- 0x0401fa49, 0x59300000, 0x4c000000, 0x8d3e7d06,
-- 0x04000004, 0x0201f800, 0x0010909d, 0x04000005,
-- 0x0401f869, 0x4c180000, 0x0401f9b7, 0x5c003000,
-- 0x5c026000, 0x0401f7e0, 0x41303000, 0x59326000,
-- 0x0401f7dd, 0x5c026000, 0x5c026800, 0x5c025800,
-- 0x1c01f000, 0x4933c857, 0x4c5c0000, 0x813261c0,
-- 0x02000800, 0x00100615, 0x41300000, 0x598cb809,
-- 0x41783000, 0x805cb9c0, 0x04000013, 0x805c0d80,
-- 0x04000004, 0x405c3000, 0x5818b800, 0x0401f7fa,
-- 0x0401f84d, 0x598c000d, 0x81300580, 0x02000800,
-- 0x00106e10, 0x59300403, 0x82000580, 0x00000042,
-- 0x04020002, 0x497a6007, 0x80000580, 0x5c00b800,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x5c00b800,
-- 0x1c01f000, 0x0401fb17, 0x4df00000, 0x4d2c0000,
-- 0x4d340000, 0x4d300000, 0x41783000, 0x598e6009,
-- 0x813261c0, 0x0400002e, 0x59300c06, 0x82040580,
-- 0x00000006, 0x04020004, 0x8d3e7d18, 0x0402000c,
-- 0x0401f024, 0x82040580, 0x00000005, 0x04020008,
-- 0x8d3e7d18, 0x04000003, 0x8d3e7d16, 0x04000004,
-- 0x59300420, 0x8c000500, 0x0402001a, 0x59326809,
-- 0x59340403, 0x81440580, 0x04020016, 0x8d3e7d00,
-- 0x04000006, 0x82040580, 0x00000003, 0x04020011,
-- 0x0401fa23, 0x0402000f, 0x0401f9ef, 0x59300000,
-- 0x4c000000, 0x8d3e7d06, 0x04000004, 0x0201f800,
-- 0x0010909d, 0x04000005, 0x0401f80f, 0x4c180000,
-- 0x0401f95d, 0x5c003000, 0x5c026000, 0x0401f7d5,
-- 0x41303000, 0x59326000, 0x0401f7d2, 0x5c026000,
-- 0x5c026800, 0x5c025800, 0x5c03e000, 0x04000ad3,
-- 0x1c01f000, 0x59300800, 0x497a6000, 0x0401fab6,
-- 0x801831c0, 0x04020009, 0x598c0008, 0x81300580,
-- 0x04020004, 0x48031808, 0x48031809, 0x0401f008,
-- 0x48071809, 0x0401f006, 0x48043000, 0x598c0008,
-- 0x81300580, 0x04020002, 0x481b1808, 0x0401f2b8,
-- 0x4d2c0000, 0x4d300000, 0x4d340000, 0x41783000,
-- 0x598e600b, 0x813261c0, 0x04000013, 0x8d3e7d06,
-- 0x04000005, 0x59326809, 0x59340200, 0x8c00050e,
-- 0x0402000a, 0x0401f9b8, 0x59300000, 0x4c000000,
-- 0x0401f853, 0x4c180000, 0x0401f92b, 0x5c003000,
-- 0x5c026000, 0x0401f7f0, 0x41303000, 0x59326000,
-- 0x0401f7ed, 0x0201f800, 0x001045c7, 0x5c026800,
-- 0x5c026000, 0x5c025800, 0x1c01f000, 0x4933c857,
-- 0x4c5c0000, 0x813261c0, 0x02000800, 0x00100615,
-- 0x41300000, 0x598cb80b, 0x41783000, 0x805cb9c0,
-- 0x0400000f, 0x805c0d80, 0x04000004, 0x405c3000,
-- 0x5818b800, 0x0401f7fa, 0x0401f835, 0x598c000d,
-- 0x81300580, 0x02000800, 0x00106e10, 0x497a6007,
-- 0x80000580, 0x5c00b800, 0x1c01f000, 0x82000540,
-- 0x00000001, 0x5c00b800, 0x1c01f000, 0x0401fa8d,
-- 0x4df00000, 0x4d340000, 0x4d300000, 0x4d2c0000,
-- 0x0201f800, 0x00020267, 0x02020800, 0x00100615,
-- 0x41783000, 0x598e600b, 0x813261c0, 0x04000014,
-- 0x59300009, 0x81340580, 0x0402000e, 0x8d3e7d00,
-- 0x04000003, 0x0401f9aa, 0x0402000a, 0x0401f976,
-- 0x59300000, 0x4c000000, 0x0401f811, 0x4c180000,
-- 0x0401f8e9, 0x5c003000, 0x5c026000, 0x0401f7ef,
-- 0x41303000, 0x59326000, 0x0401f7ec, 0x0201f800,
-- 0x001045ea, 0x5c025800, 0x5c026000, 0x5c026800,
-- 0x5c03e000, 0x04000a5d, 0x1c01f000, 0x59300800,
-- 0x497a6000, 0x0401fa40, 0x801831c0, 0x04020009,
-- 0x598c000a, 0x81300580, 0x04020004, 0x4803180a,
-- 0x4803180b, 0x0401f008, 0x4807180b, 0x0401f006,
-- 0x48043000, 0x598c000a, 0x81300580, 0x04020002,
-- 0x481b180a, 0x0401f242, 0x0401fa52, 0x4df00000,
-- 0x4d300000, 0x4c5c0000, 0x4178b800, 0x8d3e7d18,
-- 0x04000004, 0x8d3e7d16, 0x04020002, 0x805cb800,
-- 0x598e6005, 0x813261c0, 0x0400001a, 0x59300000,
-- 0x4c000000, 0x805cb9c0, 0x0402000b, 0x59300c06,
-- 0x82040580, 0x00000011, 0x04000010, 0x82040580,
-- 0x00000004, 0x04020004, 0x59300420, 0x8c000500,
-- 0x0402000a, 0x0201f800, 0x00108f05, 0x02000800,
-- 0x00107da6, 0x0201f800, 0x001090ec, 0x0201f800,
-- 0x000208b4, 0x0401fa1e, 0x5c026000, 0x0401f7e6,
-- 0x497b1805, 0x497b1804, 0x5c00b800, 0x5c026000,
-- 0x5c03e000, 0x04000a1d, 0x1c01f000, 0x4933c857,
-- 0x4c5c0000, 0x4c600000, 0x813261c0, 0x02000800,
-- 0x00100615, 0x41300000, 0x598cb805, 0x405cc000,
-- 0x805cb9c0, 0x04000025, 0x805c0d80, 0x04000004,
-- 0x405cc000, 0x5860b800, 0x0401f7fa, 0x598c000d,
-- 0x81300580, 0x02000800, 0x00106e10, 0x0401f9ee,
-- 0x598c0005, 0x805c0580, 0x04020009, 0x585c0000,
-- 0x48031805, 0x4978b800, 0x598c0004, 0x805c0580,
-- 0x0402000d, 0x497b1804, 0x0401f00b, 0x598c0004,
-- 0x805c0580, 0x04020005, 0x48631804, 0x4978b800,
-- 0x4978c000, 0x0401f004, 0x585c0000, 0x4800c000,
-- 0x4978b800, 0x0401f9ea, 0x80000580, 0x5c00c000,
-- 0x5c00b800, 0x1c01f000, 0x82000540, 0x00000001,
-- 0x5c00c000, 0x5c00b800, 0x1c01f000, 0x4933c857,
-- 0x0401f9f0, 0x4df00000, 0x4d2c0000, 0x4d340000,
-- 0x4d300000, 0x4c5c0000, 0x4178b800, 0x8d3e7d18,
-- 0x04000004, 0x8d3e7d16, 0x04020002, 0x805cb800,
-- 0x41783000, 0x598e6005, 0x813261c0, 0x04000029,
-- 0x59326809, 0x813669c0, 0x04000023, 0x59340403,
-- 0x81440580, 0x04020020, 0x805cb9c0, 0x0402000b,
-- 0x59300c06, 0x82040580, 0x00000011, 0x0400001a,
-- 0x82040580, 0x00000004, 0x04020004, 0x59300420,
-- 0x8c000500, 0x04020014, 0x0201f800, 0x00108df4,
-- 0x04000008, 0x0201f800, 0x00109360, 0x04020005,
-- 0x59300403, 0x82000580, 0x00000043, 0x0400000a,
-- 0x0401f8c1, 0x59300000, 0x4c000000, 0x0401f810,
-- 0x4c180000, 0x0401f834, 0x5c003000, 0x5c026000,
-- 0x0401f7da, 0x41303000, 0x59326000, 0x0401f7d7,
-- 0x5c00b800, 0x5c026000, 0x5c026800, 0x5c025800,
-- 0x5c03e000, 0x040009a9, 0x1c01f000, 0x59300800,
-- 0x497a6000, 0x0401f98c, 0x801831c0, 0x04020009,
-- 0x598c0004, 0x81300580, 0x04020004, 0x48031804,
-- 0x48031805, 0x0401f008, 0x48071805, 0x0401f006,
-- 0x48043000, 0x598c0004, 0x81300580, 0x04020002,
-- 0x481b1804, 0x0401f18e, 0x4943c857, 0x0401f99d,
-- 0x4df00000, 0x0401fe37, 0x0401fed2, 0x5c03e000,
-- 0x0400098e, 0x1c01f000, 0x4947c857, 0x0401f995,
-- 0x4df00000, 0x4d3c0000, 0x853e7d00, 0x0401fe7a,
-- 0x0401ff03, 0x5c027800, 0x5c03e000, 0x04000983,
-- 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-- 0x4d340000, 0x4d2c0000, 0x59326809, 0x59325808,
-- 0x59300406, 0x82000c80, 0x00000012, 0x02021800,
-- 0x00100615, 0x4933c857, 0x4943c857, 0x493fc857,
-- 0x4803c857, 0x0c01f804, 0x5c025800, 0x5c026800,
-- 0x1c01f000, 0x00106827, 0x00106829, 0x00106833,
-- 0x0010684d, 0x00106829, 0x0010683d, 0x00106865,
-- 0x00106827, 0x00106827, 0x00106878, 0x0010686f,
-- 0x00106827, 0x00106827, 0x00106827, 0x00106827,
-- 0x00106827, 0x0010687e, 0x0010687e, 0x0201f800,
-- 0x00100615, 0x0201f800, 0x00108ef1, 0x02000800,
-- 0x00101e1b, 0x0201f800, 0x001090ec, 0x0201f800,
-- 0x00107da6, 0x0201f000, 0x00107698, 0x812e59c0,
-- 0x02020800, 0x00100615, 0x5930021d, 0x82000580,
-- 0x00000003, 0x02000800, 0x00108ee7, 0x0201f000,
-- 0x00107698, 0x0201f800, 0x00108df4, 0x02000000,
-- 0x00107698, 0x592c1204, 0x82081500, 0x000000ff,
-- 0x82080580, 0x00000055, 0x02020800, 0x00100615,
-- 0x49425a06, 0x0201f800, 0x00020381, 0x0201f000,
-- 0x00107698, 0x59300004, 0x8400055c, 0x48026004,
-- 0x59300007, 0x8c000500, 0x02020800, 0x00100ee4,
-- 0x0201f800, 0x00108df4, 0x0400000d, 0x4a025a04,
-- 0x00000103, 0x49425a06, 0x497a5c09, 0x0201f800,
-- 0x00108f7d, 0x0201f800, 0x0010a4ae, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00108ee7, 0x0201f000,
-- 0x00107698, 0x59300007, 0x8c000500, 0x02020800,
-- 0x00100ee4, 0x0201f800, 0x00108df4, 0x02020800,
-- 0x0010a201, 0x0201f000, 0x00107698, 0x0201f800,
-- 0x00108df4, 0x04000005, 0x49425a06, 0x497a5c09,
-- 0x0201f800, 0x00020381, 0x0201f000, 0x00107698,
-- 0x0201f800, 0x00108df4, 0x02020800, 0x0010639d,
-- 0x0201f000, 0x00107698, 0x0201f800, 0x00108df4,
-- 0x04000004, 0x49425a06, 0x0201f800, 0x00020381,
-- 0x59325817, 0x0201f800, 0x00100843, 0x0201f000,
-- 0x00107698, 0x598c000d, 0x81300580, 0x04000003,
-- 0x497a6007, 0x1c01f000, 0x59c40004, 0x82000500,
-- 0x0000000c, 0x04000005, 0x4a038804, 0x0000000c,
-- 0x497b2807, 0x0401f00a, 0x0401fadb, 0x59300403,
-- 0x82000d80, 0x00000040, 0x04000004, 0x82000580,
-- 0x00000042, 0x04020002, 0x497a6007, 0x0201f800,
-- 0x00106e10, 0x80000580, 0x1c01f000, 0x59300804,
-- 0x8c040d20, 0x04020004, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x4933c857, 0x4d380000, 0x59300804,
-- 0x84040d20, 0x48066004, 0x42027000, 0x00000049,
-- 0x59300203, 0x82000580, 0x00000003, 0x04000003,
-- 0x42027000, 0x00000013, 0x0201f800, 0x000208d8,
-- 0x80000580, 0x5c027000, 0x1c01f000, 0x59300017,
-- 0x81480580, 0x04020003, 0x59300018, 0x814c0580,
-- 0x1c01f000, 0x4d2c0000, 0x4d300000, 0x0401f8c9,
-- 0x4df00000, 0x0201f800, 0x00105d9b, 0x59900001,
-- 0x82000500, 0x00000003, 0x0c01f001, 0x001068f1,
-- 0x001068d1, 0x001068cf, 0x001068cf, 0x0201f800,
-- 0x00100615, 0x59926004, 0x0401f88e, 0x813261c0,
-- 0x0400001d, 0x59300004, 0x8c000516, 0x04000004,
-- 0x59325808, 0x497a5808, 0x497a5809, 0x0401f88e,
-- 0x59300001, 0x800001c0, 0x0400000e, 0x497a6001,
-- 0x42003000, 0x0000bf2e, 0x58180801, 0x800409c0,
-- 0x04020004, 0x48003001, 0x48003000, 0x0401f00a,
-- 0x58180800, 0x48000800, 0x48003000, 0x0401f006,
-- 0x59300809, 0x800409c0, 0x02000800, 0x00100615,
-- 0x4978080c, 0x5c03e000, 0x04000890, 0x5c026000,
-- 0x5c025800, 0x1c01f000, 0x4d300000, 0x497b2807,
-- 0x0401f894, 0x4df00000, 0x598c0000, 0x82000500,
-- 0x00000007, 0x4803c857, 0x0c01f001, 0x00106926,
-- 0x00106909, 0x00106912, 0x00106916, 0x00106921,
-- 0x00106926, 0x00106907, 0x00106907, 0x0201f800,
-- 0x00100615, 0x598c000d, 0x80026540, 0x04000004,
-- 0x0401f81e, 0x02020800, 0x00100615, 0x0201f800,
-- 0x00106e10, 0x0401f015, 0x0401f827, 0x0201f800,
-- 0x00106e10, 0x0401f011, 0x598c000d, 0x80026540,
-- 0x0400000e, 0x0401f838, 0x04000004, 0x0401f80f,
-- 0x04000002, 0x0401f81c, 0x0201f800, 0x00106e10,
-- 0x0401f006, 0x0401f830, 0x02020800, 0x00100615,
-- 0x0201f800, 0x00106e10, 0x5c03e000, 0x0400085b,
-- 0x5c026000, 0x1c01f000, 0x598c0009, 0x81300580,
-- 0x0402000c, 0x0401f84e, 0x0401f83b, 0x59300000,
-- 0x800001c0, 0x04000004, 0x48031809, 0x497a6000,
-- 0x0401f003, 0x497b1809, 0x497b1808, 0x80000580,
-- 0x1c01f000, 0x4d2c0000, 0x59300406, 0x82000580,
-- 0x00000003, 0x04020012, 0x598c000b, 0x81300580,
-- 0x0402000f, 0x0401f83a, 0x59325808, 0x497a5808,
-- 0x497a5809, 0x0401f824, 0x59300000, 0x800001c0,
-- 0x04000004, 0x4803180b, 0x497a6000, 0x0401f003,
-- 0x497b180a, 0x497b180b, 0x80000580, 0x5c025800,
-- 0x1c01f000, 0x598c0005, 0x81300580, 0x0402000c,
-- 0x0401f827, 0x0401f814, 0x59300000, 0x800001c0,
-- 0x04000004, 0x48031805, 0x497a6000, 0x0401f003,
-- 0x497b1805, 0x497b1804, 0x80000580, 0x1c01f000,
-- 0x4a032001, 0x00000000, 0x497b2004, 0x497b2005,
-- 0x59900006, 0x82000500, 0x0000ffff, 0x48032006,
-- 0x1c01f000, 0x4c040000, 0x59300004, 0x82000500,
-- 0x7ffeffff, 0x48026004, 0x59bc00e4, 0x8c000514,
-- 0x04000009, 0x42000800, 0x0000bf00, 0x58040012,
-- 0x81300580, 0x04020004, 0x49780812, 0x4a0378e4,
-- 0x00000800, 0x5c000800, 0x1c01f000, 0x4803c856,
-- 0x598c000c, 0x80000540, 0x04000003, 0x80000040,
-- 0x4803180c, 0x1c01f000, 0x59bc00ea, 0x82000500,
-- 0x00000007, 0x82000580, 0x00000003, 0x04020004,
-- 0x4803c856, 0x4a0378e8, 0x00000001, 0x1c01f000,
-- 0x59bc00ea, 0x82000500, 0x00000007, 0x82000580,
-- 0x00000001, 0x04020011, 0x4803c856, 0x42000800,
-- 0x00000000, 0x0401f80e, 0x42000800, 0x00001000,
-- 0x59bc00ea, 0x82000500, 0x00000007, 0x82000580,
-- 0x00000003, 0x04000005, 0x80040840, 0x040207f9,
-- 0x0201f800, 0x00100615, 0x1c01f000, 0x59bc00ea,
-- 0x82000500, 0x00000007, 0x82000580, 0x00000001,
-- 0x02020800, 0x00100615, 0x59bc00ea, 0x8c000516,
-- 0x040207fe, 0x480778e1, 0x1c01f000, 0x59bc00ea,
-- 0x8c000516, 0x040207fe, 0x480778e1, 0x59bc00ea,
-- 0x8c000516, 0x040207fe, 0x480b78e1, 0x1c01f000,
-- 0x4a0378e4, 0x00002000, 0x59a8006f, 0x82000500,
-- 0x0000000c, 0x04020008, 0x42007000, 0x0010b33f,
-- 0x58380401, 0x8c000506, 0x04020003, 0x4a0378e4,
-- 0x00080000, 0x1c01f000, 0x82000d00, 0x80000018,
-- 0x02020800, 0x0010060d, 0x0201f800, 0x00100615,
-- 0x001069dc, 0x00106a81, 0x00106a9b, 0x001069dc,
-- 0x001069de, 0x001069ff, 0x00106a1e, 0x00106a53,
-- 0x001069dc, 0x00106a7f, 0x001069dc, 0x001069dc,
-- 0x001069dc, 0x001069dc, 0x001069dc, 0x001069dc,
-- 0x0201f800, 0x00100615, 0x4d300000, 0x4d900000,
-- 0x4dd00000, 0x4da40000, 0x4d140000, 0x0201f800,
-- 0x00106e2f, 0x59bc00ea, 0x8c000510, 0x040007fe,
-- 0x59be60e0, 0x59300004, 0x8c000520, 0x04000011,
-- 0x82000500, 0xfffefeff, 0x48026004, 0x4a026203,
-- 0x00000003, 0x0401ff9b, 0x0201f800, 0x0010101e,
-+ 0x0401feea, 0x417a3000, 0x59c40804, 0x83180400,
-+ 0x001068ea, 0x50000000, 0x80040500, 0x0400001b,
-+ 0x42000000, 0x0010b094, 0x0201f800, 0x0010a260,
-+ 0x0401fb93, 0x59926004, 0x0401f86c, 0x83180400,
-+ 0x001068ea, 0x50000000, 0x48038804, 0x813261c0,
-+ 0x0400000a, 0x59300004, 0x8c00050c, 0x04020003,
-+ 0x4a026203, 0x00000003, 0x42027000, 0x0000004a,
-+ 0x0201f800, 0x000207df, 0x59c40004, 0x82000500,
-+ 0x00f80000, 0x04000005, 0x811a3000, 0x83180480,
-+ 0x00000005, 0x040017dd, 0x4a0378e4, 0x00000008,
- 0x5c022800, 0x5c034800, 0x5c03a000, 0x5c032000,
-- 0x5c026000, 0x4a0378e4, 0x00000008, 0x0401f787,
-- 0x84000510, 0x48026004, 0x0401f7f6, 0x4d300000,
-- 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-- 0x0201f800, 0x00106e2f, 0x59bc00ea, 0x8c000510,
-- 0x040007fe, 0x59be60e0, 0x59300004, 0x8c000520,
-- 0x0400000f, 0x82000500, 0xfffefeff, 0x48026004,
-- 0x0401ff7c, 0x0201f800, 0x0010105c, 0x5c022800,
-- 0x5c034800, 0x5c03a000, 0x5c032000, 0x5c026000,
-- 0x4a0378e4, 0x00000008, 0x0401f768, 0x84000510,
-- 0x48026004, 0x0401f7f6, 0x4d300000, 0x4d2c0000,
-- 0x4d340000, 0x4da40000, 0x4cd00000, 0x59bc00ea,
-- 0x8c000510, 0x040007fe, 0x59be60e0, 0x813261c0,
-- 0x02000800, 0x00100615, 0x59300004, 0x8c000520,
-- 0x0400001e, 0x82000500, 0xfffefeff, 0x48026004,
-- 0x59326809, 0x42034800, 0x0010b342, 0x04011000,
-- 0x4a03c840, 0x0010b349, 0x4a03c842, 0x00000012,
-- 0x04011000, 0x4a03c840, 0x0010b35b, 0x4a03c842,
-- 0x000000ff, 0x04011000, 0x4a03c840, 0x0010b45a,
-- 0x4a03c842, 0x000000ff, 0x0201f800, 0x00106e46,
-- 0x5c01a000, 0x5c034800, 0x5c026800, 0x5c025800,
-- 0x5c026000, 0x1c01f000, 0x84000510, 0x48026004,
-- 0x5c01a000, 0x5c034800, 0x5c026800, 0x5c025800,
-- 0x5c026000, 0x1c01f000, 0x1c01f000, 0x4d300000,
-- 0x4d2c0000, 0x4d340000, 0x4cd00000, 0x4d900000,
-- 0x4dd00000, 0x4da40000, 0x4d140000, 0x0401fbd4,
-- 0x59bc00ea, 0x8c000510, 0x040007fe, 0x59be60e0,
-- 0x813261c0, 0x02000800, 0x00100615, 0x59300004,
-- 0x8c000520, 0x0400000f, 0x82000500, 0xfffefeff,
-- 0x48026004, 0x0201f800, 0x001075b9, 0x5c022800,
-- 0x5c034800, 0x5c03a000, 0x5c032000, 0x5c01a000,
-- 0x5c026800, 0x5c025800, 0x5c026000, 0x1c01f000,
-- 0x84000510, 0x48026004, 0x5c022800, 0x5c034800,
-- 0x5c03a000, 0x5c032000, 0x5c01a000, 0x5c026800,
-- 0x5c025800, 0x5c026000, 0x1c01f000, 0x0201f800,
-- 0x00100615, 0x4d300000, 0x4d380000, 0x42000000,
-- 0x0010b6c3, 0x0201f800, 0x0010a86e, 0x0401ff05,
-- 0x598e600d, 0x59c40004, 0x8c000506, 0x04000004,
-- 0x0401f8e5, 0x4a038804, 0x00000008, 0x813261c0,
-- 0x04000006, 0x0401fb98, 0x42027000, 0x00000014,
-- 0x0201f800, 0x000208d8, 0x4a0378e4, 0x00000002,
-- 0x5c027000, 0x5c026000, 0x0401f6e8, 0x4d180000,
-- 0x4d300000, 0x4d380000, 0x4d900000, 0x4dd00000,
-- 0x4da40000, 0x4d140000, 0x0401feea, 0x417a3000,
-- 0x59c40804, 0x83180400, 0x00106df6, 0x50000000,
-- 0x80040500, 0x0400001b, 0x42000000, 0x0010b6c4,
-- 0x0201f800, 0x0010a86e, 0x0401fb81, 0x59926004,
-- 0x0401f863, 0x83180400, 0x00106df6, 0x50000000,
-- 0x48038804, 0x813261c0, 0x0400000a, 0x59300004,
-- 0x8c00050c, 0x04020003, 0x4a026203, 0x00000003,
-- 0x42027000, 0x0000004a, 0x0201f800, 0x000208d8,
-- 0x59c40004, 0x82000500, 0x00f80000, 0x04000005,
-- 0x811a3000, 0x83180480, 0x00000005, 0x040017dd,
-- 0x4a0378e4, 0x00000008, 0x5c022800, 0x5c034800,
-- 0x5c03a000, 0x5c032000, 0x5c027000, 0x5c026000,
-- 0x5c023000, 0x0401f6b1, 0x4d2c0000, 0x4d340000,
-- 0x59326809, 0x598c0800, 0x82040580, 0x00000004,
-- 0x04020006, 0x838c1400, 0x00000005, 0x838c1c00,
-- 0x00000004, 0x0401f010, 0x82040580, 0x00000001,
-- 0x04020006, 0x838c1400, 0x00000009, 0x838c1c00,
-- 0x00000008, 0x0401f008, 0x82040580, 0x00000002,
-- 0x04020028, 0x838c1400, 0x0000000b, 0x838c1c00,
-- 0x0000000a, 0x41306800, 0x58340000, 0x80007d40,
-- 0x04000020, 0x583c0009, 0x81340580, 0x04020006,
-- 0x403c6800, 0x583c0000, 0x80007d40, 0x040207fa,
-- 0x0401f018, 0x4933c857, 0x483fc857, 0x583c0000,
-- 0x48006800, 0x49307800, 0x443c1000, 0x500c0000,
-- 0x803c0580, 0x04020002, 0x44341800, 0x80000580,
-- 0x4803180d, 0x4803180f, 0x598c0000, 0x82000580,
-- 0x00000003, 0x04000003, 0x4a031800, 0x00000000,
-- 0x80000580, 0x5c026800, 0x5c025800, 0x1c01f000,
-- 0x82000540, 0x00000001, 0x0401f7fb, 0x491bc857,
-- 0x59c80840, 0x82040540, 0x00000010, 0x48039040,
-- 0x59c41008, 0x82080500, 0xffffff7f, 0x48038808,
-- 0x4c040000, 0x4c080000, 0x0401fac2, 0x04020007,
-- 0x0401fac6, 0x04000022, 0x48038804, 0x0201f800,
-- 0x001010ca, 0x0401f042, 0x4a038803, 0x00000008,
-+ 0x5c027000, 0x5c026000, 0x5c023000, 0x0401f6a8,
-+ 0x4d2c0000, 0x4d340000, 0x59326809, 0x598c0800,
-+ 0x82040580, 0x00000004, 0x04020006, 0x838c1400,
-+ 0x00000005, 0x838c1c00, 0x00000004, 0x0401f010,
-+ 0x82040580, 0x00000001, 0x04020006, 0x838c1400,
-+ 0x00000009, 0x838c1c00, 0x00000008, 0x0401f008,
-+ 0x82040580, 0x00000002, 0x04020028, 0x838c1400,
-+ 0x0000000b, 0x838c1c00, 0x0000000a, 0x41306800,
-+ 0x58340000, 0x80007d40, 0x04000020, 0x583c0009,
-+ 0x81340580, 0x04020006, 0x403c6800, 0x583c0000,
-+ 0x80007d40, 0x040207fa, 0x0401f018, 0x4933c857,
-+ 0x483fc857, 0x583c0000, 0x48006800, 0x49307800,
-+ 0x443c1000, 0x500c0000, 0x803c0580, 0x04020002,
-+ 0x44341800, 0x80000580, 0x4803180d, 0x4803180f,
-+ 0x598c0000, 0x82000580, 0x00000003, 0x04000003,
-+ 0x4a031800, 0x00000000, 0x80000580, 0x5c026800,
-+ 0x5c025800, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x0401f7fb, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000000, 0x04000003, 0x42018800, 0x00000001,
-+ 0x5c000000, 0x1c01f000, 0x491bc857, 0x59c80840,
-+ 0x82040540, 0x00000010, 0x48039040, 0x59c41008,
-+ 0x82080500, 0xffffff7f, 0x48038808, 0x4c040000,
-+ 0x4c080000, 0x0401fac3, 0x04020007, 0x0401fac7,
-+ 0x04000022, 0x48038804, 0x0201f800, 0x00100f95,
-+ 0x0401f042, 0x4a038803, 0x00000008, 0x59c40003,
-+ 0x82000500, 0x00000003, 0x040007fd, 0x8c000502,
-+ 0x04020007, 0x0401fab9, 0x04000014, 0x48038804,
-+ 0x0201f800, 0x00100f95, 0x0401f034, 0x59c80040,
-+ 0x8400056a, 0x48039040, 0x59c80040, 0x8c00052a,
-+ 0x040207fe, 0x59c40005, 0x82000500, 0xc0000000,
-+ 0x04000006, 0x59c400a3, 0x84000540, 0x480388a3,
-+ 0x4a038805, 0xc0000000, 0x0201f800, 0x00100f64,
-+ 0x4a03a005, 0x30000000, 0x59d00006, 0x4a03a005,
-+ 0x30000000, 0x59900006, 0x82000500, 0xffff0000,
-+ 0x48032006, 0x59d00005, 0x8c000504, 0x040207fe,
-+ 0x42000800, 0x00007600, 0x83180540, 0x60000000,
-+ 0x480008a1, 0x811800dc, 0x59c80840, 0x80040540,
-+ 0x48039040, 0x82000540, 0x00003000, 0x48039040,
-+ 0x59c80040, 0x82000500, 0x00003000, 0x040207fd,
-+ 0x0201f800, 0x00100f83, 0x83180400, 0x001068ea,
-+ 0x50000000, 0x48038804, 0x80000580, 0x4df00000,
-+ 0x0201f800, 0x00105c41, 0x5c03e000, 0x5c001000,
-+ 0x5c000800, 0x480b8808, 0x48079040, 0x1c01f000,
-+ 0x4803c856, 0x59c80840, 0x82040540, 0x00000010,
-+ 0x48039040, 0x59c41008, 0x82080500, 0xffffff7f,
-+ 0x48038808, 0x4c040000, 0x4c080000, 0x59c40004,
-+ 0x82000500, 0x00000003, 0x04020010, 0x59c40004,
-+ 0x82000500, 0x0000000c, 0x04000005, 0x4a038804,
-+ 0x0000000c, 0x8c000504, 0x0401f025, 0x59c80040,
-+ 0x8400056e, 0x48039040, 0x59c80040, 0x8c00052e,
-+ 0x040207fe, 0x0401f01e, 0x4a038803, 0x00000008,
- 0x59c40003, 0x82000500, 0x00000003, 0x040007fd,
-- 0x8c000502, 0x04020007, 0x0401fab8, 0x04000014,
-- 0x48038804, 0x0201f800, 0x001010ca, 0x0401f034,
-- 0x59c80040, 0x8400056a, 0x48039040, 0x59c80040,
-- 0x8c00052a, 0x040207fe, 0x59c40005, 0x82000500,
-- 0xc0000000, 0x04000006, 0x59c400a3, 0x84000540,
-- 0x480388a3, 0x4a038805, 0xc0000000, 0x0201f800,
-- 0x0010106b, 0x4a03a005, 0x30000000, 0x59d00006,
-- 0x4a03a005, 0x30000000, 0x59900006, 0x82000500,
-- 0xffff0000, 0x48032006, 0x59d00005, 0x8c000504,
-- 0x040207fe, 0x42000800, 0x00007600, 0x83180540,
-- 0x60000000, 0x480008a1, 0x811800dc, 0x59c80840,
-- 0x80040540, 0x48039040, 0x82000540, 0x00003000,
-- 0x48039040, 0x59c80040, 0x82000500, 0x00003000,
-- 0x040207fd, 0x0201f800, 0x001010b8, 0x83180400,
-- 0x00106df6, 0x50000000, 0x48038804, 0x80000580,
-- 0x4df00000, 0x0201f800, 0x00105d9b, 0x5c03e000,
-+ 0x8c000502, 0x04020006, 0x59c40004, 0x4a038804,
-+ 0x0000000c, 0x8c000504, 0x0401f011, 0x59c80040,
-+ 0x8400056a, 0x48039040, 0x59c80040, 0x8c00052a,
-+ 0x040207fe, 0x59c40005, 0x82000500, 0xc0000000,
-+ 0x04000007, 0x59c400a3, 0x84000540, 0x480388a3,
-+ 0x4a038805, 0xc0000000, 0x80000580, 0x497b2807,
- 0x5c001000, 0x5c000800, 0x480b8808, 0x48079040,
-- 0x1c01f000, 0x4803c856, 0x59c80840, 0x82040540,
-- 0x00000010, 0x48039040, 0x59c41008, 0x82080500,
-- 0xffffff7f, 0x48038808, 0x4c040000, 0x4c080000,
-- 0x59c40004, 0x82000500, 0x00000003, 0x04020010,
-- 0x59c40004, 0x82000500, 0x0000000c, 0x04000005,
-- 0x4a038804, 0x0000000c, 0x8c000504, 0x0401f025,
-- 0x59c80040, 0x8400056e, 0x48039040, 0x59c80040,
-- 0x8c00052e, 0x040207fe, 0x0401f01e, 0x4a038803,
-- 0x00000008, 0x59c40003, 0x82000500, 0x00000003,
-- 0x040007fd, 0x8c000502, 0x04020006, 0x59c40004,
-- 0x4a038804, 0x0000000c, 0x8c000504, 0x0401f011,
-- 0x59c80040, 0x8400056a, 0x48039040, 0x59c80040,
-- 0x8c00052a, 0x040207fe, 0x59c40005, 0x82000500,
-- 0xc0000000, 0x04000007, 0x59c400a3, 0x84000540,
-- 0x480388a3, 0x4a038805, 0xc0000000, 0x80000580,
-- 0x497b2807, 0x5c001000, 0x5c000800, 0x480b8808,
-- 0x48079040, 0x1c01f000, 0x5c000000, 0x4c000000,
-- 0x4803c857, 0x491bc857, 0x4933c857, 0x4d900000,
-- 0x4dd00000, 0x4da40000, 0x4d140000, 0x0401fdd1,
-- 0x4df00000, 0x0401fa72, 0x59900004, 0x800001c0,
-- 0x04000011, 0x81300580, 0x0402000f, 0x59300004,
-- 0x84000520, 0x48026004, 0x0401ff4d, 0x04020009,
-- 0x5c03e000, 0x04000db9, 0x80000580, 0x5c022800,
-- 0x5c034800, 0x5c03a000, 0x5c032000, 0x1c01f000,
-- 0x0401fcf1, 0x42027000, 0x00000049, 0x59300004,
-- 0x84000520, 0x48026004, 0x8c00050c, 0x02020800,
-- 0x000208d8, 0x5c03e000, 0x04000da8, 0x82000540,
-- 0x00000001, 0x5c022800, 0x5c034800, 0x5c03a000,
-- 0x5c032000, 0x1c01f000, 0x4933c857, 0x0401fda9,
-- 0x4df00000, 0x598c000d, 0x80026540, 0x04000012,
-- 0x59300004, 0x84000520, 0x48026004, 0x0401ff86,
-- 0x04000017, 0x0401fd09, 0x42027000, 0x00000013,
-- 0x59300004, 0x8c00050c, 0x02020800, 0x000208d8,
-- 0x5c03e000, 0x04000d8d, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x836c1580, 0x00000001, 0x040007f9,
-- 0x836c1580, 0x00000004, 0x040007f6, 0x42001000,
-- 0x00103f62, 0x0201f800, 0x00105cc9, 0x5c03e000,
-- 0x04000d7e, 0x80000580, 0x1c01f000, 0x4d300000,
-- 0x4d180000, 0x4d3c0000, 0x0401fd82, 0x4df00000,
-- 0x4a0378e4, 0x0000000f, 0x0401fa02, 0x417a3000,
-- 0x59926004, 0x813261c0, 0x04000010, 0x417a7800,
-- 0x0201f800, 0x00104728, 0x0400000a, 0x59300c06,
-- 0x82040580, 0x00000003, 0x04000004, 0x82040580,
-- 0x00000006, 0x04020003, 0x42027800, 0x00000002,
-- 0x0201f800, 0x00108997, 0x811a3000, 0x83180480,
-- 0x00000005, 0x040017eb, 0x42000800, 0x00000040,
-- 0x0201f800, 0x00101395, 0x4a0378e4, 0x0000000a,
-- 0x5c03e000, 0x04000d55, 0x5c027800, 0x5c023000,
-- 0x5c026000, 0x1c01f000, 0x4803c856, 0x4d300000,
-- 0x0401fd58, 0x4df00000, 0x59c80840, 0x82040540,
-- 0x00000010, 0x48039040, 0x59c41008, 0x82080500,
-- 0xffffff7f, 0x48038808, 0x4c040000, 0x4c080000,
-- 0x42001000, 0x00000003, 0x0401f9c5, 0x598e600d,
-- 0x813261c0, 0x04020f9d, 0x040009ca, 0x497b2807,
-- 0x0401f80a, 0x5c001000, 0x5c000800, 0x480b8808,
-- 0x84040d74, 0x48079040, 0x5c03e000, 0x04000d33,
-- 0x5c026000, 0x1c01f000, 0x4d380000, 0x4d180000,
-- 0x4d300000, 0x4d900000, 0x4dd00000, 0x4da40000,
-- 0x4d140000, 0x59c41004, 0x480bc857, 0x82080500,
-- 0x00003ff0, 0x04000025, 0x417a3000, 0x4c080000,
-- 0x0201f800, 0x00105d9b, 0x5c001000, 0x82080500,
-- 0x00000210, 0x04020004, 0x811a3000, 0x80081102,
-- 0x0401f7f7, 0x0401f9c6, 0x59926004, 0x4933c857,
-- 0x813261c0, 0x04020005, 0x59c400a3, 0x8c00051a,
-- 0x02000800, 0x00100615, 0x0401fea1, 0x04000009,
-- 0x0401fc4d, 0x42027000, 0x00000049, 0x59300004,
-- 0x8c00050c, 0x02020800, 0x000208d8, 0x0401f007,
-- 0x42027000, 0x0000004a, 0x4a026203, 0x00000003,
-- 0x0201f800, 0x000208d8, 0x5c022800, 0x5c034800,
-- 0x5c03a000, 0x5c032000, 0x5c026000, 0x5c023000,
-- 0x5c027000, 0x1c01f000, 0x4d300000, 0x4d180000,
-- 0x4d900000, 0x0401fcff, 0x42001000, 0x00000000,
-- 0x598c0000, 0x82000580, 0x00000005, 0x04000974,
-- 0x417a3000, 0x811b20c8, 0x83932400, 0x0000bf32,
-- 0x59900001, 0x82000580, 0x00000001, 0x0402000d,
-- 0x42000800, 0x000007d0, 0x59926004, 0x59300011,
-- 0x82000500, 0xfff00000, 0x80000540, 0x04000003,
-- 0x42000800, 0x00001b58, 0x0201f800, 0x00105d8d,
-- 0x811a3000, 0x83180480, 0x00000005, 0x040017ea,
-- 0x59c81040, 0x84081534, 0x480b9040, 0x0401fcd3,
-- 0x5c032000, 0x5c023000, 0x5c026000, 0x1c01f000,
-- 0x4933c857, 0x4d900000, 0x4dd00000, 0x4da40000,
-- 0x4d140000, 0x4d380000, 0x0401fcd2, 0x4df00000,
-- 0x59300004, 0x8c00053e, 0x04020007, 0x8c000520,
-- 0x04000026, 0x0201f800, 0x001068a3, 0x04000023,
-- 0x0401f02b, 0x598c000d, 0x81300580, 0x04000012,
-- 0x0201f800, 0x00108a8a, 0x04020025, 0x0401f91b,
-- 0x04000023, 0x48038804, 0x0401f961, 0x0201f800,
-- 0x001010ca, 0x0201f800, 0x001068c1, 0x42027000,
-- 0x00000049, 0x59300004, 0x8c00050c, 0x0402000d,
-- 0x0401f00e, 0x59c40004, 0x8c000504, 0x04000014,
-- 0x4a038804, 0x00000004, 0x0401fc18, 0x42027000,
-+ 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x491bc857, 0x4933c857, 0x4d900000, 0x4dd00000,
-+ 0x4da40000, 0x4d140000, 0x0401fdc8, 0x4df00000,
-+ 0x0401fa7b, 0x59900004, 0x800001c0, 0x04000011,
-+ 0x81300580, 0x0402000f, 0x59300004, 0x84000520,
-+ 0x48026004, 0x0401ff4d, 0x04020009, 0x5c03e000,
-+ 0x04000da7, 0x80000580, 0x5c022800, 0x5c034800,
-+ 0x5c03a000, 0x5c032000, 0x1c01f000, 0x0401fce1,
-+ 0x42027000, 0x00000049, 0x59300004, 0x84000520,
-+ 0x48026004, 0x8c00050c, 0x02020800, 0x000207df,
-+ 0x5c03e000, 0x04000d96, 0x82000540, 0x00000001,
-+ 0x5c022800, 0x5c034800, 0x5c03a000, 0x5c032000,
-+ 0x1c01f000, 0x4933c857, 0x0401fda0, 0x4df00000,
-+ 0x598c000d, 0x80026540, 0x04000012, 0x59300004,
-+ 0x84000520, 0x48026004, 0x0401ff86, 0x04000017,
-+ 0x0401fce4, 0x42027000, 0x00000013, 0x59300004,
-+ 0x8c00050c, 0x02020800, 0x000207df, 0x5c03e000,
-+ 0x04000d7b, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x836c1580, 0x00000001, 0x040007f9, 0x836c1580,
-+ 0x00000004, 0x040007f6, 0x42001000, 0x00103df2,
-+ 0x0201f800, 0x00105b6f, 0x5c03e000, 0x04000d6c,
-+ 0x80000580, 0x1c01f000, 0x4d300000, 0x4d180000,
-+ 0x4d3c0000, 0x0401fd79, 0x4df00000, 0x4a0378e4,
-+ 0x0000000f, 0x0401fa07, 0x417a3000, 0x59926004,
-+ 0x813261c0, 0x04000010, 0x417a7800, 0x0201f800,
-+ 0x001045f8, 0x0400000a, 0x59300c06, 0x82040580,
-+ 0x00000003, 0x04000004, 0x82040580, 0x00000006,
-+ 0x04020003, 0x42027800, 0x00000002, 0x0201f800,
-+ 0x001083e0, 0x811a3000, 0x83180480, 0x00000005,
-+ 0x040017eb, 0x42000800, 0x00000040, 0x0201f800,
-+ 0x00101265, 0x4a0378e4, 0x0000000a, 0x5c03e000,
-+ 0x04000d43, 0x5c027800, 0x5c023000, 0x5c026000,
-+ 0x1c01f000, 0x4803c856, 0x4d300000, 0x0401fd4f,
-+ 0x4df00000, 0x59c80840, 0x82040540, 0x00000010,
-+ 0x48039040, 0x59c41008, 0x82080500, 0xffffff7f,
-+ 0x48038808, 0x4c040000, 0x4c080000, 0x42001000,
-+ 0x00000003, 0x0401f9c6, 0x598e600d, 0x813261c0,
-+ 0x04020f9d, 0x040009cf, 0x497b2807, 0x0401f80a,
-+ 0x5c001000, 0x5c000800, 0x480b8808, 0x84040d74,
-+ 0x48079040, 0x5c03e000, 0x04000d21, 0x5c026000,
-+ 0x1c01f000, 0x4d380000, 0x4d180000, 0x4d300000,
-+ 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-+ 0x59c41004, 0x480bc857, 0x82080500, 0x00003ff0,
-+ 0x04000025, 0x417a3000, 0x4c080000, 0x0201f800,
-+ 0x00105c41, 0x5c001000, 0x82080500, 0x00000210,
-+ 0x04020004, 0x811a3000, 0x80081102, 0x0401f7f7,
-+ 0x0401f9cf, 0x59926004, 0x4933c857, 0x813261c0,
-+ 0x04020005, 0x59c400a3, 0x8c00051a, 0x02000800,
-+ 0x001004ef, 0x0401fea1, 0x04000009, 0x0401fc3d,
-+ 0x42027000, 0x00000049, 0x59300004, 0x8c00050c,
-+ 0x02020800, 0x000207df, 0x0401f007, 0x42027000,
-+ 0x0000004a, 0x4a026203, 0x00000003, 0x0201f800,
-+ 0x000207df, 0x5c022800, 0x5c034800, 0x5c03a000,
-+ 0x5c032000, 0x5c026000, 0x5c023000, 0x5c027000,
-+ 0x1c01f000, 0x4d300000, 0x4d180000, 0x4d900000,
-+ 0x0401fcf6, 0x42001000, 0x00000000, 0x598c0000,
-+ 0x82000580, 0x00000005, 0x04000975, 0x417a3000,
-+ 0x811b20c8, 0x83932400, 0x0000bf32, 0x59900001,
-+ 0x82000580, 0x00000001, 0x0402000d, 0x42000800,
-+ 0x000007d0, 0x59926004, 0x59300011, 0x82000500,
-+ 0xfff00000, 0x80000540, 0x04000003, 0x42000800,
-+ 0x00001b58, 0x0201f800, 0x00105c33, 0x811a3000,
-+ 0x83180480, 0x00000005, 0x040017ea, 0x59c81040,
-+ 0x84081534, 0x480b9040, 0x0401fcc1, 0x5c032000,
-+ 0x5c023000, 0x5c026000, 0x1c01f000, 0x4933c857,
-+ 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-+ 0x4d380000, 0x0401fcc9, 0x4df00000, 0x59300004,
-+ 0x8c00053e, 0x04020007, 0x8c000520, 0x04000027,
-+ 0x0201f800, 0x00106379, 0x04000024, 0x0401f02c,
-+ 0x598c000d, 0x81300580, 0x04000012, 0x0201f800,
-+ 0x001084d5, 0x04020026, 0x0401f91c, 0x04000024,
-+ 0x48038804, 0x0401f96a, 0x0201f800, 0x00100f95,
-+ 0x0201f800, 0x001063a4, 0x42027000, 0x00000049,
-+ 0x59300004, 0x8c00050c, 0x0402000e, 0x0401f00f,
-+ 0x59c40004, 0x8c000504, 0x04000015, 0x4a038804,
-+ 0x00000004, 0x0201f800, 0x001063c4, 0x42027000,
- 0x00000013, 0x59300004, 0x8c00050c, 0x04000003,
-- 0x0201f800, 0x000208d8, 0x5c03e000, 0x04000c9b,
-+ 0x0201f800, 0x000207df, 0x5c03e000, 0x04000c88,
- 0x5c027000, 0x5c022800, 0x5c034800, 0x5c03a000,
- 0x5c032000, 0x80000580, 0x1c01f000, 0x5c03e000,
-- 0x04000c92, 0x5c027000, 0x5c022800, 0x5c034800,
-+ 0x04000c7f, 0x5c027000, 0x5c022800, 0x5c034800,
- 0x5c03a000, 0x5c032000, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x497b2807, 0x0401fc92, 0x59c400af,
-- 0x800001c0, 0x04020004, 0x0401fc84, 0x0201f000,
-- 0x00101565, 0x598c000f, 0x82001480, 0x00000002,
-+ 0x1c01f000, 0x497b2807, 0x0401fc88, 0x59c400af,
-+ 0x800001c0, 0x04020004, 0x0401fc71, 0x0201f000,
-+ 0x00101429, 0x598c000f, 0x82001480, 0x00000002,
- 0x04021007, 0x80000000, 0x4803180f, 0x80000580,
-- 0x0201f800, 0x00105d86, 0x0400000e, 0x0401fed7,
-- 0x0402000c, 0x0401fdc5, 0x0400000a, 0x0201f800,
-- 0x0010a7ee, 0x0401f918, 0x4d380000, 0x42027000,
-- 0x00000014, 0x0201f800, 0x000208d8, 0x5c027000,
-- 0x0401fc6a, 0x0201f000, 0x00101565, 0x4d900000,
-+ 0x0201f800, 0x00105c2c, 0x0400000e, 0x0401fed6,
-+ 0x0402000c, 0x0401fdbb, 0x0400000a, 0x0201f800,
-+ 0x0010a1df, 0x0401f91c, 0x4d380000, 0x42027000,
-+ 0x00000014, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x0401fc57, 0x0201f000, 0x00101429, 0x4d900000,
- 0x4dd00000, 0x4da40000, 0x4d140000, 0x4d300000,
-- 0x0201f800, 0x00105d9b, 0x0401fc6a, 0x59c400af,
-- 0x800001c0, 0x04000027, 0x0401f909, 0x59926004,
-+ 0x0201f800, 0x00105c41, 0x0401fc60, 0x59c400af,
-+ 0x800001c0, 0x04000027, 0x0401f911, 0x59926004,
- 0x4933c857, 0x59300004, 0x8c000516, 0x0400000b,
-- 0x0401fe86, 0x0402001f, 0x0201f800, 0x001068c1,
-- 0x0401fc52, 0x42000800, 0x80000804, 0x0201f800,
-- 0x00106466, 0x0401f017, 0x42001800, 0x00007530,
-- 0x0401f8c3, 0x04020004, 0x0201f800, 0x00105d8b,
-- 0x0401f010, 0x0401fe75, 0x0402000e, 0x0201f800,
-- 0x0010a7ee, 0x59300004, 0x8c00050c, 0x04020003,
-+ 0x0401fe85, 0x0402001f, 0x0201f800, 0x001063a4,
-+ 0x0401fc3f, 0x42000800, 0x80000804, 0x0201f800,
-+ 0x0010632f, 0x0401f017, 0x42001800, 0x00007530,
-+ 0x0401f8c3, 0x04020004, 0x0201f800, 0x00105c31,
-+ 0x0401f010, 0x0401fe74, 0x0402000e, 0x0201f800,
-+ 0x0010a1df, 0x59300004, 0x8c00050c, 0x04020003,
- 0x4a026203, 0x00000003, 0x4d380000, 0x42027000,
-- 0x0000004a, 0x0201f800, 0x000208d8, 0x5c027000,
-- 0x0401fc36, 0x5c026000, 0x5c022800, 0x5c034800,
-- 0x5c03a000, 0x5c032000, 0x0201f000, 0x00101565,
-+ 0x0000004a, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x0401fc23, 0x5c026000, 0x5c022800, 0x5c034800,
-+ 0x5c03a000, 0x5c032000, 0x0201f000, 0x00101429,
- 0x4d900000, 0x4dd00000, 0x4da40000, 0x4d140000,
-- 0x4d300000, 0x4d2c0000, 0x0401fc32, 0x0401f8d4,
-+ 0x4d300000, 0x4d2c0000, 0x0401fc28, 0x0401f8dc,
- 0x59926004, 0x4933c857, 0x0401f882, 0x04000016,
-- 0x0201f800, 0x00105d9b, 0x813261c0, 0x04000034,
-- 0x59325808, 0x812e59c0, 0x02000800, 0x00100615,
-- 0x0201f800, 0x00104e0d, 0x0402001d, 0x592c0208,
-- 0x84000550, 0x48025a08, 0x0201f800, 0x00104f29,
-+ 0x0201f800, 0x00105c41, 0x813261c0, 0x04000034,
-+ 0x59325808, 0x812e59c0, 0x02000800, 0x001004ef,
-+ 0x0201f800, 0x00104ca6, 0x0402001d, 0x592c0208,
-+ 0x84000550, 0x48025a08, 0x0201f800, 0x00104de0,
- 0x04020027, 0x592c0208, 0x84000510, 0x48025a08,
-- 0x0401f023, 0x0201f800, 0x00105d8b, 0x0401f020,
-- 0x0201f800, 0x0010a7ee, 0x0401fd99, 0x592c0208,
-+ 0x0401f023, 0x0201f800, 0x00105c31, 0x0401f020,
-+ 0x0201f800, 0x0010a1df, 0x0401fd98, 0x592c0208,
- 0x84000550, 0x48025a08, 0x4d380000, 0x42027000,
- 0x0000004a, 0x4a026203, 0x00000003, 0x0201f800,
-- 0x000208d8, 0x5c027000, 0x0401f011, 0x59900006,
-+ 0x000207df, 0x5c027000, 0x0401f011, 0x59900006,
- 0x82000500, 0xffff0000, 0x040207ee, 0x59c408af,
- 0x82040480, 0x000003e8, 0x040217ea, 0x59900006,
- 0x82000400, 0x00010000, 0x48032006, 0x0201f800,
-- 0x00105d8b, 0x0201f800, 0x00103f37, 0x5c025800,
-+ 0x00105c31, 0x0201f800, 0x00103dcb, 0x5c025800,
- 0x5c026000, 0x5c022800, 0x5c034800, 0x5c03a000,
-- 0x5c032000, 0x0201f000, 0x00106982, 0x4d300000,
-- 0x4d2c0000, 0x0201f800, 0x0010698c, 0x598e600d,
-+ 0x5c032000, 0x0201f000, 0x00106463, 0x4d300000,
-+ 0x4d2c0000, 0x0201f800, 0x00106476, 0x598e600d,
- 0x4933c857, 0x59c41004, 0x8c081500, 0x04000007,
-- 0x0201f800, 0x00104e0d, 0x04020007, 0x0201f800,
-- 0x00104f29, 0x0402002f, 0x0201f800, 0x00105d86,
-+ 0x0201f800, 0x00104ca6, 0x04020007, 0x0201f800,
-+ 0x00104de0, 0x0402002f, 0x0201f800, 0x00105c2c,
- 0x0401f02c, 0x598c000f, 0x80000540, 0x04020011,
- 0x59c408af, 0x82040480, 0x000003e8, 0x0402100d,
- 0x598c080f, 0x80040800, 0x4807180f, 0x0201f800,
-- 0x00105d86, 0x42000000, 0x0010b650, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00103f37, 0x0401f019,
-- 0x0401fdad, 0x813261c0, 0x04020003, 0x0401f849,
-- 0x0401f014, 0x0201f800, 0x0010a7ee, 0x59300406,
-+ 0x00105c2c, 0x42000000, 0x0010b020, 0x0201f800,
-+ 0x0010a260, 0x0201f800, 0x00103dcb, 0x0401f019,
-+ 0x0401fdac, 0x813261c0, 0x04020003, 0x0401f84d,
-+ 0x0401f014, 0x0201f800, 0x0010a1df, 0x59300406,
- 0x82000580, 0x00000003, 0x04020007, 0x59325808,
- 0x812e59c0, 0x04000004, 0x592c0208, 0x84000550,
-- 0x48025a08, 0x0401f854, 0x4d380000, 0x42027000,
-- 0x00000014, 0x0201f800, 0x000208d8, 0x5c027000,
-- 0x5c025800, 0x5c026000, 0x0201f000, 0x00106982,
-- 0x59c40804, 0x83180400, 0x00106dec, 0x50000000,
-+ 0x48025a08, 0x0401f858, 0x4d380000, 0x42027000,
-+ 0x00000014, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x5c025800, 0x5c026000, 0x0201f000, 0x00106463,
-+ 0x59c40804, 0x83180400, 0x001068e0, 0x50000000,
- 0x80040500, 0x1c01f000, 0x59c40804, 0x83180400,
-- 0x00106df1, 0x50000000, 0x80040500, 0x1c01f000,
-+ 0x001068e5, 0x50000000, 0x80040500, 0x1c01f000,
- 0x00000210, 0x00000420, 0x00000840, 0x00001080,
- 0x00002100, 0x00004000, 0x00008000, 0x00010000,
- 0x00020000, 0x00040000, 0x00080000, 0x00100000,
-@@ -7094,239 +6758,240 @@ uint32_t risc_code01[] = {
- 0x80040120, 0x800c0480, 0x04021004, 0x82000540,
- 0x00000001, 0x0401f005, 0x82040c00, 0x00010000,
- 0x48072006, 0x80000580, 0x1c01f000, 0x480bc857,
-- 0x0201f800, 0x0010698c, 0x4df00000, 0x480b1800,
-- 0x5c03e000, 0x02000800, 0x00106982, 0x1c01f000,
-- 0x4803c856, 0x0201f800, 0x0010698c, 0x4df00000,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x480b1800,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x4803c856, 0x0201f800, 0x00106476, 0x4df00000,
- 0x497b180d, 0x497b1803, 0x497b180e, 0x497b180f,
- 0x497b1810, 0x598c0000, 0x82000580, 0x00000003,
- 0x04000009, 0x836c0580, 0x00000002, 0x04020004,
- 0x4a031800, 0x00000005, 0x0401f003, 0x4a031800,
-- 0x00000000, 0x5c03e000, 0x02000800, 0x00106982,
-+ 0x00000000, 0x5c03e000, 0x02000800, 0x00106463,
- 0x1c01f000, 0x59300004, 0x8c00050c, 0x04020003,
-- 0x4a026203, 0x00000001, 0x1c01f000, 0x83180480,
-- 0x00000005, 0x02021800, 0x00100615, 0x491bc857,
-+ 0x4a026203, 0x00000001, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x83180480,
-+ 0x00000005, 0x02021800, 0x001004ef, 0x491bc857,
- 0x811b20c8, 0x83932400, 0x0000bf32, 0x811ba0ca,
-- 0x83d3a400, 0x00007600, 0x83180400, 0x00106e41,
-+ 0x83d3a400, 0x00007600, 0x83180400, 0x0010693d,
- 0x50034800, 0x811a28c2, 0x83162c00, 0x00006100,
-- 0x1c01f000, 0x0010b559, 0x0010b570, 0x0010b587,
-- 0x0010b59e, 0x0010b5b5, 0x4933c857, 0x59300406,
-- 0x82000c80, 0x00000012, 0x04021016, 0x4803c857,
-- 0x04011000, 0x0c01f001, 0x00106e60, 0x00106f03,
-- 0x00107249, 0x001072cf, 0x00106f03, 0x00107249,
-- 0x001072cf, 0x00106e60, 0x00106f03, 0x00106e60,
-- 0x00106e60, 0x00106e60, 0x00106e60, 0x00106e60,
-- 0x00106e60, 0x00106e60, 0x00106e66, 0x00106e66,
-- 0x0201f800, 0x0010698c, 0x0201f800, 0x001068f6,
-- 0x0201f000, 0x00106982, 0x42001000, 0x0010b5f4,
-+ 0x1c01f000, 0x0010af29, 0x0010af40, 0x0010af57,
-+ 0x0010af6e, 0x0010af85, 0x4933c857, 0x59300406,
-+ 0x82000c80, 0x00000012, 0x04021015, 0x04011000,
-+ 0x0c01f001, 0x0010695b, 0x001069fe, 0x00106d41,
-+ 0x00106dc7, 0x001069fe, 0x00106d41, 0x00106dc7,
-+ 0x0010695b, 0x001069fe, 0x0010695b, 0x0010695b,
-+ 0x0010695b, 0x0010695b, 0x0010695b, 0x0010695b,
-+ 0x0010695b, 0x00106962, 0x00106962, 0x4803c857,
-+ 0x0201f800, 0x00106476, 0x0201f800, 0x001063c4,
-+ 0x0201f000, 0x00106463, 0x42001000, 0x0010afc4,
- 0x50081000, 0x4930100c, 0x58080002, 0x82000580,
-- 0x00000100, 0x0402003e, 0x59325808, 0x812e59c0,
-- 0x02000800, 0x00100615, 0x59326809, 0x813669c0,
-- 0x04000025, 0x592c040b, 0x82000500, 0x0000e000,
-- 0x04000003, 0x0401fbc9, 0x0401f002, 0x0401fbb9,
-- 0x592c000d, 0x82000500, 0x00000003, 0x04000007,
-- 0x82000580, 0x00000003, 0x80000000, 0x58d00802,
-- 0x80040540, 0x4801a002, 0x42001000, 0x0010b5f4,
-- 0x50081000, 0x4930100b, 0x492c100a, 0x82d00400,
-- 0x00000006, 0x48001003, 0x592c000d, 0x82000400,
-- 0x00000003, 0x80000104, 0x48001004, 0x592c000e,
-- 0x48001007, 0x592c000f, 0x48001008, 0x0201f000,
-- 0x001008a1, 0x42026800, 0x0010bc0c, 0x592c080a,
-- 0x48066802, 0x82040500, 0x00ffff00, 0x04000007,
-- 0x497a6a12, 0x59a81010, 0x82081500, 0x00ffff00,
-- 0x80080580, 0x040207d0, 0x82040d00, 0x000000ff,
-- 0x800408d0, 0x48066a12, 0x0401f7cb, 0x1c01f000,
-- 0x4d2c0000, 0x4d300000, 0x4c580000, 0x4c540000,
-- 0x4c500000, 0x5832580a, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x58300002, 0x4a006002, 0x00000100,
-- 0x82000580, 0x00000100, 0x04020020, 0x5830000b,
-- 0x5832600c, 0x81300580, 0x04020012, 0x0401f82f,
-- 0x04020014, 0x592c080d, 0x82040c00, 0x00000003,
-- 0x80040904, 0x4004b000, 0x4200a000, 0x0010b349,
-- 0x4050a800, 0x0201f800, 0x0010a94f, 0x42001000,
-- 0x0000dc00, 0x0201f800, 0x0010763b, 0x0401f005,
-- 0x4803c857, 0x4933c857, 0x0401f81c, 0x04000f93,
-- 0x5c00a000, 0x5c00a800, 0x5c00b000, 0x5c026000,
-- 0x5c025800, 0x1c01f000, 0x5830000b, 0x5832600c,
-- 0x4803c857, 0x4933c857, 0x81300580, 0x040207f1,
-- 0x0401f80e, 0x040207f3, 0x4803c857, 0x0201f800,
-- 0x00106619, 0x02020800, 0x00100615, 0x4a025a06,
-- 0x00000002, 0x0201f800, 0x00020381, 0x0201f800,
-- 0x00107698, 0x0401f7e7, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x598c000d, 0x81300580, 0x04020009,
-- 0x598c0005, 0x81300580, 0x04020006, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x80000580, 0x1c01f000,
-- 0x4803c857, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x59300403,
-- 0x82000c80, 0x00000056, 0x02021800, 0x00100615,
-- 0x4803c857, 0x0c01f001, 0x0010707a, 0x00107095,
-- 0x001070a6, 0x001071a9, 0x00107169, 0x0010716d,
-- 0x0010717e, 0x00107192, 0x00107187, 0x00107192,
-- 0x001071cd, 0x00107192, 0x0010720f, 0x00107192,
-- 0x0010721d, 0x00107192, 0x00107187, 0x00107192,
-- 0x00107221, 0x00106f60, 0x00106f60, 0x00106f60,
-- 0x00106f60, 0x00106f60, 0x00106f60, 0x00106f60,
-- 0x00106f60, 0x00106f60, 0x00106f60, 0x00106f60,
-- 0x001072ed, 0x0010730c, 0x00107316, 0x00106f60,
-- 0x0010732c, 0x0010717e, 0x00106f60, 0x0010717e,
-- 0x00107192, 0x00106f60, 0x001070a6, 0x001071a9,
-- 0x00106f60, 0x0010737c, 0x00107192, 0x00106f60,
-- 0x0010738c, 0x00107192, 0x00106f60, 0x00107187,
-- 0x0010706b, 0x00106f62, 0x00106f60, 0x001073a3,
-- 0x001073dc, 0x00107456, 0x00106f60, 0x00107466,
-- 0x0010717c, 0x00107459, 0x00106f60, 0x00107338,
-- 0x0010747f, 0x00106f60, 0x001074b4, 0x00107507,
-- 0x00106f60, 0x00106f77, 0x00106fdd, 0x00106fea,
-- 0x00106f60, 0x0010717e, 0x00106f60, 0x00107031,
-- 0x0010703c, 0x00106f60, 0x00106f60, 0x00106f8b,
-- 0x00106fb0, 0x00107546, 0x00107587, 0x001075ad,
-- 0x00106f60, 0x00106f60, 0x00106f60, 0x0010757b,
-- 0x0201f800, 0x00100615, 0x0401fad2, 0x59325808,
-- 0x592c0009, 0x4801a006, 0x592c000a, 0x4801a007,
-- 0x592c000b, 0x4801a008, 0x592c000c, 0x4801a009,
-- 0x592c000d, 0x4801a00a, 0x4979a00b, 0x592c0809,
-- 0x82040d00, 0x00000fff, 0x80040904, 0x42001000,
-- 0x0000dc00, 0x0201f000, 0x0010763b, 0x4a026202,
-- 0x0000ffff, 0x0401fabb, 0x4d2c0000, 0x4a01a006,
-- 0x05000000, 0x59325808, 0x592c0009, 0x4801a007,
-- 0x592c000a, 0x4801a008, 0x592c000b, 0x4801a009,
-- 0x42000800, 0x00000004, 0x42001000, 0x0000dc00,
-- 0x5c025800, 0x0201f000, 0x0010763b, 0x4c580000,
-- 0x4c500000, 0x4c540000, 0x4d2c0000, 0x0401faa5,
-- 0x59325808, 0x5930040b, 0x800000c2, 0x4200a800,
-- 0x0010b349, 0x592cb205, 0x832ca400, 0x00000006,
-- 0x0201f800, 0x0010a93e, 0x40580000, 0x8054ac00,
-- 0x592c0001, 0x80000540, 0x04000003, 0x40025800,
-- 0x0401f7f5, 0x4200a000, 0x0010b349, 0x4050a800,
-- 0x5930b40b, 0x0201f800, 0x0010a94f, 0x59300c0b,
-+ 0x00000100, 0x0402003c, 0x59325808, 0x812e59c0,
-+ 0x02000800, 0x001004ef, 0x492fc856, 0x59326809,
-+ 0x813669c0, 0x04000022, 0x592c040b, 0x82000500,
-+ 0x0000e000, 0x04000003, 0x0401fbc4, 0x0401f002,
-+ 0x0401fbb4, 0x592c000d, 0x82000500, 0x00000003,
-+ 0x04000007, 0x82000580, 0x00000003, 0x80000000,
-+ 0x58d00802, 0x80040540, 0x4801a002, 0x42001000,
-+ 0x0010afc4, 0x50081000, 0x4930100b, 0x492c100a,
-+ 0x82d00400, 0x00000006, 0x48001003, 0x592c000d,
-+ 0x48001005, 0x592c000e, 0x48001007, 0x592c000f,
-+ 0x48001008, 0x0201f000, 0x0010079e, 0x42026800,
-+ 0x0010b5dc, 0x592c080a, 0x48066802, 0x82040500,
-+ 0x00ffff00, 0x04000007, 0x497a6a12, 0x59a8100f,
-+ 0x82081500, 0x00ffff00, 0x80080580, 0x040207d3,
-+ 0x82040d00, 0x000000ff, 0x800408d0, 0x48066a12,
-+ 0x0401f7ce, 0x1c01f000, 0x4d2c0000, 0x4d300000,
-+ 0x4c580000, 0x4c540000, 0x4c500000, 0x5832580a,
-+ 0x812e59c0, 0x02000800, 0x001004ef, 0x58300002,
-+ 0x4a006002, 0x00000100, 0x82000580, 0x00000100,
-+ 0x04020020, 0x5830000b, 0x5832600c, 0x81300580,
-+ 0x04020012, 0x0401f830, 0x04020014, 0x592c080d,
-+ 0x82040c00, 0x00000003, 0x80040904, 0x4004b000,
-+ 0x4200a000, 0x0010ad19, 0x4050a800, 0x0201f800,
-+ 0x0010a341, 0x42001000, 0x0000dc00, 0x0201f800,
-+ 0x00107130, 0x0401f005, 0x4803c857, 0x4933c857,
-+ 0x0401f81d, 0x04000f95, 0x5c00a000, 0x5c00a800,
-+ 0x5c00b000, 0x5c026000, 0x5c025800, 0x1c01f000,
-+ 0x5830000b, 0x5832600c, 0x4803c857, 0x4933c857,
-+ 0x81300580, 0x040207f1, 0x0401f80f, 0x040207f3,
-+ 0x4803c857, 0x0201f800, 0x0010ccce, 0x80c40040,
-+ 0x02020800, 0x001004ef, 0x4a025a06, 0x00000002,
-+ 0x0201f800, 0x000202e9, 0x0201f800, 0x0010719c,
-+ 0x0401f7e6, 0x0201f800, 0x00106476, 0x4df00000,
-+ 0x598c000d, 0x81300580, 0x04020009, 0x598c0005,
-+ 0x81300580, 0x04020006, 0x5c03e000, 0x02000800,
-+ 0x00106463, 0x80000580, 0x1c01f000, 0x4803c857,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x82000540,
-+ 0x00000001, 0x1c01f000, 0x59300403, 0x82000c80,
-+ 0x00000056, 0x02021800, 0x001004ef, 0x4803c857,
-+ 0x0c01f001, 0x00106b75, 0x00106b90, 0x00106ba1,
-+ 0x00106ca1, 0x00106c63, 0x00106c67, 0x00106c76,
-+ 0x00106c8a, 0x00106c7f, 0x00106c8a, 0x00106cc5,
-+ 0x00106c8a, 0x00106d07, 0x00106c8a, 0x00106d15,
-+ 0x00106c8a, 0x00106c7f, 0x00106c8a, 0x00106d19,
-+ 0x00106a5b, 0x00106a5b, 0x00106a5b, 0x00106a5b,
-+ 0x00106a5b, 0x00106a5b, 0x00106a5b, 0x00106a5b,
-+ 0x00106a5b, 0x00106a5b, 0x00106a5b, 0x00106de5,
-+ 0x00106e04, 0x00106e0e, 0x00106a5b, 0x00106e24,
-+ 0x00106c76, 0x00106a5b, 0x00106c76, 0x00106c8a,
-+ 0x00106a5b, 0x00106ba1, 0x00106ca1, 0x00106a5b,
-+ 0x00106e74, 0x00106c8a, 0x00106a5b, 0x00106e84,
-+ 0x00106c8a, 0x00106a5b, 0x00106c7f, 0x00106b66,
-+ 0x00106a5d, 0x00106a5b, 0x00106e9b, 0x00106ed1,
-+ 0x00106f4b, 0x00106a5b, 0x00106f5b, 0x00106c74,
-+ 0x00106f4e, 0x00106a5b, 0x00106e30, 0x00106f74,
-+ 0x00106a5b, 0x00106fa9, 0x00106ffc, 0x00106a5b,
-+ 0x00106a72, 0x00106ad8, 0x00106ae5, 0x00106a5b,
-+ 0x00106c76, 0x00106a5b, 0x00106b2c, 0x00106b37,
-+ 0x00106a5b, 0x00106a5b, 0x00106a86, 0x00106aab,
-+ 0x0010703b, 0x0010707c, 0x001070a2, 0x00106a5b,
-+ 0x00106a5b, 0x00106a5b, 0x00107070, 0x0201f800,
-+ 0x001004ef, 0x0401facf, 0x59325808, 0x592c0009,
-+ 0x4801a006, 0x592c000a, 0x4801a007, 0x592c000b,
-+ 0x4801a008, 0x592c000c, 0x4801a009, 0x592c000d,
-+ 0x4801a00a, 0x4979a00b, 0x592c0809, 0x82040d00,
-+ 0x00000fff, 0x80040904, 0x42001000, 0x0000dc00,
-+ 0x0201f000, 0x00107130, 0x4a026202, 0x0000ffff,
-+ 0x0401fab8, 0x4d2c0000, 0x4a01a006, 0x05000000,
-+ 0x59325808, 0x592c0009, 0x4801a007, 0x592c000a,
-+ 0x4801a008, 0x592c000b, 0x4801a009, 0x42000800,
-+ 0x00000004, 0x42001000, 0x0000dc00, 0x5c025800,
-+ 0x0201f000, 0x00107130, 0x4c580000, 0x4c500000,
-+ 0x4c540000, 0x4d2c0000, 0x0401faa2, 0x59325808,
-+ 0x5930040b, 0x800000c2, 0x4200a800, 0x0010ad19,
-+ 0x592cb205, 0x832ca400, 0x00000006, 0x0201f800,
-+ 0x0010a330, 0x40580000, 0x8054ac00, 0x592c0001,
-+ 0x80000540, 0x04000003, 0x40025800, 0x0401f7f5,
-+ 0x4200a000, 0x0010ad19, 0x4050a800, 0x5930b40b,
-+ 0x0201f800, 0x0010a341, 0x59300c0b, 0x42001000,
-+ 0x0000dc00, 0x5c025800, 0x5c00a800, 0x5c00b000,
-+ 0x5c00a000, 0x0201f000, 0x00107130, 0x4c580000,
-+ 0x4c500000, 0x4c540000, 0x4d2c0000, 0x42034800,
-+ 0x0010ad12, 0x0401fa89, 0x59325808, 0x592c0802,
-+ 0x4807c857, 0x40041000, 0x80040904, 0x82081500,
-+ 0x00000003, 0x04000008, 0x80040800, 0x82081580,
-+ 0x00000003, 0x80081000, 0x58d00002, 0x80080540,
-+ 0x4801a002, 0x4a025805, 0x02000000, 0x82d0ac00,
-+ 0x00000006, 0x592cb011, 0x832ca400, 0x00000005,
-+ 0x0201f800, 0x0010a330, 0x40580000, 0x8054ac00,
-+ 0x592e5801, 0x41780000, 0x812e5d40, 0x040207f6,
- 0x42001000, 0x0000dc00, 0x5c025800, 0x5c00a800,
-- 0x5c00b000, 0x5c00a000, 0x0201f000, 0x0010763b,
-- 0x4c580000, 0x4c500000, 0x4c540000, 0x4d2c0000,
-- 0x42034800, 0x0010b342, 0x0401fa8c, 0x59325808,
-- 0x592c0802, 0x4807c857, 0x40041000, 0x80040904,
-- 0x82081500, 0x00000003, 0x04000008, 0x80040800,
-- 0x82081580, 0x00000003, 0x80081000, 0x58d00002,
-- 0x80080540, 0x4801a002, 0x4a025805, 0x02000000,
-- 0x82d0ac00, 0x00000006, 0x592cb011, 0x832ca400,
-- 0x00000005, 0x0201f800, 0x0010a93e, 0x40580000,
-- 0x8054ac00, 0x592e5801, 0x41780000, 0x812e5d40,
-- 0x040207f6, 0x42001000, 0x0000dc00, 0x5c025800,
-- 0x5c00a800, 0x5c00b000, 0x5c00a000, 0x0201f000,
-- 0x0010763b, 0x0401fa57, 0x4a01a006, 0x78000000,
-- 0x5930001c, 0x840001c0, 0x4801a407, 0x4979a207,
-- 0x42000800, 0x00000002, 0x42001000, 0x0000dc00,
-- 0x0201f000, 0x0010763b, 0x4c580000, 0x4c540000,
-- 0x4c500000, 0x0401fa55, 0x4a01a006, 0x02000000,
-+ 0x5c00b000, 0x5c00a000, 0x0201f000, 0x00107130,
-+ 0x0401fa54, 0x4a01a006, 0x78000000, 0x5930001c,
-+ 0x840001c0, 0x4801a407, 0x4979a207, 0x42000800,
-+ 0x00000002, 0x42001000, 0x0000dc00, 0x0201f000,
-+ 0x00107130, 0x4c580000, 0x4c540000, 0x4c500000,
-+ 0x0401fa52, 0x4a01a006, 0x02000000, 0x59a80002,
-+ 0x4801a008, 0x59a80003, 0x4801a009, 0x59a80000,
-+ 0x4801a00a, 0x59a80001, 0x4801a00b, 0x5930001c,
-+ 0x82000d80, 0x0000e000, 0x04000016, 0x82000d80,
-+ 0x0000df00, 0x04000006, 0x4a01a407, 0x00000010,
-+ 0x42000800, 0x00000006, 0x0401f027, 0x4a03c840,
-+ 0x0010acb8, 0x4a03c842, 0x0000000d, 0x42001800,
-+ 0x0010acb8, 0x0201f800, 0x001006d7, 0x42000000,
-+ 0x0000df00, 0x4200a000, 0x0010acb8, 0x0401f00d,
-+ 0x4a03c840, 0x0010acc5, 0x4a03c842, 0x0000000d,
-+ 0x42001800, 0x0010acc5, 0x0201f800, 0x001006d7,
-+ 0x42000000, 0x0000e000, 0x4200a000, 0x0010acc5,
-+ 0x82000540, 0x00000010, 0x4801a407, 0x4a01a207,
-+ 0x00000034, 0x4200b000, 0x0000000d, 0x82d0ac00,
-+ 0x0000000c, 0x0201f800, 0x0010a330, 0x42000800,
-+ 0x00000013, 0x42001000, 0x0000dc00, 0x5c00a000,
-+ 0x5c00a800, 0x5c00b000, 0x0201f000, 0x00107130,
-+ 0x0401fa00, 0x4a01a006, 0x63000028, 0x5930001c,
-+ 0x4801a007, 0x42000800, 0x00000002, 0x42001000,
-+ 0x0000dc00, 0x0201f000, 0x00107130, 0x0401fa03,
-+ 0x41780000, 0x41780800, 0x42002000, 0x00080000,
-+ 0x0c01f81b, 0x80000000, 0x80040800, 0x42001000,
-+ 0x0000000c, 0x59841802, 0x8c0c1d00, 0x04020008,
-+ 0x42002000, 0x00050000, 0x0c01f811, 0x80000000,
-+ 0x80040800, 0x82081400, 0x00000004, 0x82080540,
-+ 0x02000000, 0x4801a006, 0x800408e0, 0x5930001c,
-+ 0x80040540, 0x4801a007, 0x80080904, 0x42001000,
-+ 0x0000dc00, 0x0201f000, 0x00107130, 0x00106b5c,
-+ 0x00106b5e, 0x00106b60, 0x00106b62, 0x00106b64,
-+ 0x4811a008, 0x1c01f000, 0x4811a009, 0x1c01f000,
-+ 0x4811a00a, 0x1c01f000, 0x4811a00b, 0x1c01f000,
-+ 0x4811a00c, 0x1c01f000, 0x4a026009, 0x0010b5dc,
-+ 0x59a8000f, 0x82000500, 0x000000ff, 0x800000d0,
-+ 0x42026800, 0x0010b5dc, 0x48026a12, 0x0401fa39,
-+ 0x41780800, 0x42001000, 0x00005c00, 0x0201f000,
-+ 0x00107130, 0x0401f9b7, 0x4a01a006, 0x52000000,
-+ 0x4979a007, 0x599c0017, 0x8c000500, 0x04000005,
-+ 0x599c0402, 0x0201f800, 0x0010150d, 0x4805a007,
- 0x59a80002, 0x4801a008, 0x59a80003, 0x4801a009,
- 0x59a80000, 0x4801a00a, 0x59a80001, 0x4801a00b,
-- 0x5930001c, 0x82000d80, 0x0000e000, 0x04000016,
-- 0x82000d80, 0x0000df00, 0x04000006, 0x4a01a407,
-- 0x00000010, 0x42000800, 0x00000006, 0x0401f027,
-- 0x4a03c840, 0x0010b2e7, 0x4a03c842, 0x0000000d,
-- 0x42001800, 0x0010b2e7, 0x0201f800, 0x001007f5,
-- 0x42000000, 0x0000df00, 0x4200a000, 0x0010b2e7,
-- 0x0401f00d, 0x4a03c840, 0x0010b2f4, 0x4a03c842,
-- 0x0000000d, 0x42001800, 0x0010b2f4, 0x0201f800,
-- 0x001007f5, 0x42000000, 0x0000e000, 0x4200a000,
-- 0x0010b2f4, 0x82000540, 0x00000010, 0x4801a407,
-- 0x4a01a207, 0x00000034, 0x4200b000, 0x0000000d,
-- 0x82d0ac00, 0x0000000c, 0x0201f800, 0x0010a93e,
-- 0x42000800, 0x00000013, 0x42001000, 0x0000dc00,
-- 0x5c00a000, 0x5c00a800, 0x5c00b000, 0x0201f000,
-- 0x0010763b, 0x0401fa03, 0x4a01a006, 0x63000028,
-- 0x5930001c, 0x4801a007, 0x42000800, 0x00000002,
-- 0x42001000, 0x0000dc00, 0x0201f000, 0x0010763b,
-- 0x0401fa06, 0x41780000, 0x41780800, 0x42002000,
-- 0x00080000, 0x0c01f81b, 0x80000000, 0x80040800,
-- 0x42001000, 0x0000000c, 0x59841802, 0x8c0c1d00,
-- 0x04020008, 0x42002000, 0x00050000, 0x0c01f811,
-- 0x80000000, 0x80040800, 0x82081400, 0x00000004,
-- 0x82080540, 0x02000000, 0x4801a006, 0x800408e0,
-- 0x5930001c, 0x80040540, 0x4801a007, 0x80080904,
-- 0x42001000, 0x0000dc00, 0x0201f000, 0x0010763b,
-- 0x00107061, 0x00107063, 0x00107065, 0x00107067,
-- 0x00107069, 0x4811a008, 0x1c01f000, 0x4811a009,
-- 0x1c01f000, 0x4811a00a, 0x1c01f000, 0x4811a00b,
-- 0x1c01f000, 0x4811a00c, 0x1c01f000, 0x4a026009,
-- 0x0010bc0c, 0x59a80010, 0x82000500, 0x000000ff,
-- 0x800000d0, 0x42026800, 0x0010bc0c, 0x48026a12,
-- 0x0401fa3c, 0x41780800, 0x42001000, 0x00005c00,
-- 0x0201f000, 0x0010763b, 0x0401f9ba, 0x4a01a006,
-- 0x52000000, 0x4979a007, 0x599c0017, 0x8c000500,
-- 0x04000005, 0x599c0402, 0x0201f800, 0x00101644,
-- 0x4805a007, 0x59a80002, 0x4801a008, 0x59a80003,
-- 0x4801a009, 0x59a80000, 0x4801a00a, 0x59a80001,
-- 0x4801a00b, 0x59a80010, 0x4801a00c, 0x42000800,
-- 0x00000007, 0x42001000, 0x0000dc00, 0x0201f000,
-- 0x0010763b, 0x4a026202, 0x0000ffff, 0x0401f99d,
-- 0x4a01a006, 0x05000000, 0x59a80010, 0x4801a007,
-- 0x59a80002, 0x59a80803, 0x4801a008, 0x4805a009,
-- 0x42000800, 0x00000004, 0x42001000, 0x0000dc00,
-- 0x0201f000, 0x0010763b, 0x4a026202, 0x0000ffff,
-- 0x0401f98c, 0x4d3c0000, 0x417a7800, 0x0201f800,
-- 0x00104745, 0x5c027800, 0x4a01a006, 0x03000000,
-- 0x59340403, 0x82000580, 0x000007fe, 0x0402006e,
-- 0x4a01a006, 0x04000000, 0x81a40800, 0x4a000800,
-- 0x22fffffe, 0x5934000a, 0x84000500, 0x4802680a,
-- 0x59c41002, 0x8408150c, 0x480b8802, 0x59a80026,
-- 0x8c000508, 0x04000010, 0x59a8002a, 0x4801a007,
-- 0x59a8002b, 0x82000500, 0xffff2000, 0x599c0818,
-- 0x8c040d16, 0x04000002, 0x8400056a, 0x4801a008,
-- 0x4a01a009, 0x00002710, 0x59a8002d, 0x4801a00a,
-- 0x0401f039, 0x59a8002a, 0x4801a007, 0x0201f800,
-- 0x00104e0d, 0x04020009, 0x497b8880, 0x82000500,
-- 0x0000ffff, 0x4c000000, 0x0201f800, 0x00101670,
-- 0x5c000000, 0x48038880, 0x59a8002b, 0x0201f800,
-- 0x00104e0d, 0x04020004, 0x82000500, 0x37ffffff,
-- 0x0401f003, 0x82000500, 0x3fffffff, 0x599c0818,
-- 0x8c040d16, 0x04000002, 0x8400056a, 0x59a80805,
-- 0x8c040d10, 0x04000019, 0x59300c03, 0x82041580,
-- 0x00000051, 0x04000015, 0x82041580, 0x00000031,
-- 0x04000012, 0x4c580000, 0x4c500000, 0x4c540000,
-- 0x4200b000, 0x00000004, 0x4200a000, 0x0010b6f9,
-- 0x82d0ac00, 0x0000001f, 0x4c000000, 0x0201f800,
-- 0x0010a93e, 0x5c000000, 0x5c00a800, 0x5c00a000,
-- 0x5c00b000, 0x8400057a, 0x4801a008, 0x4979a009,
-- 0x4979a00a, 0x59a80002, 0x59a80803, 0x4801a00b,
-- 0x4805a00c, 0x59a80000, 0x59a80801, 0x4801a00d,
-- 0x4805a00e, 0x4979a00f, 0x4979a010, 0x4979a011,
-- 0x4979a012, 0x4979a013, 0x4979a014, 0x4979a015,
-- 0x4979a016, 0x59a8002e, 0x84000576, 0x4801a017,
-- 0x59a8002f, 0x4801a018, 0x4979a019, 0x4979a01a,
-- 0x0401f043, 0x59a80026, 0x8c000508, 0x0400000d,
-- 0x59a8002a, 0x82000500, 0x0000ffff, 0x59c40880,
-- 0x80040d80, 0x04000007, 0x497b8880, 0x4c000000,
-- 0x0201f800, 0x00101670, 0x5c000000, 0x48038880,
-- 0x59a8002a, 0x4801a007, 0x4c640000, 0x4d2c0000,
-- 0x59a8c82b, 0x0201f800, 0x00108df4, 0x0400000d,
-- 0x0201f800, 0x00109360, 0x0402000a, 0x592c0207,
-- 0x8c00050e, 0x04000007, 0x8264cd00, 0x0000ffff,
-- 0x592c0009, 0x82000500, 0xffff0000, 0x8064cd40,
-- 0x4865a008, 0x5c025800, 0x5c00c800, 0x59a8002c,
-- 0x4801a009, 0x59a8002d, 0x4801a00a, 0x59a80002,
-+ 0x59a8000f, 0x4801a00c, 0x42000800, 0x00000007,
-+ 0x42001000, 0x0000dc00, 0x0201f000, 0x00107130,
-+ 0x4a026202, 0x0000ffff, 0x0401f99a, 0x4a01a006,
-+ 0x05000000, 0x59a8000f, 0x4801a007, 0x59a80002,
-+ 0x59a80803, 0x4801a008, 0x4805a009, 0x42000800,
-+ 0x00000004, 0x42001000, 0x0000dc00, 0x0201f000,
-+ 0x00107130, 0x4a026202, 0x0000ffff, 0x0401f989,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010461e,
-+ 0x5c027800, 0x4a01a006, 0x03000000, 0x59340403,
-+ 0x82000580, 0x000007fe, 0x0402006d, 0x4a01a006,
-+ 0x04000000, 0x81a40800, 0x4a000800, 0x22fffffe,
-+ 0x5934000a, 0x84000500, 0x4802680a, 0x59c41002,
-+ 0x8408150c, 0x480b8802, 0x59a80023, 0x8c000508,
-+ 0x04000010, 0x59a80027, 0x4801a007, 0x59a80028,
-+ 0x82000500, 0xffff2000, 0x599c0818, 0x8c040d16,
-+ 0x04000002, 0x8400056a, 0x4801a008, 0x4a01a009,
-+ 0x00002710, 0x59a8002a, 0x4801a00a, 0x0401f038,
-+ 0x59a80027, 0x4801a007, 0x0201f800, 0x00104ca6,
-+ 0x04020009, 0x497b8880, 0x82000500, 0x0000ffff,
-+ 0x4c000000, 0x0201f800, 0x00101536, 0x5c000000,
-+ 0x48038880, 0x59a80028, 0x0201f800, 0x00104ca6,
-+ 0x04020004, 0x82000500, 0x37ffffff, 0x0401f003,
-+ 0x82000500, 0x3fffffff, 0x599c0818, 0x8c040d16,
-+ 0x04000002, 0x8400056a, 0x8d0e1d10, 0x04000019,
-+ 0x59300c03, 0x82041580, 0x00000051, 0x04000015,
-+ 0x82041580, 0x00000031, 0x04000012, 0x4c580000,
-+ 0x4c500000, 0x4c540000, 0x4200b000, 0x00000004,
-+ 0x4200a000, 0x0010b0c9, 0x82d0ac00, 0x0000001f,
-+ 0x4c000000, 0x0201f800, 0x0010a330, 0x5c000000,
-+ 0x5c00a800, 0x5c00a000, 0x5c00b000, 0x8400057a,
-+ 0x4801a008, 0x4979a009, 0x4979a00a, 0x59a80002,
- 0x59a80803, 0x4801a00b, 0x4805a00c, 0x59a80000,
- 0x59a80801, 0x4801a00d, 0x4805a00e, 0x4979a00f,
- 0x4979a010, 0x4979a011, 0x4979a012, 0x4979a013,
-- 0x4979a014, 0x4979a015, 0x4979a016, 0x59a8002e,
-- 0x4801a017, 0x59a8002f, 0x4801a018, 0x59a80030,
-- 0x4801a019, 0x59a80031, 0x4801a01a, 0x42000800,
-- 0x0000001d, 0x42001000, 0x0000dc00, 0x0201f000,
-- 0x0010763b, 0x0401f8cb, 0x4a01a006, 0x50000000,
-- 0x0401f7b5, 0x0401f8c7, 0x4a01a406, 0x21000010,
-- 0x4a01a206, 0x00000014, 0x4979a007, 0x4979a008,
-+ 0x4979a014, 0x4979a015, 0x4979a016, 0x59a8002b,
-+ 0x84000576, 0x4801a017, 0x59a8002c, 0x4801a018,
-+ 0x4979a019, 0x4979a01a, 0x0401f043, 0x59a80023,
-+ 0x8c000508, 0x0400000d, 0x59a80027, 0x82000500,
-+ 0x0000ffff, 0x59c40880, 0x80040d80, 0x04000007,
-+ 0x497b8880, 0x4c000000, 0x0201f800, 0x00101536,
-+ 0x5c000000, 0x48038880, 0x59a80027, 0x4801a007,
-+ 0x4c640000, 0x4d2c0000, 0x59a8c828, 0x0201f800,
-+ 0x0010883d, 0x0400000d, 0x0201f800, 0x00108de6,
-+ 0x0402000a, 0x592c0207, 0x8c00050e, 0x04000007,
-+ 0x8264cd00, 0x0000ffff, 0x592c0009, 0x82000500,
-+ 0xffff0000, 0x8064cd40, 0x4865a008, 0x5c025800,
-+ 0x5c00c800, 0x59a80029, 0x4801a009, 0x59a8002a,
-+ 0x4801a00a, 0x59a80002, 0x59a80803, 0x4801a00b,
-+ 0x4805a00c, 0x59a80000, 0x59a80801, 0x4801a00d,
-+ 0x4805a00e, 0x4979a00f, 0x4979a010, 0x4979a011,
-+ 0x4979a012, 0x4979a013, 0x4979a014, 0x4979a015,
-+ 0x4979a016, 0x59a8002b, 0x4801a017, 0x59a8002c,
-+ 0x4801a018, 0x59a8002d, 0x4801a019, 0x59a8002e,
-+ 0x4801a01a, 0x42000800, 0x0000001d, 0x42001000,
-+ 0x0000dc00, 0x0201f000, 0x00107130, 0x0401f8c9,
-+ 0x4a01a006, 0x50000000, 0x0401f7b5, 0x0401f8c5,
-+ 0x4a01a006, 0x21100014, 0x4979a007, 0x4979a008,
- 0x4979a009, 0x4979a00a, 0x42000800, 0x00000005,
-- 0x42001000, 0x0000dc00, 0x0201f000, 0x0010763b,
-+ 0x42001000, 0x0000dc00, 0x0201f000, 0x00107130,
- 0x0401f8bf, 0x0401f002, 0x0401f8c4, 0x4a01a006,
- 0x02000000, 0x42000800, 0x00000001, 0x42001000,
-- 0x0000dc00, 0x0201f000, 0x0010763b, 0x0401f8bb,
-+ 0x0000dc00, 0x0201f000, 0x00107130, 0x0401f8bb,
- 0x4a01a006, 0x02000000, 0x59300403, 0x82000580,
-- 0x00000031, 0x04020794, 0x81a40800, 0x4a000801,
-- 0x00fffffe, 0x0401f72b, 0x0401f8b0, 0x4a01a006,
-+ 0x00000031, 0x04020796, 0x81a40800, 0x4a000801,
-+ 0x00fffffe, 0x0401f72e, 0x0401f8b0, 0x4a01a006,
- 0x01000000, 0x5930041a, 0x80000540, 0x04000003,
- 0x4801a407, 0x0401f003, 0x4a01a407, 0x00000003,
- 0x5930021a, 0x80000540, 0x04000003, 0x4801a207,
- 0x0401f003, 0x4a01a207, 0x00002a00, 0x42000800,
- 0x00000002, 0x42001000, 0x0000dc00, 0x0201f000,
-- 0x0010763b, 0x4a026202, 0x0000ffff, 0x0401f889,
-+ 0x00107130, 0x4a026202, 0x0000ffff, 0x0401f889,
- 0x4a01a406, 0x00002010, 0x4a01a206, 0x00000014,
- 0x4a01a407, 0x00000800, 0x4a01a207, 0x00002000,
- 0x80000580, 0x599c0817, 0x8c040d0a, 0x04020003,
-@@ -7351,86 +7016,86 @@ uint32_t risc_code01[] = {
- 0x8c08150a, 0x04020004, 0x8c040d0a, 0x04000002,
- 0x8400054e, 0x8c040d1c, 0x04000002, 0x84000552,
- 0x4801a20a, 0x42000800, 0x00000005, 0x42001000,
-- 0x0000dc00, 0x0201f000, 0x0010763b, 0x0401f833,
-+ 0x0000dc00, 0x0201f000, 0x00107130, 0x0401f833,
- 0x4a01a006, 0x02100014, 0x4a01a007, 0x01000000,
- 0x4979a008, 0x4979a009, 0x4979a00a, 0x42000800,
- 0x00000005, 0x42001000, 0x0000dc00, 0x0201f000,
-- 0x0010763b, 0x0401f825, 0x4a01a006, 0x02000000,
-- 0x0401f65d, 0x4933c857, 0x0401f820, 0x4a01a006,
-+ 0x00107130, 0x0401f825, 0x4a01a006, 0x02000000,
-+ 0x0401f660, 0x4933c857, 0x0401f820, 0x4a01a006,
- 0x01000000, 0x4a01a407, 0x0000000b, 0x42000800,
- 0x00000002, 0x42001000, 0x0000dc00, 0x0201f000,
-- 0x0010763b, 0x42005000, 0x32000000, 0x42006000,
-- 0x08290000, 0x41786800, 0x41787800, 0x0401f3e6,
-+ 0x00107130, 0x42005000, 0x32000000, 0x42006000,
-+ 0x08290000, 0x41786800, 0x41787800, 0x0401f3e3,
- 0x42005000, 0x22000000, 0x42006000, 0x01290000,
-- 0x41786800, 0x41787800, 0x0401f3df, 0x42005000,
-+ 0x41786800, 0x41787800, 0x0401f3dc, 0x42005000,
- 0x33000000, 0x42006000, 0x08980000, 0x41786800,
-- 0x41787800, 0x0401f3d8, 0x42005000, 0x23000000,
-+ 0x41787800, 0x0401f3d5, 0x42005000, 0x23000000,
- 0x42006000, 0x01980000, 0x41786800, 0x41787800,
-- 0x0401f3d1, 0x59300403, 0x82000c80, 0x00000085,
-- 0x02001800, 0x00100615, 0x82000c80, 0x00000093,
-- 0x02021800, 0x00100615, 0x82000480, 0x00000085,
-- 0x0c01f001, 0x00107263, 0x00107265, 0x00107272,
-- 0x00107263, 0x00107263, 0x00107263, 0x00107263,
-- 0x00107263, 0x00107263, 0x00107263, 0x00107263,
-- 0x00107263, 0x00107263, 0x0010727f, 0x0201f800,
-- 0x00100615, 0x4933c857, 0x0401f851, 0x5930001c,
-+ 0x0401f3ce, 0x59300403, 0x82000c80, 0x00000085,
-+ 0x02001800, 0x001004ef, 0x82000c80, 0x00000093,
-+ 0x02021800, 0x001004ef, 0x82000480, 0x00000085,
-+ 0x0c01f001, 0x00106d5b, 0x00106d5d, 0x00106d6a,
-+ 0x00106d5b, 0x00106d5b, 0x00106d5b, 0x00106d5b,
-+ 0x00106d5b, 0x00106d5b, 0x00106d5b, 0x00106d5b,
-+ 0x00106d5b, 0x00106d5b, 0x00106d77, 0x0201f800,
-+ 0x001004ef, 0x4933c857, 0x0401f851, 0x5930001c,
- 0x4801a004, 0x4801a007, 0x4979a408, 0x4a01a208,
- 0x0000ffff, 0x42000800, 0x00000003, 0x42001000,
-- 0x0000dc00, 0x0401f3ca, 0x4933c857, 0x0401f850,
-+ 0x0000dc00, 0x0401f3c7, 0x4933c857, 0x0401f850,
- 0x5930001c, 0x4801a004, 0x4a01a406, 0x00000003,
- 0x4a01a206, 0x00000300, 0x42000800, 0x00000001,
-- 0x42001000, 0x0000dc00, 0x0401f3bd, 0x4d2c0000,
-+ 0x42001000, 0x0000dc00, 0x0401f3ba, 0x4d2c0000,
- 0x59325808, 0x4933c857, 0x492fc857, 0x812e59c0,
-- 0x02000800, 0x00100615, 0x59340a12, 0x82040d00,
-+ 0x02000800, 0x001004ef, 0x59340a12, 0x82040d00,
- 0x0000ff00, 0x592c000a, 0x82000500, 0x000000ff,
- 0x900001c0, 0x80040540, 0x82000540, 0x00000011,
- 0x44034800, 0x81a5a000, 0x42001000, 0x00000009,
- 0x42000800, 0x00000003, 0x592c0009, 0x82000500,
- 0xff000000, 0x82001d80, 0x84000000, 0x04000009,
-- 0x82001d80, 0x85000000, 0x02020800, 0x00100615,
-+ 0x82001d80, 0x85000000, 0x02020800, 0x001004ef,
- 0x42001000, 0x00000007, 0x42000800, 0x00000001,
- 0x832c1c00, 0x00000009, 0x500c0000, 0x4401a000,
- 0x800c1800, 0x80d1a000, 0x80081040, 0x040207fb,
-- 0x42001000, 0x0000dc00, 0x5c025800, 0x0401f38c,
-+ 0x42001000, 0x0000dc00, 0x5c025800, 0x0401f389,
- 0x42005000, 0x81000000, 0x42006000, 0x00090000,
-- 0x41786800, 0x41787800, 0x0401f363, 0x42005000,
-+ 0x41786800, 0x41787800, 0x0401f360, 0x42005000,
- 0x84000000, 0x42006000, 0x00990000, 0x59300406,
- 0x82000580, 0x00000005, 0x04000002, 0x8430652e,
-- 0x41786800, 0x41787800, 0x0401f357, 0x42005000,
-+ 0x41786800, 0x41787800, 0x0401f354, 0x42005000,
- 0x85000000, 0x42006000, 0x00990000, 0x59300406,
- 0x82000580, 0x00000005, 0x04000002, 0x8430652e,
-- 0x41786800, 0x41787800, 0x0401f34b, 0x59300403,
-- 0x82000c80, 0x00000053, 0x02021800, 0x00100615,
-- 0x82000480, 0x0000004b, 0x02001800, 0x00100615,
-+ 0x41786800, 0x41787800, 0x0401f348, 0x59300403,
-+ 0x82000c80, 0x00000053, 0x02021800, 0x001004ef,
-+ 0x82000480, 0x0000004b, 0x02001800, 0x001004ef,
- 0x59326809, 0x59368c03, 0x4803c857, 0x0c01f001,
-- 0x00107353, 0x0010735b, 0x00107363, 0x0010736b,
-- 0x001072e4, 0x001072e4, 0x001072e4, 0x0010734b,
-- 0x0201f800, 0x00100615, 0x42005000, 0x06000000,
-+ 0x00106e4b, 0x00106e53, 0x00106e5b, 0x00106e63,
-+ 0x00106ddc, 0x00106ddc, 0x00106ddc, 0x00106e43,
-+ 0x0201f800, 0x001004ef, 0x42005000, 0x06000000,
- 0x42006000, 0x08290000, 0x41786800, 0x41787800,
-- 0x0401f32d, 0x4933c857, 0x0401ff46, 0x4a01a006,
-+ 0x0401f32a, 0x4933c857, 0x0401ff46, 0x4a01a006,
- 0x12000000, 0x59300406, 0x82000580, 0x00000004,
-- 0x04020003, 0x59340002, 0x0401f002, 0x59a80010,
-+ 0x04020003, 0x59340002, 0x0401f002, 0x59a8000f,
- 0x82000500, 0x00ffffff, 0x4801a007, 0x59300419,
- 0x4801a408, 0x59300219, 0x4801a208, 0x4979a009,
- 0x4979a00a, 0x4979a00b, 0x4979a00c, 0x4979a00d,
- 0x4979a00e, 0x4979a00f, 0x4979a010, 0x42000800,
-- 0x0000000b, 0x42001000, 0x0000dc00, 0x0401f330,
-+ 0x0000000b, 0x42001000, 0x0000dc00, 0x0401f32d,
- 0x0401ff28, 0x4a01a006, 0x0f000000, 0x5930001c,
- 0x4801a007, 0x42000800, 0x00000002, 0x42001000,
-- 0x0000dc00, 0x0401f326, 0x0401ff2c, 0x4a01a006,
-+ 0x0000dc00, 0x0401f323, 0x0401ff2c, 0x4a01a006,
- 0x02000000, 0x59c40085, 0x48031004, 0x59880000,
- 0x4801a007, 0x59880001, 0x4801a008, 0x59880002,
- 0x4801a009, 0x59880003, 0x4801a00a, 0x59880004,
- 0x4801a00b, 0x59880005, 0x4801a00c, 0x42000800,
-- 0x00000007, 0x42001000, 0x0000dc00, 0x0401f310,
-+ 0x00000007, 0x42001000, 0x0000dc00, 0x0401f30d,
- 0x4a026202, 0x0000ffff, 0x0401ff06, 0x4a01a006,
- 0x62000000, 0x5930001c, 0x4801a007, 0x42000800,
-- 0x00000002, 0x42001000, 0x0000dc00, 0x0401f304,
-+ 0x00000002, 0x42001000, 0x0000dc00, 0x0401f301,
- 0x0401fefc, 0x59300808, 0x4c500000, 0x4c540000,
- 0x4c580000, 0x8204a400, 0x0000000a, 0x5930b01c,
-- 0x82d0ac00, 0x00000006, 0x0201f800, 0x0010a93e,
-+ 0x82d0ac00, 0x00000006, 0x0201f800, 0x0010a330,
- 0x5930081c, 0x42001000, 0x0000dc00, 0x5c00b000,
-- 0x5c00a800, 0x5c00a000, 0x0401f2f1, 0x0401ff9b,
-+ 0x5c00a800, 0x5c00a000, 0x0401f2ee, 0x0401ff9b,
- 0x59300017, 0x4801a006, 0x59300018, 0x4801a007,
- 0x4a01a008, 0x00001000, 0x0401f020, 0x0401ff93,
- 0x59300017, 0x4801a006, 0x59300018, 0x4801a007,
-@@ -7442,377 +7107,384 @@ uint32_t risc_code01[] = {
- 0x59300017, 0x4801a006, 0x59300018, 0x4801a007,
- 0x4a01a008, 0x00000200, 0x4979a009, 0x4979a00a,
- 0x4979a00b, 0x4979a00c, 0x4979a00d, 0x42000800,
-- 0x00000008, 0x42001000, 0x0000dc00, 0x0401f2c0,
-+ 0x00000008, 0x42001000, 0x0000dc00, 0x0401f2bd,
- 0x0401fec6, 0x4a01a006, 0x02000014, 0x4979a407,
-- 0x4979a207, 0x59a8003a, 0x4801a008, 0x59a8003b,
-+ 0x4979a207, 0x59a80037, 0x4801a008, 0x59a80038,
- 0x4801a009, 0x4a01a00a, 0x00047878, 0x42000800,
-- 0x00000005, 0x42001000, 0x0000dc00, 0x0401f2b0,
-+ 0x00000005, 0x42001000, 0x0000dc00, 0x0401f2ad,
- 0x0401feb6, 0x4a01a006, 0x02140018, 0x4a01a407,
- 0x00000800, 0x5930001c, 0x82000d00, 0xff000000,
- 0x900409c0, 0x4805a207, 0x82000500, 0x00ffffff,
- 0x4801a00a, 0x4979a408, 0x4979a208, 0x4979a409,
- 0x4979a209, 0x4979a00b, 0x42000800, 0x00000006,
-- 0x42001000, 0x0000dc00, 0x0401f299, 0x4933c857,
-- 0x4937c857, 0x4d380000, 0x4d1c0000, 0x42027000,
-- 0x00000035, 0x0201f800, 0x00109183, 0x04020022,
-- 0x0401fe88, 0x4a01a006, 0x13000000, 0x5932381e,
-- 0x591c0414, 0x8c000502, 0x02000800, 0x00100615,
-- 0x591c0019, 0x4801a005, 0x591c0406, 0x82000580,
-- 0x00000003, 0x04000007, 0x59300809, 0x58040002,
-- 0x82000500, 0x00ffffff, 0x4801a007, 0x0401f003,
-- 0x59a80010, 0x4801a007, 0x59300419, 0x4801a408,
-- 0x59300219, 0x4801a208, 0x42000800, 0x00000003,
-- 0x42001000, 0x0000dc00, 0x5c023800, 0x5c027000,
-- 0x0401f26f, 0x4803c856, 0x0201f800, 0x0010698c,
-- 0x598c000d, 0x81300580, 0x02020800, 0x00100615,
-- 0x0201f800, 0x001068f6, 0x0201f800, 0x000208b4,
-- 0x5c023800, 0x5c027000, 0x0201f000, 0x00106982,
-- 0x4803c856, 0x4d2c0000, 0x4d1c0000, 0x5932381e,
-- 0x811e39c0, 0x02000800, 0x00100615, 0x591c0c06,
-- 0x82040580, 0x00000006, 0x0400000d, 0x82040580,
-- 0x00000003, 0x04000036, 0x4a026403, 0x00000037,
-- 0x4a02641a, 0x00000003, 0x4a02621a, 0x00001700,
-- 0x5c023800, 0x5c025800, 0x0401f064, 0x0401f84b,
-- 0x42001000, 0x40000000, 0x591c0203, 0x591c0804,
-- 0x8c040d3e, 0x04020023, 0x82000c80, 0x0000000e,
-- 0x0c001003, 0x0201f800, 0x00100615, 0x00107410,
-- 0x0010741c, 0x00107412, 0x0010741c, 0x00107418,
-- 0x00107410, 0x00107410, 0x0010741c, 0x0010741c,
-- 0x00107410, 0x00107410, 0x00107410, 0x00107410,
-- 0x00107410, 0x0010741c, 0x00107410, 0x0010741c,
-- 0x0201f800, 0x00100615, 0x591c0414, 0x4803c857,
-- 0x8c000518, 0x04000003, 0x8c000512, 0x04000003,
-- 0x80001580, 0x0401f003, 0x42001000, 0x20000000,
-- 0x591c0015, 0x4801a00a, 0x0401f018, 0x0401f81f,
-- 0x591e5808, 0x812e59c0, 0x02000800, 0x00100615,
-- 0x592c100f, 0x591c0011, 0x80080480, 0x4801a00a,
-- 0x591c0203, 0x591c0804, 0x8c040d3e, 0x04020007,
-- 0x82000d80, 0x00000002, 0x04000007, 0x82000d80,
-- 0x00000004, 0x04000004, 0x42001000, 0x40000000,
-- 0x0401f002, 0x80001580, 0x4809a00b, 0x42000800,
-- 0x00000006, 0x42001000, 0x0000dc00, 0x5c023800,
-- 0x5c025800, 0x0401f1fe, 0x4803c856, 0x0401fe03,
-- 0x4a01a006, 0x02000000, 0x59300c19, 0x4805a407,
-- 0x59300a19, 0x4805a207, 0x59a81010, 0x59300809,
-- 0x58041802, 0x820c1d00, 0x00ffffff, 0x5930081e,
-- 0x58040406, 0x82000580, 0x00000003, 0x04020004,
-- 0x4809a008, 0x480da009, 0x0401f003, 0x480da008,
-- 0x4809a009, 0x1c01f000, 0x4803c856, 0x0401fdeb,
-- 0x0401f003, 0x4803c856, 0x0401fde1, 0x4a01a006,
-- 0x01000000, 0x5930041a, 0x4801a407, 0x5930021a,
-- 0x4801a207, 0x42000800, 0x00000002, 0x42001000,
-- 0x0000dc00, 0x0401f1d6, 0x4803c856, 0x4d1c0000,
-- 0x0401fdc5, 0x4a01a006, 0x14000000, 0x5932381e,
-- 0x591c0019, 0x4801a005, 0x59300419, 0x4801a407,
-- 0x59300219, 0x4801a207, 0x59300015, 0x4801a008,
-- 0x59300216, 0x82000500, 0x000000ff, 0x840001c0,
-- 0x4801a409, 0x42000800, 0x00000004, 0x42001000,
-- 0x0000dc00, 0x5c023800, 0x0401f1bd, 0x4803c856,
-- 0x0401f80b, 0x5930041a, 0x900001c0, 0x4801a005,
-- 0x0401f9f4, 0x41780800, 0x42001000, 0x00005c00,
-- 0x0401f9b3, 0x0201f000, 0x00105d86, 0x4803c856,
-- 0x59300817, 0x82041c00, 0x00000005, 0x46034800,
-- 0x00000021, 0x58040404, 0x82000500, 0x0000f000,
-- 0x82000580, 0x00003000, 0x04000003, 0x46034800,
-- 0x00000041, 0x81a5a000, 0x580c0001, 0x82000d00,
-- 0x00ffffff, 0x82040d40, 0xc2000000, 0x4805a000,
-- 0x580c0800, 0x82041500, 0x00ffffff, 0x82000500,
-- 0xff000000, 0x80080540, 0x4801a001, 0x580c0002,
-- 0x82000580, 0x00c00000, 0x82000500, 0x00fd0300,
-- 0x4801a002, 0x580c0003, 0x4801a003, 0x580c0404,
-- 0x4801a404, 0x580c0204, 0x4801a204, 0x1c01f000,
-- 0x4803c856, 0x59a80026, 0x82000500, 0x00000028,
-- 0x04020009, 0x59a80026, 0x82000500, 0x00000028,
-- 0x04000003, 0x497a6a12, 0x0401f003, 0x4a026a12,
-- 0x0000ff00, 0x42005000, 0x22000000, 0x42006000,
-- 0x01380000, 0x41786800, 0x41787800, 0x0401f952,
-- 0x59301008, 0x4a01a006, 0x54000000, 0x59a80010,
-+ 0x42001000, 0x0000dc00, 0x0401f296, 0x4933c857,
-+ 0x4937c857, 0x4d1c0000, 0x42000800, 0x00000035,
-+ 0x0201f800, 0x00108bff, 0x04020021, 0x0401fe89,
-+ 0x4a01a006, 0x13000000, 0x5932381e, 0x591c0414,
-+ 0x8c000502, 0x02000800, 0x001004ef, 0x591c0019,
-+ 0x4801a005, 0x591c0406, 0x82000580, 0x00000003,
-+ 0x04000007, 0x59300809, 0x58040002, 0x82000500,
-+ 0x00ffffff, 0x4801a007, 0x0401f003, 0x59a8000f,
-+ 0x4801a007, 0x59300419, 0x4801a408, 0x59300219,
-+ 0x4801a208, 0x42000800, 0x00000003, 0x42001000,
-+ 0x0000dc00, 0x5c023800, 0x0401f26e, 0x4803c856,
-+ 0x0201f800, 0x00106476, 0x598c000d, 0x81300580,
-+ 0x02020800, 0x001004ef, 0x0201f800, 0x001063c4,
-+ 0x0201f800, 0x000207bb, 0x5c023800, 0x0201f000,
-+ 0x00106463, 0x4803c856, 0x4d2c0000, 0x4d1c0000,
-+ 0x5932381e, 0x811e39c0, 0x02000800, 0x001004ef,
-+ 0x591c0c06, 0x82040580, 0x00000006, 0x0400000d,
-+ 0x82040580, 0x00000003, 0x04000036, 0x4a026403,
-+ 0x00000037, 0x4a02641a, 0x00000003, 0x4a02621a,
-+ 0x00001700, 0x5c023800, 0x5c025800, 0x0401f064,
-+ 0x0401f84b, 0x42001000, 0x40000000, 0x591c0203,
-+ 0x591c0804, 0x8c040d3e, 0x04020023, 0x82000c80,
-+ 0x0000000e, 0x0c001003, 0x0201f800, 0x001004ef,
-+ 0x00106f05, 0x00106f11, 0x00106f07, 0x00106f11,
-+ 0x00106f0d, 0x00106f05, 0x00106f05, 0x00106f11,
-+ 0x00106f11, 0x00106f05, 0x00106f05, 0x00106f05,
-+ 0x00106f05, 0x00106f05, 0x00106f11, 0x00106f05,
-+ 0x00106f11, 0x0201f800, 0x001004ef, 0x591c0414,
-+ 0x4803c857, 0x8c000518, 0x04000003, 0x8c000512,
-+ 0x04000003, 0x80001580, 0x0401f003, 0x42001000,
-+ 0x20000000, 0x591c0015, 0x4801a00a, 0x0401f018,
-+ 0x0401f81f, 0x591e5808, 0x812e59c0, 0x02000800,
-+ 0x001004ef, 0x592c100f, 0x591c0011, 0x80080480,
-+ 0x4801a00a, 0x591c0203, 0x591c0804, 0x8c040d3e,
-+ 0x04020007, 0x82000d80, 0x00000002, 0x04000007,
-+ 0x82000d80, 0x00000004, 0x04000004, 0x42001000,
-+ 0x40000000, 0x0401f002, 0x80001580, 0x4809a00b,
-+ 0x42000800, 0x00000006, 0x42001000, 0x0000dc00,
-+ 0x5c023800, 0x5c025800, 0x0401f1fe, 0x4803c856,
-+ 0x0401fe06, 0x4a01a006, 0x02000000, 0x59300c19,
-+ 0x4805a407, 0x59300a19, 0x4805a207, 0x59a8100f,
-+ 0x59300809, 0x58041802, 0x820c1d00, 0x00ffffff,
-+ 0x5930081e, 0x58040406, 0x82000580, 0x00000003,
-+ 0x04020004, 0x4809a008, 0x480da009, 0x0401f003,
-+ 0x480da008, 0x4809a009, 0x1c01f000, 0x4803c856,
-+ 0x0401fdee, 0x0401f003, 0x4803c856, 0x0401fde4,
-+ 0x4a01a006, 0x01000000, 0x5930041a, 0x4801a407,
-+ 0x5930021a, 0x4801a207, 0x42000800, 0x00000002,
-+ 0x42001000, 0x0000dc00, 0x0401f1d6, 0x4803c856,
-+ 0x4d1c0000, 0x0401fdc8, 0x4a01a006, 0x14000000,
-+ 0x5932381e, 0x591c0019, 0x4801a005, 0x59300419,
-+ 0x4801a407, 0x59300219, 0x4801a207, 0x59300015,
-+ 0x4801a008, 0x59300216, 0x82000500, 0x000000ff,
-+ 0x840001c0, 0x4801a409, 0x42000800, 0x00000004,
-+ 0x42001000, 0x0000dc00, 0x5c023800, 0x0401f1bd,
-+ 0x4803c856, 0x0401f80b, 0x5930041a, 0x900001c0,
-+ 0x4801a005, 0x0401f9f4, 0x41780800, 0x42001000,
-+ 0x00005c00, 0x0401f9b3, 0x0201f000, 0x00105c2c,
-+ 0x4803c856, 0x59300817, 0x82041c00, 0x00000005,
-+ 0x46034800, 0x00000021, 0x58040404, 0x82000500,
-+ 0x0000f000, 0x82000580, 0x00003000, 0x04000003,
-+ 0x46034800, 0x00000041, 0x81a5a000, 0x580c0001,
-+ 0x82000d00, 0x00ffffff, 0x82040d40, 0xc2000000,
-+ 0x4805a000, 0x580c0800, 0x82041500, 0x00ffffff,
-+ 0x82000500, 0xff000000, 0x80080540, 0x4801a001,
-+ 0x580c0002, 0x82000580, 0x00c00000, 0x82000500,
-+ 0x00fd0300, 0x4801a002, 0x580c0003, 0x4801a003,
-+ 0x580c0404, 0x4801a404, 0x580c0204, 0x4801a204,
-+ 0x1c01f000, 0x4803c856, 0x59a80023, 0x82000500,
-+ 0x00000028, 0x04020009, 0x59a80023, 0x82000500,
-+ 0x00000028, 0x04000003, 0x497a6a12, 0x0401f003,
-+ 0x4a026a12, 0x0000ff00, 0x42005000, 0x22000000,
-+ 0x42006000, 0x01380000, 0x41786800, 0x41787800,
-+ 0x0401f952, 0x59301008, 0x4a01a006, 0x54000000,
-+ 0x59a8000f, 0x82000500, 0x00ffffff, 0x58080c0a,
-+ 0x800408f0, 0x80040540, 0x4801a007, 0x5808000a,
-+ 0x82000500, 0xff000000, 0x4801a008, 0x59a80002,
-+ 0x4801a009, 0x59a80003, 0x4801a00a, 0x59a80000,
-+ 0x4801a00b, 0x59a80001, 0x4801a00c, 0x5808000c,
-+ 0x9c0001c0, 0x4801a00d, 0x5808000d, 0x9c0001c0,
-+ 0x4801a00e, 0x5808000e, 0x9c0001c0, 0x4801a00f,
-+ 0x5808000f, 0x9c0001c0, 0x4801a010, 0x58080010,
-+ 0x9c0001c0, 0x4801a011, 0x58080011, 0x9c0001c0,
-+ 0x4801a012, 0x58080012, 0x9c0001c0, 0x4801a013,
-+ 0x58080013, 0x9c0001c0, 0x4801a014, 0x58080010,
-+ 0x9c0001c0, 0x4801a015, 0x58080011, 0x9c0001c0,
-+ 0x4801a016, 0x58080012, 0x9c0001c0, 0x4801a017,
-+ 0x58080013, 0x9c0001c0, 0x4801a018, 0x42000800,
-+ 0x00000013, 0x42001000, 0x0000dc00, 0x0401f135,
-+ 0x4803c856, 0x42005000, 0x22000000, 0x42006000,
-+ 0x01290000, 0x41786800, 0x41787800, 0x0401f90b,
-+ 0x59301008, 0x4a01a006, 0x55000000, 0x5808000b,
- 0x82000500, 0x00ffffff, 0x58080c0a, 0x800408f0,
-- 0x80040540, 0x4801a007, 0x5808000a, 0x82000500,
-- 0xff000000, 0x4801a008, 0x59a80002, 0x4801a009,
-- 0x59a80003, 0x4801a00a, 0x59a80000, 0x4801a00b,
-- 0x59a80001, 0x4801a00c, 0x5808000c, 0x9c0001c0,
-- 0x4801a00d, 0x5808000d, 0x9c0001c0, 0x4801a00e,
-- 0x5808000e, 0x9c0001c0, 0x4801a00f, 0x5808000f,
-- 0x9c0001c0, 0x4801a010, 0x58080010, 0x9c0001c0,
-- 0x4801a011, 0x58080011, 0x9c0001c0, 0x4801a012,
-- 0x58080012, 0x9c0001c0, 0x4801a013, 0x58080013,
-- 0x9c0001c0, 0x4801a014, 0x58080010, 0x9c0001c0,
-- 0x4801a015, 0x58080011, 0x9c0001c0, 0x4801a016,
-- 0x58080012, 0x9c0001c0, 0x4801a017, 0x58080013,
-- 0x9c0001c0, 0x4801a018, 0x42000800, 0x00000013,
-- 0x42001000, 0x0000dc00, 0x0401f135, 0x4803c856,
-- 0x42005000, 0x22000000, 0x42006000, 0x01290000,
-- 0x41786800, 0x41787800, 0x0401f90b, 0x59301008,
-- 0x4a01a006, 0x55000000, 0x5808000b, 0x82000500,
-- 0x00ffffff, 0x58080c0a, 0x800408f0, 0x80040540,
-- 0x4801a007, 0x5808080a, 0x82040d00, 0xff000000,
-- 0x59a80010, 0x82000500, 0x00ffffff, 0x80040540,
-- 0x4801a008, 0x5808000c, 0x9c0001c0, 0x4801a009,
-- 0x5808000d, 0x9c0001c0, 0x4801a00a, 0x5808000e,
-- 0x9c0001c0, 0x4801a00b, 0x5808000f, 0x9c0001c0,
-- 0x4801a00c, 0x59a80002, 0x4801a00d, 0x59a80003,
-- 0x4801a00e, 0x59a80000, 0x4801a00f, 0x59a80001,
-- 0x4801a010, 0x58080010, 0x4801a011, 0x58080011,
-- 0x4801a012, 0x58080012, 0x4801a013, 0x58080013,
-- 0x4801a014, 0x4979a015, 0x4979a016, 0x4979a017,
-- 0x4979a018, 0x42000800, 0x00000013, 0x42001000,
-- 0x0000dc00, 0x0401f0f6, 0x0401fcfc, 0x5930001c,
-- 0x800001c0, 0x04000008, 0x4a01a006, 0x01000000,
-- 0x4a01a407, 0x00000003, 0x42000800, 0x00000002,
-- 0x0401f028, 0x4a01a006, 0x02000000, 0x41780800,
-- 0x836c0580, 0x00000004, 0x04020003, 0x84040d42,
-- 0x0401f00d, 0x0201f800, 0x00104e0d, 0x04020003,
-- 0x84040d4a, 0x0401f002, 0x84040d48, 0x59a80026,
-- 0x8c000506, 0x04020003, 0x8c00050a, 0x04000002,
-- 0x84040d46, 0x4805a207, 0x59c40085, 0x48031004,
-- 0x4c580000, 0x4c500000, 0x4c540000, 0x4200b000,
-- 0x00000006, 0x8388a400, 0x00000000, 0x82d0ac00,
-- 0x00000008, 0x0201f800, 0x0010a93e, 0x5c00a800,
-- 0x5c00a000, 0x5c00b000, 0x42000800, 0x00000008,
-- 0x42001000, 0x0000dc00, 0x0401f0c1, 0x0401fcb9,
-- 0x4a01a006, 0x56000000, 0x59340006, 0x4801a007,
-- 0x59340007, 0x4801a008, 0x42000800, 0x00000003,
-- 0x42001000, 0x0000dc00, 0x0401f0b5, 0x4803c856,
-- 0x0401fcba, 0x5930081c, 0x800409c0, 0x0400000e,
-- 0x82040580, 0x0000ffff, 0x04000004, 0x82040480,
-- 0x00000007, 0x04021008, 0x4a01a006, 0x01000000,
-- 0x4a01a407, 0x00000003, 0x42000800, 0x00000002,
-- 0x0401f012, 0x4a01a006, 0x0200001c, 0x4a01a007,
-- 0x00000001, 0x42001000, 0x0010b2ec, 0x50080000,
-- 0x9c0001c0, 0x4801a009, 0x59a80010, 0x4801a00a,
-- 0x59a80002, 0x59a80803, 0x4801a00b, 0x4805a00c,
-- 0x42000800, 0x00000007, 0x42001000, 0x0000dc00,
-- 0x0401f08f, 0x4d2c0000, 0x0401fc86, 0x59325808,
-- 0x592c0008, 0x82000500, 0x00ffffff, 0x4801a001,
-- 0x4a01a006, 0x51000000, 0x5c025800, 0x0201f000,
-- 0x001070bc, 0x4803c856, 0x59a80810, 0x82040d00,
-- 0x000000ff, 0x59325808, 0x59326809, 0x59a83026,
-- 0x8c18350a, 0x04020008, 0x8c00050e, 0x04020006,
-- 0x80001d80, 0x59a82010, 0x82102500, 0x000000ff,
-- 0x0401f001, 0x59300406, 0x4803c857, 0x82000d80,
-- 0x00000009, 0x04000006, 0x82000d80, 0x0000000a,
-- 0x0400002e, 0x0201f800, 0x00100615, 0x59300015,
-- 0x8c00051e, 0x04020020, 0x42005000, 0x04000000,
-- 0x42006000, 0x05000000, 0x592c040a, 0x82000500,
-- 0x00000030, 0x800000e0, 0x80306540, 0x5934000a,
-- 0x8c000508, 0x04000002, 0x84306546, 0x41786800,
-- 0x41787800, 0x0401f831, 0x59300c14, 0x80040000,
-- 0x48026414, 0x40040000, 0x800000d0, 0x82000540,
-- 0x00000020, 0x4801a403, 0x83180d40, 0x00000038,
-- 0x42001000, 0x0000c920, 0x0401f868, 0x0201f000,
-- 0x00105d8b, 0x59a80026, 0x82000500, 0x00000028,
-- 0x04000003, 0x497a6a12, 0x0401f7dc, 0x4a026a12,
-- 0x0000ff00, 0x0401f7d9, 0x42005000, 0x02000000,
-- 0x42006000, 0x20290000, 0x41786800, 0x41787800,
-- 0x0401f812, 0x83180d40, 0x00000038, 0x42001000,
-- 0x0000c9a0, 0x0401f851, 0x42000800, 0x000007d0,
-- 0x59300011, 0x82000500, 0xfff00000, 0x80000540,
-- 0x04000003, 0x42000800, 0x00001b58, 0x41781000,
-- 0x0201f000, 0x00105d8d, 0x4201a000, 0x00000000,
-- 0x0401f003, 0x4201a000, 0x00000011, 0x59340a12,
-- 0x82040d00, 0x0000ff00, 0x59a80010, 0x82000500,
-- 0x000000ff, 0x900001c0, 0x80040540, 0x80d00540,
-- 0x44034800, 0x81a5a000, 0x59340002, 0x82000500,
-- 0x00ffffff, 0x80280540, 0x4801a000, 0x59a80010,
-- 0x4801a001, 0x4831a002, 0x82340540, 0x00000000,
-- 0x4801a003, 0x59300402, 0x4801a404, 0x59300a02,
-- 0x4805a204, 0x8c30652e, 0x04000003, 0x4805a404,
-- 0x4801a204, 0x483da005, 0x1c01f000, 0x4807c857,
-- 0x4c040000, 0x0401f82a, 0x5c000800, 0x40040000,
-- 0x80081540, 0x800000c4, 0x82000540, 0x00002000,
-- 0x4803910a, 0x59b400f6, 0x82000500, 0x00000018,
-- 0x040207fd, 0x4a0368f0, 0x0010b342, 0x42001800,
-- 0x0010b343, 0x580c0000, 0x4803c857, 0x580c0002,
-- 0x4803c857, 0x580c0004, 0x4803c857, 0x4a0368f1,
-- 0x0010b349, 0x480b68f3, 0x4a0378e4, 0x00008000,
-- 0x0201f000, 0x00105d86, 0x4807c857, 0x480a2800,
-- 0x4c040000, 0x0401f80a, 0x5c000800, 0x59b400f6,
-- 0x8c00050a, 0x040207fe, 0x49a768f2, 0x480768f4,
-- 0x4a0378e4, 0x00008000, 0x1c01f000, 0x4a0378e4,
-- 0x0000c000, 0x59bc00e4, 0x8c000520, 0x0400000c,
-- 0x4a0378e4, 0x00008000, 0x42007000, 0x000003e8,
-- 0x59bc00e4, 0x8c000520, 0x040007f5, 0x80387040,
-- 0x02000800, 0x00100615, 0x0401f7fa, 0x1c01f000,
-- 0x82000500, 0xffff0000, 0x82000580, 0x01050000,
-- 0x0402000d, 0x599c0818, 0x8c040d10, 0x0400000a,
-- 0x59a80807, 0x8c040d0a, 0x04000007, 0x42001000,
-- 0x0000804f, 0x41781800, 0x41782000, 0x0201f800,
-- 0x00103857, 0x1c01f000, 0x41781000, 0x42026000,
-- 0x0010cfc0, 0x59a8180e, 0x480a6402, 0x4a026202,
-- 0x0000ffff, 0x80081000, 0x800c1840, 0x04000004,
-- 0x83326400, 0x00000024, 0x0401f7f8, 0x1c01f000,
-- 0x4933c857, 0x59300203, 0x82000580, 0x00000000,
-- 0x0400002c, 0x59300406, 0x4803c857, 0x82000d80,
-- 0x00000004, 0x04000011, 0x82000d80, 0x00000001,
-- 0x0400000e, 0x82000d80, 0x00000003, 0x04000006,
-- 0x82000d80, 0x00000006, 0x04020011, 0x0201f800,
-- 0x0010a3fa, 0x5930001c, 0x800001c0, 0x02020800,
-- 0x0010961a, 0x0401f00a, 0x5930081e, 0x4807c857,
-- 0x800409c0, 0x04000006, 0x5804001c, 0x4803c857,
-- 0x81300580, 0x04020002, 0x4978081c, 0x497a6008,
-- 0x4a026004, 0x00004000, 0x59a80037, 0x82000c80,
-- 0x00000051, 0x04001002, 0x80000102, 0x48026206,
-- 0x497a6205, 0x497a6009, 0x4a026406, 0x00000007,
-+ 0x80040540, 0x4801a007, 0x5808080a, 0x82040d00,
-+ 0xff000000, 0x59a8000f, 0x82000500, 0x00ffffff,
-+ 0x80040540, 0x4801a008, 0x5808000c, 0x9c0001c0,
-+ 0x4801a009, 0x5808000d, 0x9c0001c0, 0x4801a00a,
-+ 0x5808000e, 0x9c0001c0, 0x4801a00b, 0x5808000f,
-+ 0x9c0001c0, 0x4801a00c, 0x59a80002, 0x4801a00d,
-+ 0x59a80003, 0x4801a00e, 0x59a80000, 0x4801a00f,
-+ 0x59a80001, 0x4801a010, 0x58080010, 0x4801a011,
-+ 0x58080011, 0x4801a012, 0x58080012, 0x4801a013,
-+ 0x58080013, 0x4801a014, 0x4979a015, 0x4979a016,
-+ 0x4979a017, 0x4979a018, 0x42000800, 0x00000013,
-+ 0x42001000, 0x0000dc00, 0x0401f0f6, 0x0401fcff,
-+ 0x5930001c, 0x800001c0, 0x04000008, 0x4a01a006,
-+ 0x01000000, 0x4a01a407, 0x00000003, 0x42000800,
-+ 0x00000002, 0x0401f028, 0x4a01a006, 0x02000000,
-+ 0x41780800, 0x836c0580, 0x00000004, 0x04020003,
-+ 0x84040d42, 0x0401f00d, 0x0201f800, 0x00104ca6,
-+ 0x04020003, 0x84040d4a, 0x0401f002, 0x84040d48,
-+ 0x59a80023, 0x8c000506, 0x04020003, 0x8c00050a,
-+ 0x04000002, 0x84040d46, 0x4805a207, 0x59c40085,
-+ 0x48031004, 0x4c580000, 0x4c500000, 0x4c540000,
-+ 0x4200b000, 0x00000006, 0x8388a400, 0x00000000,
-+ 0x82d0ac00, 0x00000008, 0x0201f800, 0x0010a330,
-+ 0x5c00a800, 0x5c00a000, 0x5c00b000, 0x42000800,
-+ 0x00000008, 0x42001000, 0x0000dc00, 0x0401f0c1,
-+ 0x0401fcbc, 0x4a01a006, 0x56000000, 0x59340006,
-+ 0x4801a007, 0x59340007, 0x4801a008, 0x42000800,
-+ 0x00000003, 0x42001000, 0x0000dc00, 0x0401f0b5,
-+ 0x4803c856, 0x0401fcbd, 0x5930081c, 0x800409c0,
-+ 0x0400000e, 0x82040580, 0x0000ffff, 0x04000004,
-+ 0x82040480, 0x00000007, 0x04021008, 0x4a01a006,
-+ 0x01000000, 0x4a01a407, 0x00000003, 0x42000800,
-+ 0x00000002, 0x0401f012, 0x4a01a006, 0x0200001c,
-+ 0x4a01a007, 0x00000001, 0x42001000, 0x0010acbd,
-+ 0x50080000, 0x9c0001c0, 0x4801a009, 0x59a8000f,
-+ 0x4801a00a, 0x59a80002, 0x59a80803, 0x4801a00b,
-+ 0x4805a00c, 0x42000800, 0x00000007, 0x42001000,
-+ 0x0000dc00, 0x0401f08f, 0x4d2c0000, 0x0401fc89,
-+ 0x59325808, 0x592c0008, 0x82000500, 0x00ffffff,
-+ 0x4801a001, 0x4a01a006, 0x51000000, 0x5c025800,
-+ 0x0201f000, 0x00106bb7, 0x4803c856, 0x59a8080f,
-+ 0x82040d00, 0x000000ff, 0x59325808, 0x59326809,
-+ 0x59a83023, 0x8c18350a, 0x04020008, 0x8c00050e,
-+ 0x04020006, 0x80001d80, 0x59a8200f, 0x82102500,
-+ 0x000000ff, 0x0401f001, 0x59300406, 0x4803c857,
-+ 0x82000d80, 0x00000009, 0x04000006, 0x82000d80,
-+ 0x0000000a, 0x0400002e, 0x0201f800, 0x001004ef,
-+ 0x59300015, 0x8c00051e, 0x04020020, 0x42005000,
-+ 0x04000000, 0x42006000, 0x05000000, 0x592c040a,
-+ 0x82000500, 0x00000030, 0x800000e0, 0x80306540,
-+ 0x5934000a, 0x8c000508, 0x04000002, 0x84306546,
-+ 0x41786800, 0x41787800, 0x0401f831, 0x59300c14,
-+ 0x80040000, 0x48026414, 0x40040000, 0x800000d0,
-+ 0x82000540, 0x00000020, 0x4801a403, 0x83180d40,
-+ 0x00000038, 0x42001000, 0x0000c920, 0x0401f868,
-+ 0x0201f000, 0x00105c31, 0x59a80023, 0x82000500,
-+ 0x00000028, 0x04000003, 0x497a6a12, 0x0401f7dc,
-+ 0x4a026a12, 0x0000ff00, 0x0401f7d9, 0x42005000,
-+ 0x02000000, 0x42006000, 0x20290000, 0x41786800,
-+ 0x41787800, 0x0401f812, 0x83180d40, 0x00000038,
-+ 0x42001000, 0x0000c9a0, 0x0401f851, 0x42000800,
-+ 0x000007d0, 0x59300011, 0x82000500, 0xfff00000,
-+ 0x80000540, 0x04000003, 0x42000800, 0x00001b58,
-+ 0x41781000, 0x0201f000, 0x00105c33, 0x4201a000,
-+ 0x00000000, 0x0401f003, 0x4201a000, 0x00000011,
-+ 0x59340a12, 0x82040d00, 0x0000ff00, 0x59a8000f,
-+ 0x82000500, 0x000000ff, 0x900001c0, 0x80040540,
-+ 0x80d00540, 0x44034800, 0x81a5a000, 0x59340002,
-+ 0x82000500, 0x00ffffff, 0x80280540, 0x4801a000,
-+ 0x59a8000f, 0x4801a001, 0x4831a002, 0x82340540,
-+ 0x00000000, 0x4801a003, 0x59300402, 0x4801a404,
-+ 0x59300a02, 0x4805a204, 0x8c30652e, 0x04000003,
-+ 0x4805a404, 0x4801a204, 0x483da005, 0x1c01f000,
-+ 0x4807c857, 0x4c040000, 0x0401f82a, 0x5c000800,
-+ 0x40040000, 0x80081540, 0x800000c4, 0x82000540,
-+ 0x00002000, 0x4803910a, 0x59b400f6, 0x82000500,
-+ 0x00000018, 0x040207fd, 0x4a0368f0, 0x0010ad12,
-+ 0x42001800, 0x0010ad13, 0x580c0000, 0x4803c857,
-+ 0x580c0004, 0x4803c857, 0x580c0006, 0x4803c857,
-+ 0x4a0368f1, 0x0010ad19, 0x480b68f3, 0x4a0378e4,
-+ 0x00008000, 0x0201f000, 0x00105c2c, 0x4807c857,
-+ 0x480a2800, 0x4c040000, 0x0401f80a, 0x5c000800,
-+ 0x59b400f6, 0x8c00050a, 0x040207fe, 0x49a768f2,
-+ 0x480768f4, 0x4a0378e4, 0x00008000, 0x1c01f000,
-+ 0x4a0378e4, 0x0000c000, 0x59bc00e4, 0x8c000520,
-+ 0x0400000c, 0x4a0378e4, 0x00008000, 0x42007000,
-+ 0x000003e8, 0x59bc00e4, 0x8c000520, 0x040007f5,
-+ 0x80387040, 0x02000800, 0x001004ef, 0x0401f7fa,
-+ 0x1c01f000, 0x82000500, 0xffff0000, 0x82000580,
-+ 0x01050000, 0x0402000d, 0x599c0818, 0x8c040d10,
-+ 0x0400000a, 0x59a80806, 0x8c040d0a, 0x04000007,
-+ 0x42001000, 0x0000804f, 0x41781800, 0x41782000,
-+ 0x0201f800, 0x001036f4, 0x1c01f000, 0x41781000,
-+ 0x42026000, 0x0010d8d4, 0x59a8180d, 0x480a6402,
-+ 0x4a026202, 0x0000ffff, 0x80081000, 0x800c1840,
-+ 0x04000004, 0x83326400, 0x00000024, 0x0401f7f8,
-+ 0x1c01f000, 0x4c000000, 0x0201f800, 0x00020799,
-+ 0x41318800, 0x5c000000, 0x1c01f000, 0x4c000000,
-+ 0x0201f800, 0x000207bb, 0x5c000000, 0x1c01f000,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
-+ 0x5c036000, 0x4db00000, 0x49b3c857, 0x4933c857,
-+ 0x59300203, 0x82000580, 0x00000000, 0x0400002c,
-+ 0x59300406, 0x4803c857, 0x82000d80, 0x00000004,
-+ 0x04000011, 0x82000d80, 0x00000001, 0x0400000e,
-+ 0x82000d80, 0x00000003, 0x04000006, 0x82000d80,
-+ 0x00000006, 0x04020011, 0x0201f800, 0x00109dc7,
-+ 0x5930001c, 0x800001c0, 0x02020800, 0x001090a2,
-+ 0x0401f00a, 0x5930081e, 0x4807c857, 0x800409c0,
-+ 0x04000006, 0x5804001c, 0x4803c857, 0x81300580,
-+ 0x04020002, 0x4978081c, 0x497a6008, 0x4a026004,
-+ 0x00004000, 0x59a80034, 0x82000c80, 0x00000051,
-+ 0x04001002, 0x80000102, 0x48026206, 0x497a6205,
-+ 0x497a6009, 0x4a026406, 0x00000007, 0x1c01f000,
-+ 0x4c000000, 0x0401f804, 0x41318800, 0x5c000000,
- 0x1c01f000, 0x8166c9c0, 0x0400001c, 0x41626000,
- 0x41580000, 0x59300a03, 0x82040d80, 0x00000000,
- 0x04000008, 0x83326400, 0x00000024, 0x81300c80,
-- 0x040017f9, 0x42026000, 0x0010cfc0, 0x0401f7f6,
-+ 0x040017f9, 0x42026000, 0x0010d8d4, 0x0401f7f6,
- 0x4933c857, 0x8166c840, 0x83300c00, 0x00000024,
- 0x80040480, 0x04021006, 0x4006c000, 0x4a026203,
- 0x00000008, 0x813261c0, 0x1c01f000, 0x4202c000,
-- 0x0010cfc0, 0x0401f7fa, 0x42000000, 0x0010b653,
-- 0x0201f800, 0x0010a86e, 0x4933c856, 0x417a6000,
-- 0x0401f7f5, 0x4933c857, 0x83380580, 0x00000013,
-- 0x0402000b, 0x59300004, 0x8c00053e, 0x04000007,
-- 0x0201f800, 0x0010698c, 0x0201f800, 0x001068f6,
-- 0x0201f800, 0x00106982, 0x1c01f000, 0x4933c857,
-- 0x59880053, 0x80000000, 0x48031053, 0x1c01f000,
-- 0x4933c857, 0x59300203, 0x82003480, 0x0000000e,
-- 0x02021800, 0x00100615, 0x4d2c0000, 0x0c01f803,
-- 0x5c025800, 0x1c01f000, 0x00107718, 0x00107c84,
-- 0x00107dd4, 0x00107718, 0x00107e3a, 0x0010787c,
-- 0x00107718, 0x00107718, 0x00107c1a, 0x00107718,
-- 0x00107718, 0x00107718, 0x00107718, 0x00107718,
-- 0x0201f800, 0x00100615, 0x4933c857, 0x59300203,
-- 0x82003480, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x0010772f, 0x001087f0, 0x0010772f,
-- 0x0010772f, 0x0010772f, 0x0010772f, 0x0010772f,
-- 0x0010772f, 0x0010879a, 0x0010880c, 0x0010887a,
-- 0x0010880c, 0x0010887a, 0x0010772f, 0x0201f800,
-- 0x00100615, 0x0201f800, 0x00100615, 0x4933c857,
-- 0x4d2c0000, 0x59325808, 0x59300203, 0x82003480,
-- 0x0000000e, 0x02021800, 0x00100615, 0x0c01f803,
-- 0x5c025800, 0x1c01f000, 0x0010774c, 0x0010774c,
-- 0x0010774c, 0x00107768, 0x001077b4, 0x0010774c,
-- 0x0010774c, 0x0010774c, 0x0010774e, 0x0010774c,
-- 0x0010774c, 0x0010774c, 0x0010774c, 0x0010774c,
-- 0x0201f800, 0x00100615, 0x4933c857, 0x83380580,
-- 0x00000040, 0x02020800, 0x00100615, 0x4a026007,
-- 0x00082000, 0x4a026203, 0x00000003, 0x493a6403,
-- 0x4a025c08, 0x00000001, 0x592c000d, 0x48026011,
-- 0x497a6013, 0x592c0208, 0x800000c2, 0x800010c4,
-- 0x80081400, 0x480a6206, 0x0201f800, 0x00100f9c,
-- 0x42000800, 0x80000060, 0x0201f000, 0x00106466,
-- 0x4933c857, 0x83380480, 0x00000050, 0x02021800,
-- 0x00100615, 0x83380480, 0x00000049, 0x02001800,
-- 0x00100615, 0x0c01f001, 0x0010777b, 0x00107786,
-- 0x00107779, 0x00107779, 0x00107779, 0x00107779,
-- 0x00107791, 0x0201f800, 0x00100615, 0x4a026203,
-- 0x00000004, 0x4a025c08, 0x00000002, 0x592c0207,
-- 0x48025c09, 0x592c0209, 0x48025a07, 0x592c000c,
-- 0x4802580d, 0x1c01f000, 0x0201f800, 0x001068c1,
-- 0x0201f800, 0x00108df4, 0x04000005, 0x4a025a06,
-- 0x00000006, 0x0201f800, 0x00020381, 0x0201f000,
-- 0x000208b4, 0x0201f800, 0x001068c1, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x42003000, 0x00000014, 0x41782800, 0x42002000,
-- 0x00000002, 0x4d400000, 0x4d440000, 0x59368c03,
-- 0x42028000, 0x00000029, 0x0201f800, 0x0010962a,
-- 0x5c028800, 0x5c028000, 0x42000000, 0x0010b663,
-- 0x0201f800, 0x0010a86e, 0x0201f800, 0x00108df4,
-- 0x02000000, 0x000208b4, 0x4a025a06, 0x00000029,
-- 0x0201f800, 0x00020381, 0x0201f000, 0x000208b4,
-- 0x4933c857, 0x83380580, 0x00000048, 0x04000005,
-- 0x83380580, 0x00000053, 0x02020800, 0x00100615,
-- 0x592c0206, 0x82000580, 0x00000007, 0x04000009,
-- 0x59300011, 0x80000540, 0x04000006, 0x592c080c,
-- 0x80040480, 0x4802580c, 0x4a025a06, 0x00000015,
-- 0x592c0206, 0x80000540, 0x04020003, 0x4a025a06,
-- 0x00000000, 0x0201f800, 0x00020381, 0x0201f000,
-- 0x000208b4, 0x4933c857, 0x4d2c0000, 0x4c500000,
-- 0x4c540000, 0x4c580000, 0x0201f800, 0x0010082a,
-- 0x02000800, 0x00100615, 0x497a5a06, 0x59a8006e,
-- 0x82000500, 0x0000f000, 0x48025c07, 0x59a80816,
-- 0x82040c00, 0x00000018, 0x48065a07, 0x412c7800,
-- 0x4d2c0000, 0x41cca000, 0x42002800, 0x00000001,
-- 0x42001000, 0x0000002c, 0x82040480, 0x0000002d,
-- 0x04021006, 0x832cac00, 0x00000009, 0x0201f800,
-- 0x0010894a, 0x0401f02e, 0x40043000, 0x42000800,
-- 0x0000002c, 0x832cac00, 0x00000009, 0x0201f800,
-- 0x0010894a, 0x82183480, 0x0000002c, 0x0201f800,
-- 0x0010082a, 0x0400001a, 0x80142800, 0x4a025804,
-- 0x00000110, 0x492c7801, 0x82180c80, 0x0000003d,
-- 0x04021007, 0x40180800, 0x832cac00, 0x00000005,
-- 0x0201f800, 0x0010894a, 0x0401f015, 0x82081400,
-- 0x0000003c, 0x82183480, 0x0000003c, 0x42000800,
-- 0x0000003c, 0x412c7800, 0x832cac00, 0x00000005,
-- 0x0201f800, 0x0010894a, 0x0401f7e5, 0x5c025800,
-- 0x592c0206, 0x8400055e, 0x48025a06, 0x592c0407,
-- 0x80080540, 0x48025c07, 0x0401f002, 0x5c025800,
-- 0x813669c0, 0x04000003, 0x59343403, 0x0401f003,
-- 0x42003000, 0x0000ffff, 0x49325808, 0x481a5c06,
-- 0x82100580, 0x00000054, 0x04020002, 0x491e5813,
-- 0x841401c0, 0x80100540, 0x48025804, 0x592c0001,
-- 0x497a5801, 0x4c000000, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x812e59c0, 0x040207f9, 0x5c00b000,
-- 0x5c00a800, 0x5c00a000, 0x5c025800, 0x1c01f000,
-- 0x4803c856, 0x4c5c0000, 0x4d2c0000, 0x4c500000,
-- 0x4c540000, 0x4c580000, 0x412cb800, 0x592c040b,
-- 0x8c000516, 0x04000003, 0x41cca000, 0x0401f003,
-- 0x83cca400, 0x00000006, 0x4008b000, 0x41781000,
-- 0x82580480, 0x00000012, 0x04001004, 0x4200b000,
-- 0x00000012, 0x40001000, 0x4c080000, 0x4d2c0000,
-- 0x0201f800, 0x0010082a, 0x04000023, 0x5c001800,
-- 0x492c1801, 0x485a5800, 0x832cac00, 0x00000002,
-- 0x0201f800, 0x0010a94f, 0x585c040b, 0x8c000500,
-+ 0x0010d8d4, 0x0401f7fa, 0x42000000, 0x0010b023,
-+ 0x0201f800, 0x0010a260, 0x4933c856, 0x417a6000,
-+ 0x0401f7f5, 0x4c000000, 0x0201f800, 0x000207df,
-+ 0x5c000000, 0x1c01f000, 0x4933c857, 0x83380580,
-+ 0x00000013, 0x0402000b, 0x59300004, 0x8c00053e,
-+ 0x04000007, 0x0201f800, 0x00106476, 0x0201f800,
-+ 0x001063c4, 0x0201f800, 0x00106463, 0x1c01f000,
-+ 0x4933c857, 0x59880053, 0x80000000, 0x48031053,
-+ 0x1c01f000, 0x4933c857, 0x59300203, 0x82003480,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x4d2c0000,
-+ 0x0c01f803, 0x5c025800, 0x1c01f000, 0x00107229,
-+ 0x0010779c, 0x001078f0, 0x00107229, 0x00107956,
-+ 0x00107390, 0x00107229, 0x00107229, 0x00107732,
-+ 0x00107229, 0x00107229, 0x00107229, 0x00107229,
-+ 0x00107229, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x59300203, 0x82003480, 0x0000000e, 0x02021800,
-+ 0x001004ef, 0x0c01f001, 0x00107240, 0x00108236,
-+ 0x00107240, 0x00107240, 0x00107240, 0x00107240,
-+ 0x00107240, 0x00107240, 0x001081e0, 0x00108252,
-+ 0x001082c1, 0x00108252, 0x001082c1, 0x00107240,
-+ 0x0201f800, 0x001004ef, 0x0201f800, 0x001004ef,
-+ 0x4933c857, 0x4d2c0000, 0x59325808, 0x59300203,
-+ 0x82003480, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f803, 0x5c025800, 0x1c01f000, 0x0010725d,
-+ 0x0010725d, 0x0010725d, 0x00107279, 0x001072c5,
-+ 0x0010725d, 0x0010725d, 0x0010725d, 0x0010725f,
-+ 0x0010725d, 0x0010725d, 0x0010725d, 0x0010725d,
-+ 0x0010725d, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x83380580, 0x00000040, 0x02020800, 0x001004ef,
-+ 0x4a026007, 0x00082000, 0x4a026203, 0x00000003,
-+ 0x493a6403, 0x4a025c08, 0x00000001, 0x592c000d,
-+ 0x48026011, 0x497a6013, 0x592c0208, 0x800000c2,
-+ 0x800010c4, 0x80081400, 0x480a6206, 0x0201f800,
-+ 0x00100e95, 0x42000800, 0x80000060, 0x0201f000,
-+ 0x0010632f, 0x4933c857, 0x83380480, 0x00000050,
-+ 0x02021800, 0x001004ef, 0x83380480, 0x00000049,
-+ 0x02001800, 0x001004ef, 0x0c01f001, 0x0010728c,
-+ 0x00107297, 0x0010728a, 0x0010728a, 0x0010728a,
-+ 0x0010728a, 0x001072a2, 0x0201f800, 0x001004ef,
-+ 0x4a026203, 0x00000004, 0x4a025c08, 0x00000002,
-+ 0x592c0207, 0x48025c09, 0x592c0209, 0x48025a07,
-+ 0x592c000c, 0x4802580d, 0x1c01f000, 0x0201f800,
-+ 0x001063a4, 0x0201f800, 0x0010883d, 0x04000005,
-+ 0x4a025a06, 0x00000006, 0x0201f800, 0x000202e9,
-+ 0x0201f000, 0x000207bb, 0x0201f800, 0x001063a4,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010caa0,
-+ 0x5c027800, 0x42003000, 0x00000014, 0x41782800,
-+ 0x42002000, 0x00000002, 0x4d400000, 0x4d440000,
-+ 0x59368c03, 0x42028000, 0x00000029, 0x0201f800,
-+ 0x001090b2, 0x5c028800, 0x5c028000, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x0201f800,
-+ 0x0010883d, 0x02000000, 0x000207bb, 0x4a025a06,
-+ 0x00000029, 0x0201f800, 0x000202e9, 0x0201f000,
-+ 0x000207bb, 0x4933c857, 0x83380580, 0x00000048,
-+ 0x04000005, 0x83380580, 0x00000053, 0x02020800,
-+ 0x001004ef, 0x592c0206, 0x82000580, 0x00000007,
-+ 0x04000009, 0x59300011, 0x80000540, 0x04000006,
-+ 0x592c080c, 0x80040480, 0x4802580c, 0x4a025a06,
-+ 0x00000015, 0x592c0206, 0x80000540, 0x04020003,
-+ 0x4a025a06, 0x00000000, 0x0201f800, 0x000202e9,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x4d2c0000,
-+ 0x4c500000, 0x4c540000, 0x4c580000, 0x0201f800,
-+ 0x0010071a, 0x02000800, 0x001004ef, 0x497a5a06,
-+ 0x59a8006b, 0x82000500, 0x0000f000, 0x48025c07,
-+ 0x59a80815, 0x82040c00, 0x00000018, 0x48065a07,
-+ 0x412c7800, 0x4d2c0000, 0x41cca000, 0x42002800,
-+ 0x00000001, 0x42001000, 0x0000002c, 0x82040480,
-+ 0x0000002d, 0x04021006, 0x832cac00, 0x00000009,
-+ 0x0201f800, 0x00108393, 0x0401f02e, 0x40043000,
-+ 0x42000800, 0x0000002c, 0x832cac00, 0x00000009,
-+ 0x0201f800, 0x00108393, 0x82183480, 0x0000002c,
-+ 0x0201f800, 0x0010071a, 0x0400001a, 0x80142800,
-+ 0x4a025804, 0x00000110, 0x492c7801, 0x82180c80,
-+ 0x0000003d, 0x04021007, 0x40180800, 0x832cac00,
-+ 0x00000005, 0x0201f800, 0x00108393, 0x0401f015,
-+ 0x82081400, 0x0000003c, 0x82183480, 0x0000003c,
-+ 0x42000800, 0x0000003c, 0x412c7800, 0x832cac00,
-+ 0x00000005, 0x0201f800, 0x00108393, 0x0401f7e5,
-+ 0x5c025800, 0x592c0206, 0x8400055e, 0x48025a06,
-+ 0x592c0407, 0x80080540, 0x48025c07, 0x0401f002,
-+ 0x5c025800, 0x813669c0, 0x04000003, 0x59343403,
-+ 0x0401f003, 0x42003000, 0x0000ffff, 0x49325808,
-+ 0x481a5c06, 0x82100580, 0x00000054, 0x04020002,
-+ 0x491e5813, 0x841401c0, 0x80100540, 0x48025804,
-+ 0x592c0001, 0x497a5801, 0x4c000000, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x812e59c0, 0x040207f9,
-+ 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x5c025800,
-+ 0x1c01f000, 0x4803c856, 0x4c5c0000, 0x4d2c0000,
-+ 0x4c500000, 0x4c540000, 0x4c580000, 0x412cb800,
-+ 0x592c040b, 0x8c000516, 0x04000003, 0x41cca000,
-+ 0x0401f003, 0x83cca400, 0x00000006, 0x4008b000,
-+ 0x41781000, 0x82580480, 0x00000048, 0x04001004,
-+ 0x4200b000, 0x00000048, 0x40001000, 0x4c080000,
-+ 0x4d2c0000, 0x0201f800, 0x0010071a, 0x04000026,
-+ 0x5c001800, 0x492c1801, 0x485a5800, 0x8258b400,
-+ 0x00000003, 0x8058b104, 0x832cac00, 0x00000002,
-+ 0x0201f800, 0x0010a341, 0x585c040b, 0x8c000500,
- 0x0400000e, 0x832c1400, 0x00000002, 0x8c000516,
- 0x04000003, 0x82081400, 0x00000006, 0x46001000,
- 0x00000001, 0x80081000, 0x46001000, 0x00000900,
- 0x84000500, 0x4800bc0b, 0x5c001000, 0x800811c0,
-- 0x040207da, 0x82000540, 0x00000001, 0x5c00b000,
-+ 0x040207d7, 0x82000540, 0x00000001, 0x5c00b000,
- 0x5c00a800, 0x5c00a000, 0x5c025800, 0x5c00b800,
- 0x1c01f000, 0x5c025800, 0x5c001000, 0x0401f7f8,
- 0x4933c857, 0x83380d80, 0x00000015, 0x04020003,
-- 0x0201f000, 0x000208b4, 0x83380d80, 0x00000016,
-- 0x02020800, 0x00100615, 0x0201f000, 0x000208b4,
-+ 0x0201f000, 0x000207bb, 0x83380d80, 0x00000016,
-+ 0x02020800, 0x001004ef, 0x0201f000, 0x000207bb,
- 0x4933c857, 0x4d2c0000, 0x4c500000, 0x4c540000,
- 0x4c580000, 0x59325808, 0x83cca400, 0x00000006,
- 0x59cc1806, 0x820c0580, 0x01000000, 0x04020004,
- 0x4200b000, 0x00000002, 0x0401f00f, 0x4200b000,
- 0x00000008, 0x832cac00, 0x00000005, 0x0201f800,
-- 0x0010a93e, 0x8c0c1d00, 0x0400000b, 0x4200b000,
-+ 0x0010a330, 0x8c0c1d00, 0x0400000b, 0x4200b000,
- 0x00000008, 0x592e5801, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x832cac00, 0x00000005, 0x0201f800,
-- 0x0010a93e, 0x0401f816, 0x5c00b000, 0x5c00a800,
-+ 0x001004ef, 0x832cac00, 0x00000005, 0x0201f800,
-+ 0x0010a330, 0x0401f816, 0x5c00b000, 0x5c00a800,
- 0x5c00a000, 0x5c025800, 0x1c01f000, 0x4933c857,
- 0x4c500000, 0x4c540000, 0x4c580000, 0x83cca400,
- 0x00000006, 0x5930a808, 0x8254ac00, 0x00000005,
-- 0x4200b000, 0x00000007, 0x0201f800, 0x0010a93e,
-+ 0x4200b000, 0x00000007, 0x0201f800, 0x0010a330,
- 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x4933c857,
-- 0x0201f800, 0x00108df4, 0x02000000, 0x000208b4,
-- 0x4d2c0000, 0x0201f800, 0x00109360, 0x0402000b,
-+ 0x0201f800, 0x0010883d, 0x02000000, 0x000207bb,
-+ 0x4d2c0000, 0x0201f800, 0x00108de6, 0x0402000b,
- 0x41780800, 0x4d400000, 0x42028000, 0x00000000,
-- 0x0201f800, 0x00109204, 0x5c028000, 0x5c025800,
-- 0x0201f000, 0x000208b4, 0x5931d821, 0x58ef400b,
-+ 0x0201f800, 0x00108c81, 0x5c028000, 0x5c025800,
-+ 0x0201f000, 0x000207bb, 0x5931d821, 0x58ef400b,
- 0x58ee580d, 0x4a025a04, 0x00000103, 0x58ec0009,
-- 0x0801f800, 0x5c025800, 0x0201f000, 0x000208b4,
-+ 0x0801f800, 0x5c025800, 0x0201f000, 0x000207bb,
- 0x4933c857, 0x59cc1806, 0x820c0580, 0x02000000,
- 0x04020014, 0x4a026802, 0x00fffffd, 0x5934000a,
- 0x84000504, 0x4802680a, 0x59300808, 0x800409c0,
-- 0x02000000, 0x000208b4, 0x4a000a04, 0x00000103,
-+ 0x02000000, 0x000207bb, 0x4a000a04, 0x00000103,
- 0x480c0805, 0x5931d821, 0x58ef400b, 0x58ee580d,
-- 0x58ec0009, 0x0801f800, 0x0201f000, 0x000208b4,
-- 0x42000000, 0x0010b66b, 0x0201f800, 0x0010a86e,
-+ 0x58ec0009, 0x0801f800, 0x0201f000, 0x000207bb,
-+ 0x42000000, 0x0010b03b, 0x0201f800, 0x0010a260,
- 0x4c0c0000, 0x0401f804, 0x5c001800, 0x040207eb,
- 0x1c01f000, 0x4933c857, 0x4d2c0000, 0x59325808,
- 0x812e59c0, 0x04020009, 0x497a6206, 0x497a6205,
-- 0x4d380000, 0x42027000, 0x00000022, 0x0401fb77,
-+ 0x4d380000, 0x42027000, 0x00000022, 0x0401fb7b,
- 0x5c027000, 0x80000580, 0x5c025800, 0x1c01f000,
- 0x4933c857, 0x4d2c0000, 0x4c500000, 0x4c540000,
- 0x4c580000, 0x59325808, 0x592e5801, 0x832cac00,
-- 0x00000005, 0x83cca400, 0x00000006, 0x59a8086e,
-+ 0x00000005, 0x83cca400, 0x00000006, 0x59a8086b,
- 0x82040d00, 0x000003ff, 0x82041480, 0x0000000f,
- 0x0400101b, 0x4200b000, 0x0000000f, 0x0201f800,
-- 0x0010a93e, 0x592e5801, 0x832cac00, 0x00000005,
-+ 0x0010a330, 0x592e5801, 0x832cac00, 0x00000005,
- 0x82080c80, 0x0000000f, 0x0400100d, 0x4200b000,
-- 0x0000000f, 0x0201f800, 0x0010a93e, 0x592e5801,
-+ 0x0000000f, 0x0201f800, 0x0010a330, 0x592e5801,
- 0x832cac00, 0x00000005, 0x82041480, 0x0000000f,
- 0x04001007, 0x42001000, 0x0000000f, 0x4008b000,
-- 0x0201f800, 0x0010a93e, 0x0401f004, 0x4004b000,
-- 0x0201f800, 0x0010a93e, 0x5931d821, 0x58ef400b,
-+ 0x0201f800, 0x0010a330, 0x0401f004, 0x4004b000,
-+ 0x0201f800, 0x0010a330, 0x5931d821, 0x58ef400b,
- 0x58ee580d, 0x4a025a04, 0x00000103, 0x592e5801,
-- 0x58ec0009, 0x0801f800, 0x0201f800, 0x000208b4,
-+ 0x58ec0009, 0x0801f800, 0x0201f800, 0x000207bb,
- 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x5c025800,
- 0x1c01f000, 0x4933c857, 0x4d2c0000, 0x4c500000,
- 0x4c540000, 0x4c580000, 0x59cc0006, 0x82000d80,
-@@ -7820,1395 +7492,1351 @@ uint32_t risc_code01[] = {
- 0x8258b500, 0x000000ff, 0x8058b104, 0x8258b400,
- 0x00000002, 0x82580c80, 0x00000007, 0x04001003,
- 0x4200b000, 0x00000006, 0x83cca400, 0x00000006,
-- 0x59301008, 0x800811c0, 0x02000800, 0x00100615,
-- 0x8208ac00, 0x00000005, 0x0201f800, 0x0010a93e,
-+ 0x59301008, 0x800811c0, 0x02000800, 0x001004ef,
-+ 0x8208ac00, 0x00000005, 0x0201f800, 0x0010a330,
- 0x82000d00, 0xff000000, 0x800409c0, 0x04000019,
- 0x8200b500, 0x000000ff, 0x8058b104, 0x82580c80,
- 0x0000000e, 0x04001003, 0x4200b000, 0x0000000d,
-- 0x58081001, 0x800811c0, 0x02000800, 0x00100615,
-- 0x8208ac00, 0x00000005, 0x0201f800, 0x0010a93e,
-+ 0x58081001, 0x800811c0, 0x02000800, 0x001004ef,
-+ 0x8208ac00, 0x00000005, 0x0201f800, 0x0010a330,
- 0x0401f008, 0x59301008, 0x800811c0, 0x02000800,
-- 0x00100615, 0x48001005, 0x59cc0007, 0x48001006,
-+ 0x001004ef, 0x48001005, 0x59cc0007, 0x48001006,
- 0x0401ff3b, 0x5c00b000, 0x5c00a800, 0x5c00a000,
- 0x5c025800, 0x1c01f000, 0x4933c857, 0x42000800,
- 0x00000000, 0x59cc0006, 0x82000580, 0x02000000,
- 0x04000003, 0x42000800, 0x00000001, 0x4d2c0000,
-- 0x59325808, 0x812e59c0, 0x02000800, 0x00100615,
-- 0x48065a06, 0x0201f800, 0x00020381, 0x5c025800,
-- 0x0201f000, 0x000208b4, 0x4933c857, 0x4d2c0000,
-+ 0x59325808, 0x812e59c0, 0x02000800, 0x001004ef,
-+ 0x48065a06, 0x0201f800, 0x000202e9, 0x5c025800,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x4d2c0000,
- 0x4c500000, 0x4c540000, 0x4c580000, 0x4200b000,
- 0x00000002, 0x59cc0806, 0x82040580, 0x01000000,
- 0x04000004, 0x8204b500, 0x0000ffff, 0x8058b104,
- 0x83cca400, 0x00000006, 0x59300008, 0x8200ac00,
-- 0x00000005, 0x0201f800, 0x0010a93e, 0x0401ff0c,
-+ 0x00000005, 0x0201f800, 0x0010a330, 0x0401ff0c,
- 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x5c025800,
- 0x1c01f000, 0x4933c857, 0x4803c857, 0x4807c857,
- 0x480bc857, 0x480fc857, 0x4813c857, 0x481bc857,
- 0x492fc857, 0x4d2c0000, 0x4c000000, 0x0201f800,
-- 0x00100819, 0x5c000000, 0x0400000f, 0x48025803,
-+ 0x00100704, 0x5c000000, 0x0400000f, 0x48025803,
- 0x5c000000, 0x4802580a, 0x4c000000, 0x481a5801,
-- 0x48125809, 0x48065804, 0x480a5807, 0x480e5808,
-- 0x412c1000, 0x0201f800, 0x001008a1, 0x82000540,
-+ 0x48125809, 0x48065805, 0x480a5807, 0x480e5808,
-+ 0x412c1000, 0x0201f800, 0x0010079e, 0x82000540,
- 0x00000001, 0x5c025800, 0x1c01f000, 0x4933c857,
-- 0x4d1c0000, 0x59cc0001, 0x82000500, 0x00ffffff,
-+ 0x4937c857, 0x4d1c0000, 0x0201f800, 0x00105ae9,
-+ 0x04020025, 0x59cc0001, 0x82000500, 0x00ffffff,
- 0x59341002, 0x82081500, 0x00ffffff, 0x80080580,
-- 0x0402001f, 0x497a6205, 0x4d380000, 0x42027000,
-- 0x00000035, 0x0201f800, 0x00109183, 0x5c027000,
-- 0x04020012, 0x591c001c, 0x800001c0, 0x0400000f,
-- 0x497a381c, 0x591c0414, 0x8c000502, 0x02000800,
-- 0x00100615, 0x84000502, 0x48023c14, 0x591c1406,
-- 0x82080580, 0x00000003, 0x04000006, 0x82080580,
-- 0x00000006, 0x04000005, 0x0401fc9e, 0x0401f004,
-- 0x0401f805, 0x0401f002, 0x0401f8c0, 0x5c023800,
-- 0x1c01f000, 0x4d2c0000, 0x591e5808, 0x4933c857,
-- 0x491fc857, 0x493bc857, 0x492fc857, 0x83380580,
-- 0x00000015, 0x040000b3, 0x83380580, 0x00000016,
-- 0x040200ae, 0x4d300000, 0x411e6000, 0x59cc0207,
-- 0x4803c857, 0x82000d00, 0x0000ff00, 0x82040580,
-- 0x00001700, 0x04000004, 0x82040580, 0x00000300,
-- 0x0402005b, 0x591c0203, 0x4803c857, 0x82000580,
-- 0x0000000d, 0x0400003f, 0x812e59c0, 0x0400009a,
-- 0x591c0202, 0x4803c857, 0x82000580, 0x0000ffff,
-- 0x0402007e, 0x592c020a, 0x4803c857, 0x82000500,
-- 0x00000003, 0x82000580, 0x00000002, 0x04020007,
-- 0x592c080f, 0x591c0011, 0x4803c857, 0x4807c857,
-- 0x80040580, 0x04020071, 0x591c0414, 0x4803c857,
-- 0x8c000500, 0x0402006d, 0x41780800, 0x591c1206,
-- 0x42000000, 0x0000000a, 0x0201f800, 0x001063ee,
-- 0x592c0406, 0x4803c857, 0x800001c0, 0x0400000c,
-- 0x80080c80, 0x04001004, 0x02020800, 0x00100615,
-- 0x80001040, 0x480a5c06, 0x800811c0, 0x04020004,
-- 0x0201f800, 0x00108b3c, 0x0401f06b, 0x0201f800,
-- 0x00108ee7, 0x591c0817, 0x591c0018, 0x48065808,
-- 0x48025809, 0x59300007, 0x8c000500, 0x02020800,
-- 0x00100ee4, 0x497a3808, 0x0201f800, 0x000201ee,
-- 0x0402004a, 0x411e6000, 0x0401fc3e, 0x0401f05a,
-- 0x0401fc6d, 0x04000013, 0x49366009, 0x4a026406,
-- 0x00000003, 0x492e6008, 0x591c0817, 0x591c1018,
-- 0x48066017, 0x480a6018, 0x4d380000, 0x591e7403,
-- 0x4d300000, 0x411e6000, 0x0401fc2e, 0x5c026000,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x0401f046,
-- 0x59a80039, 0x48023a05, 0x0401f043, 0x59cc0407,
-- 0x82000580, 0x0000000b, 0x04020025, 0x59340a00,
-- 0x84040d0e, 0x48066a00, 0x592c0a04, 0x82040d00,
-- 0x000000ff, 0x82040d80, 0x00000014, 0x04000003,
-- 0x4a02621d, 0x00000003, 0x59300007, 0x8c000500,
-- 0x02020800, 0x00100ee4, 0x4d400000, 0x42028000,
-- 0x00000003, 0x592c0a08, 0x0201f800, 0x00104bee,
-- 0x0201f800, 0x00020381, 0x5c028000, 0x497a6008,
-- 0x4a026403, 0x00000085, 0x4a026203, 0x00000009,
-- 0x4a026406, 0x00000002, 0x42000800, 0x8000404b,
-- 0x0201f800, 0x00020855, 0x0401f01b, 0x59cc0207,
-- 0x82000580, 0x00002a00, 0x04020004, 0x59a80039,
-- 0x48023a05, 0x0401f014, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x4a025a04, 0x00000103, 0x591c0007,
-- 0x8c000500, 0x02020800, 0x00100ee4, 0x591c0402,
-- 0x48025c06, 0x4a025a06, 0x00000003, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00107698, 0x0201f800,
-- 0x00104801, 0x5c026000, 0x0201f800, 0x000208b4,
-- 0x0401f002, 0x5c026000, 0x5c025800, 0x1c01f000,
-- 0x0401f819, 0x0401f7fd, 0x4933c857, 0x83380580,
-- 0x00000015, 0x04020004, 0x59a80039, 0x48023a05,
-- 0x0401f00d, 0x83380580, 0x00000016, 0x0402000d,
-- 0x4d300000, 0x411e6000, 0x0201f800, 0x0010a3fa,
-- 0x0201f800, 0x00020831, 0x0201f800, 0x000208b4,
-- 0x5c026000, 0x497a381c, 0x0201f800, 0x000208b4,
-- 0x1c01f000, 0x591c0414, 0x84000540, 0x48023c14,
-- 0x59cc100b, 0x4933c857, 0x491fc857, 0x492fc857,
-- 0x4803c857, 0x480bc857, 0x8c08153c, 0x04000006,
-- 0x59a80039, 0x48023a05, 0x497a381c, 0x0201f000,
-- 0x000208b4, 0x4d300000, 0x411e6000, 0x0201f800,
-- 0x0010898b, 0x5c026000, 0x591c0406, 0x82000580,
-- 0x00000000, 0x02000000, 0x000208b4, 0x591c0403,
-- 0x82000580, 0x00000050, 0x0402000d, 0x4d300000,
-- 0x411e6000, 0x4a026203, 0x00000001, 0x42000800,
-- 0x80000043, 0x0201f800, 0x00020855, 0x5c026000,
-- 0x497a381c, 0x0201f000, 0x000208b4, 0x591c0203,
-- 0x82000580, 0x0000000d, 0x04000014, 0x812e59c0,
-- 0x02000800, 0x00100615, 0x591c0203, 0x82000580,
-- 0x00000004, 0x04020011, 0x592c020a, 0x8c000502,
-- 0x0400000e, 0x4a023812, 0x0fffffff, 0x592c0208,
-- 0x8400051e, 0x48025a08, 0x42000000, 0x00000001,
-- 0x48023a14, 0x0401f021, 0x42000000, 0x00000007,
-- 0x48023a14, 0x0401f01d, 0x592c020a, 0x4803c857,
-- 0x8c000500, 0x0402000b, 0x8c000502, 0x040007f7,
-- 0x591c0414, 0x8c00051c, 0x040207eb, 0x591c0011,
-- 0x4803c857, 0x800001c0, 0x040007f0, 0x0401f7e6,
-- 0x8c08153a, 0x040207ed, 0x59cc000a, 0x592c180f,
-- 0x4803c857, 0x480fc857, 0x800c0580, 0x040007e7,
-- 0x59cc000a, 0x4803c857, 0x48023816, 0x42000000,
-- 0x00000005, 0x48023a14, 0x0201f000, 0x0010901b,
-- 0x4933c857, 0x4d1c0000, 0x59cc0001, 0x59341002,
-- 0x80080580, 0x82000500, 0x00ffffff, 0x04020041,
-- 0x59301419, 0x0201f800, 0x001091d9, 0x02000800,
-- 0x00100615, 0x591c1406, 0x82080580, 0x00000007,
-- 0x04000038, 0x82080580, 0x00000002, 0x04000035,
-- 0x82080580, 0x00000000, 0x04000032, 0x591c0202,
-- 0x82000d80, 0x0000ffff, 0x04000004, 0x59301a19,
-- 0x800c0580, 0x0402002b, 0x83380580, 0x00000015,
-- 0x04000026, 0x4d300000, 0x4d2c0000, 0x411e6000,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x02000800,
-- 0x00100615, 0x592c0204, 0x82000500, 0x000000ff,
-- 0x82000580, 0x00000014, 0x04000003, 0x4a02621d,
-- 0x00000003, 0x42028000, 0x00000003, 0x592c0a08,
-- 0x0201f800, 0x00104bee, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x497a6008, 0x4a026403, 0x00000085,
-+ 0x0402001d, 0x497a6205, 0x42000800, 0x00000035,
-+ 0x0201f800, 0x00108bff, 0x04020012, 0x591c001c,
-+ 0x800001c0, 0x0400000f, 0x497a381c, 0x591c0414,
-+ 0x8c000502, 0x02000800, 0x001004ef, 0x84000502,
-+ 0x48023c14, 0x591c1406, 0x82080580, 0x00000003,
-+ 0x04000006, 0x82080580, 0x00000006, 0x04000005,
-+ 0x0401fc8c, 0x0401f004, 0x0401f805, 0x0401f002,
-+ 0x0401f8c0, 0x5c023800, 0x1c01f000, 0x4d2c0000,
-+ 0x591e5808, 0x4933c857, 0x491fc857, 0x493bc857,
-+ 0x492fc857, 0x83380580, 0x00000015, 0x040000b3,
-+ 0x83380580, 0x00000016, 0x040200ae, 0x4d300000,
-+ 0x411e6000, 0x59cc0207, 0x4803c857, 0x82000d00,
-+ 0x0000ff00, 0x82040580, 0x00001700, 0x04000004,
-+ 0x82040580, 0x00000300, 0x0402005b, 0x591c0203,
-+ 0x4803c857, 0x82000580, 0x0000000d, 0x0400003f,
-+ 0x812e59c0, 0x0400009a, 0x591c0202, 0x4803c857,
-+ 0x82000580, 0x0000ffff, 0x0402007e, 0x592c020a,
-+ 0x4803c857, 0x82000500, 0x00000003, 0x82000580,
-+ 0x00000002, 0x04020007, 0x592c080f, 0x591c0011,
-+ 0x4803c857, 0x4807c857, 0x80040580, 0x04020071,
-+ 0x591c0414, 0x4803c857, 0x8c000500, 0x0402006d,
-+ 0x41780800, 0x591c1206, 0x42000000, 0x0000000a,
-+ 0x0201f800, 0x001062b7, 0x592c0406, 0x4803c857,
-+ 0x800001c0, 0x0400000c, 0x80080c80, 0x04001004,
-+ 0x02020800, 0x001004ef, 0x80001040, 0x480a5c06,
-+ 0x800811c0, 0x04020004, 0x0201f800, 0x00108589,
-+ 0x0401f06b, 0x0201f800, 0x00108942, 0x591c0817,
-+ 0x591c0018, 0x48065808, 0x48025809, 0x59300007,
-+ 0x8c000500, 0x02020800, 0x00100ddd, 0x497a3808,
-+ 0x0201f800, 0x000201e0, 0x0402004a, 0x411e6000,
-+ 0x0401fc2c, 0x0401f05a, 0x0401fc63, 0x04000013,
-+ 0x49366009, 0x4a026406, 0x00000003, 0x492e6008,
-+ 0x591c0817, 0x591c1018, 0x48066017, 0x480a6018,
-+ 0x4d380000, 0x591e7403, 0x4d300000, 0x411e6000,
-+ 0x0401fc1c, 0x5c026000, 0x0201f800, 0x000207df,
-+ 0x5c027000, 0x0401f046, 0x59a80036, 0x48023a05,
-+ 0x0401f043, 0x59cc0407, 0x82000580, 0x0000000b,
-+ 0x04020025, 0x59340a00, 0x84040d0e, 0x48066a00,
-+ 0x592c0a04, 0x82040d00, 0x000000ff, 0x82040d80,
-+ 0x00000014, 0x04000003, 0x4a02621d, 0x00000003,
-+ 0x59300007, 0x8c000500, 0x02020800, 0x00100ddd,
-+ 0x4d400000, 0x42028000, 0x00000003, 0x592c0a08,
-+ 0x0201f800, 0x00104a8e, 0x0201f800, 0x000202e9,
-+ 0x5c028000, 0x497a6008, 0x4a026403, 0x00000085,
- 0x4a026203, 0x00000009, 0x4a026406, 0x00000002,
-- 0x42000800, 0x8000404b, 0x0201f800, 0x00020855,
-- 0x5c026000, 0x0401f003, 0x59a80039, 0x48023a05,
-- 0x497a381c, 0x0201f800, 0x000208b4, 0x5c023800,
-- 0x1c01f000, 0x4933c857, 0x4c580000, 0x4d2c0000,
-- 0x59325808, 0x83383580, 0x00000015, 0x04000010,
-- 0x59342200, 0x84102502, 0x48126a00, 0x0201f800,
-- 0x00108df4, 0x04000066, 0x0201f800, 0x00109360,
-- 0x04020005, 0x4200b000, 0x00000002, 0x0201f800,
-- 0x00109346, 0x0401fa0d, 0x0401f079, 0x83cc1400,
-- 0x00000008, 0x4200b000, 0x00000002, 0x83341c00,
-- 0x00000006, 0x0201f800, 0x001082ff, 0x04020015,
-- 0x83cc1400, 0x0000000a, 0x4200b000, 0x00000002,
-- 0x83341c00, 0x00000008, 0x0201f800, 0x001082ff,
-- 0x0402000c, 0x0201f800, 0x00101e1b, 0x59342200,
-- 0x59cc1007, 0x800811c0, 0x04000003, 0x480a6801,
-- 0x84102542, 0x8410251a, 0x48126a00, 0x0401f05f,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x00101de2,
-- 0x5c027800, 0x42000000, 0x0010b663, 0x0201f800,
-- 0x0010a86e, 0x59340200, 0x84000558, 0x48026a00,
-- 0x4d300000, 0x0201f800, 0x00020892, 0x02000800,
-- 0x00100615, 0x49366009, 0x497a6008, 0x4a026406,
-- 0x00000001, 0x4a026403, 0x00000001, 0x42003000,
-- 0x00000003, 0x0201f800, 0x0010a766, 0x0201f800,
-- 0x0010393e, 0x04000011, 0x41782800, 0x42003000,
-+ 0x42000800, 0x8000404b, 0x0201f800, 0x0002075c,
-+ 0x0401f01b, 0x59cc0207, 0x82000580, 0x00002a00,
-+ 0x04020004, 0x59a80036, 0x48023a05, 0x0401f014,
-+ 0x812e59c0, 0x02000800, 0x001004ef, 0x4a025a04,
-+ 0x00000103, 0x591c0007, 0x8c000500, 0x02020800,
-+ 0x00100ddd, 0x591c0402, 0x48025c06, 0x4a025a06,
-+ 0x00000003, 0x0201f800, 0x000202e9, 0x0201f800,
-+ 0x0010719c, 0x0201f800, 0x001046db, 0x5c026000,
-+ 0x0201f800, 0x000207bb, 0x0401f002, 0x5c026000,
-+ 0x5c025800, 0x1c01f000, 0x0401f819, 0x0401f7fd,
-+ 0x4933c857, 0x83380580, 0x00000015, 0x04020004,
-+ 0x59a80036, 0x48023a05, 0x0401f00d, 0x83380580,
-+ 0x00000016, 0x0402000d, 0x4d300000, 0x411e6000,
-+ 0x0201f800, 0x00109dc7, 0x0201f800, 0x00020738,
-+ 0x0201f800, 0x000207bb, 0x5c026000, 0x497a381c,
-+ 0x0201f800, 0x000207bb, 0x1c01f000, 0x591c0414,
-+ 0x84000540, 0x48023c14, 0x59cc100b, 0x4933c857,
-+ 0x491fc857, 0x492fc857, 0x4803c857, 0x480bc857,
-+ 0x8c08153c, 0x04000006, 0x59a80036, 0x48023a05,
-+ 0x497a381c, 0x0201f000, 0x000207bb, 0x4d300000,
-+ 0x411e6000, 0x0201f800, 0x001083d4, 0x5c026000,
-+ 0x591c0406, 0x82000580, 0x00000000, 0x02000000,
-+ 0x000207bb, 0x591c0403, 0x82000580, 0x00000050,
-+ 0x0402000d, 0x4d300000, 0x411e6000, 0x4a026203,
-+ 0x00000001, 0x42000800, 0x80000043, 0x0201f800,
-+ 0x0002075c, 0x5c026000, 0x497a381c, 0x0201f000,
-+ 0x000207bb, 0x591c0203, 0x82000580, 0x0000000d,
-+ 0x04000014, 0x812e59c0, 0x02000800, 0x001004ef,
-+ 0x591c0203, 0x82000580, 0x00000004, 0x04020011,
-+ 0x592c020a, 0x8c000502, 0x0400000e, 0x4a023812,
-+ 0x0fffffff, 0x592c0208, 0x8400051e, 0x48025a08,
-+ 0x42000000, 0x00000001, 0x48023a14, 0x0401f021,
-+ 0x42000000, 0x00000007, 0x48023a14, 0x0401f01d,
-+ 0x592c020a, 0x4803c857, 0x8c000500, 0x0402000b,
-+ 0x8c000502, 0x040007f7, 0x591c0414, 0x8c00051c,
-+ 0x040207eb, 0x591c0011, 0x4803c857, 0x800001c0,
-+ 0x040007f0, 0x0401f7e6, 0x8c08153a, 0x040207ed,
-+ 0x59cc000a, 0x592c180f, 0x4803c857, 0x480fc857,
-+ 0x800c0580, 0x040007e7, 0x59cc000a, 0x4803c857,
-+ 0x48023816, 0x42000000, 0x00000005, 0x48023a14,
-+ 0x0201f000, 0x00108a82, 0x4933c857, 0x4d1c0000,
-+ 0x0201f800, 0x00105ae9, 0x0402004a, 0x59cc0001,
-+ 0x59341002, 0x80080580, 0x82000500, 0x00ffffff,
-+ 0x04020041, 0x59301419, 0x0201f800, 0x00108c55,
-+ 0x02000800, 0x001004ef, 0x591c1406, 0x82080580,
-+ 0x00000007, 0x04000038, 0x82080580, 0x00000002,
-+ 0x04000035, 0x82080580, 0x00000000, 0x04000032,
-+ 0x591c0202, 0x82000d80, 0x0000ffff, 0x04000004,
-+ 0x59301a19, 0x800c0580, 0x0402002b, 0x83380580,
-+ 0x00000015, 0x04000026, 0x4d300000, 0x4d2c0000,
-+ 0x411e6000, 0x59325808, 0x0201f800, 0x0010883d,
-+ 0x02000800, 0x001004ef, 0x592c0204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000014, 0x04000003,
-+ 0x4a02621d, 0x00000003, 0x42028000, 0x00000003,
-+ 0x592c0a08, 0x0201f800, 0x00104a8e, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x497a6008, 0x4a026403,
-+ 0x00000085, 0x4a026203, 0x00000009, 0x4a026406,
-+ 0x00000002, 0x42000800, 0x8000404b, 0x0201f800,
-+ 0x0002075c, 0x5c026000, 0x0401f003, 0x59a80036,
-+ 0x48023a05, 0x497a381c, 0x0201f800, 0x000207bb,
-+ 0x5c023800, 0x1c01f000, 0x4933c857, 0x4c580000,
-+ 0x4d2c0000, 0x59325808, 0x83383580, 0x00000015,
-+ 0x04000010, 0x59342200, 0x84102502, 0x48126a00,
-+ 0x0201f800, 0x0010883d, 0x04000065, 0x0201f800,
-+ 0x00108de6, 0x04020005, 0x4200b000, 0x00000002,
-+ 0x0201f800, 0x00108dc3, 0x0401fa10, 0x0401f078,
-+ 0x83cc1400, 0x00000008, 0x4200b000, 0x00000002,
-+ 0x83341c00, 0x00000006, 0x0201f800, 0x00107d41,
-+ 0x04020015, 0x83cc1400, 0x0000000a, 0x4200b000,
-+ 0x00000002, 0x83341c00, 0x00000008, 0x0201f800,
-+ 0x00107d41, 0x0402000c, 0x0201f800, 0x00101c36,
-+ 0x59342200, 0x59cc1007, 0x800811c0, 0x04000003,
-+ 0x480a6801, 0x84102542, 0x8410251a, 0x48126a00,
-+ 0x0401f05e, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010caa0, 0x5c027800, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x59340200, 0x84000558,
-+ 0x48026a00, 0x4d300000, 0x0201f800, 0x00020799,
-+ 0x02000800, 0x001004ef, 0x49366009, 0x497a6008,
-+ 0x4a026406, 0x00000001, 0x4a026403, 0x00000001,
-+ 0x42003000, 0x00000003, 0x0201f800, 0x0010a137,
-+ 0x8d0e1d20, 0x04000011, 0x41782800, 0x42003000,
- 0x00000001, 0x4d400000, 0x42028000, 0x00000029,
-- 0x0201f800, 0x0010a250, 0x5c028000, 0x4a026406,
-+ 0x0201f800, 0x00109c14, 0x5c028000, 0x4a026406,
- 0x00000004, 0x4a026203, 0x00000007, 0x4a026420,
- 0x00000001, 0x0401f009, 0x4a026203, 0x00000001,
-- 0x42000800, 0x0000000b, 0x0201f800, 0x001043c7,
-- 0x0201f800, 0x00106470, 0x5c026000, 0x0201f800,
-- 0x00108df4, 0x04000022, 0x0201f800, 0x00109360,
-- 0x04020022, 0x0401f9b1, 0x0401f01d, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x59340200,
-+ 0x42000800, 0x0000000b, 0x0201f800, 0x0010426c,
-+ 0x0201f800, 0x00106339, 0x5c026000, 0x0201f800,
-+ 0x0010883d, 0x04000022, 0x0201f800, 0x00108de6,
-+ 0x04020022, 0x0401f9b5, 0x0401f01d, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x59340200,
- 0x84000558, 0x48026a00, 0x42003000, 0x00000003,
- 0x41782800, 0x42002000, 0x00000005, 0x4d400000,
- 0x4d440000, 0x59368c03, 0x42028000, 0x00000029,
-- 0x0201f800, 0x0010962a, 0x5c028800, 0x5c028000,
-- 0x5c027800, 0x0201f800, 0x00101e1b, 0x0201f800,
-- 0x000208b4, 0x0401f002, 0x0401fca9, 0x5c025800,
-+ 0x0201f800, 0x001090b2, 0x5c028800, 0x5c028000,
-+ 0x5c027800, 0x0201f800, 0x00101c36, 0x0201f800,
-+ 0x000207bb, 0x0401f002, 0x0401fca5, 0x5c025800,
- 0x5c00b000, 0x1c01f000, 0x4933c857, 0x41380000,
-- 0x83383480, 0x00000056, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x00107c7e, 0x00107c79, 0x00107c7e,
-- 0x00107c7e, 0x00107c7e, 0x00107c7e, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c7e, 0x00107c77, 0x00107c7e, 0x00107c7e,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c7e, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c7e,
-- 0x00107c7e, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c7e, 0x00107c77,
-- 0x00107c77, 0x00107c7e, 0x00107c7e, 0x00107c77,
-- 0x00107c7e, 0x00107c7e, 0x00107c77, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c7e, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c7e, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c7e, 0x00107c77,
-- 0x00107c77, 0x00107c77, 0x00107c7e, 0x0201f800,
-- 0x00100615, 0x4a026203, 0x00000001, 0x493a6403,
-- 0x0201f000, 0x00106470, 0x4933c857, 0x4a026203,
-- 0x00000001, 0x493a6403, 0x0201f000, 0x00106470,
-+ 0x83383480, 0x00000056, 0x02021800, 0x001004ef,
-+ 0x0c01f001, 0x00107796, 0x00107791, 0x00107796,
-+ 0x00107796, 0x00107796, 0x00107796, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x00107796, 0x0010778f, 0x00107796, 0x00107796,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x00107796, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x00107796,
-+ 0x00107796, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x00107796, 0x0010778f,
-+ 0x0010778f, 0x00107796, 0x00107796, 0x0010778f,
-+ 0x00107796, 0x00107796, 0x0010778f, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x00107796, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x00107796, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x00107796, 0x0010778f,
-+ 0x0010778f, 0x0010778f, 0x00107796, 0x0201f800,
-+ 0x001004ef, 0x4a026203, 0x00000001, 0x493a6403,
-+ 0x0201f000, 0x00106339, 0x4933c857, 0x4a026203,
-+ 0x00000001, 0x493a6403, 0x0201f000, 0x00106339,
- 0x59300403, 0x82003480, 0x00000056, 0x02021800,
-- 0x00100615, 0x83383580, 0x00000013, 0x04000096,
-+ 0x001004ef, 0x83383580, 0x00000013, 0x04000096,
- 0x83383580, 0x00000027, 0x0402004c, 0x4933c857,
-- 0x0201f800, 0x001068f6, 0x0201f800, 0x00108ef1,
-- 0x0400000b, 0x0201f800, 0x00108f05, 0x04000041,
-+ 0x0201f800, 0x001063c4, 0x0201f800, 0x0010894c,
-+ 0x0400000b, 0x0201f800, 0x00108969, 0x04000041,
- 0x59300403, 0x82000d80, 0x00000022, 0x04020038,
-- 0x0401fc61, 0x0400003a, 0x0401f03a, 0x0201f800,
-- 0x00101e1b, 0x42000800, 0x00000007, 0x0201f800,
-- 0x001043c7, 0x0401f901, 0x4d440000, 0x59368c03,
-- 0x83440580, 0x000007fe, 0x04020008, 0x59a81026,
-- 0x84081540, 0x0201f800, 0x00104e0d, 0x04020002,
-- 0x8408154a, 0x480b5026, 0x42028000, 0x00000029,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x00101de2,
-+ 0x0401fc5d, 0x0400003a, 0x0401f03a, 0x0201f800,
-+ 0x00101c36, 0x42000800, 0x00000007, 0x0201f800,
-+ 0x0010426c, 0x0401f905, 0x4d440000, 0x59368c03,
-+ 0x83440580, 0x000007fe, 0x04020008, 0x59a81023,
-+ 0x84081540, 0x0201f800, 0x00104ca6, 0x04020002,
-+ 0x8408154a, 0x480b5023, 0x42028000, 0x00000029,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010caa0,
- 0x5c027800, 0x836c0580, 0x00000003, 0x0400000c,
- 0x59326809, 0x59340008, 0x800001c0, 0x04020008,
- 0x59368c03, 0x4933c857, 0x4937c857, 0x4947c857,
-- 0x0201f800, 0x00104451, 0x0401f00c, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x42003000,
-+ 0x0201f800, 0x0010430f, 0x0401f00c, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x42003000,
- 0x00000015, 0x41782800, 0x42002000, 0x00000003,
-- 0x0201f800, 0x0010962a, 0x5c028800, 0x0201f800,
-- 0x001090ec, 0x0201f000, 0x000208b4, 0x1c01f000,
-- 0x0401f8ce, 0x0401f7fa, 0x83380580, 0x00000014,
-- 0x0400000c, 0x4933c857, 0x0201f800, 0x00106cb4,
-- 0x02020000, 0x001076fb, 0x59300203, 0x82000580,
-- 0x00000002, 0x040000ef, 0x0201f800, 0x00100615,
-- 0x4933c857, 0x0201f800, 0x001068f6, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-+ 0x0201f800, 0x001090b2, 0x5c028800, 0x0201f800,
-+ 0x00108b64, 0x0201f000, 0x000207bb, 0x1c01f000,
-+ 0x0401f8d2, 0x0401f7fa, 0x83380580, 0x00000014,
-+ 0x0400000c, 0x4933c857, 0x0201f800, 0x001067a7,
-+ 0x02020000, 0x0010720c, 0x59300203, 0x82000580,
-+ 0x00000002, 0x040000f3, 0x0201f800, 0x001004ef,
-+ 0x4933c857, 0x0201f800, 0x001063c4, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
- 0x42003000, 0x00000016, 0x41782800, 0x4d400000,
- 0x4d440000, 0x59368c03, 0x42002000, 0x00000009,
-- 0x42028000, 0x00000029, 0x0201f800, 0x0010962a,
-- 0x5c028800, 0x5c028000, 0x42000000, 0x0010b663,
-- 0x0201f800, 0x0010a86e, 0x0201f800, 0x00108ef1,
-- 0x0402000c, 0x0201f800, 0x00101e1b, 0x0401f89f,
-+ 0x42028000, 0x00000029, 0x0201f800, 0x001090b2,
-+ 0x5c028800, 0x5c028000, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x0010894c,
-+ 0x0402000c, 0x0201f800, 0x00101c36, 0x0401f8a3,
- 0x59340c03, 0x82040580, 0x000007fe, 0x040207c8,
-- 0x59a80826, 0x84040d40, 0x48075026, 0x0401f7c4,
-- 0x0201f800, 0x00108f05, 0x04020003, 0x0401f893,
-+ 0x59a80823, 0x84040d40, 0x48075023, 0x0401f7c4,
-+ 0x0201f800, 0x00108969, 0x04020003, 0x0401f897,
- 0x0401f7bf, 0x59300403, 0x82000d80, 0x00000032,
-- 0x04020004, 0x0201f800, 0x001020b2, 0x0401f7b8,
-- 0x59300403, 0x82000d80, 0x00000022, 0x04000887,
-+ 0x04020004, 0x0201f800, 0x00101ed9, 0x0401f7b8,
-+ 0x59300403, 0x82000d80, 0x00000022, 0x0400088b,
- 0x0401f7b3, 0x4933c857, 0x4803c857, 0x0c01f001,
-- 0x00107da0, 0x00107da0, 0x00107da0, 0x00107da0,
-- 0x00107da0, 0x00107da0, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d83, 0x00107da0,
-- 0x00107d7a, 0x00107da0, 0x00107da0, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107da0, 0x00107da0, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d7a, 0x00107d91, 0x00107da0,
-- 0x00107d7a, 0x00107d8a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107d8a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107da0, 0x00107d8d, 0x00107d7a,
-- 0x00107d7c, 0x00107da0, 0x00107d7a, 0x00107da0,
-- 0x00107da0, 0x00107d7a, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107da0, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107da0, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107da0, 0x00107d7a, 0x00107d7a,
-- 0x00107d7a, 0x00107da0, 0x0201f800, 0x00100615,
-- 0x4d2c0000, 0x59325808, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x0201f000, 0x000208b4, 0x4a026203,
-- 0x00000005, 0x59a80039, 0x48026205, 0x59a80037,
-+ 0x001078b8, 0x001078b8, 0x001078b8, 0x001078b8,
-+ 0x001078b8, 0x001078b8, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x0010789b, 0x001078b8,
-+ 0x00107892, 0x001078b8, 0x001078b8, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x001078b8, 0x001078b8, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x00107892, 0x001078a9, 0x001078b8,
-+ 0x00107892, 0x001078a2, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078a2, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078b8, 0x001078a5, 0x00107892,
-+ 0x00107894, 0x001078b8, 0x00107892, 0x001078b8,
-+ 0x001078b8, 0x00107892, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078b8, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078b8, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078b8, 0x00107892, 0x00107892,
-+ 0x00107892, 0x001078b8, 0x0201f800, 0x001004ef,
-+ 0x4d2c0000, 0x59325808, 0x0201f800, 0x000202e9,
-+ 0x5c025800, 0x0201f000, 0x000207bb, 0x4a026203,
-+ 0x00000005, 0x59a80036, 0x48026205, 0x59a80034,
- 0x48026206, 0x1c01f000, 0x5930081e, 0x49780a05,
-- 0x0401f014, 0x0201f800, 0x001090ec, 0x0201f000,
-- 0x000208b4, 0x0201f800, 0x001020b2, 0x0201f800,
-- 0x0010698c, 0x04000005, 0x0201f800, 0x001068f6,
-- 0x0201f000, 0x000208b4, 0x0201f800, 0x001068f6,
-- 0x0201f800, 0x000208b4, 0x0201f000, 0x00106982,
-- 0x4933c857, 0x4a026203, 0x00000002, 0x59a80037,
-- 0x48026206, 0x1c01f000, 0x4933c857, 0x0201f800,
-- 0x00108df4, 0x0400002a, 0x4d2c0000, 0x0201f800,
-- 0x00109360, 0x0402000a, 0x4d400000, 0x42028000,
-+ 0x0401f014, 0x0201f800, 0x00108b64, 0x0201f000,
-+ 0x000207bb, 0x0201f800, 0x00101ed9, 0x0201f800,
-+ 0x00106476, 0x04000005, 0x0201f800, 0x001063c4,
-+ 0x0201f000, 0x000207bb, 0x0201f800, 0x001063c4,
-+ 0x0201f800, 0x000207bb, 0x0201f000, 0x00106463,
-+ 0x4933c857, 0x4a026203, 0x00000002, 0x59a80034,
-+ 0x48026206, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x4933c857, 0x0201f800,
-+ 0x0010883d, 0x0400002a, 0x4d2c0000, 0x0201f800,
-+ 0x00108de6, 0x0402000a, 0x4d400000, 0x42028000,
- 0x00000031, 0x42000800, 0x00000004, 0x0201f800,
-- 0x00109204, 0x5c028000, 0x0401f01c, 0x59300c06,
-+ 0x00108c81, 0x5c028000, 0x0401f01c, 0x59300c06,
- 0x82040580, 0x00000010, 0x04000004, 0x82040580,
- 0x00000011, 0x0402000a, 0x4a025a06, 0x00000031,
- 0x4a02580d, 0x00000004, 0x4a02580e, 0x000000ff,
-- 0x0201f800, 0x00020381, 0x0401f00c, 0x592c0404,
-+ 0x0201f800, 0x000202e9, 0x0401f00c, 0x592c0404,
- 0x8c00051e, 0x04000009, 0x4a025a04, 0x00000103,
- 0x4a025805, 0x01000000, 0x5931d821, 0x58ef400b,
- 0x58ec0009, 0x0801f800, 0x5c025800, 0x1c01f000,
- 0x4933c857, 0x59340400, 0x82000500, 0x000000ff,
-- 0x82003480, 0x0000000c, 0x02021800, 0x00100615,
-+ 0x82003480, 0x0000000c, 0x02021800, 0x001004ef,
- 0x59303403, 0x82180d80, 0x0000004d, 0x02000000,
-- 0x00109154, 0x82180d80, 0x00000033, 0x02000000,
-- 0x0010910f, 0x82180d80, 0x00000028, 0x02000000,
-- 0x00108f46, 0x82180d80, 0x00000029, 0x02000000,
-- 0x00108f5a, 0x82180d80, 0x0000001f, 0x02000000,
-- 0x001078af, 0x82180d80, 0x00000055, 0x02000000,
-- 0x00107888, 0x82180d80, 0x00000000, 0x0400058e,
-- 0x82180d80, 0x00000022, 0x02000000, 0x001078dc,
-- 0x82180d80, 0x00000035, 0x02000000, 0x001079d7,
-- 0x82180d80, 0x00000039, 0x04000536, 0x82180d80,
-- 0x0000003d, 0x02000000, 0x0010790c, 0x82180d80,
-- 0x00000044, 0x02000000, 0x00107949, 0x82180d80,
-- 0x00000049, 0x02000000, 0x0010799e, 0x82180d80,
-- 0x00000041, 0x02000000, 0x0010798a, 0x82180d80,
-- 0x00000043, 0x02000000, 0x001092a5, 0x82180d80,
-- 0x00000051, 0x02000000, 0x0010930b, 0x82180d80,
-+ 0x00108bd0, 0x82180d80, 0x00000033, 0x02000000,
-+ 0x00108b87, 0x82180d80, 0x00000028, 0x02000000,
-+ 0x001089aa, 0x82180d80, 0x00000029, 0x02000000,
-+ 0x001089be, 0x82180d80, 0x0000001f, 0x02000000,
-+ 0x001073c3, 0x82180d80, 0x00000055, 0x02000000,
-+ 0x0010739c, 0x82180d80, 0x00000000, 0x0400058b,
-+ 0x82180d80, 0x00000022, 0x02000000, 0x001073f0,
-+ 0x82180d80, 0x00000035, 0x02000000, 0x001074eb,
-+ 0x82180d80, 0x00000039, 0x04000530, 0x82180d80,
-+ 0x0000003d, 0x02000000, 0x00107420, 0x82180d80,
-+ 0x00000044, 0x02000000, 0x0010745d, 0x82180d80,
-+ 0x00000049, 0x02000000, 0x001074b2, 0x82180d80,
-+ 0x00000041, 0x02000000, 0x0010749e, 0x82180d80,
-+ 0x00000043, 0x02000000, 0x00108d22, 0x82180d80,
-+ 0x00000051, 0x02000000, 0x00108d88, 0x82180d80,
- 0x00000004, 0x04020003, 0x42000000, 0x00000001,
- 0x83380d80, 0x00000015, 0x04000006, 0x83380d80,
-- 0x00000016, 0x02020000, 0x001076fb, 0x0401f226,
-+ 0x00000016, 0x02020000, 0x0010720c, 0x0401f224,
- 0x4d2c0000, 0x4d3c0000, 0x0c01f804, 0x5c027800,
-- 0x5c025800, 0x1c01f000, 0x00107e42, 0x00107e46,
-- 0x00107e42, 0x00107ebb, 0x00107e42, 0x00107fc7,
-- 0x00108060, 0x00107e42, 0x00107e42, 0x00108029,
-- 0x00107e42, 0x0010803b, 0x4933c857, 0x497a6007,
-+ 0x5c025800, 0x1c01f000, 0x0010795e, 0x00107962,
-+ 0x0010795e, 0x001079d5, 0x0010795e, 0x00107ae1,
-+ 0x00107b7a, 0x0010795e, 0x0010795e, 0x00107b43,
-+ 0x0010795e, 0x00107b55, 0x4933c857, 0x497a6007,
- 0x59300808, 0x58040000, 0x4a000a04, 0x00000103,
-- 0x0201f000, 0x000208b4, 0x4933c857, 0x40000000,
-- 0x40000000, 0x1c01f000, 0x4933c857, 0x59a80016,
-- 0x82000580, 0x00000074, 0x0402005c, 0x0201f800,
-- 0x0010a0b1, 0x04020016, 0x0401f85c, 0x0201f800,
-- 0x00108df4, 0x0400000c, 0x0201f800, 0x00109360,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x40000000,
-+ 0x40000000, 0x1c01f000, 0x4933c857, 0x59a80015,
-+ 0x82000580, 0x00000074, 0x0402005b, 0x0201f800,
-+ 0x00109b50, 0x04020016, 0x0401f85b, 0x0201f800,
-+ 0x0010883d, 0x0400000c, 0x0201f800, 0x00108de6,
- 0x04020009, 0x41780800, 0x4d400000, 0x42028000,
-- 0x00000000, 0x0201f800, 0x00109204, 0x5c028000,
-- 0x0401f003, 0x0201f800, 0x00101e1b, 0x0201f800,
-- 0x00104711, 0x0201f000, 0x000208b4, 0x0201f800,
-- 0x00108df4, 0x04000007, 0x0201f800, 0x00109360,
-- 0x04020004, 0x0401ff3d, 0x0201f000, 0x000208b4,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x59340200,
-+ 0x00000000, 0x0201f800, 0x00108c81, 0x5c028000,
-+ 0x0401f003, 0x0201f800, 0x00101c36, 0x0201f800,
-+ 0x001045e1, 0x0201f000, 0x000207bb, 0x0201f800,
-+ 0x0010883d, 0x04000007, 0x0201f800, 0x00108de6,
-+ 0x04020004, 0x0401ff3d, 0x0201f000, 0x000207bb,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x59340200,
- 0x84000558, 0x48026a00, 0x42003000, 0x00000003,
-- 0x0201f800, 0x0010a766, 0x4d300000, 0x0201f800,
-- 0x00020892, 0x02000800, 0x00100615, 0x49366009,
-+ 0x0201f800, 0x0010a137, 0x4d300000, 0x0201f800,
-+ 0x00020799, 0x02000800, 0x001004ef, 0x49366009,
- 0x497a6008, 0x4a026406, 0x00000001, 0x4a026403,
-- 0x00000001, 0x0201f800, 0x0010393e, 0x04000011,
-- 0x4a026406, 0x00000004, 0x4a026203, 0x00000007,
-- 0x4a026420, 0x00000001, 0x42003000, 0x00000001,
-- 0x4d400000, 0x42028000, 0x00000029, 0x41782800,
-- 0x0201f800, 0x0010a250, 0x5c028000, 0x0401f009,
-- 0x42000800, 0x0000000b, 0x0201f800, 0x001043c7,
-- 0x4a026203, 0x00000001, 0x0201f800, 0x00106470,
-- 0x5c026000, 0x0401ff05, 0x0201f800, 0x00101e1b,
-- 0x0201f000, 0x000208b4, 0x0401ff00, 0x42000000,
-- 0x00000001, 0x0401f0de, 0x4933c857, 0x59340200,
-- 0x8c000500, 0x0400000d, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x5c027800, 0x0201f800,
-- 0x0010393e, 0x04000005, 0x42000800, 0x00000006,
-- 0x0201f800, 0x001043c7, 0x1c01f000, 0x4933c857,
-- 0x59a80816, 0x82040580, 0x00000074, 0x0400000e,
-- 0x4807c857, 0x82040580, 0x00000100, 0x040200b7,
-- 0x59cc0408, 0x4803c857, 0x8c000500, 0x040000b3,
-- 0x59341403, 0x82080580, 0x000007fe, 0x04000006,
-- 0x0401f0ae, 0x59341403, 0x82080580, 0x000007fe,
-- 0x0402001a, 0x59a80026, 0x8c000506, 0x04000015,
-- 0x59cc0000, 0x82000500, 0x000000ff, 0x59a80810,
-- 0x82040d00, 0x000000ff, 0x80040580, 0x0400000d,
-- 0x0201f800, 0x00101e1b, 0x0201f800, 0x000208b4,
-- 0x42000000, 0x0010b651, 0x0201f800, 0x0010a86e,
-- 0x4202d800, 0x00000001, 0x0201f000, 0x00103f37,
-- 0x0401fa9c, 0x0401f04c, 0x0201f800, 0x00104480,
-- 0x59341403, 0x82080580, 0x000007fc, 0x0402001f,
-- 0x4a026802, 0x00fffffc, 0x0201f800, 0x00108df4,
-- 0x04000012, 0x0201f800, 0x00109360, 0x0402000f,
-- 0x0401f8a9, 0x41780800, 0x4d400000, 0x42028000,
-- 0x00000000, 0x0201f800, 0x00109204, 0x5c028000,
-- 0x42000800, 0x00000004, 0x0201f800, 0x001043c7,
-- 0x0201f000, 0x000208b4, 0x42000800, 0x00000004,
-- 0x0201f800, 0x001043c7, 0x0201f800, 0x00101e1b,
-- 0x0201f000, 0x000208b4, 0x59a8006f, 0x8c000502,
-- 0x04000011, 0x0201f800, 0x00104e0d, 0x42001000,
-- 0x00000010, 0x04020009, 0x59340002, 0x82000500,
-- 0x00ff0000, 0x82000580, 0x00ff0000, 0x04000006,
-- 0x42001000, 0x00000008, 0x0201f800, 0x00104ada,
-- 0x0402005a, 0x0201f800, 0x00108df4, 0x0400005b,
-- 0x0201f800, 0x00109360, 0x04020005, 0x592c0404,
-- 0x8c00051c, 0x040207c9, 0x0401f877, 0x42000800,
-- 0x00000005, 0x0201f800, 0x001043c7, 0x4a026203,
-- 0x00000001, 0x4a026403, 0x00000003, 0x0201f000,
-- 0x00106470, 0x59cc0408, 0x8c000518, 0x04000010,
-- 0x0201f800, 0x001090ab, 0x0201f800, 0x00104e0d,
-- 0x04000004, 0x59cc0408, 0x8c000516, 0x040207b3,
-- 0x59a80026, 0x8400054a, 0x48035026, 0x59a80010,
-- 0x84000570, 0x48038832, 0x0401f7ac, 0x42001000,
-- 0x000000ef, 0x480b5010, 0x497b8830, 0x84081570,
-- 0x480b8832, 0x59c40802, 0x84040d4c, 0x48078802,
-- 0x0201f800, 0x001090d5, 0x59a80026, 0x84000548,
-- 0x48035026, 0x0201f800, 0x0010a1ec, 0x0402079b,
-- 0x59a80026, 0x8400054c, 0x48035026, 0x42000800,
-- 0x00000006, 0x0201f800, 0x001043c7, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x42000000, 0x000000e8,
-- 0x0201f800, 0x001059b9, 0x02000800, 0x001043fc,
-- 0x02020800, 0x00100615, 0x49366009, 0x59340200,
-- 0x8400051a, 0x48026a00, 0x42000800, 0x00000003,
-- 0x0201f800, 0x001043c7, 0x4a026406, 0x00000001,
-- 0x4a026203, 0x00000001, 0x4a026403, 0x00000002,
-- 0x0201f000, 0x00106470, 0x0401fe2c, 0x42000000,
-- 0x00000001, 0x0401f00a, 0x599c0017, 0x8c00050a,
-- 0x040007ab, 0x42000800, 0x00000004, 0x0201f800,
-- 0x001043c7, 0x0201f000, 0x000208b4, 0x4933c857,
-- 0x80003540, 0x04000005, 0x42000800, 0x00000007,
-- 0x0201f800, 0x001043c7, 0x801831c0, 0x0402000e,
-- 0x59302008, 0x801021c0, 0x04000004, 0x58100404,
-- 0x8c00051e, 0x04020008, 0x59341c03, 0x42002000,
-- 0x00000004, 0x42003000, 0x00000012, 0x0201f800,
-- 0x001038c7, 0x0201f800, 0x00101e1b, 0x0201f000,
-- 0x000208b4, 0x4c5c0000, 0x4d2c0000, 0x59325808,
-- 0x0201f800, 0x00105439, 0x5c025800, 0x59cc0008,
-- 0x48002805, 0x59cc0009, 0x48002806, 0x49782807,
-- 0x49782808, 0x49782809, 0x4978280a, 0x59cc0013,
-- 0x8c00053e, 0x04000009, 0x59cc0414, 0x900001c0,
-- 0x59ccbc15, 0x805c0540, 0x48002807, 0x59cc0416,
-- 0x900001c0, 0x48002808, 0x59cc0017, 0x8c00053e,
-- 0x04000009, 0x59cc0418, 0x900001c0, 0x59ccbc19,
-- 0x805c0540, 0x48002809, 0x59cc041a, 0x900001c0,
-- 0x4800280a, 0x5c00b800, 0x1c01f000, 0x4933c857,
-- 0x59a80016, 0x82000580, 0x00000014, 0x04020048,
-- 0x59a8006f, 0x8c000502, 0x04000015, 0x0201f800,
-- 0x00104e0d, 0x42001000, 0x00000010, 0x04020009,
-+ 0x00000001, 0x8d0e1d20, 0x04000011, 0x4a026406,
-+ 0x00000004, 0x4a026203, 0x00000007, 0x4a026420,
-+ 0x00000001, 0x42003000, 0x00000001, 0x4d400000,
-+ 0x42028000, 0x00000029, 0x41782800, 0x0201f800,
-+ 0x00109c14, 0x5c028000, 0x0401f009, 0x42000800,
-+ 0x0000000b, 0x0201f800, 0x0010426c, 0x4a026203,
-+ 0x00000001, 0x0201f800, 0x00106339, 0x5c026000,
-+ 0x0401ff06, 0x0201f800, 0x00101c36, 0x0201f000,
-+ 0x000207bb, 0x0401ff01, 0x42000000, 0x00000001,
-+ 0x0401f0dd, 0x4933c857, 0x59340200, 0x8c000500,
-+ 0x0400000c, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010425d, 0x5c027800, 0x8d0e1d20, 0x04000005,
-+ 0x42000800, 0x00000006, 0x0201f800, 0x0010426c,
-+ 0x1c01f000, 0x4933c857, 0x59a80815, 0x82040580,
-+ 0x00000074, 0x0400000e, 0x4807c857, 0x82040580,
-+ 0x00000100, 0x040200b7, 0x59cc0408, 0x4803c857,
-+ 0x8c000500, 0x040000b3, 0x59341403, 0x82080580,
-+ 0x000007fe, 0x04000006, 0x0401f0ae, 0x59341403,
-+ 0x82080580, 0x000007fe, 0x0402001a, 0x59a80023,
-+ 0x8c000506, 0x04000015, 0x59cc0000, 0x82000500,
-+ 0x000000ff, 0x59a8080f, 0x82040d00, 0x000000ff,
-+ 0x80040580, 0x0400000d, 0x0201f800, 0x00101c36,
-+ 0x0201f800, 0x000207bb, 0x42000000, 0x0010b021,
-+ 0x0201f800, 0x0010a260, 0x4202d800, 0x00000001,
-+ 0x0201f000, 0x00103dcb, 0x0401fa9b, 0x0401f04c,
-+ 0x0201f800, 0x00104346, 0x59341403, 0x82080580,
-+ 0x000007fc, 0x0402001f, 0x4a026802, 0x00fffffc,
-+ 0x0201f800, 0x0010883d, 0x04000012, 0x0201f800,
-+ 0x00108de6, 0x0402000f, 0x0401f8a9, 0x41780800,
-+ 0x4d400000, 0x42028000, 0x00000000, 0x0201f800,
-+ 0x00108c81, 0x5c028000, 0x42000800, 0x00000004,
-+ 0x0201f800, 0x0010426c, 0x0201f000, 0x000207bb,
-+ 0x42000800, 0x00000004, 0x0201f800, 0x0010426c,
-+ 0x0201f800, 0x00101c36, 0x0201f000, 0x000207bb,
-+ 0x59a8006c, 0x8c000502, 0x04000011, 0x0201f800,
-+ 0x00104ca6, 0x42001000, 0x00000010, 0x04020009,
- 0x59340002, 0x82000500, 0x00ff0000, 0x82000580,
-- 0x00ff0000, 0x0400000a, 0x42001000, 0x00000008,
-- 0x0201f800, 0x00104ada, 0x04000005, 0x59a8006f,
-- 0x8400054c, 0x4803506f, 0x0401f031, 0x836c0580,
-- 0x00000003, 0x0402000b, 0x59300008, 0x80000540,
-- 0x04020008, 0x59341c03, 0x42002000, 0x00000006,
-- 0x42003000, 0x00000013, 0x0201f800, 0x001038c7,
-- 0x0201f800, 0x001044e1, 0x0401feb8, 0x0401fa1d,
-- 0x0402001f, 0x59340404, 0x80000540, 0x0400001c,
-- 0x42000800, 0x00000006, 0x0201f800, 0x001043c7,
-- 0x0201f800, 0x00108df4, 0x04000011, 0x0201f800,
-- 0x00109360, 0x0402000a, 0x41780800, 0x4d400000,
-- 0x42028000, 0x00000000, 0x0201f800, 0x00109204,
-- 0x5c028000, 0x0201f000, 0x000208b4, 0x4a025a04,
-- 0x00000103, 0x4a025805, 0x02000000, 0x0201f800,
-- 0x00101e1b, 0x0201f000, 0x000208b4, 0x0201f800,
-- 0x00104a83, 0x0201f800, 0x00108df4, 0x04000007,
-- 0x0201f800, 0x00109360, 0x04020004, 0x0401fd8b,
-- 0x0201f000, 0x000208b4, 0x0401fd88, 0x80000580,
-- 0x59a8006f, 0x8c00050c, 0x04000005, 0x8400050c,
-- 0x4803506f, 0x82000540, 0x00000001, 0x0401ff60,
-- 0x1c01f000, 0x4933c857, 0x59a80016, 0x82000580,
-- 0x00000014, 0x0402000b, 0x42000800, 0x0000000b,
-- 0x0201f800, 0x001043c7, 0x4a026203, 0x00000001,
-- 0x4a026403, 0x00000001, 0x0201f000, 0x00106470,
-- 0x42000000, 0x00000001, 0x0401f74d, 0x4933c857,
-- 0x40003000, 0x59a80016, 0x82000580, 0x00000004,
-- 0x0402000a, 0x82183580, 0x0000000b, 0x04020005,
-- 0x42000800, 0x00000007, 0x0201f800, 0x001043c7,
-- 0x0201f000, 0x000208b4, 0x42000000, 0x00000001,
-- 0x0401f73b, 0x4803c857, 0x4d2c0000, 0x4d3c0000,
-- 0x0c01f804, 0x5c027800, 0x5c025800, 0x1c01f000,
-- 0x00107e42, 0x0010806f, 0x00107e42, 0x001080c4,
-- 0x00107e42, 0x00108132, 0x00108060, 0x00107e42,
-- 0x00107e42, 0x00108152, 0x00107e42, 0x00108162,
-- 0x4933c857, 0x4d1c0000, 0x59301403, 0x82080580,
-- 0x00000003, 0x04000008, 0x82081580, 0x0000001e,
-- 0x04020003, 0x0201f800, 0x000208b4, 0x5c023800,
-- 0x1c01f000, 0x0401ff5a, 0x0401f7fd, 0x4933c857,
-- 0x0201f800, 0x00108df4, 0x0400000b, 0x0201f800,
-- 0x00109360, 0x04020008, 0x4200b000, 0x00000002,
-- 0x0201f800, 0x00109346, 0x0401fd2c, 0x0201f000,
-- 0x000208b4, 0x0401f8f5, 0x04020030, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x417a7800, 0x0201f800,
-- 0x00101de2, 0x42000000, 0x0010b663, 0x0201f800,
-- 0x0010a86e, 0x59340200, 0x84000558, 0x48026a00,
-- 0x4a026403, 0x00000002, 0x42003000, 0x00000003,
-- 0x0201f800, 0x0010a766, 0x0201f800, 0x0010393e,
-- 0x04000011, 0x4d400000, 0x41782800, 0x42003000,
-- 0x00000005, 0x42028000, 0x00000029, 0x0201f800,
-- 0x0010a250, 0x5c028000, 0x4a026203, 0x00000007,
-- 0x4a026406, 0x00000004, 0x4a026420, 0x00000001,
-- 0x1c01f000, 0x42000800, 0x00000003, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x0201f800,
-- 0x00106470, 0x0401f7f7, 0x59cc0407, 0x82000580,
-- 0x00000009, 0x0402000a, 0x59340412, 0x82000500,
-- 0x000000ff, 0x0400000c, 0x80000040, 0x48026c12,
-- 0x4a026206, 0x0000000a, 0x0401f7ea, 0x59cc0207,
-- 0x82000500, 0x0000ff00, 0x82000580, 0x00001900,
-- 0x040007c2, 0x0401fce5, 0x80000580, 0x0401f6c4,
-- 0x4933c857, 0x59a80032, 0x80000540, 0x04000015,
-- 0x59340403, 0x82000580, 0x000007fe, 0x04020011,
-- 0x59a80010, 0x80000000, 0x48035010, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x42000800, 0x00000003,
-- 0x0201f800, 0x001043c7, 0x4a026203, 0x00000001,
-- 0x4a026403, 0x00000002, 0x0201f000, 0x00106470,
-- 0x0201f800, 0x00108df4, 0x04000011, 0x0201f800,
-- 0x00109360, 0x0402000e, 0x4c580000, 0x4200b000,
-- 0x00000002, 0x0201f800, 0x00109346, 0x5c00b000,
-- 0x0401fcbe, 0x42000800, 0x00000007, 0x0201f800,
-- 0x001043c7, 0x0201f000, 0x000208b4, 0x0401fcb7,
-- 0x59cc3407, 0x82183500, 0x000000ff, 0x82180580,
-- 0x00000005, 0x0400001c, 0x82180580, 0x0000000b,
-- 0x04000016, 0x59cc0207, 0x82000500, 0x0000ff00,
-- 0x04020004, 0x82180580, 0x00000009, 0x04000012,
-- 0x82000580, 0x00001900, 0x0402000c, 0x82180580,
-- 0x00000009, 0x0400000c, 0x42000800, 0x00000004,
-- 0x0201f800, 0x001043c7, 0x0201f800, 0x00101e1b,
-- 0x0201f000, 0x000208b4, 0x42000000, 0x00000001,
-- 0x0401f677, 0x0201f800, 0x00108df4, 0x59325808,
-- 0x04000008, 0x592c0204, 0x82000580, 0x00000139,
-- 0x040007f6, 0x592c0404, 0x8c00051e, 0x040207f3,
-- 0x59340403, 0x82000580, 0x000007fe, 0x04020007,
-- 0x59a80026, 0x84000540, 0x48035026, 0x0201f800,
-- 0x00104059, 0x0401f7e9, 0x417a7800, 0x0201f800,
-- 0x00101de2, 0x42003000, 0x00000005, 0x0201f800,
-- 0x0010a766, 0x42000000, 0x0010b663, 0x0201f800,
-- 0x0010a86e, 0x0401f7dd, 0x4933c857, 0x0401f84d,
-- 0x0402000b, 0x42000800, 0x00000005, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000003, 0x0201f000, 0x00106470, 0x42000800,
-- 0x00000004, 0x0201f800, 0x001043c7, 0x0201f800,
-- 0x00109360, 0x0402000a, 0x4c580000, 0x4200b000,
-- 0x00000002, 0x0201f800, 0x00109346, 0x5c00b000,
-- 0x0401fc5a, 0x0201f000, 0x000208b4, 0x0401fc57,
-- 0x80000580, 0x0401f636, 0x4933c857, 0x0401f82d,
-- 0x0402000b, 0x42000800, 0x00000009, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000005, 0x0201f000, 0x00106470, 0x42000000,
-- 0x00000001, 0x0401f626, 0x4933c857, 0x0401f81d,
-- 0x0402000b, 0x42000800, 0x0000000b, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000001, 0x0201f000, 0x00106470, 0x42000000,
-- 0x00000001, 0x0401f616, 0x4933c857, 0x59cc0407,
-- 0x82000580, 0x00000003, 0x04020009, 0x59cc0207,
-- 0x82000500, 0x0000ff00, 0x82000d80, 0x00002a00,
-- 0x04000003, 0x82000d80, 0x00001e00, 0x1c01f000,
-- 0x4933c857, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x4933c857, 0x4d400000, 0x4c580000, 0x59a80026,
-- 0x82000540, 0x00000003, 0x48035026, 0x0401f85c,
-- 0x04000038, 0x4d340000, 0x4d440000, 0x59a80026,
-- 0x84000552, 0x48035026, 0x0201f800, 0x0010393e,
-- 0x0400000c, 0x42028000, 0x0000002a, 0x42028800,
-+ 0x00ff0000, 0x04000006, 0x42001000, 0x00000008,
-+ 0x0201f800, 0x001049da, 0x0402005a, 0x0201f800,
-+ 0x0010883d, 0x0400005b, 0x0201f800, 0x00108de6,
-+ 0x04020005, 0x592c0404, 0x8c00051c, 0x040207c9,
-+ 0x0401f877, 0x42000800, 0x00000005, 0x0201f800,
-+ 0x0010426c, 0x4a026203, 0x00000001, 0x4a026403,
-+ 0x00000003, 0x0201f000, 0x00106339, 0x59cc0408,
-+ 0x8c000518, 0x04000010, 0x0201f800, 0x00108b1b,
-+ 0x0201f800, 0x00104ca6, 0x04000004, 0x59cc0408,
-+ 0x8c000516, 0x040207b3, 0x59a80023, 0x8400054a,
-+ 0x48035023, 0x59a8000f, 0x84000570, 0x48038832,
-+ 0x0401f7ac, 0x42001000, 0x000000ef, 0x480b500f,
-+ 0x497b8830, 0x84081570, 0x480b8832, 0x59c40802,
-+ 0x84040d4c, 0x48078802, 0x0201f800, 0x00108b49,
-+ 0x59a80023, 0x84000548, 0x48035023, 0x0201f800,
-+ 0x00109bad, 0x0402079b, 0x59a80023, 0x8400054c,
-+ 0x48035023, 0x42000800, 0x00000006, 0x0201f800,
-+ 0x0010426c, 0x417a7800, 0x0201f800, 0x0010425d,
-+ 0x42000000, 0x000000e8, 0x0201f800, 0x00105854,
-+ 0x02000800, 0x001042b1, 0x02020800, 0x001004ef,
-+ 0x49366009, 0x59340200, 0x8400051a, 0x48026a00,
-+ 0x42000800, 0x00000003, 0x0201f800, 0x0010426c,
-+ 0x4a026406, 0x00000001, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000002, 0x0201f000, 0x00106339,
-+ 0x0401fe2e, 0x42000000, 0x00000001, 0x0401f00a,
-+ 0x599c0017, 0x8c00050a, 0x040007ab, 0x42000800,
-+ 0x00000004, 0x0201f800, 0x0010426c, 0x0201f000,
-+ 0x000207bb, 0x4933c857, 0x80003540, 0x04000005,
-+ 0x42000800, 0x00000007, 0x0201f800, 0x0010426c,
-+ 0x801831c0, 0x0402000e, 0x59302008, 0x801021c0,
-+ 0x04000004, 0x58100404, 0x8c00051e, 0x04020008,
-+ 0x59341c03, 0x42002000, 0x00000004, 0x42003000,
-+ 0x00000012, 0x0201f800, 0x00103764, 0x0201f800,
-+ 0x00101c36, 0x0201f000, 0x000207bb, 0x4c5c0000,
-+ 0x4d2c0000, 0x59325808, 0x0201f800, 0x001052d5,
-+ 0x5c025800, 0x59cc0008, 0x48002805, 0x59cc0009,
-+ 0x48002806, 0x49782807, 0x49782808, 0x49782809,
-+ 0x4978280a, 0x59cc0013, 0x8c00053e, 0x04000009,
-+ 0x59cc0414, 0x900001c0, 0x59ccbc15, 0x805c0540,
-+ 0x48002807, 0x59cc0416, 0x900001c0, 0x48002808,
-+ 0x59cc0017, 0x8c00053e, 0x04000009, 0x59cc0418,
-+ 0x900001c0, 0x59ccbc19, 0x805c0540, 0x48002809,
-+ 0x59cc041a, 0x900001c0, 0x4800280a, 0x5c00b800,
-+ 0x1c01f000, 0x4933c857, 0x59a80015, 0x82000580,
-+ 0x00000014, 0x04020048, 0x59a8006c, 0x8c000502,
-+ 0x04000015, 0x0201f800, 0x00104ca6, 0x42001000,
-+ 0x00000010, 0x04020009, 0x59340002, 0x82000500,
-+ 0x00ff0000, 0x82000580, 0x00ff0000, 0x0400000a,
-+ 0x42001000, 0x00000008, 0x0201f800, 0x001049da,
-+ 0x04000005, 0x59a8006c, 0x8400054c, 0x4803506c,
-+ 0x0401f031, 0x836c0580, 0x00000003, 0x0402000b,
-+ 0x59300008, 0x80000540, 0x04020008, 0x59341c03,
-+ 0x42002000, 0x00000006, 0x42003000, 0x00000013,
-+ 0x0201f800, 0x00103764, 0x0201f800, 0x001043a7,
-+ 0x0401feb9, 0x0401fa19, 0x0402001f, 0x59340404,
-+ 0x80000540, 0x0400001c, 0x42000800, 0x00000006,
-+ 0x0201f800, 0x0010426c, 0x0201f800, 0x0010883d,
-+ 0x04000011, 0x0201f800, 0x00108de6, 0x0402000a,
-+ 0x41780800, 0x4d400000, 0x42028000, 0x00000000,
-+ 0x0201f800, 0x00108c81, 0x5c028000, 0x0201f000,
-+ 0x000207bb, 0x4a025a04, 0x00000103, 0x4a025805,
-+ 0x02000000, 0x0201f800, 0x00101c36, 0x0201f000,
-+ 0x000207bb, 0x0201f800, 0x00104975, 0x0201f800,
-+ 0x0010883d, 0x04000007, 0x0201f800, 0x00108de6,
-+ 0x04020004, 0x0401fd8d, 0x0201f000, 0x000207bb,
-+ 0x0401fd8a, 0x80000580, 0x59a8006c, 0x8c00050c,
-+ 0x04000005, 0x8400050c, 0x4803506c, 0x82000540,
-+ 0x00000001, 0x0401ff60, 0x1c01f000, 0x4933c857,
-+ 0x59a80015, 0x82000580, 0x00000014, 0x0402000b,
-+ 0x42000800, 0x0000000b, 0x0201f800, 0x0010426c,
-+ 0x4a026203, 0x00000001, 0x4a026403, 0x00000001,
-+ 0x0201f000, 0x00106339, 0x42000000, 0x00000001,
-+ 0x0401f74d, 0x4933c857, 0x40003000, 0x59a80015,
-+ 0x82000580, 0x00000004, 0x0402000a, 0x82183580,
-+ 0x0000000b, 0x04020005, 0x42000800, 0x00000007,
-+ 0x0201f800, 0x0010426c, 0x0201f000, 0x000207bb,
-+ 0x42000000, 0x00000001, 0x0401f73b, 0x4803c857,
-+ 0x4d2c0000, 0x4d3c0000, 0x0c01f804, 0x5c027800,
-+ 0x5c025800, 0x1c01f000, 0x0010795e, 0x00107b89,
-+ 0x0010795e, 0x00107bdd, 0x0010795e, 0x00107c4b,
-+ 0x00107b7a, 0x0010795e, 0x0010795e, 0x00107c6b,
-+ 0x0010795e, 0x00107c7b, 0x4933c857, 0x4d1c0000,
-+ 0x59301403, 0x82080580, 0x00000003, 0x04000008,
-+ 0x82081580, 0x0000001e, 0x04020003, 0x0201f800,
-+ 0x000207bb, 0x5c023800, 0x1c01f000, 0x0401ff5a,
-+ 0x0401f7fd, 0x4933c857, 0x0201f800, 0x0010883d,
-+ 0x0400000b, 0x0201f800, 0x00108de6, 0x04020008,
-+ 0x4200b000, 0x00000002, 0x0201f800, 0x00108dc3,
-+ 0x0401fd2e, 0x0201f000, 0x000207bb, 0x0401f8f4,
-+ 0x0402002f, 0x417a7800, 0x0201f800, 0x0010425d,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x59340200,
-+ 0x84000558, 0x48026a00, 0x4a026403, 0x00000002,
-+ 0x42003000, 0x00000003, 0x0201f800, 0x0010a137,
-+ 0x8d0e1d20, 0x04000011, 0x4d400000, 0x41782800,
-+ 0x42003000, 0x00000005, 0x42028000, 0x00000029,
-+ 0x0201f800, 0x00109c14, 0x5c028000, 0x4a026203,
-+ 0x00000007, 0x4a026406, 0x00000004, 0x4a026420,
-+ 0x00000001, 0x1c01f000, 0x42000800, 0x00000003,
-+ 0x0201f800, 0x0010426c, 0x4a026203, 0x00000001,
-+ 0x0201f800, 0x00106339, 0x0401f7f7, 0x59cc0407,
-+ 0x82000580, 0x00000009, 0x0402000a, 0x59340412,
-+ 0x82000500, 0x000000ff, 0x0400000c, 0x80000040,
-+ 0x48026c12, 0x4a026206, 0x0000000a, 0x0401f7ea,
-+ 0x59cc0207, 0x82000500, 0x0000ff00, 0x82000580,
-+ 0x00001900, 0x040007c3, 0x0401fce8, 0x80000580,
-+ 0x0401f6c5, 0x4933c857, 0x59a8002f, 0x80000540,
-+ 0x04000015, 0x59340403, 0x82000580, 0x000007fe,
-+ 0x04020011, 0x59a8000f, 0x80000000, 0x4803500f,
-+ 0x417a7800, 0x0201f800, 0x0010425d, 0x42000800,
-+ 0x00000003, 0x0201f800, 0x0010426c, 0x4a026203,
-+ 0x00000001, 0x4a026403, 0x00000002, 0x0201f000,
-+ 0x00106339, 0x0201f800, 0x0010883d, 0x04000011,
-+ 0x0201f800, 0x00108de6, 0x0402000e, 0x4c580000,
-+ 0x4200b000, 0x00000002, 0x0201f800, 0x00108dc3,
-+ 0x5c00b000, 0x0401fcc1, 0x42000800, 0x00000007,
-+ 0x0201f800, 0x0010426c, 0x0201f000, 0x000207bb,
-+ 0x0401fcba, 0x59cc3407, 0x82183500, 0x000000ff,
-+ 0x82180580, 0x00000005, 0x0400001c, 0x82180580,
-+ 0x0000000b, 0x04000016, 0x59cc0207, 0x82000500,
-+ 0x0000ff00, 0x04020004, 0x82180580, 0x00000009,
-+ 0x04000012, 0x82000580, 0x00001900, 0x0402000c,
-+ 0x82180580, 0x00000009, 0x0400000c, 0x42000800,
-+ 0x00000004, 0x0201f800, 0x0010426c, 0x0201f800,
-+ 0x00101c36, 0x0201f000, 0x000207bb, 0x42000000,
-+ 0x00000001, 0x0401f678, 0x0201f800, 0x0010883d,
-+ 0x59325808, 0x04000008, 0x592c0204, 0x82000580,
-+ 0x00000139, 0x040007f6, 0x592c0404, 0x8c00051e,
-+ 0x040207f3, 0x59340403, 0x82000580, 0x000007fe,
-+ 0x04020007, 0x59a80023, 0x84000540, 0x48035023,
-+ 0x0201f800, 0x00103eee, 0x0401f7e9, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x42003000, 0x00000005,
-+ 0x0201f800, 0x0010a137, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x0401f7dd, 0x4933c857,
-+ 0x0401f84d, 0x0402000b, 0x42000800, 0x00000005,
-+ 0x0201f800, 0x0010426c, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000003, 0x0201f000, 0x00106339,
-+ 0x42000800, 0x00000004, 0x0201f800, 0x0010426c,
-+ 0x0201f800, 0x00108de6, 0x0402000a, 0x4c580000,
-+ 0x4200b000, 0x00000002, 0x0201f800, 0x00108dc3,
-+ 0x5c00b000, 0x0401fc5d, 0x0201f000, 0x000207bb,
-+ 0x0401fc5a, 0x80000580, 0x0401f637, 0x4933c857,
-+ 0x0401f82d, 0x0402000b, 0x42000800, 0x00000009,
-+ 0x0201f800, 0x0010426c, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000005, 0x0201f000, 0x00106339,
-+ 0x42000000, 0x00000001, 0x0401f627, 0x4933c857,
-+ 0x0401f81d, 0x0402000b, 0x42000800, 0x0000000b,
-+ 0x0201f800, 0x0010426c, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000001, 0x0201f000, 0x00106339,
-+ 0x42000000, 0x00000001, 0x0401f617, 0x4933c857,
-+ 0x59cc0407, 0x82000580, 0x00000003, 0x04020009,
-+ 0x59cc0207, 0x82000500, 0x0000ff00, 0x82000d80,
-+ 0x00002a00, 0x04000003, 0x82000d80, 0x00001e00,
-+ 0x1c01f000, 0x4933c857, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x4933c857, 0x4d400000, 0x4c580000,
-+ 0x59a80023, 0x82000540, 0x00000003, 0x48035023,
-+ 0x0401f859, 0x04000035, 0x4d340000, 0x4d440000,
-+ 0x59a80023, 0x84000552, 0x48035023, 0x8d0e1d20,
-+ 0x0400000a, 0x42028000, 0x0000002a, 0x42028800,
- 0x0000ffff, 0x42003000, 0x00000002, 0x0201f800,
-- 0x0010a258, 0x59a80805, 0x84040d44, 0x48075005,
-- 0x42028000, 0x0000002a, 0x4d3c0000, 0x42027800,
-- 0x00000200, 0x0201f800, 0x00101d90, 0x5c027800,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-- 0x0201f800, 0x00101bf0, 0x4200b000, 0x00000010,
-- 0x42028800, 0x000007f0, 0x4d2c0000, 0x83440580,
-- 0x000007fe, 0x04000003, 0x0201f800, 0x00104451,
-- 0x81468800, 0x8058b040, 0x040207f9, 0x5c025800,
-- 0x59cc0408, 0x8c00051e, 0x04000004, 0x59a80026,
-- 0x84000512, 0x48035026, 0x5c028800, 0x5c026800,
-- 0x0201f800, 0x00104480, 0x4a026802, 0x00fffffe,
-- 0x59a80826, 0x84040d50, 0x59cc0013, 0x8c00053e,
-- 0x04000003, 0x8c000536, 0x04000004, 0x59cc0017,
-- 0x8c000536, 0x04020002, 0x84040d10, 0x48075026,
-- 0x59cc0800, 0x82040d00, 0x00ffffff, 0x48075010,
-- 0x80040110, 0x4803501d, 0x48038881, 0x0201f800,
-- 0x00104e0d, 0x04000007, 0x59cc0009, 0x48035035,
-- 0x59cc000a, 0x48035036, 0x0201f800, 0x001090ab,
-- 0x5c00b000, 0x5c028000, 0x1c01f000, 0x4933c857,
-- 0x4c580000, 0x59a80010, 0x82000500, 0x00ffff00,
-- 0x04000022, 0x59cc1000, 0x82081500, 0x00ffff00,
-- 0x80080580, 0x04000004, 0x42000000, 0x0010b639,
-- 0x0401f016, 0x83cc1400, 0x0000000b, 0x4200b000,
-- 0x00000002, 0x83341c00, 0x00000006, 0x0401f904,
-- 0x04000004, 0x42000000, 0x0010b63a, 0x0401f00b,
-- 0x83cc1400, 0x0000000d, 0x4200b000, 0x00000002,
-- 0x83341c00, 0x00000008, 0x0401f8f9, 0x04000007,
-- 0x42000000, 0x0010b63b, 0x0201f800, 0x0010a86e,
-- 0x82000540, 0x00000001, 0x5c00b000, 0x1c01f000,
-- 0x4933c857, 0x59cc0206, 0x82000580, 0x00000014,
-- 0x04020016, 0x59cc0407, 0x82000580, 0x00000800,
-- 0x04020012, 0x59cc0207, 0x8c00051a, 0x0400000d,
-- 0x82000500, 0x00000f00, 0x82000580, 0x00000100,
-- 0x04020008, 0x59cc020a, 0x8c000508, 0x04020003,
-- 0x8c00050a, 0x04000003, 0x80000580, 0x1c01f000,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x4933c857,
-- 0x4943c857, 0x493fc857, 0x4c5c0000, 0x4d300000,
-- 0x4d340000, 0x4d2c0000, 0x4d380000, 0x4130b800,
-- 0x42026000, 0x0010cfc0, 0x59a8000e, 0x81640480,
-- 0x040210c1, 0x8d3e7d12, 0x04000004, 0x405c0000,
-- 0x81300580, 0x040000b7, 0x59300406, 0x82000c80,
-- 0x00000012, 0x04021015, 0x59326809, 0x0c01f001,
-- 0x001082f4, 0x0010825f, 0x00108278, 0x00108283,
-- 0x00108258, 0x00108271, 0x001082ac, 0x001082f4,
-- 0x00108256, 0x001082c0, 0x001082cf, 0x00108256,
-- 0x00108256, 0x00108256, 0x00108256, 0x001082f4,
-- 0x001082e5, 0x001082dd, 0x0201f800, 0x00100615,
-- 0x8d3e7d18, 0x04000003, 0x8d3e7d16, 0x04000004,
-- 0x59300420, 0x8c000500, 0x04020096, 0x59300403,
-- 0x82000580, 0x00000043, 0x04000092, 0x0201f800,
-- 0x00108ef1, 0x02000800, 0x00101e1b, 0x0201f800,
-- 0x00108f05, 0x02000800, 0x00107da6, 0x8d3e7d06,
-- 0x04000086, 0x0201f800, 0x0010909d, 0x04000085,
-- 0x0401f082, 0x8d3e7d18, 0x04000003, 0x8d3e7d16,
-- 0x04000004, 0x59300420, 0x8c000500, 0x0402007d,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x04000077,
-- 0x49425a06, 0x497a5c09, 0x0201f800, 0x00020381,
-- 0x0201f800, 0x00108ee7, 0x0401f070, 0x813669c0,
-- 0x02000800, 0x00100615, 0x8d3e7d06, 0x04000004,
-- 0x59340200, 0x8c00050e, 0x0402006a, 0x59300004,
-- 0x8400055c, 0x48026004, 0x59300203, 0x82000580,
-- 0x00000004, 0x02000800, 0x00100ee4, 0x59325808,
-- 0x0201f800, 0x00108df4, 0x0400005c, 0x4a025a04,
-- 0x00000103, 0x59300402, 0x48025c06, 0x592c0408,
-- 0x8c000512, 0x04000006, 0x4d2c0000, 0x592e5809,
-- 0x0201f800, 0x00100843, 0x5c025800, 0x49425a06,
-- 0x497a5c09, 0x0201f800, 0x00109365, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00108ee7, 0x0401f047,
-- 0x8c000518, 0x04000047, 0x59300203, 0x82000580,
-- 0x00000004, 0x02000800, 0x00100ee4, 0x59325808,
-- 0x0201f800, 0x00108df4, 0x0400003c, 0x49425a06,
-- 0x497a5c09, 0x0201f800, 0x0010a4ae, 0x0201f800,
-- 0x00109365, 0x0201f800, 0x00020381, 0x0401f033,
-- 0x0201f800, 0x0010600e, 0x04000032, 0x59300203,
-- 0x82000580, 0x00000004, 0x04020004, 0x0201f800,
-- 0x00100ee4, 0x0401f02b, 0x42027000, 0x00000047,
-- 0x0201f800, 0x000208d8, 0x0401f026, 0x59300203,
-- 0x82000580, 0x00000004, 0x02000800, 0x00100ee4,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x0400001b,
-- 0x49425a06, 0x497a5c09, 0x0201f800, 0x00020381,
-- 0x0401f016, 0x833c0500, 0x00001800, 0x04000015,
-- 0x8d3e7d16, 0x04020013, 0x59325817, 0x0201f800,
-- 0x00100843, 0x59300203, 0x82000580, 0x00000004,
-- 0x02000800, 0x00100ee4, 0x59325808, 0x0201f800,
-- 0x00108df4, 0x04000005, 0x49425a06, 0x497a5c09,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00107698,
-- 0x83326400, 0x00000024, 0x41580000, 0x81300480,
-- 0x0400173e, 0x5c027000, 0x5c025800, 0x5c026800,
-- 0x5c026000, 0x5c00b800, 0x1c01f000, 0x5c000000,
-- 0x4c000000, 0x4803c857, 0x480bc857, 0x480fc857,
-- 0x485bc857, 0x50080800, 0x500c0000, 0x80042580,
-- 0x04020007, 0x80081000, 0x800c1800, 0x8058b040,
-- 0x040207f9, 0x80000580, 0x1c01f000, 0x4803c857,
-- 0x4807c857, 0x480bc857, 0x480fc857, 0x80040480,
-- 0x04001006, 0x42000000, 0x00000001, 0x82040d40,
-- 0x00000001, 0x1c01f000, 0x41780000, 0x0401f7fc,
-- 0x83380480, 0x00000053, 0x02021800, 0x00100615,
-- 0x83380480, 0x0000004b, 0x02001800, 0x00100615,
-- 0x0c01f001, 0x0010832f, 0x0010832f, 0x0010832f,
-- 0x0010832f, 0x0010832d, 0x0010832d, 0x0010832d,
-- 0x0010832f, 0x0201f800, 0x00100615, 0x493bc857,
-- 0x4a026203, 0x0000000d, 0x493a6403, 0x42000800,
-- 0x80000000, 0x0201f000, 0x00020855, 0x83380580,
-- 0x00000013, 0x04020008, 0x59300403, 0x82000580,
-- 0x00000050, 0x02020800, 0x00100615, 0x0201f000,
-- 0x000208b4, 0x4933c857, 0x83380580, 0x00000027,
-- 0x04020030, 0x4933c857, 0x0201f800, 0x001068f6,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x00101de2,
-- 0x5c027800, 0x42000000, 0x0010b663, 0x0201f800,
-- 0x0010a86e, 0x4d2c0000, 0x59325808, 0x0201f800,
-- 0x00108df4, 0x492fc857, 0x0400000d, 0x4a025a04,
-- 0x00000103, 0x59300c02, 0x48065c06, 0x4a025a06,
-- 0x00000029, 0x497a5c09, 0x592c0c08, 0x84040d50,
-- 0x48065c08, 0x0201f800, 0x00020381, 0x5c025800,
-- 0x42003000, 0x00000015, 0x41782800, 0x42002000,
-- 0x00000003, 0x4d400000, 0x4d440000, 0x59368c03,
-- 0x42028000, 0x00000029, 0x0201f800, 0x0010962a,
-- 0x5c028800, 0x5c028000, 0x0201f000, 0x000208b4,
-- 0x83380580, 0x00000014, 0x0402000d, 0x59300403,
-- 0x82000c80, 0x00000053, 0x02021800, 0x00100615,
-- 0x82000480, 0x00000040, 0x02001800, 0x00100615,
-- 0x4933c857, 0x4803c857, 0x0c01f00e, 0x83380580,
-- 0x00000053, 0x0400000a, 0x83380580, 0x00000048,
-- 0x02020800, 0x00100615, 0x59300403, 0x82000580,
-- 0x00000050, 0x02020800, 0x00100615, 0x1c01f000,
-- 0x001083a5, 0x001083a3, 0x001083a3, 0x001083a3,
-- 0x001083a3, 0x001083a3, 0x001083a3, 0x001083a3,
-- 0x001083a3, 0x001083a3, 0x001083a3, 0x001083bc,
-- 0x001083bc, 0x001083bc, 0x001083bc, 0x001083a3,
-- 0x001083bc, 0x001083a3, 0x001083bc, 0x0201f800,
-- 0x00100615, 0x4933c857, 0x0201f800, 0x001068f6,
-- 0x0201f800, 0x00108df4, 0x02000000, 0x000208b4,
-- 0x4d2c0000, 0x59325808, 0x4a025a04, 0x00000103,
-- 0x59300402, 0x48025c06, 0x4a025a06, 0x00000006,
-- 0x497a5c09, 0x0201f800, 0x00020381, 0x5c025800,
-- 0x0201f800, 0x00108ee7, 0x0201f000, 0x000208b4,
-- 0x4933c857, 0x0201f800, 0x001068f6, 0x0201f000,
-- 0x000208b4, 0x0201f800, 0x00100615, 0x5930001c,
-- 0x800001c0, 0x02020800, 0x0010961a, 0x59300004,
-- 0x8c00053e, 0x04020029, 0x59325808, 0x592c0c08,
-- 0x59cc2a08, 0x82141d00, 0x00000c00, 0x04000002,
-- 0x59cc1809, 0x84040d58, 0x48065c08, 0x82143500,
-- 0x00000fff, 0x04020027, 0x59340200, 0x8c00050e,
-- 0x04020080, 0x0201f800, 0x00020962, 0x04020006,
-- 0x4a025a06, 0x00000000, 0x59300811, 0x800409c0,
-- 0x04020951, 0x4a025a04, 0x00000103, 0x48065807,
-- 0x480e580a, 0x48165c09, 0x59300c02, 0x48065c06,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00104801,
-- 0x59cc0208, 0x8c000518, 0x02020000, 0x00108f88,
-- 0x0201f000, 0x000208b4, 0x0201f800, 0x00106cb4,
-- 0x040007d6, 0x4d3c0000, 0x42027800, 0x00000002,
-- 0x0201f800, 0x00108997, 0x5c027800, 0x0401f7cf,
-- 0x4817c857, 0x480fc857, 0x82180500, 0x000000ff,
-- 0x0400000e, 0x592c0204, 0x82000500, 0x000000ff,
-- 0x82000580, 0x00000048, 0x04020008, 0x592c0407,
-- 0x800001c0, 0x04000005, 0x0201f800, 0x0010950b,
-- 0x0201f000, 0x00109553, 0x82180d00, 0x00000c00,
-- 0x04000004, 0x59340200, 0x8c00050e, 0x04020032,
-- 0x4a025a06, 0x00000000, 0x41782000, 0x8c183510,
-- 0x04000007, 0x59cc000c, 0x82000500, 0x000000ff,
-- 0x04000002, 0x4803c857, 0x59cc200b, 0x4812580c,
-+ 0x00109c1c, 0x850e1d44, 0x42028000, 0x0000002a,
-+ 0x4d3c0000, 0x42027800, 0x00000200, 0x0201f800,
-+ 0x0010ca42, 0x5c027800, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x00101add,
-+ 0x4200b000, 0x00000010, 0x42028800, 0x000007f0,
-+ 0x4d2c0000, 0x83440580, 0x000007fe, 0x04000003,
-+ 0x0201f800, 0x0010430f, 0x81468800, 0x8058b040,
-+ 0x040207f9, 0x5c025800, 0x59cc0408, 0x8c00051e,
-+ 0x04000004, 0x59a80023, 0x84000512, 0x48035023,
-+ 0x5c028800, 0x5c026800, 0x0201f800, 0x00104346,
-+ 0x4a026802, 0x00fffffe, 0x59a80823, 0x84040d50,
-+ 0x59cc0013, 0x8c00053e, 0x04000003, 0x8c000536,
-+ 0x04000004, 0x59cc0017, 0x8c000536, 0x04020002,
-+ 0x84040d10, 0x48075023, 0x59cc0800, 0x82040d00,
-+ 0x00ffffff, 0x4807500f, 0x80040110, 0x4803501c,
-+ 0x48038881, 0x0201f800, 0x00104ca6, 0x04000007,
-+ 0x59cc0009, 0x48035032, 0x59cc000a, 0x48035033,
-+ 0x0201f800, 0x00108b1b, 0x5c00b000, 0x5c028000,
-+ 0x1c01f000, 0x4933c857, 0x4c580000, 0x59a8001c,
-+ 0x800001c0, 0x04000023, 0x59cc1000, 0x82081500,
-+ 0x00ffff00, 0x80081110, 0x80080580, 0x04000004,
-+ 0x42000000, 0x0010b009, 0x0401f016, 0x83cc1400,
-+ 0x0000000b, 0x4200b000, 0x00000002, 0x83341c00,
-+ 0x00000006, 0x0401f830, 0x04000004, 0x42000000,
-+ 0x0010b00a, 0x0401f00b, 0x83cc1400, 0x0000000d,
-+ 0x4200b000, 0x00000002, 0x83341c00, 0x00000008,
-+ 0x0401f825, 0x04000007, 0x42000000, 0x0010b00b,
-+ 0x0201f800, 0x0010a260, 0x82000540, 0x00000001,
-+ 0x5c00b000, 0x1c01f000, 0x4933c857, 0x59cc0206,
-+ 0x82000580, 0x00000014, 0x04020016, 0x59cc0407,
-+ 0x82000580, 0x00000800, 0x04020012, 0x59cc0207,
-+ 0x8c00051a, 0x0400000d, 0x82000500, 0x00000f00,
-+ 0x82000580, 0x00000100, 0x04020008, 0x59cc020a,
-+ 0x8c000508, 0x04020003, 0x8c00050a, 0x04000003,
-+ 0x80000580, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x480bc857, 0x480fc857, 0x485bc857, 0x50080800,
-+ 0x500c0000, 0x80042580, 0x04020007, 0x80081000,
-+ 0x800c1800, 0x8058b040, 0x040207f9, 0x80000580,
-+ 0x1c01f000, 0x4803c857, 0x4807c857, 0x480bc857,
-+ 0x480fc857, 0x80040480, 0x04001006, 0x42000000,
-+ 0x00000001, 0x82040d40, 0x00000001, 0x1c01f000,
-+ 0x41780000, 0x0401f7fc, 0x83380480, 0x00000053,
-+ 0x02021800, 0x001004ef, 0x83380480, 0x0000004b,
-+ 0x02001800, 0x001004ef, 0x0c01f001, 0x00107d71,
-+ 0x00107d71, 0x00107d71, 0x00107d71, 0x00107d6f,
-+ 0x00107d6f, 0x00107d6f, 0x00107d71, 0x0201f800,
-+ 0x001004ef, 0x493bc857, 0x4a026203, 0x0000000d,
-+ 0x493a6403, 0x42000800, 0x80000000, 0x0201f000,
-+ 0x0002075c, 0x83380580, 0x00000013, 0x04020008,
-+ 0x59300403, 0x82000580, 0x00000050, 0x02020800,
-+ 0x001004ef, 0x0201f000, 0x000207bb, 0x4933c857,
-+ 0x83380580, 0x00000027, 0x04020030, 0x4933c857,
-+ 0x0201f800, 0x001063c4, 0x4d3c0000, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x5c027800, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x4d2c0000,
-+ 0x59325808, 0x0201f800, 0x0010883d, 0x492fc857,
-+ 0x0400000d, 0x4a025a04, 0x00000103, 0x59300c02,
-+ 0x48065c06, 0x4a025a06, 0x00000029, 0x497a5809,
-+ 0x592c0c08, 0x84040d50, 0x48065c08, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x42003000, 0x00000015,
-+ 0x41782800, 0x42002000, 0x00000003, 0x4d400000,
-+ 0x4d440000, 0x59368c03, 0x42028000, 0x00000029,
-+ 0x0201f800, 0x001090b2, 0x5c028800, 0x5c028000,
-+ 0x0201f000, 0x000207bb, 0x83380580, 0x00000014,
-+ 0x0402000d, 0x59300403, 0x82000c80, 0x00000053,
-+ 0x02021800, 0x001004ef, 0x82000480, 0x00000040,
-+ 0x02001800, 0x001004ef, 0x4933c857, 0x4803c857,
-+ 0x0c01f00e, 0x83380580, 0x00000053, 0x0400000a,
-+ 0x83380580, 0x00000048, 0x02020800, 0x001004ef,
-+ 0x59300403, 0x82000580, 0x00000050, 0x02020800,
-+ 0x001004ef, 0x1c01f000, 0x00107de7, 0x00107de5,
-+ 0x00107de5, 0x00107de5, 0x00107de5, 0x00107de5,
-+ 0x00107de5, 0x00107de5, 0x00107de5, 0x00107de5,
-+ 0x00107de5, 0x00107dfe, 0x00107dfe, 0x00107dfe,
-+ 0x00107dfe, 0x00107de5, 0x00107dfe, 0x00107de5,
-+ 0x00107dfe, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x0201f800, 0x001063c4, 0x0201f800, 0x0010883d,
-+ 0x02000000, 0x000207bb, 0x4d2c0000, 0x59325808,
-+ 0x4a025a04, 0x00000103, 0x59300402, 0x48025c06,
-+ 0x4a025a06, 0x00000006, 0x497a5809, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x0201f800, 0x00108942,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x0201f800,
-+ 0x001063c4, 0x0201f000, 0x000207bb, 0x0201f800,
-+ 0x001004ef, 0x5930001c, 0x800001c0, 0x02020800,
-+ 0x001090a2, 0x59300004, 0x8c00053e, 0x0402002a,
-+ 0x59325808, 0x592c0c08, 0x59cc2808, 0x82141d00,
-+ 0x00000c00, 0x04000002, 0x59cc1809, 0x84040d58,
-+ 0x48065c08, 0x82143500, 0x00000fff, 0x04020028,
-+ 0x59340200, 0x8c00050e, 0x04020082, 0x0201f800,
-+ 0x00020869, 0x04020006, 0x4a025a06, 0x00000000,
-+ 0x59300811, 0x800409c0, 0x04020954, 0x4a025a04,
-+ 0x00000103, 0x48065807, 0x480e580a, 0x901409c0,
-+ 0x48065809, 0x59300c02, 0x48065c06, 0x0201f800,
-+ 0x000202e9, 0x0201f800, 0x001046db, 0x59cc0008,
-+ 0x8c000518, 0x02020000, 0x001089f0, 0x0201f000,
-+ 0x000207bb, 0x0201f800, 0x001067a7, 0x040007d5,
-+ 0x4d3c0000, 0x42027800, 0x00000002, 0x0201f800,
-+ 0x001083e0, 0x5c027800, 0x0401f7ce, 0x4817c857,
-+ 0x480fc857, 0x82180500, 0x000000ff, 0x0400000e,
-+ 0x592c0204, 0x82000500, 0x000000ff, 0x82000580,
-+ 0x00000048, 0x04020008, 0x592c0407, 0x800001c0,
-+ 0x04000005, 0x0201f800, 0x00108f93, 0x0201f000,
-+ 0x00108fdb, 0x82180d00, 0x00000c00, 0x04000004,
-+ 0x59340200, 0x8c00050e, 0x04020033, 0x4a025a06,
-+ 0x00000000, 0x41782000, 0x8c183510, 0x04000007,
-+ 0x59cc000c, 0x82000500, 0x000000ff, 0x04000002,
-+ 0x4803c857, 0x59cc200b, 0x4812580c, 0x41780000,
-+ 0x8c183512, 0x04000002, 0x59cc000a, 0x4802580b,
-+ 0x80100c00, 0x040007b7, 0x82041480, 0x0000001d,
-+ 0x04001006, 0x592c0404, 0x8c00051e, 0x0400000e,
-+ 0x42000800, 0x0000001c, 0x4c500000, 0x4c540000,
-+ 0x83cca400, 0x0000000c, 0x832cac00, 0x0000000d,
-+ 0x0201f800, 0x0010839c, 0x5c00a800, 0x5c00a000,
-+ 0x0401f7a4, 0x59300011, 0x59301402, 0x480a5c06,
-+ 0x48025807, 0x480e580a, 0x901401c0, 0x48025809,
-+ 0x0201f800, 0x00108345, 0x0201f800, 0x00108381,
-+ 0x0401f7a5, 0x592c020a, 0x8c000502, 0x040007cc,
-+ 0x592c0208, 0x8c00050e, 0x040207c9, 0x59300011,
-+ 0x800c0d80, 0x040007c6, 0x4803c857, 0x480fc857,
-+ 0x8c183514, 0x02000000, 0x00108a2e, 0x80000540,
-+ 0x040007bf, 0x4807c856, 0x0201f000, 0x00108a2e,
-+ 0x592c020a, 0x8c000502, 0x04000780, 0x59300011,
-+ 0x800001c0, 0x0400077d, 0x592c0208, 0x8c00050e,
-+ 0x0402077a, 0x0201f000, 0x00108a2e, 0x59cc2006,
-+ 0x59cc2807, 0x0401f038, 0x0401f037, 0x1c01f000,
-+ 0x4933c857, 0x5930001c, 0x800001c0, 0x02020800,
-+ 0x001090a2, 0x59325808, 0x592c0c08, 0x41782800,
-+ 0x41781800, 0x84040d58, 0x48065c08, 0x41783000,
-+ 0x59340200, 0x8c00050e, 0x0402001b, 0x0201f800,
-+ 0x00020869, 0x04020007, 0x4a025a06, 0x00000000,
-+ 0x59300811, 0x4807c857, 0x800409c0, 0x040208b3,
-+ 0x4a025a04, 0x00000103, 0x48065807, 0x480e580a,
-+ 0x901409c0, 0x48065809, 0x4933c857, 0x59300c02,
-+ 0x48065c06, 0x0201f800, 0x00108def, 0x0201f800,
-+ 0x000202e9, 0x0201f800, 0x001046db, 0x0201f000,
-+ 0x000207bb, 0x592c020a, 0x8c000502, 0x040007e7,
-+ 0x59300011, 0x4803c857, 0x800001c0, 0x040007e3,
-+ 0x592c0208, 0x8c00050e, 0x040207e0, 0x0201f000,
-+ 0x00108a2e, 0x5930001c, 0x800001c0, 0x4c100000,
-+ 0x4c140000, 0x02020800, 0x001090a2, 0x5c002800,
-+ 0x5c002000, 0x4a026203, 0x00000002, 0x4a026403,
-+ 0x00000043, 0x59325808, 0x592c020a, 0x8c000502,
-+ 0x0402001c, 0x40100000, 0x592c080f, 0x80040c80,
-+ 0x40140000, 0x80040480, 0x04001018, 0x59300004,
-+ 0x8c00053e, 0x0402000a, 0x48126013, 0x48166011,
-+ 0x497a6205, 0x0201f800, 0x00100eda, 0x0402000d,
-+ 0x59300804, 0x0201f000, 0x0010632f, 0x4c100000,
-+ 0x4c140000, 0x0201f800, 0x001067a7, 0x5c002800,
-+ 0x5c002000, 0x040007f1, 0x0201f000, 0x0010720c,
-+ 0x4933c857, 0x1c01f000, 0x4807c857, 0x40042800,
-+ 0x0401f7e7, 0x83380480, 0x00000058, 0x04021005,
-+ 0x83380480, 0x00000040, 0x04001002, 0x0c01f002,
-+ 0x1c01f000, 0x00107f31, 0x00107f31, 0x00107f31,
-+ 0x00107f31, 0x00107f31, 0x00107f31, 0x00107f31,
-+ 0x00107f31, 0x00107f31, 0x00107f31, 0x00107f33,
-+ 0x00107f31, 0x00107f31, 0x00107f31, 0x00107f31,
-+ 0x00107f40, 0x00107f31, 0x00107f31, 0x00107f31,
-+ 0x00107f31, 0x00107f6e, 0x00107f31, 0x00107f31,
-+ 0x00107f31, 0x0201f800, 0x001004ef, 0x4933c857,
-+ 0x0201f800, 0x00106606, 0x4a026203, 0x00000002,
-+ 0x59a80036, 0x48026205, 0x59300011, 0x59300815,
-+ 0x80040c80, 0x48066015, 0x0201f000, 0x001063a4,
-+ 0x4933c857, 0x0201f800, 0x001063a4, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
-+ 0x42000000, 0x0010b033, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x0010883d, 0x04000010, 0x4d2c0000,
-+ 0x59325808, 0x4a025a04, 0x00000103, 0x59300402,
-+ 0x48025c06, 0x4a025a06, 0x00000029, 0x497a5809,
-+ 0x592c0c08, 0x84040d50, 0x48065c08, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x42003000, 0x00000014,
-+ 0x41782800, 0x4d400000, 0x4d440000, 0x59368c03,
-+ 0x42002000, 0x00000002, 0x42028000, 0x00000029,
-+ 0x0201f800, 0x001090b2, 0x5c028800, 0x5c028000,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x59300808,
-+ 0x49780809, 0x4978080a, 0x58041408, 0x84081558,
-+ 0x48080c08, 0x1c01f000, 0x4807c857, 0x8c040d3e,
-+ 0x04020024, 0x497a5a06, 0x5930001f, 0x80000540,
-+ 0x04000018, 0x497a5a06, 0x4c040000, 0x4c080000,
-+ 0x4c0c0000, 0x4c100000, 0x4c140000, 0x40002800,
-+ 0x58141003, 0x40040000, 0x80081480, 0x48082803,
-+ 0x40140000, 0x0201f800, 0x00100c91, 0x5c002800,
-+ 0x5c002000, 0x5c001800, 0x5c001000, 0x5c000800,
-+ 0x592c0206, 0x80000540, 0x04020009, 0x0401f005,
-+ 0x592c0408, 0x8c00051c, 0x04000002, 0x592c0803,
-+ 0x4807c857, 0x4a025a06, 0x00000015, 0x1c01f000,
-+ 0x5930001f, 0x80000540, 0x04000009, 0x4a025a06,
-+ 0x00000011, 0x5930001f, 0x4c040000, 0x0201f800,
-+ 0x00100c91, 0x5c000800, 0x0401f7f5, 0x4807c856,
-+ 0x4a025a06, 0x00000007, 0x1c01f000, 0x83380480,
-+ 0x00000058, 0x04021007, 0x83380480, 0x00000040,
-+ 0x04001004, 0x4d2c0000, 0x0c01f803, 0x5c025800,
-+ 0x1c01f000, 0x00107fcd, 0x00107fcd, 0x00107fcd,
-+ 0x00107fcd, 0x00107fcd, 0x00107fcf, 0x00107fcd,
-+ 0x00107fcd, 0x00108054, 0x00107fcd, 0x00107fcd,
-+ 0x00107fcd, 0x00107fcd, 0x00107fcd, 0x00107fcd,
-+ 0x00107fcd, 0x00107fcd, 0x00107fcd, 0x00107fcd,
-+ 0x0010810c, 0x00108135, 0x00108114, 0x00107fcd,
-+ 0x00108141, 0x0201f800, 0x001004ef, 0x5930001c,
-+ 0x800001c0, 0x02020800, 0x001090a2, 0x59300007,
-+ 0x8c00050e, 0x0400007e, 0x8c000500, 0x04000070,
-+ 0x8c00051c, 0x04000009, 0x84000500, 0x48026007,
-+ 0x59325808, 0x592c3c08, 0x841c3d58, 0x481e5c08,
-+ 0x0201f000, 0x0002081b, 0x59325808, 0x592c3c08,
-+ 0x841c3d58, 0x59300007, 0x8c00051c, 0x040207f3,
-+ 0x481e5c08, 0x42000000, 0x00000005, 0x40000000,
-+ 0x80000040, 0x040207fe, 0x59300007, 0x8c00051c,
-+ 0x040207ea, 0x59cc0808, 0x592c0204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000048, 0x0402000c,
-+ 0x497a580b, 0x82040500, 0x000000ff, 0x04000008,
-+ 0x592c0407, 0x800001c0, 0x04000005, 0x0201f800,
-+ 0x00108f93, 0x0201f000, 0x00100d98, 0x900421c0,
-+ 0x48125809, 0x41782000, 0x82040500, 0x00000c00,
-+ 0x04000002, 0x59cc2009, 0x82043500, 0x00000fff,
-+ 0x04020027, 0x481e5c08, 0x4a025a06, 0x00000000,
-+ 0x801831c0, 0x02000000, 0x00100d98, 0x41782000,
-+ 0x8c183510, 0x04000002, 0x59cc200b, 0x4812580c,
- 0x41780000, 0x8c183512, 0x04000002, 0x59cc000a,
-- 0x4802580b, 0x80100c00, 0x040007b8, 0x82041480,
-+ 0x4802580b, 0x80100c00, 0x02001800, 0x001004ef,
-+ 0x02000000, 0x00100d98, 0x82041480, 0x0000001d,
-+ 0x0402100c, 0x4c500000, 0x4c540000, 0x83cca400,
-+ 0x0000000c, 0x832cac00, 0x0000000d, 0x0401fb71,
-+ 0x5c00a800, 0x5c00a000, 0x0201f000, 0x00100d98,
-+ 0x0401fb15, 0x0201f000, 0x00100d98, 0x412c7800,
-+ 0x0201f800, 0x0010071a, 0x02000800, 0x001004ef,
-+ 0x492c7809, 0x841c3d52, 0x481c7c08, 0x4a025a04,
-+ 0x00000103, 0x4812580a, 0x900401c0, 0x48025809,
-+ 0x583c0404, 0x583c1005, 0x583c2208, 0x48025c04,
-+ 0x480a5805, 0x48125a08, 0x0401f7c7, 0x8c000524,
-+ 0x04000792, 0x59325808, 0x4c000000, 0x592c0408,
-+ 0x8c00051c, 0x5c000000, 0x04020003, 0x4a026011,
-+ 0xffffffff, 0x84000524, 0x0401f788, 0x1c01f000,
-+ 0x59a80036, 0x48026205, 0x59325808, 0x4a026203,
-+ 0x00000002, 0x592c2408, 0x59300807, 0x4933c857,
-+ 0x4807c857, 0x592c0204, 0x82000500, 0x000000ff,
-+ 0x82000580, 0x00000048, 0x04020004, 0x8c102500,
-+ 0x02020000, 0x00108fdb, 0x4a025a06, 0x00000000,
-+ 0x8c040d1e, 0x04000027, 0x41780800, 0x497a5809,
-+ 0x592c1c09, 0x59300011, 0x59341200, 0x497a6205,
-+ 0x8c08150e, 0x0402006e, 0x4807c857, 0x4806580a,
-+ 0x80000d40, 0x04020f01, 0x59300402, 0x48025c06,
-+ 0x48065807, 0x4a025a04, 0x00000103, 0x4c040000,
-+ 0x4c0c0000, 0x4c100000, 0x0201f800, 0x00108def,
-+ 0x5c002000, 0x5c001800, 0x5c000800, 0x8c102512,
-+ 0x0402001a, 0x4c0c0000, 0x0201f800, 0x000202e9,
-+ 0x0201f800, 0x001046db, 0x5c001800, 0x8c0c1d18,
-+ 0x02000000, 0x000207bb, 0x0201f000, 0x001089f0,
-+ 0x4813c857, 0x8c102518, 0x0400004b, 0x41780800,
-+ 0x592c1c09, 0x820c0580, 0x00001000, 0x040007d6,
-+ 0x8c102512, 0x040007d4, 0x592c7809, 0x583c080a,
-+ 0x583c1c09, 0x0401f7d0, 0x4807c857, 0x592c7809,
-+ 0x59300402, 0x592c1404, 0x8c08151e, 0x0402000d,
-+ 0x592c1206, 0x48007c06, 0x48047807, 0x48087a06,
-+ 0x84102512, 0x48107c08, 0x4c0c0000, 0x0201f800,
-+ 0x0010073b, 0x403e5800, 0x0401fad3, 0x0401f7d9,
-+ 0x48025c06, 0x48065807, 0x583c080c, 0x583c000b,
-+ 0x80040c00, 0x82041480, 0x0000001d, 0x04001006,
-+ 0x583c1001, 0x480a5801, 0x49787801, 0x42000800,
-+ 0x0000001c, 0x82040c00, 0x00000014, 0x4c0c0000,
-+ 0x4c500000, 0x4c540000, 0x823ca400, 0x00000008,
-+ 0x832cac00, 0x00000008, 0x4c100000, 0x4c3c0000,
-+ 0x0401fad4, 0x5c007800, 0x5c002000, 0x5c00a800,
-+ 0x5c00a000, 0x84102512, 0x48125c08, 0x403e5800,
-+ 0x0201f800, 0x0010073b, 0x42034000, 0x0010ac71,
-+ 0x59a1d81e, 0x80edd9c0, 0x02000800, 0x001004ef,
-+ 0x48efc857, 0x58ec0009, 0x4803c857, 0x0801f800,
-+ 0x0401f7ac, 0x4933c857, 0x1c01f000, 0x59301414,
-+ 0x480bc857, 0x8c08151c, 0x0402000e, 0x80000540,
-+ 0x4803c857, 0x0400078d, 0x80042c80, 0x0402178b,
-+ 0x8c081514, 0x04020005, 0x592c080f, 0x4807c857,
-+ 0x80040480, 0x48026016, 0x8408155c, 0x480a6414,
-+ 0x59301007, 0x8408151e, 0x480a6007, 0x4c100000,
-+ 0x4c3c0000, 0x4d400000, 0x592e8206, 0x4a025a06,
-+ 0x00000001, 0x0201f800, 0x00108def, 0x49425a06,
-+ 0x5c028000, 0x5c007800, 0x5c002000, 0x497a5809,
-+ 0x8c102512, 0x04000006, 0x4d2c0000, 0x403e5800,
-+ 0x0201f800, 0x0010073b, 0x5c025800, 0x82102500,
-+ 0xffffedff, 0x48125c08, 0x0201f000, 0x00108a2e,
-+ 0x59325808, 0x592c0408, 0x8c000518, 0x04000004,
-+ 0x412df800, 0x0201f000, 0x00100db1, 0x1c01f000,
-+ 0x4933c857, 0x59325808, 0x497a5809, 0x4a025a06,
-+ 0x00000000, 0x4a025a04, 0x00000103, 0x59300811,
-+ 0x4807c857, 0x800409c0, 0x0402000a, 0x48065807,
-+ 0x59300c02, 0x48065c06, 0x0201f800, 0x000202e9,
-+ 0x0201f800, 0x001046db, 0x0201f000, 0x000207bb,
-+ 0x59340200, 0x8c00050e, 0x04020005, 0x59300811,
-+ 0x0401fe4a, 0x48065807, 0x0401f7f2, 0x592c0208,
-+ 0x8c00050e, 0x040207fa, 0x4933c857, 0x0201f000,
-+ 0x00108a2e, 0x4933c857, 0x59325808, 0x812e59c0,
-+ 0x02000800, 0x001004ef, 0x592c020a, 0x8c000502,
-+ 0x02000800, 0x001004ef, 0x4a026206, 0x00000002,
-+ 0x1c01f000, 0x5930001c, 0x800001c0, 0x02020800,
-+ 0x001090a2, 0x59300007, 0x4933c857, 0x4803c857,
-+ 0x8c00050e, 0x04000037, 0x8c000500, 0x04000029,
-+ 0x8c00051c, 0x0400000a, 0x84000500, 0x48026007,
-+ 0x59325808, 0x592c3c08, 0x481fc857, 0x841c3d58,
-+ 0x481e5c08, 0x0201f000, 0x0002081b, 0x59325808,
-+ 0x592c3c08, 0x841c3d58, 0x59300007, 0x8c00051c,
-+ 0x040207f2, 0x481e5c08, 0x42000000, 0x00000005,
-+ 0x40000000, 0x80000040, 0x040207fe, 0x59300007,
-+ 0x8c00051c, 0x040207e9, 0x592c0204, 0x82000500,
-+ 0x000000ff, 0x82000580, 0x00000048, 0x04020003,
-+ 0x497a580b, 0x0401f002, 0x497a5809, 0x481e5c08,
-+ 0x4a025a06, 0x00000000, 0x0201f000, 0x00100d98,
-+ 0x8c000524, 0x040007d9, 0x59325808, 0x4c000000,
-+ 0x592c0408, 0x8c00051c, 0x5c000000, 0x04020003,
-+ 0x4a026011, 0xffffffff, 0x84000524, 0x0401f7cf,
-+ 0x1c01f000, 0x4933c857, 0x41780800, 0x83380480,
-+ 0x00000058, 0x0402100b, 0x83380480, 0x00000040,
-+ 0x04001008, 0x4d2c0000, 0x59325808, 0x812e59c0,
-+ 0x0c020806, 0x5c025800, 0x0201f000, 0x000207bb,
-+ 0x493bc857, 0x1c01f000, 0x001081aa, 0x001081aa,
-+ 0x001081aa, 0x001081aa, 0x001081aa, 0x001081ac,
-+ 0x001081aa, 0x001081aa, 0x001081aa, 0x001081aa,
-+ 0x001081aa, 0x001081aa, 0x001081aa, 0x001081aa,
-+ 0x001081aa, 0x001081aa, 0x001081aa, 0x001081aa,
-+ 0x001081aa, 0x001081aa, 0x001081af, 0x001081aa,
-+ 0x001081aa, 0x001081aa, 0x0201f800, 0x001004ef,
-+ 0x59cc0808, 0x497a5807, 0x4807c857, 0x59300402,
-+ 0x48025c06, 0x4a025a04, 0x00000103, 0x900401c0,
-+ 0x48025809, 0x4a025a06, 0x00000000, 0x800409c0,
-+ 0x02000000, 0x000202e9, 0x59cc0009, 0x4802580a,
-+ 0x82042500, 0x00000100, 0x04000002, 0x59cc200b,
-+ 0x4812580c, 0x82040500, 0x00000200, 0x04000002,
-+ 0x59cc000a, 0x4802580b, 0x80100c00, 0x02001800,
-+ 0x001004ef, 0x02000000, 0x000202e9, 0x82041480,
- 0x0000001d, 0x04001006, 0x592c0404, 0x8c00051e,
- 0x0400000e, 0x42000800, 0x0000001c, 0x4c500000,
- 0x4c540000, 0x83cca400, 0x0000000c, 0x832cac00,
-- 0x0000000d, 0x0201f800, 0x00108953, 0x5c00a800,
-- 0x5c00a000, 0x0401f7a5, 0x59300011, 0x59301402,
-- 0x480a5c06, 0x48025807, 0x480e580a, 0x48165c09,
-- 0x0201f800, 0x001088fc, 0x0201f800, 0x00108938,
-- 0x0401f7a6, 0x592c020a, 0x8c000502, 0x040007cd,
-- 0x592c0208, 0x8c00050e, 0x040207ca, 0x59300011,
-- 0x800c0d80, 0x040007c7, 0x4803c857, 0x480fc857,
-- 0x8c183514, 0x02000000, 0x00108fc6, 0x80000540,
-- 0x040007c0, 0x4807c856, 0x0201f000, 0x00108fc6,
-- 0x592c020a, 0x8c000502, 0x04000782, 0x59300011,
-- 0x800001c0, 0x0400077f, 0x592c0208, 0x8c00050e,
-- 0x0402077c, 0x0201f000, 0x00108fc6, 0x59cc2006,
-- 0x59cc2807, 0x0401f037, 0x0401f036, 0x1c01f000,
-- 0x4933c857, 0x5930001c, 0x800001c0, 0x02020800,
-- 0x0010961a, 0x59325808, 0x592c0c08, 0x41782800,
-- 0x41781800, 0x84040d58, 0x48065c08, 0x41783000,
-- 0x59340200, 0x8c00050e, 0x0402001a, 0x0201f800,
-- 0x00020962, 0x04020007, 0x4a025a06, 0x00000000,
-- 0x59300811, 0x4807c857, 0x800409c0, 0x040208b2,
-- 0x4a025a04, 0x00000103, 0x48065807, 0x480e580a,
-- 0x48165c09, 0x4933c857, 0x59300c02, 0x48065c06,
-- 0x0201f800, 0x00109365, 0x0201f800, 0x00020381,
-- 0x0201f800, 0x00104801, 0x0201f000, 0x000208b4,
-- 0x592c020a, 0x8c000502, 0x040007e8, 0x59300011,
-- 0x4803c857, 0x800001c0, 0x040007e4, 0x592c0208,
-- 0x8c00050e, 0x040207e1, 0x0201f000, 0x00108fc6,
-- 0x5930001c, 0x800001c0, 0x4c100000, 0x4c140000,
-- 0x02020800, 0x0010961a, 0x5c002800, 0x5c002000,
-- 0x4a026203, 0x00000002, 0x4a026403, 0x00000043,
-- 0x59325808, 0x592c020a, 0x8c000502, 0x0402001c,
-- 0x40100000, 0x592c080f, 0x80040c80, 0x40140000,
-- 0x80040480, 0x04001018, 0x59300004, 0x8c00053e,
-- 0x0402000a, 0x48126013, 0x48166011, 0x497a6205,
-- 0x0201f800, 0x00100fe1, 0x0402000d, 0x59300804,
-- 0x0201f000, 0x00106466, 0x4c100000, 0x4c140000,
-- 0x0201f800, 0x00106cb4, 0x5c002800, 0x5c002000,
-- 0x040007f1, 0x0201f000, 0x001076fb, 0x4933c857,
-- 0x1c01f000, 0x4807c857, 0x40042800, 0x0401f7e7,
-- 0x83380480, 0x00000058, 0x04021005, 0x83380480,
-- 0x00000040, 0x04001002, 0x0c01f002, 0x1c01f000,
-- 0x001084ec, 0x001084ec, 0x001084ec, 0x001084ec,
-- 0x001084ec, 0x001084ec, 0x001084ec, 0x001084ec,
-- 0x001084ec, 0x001084ec, 0x001084ee, 0x001084ec,
-- 0x001084ec, 0x001084ec, 0x001084ec, 0x001084fb,
-- 0x001084ec, 0x001084ec, 0x001084ec, 0x001084ec,
-- 0x00108529, 0x001084ec, 0x001084ec, 0x001084ec,
-- 0x0201f800, 0x00100615, 0x4933c857, 0x0201f800,
-- 0x00106b13, 0x4a026203, 0x00000002, 0x59a80039,
-- 0x48026205, 0x59300011, 0x59300815, 0x80040c80,
-- 0x48066015, 0x0201f000, 0x001068c1, 0x4933c857,
-- 0x0201f800, 0x001068c1, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x00101de2, 0x5c027800, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x00108df4, 0x04000010, 0x4d2c0000, 0x59325808,
-+ 0x0000000d, 0x0401f9c3, 0x5c00a800, 0x5c00a000,
-+ 0x0201f000, 0x000202e9, 0x0401f967, 0x0401f1a2,
-+ 0x83380480, 0x00000093, 0x02021800, 0x001004ef,
-+ 0x83380480, 0x00000085, 0x02001800, 0x001004ef,
-+ 0x0c01f001, 0x001081f8, 0x001081f6, 0x001081f6,
-+ 0x001081ff, 0x001081f6, 0x001081f6, 0x001081f6,
-+ 0x001081f6, 0x001081f6, 0x001081f6, 0x001081f6,
-+ 0x001081f6, 0x001081f6, 0x0201f800, 0x001004ef,
-+ 0x4a026203, 0x00000001, 0x493a6403, 0x42000800,
-+ 0x80000040, 0x0201f000, 0x0002075c, 0x4933c857,
-+ 0x59cc1404, 0x0201f800, 0x00108c55, 0x0400001b,
-+ 0x591c0203, 0x82000580, 0x00000000, 0x04000017,
-+ 0x591c0009, 0x81340580, 0x04020014, 0x4d300000,
-+ 0x4d1c0000, 0x411e6000, 0x0401f9c6, 0x5c023800,
-+ 0x5c026000, 0x0400000b, 0x59cc0005, 0x8c000500,
-+ 0x04020003, 0x0401f990, 0x0401f003, 0x4a023a03,
-+ 0x00000002, 0x4a026403, 0x00000086, 0x0401f005,
-+ 0x0401f9aa, 0x040007f5, 0x4a026403, 0x00000087,
-+ 0x4a026203, 0x00000001, 0x42000800, 0x80000040,
-+ 0x0201f800, 0x0002075c, 0x59340200, 0x8c00050e,
-+ 0x0400000d, 0x59cc1404, 0x0201f800, 0x00108c55,
-+ 0x04000009, 0x591c0414, 0x8c00051a, 0x04000006,
-+ 0x4d300000, 0x411e6000, 0x0201f800, 0x00108a43,
-+ 0x5c026000, 0x1c01f000, 0x83380580, 0x00000013,
-+ 0x0402000b, 0x59300403, 0x4803c857, 0x82000d80,
-+ 0x00000086, 0x04000012, 0x82000d80, 0x00000087,
-+ 0x02020800, 0x001004ef, 0x0401f00d, 0x83380580,
-+ 0x00000027, 0x04000005, 0x83380580, 0x00000014,
-+ 0x02020800, 0x001004ef, 0x493bc857, 0x0201f800,
-+ 0x001063c4, 0x0201f000, 0x0010719c, 0x4933c857,
-+ 0x0201f000, 0x0010719c, 0x83380580, 0x00000013,
-+ 0x04020006, 0x59300403, 0x4803c857, 0x82000480,
-+ 0x00000085, 0x0c01f04d, 0x83380580, 0x00000027,
-+ 0x04020041, 0x4933c857, 0x0201f800, 0x001063c4,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010caa0,
-+ 0x5c027800, 0x42003000, 0x00000015, 0x41782800,
-+ 0x42002000, 0x00000003, 0x42028000, 0x00000029,
-+ 0x4d400000, 0x4d440000, 0x59368c03, 0x0201f800,
-+ 0x001090b2, 0x5c028800, 0x5c028000, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x0201f800,
-+ 0x0010883d, 0x0400000c, 0x4d2c0000, 0x59325808,
- 0x4a025a04, 0x00000103, 0x59300402, 0x48025c06,
-- 0x4a025a06, 0x00000029, 0x497a5c09, 0x592c0c08,
-- 0x84040d50, 0x48065c08, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x42003000, 0x00000014, 0x41782800,
-- 0x4d400000, 0x4d440000, 0x59368c03, 0x42002000,
-- 0x00000002, 0x42028000, 0x00000029, 0x0201f800,
-- 0x0010962a, 0x5c028800, 0x5c028000, 0x0201f000,
-- 0x000208b4, 0x4933c857, 0x59300808, 0x49780c09,
-- 0x4978080a, 0x58041408, 0x84081558, 0x48080c08,
-- 0x1c01f000, 0x4807c857, 0x8c040d3e, 0x04020024,
-- 0x497a5a06, 0x5930001f, 0x80000540, 0x04000018,
-- 0x497a5a06, 0x4c040000, 0x4c080000, 0x4c0c0000,
-- 0x4c100000, 0x4c140000, 0x40002800, 0x58141003,
-- 0x40040000, 0x80081480, 0x48082803, 0x40140000,
-- 0x0201f800, 0x00100d9a, 0x5c002800, 0x5c002000,
-- 0x5c001800, 0x5c001000, 0x5c000800, 0x592c0206,
-- 0x80000540, 0x04020009, 0x0401f005, 0x592c0408,
-- 0x8c00051c, 0x04000002, 0x592c0803, 0x4807c857,
-- 0x4a025a06, 0x00000015, 0x1c01f000, 0x5930001f,
-- 0x80000540, 0x04000009, 0x4a025a06, 0x00000011,
-- 0x5930001f, 0x4c040000, 0x0201f800, 0x00100d9a,
-- 0x5c000800, 0x0401f7f5, 0x4807c856, 0x4a025a06,
-- 0x00000007, 0x1c01f000, 0x83380480, 0x00000058,
-- 0x04021007, 0x83380480, 0x00000040, 0x04001004,
-- 0x4d2c0000, 0x0c01f803, 0x5c025800, 0x1c01f000,
-- 0x00108588, 0x00108588, 0x00108588, 0x00108588,
-- 0x00108588, 0x0010858a, 0x00108588, 0x00108588,
-- 0x0010860d, 0x00108588, 0x00108588, 0x00108588,
-- 0x00108588, 0x00108588, 0x00108588, 0x00108588,
-- 0x00108588, 0x00108588, 0x00108588, 0x001086c5,
-- 0x001086ee, 0x001086cd, 0x00108588, 0x001086fa,
-- 0x0201f800, 0x00100615, 0x5930001c, 0x800001c0,
-- 0x02020800, 0x0010961a, 0x59300007, 0x8c00050e,
-- 0x0400007c, 0x8c000500, 0x0400006e, 0x8c00051c,
-- 0x04000009, 0x84000500, 0x48026007, 0x59325808,
-- 0x592c3c08, 0x841c3d58, 0x481e5c08, 0x0201f000,
-- 0x00020914, 0x59325808, 0x592c3c08, 0x841c3d58,
-- 0x59300007, 0x8c00051c, 0x040207f3, 0x481e5c08,
-- 0x42000000, 0x00000005, 0x40000000, 0x80000040,
-- 0x040207fe, 0x59300007, 0x8c00051c, 0x040207ea,
-- 0x59cc0a08, 0x592c0204, 0x82000500, 0x000000ff,
-- 0x82000580, 0x00000048, 0x0402000c, 0x497a580b,
-- 0x82040500, 0x000000ff, 0x04000008, 0x592c0407,
-- 0x800001c0, 0x04000005, 0x0201f800, 0x0010950b,
-- 0x0201f000, 0x00100ea1, 0x48065c09, 0x41782000,
-- 0x82040500, 0x00000c00, 0x04000002, 0x59cc2009,
-- 0x82043500, 0x00000fff, 0x04020027, 0x481e5c08,
-- 0x4a025a06, 0x00000000, 0x801831c0, 0x02000000,
-- 0x00100ea1, 0x41782000, 0x8c183510, 0x04000002,
-- 0x59cc200b, 0x4812580c, 0x41780000, 0x8c183512,
-- 0x04000002, 0x59cc000a, 0x4802580b, 0x80100c00,
-- 0x02001800, 0x00100615, 0x02000000, 0x00100ea1,
-- 0x82041480, 0x0000001d, 0x0402100c, 0x4c500000,
-- 0x4c540000, 0x83cca400, 0x0000000c, 0x832cac00,
-- 0x0000000d, 0x0401fb6e, 0x5c00a800, 0x5c00a000,
-- 0x0201f000, 0x00100ea1, 0x0401fb12, 0x0201f000,
-- 0x00100ea1, 0x412c7800, 0x0201f800, 0x0010082a,
-- 0x02000800, 0x00100615, 0x492c7809, 0x841c3d52,
-- 0x481c7c08, 0x4a025a04, 0x00000103, 0x4812580a,
-- 0x48065c09, 0x583c0404, 0x583c1005, 0x583c2208,
-- 0x48025c04, 0x480a5805, 0x48125a08, 0x0401f7c8,
-- 0x8c000524, 0x04000794, 0x59325808, 0x4c000000,
-- 0x592c0408, 0x8c00051c, 0x5c000000, 0x04020003,
-- 0x4a026011, 0xffffffff, 0x84000524, 0x0401f78a,
-- 0x1c01f000, 0x59a80039, 0x48026205, 0x59325808,
-- 0x4a026203, 0x00000002, 0x592c2408, 0x59300807,
-- 0x4933c857, 0x4807c857, 0x592c0204, 0x82000500,
-- 0x000000ff, 0x82000580, 0x00000048, 0x04020004,
-- 0x8c102500, 0x02020000, 0x00109553, 0x4a025a06,
-- 0x00000000, 0x8c040d1e, 0x04000027, 0x41780800,
-- 0x497a5c09, 0x592c1c09, 0x59300011, 0x59341200,
-- 0x497a6205, 0x8c08150e, 0x0402006e, 0x4807c857,
-- 0x4806580a, 0x80000d40, 0x04020f03, 0x59300402,
-- 0x48025c06, 0x48065807, 0x4a025a04, 0x00000103,
-- 0x4c040000, 0x4c0c0000, 0x4c100000, 0x0201f800,
-- 0x00109365, 0x5c002000, 0x5c001800, 0x5c000800,
-- 0x8c102512, 0x0402001a, 0x4c0c0000, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00104801, 0x5c001800,
-- 0x8c0c1d18, 0x02000000, 0x000208b4, 0x0201f000,
-- 0x00108f88, 0x4813c857, 0x8c102518, 0x0400004b,
-- 0x41780800, 0x592c1c09, 0x820c0580, 0x00001000,
-- 0x040007d6, 0x8c102512, 0x040007d4, 0x592c7809,
-- 0x583c080a, 0x583c1c09, 0x0401f7d0, 0x4807c857,
-- 0x592c7809, 0x59300402, 0x592c1404, 0x8c08151e,
-- 0x0402000d, 0x592c1206, 0x48007c06, 0x48047807,
-- 0x48087a06, 0x84102512, 0x48107c08, 0x4c0c0000,
-- 0x0201f800, 0x00100843, 0x403e5800, 0x0401fad1,
-- 0x0401f7d9, 0x48025c06, 0x48065807, 0x583c080c,
-- 0x583c000b, 0x80040c00, 0x82041480, 0x0000001d,
-- 0x04001006, 0x583c1001, 0x480a5801, 0x49787801,
-- 0x42000800, 0x0000001c, 0x82040c00, 0x00000014,
-- 0x4c0c0000, 0x4c500000, 0x4c540000, 0x823ca400,
-- 0x00000008, 0x832cac00, 0x00000008, 0x4c100000,
-- 0x4c3c0000, 0x0401fad2, 0x5c007800, 0x5c002000,
-- 0x5c00a800, 0x5c00a000, 0x84102512, 0x48125c08,
-- 0x403e5800, 0x0201f800, 0x00100843, 0x42034000,
-- 0x0010b2a0, 0x59a1d81e, 0x80edd9c0, 0x02000800,
-- 0x00100615, 0x48efc857, 0x58ec0009, 0x4803c857,
-- 0x0801f800, 0x0401f7ac, 0x4933c857, 0x1c01f000,
-- 0x59301414, 0x480bc857, 0x8c08151c, 0x0402000e,
-- 0x80000540, 0x4803c857, 0x0400078d, 0x80042c80,
-- 0x0402178b, 0x8c081514, 0x04020005, 0x592c080f,
-- 0x4807c857, 0x80040480, 0x48026016, 0x8408155c,
-- 0x480a6414, 0x59301007, 0x8408151e, 0x480a6007,
-- 0x4c100000, 0x4c3c0000, 0x4d400000, 0x592e8206,
-- 0x4a025a06, 0x00000001, 0x0201f800, 0x00109365,
-- 0x49425a06, 0x5c028000, 0x5c007800, 0x5c002000,
-- 0x497a5c09, 0x8c102512, 0x04000006, 0x4d2c0000,
-- 0x403e5800, 0x0201f800, 0x00100843, 0x5c025800,
-- 0x82102500, 0xffffedff, 0x48125c08, 0x0201f000,
-- 0x00108fc6, 0x59325808, 0x592c0408, 0x8c000518,
-- 0x04000004, 0x412df800, 0x0201f000, 0x00100eba,
-- 0x1c01f000, 0x4933c857, 0x59325808, 0x497a5c09,
-- 0x4a025a06, 0x00000000, 0x4a025a04, 0x00000103,
-- 0x59300811, 0x4807c857, 0x800409c0, 0x0402000a,
-- 0x48065807, 0x59300c02, 0x48065c06, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00104801, 0x0201f000,
-- 0x000208b4, 0x59340200, 0x8c00050e, 0x04020005,
-- 0x59300811, 0x0401fe4c, 0x48065807, 0x0401f7f2,
-- 0x592c0208, 0x8c00050e, 0x040207fa, 0x4933c857,
-- 0x0201f000, 0x00108fc6, 0x4933c857, 0x59325808,
-- 0x812e59c0, 0x02000800, 0x00100615, 0x592c020a,
-- 0x8c000502, 0x02000800, 0x00100615, 0x4a026206,
-- 0x00000002, 0x1c01f000, 0x5930001c, 0x800001c0,
-- 0x02020800, 0x0010961a, 0x59300007, 0x4933c857,
-- 0x4803c857, 0x8c00050e, 0x04000037, 0x8c000500,
-- 0x04000029, 0x8c00051c, 0x0400000a, 0x84000500,
-- 0x48026007, 0x59325808, 0x592c3c08, 0x481fc857,
-- 0x841c3d58, 0x481e5c08, 0x0201f000, 0x00020914,
-- 0x59325808, 0x592c3c08, 0x841c3d58, 0x59300007,
-- 0x8c00051c, 0x040207f2, 0x481e5c08, 0x42000000,
-- 0x00000005, 0x40000000, 0x80000040, 0x040207fe,
-- 0x59300007, 0x8c00051c, 0x040207e9, 0x592c0204,
-- 0x82000500, 0x000000ff, 0x82000580, 0x00000048,
-- 0x04020003, 0x497a580b, 0x0401f002, 0x497a5c09,
-- 0x481e5c08, 0x4a025a06, 0x00000000, 0x0201f000,
-- 0x00100ea1, 0x8c000524, 0x040007d9, 0x59325808,
-- 0x4c000000, 0x592c0408, 0x8c00051c, 0x5c000000,
-- 0x04020003, 0x4a026011, 0xffffffff, 0x84000524,
-- 0x0401f7cf, 0x1c01f000, 0x4933c857, 0x41780800,
-- 0x83380480, 0x00000058, 0x0402100b, 0x83380480,
-- 0x00000040, 0x04001008, 0x4d2c0000, 0x59325808,
-- 0x812e59c0, 0x0c020806, 0x5c025800, 0x0201f000,
-- 0x000208b4, 0x493bc857, 0x1c01f000, 0x00108763,
-- 0x00108763, 0x00108763, 0x00108763, 0x00108763,
-- 0x00108765, 0x00108763, 0x00108763, 0x00108763,
-- 0x00108763, 0x00108763, 0x00108763, 0x00108763,
-- 0x00108763, 0x00108763, 0x00108763, 0x00108763,
-- 0x00108763, 0x00108763, 0x00108763, 0x0010876a,
-- 0x00108763, 0x00108763, 0x00108763, 0x0201f800,
-- 0x00100615, 0x59cc0a08, 0x497a5807, 0x4807c857,
-- 0x82040d00, 0x00000fff, 0x59300402, 0x48025c06,
-- 0x4a025a04, 0x00000103, 0x48065c09, 0x4a025a06,
-- 0x00000000, 0x800409c0, 0x02000000, 0x00020381,
-- 0x59cc0009, 0x4802580a, 0x82042500, 0x00000100,
-- 0x04000002, 0x59cc200b, 0x4812580c, 0x82040500,
-- 0x00000200, 0x04000002, 0x59cc000a, 0x4802580b,
-- 0x80100c00, 0x02001800, 0x00100615, 0x02000000,
-- 0x00020381, 0x82041480, 0x0000001d, 0x04001006,
-- 0x592c0404, 0x8c00051e, 0x0400000e, 0x42000800,
-- 0x0000001c, 0x4c500000, 0x4c540000, 0x83cca400,
-- 0x0000000c, 0x832cac00, 0x0000000d, 0x0401f9c0,
-- 0x5c00a800, 0x5c00a000, 0x0201f000, 0x00020381,
-- 0x0401f964, 0x0401f19f, 0x83380480, 0x00000093,
-- 0x02021800, 0x00100615, 0x83380480, 0x00000085,
-- 0x02001800, 0x00100615, 0x0c01f001, 0x001087b2,
-- 0x001087b0, 0x001087b0, 0x001087b9, 0x001087b0,
-- 0x001087b0, 0x001087b0, 0x001087b0, 0x001087b0,
-- 0x001087b0, 0x001087b0, 0x001087b0, 0x001087b0,
-- 0x0201f800, 0x00100615, 0x4a026203, 0x00000001,
-- 0x493a6403, 0x42000800, 0x80000040, 0x0201f000,
-- 0x00020855, 0x4933c857, 0x59cc1404, 0x0201f800,
-- 0x001091d9, 0x0400001b, 0x591c0203, 0x82000580,
-- 0x00000000, 0x04000017, 0x591c0009, 0x81340580,
-- 0x04020014, 0x4d300000, 0x4d1c0000, 0x411e6000,
-- 0x0401f9c3, 0x5c023800, 0x5c026000, 0x0400000b,
-- 0x59cc0005, 0x8c000500, 0x04020003, 0x0401f98d,
-- 0x0401f003, 0x4a023a03, 0x00000002, 0x4a026403,
-- 0x00000086, 0x0401f005, 0x0401f9a7, 0x040007f5,
-- 0x4a026403, 0x00000087, 0x4a026203, 0x00000001,
-- 0x42000800, 0x80000040, 0x0201f800, 0x00020855,
-- 0x59340200, 0x8c00050e, 0x0400000d, 0x59cc1404,
-- 0x0201f800, 0x001091d9, 0x04000009, 0x591c0414,
-- 0x8c00051a, 0x04000006, 0x4d300000, 0x411e6000,
-- 0x0201f800, 0x00108fdb, 0x5c026000, 0x1c01f000,
-- 0x83380580, 0x00000013, 0x0402000b, 0x59300403,
-- 0x4803c857, 0x82000d80, 0x00000086, 0x04000012,
-- 0x82000d80, 0x00000087, 0x02020800, 0x00100615,
-- 0x0401f00d, 0x83380580, 0x00000027, 0x04000005,
-- 0x83380580, 0x00000014, 0x02020800, 0x00100615,
-- 0x493bc857, 0x0201f800, 0x001068f6, 0x0201f000,
-- 0x00107698, 0x4933c857, 0x0201f000, 0x00107698,
-- 0x83380580, 0x00000013, 0x04020005, 0x59300403,
-- 0x82000480, 0x00000085, 0x0c01f04d, 0x83380580,
-- 0x00000027, 0x04020041, 0x4933c857, 0x0201f800,
-- 0x001068f6, 0x4d3c0000, 0x417a7800, 0x0201f800,
-- 0x00101de2, 0x5c027800, 0x42003000, 0x00000015,
-- 0x41782800, 0x42002000, 0x00000003, 0x42028000,
-- 0x00000029, 0x4d400000, 0x4d440000, 0x59368c03,
-- 0x0201f800, 0x0010962a, 0x5c028800, 0x5c028000,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-- 0x0201f800, 0x00108df4, 0x0400000c, 0x4d2c0000,
-- 0x59325808, 0x4a025a04, 0x00000103, 0x59300402,
-- 0x48025c06, 0x497a5c09, 0x49425a06, 0x0201f800,
-- 0x00020381, 0x5c025800, 0x0201f800, 0x00108ee7,
-- 0x0201f000, 0x000208b4, 0x83380580, 0x00000089,
-- 0x04000005, 0x83380580, 0x0000008a, 0x02020000,
-- 0x001076fb, 0x0201f800, 0x00106cb4, 0x02020000,
-- 0x001076fb, 0x59300a03, 0x82040580, 0x0000000a,
-- 0x0400002a, 0x82040580, 0x0000000c, 0x04000027,
-- 0x0201f800, 0x00100615, 0x83380580, 0x00000014,
-- 0x040207ea, 0x4933c857, 0x0201f800, 0x001068f6,
-- 0x42028000, 0x00000006, 0x0401f7d2, 0x0010886e,
-- 0x0010886c, 0x0010886c, 0x0010886c, 0x0010886c,
-- 0x0010886c, 0x00108874, 0x0010886c, 0x0010886c,
-- 0x0010886c, 0x0010886c, 0x0010886c, 0x0010886c,
-- 0x0201f800, 0x00100615, 0x4933c857, 0x59a80037,
-- 0x48026206, 0x4a026203, 0x0000000a, 0x1c01f000,
-- 0x4933c857, 0x59a80037, 0x48026206, 0x4a026203,
-- 0x0000000c, 0x1c01f000, 0x83380580, 0x00000089,
-- 0x04000008, 0x83380580, 0x0000008a, 0x04000032,
-- 0x4933c857, 0x493bc857, 0x0201f000, 0x001076fb,
-- 0x4933c857, 0x59325808, 0x59300a1d, 0x82040580,
-- 0x00000003, 0x04020004, 0x0201f800, 0x00104801,
-- 0x0401f00c, 0x5930021d, 0x82000580, 0x00000001,
-- 0x04020008, 0x59300c16, 0x82040580, 0x00000039,
-- 0x0400002c, 0x82040580, 0x00000035, 0x04000029,
-- 0x4c5c0000, 0x4130b800, 0x0201f800, 0x00020892,
-- 0x04000010, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x0000001e, 0x59cc0c07, 0x48066419, 0x59cc0a07,
-- 0x48066219, 0x49366009, 0x4a026406, 0x00000001,
-- 0x42000800, 0x80000040, 0x0201f800, 0x00020855,
-- 0x405e6000, 0x0201f800, 0x000208b4, 0x5c00b800,
-- 0x1c01f000, 0x4933c857, 0x5930021d, 0x82000580,
-- 0x00000001, 0x04020040, 0x59300c16, 0x82040580,
-- 0x00000035, 0x04000007, 0x82040580, 0x0000001e,
-- 0x04000004, 0x82040580, 0x00000039, 0x04020036,
-- 0x4933c857, 0x4c500000, 0x4d1c0000, 0x4130a000,
-- 0x40067000, 0x0201f800, 0x00109183, 0x04020029,
-- 0x0201f800, 0x00020892, 0x04000026, 0x491fc857,
-- 0x4933c857, 0x83380580, 0x00000035, 0x04000004,
-- 0x83380580, 0x00000039, 0x04020002, 0x4932381c,
-- 0x493a6403, 0x4a026203, 0x00000001, 0x4a026406,
-- 0x00000001, 0x58500809, 0x4807c857, 0x48066009,
-- 0x58500c15, 0x4807c857, 0x48066415, 0x58500a15,
-- 0x4807c857, 0x48066215, 0x58500a16, 0x4807c857,
-- 0x48066216, 0x58500c19, 0x4807c857, 0x48066419,
-- 0x58500a19, 0x4807c857, 0x48066219, 0x491e601e,
-- 0x42000800, 0x80000040, 0x0201f800, 0x00020855,
-- 0x40526000, 0x5c023800, 0x5c00a000, 0x0201f000,
-- 0x000208b4, 0x5930021d, 0x82000580, 0x00000003,
-- 0x02000800, 0x00104801, 0x0201f000, 0x000208b4,
-- 0x4803c856, 0x4c500000, 0x4c540000, 0x412c7800,
-- 0x4c3c0000, 0x42002800, 0x00000001, 0x82040480,
-- 0x00000101, 0x04001003, 0x42000800, 0x00000100,
-- 0x40043000, 0x42000800, 0x0000001c, 0x83cca400,
-- 0x0000000c, 0x832cac00, 0x0000000d, 0x0401f844,
-- 0x82183480, 0x0000001c, 0x592e5801, 0x812e59c0,
-- 0x02020800, 0x00100843, 0x0201f800, 0x0010082a,
-- 0x04000017, 0x80142800, 0x4a025a04, 0x00000110,
-- 0x497a5c04, 0x492c7801, 0x82180c80, 0x0000003d,
-- 0x04021006, 0x40180800, 0x832cac00, 0x00000005,
-- 0x0401f82f, 0x0401f00a, 0x82183480, 0x0000003c,
-- 0x42000800, 0x0000003c, 0x412c7800, 0x832cac00,
-- 0x00000005, 0x0401f826, 0x0401f7e8, 0x5c007800,
-- 0x841429c0, 0x82142d40, 0x00000003, 0x48147a04,
-- 0x403e5800, 0x5c00a800, 0x5c00a000, 0x1c01f000,
-- 0x492fc857, 0x812e59c0, 0x0400000f, 0x4d2c0000,
-- 0x4c3c0000, 0x592c7801, 0x803c79c0, 0x04000006,
-- 0x497a5801, 0x0201f800, 0x00020381, 0x403e5800,
-- 0x0401f7f9, 0x5c007800, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x1c01f000, 0x4803c856, 0x4c580000,
-- 0x82040c00, 0x00000003, 0x8004b104, 0x0201f800,
-- 0x0010a93e, 0x5c00b000, 0x1c01f000, 0x4803c856,
-+ 0x497a5809, 0x49425a06, 0x0201f800, 0x000202e9,
-+ 0x5c025800, 0x0201f800, 0x00108942, 0x0201f000,
-+ 0x000207bb, 0x83380580, 0x00000089, 0x04000005,
-+ 0x83380580, 0x0000008a, 0x02020000, 0x0010720c,
-+ 0x0201f800, 0x001067a7, 0x02020000, 0x0010720c,
-+ 0x59300a03, 0x82040580, 0x0000000a, 0x0400002a,
-+ 0x82040580, 0x0000000c, 0x04000027, 0x0201f800,
-+ 0x001004ef, 0x83380580, 0x00000014, 0x040207ea,
-+ 0x4933c857, 0x0201f800, 0x001063c4, 0x42028000,
-+ 0x00000006, 0x0401f7d2, 0x001082b5, 0x001082b3,
-+ 0x001082b3, 0x001082b3, 0x001082b3, 0x001082b3,
-+ 0x001082bb, 0x001082b3, 0x001082b3, 0x001082b3,
-+ 0x001082b3, 0x001082b3, 0x001082b3, 0x0201f800,
-+ 0x001004ef, 0x4933c857, 0x59a80034, 0x48026206,
-+ 0x4a026203, 0x0000000a, 0x1c01f000, 0x4933c857,
-+ 0x59a80034, 0x48026206, 0x4a026203, 0x0000000c,
-+ 0x1c01f000, 0x83380580, 0x00000089, 0x04000008,
-+ 0x83380580, 0x0000008a, 0x04000032, 0x4933c857,
-+ 0x493bc857, 0x0201f000, 0x0010720c, 0x4933c857,
-+ 0x59325808, 0x59300a1d, 0x82040580, 0x00000003,
-+ 0x04020004, 0x0201f800, 0x001046db, 0x0401f00c,
-+ 0x5930021d, 0x82000580, 0x00000001, 0x04020008,
-+ 0x59300c16, 0x82040580, 0x00000039, 0x0400002c,
-+ 0x82040580, 0x00000035, 0x04000029, 0x4c5c0000,
-+ 0x4130b800, 0x0201f800, 0x00020799, 0x04000010,
-+ 0x4a026203, 0x00000001, 0x4a026403, 0x0000001e,
-+ 0x59cc0c07, 0x48066419, 0x59cc0a07, 0x48066219,
-+ 0x49366009, 0x4a026406, 0x00000001, 0x42000800,
-+ 0x80000040, 0x0201f800, 0x0002075c, 0x405e6000,
-+ 0x0201f800, 0x000207bb, 0x5c00b800, 0x1c01f000,
-+ 0x4933c857, 0x5930021d, 0x82000580, 0x00000001,
-+ 0x04020042, 0x59300c16, 0x82040580, 0x00000035,
-+ 0x04000007, 0x82040580, 0x0000001e, 0x04000004,
-+ 0x82040580, 0x00000039, 0x04020038, 0x4933c857,
-+ 0x4c5c0000, 0x4c600000, 0x4d1c0000, 0x4130b800,
-+ 0x4004c000, 0x0201f800, 0x00108bff, 0x04020029,
-+ 0x0201f800, 0x00020799, 0x04000026, 0x491fc857,
-+ 0x4933c857, 0x82600580, 0x00000035, 0x04000004,
-+ 0x82600580, 0x00000039, 0x04020002, 0x4932381c,
-+ 0x48626403, 0x4a026203, 0x00000001, 0x4a026406,
-+ 0x00000001, 0x585c0809, 0x4807c857, 0x48066009,
-+ 0x585c0c15, 0x4807c857, 0x48066415, 0x585c0a15,
-+ 0x4807c857, 0x48066215, 0x585c0a16, 0x4807c857,
-+ 0x48066216, 0x585c0c19, 0x4807c857, 0x48066419,
-+ 0x585c0a19, 0x4807c857, 0x48066219, 0x491e601e,
-+ 0x42000800, 0x80000040, 0x0201f800, 0x0002075c,
-+ 0x405e6000, 0x5c023800, 0x5c00c000, 0x5c00b800,
-+ 0x0201f000, 0x000207bb, 0x5930021d, 0x82000580,
-+ 0x00000003, 0x02000800, 0x001046db, 0x0201f000,
-+ 0x000207bb, 0x4803c856, 0x4c500000, 0x4c540000,
-+ 0x412c7800, 0x4c3c0000, 0x42002800, 0x00000001,
-+ 0x82040480, 0x00000101, 0x04001003, 0x42000800,
-+ 0x00000100, 0x40043000, 0x42000800, 0x0000001c,
-+ 0x83cca400, 0x0000000c, 0x832cac00, 0x0000000d,
-+ 0x0401f844, 0x82183480, 0x0000001c, 0x592e5801,
-+ 0x812e59c0, 0x02020800, 0x0010073b, 0x0201f800,
-+ 0x0010071a, 0x04000017, 0x80142800, 0x4a025a04,
-+ 0x00000110, 0x497a5c04, 0x492c7801, 0x82180c80,
-+ 0x0000003d, 0x04021006, 0x40180800, 0x832cac00,
-+ 0x00000005, 0x0401f82f, 0x0401f00a, 0x82183480,
-+ 0x0000003c, 0x42000800, 0x0000003c, 0x412c7800,
-+ 0x832cac00, 0x00000005, 0x0401f826, 0x0401f7e8,
-+ 0x5c007800, 0x841429c0, 0x82142d40, 0x00000003,
-+ 0x48147a04, 0x403e5800, 0x5c00a800, 0x5c00a000,
-+ 0x1c01f000, 0x492fc857, 0x812e59c0, 0x0400000f,
-+ 0x4d2c0000, 0x4c3c0000, 0x592c7801, 0x803c79c0,
-+ 0x04000006, 0x497a5801, 0x0201f800, 0x000202e9,
-+ 0x403e5800, 0x0401f7f9, 0x5c007800, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x1c01f000, 0x4803c856,
- 0x4c580000, 0x82040c00, 0x00000003, 0x8004b104,
-- 0x0201f800, 0x0010a93e, 0x5c00b000, 0x1c01f000,
-- 0x591c0c06, 0x82040580, 0x00000003, 0x04000004,
-- 0x82040580, 0x00000002, 0x0402001a, 0x4d300000,
-- 0x4d2c0000, 0x411e6000, 0x59325808, 0x0201f800,
-- 0x00108df4, 0x0400000f, 0x4d400000, 0x42028000,
-- 0x00000013, 0x592c0a08, 0x84040d54, 0x0201f800,
-- 0x00104bee, 0x5c028000, 0x0201f800, 0x00109365,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00108ee7,
-- 0x0201f800, 0x00107698, 0x5c025800, 0x5c026000,
-- 0x1c01f000, 0x59cc0005, 0x8c000500, 0x0402000b,
-- 0x591c0406, 0x82000580, 0x00000002, 0x04020007,
-- 0x591c0c03, 0x82040580, 0x00000085, 0x04000003,
-- 0x82040580, 0x0000008b, 0x1c01f000, 0x4933c857,
-- 0x4d3c0000, 0x42027800, 0x00000002, 0x59300406,
-- 0x82000c80, 0x00000012, 0x02021800, 0x00100615,
-- 0x0c01f80a, 0x5c027800, 0x1c01f000, 0x4933c857,
-+ 0x0201f800, 0x0010a330, 0x5c00b000, 0x1c01f000,
-+ 0x4803c856, 0x4c580000, 0x82040c00, 0x00000003,
-+ 0x8004b104, 0x0201f800, 0x0010a330, 0x5c00b000,
-+ 0x1c01f000, 0x591c0c06, 0x82040580, 0x00000003,
-+ 0x04000004, 0x82040580, 0x00000002, 0x0402001a,
-+ 0x4d300000, 0x4d2c0000, 0x411e6000, 0x59325808,
-+ 0x0201f800, 0x0010883d, 0x0400000f, 0x4d400000,
-+ 0x42028000, 0x00000013, 0x592c0a08, 0x84040d54,
-+ 0x0201f800, 0x00104a8e, 0x5c028000, 0x0201f800,
-+ 0x00108def, 0x0201f800, 0x000202e9, 0x0201f800,
-+ 0x00108942, 0x0201f800, 0x0010719c, 0x5c025800,
-+ 0x5c026000, 0x1c01f000, 0x59cc0005, 0x8c000500,
-+ 0x0402000b, 0x591c0406, 0x82000580, 0x00000002,
-+ 0x04020007, 0x591c0c03, 0x82040580, 0x00000085,
-+ 0x04000003, 0x82040580, 0x0000008b, 0x1c01f000,
-+ 0x4933c857, 0x4d3c0000, 0x42027800, 0x00000002,
- 0x59300406, 0x82000c80, 0x00000012, 0x02021800,
-- 0x00100615, 0x0c01f001, 0x001089b5, 0x001089b2,
-- 0x001089b2, 0x001089dd, 0x001089b0, 0x001089b2,
-- 0x001089ce, 0x001089b2, 0x001089b0, 0x0010632c,
-- 0x001089b2, 0x001089b2, 0x001089b2, 0x001089b0,
-- 0x001089b0, 0x001089b0, 0x00108aad, 0x001089b2,
-- 0x0201f800, 0x00100615, 0x4803c856, 0x80000580,
-- 0x1c01f000, 0x4803c856, 0x8d3e7d02, 0x04020016,
-- 0x0201f800, 0x00108df4, 0x0400000f, 0x59325808,
-- 0x41780800, 0x4d400000, 0x42028000, 0x00000005,
-- 0x0201f800, 0x00104bee, 0x5c028000, 0x0201f800,
-- 0x00109365, 0x0201f800, 0x00108f83, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00107698, 0x82000540,
-- 0x00000001, 0x1c01f000, 0x4933c857, 0x0201f800,
-- 0x00104728, 0x0402000c, 0x4d400000, 0x42028000,
-- 0x00000010, 0x0201f800, 0x00109fc0, 0x4a026406,
-- 0x00000006, 0x4a026203, 0x00000007, 0x5c028000,
-- 0x1c01f000, 0x4933c857, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x0401f8b8, 0x82000c80, 0x0000000e,
-- 0x02021800, 0x00100615, 0x0c01f001, 0x001089f7,
-- 0x00108a64, 0x00108a0e, 0x00108a77, 0x00108a5f,
-- 0x001089f5, 0x001089f7, 0x001089f7, 0x001089fb,
-- 0x001089f7, 0x001089f7, 0x001089f7, 0x001089f7,
-- 0x00108a0e, 0x0201f800, 0x00100615, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x0401f7b8, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x59300406, 0x82000580,
-- 0x00000003, 0x040207b4, 0x59300203, 0x82000580,
-- 0x0000000d, 0x040007b0, 0x8d3e7d02, 0x040207ae,
-- 0x4d340000, 0x59326809, 0x0201f800, 0x00104801,
-- 0x5c026800, 0x0401f7a8, 0x59300004, 0x8400055c,
-- 0x48026004, 0x0201f800, 0x00106982, 0x59300406,
-- 0x82000580, 0x00000006, 0x04000043, 0x8d3e7d02,
-- 0x04020041, 0x497a621d, 0x59300203, 0x82000580,
-- 0x0000000d, 0x04000003, 0x4a02621d, 0x00000003,
-- 0x0401fbd4, 0x04000024, 0x4d2c0000, 0x4d400000,
-- 0x59325808, 0x0201f800, 0x00108f83, 0x592c0408,
-- 0x8c000512, 0x04000009, 0x4d2c0000, 0x84000512,
-- 0x48025c08, 0x592c0809, 0x40065800, 0x0201f800,
-- 0x00100843, 0x5c025800, 0x4d400000, 0x42028000,
-- 0x00000005, 0x592c0a08, 0x8c040d0e, 0x04000004,
-- 0x42028000, 0x00000002, 0x0401f001, 0x0201f800,
-- 0x00104bee, 0x5c028000, 0x0201f800, 0x00109365,
-- 0x0201f800, 0x00020381, 0x497a6008, 0x5c028000,
-- 0x5c025800, 0x8d3e7d00, 0x04000009, 0x4d340000,
-- 0x59326809, 0x0201f800, 0x00104801, 0x5c026800,
-- 0x0201f800, 0x00107698, 0x0401f00b, 0x4a026403,
-- 0x00000085, 0x4a026203, 0x00000009, 0x4a026406,
-- 0x00000002, 0x42000800, 0x8000404b, 0x0201f800,
-- 0x00020855, 0x5c03e000, 0x02020800, 0x0010698c,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x0201f800,
-- 0x00106982, 0x0201f800, 0x00100ee4, 0x0401f7ab,
-- 0x598c000d, 0x81300580, 0x04020004, 0x0201f800,
-- 0x00106be2, 0x0402001b, 0x0201f800, 0x00106619,
-- 0x04020006, 0x59300c03, 0x82040580, 0x00000040,
-- 0x0400078b, 0x0401f79d, 0x0201f800, 0x001068a3,
-- 0x04000010, 0x0201f800, 0x00100615, 0x0401f813,
-- 0x04020004, 0x0201f800, 0x00106bb2, 0x04020009,
-- 0x0201f800, 0x001064f6, 0x040207f4, 0x59300c03,
-- 0x82040580, 0x00000040, 0x04000779, 0x0401f78b,
-+ 0x001004ef, 0x0c01f80a, 0x5c027800, 0x1c01f000,
-+ 0x4933c857, 0x59300406, 0x82000c80, 0x00000012,
-+ 0x02021800, 0x001004ef, 0x0c01f001, 0x001083fe,
-+ 0x001083fb, 0x001083fb, 0x00108426, 0x001083f9,
-+ 0x001083fb, 0x00108417, 0x001083fb, 0x001083f9,
-+ 0x001061ee, 0x001083fb, 0x001083fb, 0x001083fb,
-+ 0x001083f9, 0x001083f9, 0x001083f9, 0x001084f8,
-+ 0x001083fb, 0x0201f800, 0x001004ef, 0x4803c856,
-+ 0x80000580, 0x1c01f000, 0x4803c856, 0x8d3e7d02,
-+ 0x04020016, 0x0201f800, 0x0010883d, 0x0400000f,
-+ 0x59325808, 0x41780800, 0x4d400000, 0x42028000,
-+ 0x00000005, 0x0201f800, 0x00104a8e, 0x5c028000,
-+ 0x0201f800, 0x00108def, 0x0201f800, 0x001089eb,
-+ 0x0201f800, 0x000202e9, 0x0201f800, 0x0010719c,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x4933c857,
-+ 0x0201f800, 0x001045f8, 0x0402000c, 0x4d400000,
-+ 0x42028000, 0x00000010, 0x0201f800, 0x00109a5d,
-+ 0x4a026406, 0x00000006, 0x4a026203, 0x00000007,
-+ 0x5c028000, 0x1c01f000, 0x4933c857, 0x0201f800,
-+ 0x00106476, 0x4df00000, 0x0401f8ba, 0x82000c80,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x0c01f001,
-+ 0x00108440, 0x001084ad, 0x00108457, 0x001084c1,
-+ 0x001084a8, 0x0010843e, 0x00108440, 0x00108440,
-+ 0x00108444, 0x00108440, 0x00108440, 0x00108440,
-+ 0x00108440, 0x00108457, 0x0201f800, 0x001004ef,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x0401f7b8,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x59300406,
-+ 0x82000580, 0x00000003, 0x040207b4, 0x59300203,
-+ 0x82000580, 0x0000000d, 0x040007b0, 0x8d3e7d02,
-+ 0x040207ae, 0x4d340000, 0x59326809, 0x0201f800,
-+ 0x001046db, 0x5c026800, 0x0401f7a8, 0x59300004,
-+ 0x8400055c, 0x48026004, 0x0201f800, 0x00106463,
-+ 0x59300406, 0x82000580, 0x00000006, 0x04000043,
-+ 0x8d3e7d02, 0x04020041, 0x497a621d, 0x59300203,
-+ 0x82000580, 0x0000000d, 0x04000003, 0x4a02621d,
-+ 0x00000003, 0x0401fbd4, 0x04000024, 0x4d2c0000,
-+ 0x4d400000, 0x59325808, 0x0201f800, 0x001089eb,
-+ 0x592c0408, 0x8c000512, 0x04000009, 0x4d2c0000,
-+ 0x84000512, 0x48025c08, 0x592c0809, 0x40065800,
-+ 0x0201f800, 0x0010073b, 0x5c025800, 0x4d400000,
-+ 0x42028000, 0x00000005, 0x592c0a08, 0x8c040d0e,
-+ 0x04000004, 0x42028000, 0x00000002, 0x0401f001,
-+ 0x0201f800, 0x00104a8e, 0x5c028000, 0x0201f800,
-+ 0x00108def, 0x0201f800, 0x000202e9, 0x497a6008,
-+ 0x5c028000, 0x5c025800, 0x8d3e7d00, 0x04000009,
-+ 0x4d340000, 0x59326809, 0x0201f800, 0x001046db,
-+ 0x5c026800, 0x0201f800, 0x0010719c, 0x0401f00b,
-+ 0x4a026403, 0x00000085, 0x4a026203, 0x00000009,
-+ 0x4a026406, 0x00000002, 0x42000800, 0x8000404b,
-+ 0x0201f800, 0x0002075c, 0x5c03e000, 0x02020800,
-+ 0x00106476, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x0201f800, 0x00106463, 0x0201f800, 0x00100ddd,
-+ 0x0401f7ab, 0x598c000d, 0x81300580, 0x04020004,
-+ 0x0201f800, 0x001066d5, 0x0402001d, 0x0201f800,
-+ 0x0010ccce, 0x80c40040, 0x04020006, 0x59300c03,
-+ 0x82040580, 0x00000040, 0x0400078a, 0x0401f79c,
-+ 0x0201f800, 0x00106379, 0x04000011, 0x0201f800,
-+ 0x001004ef, 0x0401f814, 0x04020004, 0x0201f800,
-+ 0x001066a5, 0x0402000a, 0x0201f800, 0x0010cb83,
-+ 0x80c40040, 0x040207f3, 0x59300c03, 0x82040580,
-+ 0x00000040, 0x04000777, 0x0401f789, 0x59300203,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f75c, 0x417a3000, 0x42032000, 0x0000bf32,
-+ 0x59900004, 0x81300580, 0x04000009, 0x83932400,
-+ 0x00000010, 0x811a3000, 0x83180480, 0x00000005,
-+ 0x040017f8, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x59300004, 0x8c00053e, 0x04000010, 0x8c00050c,
-+ 0x0402000e, 0x8c000516, 0x04020006, 0x82000d00,
-+ 0x0000001f, 0x82040580, 0x00000005, 0x04020004,
-+ 0x42000000, 0x00000003, 0x0401f005, 0x42000000,
-+ 0x00000001, 0x0401f002, 0x59300203, 0x1c01f000,
-+ 0x4933c857, 0x0201f800, 0x00106476, 0x4df00000,
- 0x59300203, 0x82000c80, 0x0000000e, 0x02021800,
-- 0x00100615, 0x0c01f75e, 0x417a3000, 0x42032000,
-- 0x0000bf32, 0x59900004, 0x81300580, 0x04000009,
-- 0x83932400, 0x00000010, 0x811a3000, 0x83180480,
-- 0x00000005, 0x040017f8, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x59300004, 0x8c00053e, 0x04000010,
-- 0x8c00050c, 0x0402000e, 0x8c000516, 0x04020006,
-- 0x82000d00, 0x0000001f, 0x82040580, 0x00000005,
-- 0x04020004, 0x42000000, 0x00000003, 0x0401f005,
-- 0x42000000, 0x00000001, 0x0401f002, 0x59300203,
-- 0x1c01f000, 0x4933c857, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x59300203, 0x82000c80, 0x0000000e,
-- 0x02021800, 0x00100615, 0x0c01f001, 0x00108ac7,
-- 0x00108ae4, 0x00108acb, 0x00108ac5, 0x00108ac5,
-- 0x00108ac5, 0x00108ac5, 0x00108ac5, 0x00108ac5,
-- 0x00108ac5, 0x00108ac5, 0x00108ac5, 0x00108ac5,
-- 0x00108ac5, 0x0201f800, 0x00100615, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x0401f6e8, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x4d2c0000, 0x59325808,
-- 0x59300403, 0x82000580, 0x00000052, 0x02000800,
-- 0x00101281, 0x0401fb1f, 0x02000800, 0x00100615,
-- 0x4a025a06, 0x00000005, 0x0201f800, 0x00020381,
-- 0x0201f800, 0x00104a83, 0x0201f800, 0x00107698,
-- 0x5c025800, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x598c000d, 0x81300580, 0x0402001a, 0x59300004,
-- 0x8c000520, 0x04000004, 0x84000520, 0x48026004,
-- 0x0401f01a, 0x42001000, 0x0010b5f4, 0x50081000,
-- 0x58080002, 0x82000580, 0x00000100, 0x0400000a,
-- 0x5808000c, 0x81300580, 0x02020800, 0x00100615,
-- 0x0201f800, 0x00106619, 0x02020800, 0x00100615,
-- 0x0401f7cf, 0x0201f800, 0x00106be2, 0x0402000c,
-+ 0x001004ef, 0x0c01f001, 0x00108512, 0x0010852f,
-+ 0x00108516, 0x00108510, 0x00108510, 0x00108510,
-+ 0x00108510, 0x00108510, 0x00108510, 0x00108510,
-+ 0x00108510, 0x00108510, 0x00108510, 0x00108510,
-+ 0x0201f800, 0x001004ef, 0x5c03e000, 0x02000800,
-+ 0x00106463, 0x0401f6e6, 0x5c03e000, 0x02000800,
-+ 0x00106463, 0x4d2c0000, 0x59325808, 0x59300403,
-+ 0x82000580, 0x00000052, 0x02000800, 0x0010114d,
-+ 0x0401fb1d, 0x02000800, 0x001004ef, 0x4a025a06,
-+ 0x00000005, 0x0201f800, 0x000202e9, 0x0201f800,
-+ 0x00104975, 0x0201f800, 0x0010719c, 0x5c025800,
-+ 0x82000540, 0x00000001, 0x1c01f000, 0x598c000d,
-+ 0x81300580, 0x0402001b, 0x59300004, 0x8c000520,
-+ 0x04000004, 0x84000520, 0x48026004, 0x0401f01b,
-+ 0x42001000, 0x0010afc4, 0x50081000, 0x58080002,
-+ 0x82000580, 0x00000100, 0x0400000b, 0x5808000c,
-+ 0x81300580, 0x02020800, 0x001004ef, 0x0201f800,
-+ 0x0010ccce, 0x80c40040, 0x02020800, 0x001004ef,
-+ 0x0401f7ce, 0x0201f800, 0x001066d5, 0x0402000d,
- 0x59300004, 0x8c000520, 0x04000004, 0x84000520,
-- 0x48026004, 0x0401f7c6, 0x0201f800, 0x00106619,
-- 0x040007c3, 0x0201f800, 0x00100615, 0x59300203,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f7a7, 0x59300406, 0x4933c857, 0x4803c857,
-- 0x82000c80, 0x00000012, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x00108b30, 0x00108bfe, 0x00108d36,
-- 0x00108b3c, 0x00107698, 0x00108b30, 0x00109faf,
-- 0x000208b4, 0x00108bfe, 0x00106306, 0x00108d97,
-- 0x00108b2b, 0x00108b2b, 0x00108b2b, 0x00108b2b,
-- 0x00108b2b, 0x001094b7, 0x001094b7, 0x0201f800,
-- 0x00100615, 0x0401fbd8, 0x02000000, 0x00107da6,
-- 0x1c01f000, 0x0201f800, 0x0010698c, 0x0201f800,
-- 0x001068f6, 0x0201f800, 0x00106982, 0x0201f000,
-- 0x000208b4, 0x4a026206, 0x00000001, 0x1c01f000,
-- 0x42000000, 0x0010b671, 0x0201f800, 0x0010a86e,
-- 0x4d2c0000, 0x4d400000, 0x417a5800, 0x0401fab1,
-- 0x04000007, 0x59325808, 0x592c0208, 0x8400054c,
-- 0x48025a08, 0x42028000, 0x00000006, 0x0201f800,
-- 0x0010698c, 0x0401ff4c, 0x4803c857, 0x82000c80,
-- 0x0000000e, 0x02021800, 0x00100615, 0x0c01f806,
-- 0x0201f800, 0x00106982, 0x5c028000, 0x5c025800,
-- 0x1c01f000, 0x00108bfd, 0x00108b69, 0x00108b79,
-- 0x00108ba0, 0x00108bce, 0x00108b67, 0x00108b30,
-- 0x00108b30, 0x00108b30, 0x00108b67, 0x00108b67,
-- 0x00108b67, 0x00108b67, 0x00108b79, 0x0201f800,
-- 0x00100615, 0x598c000d, 0x4803c857, 0x81300580,
-- 0x04020004, 0x0201f800, 0x00106be2, 0x0402003f,
-- 0x0201f800, 0x00106619, 0x04000043, 0x4803c856,
-- 0x0201f800, 0x001068a3, 0x04000038, 0x0201f800,
-- 0x00100615, 0x497a621d, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x592c0204, 0x4803c857, 0x82000500,
-- 0x000000ff, 0x82000580, 0x00000014, 0x04000003,
-- 0x4a02621d, 0x00000003, 0x592c0a08, 0x0201f800,
-- 0x00104bee, 0x0201f800, 0x00109365, 0x0201f800,
-- 0x00020381, 0x497a6008, 0x4a026403, 0x00000085,
-- 0x4a026203, 0x00000009, 0x4a026406, 0x00000002,
-- 0x59300804, 0x82040d00, 0x00000100, 0x82040d40,
-- 0x8000404b, 0x48066004, 0x0201f800, 0x00106982,
-- 0x42000800, 0x8000404b, 0x0201f000, 0x00020855,
-- 0x0401feea, 0x04020004, 0x0201f800, 0x00106bb2,
-- 0x0402000a, 0x0201f800, 0x001064f6, 0x040207cc,
-- 0x59300c03, 0x4807c857, 0x82040580, 0x00000040,
-- 0x04000009, 0x0401f7cc, 0x59300203, 0x4803c857,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f7a5, 0x0201f800, 0x00106982, 0x812e59c0,
-- 0x04000013, 0x592c0a08, 0x0201f800, 0x00104bee,
-- 0x0201f800, 0x00109365, 0x0201f800, 0x00020381,
-- 0x59300203, 0x82000580, 0x0000000d, 0x04000008,
-- 0x0201f800, 0x00106982, 0x4d340000, 0x59326809,
-- 0x0201f800, 0x00104801, 0x5c026800, 0x0201f800,
-- 0x00107698, 0x0401f030, 0x812e59c0, 0x02000800,
-- 0x00100615, 0x0201f800, 0x001091d3, 0x04020004,
-- 0x0201f800, 0x00100ee4, 0x0401f7a3, 0x0201f800,
-- 0x00106982, 0x592c0208, 0x8400050c, 0x48025a08,
-- 0x592c0406, 0x800000c2, 0x800008c4, 0x80040c00,
-- 0x48066206, 0x42000000, 0x10000000, 0x41300800,
-- 0x0201f800, 0x00100bde, 0x0400000d, 0x592c0208,
-- 0x8c00051c, 0x04020006, 0x8400055c, 0x48025a08,
-- 0x4a026206, 0x00000002, 0x0401f00f, 0x4d300000,
-- 0x0201f800, 0x00101335, 0x5c026000, 0x59300203,
-- 0x82000580, 0x00000004, 0x04020007, 0x4d380000,
-- 0x42027000, 0x00000048, 0x0201f800, 0x000208d8,
-- 0x5c027000, 0x1c01f000, 0x42000000, 0x0010b66d,
-- 0x0201f800, 0x0010a86e, 0x59300203, 0x82000c80,
-- 0x0000000e, 0x02021800, 0x00100615, 0x4803c857,
-- 0x0c01f001, 0x00108c17, 0x00108b39, 0x00108c19,
-- 0x00108c17, 0x00108c19, 0x00108c19, 0x00108b31,
-- 0x00108c17, 0x00108b2d, 0x00108c17, 0x00108c17,
-- 0x00108c17, 0x00108c17, 0x00108c17, 0x0201f800,
-- 0x00100615, 0x4d340000, 0x4d2c0000, 0x59326809,
-- 0x59340400, 0x82000500, 0x000000ff, 0x82000c80,
-- 0x0000000c, 0x02021800, 0x00100615, 0x59303403,
-- 0x82180d80, 0x00000004, 0x04020004, 0x42000000,
-- 0x00000001, 0x0401f006, 0x82180d80, 0x00000000,
-- 0x04020003, 0x42000000, 0x00000001, 0x4803c857,
-- 0x0c01f804, 0x5c025800, 0x5c026800, 0x1c01f000,
-- 0x00108c40, 0x00108cdf, 0x00108c42, 0x00108c77,
-- 0x00108c42, 0x00108cfc, 0x00108c42, 0x00108c4c,
-- 0x00108c40, 0x00108cfc, 0x00108c40, 0x00108c5b,
-- 0x0201f800, 0x00100615, 0x59300403, 0x82000d80,
-- 0x00000016, 0x0400002e, 0x82000d80, 0x00000004,
-- 0x0400002b, 0x82000d80, 0x00000002, 0x04000028,
-- 0x0401fab9, 0x04000079, 0x59300403, 0x82000d80,
-- 0x00000022, 0x040000ae, 0x82000d80, 0x00000039,
-- 0x040000b3, 0x82000d80, 0x00000035, 0x040000b0,
-- 0x82000d80, 0x0000001e, 0x0400001b, 0x0401f999,
-- 0x04000007, 0x0201f800, 0x00109360, 0x04020004,
-- 0x0201f800, 0x00104863, 0x0401f011, 0x59300403,
-- 0x82000d80, 0x00000001, 0x04020004, 0x0201f800,
-- 0x00104836, 0x0400000a, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x00101de2, 0x5c027800, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x00107da6, 0x0201f000, 0x00107698, 0x0401f97d,
-- 0x04000004, 0x0201f800, 0x00109360, 0x040000a9,
-- 0x59300c03, 0x82040580, 0x00000016, 0x04000056,
-- 0x82040580, 0x00000002, 0x04020034, 0x59a80026,
-- 0x8c000502, 0x04020013, 0x0201f800, 0x00104e0d,
-- 0x04020010, 0x0201f800, 0x00104e23, 0x04020006,
-- 0x42000000, 0x00000001, 0x0201f800, 0x00104de5,
-- 0x0401f094, 0x4a035033, 0x00000001, 0x4202d800,
-- 0x00000001, 0x0201f800, 0x00104d76, 0x0401f08d,
-- 0x59340403, 0x82000580, 0x000007fc, 0x04000008,
-- 0x59a80026, 0x8c00050a, 0x04020084, 0x59340212,
-- 0x82000500, 0x0000ff00, 0x04000082, 0x59340412,
-+ 0x48026004, 0x0401f7c5, 0x0201f800, 0x0010ccce,
-+ 0x80c40040, 0x040007c1, 0x0201f800, 0x001004ef,
-+ 0x59300203, 0x82000c80, 0x0000000e, 0x02021800,
-+ 0x001004ef, 0x0c01f7a5, 0x59300406, 0x4933c857,
-+ 0x4803c857, 0x82000c80, 0x00000012, 0x02021800,
-+ 0x001004ef, 0x0c01f001, 0x0010857d, 0x0010864d,
-+ 0x00108776, 0x00108589, 0x0010719c, 0x0010857d,
-+ 0x00109a4d, 0x000207bb, 0x0010864d, 0x001061cb,
-+ 0x001087d6, 0x00108578, 0x00108578, 0x00108578,
-+ 0x00108578, 0x00108578, 0x00108f3e, 0x00108f3e,
-+ 0x0201f800, 0x001004ef, 0x0401fbef, 0x02000000,
-+ 0x001078c2, 0x1c01f000, 0x0201f800, 0x00106476,
-+ 0x0201f800, 0x001063c4, 0x0201f800, 0x00106463,
-+ 0x0201f000, 0x000207bb, 0x4a026206, 0x00000001,
-+ 0x1c01f000, 0x42000000, 0x0010b041, 0x0201f800,
-+ 0x0010a260, 0x4d2c0000, 0x4d400000, 0x417a5800,
-+ 0x0401faad, 0x04000007, 0x59325808, 0x592c0208,
-+ 0x8400054c, 0x48025a08, 0x42028000, 0x00000006,
-+ 0x0201f800, 0x00106476, 0x0401ff4a, 0x4803c857,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f806, 0x0201f800, 0x00106463, 0x5c028000,
-+ 0x5c025800, 0x1c01f000, 0x0010864c, 0x001085b6,
-+ 0x001085c7, 0x001085ee, 0x0010861d, 0x001085b4,
-+ 0x0010857d, 0x0010857d, 0x0010857d, 0x001085b4,
-+ 0x001085b4, 0x001085b4, 0x001085b4, 0x001085c7,
-+ 0x0201f800, 0x001004ef, 0x598c000d, 0x4803c857,
-+ 0x81300580, 0x04020004, 0x0201f800, 0x001066d5,
-+ 0x04020041, 0x0201f800, 0x0010ccce, 0x80c40040,
-+ 0x04000044, 0x4803c856, 0x0201f800, 0x00106379,
-+ 0x04000039, 0x0201f800, 0x001004ef, 0x497a621d,
-+ 0x812e59c0, 0x02000800, 0x001004ef, 0x592c0204,
-+ 0x4803c857, 0x82000500, 0x000000ff, 0x82000580,
-+ 0x00000014, 0x04000003, 0x4a02621d, 0x00000003,
-+ 0x592c0a08, 0x0201f800, 0x00104a8e, 0x0201f800,
-+ 0x00108def, 0x0201f800, 0x000202e9, 0x497a6008,
-+ 0x4a026403, 0x00000085, 0x4a026203, 0x00000009,
-+ 0x4a026406, 0x00000002, 0x59300804, 0x82040d00,
-+ 0x00000100, 0x82040d40, 0x8000404b, 0x48066004,
-+ 0x0201f800, 0x00106463, 0x42000800, 0x8000404b,
-+ 0x0201f000, 0x0002075c, 0x0401fee7, 0x04020004,
-+ 0x0201f800, 0x001066a5, 0x0402000b, 0x0201f800,
-+ 0x0010cb83, 0x80c40040, 0x040207cb, 0x59300c03,
-+ 0x4807c857, 0x82040580, 0x00000040, 0x04000009,
-+ 0x0401f7cb, 0x59300203, 0x4803c857, 0x82000c80,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x0c01f7a3,
-+ 0x0201f800, 0x00106463, 0x812e59c0, 0x04000013,
-+ 0x592c0a08, 0x0201f800, 0x00104a8e, 0x0201f800,
-+ 0x00108def, 0x0201f800, 0x000202e9, 0x59300203,
-+ 0x82000580, 0x0000000d, 0x04000008, 0x0201f800,
-+ 0x00106463, 0x4d340000, 0x59326809, 0x0201f800,
-+ 0x001046db, 0x5c026800, 0x0201f800, 0x0010719c,
-+ 0x0401f030, 0x812e59c0, 0x02000800, 0x001004ef,
-+ 0x0201f800, 0x00108c4f, 0x04020004, 0x0201f800,
-+ 0x00100ddd, 0x0401f7a2, 0x0201f800, 0x00106463,
-+ 0x592c0208, 0x8400050c, 0x48025a08, 0x592c0406,
-+ 0x800000c2, 0x800008c4, 0x80040c00, 0x48066206,
-+ 0x42000000, 0x10000000, 0x41300800, 0x0201f800,
-+ 0x00100ad5, 0x0400000d, 0x592c0208, 0x8c00051c,
-+ 0x04020006, 0x8400055c, 0x48025a08, 0x4a026206,
-+ 0x00000002, 0x0401f00f, 0x4d300000, 0x0201f800,
-+ 0x00101201, 0x5c026000, 0x59300203, 0x82000580,
-+ 0x00000004, 0x04020007, 0x4d380000, 0x42027000,
-+ 0x00000048, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x1c01f000, 0x42000000, 0x0010b03d, 0x0201f800,
-+ 0x0010a260, 0x59300203, 0x82000c80, 0x0000000e,
-+ 0x02021800, 0x001004ef, 0x4803c857, 0x0c01f001,
-+ 0x00108666, 0x00108586, 0x00108668, 0x00108666,
-+ 0x00108668, 0x00108668, 0x0010857e, 0x00108666,
-+ 0x0010857a, 0x00108666, 0x00108666, 0x00108666,
-+ 0x00108666, 0x00108666, 0x0201f800, 0x001004ef,
-+ 0x4d340000, 0x4d2c0000, 0x59326809, 0x59340400,
-+ 0x82000500, 0x000000ff, 0x82000c80, 0x0000000c,
-+ 0x02021800, 0x001004ef, 0x59303403, 0x82180d80,
-+ 0x00000004, 0x04020004, 0x42000000, 0x00000001,
-+ 0x0401f006, 0x82180d80, 0x00000000, 0x04020003,
-+ 0x42000000, 0x00000001, 0x4803c857, 0x0c01f804,
-+ 0x5c025800, 0x5c026800, 0x1c01f000, 0x0010868f,
-+ 0x00108723, 0x00108691, 0x001086c6, 0x00108691,
-+ 0x00108740, 0x00108691, 0x0010869b, 0x0010868f,
-+ 0x00108740, 0x0010868f, 0x001086aa, 0x0201f800,
-+ 0x001004ef, 0x59300403, 0x82000d80, 0x00000016,
-+ 0x0400002e, 0x82000d80, 0x00000004, 0x0400002b,
-+ 0x82000d80, 0x00000002, 0x04000028, 0x0401face,
-+ 0x04000026, 0x59300403, 0x82000d80, 0x00000022,
-+ 0x040000a3, 0x82000d80, 0x00000039, 0x040000a8,
-+ 0x82000d80, 0x00000035, 0x040000a5, 0x82000d80,
-+ 0x0000001e, 0x0400001b, 0x0401f993, 0x04000007,
-+ 0x0201f800, 0x00108de6, 0x04020004, 0x0201f800,
-+ 0x0010474f, 0x0401f011, 0x59300403, 0x82000d80,
-+ 0x00000001, 0x04020004, 0x0201f800, 0x00104719,
-+ 0x0400000a, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010caa0, 0x5c027800, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x001078c2,
-+ 0x0201f000, 0x0010719c, 0x0401f977, 0x04000004,
-+ 0x0201f800, 0x00108de6, 0x0400009a, 0x59300c03,
-+ 0x82040580, 0x00000016, 0x0400004b, 0x82040580,
-+ 0x00000002, 0x04020029, 0x59a80023, 0x8c000502,
-+ 0x04020013, 0x0201f800, 0x00104ca6, 0x04020010,
-+ 0x0201f800, 0x00104ce4, 0x04020006, 0x42000000,
-+ 0x00000001, 0x0201f800, 0x00104c7e, 0x0401f085,
-+ 0x4a035030, 0x00000001, 0x4202d800, 0x00000001,
-+ 0x0201f800, 0x00104c16, 0x0401f07e, 0x59340412,
- 0x82000500, 0x000000ff, 0x04000010, 0x80000040,
- 0x48026c12, 0x497a6008, 0x4a026406, 0x00000007,
- 0x4a026206, 0x00000398, 0x497a6205, 0x0201f800,
-- 0x00020892, 0x04000005, 0x49366009, 0x4a026406,
-+ 0x00020799, 0x04000005, 0x49366009, 0x4a026406,
- 0x00000001, 0x0401f020, 0x59300403, 0x82000d80,
- 0x00000002, 0x0402000d, 0x59340403, 0x82000580,
-- 0x000007fe, 0x04020009, 0x59a80026, 0x84000540,
-- 0x48035026, 0x0201f800, 0x00104067, 0x0201f800,
-- 0x00107da6, 0x0401f00c, 0x0201f800, 0x00107da6,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x00101de2,
-- 0x5c027800, 0x42000000, 0x0010b663, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x00101e1b, 0x0201f000,
-- 0x00107698, 0x42000800, 0x00000003, 0x0201f800,
-- 0x001043c7, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000002, 0x0201f000, 0x00106470, 0x0401f915,
-- 0x04020793, 0x0201f800, 0x00101e1b, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-+ 0x000007fe, 0x04020009, 0x59a80023, 0x84000540,
-+ 0x48035023, 0x0201f800, 0x00103efc, 0x0201f800,
-+ 0x001078c2, 0x0401f00c, 0x0201f800, 0x001078c2,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010caa0,
-+ 0x5c027800, 0x42000000, 0x0010b033, 0x0201f800,
-+ 0x0010a260, 0x0201f800, 0x00101c36, 0x0201f000,
-+ 0x0010719c, 0x42000800, 0x00000003, 0x0201f800,
-+ 0x0010426c, 0x4a026203, 0x00000001, 0x4a026403,
-+ 0x00000002, 0x0201f000, 0x00106339, 0x0401f91a,
-+ 0x0402079e, 0x0201f800, 0x00101c36, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
-+ 0x42000000, 0x0010b033, 0x0201f800, 0x0010a260,
- 0x42003000, 0x00000018, 0x41782800, 0x42002000,
- 0x00000000, 0x4d400000, 0x4d440000, 0x59368c03,
-- 0x42028000, 0x00000029, 0x0201f800, 0x0010962a,
-- 0x5c028800, 0x5c028000, 0x0201f000, 0x00107698,
-- 0x0201f800, 0x00104863, 0x0401f7c8, 0x42000000,
-- 0x0010b66c, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x001078fd, 0x040207c1, 0x1c01f000, 0x4d380000,
-- 0x59327403, 0x0201f800, 0x00109183, 0x5c027000,
-- 0x02020000, 0x000208b4, 0x836c0580, 0x00000003,
-- 0x04000004, 0x4a026206, 0x00000002, 0x1c01f000,
-- 0x59300403, 0x48026416, 0x4a02621d, 0x00000001,
-- 0x4a026403, 0x00000085, 0x4a026203, 0x00000009,
-- 0x4a026406, 0x00000002, 0x42000800, 0x8000004b,
-- 0x0201f000, 0x00020855, 0x0201f800, 0x00101e1b,
-- 0x0201f800, 0x00107da6, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x00101de2, 0x5c027800, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x497a6008,
-+ 0x42028000, 0x00000029, 0x0201f800, 0x001090b2,
-+ 0x5c028800, 0x5c028000, 0x0201f000, 0x0010719c,
-+ 0x0201f800, 0x0010474f, 0x0401f7c8, 0x42000000,
-+ 0x0010b03c, 0x0201f800, 0x0010a260, 0x0201f800,
-+ 0x00107411, 0x040207c1, 0x1c01f000, 0x59300c03,
-+ 0x0201f800, 0x00108bff, 0x02020000, 0x000207bb,
-+ 0x836c0580, 0x00000003, 0x04000004, 0x4a026206,
-+ 0x00000002, 0x1c01f000, 0x59300403, 0x48026416,
-+ 0x4a02621d, 0x00000001, 0x4a026403, 0x00000085,
-+ 0x4a026203, 0x00000009, 0x4a026406, 0x00000002,
-+ 0x42000800, 0x8000004b, 0x0201f000, 0x0002075c,
-+ 0x0201f800, 0x001078c2, 0x4d3c0000, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x5c027800, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x497a6008,
- 0x4a026406, 0x00000007, 0x4a026206, 0x00000398,
-- 0x497a6205, 0x1c01f000, 0x42000000, 0x0010b66f,
-- 0x0201f800, 0x0010a86e, 0x4d340000, 0x59326809,
-+ 0x497a6205, 0x1c01f000, 0x42000000, 0x0010b03f,
-+ 0x0201f800, 0x0010a260, 0x4d340000, 0x59326809,
- 0x59300203, 0x82000c80, 0x0000000e, 0x02021800,
-- 0x00100615, 0x4803c857, 0x0c01f803, 0x5c026800,
-- 0x1c01f000, 0x00108d53, 0x00108b39, 0x00108d53,
-- 0x00108d53, 0x00108d53, 0x00108d53, 0x00108d53,
-- 0x00108d53, 0x00108d53, 0x00108b39, 0x00108d55,
-- 0x00108b39, 0x00108d5d, 0x00108d53, 0x0201f800,
-- 0x00100615, 0x4a026403, 0x0000008b, 0x4a026203,
-+ 0x001004ef, 0x4803c857, 0x0c01f803, 0x5c026800,
-+ 0x1c01f000, 0x00108793, 0x00108586, 0x00108793,
-+ 0x00108793, 0x00108793, 0x00108793, 0x00108793,
-+ 0x00108793, 0x00108793, 0x00108586, 0x00108795,
-+ 0x00108586, 0x0010879d, 0x00108793, 0x0201f800,
-+ 0x001004ef, 0x4a026403, 0x0000008b, 0x4a026203,
- 0x0000000b, 0x42000800, 0x8000404b, 0x0201f000,
-- 0x00020855, 0x59300a1d, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x00101de2, 0x5c027800, 0x42003000,
-- 0x00000011, 0x0201f800, 0x0010a766, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x41306800,
-- 0x0201f800, 0x00020892, 0x04000008, 0x49366009,
-- 0x4d300000, 0x40366000, 0x0201f800, 0x00107698,
-+ 0x0002075c, 0x59300a1d, 0x4d3c0000, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x5c027800, 0x42003000,
-+ 0x00000011, 0x0201f800, 0x0010a137, 0x42000000,
-+ 0x0010b033, 0x0201f800, 0x0010a260, 0x41306800,
-+ 0x0201f800, 0x00020799, 0x04000008, 0x49366009,
-+ 0x4d300000, 0x40366000, 0x0201f800, 0x0010719c,
- 0x5c026000, 0x0401f002, 0x40366000, 0x497a6008,
- 0x4a026406, 0x00000001, 0x4a026403, 0x00000001,
-- 0x0201f800, 0x0010393e, 0x04000011, 0x4a026406,
-- 0x00000004, 0x4a026203, 0x00000007, 0x4a026420,
-- 0x00000001, 0x42003000, 0x00000004, 0x4d400000,
-- 0x42028000, 0x00000029, 0x41782800, 0x0201f800,
-- 0x0010a250, 0x5c028000, 0x1c01f000, 0x42000800,
-- 0x0000000b, 0x0201f800, 0x001043c7, 0x4a026203,
-- 0x00000001, 0x0201f000, 0x00106470, 0x42000000,
-- 0x0010b675, 0x0201f800, 0x0010a86e, 0x59300203,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x4803c857, 0x0c01f001, 0x00108dc8, 0x00108db0,
-- 0x00108db4, 0x00108dc9, 0x00108db2, 0x00108db0,
-- 0x00108db0, 0x00108db0, 0x00108db0, 0x00108db0,
-- 0x00108db0, 0x00108db0, 0x00108db0, 0x00108db0,
-- 0x0201f800, 0x00100615, 0x0201f800, 0x00100ee4,
-- 0x4d2c0000, 0x59325808, 0x4a025a06, 0x00000006,
-- 0x0201f800, 0x00020381, 0x5c025800, 0x497a6008,
-- 0x4a02621d, 0x0000000a, 0x4a026403, 0x00000085,
-- 0x4a026203, 0x00000009, 0x4a026406, 0x00000002,
-- 0x42000800, 0x8000404b, 0x0201f000, 0x00020855,
-- 0x1c01f000, 0x0201f800, 0x0010698c, 0x4df00000,
-- 0x0401fcbe, 0x04020004, 0x0201f800, 0x00106bb2,
-- 0x0402000c, 0x0201f800, 0x001064f6, 0x04020005,
-- 0x5c03e000, 0x0201f800, 0x00106982, 0x0401f7dd,
-- 0x0201f800, 0x001068a3, 0x02020800, 0x00100615,
-- 0x5c03e000, 0x0201f800, 0x00106982, 0x59300203,
-- 0x82000d80, 0x00000003, 0x02000800, 0x00100615,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f7ba, 0x4803c856, 0x59a8000e, 0x59a80867,
-+ 0x8d0e1d20, 0x04000011, 0x4a026406, 0x00000004,
-+ 0x4a026203, 0x00000007, 0x4a026420, 0x00000001,
-+ 0x42003000, 0x00000004, 0x4d400000, 0x42028000,
-+ 0x00000029, 0x41782800, 0x0201f800, 0x00109c14,
-+ 0x5c028000, 0x1c01f000, 0x42000800, 0x0000000b,
-+ 0x0201f800, 0x0010426c, 0x4a026203, 0x00000001,
-+ 0x0201f000, 0x00106339, 0x42000000, 0x0010b045,
-+ 0x0201f800, 0x0010a260, 0x59300203, 0x82000c80,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x4803c857,
-+ 0x0c01f001, 0x00108807, 0x001087ef, 0x001087f3,
-+ 0x00108808, 0x001087f1, 0x001087ef, 0x001087ef,
-+ 0x001087ef, 0x001087ef, 0x001087ef, 0x001087ef,
-+ 0x001087ef, 0x001087ef, 0x001087ef, 0x0201f800,
-+ 0x001004ef, 0x0201f800, 0x00100ddd, 0x4d2c0000,
-+ 0x59325808, 0x4a025a06, 0x00000006, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x497a6008, 0x4a02621d,
-+ 0x0000000a, 0x4a026403, 0x00000085, 0x4a026203,
-+ 0x00000009, 0x4a026406, 0x00000002, 0x42000800,
-+ 0x8000404b, 0x0201f000, 0x0002075c, 0x1c01f000,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x0401fcca,
-+ 0x04020004, 0x0201f800, 0x001066a5, 0x0402000d,
-+ 0x0201f800, 0x0010cb83, 0x80c40040, 0x04020005,
-+ 0x5c03e000, 0x0201f800, 0x00106463, 0x0401f7dc,
-+ 0x0201f800, 0x00106379, 0x02020800, 0x001004ef,
-+ 0x5c03e000, 0x0201f800, 0x00106463, 0x59300203,
-+ 0x82000d80, 0x00000003, 0x02000800, 0x001004ef,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f7b9, 0x4803c856, 0x59a8000d, 0x59a80864,
- 0x80040400, 0x80080480, 0x04021004, 0x82000540,
- 0x00000001, 0x1c01f000, 0x80000580, 0x1c01f000,
-- 0x4803c856, 0x4c080000, 0x59301008, 0x82081500,
-- 0xfff00000, 0x5c001000, 0x1c01f000, 0x4803c856,
-- 0x4d300000, 0x0201f800, 0x00020892, 0x0400000a,
-- 0x0401f82f, 0x4d380000, 0x42027000, 0x0000004b,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x82000540,
-- 0x00000001, 0x5c026000, 0x1c01f000, 0x4803c856,
-- 0x4d300000, 0x0201f800, 0x001076c9, 0x0400001b,
-- 0x0401f81f, 0x4d300000, 0x0201f800, 0x0010698c,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x001067f6,
-- 0x0201f800, 0x00106543, 0x5c027800, 0x0201f800,
-- 0x0010a0da, 0x0201f800, 0x00106982, 0x5c026000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000000,
-+ 0x04000003, 0x42018800, 0x00000001, 0x5c000000,
-+ 0x1c01f000, 0x4c040000, 0x59300808, 0x59a8000b,
-+ 0x80040480, 0x04001007, 0x59a8000c, 0x80040480,
-+ 0x04021004, 0x800409c0, 0x5c000800, 0x1c01f000,
-+ 0x800409c0, 0x02020800, 0x001004ef, 0x4803c856,
-+ 0x0401f7fa, 0x4803c856, 0x4d300000, 0x0201f800,
-+ 0x00020799, 0x0400000a, 0x0401f831, 0x4d380000,
-+ 0x42027000, 0x0000004b, 0x0201f800, 0x000207df,
-+ 0x5c027000, 0x82000540, 0x00000001, 0x5c026000,
-+ 0x1c01f000, 0x4803c856, 0x4d300000, 0x0201f800,
-+ 0x001071d5, 0x0400001d, 0x0401f821, 0x4d300000,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010cef7, 0x0201f800,
-+ 0x0010cf9c, 0x5c027800, 0x0201f800, 0x0010d28a,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x5c026000,
- 0x8d3e7d3e, 0x0402000b, 0x4d380000, 0x42027000,
-- 0x0000004c, 0x0201f800, 0x000208d8, 0x5c027000,
-+ 0x0000004c, 0x0201f800, 0x000207df, 0x5c027000,
- 0x82000540, 0x00000001, 0x5c026000, 0x1c01f000,
-- 0x0201f800, 0x000208b4, 0x0401f7fa, 0x592c0407,
-+ 0x0201f800, 0x000207bb, 0x0401f7fa, 0x592c0407,
- 0x494a6017, 0x494e6018, 0x49366009, 0x492e6008,
- 0x4a026406, 0x00000003, 0x800000c2, 0x800008c4,
- 0x80040400, 0x48026206, 0x1c01f000, 0x493bc857,
-- 0x4d300000, 0x0201f800, 0x00020892, 0x0400000d,
-+ 0x4d300000, 0x0201f800, 0x00020799, 0x0400000d,
- 0x0401ffef, 0x4d400000, 0x42028000, 0x00000005,
- 0x0401f80d, 0x5c028000, 0x8d3e7d3e, 0x04020007,
-- 0x0201f800, 0x000208d8, 0x82000540, 0x00000001,
-- 0x5c026000, 0x1c01f000, 0x0201f800, 0x000208b4,
-- 0x0401f7fa, 0x4803c856, 0x0201f800, 0x0010698c,
-- 0x4d3c0000, 0x4d440000, 0x59368c03, 0x42027800,
-- 0x00000001, 0x0201f800, 0x001066ff, 0x0201f800,
-- 0x00106675, 0x0201f800, 0x00106543, 0x0201f800,
-- 0x0010a0da, 0x5c028800, 0x5c027800, 0x0201f000,
-- 0x00106982, 0x4803c856, 0x4d300000, 0x0201f800,
-- 0x00020892, 0x0400000f, 0x481a601c, 0x48ee6021,
-- 0x49366009, 0x4a026406, 0x00000001, 0x492e6008,
-- 0x4d380000, 0x42027000, 0x0000001f, 0x0201f800,
-- 0x000208d8, 0x5c027000, 0x82000540, 0x00000001,
-- 0x5c026000, 0x1c01f000, 0x4803c856, 0x4d300000,
-- 0x0201f800, 0x00020892, 0x0400000e, 0x48ee6021,
-+ 0x0201f800, 0x000207df, 0x82000540, 0x00000001,
-+ 0x5c026000, 0x1c01f000, 0x0201f800, 0x000207bb,
-+ 0x0401f7fa, 0x4803c856, 0x0201f800, 0x00106476,
-+ 0x4df00000, 0x4d3c0000, 0x4d440000, 0x59368c03,
-+ 0x42027800, 0x00000001, 0x0201f800, 0x0010ce5a,
-+ 0x0201f800, 0x0010cea8, 0x0201f800, 0x0010cf9c,
-+ 0x0201f800, 0x0010d28a, 0x5c028800, 0x5c027800,
-+ 0x5c03e000, 0x02000000, 0x00106463, 0x1c01f000,
-+ 0x4803c856, 0x4d300000, 0x0201f800, 0x00020799,
-+ 0x0400000f, 0x481a601c, 0x48ee6021, 0x49366009,
-+ 0x4a026406, 0x00000001, 0x492e6008, 0x4d380000,
-+ 0x42027000, 0x0000001f, 0x0201f800, 0x000207df,
-+ 0x5c027000, 0x82000540, 0x00000001, 0x5c026000,
-+ 0x1c01f000, 0x4803c856, 0x4d300000, 0x0201f800,
-+ 0x00020799, 0x0400000e, 0x48ee6021, 0x49366009,
-+ 0x4a026406, 0x00000001, 0x492e6008, 0x4d380000,
-+ 0x42027000, 0x00000055, 0x0201f800, 0x000207df,
-+ 0x5c027000, 0x82000540, 0x00000001, 0x5c026000,
-+ 0x1c01f000, 0x4803c856, 0x4d300000, 0x0201f800,
-+ 0x00020799, 0x0400000f, 0x481a601c, 0x48ee6021,
- 0x49366009, 0x4a026406, 0x00000001, 0x492e6008,
-- 0x4d380000, 0x42027000, 0x00000055, 0x0201f800,
-- 0x000208d8, 0x5c027000, 0x82000540, 0x00000001,
-+ 0x4d380000, 0x42027000, 0x0000003d, 0x0201f800,
-+ 0x000207df, 0x5c027000, 0x82000540, 0x00000001,
- 0x5c026000, 0x1c01f000, 0x4803c856, 0x4d300000,
-- 0x0201f800, 0x00020892, 0x0400000f, 0x481a601c,
-- 0x48ee6021, 0x49366009, 0x4a026406, 0x00000001,
-- 0x492e6008, 0x4d380000, 0x42027000, 0x0000003d,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x82000540,
-- 0x00000001, 0x5c026000, 0x1c01f000, 0x4803c856,
-- 0x4d300000, 0x0201f800, 0x001076c9, 0x04000014,
-- 0x49366009, 0x492fc857, 0x4933c857, 0x592c0404,
-- 0x8c00051e, 0x04000003, 0x48efc857, 0x48ee6021,
-+ 0x0201f800, 0x001071d5, 0x04000014, 0x49366009,
-+ 0x492fc857, 0x4933c857, 0x592c0404, 0x8c00051e,
-+ 0x04000003, 0x48efc857, 0x48ee6021, 0x4a026406,
-+ 0x00000001, 0x492e6008, 0x4d380000, 0x42027000,
-+ 0x00000000, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x82000540, 0x00000001, 0x5c026000, 0x1c01f000,
-+ 0x4803c856, 0x4d300000, 0x0201f800, 0x00020799,
-+ 0x0400000f, 0x48ee6021, 0x481a601c, 0x49366009,
- 0x4a026406, 0x00000001, 0x492e6008, 0x4d380000,
-- 0x42027000, 0x00000000, 0x0201f800, 0x000208d8,
-+ 0x42027000, 0x00000044, 0x0201f800, 0x000207df,
- 0x5c027000, 0x82000540, 0x00000001, 0x5c026000,
- 0x1c01f000, 0x4803c856, 0x4d300000, 0x0201f800,
-- 0x00020892, 0x0400000f, 0x48ee6021, 0x481a601c,
-+ 0x00020799, 0x0400000f, 0x481a601c, 0x48ee6021,
- 0x49366009, 0x4a026406, 0x00000001, 0x492e6008,
-- 0x4d380000, 0x42027000, 0x00000044, 0x0201f800,
-- 0x000208d8, 0x5c027000, 0x82000540, 0x00000001,
-- 0x5c026000, 0x1c01f000, 0x4803c856, 0x4d300000,
-- 0x0201f800, 0x00020892, 0x0400000f, 0x481a601c,
-- 0x48ee6021, 0x49366009, 0x4a026406, 0x00000001,
-- 0x492e6008, 0x4d380000, 0x42027000, 0x00000049,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x82000540,
-- 0x00000001, 0x5c026000, 0x1c01f000, 0x59300009,
-- 0x80001540, 0x02000800, 0x00100615, 0x5808040b,
-- 0x4803c856, 0x80000040, 0x04001002, 0x4800140b,
-- 0x1c01f000, 0x4803c856, 0x59300403, 0x82000d80,
-- 0x00000002, 0x0400000f, 0x82000d80, 0x00000003,
-- 0x0400000c, 0x82000d80, 0x00000004, 0x04000009,
-- 0x599c0819, 0x8c040d0e, 0x04000004, 0x82000d80,
-- 0x00000000, 0x04000003, 0x82000540, 0x00000001,
-+ 0x4d380000, 0x42027000, 0x00000049, 0x0201f800,
-+ 0x000207df, 0x5c027000, 0x82000540, 0x00000001,
-+ 0x5c026000, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x59300009, 0x80001540,
-+ 0x02000800, 0x001004ef, 0x5808040b, 0x4803c856,
-+ 0x80000040, 0x04001002, 0x4800140b, 0x1c01f000,
-+ 0x4803c856, 0x59300403, 0x82000d80, 0x00000002,
-+ 0x0400000f, 0x82000d80, 0x00000003, 0x0400000c,
-+ 0x82000d80, 0x00000004, 0x04000009, 0x599c0819,
-+ 0x8c040d0e, 0x04000004, 0x82000d80, 0x00000000,
-+ 0x04000003, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
- 0x1c01f000, 0x4803c856, 0x4c000000, 0x4d2c0000,
- 0x59300406, 0x82000580, 0x00000004, 0x0400001d,
- 0x59300008, 0x80025d40, 0x800001c0, 0x04000019,
-- 0x0201f800, 0x00109360, 0x04000014, 0x59300406,
-+ 0x0201f800, 0x00108de6, 0x04000014, 0x59300406,
- 0x82004580, 0x00000010, 0x04000010, 0x82004580,
- 0x00000011, 0x0400000d, 0x82004580, 0x00000003,
- 0x0400000c, 0x82004580, 0x00000002, 0x04000009,
-@@ -9216,158 +8844,164 @@ uint32_t risc_code01[] = {
- 0x8c00051e, 0x04000003, 0x80000580, 0x0401f003,
- 0x82000540, 0x00000001, 0x5c025800, 0x5c000000,
- 0x1c01f000, 0x4803c856, 0x4d300000, 0x0201f800,
-- 0x001076c9, 0x04000013, 0x49366009, 0x48ee6021,
-+ 0x001071d5, 0x04000013, 0x49366009, 0x48ee6021,
- 0x4a026406, 0x00000001, 0x492e6008, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
- 0x4d380000, 0x42027000, 0x00000028, 0x0201f800,
-- 0x000208d8, 0x5c027000, 0x82000540, 0x00000001,
-+ 0x000207df, 0x5c027000, 0x82000540, 0x00000001,
- 0x5c026000, 0x1c01f000, 0x4803c856, 0x83380580,
-- 0x00000015, 0x0402000d, 0x59a80016, 0x82000580,
-- 0x00000074, 0x04020009, 0x0201f800, 0x00104480,
-+ 0x00000015, 0x0402000d, 0x59a80015, 0x82000580,
-+ 0x00000074, 0x04020009, 0x0201f800, 0x00104346,
- 0x4a026203, 0x00000001, 0x4a026403, 0x00000029,
-- 0x0201f000, 0x00106470, 0x0201f800, 0x00107da6,
-- 0x0201f000, 0x000208b4, 0x4803c856, 0x83380580,
-+ 0x0201f000, 0x00106339, 0x0201f800, 0x001078c2,
-+ 0x0201f000, 0x000207bb, 0x4803c856, 0x83380580,
- 0x00000016, 0x04020007, 0x42000800, 0x00000004,
-- 0x0201f800, 0x001043c7, 0x0201f000, 0x001078bf,
-- 0x83380580, 0x00000015, 0x04020013, 0x59a80016,
-+ 0x0201f800, 0x0010426c, 0x0201f000, 0x001073d3,
-+ 0x83380580, 0x00000015, 0x04020013, 0x59a80015,
- 0x82000580, 0x00000014, 0x0402000f, 0x0201f800,
-- 0x001044e1, 0x0201f800, 0x00108210, 0x0402000a,
-+ 0x001043a7, 0x0201f800, 0x00107d26, 0x0402000a,
- 0x59340404, 0x80000540, 0x04000007, 0x42000800,
-- 0x00000006, 0x0201f800, 0x001043c7, 0x0201f000,
-- 0x001078bf, 0x0201f800, 0x00107da6, 0x0201f000,
-- 0x000208b4, 0x4803c856, 0x592c0206, 0x82000580,
-+ 0x00000006, 0x0201f800, 0x0010426c, 0x0201f000,
-+ 0x001073d3, 0x0201f800, 0x001078c2, 0x0201f000,
-+ 0x000207bb, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4803c856, 0x592c0206, 0x82000580,
- 0x00000005, 0x04000002, 0x1c01f000, 0x4803c856,
- 0x592c0208, 0x8400054a, 0x48025a08, 0x1c01f000,
- 0x497a6205, 0x497a6008, 0x4a026203, 0x00000001,
- 0x4a026403, 0x00000050, 0x42000800, 0x80000043,
-- 0x0201f000, 0x00020855, 0x4933c857, 0x4d340000,
-+ 0x0201f000, 0x0002075c, 0x4933c857, 0x4d340000,
- 0x59326809, 0x59340200, 0x8c00050e, 0x04000006,
- 0x59300406, 0x82000c80, 0x00000012, 0x04021004,
- 0x0c01f806, 0x5c026800, 0x1c01f000, 0x0201f800,
-- 0x00108b30, 0x0401f7fc, 0x00108b30, 0x00108fb4,
-- 0x00108fb8, 0x00108fbb, 0x0010a2b9, 0x0010a2d6,
-- 0x0010a2da, 0x00108b30, 0x00108b30, 0x00108b30,
-- 0x00108b30, 0x00108b30, 0x00108b30, 0x00108b30,
-- 0x00108b30, 0x00108b30, 0x00108b30, 0x00108b30,
-+ 0x0010857d, 0x0401f7fc, 0x0010857d, 0x00108a1c,
-+ 0x00108a20, 0x00108a23, 0x00109c86, 0x00109ca3,
-+ 0x00109ca7, 0x0010857d, 0x0010857d, 0x0010857d,
-+ 0x0010857d, 0x0010857d, 0x0010857d, 0x0010857d,
-+ 0x0010857d, 0x0010857d, 0x0010857d, 0x0010857d,
- 0x4803c856, 0x40000000, 0x40000000, 0x1c01f000,
- 0x40000000, 0x40000000, 0x1c01f000, 0x5930001c,
- 0x4803c857, 0x59300414, 0x4933c857, 0x4803c857,
- 0x8c000502, 0x04000005, 0x4803c857, 0x84000540,
- 0x48026414, 0x1c01f000, 0x42000000, 0xd0000000,
-- 0x41300800, 0x0201f800, 0x00100bde, 0x0401f810,
-+ 0x41300800, 0x0201f800, 0x00100ad5, 0x0401f810,
- 0x0402000e, 0x59300c14, 0x59300403, 0x82000580,
- 0x00000040, 0x04000003, 0x84040d40, 0x0401f005,
-- 0x59a80037, 0x82000400, 0x0000000a, 0x48026205,
-+ 0x59a80034, 0x82000400, 0x0000000a, 0x48026205,
- 0x84040d42, 0x48066414, 0x1c01f000, 0x4933c857,
- 0x4d340000, 0x59326809, 0x59340200, 0x8c00050e,
-- 0x02000800, 0x00100615, 0x5930001c, 0x80000540,
-- 0x04020034, 0x59300403, 0x4803c857, 0x82000580,
-- 0x00000040, 0x04000004, 0x59a80021, 0x80000540,
-- 0x0402002a, 0x4d1c0000, 0x41323800, 0x0201f800,
-- 0x00020892, 0x04000023, 0x4932381c, 0x591c0414,
-- 0x84000542, 0x48023c14, 0x49366009, 0x591c0406,
-- 0x82000580, 0x00000003, 0x04000006, 0x591c0202,
-- 0x48026419, 0x591c0402, 0x48026219, 0x0401f005,
-- 0x591c0202, 0x48026219, 0x591c0402, 0x48026419,
-- 0x491e601e, 0x4a026406, 0x00000001, 0x4a026403,
-- 0x00000035, 0x4a026203, 0x00000001, 0x42000800,
-- 0x80000040, 0x0201f800, 0x00020855, 0x411e6000,
-- 0x5c023800, 0x80000580, 0x5c026800, 0x1c01f000,
-- 0x411e6000, 0x5c023800, 0x59a80039, 0x48026205,
-- 0x82000540, 0x00000001, 0x0401f7f8, 0x4933c857,
-- 0x4d2c0000, 0x4932381c, 0x4a026202, 0x0000ffff,
-- 0x591e5808, 0x591c0007, 0x8c00051e, 0x04000005,
-- 0x8400051e, 0x48023807, 0x497a5c09, 0x0401f018,
-- 0x592c0408, 0x8c000518, 0x04000015, 0x84000518,
-- 0x48025c08, 0x4d400000, 0x592e8206, 0x4a025a06,
-- 0x00000001, 0x0401fb34, 0x49425a06, 0x5c028000,
-- 0x497a5c09, 0x592c0408, 0x8c000512, 0x04000008,
-- 0x4d2c0000, 0x84000512, 0x48025c08, 0x592e5809,
-- 0x0201f800, 0x00100843, 0x5c025800, 0x59a80039,
-- 0x48026205, 0x591c0214, 0x48026216, 0x82000d80,
-- 0x00000001, 0x04000008, 0x4a023a03, 0x00000002,
-- 0x82000580, 0x00000005, 0x04000008, 0x497a6015,
-- 0x0401f01e, 0x591c0007, 0x84000540, 0x48023807,
-- 0x4a023a03, 0x00000004, 0x591c0414, 0x4803c857,
-- 0x8400051c, 0x84000554, 0x48023c14, 0x592c000f,
-- 0x40001000, 0x591c0816, 0x80040480, 0x040217f0,
-- 0x591c0016, 0x82000500, 0xfffffffc, 0x48026015,
-- 0x48023816, 0x591c0a14, 0x4807c857, 0x82040d80,
-- 0x00000005, 0x04020005, 0x480bc857, 0x4803c857,
-- 0x4a023812, 0xffffffff, 0x591c0402, 0x48026419,
-- 0x591c0202, 0x48026219, 0x591e6809, 0x49366009,
-- 0x4a026406, 0x00000001, 0x4a026403, 0x00000039,
-+ 0x02000800, 0x001004ef, 0x5930001c, 0x80000540,
-+ 0x04020033, 0x59300403, 0x4803c857, 0x82000580,
-+ 0x00000040, 0x04000003, 0x8d0e1d0e, 0x0402002a,
-+ 0x4d1c0000, 0x41323800, 0x0201f800, 0x00020799,
-+ 0x04000023, 0x4932381c, 0x591c0414, 0x84000542,
-+ 0x48023c14, 0x49366009, 0x591c0406, 0x82000580,
-+ 0x00000003, 0x04000006, 0x591c0202, 0x48026419,
-+ 0x591c0402, 0x48026219, 0x0401f005, 0x591c0202,
-+ 0x48026219, 0x591c0402, 0x48026419, 0x491e601e,
-+ 0x4a026406, 0x00000001, 0x4a026403, 0x00000035,
- 0x4a026203, 0x00000001, 0x42000800, 0x80000040,
-- 0x0201f800, 0x00020855, 0x5c025800, 0x1c01f000,
-- 0x4933c857, 0x59300414, 0x8c000514, 0x04000015,
-- 0x8c00051c, 0x04020012, 0x59300016, 0x80100480,
-- 0x04001006, 0x04000005, 0x59300414, 0x84000514,
-- 0x8400055c, 0x0401f009, 0x48126016, 0x48126012,
-- 0x40100000, 0x592c180f, 0x800c0480, 0x48026011,
-- 0x59300414, 0x84000514, 0x48026414, 0x1c01f000,
-- 0x4933c857, 0x8c00051c, 0x04020006, 0x59300012,
-- 0x48026016, 0x59300414, 0x8400055c, 0x48026414,
-+ 0x0201f800, 0x0002075c, 0x411e6000, 0x5c023800,
-+ 0x80000580, 0x5c026800, 0x1c01f000, 0x411e6000,
-+ 0x5c023800, 0x59a80036, 0x48026205, 0x82000540,
-+ 0x00000001, 0x0401f7f8, 0x4933c857, 0x4d2c0000,
-+ 0x4932381c, 0x4a026202, 0x0000ffff, 0x591e5808,
-+ 0x591c0007, 0x8c00051e, 0x04000005, 0x8400051e,
-+ 0x48023807, 0x497a5809, 0x0401f018, 0x592c0408,
-+ 0x8c000518, 0x04000015, 0x84000518, 0x48025c08,
-+ 0x4d400000, 0x592e8206, 0x4a025a06, 0x00000001,
-+ 0x0401fb57, 0x49425a06, 0x5c028000, 0x497a5809,
-+ 0x592c0408, 0x8c000512, 0x04000008, 0x4d2c0000,
-+ 0x84000512, 0x48025c08, 0x592e5809, 0x0201f800,
-+ 0x0010073b, 0x5c025800, 0x59a80036, 0x48026205,
-+ 0x591c0214, 0x48026216, 0x82000d80, 0x00000001,
-+ 0x04000008, 0x4a023a03, 0x00000002, 0x82000580,
-+ 0x00000005, 0x04000008, 0x497a6015, 0x0401f01e,
-+ 0x591c0007, 0x84000540, 0x48023807, 0x4a023a03,
-+ 0x00000004, 0x591c0414, 0x4803c857, 0x8400051c,
-+ 0x84000554, 0x48023c14, 0x592c000f, 0x40001000,
-+ 0x591c0816, 0x80040480, 0x040217f0, 0x591c0016,
-+ 0x82000500, 0xfffffffc, 0x48026015, 0x48023816,
-+ 0x591c0a14, 0x4807c857, 0x82040d80, 0x00000005,
-+ 0x04020005, 0x480bc857, 0x4803c857, 0x4a023812,
-+ 0xffffffff, 0x591c0402, 0x48026419, 0x591c0202,
-+ 0x48026219, 0x591e6809, 0x49366009, 0x4a026406,
-+ 0x00000001, 0x4a026403, 0x00000039, 0x4a026203,
-+ 0x00000001, 0x42000800, 0x80000040, 0x0201f800,
-+ 0x0002075c, 0x5c025800, 0x1c01f000, 0x4933c857,
-+ 0x59300414, 0x8c000514, 0x04000015, 0x8c00051c,
-+ 0x04020012, 0x59300016, 0x80100480, 0x04001006,
-+ 0x04000005, 0x59300414, 0x84000514, 0x8400055c,
-+ 0x0401f009, 0x48126016, 0x48126012, 0x40100000,
-+ 0x592c180f, 0x800c0480, 0x48026011, 0x59300414,
-+ 0x84000514, 0x48026414, 0x1c01f000, 0x4933c857,
-+ 0x8c00051c, 0x04020006, 0x59300012, 0x48026016,
-+ 0x59300414, 0x8400055c, 0x48026414, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
- 0x1c01f000, 0x59300c03, 0x4933c857, 0x4807c857,
- 0x82040480, 0x00000034, 0x04001006, 0x82040480,
- 0x0000003c, 0x04021003, 0x80000580, 0x1c01f000,
- 0x82000540, 0x00000001, 0x0401f7fd, 0x41780800,
-- 0x59a81035, 0x42000000, 0x00000032, 0x0201f800,
-- 0x001063ee, 0x800811c0, 0x04020003, 0x42001000,
-- 0x00000014, 0x480b5037, 0x59a81036, 0x480b502d,
-+ 0x59a81032, 0x42000000, 0x00000032, 0x0201f800,
-+ 0x001062b7, 0x800811c0, 0x04020003, 0x42001000,
-+ 0x00000014, 0x480b5034, 0x59a81033, 0x480b502a,
- 0x41780800, 0x42000000, 0x00000064, 0x0201f800,
-- 0x001063ee, 0x800811c0, 0x04020003, 0x42001000,
-- 0x00000014, 0x480b5038, 0x82081400, 0x0000000a,
-- 0x480b5039, 0x42000800, 0x00000001, 0x0201f800,
-- 0x001069af, 0x42000000, 0x30000000, 0x40080800,
-- 0x0201f800, 0x00100bb2, 0x42000800, 0x00000003,
-- 0x59a81010, 0x0201f800, 0x001069af, 0x0201f000,
-- 0x00104755, 0x4a035037, 0x00000028, 0x4a035038,
-- 0x00000014, 0x4a03502d, 0x000007d0, 0x42001000,
-- 0x0000001e, 0x480b5039, 0x42000800, 0x00000001,
-- 0x0201f800, 0x001069af, 0x42000000, 0x30000000,
-- 0x40080800, 0x0201f800, 0x00100bb2, 0x42000800,
-- 0x00000003, 0x59a81010, 0x0201f000, 0x001069af,
-+ 0x001062b7, 0x800811c0, 0x04020003, 0x42001000,
-+ 0x00000014, 0x480b5035, 0x82081400, 0x0000000a,
-+ 0x480b5036, 0x42000800, 0x00000001, 0x0201f800,
-+ 0x00106499, 0x42000000, 0x30000000, 0x40080800,
-+ 0x0201f800, 0x00100aa9, 0x42000800, 0x00000003,
-+ 0x59a8100f, 0x0201f800, 0x00106499, 0x0201f000,
-+ 0x0010462e, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4a035034, 0x00000028, 0x4a035035,
-+ 0x00000014, 0x4a03502a, 0x000007d0, 0x42001000,
-+ 0x0000001e, 0x480b5036, 0x42000800, 0x00000001,
-+ 0x0201f800, 0x00106499, 0x42000000, 0x30000000,
-+ 0x40080800, 0x0201f800, 0x00100aa9, 0x42000800,
-+ 0x00000003, 0x59a8100f, 0x0201f000, 0x00106499,
-+ 0x4c000000, 0x0401f803, 0x5c000000, 0x1c01f000,
- 0x4933c857, 0x4d2c0000, 0x59300403, 0x82000580,
- 0x0000003e, 0x04020005, 0x59325817, 0x812e59c0,
-- 0x02020800, 0x0010083a, 0x5c025800, 0x1c01f000,
-- 0x4937c857, 0x4d300000, 0x0201f800, 0x00020892,
-+ 0x02020800, 0x0010072e, 0x5c025800, 0x1c01f000,
-+ 0x4937c857, 0x4d300000, 0x0201f800, 0x00020799,
- 0x04000011, 0x49366009, 0x4a026406, 0x00000001,
- 0x492e6008, 0x42000800, 0x00000009, 0x0201f800,
-- 0x001043c7, 0x4d380000, 0x42027000, 0x00000033,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x82000540,
-+ 0x0010426c, 0x4d380000, 0x42027000, 0x00000033,
-+ 0x0201f800, 0x000207df, 0x5c027000, 0x82000540,
- 0x00000001, 0x5c026000, 0x1c01f000, 0x4933c857,
- 0x4d2c0000, 0x4c580000, 0x4d3c0000, 0x59325808,
-- 0x83380580, 0x00000015, 0x04020025, 0x59a8b016,
-+ 0x83380580, 0x00000015, 0x04020025, 0x59a8b015,
- 0x82580c80, 0x00000019, 0x04001003, 0x4200b000,
-- 0x00000018, 0x8058b104, 0x0401fa0a, 0x80000580,
-- 0x0401fa1a, 0x832cac00, 0x00000009, 0x83cca400,
-- 0x00000006, 0x0201f800, 0x0010a93e, 0x4c600000,
-+ 0x00000018, 0x8058b104, 0x0401fa0f, 0x80000580,
-+ 0x0401fa1f, 0x832cac00, 0x00000009, 0x83cca400,
-+ 0x00000006, 0x0201f800, 0x0010a330, 0x4c600000,
- 0x4200c000, 0x00000001, 0x592c100a, 0x8c081518,
-- 0x04020006, 0x59a80010, 0x592c100d, 0x80080580,
-+ 0x04020006, 0x59a8000f, 0x592c100d, 0x80080580,
- 0x04020007, 0x4178c000, 0x59301009, 0x58081403,
-- 0x417a7800, 0x0201f800, 0x00101e48, 0x5c00c000,
-- 0x0201f800, 0x001078bf, 0x0401f008, 0x4200b000,
-- 0x00000002, 0x0401fa09, 0x0201f800, 0x00107da6,
-- 0x0201f800, 0x000208b4, 0x5c027800, 0x5c00b000,
-- 0x5c025800, 0x1c01f000, 0x4933c856, 0x49366009,
-- 0x4a026406, 0x00000001, 0x492e6008, 0x4d380000,
-- 0x42027000, 0x0000004d, 0x0201f800, 0x000208d8,
-- 0x5c027000, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x417a7800, 0x0201f800, 0x00101c5e, 0x5c00c000,
-+ 0x0201f800, 0x001073d3, 0x0401f008, 0x4200b000,
-+ 0x00000002, 0x0401fa0e, 0x0201f800, 0x001078c2,
-+ 0x0201f800, 0x000207bb, 0x5c027800, 0x5c00b000,
-+ 0x5c025800, 0x1c01f000, 0x4933c856, 0x42018800,
-+ 0x00000000, 0x49366009, 0x4a026406, 0x00000001,
-+ 0x492e6008, 0x4d380000, 0x42027000, 0x0000004d,
-+ 0x0201f800, 0x000207df, 0x5c027000, 0x82000540,
-+ 0x00000001, 0x42018800, 0x00000001, 0x1c01f000,
- 0x4803c856, 0x4d2c0000, 0x83380580, 0x00000015,
-- 0x04020027, 0x59a80816, 0x59325808, 0x5930040b,
-+ 0x04020027, 0x59a80815, 0x59325808, 0x5930040b,
- 0x800000c4, 0x80040580, 0x04020021, 0x4c500000,
- 0x4c540000, 0x4c580000, 0x83cca400, 0x00000006,
-- 0x4050a800, 0x5930b40b, 0x0201f800, 0x0010a94f,
-+ 0x4050a800, 0x5930b40b, 0x0201f800, 0x0010a341,
- 0x83cca400, 0x00000006, 0x592cb205, 0x832cac00,
-- 0x00000006, 0x0201f800, 0x0010a93e, 0x592e5801,
-+ 0x00000006, 0x0201f800, 0x0010a330, 0x592e5801,
- 0x812e59c0, 0x040207f9, 0x5931d821, 0x58ef400b,
- 0x58ee580d, 0x4a025a04, 0x00000103, 0x58ec0009,
- 0x0801f800, 0x59300402, 0x5c00b000, 0x5c00a800,
- 0x5c00a000, 0x5c025800, 0x1c01f000, 0x0201f800,
-- 0x00107da6, 0x5c025800, 0x1c01f000, 0x4933c857,
-- 0x83380580, 0x00000035, 0x04000005, 0x59301419,
-+ 0x001078c2, 0x5c025800, 0x1c01f000, 0x4933c857,
-+ 0x82040d80, 0x00000035, 0x04000005, 0x59301419,
- 0x0401f851, 0x04000027, 0x0401f006, 0x4d300000,
-- 0x5932601e, 0x0401f856, 0x5c026000, 0x04000020,
-+ 0x5932601e, 0x0401f857, 0x5c026000, 0x04000020,
- 0x591c0c06, 0x82040580, 0x00000003, 0x04000004,
- 0x82040580, 0x00000006, 0x0402001c, 0x591c0c02,
- 0x59300419, 0x80040580, 0x04000009, 0x59300219,
-@@ -9377,236 +9011,239 @@ uint32_t risc_code01[] = {
- 0x59300a19, 0x80040580, 0x04020008, 0x591c0009,
- 0x59300809, 0x80040580, 0x1c01f000, 0x417a3800,
- 0x82000540, 0x00000001, 0x1c01f000, 0x4803c856,
-- 0x59b800e4, 0x8c000538, 0x02020800, 0x00100615,
-+ 0x59b800e4, 0x8c000538, 0x02020800, 0x001004ef,
- 0x42000800, 0x0000012c, 0x4a0370e4, 0x20000000,
-- 0x59b800e4, 0x80040840, 0x02000800, 0x00100615,
-+ 0x59b800e4, 0x80040840, 0x02000800, 0x001004ef,
- 0x8c00053c, 0x040207f9, 0x4a0370e4, 0x30000000,
- 0x40000000, 0x40000000, 0x40000000, 0x59b800e4,
- 0x8c00053c, 0x040207f1, 0x1c01f000, 0x4803c856,
- 0x4a0370e4, 0x20000000, 0x40000000, 0x59b800e4,
- 0x8c000538, 0x040207fb, 0x1c01f000, 0x59300807,
- 0x8c040d1e, 0x592c0c08, 0x04020002, 0x8c040d18,
-- 0x1c01f000, 0x0401fc10, 0x04000008, 0x42000800,
-- 0x00000024, 0x0201f800, 0x001063cf, 0x82063c00,
-- 0x0010cfc0, 0x491fc857, 0x1c01f000, 0x83300480,
-- 0x0010cfc0, 0x0400100a, 0x59a8000b, 0x81300480,
-- 0x04021007, 0x59301402, 0x0401ffef, 0x04000007,
-- 0x411c0000, 0x81300580, 0x04000003, 0x81780500,
-- 0x0401f002, 0x81300540, 0x1c01f000, 0x4947c857,
-- 0x4d300000, 0x0201f800, 0x00020267, 0x0402000a,
-- 0x42026000, 0x0010bbe8, 0x49366009, 0x492e6008,
-- 0x0201f800, 0x00101de2, 0x80000580, 0x5c026000,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fc,
-- 0x4933c857, 0x0201f800, 0x00108df4, 0x02000800,
-- 0x00100615, 0x4d2c0000, 0x4d340000, 0x4d440000,
-- 0x4c580000, 0x59325808, 0x59326809, 0x49425a06,
-- 0x0201f800, 0x00105439, 0x592e8c06, 0x592c4207,
-- 0x82200500, 0x0000000f, 0x0c01f806, 0x5c00b000,
-- 0x5c028800, 0x5c026800, 0x5c025800, 0x1c01f000,
-- 0x0010922f, 0x00109251, 0x00109258, 0x0010925c,
-- 0x00109265, 0x0010922c, 0x0010922c, 0x0010922c,
-- 0x00109269, 0x00109275, 0x00109275, 0x0010922c,
-- 0x0010922c, 0x0010922c, 0x0010922c, 0x0010922c,
-- 0x4803c857, 0x0201f800, 0x00100615, 0x814281c0,
-- 0x04020012, 0x41785800, 0x592c0404, 0x8c00051c,
-- 0x04020002, 0x59345c05, 0x442c2800, 0x59340008,
-- 0x48002802, 0x59340009, 0x48002801, 0x59340006,
-- 0x48002804, 0x59340007, 0x48002803, 0x4200b000,
-- 0x0000000b, 0x0401f037, 0x592c0207, 0x8c00051e,
-- 0x4200b000, 0x00000002, 0x04020032, 0x8204b540,
-- 0x00000000, 0x0400002f, 0x44042800, 0x59326809,
-- 0x59340400, 0x48002801, 0x4200b000, 0x00000002,
-- 0x0401f028, 0x814281c0, 0x04020030, 0x59345c05,
-- 0x442c2800, 0x4200b000, 0x00000001, 0x0401f021,
-- 0x8340b540, 0x00000000, 0x0400001e, 0x0401f027,
-- 0x814281c0, 0x04020025, 0x59340200, 0x44002800,
-- 0x59340001, 0x48002801, 0x4200b000, 0x00000002,
-- 0x0401f014, 0x8340b540, 0x00000000, 0x0402001b,
-- 0x0401f010, 0x8340b540, 0x00000000, 0x0400000d,
-- 0x0201f800, 0x00104871, 0x04000014, 0x8c20450e,
-- 0x04000002, 0x497a6009, 0x4178b000, 0x497a5a06,
-- 0x0401f004, 0x8340b540, 0x00000000, 0x0402000b,
-- 0x592c0404, 0x8400051c, 0x48025c04, 0x592c0207,
-- 0x8400051e, 0x48025a07, 0x0401f8aa, 0x497a6008,
-- 0x0201f000, 0x00020381, 0x592c0207, 0x8c00051e,
-- 0x4200b000, 0x00000002, 0x040207f2, 0x8204b540,
-- 0x00000000, 0x040007ef, 0x44042800, 0x4200b000,
-- 0x00000001, 0x0401f7eb, 0x4937c857, 0x4d300000,
-- 0x0201f800, 0x00020892, 0x04000011, 0x49366009,
-- 0x4a026406, 0x00000001, 0x492e6008, 0x42000800,
-- 0x0000000b, 0x0201f800, 0x001043c7, 0x4d380000,
-- 0x42027000, 0x00000043, 0x0201f800, 0x000208d8,
-- 0x5c027000, 0x82000540, 0x00000001, 0x5c026000,
-- 0x1c01f000, 0x4937c857, 0x4d2c0000, 0x59325808,
-- 0x83380580, 0x00000015, 0x04020025, 0x59a80016,
-- 0x82000580, 0x00000004, 0x04020021, 0x59a80010,
-- 0x592c1009, 0x80080580, 0x04020010, 0x4d440000,
-- 0x592e8c06, 0x592c0207, 0x4803c856, 0x82000500,
-- 0x00000080, 0x84000548, 0x4d3c0000, 0x42027800,
-- 0x00001000, 0x0201f800, 0x0010480a, 0x5c027800,
-- 0x5c028800, 0x0401f004, 0x4803c856, 0x0201f800,
-- 0x00104871, 0x0201f800, 0x00108df4, 0x04000017,
-- 0x4d400000, 0x42028000, 0x00000000, 0x41780800,
-- 0x0401ff38, 0x5c028000, 0x0401f00e, 0x0201f800,
-- 0x00104871, 0x040207f4, 0x0201f800, 0x00108df4,
-- 0x0400000a, 0x4c580000, 0x4200b000, 0x00000002,
-- 0x0401f86e, 0x5c00b000, 0x0201f800, 0x00107da6,
-- 0x0201f800, 0x000208b4, 0x5c025800, 0x1c01f000,
-- 0x4937c857, 0x4d300000, 0x0201f800, 0x00020892,
-- 0x04000012, 0x49366009, 0x4a026406, 0x00000001,
-- 0x4d3c0000, 0x4d380000, 0x417a7800, 0x0201f800,
-- 0x001043bd, 0x492e6008, 0x42027000, 0x00000004,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x5c027800,
-+ 0x1c01f000, 0x0201f800, 0x00108829, 0x04000008,
-+ 0x42000800, 0x00000024, 0x0201f800, 0x00106298,
-+ 0x82063c00, 0x0010d8d4, 0x491fc857, 0x1c01f000,
-+ 0x83300480, 0x0010d8d4, 0x0400100a, 0x59a8000a,
-+ 0x81300480, 0x04021007, 0x59301402, 0x0401ffee,
-+ 0x04000007, 0x411c0000, 0x81300580, 0x04000003,
-+ 0x81780500, 0x0401f002, 0x81300540, 0x1c01f000,
-+ 0x4947c857, 0x4d300000, 0x0201f800, 0x0002025a,
-+ 0x0402000a, 0x42026000, 0x0010b5b8, 0x49366009,
-+ 0x492e6008, 0x0201f800, 0x0010caa0, 0x80000580,
-+ 0x5c026000, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x0401f7fc, 0x4933c857, 0x0201f800, 0x0010883d,
-+ 0x02000800, 0x001004ef, 0x4d2c0000, 0x4d340000,
-+ 0x4d440000, 0x4c580000, 0x59325808, 0x59326809,
-+ 0x49425a06, 0x0201f800, 0x001052d5, 0x592e8c06,
-+ 0x592c4207, 0x82200500, 0x0000000f, 0x0c01f806,
-+ 0x5c00b000, 0x5c028800, 0x5c026800, 0x5c025800,
-+ 0x1c01f000, 0x00108cac, 0x00108cce, 0x00108cd5,
-+ 0x00108cd9, 0x00108ce2, 0x00108ca9, 0x00108ca9,
-+ 0x00108ca9, 0x00108ce6, 0x00108cf2, 0x00108cf2,
-+ 0x00108ca9, 0x00108ca9, 0x00108ca9, 0x00108ca9,
-+ 0x00108ca9, 0x4803c857, 0x0201f800, 0x001004ef,
-+ 0x814281c0, 0x04020012, 0x41785800, 0x592c0404,
-+ 0x8c00051c, 0x04020002, 0x59345c05, 0x442c2800,
-+ 0x59340008, 0x48002802, 0x59340009, 0x48002801,
-+ 0x59340006, 0x48002804, 0x59340007, 0x48002803,
-+ 0x4200b000, 0x0000000b, 0x0401f037, 0x592c0207,
-+ 0x8c00051e, 0x4200b000, 0x00000002, 0x04020032,
-+ 0x8204b540, 0x00000000, 0x0400002f, 0x44042800,
-+ 0x59326809, 0x59340400, 0x48002801, 0x4200b000,
-+ 0x00000002, 0x0401f028, 0x814281c0, 0x04020030,
-+ 0x59345c05, 0x442c2800, 0x4200b000, 0x00000001,
-+ 0x0401f021, 0x8340b540, 0x00000000, 0x0400001e,
-+ 0x0401f027, 0x814281c0, 0x04020025, 0x59340200,
-+ 0x44002800, 0x59340001, 0x48002801, 0x4200b000,
-+ 0x00000002, 0x0401f014, 0x8340b540, 0x00000000,
-+ 0x0402001b, 0x0401f010, 0x8340b540, 0x00000000,
-+ 0x0400000d, 0x0201f800, 0x0010475d, 0x04000014,
-+ 0x8c20450e, 0x04000002, 0x497a6009, 0x4178b000,
-+ 0x497a5a06, 0x0401f004, 0x8340b540, 0x00000000,
-+ 0x0402000b, 0x592c0404, 0x8400051c, 0x48025c04,
-+ 0x592c0207, 0x8400051e, 0x48025a07, 0x0401f8aa,
-+ 0x497a6008, 0x0201f000, 0x000202e9, 0x592c0207,
-+ 0x8c00051e, 0x4200b000, 0x00000002, 0x040207f2,
-+ 0x8204b540, 0x00000000, 0x040007ef, 0x44042800,
-+ 0x4200b000, 0x00000001, 0x0401f7eb, 0x4937c857,
-+ 0x4d300000, 0x0201f800, 0x00020799, 0x04000011,
-+ 0x49366009, 0x4a026406, 0x00000001, 0x492e6008,
-+ 0x42000800, 0x0000000b, 0x0201f800, 0x0010426c,
-+ 0x4d380000, 0x42027000, 0x00000043, 0x0201f800,
-+ 0x000207df, 0x5c027000, 0x82000540, 0x00000001,
-+ 0x5c026000, 0x1c01f000, 0x4937c857, 0x4d2c0000,
-+ 0x59325808, 0x83380580, 0x00000015, 0x04020025,
-+ 0x59a80015, 0x82000580, 0x00000004, 0x04020021,
-+ 0x59a8000f, 0x592c1009, 0x80080580, 0x04020010,
-+ 0x4d440000, 0x592e8c06, 0x592c0207, 0x4803c856,
-+ 0x82000500, 0x00000080, 0x84000548, 0x4d3c0000,
-+ 0x42027800, 0x00001000, 0x0201f800, 0x001046e4,
-+ 0x5c027800, 0x5c028800, 0x0401f004, 0x4803c856,
-+ 0x0201f800, 0x0010475d, 0x0201f800, 0x0010883d,
-+ 0x04000017, 0x4d400000, 0x42028000, 0x00000000,
-+ 0x41780800, 0x0401ff38, 0x5c028000, 0x0401f00e,
-+ 0x0201f800, 0x0010475d, 0x040207f4, 0x0201f800,
-+ 0x0010883d, 0x0400000a, 0x4c580000, 0x4200b000,
-+ 0x00000002, 0x0401f86e, 0x5c00b000, 0x0201f800,
-+ 0x001078c2, 0x0201f800, 0x000207bb, 0x5c025800,
-+ 0x1c01f000, 0x4937c857, 0x4d300000, 0x0201f800,
-+ 0x00020799, 0x04000012, 0x49366009, 0x4a026406,
-+ 0x00000001, 0x4d3c0000, 0x4d380000, 0x417a7800,
-+ 0x0201f800, 0x0010425d, 0x492e6008, 0x42027000,
-+ 0x00000004, 0x0201f800, 0x000207df, 0x5c027000,
-+ 0x5c027800, 0x82000540, 0x00000001, 0x5c026000,
-+ 0x1c01f000, 0x4937c857, 0x4d300000, 0x0201f800,
-+ 0x001071d5, 0x0400000d, 0x49366009, 0x4a026406,
-+ 0x00000001, 0x492e6008, 0x4d380000, 0x42027000,
-+ 0x00000051, 0x0201f800, 0x000207df, 0x5c027000,
- 0x82000540, 0x00000001, 0x5c026000, 0x1c01f000,
-- 0x4937c857, 0x4d300000, 0x0201f800, 0x001076c9,
-- 0x0400000d, 0x49366009, 0x4a026406, 0x00000001,
-- 0x492e6008, 0x4d380000, 0x42027000, 0x00000051,
-- 0x0201f800, 0x000208d8, 0x5c027000, 0x82000540,
-- 0x00000001, 0x5c026000, 0x1c01f000, 0x4933c857,
-- 0x4c580000, 0x59325808, 0x83383580, 0x00000015,
-- 0x04020011, 0x592c0008, 0x82000500, 0x00ffffff,
-- 0x0402000a, 0x0201f800, 0x00105439, 0x59cc0000,
-- 0x82000500, 0x00ffffff, 0x44002800, 0x4200b000,
-- 0x00000001, 0x0401f80b, 0x0201f800, 0x001078bf,
-- 0x0401f006, 0x4200b000, 0x00000002, 0x0401f823,
-- 0x0201f800, 0x00107da6, 0x5c00b000, 0x1c01f000,
-- 0x492fc857, 0x4c580000, 0x4c000000, 0x8058b1c0,
-- 0x0400000b, 0x82580500, 0xfffffff0, 0x02020800,
-- 0x00100615, 0x8058b0d0, 0x592c0408, 0x82000500,
-- 0xfffff0ff, 0x80580540, 0x48025c08, 0x5c000000,
-- 0x5c00b000, 0x1c01f000, 0x492fc857, 0x4c000000,
-- 0x4c040000, 0x800000d8, 0x592c0c08, 0x82040d00,
-- 0xffff0fff, 0x80040540, 0x48025c08, 0x5c000800,
-- 0x5c000000, 0x1c01f000, 0x4933c857, 0x4d2c0000,
-- 0x59325808, 0x592c0207, 0x8400055e, 0x48025a07,
-- 0x4c500000, 0x4c540000, 0x4c580000, 0x0401ffd9,
-- 0x0201f800, 0x00105439, 0x46002800, 0x00000018,
-- 0x80142800, 0x8058b040, 0x83cca400, 0x00000007,
-- 0x4014a800, 0x0201f800, 0x0010a93e, 0x5c00b000,
-- 0x5c00a800, 0x5c00a000, 0x5c025800, 0x1c01f000,
-- 0x59325808, 0x592c0204, 0x82000580, 0x00000152,
-- 0x1c01f000, 0x5930001f, 0x80000540, 0x02020800,
-- 0x00100d9a, 0x1c01f000, 0x4d2c0000, 0x59325808,
-- 0x59300203, 0x4933c857, 0x492fc857, 0x493bc857,
-- 0x4803c857, 0x82003480, 0x0000000e, 0x02021800,
-- 0x00100615, 0x0c01f803, 0x5c025800, 0x1c01f000,
-- 0x00109386, 0x00109391, 0x001093cf, 0x00109386,
-- 0x00109386, 0x00109386, 0x00109386, 0x00109386,
-- 0x00109388, 0x00109386, 0x00109386, 0x00109386,
-- 0x00109386, 0x00109386, 0x0201f800, 0x00100615,
-- 0x83383480, 0x00000056, 0x02021800, 0x00100615,
-- 0x493a6403, 0x4a026203, 0x00000001, 0x0201f000,
-- 0x00106470, 0x83380580, 0x00000013, 0x04020010,
-- 0x4937c857, 0x592c000c, 0x800001c0, 0x04000006,
-- 0x4a026203, 0x00000002, 0x59a80037, 0x48026206,
-- 0x1c01f000, 0x4a025a06, 0x00000000, 0x0201f800,
-- 0x00020381, 0x0201f000, 0x000208b4, 0x83380580,
-- 0x00000027, 0x0400001b, 0x83380580, 0x00000014,
-- 0x04000012, 0x83380580, 0x00000015, 0x04000005,
-- 0x83380580, 0x00000016, 0x02020800, 0x00100615,
-- 0x0201f800, 0x00106cb4, 0x02020000, 0x001076fb,
-- 0x59300203, 0x82000580, 0x00000002, 0x02020800,
-- 0x00100615, 0x0401f016, 0x4937c857, 0x0201f800,
-- 0x001068f6, 0x4a02580e, 0x00000011, 0x0401f006,
-- 0x4937c857, 0x0201f800, 0x001068f6, 0x4a02580e,
-- 0x00000010, 0x4a025a06, 0x00000031, 0x4a02580d,
-- 0x00000004, 0x0201f800, 0x00020381, 0x0201f800,
-- 0x00104a83, 0x0201f000, 0x00107698, 0x59341400,
-- 0x82081d00, 0x000000ff, 0x59300c03, 0x480bc857,
-- 0x4807c857, 0x82040580, 0x00000053, 0x0400002e,
-- 0x82040580, 0x00000002, 0x04000016, 0x82040580,
-- 0x00000001, 0x04000017, 0x82040580, 0x00000003,
-- 0x0400001c, 0x82040580, 0x00000005, 0x0400001d,
-- 0x82040580, 0x00000033, 0x0400001a, 0x82040580,
-- 0x00000000, 0x0400001b, 0x82040580, 0x00000004,
-- 0x02020800, 0x00100615, 0x0401f8a1, 0x0401f016,
-- 0x820c0580, 0x00000003, 0x0400084c, 0x0401f012,
-- 0x820c0580, 0x0000000b, 0x0402000f, 0x42000800,
-- 0x00000007, 0x0201f800, 0x001043c7, 0x0401f00a,
-- 0x820c0580, 0x00000005, 0x04000864, 0x0401f006,
-- 0x820c0580, 0x00000009, 0x04000889, 0x0401f002,
-- 0x0401f893, 0x4a026403, 0x00000052, 0x59a81016,
-- 0x592c040b, 0x8c000500, 0x04000003, 0x42001000,
-- 0x00000008, 0x592c040b, 0x8c000516, 0x04000003,
-- 0x82081400, 0x00000018, 0x592c000c, 0x497a580d,
-- 0x497a580e, 0x80080c80, 0x04000009, 0x04001005,
-- 0x4a025a06, 0x00000007, 0x40001000, 0x0401f006,
-- 0x4a025a06, 0x00000015, 0x0401f003, 0x4a025a06,
-- 0x00000000, 0x480a580c, 0x82081400, 0x00000003,
-- 0x80081104, 0x0201f800, 0x0010783c, 0x04000010,
-- 0x592c1001, 0x480a600b, 0x58080800, 0x82080400,
-- 0x00000002, 0x592c1011, 0x592c1812, 0x42003000,
-- 0x00000000, 0x42002000, 0x00101250, 0x0201f800,
-- 0x001079b9, 0x04000002, 0x1c01f000, 0x4a025a06,
-- 0x0000002c, 0x497a580c, 0x0201f800, 0x00020381,
-- 0x0201f000, 0x000208b4, 0x83380580, 0x00000015,
-- 0x0402000a, 0x59a8006f, 0x8c000502, 0x0402000b,
-- 0x0201f800, 0x00104480, 0x42000800, 0x00000004,
-- 0x0201f000, 0x001043c7, 0x42000800, 0x00000007,
-- 0x0201f000, 0x001043c7, 0x0201f800, 0x00104e0d,
-+ 0x4933c857, 0x4c580000, 0x59325808, 0x83383580,
-+ 0x00000015, 0x04020011, 0x592c0008, 0x82000500,
-+ 0x00ffffff, 0x0402000a, 0x0201f800, 0x001052d5,
-+ 0x59cc0000, 0x82000500, 0x00ffffff, 0x44002800,
-+ 0x4200b000, 0x00000001, 0x0401f80b, 0x0201f800,
-+ 0x001073d3, 0x0401f006, 0x4200b000, 0x00000002,
-+ 0x0401f823, 0x0201f800, 0x001078c2, 0x5c00b000,
-+ 0x1c01f000, 0x492fc857, 0x4c580000, 0x4c000000,
-+ 0x8058b1c0, 0x0400000b, 0x82580500, 0xfffffff0,
-+ 0x02020800, 0x001004ef, 0x8058b0d0, 0x592c0408,
-+ 0x82000500, 0xfffff0ff, 0x80580540, 0x48025c08,
-+ 0x5c000000, 0x5c00b000, 0x1c01f000, 0x492fc857,
-+ 0x4c000000, 0x4c040000, 0x800000d8, 0x592c0c08,
-+ 0x82040d00, 0xffff0fff, 0x80040540, 0x48025c08,
-+ 0x5c000800, 0x5c000000, 0x1c01f000, 0x4933c857,
-+ 0x4d2c0000, 0x59325808, 0x592c0207, 0x8400055e,
-+ 0x48025a07, 0x4c500000, 0x4c540000, 0x4c580000,
-+ 0x0401ffd9, 0x0201f800, 0x001052d5, 0x46002800,
-+ 0x00000018, 0x80142800, 0x8058b040, 0x83cca400,
-+ 0x00000007, 0x4014a800, 0x0201f800, 0x0010a330,
-+ 0x5c00b000, 0x5c00a800, 0x5c00a000, 0x5c025800,
-+ 0x1c01f000, 0x4c000000, 0x0401f808, 0x42018800,
-+ 0x00000001, 0x04000003, 0x42018800, 0x00000000,
-+ 0x5c000000, 0x1c01f000, 0x59325808, 0x592c0204,
-+ 0x82000580, 0x00000152, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x5930001f,
-+ 0x80000540, 0x02020800, 0x00100c91, 0x1c01f000,
-+ 0x4d2c0000, 0x59325808, 0x59300203, 0x4933c857,
-+ 0x492fc857, 0x493bc857, 0x4803c857, 0x82003480,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x0c01f803,
-+ 0x5c025800, 0x1c01f000, 0x00108e10, 0x00108e1b,
-+ 0x00108e59, 0x00108e10, 0x00108e10, 0x00108e10,
-+ 0x00108e10, 0x00108e10, 0x00108e12, 0x00108e10,
-+ 0x00108e10, 0x00108e10, 0x00108e10, 0x00108e10,
-+ 0x0201f800, 0x001004ef, 0x83383480, 0x00000056,
-+ 0x02021800, 0x001004ef, 0x493a6403, 0x4a026203,
-+ 0x00000001, 0x0201f000, 0x00106339, 0x83380580,
-+ 0x00000013, 0x04020010, 0x492fc857, 0x592c000c,
-+ 0x800001c0, 0x04000006, 0x4a026203, 0x00000002,
-+ 0x59a80034, 0x48026206, 0x1c01f000, 0x4a025a06,
-+ 0x00000000, 0x0201f800, 0x000202e9, 0x0201f000,
-+ 0x000207bb, 0x83380580, 0x00000027, 0x0400001b,
-+ 0x83380580, 0x00000014, 0x04000012, 0x83380580,
-+ 0x00000015, 0x04000005, 0x83380580, 0x00000016,
-+ 0x02020800, 0x001004ef, 0x0201f800, 0x001067a7,
-+ 0x02020000, 0x0010720c, 0x59300203, 0x82000580,
-+ 0x00000002, 0x02020800, 0x001004ef, 0x0401f016,
-+ 0x4937c857, 0x0201f800, 0x001063c4, 0x4a02580e,
-+ 0x00000011, 0x0401f006, 0x4937c857, 0x0201f800,
-+ 0x001063c4, 0x4a02580e, 0x00000010, 0x4a025a06,
-+ 0x00000031, 0x4a02580d, 0x00000004, 0x0201f800,
-+ 0x000202e9, 0x0201f800, 0x00104975, 0x0201f000,
-+ 0x0010719c, 0x59341400, 0x82081d00, 0x000000ff,
-+ 0x59300c03, 0x480bc857, 0x4807c857, 0x82040580,
-+ 0x00000053, 0x0400002e, 0x82040580, 0x00000002,
-+ 0x04000016, 0x82040580, 0x00000001, 0x04000017,
-+ 0x82040580, 0x00000003, 0x0400001c, 0x82040580,
-+ 0x00000005, 0x0400001d, 0x82040580, 0x00000033,
-+ 0x0400001a, 0x82040580, 0x00000000, 0x0400001b,
-+ 0x82040580, 0x00000004, 0x02020800, 0x001004ef,
-+ 0x0401f89e, 0x0401f016, 0x820c0580, 0x00000003,
-+ 0x04000849, 0x0401f012, 0x820c0580, 0x0000000b,
-+ 0x0402000f, 0x42000800, 0x00000007, 0x0201f800,
-+ 0x0010426c, 0x0401f00a, 0x820c0580, 0x00000005,
-+ 0x04000861, 0x0401f006, 0x820c0580, 0x00000009,
-+ 0x04000886, 0x0401f002, 0x0401f890, 0x4a026403,
-+ 0x00000052, 0x59a81015, 0x592c040b, 0x8c000500,
-+ 0x04000003, 0x42001000, 0x00000008, 0x592c040b,
-+ 0x8c000516, 0x04000003, 0x82081400, 0x00000018,
-+ 0x592c000c, 0x497a580d, 0x497a580e, 0x80080c80,
-+ 0x04000009, 0x04001005, 0x4a025a06, 0x00000007,
-+ 0x40001000, 0x0401f006, 0x4a025a06, 0x00000015,
-+ 0x0401f003, 0x4a025a06, 0x00000000, 0x480a580c,
-+ 0x0201f800, 0x0010734d, 0x04000010, 0x592c1001,
-+ 0x480a600b, 0x58080800, 0x82080400, 0x00000002,
-+ 0x592c1011, 0x592c1812, 0x42003000, 0x00000000,
-+ 0x42002000, 0x0010111c, 0x0201f800, 0x001074cd,
-+ 0x04000002, 0x1c01f000, 0x4a025a06, 0x0000002c,
-+ 0x497a580c, 0x0201f800, 0x000202e9, 0x0201f000,
-+ 0x000207bb, 0x83380580, 0x00000015, 0x0402000a,
-+ 0x59a8006c, 0x8c000502, 0x0402000b, 0x0201f800,
-+ 0x00104346, 0x42000800, 0x00000004, 0x0201f000,
-+ 0x0010426c, 0x42000800, 0x00000007, 0x0201f000,
-+ 0x0010426c, 0x0201f800, 0x00104ca6, 0x42001000,
-+ 0x00000010, 0x04020009, 0x59340002, 0x82000500,
-+ 0x00ff0000, 0x82000580, 0x00ff0000, 0x040007ec,
-+ 0x42001000, 0x00000008, 0x0201f800, 0x001049da,
-+ 0x040007e7, 0x592c040b, 0x84000540, 0x48025c0b,
-+ 0x0401f7e9, 0x83380580, 0x00000015, 0x0402000f,
-+ 0x59a8006c, 0x8c000502, 0x04020010, 0x0201f800,
-+ 0x001043a7, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010425d, 0x5c027800, 0x42000800, 0x00000006,
-+ 0x0201f000, 0x0010426c, 0x42000800, 0x00000004,
-+ 0x0201f000, 0x0010426c, 0x0201f800, 0x00104ca6,
- 0x42001000, 0x00000010, 0x04020009, 0x59340002,
- 0x82000500, 0x00ff0000, 0x82000580, 0x00ff0000,
-- 0x040007ec, 0x42001000, 0x00000008, 0x0201f800,
-- 0x00104ada, 0x040007e7, 0x592c040b, 0x84000540,
-- 0x48025c0b, 0x0401f7e9, 0x83380580, 0x00000015,
-- 0x0402000f, 0x59a8006f, 0x8c000502, 0x04020010,
-- 0x0201f800, 0x001044e1, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x5c027800, 0x42000800,
-- 0x00000006, 0x0201f000, 0x001043c7, 0x42000800,
-- 0x00000004, 0x0201f000, 0x001043c7, 0x0201f800,
-- 0x00104e0d, 0x42001000, 0x00000010, 0x04020009,
-- 0x59340002, 0x82000500, 0x00ff0000, 0x82000580,
-- 0x00ff0000, 0x040007e7, 0x42001000, 0x00000008,
-- 0x0201f800, 0x00104ada, 0x040007e2, 0x592c040b,
-- 0x84000540, 0x48025c0b, 0x0401f7e9, 0x42000800,
-- 0x00000004, 0x0201f000, 0x001043c7, 0x83380580,
-- 0x00000015, 0x04020005, 0x0201f800, 0x0010a0b1,
-- 0x02000800, 0x00104711, 0x1c01f000, 0x83380580,
-- 0x00000015, 0x0402001d, 0x4c580000, 0x83cc1400,
-- 0x00000008, 0x4200b000, 0x00000002, 0x83341c00,
-- 0x00000006, 0x0201f800, 0x001082ff, 0x04020012,
-- 0x83cc1400, 0x0000000a, 0x4200b000, 0x00000002,
-- 0x83341c00, 0x00000008, 0x0201f800, 0x001082ff,
-- 0x04020009, 0x59342200, 0x59cc1007, 0x800811c0,
-- 0x04000003, 0x480a6801, 0x84102542, 0x8410251a,
-- 0x48126a00, 0x5c00b000, 0x1c01f000, 0x42000000,
-- 0x0010b67a, 0x0201f800, 0x0010a86e, 0x0201f800,
-- 0x0010698c, 0x59300203, 0x4933c857, 0x4803c857,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f803, 0x0201f000, 0x00106982, 0x001094d7,
-- 0x001094e6, 0x001094d8, 0x001094d5, 0x001094d5,
-- 0x001094d5, 0x001094d5, 0x001094d5, 0x001094d5,
-- 0x001094d5, 0x001094d5, 0x001094d5, 0x001094d5,
-- 0x001094d5, 0x0201f800, 0x00100615, 0x1c01f000,
-- 0x59300403, 0x82000580, 0x00000052, 0x02000000,
-- 0x00108b39, 0x0201f800, 0x00104a83, 0x59325808,
-- 0x4a025a06, 0x00000006, 0x0201f800, 0x00020381,
-- 0x0201f000, 0x00107698, 0x59301804, 0x840c0520,
-- 0x48026004, 0x598c000d, 0x81300580, 0x04020010,
-- 0x8c0c1d20, 0x04020010, 0x42001000, 0x0010b5f4,
-- 0x50081000, 0x58080002, 0x82000580, 0x00000100,
-- 0x0400000e, 0x5808000c, 0x81300580, 0x02020800,
-- 0x00100615, 0x4978100c, 0x0401f003, 0x8c0c1d20,
-- 0x040207dc, 0x0201f800, 0x00106619, 0x040007d9,
-- 0x0201f800, 0x00100615, 0x0201f800, 0x00106be2,
-- 0x040007f9, 0x59300203, 0x82000c80, 0x0000000e,
-- 0x02021800, 0x00100615, 0x0c01f7bd, 0x4933c857,
-+ 0x040007e7, 0x42001000, 0x00000008, 0x0201f800,
-+ 0x001049da, 0x040007e2, 0x592c040b, 0x84000540,
-+ 0x48025c0b, 0x0401f7e9, 0x42000800, 0x00000004,
-+ 0x0201f000, 0x0010426c, 0x83380580, 0x00000015,
-+ 0x04020005, 0x0201f800, 0x00109b50, 0x02000800,
-+ 0x001045e1, 0x1c01f000, 0x83380580, 0x00000015,
-+ 0x0402001d, 0x4c580000, 0x83cc1400, 0x00000008,
-+ 0x4200b000, 0x00000002, 0x83341c00, 0x00000006,
-+ 0x0201f800, 0x00107d41, 0x04020012, 0x83cc1400,
-+ 0x0000000a, 0x4200b000, 0x00000002, 0x83341c00,
-+ 0x00000008, 0x0201f800, 0x00107d41, 0x04020009,
-+ 0x59342200, 0x59cc1007, 0x800811c0, 0x04000003,
-+ 0x480a6801, 0x84102542, 0x8410251a, 0x48126a00,
-+ 0x5c00b000, 0x1c01f000, 0x42000000, 0x0010b04a,
-+ 0x0201f800, 0x0010a260, 0x0201f800, 0x00106476,
-+ 0x59300203, 0x4933c857, 0x4803c857, 0x82000c80,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x0c01f803,
-+ 0x0201f000, 0x00106463, 0x00108f5e, 0x00108f6d,
-+ 0x00108f5f, 0x00108f5c, 0x00108f5c, 0x00108f5c,
-+ 0x00108f5c, 0x00108f5c, 0x00108f5c, 0x00108f5c,
-+ 0x00108f5c, 0x00108f5c, 0x00108f5c, 0x00108f5c,
-+ 0x0201f800, 0x001004ef, 0x1c01f000, 0x59300403,
-+ 0x82000580, 0x00000052, 0x02000000, 0x00108586,
-+ 0x0201f800, 0x00104975, 0x59325808, 0x4a025a06,
-+ 0x00000006, 0x0201f800, 0x000202e9, 0x0201f000,
-+ 0x0010719c, 0x59301804, 0x840c0520, 0x48026004,
-+ 0x598c000d, 0x81300580, 0x04020010, 0x8c0c1d20,
-+ 0x04020010, 0x42001000, 0x0010afc4, 0x50081000,
-+ 0x58080002, 0x82000580, 0x00000100, 0x0400000f,
-+ 0x5808000c, 0x81300580, 0x02020800, 0x001004ef,
-+ 0x4978100c, 0x0401f003, 0x8c0c1d20, 0x040207dc,
-+ 0x0201f800, 0x0010ccce, 0x80c40040, 0x040007d8,
-+ 0x0201f800, 0x001004ef, 0x0201f800, 0x001066d5,
-+ 0x040007f8, 0x59300203, 0x82000c80, 0x0000000e,
-+ 0x02021800, 0x001004ef, 0x0c01f7bc, 0x4933c857,
- 0x4c500000, 0x4c540000, 0x4c580000, 0x592c0c07,
-- 0x4806580a, 0x59cc0809, 0x48065807, 0x59cc0a08,
-- 0x4806580b, 0x59a8086e, 0x82040500, 0x000003ff,
-+ 0x4806580a, 0x59cc0809, 0x48065807, 0x59cc0808,
-+ 0x4806580b, 0x59a8086b, 0x82040500, 0x000003ff,
- 0x800010c4, 0x8c040d14, 0x04000005, 0x59cc0002,
- 0x82000500, 0x00000003, 0x80081480, 0x82080480,
-- 0x000000f1, 0x02021800, 0x00100615, 0x480a621a,
-- 0x412c0800, 0x0201f800, 0x00100819, 0x02000800,
-- 0x00100615, 0x492c0809, 0x58040408, 0x84000552,
-+ 0x000000f1, 0x02021800, 0x001004ef, 0x480a621a,
-+ 0x412c0800, 0x0201f800, 0x00100704, 0x02000800,
-+ 0x001004ef, 0x492c0809, 0x58040408, 0x84000552,
- 0x84000540, 0x48000c08, 0x82081400, 0x00000003,
- 0x80081104, 0x83cca400, 0x00000006, 0x832cac00,
- 0x00000004, 0x42000800, 0x00000010, 0x82080480,
- 0x00000010, 0x04021003, 0x40080800, 0x80000580,
-- 0x4004b000, 0x4c000000, 0x0201f800, 0x0010a94f,
-+ 0x4004b000, 0x4c000000, 0x0201f800, 0x0010a341,
- 0x5c000000, 0x800001c0, 0x0400000d, 0x412c1000,
-- 0x4c000000, 0x0201f800, 0x00100819, 0x02000800,
-- 0x00100615, 0x492c1001, 0x832cac00, 0x00000004,
-+ 0x4c000000, 0x0201f800, 0x00100704, 0x02000800,
-+ 0x001004ef, 0x492c1001, 0x832cac00, 0x00000004,
- 0x5c000000, 0x40001000, 0x0401f7e9, 0x5c00b000,
- 0x5c00a800, 0x5c00a000, 0x1c01f000, 0x4933c857,
- 0x4d2c0000, 0x4c380000, 0x59325808, 0x5930021a,
-@@ -9615,7 +9252,7 @@ uint32_t risc_code01[] = {
- 0x00000c00, 0x0400000b, 0x0401f00b, 0x8c08153e,
- 0x04000006, 0x4a025a06, 0x00000007, 0x80081080,
- 0x80081000, 0x0401f003, 0x4a025a06, 0x00000015,
-- 0x480a5807, 0x42000000, 0x0010bcd8, 0x50007000,
-+ 0x480a5807, 0x42000000, 0x0010b6a8, 0x50007000,
- 0x5838000b, 0x80000540, 0x04020008, 0x4930700c,
- 0x4930700b, 0x58380002, 0x82000580, 0x00000000,
- 0x04020809, 0x0401f005, 0x82001400, 0x00000000,
-@@ -9628,807 +9265,758 @@ uint32_t risc_code01[] = {
- 0x82080480, 0x00000010, 0x04021003, 0x80000580,
- 0x0401f003, 0x42001000, 0x00000010, 0x4800700d,
- 0x48087004, 0x800810c4, 0x48087005, 0x40381000,
-- 0x0201f800, 0x001008a1, 0x1c01f000, 0x4d2c0000,
-- 0x0201f800, 0x00100819, 0x02000800, 0x00100615,
-- 0x42000800, 0x0010bcd8, 0x452c0800, 0x497a580b,
-- 0x497a580c, 0x497a580d, 0x4a025809, 0x001095b6,
-+ 0x0201f800, 0x0010079e, 0x1c01f000, 0x4d2c0000,
-+ 0x0201f800, 0x00100704, 0x02000800, 0x001004ef,
-+ 0x42000800, 0x0010b6a8, 0x452c0800, 0x497a580b,
-+ 0x497a580c, 0x497a580d, 0x4a025809, 0x0010903e,
- 0x4a025802, 0x00000100, 0x4a025801, 0x00000000,
- 0x5c025800, 0x1c01f000, 0x4833c857, 0x4d300000,
- 0x4d2c0000, 0x4c5c0000, 0x4030b800, 0x585c000a,
- 0x80025d40, 0x04020004, 0x585c000c, 0x4c000000,
- 0x0401f044, 0x585c0002, 0x82000580, 0x00000100,
- 0x04020022, 0x592c0801, 0x4c040000, 0x0201f800,
-- 0x0010083a, 0x5c000800, 0x800409c0, 0x0400001c,
-+ 0x0010072e, 0x5c000800, 0x800409c0, 0x0400001c,
- 0x4804b80a, 0x585c100d, 0x800811c0, 0x04020005,
-- 0x40065800, 0x0201f800, 0x00100843, 0x0401f014,
-+ 0x40065800, 0x0201f800, 0x0010073b, 0x0401f014,
- 0x82080480, 0x00000010, 0x04021003, 0x80000580,
- 0x0401f003, 0x42001000, 0x00000010, 0x4800b80d,
- 0x4808b804, 0x800810c4, 0x4808b805, 0x82040400,
- 0x00000004, 0x4800b803, 0x405c1000, 0x0201f800,
-- 0x001008a1, 0x0401f025, 0x0401f828, 0x585c000c,
-+ 0x0010079e, 0x0401f025, 0x0401f828, 0x585c000c,
- 0x80026540, 0x59300000, 0x80000d40, 0x04020002,
- 0x4800b80b, 0x4800b80c, 0x497a6000, 0x4c000000,
- 0x4978b80a, 0x59325808, 0x4a025a04, 0x00000103,
- 0x59300402, 0x48025c06, 0x592c100b, 0x4c080000,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00108ee7,
-+ 0x0201f800, 0x000202e9, 0x0201f800, 0x00108942,
- 0x5c001000, 0x8c081518, 0x04000004, 0x0201f800,
-- 0x00108f88, 0x0401f003, 0x0201f800, 0x000208b4,
-+ 0x001089f0, 0x0401f003, 0x0201f800, 0x000207bb,
- 0x405c7000, 0x5c000000, 0x80026540, 0x04000003,
- 0x59325808, 0x0401ff78, 0x5c00b800, 0x5c025800,
- 0x5c026000, 0x1c01f000, 0x483bc857, 0x5838000a,
-- 0x40025800, 0x0201f800, 0x00100843, 0x5838000c,
-+ 0x40025800, 0x0201f800, 0x0010073b, 0x5838000c,
- 0x80026540, 0x59300008, 0x80025d40, 0x4a025a06,
- 0x00000002, 0x1c01f000, 0x4803c857, 0x4d1c0000,
- 0x497a601c, 0x41323800, 0x40026000, 0x4d3c0000,
-- 0x42027800, 0x00000005, 0x0401f840, 0x5c027800,
-+ 0x42027800, 0x00000005, 0x0401f83f, 0x5c027800,
- 0x411e6000, 0x59300414, 0x84000502, 0x48026414,
- 0x5c023800, 0x1c01f000, 0x481bc857, 0x4933c857,
- 0x4c5c0000, 0x4c600000, 0x4010b800, 0x4014c000,
-- 0x0201f800, 0x0010a766, 0x0201f800, 0x0010393e,
-- 0x04000008, 0x40602800, 0x405c3000, 0x0201f800,
-- 0x0010a258, 0x82000540, 0x00000001, 0x0401f002,
-- 0x80000580, 0x5c00c000, 0x5c00b800, 0x1c01f000,
-- 0x4803c856, 0x4d300000, 0x42026000, 0x0010cfc0,
-- 0x59a8000e, 0x81640580, 0x0400001a, 0x59300c06,
-- 0x82040580, 0x00000001, 0x0400000d, 0x82040580,
-- 0x00000004, 0x04000006, 0x82040580, 0x00000010,
-- 0x02000800, 0x00108aad, 0x0401f009, 0x59300203,
-- 0x82000d80, 0x00000007, 0x04000005, 0x4807c857,
-- 0x0201f800, 0x0010909d, 0x04020808, 0x83326400,
-- 0x00000024, 0x41580000, 0x81300480, 0x040017e5,
-- 0x5c026000, 0x1c01f000, 0x4933c857, 0x59300403,
-- 0x4803c857, 0x0201f800, 0x0010698c, 0x4df00000,
-- 0x59300406, 0x4803c857, 0x82000d80, 0x00000002,
-- 0x04000018, 0x82000d80, 0x00000001, 0x04000009,
-- 0x82000d80, 0x00000004, 0x04000006, 0x4933c856,
-- 0x5c03e000, 0x02000800, 0x00106982, 0x0401f03c,
-- 0x59300203, 0x82000d80, 0x00000001, 0x04000018,
-- 0x82000d80, 0x00000002, 0x04000026, 0x82000d80,
-- 0x00000005, 0x04000023, 0x0201f800, 0x00100615,
-- 0x59300203, 0x82000d80, 0x00000009, 0x0400000c,
-- 0x82000d80, 0x0000000b, 0x04000009, 0x82000d80,
-- 0x0000000a, 0x04000017, 0x82000d80, 0x0000000c,
-- 0x04000014, 0x0201f800, 0x00100615, 0x598c000d,
-- 0x81300580, 0x04020004, 0x0201f800, 0x00106be2,
-- 0x0402000c, 0x59300004, 0x4803c857, 0x8c000520,
-- 0x04000004, 0x84000520, 0x48026004, 0x0401f005,
-- 0x0201f800, 0x00106619, 0x02020800, 0x00100615,
-- 0x5c03e000, 0x02000800, 0x00106982, 0x59300406,
-+ 0x0201f800, 0x0010a137, 0x8d0e1d20, 0x04000008,
-+ 0x40602800, 0x405c3000, 0x0201f800, 0x00109c1c,
-+ 0x82000540, 0x00000001, 0x0401f002, 0x80000580,
-+ 0x5c00c000, 0x5c00b800, 0x1c01f000, 0x4803c856,
-+ 0x4d300000, 0x42026000, 0x0010d8d4, 0x59a8000d,
-+ 0x81640580, 0x0400001a, 0x59300c06, 0x82040580,
-+ 0x00000001, 0x0400000d, 0x82040580, 0x00000004,
-+ 0x04000006, 0x82040580, 0x00000010, 0x02000800,
-+ 0x001084f8, 0x0401f009, 0x59300203, 0x82000d80,
-+ 0x00000007, 0x04000005, 0x4807c857, 0x0201f800,
-+ 0x00108b0d, 0x04020808, 0x83326400, 0x00000024,
-+ 0x41580000, 0x81300480, 0x040017e5, 0x5c026000,
-+ 0x1c01f000, 0x4933c857, 0x59300403, 0x4803c857,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x59300406,
-+ 0x4803c857, 0x82000d80, 0x00000002, 0x04000018,
-+ 0x82000d80, 0x00000001, 0x04000009, 0x82000d80,
-+ 0x00000004, 0x04000006, 0x4933c856, 0x5c03e000,
-+ 0x02000800, 0x00106463, 0x0401f03d, 0x59300203,
-+ 0x82000d80, 0x00000001, 0x04000018, 0x82000d80,
-+ 0x00000002, 0x04000027, 0x82000d80, 0x00000005,
-+ 0x04000024, 0x0201f800, 0x001004ef, 0x59300203,
-+ 0x82000d80, 0x00000009, 0x0400000c, 0x82000d80,
-+ 0x0000000b, 0x04000009, 0x82000d80, 0x0000000a,
-+ 0x04000018, 0x82000d80, 0x0000000c, 0x04000015,
-+ 0x0201f800, 0x001004ef, 0x598c000d, 0x81300580,
-+ 0x04020004, 0x0201f800, 0x001066d5, 0x0402000d,
-+ 0x59300004, 0x4803c857, 0x8c000520, 0x04000004,
-+ 0x84000520, 0x48026004, 0x0401f006, 0x0201f800,
-+ 0x0010ccce, 0x80c40040, 0x02020800, 0x001004ef,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x59300406,
- 0x82000d80, 0x00000002, 0x04000009, 0x0201f800,
-- 0x00104a83, 0x0201f800, 0x00108f05, 0x02000800,
-- 0x00107da6, 0x8d3e7d00, 0x04000003, 0x0201f000,
-- 0x00107698, 0x4a02621d, 0x00000001, 0x4a026403,
-+ 0x00104975, 0x0201f800, 0x00108969, 0x02000800,
-+ 0x001078c2, 0x8d3e7d00, 0x04000003, 0x0201f000,
-+ 0x0010719c, 0x4a02621d, 0x00000001, 0x4a026403,
- 0x00000085, 0x4a026203, 0x00000009, 0x4a026406,
- 0x00000002, 0x42000800, 0x8000004b, 0x0201f000,
-- 0x00020855, 0x4933c857, 0x59368c03, 0x4c180000,
-+ 0x0002075c, 0x4933c857, 0x59368c03, 0x4c180000,
- 0x59300203, 0x82003480, 0x0000000e, 0x02021800,
-- 0x00100615, 0x0c01f803, 0x5c003000, 0x1c01f000,
-- 0x001096da, 0x00109bb9, 0x00109cbd, 0x001096da,
-- 0x001096da, 0x001096da, 0x001096da, 0x001096da,
-- 0x001096fd, 0x001096da, 0x001096da, 0x001096da,
-- 0x001096da, 0x001096da, 0x0201f800, 0x00100615,
-+ 0x001004ef, 0x0c01f803, 0x5c003000, 0x1c01f000,
-+ 0x00109162, 0x0010965b, 0x0010975f, 0x00109162,
-+ 0x00109162, 0x00109162, 0x00109162, 0x00109162,
-+ 0x00109185, 0x00109162, 0x00109162, 0x00109162,
-+ 0x00109162, 0x00109162, 0x0201f800, 0x001004ef,
- 0x4933c857, 0x42028800, 0x0000ffff, 0x813669c0,
- 0x04000002, 0x59368c03, 0x4c180000, 0x59300203,
-- 0x82003480, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f803, 0x5c003000, 0x1c01f000, 0x001096f9,
-- 0x00109f70, 0x001096f9, 0x001096f9, 0x001096f9,
-- 0x001096f9, 0x001096f9, 0x0010a779, 0x00109edd,
-- 0x0010a34a, 0x0010a380, 0x0010a34a, 0x0010a380,
-- 0x001096f9, 0x0201f800, 0x00100615, 0x0201f800,
-- 0x00100615, 0x83383480, 0x00000051, 0x02021800,
-- 0x00100615, 0x41380000, 0x493bc857, 0x4d1c0000,
-+ 0x82003480, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f803, 0x5c003000, 0x1c01f000, 0x00109181,
-+ 0x00109a0d, 0x00109181, 0x00109181, 0x00109181,
-+ 0x00109181, 0x00109181, 0x0010a14a, 0x0010997c,
-+ 0x00109d17, 0x00109d4d, 0x00109d17, 0x00109d4d,
-+ 0x00109181, 0x0201f800, 0x001004ef, 0x0201f800,
-+ 0x001004ef, 0x83383480, 0x00000051, 0x02021800,
-+ 0x001004ef, 0x41380000, 0x493bc857, 0x4d1c0000,
- 0x4d400000, 0x0c01f804, 0x5c028000, 0x5c023800,
-- 0x1c01f000, 0x0010975a, 0x0010993d, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x00109948, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010975a,
-- 0x0010977c, 0x001097ba, 0x001097d1, 0x0010982d,
-- 0x00109894, 0x001098d2, 0x00109902, 0x0010975a,
-- 0x0010975a, 0x00109950, 0x0010975a, 0x0010975a,
-- 0x0010995e, 0x00109967, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x001099e9,
-- 0x0010975a, 0x0010975a, 0x00109868, 0x0010975a,
-- 0x0010975a, 0x001099c0, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x001099f7, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x00109a40, 0x0010975a, 0x0010975a,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010975a,
-- 0x00109a8d, 0x0010975a, 0x00109ab9, 0x00109ac4,
-- 0x0010975a, 0x0010975a, 0x0010975c, 0x00109acf,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x0010976b,
-- 0x0010975a, 0x0010975a, 0x0010975a, 0x00109ad6,
-- 0x00109ade, 0x00109afc, 0x0201f800, 0x00100615,
-- 0x4933c857, 0x0201f800, 0x0010a3b0, 0x040203a8,
-- 0x0201f800, 0x00101eb0, 0x040203a5, 0x59cc0407,
-+ 0x1c01f000, 0x001091e2, 0x001093c1, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001093cc, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091e2,
-+ 0x00109204, 0x00109241, 0x00109258, 0x001092b4,
-+ 0x0010931a, 0x00109357, 0x00109387, 0x001091e2,
-+ 0x001091e2, 0x001093d4, 0x001091e2, 0x001091e2,
-+ 0x001093e2, 0x001093eb, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x00109485,
-+ 0x001091e2, 0x001091e2, 0x001092ef, 0x001091e2,
-+ 0x001091e2, 0x00109444, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x00109493, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001094df, 0x001091e2, 0x001091e2,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091e2,
-+ 0x0010952f, 0x001091e2, 0x0010955b, 0x00109566,
-+ 0x001091e2, 0x001091e2, 0x001091e4, 0x00109571,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x001091f3,
-+ 0x001091e2, 0x001091e2, 0x001091e2, 0x00109578,
-+ 0x00109580, 0x0010959e, 0x0201f800, 0x001004ef,
-+ 0x4933c857, 0x0201f800, 0x00109d7d, 0x040203c2,
-+ 0x0201f800, 0x00101cd8, 0x040203bf, 0x59cc0407,
- 0x4802601c, 0x4a026403, 0x00000045, 0x4a026203,
-- 0x00000001, 0x0201f000, 0x00106470, 0x4933c857,
-- 0x0201f800, 0x0010a3b0, 0x04020399, 0x0201f800,
-- 0x00101eb0, 0x04020396, 0x0401fbd6, 0x0402019e,
-+ 0x00000001, 0x0201f000, 0x00106339, 0x4933c857,
-+ 0x0201f800, 0x00109d7d, 0x040203b3, 0x0201f800,
-+ 0x00101cd8, 0x040203b0, 0x0401fbf0, 0x0402019b,
- 0x59cc0007, 0x4802601c, 0x4a026403, 0x0000004a,
-- 0x4a026203, 0x00000001, 0x0201f000, 0x00106470,
-- 0x4933c857, 0x0201f800, 0x00101eb0, 0x04020009,
-- 0x0201f800, 0x0010473b, 0x04020006, 0x82000500,
-+ 0x4a026203, 0x00000001, 0x0201f000, 0x00106339,
-+ 0x4933c857, 0x0201f800, 0x00101cd8, 0x04020009,
-+ 0x0201f800, 0x00104614, 0x04020006, 0x82000500,
- 0x00000009, 0x82000580, 0x00000008, 0x04020008,
- 0x4a026403, 0x00000009, 0x4a02641a, 0x00000009,
-- 0x4a02621a, 0x00000000, 0x0401f1b6, 0x0201f800,
-- 0x00104858, 0x04000018, 0x0201f800, 0x0010a041,
-- 0x0402001f, 0x42028000, 0x00000029, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x0201f800, 0x00104480, 0x4a026403, 0x00000008,
-- 0x42003000, 0x00000003, 0x0201f800, 0x0010393e,
-- 0x040001a0, 0x4a026203, 0x00000007, 0x41782800,
-- 0x0401f18b, 0x0201f800, 0x0010a1ec, 0x040207e7,
-- 0x4a026403, 0x00000009, 0x4a02641a, 0x0000000e,
-- 0x4a02621a, 0x00001900, 0x0401f192, 0x4a026403,
-- 0x00000009, 0x4a02641a, 0x00000003, 0x4a02621a,
-- 0x00000f00, 0x0401f18b, 0x4933c857, 0x0201f800,
-- 0x00101eb0, 0x0402034a, 0x0201f800, 0x0010473b,
-- 0x04020347, 0x493a6403, 0x0201f800, 0x0010a01c,
-- 0x04020006, 0x42003000, 0x00000005, 0x4a026403,
-- 0x00000006, 0x0401f7d9, 0x4a026403, 0x00000007,
-- 0x4a02641a, 0x00000009, 0x4a02621a, 0x00000000,
-- 0x0401f174, 0x4933c857, 0x0201f800, 0x0010473b,
-- 0x04020333, 0x0201f800, 0x0010a3b0, 0x02000800,
-- 0x00101eb0, 0x0402032e, 0x0201f800, 0x00104858,
-- 0x04020005, 0x42027800, 0x00000001, 0x0201f800,
-- 0x001043bd, 0x0201f800, 0x0010484b, 0x04020031,
-- 0x59cc0206, 0x82003500, 0x00000003, 0x04020034,
-- 0x82003480, 0x00000014, 0x04001031, 0x5934300a,
-- 0x84183516, 0x82000580, 0x00000014, 0x04020002,
-- 0x84183556, 0x481a680a, 0x59cc0406, 0x82000500,
-- 0x00000003, 0x04020026, 0x0201f800, 0x0010a08e,
-- 0x0402002e, 0x0201f800, 0x00104836, 0x04020007,
-- 0x4c600000, 0x4178c000, 0x417a7800, 0x0201f800,
-- 0x00101e48, 0x5c00c000, 0x836c0580, 0x00000003,
-- 0x04020009, 0x42003000, 0x00000006, 0x0201f800,
-- 0x0010a75e, 0x42000000, 0x0010b664, 0x0201f800,
-- 0x0010a86e, 0x0201f800, 0x001044e1, 0x4a026403,
-- 0x0000000a, 0x42003000, 0x00000020, 0x0401f78f,
-- 0x4a026403, 0x0000000b, 0x4a02641a, 0x00000009,
-- 0x4a02621a, 0x00001e00, 0x0401f12a, 0x42000000,
-- 0x0010b65f, 0x0201f800, 0x0010a86e, 0x4a026403,
-- 0x0000000b, 0x4a02641a, 0x00000007, 0x4a02621a,
-- 0x00000000, 0x0401f11f, 0x4a026403, 0x0000000b,
-- 0x4a02641a, 0x00000003, 0x4a02621a, 0x00000000,
-- 0x0401f118, 0x4933c857, 0x0201f800, 0x0010473b,
-- 0x040202d7, 0x0201f800, 0x0010a3b0, 0x040202d4,
-- 0x0201f800, 0x00101eb0, 0x040202d1, 0x59cc0206,
-- 0x82003500, 0x00000003, 0x04020020, 0x82003480,
-- 0x00000014, 0x0400101d, 0x59cc0406, 0x82000500,
-- 0x00000003, 0x04020019, 0x59340400, 0x82000580,
-- 0x00000707, 0x0400001c, 0x417a7800, 0x4c600000,
-- 0x4178c000, 0x0201f800, 0x00101e48, 0x5c00c000,
-- 0x42003000, 0x0000000a, 0x0201f800, 0x0010a75e,
-- 0x42000000, 0x0010b661, 0x0201f800, 0x0010a86e,
-- 0x4a026403, 0x0000000c, 0x41782800, 0x42003000,
-- 0x00000021, 0x0401f749, 0x4a026403, 0x0000000d,
-+ 0x4a02621a, 0x00000000, 0x0401f1b2, 0x0201f800,
-+ 0x00104744, 0x04000017, 0x0201f800, 0x00109ae0,
-+ 0x0402001e, 0x42028000, 0x00000029, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
-+ 0x0201f800, 0x00104346, 0x4a026403, 0x00000008,
-+ 0x42003000, 0x00000003, 0x8d0e1d20, 0x0400019d,
-+ 0x4a026203, 0x00000007, 0x41782800, 0x0401f188,
-+ 0x0201f800, 0x00109bad, 0x040207e8, 0x4a026403,
-+ 0x00000009, 0x4a02641a, 0x0000000e, 0x4a02621a,
-+ 0x00001900, 0x0401f18f, 0x4a026403, 0x00000009,
-+ 0x4a02641a, 0x00000003, 0x4a02621a, 0x00000f00,
-+ 0x0401f188, 0x4933c857, 0x0201f800, 0x00101cd8,
-+ 0x04020365, 0x0201f800, 0x00104614, 0x04020362,
-+ 0x493a6403, 0x0201f800, 0x00109abb, 0x04020006,
-+ 0x42003000, 0x00000005, 0x4a026403, 0x00000006,
-+ 0x0401f7da, 0x4a026403, 0x00000007, 0x4a02641a,
-+ 0x00000009, 0x4a02621a, 0x00000000, 0x0401f171,
-+ 0x4933c857, 0x0201f800, 0x00104614, 0x0402034e,
-+ 0x0201f800, 0x00109d7d, 0x02000800, 0x00101cd8,
-+ 0x04020349, 0x0201f800, 0x00104744, 0x04020005,
-+ 0x42027800, 0x00000001, 0x0201f800, 0x0010425d,
-+ 0x0201f800, 0x0010472e, 0x04020031, 0x59cc0206,
-+ 0x82003500, 0x00000003, 0x04020034, 0x82003480,
-+ 0x00000014, 0x04001031, 0x5934300a, 0x84183516,
-+ 0x82000580, 0x00000014, 0x04020002, 0x84183556,
-+ 0x481a680a, 0x59cc0406, 0x82000500, 0x00000003,
-+ 0x04020026, 0x0201f800, 0x00109b2d, 0x0402002e,
-+ 0x0201f800, 0x00104719, 0x04020007, 0x4c600000,
-+ 0x4178c000, 0x417a7800, 0x0201f800, 0x00101c5e,
-+ 0x5c00c000, 0x836c0580, 0x00000003, 0x04020009,
-+ 0x42003000, 0x00000006, 0x0201f800, 0x0010a12f,
-+ 0x42000000, 0x0010b034, 0x0201f800, 0x0010a260,
-+ 0x0201f800, 0x001043a7, 0x4a026403, 0x0000000a,
-+ 0x42003000, 0x00000020, 0x0401f790, 0x4a026403,
-+ 0x0000000b, 0x4a02641a, 0x00000009, 0x4a02621a,
-+ 0x00001e00, 0x0401f127, 0x42000000, 0x0010b02f,
-+ 0x0201f800, 0x0010a260, 0x4a026403, 0x0000000b,
- 0x4a02641a, 0x00000007, 0x4a02621a, 0x00000000,
-- 0x0401f0e4, 0x4a026403, 0x0000000d, 0x4a02641a,
-- 0x00000009, 0x4a02621a, 0x00001e00, 0x0401f0dd,
-- 0x4933c857, 0x0201f800, 0x0010473b, 0x0402029c,
-- 0x0201f800, 0x0010a3b0, 0x04020299, 0x0201f800,
-- 0x00101eb0, 0x04020296, 0x0401fad6, 0x0402001a,
-- 0x493a6403, 0x4c5c0000, 0x0401fadc, 0x0402000e,
-- 0x4a026403, 0x0000002e, 0x4014b800, 0x0201f800,
-- 0x0010393e, 0x0400000e, 0x4a026203, 0x00000007,
-- 0x405c2800, 0x42003000, 0x00000024, 0x5c00b800,
-- 0x0401f0af, 0x4a026403, 0x0000000d, 0x4a02641a,
-- 0x00000007, 0x4a02621a, 0x00000000, 0x5c00b800,
-- 0x0401f0b8, 0x4a026403, 0x0000000d, 0x4a02641a,
-- 0x00000009, 0x4a02621a, 0x00001e00, 0x0401f0b1,
-- 0x4933c857, 0x0201f800, 0x0010473b, 0x040206f1,
-- 0x59a80026, 0x82000500, 0x00000009, 0x82000580,
-- 0x00000008, 0x040006eb, 0x0201f800, 0x0010484b,
-- 0x0402002d, 0x0201f800, 0x0010a096, 0x04020007,
-- 0x4a026403, 0x0000000e, 0x41782800, 0x42003000,
-- 0x00000052, 0x0401f6f9, 0x4933c857, 0x42003000,
-- 0x00000003, 0x0201f800, 0x0010a766, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-- 0x59340200, 0x84000558, 0x48026a00, 0x42000800,
-- 0x0000000b, 0x0201f800, 0x001043c7, 0x0201f800,
-- 0x0010393e, 0x0400007c, 0x42003000, 0x00000007,
-- 0x0401f061, 0x4933c857, 0x4a026403, 0x0000000f,
-- 0x4a02641a, 0x00000003, 0x4a02621a, 0x00001e00,
-- 0x0401f078, 0x59340400, 0x82000580, 0x00000703,
-- 0x040007f5, 0x0401f040, 0x4933c857, 0x0201f800,
-- 0x0010473b, 0x04020232, 0x59a80026, 0x82000500,
-- 0x00000009, 0x82000580, 0x00000008, 0x0400022c,
-- 0x0201f800, 0x00104842, 0x0402002f, 0x0201f800,
-- 0x0010a0b1, 0x02000800, 0x0010a041, 0x04020007,
-- 0x4a026403, 0x00000010, 0x41782800, 0x42003000,
-- 0x00000050, 0x0401f6b9, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x00101de2, 0x5c027800, 0x42003000,
-- 0x00000003, 0x0201f800, 0x0010a766, 0x42000000,
-- 0x0010b663, 0x0201f800, 0x0010a86e, 0x59340200,
-- 0x84000558, 0x48026a00, 0x0401f7c5, 0x4a026403,
-- 0x00000011, 0x4a02641a, 0x00000003, 0x4a02621a,
-- 0x00001e00, 0x0401f043, 0x4933c857, 0x0201f800,
-- 0x00101eb0, 0x02000800, 0x0010a3b0, 0x04020200,
-- 0x0401fa40, 0x04020008, 0x4a026403, 0x00000012,
-- 0x0401f038, 0x59340400, 0x82000580, 0x00000703,
-- 0x040007eb, 0x4d3c0000, 0x417a7800, 0x42028000,
-- 0x00000029, 0x0201f800, 0x00101de2, 0x5c027800,
-- 0x42003000, 0x00000017, 0x0201f800, 0x0010a766,
-- 0x42000000, 0x0010b663, 0x0201f800, 0x0010a86e,
-- 0x0201f800, 0x0010393e, 0x0400001b, 0x42003000,
-+ 0x0401f11c, 0x4a026403, 0x0000000b, 0x4a02641a,
-+ 0x00000003, 0x4a02621a, 0x00000000, 0x0401f115,
-+ 0x4933c857, 0x0201f800, 0x00104614, 0x040202f2,
-+ 0x0201f800, 0x00109d7d, 0x040202ef, 0x0201f800,
-+ 0x00101cd8, 0x040202ec, 0x59cc0206, 0x82003500,
-+ 0x00000003, 0x04020020, 0x82003480, 0x00000014,
-+ 0x0400101d, 0x59cc0406, 0x82000500, 0x00000003,
-+ 0x04020019, 0x59340400, 0x82000580, 0x00000707,
-+ 0x0400001c, 0x417a7800, 0x4c600000, 0x4178c000,
-+ 0x0201f800, 0x00101c5e, 0x5c00c000, 0x42003000,
-+ 0x0000000a, 0x0201f800, 0x0010a12f, 0x42000000,
-+ 0x0010b031, 0x0201f800, 0x0010a260, 0x4a026403,
-+ 0x0000000c, 0x41782800, 0x42003000, 0x00000021,
-+ 0x0401f74a, 0x4a026403, 0x0000000d, 0x4a02641a,
-+ 0x00000007, 0x4a02621a, 0x00000000, 0x0401f0e1,
-+ 0x4a026403, 0x0000000d, 0x4a02641a, 0x00000009,
-+ 0x4a02621a, 0x00001e00, 0x0401f0da, 0x4933c857,
-+ 0x0201f800, 0x00104614, 0x040202b7, 0x0201f800,
-+ 0x00109d7d, 0x040202b4, 0x0201f800, 0x00101cd8,
-+ 0x040202b1, 0x0401faf1, 0x04020019, 0x493a6403,
-+ 0x4c5c0000, 0x0401faf7, 0x0402000d, 0x4a026403,
-+ 0x0000002e, 0x4014b800, 0x8d0e1d20, 0x0400000e,
-+ 0x4a026203, 0x00000007, 0x405c2800, 0x42003000,
-+ 0x00000024, 0x5c00b800, 0x0401f0ad, 0x4a026403,
-+ 0x0000000d, 0x4a02641a, 0x00000007, 0x4a02621a,
-+ 0x00000000, 0x5c00b800, 0x0401f0b6, 0x4a026403,
-+ 0x0000000d, 0x4a02641a, 0x00000009, 0x4a02621a,
-+ 0x00001e00, 0x0401f0af, 0x4933c857, 0x0201f800,
-+ 0x00104614, 0x040206f3, 0x59a80023, 0x82000500,
-+ 0x00000009, 0x82000580, 0x00000008, 0x040006ed,
-+ 0x0201f800, 0x0010472e, 0x0402002c, 0x0201f800,
-+ 0x00109b35, 0x04020007, 0x4a026403, 0x0000000e,
-+ 0x41782800, 0x42003000, 0x00000052, 0x0401f6fb,
-+ 0x4933c857, 0x42003000, 0x00000003, 0x0201f800,
-+ 0x0010a137, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010caa0, 0x5c027800, 0x42000000, 0x0010b033,
-+ 0x0201f800, 0x0010a260, 0x59340200, 0x84000558,
-+ 0x48026a00, 0x42000800, 0x0000000b, 0x0201f800,
-+ 0x0010426c, 0x8d0e1d20, 0x0400007b, 0x42003000,
-+ 0x00000007, 0x0401f060, 0x4933c857, 0x4a026403,
-+ 0x0000000f, 0x4a02641a, 0x00000003, 0x4a02621a,
-+ 0x00001e00, 0x0401f077, 0x59340400, 0x82000580,
-+ 0x00000703, 0x040007f5, 0x0401f040, 0x4933c857,
-+ 0x0201f800, 0x00104614, 0x0402024f, 0x59a80023,
-+ 0x82000500, 0x00000009, 0x82000580, 0x00000008,
-+ 0x04000249, 0x0201f800, 0x00104725, 0x0402002f,
-+ 0x0201f800, 0x00109b50, 0x02000800, 0x00109ae0,
-+ 0x04020007, 0x4a026403, 0x00000010, 0x41782800,
-+ 0x42003000, 0x00000050, 0x0401f6bc, 0x4d3c0000,
-+ 0x417a7800, 0x0201f800, 0x0010caa0, 0x5c027800,
-+ 0x42003000, 0x00000003, 0x0201f800, 0x0010a137,
-+ 0x42000000, 0x0010b033, 0x0201f800, 0x0010a260,
-+ 0x59340200, 0x84000558, 0x48026a00, 0x0401f7c6,
-+ 0x4a026403, 0x00000011, 0x4a02641a, 0x00000003,
-+ 0x4a02621a, 0x00001e00, 0x0401f042, 0x4933c857,
-+ 0x0201f800, 0x00101cd8, 0x02000800, 0x00109d7d,
-+ 0x0402021d, 0x0401fa5d, 0x04020008, 0x4a026403,
-+ 0x00000012, 0x0401f037, 0x59340400, 0x82000580,
-+ 0x00000703, 0x040007eb, 0x4d3c0000, 0x417a7800,
-+ 0x42028000, 0x00000029, 0x0201f800, 0x0010caa0,
-+ 0x5c027800, 0x42003000, 0x00000017, 0x0201f800,
-+ 0x0010a137, 0x42000000, 0x0010b033, 0x0201f800,
-+ 0x0010a260, 0x8d0e1d20, 0x0400001b, 0x42003000,
- 0x00000006, 0x42028000, 0x00000029, 0x4933c857,
- 0x4a026403, 0x00000001, 0x4a026203, 0x00000007,
-- 0x4c180000, 0x0201f800, 0x0010a79b, 0x5c003000,
-- 0x41782800, 0x0201f000, 0x0010a250, 0x42028000,
-+ 0x4c180000, 0x0201f800, 0x0010a169, 0x5c003000,
-+ 0x41782800, 0x0201f000, 0x00109c14, 0x42028000,
- 0x00000046, 0x4c140000, 0x4c180000, 0x0201f800,
-- 0x0010a79b, 0x5c003000, 0x5c002800, 0x0201f000,
-- 0x0010a250, 0x4933c857, 0x4a026403, 0x00000001,
-- 0x42000800, 0x0000000b, 0x0201f800, 0x001043c7,
-- 0x4a026203, 0x00000001, 0x0201f000, 0x00106470,
-+ 0x0010a169, 0x5c003000, 0x5c002800, 0x0201f000,
-+ 0x00109c14, 0x4933c857, 0x4a026403, 0x00000001,
-+ 0x42000800, 0x0000000b, 0x0201f800, 0x0010426c,
-+ 0x4a026203, 0x00000001, 0x0201f000, 0x00106339,
- 0x4933c857, 0x42000800, 0x00000009, 0x0201f800,
-- 0x001043c7, 0x4a026403, 0x00000005, 0x0401f7f5,
-- 0x0201f800, 0x0010a3b0, 0x040201b5, 0x0201f800,
-- 0x00101eb0, 0x040201b2, 0x0401f9f2, 0x040207ba,
-+ 0x0010426c, 0x4a026403, 0x00000005, 0x0401f7f5,
-+ 0x0201f800, 0x00109d7d, 0x040201d3, 0x0201f800,
-+ 0x00101cd8, 0x040201d0, 0x0401fa10, 0x040207bb,
- 0x4a026403, 0x00000020, 0x4a026203, 0x00000001,
-- 0x0201f000, 0x00106470, 0x0201f800, 0x00101eb0,
-- 0x040201a7, 0x4a026403, 0x00000023, 0x4a026203,
-- 0x00000001, 0x0201f000, 0x00106470, 0x0201f800,
-- 0x0010a3b0, 0x02000800, 0x00101eb0, 0x0402019c,
-- 0x0401f9dc, 0x040207a4, 0x40300800, 0x59a81010,
-+ 0x0201f000, 0x00106339, 0x0201f800, 0x00101cd8,
-+ 0x040201c5, 0x4a026403, 0x00000023, 0x4a026203,
-+ 0x00000001, 0x0201f000, 0x00106339, 0x0201f800,
-+ 0x00109d7d, 0x02000800, 0x00101cd8, 0x040201ba,
-+ 0x0401f9fa, 0x040207a5, 0x40300800, 0x59a8100f,
- 0x59cc0007, 0x82000500, 0x00ffffff, 0x80080580,
-- 0x04000019, 0x59cc1408, 0x0201f800, 0x00108de9,
-+ 0x04000019, 0x59cc1408, 0x0201f800, 0x00108829,
- 0x0400002d, 0x59cc0c08, 0x4d300000, 0x0201f800,
-- 0x00105b0f, 0x41323800, 0x5c026000, 0x04000026,
-+ 0x001059aa, 0x41323800, 0x5c026000, 0x04000026,
- 0x591c0202, 0x82000580, 0x0000ffff, 0x04000005,
- 0x59cc1208, 0x591c0202, 0x80080580, 0x0402001e,
- 0x591c0406, 0x82000580, 0x00000007, 0x0402001a,
- 0x0401f02c, 0x59cc1208, 0x82080580, 0x0000ffff,
-- 0x0400000c, 0x0201f800, 0x001091d9, 0x04000012,
-+ 0x0400000c, 0x0201f800, 0x00108c55, 0x04000012,
- 0x59cc1408, 0x591c0202, 0x80080580, 0x0402000e,
- 0x591c0009, 0x81340580, 0x04000016, 0x0401f00a,
-- 0x59cc1408, 0x417a7800, 0x0201f800, 0x0010a217,
-+ 0x59cc1408, 0x417a7800, 0x0201f800, 0x00109bdc,
- 0x04020010, 0x59cc1208, 0x82080580, 0x0000ffff,
- 0x04000019, 0x4a026403, 0x00000026, 0x4a02621a,
- 0x00001700, 0x59cc1204, 0x82081580, 0x0000ffff,
- 0x04020798, 0x4a026403, 0x00000025, 0x0401f795,
- 0x591c0406, 0x82000580, 0x00000007, 0x040207f2,
- 0x591c0403, 0x82000580, 0x00000024, 0x04020006,
-- 0x4d300000, 0x411e6000, 0x0201f800, 0x000208b4,
-+ 0x4d300000, 0x411e6000, 0x0201f800, 0x000207bb,
- 0x5c026000, 0x4a026403, 0x00000025, 0x0401f785,
- 0x4933c857, 0x4d3c0000, 0x42027800, 0x00000001,
-- 0x0201f800, 0x001043bd, 0x5c027800, 0x4c580000,
-+ 0x0201f800, 0x0010425d, 0x5c027800, 0x4c580000,
- 0x4200b000, 0x00000002, 0x83a81c00, 0x00000002,
-- 0x83cc1400, 0x0000000b, 0x0201f800, 0x001082ff,
-+ 0x83cc1400, 0x0000000b, 0x0201f800, 0x00107d41,
- 0x5c00b000, 0x04000004, 0x4a026403, 0x00000031,
-- 0x0401f770, 0x0201f800, 0x00107698, 0x0201f800,
-- 0x00104e0d, 0x0402000f, 0x0201f800, 0x00104e1b,
-- 0x04020008, 0x4a035033, 0x00000001, 0x4202d800,
-- 0x00000001, 0x0201f800, 0x00104d76, 0x0401f005,
-- 0x42000000, 0x00000001, 0x0201f800, 0x00104de5,
-- 0x1c01f000, 0x0201f800, 0x00101eb0, 0x0402011c,
-- 0x0401f95c, 0x04020724, 0x493a6403, 0x0401f9ac,
-- 0x04020004, 0x4a026403, 0x0000002b, 0x0401f751,
-- 0x4a026403, 0x0000002c, 0x0401f74e, 0x4933c857,
-- 0x0201f800, 0x00101eb0, 0x0402010d, 0x0201f800,
-- 0x00104836, 0x04020740, 0x0201f800, 0x00104728,
-- 0x0400003c, 0x59cc0408, 0x48026419, 0x59cc0208,
-- 0x48026219, 0x59cc0807, 0x59340002, 0x82000500,
-- 0x00ffffff, 0x80040580, 0x04000012, 0x59a80010,
-- 0x80040580, 0x04020021, 0x59cc1408, 0x0201f800,
-- 0x001091d9, 0x04000023, 0x0201f800, 0x0010a2e8,
-- 0x04000020, 0x0201f800, 0x0010a745, 0x0400001d,
-- 0x491e601e, 0x4a026403, 0x00000036, 0x0401f0e6,
-- 0x59cc1208, 0x82080580, 0x0000ffff, 0x04000009,
-- 0x0201f800, 0x001091d9, 0x04000012, 0x591c0202,
-- 0x59cc0c08, 0x80040580, 0x0402000e, 0x0401f7eb,
-- 0x59cc1408, 0x41327800, 0x0201f800, 0x0010a217,
-- 0x04000008, 0x0401f7e5, 0x4803c856, 0x4a02641a,
-- 0x00000009, 0x4a02621a, 0x00001500, 0x0401f006,
-- 0x4803c856, 0x4a02641a, 0x00000003, 0x4a02621a,
-- 0x00001700, 0x4a026403, 0x00000037, 0x0401f0c6,
-- 0x4803c856, 0x4a026403, 0x00000012, 0x0401f0c2,
-- 0x4933c857, 0x0201f800, 0x00101eb0, 0x040200c4,
-- 0x0201f800, 0x00104836, 0x040206f7, 0x0201f800,
-- 0x00104728, 0x0400003e, 0x59cc0407, 0x48026419,
-- 0x59cc1207, 0x480a6219, 0x82080580, 0x0000ffff,
-- 0x04000005, 0x0201f800, 0x001091d9, 0x0400002c,
-- 0x0401f006, 0x59cc1407, 0x41327800, 0x0201f800,
-- 0x0010a217, 0x04000026, 0x59cc0c07, 0x591c0202,
-- 0x80040580, 0x04020022, 0x4d300000, 0x411e6000,
-- 0x0201f800, 0x0010898b, 0x5c026000, 0x59cc0c09,
-- 0x82040d00, 0x0000ff00, 0x840409c0, 0x0201f800,
-- 0x0010a745, 0x04000016, 0x82040580, 0x00000001,
-- 0x0400000a, 0x82040580, 0x00000005, 0x04000004,
-- 0x82040580, 0x00000007, 0x04020007, 0x591c0008,
-- 0x80000540, 0x04000004, 0x59cc2808, 0x0201f000,
-- 0x0010a2fc, 0x4803c856, 0x4a02641a, 0x00000009,
-- 0x4a02621a, 0x00002a00, 0x0401f006, 0x4803c856,
-- 0x4a02641a, 0x00000003, 0x4a02621a, 0x00000300,
-- 0x4a026403, 0x0000003b, 0x0401f07b, 0x4803c856,
-- 0x4a02641a, 0x0000000b, 0x4a02621a, 0x00000000,
-- 0x0401f7f8, 0x4c080000, 0x0201f800, 0x0010473b,
-- 0x04000026, 0x0201f800, 0x00104711, 0x0201f800,
-- 0x0010a41c, 0x0402001e, 0x59a80026, 0x82000540,
-- 0x00000003, 0x48035026, 0x59a8001d, 0x800000d0,
-- 0x59a80810, 0x82040d00, 0x000000ff, 0x80041540,
-- 0x480b5010, 0x42000800, 0x00000003, 0x0201f800,
-- 0x001069af, 0x497b5028, 0x0201f800, 0x0010393e,
-- 0x04000003, 0x4a032804, 0x000007d0, 0x8c00050a,
-- 0x0402000a, 0x0201f800, 0x000208b4, 0x0201f800,
-- 0x00101bf0, 0x5c001000, 0x1c01f000, 0x0201f800,
-- 0x0010a43e, 0x0401f7fc, 0x5c001000, 0x0201f000,
-- 0x000208b4, 0x0201f800, 0x00101eb0, 0x0402004c,
-- 0x0201f800, 0x0010a443, 0x4a026403, 0x00000047,
-- 0x4a026203, 0x00000001, 0x0201f000, 0x00106470,
-- 0x0201f800, 0x00101eb0, 0x04020041, 0x0201f800,
-- 0x0010a443, 0x4a026403, 0x00000047, 0x4a026203,
-- 0x00000001, 0x0201f000, 0x00106470, 0x0201f800,
-- 0x00101eb0, 0x04020036, 0x0201f800, 0x0010a443,
-- 0x0201f000, 0x000208b4, 0x0401f834, 0x04000030,
-- 0x4a026403, 0x0000004e, 0x4a026203, 0x00000001,
-- 0x0201f000, 0x00106470, 0x4a026403, 0x0000004f,
-- 0x497a601c, 0x59cc0a06, 0x82040d00, 0x000000ff,
-- 0x800409c0, 0x0400065f, 0x82040580, 0x00000001,
-- 0x04020005, 0x59cc0808, 0x59a80005, 0x80040580,
-- 0x04000658, 0x82040580, 0x00000002, 0x0402000a,
-- 0x83cc1400, 0x0000000b, 0x4200b000, 0x00000002,
-- 0x83341c00, 0x00000006, 0x0201f800, 0x001082ff,
-- 0x0400064c, 0x4a02601c, 0x00000001, 0x0401f649,
-- 0x4a026403, 0x00000050, 0x59cc0207, 0x4802601c,
-- 0x0401f644, 0x4a026203, 0x00000001, 0x42000800,
-- 0x80000040, 0x0201f000, 0x00020855, 0x4803c857,
-- 0x0201f000, 0x000208b4, 0x4d2c0000, 0x4c500000,
-- 0x4c580000, 0x4c540000, 0x59a80016, 0x82000c80,
-- 0x00000841, 0x0402102d, 0x0201f800, 0x00100819,
-- 0x0400002a, 0x492e6008, 0x59a80016, 0x48025802,
-- 0x82000400, 0x00000003, 0x80000104, 0x83cca400,
-- 0x00000006, 0x82000c80, 0x0000000b, 0x04001015,
-- 0x4a025811, 0x0000000b, 0x4200b000, 0x0000000b,
-+ 0x0401f770, 0x0201f800, 0x000207bb, 0x4200b000,
-+ 0x00000002, 0x83a81c00, 0x00000000, 0x83cc1400,
-+ 0x0000000d, 0x0201f800, 0x00107d41, 0x04020010,
-+ 0x0201f800, 0x001059a9, 0x0400000d, 0x59300406,
-+ 0x82000580, 0x00000001, 0x04020009, 0x59300403,
-+ 0x82000580, 0x00000002, 0x04020005, 0x59300009,
-+ 0x81340580, 0x02000800, 0x000207bb, 0x0201f800,
-+ 0x00104ca6, 0x0402000f, 0x0201f800, 0x00104cd3,
-+ 0x04020008, 0x4a035030, 0x00000001, 0x4202d800,
-+ 0x00000001, 0x0201f800, 0x00104c16, 0x0401f005,
-+ 0x42000000, 0x00000001, 0x0201f800, 0x00104c7e,
-+ 0x1c01f000, 0x0201f800, 0x00101cd8, 0x04020122,
-+ 0x0401f962, 0x0402070d, 0x493a6403, 0x0401f9b2,
-+ 0x04020004, 0x4a026403, 0x0000002b, 0x0401f739,
-+ 0x4a026403, 0x0000002c, 0x0401f736, 0x4933c857,
-+ 0x0201f800, 0x00105ae9, 0x04020113, 0x0201f800,
-+ 0x00101cd8, 0x04020110, 0x0201f800, 0x00104719,
-+ 0x04020725, 0x0201f800, 0x001045f8, 0x0400003c,
-+ 0x59cc0408, 0x48026419, 0x59cc0208, 0x48026219,
-+ 0x59cc0807, 0x59340002, 0x82000500, 0x00ffffff,
-+ 0x80040580, 0x04000012, 0x59a8000f, 0x80040580,
-+ 0x04020021, 0x59cc1408, 0x0201f800, 0x00108c55,
-+ 0x04000023, 0x0201f800, 0x00109cb5, 0x04000020,
-+ 0x0201f800, 0x0010a116, 0x0400001d, 0x491e601e,
-+ 0x4a026403, 0x00000036, 0x0401f0e9, 0x59cc1208,
-+ 0x82080580, 0x0000ffff, 0x04000009, 0x0201f800,
-+ 0x00108c55, 0x04000012, 0x591c0202, 0x59cc0c08,
-+ 0x80040580, 0x0402000e, 0x0401f7eb, 0x59cc1408,
-+ 0x41327800, 0x0201f800, 0x00109bdc, 0x04000008,
-+ 0x0401f7e5, 0x4803c856, 0x4a02641a, 0x00000009,
-+ 0x4a02621a, 0x00001500, 0x0401f006, 0x4803c856,
-+ 0x4a02641a, 0x00000003, 0x4a02621a, 0x00001700,
-+ 0x4a026403, 0x00000037, 0x0401f0c9, 0x4803c856,
-+ 0x4a026403, 0x00000012, 0x0401f0c5, 0x4933c857,
-+ 0x0201f800, 0x00105ae9, 0x040200c7, 0x0201f800,
-+ 0x00101cd8, 0x040200c4, 0x0201f800, 0x00104719,
-+ 0x040206d9, 0x0201f800, 0x001045f8, 0x0400003e,
-+ 0x59cc0407, 0x48026419, 0x59cc1207, 0x480a6219,
-+ 0x82080580, 0x0000ffff, 0x04000005, 0x0201f800,
-+ 0x00108c55, 0x0400002c, 0x0401f006, 0x59cc1407,
-+ 0x41327800, 0x0201f800, 0x00109bdc, 0x04000026,
-+ 0x59cc0c07, 0x591c0202, 0x80040580, 0x04020022,
-+ 0x4d300000, 0x411e6000, 0x0201f800, 0x001083d4,
-+ 0x5c026000, 0x59cc0c09, 0x82040d00, 0x0000ff00,
-+ 0x840409c0, 0x0201f800, 0x0010a116, 0x04000016,
-+ 0x82040580, 0x00000001, 0x0400000a, 0x82040580,
-+ 0x00000005, 0x04000004, 0x82040580, 0x00000007,
-+ 0x04020007, 0x591c0008, 0x80000540, 0x04000004,
-+ 0x59cc2808, 0x0201f000, 0x00109cc9, 0x4803c856,
-+ 0x4a02641a, 0x00000009, 0x4a02621a, 0x00002a00,
-+ 0x0401f006, 0x4803c856, 0x4a02641a, 0x00000003,
-+ 0x4a02621a, 0x00000300, 0x4a026403, 0x0000003b,
-+ 0x0401f07b, 0x4803c856, 0x4a02641a, 0x0000000b,
-+ 0x4a02621a, 0x00000000, 0x0401f7f8, 0x4c080000,
-+ 0x0201f800, 0x00104614, 0x04000026, 0x0201f800,
-+ 0x001045e1, 0x0201f800, 0x00109de9, 0x0402001e,
-+ 0x59a80023, 0x82000540, 0x00000003, 0x48035023,
-+ 0x59a8001c, 0x800000d0, 0x59a8080f, 0x82040d00,
-+ 0x000000ff, 0x80041540, 0x480b500f, 0x42000800,
-+ 0x00000003, 0x0201f800, 0x00106499, 0x497b5025,
-+ 0x8d0e1d20, 0x04000006, 0x4a032804, 0x000007d0,
-+ 0x599c0017, 0x8c00050a, 0x0402000a, 0x0201f800,
-+ 0x000207bb, 0x0201f800, 0x00101add, 0x5c001000,
-+ 0x1c01f000, 0x0201f800, 0x00109e0b, 0x0401f7fc,
-+ 0x5c001000, 0x0201f000, 0x000207bb, 0x0201f800,
-+ 0x00101cd8, 0x0402004c, 0x0201f800, 0x00109e10,
-+ 0x4a026403, 0x00000047, 0x4a026203, 0x00000001,
-+ 0x0201f000, 0x00106339, 0x0201f800, 0x00101cd8,
-+ 0x04020041, 0x0201f800, 0x00109e10, 0x4a026403,
-+ 0x00000047, 0x4a026203, 0x00000001, 0x0201f000,
-+ 0x00106339, 0x0201f800, 0x00101cd8, 0x04020036,
-+ 0x0201f800, 0x00109e10, 0x0201f000, 0x000207bb,
-+ 0x0401f834, 0x04000030, 0x4a026403, 0x0000004e,
-+ 0x4a026203, 0x00000001, 0x0201f000, 0x00106339,
-+ 0x4a026403, 0x0000004f, 0x497a601c, 0x59cc0a06,
-+ 0x82040d00, 0x000000ff, 0x800409c0, 0x04000641,
-+ 0x82040580, 0x00000001, 0x04020005, 0x59cc0808,
-+ 0x59a80005, 0x80040580, 0x0400063a, 0x82040580,
-+ 0x00000002, 0x0402000a, 0x83cc1400, 0x0000000b,
-+ 0x4200b000, 0x00000002, 0x83341c00, 0x00000006,
-+ 0x0201f800, 0x00107d41, 0x0400062e, 0x4a02601c,
-+ 0x00000001, 0x0401f62b, 0x4a026403, 0x00000050,
-+ 0x59cc0207, 0x4802601c, 0x0401f626, 0x4a026203,
-+ 0x00000001, 0x42000800, 0x80000040, 0x0201f000,
-+ 0x0002075c, 0x4803c857, 0x0201f000, 0x000207bb,
-+ 0x4d2c0000, 0x4c500000, 0x4c580000, 0x4c540000,
-+ 0x59a80015, 0x82000c80, 0x00000841, 0x0402102d,
-+ 0x0201f800, 0x00100704, 0x0400002a, 0x492e6008,
-+ 0x59a80015, 0x48025802, 0x82000400, 0x00000003,
-+ 0x80000104, 0x83cca400, 0x00000006, 0x82000c80,
-+ 0x0000000b, 0x04001015, 0x4a025811, 0x0000000b,
-+ 0x4200b000, 0x0000000b, 0x832c0400, 0x00000005,
-+ 0x4000a800, 0x0201f800, 0x0010a330, 0x412c7000,
-+ 0x800409c0, 0x04020003, 0x49787001, 0x0401f00e,
-+ 0x0201f800, 0x00100704, 0x0400000e, 0x492c7001,
-+ 0x40040000, 0x0401f7ea, 0x48025811, 0x4000b000,
- 0x832c0400, 0x00000005, 0x4000a800, 0x0201f800,
-- 0x0010a93e, 0x412c7000, 0x800409c0, 0x04020003,
-- 0x49787001, 0x0401f00e, 0x0201f800, 0x00100819,
-- 0x0400000e, 0x492c7001, 0x40040000, 0x0401f7ea,
-- 0x48025811, 0x4000b000, 0x832c0400, 0x00000005,
-- 0x4000a800, 0x0201f800, 0x0010a93e, 0x82000540,
-- 0x00000001, 0x0401f006, 0x497b5016, 0x59325808,
-- 0x0201f800, 0x00100843, 0x80000580, 0x5c00a800,
-- 0x5c00b000, 0x5c00a000, 0x5c025800, 0x1c01f000,
-- 0x4d340000, 0x59326809, 0x59343400, 0x4933c857,
-- 0x4937c857, 0x481bc857, 0x0201f800, 0x00104842,
-- 0x5c026800, 0x1c01f000, 0x4933c857, 0x4c600000,
-- 0x4c5c0000, 0x4d3c0000, 0x4d440000, 0x4d340000,
-- 0x0401f84f, 0x04020037, 0x59cc0207, 0x82000d00,
-- 0x0000ff00, 0x900411c0, 0x59cc000a, 0x82000500,
-- 0x00ffffff, 0x80081540, 0x480a601c, 0x8c040d18,
-- 0x04000011, 0x42003000, 0x00000008, 0x0201f800,
-- 0x0010a756, 0x42000000, 0x0010b662, 0x0201f800,
-- 0x0010a86e, 0x4200b800, 0x00000002, 0x4200c000,
-- 0x00000001, 0x417a7800, 0x0201f800, 0x00101e48,
-- 0x0401f01f, 0x4178b800, 0x8c040d1a, 0x04000019,
-- 0x59cc000a, 0x0201f800, 0x001059b9, 0x02000800,
-- 0x00020267, 0x04020013, 0x59300009, 0x4c000000,
-- 0x49366009, 0x42003000, 0x00000009, 0x0201f800,
-- 0x0010a75e, 0x42000000, 0x0010b662, 0x0201f800,
-- 0x0010a86e, 0x417a7800, 0x4178c000, 0x0201f800,
-- 0x00101e48, 0x5c000000, 0x48026009, 0x0401f004,
-- 0x82000540, 0x00000001, 0x0401f003, 0x405c2800,
-- 0x80000580, 0x5c026800, 0x5c028800, 0x5c027800,
-- 0x5c00b800, 0x5c00c000, 0x1c01f000, 0x4933c857,
-- 0x59cc0206, 0x82000480, 0x00000010, 0x04021006,
-- 0x4a02621a, 0x00000000, 0x82000540, 0x00000001,
-- 0x0401f002, 0x80000580, 0x1c01f000, 0x4933c857,
-- 0x4a02621a, 0x00000000, 0x59cc0407, 0x82000500,
-- 0x0000ff00, 0x82000580, 0x00000800, 0x04020009,
-- 0x59cc0006, 0x82000500, 0x00ff0000, 0x82000d80,
-- 0x00140000, 0x04000003, 0x82000d80, 0x00100000,
-- 0x1c01f000, 0x59300403, 0x82003480, 0x00000051,
-- 0x02021800, 0x00100615, 0x83383580, 0x00000013,
-- 0x04020003, 0x4803c857, 0x0c01f016, 0x4933c857,
-- 0x493bc857, 0x83383580, 0x00000027, 0x04000005,
-- 0x83383580, 0x00000014, 0x02020800, 0x00100615,
-- 0x493bc857, 0x4937c857, 0x0201f800, 0x00104711,
-- 0x42000800, 0x00000007, 0x0201f800, 0x001043c7,
-- 0x0201f800, 0x001068f6, 0x0201f000, 0x00107698,
-- 0x00109c29, 0x00109c32, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c32, 0x00109c3d, 0x00109cb0,
-- 0x00109c82, 0x00109cb0, 0x00109c9a, 0x00109cb0,
-- 0x00109ca1, 0x00109cb0, 0x00109ca9, 0x00109cb0,
-- 0x00109ca9, 0x00109cb0, 0x00109cb0, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c32, 0x00109c29,
-- 0x00109cb0, 0x00109c29, 0x00109c29, 0x00109cb0,
-- 0x00109c29, 0x00109cad, 0x00109cb0, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c29, 0x00109cb0,
-- 0x00109cb0, 0x00109c29, 0x00109ca6, 0x00109cb0,
-- 0x00109c29, 0x00109c37, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109cac, 0x00109cb0,
-- 0x00109c29, 0x00109c29, 0x00109cb0, 0x00109cb0,
-- 0x00109c29, 0x00109c29, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c29, 0x00109c29,
-- 0x00109c29, 0x00109c2b, 0x00109c29, 0x00109c2b,
-- 0x00109c29, 0x00109c29, 0x00109c2b, 0x00109c29,
-- 0x00109c29, 0x00109c29, 0x00109c2b, 0x00109c2b,
-- 0x00109c2b, 0x0201f800, 0x00100615, 0x4d2c0000,
-- 0x59325808, 0x0201f800, 0x00100843, 0x5c025800,
-- 0x0201f000, 0x000208b4, 0x59a80037, 0x48026206,
-- 0x4a026203, 0x00000002, 0x1c01f000, 0x4d3c0000,
-- 0x417a7800, 0x0201f800, 0x001043bd, 0x5c027800,
-- 0x0401f074, 0x42000800, 0x00000007, 0x0201f800,
-- 0x001043c7, 0x59a80026, 0x8c000508, 0x04000012,
-- 0x59326809, 0x4c580000, 0x4200b000, 0x00000002,
-- 0x83a81c00, 0x00000002, 0x83341400, 0x00000006,
-- 0x0201f800, 0x001082ff, 0x80000540, 0x5c00b000,
-- 0x04020060, 0x59340200, 0x8400051a, 0x48026a00,
-- 0x0401f01b, 0x599c0017, 0x8c00050a, 0x04020059,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x001043bd,
-- 0x5c027800, 0x42000800, 0x00000007, 0x0201f800,
-- 0x001043c7, 0x59340212, 0x82000500, 0x0000ff00,
-- 0x0400004c, 0x599c0019, 0x8c00050e, 0x04020049,
-- 0x416c0000, 0x82000580, 0x00000002, 0x04020004,
-- 0x59a8001b, 0x80000000, 0x4803501b, 0x42000800,
-- 0x00000003, 0x0201f800, 0x001043c7, 0x4a026406,
-- 0x00000001, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000002, 0x0201f800, 0x00106470, 0x4ce80000,
-- 0x4201d000, 0x00000001, 0x0201f800, 0x00105ce7,
-- 0x5c01d000, 0x1c01f000, 0x0201f800, 0x00104842,
-- 0x0400002c, 0x0201f800, 0x00106196, 0x42000800,
-- 0x00000004, 0x0201f800, 0x001043c7, 0x0201f800,
-- 0x0010a791, 0x04020023, 0x42000800, 0x00000005,
-- 0x0201f800, 0x001043c7, 0x4a026406, 0x00000001,
-- 0x4a026203, 0x00000001, 0x4a026403, 0x00000003,
-- 0x0201f000, 0x00106470, 0x0201f800, 0x0010484b,
-- 0x04020014, 0x42000800, 0x00000006, 0x0401f813,
-- 0x0401f010, 0x42000800, 0x00000004, 0x0201f800,
-- 0x001043c7, 0x0401f79c, 0x42000800, 0x00000004,
-- 0x0401f006, 0x0201f800, 0x00104711, 0x0401f005,
-- 0x0401f004, 0x0401f003, 0x0201f800, 0x001043c7,
-- 0x0201f000, 0x000208b4, 0x4933c857, 0x4807c857,
-- 0x0201f800, 0x001043c7, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x5c027800, 0x0201f000,
-- 0x00104711, 0x59340400, 0x4803c857, 0x80000110,
-- 0x82003480, 0x0000000c, 0x02021800, 0x00100615,
-- 0x83383580, 0x00000015, 0x04020002, 0x0c01f006,
-- 0x83383580, 0x00000016, 0x02020800, 0x00100615,
-- 0x0c01f00d, 0x00107e42, 0x00107e42, 0x00107e42,
-- 0x00107e42, 0x00107e42, 0x00107e42, 0x00109d11,
-- 0x00109ce5, 0x00107e42, 0x00107e42, 0x00107e42,
-- 0x00107e42, 0x00107e42, 0x00107e42, 0x00107e42,
-- 0x00107e42, 0x00107e42, 0x00107e42, 0x00109d11,
-- 0x00109d18, 0x00107e42, 0x00107e42, 0x00107e42,
-- 0x00107e42, 0x4933c857, 0x599c0017, 0x8c00050a,
-- 0x0402001b, 0x813669c0, 0x04000019, 0x59340212,
-- 0x82000500, 0x0000ff00, 0x04000015, 0x599c0019,
-- 0x8c00050e, 0x04020012, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x001043bd, 0x5c027800, 0x42000800,
-- 0x00000003, 0x0201f800, 0x001043c7, 0x4a026406,
-- 0x00000001, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000002, 0x0201f000, 0x00106470, 0x59cc0001,
-- 0x59340802, 0x80040580, 0x82000500, 0x00ffffff,
-- 0x02020000, 0x000208b4, 0x59345002, 0x0201f800,
-- 0x001040e4, 0x482a6802, 0x0201f000, 0x000208b4,
-- 0x1c01f000, 0x4933c857, 0x59303403, 0x82183580,
-- 0x0000001e, 0x02000000, 0x000208b4, 0x1c01f000,
-- 0x4933c857, 0x0201f800, 0x00108180, 0x02020000,
-- 0x000208b4, 0x4a026203, 0x00000001, 0x4a026403,
-- 0x00000001, 0x0201f000, 0x00106470, 0x493bc857,
-- 0x83380580, 0x00000051, 0x0402000b, 0x0201f800,
-- 0x00106cb4, 0x02020000, 0x001076fb, 0x59300203,
-- 0x82000580, 0x00000002, 0x0400006e, 0x0201f800,
-- 0x00100615, 0x83380580, 0x00000027, 0x04000014,
-- 0x83380580, 0x00000048, 0x04000006, 0x83380580,
-- 0x00000014, 0x0400000e, 0x02020800, 0x00100615,
-- 0x0201f800, 0x00106cb4, 0x02020000, 0x001076fb,
-- 0x59300203, 0x82000580, 0x00000004, 0x02000000,
-- 0x000209a5, 0x0201f800, 0x00100615, 0x4933c857,
-- 0x59300403, 0x82000c80, 0x00000044, 0x02021800,
-- 0x00100615, 0x82000480, 0x00000040, 0x02001800,
-- 0x00100615, 0x40027000, 0x4803c857, 0x0c01f001,
-- 0x00109d58, 0x00109d5a, 0x00109d5a, 0x00109d75,
-- 0x0201f800, 0x00100615, 0x0201f800, 0x001068f6,
-- 0x59325808, 0x812e59c0, 0x04000016, 0x832c0500,
-- 0x00ff0000, 0x04000013, 0x4a026203, 0x00000002,
-- 0x59326809, 0x59340200, 0x8c00050e, 0x0402000d,
-- 0x42028000, 0x00000004, 0x0201f800, 0x0010a201,
-+ 0x0010a330, 0x82000540, 0x00000001, 0x0401f006,
-+ 0x497b5015, 0x59325808, 0x0201f800, 0x0010073b,
-+ 0x80000580, 0x5c00a800, 0x5c00b000, 0x5c00a000,
-+ 0x5c025800, 0x1c01f000, 0x4d340000, 0x59326809,
-+ 0x59343400, 0x4933c857, 0x4937c857, 0x481bc857,
-+ 0x0201f800, 0x00104725, 0x5c026800, 0x1c01f000,
-+ 0x4933c857, 0x4c600000, 0x4c5c0000, 0x4d3c0000,
-+ 0x4d440000, 0x4d340000, 0x0401f84f, 0x04020037,
-+ 0x59cc0207, 0x82000d00, 0x0000ff00, 0x900411c0,
-+ 0x59cc000a, 0x82000500, 0x00ffffff, 0x80081540,
-+ 0x480a601c, 0x8c040d18, 0x04000011, 0x42003000,
-+ 0x00000008, 0x0201f800, 0x0010a127, 0x42000000,
-+ 0x0010b032, 0x0201f800, 0x0010a260, 0x4200b800,
-+ 0x00000002, 0x4200c000, 0x00000001, 0x417a7800,
-+ 0x0201f800, 0x00101c5e, 0x0401f01f, 0x4178b800,
-+ 0x8c040d1a, 0x04000019, 0x59cc000a, 0x0201f800,
-+ 0x00105854, 0x02000800, 0x0002025a, 0x04020013,
-+ 0x59300009, 0x4c000000, 0x49366009, 0x42003000,
-+ 0x00000009, 0x0201f800, 0x0010a12f, 0x42000000,
-+ 0x0010b032, 0x0201f800, 0x0010a260, 0x417a7800,
-+ 0x4178c000, 0x0201f800, 0x00101c5e, 0x5c000000,
-+ 0x48026009, 0x0401f004, 0x82000540, 0x00000001,
-+ 0x0401f003, 0x405c2800, 0x80000580, 0x5c026800,
-+ 0x5c028800, 0x5c027800, 0x5c00b800, 0x5c00c000,
-+ 0x1c01f000, 0x4933c857, 0x59cc0206, 0x82000480,
-+ 0x00000010, 0x04021006, 0x4a02621a, 0x00000000,
-+ 0x82000540, 0x00000001, 0x0401f002, 0x80000580,
-+ 0x1c01f000, 0x4933c857, 0x4a02621a, 0x00000000,
-+ 0x59cc0407, 0x82000500, 0x0000ff00, 0x82000580,
-+ 0x00000800, 0x04020009, 0x59cc0006, 0x82000500,
-+ 0x00ff0000, 0x82000d80, 0x00140000, 0x04000003,
-+ 0x82000d80, 0x00100000, 0x1c01f000, 0x59300403,
-+ 0x82003480, 0x00000051, 0x02021800, 0x001004ef,
-+ 0x83383580, 0x00000013, 0x04020003, 0x4803c857,
-+ 0x0c01f016, 0x4933c857, 0x493bc857, 0x83383580,
-+ 0x00000027, 0x04000005, 0x83383580, 0x00000014,
-+ 0x02020800, 0x001004ef, 0x493bc857, 0x4937c857,
-+ 0x0201f800, 0x001045e1, 0x42000800, 0x00000007,
-+ 0x0201f800, 0x0010426c, 0x0201f800, 0x001063c4,
-+ 0x0201f000, 0x0010719c, 0x001096cb, 0x001096d4,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096d4,
-+ 0x001096df, 0x00109752, 0x00109724, 0x00109752,
-+ 0x0010973c, 0x00109752, 0x00109743, 0x00109752,
-+ 0x0010974b, 0x00109752, 0x0010974b, 0x00109752,
-+ 0x00109752, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096d4, 0x001096cb, 0x00109752, 0x001096cb,
-+ 0x001096cb, 0x00109752, 0x001096cb, 0x0010974f,
-+ 0x00109752, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096cb, 0x00109752, 0x00109752, 0x001096cb,
-+ 0x00109748, 0x00109752, 0x001096cb, 0x001096d9,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x0010974e, 0x00109752, 0x001096cb, 0x001096cb,
-+ 0x00109752, 0x00109752, 0x001096cb, 0x001096cb,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096cb, 0x001096cb, 0x001096cb, 0x001096cd,
-+ 0x001096cb, 0x001096cd, 0x001096cb, 0x001096cb,
-+ 0x001096cd, 0x001096cb, 0x001096cb, 0x001096cb,
-+ 0x001096cd, 0x001096cd, 0x001096cd, 0x0201f800,
-+ 0x001004ef, 0x4d2c0000, 0x59325808, 0x0201f800,
-+ 0x0010073b, 0x5c025800, 0x0201f000, 0x000207bb,
-+ 0x59a80034, 0x48026206, 0x4a026203, 0x00000002,
-+ 0x1c01f000, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010425d, 0x5c027800, 0x0401f074, 0x42000800,
-+ 0x00000007, 0x0201f800, 0x0010426c, 0x59a80023,
-+ 0x8c000508, 0x04000012, 0x59326809, 0x4c580000,
-+ 0x4200b000, 0x00000002, 0x83a81c00, 0x00000002,
-+ 0x83341400, 0x00000006, 0x0201f800, 0x00107d41,
-+ 0x80000540, 0x5c00b000, 0x04020060, 0x59340200,
-+ 0x8400051a, 0x48026a00, 0x0401f01b, 0x599c0017,
-+ 0x8c00050a, 0x04020059, 0x4d3c0000, 0x417a7800,
-+ 0x0201f800, 0x0010425d, 0x5c027800, 0x42000800,
-+ 0x00000007, 0x0201f800, 0x0010426c, 0x59340212,
-+ 0x82000500, 0x0000ff00, 0x0400004c, 0x599c0019,
-+ 0x8c00050e, 0x04020049, 0x416c0000, 0x82000580,
-+ 0x00000002, 0x04020004, 0x59a8001a, 0x80000000,
-+ 0x4803501a, 0x42000800, 0x00000003, 0x0201f800,
-+ 0x0010426c, 0x4a026406, 0x00000001, 0x4a026203,
-+ 0x00000001, 0x4a026403, 0x00000002, 0x0201f800,
-+ 0x00106339, 0x4ce80000, 0x4201d000, 0x00000001,
-+ 0x0201f800, 0x00105b8d, 0x5c01d000, 0x1c01f000,
-+ 0x0201f800, 0x00104725, 0x0400002c, 0x0201f800,
-+ 0x00106059, 0x42000800, 0x00000004, 0x0201f800,
-+ 0x0010426c, 0x0201f800, 0x0010a15f, 0x04020023,
-+ 0x42000800, 0x00000005, 0x0201f800, 0x0010426c,
-+ 0x4a026406, 0x00000001, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000003, 0x0201f000, 0x00106339,
-+ 0x0201f800, 0x0010472e, 0x04020014, 0x42000800,
-+ 0x00000006, 0x0401f813, 0x0401f010, 0x42000800,
-+ 0x00000004, 0x0201f800, 0x0010426c, 0x0401f79c,
-+ 0x42000800, 0x00000004, 0x0401f006, 0x0201f800,
-+ 0x001045e1, 0x0401f005, 0x0401f004, 0x0401f003,
-+ 0x0201f800, 0x0010426c, 0x0201f000, 0x000207bb,
-+ 0x4933c857, 0x4807c857, 0x0201f800, 0x0010426c,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010425d,
-+ 0x5c027800, 0x0201f000, 0x001045e1, 0x59340400,
-+ 0x4803c857, 0x80000110, 0x82003480, 0x0000000c,
-+ 0x02021800, 0x001004ef, 0x83383580, 0x00000015,
-+ 0x04020002, 0x0c01f006, 0x83383580, 0x00000016,
-+ 0x02020800, 0x001004ef, 0x0c01f00d, 0x0010795e,
-+ 0x0010795e, 0x0010795e, 0x0010795e, 0x0010795e,
-+ 0x0010795e, 0x001097b2, 0x00109787, 0x0010795e,
-+ 0x0010795e, 0x0010795e, 0x0010795e, 0x0010795e,
-+ 0x0010795e, 0x0010795e, 0x0010795e, 0x0010795e,
-+ 0x0010795e, 0x001097b2, 0x001097b9, 0x0010795e,
-+ 0x0010795e, 0x0010795e, 0x0010795e, 0x4933c857,
-+ 0x599c0017, 0x8c00050a, 0x0402001b, 0x813669c0,
-+ 0x04000019, 0x59340212, 0x82000500, 0x0000ff00,
-+ 0x04000015, 0x599c0019, 0x8c00050e, 0x04020012,
-+ 0x4d3c0000, 0x417a7800, 0x0201f800, 0x0010425d,
-+ 0x5c027800, 0x42000800, 0x00000003, 0x0201f800,
-+ 0x0010426c, 0x4a026406, 0x00000001, 0x4a026203,
-+ 0x00000001, 0x4a026403, 0x00000002, 0x0201f000,
-+ 0x00106339, 0x59cc0001, 0x59340802, 0x80040580,
-+ 0x82000500, 0x00ffffff, 0x02020000, 0x000207bb,
-+ 0x59345002, 0x0201f800, 0x00103f80, 0x482a6802,
-+ 0x0201f000, 0x000207bb, 0x4933c857, 0x59303403,
-+ 0x82183580, 0x0000001e, 0x02000000, 0x000207bb,
-+ 0x1c01f000, 0x4933c857, 0x0201f800, 0x00107c99,
-+ 0x02020000, 0x000207bb, 0x4a026203, 0x00000001,
-+ 0x4a026403, 0x00000001, 0x0201f000, 0x00106339,
-+ 0x493bc857, 0x83380580, 0x00000051, 0x0402000b,
-+ 0x0201f800, 0x001067a7, 0x02020000, 0x0010720c,
-+ 0x59300203, 0x82000580, 0x00000002, 0x0400006d,
-+ 0x0201f800, 0x001004ef, 0x83380580, 0x00000027,
-+ 0x04000014, 0x83380580, 0x00000048, 0x04000006,
-+ 0x83380580, 0x00000014, 0x0400000e, 0x02020800,
-+ 0x001004ef, 0x0201f800, 0x001067a7, 0x02020000,
-+ 0x0010720c, 0x59300203, 0x82000580, 0x00000004,
-+ 0x02000000, 0x000208ac, 0x0201f800, 0x001004ef,
-+ 0x4933c857, 0x59300403, 0x82000c80, 0x00000044,
-+ 0x02021800, 0x001004ef, 0x82000480, 0x00000040,
-+ 0x02001800, 0x001004ef, 0x40027000, 0x4803c857,
-+ 0x0c01f001, 0x001097f9, 0x001097fb, 0x001097fb,
-+ 0x00109815, 0x0201f800, 0x001004ef, 0x0201f800,
-+ 0x001063c4, 0x59325808, 0x812e59c0, 0x04000015,
-+ 0x832c0500, 0x00ff0000, 0x04000012, 0x4a026203,
-+ 0x00000002, 0x59326809, 0x59340200, 0x8c00050e,
-+ 0x0402000c, 0x42028000, 0x00000004, 0x0401fbbb,
- 0x497a6008, 0x59300206, 0x80000540, 0x04020003,
-- 0x59a80038, 0x48026206, 0x4a026203, 0x00000007,
-- 0x1c01f000, 0x0201f800, 0x001068f6, 0x0201f800,
-- 0x00108df4, 0x02000000, 0x00107698, 0x59325808,
-- 0x0201f800, 0x0010083a, 0x0201f000, 0x00107698,
-- 0x0201f800, 0x00100615, 0x59325808, 0x592c040a,
-+ 0x59a80035, 0x48026206, 0x4a026203, 0x00000007,
-+ 0x1c01f000, 0x0201f800, 0x001063c4, 0x0201f800,
-+ 0x0010883d, 0x02000000, 0x0010719c, 0x59325808,
-+ 0x0201f800, 0x0010072e, 0x0201f000, 0x0010719c,
-+ 0x0201f800, 0x001004ef, 0x59325808, 0x592c040a,
- 0x8c000502, 0x04000007, 0x4a026203, 0x00000007,
-- 0x42027000, 0x00000043, 0x0201f000, 0x000208d8,
-+ 0x42027000, 0x00000043, 0x0201f000, 0x000207df,
- 0x4a026203, 0x00000004, 0x1c01f000, 0x0201f800,
-- 0x0010a3b6, 0x02000000, 0x000209a3, 0x1c01f000,
-+ 0x00109d83, 0x02000000, 0x000208aa, 0x1c01f000,
- 0x4a026203, 0x00000001, 0x4a026403, 0x00000041,
-- 0x42027800, 0x80002042, 0x0201f000, 0x00020855,
-+ 0x42027800, 0x80002042, 0x0201f000, 0x0002075c,
- 0x83380580, 0x00000051, 0x04000006, 0x83380580,
-- 0x00000041, 0x02020800, 0x00100615, 0x1c01f000,
-- 0x0201f800, 0x00020831, 0x0201f800, 0x0010a3fa,
-- 0x0201f000, 0x000208b4, 0x83380480, 0x00000052,
-- 0x02021800, 0x00100615, 0x83380480, 0x00000049,
-- 0x02001800, 0x00100615, 0x0c01f001, 0x00109dbe,
-- 0x00109ddf, 0x00109dbc, 0x00109dbc, 0x00109dbc,
-- 0x00109dbc, 0x00109ddf, 0x00109dbc, 0x00109e01,
-- 0x0201f800, 0x00100615, 0x59325808, 0x592c040a,
-+ 0x00000041, 0x02020800, 0x001004ef, 0x1c01f000,
-+ 0x0201f800, 0x00020738, 0x0201f800, 0x00109dc7,
-+ 0x0201f000, 0x000207bb, 0x83380480, 0x00000052,
-+ 0x02021800, 0x001004ef, 0x83380480, 0x00000049,
-+ 0x02001800, 0x001004ef, 0x0c01f001, 0x0010985e,
-+ 0x0010987f, 0x0010985c, 0x0010985c, 0x0010985c,
-+ 0x0010985c, 0x0010987f, 0x0010985c, 0x001098a0,
-+ 0x0201f800, 0x001004ef, 0x59325808, 0x592c040a,
- 0x8c00051e, 0x0400000d, 0x82000d00, 0x000000c0,
- 0x82040d80, 0x00000080, 0x0400000d, 0x59300804,
- 0x8c040d18, 0x0402000a, 0x42027000, 0x00000041,
-- 0x0201f000, 0x000209c4, 0x4a026203, 0x00000007,
-- 0x497a6206, 0x0201f000, 0x00020831, 0x59325808,
-+ 0x0201f000, 0x000208cb, 0x4a026203, 0x00000007,
-+ 0x497a6206, 0x0201f000, 0x00020738, 0x59325808,
- 0x592c0c0a, 0x8c040d1a, 0x04020005, 0x0201f800,
-- 0x00020831, 0x0201f000, 0x000208b4, 0x0201f800,
-- 0x0010a3b6, 0x040007fa, 0x1c01f000, 0x0201f800,
-- 0x001068c1, 0x59325808, 0x59326809, 0x59340200,
-+ 0x00020738, 0x0201f000, 0x000207bb, 0x0201f800,
-+ 0x00109d83, 0x040007fa, 0x1c01f000, 0x0201f800,
-+ 0x001063a4, 0x59325808, 0x59326809, 0x59340200,
- 0x8c00050e, 0x0400000e, 0x592c040a, 0x82000500,
- 0x000000c0, 0x82000580, 0x00000080, 0x04000005,
- 0x592c000f, 0x59301815, 0x800c1c80, 0x480e6015,
-- 0x4a026203, 0x00000002, 0x0401f00e, 0x42028000,
-- 0x00000004, 0x0201f800, 0x0010a201, 0x59300206,
-- 0x80000540, 0x04020004, 0x59a80038, 0x800000c2,
-- 0x48026206, 0x497a6008, 0x4a026203, 0x00000007,
-- 0x1c01f000, 0x4933c857, 0x0201f800, 0x00106cb4,
-- 0x02020800, 0x00100615, 0x59300203, 0x82000580,
-- 0x00000002, 0x04000793, 0x0201f800, 0x00100615,
-+ 0x4a026203, 0x00000002, 0x0401f00d, 0x42028000,
-+ 0x00000004, 0x0401fb31, 0x59300206, 0x80000540,
-+ 0x04020004, 0x59a80035, 0x800000c2, 0x48026206,
-+ 0x497a6008, 0x4a026203, 0x00000007, 0x1c01f000,
-+ 0x4933c857, 0x0201f800, 0x001067a7, 0x02020800,
-+ 0x001004ef, 0x59300203, 0x82000580, 0x00000002,
-+ 0x04000794, 0x0201f800, 0x001004ef, 0x4a026203,
-+ 0x00000007, 0x497a6206, 0x0201f000, 0x00020738,
- 0x4a026203, 0x00000007, 0x497a6206, 0x0201f000,
-- 0x00020831, 0x4a026203, 0x00000007, 0x497a6206,
-- 0x0201f000, 0x0002082c, 0x59300414, 0x8c00051c,
-- 0x02020000, 0x000209b5, 0x59325808, 0x592c200f,
-- 0x40080000, 0x80102480, 0x59300015, 0x80102400,
-- 0x48126015, 0x0201f000, 0x000209b5, 0x8c040d0e,
-- 0x0402000a, 0x4a026203, 0x00000006, 0x0401f823,
-- 0x5930001f, 0x80000540, 0x02020800, 0x00100dc4,
-- 0x0201f000, 0x0002082c, 0x4a026203, 0x00000002,
-- 0x1c01f000, 0x42000800, 0x00000001, 0x0201f800,
-- 0x00100dc4, 0x82040580, 0x00000001, 0x02000000,
-- 0x000209bc, 0x0401f7d8, 0x59300414, 0x8c00051c,
-- 0x04000006, 0x0201f800, 0x00100bad, 0x02000000,
-- 0x000209ae, 0x1c01f000, 0x59300011, 0x80000540,
-- 0x04020005, 0x0201f800, 0x00100bad, 0x02000000,
-- 0x000209ae, 0x1c01f000, 0x492fc857, 0x480bc857,
-- 0x8c08153e, 0x04000006, 0x80081080, 0x80081000,
-- 0x42000800, 0x00000009, 0x0401f003, 0x42000800,
-- 0x00000015, 0x480a580b, 0x1c01f000, 0x83380580,
-- 0x00000013, 0x04000005, 0x83380580, 0x00000014,
-- 0x02020800, 0x00100615, 0x59300414, 0x8c000516,
-- 0x02000800, 0x00100615, 0x1c01f000, 0x0201f800,
-- 0x00100615, 0x59300008, 0x80000540, 0x02020800,
-- 0x00100615, 0x1c01f000, 0x59300414, 0x8c000516,
-- 0x02000800, 0x00100615, 0x1c01f000, 0x4a026203,
-- 0x00000004, 0x493a6403, 0x42000800, 0x80002001,
-- 0x0201f000, 0x00020855, 0x4a026203, 0x00000003,
-- 0x493a6403, 0x0201f800, 0x000200ca, 0x59325808,
-- 0x592c040a, 0x8c00051e, 0x04000012, 0x82000500,
-- 0x000000c0, 0x82000580, 0x00000080, 0x04000011,
-- 0x59300414, 0x8c000512, 0x0402000a, 0x8c000510,
-- 0x04020008, 0x592c040c, 0x80000540, 0x04020005,
-- 0x82080d40, 0x80003065, 0x0201f000, 0x00106466,
-- 0x82080d40, 0x80002065, 0x0201f000, 0x00106466,
-- 0x82080d40, 0x80002042, 0x0201f000, 0x00106466,
-- 0x4933c857, 0x493bc857, 0x83380480, 0x00000044,
-- 0x02021800, 0x00100615, 0x83380480, 0x00000041,
-- 0x02001800, 0x00100615, 0x0c01f001, 0x00109ea6,
-- 0x00109eb6, 0x00109ecb, 0x59325808, 0x592c040a,
-- 0x8c00051e, 0x0400001d, 0x82001d00, 0x000000c0,
-- 0x820c1d80, 0x000000c0, 0x04000018, 0x4a026203,
-- 0x00000001, 0x493a6403, 0x42000800, 0x80002042,
-- 0x0201f000, 0x00020855, 0x59325808, 0x592c040a,
-- 0x8c00051e, 0x0400000d, 0x82001d00, 0x000000c0,
-- 0x820c1d80, 0x000000c0, 0x04000008, 0x4a026203,
-- 0x00000001, 0x493a6403, 0x42000800, 0x80002001,
-- 0x0201f000, 0x00020855, 0x497a6008, 0x497a6206,
-- 0x42028000, 0x00000004, 0x0401f337, 0x59325808,
-- 0x592c040a, 0x8c00051e, 0x040007f8, 0x82001d00,
-- 0x000000c0, 0x820c1d80, 0x000000c0, 0x040007f3,
-- 0x4a026203, 0x00000003, 0x493a6403, 0x0201f800,
-- 0x000200ca, 0x82080d40, 0x80002065, 0x0201f000,
-- 0x00106466, 0x4933c857, 0x493bc857, 0x83380580,
-- 0x00000085, 0x04000006, 0x83380580, 0x00000088,
-- 0x0400000a, 0x0201f800, 0x00100615, 0x4a026203,
-- 0x00000009, 0x493a6403, 0x42000800, 0x8000004b,
-- 0x0201f000, 0x00020855, 0x4d1c0000, 0x813669c0,
-- 0x04000004, 0x0201f800, 0x0010a3b0, 0x04020044,
-- 0x59cc1404, 0x0401f846, 0x04000018, 0x591c0406,
-- 0x82000500, 0x0000001f, 0x82002580, 0x00000006,
-- 0x04000007, 0x82002580, 0x00000004, 0x0400002e,
-- 0x82002580, 0x00000011, 0x0402000c, 0x497a3a05,
-- 0x42002000, 0x00000054, 0x0201f800, 0x001077d1,
-- 0x4a026203, 0x00000007, 0x493a6403, 0x0201f800,
-- 0x0010a79b, 0x0401f02c, 0x0201f800, 0x0010393e,
-- 0x04000004, 0x42023800, 0xffffffff, 0x0401f7f1,
-- 0x813669c0, 0x04020009, 0x59cc0001, 0x0201f800,
-- 0x001059b9, 0x0402001e, 0x0201f800, 0x001043fc,
-- 0x0402001b, 0x49366009, 0x4a026403, 0x00000087,
-- 0x59cc1204, 0x82081580, 0x0000ffff, 0x04020003,
-- 0x4a026403, 0x00000086, 0x4a026203, 0x00000001,
-- 0x42000800, 0x80000040, 0x0201f800, 0x00020855,
-- 0x0401f00d, 0x591c0203, 0x82000580, 0x00000007,
-- 0x040207de, 0x4d300000, 0x411e6000, 0x0201f800,
-- 0x00107698, 0x5c026000, 0x0401f7d8, 0x0201f800,
-- 0x00107698, 0x5c023800, 0x1c01f000, 0x4933c857,
-- 0x480bc857, 0x42002800, 0x0010cfc0, 0x41300000,
-- 0x80140580, 0x04000017, 0x58140203, 0x82000580,
-- 0x00000000, 0x04000013, 0x58140202, 0x80080580,
-- 0x04020010, 0x58141c06, 0x820c0580, 0x00000005,
-- 0x0400000c, 0x820c0580, 0x00000009, 0x0400001d,
-- 0x59302009, 0x58140009, 0x800001c0, 0x0400000b,
-- 0x801021c0, 0x04000003, 0x80100580, 0x04000010,
-- 0x82142c00, 0x00000024, 0x41540000, 0x80140480,
-- 0x0402100e, 0x0401f7e2, 0x5814001e, 0x801021c0,
-- 0x04000005, 0x58102002, 0x82102500, 0x00ffffff,
-- 0x0401f7f2, 0x5810201e, 0x0401f7f0, 0x40163800,
-- 0x81300540, 0x0401f002, 0x80000580, 0x1c01f000,
-- 0x58141807, 0x8c0c1d10, 0x040207ea, 0x0401f7e1,
-- 0x83380580, 0x00000013, 0x0402000e, 0x59300403,
-- 0x4803c857, 0x82000c80, 0x00000085, 0x02001800,
-- 0x00100615, 0x82000c80, 0x00000093, 0x02021800,
-- 0x00100615, 0x82000480, 0x00000085, 0x0c01f019,
-- 0x83380580, 0x00000027, 0x04000005, 0x83380580,
-- 0x00000014, 0x02020000, 0x001076fb, 0x493bc857,
-- 0x0201f800, 0x001068f6, 0x59325808, 0x812e59c0,
-- 0x02000000, 0x00107698, 0x4a025a06, 0x00000031,
-- 0x4a025811, 0x00000004, 0x4a025812, 0x000000ff,
-- 0x0201f800, 0x00020381, 0x0201f000, 0x00107698,
-- 0x00109fa6, 0x00109fad, 0x00109fad, 0x00109fa6,
-- 0x00109fa6, 0x00109fa6, 0x00109fa6, 0x00109fa6,
-- 0x00109fa6, 0x00109fa6, 0x00109fa6, 0x00109fa6,
-- 0x00109fa6, 0x00109fa8, 0x0201f800, 0x00100615,
-- 0x59325808, 0x4a025a06, 0x00000000, 0x0201f800,
-- 0x00020381, 0x0201f000, 0x000208b4, 0x4933c857,
-- 0x42000000, 0x0010b672, 0x0201f800, 0x0010a86e,
-- 0x0201f800, 0x0010a3fa, 0x497a6205, 0x42028000,
-- 0x0000000b, 0x0401f807, 0x4a026406, 0x00000006,
-- 0x4a026203, 0x00000007, 0x497a6206, 0x1c01f000,
-- 0x4933c857, 0x4943c857, 0x59300406, 0x82000580,
-- 0x00000007, 0x04020002, 0x1c01f000, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x0201f800, 0x00108a99,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x00109ff4, 0x00109ff8, 0x00109fdf,
-- 0x0010a006, 0x0010a019, 0x00109fdf, 0x00109fdf,
-- 0x00109fdf, 0x00109fdf, 0x00109fdf, 0x00109fdf,
-- 0x00109fdf, 0x00109fdf, 0x00109fdf, 0x4d400000,
-- 0x5930001f, 0x80000540, 0x04000005, 0x41400800,
-- 0x0201f800, 0x00100dc4, 0x40068000, 0x4d2c0000,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x04020a16,
-- 0x4c5c0000, 0x5930b809, 0x0201f800, 0x00107698,
-- 0x485e6009, 0x5c00b800, 0x5c025800, 0x5c028000,
-- 0x5c03e000, 0x02000000, 0x00106982, 0x1c01f000,
-- 0x598c000d, 0x81300580, 0x04020004, 0x0201f800,
-- 0x00106be2, 0x04020016, 0x0201f800, 0x00106619,
-- 0x040007df, 0x0201f800, 0x001068a3, 0x04000010,
-- 0x0201f800, 0x00100615, 0x0201f800, 0x00108a8a,
-- 0x04020004, 0x0201f800, 0x00106bb2, 0x04020008,
-- 0x0201f800, 0x001064f6, 0x040007d1, 0x0201f800,
-- 0x001068a3, 0x02020800, 0x00100615, 0x59300203,
-- 0x82000c80, 0x0000000e, 0x02021800, 0x00100615,
-- 0x0c01f7b9, 0x0201f800, 0x00100ee4, 0x0401f7c4,
-- 0x4933c857, 0x4d440000, 0x4d340000, 0x59cc0007,
-- 0x0201f800, 0x001059b9, 0x02000800, 0x00020267,
-- 0x0402001a, 0x59300009, 0x4c000000, 0x49366009,
-- 0x42003000, 0x0000000b, 0x0201f800, 0x0010a766,
-- 0x42000000, 0x0010b660, 0x0201f800, 0x0010a86e,
-- 0x4d3c0000, 0x4d400000, 0x42028000, 0x00000029,
-- 0x417a7800, 0x0201f800, 0x00101de2, 0x5c028000,
-- 0x5c027800, 0x5c000000, 0x48026009, 0x59cc0007,
-- 0x48026802, 0x80000580, 0x5c026800, 0x5c028800,
-- 0x1c01f000, 0x4933c857, 0x4c040000, 0x59a80016,
-- 0x82000580, 0x00000074, 0x04020040, 0x59cc0a08,
-- 0x82040480, 0x00000100, 0x04001033, 0x59cc0c08,
-- 0x82040500, 0x00008000, 0x04000035, 0x59a80032,
-- 0x80000540, 0x04020009, 0x59301009, 0x58080212,
-- 0x82000500, 0x0000ff00, 0x04000004, 0x82040500,
-- 0x00000800, 0x0400002a, 0x59cc0c09, 0x80040840,
-- 0x04001024, 0x59a80826, 0x8c040d06, 0x04000004,
-- 0x59cc0c0f, 0x8c040d1e, 0x04020012, 0x59cc0a17,
-- 0x800409c0, 0x04020012, 0x59cc0a18, 0x82040480,
-- 0x00000100, 0x04001014, 0x59cc0c18, 0x800409c0,
-- 0x0402000e, 0x59cc0c19, 0x80040840, 0x04001011,
-- 0x59cc0c1a, 0x80040840, 0x04001011, 0x0401f018,
-- 0x4a02621a, 0x00000100, 0x0401f012, 0x4a02621a,
-- 0x00000300, 0x0401f00f, 0x4a02621a, 0x00000500,
-- 0x0401f00c, 0x4a02621a, 0x00000700, 0x0401f009,
-- 0x4a02621a, 0x00000900, 0x0401f006, 0x4a02621a,
-- 0x00000f00, 0x0401f003, 0x4a02621a, 0x00002d00,
-- 0x82000540, 0x00000001, 0x0401f002, 0x80000580,
-- 0x5c000800, 0x1c01f000, 0x59cc0407, 0x4803c857,
-- 0x82000580, 0x00000800, 0x04000003, 0x4a02621a,
-- 0x00000000, 0x1c01f000, 0x4933c857, 0x4c580000,
-- 0x59cc000c, 0x59340802, 0x82040d00, 0x00ffffff,
-- 0x80040580, 0x04020012, 0x83cc1400, 0x00000008,
-+ 0x00020733, 0x59300414, 0x8c00051c, 0x02020000,
-+ 0x000208bc, 0x59325808, 0x592c200f, 0x40080000,
-+ 0x80102480, 0x59300015, 0x80102400, 0x48126015,
-+ 0x0201f000, 0x000208bc, 0x8c040d0e, 0x0402000a,
-+ 0x4a026203, 0x00000006, 0x0401f823, 0x5930001f,
-+ 0x80000540, 0x02020800, 0x00100cbb, 0x0201f000,
-+ 0x00020733, 0x4a026203, 0x00000002, 0x1c01f000,
-+ 0x42000800, 0x00000001, 0x0201f800, 0x00100cbb,
-+ 0x82040580, 0x00000001, 0x02000000, 0x000208c3,
-+ 0x0401f7d8, 0x59300414, 0x8c00051c, 0x04000006,
-+ 0x0201f800, 0x00100aa4, 0x02000000, 0x000208b5,
-+ 0x1c01f000, 0x59300011, 0x80000540, 0x04020005,
-+ 0x0201f800, 0x00100aa4, 0x02000000, 0x000208b5,
-+ 0x1c01f000, 0x492fc857, 0x480bc857, 0x8c08153e,
-+ 0x04000006, 0x80081080, 0x80081000, 0x42000800,
-+ 0x00000009, 0x0401f003, 0x42000800, 0x00000015,
-+ 0x480a580b, 0x1c01f000, 0x83380580, 0x00000013,
-+ 0x04000005, 0x83380580, 0x00000014, 0x02020800,
-+ 0x001004ef, 0x59300414, 0x8c000516, 0x02000800,
-+ 0x001004ef, 0x1c01f000, 0x0201f800, 0x001004ef,
-+ 0x59300008, 0x80000540, 0x02020800, 0x001004ef,
-+ 0x1c01f000, 0x59300414, 0x8c000516, 0x02000800,
-+ 0x001004ef, 0x1c01f000, 0x4a026203, 0x00000004,
-+ 0x493a6403, 0x42000800, 0x80002001, 0x0201f000,
-+ 0x0002075c, 0x4a026203, 0x00000003, 0x493a6403,
-+ 0x0201f800, 0x000200be, 0x59325808, 0x592c040a,
-+ 0x8c00051e, 0x04000012, 0x82000500, 0x000000c0,
-+ 0x82000580, 0x00000080, 0x04000011, 0x59300414,
-+ 0x8c000512, 0x0402000a, 0x8c000510, 0x04020008,
-+ 0x592c040c, 0x80000540, 0x04020005, 0x82080d40,
-+ 0x80003065, 0x0201f000, 0x0010632f, 0x82080d40,
-+ 0x80002065, 0x0201f000, 0x0010632f, 0x82080d40,
-+ 0x80002042, 0x0201f000, 0x0010632f, 0x4933c857,
-+ 0x493bc857, 0x83380480, 0x00000044, 0x02021800,
-+ 0x001004ef, 0x83380480, 0x00000041, 0x02001800,
-+ 0x001004ef, 0x0c01f001, 0x00109945, 0x00109955,
-+ 0x0010996a, 0x59325808, 0x592c040a, 0x8c00051e,
-+ 0x0400001d, 0x82001d00, 0x000000c0, 0x820c1d80,
-+ 0x000000c0, 0x04000018, 0x4a026203, 0x00000001,
-+ 0x493a6403, 0x42000800, 0x80002042, 0x0201f000,
-+ 0x0002075c, 0x59325808, 0x592c040a, 0x8c00051e,
-+ 0x0400000d, 0x82001d00, 0x000000c0, 0x820c1d80,
-+ 0x000000c0, 0x04000008, 0x4a026203, 0x00000001,
-+ 0x493a6403, 0x42000800, 0x80002001, 0x0201f000,
-+ 0x0002075c, 0x497a6008, 0x497a6206, 0x42028000,
-+ 0x00000004, 0x0401f25d, 0x59325808, 0x592c040a,
-+ 0x8c00051e, 0x040007f8, 0x82001d00, 0x000000c0,
-+ 0x820c1d80, 0x000000c0, 0x040007f3, 0x4a026203,
-+ 0x00000003, 0x493a6403, 0x0201f800, 0x000200be,
-+ 0x82080d40, 0x80002065, 0x0201f000, 0x0010632f,
-+ 0x4933c857, 0x493bc857, 0x83380580, 0x00000085,
-+ 0x04000006, 0x83380580, 0x00000088, 0x0400000a,
-+ 0x0201f800, 0x001004ef, 0x4a026203, 0x00000009,
-+ 0x493a6403, 0x42000800, 0x8000004b, 0x0201f000,
-+ 0x0002075c, 0x4d1c0000, 0x813669c0, 0x04000003,
-+ 0x0401fbed, 0x04020043, 0x59cc1404, 0x0401f845,
-+ 0x04000018, 0x591c0406, 0x82000500, 0x0000001f,
-+ 0x82002580, 0x00000006, 0x04000007, 0x82002580,
-+ 0x00000004, 0x0400002d, 0x82002580, 0x00000011,
-+ 0x0402000c, 0x497a3a05, 0x42002000, 0x00000054,
-+ 0x0201f800, 0x001072e2, 0x4a026203, 0x00000007,
-+ 0x493a6403, 0x0201f800, 0x0010a169, 0x0401f02b,
-+ 0x8d0e1d20, 0x04000004, 0x42023800, 0xffffffff,
-+ 0x0401f7f2, 0x813669c0, 0x04020009, 0x59cc0001,
-+ 0x0201f800, 0x00105854, 0x0402001e, 0x0201f800,
-+ 0x001042b1, 0x0402001b, 0x49366009, 0x4a026403,
-+ 0x00000087, 0x59cc1204, 0x82081580, 0x0000ffff,
-+ 0x04020003, 0x4a026403, 0x00000086, 0x4a026203,
-+ 0x00000001, 0x42000800, 0x80000040, 0x0201f800,
-+ 0x0002075c, 0x0401f00d, 0x591c0203, 0x82000580,
-+ 0x00000007, 0x040207df, 0x4d300000, 0x411e6000,
-+ 0x0201f800, 0x0010719c, 0x5c026000, 0x0401f7d9,
-+ 0x0201f800, 0x0010719c, 0x5c023800, 0x1c01f000,
-+ 0x4933c857, 0x480bc857, 0x42002800, 0x0010d8d4,
-+ 0x41300000, 0x80140580, 0x04000017, 0x58140203,
-+ 0x82000580, 0x00000000, 0x04000013, 0x58140202,
-+ 0x80080580, 0x04020010, 0x58141c06, 0x820c0580,
-+ 0x00000005, 0x0400000c, 0x820c0580, 0x00000009,
-+ 0x0400001d, 0x59302009, 0x58140009, 0x800001c0,
-+ 0x0400000b, 0x801021c0, 0x04000003, 0x80100580,
-+ 0x04000010, 0x82142c00, 0x00000024, 0x41540000,
-+ 0x80140480, 0x0402100e, 0x0401f7e2, 0x5814001e,
-+ 0x801021c0, 0x04000005, 0x58102002, 0x82102500,
-+ 0x00ffffff, 0x0401f7f2, 0x5810201e, 0x0401f7f0,
-+ 0x40163800, 0x81300540, 0x0401f002, 0x80000580,
-+ 0x1c01f000, 0x58141807, 0x8c0c1d10, 0x040207ea,
-+ 0x0401f7e1, 0x4933c857, 0x83380580, 0x00000013,
-+ 0x0402000e, 0x59300403, 0x4803c857, 0x82000c80,
-+ 0x00000085, 0x02001800, 0x001004ef, 0x82000c80,
-+ 0x00000093, 0x02021800, 0x001004ef, 0x82000480,
-+ 0x00000085, 0x0c01f019, 0x83380580, 0x00000027,
-+ 0x04000005, 0x83380580, 0x00000014, 0x02020000,
-+ 0x0010720c, 0x493bc857, 0x0201f800, 0x001063c4,
-+ 0x59325808, 0x812e59c0, 0x02000000, 0x0010719c,
-+ 0x4a025a06, 0x00000031, 0x4a025811, 0x00000004,
-+ 0x4a025812, 0x000000ff, 0x0201f800, 0x000202e9,
-+ 0x0201f000, 0x0010719c, 0x00109a44, 0x00109a4b,
-+ 0x00109a4b, 0x00109a44, 0x00109a44, 0x00109a44,
-+ 0x00109a44, 0x00109a44, 0x00109a44, 0x00109a44,
-+ 0x00109a44, 0x00109a44, 0x00109a44, 0x00109a46,
-+ 0x0201f800, 0x001004ef, 0x59325808, 0x4a025a06,
-+ 0x00000000, 0x0201f800, 0x000202e9, 0x0201f000,
-+ 0x000207bb, 0x4933c857, 0x42000000, 0x0010b042,
-+ 0x0201f800, 0x0010a260, 0x0401fb75, 0x497a6205,
-+ 0x42028000, 0x0000000b, 0x0401f807, 0x4a026406,
-+ 0x00000006, 0x4a026203, 0x00000007, 0x497a6206,
-+ 0x1c01f000, 0x4933c857, 0x4943c857, 0x59300406,
-+ 0x82000580, 0x00000007, 0x04020002, 0x1c01f000,
-+ 0x0201f800, 0x00106476, 0x4df00000, 0x0201f800,
-+ 0x001084e4, 0x82000c80, 0x0000000e, 0x02021800,
-+ 0x001004ef, 0x0c01f001, 0x00109a91, 0x00109a95,
-+ 0x00109a7c, 0x00109aa4, 0x00109ab8, 0x00109a7c,
-+ 0x00109a7c, 0x00109a7c, 0x00109a7c, 0x00109a7c,
-+ 0x00109a7c, 0x00109a7c, 0x00109a7c, 0x00109a7c,
-+ 0x4d400000, 0x5930001f, 0x80000540, 0x04000005,
-+ 0x41400800, 0x0201f800, 0x00100cbb, 0x40068000,
-+ 0x4d2c0000, 0x59325808, 0x0201f800, 0x0010883d,
-+ 0x0402093e, 0x4c5c0000, 0x5930b809, 0x0201f800,
-+ 0x0010719c, 0x485e6009, 0x5c00b800, 0x5c025800,
-+ 0x5c028000, 0x5c03e000, 0x02000000, 0x00106463,
-+ 0x1c01f000, 0x598c000d, 0x81300580, 0x04020004,
-+ 0x0201f800, 0x001066d5, 0x04020018, 0x0201f800,
-+ 0x0010ccce, 0x80c40040, 0x040007de, 0x0201f800,
-+ 0x00106379, 0x04000011, 0x0201f800, 0x001004ef,
-+ 0x0201f800, 0x001084d5, 0x04020004, 0x0201f800,
-+ 0x001066a5, 0x04020009, 0x0201f800, 0x0010cb83,
-+ 0x80c40040, 0x040007cf, 0x0201f800, 0x00106379,
-+ 0x02020800, 0x001004ef, 0x59300203, 0x82000c80,
-+ 0x0000000e, 0x02021800, 0x001004ef, 0x0c01f7b7,
-+ 0x0201f800, 0x00100ddd, 0x0401f7c2, 0x4933c857,
-+ 0x4d440000, 0x4d340000, 0x59cc0007, 0x0201f800,
-+ 0x00105854, 0x02000800, 0x0002025a, 0x0402001a,
-+ 0x59300009, 0x4c000000, 0x49366009, 0x42003000,
-+ 0x0000000b, 0x0201f800, 0x0010a137, 0x42000000,
-+ 0x0010b030, 0x0201f800, 0x0010a260, 0x4d3c0000,
-+ 0x4d400000, 0x42028000, 0x00000029, 0x417a7800,
-+ 0x0201f800, 0x0010caa0, 0x5c028000, 0x5c027800,
-+ 0x5c000000, 0x48026009, 0x59cc0007, 0x48026802,
-+ 0x80000580, 0x5c026800, 0x5c028800, 0x1c01f000,
-+ 0x4933c857, 0x4c040000, 0x59a80015, 0x82000580,
-+ 0x00000074, 0x04020040, 0x59cc0a08, 0x82040480,
-+ 0x00000100, 0x04001033, 0x59cc0c08, 0x82040500,
-+ 0x00008000, 0x04000035, 0x59a8002f, 0x80000540,
-+ 0x04020009, 0x59301009, 0x58080212, 0x82000500,
-+ 0x0000ff00, 0x04000004, 0x82040500, 0x00000800,
-+ 0x0400002a, 0x59cc0c09, 0x80040840, 0x04001024,
-+ 0x59a80823, 0x8c040d06, 0x04000004, 0x59cc0c0f,
-+ 0x8c040d1e, 0x04020012, 0x59cc0a17, 0x800409c0,
-+ 0x04020012, 0x59cc0a18, 0x82040480, 0x00000100,
-+ 0x04001014, 0x59cc0c18, 0x800409c0, 0x0402000e,
-+ 0x59cc0c19, 0x80040840, 0x04001011, 0x59cc0c1a,
-+ 0x80040840, 0x04001011, 0x0401f018, 0x4a02621a,
-+ 0x00000100, 0x0401f012, 0x4a02621a, 0x00000300,
-+ 0x0401f00f, 0x4a02621a, 0x00000500, 0x0401f00c,
-+ 0x4a02621a, 0x00000700, 0x0401f009, 0x4a02621a,
-+ 0x00000900, 0x0401f006, 0x4a02621a, 0x00000f00,
-+ 0x0401f003, 0x4a02621a, 0x00002d00, 0x82000540,
-+ 0x00000001, 0x0401f002, 0x80000580, 0x5c000800,
-+ 0x1c01f000, 0x59cc0407, 0x4803c857, 0x82000580,
-+ 0x00000800, 0x04000003, 0x4a02621a, 0x00000000,
-+ 0x1c01f000, 0x4933c857, 0x4c580000, 0x59cc000c,
-+ 0x59340802, 0x82040d00, 0x00ffffff, 0x80040580,
-+ 0x04020012, 0x83cc1400, 0x00000008, 0x4200b000,
-+ 0x00000002, 0x83341c00, 0x00000006, 0x0201f800,
-+ 0x00107d41, 0x04020009, 0x83cc1400, 0x0000000a,
-+ 0x4200b000, 0x00000002, 0x83341c00, 0x00000008,
-+ 0x0201f800, 0x00107d41, 0x5c00b000, 0x1c01f000,
-+ 0x4933c857, 0x4c580000, 0x83cc1400, 0x0000000b,
- 0x4200b000, 0x00000002, 0x83341c00, 0x00000006,
-- 0x0201f800, 0x001082ff, 0x04020009, 0x83cc1400,
-- 0x0000000a, 0x4200b000, 0x00000002, 0x83341c00,
-- 0x00000008, 0x0201f800, 0x001082ff, 0x5c00b000,
-- 0x1c01f000, 0x4933c857, 0x4c580000, 0x83cc1400,
-- 0x0000000b, 0x4200b000, 0x00000002, 0x83341c00,
-- 0x00000006, 0x0201f800, 0x001082ff, 0x0402000c,
-- 0x83cc1400, 0x0000000d, 0x4200b000, 0x00000002,
-- 0x83341c00, 0x00000008, 0x0201f800, 0x001082ff,
-- 0x04000014, 0x4933c856, 0x4933c856, 0x4933c857,
-- 0x59340009, 0x4803c857, 0x5934000e, 0x4803c857,
-- 0x59340008, 0x4803c857, 0x5934000d, 0x4803c857,
-- 0x59340007, 0x4803c857, 0x5934000c, 0x4803c857,
-- 0x59340006, 0x4803c857, 0x5934000b, 0x4803c857,
-- 0x5c00b000, 0x1c01f000, 0x4933c857, 0x4947c857,
-- 0x4943c857, 0x4c600000, 0x0201f800, 0x0010698c,
-- 0x4df00000, 0x4d2c0000, 0x4d300000, 0x4d340000,
-- 0x0401f8d8, 0x4130c000, 0x42026000, 0x0010cfc0,
-- 0x59a8000e, 0x8060c1c0, 0x04000005, 0x82601580,
-- 0x0010bbe8, 0x04000002, 0x80000040, 0x81640480,
-- 0x040210c4, 0x40600000, 0x81300580, 0x040000bc,
-- 0x0401f9bc, 0x040200ba, 0x59326809, 0x59300406,
-- 0x82000c80, 0x00000012, 0x02021800, 0x00100615,
-- 0x0c01f001, 0x0010a1af, 0x0010a118, 0x0010a133,
-- 0x0010a13e, 0x0010a111, 0x0010a12c, 0x0010a169,
-- 0x0010a1af, 0x0010a10f, 0x0010a17c, 0x0010a190,
-- 0x0010a10f, 0x0010a10f, 0x0010a10f, 0x0010a10f,
-- 0x0010a1af, 0x0010a1a6, 0x0010a19e, 0x0201f800,
-- 0x00100615, 0x8d3e7d18, 0x04000003, 0x8d3e7d16,
-- 0x04000004, 0x59300420, 0x8c000500, 0x04020098,
-- 0x59300403, 0x82000580, 0x00000043, 0x04000094,
-- 0x0201f800, 0x00108ef1, 0x04000007, 0x0201f800,
-- 0x00108f05, 0x0402008c, 0x0201f800, 0x00107da6,
-- 0x0401f089, 0x0201f800, 0x00101e1b, 0x0201f800,
-- 0x00108f05, 0x02000800, 0x00107da6, 0x0401f082,
-- 0x8d3e7d18, 0x04000003, 0x8d3e7d16, 0x04000004,
-- 0x59300420, 0x8c000500, 0x0402007d, 0x59325808,
-- 0x0201f800, 0x00108df4, 0x04000077, 0x49425a06,
-- 0x497a5c09, 0x0201f800, 0x00020381, 0x0201f800,
-- 0x00108ee7, 0x0401f070, 0x8d3e7d00, 0x04000007,
-- 0x59300017, 0x81480580, 0x0402006d, 0x59300018,
-- 0x814c0580, 0x0402006a, 0x59300203, 0x82000580,
-- 0x00000004, 0x02000800, 0x00100ee4, 0x59325808,
-- 0x0201f800, 0x00108df4, 0x0400005f, 0x4a025a04,
-- 0x00000103, 0x59300004, 0x8400055c, 0x48026004,
-- 0x592c0408, 0x8c000512, 0x04000007, 0x4d2c0000,
-- 0x592c0009, 0x40025800, 0x0201f800, 0x00100843,
-- 0x5c025800, 0x49425a06, 0x497a5c09, 0x0401fb4f,
-- 0x0201f800, 0x00109365, 0x0201f800, 0x00108f7d,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00108ee7,
-- 0x0401f045, 0x8d3e7d18, 0x04000045, 0x59300203,
-- 0x82000580, 0x00000004, 0x02000800, 0x00100ee4,
-- 0x59325808, 0x0201f800, 0x00108df4, 0x0400003a,
-- 0x49425a06, 0x497a5c09, 0x0401fb38, 0x0201f800,
-- 0x00109365, 0x0201f800, 0x00020381, 0x0401f032,
-- 0x0201f800, 0x0010600e, 0x04000031, 0x59300203,
-- 0x82000580, 0x00000004, 0x0400002d, 0x59300203,
-- 0x82000580, 0x00000003, 0x04020029, 0x0201f800,
-- 0x001068c1, 0x59325808, 0x0201f800, 0x00108df4,
-- 0x04000021, 0x0201f800, 0x00020381, 0x0401f01e,
-- 0x59300203, 0x82000580, 0x00000004, 0x02000800,
-- 0x00100ee4, 0x59325808, 0x0201f800, 0x00108df4,
-- 0x04000015, 0x49425a06, 0x497a5c09, 0x0201f800,
-- 0x00020381, 0x0401f010, 0x833c0500, 0x00001800,
-- 0x0400000f, 0x8d3e7d16, 0x0402000d, 0x59325817,
-- 0x0201f800, 0x00100843, 0x59325808, 0x0201f800,
-- 0x00108df4, 0x04000004, 0x49425a06, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x00107698, 0x83326400,
-- 0x00000024, 0x41580000, 0x81300480, 0x04001735,
-- 0x5c026800, 0x5c026000, 0x5c025800, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x5c00c000, 0x1c01f000,
-- 0x4933c857, 0x813261c0, 0x0400002d, 0x83300d80,
-- 0x0010bbe8, 0x0400002a, 0x8d3e7d06, 0x04020028,
-- 0x59300c06, 0x82040580, 0x00000001, 0x0400000a,
-- 0x82040580, 0x00000002, 0x04020021, 0x5930021d,
-- 0x82000580, 0x00000001, 0x0402001d, 0x59300c16,
-- 0x0401f002, 0x59300c03, 0x82040580, 0x00000039,
-- 0x04000004, 0x82040580, 0x00000035, 0x04020014,
-- 0x4d300000, 0x4d1c0000, 0x5932601e, 0x4933c857,
-- 0x0201f800, 0x001091e3, 0x02000800, 0x00100615,
-- 0x591c001c, 0x497a381c, 0x591c0c14, 0x84040d02,
-- 0x48063c14, 0x5c023800, 0x5c026000, 0x81300580,
-- 0x02020800, 0x00100615, 0x497a601e, 0x1c01f000,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4d3c0000,
-- 0x42027800, 0x00000001, 0x0201f800, 0x001043bd,
-- 0x5c027800, 0x4c580000, 0x4200b000, 0x00000002,
-- 0x83a81c00, 0x00000002, 0x83cc1400, 0x0000000b,
-- 0x0201f800, 0x001082ff, 0x5c00b000, 0x80000540,
-- 0x1c01f000, 0x492fc857, 0x4943c857, 0x59a8000c,
-- 0x812c0480, 0x04001011, 0x59a8000d, 0x812c0480,
-- 0x0402100e, 0x592c0000, 0x80005d40, 0x04000008,
-- 0x497a5800, 0x49425a06, 0x4c2c0000, 0x0201f800,
-- 0x00020381, 0x5c025800, 0x0401f7f7, 0x49425a06,
-- 0x0201f000, 0x00020381, 0x1c01f000, 0x493fc857,
-- 0x4933c857, 0x480bc857, 0x0201f800, 0x0010393e,
-+ 0x0201f800, 0x00107d41, 0x0402000c, 0x83cc1400,
-+ 0x0000000d, 0x4200b000, 0x00000002, 0x83341c00,
-+ 0x00000008, 0x0201f800, 0x00107d41, 0x04000014,
-+ 0x4933c856, 0x4933c856, 0x4933c857, 0x59340009,
-+ 0x4803c857, 0x5934000e, 0x4803c857, 0x59340008,
-+ 0x4803c857, 0x5934000d, 0x4803c857, 0x59340007,
-+ 0x4803c857, 0x5934000c, 0x4803c857, 0x59340006,
-+ 0x4803c857, 0x5934000b, 0x4803c857, 0x5c00b000,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4933c857, 0x813261c0, 0x0400002d,
-+ 0x83300d80, 0x0010b5b8, 0x0400002a, 0x8d3e7d06,
-+ 0x04020028, 0x59300c06, 0x82040580, 0x00000001,
-+ 0x0400000a, 0x82040580, 0x00000002, 0x04020021,
-+ 0x5930021d, 0x82000580, 0x00000001, 0x0402001d,
-+ 0x59300c16, 0x0401f002, 0x59300c03, 0x82040580,
-+ 0x00000039, 0x04000004, 0x82040580, 0x00000035,
-+ 0x04020014, 0x4d300000, 0x4d1c0000, 0x5932601e,
-+ 0x4933c857, 0x0201f800, 0x00108c60, 0x02000800,
-+ 0x001004ef, 0x591c001c, 0x497a381c, 0x591c0c14,
-+ 0x84040d02, 0x48063c14, 0x5c023800, 0x5c026000,
-+ 0x81300580, 0x02020800, 0x001004ef, 0x497a601e,
-+ 0x1c01f000, 0x5c000000, 0x4c000000, 0x4803c857,
-+ 0x4d3c0000, 0x42027800, 0x00000001, 0x0201f800,
-+ 0x0010425d, 0x5c027800, 0x4c580000, 0x4200b000,
-+ 0x00000002, 0x83a81c00, 0x00000002, 0x83cc1400,
-+ 0x0000000b, 0x0201f800, 0x00107d41, 0x5c00b000,
-+ 0x80000540, 0x1c01f000, 0x4c000000, 0x0401f803,
-+ 0x5c000000, 0x1c01f000, 0x492fc857, 0x4943c857,
-+ 0x59a8000b, 0x812c0480, 0x04001011, 0x59a8000c,
-+ 0x812c0480, 0x0402100e, 0x592c0000, 0x80005d40,
-+ 0x04000008, 0x497a5800, 0x49425a06, 0x4c2c0000,
-+ 0x0201f800, 0x000202e9, 0x5c025800, 0x0401f7f7,
-+ 0x49425a06, 0x0201f000, 0x000202e9, 0x1c01f000,
-+ 0x493fc857, 0x4933c857, 0x480bc857, 0x8d0e1d20,
- 0x0400002e, 0x41502800, 0x813e79c0, 0x04020006,
-- 0x59a80066, 0x80000000, 0x59a8086a, 0x80040580,
-+ 0x59a80063, 0x80000000, 0x59a80867, 0x80040580,
- 0x04000026, 0x41300000, 0x80140580, 0x0400001a,
- 0x58140203, 0x82000580, 0x00000000, 0x04000016,
- 0x58140202, 0x80080580, 0x04020013, 0x58141c06,
-@@ -10446,8 +10034,8 @@ uint32_t risc_code01[] = {
- 0x42002000, 0x0000ffff, 0x5c000000, 0x4c000000,
- 0x4803c857, 0x480bc857, 0x4813c857, 0x492fc857,
- 0x4943c857, 0x4d2c0000, 0x4c080000, 0x4c100000,
-- 0x4c140000, 0x4c180000, 0x0201f800, 0x0010082a,
-- 0x02000800, 0x00100615, 0x5c003000, 0x5c002800,
-+ 0x4c140000, 0x4c180000, 0x0201f800, 0x0010071a,
-+ 0x02000800, 0x001004ef, 0x5c003000, 0x5c002800,
- 0x5c002000, 0x5c001000, 0x4a025a04, 0x0000010d,
- 0x800811c0, 0x04000017, 0x83400580, 0x00000029,
- 0x04020010, 0x82180580, 0x00000002, 0x0400000a,
-@@ -10458,174 +10046,177 @@ uint32_t risc_code01[] = {
- 0x4a025809, 0xffffffff, 0x4a025c13, 0x0000ffff,
- 0x49425a08, 0x48125a06, 0x82100580, 0x0000ffff,
- 0x04000012, 0x4c140000, 0x4c180000, 0x4d440000,
-- 0x4d340000, 0x40128800, 0x0201f800, 0x00020267,
-- 0x02020800, 0x00100615, 0x59340002, 0x82000500,
-+ 0x4d340000, 0x40128800, 0x0201f800, 0x0002025a,
-+ 0x02020800, 0x001004ef, 0x59340002, 0x82000500,
- 0x00ffffff, 0x48025812, 0x5c026800, 0x5c028800,
- 0x5c003000, 0x5c002800, 0x497a5800, 0x497a5c04,
- 0x83400580, 0x00000046, 0x04020002, 0x48165a07,
-- 0x481a5c08, 0x0401fbe0, 0x5c025800, 0x1c01f000,
-- 0x59300809, 0x800409c0, 0x04000004, 0x58040403,
-- 0x81440580, 0x1c01f000, 0x82000540, 0x00000001,
-- 0x0401f7fd, 0x4933c857, 0x4c040000, 0x59300403,
-- 0x82000d80, 0x0000001e, 0x04020016, 0x800000d0,
-- 0x59300a16, 0x82040d00, 0x000000ff, 0x80040540,
-- 0x4803c857, 0x48026416, 0x4a026403, 0x00000085,
-- 0x4a026203, 0x00000009, 0x4a026406, 0x00000005,
-- 0x4a02621d, 0x00000004, 0x59a80038, 0x48026206,
-- 0x42000800, 0x8000004b, 0x0201f800, 0x00020855,
-- 0x5c000800, 0x1c01f000, 0x4933c857, 0x40000000,
-- 0x40000000, 0x1c01f000, 0x59300414, 0x4933c857,
-- 0x4803c857, 0x8c000518, 0x04000009, 0x8c000512,
-- 0x02020000, 0x00108fdb, 0x0401f918, 0x0201f800,
-- 0x00020831, 0x0201f800, 0x000208b4, 0x1c01f000,
-- 0x591c0406, 0x4803c857, 0x82000c80, 0x00000009,
-- 0x0402100b, 0x0c01f001, 0x0010a2f7, 0x0010a2f7,
-- 0x0010a2f7, 0x0010a2f9, 0x0010a2f7, 0x0010a2f9,
-- 0x0010a2f9, 0x0010a2f7, 0x0010a2f9, 0x80000580,
-- 0x1c01f000, 0x82000540, 0x00000001, 0x1c01f000,
-- 0x591c0406, 0x82000500, 0x0000001f, 0x82000580,
-- 0x00000006, 0x0400000e, 0x4803c857, 0x4a026403,
-- 0x0000003b, 0x4a02641a, 0x00000009, 0x4a02621a,
-- 0x00002a00, 0x4a026203, 0x00000001, 0x42000800,
-- 0x80000040, 0x0201f000, 0x00020855, 0x4803c856,
-- 0x4c040000, 0x4c140000, 0x4d300000, 0x411e6000,
-- 0x0401f8e6, 0x497a6205, 0x59300414, 0x4803c857,
-- 0x82000500, 0xffffadff, 0x48026414, 0x497a6405,
-- 0x5c026000, 0x0201f800, 0x0010082a, 0x02000800,
-- 0x00100615, 0x5c002800, 0x5c000800, 0x4a025a04,
-- 0x0000010d, 0x497a5800, 0x497a5c04, 0x4a025a08,
-- 0x00000045, 0x491e5809, 0x59300402, 0x48025c07,
-- 0x59300419, 0x48025c0b, 0x591c0414, 0x84000556,
-- 0x48023c14, 0x591c1809, 0x580c0403, 0x48025a06,
-- 0x4816580a, 0x48065a0b, 0x0401fb57, 0x4d400000,
-- 0x42028000, 0x00000045, 0x591c0202, 0x4c000000,
-- 0x4d300000, 0x411e6000, 0x0401fc82, 0x5c026000,
-- 0x5c000000, 0x48023a02, 0x5c028000, 0x4a023c06,
-- 0x00000006, 0x4a023a03, 0x00000007, 0x497a3a06,
-- 0x497a3a05, 0x1c01f000, 0x4933c857, 0x83380580,
-- 0x00000013, 0x0402000b, 0x59300403, 0x4803c857,
-- 0x82000d80, 0x00000085, 0x0400002b, 0x82000d80,
-- 0x0000008b, 0x04000028, 0x0201f800, 0x00100615,
-- 0x83380580, 0x00000027, 0x0402000c, 0x0201f800,
-- 0x001068f6, 0x4d2c0000, 0x4d400000, 0x59325808,
-- 0x42028000, 0x00000004, 0x0401fe9f, 0x5c028000,
-- 0x5c025800, 0x1c01f000, 0x83380580, 0x00000014,
-- 0x040007f3, 0x83380580, 0x00000089, 0x04000005,
-- 0x83380580, 0x0000008a, 0x02020000, 0x001076fb,
-- 0x0201f800, 0x00106cb4, 0x02020000, 0x001076fb,
-- 0x59300a03, 0x82040580, 0x0000000a, 0x04000009,
-- 0x82040580, 0x0000000c, 0x04000006, 0x0201f800,
-- 0x00100615, 0x4a026203, 0x0000000a, 0x1c01f000,
-- 0x83380480, 0x00000093, 0x0402100c, 0x83380480,
-- 0x00000085, 0x04001009, 0x83380580, 0x00000089,
-- 0x0400000a, 0x83380580, 0x0000008a, 0x04000022,
-- 0x0201f800, 0x00100615, 0x493bc857, 0x4933c857,
-- 0x0201f000, 0x001076fb, 0x4933c857, 0x4c340000,
-- 0x41306800, 0x0201f800, 0x00020892, 0x04000011,
-- 0x4a026203, 0x00000001, 0x4a026403, 0x0000001e,
-- 0x59cc0c07, 0x48066419, 0x59cc0a07, 0x48066219,
-- 0x58340809, 0x48066009, 0x4a026406, 0x00000004,
-- 0x42000800, 0x80000040, 0x0201f800, 0x00020855,
-- 0x40366000, 0x0201f800, 0x000208b4, 0x5c006800,
-- 0x1c01f000, 0x4933c857, 0x0201f000, 0x000208b4,
-- 0x59300809, 0x58040200, 0x8c00051a, 0x02020800,
-- 0x001006ba, 0x1c01f000, 0x0201f800, 0x0010472e,
-- 0x0400001e, 0x4a026203, 0x00000002, 0x59300414,
-- 0x84000558, 0x48026414, 0x8c000512, 0x04000004,
-- 0x59a80039, 0x48026205, 0x0401f007, 0x59a80839,
-- 0x59a80037, 0x80040400, 0x82000400, 0x0000001e,
-- 0x48026205, 0x59300009, 0x82000c00, 0x00000011,
-- 0x50040000, 0x80000540, 0x04000004, 0x82000c00,
-- 0x00000000, 0x0401f7fb, 0x45300800, 0x497a6000,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x82100500,
-- 0xfffffeef, 0x0402001c, 0x4d2c0000, 0x4937c857,
-- 0x59340811, 0x83341400, 0x00000011, 0x800409c0,
-- 0x0400000e, 0x40040000, 0x81300580, 0x04000005,
-- 0x58040800, 0x82041400, 0x00000000, 0x0401f7f8,
-- 0x59300800, 0x497a6000, 0x44041000, 0x0201f800,
-- 0x00020831, 0x0401f002, 0x4933c857, 0x5c025800,
-- 0x492e6008, 0x0201f800, 0x00020831, 0x0201f000,
-- 0x000208b4, 0x492fc857, 0x4a025a06, 0x00000006,
-- 0x0201f000, 0x00020381, 0x4c340000, 0x59300009,
-- 0x800001c0, 0x04000010, 0x82006c00, 0x00000011,
-- 0x50340000, 0x80000540, 0x04000009, 0x81300580,
-- 0x04000005, 0x50340000, 0x82006c00, 0x00000000,
-- 0x0401f7f8, 0x59300000, 0x44006800, 0x5c006800,
-- 0x1c01f000, 0x59300c06, 0x82040580, 0x00000005,
-- 0x040007fb, 0x82040580, 0x00000011, 0x040007f8,
-- 0x82040580, 0x00000006, 0x040007f5, 0x82040580,
-- 0x00000001, 0x040007f2, 0x0201f800, 0x00100615,
-- 0x4933c857, 0x4c080000, 0x4c0c0000, 0x4c580000,
-- 0x59a8101d, 0x59cc1807, 0x820c1d00, 0x00ffffff,
-- 0x800c0110, 0x80083580, 0x04020014, 0x83cc1400,
-- 0x00000008, 0x4200b000, 0x00000002, 0x59300009,
-- 0x82001c00, 0x00000006, 0x0201f800, 0x001082ff,
-- 0x0402000a, 0x83cc1400, 0x0000000a, 0x4200b000,
-- 0x00000002, 0x59300009, 0x82001c00, 0x00000008,
-- 0x0201f800, 0x001082ff, 0x5c00b000, 0x5c001800,
-- 0x5c001000, 0x1c01f000, 0x4933c856, 0x0201f800,
-- 0x0010404b, 0x0201f000, 0x00101bf0, 0x493bc857,
-- 0x4d2c0000, 0x0201f800, 0x0010082a, 0x02000800,
-- 0x00100615, 0x832cac00, 0x00000005, 0x4c580000,
-- 0x4c540000, 0x4200b000, 0x00000006, 0x4578a800,
-- 0x8054a800, 0x8058b040, 0x040207fd, 0x83380580,
-- 0x00000046, 0x04020004, 0x4a025a04, 0x00000144,
-- 0x0401f008, 0x4a025a04, 0x00000146, 0x83380580,
-- 0x00000041, 0x04000003, 0x4a025a06, 0x00000001,
-- 0x59cc0007, 0x82000500, 0xff000000, 0x80000110,
-- 0x59cc1008, 0x82081500, 0xff000000, 0x80081540,
-- 0x480a580a, 0x83380580, 0x00000046, 0x04020006,
-- 0x59cc0007, 0x82000500, 0x00ffffff, 0x4802580b,
-- 0x0401f005, 0x59cc0008, 0x82000500, 0x00ffffff,
-- 0x4802580b, 0x83380580, 0x00000046, 0x04020004,
-- 0x83cc1400, 0x00000009, 0x0401f003, 0x83cc1400,
-- 0x0000000d, 0x50080000, 0x9c0001c0, 0x4802580c,
-- 0x80081000, 0x50080000, 0x9c0001c0, 0x4802580d,
-- 0x83380580, 0x00000046, 0x04020008, 0x59cc000b,
-- 0x9c0001c0, 0x4802580e, 0x59cc000c, 0x9c0001c0,
-- 0x4802580f, 0x0401f007, 0x59cc000f, 0x9c0001c0,
-- 0x4802580e, 0x59cc0010, 0x9c0001c0, 0x4802580f,
-- 0x83380580, 0x00000046, 0x04020004, 0x83cc1400,
-- 0x00000011, 0x0401f003, 0x83cc1400, 0x00000015,
-- 0x412c3000, 0x82183400, 0x00000010, 0x4200b000,
-- 0x00000004, 0x50080000, 0x9c0001c0, 0x44003000,
-- 0x80081000, 0x80183000, 0x8058b040, 0x040207fa,
-- 0x5c00a800, 0x5c00b000, 0x0201f800, 0x00020381,
-- 0x5c025800, 0x1c01f000, 0x4933c857, 0x492fc857,
-- 0x59300809, 0x58040200, 0x8c00051e, 0x04000004,
-- 0x592c0208, 0x84000558, 0x48025a08, 0x1c01f000,
-- 0x59e0180f, 0x599c0413, 0x800c1000, 0x80080580,
-- 0x04020002, 0x41781000, 0x59e00010, 0x59e00810,
-- 0x80040d80, 0x040207fd, 0x80080580, 0x0400000b,
-- 0x4c080000, 0x599c0814, 0x599c1015, 0x800c00cc,
-- 0x80040c00, 0x82081440, 0x00000000, 0x5c001800,
-- 0x82000540, 0x00000001, 0x4803c857, 0x1c01f000,
-- 0x59300203, 0x4933c857, 0x4937c857, 0x493bc857,
-- 0x4803c857, 0x82003480, 0x0000000e, 0x02021800,
-- 0x00100615, 0x0c01f001, 0x0010a4e8, 0x0010a63a,
-- 0x0010a4e8, 0x0010a4e8, 0x0010a4e8, 0x0010a4e8,
-- 0x0010a4e8, 0x0010a59f, 0x0010a4ea, 0x0010a4e8,
-- 0x0010a4e8, 0x0010a4e8, 0x0010a4e8, 0x0010a4e8,
-- 0x0201f800, 0x00100615, 0x83380580, 0x0000004c,
-- 0x02020800, 0x00100615, 0x0201f800, 0x0010473b,
-- 0x04020020, 0x59a80826, 0x82040500, 0x00000009,
-- 0x82000580, 0x00000008, 0x0400001a, 0x8c040d12,
-- 0x0400003d, 0x59cc0806, 0x82040d00, 0xff000000,
-- 0x82040580, 0x03000000, 0x0400001f, 0x82040580,
-+ 0x481a5c08, 0x0401fbec, 0x5c025800, 0x1c01f000,
-+ 0x4c000000, 0x0401f808, 0x42018800, 0x00000001,
-+ 0x04000003, 0x42018800, 0x00000000, 0x5c000000,
-+ 0x1c01f000, 0x59300809, 0x800409c0, 0x04000004,
-+ 0x58040403, 0x81440580, 0x1c01f000, 0x82000540,
-+ 0x00000001, 0x0401f7fd, 0x4933c857, 0x4c040000,
-+ 0x59300403, 0x82000d80, 0x0000001e, 0x04020016,
-+ 0x800000d0, 0x59300a16, 0x82040d00, 0x000000ff,
-+ 0x80040540, 0x4803c857, 0x48026416, 0x4a026403,
-+ 0x00000085, 0x4a026203, 0x00000009, 0x4a026406,
-+ 0x00000005, 0x4a02621d, 0x00000004, 0x59a80035,
-+ 0x48026206, 0x42000800, 0x8000004b, 0x0201f800,
-+ 0x0002075c, 0x5c000800, 0x1c01f000, 0x4933c857,
-+ 0x40000000, 0x40000000, 0x1c01f000, 0x59300414,
-+ 0x4933c857, 0x4803c857, 0x8c000518, 0x04000009,
-+ 0x8c000512, 0x02020000, 0x00108a43, 0x0401f918,
-+ 0x0201f800, 0x00020738, 0x0201f800, 0x000207bb,
-+ 0x1c01f000, 0x591c0406, 0x4803c857, 0x82000c80,
-+ 0x00000009, 0x0402100b, 0x0c01f001, 0x00109cc4,
-+ 0x00109cc4, 0x00109cc4, 0x00109cc6, 0x00109cc4,
-+ 0x00109cc6, 0x00109cc6, 0x00109cc4, 0x00109cc6,
-+ 0x80000580, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x591c0406, 0x82000500, 0x0000001f,
-+ 0x82000580, 0x00000006, 0x0400000e, 0x4803c857,
-+ 0x4a026403, 0x0000003b, 0x4a02641a, 0x00000009,
-+ 0x4a02621a, 0x00002a00, 0x4a026203, 0x00000001,
-+ 0x42000800, 0x80000040, 0x0201f000, 0x0002075c,
-+ 0x4803c856, 0x4c040000, 0x4c140000, 0x4d300000,
-+ 0x411e6000, 0x0401f8e6, 0x497a6205, 0x59300414,
-+ 0x4803c857, 0x82000500, 0xffffadff, 0x48026414,
-+ 0x497a6405, 0x5c026000, 0x0201f800, 0x0010071a,
-+ 0x02000800, 0x001004ef, 0x5c002800, 0x5c000800,
-+ 0x4a025a04, 0x0000010d, 0x497a5800, 0x497a5c04,
-+ 0x4a025a08, 0x00000045, 0x491e5809, 0x59300402,
-+ 0x48025c07, 0x59300419, 0x48025c0b, 0x591c0414,
-+ 0x84000556, 0x48023c14, 0x591c1809, 0x580c0403,
-+ 0x48025a06, 0x4816580a, 0x48065a0b, 0x0401fb5a,
-+ 0x4d400000, 0x42028000, 0x00000045, 0x591c0202,
-+ 0x4c000000, 0x4d300000, 0x411e6000, 0x0401fd52,
-+ 0x5c026000, 0x5c000000, 0x48023a02, 0x5c028000,
-+ 0x4a023c06, 0x00000006, 0x4a023a03, 0x00000007,
-+ 0x497a3a06, 0x497a3a05, 0x1c01f000, 0x4933c857,
-+ 0x83380580, 0x00000013, 0x0402000b, 0x59300403,
-+ 0x4803c857, 0x82000d80, 0x00000085, 0x0400002b,
-+ 0x82000d80, 0x0000008b, 0x04000028, 0x0201f800,
-+ 0x001004ef, 0x83380580, 0x00000027, 0x0402000c,
-+ 0x0201f800, 0x001063c4, 0x4d2c0000, 0x4d400000,
-+ 0x59325808, 0x42028000, 0x00000004, 0x0401fe97,
-+ 0x5c028000, 0x5c025800, 0x1c01f000, 0x83380580,
-+ 0x00000014, 0x040007f3, 0x83380580, 0x00000089,
-+ 0x04000005, 0x83380580, 0x0000008a, 0x02020000,
-+ 0x0010720c, 0x0201f800, 0x001067a7, 0x02020000,
-+ 0x0010720c, 0x59300a03, 0x82040580, 0x0000000a,
-+ 0x04000009, 0x82040580, 0x0000000c, 0x04000006,
-+ 0x0201f800, 0x001004ef, 0x4a026203, 0x0000000a,
-+ 0x1c01f000, 0x83380480, 0x00000093, 0x0402100c,
-+ 0x83380480, 0x00000085, 0x04001009, 0x83380580,
-+ 0x00000089, 0x0400000a, 0x83380580, 0x0000008a,
-+ 0x04000022, 0x0201f800, 0x001004ef, 0x493bc857,
-+ 0x4933c857, 0x0201f000, 0x0010720c, 0x4933c857,
-+ 0x4c340000, 0x41306800, 0x0201f800, 0x00020799,
-+ 0x04000011, 0x4a026203, 0x00000001, 0x4a026403,
-+ 0x0000001e, 0x59cc0c07, 0x48066419, 0x59cc0a07,
-+ 0x48066219, 0x58340809, 0x48066009, 0x4a026406,
-+ 0x00000004, 0x42000800, 0x80000040, 0x0201f800,
-+ 0x0002075c, 0x40366000, 0x0201f800, 0x000207bb,
-+ 0x5c006800, 0x1c01f000, 0x4933c857, 0x0201f000,
-+ 0x000207bb, 0x59300809, 0x58040200, 0x8c00051a,
-+ 0x02020800, 0x00100594, 0x1c01f000, 0x0201f800,
-+ 0x001045fe, 0x0400001e, 0x4a026203, 0x00000002,
-+ 0x59300414, 0x84000558, 0x48026414, 0x8c000512,
-+ 0x04000004, 0x59a80036, 0x48026205, 0x0401f007,
-+ 0x59a80836, 0x59a80034, 0x80040400, 0x82000400,
-+ 0x0000001e, 0x48026205, 0x59300009, 0x82000c00,
-+ 0x00000011, 0x50040000, 0x80000540, 0x04000004,
-+ 0x82000c00, 0x00000000, 0x0401f7fb, 0x45300800,
-+ 0x497a6000, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x82100500, 0xfffffeef, 0x0402001c, 0x4d2c0000,
-+ 0x4937c857, 0x59340811, 0x83341400, 0x00000011,
-+ 0x800409c0, 0x0400000e, 0x40040000, 0x81300580,
-+ 0x04000005, 0x58040800, 0x82041400, 0x00000000,
-+ 0x0401f7f8, 0x59300800, 0x497a6000, 0x44041000,
-+ 0x0201f800, 0x00020738, 0x0401f002, 0x4933c857,
-+ 0x5c025800, 0x492e6008, 0x0201f800, 0x00020738,
-+ 0x0201f000, 0x000207bb, 0x492fc857, 0x4a025a06,
-+ 0x00000006, 0x0201f000, 0x000202e9, 0x4c340000,
-+ 0x59300009, 0x800001c0, 0x04000010, 0x82006c00,
-+ 0x00000011, 0x50340000, 0x80000540, 0x04000009,
-+ 0x81300580, 0x04000005, 0x50340000, 0x82006c00,
-+ 0x00000000, 0x0401f7f8, 0x59300000, 0x44006800,
-+ 0x5c006800, 0x1c01f000, 0x59300c06, 0x82040580,
-+ 0x00000005, 0x040007fb, 0x82040580, 0x00000011,
-+ 0x040007f8, 0x82040580, 0x00000006, 0x040007f5,
-+ 0x82040580, 0x00000001, 0x040007f2, 0x0201f800,
-+ 0x001004ef, 0x4933c857, 0x4c080000, 0x4c0c0000,
-+ 0x4c580000, 0x59a8101c, 0x59cc1807, 0x820c1d00,
-+ 0x00ffffff, 0x800c0110, 0x80083580, 0x04020014,
-+ 0x83cc1400, 0x00000008, 0x4200b000, 0x00000002,
-+ 0x59300009, 0x82001c00, 0x00000006, 0x0201f800,
-+ 0x00107d41, 0x0402000a, 0x83cc1400, 0x0000000a,
-+ 0x4200b000, 0x00000002, 0x59300009, 0x82001c00,
-+ 0x00000008, 0x0201f800, 0x00107d41, 0x5c00b000,
-+ 0x5c001800, 0x5c001000, 0x1c01f000, 0x4933c856,
-+ 0x0201f800, 0x00103ee0, 0x0201f000, 0x00101add,
-+ 0x493bc857, 0x4d2c0000, 0x0201f800, 0x0010071a,
-+ 0x02000800, 0x001004ef, 0x832cac00, 0x00000005,
-+ 0x4c580000, 0x4c540000, 0x4200b000, 0x00000006,
-+ 0x4578a800, 0x8054a800, 0x8058b040, 0x040207fd,
-+ 0x83380580, 0x00000046, 0x04020004, 0x4a025a04,
-+ 0x00000144, 0x0401f008, 0x4a025a04, 0x00000146,
-+ 0x83380580, 0x00000041, 0x04000003, 0x4a025a06,
-+ 0x00000001, 0x59cc0007, 0x82000500, 0xff000000,
-+ 0x80000110, 0x59cc1008, 0x82081500, 0xff000000,
-+ 0x80081540, 0x480a580a, 0x83380580, 0x00000046,
-+ 0x04020006, 0x59cc0007, 0x82000500, 0x00ffffff,
-+ 0x4802580b, 0x0401f005, 0x59cc0008, 0x82000500,
-+ 0x00ffffff, 0x4802580b, 0x83380580, 0x00000046,
-+ 0x04020004, 0x83cc1400, 0x00000009, 0x0401f003,
-+ 0x83cc1400, 0x0000000d, 0x50080000, 0x9c0001c0,
-+ 0x4802580c, 0x80081000, 0x50080000, 0x9c0001c0,
-+ 0x4802580d, 0x83380580, 0x00000046, 0x04020008,
-+ 0x59cc000b, 0x9c0001c0, 0x4802580e, 0x59cc000c,
-+ 0x9c0001c0, 0x4802580f, 0x0401f007, 0x59cc000f,
-+ 0x9c0001c0, 0x4802580e, 0x59cc0010, 0x9c0001c0,
-+ 0x4802580f, 0x83380580, 0x00000046, 0x04020004,
-+ 0x83cc1400, 0x00000011, 0x0401f003, 0x83cc1400,
-+ 0x00000015, 0x412c3000, 0x82183400, 0x00000010,
-+ 0x4200b000, 0x00000004, 0x50080000, 0x9c0001c0,
-+ 0x44003000, 0x80081000, 0x80183000, 0x8058b040,
-+ 0x040207fa, 0x5c00a800, 0x5c00b000, 0x0201f800,
-+ 0x000202e9, 0x5c025800, 0x1c01f000, 0x4c000000,
-+ 0x0401f803, 0x5c000000, 0x1c01f000, 0x4933c857,
-+ 0x492fc857, 0x59300809, 0x58040200, 0x8c00051e,
-+ 0x04000004, 0x592c0208, 0x84000558, 0x48025a08,
-+ 0x1c01f000, 0x59e0180f, 0x599c0413, 0x800c1000,
-+ 0x80080580, 0x04020002, 0x41781000, 0x59e00010,
-+ 0x59e00810, 0x80040d80, 0x040207fd, 0x80080580,
-+ 0x0400000b, 0x4c080000, 0x599c0814, 0x599c1015,
-+ 0x800c00cc, 0x80040c00, 0x82081440, 0x00000000,
-+ 0x5c001800, 0x82000540, 0x00000001, 0x4803c857,
-+ 0x1c01f000, 0x59300203, 0x4933c857, 0x4937c857,
-+ 0x493bc857, 0x4803c857, 0x82003480, 0x0000000e,
-+ 0x02021800, 0x001004ef, 0x0c01f001, 0x00109eb9,
-+ 0x0010a00a, 0x00109eb9, 0x00109eb9, 0x00109eb9,
-+ 0x00109eb9, 0x00109eb9, 0x00109f6f, 0x00109ebb,
-+ 0x00109eb9, 0x00109eb9, 0x00109eb9, 0x00109eb9,
-+ 0x00109eb9, 0x0201f800, 0x001004ef, 0x83380580,
-+ 0x0000004c, 0x02020800, 0x001004ef, 0x0201f800,
-+ 0x00104614, 0x04020020, 0x59a80823, 0x82040500,
-+ 0x00000009, 0x82000580, 0x00000008, 0x0400001a,
-+ 0x8c040d12, 0x0400003d, 0x59cc0806, 0x82040d00,
-+ 0xff000000, 0x82040580, 0x03000000, 0x0400001f,
-+ 0x82040580, 0x50000000, 0x04000005, 0x82040580,
-+ 0x52000000, 0x02020000, 0x000207bb, 0x813669c0,
-+ 0x04000006, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x0010caa0, 0x5c027800, 0x4a026403, 0x00000001,
-+ 0x0401f014, 0x59cc0806, 0x82040d00, 0xff000000,
-+ 0x82040580, 0x03000000, 0x04000008, 0x82040580,
- 0x50000000, 0x04000005, 0x82040580, 0x52000000,
-- 0x02020000, 0x000208b4, 0x813669c0, 0x04000006,
-- 0x4d3c0000, 0x417a7800, 0x0201f800, 0x00101de2,
-- 0x5c027800, 0x4a026403, 0x00000001, 0x0401f014,
-- 0x59cc0806, 0x82040d00, 0xff000000, 0x82040580,
-- 0x03000000, 0x04000008, 0x82040580, 0x50000000,
-- 0x04000005, 0x82040580, 0x52000000, 0x02020000,
-- 0x000208b4, 0x4a026403, 0x00000009, 0x4a02641a,
-- 0x00000009, 0x4a02621a, 0x00000000, 0x813669c0,
-- 0x0402000b, 0x59cc0001, 0x0201f800, 0x001059b9,
-- 0x02020000, 0x000208b4, 0x0201f800, 0x001043fc,
-- 0x02020000, 0x000208b4, 0x49366009, 0x4a026406,
-- 0x00000004, 0x4a026203, 0x00000001, 0x0201f000,
-- 0x00106470, 0x0201f800, 0x0010393e, 0x04000023,
-+ 0x02020000, 0x000207bb, 0x4a026403, 0x00000009,
-+ 0x4a02641a, 0x00000009, 0x4a02621a, 0x00000000,
-+ 0x813669c0, 0x0402000b, 0x59cc0001, 0x0201f800,
-+ 0x00105854, 0x02020000, 0x000207bb, 0x0201f800,
-+ 0x001042b1, 0x02020000, 0x000207bb, 0x49366009,
-+ 0x4a026406, 0x00000004, 0x4a026203, 0x00000001,
-+ 0x0201f000, 0x00106339, 0x8d0e1d20, 0x04000023,
- 0x59cc0806, 0x4807c857, 0x82040d00, 0xff000000,
- 0x82040580, 0x03000000, 0x04000033, 0x82040580,
- 0x20000000, 0x04000041, 0x82040580, 0x21000000,
-@@ -10634,34 +10225,34 @@ uint32_t risc_code01[] = {
- 0x52000000, 0x04000049, 0x82040580, 0x05000000,
- 0x0402000d, 0x59cc0806, 0x82040d00, 0xff000000,
- 0x9c0431c0, 0x42028000, 0x00000046, 0x42002800,
-- 0x00000001, 0x0401fcf7, 0x0401f940, 0x02000800,
-- 0x00100615, 0x42002000, 0x00000051, 0x0201f800,
-- 0x001077d1, 0x59cc0000, 0x82000500, 0x00ffffff,
-+ 0x00000001, 0x0401fceb, 0x0401f940, 0x02000800,
-+ 0x001004ef, 0x42002000, 0x00000051, 0x0201f800,
-+ 0x001072e2, 0x59cc0000, 0x82000500, 0x00ffffff,
- 0x82000580, 0x00ffffff, 0x04000005, 0x4a026203,
- 0x00000007, 0x493a6403, 0x1c01f000, 0x59325817,
-- 0x812e59c0, 0x02020800, 0x00100843, 0x0201f000,
-- 0x000208b4, 0x813669c0, 0x040007df, 0x59340400,
-+ 0x812e59c0, 0x02020800, 0x0010073b, 0x0201f000,
-+ 0x000207bb, 0x813669c0, 0x040007df, 0x59340400,
- 0x82000500, 0x000000ff, 0x82000580, 0x00000003,
-- 0x040207d9, 0x0401fc73, 0x040207d7, 0x4a026403,
-+ 0x040207d9, 0x0401fc64, 0x040207d7, 0x4a026403,
- 0x00000009, 0x4a02641a, 0x0000000e, 0x4a02621a,
-- 0x00001900, 0x0401f7a2, 0x813669c0, 0x0400000c,
-+ 0x00001900, 0x0401f7a3, 0x813669c0, 0x0400000c,
- 0x59340c00, 0x82040500, 0x000000ff, 0x82000580,
-- 0x00000009, 0x04000794, 0x82040500, 0x0000ff00,
-+ 0x00000009, 0x04000795, 0x82040500, 0x0000ff00,
- 0x82000580, 0x00000700, 0x040207c3, 0x4a026403,
- 0x00000009, 0x4a02641a, 0x00000009, 0x4a02621a,
-- 0x00001e00, 0x0401f78e, 0x813669c0, 0x040007f8,
-+ 0x00001e00, 0x0401f78f, 0x813669c0, 0x040007f8,
- 0x59340c00, 0x82040500, 0x0000ff00, 0x82000580,
- 0x00000700, 0x040007f2, 0x0401f7b3, 0x4d2c0000,
- 0x4c580000, 0x4c500000, 0x4c540000, 0x41385000,
-- 0x83380580, 0x00000054, 0x02020800, 0x00100615,
-+ 0x83380580, 0x00000054, 0x02020800, 0x001004ef,
- 0x59325808, 0x592c0c0b, 0x82040d00, 0x0000e000,
- 0x82040580, 0x00002000, 0x04020076, 0x59300817,
- 0x800409c0, 0x04000014, 0x58041404, 0x41cca800,
- 0x8204a400, 0x00000005, 0x82080480, 0x00000010,
-- 0x04021004, 0x4008b000, 0x0401fb84, 0x0401f00a,
-- 0x40001000, 0x4200b000, 0x0000000f, 0x0401fb7f,
-+ 0x04021004, 0x4008b000, 0x0401fba6, 0x0401f00a,
-+ 0x40001000, 0x4200b000, 0x0000000f, 0x0401fba1,
- 0x58040801, 0x800409c0, 0x040207f2, 0x0201f800,
-- 0x00100615, 0x813669c0, 0x0400005e, 0x59344c00,
-+ 0x001004ef, 0x813669c0, 0x0400005e, 0x59344c00,
- 0x592c0c09, 0x4807c857, 0x4827c857, 0x82040d00,
- 0x000000ff, 0x82040580, 0x00000003, 0x0400002a,
- 0x82040580, 0x00000005, 0x04000032, 0x82040580,
-@@ -10670,25 +10261,25 @@ uint32_t risc_code01[] = {
- 0x82040580, 0x00000021, 0x04000004, 0x82040580,
- 0x00000024, 0x04020043, 0x82240500, 0x0000ff00,
- 0x82000580, 0x00000007, 0x04000008, 0x42000800,
-- 0x00000009, 0x0201f800, 0x001043c7, 0x42005000,
-+ 0x00000009, 0x0201f800, 0x0010426c, 0x42005000,
- 0x0000000c, 0x0401f037, 0x4a025a06, 0x00000031,
- 0x4a02580d, 0x00000009, 0x59340400, 0x4802580e,
-- 0x0201f800, 0x00020381, 0x0201f800, 0x00107698,
-- 0x0401f03d, 0x0201f800, 0x001040e4, 0x0201f800,
-- 0x00104480, 0x42000800, 0x00000003, 0x0201f800,
-- 0x001043c7, 0x42005000, 0x00000008, 0x0401f021,
-- 0x59cc0007, 0x0201f800, 0x00105c25, 0x0402001d,
-- 0x0201f800, 0x001040e4, 0x0401f01a, 0x82240500,
-+ 0x0201f800, 0x000202e9, 0x0201f800, 0x0010719c,
-+ 0x0401f03d, 0x0201f800, 0x00103f80, 0x0201f800,
-+ 0x00104346, 0x42000800, 0x00000003, 0x0201f800,
-+ 0x0010426c, 0x42005000, 0x00000008, 0x0401f021,
-+ 0x59cc0007, 0x0201f800, 0x00105ac6, 0x0402001d,
-+ 0x0201f800, 0x00103f80, 0x0401f01a, 0x82240500,
- 0x0000ff00, 0x82000580, 0x00000007, 0x040007df,
- 0x82240500, 0x000000ff, 0x82000580, 0x00000009,
-- 0x040007da, 0x0201f800, 0x001044e1, 0x42005000,
-+ 0x040007da, 0x0201f800, 0x001043a7, 0x42005000,
- 0x0000000a, 0x0401f00b, 0x42005000, 0x0000000e,
- 0x0401f003, 0x42005000, 0x00000010, 0x82240500,
- 0x0000ff00, 0x82000580, 0x00000007, 0x040007cb,
- 0x482a6403, 0x4a026203, 0x00000001, 0x592c000d,
-- 0x48026011, 0x497a6013, 0x59a80038, 0x48026206,
-- 0x417a7800, 0x0201f800, 0x00106470, 0x59325817,
-- 0x812e59c0, 0x04000004, 0x0201f800, 0x00100843,
-+ 0x48026011, 0x497a6013, 0x59a80035, 0x48026206,
-+ 0x417a7800, 0x0201f800, 0x00106339, 0x59325817,
-+ 0x812e59c0, 0x04000004, 0x0201f800, 0x0010073b,
- 0x497a6017, 0x5c00a800, 0x5c00a000, 0x5c00b000,
- 0x5c025800, 0x1c01f000, 0x4d2c0000, 0x59325808,
- 0x83380580, 0x00000013, 0x0402002a, 0x492fc857,
-@@ -10696,24 +10287,24 @@ uint32_t risc_code01[] = {
- 0x82040580, 0x00000010, 0x04000018, 0x82040580,
- 0x0000000e, 0x04000015, 0x82040580, 0x00000008,
- 0x0400000d, 0x82040580, 0x0000000c, 0x0400000a,
-- 0x82040580, 0x0000000a, 0x02020800, 0x00100615,
-- 0x42000800, 0x00000006, 0x0201f800, 0x001043c7,
-+ 0x82040580, 0x0000000a, 0x02020800, 0x001004ef,
-+ 0x42000800, 0x00000006, 0x0201f800, 0x0010426c,
- 0x0401f009, 0x42000800, 0x00000004, 0x0201f800,
-- 0x001043c7, 0x0401f004, 0x59340200, 0x8400051a,
-+ 0x0010426c, 0x0401f004, 0x59340200, 0x8400051a,
- 0x48026a00, 0x4a025a06, 0x00000000, 0x0201f800,
-- 0x00020381, 0x0201f800, 0x000208b4, 0x0401f024,
-+ 0x000202e9, 0x0201f800, 0x000207bb, 0x0401f024,
- 0x83380580, 0x00000027, 0x0400000f, 0x83380580,
-- 0x00000014, 0x02020800, 0x00100615, 0x492fc857,
-- 0x0201f800, 0x001068f6, 0x42028000, 0x00000031,
-+ 0x00000014, 0x02020800, 0x001004ef, 0x492fc857,
-+ 0x0201f800, 0x001063c4, 0x42028000, 0x00000031,
- 0x42000800, 0x00000004, 0x42001000, 0x000000ff,
-- 0x0401f00a, 0x492fc857, 0x0201f800, 0x001068f6,
-+ 0x0401f00a, 0x492fc857, 0x0201f800, 0x001063c4,
- 0x42028000, 0x00000031, 0x42000800, 0x00000004,
- 0x42001000, 0x00000010, 0x49425a06, 0x4806580d,
-- 0x480a580e, 0x0201f800, 0x00020381, 0x0201f800,
-- 0x00104a83, 0x0201f800, 0x00107698, 0x5c025800,
-- 0x1c01f000, 0x492fc857, 0x42007000, 0x0010b5f6,
-+ 0x480a580e, 0x0201f800, 0x000202e9, 0x0201f800,
-+ 0x00104975, 0x0201f800, 0x0010719c, 0x5c025800,
-+ 0x1c01f000, 0x492fc857, 0x42007000, 0x0010afc6,
- 0x58380807, 0x800409c0, 0x04020005, 0x492c7008,
-- 0x492c7007, 0x0201f000, 0x001008be, 0x492c0800,
-+ 0x492c7007, 0x0201f000, 0x001007bb, 0x492c0800,
- 0x492c7007, 0x1c01f000, 0x4d2c0000, 0x4c580000,
- 0x4c500000, 0x4c540000, 0x4933c857, 0x4937c857,
- 0x59cc0806, 0x4807c857, 0x82040d00, 0xff000000,
-@@ -10721,195 +10312,203 @@ uint32_t risc_code01[] = {
- 0x05000000, 0x0400000a, 0x82040580, 0x21000000,
- 0x04000030, 0x82040580, 0x24000000, 0x0400002d,
- 0x82040580, 0x20000000, 0x0402002f, 0x0201f800,
-- 0x0010082a, 0x0400002c, 0x492fc857, 0x492e6017,
-- 0x59a8b016, 0x8258b400, 0x0000001b, 0x8258b500,
-+ 0x0010071a, 0x0400002c, 0x492fc857, 0x492e6017,
-+ 0x59a8b015, 0x8258b400, 0x0000001b, 0x8258b500,
- 0xfffffffc, 0x8058b104, 0x485a5c04, 0x412c7800,
- 0x41cca000, 0x82580480, 0x00000010, 0x04021005,
-- 0x832cac00, 0x00000005, 0x0401fa78, 0x0401f015,
-+ 0x832cac00, 0x00000005, 0x0401fa9a, 0x0401f015,
- 0x40580800, 0x4200b000, 0x0000000f, 0x832cac00,
-- 0x00000005, 0x0401fa71, 0x8204b480, 0x0000000f,
-- 0x0201f800, 0x0010082a, 0x04000004, 0x492c7801,
-+ 0x00000005, 0x0401fa93, 0x8204b480, 0x0000000f,
-+ 0x0201f800, 0x0010071a, 0x04000004, 0x492c7801,
- 0x412c7800, 0x0401f7ec, 0x59325817, 0x0201f800,
-- 0x00100843, 0x497a6017, 0x80000580, 0x0401f006,
-+ 0x0010073b, 0x497a6017, 0x80000580, 0x0401f006,
- 0x59340200, 0x84000554, 0x48026a00, 0x82000540,
- 0x00000001, 0x5c00a800, 0x5c00a000, 0x5c00b000,
- 0x5c025800, 0x1c01f000, 0x4933c857, 0x492fc857,
- 0x4d2c0000, 0x4c5c0000, 0x5930bc06, 0x59300a03,
-- 0x82040580, 0x00000007, 0x0400003c, 0x82040580,
-- 0x00000001, 0x02020800, 0x00100615, 0x0201f800,
-- 0x0010698c, 0x4df00000, 0x598c000d, 0x81300580,
-+ 0x82040580, 0x00000007, 0x0400003d, 0x82040580,
-+ 0x00000001, 0x02020800, 0x001004ef, 0x0201f800,
-+ 0x00106476, 0x4df00000, 0x598c000d, 0x81300580,
- 0x04020019, 0x59300004, 0x8c000520, 0x04000004,
- 0x84000520, 0x48026004, 0x0401f019, 0x825c0580,
-- 0x00000011, 0x0402000d, 0x42001000, 0x0010b5f4,
-+ 0x00000011, 0x0402000d, 0x42001000, 0x0010afc4,
- 0x50081000, 0x58080002, 0x82000580, 0x00000100,
- 0x04000006, 0x5808000c, 0x81300580, 0x02020800,
-- 0x00100615, 0x0401f00a, 0x0201f800, 0x00106be2,
-- 0x04020027, 0x59300004, 0x8c000520, 0x04000004,
-- 0x84000520, 0x48026004, 0x0401f003, 0x0201f800,
-- 0x00106619, 0x5c03e000, 0x02000800, 0x00106982,
-- 0x0201f800, 0x00108df4, 0x02000800, 0x00100615,
-- 0x59325808, 0x4a025a06, 0x00000005, 0x0201f800,
-- 0x00020381, 0x825c0580, 0x00000005, 0x0400001b,
-- 0x0201f800, 0x00104a83, 0x825c0580, 0x00000005,
-- 0x04000016, 0x59325817, 0x812e59c0, 0x02020800,
-- 0x00100843, 0x0201f800, 0x00107698, 0x80000580,
-- 0x5c00b800, 0x5c025800, 0x1c01f000, 0x5c03e000,
-- 0x02000800, 0x00106982, 0x59300c06, 0x82040580,
-- 0x00000011, 0x040007ae, 0x82040580, 0x00000005,
-- 0x040007ab, 0x0401f7f3, 0x0201f800, 0x000208b4,
-- 0x0401f7ef, 0x4c040000, 0x59340200, 0x4803c857,
-- 0x8c00051c, 0x04000009, 0x59cc0805, 0x591c0019,
-- 0x4803c857, 0x80040580, 0x04000004, 0x80000580,
-- 0x4803c856, 0x0401f003, 0x82000540, 0x00000001,
-- 0x5c000800, 0x1c01f000, 0x4c000000, 0x4c0c0000,
-- 0x4c100000, 0x42001800, 0x0000ffff, 0x42002000,
-- 0x00000004, 0x0401f013, 0x4c000000, 0x4c0c0000,
-- 0x4c100000, 0x59302009, 0x58101c03, 0x42002000,
-- 0x00000004, 0x0401f00b, 0x4c000000, 0x4c0c0000,
-- 0x4c100000, 0x59302009, 0x801021c0, 0x02000800,
-- 0x00100615, 0x58101c03, 0x42002000, 0x00000007,
-- 0x480fc857, 0x4813c857, 0x481bc857, 0x0201f800,
-- 0x001038c7, 0x5c002000, 0x5c001800, 0x5c000000,
-- 0x1c01f000, 0x83380580, 0x00000092, 0x02020800,
-- 0x00100615, 0x42000800, 0x80000040, 0x4a026203,
-- 0x00000001, 0x493a6403, 0x0201f000, 0x00020855,
-- 0x4d400000, 0x0201f800, 0x0010393e, 0x04000008,
-- 0x59a80005, 0x84000544, 0x48035005, 0x42028000,
-- 0x0000002a, 0x0201f800, 0x0010a25b, 0x5c028000,
-- 0x1c01f000, 0x59a80026, 0x8c000508, 0x04000005,
-- 0x599c0017, 0x8c00050a, 0x04020002, 0x1c01f000,
-- 0x82000540, 0x00000001, 0x1c01f000, 0x59300420,
-- 0x84000540, 0x48026420, 0x1c01f000, 0x4817c857,
-- 0x4c000000, 0x4c040000, 0x8c142d2a, 0x04000004,
-- 0x598800b9, 0x80000000, 0x480310b9, 0x8c142d2e,
-- 0x04000004, 0x598800ba, 0x80000000, 0x480310ba,
-- 0x8c142d2c, 0x04000013, 0x40140000, 0x82000500,
-- 0x00070000, 0x82000d80, 0x00030000, 0x0400000d,
-- 0x82000d80, 0x00040000, 0x0400000a, 0x82000d80,
-- 0x00050000, 0x04000007, 0x59880005, 0x80000000,
-- 0x48031005, 0x598800bb, 0x80000000, 0x480310bb,
-- 0x5c000800, 0x5c000000, 0x1c01f000, 0x4817c857,
-- 0x4c000000, 0x4c040000, 0x8c142d2a, 0x04000004,
-- 0x598800bc, 0x80000000, 0x480310bc, 0x8c142d2e,
-- 0x04000004, 0x598800bd, 0x80000000, 0x480310bd,
-- 0x8c142d2c, 0x04000013, 0x40140000, 0x82000500,
-- 0x00070000, 0x82000d80, 0x00030000, 0x0400000d,
-- 0x82000d80, 0x00040000, 0x0400000a, 0x82000d80,
-- 0x00050000, 0x04000007, 0x59880005, 0x80000000,
-- 0x48031005, 0x598800be, 0x80000000, 0x480310be,
-- 0x5c000800, 0x5c000000, 0x1c01f000, 0x4c000000,
-- 0x59880001, 0x80000000, 0x4803c857, 0x48031001,
-- 0x5c000000, 0x1c01f000, 0x4c000000, 0x59880000,
-- 0x80000000, 0x4803c857, 0x48031000, 0x5c000000,
-- 0x1c01f000, 0x4c000000, 0x59880002, 0x80000000,
-- 0x4803c857, 0x48031002, 0x5c000000, 0x1c01f000,
-- 0x4807c857, 0x4c000000, 0x8c040d2c, 0x04000004,
-- 0x598800a7, 0x80000000, 0x480310a7, 0x8c040d2a,
-- 0x04000004, 0x598800a8, 0x80000000, 0x480310a8,
-- 0x8c040d28, 0x04000004, 0x598800a9, 0x80000000,
-- 0x480310a9, 0x8c040d26, 0x04000004, 0x598800aa,
-- 0x80000000, 0x480310aa, 0x8c040d24, 0x04000004,
-- 0x598800ab, 0x80000000, 0x480310ab, 0x8c040d22,
-- 0x04000004, 0x598800ac, 0x80000000, 0x480310ac,
-- 0x8c040d20, 0x04000004, 0x598800ad, 0x80000000,
-- 0x480310ad, 0x5c000000, 0x1c01f000, 0x4807c857,
-- 0x4c000000, 0x598800ae, 0x80000000, 0x480310ae,
-+ 0x001004ef, 0x0401f00a, 0x0201f800, 0x001066d5,
-+ 0x04020028, 0x59300004, 0x8c000520, 0x04000004,
-+ 0x84000520, 0x48026004, 0x0401f004, 0x0201f800,
-+ 0x0010ccce, 0x80c40040, 0x5c03e000, 0x02000800,
-+ 0x00106463, 0x0201f800, 0x0010883d, 0x02000800,
-+ 0x001004ef, 0x59325808, 0x4a025a06, 0x00000005,
-+ 0x0201f800, 0x000202e9, 0x825c0580, 0x00000005,
-+ 0x0400001b, 0x0201f800, 0x00104975, 0x825c0580,
-+ 0x00000005, 0x04000016, 0x59325817, 0x812e59c0,
-+ 0x02020800, 0x0010073b, 0x0201f800, 0x0010719c,
-+ 0x80000580, 0x5c00b800, 0x5c025800, 0x1c01f000,
-+ 0x5c03e000, 0x02000800, 0x00106463, 0x59300c06,
-+ 0x82040580, 0x00000011, 0x040007ad, 0x82040580,
-+ 0x00000005, 0x040007aa, 0x0401f7f3, 0x0201f800,
-+ 0x000207bb, 0x0401f7ef, 0x4c040000, 0x59340200,
-+ 0x4803c857, 0x8c00051c, 0x04000009, 0x59cc0805,
-+ 0x591c0019, 0x4803c857, 0x80040580, 0x04000004,
-+ 0x80000580, 0x4803c856, 0x0401f003, 0x82000540,
-+ 0x00000001, 0x5c000800, 0x1c01f000, 0x4c000000,
-+ 0x4c0c0000, 0x4c100000, 0x42001800, 0x0000ffff,
-+ 0x42002000, 0x00000004, 0x0401f013, 0x4c000000,
-+ 0x4c0c0000, 0x4c100000, 0x59302009, 0x58101c03,
-+ 0x42002000, 0x00000004, 0x0401f00b, 0x4c000000,
-+ 0x4c0c0000, 0x4c100000, 0x59302009, 0x801021c0,
-+ 0x02000800, 0x001004ef, 0x58101c03, 0x42002000,
-+ 0x00000007, 0x480fc857, 0x4813c857, 0x481bc857,
-+ 0x0201f800, 0x00103764, 0x5c002000, 0x5c001800,
-+ 0x5c000000, 0x1c01f000, 0x83380580, 0x00000092,
-+ 0x02020800, 0x001004ef, 0x42000800, 0x80000040,
-+ 0x4a026203, 0x00000001, 0x493a6403, 0x0201f000,
-+ 0x0002075c, 0x4d400000, 0x8d0e1d20, 0x04000006,
-+ 0x850e1d44, 0x42028000, 0x0000002a, 0x0201f800,
-+ 0x00109c1f, 0x5c028000, 0x1c01f000, 0x59a80023,
-+ 0x8c000508, 0x04000005, 0x599c0017, 0x8c00050a,
-+ 0x04020002, 0x1c01f000, 0x82000540, 0x00000001,
-+ 0x1c01f000, 0x59300420, 0x84000540, 0x48026420,
-+ 0x1c01f000, 0x4c000000, 0x0401f803, 0x5c000000,
-+ 0x1c01f000, 0x4c640000, 0x0201f800, 0x00108c2f,
-+ 0x59300203, 0x82000580, 0x00000008, 0x04020015,
-+ 0x4200c800, 0x00000032, 0x42000000, 0x20000000,
-+ 0x41300800, 0x0201f800, 0x00100ad5, 0x0400000d,
-+ 0x59300203, 0x82000580, 0x00000008, 0x04020009,
-+ 0x42000000, 0x0000001e, 0x80000040, 0x040207ff,
-+ 0x8064c840, 0x040207f1, 0x0201f800, 0x001004ef,
-+ 0x0201f800, 0x00108c47, 0x5c00c800, 0x1c01f000,
-+ 0x4817c857, 0x4c000000, 0x4c040000, 0x8c142d2a,
-+ 0x04000004, 0x598800b9, 0x80000000, 0x480310b9,
-+ 0x8c142d2e, 0x04000004, 0x598800ba, 0x80000000,
-+ 0x480310ba, 0x8c142d2c, 0x04000013, 0x40140000,
-+ 0x82000500, 0x00070000, 0x82000d80, 0x00030000,
-+ 0x0400000d, 0x82000d80, 0x00040000, 0x0400000a,
-+ 0x82000d80, 0x00050000, 0x04000007, 0x59880005,
-+ 0x80000000, 0x48031005, 0x598800bb, 0x80000000,
-+ 0x480310bb, 0x5c000800, 0x5c000000, 0x1c01f000,
-+ 0x4817c857, 0x4c000000, 0x4c040000, 0x8c142d2a,
-+ 0x04000004, 0x598800bc, 0x80000000, 0x480310bc,
-+ 0x8c142d2e, 0x04000004, 0x598800bd, 0x80000000,
-+ 0x480310bd, 0x8c142d2c, 0x04000013, 0x40140000,
-+ 0x82000500, 0x00070000, 0x82000d80, 0x00030000,
-+ 0x0400000d, 0x82000d80, 0x00040000, 0x0400000a,
-+ 0x82000d80, 0x00050000, 0x04000007, 0x59880005,
-+ 0x80000000, 0x48031005, 0x598800be, 0x80000000,
-+ 0x480310be, 0x5c000800, 0x5c000000, 0x1c01f000,
-+ 0x4c000000, 0x59880001, 0x80000000, 0x4803c857,
-+ 0x48031001, 0x5c000000, 0x1c01f000, 0x4c000000,
-+ 0x59880000, 0x80000000, 0x4803c857, 0x48031000,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59880002,
-+ 0x80000000, 0x4803c857, 0x48031002, 0x5c000000,
-+ 0x1c01f000, 0x4807c857, 0x4c000000, 0x8c040d2c,
-+ 0x04000004, 0x598800a7, 0x80000000, 0x480310a7,
-+ 0x8c040d2a, 0x04000004, 0x598800a8, 0x80000000,
-+ 0x480310a8, 0x8c040d28, 0x04000004, 0x598800a9,
-+ 0x80000000, 0x480310a9, 0x8c040d26, 0x04000004,
-+ 0x598800aa, 0x80000000, 0x480310aa, 0x8c040d24,
-+ 0x04000004, 0x598800ab, 0x80000000, 0x480310ab,
-+ 0x8c040d22, 0x04000004, 0x598800ac, 0x80000000,
-+ 0x480310ac, 0x8c040d20, 0x04000004, 0x598800ad,
-+ 0x80000000, 0x480310ad, 0x5c000000, 0x1c01f000,
-+ 0x4807c857, 0x4c000000, 0x598800ae, 0x80000000,
-+ 0x480310ae, 0x5c000000, 0x1c01f000, 0x4807c857,
-+ 0x4c000000, 0x8c040d1c, 0x04000004, 0x598800af,
-+ 0x80000000, 0x480310af, 0x8c040d1a, 0x04000004,
-+ 0x598800b0, 0x80000000, 0x480310b0, 0x5c000000,
-+ 0x1c01f000, 0x4807c857, 0x4c000000, 0x8c040d18,
-+ 0x04000004, 0x598800b1, 0x80000000, 0x480310b1,
-+ 0x8c040d16, 0x04000004, 0x598800b2, 0x80000000,
-+ 0x480310b2, 0x8c040d14, 0x04000004, 0x598800b3,
-+ 0x80000000, 0x480310b3, 0x5c000000, 0x1c01f000,
-+ 0x4807c857, 0x4c000000, 0x8c040d10, 0x04000004,
-+ 0x598800b4, 0x80000000, 0x480310b4, 0x8c040d0c,
-+ 0x04000004, 0x598800b5, 0x80000000, 0x480310b5,
- 0x5c000000, 0x1c01f000, 0x4807c857, 0x4c000000,
-- 0x8c040d1c, 0x04000004, 0x598800af, 0x80000000,
-- 0x480310af, 0x8c040d1a, 0x04000004, 0x598800b0,
-- 0x80000000, 0x480310b0, 0x5c000000, 0x1c01f000,
-- 0x4807c857, 0x4c000000, 0x8c040d18, 0x04000004,
-- 0x598800b1, 0x80000000, 0x480310b1, 0x8c040d16,
-- 0x04000004, 0x598800b2, 0x80000000, 0x480310b2,
-- 0x8c040d14, 0x04000004, 0x598800b3, 0x80000000,
-- 0x480310b3, 0x5c000000, 0x1c01f000, 0x4807c857,
-- 0x4c000000, 0x8c040d10, 0x04000004, 0x598800b4,
-- 0x80000000, 0x480310b4, 0x8c040d0c, 0x04000004,
-- 0x598800b5, 0x80000000, 0x480310b5, 0x5c000000,
-- 0x1c01f000, 0x4807c857, 0x4c000000, 0x8c040d08,
-- 0x04000004, 0x598800b6, 0x80000000, 0x480310b6,
-- 0x8c040d04, 0x04000004, 0x598800b7, 0x80000000,
-- 0x480310b7, 0x5c000000, 0x1c01f000, 0x4807c856,
-- 0x4c000000, 0x59880080, 0x80000000, 0x48031080,
-- 0x5c000000, 0x1c01f000, 0x4803c857, 0x4c040000,
-- 0x50000800, 0x80040800, 0x4807c857, 0x44040000,
-- 0x5c000800, 0x1c01f000, 0x480fc857, 0x4c000000,
-- 0x820c0580, 0x00000000, 0x04020004, 0x42000000,
-- 0x0010b617, 0x0401f014, 0x820c0580, 0x00001001,
-- 0x04020004, 0x42000000, 0x0010b618, 0x0401f00e,
-- 0x820c0580, 0x00001002, 0x04020004, 0x42000000,
-- 0x0010b619, 0x0401f008, 0x820c0c80, 0x0000201c,
-- 0x02021800, 0x00100615, 0x820c0500, 0x0000001f,
-- 0x0c01f804, 0x0401ffdd, 0x5c000000, 0x1c01f000,
-- 0x0010a8b0, 0x0010a8b3, 0x0010a8b6, 0x0010a8b9,
-- 0x0010a8bc, 0x0010a8bf, 0x0010a8c2, 0x0010a8c5,
-- 0x0010a8c8, 0x0010a8cb, 0x0010a8ce, 0x0010a8d1,
-- 0x0010a8d4, 0x0010a8d7, 0x0010a8da, 0x0010a8dd,
-- 0x0010a8e0, 0x0010a8e3, 0x0010a8e6, 0x0010a8e9,
-- 0x0010a8ec, 0x0010a8ef, 0x0010a8f2, 0x0010a8f5,
-- 0x0010a8f8, 0x0010a8fb, 0x0010a8fe, 0x0010a901,
-- 0x42000000, 0x0010b61a, 0x1c01f000, 0x42000000,
-- 0x0010b61b, 0x1c01f000, 0x42000000, 0x0010b61c,
-- 0x1c01f000, 0x42000000, 0x0010b61d, 0x1c01f000,
-- 0x42000000, 0x0010b61e, 0x1c01f000, 0x42000000,
-- 0x0010b61f, 0x1c01f000, 0x42000000, 0x0010b620,
-- 0x1c01f000, 0x42000000, 0x0010b621, 0x1c01f000,
-- 0x42000000, 0x0010b622, 0x1c01f000, 0x42000000,
-- 0x0010b623, 0x1c01f000, 0x42000000, 0x0010b624,
-- 0x1c01f000, 0x42000000, 0x0010b625, 0x1c01f000,
-- 0x42000000, 0x0010b626, 0x1c01f000, 0x42000000,
-- 0x0010b627, 0x1c01f000, 0x42000000, 0x0010b628,
-- 0x1c01f000, 0x42000000, 0x0010b629, 0x1c01f000,
-- 0x42000000, 0x0010b62a, 0x1c01f000, 0x42000000,
-- 0x0010b62b, 0x1c01f000, 0x42000000, 0x0010b62c,
-- 0x1c01f000, 0x42000000, 0x0010b62d, 0x1c01f000,
-- 0x42000000, 0x0010b62e, 0x1c01f000, 0x42000000,
-- 0x0010b62f, 0x1c01f000, 0x42000000, 0x0010b630,
-- 0x1c01f000, 0x42000000, 0x0010b631, 0x1c01f000,
-- 0x42000000, 0x0010b632, 0x1c01f000, 0x42000000,
-- 0x0010b633, 0x1c01f000, 0x42000000, 0x0010b634,
-- 0x1c01f000, 0x42000000, 0x0010b635, 0x1c01f000,
-- 0x480fc857, 0x4c000000, 0x820c0580, 0x00000001,
-- 0x04020004, 0x42000000, 0x0010b60c, 0x0401f012,
-- 0x820c0580, 0x00000002, 0x04020004, 0x42000000,
-- 0x0010b60d, 0x0401f00c, 0x820c0580, 0x00000003,
-- 0x04020004, 0x42000000, 0x0010b60e, 0x0401f006,
-- 0x820c0580, 0x00000004, 0x04020004, 0x42000000,
-- 0x0010b60f, 0x0401ff51, 0x5c000000, 0x1c01f000,
-- 0x4c000000, 0x59a80026, 0x4803c857, 0x8c000502,
-- 0x04000010, 0x8c000506, 0x04000004, 0x42000000,
-- 0x0010b63f, 0x0401f012, 0x8c00050a, 0x04000004,
-- 0x42000000, 0x0010b63e, 0x0401f00d, 0x8c000508,
-- 0x04000004, 0x42000000, 0x0010b641, 0x0401f008,
-- 0x0201f800, 0x00104e0d, 0x04000006, 0x8c000506,
-- 0x04020004, 0x42000000, 0x0010b640, 0x0401ff33,
-- 0x5c000000, 0x1c01f000, 0x8058b1c0, 0x02000800,
-- 0x00100615, 0x5450a800, 0x8050a000, 0x8054a800,
-- 0x8058b040, 0x040207fc, 0x1c01f000, 0x8058b1c0,
-- 0x02000800, 0x00100615, 0x4450a800, 0x8054a800,
-- 0x8058b040, 0x040207fd, 0x1c01f000, 0x8058b1c0,
-- 0x02000800, 0x00100615, 0x50500000, 0x9c0001c0,
-- 0x4400a800, 0x8050a000, 0x8054a800, 0x8058b040,
-- 0x040207fa, 0x1c01f000, 0x4c000000, 0x59a80008,
-- 0x8c00051c, 0x5c000000, 0x1c01f000, 0x00000001,
-- 0x00000002, 0x00000004, 0x00000008, 0x00000010,
-- 0x00000020, 0x00000040, 0x00000080, 0x00000100,
-- 0x00000200, 0x00000400, 0x00000800, 0x00001000,
-- 0x00002000, 0x00004000, 0x00008000, 0x00010000,
-- 0xd2764e14
-+ 0x8c040d08, 0x04000004, 0x598800b6, 0x80000000,
-+ 0x480310b6, 0x8c040d04, 0x04000004, 0x598800b7,
-+ 0x80000000, 0x480310b7, 0x5c000000, 0x1c01f000,
-+ 0x4807c856, 0x4c000000, 0x59880080, 0x80000000,
-+ 0x48031080, 0x5c000000, 0x1c01f000, 0x40680000,
-+ 0x4803c857, 0x4c040000, 0x50000800, 0x80040800,
-+ 0x4807c857, 0x44040000, 0x5c000800, 0x1c01f000,
-+ 0x480fc857, 0x4c000000, 0x820c0580, 0x00000000,
-+ 0x04020004, 0x42000000, 0x0010afe7, 0x0401f014,
-+ 0x820c0580, 0x00001001, 0x04020004, 0x42000000,
-+ 0x0010afe8, 0x0401f00e, 0x820c0580, 0x00001002,
-+ 0x04020004, 0x42000000, 0x0010afe9, 0x0401f008,
-+ 0x820c0c80, 0x0000201c, 0x02021800, 0x001004ef,
-+ 0x820c0500, 0x0000001f, 0x0c01f804, 0x0401ffdd,
-+ 0x5c000000, 0x1c01f000, 0x0010a2a2, 0x0010a2a5,
-+ 0x0010a2a8, 0x0010a2ab, 0x0010a2ae, 0x0010a2b1,
-+ 0x0010a2b4, 0x0010a2b7, 0x0010a2ba, 0x0010a2bd,
-+ 0x0010a2c0, 0x0010a2c3, 0x0010a2c6, 0x0010a2c9,
-+ 0x0010a2cc, 0x0010a2cf, 0x0010a2d2, 0x0010a2d5,
-+ 0x0010a2d8, 0x0010a2db, 0x0010a2de, 0x0010a2e1,
-+ 0x0010a2e4, 0x0010a2e7, 0x0010a2ea, 0x0010a2ed,
-+ 0x0010a2f0, 0x0010a2f3, 0x42000000, 0x0010afea,
-+ 0x1c01f000, 0x42000000, 0x0010afeb, 0x1c01f000,
-+ 0x42000000, 0x0010afec, 0x1c01f000, 0x42000000,
-+ 0x0010afed, 0x1c01f000, 0x42000000, 0x0010afee,
-+ 0x1c01f000, 0x42000000, 0x0010afef, 0x1c01f000,
-+ 0x42000000, 0x0010aff0, 0x1c01f000, 0x42000000,
-+ 0x0010aff1, 0x1c01f000, 0x42000000, 0x0010aff2,
-+ 0x1c01f000, 0x42000000, 0x0010aff3, 0x1c01f000,
-+ 0x42000000, 0x0010aff4, 0x1c01f000, 0x42000000,
-+ 0x0010aff5, 0x1c01f000, 0x42000000, 0x0010aff6,
-+ 0x1c01f000, 0x42000000, 0x0010aff7, 0x1c01f000,
-+ 0x42000000, 0x0010aff8, 0x1c01f000, 0x42000000,
-+ 0x0010aff9, 0x1c01f000, 0x42000000, 0x0010affa,
-+ 0x1c01f000, 0x42000000, 0x0010affb, 0x1c01f000,
-+ 0x42000000, 0x0010affc, 0x1c01f000, 0x42000000,
-+ 0x0010affd, 0x1c01f000, 0x42000000, 0x0010affe,
-+ 0x1c01f000, 0x42000000, 0x0010afff, 0x1c01f000,
-+ 0x42000000, 0x0010b000, 0x1c01f000, 0x42000000,
-+ 0x0010b001, 0x1c01f000, 0x42000000, 0x0010b002,
-+ 0x1c01f000, 0x42000000, 0x0010b003, 0x1c01f000,
-+ 0x42000000, 0x0010b004, 0x1c01f000, 0x42000000,
-+ 0x0010b005, 0x1c01f000, 0x480fc857, 0x4c000000,
-+ 0x820c0580, 0x00000001, 0x04020004, 0x42000000,
-+ 0x0010afdc, 0x0401f012, 0x820c0580, 0x00000002,
-+ 0x04020004, 0x42000000, 0x0010afdd, 0x0401f00c,
-+ 0x820c0580, 0x00000003, 0x04020004, 0x42000000,
-+ 0x0010afde, 0x0401f006, 0x820c0580, 0x00000004,
-+ 0x04020004, 0x42000000, 0x0010afdf, 0x0401ff51,
-+ 0x5c000000, 0x1c01f000, 0x4c000000, 0x59a80023,
-+ 0x4803c857, 0x8c000502, 0x04000010, 0x8c000506,
-+ 0x04000004, 0x42000000, 0x0010b00f, 0x0401f012,
-+ 0x8c00050a, 0x04000004, 0x42000000, 0x0010b00e,
-+ 0x0401f00d, 0x8c000508, 0x04000004, 0x42000000,
-+ 0x0010b011, 0x0401f008, 0x0201f800, 0x00104ca6,
-+ 0x04000006, 0x8c000506, 0x04020004, 0x42000000,
-+ 0x0010b010, 0x0401ff33, 0x5c000000, 0x1c01f000,
-+ 0x8058b1c0, 0x02000800, 0x001004ef, 0x5450a800,
-+ 0x8050a000, 0x8054a800, 0x8058b040, 0x040207fc,
-+ 0x1c01f000, 0x8058b1c0, 0x02000800, 0x001004ef,
-+ 0x4450a800, 0x8054a800, 0x8058b040, 0x040207fd,
-+ 0x1c01f000, 0x8058b1c0, 0x02000800, 0x001004ef,
-+ 0x50500000, 0x9c0001c0, 0x4400a800, 0x8050a000,
-+ 0x8054a800, 0x8058b040, 0x040207fa, 0x1c01f000,
-+ 0x4c000000, 0x59a80007, 0x8c00051c, 0x5c000000,
-+ 0x1c01f000, 0x00000001, 0x00000002, 0x00000004,
-+ 0x00000008, 0x00000010, 0x00000020, 0x00000040,
-+ 0x00000080, 0x00000100, 0x00000200, 0x00000400,
-+ 0x00000800, 0x00001000, 0x00002000, 0x00004000,
-+ 0x00008000, 0x00010000, 0x210ce798
- };
-
- #ifdef UNIQUE_FW_NAME
--uint32_t fw2400_length01 = 0x0000a971 ;
-+uint32_t fw2400_length01 = 0x0000a363 ;
- #else
--uint32_t risc_code_length01 = 0x0000a971 ;
-+uint32_t risc_code_length01 = 0x0000a363 ;
- #endif
-
-
- #ifdef UNIQUE_FW_NAME
--uint32_t fw2400_addr02 = 0x0010d000 ;
-+uint32_t fw2400_addr02 = 0x0010e000 ;
- #else
--uint32_t risc_code_addr02 = 0x0010d000 ;
-+uint32_t risc_code_addr02 = 0x0010e000 ;
- #endif
-
- #ifdef UNIQUE_FW_NAME
-@@ -10917,327 +10516,274 @@ uint32_t fw2400_code02[] = {
- #else
- uint32_t risc_code02[] = {
- #endif
-- 0x00000000, 0x00000000, 0x0010d000, 0x0000165e,
-- 0x00000000, 0x00000000, 0x00020000, 0x000009f7,
-- 0x836c0580, 0x00000003, 0x02020000, 0x00100314,
-- 0x42000000, 0x0010b2b7, 0x50000000, 0x800001c0,
-- 0x0402098a, 0x0401f94d, 0x0201f800, 0x00020524,
-- 0x0401fbfe, 0x0201f800, 0x0002084c, 0x0201f800,
-- 0x000206af, 0x0401f7ef, 0x59b800ea, 0x82000d00,
-- 0xf0000038, 0x02020000, 0x00100ac3, 0x8c000510,
-- 0x02000000, 0x00100ac2, 0x59ba60e0, 0x81300182,
-- 0x0402104e, 0x04002030, 0x8532653e, 0x59300406,
-- 0x82000580, 0x00000003, 0x04020028, 0x59300203,
-- 0x82000580, 0x00000004, 0x04020024, 0x59325808,
-- 0x59300402, 0x4a025a04, 0x00000103, 0x900001c0,
-- 0x48025806, 0x497a5807, 0x497a5c09, 0x5930001f,
-- 0x80000540, 0x02020800, 0x00100d9a, 0x59300004,
-- 0x8c00053e, 0x04020010, 0x0401fb47, 0x59326809,
-- 0x0201f800, 0x000208b4, 0x5934000f, 0x5934140b,
-+ 0x00000000, 0x00000000, 0x0010e000, 0x0000202a,
-+ 0x00000000, 0x00000000, 0x00020000, 0x000008fe,
-+ 0x836c0580, 0x00000003, 0x02020000, 0x00100335,
-+ 0x42000000, 0x0010ac88, 0x50000000, 0x800001c0,
-+ 0x0402097c, 0x0401f93f, 0x0201f800, 0x00020450,
-+ 0x0401faf5, 0x0201f800, 0x00020753, 0x0201f800,
-+ 0x000205d0, 0x0401f7ef, 0x59b800ea, 0x82000d00,
-+ 0xf0000038, 0x02020000, 0x001009ba, 0x8c000510,
-+ 0x02000000, 0x001009b9, 0x59ba60e0, 0x81300182,
-+ 0x04021042, 0x04002028, 0x8532653e, 0x59300406,
-+ 0x82000580, 0x00000003, 0x04020020, 0x59300203,
-+ 0x82000580, 0x00000004, 0x0402001c, 0x59325808,
-+ 0x59300004, 0x4a025a04, 0x00000103, 0x497a5809,
-+ 0x8c00053e, 0x04020010, 0x0401fab7, 0x59326809,
-+ 0x0201f800, 0x000207bb, 0x5934000f, 0x5934140b,
- 0x80081040, 0x04001002, 0x480a6c0b, 0x80000540,
-- 0x04020a31, 0x59b800ea, 0x8c000510, 0x040207d7,
-- 0x1c01f000, 0x0201f800, 0x00106cb4, 0x040007ef,
-- 0x0201f000, 0x00100aae, 0x42027000, 0x00000055,
-- 0x0401f027, 0x83326500, 0x3fffffff, 0x59300406,
-- 0x82000580, 0x00000003, 0x04020015, 0x59325808,
-- 0x59326809, 0x59301402, 0x4a025a04, 0x00000103,
-- 0x900811c0, 0x480a5806, 0x497a5c09, 0x497a5807,
-- 0x0401fb21, 0x0201f800, 0x000208b4, 0x5934000f,
-+ 0x04020a2c, 0x59b800ea, 0x8c000510, 0x040207df,
-+ 0x1c01f000, 0x0201f800, 0x001067a7, 0x040007ef,
-+ 0x0201f000, 0x001009a5, 0x42027000, 0x00000055,
-+ 0x0401f023, 0x83326500, 0x3fffffff, 0x59300406,
-+ 0x82000580, 0x00000003, 0x04020011, 0x59325808,
-+ 0x59326809, 0x4a025a04, 0x00000103, 0x497a5809,
-+ 0x0401fa95, 0x0201f800, 0x000207bb, 0x5934000f,
- 0x5934140b, 0x80081040, 0x04001002, 0x480a6c0b,
-- 0x80000540, 0x04020a0c, 0x0401f7db, 0x42027000,
-+ 0x80000540, 0x04020a0b, 0x0401f7df, 0x42027000,
- 0x00000054, 0x0401f00a, 0x83300500, 0x60000000,
-- 0x02000000, 0x00100ab1, 0x81326580, 0x8000013a,
-- 0x82000400, 0x00100ac9, 0x50027000, 0x59300c06,
-- 0x82040580, 0x00000002, 0x02000000, 0x00100aae,
-+ 0x02000000, 0x001009a8, 0x81326580, 0x8000013a,
-+ 0x82000400, 0x001009c0, 0x50027000, 0x59300c06,
-+ 0x82040580, 0x00000002, 0x02000000, 0x001009a5,
- 0x59300004, 0x8c00053e, 0x04020004, 0x0201f800,
-- 0x000208d8, 0x0401f7c4, 0x0201f800, 0x00106cb4,
-- 0x040007fb, 0x0201f000, 0x00100aae, 0x59325808,
-+ 0x000207df, 0x0401f7c8, 0x0201f800, 0x001067a7,
-+ 0x040007fb, 0x0201f000, 0x001009a5, 0x59325808,
- 0x412c7000, 0x58380a04, 0x82040500, 0x0000000f,
-- 0x82000c00, 0x0010110d, 0x50044000, 0x0c01f001,
-- 0x00100e24, 0x00100e24, 0x000200a0, 0x00100e24,
-- 0x00100e24, 0x00100e24, 0x00100e24, 0x00100e24,
-- 0x000200b0, 0x00100e38, 0x00100e24, 0x00100e24,
-- 0x00100e26, 0x00100e24, 0x00100e24, 0x00100e24,
-- 0x5838040a, 0x8c000500, 0x02000800, 0x00100615,
-+ 0x82000c00, 0x00100fd8, 0x50044000, 0x0c01f001,
-+ 0x00100d1b, 0x00100d1b, 0x00020094, 0x00100d1b,
-+ 0x00100d1b, 0x00100d1b, 0x00100d1b, 0x00100d1b,
-+ 0x000200a4, 0x00100d2f, 0x00100d1b, 0x00100d1b,
-+ 0x00100d1d, 0x00100d1b, 0x00100d1b, 0x00100d1b,
-+ 0x5838040a, 0x8c000500, 0x02000800, 0x001004ef,
- 0x50200000, 0x80387c00, 0x583c1002, 0x583c2800,
- 0x583c2001, 0x58380a07, 0x5838300f, 0x59303807,
- 0x58384c08, 0x5838000d, 0x48026012, 0x0401f010,
-- 0x5838020a, 0x8c000502, 0x02000000, 0x00100e24,
-+ 0x5838020a, 0x8c000502, 0x02000000, 0x00100d1b,
- 0x50200000, 0x80387c00, 0x583c2800, 0x583c2001,
- 0x583c1002, 0x592c0a07, 0x592c4c08, 0x592c300f,
- 0x59303807, 0x497a6012, 0x497a6013, 0x4816600e,
- 0x4812600f, 0x480a6010, 0x481a6011, 0x80040840,
-- 0x4806600d, 0x02020000, 0x00100e65, 0x841c3d40,
-+ 0x4806600d, 0x02020000, 0x00100d5c, 0x841c3d40,
- 0x481e6007, 0x1c01f000, 0x41787800, 0x59325808,
-- 0x592c0c0a, 0x8c040d02, 0x02000000, 0x00100fda,
-+ 0x592c0c0a, 0x8c040d02, 0x02000000, 0x00100ed3,
- 0x592c000d, 0x592c100f, 0x592c0a04, 0x480a6011,
- 0x48026012, 0x48026013, 0x412c3000, 0x82040500,
-- 0x0000000f, 0x82000400, 0x0010110d, 0x50003800,
-+ 0x0000000f, 0x82000400, 0x00100fd8, 0x50003800,
- 0x501c0000, 0x401c1000, 0x592c1a07, 0x4802600a,
- 0x481a600b, 0x480a600c, 0x480e600d, 0x843c7d4a,
-- 0x403c1000, 0x1c01f000, 0x41787800, 0x497a6012,
-- 0x592c0a04, 0x412c3000, 0x592c1a07, 0x82040500,
-- 0x0000000f, 0x82000400, 0x0010110d, 0x50004000,
-- 0x50200000, 0x40201000, 0x4802600a, 0x481a600b,
-- 0x480a600c, 0x480e600d, 0x80000580, 0x483e6004,
-- 0x1c01f000, 0x0002014c, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x00020139, 0x00020139, 0x00020139,
-- 0x00020139, 0x4c000000, 0x4df00000, 0x4203e000,
-- 0xb0100000, 0x41f00000, 0x81fe1500, 0x8d0a1512,
-- 0x02020800, 0x00101468, 0x8d0a1518, 0x02020800,
-- 0x00020861, 0x8d0a151a, 0x04020ed0, 0x83080500,
-- 0x00000d00, 0x04020804, 0x5c03e000, 0x5c000000,
-- 0x1801f000, 0x8d0a1516, 0x02020800, 0x001012d9,
-- 0x8d0a1514, 0x02020800, 0x001011a5, 0x8d0a1508,
-- 0x02020800, 0x001011aa, 0x8d0a1500, 0x02020000,
-- 0x000207c8, 0x1c01f000, 0x42000000, 0x0010b2bd,
-- 0x50000000, 0x8c000504, 0x04000014, 0x42000000,
-- 0x0010b2bd, 0x50000000, 0x8c000502, 0x04020002,
-- 0x1c01f000, 0x4df00000, 0x4203e000, 0x50000000,
-- 0x42034000, 0x0010b2a0, 0x59a0001d, 0x59a1d81e,
-- 0x84000502, 0x4803401d, 0x58ec0009, 0x0801f800,
-- 0x5c03e000, 0x1c01f000, 0x04027002, 0x04026002,
-- 0x1c01f000, 0x4df00000, 0x4203e000, 0x50000000,
-- 0x0201f800, 0x0010082a, 0x0400001a, 0x412dd800,
-- 0x48efc857, 0x0201f800, 0x00103941, 0x42034000,
-- 0x0010b2a0, 0x49a1d80b, 0x48ef401e, 0x59a0001d,
-- 0x84000544, 0x4803401d, 0x59e00020, 0x4803c857,
-- 0x59e00021, 0x4803c857, 0x59e00022, 0x4803c857,
-- 0x59e00023, 0x4803c857, 0x59e00024, 0x4803c857,
-- 0x0201f800, 0x00101fbb, 0x0201f800, 0x00101fda,
-- 0x5c03e000, 0x1c01f000, 0x4da00000, 0x4df00000,
-- 0x4203e000, 0x50000000, 0x04006051, 0x42034000,
-- 0x0010b2a0, 0x59a01017, 0x59a01818, 0x800c19c0,
-- 0x04020008, 0x59a0381b, 0x801c39c0, 0x02000800,
-- 0x00100615, 0x59a0041c, 0x801c3c00, 0x0401f00c,
-- 0x59a00419, 0x82000400, 0x00000002, 0x48034419,
-- 0x82000c80, 0x00000013, 0x04001003, 0x497b4419,
-- 0x41780000, 0x59a03816, 0x801c3c00, 0x80081040,
-- 0x480b4017, 0x581c0200, 0x4803c021, 0x581c0401,
-- 0x4803c022, 0x581c0201, 0x4803c023, 0x581c0400,
-- 0x4803c020, 0x900001c0, 0x82000540, 0x00000012,
-- 0x4803c011, 0x59e00017, 0x8c000508, 0x04000003,
-- 0x4a03c017, 0x00000002, 0x4203e000, 0x30000001,
-- 0x800c19c0, 0x04000007, 0x800c1840, 0x480f4018,
-- 0x0402001f, 0x497b4419, 0x497b4219, 0x0401f01c,
-- 0x800811c0, 0x0402000b, 0x4d2c0000, 0x59a2581b,
-- 0x0201f800, 0x0010083a, 0x5c025800, 0x497b401b,
-- 0x497b401a, 0x497b441c, 0x497b421c, 0x0401f010,
-- 0x59a0041c, 0x82000400, 0x00000002, 0x82000c80,
-- 0x00000012, 0x4803441c, 0x04001009, 0x4d2c0000,
-- 0x59a2581b, 0x592c3813, 0x481f401b, 0x497b441c,
-- 0x0201f800, 0x0010083a, 0x5c025800, 0x5c03e000,
-- 0x5c034000, 0x1c01f000, 0x59a80005, 0x82000500,
-- 0x00000003, 0x02020000, 0x00104145, 0x59340400,
-- 0x82000580, 0x00000606, 0x02020000, 0x00104116,
-- 0x5934000d, 0x80027d40, 0x02020000, 0x00104151,
-- 0x0401f803, 0x80000580, 0x1c01f000, 0x5934000f,
-- 0x59341203, 0x80080540, 0x0402005d, 0x5934020b,
-- 0x5934140b, 0x80080480, 0x04021059, 0x0201f800,
-- 0x00020892, 0x04000052, 0x592c0406, 0x49366009,
-- 0x492e6008, 0x4a026406, 0x00000003, 0x4a026403,
-- 0x00000040, 0x80081000, 0x480a6c0b, 0x800000c2,
-+ 0x403c1000, 0x1c01f000, 0x592c0a04, 0x497a6012,
-+ 0x41787800, 0x592c1a07, 0x82040500, 0x0000000f,
-+ 0x82000400, 0x00100fd8, 0x50004000, 0x50200000,
-+ 0x4802600a, 0x492e600b, 0x4822600c, 0x480e600d,
-+ 0x483e6004, 0x80000580, 0x1c01f000, 0x0002013e,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x0002012b,
-+ 0x0002012b, 0x0002012b, 0x0002012b, 0x4c000000,
-+ 0x4df00000, 0x4203e000, 0xb0100000, 0x41f00000,
-+ 0x81fe1500, 0x8d0a1512, 0x02020800, 0x00101336,
-+ 0x8d0a1518, 0x02020800, 0x00020768, 0x8d0a151a,
-+ 0x04020ede, 0x83080500, 0x00000d00, 0x04020804,
-+ 0x5c03e000, 0x5c000000, 0x1801f000, 0x8d0a1516,
-+ 0x02020800, 0x001011a5, 0x8d0a1514, 0x02020800,
-+ 0x00101070, 0x8d0a1508, 0x02020800, 0x00101075,
-+ 0x8d0a1500, 0x02020000, 0x000206cf, 0x1c01f000,
-+ 0x42000000, 0x0010ac8e, 0x50000000, 0x8c000504,
-+ 0x04000014, 0x42000000, 0x0010ac8e, 0x50000000,
-+ 0x8c000502, 0x04020002, 0x1c01f000, 0x4df00000,
-+ 0x4203e000, 0x50000000, 0x42034000, 0x0010ac71,
-+ 0x59a0001d, 0x59a1d81e, 0x84000502, 0x4803401d,
-+ 0x58ec0009, 0x0801f800, 0x5c03e000, 0x1c01f000,
-+ 0x04027002, 0x04026002, 0x1c01f000, 0x4df00000,
-+ 0x4203e000, 0x50000000, 0x0201f800, 0x0010071a,
-+ 0x0400001a, 0x412dd800, 0x48efc857, 0x0201f800,
-+ 0x001037da, 0x42034000, 0x0010ac71, 0x49a1d80b,
-+ 0x48ef401e, 0x59a0001d, 0x84000544, 0x4803401d,
-+ 0x59e00020, 0x4803c857, 0x59e00021, 0x4803c857,
-+ 0x59e00022, 0x4803c857, 0x59e00023, 0x4803c857,
-+ 0x59e00024, 0x4803c857, 0x0201f800, 0x00101de3,
-+ 0x0201f800, 0x00101e02, 0x5c03e000, 0x1c01f000,
-+ 0x4da00000, 0x4df00000, 0x4203e000, 0x50000000,
-+ 0x04006051, 0x42034000, 0x0010ac71, 0x59a01017,
-+ 0x59a01818, 0x800c19c0, 0x04020008, 0x59a0381b,
-+ 0x801c39c0, 0x02000800, 0x001004ef, 0x59a0041c,
-+ 0x801c3c00, 0x0401f00c, 0x59a00419, 0x82000400,
-+ 0x00000002, 0x48034419, 0x82000c80, 0x00000013,
-+ 0x04001003, 0x497b4419, 0x41780000, 0x59a03816,
-+ 0x801c3c00, 0x80081040, 0x480b4017, 0x581c0200,
-+ 0x4803c021, 0x581c0401, 0x4803c022, 0x581c0201,
-+ 0x4803c023, 0x581c0400, 0x4803c020, 0x900001c0,
-+ 0x82000540, 0x00000012, 0x4803c011, 0x59e00017,
-+ 0x8c000508, 0x04000003, 0x4a03c017, 0x00000002,
-+ 0x4203e000, 0x30000001, 0x800c19c0, 0x04000007,
-+ 0x800c1840, 0x480f4018, 0x0402001f, 0x497b4419,
-+ 0x497b4219, 0x0401f01c, 0x800811c0, 0x0402000b,
-+ 0x4d2c0000, 0x59a2581b, 0x0201f800, 0x0010072e,
-+ 0x5c025800, 0x497b401b, 0x497b401a, 0x497b441c,
-+ 0x497b421c, 0x0401f010, 0x59a0041c, 0x82000400,
-+ 0x00000002, 0x82000c80, 0x00000012, 0x4803441c,
-+ 0x04001009, 0x4d2c0000, 0x59a2581b, 0x592c3813,
-+ 0x481f401b, 0x497b441c, 0x0201f800, 0x0010072e,
-+ 0x5c025800, 0x5c03e000, 0x5c034000, 0x1c01f000,
-+ 0x830c0500, 0x00000003, 0x02020000, 0x00103fe4,
-+ 0x59340400, 0x82000580, 0x00000606, 0x02020000,
-+ 0x00103fb6, 0x5934000d, 0x80027d40, 0x02020000,
-+ 0x00103fef, 0x0401f803, 0x80000580, 0x1c01f000,
-+ 0x5934000f, 0x59341203, 0x80080540, 0x0402005f,
-+ 0x5934000b, 0x80001120, 0x82000500, 0x0000ffff,
-+ 0x80080480, 0x04021059, 0x0201f800, 0x00020799,
-+ 0x04000052, 0x592c0406, 0x49366009, 0x492e6008,
-+ 0x4a026406, 0x00000003, 0x4a026403, 0x00000040,
-+ 0x80081000, 0x480a6c0b, 0x800000c2, 0x800010c4,
-+ 0x80080400, 0x592c0808, 0x592c1809, 0x592c020a,
-+ 0x480a6206, 0x48066017, 0x480e6018, 0x8c000502,
-+ 0x0400002a, 0x4a026203, 0x00000004, 0x592c0207,
-+ 0x80000040, 0x0402001a, 0x59a8006d, 0x80000040,
-+ 0x040207ff, 0x592c0204, 0x82000500, 0x000000ff,
-+ 0x82000580, 0x00000018, 0x04020011, 0x592c180f,
-+ 0x59300007, 0x82000540, 0x00000091, 0x480e6011,
-+ 0x48026007, 0x42000000, 0x80080004, 0x48026004,
-+ 0x59bc00ea, 0x8c000516, 0x040207fe, 0x83300400,
-+ 0x20000000, 0x480378e1, 0x1c01f000, 0x0401fe4c,
-+ 0x59300007, 0x8400054e, 0x48026007, 0x592c1a04,
-+ 0x820c1d00, 0x000000ff, 0x820c0580, 0x00000048,
-+ 0x04000012, 0x0401f7ec, 0x8c000500, 0x04020e9f,
-+ 0x4a026203, 0x00000002, 0x59a8006e, 0x80000040,
-+ 0x040207ff, 0x592c1a04, 0x820c1d00, 0x000000ff,
-+ 0x820c0580, 0x00000018, 0x040007df, 0x820c0580,
-+ 0x00000048, 0x040207dc, 0x42000800, 0x80000804,
-+ 0x0201f000, 0x0010632f, 0x800811c0, 0x04020003,
-+ 0x4a026a03, 0x00000001, 0x59340010, 0x492e6810,
-+ 0x80000d40, 0x04020003, 0x492e680f, 0x1c01f000,
-+ 0x492c0800, 0x1c01f000, 0x83440c80, 0x00000800,
-+ 0x04021009, 0x83440400, 0x0010a400, 0x50000000,
-+ 0x80000540, 0x04000004, 0x40026800, 0x80000580,
-+ 0x1c01f000, 0x82000540, 0x00000001, 0x1c01f000,
-+ 0x59340203, 0x80000540, 0x0402004d, 0x4d300000,
-+ 0x4d2c0000, 0x5934000f, 0x80025d40, 0x04000046,
-+ 0x0201f800, 0x00020799, 0x04000041, 0x592c0000,
-+ 0x4802680f, 0x80000540, 0x04020002, 0x48026810,
-+ 0x592c2a04, 0x80081000, 0x480a6c0b, 0x49366009,
-+ 0x492e6008, 0x82142d00, 0x000000ff, 0x82140580,
-+ 0x00000012, 0x04000037, 0x4a026406, 0x00000003,
-+ 0x4a026403, 0x00000040, 0x592c0406, 0x800000c2,
- 0x800018c4, 0x800c0400, 0x48026206, 0x592c0808,
- 0x592c1809, 0x592c020a, 0x48066017, 0x480e6018,
-- 0x8c000502, 0x0400002a, 0x4a026203, 0x00000004,
-- 0x592c0207, 0x80000040, 0x0402001a, 0x59a80070,
-- 0x80000040, 0x040207ff, 0x592c0204, 0x82000500,
-- 0x000000ff, 0x82000580, 0x00000018, 0x04020011,
-- 0x592c180f, 0x59300007, 0x82000540, 0x00000091,
-- 0x480e6011, 0x48026007, 0x42000000, 0x80000004,
-- 0x48026004, 0x59bc00ea, 0x8c000516, 0x040207fe,
-- 0x83300400, 0x20000000, 0x480378e1, 0x1c01f000,
-- 0x0401fe4b, 0x59300007, 0x8400054e, 0x48026007,
-- 0x592c1a04, 0x820c1d00, 0x000000ff, 0x820c0580,
-- 0x00000048, 0x04000012, 0x0401f7ec, 0x8c000500,
-- 0x04020e9e, 0x4a026203, 0x00000002, 0x59a80071,
-- 0x80000040, 0x040207ff, 0x592c1a04, 0x820c1d00,
-- 0x000000ff, 0x820c0580, 0x00000018, 0x040007df,
-- 0x820c0580, 0x00000048, 0x040207dc, 0x42000800,
-- 0x80000804, 0x0201f000, 0x00106466, 0x800811c0,
-- 0x04020003, 0x4a026a03, 0x00000001, 0x59340010,
-- 0x492e6810, 0x80000d40, 0x04020003, 0x492e680f,
-- 0x1c01f000, 0x492c0800, 0x1c01f000, 0x83440c80,
-- 0x00000800, 0x04021009, 0x83440400, 0x0010aa00,
-- 0x50000000, 0x80000540, 0x04000004, 0x40026800,
-- 0x80000580, 0x1c01f000, 0x82000540, 0x00000001,
-- 0x1c01f000, 0x59340203, 0x80000540, 0x0402004b,
-- 0x4d300000, 0x4d2c0000, 0x5934000f, 0x80025d40,
-- 0x04000044, 0x0201f800, 0x00020892, 0x0400003f,
-- 0x592c0000, 0x4802680f, 0x80000540, 0x04020002,
-- 0x48026810, 0x592c2a04, 0x80081000, 0x480a6c0b,
-- 0x49366009, 0x492e6008, 0x82142d00, 0x000000ff,
-- 0x82140580, 0x00000012, 0x04000035, 0x4a026406,
-- 0x00000003, 0x4a026403, 0x00000040, 0x592c0406,
-- 0x800000c2, 0x800018c4, 0x800c0400, 0x48026206,
-- 0x592c0808, 0x592c1809, 0x592c020a, 0x48066017,
-- 0x480e6018, 0x8c000502, 0x02000000, 0x001045a1,
-- 0x4a026203, 0x00000004, 0x592c0207, 0x80000040,
-- 0x02020000, 0x00104594, 0x82140580, 0x00000018,
-- 0x02020000, 0x00104594, 0x592c180f, 0x59300007,
-- 0x82000540, 0x00000091, 0x480e6011, 0x48026007,
-- 0x42000000, 0x80000004, 0x48026004, 0x59bc00ea,
-- 0x8c000516, 0x040207fe, 0x83300400, 0x20000000,
-- 0x480378e1, 0x5934020b, 0x5934140b, 0x80080480,
-- 0x040017be, 0x0401f003, 0x4a026a03, 0x00000001,
-- 0x5c025800, 0x5c026000, 0x1c01f000, 0x497a5800,
-- 0x49325809, 0x4a026406, 0x00000006, 0x4a026203,
-- 0x00000007, 0x0401f802, 0x0401f7ef, 0x59a80021,
-- 0x800001c0, 0x02020000, 0x001045c3, 0x59a80005,
-- 0x8c000504, 0x02020000, 0x001045bf, 0x59340200,
-- 0x8c000518, 0x02020000, 0x001045bb, 0x592c0a0c,
-- 0x48066202, 0x4a025a06, 0x00000000, 0x8c000508,
-- 0x02020000, 0x001045b7, 0x4d3c0000, 0x417a7800,
-- 0x0201f800, 0x000207ce, 0x5c027800, 0x1c01f000,
-- 0x59980026, 0x497a5800, 0x80000540, 0x04020067,
-- 0x59d80105, 0x82000d00, 0x00018780, 0x04020197,
-- 0x800000f6, 0x8000013c, 0x0c01f001, 0x000202f3,
-- 0x0002034e, 0x00020308, 0x00020326, 0x592c0001,
-- 0x492fb107, 0x80000d40, 0x04020805, 0x59940019,
-- 0x80000540, 0x04002085, 0x1c01f000, 0x497a5801,
-+ 0x8c000502, 0x02000000, 0x00104467, 0x4a026203,
-+ 0x00000004, 0x592c0207, 0x80000040, 0x02020000,
-+ 0x0010445a, 0x82140580, 0x00000018, 0x02020000,
-+ 0x0010445a, 0x592c180f, 0x59300007, 0x82000540,
-+ 0x00000091, 0x480e6011, 0x48026007, 0x42000000,
-+ 0x80080004, 0x48026004, 0x59bc00ea, 0x8c000516,
-+ 0x040207fe, 0x83300400, 0x20000000, 0x480378e1,
-+ 0x5934000b, 0x80001120, 0x82000500, 0x0000ffff,
-+ 0x80080480, 0x040017bc, 0x0401f003, 0x4a026a03,
-+ 0x00000001, 0x5c025800, 0x5c026000, 0x1c01f000,
-+ 0x497a5800, 0x49325809, 0x4a026406, 0x00000006,
-+ 0x4a026203, 0x00000007, 0x0401f802, 0x0401f7ed,
-+ 0x8d0e1d0e, 0x02020000, 0x00104489, 0x8d0e1d04,
-+ 0x02020000, 0x00104485, 0x59340200, 0x8c000518,
-+ 0x02020000, 0x00104481, 0x592c0a0c, 0x48066202,
-+ 0x4a025a06, 0x00000000, 0x8c000508, 0x02020000,
-+ 0x0010447d, 0x4d3c0000, 0x417a7800, 0x0201f800,
-+ 0x000206d5, 0x5c027800, 0x1c01f000, 0x497a5801,
- 0x40065800, 0x592c0001, 0x496a5800, 0x815eb800,
- 0x412ed000, 0x80000d40, 0x040207f9, 0x59c80000,
- 0x82000540, 0x00001200, 0x48039000, 0x1c01f000,
-- 0x492fb107, 0x592c0001, 0x80000d40, 0x04020ff0,
-- 0x59da5908, 0x835c0480, 0x00000020, 0x0400100d,
-- 0x0402b00b, 0x492fb007, 0x0400e7fa, 0x59d80105,
-- 0x82000500, 0x00018780, 0x0402016c, 0x59940019,
-- 0x80000540, 0x04002065, 0x1c01f000, 0x0400f009,
-- 0x496a5800, 0x412ed000, 0x815eb800, 0x59c80000,
-- 0x82000540, 0x00001200, 0x48039000, 0x0401f7ef,
-- 0x492fa807, 0x0401f7ed, 0x59d81108, 0x45681000,
-- 0x400ad000, 0x815eb800, 0x0400e7fc, 0x59c80000,
-- 0x82000540, 0x00001200, 0x48039000, 0x0402d009,
-- 0x592c0001, 0x492fb107, 0x80000d40, 0x04020fc8,
-- 0x59940019, 0x80000540, 0x04002048, 0x1c01f000,
-- 0x59d80105, 0x82000500, 0x00018780, 0x04020147,
-- 0x42000000, 0x0010b654, 0x0201f800, 0x0010a86e,
-- 0x59980026, 0x59980828, 0x80000000, 0x48033026,
-- 0x492f3028, 0x800409c0, 0x04000003, 0x492c0800,
-- 0x0401f002, 0x492f3029, 0x592c0001, 0x80000d40,
-- 0x04020faf, 0x0401f7e7, 0x59980026, 0x59980828,
-- 0x80000000, 0x48033026, 0x492f3028, 0x800409c0,
-- 0x04000003, 0x492c0800, 0x0401f002, 0x492f3029,
-- 0x592c0001, 0x80000d40, 0x04020fa1, 0x0402d00d,
-- 0x59980029, 0x80025d40, 0x0400000e, 0x59980026,
-- 0x80000040, 0x48033026, 0x04020002, 0x48033028,
-- 0x592c0000, 0x48033029, 0x492fb107, 0x0400d7f5,
-- 0x42000000, 0x0010b654, 0x0201f800, 0x0010a86e,
-- 0x0402e00a, 0x59da5908, 0x496a5800, 0x412ed000,
-- 0x815eb800, 0x0400e7fc, 0x59c80000, 0x82000540,
-- 0x00001200, 0x48039000, 0x59d80105, 0x82000500,
-- 0x00018780, 0x04020109, 0x59940019, 0x80000540,
-- 0x04002002, 0x1c01f000, 0x59980023, 0x48032819,
-+ 0x59980014, 0x48032819, 0x59d8090b, 0x48073015,
- 0x1c01f000, 0x592c0404, 0x8c00051e, 0x02020000,
-- 0x00104b7b, 0x59980022, 0x80000540, 0x0402075d,
-- 0x59980026, 0x497a5800, 0x80000540, 0x02020000,
-- 0x00104ba6, 0x59d80105, 0x82000d00, 0x00018780,
-- 0x040200f2, 0x800000f6, 0x8000013c, 0x0c01f001,
-- 0x00020398, 0x00104ba6, 0x0002039d, 0x000203e6,
-- 0x592c0001, 0x492fb107, 0x80000d40, 0x04020760,
-- 0x1c01f000, 0x592c0001, 0x492fb107, 0x80000d40,
-- 0x04020f5b, 0x59da5908, 0x835c0480, 0x00000020,
-- 0x0400102b, 0x0402b033, 0x492fb007, 0x0400e7fa,
-- 0x59d80105, 0x82000500, 0x00018780, 0x040200d7,
-- 0x0400601f, 0x59d8010a, 0x59d8090a, 0x80040580,
-- 0x040207fd, 0x800408e0, 0x599c1017, 0x8c081508,
-- 0x04020028, 0x82040d40, 0x00000013, 0x5998002b,
-- 0x4807c011, 0x84000500, 0x4803302b, 0x59e00017,
-- 0x8c000508, 0x04020004, 0x4203e000, 0x30000001,
-- 0x1c01f000, 0x4a03c017, 0x00000003, 0x82040500,
-- 0x000000ff, 0x82000580, 0x0000001d, 0x040207f7,
-- 0x4a03c017, 0x0000000d, 0x0401f7f4, 0x5998082b,
-- 0x84040d40, 0x4807302b, 0x1c01f000, 0x496a5800,
-- 0x412ed000, 0x815eb800, 0x59c80000, 0x82000540,
-- 0x00001200, 0x48039000, 0x0400e7cb, 0x0401f7d1,
-- 0x0402f7f7, 0x492fa807, 0x0400e7c7, 0x0401f7cd,
-- 0x59e0000f, 0x59e0100f, 0x80081580, 0x040207fd,
-- 0x81281580, 0x040007d4, 0x40025000, 0x82040d40,
-- 0x0000001d, 0x0401f7d2, 0x59d80908, 0x45680800,
-- 0x4006d000, 0x815eb800, 0x0400e7fc, 0x59c80000,
-- 0x82000540, 0x00001200, 0x48039000, 0x02006000,
-- 0x00104b8d, 0x59d8010a, 0x59d8090a, 0x80040d80,
-- 0x040207fd, 0x900001c0, 0x82000540, 0x00000013,
-- 0x4803c011, 0x5998002b, 0x84000500, 0x4803302b,
-- 0x59e00017, 0x8c000508, 0x04000003, 0x4a03c017,
-- 0x00000003, 0x4203e000, 0x30000001, 0x59d80105,
-- 0x82000500, 0x00018780, 0x0402007c, 0x0202d000,
-- 0x00104b92, 0x592c0001, 0x492fb107, 0x80000d40,
-- 0x040206ef, 0x1c01f000, 0x59980020, 0x0c01f001,
-- 0x00020413, 0x00020414, 0x00020434, 0x1c01f000,
-- 0x4df00000, 0x4203e000, 0x50000000, 0x04026876,
-- 0x04006004, 0x599c0017, 0x8c000508, 0x040208f5,
-- 0x59980029, 0x80025d40, 0x0400000a, 0x0402d00b,
-- 0x59980026, 0x80000040, 0x48033026, 0x592c0000,
-- 0x492fb107, 0x48033029, 0x04020002, 0x48033028,
-- 0x5c03e000, 0x1c01f000, 0x59d80105, 0x82000500,
-- 0x00018780, 0x04020055, 0x42000000, 0x0010b654,
-- 0x0201f800, 0x0010a86e, 0x5c03e000, 0x1c01f000,
-- 0x4df00000, 0x4203e000, 0x50000000, 0x599cb817,
-- 0x59940019, 0x80000540, 0x04002023, 0x0400000e,
-- 0x59980022, 0x82000580, 0x00000005, 0x0400001e,
-- 0x59a80069, 0x81640580, 0x0402001b, 0x8c5cbd08,
-- 0x04000007, 0x59a8006a, 0x59a80866, 0x80040580,
-- 0x04020015, 0x8c5cbd08, 0x0402002b, 0x59d8090b,
-- 0x59d8010a, 0x80040580, 0x0400000d, 0x0400600e,
-- 0x4a03c011, 0x80400012, 0x4a03c020, 0x00008040,
-- 0x59e00017, 0x8c000508, 0x04000003, 0x4a03c017,
-- 0x00000002, 0x4203e000, 0x30000001, 0x4a032819,
-- 0xffff0000, 0x0400e879, 0x04006003, 0x8c5cbd08,
-- 0x0402088e, 0x59980029, 0x80025d40, 0x04020003,
-- 0x5c03e000, 0x1c01f000, 0x59d80105, 0x82000500,
-- 0x00018780, 0x04020019, 0x0202d000, 0x00104c06,
-- 0x59980826, 0x592c0000, 0x80040840, 0x48073026,
-- 0x492fb107, 0x48033029, 0x040207f2, 0x48033028,
-- 0x0401f7f0, 0x59e0000f, 0x59e0080f, 0x80040580,
-+ 0x00104a7b, 0x497a5800, 0x8d0e1d26, 0x0402000e,
-+ 0x0402d007, 0x592c0001, 0x492fb107, 0x80000d40,
-+ 0x04020fe3, 0x0400e065, 0x1c01f000, 0x0400e863,
-+ 0x0400d7f9, 0x42000000, 0x0010b024, 0x0201f800,
-+ 0x0010a260, 0x0401f8a8, 0x0400d8b3, 0x0400e05b,
-+ 0x59d80105, 0x82000d00, 0x00018780, 0x040200c2,
-+ 0x1c01f000, 0x59980012, 0x0c01f001, 0x0002030a,
-+ 0x0002030b, 0x00020316, 0x1c01f000, 0x4df00000,
-+ 0x4203e000, 0x50000000, 0x040268c2, 0x04006003,
-+ 0x8d0e1d20, 0x0402092b, 0x8d0e1d26, 0x0402089e,
-+ 0x5c03e000, 0x1c01f000, 0x4df00000, 0x4203e000,
-+ 0x50000000, 0x59940019, 0x80000540, 0x0400201b,
-+ 0x0400000e, 0x59980013, 0x82000580, 0x00000005,
-+ 0x04000016, 0x59a80066, 0x81640580, 0x04020013,
-+ 0x8d0e1d20, 0x04000007, 0x59a80067, 0x59a80863,
-+ 0x80040580, 0x0402000d, 0x8d0e1d20, 0x04020022,
-+ 0x59d8090b, 0x59d8010a, 0x80040580, 0x0400001b,
-+ 0x59980015, 0x80040580, 0x0400000c, 0x59980014,
-+ 0x48032819, 0x48073015, 0x0400e8cc, 0x04006003,
-+ 0x8d0e1d20, 0x040208e1, 0x8d0e1d26, 0x04020876,
-+ 0x5c03e000, 0x1c01f000, 0x040067f8, 0x4a03c011,
-+ 0x80400012, 0x4a03c020, 0x00008040, 0x59e00017,
-+ 0x8c000508, 0x04000003, 0x4a03c017, 0x00000002,
-+ 0x4203e000, 0x30000001, 0x4a032819, 0xffff0000,
-+ 0x0401f7ea, 0x59e0000f, 0x59e0080f, 0x80040580,
- 0x040207fd, 0x59e00010, 0x59e01010, 0x80081580,
-- 0x040207fd, 0x40065000, 0x80041580, 0x040007cc,
-- 0x040067e1, 0x0401f7cf, 0x4803c857, 0x485fc857,
-- 0x8c00050e, 0x02020800, 0x0010060d, 0x4203e000,
-- 0x50000000, 0x4200b800, 0x00008004, 0x0201f000,
-- 0x0010061a, 0x5998002b, 0x8c000500, 0x04020039,
-- 0x0400e006, 0x59d80105, 0x82000500, 0x00018780,
-- 0x040207ee, 0x1c01f000, 0x59da5908, 0x835c0c80,
-- 0x00000020, 0x04001003, 0x0400b028, 0x0400f02a,
-- 0x496a5800, 0x412ed000, 0x815eb800, 0x59c80000,
-- 0x82000540, 0x00001200, 0x48039000, 0x0400e7f3,
-+ 0x040207fd, 0x40065000, 0x80041580, 0x040007d5,
-+ 0x040067e2, 0x0401f7e6, 0x59d81108, 0x835c0480,
-+ 0x00000020, 0x0400100f, 0x0402b00d, 0x480bb007,
-+ 0x0400e7fa, 0x59d80105, 0x82000500, 0x00018780,
-+ 0x04020061, 0x8d0e1d22, 0x04000012, 0x59940019,
-+ 0x80000540, 0x0400277b, 0x1c01f000, 0x0400f00a,
-+ 0x49681000, 0x400ad000, 0x815eb800, 0x59c80000,
-+ 0x82000540, 0x00001200, 0x48039000, 0x0402e7ee,
-+ 0x0401f7e6, 0x480ba807, 0x0402e7eb, 0x0401f7e3,
-+ 0x04006021, 0x850e1d24, 0x59d8010a, 0x59d8090a,
-+ 0x80040580, 0x040207fd, 0x800408e0, 0x8d0e1d20,
-+ 0x0402001b, 0x82040d40, 0x00000013, 0x4807c011,
-+ 0x59e00017, 0x8c000508, 0x04020004, 0x4203e000,
-+ 0x30000001, 0x1c01f000, 0x82040500, 0x000000ff,
-+ 0x82000580, 0x0000001d, 0x04000006, 0x4a03c017,
-+ 0x00000003, 0x4203e000, 0x30000001, 0x1c01f000,
-+ 0x4a03c017, 0x0000000d, 0x4203e000, 0x30000001,
-+ 0x1c01f000, 0x850e1d64, 0x1c01f000, 0x59e0000f,
-+ 0x59e0100f, 0x80081580, 0x040207fd, 0x81281580,
-+ 0x040007e1, 0x40025000, 0x82040d40, 0x0000001d,
-+ 0x0401f7df, 0x59980817, 0x592c0001, 0x492f3017,
-+ 0x800409c0, 0x04000005, 0x492c0800, 0x80000d40,
-+ 0x0402072b, 0x1c01f000, 0x492f3018, 0x850e1d66,
-+ 0x0401f7fb, 0x0402d00c, 0x59980818, 0x58040000,
-+ 0x4807b107, 0x80000d40, 0x04020005, 0x48033017,
-+ 0x850e1d26, 0x48033018, 0x1c01f000, 0x0400d7f8,
-+ 0x0401f7fd, 0x59d80105, 0x82000500, 0x00018780,
-+ 0x04020005, 0x42000000, 0x0010b024, 0x0201f000,
-+ 0x0010a260, 0x4803c857, 0x485fc857, 0x8c00050e,
-+ 0x02020800, 0x001004e4, 0x4203e000, 0x50000000,
-+ 0x4200b800, 0x00008004, 0x0201f000, 0x001004f4,
-+ 0x0400e78a, 0x59d80105, 0x82000500, 0x00018780,
-+ 0x040207f1, 0x8d0e1d24, 0x04020002, 0x1c01f000,
- 0x59d8010a, 0x59d8090a, 0x80040580, 0x040207fd,
-- 0x800408e0, 0x599c1017, 0x8c081508, 0x04020021,
-+ 0x800408e0, 0x850e1d24, 0x8d0e1d20, 0x04020019,
- 0x82040d40, 0x00000013, 0x4807c011, 0x59e00017,
-- 0x8c000508, 0x0400000a, 0x4a03c017, 0x00000003,
-- 0x82040500, 0x000000ff, 0x82000580, 0x0000001d,
-- 0x04020003, 0x4a03c017, 0x0000000d, 0x4203e000,
-- 0x30000001, 0x59d80105, 0x82000500, 0x00018780,
-- 0x040207c2, 0x1c01f000, 0x492fb007, 0x0400e7d3,
-- 0x0401f7e0, 0x492fa807, 0x0400e7d0, 0x0401f7dd,
-- 0x84000500, 0x4803302b, 0x0400e7cc, 0x0401f7d9,
-+ 0x8c000508, 0x04020004, 0x4203e000, 0x30000001,
-+ 0x1c01f000, 0x82040500, 0x000000ff, 0x82000580,
-+ 0x0000001d, 0x04000006, 0x4a03c017, 0x00000003,
-+ 0x4203e000, 0x30000001, 0x1c01f000, 0x4a03c017,
-+ 0x0000000d, 0x4203e000, 0x30000001, 0x1c01f000,
- 0x59e0000f, 0x59e0100f, 0x80081580, 0x040207fd,
-- 0x81281580, 0x040007db, 0x40025000, 0x82040d40,
-- 0x0000001d, 0x0401f7d9, 0x59da5908, 0x496a5800,
-+ 0x81281580, 0x040007e3, 0x40025000, 0x82040d40,
-+ 0x0000001d, 0x0401f7e1, 0x59da5908, 0x496a5800,
- 0x412ed000, 0x815eb800, 0x0400e7fc, 0x59c80000,
- 0x82000540, 0x00001200, 0x48039000, 0x59d8090b,
-- 0x59980024, 0x48073024, 0x80040480, 0x04020004,
-- 0x59940019, 0x80000540, 0x04022003, 0x59980823,
-+ 0x59980015, 0x48073015, 0x80040480, 0x04020004,
-+ 0x59940019, 0x80000540, 0x04022003, 0x59980814,
- 0x48072819, 0x59d80105, 0x82000500, 0x00018780,
-- 0x04020796, 0x1c01f000, 0x59981025, 0x59e00010,
-+ 0x040207ad, 0x1c01f000, 0x59981016, 0x59e00010,
- 0x59e00810, 0x80041d80, 0x040207fd, 0x80080580,
-- 0x04000011, 0x48073025, 0x59e0000f, 0x59e0100f,
-+ 0x04000011, 0x48073016, 0x59e0000f, 0x59e0100f,
- 0x80081d80, 0x040207fd, 0x81280580, 0x04000006,
-- 0x400a5000, 0x40080000, 0x80040580, 0x0402067f,
-+ 0x400a5000, 0x40080000, 0x80040580, 0x040206b9,
- 0x1c01f000, 0x59940019, 0x80000540, 0x040227fa,
- 0x1c01f000, 0x59e0000f, 0x59e0100f, 0x80081d80,
- 0x040207fd, 0x81280580, 0x040007f6, 0x400a5000,
-@@ -11247,733 +10793,1413 @@ uint32_t risc_code02[] = {
- 0x900811c0, 0x82081540, 0x0000001c, 0x480bc011,
- 0x59e00017, 0x8c000508, 0x04000003, 0x4a03c017,
- 0x0000000c, 0x4203e000, 0x30000001, 0x1c01f000,
-- 0x41700000, 0x0c01f001, 0x001050f0, 0x0002052f,
-- 0x001050f0, 0x001050f1, 0x001050ee, 0x001050ee,
-- 0x001050ee, 0x001050ee, 0x00105594, 0x04010037,
-- 0x59980006, 0x80000540, 0x0402003c, 0x0402c01c,
-+ 0x41700000, 0x0c01f001, 0x00104f9e, 0x0002045b,
-+ 0x00104f9e, 0x00104f9f, 0x00104f9c, 0x00104f9c,
-+ 0x00104f9c, 0x00104f9c, 0x00105429, 0x04010037,
-+ 0x59980004, 0x80000540, 0x0402003c, 0x0402c01c,
- 0x4202f800, 0x00000010, 0x4df00000, 0x4203e000,
-- 0x50000000, 0x49db3005, 0x59da5808, 0x592c0204,
-- 0x497a5800, 0x497a5801, 0x82000500, 0x000000ff,
-+ 0x50000000, 0x49db3003, 0x59da5808, 0x592c2a04,
-+ 0x497a5800, 0x497a5801, 0x82140500, 0x000000ff,
- 0x82000c80, 0x00000079, 0x04021036, 0x0c01f839,
- 0x5c03e000, 0x817ef840, 0x04000009, 0x836c0580,
- 0x00000003, 0x04020006, 0x83700580, 0x00000001,
-- 0x04020010, 0x0401001b, 0x0400c7e8, 0x0400f94b,
-- 0x0400b135, 0x59d40005, 0x82000500, 0x43018780,
-- 0x02020000, 0x00105523, 0x59d80005, 0x82000500,
-- 0x43018780, 0x02020000, 0x0010552a, 0x1c01f000,
-- 0x83700580, 0x00000003, 0x02000800, 0x001050f1,
-+ 0x04020010, 0x0401001b, 0x0400c7e8, 0x0400f940,
-+ 0x0400b12a, 0x59d40005, 0x82000500, 0x43018780,
-+ 0x02020000, 0x001053bf, 0x59d80005, 0x82000500,
-+ 0x43018780, 0x02020000, 0x001053c6, 0x1c01f000,
-+ 0x83700580, 0x00000003, 0x02000800, 0x00104f9f,
- 0x83700580, 0x00000001, 0x040207ed, 0x04010005,
- 0x0400c7d2, 0x0401f7ea, 0x4202f800, 0x00000010,
-- 0x4df00000, 0x4203e000, 0x50000000, 0x49d73005,
-+ 0x4df00000, 0x4203e000, 0x50000000, 0x49d73003,
- 0x59d65808, 0x0401f7ce, 0x4df00000, 0x4203e000,
-- 0x50000000, 0x40025800, 0x592c0204, 0x497b3005,
-- 0x497b3006, 0x4202f800, 0x00000010, 0x0401f7c7,
-- 0x0201f800, 0x00105161, 0x5c03e000, 0x0401f7d4,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105207, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105171, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105231, 0x00105161,
-- 0x00105161, 0x00105161, 0x00020623, 0x00105161,
-- 0x00105398, 0x00105161, 0x00105161, 0x00105161,
-- 0x000205f5, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105199, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x001054b7,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105502, 0x00105161, 0x0010518b,
-- 0x00105161, 0x0010547b, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105449, 0x00105161, 0x00105449,
-- 0x00105556, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105409, 0x00105539,
-- 0x00105161, 0x00105549, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x00105161, 0x00105161, 0x00105161,
-- 0x00105161, 0x592c0204, 0x80000110, 0x80000040,
-- 0x0400000b, 0x02001000, 0x00105169, 0x48033002,
-- 0x492f3003, 0x492f3004, 0x4a033008, 0x00020603,
-- 0x4202e000, 0x00000003, 0x1c01f000, 0x592c0406,
-- 0x82000c80, 0x0000199a, 0x02021000, 0x00105179,
-- 0x59a80021, 0x80000540, 0x02020000, 0x001051a7,
-- 0x592e8a06, 0x83440c80, 0x000007f0, 0x02021000,
-- 0x00105179, 0x83440400, 0x0010aa00, 0x50000000,
-- 0x80026d40, 0x02000000, 0x001051bb, 0x59340002,
-- 0x592c0810, 0x80040580, 0x82000500, 0x00ffffff,
-- 0x02020000, 0x00105179, 0x0201f800, 0x000201ee,
-- 0x02020000, 0x001051be, 0x1c01f000, 0x592c0204,
-- 0x80000110, 0x02000000, 0x00105169, 0x80000040,
-- 0x0402000b, 0x592c040a, 0x8c000504, 0x04000010,
-+ 0x50000000, 0x40025800, 0x592c2a04, 0x497b3003,
-+ 0x497b3004, 0x4202f800, 0x00000010, 0x0401f7c7,
-+ 0x0201f800, 0x0010500f, 0x5c03e000, 0x0401f7d4,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x001050aa, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010501f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x001050d2, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0002054c, 0x0010500f,
-+ 0x00105237, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x00020521, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x00105042, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x00105353,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010539e, 0x0010500f, 0x00105039,
-+ 0x0010500f, 0x00105317, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x001052e5, 0x0010500f, 0x001052e5,
-+ 0x001053f0, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x001052a7, 0x001053d5,
-+ 0x0010500f, 0x001053e4, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x0010500f, 0x0010500f, 0x0010500f,
-+ 0x0010500f, 0x80140110, 0x80000040, 0x0400000b,
-+ 0x02001000, 0x00105017, 0x4a033006, 0x0002052e,
-+ 0x48033000, 0x492f3001, 0x492f3002, 0x4202e000,
-+ 0x00000003, 0x1c01f000, 0x592c0406, 0x82000c80,
-+ 0x0000199a, 0x02021000, 0x00105027, 0x8d0e1d0e,
-+ 0x02020000, 0x0010504b, 0x592e8a06, 0x83440c80,
-+ 0x000007f0, 0x02021000, 0x00105027, 0x83440400,
-+ 0x0010a400, 0x50000000, 0x80026d40, 0x02000000,
-+ 0x0010505f, 0x59340002, 0x592c0810, 0x80040580,
-+ 0x82000500, 0x00ffffff, 0x02020000, 0x00105027,
-+ 0x0401fc98, 0x02020000, 0x00105062, 0x1c01f000,
-+ 0x80140110, 0x02000000, 0x00105017, 0x80000040,
-+ 0x0402000b, 0x592c040a, 0x8c000504, 0x0400000b,
- 0x592c0207, 0x82000c80, 0x00001001, 0x02021000,
-- 0x00105179, 0x0201f000, 0x0010556e, 0x48033002,
-- 0x492f3003, 0x492f3004, 0x4a033008, 0x0002063b,
-- 0x4202e000, 0x00000003, 0x1c01f000, 0x592c0406,
-- 0x82000c80, 0x0000199a, 0x02021000, 0x00105179,
-- 0x592e8a06, 0x417a7800, 0x0401fc25, 0x02020000,
-- 0x0010533c, 0x59340002, 0x592c0808, 0x80040580,
-- 0x82000500, 0x00ffffff, 0x02020000, 0x00105179,
-- 0x497a5808, 0x592e6009, 0x83300580, 0xffffffff,
-- 0x02000000, 0x001052fc, 0x83300480, 0x0010cfc0,
-- 0x02001000, 0x00105359, 0x59a8000b, 0x81300480,
-- 0x02021000, 0x00105359, 0x592c240a, 0x49366009,
-- 0x8c10251c, 0x02020000, 0x001052ea, 0x59a80068,
-- 0x8c000510, 0x02020000, 0x00105372, 0x59a80821,
-- 0x800409c0, 0x02020000, 0x001052d0, 0x59a80805,
-- 0x8c040d04, 0x02020000, 0x00105363, 0x59340200,
-- 0x8c000518, 0x02020000, 0x00105354, 0x59300c06,
-- 0x82040580, 0x00000006, 0x02020000, 0x001052f4,
-- 0x59300414, 0x8c000516, 0x02020000, 0x0010535e,
-- 0x8c102508, 0x02020000, 0x0010a3d7, 0x59300808,
-- 0x4a025a06, 0x00000000, 0x800409c0, 0x02020000,
-- 0x001052cb, 0x592c0a0c, 0x48066202, 0x492e6008,
-- 0x0401f14a, 0x4df00000, 0x4203e000, 0x50000000,
-- 0x0402b00b, 0x835c0480, 0x00000020, 0x0400100d,
-- 0x815eb840, 0x416a5800, 0x592ed000, 0x492fb007,
-- 0x497a5800, 0x497a5801, 0x0400b7f7, 0x59d80005,
-- 0x82000500, 0x43018780, 0x02020000, 0x0010552a,
-- 0x5c03e000, 0x1c01f000, 0x4df00000, 0x4203e000,
-- 0x50000000, 0x0402f00b, 0x835c0480, 0x00000020,
-+ 0x00105027, 0x0201f000, 0x00105403, 0x4a033006,
-+ 0x0002055e, 0x0401f7cb, 0x592c0406, 0x82000c80,
-+ 0x0000199a, 0x02021000, 0x00105027, 0x592e8a06,
-+ 0x417a7800, 0x0401fcf5, 0x02020000, 0x001051db,
-+ 0x59340002, 0x592c0808, 0x80040580, 0x82000500,
-+ 0x00ffffff, 0x02020000, 0x00105027, 0x592e6009,
-+ 0x497a5808, 0x83300580, 0xffffffff, 0x02000000,
-+ 0x0010519b, 0x83300480, 0x0010d8d4, 0x02001000,
-+ 0x001051f8, 0x59a8000a, 0x81300480, 0x02021000,
-+ 0x001051f8, 0x592c240a, 0x49366009, 0x8c10251c,
-+ 0x02020000, 0x00105189, 0x59a80065, 0x8c000510,
-+ 0x02020000, 0x00105211, 0x8d0e1d0e, 0x02020000,
-+ 0x0010516f, 0x8d0e1d04, 0x02020000, 0x00105202,
-+ 0x59340200, 0x8c000518, 0x02020000, 0x001051f3,
-+ 0x59300c06, 0x82040580, 0x00000006, 0x02020000,
-+ 0x00105193, 0x59300414, 0x8c000516, 0x02020000,
-+ 0x001051fd, 0x8c102508, 0x02020000, 0x00109da4,
-+ 0x59300808, 0x4a025a06, 0x00000000, 0x800409c0,
-+ 0x02020000, 0x0010516a, 0x592c0a0c, 0x48066202,
-+ 0x492e6008, 0x0401f130, 0x4df00000, 0x4203e000,
-+ 0x50000000, 0x0402b00b, 0x835c0480, 0x00000020,
- 0x0400100d, 0x815eb840, 0x416a5800, 0x592ed000,
-- 0x492fa807, 0x497a5800, 0x497a5801, 0x0400f7f7,
-- 0x59d40005, 0x82000500, 0x43018780, 0x02020000,
-- 0x00105523, 0x5c03e000, 0x1c01f000, 0x4df00000,
-- 0x4203e000, 0x50000000, 0x59940024, 0x80000540,
-- 0x0400010f, 0x4c000000, 0x42000000, 0x00001000,
-- 0x50000000, 0x82000480, 0x24320001, 0x04020015,
-+ 0x492fb007, 0x497a5800, 0x497a5801, 0x0400b7f7,
-+ 0x59d80005, 0x82000500, 0x43018780, 0x02020000,
-+ 0x001053c6, 0x5c03e000, 0x1c01f000, 0x4df00000,
-+ 0x4203e000, 0x50000000, 0x0402f00b, 0x835c0480,
-+ 0x00000020, 0x0400100d, 0x815eb840, 0x416a5800,
-+ 0x592ed000, 0x492fa807, 0x497a5800, 0x497a5801,
-+ 0x0400f7f7, 0x59d40005, 0x82000500, 0x43018780,
-+ 0x02020000, 0x001053bf, 0x5c03e000, 0x1c01f000,
-+ 0x4df00000, 0x4203e000, 0x50000000, 0x59940024,
-+ 0x80000540, 0x040000f5, 0x4c000000, 0x59e00002,
-+ 0x8c00051e, 0x0402001b, 0x42000000, 0x00001000,
-+ 0x50000000, 0x82000480, 0x24320002, 0x04020015,
- 0x42000800, 0x00000064, 0x80040840, 0x04000007,
- 0x4a030000, 0x00000001, 0x40000000, 0x59800000,
- 0x8c000500, 0x040007f9, 0x04000008, 0x42000800,
-- 0x00007a01, 0x50040000, 0x8c000510, 0x04000003,
-- 0x84000510, 0x44000800, 0x4a030000, 0x00000000,
-- 0x59e00002, 0x8c00051e, 0x0402001b, 0x42000000,
-- 0x00001000, 0x50000000, 0x82000480, 0x24320002,
-- 0x04020015, 0x42000800, 0x00000064, 0x80040840,
-- 0x04000007, 0x4a030000, 0x00000001, 0x40000000,
-- 0x59800000, 0x8c000500, 0x040007f9, 0x04000008,
-- 0x42000800, 0x00007a17, 0x50040000, 0x8c00050e,
-- 0x04020003, 0x8400054e, 0x44000800, 0x4a030000,
-- 0x00000000, 0x5c000000, 0x5994781a, 0x48032825,
-- 0x803c0480, 0x04001004, 0x04000003, 0x4803281a,
-- 0x0401f022, 0x41787800, 0x803c7800, 0x82000400,
-- 0x000003e8, 0x040027fd, 0x4803281a, 0x59a80024,
-- 0x803c1400, 0x480b5024, 0x803c0040, 0x04000002,
-- 0x483fc857, 0x59e40852, 0x59a80025, 0x80040580,
-- 0x04000004, 0x480bc857, 0x59e40052, 0x48035025,
-- 0x59940026, 0x803c0400, 0x48032826, 0x0201f800,
-- 0x00105d5a, 0x59940000, 0x82000580, 0x00000000,
-- 0x04020006, 0x59940026, 0x48032827, 0x497b2826,
-- 0x4a032800, 0x00000001, 0x4c0c0000, 0x59940007,
-- 0x80000d40, 0x0400001d, 0x59941006, 0x59940025,
-- 0x80081c80, 0x04001004, 0x04000003, 0x480f2806,
-- 0x0401f016, 0x80040840, 0x48072807, 0x82040580,
-- 0x000003e8, 0x04020007, 0x4c040000, 0x4c0c0000,
-- 0x59940008, 0x0801f800, 0x5c001800, 0x5c000800,
-- 0x800409c0, 0x04020004, 0x59940008, 0x0801f800,
-- 0x0401f006, 0x400c0000, 0x820c1c00, 0x0000000a,
-- 0x040027ed, 0x480f2806, 0x5c001800, 0x4d180000,
-- 0x59c40008, 0x8c000534, 0x04020025, 0x417a3000,
-- 0x83947c00, 0x00000009, 0x583c0001, 0x80000d40,
-- 0x04020008, 0x823c7c00, 0x00000003, 0x811a3000,
-- 0x83180580, 0x00000005, 0x040207f8, 0x0401f018,
-- 0x583c1000, 0x59940025, 0x80080480, 0x04001005,
-- 0x04000004, 0x48007800, 0x80000040, 0x04021010,
-- 0x80040840, 0x48047801, 0x04000008, 0x82000400,
-- 0x0000000a, 0x48007800, 0x040027fa, 0x82040500,
-- 0x0000007f, 0x0401f7e8, 0x583c0002, 0x4c3c0000,
-- 0x0801f800, 0x5c007800, 0x0401f7e3, 0x5c023000,
-- 0x59940019, 0x80001540, 0x04000007, 0x04002006,
-- 0x59940025, 0x80080480, 0x04021002, 0x80000580,
-- 0x48032819, 0x5994001c, 0x80000d40, 0x04000013,
-- 0x5994101b, 0x59940025, 0x80080480, 0x04001005,
-- 0x04000004, 0x4803281b, 0x80000040, 0x0402100b,
-- 0x80040840, 0x4807281c, 0x04020004, 0x5994001d,
-- 0x0801f800, 0x0401f005, 0x82000400, 0x0000000a,
-- 0x4803281b, 0x040027f7, 0x59940004, 0x80000d40,
-- 0x04000013, 0x59941003, 0x59940025, 0x80080480,
-- 0x04001005, 0x04000004, 0x48032803, 0x80000040,
-- 0x0402100b, 0x80040840, 0x48072804, 0x04020004,
-- 0x59940005, 0x0801f800, 0x0401f005, 0x82000400,
-- 0x0000000a, 0x48032803, 0x040027f7, 0x5994001f,
-- 0x80000d40, 0x04000013, 0x5994101e, 0x59940025,
-- 0x80080480, 0x04001005, 0x04000004, 0x4803281e,
-- 0x80000040, 0x0402100b, 0x80040840, 0x4807281f,
-- 0x04020004, 0x59940020, 0x0801f800, 0x0401f005,
-- 0x82000400, 0x00000001, 0x4803281e, 0x040027f7,
-- 0x59940022, 0x80000d40, 0x04000013, 0x59941021,
-+ 0x00007a17, 0x50040000, 0x8c00050e, 0x04020003,
-+ 0x8400054e, 0x44000800, 0x4a030000, 0x00000000,
-+ 0x5c000000, 0x5994781a, 0x48032825, 0x803c0480,
-+ 0x04001004, 0x04000003, 0x4803281a, 0x0401f022,
-+ 0x41787800, 0x803c7800, 0x82000400, 0x000003e8,
-+ 0x040027fd, 0x4803281a, 0x59a80021, 0x803c1400,
-+ 0x480b5021, 0x803c0040, 0x04000002, 0x483fc857,
-+ 0x59e40852, 0x59a80022, 0x80040580, 0x04000004,
-+ 0x480bc857, 0x59e40052, 0x48035022, 0x59940026,
-+ 0x803c0400, 0x48032826, 0x0201f800, 0x00105c00,
-+ 0x59940000, 0x82000580, 0x00000000, 0x04020006,
-+ 0x59940026, 0x48032827, 0x497b2826, 0x4a032800,
-+ 0x00000001, 0x4c0c0000, 0x59940007, 0x80000d40,
-+ 0x0400001d, 0x59941006, 0x59940025, 0x80081c80,
-+ 0x04001004, 0x04000003, 0x480f2806, 0x0401f016,
-+ 0x80040840, 0x48072807, 0x82040580, 0x000003e8,
-+ 0x04020007, 0x4c040000, 0x4c0c0000, 0x59940008,
-+ 0x0801f800, 0x5c001800, 0x5c000800, 0x800409c0,
-+ 0x04020004, 0x59940008, 0x0801f800, 0x0401f006,
-+ 0x400c0000, 0x820c1c00, 0x0000000a, 0x040027ed,
-+ 0x480f2806, 0x5c001800, 0x4d180000, 0x59c40008,
-+ 0x8c000534, 0x04020025, 0x417a3000, 0x83947c00,
-+ 0x00000009, 0x583c0001, 0x80000d40, 0x04020008,
-+ 0x823c7c00, 0x00000003, 0x811a3000, 0x83180580,
-+ 0x00000005, 0x040207f8, 0x0401f018, 0x583c1000,
- 0x59940025, 0x80080480, 0x04001005, 0x04000004,
-- 0x48032821, 0x80000040, 0x0402100b, 0x80040840,
-- 0x48072822, 0x04020004, 0x59940023, 0x0801f800,
-- 0x0401f005, 0x82000400, 0x0000000a, 0x48032821,
-- 0x040027f7, 0x59940824, 0x59940025, 0x80040480,
-- 0x02001800, 0x00100615, 0x48032824, 0x59940000,
-- 0x0c01f001, 0x00105cee, 0x00105cf0, 0x00105d16,
-- 0x59940024, 0x80000000, 0x48032824, 0x4203e000,
-- 0x70000000, 0x1c01f000, 0x592c0406, 0x800000c2,
-- 0x800008c4, 0x80040c00, 0x592c040a, 0x48066206,
-- 0x82000d00, 0x00000003, 0x02000000, 0x00105e97,
-- 0x8c000500, 0x0402002c, 0x59a80872, 0x80040840,
-- 0x040207ff, 0x8c00051e, 0x02000000, 0x00105e72,
-- 0x82000d00, 0x000000c0, 0x02020000, 0x00105e68,
-- 0x82000d00, 0x00002020, 0x02020000, 0x00105e65,
-- 0x813e79c0, 0x02020000, 0x00105e65, 0x592c0c0c,
-- 0x800409c0, 0x02020000, 0x00105e65, 0x59300a03,
-- 0x82040d80, 0x00000007, 0x02020000, 0x00105e65,
-- 0x4a026203, 0x00000003, 0x4a026403, 0x00000043,
-- 0x0201f800, 0x000200ca, 0x82080d40, 0x80003465,
-- 0x48066004, 0x497a6000, 0x59bc00ea, 0x8c000516,
-- 0x040207fe, 0x83300400, 0xa0000000, 0x480378e1,
-- 0x1c01f000, 0x8c000502, 0x02020000, 0x00105eba,
-- 0x8c00051e, 0x0400000e, 0x82000d00, 0x000000c0,
-- 0x04000005, 0x82040d80, 0x000000c0, 0x02020000,
-- 0x00105ebf, 0x82000d00, 0x00002020, 0x82040d80,
-- 0x00002020, 0x02000000, 0x00105e86, 0x592c0207,
-- 0x80000040, 0x02020000, 0x00105e90, 0x592c180d,
-- 0x800c19c0, 0x02020000, 0x00105e90, 0x592c180f,
-- 0x59300007, 0x82000540, 0x00000011, 0x480e6011,
-- 0x48026007, 0x4a026203, 0x00000004, 0x4a026403,
-- 0x00000042, 0x42000800, 0x80002001, 0x0401f02a,
-- 0x5c000000, 0x4c000000, 0x4803c857, 0x4807c857,
-- 0x0401f003, 0x42000800, 0x00000001, 0x59325808,
-- 0x832c0500, 0x00ff0000, 0x0400000d, 0x592c0000,
-- 0x48065a06, 0x48026008, 0x592c040a, 0x8c000510,
-- 0x04020008, 0x0201f800, 0x00020381, 0x417a7800,
-- 0x59300008, 0x80025d40, 0x0402078c, 0x1c01f000,
-- 0x456a5800, 0x412ed000, 0x815eb800, 0x59c80000,
-- 0x82000540, 0x00001200, 0x48039000, 0x0401f7f4,
-- 0x59840000, 0x80000540, 0x04020002, 0x1c01f000,
-- 0x59840003, 0x80000540, 0x02020000, 0x00105f37,
-- 0x1c01f000, 0x59300004, 0x82000500, 0x00000100,
-- 0x80040d40, 0x48066004, 0x59bc00ea, 0x8c000516,
-- 0x040207fe, 0x83300400, 0x40000000, 0x480378e1,
-- 0x1c01f000, 0x59bc00ea, 0x82001500, 0xb0000018,
-- 0x02020000, 0x001069c6, 0x8c000510, 0x0400002a,
-- 0x59bc10e0, 0x82080500, 0xfffff000, 0x0402000a,
-- 0x80080108, 0x820a3500, 0x0000000f, 0x4803c857,
-- 0x1201f000, 0x001069cc, 0x84000510, 0x48026004,
-- 0x0401f016, 0x840a653e, 0x59300004, 0x8c000520,
-- 0x040007fa, 0x82000500, 0xfffefeff, 0x48026004,
-- 0x8c08153e, 0x04020005, 0x42027000, 0x00000013,
-- 0x0401f858, 0x0401f009, 0x59300004, 0x8c000514,
-- 0x04000003, 0x0401ffac, 0x0401f02e, 0x42027000,
-- 0x00000049, 0x0401f84f, 0x59bc00ea, 0x82001500,
-- 0xb0000018, 0x02020000, 0x001069c6, 0x8c000510,
-- 0x040207d8, 0x1c01f000, 0x83640480, 0x00000010,
-- 0x04001019, 0x41626000, 0x41580000, 0x59300a03,
-- 0x82040d80, 0x00000000, 0x04000008, 0x83326400,
-- 0x00000024, 0x81300c80, 0x040017f9, 0x42026000,
-- 0x0010cfc0, 0x0401f7f6, 0x4a026203, 0x00000008,
-+ 0x48007800, 0x80000040, 0x04021010, 0x80040840,
-+ 0x48047801, 0x04000008, 0x82000400, 0x0000000a,
-+ 0x48007800, 0x040027fa, 0x82040500, 0x0000007f,
-+ 0x0401f7e8, 0x583c0002, 0x4c3c0000, 0x0801f800,
-+ 0x5c007800, 0x0401f7e3, 0x5c023000, 0x59940019,
-+ 0x80001540, 0x04000007, 0x04002006, 0x59940025,
-+ 0x80080480, 0x04021002, 0x80000580, 0x48032819,
-+ 0x5994001c, 0x80000d40, 0x04000013, 0x5994101b,
-+ 0x59940025, 0x80080480, 0x04001005, 0x04000004,
-+ 0x4803281b, 0x80000040, 0x0402100b, 0x80040840,
-+ 0x4807281c, 0x04020004, 0x5994001d, 0x0801f800,
-+ 0x0401f005, 0x82000400, 0x0000000a, 0x4803281b,
-+ 0x040027f7, 0x59940004, 0x80000d40, 0x04000013,
-+ 0x59941003, 0x59940025, 0x80080480, 0x04001005,
-+ 0x04000004, 0x48032803, 0x80000040, 0x0402100b,
-+ 0x80040840, 0x48072804, 0x04020004, 0x59940005,
-+ 0x0801f800, 0x0401f005, 0x82000400, 0x0000000a,
-+ 0x48032803, 0x040027f7, 0x5994001f, 0x80000d40,
-+ 0x04000013, 0x5994101e, 0x59940025, 0x80080480,
-+ 0x04001005, 0x04000004, 0x4803281e, 0x80000040,
-+ 0x0402100b, 0x80040840, 0x4807281f, 0x04020004,
-+ 0x59940020, 0x0801f800, 0x0401f005, 0x82000400,
-+ 0x00000001, 0x4803281e, 0x040027f7, 0x59940022,
-+ 0x80000d40, 0x04000013, 0x59941021, 0x59940025,
-+ 0x80080480, 0x04001005, 0x04000004, 0x48032821,
-+ 0x80000040, 0x0402100b, 0x80040840, 0x48072822,
-+ 0x04020004, 0x59940023, 0x0801f800, 0x0401f005,
-+ 0x82000400, 0x0000000a, 0x48032821, 0x040027f7,
-+ 0x59940824, 0x59940025, 0x80040480, 0x02001800,
-+ 0x001004ef, 0x48032824, 0x59940000, 0x0c01f001,
-+ 0x00105b94, 0x00105b96, 0x00105bbc, 0x59940024,
-+ 0x80000000, 0x48032824, 0x4203e000, 0x70000000,
-+ 0x1c01f000, 0x592c0406, 0x800000c2, 0x800008c4,
-+ 0x80040c00, 0x592c040a, 0x48066206, 0x82000d00,
-+ 0x00000003, 0x02000000, 0x00105d45, 0x8c000500,
-+ 0x0402002c, 0x59a8086f, 0x80040840, 0x040207ff,
-+ 0x8c00051e, 0x02000000, 0x00105d20, 0x82000d00,
-+ 0x000000c0, 0x02020000, 0x00105d16, 0x82000d00,
-+ 0x00002020, 0x02020000, 0x00105d13, 0x813e79c0,
-+ 0x02020000, 0x00105d13, 0x592c0c0c, 0x800409c0,
-+ 0x02020000, 0x00105d13, 0x59300a03, 0x82040d80,
-+ 0x00000007, 0x02020000, 0x00105d13, 0x4a026203,
-+ 0x00000003, 0x4a026403, 0x00000043, 0x0201f800,
-+ 0x000200be, 0x82080d40, 0x80003465, 0x48066004,
-+ 0x497a6000, 0x59bc00ea, 0x8c000516, 0x040207fe,
-+ 0x83300400, 0xa0000000, 0x480378e1, 0x1c01f000,
-+ 0x8c000502, 0x02020000, 0x00105d68, 0x8c00051e,
-+ 0x0400000e, 0x82000d00, 0x000000c0, 0x04000005,
-+ 0x82040d80, 0x000000c0, 0x02020000, 0x00105d6d,
-+ 0x82000d00, 0x00002020, 0x82040d80, 0x00002020,
-+ 0x02000000, 0x00105d34, 0x592c0207, 0x80000040,
-+ 0x02020000, 0x00105d3e, 0x592c180d, 0x800c19c0,
-+ 0x02020000, 0x00105d3e, 0x592c180f, 0x59300007,
-+ 0x82000540, 0x00000011, 0x480e6011, 0x48026007,
-+ 0x4a026203, 0x00000004, 0x4a026403, 0x00000042,
-+ 0x42000800, 0x80002001, 0x0401f02a, 0x5c000000,
-+ 0x4c000000, 0x4803c857, 0x4807c857, 0x0401f003,
-+ 0x42000800, 0x00000001, 0x59325808, 0x832c0500,
-+ 0x00ff0000, 0x0400000d, 0x592c0000, 0x48065a06,
-+ 0x48026008, 0x592c040a, 0x8c000510, 0x04020008,
-+ 0x0201f800, 0x000202e9, 0x417a7800, 0x59300008,
-+ 0x80025d40, 0x0402078c, 0x1c01f000, 0x456a5800,
-+ 0x412ed000, 0x815eb800, 0x59c80000, 0x82000540,
-+ 0x00001200, 0x48039000, 0x0401f7f4, 0x59840000,
-+ 0x80000540, 0x04020002, 0x1c01f000, 0x59840003,
-+ 0x80000540, 0x02020000, 0x00105de5, 0x1c01f000,
-+ 0x59300004, 0x82000500, 0x00000100, 0x80040d40,
-+ 0x48066004, 0x59bc00ea, 0x8c000516, 0x040207fe,
-+ 0x83300400, 0x40000000, 0x480378e1, 0x1c01f000,
-+ 0x59bc00ea, 0x82001500, 0xb0000018, 0x02020000,
-+ 0x001064b0, 0x8c000510, 0x0400002a, 0x59bc10e0,
-+ 0x82080500, 0xfffff000, 0x0402000a, 0x80080108,
-+ 0x820a3500, 0x0000000f, 0x4803c857, 0x1201f000,
-+ 0x001064b6, 0x84000510, 0x48026004, 0x0401f016,
-+ 0x840a653e, 0x59300004, 0x8c000520, 0x040007fa,
-+ 0x82000500, 0xfffefeff, 0x48026004, 0x8c08153e,
-+ 0x04020005, 0x42027000, 0x00000013, 0x0401f858,
-+ 0x0401f009, 0x59300004, 0x8c000514, 0x04000003,
-+ 0x0401ffac, 0x0401f02e, 0x42027000, 0x00000049,
-+ 0x0401f84f, 0x59bc00ea, 0x82001500, 0xb0000018,
-+ 0x02020000, 0x001064b0, 0x8c000510, 0x040207d8,
-+ 0x1c01f000, 0x83640480, 0x00000010, 0x04001019,
-+ 0x41626000, 0x41580000, 0x59300a03, 0x82040d80,
-+ 0x00000000, 0x04020009, 0x4a026203, 0x00000008,
- 0x8166c840, 0x8332c400, 0x00000024, 0x81600480,
-- 0x04021002, 0x1c01f000, 0x837ac540, 0x0010cfc0,
-- 0x1c01f000, 0x42000000, 0x0010b653, 0x0201f800,
-- 0x0010a86e, 0x4967c857, 0x80026580, 0x1c01f000,
-- 0x83300480, 0x0010cfc0, 0x02001800, 0x00100615,
-- 0x41580000, 0x81300480, 0x0402100c, 0x04011000,
-- 0x457a6000, 0x4a026202, 0x0000ffff, 0x83300400,
-- 0x00000003, 0x4803c840, 0x4a03c842, 0x00000021,
-- 0x8166c800, 0x1c01f000, 0x41540000, 0x81300480,
-- 0x02021800, 0x00100615, 0x04011000, 0x457a6000,
-- 0x4a026202, 0x0000ffff, 0x83300400, 0x00000003,
-- 0x4803c840, 0x4a03c842, 0x00000021, 0x59a80066,
-- 0x49335065, 0x80000000, 0x48035066, 0x1c01f000,
-- 0x4d340000, 0x59326809, 0x59300406, 0x82000500,
-- 0x0000001f, 0x0c01f803, 0x5c026800, 0x1c01f000,
-- 0x001076ed, 0x00107700, 0x0010771a, 0x00020900,
-- 0x001096c1, 0x001096dc, 0x00020975, 0x001076ed,
-- 0x00107700, 0x00106226, 0x00107733, 0x001076ed,
-- 0x001076ed, 0x001076ed, 0x001076ed, 0x001076ed,
-- 0x0010936a, 0x0010a4d0, 0x001076ed, 0x001076ed,
-- 0x001076ed, 0x001076ed, 0x001076ed, 0x001076ed,
-- 0x001076ed, 0x001076ed, 0x001076ed, 0x001076ed,
-- 0x001076ed, 0x001076ed, 0x001076ed, 0x001076ed,
-- 0x59300203, 0x82000c80, 0x0000000e, 0x02021800,
-- 0x00100615, 0x0c01f001, 0x00107731, 0x00108337,
-- 0x00020914, 0x001084cc, 0x00108566, 0x00107731,
-- 0x00107731, 0x00107731, 0x0010831c, 0x00107731,
-- 0x00107731, 0x00107731, 0x00107731, 0x0010873a,
-- 0x83380480, 0x00000058, 0x04021007, 0x83380480,
-- 0x00000040, 0x04001004, 0x4d2c0000, 0x0c01f803,
-- 0x5c025800, 0x1c01f000, 0x001083c1, 0x001083c1,
-- 0x001083c1, 0x001083c1, 0x001083c1, 0x001083c3,
-- 0x00108463, 0x001083c1, 0x001083c1, 0x001083c1,
-- 0x001083c1, 0x001083c1, 0x001083c1, 0x001083c1,
-- 0x001083c1, 0x001083c1, 0x001083c1, 0x001083c1,
-- 0x001083c1, 0x00108467, 0x00020936, 0x001083c1,
-- 0x00108466, 0x00108468, 0x59325808, 0x59300811,
-- 0x59301402, 0x59340200, 0x8c00050e, 0x0402001c,
-- 0x0401f826, 0x04000005, 0x4a025a04, 0x00000103,
-- 0x497a5c09, 0x0401f009, 0x4a025a04, 0x00000103,
-- 0x4a025a06, 0x00000000, 0x497a5c09, 0x800409c0,
-- 0x02020800, 0x00108531, 0x48065807, 0x480a5c06,
-- 0x0201f800, 0x00020381, 0x5934000f, 0x5934140b,
-- 0x80081040, 0x04001002, 0x480a6c0b, 0x80000540,
-- 0x02020800, 0x00020275, 0x0401f75e, 0x592c020a,
-- 0x8c000502, 0x040007e9, 0x800409c0, 0x040007e7,
-- 0x592c0208, 0x8c00050e, 0x040207e4, 0x4933c857,
-- 0x0201f000, 0x00108fc6, 0x592c020a, 0x8c000500,
-- 0x04000010, 0x59300015, 0x592c380f, 0x801c3c80,
-- 0x0400000c, 0x4a025a06, 0x00000015, 0x8c1c3d3e,
-- 0x04000005, 0x4a025a06, 0x00000007, 0x801c3880,
-- 0x801c3800, 0x481fc857, 0x821c0d40, 0x00000000,
-- 0x1c01f000, 0x59300203, 0x82003480, 0x0000000e,
-- 0x02021800, 0x00100615, 0x0c01f001, 0x001096fb,
-- 0x00020989, 0x00109d9c, 0x00109daa, 0x000209a5,
-- 0x001096fb, 0x00109e98, 0x000209c4, 0x001096fb,
-- 0x001096fb, 0x001096fb, 0x001096fb, 0x001096fb,
-- 0x001096fb, 0x83380580, 0x00000013, 0x02020000,
-- 0x00109d23, 0x59300403, 0x82027480, 0x00000044,
-- 0x02021800, 0x00100615, 0x82000480, 0x00000040,
-- 0x02001800, 0x00100615, 0x0c01f001, 0x00109d80,
-- 0x0002099b, 0x00109d82, 0x00109d94, 0x59325808,
-- 0x832c0500, 0x00ff0000, 0x04000005, 0x592c0c0a,
-- 0x8c040d1a, 0x02020000, 0x00109d8f, 0x0401fe8e,
-- 0x0401f710, 0x83380580, 0x00000048, 0x04000007,
-- 0x83380580, 0x00000053, 0x02000000, 0x00109e3a,
-- 0x0201f800, 0x00100615, 0x5930001f, 0x59301011,
-- 0x59300809, 0x58040a00, 0x8c040d0e, 0x02020000,
-- 0x00109e16, 0x800811c0, 0x02020000, 0x00109e23,
-- 0x5930001f, 0x80000540, 0x02020000, 0x00109e31,
-- 0x59325808, 0x592c040a, 0x8c00051e, 0x02000000,
-- 0x00109e0c, 0x42027000, 0x00000041, 0x0401f001,
-- 0x83380480, 0x00000054, 0x02021800, 0x00100615,
-- 0x83380480, 0x00000040, 0x02001000, 0x00109e57,
-- 0x0c01f001, 0x00109e63, 0x000209e1, 0x00109e6f,
-- 0x00109e76, 0x00109e63, 0x00109e63, 0x00109e63,
-- 0x00109e63, 0x00109e65, 0x00109e6a, 0x00109e6a,
-- 0x00109e63, 0x00109e63, 0x00109e63, 0x00109e63,
-- 0x00109e6a, 0x00109e63, 0x00109e6a, 0x00109e63,
-- 0x00109e65, 0x4a026203, 0x00000001, 0x493a6403,
-- 0x42000800, 0x80002042, 0x0401f66f, 0x00000000,
-+ 0x04021009, 0x1c01f000, 0x83326400, 0x00000024,
-+ 0x81300c80, 0x040017f1, 0x42026000, 0x0010d8d4,
-+ 0x0401f7ee, 0x837ac540, 0x0010d8d4, 0x1c01f000,
-+ 0x42000000, 0x0010b023, 0x0201f800, 0x0010a260,
-+ 0x4967c857, 0x80026580, 0x1c01f000, 0x83300480,
-+ 0x0010d8d4, 0x02001800, 0x001004ef, 0x41580000,
-+ 0x81300480, 0x0402100c, 0x457a6000, 0x4a026202,
-+ 0x0000ffff, 0x04011000, 0x83300400, 0x00000003,
-+ 0x4803c840, 0x4a03c842, 0x00000021, 0x8166c800,
-+ 0x1c01f000, 0x41540000, 0x81300480, 0x02021800,
-+ 0x001004ef, 0x457a6000, 0x4a026202, 0x0000ffff,
-+ 0x04011000, 0x83300400, 0x00000003, 0x4803c840,
-+ 0x4a03c842, 0x00000021, 0x59a80063, 0x49335062,
-+ 0x80000000, 0x48035063, 0x1c01f000, 0x4d340000,
-+ 0x59326809, 0x59300406, 0x82000500, 0x0000001f,
-+ 0x0c01f803, 0x5c026800, 0x1c01f000, 0x001071fe,
-+ 0x00107211, 0x0010722b, 0x00020807, 0x00109149,
-+ 0x00109164, 0x0002087c, 0x001071fe, 0x00107211,
-+ 0x001060ed, 0x00107244, 0x001071fe, 0x001071fe,
-+ 0x001071fe, 0x001071fe, 0x001071fe, 0x00108df4,
-+ 0x00109ea1, 0x001071fe, 0x001071fe, 0x001071fe,
-+ 0x001071fe, 0x001071fe, 0x001071fe, 0x001071fe,
-+ 0x001071fe, 0x001071fe, 0x001071fe, 0x001071fe,
-+ 0x001071fe, 0x001071fe, 0x001071fe, 0x59300203,
-+ 0x82000c80, 0x0000000e, 0x02021800, 0x001004ef,
-+ 0x0c01f001, 0x00107242, 0x00107d79, 0x0002081b,
-+ 0x00107f11, 0x00107fab, 0x00107242, 0x00107242,
-+ 0x00107242, 0x00107d5e, 0x00107242, 0x00107242,
-+ 0x00107242, 0x00107242, 0x00108181, 0x83380480,
-+ 0x00000058, 0x04021007, 0x83380480, 0x00000040,
-+ 0x04001004, 0x4d2c0000, 0x0c01f803, 0x5c025800,
-+ 0x1c01f000, 0x00107e03, 0x00107e03, 0x00107e03,
-+ 0x00107e03, 0x00107e03, 0x00107e05, 0x00107ea7,
-+ 0x00107e03, 0x00107e03, 0x00107e03, 0x00107e03,
-+ 0x00107e03, 0x00107e03, 0x00107e03, 0x00107e03,
-+ 0x00107e03, 0x00107e03, 0x00107e03, 0x00107e03,
-+ 0x00107eab, 0x0002083d, 0x00107e03, 0x00107eaa,
-+ 0x00107eac, 0x59325808, 0x59300811, 0x59301402,
-+ 0x59340200, 0x8c00050e, 0x0402001c, 0x0401f826,
-+ 0x04000005, 0x4a025a04, 0x00000103, 0x497a5809,
-+ 0x0401f009, 0x4a025a04, 0x00000103, 0x4a025a06,
-+ 0x00000000, 0x497a5809, 0x800409c0, 0x02020800,
-+ 0x00107f76, 0x48065807, 0x480a5c06, 0x0201f800,
-+ 0x000202e9, 0x5934000f, 0x5934140b, 0x80081040,
-+ 0x04001002, 0x480a6c0b, 0x80000540, 0x02020800,
-+ 0x00020268, 0x0401f75e, 0x592c020a, 0x8c000502,
-+ 0x040007e9, 0x800409c0, 0x040007e7, 0x592c0208,
-+ 0x8c00050e, 0x040207e4, 0x4933c857, 0x0201f000,
-+ 0x00108a2e, 0x592c020a, 0x8c000500, 0x04000010,
-+ 0x59300015, 0x592c380f, 0x801c3c80, 0x0400000c,
-+ 0x4a025a06, 0x00000015, 0x8c1c3d3e, 0x04000005,
-+ 0x4a025a06, 0x00000007, 0x801c3880, 0x801c3800,
-+ 0x481fc857, 0x821c0d40, 0x00000000, 0x1c01f000,
-+ 0x59300203, 0x82003480, 0x0000000e, 0x02021800,
-+ 0x001004ef, 0x0c01f001, 0x00109183, 0x00020890,
-+ 0x0010983c, 0x0010984a, 0x000208ac, 0x00109183,
-+ 0x00109937, 0x000208cb, 0x00109183, 0x00109183,
-+ 0x00109183, 0x00109183, 0x00109183, 0x00109183,
-+ 0x83380580, 0x00000013, 0x02020000, 0x001097c4,
-+ 0x59300403, 0x82027480, 0x00000044, 0x02021800,
-+ 0x001004ef, 0x82000480, 0x00000040, 0x02001800,
-+ 0x001004ef, 0x0c01f001, 0x00109820, 0x000208a2,
-+ 0x00109822, 0x00109834, 0x59325808, 0x832c0500,
-+ 0x00ff0000, 0x04000005, 0x592c0c0a, 0x8c040d1a,
-+ 0x02020000, 0x0010982f, 0x0401fe8e, 0x0401f710,
-+ 0x83380580, 0x00000048, 0x04000007, 0x83380580,
-+ 0x00000053, 0x02000000, 0x001098d9, 0x0201f800,
-+ 0x001004ef, 0x5930001f, 0x59301011, 0x59300809,
-+ 0x58040a00, 0x8c040d0e, 0x02020000, 0x001098b5,
-+ 0x800811c0, 0x02020000, 0x001098c2, 0x5930001f,
-+ 0x80000540, 0x02020000, 0x001098d0, 0x59325808,
-+ 0x592c040a, 0x8c00051e, 0x02000000, 0x001098ab,
-+ 0x42027000, 0x00000041, 0x0401f001, 0x83380480,
-+ 0x00000054, 0x02021800, 0x001004ef, 0x83380480,
-+ 0x00000040, 0x02001000, 0x001098f6, 0x0c01f001,
-+ 0x00109902, 0x000208e8, 0x0010990e, 0x00109915,
-+ 0x00109902, 0x00109902, 0x00109902, 0x00109902,
-+ 0x00109904, 0x00109909, 0x00109909, 0x00109902,
-+ 0x00109902, 0x00109902, 0x00109902, 0x00109909,
-+ 0x00109902, 0x00109909, 0x00109902, 0x00109904,
-+ 0x4a026203, 0x00000001, 0x493a6403, 0x42000800,
-+ 0x80002042, 0x0401f66f, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-- 0x00000000, 0x00000000, 0xa36ec441, 0x00000000,
-- 0x00000000, 0x00000000, 0x00000005, 0xfffffffb,
-- 0x02800004, 0x00000000, 0x0000c000, 0x0000071b,
-- 0x073fca5a, 0x0705a5a5, 0x01928009, 0x070ff0e1,
-- 0x03800006, 0x04958010, 0x05308000, 0x05008000,
-- 0x0600902f, 0x04a004dc, 0x0202f051, 0x042e4020,
-- 0x018f021b, 0x033e5000, 0x03020000, 0x078d0018,
-- 0x0493041a, 0x0092041c, 0x038a0305, 0x078b0303,
-- 0x048e8010, 0x0678aae5, 0x06000001, 0x07818174,
-- 0x040010e6, 0x0448e0e6, 0x04818010, 0x002fb008,
-- 0x0448e0e6, 0x04818010, 0x060ff0e6, 0x00580401,
-- 0x054880ff, 0x04818010, 0x022a5001, 0x030430d4,
-- 0x06780043, 0x030e0000, 0x030450ff, 0x06780043,
-- 0x03019000, 0x048185c4, 0x027c0045, 0x03020000,
-- 0x06810037, 0x027c0045, 0x03040000, 0x068100c7,
-- 0x027c0045, 0x03080000, 0x0681061c, 0x04908037,
-- 0x029105c2, 0x010410a6, 0x0379ff41, 0x037fffff,
-- 0x072d6000, 0x07601241, 0x050f80ff, 0x032fa009,
-- 0x05600400, 0x050f80ff, 0x056c04ff, 0x068105da,
-- 0x073fa009, 0x06000001, 0x0279ff02, 0x0700ffff,
-- 0x070ff0d1, 0x0179feff, 0x0700ffff, 0x045c0402,
-- 0x048185da, 0x060ff0d0, 0x0179feff, 0x0700ffff,
-- 0x057dfeff, 0x0700ffff, 0x068105bc, 0x05600e41,
-- 0x050f80ff, 0x032fa069, 0x07480000, 0x068105ce,
-- 0x06780043, 0x070000f0, 0x0781005f, 0x037c00ff,
-- 0x06000010, 0x0781005f, 0x038005ca, 0x0379ff00,
-- 0x070fffff, 0x06780043, 0x07f00000, 0x075a0000,
-- 0x020ef001, 0x038605cc, 0x05484000, 0x02a1819e,
-- 0x062d6001, 0x002fb001, 0x070ff069, 0x01868072,
-- 0x060ff079, 0x055c0441, 0x06810010, 0x012fb000,
-- 0x060560fb, 0x03800078, 0x060ff079, 0x02868198,
-- 0x070ff069, 0x055c0441, 0x06810010, 0x060560fb,
-- 0x0400d0d0, 0x062d6002, 0x0648300d, 0x06810086,
-- 0x070ff0d1, 0x062d6001, 0x045c040b, 0x06810089,
-- 0x05488000, 0x04818086, 0x072e500c, 0x00208001,
-- 0x05a004e1, 0x02800010, 0x062d6001, 0x07f00000,
-- 0x07f00000, 0x070ff0d1, 0x0179feff, 0x070000ff,
-- 0x055c040c, 0x058180bb, 0x0007b001, 0x03079041,
-- 0x0307a000, 0x06600a79, 0x050f80ff, 0x053fa80a,
-- 0x06000010, 0x072d5003, 0x078d0096, 0x0307c003,
-- 0x0007d004, 0x0107e005, 0x0307f006, 0x02080007,
-- 0x00081008, 0x01082009, 0x0308300a, 0x0008400b,
-- 0x0308500c, 0x068d00a1, 0x0678007a, 0x07f00000,
-- 0x010880ff, 0x03386000, 0x03010000, 0x072e6300,
-- 0x020ef07f, 0x02860010, 0x070ff07d, 0x0450047c,
-- 0x050f80ff, 0x002fa819, 0x068d00ae, 0x02080001,
-- 0x00081002, 0x0448807a, 0x068100b5, 0x0379ff03,
-- 0x070000ff, 0x01082003, 0x068d00b6, 0x02386004,
-- 0x03010000, 0x072e6c00, 0x02800010, 0x06780043,
-- 0x070000f0, 0x068105d5, 0x050020ff, 0x027c0002,
-- 0x06000010, 0x078100c3, 0x028005d5, 0x0700c0d1,
-- 0x0379ff0c, 0x070000ff, 0x0380008e, 0x0204a051,
-- 0x06780043, 0x070000f0, 0x037c00ff, 0x06000010,
-- 0x0781816a, 0x072d6000, 0x019485be, 0x050fb056,
-- 0x044880e6, 0x04818010, 0x060ff0d0, 0x0179feff,
-- 0x0700ffff, 0x057dfeff, 0x0700ffff, 0x068105bc,
-- 0x05a00212, 0x0349c0e4, 0x0781811d, 0x070ff093,
-- 0x050010ff, 0x070ff093, 0x045c0401, 0x058180db,
-- 0x02046092, 0x04002046, 0x04600202, 0x00540401,
-- 0x048280e6, 0x04500425, 0x070060ff, 0x0730ffff,
-- 0x0700000f, 0x0742000f, 0x05810190, 0x06a005a4,
-- 0x0648a002, 0x048180e9, 0x00047089, 0x070ff047,
-- 0x045c0443, 0x077800ff, 0x07f00000, 0x0781818e,
-- 0x07780047, 0x0500e000, 0x048185ab, 0x070ff006,
-- 0x01860117, 0x0179fe47, 0x0700000f, 0x010480ff,
-- 0x056c7048, 0x06818102, 0x007a0d4a, 0x04003801,
-- 0x0220f001, 0x0180010f, 0x07608e48, 0x034a60ff,
-- 0x0700f0ff, 0x074b88ff, 0x037000ff, 0x07000600,
-- 0x05500448, 0x074d00ff, 0x045a044a, 0x0304a0ff,
-- 0x070ff00f, 0x01540406, 0x05820117, 0x04950120,
-- 0x05a001bd, 0x02868123, 0x0134bfff, 0x070fffff,
-- 0x0104102e, 0x050fd041, 0x00800126, 0x0595011d,
-- 0x05a001bd, 0x0186011d, 0x0202f00e, 0x052e4030,
-- 0x040fd02f, 0x070fc0ff, 0x05a00218, 0x02800010,
-- 0x0400e02f, 0x042e4020, 0x0202f051, 0x0004100e,
-- 0x0004b00e, 0x050fd041, 0x024a6c46, 0x04500423,
-- 0x050070ff, 0x03620024, 0x050080ff, 0x04004046,
-- 0x0700500f, 0x03206000, 0x05601048, 0x0700a0ff,
-- 0x0700900a, 0x070ff005, 0x04500446, 0x00540425,
-- 0x04820157, 0x05601622, 0x050f80ff, 0x063fa032,
-- 0x06000002, 0x03203000, 0x01204000, 0x03205000,
-- 0x0120b000, 0x0320c000, 0x07601441, 0x050f80ff,
-- 0x043fa852, 0x06000001, 0x070ff056, 0x056c02ff,
-- 0x050fb0ff, 0x070560ff, 0x03079041, 0x05600e41,
-- 0x050f80ff, 0x073fa011, 0x0600003d, 0x06780043,
-- 0x07f00000, 0x065a007a, 0x010880ff, 0x04a001b6,
-- 0x058d0150, 0x0208a04a, 0x0108b04b, 0x02386001,
-- 0x03010000, 0x072e6300, 0x028000a8, 0x0500d00a,
-- 0x05500405, 0x014a68ff, 0x070090ff, 0x0154040a,
-- 0x0700c0ff, 0x0600a023, 0x0500b024, 0x02206001,
-- 0x05601622, 0x050f80ff, 0x063fa04a, 0x06000002,
-- 0x05601022, 0x050f80ff, 0x043fa819, 0x06000001,
-- 0x0600a00d, 0x0180013c, 0x06780043, 0x070000f0,
-- 0x050010ff, 0x027c0001, 0x07000030, 0x078105b2,
-- 0x027c0001, 0x06000020, 0x078105b2, 0x038005ca,
-- 0x054880ff, 0x06810010, 0x070ff056, 0x050fb0ff,
-- 0x044880e5, 0x0581017d, 0x044880e6, 0x04818010,
-- 0x00800183, 0x056c02ff, 0x050fb0ff, 0x070560ff,
-- 0x072e5300, 0x044880e6, 0x04818010, 0x072d5003,
-- 0x06780043, 0x07f00000, 0x010880ff, 0x058d0187,
-- 0x03386005, 0x03010000, 0x033e6000, 0x0700000c,
-- 0x052e5200, 0x02800010, 0x0120918e, 0x018004e4,
-- 0x01209190, 0x018004e4, 0x00209192, 0x018004e4,
-- 0x03209000, 0x018004e4, 0x01209196, 0x018004e4,
-- 0x00209198, 0x018004e4, 0x02493075, 0x0681050b,
-- 0x0120919a, 0x018004e4, 0x06601e01, 0x050f80ff,
-- 0x063fa029, 0x06000008, 0x02015010, 0x02016051,
-- 0x00017051, 0x00011051, 0x05601a41, 0x050f80ff,
-- 0x053fa83a, 0x06000008, 0x05600e41, 0x050f80ff,
-- 0x01464000, 0x032fa00a, 0x07006011, 0x05007012,
-- 0x04008013, 0x07009014, 0x0600a015, 0x0400b016,
-- 0x0700c017, 0x07c00000, 0x072d5003, 0x06601479,
-- 0x050f80ff, 0x048d01b9, 0x063fa051, 0x0600003e,
-- 0x07c00000, 0x06005051, 0x0400e02c, 0x0660060e,
-- 0x050f80ff, 0x032fa009, 0x0379ff00, 0x070000ff,
-- 0x076c0000, 0x058101dd, 0x0660480e, 0x0500e0ff,
-- 0x034000ff, 0x01540427, 0x0582020a, 0x03400005,
-- 0x070ff005, 0x055c0428, 0x0481020e, 0x01680e05,
-- 0x056c0405, 0x068181bf, 0x040f8029, 0x053fa809,
-- 0x07000024, 0x06600649, 0x050f80ff, 0x032fa009,
-- 0x0379ff00, 0x070000ff, 0x076c0000, 0x068181bf,
-- 0x0400e049, 0x0340002d, 0x050f802b, 0x053fa80a,
-- 0x06000016, 0x0660480e, 0x0302c0ff, 0x034000ff,
-- 0x01540427, 0x0582020c, 0x072d6000, 0x0460040e,
-- 0x050f80ff, 0x0104e0d1, 0x0379ff4e, 0x0700ffff,
-- 0x062d6002, 0x032fa009, 0x0004d0d0, 0x074b004d,
-- 0x07780000, 0x07ffff00, 0x055a044d, 0x070000ff,
-+ 0x00000000, 0xa7f07d50, 0x00000000, 0x00000000,
-+ 0x0010ca00, 0x00000aa3, 0x42000000, 0x0010d4d0,
-+ 0x42001000, 0x0010d4c1, 0x44001000, 0x42013800,
-+ 0x0010d8d0, 0x42000000, 0x0010d4c0, 0x449c0000,
-+ 0x409d4000, 0x409d6800, 0x1c01f000, 0x4200d000,
-+ 0x0000000d, 0x42000000, 0x00000002, 0x4400d000,
-+ 0x0401f7fb, 0x4200d000, 0x0000000d, 0x42000000,
-+ 0x00000001, 0x4400d000, 0x0401f7fb, 0x1c01f000,
-+ 0x4937c857, 0x5134d200, 0x8468d502, 0x446a6a00,
-+ 0x1c01f000, 0x809d3840, 0x48813800, 0x4937c857,
-+ 0x42010000, 0x00000001, 0x0201f800, 0x001071d0,
-+ 0x40c66000, 0x80c589c0, 0x04000012, 0x49358809,
-+ 0x48818c06, 0x417a7800, 0x0201f800, 0x00104259,
-+ 0x59a8d01a, 0x8068d000, 0x486b501a, 0x599cd019,
-+ 0x417a7000, 0x8c68d50e, 0x04020003, 0x42027000,
-+ 0x00000004, 0x0201f800, 0x001071f9, 0x41790000,
-+ 0x40818800, 0x589d0000, 0x809d3800, 0x1c01f000,
-+ 0x829d3c80, 0x00000004, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x41350800, 0x41451000,
-+ 0x412d1800, 0x4943c857, 0x493fc857, 0x0201f800,
-+ 0x0010646d, 0x40c50000, 0x0201f800, 0x0010cf72,
-+ 0x0201f800, 0x0010cf62, 0x0201f800, 0x0010d011,
-+ 0x0201f800, 0x0010d15d, 0x808101c0, 0x0402003a,
-+ 0x417a8800, 0x0201f800, 0x0010433e, 0x40c66800,
-+ 0x80c589c0, 0x04000016, 0x8d3e7d06, 0x04000004,
-+ 0x50c4d200, 0x8c68d50e, 0x04020016, 0x8d3e7d18,
-+ 0x04000029, 0x5935000f, 0x0401f006, 0x49410206,
-+ 0x40825800, 0x50810000, 0x0201f800, 0x00104a76,
-+ 0x808101c0, 0x040207fa, 0x497a680f, 0x497a6810,
-+ 0x4937c857, 0x46026c00, 0x00000707, 0x81468800,
-+ 0x83457480, 0x000007ef, 0x040007e3, 0x040017e2,
-+ 0x8d3e7d02, 0x0400001b, 0x497b501c, 0x42028800,
-+ 0x000007f0, 0x0201f800, 0x0010433e, 0x40c66800,
-+ 0x48c7c857, 0x80c589c0, 0x04000005, 0x46018c00,
-+ 0x00000707, 0x0201f800, 0x00103f7c, 0x81468800,
-+ 0x83457480, 0x000007ff, 0x040007f3, 0x040017f2,
-+ 0x0401f008, 0x4937c857, 0x0201f800, 0x00103f7c,
-+ 0x0401f7e3, 0x0201f800, 0x0010645f, 0x0401f7c5,
-+ 0x40866800, 0x408a8800, 0x408e5800, 0x589d1803,
-+ 0x589d1002, 0x589d0801, 0x589d0000, 0x829d3c00,
-+ 0x00000004, 0x1c01f000, 0x829d3c80, 0x00000006,
-+ 0x48813800, 0x48853801, 0x48893802, 0x488d3803,
-+ 0x48913804, 0x48953805, 0x41352800, 0x41412000,
-+ 0x41451800, 0x412d1000, 0x4933c857, 0x493fc857,
-+ 0x0201f800, 0x0010646d, 0x40c50800, 0x59326809,
-+ 0x813669c0, 0x0400001f, 0x5934d403, 0x406a8800,
-+ 0x42028000, 0x00000029, 0x0201f800, 0x0010ce09,
-+ 0x0201f800, 0x0010cef7, 0x0201f800, 0x0010cf9c,
-+ 0x0201f800, 0x0010d28a, 0x4937c857, 0x8d3e7d18,
-+ 0x04000015, 0x5935000f, 0x808101c0, 0x0400000a,
-+ 0x49410206, 0x40825800, 0x50810000, 0x0201f800,
-+ 0x00104a76, 0x808101c0, 0x040207fa, 0x4882680f,
-+ 0x48826810, 0x4937c857, 0x46026c00, 0x00000707,
-+ 0x808509c0, 0x04000007, 0x0201f800, 0x0010645f,
-+ 0x0401f004, 0x0201f800, 0x00103f7c, 0x0401f7f9,
-+ 0x408a5800, 0x408e8800, 0x40928000, 0x40966800,
-+ 0x589d2805, 0x589d2004, 0x589d1803, 0x589d1002,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x00000006,
-+ 0x1c01f000, 0x809d3840, 0x48813800, 0x4937c857,
-+ 0x42010000, 0x00000001, 0x0201f800, 0x001071d0,
-+ 0x40c66000, 0x80c589c0, 0x04000018, 0x49358809,
-+ 0x5934d403, 0x82697480, 0x000007fe, 0x04000003,
-+ 0x417a7800, 0x0401ffa9, 0x48826406, 0x417a7800,
-+ 0x0201f800, 0x00104259, 0x4200d000, 0x00000003,
-+ 0x0201f800, 0x00104267, 0x59a8d01a, 0x8068d000,
-+ 0x486b501a, 0x42027000, 0x00000002, 0x0201f800,
-+ 0x001071f9, 0x41790000, 0x40818800, 0x589d0000,
-+ 0x809d3800, 0x1c01f000, 0x829d3c80, 0x00000002,
-+ 0x48813800, 0x48853801, 0x4a03c856, 0x12345678,
-+ 0x42010000, 0x00000001, 0x4883501b, 0x42028800,
-+ 0x000007fe, 0x4200d000, 0x00fffffe, 0x0201f800,
-+ 0x001042a1, 0x40c66800, 0x80c589c0, 0x0400000c,
-+ 0x0401ff00, 0x0401ffc8, 0x40c50800, 0x80c589c0,
-+ 0x04020007, 0x59a8d023, 0x8468d54e, 0x486b5023,
-+ 0x0201f800, 0x00108b45, 0x40850000, 0x40818800,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x00000002,
-+ 0x1c01f000, 0x829d3c80, 0x00000002, 0x48813800,
-+ 0x48853801, 0x40690000, 0x406d0800, 0x0201f800,
-+ 0x0010643e, 0x59bc002f, 0x81317480, 0x04000018,
-+ 0x59bcd02e, 0x41300000, 0x80697480, 0x0400001e,
-+ 0x5130d800, 0x806cd9c0, 0x04020009, 0x59317001,
-+ 0x48b90801, 0x5930d001, 0x8068d1c0, 0x04020002,
-+ 0x4886680c, 0x486e6001, 0x0401f036, 0x5930d801,
-+ 0x806cd9c0, 0x0402001f, 0x51317000, 0x44b90000,
-+ 0x446e6000, 0x486e680c, 0x0401f02e, 0x5930d801,
-+ 0x806cd9c0, 0x0402000f, 0x5130d000, 0x8068d1c0,
-+ 0x04020020, 0x486f782f, 0x486f782e, 0x486e680c,
-+ 0x0401f024, 0x5930d001, 0x8068d1c0, 0x04020013,
-+ 0x4883782e, 0x44690000, 0x486a680c, 0x0401f01d,
-+ 0x5130d000, 0x8068d1c0, 0x04020016, 0x486f782f,
-+ 0x59317001, 0x48bb782e, 0x486a6001, 0x0401f015,
-+ 0x51317000, 0x44b8d800, 0x446d0000, 0x457a6000,
-+ 0x497a6001, 0x0401f00f, 0x59317001, 0x48bb782e,
-+ 0x59317001, 0x44b90000, 0x497a6001, 0x0401f009,
-+ 0x51317000, 0x48bb782f, 0x446e6000, 0x0401f7d6,
-+ 0x51317000, 0x44b8d800, 0x486f782f, 0x0401f7f0,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x00000002,
-+ 0x1c01f000, 0x829d3c80, 0x00000005, 0x48813800,
-+ 0x48853801, 0x48893802, 0x488d3803, 0x48913804,
-+ 0x4933c857, 0x0201f800, 0x0010646d, 0x40c52000,
-+ 0x41351800, 0x41191000, 0x41910800, 0x59326809,
-+ 0x59bcd82f, 0x406ce000, 0x806cd9c0, 0x0400000c,
-+ 0x41300000, 0x806d7480, 0x04000027, 0x586cd009,
-+ 0x41340000, 0x80697480, 0x0400001c, 0x406ce000,
-+ 0x506cd800, 0x806cd9c0, 0x040207f6, 0x83bcd400,
-+ 0x00000032, 0x406b2000, 0x417a3000, 0x5990d004,
-+ 0x41300000, 0x80697480, 0x0400000b, 0x811a3000,
-+ 0x83197480, 0x00000005, 0x0400001e, 0x83932400,
-+ 0x00000010, 0x5990d004, 0x41300000, 0x80697480,
-+ 0x040207f7, 0x0201f800, 0x001065fd, 0x0201f800,
-+ 0x00106431, 0x0401f00b, 0x406d0000, 0x586cd801,
-+ 0x806cd9c0, 0x040007d9, 0x41300000, 0x806d7480,
-+ 0x040207fa, 0x4070d000, 0x4080d800, 0x0401ff6e,
-+ 0x40872000, 0x408a3000, 0x408e6800, 0x80917040,
-+ 0x0400000b, 0x4200d000, 0x00000001, 0x0401f00e,
-+ 0x40872000, 0x408a3000, 0x408e6800, 0x80917040,
-+ 0x04000006, 0x4178d000, 0x0401f007, 0x0201f800,
-+ 0x0010645f, 0x0401f7f4, 0x0201f800, 0x0010645f,
-+ 0x0401f7f9, 0x40698800, 0x589d2004, 0x589d1803,
-+ 0x589d1002, 0x589d0801, 0x589d0000, 0x829d3c00,
-+ 0x00000005, 0x1c01f000, 0x829d3c80, 0x00000002,
-+ 0x48813800, 0x48853801, 0x40690000, 0x51310800,
-+ 0x457a6000, 0x0201f800, 0x0010643e, 0x808101c0,
-+ 0x04000008, 0x44850000, 0x598cd00a, 0x41300000,
-+ 0x80697480, 0x0402000b, 0x4883180a, 0x0401f009,
-+ 0x598cd00a, 0x41300000, 0x80697480, 0x04000003,
-+ 0x4887180b, 0x0401f003, 0x4883180a, 0x4883180b,
-+ 0x0201f800, 0x00106454, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000002, 0x1c01f000, 0x4933c857,
-+ 0x813261c0, 0x0400000d, 0x598cd80b, 0x4178d000,
-+ 0x0401f006, 0x41300000, 0x806d7480, 0x0400000d,
-+ 0x406cd000, 0x506cd800, 0x806cd9c0, 0x040207fa,
-+ 0x4178d000, 0x0401f013, 0x4178d000, 0x4068d800,
-+ 0x4068e000, 0x0201f800, 0x001004ec, 0x0401f00d,
-+ 0x0401ffca, 0x598cd00d, 0x41300000, 0x80697480,
-+ 0x04000005, 0x497a6007, 0x4200d000, 0x00000001,
-+ 0x0401f004, 0x0201f800, 0x00106904, 0x0401f7fa,
-+ 0x40698800, 0x1c01f000, 0x829d3c80, 0x00000002,
-+ 0x48813800, 0x48853801, 0x40690000, 0x51310800,
-+ 0x457a6000, 0x0201f800, 0x0010643e, 0x808101c0,
-+ 0x04000008, 0x44850000, 0x598cd008, 0x41300000,
-+ 0x80697480, 0x0402000b, 0x48831808, 0x0401f009,
-+ 0x598cd008, 0x41300000, 0x80697480, 0x04000003,
-+ 0x48871809, 0x0401f003, 0x48831808, 0x48831809,
-+ 0x0201f800, 0x00106454, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000002, 0x1c01f000, 0x4933c857,
-+ 0x813261c0, 0x0400001b, 0x598cd809, 0x4178d000,
-+ 0x0401f006, 0x41300000, 0x806d7480, 0x04000007,
-+ 0x406cd000, 0x506cd800, 0x806cd9c0, 0x040207fa,
-+ 0x4178d000, 0x0401f018, 0x0401ffd0, 0x598cd00d,
-+ 0x41300000, 0x80697480, 0x04000010, 0x5930d403,
-+ 0x82697480, 0x00000042, 0x04000004, 0x4200d000,
-+ 0x00000001, 0x0401f00c, 0x497a6007, 0x0401f7fc,
-+ 0x4178d000, 0x4068d800, 0x4068e000, 0x0201f800,
-+ 0x001004ec, 0x0401f004, 0x0201f800, 0x00106904,
-+ 0x0401f7ef, 0x40698800, 0x1c01f000, 0x829d3c80,
-+ 0x00000002, 0x48813800, 0x48853801, 0x40690000,
-+ 0x51310800, 0x457a6000, 0x0201f800, 0x0010643e,
-+ 0x808101c0, 0x04000008, 0x44850000, 0x598cd004,
-+ 0x41300000, 0x80697480, 0x0402000b, 0x48831804,
-+ 0x0401f009, 0x598cd004, 0x41300000, 0x80697480,
-+ 0x04000003, 0x48871805, 0x0401f003, 0x48831804,
-+ 0x48831805, 0x0201f800, 0x00106454, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000002, 0x1c01f000,
-+ 0x829d3c80, 0x00000002, 0x48813800, 0x48853801,
-+ 0x4933c857, 0x813261c0, 0x04000023, 0x598d0005,
-+ 0x40810800, 0x0401f006, 0x41300000, 0x80817480,
-+ 0x04000007, 0x40810800, 0x50810000, 0x808101c0,
-+ 0x040207fa, 0x4178d000, 0x0401f028, 0x598cd00d,
-+ 0x80697480, 0x04000022, 0x0201f800, 0x0010643e,
-+ 0x598cd005, 0x40800000, 0x80697480, 0x04000014,
-+ 0x598cd004, 0x80697480, 0x04000007, 0x45790000,
-+ 0x0201f800, 0x00106454, 0x4200d000, 0x00000001,
-+ 0x0401f016, 0x48871804, 0x45790000, 0x45790800,
-+ 0x0401f7f8, 0x4178d000, 0x4068d800, 0x4068e000,
-+ 0x0201f800, 0x001004ec, 0x0401f00c, 0x50817000,
-+ 0x48bb1805, 0x45790000, 0x598cd004, 0x80697480,
-+ 0x040207ec, 0x497b1804, 0x0401f7ea, 0x0201f800,
-+ 0x00106904, 0x0401f7dd, 0x40698800, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000002, 0x1c01f000,
-+ 0x829d3c80, 0x00000002, 0x48813800, 0x48853801,
-+ 0x0201f800, 0x0010646d, 0x40c50800, 0x0401ff70,
-+ 0x80c589c0, 0x04000006, 0x42010000, 0x00000001,
-+ 0x80857040, 0x0402000c, 0x0401f009, 0x0401ff24,
-+ 0x80c589c0, 0x040207f9, 0x0401ffae, 0x40c50000,
-+ 0x80c589c0, 0x040007f7, 0x0401f7f4, 0x0201f800,
-+ 0x0010645f, 0x40818800, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000002, 0x1c01f000, 0x829d3c80,
-+ 0x00000002, 0x48813800, 0x48853801, 0x5c00d000,
-+ 0x4c680000, 0x486bc857, 0x41350000, 0x412d0800,
-+ 0x59326809, 0x59325808, 0x5930d406, 0x82697480,
-+ 0x00000011, 0x83f17500, 0x0d000000, 0x04000030,
-+ 0x82b97480, 0x0c000000, 0x0400002d, 0x4933c857,
-+ 0x4943c857, 0x493fc857, 0x5930d406, 0x486bc857,
-+ 0x5930d406, 0x82697480, 0x00000011, 0x83f17500,
-+ 0x03000000, 0x04000018, 0x42000000, 0x0010cd11,
-+ 0x8068d400, 0x5068d000, 0x0869f000, 0x0010cd23,
-+ 0x0010cd6d, 0x0010cd2b, 0x0010cd78, 0x0010cd6d,
-+ 0x0010cd5f, 0x0010cd53, 0x0010cd23, 0x0010cd23,
-+ 0x0010cd4a, 0x0010cd3f, 0x0010cd23, 0x0010cd23,
-+ 0x0010cd23, 0x0010cd23, 0x0010cd23, 0x0010cd33,
-+ 0x0010cd33, 0x4178d000, 0x4068d800, 0x4068e000,
-+ 0x0201f800, 0x001004ec, 0x40826800, 0x40865800,
-+ 0x0401f078, 0x812e59c0, 0x04000062, 0x4178d000,
-+ 0x4068d800, 0x4068e000, 0x0201f800, 0x001004ec,
-+ 0x0401f070, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x04020068, 0x59325817, 0x0201f800, 0x00100737,
-+ 0x0201f800, 0x00107198, 0x40826800, 0x40865800,
-+ 0x0401f064, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x040007f8, 0x49425a06, 0x497a5c09, 0x0201f800,
-+ 0x00104a76, 0x0201f800, 0x00107198, 0x0401f7f3,
-+ 0x0201f800, 0x00108834, 0x80c589c0, 0x040007ed,
-+ 0x0201f800, 0x0010625f, 0x0201f800, 0x00107198,
-+ 0x0401f7ea, 0x5930d007, 0x8c68d500, 0x04020046,
-+ 0x0201f800, 0x00108834, 0x80c589c0, 0x040007e1,
-+ 0x0201f800, 0x00109bc2, 0x0201f800, 0x00107198,
-+ 0x0401f7de, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x040007d8, 0x592cd204, 0x8268d500, 0x000000ff,
-+ 0x82697480, 0x00000055, 0x040207c5, 0x49425a06,
-+ 0x0201f800, 0x00104a76, 0x0401f7db, 0x0201f800,
-+ 0x0010d07d, 0x80c589c0, 0x04020025, 0x0201f800,
-+ 0x00108b60, 0x0201f800, 0x001078be, 0x0201f800,
-+ 0x00107198, 0x0401f7c5, 0x5930d007, 0x8c68d500,
-+ 0x0402001e, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x040007bc, 0x4a025a04, 0x00000103, 0x49425a06,
-+ 0x497a5809, 0x0201f800, 0x001089e1, 0x0201f800,
-+ 0x00109e7b, 0x0201f800, 0x00104a76, 0x0201f800,
-+ 0x0010893e, 0x0201f800, 0x00107198, 0x0401f7af,
-+ 0x5930d21d, 0x82697480, 0x00000003, 0x040007f8,
-+ 0x0201f800, 0x00107198, 0x0401f7a8, 0x0201f800,
-+ 0x00101c32, 0x0401f7da, 0x0201f800, 0x00100ddb,
-+ 0x0401f7e1, 0x0201f800, 0x00100ddb, 0x0401f7b9,
-+ 0x49425a06, 0x0201f800, 0x00104a76, 0x0401f796,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x00000002,
-+ 0x1c01f000, 0x809d3840, 0x48813800, 0x5930d406,
-+ 0x82697480, 0x00000011, 0x83f17500, 0x0d000000,
-+ 0x04000020, 0x82b97480, 0x0c000000, 0x0400001d,
-+ 0x82697480, 0x00000011, 0x83f17500, 0x03000000,
-+ 0x04000018, 0x42000000, 0x0010cdbc, 0x8068d400,
-+ 0x5068d000, 0x0869f000, 0x0010cdde, 0x0010cdf2,
-+ 0x0010cdde, 0x0010cdd4, 0x0010cde9, 0x0010cde9,
-+ 0x0010cde1, 0x0010cdde, 0x0010cdde, 0x0010cdde,
-+ 0x0010cdde, 0x0010cdde, 0x0010cdde, 0x0010cdde,
-+ 0x0010cdde, 0x0010cdde, 0x0010cdde, 0x0010cdfe,
-+ 0x4178d000, 0x4068d800, 0x4068e000, 0x0201f800,
-+ 0x001004ec, 0x0401f032, 0x5930d009, 0x833cdd00,
-+ 0x00001000, 0x8d3e7d18, 0x04020006, 0x8d3e7d06,
-+ 0x04000004, 0x5068d200, 0x8c68d50e, 0x04020028,
-+ 0x4200d800, 0x00000001, 0x0401f025, 0x833cd500,
-+ 0x00001000, 0x4200d800, 0x00000001, 0x8d3e7d18,
-+ 0x0402001f, 0x4068d800, 0x0401f01d, 0x8d3e7d18,
-+ 0x04000003, 0x8d3e7d16, 0x040007f2, 0x5930d420,
-+ 0x4178d800, 0x8c68d500, 0x04020015, 0x0401f7ed,
-+ 0x833d0500, 0x00001000, 0x8d3e7d18, 0x040207e9,
-+ 0x8d3e7d06, 0x040007e7, 0x0201f800, 0x00108b04,
-+ 0x4080d800, 0x80c589c0, 0x04020009, 0x0401f7e1,
-+ 0x833cd500, 0x00001000, 0x8d3e7d18, 0x040207dd,
-+ 0x4068d800, 0x8d3e7d16, 0x040007da, 0x406d8800,
-+ 0x589d0000, 0x809d3800, 0x1c01f000, 0x829d3c80,
-+ 0x00000006, 0x48813800, 0x48853801, 0x48893802,
-+ 0x488d3803, 0x48913804, 0x48953805, 0x4933c857,
-+ 0x0201f800, 0x0010646d, 0x40c52800, 0x41352000,
-+ 0x41311000, 0x412d1800, 0x41790800, 0x598e6005,
-+ 0x0401f00a, 0x59326809, 0x813669c0, 0x04000005,
-+ 0x5934d403, 0x41440000, 0x80697480, 0x0400000b,
-+ 0x41310800, 0x51326000, 0x813261c0, 0x040207f6,
-+ 0x408a6000, 0x408e5800, 0x40926800, 0x80957040,
-+ 0x04000025, 0x0401f026, 0x0401ff7b, 0x80c589c0,
-+ 0x040007f4, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x04000015, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x04000005, 0x0201f800, 0x00108ddd, 0x80c589c0,
-+ 0x0400000d, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x040007e4, 0x0201f800, 0x00108ddd, 0x80c589c0,
-+ 0x040007e0, 0x5930d403, 0x82697480, 0x00000043,
-+ 0x040007dc, 0x0201f800, 0x0010635b, 0x51310000,
-+ 0x4084d000, 0x0401fe22, 0x0401fea1, 0x40826000,
-+ 0x0401f7d6, 0x0201f800, 0x0010645f, 0x589d2805,
-+ 0x589d2004, 0x589d1803, 0x589d1002, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000006, 0x1c01f000,
-+ 0x829d3c80, 0x00000006, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x48913804, 0x48953805,
-+ 0x0201f800, 0x0010646d, 0x40c52800, 0x412d1000,
-+ 0x41311800, 0x41352000, 0x0201f800, 0x0010433e,
-+ 0x40c66800, 0x80c589c0, 0x0400002e, 0x41790800,
-+ 0x598e600b, 0x0401f003, 0x41310800, 0x51326000,
-+ 0x813261c0, 0x0400001c, 0x5930d009, 0x41340000,
-+ 0x80697480, 0x040207f9, 0x0401ff2f, 0x80c589c0,
-+ 0x04000003, 0x8d3e7d00, 0x0400000a, 0x0401ff2a,
-+ 0x80c589c0, 0x040007f1, 0x8d3e7d00, 0x040007ef,
-+ 0x0201f800, 0x00106391, 0x80c589c0, 0x040007eb,
-+ 0x0201f800, 0x0010635b, 0x51310000, 0x4084d000,
-+ 0x0401fd56, 0x0401fe62, 0x40826000, 0x813261c0,
-+ 0x040207e6, 0x0201f800, 0x001044b4, 0x408a5800,
-+ 0x408e6000, 0x40926800, 0x80957040, 0x04000002,
-+ 0x0401f009, 0x0201f800, 0x0010645f, 0x0401f006,
-+ 0x4178d000, 0x4068d800, 0x4068e000, 0x0201f800,
-+ 0x001004ec, 0x589d2805, 0x589d2004, 0x589d1803,
-+ 0x589d1002, 0x589d0801, 0x589d0000, 0x829d3c00,
-+ 0x00000006, 0x1c01f000, 0x829d3c80, 0x00000006,
-+ 0x48813800, 0x48853801, 0x48893802, 0x488d3803,
-+ 0x48913804, 0x48953805, 0x0201f800, 0x0010646d,
-+ 0x40c52800, 0x412d2000, 0x41351800, 0x41311000,
-+ 0x42010000, 0x00000001, 0x598e6009, 0x813261c0,
-+ 0x0400000c, 0x59326809, 0x5934d403, 0x41440000,
-+ 0x80697480, 0x04000010, 0x808101c0, 0x0400000b,
-+ 0x41310800, 0x51326000, 0x813261c0, 0x040207f6,
-+ 0x408a6000, 0x408e6800, 0x40925800, 0x80957040,
-+ 0x0400001c, 0x0401f023, 0x42010000, 0x00000001,
-+ 0x0401f7eb, 0x0401fed8, 0x80c589c0, 0x04000007,
-+ 0x8d3e7d00, 0x04000005, 0x5930d406, 0x82697480,
-+ 0x00000003, 0x04000012, 0x0401fecf, 0x80c589c0,
-+ 0x040007e6, 0x8d3e7d00, 0x040207e4, 0x51310000,
-+ 0x0201f800, 0x0010635b, 0x4084d000, 0x0401fd43,
-+ 0x0401fe0b, 0x40826000, 0x41790000, 0x0401f7db,
-+ 0x0201f800, 0x0010645f, 0x0401f006, 0x0201f800,
-+ 0x00106391, 0x80c589c0, 0x040207f1, 0x0401f7eb,
-+ 0x589d2805, 0x589d2004, 0x589d1803, 0x589d1002,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x00000006,
-+ 0x1c01f000, 0x829d3c80, 0x00000002, 0x48813800,
-+ 0x48853801, 0x4947c857, 0x0201f800, 0x0010646d,
-+ 0x40c50800, 0x413d0000, 0x853e7d00, 0x0401ffa7,
-+ 0x0401ff58, 0x40827800, 0x80857040, 0x04000002,
-+ 0x0401f003, 0x0201f800, 0x0010645f, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000002, 0x1c01f000,
-+ 0x829d3c80, 0x00000005, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x48913804, 0x412d2000,
-+ 0x41351800, 0x41311000, 0x41790800, 0x598e600b,
-+ 0x813261c0, 0x04000011, 0x0401fe8b, 0x80c589c0,
-+ 0x04020006, 0x41310800, 0x51326000, 0x813261c0,
-+ 0x040207fa, 0x0401f009, 0x0201f800, 0x0010635b,
-+ 0x51310000, 0x4084d000, 0x0401fcb8, 0x0401fdc4,
-+ 0x40826000, 0x0401f7ef, 0x0201f800, 0x0010448d,
-+ 0x408e6800, 0x408a6000, 0x40925800, 0x589d2004,
-+ 0x589d1803, 0x589d1002, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000005, 0x1c01f000, 0x829d3c80,
-+ 0x00000005, 0x48813800, 0x48853801, 0x48893802,
-+ 0x488d3803, 0x48913804, 0x412d2000, 0x41351800,
-+ 0x41311000, 0x41790800, 0x598e6009, 0x813261c0,
-+ 0x04000011, 0x0401fe60, 0x80c589c0, 0x04020006,
-+ 0x41310800, 0x51326000, 0x813261c0, 0x040207fa,
-+ 0x0401f009, 0x51310000, 0x0201f800, 0x0010635b,
-+ 0x4084d000, 0x0401fcd1, 0x0401fd99, 0x40826000,
-+ 0x0401f7ef, 0x408a6000, 0x408e6800, 0x40925800,
-+ 0x589d2004, 0x589d1803, 0x589d1002, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000005, 0x1c01f000,
-+ 0x809d3840, 0x48813800, 0x4943c857, 0x0201f800,
-+ 0x0010646d, 0x40c50000, 0x0401ffd1, 0x0401ffa5,
-+ 0x80817040, 0x04000002, 0x0401f003, 0x0201f800,
-+ 0x0010645f, 0x589d0000, 0x809d3800, 0x1c01f000,
-+ 0x829d3c80, 0x00000004, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x0201f800, 0x0010646d,
-+ 0x40c51800, 0x41311000, 0x41790800, 0x598e6005,
-+ 0x813261c0, 0x04000008, 0x0401fe27, 0x80c589c0,
-+ 0x04020009, 0x41310800, 0x51326000, 0x813261c0,
-+ 0x040207fa, 0x408a6000, 0x808d7040, 0x0400000a,
-+ 0x0401f00b, 0x0201f800, 0x0010635b, 0x51310000,
-+ 0x4084d000, 0x0401fcde, 0x0401fd5d, 0x40826000,
-+ 0x0401f7ec, 0x0201f800, 0x0010645f, 0x589d1803,
-+ 0x589d1002, 0x589d0801, 0x589d0000, 0x829d3c00,
-+ 0x00000004, 0x1c01f000, 0x809d3840, 0x44a13800,
-+ 0x829d3c80, 0x00000005, 0x409d4000, 0x829d3c80,
-+ 0x00000007, 0x48813800, 0x48853801, 0x48893802,
-+ 0x488d3803, 0x48913804, 0x48953805, 0x48993806,
-+ 0x0201f800, 0x0010646d, 0x48c54000, 0x41311800,
-+ 0x41352800, 0x49194002, 0x412d2000, 0x49914001,
-+ 0x41d13000, 0x49a54003, 0x49154004, 0x59be602f,
-+ 0x813261c0, 0x0400001b, 0x41310800, 0x0401f005,
-+ 0x808101c0, 0x04000017, 0x41310800, 0x40826000,
-+ 0x51310000, 0x59326809, 0x5934d403, 0x41440000,
-+ 0x80697480, 0x040207f7, 0x59310001, 0x8d3e7d00,
-+ 0x04000005, 0x0201f800, 0x00106391, 0x80c589c0,
-+ 0x04000004, 0x0401fddc, 0x80c589c0, 0x04020021,
-+ 0x41311000, 0x40826000, 0x808101c0, 0x040207f3,
-+ 0x417a3000, 0x0201f800, 0x00106927, 0x59926004,
-+ 0x813261c0, 0x04000006, 0x59326809, 0x5934d403,
-+ 0x41440000, 0x80697480, 0x04000018, 0x811a3000,
-+ 0x83197480, 0x00000004, 0x040007f3, 0x040017f2,
-+ 0x408e6000, 0x40966800, 0x58a23002, 0x40925800,
-+ 0x58a32001, 0x409ba000, 0x58a34803, 0x58a22804,
-+ 0x58a0d000, 0x80697040, 0x04000017, 0x0401f018,
-+ 0x4084d000, 0x4088d800, 0x0201f800, 0x0010cb2f,
-+ 0x0401fcfb, 0x0401f7dc, 0x8d3e7d00, 0x04000005,
-+ 0x0201f800, 0x00106391, 0x80c589c0, 0x040007e4,
-+ 0x0401fdad, 0x80c589c0, 0x040007e1, 0x0201f800,
-+ 0x001065fd, 0x0201f800, 0x00106431, 0x0401fcec,
-+ 0x0401f7db, 0x0201f800, 0x0010645f, 0x589d3006,
-+ 0x589d2805, 0x589d2004, 0x589d1803, 0x589d1002,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x0000000c,
-+ 0x509d4000, 0x809d3800, 0x1c01f000, 0x809d3840,
-+ 0x44a13800, 0x829d3c80, 0x00000007, 0x409d4000,
-+ 0x829d3c80, 0x00000007, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x48913804, 0x48953805,
-+ 0x48993806, 0x0201f800, 0x0010646d, 0x40c52800,
-+ 0x41313000, 0x49354001, 0x492d4000, 0x49194004,
-+ 0x49914003, 0x49d14002, 0x49a54005, 0x49154006,
-+ 0x59be602f, 0x813261c0, 0x04000023, 0x41312000,
-+ 0x41790800, 0x51311000, 0x59326809, 0x0401f009,
-+ 0x41311800, 0x808509c0, 0x04000010, 0x808101c0,
-+ 0x04000002, 0x40826000, 0x808101c0, 0x0400000d,
-+ 0x59310001, 0x0401fd6c, 0x80c589c0, 0x040007f5,
-+ 0x4090d000, 0x408cd800, 0x0201f800, 0x0010cb2f,
-+ 0x0401fcab, 0x0401f7f2, 0x41310800, 0x0401f7f0,
-+ 0x808911c0, 0x04000006, 0x408a6000, 0x808509c0,
-+ 0x04000003, 0x40852000, 0x40810800, 0x808911c0,
-+ 0x040207e1, 0x417a3000, 0x0201f800, 0x00106927,
-+ 0x59926004, 0x813261c0, 0x04000005, 0x59326809,
-+ 0x0401fd51, 0x80c589c0, 0x04020011, 0x811a3000,
-+ 0x83197480, 0x00000004, 0x040007f4, 0x040017f3,
-+ 0x409a6000, 0x58a26801, 0x58a25800, 0x58a23004,
-+ 0x58a32003, 0x58a3a002, 0x58a34805, 0x58a22806,
-+ 0x80957040, 0x04000008, 0x0401f009, 0x0201f800,
-+ 0x001065fd, 0x0201f800, 0x00106431, 0x0401fc80,
-+ 0x0401f7eb, 0x0201f800, 0x0010645f, 0x589d3006,
-+ 0x589d2805, 0x589d2004, 0x589d1803, 0x589d1002,
-+ 0x589d0801, 0x589d0000, 0x829d3c00, 0x0000000e,
-+ 0x509d4000, 0x809d3800, 0x1c01f000, 0x4178e000,
-+ 0x5930d403, 0x486bc856, 0x5930dc03, 0x826cd480,
-+ 0x00000002, 0x82697480, 0x00000002, 0x04000008,
-+ 0x04001007, 0x599cd019, 0x82697480, 0x00000080,
-+ 0x04020005, 0x806cd9c0, 0x04020003, 0x4200e000,
-+ 0x00000001, 0x40718800, 0x1c01f000, 0x809d3840,
-+ 0x48813800, 0x5930dc06, 0x826d7480, 0x00000011,
-+ 0x83f17500, 0x0d000000, 0x04000027, 0x82b97480,
-+ 0x0c000000, 0x04000024, 0x59326809, 0x826d7480,
-+ 0x00000011, 0x83f17500, 0x03000000, 0x0400001d,
-+ 0x42000000, 0x0010d0a7, 0x806cd400, 0x5068d000,
-+ 0x0869f000, 0x0010d0be, 0x0010d10b, 0x0010d0dc,
-+ 0x0010d11d, 0x0010d10b, 0x0010d0d8, 0x0010d0e8,
-+ 0x0010d0be, 0x0010d0b9, 0x0010d0fe, 0x0010d0cc,
-+ 0x0010d0b9, 0x0010d0b9, 0x0010d0b9, 0x0010d0b9,
-+ 0x0010d0be, 0x0010d0cc, 0x0010d0c5, 0x406cd000,
-+ 0x4178d800, 0x406ce000, 0x0201f800, 0x001004ec,
-+ 0x0401f09c, 0x406cd000, 0x4178d800, 0x406ce000,
-+ 0x0201f800, 0x001004ec, 0x0401f096, 0x0201f800,
-+ 0x0010cda7, 0x80c589c0, 0x040007f6, 0x59325817,
-+ 0x0201f800, 0x00100737, 0x5930d203, 0x82697480,
-+ 0x00000004, 0x04000078, 0x59325808, 0x0201f800,
-+ 0x00108834, 0x80c589c0, 0x04020054, 0x0201f800,
-+ 0x00107198, 0x0401f083, 0x0201f800, 0x0010cda7,
-+ 0x80c589c0, 0x040007e3, 0x59325808, 0x0201f800,
-+ 0x00108834, 0x80c589c0, 0x040007f5, 0x49425a06,
-+ 0x497a5c09, 0x0201f800, 0x00104a76, 0x0201f800,
-+ 0x0010893e, 0x0401f7ee, 0x0201f800, 0x0010cda7,
-+ 0x80c589c0, 0x040007d3, 0x5930d203, 0x82697480,
-+ 0x00000004, 0x04000061, 0x59325808, 0x0201f800,
-+ 0x00108834, 0x80c589c0, 0x040007e1, 0x49425a06,
-+ 0x497a5c09, 0x813669c0, 0x0402002b, 0x0201f800,
-+ 0x00108deb, 0x0201f800, 0x00104a76, 0x0401f7d8,
-+ 0x0201f800, 0x00105ebc, 0x80c589c0, 0x040207bd,
-+ 0x5930d203, 0x82697480, 0x00000004, 0x04000045,
-+ 0x42027000, 0x00000047, 0x0201f800, 0x001071f9,
-+ 0x0401f050, 0x0201f800, 0x0010cda7, 0x80c589c0,
-+ 0x040007b0, 0x5930d403, 0x82697480, 0x00000043,
-+ 0x040007ac, 0x0401ff6a, 0x80c589c0, 0x04020038,
-+ 0x0201f800, 0x00108960, 0x80c589c0, 0x040007bc,
-+ 0x0201f800, 0x001078be, 0x0401f7b9, 0x813669c0,
-+ 0x0402000f, 0x4178d000, 0x4068d800, 0x4068e000,
-+ 0x0401f7a0, 0x0201f800, 0x00109e7b, 0x0201f800,
-+ 0x00108deb, 0x0401f7d4, 0x49425a06, 0x497a5c09,
-+ 0x0201f800, 0x00104a76, 0x0401f7a9, 0x0201f800,
-+ 0x0010cda7, 0x80c589c0, 0x0400078e, 0x5930d203,
-+ 0x82697480, 0x00000004, 0x04000023, 0x59310008,
-+ 0x0201f800, 0x00108834, 0x80c589c0, 0x0400079c,
-+ 0x4a010204, 0x00000103, 0x5930d402, 0x48690406,
-+ 0x5880d408, 0x8c68d512, 0x04020013, 0x49410206,
-+ 0x49790009, 0x0201f800, 0x00108deb, 0x40825800,
-+ 0x0401f79d, 0x0201f800, 0x00100ddb, 0x0401f787,
-+ 0x0201f800, 0x00100ddb, 0x0401f00e, 0x0201f800,
-+ 0x00101c32, 0x0401f7c7, 0x0201f800, 0x00100ddb,
-+ 0x0401f79e, 0x58825809, 0x0201f800, 0x00100737,
-+ 0x0401f7eb, 0x0201f800, 0x00100ddb, 0x0401f7dc,
-+ 0x589d0000, 0x809d3800, 0x1c01f000, 0x829d3c80,
-+ 0x00000005, 0x48813800, 0x48853801, 0x48893802,
-+ 0x488d3803, 0x48913804, 0x41310800, 0x412d1000,
-+ 0x41351800, 0x41392000, 0x4933c857, 0x4943c857,
-+ 0x493fc857, 0x42010000, 0x0010d8d4, 0x59a8d00d,
-+ 0x41640000, 0x80697480, 0x0400002b, 0x41580000,
-+ 0x80817480, 0x0402100d, 0x40826000, 0x8d3e7d12,
-+ 0x04000004, 0x40800000, 0x80857480, 0x04000002,
-+ 0x0401ff17, 0x82810400, 0x00000024, 0x41580000,
-+ 0x80817480, 0x040017f5, 0x41540000, 0x80817480,
-+ 0x0402101b, 0x8d3e7d18, 0x04000019, 0x59a8d063,
-+ 0x59a80067, 0x80697480, 0x04000015, 0x40826000,
-+ 0x5880d009, 0x8068d1c0, 0x04020005, 0x5880d203,
-+ 0x82697480, 0x00000008, 0x04000002, 0x0401ff00,
-+ 0x0201f800, 0x0010a16d, 0x0401fefd, 0x82810400,
-+ 0x00000024, 0x41540000, 0x80817480, 0x040017ea,
-+ 0x0401f003, 0x41510000, 0x0401f7e4, 0x40866000,
-+ 0x408a5800, 0x408e6800, 0x40927000, 0x589d2004,
-+ 0x589d1803, 0x589d1002, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000005, 0x1c01f000, 0x809d3840,
-+ 0x48813800, 0x5930dc06, 0x826d7480, 0x00000011,
-+ 0x83f17500, 0x0d000000, 0x04000026, 0x82b97480,
-+ 0x0c000000, 0x04000023, 0x826d7480, 0x00000011,
-+ 0x83f17500, 0x03000000, 0x0400001d, 0x42000000,
-+ 0x0010d1be, 0x806cd400, 0x5068d000, 0x0869f000,
-+ 0x0010d1d5, 0x0010d222, 0x0010d1e0, 0x0010d1f8,
-+ 0x0010d222, 0x0010d1dc, 0x0010d243, 0x0010d1d5,
-+ 0x0010d1d0, 0x0010d259, 0x0010d235, 0x0010d1d0,
-+ 0x0010d1d0, 0x0010d1d0, 0x0010d1d0, 0x0010d1d5,
-+ 0x0010d1ef, 0x0010d1e8, 0x406cd000, 0x4178d800,
-+ 0x406ce000, 0x0201f800, 0x001004ec, 0x0401f0aa,
-+ 0x406cd000, 0x4178d800, 0x406ce000, 0x0201f800,
-+ 0x001004ec, 0x0401f0a4, 0x0201f800, 0x0010cda7,
-+ 0x80c589c0, 0x040007f6, 0x59325808, 0x0201f800,
-+ 0x00108834, 0x80c589c0, 0x04020088, 0x0201f800,
-+ 0x00107198, 0x0401f098, 0x0201f800, 0x0010cda7,
-+ 0x80c589c0, 0x040007ea, 0x59325817, 0x0201f800,
-+ 0x00100737, 0x59325808, 0x0201f800, 0x00108834,
-+ 0x80c589c0, 0x040007f2, 0x49425a06, 0x0201f800,
-+ 0x00104a76, 0x0401f7ee, 0x0201f800, 0x0010cda7,
-+ 0x80c589c0, 0x040007da, 0x8d3e7d00, 0x04000009,
-+ 0x5930d017, 0x41480000, 0x80697480, 0x040207d4,
-+ 0x5930d018, 0x414c0000, 0x80697480, 0x040207d0,
-+ 0x5930d203, 0x82697480, 0x00000004, 0x04000073,
-+ 0x59310008, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x040007d7, 0x4a010204, 0x00000103, 0x5880d408,
-+ 0x8c68d512, 0x04020065, 0x49410206, 0x49790009,
-+ 0x40825800, 0x0201f800, 0x00109e7b, 0x0201f800,
-+ 0x00108deb, 0x0201f800, 0x001089e1, 0x0201f800,
-+ 0x00104a76, 0x0201f800, 0x0010893e, 0x0401f7c4,
-+ 0x0201f800, 0x0010cda7, 0x80c589c0, 0x040007b0,
-+ 0x5930d403, 0x82697480, 0x00000043, 0x040007ac,
-+ 0x0201f800, 0x0010d07d, 0x80c589c0, 0x04020048,
-+ 0x0201f800, 0x00108960, 0x80c589c0, 0x040007b4,
-+ 0x0201f800, 0x001078be, 0x0401f7b1, 0x5930d203,
-+ 0x82697480, 0x00000004, 0x04000037, 0x59325808,
-+ 0x0201f800, 0x00108834, 0x80c589c0, 0x040007a8,
-+ 0x49425a06, 0x497a5c09, 0x0201f800, 0x00104a76,
-+ 0x0401f7a3, 0x0201f800, 0x0010cda7, 0x80c589c0,
-+ 0x0400078f, 0x5930d203, 0x82697480, 0x00000004,
-+ 0x04000028, 0x59325808, 0x0201f800, 0x00108834,
-+ 0x80c589c0, 0x04000796, 0x49425a06, 0x497a5c09,
-+ 0x0201f800, 0x00109e7b, 0x0201f800, 0x00108deb,
-+ 0x0201f800, 0x00104a76, 0x0401f78d, 0x0201f800,
-+ 0x00105ebc, 0x80c589c0, 0x04020779, 0x5930d203,
-+ 0x82697480, 0x00000004, 0x04000775, 0x82697480,
-+ 0x00000003, 0x04020772, 0x0201f800, 0x001063a0,
-+ 0x59325808, 0x0201f800, 0x00108834, 0x80c589c0,
-+ 0x0400077b, 0x0401f78a, 0x49425a06, 0x497a5c09,
-+ 0x0401f7af, 0x0201f800, 0x00100ddb, 0x0401f7c8,
-+ 0x0201f800, 0x00100ddb, 0x0401f7d7, 0x0201f800,
-+ 0x00101c32, 0x0401f7b7, 0x58825809, 0x0201f800,
-+ 0x00100737, 0x0401f799, 0x0201f800, 0x00100ddb,
-+ 0x0401f78c, 0x589d0000, 0x809d3800, 0x1c01f000,
-+ 0x0201f800, 0x00109c74, 0x80c589c0, 0x04020002,
-+ 0x0401f003, 0x59326809, 0x0401ff21, 0x1c01f000,
-+ 0x829d3c80, 0x00000006, 0x48813800, 0x48853801,
-+ 0x48893802, 0x488d3803, 0x48913804, 0x48953805,
-+ 0x41311000, 0x412d2000, 0x41352800, 0x4933c857,
-+ 0x4947c857, 0x4943c857, 0x0201f800, 0x0010646d,
-+ 0x40c51800, 0x0201f800, 0x00109b79, 0x41310800,
-+ 0x813261c0, 0x04000048, 0x42000000, 0x0010b5b8,
-+ 0x81317480, 0x04000044, 0x59a8d00d, 0x8068d040,
-+ 0x42010000, 0x0010d8d4, 0x40680000, 0x81657480,
-+ 0x04000043, 0x41580000, 0x80817480, 0x0402100c,
-+ 0x40826000, 0x40800000, 0x80857480, 0x04000003,
-+ 0x4084d000, 0x0401ffcf, 0x82810400, 0x00000024,
-+ 0x41580000, 0x80817480, 0x040017f6, 0x41540000,
-+ 0x80817480, 0x04021012, 0x8d3e7d18, 0x04000010,
-+ 0x59a8d063, 0x59a80067, 0x80697480, 0x0400000c,
-+ 0x40826000, 0x5880d009, 0x8068d1c0, 0x0400000e,
-+ 0x4084d000, 0x0401ffbb, 0x82810400, 0x00000024,
-+ 0x41540000, 0x80817480, 0x040017f0, 0x408a6000,
-+ 0x40925800, 0x40966800, 0x808d7040, 0x0400001e,
-+ 0x0401f023, 0x0201f800, 0x0010433e, 0x40c66800,
-+ 0x80c589c0, 0x040007f1, 0x58c4d002, 0x5930d81e,
-+ 0x82680500, 0x00ffffff, 0x806d7480, 0x040207eb,
-+ 0x5930d203, 0x82697480, 0x00000008, 0x04000011,
-+ 0x49366009, 0x0401fec6, 0x82810400, 0x00000024,
-+ 0x0401f7e4, 0x59a8d00d, 0x42010000, 0x0010d8d4,
-+ 0x40680000, 0x81657480, 0x040207bf, 0x41510000,
-+ 0x0401f7cb, 0x0201f800, 0x0010645f, 0x0401f004,
-+ 0x0201f800, 0x0010a16d, 0x0401f7ee, 0x589d2805,
-+ 0x589d2004, 0x589d1803, 0x589d1002, 0x589d0801,
-+ 0x589d0000, 0x829d3c00, 0x00000006, 0x1c01f000,
-+ 0x4200d000, 0x00000080, 0x0201f800, 0x001014be,
-+ 0x0201f800, 0x00105c88, 0x59c4d0a3, 0x8468d506,
-+ 0x486b88a3, 0x0201f800, 0x00104cb9, 0x80c589c0,
-+ 0x04020005, 0x0201f800, 0x00104cdb, 0x80c589c0,
-+ 0x0400006a, 0x59c4d0a3, 0x8268d500, 0xbe7fffff,
-+ 0x486b88a3, 0x4200d000, 0x000000f8, 0x0201f800,
-+ 0x00103ec0, 0x59c4d0a3, 0x8268d540, 0x00018000,
-+ 0x8468d51c, 0x486b88a3, 0x59c4d0a3, 0x8468d520,
-+ 0x486b88a3, 0x497b8808, 0x59c4d006, 0x8268d500,
-+ 0xfbffff0e, 0x486b8806, 0x497b2822, 0x497b2823,
-+ 0x4200d000, 0x000001f4, 0x4200d800, 0x0010d490,
-+ 0x0201f800, 0x00105b5d, 0x4a038805, 0x00000001,
-+ 0x0201f800, 0x00101579, 0x80c589c0, 0x04000021,
-+ 0x4200d000, 0x00000001, 0x0201f800, 0x0010183f,
-+ 0x4200d000, 0x00000001, 0x0201f800, 0x001017f3,
-+ 0x0201f800, 0x0010187e, 0x4a03503b, 0x00000001,
-+ 0x0201f800, 0x00104cb9, 0x80c589c0, 0x0400002a,
-+ 0x59c4d0a4, 0x8268d500, 0x0000000f, 0x82697480,
-+ 0x00000008, 0x04000003, 0x4a038805, 0x04000000,
-+ 0x59c4d0a3, 0x8268d540, 0x0001c000, 0x486b88a3,
-+ 0x59c4d0a3, 0x8468d520, 0x486b88a3, 0x0401f04b,
-+ 0x0201f800, 0x00101589, 0x80c589c0, 0x04000006,
-+ 0x4178d000, 0x0201f800, 0x0010183f, 0x4178d000,
-+ 0x0401f7de, 0x0201f800, 0x00101599, 0x80c589c0,
-+ 0x04020025, 0x0201f800, 0x001015a9, 0x80c589c0,
-+ 0x04000034, 0x59a8d046, 0x8068d1c0, 0x040007d5,
-+ 0x0201f800, 0x001015b8, 0x4a03503b, 0x00000001,
-+ 0x0401f032, 0x0201f800, 0x00104cdb, 0x80c589c0,
-+ 0x040207d4, 0x0201f800, 0x00104cca, 0x80c589c0,
-+ 0x04000018, 0x4a035030, 0x00000001, 0x0201f800,
-+ 0x00104c16, 0x0401f025, 0x0201f800, 0x00104cca,
-+ 0x80c589c0, 0x04000015, 0x59c4d0a3, 0x8468d570,
-+ 0x8468d532, 0x486b88a3, 0x4a038808, 0x00000008,
-+ 0x0401f79e, 0x4200d000, 0x00000002, 0x0201f800,
-+ 0x0010183f, 0x4200d000, 0x00000002, 0x0401f7af,
-+ 0x40c4d000, 0x40c4d800, 0x40c4e000, 0x0201f800,
-+ 0x001004ec, 0x0401f7bb, 0x40c4d000, 0x40c4d800,
-+ 0x40c4e000, 0x0201f800, 0x001004ec, 0x0401f78b,
-+ 0x40c4d000, 0x40c4d800, 0x40c4e000, 0x0201f800,
-+ 0x001004ec, 0x0401f79f, 0x1c01f000, 0x5994d022,
-+ 0x59940023, 0x8068d540, 0x4178d800, 0x8068d1c0,
-+ 0x04020003, 0x4200d800, 0x00000001, 0x406d8800,
-+ 0x1c01f000, 0x0201f800, 0x0010177b, 0x4a03503b,
-+ 0x00000002, 0x497b5046, 0x59c4d0a3, 0x8468d520,
-+ 0x486b88a3, 0x497b2822, 0x497b2823, 0x4200d000,
-+ 0x0000002d, 0x4200d800, 0x0010d490, 0x0201f800,
-+ 0x00105b5d, 0x1c01f000, 0x0401ffe5, 0x80c589c0,
-+ 0x04000004, 0x4a03503b, 0x00000003, 0x0401f01f,
-+ 0x0201f800, 0x001015a9, 0x80c589c0, 0x04000004,
-+ 0x59a8d046, 0x8068d1c0, 0x04020008, 0x0201f800,
-+ 0x00101844, 0x80c589c0, 0x04020002, 0x0401f013,
-+ 0x0401ffdd, 0x0401f011, 0x0201f800, 0x001015b8,
-+ 0x59a8d045, 0x8c68d51e, 0x040007f9, 0x0201f800,
-+ 0x00104cca, 0x80c589c0, 0x04020003, 0x0401ffd2,
-+ 0x0401f006, 0x4a035030, 0x00000001, 0x0201f800,
-+ 0x00104c16, 0x0401f7fa, 0x1c01f000, 0x4a03503b,
-+ 0x00000003, 0x497b8885, 0x1c01f000, 0x4202d800,
-+ 0x00000001, 0x497b503b, 0x4a038805, 0x00000001,
-+ 0x497b2822, 0x497b2823, 0x497b8885, 0x1c01f000,
-+ 0x59c4d005, 0x8268d500, 0x000000c0, 0x04020003,
-+ 0x486b8885, 0x0401f006, 0x59c4d006, 0x8268d540,
-+ 0x000000f1, 0x486b8806, 0x0401ffed, 0x1c01f000,
-+ 0x0201f800, 0x00104cdb, 0x80c589c0, 0x04000005,
-+ 0x59a8d02f, 0x82697480, 0x0000aaaa, 0x0400000c,
-+ 0x497b502f, 0x59c4d006, 0x8268d540, 0x04000001,
-+ 0x486b8806, 0x8d0e1d06, 0x04020008, 0x59c4d0a3,
-+ 0x8468d546, 0x486b88a3, 0x0401f004, 0x4a03500f,
-+ 0x00ffffff, 0x0401f7f3, 0x0401ffd5, 0x1c01f000,
-+ 0x829d3c80, 0x00000002, 0x48813800, 0x48853801,
-+ 0x0401ff8b, 0x80c589c0, 0x04020020, 0x4a038805,
-+ 0x000000f0, 0x0201f800, 0x00101844, 0x80c589c0,
-+ 0x04000013, 0x0201f800, 0x00104cca, 0x80c589c0,
-+ 0x04020018, 0x59c4d0a4, 0x8268d500, 0x0000000f,
-+ 0x82697480, 0x00000008, 0x04000006, 0x59c4d005,
-+ 0x82690500, 0x04000000, 0x8c68d534, 0x0400000f,
-+ 0x0401ffcc, 0x497b8885, 0x0401f024, 0x0201f800,
-+ 0x001015a9, 0x80c589c0, 0x040007fb, 0x59a8d046,
-+ 0x8068d1c0, 0x040007f8, 0x0401ffa9, 0x0401f01b,
-+ 0x0401ffb4, 0x0401f019, 0x59950822, 0x80857040,
-+ 0x040207f1, 0x0201f800, 0x00104cdb, 0x80c589c0,
-+ 0x040007ed, 0x4a038805, 0x000000f0, 0x0201f800,
-+ 0x00104d1a, 0x4a03502f, 0x0000aaaa, 0x48835030,
-+ 0x59c4d0a3, 0x8468d546, 0x486b88a3, 0x4086d800,
-+ 0x4883503b, 0x48878805, 0x48832822, 0x48832823,
-+ 0x0401ff9c, 0x0401f7dc, 0x589d0801, 0x589d0000,
-+ 0x829d3c00, 0x00000002, 0x1c01f000, 0x59a9703b,
-+ 0x48bbc856, 0x4200d000, 0x00000080, 0x0201f800,
-+ 0x001014be, 0x497b503b, 0x0201f800, 0x001015a9,
-+ 0x80c589c0, 0x0400000e, 0x59a8d04f, 0x8068d1c0,
-+ 0x04020008, 0x8068d1c0, 0x04020009, 0x4a03504f,
-+ 0x0000000a, 0x4a035046, 0x00000001, 0x0401f004,
-+ 0x8068d040, 0x486b504f, 0x0401f7f7, 0x497b8885,
-+ 0x0201f800, 0x00100599, 0x1c01f000, 0x59a8d03b,
-+ 0x82697480, 0x00000003, 0x83f17500, 0x03000000,
-+ 0x0400000c, 0x80697040, 0x04000012, 0x80697040,
-+ 0x0400100e, 0x82697480, 0x00000002, 0x0400000f,
-+ 0x82697480, 0x00000003, 0x0400000e, 0x0401f00e,
-+ 0x4200d800, 0x00000003, 0x4178e000, 0x0201f800,
-+ 0x001004ec, 0x0401f008, 0x0401fe76, 0x0401f006,
-+ 0x0401ff2e, 0x0401f004, 0x0401ff82, 0x0401f002,
-+ 0x0401ffc7, 0x1c01f000, 0x497b2823, 0x1c01f000,
-+ 0x00000000, 0x00000001, 0x00000002, 0x00000003,
-+ 0x00000004, 0x00000005, 0x00000006, 0x00000007,
-+ 0x00000008, 0x00000009, 0x0000000a, 0x0000000b,
-+ 0x0000000c, 0x0000000d, 0x0000000e, 0x0000000f,
-+ 0x941bc502, 0x02800004, 0x00000000, 0x0000c000,
-+ 0x00000742, 0x073fca5a, 0x0705a5a5, 0x01928009,
-+ 0x070ff0e1, 0x03800006, 0x04958010, 0x05308000,
-+ 0x05008000, 0x0600902f, 0x04a004f2, 0x0202f051,
-+ 0x042e4020, 0x018f021e, 0x033e5000, 0x03020000,
-+ 0x078d0018, 0x05930428, 0x0092042a, 0x028a0319,
-+ 0x078b0317, 0x048e8010, 0x0678aae5, 0x06000001,
-+ 0x07818174, 0x040010e6, 0x0448e0e6, 0x04818010,
-+ 0x002fb008, 0x0448e0e6, 0x04818010, 0x060ff0e6,
-+ 0x00580401, 0x054880ff, 0x04818010, 0x022a5001,
-+ 0x030430d4, 0x06780043, 0x030e0000, 0x030450ff,
-+ 0x06780043, 0x03019000, 0x058185eb, 0x027c0045,
-+ 0x03020000, 0x06810037, 0x027c0045, 0x03040000,
-+ 0x068100c7, 0x027c0045, 0x03080000, 0x06810643,
-+ 0x04908037, 0x029105e9, 0x010410a6, 0x0379ff41,
-+ 0x037fffff, 0x072d6000, 0x07601241, 0x050f80ff,
-+ 0x032fa009, 0x05600400, 0x050f80ff, 0x056c04ff,
-+ 0x06810601, 0x073fa009, 0x06000001, 0x0279ff02,
-+ 0x0700ffff, 0x070ff0d1, 0x0179feff, 0x0700ffff,
-+ 0x045c0402, 0x04818601, 0x060ff0d0, 0x0179feff,
-+ 0x0700ffff, 0x057dfeff, 0x0700ffff, 0x068105e3,
-+ 0x05600e41, 0x050f80ff, 0x032fa069, 0x07480000,
-+ 0x078105f5, 0x06780043, 0x070000f0, 0x0781005f,
-+ 0x037c00ff, 0x06000010, 0x0781005f, 0x028005f1,
-+ 0x0379ff00, 0x070fffff, 0x06780043, 0x07f00000,
-+ 0x075a0000, 0x020ef001, 0x038605f3, 0x05484000,
-+ 0x02a1819e, 0x062d6001, 0x002fb001, 0x070ff069,
-+ 0x01868072, 0x060ff079, 0x055c0441, 0x06810010,
-+ 0x012fb000, 0x060560fb, 0x03800078, 0x060ff079,
-+ 0x02868198, 0x070ff069, 0x055c0441, 0x06810010,
-+ 0x060560fb, 0x0400d0d0, 0x062d6002, 0x0648300d,
-+ 0x06810086, 0x070ff0d1, 0x062d6001, 0x045c040b,
-+ 0x06810089, 0x05488000, 0x04818086, 0x072e500c,
-+ 0x00208001, 0x04a004f7, 0x02800010, 0x062d6001,
-+ 0x07f00000, 0x07f00000, 0x070ff0d1, 0x0179feff,
-+ 0x070000ff, 0x055c040c, 0x058180bb, 0x0007b001,
-+ 0x03079041, 0x0307a000, 0x06600a79, 0x050f80ff,
-+ 0x053fa80a, 0x06000010, 0x072d5003, 0x078d0096,
-+ 0x0307c003, 0x0007d004, 0x0107e005, 0x0307f006,
-+ 0x02080007, 0x00081008, 0x01082009, 0x0308300a,
-+ 0x0008400b, 0x0308500c, 0x068d00a1, 0x0678007a,
-+ 0x07f00000, 0x010880ff, 0x03386000, 0x03010000,
-+ 0x072e6300, 0x020ef07f, 0x02860010, 0x070ff07d,
-+ 0x0450047c, 0x050f80ff, 0x002fa819, 0x068d00ae,
-+ 0x02080001, 0x00081002, 0x0448807a, 0x068100b5,
-+ 0x0379ff03, 0x070000ff, 0x01082003, 0x068d00b6,
-+ 0x02386004, 0x03010000, 0x072e6c00, 0x02800010,
-+ 0x06780043, 0x070000f0, 0x078105fc, 0x050020ff,
-+ 0x027c0002, 0x06000010, 0x078100c3, 0x038005fc,
-+ 0x0700c0d1, 0x0379ff0c, 0x070000ff, 0x0380008e,
-+ 0x0204a051, 0x06780043, 0x070000f0, 0x037c00ff,
-+ 0x06000010, 0x0781816a, 0x072d6000, 0x009485e5,
-+ 0x050fb056, 0x044880e6, 0x04818010, 0x060ff0d0,
-+ 0x0179feff, 0x0700ffff, 0x057dfeff, 0x0700ffff,
-+ 0x068105e3, 0x04a00215, 0x0349c0e4, 0x0781811d,
-+ 0x070ff093, 0x050010ff, 0x070ff093, 0x045c0401,
-+ 0x058180db, 0x02046092, 0x04002046, 0x04600202,
-+ 0x00540401, 0x048280e6, 0x04500425, 0x070060ff,
-+ 0x0730ffff, 0x0700000f, 0x0742000f, 0x05810190,
-+ 0x06a005cb, 0x0648a002, 0x048180e9, 0x00047089,
-+ 0x070ff047, 0x045c0443, 0x077800ff, 0x07f00000,
-+ 0x0781818e, 0x07780047, 0x0500e000, 0x058185d2,
-+ 0x070ff006, 0x01860117, 0x0179fe47, 0x0700000f,
-+ 0x010480ff, 0x056c7048, 0x06818102, 0x007a0d4a,
-+ 0x04003801, 0x0220f001, 0x0180010f, 0x07608e48,
-+ 0x034a60ff, 0x0700f0ff, 0x074b88ff, 0x037000ff,
-+ 0x07000600, 0x05500448, 0x074d00ff, 0x045a044a,
-+ 0x0304a0ff, 0x070ff00f, 0x01540406, 0x05820117,
-+ 0x04950120, 0x05a001bd, 0x02868123, 0x0134bfff,
-+ 0x070fffff, 0x0104102e, 0x050fd041, 0x00800126,
-+ 0x0595011d, 0x05a001bd, 0x0186011d, 0x0202f00e,
-+ 0x052e4030, 0x040fd02f, 0x070fc0ff, 0x05a0021b,
-+ 0x02800010, 0x0400e02f, 0x042e4020, 0x0202f051,
-+ 0x0004100e, 0x0004b00e, 0x050fd041, 0x024a6c46,
-+ 0x04500423, 0x050070ff, 0x03620024, 0x050080ff,
-+ 0x04004046, 0x0700500f, 0x03206000, 0x05601048,
-+ 0x0700a0ff, 0x0700900a, 0x070ff005, 0x04500446,
-+ 0x00540425, 0x04820157, 0x05601622, 0x050f80ff,
-+ 0x063fa032, 0x06000002, 0x03203000, 0x01204000,
-+ 0x03205000, 0x0120b000, 0x0320c000, 0x07601441,
-+ 0x050f80ff, 0x043fa852, 0x06000001, 0x070ff056,
-+ 0x056c02ff, 0x050fb0ff, 0x070560ff, 0x03079041,
-+ 0x05600e41, 0x050f80ff, 0x073fa011, 0x0600003d,
-+ 0x06780043, 0x07f00000, 0x065a007a, 0x010880ff,
-+ 0x04a001b6, 0x058d0150, 0x0208a04a, 0x0108b04b,
-+ 0x02386001, 0x03010000, 0x072e6300, 0x028000a8,
-+ 0x0500d00a, 0x05500405, 0x014a68ff, 0x070090ff,
-+ 0x0154040a, 0x0700c0ff, 0x0600a023, 0x0500b024,
-+ 0x02206001, 0x05601622, 0x050f80ff, 0x063fa04a,
-+ 0x06000002, 0x05601022, 0x050f80ff, 0x043fa819,
-+ 0x06000001, 0x0600a00d, 0x0180013c, 0x06780043,
-+ 0x070000f0, 0x050010ff, 0x027c0001, 0x07000030,
-+ 0x068105d9, 0x027c0001, 0x06000020, 0x068105d9,
-+ 0x028005f1, 0x054880ff, 0x06810010, 0x070ff056,
-+ 0x050fb0ff, 0x044880e5, 0x0581017d, 0x044880e6,
-+ 0x04818010, 0x00800183, 0x056c02ff, 0x050fb0ff,
-+ 0x070560ff, 0x072e5300, 0x044880e6, 0x04818010,
-+ 0x072d5003, 0x06780043, 0x07f00000, 0x010880ff,
-+ 0x058d0187, 0x03386005, 0x03010000, 0x033e6000,
-+ 0x0700000c, 0x052e5200, 0x02800010, 0x0120918e,
-+ 0x018004fa, 0x01209190, 0x018004fa, 0x00209192,
-+ 0x018004fa, 0x03209000, 0x018004fa, 0x01209196,
-+ 0x018004fa, 0x00209198, 0x018004fa, 0x02493075,
-+ 0x06810532, 0x0120919a, 0x018004fa, 0x06601e01,
-+ 0x050f80ff, 0x063fa029, 0x06000008, 0x02015010,
-+ 0x02016051, 0x00017051, 0x00011051, 0x05601a41,
-+ 0x050f80ff, 0x053fa83a, 0x06000008, 0x05600e41,
-+ 0x050f80ff, 0x01464000, 0x032fa00a, 0x07006011,
-+ 0x05007012, 0x04008013, 0x07009014, 0x0600a015,
-+ 0x0400b016, 0x0700c017, 0x07c00000, 0x072d5003,
-+ 0x06601479, 0x050f80ff, 0x048d01b9, 0x063fa051,
-+ 0x0600003e, 0x07c00000, 0x06005051, 0x0400e02c,
-+ 0x0660060e, 0x050f80ff, 0x032fa009, 0x0379ff00,
-+ 0x070000ff, 0x076c0000, 0x058101dd, 0x0660480e,
-+ 0x0500e0ff, 0x034000ff, 0x01540427, 0x0482020d,
-+ 0x03400005, 0x070ff005, 0x055c0428, 0x05810211,
-+ 0x01680e05, 0x056c0405, 0x068181bf, 0x040f8029,
-+ 0x053fa809, 0x07000024, 0x06600649, 0x050f80ff,
-+ 0x032fa009, 0x0379ff00, 0x070000ff, 0x076c0000,
-+ 0x068181bf, 0x0400e049, 0x0340002d, 0x050f802b,
-+ 0x053fa80a, 0x06000016, 0x0660480e, 0x0302c0ff,
-+ 0x034000ff, 0x01540427, 0x0582020f, 0x072d6000,
-+ 0x0460040e, 0x050f80ff, 0x0004d0d0, 0x0379ff4d,
-+ 0x0700ffff, 0x0104e0d1, 0x0379ff4e, 0x0700ffff,
-+ 0x062d6002, 0x032fa009, 0x0204f0d0, 0x064b004f,
-+ 0x07780000, 0x07ffff00, 0x045a044f, 0x070000ff,
- 0x00201008, 0x04002051, 0x06003051, 0x05304000,
- 0x07000060, 0x03205009, 0x07006022, 0x0460040e,
-- 0x050f80ff, 0x032fa03a, 0x06603c0e, 0x050f80ff,
-- 0x073fa00a, 0x07000027, 0x050010d1, 0x0460320e,
-+ 0x050f80ff, 0x032fa03a, 0x06603a0e, 0x050f80ff,
-+ 0x053fa812, 0x06000026, 0x050010d1, 0x0460320e,
- 0x050f80ff, 0x012fa80a, 0x060ff00e, 0x055c042e,
-- 0x04810210, 0x07c00000, 0x0400e026, 0x008001cb,
-+ 0x04810213, 0x07c00000, 0x0400e026, 0x008001cb,
- 0x0202c026, 0x008001e6, 0x0500e02e, 0x008001e6,
-- 0x0400e051, 0x01800209, 0x0349c0e4, 0x04810215,
-+ 0x0400e051, 0x0180020c, 0x0349c0e4, 0x05810218,
- 0x07c00000, 0x013e4000, 0x070c0000, 0x07c00000,
-- 0x013e4000, 0x03080000, 0x07c00000, 0x009702f4,
-- 0x022a5002, 0x0790821d, 0x00910291, 0x030400a6,
-- 0x0678aae5, 0x06000001, 0x01a1860c, 0x06600c40,
-+ 0x013e4000, 0x03080000, 0x07c00000, 0x02970308,
-+ 0x022a5002, 0x06908220, 0x019102a5, 0x030400a6,
-+ 0x0678aae5, 0x06000001, 0x01a18633, 0x06600c40,
- 0x050f80ff, 0x032fa021, 0x074b0000, 0x076c0600,
-- 0x07818293, 0x05600403, 0x050f80ff, 0x073fa009,
-+ 0x068182a7, 0x05600403, 0x050f80ff, 0x073fa009,
- 0x06000002, 0x0279ff04, 0x0700ffff, 0x010440d7,
-- 0x0179fe44, 0x0700ffff, 0x045c0404, 0x07818295,
-- 0x0349f044, 0x0681829e, 0x02495001, 0x06818297,
-- 0x060ff079, 0x045c0440, 0x0781823c, 0x0644f07a,
-- 0x002fb008, 0x060ff079, 0x045c0440, 0x07818241,
-- 0x0644f07a, 0x002fb008, 0x0648f001, 0x07818288,
-- 0x04600e40, 0x050f80ff, 0x06480001, 0x04810257,
-- 0x0448e001, 0x04810273, 0x02460001, 0x0644f001,
-- 0x012fa80a, 0x04008040, 0x05a004ee, 0x0286828c,
-- 0x05a004d8, 0x062da001, 0x013e4000, 0x06000080,
-- 0x06930013, 0x02920013, 0x02800010, 0x0644f001,
-- 0x012fa80a, 0x020ef002, 0x00860275, 0x04600840,
-+ 0x0179fe44, 0x0700ffff, 0x045c0404, 0x078182a9,
-+ 0x0349f044, 0x078182b2, 0x02495001, 0x068182ab,
-+ 0x060ff079, 0x045c0440, 0x0781823f, 0x0644f07a,
-+ 0x002fb008, 0x060ff079, 0x045c0440, 0x07818244,
-+ 0x0644f07a, 0x002fb008, 0x0648f001, 0x0781829c,
-+ 0x04600e40, 0x050f80ff, 0x06480001, 0x05810263,
-+ 0x0448e001, 0x05810287, 0x02460001, 0x0644f001,
-+ 0x012fa80a, 0x04008040, 0x06a00504, 0x038682a0,
-+ 0x00491001, 0x078182a0, 0x070050d8, 0x05780105,
-+ 0x07ffff00, 0x06600c02, 0x050f80ff, 0x053fa812,
-+ 0x06000002, 0x05a004ee, 0x062da001, 0x013e4000,
-+ 0x06000080, 0x06930013, 0x02920013, 0x02800010,
-+ 0x0644f001, 0x012fa80a, 0x020ef002, 0x00860289,
-+ 0x04600840, 0x050f80ff, 0x053fa809, 0x06000002,
-+ 0x05780105, 0x00800440, 0x017c0105, 0x05000400,
-+ 0x06818289, 0x06601e02, 0x050f80ff, 0x053fa809,
-+ 0x06000002, 0x04602a40, 0x050f80ff, 0x070ff005,
-+ 0x053fa809, 0x06000002, 0x055c0405, 0x06818289,
-+ 0x070050d8, 0x05780105, 0x07ffff00, 0x06006051,
-+ 0x06600c02, 0x050f80ff, 0x053fa812, 0x06000002,
-+ 0x04008040, 0x0045e008, 0x05a004ee, 0x0080025d,
-+ 0x0644f001, 0x012fa80a, 0x050020d8, 0x04600440,
-+ 0x050f80ff, 0x073fa00a, 0x06000001, 0x06480001,
-+ 0x07818295, 0x05308000, 0x03040000, 0x06009040,
-+ 0x04a004f2, 0x0080025d, 0x07a00633, 0x054b0800,
-+ 0x056a0700, 0x06600c40, 0x050f80ff, 0x032fa00a,
-+ 0x0080025d, 0x013e4000, 0x06000080, 0x0120929c,
-+ 0x018004fa, 0x06009008, 0x05308000, 0x05004000,
-+ 0x04a004f2, 0x0080025d, 0x02209002, 0x018002f9,
-+ 0x03209000, 0x018002f9, 0x02209004, 0x018002f9,
-+ 0x07a00311, 0x062da001, 0x05308000, 0x05002000,
-+ 0x06009040, 0x04a004f2, 0x0080025e, 0x013e4000,
-+ 0x06000080, 0x02495001, 0x068182ef, 0x04600840,
-+ 0x050f80ff, 0x053fa809, 0x06000001, 0x0721f000,
-+ 0x0349f003, 0x058102be, 0x0245f01f, 0x06000002,
-+ 0x008602ef, 0x07601400, 0x050f80ff, 0x012fa809,
-+ 0x06480001, 0x048102ef, 0x06602440, 0x050f80ff,
-+ 0x012fa809, 0x020ef001, 0x028682ef, 0x009b02ef,
-+ 0x050020d8, 0x062da001, 0x06303002, 0x05000430,
-+ 0x04600440, 0x050f80ff, 0x073fa012, 0x06000001,
-+ 0x028f82d3, 0x050040d8, 0x062da001, 0x07601e00,
-+ 0x050f80ff, 0x073fa009, 0x06000001, 0x060ff004,
-+ 0x00540402, 0x058202ed, 0x06005051, 0x06006051,
-+ 0x06602240, 0x050f80ff, 0x063fa01a, 0x06000002,
-+ 0x06600a40, 0x050f80ff, 0x073fa00a, 0x07000003,
-+ 0x060ff040, 0x045a041f, 0x010eb0ff, 0x06930013,
-+ 0x02920013, 0x02800010, 0x04004002, 0x018002dd,
-+ 0x07a00311, 0x062da001, 0x05308000, 0x07005000,
-+ 0x06009040, 0x04a004f2, 0x050080d8, 0x04a004f7,
-+ 0x062da001, 0x02800013, 0x050fd009, 0x050fd041,
-+ 0x013e4000, 0x06000080, 0x05308000, 0x03013000,
-+ 0x04a004f2, 0x010440d7, 0x0349f044, 0x07810306,
-+ 0x062da001, 0x038f0306, 0x03e00000, 0x062da001,
-+ 0x02800013, 0x0249c0e5, 0x06810013, 0x062da001,
-+ 0x07f00000, 0x07f00000, 0x033e5000, 0x070c0000,
-+ 0x038f030a, 0x03800011, 0x050020d8, 0x04600440,
-+ 0x050f80ff, 0x073fa00a, 0x06000001, 0x07c00000,
-+ 0x002fb001, 0x0280031a, 0x012fb000, 0x03075087,
-+ 0x078d031b, 0x03386000, 0x03020000, 0x04482075,
-+ 0x07810366, 0x0648a0e6, 0x0681035b, 0x0642007f,
-+ 0x07810359, 0x0340007e, 0x060ff038, 0x0154047e,
-+ 0x03d00348, 0x0560027d, 0x050f80ff, 0x032fa009,
-+ 0x030ef000, 0x0386052b, 0x0107d000, 0x05600800,
-+ 0x050f80ff, 0x032fa009, 0x03681e00, 0x04500420,
-+ 0x050f80ff, 0x073fa009, 0x0700003f, 0x02800325,
-+ 0x070ff07d, 0x0450047c, 0x050f80ff, 0x002fa819,
-+ 0x068d033b, 0x02080001, 0x00081002, 0x0448807a,
-+ 0x07810342, 0x0379ff03, 0x070000ff, 0x01082003,
-+ 0x068d0343, 0x02386004, 0x03010000, 0x072e6c00,
-+ 0x03800366, 0x0380034e, 0x03800350, 0x02800352,
-+ 0x02800354, 0x03800356, 0x02800358, 0x0727c005,
-+ 0x02800337, 0x0627c008, 0x02800337, 0x0627c00b,
-+ 0x02800337, 0x0627c00e, 0x02800337, 0x0727c011,
-+ 0x02800337, 0x03800328, 0x052e6800, 0x03800366,
-+ 0x044880e6, 0x06810558, 0x052e6200, 0x070ff088,
-+ 0x0179feff, 0x070fffff, 0x04818523, 0x060ff083,
-+ 0x01868381, 0x033e6000, 0x07000003, 0x078d0366,
-+ 0x07286000, 0x07f00000, 0x078d0369, 0x028c031a,
-+ 0x0648c0e6, 0x04818386, 0x0448e0e6, 0x0781037e,
-+ 0x004920e6, 0x06810379, 0x06a00594, 0x05001088,
-+ 0x00700101, 0x03100000, 0x00088001, 0x033e6000,
-+ 0x07000088, 0x02800585, 0x02386001, 0x07030000,
-+ 0x033e6000, 0x06000008, 0x038003ff, 0x02799075,
-+ 0x0500040f, 0x06810010, 0x06601479, 0x050080ff,
-+ 0x06309052, 0x0600003e, 0x0280038a, 0x06602279,
-+ 0x050080ff, 0x05309812, 0x07000041, 0x0648007a,
-+ 0x06810392, 0x04488075, 0x04818392, 0x040f8008,
-+ 0x070fa009, 0x0049107a, 0x02a18401, 0x00798075,
-+ 0x06000507, 0x04818543, 0x0448b075, 0x07810399,
-+ 0x02493075, 0x07810530, 0x0648c0e6, 0x058183ac,
-+ 0x068d039b, 0x02386001, 0x07030000, 0x0049107a,
-+ 0x068103a2, 0x020ef083, 0x038603ac, 0x06483075,
-+ 0x068103fd, 0x0678007a, 0x07000035, 0x02a184e5,
-+ 0x05308000, 0x07060000, 0x06009079, 0x04a004f2,
-+ 0x028003fd, 0x06483075, 0x0781050f, 0x068d03ae,
-+ 0x02386001, 0x07030000, 0x0444e07a, 0x0648307a,
-+ 0x048183df, 0x0448707a, 0x068103f8, 0x0648f07a,
-+ 0x078103ca, 0x04a004e5, 0x04008079, 0x06a00504,
-+ 0x008683da, 0x0049107a, 0x048183da, 0x04600408,
- 0x050f80ff, 0x053fa809, 0x06000002, 0x05780105,
-- 0x00800440, 0x017c0105, 0x05000400, 0x06818275,
-- 0x06601e02, 0x050f80ff, 0x053fa809, 0x06000002,
-- 0x04602a40, 0x050f80ff, 0x070ff005, 0x053fa809,
-- 0x06000002, 0x055c0405, 0x06818275, 0x04008040,
-- 0x0045e008, 0x05a004d8, 0x00800251, 0x0644f001,
-- 0x012fa80a, 0x050020d8, 0x04600440, 0x050f80ff,
-- 0x073fa00a, 0x06000001, 0x06480001, 0x07818281,
-- 0x05308000, 0x03040000, 0x06009040, 0x04a004dc,
-- 0x00800251, 0x07a0060c, 0x054b0800, 0x056a0700,
-- 0x06600c40, 0x050f80ff, 0x032fa00a, 0x00800251,
-- 0x013e4000, 0x06000080, 0x01209288, 0x018004e4,
-- 0x06009008, 0x05308000, 0x05004000, 0x04a004dc,
-- 0x00800251, 0x02209002, 0x008002e5, 0x03209000,
-- 0x008002e5, 0x02209004, 0x008002e5, 0x04a002fd,
-- 0x062da001, 0x05308000, 0x05002000, 0x06009040,
-- 0x04a004dc, 0x00800252, 0x013e4000, 0x06000080,
-- 0x02495001, 0x078182db, 0x04600840, 0x050f80ff,
-- 0x053fa809, 0x06000001, 0x0721f000, 0x0349f003,
-- 0x058102aa, 0x0245f01f, 0x06000002, 0x018602db,
-- 0x07601400, 0x050f80ff, 0x012fa809, 0x06480001,
-- 0x058102db, 0x06602440, 0x050f80ff, 0x012fa809,
-- 0x020ef001, 0x038682db, 0x019b02db, 0x050020d8,
-- 0x062da001, 0x06303002, 0x05000430, 0x04600440,
-- 0x050f80ff, 0x073fa012, 0x06000001, 0x028f82bf,
-- 0x050040d8, 0x062da001, 0x07601e00, 0x050f80ff,
-- 0x073fa009, 0x06000001, 0x060ff004, 0x00540402,
-- 0x048202d9, 0x06005051, 0x06006051, 0x06602240,
-- 0x050f80ff, 0x063fa01a, 0x06000002, 0x06600a40,
-- 0x050f80ff, 0x073fa00a, 0x07000003, 0x060ff040,
-- 0x045a041f, 0x010eb0ff, 0x06930013, 0x02920013,
-- 0x02800010, 0x04004002, 0x018002c9, 0x04a002fd,
-- 0x062da001, 0x05308000, 0x07005000, 0x06009040,
-- 0x04a004dc, 0x050080d8, 0x05a004e1, 0x062da001,
-- 0x02800013, 0x050fd009, 0x050fd041, 0x013e4000,
-- 0x06000080, 0x05308000, 0x03013000, 0x04a004dc,
-- 0x010440d7, 0x0349f044, 0x048102f2, 0x062da001,
-- 0x008f02f2, 0x03e00000, 0x062da001, 0x02800013,
-- 0x0249c0e5, 0x06810013, 0x062da001, 0x07f00000,
-- 0x07f00000, 0x033e5000, 0x070c0000, 0x018f02f6,
-- 0x03800011, 0x050020d8, 0x04600440, 0x050f80ff,
-- 0x073fa00a, 0x06000001, 0x07c00000, 0x002fb001,
-- 0x03800306, 0x012fb000, 0x03075087, 0x068d0307,
-- 0x03386000, 0x03020000, 0x04482075, 0x06810352,
-- 0x0648a0e6, 0x07810347, 0x0642007f, 0x06810345,
-- 0x0340007e, 0x060ff038, 0x0154047e, 0x02d00334,
-- 0x0560027d, 0x050f80ff, 0x032fa009, 0x030ef000,
-- 0x02860504, 0x0107d000, 0x05600800, 0x050f80ff,
-- 0x032fa009, 0x03681e00, 0x04500420, 0x050f80ff,
-- 0x073fa009, 0x0700003f, 0x03800311, 0x070ff07d,
-- 0x0450047c, 0x050f80ff, 0x002fa819, 0x078d0327,
-- 0x02080001, 0x00081002, 0x0448807a, 0x0781032e,
-- 0x0379ff03, 0x070000ff, 0x01082003, 0x068d032f,
-- 0x02386004, 0x03010000, 0x072e6c00, 0x02800352,
-- 0x0380033a, 0x0380033c, 0x0280033e, 0x02800340,
-- 0x03800342, 0x03800344, 0x0727c005, 0x02800323,
-- 0x0627c008, 0x02800323, 0x0627c00b, 0x02800323,
-- 0x0627c00e, 0x02800323, 0x0727c011, 0x02800323,
-- 0x03800314, 0x052e6800, 0x02800352, 0x044880e6,
-- 0x06810531, 0x052e6200, 0x070ff088, 0x0179feff,
-- 0x070fffff, 0x04818501, 0x060ff083, 0x0086836d,
-- 0x033e6000, 0x07000003, 0x068d0352, 0x07286000,
-- 0x07f00000, 0x078d0355, 0x038c0306, 0x0648c0e6,
-- 0x05818372, 0x0448e0e6, 0x0781036a, 0x004920e6,
-- 0x07810365, 0x06a0056d, 0x05001088, 0x00700101,
-- 0x03100000, 0x00088001, 0x033e6000, 0x07000088,
-- 0x0280055e, 0x02386001, 0x07030000, 0x033e6000,
-- 0x06000008, 0x028003f1, 0x02799075, 0x0500040f,
-- 0x06810010, 0x06601479, 0x050080ff, 0x06309052,
-- 0x0600003e, 0x02800376, 0x06602279, 0x050080ff,
-- 0x05309812, 0x07000041, 0x0648007a, 0x0781037e,
-- 0x04488075, 0x0581837e, 0x040f8008, 0x070fa009,
-- 0x0049107a, 0x01a183f3, 0x00798075, 0x06000507,
-- 0x0481851c, 0x0448b075, 0x06810385, 0x02493075,
-- 0x07810509, 0x0249c0e6, 0x048183e0, 0x0648c0e6,
-- 0x0581839a, 0x068d0389, 0x02386001, 0x07030000,
-- 0x0049107a, 0x07810390, 0x020ef083, 0x0386039a,
-- 0x06483075, 0x068103ef, 0x0678007a, 0x07000035,
-- 0x03a184cf, 0x05308000, 0x07060000, 0x06009079,
-- 0x04a004dc, 0x028003ef, 0x0448807a, 0x0681039e,
-- 0x06483075, 0x058104f9, 0x0448d07a, 0x068103a2,
-- 0x06483075, 0x058104f9, 0x068d03a2, 0x02386001,
-- 0x07030000, 0x0444e07a, 0x0648307a, 0x048183c7,
-- 0x0448707a, 0x068103ea, 0x0648f07a, 0x078103b2,
-- 0x05a004cf, 0x04008079, 0x05a004ee, 0x008683c2,
-- 0x05a004d8, 0x028003ef, 0x0560107b, 0x050f80ff,
-- 0x032fa009, 0x0349c000, 0x058183c0, 0x04600e79,
-- 0x050f80ff, 0x073fa00a, 0x0600003d, 0x06600a79,
-- 0x050f80ff, 0x053fa80a, 0x06000010, 0x028003ef,
-- 0x0046e07a, 0x028003ea, 0x06009008, 0x05308000,
-- 0x05004000, 0x04a004dc, 0x028003ef, 0x0560167b,
-- 0x050f80ff, 0x032fa011, 0x070ff000, 0x04500401,
-- 0x030460ff, 0x060ff025, 0x00540446, 0x078203d1,
-- 0x030460ff, 0x04092046, 0x05a00218, 0x06600679,
-- 0x050f80ff, 0x00201007, 0x012fa80a, 0x0046047a,
-- 0x034630ff, 0x050020ff, 0x06003051, 0x04600e79,
-- 0x050f80ff, 0x073fa012, 0x06000001, 0x028003ef,
-- 0x033e6a00, 0x0202000e, 0x02079051, 0x07000088,
-- 0x078d03e4, 0x0744c000, 0x01088000, 0x03386006,
-- 0x03010000, 0x02800010, 0x05a004cf, 0x05308000,
-- 0x03020000, 0x06009079, 0x04a004dc, 0x033e6a00,
-- 0x0302000a, 0x02079051, 0x02800010, 0x04603e79,
-- 0x050f80ff, 0x032fa009, 0x070ff000, 0x0186040c,
-- 0x057dfeff, 0x07ffffff, 0x0581040c, 0x050f8000,
-- 0x012fa811, 0x0079fe02, 0x070000ff, 0x077d66ff,
-- 0x060000dc, 0x0781840c, 0x060ff001, 0x0286840d,
-- 0x064b0002, 0x06420002, 0x060ff002, 0x05500400,
-- 0x050f80ff, 0x05004084, 0x073fa00a, 0x06000002,
-- 0x07c00000, 0x04600201, 0x050f80ff, 0x073fa009,
-- 0x06000001, 0x0079fe02, 0x070000ff, 0x077d72ff,
-- 0x070000dd, 0x0781840c, 0x064b0002, 0x06420002,
-- 0x06000001, 0x01800406, 0x0605004c, 0x0180041e,
-- 0x0493041a, 0x04a004d5, 0x054bc450, 0x05810421,
-- 0x01d00422, 0x01800421, 0x00800432, 0x00800434,
-- 0x00800432, 0x008004a7, 0x0180043f, 0x00800434,
-- 0x01800471, 0x00800432, 0x00800432, 0x008004ab,
-- 0x00800432, 0x018004af, 0x008004c4, 0x01800488,
-- 0x00800432, 0x00800432, 0x00209432, 0x018004e4,
-- 0x0379ff50, 0x070fffff, 0x060ff079, 0x055c0450,
-- 0x048104a4, 0x002fb008, 0x060ff079, 0x055c0450,
-- 0x058104a3, 0x04a004c7, 0x0180049c, 0x0179fe50,
-- 0x070fffff, 0x070050ff, 0x060ff079, 0x055c0405,
-- 0x04810449, 0x002fb008, 0x060ff079, 0x055c0405,
-- 0x078184a0, 0x070ff087, 0x017980ff, 0x06000507,
-- 0x06818451, 0x02203040, 0x05002087, 0x0049d002,
-- 0x0481046b, 0x04930458, 0x01257000, 0x073c3fff,
-- 0x0700000f, 0x052e4003, 0x072e5030, 0x0304c050,
-- 0x02400057, 0x06740057, 0x06000002, 0x06820016,
-- 0x04002083, 0x07003084, 0x04004085, 0x06602279,
-- 0x050f80ff, 0x063fa01a, 0x06000001, 0x05a004cf,
-- 0x06a00576, 0x033e6a00, 0x0302000a, 0x062e5020,
-- 0x003e4002, 0x07000a00, 0x028003f1, 0x07420003,
-- 0x0781844e, 0x00798002, 0x06000507, 0x06818451,
-- 0x0180045c, 0x05930478, 0x01257000, 0x073c3fff,
-- 0x0700000f, 0x052e4003, 0x072e5030, 0x0304c050,
-- 0x067800e6, 0x07000041, 0x0581047d, 0x06a0057f,
-- 0x04818016, 0x002fb008, 0x067800e6, 0x07000041,
-- 0x04810483, 0x06a0057f, 0x04818016, 0x062e5020,
-- 0x003e4002, 0x07000a00, 0x03e00000, 0x02800010,
-- 0x0379ff50, 0x070fffff, 0x060ff079, 0x055c0450,
-- 0x0781848e, 0x0245507a, 0x002fb008, 0x060ff079,
-- 0x055c0450, 0x07818493, 0x0245507a, 0x002fb008,
-- 0x05600e50, 0x050f80ff, 0x012fa809, 0x02455001,
-- 0x05600e50, 0x050f80ff, 0x012fa80a, 0x0080049d,
-- 0x002fb008, 0x003e4002, 0x07000a00, 0x02800016,
-- 0x079384a3, 0x062e5020, 0x042e4002, 0x002fb008,
-- 0x013e4000, 0x05000e00, 0x02800016, 0x0179fe50,
-- 0x070fffff, 0x010210ff, 0x02800016, 0x0179fe50,
-- 0x070fffff, 0x050340ff, 0x0080049d, 0x0179fe50,
-- 0x070fffff, 0x0102e0ff, 0x0760282e, 0x050f80ff,
-- 0x05222000, 0x07223000, 0x05224000, 0x07225000,
-- 0x07226000, 0x05227000, 0x05228000, 0x07229000,
-- 0x0722a000, 0x0522b000, 0x063fa051, 0x07000011,
-- 0x0202c026, 0x0522d000, 0x052e400c, 0x02800016,
-- 0x030430d4, 0x062e5008, 0x00800176, 0x05600e50,
-- 0x050f80ff, 0x032fa009, 0x03460000, 0x018004d2,
-- 0x0246007a, 0x0045207a, 0x008004d0, 0x0246007a,
-- 0x0600007a, 0x04600e79, 0x050f80ff, 0x032fa00a,
-- 0x07c00000, 0x029284d5, 0x070500e1, 0x07c00000,
-- 0x0245f008, 0x048404d9, 0x020e0008, 0x07c00000,
-- 0x070ff009, 0x065a0008, 0x058404de, 0x020e0008,
-- 0x07c00000, 0x058404e1, 0x020e0008, 0x07c00000,
-- 0x05308000, 0x0500d000, 0x04a004dc, 0x04a004e9,
-- 0x02800010, 0x052e4300, 0x072e500c, 0x073c3fff,
-- 0x0700000f, 0x07c00000, 0x06602208, 0x050f80ff,
-- 0x032fa011, 0x076a0000, 0x068184f7, 0x066a0001,
-- 0x048104f7, 0x04002051, 0x07c00000, 0x00202001,
-- 0x07c00000, 0x0648307a, 0x01a18606, 0x05a004cc,
-- 0x05308000, 0x05001000, 0x06009079, 0x04a004dc,
-- 0x0280055e, 0x0249c0e6, 0x058104f9, 0x0280036d,
-- 0x0648307a, 0x07818196, 0x05a004cf, 0x02209504,
-- 0x018004e4, 0x02490075, 0x06810519, 0x04002089,
-- 0x04780102, 0x07f00000, 0x05001088, 0x06a0056d,
-+ 0x07ffff00, 0x07600c7b, 0x050f80ff, 0x053fa812,
-+ 0x06000002, 0x05a004ee, 0x028003fd, 0x0560107b,
-+ 0x050f80ff, 0x032fa009, 0x0349c000, 0x058183d8,
-+ 0x04600e79, 0x050f80ff, 0x073fa00a, 0x0600003d,
-+ 0x06600a79, 0x050f80ff, 0x053fa80a, 0x06000010,
-+ 0x028003fd, 0x0046e07a, 0x028003f8, 0x06009008,
-+ 0x05308000, 0x05004000, 0x04a004f2, 0x028003fd,
-+ 0x0560167b, 0x050f80ff, 0x032fa011, 0x070ff000,
-+ 0x04500401, 0x030460ff, 0x060ff025, 0x00540446,
-+ 0x068203e9, 0x030460ff, 0x04092046, 0x05a0021b,
-+ 0x06600679, 0x050f80ff, 0x00201007, 0x012fa80a,
-+ 0x0046047a, 0x034630ff, 0x050020ff, 0x06003051,
-+ 0x04600e79, 0x050f80ff, 0x073fa012, 0x06000001,
-+ 0x028003fd, 0x04a004e5, 0x05308000, 0x03020000,
-+ 0x06009079, 0x04a004f2, 0x033e6a00, 0x0700000a,
-+ 0x02079051, 0x02800010, 0x04603e79, 0x050f80ff,
-+ 0x032fa009, 0x070ff000, 0x0086041a, 0x057dfeff,
-+ 0x07ffffff, 0x0481041a, 0x050f8000, 0x012fa811,
-+ 0x0079fe02, 0x070000ff, 0x077d66ff, 0x060000dc,
-+ 0x0681841a, 0x060ff001, 0x0386841b, 0x064b0002,
-+ 0x06420002, 0x060ff002, 0x05500400, 0x050f80ff,
-+ 0x05004084, 0x073fa00a, 0x06000002, 0x07c00000,
-+ 0x04600201, 0x050f80ff, 0x073fa009, 0x06000001,
-+ 0x0079fe02, 0x070000ff, 0x077d72ff, 0x070000dd,
-+ 0x0681841a, 0x064b0002, 0x06420002, 0x06000001,
-+ 0x01800414, 0x0605004c, 0x0080042c, 0x05930428,
-+ 0x05a004eb, 0x054bc450, 0x0481042f, 0x01d00430,
-+ 0x0080042f, 0x00800440, 0x01800442, 0x018004aa,
-+ 0x018004bd, 0x0180044d, 0x01800442, 0x0080047f,
-+ 0x00800440, 0x00800440, 0x008004c1, 0x00800440,
-+ 0x018004c5, 0x008004da, 0x01800496, 0x00800440,
-+ 0x00800440, 0x00209440, 0x018004fa, 0x0379ff50,
-+ 0x070fffff, 0x060ff079, 0x055c0450, 0x048104ba,
-+ 0x002fb008, 0x060ff079, 0x055c0450, 0x048104b9,
-+ 0x05a004dd, 0x018004b2, 0x0179fe50, 0x070fffff,
-+ 0x070050ff, 0x060ff079, 0x055c0405, 0x04810457,
-+ 0x002fb008, 0x060ff079, 0x055c0405, 0x068184b6,
-+ 0x070ff087, 0x017980ff, 0x06000507, 0x0781845f,
-+ 0x02203040, 0x05002087, 0x0049d002, 0x04810479,
-+ 0x05930466, 0x01257000, 0x073c3fff, 0x0700000f,
-+ 0x052e4003, 0x072e5030, 0x0304c050, 0x02400057,
-+ 0x06740057, 0x06000002, 0x06820016, 0x04002083,
-+ 0x07003084, 0x04004085, 0x06602279, 0x050f80ff,
-+ 0x063fa01a, 0x06000001, 0x04a004e5, 0x06a0059d,
-+ 0x033e6a00, 0x0700000a, 0x062e5020, 0x003e4002,
-+ 0x07000a00, 0x038003ff, 0x07420003, 0x0781845c,
-+ 0x00798002, 0x06000507, 0x0781845f, 0x0180046a,
-+ 0x04930486, 0x01257000, 0x073c3fff, 0x0700000f,
-+ 0x052e4003, 0x072e5030, 0x0304c050, 0x067800e6,
-+ 0x07000041, 0x0581048b, 0x07a005a6, 0x04818016,
-+ 0x002fb008, 0x067800e6, 0x07000041, 0x04810491,
-+ 0x07a005a6, 0x04818016, 0x062e5020, 0x003e4002,
-+ 0x07000a00, 0x03e00000, 0x02800010, 0x0379ff50,
-+ 0x070fffff, 0x060ff079, 0x055c0450, 0x0781849c,
-+ 0x0245507a, 0x002fb008, 0x060ff079, 0x055c0450,
-+ 0x068184a1, 0x0245507a, 0x002fb008, 0x05600e50,
-+ 0x050f80ff, 0x012fa809, 0x02455001, 0x05600e50,
-+ 0x050f80ff, 0x012fa80a, 0x008004b3, 0x069584ba,
-+ 0x0179fe50, 0x070fffff, 0x045c042f, 0x068184ba,
-+ 0x0202f051, 0x042e4020, 0x008004b3, 0x002fb008,
-+ 0x003e4002, 0x07000a00, 0x02800016, 0x069384b9,
-+ 0x062e5020, 0x042e4002, 0x002fb008, 0x013e4000,
-+ 0x05000e00, 0x02800016, 0x0179fe50, 0x070fffff,
-+ 0x010210ff, 0x02800016, 0x0179fe50, 0x070fffff,
-+ 0x050340ff, 0x008004b3, 0x0179fe50, 0x070fffff,
-+ 0x0102e0ff, 0x0760282e, 0x050f80ff, 0x05222000,
-+ 0x07223000, 0x05224000, 0x07225000, 0x07226000,
-+ 0x05227000, 0x05228000, 0x07229000, 0x0722a000,
-+ 0x0522b000, 0x063fa051, 0x07000011, 0x0202c026,
-+ 0x0522d000, 0x052e400c, 0x02800016, 0x030430d4,
-+ 0x062e5008, 0x00800176, 0x05600e50, 0x050f80ff,
-+ 0x032fa009, 0x03460000, 0x018004e8, 0x0246007a,
-+ 0x0045207a, 0x008004e6, 0x0246007a, 0x0600007a,
-+ 0x04600e79, 0x050f80ff, 0x032fa00a, 0x07c00000,
-+ 0x039284eb, 0x070500e1, 0x07c00000, 0x0245f008,
-+ 0x048404ef, 0x020e0008, 0x07c00000, 0x070ff009,
-+ 0x065a0008, 0x048404f4, 0x020e0008, 0x07c00000,
-+ 0x048404f7, 0x020e0008, 0x07c00000, 0x05308000,
-+ 0x0500d000, 0x04a004f2, 0x05a004ff, 0x02800010,
-+ 0x052e4300, 0x072e500c, 0x073c3fff, 0x0700000f,
-+ 0x07c00000, 0x06602208, 0x050f80ff, 0x032fa011,
-+ 0x076a0000, 0x0481850d, 0x066a0001, 0x0681050d,
-+ 0x06006051, 0x07c00000, 0x02206001, 0x07c00000,
-+ 0x0678007a, 0x07000021, 0x05818514, 0x0049107a,
-+ 0x048183ae, 0x040fd079, 0x0648307a, 0x01a1862d,
-+ 0x05a004e2, 0x05308000, 0x05001000, 0x06009079,
-+ 0x04a004f2, 0x068d051c, 0x033e6a00, 0x0600000e,
-+ 0x02079051, 0x03386006, 0x03010000, 0x02800010,
-+ 0x0648307a, 0x01a1862d, 0x05a004e2, 0x05308000,
-+ 0x05001000, 0x06009079, 0x04a004f2, 0x02800585,
-+ 0x0648307a, 0x07818196, 0x04a004e5, 0x0320952b,
-+ 0x018004fa, 0x02490075, 0x06810540, 0x04002089,
-+ 0x04780102, 0x07f00000, 0x05001088, 0x06a00594,
- 0x04740101, 0x03100000, 0x060ff002, 0x045c0401,
-- 0x0481851a, 0x00088001, 0x033e6000, 0x070000c0,
-- 0x0380055a, 0x07f00000, 0x0220951a, 0x018004e4,
-+ 0x05818541, 0x00088001, 0x033e6000, 0x070000c0,
-+ 0x03800581, 0x07f00000, 0x03209541, 0x018004fa,
- 0x040fd075, 0x040fd07a, 0x040fd079, 0x0648307a,
-- 0x06810525, 0x06780075, 0x06000007, 0x0481852c,
-- 0x07a00606, 0x06486075, 0x06818194, 0x02490075,
-- 0x0781819a, 0x04487075, 0x04818534, 0x0280053b,
-- 0x05308000, 0x03010000, 0x06009079, 0x04a004dc,
-- 0x02800010, 0x0448e0e6, 0x04818352, 0x00800192,
-- 0x05308000, 0x0500e000, 0x06009079, 0x04a004dc,
-- 0x04008089, 0x05a004e1, 0x0380055a, 0x05a004cc,
-+ 0x0681054c, 0x06780075, 0x06000007, 0x05818553,
-+ 0x07a0062d, 0x06486075, 0x06818194, 0x02490075,
-+ 0x0781819a, 0x04487075, 0x0481855b, 0x02800562,
-+ 0x05308000, 0x03010000, 0x06009079, 0x04a004f2,
-+ 0x02800010, 0x0448e0e6, 0x05818366, 0x00800192,
-+ 0x05308000, 0x0500e000, 0x06009079, 0x04a004f2,
-+ 0x04008089, 0x04a004f7, 0x03800581, 0x05a004e2,
- 0x05308000, 0x0700f000, 0x06009079, 0x07000088,
-- 0x06a00543, 0x04a004dc, 0x02800010, 0x03386000,
-- 0x07030000, 0x07f00000, 0x068d0546, 0x033e6a00,
-- 0x0202000e, 0x02079051, 0x0448b075, 0x06810551,
-- 0x02493075, 0x06810551, 0x05301005, 0x03010000,
-- 0x03800553, 0x05301006, 0x03010000, 0x05002087,
-- 0x06485002, 0x05818553, 0x0744c000, 0x01088000,
-- 0x02086001, 0x07c00000, 0x05001088, 0x06a0056d,
-- 0x0644c001, 0x00088001, 0x033e6a00, 0x0202000e,
-- 0x004920e6, 0x05818563, 0x02079051, 0x078d0563,
-- 0x060ff089, 0x034990ff, 0x0781056a, 0x03386005,
-+ 0x07a0056a, 0x04a004f2, 0x02800010, 0x03386000,
-+ 0x07030000, 0x07f00000, 0x068d056d, 0x033e6a00,
-+ 0x0600000e, 0x02079051, 0x0448b075, 0x07810578,
-+ 0x02493075, 0x07810578, 0x05301005, 0x03010000,
-+ 0x0280057a, 0x05301006, 0x03010000, 0x05002087,
-+ 0x06485002, 0x0481857a, 0x0744c000, 0x01088000,
-+ 0x02086001, 0x07c00000, 0x05001088, 0x06a00594,
-+ 0x0644c001, 0x00088001, 0x033e6a00, 0x0600000e,
-+ 0x004920e6, 0x0481858a, 0x02079051, 0x068d058a,
-+ 0x060ff089, 0x034990ff, 0x06810591, 0x03386005,
- 0x03010000, 0x02800010, 0x03386006, 0x03010000,
-- 0x02800010, 0x068d056d, 0x03386000, 0x07030000,
-- 0x07f00000, 0x078d0571, 0x070ff087, 0x074850ff,
-- 0x05818572, 0x07c00000, 0x068d0576, 0x02386001,
-- 0x07030000, 0x07f00000, 0x068d057a, 0x070ff087,
-- 0x074850ff, 0x0581857b, 0x07c00000, 0x05002087,
-- 0x0049d002, 0x0581858e, 0x002fb008, 0x067800e6,
-- 0x07000041, 0x002fb008, 0x0581858e, 0x06a005a4,
-- 0x0448e002, 0x06810591, 0x0648a002, 0x0481859b,
-- 0x06486002, 0x07810595, 0x02400057, 0x056a02ff,
-- 0x07c00000, 0x06a005a4, 0x06788102, 0x06000004,
-- 0x0581858e, 0x04002089, 0x070ff0d4, 0x045c0402,
-- 0x077800ff, 0x07f00000, 0x0581858e, 0x00202010,
-- 0x038c058e, 0x07f00000, 0x06420002, 0x0581859c,
-- 0x06a00576, 0x033e6a00, 0x0302000a, 0x07c00000,
-+ 0x02800010, 0x068d0594, 0x03386000, 0x07030000,
-+ 0x07f00000, 0x068d0598, 0x070ff087, 0x074850ff,
-+ 0x05818599, 0x07c00000, 0x068d059d, 0x02386001,
-+ 0x07030000, 0x07f00000, 0x068d05a1, 0x070ff087,
-+ 0x074850ff, 0x048185a2, 0x07c00000, 0x05002087,
-+ 0x0049d002, 0x048185b5, 0x002fb008, 0x067800e6,
-+ 0x07000041, 0x002fb008, 0x048185b5, 0x06a005cb,
-+ 0x0448e002, 0x078105b8, 0x0648a002, 0x048185c2,
-+ 0x06486002, 0x068105bc, 0x02400057, 0x056a02ff,
-+ 0x07c00000, 0x06a005cb, 0x06788102, 0x06000004,
-+ 0x048185b5, 0x04002089, 0x070ff0d4, 0x045c0402,
-+ 0x077800ff, 0x07f00000, 0x048185b5, 0x00202010,
-+ 0x028c05b5, 0x07f00000, 0x06420002, 0x058185c3,
-+ 0x06a0059d, 0x033e6a00, 0x0700000a, 0x07c00000,
- 0x07f00000, 0x060ff0a2, 0x050020ff, 0x060ff0a2,
-- 0x045c0402, 0x058185a5, 0x07c00000, 0x05a00218,
-- 0x03495047, 0x068105b0, 0x0320901d, 0x02800602,
-- 0x0220901f, 0x02800602, 0x014980e4, 0x04818010,
-+ 0x045c0402, 0x058185cc, 0x07c00000, 0x05a0021b,
-+ 0x03495047, 0x078105d7, 0x0320901d, 0x02800629,
-+ 0x0220901f, 0x02800629, 0x014980e4, 0x04818010,
- 0x013e4000, 0x07003000, 0x05600e35, 0x050f80ff,
-- 0x07a006fa, 0x01208003, 0x05a004e1, 0x038005ca,
-- 0x03209009, 0x02800602, 0x03209011, 0x02800602,
-- 0x02209007, 0x02800602, 0x03209003, 0x02800602,
-- 0x00498043, 0x048185bc, 0x00497043, 0x058185c0,
-- 0x02209001, 0x02800602, 0x0220900d, 0x02800602,
-- 0x0320900f, 0x02800602, 0x03493000, 0x068105d3,
-- 0x027c0045, 0x070a0000, 0x068105dc, 0x0220900b,
-- 0x02800602, 0x02209013, 0x05308000, 0x01012000,
-- 0x04a004dc, 0x00800183, 0x03209005, 0x02800602,
-- 0x072e500c, 0x00208002, 0x05a004e1, 0x02800010,
-- 0x02209015, 0x02800602, 0x072d6000, 0x05308000,
-+ 0x05a00721, 0x01208003, 0x04a004f7, 0x028005f1,
-+ 0x03209009, 0x02800629, 0x03209011, 0x02800629,
-+ 0x02209007, 0x02800629, 0x03209003, 0x02800629,
-+ 0x00498043, 0x048185e3, 0x00497043, 0x058185e7,
-+ 0x02209001, 0x02800629, 0x0220900d, 0x02800629,
-+ 0x0320900f, 0x02800629, 0x03493000, 0x078105fa,
-+ 0x027c0045, 0x070a0000, 0x07810603, 0x0220900b,
-+ 0x02800629, 0x02209013, 0x05308000, 0x01012000,
-+ 0x04a004f2, 0x00800183, 0x03209005, 0x02800629,
-+ 0x072e500c, 0x00208002, 0x04a004f7, 0x02800010,
-+ 0x02209015, 0x02800629, 0x072d6000, 0x05308000,
- 0x05007000, 0x07f00000, 0x070090d1, 0x0379ff09,
-- 0x0700ffff, 0x04a004dc, 0x03209017, 0x02800602,
-- 0x033e5000, 0x06000080, 0x02209019, 0x02800602,
-+ 0x0700ffff, 0x04a004f2, 0x03209017, 0x02800629,
-+ 0x033e5000, 0x06000080, 0x02209019, 0x02800629,
- 0x072d6000, 0x033e5000, 0x06000080, 0x07f00000,
- 0x060ff0d0, 0x0179feff, 0x0700ffff, 0x057dfeff,
- 0x0700ffff, 0x04818010, 0x02400058, 0x00642058,
- 0x06820010, 0x033e5000, 0x06000080, 0x04058051,
-- 0x0320901b, 0x02800602, 0x05308000, 0x01012000,
-- 0x04a004dc, 0x00800176, 0x05a00218, 0x05308000,
-- 0x05008000, 0x06009079, 0x04a004dc, 0x07c00000,
-- 0x034900e4, 0x04818616, 0x013e4000, 0x070000c0,
-- 0x07f00000, 0x034900e4, 0x05818614, 0x07c00000,
-+ 0x0320901b, 0x02800629, 0x05308000, 0x01012000,
-+ 0x04a004f2, 0x00800176, 0x05a0021b, 0x05308000,
-+ 0x05008000, 0x06009079, 0x04a004f2, 0x07c00000,
-+ 0x034900e4, 0x0481863d, 0x013e4000, 0x070000c0,
-+ 0x07f00000, 0x034900e4, 0x0481863b, 0x07c00000,
- 0x013e4000, 0x06000080, 0x07f00000, 0x07f00000,
-- 0x07f00000, 0x034900e4, 0x0681060e, 0x02800616,
-- 0x072d6000, 0x00498043, 0x07810630, 0x060ff0d0,
-+ 0x07f00000, 0x034900e4, 0x07810635, 0x0280063d,
-+ 0x072d6000, 0x00498043, 0x06810657, 0x060ff0d0,
- 0x0179feff, 0x0700ffff, 0x057dfeff, 0x0700ffff,
-- 0x048185e0, 0x050f8030, 0x032fa009, 0x0379ff00,
-+ 0x04818607, 0x050f8030, 0x032fa009, 0x0379ff00,
- 0x0700ffff, 0x070ff0d1, 0x0179feff, 0x0700ffff,
-- 0x055c0400, 0x068105e0, 0x04004051, 0x03800678,
-- 0x06a006da, 0x062d6001, 0x020ef004, 0x038605e2,
-+ 0x055c0400, 0x06810607, 0x04004051, 0x0380069f,
-+ 0x04a00701, 0x062d6001, 0x020ef004, 0x03860609,
- 0x06600004, 0x050f80ff, 0x032fa009, 0x074b0000,
-- 0x05002000, 0x0769ff00, 0x01640800, 0x078205e2,
-- 0x01640e00, 0x058285e2, 0x070ff036, 0x045c0404,
-- 0x0581864b, 0x072d6000, 0x050f8030, 0x032fa009,
-+ 0x05002000, 0x0769ff00, 0x01640800, 0x07820609,
-+ 0x01640e00, 0x05828609, 0x070ff036, 0x045c0404,
-+ 0x05818672, 0x072d6000, 0x050f8030, 0x032fa009,
- 0x0379ff00, 0x0700ffff, 0x070ff0d1, 0x0179feff,
-- 0x0700ffff, 0x055c0400, 0x068105e0, 0x04482034,
-- 0x068105fd, 0x06483034, 0x048185fd, 0x070ff0d4,
-+ 0x0700ffff, 0x055c0400, 0x06810607, 0x04482034,
-+ 0x07810624, 0x06483034, 0x05818624, 0x070ff0d4,
- 0x077800ff, 0x070000f0, 0x037c00ff, 0x06000010,
-- 0x07810678, 0x07a006d4, 0x024900e5, 0x0681065b,
-+ 0x0781069f, 0x06a006fb, 0x024900e5, 0x07810682,
- 0x033e5000, 0x06000080, 0x02800010, 0x04601c04,
- 0x050f80ff, 0x053fa809, 0x06000020, 0x030ef041,
-- 0x028605ec, 0x062d6002, 0x05602a41, 0x050f80ff,
-+ 0x02860613, 0x062d6002, 0x05602a41, 0x050f80ff,
- 0x012fa809, 0x060ff0d0, 0x074b00ff, 0x045c0401,
-- 0x04818676, 0x062d6001, 0x07602841, 0x050f80ff,
-+ 0x0481869d, 0x062d6001, 0x07602841, 0x050f80ff,
- 0x053fa809, 0x06000001, 0x070ff0d1, 0x054b80ff,
-- 0x074b0003, 0x055c0403, 0x04818676, 0x033e5000,
-- 0x06000080, 0x0180070c, 0x07600041, 0x0380065c,
-- 0x07a006d4, 0x024900e5, 0x0781067e, 0x033e5000,
-- 0x06000080, 0x02800010, 0x07a006c0, 0x030ef041,
-- 0x038605f0, 0x04058051, 0x072d6000, 0x05601041,
-+ 0x074b0003, 0x055c0403, 0x0481869d, 0x033e5000,
-+ 0x06000080, 0x01800733, 0x07600041, 0x02800683,
-+ 0x06a006fb, 0x024900e5, 0x078106a5, 0x033e5000,
-+ 0x06000080, 0x02800010, 0x07a006e7, 0x030ef041,
-+ 0x03860617, 0x04058051, 0x072d6000, 0x05601041,
- 0x050f80ff, 0x012fa809, 0x0600a0d0, 0x0500b0d1,
- 0x062d6001, 0x07f00000, 0x07f00000, 0x0600c0d0,
- 0x0500d0d1, 0x062d6002, 0x0279ff0d, 0x07ff0000,
-@@ -11981,28 +12207,28 @@ uint32_t risc_code02[] = {
- 0x06601201, 0x050f80ff, 0x073fa022, 0x07000005,
- 0x0079fe0d, 0x070000ff, 0x050020ff, 0x05602a41,
- 0x050f80ff, 0x073fa00a, 0x06000001, 0x020ef004,
-- 0x038606bd, 0x04601c04, 0x050f80ff, 0x053fa809,
-+ 0x038606e4, 0x04601c04, 0x050f80ff, 0x053fa809,
- 0x06000001, 0x050f80ff, 0x053fa80a, 0x06000020,
- 0x07602841, 0x050f80ff, 0x073fa009, 0x06000001,
- 0x0279ff02, 0x070000ff, 0x0678000d, 0x0700ff00,
- 0x065a0002, 0x07602841, 0x050f80ff, 0x073fa00a,
- 0x06000001, 0x07600041, 0x050f80ff, 0x053fa80a,
- 0x06000001, 0x07601241, 0x050f80ff, 0x073fa00a,
-- 0x06000002, 0x033e5000, 0x06000080, 0x0180070c,
-+ 0x06000002, 0x033e5000, 0x06000080, 0x01800733,
- 0x040f8032, 0x073fa011, 0x06000001, 0x060ff002,
-- 0x055c0403, 0x048186c8, 0x00041051, 0x07c00000,
-+ 0x055c0403, 0x048186ef, 0x00041051, 0x07c00000,
- 0x04600402, 0x04500432, 0x050f80ff, 0x053fa809,
- 0x06000020, 0x00400402, 0x01680eff, 0x070030ff,
- 0x040f8032, 0x053fa80a, 0x06000001, 0x07c00000,
-- 0x024900e5, 0x078106d7, 0x07c00000, 0x033e5000,
-+ 0x024900e5, 0x068106fe, 0x07c00000, 0x033e5000,
- 0x070000c0, 0x07c00000, 0x05004036, 0x060000d0,
- 0x0179fe00, 0x0700ffff, 0x057dfeff, 0x0700ffff,
-- 0x078106f9, 0x070000d1, 0x0379ff00, 0x0700ffff,
-+ 0x04810720, 0x070000d1, 0x0379ff00, 0x0700ffff,
- 0x06005051, 0x060ff031, 0x05500405, 0x050f80ff,
-- 0x073fa009, 0x06000002, 0x020ef004, 0x038606f3,
-+ 0x073fa009, 0x06000002, 0x020ef004, 0x0086071a,
- 0x04600404, 0x050f80ff, 0x012fa809, 0x0079fe01,
-- 0x0700ffff, 0x055c0400, 0x078106f9, 0x01400405,
-- 0x070050ff, 0x057de0ff, 0x06000007, 0x048186e5,
-+ 0x0700ffff, 0x055c0400, 0x04810720, 0x01400405,
-+ 0x070050ff, 0x057de0ff, 0x06000007, 0x0781870c,
- 0x04004051, 0x07c00000, 0x072d6000, 0x07f00000,
- 0x07f00000, 0x000110d0, 0x010120d1, 0x062d6001,
- 0x07f00000, 0x07f00000, 0x020130d0, 0x010140d1,
-@@ -12011,21 +12237,21 @@ uint32_t risc_code02[] = {
- 0x07600c41, 0x050f80ff, 0x073fa009, 0x06000001,
- 0x04780102, 0x07ffff00, 0x046a0702, 0x050f80ff,
- 0x073fa00a, 0x06000001, 0x05600e41, 0x050f80ff,
-- 0x032fa069, 0x03800053, 0xdb4ee9e2, 0x02800004,
-+ 0x032fa069, 0x03800053, 0xfa0228ad, 0x02800004,
- 0x00000000, 0x00008000, 0x00000542, 0x040f801f,
- 0x012fa8c9, 0x040f801f, 0x073fa081, 0x06000010,
- 0x03200005, 0x07420000, 0x050fb000, 0x040f801f,
- 0x073fa011, 0x06000038, 0x040f801f, 0x053fa859,
- 0x0700003a, 0x050fe000, 0x0581800a, 0x0784003c,
- 0x04958019, 0x030e0011, 0x072e4200, 0x03800014,
-- 0x0291001f, 0x050010c0, 0x04482001, 0x058180fa,
-- 0x06483001, 0x0681815d, 0x02920029, 0x068b0029,
-- 0x008a0162, 0x050010c0, 0x06780001, 0x050007c0,
-- 0x06818240, 0x06780001, 0x0500f800, 0x06818280,
-+ 0x0291001f, 0x050010c0, 0x04482001, 0x048180f8,
-+ 0x06483001, 0x0681815b, 0x02920029, 0x068b0029,
-+ 0x018a0160, 0x050010c0, 0x06780001, 0x050007c0,
-+ 0x0681823e, 0x06780001, 0x0500f800, 0x07818288,
- 0x03910030, 0x040fe029, 0x03860030, 0x076c001d,
-- 0x058102b1, 0x076c0a1d, 0x048102da, 0x029200ab,
-+ 0x0581029c, 0x076c0a1d, 0x058102c5, 0x029200ab,
- 0x040fe02f, 0x0386003c, 0x06000013, 0x050fb000,
-- 0x066c0073, 0x068103ec, 0x014920e4, 0x0581803c,
-+ 0x066c0073, 0x078103d7, 0x014920e4, 0x0581803c,
- 0x03400000, 0x076c0a00, 0x04818034, 0x0696003e,
- 0x03b900ca, 0x05908014, 0x010170e1, 0x07780017,
- 0x03e00000, 0x06810091, 0x050010ff, 0x0179fe17,
-@@ -12068,264 +12294,264 @@ uint32_t risc_code02[] = {
- 0x027a4b01, 0x03800000, 0x05600800, 0x050f80ff,
- 0x012fa80a, 0x07600c00, 0x050f80ff, 0x012fa821,
- 0x06780001, 0x07ffff00, 0x037c00ff, 0x05000700,
-- 0x068100ef, 0x06601804, 0x070030ff, 0x050f80ff,
-- 0x012fa809, 0x05002000, 0x050f8003, 0x073fa00a,
-- 0x06000001, 0x040fe001, 0x038600f0, 0x04600201,
-- 0x050f80ff, 0x032fa00a, 0x07c00000, 0x050fe02e,
-- 0x018680f5, 0x0102e000, 0x0302f000, 0x038000f9,
-- 0x0760002e, 0x050f80ff, 0x032fa00a, 0x0102e000,
-- 0x07c00000, 0x022c0004, 0x056c041d, 0x0481010e,
-- 0x056c021d, 0x04810125, 0x056c081d, 0x04810137,
-- 0x076c061d, 0x04810151, 0x0521d000, 0x0202c013,
-- 0x0202a013, 0x02020013, 0x0460021a, 0x050f80ff,
-- 0x053fa80a, 0x07000009, 0x03b600be, 0x0484801f,
-- 0x0380003c, 0x040fe02a, 0x00860104, 0x06000013,
-- 0x04001013, 0x0560102b, 0x050f80ff, 0x032fa012,
-- 0x06420029, 0x0660002a, 0x050f80ff, 0x053fa809,
-- 0x06000001, 0x050fe003, 0x01860122, 0x01028003,
-- 0x0660002a, 0x050f80ff, 0x053fa80a, 0x07000009,
-- 0x00800152, 0x00028013, 0x00027013, 0x00800152,
-- 0x040fe02a, 0x01860103, 0x06420029, 0x0660002a,
-+ 0x078100ed, 0x06601804, 0x070030ff, 0x050f80ff,
-+ 0x012fa809, 0x050f8003, 0x032fa00a, 0x040fe001,
-+ 0x038600ee, 0x04600201, 0x050f80ff, 0x032fa00a,
-+ 0x07c00000, 0x050fe02e, 0x018680f3, 0x0102e000,
-+ 0x0302f000, 0x028000f7, 0x0760002e, 0x050f80ff,
-+ 0x032fa00a, 0x0102e000, 0x07c00000, 0x022c0004,
-+ 0x056c041d, 0x0581010c, 0x056c021d, 0x04810123,
-+ 0x056c081d, 0x05810135, 0x076c061d, 0x0481014f,
-+ 0x0521d000, 0x0202c013, 0x0202a013, 0x02020013,
-+ 0x0460021a, 0x050f80ff, 0x053fa80a, 0x07000009,
-+ 0x03b600be, 0x0484801f, 0x0380003c, 0x040fe02a,
-+ 0x00860102, 0x06000013, 0x04001013, 0x0560102b,
-+ 0x050f80ff, 0x032fa012, 0x06420029, 0x0660002a,
- 0x050f80ff, 0x053fa809, 0x06000001, 0x050fe003,
-- 0x00860134, 0x03026003, 0x0660002a, 0x050f80ff,
-- 0x053fa80a, 0x07000009, 0x00800152, 0x02026013,
-- 0x02025013, 0x00800152, 0x040fe02a, 0x01860103,
-+ 0x00860120, 0x01028003, 0x0660002a, 0x050f80ff,
-+ 0x053fa80a, 0x07000009, 0x01800150, 0x00028013,
-+ 0x00027013, 0x01800150, 0x040fe02a, 0x00860101,
- 0x06420029, 0x0660002a, 0x050f80ff, 0x053fa809,
-- 0x06000001, 0x050fe003, 0x00860146, 0x01022003,
-+ 0x06000001, 0x050fe003, 0x00860132, 0x03026003,
- 0x0660002a, 0x050f80ff, 0x053fa80a, 0x07000009,
-- 0x01800148, 0x00022013, 0x00021013, 0x0647f020,
-- 0x007a0120, 0x04000101, 0x04a002a2, 0x0400802a,
-- 0x06a0051f, 0x03948103, 0x0521d005, 0x00800104,
-- 0x0180010c, 0x0647f020, 0x06486020, 0x06818157,
-- 0x04a002a2, 0x01800103, 0x007a0120, 0x04000101,
-- 0x04a002a2, 0x0400802a, 0x06a0051f, 0x01800103,
-- 0x040fd02a, 0x052e4003, 0x00208010, 0x06a0051f,
-- 0x0180010c, 0x00018098, 0x07480018, 0x06818173,
-- 0x05481018, 0x07818171, 0x05482018, 0x0781816f,
-- 0x07483018, 0x0681816d, 0x002fb004, 0x01800174,
-- 0x012fb003, 0x01800174, 0x002fb002, 0x01800174,
-- 0x002fb001, 0x01800174, 0x012fb000, 0x0179fe78,
-- 0x070000ff, 0x030190ff, 0x00017086, 0x058b0178,
-- 0x03385000, 0x03020000, 0x07780017, 0x00430407,
-- 0x07818200, 0x046c0419, 0x058101b4, 0x046c0219,
-- 0x05810184, 0x07219000, 0x00800198, 0x07219000,
-- 0x07483017, 0x0481019e, 0x05482017, 0x058101a5,
-- 0x0448b075, 0x06818198, 0x06601476, 0x050f80ff,
-- 0x073fa022, 0x0600003e, 0x06000080, 0x05001081,
-- 0x05002082, 0x06003083, 0x05004084, 0x04601c76,
-- 0x050f80ff, 0x022fa02a, 0x07219000, 0x07780078,
-- 0x07ffff00, 0x045a0419, 0x010780ff, 0x0484801f,
-- 0x0380003c, 0x040fe07f, 0x008601ad, 0x04a001cd,
-- 0x00920198, 0x040fe07f, 0x06a681cd, 0x00800198,
-- 0x0560107b, 0x050f80ff, 0x032fa009, 0x0744f000,
-- 0x0560107b, 0x050f80ff, 0x032fa00a, 0x0180018b,
-- 0x052e400c, 0x040080fb, 0x046aa108, 0x06009076,
-- 0x04002075, 0x06a00526, 0x00800198, 0x06219001,
-- 0x05482017, 0x048101c1, 0x058b01b7, 0x060ff086,
-- 0x0349f0ff, 0x07818177, 0x07483017, 0x058101be,
-- 0x050fd0ff, 0x040fe07f, 0x06a681cd, 0x00800198,
-- 0x05004084, 0x05a00222, 0x00920198, 0x070ff07d,
-- 0x0450047c, 0x056004ff, 0x050f80ff, 0x032fa009,
-- 0x070ff000, 0x00540479, 0x030790ff, 0x018001a5,
-- 0x060ff079, 0x0054047a, 0x058201f9, 0x058101f9,
-- 0x070ff07d, 0x0450047c, 0x050f80ff, 0x002fa819,
-- 0x048b01d5, 0x02080001, 0x00081002, 0x01082003,
-- 0x048b01d9, 0x03385000, 0x03010000, 0x02400019,
-- 0x070ff003, 0x04500479, 0x030790ff, 0x0340007e,
-- 0x0642007f, 0x058101f9, 0x070ff07e, 0x050f80ff,
-- 0x032fa009, 0x050fe000, 0x028681f8, 0x070ff07d,
-- 0x056002ff, 0x050f80ff, 0x032fa009, 0x0107d000,
-- 0x018601fa, 0x0560087d, 0x050f80ff, 0x032fa009,
-- 0x03681e00, 0x0550041b, 0x050f80ff, 0x032fa009,
-- 0x0107e000, 0x070ff07e, 0x018001e4, 0x0307c000,
-- 0x07c00000, 0x052e400c, 0x040080fb, 0x046aa108,
-- 0x06009076, 0x04002075, 0x02800526, 0x040fd076,
-- 0x050fd017, 0x060ff086, 0x077800ff, 0x07000060,
-- 0x037c00ff, 0x07000060, 0x06818202, 0x07780078,
-- 0x07ffff00, 0x045a0419, 0x010780ff, 0x06601476,
-- 0x050f80ff, 0x073fa022, 0x0600003e, 0x052e400c,
-- 0x04600876, 0x050f80ff, 0x053fa809, 0x06000001,
-- 0x05488003, 0x0481021c, 0x0400d0fb, 0x066a810d,
-- 0x013e4000, 0x07000300, 0x02800029, 0x040080fb,
-- 0x066a8108, 0x06009076, 0x04002075, 0x06a00526,
-- 0x02800029, 0x0240007f, 0x0742007e, 0x050f807e,
-- 0x032fa009, 0x050fe000, 0x0386823c, 0x070ff07d,
-- 0x055c047b, 0x04810231, 0x0760007d, 0x050f80ff,
-- 0x032fa009, 0x050fe000, 0x02868231, 0x070ff07b,
-- 0x0107d0ff, 0x0560087d, 0x050f80ff, 0x032fa009,
-- 0x03681e00, 0x0450041c, 0x0107e0ff, 0x050f80ff,
-- 0x032fa009, 0x050fe000, 0x0086023e, 0x0307c000,
-- 0x07c00000, 0x040fd076, 0x0380053a, 0x010180c0,
-- 0x0548e018, 0x07818259, 0x0748f018, 0x07818255,
-- 0x03490018, 0x06818251, 0x01491018, 0x0781824d,
-- 0x073c0000, 0x06000040, 0x02200004, 0x0180025c,
-- 0x073c0000, 0x06000020, 0x03200003, 0x0180025c,
-- 0x073c0000, 0x06000010, 0x02200002, 0x0180025c,
-- 0x073c0000, 0x06000008, 0x02200001, 0x0180025c,
-- 0x073c0000, 0x06000004, 0x06000013, 0x050fb000,
-- 0x040fe076, 0x00860275, 0x046c0273, 0x04810285,
-- 0x066c0073, 0x05810266, 0x040fd076, 0x07a0053a,
-- 0x03800014, 0x040fd076, 0x01800269, 0x00452075,
-- 0x00077013, 0x0647f075, 0x06486075, 0x0781826f,
-- 0x04a002a8, 0x00800275, 0x007a0175, 0x04000101,
-- 0x04a002a8, 0x04008076, 0x0245f008, 0x06a0051f,
-+ 0x01800150, 0x02026013, 0x02025013, 0x01800150,
-+ 0x040fe02a, 0x00860101, 0x06420029, 0x0660002a,
-+ 0x050f80ff, 0x053fa809, 0x06000001, 0x050fe003,
-+ 0x01860144, 0x01022003, 0x0660002a, 0x050f80ff,
-+ 0x053fa80a, 0x07000009, 0x00800146, 0x00022013,
-+ 0x00021013, 0x0647f020, 0x007a0120, 0x04000101,
-+ 0x05a0028d, 0x0400802a, 0x06a0051f, 0x02948101,
-+ 0x0521d005, 0x00800102, 0x0180010a, 0x0647f020,
-+ 0x06486020, 0x07818155, 0x05a0028d, 0x00800101,
-+ 0x007a0120, 0x04000101, 0x05a0028d, 0x0400802a,
-+ 0x06a0051f, 0x00800101, 0x040fd02a, 0x052e4003,
-+ 0x00208010, 0x06a0051f, 0x0180010a, 0x00018098,
-+ 0x07480018, 0x07818171, 0x05481018, 0x0781816f,
-+ 0x05482018, 0x0681816d, 0x07483018, 0x0681816b,
-+ 0x002fb004, 0x01800172, 0x012fb003, 0x01800172,
-+ 0x002fb002, 0x01800172, 0x002fb001, 0x01800172,
-+ 0x012fb000, 0x0179fe78, 0x070000ff, 0x030190ff,
-+ 0x00017086, 0x048b0176, 0x03385000, 0x03020000,
-+ 0x07780017, 0x00430407, 0x068181fe, 0x046c0419,
-+ 0x058101b2, 0x046c0219, 0x05810182, 0x07219000,
-+ 0x01800196, 0x07219000, 0x07483017, 0x0581019c,
-+ 0x05482017, 0x058101a3, 0x0448b075, 0x07818196,
-+ 0x06601476, 0x050f80ff, 0x073fa022, 0x0600003e,
-+ 0x06000080, 0x05001081, 0x05002082, 0x06003083,
-+ 0x05004084, 0x04601c76, 0x050f80ff, 0x022fa02a,
-+ 0x07219000, 0x07780078, 0x07ffff00, 0x045a0419,
-+ 0x010780ff, 0x0484801f, 0x0380003c, 0x040fe07f,
-+ 0x008601ab, 0x04a001cb, 0x01920196, 0x040fe07f,
-+ 0x06a681cb, 0x01800196, 0x0560107b, 0x050f80ff,
-+ 0x032fa009, 0x0744f000, 0x0560107b, 0x050f80ff,
-+ 0x032fa00a, 0x00800189, 0x052e400c, 0x040080fb,
-+ 0x046aa108, 0x06009076, 0x04002075, 0x06a00526,
-+ 0x01800196, 0x06219001, 0x05482017, 0x048101bf,
-+ 0x048b01b5, 0x060ff086, 0x0349f0ff, 0x06818175,
-+ 0x07483017, 0x048101bc, 0x050fd0ff, 0x040fe07f,
-+ 0x06a681cb, 0x01800196, 0x05004084, 0x04a00220,
-+ 0x01920196, 0x070ff07d, 0x0450047c, 0x056004ff,
-+ 0x050f80ff, 0x032fa009, 0x070ff000, 0x00540479,
-+ 0x030790ff, 0x018001a3, 0x060ff079, 0x0054047a,
-+ 0x048201f7, 0x048101f7, 0x070ff07d, 0x0450047c,
-+ 0x050f80ff, 0x002fa819, 0x048b01d3, 0x02080001,
-+ 0x00081002, 0x01082003, 0x058b01d7, 0x03385000,
-+ 0x03010000, 0x02400019, 0x070ff003, 0x04500479,
-+ 0x030790ff, 0x0340007e, 0x0642007f, 0x048101f7,
-+ 0x070ff07e, 0x050f80ff, 0x032fa009, 0x050fe000,
-+ 0x038681f6, 0x070ff07d, 0x056002ff, 0x050f80ff,
-+ 0x032fa009, 0x0107d000, 0x008601f8, 0x0560087d,
-+ 0x050f80ff, 0x032fa009, 0x03681e00, 0x0550041b,
-+ 0x050f80ff, 0x032fa009, 0x0107e000, 0x070ff07e,
-+ 0x018001e2, 0x0307c000, 0x07c00000, 0x052e400c,
-+ 0x040080fb, 0x046aa108, 0x06009076, 0x04002075,
-+ 0x02800526, 0x040fd076, 0x050fd017, 0x060ff086,
-+ 0x077800ff, 0x07000060, 0x037c00ff, 0x07000060,
-+ 0x07818200, 0x07780078, 0x07ffff00, 0x045a0419,
-+ 0x010780ff, 0x06601476, 0x050f80ff, 0x073fa022,
-+ 0x0600003e, 0x052e400c, 0x04600876, 0x050f80ff,
-+ 0x053fa809, 0x06000001, 0x05488003, 0x0481021a,
-+ 0x0400d0fb, 0x066a810d, 0x013e4000, 0x07000300,
-+ 0x02800029, 0x040080fb, 0x066a8108, 0x06009076,
-+ 0x04002075, 0x06a00526, 0x02800029, 0x0240007f,
-+ 0x0742007e, 0x050f807e, 0x032fa009, 0x050fe000,
-+ 0x0386823a, 0x070ff07d, 0x055c047b, 0x0481022f,
-+ 0x0760007d, 0x050f80ff, 0x032fa009, 0x050fe000,
-+ 0x0286822f, 0x070ff07b, 0x0107d0ff, 0x0560087d,
-+ 0x050f80ff, 0x032fa009, 0x03681e00, 0x0450041c,
-+ 0x0107e0ff, 0x050f80ff, 0x032fa009, 0x050fe000,
-+ 0x0186023c, 0x0307c000, 0x07c00000, 0x040fd076,
-+ 0x0380053a, 0x010180c0, 0x0548e018, 0x06818257,
-+ 0x0748f018, 0x07818253, 0x03490018, 0x0681824f,
-+ 0x01491018, 0x0781824b, 0x073c0000, 0x06000040,
-+ 0x02200004, 0x0180025a, 0x073c0000, 0x06000020,
-+ 0x03200003, 0x0180025a, 0x073c0000, 0x06000010,
-+ 0x02200002, 0x0180025a, 0x073c0000, 0x06000008,
-+ 0x02200001, 0x0180025a, 0x073c0000, 0x06000004,
-+ 0x06000013, 0x050fb000, 0x040fe076, 0x0186027d,
-+ 0x046c0273, 0x07818269, 0x0448b075, 0x04810270,
-+ 0x06000013, 0x04001013, 0x0560107b, 0x050f80ff,
-+ 0x032fa012, 0x0046b075, 0x03b600be, 0x01800271,
-+ 0x066c0073, 0x0481026e, 0x040fd076, 0x07a0053a,
-+ 0x03800014, 0x040fd076, 0x01800271, 0x00452075,
-+ 0x00077013, 0x0647f075, 0x06486075, 0x07818277,
-+ 0x05a00293, 0x0180027d, 0x007a0175, 0x04000101,
-+ 0x05a00293, 0x04008076, 0x0245f008, 0x06a0051f,
- 0x07273000, 0x05600272, 0x050f80ff, 0x053fa80a,
- 0x07000009, 0x0379ff78, 0x070000ff, 0x02076013,
- 0x02075013, 0x0484801f, 0x0380003c, 0x070fc0ff,
-- 0x052e400c, 0x00208020, 0x06a0051f, 0x0180027e,
-- 0x04600276, 0x050010ff, 0x040f8001, 0x032fa009,
-- 0x040f8001, 0x053fa80a, 0x07000009, 0x070ff000,
-- 0x02868297, 0x06601276, 0x050f80ff, 0x073fa009,
-- 0x0700000c, 0x07601818, 0x050f80ff, 0x053fa80a,
-- 0x07000009, 0x00800298, 0x07a000f0, 0x0448b075,
-- 0x04810268, 0x06000013, 0x04001013, 0x0560107b,
-- 0x050f80ff, 0x032fa012, 0x0046b075, 0x03b600be,
-- 0x01800269, 0x06000020, 0x04001016, 0x0460082a,
-- 0x050f80ff, 0x032fa012, 0x07c00000, 0x06000075,
-- 0x040010a2, 0x044b0801, 0x060ff016, 0x065a0001,
-- 0x04600876, 0x050f80ff, 0x032fa012, 0x07c00000,
-- 0x050fe022, 0x008602bc, 0x0421d004, 0x0302a022,
-- 0x04a002e9, 0x04488020, 0x048102ce, 0x040fd02a,
-- 0x0521d000, 0x0202a013, 0x02020013, 0x040fe026,
-- 0x018602d4, 0x0421d001, 0x0202a026, 0x04a002e9,
-- 0x0202c013, 0x00683e20, 0x070060ff, 0x056c0206,
-- 0x0681031c, 0x056c0406, 0x06810332, 0x076c0606,
-- 0x078103a3, 0x04488020, 0x068182d0, 0x056c1606,
-- 0x078103b1, 0x06a00516, 0x018002e2, 0x040fd02a,
-- 0x0521d000, 0x0202a013, 0x02020013, 0x050fe028,
-- 0x018602e2, 0x0302a028, 0x0421d002, 0x04a002e9,
-- 0x018002f0, 0x050fe022, 0x018602e2, 0x0421d004,
-- 0x0302a022, 0x04a002e9, 0x04488020, 0x078182e4,
-- 0x06a00516, 0x05848030, 0x0380003c, 0x040fd02a,
-- 0x0521d000, 0x0202a013, 0x02020013, 0x018002e2,
-- 0x0460082a, 0x050f80ff, 0x022fa031, 0x03020000,
-- 0x0002b004, 0x01018005, 0x07c00000, 0x0400702a,
-- 0x07a003e4, 0x007a0101, 0x07060000, 0x07303000,
-- 0x07008290, 0x07600018, 0x050f80ff, 0x053fa809,
-- 0x07000003, 0x0448e007, 0x068182fe, 0x06006013,
-- 0x03800305, 0x02400010, 0x048102fe, 0x06006010,
-- 0x0460322a, 0x050f80ff, 0x073fa00a, 0x07000003,
-- 0x050f801e, 0x032fa03a, 0x063aa020, 0x06000002,
-- 0x013e4000, 0x07000030, 0x0298030b, 0x070ff0f6,
-- 0x036830ff, 0x0581830c, 0x070f001e, 0x0560102b,
-- 0x050f10ff, 0x063f3c08, 0x0600000d, 0x013e4000,
-- 0x06000020, 0x040f801a, 0x0320000a, 0x022017d0,
-- 0x032fa012, 0x0202c013, 0x018002e2, 0x04007013,
-- 0x07a003e4, 0x007a0101, 0x07050000, 0x07303000,
-- 0x07008890, 0x074d0005, 0x06006013, 0x050f801e,
-- 0x032fa03a, 0x05601a2b, 0x050f80ff, 0x022fa019,
-- 0x04001002, 0x04002013, 0x040f801f, 0x022fa01a,
-- 0x073aa00c, 0x06000002, 0x07300c03, 0x0600000d,
-- 0x038003d1, 0x04007013, 0x07a003e4, 0x007a0101,
-- 0x03070000, 0x0660282a, 0x050f80ff, 0x073fa009,
-- 0x06000004, 0x02499008, 0x0781033f, 0x07303000,
-- 0x07008890, 0x03800341, 0x07303000, 0x04008980,
-- 0x05007003, 0x074d0005, 0x06006013, 0x050f801e,
-- 0x032fa03a, 0x0760142b, 0x050f80ff, 0x032fa021,
-- 0x064b0002, 0x02499008, 0x0781034d, 0x0644c002,
-- 0x054b0400, 0x050040ff, 0x06698104, 0x04818362,
-- 0x06000013, 0x04001013, 0x04780102, 0x06000010,
-- 0x06003013, 0x04004013, 0x06005013, 0x06006013,
-- 0x04007013, 0x00644015, 0x0682035e, 0x04448002,
-- 0x02205008, 0x040f801f, 0x032fa042, 0x04008015,
-- 0x0280039b, 0x046c8004, 0x04818370, 0x01208018,
-- 0x06780002, 0x07000003, 0x04818373, 0x06003001,
-- 0x06000013, 0x04001013, 0x04004013, 0x06005013,
-- 0x040f801f, 0x022fa032, 0x0280039b, 0x040fd02a,
-- 0x07a0053a, 0x03800014, 0x0379ff03, 0x070000ff,
-- 0x04488002, 0x0681037a, 0x070ff003, 0x04500408,
-- 0x050080ff, 0x0379ff00, 0x070000ff, 0x06489002,
-- 0x07810381, 0x070ff000, 0x04500408, 0x050080ff,
-- 0x07005003, 0x05004000, 0x06003001, 0x06000013,
-- 0x04001013, 0x040f801f, 0x022fa032, 0x05601c2b,
-- 0x050f80ff, 0x022fa031, 0x06600c1f, 0x050f80ff,
-- 0x022fa032, 0x02680608, 0x0681039b, 0x016408ff,
-- 0x057dfeff, 0x07ffffff, 0x034000ff, 0x045a0407,
-- 0x070000ff, 0x0760061e, 0x050f80ff, 0x032fa00a,
-- 0x06600908, 0x0669f908, 0x027a0008, 0x06000020,
-- 0x070aa0ff, 0x014a20ff, 0x037a00ff, 0x060000dc,
-- 0x070000ff, 0x038003d1, 0x04007013, 0x07a003e4,
-- 0x007a0101, 0x07030000, 0x07303000, 0x07008190,
-- 0x06006013, 0x050f801e, 0x032fa03a, 0x073aa000,
-- 0x06000002, 0x07300c00, 0x07000005, 0x038003d1,
-- 0x04007013, 0x07a003e4, 0x007a0101, 0x07810000,
-- 0x07303000, 0x07000090, 0x06006013, 0x06600c2a,
-- 0x050f80ff, 0x053fa809, 0x07000003, 0x04780107,
-- 0x07ffff00, 0x007c0107, 0x07000500, 0x048183c4,
-- 0x07303000, 0x05000890, 0x074d0005, 0x0660282a,
-- 0x050f80ff, 0x053fa809, 0x07000003, 0x0049d007,
-- 0x068103cb, 0x02206001, 0x050f801e, 0x032fa03a,
-- 0x073aa000, 0x06000002, 0x07300c00, 0x07000005,
-- 0x013e4000, 0x07000030, 0x029803d3, 0x070ff0f6,
-- 0x036830ff, 0x058183d4, 0x070f001e, 0x040f101f,
-- 0x070f3000, 0x013e4000, 0x06000020, 0x040f801a,
-- 0x0320000a, 0x022017d0, 0x032fa012, 0x018002e2,
-- 0x03200000, 0x06006076, 0x028003e6, 0x03200011,
-- 0x0600602a, 0x04a0046b, 0x05600406, 0x050f80ff,
-- 0x053fa809, 0x06000002, 0x07c00000, 0x0207602f,
-- 0x04600876, 0x050f80ff, 0x022fa031, 0x03075000,
-- 0x0007b004, 0x01018005, 0x06600076, 0x050020ff,
-- 0x050f80ff, 0x012fa809, 0x0202f001, 0x018683fa,
-- 0x0002e013, 0x040f8002, 0x053fa80a, 0x07000009,
-- 0x06273001, 0x0448b075, 0x06818404, 0x04602076,
-- 0x050f80ff, 0x053fa811, 0x0700003c, 0x0179fe78,
-- 0x070000ff, 0x030190ff, 0x0386840c, 0x04a00420,
-- 0x00078019, 0x0092041f, 0x00800464, 0x040fd076,
-- 0x040fd019, 0x04600276, 0x050020ff, 0x050f80ff,
-- 0x032fa009, 0x040f8002, 0x053fa80a, 0x07000009,
-- 0x050fe000, 0x0286841c, 0x07601818, 0x050f80ff,
-- 0x053fa80a, 0x07000009, 0x0180041d, 0x07a000f0,
-- 0x07273000, 0x02076013, 0x0380003c, 0x048b0420,
-- 0x03385000, 0x07030000, 0x05600818, 0x050f80ff,
-- 0x032fa009, 0x054b0400, 0x0308a0ff, 0x0179fe00,
-- 0x070000ff, 0x010880ff, 0x0448b075, 0x0581043a,
-- 0x0760147b, 0x050f80ff, 0x002fa819, 0x064b0001,
-- 0x02080002, 0x01081003, 0x00082001, 0x02083001,
-- 0x02079001, 0x0207a001, 0x00084013, 0x0207f013,
-- 0x0180045c, 0x06485075, 0x04810452, 0x02465075,
-- 0x06601476, 0x050f80ff, 0x073fa021, 0x0600003e,
-- 0x070ff07d, 0x0450047c, 0x050f80ff, 0x002fa819,
-- 0x048b0445, 0x02080001, 0x00081002, 0x01082003,
-- 0x03079003, 0x0208307a, 0x0340007e, 0x0642007f,
-- 0x04810457, 0x070ff07e, 0x05a001e4, 0x02928457,
-- 0x01800463, 0x048b0452, 0x06601476, 0x050f80ff,
-- 0x073fa041, 0x0600003e, 0x06602476, 0x050f80ff,
-- 0x073fa009, 0x06000007, 0x0008400e, 0x058b045c,
-- 0x03385000, 0x03010000, 0x06219001, 0x040fe07f,
-- 0x01860463, 0x008001cd, 0x07c00000, 0x00683e75,
-- 0x05810469, 0x0448d075, 0x0481048f, 0x018004bd,
-- 0x06a0051a, 0x0080041f, 0x02978476, 0x07602418,
-- 0x050f80ff, 0x012fa809, 0x06780001, 0x070000ff,
-- 0x075a0000, 0x070ff014, 0x0569feff, 0x054b08ff,
-- 0x075a0000, 0x05600418, 0x050f80ff, 0x012fa809,
-- 0x040fe007, 0x0386847d, 0x01204000, 0x0180048b,
-- 0x00700101, 0x03010000, 0x06780001, 0x07ff0000,
-- 0x076c00ff, 0x06818485, 0x00700101, 0x03010000,
-- 0x05600418, 0x050f80ff, 0x012fa80a, 0x06780001,
-- 0x07ff0000, 0x050040ff, 0x0279ff01, 0x0700ffff,
-- 0x05002014, 0x07c00000, 0x04007076, 0x0448b075,
-- 0x058104a9, 0x03200011, 0x06006076, 0x06a003e6,
-+ 0x052e400c, 0x00208020, 0x06a0051f, 0x00800286,
-+ 0x06000020, 0x04001016, 0x0460082a, 0x050f80ff,
-+ 0x032fa012, 0x07c00000, 0x06000075, 0x040010a2,
-+ 0x044b0801, 0x060ff016, 0x065a0001, 0x04600876,
-+ 0x050f80ff, 0x032fa012, 0x07c00000, 0x050fe022,
-+ 0x008602a7, 0x0421d004, 0x0302a022, 0x05a002d4,
-+ 0x04488020, 0x048102b9, 0x040fd02a, 0x0521d000,
-+ 0x0202a013, 0x02020013, 0x040fe026, 0x008602bf,
-+ 0x0421d001, 0x0202a026, 0x05a002d4, 0x0202c013,
-+ 0x00683e20, 0x070060ff, 0x056c0206, 0x06810307,
-+ 0x056c0406, 0x0781031d, 0x076c0606, 0x0781038e,
-+ 0x04488020, 0x078182bb, 0x056c1606, 0x0781039c,
-+ 0x06a00516, 0x008002cd, 0x040fd02a, 0x0521d000,
-+ 0x0202a013, 0x02020013, 0x050fe028, 0x008602cd,
-+ 0x0302a028, 0x0421d002, 0x05a002d4, 0x018002db,
-+ 0x050fe022, 0x008602cd, 0x0421d004, 0x0302a022,
-+ 0x05a002d4, 0x04488020, 0x078182cf, 0x06a00516,
-+ 0x05848030, 0x0380003c, 0x040fd02a, 0x0521d000,
-+ 0x0202a013, 0x02020013, 0x008002cd, 0x0460082a,
-+ 0x050f80ff, 0x022fa031, 0x03020000, 0x0002b004,
-+ 0x01018005, 0x07c00000, 0x0400702a, 0x07a003cf,
- 0x007a0101, 0x07060000, 0x07303000, 0x07008290,
- 0x07600018, 0x050f80ff, 0x053fa809, 0x07000003,
-- 0x0448e007, 0x068184a1, 0x06006013, 0x018004b8,
-- 0x02400010, 0x048104a1, 0x06006010, 0x04603276,
-- 0x050f80ff, 0x073fa00a, 0x07000003, 0x018004b8,
-- 0x04602a76, 0x050f80ff, 0x032fa009, 0x060ff07a,
-- 0x05500400, 0x070000ff, 0x04602a76, 0x050f80ff,
-- 0x032fa00a, 0x07a003e1, 0x007a0101, 0x03010000,
-- 0x06303008, 0x05008000, 0x0600600e, 0x050f8074,
-- 0x032fa03a, 0x053079a0, 0x0700000c, 0x008004fd,
-- 0x00683e75, 0x076c0aff, 0x048104dc, 0x04007013,
-- 0x03200011, 0x06006076, 0x06a003e6, 0x007a0101,
-- 0x03070000, 0x06602876, 0x050f80ff, 0x053fa809,
-- 0x06000001, 0x03499003, 0x058104d1, 0x07303000,
-- 0x07008890, 0x053079a0, 0x0700000c, 0x008004d5,
-- 0x07303000, 0x04008980, 0x04307920, 0x0700000c,
-- 0x074d0005, 0x06006013, 0x050f8074, 0x032fa03a,
-- 0x04307920, 0x0700000c, 0x008004fd, 0x04602a76,
-- 0x050f80ff, 0x032fa009, 0x060ff07a, 0x05500400,
-- 0x070000ff, 0x04602a76, 0x050f80ff, 0x032fa00a,
-- 0x04007076, 0x07a003e1, 0x007a0101, 0x03010000,
-+ 0x0448e007, 0x068182e9, 0x06006013, 0x018002f0,
-+ 0x02400010, 0x048102e9, 0x06006010, 0x0460322a,
-+ 0x050f80ff, 0x073fa00a, 0x07000003, 0x050f801e,
-+ 0x032fa03a, 0x063aa020, 0x06000002, 0x013e4000,
-+ 0x07000030, 0x019802f6, 0x070ff0f6, 0x036830ff,
-+ 0x068182f7, 0x070f001e, 0x0560102b, 0x050f10ff,
-+ 0x063f3c08, 0x0600000d, 0x013e4000, 0x06000020,
-+ 0x040f801a, 0x0320000a, 0x022017d0, 0x032fa012,
-+ 0x0202c013, 0x008002cd, 0x04007013, 0x07a003cf,
-+ 0x007a0101, 0x07050000, 0x07303000, 0x07008890,
-+ 0x074d0005, 0x06006013, 0x050f801e, 0x032fa03a,
-+ 0x05601a2b, 0x050f80ff, 0x022fa019, 0x04001002,
-+ 0x04002013, 0x040f801f, 0x022fa01a, 0x073aa00c,
-+ 0x06000002, 0x07300c03, 0x0600000d, 0x028003bc,
-+ 0x04007013, 0x07a003cf, 0x007a0101, 0x03070000,
-+ 0x0660282a, 0x050f80ff, 0x073fa009, 0x06000004,
-+ 0x02499008, 0x0681032a, 0x07303000, 0x07008890,
-+ 0x0280032c, 0x07303000, 0x04008980, 0x05007003,
-+ 0x074d0005, 0x06006013, 0x050f801e, 0x032fa03a,
-+ 0x0760142b, 0x050f80ff, 0x032fa021, 0x064b0002,
-+ 0x02499008, 0x06810338, 0x0644c002, 0x054b0400,
-+ 0x050040ff, 0x06698104, 0x0581834d, 0x06000013,
-+ 0x04001013, 0x04780102, 0x06000010, 0x06003013,
-+ 0x04004013, 0x06005013, 0x06006013, 0x04007013,
-+ 0x00644015, 0x06820349, 0x04448002, 0x02205008,
-+ 0x040f801f, 0x032fa042, 0x04008015, 0x02800386,
-+ 0x046c8004, 0x0481835b, 0x01208018, 0x06780002,
-+ 0x07000003, 0x0481835e, 0x06003001, 0x06000013,
-+ 0x04001013, 0x04004013, 0x06005013, 0x040f801f,
-+ 0x022fa032, 0x02800386, 0x040fd02a, 0x07a0053a,
-+ 0x03800014, 0x0379ff03, 0x070000ff, 0x04488002,
-+ 0x07810365, 0x070ff003, 0x04500408, 0x050080ff,
-+ 0x0379ff00, 0x070000ff, 0x06489002, 0x0781036c,
-+ 0x070ff000, 0x04500408, 0x050080ff, 0x07005003,
-+ 0x05004000, 0x06003001, 0x06000013, 0x04001013,
-+ 0x040f801f, 0x022fa032, 0x05601c2b, 0x050f80ff,
-+ 0x022fa031, 0x06600c1f, 0x050f80ff, 0x022fa032,
-+ 0x02680608, 0x06810386, 0x016408ff, 0x057dfeff,
-+ 0x07ffffff, 0x034000ff, 0x045a0407, 0x070000ff,
-+ 0x0760061e, 0x050f80ff, 0x032fa00a, 0x06600908,
-+ 0x0669f908, 0x027a0008, 0x06000020, 0x070aa0ff,
-+ 0x024a2408, 0x037a00ff, 0x060000dc, 0x070000ff,
-+ 0x028003bc, 0x04007013, 0x07a003cf, 0x007a0101,
-+ 0x07030000, 0x07303000, 0x07008190, 0x06006013,
-+ 0x050f801e, 0x032fa03a, 0x073aa000, 0x06000002,
-+ 0x07300c00, 0x07000005, 0x028003bc, 0x04007013,
-+ 0x07a003cf, 0x007a0101, 0x07810000, 0x07303000,
-+ 0x07000090, 0x06006013, 0x06600c2a, 0x050f80ff,
-+ 0x053fa809, 0x07000003, 0x04780107, 0x07ffff00,
-+ 0x007c0107, 0x07000500, 0x058183af, 0x07303000,
-+ 0x05000890, 0x074d0005, 0x0660282a, 0x050f80ff,
-+ 0x053fa809, 0x07000003, 0x0049d007, 0x068103b6,
-+ 0x02206001, 0x050f801e, 0x032fa03a, 0x073aa000,
-+ 0x06000002, 0x07300c00, 0x07000005, 0x013e4000,
-+ 0x07000030, 0x039803be, 0x070ff0f6, 0x036830ff,
-+ 0x048183bf, 0x070f001e, 0x040f101f, 0x070f3000,
-+ 0x013e4000, 0x06000020, 0x040f801a, 0x0320000a,
-+ 0x022017d0, 0x032fa012, 0x008002cd, 0x03200000,
-+ 0x06006076, 0x038003d1, 0x03200011, 0x0600602a,
-+ 0x05a00466, 0x05600406, 0x050f80ff, 0x053fa809,
-+ 0x06000002, 0x07c00000, 0x0207602f, 0x04600876,
-+ 0x050f80ff, 0x022fa031, 0x03075000, 0x0007b004,
-+ 0x01018005, 0x06600076, 0x050020ff, 0x050f80ff,
-+ 0x032fa011, 0x0302f000, 0x018683ee, 0x0202f001,
-+ 0x008683ec, 0x0002e013, 0x07601818, 0x050f80ff,
-+ 0x053fa80a, 0x07000009, 0x028003f4, 0x0002e001,
-+ 0x028003f4, 0x040fe001, 0x038603e7, 0x0760002e,
-+ 0x050f80ff, 0x012fa80a, 0x0002e001, 0x06000013,
-+ 0x04001013, 0x040f8002, 0x032fa012, 0x06273001,
-+ 0x0448b075, 0x058183ff, 0x04602076, 0x050f80ff,
-+ 0x053fa811, 0x0700003c, 0x0179fe78, 0x070000ff,
-+ 0x030190ff, 0x02868407, 0x05a0041b, 0x00078019,
-+ 0x0092041a, 0x0180045f, 0x040fd076, 0x040fd019,
-+ 0x04600276, 0x050020ff, 0x050f80ff, 0x032fa009,
-+ 0x040f8002, 0x053fa80a, 0x07000009, 0x050fe000,
-+ 0x03868417, 0x07601818, 0x050f80ff, 0x053fa80a,
-+ 0x07000009, 0x01800418, 0x07a000ee, 0x07273000,
-+ 0x02076013, 0x0380003c, 0x058b041b, 0x03385000,
-+ 0x07030000, 0x05600818, 0x050f80ff, 0x032fa009,
-+ 0x054b0400, 0x0308a0ff, 0x0179fe00, 0x070000ff,
-+ 0x010880ff, 0x0448b075, 0x05810435, 0x0760147b,
-+ 0x050f80ff, 0x002fa819, 0x064b0001, 0x02080002,
-+ 0x01081003, 0x00082001, 0x02083001, 0x02079001,
-+ 0x0207a001, 0x00084013, 0x0207f013, 0x00800457,
-+ 0x06485075, 0x0581044d, 0x02465075, 0x06601476,
-+ 0x050f80ff, 0x073fa021, 0x0600003e, 0x070ff07d,
-+ 0x0450047c, 0x050f80ff, 0x002fa819, 0x048b0440,
-+ 0x02080001, 0x00081002, 0x01082003, 0x03079003,
-+ 0x0208307a, 0x0340007e, 0x0642007f, 0x04810452,
-+ 0x070ff07e, 0x05a001e2, 0x02928452, 0x0080045e,
-+ 0x058b044d, 0x06601476, 0x050f80ff, 0x073fa041,
-+ 0x0600003e, 0x06602476, 0x050f80ff, 0x073fa009,
-+ 0x06000007, 0x0008400e, 0x048b0457, 0x03385000,
-+ 0x03010000, 0x06219001, 0x040fe07f, 0x0086045e,
-+ 0x008001cb, 0x07c00000, 0x00683e75, 0x04810464,
-+ 0x0448d075, 0x0481048a, 0x008004bc, 0x06a0051a,
-+ 0x0080041a, 0x03978471, 0x07602418, 0x050f80ff,
-+ 0x012fa809, 0x06780001, 0x070000ff, 0x075a0000,
-+ 0x070ff014, 0x0569feff, 0x054b08ff, 0x075a0000,
-+ 0x05600418, 0x050f80ff, 0x012fa809, 0x040fe007,
-+ 0x03868478, 0x01204000, 0x00800486, 0x00700101,
-+ 0x03010000, 0x06780001, 0x07ff0000, 0x076c00ff,
-+ 0x06818480, 0x00700101, 0x03010000, 0x05600418,
-+ 0x050f80ff, 0x012fa80a, 0x06780001, 0x07ff0000,
-+ 0x050040ff, 0x0279ff01, 0x0700ffff, 0x05002014,
-+ 0x07c00000, 0x04007076, 0x0448b075, 0x048104a4,
-+ 0x03200011, 0x06006076, 0x07a003d1, 0x007a0101,
-+ 0x07060000, 0x07303000, 0x07008290, 0x07600018,
-+ 0x050f80ff, 0x053fa809, 0x07000003, 0x0448e007,
-+ 0x0781849c, 0x06006013, 0x018004b7, 0x02400010,
-+ 0x0581049c, 0x06006010, 0x04603276, 0x050f80ff,
-+ 0x073fa00a, 0x07000003, 0x018004b7, 0x0600007a,
-+ 0x02493075, 0x068184ad, 0x04602a76, 0x050f80ff,
-+ 0x032fa009, 0x060ff07a, 0x05500400, 0x070000ff,
-+ 0x06473075, 0x04602a76, 0x050f80ff, 0x032fa00a,
-+ 0x07a003cc, 0x007a0101, 0x03010000, 0x06303008,
-+ 0x05008000, 0x0600600e, 0x050f8074, 0x032fa03a,
-+ 0x053079a0, 0x0700000c, 0x008004fd, 0x00683e75,
-+ 0x076c0aff, 0x058104db, 0x04007013, 0x03200011,
-+ 0x06006076, 0x07a003d1, 0x007a0101, 0x03070000,
-+ 0x06602876, 0x050f80ff, 0x053fa809, 0x06000001,
-+ 0x03499003, 0x048104d0, 0x07303000, 0x07008890,
-+ 0x053079a0, 0x0700000c, 0x018004d4, 0x07303000,
-+ 0x04008980, 0x04307920, 0x0700000c, 0x074d0005,
-+ 0x06006013, 0x050f8074, 0x032fa03a, 0x04307920,
-+ 0x0700000c, 0x008004fd, 0x04602a76, 0x050f80ff,
-+ 0x032fa009, 0x060ff07a, 0x05500400, 0x070000ff,
-+ 0x06473075, 0x04602a76, 0x050f80ff, 0x032fa00a,
-+ 0x04007076, 0x07a003cc, 0x007a0101, 0x03010000,
- 0x06303008, 0x07008800, 0x074d0005, 0x06600a76,
- 0x050f80ff, 0x073fa009, 0x07000003, 0x054b0406,
- 0x045a0404, 0x050040ff, 0x0600600e, 0x050f8074,
-@@ -12337,7 +12563,7 @@ uint32_t risc_code02[] = {
- 0x06000020, 0x0678007a, 0x07fff000, 0x04818510,
- 0x0320000a, 0x022017d0, 0x02800513, 0x0320000a,
- 0x06301b58, 0x06000001, 0x050f8072, 0x032fa012,
-- 0x0080041f, 0x01208060, 0x0600902a, 0x04002020,
-+ 0x0080041a, 0x01208060, 0x0600902a, 0x04002020,
- 0x02800526, 0x040080fb, 0x066ae108, 0x06009076,
- 0x04002075, 0x02800526, 0x03201100, 0x05848524,
- 0x06420001, 0x04818520, 0x0280053d, 0x020e0008,
-@@ -12348,12 +12574,12 @@ uint32_t risc_code02[] = {
- 0x030e0009, 0x07c00000, 0x01011009, 0x052e4300,
- 0x07c00000, 0x052e400f, 0x01208090, 0x0280051f,
- 0x070fc0ff, 0x040f8013, 0x032fa009, 0x02800540,
-- 0x6321d92e, 0xffef19a2
-+ 0x777821fa, 0xffeeffd6
- };
-
- #ifdef UNIQUE_FW_NAME
--uint32_t fw2400_length02 = 0x0000165e ;
-+uint32_t fw2400_length02 = 0x0000202a ;
- #else
--uint32_t risc_code_length02 = 0x0000165e ;
-+uint32_t risc_code_length02 = 0x0000202a ;
- #endif
-
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/ql6312.c ./drivers/scsi/qla2xxx/ql6312.c
---- ./drivers/scsi/qla2xxx.qla2xxx/ql6312.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/ql6312.c 1970-01-01 03:00:00.000000000 +0300
-@@ -1,133 +0,0 @@
--/*
-- * QLogic ISP6312 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com)
-- *
-- * Released under GPL v2.
-- */
--
--#include <linux/init.h>
--#include <linux/module.h>
--#include <linux/pci.h>
--
--#include "qla_def.h"
--
--static char qla_driver_name[] = "qla6312";
--
--extern unsigned char fw2300ipx_version[];
--extern unsigned char fw2300ipx_version_str[];
--extern unsigned short fw2300ipx_addr01;
--extern unsigned short fw2300ipx_code01[];
--extern unsigned short fw2300ipx_length01;
--extern unsigned char fw2322ipx_version[];
--extern unsigned char fw2322ipx_version_str[];
--extern unsigned short fw2322ipx_addr01;
--extern unsigned short fw2322ipx_code01[];
--extern unsigned short fw2322ipx_length01;
--extern unsigned long rseqipx_code_addr01;
--extern unsigned short rseqipx_code01[];
--extern unsigned short rseqipx_code_length01;
--extern unsigned long xseqipx_code_addr01;
--extern unsigned short xseqipx_code01[];
--extern unsigned short xseqipx_code_length01;
--
--static struct qla_fw_info qla_fw_tbl[] = {
-- {
-- .addressing = FW_INFO_ADDR_NORMAL,
-- .fwcode = &fw2300ipx_code01[0],
-- .fwlen = &fw2300ipx_length01,
-- .fwstart = &fw2300ipx_addr01,
-- },
-- { FW_INFO_ADDR_NOMORE, },
--
-- {
-- .addressing = FW_INFO_ADDR_NORMAL,
-- .fwcode = &fw2322ipx_code01[0],
-- .fwlen = &fw2322ipx_length01,
-- .fwstart = &fw2322ipx_addr01,
-- },
-- {
-- .addressing = FW_INFO_ADDR_EXTENDED,
-- .fwcode = &rseqipx_code01[0],
-- .fwlen = &rseqipx_code_length01,
-- .lfwstart = &rseqipx_code_addr01,
-- },
-- {
-- .addressing = FW_INFO_ADDR_EXTENDED,
-- .fwcode = &xseqipx_code01[0],
-- .fwlen = &xseqipx_code_length01,
-- .lfwstart = &xseqipx_code_addr01,
-- },
-- { FW_INFO_ADDR_NOMORE, },
--};
--
--static struct qla_board_info qla_board_tbl[] = {
-- {
-- .drv_name = qla_driver_name,
-- .isp_name = "ISP6312",
-- .fw_info = qla_fw_tbl,
-- },
-- {
-- .drv_name = qla_driver_name,
-- .isp_name = "ISP6322",
-- .fw_info = &qla_fw_tbl[2],
-- },
--};
--
--static struct pci_device_id qla6312_pci_tbl[] = {
-- {
-- .vendor = PCI_VENDOR_ID_QLOGIC,
-- .device = PCI_DEVICE_ID_QLOGIC_ISP6312,
-- .subvendor = PCI_ANY_ID,
-- .subdevice = PCI_ANY_ID,
-- .driver_data = (unsigned long)&qla_board_tbl[0],
-- },
-- {
-- .vendor = PCI_VENDOR_ID_QLOGIC,
-- .device = PCI_DEVICE_ID_QLOGIC_ISP6322,
-- .subvendor = PCI_ANY_ID,
-- .subdevice = PCI_ANY_ID,
-- .driver_data = (unsigned long)&qla_board_tbl[1],
-- },
-- {0, 0},
--};
--MODULE_DEVICE_TABLE(pci, qla6312_pci_tbl);
--
--static int __devinit
--qla6312_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
--{
-- return qla2x00_probe_one(pdev,
-- (struct qla_board_info *)id->driver_data);
--}
--
--static void __devexit
--qla6312_remove_one(struct pci_dev *pdev)
--{
-- qla2x00_remove_one(pdev);
--}
--
--static struct pci_driver qla6312_pci_driver = {
-- .name = "qla6312",
-- .id_table = qla6312_pci_tbl,
-- .probe = qla6312_probe_one,
-- .remove = __devexit_p(qla6312_remove_one),
--};
--
--static int __init
--qla6312_init(void)
--{
-- return pci_module_init(&qla6312_pci_driver);
--}
--
--static void __exit
--qla6312_exit(void)
--{
-- pci_unregister_driver(&qla6312_pci_driver);
--}
--
--module_init(qla6312_init);
--module_exit(qla6312_exit);
--
--MODULE_AUTHOR("QLogic Corporation");
--MODULE_DESCRIPTION("QLogic ISP63xx FC-SCSI Host Bus Adapter driver");
--MODULE_LICENSE("GPL");
--MODULE_VERSION(QLA2XXX_VERSION);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla2xip.c ./drivers/scsi/qla2xxx/qla2xip.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla2xip.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla2xip.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,1079 @@
-+/*
-+ * QLogic ISP2x00 IP network driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/****************************************************************************
-+ Please see revision.notes for revision history.
-+*****************************************************************************/
-+
-+static const char *qla_name = "qla2xip";
-+static const char *qla_version = "2.00.00b1";
-+
-+#include <linux/config.h>
-+#include <linux/version.h>
-+#include <linux/module.h>
-+
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/ioport.h>
-+#include <linux/pci.h>
-+#include <linux/kernel.h>
-+#include <linux/ip.h>
-+#include <linux/if_arp.h>
-+#include <linux/if_ether.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/ethtool.h>
-+#include <linux/skbuff.h>
-+#include <linux/init.h>
-+#include <linux/delay.h>
-+#include <linux/mm.h>
-+#include <linux/moduleparam.h>
-+#include <asm/system.h>
-+#include <asm/io.h>
-+#include <asm/irq.h>
-+#include <asm/byteorder.h>
-+#include <asm/uaccess.h>
-+
-+#include "qla_ip.h" /* Common include file with scsi driver */
-+#include "qla2xip.h"
-+
-+/* Module command line parameters */
-+static int mtu = DEFAULT_MTU_SIZE;
-+static int buffers = DEFAULT_RECEIVE_BUFFERS;
-+
-+module_param(mtu, int, S_IRUGO|S_IWUSR);
-+MODULE_PARM_DESC(mtu,
-+ "Maximum transmission unit size "
-+ "(min=" __MODULE_STRING(MIN_MTU_SIZE)
-+ " max=" __MODULE_STRING(MAX_MTU_SIZE) ")");
-+
-+module_param(buffers, int, S_IRUGO|S_IWUSR);
-+MODULE_PARM_DESC(buffers,
-+ "Maximum number of receive buffers "
-+ "(min=" __MODULE_STRING(MIN_RECEIVE_BUFFERS)
-+ " max=" __MODULE_STRING(MAX_RECEIVE_BUFFERS) ")");
-+
-+/* Backdoor entry points into qla2x00 driver */
-+extern int qla2x00_ip_inquiry(uint16_t, struct bd_inquiry *);
-+
-+/**
-+ * qla2xip_driver_entry() - The starting address of the driver.
-+ */
-+static void
-+qla2xip_driver_entry(void)
-+{
-+ ;
-+}
-+
-+/**
-+ * qla2xip_display_info() - Prints basic driver information.
-+ *
-+ * Used mainly for debugging purposes.
-+ */
-+static void
-+qla2xip_display_info(void)
-+{
-+ printk(KERN_INFO
-+ "%s: QLogic IP via Fibre Channel Network Driver for ISP2xxx\n",
-+ qla_name);
-+
-+ printk(KERN_INFO
-+ "%s: Driver Version %s, Entry point: %p\n",
-+ qla_name, qla_version, qla2xip_driver_entry);
-+}
-+
-+/**
-+ * qla2xip_display_dev_info() - Prints basic device information.
-+ * @dev: the device to interrogate
-+ */
-+static void
-+qla2xip_display_dev_info(struct net_device *dev)
-+{
-+#define LS_UNKNOWN 2
-+ static char *link_speeds[5] = { "1", "2", "?", "4", "10" };
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ char *link_speed;
-+
-+ /* Determine link speed from inquiry data */
-+ link_speed = link_speeds[LS_UNKNOWN];
-+ if (qdev->link_speed < 5)
-+ link_speed = link_speeds[qdev->link_speed];
-+
-+ printk(KERN_INFO
-+ "%s: Mapping interface %s to HBA "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x %sgb hdma%c.\n",
-+ qla_name,
-+ dev->name,
-+ qdev->port_name[0],
-+ qdev->port_name[1],
-+ qdev->port_name[2],
-+ qdev->port_name[3],
-+ qdev->port_name[4],
-+ qdev->port_name[5],
-+ qdev->port_name[6],
-+ qdev->port_name[7],
-+ link_speed,
-+ (test_bit(BDI_64BIT_ADDRESSING, &qdev->options) ? '+' : '-'));
-+}
-+
-+/**
-+ * qla2xip_allocate_buffers() - Allocates and initializes network structures.
-+ * @dev: The device to initialize
-+ *
-+ * Returns 0 on success.
-+ */
-+static int
-+qla2xip_allocate_buffers(struct net_device *dev)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int i;
-+ struct sk_buff *skb;
-+ struct send_cb *scb;
-+ struct buffer_cb *bcb;
-+ struct packet_header *packethdr;
-+ unsigned long iter;
-+
-+ /*
-+ * Allocate/initialize queue of send control blocks for sending packets
-+ * to the SCSI driver.
-+ */
-+
-+ if ((PAGE_SIZE / sizeof(struct packet_header)) < MAX_SEND_PACKETS) {
-+ printk(KERN_ERR
-+ "%s: Unable to allocate space for packets %lx/%x\n",
-+ qla_name, PAGE_SIZE / sizeof(struct packet_header),
-+ MAX_SEND_PACKETS);
-+ return 1;
-+ }
-+
-+ qdev->scb_header = pci_alloc_consistent(qdev->pdev, PAGE_SIZE,
-+ &qdev->scb_header_dma);
-+ if (!qdev->scb_header) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate send_cb headers\n", qla_name);
-+ return 1;
-+ }
-+
-+ for (i = 0, iter = 0; i < MAX_SEND_PACKETS;
-+ i++, iter += sizeof(struct packet_header)) {
-+ scb = &qdev->send_buffers[i];
-+
-+ scb->qdev = qdev;
-+ scb->header = (struct packet_header *)
-+ (((__u8 *) qdev->scb_header) + iter);
-+ scb->header_dma = qdev->scb_header_dma + iter;
-+
-+ /* Build Network and SNAP headers */
-+ packethdr = (struct packet_header *)scb->header;
-+ packethdr->networkh.s.na.naa = NAA_IEEE_MAC_TYPE;
-+ packethdr->networkh.s.na.unused = 0;
-+ memcpy(&packethdr->networkh.s.fcaddr[2], &qdev->port_name[2],
-+ WWN_SIZE - 2);
-+
-+ packethdr->snaph.dsap = LLC_SAP_IEEE_802DOT2;
-+ packethdr->snaph.ssap = LLC_SAP_IEEE_802DOT2;
-+ packethdr->snaph.llc = LLC_CONTROL;
-+ packethdr->snaph.protid[0] = SNAP_OUI;
-+ packethdr->snaph.protid[1] = SNAP_OUI;
-+ packethdr->snaph.protid[2] = SNAP_OUI;
-+
-+ /* Add send control block to send control block ring */
-+ qdev->send_q[i] = scb;
-+ qdev->send_q_in++;
-+ }
-+
-+ /*
-+ * Allocate/initialize queue of buffers for receiving packets from the
-+ * SCSI driver
-+ * */
-+ for (i = 0; i < qdev->max_receive_buffers; i++) {
-+ /* Initialize receive buffer control block */
-+ bcb = &qdev->receive_buffers[i];
-+ bcb->handle = i;
-+
-+ /* Allocate data buffer */
-+ skb = dev_alloc_skb(qdev->receive_buff_data_size);
-+ if (skb == NULL) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate buffer_cb skb\n",
-+ qla_name);
-+ return 1;
-+ }
-+
-+ bcb->skb = skb;
-+ bcb->skb_data = skb->data;
-+ bcb->skb_data_dma = pci_map_single(qdev->pdev,
-+ skb->data, skb->len,
-+ PCI_DMA_FROMDEVICE);
-+ /* Add receive buffer to receive buffer queue */
-+ qdev->receive_q_in->handle = bcb->handle;
-+ qdev->receive_q_in->data_addr_low = LSD(bcb->skb_data_dma);
-+ qdev->receive_q_in->data_addr_high = MSD(bcb->skb_data_dma);
-+ qdev->receive_q_in++;
-+ qdev->receive_q_add_cnt++;
-+ }
-+
-+ return 0;
-+}
-+
-+/**
-+ * qla2xip_deallocate_buffers() - Deallocate network structures.
-+ * @dev: The device to uninitialize
-+ *
-+ * The device structure @dev is freed within this routine.
-+ */
-+static void
-+qla2xip_deallocate_buffers(struct net_device *dev)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int i;
-+ struct send_cb *scb;
-+ struct buffer_cb *bcb;
-+
-+ /*
-+ * Deallocate queue of control blocks for sending packets to SCSI driver
-+ */
-+ pci_free_consistent(qdev->pdev, sizeof(struct packet_header),
-+ qdev->scb_header, qdev->scb_header_dma);
-+ for (i = 0; i < MAX_SEND_PACKETS; i++) {
-+ scb = &qdev->send_buffers[i];
-+ scb->header = NULL;
-+ scb->header_dma = 0;
-+ }
-+
-+ /*
-+ * Deallocate queue of buffers for receiving packets from SCSI driver
-+ */
-+ for (i = 0; i < qdev->max_receive_buffers; i++) {
-+ bcb = &qdev->receive_buffers[i];
-+ if (bcb->skb) {
-+ pci_unmap_single(qdev->pdev,
-+ bcb->skb_data_dma,
-+ bcb->skb->len, PCI_DMA_FROMDEVICE);
-+ dev_kfree_skb_any(bcb->skb);
-+ bcb->skb = NULL;
-+ }
-+ }
-+
-+ /* Free dev and private structure */
-+ kfree(dev);
-+}
-+
-+/**
-+ * qla2xip_get_send_cb() - Retrieves the next available send control block.
-+ * @qdev: The device's private structure
-+ *
-+ * This routine assumes calls to qla2xip_send() are serialized and does NOT use
-+ * a spinlock to update the @send_q_out pointer.
-+ *
-+ * Returns the next available send_cb structure from the send queue, else NULL.
-+ */
-+static struct send_cb *
-+qla2xip_get_send_cb(struct qla2xip_private *qdev)
-+{
-+ struct send_cb *scb;
-+
-+ scb = NULL;
-+ if (qdev->send_q_in != qdev->send_q_out) {
-+ scb = qdev->send_q[qdev->send_q_out];
-+ if (qdev->send_q_out == MAX_SEND_PACKETS)
-+ qdev->send_q_out = 0;
-+ else
-+ qdev->send_q_out++;
-+ }
-+ return scb;
-+}
-+
-+/**
-+ * qla2xip_free_send_cb() - Returns the send control block to the free queue.
-+ * @scb: The send_cb to return to the free queue
-+ */
-+static void
-+qla2xip_free_send_cb(struct send_cb *scb)
-+{
-+ struct qla2xip_private *qdev = scb->qdev;
-+
-+ spin_lock(&qdev->lock);
-+
-+ /* Return send control block to free queue */
-+ qdev->send_q[qdev->send_q_in] = scb;
-+ if (qdev->send_q_in == MAX_SEND_PACKETS)
-+ qdev->send_q_in = 0;
-+ else
-+ qdev->send_q_in++;
-+
-+ spin_unlock(&qdev->lock);
-+}
-+
-+/**
-+ * qla2xip_notify() - Notification callback routine.
-+ * @dev: The device context
-+ * @type: The asyncronous event
-+ *
-+ * This callback routine is used to by the SCSI driver to notify the network
-+ * driver of an asyncronous event.
-+ */
-+static void
-+qla2xip_notify(struct net_device *dev, uint32_t type)
-+{
-+ /* Switch on event type */
-+ switch (type) {
-+ case NOTIFY_EVENT_RESET_DETECTED:
-+ printk(KERN_INFO
-+ "%s: %s - Reset detected\n", qla_name, dev->name);
-+ break;
-+
-+ case NOTIFY_EVENT_LINK_DOWN:
-+ printk(KERN_INFO
-+ "%s: %s - Link down detected\n", qla_name, dev->name);
-+ break;
-+
-+ case NOTIFY_EVENT_LINK_UP:
-+ printk(KERN_INFO
-+ "%s: %s - Link up detected\n", qla_name, dev->name);
-+ break;
-+
-+ default:
-+ printk(KERN_INFO
-+ "%s: %s - Unsupported notification type %x\n",
-+ qla_name, dev->name, type);
-+ break;
-+ }
-+}
-+
-+/**
-+ * qla2xip_send_completion() - Send completion callback routine.
-+ * @scb: The send_cb that was sent
-+ *
-+ * This callback routine is used to by the SCSI driver to notify the network
-+ * driver of a send completion on the specified @scb.
-+ *
-+ * Note: this routine is called from an IRQ context.
-+ */
-+static void
-+qla2xip_send_completion(struct send_cb *scb)
-+{
-+ struct qla2xip_private *qdev = scb->qdev;
-+ struct net_device *dev = qdev->dev;
-+
-+ /* Interrogate completion status from firmware */
-+ switch (scb->comp_status) {
-+ case SCB_CS_COMPLETE:
-+ qdev->stats.tx_packets++;
-+ qdev->stats.tx_bytes += (scb->skb->len +
-+ sizeof(struct packet_header));
-+ break;
-+
-+ case SCB_CS_INCOMPLETE:
-+ case SCB_CS_ABORTED:
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_aborted_errors++;
-+ printk(KERN_WARNING
-+ "%s: Unsuccessful send-completion status "
-+ "(%x)\n", qla_name, scb->comp_status);
-+ break;
-+
-+ case SCB_CS_RESET:
-+ case SCB_CS_TIMEOUT:
-+ case SCB_CS_PORT_UNAVAILABLE:
-+ case SCB_CS_PORT_LOGGED_OUT:
-+ case SCB_CS_PORT_CONFIG_CHG:
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_carrier_errors++;
-+ printk(KERN_WARNING
-+ "%s: Unsuccessful send-completion status "
-+ "(%x)\n", qla_name, scb->comp_status);
-+ break;
-+
-+ case SCB_CS_FW_RESOURCE_UNAVAILABLE:
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_fifo_errors++;
-+ printk(KERN_WARNING
-+ "%s: Unsuccessful send-completion status "
-+ "(%x)\n", qla_name, scb->comp_status);
-+ break;
-+
-+ default:
-+ printk(KERN_ERR
-+ "%s: Unknown send-completion status returned "
-+ "(%x)\n", qla_name, scb->comp_status);
-+ break;
-+
-+ }
-+
-+ /* Free resources */
-+ dev_kfree_skb_irq(scb->skb);
-+ qla2xip_free_send_cb(scb);
-+
-+ /* Start queueing of packets if stopped */
-+ netif_wake_queue(dev);
-+}
-+
-+/**
-+ * qla2xip_receive_packets() - Receive packet callback routine.
-+ * @dev: The device context
-+ * @bcb: The buffer_cb that was received
-+ *
-+ * This callback routine is used to by the SCSI driver to notify the network
-+ * driver of a received packet.
-+ *
-+ * The routine will double-buffer any linked buffer_cbs if the packet spans
-+ * multiple sequence buffers.
-+ *
-+ * Note: this routine is called from an IRQ context.
-+ * Note: the SCSI driver will serialize calls to this routine, hence a spinlock
-+ * is not used.
-+ */
-+static void
-+qla2xip_receive_packets(struct net_device *dev, struct buffer_cb *bcb)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int pkt_len;
-+ struct ethhdr *eth;
-+ struct sk_buff *skb;
-+ struct packet_header *packethdr;
-+
-+ /* TODO: Interrogate firmware completion status */
-+
-+ pkt_len = bcb->packet_size -
-+ (sizeof(struct packet_header) - sizeof(struct ethhdr));
-+
-+ /* Convert Network and SNAP headers into Ethernet header */
-+ packethdr = (struct packet_header *)bcb->skb_data;
-+ eth = (struct ethhdr *)(bcb->skb_data +
-+ (sizeof(struct packet_header) -
-+ sizeof(struct ethhdr)));
-+
-+ eth->h_proto = packethdr->snaph.ethertype;
-+ memcpy(eth->h_source, packethdr->networkh.s.na.addr, ETH_ALEN);
-+ memcpy(eth->h_dest, packethdr->networkh.d.na.addr, ETH_ALEN);
-+
-+ if (bcb->linked_bcb_cnt == 1) {
-+ /*
-+ * Packet is in single receive buffer, no need to double buffer
-+ */
-+ skb = bcb->skb;
-+ pci_unmap_single(qdev->pdev,
-+ bcb->skb_data_dma, skb->len,
-+ PCI_DMA_FROMDEVICE);
-+ skb->dev = dev;
-+
-+ /* Adjust buffer pointer and length */
-+ skb_reserve(skb, sizeof(struct packet_header) -
-+ sizeof(struct ethhdr));
-+ skb_put(skb, pkt_len);
-+ skb->protocol = eth_type_trans(skb, dev);
-+
-+ /* Indicate receive packet */
-+ netif_rx(skb);
-+ dev->last_rx = jiffies;
-+
-+ qdev->stats.rx_packets++;
-+ qdev->stats.rx_bytes += bcb->packet_size;
-+
-+ /* Preallocate replacement receive buffer */
-+ skb = dev_alloc_skb(qdev->receive_buff_data_size);
-+ if (skb) {
-+ bcb->skb = skb;
-+ bcb->skb_data = skb->data;
-+ bcb->skb_data_dma = pci_map_single(qdev->pdev,
-+ skb->data, skb->len,
-+ PCI_DMA_FROMDEVICE);
-+
-+ /* Add receive buffer to receive buffer queue */
-+ qdev->receive_q_in->handle = bcb->handle;
-+ qdev->receive_q_in->data_addr_low =
-+ LSD(bcb->skb_data_dma);
-+ qdev->receive_q_in->data_addr_high =
-+ MSD(bcb->skb_data_dma);
-+ qdev->receive_q_in++;
-+ if (qdev->receive_q_in == qdev->receive_q_end)
-+ qdev->receive_q_in = qdev->receive_q;
-+ qdev->receive_q_add_cnt++;
-+ } else {
-+ printk(KERN_ERR
-+ "%s: %s - Failed to allocate buffer_cb skb, "
-+ "buffer pool has been reduced!\n",
-+ qla_name, dev->name);
-+ bcb->skb = NULL;
-+ }
-+ } else {
-+ int i;
-+ int buffer_len;
-+ struct buffer_cb *nbcb;
-+
-+ /*
-+ * Incoming packet was broken into multiple receive buffers.
-+ * This is probably due to a MTU mismatch between systems.
-+ * Must double buffer packet into single buffer for Linux
-+ */
-+ skb = dev_alloc_skb(pkt_len + 2);
-+ if (skb) {
-+ skb->dev = dev;
-+ skb_reserve(skb, 2);
-+
-+ /* Move 1st buffer with ethernet header */
-+ buffer_len = bcb->rec_data_size -
-+ (sizeof(struct packet_header) -
-+ sizeof(struct ethhdr));
-+ memcpy(skb_put(skb, buffer_len), eth, buffer_len);
-+
-+ /* Move rest of receive buffers */
-+ nbcb = bcb;
-+ for (i = 1; i < bcb->linked_bcb_cnt; i++) {
-+ nbcb = nbcb->next_bcb;
-+ buffer_len = nbcb->rec_data_size;
-+ memcpy(skb_put(skb, buffer_len),
-+ nbcb->skb_data, buffer_len);
-+ }
-+
-+ skb->protocol = eth_type_trans(skb, dev);
-+
-+ /* Indicate receive packet */
-+ netif_rx(skb);
-+ dev->last_rx = jiffies;
-+
-+ qdev->stats.rx_packets++;
-+ qdev->stats.rx_bytes += bcb->packet_size;
-+ } else {
-+ /* Failed to allocate buffer, drop packet */
-+ printk(KERN_ERR
-+ "%s: %s - Failed to allocate buffer_cb skb, "
-+ "packet dropped, buffer pool has been "
-+ "reduced!\n", qla_name, dev->name);
-+ qdev->stats.rx_dropped++;
-+ }
-+
-+ /* Return buffers to receive buffer queue */
-+ nbcb = bcb;
-+ for (i = 0; i < bcb->linked_bcb_cnt;
-+ i++, nbcb = nbcb->next_bcb) {
-+ qdev->receive_q_in->handle = nbcb->handle;
-+ qdev->receive_q_in->data_addr_low =
-+ LSD(nbcb->skb_data_dma);
-+ qdev->receive_q_in->data_addr_high =
-+ MSD(nbcb->skb_data_dma);
-+ qdev->receive_q_in++;
-+ if (qdev->receive_q_in == qdev->receive_q_end)
-+ qdev->receive_q_in = qdev->receive_q;
-+ }
-+ qdev->receive_q_add_cnt += bcb->linked_bcb_cnt;
-+ }
-+
-+ /* Update (RISC) free buffer count */
-+ qdev->receive_q_cnt -= bcb->linked_bcb_cnt;
-+
-+ /* Pass receive buffers to SCSI driver */
-+ if (qdev->receive_q_add_cnt >= RECEIVE_BUFFERS_ADD_MARK ||
-+ qdev->receive_q_cnt <= RECEIVE_BUFFERS_LOW_MARK) {
-+ qdev->ip_add_buffers_routine(qdev->ha,
-+ qdev->receive_q_add_cnt, 1);
-+
-+ qdev->receive_q_cnt += qdev->receive_q_add_cnt;
-+ qdev->receive_q_add_cnt = 0;
-+ }
-+}
-+
-+/**
-+ * qla2xip_open() - Prepares a networking interface for use.
-+ * @dev: The device to open
-+ *
-+ * Returns 0.
-+ */
-+static int
-+qla2xip_open(struct net_device *dev)
-+{
-+ netif_start_queue(dev);
-+ return 0;
-+}
-+
-+/**
-+ * qla2xip_close() - Shutdown a networking interface.
-+ * @dev: The device to shutdown
-+ *
-+ * Returns 0.
-+ */
-+static int
-+qla2xip_close(struct net_device *dev)
-+{
-+ netif_stop_queue(dev);
-+ return 0;
-+}
-+
-+/**
-+ * qla2xip_send() - Transmit a socket buffer over an interface.
-+ * @skb: The buffer to transmit
-+ * @dev: The device to transmit the buffer on
-+ *
-+ * Returns 0 if the buffer was sent, else 1.
-+ */
-+static int
-+qla2xip_send(struct sk_buff *skb, struct net_device *dev)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int status;
-+ struct ethhdr *eth;
-+ struct send_cb *scb;
-+ struct packet_header *packethdr;
-+
-+ /* Get next available send control block */
-+ scb = qla2xip_get_send_cb(qdev);
-+ if (scb) {
-+ /* Finish building Network and SNAP headers */
-+ eth = (struct ethhdr *)skb->data;
-+ packethdr = scb->header;
-+
-+ packethdr->networkh.d.na.naa = NAA_IEEE_MAC_TYPE;
-+ packethdr->networkh.d.na.unused = 0;
-+ memcpy(packethdr->networkh.d.na.addr, eth->h_dest, ETH_ALEN);
-+ packethdr->snaph.ethertype = eth->h_proto;
-+
-+ /* Skip over ethernet header */
-+ skb_pull(skb, sizeof(struct ethhdr));
-+
-+ /* Pass send packet to SCSI driver */
-+ dev->trans_start = jiffies;
-+ scb->skb = skb;
-+ status = qdev->ip_send_packet_routine(qdev->ha, scb);
-+ if (status == QL_STATUS_SUCCESS) {
-+ /* Packet successfully sent to ISP */
-+ /* Move up */
-+ /*dev->trans_start = jiffies; */
-+ return 0;
-+ } else if (status == QL_STATUS_RESOURCE_ERROR) {
-+ /* ISP too busy now, try later */
-+ printk(KERN_WARNING
-+ "%s: %s - Unable to send packet -- Resource "
-+ "error...Try again.\n", qla_name, dev->name);
-+ /* Free send control block */
-+ qla2xip_free_send_cb(scb);
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_fifo_errors++;
-+ netif_stop_queue(dev);
-+ return 1;
-+ } else {
-+ /* Error, don't send packet */
-+ printk(KERN_ERR
-+ "%s: %s - Unable to send packet -- Bad error "
-+ "occured!!!\n", qla_name, dev->name);
-+ /* Free send control block */
-+ qla2xip_free_send_cb(scb);
-+ dev_kfree_skb(skb);
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_aborted_errors++;
-+ return 0;
-+ }
-+ } else {
-+ /* Out of send control blocks, pause queueing of packets */
-+ printk(KERN_WARNING
-+ "%s: %s - Unable to send packet -- Out of send "
-+ "control blocks!!!\n", qla_name, dev->name);
-+ qdev->stats.tx_errors++;
-+ qdev->stats.tx_fifo_errors++;
-+ netif_stop_queue(dev);
-+ return 1;
-+ }
-+}
-+
-+/**
-+ * qla2xip_get_stats() - Retrieves networking statistics.
-+ * @dev: The device to interrogate
-+ *
-+ * Returns a pointer to the net_device_stats structure of the @dev.
-+ */
-+static struct net_device_stats *
-+qla2xip_get_stats(struct net_device *dev)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+
-+ return &qdev->stats;
-+}
-+
-+/**
-+ * qla2xip_change_mtu() - Set the MTU of a device.
-+ * @dev: The device to update
-+ * @new_mtu: The new MTU value
-+ *
-+ * Returns 0 if the MTU was successfully updated.
-+ */
-+static int
-+qla2xip_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+ if ((new_mtu > MAX_MTU_SIZE) || (new_mtu < MIN_MTU_SIZE))
-+ return -EINVAL;
-+
-+ return -EOPNOTSUPP;
-+}
-+
-+/**
-+ * qla2xip_set_multicast_list() - Add a device to a multicast group.
-+ * @dev: The device to add
-+ */
-+static void
-+qla2xip_set_multicast_list(struct net_device *dev)
-+{
-+ /* TODO: complete interface */
-+ return;
-+}
-+
-+/**
-+ * qla2xip_ethtool_ioctl() - Interface for ethtool IOCTLs.
-+ * @dev: The device to interrogate
-+ * @useraddr: The user-space IOCTL data
-+ *
-+ * Interface example from drivers/net/3c59x.c.
-+ *
-+ * Returns 0 if the ethtool IOCTL succeeded.
-+ */
-+static int
-+qla2xip_ethtool_ioctl(struct net_device *dev, void *useraddr)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ u32 ethcmd;
-+ struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
-+
-+ if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
-+ return -EFAULT;
-+
-+ switch (ethcmd) {
-+ case ETHTOOL_GDRVINFO:
-+ strcpy(info.driver, qla_name);
-+ strcpy(info.version, qla_version);
-+ strcpy(info.bus_info, pci_name(qdev->pdev));
-+ if (copy_to_user(useraddr, &info, sizeof(info)))
-+ return -EFAULT;
-+ return 0;
-+ }
-+ return -EOPNOTSUPP;
-+}
-+
-+/**
-+ * qla2xip_do_ioctl() - Interface for private networking IOCTLs.
-+ * @dev: The device to interrogate
-+ * @useraddr: The IOCTL interface request
-+ *
-+ * Note: currently only a small subset of ethtool support IOCTLs are
-+ * implemented.
-+ *
-+ * Returns 0 if the IOCTL succeeded.
-+ */
-+static int
-+qla2xip_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int retval;
-+
-+ /* TODO: Complete interface */
-+ qdev = qdev;
-+ switch (cmd) {
-+ case SIOCETHTOOL:
-+ retval = qla2xip_ethtool_ioctl(dev, (void *)rq->ifr_data);
-+ break;
-+
-+ default:
-+ retval = -EOPNOTSUPP;
-+ break;
-+ }
-+ return retval;
-+}
-+
-+/**
-+ * qla2xip_set_mac_address() - Set the MAC address of a device.
-+ * @dev: The device to update
-+ * @p: The new MAC address
-+ *
-+ * Returns 0 if the MAC address was successfully updated.
-+ */
-+static int
-+qla2xip_set_mac_address(struct net_device *dev, void *p)
-+{
-+ /* TODO: complete interface */
-+ return 0;
-+}
-+
-+/**
-+ * qla2xip_tx_timeout() - Transmission timeout handler.
-+ * @dev: The device that timed-out
-+ */
-+static void
-+qla2xip_tx_timeout(struct net_device *dev)
-+{
-+ struct qla2xip_private *qdev = (struct qla2xip_private *)dev->priv;
-+ int status;
-+
-+ printk(KERN_ERR
-+ "%s: %s - Transmission timed out, cable problem?\n",
-+ qla_name, dev->name);
-+ printk(KERN_DEBUG
-+ "%s: %s - Transmission timed out, cable problem?\n",
-+ qla_name, dev->name);
-+
-+ /* Call SCSI driver to perform any internal cleanup */
-+ status = qdev->ip_tx_timeout_routine(qdev->ha);
-+
-+ qdev->stats.rx_dropped++;
-+ dev->trans_start = jiffies;
-+ netif_wake_queue(dev);
-+}
-+
-+/* Chain of configured device structures (just for module unload)*/
-+static struct net_device *root_dev;
-+
-+/**
-+ * qla2xip_init() - Driver initialization routine.
-+ *
-+ * This routine scans for and initializes all QLogic adapters that support the
-+ * IP interface.
-+ */
-+static int __devinit
-+qla2xip_init(void)
-+{
-+ int rval;
-+ int adapters_found;
-+ int version_display;
-+ int adapter_number;
-+ struct bd_enable *enable_data;
-+ struct bd_inquiry *inq_data;
-+ struct qla2xip_private *qdev;
-+ struct net_device *dev;
-+
-+ adapters_found = 0;
-+ version_display = 0;
-+
-+ /* Allocate buffer for backdoor inquiry to SCSI driver */
-+ inq_data = kmalloc(sizeof(struct bd_inquiry), GFP_KERNEL);
-+ if (inq_data == NULL) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate inquiry data\n", qla_name);
-+
-+ return -ENOMEM;
-+ }
-+
-+ enable_data = kmalloc(sizeof(struct bd_enable), GFP_KERNEL);
-+ if (enable_data == NULL) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate enable data\n", qla_name);
-+ kfree(inq_data);
-+
-+ return -ENOMEM;
-+ }
-+
-+ /* Loop, looking for all adapters with IP support */
-+ for (adapter_number = 0;
-+ adapter_number < MAX_ADAPTER_COUNT; adapter_number++) {
-+
-+ memset(inq_data, 0, sizeof(struct bd_inquiry));
-+ inq_data->length = BDI_LENGTH;
-+ inq_data->version = BDI_VERSION;
-+
-+ rval = qla2x00_ip_inquiry(adapter_number, inq_data);
-+ if (!rval)
-+ continue;
-+
-+ /* Inquiry succeeded */
-+ /* Display version info if adapter is found */
-+ if (!version_display) {
-+ version_display = 1;
-+ qla2xip_display_info();
-+ }
-+
-+ /*
-+ * Allocate device structure and private structure
-+ *
-+ * The default init_fcdev behaviour is not consistent with the
-+ * pre-existing behaviour.
-+ *
-+ * Allocate the ethernet device and update needed fields.
-+ * Post-register when allocations complete.
-+ */
-+ dev = alloc_etherdev(sizeof(struct qla2xip_private));
-+ if (dev == NULL) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate net-device structure\n",
-+ qla_name);
-+ break;
-+ }
-+ SET_MODULE_OWNER(dev);
-+
-+ qdev = (struct qla2xip_private *)dev->priv;
-+
-+ qdev->dev = dev;
-+ spin_lock_init(&qdev->lock);
-+
-+ /* Set driver entry points */
-+ dev->open = qla2xip_open;
-+ dev->hard_start_xmit = qla2xip_send;
-+ dev->stop = qla2xip_close;
-+ dev->get_stats = qla2xip_get_stats;
-+ dev->change_mtu = qla2xip_change_mtu;
-+ dev->set_multicast_list = qla2xip_set_multicast_list;
-+ dev->do_ioctl = qla2xip_do_ioctl;
-+ dev->set_mac_address = qla2xip_set_mac_address;
-+ dev->tx_timeout = qla2xip_tx_timeout;
-+
-+ /* Update interface name */
-+ strcpy(dev->name, "fc%d");
-+
-+ /* Save Inquiry data from SCSI driver */
-+ qdev->options = inq_data->options;
-+ qdev->ha = inq_data->ha;
-+ qdev->receive_q = (struct risc_rec_entry *)inq_data->risc_rec_q;
-+ qdev->receive_q_size = inq_data->risc_rec_q_size;
-+ qdev->receive_q_in = qdev->receive_q;
-+ qdev->receive_q_end = &qdev->receive_q[qdev->receive_q_size];
-+
-+ qdev->link_speed = inq_data->link_speed;
-+ memcpy(qdev->port_name, inq_data->port_name, WWN_SIZE);
-+ qdev->pdev = inq_data->pdev;
-+
-+ qdev->ip_enable_routine = inq_data->ip_enable_routine;
-+ qdev->ip_disable_routine = inq_data->ip_disable_routine;
-+ qdev->ip_add_buffers_routine = inq_data->ip_add_buffers_routine;
-+ qdev->ip_send_packet_routine = inq_data->ip_send_packet_routine;
-+ qdev->ip_tx_timeout_routine = inq_data->ip_tx_timeout_routine;
-+
-+ /* Validate and set parameters */
-+ qdev->mtu = mtu;
-+ qdev->max_receive_buffers = buffers;
-+
-+ if (qdev->mtu > MAX_MTU_SIZE)
-+ qdev->mtu = MAX_MTU_SIZE;
-+ if (qdev->mtu < MIN_MTU_SIZE)
-+ qdev->mtu = MIN_MTU_SIZE;
-+
-+ if (qdev->max_receive_buffers > MAX_RECEIVE_BUFFERS)
-+ qdev->max_receive_buffers = MAX_RECEIVE_BUFFERS;
-+ if (qdev->max_receive_buffers < MIN_RECEIVE_BUFFERS)
-+ qdev->max_receive_buffers = MIN_RECEIVE_BUFFERS;
-+
-+ qdev->receive_buff_data_size = qdev->mtu +
-+ sizeof(struct packet_header);
-+ qdev->header_size = DEFAULT_HEADER_SPLIT;
-+
-+ /* TODO: Update ARP header type */
-+ /*dev->type = ARPHRD_FCFABRIC; */
-+ dev->mtu = qdev->mtu;
-+ dev->tx_queue_len = MAX_SEND_PACKETS;
-+ if (test_bit(BDI_64BIT_ADDRESSING, &qdev->options))
-+ dev->features |= NETIF_F_HIGHDMA;
-+
-+ /*
-+ * The Ethernet address is the last 6 bytes of the adapter
-+ * portname
-+ */
-+ memcpy(dev->dev_addr, &qdev->port_name[2], ETH_ALEN);
-+ /* TODO: Why do we need this? */
-+ /* dev->dev_addr[6] = qdev->port_name[6 + 2]; */
-+
-+ dev->irq = qdev->pdev->irq;
-+ dev->flags &= ~IFF_MULTICAST;
-+ dev->flags |= IFF_NOTRAILERS;
-+
-+ /* Allocate and initialize data buffers */
-+ rval = qla2xip_allocate_buffers(dev);
-+ if (rval) {
-+ printk(KERN_ERR
-+ "%s: Failed to allocate support buffers\n",
-+ qla_name);
-+
-+ qla2xip_deallocate_buffers(dev);
-+ break;
-+ }
-+
-+ /* Enable connection to SCSI driver */
-+ memset(enable_data, 0, sizeof(struct bd_enable));
-+ enable_data->length = BDE_LENGTH;
-+ enable_data->version = BDE_VERSION;
-+ set_bit(BDE_NOTIFY_ROUTINE, &enable_data->options);
-+ enable_data->mtu = qdev->mtu;
-+ enable_data->header_size = qdev->header_size;
-+ enable_data->receive_buffers = qdev->receive_buffers;
-+ enable_data->max_receive_buffers = qdev->max_receive_buffers;
-+ enable_data->receive_buff_data_size =
-+ qdev->receive_buff_data_size;
-+ enable_data->notify_routine = qla2xip_notify;
-+ enable_data->notify_context = dev;
-+ enable_data->send_completion_routine = qla2xip_send_completion;
-+ enable_data->receive_packets_routine = qla2xip_receive_packets;
-+ enable_data->receive_packets_context = dev;
-+
-+ rval = qdev->ip_enable_routine(qdev->ha, enable_data);
-+ if (!rval) {
-+ /*
-+ * Connection to SCSI driver failed return resources
-+ */
-+ printk(KERN_ERR
-+ "%s: Failed to enable backdoor IP\n", qla_name);
-+ qla2xip_deallocate_buffers(dev);
-+ break;
-+ }
-+
-+ /*
-+ * Pass receive buffers to SCSI driver
-+ */
-+ qdev->ip_add_buffers_routine(qdev->ha,
-+ qdev->receive_q_add_cnt, 0);
-+ qdev->receive_q_cnt = qdev->receive_q_add_cnt;
-+ qdev->receive_q_add_cnt = 0;
-+
-+ /* Register the device */
-+ rval = register_netdev(dev);
-+ if (rval) {
-+ printk(KERN_ERR
-+ "%s: Unable to register net-device\n", qla_name);
-+ qla2xip_deallocate_buffers(dev);
-+ break;
-+ }
-+
-+ qla2xip_display_dev_info(dev);
-+
-+ /*
-+ * Add to device chain and increment adapter count
-+ */
-+ qdev->next = root_dev;
-+ root_dev = dev;
-+ adapters_found++;
-+
-+ continue;
-+ }
-+
-+ kfree(enable_data);
-+ kfree(inq_data);
-+
-+ if (adapters_found > 0)
-+ return 0;
-+ return -ENODEV;
-+}
-+
-+static void __devexit
-+qla2xip_exit(void)
-+{
-+ struct qla2xip_private *qdev;
-+ struct net_device *next;
-+
-+ while (root_dev) {
-+ qdev = (struct qla2xip_private *)root_dev->priv;
-+ next = qdev->next;
-+
-+ /* Call SCSI driver to disable IP connection */
-+ qdev->ip_disable_routine(qdev->ha);
-+
-+ unregister_netdev(root_dev);
-+
-+ /* Return allocated buffers */
-+ qla2xip_deallocate_buffers(root_dev);
-+
-+ root_dev = next;
-+ }
-+}
-+
-+MODULE_AUTHOR("QLogic Corporation");
-+MODULE_DESCRIPTION("QLogic IP via Fibre Channel Network Driver for ISP2xxx");
-+MODULE_LICENSE("GPL");
-+
-+module_init(qla2xip_init);
-+module_exit(qla2xip_exit);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla2xip.h ./drivers/scsi/qla2xxx/qla2xip.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla2xip.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla2xip.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,80 @@
-+/*
-+ * QLogic QLogic ISP2x00 IP network driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/****************************************************************************
-+ Please see revision.notes for revision history.
-+*****************************************************************************/
-+
-+#if !defined(_QLA2XIP_H_)
-+#define _QLA2XIP_H_
-+
-+#define WWN_SIZE 8
-+#define MAX_ADAPTER_COUNT 8 /* Maximum adapters supported */
-+
-+#define MAX_MTU_SIZE 65280 /* Maximum MTU size */
-+#define MIN_MTU_SIZE 100 /* Minimum MTU size */
-+#define DEFAULT_MTU_SIZE 4096 /* Default MTU size */
-+#define DEFAULT_BUFFER_SIZE (DEFAULT_MTU_SIZE + sizeof(PACKET_HEADER))
-+#define DEFAULT_RECEIVE_BUFFERS 32 /* Default number of receive buffers */
-+
-+#define RECEIVE_BUFFERS_LOW_MARK 16 /* Receive buffers low water mark */
-+#define RECEIVE_BUFFERS_ADD_MARK 10 /* Receive buffers add mark */
-+#define DEFAULT_HEADER_SPLIT 0 /* Default header split size (== 0) */
-+
-+#define LSD(x) ((uint32_t)((uint64_t)(x)))
-+#define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
-+
-+/*
-+ * Struct private for the QLogic IP adapter
-+ */
-+struct qla2xip_private {
-+ /* Net device members */
-+ struct net_device *next;
-+ spinlock_t lock;
-+
-+ struct net_device_stats stats; /* Device statistics */
-+ struct net_device *dev; /* Parent NET device */
-+
-+ uint32_t mtu; /* Maximum transfer unit */
-+ uint16_t header_size; /* Split header size */
-+
-+ /* Send control block queue */
-+ struct send_cb *send_q[MAX_SEND_PACKETS + 1];
-+ uint16_t send_q_in; /* free in-pointer */
-+ uint16_t send_q_out; /* free out-pointer */
-+ /* Send control block array */
-+ struct send_cb send_buffers[MAX_SEND_PACKETS];
-+ struct packet_header *scb_header;
-+ dma_addr_t scb_header_dma;
-+
-+ /* Inquiry data from SCSI driver */
-+ unsigned long options; /* QLA2X00 supported options */
-+ void *ha; /* Driver ha pointer */
-+ uint16_t link_speed; /* Link speed */
-+ uint8_t port_name[WWN_SIZE]; /* Adapter port name */
-+ struct pci_dev *pdev; /* PCI device information */
-+
-+ /* Pointers to SCSI-backdoor callbacks */
-+ int (*ip_enable_routine) (void *, struct bd_enable *);
-+ int (*ip_disable_routine) (void *);
-+ int (*ip_add_buffers_routine) (void *, uint16_t, int);
-+ int (*ip_send_packet_routine) (void *, struct send_cb *);
-+ int (*ip_tx_timeout_routine) (void *);
-+
-+ /* RISC receive queue */
-+ uint16_t receive_q_size; /* size */
-+ struct risc_rec_entry *receive_q; /* pointer */
-+ struct risc_rec_entry *receive_q_in; /* in-pointer */
-+ struct risc_rec_entry *receive_q_end; /* end-pointer */
-+ uint16_t receive_q_cnt; /* current buffer count */
-+ uint16_t receive_q_add_cnt; /* buffers to be added */
-+
-+ struct buffer_cb receive_buffers[MAX_RECEIVE_BUFFERS];
-+ uint16_t max_receive_buffers; /* maximum # receive buffers */
-+ uint32_t receive_buff_data_size; /* data size */
-+};
-+#endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla2xxx_conf.c ./drivers/scsi/qla2xxx/qla2xxx_conf.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla2xxx_conf.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla2xxx_conf.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,41 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/string.h>
-+
-+/*
-+ * Extended configuration parameters
-+ */
-+#include "qla_opts.h"
-+
-+MODULE_DESCRIPTION("QLogic Persistent Binding Data Module");
-+MODULE_AUTHOR("QLogic Corporation");
-+MODULE_LICENSE("GPL");
-+
-+char *qla_persistent_str = NULL ;
-+CONFIG_BEGIN("qla2xxx_conf")
-+CONFIG_ITEM("OPTIONS", "")
-+CONFIG_END
-+
-+static int conf_init(void)
-+{
-+ QLOPTS_CONFIGURE(qla_persistent_str);
-+ inter_module_register("qla2xxx_conf", THIS_MODULE, qla_persistent_str);
-+ return 0;
-+}
-+
-+static void conf_exit (void)
-+{
-+ inter_module_unregister("qla2xxx_conf");
-+}
-+
-+module_init(conf_init);
-+module_exit(conf_exit);
-+
-+
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_32ioctl.c ./drivers/scsi/qla2xxx/qla_32ioctl.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_32ioctl.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_32ioctl.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,156 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include <linux/config.h>
-+#include <linux/version.h>
-+
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+
-+#include <linux/file.h>
-+
-+#include "exioct.h"
-+#include "qlfoln.h"
-+#include "qla_dbg.h"
-+
-+
-+/* fs/ioctl.c */
-+extern asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, void *);
-+/*
-+ * Register an 32bit ioctl translation handler for ioctl cmd.
-+ *
-+ * handler == NULL: use 64bit ioctl handler.
-+ * arguments to handler: fd: file descriptor
-+ * cmd: ioctl command.
-+ * arg: ioctl argument
-+ * struct file *file: file descriptor pointer.
-+ */
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
-+#define register_ioctl32_conversion(cmd, handler) (0)
-+#define unregister_ioctl32_conversion(cmd) (0)
-+#else
-+extern int register_ioctl32_conversion(unsigned int cmd,
-+ int (*handler)(unsigned int, unsigned int, unsigned long, struct file *));
-+extern int unregister_ioctl32_conversion(unsigned int cmd);
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
-+int
-+qla2xxx_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg,
-+ struct file *pfile)
-+{
-+ return (sys_ioctl(fd, cmd, (void *)arg));
-+}
-+#endif
-+
-+static int
-+apidev_reg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
-+{
-+ int err = 0;
-+ int i;
-+ unsigned int cmd;
-+
-+ for (i = low_idx; i <= high_idx; i++) {
-+ cmd = (unsigned int)QL_IOCTL_CMD(i);
-+ err = register_ioctl32_conversion(cmd, qla2xxx_ioctl32);
-+ if (err) {
-+ DEBUG9(printk(
-+ "%s: error registering cmd %x. err=%d.\n",
-+ __func__, cmd, err));
-+ break;
-+ }
-+ DEBUG9(printk("%s: registered cmd %x.\n", __func__, cmd));
-+ }
-+
-+ return (err);
-+}
-+
-+static int
-+apidev_unreg_increasing_idx(uint16_t low_idx, uint16_t high_idx)
-+{
-+ int err = 0;
-+ int i;
-+ unsigned int cmd;
-+
-+ for (i = low_idx; i <= high_idx; i++) {
-+ cmd = (unsigned int)QL_IOCTL_CMD(i);
-+ err = unregister_ioctl32_conversion(cmd);
-+ if (err) {
-+ DEBUG9(printk(
-+ "%s: error unregistering cmd %x. err=%d.\n",
-+ __func__, cmd, err));
-+ break;
-+ }
-+ DEBUG9(printk("%s: unregistered cmd %x.\n", __func__, cmd));
-+ }
-+
-+ return (err);
-+}
-+
-+void
-+apidev_init_32ioctl_reg(void)
-+{
-+ int err;
-+
-+ DEBUG9(printk("qla2x00: going to register ioctl32 cmds.\n"));
-+
-+ /* regular external ioctl codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_LN_REG_CC_START_IDX,
-+ EXT_DEF_LN_REG_CC_END_IDX);
-+ if (!err) {
-+ /* regular internal ioctl codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_LN_INT_CC_START_IDX,
-+ EXT_DEF_LN_INT_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* additional codes */
-+ err = apidev_reg_increasing_idx(EXT_DEF_LN_ADD_CC_START_IDX,
-+ EXT_DEF_LN_ADD_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* QL FO specific codes */
-+ err = apidev_reg_increasing_idx(FO_CC_START_IDX, FO_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* LN Drvr specific codes are defined in decreasing order */
-+ err = apidev_reg_increasing_idx(EXT_DEF_LN_SPC_CC_END_IDX,
-+ EXT_DEF_LN_SPC_CC_START_IDX);
-+ }
-+}
-+
-+void
-+apidev_cleanup_32ioctl_unreg(void)
-+{
-+ int err;
-+
-+ DEBUG9(printk("qla2x00: going to unregister ioctl32 cmds.\n"));
-+
-+ /* regular external ioctl codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_LN_REG_CC_START_IDX,
-+ EXT_DEF_LN_REG_CC_END_IDX);
-+ if (!err) {
-+ /* regular internal ioctl codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_LN_INT_CC_START_IDX,
-+ EXT_DEF_LN_INT_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* additional codes */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_LN_ADD_CC_START_IDX,
-+ EXT_DEF_LN_ADD_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* QL FO specific codes */
-+ err = apidev_unreg_increasing_idx(FO_CC_START_IDX,
-+ FO_CC_END_IDX);
-+ }
-+ if (!err) {
-+ /* LN Drvr specific codes are defined in decreasing order */
-+ err = apidev_unreg_increasing_idx(EXT_DEF_LN_SPC_CC_END_IDX,
-+ EXT_DEF_LN_SPC_CC_START_IDX);
-+ }
-+}
-+
-+#endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_32ioctl.h ./drivers/scsi/qla2xxx/qla_32ioctl.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_32ioctl.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_32ioctl.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,13 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#ifndef _QLA_32IOCTL_H_
-+#define _QLA_32IOCTL_H_
-+
-+extern void apidev_init_32ioctl_reg(void);
-+extern void apidev_cleanup_32ioctl_unreg(void);
-+
-+#endif /* _QLA_32IOCTL_H_ */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_attr.c ./drivers/scsi/qla2xxx/qla_attr.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_attr.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_attr.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,172 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+#include <linux/vmalloc.h>
-+
-+/* SYSFS attributes --------------------------------------------------------- */
-+
-+static ssize_t
-+qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-+ struct device, kobj)));
-+ char *rbuf = (char *)ha->fw_dump;
-+
-+ if (ha->fw_dump_reading == 0)
-+ return 0;
-+ if (off > ha->fw_dump_len)
-+ return 0;
-+ if (off + count > ha->fw_dump_len)
-+ count = ha->fw_dump_len - off;
-+
-+ memcpy(buf, &rbuf[off], count);
-+
-+ return (count);
-+}
-+
-+static ssize_t
-+qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-+ struct device, kobj)));
-+ int reading;
-+
-+ if (off != 0)
-+ return (0);
-+
-+ reading = simple_strtol(buf, NULL, 10);
-+ switch (reading) {
-+ case 0:
-+ if (!ha->fw_dump_reading)
-+ break;
-+
-+ qla_printk(KERN_INFO, ha,
-+ "Firmware dump cleared on (%ld).\n", ha->host_no);
-+
-+ ha->fw_dump_reading = 0;
-+ ha->fw_dumped = 0;
-+ break;
-+ case 1:
-+ if (ha->fw_dumped && !ha->fw_dump_reading) {
-+ ha->fw_dump_reading = 1;
-+
-+ qla_printk(KERN_INFO, ha,
-+ "Raw firmware dump ready for read on (%ld).\n",
-+ ha->host_no);
-+ }
-+ break;
-+ case 2:
-+ qla2x00_alloc_fw_dump(ha);
-+ break;
-+ }
-+ return (count);
-+}
-+
-+static struct bin_attribute sysfs_fw_dump_attr = {
-+ .attr = {
-+ .name = "fw_dump",
-+ .mode = S_IRUSR | S_IWUSR,
-+ .owner = THIS_MODULE,
-+ },
-+ .size = 0,
-+ .read = qla2x00_sysfs_read_fw_dump,
-+ .write = qla2x00_sysfs_write_fw_dump,
-+};
-+
-+static ssize_t
-+qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-+ struct device, kobj)));
-+ unsigned long flags;
-+
-+ if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
-+ return 0;
-+
-+ /* Read NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_read_nvram_data(ha, (uint8_t *)buf, ha->nvram_base,
-+ ha->nvram_size);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ return (count);
-+}
-+
-+static ssize_t
-+qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-+ struct device, kobj)));
-+ unsigned long flags;
-+ uint16_t cnt;
-+
-+ if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
-+ return 0;
-+
-+ /* Checksum NVRAM. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ uint32_t *iter;
-+ uint32_t chksum;
-+
-+ iter = (uint32_t *)buf;
-+ chksum = 0;
-+ for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
-+ chksum += le32_to_cpu(*iter++);
-+ chksum = ~chksum + 1;
-+ *iter = cpu_to_le32(chksum);
-+ } else {
-+ uint8_t *iter;
-+ uint8_t chksum;
-+
-+ iter = (uint8_t *)buf;
-+ chksum = 0;
-+ for (cnt = 0; cnt < count - 1; cnt++)
-+ chksum += *iter++;
-+ chksum = ~chksum + 1;
-+ *iter = chksum;
-+ }
-+
-+ /* Write NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_write_nvram_data(ha, (uint8_t *)buf, ha->nvram_base, count);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ return (count);
-+}
-+
-+static struct bin_attribute sysfs_nvram_attr = {
-+ .attr = {
-+ .name = "nvram",
-+ .mode = S_IRUSR | S_IWUSR,
-+ .owner = THIS_MODULE,
-+ },
-+ .size = 0,
-+ .read = qla2x00_sysfs_read_nvram,
-+ .write = qla2x00_sysfs_write_nvram,
-+};
-+
-+void
-+qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
-+{
-+ sysfs_create_bin_file(&ha->host->shost_gendev.kobj,
-+ &sysfs_fw_dump_attr);
-+ sysfs_nvram_attr.size = ha->nvram_size;
-+ sysfs_create_bin_file(&ha->host->shost_gendev.kobj, &sysfs_nvram_attr);
-+}
-+
-+void
-+qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
-+{
-+ sysfs_remove_bin_file(&ha->host->shost_gendev.kobj,
-+ &sysfs_fw_dump_attr);
-+ sysfs_remove_bin_file(&ha->host->shost_gendev.kobj, &sysfs_nvram_attr);
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_cfg.c ./drivers/scsi/qla2xxx/qla_cfg.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_cfg.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_cfg.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,8679 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/*
-+ * QLogic ISP2x00 Multi-path LUN Support Driver
-+ *
-+ */
-+
-+#include "qla_def.h"
-+
-+#include <asm/uaccess.h>
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+#include "qla_foln.h"
-+
-+/*
-+ * Local Function Prototypes.
-+ */
-+
-+static uint32_t qla2x00_add_portname_to_mp_dev(mp_device_t *, uint8_t *, uint8_t *);
-+
-+static mp_device_t * qla2x00_allocate_mp_dev(uint8_t *, uint8_t *);
-+static mp_path_t * qla2x00_allocate_path(mp_host_t *, uint16_t, fc_port_t *,
-+ uint16_t);
-+static mp_path_list_t * qla2x00_allocate_path_list(void);
-+
-+static mp_host_t * qla2x00_find_host_by_portname(uint8_t *);
-+
-+static mp_device_t * qla2x00_find_or_allocate_mp_dev (mp_host_t *, uint16_t,
-+ fc_port_t *);
-+static mp_path_t * qla2x00_find_or_allocate_path(mp_host_t *, mp_device_t *,
-+ uint16_t, uint16_t, fc_port_t *);
-+
-+static lu_path_t * qla2x00_find_or_allocate_lu_path(mp_host_t *, fc_lun_t *, uint16_t );
-+
-+static uint32_t qla2x00_cfg_register_failover_lun(mp_device_t *,srb_t *,
-+ fc_lun_t *);
-+static uint32_t qla2x00_send_failover_notify(mp_device_t *, uint8_t,
-+ mp_path_t *, mp_path_t *);
-+static mp_path_t * qla2x00_select_next_path(mp_host_t *, mp_device_t *,
-+ uint8_t, srb_t *);
-+
-+static uint8_t qla2x00_update_mp_host(mp_host_t *);
-+static uint32_t qla2x00_update_mp_tree (void);
-+
-+static fc_lun_t *qla2x00_find_matching_lun(uint8_t , mp_device_t *, mp_path_t *);
-+static lu_path_t * qla2x00_find_lu_path_by_id(mp_lun_t *, uint8_t );
-+static mp_path_t *qla2x00_find_path_by_id(mp_device_t *, uint8_t);
-+static mp_device_t *qla2x00_find_mp_dev_by_id(mp_host_t *, uint16_t);
-+mp_device_t *qla2x00_find_mp_dev_by_nodename(mp_host_t *, uint8_t *);
-+mp_device_t *qla2x00_find_mp_dev_by_portname(mp_host_t *, uint8_t *,
-+ uint16_t *);
-+static mp_device_t *qla2x00_find_dp_by_pn_from_all_hosts(uint8_t *, uint16_t *);
-+static mp_device_t *qla2x00_find_dp_from_all_hosts(uint8_t *);
-+
-+static mp_path_t *qla2x00_get_visible_path(mp_device_t *dp);
-+static void qla2x00_map_os_targets(mp_host_t *);
-+static void qla2x00_map_os_luns(mp_host_t *, mp_device_t *, uint16_t);
-+static uint8_t qla2x00_map_a_oslun(mp_host_t *, mp_device_t *, uint16_t, uint16_t);
-+
-+static uint8_t qla2x00_is_ww_name_zero(uint8_t *);
-+static void qla2x00_add_path(mp_path_list_t *, mp_path_t *);
-+static void qla2x00_failback_single_lun(mp_device_t *, uint8_t, uint8_t);
-+static void qla2x00_failback_luns(mp_host_t *);
-+static void qla2x00_setup_new_path(mp_device_t *, mp_path_t *, fc_port_t *);
-+static int qla2x00_get_wwuln_from_device(mp_host_t *, fc_lun_t *, char *,
-+ int , uint8_t *, uint8_t *);
-+#if 0
-+static mp_device_t * qla2x00_is_nn_and_pn_in_device(mp_device_t *,
-+ uint8_t *, uint8_t *);
-+static mp_device_t * qla2x00_find_mp_dev_by_nn_and_pn(mp_host_t *, uint8_t *, uint8_t *);
-+#endif
-+static mp_lun_t * qla2x00_find_matching_lunid(char *);
-+static fc_lun_t * qla2x00_find_matching_lun_by_num(uint16_t , mp_device_t *,
-+ mp_path_t *);
-+static int qla2x00_configure_cfg_device(fc_port_t *);
-+static mp_lun_t *
-+qla2x00_find_or_allocate_lun(mp_host_t *, uint16_t ,
-+ fc_port_t *, fc_lun_t *);
-+static void qla2x00_add_lun( mp_device_t *, mp_lun_t *);
-+#if 0
-+static int qla2x00_is_nodename_in_device(mp_device_t *, uint8_t *);
-+#endif
-+static mp_port_t *
-+qla2x00_find_or_allocate_port(mp_host_t *, mp_lun_t *,
-+ mp_path_t *);
-+static mp_tport_grp_t *
-+qla2x00_find_or_allocate_tgt_port_grp(mp_host_t *, mp_port_t *, fc_lun_t *,
-+ mp_path_t * );
-+static mp_port_t *
-+qla2x00_find_port_by_name(mp_lun_t *, mp_path_t *);
-+static struct _mp_path *
-+qla2x00_find_first_path_to_active_tpg( mp_device_t *, mp_lun_t *, int);
-+static struct _mp_path *
-+qla2x00_find_first_active_path(mp_device_t *, mp_lun_t *);
-+#if 0
-+static int
-+qla2x00_is_pathid_in_port(mp_port_t *, uint8_t );
-+#endif
-+int qla2x00_export_target( void *, uint16_t , fc_port_t *, uint16_t );
-+int
-+qla2x00_get_vol_access_path(fc_port_t *fcport, fc_lun_t *fclun, int modify);
-+int
-+qla2x00_get_lun_ownership(mp_host_t *host, fc_lun_t *fclun,
-+ uint8_t *cur_vol_path_own);
-+
-+/*
-+ * Global data items
-+ */
-+mp_host_t *mp_hosts_base = NULL;
-+DECLARE_MUTEX(mp_hosts_lock);
-+int mp_config_required = 0;
-+static int mp_num_hosts;
-+static int mp_initialized;
-+
-+/*
-+ * ENTRY ROUTINES
-+ */
-+
-+ /*
-+ * Borrowed from scsi_scan.c
-+ */
-+int16_t
-+qla2x00_cfg_lookup_device(unsigned char *response_data)
-+{
-+ int i = 0;
-+ unsigned char *pnt;
-+ DEBUG3(printk(KERN_INFO "Entering %s\n", __func__));
-+ for (i = 0; 1; i++) {
-+ if (cfg_device_list[i].vendor == NULL)
-+ return -1;
-+ pnt = &response_data[8];
-+ while (*pnt && *pnt == ' ')
-+ pnt++;
-+ if (memcmp(cfg_device_list[i].vendor, pnt,
-+ strlen(cfg_device_list[i].vendor)))
-+ continue;
-+ pnt = &response_data[16];
-+ while (*pnt && *pnt == ' ')
-+ pnt++;
-+ if (memcmp(cfg_device_list[i].model, pnt,
-+ strlen(cfg_device_list[i].model)))
-+ continue;
-+ return i;
-+ }
-+ return -1;
-+}
-+
-+int
-+qla2x00_issue_scsi_inquiry(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, fc_lun_t *fclun )
-+{
-+ int rval;
-+ int retry;
-+ int ret = 0;
-+ uint16_t lun = fclun->lun;
-+ inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+
-+ inq = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &inq_dma);
-+ if (inq == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - INQ\n", ha->host_no);
-+ ha->mem_err++;
-+ return BIT_0;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &inq->p.rsp24.comp_status;
-+ sstatus = &inq->p.rsp24.scsi_status;
-+ } else {
-+ cstatus = &inq->p.rsp.comp_status;
-+ sstatus = &inq->p.rsp.scsi_status;
-+ }
-+
-+ retry = 2;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ inq->p.cmd24.entry_count = 1;
-+ inq->p.cmd24.nport_handle =
-+ cpu_to_le16(fcport->loop_id);
-+ inq->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ inq->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ inq->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ inq->p.cmd24.lun[1] = LSB(lun);
-+ inq->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(inq->p.cmd24.lun,
-+ sizeof(inq->p.cmd24.lun));
-+ inq->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_READ_DATA);
-+ inq->p.cmd24.task = TSK_SIMPLE;
-+ inq->p.cmd24.fcp_cdb[0] = INQUIRY;
-+ inq->p.cmd24.fcp_cdb[4] = INQ_DATA_SIZE;
-+ host_to_fcp_swap(inq->p.cmd24.fcp_cdb,
-+ sizeof(inq->p.cmd24.fcp_cdb));
-+ inq->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd24.timeout = __constant_cpu_to_le16(3);
-+ inq->p.cmd24.byte_count =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ inq->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_len =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ } else {
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ inq->p.cmd.entry_count = 1;
-+ inq->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, inq->p.cmd.target, fcport->loop_id);
-+ inq->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_READ | CF_SIMPLE_TAG);
-+ inq->p.cmd.scsi_cdb[0] = INQUIRY;
-+ inq->p.cmd.scsi_cdb[4] = INQ_DATA_SIZE;
-+ inq->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd.timeout = __constant_cpu_to_le16(3);
-+ inq->p.cmd.byte_count =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ inq->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_length =
-+ __constant_cpu_to_le32(INQ_DATA_SIZE);
-+ }
-+
-+ DEBUG(printk("scsi(%ld:0x%x:%d) %s: Inquiry - fcport=%p, lun "
-+ "(%d)\n", ha->host_no, fcport->loop_id, lun, __func__,
-+ fcport, lun));
-+
-+ rval = qla2x00_issue_iocb(ha, inq, inq_dma,
-+ sizeof(inq_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && inq->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) INQ failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ inq->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE) &&
-+ --retry);
-+
-+ if (rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) {
-+ DEBUG2(printk("%s: Failed lun inquiry - inq[0]= 0x%x, comp "
-+ "status 0x%x, scsi status 0x%x. loop_id=%d\n", __func__,
-+ inq->inq[0], comp_status, scsi_status, fcport->loop_id));
-+ ret = 1;
-+ } else {
-+ fclun->device_type = inq->inq[0];
-+ }
-+ DEBUG(printk("%s(%ld): lun=%d device_type=0x%x\n",__func__, ha->host_no, lun, fclun->device_type));
-+ dma_pool_free(ha->s_dma_pool, inq, inq_dma);
-+
-+ return (ret);
-+}
-+
-+int
-+qla2x00_test_active_lun( fc_port_t *fcport, fc_lun_t *fclun, uint8_t *wait_for_transition )
-+{
-+ int rval = 0 ;
-+ int retry;
-+ scsi_qla_host_t *ha;
-+ uint16_t lun = 0;
-+ tur_cmd_rsp_t *tur;
-+ dma_addr_t tur_dma;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port loop_id 0x%02x is "
-+ "marked DEAD\n", ha->host_no, __func__, fcport->loop_id));
-+ return rval;
-+ }
-+
-+ if (fclun == NULL) {
-+ DEBUG2(printk("scsi(%ld) %s Bad fclun ptr on entry.\n",
-+ ha->host_no, __func__));
-+ return rval;
-+ }
-+
-+ lun = fclun->lun;
-+
-+ tur = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tur_dma);
-+ if (tur == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TUR\n", ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &tur->p.rsp24.comp_status;
-+ sstatus = &tur->p.rsp24.scsi_status;
-+ sense_data = tur->p.rsp24.data;
-+ } else {
-+ cstatus = &tur->p.rsp.comp_status;
-+ sstatus = &tur->p.rsp.scsi_status;
-+ sense_data = tur->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 4;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(tur, 0, sizeof(tur_cmd_rsp_t));
-+ tur->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ tur->p.cmd24.entry_count = 1;
-+ tur->p.cmd24.nport_handle =
-+ cpu_to_le16(fcport->loop_id);
-+ tur->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ tur->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ tur->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ tur->p.cmd24.lun[1] = LSB(lun);
-+ tur->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(tur->p.cmd24.lun,
-+ sizeof(tur->p.cmd24.lun));
-+ tur->p.cmd24.task = TSK_SIMPLE;
-+ tur->p.cmd24.fcp_cdb[0] = TEST_UNIT_READY;
-+ host_to_fcp_swap(tur->p.cmd24.fcp_cdb,
-+ sizeof(tur->p.cmd24.fcp_cdb));
-+ tur->p.cmd24.dseg_count = __constant_cpu_to_le16(0);
-+ tur->p.cmd24.timeout = __constant_cpu_to_le16(3);
-+ tur->p.cmd24.byte_count = __constant_cpu_to_le32(0);
-+ } else {
-+ memset(tur, 0, sizeof(tur_cmd_rsp_t));
-+ tur->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ tur->p.cmd.entry_count = 1;
-+ tur->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, tur->p.cmd.target, fcport->loop_id);
-+ tur->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_SIMPLE_TAG);
-+ tur->p.cmd.scsi_cdb[0] = TEST_UNIT_READY;
-+ tur->p.cmd.dseg_count = __constant_cpu_to_le16(0);
-+ tur->p.cmd.timeout = __constant_cpu_to_le16(3);
-+ tur->p.cmd.byte_count = __constant_cpu_to_le32(0);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, tur, tur_dma,
-+ sizeof(tur_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && tur->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) TUR failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ tur->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: TEST UNIT READY - comp "
-+ "status 0x%x, scsi status 0x%x, rval=%d\n", ha->host_no,
-+ fcport->loop_id, lun,__func__, comp_status, scsi_status,
-+ rval));
-+
-+ if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(tur->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ tur->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__, sense_data[2],
-+ sense_data[12], sense_data[13]));
-+
-+ if (sense_data[2] == NOT_READY &&
-+ sense_data[12] == 0x4 && sense_data[13] == 0x2)
-+ break;
-+
-+ if (fcport->flags & FC_DSXXX_DEVICE) {
-+ /* Wait for transition to complete */
-+ if (sense_data[2] == NOT_READY && sense_data[12] == 0x4 &&
-+ sense_data[13] == 0xa ) {
-+ rval = 1;
-+ break;
-+ }
-+ /* Already switched status - active on other controller */
-+ if (sense_data[2] == NOT_READY && sense_data[12] == 0x4 &&
-+ ( sense_data[13] == 0xb || sense_data[13] == 0x00) ) {
-+ if(wait_for_transition)
-+ *wait_for_transition = 0;
-+ rval = 1;
-+ break;
-+ }
-+ }
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && --retry);
-+
-+ if (rval == QLA_SUCCESS && retry &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (sense_data[2] == NOT_READY && sense_data[12] == 0x4 &&
-+ sense_data[13] == 0x2)) && comp_status == CS_COMPLETE)) {
-+
-+ DEBUG2(printk("scsi(%ld) %s - Lun (0x%02x:%d) set to ACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id, lun));
-+
-+ /* We found an active path */
-+ fclun->flags |= FLF_ACTIVE_LUN;
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk("scsi(%ld) %s - Lun (0x%02x:%d) set to "
-+ "INACTIVE.\n", ha->host_no, __func__, fcport->loop_id,
-+ lun));
-+ /* fcport->flags &= ~(FC_MSA_PORT_ACTIVE); */
-+ fclun->flags &= ~(FLF_ACTIVE_LUN);
-+ rval = 0;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, tur, tur_dma);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+static fc_lun_t *
-+qla2x00_find_data_lun(fc_port_t *fcport)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_lun_t *fclun, *ret_fclun;
-+
-+ ha = fcport->ha;
-+ ret_fclun = NULL;
-+
-+ /* Go thur all luns and find a good data lun */
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ fclun->flags &= ~FLF_VISIBLE_LUN;
-+ if (fclun->device_type == 0xff)
-+ qla2x00_issue_scsi_inquiry(ha, fcport, fclun);
-+ if (fclun->device_type == 0xc)
-+ fclun->flags |= FLF_VISIBLE_LUN;
-+ else if (fclun->device_type == TYPE_DISK) {
-+ ret_fclun = fclun;
-+ }
-+ }
-+ return (ret_fclun);
-+}
-+
-+/*
-+ * qla2x00_test_active_port
-+ * Determines if the port is in active or standby mode. First, we
-+ * need to locate a storage lun then do a TUR on it.
-+ *
-+ * Input:
-+ * fcport = port structure pointer.
-+ *
-+ *
-+ * Return:
-+ * 0 - Standby or error
-+ * 1 - Active
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_test_active_port(fc_port_t *fcport)
-+{
-+ int rval = 0 ;
-+ int retry;
-+ scsi_qla_host_t *ha;
-+ uint16_t lun = 0;
-+ fc_lun_t *fclun;
-+ tur_cmd_rsp_t *tur;
-+ dma_addr_t tur_dma;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ ENTER(__func__);
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fcport->loop_id));
-+ return rval;
-+ }
-+
-+ if ((fclun = qla2x00_find_data_lun(fcport)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s leaving: Couldn't find data lun\n",
-+ __func__));
-+ return rval;
-+ }
-+ lun = fclun->lun;
-+
-+ tur = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tur_dma);
-+ if (tur == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TUR\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &tur->p.rsp24.comp_status;
-+ sstatus = &tur->p.rsp24.scsi_status;
-+ sense_data = tur->p.rsp24.data;
-+ } else {
-+ cstatus = &tur->p.rsp.comp_status;
-+ sstatus = &tur->p.rsp.scsi_status;
-+ sense_data = tur->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 4;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(tur, 0, sizeof(tur_cmd_rsp_t));
-+ tur->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ tur->p.cmd24.entry_count = 1;
-+ tur->p.cmd24.nport_handle =
-+ cpu_to_le16(fcport->loop_id);
-+ tur->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ tur->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ tur->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ tur->p.cmd24.lun[1] = LSB(lun);
-+ tur->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(tur->p.cmd24.lun,
-+ sizeof(tur->p.cmd24.lun));
-+ tur->p.cmd24.task = TSK_SIMPLE;
-+ tur->p.cmd24.fcp_cdb[0] = TEST_UNIT_READY;
-+ host_to_fcp_swap(tur->p.cmd24.fcp_cdb,
-+ sizeof(tur->p.cmd24.fcp_cdb));
-+ tur->p.cmd24.dseg_count = __constant_cpu_to_le16(0);
-+ tur->p.cmd24.timeout = __constant_cpu_to_le16(3);
-+ tur->p.cmd24.byte_count = __constant_cpu_to_le32(0);
-+ } else {
-+ memset(tur, 0, sizeof(tur_cmd_rsp_t));
-+ tur->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ tur->p.cmd.entry_count = 1;
-+ tur->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, tur->p.cmd.target, fcport->loop_id);
-+ tur->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_SIMPLE_TAG);
-+ tur->p.cmd.scsi_cdb[0] = TEST_UNIT_READY;
-+ tur->p.cmd.dseg_count = __constant_cpu_to_le16(0);
-+ tur->p.cmd.timeout = __constant_cpu_to_le16(3);
-+ tur->p.cmd.byte_count = __constant_cpu_to_le32(0);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, tur, tur_dma,
-+ sizeof(tur_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && tur->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) TUR failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ tur->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: TEST UNIT READY - comp "
-+ "status 0x%x, scsi status 0x%x, rval=%d\n", ha->host_no,
-+ fcport->loop_id, lun,__func__, comp_status, scsi_status,
-+ rval));
-+ if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(tur->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ tur->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__, sense_data[2],
-+ sense_data[12], sense_data[13]));
-+
-+ if (sense_data[2] == NOT_READY &&
-+ sense_data[12] == 0x4 && sense_data[13] == 0x2)
-+ break;
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && --retry);
-+
-+ if (rval == QLA_SUCCESS && retry &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (sense_data[2] == NOT_READY && sense_data[12] == 0x4 &&
-+ sense_data[13] == 0x2)) && comp_status == CS_COMPLETE)) {
-+ DEBUG2(printk("scsi(%ld) %s - Port (0x%04x) set to ACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id));
-+ /* We found an active path */
-+ fcport->flags |= FC_MSA_PORT_ACTIVE;
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk("scsi(%ld) %s - Port (0x%04x) set to INACTIVE.\n",
-+ ha->host_no, __func__, fcport->loop_id));
-+ fcport->flags &= ~(FC_MSA_PORT_ACTIVE);
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, tur, tur_dma);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+/*
-+ * Enable Auto Restore enables auto failback capability.
-+ */
-+static inline void
-+qla2x00_enable_auto_restore(fc_port_t *fcport)
-+{
-+ if (fcport->cfg_id == -1){
-+ DEBUG2(printk("%s(%ld) this device: loop_id=0x%x is not in"
-+ " the cfg_device_list[] database\n", __func__,
-+ fcport->ha->host_no, fcport->loop_id));
-+ return;
-+ }
-+
-+ if (fcport->flags & (FC_MSA_DEVICE | FC_EVA_DEVICE)) {
-+ DEBUG2(printk("%s(%ld) support disabled for MSA/EVA"
-+ " Active/Passive device\n", __func__,
-+ fcport->ha->host_no));
-+ return;
-+ }
-+
-+ if (cfg_device_list[fcport->cfg_id].flags & ql2xautorestore) {
-+ if ( fcport->flags & FC_FAILBACK_DISABLE)
-+ fcport->flags &= ~FC_FAILBACK_DISABLE;
-+ else
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ DEBUG2(printk("%s(%ld): enabled autorestore for loop_id=0x%x "
-+ "fcport_flags=0x%x\n", __func__, fcport->ha->host_no,
-+ fcport->loop_id, fcport->flags));
-+ }
-+
-+}
-+
-+
-+void
-+qla2x00_set_device_flags(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ if (fcport->cfg_id == -1)
-+ return;
-+
-+ fcport->flags &= ~(FC_XP_DEVICE|FC_MSA_DEVICE|FC_EVA_DEVICE|
-+ FC_DSXXX_DEVICE | FC_AA_EVA_DEVICE |
-+ FC_DFXXX_DEVICE | FC_AA_MSA_DEVICE |
-+ FC_NVSXXX_DEVICE| FC_SYMXXX_DEVICE);
-+ if ((cfg_device_list[fcport->cfg_id].flags & BIT_0)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an XP device\n", ha->host_no,
-+ fcport->loop_id);
-+ fcport->flags |= FC_XP_DEVICE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_1)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is a MSA1000 device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_MSA_DEVICE;
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_2)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is a EVA device\n", ha->host_no,
-+ fcport->loop_id);
-+ fcport->flags |= FC_EVA_DEVICE;
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_4)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an DSXXX device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_DSXXX_DEVICE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_5)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an EVA_XL (AA) device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_AA_EVA_DEVICE;
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_7)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an MSA (AA) device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_AA_MSA_DEVICE;
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_8)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an DF700 device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_DFXXX_DEVICE;
-+ fcport->fo_target_port = qla2x00_get_vol_access_path;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_9)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an NVS1000 device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_NVSXXX_DEVICE;
-+ fcport->flags |= FC_FAILBACK_DISABLE;
-+ } else if ((cfg_device_list[fcport->cfg_id].flags & BIT_10)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x is an SYMXXX device\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_SYMXXX_DEVICE;
-+ }
-+
-+ if ((cfg_device_list[fcport->cfg_id].flags & 8)) {
-+ printk(KERN_INFO
-+ "scsi(%ld) :Loop id 0x%04x has FAILOVERS disabled.\n",
-+ ha->host_no, fcport->loop_id);
-+ fcport->flags |= FC_FAILOVER_DISABLE;
-+ }
-+
-+ /* Enable Failback for the devices specified
-+ * on the cmd line.
-+ */
-+ qla2x00_enable_auto_restore(fcport);
-+}
-+
-+
-+static int
-+qla2x00_configure_cfg_device(fc_port_t *fcport)
-+{
-+ int id = fcport->cfg_id;
-+ int exclude = 0;
-+
-+ DEBUG3(printk("Entering %s - id= %d\n", __func__, fcport->cfg_id));
-+
-+ if (fcport->cfg_id == -1)
-+ return 0;
-+
-+ /* Set any notify options */
-+ if (cfg_device_list[id].notify_type != FO_NOTIFY_TYPE_NONE) {
-+ fcport->notify_type = cfg_device_list[id].notify_type;
-+ }
-+
-+ DEBUG3(printk("%s - Configuring device \n", __func__));
-+
-+ fcport->fo_combine = cfg_device_list[id].fo_combine;
-+
-+ /* For some device we fake target port group support.
-+ * This points to vendor specific implementation -
-+ * for ex: qla2x00_get_vol_access_path() etc.
-+ * So it may be already set.
-+ */
-+ if(fcport->fo_target_port == NULL)
-+ fcport->fo_target_port = cfg_device_list[id].fo_target_port;
-+
-+ /* Disable failover capability if needed and return */
-+ if (ql2xexcludemodel) {
-+ if ((ql2xexcludemodel & BIT_0) &&
-+ (fcport->flags & FC_XP_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_1) &&
-+ (fcport->flags & FC_MSA_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_2) &&
-+ (fcport->flags & FC_EVA_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_4) &&
-+ (fcport->flags & FC_DSXXX_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_5) &&
-+ (fcport->flags & FC_AA_EVA_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_7) &&
-+ (fcport->flags & FC_AA_MSA_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_8) &&
-+ (fcport->flags & FC_DFXXX_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_9) &&
-+ (fcport->flags & FC_NVSXXX_DEVICE)) {
-+ exclude++;
-+ } else if ((ql2xexcludemodel & BIT_10) &&
-+ (fcport->flags & FC_SYMXXX_DEVICE)) {
-+ exclude++;
-+ }
-+ if (exclude) {
-+ printk(KERN_INFO
-+ "scsi(%ld): Excluding Loopid 0x%04x as a "
-+ "failover capable device.\n",
-+ fcport->ha->host_no, fcport->loop_id);
-+
-+ fcport->flags |= FC_FAILOVER_DISABLE;
-+ fcport->fo_combine = qla2x00_export_target;
-+ fcport->fo_target_port = NULL;
-+ }
-+ }
-+
-+ DEBUG3(printk("Exiting %s - id= %d\n", __func__, fcport->cfg_id));
-+
-+ return 1;
-+}
-+
-+
-+/*
-+ * qla2x00_get_lbtype
-+ *
-+ * get the lbtype and set in the dp
-+ */
-+static void
-+qla2x00_get_lbtype(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+ int lbtype, i;
-+ uint8_t *propbuf;
-+ uint8_t nn[WWN_SIZE];
-+ mp_device_t *dp; /* virtual device pointer */
-+
-+ if (!ql2xdevconf)
-+ return;
-+
-+ propbuf = kmalloc(LINESIZE, GFP_KERNEL);
-+ if (!propbuf)
-+ return;
-+
-+ for (lbtype = 0; lbtype <= LB_LRU_BYTES; lbtype++) {
-+ for (i = 0; i < 256; i++) {
-+ sprintf(propbuf, "scsi-lbtype-%d-key%d-tgtname", lbtype,i );
-+ rval = qla2x00_get_prop_xstr(ha, propbuf, nn, WWN_SIZE);
-+ if (rval != WWN_SIZE) {
-+ continue;
-+ }
-+ if((dp = qla2x00_find_dp_from_all_hosts(nn)) != NULL ) {
-+ dp->lbtype = lbtype;
-+ }
-+ }
-+ }
-+ kfree(propbuf);
-+}
-+
-+/*
-+ * qla2x00_cfg_init
-+ * Initialize configuration structures to handle an instance of
-+ * an HBA, QLA2x000 card.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_cfg_init(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+
-+ ENTER("qla2x00_cfg_init");
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ mp_initialized = 1;
-+ /* First HBA, initialize the failover global properties */
-+ qla2x00_fo_init_params(ha);
-+
-+ down(&mp_hosts_lock);
-+ /*
-+ * If the user specified a device configuration then it is use as the
-+ * configuration. Otherwise, we wait for path discovery.
-+ */
-+ if (mp_config_required)
-+ qla2x00_cfg_build_path_tree(ha);
-+
-+ /* Get all the LB Type */
-+ qla2x00_get_lbtype(ha);
-+
-+ rval = qla2x00_cfg_path_discovery(ha);
-+ up(&mp_hosts_lock);
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla2x00_cfg_init");
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_cfg_path_discovery
-+ * Discover the path configuration from the device configuration
-+ * for the specified host adapter and build the path search tree.
-+ * This function is called after the lower level driver has
-+ * completed its port and lun discovery.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_cfg_path_discovery(scsi_qla_host_t *ha)
-+{
-+ int rval = QLA_SUCCESS;
-+ mp_host_t *host;
-+
-+ ENTER("qla2x00_cfg_path_discovery");
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ /* Initialize the path tree for this adapter */
-+ host = qla2x00_find_host_by_portname(ha->port_name);
-+ if (mp_config_required) {
-+ if (host == NULL ) {
-+ DEBUG4(printk("cfg_path_discovery: host not found, "
-+ "port port_name = "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ ha->port_name[0], ha->port_name[1],
-+ ha->port_name[2], ha->port_name[3],
-+ ha->port_name[4], ha->port_name[5],
-+ ha->port_name[6], ha->port_name[7]));
-+ rval = QLA_FUNCTION_FAILED;
-+ } else if (ha->instance != host->instance) {
-+ DEBUG4(printk("cfg_path_discovery: host instance "
-+ "don't match - instance=%ld.\n",
-+ ha->instance));
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+ } else if (host == NULL) {
-+ /* New host adapter so allocate it */
-+ DEBUG3(printk("%s: found new ha inst %ld. alloc host.\n",
-+ __func__, ha->instance));
-+ if ( (host = qla2x00_alloc_host(ha)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla2x00(%d): Couldn't allocate "
-+ "host - ha = %p.\n",
-+ (int)ha->instance, ha);
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+ }
-+
-+ /* Fill in information about host */
-+ if (host != NULL ) {
-+ host->flags |= MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->flags |= MP_HOST_FLAG_LUN_FO_ENABLED;
-+ host->fcports = &ha->fcports;
-+
-+ /* Check if multipath is enabled */
-+ DEBUG3(printk("%s: updating mp host for ha inst %ld.\n",
-+ __func__, ha->instance));
-+ if (!qla2x00_update_mp_host(host)) {
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+ host->flags &= ~MP_HOST_FLAG_LUN_FO_ENABLED;
-+ }
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("qla2x00_path_discovery: Exiting FAILED\n"));
-+ } else {
-+ LEAVE("qla2x00_cfg_path_discovery");
-+ }
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_cfg_event_notifiy
-+ * Callback for host driver to notify us of configuration changes.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * i_type = event type
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_cfg_event_notify(scsi_qla_host_t *ha, uint32_t i_type)
-+{
-+ mp_host_t *host; /* host adapter pointer */
-+
-+ ENTER("qla2x00_cfg_event_notify");
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ switch (i_type) {
-+ case MP_NOTIFY_RESET_DETECTED:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_RESET_DETECTED "
-+ "- no action\n",
-+ ha->host_no));
-+ break;
-+ case MP_NOTIFY_PWR_LOSS:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_PWR_LOSS - "
-+ "update tree\n",
-+ ha->host_no));
-+ /*
-+ * Update our path tree in case we are
-+ * losing the adapter
-+ */
-+ down(&mp_hosts_lock);
-+ qla2x00_update_mp_tree();
-+ up(&mp_hosts_lock);
-+ break;
-+ case MP_NOTIFY_LOOP_UP:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_LOOP_UP - "
-+ "update host tree\n",
-+ ha->host_no));
-+ /* Adapter is back up with new configuration */
-+ if ((host = qla2x00_cfg_find_host(ha)) != NULL) {
-+ host->flags |= MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->fcports = &ha->fcports;
-+ set_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ down(&mp_hosts_lock);
-+ qla2x00_update_mp_tree();
-+ up(&mp_hosts_lock);
-+ clear_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ }
-+ break;
-+ case MP_NOTIFY_LOOP_DOWN:
-+ case MP_NOTIFY_BUS_RESET:
-+ DEBUG(printk("scsi%ld: MP_NOTIFY_OTHERS - "
-+ "no action\n",
-+ ha->host_no));
-+ break;
-+ default:
-+ break;
-+
-+ }
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla2x00_cfg_event_notify");
-+
-+ return QLA_SUCCESS;
-+}
-+
-+void
-+qla2x00_cfg_select_route(srb_t *sp)
-+{
-+ mp_lun_t *mplun;
-+ struct list_head *list, *temp;
-+ fc_lun_t *tmp_fclun, *fclun;
-+ lu_path_t *lun_path;
-+ int i;
-+
-+ DEBUG3(printk("qla2x00_cfg_select_route() sp=%p, fclun=%p\n",
-+ sp, sp->fclun));
-+
-+ if( (fclun = sp->fclun) == NULL )
-+ return;
-+
-+ mplun = (mp_lun_t *)fclun->mplun;
-+ if( mplun != NULL )
-+ {
-+ DEBUG3(printk("qla2x00_cfg_select_route(%ld) pid=%ld mplun=%p, fclun=%p, "
-+ "lun %d, port= %02x, active cnt=%d, pathid=%d, dest ha =%ld, type=%d, %d\n",
-+ sp->ha->host_no, sp->cmd->serial_number,fclun->mplun,fclun,mplun->number,
-+ fclun->fcport->loop_id,
-+ mplun->act_cnt,mplun->active,
-+ fclun->fcport->ha->host_no, mplun->dp->lbtype,
-+ mplun->load_balance_type));
-+ switch (mplun->load_balance_type) {
-+ case LB_RR:
-+ i = 0;
-+#ifdef NOT_TESTED
-+ list_for_each_safe(list, temp, &mplun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ tmp_fclun = lun_path->fclun;
-+ if( mplun->active == i ) {
-+ fclun = tmp_fclun;
-+ DEBUG3(printk("%s:RR - selecting"
-+ " fclun %p, index %d ...\n",
-+ __func__,fclun,mplun->active));
-+ /* next path */
-+ mplun->active = lun_path->path_id;
-+ break;
-+ }
-+ i++;
-+ }
-+ /* point to next path */
-+ if( mplun->active > mplun->act_cnt )
-+ mplun->active = 0;
-+#endif
-+ break;
-+
-+ case LB_LRU:
-+ list_for_each_safe(list, temp, &mplun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ tmp_fclun = lun_path->fclun;
-+ if( tmp_fclun == fclun )
-+ continue;
-+ DEBUG3(printk("%s:LRU - selecting fclun"
-+ " %p, path_id=%d, cmp= %ld < %ld ...\n",
-+ __func__,tmp_fclun,lun_path->path_id,
-+ tmp_fclun->io_cnt,fclun->io_cnt));
-+ if (tmp_fclun->io_cnt < fclun->io_cnt) {
-+ fclun = tmp_fclun;
-+ mplun->active = lun_path->path_id;
-+ DEBUG3(printk("%s:LRU - CHANGED to pathid=%d"
-+ " fclun %p, cmp= %ld < %ld port %02x...\n",
-+ __func__,lun_path->path_id,tmp_fclun,
-+ tmp_fclun->io_cnt,fclun->io_cnt,tmp_fclun->fcport->loop_id));
-+ }
-+ }
-+ break;
-+
-+ case LB_LST:
-+ list_for_each_safe(list, temp, &mplun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ tmp_fclun = lun_path->fclun;
-+ if( tmp_fclun == fclun )
-+ continue;
-+ DEBUG3(printk("%s:LST - selecting fclun %p, path_id=%d,"
-+ " cmp= %ld < %ld ...\n",
-+ __func__,tmp_fclun,lun_path->path_id,
-+ tmp_fclun->io_cnt,fclun->io_cnt));
-+ if (time_before(tmp_fclun->s_time,
-+ fclun->s_time)) {
-+ fclun = tmp_fclun;
-+ mplun->active = lun_path->path_id;
-+ DEBUG3(printk("%s:LST - SELECTED pathid=%d"
-+ " fclun %p, cmp= %ld < %ld port %02x...\n",
-+ __func__,lun_path->path_id,tmp_fclun,
-+ tmp_fclun->io_cnt,fclun->io_cnt,
-+ tmp_fclun->fcport->loop_id));
-+ }
-+ }
-+ break;
-+
-+ default:
-+ DEBUG3(printk("%s: - Selected default: fclun %p ...\n",__func__,fclun));
-+ return ;
-+ }
-+ }
-+ /* if we change fclun ptrs then update everything */
-+ if( fclun != sp->fclun )
-+ {
-+ sp->lun_queue->fclun = fclun;
-+ DEBUG3(printk("%s:Changing to fclun %p from %p...\n",__func__,
-+ fclun,sp->fclun));
-+ sp->fclun = fclun;
-+ sp->ha = fclun->fcport->ha;
-+ }
-+}
-+
-+
-+
-+
-+static int
-+qla2x00_chg_lun_to_preferred_path(scsi_qla_host_t *ha, mp_lun_t *mplun, int id)
-+{
-+ mp_device_t *dp;
-+ lu_path_t *lu_path;
-+ mp_path_t *path, *old_path;
-+ fc_lun_t *fclun;
-+
-+ if ( mplun == NULL ) {
-+ return 0;
-+ }
-+
-+ DEBUG(printk("scsi%ld: %s : mplun %d preferred via configuration - id "
-+ "%d \n", ha->host_no, __func__, mplun->number, id));
-+ dp = mplun->dp;
-+ if( (path = qla2x00_find_path_by_id(dp, id)) == NULL )
-+ return 0;
-+ /* get fclun for this path */
-+ if ( (fclun = mplun->paths[id]) == NULL )
-+ return 0;
-+
-+ if( path->port == NULL )
-+ return 0;
-+
-+ if( (fclun->flags & FLF_VISIBLE_LUN) ) {
-+ DEBUG2(printk("scsi%ld: %s : mplun %d Skipping "
-+ "controller lun in conf\n"
-+ , ha->host_no, __func__, mplun->number));
-+ return 0;
-+ }
-+
-+ /* Is this path on an active controller? */
-+ /* Is this path on an active controller? */
-+ if( (path->port->flags & FC_EVA_DEVICE) &&
-+ (fclun->flags & FLF_ACTIVE_LUN) ){
-+ return 0;
-+ }
-+
-+ if( (path->port->flags & FC_MSA_DEVICE) &&
-+ (path->port->flags & FC_MSA_PORT_ACTIVE) ) {
-+ return 0;
-+ }
-+ /* Is this path on the OPT controller? */
-+ if (path->port->fo_target_port) {
-+ lu_path = qla2x00_find_lu_path_by_id(mplun,id);
-+ if( lu_path == NULL )
-+ return 0;
-+ if (lu_path->asym_acc_state == TPG_ACT_OPT)
-+ return 0;
-+ old_path = qla2x00_find_first_path_to_active_tpg(dp, mplun, 0);
-+ } else {
-+ old_path = qla2x00_find_first_active_path(dp, mplun);
-+ }
-+ if ( old_path == NULL )
-+ return 0;
-+ DEBUG(printk("scsi%ld: %s : mplun %d SWITCHING from id=%d to "
-+ "preferred path id=%d\n", ha->host_no, __func__, mplun->number,
-+ old_path->id, id));
-+
-+ qla2x00_send_failover_notify(dp, mplun->number, path, old_path);
-+ return 1;
-+}
-+
-+static int
-+qla2x00_set_preferred_path(mp_lun_t *mplun, int order, int flag)
-+{
-+ mp_device_t *dp;
-+ lu_path_t *lun_path;
-+ struct list_head *list, *temp;
-+ int paths_cnt = 0, path_id, path_order;
-+ mp_path_t *path, *oldpath;
-+ int id;
-+ fc_lun_t *fclun;
-+
-+ DEBUG(printk("%s entered\n",__func__));
-+
-+ if ( mplun == NULL ) {
-+ return 0;
-+ }
-+
-+ dp = mplun->dp;
-+ path_id = PATH_INDEX_INVALID;
-+ if (mplun->asymm_support == TGT_PORT_GRP_UNSUPPORTED) {
-+ /* We always have the first path */
-+ if ( (fclun = mplun->paths[0]) != NULL ) {
-+ if ( !(fclun->fcport->flags & FC_AA_EVA_DEVICE) &&
-+ !(fclun->fcport->flags & FC_DFXXX_DEVICE))
-+ return 0;
-+ }
-+ }
-+
-+ id = mplun->pref_path_id;
-+ /* we have a preferred setting from the qla2xxx.conf file, so use it */
-+ if ( flag ) {
-+ path = qla2x00_find_path_by_id(dp, mplun->config_pref_id);
-+ if (path) {
-+ if (id != PATH_INDEX_INVALID) {
-+ oldpath = qla2x00_find_path_by_id(dp,
-+ id);
-+ if (oldpath) {
-+ oldpath->lun_data.data[
-+ mplun->number] &=
-+ ~LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk("%s Removing "
-+ "previous preferred "
-+ "setting for id=%d\n",
-+ __func__, id));
-+ }
-+ }
-+ path_id = path->id;
-+ path->lun_data.data[mplun->number] |= LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk( "%s: Found (preferred config) preferred lun lun=%d,"
-+ " pathid=%d\n", __func__, mplun->number,
-+ path->id));
-+ } else {
-+ printk( KERN_INFO "%s: Could use conf preferred setting lun=%d,"
-+ " pathid=%d\n", __func__, mplun->number, id);
-+ goto set_preferred_def;
-+ }
-+ goto set_preferred_end;
-+ }
-+
-+ switch (mplun->load_balance_type) {
-+
-+ case LB_STATIC: /* distrubute luns across all active-optmisied paths */
-+ if( id != PATH_INDEX_INVALID ) {
-+ if( (path = qla2x00_find_path_by_id(dp, id)) ) {
-+ path->lun_data.data[mplun->number] &= ~LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk("%s Removing previous preferred setting for id=%d\n",
-+ __func__, id));
-+ }
-+ }
-+ /* Determine how many active paths we have */
-+ paths_cnt = 0;
-+ list_for_each_safe(list, temp, &mplun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ paths_cnt++;
-+ }
-+
-+ if (paths_cnt == 0 ) {
-+ printk(KERN_INFO "%s no active_path\n",__func__);
-+ goto set_preferred_def;
-+ // return 0;
-+ } else
-+ DEBUG5(printk("%s active_path_cnt=%d\n",__func__, paths_cnt));
-+
-+ path_order = order % paths_cnt;
-+ paths_cnt = 0;
-+ list_for_each_safe(list, temp, &mplun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ if (paths_cnt == path_order) {
-+ path_id = lun_path->path_id;
-+ if( (path = qla2x00_find_path_by_id( dp, path_id)) ) {
-+ DEBUG2(printk( "%s: 1. Found preferred lun lun=%d,"
-+ " pathid=%d\n", __func__, mplun->number,
-+ path->id));
-+ path->lun_data.data[mplun->number] |= LUN_DATA_PREFERRED_PATH;
-+ } else
-+ printk(KERN_INFO "%s could not find path=%p for id=%d\n",
-+ __func__, path,path_id);
-+ break;
-+ }
-+ paths_cnt++;
-+ }
-+
-+ break;
-+
-+ case LB_NONE:
-+ case LB_LRU:
-+ case LB_LST:
-+ case LB_RR:
-+ case LB_LRU_BYTES:
-+set_preferred_def:
-+ /* default is first active path */
-+ path = qla2x00_find_first_path_to_active_tpg(dp, mplun, 1);
-+ if (path) {
-+ if (id != PATH_INDEX_INVALID) {
-+ oldpath = qla2x00_find_path_by_id(dp,
-+ id);
-+ if (oldpath) {
-+ oldpath->lun_data.data[
-+ mplun->number] &=
-+ ~LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk("%s Removing "
-+ "previous preferred "
-+ "setting for id=%d\n",
-+ __func__, id));
-+ }
-+ }
-+ path_id = path->id;
-+ path->lun_data.data[mplun->number] |= LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk( "%s: Found preferred lun lun=%d,"
-+ " pathid=%d\n", __func__, mplun->number,
-+ path->id));
-+ break;
-+ } else {
-+ DEBUG(printk("%s could not find an active path=%p\n",
-+ __func__, path));
-+ }
-+ default:
-+ path = qla2x00_find_first_active_path(dp, mplun);
-+ if (path) {
-+ path_id = path->id;
-+ path->lun_data.data[mplun->number] |= LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk( "%s: Found preferred lun lun=%d,"
-+ " pathid=%d\n", __func__, mplun->number,
-+ path->id));
-+ }
-+ }
-+
-+set_preferred_end:
-+ dp->path_list->current_path[mplun->number] = path_id;
-+ mplun->pref_path_id = path_id;
-+ DEBUG2(printk("%s lun=%d path_id=%d lb_type=%d order=%d "
-+ "paths_cnt=%d\n",__func__, mplun->number, path_id,
-+ mplun->load_balance_type, order, paths_cnt));
-+ DEBUG3(printk("%s leaving\n", __func__));
-+
-+ return 1;
-+}
-+
-+
-+int
-+qla2x00_cfg_remap(scsi_qla_host_t *halist)
-+{
-+ scsi_qla_host_t *ha;
-+
-+ mp_initialized = 1;
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ DEBUG2(printk("Entering %s ...\n",__func__));
-+ /* Find the host that was specified */
-+ set_bit(CFG_FAILOVER, &ha->cfg_flags);
-+ qla2x00_cfg_path_discovery(ha);
-+ clear_bit(CFG_FAILOVER, &ha->cfg_flags);
-+
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+ mp_initialized = 0;
-+ DEBUG2(printk("Exiting %s ...\n",__func__));
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla2x00_allocate_mp_port
-+ * Allocate an fc_mp_port, clear the memory, and log a system
-+ * error if the allocation fails. After fc_mp_port is allocated
-+ *
-+ */
-+static mp_port_t *
-+qla2x00_allocate_mp_port(uint8_t *portname)
-+{
-+ mp_port_t *port;
-+ int i;
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ port = kmalloc(sizeof(mp_port_t), GFP_KERNEL);
-+ if (!port)
-+ return NULL;
-+ memset(port, 0, sizeof(*port));
-+
-+ DEBUG(printk("%s: mp_port_t allocated at %p\n",
-+ __func__, port));
-+
-+ /*
-+ * Since this is the first port, it goes at
-+ * index zero.
-+ */
-+ if (portname)
-+ {
-+ DEBUG3(printk("%s: copying port name %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ __func__, portname[0], portname[1],
-+ portname[2], portname[3], portname[4],
-+ portname[5], portname[6], portname[7]));
-+ memcpy(&port->portname[0], portname, PORT_NAME_SIZE);
-+ }
-+ for ( i = 0 ;i < MAX_HOSTS; i++ ) {
-+ port->path_list[i] = PATH_INDEX_INVALID;
-+ }
-+ port->fo_cnt = 0;
-+
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+
-+ return port;
-+}
-+
-+static mp_port_t *
-+qla2x00_find_port_by_name(mp_lun_t *mplun,
-+ mp_path_t *path)
-+{
-+ mp_port_t *port = NULL;
-+ mp_port_t *temp_port;
-+ struct list_head *list, *temp;
-+
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ temp_port = list_entry(list, mp_port_t, list);
-+ if (memcmp(temp_port->portname, path->portname, WWN_SIZE) == 0) {
-+ port = temp_port;
-+ break;
-+ }
-+ }
-+ return port;
-+}
-+
-+
-+static mp_port_t *
-+qla2x00_find_or_allocate_port(mp_host_t *host, mp_lun_t *mplun,
-+ mp_path_t *path)
-+{
-+ mp_port_t *port = NULL;
-+ struct list_head *list, *temp;
-+ unsigned long instance = host->instance;
-+
-+ DEBUG3(printk("%s entered\n",__func__));
-+
-+ if (instance == MAX_HOSTS - 1) {
-+ printk(KERN_INFO "%s: Fail no room\n", __func__);
-+ return NULL;
-+ }
-+
-+ if (mplun == NULL) {
-+ return NULL;
-+ }
-+
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ port = list_entry(list, mp_port_t, list);
-+ if ( memcmp(port->portname, path->portname, WWN_SIZE) == 0 ) {
-+ if ( port->path_list[instance] == PATH_INDEX_INVALID ) {
-+ DEBUG(printk("scsi%ld %s: Found matching mp port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ instance, __func__, port->portname[0], port->portname[1],
-+ port->portname[2], port->portname[3],
-+ port->portname[4], port->portname[5],
-+ port->portname[6], port->portname[7]));
-+ port->path_list[instance] = path->id;
-+ port->hba_list[instance] = host->ha;
-+ port->cnt++;
-+ DEBUG(printk("%s: adding portname - port[%d] = "
-+ "%p at index = %d with path id %d\n",
-+ __func__, (int)instance ,port,
-+ (int)instance, path->id));
-+ }
-+ return port;
-+ }
-+ }
-+ port = qla2x00_allocate_mp_port(path->portname);
-+ if (port) {
-+ port->cnt++;
-+ DEBUG(printk("%s: allocate and adding portname - port[%d] = "
-+ "%p at index = %d with path id %d\n",
-+ __func__, (int)instance, port,
-+ (int)instance, path->id));
-+ port->path_list[instance] = path->id;
-+ port->hba_list[instance] = host->ha;
-+ /* add port to list */
-+ list_add_tail(&port->list,&mplun->ports_list );
-+ port->flags = MP_NO_REL_TPORT_ID;
-+ }
-+ DEBUG3(printk("%s exit port=%p\n",__func__,port));
-+ return port;
-+}
-+
-+/* Find or allocates target port group and adds mp_port to it so. */
-+static mp_tport_grp_t *
-+qla2x00_find_or_allocate_tgt_port_grp(mp_host_t *host, mp_port_t *port,
-+ fc_lun_t *fclun, mp_path_t *path)
-+{
-+ uint8_t rel_tport_id[2];
-+ uint8_t tpg_id[2];
-+ uint16_t len;
-+ char wwulnbuf[WWULN_SIZE];
-+ mp_tport_grp_t *tport_grp = NULL;
-+ mp_lun_t *mplun = fclun->mplun;
-+ struct list_head *list, *temp;
-+ unsigned long instance = host->instance;
-+ uint8_t cur_vol_path_own;
-+ int ret;
-+
-+ DEBUG3(printk("%s entered\n",__func__));
-+
-+ if( instance == MAX_HOSTS - 1) {
-+ printk(KERN_INFO "%s: Fail no room\n", __func__);
-+ return NULL;
-+ }
-+
-+ if ( mplun == NULL ) {
-+ return NULL;
-+ }
-+ DEBUG(printk("%s(%ld) entered\n",__func__,instance));
-+ if (fclun->asymm_support != TGT_PORT_GRP_UNSUPPORTED) {
-+ len = qla2x00_get_wwuln_from_device(host, fclun,
-+ &wwulnbuf[0], WWULN_SIZE, &rel_tport_id[0] , &tpg_id[0]);
-+
-+ DEBUG5(printk("scsi(%ld): tpg_id[0]:0x%x tpg_id[1]:0x%x "
-+ "rtport_id[0]:0x%x rtport_id[1]:0x%x loop_id=0x%x lun=%d\n",
-+ instance, tpg_id[0], tpg_id[1], rel_tport_id[0], rel_tport_id[1],
-+ fclun->fcport->loop_id, fclun->lun));
-+
-+ /* if fail to do the inq then exit */
-+ if( len == 0 ) {
-+ return tport_grp;
-+ }
-+ } else {
-+ /* These targets do not support TPG as of know.
-+ * But we creates dummy TPG for these targets to
-+ * re-use the existing infrastructure of TPG.
-+ * Using the Vol Preferred Path Priority as the TPG ID.
-+ * Rel TPG ID is immaterial. Set it to Zero for right
-+ * know unless there is need for it to be unique.
-+ */
-+ if( (fclun->fcport->flags & FC_DFXXX_DEVICE) ) {
-+ memset(rel_tport_id, 0, sizeof(rel_tport_id));
-+ memset(tpg_id, 0, sizeof(tpg_id));
-+ /* Using Vol Pref Path Priority as TPG_ID */
-+ ret = qla2x00_get_lun_ownership(
-+ host, fclun, &cur_vol_path_own);
-+ if( ret == -1) {
-+ return tport_grp;
-+ } else
-+ tpg_id[1] = ret;
-+ }
-+ }
-+
-+ DEBUG5(printk("scsi(%ld): tpg_id[0]:0x%x tpg_id[1]:0x%x "
-+ "rtport_id[0]:0x%x rtport_id[1]:0x%x loop_id=0x%x lun=%d\n",
-+ instance, tpg_id[0], tpg_id[1], rel_tport_id[0], rel_tport_id[1],
-+ fclun->fcport->loop_id, fclun->lun));
-+
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list) {
-+ tport_grp = list_entry(list, mp_tport_grp_t, list);
-+ if (memcmp(tport_grp->tpg_id, &tpg_id[0], sizeof(tpg_id))
-+ == 0) {
-+ if (port->flags & MP_NO_REL_TPORT_ID) {
-+ DEBUG(printk("scsi%ld %s: Adding mp port"
-+ " %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ instance, __func__, port->portname[0],
-+ port->portname[1], port->portname[2],
-+ port->portname[3],
-+ port->portname[4], port->portname[5],
-+ port->portname[6], port->portname[7]));
-+ DEBUG(printk("%s(%ld): tpg_id[0]=0x%0x tpg_id[1]=0x%0x\n",
-+ __func__,instance,tpg_id[0],tpg_id[1]));
-+ /* add port to list */
-+ memcpy(&port->rel_tport_id[0],&rel_tport_id[0],
-+ sizeof(rel_tport_id));
-+ if (tport_grp->ports_list[path->id] == NULL) {
-+ tport_grp->ports_list[path->id] = port;
-+ DEBUG(printk("Updated tpg ports_list[%d]= %p\n",
-+ path->id, port));
-+ }
-+ port->flags &= ~MP_NO_REL_TPORT_ID;
-+ } else {
-+ DEBUG(printk("%s: found an existing tport_grp=%p tpg_id[0]:0x%x"
-+ " tpg_id[1]:0x%x\n", __func__, tport_grp, tpg_id[0],
-+ tpg_id[1]));
-+ }
-+
-+ return tport_grp;
-+ }
-+ }
-+
-+ /* allocate the target port group */
-+ tport_grp = kmalloc(sizeof(mp_tport_grp_t), GFP_KERNEL);
-+ if (tport_grp == NULL)
-+ return NULL;
-+
-+ memset(tport_grp, 0, sizeof(*tport_grp));
-+ memcpy(&tport_grp->tpg_id[0], &tpg_id[0], sizeof(tpg_id));
-+ list_add_tail(&tport_grp->list,&mplun->tport_grps_list);
-+
-+ DEBUG(printk("scsi(%ld): allocated tpg_id[1]:0x%x rtport_id[1]:0x%x"
-+ " loop_id=0x%x lun=%d\n", instance, tpg_id[1], rel_tport_id[1],
-+ fclun->fcport->loop_id, fclun->lun));
-+
-+ memcpy(&port->rel_tport_id[0], &rel_tport_id[0], sizeof(rel_tport_id));
-+ port->flags &= ~MP_NO_REL_TPORT_ID;
-+ /* Add port to tgt port group list */
-+ if (tport_grp->ports_list[path->id] == NULL) {
-+ tport_grp->ports_list[path->id] = port;
-+ DEBUG2(printk("Updated tpg ports_list[%d]= %p \n",
-+ path->id, port));
-+ }
-+
-+ DEBUG(printk("%s(%ld): Adding mp port"
-+ " %02x%02x%02x%02x%02x%02x%02x%02x to it.\n",__func__, instance,
-+ port->portname[0], port->portname[1], port->portname[2],
-+ port->portname[3], port->portname[4], port->portname[5],
-+ port->portname[6], port->portname[7]));
-+
-+ DEBUG3(printk("%s leaving\n",__func__));
-+
-+ return tport_grp;
-+
-+}
-+
-+/*
-+ * qla2x00_cfg_failover_port
-+ * Failover all the luns on the specified target to
-+ * the new path.
-+ *
-+ * Inputs:
-+ * ha = pointer to host adapter
-+ * fp - pointer to new fc_lun (failover lun)
-+ * tgt - pointer to target
-+ *
-+ * Returns:
-+ *
-+ */
-+static fc_lun_t *
-+qla2x00_cfg_failover_port( mp_host_t *host, mp_device_t *dp,
-+ mp_path_t *new_path, fc_port_t *old_fcport, srb_t *sp)
-+{
-+ uint8_t l;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ fc_lun_t *new_fclun = NULL;
-+ os_lun_t *up;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+
-+ fcport = new_path->port;
-+ if( !qla2x00_test_active_port(fcport) ) {
-+ DEBUG2(printk("%s(%ld): %s - port not ACTIVE "
-+ "to failover: port = %p, loop id= 0x%x\n",
-+ __func__,
-+ host->ha->host_no, __func__, fcport, fcport->loop_id));
-+ return new_fclun;
-+ }
-+
-+ /* Log the failover to console */
-+ printk(KERN_INFO
-+ "qla2x00%d: FAILOVER all LUNS on device %d to WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x, reason=0x%x\n",
-+ (int) host->instance,
-+ (int) dp->dev_id,
-+ old_fcport->port_name[0], old_fcport->port_name[1],
-+ old_fcport->port_name[2], old_fcport->port_name[3],
-+ old_fcport->port_name[4], old_fcport->port_name[5],
-+ old_fcport->port_name[6], old_fcport->port_name[7],
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7], sp->err_id );
-+ printk(KERN_INFO
-+ "qla2x00: FROM HBA %d to HBA %d\n",
-+ (int)old_fcport->ha->instance,
-+ (int)fcport->ha->instance);
-+
-+ /* we failover all the luns on this port */
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ l = fclun->lun;
-+ if( (fclun->flags & FLF_VISIBLE_LUN) ) {
-+ continue;
-+ }
-+ dp->path_list->current_path[l] = new_path->id;
-+ if ((vis_path =
-+ qla2x00_get_visible_path(dp)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla2x00(%d): No visible "
-+ "path for target %d, "
-+ "dp = %p\n",
-+ (int)host->instance,
-+ dp->dev_id, dp);
-+ continue;
-+ }
-+
-+ vis_host = vis_path->host;
-+ up = (os_lun_t *) GET_LU_Q(vis_host->ha,
-+ dp->dev_id, l);
-+ if (up == NULL ) {
-+ DEBUG2(printk("%s: instance %d: No lun queue"
-+ "for target %d, lun %d.. \n",
-+ __func__,(int)vis_host->instance,dp->dev_id,l));
-+ continue;
-+ }
-+
-+ up->fclun = fclun;
-+ fclun->fcport->cur_path = new_path->id;
-+
-+ DEBUG2(printk("%s: instance %d: Mapping target %d:0x%x,"
-+ "lun %d to path id %d\n",
-+ __func__,(int)vis_host->instance,dp->dev_id,
-+ fclun->fcport->loop_id, l,
-+ fclun->fcport->cur_path));
-+
-+ /* issue reset to data luns only */
-+ if( fclun->device_type == TYPE_DISK) {
-+ new_fclun = fclun;
-+ /* send a reset lun command as well */
-+ printk(KERN_INFO
-+ "scsi(%ld:0x%x:%d) sending reset lun \n",
-+ fcport->ha->host_no,
-+ fcport->loop_id, l);
-+ qla2x00_lun_reset(fcport->ha, fcport, l);
-+ }
-+ }
-+ return new_fclun;
-+}
-+
-+int
-+qla2x00_cfg_is_lbenable(fc_lun_t *fclun)
-+{
-+ mp_lun_t *mplun;
-+
-+ if( fclun == NULL )
-+ return 0;
-+ /* Check for non-lunid storages */
-+ mplun = (mp_lun_t *)fclun->mplun;
-+ if( mplun == NULL )
-+ return 0;
-+
-+ DEBUG2(printk( "%s(): load balancing type for path= %d, path cnt=%d\n",
-+ __func__,
-+ mplun->load_balance_type,mplun->act_cnt));
-+ if( mplun->load_balance_type >= LB_LRU ) {
-+ if( mplun->act_cnt > 1 )
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * qla2x00_cfg_failover
-+ * A problem has been detected with the current path for this
-+ * lun. Select the next available path as the current path
-+ * for this device.
-+ *
-+ * Inputs:
-+ * ha = pointer to host adapter
-+ * fp - pointer to failed fc_lun (failback lun)
-+ * tgt - pointer to target
-+ *
-+ * Returns:
-+ * pointer to new fc_lun_t, or NULL if failover fails.
-+ */
-+fc_lun_t *
-+qla2x00_cfg_failover(scsi_qla_host_t *ha, fc_lun_t *fp,
-+ os_tgt_t *tgt, srb_t *sp)
-+{
-+ mp_host_t *host; /* host adapter pointer */
-+ mp_device_t *dp; /* virtual device pointer */
-+ mp_path_t *new_path; /* new path pointer */
-+ fc_lun_t *new_fp = NULL;
-+ fc_port_t *fcport, *new_fcport;
-+ struct osl_fo_info *osl_fo;
-+
-+ ENTER("qla2x00_cfg_failover");
-+ DEBUG2(printk("%s entered\n",__func__));
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ if ((host = qla2x00_cfg_find_host(ha)) != NULL) {
-+ if (test_bit(TQF_USED_ID, &tgt->flags))
-+ dp = qla2x00_find_mp_dev_by_id(host, tgt->id);
-+ else
-+ dp = qla2x00_find_mp_dev_by_nodename(host,
-+ tgt->node_name);
-+ if (dp) {
-+ DEBUG3(printk("qla2x00_cfg_failover: dp = %p\n", dp));
-+ /*
-+ * Point at the next path in the path list if there is
-+ * one, and if it hasn't already been failed over by
-+ * another I/O. If there is only one path continuer
-+ * to point at it.
-+ */
-+ new_path = qla2x00_select_next_path(host, dp,
-+ fp->lun, sp);
-+ if( new_path == NULL ) {
-+ DEBUG2(printk("cfg_failover: Bad new path=%p"
-+ " fp lun= %p\n",
-+ new_path, fp));
-+ goto cfg_failover_done;
-+ }
-+ new_fp = qla2x00_find_matching_lun(fp->lun,
-+ dp, new_path);
-+ if( new_fp == NULL ) {
-+ DEBUG2(printk("cfg_failover: Bad fp - new path=%p, new pathid=%d"
-+ " new fp lun= %p\n",
-+ new_path, new_path->id, new_fp));
-+ goto cfg_failover_done;
-+ }
-+ DEBUG2(printk("cfg_failover: new path=%p, new pathid=%d"
-+ " new fp lun= %p\n",
-+ new_path, new_path->id, new_fp));
-+
-+ fcport = fp->fcport;
-+ if( (fcport->flags & FC_MSA_DEVICE) ) {
-+ /*
-+ * "select next path" has already
-+ * send out the switch path notify
-+ * command, so inactive old path
-+ */
-+ fcport->flags &= ~(FC_MSA_PORT_ACTIVE);
-+ if( qla2x00_cfg_failover_port( host, dp,
-+ new_path, fcport, sp) == NULL ) {
-+ osl_fo = (struct osl_fo_info *)
-+ sp->lun_queue->fo_ptr;
-+ osl_fo->fo_retry_cnt[new_path->id]++;
-+
-+ DEBUG2(printk(KERN_INFO
-+ "scsi(%ld): Fail to failover "
-+ "device - fcport = %p path_id=%d\n",
-+ host->ha->host_no, fcport,
-+ new_path->id));
-+ goto cfg_failover_done;
-+ }
-+ } else if( (fcport->flags & FC_EVA_DEVICE) || fcport->fo_target_port) {
-+ new_fcport = new_path->port;
-+ if ( qla2x00_test_active_lun(
-+ new_fcport, new_fp, NULL ) ) {
-+ qla2x00_cfg_register_failover_lun(dp,
-+ sp, new_fp);
-+ /* send a reset lun command as well */
-+ if (fcport->flags &
-+ (FC_EVA_DEVICE |
-+ FC_AA_EVA_DEVICE)) {
-+ printk(KERN_INFO
-+ "scsi(%ld:0x%x:%d) sending"
-+ "reset lun \n",
-+ new_fcport->ha->host_no,
-+ new_fcport->loop_id,
-+ new_fp->lun);
-+ qla2x00_lun_reset(
-+ new_fcport->ha,
-+ new_fcport, new_fp->lun);
-+ }
-+ } else {
-+ osl_fo = (struct osl_fo_info *)
-+ sp->lun_queue->fo_ptr;
-+ osl_fo->fo_retry_cnt[new_path->id]++;
-+
-+ DEBUG2(printk(
-+ "scsi(%ld): %s Fail to failover lun "
-+ "old fclun= %p, new fclun= %p\n",
-+ host->ha->host_no,
-+ __func__,fp, new_fp));
-+ goto cfg_failover_done;
-+ }
-+ } else { /*default */
-+ DEBUG2(printk(
-+ "scsi(%ld): %s Default failover lun "
-+ "old fclun= %p, new fclun= %p\n",
-+ host->ha->host_no,
-+ __func__,fp, new_fp));
-+ new_fp = qla2x00_find_matching_lun(fp->lun, dp,
-+ new_path);
-+ qla2x00_cfg_register_failover_lun(dp, sp,
-+ new_fp);
-+ }
-+
-+ } else {
-+ printk(KERN_INFO
-+ "qla2x00(%d): Couldn't find device "
-+ "to failover: dp = %p\n",
-+ host->instance, dp);
-+ }
-+ }
-+
-+cfg_failover_done:
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ LEAVE("qla2x00_cfg_failover");
-+
-+ return new_fp;
-+}
-+
-+/*
-+ * IOCTL support
-+ */
-+#define CFG_IOCTL
-+#if defined(CFG_IOCTL)
-+/*
-+ * qla2x00_cfg_get_paths
-+ * Get list of paths EXT_FO_GET_PATHS.
-+ *
-+ * Input:
-+ * ha = pointer to adapter
-+ * bp = pointer to buffer
-+ * cmd = Pointer to kernel copy of EXT_IOCTL.
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ * driver ioctl errors are returned via cmd->Status.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_cfg_get_paths(EXT_IOCTL *cmd, FO_GET_PATHS *bp, int mode)
-+{
-+ int cnt;
-+ int rval = 0;
-+ uint16_t idx;
-+
-+ FO_PATHS_INFO *paths, *u_paths;
-+ FO_PATH_ENTRY *entry;
-+ EXT_DEST_ADDR *sap = &bp->HbaAddr;
-+ mp_host_t *host = NULL; /* host adapter pointer */
-+ mp_device_t *dp; /* virtual device pointer */
-+ mp_path_t *path; /* path pointer */
-+ mp_path_list_t *path_list; /* path list pointer */
-+ scsi_qla_host_t *ha;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ u_paths = (FO_PATHS_INFO *)Q64BIT_TO_PTR(cmd->ResponseAdr, cmd->AddrMode);
-+ ha = qla2x00_get_hba((int)bp->HbaInstance);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk(KERN_INFO "%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (rval);
-+ }
-+ DEBUG9(printk("%s(%ld): found matching ha inst %d.\n",
-+ __func__, ha->host_no, bp->HbaInstance));
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_HBA_INST;
-+ DEBUG4(printk("%s: cannot find target (%ld)\n",
-+ __func__, ha->instance));
-+ DEBUG9_10(printk("%s: cannot find host inst(%ld).\n",
-+ __func__, ha->instance));
-+
-+ return rval;
-+ }
-+ }
-+
-+ paths = kmalloc(sizeof(FO_PATHS_INFO), GFP_KERNEL);
-+ if (paths == NULL) {
-+ DEBUG4(printk("%s: failed to allocate memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_PATHS_INFO)));
-+ DEBUG9_10(printk("%s: failed allocate memory size(%d).\n",
-+ __func__, (int)sizeof(FO_PATHS_INFO)));
-+
-+ cmd->Status = EXT_STATUS_NO_MEMORY;
-+
-+ return -ENOMEM;
-+ }
-+ memset(paths, 0, sizeof(FO_PATHS_INFO));
-+
-+ DEBUG9(printk("%s(%ld): found matching ha inst %d.\n",
-+ __func__, ha->host_no, bp->HbaInstance));
-+
-+ if (!qla2x00_failover_enabled(ha)) {
-+ /* non-fo case. There's only one path. */
-+
-+ mp_path_list_t *ptmp_plist;
-+#define STD_MAX_PATH_CNT 1
-+#define STD_VISIBLE_INDEX 0
-+ int found;
-+ fc_port_t *fcport = NULL;
-+
-+ DEBUG9(printk("%s: non-fo case.\n", __func__));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_plist,
-+ sizeof(mp_path_list_t))) {
-+ /* not enough memory */
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld scrap not big enough. "
-+ "lun_mask requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(mp_path_list_t)));
-+ cmd->Status = EXT_STATUS_NO_MEMORY;
-+
-+ kfree(paths);
-+
-+ return -ENOMEM;
-+ }
-+
-+ found = 0;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (memcmp(fcport->node_name, sap->DestAddr.WWNN,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+ found++;
-+ break;
-+ }
-+ }
-+
-+ if (found) {
-+ DEBUG9(printk("%s: found fcport:"
-+ "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-+ __func__,
-+ sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7]));
-+
-+ paths->HbaInstance = bp->HbaInstance;
-+ paths->PathCount = STD_MAX_PATH_CNT;
-+ paths->VisiblePathIndex = STD_VISIBLE_INDEX;
-+
-+ /* Copy current path, which is the first one (0). */
-+ memcpy(paths->CurrentPathIndex,
-+ ptmp_plist->current_path,
-+ sizeof(paths->CurrentPathIndex));
-+
-+ entry = &(paths->PathEntry[STD_VISIBLE_INDEX]);
-+
-+ entry->Visible = 1;
-+ entry->HbaInstance = bp->HbaInstance;
-+
-+ memcpy(entry->PortName, fcport->port_name,
-+ EXT_DEF_WWP_NAME_SIZE);
-+
-+ /* Copy data to user */
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->PathCount,
-+ &paths->PathCount, 4);
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->CurrentPathIndex,
-+ &paths->CurrentPathIndex,
-+ sizeof(paths->CurrentPathIndex));
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->PathEntry,
-+ &paths->PathEntry,
-+ sizeof(paths->PathEntry));
-+
-+ if (rval) { /* if any of the above failed */
-+ DEBUG9_10(printk("%s: data copy failed.\n",
-+ __func__));
-+
-+ cmd->Status = EXT_STATUS_COPY_ERR;
-+ }
-+ } else {
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_TARGET;
-+
-+ DEBUG10(printk("%s: cannot find fcport "
-+ "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-+ __func__,
-+ sap->DestAddr.WWNN[0],
-+ sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2],
-+ sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4],
-+ sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6],
-+ sap->DestAddr.WWNN[7]));
-+ DEBUG4(printk("%s: cannot find fcport "
-+ "(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)\n.",
-+ __func__,
-+ sap->DestAddr.WWNN[0],
-+ sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2],
-+ sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4],
-+ sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6],
-+ sap->DestAddr.WWNN[7]));
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ /* end of non-fo case. */
-+
-+ } else if (sap->DestType != EXT_DEF_DESTTYPE_WWNN &&
-+ sap->DestType != EXT_DEF_DESTTYPE_WWPN) {
-+ /* Scan for mp_dev by nodename or portname *ONLY* */
-+
-+ cmd->Status = EXT_STATUS_INVALID_PARAM;
-+ cmd->DetailStatus = EXT_DSTATUS_TARGET;
-+
-+ DEBUG4(printk("%s: target can be accessed by NodeName only.",
-+ __func__));
-+ DEBUG9_10(printk("%s: target can be accessed by NodeName or "
-+ " PortName only. Got type %d.\n",
-+ __func__, sap->DestType));
-+
-+ } else if ((sap->DestType == EXT_DEF_DESTTYPE_WWNN &&
-+ (dp = qla2x00_find_mp_dev_by_nodename(host,
-+ sap->DestAddr.WWNN)) != NULL) ||
-+ (sap->DestType == EXT_DEF_DESTTYPE_WWPN &&
-+ (dp = qla2x00_find_mp_dev_by_portname(host,
-+ sap->DestAddr.WWPN, &idx)) != NULL)) {
-+
-+ DEBUG9(printk("%s(%ld): Found mp_dev. nodename="
-+ "%02x%02x%02x%02x%02x%02x%02x%02x portname="
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n.",
-+ __func__, host->ha->host_no,
-+ sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7],
-+ sap->DestAddr.WWPN[0], sap->DestAddr.WWPN[1],
-+ sap->DestAddr.WWPN[2], sap->DestAddr.WWPN[3],
-+ sap->DestAddr.WWPN[4], sap->DestAddr.WWPN[5],
-+ sap->DestAddr.WWPN[6], sap->DestAddr.WWPN[7]));
-+
-+ path_list = dp->path_list;
-+
-+ paths->HbaInstance = bp->HbaInstance;
-+ paths->PathCount = path_list->path_cnt;
-+ paths->VisiblePathIndex = path_list->visible;
-+
-+ /* copy current paths */
-+ memcpy(paths->CurrentPathIndex,
-+ path_list->current_path,
-+ sizeof(paths->CurrentPathIndex));
-+
-+ path = path_list->last;
-+ for (cnt = 0; cnt < path_list->path_cnt; cnt++) {
-+ entry = &(paths->PathEntry[path->id]);
-+
-+ entry->Visible = (path->id == path_list->visible);
-+ entry->HbaInstance = path->host->instance;
-+ DEBUG9(printk("%s: entry %d ha %d path id %d, pn="
-+ "%02x%02x%02x%02x%02x%02x%02x%02x. visible=%d.\n",
-+ __func__, cnt, path->host->instance, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7],
-+ entry->Visible));
-+
-+ memcpy(entry->PortName,
-+ path->portname,
-+ EXT_DEF_WWP_NAME_SIZE);
-+
-+ path = path->next;
-+ }
-+ DEBUG9(printk("%s: path cnt=%d, visible path=%d.\n",
-+ __func__, path_list->path_cnt, path_list->visible));
-+
-+ DEBUG9(printk("%s: path cnt=%d, visible path=%d.\n",
-+ __func__, path_list->path_cnt, path_list->visible));
-+
-+ /* copy data to user */
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->PathCount,
-+ &paths->PathCount, 4);
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->CurrentPathIndex,
-+ &paths->CurrentPathIndex,
-+ sizeof(paths->CurrentPathIndex));
-+ if (rval == 0)
-+ rval = copy_to_user(&u_paths->PathEntry,
-+ &paths->PathEntry,
-+ sizeof(paths->PathEntry));
-+
-+ if (rval != 0) { /* if any of the above failed */
-+ DEBUG9_10(printk("%s: u_paths %p copy"
-+ " error. paths->PathCount=%d.\n",
-+ __func__, u_paths, paths->PathCount));
-+ cmd->Status = EXT_STATUS_COPY_ERR;
-+ }
-+
-+ } else {
-+
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_TARGET;
-+
-+ DEBUG9_10(printk("%s: DestType=%x.\n",
-+ __func__, sap->DestType));
-+ DEBUG9_10(printk("%s: return DEV_NOT_FOUND for node=%02x%02x"
-+ "%02x%02x%02x%02x%02x%02x port=%02x%02x%02x%02x%02x%02x"
-+ "%02x%02x.\n",
-+ __func__,
-+ sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7],
-+ sap->DestAddr.WWPN[0], sap->DestAddr.WWPN[1],
-+ sap->DestAddr.WWPN[2], sap->DestAddr.WWPN[3],
-+ sap->DestAddr.WWPN[4], sap->DestAddr.WWPN[5],
-+ sap->DestAddr.WWPN[6], sap->DestAddr.WWPN[7]));
-+
-+ DEBUG4(printk("%s: return DEV_NOT_FOUND for node=%02x%02x"
-+ "%02x%02x%02x%02x%02x%02x port=%02x%02x%02x%02x%02x%02x"
-+ "%02x%02x.\n",
-+ __func__,
-+ sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7],
-+ sap->DestAddr.WWPN[0], sap->DestAddr.WWPN[1],
-+ sap->DestAddr.WWPN[2], sap->DestAddr.WWPN[3],
-+ sap->DestAddr.WWPN[4], sap->DestAddr.WWPN[5],
-+ sap->DestAddr.WWPN[6], sap->DestAddr.WWPN[7]));
-+ }
-+
-+ kfree(paths);
-+
-+ DEBUG9(printk("%s: exiting. rval=%d.\n", __func__, rval));
-+
-+ return rval;
-+
-+} /* qla2x00_cfg_get_paths */
-+
-+/*
-+ * qla2x00_cfg_set_current_path
-+ * Set the current failover path EXT_FO_GET_PATHS IOCTL call.
-+ *
-+ * Input:
-+ * ha = pointer to adapter
-+ * bp = pointer to buffer
-+ * cmd = Pointer to kernel copy of EXT_IOCTL.
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_cfg_set_current_path(EXT_IOCTL *cmd, FO_SET_CURRENT_PATH *bp, int mode )
-+{
-+ uint8_t orig_id, new_id;
-+ uint16_t idx;
-+ mp_host_t *host, *new_host;
-+ mp_device_t *dp;
-+ mp_path_list_t *path_list;
-+ EXT_DEST_ADDR *sap = &bp->HbaAddr;
-+ uint32_t rval = 0;
-+ scsi_qla_host_t *ha;
-+ mp_path_t *new_path, *old_path;
-+ fc_lun_t *fclun;
-+ int skip_set = 0;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ /* First find the adapter with the instance number. */
-+ ha = qla2x00_get_hba((int)bp->HbaInstance);
-+ if (!ha) {
-+ DEBUG2_9_10(printk(KERN_INFO "%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (rval);
-+ }
-+
-+ if (!qla2x00_failover_enabled(ha)) {
-+ /* non-failover mode. nothing to be done. */
-+ DEBUG9_10(printk("%s(%ld): non-failover driver mode.\n",
-+ __func__, ha->host_no));
-+
-+ return 0;
-+ }
-+
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_HBA_INST;
-+ DEBUG4(printk("%s: cannot find adapter.\n",
-+ __func__));
-+ DEBUG9_10(printk("%s(%ld): cannot find mphost.\n",
-+ __func__, ha->host_no));
-+ return (rval);
-+ }
-+
-+ set_bit(CFG_ACTIVE, &ha->cfg_flags);
-+ sap = &bp->HbaAddr;
-+ /* Scan for mp_dev by nodename *ONLY* */
-+ if (sap->DestType != EXT_DEF_DESTTYPE_WWNN &&
-+ sap->DestType != EXT_DEF_DESTTYPE_WWPN) {
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_TARGET;
-+ DEBUG4(printk("%s: target can be accessed by NodeName only.",
-+ __func__));
-+ DEBUG9_10(printk("%s(%ld): target can be accessed by NodeName "
-+ " or PortName only.\n",
-+ __func__, ha->host_no));
-+ } else if ((sap->DestType == EXT_DEF_DESTTYPE_WWNN &&
-+ (dp = qla2x00_find_mp_dev_by_nodename(host,
-+ sap->DestAddr.WWNN)) != NULL) ||
-+ (sap->DestType == EXT_DEF_DESTTYPE_WWPN &&
-+ (dp = qla2x00_find_mp_dev_by_portname(host,
-+ sap->DestAddr.WWPN, &idx)) != NULL)) {
-+
-+ if (sap->DestType == EXT_DEF_DESTTYPE_WWNN) {
-+ DEBUG9_10(printk("%s(%ld): found mpdev with matching "
-+ " NodeName.\n",
-+ __func__, ha->host_no));
-+ } else {
-+ DEBUG9_10(printk("%s(%ld): found mpdev with matching "
-+ " PortName.\n",
-+ __func__, ha->host_no));
-+ }
-+
-+ path_list = dp->path_list;
-+
-+ if (bp->NewCurrentPathIndex < MAX_PATHS_PER_DEVICE &&
-+ sap->Lun < MAX_LUNS &&
-+ bp->NewCurrentPathIndex < path_list->path_cnt) {
-+
-+ orig_id = path_list->current_path[sap->Lun];
-+
-+ DEBUG(printk("%s: dev no %d, lun %d, "
-+ "newindex %d, oldindex %d "
-+ "nn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, dp->dev_id, sap->Lun,
-+ bp->NewCurrentPathIndex, orig_id,
-+ host->nodename[0], host->nodename[1],
-+ host->nodename[2], host->nodename[3],
-+ host->nodename[4], host->nodename[5],
-+ host->nodename[6], host->nodename[7]));
-+ old_path = qla2x00_find_path_by_id(dp, orig_id);
-+
-+ if ( orig_id == PATH_INDEX_INVALID ) {
-+ cmd->Status = EXT_STATUS_INVALID_PARAM;
-+ cmd->DetailStatus =
-+ EXT_DSTATUS_PATH_INDEX;
-+ skip_set++;
-+ /* Make sure original lun is not a controller lun */
-+ } else if ((fclun = qla2x00_find_matching_lun(sap->Lun,
-+ dp, old_path)) != NULL) {
-+ if( (fclun->flags & FLF_VISIBLE_LUN) ) {
-+ cmd->Status = EXT_STATUS_INVALID_PARAM;
-+ cmd->DetailStatus =
-+ EXT_DSTATUS_PATH_INDEX;
-+ skip_set++;
-+ }
-+ }
-+ if (!skip_set && bp->NewCurrentPathIndex != orig_id) {
-+ /* Acquire the update spinlock. */
-+
-+ /* Set the new current path. */
-+ new_id = path_list-> current_path[sap->Lun] =
-+ bp->NewCurrentPathIndex;
-+
-+ /* Release the update spinlock. */
-+ old_path = qla2x00_find_path_by_id(
-+ dp, orig_id);
-+ new_path = qla2x00_find_path_by_id(dp, new_id);
-+ new_host = new_path->host;
-+
-+ /* remap the lun */
-+ qla2x00_map_a_oslun(new_host, dp,
-+ dp->dev_id, sap->Lun);
-+
-+ qla2x00_send_failover_notify(dp,
-+ sap->Lun, old_path, new_path);
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: path index not changed.\n",
-+ __func__));
-+ DEBUG9(printk("%s(%ld): path id not changed.\n",
-+ __func__, ha->host_no));
-+ }
-+ } else {
-+ cmd->Status = EXT_STATUS_INVALID_PARAM;
-+ cmd->DetailStatus = EXT_DSTATUS_PATH_INDEX;
-+ DEBUG4(printk("%s: invalid index for device.\n",
-+ __func__));
-+ DEBUG9_10(printk("%s: invalid index for device.\n",
-+ __func__));
-+ }
-+ } else {
-+ cmd->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ cmd->DetailStatus = EXT_DSTATUS_TARGET;
-+ DEBUG4(printk("%s: cannot find device.\n",
-+ __func__));
-+ DEBUG9_10(printk("%s: DestType=%x.\n",
-+ __func__, sap->DestType));
-+ DEBUG9_10(printk("%s: return DEV_NOT_FOUND for node=%02x%02x"
-+ "%02x%02x%02x%02x%02x%02x port=%02x%02x%02x%02x%02x%02x"
-+ "%02x%02x.\n",
-+ __func__,
-+ sap->DestAddr.WWNN[0], sap->DestAddr.WWNN[1],
-+ sap->DestAddr.WWNN[2], sap->DestAddr.WWNN[3],
-+ sap->DestAddr.WWNN[4], sap->DestAddr.WWNN[5],
-+ sap->DestAddr.WWNN[6], sap->DestAddr.WWNN[7],
-+ sap->DestAddr.WWPN[0], sap->DestAddr.WWPN[1],
-+ sap->DestAddr.WWPN[2], sap->DestAddr.WWPN[3],
-+ sap->DestAddr.WWPN[4], sap->DestAddr.WWPN[5],
-+ sap->DestAddr.WWPN[6], sap->DestAddr.WWPN[7]));
-+ }
-+ clear_bit(CFG_ACTIVE, &ha->cfg_flags);
-+
-+ DEBUG9(printk("%s: exiting. rval = %d.\n", __func__, rval));
-+
-+ return rval;
-+}
-+#endif
-+
-+/*
-+ * MP SUPPORT ROUTINES
-+ */
-+
-+/*
-+ * qla2x00_add_mp_host
-+ * Add the specified host the host list.
-+ *
-+ * Input:
-+ * node_name = pointer to node name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla2x00_add_mp_host(uint8_t *node_name)
-+{
-+ mp_host_t *host, *temp;
-+
-+ host = kmalloc(sizeof(mp_host_t), GFP_KERNEL);
-+ if (!host)
-+ return NULL;
-+ memset(host, 0, sizeof(*host));
-+ memcpy(host->nodename, node_name, WWN_SIZE);
-+ host->next = NULL;
-+
-+ /* add to list */
-+ if (mp_hosts_base == NULL) {
-+ mp_hosts_base = host;
-+ } else {
-+ temp = mp_hosts_base;
-+ while (temp->next != NULL)
-+ temp = temp->next;
-+ temp->next = host;
-+ }
-+
-+ mp_num_hosts++;
-+ return host;
-+}
-+
-+/*
-+ * qla2x00_alloc_host
-+ * Allocate and initialize an mp host structure.
-+ *
-+ * Input:
-+ * ha = pointer to base driver's adapter structure.
-+ *
-+ * Returns:
-+ * Pointer to host structure or null on error.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla2x00_alloc_host(scsi_qla_host_t *ha)
-+{
-+ mp_host_t *host, *temp;
-+
-+ ENTER("qla2x00_alloc_host");
-+
-+ host = kmalloc(sizeof(mp_host_t), GFP_KERNEL);
-+ if (!host)
-+ return NULL;
-+
-+ memset(host, 0, sizeof(*host));
-+ host->ha = ha;
-+ memcpy(host->nodename, ha->node_name, WWN_SIZE);
-+ memcpy(host->portname, ha->port_name, WWN_SIZE);
-+ host->next = NULL;
-+ host->flags = MP_HOST_FLAG_NEEDS_UPDATE;
-+ host->instance = ha->instance;
-+ /* host->MaxLunsPerTarget = qla_fo_params.MaxLunsPerTarget; */
-+
-+ if (qla2x00_fo_enabled(host->ha, host->instance)) {
-+ host->flags |= MP_HOST_FLAG_FO_ENABLED;
-+ DEBUG4(printk("%s: Failover enabled.\n",
-+ __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failover disabled.\n",
-+ __func__));
-+ }
-+ /* add to list */
-+ if (mp_hosts_base == NULL) {
-+ mp_hosts_base = host;
-+ } else {
-+ temp = mp_hosts_base;
-+ while (temp->next != NULL)
-+ temp = temp->next;
-+ temp->next = host;
-+ }
-+ mp_num_hosts++;
-+
-+ DEBUG4(printk("%s: Alloc host @ %p\n", __func__, host));
-+ return host;
-+}
-+
-+/*
-+ * qla2x00_add_portname_to_mp_dev
-+ * Add the specific port name to the list of port names for a
-+ * multi-path device.
-+ *
-+ * Input:
-+ * dp = pointer ti virtual device
-+ * portname = Port name to add to device
-+ * nodename = Node name to add to device
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla2x00_add_portname_to_mp_dev(mp_device_t *dp, uint8_t *portname, uint8_t *nodename)
-+{
-+ uint16_t index;
-+ uint32_t rval = QLA_SUCCESS;
-+
-+ ENTER("qla2x00_add_portname_to_mp_dev");
-+
-+ /* Look for an empty slot and add the specified portname. */
-+ for (index = 0; index < MAX_NUMBER_PATHS; index++) {
-+ if (qla2x00_is_ww_name_zero(&dp->portnames[index][0])) {
-+ DEBUG4(printk("%s: adding portname to dp = "
-+ "%p at index = %d\n",
-+ __func__, dp, index));
-+ memcpy(&dp->portnames[index][0], portname, WWN_SIZE);
-+ break;
-+ }
-+ }
-+ if (index == MAX_NUMBER_PATHS) {
-+ rval = QLA_FUNCTION_FAILED;
-+ DEBUG4(printk("%s: Fail no room\n", __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit OK\n", __func__));
-+ }
-+
-+ LEAVE("qla2x00_add_portname_to_mp_dev");
-+
-+ return rval;
-+}
-+
-+
-+/*
-+ * qla2x00_allocate_mp_dev
-+ * Allocate an fc_mp_dev, clear the memory, and log a system
-+ * error if the allocation fails. After fc_mp_dev is allocated
-+ *
-+ * Inputs:
-+ * nodename = pointer to nodename of new device
-+ * portname = pointer to portname of new device
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_allocate_mp_dev(uint8_t *nodename, uint8_t *portname)
-+{
-+ mp_device_t *dp; /* Virtual device pointer */
-+
-+ ENTER("qla2x00_allocate_mp_dev");
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ dp = kmalloc(sizeof(mp_device_t), GFP_KERNEL);
-+ if (!dp) {
-+ DEBUG4(printk("%s: Allocate failed.\n", __func__));
-+ return NULL;
-+ }
-+ memset(dp, 0, sizeof(*dp));
-+
-+ DEBUG3(printk("%s: mp_device_t allocated at %p\n", __func__, dp));
-+
-+ /*
-+ * Copy node name into the mp_device_t.
-+ */
-+ if (nodename) {
-+ DEBUG3(printk("%s: copying node name %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ __func__, nodename[0], nodename[1],
-+ nodename[2], nodename[3], nodename[4],
-+ nodename[5], nodename[6], nodename[7]));
-+ memcpy(dp->nodename, nodename, WWN_SIZE);
-+ }
-+
-+ /*
-+ * Since this is the first port, it goes at
-+ * index zero.
-+ */
-+ if (portname)
-+ {
-+ DEBUG3(printk("%s: copying port name %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ __func__, portname[0], portname[1],
-+ portname[2], portname[3], portname[4],
-+ portname[5], portname[6], portname[7]));
-+ memcpy(&dp->portnames[0][0], portname, PORT_NAME_SIZE);
-+ }
-+
-+ /* Allocate an PATH_LIST for the fc_mp_dev. */
-+ if ((dp->path_list = qla2x00_allocate_path_list()) == NULL) {
-+ DEBUG4(printk("%s: allocate path_list Failed.\n",
-+ __func__));
-+ kfree(dp);
-+ dp = NULL;
-+ } else {
-+ DEBUG4(printk("%s: mp_path_list_t allocated at %p\n",
-+ __func__, dp->path_list));
-+ /* EMPTY */
-+ DEBUG4(printk("qla2x00_allocate_mp_dev: Exit Okay\n"));
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+ LEAVE("qla2x00_allocate_mp_dev");
-+
-+ return dp;
-+}
-+
-+/*
-+ * qla2x00_allocate_path
-+ * Allocate a PATH.
-+ *
-+ * Inputs:
-+ * host Host adapter for the device.
-+ * path_id path number
-+ * port port for device.
-+ * dev_id device number
-+ *
-+ * Returns:
-+ * Pointer to new PATH, or NULL if the allocation failed.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla2x00_allocate_path(mp_host_t *host, uint16_t path_id,
-+ fc_port_t *port, uint16_t dev_id)
-+{
-+ mp_path_t *path;
-+ uint16_t lun;
-+
-+ ENTER("qla2x00_allocate_path");
-+
-+ path = kmalloc(sizeof(mp_path_t), GFP_KERNEL);
-+ if (!path) {
-+ DEBUG4(printk("%s: Failed\n", __func__));
-+ return 0;
-+ }
-+ memset(path, 0, sizeof(*path));
-+
-+ DEBUG3(printk("%s(%ld): allocated path %p at path id %d.\n",
-+ __func__, host->ha->host_no, path, path_id));
-+
-+ /* Copy the supplied information into the MP_PATH. */
-+ path->host = host;
-+
-+ if (!(port->flags & FC_CONFIG) && port->loop_id != FC_NO_LOOP_ID) {
-+ path->port = port;
-+ DEBUG3(printk("%s(%ld): assigned port pointer %p "
-+ "to path id %d.\n",
-+ __func__, host->ha->host_no, port, path_id));
-+ }
-+
-+ path->id = path_id;
-+ port->cur_path = path->id;
-+ path->mp_byte = port->mp_byte;
-+ path->next = NULL;
-+ memcpy(path->portname, port->port_name, WWN_SIZE);
-+
-+ DEBUG3(printk("%s(%ld): path id %d copied portname "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x. enabling all LUNs.\n",
-+ __func__, host->ha->host_no, path->id,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ path->lun_data.data[lun] |= LUN_DATA_ENABLED;
-+ }
-+
-+ return path;
-+}
-+
-+
-+/*
-+ * qla2x00_allocate_path_list
-+ * Allocate a PATH_LIST
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Returns:
-+ * Pointer to new PATH_LIST, or NULL if the allocation fails.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_list_t *
-+qla2x00_allocate_path_list( void )
-+{
-+ mp_path_list_t *path_list;
-+ uint16_t i;
-+ uint8_t l;
-+
-+ path_list = kmalloc(sizeof(mp_path_list_t), GFP_KERNEL);
-+ if (!path_list) {
-+ DEBUG4(printk("%s: Alloc pool failed for MP_PATH_LIST.\n",
-+ __func__));
-+ return NULL;
-+ }
-+ memset(path_list, 0, sizeof(*path_list));
-+
-+ DEBUG4(printk("%s: allocated at %p\n", __func__, path_list));
-+
-+ path_list->visible = PATH_INDEX_INVALID;
-+ /* Initialized current path */
-+ for (i = 0; i < MAX_LUNS_PER_DEVICE; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ path_list->current_path[l] = PATH_INDEX_INVALID;
-+ }
-+ path_list->last = NULL;
-+
-+ return path_list;
-+}
-+
-+/*
-+ * qla2x00_cfg_find_host
-+ * Look through the existing multipath tree, and find
-+ * a host adapter to match the specified ha.
-+ *
-+ * Input:
-+ * ha = pointer to host adapter
-+ *
-+ * Return:
-+ * Pointer to new host, or NULL if no match found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla2x00_cfg_find_host(scsi_qla_host_t *ha)
-+{
-+ mp_host_t *host = NULL; /* Host found and null if not */
-+ mp_host_t *tmp_host;
-+
-+ ENTER("qla2x00_cfg_find_host");
-+
-+ for (tmp_host = mp_hosts_base; (tmp_host); tmp_host = tmp_host->next) {
-+ if (tmp_host->ha == ha) {
-+ host = tmp_host;
-+ DEBUG3(printk("%s: Found host =%p, instance %d\n",
-+ __func__, host, host->instance));
-+ break;
-+ }
-+ }
-+
-+ LEAVE("qla2x00_cfg_find_host");
-+
-+ return host;
-+}
-+
-+/*
-+ * qla2x00_find_host_by_portname
-+ * Look through the existing multipath tree, and find
-+ * a host adapter to match the specified portname.
-+ *
-+ * Input:
-+ * name = portname to match.
-+ *
-+ * Return:
-+ * Pointer to new host, or NULL if no match found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_host_t *
-+qla2x00_find_host_by_portname(uint8_t *name)
-+{
-+ mp_host_t *host; /* Host found and null if not */
-+
-+ for (host = mp_hosts_base; (host); host = host->next) {
-+ if (memcmp(host->portname, name, WWN_SIZE) == 0)
-+ break;
-+ }
-+ return host;
-+}
-+
-+/*
-+ * qla2x00_found_hidden_path
-+ * This is called only when the port trying to figure out whether
-+ * to bind to this mp_device has mpbyte of zero. It doesn't matter
-+ * if the path we check on is first path or not because if
-+ * more than one path has mpbyte zero and not all are zero, it is
-+ * invalid and unsupported configuration which we don't handle.
-+ *
-+ * Input:
-+ * dp = mp_device pointer
-+ *
-+ * Returns:
-+ * 1 - first path in dp is hidden.
-+ * 0 - no hidden path.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static inline uint8_t
-+qla2x00_found_hidden_path(mp_device_t *dp)
-+{
-+ uint8_t ret = 0;
-+ mp_path_list_t *path_list = dp->path_list;
-+#ifdef QL_DEBUG_LEVEL_2
-+ mp_path_t *tmp_path;
-+ uint8_t cnt = 0;
-+#endif
-+
-+ /* Sanity check */
-+ if (path_list == NULL) {
-+ /* ERROR? Just print debug and return */
-+ DEBUG2_3(printk("%s: ERROR No path list found on dp.\n",
-+ __func__));
-+ return (0);
-+ }
-+
-+ if (path_list->last != NULL &&
-+ path_list->last->mp_byte & MP_MASK_HIDDEN) {
-+ ret = 1;
-+ }
-+
-+#ifdef QL_DEBUG_LEVEL_2
-+ /* If any path is visible, return 0 right away, otherwise check
-+ * through to make sure all existing paths in this mpdev are hidden.
-+ */
-+ for (tmp_path = path_list->last; tmp_path && cnt < path_list->path_cnt;
-+ tmp_path = tmp_path->next, cnt++) {
-+ if (!(tmp_path->mp_byte & MP_MASK_HIDDEN)) {
-+ printk("%s: found visible path.\n", __func__);
-+ }
-+ }
-+#endif
-+
-+ return (ret);
-+}
-+
-+
-+/*
-+ * qla2x00_get_lun_ownership()
-+ * Issue Vendor Specific SCSI Inquiry page code 0xe0 command for
-+ * Ownership assignment query.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * fcport = FC port structure pointer.
-+ *
-+ * Return:
-+ * QLA2X00_FUNCTION_FAILED - Failed to get the pref_path_priority
-+ * Otherwise : pref_path_priority
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_get_lun_ownership(mp_host_t *host, fc_lun_t *fclun,
-+ uint8_t *cur_vol_path_own)
-+{
-+ int rval = 0 ;
-+ int retry;
-+ scsi_qla_host_t *ha;
-+ uint16_t next_loopid;
-+ evpd_inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ int vol_pref_path_priority;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ if (atomic_read(&fclun->fcport->state) == FCS_DEVICE_DEAD){
-+ DEBUG(printk("%s leaving: Port is marked DEAD\n",__func__));
-+ return rval;
-+ }
-+
-+ ha = host->ha;
-+ inq = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &inq_dma);
-+ if (inq == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - INQ\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &inq->p.rsp24.comp_status;
-+ sstatus = &inq->p.rsp24.scsi_status;
-+ sense_data = inq->p.rsp24.data;
-+ } else {
-+ cstatus = &inq->p.rsp.comp_status;
-+ sstatus = &inq->p.rsp.scsi_status;
-+ sense_data = inq->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 2;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(inq, 0, sizeof(evpd_inq_cmd_rsp_t));
-+ inq->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ inq->p.cmd24.entry_count = 1;
-+ inq->p.cmd24.nport_handle =
-+ cpu_to_le16(fclun->fcport->loop_id);
-+ inq->p.cmd24.port_id[0] = fclun->fcport->d_id.b.al_pa;
-+ inq->p.cmd24.port_id[1] = fclun->fcport->d_id.b.area;
-+ inq->p.cmd24.port_id[2] = fclun->fcport->d_id.b.domain;
-+ inq->p.cmd24.lun[1] = LSB(fclun->lun);
-+ inq->p.cmd24.lun[2] = MSB(fclun->lun);
-+ host_to_fcp_swap(inq->p.cmd24.lun,
-+ sizeof(inq->p.cmd24.lun));
-+ inq->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_READ_DATA);
-+ inq->p.cmd24.task = TSK_SIMPLE;
-+ inq->p.cmd24.fcp_cdb[0] = INQUIRY;
-+ inq->p.cmd24.fcp_cdb[1] = INQ_EVPD_SET;
-+ inq->p.cmd24.fcp_cdb[2] = VOL_OWNERSHIP_VPD_PAGE;
-+ inq->p.cmd24.fcp_cdb[4] = VITAL_PRODUCT_DATA_SIZE;
-+ host_to_fcp_swap(inq->p.cmd24.fcp_cdb,
-+ sizeof(inq->p.cmd24.fcp_cdb));
-+ inq->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd24.timeout = __constant_cpu_to_le16(10);
-+ inq->p.cmd24.byte_count =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ inq->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_len =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ } else {
-+ memset(inq, 0, sizeof(evpd_inq_cmd_rsp_t));
-+ inq->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ inq->p.cmd.entry_count = 1;
-+ inq->p.cmd.lun = cpu_to_le16(fclun->lun);
-+ SET_TARGET_ID(ha, inq->p.cmd.target,
-+ fclun->fcport->loop_id);
-+ inq->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_READ | CF_SIMPLE_TAG);
-+ inq->p.cmd.scsi_cdb[0] = INQUIRY;
-+ inq->p.cmd.scsi_cdb[1] = INQ_EVPD_SET;
-+ inq->p.cmd.scsi_cdb[2] = VOL_OWNERSHIP_VPD_PAGE;
-+ inq->p.cmd.scsi_cdb[4] = VITAL_PRODUCT_DATA_SIZE;
-+ inq->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ inq->p.cmd.byte_count =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ inq->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_length =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, inq, inq_dma,
-+ sizeof(evpd_inq_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && inq->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) INQ failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ inq->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ DEBUG2(printk("%s: lun (%d) inquiry page 0x83- (lun ownership) comp status "
-+ "0x%x, scsi status 0x%x, rval=%d\n",__func__, fclun->lun,
-+ comp_status, scsi_status, rval));
-+
-+ /* if port not logged in then try and login */
-+ if (fclun->lun == 0 && comp_status == CS_PORT_LOGGED_OUT &&
-+ atomic_read(&fclun->fcport->state) != FCS_DEVICE_DEAD) {
-+ if (fclun->fcport->flags & FC_FABRIC_DEVICE) {
-+ /* login and update database */
-+ next_loopid = 0;
-+ qla2x00_fabric_login(ha, fclun->fcport,
-+ &next_loopid);
-+ } else {
-+ /* Loop device gone but no LIP... */
-+ rval = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE) &&
-+ --retry);
-+
-+ if (rval == QLA_SUCCESS &&
-+ inq->inq[1] == VOL_OWNERSHIP_VPD_PAGE &&
-+ ( inq->inq[4] & VOL_OWNERSHIP_BIT_VALID) ) {
-+
-+ *cur_vol_path_own = (inq->inq[4]& VOL_OWNERSHIP_BIT) >> 6;
-+ vol_pref_path_priority = ((inq->inq[4]& VOL_OWNERSHIP_BIT))?
-+ PREFERRED_PATH_PRIORITY : SECONDARY_PATH_PRIORITY;
-+
-+ } else {
-+ if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data, sizeof(inq->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ inq->p.rsp24.rsp_data_len);
-+ }
-+
-+ /*
-+ * ILLEGAL REQUEST - 0x05
-+ * INVALID FIELD IN CDB - 24 : 00
-+ */
-+ if (sense_data[2] == 0x05 && sense_data[12] == 0x24 &&
-+ sense_data[13] == 0x00) {
-+ DEBUG(printk(KERN_INFO
-+ "%s Lun(%d) does not support Inquiry Page "
-+ "Code-0x83\n", __func__, fclun->lun));
-+ } else {
-+ DEBUG(printk(KERN_INFO "%s Lun(%d) does not support "
-+ "Inquiry Page Code-0x83\n", __func__,fclun->lun));
-+
-+ DEBUG(printk(KERN_INFO
-+ "Unhandled check condition sense_data[2]=0x%x "
-+ "sense_data[12]=0x%x sense_data[13]=0x%x\n",
-+ sense_data[2], sense_data[12], sense_data[13]));
-+ }
-+ rval = 0;
-+ } else {
-+ /* Unable to issue Inquiry Page 0x83 */
-+ DEBUG2(printk(KERN_INFO
-+ "%s Failed to issue Inquiry Page 0x83 -- lun (%d) cs=0x%x "
-+ "ss=0x%x, rval=%d\n", __func__, fclun->lun, comp_status,
-+ scsi_status, rval));
-+ rval = 0;
-+ }
-+ *cur_vol_path_own = 0;
-+ vol_pref_path_priority = SECONDARY_PATH_PRIORITY;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, inq, inq_dma);
-+
-+ return vol_pref_path_priority;
-+}
-+
-+/*
-+ * qla2x00_get_wwuln_from_device
-+ * Issue SCSI inquiry page code 0x83 command for LUN WWLUN_NAME.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * fcport = FC port structure pointer.
-+ *
-+ * Return:
-+ * 0 - Failed to get the lun_wwlun_name
-+ * Otherwise : wwlun_size
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+
-+static int
-+qla2x00_get_wwuln_from_device(mp_host_t *host, fc_lun_t *fclun, char *evpd_buf,
-+ int wwlun_size , uint8_t *rel_tport_id, uint8_t *tpg_id)
-+{
-+
-+ int rval = 0 ;
-+ int retry;
-+ scsi_qla_host_t *ha;
-+ uint16_t next_loopid;
-+ evpd_inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t page_length = 0;
-+ uint16_t next_desc = 0;
-+ uint16_t hdr;
-+ uint32_t iden_len = 0;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ if (atomic_read(&fclun->fcport->state) == FCS_DEVICE_DEAD){
-+ DEBUG(printk("%s leaving: Port is marked DEAD\n",__func__));
-+ return rval;
-+ }
-+
-+ memset(evpd_buf, 0 ,wwlun_size);
-+ ha = host->ha;
-+
-+ inq = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &inq_dma);
-+ if (inq == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - INQ\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &inq->p.rsp24.comp_status;
-+ sstatus = &inq->p.rsp24.scsi_status;
-+ sense_data = inq->p.rsp24.data;
-+ } else {
-+ cstatus = &inq->p.rsp.comp_status;
-+ sstatus = &inq->p.rsp.scsi_status;
-+ sense_data = inq->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 2;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(inq, 0, sizeof(evpd_inq_cmd_rsp_t));
-+ inq->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ inq->p.cmd24.entry_count = 1;
-+ inq->p.cmd24.nport_handle =
-+ cpu_to_le16(fclun->fcport->loop_id);
-+ inq->p.cmd24.port_id[0] = fclun->fcport->d_id.b.al_pa;
-+ inq->p.cmd24.port_id[1] = fclun->fcport->d_id.b.area;
-+ inq->p.cmd24.port_id[2] = fclun->fcport->d_id.b.domain;
-+ inq->p.cmd24.lun[1] = LSB(fclun->lun);
-+ inq->p.cmd24.lun[2] = MSB(fclun->lun);
-+ host_to_fcp_swap(inq->p.cmd24.lun,
-+ sizeof(inq->p.cmd24.lun));
-+ inq->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_READ_DATA);
-+ inq->p.cmd24.task = TSK_SIMPLE;
-+ inq->p.cmd24.fcp_cdb[0] = INQUIRY;
-+ inq->p.cmd24.fcp_cdb[1] = INQ_EVPD_SET;
-+ inq->p.cmd24.fcp_cdb[2] = INQ_DEV_IDEN_PAGE;
-+ inq->p.cmd24.fcp_cdb[4] = VITAL_PRODUCT_DATA_SIZE;
-+ host_to_fcp_swap(inq->p.cmd24.fcp_cdb,
-+ sizeof(inq->p.cmd24.fcp_cdb));
-+ inq->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd24.timeout = __constant_cpu_to_le16(10);
-+ inq->p.cmd24.byte_count =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ inq->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(struct sts_entry_24xx)));
-+ inq->p.cmd24.dseg_0_len =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ } else {
-+ memset(inq, 0, sizeof(evpd_inq_cmd_rsp_t));
-+ inq->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ inq->p.cmd.entry_count = 1;
-+ inq->p.cmd.lun = cpu_to_le16(fclun->lun);
-+ SET_TARGET_ID(ha, inq->p.cmd.target,
-+ fclun->fcport->loop_id);
-+ inq->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_READ | CF_SIMPLE_TAG);
-+ inq->p.cmd.scsi_cdb[0] = INQUIRY;
-+ inq->p.cmd.scsi_cdb[1] = INQ_EVPD_SET;
-+ inq->p.cmd.scsi_cdb[2] = INQ_DEV_IDEN_PAGE;
-+ inq->p.cmd.scsi_cdb[4] = VITAL_PRODUCT_DATA_SIZE;
-+ inq->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ inq->p.cmd.byte_count =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ inq->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(inq_dma + sizeof(sts_entry_t)));
-+ inq->p.cmd.dseg_0_length =
-+ __constant_cpu_to_le32(VITAL_PRODUCT_DATA_SIZE);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, inq, inq_dma,
-+ sizeof(evpd_inq_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && inq->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) INQ failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ inq->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ DEBUG5(printk("%s: lun (%d) inquiry page 0x83- comp status "
-+ "0x%x, scsi status 0x%x, rval=%d\n",__func__, fclun->lun,
-+ comp_status, scsi_status, rval));
-+
-+ /* if port not logged in then try and login */
-+ if (fclun->lun == 0 && comp_status == CS_PORT_LOGGED_OUT &&
-+ atomic_read(&fclun->fcport->state) != FCS_DEVICE_DEAD) {
-+ if (fclun->fcport->flags & FC_FABRIC_DEVICE) {
-+ /* login and update database */
-+ next_loopid = 0;
-+ qla2x00_fabric_login(ha, fclun->fcport,
-+ &next_loopid);
-+ } else {
-+ /* Loop device gone but no LIP... */
-+ rval = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE) &&
-+ --retry);
-+
-+ if (rval == QLA_SUCCESS && inq->inq[1] == INQ_DEV_IDEN_PAGE) {
-+ if (inq->inq[7] <= WWLUN_SIZE) {
-+ memcpy(evpd_buf, &inq->inq[8], inq->inq[7]);
-+ DEBUG(printk("%s : Lun(%d) WWLUN size %d\n",__func__,
-+ fclun->lun, inq->inq[7]));
-+ } else {
-+ memcpy(evpd_buf, &inq->inq[8], WWLUN_SIZE);
-+ printk(KERN_INFO "%s : Lun(%d) WWLUN may not be "
-+ "complete, Buffer too small need: %d provided: "
-+ "%d\n",__func__, fclun->lun, inq->inq[7],
-+ WWLUN_SIZE);
-+ }
-+ rval = inq->inq[7]; /* lun wwlun_size */
-+ DEBUG3(qla2x00_dump_buffer(evpd_buf, rval));
-+
-+ /* Copy the other identifiers for devices which
-+ * support report target port group cmd */
-+ if (fclun->fcport->fo_target_port == NULL)
-+ goto out;
-+ if (rel_tport_id == NULL || tpg_id == NULL)
-+ goto out;
-+
-+ /* page length of identifier descriptor list */
-+ hdr = 4;
-+ page_length = (inq->inq[2] << 8 | inq->inq[3]);
-+ page_length = page_length + hdr;
-+ /* identifier descriptor next to logical unit */
-+ next_desc = hdr + (inq->inq[7] + hdr);
-+
-+ DEBUG5(printk("%s next_desc =%d page_length=%d\n",
-+ __func__,next_desc,page_length));
-+ while (next_desc < page_length) {
-+ iden_len = inq->inq[next_desc + hdr -1];
-+ DEBUG5(printk("%s iden len =%d code_set=0x%x type=0x%x\n",__func__,iden_len,
-+ (inq->inq[next_desc] & 0x0f),(inq->inq[next_desc + 1] & 0x3f) ));
-+
-+ if((inq->inq[next_desc] & 0x0f) == CODE_SET_BINARY &&
-+ (((inq->inq[next_desc + 1] & 0x3f) ==
-+ (ASSOCIATION_LOGICAL_DEVICE << 4 |
-+ TYPE_REL_TGT_PORT)) ||
-+ ((inq->inq[next_desc + 1] & 0x3f) ==
-+ (ASSOCIATION_TARGET_PORT << 4 |
-+ TYPE_REL_TGT_PORT)))) {
-+ iden_len = inq->inq[next_desc + hdr -1];
-+ rel_tport_id[0] =
-+ inq->inq[next_desc + hdr + iden_len -2];
-+ rel_tport_id[1] =
-+ inq->inq[next_desc + hdr + iden_len -1];
-+ DEBUG(printk("%s rel_tport_id[0]=0x%x"
-+ " rel_tport_id[1]=0x%x\n", __func__,
-+ rel_tport_id[0], rel_tport_id[1]));
-+ }
-+ if((inq->inq[next_desc] & 0x0f) == CODE_SET_BINARY &&
-+ (((inq->inq[next_desc + 1] & 0x3f) ==
-+ (ASSOCIATION_LOGICAL_DEVICE << 4 |
-+ TYPE_TPG_GROUP)) ||
-+ ((inq->inq[next_desc + 1] & 0x3f) ==
-+ (ASSOCIATION_TARGET_PORT << 4 |
-+ TYPE_TPG_GROUP)))) {
-+
-+ iden_len = inq->inq[next_desc + hdr -1];
-+ tpg_id[0] = inq->inq[next_desc + hdr + iden_len -2];
-+ tpg_id[1] = inq->inq[next_desc + hdr + iden_len -1];
-+ DEBUG(printk("%s tpg_id[0]=0x%x "
-+ "tpg_id[1]=0x%x\n",__func__,
-+ tpg_id[0],tpg_id[1]));
-+ }
-+ /* increment to the next identifier descriptor */
-+ next_desc += iden_len + hdr;
-+ }
-+ } else if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data, sizeof(inq->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ inq->p.rsp24.rsp_data_len);
-+ }
-+
-+ /*
-+ * ILLEGAL REQUEST - 0x05
-+ * INVALID FIELD IN CDB - 24 : 00
-+ */
-+ if (sense_data[2] == 0x05 && sense_data[12] == 0x24 &&
-+ sense_data[13] == 0x00) {
-+ DEBUG(printk(KERN_INFO
-+ "%s Lun(%d) does not support Inquiry Page "
-+ "Code-0x83\n", __func__, fclun->lun));
-+ } else {
-+ DEBUG(printk(KERN_INFO "%s Lun(%d) does not support "
-+ "Inquiry Page Code-0x83\n", __func__,fclun->lun));
-+
-+ DEBUG(printk(KERN_INFO
-+ "Unhandled check condition sense_data[2]=0x%x "
-+ "sense_data[12]=0x%x sense_data[13]=0x%x\n",
-+ sense_data[2], sense_data[12], sense_data[13]));
-+ }
-+ rval = 0;
-+ } else {
-+ /* Unable to issue Inquiry Page 0x83 */
-+ DEBUG2(printk(KERN_INFO
-+ "%s Failed to issue Inquiry Page 0x83 -- lun (%d) cs=0x%x "
-+ "ss=0x%x, rval=%d\n", __func__, fclun->lun, comp_status,
-+ scsi_status, rval));
-+ rval = 0;
-+ }
-+out:
-+
-+ dma_pool_free(ha->s_dma_pool, inq, inq_dma);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_find_matching_lunid
-+ * Find the lun in the lun list that matches the
-+ * specified wwu lun number.
-+ *
-+ * Input:
-+ * buf = buffer that contains the wwuln
-+ * host = host to search for lun
-+ *
-+ * Returns:
-+ * NULL or pointer to lun
-+ *
-+ * Context:
-+ * Kernel context.
-+ * (dg)
-+ */
-+static mp_lun_t *
-+qla2x00_find_matching_lunid(char *buf)
-+{
-+ int devid = 0;
-+ mp_host_t *temp_host; /* temporary pointer */
-+ mp_device_t *temp_dp; /* temporary pointer */
-+ mp_lun_t *lun;
-+
-+ //printk("%s: entered.\n", __func__);
-+
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ for (devid = 0; devid < MAX_MP_DEVICES; devid++) {
-+ temp_dp = temp_host->mp_devs[devid];
-+
-+ if (temp_dp == NULL)
-+ continue;
-+
-+ for( lun = temp_dp->luns; lun != NULL ;
-+ lun = lun->next ) {
-+
-+ if (lun->siz > WWULN_SIZE )
-+ lun->siz = WWULN_SIZE;
-+
-+ if (memcmp(lun->wwuln, buf, lun->siz) == 0)
-+ return lun;
-+ }
-+ }
-+ }
-+ return NULL;
-+
-+}
-+
-+void
-+qla2x00_update_lu_path_state(scsi_qla_host_t *ha, rpt_tport_grp_rsp_t *tpg,
-+ fc_lun_t *fclun,
-+ uint16_t tpg_count,
-+ uint8_t *tpg_id,
-+ uint8_t asym_acc_state)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *lu_path = NULL;
-+ mp_lun_t *mplun;
-+
-+ /* update the lu_path state */
-+ mplun = fclun->mplun;
-+ list_for_each_safe(list, temp, &mplun->lu_paths) {
-+ lu_path = list_entry(list, lu_path_t, list);
-+
-+ if (lu_path->tpg_id[0] != tpg_id[0] || lu_path->tpg_id[1] != tpg_id[1])
-+ continue;
-+
-+ if (lu_path->fclun != fclun)
-+ continue;
-+
-+ /* copy the tgt port group state */
-+ if(tpg != NULL)
-+ lu_path->asym_acc_state =
-+ tpg->list.tport_grp[tpg_count].state.asym_acc_state;
-+ else
-+ lu_path->asym_acc_state = asym_acc_state;
-+
-+ /* FIXMEdg: Is this really needed ????? */
-+ if(lu_path->asym_acc_state == TPG_ACT_OPT) {
-+ fclun->flags |= FLF_ACTIVE_LUN;
-+
-+ DEBUG(printk("%s(%ld) Set lun %d to active path %d, "
-+ "state =%d fclun_flags=0x%x loop_id=0x%02x\n",
-+ __func__, ha->instance, fclun->lun,
-+ lu_path->path_id, lu_path->asym_acc_state,
-+ lu_path->fclun->flags,
-+ lu_path->fclun->fcport->loop_id));
-+ }
-+ DEBUG2(printk("%s(%ld): index=%d lun %d Update state of "
-+ "lu_path %d tpg_id=0x%x rel_tport_id=0x%x, tpg state=%d \n",
-+ __func__, ha->instance, tpg_count, fclun->lun,
-+ lu_path->path_id, lu_path->tpg_id[1],
-+ lu_path->rel_tport_id[1],lu_path->asym_acc_state));
-+ }
-+}
-+
-+
-+int
-+qla2x00_get_vol_access_path(fc_port_t *fcport, fc_lun_t *fclun, int modify)
-+{
-+ int rval = QLA_FUNCTION_FAILED;
-+ uint8_t tpg_id[2];
-+ uint16_t lun = 0;
-+ scsi_qla_host_t *ha;
-+ mp_lun_t *mplun;
-+ struct list_head *list, *temp;
-+ mp_tport_grp_t *tport_grp = NULL;
-+ mp_host_t *host;
-+ uint16_t tpg_count;
-+ int vol_pref_path_priority = -1;
-+ uint8_t cur_vol_path_own, asym_acc_state = 0;
-+
-+ ENTER(__func__);
-+ DEBUG(printk(KERN_INFO "%s entered\n",__func__));
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: lun %d, Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fclun->lun, fcport->loop_id));
-+ return rval;
-+ }
-+
-+ lun = fclun->lun;
-+ mplun = fclun->mplun;
-+ if (fclun->mplun == NULL) {
-+ DEBUG2(printk("%s mplun does not exist for fclun=%p\n",
-+ __func__,fclun));
-+ return rval;
-+ }
-+ if ((host = qla2x00_cfg_find_host(fcport->ha)) == NULL) {
-+ DEBUG2(printk("%s mp_host does not exist for fclun=%p\n",
-+ __func__,fclun));
-+ return rval;
-+ }
-+
-+ if( (fclun->fcport->flags & FC_DFXXX_DEVICE) ) {
-+ vol_pref_path_priority = qla2x00_get_lun_ownership(
-+ host, fclun, &cur_vol_path_own);
-+ }
-+ if (vol_pref_path_priority == -1) {
-+ DEBUG2(printk("%s failed to get the vol_pref_path_priority\n",
-+ __func__));
-+ return rval;
-+ }
-+ DEBUG2(printk("scsi(%ld) %s port 0x%02x lun %d access: vol_pref_path 0x%x, cureent 0x%x\n",
-+ ha->host_no,__func__,fcport->loop_id,
-+ fclun->lun,vol_pref_path_priority,
-+ cur_vol_path_own));
-+
-+ memset(&tpg_id[0], 0, sizeof(tpg_id));
-+ tpg_id[1] = vol_pref_path_priority;
-+ /* find matching tpg_id and copy the asym_acc_state */
-+ for (tpg_count = 0; tpg_count < TGT_PORT_GRP_COUNT; tpg_count++) {
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list){
-+ tport_grp = list_entry(list, mp_tport_grp_t,
-+ list);
-+ if (memcmp(tport_grp->tpg_id, &tpg_id[0],
-+ sizeof(tpg_id)) != 0)
-+ continue;
-+ /* copy the tgt port group state */
-+ if (mp_initialized) {
-+ if (vol_pref_path_priority ==
-+ PREFERRED_PATH_PRIORITY)
-+ asym_acc_state = TPG_ACT_OPT;
-+ if (vol_pref_path_priority ==
-+ SECONDARY_PATH_PRIORITY)
-+ asym_acc_state =
-+ TPG_ACT_NON_OPT;
-+
-+ } else {
-+ /* Volume owned by the controller */
-+ if (cur_vol_path_own == 1)
-+ asym_acc_state = TPG_ACT_OPT;
-+ /* Volume owned by the alternate controller */
-+ if (cur_vol_path_own == 0)
-+ asym_acc_state = TPG_ACT_NON_OPT;
-+ }
-+ tport_grp->asym_acc_state = asym_acc_state;
-+ DEBUG(printk("%s Update target port state =%d for"
-+ " mplun %p\n", __func__,
-+ tport_grp->asym_acc_state,mplun));
-+ }
-+ if (modify ) {
-+ qla2x00_update_lu_path_state(ha, NULL, fclun,
-+ 0, &tpg_id[0], asym_acc_state);
-+ }
-+ }
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_get_target_ports(fc_port_t *fcport, fc_lun_t *fclun, int modify)
-+{
-+ int rval = 0 ;
-+ int retry;
-+ uint16_t tpg_count;
-+ uint8_t tpg_id[2];
-+ uint16_t lun = 0;
-+ dma_addr_t tpg_dma;
-+ scsi_qla_host_t *ha;
-+ mp_lun_t *mplun;
-+ rpt_tport_grp_rsp_t *tpg;
-+ struct list_head *list, *temp;
-+ mp_tport_grp_t *tport_grp = NULL;
-+ tgt_port_grp_desc_0 *tpg_rtpg_0 = NULL;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ ENTER(__func__);
-+ DEBUG(printk(KERN_INFO "%s entered\n",__func__));
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fcport->loop_id));
-+ return rval;
-+ }
-+
-+ lun = fclun->lun;
-+ mplun = fclun->mplun;
-+ if (fclun->mplun == NULL) {
-+ DEBUG(printk("%s mplun does not exist for fclun=%p\n",
-+ __func__,fclun));
-+ return rval;
-+ }
-+
-+ /* LUN 0 on EVA/MSA device is a controller lun and does not support ALUA */
-+ if (fclun->asymm_support == TGT_PORT_GRP_UNSUPPORTED) {
-+ //qla2x00_test_active_lun(fcport, fclun);
-+ printk("%s(%ld): for lun=%d does not suuport ALUA \n",__func__,
-+ ha->instance,lun);
-+ rval = 1;
-+ return rval;
-+ }
-+
-+ tpg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tpg_dma);
-+ if (tpg == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TPG\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &tpg->p.rsp24.comp_status;
-+ sstatus = &tpg->p.rsp24.scsi_status;
-+ sense_data = tpg->p.rsp24.data;
-+ } else {
-+ cstatus = &tpg->p.rsp.comp_status;
-+ sstatus = &tpg->p.rsp.scsi_status;
-+ sense_data = tpg->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 2;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(tpg, 0, sizeof(rpt_tport_grp_rsp_t));
-+ tpg->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ tpg->p.cmd24.entry_count = 1;
-+ tpg->p.cmd24.nport_handle =
-+ cpu_to_le16(fcport->loop_id);
-+ tpg->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ tpg->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ tpg->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ tpg->p.cmd24.lun[1] = LSB(lun);
-+ tpg->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(tpg->p.cmd24.lun,
-+ sizeof(tpg->p.cmd24.lun));
-+ tpg->p.cmd24.task = TSK_SIMPLE;
-+ tpg->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_READ_DATA);
-+ tpg->p.cmd24.fcp_cdb[0] = SCSIOP_MAINTENANCE_IN;
-+ tpg->p.cmd24.fcp_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ tpg->p.cmd24.fcp_cdb[8] =
-+ (sizeof(rpt_tport_grp_data_t) >> 8) & 0xff;
-+ tpg->p.cmd24.fcp_cdb[9] =
-+ sizeof(rpt_tport_grp_data_t) & 0xff;
-+ host_to_fcp_swap(tpg->p.cmd24.fcp_cdb,
-+ sizeof(tpg->p.cmd24.fcp_cdb));
-+ tpg->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ tpg->p.cmd24.timeout = __constant_cpu_to_le16(10);
-+ tpg->p.cmd24.byte_count =
-+ __constant_cpu_to_le32(sizeof(rpt_tport_grp_data_t));
-+ tpg->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(tpg_dma + sizeof(struct sts_entry_24xx)));
-+ tpg->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(tpg_dma + sizeof(struct sts_entry_24xx)));
-+ tpg->p.cmd24.dseg_0_len =
-+ __constant_cpu_to_le32(sizeof(rpt_tport_grp_data_t));
-+ } else {
-+ memset(tpg, 0, sizeof(rpt_tport_grp_rsp_t));
-+ tpg->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ tpg->p.cmd.entry_count = 1;
-+ tpg->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, tpg->p.cmd.target, fcport->loop_id);
-+ tpg->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_READ | CF_SIMPLE_TAG);
-+ tpg->p.cmd.scsi_cdb[0] = SCSIOP_MAINTENANCE_IN;
-+ tpg->p.cmd.scsi_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ tpg->p.cmd.scsi_cdb[8] = (sizeof(rpt_tport_grp_data_t) >> 8)
-+ & 0xff;
-+ tpg->p.cmd.scsi_cdb[9] = sizeof(rpt_tport_grp_data_t) & 0xff;
-+ tpg->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ tpg->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ tpg->p.cmd.byte_count =
-+ __constant_cpu_to_le32(sizeof(rpt_tport_grp_data_t));
-+ tpg->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(tpg_dma + sizeof(sts_entry_t)));
-+ tpg->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(tpg_dma + sizeof(sts_entry_t)));
-+ tpg->p.cmd.dseg_0_length =
-+ __constant_cpu_to_le32(sizeof(rpt_tport_grp_data_t));
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, tpg, tpg_dma,
-+ sizeof(rpt_tport_grp_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && tpg->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) TPG failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ tpg->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ DEBUG5(printk("%s: lun (%d) Report Target Port group "
-+ " comp status 0x%x, scsi status 0x%x, rval=%d\n",
-+ __func__, lun, comp_status, scsi_status, rval));
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: Report Target Port group"
-+ " - comp status 0x%x, scsi status 0x%x, rval=%d\n",
-+ ha->host_no, fcport->loop_id, lun,__func__, comp_status,
-+ scsi_status, rval));
-+
-+ if (rval != QLA_SUCCESS ||
-+ comp_status != CS_COMPLETE ||
-+ scsi_status & SS_CHECK_CONDITION) {
-+
-+ /* Device underrun, treat as OK. */
-+ if (comp_status == CS_DATA_UNDERRUN &&
-+ scsi_status & SS_RESIDUAL_UNDER) {
-+
-+ rval = QLA_SUCCESS;
-+ comp_status = CS_COMPLETE;
-+ break;
-+ }
-+ }
-+
-+ if ((scsi_status & SS_CHECK_CONDITION)) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(tpg->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ tpg->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__,
-+ sense_data[2], sense_data[12], sense_data[13]));
-+ /* add checking for extended sense key for adaptec */
-+ if (sense_data[2] == NOT_READY)
-+ break;
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && --retry);
-+
-+ if (rval == QLA_SUCCESS && retry &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (sense_data[2] == NOT_READY)) && comp_status == CS_COMPLETE)) {
-+ memset(&tpg_id[0], 0, sizeof(tpg_id));
-+ /* find matching tpg_id and copy the asym_acc_state */
-+ for (tpg_count = 0; tpg_count < TGT_PORT_GRP_COUNT;
-+ tpg_count++) {
-+ /* In our original design, we assume there are two relative target port
-+ * groups per target port, but some storages (ie. MSA1500) only has one relative
-+ * target port per target port group, so we have a different structure definitions
-+ * for each type and use the appropriate one depending on how many ports the storage
-+ * has.
-+ * tpg = dual relative port devices
-+ * tpg_rtgp_0 = single relative port devices
-+ */
-+ if(tpg->list.tport_grp[0].tgt_port_count == 1){
-+ if (tpg_rtpg_0 == NULL)
-+ tpg_rtpg_0 = (tgt_port_grp_desc_0 *)
-+ &tpg->list.tport_grp[tpg_count];
-+ memcpy(&tpg_id[0], &tpg_rtpg_0->tgt_port_grp[0],
-+ sizeof(tpg_id));
-+ } else {
-+ memcpy(&tpg_id[0],
-+ &tpg->list.tport_grp[tpg_count].tgt_port_grp[0],
-+ sizeof(tpg_id));
-+
-+ }
-+ DEBUG2(printk("%s tpg_id[0]=0x%x tpg_id[1]=0x%x\n",
-+ __func__,tpg_id[0], tpg_id[1]));
-+
-+
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list){
-+ tport_grp = list_entry(list, mp_tport_grp_t,
-+ list);
-+ if (memcmp(tport_grp->tpg_id, &tpg_id[0],
-+ sizeof(tpg_id)) != 0)
-+ continue;
-+ /* copy the tgt port group state */
-+ if(tpg_rtpg_0 != NULL) {
-+ tport_grp->asym_acc_state =
-+ tpg_rtpg_0->state.asym_acc_state;
-+ } else {
-+ tport_grp->asym_acc_state =
-+ tpg->list.tport_grp[tpg_count].state.
-+ asym_acc_state;
-+ }
-+ DEBUG2(printk("%s Update target port state =%d for mplun %p\n",
-+ __func__,tport_grp->asym_acc_state,mplun));
-+ }
-+ if( modify ) {
-+ if(tpg_rtpg_0 != NULL)
-+ qla2x00_update_lu_path_state(ha, NULL,
-+ fclun,
-+ tpg_count, &tpg_id[0],
-+ tpg_rtpg_0->state.asym_acc_state);
-+ else
-+ qla2x00_update_lu_path_state(ha, tpg,
-+ fclun,
-+ tpg_count, &tpg_id[0],
-+ 0);
-+ }
-+ if(tpg_rtpg_0 != NULL)
-+ tpg_rtpg_0++;
-+
-+ }
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk(KERN_INFO "%s Failed to issue Report tgt port"
-+ " group -- lun (%d) cs=0x%x ss=0x%x, rval=%d\n",
-+ __func__, lun, comp_status, scsi_status, rval));
-+ rval = 0;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, tpg, tpg_dma);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_get_target_xports(fc_port_t *fcport, fc_lun_t *fclun, int modify)
-+{
-+ int rval = 0;
-+ int retry;
-+ uint16_t tpg_count;
-+ uint16_t lun = 0;
-+ dma_addr_t tpg_dma;
-+ scsi_qla_host_t *ha;
-+ mp_lun_t *mplun;
-+ rtpg_param_data_rsp_t *tpg;
-+ struct list_head *list, *temp;
-+ mp_tport_grp_t *tport_grp = NULL;
-+ tpg_desc_t *tport_grp_desc_end = NULL;
-+ tpg_desc_t *tport_grp_desc = NULL;
-+ rel_tport_desc_t *rel_tport;
-+ uint16_t comp_status = 0;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+ uint32_t rtpg_size;
-+ int expected_rtpg_siz;
-+ int max_port_count;
-+ int i;
-+
-+ ENTER(__func__);
-+ DEBUG(printk(KERN_INFO "%s entered\n",__func__));
-+
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fcport->loop_id));
-+ return rval;
-+ }
-+
-+ lun = fclun->lun;
-+ mplun = fclun->mplun;
-+ if (fclun->mplun == NULL) {
-+ DEBUG(printk("%s mplun does not exist for fclun=%p\n",
-+ __func__,fclun));
-+ return rval;
-+ }
-+
-+ /* LUN 0 on EVA/MSA device is a controller lun and does not support ALUA */
-+ if (fclun->asymm_support == TGT_PORT_GRP_UNSUPPORTED) {
-+ //qla2x00_test_active_lun(fcport, fclun);
-+ printk("%s(%ld): for lun=%d does not suuport ALUA \n",__func__,
-+ ha->instance,lun);
-+ rval = 1;
-+ return rval;
-+ }
-+
-+ /* We can handle RTPG parameters up to this size */
-+ expected_rtpg_siz = 4000;
-+ tpg = dma_alloc_coherent(&ha->pdev->dev,
-+ sizeof(rtpg_param_data_rsp_t) + expected_rtpg_siz, &tpg_dma,
-+ GFP_KERNEL);
-+ if (tpg == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TPG\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return rval;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &tpg->p.rsp24.comp_status;
-+ sstatus = &tpg->p.rsp24.scsi_status;
-+ sense_data = tpg->p.rsp24.data;
-+ } else {
-+ cstatus = &tpg->p.rsp.comp_status;
-+ sstatus = &tpg->p.rsp.scsi_status;
-+ sense_data = tpg->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 2;
-+ do {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(tpg, 0, sizeof(rtpg_param_data_rsp_t));
-+ tpg->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ tpg->p.cmd24.entry_count = 1;
-+ tpg->p.cmd24.nport_handle =
-+ cpu_to_le16(fcport->loop_id);
-+ tpg->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ tpg->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ tpg->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ tpg->p.cmd24.lun[1] = LSB(lun);
-+ tpg->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(tpg->p.cmd24.lun,
-+ sizeof(tpg->p.cmd24.fcp_cdb));
-+ tpg->p.cmd24.task = TSK_SIMPLE;
-+ tpg->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_READ_DATA);
-+ tpg->p.cmd24.fcp_cdb[0] = SCSIOP_MAINTENANCE_IN;
-+ tpg->p.cmd24.fcp_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ tpg->p.cmd24.fcp_cdb[8] =
-+ (expected_rtpg_siz >> 8) & 0xff;
-+ tpg->p.cmd24.fcp_cdb[9] = expected_rtpg_siz & 0xff;
-+ host_to_fcp_swap(tpg->p.cmd24.fcp_cdb,
-+ sizeof(tpg->p.cmd24.fcp_cdb));
-+ tpg->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ tpg->p.cmd24.timeout = __constant_cpu_to_le16(10);
-+ tpg->p.cmd24.byte_count =
-+ cpu_to_le32(expected_rtpg_siz);
-+ tpg->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(tpg_dma + sizeof(struct sts_entry_24xx)));
-+ tpg->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(tpg_dma + sizeof(struct sts_entry_24xx)));
-+ tpg->p.cmd24.dseg_0_len =
-+ cpu_to_le32(expected_rtpg_siz);
-+ } else {
-+ memset(tpg, 0, sizeof(rpt_tport_grp_rsp_t));
-+ tpg->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ tpg->p.cmd.entry_count = 1;
-+ tpg->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, tpg->p.cmd.target, fcport->loop_id);
-+ tpg->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_READ | CF_SIMPLE_TAG);
-+ tpg->p.cmd.scsi_cdb[0] = SCSIOP_MAINTENANCE_IN;
-+ tpg->p.cmd.scsi_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ tpg->p.cmd.scsi_cdb[8] =
-+ (expected_rtpg_siz >> 8) & 0xff;
-+ tpg->p.cmd.scsi_cdb[9] = expected_rtpg_siz & 0xff;
-+ tpg->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ tpg->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ tpg->p.cmd.byte_count = cpu_to_le32(expected_rtpg_siz);
-+ tpg->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(tpg_dma + sizeof(sts_entry_t)));
-+ tpg->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(tpg_dma + sizeof(sts_entry_t)));
-+ tpg->p.cmd.dseg_0_length =
-+ cpu_to_le32(expected_rtpg_siz);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, tpg, tpg_dma,
-+ sizeof(rpt_tport_grp_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && tpg->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld) TPG failed to complete IOCB "
-+ "-- error status (%x).\n", __func__, ha->host_no,
-+ tpg->p.rsp.entry_status));
-+ continue;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ DEBUG5(printk("%s: lun (%d) Report Target Port group "
-+ " comp status 0x%x, scsi status 0x%x, rval=%d\n",
-+ __func__, lun, comp_status, scsi_status, rval));
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ DEBUG(printk("scsi(%ld:%04x:%d) %s: Report Target Port group"
-+ " - comp status 0x%x, scsi status 0x%x, rval=%d\n",
-+ ha->host_no, fcport->loop_id, lun,__func__, comp_status,
-+ scsi_status, rval));
-+
-+ if (rval != QLA_SUCCESS ||
-+ comp_status != CS_COMPLETE ||
-+ scsi_status & SS_CHECK_CONDITION) {
-+
-+ /* Device underrun, treat as OK. */
-+ if (comp_status == CS_DATA_UNDERRUN &&
-+ scsi_status & SS_RESIDUAL_UNDER) {
-+
-+ rval = QLA_SUCCESS;
-+ comp_status = CS_COMPLETE;
-+ break;
-+ }
-+ }
-+
-+ if ((scsi_status & SS_CHECK_CONDITION)) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(tpg->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ tpg->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s: check status bytes = "
-+ "0x%02x 0x%02x 0x%02x\n", __func__,
-+ sense_data[2], sense_data[12], sense_data[13]));
-+ /* add checking for extended sense key for adaptec */
-+ if (sense_data[2] == NOT_READY)
-+ break;
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && --retry);
-+
-+ if (rval == QLA_SUCCESS && retry &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (sense_data[2] == NOT_READY)) && comp_status == CS_COMPLETE)) {
-+
-+ /* check for size match */
-+ rtpg_size = be32_to_cpu(tpg->data.len);
-+ if (rtpg_size > expected_rtpg_siz) {
-+ printk(KERN_INFO
-+ "scsi(%ld:%04x:%d) %s: Buffer too big - size 0x%x "
-+ "> 0x%x \n", ha->host_no, fcport->loop_id, lun,
-+ __func__, rtpg_size, expected_rtpg_siz);
-+ rtpg_size = expected_rtpg_siz;
-+ }
-+
-+ tport_grp_desc = (tpg_desc_t *)&tpg->data.tpg_desc_entry[0];
-+ max_port_count = tport_grp_desc->tgt_port_count;
-+ tport_grp_desc_end = (tpg_desc_t *) ((ulong)tport_grp_desc +
-+ (ulong)rtpg_size);
-+
-+ DEBUG5(printk("%s: Dump of RTPG parameter data [siz]= 0x%x, "
-+ "%d start address=%p max_port_count=%d, ending "
-+ "address=%p\n", __func__, rtpg_size, rtpg_size,
-+ &tpg->data, max_port_count, tport_grp_desc_end));
-+ DEBUG5(qla2x00_dump_buffer((uint8_t *)&tpg->data, rtpg_size));
-+
-+ /* find matching tpg_id and update the asym_acc_state */
-+ for (tpg_count = 0; tpg_count < 10 ; tpg_count++) {
-+ rel_tport = &tport_grp_desc->rel_tgt_port_entry[0];
-+ DEBUG5(printk("%s: Next TPG descr data: tpg_index=%d, "
-+ "tpg_desc id=0x%x:0x%x max_port_count=%d, "
-+ "tport_grp_desc=%p, rel_tport=%p\n", __func__,
-+ tpg_count, tport_grp_desc->tpg_id[0],
-+ tport_grp_desc->tpg_id[1], max_port_count,
-+ tport_grp_desc, rel_tport ));
-+ if ((ulong) rel_tport >= (ulong) tport_grp_desc_end) {
-+ DEBUG2(printk("Done\n"));
-+ break;
-+ }
-+ /*
-+ * Search our list for this entry and if match update
-+ * state info.
-+ */
-+ i = 0;
-+ list_for_each_safe(list, temp,
-+ &mplun->tport_grps_list) {
-+ tport_grp = list_entry(list, mp_tport_grp_t,
-+ list);
-+ /* matching TPG descriptors */
-+ if (tport_grp->tpg_id[0] ==
-+ tport_grp_desc->tpg_id[0] &&
-+ tport_grp->tpg_id[1] ==
-+ tport_grp_desc->tpg_id[1]) {
-+ /* copy the tgt port group state */
-+ tport_grp->asym_acc_state =
-+ tport_grp_desc->state.asym_acc_state;
-+ DEBUG2(printk("%s Found Matching TPG - "
-+ "Updating TPG state =%d for mplun "
-+ "%p\n", __func__,
-+ tport_grp->asym_acc_state,mplun));
-+ if (modify) {
-+ qla2x00_update_lu_path_state(
-+ ha, NULL, fclun, tpg_count,
-+ &tport_grp->tpg_id[0],
-+ tport_grp->asym_acc_state);
-+ }
-+ }
-+
-+ DEBUG2(printk("%s: TPG[%d] : our_tpg[%d]= "
-+ "0x%x:0x%x, tpg= 0x%x:0x%x, last rel_tport "
-+ "[%p]= 0x%x,0x%x\n", __func__, tpg_count,
-+ i, tport_grp->tpg_id[0],
-+ tport_grp->tpg_id[1],
-+ tport_grp_desc->tpg_id[0],
-+ tport_grp_desc->tpg_id[1], rel_tport,
-+ rel_tport->rel_port_id[0],
-+ rel_tport->rel_port_id[1] ));
-+ i++;
-+ }
-+
-+ /* Skip rel ports in the TPG descriptor */
-+ for (i = 0; i < max_port_count ; i++ , rel_tport++)
-+ ;
-+ /* next descriptor */
-+ tport_grp_desc = (tpg_desc_t *) rel_tport;
-+ }
-+ rval = 1;
-+ } else {
-+ DEBUG2(printk(KERN_INFO "%s Failed to issue Report tgt port"
-+ " group -- lun (%d) cs=0x%x ss=0x%x, rval=%d\n",
-+ __func__, lun, comp_status, scsi_status, rval));
-+ rval = 0;
-+ }
-+
-+ dma_free_coherent(&ha->pdev->dev,
-+ sizeof(rtpg_param_data_rsp_t) + expected_rtpg_siz, tpg, tpg_dma);
-+
-+ LEAVE(__func__);
-+
-+ return rval;
-+}
-+
-+
-+#if 0
-+/*
-+ * qla2x00_find_mp_dev_by_nn_and_pn
-+ * Find the mp_dev for the specified target name.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * name = Target name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_find_mp_dev_by_nn_and_pn(mp_host_t *host,
-+ uint8_t *portname, uint8_t *nodename)
-+{
-+ int id;
-+ int idx;
-+ mp_device_t *dp;
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id] ) == NULL)
-+ continue;
-+
-+ for (idx = 0; idx < MAX_PATHS_PER_DEVICE; idx++) {
-+ if (memcmp(&dp->nodenames[idx][0], nodename, WWN_SIZE) == 0 &&
-+ memcmp(&dp->portnames[idx][0], portname, WWN_SIZE) == 0 ) {
-+ DEBUG3(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id));
-+ return dp;
-+ }
-+ }
-+ }
-+
-+ return NULL;
-+}
-+
-+/*
-+ * qla2x00_is_nn_and_pn_in_device
-+ * Find the mp_dev for the specified target name.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * name = Target name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_is_nn_and_pn_in_device(mp_device_t *dp,
-+ uint8_t *portname, uint8_t *nodename)
-+{
-+ int idx;
-+
-+ for (idx = 0; idx < MAX_PATHS_PER_DEVICE; idx++) {
-+ if (memcmp(&dp->nodenames[idx][0], nodename, WWN_SIZE) == 0 &&
-+ memcmp(&dp->portnames[idx][0], portname, WWN_SIZE) == 0 ) {
-+ DEBUG3(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id));
-+ return dp;
-+ }
-+ }
-+
-+ return NULL;
-+}
-+#endif
-+
-+/*
-+ * qla2x00_export_target
-+ * Look through the existing multipath control tree, and find
-+ * an mp_lun_t with the supplied world-wide lun number. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter to add device to.
-+ * dev_id Index of device on adapter.
-+ * port port database information.
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * If the MP HOST does not already point to the mp_device_t,
-+ * a pointer is added at the proper port offset.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_export_target( void *vhost, uint16_t dev_id,
-+ fc_port_t *fcport, uint16_t pathid)
-+{
-+ mp_host_t *host = (mp_host_t *) vhost;
-+ mp_path_t *path;
-+ mp_device_t *dp = NULL;
-+ int names_valid; /* Node name and port name are not zero */
-+ int node_found; /* Found matching node name. */
-+ int port_found; /* Found matching port name. */
-+ mp_device_t *temp_dp;
-+ int i;
-+ uint16_t new_id = dev_id;
-+ uint16_t idx;
-+
-+ DEBUG3(printk("%s(%ld): Entered. host=%p, fcport =%p, dev_id = %d\n",
-+ __func__, host->ha->host_no, host, fcport, dev_id));
-+
-+ temp_dp = qla2x00_find_mp_dev_by_id(host,dev_id);
-+
-+ /* if Device already known at this port. */
-+ if (temp_dp != NULL) {
-+ node_found = qla2x00_is_nodename_equal(temp_dp->nodename,
-+ fcport->node_name);
-+ port_found = qla2x00_is_portname_in_device(temp_dp,
-+ fcport->port_name);
-+ /* found */
-+ if (node_found && port_found)
-+ dp = temp_dp;
-+
-+ }
-+
-+
-+ /* Sanity check the port information */
-+ names_valid = (!qla2x00_is_ww_name_zero(fcport->node_name) &&
-+ !qla2x00_is_ww_name_zero(fcport->port_name));
-+
-+ /*
-+ * If the optimized check failed, loop through each known
-+ * device on this known adapter looking for the node name.
-+ */
-+ if (dp == NULL && names_valid) {
-+ if( (temp_dp = qla2x00_find_mp_dev_by_portname(host,
-+ fcport->port_name, &idx)) == NULL ) {
-+ /* find a good index */
-+ for( i = dev_id; i < MAX_MP_DEVICES; i++ )
-+ if(host->mp_devs[i] == NULL ) {
-+ new_id = i;
-+ break;
-+ }
-+ } else if( temp_dp != NULL ) { /* found dp */
-+ if( qla2x00_is_nodename_equal(temp_dp->nodename,
-+ fcport->node_name) ) {
-+ new_id = temp_dp->dev_id;
-+ dp = temp_dp;
-+ }
-+ }
-+ }
-+
-+ /* If we couldn't find one, allocate one. */
-+ if (dp == NULL &&
-+ ((fcport->flags & FC_CONFIG) || !mp_config_required)) {
-+
-+ DEBUG2(printk("%s(%d): No match for WWPN. Creating new mpdev \n"
-+ "node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->instance,
-+ fcport->node_name[0], fcport->node_name[1],
-+ fcport->node_name[2], fcport->node_name[3],
-+ fcport->node_name[4], fcport->node_name[5],
-+ fcport->node_name[6], fcport->node_name[7],
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+ dp = qla2x00_allocate_mp_dev(fcport->node_name,
-+ fcport->port_name);
-+
-+ DEBUG2(printk("%s(%ld): (2) mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, new_id, dp));
-+ host->mp_devs[new_id] = dp;
-+ dp->dev_id = new_id;
-+ dp->use_cnt++;
-+ }
-+
-+ /*
-+ * We either have found or created a path list. Find this
-+ * host's path in the path list or allocate a new one
-+ * and add it to the list.
-+ */
-+ if (dp == NULL) {
-+ /* We did not create a mp_dev for this port. */
-+ fcport->mp_byte |= MP_MASK_UNCONFIGURED;
-+ DEBUG2(printk("%s: Device NOT found or created at "
-+ " dev_id=%d.\n",
-+ __func__, dev_id));
-+ return 0;
-+ }
-+
-+ path = qla2x00_find_or_allocate_path(host, dp, dev_id,
-+ pathid, fcport);
-+ if (path == NULL) {
-+ DEBUG2(printk("%s:Path NOT found or created.\n",
-+ __func__));
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+
-+static int
-+qla2x00_add_path_to_active_list( mp_lun_t *lun, lu_path_t *lun_path)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *nwlun_path = NULL;
-+ fc_lun_t *fclun;
-+ unsigned long flags;
-+ unsigned long cpu_flags = 0;
-+
-+ spin_lock_irqsave(&lun->mplock, cpu_flags);
-+ list_for_each_safe(list, temp, &lun->active_list) {
-+ nwlun_path = list_entry(list, lu_path_t, next_active);
-+ if( nwlun_path == lun_path )
-+ {
-+ DEBUG2(printk("%s: ** Already in active list-lun %d fclun %p pathid=%d loop id %02x -act cnt= %d, dp->lbtype=%d\n",
-+ __func__,lun_path->fclun->lun,
-+ lun_path->fclun,lun_path->path_id,lun_path->fclun->fcport->loop_id,lun->act_cnt,lun->dp->lbtype));
-+
-+ if ( (fclun = lun_path->fclun ) != NULL ) {
-+ spin_lock(&fclun->fcport->ha->hardware_lock);
-+ fclun->s_time = 0;
-+ fclun->io_cnt = 0;
-+ spin_unlock(&fclun->fcport->ha->hardware_lock);
-+ }
-+ spin_unlock_irqrestore(&lun->mplock, cpu_flags);
-+ return 0;
-+ }
-+ }
-+ spin_unlock_irqrestore(&lun->mplock, cpu_flags);
-+
-+ DEBUG2(printk("%s: +++ Adding lun %d fclun %p pathid=%d loop id %02x... to active list -count %d\n",
-+ __func__,lun_path->fclun->lun,
-+ lun_path->fclun,lun_path->path_id,lun_path->fclun->fcport->loop_id,lun->act_cnt));
-+ spin_lock_irqsave(&lun->mplock, cpu_flags);
-+ list_add_tail(&lun_path->next_active, &lun->active_list);
-+ lun->act_cnt++;
-+ spin_unlock_irqrestore(&lun->mplock, cpu_flags);
-+
-+ /* reset service time, so it can be retries
-+ once it gets restored */
-+ if ( (fclun = lun_path->fclun ) != NULL ) {
-+ spin_lock_irqsave(&fclun->fcport->ha->hardware_lock, flags);
-+ fclun->s_time = 0;
-+ fclun->io_cnt = 0;
-+ spin_unlock_irqrestore(&fclun->fcport->ha->hardware_lock, flags);
-+ }
-+ return 1;
-+}
-+
-+static void
-+qla2x00_change_active_path( mp_lun_t *lun, fc_lun_t *fclun, srb_t *sp)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *lun_path;
-+ fc_lun_t *tmp_fclun = NULL;
-+ unsigned long cpu_flags = 0;
-+
-+ spin_lock_irqsave(&lun->mplock, cpu_flags);
-+ list_for_each_safe(list, temp, &lun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ tmp_fclun = lun_path->fclun;
-+ if( tmp_fclun != fclun ) {
-+ DEBUG2(printk("%s: -+-+ Changing to fclun %p, path_id=%d, loop_id %02x io_cnt= %ld s_time = %ld ...\n",
-+ __func__,tmp_fclun,lun_path->path_id,tmp_fclun->fcport->loop_id,
-+ tmp_fclun->io_cnt,tmp_fclun->s_time));
-+ sp->lun_queue->fclun = tmp_fclun;
-+ lun->active = lun_path->path_id;
-+ break;
-+ }
-+ }
-+ spin_unlock_irqrestore(&lun->mplock, cpu_flags);
-+}
-+
-+int
-+qla2x00_del_fclun_from_active_list(mp_lun_t *lun, fc_lun_t *fclun, srb_t *sp)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *lun_path;
-+ unsigned long cpu_flags = 0;
-+ int switch_paths = 0;
-+
-+ DEBUG(printk("%s\n",__func__));
-+ spin_lock_irqsave(&lun->mplock, cpu_flags);
-+ list_for_each_safe(list, temp, &lun->active_list) {
-+ lun_path = list_entry(list, lu_path_t, next_active);
-+ DEBUG(printk("%s: active list entry: lun %d mplun->fclun %p fclun=%p "
-+ "pathid=%d loop id %02x... to active list -count %d\n",
-+ __func__,lun_path->fclun->lun,
-+ lun_path->fclun,fclun,lun_path->path_id,
-+ lun_path->fclun->fcport->loop_id,lun->act_cnt));
-+ if( lun_path->fclun == fclun )
-+ {
-+ DEBUG2(printk("%s: ---- Removing lun %d fclun %p pathid=%d loop id %02x... to active list -count %d\n",
-+ __func__,lun_path->fclun->lun,
-+ lun_path->fclun,lun_path->path_id,lun_path->fclun->fcport->loop_id,lun->act_cnt));
-+ list_del_init(list);
-+ if( lun->act_cnt > 0 )
-+ lun->act_cnt--;
-+ switch_paths++;
-+ break;
-+ }
-+ }
-+ spin_unlock_irqrestore(&lun->mplock, cpu_flags);
-+ if ( switch_paths )
-+ qla2x00_change_active_path( lun, fclun, sp);
-+ if( lun->act_cnt == 0 )
-+ return 1;
-+ return 0;
-+}
-+
-+/*
-+ * qla2x00_combine_by_lunid
-+ * Look through the existing multipath control tree, and find
-+ * an mp_lun_t with the supplied world-wide lun number. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter to add device to.
-+ * dev_id Index of device on adapter.
-+ * port port database information.
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * If the MP HOST does not already point to the mp_device_t,
-+ * a pointer is added at the proper port offset.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_combine_by_lunid( void *vhost, uint16_t dev_id,
-+ fc_port_t *fcport, uint16_t pathid)
-+{
-+ mp_host_t *host = (mp_host_t *) vhost;
-+ int fail = 0;
-+ mp_path_t *path;
-+ mp_device_t *dp = NULL;
-+ fc_lun_t *fclun;
-+ mp_lun_t *lun;
-+ int names_valid; /* Node name and port name are not zero */
-+ mp_host_t *temp_host; /* pointer to temporary host */
-+ mp_device_t *temp_dp;
-+ mp_port_t *port;
-+ mp_tport_grp_t *tpg;
-+ lu_path_t *lu_path = NULL;
-+ int l;
-+
-+ ENTER("qla2x00_combine_by_lunid");
-+ DEBUG3(printk("Entering %s\n", __func__));
-+
-+ /*
-+ * Currently, not use because we create common nodename for
-+ * the gui, so we can use the normal common namename processing.
-+ */
-+ if (fcport->flags & FC_CONFIG) {
-+ /* Search for device if not found create one */
-+
-+ temp_dp = qla2x00_find_mp_dev_by_id(host,dev_id);
-+
-+ /* if Device already known at this port. */
-+ if (temp_dp != NULL) {
-+ DEBUG(printk("%s: Found an existing "
-+ "dp %p- host %p inst=%d, fcport =%p, path id = %d\n",
-+ __func__, temp_dp, host, host->instance, fcport,
-+ pathid));
-+ if( qla2x00_is_portname_in_device(temp_dp,
-+ fcport->port_name) ) {
-+
-+ DEBUG2(printk("%s: mp dev %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x exists on %p. dev id %d. path cnt=%d.\n",
-+ __func__,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7],
-+ temp_dp, dev_id, temp_dp->path_list->path_cnt));
-+ dp = temp_dp;
-+ }
-+
-+ }
-+
-+ /*
-+ * If the optimized check failed, loop through each known
-+ * device on each known adapter looking for the node name
-+ * and port name.
-+ */
-+ if (dp == NULL) {
-+ /*
-+ * Loop through each potential adapter for the
-+ * specified target (dev_id). If a device is
-+ * found then add this port or use it.
-+ */
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ /* user specifies the target via dev_id */
-+ temp_dp = temp_host->mp_devs[dev_id];
-+ if (temp_dp == NULL) {
-+ continue;
-+ }
-+ if( qla2x00_is_portname_in_device(temp_dp,
-+ fcport->port_name) ) {
-+ dp = temp_dp;
-+ } else {
-+ qla2x00_add_portname_to_mp_dev(
-+ temp_dp, fcport->port_name,
-+ fcport->node_name);
-+ dp = temp_dp;
-+ host->mp_devs[dev_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ break;
-+ }
-+ }
-+
-+ /* Sanity check the port information */
-+ names_valid = (!qla2x00_is_ww_name_zero(fcport->node_name) &&
-+ !qla2x00_is_ww_name_zero(fcport->port_name));
-+
-+ if (dp == NULL && names_valid &&
-+ ((fcport->flags & FC_CONFIG) || !mp_config_required) ) {
-+
-+ DEBUG2(printk("%s(%ld): No match. adding new mpdev on "
-+ "dev_id %d. node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dev_id,
-+ fcport->node_name[0], fcport->node_name[1],
-+ fcport->node_name[2], fcport->node_name[3],
-+ fcport->node_name[4], fcport->node_name[5],
-+ fcport->node_name[6], fcport->node_name[7],
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+ dp = qla2x00_allocate_mp_dev(fcport->node_name,
-+ fcport->port_name);
-+
-+ host->mp_devs[dev_id] = dp;
-+ dp->dev_id = dev_id;
-+ dp->use_cnt++;
-+ }
-+
-+ /*
-+ * We either have found or created a path list. Find this
-+ * host's path in the path list or allocate a new one
-+ * and add it to the list.
-+ */
-+ if (dp == NULL) {
-+ /* We did not create a mp_dev for this port. */
-+ fcport->mp_byte |= MP_MASK_UNCONFIGURED;
-+ DEBUG2(printk("%s: Device NOT found or created at "
-+ " dev_id=%d.\n",
-+ __func__, dev_id));
-+ return 0;
-+ }
-+
-+ /*
-+ * Find the path in the current path list, or allocate
-+ * a new one and put it in the list if it doesn't exist.
-+ * Note that we do NOT set bSuccess to 0 in the case
-+ * of failure here. We must tolerate the situation where
-+ * the customer has more paths to a device than he can
-+ * get into a PATH_LIST.
-+ */
-+ path = qla2x00_find_or_allocate_path(host, dp, dev_id,
-+ pathid, fcport);
-+ if (path == NULL) {
-+ DEBUG2(printk("%s:Path NOT found or created.\n",
-+ __func__));
-+ return 0;
-+ }
-+
-+ /*
-+ * Set the PATH flag to match the device flag of whether this
-+ * device needs a relogin. If any device needs relogin, set
-+ * the relogin countdown.
-+ */
-+ path->config = 1;
-+ } else {
-+ if (mp_initialized && fcport->flags & FC_MSA_DEVICE) {
-+ qla2x00_test_active_port(fcport);
-+ }
-+ list_for_each_entry(fclun, &fcport->fcluns, list) {
-+ if (mp_initialized &&
-+ fcport->flags & FC_EVA_DEVICE) {
-+ qla2x00_test_active_lun(fcport, fclun, NULL );
-+ }
-+ lun = qla2x00_find_or_allocate_lun(host, dev_id,
-+ fcport, fclun);
-+
-+ if (lun == NULL) {
-+ fail++;
-+ continue;
-+ }
-+ /*
-+ * Find the path in the current path list, or allocate
-+ * a new one and put it in the list if it doesn't exist.
-+ */
-+ dp = lun->dp;
-+ if (fclun->mplun == NULL ) {
-+ fclun->mplun = lun;
-+ lun->asymm_support = fclun->asymm_support;
-+ }
-+ path = qla2x00_find_or_allocate_path(host, dp,
-+ dp->dev_id, pathid, fcport);
-+ if (path == NULL || dp == NULL) {
-+ fail++;
-+ continue;
-+ }
-+
-+ /* set up the path at lun level */
-+ lu_path = qla2x00_find_or_allocate_lu_path(host,
-+ fclun, path->id);
-+ if (lu_path == NULL) {
-+ fail++;
-+ continue;
-+ }
-+
-+ /* set the lun active flag */
-+ /* Kludge: HSV210(EVA-AA) reports controller lun as
-+ * Disk Type. Controller lun on HSV210 does not
-+ * support TgtPortGrp. Mark this lun as active for OS
-+ * to scan beyond Lun Zero.
-+ */
-+ if (mp_initialized &&
-+ fcport->flags & (FC_AA_EVA_DEVICE |
-+ FC_AA_MSA_DEVICE | FC_NVSXXX_DEVICE)) {
-+ qla2x00_test_active_lun( path->port, fclun, NULL );
-+ }
-+
-+ /* Add fclun to path list */
-+ if (lun->paths[path->id] == NULL) {
-+ lun->paths[path->id] = fclun;
-+ DEBUG2(printk("Updated path[%d]= %p for lun %p\n",
-+ path->id, fclun, lun));
-+ lun->path_cnt++;
-+ }
-+
-+ /*
-+ * if we have a visible lun then make
-+ * the target visible as well
-+ */
-+ l = lun->number;
-+ if (fclun->flags & FLF_VISIBLE_LUN) {
-+ if (dp->path_list->visible ==
-+ PATH_INDEX_INVALID) {
-+ dp->path_list->visible = path->id;
-+ DEBUG2(printk("%s: dp %p setting "
-+ "visible id to %d\n",
-+ __func__,dp,path->id ));
-+ }
-+ dp->path_list->current_path[l] = path->id;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+
-+ DEBUG2(printk("%s: Found a controller path 0x%x "
-+ "- lun %d\n", __func__, path->id,l));
-+ printk("%s: Found a controller path 0x%x "
-+ "- lun %d\n", __func__, path->id,l);
-+ } else if (mp_initialized && path->config ) {
-+ if (path->lun_data.data[l] &
-+ LUN_DATA_PREFERRED_PATH) {
-+ /*
-+ * If this is not the first path added, if this
-+ * is the preferred path, so make it the
-+ * current path.
-+ */
-+ dp->path_list->current_path[l] = path->id;
-+ lun->config_pref_id = path->id;
-+ }
-+ } else if (mp_initialized &&
-+ ((fcport->fo_target_port == NULL))) {
-+ /*
-+ * Whenever a port or lun is "active" then
-+ * force it to be a preferred path.
-+ */
-+ if (qla2x00_find_first_active_path(dp, lun)
-+ == path ){
-+ dp->path_list->current_path[l] =
-+ path->id;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk(
-+ "%s: Found (find first) preferred lun at loopid=0x%02x, lun=%d, pathid=%d\n",
-+ __func__, fcport->loop_id, l, path->id));
-+ } else if (fcport->flags & (FC_MSA_DEVICE
-+ | FC_EVA_DEVICE)) {
-+ dp->path_list->current_path[l] =
-+ 0;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ DEBUG2(printk(
-+ "%s: Setting first path as preferred lun at loopid=0x%02x, lun=%d, pathid=%d\n",
-+ __func__, fcport->loop_id, l, path->id));
-+ }
-+ }
-+
-+ port = qla2x00_find_or_allocate_port(host, lun, path);
-+ if (port == NULL) {
-+ fail++;
-+ continue;
-+ }
-+
-+ if (fcport->fo_target_port) {
-+ if ((fcport->fo_target_port ==
-+ qla2x00_get_target_ports) &&
-+ (fclun->asymm_support ==
-+ TGT_PORT_GRP_UNSUPPORTED)) {
-+ DEBUG(printk("%s lun = %d does not support"
-+ " ALUA\n",__func__,fclun->lun));
-+ printk("%s lun = %d does not support"
-+ " ALUA\n",__func__,fclun->lun);
-+ memcpy(&lu_path->rel_tport_id[0], &port->rel_tport_id[0],
-+ sizeof(port->rel_tport_id));
-+ } else {
-+ tpg = qla2x00_find_or_allocate_tgt_port_grp(
-+ host, port, fclun,path);
-+ if (tpg == NULL) {
-+ fail++;
-+ continue;
-+ }
-+ if (lu_path->flags & LPF_TPG_UNKNOWN) {
-+ memcpy(&lu_path->tpg_id[0], &tpg->tpg_id[0],
-+ sizeof(tpg->tpg_id));
-+ memcpy(&lu_path->rel_tport_id[0], &port->rel_tport_id[0],
-+ sizeof(port->rel_tport_id));
-+ }
-+ if (mp_initialized) {
-+ /* set the tgt port grp state */
-+ fcport->fo_target_port(fcport,fclun,1);
-+ }
-+ }
-+ }
-+
-+ /*
-+ * create active path list for load balancing:
-+ * - All paths ACT_OPT and NON_ACT_OPT
-+ */
-+ if (lun->load_balance_type >= LB_LRU) {
-+ if (!(fclun->flags & FLF_VISIBLE_LUN)) {
-+ if ( (fclun->flags & FLF_ACTIVE_LUN) ||
-+ fcport->fo_target_port) {
-+ /* all path s ACT_OPT and NON_ACT_OPT */
-+ qla2x00_add_path_to_active_list(lun,
-+ lu_path);
-+ }
-+ if ((lu_path->flags & LPF_TPG_UNKNOWN))
-+ lu_path->flags &= ~LPF_TPG_UNKNOWN;
-+ }
-+ } else {
-+ /* create active path list for set preferred paths */
-+ if ((lu_path->flags & LPF_TPG_UNKNOWN) &&
-+ !(fclun->flags & FLF_VISIBLE_LUN)) {
-+ if (fcport->fo_target_port) {
-+ if (lu_path->asym_acc_state ==
-+ TPG_ACT_OPT) {
-+ DEBUG2(printk("%s(%d): Setting "
-+ "TPG_ACT_OPT loopid=0x%02x "
-+ "lu_path tpg_id=0x%x "
-+ "rel_tport_id=0x%x lun=%d "
-+ "fclun_flags=%d\n",
-+ __func__, host->instance,
-+ fclun->fcport->loop_id,
-+ lu_path->tpg_id[1],
-+ lu_path->rel_tport_id[1],
-+ l, fclun->flags));
-+ qla2x00_add_path_to_active_list(lun,
-+ lu_path);
-+ }
-+ } else if (fclun->flags & FLF_ACTIVE_LUN) {
-+ qla2x00_add_path_to_active_list(lun,
-+ lu_path);
-+ }
-+ lu_path->flags &= ~LPF_TPG_UNKNOWN;
-+
-+ DEBUG(printk("%s(%d): lu_path tpg_id=0x%x "
-+ "rel_tport_id=0x%x lun=%d\n fclun_flags=%d",
-+ __func__, host->instance,
-+ lu_path->tpg_id[1],
-+ lu_path->rel_tport_id[1],l, fclun->flags));
-+ }
-+ }
-+
-+ } /* end of list_for_each_entry() */
-+ }
-+
-+ if (fail)
-+ return 0;
-+ return 1;
-+}
-+
-+#if 0
-+/*
-+ * qla2x00_find_or_allocate_mp_dev
-+ * Look through the existing multipath control tree, and find
-+ * an mp_device_t with the supplied world-wide node name. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter to add device to.
-+ * dev_id Index of device on adapter.
-+ * port port database information.
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * If the MP HOST does not already point to the mp_device_t,
-+ * a pointer is added at the proper port offset.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_find_or_allocate_mp_dev(mp_host_t *host, uint16_t dev_id,
-+ fc_port_t *port)
-+{
-+ mp_device_t *dp = NULL; /* pointer to multi-path device */
-+ int node_found; /* Found matching node name. */
-+ int port_found; /* Found matching port name. */
-+ int names_valid; /* Node name and port name are not zero */
-+ mp_host_t *temp_host; /* pointer to temporary host */
-+
-+ uint16_t j;
-+ mp_device_t *temp_dp;
-+
-+ ENTER("qla2x00_find_or_allocate_mp_dev");
-+
-+ DEBUG3(printk("%s(%ld): entered. host=%p, port =%p, dev_id = %d\n",
-+ __func__, host->ha->host_no, host, port, dev_id));
-+
-+ temp_dp = qla2x00_find_mp_dev_by_id(host,dev_id);
-+
-+ DEBUG3(printk("%s: temp dp =%p\n", __func__, temp_dp));
-+ /* if Device already known at this port. */
-+ if (temp_dp != NULL) {
-+ node_found = qla2x00_is_nodename_equal(temp_dp->nodename,
-+ port->node_name);
-+ port_found = qla2x00_is_portname_in_device(temp_dp,
-+ port->port_name);
-+
-+ if (node_found && port_found) {
-+ DEBUG3(printk("%s: mp dev %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x exists on %p. dev id %d. path cnt=%d.\n",
-+ __func__,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ temp_dp, dev_id, temp_dp->path_list->path_cnt));
-+ dp = temp_dp;
-+
-+ /*
-+ * Copy the LUN configuration data
-+ * into the mp_device_t.
-+ */
-+ }
-+ }
-+
-+
-+ /* Sanity check the port information */
-+ names_valid = (!qla2x00_is_ww_name_zero(port->node_name) &&
-+ !qla2x00_is_ww_name_zero(port->port_name));
-+
-+ /*
-+ * If the optimized check failed, loop through each known
-+ * device on each known adapter looking for the node name.
-+ */
-+ if (dp == NULL && names_valid) {
-+ DEBUG3(printk("%s: Searching each adapter for the device...\n",
-+ __func__));
-+
-+ /* Check for special cases. */
-+ if (port->flags & FC_CONFIG) {
-+ /* Here the search is done only for ports that
-+ * are found in config file, so we can count on
-+ * mp_byte value when binding the paths.
-+ */
-+ DEBUG3(printk("%s(%ld): mpbyte=%02x process configured "
-+ "portname=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no, port->mp_byte,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ DEBUG3(printk("%s(%ld): nodename %02x%02x%02x%02x%02x"
-+ "%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7]));
-+
-+ if (port->mp_byte == 0) {
-+ DEBUG3(printk("%s(%ld): port visible.\n",
-+ __func__, host->ha->host_no));
-+
-+ /* This device in conf file is set to visible */
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ /* Search all hosts with given tgt id
-+ * for any previously created dp with
-+ * matching node name.
-+ */
-+ temp_dp = temp_host->mp_devs[dev_id];
-+ if (temp_dp == NULL) {
-+ continue;
-+ }
-+
-+ node_found =
-+ qla2x00_is_nodename_equal(
-+ temp_dp->nodename, port->node_name);
-+
-+ if (node_found &&
-+ qla2x00_found_hidden_path(
-+ temp_dp)) {
-+ DEBUG3(printk(
-+ "%s(%ld): found "
-+ "mpdev of matching "
-+ "node %02x%02x%02x"
-+ "%02x%02x%02x%02x"
-+ "%02x w/ hidden "
-+ "paths. dp=%p "
-+ "dev_id=%d.\n",
-+ __func__,
-+ host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, dev_id));
-+ /*
-+ * Found the mpdev.
-+ * Treat this same as default
-+ * case by adding this port
-+ * to this mpdev which has same
-+ * nodename.
-+ */
-+ qla2x00_add_portname_to_mp_dev(
-+ temp_dp, port->port_name, port->node_name);
-+ dp = temp_dp;
-+ host->mp_devs[dev_id] = dp;
-+ dp->use_cnt++;
-+
-+ break;
-+ }
-+ }
-+
-+ } else if (port->mp_byte & MP_MASK_OVERRIDE) {
-+ /* Bind on port name */
-+ DEBUG3(printk(
-+ "%s(%ld): port has override bit.\n",
-+ __func__, host->ha->host_no));
-+
-+ temp_dp = qla2x00_find_dp_by_pn_from_all_hosts(
-+ port->port_name, &j);
-+
-+ if (temp_dp) {
-+ /* Found match */
-+ DEBUG3(printk("%s(%ld): update mpdev "
-+ "on Matching port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x "
-+ "dp %p dev_id %d\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, j));
-+ /*
-+ * Bind this port to this mpdev of the
-+ * matching port name.
-+ */
-+ dp = temp_dp;
-+ host->mp_devs[j] = dp;
-+ dp->use_cnt++;
-+ }
-+ } else {
-+ DEBUG3(printk("%s(%ld): default case.\n",
-+ __func__, host->ha->host_no));
-+ /* Default case. Search and bind/add this
-+ * port to the mp_dev with matching node name
-+ * if it is found.
-+ */
-+ dp = qla2x00_default_bind_mpdev(host, port);
-+ }
-+
-+ } else {
-+ DEBUG3(printk("%s(%ld): process discovered port "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ DEBUG3(printk("%s(%ld): nodename %02x%02x%02x%02x%02x"
-+ "%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7]));
-+
-+ /* Here we try to find the mp_dev pointer for the
-+ * current port in the current host, which would
-+ * have been created if the port was specified in
-+ * the config file. To be sure the mp_dev we found
-+ * really is for the current port, we check the
-+ * node name to make sure it matches also.
-+ * When we find a previously created mp_dev pointer
-+ * for the current port, just return the pointer.
-+ * We proceed to add this port to an mp_dev of
-+ * the matching node name only if it is not found in
-+ * the mp_dev list already created and ConfigRequired
-+ * is not set.
-+ */
-+ temp_dp = qla2x00_find_mp_dev_by_portname(host,
-+ port->port_name, &j);
-+
-+ if (temp_dp && qla2x00_is_nodename_equal(
-+ temp_dp->nodename, port->node_name)) {
-+ /* Found match. This mpdev port was created
-+ * from config file entry.
-+ */
-+ DEBUG3(printk("%s(%ld): update mpdev "
-+ "on Matching port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x "
-+ "dp %p dev_id %d\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, j));
-+
-+ dp = temp_dp;
-+ } else if (!mp_config_required) {
-+
-+ DEBUG3(printk("%s(%ld): default case.\n",
-+ __func__, host->ha->host_no));
-+ /* Default case. Search and bind/add this
-+ * port to the mp_dev with matching node name
-+ * if it is found.
-+ */
-+ dp = qla2x00_default_bind_mpdev(host, port);
-+ }
-+ }
-+ }
-+
-+ /* If we couldn't find one, allocate one. */
-+ if (dp == NULL &&
-+ ((port->flags & FC_CONFIG) || !mp_config_required)) {
-+
-+ DEBUG3(printk("%s(%ld): No match. adding new mpdev on "
-+ "dev_id %d. node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dev_id,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ dp = qla2x00_allocate_mp_dev(port->node_name, port->port_name);
-+
-+#ifdef QL_DEBUG_LEVEL_2
-+ if (host->mp_devs[dev_id] != NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: invalid/unsupported configuration found. "
-+ "overwriting target id %d.\n",
-+ dev_id);
-+ }
-+#endif
-+ host->mp_devs[dev_id] = dp;
-+ dp->dev_id = dev_id;
-+ dp->use_cnt++;
-+ }
-+
-+ DEBUG3(printk("%s(%ld): exiting. return dp=%p.\n",
-+ __func__, host->ha->host_no, dp));
-+ LEAVE("qla2x00_find_or_allocate_mp_dev");
-+
-+ return dp;
-+}
-+#endif
-+
-+/*
-+ * qla2x00_default_bind_mpdev
-+ *
-+ * Input:
-+ * host = mp_host of current adapter
-+ * port = fc_port of current port
-+ *
-+ * Returns:
-+ * mp_device pointer
-+ * NULL - not found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static inline mp_device_t *
-+qla2x00_default_bind_mpdev(mp_host_t *host, fc_port_t *port)
-+{
-+ /* Default search case */
-+ int devid = 0;
-+ mp_device_t *temp_dp = NULL; /* temporary pointer */
-+ mp_host_t *temp_host; /* temporary pointer */
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ for (devid = 0; devid < MAX_MP_DEVICES; devid++) {
-+ temp_dp = temp_host->mp_devs[devid];
-+
-+ if (temp_dp == NULL)
-+ continue;
-+
-+ if (qla2x00_is_nodename_equal(temp_dp->nodename,
-+ port->node_name)) {
-+ DEBUG3(printk(
-+ "%s: Found matching dp @ host %p id %d:\n",
-+ __func__, temp_host, devid));
-+ break;
-+ }
-+ }
-+ if (temp_dp != NULL) {
-+ /* found a match. */
-+ break;
-+ }
-+ }
-+
-+ if (temp_dp) {
-+ DEBUG3(printk("%s(%ld): update mpdev "
-+ "on Matching node at dp %p. "
-+ "dev_id %d adding new port %p-%02x"
-+ "%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no,
-+ temp_dp, devid, port,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+ if (!qla2x00_is_portname_in_device(temp_dp,
-+ port->port_name)) {
-+ qla2x00_add_portname_to_mp_dev(temp_dp,
-+ port->port_name, port->node_name);
-+ }
-+
-+ /*
-+ * Set the flag that we have
-+ * found the device.
-+ */
-+ host->mp_devs[devid] = temp_dp;
-+ temp_dp->use_cnt++;
-+
-+ /* Fixme(dg)
-+ * Copy the LUN info into
-+ * the mp_device_t
-+ */
-+ }
-+
-+ return (temp_dp);
-+}
-+
-+/*
-+ * qla2x00_find_or_allocate_mp_dev
-+ * Look through the existing multipath control tree, and find
-+ * an mp_device_t with the supplied world-wide node name. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter to add device to.
-+ * dev_id Index of device on adapter.
-+ * port port database information.
-+ *
-+ * Returns:
-+ * Pointer to new mp_device_t, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * If the MP HOST does not already point to the mp_device_t,
-+ * a pointer is added at the proper port offset.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_find_or_allocate_mp_dev(mp_host_t *host, uint16_t dev_id,
-+ fc_port_t *port)
-+{
-+ mp_device_t *dp = NULL; /* pointer to multi-path device */
-+ uint8_t node_found; /* Found matching node name. */
-+ uint8_t port_found; /* Found matching port name. */
-+ uint8_t names_valid; /* Node name and port name are not zero */
-+ mp_host_t *temp_host; /* pointer to temporary host */
-+
-+ uint16_t j;
-+ mp_device_t *temp_dp;
-+
-+ ENTER("qla2x00_find_or_allocate_mp_dev");
-+
-+ DEBUG3(printk("%s(%ld): entered. host=%p, port =%p, dev_id = %d\n",
-+ __func__, host->ha->host_no, host, port, dev_id));
-+
-+ temp_dp = qla2x00_find_mp_dev_by_id(host,dev_id);
-+
-+ DEBUG3(printk("%s: temp dp =%p\n", __func__, temp_dp));
-+ /* if Device already known at this port. */
-+ if (temp_dp != NULL) {
-+ node_found = qla2x00_is_nodename_equal(temp_dp->nodename,
-+ port->node_name);
-+ port_found = qla2x00_is_portname_in_device(temp_dp,
-+ port->port_name);
-+
-+ if (node_found && port_found) {
-+ DEBUG3(printk("%s: mp dev %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x exists on %p. dev id %d. path cnt=%d.\n",
-+ __func__,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ temp_dp, dev_id, temp_dp->path_list->path_cnt));
-+ dp = temp_dp;
-+
-+ /*
-+ * Copy the LUN configuration data
-+ * into the mp_device_t.
-+ */
-+ }
-+ }
-+
-+ /* Sanity check the port information */
-+ names_valid = (!qla2x00_is_ww_name_zero(port->node_name) &&
-+ !qla2x00_is_ww_name_zero(port->port_name));
-+
-+ /*
-+ * If the optimized check failed, loop through each known
-+ * device on each known adapter looking for the node name.
-+ */
-+ if (dp == NULL && names_valid) {
-+ DEBUG3(printk("%s: Searching each adapter for the device...\n",
-+ __func__));
-+
-+ /* Check for special cases. */
-+ if (port->flags & FC_CONFIG) {
-+ /* Here the search is done only for ports that
-+ * are found in config file, so we can count on
-+ * mp_byte value when binding the paths.
-+ */
-+ DEBUG3(printk("%s(%ld): mpbyte=%02x process configured "
-+ "portname=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no, port->mp_byte,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ DEBUG3(printk("%s(%ld): nodename %02x%02x%02x%02x%02x"
-+ "%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7]));
-+
-+ if (port->mp_byte == 0) {
-+ DEBUG3(printk("%s(%ld): port visible.\n",
-+ __func__, host->ha->host_no));
-+
-+ /* This device in conf file is set to visible */
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ /* Search all hosts with given tgt id
-+ * for any previously created dp with
-+ * matching node name.
-+ */
-+ temp_dp = temp_host->mp_devs[dev_id];
-+ if (temp_dp == NULL) {
-+ continue;
-+ }
-+
-+ node_found =
-+ qla2x00_is_nodename_equal(
-+ temp_dp->nodename, port->node_name);
-+
-+ if (node_found &&
-+ qla2x00_found_hidden_path(
-+ temp_dp)) {
-+ DEBUG3(printk(
-+ "%s(%ld): found "
-+ "mpdev of matching "
-+ "node %02x%02x%02x"
-+ "%02x%02x%02x%02x"
-+ "%02x w/ hidden "
-+ "paths. dp=%p "
-+ "dev_id=%d.\n",
-+ __func__,
-+ host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, dev_id));
-+ /*
-+ * Found the mpdev.
-+ * Treat this same as default
-+ * case by adding this port
-+ * to this mpdev which has same
-+ * nodename.
-+ */
-+ if (!qla2x00_is_portname_in_device(
-+ temp_dp, port->port_name)) {
-+ qla2x00_add_portname_to_mp_dev(
-+ temp_dp, port->port_name,
-+ port->node_name);
-+ }
-+
-+ dp = temp_dp;
-+ host->mp_devs[dev_id] = dp;
-+ dp->use_cnt++;
-+
-+ break;
-+ } else {
-+ port->flags |=
-+ FC_FAILOVER_DISABLE;
-+ }
-+ }
-+
-+ } else if (port->mp_byte & MP_MASK_OVERRIDE) {
-+ /* Bind on port name */
-+ DEBUG3(printk(
-+ "%s(%ld): port has override bit.\n",
-+ __func__, host->ha->host_no));
-+
-+ temp_dp = qla2x00_find_dp_by_pn_from_all_hosts(
-+ port->port_name, &j);
-+
-+ if (temp_dp) {
-+ /* Found match */
-+ DEBUG3(printk("%s(%ld): update mpdev "
-+ "on Matching port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x "
-+ "dp %p dev_id %d\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, j));
-+ /*
-+ * Bind this port to this mpdev of the
-+ * matching port name.
-+ */
-+ dp = temp_dp;
-+ host->mp_devs[j] = dp;
-+ dp->use_cnt++;
-+ }
-+ } else {
-+ DEBUG3(printk("%s(%ld): default case.\n",
-+ __func__, host->ha->host_no));
-+ /* Default case. Search and bind/add this
-+ * port to the mp_dev with matching node name
-+ * if it is found.
-+ */
-+ dp = qla2x00_default_bind_mpdev(host, port);
-+ }
-+
-+ } else {
-+ DEBUG3(printk("%s(%ld): process discovered port "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ DEBUG3(printk("%s(%ld): nodename %02x%02x%02x%02x%02x"
-+ "%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7]));
-+
-+ /* Here we try to find the mp_dev pointer for the
-+ * current port in the current host, which would
-+ * have been created if the port was specified in
-+ * the config file. To be sure the mp_dev we found
-+ * really is for the current port, we check the
-+ * node name to make sure it matches also.
-+ * When we find a previously created mp_dev pointer
-+ * for the current port, just return the pointer.
-+ * We proceed to add this port to an mp_dev of
-+ * the matching node name only if it is not found in
-+ * the mp_dev list already created and ConfigRequired
-+ * is not set.
-+ */
-+ temp_dp = qla2x00_find_mp_dev_by_portname(host,
-+ port->port_name, &j);
-+
-+ if (temp_dp && qla2x00_is_nodename_equal(
-+ temp_dp->nodename, port->node_name)) {
-+ /* Found match. This mpdev port was created
-+ * from config file entry.
-+ */
-+ DEBUG3(printk("%s(%ld): found mpdev "
-+ "created for current port %02x%02x%02x"
-+ "%02x%02x%02x%02x%02x "
-+ "dp %p dev_id %d\n",
-+ __func__, host->ha->host_no,
-+ port->port_name[0],
-+ port->port_name[1],
-+ port->port_name[2],
-+ port->port_name[3],
-+ port->port_name[4],
-+ port->port_name[5],
-+ port->port_name[6],
-+ port->port_name[7],
-+ temp_dp, j));
-+
-+ dp = temp_dp;
-+ } else if (!mp_config_required) {
-+
-+ DEBUG3(printk("%s(%ld): default case.\n",
-+ __func__, host->ha->host_no));
-+ /* Default case. Search and bind/add this
-+ * port to the mp_dev with matching node name
-+ * if it is found.
-+ */
-+ dp = qla2x00_default_bind_mpdev(host, port);
-+ }
-+ }
-+ }
-+
-+ /* If we couldn't find one, allocate one. */
-+ if (dp == NULL &&
-+ ((port->flags & FC_CONFIG) || !mp_config_required)) {
-+
-+ DEBUG3(printk("%s(%ld): No match. adding new mpdev on "
-+ "dev_id %d. node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dev_id,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ dp = qla2x00_allocate_mp_dev(port->node_name, port->port_name);
-+
-+#ifdef QL_DEBUG_LEVEL_2
-+ if (host->mp_devs[dev_id] != NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: invalid/unsupported configuration found. "
-+ "overwriting target id %d.\n",
-+ dev_id);
-+ }
-+#endif
-+ host->mp_devs[dev_id] = dp;
-+ dp->dev_id = dev_id;
-+ dp->use_cnt++;
-+ }
-+
-+ DEBUG3(printk("%s(%ld): exiting. return dp=%p.\n",
-+ __func__, host->ha->host_no, dp));
-+ LEAVE("qla2x00_find_or_allocate_mp_dev");
-+
-+ return dp;
-+}
-+
-+
-+/*
-+ * qla2x00_find_or_allocate_path
-+ * Look through the path list for the supplied device, and either
-+ * find the supplied adapter (path) for the adapter, or create
-+ * a new one and add it to the path list.
-+ *
-+ * Input:
-+ * host Adapter (path) for the device.
-+ * dp Device and path list for the device.
-+ * dev_id Index of device on adapter.
-+ * port Device data from port database.
-+ *
-+ * Returns:
-+ * Pointer to new PATH, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * 1. If the PATH_LIST does not already point to the PATH,
-+ * a new PATH is added to the PATH_LIST.
-+ * 2. If the new path is found to be a second visible path, it is
-+ * marked as hidden, and the device database is updated to be
-+ * hidden as well, to keep the miniport synchronized.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla2x00_find_or_allocate_path(mp_host_t *host, mp_device_t *dp,
-+ uint16_t dev_id, uint16_t pathid, fc_port_t *port)
-+{
-+ mp_path_list_t *path_list = dp->path_list;
-+ mp_path_t *path;
-+ uint8_t id;
-+
-+
-+ ENTER("qla2x00_find_or_allocate_path");
-+
-+ DEBUG4(printk("%s: host =%p, port =%p, dp=%p, dev id = %d\n",
-+ __func__, host, port, dp, dev_id));
-+ /*
-+ * Loop through each known path in the path list. Look for
-+ * a PATH that matches both the adapter and the port name.
-+ */
-+ path = qla2x00_find_path_by_name(host, path_list, port->port_name);
-+
-+
-+ if (path != NULL ) {
-+ DEBUG3(printk("%s: Found an existing "
-+ "path %p- host %p inst=%d, port =%p, path id = %d\n",
-+ __func__, path, host, host->instance, path->port,
-+ path->id));
-+ DEBUG3(printk("%s: Luns for path_id %d, instance %d\n",
-+ __func__, path->id, host->instance));
-+ DEBUG3(qla2x00_dump_buffer(
-+ (char *)&path->lun_data.data[0], 64));
-+
-+ /* If we found an existing path, look for any changes to it. */
-+ if (path->port == NULL) {
-+ DEBUG3(printk("%s: update path %p w/ port %p, path id="
-+ "%d, path mp_byte=0x%x port mp_byte=0x%x.\n",
-+ __func__, path, port, path->id,
-+ path->mp_byte, port->mp_byte));
-+ path->port = port;
-+ port->mp_byte = path->mp_byte;
-+ } else {
-+ DEBUG3(printk("%s: update path %p port %p path id %d, "
-+ "path mp_byte=0x%x port mp_byte=0x%x.\n",
-+ __func__, path, path->port, path->id,
-+ path->mp_byte, port->mp_byte));
-+
-+ if ((path->mp_byte & MP_MASK_HIDDEN) &&
-+ !(port->mp_byte & MP_MASK_HIDDEN)) {
-+
-+ DEBUG3(printk("%s: Adapter(%p) "
-+ "Device (%p) Path (%d) "
-+ "has become visible.\n",
-+ __func__, host, dp, path->id));
-+
-+ path->mp_byte &= ~MP_MASK_HIDDEN;
-+ }
-+
-+ if (!(path->mp_byte & MP_MASK_HIDDEN) &&
-+ (port->mp_byte & MP_MASK_HIDDEN)) {
-+
-+ DEBUG3(printk("%s(%ld): Adapter(%p) "
-+ "Device (%p) Path (%d) "
-+ "has become hidden.\n",
-+ __func__, host->ha->host_no, host,
-+ dp, path->id));
-+
-+ path->mp_byte |= MP_MASK_HIDDEN;
-+ }
-+ }
-+
-+ } else {
-+ /*
-+ * If we couldn't find an existing path, and there is still
-+ * room to add one, allocate one and put it in the list.
-+ */
-+ if (path_list->path_cnt < MAX_PATHS_PER_DEVICE &&
-+ path_list->path_cnt < qla_fo_params.MaxPathsPerDevice) {
-+
-+ if (port->flags & FC_CONFIG) {
-+ /* Use id specified in config file. */
-+ id = pathid;
-+ DEBUG3(printk("%s(%ld): using path id %d from "
-+ "config file.\n",
-+ __func__, host->ha->host_no, id));
-+ } else {
-+ /* Assign one. */
-+ id = path_list->path_cnt;
-+ DEBUG3(printk(
-+ "%s(%ld): assigning path id %d.\n",
-+ __func__, host->ha->host_no, id));
-+ }
-+
-+ /* Update port with bitmask info */
-+ path = qla2x00_allocate_path(host, id, port, dev_id);
-+ if (path) {
-+#if defined(QL_DEBUG_LEVEL_3)
-+ printk("%s: allocated new path %p, adding path "
-+ "id %d, mp_byte=0x%x\n", __func__, path,
-+ id, path->mp_byte);
-+ if (path->port)
-+ printk("port=%p-"
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ path->port,
-+ path->port->port_name[0],
-+ path->port->port_name[1],
-+ path->port->port_name[2],
-+ path->port->port_name[3],
-+ path->port->port_name[4],
-+ path->port->port_name[5],
-+ path->port->port_name[6],
-+ path->port->port_name[7]);
-+#endif
-+ qla2x00_add_path(path_list, path);
-+
-+ /*
-+ * Reconcile the new path against the existing
-+ * ones.
-+ */
-+ qla2x00_setup_new_path(dp, path, port);
-+ }
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Err exit, no space to add path.\n",
-+ __func__));
-+ }
-+
-+ }
-+
-+ LEAVE("qla2x00_find_or_allocate_path");
-+
-+ return path;
-+}
-+
-+static lu_path_t *
-+qla2x00_find_or_allocate_lu_path(mp_host_t *host, fc_lun_t *fclun,
-+ uint16_t pathid)
-+{
-+ mp_lun_t *mplun = NULL;
-+ struct list_head *list, *temp;
-+ lu_path_t *lu_path = NULL;
-+ fc_port_t *fcport = fclun->fcport;
-+
-+ DEBUG3(printk("%s entered\n",__func__));
-+
-+ if (fclun->mplun == NULL) {
-+ DEBUG(printk("%s mplun does not exist for fclun=%p\n",
-+ __func__,fclun));
-+ goto failed;
-+ }
-+ mplun = fclun->mplun;
-+ /*
-+ * Loop through each known path in the lun_path list. Look for
-+ * a PATH that matches fclun. */
-+ list_for_each_safe(list, temp, &mplun->lu_paths) {
-+ lu_path = list_entry(list, lu_path_t, list);
-+ if (lu_path->fclun == fclun){
-+ DEBUG2(printk("%s found an existing path lu_path=%p"
-+ " lu_path_id=%d fclun=%p\n",__func__,
-+ lu_path, lu_path->path_id, fclun));
-+ goto found_lu_path;
-+ }
-+ }
-+
-+ lu_path = kmalloc(sizeof(lu_path_t), GFP_KERNEL);
-+ if (lu_path == NULL) {
-+ DEBUG4(printk("%s: Failed\n", __func__));
-+ goto failed;
-+ }
-+ memset(lu_path, 0, sizeof(*lu_path));
-+
-+ DEBUG(printk("%s(%ld): allocated lu_path %p at path id lun=%d %d.\n",
-+ __func__, host->ha->host_no, lu_path, pathid, fclun->lun));
-+
-+ /* Copy the supplied information into the lu_path. */
-+ lu_path->host = host;
-+ lu_path->hba_instance = host->instance;
-+ lu_path->path_id = pathid;
-+ lu_path->fclun = fclun;
-+ lu_path->flags = LPF_TPG_UNKNOWN;
-+ fclun->path_id = pathid;
-+ memcpy(lu_path->portname, fcport->port_name, WWN_SIZE);
-+ list_add_tail(&lu_path->list,&mplun->lu_paths);
-+
-+ DEBUG3(printk("%s(%ld): path id %d copied portname "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no, pathid,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+
-+ DEBUG3(printk("%s leaving\n",__func__));
-+
-+found_lu_path :
-+ return lu_path;
-+failed :
-+ return NULL;
-+
-+}
-+
-+static mp_device_t *
-+qla2x00_find_dp_from_all_hosts(uint8_t *nn)
-+{
-+ mp_device_t *temp_dp = NULL;
-+ mp_host_t *temp_host; /* temporary pointer */
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ temp_dp = qla2x00_find_mp_dev_by_nodename(temp_host, nn );
-+ if( temp_dp ) {
-+ return temp_dp;
-+ }
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+
-+ return temp_dp;
-+}
-+/*
-+ * qla2x00_find_or_allocate_lun
-+ * Look through the existing multipath control tree, and find
-+ * an mp_lun_t with the supplied world-wide lun number. If
-+ * one cannot be found, allocate one.
-+ *
-+ * Input:
-+ * host Adapter (lun) for the device.
-+ * fclun Lun data from port database.
-+ *
-+ * Returns:
-+ * Pointer to new LUN, or NULL if the allocation fails.
-+ *
-+ * Side Effects:
-+ * 1. If the LUN_LIST does not already point to the LUN,
-+ * a new LUN is added to the LUN_LIST.
-+ * 2. If the DEVICE_LIST does not already point to the DEVICE,
-+ * a new DEVICE is added to the DEVICE_LIST.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_lun_t *
-+qla2x00_find_or_allocate_lun(mp_host_t *host, uint16_t dev_id,
-+ fc_port_t *port, fc_lun_t *fclun)
-+{
-+ mp_lun_t *lun = NULL;
-+ mp_device_t *dp = NULL;
-+ mp_device_t *temp_dp = NULL;
-+ uint16_t len;
-+ uint16_t idx;
-+ uint16_t new_id = dev_id;
-+ char wwulnbuf[WWULN_SIZE];
-+ int new_dev = 0;
-+ int i;
-+
-+
-+ ENTER("qla2x00_find_or_allocate_lun");
-+ DEBUG(printk("Entering %s\n", __func__));
-+
-+ if( fclun == NULL )
-+ return NULL;
-+
-+ DEBUG2(printk("%s: "
-+ " lun num=%d fclun %p mplun %p hba inst=%d, port =%p, dev id = %d\n",
-+ __func__, fclun->lun, fclun, fclun->mplun, host->instance, port,
-+ dev_id));
-+ /*
-+ * Perform inquiry page 83 to get the wwuln or
-+ * use what was specified by the user.
-+ */
-+ if ( (port->flags & FC_CONFIG) ) {
-+ if( (len = fclun->mplen) != 0 )
-+ memcpy(wwulnbuf, fclun->mpbuf, len);
-+ } else {
-+ len = qla2x00_get_wwuln_from_device(host, fclun,
-+ &wwulnbuf[0], WWULN_SIZE, NULL, NULL);
-+ /* if fail to do the inq then exit */
-+ if( len == 0 ) {
-+ return lun;
-+ }
-+ }
-+
-+ if( len != 0 )
-+ lun = qla2x00_find_matching_lunid(wwulnbuf);
-+
-+ /*
-+ * If this is a visible "controller" lun and
-+ * it is already exists on somewhere world wide
-+ * then allocate a new device, so it can be
-+ * exported it to the OS.
-+ */
-+ if( (fclun->flags & FLF_VISIBLE_LUN) &&
-+ lun != NULL ) {
-+ if( fclun->mplun == NULL ) {
-+ lun = NULL;
-+ new_dev++;
-+ DEBUG2(printk("%s: Creating visible lun "
-+ "lun %p num %d fclun %p mplun %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, lun, fclun->lun, fclun, fclun->mplun, host->instance, port,
-+ dev_id));
-+ } else {
-+ lun = fclun->mplun;
-+ return lun;
-+ }
-+ }
-+ else if ( (lun == NULL) && ql2xmap2actpath &&
-+ ( ((port->flags & FC_MSA_DEVICE) &&
-+ !(port->flags & FC_MSA_PORT_ACTIVE)) ||
-+ ((port->flags & FC_EVA_DEVICE) &&
-+ !(fclun->flags & FLF_ACTIVE_LUN)) ) ){
-+ DEBUG2(printk("%s: Skipping MSA/EVA lun "
-+ "lun %p num %d fclun %p mplun %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, lun, fclun->lun, fclun, fclun->mplun, host->instance, port,
-+ dev_id));
-+ return NULL;
-+ }
-+
-+ if (lun != NULL ) {
-+ DEBUG(printk("%s: Found an existing "
-+ "lun %p num %d fclun %p host %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, lun, fclun->lun, fclun, host, host->instance, port,
-+ dev_id));
-+ if( (dp = lun->dp ) == NULL ) {
-+ printk("NO dp pointer in alloacted lun\n");
-+ return NULL;
-+ }
-+ DEBUG(printk("%s(%ld): lookup portname for lun->dp = "
-+ "dev_id %d. dp=%p node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dp->dev_id, dp,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+#if 1
-+ if( qla2x00_is_portname_in_device(dp,
-+ port->port_name) ) {
-+
-+ DEBUG(printk("%s: Found portname %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x match in mp_dev[%d] = %p\n",
-+ __func__,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ dp->dev_id, dp));
-+ if(host->mp_devs[dp->dev_id] == NULL ) {
-+ host->mp_devs[dp->dev_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ } else {
-+ DEBUG(printk("%s(%ld): MP_DEV no-match on portname. adding new port - "
-+ "dev_id %d. node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dev_id,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+ qla2x00_add_portname_to_mp_dev(dp,
-+ port->port_name, port->node_name);
-+
-+ DEBUG2(printk("%s(%ld): (1) Added portname and mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, dp->dev_id, dp));
-+ for( i = dev_id; i < MAX_MP_DEVICES; i++ )
-+ if(host->mp_devs[i] == NULL ) {
-+ new_id = i;
-+ break;
-+ }
-+ if(host->mp_devs[dp->dev_id] == NULL ) {
-+ host->mp_devs[dp->dev_id] = dp;
-+ dp->use_cnt++;
-+ } else if ( host->mp_devs[dp->dev_id] != dp ) {
-+ DEBUG2(printk("%s(%d) Targets coming up in "
-+ "different order, using a new slot: "
-+ "old_dev_id=%d old_dp=%p new_dev_id=%d "
-+ "new_dp=%p\n", __func__, host->instance,
-+ dp->dev_id, host->mp_devs[dp->dev_id],
-+ new_id, dp));
-+ host->mp_devs[new_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ }
-+#else
-+ if( (temp_dp = qla2x00_find_mp_dev_by_portname(host,
-+ port->port_name, &idx)) == NULL ) {
-+ DEBUG(printk("%s(%ld): MP_DEV no-match on portname. adding new port on "
-+ "dev_id %d. node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, dev_id,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+ qla2x00_add_portname_to_mp_dev(dp,
-+ port->port_name, port->node_name);
-+
-+ DEBUG(printk("%s(%ld): (1) Added portname and mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, dp->dev_id, dp));
-+ if(host->mp_devs[dp->dev_id] == NULL ) {
-+ host->mp_devs[dp->dev_id] = dp;
-+ dp->use_cnt++;
-+ }
-+ } else if( dp == temp_dp ){
-+ DEBUG3(printk("%s(%ld): MP_DEV %p match with portname @ "
-+ " mp_dev[%d]. "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no, temp_dp, idx,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+
-+ host->mp_devs[idx] = temp_dp;
-+ dp->use_cnt++;
-+ }
-+#endif
-+ } else {
-+ DEBUG(printk("%s: MP_lun %d not found "
-+ "for fclun %p inst=%d, port =%p, dev id = %d\n",
-+ __func__, fclun->lun, fclun, host->instance, port,
-+ dev_id));
-+
-+ if( (dp = qla2x00_find_mp_dev_by_portname(host,
-+ port->port_name, &idx)) == NULL || new_dev ) {
-+ DEBUG2(printk("%s(%ld): No match for WWPN. Creating new mpdev \n"
-+ "node %02x%02x%02x%02x%02x%02x%02x%02x "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, host->ha->host_no,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7]));
-+ dp = qla2x00_allocate_mp_dev(port->node_name,
-+ port->port_name);
-+ if( dp == NULL ) {
-+ return lun;
-+ }
-+ if (ql2xlbType != 0 && ql2xlbType <= LB_LST) {
-+ dp->lbtype = ql2xlbType;
-+ }
-+ DEBUG2(printk(KERN_INFO "scsi%ld: Setting "
-+ "lbType=%d\n", host->ha->host_no, dp->lbtype));
-+ /* find a good index */
-+ for( i = dev_id; i < MAX_MP_DEVICES; i++ )
-+ if(host->mp_devs[i] == NULL ) {
-+ new_id = i;
-+ break;
-+ }
-+ } else if( dp != NULL ) { /* found dp */
-+ new_id = dp->dev_id;
-+ DEBUG2(printk("%s: 2. Found portname already in device %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x match in mp_dev[%d] = %p\n",
-+ __func__,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ dp->dev_id, dp));
-+ }
-+
-+ /*
-+ * if we have a controller lun then assign it to a different dev
-+ * and point to the failover dev as well by nodename matching.
-+ */
-+ if (ql2xtgtemul && (fclun->flags & FLF_VISIBLE_LUN)) {
-+ DEBUG2(printk("%s(%ld): (2) mp_dev[%d] Setting dev IGNORE flag."
-+ " dp %p , new_dev = %d\n ",
-+ __func__, host->ha->host_no, new_id, dp, new_dev));
-+ temp_dp = qla2x00_find_dp_from_all_hosts(port->node_name);
-+ /* bind together for old GUI */
-+ if( temp_dp ) {
-+ dp->mpdev = temp_dp;
-+ DEBUG2(printk("%s: 10. Found nodename %02x%02x%02x%02x%02x%02x"
-+ "%02x%02x already in mp_dev[%d] = %p - binding.\n",
-+ __func__,
-+ port->node_name[0], port->node_name[1],
-+ port->node_name[2], port->node_name[3],
-+ port->node_name[4], port->node_name[5],
-+ port->node_name[6], port->node_name[7],
-+ temp_dp->dev_id, temp_dp));
-+ }
-+ }
-+
-+ if( dp != NULL ) {
-+ DEBUG2(printk("%s(%ld): (2) mp_dev[%d] update"
-+ " with dp %p\n ",
-+ __func__, host->ha->host_no, new_id, dp));
-+ host->mp_devs[new_id] = dp;
-+ dp->dev_id = new_id;
-+ dp->use_cnt++;
-+ lun = kmalloc(sizeof(mp_lun_t), GFP_KERNEL);
-+ if (lun != NULL) {
-+ memset(lun, 0, sizeof(*lun));
-+ DEBUG(printk("Added lun %p to dp %p lun number %d\n",
-+ lun, dp, fclun->lun));
-+ DEBUG(qla2x00_dump_buffer(wwulnbuf, len));
-+ memcpy(lun->wwuln, wwulnbuf, len);
-+ lun->siz = len;
-+ lun->number = fclun->lun;
-+ lun->dp = dp;
-+ qla2x00_add_lun(dp, lun);
-+ INIT_LIST_HEAD(&lun->ports_list);
-+ INIT_LIST_HEAD(&lun->lu_paths);
-+ INIT_LIST_HEAD(&lun->active_list);
-+ INIT_LIST_HEAD(&lun->tport_grps_list);
-+ spin_lock_init(&lun->mplock);
-+ lun->pref_path_id = PATH_INDEX_INVALID;
-+ lun->config_pref_id =
-+ PATH_INDEX_INVALID;
-+ lun->act_cnt = 0;
-+ lun->active = 0;
-+ lun->load_balance_type =
-+ dp->lbtype;
-+ }
-+ } else
-+ printk(KERN_WARNING
-+ "qla2x00: Couldn't get memory for dp. \n");
-+ }
-+
-+ DEBUG(printk("Exiting %s\n", __func__));
-+ LEAVE("qla2x00_find_or_allocate_lun");
-+
-+ return lun;
-+}
-+
-+
-+static uint32_t
-+qla2x00_cfg_register_failover_lun(mp_device_t *dp, srb_t *sp, fc_lun_t *new_lp)
-+{
-+ uint32_t status = QLA_SUCCESS;
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+ fc_lun_t *old_lp;
-+
-+ DEBUG2(printk(KERN_INFO "%s: NEW fclun = %p, sp = %p\n",
-+ __func__, new_lp, sp));
-+
-+ /*
-+ * Fix lun descriptors to point to new fclun which is a new fcport.
-+ */
-+ if (new_lp == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed new lun %p\n",
-+ __func__, new_lp));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ tq = sp->tgt_queue;
-+ lq = sp->lun_queue;
-+ if (tq == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old tq %p\n",
-+ __func__, tq));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ if (lq == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old lq %p\n",
-+ __func__, lq));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ old_lp = lq->fclun;
-+ lq->fclun = new_lp;
-+
-+ /* Log the failover to console */
-+ printk(KERN_INFO
-+ "qla2x00: FAILOVER device %d from "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x - "
-+ "LUN %02x, reason=0x%x\n",
-+ dp->dev_id,
-+ old_lp->fcport->port_name[0], old_lp->fcport->port_name[1],
-+ old_lp->fcport->port_name[2], old_lp->fcport->port_name[3],
-+ old_lp->fcport->port_name[4], old_lp->fcport->port_name[5],
-+ old_lp->fcport->port_name[6], old_lp->fcport->port_name[7],
-+ new_lp->fcport->port_name[0], new_lp->fcport->port_name[1],
-+ new_lp->fcport->port_name[2], new_lp->fcport->port_name[3],
-+ new_lp->fcport->port_name[4], new_lp->fcport->port_name[5],
-+ new_lp->fcport->port_name[6], new_lp->fcport->port_name[7],
-+ new_lp->lun, sp->err_id);
-+ printk(KERN_INFO
-+ "qla2x00: FROM HBA %d to HBA %d\n",
-+ (int)old_lp->fcport->ha->instance,
-+ (int)new_lp->fcport->ha->instance);
-+
-+ DEBUG3(printk("%s: NEW fclun = %p , port =%p, "
-+ "loop_id =0x%x, instance %ld\n",
-+ __func__,
-+ new_lp, new_lp->fcport,
-+ new_lp->fcport->loop_id,
-+ new_lp->fcport->ha->instance));
-+
-+ return status;
-+}
-+
-+
-+/*
-+ * qla2x00_send_failover_notify
-+ * A failover operation has just been done from an old path
-+ * index to a new index. Call lower level driver
-+ * to perform the failover notification.
-+ *
-+ * Inputs:
-+ * device Device being failed over.
-+ * lun LUN being failed over.
-+ * newpath path that was failed over too.
-+ * oldpath path that was failed over from.
-+ *
-+ * Return:
-+ * Local function status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static uint32_t
-+qla2x00_send_failover_notify(mp_device_t *dp,
-+ uint8_t lun, mp_path_t *newpath, mp_path_t *oldpath)
-+{
-+ fc_lun_t *old_lp, *new_lp;
-+ uint32_t status = QLA_SUCCESS;
-+
-+ ENTER("qla2x00_send_failover_notify");
-+
-+ if ((old_lp = qla2x00_find_matching_lun(lun, dp, oldpath)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get old lun %p, %d\n",
-+ __func__, old_lp,lun));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ if ((new_lp = qla2x00_find_matching_lun(lun, dp, newpath)) == NULL) {
-+ DEBUG2(printk(KERN_INFO "%s: Failed to get new lun %p,%d\n",
-+ __func__, new_lp,lun));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ /*
-+ * If the target is the same target, but a new HBA has been selected,
-+ * send a third party logout if required.
-+ */
-+ if ((qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET ||
-+ qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_CDB) &&
-+ qla2x00_is_portname_equal(
-+ oldpath->portname, newpath->portname)) {
-+
-+ status = qla2x00_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Logout succeded\n",
-+ __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Logout Failed\n",
-+ __func__));
-+ }
-+ } else if ((qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LUN_RESET) ||
-+ (qla_fo_params.FailoverNotifyType &
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET)) {
-+
-+ /*
-+ * If desired, send a LUN reset as the
-+ * failover notification type.
-+ */
-+ if (newpath->lun_data.data[lun] & LUN_DATA_ENABLED) {
-+ status = qla2x00_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: LUN reset succeeded.\n",
-+ __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failed reset LUN.\n",
-+ __func__));
-+ }
-+ }
-+
-+ } else if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_CDB ||
-+ qla_fo_params.FailoverNotifyType ==
-+ FO_NOTIFY_TYPE_LOGOUT_OR_CDB) {
-+
-+ if (newpath->lun_data.data[lun] & LUN_DATA_ENABLED) {
-+ status = qla2x00_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Send CDB succeeded.\n",
-+ __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Send CDB Error "
-+ "lun=(%d).\n", __func__, lun));
-+ }
-+ }
-+ } else if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_SPINUP ||
-+ old_lp->fcport->notify_type == FO_NOTIFY_TYPE_SPINUP ){
-+
-+ status = qla2x00_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG(printk("%s: Send CDB succeeded.\n",
-+ __func__));
-+ } else {
-+ /* EMPTY */
-+ DEBUG(printk("%s: Send CDB Error "
-+ "lun=(%d).\n", __func__, lun));
-+ }
-+ } else if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_TPGROUP_CDB ||
-+ old_lp->fcport->notify_type == FO_NOTIFY_TYPE_TPGROUP_CDB) {
-+
-+ status = qla2x00_send_fo_notification(old_lp, new_lp);
-+ if (status == QLA_SUCCESS) {
-+ DEBUG(printk("%s: Set Tgt Port Group CDB succeeded.\n",
-+ __func__));
-+ } else {
-+ DEBUG(printk("%s: Set Tgt Port Group CDB Error "
-+ "lun=(%d).\n", __func__, lun));
-+ }
-+
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: failover disabled or no notify routine "
-+ "defined.\n", __func__));
-+ }
-+
-+ return status;
-+}
-+
-+static mp_path_t *
-+qla2x00_find_host_from_port(mp_device_t *dp,
-+ mp_host_t *host,
-+ mp_port_t *port )
-+{
-+ unsigned long instance;
-+ uint8_t id;
-+ int i;
-+ mp_path_t *path = NULL;
-+
-+ /* get next host instance */
-+ instance = host->instance;
-+ for(i = 0 ; i < port->cnt ; i++ ) {
-+ instance = instance + 1;
-+ DEBUG3(printk("%s: Finding new instance %d, max %d, cnt %d\n",
-+ __func__, (int)instance, port->cnt, i));
-+ /* Handle wrap-around */
-+ if( instance == port->cnt )
-+ instance = 0;
-+ if( port->hba_list[instance] == NULL )
-+ continue;
-+ if( port->hba_list[instance] != host->ha )
-+ break;
-+ }
-+ /* Found a different hba then return the path to it */
-+ if ( i != port->cnt ) {
-+ id = port->path_list[instance];
-+ DEBUG2(printk("%s: Changing to new host - pathid=%d\n",
-+ __func__, id));
-+ path = qla2x00_find_path_by_id(dp, id);
-+ /* Make sure this is a good port */
-+ if (path) {
-+ if (atomic_read(&path->port->state) ==
-+ FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("qla(%d) %s - Port (0x%04x) "
-+ "DEAD.\n", path->host->instance, __func__,
-+ path->port->loop_id));
-+ path = NULL;
-+ }
-+ }
-+ }
-+ return( path );
-+}
-+
-+static inline mp_tport_grp_t *
-+qla2x00_find_tgt_port_grp_by_state(mp_lun_t *mplun, uint8_t asym_acc_state)
-+{
-+ mp_tport_grp_t *tport_grp = NULL, *tmp_tpg;
-+ struct list_head *list, *temp;
-+
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list) {
-+ tmp_tpg = list_entry(list, mp_tport_grp_t, list);
-+ if (tmp_tpg->asym_acc_state == asym_acc_state) {
-+ tport_grp = tmp_tpg;
-+ break;
-+ }
-+ }
-+ return tport_grp;
-+}
-+
-+/*
-+ * Find_best_port
-+ * This routine tries to locate the best port to the target that
-+ * doesn't require issuing a target notify command.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla2x00_find_best_port(mp_device_t *dp,
-+ mp_path_t *orig_path,
-+ mp_port_t *port,
-+ fc_lun_t *fclun )
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_t *new_path;
-+ mp_port_t *temp_port;
-+ int i;
-+ fc_lun_t *new_fp;
-+ struct list_head *list, *temp;
-+ mp_lun_t *mplun = (mp_lun_t *)fclun->mplun;
-+ unsigned long instance;
-+ uint16_t id;
-+
-+ list_for_each_safe(list, temp, &mplun->ports_list) {
-+ temp_port = list_entry(list, mp_port_t, list);
-+ if ( port == temp_port ) {
-+ continue;
-+ }
-+ /* Search for an active matching lun on any HBA,
-+ but starting with the orig HBA */
-+ instance = orig_path->host->instance;
-+ for(i = 0 ; i < temp_port->cnt ; instance++) {
-+ if( instance == MAX_HOSTS )
-+ instance = 0;
-+ id = temp_port->path_list[instance];
-+ DEBUG(printk(
-+ "qla%d %s: i=%d, Checking temp port=%p, pathid=%d\n",
-+ (int)instance,__func__, i, temp_port, id));
-+ if (id == PATH_INDEX_INVALID)
-+ continue;
-+ i++; /* found a valid hba entry */
-+ new_fp = mplun->paths[id];
-+ DEBUG(printk(
-+ "qla%d %s: Checking fclun %p, for pathid=%d\n",
-+ (int)instance,__func__, new_fp, id));
-+ if( new_fp == NULL )
-+ continue;
-+ new_path = qla2x00_find_path_by_id(dp, id);
-+ if( new_path != NULL ) {
-+ DEBUG(printk(
-+ "qla%d %s: Found new path new_fp=%p, "
-+ "path=%p, flags=0x%x\n",
-+ (int)new_path->host->instance,__func__, new_fp,
-+ new_path, new_path->port->flags));
-+
-+
-+ if (atomic_read(&new_path->port->state) ==
-+ FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("qla(%d) %s - Port (0x%04x) "
-+ "DEAD.\n", (int)new_path->host->instance,
-+ __func__, new_path->port->loop_id));
-+ continue;
-+ }
-+
-+ /* Is this path on an active controller? */
-+ if( (new_path->port->flags & FC_EVA_DEVICE) &&
-+ !(new_fp->flags & FLF_ACTIVE_LUN) ){
-+ DEBUG2(printk("qla(%d) %s - EVA Port (0x%04x) INACTIVE.\n",
-+ (int)new_path->host->instance, __func__,
-+ new_path->port->loop_id));
-+ continue;
-+ }
-+
-+ if( (new_path->port->flags & FC_MSA_DEVICE) &&
-+ !(new_path->port->flags & FC_MSA_PORT_ACTIVE) ) {
-+ DEBUG2(printk("qla(%d) %s - MSA Port (0x%04x) INACTIVE.\n",
-+ (int)new_path->host->instance, __func__,
-+ new_path->port->loop_id));
-+ continue;
-+ }
-+ /* Is this path on the same active controller? */
-+ /* FixME:Luns on the same Tgt port grp have the same asym access state */
-+ if (new_path->port->fo_target_port) {
-+ lu_path_t *new_lu_path;
-+ /* find lu_path for the current fclun */
-+ new_lu_path = qla2x00_find_lu_path_by_id(mplun,new_fp->path_id);
-+ if (new_lu_path->asym_acc_state != TPG_ACT_OPT) {
-+ DEBUG(printk("qla(%d) %s - Port (0x%04x)"
-+ " does not belong to the active tgt port grp.\n",
-+ (int)new_path->host->instance, __func__,
-+ new_path->port->loop_id));
-+ continue;
-+ } else {
-+ DEBUG2(printk("qla(%d) %s - Port (0x%04x) Found path %d belonging"
-+ " to the active tgt port grp\n",
-+ (int)new_path->host->instance,__func__,
-+ new_path->port->loop_id,new_lu_path->path_id));
-+ }
-+ }
-+
-+ /* found a good path */
-+ DEBUG2(printk("qla%d %s: *** Changing from port %p to "
-+ "new port %p - pathid=%d\n", (int)instance,
-+ __func__, port, temp_port, new_path->id));
-+
-+ return( new_path );
-+ }
-+ }
-+ }
-+
-+ return( path );
-+}
-+
-+int
-+qla2x00_find_all_active_fcports(uint16_t lun)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ uint8_t wait_for_transition = 1;
-+ int bad = 0;
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Scanning for active ports...\n", __func__));
-+
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-+ atomic_read(&fcport->ha->loop_state) == LOOP_DEAD)
-+ continue;
-+
-+ if (fcport->flags & (FC_EVA_DEVICE | FC_MSA_DEVICE)) {
-+ list_for_each_entry(fclun, &fcport->fcluns,
-+ list) {
-+ if (fclun->flags & FLF_VISIBLE_LUN)
-+ continue;
-+ if (lun != fclun->lun)
-+ continue;
-+
-+ qla2x00_test_active_lun(fcport, fclun, NULL);
-+ }
-+ }
-+ if ((fcport->flags & FC_MSA_DEVICE))
-+ qla2x00_test_active_port(fcport);
-+ /* FixMe - Add support for devices which support tgt port grp ??*/
-+ if (fcport->fo_target_port) {
-+ DEBUG(printk("%s(%ld) issue report tgt port group\n",__func__,ha->host_no));
-+ list_for_each_entry(fclun, &fcport->fcluns,
-+ list) {
-+ if (fclun->flags & FLF_VISIBLE_LUN)
-+ continue;
-+ if (lun != fclun->lun)
-+ continue;
-+
-+ /* For DSXXX device do a quick check to see if
-+ * implicit failover is taking place.
-+ */
-+ if (wait_for_transition) {
-+ if (qla2x00_wait_for_tpg_ready(fclun)
-+ == QLA_FUNCTION_FAILED ) {
-+ DEBUG2(printk("%s(%ld) lun=%d"
-+ "Waiting for transition state - failed\n",
-+ __func__,ha->host_no, lun));
-+ bad =1;
-+ break; /* don't waste time on the other luns */
-+ }
-+ wait_for_transition = 0;
-+ }
-+
-+ /* set the tgt port grp state */
-+ fcport->fo_target_port(fcport, fclun, 1);
-+ }
-+ }
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Done Scanning ports...\n", __func__));
-+ return bad;
-+}
-+
-+void
-+qla2x00_find_all_active_ports(srb_t *sp)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ uint16_t lun;
-+ uint8_t wait_for_transition = 1;
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Scanning for active ports...\n", __func__));
-+
-+ lun = sp->lun_queue->fclun->lun;
-+
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-+ atomic_read(&fcport->ha->loop_state) == LOOP_DEAD)
-+ continue;
-+
-+ if (fcport->flags & (FC_EVA_DEVICE | FC_MSA_DEVICE)) {
-+ list_for_each_entry(fclun, &fcport->fcluns,
-+ list) {
-+ if (fclun->flags & FLF_VISIBLE_LUN)
-+ continue;
-+ if (lun != fclun->lun)
-+ continue;
-+
-+ qla2x00_test_active_lun(fcport, fclun, NULL);
-+ }
-+ }
-+ if ((fcport->flags & FC_MSA_DEVICE))
-+ qla2x00_test_active_port(fcport);
-+ /* FixMe - Add support for devices which support tgt port grp ??*/
-+ if (fcport->fo_target_port) {
-+ DEBUG(printk("%s(%ld) issue report tgt port group\n",__func__,ha->host_no));
-+ list_for_each_entry(fclun, &fcport->fcluns,
-+ list) {
-+ if (fclun->flags & FLF_VISIBLE_LUN)
-+ continue;
-+ if (lun != fclun->lun)
-+ continue;
-+
-+ /* For DSXXX device do a quick check to see if
-+ * implicit failover is taking place.
-+ */
-+ if ((fcport->flags & (FC_DSXXX_DEVICE|
-+ FC_AA_MSA_DEVICE) )
-+ && wait_for_transition) {
-+ if (qla2x00_wait_for_tpg_ready(fclun)
-+ == QLA_FUNCTION_FAILED ) {
-+ DEBUG2(printk("%s(%ld) lun=%d"
-+ "Waiting for transition state - failed\n",
-+ __func__,ha->host_no, lun));
-+ break; /* don't waste time on the other luns */
-+ }
-+ wait_for_transition = 0;
-+ }
-+
-+ /* set the tgt port grp state */
-+ if (fcport->flags & FC_AA_MSA_DEVICE)
-+ fcport->fo_target_port(fcport, fclun, 0);
-+ else
-+ fcport->fo_target_port(fcport, fclun, 1);
-+ }
-+ }
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "%s: Done Scanning ports...\n", __func__));
-+}
-+
-+/*
-+ * qla2x00_smart_failover
-+ * This routine tries to be smart about how it selects the
-+ * next path. It selects the next path base on whether the
-+ * loop went down or the port went down. If the loop went
-+ * down it will select the next HBA. Otherwise, it will select
-+ * the next port.
-+ *
-+ * Inputs:
-+ * device Device being failed over.
-+ * sp Request that initiated failover.
-+ * orig_path path that was failed over from.
-+ *
-+ * Return:
-+ * next path next path to use.
-+ * flag 1 - Don't send notify command
-+ * 0 - Send notify command
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+static mp_path_t *
-+qla2x00_smart_path(mp_device_t *dp,
-+ mp_path_t *orig_path, srb_t *sp, int *flag )
-+{
-+ mp_path_t *path = NULL;
-+ fc_lun_t *fclun;
-+ mp_port_t *port;
-+ mp_host_t *host= orig_path->host;
-+
-+ DEBUG2(printk("Entering %s - sp err = %d, instance =%d\n",
-+ __func__, sp->err_id, (int)host->instance));
-+
-+ qla2x00_find_all_active_ports(sp);
-+
-+ if( sp != NULL ) {
-+ fclun = sp->lun_queue->fclun;
-+ if( fclun == NULL ) {
-+ printk( KERN_INFO
-+ "scsi%d %s: couldn't find fclun %p pathid=%d\n",
-+ (int)host->instance,__func__, fclun, orig_path->id);
-+ return( orig_path->next );
-+ }
-+ port = qla2x00_find_port_by_name(
-+ (mp_lun_t *)fclun->mplun, orig_path);
-+ if( port == NULL ) {
-+ printk( KERN_INFO
-+ "scsi%d %s: couldn't find MP port %p pathid=%d\n",
-+ (int)host->instance,__func__, port, orig_path->id);
-+ return( orig_path->next );
-+ }
-+
-+ /* Change to next HOST if loop went down */
-+ if( sp->err_id == SRB_ERR_LOOP ) {
-+ path = qla2x00_find_host_from_port(dp,
-+ host, port );
-+ if( path != NULL ) {
-+ port->fo_cnt++;
-+ *flag = 1;
-+ /* if we used all the hbas then
-+ try and get another port */
-+ if( port->fo_cnt > port->cnt ) {
-+ port->fo_cnt = 0;
-+ *flag = 0;
-+ path =
-+ qla2x00_find_best_port(dp,
-+ orig_path, port, fclun );
-+ if( path )
-+ *flag = 1;
-+ }
-+ }
-+ } else {
-+ path = qla2x00_find_best_port(dp,
-+ orig_path, port, fclun );
-+ if( path )
-+ *flag = 1;
-+ }
-+ }
-+ /* Default path is next path*/
-+ if (path == NULL)
-+ path = orig_path->next;
-+
-+ DEBUG3(printk("Exiting %s\n", __func__));
-+ return path;
-+}
-+
-+void
-+qla2x00_flush_failover_target(scsi_qla_host_t *ha, os_tgt_t *tq )
-+{
-+ os_lun_t *lq;
-+ int l;
-+
-+ for (l = 0; l < ha->max_luns; l++) {
-+ if ((lq = (os_lun_t *) tq->olun[l]) == NULL)
-+ continue;
-+ qla2x00_flush_failover_q(ha, lq);
-+ }
-+}
-+
-+/*
-+ * qla2x00_select_next_path
-+ * A problem has been detected with the current path for this
-+ * device. Try to select the next available path as the current
-+ * path for this device. If there are no more paths, the same
-+ * path will still be selected.
-+ *
-+ * Inputs:
-+ * dp pointer of device structure.
-+ * lun LUN to failover.
-+ *
-+ * Return Value:
-+ * new path or same path
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla2x00_select_next_path(mp_host_t *host, mp_device_t *dp, uint8_t lun,
-+ srb_t *sp)
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_list_t *path_list;
-+ mp_path_t *orig_path;
-+ int id;
-+ uint32_t status;
-+ mp_host_t *new_host;
-+ int skip_notify= 0;
-+ fc_port_t *fcport;
-+ scsi_qla_host_t *vis_ha;
-+ fc_lun_t *new_fp = NULL;
-+
-+
-+ ENTER("qla2x00_select_next_path:");
-+
-+ path_list = dp->path_list;
-+ if (path_list == NULL)
-+ return NULL;
-+
-+ /* Get current path */
-+ id = path_list->current_path[lun];
-+
-+ /* Get path for current path id */
-+ if ((orig_path = qla2x00_find_path_by_id(dp, id)) != NULL) {
-+ /* select next path */
-+ /* FixMe - Add support for devices which
-+ support tgt port grp ??*/
-+ if ( (fcport = orig_path->port) != NULL ) {
-+ path = orig_path->next;
-+ /* if path cnt == 1 and MSA device then see if
-+ we can fix it by sending a notify */
-+ if( (fcport->flags & ( FC_MSA_DEVICE |
-+ FC_EVA_DEVICE)) &&
-+ !mp_initialized &&
-+ path_list->path_cnt == 1 ) {
-+ if( !qla2x00_test_active_port(fcport) ) {
-+ path = orig_path;
-+ /* flush all for this target */
-+ vis_ha =
-+ (scsi_qla_host_t *)sp->cmd->device->host->hostdata;
-+ qla2x00_flush_failover_target(
-+ vis_ha, sp->tgt_queue);
-+ qla2x00_spinup(fcport->ha,
-+ fcport, lun);
-+ skip_notify= 1;
-+ }
-+ }
-+ if ( !skip_notify && ((fcport->flags &
-+ (FC_MSA_DEVICE|FC_EVA_DEVICE)) ||
-+ fcport->fo_target_port)) {
-+ path = qla2x00_smart_path(dp, orig_path, sp,
-+ &skip_notify);
-+ }
-+ } else
-+ path = orig_path->next;
-+
-+ new_host = path->host;
-+
-+ /* FIXME may need to check for HBA being reset */
-+ DEBUG3(printk("%s: lun %d orig path = %p new path = %p "
-+ "curr idx = %d, new idx = %d, skip_notify=%d\n",
-+ __func__, lun, orig_path, path, orig_path->id, path->id,
-+ skip_notify));
-+ DEBUG3(printk(" FAILOVER: device nodename: "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ dp->nodename[0], dp->nodename[1],
-+ dp->nodename[2], dp->nodename[3],
-+ dp->nodename[4], dp->nodename[5],
-+ dp->nodename[6], dp->nodename[7]));
-+ DEBUG3(printk(" Original - host nodename: "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ orig_path->host->nodename[0],
-+ orig_path->host->nodename[1],
-+ orig_path->host->nodename[2],
-+ orig_path->host->nodename[3],
-+ orig_path->host->nodename[4],
-+ orig_path->host->nodename[5],
-+ orig_path->host->nodename[6],
-+ orig_path->host->nodename[7]));
-+ DEBUG3(printk(" portname: "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ orig_path->port->port_name[0],
-+ orig_path->port->port_name[1],
-+ orig_path->port->port_name[2],
-+ orig_path->port->port_name[3],
-+ orig_path->port->port_name[4],
-+ orig_path->port->port_name[5],
-+ orig_path->port->port_name[6],
-+ orig_path->port->port_name[7]));
-+ DEBUG3(printk(" New - host nodename: "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ new_host->nodename[0], new_host->nodename[1],
-+ new_host->nodename[2], new_host->nodename[3],
-+ new_host->nodename[4], new_host->nodename[5],
-+ new_host->nodename[6], new_host->nodename[7]));
-+ DEBUG3(printk(" portname: "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ path->port->port_name[0],
-+ path->port->port_name[1],
-+ path->port->port_name[2],
-+ path->port->port_name[3],
-+ path->port->port_name[4],
-+ path->port->port_name[5],
-+ path->port->port_name[6],
-+ path->port->port_name[7]));
-+
-+ path_list->current_path[lun] = path->id;
-+ if (path != orig_path) {
-+ if (path->port) {
-+ if (path->port->flags & FC_AA_MSA_DEVICE) {
-+ new_fp = qla2x00_find_matching_lun(lun,
-+ dp, path);
-+ if (new_fp != NULL) {
-+ /*
-+ * Check lun before issuing
-+ * reset
-+ */
-+ if (qla2x00_test_active_lun(
-+ path->port, new_fp,
-+ NULL)) {
-+ DEBUG2(printk(KERN_INFO
-+ "scsi(%ld:0x%x:%d) "
-+ "sending reset "
-+ "lun\n",
-+ path->port->ha->host_no,
-+ path->port->loop_id, lun));
-+ qla2x00_lun_reset(
-+ path->port->ha,
-+ path->port, lun);
-+ }
-+ }
-+ }
-+ if (!skip_notify) {
-+ status = qla2x00_send_failover_notify(
-+ dp, lun, path, orig_path);
-+ }
-+ }
-+ }
-+ }
-+
-+ LEAVE("qla2x00_select_next_path:");
-+
-+ return path ;
-+}
-+
-+
-+/*
-+ * qla2x00_update_mp_host
-+ * Update the multipath control information from the port
-+ * database for that adapter.
-+ *
-+ * Input:
-+ * host Adapter to update. Devices that are new are
-+ * known to be attached to this adapter.
-+ *
-+ * Returns:
-+ * 1 if updated successfully; 0 if error.
-+ *
-+ */
-+static uint8_t
-+qla2x00_update_mp_host(mp_host_t *host)
-+{
-+ uint8_t success = 1;
-+ uint16_t dev_id;
-+ fc_port_t *fcport;
-+ scsi_qla_host_t *ha = host->ha;
-+ int order;
-+ mp_device_t *temp_dp;
-+ mp_lun_t *lun;
-+
-+ ENTER("qla2x00_update_mp_host");
-+
-+ /*
-+ * We make sure each port is attached to some virtual device.
-+ */
-+ dev_id = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ DEBUG3(printk("%s(%ld): checking fcport list. update port "
-+ "%p-%02x%02x%02x%02x%02x%02x%02x%02x dev_id %d "
-+ "to ha inst %ld.\n",
-+ __func__, ha->host_no,
-+ fcport,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7],
-+ dev_id, ha->instance));
-+
-+ qla2x00_configure_cfg_device(fcport);
-+ success |= qla2x00_update_mp_device(host, fcport, dev_id, 0);
-+ dev_id++;
-+ }
-+ if (mp_initialized) {
-+ for (dev_id = 0; dev_id < MAX_MP_DEVICES; dev_id++) {
-+ temp_dp = host->mp_devs[dev_id];
-+
-+ if (temp_dp == NULL)
-+ continue;
-+
-+ for (order = 0, lun = temp_dp->luns; lun != NULL ;
-+ lun = lun->next, order++) {
-+ if ( lun->config_pref_id != PATH_INDEX_INVALID ) {
-+ qla2x00_chg_lun_to_preferred_path(ha, lun, lun->config_pref_id);
-+ qla2x00_set_preferred_path(lun, order, 1);
-+ } else
-+ qla2x00_set_preferred_path(lun, order, 0);
-+ }
-+ }
-+ }
-+
-+ if (success) {
-+ DEBUG2(printk(KERN_INFO "%s: Exit OK\n", __func__));
-+ qla2x00_map_os_targets(host);
-+ } else {
-+ /* EMPTY */
-+ DEBUG2(printk(KERN_INFO "%s: Exit FAILED\n", __func__));
-+ }
-+
-+ DEBUG2(printk("%s: inst %ld exiting.\n", __func__, ha->instance));
-+ LEAVE("qla2x00_update_mp_host");
-+
-+ return success;
-+}
-+
-+/*
-+ * qla2x00_update_mp_device
-+ * Update the multipath control information from the port
-+ * database for that adapter.
-+ *
-+ * Inputs:
-+ * host Host adapter structure
-+ * port Device to add to the path tree.
-+ * dev_id Device id
-+ *
-+ * Synchronization:
-+ * The Adapter Lock should have already been acquired
-+ * before calling this routine.
-+ *
-+ * Return
-+ * 1 if updated successfully; 0 if error.
-+ *
-+ */
-+uint8_t
-+qla2x00_update_mp_device(mp_host_t *host,
-+ fc_port_t *port, uint16_t dev_id, uint16_t pathid)
-+{
-+ uint8_t success = 1;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+
-+ ENTER("qla2x00_update_mp_device");
-+
-+ DEBUG3(printk("%s(%ld): entered. host %p inst=%d, port =%p-%02x%02x"
-+ "%02x%02x%02x%02x%02x%02x, dev id = %d\n",
-+ __func__, host->ha->host_no, host, host->instance, port,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ dev_id));
-+
-+ if (!qla2x00_is_ww_name_zero(port->port_name)) {
-+ if( port->fo_combine ) {
-+ return( port->fo_combine(host, dev_id, port, pathid) );
-+ }
-+
-+ /* Only export tape devices */
-+ if (port->flags & FC_TAPE_PRESENT) {
-+ return qla2x00_export_target(host, dev_id, port, pathid);
-+ }
-+
-+ /*
-+ * Search for a device with a matching node name,
-+ * portname or create one.
-+ */
-+ dp = qla2x00_find_or_allocate_mp_dev(host, dev_id, port);
-+
-+ /*
-+ * We either have found or created a path list. Find this
-+ * host's path in the path list or allocate a new one
-+ * and add it to the list.
-+ */
-+ if (dp == NULL) {
-+ /* We did not create a mp_dev for this port. */
-+ port->mp_byte |= MP_MASK_UNCONFIGURED;
-+ DEBUG4(printk("%s: Device NOT found or created at "
-+ " dev_id=%d.\n",
-+ __func__, dev_id));
-+ return 0;
-+ }
-+
-+ /*
-+ * Find the path in the current path list, or allocate
-+ * a new one and put it in the list if it doesn't exist.
-+ * Note that we do NOT set bSuccess to 0 in the case
-+ * of failure here. We must tolerate the situation where
-+ * the customer has more paths to a device than he can
-+ * get into a PATH_LIST.
-+ */
-+
-+ path = qla2x00_find_or_allocate_path(host, dp, dev_id,
-+ pathid, port);
-+ if (path == NULL) {
-+ DEBUG4(printk("%s:Path NOT found or created.\n",
-+ __func__));
-+ return 0;
-+ }
-+
-+ /* Set the PATH flag to match the device flag
-+ * of whether this device needs a relogin. If any
-+ * device needs relogin, set the relogin countdown.
-+ */
-+ if (port->flags & FC_CONFIG)
-+ path->config = 1;
-+
-+ if (atomic_read(&port->state) != FCS_ONLINE) {
-+ path->relogin = 1;
-+ if (host->relogin_countdown == 0)
-+ host->relogin_countdown = 30;
-+ } else {
-+ path->relogin = 0;
-+ }
-+
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Failed portname empty.\n",
-+ __func__));
-+ }
-+
-+ DEBUG3(printk("%s(%ld): exiting.\n",
-+ __func__, host->ha->host_no));
-+ LEAVE("qla2x00_update_mp_device");
-+
-+ return success;
-+}
-+
-+/*
-+ * qla2x00_update_mp_tree
-+ * Get port information from each adapter, and build or rebuild
-+ * the multipath control tree from this data. This is called
-+ * from init and during port database notification.
-+ *
-+ * Input:
-+ * None
-+ *
-+ * Return:
-+ * Local function return code.
-+ *
-+ */
-+static uint32_t
-+qla2x00_update_mp_tree(void)
-+{
-+ mp_host_t *host;
-+ uint32_t rval = QLA_SUCCESS;
-+
-+ ENTER("qla2x00_update_mp_tree:");
-+
-+ /* Loop through each adapter and see what needs updating. */
-+ for (host = mp_hosts_base; (host) ; host = host->next) {
-+
-+ DEBUG4(printk("%s: hba(%d) flags (%x)\n",
-+ __func__, host->instance, host->flags));
-+ /* Clear the countdown; it may be reset in the update. */
-+ host->relogin_countdown = 0;
-+
-+ /* Override the NEEDS_UPDATE flag if disabled. */
-+ if (host->flags & MP_HOST_FLAG_DISABLE ||
-+ list_empty(host->fcports))
-+ host->flags &= ~MP_HOST_FLAG_NEEDS_UPDATE;
-+
-+ if (host->flags & MP_HOST_FLAG_NEEDS_UPDATE) {
-+
-+ /*
-+ * Perform the actual updates. If this succeeds, clear
-+ * the flag that an update is needed, and failback all
-+ * devices that are visible on this path to use this
-+ * path. If the update fails, leave set the flag that
-+ * an update is needed, and it will be picked back up
-+ * during the next timer routine.
-+ */
-+ if (qla2x00_update_mp_host(host)) {
-+ host->flags &= ~MP_HOST_FLAG_NEEDS_UPDATE;
-+
-+ qla2x00_failback_luns(host);
-+ } else
-+ rval = QLA_FUNCTION_FAILED;
-+
-+ }
-+
-+ }
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit FAILED.\n", __func__));
-+
-+ } else {
-+ /* EMPTY */
-+ DEBUG4(printk("%s: Exit OK.\n", __func__));
-+ }
-+ return rval;
-+}
-+
-+
-+
-+/*
-+ * qla2x00_find_matching_lun_by_num
-+ * Find the lun in the path that matches the
-+ * specified lun number.
-+ *
-+ * Input:
-+ * lun = lun number
-+ * newpath = path to search for lun
-+ *
-+ * Returns:
-+ * NULL or pointer to lun
-+ *
-+ * Context:
-+ * Kernel context.
-+ * (dg)
-+ */
-+static fc_lun_t *
-+qla2x00_find_matching_lun_by_num(uint16_t lun_no, mp_device_t *dp,
-+ mp_path_t *newpath)
-+{
-+ int found;
-+ fc_lun_t *lp = NULL; /* lun ptr */
-+ fc_port_t *fcport; /* port ptr */
-+ mp_lun_t *lun;
-+
-+ /* Use the lun list if we have one */
-+ if( dp->luns ) {
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ if( lun_no == lun->number ) {
-+ lp = lun->paths[newpath->id];
-+ break;
-+ }
-+ }
-+ } else {
-+ if ((fcport = newpath->port) != NULL) {
-+ found = 0;
-+ list_for_each_entry(lp, &fcport->fcluns, list) {
-+ if (lun_no == lp->lun) {
-+ found++;
-+ break;
-+ }
-+ }
-+ if (!found)
-+ lp = NULL;
-+ }
-+ }
-+ return lp;
-+}
-+
-+static fc_lun_t *
-+qla2x00_find_matching_lun(uint8_t lun, mp_device_t *dp,
-+ mp_path_t *newpath)
-+{
-+ fc_lun_t *lp;
-+
-+ lp = qla2x00_find_matching_lun_by_num(lun, dp, newpath);
-+
-+ return lp;
-+}
-+
-+/*
-+ * qla2x00_find_path_by_name
-+ * Find the path specified portname from the pathlist
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * pathlist = multi-path path list
-+ * portname portname to search for
-+ *
-+ * Returns:
-+ * pointer to the path or NULL
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_path_t *
-+qla2x00_find_path_by_name(mp_host_t *host, mp_path_list_t *plp,
-+ uint8_t *portname)
-+{
-+ mp_path_t *path = NULL; /* match if not NULL */
-+ mp_path_t *tmp_path;
-+ int cnt;
-+
-+ if ((tmp_path = plp->last) != NULL) {
-+ for (cnt = 0; (tmp_path) && cnt < plp->path_cnt; cnt++) {
-+ if (tmp_path->host == host &&
-+ qla2x00_is_portname_equal(
-+ tmp_path->portname, portname)) {
-+
-+ path = tmp_path;
-+ break;
-+ }
-+ tmp_path = tmp_path->next;
-+ }
-+ }
-+ return path ;
-+}
-+
-+/*
-+* qla2x00_find_lu_path_by_id
-+ * Find the path for the specified path id.
-+ *
-+ * Input:
-+ * mp_lun multi-path lun
-+ * id path id
-+ *
-+ * Returns:
-+ * pointer to the lu_path or NULL
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static lu_path_t *
-+qla2x00_find_lu_path_by_id(mp_lun_t *mplun, uint8_t path_id)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *tmp_path = NULL;
-+ lu_path_t *lu_path = NULL;
-+
-+ list_for_each_safe(list, temp, &mplun->lu_paths){
-+ tmp_path = list_entry(list, lu_path_t, list);
-+ if (tmp_path->path_id == path_id) {
-+ lu_path = tmp_path;
-+ break;
-+ }
-+ }
-+ return lu_path ;
-+}
-+
-+
-+/*
-+ * qla2x00_find_path_by_id
-+ * Find the path for the specified path id.
-+ *
-+ * Input:
-+ * dp multi-path device
-+ * id path id
-+ *
-+ * Returns:
-+ * pointer to the path or NULL
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla2x00_find_path_by_id(mp_device_t *dp, uint8_t id)
-+{
-+ mp_path_t *path = NULL;
-+ mp_path_t *tmp_path;
-+ mp_path_list_t *path_list;
-+ int cnt;
-+
-+ path_list = dp->path_list;
-+ tmp_path = path_list->last;
-+ for (cnt = 0; (tmp_path) && cnt < path_list->path_cnt; cnt++) {
-+ if (tmp_path->id == id) {
-+ path = tmp_path;
-+ break;
-+ }
-+ tmp_path = tmp_path->next;
-+ }
-+ return path ;
-+}
-+
-+/*
-+ * qla2x00_find_mp_dev_by_id
-+ * Find the mp_dev for the specified target id.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * tgt = Target id
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_find_mp_dev_by_id(mp_host_t *host, uint16_t id )
-+{
-+ if (id < MAX_MP_DEVICES)
-+ return host->mp_devs[id];
-+ else
-+ return NULL;
-+}
-+
-+/*
-+ * qla2x00_find_mp_dev_by_nodename
-+ * Find the mp_dev for the specified target name.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * name = Target name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_device_t *
-+qla2x00_find_mp_dev_by_nodename(mp_host_t *host, uint8_t *name )
-+{
-+ int id;
-+ mp_device_t *dp;
-+
-+ ENTER("qla2x00_find_mp_dev_by_nodename");
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id] ) == NULL)
-+ continue;
-+
-+ if ( dp->mpdev ) {
-+ DEBUG2(printk("%s: IGNORE device @ index %d: mpdev=%p\n",
-+ __func__, id,dp->mpdev));
-+ if (qla2x00_is_nodename_equal(dp->mpdev->nodename, name)) {
-+ DEBUG2(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id));
-+ return dp->mpdev;
-+ }
-+ }
-+DEBUG3(printk("%s mpdev_nodename=%0x nodename_from_gui=%0x",__func__,dp->nodename[7],name[7]));
-+ if (qla2x00_is_nodename_equal(dp->nodename, name)) {
-+ DEBUG3(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id));
-+ return dp;
-+ }
-+ }
-+
-+ LEAVE("qla2x00_find_mp_dev_by_name");
-+
-+ return NULL;
-+}
-+
-+/*
-+ * qla2x00_find_mp_dev_by_portname
-+ * Find the mp_dev for the specified target name.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ * name = port name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+mp_device_t *
-+qla2x00_find_mp_dev_by_portname(mp_host_t *host, uint8_t *name, uint16_t *pidx)
-+{
-+ int id;
-+ mp_device_t *dp = NULL;
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id] ) == NULL)
-+ continue;
-+
-+ if (qla2x00_is_portname_in_device(dp, name)) {
-+ DEBUG3(printk("%s: Found matching device @ index %d:\n",
-+ __func__, id));
-+ *pidx = id;
-+ return dp;
-+ }
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+
-+ return NULL;
-+ }
-+
-+/*
-+ * qla2x00_find_dp_by_pn_from_all_hosts
-+ * Search through all mp hosts to find the mp_dev for the
-+ * specified port name.
-+ *
-+ * Input:
-+ * pn = port name
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_device_t *
-+qla2x00_find_dp_by_pn_from_all_hosts(uint8_t *pn, uint16_t *pidx)
-+{
-+ int id;
-+ mp_device_t *ret_dp = NULL;
-+ mp_device_t *temp_dp = NULL; /* temporary pointer */
-+ mp_host_t *temp_host; /* temporary pointer */
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ for (temp_host = mp_hosts_base; (temp_host);
-+ temp_host = temp_host->next) {
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ temp_dp = temp_host->mp_devs[id];
-+
-+ if (temp_dp == NULL)
-+ continue;
-+
-+ if (qla2x00_is_portname_in_device(temp_dp, pn)) {
-+ DEBUG3(printk(
-+ "%s: Found matching dp @ host %p id %d:\n",
-+ __func__, temp_host, id));
-+ ret_dp = temp_dp;
-+ *pidx = id;
-+ break;
-+ }
-+ }
-+ if (ret_dp != NULL) {
-+ /* found a match. */
-+ break;
-+ }
-+ }
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+
-+ return ret_dp;
-+}
-+
-+/*
-+ * qla2x00_get_visible_path
-+ * Find the the visible path for the specified device.
-+ *
-+ * Input:
-+ * dp = device pointer
-+ *
-+ * Returns:
-+ * NULL or path
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static mp_path_t *
-+qla2x00_get_visible_path(mp_device_t *dp)
-+{
-+ uint16_t id;
-+ mp_path_list_t *path_list;
-+ mp_path_t *path;
-+
-+ path_list = dp->path_list;
-+ /* if we don't have a visible path skip it */
-+ if ((id = path_list->visible) == PATH_INDEX_INVALID) {
-+ return NULL;
-+ }
-+
-+ if ((path = qla2x00_find_path_by_id(dp,id))== NULL)
-+ return NULL;
-+
-+ return path ;
-+}
-+
-+/*
-+ * qla2x00_map_os_targets
-+ * Allocate the luns and setup the OS target.
-+ *
-+ * Input:
-+ * host = host adapter pointer.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla2x00_map_os_targets(mp_host_t *host)
-+{
-+ scsi_qla_host_t *ha = host->ha;
-+ mp_path_t *path;
-+ mp_device_t *dp;
-+ os_tgt_t *tgt;
-+ int t;
-+
-+ ENTER("qla2x00_map_os_targets ");
-+
-+ for (t = 0; t < MAX_TARGETS; t++ ) {
-+ dp = host->mp_devs[t];
-+ if (dp != NULL) {
-+ DEBUG3(printk("%s: (%d) found a dp=%p, "
-+ "host=%p, ha=%p\n",
-+ __func__, t, dp, host,ha));
-+
-+ if ((path = qla2x00_get_visible_path(dp)) == NULL) {
-+ DEBUG( printk(KERN_INFO
-+ "qla_cfg(%d): No visible path "
-+ "for target %d, dp = %p\n",
-+ host->instance, t, dp));
-+ continue;
-+ }
-+
-+ /* if not the visible path skip it */
-+ if (path->host == host) {
-+ if (TGT_Q(ha, t) == NULL) {
-+ if ((tgt = qla2x00_tgt_alloc(ha, t)) == NULL) {
-+ printk(KERN_WARNING
-+ "%s(%ld): Unable to allocate "
-+ "target structure, skipping "
-+ "device target %d\n",
-+ __func__, ha->host_no, t);
-+ continue;
-+ }
-+ memcpy(tgt->node_name, dp->nodename,
-+ WWN_SIZE);
-+ memcpy(tgt->port_name, path->portname,
-+ WWN_SIZE);
-+ tgt->fcport = path->port;
-+ tgt->id = dp->dev_id;
-+ if (path->port)
-+ if (path->port->flags &
-+ FC_NVSXXX_DEVICE)
-+ set_bit(TQF_USED_ID,
-+ &tgt->flags);
-+ }
-+ if (path->port)
-+ path->port->os_target_id = t;
-+ DEBUG3(printk("%s(%ld): host instance =%d, "
-+ "device= %p, tgt=%d has VISIBLE path,"
-+ "path id=%d\n",
-+ __func__, ha->host_no,
-+ host->instance,
-+ dp, t, path->id));
-+ } else {
-+ /* EMPTY */
-+ DEBUG3(printk("%s(%ld): host instance =%d, "
-+ "device= %p, tgt=%d has HIDDEN "
-+ "path, path id=%d\n",
-+ __func__, ha->host_no,
-+ host->instance, dp, t,
-+ path->id));
-+ continue;
-+ }
-+ qla2x00_map_os_luns(host, dp, t);
-+ } else {
-+ if ((tgt= TGT_Q(ha,t)) != NULL) {
-+ qla2x00_tgt_free(ha,t);
-+ }
-+ }
-+ }
-+
-+ LEAVE("qla2x00_map_os_targets ");
-+}
-+
-+static void
-+qla2x00_map_or_failover_oslun(mp_host_t *host, mp_device_t *dp,
-+ uint16_t t, uint16_t lun_no)
-+{
-+ int i;
-+
-+ /*
-+ * if this is initization time and we couldn't map the
-+ * lun then try and find a usable path.
-+ */
-+ if ( qla2x00_map_a_oslun(host, dp, t, lun_no) &&
-+ (host->flags & MP_HOST_FLAG_LUN_FO_ENABLED) ){
-+ /* find a path for us to use */
-+ for ( i = 0; i < dp->path_list->path_cnt; i++ ){
-+ qla2x00_select_next_path(host, dp, lun_no, NULL);
-+ if( !qla2x00_map_a_oslun(host, dp, t, lun_no))
-+ break;
-+ }
-+ }
-+}
-+
-+/*
-+ * qla2x00_map_os_luns
-+ * Allocate the luns for the OS target.
-+ *
-+ * Input:
-+ * dp = pointer to device
-+ * t = OS target number.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla2x00_map_os_luns(mp_host_t *host, mp_device_t *dp, uint16_t t)
-+{
-+ uint16_t lun_no;
-+ mp_lun_t *lun;
-+ os_lun_t *up;
-+
-+ DEBUG3(printk("Entering %s..\n",__func__));
-+
-+ /* if we are using lun binding then scan for the discovered luns */
-+ if( dp->luns ) {
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ lun_no = lun->number;
-+ DEBUG2(printk("%s: instance %d: Mapping target %d, lun %d..\n",
-+ __func__,host->instance,t,lun->number));
-+ qla2x00_map_or_failover_oslun(host, dp,
-+ t, lun_no);
-+ up = (os_lun_t *) GET_LU_Q(host->ha, t, lun_no);
-+ if (up == NULL) {
-+ DEBUG2(printk("%s: instance %d: No LUN_Q for target %d, lun %d..\n",
-+ __func__,host->instance,t,lun->number));
-+ continue;
-+ }
-+ if (up->fclun == NULL) {
-+ DEBUG2(printk("%s: instance %d: No FCLUN for target %d, lun %d.. lp=%p \n",
-+ __func__,host->instance,t,lun->number,up));
-+ continue;
-+ }
-+ DEBUG2(printk("%s: instance %d: Mapping target %d, lun %d.. to path id %d\n",
-+ __func__,host->instance,t,lun->number,
-+ up->fclun->fcport->cur_path));
-+ }
-+ } else {
-+ for (lun_no = 0; lun_no < MAX_LUNS; lun_no++ ) {
-+ qla2x00_map_or_failover_oslun(host, dp,
-+ t, lun_no);
-+ }
-+ }
-+ DEBUG3(printk("Exiting %s..\n",__func__));
-+}
-+
-+/*
-+ * qla2x00_map_a_osluns
-+ * Map the OS lun to the current path
-+ *
-+ * Input:
-+ * host = pointer to host
-+ * dp = pointer to device
-+ * lun = OS lun number.
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+
-+static uint8_t
-+qla2x00_map_a_oslun(mp_host_t *host, mp_device_t *dp, uint16_t t, uint16_t lun)
-+{
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ os_lun_t *lq;
-+ uint16_t id;
-+ mp_path_t *path, *vis_path;
-+ mp_host_t *vis_host;
-+ uint8_t status = 0;
-+
-+ if ((id = dp->path_list->current_path[lun]) != PATH_INDEX_INVALID) {
-+ path = qla2x00_find_path_by_id(dp,id);
-+ if (path) {
-+ fcport = path->port;
-+ if (fcport) {
-+
-+ /* Always map all luns if they are enabled */
-+ fcport->cur_path = id;
-+ fclun = qla2x00_find_matching_lun(lun,dp,path);
-+ if (fclun &&
-+ (path->lun_data.data[lun] &
-+ LUN_DATA_ENABLED) ) {
-+ DEBUG(printk( "qla2x00(%d): Current path for lun %d/%p is path id %d\n",
-+ host->instance,
-+ lun, fclun, id));
-+ DEBUG3(printk( "qla2x00(%d): Lun is enable \n", host->instance));
-+
-+ /*
-+ * Mapped lun on the visible path
-+ */
-+ if ((vis_path =
-+ qla2x00_get_visible_path(dp)) ==
-+ NULL ) {
-+
-+ printk(KERN_INFO
-+ "qla2x00(%d): No visible "
-+ "path for target %d, "
-+ "dp = %p\n",
-+ host->instance,
-+ t, dp);
-+
-+ return 0;
-+ }
-+ vis_host = vis_path->host;
-+
-+ /* ra 11/30/01 */
-+ /*
-+ * Always alloc LUN 0 so kernel
-+ * will scan past LUN 0.
-+ */
-+ if (lun != 0 &&
-+ (EXT_IS_LUN_BIT_SET(
-+ &(fcport->lun_mask), lun))) {
-+
-+ /* mask this LUN */
-+ return 0;
-+ }
-+
-+ if ((lq = qla2x00_lun_alloc(
-+ vis_host->ha,
-+ t, lun)) != NULL) {
-+
-+ lq->fclun = fclun;
-+ ((struct osl_fo_info *)
-+ lq->fo_ptr)->path_cnt =
-+ dp->path_list->path_cnt;
-+ }
-+ DEBUG(printk( "qla2x00(%d): lun allocated %p for lun %d\n",
-+ host->instance,lq,lun));
-+ }
-+ }
-+ else
-+ status = 1;
-+ }
-+ }
-+ return status;
-+}
-+
-+/*
-+ * qla2x00_is_ww_name_zero
-+ *
-+ * Input:
-+ * ww_name = Pointer to WW name to check
-+ *
-+ * Returns:
-+ * 1 if name is 0 else 0
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint8_t
-+qla2x00_is_ww_name_zero(uint8_t *nn)
-+{
-+ int cnt;
-+
-+ /* Check for zero node name */
-+ for (cnt = 0; cnt < WWN_SIZE ; cnt++, nn++) {
-+ if (*nn != 0)
-+ break;
-+ }
-+ /* if zero return 1 */
-+ if (cnt == WWN_SIZE)
-+ return 1;
-+ else
-+ return 0;
-+}
-+
-+/*
-+ * qla2x00_add_path
-+ * Add a path to the pathlist
-+ *
-+ * Input:
-+ * pathlist -- path list of paths
-+ * path -- path to be added to list
-+ *
-+ * Returns:
-+ * None
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla2x00_add_path( mp_path_list_t *pathlist, mp_path_t *path )
-+{
-+ mp_path_t *last = pathlist->last;
-+
-+ ENTER("qla2x00_add_path");
-+ DEBUG3(printk("%s: entered for path id %d.\n",
-+ __func__, path->id));
-+
-+ DEBUG3(printk("%s: pathlist =%p, path =%p, cnt = %d\n",
-+ __func__, pathlist, path, pathlist->path_cnt));
-+ if (last == NULL) {
-+ last = path;
-+ } else {
-+ path->next = last->next;
-+ }
-+
-+ last->next = path;
-+ pathlist->last = path;
-+ pathlist->path_cnt++;
-+
-+ DEBUG3(printk("%s: exiting. path cnt=%d.\n",
-+ __func__, pathlist->path_cnt));
-+ LEAVE("qla2x00_add_path");
-+}
-+
-+static void
-+qla2x00_add_lun( mp_device_t *dp, mp_lun_t *lun)
-+{
-+ mp_lun_t *cur_lun;
-+
-+ ENTER("qla2x00_add_lun");
-+
-+ /* Insert new entry into the list of luns */
-+ lun->next = NULL;
-+
-+ cur_lun = dp->luns;
-+ if( cur_lun == NULL ) {
-+ dp->luns = lun;
-+ } else {
-+ /* add to tail of list */
-+ while( cur_lun->next != NULL )
-+ cur_lun = cur_lun->next;
-+
-+ cur_lun->next = lun;
-+ }
-+ LEAVE("qla2x00_add_lun");
-+}
-+
-+/*
-+ * qla2x00_is_portname_in_device
-+ * Search for the specified "portname" in the device list.
-+ *
-+ * Input:
-+ * dp = device pointer
-+ * portname = portname to searched for in device
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_is_portname_in_device(mp_device_t *dp, uint8_t *portname)
-+{
-+ int idx;
-+
-+ if ( dp->mpdev ){
-+ for (idx = 0; idx < MAX_PATHS_PER_DEVICE; idx++) {
-+ if (memcmp(&dp->mpdev->portnames[idx][0], portname, WWN_SIZE) == 0)
-+ return 1;
-+ }
-+ }
-+ for (idx = 0; idx < MAX_PATHS_PER_DEVICE; idx++) {
-+ if (memcmp(&dp->portnames[idx][0], portname, WWN_SIZE) == 0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+
-+/*
-+ * qla2x00_set_lun_data_from_bitmask
-+ * Set or clear the LUN_DATA_ENABLED bits in the LUN_DATA from
-+ * a LUN bitmask provided from the miniport driver.
-+ *
-+ * Inputs:
-+ * lun_data = Extended LUN_DATA buffer to set.
-+ * lun_mask = Pointer to lun bit mask union.
-+ *
-+ * Return Value: none.
-+ */
-+void
-+qla2x00_set_lun_data_from_bitmask(mp_lun_data_t *lun_data,
-+ lun_bit_mask_t *lun_mask)
-+{
-+ int16_t lun;
-+
-+ ENTER("qla2x00_set_lun_data_from_bitmask");
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ /* our bit mask is inverted */
-+ if (!(EXT_IS_LUN_BIT_SET(lun_mask,lun)))
-+ lun_data->data[lun] |= LUN_DATA_ENABLED;
-+ else
-+ lun_data->data[lun] &= ~LUN_DATA_ENABLED;
-+
-+ DEBUG5(printk("%s: lun data[%d] = 0x%x\n",
-+ __func__, lun, lun_data->data[lun]));
-+ }
-+
-+ LEAVE("qla2x00_set_lun_data_from_bitmask");
-+
-+ return;
-+}
-+
-+static void
-+qla2x00_failback_single_lun(mp_device_t *dp, uint8_t lun, uint8_t new)
-+{
-+ mp_path_list_t *pathlist;
-+ mp_path_t *new_path, *old_path;
-+ uint8_t old;
-+ mp_host_t *host;
-+ os_lun_t *lq;
-+ os_tgt_t *tq;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+ fc_port_t *new_fcport;
-+ fc_lun_t *fclun;
-+ int skip_notify = 0;
-+
-+ /* Failback and update statistics. */
-+ if ((pathlist = dp->path_list) == NULL)
-+ return;
-+
-+ old = pathlist->current_path[lun];
-+ pathlist->current_path[lun] = new;
-+
-+ if ((new_path = qla2x00_find_path_by_id(dp, new)) == NULL)
-+ return;
-+ if ((old_path = qla2x00_find_path_by_id(dp, old)) == NULL)
-+ return;
-+
-+ /* An fclun should exist for the failbacked lun */
-+ if ((fclun = qla2x00_find_matching_lun(lun, dp, new_path)) == NULL)
-+ return;
-+ if (qla2x00_find_matching_lun(lun, dp, old_path) == NULL)
-+ return;
-+
-+ if ((vis_path = qla2x00_get_visible_path(dp)) == NULL) {
-+ DEBUG2(printk(KERN_INFO
-+ "No visible path for target %d, dp = %p\n", dp->dev_id,
-+ dp));
-+ return;
-+ }
-+ vis_host = vis_path->host;
-+ tq = TGT_Q(vis_host->ha, dp->dev_id);
-+ if (tq == NULL) {
-+ DEBUG2(printk(KERN_INFO
-+ "%s(): **** DP dev_id derives a NULL TGT_Q\n", __func__));
-+ return;
-+ }
-+
-+ if( (new_fcport = new_path->port ) == NULL )
-+ return;
-+
-+ DEBUG2(printk(KERN_INFO
-+ "qla2x00(%d): Suspending I/O to target %d, dp = %p, lun=%d\n",
-+ vis_host->instance, dp->dev_id, dp, lun));
-+
-+ set_bit(TQF_SUSPENDED, &tq->flags);
-+ /* Log to console and to event log. */
-+ printk(KERN_INFO
-+ "qla2x00: FAILBACK device %d -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x LUN %02x\n",
-+ dp->dev_id,
-+ dp->nodename[0], dp->nodename[1],
-+ dp->nodename[2], dp->nodename[3],
-+ dp->nodename[4], dp->nodename[5],
-+ dp->nodename[6], dp->nodename[7],
-+ lun);
-+
-+ printk(KERN_INFO
-+ "qla2x00: FROM HBA %d to HBA %d \n",
-+ old_path->host->instance,
-+ new_path->host->instance);
-+
-+ host = new_path->host;
-+
-+ if (new_fcport->flags & (FC_AA_EVA_DEVICE |
-+ FC_AA_MSA_DEVICE) ) {
-+ /* Update lun path info if necessary */
-+ if( qla2x00_find_all_active_fcports(lun) ) {
-+ DEBUG2(printk(KERN_INFO
-+ "qla2x00(%d): FAILBACk failed for target %d, dp = %p, lun=%d\n",
-+ vis_host->instance, dp->dev_id, dp, lun));
-+ clear_bit(TQF_SUSPENDED, &tq->flags);
-+ return;
-+ }
-+
-+ /* Check if path has already moved */
-+ if (new_fcport->fo_target_port) {
-+ lu_path_t *new_lu_path;
-+ mp_lun_t *mplun;
-+ /* find lu_path for the current fclun */
-+ mplun = (mp_lun_t *)fclun->mplun;
-+ new_lu_path = qla2x00_find_lu_path_by_id(
-+ mplun,fclun->path_id);
-+ if (new_lu_path->asym_acc_state == TPG_ACT_OPT) {
-+ skip_notify++;
-+ }
-+ }
-+ }
-+ /* Clear the reservation if any. */
-+ if (new_fcport != NULL ) {
-+ if (new_fcport->flags &
-+ (FC_EVA_DEVICE | FC_AA_EVA_DEVICE | FC_AA_MSA_DEVICE |
-+ FC_NVSXXX_DEVICE | FC_SYMXXX_DEVICE)) {
-+ printk(KERN_INFO
-+ "scsi(%ld:0x%x:%d) sending lun reset.\n",
-+ new_fcport->ha->host_no, new_fcport->loop_id, lun);
-+ qla2x00_lun_reset(new_fcport->ha, new_fcport, lun);
-+ }
-+ }
-+
-+ /* Send a failover notification. */
-+ if( !skip_notify )
-+ qla2x00_send_failover_notify(dp, lun, new_path, old_path);
-+
-+ /* remap the lun */
-+ qla2x00_map_a_oslun(host, dp, dp->dev_id, lun);
-+
-+ /* 7/16
-+ * Reset counts on the visible path
-+ */
-+ if ((vis_path = qla2x00_get_visible_path(dp)) == NULL) {
-+ printk(KERN_INFO
-+ "qla2x00(%d): No visible path for "
-+ "target %d, dp = %p\n",
-+ host->instance,
-+ dp->dev_id, dp);
-+ return;
-+ }
-+
-+ DEBUG2(printk(KERN_INFO
-+ "qla2x00(%d): Resuming I/O to target %d, dp = %p, lun=%d\n",
-+ vis_host->instance, dp->dev_id, dp, lun));
-+ clear_bit(TQF_SUSPENDED, &tq->flags);
-+
-+ vis_host = vis_path->host;
-+ if ((lq = qla2x00_lun_alloc(vis_host->ha, dp->dev_id, lun)) != NULL) {
-+ ((struct osl_fo_info *) lq->fo_ptr)->path_cnt =
-+ dp->path_list->path_cnt;
-+ qla2x00_delay_lun(vis_host->ha, lq, ql2xrecoveryTime);
-+ qla2x00_flush_failover_q(vis_host->ha, lq);
-+ qla2x00_reset_lun_fo_counts(vis_host->ha, lq);
-+ }
-+}
-+
-+#if 0
-+static void
-+qla2x00_failback_single_lun(mp_device_t *dp, uint8_t lun, uint8_t new)
-+{
-+ mp_path_list_t *pathlist;
-+ mp_path_t *new_path, *old_path;
-+ uint8_t old;
-+ mp_host_t *new_host;
-+ os_lun_t *lq;
-+ mp_path_t *vis_path;
-+ mp_host_t *vis_host;
-+ int status;
-+
-+ /* Failback and update statistics. */
-+ if ((pathlist = dp->path_list) == NULL)
-+ return;
-+
-+ old = pathlist->current_path[lun];
-+ /* pathlist->current_path[lun] = new; */
-+
-+ if ((new_path = qla2x00_find_path_by_id(dp, new)) == NULL)
-+ return;
-+ if ((old_path = qla2x00_find_path_by_id(dp, old)) == NULL)
-+ return;
-+
-+ /* An fclun should exist for the failbacked lun */
-+ if (qla2x00_find_matching_lun(lun, dp, new_path) == NULL)
-+ return;
-+ if (qla2x00_find_matching_lun(lun, dp, old_path) == NULL)
-+ return;
-+
-+ if ((vis_path = qla2x00_get_visible_path(dp)) == NULL) {
-+ printk(KERN_INFO
-+ "No visible path for "
-+ "target %d, dp = %p\n",
-+ dp->dev_id, dp);
-+ return;
-+ }
-+ vis_host = vis_path->host;
-+ /* Schedule the recovery before we move the luns */
-+ if( (lq = (os_lun_t *)
-+ LUN_Q(vis_host->ha, dp->dev_id, lun)) == NULL ) {
-+ printk(KERN_INFO
-+ "qla2x00(%d): No visible lun for "
-+ "target %d, dp = %p, lun=%d\n",
-+ vis_host->instance,
-+ dp->dev_id, dp, lun);
-+ return;
-+ }
-+
-+ qla2x00_delay_lun(vis_host->ha, lq, ql2xrecoveryTime);
-+
-+ /* Log to console and to event log. */
-+ printk(KERN_INFO
-+ "qla2x00: FAILBACK device %d -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x LUN %02x\n",
-+ dp->dev_id,
-+ dp->nodename[0], dp->nodename[1],
-+ dp->nodename[2], dp->nodename[3],
-+ dp->nodename[4], dp->nodename[5],
-+ dp->nodename[6], dp->nodename[7],
-+ lun);
-+
-+ printk(KERN_INFO
-+ "qla2x00: FROM HBA %d to HBA %d \n",
-+ old_path->host->instance,
-+ new_path->host->instance);
-+
-+
-+ /* Send a failover notification. */
-+ status = qla2x00_send_failover_notify(dp, lun,
-+ new_path, old_path);
-+
-+ new_host = new_path->host;
-+
-+ /* remap the lun */
-+ if (status == QLA_SUCCESS ) {
-+ pathlist->current_path[lun] = new;
-+ qla2x00_map_a_oslun(new_host, dp, dp->dev_id, lun);
-+ qla2x00_flush_failover_q(vis_host->ha, lq);
-+ qla2x00_reset_lun_fo_counts(vis_host->ha, lq);
-+ }
-+}
-+#endif
-+
-+/*
-+* qla2x00_failback_luns
-+* This routine looks through the devices on an adapter, and
-+* for each device that has this adapter as the visible path,
-+* it forces that path to be the current path. This allows us
-+* to keep some semblance of static load balancing even after
-+* an adapter goes away and comes back.
-+*
-+* Arguments:
-+* host Adapter that has just come back online.
-+*
-+* Return:
-+* None.
-+*/
-+static void
-+qla2x00_failback_luns( mp_host_t *host)
-+{
-+ uint16_t dev_no;
-+ uint8_t l;
-+ uint16_t lun;
-+ int i;
-+ mp_device_t *dp;
-+ mp_path_list_t *path_list;
-+ mp_path_t *path;
-+ fc_lun_t *new_fp;
-+
-+ ENTER("qla2x00_failback_luns");
-+
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ if (dp->mpdev)
-+ dp = dp->mpdev;
-+
-+ path_list = dp->path_list;
-+ for (path = path_list->last, i= 0;
-+ i < path_list->path_cnt;
-+ i++, path = path->next) {
-+
-+ if (path->host != host )
-+ continue;
-+
-+ if (path->port == NULL)
-+ continue;
-+
-+ if (atomic_read(&path->port->state) == FCS_DEVICE_DEAD)
-+ continue;
-+
-+ if ((path->port->flags & FC_FAILBACK_DISABLE))
-+ continue;
-+
-+ /*
-+ * Failback all the paths for this host,
-+ * the luns could be preferred across all paths
-+ */
-+ DEBUG(printk("%s(%d): Lun Data for device %p, "
-+ "id=%d, path id=%d\n",
-+ __func__, host->instance, dp, dp->dev_id,
-+ path->id));
-+ DEBUG4(qla2x00_dump_buffer(
-+ (char *)&path->lun_data.data[0], 64));
-+ DEBUG4(printk("%s(%d): Perferrred Path data:\n",
-+ __func__, host->instance));
-+ DEBUG4(qla2x00_dump_buffer(
-+ (char *)&path_list->current_path[0], 64));
-+
-+ for (lun = 0; lun < MAX_LUNS_PER_DEVICE; lun++) {
-+ l = (uint8_t)(lun & 0xFF);
-+
-+ /*
-+ * if this is the preferred lun and not
-+ * the current path then failback lun.
-+ */
-+ DEBUG4(printk("%s: target=%d, cur path id =%d, "
-+ "lun data[%d] = %d)\n",
-+ __func__, dp->dev_id, path->id,
-+ lun, path->lun_data.data[lun]));
-+
-+ if ((path->lun_data.data[l] &
-+ LUN_DATA_PREFERRED_PATH) &&
-+ /* !path->relogin && */
-+ path_list->current_path[l] !=
-+ path->id) {
-+ /* No point in failing back a
-+ disconnected lun */
-+ new_fp = qla2x00_find_matching_lun(
-+ l, dp, path);
-+
-+ if (new_fp == NULL)
-+ continue;
-+ /* Skip a disconect lun */
-+ if (new_fp->device_type & 0x20)
-+ continue;
-+
-+ qla2x00_failback_single_lun(
-+ dp, l, path->id);
-+ }
-+ }
-+ }
-+
-+ }
-+
-+ LEAVE("qla2x00_failback_luns");
-+
-+ return;
-+}
-+
-+static struct _mp_path *
-+qla2x00_find_first_path_to_active_tpg( mp_device_t *dp, mp_lun_t *mplun, int any_grp)
-+{
-+ mp_tport_grp_t *tport_grp = NULL;
-+ mp_path_t *path = NULL;
-+ mp_path_list_t *plp = dp->path_list;
-+ mp_path_t *tmp_path;
-+ fc_port_t *fcport;
-+ mp_port_t *mp_port;
-+ int cnt;
-+
-+ /* Find an Active Optimised Tgt port group */
-+ tport_grp = qla2x00_find_tgt_port_grp_by_state(mplun, TPG_ACT_OPT);
-+ if (tport_grp == NULL ) {
-+ /* Find an Active Non Optimised Tgt port group */
-+ if ( any_grp )
-+ tport_grp = qla2x00_find_tgt_port_grp_by_state(mplun, TPG_ACT_NON_OPT);
-+ if (tport_grp == NULL)
-+ return path;
-+ }
-+ DEBUG(printk("%s found active tpg asym_state=%d tpg_id=%d\n",__func__,
-+ tport_grp->asym_acc_state, tport_grp->tpg_id[1]));
-+ /* Find first active path to this tgt port grp */
-+ if ((tmp_path = plp->last) != NULL) {
-+ tmp_path = tmp_path->next;
-+ for (cnt = 0; (tmp_path) && cnt < plp->path_cnt;
-+ tmp_path = tmp_path->next, cnt++) {
-+ fcport = tmp_path->port;
-+ if (fcport == NULL)
-+ continue;
-+ mp_port = tport_grp->ports_list[tmp_path->id];
-+ if (mp_port == NULL)
-+ continue;
-+ if (memcmp(fcport->port_name, mp_port->portname,
-+ WWN_SIZE) == 0) {
-+ path = tmp_path;
-+ break;
-+ }
-+ }
-+ }
-+ return path;
-+
-+
-+}
-+
-+static struct _mp_path *
-+qla2x00_find_first_active_path( mp_device_t *dp, mp_lun_t *lun)
-+{
-+ mp_path_t *path= NULL;
-+ mp_path_list_t *plp = dp->path_list;
-+ mp_path_t *tmp_path;
-+ fc_port_t *fcport;
-+ fc_lun_t *fclun;
-+ int cnt;
-+
-+ if ((tmp_path = plp->last) != NULL) {
-+ tmp_path = tmp_path->next;
-+ for (cnt = 0; (tmp_path) && cnt < plp->path_cnt;
-+ tmp_path = tmp_path->next, cnt++) {
-+ fcport = tmp_path->port;
-+ if (fcport != NULL) {
-+ if ((fcport->flags & FC_EVA_DEVICE) ||
-+ fcport->fo_target_port) {
-+ fclun = lun->paths[tmp_path->id];
-+ if (fclun == NULL)
-+ continue;
-+ if (fclun->flags & FLF_ACTIVE_LUN) {
-+ path = tmp_path;
-+ break;
-+ }
-+ } else {
-+ if ((fcport->flags &
-+ FC_MSA_PORT_ACTIVE)) {
-+ path = tmp_path;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return path;
-+}
-+
-+/*
-+ * qla2x00_setup_new_path
-+ * Checks the path against the existing paths to see if there
-+ * are any incompatibilities. It then checks and sets up the
-+ * current path indices.
-+ *
-+ * Inputs:
-+ * dp = pointer to device
-+ * path = new path
-+ *
-+ * Returns:
-+ * None
-+ */
-+static void
-+qla2x00_setup_new_path( mp_device_t *dp, mp_path_t *path, fc_port_t *fcport)
-+{
-+ mp_path_list_t *path_list = dp->path_list;
-+ mp_path_t *tmp_path, *first_path;
-+ mp_host_t *first_host;
-+ mp_host_t *tmp_host;
-+
-+ uint16_t lun;
-+ uint8_t l;
-+ int i;
-+
-+ ENTER("qla2x00_setup_new_path");
-+ DEBUG(printk("qla2x00_setup_new_path: path %p path id %d\n",
-+ path, path->id));
-+ if (path->port){
-+ DEBUG(printk("qla2x00_setup_new_path: port %p loop id 0x%x\n",
-+ path->port, fcport->loop_id));
-+ }
-+
-+ /* If this is a visible path, and there is not already a
-+ * visible path, save it as the visible path. If there
-+ * is already a visible path, log an error and make this
-+ * path invisible.
-+ */
-+ if (!(path->mp_byte & (MP_MASK_HIDDEN | MP_MASK_UNCONFIGURED))) {
-+
-+ /* No known visible path */
-+ if (path_list->visible == PATH_INDEX_INVALID) {
-+ DEBUG3(printk("%s: No know visible path - make this "
-+ "path visible\n",
-+ __func__));
-+
-+ path_list->visible = path->id;
-+ path->mp_byte &= ~MP_MASK_HIDDEN;
-+ } else {
-+ DEBUG3(printk("%s: Second visible path found- make "
-+ "this one hidden\n",
-+ __func__));
-+
-+ path->mp_byte |= MP_MASK_HIDDEN;
-+ }
-+ if (path->port)
-+ path->port->mp_byte = path->mp_byte;
-+ }
-+
-+ /*
-+ * If this is not the first path added, and the setting for
-+ * MaxLunsPerTarget does not match that of the first path
-+ * then disable qla_cfg for all adapters.
-+ */
-+ first_path = qla2x00_find_path_by_id(dp, 0);
-+
-+ if (first_path != NULL) {
-+ first_host = first_path->host;
-+ if ((path->id != 0) &&
-+ (first_host->MaxLunsPerTarget !=
-+ path->host->MaxLunsPerTarget)) {
-+
-+ for (tmp_path = path_list->last, i = 0;
-+ (tmp_path) && i <= path->id; i++) {
-+
-+ tmp_host = tmp_path->host;
-+ if (!(tmp_host->flags &
-+ MP_HOST_FLAG_DISABLE)) {
-+
-+ DEBUG4(printk("%s: 2nd visible "
-+ "path (%p)\n",
-+ __func__, tmp_host));
-+
-+ tmp_host->flags |= MP_HOST_FLAG_DISABLE;
-+ }
-+ }
-+ }
-+ }
-+
-+ if ((!(fcport->flags & (FC_MSA_DEVICE | FC_EVA_DEVICE)) && fcport->fo_target_port == NULL) ||
-+ fcport->flags & FC_FAILOVER_DISABLE) {
-+
-+ /*
-+ * For each LUN, evaluate whether the new path that is added is
-+ * better than the existing path. If it is, make it the
-+ * current path for the LUN.
-+ */
-+ for (lun = 0; lun < MAX_LUNS_PER_DEVICE; lun++) {
-+ l = (uint8_t)(lun & 0xFF);
-+
-+ /*
-+ * If this is the first path added, it is the only
-+ * available path, so make it the current path.
-+ */
-+ DEBUG4(printk("%s: lun_data 0x%x, LUN %d\n",
-+ __func__, path->lun_data.data[l], lun));
-+
-+ if (first_path == path) {
-+ path_list->current_path[l] = 0;
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ } else if (path->lun_data.data[l] &
-+ LUN_DATA_PREFERRED_PATH) {
-+ /*
-+ * If this is not the first path added, if this
-+ * is the preferred path, so make it the
-+ * current path.
-+ */
-+ path_list->current_path[l] = path->id;
-+ }
-+ }
-+ }
-+
-+ LEAVE("qla2x00_setup_new_path");
-+
-+ return;
-+}
-+
-+/*
-+ * qla2x00_cfg_mem_free
-+ * Free all configuration structures.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla2x00_cfg_mem_free(scsi_qla_host_t *ha)
-+{
-+ mp_lun_t *cur_lun;
-+ mp_lun_t *tmp_lun;
-+ mp_device_t *dp;
-+ mp_path_list_t *path_list;
-+ mp_path_t *tmp_path, *path;
-+ mp_host_t *host, *temp;
-+ mp_port_t *temp_port;
-+ struct list_head *list, *temp_list;
-+ int id, cnt, tid;
-+ mp_tport_grp_t *tport_grp;
-+ lu_path_t *lu_path;
-+
-+ if ((host = qla2x00_cfg_find_host(ha)) != NULL) {
-+ if( mp_num_hosts == 0 )
-+ return;
-+
-+ for (id= 0; id < MAX_MP_DEVICES; id++) {
-+ if ((dp = host->mp_devs[id]) == NULL)
-+ continue;
-+ if ((path_list = dp->path_list) == NULL)
-+ continue;
-+ if ((tmp_path = path_list->last) == NULL)
-+ continue;
-+ for (cnt = 0; cnt < path_list->path_cnt; cnt++) {
-+ path = tmp_path;
-+ tmp_path = tmp_path->next;
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing path[%d] "
-+ "= %p\n",
-+ host->instance,
-+ cnt, path));
-+ kfree(path);
-+ }
-+ kfree(path_list);
-+ host->mp_devs[id] = NULL;
-+ /* remove dp from other hosts */
-+ for (temp = mp_hosts_base; (temp); temp = temp->next) {
-+ for (tid= 0; tid < MAX_MP_DEVICES; tid++)
-+ if (temp->mp_devs[tid] == dp) {
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing host[%d] = "
-+ "%p\n",
-+ host->instance,
-+ temp->instance,temp));
-+ temp->mp_devs[tid] = NULL;
-+ }
-+ }
-+ /* Free all the lun struc's attached
-+ * to this mp_device */
-+ for ( cur_lun = dp->luns; (cur_lun);
-+ cur_lun = cur_lun->next) {
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing lun:%p "
-+ "attached to device:%p\n",
-+ host->instance,
-+ cur_lun,dp));
-+ list_for_each_safe(list, temp_list,
-+ &cur_lun->ports_list) {
-+ temp_port = list_entry(list,
-+ mp_port_t, list);
-+ list_del_init(&temp_port->list);
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing port:%p "
-+ "attached to lun:%p\n",
-+ host->instance, temp_port,
-+ cur_lun));
-+ kfree(temp_port);
-+
-+ }
-+ list_for_each_safe(list, temp_list, &cur_lun->active_list) {
-+ lu_path = list_entry(list, lu_path_t, next_active);
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Deleting active lu_path:%p "
-+ "attached to lun:%p\n",
-+ host->instance, lu_path,
-+ cur_lun));
-+ list_del_init(&lu_path->next_active);
-+ }
-+ list_for_each_safe(list, temp_list,
-+ &cur_lun->lu_paths) {
-+ lu_path = list_entry(list, lu_path_t,
-+ list);
-+ list_del_init(&lu_path->list);
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing lu_path:%p "
-+ "attached to lun:%p\n",
-+ host->instance, lu_path,
-+ cur_lun));
-+ kfree(lu_path);
-+ }
-+ if (cur_lun->asymm_support) {
-+ list_for_each_safe(list, temp_list,
-+ &cur_lun->tport_grps_list) {
-+ tport_grp = list_entry(list,
-+ mp_tport_grp_t, list);
-+ DEBUG(printk(KERN_INFO
-+ "host%d - Removing tpg:%p "
-+ "attached to lun:%p\n",
-+ host->instance, tport_grp,
-+ cur_lun));
-+ list_del_init(&tport_grp->list);
-+ kfree(tport_grp);
-+ }
-+ }
-+ tmp_lun = cur_lun;
-+ kfree(tmp_lun);
-+ }
-+ kfree(dp);
-+ }
-+
-+ /* remove this host from host list */
-+ temp = mp_hosts_base;
-+ if (temp != NULL) {
-+ /* Remove from top of queue */
-+ if (temp == host) {
-+ mp_hosts_base = host->next;
-+ } else {
-+ /*
-+ * Remove from middle of queue
-+ * or bottom of queue
-+ */
-+ for (temp = mp_hosts_base;
-+ temp != NULL;
-+ temp = temp->next) {
-+
-+ if (temp->next == host) {
-+ temp->next = host->next;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ kfree(host);
-+ mp_num_hosts--;
-+ }
-+}
-+
-+int
-+qla2x00_is_fcport_in_foconfig(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ mp_device_t *dp;
-+ mp_host_t *host;
-+ mp_path_t *path;
-+ mp_path_list_t *pathlist;
-+ uint16_t dev_no;
-+
-+ /* no configured devices */
-+ host = qla2x00_cfg_find_host(ha);
-+ if (!host)
-+ return (0);
-+
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Sanity check */
-+ if (qla2x00_is_wwn_zero(dp->nodename))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = qla2x00_find_path_by_name(host, dp->path_list,
-+ fcport->port_name);
-+ if (path != NULL) {
-+ /* found path for port */
-+ if (path->config == 1) {
-+ return (1);
-+ } else {
-+ break;
-+ }
-+ }
-+ }
-+
-+ return (0);
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_cfg.h ./drivers/scsi/qla2xxx/qla_cfg.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_cfg.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_cfg.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,280 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/*
-+ * QLogic ISP2x00 Multi-path LUN Support
-+ * Multi-path include file.
-+ */
-+
-+#if !defined(_QLA_CFG_H)
-+#define _QLA_CFG_H
-+
-+#if defined(__cplusplus)
-+extern "C"
-+{
-+#endif
-+
-+/*
-+ * Failover definitions
-+ */
-+#define FAILOVER_TYPE_COUNT 4
-+#define MP_NOTIFY_RESET_DETECTED 1
-+#define MP_NOTIFY_PWR_LOSS 2
-+#define MP_NOTIFY_LOOP_UP 3
-+#define MP_NOTIFY_LOOP_DOWN 4
-+#define MP_NOTIFY_BUS_RESET 5
-+#define FAILOVER_TYPE_ERROR_RETRY 1
-+#define MAX_NUMBER_PATHS FO_MAX_PATHS
-+#define PORT_NAME_SIZE WWN_SIZE
-+#define FAILOVER_NOTIFY_STATUS_ERROR QLA_SUCCESS
-+#define FAILOVER_NOTIFY_STATUS_SUCCESS QLA_SUCCESS
-+#define FAILOVER_NOTIFY_CDB_LENGTH_MAX FO_NOTIFY_CDB_LENGTH_MAX
-+#define MAX_TARGETS_PER_DEVICE SDM_DEF_MAX_TARGETS_PER_DEVICE
-+
-+/*
-+ * Limits definitions.
-+ */
-+#define MAX_LUNS_PER_DEVICE MAX_LUNS /* Maximum # of luns */
-+#define MAX_MP_DEVICES MAX_TARGETS /* Maximum # of virtual devs */
-+#define MAX_PATHS_PER_DEVICE 64 /* Maximum # of paths */
-+#define MAX_TPG_PORTS 128 /* Max Ports per Tgt Port Group */
-+#if !defined(MAX_LUNS)
-+#define MAX_LUNS 256
-+#endif
-+#define MAX_HOSTS MAX_HOST_COUNT
-+
-+/* Async notification types */
-+#define NOTIFY_EVENT_LINK_DOWN 1 /* Link went down */
-+#define NOTIFY_EVENT_LINK_UP 2 /* Link is back up */
-+#define NOTIFY_EVENT_RESET_DETECTED 3 /* Reset detected */
-+
-+/* MACROS */
-+#define qla2x00_is_portname_equal(N1,N2) \
-+ ((memcmp((N1),(N2),WWN_SIZE)==0 ? 1: 0))
-+#define qla2x00_is_nodename_equal(N1,N2) \
-+ ((memcmp((N1),(N2),WWN_SIZE)==0 ? 1: 0))
-+
-+/*
-+ * Per-multipath driver parameters
-+ */
-+typedef struct _mp_lun_data {
-+ uint8_t data[MAX_LUNS];
-+#define LUN_DATA_ENABLED BIT_7
-+#define LUN_DATA_PREFERRED_PATH BIT_6
-+}
-+mp_lun_data_t;
-+
-+
-+#define PATH_INDEX_INVALID 0xff
-+
-+extern int
-+qla2x00_get_vol_access_path(fc_port_t *fcport, fc_lun_t *fclun, int modify);
-+/*
-+ * Per-device collection of all paths.
-+ */
-+typedef struct _mp_path_list {
-+ struct _mp_path *last; /* ptrs to end of circular list of paths */
-+ uint8_t path_cnt; /* number of paths */
-+ uint8_t visible; /* visible path */
-+ uint16_t reserved1; /* Memory alignment */
-+ uint32_t reserved2; /* Memory alignment */
-+ uint8_t current_path[ MAX_LUNS_PER_DEVICE ]; /* current path for a given lun */
-+ uint16_t failover_cnt[ FAILOVER_TYPE_COUNT ];
-+}
-+mp_path_list_t;
-+
-+typedef struct _lu_path {
-+ struct list_head list;
-+ struct list_head next_active; /* list of active path */
-+ struct _mp_host *host;
-+ uint8_t hba_instance;
-+ uint16_t path_id; /* path id (index) */
-+ uint16_t flags;
-+#define LPF_TPG_UNKNOWN BIT_0
-+ fc_lun_t *fclun; /* fclun for this path */
-+ /*
-+ * tpg_id[0] : msb
-+ * tpg_id[1] : lsb
-+ */
-+ uint8_t tpg_id[2]; /* target port group id */
-+ /*
-+ * rel_tport_id[0] : msb
-+ * rel_tport_id[1] : lsb
-+ */
-+ uint8_t rel_tport_id[2]; /* relative target port id */
-+ uint8_t asym_acc_state; /* asymmetric access state */
-+ uint8_t portname[WWN_SIZE]; /* portname of this tgt */
-+}
-+lu_path_t;
-+/*
-+ * Definitions for failover notify SRBs. These SRBs contain failover notify
-+ * CDBs to notify a target that a failover has occurred.
-+ *
-+ */
-+typedef struct _failover_notify_srb {
-+ srb_t *srb;
-+ uint16_t status;
-+ uint16_t reserved;
-+}
-+failover_notify_srb_t;
-+
-+#define WWULN_SIZE 32
-+typedef struct _mp_lun {
-+ struct _mp_lun *next;
-+ struct _mp_device *dp; /* Multipath device */
-+ struct list_head lu_paths; /* list of lu_paths */
-+ struct list_head active_list; /* list of active lu_paths */
-+ spinlock_t mplock;
-+ int active;
-+ int act_cnt;
-+ struct list_head ports_list;
-+ struct list_head tport_grps_list; /* list of target port groups */
-+ int number; /* actual lun number */
-+ int load_balance_type; /* load balancing method */
-+#define LB_NONE 0 /* All the luns on the first active path */
-+#define LB_STATIC 1 /* All the luns distributed across all the paths
-+ on active optimised controller */
-+#define LB_LRU 2
-+#define LB_LST 3
-+#define LB_RR 4
-+#define LB_LRU_BYTES 5
-+ uint16_t cur_path_id; /* current path */
-+ uint16_t pref_path_id; /* preferred path */
-+ uint16_t config_pref_id; /* configuration preferred path */
-+ fc_lun_t *paths[MAX_PATHS_PER_DEVICE]; /* list of fcluns */
-+ int path_cnt; /* Must be > 1 for fo device */
-+ int siz; /* Size of wwuln */
-+ uint8_t wwuln[WWULN_SIZE];/* lun id from inquiry page 83. */
-+ uint8_t asymm_support;
-+}
-+mp_lun_t;
-+
-+typedef struct _mp_port {
-+ struct list_head list;
-+ uint8_t portname[WWN_SIZE];
-+ uint8_t path_list[ MAX_HOSTS ]; /* path index for a given HBA */
-+ scsi_qla_host_t *hba_list[ MAX_HOSTS ];
-+ int cnt;
-+ int fo_cnt;
-+ ulong total_blks; /* blocks transferred on this port */
-+ /* page 83 type=4 relative tgt port group identifier.
-+ * For adaptec its set to 1 for Port A and 2 for Port B on
-+ * the controller
-+ * rel_tport_id[0] : msb
-+ * rel_tport_id[1] : lsb
-+ */
-+ uint8_t rel_tport_id[2]; /* relative target port id */
-+ uint8_t flags;
-+#define MP_NO_REL_TPORT_ID BIT_0
-+
-+}
-+mp_port_t;
-+
-+/*
-+ * Describes target port groups.
-+ */
-+typedef struct _mp_tport_grp {
-+ struct list_head list;
-+ /* page 83 type=5 target port group identifier in big endian format.
-+ * IBM has groups 0 and 1
-+ * tpg_id[0] : msb
-+ * tpg_id[1] : lsb
-+ */
-+
-+ /* list of mp_ports */
-+ mp_port_t *ports_list[MAX_TPG_PORTS];
-+ uint8_t tpg_id[2];
-+ uint8_t asym_acc_state; /* asymmetric access state */
-+#define TPG_ACT_OPT 0
-+#define TPG_ACT_NON_OPT 1
-+#define TPG_STANDBY 2
-+#define TPG_UNAVAIL 3
-+#define TPG_ILLEGAL f
-+}
-+mp_tport_grp_t;
-+
-+
-+/*
-+ * Per-device multipath control data.
-+ */
-+typedef struct _mp_device {
-+ mp_path_list_t *path_list; /* Path list for device. */
-+ int dev_id;
-+ int use_cnt; /* number of users */
-+ int lbtype;
-+ struct _mp_device *mpdev;
-+ struct _mp_lun *luns; /* list of luns */
-+ uint8_t nodename[WWN_SIZE]; /* World-wide node name for device. */
-+
-+ /* World-wide node names. */
-+ uint8_t nodenames[MAX_PATHS_PER_DEVICE][WWN_SIZE];
-+ /* World-wide port names. */
-+ uint8_t portnames[MAX_PATHS_PER_DEVICE][WWN_SIZE];
-+}
-+mp_device_t;
-+
-+/*
-+ * Per-adapter multipath Host
-+ */
-+typedef struct _mp_host {
-+ struct _mp_host *next; /* ptr to next host adapter in list */
-+ scsi_qla_host_t *ha; /* ptr to lower-level driver adapter struct */
-+ int instance; /* OS instance number */
-+ struct list_head *fcports; /* Port chain for this adapter */
-+ mp_device_t *mp_devs[MAX_MP_DEVICES]; /* Multipath devices */
-+
-+ uint32_t flags;
-+#define MP_HOST_FLAG_NEEDS_UPDATE BIT_0 /* Need to update device data. */
-+#define MP_HOST_FLAG_FO_ENABLED BIT_1 /* Failover enabled for this host */
-+#define MP_HOST_FLAG_DISABLE BIT_2 /* Bypass qla_cfg. */
-+#define MP_HOST_FLAG_LUN_FO_ENABLED BIT_3 /* lun Failover enabled */
-+
-+ uint8_t nodename[WWN_SIZE];
-+ uint8_t portname[WWN_SIZE];
-+ uint16_t MaxLunsPerTarget;
-+
-+ uint16_t relogin_countdown;
-+}
-+mp_host_t;
-+
-+/*
-+ * Describes path a single.
-+ */
-+typedef struct _mp_path {
-+ struct _mp_path *next; /* next path in list */
-+ struct _mp_host *host; /* Pointer to adapter */
-+ fc_port_t *port; /* FC port info */
-+ uint16_t id; /* Path id (index) */
-+ uint16_t flags;
-+ uint8_t mp_byte; /* Multipath control byte */
-+#define MP_MASK_HIDDEN 0x80
-+#define MP_MASK_UNCONFIGURED 0x40
-+#define MP_MASK_OVERRIDE 0x10 /* MC_MASK_SEPARATE_TARGETS */
-+#define MP_MASK_PRIORITY 0x07
-+
-+ uint8_t relogin; /* Need to relogin to port */
-+ uint8_t config; /* User configured path */
-+ uint8_t reserved[3];
-+ mp_lun_data_t lun_data; /* Lun data information */
-+ uint8_t portname[WWN_SIZE]; /* Port name of this target. */
-+}
-+mp_path_t;
-+
-+/*
-+ * Failover notification requests from host driver.
-+ */
-+typedef struct failover_notify_entry {
-+ struct scsi_address *os_addr;
-+}
-+failover_notify_t;
-+
-+struct osl_fo_info {
-+ uint8_t path_cnt;
-+ uint32_t fo_retry_cnt[MAX_PATHS_PER_DEVICE];
-+};
-+
-+#endif /* _QLA_CFG_H */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_cfgln.c ./drivers/scsi/qla2xxx/qla_cfgln.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_cfgln.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_cfgln.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,578 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/*
-+ * QLogic ISP2x00 Multi-path LUN Support Driver
-+ * Linux specific functions
-+ *
-+ */
-+
-+#include "qla_def.h"
-+#include "qla_foln.h"
-+
-+#define MAX_SEARCH_STR_SIZE 512
-+
-+/*
-+ * qla2x00_set_lun_data_from_config
-+ * Set lun_data byte from the configuration parameters.
-+ *
-+ * Input:
-+ * host -- pointer to host adapter structure.
-+ * port -- pointer to port
-+ * tgt -- target number
-+ * dev_no -- device number
-+ */
-+void
-+qla2x00_set_lun_data_from_config(mp_host_t *host, fc_port_t *port,
-+ uint16_t tgt, uint16_t dev_no)
-+{
-+ char *propbuf; /* As big as largest search string */
-+ int rval;
-+ int16_t lun, l;
-+ scsi_qla_host_t *ha = host->ha;
-+ mp_device_t *dp;
-+ lun_bit_mask_t *plun_mask;
-+ lun_bit_mask_t *mask_ptr;
-+ mp_path_list_t *pathlist;
-+
-+ mp_path_t *path;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&propbuf,
-+ MAX_SEARCH_STR_SIZE)) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "propbuf requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ MAX_SEARCH_STR_SIZE));
-+ return;
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&plun_mask,
-+ sizeof(lun_bit_mask_t))) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "lun_mask requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(lun_bit_mask_t)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+ mask_ptr = plun_mask;
-+
-+ dp = host->mp_devs[tgt];
-+ if (dp == NULL) {
-+ printk("qla2x00_set_lun_data_from_config: Target %d "
-+ "not found for hba %d\n",tgt, host->instance);
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+ if ( (pathlist = dp->path_list) == NULL ) {
-+ printk("qla2x00_set_lun_data_from_config: path list "
-+ "not found for target %d\n", tgt);
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ if ((path = qla2x00_find_path_by_name(host, pathlist,
-+ port->port_name)) == NULL ) {
-+ printk("qla2x00_set_lun_data_from_config: No path found "
-+ "for target %d\n", tgt);
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ /* Get "target-N-device-N-preferred" as a 256 bit lun_mask*/
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-preferred", ha->instance,
-+ tgt, dev_no);
-+ DEBUG3(printk("build_tree: %s\n",propbuf));
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)(plun_mask), sizeof(lun_bit_mask_t));
-+
-+ if (rval == -1) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(%ld): no preferred mask entry found for "
-+ "path id %d on port %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+ } else {
-+ if (rval != sizeof(lun_bit_mask_t)) {
-+ /* EMPTY */
-+ printk("qla2x00_set_lun_data_from_config: "
-+ "Preferred mask len %d is incorrect.\n", rval);
-+ }
-+
-+ DEBUG3(printk("%s(%ld): reading Preferred Mask for path id %d "
-+ "on port %02x%02x%02x%02x%02x%02x%02x%02x:\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+ DEBUG3(qla2x00_dump_buffer((char *)plun_mask,
-+ sizeof(lun_bit_mask_t)));
-+
-+ for (lun = MAX_LUNS-1, l =0; lun >= 0; lun--, l++ ) {
-+ if (EXT_IS_LUN_BIT_SET(mask_ptr, lun)) {
-+ path->lun_data.data[l] |=
-+ LUN_DATA_PREFERRED_PATH;
-+ pathlist->current_path[l] = path->id;
-+ } else {
-+ path->lun_data.data[l] &=
-+ ~LUN_DATA_PREFERRED_PATH;
-+ }
-+ }
-+
-+ }
-+
-+ /* Get "target-N-device-N-lun-disable" as a 256 bit lun_mask*/
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-lun-disabled", ha->instance,
-+ tgt, dev_no);
-+ DEBUG3(printk("build_tree: %s\n",propbuf));
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)plun_mask, sizeof(lun_bit_mask_t));
-+ if (rval == -1) {
-+ /* default: all luns enabled */
-+ DEBUG3(printk("%s(%ld): no entry found for path id %d. "
-+ "Assume all LUNs enabled on port %02x%02x%02x%02x%02x%"
-+ "02x%02x%02x.\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ path->lun_data.data[lun] |= LUN_DATA_ENABLED;
-+ }
-+ } else {
-+ if (rval != sizeof(lun_bit_mask_t)) {
-+ printk("qla2x00_set_lun_data_from_config: Enable "
-+ "mask has wrong size %d != %ld\n",
-+ rval, (ulong)sizeof(lun_bit_mask_t));
-+ } else {
-+ for (lun = MAX_LUNS-1, l =0; lun >= 0; lun--, l++) {
-+ /* our bit mask is inverted */
-+ if (!EXT_IS_LUN_BIT_SET(mask_ptr,lun))
-+ path->lun_data.data[l] |=
-+ LUN_DATA_ENABLED;
-+ else
-+ path->lun_data.data[l] &=
-+ ~LUN_DATA_ENABLED;
-+ }
-+ DEBUG3(printk("%s(%ld): got lun mask for path id %d "
-+ "port %02x%02x%02x%02x%02x%02x%02x%02x:\n",
-+ __func__, ha->host_no, path->id,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+ DEBUG3(qla2x00_dump_buffer(
-+ (uint8_t *)&path->lun_data.data[0], 64));
-+ }
-+ }
-+
-+ DEBUG3(printk("qla2x00_set_lun_data_from_config: Luns data for "
-+ "device %p, instance %d, path id=%d\n",
-+ dp,host->instance,path->id));
-+ DEBUG3(qla2x00_dump_buffer((char *)&path->lun_data.data[0], 64));
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ LEAVE("qla2x00_set_lun_data_from_config");
-+}
-+
-+
-+
-+/*
-+ * qla2x00_cfg_build_path_tree
-+ * Find all path properties and build a path tree. The
-+ * resulting tree has no actual port assigned to it
-+ * until the port discovery is done by the lower level.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla2x00_cfg_build_path_tree(scsi_qla_host_t *ha)
-+{
-+ char *propbuf;
-+ uint8_t node_name[WWN_SIZE];
-+ uint8_t port_name[WWN_SIZE];
-+ fc_port_t *port;
-+ uint16_t dev_no = 0, tgt;
-+ int instance, rval;
-+ mp_host_t *host = NULL;
-+ int done;
-+ uint8_t control_byte;
-+
-+
-+ ENTER("qla2x00_cfg_build_path_tree");
-+
-+ printk(KERN_INFO
-+ "qla02%d: ConfigRequired is set. \n", (int)ha->instance);
-+ DEBUG(printk("qla2x00_cfg_build_path_tree: hba =%ld\n",
-+ ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&propbuf,
-+ MAX_SEARCH_STR_SIZE)) {
-+ /* not enough memory */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "propbuf requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ MAX_SEARCH_STR_SIZE));
-+ return;
-+ }
-+
-+ /* Look for adapter nodename in properties */
-+ sprintf(propbuf, "scsi-qla%ld-adapter-port", ha->instance);
-+ DEBUG(printk("build_tree: %s\n",propbuf));
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf, port_name, WWN_SIZE);
-+ if (rval != WWN_SIZE) {
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ /* Does nodename match the host adapter nodename? */
-+ if (!qla2x00_is_nodename_equal(ha->port_name, port_name)) {
-+ printk(KERN_INFO
-+ "scsi(%d): Adapter nodenames don't match - ha = %p.\n",
-+ (int)ha->instance,ha);
-+ DEBUG(printk("qla(%d): Adapter nodenames don't match - "
-+ "ha=%p. port name=%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ (int)ha->instance,ha, ha->port_name[0], ha->port_name[1],
-+ ha->port_name[2], ha->port_name[3], ha->port_name[4],
-+ ha->port_name[5], ha->port_name[6], ha->port_name[7]));
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+
-+ DEBUG(printk("%s: found entry for adapter port %02x%02x%02x%02x"
-+ "%02x%02x%02x%02x.\n",
-+ __func__,
-+ port_name[0], port_name[1], port_name[2],
-+ port_name[3], port_name[4], port_name[5],
-+ port_name[6], port_name[7]));
-+
-+ instance = ha->instance;
-+ if ((host = qla2x00_alloc_host(ha)) == NULL) {
-+ printk(KERN_INFO
-+ "scsi(%d): Couldn't allocate host - ha = %p.\n",
-+ (int)instance,ha);
-+ } else {
-+ /* create a dummy port */
-+ port = kmalloc(sizeof(fc_port_t), GFP_KERNEL);
-+ if (port == NULL) {
-+ printk(KERN_INFO
-+ "scsi(%d): Couldn't allocate port.\n",
-+ (int)instance);
-+ DEBUG(printk("qla(%d): Couldn't allocate port.\n",
-+ (int)host->instance));
-+ /* remove host */
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return;
-+ }
-+ /* Setup fcport template structure. */
-+ memset(port, 0, sizeof (fc_port_t));
-+ port->port_type = FCT_UNKNOWN;
-+ port->loop_id = FC_NO_LOOP_ID;
-+ port->iodesc_idx_sent = IODESC_INVALID_INDEX;
-+ atomic_set(&port->state, FCS_UNCONFIGURED);
-+ port->flags = FC_RLC_SUPPORT;
-+ INIT_LIST_HEAD(&port->fcluns);
-+
-+ done = 0;
-+
-+ /* For each target on the host bus adapter */
-+ for (tgt = 0; tgt < MAX_MP_DEVICES &&
-+ !done; tgt++) {
-+
-+ /* get all paths for this target */
-+ for (dev_no = 0; dev_no < MAX_PATHS_PER_DEVICE &&
-+ !done ; dev_no++) {
-+
-+ /*
-+ * O(N*M) scan, should ideally check if there
-+ * are any tgt entries present, if not, then
-+ * continue.
-+ *
-+ * sprintf(propbuf,
-+ * "scsi-qla%d-tgt-%d-",
-+ * instance, tgt);
-+ * if (strstr(ha->cmdline, propbuf) == NULL)
-+ * continue;
-+ *
-+ */
-+ memset(port, 0, sizeof (fc_port_t));
-+
-+ /*
-+ * Get "target-N-device-N-node" is a 16-chars
-+ * number
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-node",
-+ ha->instance, tgt, dev_no);
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ node_name, WWN_SIZE);
-+ if (rval != WWN_SIZE)
-+ /* di values may not be contiguous for
-+ * override case.
-+ */
-+ continue;
-+
-+ DEBUG(printk("build_tree: %s\n",propbuf));
-+ memcpy(port->node_name, node_name, WWN_SIZE);
-+
-+ /*
-+ * Get "target-N-device-N-port" is a 16-chars
-+ * number
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-port",
-+ ha->instance, tgt, dev_no);
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ port_name, WWN_SIZE);
-+ if (rval != WWN_SIZE)
-+ continue;
-+
-+ DEBUG(printk("build_tree: %s\n",propbuf));
-+ memcpy(port->node_name, node_name, WWN_SIZE);
-+ memcpy(port->port_name, port_name, WWN_SIZE);
-+ port->flags |= FC_CONFIG;
-+
-+ /*
-+ * Get "target-N-device-N-control" if property
-+ * is present then all luns are visible.
-+ */
-+ sprintf(propbuf,
-+ "scsi-qla%ld-tgt-%d-di-%d-control",
-+ ha->instance, tgt, dev_no);
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)(&control_byte),
-+ sizeof(control_byte));
-+ if (rval == -1) {
-+ /* error getting string. go to next. */
-+ DEBUG2(printk(
-+ "%s: string parsing failed.\n",
-+ __func__));
-+ continue;
-+ }
-+
-+ DEBUG3(printk("build_tree: %s\n",propbuf));
-+
-+ DEBUG(printk("build_tree: control byte 0x%x\n",
-+ control_byte));
-+
-+ port->mp_byte = control_byte;
-+ DEBUG(printk("%s(%ld): calling update_mp_device"
-+ " for host %p port %p-%02x%02x%02x%02x%02x"
-+ "%02x%02x%02x tgt=%d mpbyte=%02x.\n",
-+ __func__, ha->host_no, host, port,
-+ port->port_name[0], port->port_name[1],
-+ port->port_name[2], port->port_name[3],
-+ port->port_name[4], port->port_name[5],
-+ port->port_name[6], port->port_name[7],
-+ tgt, port->mp_byte));
-+
-+ qla2x00_update_mp_device(host, port, tgt,
-+ dev_no);
-+
-+ /* free any mplun info */
-+
-+ qla2x00_set_lun_data_from_config(host,
-+ port, tgt, dev_no);
-+ }
-+ }
-+ kfree(port);
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ LEAVE("qla2x00_cfg_build_path_tree");
-+ DEBUG(printk("Leaving: qla2x00_cfg_build_path_tree\n"));
-+}
-+
-+/*
-+ * qla2x00_cfg_display_devices
-+ * This routine will the node names of the different devices found
-+ * after port inquiry.
-+ *
-+ * Input:
-+ *
-+ * Returns:
-+ * None.
-+ */
-+void
-+qla2x00_cfg_display_devices(int flag)
-+{
-+ mp_host_t *host;
-+ int id;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+ mp_path_list_t *path_list;
-+ int cnt, i, dev_no;
-+ int instance;
-+ lun_bit_mask_t lun_mask;
-+ int mask_set;
-+ uint8_t l;
-+ mp_lun_t *lun;
-+ unsigned char tmp_buf[32];
-+
-+ for (host = mp_hosts_base; (host); host = host->next) {
-+
-+ instance = (int) host->instance;
-+ /* Display the node name for adapter */
-+ printk(KERN_INFO
-+ "scsi-qla%d-adapter-port="
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\\;\n",
-+ instance,
-+ host->portname[0],
-+ host->portname[1],
-+ host->portname[2],
-+ host->portname[3],
-+ host->portname[4],
-+ host->portname[5],
-+ host->portname[6],
-+ host->portname[7]);
-+
-+ for (id = 0; id < MAX_MP_DEVICES; id++) {
-+ if( (dp = host->mp_devs[id] ) == NULL )
-+ continue;
-+
-+ path_list = dp->path_list;
-+
-+
-+ if( (path = path_list->last) != NULL ) {
-+ /* Print out device port names */
-+ path = path->next; /* first path */
-+ for (dev_no = 0, cnt = 0;
-+ cnt < path_list->path_cnt;
-+ path = path->next, cnt++) {
-+
-+ /* skip others if not our host */
-+ if (host != path->host)
-+ continue;
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-node="
-+ "%02x%02x%02x%02x"
-+ "%02x%02x%02x%02x\\;\n",
-+ instance, id, path->id,
-+ dp->nodename[0],
-+ dp->nodename[1],
-+ dp->nodename[2],
-+ dp->nodename[3],
-+ dp->nodename[4],
-+ dp->nodename[5],
-+ dp->nodename[6],
-+ dp->nodename[7]);
-+
-+ /* port_name */
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-port="
-+ "%02x%02x%02x%02x"
-+ "%02x%02x%02x%02x\\;\n",
-+ instance, id, path->id,
-+ path->portname[0],
-+ path->portname[1],
-+ path->portname[2],
-+ path->portname[3],
-+ path->portname[4],
-+ path->portname[5],
-+ path->portname[6],
-+ path->portname[7]);
-+
-+ /* control byte */
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-"
-+ "control=%02x\\;\n",
-+ instance, id, path->id,
-+ path->mp_byte);
-+
-+ /*
-+ * Build preferred bit mask for this
-+ * path */
-+ memset(&lun_mask, 0, sizeof(lun_mask));
-+ mask_set = 0;
-+ for (i = 0; i < MAX_LUNS; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ if (path_list->current_path[l] == path->id ) {
-+ EXT_SET_LUN_BIT((&lun_mask),l);
-+ mask_set++;
-+ }
-+ }
-+ if (mask_set) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-preferred=%08x%08x%08x%08x%08x%08x%08x%08x\\;\n",
-+ instance, id, path->id,
-+ *((uint32_t *) &lun_mask.mask[28]),
-+ *((uint32_t *) &lun_mask.mask[24]),
-+ *((uint32_t *) &lun_mask.mask[20]),
-+ *((uint32_t *) &lun_mask.mask[16]),
-+ *((uint32_t *) &lun_mask.mask[12]),
-+ *((uint32_t *) &lun_mask.mask[8]),
-+ *((uint32_t *) &lun_mask.mask[4]),
-+ *((uint32_t *) &lun_mask.mask[0]) );
-+ }
-+ /*
-+ * Build disable bit mask for this path
-+ */
-+ mask_set = 0;
-+ for (i = 0; i < MAX_LUNS; i++) {
-+ l = (uint8_t)(i & 0xFF);
-+ if (!(path->lun_data.data[l] &
-+ LUN_DATA_ENABLED) ) {
-+
-+ mask_set++;
-+ }
-+ }
-+ if (mask_set) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-lun-disable=%08x%08x%08x%08x%08x%08x%08x%08x\\;\n",
-+ instance, id, path->id,
-+ *((uint32_t *) &lun_mask.mask[28]),
-+ *((uint32_t *) &lun_mask.mask[24]),
-+ *((uint32_t *) &lun_mask.mask[20]),
-+ *((uint32_t *) &lun_mask.mask[16]),
-+ *((uint32_t *) &lun_mask.mask[12]),
-+ *((uint32_t *) &lun_mask.mask[8]),
-+ *((uint32_t *) &lun_mask.mask[4]),
-+ *((uint32_t *) &lun_mask.mask[0]) );
-+ }
-+ /* display lun wwuln */
-+ if( flag )
-+ for (lun = dp->luns; lun != NULL ; lun = lun->next) {
-+ printk(KERN_INFO
-+ "scsi-qla%d-tgt-%d-di-%d-lun-%d-lunid=",
-+ instance, id, path->id, lun->number);
-+ for (i = 0 ; i < lun->siz ;
-+ i++) {
-+ sprintf(tmp_buf+i,
-+ "%02x",
-+ lun->wwuln[i]);
-+ }
-+ printk(KERN_INFO "%s:%02d;\n",
-+ tmp_buf,lun->siz);
-+ }
-+ dev_no++;
-+ }
-+
-+ }
-+ }
-+ }
-+}
-+
-+
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_dbg.c ./drivers/scsi/qla2xxx/qla_dbg.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_dbg.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_dbg.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,26 +1,41 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
- #include <linux/delay.h>
-
--static int qla_uprintf(char **, char *, ...);
-+static inline void
-+qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump)
-+{
-+ fw_dump->fw_major_version = htonl(ha->fw_major_version);
-+ fw_dump->fw_minor_version = htonl(ha->fw_minor_version);
-+ fw_dump->fw_subminor_version = htonl(ha->fw_subminor_version);
-+ fw_dump->fw_attributes = htonl(ha->fw_attributes);
-+
-+ fw_dump->vendor = htonl(ha->pdev->vendor);
-+ fw_dump->device = htonl(ha->pdev->device);
-+ fw_dump->subsystem_vendor = htonl(ha->pdev->subsystem_vendor);
-+ fw_dump->subsystem_device = htonl(ha->pdev->subsystem_device);
-+}
-+
-+static inline void *
-+qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr)
-+{
-+ /* Request queue. */
-+ memcpy(ptr, ha->request_ring, ha->request_q_length *
-+ sizeof(request_t));
-+
-+ /* Response queue. */
-+ ptr += ha->request_q_length * sizeof(request_t);
-+ memcpy(ptr, ha->response_ring, ha->response_q_length *
-+ sizeof(response_t));
-+
-+ return ptr + (ha->response_q_length * sizeof(response_t));
-+}
-
- /**
- * qla2300_fw_dump() - Dumps binary data from the 2300 firmware.
-@@ -40,7 +55,8 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
- uint16_t __iomem *dmp_reg;
- unsigned long flags;
- struct qla2300_fw_dump *fw;
-- uint32_t dump_size, data_ram_cnt;
-+ uint32_t data_ram_cnt;
-+ uint16_t wd;
-
- risc_address = data_ram_cnt = 0;
- mb0 = mb2 = 0;
-@@ -49,32 +65,26 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
- if (!hardware_locked)
- spin_lock_irqsave(&ha->hardware_lock, flags);
-
-- if (ha->fw_dump != NULL) {
-+ if (!ha->fw_dump) {
- qla_printk(KERN_WARNING, ha,
-- "Firmware has been previously dumped (%p) -- ignoring "
-- "request...\n", ha->fw_dump);
-+ "No buffer available for dump!!!\n");
- goto qla2300_fw_dump_failed;
- }
-
-- /* Allocate (large) dump buffer. */
-- dump_size = sizeof(struct qla2300_fw_dump);
-- dump_size += (ha->fw_memory_size - 0x11000) * sizeof(uint16_t);
-- ha->fw_dump_order = get_order(dump_size);
-- ha->fw_dump = (struct qla2300_fw_dump *) __get_free_pages(GFP_ATOMIC,
-- ha->fw_dump_order);
-- if (ha->fw_dump == NULL) {
-+ if (ha->fw_dumped) {
- qla_printk(KERN_WARNING, ha,
-- "Unable to allocated memory for firmware dump (%d/%d).\n",
-- ha->fw_dump_order, dump_size);
-+ "Firmware has been previously dumped (%p) -- ignoring "
-+ "request...\n", ha->fw_dump);
- goto qla2300_fw_dump_failed;
- }
-- fw = ha->fw_dump;
-+ fw = &ha->fw_dump->isp.isp23;
-+ qla2xxx_prep_dump(ha, ha->fw_dump);
-
- rval = QLA_SUCCESS;
-- fw->hccr = RD_REG_WORD(&reg->hccr);
-+ fw->hccr = htons(RD_REG_WORD(&reg->hccr));
-
- /* Pause RISC. */
-- WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-+ WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
- if (IS_QLA2300(ha)) {
- for (cnt = 30000;
- (RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0 &&
-@@ -91,100 +101,96 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
-
- if (rval == QLA_SUCCESS) {
- dmp_reg = (uint16_t __iomem *)(reg + 0);
-- for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-- fw->pbiu_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-+ fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10);
-- for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
-- fw->risc_host_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
-+ fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x40);
-- for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
-- fw->mailbox_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
-+ fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- WRT_REG_WORD(&reg->ctrl_status, 0x40);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->resp_dma_reg) / 2; cnt++)
-- fw->resp_dma_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->resp_dma_reg) / 2; cnt++)
-+ fw->resp_dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- WRT_REG_WORD(&reg->ctrl_status, 0x50);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
-- fw->dma_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
-+ fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- WRT_REG_WORD(&reg->ctrl_status, 0x00);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0);
-- for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-- fw->risc_hdw_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-+ fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2000);
-+ WRT_REG_WORD(&reg->pcr, 0x2000);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
-- fw->risc_gp0_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
-+ fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2200);
-+ WRT_REG_WORD(&reg->pcr, 0x2200);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
-- fw->risc_gp1_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
-+ fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2400);
-+ WRT_REG_WORD(&reg->pcr, 0x2400);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
-- fw->risc_gp2_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
-+ fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2600);
-+ WRT_REG_WORD(&reg->pcr, 0x2600);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
-- fw->risc_gp3_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
-+ fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2800);
-+ WRT_REG_WORD(&reg->pcr, 0x2800);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
-- fw->risc_gp4_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
-+ fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2A00);
-+ WRT_REG_WORD(&reg->pcr, 0x2A00);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
-- fw->risc_gp5_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
-+ fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2C00);
-+ WRT_REG_WORD(&reg->pcr, 0x2C00);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
-- fw->risc_gp6_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
-+ fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2E00);
-+ WRT_REG_WORD(&reg->pcr, 0x2E00);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
-- fw->risc_gp7_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
-+ fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x10);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x10);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
-- fw->frame_buf_hdw_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
-+ fw->frame_buf_hdw_reg[cnt] =
-+ htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x20);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x20);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
-- fw->fpm_b0_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
-+ fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x30);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x30);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
-- fw->fpm_b1_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
-+ fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- /* Reset RISC. */
- WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-- /*
-- * We need to have a delay here since the card will not respond
-- * while in reset causing an MCA on some architectures.
-- */
-- udelay(20);
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
- for (cnt = 0; cnt < 30000; cnt++) {
-+ udelay(10);
- if ((RD_REG_WORD(&reg->ctrl_status) &
- CSR_ISP_SOFT_RESET) == 0)
- break;
--
-- udelay(10);
- }
- }
-
-@@ -250,7 +256,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb0 & MBS_MASK;
-- fw->risc_ram[cnt] = mb2;
-+ fw->risc_ram[cnt] = htons(mb2);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
-@@ -309,7 +315,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb0 & MBS_MASK;
-- fw->stack_ram[cnt] = mb2;
-+ fw->stack_ram[cnt] = htons(mb2);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
-@@ -369,23 +375,25 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb0 & MBS_MASK;
-- fw->data_ram[cnt] = mb2;
-+ fw->data_ram[cnt] = htons(mb2);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
- }
-
-+ if (rval == QLA_SUCCESS)
-+ qla2xxx_copy_queues(ha, &fw->data_ram[cnt]);
-
- if (rval != QLA_SUCCESS) {
- qla_printk(KERN_WARNING, ha,
- "Failed to dump firmware (%x)!!!\n", rval);
-+ ha->fw_dumped = 0;
-
-- free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
-- ha->fw_dump = NULL;
- } else {
- qla_printk(KERN_INFO, ha,
- "Firmware dump saved to temp buffer (%ld/%p).\n",
- ha->host_no, ha->fw_dump);
-+ ha->fw_dumped = 1;
- }
-
- qla2300_fw_dump_failed:
-@@ -394,193 +402,6 @@ qla2300_fw_dump_failed:
- }
-
- /**
-- * qla2300_ascii_fw_dump() - Converts a binary firmware dump to ASCII.
-- * @ha: HA context
-- */
--void
--qla2300_ascii_fw_dump(scsi_qla_host_t *ha)
--{
-- uint32_t cnt;
-- char *uiter;
-- char fw_info[30];
-- struct qla2300_fw_dump *fw;
-- uint32_t data_ram_cnt;
--
-- uiter = ha->fw_dump_buffer;
-- fw = ha->fw_dump;
--
-- qla_uprintf(&uiter, "%s Firmware Version %s\n", ha->model_number,
-- qla2x00_get_fw_version_str(ha, fw_info));
--
-- qla_uprintf(&uiter, "\n[==>BEG]\n");
--
-- qla_uprintf(&uiter, "HCCR Register:\n%04x\n\n", fw->hccr);
--
-- qla_uprintf(&uiter, "PBIU Registers:");
-- for (cnt = 0; cnt < sizeof (fw->pbiu_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->pbiu_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nReqQ-RspQ-Risc2Host Status registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_host_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_host_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nMailbox Registers:");
-- for (cnt = 0; cnt < sizeof (fw->mailbox_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->mailbox_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nAuto Request Response DMA Registers:");
-- for (cnt = 0; cnt < sizeof (fw->resp_dma_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->resp_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nDMA Registers:");
-- for (cnt = 0; cnt < sizeof (fw->dma_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC Hardware Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_hdw_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP0 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp0_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP1 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp1_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP2 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp2_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp2_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP3 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp3_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp3_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP4 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp4_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp4_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP5 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp5_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp5_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP6 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp6_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp6_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP7 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp7_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp7_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFrame Buffer Hardware Registers:");
-- for (cnt = 0; cnt < sizeof (fw->frame_buf_hdw_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->frame_buf_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM B0 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->fpm_b0_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->fpm_b0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM B1 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->fpm_b1_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->fpm_b1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nCode RAM Dump:");
-- for (cnt = 0; cnt < sizeof (fw->risc_ram) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%04x: ", cnt + 0x0800);
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nStack RAM Dump:");
-- for (cnt = 0; cnt < sizeof (fw->stack_ram) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%05x: ", cnt + 0x10000);
-- }
-- qla_uprintf(&uiter, "%04x ", fw->stack_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nData RAM Dump:");
-- data_ram_cnt = ha->fw_memory_size - 0x11000 + 1;
-- for (cnt = 0; cnt < data_ram_cnt; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%05x: ", cnt + 0x11000);
-- }
-- qla_uprintf(&uiter, "%04x ", fw->data_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\n[<==END] ISP Debug Dump.");
--}
--
--/**
- * qla2100_fw_dump() - Dumps binary data from the 2100/2200 firmware.
- * @ha: HA context
- * @hardware_locked: Called with the hardware_lock
-@@ -596,6 +417,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int
- uint16_t __iomem *dmp_reg;
- unsigned long flags;
- struct qla2100_fw_dump *fw;
-+ uint16_t wd;
-
- risc_address = 0;
- mb0 = mb2 = 0;
-@@ -604,30 +426,26 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int
- if (!hardware_locked)
- spin_lock_irqsave(&ha->hardware_lock, flags);
-
-- if (ha->fw_dump != NULL) {
-+ if (!ha->fw_dump) {
- qla_printk(KERN_WARNING, ha,
-- "Firmware has been previously dumped (%p) -- ignoring "
-- "request...\n", ha->fw_dump);
-+ "No buffer available for dump!!!\n");
- goto qla2100_fw_dump_failed;
- }
-
-- /* Allocate (large) dump buffer. */
-- ha->fw_dump_order = get_order(sizeof(struct qla2100_fw_dump));
-- ha->fw_dump = (struct qla2100_fw_dump *) __get_free_pages(GFP_ATOMIC,
-- ha->fw_dump_order);
-- if (ha->fw_dump == NULL) {
-+ if (ha->fw_dumped) {
- qla_printk(KERN_WARNING, ha,
-- "Unable to allocated memory for firmware dump (%d/%Zd).\n",
-- ha->fw_dump_order, sizeof(struct qla2100_fw_dump));
-+ "Firmware has been previously dumped (%p) -- ignoring "
-+ "request...\n", ha->fw_dump);
- goto qla2100_fw_dump_failed;
- }
-- fw = ha->fw_dump;
-+ fw = &ha->fw_dump->isp.isp21;
-+ qla2xxx_prep_dump(ha, ha->fw_dump);
-
- rval = QLA_SUCCESS;
-- fw->hccr = RD_REG_WORD(&reg->hccr);
-+ fw->hccr = htons(RD_REG_WORD(&reg->hccr));
-
- /* Pause RISC. */
-- WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-+ WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
- for (cnt = 30000; (RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0 &&
- rval == QLA_SUCCESS; cnt--) {
- if (cnt)
-@@ -637,88 +455,86 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int
- }
- if (rval == QLA_SUCCESS) {
- dmp_reg = (uint16_t __iomem *)(reg + 0);
-- for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-- fw->pbiu_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-+ fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10);
- for (cnt = 0; cnt < ha->mbx_count; cnt++) {
- if (cnt == 8) {
-- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xe0);
-+ dmp_reg = (uint16_t __iomem *)
-+ ((uint8_t __iomem *)reg + 0xe0);
- }
-- fw->mailbox_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
- }
-
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x20);
-- for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
-- fw->dma_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
-+ fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- WRT_REG_WORD(&reg->ctrl_status, 0x00);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0);
-- for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-- fw->risc_hdw_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-+ fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2000);
-+ WRT_REG_WORD(&reg->pcr, 0x2000);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
-- fw->risc_gp0_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
-+ fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2100);
-+ WRT_REG_WORD(&reg->pcr, 0x2100);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
-- fw->risc_gp1_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
-+ fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2200);
-+ WRT_REG_WORD(&reg->pcr, 0x2200);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
-- fw->risc_gp2_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
-+ fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2300);
-+ WRT_REG_WORD(&reg->pcr, 0x2300);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
-- fw->risc_gp3_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
-+ fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2400);
-+ WRT_REG_WORD(&reg->pcr, 0x2400);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
-- fw->risc_gp4_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
-+ fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2500);
-+ WRT_REG_WORD(&reg->pcr, 0x2500);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
-- fw->risc_gp5_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
-+ fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2600);
-+ WRT_REG_WORD(&reg->pcr, 0x2600);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
-- fw->risc_gp6_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
-+ fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->pcr, 0x2700);
-+ WRT_REG_WORD(&reg->pcr, 0x2700);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
-- fw->risc_gp7_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
-+ fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x10);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x10);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
-- fw->frame_buf_hdw_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
-+ fw->frame_buf_hdw_reg[cnt] =
-+ htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x20);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x20);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
-- fw->fpm_b0_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
-+ fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
-- WRT_REG_WORD(&reg->ctrl_status, 0x30);
-+ WRT_REG_WORD(&reg->ctrl_status, 0x30);
- dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
-- for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
-- fw->fpm_b1_reg[cnt] = RD_REG_WORD(dmp_reg++);
-+ for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
-+ fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
-
- /* Reset the ISP. */
- WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-- /*
-- * We need to have a delay here since the card will not respond
-- * while in reset causing an MCA on some architectures.
-- */
-- udelay(20);
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
- }
-
- for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 &&
-@@ -733,7 +549,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int
- if (rval == QLA_SUCCESS && (IS_QLA2200(ha) || (IS_QLA2100(ha) &&
- (RD_REG_WORD(&reg->mctr) & (BIT_1 | BIT_0)) != 0))) {
-
-- WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-+ WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
- for (cnt = 30000;
- (RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0 &&
- rval == QLA_SUCCESS; cnt--) {
-@@ -791,22 +607,25 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb0 & MBS_MASK;
-- fw->risc_ram[cnt] = mb2;
-+ fw->risc_ram[cnt] = htons(mb2);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
- }
-
-+ if (rval == QLA_SUCCESS)
-+ qla2xxx_copy_queues(ha, &fw->risc_ram[cnt]);
-+
- if (rval != QLA_SUCCESS) {
- qla_printk(KERN_WARNING, ha,
- "Failed to dump firmware (%x)!!!\n", rval);
-+ ha->fw_dumped = 0;
-
-- free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
-- ha->fw_dump = NULL;
- } else {
- qla_printk(KERN_INFO, ha,
- "Firmware dump saved to temp buffer (%ld/%p).\n",
- ha->host_no, ha->fw_dump);
-+ ha->fw_dumped = 1;
- }
-
- qla2100_fw_dump_failed:
-@@ -814,198 +633,25 @@ qla2100_fw_dump_failed:
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
- }
-
--/**
-- * qla2100_ascii_fw_dump() - Converts a binary firmware dump to ASCII.
-- * @ha: HA context
-- */
--void
--qla2100_ascii_fw_dump(scsi_qla_host_t *ha)
--{
-- uint32_t cnt;
-- char *uiter;
-- char fw_info[30];
-- struct qla2100_fw_dump *fw;
--
-- uiter = ha->fw_dump_buffer;
-- fw = ha->fw_dump;
--
-- qla_uprintf(&uiter, "%s Firmware Version %s\n", ha->model_number,
-- qla2x00_get_fw_version_str(ha, fw_info));
--
-- qla_uprintf(&uiter, "\n[==>BEG]\n");
--
-- qla_uprintf(&uiter, "HCCR Register:\n%04x\n\n", fw->hccr);
--
-- qla_uprintf(&uiter, "PBIU Registers:");
-- for (cnt = 0; cnt < sizeof (fw->pbiu_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->pbiu_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nMailbox Registers:");
-- for (cnt = 0; cnt < sizeof (fw->mailbox_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->mailbox_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nDMA Registers:");
-- for (cnt = 0; cnt < sizeof (fw->dma_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC Hardware Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_hdw_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP0 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp0_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP1 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp1_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP2 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp2_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp2_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP3 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp3_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp3_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP4 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp4_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp4_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP5 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp5_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp5_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP6 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp6_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp6_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP7 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->risc_gp7_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_gp7_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFrame Buffer Hardware Registers:");
-- for (cnt = 0; cnt < sizeof (fw->frame_buf_hdw_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->frame_buf_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM B0 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->fpm_b0_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->fpm_b0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM B1 Registers:");
-- for (cnt = 0; cnt < sizeof (fw->fpm_b1_reg) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n");
-- }
-- qla_uprintf(&uiter, "%04x ", fw->fpm_b1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC SRAM:");
-- for (cnt = 0; cnt < sizeof (fw->risc_ram) / 2; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%04x: ", cnt + 0x1000);
-- }
-- qla_uprintf(&uiter, "%04x ", fw->risc_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\n[<==END] ISP Debug Dump.");
--
-- return;
--}
--
--static int
--qla_uprintf(char **uiter, char *fmt, ...)
--{
-- int iter, len;
-- char buf[128];
-- va_list args;
--
-- va_start(args, fmt);
-- len = vsprintf(buf, fmt, args);
-- va_end(args);
--
-- for (iter = 0; iter < len; iter++, *uiter += 1)
-- *uiter[0] = buf[iter];
--
-- return (len);
--}
--
--
- void
- qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
- {
- int rval;
- uint32_t cnt, timer;
- uint32_t risc_address;
-- uint16_t mb[4];
-+ uint16_t mb[4], wd;
-
- uint32_t stat;
-- struct device_reg_24xx __iomem *reg;
-+ struct device_reg_24xx __iomem *reg =
-+ (struct device_reg_24xx __iomem *)ha->iobase;
- uint32_t __iomem *dmp_reg;
- uint32_t *iter_reg;
- uint16_t __iomem *mbx_reg;
- unsigned long flags;
- struct qla24xx_fw_dump *fw;
- uint32_t ext_mem_cnt;
-- uint16_t wd;
-+ void *eft;
-
-- reg = (struct device_reg_24xx __iomem *)ha->iobase;
- risc_address = ext_mem_cnt = 0;
- memset(mb, 0, sizeof(mb));
- flags = 0;
-@@ -1013,7 +659,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
- if (!hardware_locked)
- spin_lock_irqsave(&ha->hardware_lock, flags);
-
-- if (!ha->fw_dump24) {
-+ if (!ha->fw_dump) {
- qla_printk(KERN_WARNING, ha,
- "No buffer available for dump!!!\n");
- goto qla24xx_fw_dump_failed;
-@@ -1022,13 +668,14 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
- if (ha->fw_dumped) {
- qla_printk(KERN_WARNING, ha,
- "Firmware has been previously dumped (%p) -- ignoring "
-- "request...\n", ha->fw_dump24);
-+ "request...\n", ha->fw_dump);
- goto qla24xx_fw_dump_failed;
- }
-- fw = (struct qla24xx_fw_dump *) ha->fw_dump24;
-+ fw = &ha->fw_dump->isp.isp24;
-+ qla2xxx_prep_dump(ha, ha->fw_dump);
-
- rval = QLA_SUCCESS;
-- fw->host_status = RD_REG_DWORD(&reg->host_status);
-+ fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
-
- /* Pause RISC. */
- if ((RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0) {
-@@ -1050,7 +697,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
- /* Host interface registers. */
- dmp_reg = (uint32_t __iomem *)(reg + 0);
- for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++)
-- fw->host_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Disable interrupts. */
- WRT_REG_DWORD(&reg->ictrl, 0);
-@@ -1062,470 +709,471 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0000000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[0] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[0] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0100000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[1] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[1] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0200000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[2] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[2] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0300000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[3] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[3] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0400000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[4] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[4] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0500000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[5] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[5] = htonl(RD_REG_DWORD(dmp_reg));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
- WRT_REG_DWORD(dmp_reg, 0xB0600000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
-- fw->shadow_reg[6] = RD_REG_DWORD(dmp_reg);
-+ fw->shadow_reg[6] = htonl(RD_REG_DWORD(dmp_reg));
-
- /* Mailbox registers. */
- mbx_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
- for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
-- fw->mailbox_reg[cnt] = RD_REG_WORD(mbx_reg++);
-+ fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++));
-
- /* Transfer sequence registers. */
- iter_reg = fw->xseq_gp_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF00);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF10);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF20);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF30);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF40);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF50);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF60);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBF70);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBFE0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++)
-- fw->xseq_0_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->xseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xBFF0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++)
-- fw->xseq_1_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->xseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Receive sequence registers. */
- iter_reg = fw->rseq_gp_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF00);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF10);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF20);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF30);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF40);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF50);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF60);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFF70);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFFD0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++)
-- fw->rseq_0_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->rseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFFE0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++)
-- fw->rseq_1_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->rseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0xFFF0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++)
-- fw->rseq_2_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->rseq_2_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Command DMA registers. */
- WRT_REG_DWORD(&reg->iobase_addr, 0x7100);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++)
-- fw->cmd_dma_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->cmd_dma_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Queues. */
- iter_reg = fw->req0_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7200);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 8; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
- for (cnt = 0; cnt < 7; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->resp0_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7300);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 8; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
- for (cnt = 0; cnt < 7; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->req1_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7400);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 8; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
- for (cnt = 0; cnt < 7; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Transmit DMA registers. */
- iter_reg = fw->xmt0_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7600);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7610);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->xmt1_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7620);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7630);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->xmt2_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7640);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7650);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->xmt3_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7660);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7670);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->xmt4_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7680);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7690);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x76A0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++)
-- fw->xmt_data_dma_reg[cnt] = RD_REG_DWORD(dmp_reg++);
-+ fw->xmt_data_dma_reg[cnt] =
-+ htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Receive DMA registers. */
- iter_reg = fw->rcvt0_data_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7700);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7710);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- iter_reg = fw->rcvt1_data_dma_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x7720);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x7730);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* RISC registers. */
- iter_reg = fw->risc_gp_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F00);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F10);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F20);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F30);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F40);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F50);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F60);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x0F70);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Local memory controller registers. */
- iter_reg = fw->lmc_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x3000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3010);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3020);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3030);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3040);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3050);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x3060);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Fibre Protocol Module registers. */
- iter_reg = fw->fpm_hdw_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x4000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4010);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4020);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4030);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4040);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4050);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4060);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4070);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4080);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x4090);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x40A0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x40B0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Frame Buffer registers. */
- iter_reg = fw->fb_hdw_reg;
- WRT_REG_DWORD(&reg->iobase_addr, 0x6000);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6010);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6020);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6030);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6040);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6100);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6130);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6150);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6170);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x6190);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- WRT_REG_DWORD(&reg->iobase_addr, 0x61B0);
- dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
- for (cnt = 0; cnt < 16; cnt++)
-- *iter_reg++ = RD_REG_DWORD(dmp_reg++);
-+ *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
-
- /* Reset RISC. */
- WRT_REG_DWORD(&reg->ctrl_status,
-@@ -1615,7 +1263,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb[0] & MBS_MASK;
-- fw->code_ram[cnt] = (mb[3] << 16) | mb[2];
-+ fw->code_ram[cnt] = htonl((mb[3] << 16) | mb[2]);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
-@@ -1665,12 +1313,18 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
-
- if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
- rval = mb[0] & MBS_MASK;
-- fw->ext_mem[cnt] = (mb[3] << 16) | mb[2];
-+ fw->ext_mem[cnt] = htonl((mb[3] << 16) | mb[2]);
- } else {
- rval = QLA_FUNCTION_FAILED;
- }
- }
-
-+ if (rval == QLA_SUCCESS) {
-+ eft = qla2xxx_copy_queues(ha, &fw->ext_mem[cnt]);
-+ if (ha->eft)
-+ memcpy(eft, ha->eft, ntohl(ha->fw_dump->eft_size));
-+ }
-+
- if (rval != QLA_SUCCESS) {
- qla_printk(KERN_WARNING, ha,
- "Failed to dump firmware (%x)!!!\n", rval);
-@@ -1679,7 +1333,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int
- } else {
- qla_printk(KERN_INFO, ha,
- "Firmware dump saved to temp buffer (%ld/%p).\n",
-- ha->host_no, ha->fw_dump24);
-+ ha->host_no, ha->fw_dump);
- ha->fw_dumped = 1;
- }
-
-@@ -1688,496 +1342,6 @@ qla24xx_fw_dump_failed:
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
- }
-
--void
--qla24xx_ascii_fw_dump(scsi_qla_host_t *ha)
--{
-- uint32_t cnt;
-- char *uiter;
-- struct qla24xx_fw_dump *fw;
-- uint32_t ext_mem_cnt;
--
-- uiter = ha->fw_dump_buffer;
-- fw = ha->fw_dump24;
--
-- qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n",
-- ha->fw_major_version, ha->fw_minor_version,
-- ha->fw_subminor_version, ha->fw_attributes);
--
-- qla_uprintf(&uiter, "\nR2H Status Register\n%04x\n", fw->host_status);
--
-- qla_uprintf(&uiter, "\nHost Interface Registers");
-- for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->host_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nShadow Registers");
-- for (cnt = 0; cnt < sizeof(fw->shadow_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->shadow_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nMailbox Registers");
-- for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->mailbox_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xseq_1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_0_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_1_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRSEQ-2 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rseq_2_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nCommand DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->cmd_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRequest0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->req0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nResponse0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->resp0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->resp0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRequest1 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->req1_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt0_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt1_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT2 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt2_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt2_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT3 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt3_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt3_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT4 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt4_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt4_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nXMT Data DMA Common Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->xmt_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRCV Thread 0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt0_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rcvt0_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRCV Thread 1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt1_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->rcvt1_data_dma_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nRISC GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->risc_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->risc_gp_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nLMC Registers");
-- for (cnt = 0; cnt < sizeof(fw->lmc_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->lmc_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFPM Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fpm_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->fpm_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nFB Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fb_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- qla_uprintf(&uiter, "\n");
--
-- qla_uprintf(&uiter, "%08x ", fw->fb_hdw_reg[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nCode RAM");
-- for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%08x: ", cnt + 0x20000);
-- }
-- qla_uprintf(&uiter, "%08x ", fw->code_ram[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n\nExternal Memory");
-- ext_mem_cnt = ha->fw_memory_size - 0x100000 + 1;
-- for (cnt = 0; cnt < ext_mem_cnt; cnt++) {
-- if (cnt % 8 == 0) {
-- qla_uprintf(&uiter, "\n%08x: ", cnt + 0x100000);
-- }
-- qla_uprintf(&uiter, "%08x ", fw->ext_mem[cnt]);
-- }
--
-- qla_uprintf(&uiter, "\n[<==END] ISP Debug Dump");
--}
--
--void
--qla24xx_console_fw_dump(scsi_qla_host_t *ha)
--{
-- uint32_t cnt;
-- char *uiter;
-- struct qla24xx_fw_dump *fw;
-- uint32_t ext_mem_cnt;
--
-- uiter = ha->fw_dump_buffer;
-- fw = ha->fw_dump24;
--
-- printk("ISP FW Version %d.%02d.%02d Attributes %04x\n",
-- ha->fw_major_version, ha->fw_minor_version,
-- ha->fw_subminor_version, ha->fw_attributes);
--
-- printk("\nR2H Status Register\n%04x\n", fw->host_status);
--
-- printk("\nHost Interface Registers");
-- for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->host_reg[cnt]);
-- }
--
-- printk("\n\nShadow Registers");
-- for (cnt = 0; cnt < sizeof(fw->shadow_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->shadow_reg[cnt]);
-- }
--
-- printk("\n\nMailbox Registers");
-- for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->mailbox_reg[cnt]);
-- }
--
-- printk("\n\nXSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xseq_gp_reg[cnt]);
-- }
--
-- printk("\n\nXSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xseq_0_reg[cnt]);
-- }
--
-- printk("\n\nXSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xseq_1_reg[cnt]);
-- }
--
-- printk("\n\nRSEQ GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rseq_gp_reg[cnt]);
-- }
--
-- printk("\n\nRSEQ-0 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rseq_0_reg[cnt]);
-- }
--
-- printk("\n\nRSEQ-1 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rseq_1_reg[cnt]);
-- }
--
-- printk("\n\nRSEQ-2 Registers");
-- for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rseq_2_reg[cnt]);
-- }
--
-- printk("\n\nCommand DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->cmd_dma_reg[cnt]);
-- }
--
-- printk("\n\nRequest0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->req0_dma_reg[cnt]);
-- }
--
-- printk("\n\nResponse0 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->resp0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->resp0_dma_reg[cnt]);
-- }
--
-- printk("\n\nRequest1 Queue DMA Channel Registers");
-- for (cnt = 0; cnt < sizeof(fw->req1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->req1_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt0_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt0_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt1_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt1_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT2 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt2_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt2_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT3 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt3_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt3_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT4 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt4_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt4_dma_reg[cnt]);
-- }
--
-- printk("\n\nXMT Data DMA Common Registers");
-- for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->xmt_data_dma_reg[cnt]);
-- }
--
-- printk("\n\nRCV Thread 0 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt0_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rcvt0_data_dma_reg[cnt]);
-- }
--
-- printk("\n\nRCV Thread 1 Data DMA Registers");
-- for (cnt = 0; cnt < sizeof(fw->rcvt1_data_dma_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->rcvt1_data_dma_reg[cnt]);
-- }
--
-- printk("\n\nRISC GP Registers");
-- for (cnt = 0; cnt < sizeof(fw->risc_gp_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->risc_gp_reg[cnt]);
-- }
--
-- printk("\n\nLMC Registers");
-- for (cnt = 0; cnt < sizeof(fw->lmc_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->lmc_reg[cnt]);
-- }
--
-- printk("\n\nFPM Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fpm_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->fpm_hdw_reg[cnt]);
-- }
--
-- printk("\n\nFB Hardware Registers");
-- for (cnt = 0; cnt < sizeof(fw->fb_hdw_reg) / 4; cnt++) {
-- if (cnt % 8 == 0)
-- printk("\n");
--
-- printk("%08x ", fw->fb_hdw_reg[cnt]);
-- }
--
-- printk("\n\nCode RAM");
-- for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) {
-- if (cnt % 8 == 0) {
-- printk("\n%08x: ", cnt + 0x20000);
-- }
-- printk("%08x ", fw->code_ram[cnt]);
-- }
--
-- printk("\n\nExternal Memory");
-- ext_mem_cnt = ha->fw_memory_size - 0x100000 + 1;
-- for (cnt = 0; cnt < ext_mem_cnt; cnt++) {
-- if (cnt % 8 == 0) {
-- printk("\n%08x: ", cnt + 0x100000);
-- }
-- printk("%08x ", fw->ext_mem[cnt]);
-- }
--
-- printk("\n[<==END] ISP Debug Dump");
--}
--
- //FIXME
-
- /****************************************************************************/
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_dbg.h ./drivers/scsi/qla2xxx/qla_dbg.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_dbg.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_dbg.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,22 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
--
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- /*
- * Driver debug definitions.
- */
-@@ -63,72 +50,72 @@
- #define LEAVE_INTR(x) do {} while (0)
- #endif
-
--#define DEBUG(x) do { if (extended_error_logging) { x; } } while (0);
-+#define DEBUG(x) do { if (extended_error_logging) { x; } } while (0)
-
- #if defined(QL_DEBUG_LEVEL_1)
--#define DEBUG1(x) do {x;} while (0);
-+#define DEBUG1(x) do {x;} while (0)
- #else
--#define DEBUG1(x) do {} while (0);
-+#define DEBUG1(x) do {} while (0)
- #endif
-
--#define DEBUG2(x) do { if (extended_error_logging) { x; } } while (0);
--#define DEBUG2_3(x) do { if (extended_error_logging) { x; } } while (0);
--#define DEBUG2_3_11(x) do { if (extended_error_logging) { x; } } while (0);
--#define DEBUG2_9_10(x) do { if (extended_error_logging) { x; } } while (0);
--#define DEBUG2_11(x) do { if (extended_error_logging) { x; } } while (0);
--#define DEBUG2_13(x) do { if (extended_error_logging) { x; } } while (0);
-+#define DEBUG2(x) do { if (extended_error_logging) { x; } } while (0)
-+#define DEBUG2_3(x) do { if (extended_error_logging) { x; } } while (0)
-+#define DEBUG2_3_11(x) do { if (extended_error_logging) { x; } } while (0)
-+#define DEBUG2_9_10(x) do { if (extended_error_logging) { x; } } while (0)
-+#define DEBUG2_11(x) do { if (extended_error_logging) { x; } } while (0)
-+#define DEBUG2_13(x) do { if (extended_error_logging) { x; } } while (0)
-
- #if defined(QL_DEBUG_LEVEL_3)
--#define DEBUG3(x) do {x;} while (0);
--#define DEBUG3_11(x) do {x;} while (0);
-+#define DEBUG3(x) do {x;} while (0)
-+#define DEBUG3_11(x) do {x;} while (0)
- #else
--#define DEBUG3(x) do {} while (0);
-+#define DEBUG3(x) do {} while (0)
- #endif
-
- #if defined(QL_DEBUG_LEVEL_4)
--#define DEBUG4(x) do {x;} while (0);
-+#define DEBUG4(x) do {x;} while (0)
- #else
--#define DEBUG4(x) do {} while (0);
-+#define DEBUG4(x) do {} while (0)
- #endif
-
- #if defined(QL_DEBUG_LEVEL_5)
--#define DEBUG5(x) do {x;} while (0);
-+#define DEBUG5(x) do {x;} while (0)
- #else
--#define DEBUG5(x) do {} while (0);
-+#define DEBUG5(x) do {} while (0)
- #endif
-
- #if defined(QL_DEBUG_LEVEL_7)
--#define DEBUG7(x) do {x;} while (0);
-+#define DEBUG7(x) do {x;} while (0)
- #else
--#define DEBUG7(x) do {} while (0);
-+#define DEBUG7(x) do {} while (0)
- #endif
-
- #if defined(QL_DEBUG_LEVEL_9)
--#define DEBUG9(x) do {x;} while (0);
--#define DEBUG9_10(x) do {x;} while (0);
-+#define DEBUG9(x) do {x;} while (0)
-+#define DEBUG9_10(x) do {x;} while (0)
- #else
--#define DEBUG9(x) do {} while (0);
-+#define DEBUG9(x) do {} while (0)
- #endif
-
- #if defined(QL_DEBUG_LEVEL_10)
--#define DEBUG10(x) do {x;} while (0);
--#define DEBUG9_10(x) do {x;} while (0);
-+#define DEBUG10(x) do {x;} while (0)
-+#define DEBUG9_10(x) do {x;} while (0)
- #else
--#define DEBUG10(x) do {} while (0);
-+#define DEBUG10(x) do {} while (0)
- #if !defined(DEBUG9_10)
-- #define DEBUG9_10(x) do {} while (0);
-+ #define DEBUG9_10(x) do {} while (0)
- #endif
- #endif
-
- #if defined(QL_DEBUG_LEVEL_11)
--#define DEBUG11(x) do{x;} while(0);
-+#define DEBUG11(x) do{x;} while(0)
- #if !defined(DEBUG3_11)
--#define DEBUG3_11(x) do{x;} while(0);
-+#define DEBUG3_11(x) do{x;} while(0)
- #endif
- #else
--#define DEBUG11(x) do{} while(0);
-+#define DEBUG11(x) do{} while(0)
- #if !defined(QL_DEBUG_LEVEL_3)
-- #define DEBUG3_11(x) do{} while(0);
-+ #define DEBUG3_11(x) do{} while(0)
- #endif
- #endif
-
-@@ -153,9 +140,6 @@
- /*
- * Firmware Dump structure definition
- */
--#define FW_DUMP_SIZE_128K 0xBC000
--#define FW_DUMP_SIZE_512K 0x2FC000
--#define FW_DUMP_SIZE_1M 0x5FC000
-
- struct qla2300_fw_dump {
- uint16_t hccr;
-@@ -201,8 +185,6 @@ struct qla2100_fw_dump {
- uint16_t risc_ram[0xf000];
- };
-
--#define FW_DUMP_SIZE_24XX 0x2B0000
--
- struct qla24xx_fw_dump {
- uint32_t host_status;
- uint32_t host_reg[32];
-@@ -234,3 +216,39 @@ struct qla24xx_fw_dump {
- uint32_t code_ram[0x2000];
- uint32_t ext_mem[1];
- };
-+
-+#define EFT_NUM_BUFFERS 4
-+#define EFT_BYTES_PER_BUFFER 0x4000
-+#define EFT_SIZE ((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS))
-+
-+struct qla2xxx_fw_dump {
-+ uint8_t signature[4];
-+ uint32_t version;
-+
-+ uint32_t fw_major_version;
-+ uint32_t fw_minor_version;
-+ uint32_t fw_subminor_version;
-+ uint32_t fw_attributes;
-+
-+ uint32_t vendor;
-+ uint32_t device;
-+ uint32_t subsystem_vendor;
-+ uint32_t subsystem_device;
-+
-+ uint32_t fixed_size;
-+ uint32_t mem_size;
-+ uint32_t req_q_size;
-+ uint32_t rsp_q_size;
-+
-+ uint32_t eft_size;
-+ uint32_t eft_addr_l;
-+ uint32_t eft_addr_h;
-+
-+ uint32_t header_size;
-+
-+ union {
-+ struct qla2100_fw_dump isp21;
-+ struct qla2300_fw_dump isp23;
-+ struct qla24xx_fw_dump isp24;
-+ } isp;
-+};
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_def.h ./drivers/scsi/qla2xxx/qla_def.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_def.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_def.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,25 +1,13 @@
--/********************************************************************************
--* QLOGIC LINUX SOFTWARE
--*
--* QLogic ISP2x00 device driver for Linux 2.6.x
--* Copyright (C) 2003-2005 QLogic Corporation
--* (www.qlogic.com)
--*
--* This program is free software; you can redistribute it and/or modify it
--* under the terms of the GNU General Public License as published by the
--* Free Software Foundation; either version 2, or (at your option) any
--* later version.
--*
--* This program is distributed in the hope that it will be useful, but
--* WITHOUT ANY WARRANTY; without even the implied warranty of
--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--* General Public License for more details.
--**
--******************************************************************************/
--
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #ifndef __QLA_DEF_H
- #define __QLA_DEF_H
-
-+#include <linux/version.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/types.h>
-@@ -34,6 +22,11 @@
- #include <linux/spinlock.h>
- #include <linux/completion.h>
- #include <asm/semaphore.h>
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+#include <linux/ip.h>
-+#include <linux/if_arp.h>
-+#include <linux/skbuff.h>
-+#endif
-
- #include <scsi/scsi.h>
- #include <scsi/scsi_host.h>
-@@ -98,6 +91,9 @@
- #define FPM_2310 7
-
- #include "qla_settings.h"
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+#include "qla_ip.h"
-+#endif
-
- /*
- * Data bit definitions
-@@ -159,6 +155,14 @@
- #define RD_REG_DWORD_RELAXED(addr) readl_relaxed((void __iomem *)addr)
- #define WRT_REG_WORD(addr, data) writew(data,addr)
- #define WRT_REG_DWORD(addr, data) writel(data,addr)
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * The ISP2312 v2 chip cannot access the FLASH/GPIO registers via MMIO in an
-+ * 133Mhz slot.
-+ */
-+#define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr))
-+#define WRT_REG_WORD_PIO(addr, data) (outw(data,(unsigned long)addr))
-+#endif
-
- /*
- * Fibre Channel device definitions.
-@@ -273,6 +277,7 @@ typedef struct srb {
- #define SRB_ERR_LOOP 2 /* Request failed -- "loop down" */
- #define SRB_ERR_DEVICE 3 /* Request failed -- "device error" */
- #define SRB_ERR_OTHER 4
-+#define SRB_ERR_RETRY 5
-
- /* SRB magic number */
- uint16_t magic;
-@@ -342,6 +347,8 @@ typedef volatile struct {
- #define NVR_SELECT BIT_1
- #define NVR_CLOCK BIT_0
-
-+#define NVR_WAIT_CNT 20000
-+
- union {
- struct {
- volatile uint16_t mailbox0;
-@@ -695,7 +702,9 @@ typedef struct {
- #define MBC_SERDES_PARAMS 0x10 /* Serdes Tx Parameters. */
- #define MBC_GET_IOCB_STATUS 0x12 /* Get IOCB status command. */
- #define MBC_GET_TIMEOUT_PARAMS 0x22 /* Get FW timeouts. */
-+#define MBC_TRACE_CONTROL 0x27 /* Trace control command. */
- #define MBC_GEN_SYSTEM_ERROR 0x2a /* Generate System Error. */
-+#define MBC_READ_SFP 0x31 /* Read SFP Data. */
- #define MBC_SET_TIMEOUT_PARAMS 0x32 /* Set FW timeouts. */
- #define MBC_MID_INITIALIZE_FIRMWARE 0x48 /* MID Initialize firmware. */
- #define MBC_MID_GET_VP_DATABASE 0x49 /* MID Get VP Database. */
-@@ -705,6 +714,9 @@ typedef struct {
- #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */
- #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */
-
-+#define TC_ENABLE 4
-+#define TC_DISABLE 5
-+
- /* Firmware return data sizes */
- #define FCAL_MAP_SIZE 128
-
-@@ -1647,6 +1659,7 @@ typedef struct os_tgt {
- port_id_t d_id;
- uint8_t node_name[WWN_SIZE];
- uint8_t port_name[WWN_SIZE];
-+ uint8_t id;
- } os_tgt_t;
-
- /*
-@@ -1655,6 +1668,7 @@ typedef struct os_tgt {
- #define TQF_ONLINE 0 /* Device online to OS. */
- #define TQF_SUSPENDED 1
- #define TQF_RETRY_CMDS 2
-+#define TQF_USED_ID 3
-
- /*
- * SCSI LUN Queue structure
-@@ -1683,6 +1697,9 @@ typedef struct os_lun {
- u_long w_cnt; /* total writes */
- u_long r_cnt; /* total reads */
- u_long avg_time; /* */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ void *fo_ptr;
-+#endif
- } os_lun_t;
-
-
-@@ -1747,6 +1764,15 @@ typedef struct fc_port {
- uint8_t mp_byte; /* multi-path byte (not used) */
- uint8_t cur_path; /* current path id */
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ int16_t cfg_id; /* index into cfg device table */
-+ uint16_t notify_type;
-+ int (*fo_combine)(void *, uint16_t, struct fc_port *, uint16_t);
-+ int (*fo_detect)(void);
-+ int (*fo_notify)(void);
-+ int (*fo_select)(void);
-+ int (*fo_target_port)(struct fc_port *, struct fc_lun *, int);
-+#endif
- lun_bit_mask_t lun_mask;
- } fc_port_t;
-
-@@ -1764,32 +1790,35 @@ typedef struct fc_port {
- /*
- * FC port flags.
- */
--#define FCF_FABRIC_DEVICE BIT_0
--#define FCF_LOGIN_NEEDED BIT_1
--#define FCF_FO_MASKED BIT_2
--#define FCF_FAILOVER_NEEDED BIT_3
--#define FCF_RESET_NEEDED BIT_4
--#define FCF_PERSISTENT_BOUND BIT_5
--#define FCF_TAPE_PRESENT BIT_6
--#define FCF_FARP_DONE BIT_7
--#define FCF_FARP_FAILED BIT_8
--#define FCF_FARP_REPLY_NEEDED BIT_9
--#define FCF_AUTH_REQ BIT_10
--#define FCF_SEND_AUTH_REQ BIT_11
--#define FCF_RECEIVE_AUTH_REQ BIT_12
--#define FCF_AUTH_SUCCESS BIT_13
--#define FCF_RLC_SUPPORT BIT_14
--#define FCF_CONFIG BIT_15 /* Needed? */
--#define FCF_RESCAN_NEEDED BIT_16
--#define FCF_XP_DEVICE BIT_17
--#define FCF_MSA_DEVICE BIT_18
--#define FCF_EVA_DEVICE BIT_19
--#define FCF_MSA_PORT_ACTIVE BIT_20
--#define FCF_FAILBACK_DISABLE BIT_21
--#define FCF_FAILOVER_DISABLE BIT_22
--#define FCF_DSXXX_DEVICE BIT_23
--#define FCF_AA_EVA_DEVICE BIT_24
--#define FCF_AA_MSA_DEVICE BIT_25
-+#define FC_FABRIC_DEVICE BIT_0
-+#define FC_LOGIN_NEEDED BIT_1
-+#define FC_FO_MASKED BIT_2
-+#define FC_FAILOVER_NEEDED BIT_3
-+#define FC_RESET_NEEDED BIT_4
-+#define FC_PERSISTENT_BOUND BIT_5
-+#define FC_TAPE_PRESENT BIT_6
-+#define FC_FARP_DONE BIT_7
-+#define FC_FARP_FAILED BIT_8
-+#define FC_FARP_REPLY_NEEDED BIT_9
-+#define FC_AUTH_REQ BIT_10
-+#define FC_SEND_AUTH_REQ BIT_11
-+#define FC_RECEIVE_AUTH_REQ BIT_12
-+#define FC_AUTH_SUCCESS BIT_13
-+#define FC_RLC_SUPPORT BIT_14
-+#define FC_CONFIG BIT_15 /* Needed? */
-+#define FC_RESCAN_NEEDED BIT_16
-+#define FC_XP_DEVICE BIT_17
-+#define FC_MSA_DEVICE BIT_18
-+#define FC_EVA_DEVICE BIT_19
-+#define FC_MSA_PORT_ACTIVE BIT_20
-+#define FC_FAILBACK_DISABLE BIT_21
-+#define FC_FAILOVER_DISABLE BIT_22
-+#define FC_DSXXX_DEVICE BIT_23
-+#define FC_AA_EVA_DEVICE BIT_24
-+#define FC_AA_MSA_DEVICE BIT_25
-+#define FC_DFXXX_DEVICE BIT_26
-+#define FC_NVSXXX_DEVICE BIT_27
-+#define FC_SYMXXX_DEVICE BIT_28
-
- /* No loop ID flag. */
- #define FC_NO_LOOP_ID 0x1000
-@@ -1808,6 +1837,22 @@ typedef struct fc_lun {
-
- uint8_t max_path_retries;
- uint32_t flags;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ u_long s_time; /* service time */
-+ u_long kbytes;
-+ u_long io_cnt; /* total xfer count since boot */
-+ void *mplun;
-+ void *mpbuf; /* Pointer to buffer use by MPIO driver. */
-+ int mplen;
-+ void *lu_path;
-+ uint8_t path_id; /* Path id */
-+ uint8_t asymm_support; /*
-+ * tpgs field of the inquiry data indicating
-+ * support for REPORT/SET Tgt port group.
-+ */
-+#define TGT_PORT_GRP_UNSUPPORTED 0
-+#define SET_TGT_PORT_GRP_UNSUPPORTED 1
-+#endif
- } fc_lun_t;
-
- #define FLF_VISIBLE_LUN BIT_0
-@@ -2266,6 +2311,7 @@ typedef struct scsi_qla_host {
- uint32_t msi_enabled :1;
- uint32_t msix_enabled :1;
- uint32_t enable_ip :1;
-+ uint32_t disable_serdes :1;
- } flags;
-
- atomic_t loop_state;
-@@ -2508,6 +2554,11 @@ typedef struct scsi_qla_host {
- struct sns_cmd_pkt *sns_cmd;
- dma_addr_t sns_cmd_dma;
-
-+#define SFP_DEV_SIZE 256
-+#define SFP_BLOCK_SIZE 64
-+ void *sfp_data;
-+ dma_addr_t sfp_data_dma;
-+
- pid_t dpc_pid;
- int dpc_should_die;
- struct completion dpc_inited;
-@@ -2592,16 +2643,12 @@ typedef struct scsi_qla_host {
- uint16_t fw_seriallink_options24[4];
-
- /* Firmware dump information. */
-- void *fw_dump;
-- int fw_dump_order;
-- int fw_dump_reading;
-- char *fw_dump_buffer;
-- int fw_dump_buffer_len;
--
--//ISP24xx
-+ struct qla2xxx_fw_dump *fw_dump;
-+ uint32_t fw_dump_len;
- int fw_dumped;
-- void *fw_dump24;
-- int fw_dump24_len;
-+ int fw_dump_reading;
-+ dma_addr_t eft_dma;
-+ void *eft;
-
- uint8_t host_str[16];
- uint32_t pci_attr;
-@@ -2613,6 +2660,27 @@ typedef struct scsi_qla_host {
- char *model_desc;
- uint8_t adapter_id[16+1];
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/* following are new and needed for IOCTL support */
-+ struct hba_ioctl *ioctl;
-+
-+ void *ioctl_mem;
-+ dma_addr_t ioctl_mem_phys;
-+ uint32_t ioctl_mem_size;
-+
-+ struct scsi_cmnd *ioctl_err_cmd;
-+
-+ /* PCI expansion ROM image information. */
-+ unsigned long code_types;
-+#define ROM_CODE_TYPE_BIOS 0
-+#define ROM_CODE_TYPE_FCODE 1
-+#define ROM_CODE_TYPE_EFI 3
-+
-+ uint8_t bios_revision[2];
-+ uint8_t efi_revision[2];
-+ uint8_t fcode_revision[16];
-+ uint32_t fw_revision[4];
-+#endif
- uint8_t *node_name;
- uint8_t *port_name;
- uint32_t isp_abort_cnt;
-@@ -2623,9 +2691,6 @@ typedef struct scsi_qla_host {
- uint64_t IosExecuted;
- uint64_t BytesExecuted;
-
-- uint8_t driver_verstr[80];
-- uint8_t driver_version[4];
--
- /* Needed for BEACON */
- uint8_t beacon_blink_led;
- uint8_t beacon_color_state;
-@@ -2635,6 +2700,33 @@ typedef struct scsi_qla_host {
- #define QLA_LED_ALL_ON 0x07 /* yellow, green, amber */
- #define QLA_LED_RGA_ON 0x07 /* isp2322: red, green, amber */
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Data for IP support */
-+ uint8_t ip_port_name[WWN_SIZE];
-+
-+ struct risc_rec_entry *risc_rec_q;
-+ dma_addr_t risc_rec_q_dma;
-+ uint16_t rec_entries_in;
-+ uint16_t rec_entries_out;
-+
-+ struct send_cb *active_scb_q[MAX_SEND_PACKETS];
-+ uint32_t current_scb_q_idx;
-+
-+ uint32_t mtu;
-+ uint16_t header_size;
-+ uint16_t max_receive_buffers;
-+ struct buffer_cb *receive_buffers;
-+ uint32_t receive_buff_data_size;
-+
-+ void (*send_completion_routine)
-+ (struct send_cb *scb);
-+ void *receive_packets_context;
-+ void (*receive_packets_routine)
-+ (void *context, struct buffer_cb *bcb);
-+ void *notify_context;
-+ void (*notify_routine)
-+ (void *context, uint32_t type);
-+#endif
- } scsi_qla_host_t;
-
-
-@@ -2652,7 +2744,7 @@ typedef struct scsi_qla_host {
- test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
- test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
- atomic_read(&ha->loop_state) == LOOP_DOWN)
--
-+
- #define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
-
- #define TGT_Q(ha, t) (ha->otgt[t])
-@@ -2690,6 +2782,7 @@ typedef struct scsi_qla_host {
- #define QLA_BUSY 0x107
- #define QLA_RSCNS_HANDLED 0x108
- #define QLA_ALREADY_REGISTERED 0x109
-+#define QLA_PORT_LOGGED_OUT 0x10a
-
- /*
- * Stat info for all adpaters
-@@ -2708,11 +2801,18 @@ struct _qla2x00stats {
-
- #define INVALID_HANDLE (MAX_OUTSTANDING_COMMANDS+1)
-
-+#ifndef DID_IMM_RETRY
-+#define DID_IMM_RETRY DID_BUS_BUSY
-+#endif
-+
- /*
- * Flash support definitions
- */
- #define FLASH_IMAGE_SIZE 131072
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+#include "qla_foln.h"
-+#endif
- #include "qla_gbl.h"
- #include "qla_dbg.h"
- #include "qla_inline.h"
-@@ -2732,11 +2832,3 @@ struct _qla2x00stats {
- #define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
-
- #endif
--
--#define spin_unlock_irq_dump(host_lock) \
-- do { \
-- if (crashdump_mode()) \
-- spin_unlock(host_lock); \
-- else \
-- spin_unlock_irq(host_lock); \
-- } while (0)
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_devtbl.h ./drivers/scsi/qla2xxx/qla_devtbl.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_devtbl.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_devtbl.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,4 +1,10 @@
--#define QLA_MODEL_NAMES 0x4A
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#define QLA_MODEL_NAMES 0x57
-
- /*
- * Adapter model names and descriptions.
-@@ -76,6 +82,19 @@ static char *qla2x00_model_name[QLA_MODE
- "QLE2440", "PCI-Express to 4Gb FC, Single Channel", /* 0x145 */
- "QLE2464", "PCI-Express to 4Gb FC, Quad Channel", /* 0x146 */
- "QLA2440", "PCI-X 2.0 to 4Gb FC, Single Channel", /* 0x147 */
-- " ", " ", /* 0x148 */
-+ "HP AE369A", "PCI-X 2.0 to 4Gb FC, Dual Channel", /* 0x148 */
- "QLA2340", "Sun 133MHz PCI-X to 2Gb FC, Single Channel", /* 0x149 */
-+ " ", " ", /* 0x14a */
-+ " ", " ", /* 0x14b */
-+ "QMC2432M", "IBM eServer BC 4Gb FC Expansion Card CFFE", /* 0x14c */
-+ "QMC2422M", "IBM eServer BC 4Gb FC Expansion Card CFFX", /* 0x14d */
-+ "QLE220", "Sun PCI-Express to 4Gb FC, Single Channel", /* 0x14e */
-+ " ", " ", /* 0x14f */
-+ " ", " ", /* 0x150 */
-+ " ", " ", /* 0x151 */
-+ "QME2462", "PCI-Express to 4Gb FC, Dual Channel Mezz HBA", /* 0x152 */
-+ "QMH2462", "PCI-Express to 4Gb FC, Dual Channel Mezz HBA", /* 0x153 */
-+ " ", " ", /* 0x154 */
-+ "QLE220", "PCI-Express to 4Gb FC, Single Channel", /* 0x155 */
-+ "QLE220", "PCI-Express to 4Gb FC, Single Channel", /* 0x156 */
- };
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_fo.c ./drivers/scsi/qla2xxx/qla_fo.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_fo.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_fo.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,3600 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+#include <asm/uaccess.h>
-+#include <linux/vmalloc.h>
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+#include "qla_cfg.h"
-+
-+
-+/* This type is used to create a temporary list of port names */
-+typedef struct _portname_list {
-+ struct _portname_list *pnext;
-+ uint8_t portname[8];
-+} portname_list;
-+
-+/*
-+ * Global variables
-+ */
-+SysFoParams_t qla_fo_params;
-+
-+/*
-+ * Local routines
-+ */
-+#if !defined(linux)
-+static int qla2x00_sdm_setup(EXT_IOCTL *cmd_stp, void *arg, int mode);
-+#endif
-+static uint32_t qla2x00_fo_get_params(PFO_PARAMS pp);
-+static uint32_t qla2x00_fo_set_params(PFO_PARAMS pp);
-+static uint8_t qla2x00_fo_count_retries(scsi_qla_host_t *ha, srb_t *sp);
-+static int qla2x00_fo_get_lun_data(EXT_IOCTL *pext,
-+ FO_LUN_DATA_INPUT *bp, int mode);
-+static int qla2x00_fo_set_lun_data(EXT_IOCTL *pext,
-+ FO_LUN_DATA_INPUT *bp, int mode);
-+static uint32_t qla2x00_fo_stats(FO_HBA_STAT *stat_p, uint8_t reset);
-+static int qla2x00_fo_get_target_data(EXT_IOCTL *pext,
-+ FO_TARGET_DATA_INPUT *bp, int mode);
-+
-+static int qla2x00_std_get_tgt(scsi_qla_host_t *, EXT_IOCTL *,
-+ FO_DEVICE_DATA *);
-+static int qla2x00_fo_get_tgt(mp_host_t *, scsi_qla_host_t *, EXT_IOCTL *,
-+ FO_DEVICE_DATA *);
-+static int qla2x00_fo_set_target_data(EXT_IOCTL *pext,
-+ FO_TARGET_DATA_INPUT *bp, int mode);
-+
-+static int
-+qla2x00_fo_get_lbtype(EXT_IOCTL *pext, int mode);
-+
-+static int
-+qla2x00_fo_set_lbtype(EXT_IOCTL *pext, int mode);
-+
-+static int qla2x00_port_name_in_list(uint8_t *, portname_list *);
-+static int qla2x00_add_to_portname_list(uint8_t *, portname_list **);
-+static void qla2x00_free_portname_list(portname_list **);
-+
-+/*
-+ * qla2x00_get_hba
-+ * Searches the hba structure chain for the requested instance
-+ * aquires the mutex and returns a pointer to the hba structure.
-+ *
-+ * Input:
-+ * inst = adapter instance number.
-+ *
-+ * Returns:
-+ * Return value is a pointer to the adapter structure or
-+ * NULL if instance not found.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+scsi_qla_host_t *
-+qla2x00_get_hba(unsigned long instance)
-+{
-+ int found;
-+ scsi_qla_host_t *ha;
-+
-+ ha = NULL;
-+ found = 0;
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ if (ha->instance == instance) {
-+ found++;
-+ break;
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ return (found ? ha : NULL);
-+}
-+
-+int qla2x00_lookup_sense_code(unsigned char *sense_buffer);
-+
-+/*
-+ * Error structure
-+ */
-+struct error_code_info {
-+ uint8_t key;
-+ uint8_t asc;
-+ uint8_t ascq;
-+ uint8_t reserved;
-+};
-+
-+static struct error_code_info cfg_sense_code_list[] = {
-+ {HARDWARE_ERROR, 0x80, 0x02},
-+ {HARDWARE_ERROR, 0x44, 0x00},
-+ {HARDWARE_ERROR, 0x80, 0x03},
-+ {HARDWARE_ERROR, 0x95, 0x01},
-+ {HARDWARE_ERROR, 0x45, 0x00},
-+ {HARDWARE_ERROR, 0xD1, 0x0a},
-+ {HARDWARE_ERROR, 0x4b, 0x00},
-+ {HARDWARE_ERROR, 0xd0, 0x06},
-+ {HARDWARE_ERROR, 0x40, 0x81},
-+ {HARDWARE_ERROR, 0x44, 0x00},
-+ {HARDWARE_ERROR, 0xc0, 0x00},
-+ {HARDWARE_ERROR, 0x40, 0x81},
-+ {HARDWARE_ERROR, 0x44, 0x00},
-+ {HARDWARE_ERROR, 0xc0, 0x00},
-+ {HARDWARE_ERROR, 0x91, 0x09},
-+ {HARDWARE_ERROR, 0x40, 0x91},
-+ {HARDWARE_ERROR, 0x40, 0x92},
-+ {HARDWARE_ERROR, 0x40, 0x93},
-+ {HARDWARE_ERROR, 0x40, 0x94},
-+ {HARDWARE_ERROR, 0x40, 0x95},
-+ {HARDWARE_ERROR, 0x40, 0x96},
-+ {HARDWARE_ERROR, 0x44, 0x00},
-+ {HARDWARE_ERROR, 0x40, 0x81},
-+ {HARDWARE_ERROR, 0x87, 0x08},
-+ {HARDWARE_ERROR, 0x44, 0x00},
-+ {HARDWARE_ERROR, 0xa8, 0x00},
-+ {HARDWARE_ERROR, 0xa8, 0x01},
-+ {HARDWARE_ERROR, 0x40, 0x80},
-+ {HARDWARE_ERROR, 0x3F, 0xA1},
-+ {HARDWARE_ERROR, 0x0c, 0x80 },
-+ {HARDWARE_ERROR, 0x0c, 0x00 },
-+ {HARDWARE_ERROR, 0x0c, 0x81 },
-+ {0, 0, 0 }
-+};
-+
-+
-+int qla2x00_lookup_sense_code(unsigned char *sense_buffer)
-+{
-+ int i = 0;
-+
-+ DEBUG3(printk("%s entered\n",__func__));
-+
-+ for (i = 0; 1; i++) {
-+ if (cfg_sense_code_list[i].key == 0)
-+ return 0;
-+
-+ if( cfg_sense_code_list[i].key != (sense_buffer[2] & 0xf) )
-+ continue;
-+
-+ if (cfg_sense_code_list[i].asc == sense_buffer[12] &&
-+ cfg_sense_code_list[i].ascq == sense_buffer[13] )
-+ return 1;
-+ }
-+}
-+
-+/*
-+ * qla2x00_fo_stats
-+ * Searches the hba structure chan for the requested instance
-+ * aquires the mutex and returns a pointer to the hba structure.
-+ *
-+ * Input:
-+ * stat_p = Pointer to FO_HBA_STAT union.
-+ * reset = Flag, 1 = reset statistics.
-+ * 0 = return statistics values.
-+ *
-+ * Returns:
-+ * 0 = success
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla2x00_fo_stats(FO_HBA_STAT *stat_p, uint8_t reset)
-+{
-+ int32_t inst, idx;
-+ uint32_t rval = 0;
-+ scsi_qla_host_t *ha;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ inst = stat_p->input.HbaInstance;
-+ stat_p->info.HbaCount = 0;
-+
-+ ha = NULL;
-+
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ if (inst == FO_ADAPTER_ALL) {
-+ stat_p->info.HbaCount++;
-+ idx = ha->instance;
-+ } else if (ha->instance == inst) {
-+ stat_p->info.HbaCount = 1;
-+ idx = inst;
-+ }
-+ if (reset) {
-+ DEBUG9(printk("%s: reset stats.\n", __func__));
-+ ha->IosRequested = 0;
-+ ha->BytesRequested = 0;
-+ ha->IosExecuted = 0;
-+ ha->BytesExecuted = 0;
-+ } else {
-+ DEBUG9(printk("%s: get stats for inst %d.\n",
-+ __func__, inst));
-+
-+#if 0
-+ stat_p->info.StatEntry[idx].IosRequested =
-+ ha->IosRequested;
-+ stat_p->info.StatEntry[idx].BytesRequested =
-+ ha->BytesRequested;
-+ stat_p->info.StatEntry[idx].IosExecuted =
-+ ha->IosExecuted;
-+ stat_p->info.StatEntry[idx].BytesExecuted =
-+ ha->BytesExecuted;
-+#endif
-+ }
-+ if (inst != FO_ADAPTER_ALL)
-+ break;
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_fo_get_lun_data
-+ * Get lun data from all devices attached to a HBA (FO_GET_LUN_DATA).
-+ * Gets lun mask if failover not enabled.
-+ *
-+ * Input:
-+ * ha = pointer to adapter
-+ * bp = pointer to buffer
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_get_lun_data(EXT_IOCTL *pext, FO_LUN_DATA_INPUT *bp, int mode)
-+{
-+ scsi_qla_host_t *ha;
-+ struct list_head *fcports;
-+ fc_port_t *fcport;
-+ int ret = 0;
-+ mp_host_t *host = NULL;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+ mp_path_list_t *pathlist;
-+ os_tgt_t *ostgt;
-+ uint8_t path_id;
-+ uint16_t dev_no;
-+ uint16_t cnt;
-+ uint16_t lun;
-+ FO_EXTERNAL_LUN_DATA_ENTRY *u_entry, *entry;
-+ FO_LUN_DATA_LIST *u_list, *list;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ ha = qla2x00_get_hba((unsigned long)bp->HbaInstance);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-+ __func__, ha->instance, bp));
-+ DEBUG4(printk("%s: hba %p, buff %p bp->HbaInstance(%x).\n",
-+ __func__, ha, bp, (int)bp->HbaInstance));
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ if (list_empty(&ha->fcports)) {
-+ DEBUG2_9_10(printk(
-+ "%s: no HOST for ha inst %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ /* Since all ports are unconfigured, return a dummy
-+ * entry for each of them.
-+ */
-+ list = vmalloc(sizeof(FO_LUN_DATA_LIST));
-+ if (list == NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc "
-+ "memory of size (%d)\n", __func__,
-+ (int)sizeof(FO_LUN_DATA_LIST)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+ memset(list, 0, sizeof(FO_LUN_DATA_LIST));
-+
-+ entry = &list->DataEntry[0];
-+
-+ u_list = (FO_LUN_DATA_LIST *)
-+ Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode);
-+ u_entry = &u_list->DataEntry[0];
-+
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ memcpy(entry->NodeName, fcport->node_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->PortName, fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+
-+ entry->TargetId = 0;
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ entry->Data[lun] = 0;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): entry %d for "
-+ "unconfigured portname=%02x%02x"
-+ "%02x%02x%02x%02x%02x%02x, "
-+ "tgt_id=%d.\n",
-+ __func__, ha->host_no,
-+ list->EntryCount,
-+ entry->PortName[0],
-+ entry->PortName[1],
-+ entry->PortName[2],
-+ entry->PortName[3],
-+ entry->PortName[4],
-+ entry->PortName[5],
-+ entry->PortName[6],
-+ entry->PortName[7],
-+ entry->TargetId));
-+
-+ list->EntryCount++;
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk(
-+ "%s: u_entry %p copy out "
-+ "err. EntryCount=%d.\n",
-+ __func__, u_entry,
-+ list->EntryCount));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+ }
-+
-+ vfree(list);
-+
-+ return (ret);
-+ }
-+ }
-+
-+ list = vmalloc(sizeof(FO_LUN_DATA_LIST));
-+ if (list == NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_LUN_DATA_LIST)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+ memset(list, 0, sizeof(FO_LUN_DATA_LIST));
-+
-+ entry = &list->DataEntry[0];
-+
-+ u_list = (FO_LUN_DATA_LIST *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ u_entry = &u_list->DataEntry[0];
-+
-+ /* find the correct fcport list */
-+ if (!qla2x00_failover_enabled(ha))
-+ fcports = &ha->fcports;
-+ else
-+ fcports = host->fcports;
-+
-+ /* Check thru this adapter's fcport list */
-+ fcport = NULL;
-+ list_for_each_entry(fcport, fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+ if ((atomic_read(&fcport->state) != FCS_ONLINE) &&
-+ !qla2x00_is_fcport_in_config(ha, fcport)) {
-+ /* no need to report */
-+ DEBUG2_9_10(printk("%s(%ld): not reporting fcport "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x. state=%i,"
-+ " flags=%02x.\n",
-+ __func__, ha->host_no, fcport->port_name[0],
-+ fcport->port_name[1], fcport->port_name[2],
-+ fcport->port_name[3], fcport->port_name[4],
-+ fcport->port_name[5], fcport->port_name[6],
-+ fcport->port_name[7], atomic_read(&fcport->state),
-+ fcport->flags));
-+ continue;
-+ }
-+
-+ memcpy(entry->PortName,
-+ fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
-+
-+ /* Return dummy entry for unconfigured ports */
-+ if (fcport->mp_byte & MP_MASK_UNCONFIGURED) {
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ entry->Data[lun] = 0;
-+ }
-+ entry->TargetId = 0;
-+
-+ DEBUG9(printk("%s(%ld): entry %d for unconfigured "
-+ "portname=%02x%02x%02x%02x%02x%02x%02x%02x, "
-+ "tgt_id=%d.\n",
-+ __func__, ha->host_no,
-+ list->EntryCount,
-+ entry->PortName[0], entry->PortName[1],
-+ entry->PortName[2], entry->PortName[3],
-+ entry->PortName[4], entry->PortName[5],
-+ entry->PortName[6], entry->PortName[7],
-+ entry->TargetId));
-+
-+ list->EntryCount++;
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_entry %p "
-+ "copy out err. EntryCount=%d.\n",
-+ __func__, u_entry, list->EntryCount));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+
-+ continue;
-+ }
-+
-+ if (!qla2x00_failover_enabled(ha)) {
-+ /*
-+ * Failover disabled. Just return LUN mask info
-+ * in lun data entry of this port.
-+ */
-+ memcpy(entry->NodeName,
-+ fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-+ entry->TargetId = 0;
-+ for (cnt = 0; cnt < MAX_FIBRE_DEVICES; cnt++) {
-+ if (!(ostgt = ha->otgt[cnt])) {
-+ continue;
-+ }
-+
-+ if (ostgt->fcport == fcport) {
-+ entry->TargetId = cnt;
-+ break;
-+ }
-+ }
-+ if (cnt == MAX_FIBRE_DEVICES) {
-+ /* Not found? For now just go to next port. */
-+#if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_10)
-+ uint8_t *tmp_name;
-+
-+ tmp_name = fcport->port_name;
-+
-+ printk("%s(%ld): ERROR - port "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x "
-+ "not configured.\n",
-+ __func__, ha->host_no,
-+ tmp_name[0], tmp_name[1], tmp_name[2],
-+ tmp_name[3], tmp_name[4], tmp_name[5],
-+ tmp_name[6], tmp_name[7]);
-+#endif /* DEBUG */
-+
-+ continue;
-+ }
-+
-+ /* Got a valid port */
-+ list->EntryCount++;
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ /* set MSB if masked */
-+ entry->Data[lun] = LUN_DATA_PREFERRED_PATH;
-+ if (!EXT_IS_LUN_BIT_SET(&(fcport->lun_mask),
-+ lun)) {
-+ entry->Data[lun] |= LUN_DATA_ENABLED;
-+ }
-+ }
-+
-+ DEBUG9(printk("%s: got lun_mask for tgt %d\n",
-+ __func__, cnt));
-+ DEBUG9(qla2x00_dump_buffer((char *)&(fcport->lun_mask),
-+ sizeof(lun_bit_mask_t)));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
-+
-+ if (ret) {
-+ /* error */
-+ DEBUG9_10(printk("%s: u_entry %p copy "
-+ "error. list->EntryCount=%d.\n",
-+ __func__, u_entry, list->EntryCount));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ /* Go to next port */
-+ u_entry++;
-+ continue;
-+ }
-+
-+ /*
-+ * Failover is enabled. Go through the mp_devs list and return
-+ * lun data in configured path.
-+ */
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Lookup entry name */
-+ if (!qla2x00_is_portname_in_device(dp, entry->PortName))
-+ continue;
-+ if( dp->mpdev ) {
-+ dp = dp->mpdev;
-+ }
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt;
-+ path_id++, path = path->next) {
-+
-+ if (path->host != host)
-+ continue;
-+
-+ if (!qla2x00_is_portname_equal(path->portname,
-+ entry->PortName))
-+ continue;
-+
-+ /* Got an entry */
-+ if (fcport->flags & (FC_XP_DEVICE|FC_NVSXXX_DEVICE)) {
-+ memcpy(entry->NodeName, dp->nodename,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ } else {
-+ memcpy(entry->NodeName,
-+ fcport->node_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ }
-+
-+ entry->TargetId = dp->dev_id;
-+ entry->Dev_No = path->id;
-+ list->EntryCount++;
-+
-+ DEBUG9_10(printk(
-+ "%s(%ld): got lun_mask for tgt %d\n",
-+ __func__, ha->host_no, entry->TargetId));
-+ DEBUG9(qla2x00_dump_buffer(
-+ (char *)&(fcport->lun_mask),
-+ sizeof(lun_bit_mask_t)));
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ entry->Data[lun] =
-+ path->lun_data.data[lun];
-+ }
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_entry %p "
-+ "copy out err. EntryCount=%d.\n",
-+ __func__, u_entry, list->EntryCount));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+
-+ DEBUG9_10(printk("%s: get_lun_data for tgt "
-+ "%d- u_entry(%p) - lun entry[%d] :\n",
-+ __func__, entry->TargetId,
-+ u_entry,list->EntryCount - 1));
-+
-+ DEBUG9(qla2x00_dump_buffer((void *)entry, 64));
-+
-+ /*
-+ * We found the right path for this port.
-+ * Continue with next port.
-+ */
-+ break;
-+ }
-+
-+ /* Continue with next port. */
-+ break;
-+ }
-+ }
-+
-+ DEBUG9(printk("%s: get_lun_data - entry count = [%d]\n",
-+ __func__, list->EntryCount));
-+ DEBUG4(printk("%s: get_lun_data - entry count = [%d]\n",
-+ __func__, list->EntryCount));
-+
-+ if (ret == 0) {
-+ /* copy number of entries */
-+ ret = copy_to_user(&u_list->EntryCount, &list->EntryCount,
-+ sizeof(list->EntryCount));
-+ pext->ResponseLen = FO_LUN_DATA_LIST_MAX_SIZE;
-+ }
-+
-+ vfree(list);
-+ DEBUG9(printk("%s: exiting. ret=%d.\n", __func__, ret));
-+ return ret;
-+}
-+
-+/*
-+ * qla2x00_fo_set_lun_data
-+ * Set lun data for the specified device on the attached hba
-+ * (FO_SET_LUN_DATA).
-+ * Sets lun mask if failover not enabled.
-+ *
-+ * Input:
-+ * bp = pointer to buffer
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_set_lun_data(EXT_IOCTL *pext, FO_LUN_DATA_INPUT *bp, int mode)
-+{
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ int i;
-+ int ret = 0;
-+ mp_host_t *host = NULL;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+ mp_path_list_t *pathlist;
-+ os_tgt_t *ostgt;
-+ uint8_t path_id;
-+ uint16_t dev_no;
-+ uint16_t lun;
-+ FO_LUN_DATA_LIST *u_list, *list;
-+ FO_EXTERNAL_LUN_DATA_ENTRY *u_entry, *entry;
-+
-+ typedef struct _tagStruct {
-+ FO_LUN_DATA_INPUT foLunDataInput;
-+ FO_LUN_DATA_LIST foLunDataList;
-+ }
-+ com_struc;
-+ com_struc *com_iter;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ ha = qla2x00_get_hba((unsigned long)bp->HbaInstance);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-+ __func__, ha->instance, bp));
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ DEBUG2_9_10(printk("%s: no HOST for ha inst %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+ }
-+
-+ list = vmalloc(sizeof(FO_LUN_DATA_LIST));
-+ if (list == NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_LUN_DATA_LIST)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+ memset(list, 0, sizeof(FO_LUN_DATA_LIST));
-+
-+ entry = &list->DataEntry[0];
-+
-+ /* get lun data list from user */
-+ com_iter = (com_struc *)Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
-+ u_list = &(com_iter->foLunDataList);
-+ u_entry = &u_list->DataEntry[0];
-+
-+ ret = copy_from_user(list, u_list, sizeof(FO_LUN_DATA_LIST));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_list %p copy error.\n",
-+ __func__, u_list));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ vfree(list);
-+ return (ret);
-+ }
-+
-+ DEBUG2(printk("qla_fo_set_lun_data: pext->RequestAdr(%p) u_list (%p) "
-+ "sizeof(FO_LUN_DATA_INPUT) =(%d) and 64 bytes...\n",
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode), u_list,
-+ (int)sizeof(FO_LUN_DATA_INPUT)));
-+ DEBUG2(qla2x00_dump_buffer((void *)u_list, 64));
-+
-+ for (i = 0; i < list->EntryCount; i++, u_entry++) {
-+
-+ ret = copy_from_user(entry, u_entry,
-+ sizeof(FO_EXTERNAL_LUN_DATA_ENTRY));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_entry %p copy error.\n",
-+ __func__, u_entry));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ if (!qla2x00_failover_enabled(ha)) {
-+ /*
-+ * Failover disabled. Just find the port and set
-+ * LUN mask values in lun_mask field of this port.
-+ */
-+
-+ if (!(ostgt = ha->otgt[entry->TargetId]))
-+ /* ERROR */
-+ continue;
-+
-+ if (!(fcport = ostgt->fcport))
-+ /* ERROR */
-+ continue;
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ /* set MSB if masked */
-+ if (entry->Data[lun] | LUN_DATA_ENABLED) {
-+ EXT_CLR_LUN_BIT(&(fcport->lun_mask),
-+ lun);
-+ } else {
-+ EXT_SET_LUN_BIT(&(fcport->lun_mask),
-+ lun);
-+ }
-+ }
-+
-+ /* Go to next entry */
-+ continue;
-+ }
-+
-+ /*
-+ * Failover is enabled. Go through the mp_devs list and set lun
-+ * data in configured path.
-+ */
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Lookup entry name */
-+ if (!qla2x00_is_portname_in_device(dp, entry->PortName))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt;
-+ path_id++, path = path->next) {
-+
-+ if (path->host != host)
-+ continue;
-+
-+ if (!qla2x00_is_portname_equal(path->portname,
-+ entry->PortName))
-+ continue;
-+
-+ for (lun = 0; lun < MAX_LUNS; lun++) {
-+ path->lun_data.data[lun] =
-+ entry->Data[lun];
-+ DEBUG4(printk("cfg_set_lun_data: lun "
-+ "data[%d] = 0x%x \n", lun,
-+ path->lun_data.data[lun]));
-+ }
-+
-+ break;
-+ }
-+ break;
-+ }
-+ }
-+
-+ vfree(list);
-+
-+ DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret));
-+
-+ return ret;
-+}
-+
-+/*
-+ * qla2x00_fo_get_target_data
-+ * Get the target control byte for all devices attached to a HBA.
-+ *
-+ * Input:
-+ * bp = pointer to buffer
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_get_target_data(EXT_IOCTL *pext, FO_TARGET_DATA_INPUT *bp, int mode)
-+{
-+ scsi_qla_host_t *ha;
-+ int ret = 0;
-+ mp_host_t *host = NULL;
-+ FO_DEVICE_DATA *entry;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ ha = qla2x00_get_hba((unsigned long)bp->HbaInstance);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-+ __func__, ha->instance, bp));
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL &&
-+ list_empty(&ha->fcports)) {
-+ DEBUG2_9_10(printk("%s: no HOST for ha inst %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+ }
-+
-+ if ((entry = (FO_DEVICE_DATA *)vmalloc(sizeof(FO_DEVICE_DATA))) ==
-+ NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_DEVICE_DATA)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+
-+ /* Return data accordingly. */
-+ if (!qla2x00_failover_enabled(ha))
-+ ret = qla2x00_std_get_tgt(ha, pext, entry);
-+ else
-+ ret = qla2x00_fo_get_tgt(host, ha, pext, entry);
-+
-+
-+ if (ret == 0) {
-+ pext->ResponseLen = sizeof(FO_DEVICE_DATABASE);
-+ }
-+
-+ vfree(entry);
-+
-+ DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_std_get_tgt(scsi_qla_host_t *ha, EXT_IOCTL *pext, FO_DEVICE_DATA *entry)
-+{
-+ int ret = 0;
-+ uint16_t i, tgt;
-+ uint32_t b;
-+ fc_port_t *fcport;
-+ os_tgt_t *ostgt;
-+ FO_DEVICE_DATA *u_entry;
-+
-+ DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ u_entry = (FO_DEVICE_DATA *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+
-+ if (pext->ResponseLen < sizeof(FO_DEVICE_DATA)) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s: ERROR ResponseLen %d too small.\n",
-+ __func__, pext->ResponseLen));
-+
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): user buffer size=%d. Copying fcport list\n",
-+ __func__, ha->host_no, pext->ResponseLen));
-+
-+ /* Loop through and return ports found. */
-+ /* Check thru this adapter's fcport list */
-+ i = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (i >= MAX_TARGETS)
-+ break;
-+
-+ /* clear for a new entry */
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ memcpy(entry->WorldWideName,
-+ fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->PortName,
-+ fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
-+
-+ for (b = 0; b < 3 ; b++)
-+ entry->PortId[b] = fcport->d_id.r.d_id[2-b];
-+
-+ DEBUG9(printk("%s(%ld): found fcport %p:%02x%02x%02x%02x"
-+ "%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no,
-+ fcport,
-+ fcport->port_name[0],
-+ fcport->port_name[1],
-+ fcport->port_name[2],
-+ fcport->port_name[3],
-+ fcport->port_name[4],
-+ fcport->port_name[5],
-+ fcport->port_name[6],
-+ fcport->port_name[7]));
-+
-+ /*
-+ * Just find the port and return target info.
-+ */
-+ for (tgt = 0; tgt < MAX_FIBRE_DEVICES; tgt++) {
-+ if (!(ostgt = ha->otgt[tgt])) {
-+ continue;
-+ }
-+
-+ if (ostgt->fcport == fcport) {
-+ DEBUG9(printk("%s(%ld): Found target %d.\n",
-+ __func__, ha->host_no, tgt));
-+
-+ entry->TargetId = tgt;
-+ break;
-+ }
-+ }
-+
-+ if (tgt == MAX_FIBRE_DEVICES) {
-+ /* Not bound, this target is unconfigured. */
-+ entry->MultipathControl = MP_MASK_UNCONFIGURED;
-+ } else {
-+ entry->MultipathControl = 0; /* always configured */
-+ }
-+
-+ ret = copy_to_user(u_entry, entry, sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s(%ld): u_entry %p copy "
-+ "out err. tgt id = %d, port id=%02x%02x%02x.\n",
-+ __func__, ha->host_no, u_entry, tgt,
-+ fcport->d_id.r.d_id[2],
-+ fcport->d_id.r.d_id[1],
-+ fcport->d_id.r.d_id[0]));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): done copying fcport list entries.\n",
-+ __func__, ha->host_no));
-+
-+ /* For ports not found but were in config file, return unconfigured
-+ * status so agent will try to issue commands to it and GUI will display
-+ * them as missing.
-+ */
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (!(ostgt = TGT_Q(ha, tgt)))
-+ continue;
-+
-+ switch (ha->binding_type) {
-+ case BIND_BY_PORT_ID:
-+ case BIND_BY_PORT_NAME:
-+ /* This is a bound target. */
-+ if (ostgt->fcport != NULL)
-+ /* port found. */
-+ break;
-+
-+ /* This target was configured but not found. Return as
-+ * unconfigured.
-+ */
-+ DEBUG9(printk(
-+ "%s(%ld): returning tgt %d as unconfigured.\n",
-+ __func__, ha->host_no, tgt));
-+
-+ /* clear for a new entry */
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ /* Return unconfigured */
-+ memcpy(entry->WorldWideName,
-+ ostgt->node_name, EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->PortName,
-+ ostgt->port_name, EXT_DEF_WWP_NAME_SIZE);
-+
-+ for (b = 0; b < 3 ; b++)
-+ entry->PortId[b] = ostgt->d_id.r.d_id[2-b];
-+
-+ entry->TargetId = tgt;
-+ entry->MultipathControl = MP_MASK_UNCONFIGURED;
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s(%ld): u_entry %p copy "
-+ "out err. tgt id=%d.\n",
-+ __func__, ha->host_no, u_entry, tgt));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): done copying missing dev entries.\n",
-+ __func__, ha->host_no));
-+
-+ DEBUG9(printk("%s(%ld): exiting. ret = %d.\n",
-+ __func__, ha->host_no, ret));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_fo_get_tgt(mp_host_t *host, scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ FO_DEVICE_DATA *entry)
-+{
-+ int ret = 0;
-+ uint8_t path_id;
-+ uint16_t dev_no;
-+ uint32_t b;
-+ uint16_t cnt = 0;
-+
-+ fc_port_t *fcport;
-+ mp_device_t *dp;
-+ mp_path_list_t *pathlist;
-+ mp_path_t *path;
-+
-+ FO_DEVICE_DATA *u_entry;
-+
-+ DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ u_entry = (FO_DEVICE_DATA *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+
-+ /* If host is NULL then report all online fcports of the corresponding
-+ * ha as unconfigured devices. ha should never be NULL.
-+ */
-+ if (host == NULL) {
-+ /* Loop through and return ports found. */
-+ /* Check thru this adapter's fcport list */
-+ cnt = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ /* no need to report */
-+ DEBUG2_9_10(printk("%s(%ld): not reporting "
-+ "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-+ "state=%i, flags=%02x.\n",
-+ __func__, ha->host_no,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7],
-+ atomic_read(&fcport->state),
-+ fcport->flags));
-+ continue;
-+ }
-+
-+ cnt++;
-+ if (cnt >= MAX_TARGETS)
-+ break;
-+
-+ /* clear for a new entry */
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ memcpy(entry->WorldWideName,
-+ fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->PortName,
-+ fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
-+
-+ DEBUG10(printk("%s(%ld): found fcport %p:%02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no,
-+ fcport,
-+ fcport->port_name[0],
-+ fcport->port_name[1],
-+ fcport->port_name[2],
-+ fcport->port_name[3],
-+ fcport->port_name[4],
-+ fcport->port_name[5],
-+ fcport->port_name[6],
-+ fcport->port_name[7]));
-+
-+ for (b = 0; b < 3 ; b++)
-+ entry->PortId[b] = fcport->d_id.r.d_id[2-b];
-+
-+ DEBUG9_10(printk("%s(%ld): fcport mpbyte=%02x. "
-+ "return unconfigured. ",
-+ __func__, ha->host_no, fcport->mp_byte));
-+
-+ entry->TargetId = 0;
-+ entry->Dev_No = 0;
-+ entry->MultipathControl = MP_MASK_UNCONFIGURED;
-+
-+ DEBUG9_10(printk("tgtid=%d dev_no=%d, mpdata=0x%x.\n",
-+ entry->TargetId, entry->Dev_No,
-+ entry->MultipathControl));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s(%ld): u_entry %p "
-+ "copy out err. no tgt id.\n",
-+ __func__, ha->host_no, u_entry));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): after returning unconfigured fcport "
-+ "list. got %d entries.\n",
-+ __func__, ha->host_no, cnt));
-+
-+ return (ret);
-+ }
-+
-+ /* Check thru fcport list on host */
-+ /* Loop through and return online ports found. */
-+ /* Check thru this adapter's fcport list */
-+ cnt = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, host->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if ((atomic_read(&fcport->state) != FCS_ONLINE) &&
-+ !qla2x00_is_fcport_in_config(ha, fcport)) {
-+ /* no need to report */
-+ DEBUG2_9_10(printk("%s(%ld): not reporting "
-+ "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-+ "state=%i, flags=%02x.\n",
-+ __func__, ha->host_no, fcport->port_name[0],
-+ fcport->port_name[1], fcport->port_name[2],
-+ fcport->port_name[3], fcport->port_name[4],
-+ fcport->port_name[5], fcport->port_name[6],
-+ fcport->port_name[7],
-+ atomic_read(&fcport->state),
-+ fcport->flags));
-+ continue;
-+ }
-+
-+ cnt++;
-+ if (cnt >= MAX_TARGETS)
-+ break;
-+
-+ /* clear for a new entry */
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ memcpy(entry->PortName,
-+ fcport->port_name, EXT_DEF_WWN_NAME_SIZE);
-+
-+ DEBUG10(printk("%s(%ld): found fcport %p:%02x%02x%02x%02x"
-+ "%02x%02x%02x%02x.\n",
-+ __func__, host->ha->host_no,
-+ fcport,
-+ fcport->port_name[0],
-+ fcport->port_name[1],
-+ fcport->port_name[2],
-+ fcport->port_name[3],
-+ fcport->port_name[4],
-+ fcport->port_name[5],
-+ fcport->port_name[6],
-+ fcport->port_name[7]));
-+
-+ for (b = 0; b < 3 ; b++)
-+ entry->PortId[b] = fcport->d_id.r.d_id[2-b];
-+
-+ if (fcport->mp_byte & MP_MASK_UNCONFIGURED) {
-+ DEBUG9_10(printk("%s(%ld): fcport mpbyte=%02x. "
-+ "return unconfigured. ",
-+ __func__, host->ha->host_no, fcport->mp_byte));
-+ memcpy(entry->WorldWideName,
-+ fcport->node_name, EXT_DEF_WWN_NAME_SIZE);
-+
-+ entry->TargetId = fcport->os_target_id;
-+ entry->Dev_No = 0;
-+ entry->MultipathControl = MP_MASK_UNCONFIGURED;
-+
-+ DEBUG9_10(printk("tgtid=%d dev_no=%d, mpdata=0x%x.\n",
-+ entry->TargetId, entry->Dev_No,
-+ entry->MultipathControl));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s(%ld): u_entry %p "
-+ "copy out err. tgt id=%d.\n",
-+ __func__, host->ha->host_no, u_entry,
-+ fcport->os_target_id));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+ continue;
-+ }
-+
-+ /*
-+ * Port was configured. Go through the mp_devs list and
-+ * get target data in configured path.
-+ */
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ if( dp->mpdev ) {
-+ dp = dp->mpdev;
-+ }
-+
-+ /* Lookup entry name */
-+ if (!qla2x00_is_portname_in_device(dp, entry->PortName))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt;
-+ path_id++, path= path->next) {
-+
-+ if (path->host != host)
-+ continue;
-+
-+ if (!qla2x00_is_portname_equal(path->portname,
-+ entry->PortName))
-+ continue;
-+
-+ if (fcport->flags & (FC_XP_DEVICE|FC_NVSXXX_DEVICE)) {
-+ memcpy(entry->WorldWideName,
-+ dp->nodename,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ if (fcport->flags & FC_XP_DEVICE)
-+ DEBUG4(printk(KERN_INFO
-+ "%s XP device:copy the node "
-+ "name from mp_dev:%0x\n",
-+ __func__,dp->nodename[7]));
-+ } else {
-+ memcpy(entry->WorldWideName,
-+ fcport->node_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ DEBUG4(printk(KERN_INFO
-+ "%s :copy the node name from "
-+ "fcport:%0x\n",
-+ __func__,dp->nodename[7]));
-+ }
-+
-+ entry->TargetId = dp->dev_id;
-+ entry->Dev_No = path->id;
-+
-+ if (path->config ||
-+ !mp_config_required) {
-+ entry->MultipathControl = path->mp_byte;
-+ } else {
-+ entry->MultipathControl =
-+ MP_MASK_UNCONFIGURED;
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): fcport path->id "
-+ "= %d, target/mpbyte data = 0x%02x.\n",
-+ __func__, host->ha->host_no,
-+ path->id, entry->MultipathControl));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s(%ld): u_entry %p "
-+ "copy out err. tgt id=%d.\n",
-+ __func__, host->ha->host_no,
-+ u_entry, dp->dev_id));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+
-+ /* Path found. Continue with next fcport */
-+ break;
-+ }
-+ break;
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): after checking fcport list. got %d entries.\n",
-+ __func__, host->ha->host_no, cnt));
-+
-+ /* For ports not found but were in config file, return configured
-+ * status so agent will try to issue commands to it and GUI will display
-+ * them as missing.
-+ */
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Sanity check */
-+ if (qla2x00_is_wwn_zero(dp->nodename))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt;
-+ path_id++, path = path->next) {
-+
-+ /* Sanity check */
-+ if (qla2x00_is_wwn_zero(path->portname))
-+ continue;
-+
-+ if (path->port == NULL) {
-+ if (path->host != host) {
-+ /* path on other host. no need to
-+ * report
-+ */
-+ DEBUG10(printk("%s(%ld): path host %p "
-+ "not for current host %p.\n",
-+ __func__, host->ha->host_no,
-+ path->host, host));
-+
-+ continue;
-+ }
-+
-+ /* clear for a new entry */
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ /* This device was not found. Return
-+ * unconfigured.
-+ */
-+ memcpy(entry->WorldWideName,
-+ dp->nodename, EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->PortName,
-+ path->portname, EXT_DEF_WWN_NAME_SIZE);
-+
-+ entry->TargetId = dp->dev_id;
-+ entry->Dev_No = path->id;
-+ entry->MultipathControl = path->mp_byte;
-+ cnt++;
-+
-+ DEBUG9_10(printk("%s: found missing device. "
-+ "return tgtid=%d dev_no=%d, mpdata=0x%x for"
-+ " port %02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ __func__, entry->TargetId, entry->Dev_No,
-+ entry->MultipathControl,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_entry %p "
-+ "copy out err. tgt id=%d.\n",
-+ __func__, u_entry, dp->dev_id));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ u_entry++;
-+ }
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): after checking missing devs. got %d entries.\n",
-+ __func__, host->ha->host_no, cnt));
-+
-+ DEBUG9(printk("%s(%ld): exiting. ret = %d.\n",
-+ __func__, host->ha->host_no, ret));
-+
-+ return (ret);
-+
-+} /* qla2x00_get_fo_tgt */
-+
-+/*
-+ * qla2x00_fo_set_target_data
-+ * Set multipath control byte for all devices on the attached hba
-+ *
-+ * Input:
-+ * bp = pointer to buffer
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_set_target_data(EXT_IOCTL *pext, FO_TARGET_DATA_INPUT *bp, int mode)
-+{
-+ scsi_qla_host_t *ha;
-+ int i;
-+ int ret = 0;
-+ mp_host_t *host;
-+ mp_device_t *dp;
-+ mp_path_t *path;
-+ mp_path_list_t *pathlist;
-+ uint16_t dev_no;
-+ uint8_t path_id;
-+ FO_DEVICE_DATA *entry, *u_entry;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ ha = qla2x00_get_hba((unsigned long)bp->HbaInstance);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, bp->HbaInstance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: ha inst %ld, buff %p.\n",
-+ __func__, ha->instance, bp));
-+
-+ if (!qla2x00_failover_enabled(ha))
-+ /* non-failover mode. nothing to be done. */
-+ return 0;
-+
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ DEBUG2_9_10(printk("%s: no HOST for ha inst %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ entry = vmalloc(sizeof(FO_DEVICE_DATA));
-+ if (entry == NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_DEVICE_DATA)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+ memset(entry, 0, sizeof(FO_DEVICE_DATA));
-+
-+ u_entry = (FO_DEVICE_DATA *)(Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode) + sizeof(FO_TARGET_DATA_INPUT));
-+
-+ for (i = 0; i < MAX_TARGETS; i++, u_entry++) {
-+ ret = copy_from_user(entry, u_entry, sizeof(FO_DEVICE_DATA));
-+ if (ret) {
-+ /* error */
-+ DEBUG2_9_10(printk("%s: u_entry %p copy error.\n",
-+ __func__, u_entry));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ break;
-+ }
-+
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES; dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Lookup entry name */
-+ if (!qla2x00_is_portname_in_device(dp, entry->PortName))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt;
-+ path_id++, path= path->next) {
-+
-+ if (path->host != host)
-+ continue;
-+
-+ if (!qla2x00_is_portname_equal(path->portname,
-+ entry->PortName))
-+ continue;
-+
-+ path->mp_byte = entry->MultipathControl;
-+
-+ DEBUG9(printk("cfg_set_target_data: %d target "
-+ "data = 0x%x \n",
-+ path->id,path->mp_byte));
-+
-+ /*
-+ * If this is the visible path, then make it
-+ * available on next reboot.
-+ */
-+ if (!((path->mp_byte & MP_MASK_HIDDEN) ||
-+ (path->mp_byte & MP_MASK_UNCONFIGURED))) {
-+ pathlist->visible = path->id;
-+ }
-+
-+ /* Found path. Go to next entry. */
-+ break;
-+ }
-+ break;
-+ }
-+ }
-+
-+ vfree(entry);
-+
-+ DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret));
-+
-+ return (ret);
-+
-+}
-+
-+/*
-+ * qla2x00_fo_ioctl
-+ * Provides functions for failover ioctl() calls.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * ioctl_code = ioctl function to perform
-+ * arg = Address of application EXT_IOCTL cmd data
-+ * mode = flags
-+ *
-+ * Returns:
-+ * Return value is the ioctl rval_p return value.
-+ * 0 = success
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+/* ARGSUSED */
-+int
-+qla2x00_fo_ioctl(scsi_qla_host_t *ha, int ioctl_code, EXT_IOCTL *pext, int mode)
-+{
-+ typedef union {
-+ FO_PARAMS params;
-+ FO_GET_PATHS path;
-+ FO_SET_CURRENT_PATH set_path;
-+ /* FO_HBA_STAT_INPUT stat; */
-+ FO_HBA_STAT stat;
-+ FO_LUN_DATA_INPUT lun_data;
-+ FO_TARGET_DATA_INPUT target_data;
-+ } fodata_t;
-+ fodata_t *buff = NULL;
-+ int rval = 0;
-+ size_t in_size, out_size;
-+
-+
-+ ENTER("qla2x00_fo_ioctl");
-+ DEBUG9(printk("%s: entered. arg (%p):\n", __func__, pext));
-+
-+ /*
-+ * default case for this switch not needed,
-+ * ioctl_code validated by caller.
-+ */
-+ in_size = out_size = 0;
-+ switch (ioctl_code) {
-+ case FO_CC_GET_PARAMS:
-+ out_size = sizeof(FO_PARAMS);
-+ break;
-+ case FO_CC_SET_PARAMS:
-+ in_size = sizeof(FO_PARAMS);
-+ break;
-+ case FO_CC_GET_PATHS:
-+ in_size = sizeof(FO_GET_PATHS);
-+ break;
-+ case FO_CC_SET_CURRENT_PATH:
-+ in_size = sizeof(FO_SET_CURRENT_PATH);
-+ break;
-+ case FO_CC_GET_HBA_STAT:
-+ case FO_CC_RESET_HBA_STAT:
-+ in_size = sizeof(FO_HBA_STAT_INPUT);
-+ break;
-+ case FO_CC_GET_LUN_DATA:
-+ in_size = sizeof(FO_LUN_DATA_INPUT);
-+ break;
-+ case FO_CC_SET_LUN_DATA:
-+ in_size = sizeof(FO_LUN_DATA_INPUT);
-+ break;
-+ case FO_CC_GET_TARGET_DATA:
-+ in_size = sizeof(FO_TARGET_DATA_INPUT);
-+ break;
-+ case FO_CC_SET_TARGET_DATA:
-+ in_size = sizeof(FO_TARGET_DATA_INPUT);
-+ break;
-+ case FO_CC_GET_LBTYPE:
-+ /* Empty */
-+ break;
-+ case FO_CC_SET_LBTYPE:
-+ /* Empty */
-+ break;
-+
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&buff,
-+ sizeof(fodata_t))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG10(printk(
-+ "%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(fodata_t)));
-+ goto done_fo_ioctl;
-+ }
-+
-+ if (in_size != 0) {
-+ if ((int)pext->RequestLen < in_size) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ pext->DetailStatus = EXT_DSTATUS_REQUEST_LEN;
-+ DEBUG10(printk("%s: got invalie req len (%d).\n",
-+ __func__, pext->RequestLen));
-+
-+ } else {
-+ rval = copy_from_user(buff,
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode),
-+ in_size);
-+ if (rval) {
-+ DEBUG2_9_10(printk("%s: req buf copy error. "
-+ "size=%ld.\n",
-+ __func__, (ulong)in_size));
-+
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ } else {
-+ DEBUG9(printk("qla2x00_fo_ioctl: req buf "
-+ "copied ok.\n"));
-+ }
-+ }
-+ } else if (out_size != 0 && (ulong)pext->ResponseLen < out_size) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ pext->DetailStatus = out_size;
-+ DEBUG10(printk("%s: got invalie resp len (%d).\n",
-+ __func__, pext->ResponseLen));
-+ }
-+
-+ if (rval != 0 || pext->Status != 0)
-+ goto done_fo_ioctl;
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ switch (ioctl_code) {
-+ case FO_CC_GET_PARAMS:
-+ rval = qla2x00_fo_get_params(&(buff->params));
-+ break;
-+ case FO_CC_SET_PARAMS:
-+ rval = qla2x00_fo_set_params(&(buff->params));
-+ break;
-+ case FO_CC_GET_PATHS:
-+ rval = qla2x00_cfg_get_paths(pext,
-+ &(buff->path),mode);
-+ if (rval != 0)
-+ out_size = 0;
-+ break;
-+ case FO_CC_SET_CURRENT_PATH:
-+ rval = qla2x00_cfg_set_current_path(pext,
-+ &(buff->set_path),mode);
-+ break;
-+ case FO_CC_RESET_HBA_STAT:
-+ rval = qla2x00_fo_stats(&(buff->stat), 1);
-+ break;
-+ case FO_CC_GET_HBA_STAT:
-+ rval = qla2x00_fo_stats(&(buff->stat), 0);
-+ break;
-+ case FO_CC_GET_LUN_DATA:
-+
-+ DEBUG4(printk("calling qla2x00_fo_get_lun_data\n"));
-+ DEBUG4(printk("pext->RequestAdr (%p):\n",
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-+
-+ rval = qla2x00_fo_get_lun_data(pext,
-+ &(buff->lun_data), mode);
-+
-+ if (rval != 0)
-+ out_size = 0;
-+ break;
-+ case FO_CC_SET_LUN_DATA:
-+
-+ DEBUG4(printk("calling qla2x00_fo_set_lun_data\n"));
-+ DEBUG4(printk(" pext->RequestAdr (%p):\n",
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-+
-+ rval = qla2x00_fo_set_lun_data(pext,
-+ &(buff->lun_data), mode);
-+ break;
-+ case FO_CC_GET_TARGET_DATA:
-+ DEBUG4(printk("calling qla2x00_fo_get_target_data\n"));
-+ DEBUG4(printk("pext->RequestAdr (%p):\n",
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-+
-+ rval = qla2x00_fo_get_target_data(pext,
-+ &(buff->target_data), mode);
-+
-+ if (rval != 0) {
-+ out_size = 0;
-+ }
-+ break;
-+ case FO_CC_SET_TARGET_DATA:
-+ DEBUG4(printk("calling qla2x00_fo_set_target_data\n"));
-+ DEBUG4(printk(" pext->RequestAdr (%p):\n",
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-+ rval = qla2x00_fo_set_target_data(pext,
-+ &(buff->target_data), mode);
-+ break;
-+ case FO_CC_GET_LBTYPE:
-+ DEBUG4(printk("calling qla2x00_fo_get_lbtype\n"));
-+ rval = qla2x00_fo_get_lbtype(pext, mode);
-+ break;
-+ case FO_CC_SET_LBTYPE:
-+ DEBUG4(printk("calling qla2x00_fo_set_lbtype\n"));
-+ rval = qla2x00_fo_set_lbtype(pext, mode);
-+ break;
-+ }
-+
-+ if (rval == 0) {
-+ rval = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), buff, out_size);
-+ if (rval != 0) {
-+ DEBUG10(printk("%s: resp buf copy error. size=%ld.\n",
-+ __func__, (ulong)out_size));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ }
-+ }
-+
-+done_fo_ioctl:
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ if (rval != 0) {
-+ /*EMPTY*/
-+ DEBUG10(printk("%s: **** FAILED ****\n", __func__));
-+ } else {
-+ /*EMPTY*/
-+ DEBUG9(printk("%s: exiting normally\n", __func__));
-+ }
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_cfg_get_path_cnt
-+ * Get the path cnt for the target.
-+ * Input:
-+ * sp = Pointer to command.
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int qla2x00_cfg_get_path_cnt(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ mp_host_t *host; /* host adapter pointer */
-+ os_tgt_t *tq;
-+ mp_path_list_t *path_list;
-+ mp_device_t *dp;
-+ int id = 0;
-+
-+ tq = sp->tgt_queue;
-+ if ((host = qla2x00_cfg_find_host(ha)) != NULL) {
-+ if ((dp = qla2x00_find_mp_dev_by_nodename(host,
-+ tq->node_name)) != NULL) {
-+ path_list = dp->path_list;
-+ id = path_list->path_cnt;
-+ }
-+ }
-+ return id;
-+}
-+
-+/*
-+ * qla2x00_fo_count_retries
-+ * Increment the retry counter for the command.
-+ * Set or reset the SRB_RETRY flag.
-+ *
-+ * Input:
-+ * sp = Pointer to command.
-+ *
-+ * Returns:
-+ * 1 -- retry
-+ * 0 -- don't retry
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint8_t
-+qla2x00_fo_count_retries(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ uint8_t retry = 0;
-+ os_lun_t *lq;
-+ os_tgt_t *tq;
-+ scsi_qla_host_t *vis_ha;
-+ uint16_t path_id;
-+ int path_cnt;
-+ struct osl_fo_info *osl_fo;
-+ mp_lun_t *mplun;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ lq = sp->lun_queue;
-+ osl_fo = (struct osl_fo_info *) lq->fo_ptr;
-+ /*
-+ * if load balancing then we don't try and failover until
-+ * all the active paths are gone.
-+ */
-+ mplun = (mp_lun_t *)sp->fclun->mplun;
-+ path_cnt = qla2x00_cfg_get_path_cnt(ha, sp);
-+ DEBUG(printk("%s path_cnt=%d osl_fo_path_cnt=%d for lun=%d\n",
-+ __func__, path_cnt, osl_fo->path_cnt, lq->fclun->lun));
-+
-+ if (test_and_clear_bit(LUN_MPIO_RESET_CNTS, &lq->q_flag))
-+ for (path_id = 0; path_id < MAX_PATHS_PER_DEVICE; path_id++)
-+ osl_fo->fo_retry_cnt[path_id] = 0;
-+
-+ /* Check to see if we have exhausted retries on all the paths. */
-+ for (path_id = 0; path_id < path_cnt; path_id++) {
-+ if (osl_fo->fo_retry_cnt[path_id] >=
-+ qla_fo_params.MaxRetriesPerPath) {
-+ DEBUG2(printk("%s path_id=%d fo_retry_cnt=%d for lun=%d\n",
-+ __func__, path_id, osl_fo->fo_retry_cnt[path_id], lq->fclun->lun));
-+ continue;
-+ }
-+ retry = 1;
-+ break;
-+ }
-+ if (retry == 0) {
-+ sp->fo_retry_cnt = 0;
-+ printk(KERN_INFO
-+ "qla2x00: no more failovers for request - pid= %ld\n",
-+ sp->cmd->serial_number);
-+ } else {
-+ /*
-+ * We haven't exceeded the max retries for this request, check
-+ * max retries this path
-+ */
-+ if((++sp->fo_retry_cnt % qla_fo_params.MaxRetriesPerPath) == 0){
-+ if (mplun) {
-+ if( mplun->load_balance_type >= LB_LRU ) {
-+#if defined(QL_DEBUG_LEVEL_2)
-+ osl_fo = (struct osl_fo_info *)
-+ sp->lun_queue->fo_ptr;
-+ printk(" %s: LB-FAILOVER - lun=%d "
-+ "visha=%ld, sp=%p, pid =%ld, "
-+ "path_id=%d fo retry= %d, act "
-+ "paths=%d max_paths=%d\n",
-+ __func__, sp->fclun->lun,
-+ ha->host_no, sp,
-+ sp->cmd->serial_number, path_id,
-+ osl_fo->fo_retry_cnt[path_id],
-+ mplun->act_cnt, path_cnt);
-+#endif
-+
-+ if ( qla2x00_del_fclun_from_active_list( mplun,
-+ sp->fclun, sp) == 0 ){
-+ sp->fclun = sp->lun_queue->fclun;
-+ sp->ha = sp->fclun->fcport->ha;
-+ return 1;
-+ }
-+ printk(KERN_INFO
-+ "%s: no more active paths for request - "
-+ "pid= %ld, lun=%d, lq=%p\n",
-+ __func__,sp->cmd->serial_number, sp->fclun->lun, lq);
-+ }
-+ }
-+
-+ path_id = sp->fclun->fcport->cur_path;
-+ osl_fo->fo_retry_cnt[path_id]++;
-+ DEBUG2(printk("qla2x00_fo_count_retries: FAILOVER - "
-+ "queuing ha=%ld, sp=%p, pid =%ld, "
-+ "fo retry= %d \n",
-+ ha->host_no,
-+ sp, sp->cmd->serial_number,
-+ osl_fo->fo_retry_cnt[path_id]));
-+
-+ /*
-+ * Note: we don't want it to timeout, so it is
-+ * recycling on the retry queue and the fialover queue.
-+ */
-+ tq = sp->tgt_queue;
-+ set_bit(LUN_MPIO_BUSY, &lq->q_flag);
-+
-+ /*
-+ * ??? We can get a path error on any ha, but always
-+ * queue failover on originating ha. This will allow us
-+ * to syncronized the requests for a given lun.
-+ */
-+ sp->f_start=jiffies; /*ra 10/29/01*/
-+ /* Now queue it on to be failover */
-+ sp->ha = ha;
-+ /* we can only failover using the visible HA */
-+ vis_ha =
-+ (scsi_qla_host_t *)sp->cmd->device->host->hostdata;
-+ add_to_failover_queue(vis_ha,sp);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s: exiting. retry = %d.\n", __func__, retry));
-+
-+ return retry ;
-+}
-+
-+int
-+qla2x00_fo_check_device(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ int retry = 0;
-+ os_lun_t *lq;
-+ struct scsi_cmnd *cp;
-+ fc_port_t *fcport;
-+
-+ if ( !(sp->flags & SRB_GOT_SENSE) )
-+ return retry;
-+
-+ cp = sp->cmd;
-+ lq = sp->lun_queue;
-+ fcport = lq->fclun->fcport;
-+ switch (cp->sense_buffer[2] & 0xf) {
-+ case NOT_READY:
-+ if (fcport->flags & (FC_MSA_DEVICE | FC_EVA_DEVICE |
-+ FC_AA_EVA_DEVICE | FC_AA_MSA_DEVICE)) {
-+ /*
-+ * if we can't access port
-+ */
-+ if ((cp->sense_buffer[12] == 0x4 &&
-+ (cp->sense_buffer[13] == 0x0 ||
-+ cp->sense_buffer[13] == 0x2))) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_NO_CONNECT << 16;
-+ return 1;
-+ }
-+ }
-+ if (fcport->flags & FC_NVSXXX_DEVICE) {
-+ /*
-+ * if we can't access port
-+ */
-+ if ((cp->sense_buffer[12] == 0x4 &&
-+ cp->sense_buffer[13] == 0x0 )) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_NO_CONNECT << 16;
-+ return 1;
-+ }
-+ }
-+ if (fcport->flags & FC_DSXXX_DEVICE) {
-+ /* retry I/O */
-+ if (cp->sense_buffer[12] == 0x4 &&
-+ (cp->sense_buffer[13] == 0x0 ||
-+ cp->sense_buffer[13] == 0xa)) {
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ return 1;
-+ }
-+ if (cp->sense_buffer[12] == 0x4 &&
-+ cp->sense_buffer[13] == 0xb) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_NO_CONNECT << 16;
-+ return 1;
-+ }
-+ }
-+
-+ break;
-+
-+ case UNIT_ATTENTION:
-+ if (fcport->flags & (FC_EVA_DEVICE | FC_AA_EVA_DEVICE |
-+ FC_AA_MSA_DEVICE)) {
-+ if ((cp->sense_buffer[12] == 0xa &&
-+ cp->sense_buffer[13] == 0x8)) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_NO_CONNECT << 16;
-+ return 1;
-+ }
-+ if ((cp->sense_buffer[12] == 0xa &&
-+ cp->sense_buffer[13] == 0x9)) {
-+ /* failback lun */
-+ }
-+ }
-+ /* retry I/O */
-+ if (fcport->flags & FC_DSXXX_DEVICE) {
-+ /* lun config changed */
-+ if (cp->sense_buffer[12] == 0x2a &&
-+ cp->sense_buffer[13] == 0x6) {
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ return 1;
-+ }
-+ }
-+
-+ break;
-+
-+ case HARDWARE_ERROR:
-+ if (fcport->flags & (FC_DFXXX_DEVICE)) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ return 1;
-+ }
-+ break;
-+
-+ case ABORTED_COMMAND:
-+ if (fcport->flags & (FC_DFXXX_DEVICE)) {
-+ sp->err_id = SRB_ERR_DEVICE;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ return 1;
-+ }
-+ break;
-+
-+ }
-+
-+ return (retry);
-+}
-+
-+/*
-+ * qla2x00_fo_check
-+ * This function is called from the done routine to see if
-+ * the SRB requires a failover.
-+ *
-+ * This function examines the available os returned status and
-+ * if meets condition, the command(srb) is placed ont the failover
-+ * queue for processing.
-+ *
-+ * Input:
-+ * sp = Pointer to the SCSI Request Block
-+ *
-+ * Output:
-+ * sp->flags SRB_RETRY bit id command is to
-+ * be retried otherwise bit is reset.
-+ *
-+ * Returns:
-+ * None.
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ */
-+uint8_t
-+qla2x00_fo_check(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ uint8_t retry = 0;
-+ int host_status;
-+ static char *reason[] = {
-+ "DID_OK",
-+ "DID_NO_CONNECT",
-+ "DID_BUS_BUSY",
-+ "DID_TIME_OUT",
-+ "DID_BAD_TARGET",
-+ "DID_ABORT",
-+ "DID_PARITY",
-+ "DID_ERROR",
-+ "DID_RESET",
-+ "DID_BAD_INTR"
-+ };
-+
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ /* we failover on selction timeouts and some device check conditions */
-+ if( sp->err_id == SRB_ERR_RETRY ) {
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ // spin_lock_irqsave(&ha->hardware_lock, flags);
-+ sp->fclun->io_cnt++;
-+ sp->fclun->s_time += HZ;
-+ // spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ }
-+ qla2x00_fo_check_device(ha, sp);
-+ host_status = host_byte(sp->cmd->result);
-+ if( host_status == DID_NO_CONNECT ) {
-+
-+ if (qla2x00_fo_count_retries(ha, sp)) {
-+ /* Force a retry on this request, it will
-+ * cause the LINUX timer to get reset, while we
-+ * we are processing the failover.
-+ */
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ retry = 1;
-+ }
-+ DEBUG(printk("qla2x00_fo_check: pid= %ld sp %p/%d/%d retry count=%d, "
-+ "retry flag = %d, host status (%s)\n",
-+ sp->cmd->serial_number, sp, sp->state, sp->err_id, sp->fo_retry_cnt, retry,
-+ reason[host_status]));
-+ }
-+
-+ /* Clear out any FO retry counts on good completions. */
-+ if (host_status == DID_OK)
-+ set_bit(LUN_MPIO_RESET_CNTS, &sp->lun_queue->q_flag);
-+
-+ DEBUG3(printk("%s: exiting. retry = %d.\n", __func__, retry));
-+
-+ return retry;
-+}
-+
-+/*
-+ * qla2x00_fo_path_change
-+ * This function is called from configuration mgr to notify
-+ * of a path change.
-+ *
-+ * Input:
-+ * type = Failover notify type, FO_NOTIFY_LUN_RESET or FO_NOTIFY_LOGOUT
-+ * newlunp = Pointer to the fc_lun struct for current path.
-+ * oldlunp = Pointer to fc_lun struct for previous path.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint32_t
-+qla2x00_fo_path_change(uint32_t type, fc_lun_t *newlunp, fc_lun_t *oldlunp)
-+{
-+ uint32_t ret = QLA_SUCCESS;
-+
-+ newlunp->max_path_retries = 0;
-+ return ret;
-+}
-+
-+/*
-+ * qla2x00_fo_get_params
-+ * Process an ioctl request to get system wide failover parameters.
-+ *
-+ * Input:
-+ * pp = Pointer to FO_PARAMS structure.
-+ *
-+ * Returns:
-+ * EXT_STATUS code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla2x00_fo_get_params(PFO_PARAMS pp)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ pp->MaxPathsPerDevice = qla_fo_params.MaxPathsPerDevice;
-+ pp->MaxRetriesPerPath = qla_fo_params.MaxRetriesPerPath;
-+ pp->MaxRetriesPerIo = qla_fo_params.MaxRetriesPerIo;
-+ pp->Flags = qla_fo_params.Flags;
-+ pp->FailoverNotifyType = qla_fo_params.FailoverNotifyType;
-+ pp->FailoverNotifyCdbLength = qla_fo_params.FailoverNotifyCdbLength;
-+ memset(pp->FailoverNotifyCdb, 0, sizeof(pp->FailoverNotifyCdb));
-+ memcpy(pp->FailoverNotifyCdb,
-+ &qla_fo_params.FailoverNotifyCdb[0], sizeof(pp->FailoverNotifyCdb));
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return EXT_STATUS_OK;
-+}
-+
-+/*
-+ * qla2x00_fo_set_params
-+ * Process an ioctl request to set system wide failover parameters.
-+ *
-+ * Input:
-+ * pp = Pointer to FO_PARAMS structure.
-+ *
-+ * Returns:
-+ * EXT_STATUS code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static uint32_t
-+qla2x00_fo_set_params(PFO_PARAMS pp)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ /* Check values for defined MIN and MAX */
-+ if ((pp->MaxPathsPerDevice > SDM_DEF_MAX_PATHS_PER_DEVICE) ||
-+ (pp->MaxRetriesPerPath < FO_MAX_RETRIES_PER_PATH_MIN) ||
-+ (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_PATH_MAX) ||
-+ (pp->MaxRetriesPerIo < FO_MAX_RETRIES_PER_IO_MIN) ||
-+ (pp->MaxRetriesPerPath > FO_MAX_RETRIES_PER_IO_MAX)) {
-+ DEBUG2_9_10(printk("%s: got invalid params.\n", __func__));
-+ return EXT_STATUS_INVALID_PARAM;
-+ }
-+
-+ /* Update the global structure. */
-+ qla_fo_params.MaxPathsPerDevice = pp->MaxPathsPerDevice;
-+ qla_fo_params.MaxRetriesPerPath = pp->MaxRetriesPerPath;
-+ qla_fo_params.MaxRetriesPerIo = pp->MaxRetriesPerIo;
-+ qla_fo_params.Flags = pp->Flags;
-+ qla_fo_params.FailoverNotifyType = pp->FailoverNotifyType;
-+ qla_fo_params.FailoverNotifyCdbLength = pp->FailoverNotifyCdbLength;
-+ if (pp->FailoverNotifyType & FO_NOTIFY_TYPE_CDB) {
-+ if (pp->FailoverNotifyCdbLength >
-+ sizeof(qla_fo_params.FailoverNotifyCdb)) {
-+ DEBUG2_9_10(printk("%s: got invalid cdb length.\n",
-+ __func__));
-+ return EXT_STATUS_INVALID_PARAM;
-+ }
-+
-+ memcpy(qla_fo_params.FailoverNotifyCdb,
-+ pp->FailoverNotifyCdb,
-+ sizeof(qla_fo_params.FailoverNotifyCdb));
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return EXT_STATUS_OK;
-+}
-+
-+
-+/*
-+ * qla2x00_fo_init_params
-+ * Gets driver configuration file failover properties to initalize
-+ * the global failover parameters structure.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla2x00_fo_init_params(scsi_qla_host_t *ha)
-+{
-+ DEBUG3(printk("%s: entered.\n", __func__));
-+
-+ /* For parameters that are not completely implemented yet, */
-+
-+ memset(&qla_fo_params, 0, sizeof(qla_fo_params));
-+
-+ if(MaxPathsPerDevice) {
-+ qla_fo_params.MaxPathsPerDevice = MaxPathsPerDevice;
-+ } else
-+ qla_fo_params.MaxPathsPerDevice =FO_MAX_PATHS_PER_DEVICE_DEF ;
-+ if(MaxRetriesPerPath) {
-+ qla_fo_params.MaxRetriesPerPath = MaxRetriesPerPath;
-+ } else
-+ qla_fo_params.MaxRetriesPerPath =FO_MAX_RETRIES_PER_PATH_DEF;
-+ if(MaxRetriesPerIo) {
-+ qla_fo_params.MaxRetriesPerIo =MaxRetriesPerIo;
-+ } else
-+ qla_fo_params.MaxRetriesPerIo =FO_MAX_RETRIES_PER_IO_DEF;
-+
-+ qla_fo_params.Flags = 0;
-+ qla_fo_params.FailoverNotifyType = FO_NOTIFY_TYPE_NONE;
-+
-+ /* Set it to whatever user specified on the cmdline */
-+ if (qlFailoverNotifyType != FO_NOTIFY_TYPE_NONE)
-+ qla_fo_params.FailoverNotifyType = qlFailoverNotifyType;
-+
-+
-+ DEBUG3(printk("%s: exiting.\n", __func__));
-+}
-+
-+int
-+qla2x00_spinup(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun)
-+{
-+ int rval = QLA_SUCCESS;
-+ int count, retry;
-+ inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t comp_status = CS_COMPLETE;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+
-+ ENTER(__func__);
-+
-+ inq = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &inq_dma);
-+ if (inq == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - INQ\n",
-+ ha->host_no);
-+
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ count = 5;
-+ retry = 5;
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is not "
-+ "ONLINE\n", ha->host_no,__func__,fcport->loop_id));
-+ rval = QLA_FUNCTION_FAILED;
-+ } else {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &inq->p.rsp24.comp_status;
-+ sstatus = &inq->p.rsp24.scsi_status;
-+ sense_data = inq->p.rsp24.data;
-+ } else {
-+ cstatus = &inq->p.rsp.comp_status;
-+ sstatus = &inq->p.rsp.scsi_status;
-+ sense_data = inq->p.rsp.req_sense_data;
-+ }
-+
-+ do {
-+ /* Issue spinup */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ inq->p.cmd24.entry_count = 1;
-+ inq->p.cmd24.nport_handle = fcport->loop_id;
-+ inq->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ inq->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ inq->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ inq->p.cmd24.lun[1] = LSB(lun);
-+ inq->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(inq->p.cmd24.lun,
-+ sizeof(inq->p.cmd24.lun));
-+ inq->p.cmd24.task = TSK_SIMPLE;
-+ inq->p.cmd24.fcp_cdb[0] = START_STOP;
-+ inq->p.cmd24.fcp_cdb[4] = 1;
-+ host_to_fcp_swap(inq->p.cmd24.fcp_cdb,
-+ sizeof(inq->p.cmd24.fcp_cdb));
-+ inq->p.cmd24.dseg_count =
-+ __constant_cpu_to_le16(0);
-+ inq->p.cmd24.timeout =
-+ __constant_cpu_to_le16(20);
-+ inq->p.cmd24.byte_count =
-+ __constant_cpu_to_le32(0);
-+ } else {
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ inq->p.cmd.entry_count = 1;
-+ inq->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, inq->p.cmd.target,
-+ fcport->loop_id);
-+ /* no direction for this command */
-+ inq->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_SIMPLE_TAG);
-+ inq->p.cmd.scsi_cdb[0] = START_STOP;
-+ inq->p.cmd.scsi_cdb[4] = 1; /* Start cycle. */
-+ inq->p.cmd.dseg_count =
-+ __constant_cpu_to_le16(0);
-+ inq->p.cmd.timeout = __constant_cpu_to_le16(20);
-+ inq->p.cmd.byte_count =
-+ __constant_cpu_to_le32(0);
-+ }
-+
-+ rval = qla2x00_issue_iocb(ha, inq, inq_dma,
-+ sizeof(inq_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS &&
-+ inq->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld): START_STOP failed to "
-+ "complete IOCB -- error status (%x).\n",
-+ __func__, ha->host_no,
-+ inq->p.rsp.entry_status));
-+ rval = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(inq->p.rsp24.data));
-+ if (scsi_status &
-+ SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ inq->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s(%ld): SS_CHECK_CONDITION "
-+ "Sense Data %02x %02x %02x %02x "
-+ "%02x %02x %02x %02x\n", __func__,
-+ ha->host_no, sense_data[0], sense_data[1],
-+ sense_data[2], sense_data[3],
-+ sense_data[4], sense_data[5],
-+ sense_data[6], sense_data[7]));
-+ if (sense_data[2] == NOT_READY &&
-+ sense_data[12] == 4 &&
-+ sense_data[13] == 3) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ printk(".");
-+ count--;
-+ } else
-+ retry--;
-+ }
-+
-+ printk(KERN_INFO
-+ "qla_fo(%ld): Sending Start - count %d, retry=%d"
-+ "comp status 0x%x, scsi status 0x%x, rval=%d\n",
-+ ha->host_no, count, retry, comp_status, scsi_status,
-+ rval);
-+
-+ if (rval != QLA_SUCCESS || comp_status != CS_COMPLETE)
-+ retry--;
-+ } while (count && retry && (rval != QLA_SUCCESS ||
-+ comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)));
-+ }
-+
-+ if (rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) {
-+
-+ DEBUG(printk("qla_fo(%ld): Failed spinup - comp status 0x%x, "
-+ "scsi status 0x%x. loop_id=%d\n", ha->host_no, comp_status,
-+ scsi_status, fcport->loop_id));
-+ rval = QLA_FUNCTION_FAILED;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, inq, inq_dma);
-+
-+ LEAVE(__func__);
-+
-+ return (rval);
-+}
-+
-+static lu_path_t *
-+qla2x00_find_lu_path_by_fclun(mp_lun_t *mplun, fc_lun_t *fclun)
-+{
-+ struct list_head *list, *temp;
-+ lu_path_t *tmp_path;
-+ lu_path_t *lu_path = NULL;
-+
-+ list_for_each_safe(list, temp, &mplun->lu_paths){
-+ tmp_path = list_entry(list, lu_path_t, list);
-+ if (tmp_path->fclun == fclun ) {
-+ lu_path = tmp_path;
-+ break;
-+ }
-+ }
-+ return lu_path;
-+}
-+
-+static int
-+qla2x00_update_tpg_states(fc_lun_t *old_lp, fc_lun_t *new_lp)
-+{
-+ mp_tport_grp_t *old_tpg = NULL;
-+ mp_tport_grp_t *new_tpg = NULL;
-+ mp_lun_t *mplun = (mp_lun_t *)new_lp->mplun;
-+ lu_path_t *new_lu_path;
-+ lu_path_t *old_lu_path;
-+ uint8_t passive_state = 0;
-+ struct list_head *list, *temp;
-+ mp_tport_grp_t *tport_grp;
-+
-+ new_lu_path = qla2x00_find_lu_path_by_fclun(mplun,new_lp);
-+ old_lu_path = qla2x00_find_lu_path_by_fclun(mplun,old_lp);
-+ if( new_lu_path == NULL || old_lu_path == NULL) {
-+ return 1;
-+ }
-+ if( new_lu_path == old_lu_path ) {
-+ DEBUG2(printk("%s Ignoring new path_id =%d,"
-+ " old path_id =%d\n",__func__,
-+ new_lu_path->path_id, old_lu_path->path_id));
-+ return 1;
-+ }
-+
-+ /* Always change */
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list) {
-+ tport_grp = list_entry(list, mp_tport_grp_t, list);
-+ if (tport_grp->asym_acc_state != TPG_ACT_OPT) {
-+ passive_state = tport_grp->asym_acc_state;
-+ new_tpg = tport_grp;
-+ } else {
-+ old_tpg = tport_grp;
-+ }
-+ }
-+
-+ if( new_tpg == NULL || old_tpg == NULL) {
-+ return 1;
-+ }
-+
-+ old_tpg->asym_acc_state = passive_state;
-+ new_tpg->asym_acc_state = TPG_ACT_OPT;
-+
-+ old_lu_path->asym_acc_state = old_tpg->asym_acc_state;
-+ new_lu_path->asym_acc_state = new_tpg->asym_acc_state;
-+
-+ DEBUG2(printk("%s TPG STATES: lun %d new_tpg[%d]=%d new tpg %p, "
-+ "old_tpg[%d]=%d old tpg %p\n", __func__, mplun->number,
-+ new_tpg->tpg_id[1], new_tpg->asym_acc_state,
-+ new_tpg,old_tpg->tpg_id[1], old_tpg->asym_acc_state,old_tpg));
-+ DEBUG2(printk("%s lun %d new_lu_path[%d]=%d (new state), "
-+ "old_lun_path[%d]=%d (old state)\n", __func__, mplun->number,
-+ new_lu_path->path_id, new_lu_path->asym_acc_state,
-+ old_lu_path->path_id, old_lu_path->asym_acc_state));
-+
-+ return 0;
-+}
-+
-+static int
-+qla2x00_issue_set_tpg_cdb (fc_lun_t *new_lp)
-+{
-+ int rval = QLA_SUCCESS;
-+ int retry;
-+ uint16_t tpg_count;
-+ //uint16_t tpg_id;
-+ uint16_t lun = 0;
-+ uint8_t passive_state = 0;
-+ dma_addr_t stpg_dma;
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ mp_lun_t *mplun;
-+ set_tport_grp_rsp_t *stpg;
-+ struct list_head *list, *temp;
-+ mp_tport_grp_t *tport_grp;
-+ uint8_t index = 0;
-+ uint16_t comp_status = CS_COMPLETE;
-+ uint16_t scsi_status = 0;
-+ uint16_t *cstatus, *sstatus;
-+ uint8_t *sense_data;
-+
-+ fcport = new_lp->fcport;
-+ ha = fcport->ha;
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-+ DEBUG2(printk("scsi(%ld) %s leaving: Port 0x%02x is marked "
-+ "DEAD\n", ha->host_no,__func__,fcport->loop_id));
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ lun = new_lp->lun;
-+ mplun = new_lp->mplun;
-+ if (mplun == NULL) {
-+ DEBUG(printk("%s mplun does not exist for fclun=%p\n",
-+ __func__,new_lp));
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ /* check for ALUA support */
-+ if (new_lp->asymm_support == TGT_PORT_GRP_UNSUPPORTED ||
-+ new_lp->asymm_support == SET_TGT_PORT_GRP_UNSUPPORTED) {
-+ printk("%s(%ld): lun=%d does not support ALUA\n",__func__,ha->instance,lun);
-+ return rval;
-+ }
-+
-+ stpg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stpg_dma);
-+ if (stpg == NULL) {
-+ printk(KERN_WARNING
-+ "scsi(%ld): Memory Allocation failed - TPG\n",
-+ ha->host_no);
-+ ha->mem_err++;
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ cstatus = &stpg->p.rsp24.comp_status;
-+ sstatus = &stpg->p.rsp24.scsi_status;
-+ sense_data = stpg->p.rsp24.data;
-+ } else {
-+ cstatus = &stpg->p.rsp.comp_status;
-+ sstatus = &stpg->p.rsp.scsi_status;
-+ sense_data = stpg->p.rsp.req_sense_data;
-+ }
-+
-+ retry = 5;
-+ do {
-+ memset(stpg, 0, sizeof(set_tport_grp_rsp_t));
-+
-+ /*
-+ * Right now we support only two tgt port groups. For failover
-+ * to occur the state of the two controller must be opposite to
-+ * each other and different from current state
-+ */
-+ tpg_count = 0;
-+ list_for_each_safe(list, temp, &mplun->tport_grps_list) {
-+ tport_grp = list_entry(list, mp_tport_grp_t, list);
-+ if (tport_grp->asym_acc_state != TPG_ACT_OPT) {
-+ passive_state = tport_grp->asym_acc_state;
-+ stpg->list.descriptor[tpg_count].
-+ asym_acc_state = TPG_ACT_OPT;
-+ } else {
-+ /* save until we have the old setting */
-+ index = tpg_count;
-+ }
-+ memcpy(&stpg->list.descriptor[tpg_count].
-+ tgt_port_grp[0], &tport_grp->tpg_id[0],
-+ sizeof(tport_grp->tpg_id));
-+ DEBUG4(printk("%s lun=%d tpg_id=%d old_tpg_state=%d\n",
-+ __func__, lun, tport_grp->tpg_id[1],
-+ tport_grp->asym_acc_state));
-+ tpg_count++;
-+ }
-+ /* setting the active controller to passive state */
-+ stpg->list.descriptor[index].asym_acc_state = passive_state;
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ stpg->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ stpg->p.cmd24.entry_count = 1;
-+ stpg->p.cmd24.nport_handle = fcport->loop_id;
-+ stpg->p.cmd24.port_id[0] = fcport->d_id.b.al_pa;
-+ stpg->p.cmd24.port_id[1] = fcport->d_id.b.area;
-+ stpg->p.cmd24.port_id[2] = fcport->d_id.b.domain;
-+ stpg->p.cmd24.lun[1] = LSB(lun);
-+ stpg->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(stpg->p.cmd24.lun,
-+ sizeof(stpg->p.cmd24.lun));
-+ stpg->p.cmd24.task = TSK_SIMPLE;
-+ stpg->p.cmd24.task_mgmt_flags =
-+ __constant_cpu_to_le16(TMF_WRITE_DATA);
-+ stpg->p.cmd24.fcp_cdb[0] = SCSIOP_MAINTENANCE_OUT;
-+ stpg->p.cmd24.fcp_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ stpg->p.cmd24.fcp_cdb[8] =
-+ (sizeof(set_tport_grp_data_t) >> 8) & 0xff;
-+ stpg->p.cmd24.fcp_cdb[9] =
-+ sizeof(set_tport_grp_data_t) & 0xff;
-+ host_to_fcp_swap(stpg->p.cmd24.fcp_cdb,
-+ sizeof(stpg->p.cmd24.fcp_cdb));
-+ stpg->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ stpg->p.cmd24.timeout = __constant_cpu_to_le16(10);
-+ stpg->p.cmd24.byte_count = __constant_cpu_to_le32(
-+ sizeof(set_tport_grp_data_t));
-+ stpg->p.cmd24.dseg_0_address[0] = cpu_to_le32(
-+ LSD(stpg_dma + sizeof(struct sts_entry_24xx)));
-+ stpg->p.cmd24.dseg_0_address[1] = cpu_to_le32(
-+ MSD(stpg_dma + sizeof(struct sts_entry_24xx)));
-+ stpg->p.cmd24.dseg_0_len = __constant_cpu_to_le32(
-+ sizeof(set_tport_grp_data_t));
-+ } else {
-+ stpg->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ stpg->p.cmd.entry_count = 1;
-+ stpg->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(ha, stpg->p.cmd.target, fcport->loop_id);
-+ stpg->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_WRITE | CF_SIMPLE_TAG);
-+ stpg->p.cmd.scsi_cdb[0] = SCSIOP_MAINTENANCE_OUT;
-+ stpg->p.cmd.scsi_cdb[1] = SCSISA_TARGET_PORT_GROUPS;
-+ stpg->p.cmd.scsi_cdb[8] =
-+ (sizeof(set_tport_grp_data_t) >> 8) & 0xff;
-+ stpg->p.cmd.scsi_cdb[9] =
-+ sizeof(set_tport_grp_data_t) & 0xff;
-+ stpg->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ stpg->p.cmd.timeout = __constant_cpu_to_le16(10);
-+ stpg->p.cmd.byte_count = __constant_cpu_to_le32(
-+ sizeof(set_tport_grp_data_t));
-+ stpg->p.cmd.dseg_0_address[0] = cpu_to_le32(
-+ LSD(stpg_dma + sizeof(sts_entry_t)));
-+ stpg->p.cmd.dseg_0_address[1] = cpu_to_le32(
-+ MSD(stpg_dma + sizeof(sts_entry_t)));
-+ stpg->p.cmd.dseg_0_length = __constant_cpu_to_le32(
-+ sizeof(set_tport_grp_data_t));
-+ }
-+
-+#if defined(DEBUG4)
-+ for (tpg_count = 0; tpg_count < TGT_PORT_GRP_COUNT;
-+ tpg_count++) {
-+ printk("%s lun=%d tpg_id[0]=%d tpg_id[1]=%d "
-+ "new_tpg_state=%d\n",__func__, lun,
-+ stpg->list.descriptor[tpg_count].tgt_port_grp[0],
-+ stpg->list.descriptor[tpg_count].tgt_port_grp[1],
-+ stpg->list.descriptor[tpg_count].asym_acc_state);
-+ }
-+#endif
-+
-+ rval = qla2x00_issue_iocb(ha, stpg, stpg_dma,
-+ sizeof(set_tport_grp_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && stpg->p.rsp.entry_status != 0) {
-+ DEBUG(printk("%s(%ld): SET_TGT_PORT_GRP failed to "
-+ "complete IOCB -- error status (%x).\n", __func__,
-+ ha->host_no, stpg->p.rsp.entry_status));
-+ rval = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ comp_status = le16_to_cpup(cstatus);
-+ scsi_status = le16_to_cpup(sstatus);
-+
-+ /* Port Logged Out, so don't retry */
-+ if (comp_status == CS_PORT_LOGGED_OUT ||
-+ comp_status == CS_PORT_CONFIG_CHG ||
-+ comp_status == CS_PORT_BUSY ||
-+ comp_status == CS_INCOMPLETE ||
-+ comp_status == CS_PORT_UNAVAILABLE)
-+ break;
-+
-+ if (scsi_status & SS_CHECK_CONDITION) {
-+ /* Skip past any FCP RESPONSE data. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ host_to_fcp_swap(sense_data,
-+ sizeof(stpg->p.rsp24.data));
-+ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID)
-+ sense_data += le32_to_cpu(
-+ stpg->p.rsp24.rsp_data_len);
-+ }
-+
-+ DEBUG2(printk("%s(%ld): SS_CHECK_CONDITION Sense Data "
-+ "%02x %02x %02x %02x %02x %02x %02x %02x\n",
-+ __func__, ha->host_no, sense_data[0], sense_data[1],
-+ sense_data[2], sense_data[3], sense_data[4],
-+ sense_data[5], sense_data[6], sense_data[7]));
-+
-+ /* switched status */
-+ if ((fcport->flags & FC_DSXXX_DEVICE) &&
-+ sense_data[2] == 0x6 && sense_data[12] == 0x29 &&
-+ sense_data[13] == 0x1) {
-+ scsi_status = 0; /* make OK */
-+ break;
-+ }
-+ /* Already switched status */
-+ if ((fcport->flags & FC_DSXXX_DEVICE) &&
-+ sense_data[2] == 0x5 && sense_data[12] == 0x26 &&
-+ sense_data[13] == 0x0) {
-+ scsi_status = 0; /* make OK */
-+ break;
-+ }
-+
-+ if (sense_data[2] == NOT_READY &&
-+ sense_data[12] == 4 && sense_data[13] == 0xa) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(3 * HZ);
-+ printk(".");
-+ }
-+ }
-+ } while ((rval != QLA_SUCCESS || comp_status != CS_COMPLETE ||
-+ (scsi_status & SS_CHECK_CONDITION)) && --retry);
-+
-+ if (rval == QLA_SUCCESS && retry &&
-+ (!((scsi_status & SS_CHECK_CONDITION) &&
-+ (stpg->p.rsp.req_sense_data[2] == NOT_READY )) &&
-+ comp_status == CS_COMPLETE)) {
-+ DEBUG2(printk("%s Set tgt port group Succeded -- lun (%d) "
-+ "cs=0x%x ss=0x%x, rval=%d\n", __func__, lun, comp_status,
-+ scsi_status, rval));
-+ } else {
-+ rval = QLA_FUNCTION_FAILED;
-+ DEBUG2(printk("%s Failed to issue Set tgt port group -- lun "
-+ "(%d) cs=0x%x ss=0x%x, rval=%d\n", __func__, lun,
-+ comp_status, scsi_status, rval));
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, stpg, stpg_dma);
-+
-+ return rval;
-+}
-+
-+uint32_t
-+qla2x00_wait_for_tpg_ready(fc_lun_t *new_lp)
-+{
-+ int seconds = 60;
-+ int rval = 0, completed =0;
-+ uint8_t wait_for_transition;
-+
-+ DEBUG2(printk("%s: entered.\n", __func__));
-+ wait_for_transition = 1;
-+ do {
-+ rval = qla2x00_test_active_lun(new_lp->fcport,
-+ new_lp, &wait_for_transition);
-+ if(rval == 1 || wait_for_transition == 0) {
-+ completed++;
-+ break;
-+ }
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ * 2);
-+ } while (--seconds);
-+
-+ if (completed)
-+ rval = QLA_SUCCESS;
-+ else
-+ rval = QLA_FUNCTION_FAILED;
-+ DEBUG2(printk("%s: leaving rval=%d seconds=%d.\n", __func__,
-+ rval, seconds));
-+
-+ return rval;
-+}
-+
-+
-+
-+
-+/*
-+ * qla2x00_send_fo_notification
-+ * Sends failover notification if needed. Change the fc_lun pointer
-+ * in the old path lun queue.
-+ *
-+ * Input:
-+ * old_lp = Pointer to old fc_lun.
-+ * new_lp = Pointer to new fc_lun.
-+ *
-+ * Returns:
-+ * Local function status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint32_t
-+qla2x00_send_fo_notification(fc_lun_t *old_lp, fc_lun_t *new_lp)
-+{
-+ scsi_qla_host_t *old_ha = old_lp->fcport->ha;
-+ int rval = QLA_SUCCESS;
-+ uint16_t loop_id, lun;
-+ inq_cmd_rsp_t *inq;
-+ dma_addr_t inq_dma;
-+ uint16_t *cstatus = NULL;
-+ uint16_t *sstatus = NULL;
-+
-+
-+ DEBUG3(printk("%s(%ld): entered.\n", __func__, old_ha->host_no));
-+
-+ if (new_lp->fcport == NULL) {
-+ DEBUG2(printk("%s(%ld): No new fcport for lun pointer\n",
-+ __func__, old_ha->host_no));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ loop_id = new_lp->fcport->loop_id;
-+ lun = new_lp->lun;
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_LUN_RESET) {
-+ rval = qla2x00_lun_reset(old_ha, new_lp->fcport, lun);
-+ if (rval == QLA_SUCCESS) {
-+ DEBUG4(printk("%s(%ld): LUN reset succeded\n",
-+ __func__, old_ha->host_no));
-+ } else {
-+ DEBUG4(printk("%s(%ld): LUN reset failed\n", __func__,
-+ old_ha->host_no));
-+ }
-+ }
-+ if (qla_fo_params.FailoverNotifyType ==
-+ FO_NOTIFY_TYPE_LOGOUT_OR_LUN_RESET ||
-+ qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_LOGOUT_OR_CDB) {
-+ rval = qla2x00_fabric_logout(old_ha, loop_id,
-+ new_lp->fcport->d_id.b.domain, new_lp->fcport->d_id.b.area,
-+ new_lp->fcport->d_id.b.al_pa);
-+ if (rval == QLA_SUCCESS) {
-+ DEBUG4(printk("%s(%ld): logout succeded\n", __func__,
-+ old_ha->host_no));
-+ } else {
-+ DEBUG4(printk("%s(%ld): logout failed\n", __func__,
-+ old_ha->host_no));
-+ }
-+ }
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_SPINUP ||
-+ new_lp->fcport->notify_type == FO_NOTIFY_TYPE_SPINUP) {
-+ rval = qla2x00_spinup(new_lp->fcport->ha, new_lp->fcport,
-+ new_lp->lun);
-+ }
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_TPGROUP_CDB ||
-+ old_lp->fcport->notify_type == FO_NOTIFY_TYPE_TPGROUP_CDB) {
-+ /* send set target port group cdb */
-+ rval = qla2x00_issue_set_tpg_cdb(new_lp);
-+ if (rval == QLA_SUCCESS) {
-+ qla2x00_wait_for_tpg_ready(new_lp);
-+ DEBUG2(printk("%s: set tgt port group succeded\n",
-+ __func__));
-+ qla2x00_update_tpg_states(old_lp, new_lp);
-+ } else {
-+ DEBUG2(printk("%s: set tgt port group failed\n",
-+ __func__));
-+ }
-+ }
-+
-+ if (qla_fo_params.FailoverNotifyType == FO_NOTIFY_TYPE_CDB) {
-+ inq = dma_pool_alloc(new_lp->fcport->ha->s_dma_pool,
-+ GFP_KERNEL, &inq_dma);
-+ if (inq == NULL) {
-+ DEBUG4(printk("%s(%ld): memory allocation failed\n",
-+ __func__, old_ha->host_no));
-+
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ if (IS_QLA24XX(old_ha) || IS_QLA54XX(old_ha)) {
-+ cstatus = &inq->p.rsp24.comp_status;
-+ sstatus = &inq->p.rsp24.scsi_status;
-+
-+ memset(inq, 0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd24.entry_type = COMMAND_TYPE_7;
-+ inq->p.cmd24.entry_count = 1;
-+ inq->p.cmd24.nport_handle = loop_id;
-+ inq->p.cmd24.port_id[0] = new_lp->fcport->d_id.b.al_pa;
-+ inq->p.cmd24.port_id[1] = new_lp->fcport->d_id.b.area;
-+ inq->p.cmd24.port_id[2] = new_lp->fcport->d_id.b.domain;
-+ inq->p.cmd24.lun[1] = LSB(lun);
-+ inq->p.cmd24.lun[2] = MSB(lun);
-+ host_to_fcp_swap(inq->p.cmd24.lun,
-+ sizeof(inq->p.cmd24.lun));
-+ inq->p.cmd24.task = TSK_SIMPLE;
-+ memcpy(inq->p.cmd24.fcp_cdb,
-+ qla_fo_params.FailoverNotifyCdb,
-+ qla_fo_params.FailoverNotifyCdbLength);
-+ host_to_fcp_swap(inq->p.cmd24.fcp_cdb,
-+ sizeof(inq->p.cmd24.fcp_cdb));
-+ inq->p.cmd24.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd24.timeout = __constant_cpu_to_le16(0);
-+ inq->p.cmd24.byte_count = __constant_cpu_to_le32(0);
-+ } else {
-+ cstatus = &inq->p.rsp.comp_status;
-+ sstatus = &inq->p.rsp.scsi_status;
-+
-+ memset(inq,0, sizeof(inq_cmd_rsp_t));
-+ inq->p.cmd.entry_type = COMMAND_A64_TYPE;
-+ inq->p.cmd.entry_count = 1;
-+ inq->p.cmd.lun = cpu_to_le16(lun);
-+ SET_TARGET_ID(old_ha, inq->p.cmd.target, loop_id);
-+
-+ /* FIXME: How do you know the direction ???? */
-+ /* This has same issues as passthur commands - you
-+ * need more than just the CDB.
-+ */
-+ inq->p.cmd.control_flags =
-+ __constant_cpu_to_le16(CF_SIMPLE_TAG);
-+ memcpy(inq->p.cmd.scsi_cdb,
-+ qla_fo_params.FailoverNotifyCdb,
-+ qla_fo_params.FailoverNotifyCdbLength);
-+ inq->p.cmd.dseg_count = __constant_cpu_to_le16(1);
-+ inq->p.cmd.byte_count = __constant_cpu_to_le32(0);
-+ }
-+
-+ rval = qla2x00_issue_iocb(old_ha, inq, inq_dma,
-+ sizeof(inq_cmd_rsp_t));
-+
-+ if (rval == QLA_SUCCESS && inq->p.rsp.entry_status != 0) {
-+ DEBUG(printk("scsi(%ld): Send CDB failed to complete "
-+ "IOCB -- error status (%x).\n", old_ha->host_no,
-+ inq->p.rsp.entry_status));
-+ rval = QLA_FUNCTION_FAILED;
-+ } else if (rval != QLA_SUCCESS ||
-+ le16_to_cpup(cstatus) != CS_COMPLETE ||
-+ le16_to_cpup(sstatus) & SS_CHECK_CONDITION ||
-+ inq->inq[0] == 0x7f) {
-+ DEBUG4(printk("%s(%ld): send CDB failed: comp_status "
-+ "= %x scsi_status = %x inq[0] = %x\n", __func__,
-+ old_ha->host_no, le16_to_cpup(cstatus),
-+ le16_to_cpup(sstatus), inq->inq[0]));
-+ }
-+
-+ dma_pool_free(new_lp->fcport->ha->s_dma_pool, inq, inq_dma);
-+ }
-+
-+ DEBUG3(printk("%s: exiting. rval = %d.\n", __func__, rval));
-+
-+ return rval;
-+}
-+
-+
-+/*
-+ * qla2100_fo_enabled
-+ * Reads and validates the failover enabled property.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * instance = HBA number.
-+ *
-+ * Returns:
-+ * 1 when failover is authorized else 0
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+uint8_t
-+qla2x00_fo_enabled(scsi_qla_host_t *ha, int instance)
-+{
-+ return qla2x00_failover_enabled(ha);
-+}
-+
-+/*
-+ * qla2x00_fo_missing_port_summary
-+ * Returns values of devices not connected but found in configuration
-+ * file in user's dd_entry list.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pdd_entry = pointer to a temporary EXT_DEVICEDATAENTRY struct
-+ * pstart_of_entry_list = start of user addr of buffer for dd_entry entries
-+ * max_entries = max number of entries allowed by user buffer
-+ * pentry_cnt = pointer to total number of entries so far
-+ * ret_status = pointer to ioctl status field
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_fo_missing_port_summary(scsi_qla_host_t *ha,
-+ EXT_DEVICEDATAENTRY *pdd_entry, void *pstart_of_entry_list,
-+ uint32_t max_entries, uint32_t *pentry_cnt, uint32_t *ret_status)
-+{
-+ int ret = 0;
-+ uint8_t path_id;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint16_t dev_no;
-+ uint32_t b;
-+ uint32_t current_offset;
-+ uint32_t transfer_size;
-+ mp_device_t *dp;
-+ mp_host_t *host;
-+ mp_path_list_t *pathlist;
-+ mp_path_t *path;
-+ portname_list *portname_used = NULL;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ DEBUG2_9_10(printk("%s(%ld): no HOST for ha inst %ld.\n",
-+ __func__, ha->host_no, ha->instance));
-+ *ret_status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ /* Assumption: each port name cannot appear in more than one mpdev
-+ * structure.
-+ */
-+ for (dev_no = 0; dev_no < MAX_MP_DEVICES && *pentry_cnt < max_entries;
-+ dev_no++) {
-+ dp = host->mp_devs[dev_no];
-+
-+ if (dp == NULL)
-+ continue;
-+
-+ /* Sanity check */
-+ if (qla2x00_is_wwn_zero(dp->nodename))
-+ continue;
-+
-+ if ((pathlist = dp->path_list) == NULL)
-+ continue;
-+
-+ path = pathlist->last;
-+ for (path_id = 0; path_id < pathlist->path_cnt &&
-+ *pentry_cnt < max_entries; path_id++, path = path->next) {
-+
-+ /* Sanity check */
-+ if (qla2x00_is_wwn_zero(path->portname))
-+ continue;
-+
-+ if (path->config && path->port == NULL) {
-+ /* This path was created from config file
-+ * but has not been configured.
-+ */
-+ if (path->host != host) {
-+ /* path on other host. don't report */
-+ DEBUG10(printk("%s(%ld): path host %p "
-+ "not for current host %p.\n",
-+ __func__, ha->host_no, path->host,
-+ host));
-+
-+ continue;
-+ }
-+
-+ /* Check whether we've copied info on this
-+ * port name before. If this is a new port
-+ * name, save the port name so we won't copy
-+ * it again if it's also found on other hosts.
-+ */
-+ if (qla2x00_port_name_in_list(path->portname,
-+ portname_used)) {
-+ DEBUG10(printk("%s(%ld): found previously "
-+ "reported portname=%02x%02x%02x"
-+ "%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no,
-+ path->portname[0],
-+ path->portname[1],
-+ path->portname[2],
-+ path->portname[3],
-+ path->portname[4],
-+ path->portname[5],
-+ path->portname[6],
-+ path->portname[7]));
-+ continue;
-+ }
-+
-+ if ((ret = qla2x00_add_to_portname_list(
-+ path->portname, &portname_used))) {
-+ /* mem alloc error? */
-+ *ret_status = EXT_STATUS_NO_MEMORY;
-+ break;
-+ }
-+
-+ DEBUG10(printk("%s(%ld): returning missing device "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no,
-+ path->portname[0], path->portname[1],
-+ path->portname[2], path->portname[3],
-+ path->portname[4], path->portname[5],
-+ path->portname[6], path->portname[7]));
-+
-+ /* This device was not found. Return
-+ * as unconfigured.
-+ */
-+ memcpy(pdd_entry->NodeWWN, dp->nodename,
-+ WWN_SIZE);
-+ memcpy(pdd_entry->PortWWN, path->portname,
-+ WWN_SIZE);
-+
-+ for (b = 0; b < 3 ; b++)
-+ pdd_entry->PortID[b] = 0;
-+
-+ /* assume fabric dev so api won't translate the portid from loopid */
-+ pdd_entry->ControlFlags = EXT_DEF_GET_FABRIC_DEVICE;
-+
-+ pdd_entry->TargetAddress.Bus = 0;
-+ pdd_entry->TargetAddress.Target = dp->dev_id;
-+ pdd_entry->TargetAddress.Lun = 0;
-+ pdd_entry->DeviceFlags = 0;
-+ pdd_entry->LoopID = 0;
-+ pdd_entry->BaseLunNumber = 0;
-+
-+ current_offset = *pentry_cnt *
-+ sizeof(EXT_DEVICEDATAENTRY);
-+
-+ transfer_size = sizeof(EXT_DEVICEDATAENTRY);
-+
-+ /* now copy up this dd_entry to user */
-+ usr_temp = (uint8_t *)pstart_of_entry_list +
-+ current_offset;
-+ kernel_tmp = (uint8_t *)pdd_entry;
-+ ret = copy_to_user(usr_temp, kernel_tmp,
-+ transfer_size);
-+ if (ret) {
-+ *ret_status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld "
-+ "ERROR copy rsp list buffer.\n",
-+ __func__, ha->host_no,
-+ ha->instance));
-+ break;
-+ }
-+ *pentry_cnt+=1;
-+ }
-+
-+ }
-+
-+ if (ret || *ret_status) {
-+ break;
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): ending entry cnt=%d.\n",
-+ __func__, ha->host_no, *pentry_cnt));
-+
-+ qla2x00_free_portname_list(&portname_used);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting. ret=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_port_name_in_list
-+ * Returns whether we found the specified port name in the list given.
-+ *
-+ * Input:
-+ * wwpn = pointer to ww port name.
-+ * list = pointer to a portname_list list.
-+ *
-+ * Returns:
-+ * 1 = found portname in list
-+ * 0 = portname not in list
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_port_name_in_list(uint8_t *wwpn, portname_list *list)
-+{
-+ int found_name = 0;
-+ portname_list *ptmp;
-+
-+ for (ptmp = list; ptmp; ptmp = ptmp->pnext) {
-+ if (qla2x00_is_nodename_equal(ptmp->portname, wwpn)) {
-+ found_name = 1;
-+ break;
-+ }
-+ }
-+
-+ return (found_name);
-+}
-+
-+/*
-+ * qla2x00_add_to_portname_list
-+ * Allocates a portname_list member and adds it to the list given
-+ * with the specified port name.
-+ *
-+ * Input:
-+ * wwpn = pointer to ww port name.
-+ * plist = pointer to a pointer of portname_list list.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno indicating error
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_add_to_portname_list(uint8_t *wwpn, portname_list **plist)
-+{
-+ portname_list *ptmp, *plast;
-+
-+ ptmp = vmalloc(sizeof(portname_list));
-+ if (!ptmp) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(FO_LUN_DATA_LIST)));
-+ return -ENOMEM;
-+ }
-+
-+ memset(ptmp, 0, sizeof(*ptmp));
-+ memcpy(ptmp->portname, wwpn, EXT_DEF_WWN_NAME_SIZE);
-+
-+ if (*plist) {
-+ /* Add to tail of list */
-+ for (plast = *plist; plast->pnext; plast=plast->pnext)
-+ ;
-+ plast->pnext = ptmp;
-+ } else
-+ *plist = ptmp;
-+
-+ return 0;
-+}
-+
-+/*
-+ * qla2x00_free_portname_list
-+ * Free the list given.
-+ *
-+ * Input:
-+ * plist = pointer to a pointer of portname_list list to free.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla2x00_free_portname_list(portname_list **plist)
-+{
-+ portname_list *ptmp;
-+ portname_list *ptmpnext;
-+
-+ for (ptmp = *plist; ptmp; ptmp = ptmpnext) {
-+ ptmpnext = ptmp->pnext;
-+ vfree(ptmp);
-+ }
-+ *plist = NULL;
-+}
-+
-+/*
-+ * qla2x00_fo_get_lbtype
-+ * Get the lbtype, go thruoug the host->mp_device
-+ * match based on the PortName. If match found
-+ * return the lbtype.
-+ *
-+ * Input:
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_get_lbtype(EXT_IOCTL *pext, int mode)
-+{
-+ scsi_qla_host_t *ha = NULL;
-+ int ret = 0;
-+ int devid = 0;
-+ mp_host_t *host = NULL;
-+ mp_device_t *dp = NULL;
-+ uint16_t idx = 0;
-+ int respSize = 0;
-+
-+ /* Response */
-+ PFOTGTLBDATALIST pTgtLBDataList = NULL;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+ pext->Status = EXT_STATUS_OK;
-+
-+ /* Check resp size */
-+ respSize = sizeof(FOTGTLBDATALIST);
-+
-+ do { /* do 0 for a quick break */
-+
-+ if ((int)pext->ResponseLen < respSize) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s: ERROR ResponseLen %d too small."
-+ "\n", __func__, pext->ResponseLen));
-+ break;
-+ }
-+
-+ /* Allocate memory for response */
-+ pTgtLBDataList = (PFOTGTLBDATALIST)vmalloc(respSize);
-+ if (pTgtLBDataList == NULL) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ break;
-+
-+ }
-+
-+ /* Copy the response from user space */
-+ ret = copy_from_user(pTgtLBDataList,
-+ Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode), respSize);
-+ if (ret) {
-+ DEBUG2_9_10(printk("%s: resp buf copy error. "
-+ "size=%ld.\n",
-+ __func__, (ulong)respSize));
-+
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ ret = (-EFAULT);
-+
-+ break;
-+ }
-+
-+ /* Reserved field is used to pass in HbaInstance */
-+ ha = qla2x00_get_hba((int)pTgtLBDataList->Reserved0);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, (int)pTgtLBDataList->Reserved0));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ DEBUG2_9_10(printk("%s: no HOST for ha inst "
-+ "%ld.\n", __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+ } else {
-+ /* Failover disable,can not loop hosts */
-+ DEBUG2_9_10(printk("%s: Non-failover driver %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+
-+ } while (0);
-+
-+ /* check if error, return */
-+ if (pext->Status != EXT_STATUS_OK) {
-+ /* free any memory and return */
-+ if (pTgtLBDataList) {
-+ vfree(pTgtLBDataList);
-+ }
-+
-+ return (ret);
-+ }
-+
-+ /* go through the mp_devices in host and get all the node name */
-+ for (devid = 0; devid < MAX_MP_DEVICES; devid++) {
-+ dp = host->mp_devs[devid];
-+ if (dp == NULL) {
-+ continue;
-+ }
-+
-+ if (dp->mpdev)
-+ dp = dp->mpdev;
-+
-+ /* go throug the dp to find matching NodeName */
-+ if (qla2x00_is_wwn_zero(&dp->nodename[0])) {
-+ continue;
-+ }
-+
-+ printk(KERN_INFO "%s: %d LB Type is:0x%x\n",
-+ __func__, devid, dp->lbtype);
-+
-+ /* Found a Node Name, get the lbtype */
-+ DEBUG2_9_10(printk("%s: %ld LB Type is:0x%x\n",
-+ __func__, ha->instance, dp->lbtype));
-+
-+ if (idx < MAX_LB_ENTRIES ) {
-+ pTgtLBDataList->Entry[idx].LBPolicy = dp->lbtype;
-+ memcpy(&pTgtLBDataList->Entry[idx].NodeName[0],
-+ &dp->nodename[0], WWN_SIZE);
-+ } else {
-+ DEBUG2_9_10(printk("%s: %ld Array out of bound:\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DATA_OVERRUN;
-+ break;
-+ }
-+
-+ idx++;
-+ pTgtLBDataList->EntryCount = idx;
-+ pext->Status = EXT_STATUS_OK;
-+ }
-+
-+ if (pext->Status == EXT_STATUS_OK ) {
-+ /* copy back the response */
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), pTgtLBDataList, respSize);
-+ if (ret) {
-+ DEBUG2_9_10(printk("%s(%ld): resp %p copy out err.\n",
-+ __func__, ha->host_no,
-+ Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode)));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ ret = (-EFAULT);
-+ }
-+ }
-+
-+ /* free memory */
-+ if (pTgtLBDataList) {
-+ vfree(pTgtLBDataList);
-+ }
-+
-+ DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret));
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_fo_set_lbtype
-+ * Set the lbtype, go thruoug the host->mp_device
-+ * match based on the NodeName. If match found
-+ * set the lbtype.
-+ *
-+ * Input:
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_fo_set_lbtype(EXT_IOCTL *pext, int mode)
-+{
-+ scsi_qla_host_t *ha = NULL;
-+ int ret = 0;
-+ int devid = 0;
-+ int requestSize = 0;
-+ uint16_t entryCount = 0;
-+ uint16_t idx = 0;
-+ mp_host_t *host = NULL;
-+ mp_host_t *tmp_host = NULL;
-+ mp_device_t *dp = NULL;
-+
-+ /* Request */
-+ PFOTGTLBDATALIST pTgtLBDataList = NULL;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ pext->Status = EXT_STATUS_OK;
-+ requestSize = sizeof(FOTGTLBDATALIST);
-+
-+ do { /* do 0 for a quick break */
-+
-+ if ((int)pext->RequestLen < requestSize) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ pext->DetailStatus = EXT_DSTATUS_REQUEST_LEN;
-+ DEBUG10(printk("%s: got invalie req len (%d).\n",
-+ __func__, pext->RequestLen));
-+ break;
-+ }
-+
-+ /* Allocate memory for request */
-+ pTgtLBDataList = (PFOTGTLBDATALIST)vmalloc(requestSize);
-+ if (pTgtLBDataList == NULL) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ break;
-+ }
-+
-+ /* Copy the request from user space */
-+ ret = copy_from_user(pTgtLBDataList,
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode),
-+ requestSize);
-+ if (ret) {
-+ DEBUG2_9_10(printk("%s: req buf copy error size=%ld.\n",
-+ __func__, (ulong)requestSize));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ ret = (-EFAULT);
-+ break;
-+ }
-+
-+ /* Reserved field is used to pass in HbaInstance */
-+ ha = qla2x00_get_hba((int)pTgtLBDataList->Reserved0);
-+
-+ if (!ha) {
-+ DEBUG2_9_10(printk("%s: no ha matching inst %d.\n",
-+ __func__, (int)pTgtLBDataList->Reserved0));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+
-+ if (qla2x00_failover_enabled(ha)) {
-+ if ((host = qla2x00_cfg_find_host(ha)) == NULL) {
-+ DEBUG2_9_10(printk("%s: no HOST for ha inst "
-+ "%ld.\n", __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+ } else {
-+ /* Failover disable,can not loop hosts */
-+ DEBUG2_9_10(printk("%s: Non-failover driver %ld.\n",
-+ __func__, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ break;
-+ }
-+
-+ } while (0);
-+
-+ /* check if error, return */
-+ if (pext->Status != EXT_STATUS_OK) {
-+ /* free any memory and return */
-+ if (pTgtLBDataList) {
-+ vfree(pTgtLBDataList);
-+ }
-+ return (pext->Status);
-+ }
-+
-+ /* Loop for all the targets here */
-+ entryCount = pTgtLBDataList->EntryCount;
-+ DEBUG9(printk("%s(): Entry Count = %d\n", __func__, entryCount));
-+ for (idx = 0; idx < entryCount; idx++) {
-+ devid = 0;
-+ /* reset Status */
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9(printk("%s(): Status reset\n", __func__));
-+
-+ /* go through all the hosts and set the lbtype
-+ * in matching dp->node name
-+ */
-+ for (tmp_host = mp_hosts_base; (tmp_host);
-+ tmp_host = tmp_host->next) {
-+
-+ /* go through the mp_devices in host and
-+ * match the node name
-+ */
-+ for (devid = 0; devid < MAX_MP_DEVICES; devid++) {
-+ dp = tmp_host->mp_devs[devid];
-+
-+ if (dp == NULL) {
-+ continue;
-+ }
-+
-+ /* go throug the dp to find matching NodeName */
-+ if (qla2x00_is_wwn_zero(&dp->nodename[0])) {
-+ continue;
-+ }
-+
-+ if (memcmp(&dp->nodename[0],
-+ &pTgtLBDataList->Entry[idx].NodeName[0],
-+ WWN_SIZE) == 0) {
-+ /* Found matching Node Name,
-+ * set the lbtype
-+ */
-+
-+ DEBUG2_9_10(printk("%s: %ld LB Type is:"
-+ " 0x%x\n",
-+ __func__, ha->instance, dp->lbtype));
-+
-+ dp->lbtype =
-+ pTgtLBDataList->Entry[idx].LBPolicy;
-+
-+ DEBUG2_9_10(printk("%s: %ld LB Type "
-+ "after is: 0x%x\n",
-+ __func__, ha->instance, dp->lbtype));
-+ pext->Status = EXT_STATUS_OK;
-+ break; /* search for next */
-+ }
-+ }
-+ }
-+ }
-+
-+ if (pTgtLBDataList) {
-+ vfree(pTgtLBDataList);
-+ }
-+
-+ DEBUG9(printk("%s: exiting. ret = %d.\n", __func__, ret));
-+ return (ret);
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_fo.h ./drivers/scsi/qla2xxx/qla_fo.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_fo.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_fo.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,63 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/*
-+ * QLogic ISP2x00 Failover Header
-+ *
-+ */
-+#ifndef _QLA_FO_H
-+#define _QLA_FO_H
-+
-+#if defined(__cplusplus)
-+extern "C"
-+{
-+#endif
-+
-+#include "qlfo.h"
-+ /*
-+ * This structure definition is for a scsi I/O request NOT subject to
-+ * failover re-routing. It is for the use of configuration operations
-+ * and diagnostics functions as definted in ExIoct.h
-+ */
-+ typedef struct scsi_cdb_request {
-+ struct adapter_state *ha;
-+ uint16_t target;
-+ uint16_t lun;
-+ uint8_t *cdb_ptr; /* Pointer to cdb to be sent */
-+ uint8_t cdb_len; /* cdb length */
-+ uint8_t direction; /* Direction of I/O for buffer */
-+ uint8_t scb_len; /* Scsi completion block length */
-+ uint8_t *scb_ptr; /* Scsi completion block pointer */
-+ uint8_t *buf_ptr; /* Pointer to I/O buffer */
-+ uint16_t buf_len; /* Buffer size */
-+ }
-+ SCSI_REQ_t, *SCSI_REQ_p;
-+
-+
-+ /*
-+ * Special defines
-+ */
-+ typedef union _FO_HBA_STAT {
-+ FO_HBA_STAT_INPUT input;
-+ FO_HBA_STAT_INFO info;
-+ } FO_HBA_STAT;
-+
-+ typedef union _FO_LUN_DATA {
-+ FO_LUN_DATA_INPUT input;
-+ FO_LUN_DATA_LIST list;
-+ } FO_LUN_DATA;
-+
-+ typedef union _FO_TARGET_DATA {
-+ FO_TARGET_DATA_INPUT input;
-+ FO_DEVICE_DATABASE list;
-+ } FO_TARGET_DATA;
-+
-+#if defined(__cplusplus)
-+}
-+#endif
-+
-+#endif /* ifndef _QLA_FO_H */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_foln.c ./drivers/scsi/qla2xxx/qla_foln.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_foln.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_foln.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,508 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+#include <linux/moduleparam.h>
-+
-+#include "qlfo.h"
-+#include "qlfolimits.h"
-+#include "qla_foln.h"
-+
-+int ql2xfailover = 1;
-+module_param(ql2xfailover, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql2xfailover,
-+ "Driver failover support: 0 to disable; 1 to enable.");
-+
-+int ql2xrecoveryTime = MAX_RECOVERYTIME;
-+module_param_named(recoveryTime, ql2xrecoveryTime, int, S_IRUGO|S_IWUSR);
-+MODULE_PARM_DESC(recoveryTime,
-+ "Recovery time in seconds before a target device is sent I/O "
-+ "after a failback is performed.");
-+
-+int ql2xfailbackTime = MAX_FAILBACKTIME;
-+module_param_named(failbackTime, ql2xfailbackTime, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(failbackTime,
-+ "Delay in seconds before a failback is performed.");
-+
-+int MaxPathsPerDevice = 0;
-+module_param(MaxPathsPerDevice, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxPathsPerDevice,
-+ "Maximum number of paths to a device. Default 8.");
-+
-+int MaxRetriesPerPath = 0;
-+module_param(MaxRetriesPerPath, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxRetriesPerPath,
-+ "How many retries to perform on the current path before "
-+ "failing over to the next path in the path list.");
-+
-+int MaxRetriesPerIo = 0;
-+module_param(MaxRetriesPerIo, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(MaxRetriesPerIo,
-+ "How many total retries to do before failing the command and "
-+ "returning to the OS with a DID_NO_CONNECT status.");
-+
-+int qlFailoverNotifyType = 0;
-+module_param(qlFailoverNotifyType, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(qlFailoverNotifyType,
-+ "Failover notification mechanism to use when a failover or "
-+ "failback occurs.");
-+
-+int ql2xlbType = 0;
-+module_param(ql2xlbType, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql2xlbType,
-+ "Load Balance Method : (0) None (1) static load balance and "
-+ "Default : 0 All the luns exposed on the first active path"
-+ " : 1 For static load balance across active optimised"
-+ " controller ports"
-+ " : 2 For LRU"
-+ " : 3 For LST");
-+
-+int ql2xexcludemodel = 0;
-+module_param(ql2xexcludemodel, int, 0);
-+MODULE_PARM_DESC(ql2xexcludemodel,
-+ "Exclude device models from being marked as failover capable."
-+ "Combine one or more of the following model numbers into "
-+ "an exclusion mask: "
-+ "0x20 - HSV210, 0x10 - DSXXX, "
-+ "0x04 - HSV110, 0x02 - MSA1000, 0x01 - XP128.");
-+
-+int ql2xtgtemul = 1;
-+module_param(ql2xtgtemul, int, 0);
-+MODULE_PARM_DESC(ql2xtgtemul,
-+ "Enable/Disable target combining emulation."
-+ "Default : 1 Enable target failover emulation for targets "
-+ "created by lunid matching"
-+ " : 0 Disable target failover emulation");
-+
-+int ql2xautorestore = 0;
-+/* Bit Map Values assigend to these devices are in-sync with
-+ * values assigned to these devices in the cfg_device_list[]
-+ * table. To add other devices use the bit map value assigned
-+ * to it in the above mentioned device table.
-+ */
-+module_param(ql2xautorestore,int, 0);
-+MODULE_PARM_DESC(ql2xautorestore,
-+ " Enable or disable auto-restore for the specified devices. "
-+ " Combine one or more of the following model numbers into "
-+ " an mask to toggle the default condition of autorestore: "
-+ " MSA1000: 0x2, EVA: 0x4, EVA A/A: 0x20, MSA A/A: 0x80"
-+ " For Ex: passing value of 0x6 will enable autorestore for"
-+ " both: MSA1000 and EVA since the default condition is disable.");
-+
-+int ql2xmap2actpath = 0;
-+module_param(ql2xmap2actpath,int, 0);
-+MODULE_PARM_DESC(ql2xmap2actpath,
-+ " Enable OS mapping to the active port for"
-+ "Active/Passive devices. "
-+ "0 to disable; 1 to enable.");
-+
-+struct cfg_device_info cfg_device_list[] = {
-+
-+ {"HP", "MSA CONTROLLER", BIT_7, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"HP", "MSA VOLUME", BIT_7, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"COMPAQ", "MSA1000", BIT_1, FO_NOTIFY_TYPE_SPINUP,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"HITACHI", "OPEN-", BIT_0, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"HP", "OPEN-", BIT_0, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"COMPAQ", "HSV110 (C)COMPAQ", 4, FO_NOTIFY_TYPE_SPINUP,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"HP", "HSV100", BIT_2, FO_NOTIFY_TYPE_SPINUP,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"DEC", "HSG80", BIT_3, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_export_target, NULL, NULL, NULL },
-+ {"IBM", "DS400", BIT_4, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"COMPAQ", "HSV111 (C)COMPAQ", BIT_5, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"HP", "HSV101", BIT_5, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"HP", "HSV200", BIT_5, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"HP", "HSV210", BIT_5, FO_NOTIFY_TYPE_TPGROUP_CDB,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_ports,
-+ NULL, NULL, NULL},
-+ {"HITACHI", "DF600", BIT_8, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, NULL, NULL, NULL },
-+ {"HP", "NVS1000 ", BIT_9, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, qla2x00_get_target_xports,
-+ NULL, NULL, NULL},
-+ {"DataCore", "SANsymphony", BIT_10, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, NULL,
-+ NULL, NULL, NULL},
-+ {"DataCore", "SANmelody", BIT_10, FO_NOTIFY_TYPE_NONE,
-+ qla2x00_combine_by_lunid, NULL,
-+ NULL, NULL, NULL},
-+
-+ /*
-+ * Must be at end of list...
-+ */
-+ {NULL, NULL }
-+};
-+
-+/*
-+ * qla2x00_check_for_devices_online
-+ *
-+ * Check fcport state of all devices to make sure online.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Return:
-+ * None.
-+ *
-+ * Context:
-+ */
-+static uint8_t
-+qla2x00_check_for_devices_online(scsi_qla_host_t *ha)
-+{
-+ fc_port_t *fcport;
-+
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if(fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if ((atomic_read(&fcport->state) == FCS_ONLINE) ||
-+ (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
-+ fcport->flags & FC_FAILBACK_DISABLE)
-+ continue;
-+
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+/*
-+ * qla2x00_failover_cleanup
-+ * Cleanup queues after a failover.
-+ *
-+ * Input:
-+ * sp = command pointer
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+void
-+qla2x00_failover_cleanup(srb_t *sp)
-+{
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->host_scribble = (unsigned char *) NULL;
-+ if ( (sp->flags & SRB_GOT_SENSE) ) {
-+ sp->flags &= ~SRB_GOT_SENSE;
-+ sp->cmd->sense_buffer[0] = 0;
-+ }
-+ /* turn-off all failover flags */
-+ sp->flags = sp->flags & ~(SRB_RETRY|SRB_FAILOVER|SRB_FO_CANCEL);
-+}
-+
-+int
-+qla2x00_suspend_failover_targets(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ struct list_head *list, *temp;
-+ srb_t *sp;
-+ int count;
-+ os_tgt_t *tq;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ count = ha->failover_cnt;
-+ list_for_each_safe(list, temp, &ha->failover_queue) {
-+ sp = list_entry(ha->failover_queue.next, srb_t, list);
-+ tq = sp->tgt_queue;
-+ if (!(test_bit(TQF_SUSPENDED, &tq->flags)))
-+ set_bit(TQF_SUSPENDED, &tq->flags);
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return count;
-+}
-+
-+srb_t *
-+qla2x00_failover_next_request(scsi_qla_host_t *ha)
-+{
-+ unsigned long flags;
-+ srb_t *sp = NULL;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ if (!list_empty(&ha->failover_queue)) {
-+ sp = list_entry(ha->failover_queue.next, srb_t, list);
-+ __del_from_failover_queue(ha, sp);
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return sp;
-+}
-+
-+/*
-+ * qla2x00_process_failover
-+ * Process any command on the failover queue.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+static void
-+qla2x00_process_failover(scsi_qla_host_t *ha)
-+{
-+
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+ srb_t *sp;
-+ fc_port_t *fcport;
-+ uint32_t t, l;
-+ scsi_qla_host_t *vis_ha = ha;
-+ int count, i;
-+
-+ DEBUG2(printk(KERN_INFO "%s: hba %ld active=%ld, retry=%d, "
-+ "done=%ld, failover=%d, scsi retry=%d commands.\n",
-+ __func__,
-+ ha->host_no,
-+ ha->actthreads,
-+ ha->retry_q_cnt,
-+ ha->done_q_cnt,
-+ ha->failover_cnt,
-+ ha->scsi_retry_q_cnt));
-+
-+ /* Prevent acceptance of new I/O requests for failover target. */
-+ count = qla2x00_suspend_failover_targets(ha);
-+
-+ /*
-+ * Process all the commands in the failover queue. Attempt to failover
-+ * then either complete the command as is or requeue for retry.
-+ */
-+ for (i = 0; i < count ; i++) {
-+ sp = qla2x00_failover_next_request(ha);
-+ if (!sp)
-+ break;
-+
-+ qla2x00_extend_timeout(sp->cmd, 360);
-+ if (i == 0)
-+ vis_ha =
-+ (scsi_qla_host_t *)sp->cmd->device->host->hostdata;
-+
-+ tq = sp->tgt_queue;
-+ lq = sp->lun_queue;
-+ fcport = lq->fclun->fcport;
-+
-+ DEBUG2(printk("%s(): pid %ld retrycnt=%d, fcport =%p, "
-+ "state=0x%x, \nloop state=0x%x fclun=%p, lq fclun=%p, "
-+ "lq=%p, lun=%d\n", __func__, sp->cmd->serial_number,
-+ sp->cmd->retries, fcport, atomic_read(&fcport->state),
-+ atomic_read(&ha->loop_state), sp->fclun, lq->fclun, lq,
-+ lq->fclun->lun));
-+ if (sp->err_id == SRB_ERR_DEVICE && sp->fclun == lq->fclun &&
-+ atomic_read(&fcport->state) == FCS_ONLINE) {
-+ if (!(qla2x00_test_active_lun(fcport, sp->fclun, NULL))) {
-+ DEBUG2(printk("scsi(%ld) %s Detected INACTIVE "
-+ "Port 0x%02x \n", ha->host_no, __func__,
-+ fcport->loop_id));
-+ sp->err_id = SRB_ERR_OTHER;
-+ sp->cmd->sense_buffer[2] = 0;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ }
-+ }
-+ if ((sp->flags & SRB_GOT_SENSE)) {
-+ sp->flags &= ~SRB_GOT_SENSE;
-+ sp->cmd->sense_buffer[0] = 0;
-+ sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->host_scribble = (unsigned char *) NULL;
-+ }
-+
-+ /*** Select an alternate path ***/
-+
-+ /* if load balancing is enabled then adjust lq->fclun */
-+ if (qla2x00_cfg_is_lbenable(sp->fclun))
-+ lq->fclun = sp->fclun;
-+
-+ /*
-+ * If the path has already been change by a previous request
-+ * sp->fclun != lq->fclun
-+ */
-+ if (sp->err_id != SRB_ERR_OTHER) {
-+ if (atomic_read(&fcport->ha->loop_state) == LOOP_DEAD)
-+ sp->err_id = SRB_ERR_LOOP;
-+ else
-+ sp->err_id = SRB_ERR_PORT;
-+ }
-+ if (sp->fclun != lq->fclun || (sp->err_id != SRB_ERR_OTHER &&
-+ (atomic_read(&fcport->ha->loop_state) != LOOP_DEAD) &&
-+ atomic_read(&fcport->state) != FCS_DEVICE_DEAD)) {
-+ qla2x00_failover_cleanup(sp);
-+ } else if (qla2x00_cfg_failover(ha,
-+ lq->fclun, tq, sp) == NULL) {
-+ /*
-+ * We ran out of paths, so just retry the status which
-+ * is already set in the cmd. We want to serialize the
-+ * failovers, so we make them go thur visible HBA.
-+ */
-+ printk(KERN_INFO
-+ "%s(): Ran out of paths - pid %ld - retrying\n",
-+ __func__, sp->cmd->serial_number);
-+ } else {
-+ /*
-+ * if load balancing is enabled then we need to flush the
-+ * other requests for the same lun
-+ */
-+ if( qla2x00_cfg_is_lbenable(sp->fclun) ){
-+ DEBUG2(printk("%s(): Flushing fo queue"
-+ " for lq=%p\n",
-+ __func__,
-+ lq));
-+ qla2x00_flush_failover_q(vis_ha, lq);
-+ }
-+ qla2x00_failover_cleanup(sp);
-+
-+ }
-+ add_to_done_queue(ha, sp);
-+ }
-+
-+ for (t = 0; t < vis_ha->max_targets; t++) {
-+ if ((tq = vis_ha->otgt[t]) == NULL)
-+ continue;
-+ if (test_and_clear_bit(TQF_SUSPENDED, &tq->flags)) {
-+ /* EMPTY */
-+ DEBUG2(printk("%s(): remove suspend for target %d\n",
-+ __func__, t));
-+ }
-+ for (l = 0; l < vis_ha->max_luns; l++) {
-+ if ((lq = (os_lun_t *) tq->olun[l]) == NULL)
-+ continue;
-+
-+ if( test_and_clear_bit(LUN_MPIO_BUSY, &lq->q_flag) ) {
-+ /* EMPTY */
-+ DEBUG(printk("%s(): remove suspend for "
-+ "lun %d\n", __func__, lq->fclun->lun));
-+ }
-+ }
-+ }
-+ qla2x00_restart_queues(ha, 0);
-+
-+ DEBUG(printk("%s() - done", __func__));
-+}
-+
-+int
-+qla2x00_search_failover_queue(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-+{
-+ struct list_head *list, *temp;
-+ unsigned long flags;
-+ srb_t *sp;
-+
-+ DEBUG3(printk("qla2xxx_eh_abort: searching sp %p in failover queue.\n",
-+ CMD_SP(cmd)));
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_safe(list, temp, &ha->failover_queue) {
-+ sp = list_entry(list, srb_t, list);
-+
-+ if (cmd == sp->cmd)
-+ goto found;
-+
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return 0;
-+
-+ found:
-+ /* Remove srb from failover queue. */
-+ __del_from_failover_queue(ha, sp);
-+ cmd->result = DID_ABORT << 16;
-+ __add_to_done_queue(ha, sp);
-+
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+ return 1;
-+}
-+
-+/*
-+ * If we are not processing a ioctl or one of
-+ * the ports are still MISSING or need a resync
-+ * then process the failover event.
-+ */
-+void
-+qla2x00_process_failover_event(scsi_qla_host_t *ha)
-+{
-+ if (test_bit(CFG_ACTIVE, &ha->cfg_flags))
-+ return;
-+ if (qla2x00_check_for_devices_online(ha)) {
-+ if (test_and_clear_bit(FAILOVER_EVENT, &ha->dpc_flags)) {
-+ if (ha->flags.online)
-+ qla2x00_cfg_event_notify(ha, ha->failover_type);
-+ }
-+ }
-+
-+ /*
-+ * Get any requests from failover queue
-+ */
-+ if (test_and_clear_bit(FAILOVER_NEEDED, &ha->dpc_flags))
-+ qla2x00_process_failover(ha);
-+}
-+
-+int
-+qla2x00_do_fo_check(scsi_qla_host_t *ha, srb_t *sp, scsi_qla_host_t *vis_ha)
-+{
-+ /*
-+ * This routine checks for DID_NO_CONNECT to decide
-+ * whether to failover to another path or not. We only
-+ * failover on that status.
-+ */
-+ if (sp->lun_queue->fclun->fcport->flags & FC_FAILOVER_DISABLE)
-+ return 0;
-+
-+ if (sp->lun_queue->fclun->flags & FLF_VISIBLE_LUN)
-+ return 0;
-+
-+ if (!qla2x00_fo_check(ha, sp))
-+ return 0;
-+
-+ if ((sp->state != SRB_FAILOVER_STATE)) {
-+ /*
-+ * Retry the command on this path
-+ * several times before selecting a new
-+ * path.
-+ */
-+ add_to_pending_queue_head(vis_ha, sp);
-+ qla2x00_next(vis_ha);
-+ } else
-+ qla2x00_extend_timeout(sp->cmd, EXTEND_CMD_TIMEOUT);
-+
-+ return 1;
-+}
-+
-+void
-+qla2xxx_start_all_adapters(scsi_qla_host_t *ha)
-+{
-+ struct list_head *hal;
-+ scsi_qla_host_t *vis_ha;
-+
-+ /* Try and start all visible adapters */
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each(hal, &qla_hostlist) {
-+ vis_ha = list_entry(hal, scsi_qla_host_t, list);
-+
-+ if (!list_empty(&vis_ha->pending_queue))
-+ qla2x00_next(vis_ha);
-+
-+ DEBUG2(printk("host(%ld):Commands busy=%d "
-+ "failed=%d eh_active=%d\n ",
-+ vis_ha->host_no, vis_ha->host->host_busy,
-+ vis_ha->host->host_failed,
-+ qla2x00_is_eh_active(vis_ha->host)));
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_foln.h ./drivers/scsi/qla2xxx/qla_foln.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_foln.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_foln.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,378 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#ifndef __QLA_FOLN_H
-+#define __QLA_FOLN_H
-+
-+#if defined(CONFIG_SCSI_QLA2XXX_FAILOVER)
-+
-+#include "exioct.h"
-+#include "qla_fo.h"
-+#include "qla_cfg.h"
-+
-+// Inbound or Outbound tranfer of data
-+#define QLA2X00_UNKNOWN 0
-+#define QLA2X00_READ 1
-+#define QLA2X00_WRITE 2
-+
-+/*
-+ * Device configuration table
-+ *
-+ * This table provides a library of information about the device
-+ */
-+struct cfg_device_info {
-+ const char *vendor;
-+ const char *model;
-+ const int flags; /* bit 0 (0x1) -- translate the real
-+ WWNN to the common WWNN for the target AND
-+ XP_DEVICE */
-+ /* bit 1 -- MSA 1000 */
-+ /* bit 2 -- EVA */
-+ /* bit 3 -- DISABLE FAILOVER */
-+ /* bit 4 -- Adaptec failover */
-+ /* bit 5 -- EVA AA failover */
-+ /* bit 6 -- IBM */
-+ /* bit 7 -- MSA AA failover */
-+ /* bit 8 -- HDS */
-+ /* bit 9 -- Incipient */
-+ const int notify_type; /* support the different types: 1 - 4 */
-+ int ( *fo_combine)(void *,
-+ uint16_t, fc_port_t *, uint16_t );
-+ /* Devices which support Report Target Port Groups */
-+ int (*fo_target_port) (fc_port_t *, fc_lun_t *, int);
-+ int ( *fo_detect)(void);
-+ int ( *fo_notify)(void);
-+ int ( *fo_select)(void);
-+};
-+
-+#define VITAL_PRODUCT_DATA_SIZE 128
-+#define INQ_EVPD_SET 1
-+#define INQ_DEV_IDEN_PAGE 0x83
-+#define WWLUN_SIZE 32
-+/* code set values */
-+#define CODE_SET_BINARY 0x01
-+
-+/* Association field values */
-+#define ASSOCIATION_LOGICAL_DEVICE 0x00
-+#define ASSOCIATION_TARGET_PORT 0x01
-+#define ASSOCIATION_TARGET_DEVICE 0x02
-+
-+/* Identifier type values */
-+#define TYPE_REL_TGT_PORT 0x04
-+#define TYPE_TPG_GROUP 0x05
-+
-+/* Identifier length */
-+#define DEFAULT_IDENT_LEN 4
-+
-+/* Volume Access Control VPD Page */
-+#define VOL_ACCESS_CTRL_VPD_PAGE 0xc9
-+
-+/* Volume Preferred Path Priority */
-+#define PREFERRED_PATH_PRIORITY 0x1
-+#define SECONDARY_PATH_PRIORITY 0x2
-+
-+/* Volume Ownership VPD Page */
-+#define VOL_OWNERSHIP_VPD_PAGE 0xe0
-+#define VOL_OWNERSHIP_BIT BIT_6
-+#define VOL_OWNERSHIP_BIT_VALID BIT_7
-+
-+
-+typedef struct {
-+ union {
-+ cmd_a64_entry_t cmd;
-+ sts_entry_t rsp;
-+ struct cmd_type_7 cmd24;
-+ struct sts_entry_24xx rsp24;
-+ } p;
-+ uint8_t inq[VITAL_PRODUCT_DATA_SIZE];
-+} evpd_inq_cmd_rsp_t;
-+
-+typedef struct {
-+ union {
-+ cmd_a64_entry_t cmd;
-+ sts_entry_t rsp;
-+ struct cmd_type_7 cmd24;
-+ struct sts_entry_24xx rsp24;
-+ } p;
-+} tur_cmd_rsp_t;
-+
-+/* We know supports 2 x 2 - 2 target port groups with 2 relative
-+* target ports each. */
-+/* SCSI Report/Set Target Port Groups command and data definitions */
-+#define SCSIOP_MAINTENANCE_IN 0xA3
-+#define SCSIOP_MAINTENANCE_OUT 0xA4
-+
-+#define SCSISA_TARGET_PORT_GROUPS 0x0A
-+
-+#define TGT_PORT_GRP_COUNT 2
-+#define REL_TGT_PORT_GRP_COUNT 2
-+
-+/* RTPG parameter data format */
-+typedef struct {
-+ uint32_t len;
-+ /* Variable-length descriptors.*/
-+ uint8_t tpg_desc_entry[1];
-+} rtpg_param_data_t;
-+
-+/* Qlogic RTPG IOCB format */
-+typedef struct {
-+ union {
-+ cmd_a64_entry_t cmd;
-+ sts_entry_t rsp;
-+ struct cmd_type_7 cmd24;
-+ struct sts_entry_24xx rsp24;
-+ } p;
-+ rtpg_param_data_t data;
-+} rtpg_param_data_rsp_t;
-+
-+typedef struct {
-+ uint8_t obsolete[2];
-+ uint8_t rel_port_id[2];
-+} rel_tport_desc_t;
-+
-+/* Target Port Groups descriptor format */
-+typedef struct {
-+ struct {
-+ /* indicates the state of corresponding tgt port group */
-+ uint8_t asym_acc_state : 4;
-+ uint8_t rsvd_1 : 3;
-+ uint8_t pref :1;
-+
-+ uint8_t supp_acc_state : 4;
-+ uint8_t rsvd_2 : 4;
-+ } state;
-+ /* 1st target port group identifier */
-+ uint8_t tpg_id[2];
-+ uint8_t rsvd;
-+ /* indicates reason for the last fail over operation */
-+ uint8_t status_code;
-+ uint8_t vendor_unique;
-+ /* no of ports on this controller */
-+ uint8_t tgt_port_count;
-+ /* Variable-length data.*/
-+ rel_tport_desc_t rel_tgt_port_entry[1];
-+} tpg_desc_t;
-+
-+
-+/* Single port per tgt port grp descriptor */
-+typedef struct {
-+ struct {
-+ /* indicates the state of corresponding tgt port group */
-+ uint8_t asym_acc_state : 4;
-+ uint8_t rsvd_1 : 3;
-+ uint8_t pref :1;
-+
-+ uint8_t supp_acc_state : 4;
-+ uint8_t rsvd_2 : 4;
-+ } state;
-+ /* identifies the controller */
-+ uint8_t tgt_port_grp[2];
-+ uint8_t rsvd;
-+ /* indicates reason for the last fail over operation */
-+ uint8_t status_code;
-+ uint8_t vendor_unique;
-+ /* no of ports on corresponding controller */
-+ uint8_t tgt_port_count;
-+ uint8_t rel_tgt_port[REL_TGT_PORT_GRP_COUNT][4];
-+} tgt_port_grp_desc;
-+
-+/* Single port per tgt port grp descriptor */
-+typedef struct {
-+ struct {
-+ /* indicates the state of corresponding tgt port group */
-+ uint8_t asym_acc_state : 4;
-+ uint8_t rsvd_1 : 3;
-+ uint8_t pref :1;
-+
-+ uint8_t supp_acc_state : 4;
-+ uint8_t rsvd_2 : 4;
-+ } state;
-+ /* identifies the controller */
-+ uint8_t tgt_port_grp[2];
-+ uint8_t rsvd;
-+ /* indicates reason for the last fail over operation */
-+ uint8_t status_code;
-+ uint8_t vendor_unique;
-+ /* no of ports on corresponding controller */
-+ uint8_t tgt_port_count;
-+ /* Single port per controller */
-+ uint8_t rel_tgt_port[4];
-+} tgt_port_grp_desc_0;
-+
-+
-+typedef struct {
-+ uint32_t len;
-+ //rename it to descriptor ??
-+ tgt_port_grp_desc tport_grp[TGT_PORT_GRP_COUNT];
-+} rpt_tport_grp_data_t;
-+
-+typedef struct {
-+ union {
-+ cmd_a64_entry_t cmd;
-+ sts_entry_t rsp;
-+ struct cmd_type_7 cmd24;
-+ struct sts_entry_24xx rsp24;
-+ } p;
-+ rpt_tport_grp_data_t list;
-+} rpt_tport_grp_rsp_t;
-+
-+typedef struct {
-+ /* indicates the state of corresponding tgt port group */
-+ uint8_t asym_acc_state : 4;
-+ uint8_t rsvd_1 : 4;
-+ uint8_t rsvd_2;
-+ /* identifies the controller */
-+ uint8_t tgt_port_grp[2];
-+} set_tgt_port_grp_desc;
-+
-+typedef struct {
-+ uint32_t rsvd;
-+ set_tgt_port_grp_desc descriptor[TGT_PORT_GRP_COUNT];
-+} set_tport_grp_data_t;
-+
-+typedef struct {
-+ union {
-+ cmd_a64_entry_t cmd;
-+ sts_entry_t rsp;
-+ struct cmd_type_7 cmd24;
-+ struct sts_entry_24xx rsp24;
-+ } p;
-+ set_tport_grp_data_t list;
-+} set_tport_grp_rsp_t;
-+
-+/*
-+ * Global Data in qla_fo.c source file.
-+ */
-+extern SysFoParams_t qla_fo_params;
-+
-+/*
-+ * Global Function Prototypes in qla_fo.c source file.
-+ */
-+extern scsi_qla_host_t *qla2x00_get_hba(unsigned long);
-+extern uint32_t qla2x00_send_fo_notification(fc_lun_t *fclun_p, fc_lun_t *olun_p);
-+extern void qla2x00_fo_init_params(scsi_qla_host_t *ha);
-+extern uint8_t qla2x00_fo_enabled(scsi_qla_host_t *ha, int instance);
-+extern int qla2x00_fo_ioctl(scsi_qla_host_t *, int, EXT_IOCTL *, int);
-+
-+extern int qla2x00_fo_missing_port_summary(scsi_qla_host_t *,
-+ EXT_DEVICEDATAENTRY *, void *, uint32_t, uint32_t *, uint32_t *);
-+extern uint32_t qla2x00_wait_for_tpg_ready(fc_lun_t *);
-+
-+/*
-+ * Global Data in qla_cfg.c source file.
-+ */
-+extern mp_host_t *mp_hosts_base;
-+extern int mp_config_required;
-+
-+/*
-+ * Global Function Prototypes in qla_cfg.c source file.
-+ */
-+
-+extern mp_device_t *qla2x00_find_mp_dev_by_nodename(mp_host_t *, uint8_t *);
-+extern mp_device_t *qla2x00_find_mp_dev_by_portname(mp_host_t *, uint8_t *,
-+ uint16_t *);
-+extern mp_host_t *qla2x00_cfg_find_host(scsi_qla_host_t *);
-+extern int qla2x00_is_portname_in_device(mp_device_t *, uint8_t *);
-+extern int qla2x00_cfg_path_discovery(scsi_qla_host_t *);
-+extern int qla2x00_cfg_event_notify(scsi_qla_host_t *, uint32_t);
-+extern fc_lun_t *qla2x00_cfg_failover(scsi_qla_host_t *, fc_lun_t *,
-+ os_tgt_t *, srb_t *);
-+extern int qla2x00_cfg_get_paths(EXT_IOCTL *, FO_GET_PATHS *, int);
-+extern int qla2x00_cfg_set_current_path(EXT_IOCTL *, FO_SET_CURRENT_PATH *,
-+ int);
-+extern void qla2x00_fo_properties(scsi_qla_host_t *);
-+extern mp_host_t *qla2x00_add_mp_host(uint8_t *);
-+extern mp_host_t *qla2x00_alloc_host(scsi_qla_host_t *);
-+extern uint8_t qla2x00_fo_check(scsi_qla_host_t *ha, srb_t *);
-+extern mp_path_t *qla2x00_find_path_by_name(mp_host_t *, mp_path_list_t *,
-+ uint8_t *);
-+
-+extern int __qla2x00_is_fcport_in_config(scsi_qla_host_t *, fc_port_t *);
-+extern int qla2x00_cfg_init(scsi_qla_host_t *);
-+extern void qla2x00_cfg_mem_free(scsi_qla_host_t *);
-+
-+extern int qla2x00_cfg_remap(scsi_qla_host_t *);
-+extern void qla2x00_set_device_flags(scsi_qla_host_t *, fc_port_t *);
-+
-+extern int16_t qla2x00_cfg_lookup_device(unsigned char *);
-+extern int qla2x00_combine_by_lunid(void *, uint16_t, fc_port_t *, uint16_t);
-+extern int qla2x00_export_target(void *, uint16_t, fc_port_t *, uint16_t);
-+
-+extern int qla2x00_test_active_lun(fc_port_t *, fc_lun_t *, uint8_t *);
-+
-+extern int qla2x00_test_active_port(fc_port_t *);
-+
-+extern int qla2x00_is_fcport_in_foconfig(scsi_qla_host_t *, fc_port_t *);
-+extern int qla2x00_get_target_ports(fc_port_t *, fc_lun_t *, int);
-+extern int qla2x00_get_target_xports(fc_port_t *, fc_lun_t *, int);
-+extern void qla2x00_cfg_select_route(srb_t *);
-+extern int qla2x00_cfg_is_lbenable(fc_lun_t *);
-+extern int qla2x00_del_fclun_from_active_list(mp_lun_t *, fc_lun_t *, srb_t *);
-+extern int qla2x00_spinup(scsi_qla_host_t *, fc_port_t *, uint16_t );
-+
-+/*
-+ * Global Function Prototypes in qla_cfgln.c source file.
-+ */
-+extern void qla2x00_cfg_build_path_tree( scsi_qla_host_t *ha);
-+extern uint8_t qla2x00_update_mp_device(mp_host_t *,
-+ fc_port_t *, uint16_t, uint16_t);
-+extern void qla2x00_cfg_display_devices(int);
-+
-+
-+/*
-+ * Global Function Prototypes in qla_foln.c source file.
-+ */
-+extern int qla2x00_search_failover_queue(scsi_qla_host_t *, struct scsi_cmnd *);
-+extern void qla2x00_process_failover_event(scsi_qla_host_t *);
-+extern int qla2x00_do_fo_check(scsi_qla_host_t *, srb_t *, scsi_qla_host_t *);
-+extern void qla2xxx_start_all_adapters(scsi_qla_host_t *);
-+extern void qla2x00_failover_cleanup(srb_t *);
-+
-+extern int ql2xfailover;
-+extern int ql2xrecoveryTime;
-+extern int ql2xfailbackTime;
-+
-+extern int MaxPathsPerDevice;
-+extern int MaxRetriesPerPath;
-+extern int MaxRetriesPerIo;
-+extern int qlFailoverNotifyType;
-+extern int ql2xlbType;
-+extern int ql2xexcludemodel;
-+extern int ql2xtgtemul;
-+extern int ql2xautorestore;
-+extern int ql2xmap2actpath;
-+
-+extern struct cfg_device_info cfg_device_list[];
-+
-+#define qla2x00_failover_enabled(ha) (ql2xfailover)
-+
-+#else
-+
-+#define qla2x00_is_fcport_in_foconfig(ha, fcport) (0)
-+#define qla2x00_fo_missing_port_summary(ha, e, s, m, c, r) (0)
-+/* qla2x00_cfg_init() is declared int but the retval isn't checked.. */
-+#define qla2x00_cfg_init(ha) do { } while (0)
-+#define qla2x00_cfg_mem_free(ha) do { } while (0)
-+#define qla2x00_cfg_display_devices() do { } while (0)
-+#define qla2x00_process_failover_event(ha) do { } while (0)
-+#define qla2xxx_start_all_adapters(ha) do { } while (0)
-+#define qla2x00_search_failover_queue(ha, cmd) (0)
-+#define qla2x00_do_fo_check(ha, sp, vis_ha) (0)
-+#define qla2x00_failover_enabled(ha) (0)
-+#endif /* CONFIG_SCSI_QLA2XXX_FAILOVER */
-+
-+static __inline int
-+qla2x00_is_fcport_in_config(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ if (qla2x00_failover_enabled(ha))
-+ return qla2x00_is_fcport_in_foconfig(ha, fcport);
-+ else if (fcport->flags & FC_PERSISTENT_BOUND)
-+ return 1;
-+ return 0;
-+}
-+
-+
-+#endif /* __QLA_FOLN_H */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_fw.h ./drivers/scsi/qla2xxx/qla_fw.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_fw.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_fw.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,23 +1,9 @@
--
--/********************************************************************************
--* QLOGIC LINUX SOFTWARE
--*
--* QLogic ISP2x00 device driver for Linux 2.6.x
--* Copyright (C) 2003-2004 QLogic Corporation
--* (www.qlogic.com)
--*
--* This program is free software; you can redistribute it and/or modify it
--* under the terms of the GNU General Public License as published by the
--* Free Software Foundation; either version 2, or (at your option) any
--* later version.
--*
--* This program is distributed in the hope that it will be useful, but
--* WITHOUT ANY WARRANTY; without even the implied warranty of
--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--* General Public License for more details.
--**
--******************************************************************************/
--
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #ifndef __QLA_FW_H
- #define __QLA_FW_H
-
-@@ -159,7 +145,7 @@ struct nvram_24xx {
- * BIT 2 = Enable Memory Map BIOS
- * BIT 3 = Enable Selectable Boot
- * BIT 4 = Disable RISC code load
-- * BIT 5 =
-+ * BIT 5 = Disable Serdes
- * BIT 6 =
- * BIT 7 =
- *
-@@ -296,7 +282,7 @@ struct init_cb_24xx {
- uint16_t response_q_length;
- uint16_t request_q_length;
-
-- uint16_t link_down_timeout; /* Milliseconds. */
-+ uint16_t link_down_on_nos; /* Milliseconds. */
-
- uint16_t prio_request_q_length;
-
-@@ -480,7 +466,7 @@ struct sts_entry_24xx {
- uint16_t comp_status; /* Completion status. */
- uint16_t ox_id; /* OX_ID used by the firmware. */
-
-- uint32_t residual_len; /* Residual transfer length. */
-+ uint32_t residual_len; /* FW calc residual transfer length. */
-
- uint16_t reserved_1;
- uint16_t state_flags; /* State flags. */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_gbl.h ./drivers/scsi/qla2xxx/qla_gbl.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_gbl.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_gbl.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,25 +1,9 @@
--/********************************************************************************
--* QLOGIC LINUX SOFTWARE
--*
--* QLogic ISP2x00 device driver for Linux 2.6.x
--* Copyright (C) 2003-2005 QLogic Corporation
--* (www.qlogic.com)
--*
--* This program is free software; you can redistribute it and/or modify it
--* under the terms of the GNU General Public License as published by the
--* Free Software Foundation; either version 2, or (at your option) any
--* later version.
--*
--* This program is distributed in the hope that it will be useful, but
--* WITHOUT ANY WARRANTY; without even the implied warranty of
--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--* General Public License for more details.
--*
--******************************************************************************
--* Global include file.
--******************************************************************************/
--
--
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #ifndef __QLA_GBL_H
- #define __QLA_GBL_H
-
-@@ -47,6 +31,12 @@ extern void qla2x00_rescan_fcports(scsi_
- extern void qla2x00_tgt_free(scsi_qla_host_t *ha, uint16_t t);
-
- extern int qla2x00_abort_isp(scsi_qla_host_t *);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern os_tgt_t *qla2x00_tgt_alloc(scsi_qla_host_t *, uint16_t);
-+extern os_lun_t *qla2x00_lun_alloc(scsi_qla_host_t *, uint16_t, uint16_t);
-+#endif
-+
-+extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
-
- /*
- * Global Data in qla_os.c source file.
-@@ -68,9 +58,14 @@ extern int ql2xintrdelaytimer;
- extern int ql2xloginretrycount;
- extern int ql2xprocessnotready;
- extern int ql2xprocessrscn;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern int ql2xioctltimeout;
-+extern char *ql2xdevconf;
-+#endif
- extern int extended_error_logging;
- extern int ql2xfwloadbin;
- extern int ql2xfdmienable;
-+extern int ql2xallocfwdump;
-
- extern int ConfigRequired;
-
-@@ -79,6 +74,16 @@ extern int ql2xsuspendcount;
- #if defined(MODULE)
- extern char *ql2xopts;
- #endif
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern struct list_head qla_hostlist;
-+extern rwlock_t qla_hostlist_lock;
-+
-+extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *);
-+extern int qla2x00_get_prop_xstr(scsi_qla_host_t *, char *, uint8_t *, int);
-+extern int qla2x00_queuecommand(struct scsi_cmnd *,
-+ void (*)(struct scsi_cmnd *));
-+extern srb_t *qla2x00_get_new_sp(scsi_qla_host_t *);
-+#endif
-
- extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
-
-@@ -116,6 +121,10 @@ extern int qla2x00_start_scsi(srb_t *sp)
- extern int qla24xx_start_scsi(srb_t *sp);
- int qla2x00_marker(scsi_qla_host_t *, uint16_t, uint16_t, uint8_t);
- int __qla2x00_marker(scsi_qla_host_t *, uint16_t, uint16_t, uint8_t);
-+extern void *qla2x00_req_pkt(scsi_qla_host_t *);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern request_t *qla2x00_ms_req_pkt(scsi_qla_host_t *, srb_t *);
-+#endif
-
- /*
- * Global Function Prototypes in qla_mbx.c source file.
-@@ -217,6 +226,34 @@ qla2x00_set_serdes_params(scsi_qla_host_
- extern int
- qla2x00_stop_firmware(scsi_qla_host_t *);
-
-+extern int
-+qla2x00_trace_control(scsi_qla_host_t *, uint16_t, dma_addr_t, uint16_t);
-+
-+extern int
-+qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t);
-+
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern int qla2x00_mailbox_command(scsi_qla_host_t *, mbx_cmd_t *);
-+
-+extern uint8_t
-+qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *, uint16_t *);
-+
-+extern uint8_t
-+qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *);
-+
-+extern int
-+qla2x00_lun_reset(scsi_qla_host_t *, fc_port_t *, uint16_t);
-+
-+extern int
-+qla2x00_send_rnid_mbx(scsi_qla_host_t *, uint16_t, uint8_t, dma_addr_t,
-+ size_t, uint16_t *);
-+
-+extern int
-+qla2x00_set_rnid_params_mbx(scsi_qla_host_t *, dma_addr_t, size_t, uint16_t *);
-+
-+extern int
-+qla2x00_get_rnid_params_mbx(scsi_qla_host_t *, dma_addr_t, size_t, uint16_t *);
-+#endif
- /*
- * Global Function Prototypes in qla_isr.c source file.
- */
-@@ -233,6 +270,21 @@ extern void qla2x00_lock_nvram_access(sc
- extern void qla2x00_unlock_nvram_access(scsi_qla_host_t *);
- extern uint16_t qla2x00_get_nvram_word(scsi_qla_host_t *, uint32_t);
- extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern void qla2x00_flash_enable(scsi_qla_host_t *);
-+extern void qla2x00_flash_disable(scsi_qla_host_t *);
-+extern uint8_t qla2x00_read_flash_byte(scsi_qla_host_t *, uint32_t);
-+extern void qla2x00_get_flash_manufacturer(scsi_qla_host_t *, uint8_t *,
-+ uint8_t *);
-+extern int qla2x00_get_flash_version(scsi_qla_host_t *);
-+extern int qla24xx_refresh_flash_version(scsi_qla_host_t *, uint8_t *);
-+extern uint16_t qla2x00_get_flash_image(scsi_qla_host_t *, uint8_t *);
-+extern uint16_t qla2x00_set_flash_image(scsi_qla_host_t *, uint8_t *, uint32_t,
-+ uint32_t);
-+extern uint16_t
-+qla2x00_update_or_read_flash(scsi_qla_host_t *, uint8_t *, uint32_t, uint32_t,
-+ uint8_t);
-+#endif
- extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *,
- uint32_t, uint32_t);
- extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
-@@ -246,9 +298,6 @@ extern int qla2x00_write_nvram_data(scsi
- extern void qla2100_fw_dump(scsi_qla_host_t *, int);
- extern void qla2300_fw_dump(scsi_qla_host_t *, int);
- extern void qla24xx_fw_dump(scsi_qla_host_t *, int);
--extern void qla2100_ascii_fw_dump(scsi_qla_host_t *);
--extern void qla2300_ascii_fw_dump(scsi_qla_host_t *);
--extern void qla24xx_ascii_fw_dump(scsi_qla_host_t *);
- extern void qla2x00_dump_regs(scsi_qla_host_t *);
- extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
- extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);
-@@ -279,11 +328,38 @@ extern void qla2x00_cancel_io_descriptor
- /*
- * Global Function Prototypes in qla_xioctl.c source file.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern void * Q64BIT_TO_PTR(uint64_t, uint16_t);
-+
-+extern int qla2x00_ioctl(struct scsi_device *, int , void *);
-+extern int qla2x00_ioctl_init(void);
-+extern int qla2x00_ioctl_exit(void);
-+extern void qla2x00_enqueue_aen(scsi_qla_host_t *, uint16_t, void *);
-+extern int qla2x00_alloc_ioctl_mem(scsi_qla_host_t *);
-+extern void qla2x00_free_ioctl_mem(scsi_qla_host_t *);
-+extern int qla2x00_get_ioctl_scrap_mem(scsi_qla_host_t *, void **, uint32_t);
-+extern void qla2x00_free_ioctl_scrap_mem(scsi_qla_host_t *);
-+#else
- #define qla2x00_enqueue_aen(ha, cmd, mode) do { } while (0)
- #define qla2x00_alloc_ioctl_mem(ha) (0)
- #define qla2x00_free_ioctl_mem(ha) do { } while (0)
-+#endif
-
- /*
- * Global Function Prototypes in qla_ip.c source file.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+extern void qla2x00_ip_send_complete(scsi_qla_host_t *, uint32_t,
-+ uint16_t);
-+extern void qla24xx_ip_send_complete(scsi_qla_host_t *, uint32_t,
-+ uint16_t);
-+extern void qla2x00_ip_receive(scsi_qla_host_t *, struct ip_rec_entry *);
-+extern void qla24xx_ip_receive(scsi_qla_host_t *, struct ip_rec_entry_24xx *);
-+#endif
-+
-+/*
-+ * Global Function Prototypes in qla_attr.c source file.
-+ */
-+extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
-+extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
- #endif /* _QLA_GBL_H */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_gs.c ./drivers/scsi/qla2xxx/qla_gs.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_gs.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_gs.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,23 +1,13 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
-+#include <linux/utsname.h>
-+
- static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *);
- static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *);
- static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
-@@ -1378,7 +1368,12 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *ha)
- /* Option ROM version. */
- eiter = (struct ct_fdmi_hba_attr *) (entries + size);
- eiter->type = __constant_cpu_to_be16(FDMI_HBA_OPTION_ROM_VERSION);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ sprintf(eiter->a.orom_version, "%d.%02d", ha->bios_revision[1],
-+ ha->bios_revision[0]);
-+#else
- strcpy(eiter->a.orom_version, "0.00");
-+#endif
- alen = strlen(eiter->a.orom_version);
- alen += (alen & 3) ? (4 - (alen & 3)) : 4;
- eiter->len = cpu_to_be16(4 + alen);
-@@ -1399,6 +1394,19 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *ha)
- DEBUG13(printk("%s(%ld): FIRMWAREVER=%s.\n", __func__, ha->host_no,
- eiter->a.fw_version));
-
-+ /* OS name/version */
-+ eiter = (struct ct_fdmi_hba_attr *) (entries + size);
-+ eiter->type = __constant_cpu_to_be16(FDMI_HBA_OS_NAME_AND_VERSION);
-+ sprintf(eiter->a.os_version, "%s %s %s", system_utsname.sysname,
-+ system_utsname.release, system_utsname.version);
-+ alen = strlen(eiter->a.os_version);
-+ alen += (alen & 3) ? (4 - (alen & 3)) : 4;
-+ eiter->len = cpu_to_be16(4 + alen);
-+ size += 4 + alen;
-+
-+ DEBUG13(printk("%s(%ld): OSNAME='%s' size=%d.\n", __func__, ha->host_no,
-+ eiter->a.os_version, size));
-+
- /* Update MS request size. */
- qla2x00_update_ms_fdmi_iocb(ha, size + 16);
-
-@@ -1545,9 +1553,7 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
- eiter = (struct ct_fdmi_port_attr *) (entries + size);
- eiter->type = __constant_cpu_to_be16(FDMI_PORT_SUPPORT_SPEED);
- eiter->len = __constant_cpu_to_be16(4 + 4);
-- if (IS_QLA54XX(ha))
-- eiter->a.sup_speed = __constant_cpu_to_be32(8);
-- else if (IS_QLA24XX(ha))
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
- eiter->a.sup_speed = __constant_cpu_to_be32(4);
- else if (IS_QLA23XX(ha))
- eiter->a.sup_speed = __constant_cpu_to_be32(2);
-@@ -1603,6 +1609,18 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
- DEBUG13(printk("%s(%ld): OS_DEVICE_NAME=%s.\n", __func__, ha->host_no,
- eiter->a.os_dev_name));
-
-+ /* Model name. */
-+ eiter = (struct ct_fdmi_port_attr *) (entries + size);
-+ eiter->type = __constant_cpu_to_be16(FDMI_PORT_HOST_NAME);
-+ strcpy(eiter->a.host_name, system_utsname.nodename);
-+ alen = strlen(eiter->a.host_name);
-+ alen += (alen & 3) ? (4 - (alen & 3)) : 4;
-+ eiter->len = cpu_to_be16(4 + alen);
-+ size += 4 + alen;
-+
-+ DEBUG13(printk("%s(%ld): HOSTNAME=%s.\n", __func__, ha->host_no,
-+ eiter->a.host_name));
-+
- /* Update MS request size. */
- qla2x00_update_ms_fdmi_iocb(ha, size + 16);
-
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_inioct.c ./drivers/scsi/qla2xxx/qla_inioct.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_inioct.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_inioct.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,1195 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+#include <linux/vmalloc.h>
-+#include <linux/delay.h>
-+#include <asm/uaccess.h>
-+
-+#include "exioct.h"
-+#include "inioct.h"
-+
-+
-+static int qla2x00_read_option_rom_ext(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_update_option_rom_ext(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static void qla2x00_get_option_rom_table(scsi_qla_host_t *,
-+ INT_OPT_ROM_REGION **, unsigned long *);
-+
-+/* Option ROM definitions. */
-+INT_OPT_ROM_REGION OptionRomTable2312[] =
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_PHBIOS_FCODE_EFI_CFW, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+INT_OPT_ROM_REGION OptionRomTable6312[] = // 128k x20000
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_PHBIOS_CFW, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+INT_OPT_ROM_REGION OptionRomTableHp[] = // 128k x20000
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_PHEFI_PHECFW_PHVPD, INT_OPT_ROM_SIZE_2312,
-+ 0, INT_OPT_ROM_SIZE_2312-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+INT_OPT_ROM_REGION OptionRomTable2322[] = // 1 M x100000
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2322,
-+ 0, INT_OPT_ROM_SIZE_2322-1},
-+ {INT_OPT_ROM_REGION_PHBIOS_PHFCODE_PHEFI_FW, INT_OPT_ROM_SIZE_2322,
-+ 0, INT_OPT_ROM_SIZE_2322-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+INT_OPT_ROM_REGION OptionRomTable6322[] = // 1 M x100000
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2322,
-+ 0, INT_OPT_ROM_SIZE_2322-1},
-+ {INT_OPT_ROM_REGION_PHBIOS_FW, INT_OPT_ROM_SIZE_2322,
-+ 0, INT_OPT_ROM_SIZE_2322-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+INT_OPT_ROM_REGION OptionRomTable2422[] = // 1 M x100000
-+{
-+ {INT_OPT_ROM_REGION_ALL, INT_OPT_ROM_SIZE_2422,
-+ 0, INT_OPT_ROM_SIZE_2422-1},
-+ {INT_OPT_ROM_REGION_PHBIOS_PHFCODE_PHEFI, 0x40000,
-+ 0, 0x40000-1 },
-+ {INT_OPT_ROM_REGION_FW, 0x80000,
-+ 0x80000, INT_OPT_ROM_SIZE_2422-1},
-+ {INT_OPT_ROM_REGION_NONE, 0, 0, 0 }
-+};
-+
-+
-+/* ========================================================================= */
-+
-+int
-+qla2x00_read_nvram(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ char *ptmp_buf;
-+ uint32_t transfer_size;
-+ unsigned long flags;
-+
-+ DEBUG9(printk("qla2x00_read_nvram: entered.\n"));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_buf,
-+ ha->nvram_size)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ha->nvram_size));
-+ return (ret);
-+ }
-+
-+ transfer_size = ha->nvram_size;
-+ if (pext->ResponseLen < ha->nvram_size)
-+ transfer_size = pext->ResponseLen;
-+
-+ /* Dump NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_read_nvram_data(ha, (uint8_t *)ptmp_buf, ha->nvram_base,
-+ ha->nvram_size);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_buf, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("qla2x00_read_nvram: exiting.\n"));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_update_nvram
-+ * Write data to NVRAM.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * pext = pointer to driver internal IOCTL structure.
-+ *
-+ * Returns:
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_update_nvram(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ uint8_t cnt;
-+ uint8_t *usr_tmp, *kernel_tmp;
-+ nvram_t *pnew_nv;
-+ uint32_t transfer_size;
-+ int ret = 0;
-+ unsigned long flags;
-+
-+ DEBUG9(printk("qla2x00_update_nvram: entered.\n"));
-+
-+ if (pext->RequestLen < ha->nvram_size)
-+ transfer_size = pext->RequestLen;
-+ else
-+ transfer_size = ha->nvram_size;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pnew_nv,
-+ ha->nvram_size)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%d.\n",
-+ __func__, ha->host_no, ha->instance, ha->nvram_size));
-+ return (ret);
-+ }
-+
-+ /* Read from user buffer */
-+ kernel_tmp = (uint8_t *)pnew_nv;
-+ usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
-+
-+ ret = copy_from_user(kernel_tmp, usr_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "qla2x00_update_nvram: ERROR in buffer copy READ. "
-+ "RequestAdr=%p\n", Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ /* Checksum NVRAM. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ uint32_t *iter;
-+ uint32_t chksum;
-+
-+ iter = (uint32_t *)pnew_nv;
-+ chksum = 0;
-+ for (cnt = 0; cnt < ((ha->nvram_size >> 2) - 1); cnt++)
-+ chksum += le32_to_cpu(*iter++);
-+ chksum = ~chksum + 1;
-+ *iter = cpu_to_le32(chksum);
-+ } else {
-+ uint8_t *iter;
-+ uint8_t chksum;
-+
-+ iter = (uint8_t *)pnew_nv;
-+ chksum = 0;
-+ for (cnt = 0; cnt < ha->nvram_size - 1; cnt++)
-+ chksum += *iter++;
-+ chksum = ~chksum + 1;
-+ *iter = chksum;
-+ }
-+
-+ /* Write NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_write_nvram_data(ha, (uint8_t *)pnew_nv, ha->nvram_base,
-+ transfer_size);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("qla2x00_update_nvram: exiting.\n"));
-+
-+ /* Schedule DPC to restart the RISC */
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ up(ha->dpc_wait);
-+
-+ if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
-+ pext->Status = EXT_STATUS_ERR;
-+ }
-+
-+ return ret;
-+}
-+
-+static int
-+qla2x00_loopback_test(scsi_qla_host_t *ha, INT_LOOPBACK_REQ *req,
-+ uint16_t *ret_mb)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ DEBUG11(printk("qla2x00_send_loopback: req.Options=%x iterations=%x "
-+ "MAILBOX_CNT=%d.\n", req->Options, req->IterationCount,
-+ MAILBOX_REGISTER_COUNT));
-+
-+ memset(mcp->mb, 0 , sizeof(mcp->mb));
-+
-+ mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK;
-+ mcp->mb[1] = req->Options | MBX_6;
-+ mcp->mb[10] = LSW(req->TransferCount);
-+ mcp->mb[11] = MSW(req->TransferCount);
-+ mcp->mb[14] = LSW(ha->ioctl_mem_phys); /* send data address */
-+ mcp->mb[15] = MSW(ha->ioctl_mem_phys);
-+ mcp->mb[20] = LSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[21] = MSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[16] = LSW(ha->ioctl_mem_phys); /* rcv data address */
-+ mcp->mb[17] = MSW(ha->ioctl_mem_phys);
-+ mcp->mb[6] = LSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[7] = MSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[18] = LSW(req->IterationCount); /* iteration count lsb */
-+ mcp->mb[19] = MSW(req->IterationCount); /* iteration count msb */
-+ mcp->out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15|
-+ MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_7|MBX_6|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_19|MBX_18|MBX_3|MBX_2|MBX_1|MBX_0;
-+ mcp->buf_size = req->TransferCount;
-+ mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
-+ mcp->tov = 30;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ /* Always copy back return mailbox values. */
-+ memcpy((void *)ret_mb, (void *)mcp->mb, sizeof(mcp->mb));
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* Empty. */
-+ DEBUG2_3_11(printk(
-+ "qla2x00_loopback_test(%ld): mailbox command FAILED=%x.\n",
-+ ha->host_no, mcp->mb[0]));
-+ } else {
-+ /* Empty. */
-+ DEBUG11(printk(
-+ "qla2x00_loopback_test(%ld): done.\n", ha->host_no));
-+ }
-+
-+ return rval;
-+}
-+
-+static int
-+qla2x00_echo_test(scsi_qla_host_t *ha, INT_LOOPBACK_REQ *req, uint16_t *ret_mb)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ memset(mcp->mb, 0 , sizeof(mcp->mb));
-+
-+ mcp->mb[0] = MBC_DIAGNOSTIC_ECHO;
-+ mcp->mb[1] = BIT_6; /* use 64bit DMA addr */
-+ mcp->mb[10] = req->TransferCount;
-+ mcp->mb[14] = LSW(ha->ioctl_mem_phys); /* send data address */
-+ mcp->mb[15] = MSW(ha->ioctl_mem_phys);
-+ mcp->mb[20] = LSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[21] = MSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[16] = LSW(ha->ioctl_mem_phys); /* rcv data address */
-+ mcp->mb[17] = MSW(ha->ioctl_mem_phys);
-+ mcp->mb[6] = LSW(MSD(ha->ioctl_mem_phys));
-+ mcp->mb[7] = MSW(MSD(ha->ioctl_mem_phys));
-+ mcp->out_mb = MBX_21|MBX_20|MBX_17|MBX_16|MBX_15|MBX_14|MBX_10|
-+ MBX_7|MBX_6|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_1|MBX_0;
-+ mcp->buf_size = req->TransferCount;
-+ mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
-+ mcp->tov = 30;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ /* Always copy back return mailbox values. */
-+ memcpy((void *)ret_mb, (void *)mcp->mb, sizeof(mcp->mb));
-+
-+ if (rval != QLA_SUCCESS) {
-+ /* Empty. */
-+ DEBUG2_3_11(printk(
-+ "%s(%ld): mailbox command FAILED=%x/%x.\n", __func__,
-+ ha->host_no, mcp->mb[0], mcp->mb[1]));
-+ } else {
-+ /* Empty. */
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
-+ }
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_send_loopback(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int rval = 0;
-+ int status;
-+ uint16_t ret_mb[MAILBOX_REGISTER_COUNT];
-+ INT_LOOPBACK_REQ req;
-+ INT_LOOPBACK_RSP rsp;
-+
-+ DEBUG9(printk("qla2x00_send_loopback: entered.\n"));
-+
-+
-+ if (pext->RequestLen != sizeof(INT_LOOPBACK_REQ)) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk(
-+ "qla2x00_send_loopback: invalid RequestLen =%d.\n",
-+ pext->RequestLen));
-+ return rval;
-+ }
-+
-+ if (pext->ResponseLen != sizeof(INT_LOOPBACK_RSP)) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk(
-+ "qla2x00_send_loopback: invalid ResponseLen =%d.\n",
-+ pext->ResponseLen));
-+ return rval;
-+ }
-+
-+ status = copy_from_user(&req, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (status) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR copy read of "
-+ "request buffer.\n"));
-+ return (-EFAULT);
-+ }
-+
-+ status = copy_from_user(&rsp, Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), pext->ResponseLen);
-+ if (status) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR copy read of "
-+ "response buffer.\n"));
-+ return (-EFAULT);
-+ }
-+
-+ if (req.TransferCount > req.BufferLength ||
-+ req.TransferCount > rsp.BufferLength) {
-+
-+ /* Buffer lengths not large enough. */
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ DEBUG9_10(printk(
-+ "qla2x00_send_loopback: invalid TransferCount =%d. "
-+ "req BufferLength =%d rspBufferLength =%d.\n",
-+ req.TransferCount, req.BufferLength, rsp.BufferLength));
-+
-+ return rval;
-+ }
-+
-+ status = copy_from_user(ha->ioctl_mem, Q64BIT_TO_PTR(req.BufferAddress,
-+ pext->AddrMode), req.TransferCount);
-+ if (status) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR copy read of "
-+ "user loopback data buffer.\n"));
-+ return (-EFAULT);
-+ }
-+
-+
-+ DEBUG9(printk("qla2x00_send_loopback: req -- bufadr=%lx, buflen=%x, "
-+ "xfrcnt=%x, rsp -- bufadr=%lx, buflen=%x.\n",
-+ (unsigned long)req.BufferAddress, req.BufferLength,
-+ req.TransferCount, (unsigned long)rsp.BufferAddress,
-+ rsp.BufferLength));
-+
-+ /*
-+ * AV - the caller of this IOCTL expects the FW to handle
-+ * a loopdown situation and return a good status for the
-+ * call function and a LOOPDOWN status for the test operations
-+ */
-+ /*if (atomic_read(&ha->loop_state) != LOOP_READY || */
-+ if (test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("qla2x00_send_loopback(%ld): "
-+ "loop not ready.\n", ha->host_no));
-+ return rval;
-+ }
-+
-+ if (ha->current_topology == ISP_CFG_F) {
-+ if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST ;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR "
-+ "command only supported for QLA23xx.\n"));
-+ return rval;
-+ }
-+ status = qla2x00_echo_test(ha, &req, ret_mb);
-+ } else {
-+ status = qla2x00_loopback_test(ha, &req, ret_mb);
-+ }
-+
-+ if (status) {
-+ if (status == QLA_FUNCTION_TIMEOUT ) {
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR "
-+ "command timed out.\n"));
-+ return rval;
-+ } else {
-+ /* EMPTY. Just proceed to copy back mailbox reg
-+ * values for users to interpret.
-+ */
-+ pext->Status = EXT_STATUS_ERR;
-+ DEBUG10(printk("qla2x00_send_loopback: ERROR "
-+ "loopback command failed 0x%x.\n", ret_mb[0]));
-+ }
-+ }
-+
-+ DEBUG9(printk("qla2x00_send_loopback: loopback mbx cmd ok. "
-+ "copying data.\n"));
-+
-+ /* put loopback return data in user buffer */
-+ status = copy_to_user(Q64BIT_TO_PTR(rsp.BufferAddress,
-+ pext->AddrMode), ha->ioctl_mem, req.TransferCount);
-+ if (status) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR copy "
-+ "write of return data buffer.\n"));
-+ return (-EFAULT);
-+ }
-+
-+ rsp.CompletionStatus = ret_mb[0];
-+ if (ha->current_topology == ISP_CFG_F) {
-+ rsp.CommandSent = INT_DEF_LB_ECHO_CMD;
-+ } else {
-+ if (rsp.CompletionStatus == INT_DEF_LB_COMPLETE ||
-+ rsp.CompletionStatus == INT_DEF_LB_CMD_ERROR) {
-+ rsp.CrcErrorCount = ret_mb[1];
-+ rsp.DisparityErrorCount = ret_mb[2];
-+ rsp.FrameLengthErrorCount = ret_mb[3];
-+ rsp.IterationCountLastError =
-+ (ret_mb[19] << 16) | ret_mb[18];
-+ }
-+ }
-+
-+ status = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), &rsp, pext->ResponseLen);
-+ if (status) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("qla2x00_send_loopback: ERROR copy "
-+ "write of response buffer.\n"));
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("qla2x00_send_loopback: exiting.\n"));
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_read_option_rom(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int rval = 0;
-+
-+
-+ if (pext->SubCode)
-+ return qla2x00_read_option_rom_ext(ha, pext, mode);
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ /* These interfaces are not valid for 24xx and 25xx chips. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ return rval;
-+ }
-+
-+ /* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-+ if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && !ha->pio_address) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ return rval;
-+ }
-+
-+ if (pext->ResponseLen != FLASH_IMAGE_SIZE) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ return rval;
-+ }
-+
-+ /* Dump FLASH. This is for non-24xx/25xx */
-+ if (qla2x00_update_or_read_flash(ha, Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), 0, FLASH_IMAGE_SIZE, QLA2X00_READ)) {
-+ pext->Status = EXT_STATUS_ERR;
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_read_option_rom_ext(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int iter, found;
-+ int rval = 0;
-+ uint8_t *image_ptr;
-+ uint32_t saddr, length;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ found = 0;
-+ saddr = length = 0;
-+
-+ /* Retrieve region or raw starting address. */
-+ if (pext->SubCode == 0xFFFF) {
-+ saddr = pext->Reserved1;
-+ length = pext->RequestLen;
-+ found++;
-+ } else {
-+ INT_OPT_ROM_REGION *OptionRomTable = NULL;
-+ unsigned long OptionRomTableSize;
-+
-+ /* Pick the right OptionRom table based on device id */
-+ qla2x00_get_option_rom_table(ha, &OptionRomTable,
-+ &OptionRomTableSize);
-+
-+ for (iter = 0; OptionRomTable != NULL && iter <
-+ (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION));
-+ iter++) {
-+ if (OptionRomTable[iter].Region == pext->SubCode) {
-+ saddr = OptionRomTable[iter].Beg;
-+ length = OptionRomTable[iter].Size;
-+ found++;
-+ break;
-+ }
-+ }
-+ }
-+
-+ if (!found) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return rval;
-+ }
-+
-+ if (pext->ResponseLen < length) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ return (-EFAULT);
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ image_ptr = vmalloc(length);
-+ if (image_ptr == NULL) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ printk(KERN_WARNING
-+ "%s: ERROR in flash allocation.\n", __func__);
-+ return rval;
-+ }
-+ } else {
-+ image_ptr = Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode);
-+ }
-+
-+ /* Dump FLASH. */
-+ if (qla2x00_update_or_read_flash(ha, image_ptr, saddr, length,
-+ QLA2X00_READ)) {
-+ pext->Status = EXT_STATUS_ERR;
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ }
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ rval = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode), image_ptr, length);
-+ if (rval) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ vfree(image_ptr);
-+ return (-EFAULT);
-+ }
-+
-+ vfree(image_ptr);
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_update_option_rom(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int rval = 0;
-+ uint8_t *usr_tmp;
-+ uint8_t *kern_tmp;
-+ uint16_t status;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld ext ioctl struct dump-\n",
-+ __func__, ha->host_no, ha->instance));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)pext,
-+ sizeof(EXT_IOCTL)));
-+
-+ if (pext->SubCode)
-+ return qla2x00_update_option_rom_ext(ha, pext, mode);
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ /* These interfaces are not valid for 24xx and 25xx chips. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ return rval;
-+ }
-+
-+ /* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-+ if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && !ha->pio_address) {
-+ DEBUG10(printk("%s: got 2312 and no flash access via mmio.\n",
-+ __func__));
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ return rval;
-+ }
-+
-+ if (pext->RequestLen != FLASH_IMAGE_SIZE) {
-+ DEBUG10(printk("%s: wrong RequestLen=%d, should be %d.\n",
-+ __func__, pext->RequestLen, FLASH_IMAGE_SIZE));
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ return rval;
-+ }
-+
-+ /* Read from user buffer */
-+ kern_tmp = vmalloc(FLASH_IMAGE_SIZE);
-+ if (kern_tmp == NULL) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG10(printk("%s: vmalloc failed.\n", __func__));
-+ printk(KERN_WARNING
-+ "%s: ERROR in flash allocation.\n", __func__);
-+ return rval;
-+ }
-+
-+ usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
-+
-+ DEBUG9(printk("%s(%ld): going to copy from user.\n",
-+ __func__, ha->host_no));
-+
-+ rval = copy_from_user(kern_tmp, usr_tmp, FLASH_IMAGE_SIZE);
-+ if (rval) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s: ERROR in buffer copy READ. "
-+ "RequestAdr=%p\n",
-+ __func__, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode)));
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): done copy from user. data dump:\n",
-+ __func__, ha->host_no));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)kern_tmp,
-+ FLASH_IMAGE_SIZE));
-+
-+ /* Go with update */
-+ status = qla2x00_update_or_read_flash(ha, kern_tmp, 0, FLASH_IMAGE_SIZE,
-+ QLA2X00_WRITE);
-+
-+ vfree(kern_tmp);
-+
-+ if (status) {
-+ pext->Status = EXT_STATUS_ERR;
-+ DEBUG9_10(printk("%s: ERROR updating flash.\n", __func__));
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_update_option_rom_ext(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int iter, found;
-+ int ret = 0;
-+ uint16_t status;
-+ uint8_t *usr_tmp;
-+ uint8_t *kern_tmp;
-+ uint8_t *ptmp_mem = NULL;
-+ uint32_t saddr, length;
-+ scsi_qla_host_t *hba2 = NULL;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ found = 0;
-+ saddr = length = 0;
-+ /* Retrieve region or raw starting address. */
-+ if (pext->SubCode == 0xFFFF) {
-+ saddr = pext->Reserved1;
-+ length = pext->RequestLen;
-+ found++;
-+ } else {
-+ INT_OPT_ROM_REGION *OptionRomTable = NULL;
-+ unsigned long OptionRomTableSize;
-+
-+ /* Pick the right OptionRom table based on device id */
-+ qla2x00_get_option_rom_table(ha, &OptionRomTable,
-+ &OptionRomTableSize);
-+
-+ for (iter = 0; OptionRomTable != NULL && iter <
-+ (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION));
-+ iter++) {
-+ if (OptionRomTable[iter].Region == pext->SubCode) {
-+ saddr = OptionRomTable[iter].Beg;
-+ length = OptionRomTable[iter].Size;
-+ found++;
-+ break;
-+ }
-+ }
-+ }
-+
-+ if (!found) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return ret;
-+ }
-+
-+ if (pext->RequestLen < length) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ return ret;
-+ }
-+
-+ /* Read from user buffer */
-+ usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
-+
-+ kern_tmp = vmalloc(length);
-+ if (kern_tmp == NULL) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ printk(KERN_WARNING
-+ "%s: ERROR in flash allocation.\n", __func__);
-+ return ret;
-+ }
-+
-+ ret = copy_from_user(kern_tmp, usr_tmp, length);
-+ if (ret) {
-+ vfree(kern_tmp);
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s: ERROR in buffer copy READ. "
-+ "RequestAdr=%p\n", __func__,
-+ Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode)));
-+ return (-EFAULT);
-+ }
-+
-+ /* Go with update */
-+ status = qla2x00_update_or_read_flash(ha, kern_tmp, saddr, length,
-+ QLA2X00_WRITE);
-+
-+ vfree(kern_tmp);
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ if (status) {
-+ pext->Status = EXT_STATUS_ERR;
-+ DEBUG9_10(printk("%s: ERROR updating flash.\n", __func__));
-+ } else {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ if (qla2x00_get_ioctl_scrap_mem(ha,
-+ (void **)&ptmp_mem, PAGE_SIZE)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not "
-+ "big enough. size requested=%ld.\n",
-+ __func__, ha->host_no,
-+ ha->instance, PAGE_SIZE));
-+ } else {
-+ if (qla24xx_refresh_flash_version(ha,
-+ ptmp_mem)) {
-+
-+ pext->Status = EXT_STATUS_ERR;
-+ DEBUG9_10(printk( "%s: ERROR reading "
-+ "updated flash versions.\n",
-+ __func__));
-+ }
-+
-+ /* Refresh second function if exists. */
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(hba2, &qla_hostlist, list) {
-+ if ((hba2->pdev->bus->number) ==
-+ (ha->pdev->bus->number) &&
-+ PCI_SLOT(hba2->pdev->devfn) ==
-+ PCI_SLOT(ha->pdev->devfn) &&
-+ PCI_FUNC(hba2->pdev->devfn) !=
-+ PCI_FUNC(ha->pdev->devfn)) {
-+ hba2->code_types = ha->code_types;
-+ hba2->bios_revision[0] = ha->bios_revision[0];
-+ hba2->bios_revision[1] = ha->bios_revision[1];
-+ hba2->efi_revision[0] = ha->efi_revision[0];
-+ hba2->efi_revision[1] = ha->efi_revision[1];
-+ hba2->fcode_revision[0] = ha->fcode_revision[0];
-+ hba2->fcode_revision[1] = ha->fcode_revision[1];
-+ hba2->fw_revision[0] = ha->fw_revision[0];
-+ hba2->fw_revision[1] = ha->fw_revision[1];
-+ hba2->fw_revision[2] = ha->fw_revision[2];
-+ hba2->fw_revision[3] = ha->fw_revision[3];
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return ret;
-+}
-+
-+int
-+qla2x00_get_option_rom_layout(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0, iter;
-+ INT_OPT_ROM_REGION *OptionRomTable = NULL;
-+ INT_OPT_ROM_LAYOUT *optrom_layout;
-+ unsigned long OptionRomTableSize;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ /* Pick the right OptionRom table based on device id */
-+ qla2x00_get_option_rom_table(ha, &OptionRomTable, &OptionRomTableSize);
-+
-+ if (OptionRomTable == NULL) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld) Option Rom Table for device_id=0x%x "
-+ "not defined\n", __func__, ha->host_no, ha->pdev->device));
-+ return ret;
-+ }
-+
-+ if (pext->ResponseLen < OptionRomTableSize) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s(%ld) buffer too small: response_len = %d "
-+ "optrom_table_len=%ld.\n", __func__, ha->host_no,
-+ pext->ResponseLen, OptionRomTableSize));
-+ return ret;
-+ }
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&optrom_layout,
-+ OptionRomTableSize)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n", __func__, ha->host_no,
-+ ha->instance, OptionRomTableSize));
-+ return ret;
-+ }
-+
-+ // Dont Count the NULL Entry.
-+ optrom_layout->NoOfRegions = (UINT32)
-+ (OptionRomTableSize / sizeof(INT_OPT_ROM_REGION) - 1);
-+
-+ for (iter = 0; iter < optrom_layout->NoOfRegions; iter++) {
-+ optrom_layout->Region[iter].Region =
-+ OptionRomTable[iter].Region;
-+ optrom_layout->Region[iter].Size =
-+ OptionRomTable[iter].Size;
-+
-+ if (OptionRomTable[iter].Region == INT_OPT_ROM_REGION_ALL)
-+ optrom_layout->Size = OptionRomTable[iter].Size;
-+ }
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ optrom_layout, OptionRomTableSize);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return ret;
-+}
-+
-+static void
-+qla2x00_get_option_rom_table(scsi_qla_host_t *ha,
-+ INT_OPT_ROM_REGION **pOptionRomTable, unsigned long *OptionRomTableSize)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ switch (ha->pdev->device) {
-+ case PCI_DEVICE_ID_QLOGIC_ISP6312:
-+ *pOptionRomTable = OptionRomTable6312;
-+ *OptionRomTableSize = sizeof(OptionRomTable6312);
-+ break;
-+ case PCI_DEVICE_ID_QLOGIC_ISP2312:
-+ /* HBA Model 6826A - is 2312 V3 Chip */
-+ if (ha->pdev->subsystem_vendor == 0x103C &&
-+ ha->pdev->subsystem_device == 0x12BA) {
-+ *pOptionRomTable = OptionRomTableHp;
-+ *OptionRomTableSize = sizeof(OptionRomTableHp);
-+ } else {
-+ *pOptionRomTable = OptionRomTable2312;
-+ *OptionRomTableSize = sizeof(OptionRomTable2312);
-+ }
-+ break;
-+ case PCI_DEVICE_ID_QLOGIC_ISP2322:
-+ *pOptionRomTable = OptionRomTable2322;
-+ *OptionRomTableSize = sizeof(OptionRomTable2322);
-+ break;
-+ case PCI_DEVICE_ID_QLOGIC_ISP6322:
-+ *pOptionRomTable = OptionRomTable6322;
-+ *OptionRomTableSize = sizeof(OptionRomTable6322);
-+ break;
-+ case PCI_DEVICE_ID_QLOGIC_ISP2422:
-+ case PCI_DEVICE_ID_QLOGIC_ISP2432:
-+ case PCI_DEVICE_ID_QLOGIC_ISP5422:
-+ case PCI_DEVICE_ID_QLOGIC_ISP5432:
-+ *pOptionRomTable = OptionRomTable2422;
-+ *OptionRomTableSize = sizeof(OptionRomTable2422);
-+ break;
-+ default:
-+ DEBUG9_10(printk("%s(%ld) Option Rom Table for device_id=0x%x "
-+ "not defined\n", __func__, ha->host_no, ha->pdev->device));
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+}
-+
-+int
-+qla2x00_get_vpd(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *ptmp_buf;
-+ uint32_t data_offset;
-+ uint32_t transfer_size;
-+ unsigned long flags;
-+
-+
-+ if (!(IS_QLA24XX(ha) || IS_QLA54XX(ha))) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld not 24xx or 25xx. exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ transfer_size = FA_NVRAM_VPD_SIZE * 4; /* byte count */
-+ if (pext->ResponseLen < transfer_size) {
-+ pext->ResponseLen = transfer_size;
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld Response buffer too small.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_buf,
-+ transfer_size)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ha->nvram_size));
-+ return (ret);
-+ }
-+
-+ if (PCI_FUNC(ha->pdev->devfn))
-+ data_offset = FA_NVRAM_VPD1_ADDR;
-+ else
-+ data_offset = FA_NVRAM_VPD0_ADDR;
-+
-+ /* Dump VPD region in NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_read_nvram_data(ha, ptmp_buf, data_offset, transfer_size);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_buf, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no));
-+
-+ return (ret);
-+}
-+
-+int
-+qla2x00_update_vpd(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *usr_tmp, *kernel_tmp, *pnew_nv;
-+ uint32_t data_offset;
-+ uint32_t transfer_size;
-+ unsigned long flags;
-+
-+
-+ if (!(IS_QLA24XX(ha) || IS_QLA54XX(ha))) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld not 24xx or 25xx. exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ transfer_size = FA_NVRAM_VPD_SIZE * 4; /* byte count */
-+ if (pext->RequestLen < transfer_size)
-+ transfer_size = pext->RequestLen;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pnew_nv, transfer_size)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%d.\n",
-+ __func__, ha->host_no, ha->instance, transfer_size));
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): transfer_size=%d.\n",
-+ __func__, ha->host_no, transfer_size));
-+
-+ /* Read from user buffer */
-+ kernel_tmp = (uint8_t *)pnew_nv;
-+ usr_tmp = Q64BIT_TO_PTR(pext->RequestAdr, pext->AddrMode);
-+
-+ ret = copy_from_user(kernel_tmp, usr_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): ERROR in buffer copy READ. RequestAdr=%p\n",
-+ __func__, ha->host_no, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ if (PCI_FUNC(ha->pdev->devfn))
-+ data_offset = FA_NVRAM_VPD1_ADDR;
-+ else
-+ data_offset = FA_NVRAM_VPD0_ADDR;
-+
-+ /* Write NVRAM. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ qla2x00_write_nvram_data(ha, pnew_nv, data_offset, transfer_size);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no));
-+
-+ /* No need to reset the 24xx. */
-+ return ret;
-+}
-+
-+int
-+qla2x00_get_sfp_data(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *ptmp_buf, *ptmp_iter;
-+ uint32_t transfer_size;
-+ uint16_t iter, addr, offset;
-+ int rval;
-+
-+ if (!(IS_QLA24XX(ha) || IS_QLA54XX(ha))) {
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld not 24xx or 25xx. exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ transfer_size = SFP_DEV_SIZE * 2;
-+ if (pext->ResponseLen < transfer_size) {
-+ pext->ResponseLen = transfer_size;
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld Response buffer too small.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_buf,
-+ transfer_size)) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ha->nvram_size));
-+ return (ret);
-+ }
-+
-+ ptmp_iter = ptmp_buf;
-+ addr = 0xa0;
-+ for (iter = 0, offset = 0; iter < (SFP_DEV_SIZE * 2) / SFP_BLOCK_SIZE;
-+ iter++, offset += SFP_BLOCK_SIZE) {
-+ if (iter == 4) {
-+ /* Skip to next device address. */
-+ addr = 0xa2;
-+ offset = 0;
-+ }
-+
-+ rval = qla2x00_read_sfp(ha, ha->sfp_data_dma, addr, offset,
-+ SFP_BLOCK_SIZE);
-+ if (rval != QLA_SUCCESS) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR reading SFP "
-+ "data (%x/%x/%x).\n",
-+ __func__, ha->host_no, ha->instance, rval, addr,
-+ offset));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+ memcpy(ptmp_iter, ha->sfp_data, SFP_BLOCK_SIZE);
-+ ptmp_iter += SFP_BLOCK_SIZE;
-+ }
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_buf, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): exiting.\n", __func__, ha->host_no));
-+
-+ return (ret);
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_init.c ./drivers/scsi/qla2xxx/qla_init.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_init.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_init.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,20 +1,8 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
-@@ -73,8 +61,25 @@ static void qla2x00_lun_free(scsi_qla_ho
-
- static int qla2x00_restart_isp(scsi_qla_host_t *);
- static void qla2x00_reset_adapter(scsi_qla_host_t *);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+static int qla2x00_mask_hba(scsi_qla_host_t *);
-+static int qla2x00_bstr_to_hex(char *, uint8_t *, int);
-+static int qla2x00_get_prop_int(scsi_qla_host_t *, char *, int *);
-+static int qla2x00_find_propname(scsi_qla_host_t *,
-+ char *, char *, char *, int);
-+static void qla2x00_get_lun_mask_from_config(scsi_qla_host_t *, fc_port_t *,
-+ uint16_t, uint16_t);
-+static int qla2x00_get_prop_16chars(scsi_qla_host_t *,
-+ char *, char *, char *);
-+static void qla2x00_get_properties(scsi_qla_host_t *, char *);
-+
-+static void qla2x00_cfg_persistent_binding(scsi_qla_host_t *);
-+static os_tgt_t *qla2x00_persistent_bind(scsi_qla_host_t *, uint8_t *,
-+ uint8_t *, port_id_t *, uint16_t);
-+#else
- static os_tgt_t *qla2x00_tgt_alloc(scsi_qla_host_t *, uint16_t);
- static os_lun_t *qla2x00_lun_alloc(scsi_qla_host_t *, uint16_t, uint16_t);
-+#endif
-
- //ISP24XX
- static int qla24xx_nvram_config(scsi_qla_host_t *);
-@@ -134,10 +139,49 @@ qla2x00_initialize_adapter(scsi_qla_host
- /* Initialize target map database. */
- qla2x00_init_tgt_map(ha);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Get Flash Version */
-+ qla2x00_get_flash_version(ha);
-+#endif
- qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
-
- qla2x00_nvram_config(ha);
-
-+ if (ha->flags.disable_serdes) {
-+ /* Mask HBA via NVRAM settings? */
-+ qla_printk(KERN_INFO, ha, "Masking HBA WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x (via NVRAM).\n",
-+ ha->port_name[0], ha->port_name[1],
-+ ha->port_name[2], ha->port_name[3],
-+ ha->port_name[4], ha->port_name[5],
-+ ha->port_name[6], ha->port_name[7]);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /*
-+ * If the user specified a device configuration on the command line
-+ * then use it as the configuration. Otherwise, we scan for all
-+ * devices.
-+ */
-+ if (ql2xdevconf) {
-+ ha->cmdline = ql2xdevconf;
-+
-+ if (qla2x00_mask_hba(ha)) {
-+ /* Mask the HBA. */
-+ qla_printk(KERN_INFO, ha, "Masking HBA WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ ha->port_name[0], ha->port_name[1],
-+ ha->port_name[2], ha->port_name[3],
-+ ha->port_name[4], ha->port_name[5],
-+ ha->port_name[6], ha->port_name[7]);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ if (!qla2x00_failover_enabled(ha))
-+ qla2x00_get_properties(ha, ql2xdevconf);
-+ }
-+#endif
-
- qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n");
-
-@@ -496,9 +540,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
- unsigned long flags = 0;
- device_reg_t __iomem *reg = ha->iobase;
- uint32_t cnt;
-- unsigned long mbx_flags = 0;
-- uint16_t cmd;
--
-+ uint16_t cmd, wd;
-
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- /* Disable ISP interrupts. */
-@@ -506,7 +548,6 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
-
- /* Perform RISC reset. */
- qla24xx_reset_risc(ha);
--
- return;
- }
-
-@@ -589,20 +630,15 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
-
- /* Reset ISP chip. */
- WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
-
- /* Wait for RISC to recover from reset. */
- if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
-- /*
-- * It is necessary to for a delay here since the card doesn't
-- * respond to PCI reads during a reset. On some architectures
-- * this will result in an MCA.
-- */
-- udelay(20);
- for (cnt = 30000; cnt; cnt--) {
-+ udelay(100);
- if ((RD_REG_WORD(&reg->ctrl_status) &
- CSR_ISP_SOFT_RESET) == 0)
- break;
-- udelay(100);
- }
- } else
- udelay(10);
-@@ -619,20 +655,8 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
-
- if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
- for (cnt = 0; cnt < 30000; cnt++) {
-- if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)))
-- spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags);
--
-- if (RD_MAILBOX_REG(ha, reg, 0) != MBS_BUSY) {
-- if (!(test_bit(ABORT_ISP_ACTIVE,
-- &ha->dpc_flags)))
-- spin_unlock_irqrestore(
-- &ha->mbx_reg_lock, mbx_flags);
-+ if (RD_MAILBOX_REG(ha, reg, 0) != MBS_BUSY)
- break;
-- }
--
-- if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)))
-- spin_unlock_irqrestore(&ha->mbx_reg_lock,
-- mbx_flags);
-
- udelay(100);
- }
-@@ -666,7 +690,7 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
- unsigned long flags = 0;
- uint16_t data;
- uint32_t cnt;
-- uint16_t mb[5];
-+ uint16_t mb[5], wd;
-
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- /* Perform RISC reset. */
-@@ -699,12 +723,8 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
-
- /* Reset ISP chip. */
- WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
-
-- /*
-- * We need to have a delay here since the card will not respond while
-- * in reset causing an MCA on some architectures.
-- */
-- udelay(20);
- data = qla2x00_debounce_register(&reg->ctrl_status);
- for (cnt = 6000000 ; cnt && (data & CSR_ISP_SOFT_RESET); cnt--) {
- udelay(5);
-@@ -801,36 +821,104 @@ chip_diag_failed:
- return (rval);
- }
-
--static void
-+void
- qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
- {
-- if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
-+ int rval;
-+ uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size,
-+ eft_size;
-+ dma_addr_t eft_dma;
-+ void *eft;
-+
-+ if (ha->fw_dump) {
-+ qla_printk(KERN_WARNING, ha,
-+ "Firmware dump previously allocated.\n");
- return;
-+ }
-
- ha->fw_dumped = 0;
--//#warning "ISP24XX -- Consolidate FW dump memory allocations"
--#ifdef ISP24xx
-+ fixed_size = mem_size = eft_size = 0;
- if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
-- ha->fw_dump_len = sizeof(struct qla2100_fw_dump);
-+ fixed_size = sizeof(struct qla2100_fw_dump);
- } else if (IS_QLA23XX(ha)) {
-- ha->fw_dump_len = sizeof(struct qla2300_fw_dump);
-- ha->fw_dump_len += (ha->fw_memory_size - 0x11000) *
-+ fixed_size = offsetof(struct qla2300_fw_dump, data_ram);
-+ mem_size = (ha->fw_memory_size - 0x11000 + 1) *
- sizeof(uint16_t);
-- } else /* if (IS_QLA24XX(ha)) */ {
-- ha->fw_dump_len = sizeof(struct qla24xx_fw_dump);
-- ha->fw_dump_len += (ha->fw_memory_size - 0x100000) *
-+ } else if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ fixed_size = offsetof(struct qla24xx_fw_dump, ext_mem);
-+ mem_size = (ha->fw_memory_size - 0x100000 + 1) *
- sizeof(uint32_t);
-- }
--#endif
-- ha->fw_dump24_len = sizeof(struct qla24xx_fw_dump);
-- ha->fw_dump24_len += (ha->fw_memory_size - 0x100000) * sizeof(uint32_t);
-- ha->fw_dump24 = vmalloc(ha->fw_dump24_len);
-- if (ha->fw_dump24)
-- qla_printk(KERN_INFO, ha, "Allocated (%d KB) for firmware "
-- "dump...\n", ha->fw_dump24_len / 1024);
-- else
-+
-+ /* Allocate memory for Extended Trace Buffer. */
-+ eft = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &eft_dma,
-+ GFP_KERNEL);
-+ if (!eft) {
-+ qla_printk(KERN_WARNING, ha, "Unable to allocate "
-+ "(%d KB) for EFT.\n", EFT_SIZE / 1024);
-+ goto cont_alloc;
-+ }
-+
-+ rval = qla2x00_trace_control(ha, TC_ENABLE, eft_dma,
-+ EFT_NUM_BUFFERS);
-+ if (rval) {
-+ qla_printk(KERN_WARNING, ha, "Unable to initialize "
-+ "EFT (%d).\n", rval);
-+ dma_free_coherent(&ha->pdev->dev, EFT_SIZE, eft,
-+ eft_dma);
-+ goto cont_alloc;
-+ }
-+
-+ qla_printk(KERN_INFO, ha, "Allocated (%d KB) for EFT...\n",
-+ EFT_SIZE / 1024);
-+
-+ eft_size = EFT_SIZE;
-+ memset(eft, 0, eft_size);
-+ ha->eft_dma = eft_dma;
-+ ha->eft = eft;
-+ }
-+cont_alloc:
-+ req_q_size = ha->request_q_length * sizeof(request_t);
-+ rsp_q_size = ha->response_q_length * sizeof(response_t);
-+
-+ dump_size = offsetof(struct qla2xxx_fw_dump, isp);
-+ dump_size += fixed_size + mem_size + req_q_size + rsp_q_size +
-+ eft_size;
-+
-+ ha->fw_dump = vmalloc(dump_size);
-+ if (!ha->fw_dump) {
- qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for "
-- "firmware dump!!!\n", ha->fw_dump24_len / 1024);
-+ "firmware dump!!!\n", dump_size / 1024);
-+
-+ if (ha->eft) {
-+ dma_free_coherent(&ha->pdev->dev, eft_size, ha->eft,
-+ ha->eft_dma);
-+ ha->eft = NULL;
-+ ha->eft_dma = 0;
-+ }
-+ return;
-+ }
-+
-+ qla_printk(KERN_INFO, ha, "Allocated (%d KB) for firmware dump...\n",
-+ dump_size / 1024);
-+
-+ ha->fw_dump_len = dump_size;
-+ ha->fw_dump->signature[0] = 'Q';
-+ ha->fw_dump->signature[1] = 'L';
-+ ha->fw_dump->signature[2] = 'G';
-+ ha->fw_dump->signature[3] = 'C';
-+ ha->fw_dump->version = __constant_htonl(1);
-+
-+ ha->fw_dump->fixed_size = htonl(fixed_size);
-+ ha->fw_dump->mem_size = htonl(mem_size);
-+ ha->fw_dump->req_q_size = htonl(req_q_size);
-+ ha->fw_dump->rsp_q_size = htonl(rsp_q_size);
-+
-+ ha->fw_dump->eft_size = htonl(eft_size);
-+ ha->fw_dump->eft_addr_l = htonl(LSD(ha->eft_dma));
-+ ha->fw_dump->eft_addr_h = htonl(MSD(ha->eft_dma));
-+
-+ ha->fw_dump->header_size =
-+ htonl(offsetof(struct qla2xxx_fw_dump, isp));
- }
-
- /**
-@@ -848,10 +936,6 @@ qla2x00_resize_request_q(scsi_qla_host_t
- dma_addr_t request_dma;
- request_t *request_ring;
-
--//ISP24xx
--if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- qla2x00_alloc_fw_dump(ha);
--
- /* Valid only on recent ISPs. */
- if (IS_QLA2100(ha) || IS_QLA2200(ha))
- return;
-@@ -923,6 +1007,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
- &ha->fw_subminor_version,
- &ha->fw_attributes, &ha->fw_memory_size);
- qla2x00_resize_request_q(ha);
-+
-+ if (ql2xallocfwdump)
-+ qla2x00_alloc_fw_dump(ha);
- }
- } else {
- DEBUG2(printk(KERN_INFO
-@@ -1032,6 +1119,12 @@ qla2x00_update_fw_options(scsi_qla_host_
- /* Return command IOCBs without waiting for an ABTS to complete. */
- ha->fw_options[3] |= BIT_13;
-
-+ /* Cluster fix.
-+ * So new request don't get returned with reservation conflict before
-+ * TM func completes. Wait for FCP_RSP before completing the TMF.
-+ */
-+ ha->fw_options[3] |= BIT_10;
-+
- /* LED scheme. */
- if (ha->flags.enable_led_scheme)
- ha->fw_options[2] |= BIT_12;
-@@ -1208,8 +1301,7 @@ qla2x00_fw_ready(scsi_qla_host_t *ha)
- rval = QLA_FUNCTION_FAILED;
-
- if (atomic_read(&ha->loop_down_timer) &&
-- (fw_state >= FSTATE_LOSS_OF_SYNC ||
-- fw_state == FSTATE_WAIT_AL_PA)) {
-+ fw_state != FSTATE_READY) {
- /* Loop down. Timeout on min_wait for states
- * other than Wait for Login.
- */
-@@ -1231,7 +1323,8 @@ qla2x00_fw_ready(scsi_qla_host_t *ha)
- break;
-
- /* Delay for a while */
-- msleep(500);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ / 2);
-
- DEBUG3(printk("scsi(%ld): fw_state=%x curr time=%lx.\n",
- ha->host_no, fw_state, jiffies));
-@@ -1360,6 +1453,101 @@ qla2x00_configure_hba(scsi_qla_host_t *h
- return(rval);
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+static void
-+qla2x00_alias_hba(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+ int instance;
-+ uint8_t *propbuf;
-+ init_cb_t *icb;
-+ uint8_t pn[WWN_SIZE];
-+
-+ if (!ql2xdevconf)
-+ return;
-+
-+ propbuf = kmalloc(LINESIZE, GFP_KERNEL);
-+ if (!propbuf)
-+ return;
-+
-+ icb = ha->init_cb;
-+ for (instance = 0; instance < MAX_HOST_COUNT; instance++) {
-+ sprintf(propbuf, "scsi-qla%d-adapter-port", instance);
-+ rval = qla2x00_get_prop_16chars(ha, propbuf, pn, ql2xdevconf);
-+ if (rval != QLA_SUCCESS)
-+ break;
-+
-+ /* Portname match? */
-+ if (memcmp(ha->init_cb->port_name, pn, WWN_SIZE))
-+ continue;
-+
-+ /* Check for portname alias. */
-+ sprintf(propbuf, "scsi-qla%d-aliased-port", instance);
-+ rval = qla2x00_get_prop_16chars(ha, propbuf, pn, ql2xdevconf);
-+ if (rval != QLA_SUCCESS)
-+ break;
-+
-+ /* Use aliased portname. */
-+ qla_printk(KERN_INFO, ha, "Using aliased WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ icb->port_name[0], icb->port_name[1], icb->port_name[2],
-+ icb->port_name[3], icb->port_name[4], icb->port_name[5],
-+ icb->port_name[6], icb->port_name[7], pn[0], pn[1], pn[2],
-+ pn[3], pn[4], pn[5], pn[6], pn[7]);
-+
-+ memcpy(icb->port_name, pn, WWN_SIZE);
-+
-+ break;
-+ }
-+ kfree(propbuf);
-+}
-+
-+static int
-+qla2x00_mask_hba(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+ int instance;
-+ int mask;
-+ uint8_t *propbuf;
-+ init_cb_t *icb;
-+ uint8_t pn[WWN_SIZE];
-+ int propval;
-+
-+ mask = 0;
-+ if (!ql2xdevconf)
-+ return mask;
-+
-+ propbuf = kmalloc(LINESIZE, GFP_KERNEL);
-+ if (!propbuf)
-+ return mask;
-+
-+ icb = ha->init_cb;
-+ for (instance = 0; instance < MAX_HOST_COUNT; instance++) {
-+ sprintf(propbuf, "scsi-qla%d-adapter-port", instance);
-+ rval = qla2x00_get_prop_16chars(ha, propbuf, pn, ha->cmdline);
-+ if (rval != QLA_SUCCESS)
-+ break;
-+
-+ /* Portname match? */
-+ if (memcmp(ha->init_cb->port_name, pn, WWN_SIZE))
-+ continue;
-+
-+ /* Check for disable directive. */
-+ propval = 0;
-+ sprintf(propbuf, "scsi-qla%d-adapter-disable", instance);
-+ rval = qla2x00_get_prop_int(ha, propbuf, &propval);
-+ if (!rval)
-+ break;
-+ if (propval)
-+ mask = 1;
-+ break;
-+ }
-+ kfree(propbuf);
-+
-+ return mask;
-+}
-+#endif
- /*
- * NVRAM configuration for ISP 2xxx
- *
-@@ -1562,6 +1750,19 @@ qla2x00_nvram_config(scsi_qla_host_t *ha
- while (cnt--)
- *dptr1++ = *dptr2++;
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Handle WWNN/WWPN aliasing. */
-+ qla2x00_alias_hba(ha);
-+
-+ memcpy(ha->ip_port_name, icb->port_name, WWN_SIZE);
-+#endif
-+
-+ /* Use alternate WWN? */
-+ if (nv->host_p[1] & BIT_7) {
-+ memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE);
-+ memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE);
-+ }
-+
- /* Prepare nodename */
- if ((icb->firmware_options[1] & BIT_6) == 0) {
- /*
-@@ -1585,6 +1786,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha
- ha->flags.enable_lip_full_login = ((nv->host_p[1] & BIT_2) ? 1 : 0);
- ha->flags.enable_target_reset = ((nv->host_p[1] & BIT_3) ? 1 : 0);
- ha->flags.enable_led_scheme = (nv->special_options[1] & BIT_4) ? 1 : 0;
-+ ha->flags.disable_serdes = 0;
-
- ha->operating_mode =
- (icb->add_firmware_options[0] & (BIT_6 | BIT_5 | BIT_4)) >> 4;
-@@ -1756,7 +1958,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha
- fcport->loop_id = FC_NO_LOOP_ID;
- fcport->iodesc_idx_sent = IODESC_INVALID_INDEX;
- atomic_set(&fcport->state, FCS_UNCONFIGURED);
-- fcport->flags = FCF_RLC_SUPPORT;
-+ fcport->flags = FC_RLC_SUPPORT;
- fcport->os_target_id = MAX_TARGETS;
- INIT_LIST_HEAD(&fcport->fcluns);
-
-@@ -1819,6 +2021,9 @@ qla2x00_configure_loop(scsi_qla_host_t *
- set_bit(RSCN_UPDATE, &flags);
- clear_bit(LOCAL_LOOP_UPDATE, &flags);
-
-+ } else if (ha->current_topology == ISP_CFG_N) {
-+ clear_bit(RSCN_UPDATE, &flags);
-+
- } else if (!ha->flags.online ||
- (test_bit(ABORT_ISP_ACTIVE, &flags))) {
-
-@@ -1848,7 +2053,21 @@ qla2x00_configure_loop(scsi_qla_host_t *
- test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
- rval = QLA_FUNCTION_FAILED;
- } else {
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (!qla2x00_failover_enabled(ha)) {
-+ qla2x00_config_os(ha);
-+ } else {
-+ DEBUG(printk("scsi(%ld): schedule FAILBACK "
-+ "EVENT\n", ha->host_no));
-+ if (!(test_and_set_bit(FAILOVER_EVENT_NEEDED,
-+ &ha->dpc_flags))) {
-+ ha->failback_delay = ql2xfailbackTime;
-+ }
-+ ha->failover_type = MP_NOTIFY_LOOP_UP;
-+ }
-+#else
- qla2x00_config_os(ha);
-+#endif
- atomic_set(&ha->loop_state, LOOP_READY);
-
- DEBUG(printk("scsi(%ld): LOOP READY\n", ha->host_no));
-@@ -1924,22 +2143,22 @@ qla2x00_configure_local_loop(scsi_qla_ho
- rval = QLA_MEMORY_ALLOC_FAILED;
- goto cleanup_allocation;
- }
-- new_fcport->flags &= ~FCF_FABRIC_DEVICE;
-+ new_fcport->flags &= ~FC_FABRIC_DEVICE;
-
- /*
-- * Mark local devices that were present with FCF_DEVICE_LOST for now.
-+ * Mark local devices that were present with FC_DEVICE_LOST for now.
- */
- list_for_each_entry(fcport, &ha->fcports, list) {
- if (atomic_read(&fcport->state) == FCS_ONLINE &&
- fcport->port_type != FCT_BROADCAST &&
-- (fcport->flags & FCF_FABRIC_DEVICE) == 0) {
-+ (fcport->flags & FC_FABRIC_DEVICE) == 0) {
-
- DEBUG(printk("scsi(%ld): Marking port lost, "
- "loop_id=0x%04x\n",
- ha->host_no, fcport->loop_id));
-
- atomic_set(&fcport->state, FCS_DEVICE_LOST);
-- fcport->flags &= ~FCF_FARP_DONE;
-+ fcport->flags &= ~FC_FARP_DONE;
- }
- }
-
-@@ -2001,8 +2220,8 @@ qla2x00_configure_local_loop(scsi_qla_ho
- WWN_SIZE))
- continue;
-
-- fcport->flags &= ~(FCF_FABRIC_DEVICE |
-- FCF_PERSISTENT_BOUND);
-+ fcport->flags &= ~(FC_FABRIC_DEVICE |
-+ FC_PERSISTENT_BOUND);
- fcport->loop_id = new_fcport->loop_id;
- fcport->port_type = new_fcport->port_type;
- fcport->d_id.b24 = new_fcport->d_id.b24;
-@@ -2015,7 +2234,7 @@ qla2x00_configure_local_loop(scsi_qla_ho
-
- if (!found) {
- /* New device, add to fcports list. */
-- new_fcport->flags &= ~FCF_PERSISTENT_BOUND;
-+ new_fcport->flags &= ~FC_PERSISTENT_BOUND;
- list_add_tail(&new_fcport->list, &ha->fcports);
-
- /* Allocate a new replacement fcport. */
-@@ -2025,7 +2244,7 @@ qla2x00_configure_local_loop(scsi_qla_ho
- rval = QLA_MEMORY_ALLOC_FAILED;
- goto cleanup_allocation;
- }
-- new_fcport->flags &= ~FCF_FABRIC_DEVICE;
-+ new_fcport->flags &= ~FC_FABRIC_DEVICE;
- }
-
- qla2x00_update_fcport(ha, fcport);
-@@ -2092,13 +2311,17 @@ qla2x00_update_fcport(scsi_qla_host_t *h
- PORT_RETRY_TIME;
- atomic_set(&fcport->port_down_timer, ha->port_down_retry_count *
- PORT_RETRY_TIME);
-- fcport->flags &= ~FCF_LOGIN_NEEDED;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ fcport->flags &= ~(FC_FAILOVER_NEEDED | FC_LOGIN_NEEDED);
-+#else
-+ fcport->flags &= ~FC_LOGIN_NEEDED;
-+#endif
-
- /*
- * Check for outstanding cmd on tape Bypass LUN discovery if active
- * command on tape.
- */
-- if (fcport->flags & FCF_TAPE_PRESENT) {
-+ if (fcport->flags & FC_TAPE_PRESENT) {
- spin_lock_irqsave(&ha->hardware_lock, flags);
- for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
- if ((sp = ha->outstanding_cmds[index]) != 0) {
-@@ -2119,6 +2342,13 @@ qla2x00_update_fcport(scsi_qla_host_t *h
- fcport->device_type = TYPE_PROCESSOR;
- } else {
- qla2x00_lun_discovery(ha, fcport);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if ((fcport->flags & (FC_MSA_DEVICE | FC_EVA_DEVICE |
-+ FC_AA_EVA_DEVICE | FC_AA_MSA_DEVICE |
-+ FC_DFXXX_DEVICE | FC_DSXXX_DEVICE | FC_NVSXXX_DEVICE |
-+ FC_SYMXXX_DEVICE)))
-+ qla2x00_test_active_port(fcport);
-+#endif
- }
- atomic_set(&fcport->state, FCS_ONLINE);
- }
-@@ -2189,7 +2419,7 @@ qla2x00_rpt_lun_discovery(scsi_qla_host_
- rval = QLA_FUNCTION_FAILED;
-
- /* No point in continuing if the device doesn't support RLC */
-- if ((fcport->flags & FCF_RLC_SUPPORT) == 0)
-+ if ((fcport->flags & FC_RLC_SUPPORT) == 0)
- return (rval);
-
- rval = qla2x00_report_lun(ha, fcport);
-@@ -2346,7 +2576,7 @@ qla2x00_report_lun(scsi_qla_host_t *ha,
- if (rval == QLA_SUCCESS &&
- comp_status == CS_PORT_LOGGED_OUT &&
- atomic_read(&fcport->state) != FCS_DEVICE_DEAD) {
-- if (fcport->flags & FCF_FABRIC_DEVICE) {
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
- DEBUG2(printk("scsi(%ld): Attempting "
- "to re-login to %04x/%p.\n",
- ha->host_no, fcport->loop_id,
-@@ -2382,7 +2612,7 @@ qla2x00_report_lun(scsi_qla_host_t *ha,
- sense_data[5], sense_data[6],
- sense_data[7]));
- if (sense_data[2] == ILLEGAL_REQUEST) {
-- fcport->flags &= ~(FCF_RLC_SUPPORT);
-+ fcport->flags &= ~(FC_RLC_SUPPORT);
- break;
- }
- }
-@@ -2433,7 +2663,7 @@ qla2x00_cfg_lun(scsi_qla_host_t *ha, fc_
- case 0x0C:
- break;
- case TYPE_TAPE:
-- fcport->flags |= FCF_TAPE_PRESENT;
-+ fcport->flags |= FC_TAPE_PRESENT;
- break;
- default:
- DEBUG2(printk("scsi(%ld): Unsupported lun type -- "
-@@ -2443,9 +2673,20 @@ qla2x00_cfg_lun(scsi_qla_host_t *ha, fc_
- }
-
- fcport->device_type = device_type;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Does this port require special failover handling? */
-+ if (qla2x00_failover_enabled(ha)) {
-+ fcport->cfg_id = qla2x00_cfg_lookup_device(&inq->inq[0]);
-+ qla2x00_set_device_flags(ha, fcport);
-+ }
-+#endif
- fclun = qla2x00_add_lun(fcport, lun);
-
- if (fclun != NULL) {
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Alua/tpgs field of inquiry data. */
-+ fclun->asymm_support = ((inq->inq[5] >> 4) & 3);
-+#endif
- atomic_set(&fcport->state, FCS_ONLINE);
- }
-
-@@ -2482,8 +2723,10 @@ qla2x00_add_lun(fc_port_t *fcport, uint1
- break;
- }
- }
-- if (found)
-+ if (found) {
-+ fclun->device_type = fcport->device_type;
- return (fclun);
-+ }
-
- fclun = kmalloc(sizeof(fc_lun_t), GFP_ATOMIC);
- if (fclun == NULL) {
-@@ -2637,7 +2880,7 @@ qla2x00_inquiry(scsi_qla_host_t *ha, fc_
- if (rval == QLA_SUCCESS &&
- comp_status == CS_PORT_LOGGED_OUT &&
- atomic_read(&fcport->state) != FCS_DEVICE_DEAD) {
-- if (fcport->flags & FCF_FABRIC_DEVICE) {
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
- DEBUG2(printk("scsi(%ld): Attempting "
- "to re-login to %04x/%p.\n",
- ha->host_no, fcport->loop_id,
-@@ -2787,14 +3030,14 @@ qla2x00_configure_fabric(scsi_qla_host_t
- if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
- break;
-
-- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
-+ if ((fcport->flags & FC_FABRIC_DEVICE) == 0)
- continue;
-
- if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
- qla2x00_mark_device_lost(ha, fcport,
- ql2xplogiabsentdevice);
- if (fcport->loop_id != FC_NO_LOOP_ID &&
-- (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
-+ (fcport->flags & FC_TAPE_PRESENT) == 0 &&
- fcport->port_type != FCT_INITIATOR &&
- fcport->port_type != FCT_BROADCAST) {
-
-@@ -2820,8 +3063,8 @@ qla2x00_configure_fabric(scsi_qla_host_t
- test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
- break;
-
-- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
-- (fcport->flags & FCF_LOGIN_NEEDED) == 0)
-+ if ((fcport->flags & FC_FABRIC_DEVICE) == 0 ||
-+ (fcport->flags & FC_LOGIN_NEEDED) == 0)
- continue;
-
- if (fcport->loop_id == FC_NO_LOOP_ID) {
-@@ -2937,7 +3180,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho
- kfree(swl);
- return (QLA_MEMORY_ALLOC_FAILED);
- }
-- new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
-+ new_fcport->flags |= (FC_FABRIC_DEVICE | FC_LOGIN_NEEDED);
-
- /* Set start port ID scan at adapter ID. */
- first_dev = 1;
-@@ -3030,12 +3273,12 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho
- /*
- * If device was not a fabric device before.
- */
-- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) {
-+ if ((fcport->flags & FC_FABRIC_DEVICE) == 0) {
- fcport->d_id.b24 = new_fcport->d_id.b24;
- fcport->loop_id = FC_NO_LOOP_ID;
-- fcport->flags |= (FCF_FABRIC_DEVICE |
-- FCF_LOGIN_NEEDED);
-- fcport->flags &= ~FCF_PERSISTENT_BOUND;
-+ fcport->flags |= (FC_FABRIC_DEVICE |
-+ FC_LOGIN_NEEDED);
-+ fcport->flags &= ~FC_PERSISTENT_BOUND;
- break;
- }
-
-@@ -3045,9 +3288,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho
- * relogin later.
- */
- fcport->d_id.b24 = new_fcport->d_id.b24;
-- fcport->flags |= FCF_LOGIN_NEEDED;
-+ fcport->flags |= FC_LOGIN_NEEDED;
- if (fcport->loop_id != FC_NO_LOOP_ID &&
-- (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
-+ (fcport->flags & FC_TAPE_PRESENT) == 0 &&
- fcport->port_type != FCT_INITIATOR &&
- fcport->port_type != FCT_BROADCAST) {
- qla2x00_fabric_logout(ha, fcport->loop_id,
-@@ -3073,7 +3316,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho
- kfree(swl);
- return (QLA_MEMORY_ALLOC_FAILED);
- }
-- new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
-+ new_fcport->flags |= (FC_FABRIC_DEVICE | FC_LOGIN_NEEDED);
- new_fcport->d_id.b24 = nxt_d_id.b24;
- }
-
-@@ -3266,7 +3509,7 @@ qla2x00_device_resync(scsi_qla_host_t *h
- qla2x00_cancel_io_descriptors(ha);
-
- list_for_each_entry(fcport, &ha->fcports, list) {
-- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
-+ if ((fcport->flags & FC_FABRIC_DEVICE) == 0 ||
- (fcport->d_id.b24 & mask) != d_id.b24 ||
- fcport->port_type == FCT_BROADCAST)
- continue;
-@@ -3278,7 +3521,7 @@ qla2x00_device_resync(scsi_qla_host_t *h
- FCS_DEVICE_LOST);
- }
- }
-- fcport->flags &= ~FCF_FARP_DONE;
-+ fcport->flags &= ~FC_FARP_DONE;
- }
- }
- return (rval);
-@@ -3315,7 +3558,7 @@ qla2x00_fabric_dev_login(scsi_qla_host_t
- if (rval == QLA_SUCCESS) {
- /* Send an ADISC to tape devices.*/
- opts = 0;
-- if (fcport->flags & FCF_TAPE_PRESENT)
-+ if (fcport->flags & FC_TAPE_PRESENT)
- opts |= BIT_1;
- rval = qla2x00_get_port_database(ha, fcport, opts);
- if (rval != QLA_SUCCESS) {
-@@ -3404,7 +3647,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha
- } else {
- fcport->port_type = FCT_TARGET;
- if (mb[1] & BIT_1) {
-- fcport->flags |= FCF_TAPE_PRESENT;
-+ fcport->flags |= FC_TAPE_PRESENT;
- }
- }
-
-@@ -3583,7 +3826,7 @@ qla2x00_restart_queues(scsi_qla_host_t *
- * When time expire return request back to OS as BUSY
- */
- __del_from_pending_queue(ha, sp);
-- sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->result = DID_IMM_RETRY << 16;
- sp->cmd->host_scribble = (unsigned char *)NULL;
- __add_to_done_queue(ha, sp);
- }
-@@ -3603,7 +3846,7 @@ qla2x00_restart_queues(scsi_qla_host_t *
- sp = list_entry(list, srb_t, list);
- /* when time expire return request back to OS as BUSY */
- __del_from_retry_queue(ha, sp);
-- sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->result = DID_IMM_RETRY << 16;
- sp->cmd->host_scribble = (unsigned char *)NULL;
- __add_to_done_queue(ha, sp);
- }
-@@ -3612,7 +3855,7 @@ qla2x00_restart_queues(scsi_qla_host_t *
- DEBUG2(printk("%s(%ld): callback %d commands.\n",
- __func__,
- ha->host_no,
-- retry_q_cnt);)
-+ retry_q_cnt));
- }
-
- DEBUG2(printk("%s(%ld): active=%ld, retry=%d, pending=%d, "
-@@ -3623,8 +3866,12 @@ qla2x00_restart_queues(scsi_qla_host_t *
- ha->retry_q_cnt,
- pending_q_cnt,
- ha->done_q_cnt,
-- ha->scsi_retry_q_cnt);)
-+ ha->scsi_retry_q_cnt));
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha))
-+ qla2xxx_start_all_adapters(ha);
-+#endif
- if (!list_empty(&ha->done_queue))
- qla2x00_done(ha);
- }
-@@ -3637,11 +3884,11 @@ qla2x00_rescan_fcports(scsi_qla_host_t *
-
- rescan_done = 0;
- list_for_each_entry(fcport, &ha->fcports, list) {
-- if ((fcport->flags & FCF_RESCAN_NEEDED) == 0)
-+ if ((fcport->flags & FC_RESCAN_NEEDED) == 0)
- continue;
-
- qla2x00_update_fcport(ha, fcport);
-- fcport->flags &= ~FCF_RESCAN_NEEDED;
-+ fcport->flags &= ~FC_RESCAN_NEEDED;
-
- rescan_done = 1;
- }
-@@ -3649,7 +3896,14 @@ qla2x00_rescan_fcports(scsi_qla_host_t *
-
- /* Update OS target and lun structures if necessary. */
- if (rescan_done) {
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (!qla2x00_failover_enabled(ha))
-+ qla2x00_config_os(ha);
-+ else
-+ qla2x00_cfg_remap(ha);
-+#else
- qla2x00_config_os(ha);
-+#endif
- }
- }
-
-@@ -3688,7 +3942,7 @@ qla2x00_config_os(scsi_qla_host_t *ha)
- continue;
- }
-
-- if (fcport->flags & FCF_FO_MASKED) {
-+ if (fcport->flags & FC_FO_MASKED) {
- continue;
- }
-
-@@ -3802,10 +4056,14 @@ qla2x00_fcport_bind(scsi_qla_host_t *ha,
- atomic_read(&fcport->port_down_timer)));
-
- fcport->tgt_queue = tq;
-- fcport->flags |= FCF_PERSISTENT_BOUND;
-+ fcport->flags |= FC_PERSISTENT_BOUND;
- tq->fcport = fcport;
- set_bit(TQF_ONLINE, &tq->flags);
- tq->port_down_retry_count = ha->port_down_retry_count;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (!qla2x00_failover_enabled(ha))
-+ qla2x00_get_lun_mask_from_config(ha, fcport, tgt, 0);
-+#endif
- }
-
- if (!ConfigRequired && tgt == MAX_TARGETS) {
-@@ -3878,7 +4136,11 @@ qla2x00_fclun_bind(scsi_qla_host_t *ha,
- * Context:
- * Kernel context.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+os_tgt_t *
-+#else
- static os_tgt_t *
-+#endif
- qla2x00_tgt_alloc(scsi_qla_host_t *ha, uint16_t tgt)
- {
- os_tgt_t *tq;
-@@ -3945,12 +4207,11 @@ qla2x00_tgt_free(scsi_qla_host_t *ha, ui
-
- tq = TGT_Q(ha, tgt);
- if (tq != NULL) {
-- TGT_Q(ha, tgt) = NULL;
--
- /* Free LUN structures. */
- for (lun = 0; lun < MAX_LUNS; lun++)
- qla2x00_lun_free(ha, tgt, lun);
-
-+ TGT_Q(ha, tgt) = NULL;
- kfree(tq);
- }
-
-@@ -3972,7 +4233,11 @@ qla2x00_tgt_free(scsi_qla_host_t *ha, ui
- * Context:
- * Kernel context.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+os_lun_t *
-+#else
- static os_lun_t *
-+#endif
- qla2x00_lun_alloc(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun)
- {
- os_lun_t *lq;
-@@ -4004,6 +4269,23 @@ qla2x00_lun_alloc(scsi_qla_host_t *ha, u
- */
- lq->q_state = LUN_STATE_READY;
- spin_lock_init(&lq->q_lock);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha)) {
-+ lq->fo_ptr = kmalloc(sizeof(struct osl_fo_info),
-+ GFP_ATOMIC);
-+ if (lq->fo_ptr) {
-+ memset(lq->fo_ptr, 0,
-+ sizeof(struct osl_fo_info));
-+ } else {
-+ qla_printk(KERN_WARNING, ha,
-+ "Unable to allocate FO lun "
-+ "information.\n");
-+ LUN_Q(ha, tgt, lun) = NULL;
-+ kfree(lq);
-+ lq = NULL;
-+ }
-+ }
-+#endif
- }
- }
-
-@@ -4042,12 +4324,504 @@ qla2x00_lun_free(scsi_qla_host_t *ha, ui
-
- if (TGT_Q(ha, tgt) != NULL && (lq = LUN_Q(ha, tgt, lun)) != NULL) {
- LUN_Q(ha, tgt, lun) = NULL;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (lq->fo_ptr)
-+ kfree(lq->fo_ptr);
-+#endif
- kfree(lq);
- }
-
- return;
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * qla2x00_bstr_to_hex
-+ * Convert hex byte string to number.
-+ *
-+ * Input:
-+ * s = byte string pointer.
-+ * bp = byte pointer for number.
-+ * size = number of bytes.
-+ *
-+ * Context:
-+ * Kernel/Interrupt context.
-+ */
-+static int
-+qla2x00_bstr_to_hex(char *s, uint8_t *bp, int size)
-+{
-+ int cnt;
-+ uint8_t n;
-+
-+ for (cnt = 0; *s != '\0' && cnt / 2 < size; cnt++) {
-+ if (*s >= 'A' && *s <= 'F') {
-+ n = (*s++ - 'A') + 10;
-+ } else if (*s >= 'a' && *s <= 'f') {
-+ n = (*s++ - 'a') + 10;
-+ } else if (*s >= '0' && *s <= '9') {
-+ n = *s++ - '0';
-+ } else {
-+ cnt = 0;
-+ break;
-+ }
-+
-+ if (cnt & BIT_0)
-+ *bp++ |= n;
-+ else
-+ *bp = n << 4;
-+ }
-+
-+ /* fixme(dg) Need to swap data little endian */
-+
-+ return (cnt / 2);
-+}
-+
-+/*
-+ * qla2x00_get_prop_xstr
-+ * Get a string property value for the specified property name and
-+ * convert from the property string found in the configuration file,
-+ * which are ASCII characters representing nibbles, 2 characters represent
-+ * the hexdecimal value for a byte in the byte array.
-+ * The byte array is initialized to zero.
-+ * The resulting converted value is in big endian format (MSB at byte0).
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * propname = property name pointer.
-+ * propval = pointer where to store converted property val.
-+ * size = max or expected size of 'propval' array.
-+ *
-+ * Returns:
-+ * 0 = empty value string or invalid character in string
-+ * >0 = count of characters converted
-+ * -1 = property not found
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_get_prop_xstr(scsi_qla_host_t *ha,
-+ char *propname, uint8_t *propval, int size)
-+{
-+ char *propstr;
-+ int rval = -1;
-+//XXX
-+ static char buf[LINESIZE];
-+
-+ /* Get the requested property string */
-+ rval = qla2x00_find_propname(ha, propname, buf, ha->cmdline, size*2);
-+ DEBUG3(printk("%s(): Ret rval from find propname = %d\n",
-+ __func__,
-+ rval));
-+
-+ propstr = &buf[0];
-+ if (*propstr == '=')
-+ propstr++; /* ignore equal sign */
-+
-+ if (rval == 0) { /* not found */
-+ return (-1);
-+ }
-+
-+ rval = qla2x00_bstr_to_hex(propstr, (uint8_t *)propval, size);
-+ if (rval == 0) {
-+ /* Invalid character in value string */
-+ qla_printk(KERN_INFO, ha,
-+ "%s(): %s Invalid hex string for property\n",
-+ __func__,
-+ propname);
-+ qla_printk(KERN_INFO, ha,
-+ " Invalid string - %s\n",
-+ propstr);
-+ }
-+
-+ return (rval);
-+}
-+
-+static int
-+qla2x00_get_prop_int(scsi_qla_host_t *ha, char *propname, int *propval)
-+{
-+ char *propstr;
-+ int rval = -1;
-+ char buf[LINESIZE];
-+
-+ /* Get the requested property string */
-+ rval = qla2x00_find_propname(ha, propname, buf, ha->cmdline,
-+ LINESIZE/2);
-+ if (!rval)
-+ return -1;
-+
-+ propstr = &buf[0];
-+ if (*propstr == '=')
-+ propstr++; /* ignore equal sign */
-+
-+ rval = sscanf(propstr, "%d", propval);
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_find_propname
-+ * Get property in database.
-+ *
-+ * Input:
-+ * ha = adapter structure pointer.
-+ * db = pointer to database
-+ * propstr = pointer to dest array for string
-+ * propname = name of property to search for.
-+ * siz = size of property
-+ *
-+ * Returns:
-+ * 0 = no property
-+ * size = index of property
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_find_propname(scsi_qla_host_t *ha,
-+ char *propname, char *propstr,
-+ char *db, int siz)
-+{
-+ char *cp;
-+
-+ /* find the specified string */
-+ if (db) {
-+ /* find the property name */
-+ if ((cp = strstr(db,propname)) != NULL) {
-+ while ((*cp) && *cp != '=')
-+ cp++;
-+ if (*cp) {
-+ strncpy(propstr, cp, siz+1);
-+ propstr[siz+1] = '\0';
-+ DEBUG(printk("qla2x00_find_propname: found "
-+ "property = {%s}\n",
-+ propstr));
-+ return (siz); /* match */
-+ }
-+ }
-+ }
-+
-+ return (0);
-+}
-+
-+/*
-+ * qla2x00_get_lun_mask_from_config
-+ * Get lun mask from the configuration parameters.
-+ * Bit order is little endian.
-+ *
-+ * Input:
-+ * ha -- Host adapter
-+ * tgt -- target/device number
-+ * port -- pointer to port
-+ */
-+static void
-+qla2x00_get_lun_mask_from_config(scsi_qla_host_t *ha,
-+ fc_port_t *fcport, uint16_t tgt, uint16_t dev_no)
-+{
-+ char propbuf[60]; /* size of search string */
-+ int rval, lun, bit;
-+ lun_bit_mask_t lun_mask, *mask_ptr = &lun_mask;
-+
-+ /* Get "target-N-device-N-lun-mask" as a 256 bit lun_mask*/
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-lun-disabled",
-+ ha->instance, tgt, dev_no);
-+
-+ rval = qla2x00_get_prop_xstr(ha, propbuf,
-+ (uint8_t *)&lun_mask, sizeof(lun_bit_mask_t));
-+ if (rval == sizeof(lun_bit_mask_t)) {
-+ memset(&fcport->lun_mask, 0, sizeof(lun_bit_mask_t));
-+ for (lun = 8 * sizeof(lun_bit_mask_t) - 1, bit = 0;
-+ lun >= 0; lun--, bit++) {
-+ if (EXT_IS_LUN_BIT_SET(mask_ptr, lun))
-+ EXT_SET_LUN_BIT((&fcport->lun_mask), bit);
-+ }
-+
-+ DEBUG3(printk("scsi(%ld): returning lun mask for fcport "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x:\n",
-+ ha->host_no,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+ DEBUG3(qla2x00_dump_buffer((uint8_t *)&fcport->lun_mask,
-+ sizeof(lun_bit_mask_t)));
-+ }
-+}
-+
-+/*
-+ * qla2x00_get_prop_16chars
-+ * Get an 8-byte property value for the specified property name by
-+ * converting from the property string found in the configuration file.
-+ * The resulting converted value is in big endian format (MSB at byte0).
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * propname = property name pointer.
-+ * propval = pointer to location for the converted property val.
-+ * db = pointer to database
-+ *
-+ * Returns:
-+ * 0 = value returned successfully.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_prop_16chars(scsi_qla_host_t *ha,
-+ char *propname, char *propval, char *db)
-+{
-+ char *propstr;
-+ int i, k;
-+ int rval;
-+ uint8_t nval;
-+ uint8_t *pchar;
-+ uint8_t *ret_byte;
-+ uint8_t *tmp_byte;
-+ uint8_t *retval = (uint8_t*)propval;
-+ uint8_t tmpval[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-+ uint16_t max_byte_cnt = 8; /* 16 chars = 8 bytes */
-+ uint16_t max_strlen = 16;
-+ static char buf[LINESIZE];
-+
-+ rval = qla2x00_find_propname(ha, propname, buf, db, max_strlen);
-+
-+ propstr = &buf[0];
-+ if (*propstr == '=')
-+ propstr++; /* ignore equal sign */
-+
-+ if (rval == 0) {
-+ return (1);
-+ }
-+
-+ /* Convert string to numbers. */
-+ pchar = (uint8_t *)propstr;
-+ tmp_byte = (uint8_t *)tmpval;
-+
-+ rval = 0;
-+ for (i = 0; i < max_strlen; i++) {
-+ /*
-+ * Check for invalid character, two at a time,
-+ * then convert them starting with first byte.
-+ */
-+
-+ if ((pchar[i] >= '0') && (pchar[i] <= '9')) {
-+ nval = pchar[i] - '0';
-+ } else if ((pchar[i] >= 'A') && (pchar[i] <= 'F')) {
-+ nval = pchar[i] - 'A' + 10;
-+ } else if ((pchar[i] >= 'a') && (pchar[i] <= 'f')) {
-+ nval = pchar[i] - 'a' + 10;
-+ } else {
-+ /* invalid character */
-+ rval = 1;
-+ break;
-+ }
-+
-+ if (i & BIT_0) {
-+ *tmp_byte = *tmp_byte | nval;
-+ tmp_byte++;
-+ } else {
-+ *tmp_byte = *tmp_byte | nval << 4;
-+ }
-+ }
-+
-+ if (rval != 0) {
-+ /* Encountered invalid character. */
-+ return (rval);
-+ }
-+
-+ /* Copy over the converted value. */
-+ ret_byte = retval;
-+ tmp_byte = tmpval;
-+
-+ i = max_byte_cnt;
-+ k = 0;
-+ while (i--) {
-+ *ret_byte++ = *tmp_byte++;
-+ }
-+
-+ /* big endian retval[0]; */
-+ return (0);
-+}
-+
-+/*
-+* qla2x00_get_properties
-+* Find all properties for the specified adapeter in
-+* command line.
-+*
-+* Input:
-+* ha = adapter block pointer.
-+* cmdline = pointer to command line string
-+*
-+* Context:
-+* Kernel context.
-+*/
-+static void
-+qla2x00_get_properties(scsi_qla_host_t *ha, char *cmdline)
-+{
-+ int rval;
-+ static char propbuf[LINESIZE];
-+ uint8_t fc_name[8];
-+
-+ /* Adapter FC node names. */
-+ sprintf(propbuf, "scsi-qla%ld-adapter-node", ha->instance);
-+ rval = qla2x00_get_prop_16chars(ha, propbuf, fc_name, cmdline);
-+ if (rval == QLA_SUCCESS)
-+ memcpy(ha->node_name, fc_name, WWN_SIZE);
-+
-+ /* DG 04/07 check portname of adapter */
-+ sprintf(propbuf, "scsi-qla%ld-adapter-port", ha->instance);
-+ rval = qla2x00_get_prop_16chars(ha, propbuf, fc_name, cmdline);
-+ if (rval == QLA_SUCCESS &&
-+ memcmp(ha->port_name, fc_name, WWN_SIZE)) {
-+ /*
-+ * Adapter port name is WWN, and cannot be changed.
-+ * Inform users of the mismatch, then just continue driver
-+ * loading using the original adapter port name in NVRAM.
-+ */
-+ qla_printk(KERN_WARNING, ha,
-+ "Found mismatch in adapter port names.\n");
-+ qla_printk(KERN_INFO, ha,
-+ " qla%ld port name found in NVRAM -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ ha->instance, ha->port_name[0], ha->port_name[1],
-+ ha->port_name[2], ha->port_name[3], ha->port_name[4],
-+ ha->port_name[5], ha->port_name[6], ha->port_name[7]);
-+ qla_printk(KERN_INFO, ha,
-+ " qla%ld port name found on command line -> "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x\n",
-+ ha->instance,
-+ fc_name[0], fc_name[1], fc_name[2], fc_name[3],
-+ fc_name[4], fc_name[5], fc_name[6], fc_name[7]);
-+ qla_printk(KERN_INFO, ha,
-+ " Using port name from NVRAM.\n");
-+ }
-+
-+ qla2x00_cfg_persistent_binding(ha);
-+}
-+
-+/*
-+ * qla2x00_cfg_persistent_binding
-+ * Get driver configuration file target persistent binding entries.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static void
-+qla2x00_cfg_persistent_binding(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+ static char propbuf[LINESIZE];
-+ char *cmdline = ha->cmdline;
-+ uint16_t tgt;
-+ port_id_t d_id;
-+ uint8_t portid[3];
-+ uint8_t port_name[8];
-+
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (ha->binding_type == BIND_BY_PORT_ID) {
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-0-pid",
-+ ha->instance, tgt);
-+ rval = qla2x00_get_prop_xstr(ha,
-+ propbuf, portid, sizeof(portid));
-+ if (rval != sizeof(portid))
-+ continue;
-+
-+ memset(&d_id, 0, sizeof(port_id_t));
-+ d_id.r.d_id[0] = portid[2];
-+ d_id.r.d_id[1] = portid[1];
-+ d_id.r.d_id[2] = portid[0];
-+ } else {
-+ sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-0-port",
-+ ha->instance, tgt);
-+ rval = qla2x00_get_prop_16chars(ha,
-+ propbuf, port_name, cmdline);
-+ if (rval != QLA_SUCCESS)
-+ continue;
-+
-+ /* Fallthru since port_name already populated */
-+ }
-+
-+ /*
-+ * Create target context for device.
-+ */
-+ if (ha->binding_type == BIND_BY_PORT_ID) {
-+ qla2x00_persistent_bind(ha, NULL, NULL, &d_id, tgt);
-+ } else {
-+ qla2x00_persistent_bind(ha, NULL, port_name, NULL, tgt);
-+ }
-+ }
-+}
-+
-+/*
-+ * qla2x00_persistent_bind
-+ * Allocates target and fcport.
-+ *
-+ * Input:
-+ * ha: adapter state pointer.
-+ * node_name: node name pointer.
-+ * port_name: port name pointer.
-+ * d_id: port ID pointer.
-+ * tgt: OS target number.
-+ *
-+ * Returns:
-+ * success = target queue pointer.
-+ * failure = NULL.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static os_tgt_t *
-+qla2x00_persistent_bind(scsi_qla_host_t *ha, uint8_t *node_name,
-+ uint8_t *port_name, port_id_t *d_id, uint16_t tgt)
-+{
-+ os_tgt_t *tq;
-+ uint16_t tgt2;
-+
-+ /*
-+ * Check for duplicates.
-+ */
-+ for (tgt2 = 0; tgt2 < MAX_TARGETS; tgt2++) {
-+ if ((tq = TGT_Q(ha, tgt2)) == NULL) {
-+ continue;
-+ }
-+
-+ if (ha->binding_type == BIND_BY_PORT_ID) {
-+ if (tq->d_id.b24 != d_id->b24) {
-+ continue;
-+ }
-+ } else if (memcmp(tq->port_name, port_name, WWN_SIZE) != 0) {
-+ continue;
-+ }
-+
-+ qla_printk(KERN_WARNING, ha,
-+ "Duplicate persistent bindings found for "
-+ "WWPN: %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ port_name[0], port_name[1], port_name[2], port_name[3],
-+ port_name[4], port_name[5], port_name[6], port_name[7]);
-+
-+ return (tq);
-+ }
-+
-+ tq = qla2x00_tgt_alloc(ha, tgt);
-+ if (tq == NULL) {
-+ return (NULL);
-+ }
-+
-+ if (node_name != NULL) {
-+ memcpy(tq->node_name, node_name, WWN_SIZE);
-+ }
-+ if (port_name != NULL) {
-+ memcpy(tq->port_name, port_name, WWN_SIZE);
-+ }
-+ if (d_id != NULL) {
-+ tq->d_id.b24 = d_id->b24;
-+ }
-+
-+ return (tq);
-+}
-+#endif
- /*
- * qla2x00_abort_isp
- * Resets ISP and aborts all outstanding commands.
-@@ -4087,6 +4861,16 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
- LOOP_DOWN_TIME);
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Return all IP send packets */
-+ for (cnt = 0; cnt < MAX_SEND_PACKETS; cnt++) {
-+ if (ha->active_scb_q[cnt] != NULL) {
-+ ha->send_completion_routine(
-+ ha->active_scb_q[cnt]);
-+ ha->active_scb_q[cnt] = NULL;
-+ }
-+ }
-+#endif
- spin_lock_irqsave(&ha->hardware_lock, flags);
- /* Requeue all commands in outstanding command list. */
- for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
-@@ -4096,6 +4880,11 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
- if (ha->actthreads)
- ha->actthreads--;
- sp->lun_queue->out_cnt--;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (sp->fclun->io_cnt > 0)
-+ sp->fclun->io_cnt--;
-+ sp->fclun->s_time = jiffies - sp->u_start;
-+#endif
-
- /*
- * Set the cmd host_byte status depending on
-@@ -4105,7 +4894,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
- if (sp->flags & SRB_TAPE) {
- sp->cmd->result = DID_NO_CONNECT << 16;
- } else {
-- if (ha->host->eh_active != EH_ACTIVE)
-+ if (!qla2x00_is_eh_active(ha->host))
- sp->cmd->result =
- DID_BUS_BUSY << 16;
- else
-@@ -4165,14 +4954,14 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
- ha->isp_abort_cnt--;
- DEBUG(printk("qla%ld: ISP abort - "
- "retry remaining %d\n",
-- ha->host_no, ha->isp_abort_cnt);)
-+ ha->host_no, ha->isp_abort_cnt));
- status = 1;
- }
- } else {
- ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT;
- DEBUG(printk("qla2x00(%ld): ISP error recovery "
- "- retrying (%d) more times\n",
-- ha->host_no, ha->isp_abort_cnt);)
-+ ha->host_no, ha->isp_abort_cnt));
- set_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
- status = 1;
- }
-@@ -4186,7 +4975,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
- } else {
- DEBUG(printk(KERN_INFO
- "qla2x00_abort_isp(%ld): exiting.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return(status);
-@@ -4264,7 +5053,7 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
- clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
- if (!(status = qla2x00_fw_ready(ha))) {
- DEBUG(printk("%s(): Start configure loop, "
-- "status = %d\n", __func__, status);)
-+ "status = %d\n", __func__, status));
-
- /* Issue a marker after FW becomes ready. */
- qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
-@@ -4288,7 +5077,7 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
-
- DEBUG(printk("%s(): Configure loop done, status = 0x%x\n",
- __func__,
-- status);)
-+ status));
- }
- return (status);
- }
-@@ -4401,7 +5190,6 @@ qla24xx_nvram_config(scsi_qla_host_t *ha
- nv->node_name[6] = 0x55;
- nv->node_name[7] = 0x86;
- nv->login_retry_count = __constant_cpu_to_le16(8);
-- nv->link_down_timeout = __constant_cpu_to_le16(200);
- nv->interrupt_delay_timer = __constant_cpu_to_le16(0);
- nv->login_timeout = __constant_cpu_to_le16(0);
- nv->firmware_options_1 =
-@@ -4430,7 +5218,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha
- *dptr1++ = *dptr2++;
-
- icb->login_retry_count = nv->login_retry_count;
-- icb->link_down_timeout = nv->link_down_timeout;
-+ icb->link_down_on_nos = nv->link_down_on_nos;
-
- /* Copy 2nd segment. */
- dptr1 = (uint8_t *)&icb->interrupt_delay_timer;
-@@ -4485,8 +5273,21 @@ qla24xx_nvram_config(scsi_qla_host_t *ha
- } else
- strcpy(ha->model_number, "QLA2462");
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Handle WWNN/WWPN aliasing. */
-+ qla2x00_alias_hba(ha);
-+
-+ memcpy(ha->ip_port_name, icb->port_name, WWN_SIZE);
-+#endif
-+
-+ /* Use alternate WWN? */
-+ if (nv->host_p & __constant_cpu_to_le32(BIT_15)) {
-+ memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE);
-+ memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE);
-+ }
-+
- /* Prepare nodename */
-- if ((icb->firmware_options_1 & BIT_14) == 0) {
-+ if ((icb->firmware_options_1 & __constant_cpu_to_le32(BIT_14)) == 0) {
- /*
- * Firmware will apply the following mask if the nodename was
- * not provided.
-@@ -4501,9 +5302,10 @@ qla24xx_nvram_config(scsi_qla_host_t *ha
- ha->flags.enable_lip_full_login = 1;
- ha->flags.enable_target_reset = 1;
- ha->flags.enable_led_scheme = 0;
-+ ha->flags.disable_serdes = le32_to_cpu(nv->host_p) & BIT_5 ? 1: 0;
-
-- ha->operating_mode =
-- (icb->firmware_options_2 & (BIT_6 | BIT_5 | BIT_4)) >> 4;
-+ ha->operating_mode = (le32_to_cpu(icb->firmware_options_2) &
-+ (BIT_6 | BIT_5 | BIT_4)) >> 4;
-
- memcpy(ha->fw_seriallink_options24, nv->seriallink_options,
- sizeof(ha->fw_seriallink_options24));
-@@ -4929,7 +5731,7 @@ qla24xx_load_risc(scsi_qla_host_t *ha, u
- cnt = risc_code_size;
-
- DEBUG7(printk("scsi(%ld): Loading risc segment@ "
-- "addr %p, number of bytes 0x%x, offset 0x%lx.\n",
-+ "addr %p, number of bytes 0x%x, offset 0x%x.\n",
- ha->host_no, risc_code, cnt, risc_address));
-
- req_ring = (uint32_t *)ha->request_ring;
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_inline.h ./drivers/scsi/qla2xxx/qla_inline.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_inline.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_inline.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,23 +1,10 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
-
--
- static __inline__ uint16_t qla2x00_debounce_register(volatile uint16_t __iomem *);
- /*
- * qla2x00_debounce_register
-@@ -337,3 +324,16 @@ qla2x00_is_reserved_id(scsi_qla_host_t *
- return ((loop_id > ha->last_loop_id && loop_id < SNS_FIRST_LOOP_ID) ||
- loop_id == MANAGEMENT_SERVER || loop_id == BROADCAST);
- };
-+
-+static inline int
-+qla2x00_is_eh_active(struct Scsi_Host *shost)
-+{
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
-+ if (shost->eh_active)
-+ return 1;
-+#else
-+ if (shost->shost_state == SHOST_RECOVERY)
-+ return 1;
-+#endif
-+ return 0;
-+};
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_iocb.c ./drivers/scsi/qla2xxx/qla_iocb.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_iocb.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_iocb.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,22 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-- *
-- ******************************************************************************/
--
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #include "qla_def.h"
-
- #include <linux/blkdev.h>
-@@ -27,7 +14,6 @@
- static inline uint16_t qla2x00_get_cmd_direction(struct scsi_cmnd *cmd);
- static inline cont_entry_t *qla2x00_prep_cont_type0_iocb(scsi_qla_host_t *);
- static inline cont_a64_entry_t *qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *);
--static request_t *qla2x00_req_pkt(scsi_qla_host_t *ha);
-
- /**
- * qla2x00_get_cmd_direction() - Determine control_flag data direction.
-@@ -216,7 +202,18 @@ void qla2x00_build_scsi_iocbs_32(srb_t *
- cur_seg++;
- }
- } else {
-- *cur_dsd++ = cpu_to_le32(sp->dma_handle);
-+ dma_addr_t req_dma;
-+ struct page *page;
-+ unsigned long offset;
-+
-+ page = virt_to_page(cmd->request_buffer);
-+ offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-+ req_dma = pci_map_page(ha->pdev, page, offset,
-+ cmd->request_bufflen, cmd->sc_data_direction);
-+
-+ sp->dma_handle = req_dma;
-+
-+ *cur_dsd++ = cpu_to_le32(req_dma);
- *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
- }
- }
-@@ -288,8 +285,19 @@ void qla2x00_build_scsi_iocbs_64(srb_t *
- cur_seg++;
- }
- } else {
-- *cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle));
-- *cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle));
-+ dma_addr_t req_dma;
-+ struct page *page;
-+ unsigned long offset;
-+
-+ page = virt_to_page(cmd->request_buffer);
-+ offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-+ req_dma = pci_map_page(ha->pdev, page, offset,
-+ cmd->request_bufflen, cmd->sc_data_direction);
-+
-+ sp->dma_handle = req_dma;
-+
-+ *cur_dsd++ = cpu_to_le32(LSD(req_dma));
-+ *cur_dsd++ = cpu_to_le32(MSD(req_dma));
- *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
- }
- }
-@@ -322,9 +330,8 @@ qla2x00_start_scsi(srb_t *sp)
-
- /* Setup device pointers. */
- ret = 0;
-- /* So we know we haven't pci_map'ed anything yet */
-- tot_dsds = 0;
-- fclun = sp->lun_queue->fclun;
-+ // fclun = sp->lun_queue->fclun;
-+ fclun = sp->fclun;
- ha = fclun->fcport->ha;
- reg = ha->iobase;
- cmd = sp->cmd;
-@@ -352,7 +359,9 @@ qla2x00_start_scsi(srb_t *sp)
- if (index == MAX_OUTSTANDING_COMMANDS)
- goto queuing_error;
-
-- /* Map the sg table so we have an accurate count of sg entries needed */
-+ /* Calculate the number of request entries needed. */
-+ tot_dsds = 0;
-+ sg = NULL;
- if (cmd->use_sg) {
- sg = (struct scatterlist *) cmd->request_buffer;
- tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
-@@ -360,23 +369,9 @@ qla2x00_start_scsi(srb_t *sp)
- if (tot_dsds == 0)
- goto queuing_error;
- } else if (cmd->request_bufflen) {
-- dma_addr_t req_dma;
-- struct page *page;
-- unsigned long offset;
--
-- page = virt_to_page(cmd->request_buffer);
-- offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-- req_dma = pci_map_page(ha->pdev, page, offset,
-- cmd->request_bufflen, cmd->sc_data_direction);
--
-- if (dma_mapping_error(req_dma))
-- goto queuing_error;
--
-- sp->dma_handle = req_dma;
-- tot_dsds = 1;
-+ tot_dsds++;
- }
-
-- /* Calculate the number of request entries needed. */
- req_cnt = (ha->calc_request_entries)(tot_dsds);
- if (ha->req_q_cnt < (req_cnt + 2)) {
- cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
-@@ -384,10 +379,14 @@ qla2x00_start_scsi(srb_t *sp)
- ha->req_q_cnt = cnt - ha->req_ring_index;
- else
- ha->req_q_cnt = ha->request_q_length -
-- (ha->req_ring_index - cnt);
-+ (ha->req_ring_index - cnt);
- }
-- if (ha->req_q_cnt < (req_cnt + 2))
-+ if (ha->req_q_cnt < (req_cnt + 2)) {
-+ if (cmd->use_sg)
-+ pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-+ cmd->sc_data_direction);
- goto queuing_error;
-+ }
-
- /* Build command packet */
- ha->current_outstanding_cmd = handle;
-@@ -458,6 +457,9 @@ qla2x00_start_scsi(srb_t *sp)
- ha->actthreads++;
- ha->total_ios++;
- sp->lun_queue->out_cnt++;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ sp->fclun->io_cnt++;
-+#endif
- sp->flags |= SRB_DMA_VALID;
- sp->state = SRB_ACTIVE_STATE;
- sp->u_start = jiffies;
-@@ -470,14 +472,6 @@ qla2x00_start_scsi(srb_t *sp)
- return (QLA_SUCCESS);
-
- queuing_error:
-- if (cmd->use_sg && tot_dsds) {
-- sg = (struct scatterlist *) cmd->request_buffer;
-- pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- } else if (tot_dsds) {
-- pci_unmap_page(ha->pdev, sp->dma_handle, cmd->request_bufflen,
-- cmd->sc_data_direction);
-- }
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
-
- return (QLA_FUNCTION_FAILED);
-@@ -518,6 +512,7 @@ __qla2x00_marker(scsi_qla_host_t *ha, ui
- mrk24->nport_handle = cpu_to_le16(loop_id);
- mrk24->lun[1] = LSB(lun);
- mrk24->lun[2] = MSB(lun);
-+ host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun));
- } else {
- SET_TARGET_ID(ha, mrk->target, loop_id);
- mrk->lun = cpu_to_le16(lun);
-@@ -552,7 +547,7 @@ qla2x00_marker(scsi_qla_host_t *ha, uint
- *
- * Returns NULL if function failed, else, a pointer to the request packet.
- */
--static request_t *
-+void *
- qla2x00_req_pkt(scsi_qla_host_t *ha)
- {
- device_reg_t __iomem *reg = ha->iobase;
-@@ -652,6 +647,105 @@ qla2x00_isp_cmd(scsi_qla_host_t *ha)
- }
-
- }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/**
-+ * qla2x00_ms_req_pkt() - Retrieve a Management Server request packet from
-+ * the request ring.
-+ * @ha: HA context
-+ * @sp: pointer to handle post function call
-+ *
-+ * Note: The caller must hold the hardware lock before calling this routine.
-+ *
-+ * Returns NULL if function failed, else, a pointer to the request packet.
-+ */
-+request_t *
-+qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp)
-+{
-+ device_reg_t __iomem *reg = ha->iobase;
-+ struct device_reg_24xx __iomem *reg24 =
-+ (struct device_reg_24xx __iomem *) ha->iobase;
-+ request_t *pkt = NULL;
-+ uint16_t cnt, index;
-+ uint32_t timer;
-+ uint8_t found = 0;
-+ uint16_t req_cnt = 1;
-+
-+ /* Wait 1 second for slot. */
-+ for (timer = HZ; timer; timer--) {
-+ if ((req_cnt + 2) >= ha->req_q_cnt) {
-+ /* Calculate number of free request entries. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ cnt = (uint16_t)RD_REG_DWORD(&reg24->req_q_out);
-+ else
-+ cnt = qla2x00_debounce_register(
-+ ISP_REQ_Q_OUT(ha, reg));
-+
-+ if (ha->req_ring_index < cnt) {
-+ ha->req_q_cnt = cnt - ha->req_ring_index;
-+ } else {
-+ ha->req_q_cnt = ha->request_q_length -
-+ (ha->req_ring_index - cnt);
-+ }
-+ }
-+
-+ /* Check for room in outstanding command list. */
-+ cnt = ha->current_outstanding_cmd;
-+ for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-+ cnt++;
-+ if (cnt == MAX_OUTSTANDING_COMMANDS)
-+ cnt = 1;
-+
-+ if (ha->outstanding_cmds[cnt] == 0) {
-+ found = 1;
-+ ha->current_outstanding_cmd = cnt;
-+ break;
-+ }
-+ }
-+
-+ /* If room for request in request ring. */
-+ if (found && (req_cnt + 2) < ha->req_q_cnt) {
-+ pkt = ha->request_ring_ptr;
-+
-+ /* Zero out packet. */
-+ memset(pkt, 0, REQUEST_ENTRY_SIZE);
-+
-+ DEBUG5(printk("%s(): putting sp=%p in "
-+ "outstanding_cmds[%x]\n",
-+ __func__,
-+ sp, cnt));
-+
-+ ha->outstanding_cmds[cnt] = sp;
-+
-+ /* save the handle */
-+ sp->cmd->host_scribble = (unsigned char *) (u_long) cnt;
-+ CMD_SP(sp->cmd) = (void *)sp;
-+
-+ ha->req_q_cnt--;
-+ pkt->handle = (uint32_t)cnt;
-+
-+ /* Set system defined field. */
-+ pkt->sys_define = (uint8_t)ha->req_ring_index;
-+ pkt->entry_status = 0;
-+
-+ break;
-+ }
-+
-+ /* Release ring specific lock */
-+ spin_unlock(&ha->hardware_lock);
-+ udelay(20);
-+
-+ /* Check for pending interrupts. */
-+ qla2x00_poll(ha);
-+
-+ spin_lock_irq(&ha->hardware_lock);
-+ }
-+ if (!pkt) {
-+ DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
-+ }
-+
-+ return (pkt);
-+}
-+#endif
-
- //
- // ISP24xx
-@@ -757,8 +851,19 @@ qla24xx_build_scsi_iocbs(srb_t *sp, stru
- cur_seg++;
- }
- } else {
-- *cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle));
-- *cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle));
-+ dma_addr_t req_dma;
-+ struct page *page;
-+ unsigned long offset;
-+
-+ page = virt_to_page(cmd->request_buffer);
-+ offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-+ req_dma = pci_map_page(ha->pdev, page, offset,
-+ cmd->request_bufflen, cmd->sc_data_direction);
-+
-+ sp->dma_handle = req_dma;
-+
-+ *cur_dsd++ = cpu_to_le32(LSD(req_dma));
-+ *cur_dsd++ = cpu_to_le32(MSD(req_dma));
- *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
- }
- }
-@@ -792,8 +897,6 @@ qla24xx_start_scsi(srb_t *sp)
-
- /* Setup device pointers. */
- ret = 0;
-- /* So we know we haven't pci_map'ed anything yet */
-- tot_dsds = 0;
- fclun = sp->lun_queue->fclun;
- ha = fclun->fcport->ha;
- reg = (struct device_reg_24xx __iomem *)ha->iobase;
-@@ -822,7 +925,9 @@ qla24xx_start_scsi(srb_t *sp)
- if (index == MAX_OUTSTANDING_COMMANDS)
- goto queuing_error;
-
-- /* Map the sg table so we have an accurate count of sg entries needed */
-+ /* Calculate the number of request entries needed. */
-+ tot_dsds = 0;
-+ sg = NULL;
- if (cmd->use_sg) {
- sg = (struct scatterlist *) cmd->request_buffer;
- tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
-@@ -830,23 +935,9 @@ qla24xx_start_scsi(srb_t *sp)
- if (tot_dsds == 0)
- goto queuing_error;
- } else if (cmd->request_bufflen) {
-- dma_addr_t req_dma;
-- struct page *page;
-- unsigned long offset;
--
-- page = virt_to_page(cmd->request_buffer);
-- offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
-- req_dma = pci_map_page(ha->pdev, page, offset,
-- cmd->request_bufflen, cmd->sc_data_direction);
--
-- if (dma_mapping_error(req_dma))
-- goto queuing_error;
--
-- sp->dma_handle = req_dma;
-- tot_dsds = 1;
-+ tot_dsds++;
- }
-
-- /* Calculate the number of request entries needed. */
- req_cnt = qla24xx_calc_iocbs(tot_dsds);
- if (ha->req_q_cnt < (req_cnt + 2)) {
- cnt = (uint16_t)RD_REG_DWORD_RELAXED(&reg->req_q_out);
-@@ -854,10 +945,14 @@ qla24xx_start_scsi(srb_t *sp)
- ha->req_q_cnt = cnt - ha->req_ring_index;
- else
- ha->req_q_cnt = ha->request_q_length -
-- (ha->req_ring_index - cnt);
-+ (ha->req_ring_index - cnt);
- }
-- if (ha->req_q_cnt < (req_cnt + 2))
-+ if (ha->req_q_cnt < (req_cnt + 2)) {
-+ if (cmd->use_sg)
-+ pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-+ cmd->sc_data_direction);
- goto queuing_error;
-+ }
-
- /* Build command packet. */
- ha->current_outstanding_cmd = handle;
-@@ -933,6 +1028,9 @@ qla24xx_start_scsi(srb_t *sp)
- ha->actthreads++;
- ha->total_ios++;
- sp->lun_queue->out_cnt++;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ sp->fclun->io_cnt++;
-+#endif
- sp->flags |= SRB_DMA_VALID;
- sp->state = SRB_ACTIVE_STATE;
- sp->u_start = jiffies;
-@@ -945,14 +1043,6 @@ qla24xx_start_scsi(srb_t *sp)
- return (QLA_SUCCESS);
-
- queuing_error:
-- if (cmd->use_sg && tot_dsds) {
-- sg = (struct scatterlist *) cmd->request_buffer;
-- pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
-- cmd->sc_data_direction);
-- } else if (tot_dsds) {
-- pci_unmap_page(ha->pdev, sp->dma_handle, cmd->request_bufflen,
-- cmd->sc_data_direction);
-- }
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
-
- return (QLA_FUNCTION_FAILED);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_ip.c ./drivers/scsi/qla2xxx/qla_ip.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_ip.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_ip.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,1262 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+static __u8 hwbroadcast_addr[ETH_ALEN] = { [0 ... ETH_ALEN - 1] = 0xFF };
-+
-+/**
-+ * qla2x00_ip_initialize() - Initialize RISC IP support.
-+ * @ha: SCSI driver HA context
-+ *
-+ * Prior to RISC IP initialization, this routine, if necessary, will reset all
-+ * buffers in the receive buffer ring.
-+ *
-+ * Returns 1 if the RISC IP initialization succeeds.
-+ */
-+static int
-+qla2x00_ip_initialize(scsi_qla_host_t *ha)
-+{
-+ int i;
-+ int status;
-+ unsigned long flags;
-+ device_reg_t __iomem *reg;
-+ static mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+ struct ip_init_cb *ipinit_cb;
-+ dma_addr_t ipinit_cb_dma;
-+
-+ DEBUG12(printk("%s: enter\n", __func__));
-+
-+ status = 0;
-+
-+ /* Initialize IP data in ha */
-+ /* Reset/pack buffers owned by RISC in receive buffer ring */
-+ if (ha->rec_entries_in != ha->rec_entries_out) {
-+ struct buffer_cb *bcb;
-+ uint16_t rec_out;
-+ struct risc_rec_entry *rec_entry;
-+
-+ bcb = ha->receive_buffers;
-+ rec_out = ha->rec_entries_out;
-+
-+ /*
-+ * Must locate all RISC owned buffers and pack them in the
-+ * buffer ring.
-+ */
-+ /* between IpBufferOut and IpBufferIN */
-+ for (i = 0; i < ha->max_receive_buffers; i++, bcb++) {
-+ if (test_bit(BCB_RISC_OWNS_BUFFER, &bcb->state)) {
-+ /*
-+ * Set RISC owned buffer into receive buffer
-+ * ring.
-+ */
-+ rec_entry = &ha->risc_rec_q[rec_out];
-+ rec_entry->handle = bcb->handle;
-+ rec_entry->data_addr_low =
-+ LSD(bcb->skb_data_dma);
-+ rec_entry->data_addr_high =
-+ MSD(bcb->skb_data_dma);
-+ if (rec_out < IP_BUFFER_QUEUE_DEPTH - 1)
-+ rec_out++;
-+ else
-+ rec_out = 0;
-+ }
-+ }
-+
-+ /* Verify correct number of RISC owned buffers were found */
-+ if (rec_out != ha->rec_entries_in) {
-+ /* Incorrect number of RISC owned buffers?? */
-+ DEBUG12(printk("%s: incorrect number of RISC "
-+ "owned buffers, disable IP\n",
-+ __func__));
-+ ha->flags.enable_ip = 0;
-+ return 0;
-+ }
-+ }
-+
-+ /* Init RISC buffer pointer */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ reg = ha->iobase;
-+ WRT_MAILBOX_REG(ha, reg, 8, ha->rec_entries_in);
-+ RD_MAILBOX_REG(ha, reg, 8);
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ /* Wait for a ready state from the adapter */
-+ while (!ha->flags.init_done || ha->dpc_active) {
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ }
-+
-+ /* Setup IP initialization control block */
-+ ipinit_cb = pci_alloc_consistent(ha->pdev,
-+ sizeof(struct ip_init_cb),
-+ &ipinit_cb_dma);
-+ if (ipinit_cb) {
-+ memset(ipinit_cb, 0, sizeof(struct ip_init_cb));
-+ ipinit_cb->version = IPICB_VERSION;
-+ ipinit_cb->firmware_options =
-+ __constant_cpu_to_le16(IPICB_OPTION_OUT_OF_BUFFERS_EVENT |
-+ IPICB_OPTION_NO_BROADCAST_FASTPOST |
-+ IPICB_OPTION_64BIT_ADDRESSING);
-+ ipinit_cb->header_size = cpu_to_le16(ha->header_size);
-+ ipinit_cb->mtu = cpu_to_le16((uint16_t) ha->mtu);
-+ ipinit_cb->receive_buffer_size =
-+ cpu_to_le16((uint16_t) ha->receive_buff_data_size);
-+ ipinit_cb->receive_queue_size =
-+ __constant_cpu_to_le16(IP_BUFFER_QUEUE_DEPTH);
-+ ipinit_cb->low_water_mark =
-+ __constant_cpu_to_le16(IPICB_LOW_WATER_MARK);
-+ ipinit_cb->receive_queue_addr[0] =
-+ cpu_to_le16(LSW(ha->risc_rec_q_dma));
-+ ipinit_cb->receive_queue_addr[1] =
-+ cpu_to_le16(MSW(ha->risc_rec_q_dma));
-+ ipinit_cb->receive_queue_addr[2] =
-+ cpu_to_le16(LSW(MSD(ha->risc_rec_q_dma)));
-+ ipinit_cb->receive_queue_addr[3] =
-+ cpu_to_le16(MSW(MSD(ha->risc_rec_q_dma)));
-+ ipinit_cb->receive_queue_in = cpu_to_le16(ha->rec_entries_out);
-+ ipinit_cb->container_count =
-+ __constant_cpu_to_le16(IPICB_BUFFER_CONTAINER_COUNT);
-+
-+ /* Issue mailbox command to initialize IP firmware */
-+ mcp->mb[0] = MBC_INITIALIZE_IP;
-+ mcp->mb[2] = MSW(ipinit_cb_dma);
-+ mcp->mb[3] = LSW(ipinit_cb_dma);
-+ mcp->mb[6] = MSW(MSD(ipinit_cb_dma));
-+ mcp->mb[7] = LSW(MSD(ipinit_cb_dma));
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-+ mcp->in_mb = MBX_0;
-+ mcp->tov = 30;
-+ mcp->buf_size = sizeof(struct ip_init_cb);
-+ mcp->flags = MBX_DMA_OUT;
-+
-+ status = qla2x00_mailbox_command(ha, mcp);
-+ if (status == QL_STATUS_SUCCESS) {
-+ /* IP initialization successful */
-+ DEBUG12(printk("%s: successful\n", __func__));
-+
-+ ha->flags.enable_ip = 1;
-+
-+ /* Force database update */
-+ set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
-+ set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
-+ set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags);
-+
-+ /* qla2x00_loop_resync(ha); */
-+ if (ha->dpc_wait && !ha->dpc_active) {
-+ up(ha->dpc_wait);
-+ }
-+ status = 1;
-+ } else {
-+ DEBUG12(printk("%s: MBC_INITIALIZE_IP "
-+ "failed %x MB0 %x\n",
-+ __func__, status, mcp->mb[0]));
-+ status = 0;
-+ }
-+ pci_free_consistent(ha->pdev, sizeof(struct ip_init_cb),
-+ ipinit_cb, ipinit_cb_dma);
-+
-+ } else {
-+ DEBUG12(printk("%s: memory allocation error\n", __func__));
-+ }
-+
-+ return status;
-+}
-+
-+static void
-+qla24xx_add_buffers(scsi_qla_host_t *ha, uint16_t unused, int ha_locked)
-+{
-+ int i;
-+ unsigned long flags = 0;
-+ struct buffer_cb *bcbs;
-+ struct ip_load_pool_24xx *pkt = NULL;
-+ struct risc_rec_entry *rentry = NULL;
-+
-+ flags = 0;
-+ unused = 0;
-+
-+ if (!ha_locked)
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ bcbs = ha->receive_buffers;
-+ while (1) {
-+ for (i = 0; i < ha->max_receive_buffers; i++, bcbs++)
-+ if (!test_and_set_bit(BCB_RISC_OWNS_BUFFER,
-+ &bcbs->state))
-+ break;
-+
-+ if (i == ha->max_receive_buffers)
-+ break;
-+
-+ if (!pkt) {
-+ pkt = qla2x00_req_pkt(ha);
-+ if (!pkt) {
-+ DEBUG2_3(printk("%s(%ld): failed to allocate "
-+ "IP resource IOCB.\n", __func__,
-+ ha->host_no));
-+ clear_bit(BCB_RISC_OWNS_BUFFER, &bcbs->state);
-+ break;
-+ }
-+ pkt->entry_type = IP_LOAD_POOL_24XX;
-+ rentry = pkt->buffers;
-+ }
-+ ha->rec_entries_in++;
-+
-+ rentry->handle = bcbs->handle;
-+ rentry->data_addr_low = LSD(bcbs->skb_data_dma);
-+ rentry->data_addr_high = MSD(bcbs->skb_data_dma);
-+ rentry++;
-+
-+ pkt->buffer_count++;
-+ if (pkt->buffer_count == IP_POOL_BUFFERS) {
-+ wmb();
-+ qla2x00_isp_cmd(ha);
-+ pkt = NULL;
-+ }
-+ }
-+
-+ if (pkt) {
-+ wmb();
-+ qla2x00_isp_cmd(ha);
-+ }
-+
-+ if (!ha_locked)
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+static int
-+qla24xx_ip_initialize(scsi_qla_host_t *ha)
-+{
-+ int status;
-+ static mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+ struct ip_init_cb_24xx *ipinit_cb;
-+ dma_addr_t ipinit_cb_dma;
-+
-+ DEBUG12(printk("%s: enter\n", __func__));
-+
-+ status = 0;
-+
-+ /* Wait for a ready state from the adapter */
-+ while (!ha->flags.init_done || ha->dpc_active) {
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ }
-+
-+ /* Setup IP initialization control block */
-+ ipinit_cb = pci_alloc_consistent(ha->pdev,
-+ sizeof(struct ip_init_cb_24xx), &ipinit_cb_dma);
-+ if (ipinit_cb) {
-+ memset(ipinit_cb, 0, sizeof(struct ip_init_cb_24xx));
-+ ipinit_cb->version = IPICB_VERSION;
-+ ipinit_cb->firmware_options = __constant_cpu_to_le16(BIT_2);
-+ ipinit_cb->header_size = cpu_to_le16(ha->header_size);
-+ ipinit_cb->mtu = cpu_to_le16((uint16_t) ha->mtu);
-+ ipinit_cb->receive_buffer_size =
-+ cpu_to_le16((uint16_t) ha->receive_buff_data_size);
-+ ipinit_cb->low_water_mark =
-+ __constant_cpu_to_le16(IPICB_LOW_WATER_MARK);
-+ ipinit_cb->container_count =
-+ __constant_cpu_to_le16(IPICB_BUFFER_CONTAINER_COUNT);
-+
-+ /* Issue mailbox command to initialize IP firmware */
-+ mcp->mb[0] = MBC_INITIALIZE_IP;
-+ mcp->mb[2] = MSW(ipinit_cb_dma);
-+ mcp->mb[3] = LSW(ipinit_cb_dma);
-+ mcp->mb[6] = MSW(MSD(ipinit_cb_dma));
-+ mcp->mb[7] = LSW(MSD(ipinit_cb_dma));
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-+ mcp->in_mb = MBX_0;
-+ mcp->tov = 30;
-+ mcp->buf_size = sizeof(struct ip_init_cb);
-+ mcp->flags = MBX_DMA_OUT;
-+
-+ status = qla2x00_mailbox_command(ha, mcp);
-+ if (status == QL_STATUS_SUCCESS) {
-+ /* IP initialization successful */
-+ DEBUG12(printk("%s: successful\n", __func__));
-+
-+ ha->flags.enable_ip = 1;
-+
-+ qla24xx_add_buffers(ha, 0, 0);
-+
-+ /* Force database update */
-+ set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
-+ set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
-+ set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags);
-+
-+ /* qla2x00_loop_resync(ha); */
-+ if (ha->dpc_wait && !ha->dpc_active) {
-+ up(ha->dpc_wait);
-+ }
-+ status = 1;
-+ } else {
-+ DEBUG12(printk("%s: MBC_INITIALIZE_IP failed %x MB0 "
-+ "%x\n", __func__, status, mcp->mb[0]));
-+ status = 0;
-+ }
-+ pci_free_consistent(ha->pdev, sizeof(struct ip_init_cb_24xx),
-+ ipinit_cb, ipinit_cb_dma);
-+
-+ } else {
-+ DEBUG12(printk("%s: memory allocation error\n", __func__));
-+ }
-+
-+ return status;
-+}
-+
-+/**
-+ * qla2x00_ip_send_complete() - Handle IP send completion.
-+ * @ha: SCSI driver HA context
-+ * @handle: handle to completed send_cb
-+ * @comp_status: Firmware completion status of send_cb
-+ *
-+ * Upon cleanup of the internal active-scb queue, the IP driver is notified of
-+ * the completion.
-+ */
-+void
-+qla2x00_ip_send_complete(scsi_qla_host_t *ha,
-+ uint32_t handle, uint16_t comp_status)
-+{
-+ struct send_cb *scb;
-+
-+ /* Set packet pointer from queue entry handle */
-+ if (handle < MAX_SEND_PACKETS) {
-+ scb = ha->active_scb_q[handle];
-+ if (scb) {
-+ ha->ipreq_cnt--;
-+ ha->active_scb_q[handle] = NULL;
-+
-+ scb->comp_status = comp_status;
-+ pci_unmap_single(ha->pdev,
-+ scb->skb_data_dma,
-+ scb->skb->len, PCI_DMA_TODEVICE);
-+
-+ /* Return send packet to IP driver */
-+ ha->send_completion_routine(scb);
-+ return;
-+ }
-+ }
-+
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP send handle %x - aborting ISP\n", __func__, handle);
-+
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+}
-+
-+void
-+qla24xx_ip_send_complete(scsi_qla_host_t *ha, uint32_t handle,
-+ uint16_t comp_status)
-+{
-+ struct send_cb *scb;
-+
-+ /* Set packet pointer from queue entry handle */
-+ if (handle < MAX_SEND_PACKETS) {
-+ scb = ha->active_scb_q[handle];
-+ if (scb) {
-+ ha->ipreq_cnt--;
-+ ha->active_scb_q[handle] = NULL;
-+
-+ scb->comp_status = comp_status;
-+ pci_unmap_single(ha->pdev, scb->skb_data_dma,
-+ scb->skb->len, PCI_DMA_TODEVICE);
-+
-+ /* Return send packet to IP driver */
-+ ha->send_completion_routine(scb);
-+ return;
-+ }
-+ }
-+
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP send handle %x - aborting ISP\n", __func__, handle);
-+
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+}
-+
-+/**
-+ * qla2x00_ip_receive() - Handle IP receive IOCB.
-+ * @ha: SCSI driver HA context
-+ * @pkt: RISC IP receive packet
-+ *
-+ * Upon preparation of one or more buffer_cbs, the IP driver is notified of
-+ * the received packet.
-+ */
-+void
-+qla2x00_ip_receive(scsi_qla_host_t *ha, struct ip_rec_entry *iprec_entry)
-+{
-+ uint32_t handle;
-+ uint32_t packet_size;
-+ uint16_t linked_bcb_cnt;
-+ uint32_t rec_data_size;
-+ uint16_t comp_status;
-+ struct buffer_cb *bcb;
-+ struct buffer_cb *nbcb;
-+
-+ comp_status = le16_to_cpu(iprec_entry->comp_status);
-+
-+ /* If split buffer, set header size for 1st buffer */
-+ if (comp_status & IPREC_STATUS_SPLIT_BUFFER)
-+ rec_data_size = ha->header_size;
-+ else
-+ rec_data_size = ha->receive_buff_data_size;
-+
-+ handle = iprec_entry->buffer_handles[0];
-+ if (handle >= ha->max_receive_buffers) {
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (> buffer_count)...Post "
-+ "ISP Abort\n", __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+
-+ bcb = &ha->receive_buffers[handle];
-+
-+ if (!test_and_clear_bit(BCB_RISC_OWNS_BUFFER, &bcb->state)) {
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (!RISC_owned)...Post "
-+ "ISP Abort\n", __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+
-+ packet_size = le16_to_cpu(iprec_entry->sequence_length);
-+ bcb->comp_status = comp_status;
-+ bcb->packet_size = packet_size;
-+ nbcb = bcb;
-+
-+ /* Prepare any linked buffers */
-+ for (linked_bcb_cnt = 1;; linked_bcb_cnt++) {
-+ if (packet_size > rec_data_size) {
-+ nbcb->rec_data_size = rec_data_size;
-+ packet_size -= rec_data_size;
-+
-+ /*
-+ * If split buffer, only use header size on 1st buffer
-+ */
-+ rec_data_size = ha->receive_buff_data_size;
-+
-+ handle = iprec_entry->buffer_handles[linked_bcb_cnt];
-+ if (handle >= ha->max_receive_buffers) {
-+ /*
-+ * Invalid handle from RISC reset RISC firmware
-+ */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (> "
-+ "buffer_count - PS)...Post ISP Abort\n",
-+ __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+ nbcb->next_bcb = &ha->receive_buffers[handle];
-+ nbcb = nbcb->next_bcb;
-+
-+ if (!test_and_clear_bit(BCB_RISC_OWNS_BUFFER,
-+ &nbcb->state)) {
-+ /*
-+ * Invalid handle from RISC reset RISC firmware
-+ */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x "
-+ "(!RISC_owned - PS)...Post ISP Abort\n",
-+ __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+ } else {
-+ /* Single buffer_cb */
-+ nbcb->rec_data_size = packet_size;
-+ nbcb->next_bcb = NULL;
-+ break;
-+ }
-+ }
-+
-+ /* Check for incoming ARP packet with matching IP address */
-+ if (le16_to_cpu(iprec_entry->service_class) == 0) {
-+ fc_port_t *fcport;
-+ struct packet_header *packethdr;
-+
-+ packethdr = (struct packet_header *)bcb->skb_data;
-+
-+ /* Scan list of IP devices to see if login needed */
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (!memcmp(&fcport->port_name[2],
-+ packethdr->networkh.s.na.addr, ETH_ALEN)) {
-+ break;
-+ }
-+ }
-+ }
-+
-+ /* Pass received packet to IP driver */
-+ bcb->linked_bcb_cnt = linked_bcb_cnt;
-+ ha->receive_packets_routine(ha->receive_packets_context, bcb);
-+
-+ /* Keep track of RISC buffer pointer (for IP reinit) */
-+ ha->rec_entries_out += linked_bcb_cnt;
-+ if (ha->rec_entries_out >= IP_BUFFER_QUEUE_DEPTH)
-+ ha->rec_entries_out -= IP_BUFFER_QUEUE_DEPTH;
-+}
-+
-+void
-+qla24xx_ip_receive(scsi_qla_host_t *ha, struct ip_rec_entry_24xx *iprec_entry)
-+{
-+ uint32_t handle;
-+ uint32_t packet_size;
-+ uint16_t linked_bcb_cnt;
-+ uint32_t rec_data_size;
-+ uint16_t comp_status;
-+ struct buffer_cb *bcb;
-+ struct buffer_cb *nbcb;
-+
-+ comp_status = le16_to_cpu(iprec_entry->comp_status);
-+
-+ /* If split buffer, set header size for 1st buffer */
-+ if (comp_status & BIT_0)
-+ rec_data_size = ha->header_size;
-+ else
-+ rec_data_size = ha->receive_buff_data_size;
-+
-+ handle = iprec_entry->buffer_handles[0];
-+ if (handle >= ha->max_receive_buffers) {
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (> buffer_count)...Post ISP "
-+ "Abort\n", __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+
-+ bcb = &ha->receive_buffers[handle];
-+
-+ if (!test_and_clear_bit(BCB_RISC_OWNS_BUFFER, &bcb->state)) {
-+ /* Invalid handle from RISC, reset RISC firmware */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (!RISC_owned)...Post ISP "
-+ "Abort\n", __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+
-+ packet_size = le16_to_cpu(iprec_entry->sequence_length);
-+ bcb->comp_status = comp_status;
-+ bcb->packet_size = packet_size;
-+ nbcb = bcb;
-+
-+ /* Prepare any linked buffers */
-+ for (linked_bcb_cnt = 0; linked_bcb_cnt < IP_RCV_BUFFERS;
-+ linked_bcb_cnt++) {
-+ if (packet_size > rec_data_size) {
-+ nbcb->rec_data_size = rec_data_size;
-+ packet_size -= rec_data_size;
-+
-+ /*
-+ * If split buffer, only use header size on 1st buffer
-+ */
-+ rec_data_size = ha->receive_buff_data_size;
-+
-+ handle = iprec_entry->buffer_handles[linked_bcb_cnt];
-+ if (handle >= ha->max_receive_buffers) {
-+ /*
-+ * Invalid handle from RISC reset RISC firmware
-+ */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x (> "
-+ "buffer_count - PS)...Post ISP Abort\n",
-+ __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+ nbcb->next_bcb = &ha->receive_buffers[handle];
-+ nbcb = nbcb->next_bcb;
-+
-+ if (!test_and_clear_bit(BCB_RISC_OWNS_BUFFER,
-+ &nbcb->state)) {
-+ /*
-+ * Invalid handle from RISC reset RISC firmware
-+ */
-+ printk(KERN_WARNING
-+ "%s: Bad IP buffer handle %x "
-+ "(!RISC_owned - PS)...Post ISP Abort\n",
-+ __func__, handle);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ return;
-+ }
-+ } else {
-+ /* Single buffer_cb */
-+ nbcb->rec_data_size = packet_size;
-+ nbcb->next_bcb = NULL;
-+ break;
-+ }
-+ }
-+
-+ /* Check for incoming ARP packet with matching IP address */
-+ if (le16_to_cpu(iprec_entry->service_class) == 0) {
-+ fc_port_t *fcport;
-+ struct packet_header *packethdr;
-+
-+ packethdr = (struct packet_header *)bcb->skb_data;
-+
-+ /* Scan list of IP devices to see if login needed */
-+ list_for_each_entry(fcport, &ha->fcports, list)
-+ if (!memcmp(&fcport->port_name[2],
-+ packethdr->networkh.s.na.addr, ETH_ALEN))
-+ break;
-+ }
-+
-+ /* Pass received packet to IP driver */
-+ bcb->linked_bcb_cnt = linked_bcb_cnt + 1;
-+ ha->receive_packets_routine(ha->receive_packets_context, bcb);
-+
-+ /* Keep track of RISC buffer pointer (for IP reinit) */
-+ ha->rec_entries_out += linked_bcb_cnt + 1;
-+ if (ha->rec_entries_out >= IP_BUFFER_QUEUE_DEPTH)
-+ ha->rec_entries_out -= IP_BUFFER_QUEUE_DEPTH;
-+}
-+
-+/**
-+ * qla2x00_convert_to_arp() - Convert an IP send packet to an ARP packet
-+ * @ha: SCSI driver HA context
-+ * @scb: The send_cb structure to convert
-+ *
-+ * Returns 1 if conversion successful.
-+ */
-+static int
-+qla2x00_convert_to_arp(scsi_qla_host_t *ha, struct send_cb *scb)
-+{
-+ struct sk_buff *skb;
-+ struct packet_header *packethdr;
-+ struct arp_header *arphdr;
-+ struct ip_header *iphdr;
-+
-+ DEBUG12(printk("%s: convert packet to ARP\n", __func__));
-+
-+ skb = scb->skb;
-+ packethdr = scb->header;
-+ arphdr = (struct arp_header *)skb->data;
-+ iphdr = (struct ip_header *)skb->data;
-+
-+ if (packethdr->snaph.ethertype == __constant_htons(ETH_P_IP)) {
-+ /* Convert IP packet to ARP packet */
-+ packethdr->networkh.d.na.naa = NAA_IEEE_MAC_TYPE;
-+ packethdr->networkh.d.na.unused = 0;
-+ memcpy(packethdr->networkh.d.na.addr,
-+ hwbroadcast_addr, ETH_ALEN);
-+ packethdr->snaph.ethertype = __constant_htons(ETH_P_ARP);
-+
-+ arphdr->ar_tip = iphdr->iph.daddr;
-+ arphdr->ar_sip = iphdr->iph.saddr;
-+ arphdr->arph.ar_hrd = __constant_htons(ARPHRD_IEEE802);
-+ arphdr->arph.ar_pro = __constant_htons(ETH_P_IP);
-+ arphdr->arph.ar_hln = ETH_ALEN;
-+ arphdr->arph.ar_pln = sizeof(iphdr->iph.daddr); /* 4 */
-+ arphdr->arph.ar_op = __constant_htons(ARPOP_REQUEST);
-+ memcpy(arphdr->ar_sha, packethdr->networkh.s.na.addr, ETH_ALEN);
-+ memset(arphdr->ar_tha, 0, ETH_ALEN);
-+
-+ skb->len = sizeof(struct arp_header);
-+
-+ return 1;
-+ } else {
-+ return 0;
-+ }
-+}
-+
-+/**
-+ * qla2x00_get_ip_loopid() - Retrieve loop id of an IP device.
-+ * @ha: SCSI driver HA context
-+ * @packethdr: IP device to remove
-+ * @loop_id: loop id of discovered device
-+ *
-+ * This routine will interrogate the packet header to determine if the sender is
-+ * in the list of active IP devices. The first two bytes of the destination
-+ * address will be modified to match the port name stored in the active IP
-+ * device list.
-+ *
-+ * Returns 1 if a valid loop id is returned.
-+ */
-+static int
-+qla2x00_get_ip_loopid(scsi_qla_host_t *ha,
-+ struct packet_header *packethdr, uint16_t * loop_id)
-+{
-+ fc_port_t *fcport;
-+
-+ /* Scan list of logged in IP devices for match */
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (memcmp(&fcport->port_name[2],
-+ &(packethdr->networkh.d.fcaddr[2]), ETH_ALEN))
-+ continue;
-+
-+ /* Found match, return loop ID */
-+ *loop_id = fcport->loop_id;
-+
-+ /* Update first 2 bytes of port name */
-+ packethdr->networkh.d.fcaddr[0] = fcport->port_name[0];
-+ packethdr->networkh.d.fcaddr[1] = fcport->port_name[1];
-+
-+ return 1;
-+ }
-+
-+ /* Check for broadcast or multicast packet */
-+ if (!memcmp(packethdr->networkh.d.na.addr, hwbroadcast_addr,
-+ ETH_ALEN) || (packethdr->networkh.d.na.addr[0] & 0x01)) {
-+ /* Broadcast packet, return broadcast loop ID */
-+ *loop_id = BROADCAST;
-+
-+ /* Update destination NAA of header */
-+ packethdr->networkh.d.na.naa = NAA_IEEE_MAC_TYPE;
-+ packethdr->networkh.d.na.unused = 0;
-+ return 1;
-+ }
-+
-+ /* TODO */
-+ /* Try sending FARP IOCB to request login */
-+
-+ DEBUG12(printk("%s: ID not found for "
-+ "XX XX %02x %02x %02x %02x %02x %02x\n",
-+ __func__,
-+ packethdr->networkh.d.na.addr[0],
-+ packethdr->networkh.d.na.addr[1],
-+ packethdr->networkh.d.na.addr[2],
-+ packethdr->networkh.d.na.addr[3],
-+ packethdr->networkh.d.na.addr[4],
-+ packethdr->networkh.d.na.addr[5]));
-+
-+ return 0;
-+}
-+
-+/**
-+ * qla2x00_ip_enable() - Create IP-driver/SCSI-driver IP connection.
-+ * @ha: SCSI driver HA context
-+ * @enable_data: bd_enable data describing the IP connection
-+ *
-+ * This routine is called by the IP driver to enable an IP connection to the
-+ * SCSI driver and to pass in IP driver parameters.
-+ *
-+ * The HA context is propagated with the specified @enable_data and the
-+ * Firmware is initialized for IP support.
-+ *
-+ * Returns 1 if the IP connection was successfully enabled.
-+ */
-+static int
-+qla2x00_ip_enable(scsi_qla_host_t *ha, struct bd_enable *enable_data)
-+{
-+ int status;
-+
-+ DEBUG12(printk("%s: enable adapter %ld\n", __func__, ha->host_no));
-+
-+ status = 0;
-+
-+ /* Verify structure size and version and adapter online */
-+ if (!(ha->flags.online) ||
-+ (enable_data->length != BDE_LENGTH) ||
-+ (enable_data->version != BDE_VERSION)) {
-+
-+ DEBUG12(printk("%s: incompatable structure or offline\n",
-+ __func__));
-+ return status;
-+ }
-+
-+ /* Save parameters from IP driver */
-+ ha->mtu = enable_data->mtu;
-+ ha->header_size = enable_data->header_size;
-+ ha->receive_buffers = enable_data->receive_buffers;
-+ ha->max_receive_buffers = enable_data->max_receive_buffers;
-+ ha->receive_buff_data_size = enable_data->receive_buff_data_size;
-+ if (test_bit(BDE_NOTIFY_ROUTINE, &enable_data->options)) {
-+ ha->notify_routine = enable_data->notify_routine;
-+ ha->notify_context = enable_data->notify_context;
-+ }
-+ ha->send_completion_routine = enable_data->send_completion_routine;
-+ ha->receive_packets_routine = enable_data->receive_packets_routine;
-+ ha->receive_packets_context = enable_data->receive_packets_context;
-+
-+ /* Enable RISC IP support */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ status = qla24xx_ip_initialize(ha);
-+ else
-+ status = qla2x00_ip_initialize(ha);
-+ if (!status) {
-+ DEBUG12(printk("%s: IP initialization failed", __func__));
-+ ha->notify_routine = NULL;
-+ }
-+ return status;
-+}
-+
-+/**
-+ * qla2x00_ip_disable() - Remove IP-driver/SCSI-driver IP connection.
-+ * @ha: SCSI driver HA context
-+ *
-+ * This routine is called by the IP driver to disable a previously created IP
-+ * connection.
-+ *
-+ * A Firmware call to disable IP support is issued.
-+ */
-+static void
-+qla2x00_ip_disable(scsi_qla_host_t *ha)
-+{
-+ int rval;
-+ static mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ DEBUG12(printk("%s: disable adapter %ld\n", __func__, ha->host_no));
-+
-+ /* Wait for a ready state from the adapter */
-+ while (!ha->flags.init_done || ha->dpc_active) {
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ }
-+
-+ /* Disable IP support */
-+ ha->flags.enable_ip = 0;
-+
-+ mcp->mb[0] = MBC_DISABLE_IP;
-+ mcp->out_mb = MBX_0;
-+ mcp->in_mb = MBX_0;
-+ mcp->tov = 30;
-+ mcp->flags = 0;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+ if (rval == QL_STATUS_SUCCESS) {
-+ /* IP disabled successful */
-+ DEBUG12(printk(KERN_INFO "%s: successful\n", __func__));
-+ } else {
-+ DEBUG12(printk(KERN_WARNING
-+ "%s: MBC_DISABLE_IP failed\n", __func__));
-+ }
-+
-+ /* Reset IP parameters */
-+ ha->rec_entries_in = 0;
-+ ha->rec_entries_out = 0;
-+ ha->notify_routine = NULL;
-+}
-+
-+/**
-+ * qla2x00_add_buffers() - Adds buffers to the receive buffer queue.
-+ * @ha: SCSI driver HA context
-+ * @rec_count: The number of receive buffers to add to the queue
-+ * @ha_locked: Flag indicating if the function is called with the hardware lock
-+ *
-+ * This routine is called by the IP driver to pass new buffers to the receive
-+ * buffer queue.
-+ */
-+static void
-+qla2x00_add_buffers(scsi_qla_host_t *ha, uint16_t rec_count, int ha_locked)
-+{
-+ int i;
-+ uint16_t rec_in;
-+ uint16_t handle;
-+ unsigned long flags = 0;
-+ device_reg_t __iomem *reg;
-+ struct risc_rec_entry *risc_rec_q;
-+ struct buffer_cb *bcbs;
-+
-+ flags = 0;
-+ risc_rec_q = ha->risc_rec_q;
-+ rec_in = ha->rec_entries_in;
-+ bcbs = ha->receive_buffers;
-+ /* Set RISC owns buffer flag on new entries */
-+ for (i = 0; i < rec_count; i++) {
-+ handle = risc_rec_q[rec_in].handle;
-+ set_bit(BCB_RISC_OWNS_BUFFER, &(bcbs[handle].state));
-+ if (rec_in < IP_BUFFER_QUEUE_DEPTH - 1)
-+ rec_in++;
-+ else
-+ rec_in = 0;
-+ }
-+
-+ /* Update RISC buffer pointer */
-+ if (!ha_locked)
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ reg = ha->iobase;
-+ WRT_MAILBOX_REG(ha, reg, 8, rec_in);
-+ RD_MAILBOX_REG(ha, reg, 8);
-+ ha->rec_entries_in = rec_in;
-+
-+ if (!ha_locked)
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+}
-+
-+/**
-+ * qla2x00_send_packet() - Transmit a send_cb.
-+ * @ha: SCSI driver HA context
-+ * @scb: The send_cb structure to send
-+ *
-+ * This routine is called by the IP driver to pass @scb (IP packet) to the ISP
-+ * for transmission.
-+ *
-+ * Returns QL_STATUS_SUCCESS if @scb was sent, QL_STATUS_RESOURCE_ERROR if the
-+ * RISC was too busy to send, or QL_STATUS_ERROR.
-+ */
-+static int
-+qla2x00_send_packet(scsi_qla_host_t *ha, struct send_cb *scb)
-+{
-+ int i;
-+ uint16_t cnt;
-+ uint32_t handle;
-+ unsigned long flags;
-+ struct ip_cmd_entry *ipcmd_entry;
-+ struct sk_buff *skb;
-+ device_reg_t __iomem *reg;
-+ uint16_t loop_id;
-+
-+ skb = scb->skb;
-+ reg = ha->iobase;
-+
-+ /* Check adapter state */
-+ if (!ha->flags.online) {
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ /* Send marker if required */
-+ if (ha->marker_needed != 0) {
-+ if (qla2x00_marker(ha, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
-+ printk(KERN_WARNING
-+ "%s: Unable to issue marker.\n", __func__);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ ha->marker_needed = 0;
-+ }
-+
-+ /* Acquire ring specific lock */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ if (ha->req_q_cnt < 4) {
-+ /* Update number of free request entries */
-+ cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
-+ if (ha->req_ring_index < cnt)
-+ ha->req_q_cnt = cnt - ha->req_ring_index;
-+ else
-+ ha->req_q_cnt = ha->request_q_length -
-+ (ha->req_ring_index - cnt);
-+ }
-+
-+ if (ha->req_q_cnt >= 4) {
-+ /* Get tag handle for command */
-+ handle = ha->current_scb_q_idx;
-+ for (i = 0; i < MAX_SEND_PACKETS; i++) {
-+ handle++;
-+ if (handle == MAX_SEND_PACKETS)
-+ handle = 0;
-+ if (ha->active_scb_q[handle] == NULL) {
-+ ha->current_scb_q_idx = handle;
-+ goto found_handle;
-+ }
-+ }
-+ }
-+
-+ /* Low on resources, try again later */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ printk(KERN_WARNING
-+ "%s: Low on resources, try again later...\n", __func__);
-+
-+ return QLA_MEMORY_ALLOC_FAILED;
-+
-+found_handle:
-+
-+ /* Build ISP command packet */
-+ ipcmd_entry = (struct ip_cmd_entry *)ha->request_ring_ptr;
-+
-+ *((uint32_t *) (&ipcmd_entry->entry_type)) =
-+ __constant_cpu_to_le32(ET_IP_COMMAND_64 | (1 << 8));
-+
-+ ipcmd_entry->handle = handle;
-+
-+ /* Get destination loop ID for packet */
-+ if (!qla2x00_get_ip_loopid(ha, scb->header, &loop_id)) {
-+ /* Failed to get loop ID, convert packet to ARP */
-+ if (qla2x00_convert_to_arp(ha, scb)) {
-+ /* Broadcast ARP */
-+ loop_id = BROADCAST;
-+ } else {
-+ /* Return packet */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ printk(KERN_WARNING
-+ "%s: Unable to determine loop id for "
-+ "destination.\n", __func__);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ }
-+
-+ /* Default five second firmware timeout */
-+ ipcmd_entry->loop_id = cpu_to_le16(loop_id);
-+ ipcmd_entry->timeout = __constant_cpu_to_le16(5);
-+ ipcmd_entry->control_flags = __constant_cpu_to_le16(CF_WRITE);
-+ ipcmd_entry->reserved_2 = 0;
-+ ipcmd_entry->service_class = __constant_cpu_to_le16(0);
-+ ipcmd_entry->data_seg_count = __constant_cpu_to_le16(2);
-+ scb->skb_data_dma = pci_map_single(ha->pdev, skb->data, skb->len,
-+ PCI_DMA_TODEVICE);
-+ ipcmd_entry->dseg_0_address[0] = cpu_to_le32(LSD(scb->header_dma));
-+ ipcmd_entry->dseg_0_address[1] = cpu_to_le32(MSD(scb->header_dma));
-+ ipcmd_entry->dseg_0_length =
-+ __constant_cpu_to_le32(sizeof(struct packet_header));
-+ ipcmd_entry->dseg_1_address[0] = cpu_to_le32(LSD(scb->skb_data_dma));
-+ ipcmd_entry->dseg_1_address[1] = cpu_to_le32(MSD(scb->skb_data_dma));
-+ ipcmd_entry->dseg_1_length = cpu_to_le32(skb->len);
-+ ipcmd_entry->byte_count =
-+ cpu_to_le32(skb->len + sizeof(struct packet_header));
-+
-+ /* Adjust ring index. */
-+ ha->req_ring_index++;
-+ if (ha->req_ring_index == ha->request_q_length) {
-+ ha->req_ring_index = 0;
-+ ha->request_ring_ptr = ha->request_ring;
-+ } else
-+ ha->request_ring_ptr++;
-+
-+ ha->ipreq_cnt++;
-+ ha->req_q_cnt--;
-+ ha->active_scb_q[handle] = scb;
-+ /* Set chip new ring index. */
-+ WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
-+ RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ return QL_STATUS_SUCCESS;
-+}
-+
-+static int
-+qla24xx_send_packet(scsi_qla_host_t *ha, struct send_cb *scb)
-+{
-+ int i;
-+ uint16_t cnt;
-+ uint16_t loop_id;
-+ uint32_t handle;
-+ unsigned long flags;
-+ struct ip_cmd_entry_24xx *ipcmd_entry;
-+ cont_a64_entry_t *ipcmd_cont;
-+ struct sk_buff *skb;
-+ struct device_reg_24xx __iomem *reg;
-+
-+ skb = scb->skb;
-+ reg = (struct device_reg_24xx __iomem *)ha->iobase;
-+
-+ /* Check adapter state */
-+ if (!ha->flags.online) {
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ /* Send marker if required */
-+ if (ha->marker_needed != 0) {
-+ if (qla2x00_marker(ha, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
-+ printk(KERN_WARNING
-+ "%s: Unable to issue marker.\n", __func__);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ ha->marker_needed = 0;
-+ }
-+
-+ /* Acquire ring specific lock */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+
-+ if (ha->req_q_cnt < 4) {
-+ /* Update number of free request entries */
-+ cnt = (uint16_t)RD_REG_DWORD_RELAXED(&reg->req_q_out);
-+ if (ha->req_ring_index < cnt)
-+ ha->req_q_cnt = cnt - ha->req_ring_index;
-+ else
-+ ha->req_q_cnt = ha->request_q_length -
-+ (ha->req_ring_index - cnt);
-+ }
-+
-+ if (ha->req_q_cnt >= 4) {
-+ /* Get tag handle for command */
-+ handle = ha->current_scb_q_idx;
-+ for (i = 0; i < MAX_SEND_PACKETS; i++) {
-+ handle++;
-+ if (handle == MAX_SEND_PACKETS)
-+ handle = 0;
-+ if (ha->active_scb_q[handle] == NULL) {
-+ ha->current_scb_q_idx = handle;
-+ goto found_handle;
-+ }
-+ }
-+ }
-+
-+ /* Low on resources, try again later */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ printk(KERN_WARNING
-+ "%s: Low on resources, try again later...\n", __func__);
-+
-+ return QLA_MEMORY_ALLOC_FAILED;
-+
-+found_handle:
-+
-+ /* Build ISP command packet */
-+ ipcmd_entry = (struct ip_cmd_entry_24xx *)ha->request_ring_ptr;
-+
-+ *((uint32_t *) (&ipcmd_entry->entry_type)) =
-+ __constant_cpu_to_le32(IP_COMMAND_24XX);
-+ ipcmd_entry->handle = handle;
-+ memset((uint32_t *)ipcmd_entry + 2, 0, REQUEST_ENTRY_SIZE - 8);
-+
-+ /* Get destination loop ID for packet */
-+ if (!qla2x00_get_ip_loopid(ha, scb->header, &loop_id)) {
-+ /* Failed to get loop ID, convert packet to ARP */
-+ if (qla2x00_convert_to_arp(ha, scb)) {
-+ /* Broadcast ARP */
-+ loop_id = BROADCAST;
-+ } else {
-+ /* Return packet */
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ printk(KERN_WARNING
-+ "%s: Unable to determine loop id for "
-+ "destination.\n", __func__);
-+ return QLA_FUNCTION_FAILED;
-+ }
-+ }
-+
-+ /* Default five second firmware timeout */
-+ ipcmd_entry->nport_handle = cpu_to_le16(loop_id);
-+ ipcmd_entry->timeout = __constant_cpu_to_le16(5);
-+ ipcmd_entry->dseg_count = __constant_cpu_to_le16(2);
-+
-+ ipcmd_entry->control_flags = __constant_cpu_to_le16(BIT_0);
-+ ipcmd_entry->fhdr_control_flags = __constant_cpu_to_le16(BIT_4|BIT_5);
-+ ipcmd_entry->byte_count =
-+ cpu_to_le32(skb->len + sizeof(struct packet_header));
-+
-+ scb->skb_data_dma = pci_map_single(ha->pdev, skb->data, skb->len,
-+ PCI_DMA_TODEVICE);
-+ ipcmd_entry->dseg_0_address[0] = cpu_to_le32(LSD(scb->header_dma));
-+ ipcmd_entry->dseg_0_address[1] = cpu_to_le32(MSD(scb->header_dma));
-+ ipcmd_entry->dseg_0_length =
-+ __constant_cpu_to_le32(sizeof(struct packet_header));
-+
-+ /* Adjust ring index. */
-+ ha->req_ring_index++;
-+ if (ha->req_ring_index == ha->request_q_length) {
-+ ha->req_ring_index = 0;
-+ ha->request_ring_ptr = ha->request_ring;
-+ } else
-+ ha->request_ring_ptr++;
-+ ha->req_q_cnt--;
-+
-+ /* Build continuation packet */
-+ ipcmd_cont = (cont_a64_entry_t *)ha->request_ring_ptr;
-+ memset(ipcmd_cont, 0, REQUEST_ENTRY_SIZE);
-+ *((uint32_t *) (&ipcmd_cont->entry_type)) =
-+ __constant_cpu_to_le32(CONTINUE_A64_TYPE);
-+
-+ ipcmd_cont->dseg_0_address[0] = cpu_to_le32(LSD(scb->skb_data_dma));
-+ ipcmd_cont->dseg_0_address[1] = cpu_to_le32(MSD(scb->skb_data_dma));
-+ ipcmd_cont->dseg_0_length = cpu_to_le32(skb->len);
-+ wmb();
-+
-+ /* Adjust ring index. */
-+ ha->req_ring_index++;
-+ if (ha->req_ring_index == ha->request_q_length) {
-+ ha->req_ring_index = 0;
-+ ha->request_ring_ptr = ha->request_ring;
-+ } else
-+ ha->request_ring_ptr++;
-+ ha->req_q_cnt--;
-+
-+ ha->ipreq_cnt++;
-+ ha->active_scb_q[handle] = scb;
-+
-+ /* Set chip new ring index. */
-+ WRT_REG_DWORD(&reg->req_q_in, ha->req_ring_index);
-+ RD_REG_DWORD_RELAXED(&reg->req_q_in); /* PCI Posting. */
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ return QL_STATUS_SUCCESS;
-+}
-+
-+/**
-+ * qla2x00_tx_timeout() - Handle transmission timeout.
-+ * @ha: SCSI driver HA context
-+ *
-+ * This routine is called by the IP driver to handle packet transmission
-+ * timeouts.
-+ *
-+ * Returns QL_STATUS_SUCCESS if timeout handling completed successfully.
-+ */
-+static int
-+qla2x00_tx_timeout(scsi_qla_host_t *ha)
-+{
-+ /* TODO: complete interface */
-+
-+ /* Reset RISC firmware for basic recovery */
-+ printk(KERN_WARNING
-+ "%s: A transmission timeout occured - aborting ISP\n", __func__);
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+
-+ return QL_STATUS_SUCCESS;
-+}
-+
-+/**
-+ * qla2x00_ip_inquiry() - Discover IP-capable adapters.
-+ * @adapter_num: adapter number to check (instance)
-+ * @inq_data: return bd_inquiry data of the discovered adapter
-+ *
-+ * This routine is called by the IP driver to discover adapters that support IP
-+ * and to get adapter parameters from the SCSI driver.
-+ *
-+ * Returns 1 if the specified adapter supports IP.
-+ */
-+int
-+qla2x00_ip_inquiry(uint16_t adapter_num, struct bd_inquiry *inq_data)
-+{
-+ int found;
-+ scsi_qla_host_t *ha;
-+
-+ /* Verify structure size and version */
-+ if ((inq_data->length != BDI_LENGTH) ||
-+ (inq_data->version != BDI_VERSION)) {
-+ DEBUG12(printk("%s: incompatable structure\n", __func__));
-+ return 0;
-+ }
-+
-+ /* Find the specified host adapter */
-+ found = 0;
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list) {
-+ if (ha->instance == adapter_num) {
-+ found++;
-+ break;
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ if (!found)
-+ return 0;
-+ if (!ha->flags.online)
-+ return 0;
-+
-+ DEBUG12(printk("%s: found adapter %d\n", __func__, adapter_num));
-+
-+ /* Return inquiry data to backdoor IP driver */
-+ set_bit(BDI_IP_SUPPORT, &inq_data->options);
-+ if (ha->flags.enable_64bit_addressing)
-+ set_bit(BDI_64BIT_ADDRESSING, &inq_data->options);
-+ inq_data->ha = ha;
-+ inq_data->risc_rec_q = ha->risc_rec_q;
-+ inq_data->risc_rec_q_size = IP_BUFFER_QUEUE_DEPTH;
-+ inq_data->link_speed = ha->link_data_rate;
-+ memcpy(inq_data->port_name, ha->ip_port_name, WWN_SIZE);
-+ inq_data->pdev = ha->pdev;
-+ inq_data->ip_enable_routine = qla2x00_ip_enable;
-+ inq_data->ip_disable_routine = qla2x00_ip_disable;
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ set_bit(BDI_64BIT_ADDRESSING, &inq_data->options);
-+ inq_data->ip_add_buffers_routine = qla24xx_add_buffers;
-+ inq_data->ip_send_packet_routine = qla24xx_send_packet;
-+ } else {
-+ inq_data->ip_add_buffers_routine = qla2x00_add_buffers;
-+ inq_data->ip_send_packet_routine = qla2x00_send_packet;
-+ }
-+ inq_data->ip_tx_timeout_routine = qla2x00_tx_timeout;
-+
-+ return 1;
-+}
-+EXPORT_SYMBOL_GPL(qla2x00_ip_inquiry);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_ip.h ./drivers/scsi/qla2xxx/qla_ip.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_ip.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_ip.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,445 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
-+/****************************************************************************
-+ Please see revision.notes for revision history.
-+*****************************************************************************/
-+
-+#if !defined(_QLA_IP_H_)
-+#define _QLA_IP_H_
-+
-+#define MAX_SEND_PACKETS 32 /* Maximum # send packets */
-+#define MAX_RECEIVE_BUFFERS 64 /* Maximum # receive buffers */
-+#define MIN_RECEIVE_BUFFERS 8 /* Minimum # receive buffers */
-+#define IP_BUFFER_QUEUE_DEPTH (MAX_RECEIVE_BUFFERS+1)
-+
-+/* Async notification types */
-+#define NOTIFY_EVENT_LINK_DOWN 1 /* Link went down */
-+#define NOTIFY_EVENT_LINK_UP 2 /* Link is back up */
-+#define NOTIFY_EVENT_RESET_DETECTED 3 /* Reset detected */
-+
-+/* QLogic subroutine status definitions */
-+#define QL_STATUS_SUCCESS 0
-+#define QL_STATUS_ERROR 1
-+#define QL_STATUS_FATAL_ERROR 2
-+#define QL_STATUS_RESOURCE_ERROR 3
-+#define QL_STATUS_LOOP_ID_IN_USE 4
-+#define QL_STATUS_NO_DATA 5
-+
-+/************************************************************************/
-+/* RFC 2625 -- networking structure definitions */
-+/************************************************************************/
-+
-+/* Network header definitions */
-+struct network_address {
-+ __u8 naa;
-+#define NAA_IEEE_MAC_TYPE 0x10 /* NAA code - IEEE MAC addr */
-+
-+ __u8 unused;
-+ __u8 addr[6];
-+};
-+
-+struct network_header {
-+ union {
-+ struct network_address na;
-+ __u8 fcaddr[8];
-+ } d;
-+
-+ union {
-+ struct network_address na;
-+ __u8 fcaddr[8];
-+ } s;
-+};
-+
-+/* SNAP header definitions */
-+/* from linux/if_fc.h */
-+struct snap_header {
-+ __u8 dsap; /* destination SAP */
-+ __u8 ssap; /* source SAP */
-+#define LLC_SAP_IEEE_802DOT2 0xAA /* LLC SAP code - IEEE 802.2 */
-+
-+ __u8 llc; /* LLC control field */
-+#define LLC_CONTROL 0x03 /* LLC control code */
-+
-+ __u8 protid[3]; /* protocol id */
-+#define SNAP_OUI 0x00 /* SNAP OUI code */
-+
-+ __u16 ethertype; /* ether type field */
-+};
-+
-+/* Packet header definitions */
-+struct packet_header {
-+ struct network_header networkh;
-+ struct snap_header snaph;
-+};
-+
-+/* ARP header definitions */
-+/* from linux/if_arp.h */
-+struct arp_header {
-+ struct arphdr arph;
-+ __u8 ar_sha[ETH_ALEN]; /* sender hardware address */
-+ __u32 ar_sip; /* sender IP address */
-+ __u8 ar_tha[ETH_ALEN]; /* target hardware address */
-+ __u32 ar_tip; /* target IP address */
-+};
-+
-+/* IP header definitions */
-+struct ip_header {
-+ struct iphdr iph;
-+ __u32 options; /* IP packet options */
-+};
-+
-+/************************************************************************/
-+/* Support structures. */
-+/************************************************************************/
-+
-+/* Definitions for IP support */
-+#define LOOP_ID_MASK 0x00FF
-+#define PLE_NOT_SCSI_DEVICE 0x8000 /* Upper bit of loop ID set */
-+ /* if not SCSI */
-+
-+/* Receive buffer control block definitions */
-+struct buffer_cb {
-+ uint16_t handle; /* ISP buffer handle */
-+ uint16_t comp_status; /* completion status from FW */
-+
-+ unsigned long state; /* Buffer CB state */
-+#define BCB_RISC_OWNS_BUFFER 1
-+
-+ struct sk_buff *skb; /* Socket buffer */
-+ uint8_t *skb_data; /* Socket buffer data */
-+ dma_addr_t skb_data_dma; /* SKB data physical address */
-+ uint32_t rec_data_size; /* Size of received data */
-+ uint32_t packet_size; /* Size of packet received */
-+
-+ uint16_t linked_bcb_cnt; /* # of linked CBs for packet */
-+ uint16_t unused2;
-+ struct buffer_cb *next_bcb; /* Next buffer CB */
-+};
-+
-+/* Send control block definitions */
-+struct send_cb {
-+ uint16_t comp_status; /* completion status from FW */
-+#define SCB_CS_COMPLETE 0x0
-+#define SCB_CS_INCOMPLETE 0x1
-+#define SCB_CS_RESET 0x4
-+#define SCB_CS_ABORTED 0x5
-+#define SCB_CS_TIMEOUT 0x6
-+#define SCB_CS_PORT_UNAVAILABLE 0x28
-+#define SCB_CS_PORT_LOGGED_OUT 0x29
-+#define SCB_CS_PORT_CONFIG_CHG 0x2A
-+#define SCB_CS_FW_RESOURCE_UNAVAILABLE 0x2C
-+
-+ uint16_t unused1;
-+
-+ void *qdev; /* netdev private structure */
-+
-+ struct packet_header *header; /* Network/SNAP Header pool. */
-+ dma_addr_t header_dma;
-+
-+ struct sk_buff *skb; /* socket buffer to send */
-+ dma_addr_t skb_data_dma; /* skb data physical address */
-+};
-+
-+/************************************************************************/
-+/* Definitions for Backdoor Inquiry. */
-+/************************************************************************/
-+
-+struct bd_inquiry {
-+ uint16_t length; /* Length of structure */
-+#define BDI_LENGTH sizeof(struct bd_inquiry)
-+
-+ uint16_t version; /* Structure version number */
-+/* NOTE: Update this value anytime the structure changes */
-+#define BDI_VERSION 2
-+
-+ /* Exports */
-+ unsigned long options; /* supported options */
-+#define BDI_IP_SUPPORT 1 /* IP supported */
-+#define BDI_64BIT_ADDRESSING 2 /* 64bit address supported */
-+
-+ void *ha; /* Driver ha pointer */
-+ void *risc_rec_q; /* RISC receive queue */
-+ uint16_t risc_rec_q_size; /* size */
-+
-+ uint16_t link_speed; /* Current link speed */
-+#define BDI_1GBIT_PORTSPEED 1 /* operating at 1GBIT */
-+#define BDI_2GBIT_PORTSPEED 2 /* operating at 2GBIT */
-+#define BDI_4GBIT_PORTSPEED 4 /* operating at 2GBIT */
-+#define BDI_8GBIT_PORTSPEED 8 /* operating at 2GBIT */
-+#define BDI_10GBIT_PORTSPEED 16 /* operating at 10GBIT */
-+
-+ uint8_t port_name[8]; /* Adapter port name */
-+
-+ struct pci_dev *pdev; /* PCI device information */
-+
-+ /* Pointers to SCSI-backdoor callbacks */
-+ void *ip_enable_routine;
-+ void *ip_disable_routine;
-+ void *ip_add_buffers_routine;
-+ void *ip_send_packet_routine;
-+ void *ip_tx_timeout_routine;
-+
-+ uint32_t unused2[9];
-+};
-+
-+/************************************************************************/
-+/* Definitions for Backdoor Enable. */
-+/************************************************************************/
-+
-+struct bd_enable {
-+ uint16_t length; /* Length of structure */
-+#define BDE_LENGTH sizeof(struct bd_enable)
-+
-+ uint16_t version; /* Structure version number */
-+/* NOTE: Update this value anytime the structure changes */
-+#define BDE_VERSION 2
-+
-+ /* Imports */
-+ unsigned long options; /* supported options */
-+#define BDE_NOTIFY_ROUTINE 1 /* notify routine imported */
-+
-+ uint32_t mtu; /* maximum transfer size */
-+ uint16_t header_size; /* split header size */
-+ uint16_t unused1;
-+
-+ void *receive_buffers; /* receive buffers array */
-+ uint16_t max_receive_buffers; /* max # receive buffers */
-+ uint16_t unused2;
-+ uint32_t receive_buff_data_size; /* buffer size */
-+
-+ /* Pointers to IP-backdoor callbacks */
-+ void *notify_routine;
-+ void *notify_context;
-+ void *send_completion_routine;
-+ void *receive_packets_routine;
-+ void *receive_packets_context;
-+
-+ uint32_t unused3[9];
-+};
-+
-+/************************************************************************/
-+/* RISC interface structures */
-+/************************************************************************/
-+
-+/* IP mailbox commands */
-+#define MBC_INITIALIZE_IP 0x0077
-+#define MBC_DISABLE_IP 0x0079
-+
-+/* IP async events */
-+#define MBA_IP_TRANSMIT_COMPLETE 0x8022
-+#define MBA_IP_RECEIVE_COMPLETE 0x8023
-+#define MBA_IP_BROADCAST_RECEIVED 0x8024
-+#define MBA_IP_RECEIVE_BUFFERS_LOW 0x8025
-+#define MBA_IP_OUT_OF_BUFFERS 0x8026
-+#define MBA_IP_RECEIVE_COMPLETE_SPLIT 0x8027
-+
-+/* IP fast post completions for 2300 */
-+#define RHS_IP_SEND_COMPLETE 0x18
-+#define RHS_IP_RECV_COMPLETE 0x19
-+#define RHS_IP_RECV_DA_COMPLETE 0x1B
-+
-+/* RISC IP receive buffer queue entry structure */
-+struct risc_rec_entry {
-+ uint32_t data_addr_low;
-+ uint32_t data_addr_high;
-+ uint16_t handle;
-+ uint16_t unused;
-+};
-+
-+/* Firmware IP initialization control block definitions */
-+struct ip_init_cb {
-+ uint8_t version;
-+#define IPICB_VERSION 0x01
-+
-+ uint8_t reserved_1;
-+
-+ uint16_t firmware_options;
-+#define IPICB_OPTION_64BIT_ADDRESSING 0x0001
-+#define IPICB_OPTION_NO_BROADCAST_FASTPOST 0x0002
-+#define IPICB_OPTION_OUT_OF_BUFFERS_EVENT 0x0004
-+
-+ uint16_t header_size;
-+ uint16_t mtu;
-+ uint16_t receive_buffer_size;
-+ uint16_t reserved_2;
-+ uint16_t reserved_3;
-+ uint16_t reserved_4;
-+ uint16_t reserved_5;
-+
-+ uint16_t receive_queue_size;
-+ uint16_t low_water_mark;
-+#define IPICB_LOW_WATER_MARK 0
-+
-+ uint16_t receive_queue_addr[4];
-+ uint16_t receive_queue_in;
-+ uint16_t fast_post_count;
-+
-+ uint16_t container_count;
-+#define IPICB_BUFFER_CONTAINER_COUNT 64
-+
-+ uint8_t reserved_6[28];
-+};
-+
-+/* IP IOCB types */
-+
-+/* IP Command IOCB structure */
-+struct ip_cmd_entry {
-+ uint8_t entry_type;
-+#define ET_IP_COMMAND_64 0x1B
-+
-+ uint8_t entry_count;
-+ uint8_t sys_define;
-+ uint8_t entry_status;
-+
-+ uint32_t handle;
-+ uint16_t loop_id;
-+ uint16_t comp_status;
-+ uint16_t control_flags;
-+ uint16_t reserved_2;
-+ uint16_t timeout;
-+ uint16_t data_seg_count;
-+ uint16_t service_class;
-+ uint16_t reserved_3[7];
-+ uint32_t byte_count;
-+ uint32_t dseg_0_address[2];
-+ uint32_t dseg_0_length;
-+ uint32_t dseg_1_address[2];
-+ uint32_t dseg_1_length;
-+};
-+
-+/* IP Receive IOCB structure */
-+struct ip_rec_entry {
-+ uint8_t entry_type;
-+#define ET_IP_RECEIVE 0x23
-+
-+ uint8_t entry_count;
-+ uint8_t segment_count;
-+ uint8_t entry_status;
-+
-+ uint16_t s_idlow;
-+ uint8_t s_idhigh;
-+ uint8_t reserved_1;
-+ uint16_t loop_id;
-+ uint16_t comp_status;
-+#define IPREC_STATUS_SPLIT_BUFFER 0x0001
-+
-+ uint16_t service_class;
-+ uint16_t sequence_length;
-+
-+#define IPREC_MAX_HANDLES 24
-+ uint16_t buffer_handles[IPREC_MAX_HANDLES];
-+};
-+
-+
-+#define IPICB24_VERSION 1
-+struct ip_init_cb_24xx {
-+ uint8_t version;
-+ uint8_t reserved_1;
-+
-+ /*
-+ * BIT 0-1 = Reserved
-+ * BIT 2 = Allow Out of Received Buffers AE
-+ * BIT 3-15 = Reserved
-+ */
-+ uint16_t firmware_options;
-+
-+ uint16_t header_size;
-+ uint16_t mtu;
-+ uint16_t receive_buffer_size;
-+ uint16_t reserved_2[5];
-+
-+ uint16_t low_water_mark;
-+ uint16_t reserved_3[6];
-+
-+ uint16_t container_count;
-+
-+ uint16_t reserved_6[14];
-+};
-+
-+/* IP IOCB types */
-+
-+#define IP_COMMAND_24XX 0x3B
-+struct ip_cmd_entry_24xx {
-+ uint8_t entry_type;
-+ uint8_t entry_count;
-+ uint8_t sys_define;
-+ uint8_t entry_status;
-+
-+ uint32_t handle;
-+ uint16_t nport_handle;
-+ uint16_t timeout;
-+ uint16_t dseg_count;
-+ uint16_t reserved_1[3];
-+
-+ uint32_t tx_exg_addr;
-+
-+ /*
-+ * BIT 0 = Always 1
-+ * BIT 1 = Terminate Exchange
-+ * BIT 2-15 = Reserved
-+ */
-+ uint16_t control_flags;
-+
-+ /*
-+ * BIT 0-3 = Reserved
-+ * BIT 4 = Last Sequence
-+ * BIT 5 = First Sequence
-+ * BIT 6-15 = Reserved
-+ */
-+ uint16_t fhdr_control_flags;
-+
-+ uint16_t reserved_2[6];
-+
-+ uint32_t sys_define2;
-+ uint32_t byte_count;
-+ uint16_t reserved_3[2];
-+
-+ uint32_t dseg_0_address[2];
-+ uint32_t dseg_0_length;
-+};
-+
-+#define IP_RECEIVE_24XX 0x3c
-+struct ip_rec_entry_24xx {
-+ uint8_t entry_type;
-+ uint8_t entry_count;
-+ uint8_t segment_count;
-+ uint8_t entry_status;
-+
-+ uint16_t s_idlow;
-+ uint8_t s_idhigh;
-+ uint8_t reserved_1;
-+
-+ uint16_t comp_status;
-+ uint16_t nport_handle;
-+ uint16_t service_class;
-+ uint16_t sequence_length;
-+
-+#define IP_RCV_BUFFERS 4
-+ uint16_t buffer_handles[IP_RCV_BUFFERS];
-+
-+ uint16_t reserved_2[20];
-+};
-+
-+#define IP_LOAD_POOL_24XX 0x3d
-+struct ip_load_pool_24xx {
-+ uint8_t entry_type;
-+ uint8_t entry_count;
-+ uint8_t segment_count;
-+ uint8_t entry_status;
-+
-+ uint32_t handle;
-+
-+ uint16_t comp_status;
-+ uint16_t pool_id;
-+ uint16_t options;
-+ uint16_t buffer_count;
-+
-+#define IP_POOL_BUFFERS 4
-+ struct risc_rec_entry buffers[IP_POOL_BUFFERS];
-+};
-+#endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_isr.c ./drivers/scsi/qla2xxx/qla_isr.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_isr.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_isr.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,20 +1,8 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
-@@ -681,6 +669,15 @@ qla2x00_async_event(scsi_qla_host_t *ha,
- DEBUG2(printk("scsi(%ld): Discard RND Frame -- %04x %04x "
- "%04x.\n", ha->host_no, mb[1], mb[2], mb[3]));
- break;
-+
-+ case MBA_IP_LOW_WATER_MARK:
-+ DEBUG12(printk("scsi(%ld): Asynchronous IP Low Water Mark.\n",
-+ ha->host_no));
-+ break;
-+ case MBA_IP_RCV_BUFFER_EMPTY:
-+ DEBUG12(printk("scsi(%ld): Asynchronous IP Receive Buffers "
-+ "Empty.\n", ha->host_no));
-+ break;
- }
- }
-
-@@ -713,6 +710,11 @@ qla2x00_process_completed_request(struct
- if (ha->actthreads)
- ha->actthreads--;
- sp->lun_queue->out_cnt--;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (sp->fclun->io_cnt > 0)
-+ sp->fclun->io_cnt--;
-+ sp->fclun->s_time = jiffies - sp->u_start;
-+#endif
- CMD_COMPL_STATUS(sp->cmd) = 0L;
- CMD_SCSI_STATUS(sp->cmd) = 0L;
-
-@@ -790,6 +792,15 @@ qla2x00_process_response_queue(struct sc
- case MS_IOCB_TYPE:
- qla2x00_ms_entry(ha, (ms_iocb_entry_t *)pkt);
- break;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ case ET_IP_COMMAND_64:
-+ qla2x00_ip_send_complete(ha, pkt->handle,
-+ le16_to_cpu(pkt->comp_status));
-+ break;
-+ case ET_IP_RECEIVE:
-+ qla2x00_ip_receive(ha, (struct ip_rec_entry *)pkt);
-+ break;
-+#endif
- case MBX_IOCB_TYPE:
- if (!IS_QLA2100(ha) && !IS_QLA2200(ha) &&
- !IS_QLA6312(ha) && !IS_QLA6322(ha)) {
-@@ -845,7 +856,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha
- uint16_t scsi_status;
- uint8_t lscsi_status;
- int32_t resid;
-- uint32_t sense_len, rsp_info_len, resid_len;
-+ uint32_t sense_len, rsp_info_len, resid_len, fw_resid_len;
- uint8_t *rsp_info, *sense_data;
-
- sts = (sts_entry_t *) pkt;
-@@ -911,6 +922,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha
- }
-
- sp->lun_queue->out_cnt--;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (sp->fclun->io_cnt > 0)
-+ sp->fclun->io_cnt--;
-+ sp->fclun->s_time = jiffies - sp->u_start;
-+#endif
-
- lscsi_status = scsi_status & STATUS_MASK;
-
-@@ -921,11 +937,12 @@ qla2x00_status_entry(scsi_qla_host_t *ha
- tq = sp->tgt_queue;
- lq = sp->lun_queue;
-
-- sense_len = rsp_info_len = resid_len = 0;
-+ sense_len = rsp_info_len = resid_len = fw_resid_len = 0;
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- sense_len = le32_to_cpu(sts24->sense_len);
- rsp_info_len = le32_to_cpu(sts24->rsp_data_len);
- resid_len = le32_to_cpu(sts24->rsp_residual_count);
-+ fw_resid_len = le32_to_cpu(sts24->residual_len);
- rsp_info = sts24->data;
- sense_data = sts24->data;
- host_to_fcp_swap(sts24->data, sizeof(sts24->data));
-@@ -1057,6 +1074,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha
-
- case CS_DATA_UNDERRUN:
- resid = resid_len;
-+ /* Use F/W calculated residual length. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ resid = fw_resid_len;
-+
- if (scsi_status & SS_RESIDUAL_UNDER) {
- cp->resid = resid;
- if (sp->flags & SRB_IOCTL)
-@@ -1064,8 +1085,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha
- } else {
- DEBUG2(printk(KERN_INFO
- "scsi(%ld:%d:%d) UNDERRUN status detected "
-- "0x%x-0x%x.\n", ha->host_no, cp->device->id,
-- cp->device->lun, comp_status, scsi_status));
-+ "0x%x-0x%x. resid=0x%x fw_resid=0x%x cdb=0x%x "
-+ "os_underflow=0x%x srb_flags=0x%x\n", ha->host_no,
-+ cp->device->id, cp->device->lun, comp_status,
-+ scsi_status, resid_len, resid, cp->cmnd[0],
-+ cp->underflow, sp->flags));
- }
-
- /*
-@@ -1388,6 +1412,11 @@ qla2x00_error_entry(scsi_qla_host_t *ha,
- if (ha->actthreads)
- ha->actthreads--;
- sp->lun_queue->out_cnt--;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (sp->fclun->io_cnt > 0)
-+ sp->fclun->io_cnt--;
-+ sp->fclun->s_time = jiffies - sp->u_start;
-+#endif
-
- /* Bad payload or header */
- if (pkt->entry_status &
-@@ -1493,7 +1522,7 @@ qla2x00_check_sense(struct scsi_cmnd *cp
- /*
- * Suspend the lun only for hard disk device type.
- */
-- if ((fcport->flags & FCF_TAPE_PRESENT) == 0 &&
-+ if ((fcport->flags & FC_TAPE_PRESENT) == 0 &&
- lq->q_state != LUN_STATE_TIMEOUT) {
- /*
- * If target is in process of being ready then suspend
-@@ -1567,6 +1596,15 @@ qla24xx_process_response_queue(struct sc
- case MS_IOCB_TYPE:
- qla24xx_ms_entry(ha, (struct ct_entry_24xx *)pkt);
- break;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ case IP_COMMAND_24XX:
-+ qla24xx_ip_send_complete(ha, pkt->handle,
-+ le16_to_cpu(pkt->comp_status));
-+ break;
-+ case IP_RECEIVE_24XX:
-+ qla24xx_ip_receive(ha, (struct ip_rec_entry_24xx *)pkt);
-+ break;
-+#endif
- default:
- /* Type Not Supported. */
- DEBUG4(printk(KERN_WARNING
-@@ -1692,8 +1730,8 @@ qla24xx_ms_entry(scsi_qla_host_t *ha, st
- DEBUG3(printk("%s(%ld): pkt=%p pkthandle=%d.\n",
- __func__, ha->host_no, pkt, pkt->handle));
-
-- DEBUG9(printk("%s: ct pkt dump:\n", __func__);)
-- DEBUG9(qla2x00_dump_buffer((void *)pkt, sizeof(struct ct_entry_24xx));)
-+ DEBUG9(printk("%s: ct pkt dump:\n", __func__));
-+ DEBUG9(qla2x00_dump_buffer((void *)pkt, sizeof(struct ct_entry_24xx)));
-
- /* Validate handle. */
- if (pkt->handle < MAX_OUTSTANDING_COMMANDS)
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_listops.h ./drivers/scsi/qla2xxx/qla_listops.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_listops.h 2006-08-23 11:10:14.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_listops.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /* Management functions for various lists */
-
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_mbx.c ./drivers/scsi/qla2xxx/qla_mbx.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_mbx.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_mbx.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,20 +1,8 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
-@@ -23,19 +11,20 @@
- //ISP24xx
- int qla24xx_abort_command(scsi_qla_host_t *, srb_t *);
- int qla24xx_abort_target(scsi_qla_host_t *, fc_port_t *);
-+static int qla24xx_lun_reset(scsi_qla_host_t *, fc_port_t *, uint16_t);
-
- static void
- qla2x00_mbx_sem_timeout(unsigned long data)
- {
- struct semaphore *sem_ptr = (struct semaphore *)data;
-
-- DEBUG11(printk("qla2x00_sem_timeout: entered.\n");)
-+ DEBUG11(printk("qla2x00_sem_timeout: entered.\n"));
-
- if (sem_ptr != NULL) {
- up(sem_ptr);
- }
-
-- DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n");)
-+ DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n"));
- }
-
- /*
-@@ -57,7 +46,11 @@ qla2x00_mbx_sem_timeout(unsigned long da
- * Context:
- * Kernel context.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int
-+#else
- static int
-+#endif
- qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
- {
- int rval;
-@@ -79,11 +72,7 @@ qla2x00_mailbox_command(scsi_qla_host_t
- rval = QLA_SUCCESS;
- abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
-
-- /* In diskdump, force POLLING mode */
-- if (crashdump_mode())
-- abort_active = 1;
--
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- /*
- * Wait for active mailbox commands to finish by waiting at most tov
-@@ -94,7 +83,7 @@ qla2x00_mailbox_command(scsi_qla_host_t
- if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) {
- /* Timeout occurred. Return error. */
- DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
-- "Exiting.\n", __func__, ha->host_no);)
-+ "Exiting.\n", __func__, ha->host_no));
- return QLA_FUNCTION_TIMEOUT;
- }
- }
-@@ -108,7 +97,7 @@ qla2x00_mailbox_command(scsi_qla_host_t
- spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags);
-
- DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n",
-- ha->host_no, mcp->mb[0]);)
-+ ha->host_no, mcp->mb[0]));
-
- spin_lock_irqsave(&ha->hardware_lock, flags);
-
-@@ -155,14 +144,14 @@ qla2x00_mailbox_command(scsi_qla_host_t
-
- /* Unlock mbx registers and wait for interrupt */
- DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. "
-- "jiffies=%lx.\n", __func__, ha->host_no, jiffies);)
-+ "jiffies=%lx.\n", __func__, ha->host_no, jiffies));
-
- /* Wait for mbx cmd completion until timeout */
-
- if (!abort_active && io_lock_on) {
- /* sleep on completion semaphore */
- DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n",
-- __func__, ha->host_no);)
-+ __func__, ha->host_no));
-
- init_timer(&tmp_intr_timer);
- tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem;
-@@ -171,11 +160,11 @@ qla2x00_mailbox_command(scsi_qla_host_t
- (void (*)(unsigned long))qla2x00_mbx_sem_timeout;
-
- DEBUG11(printk("%s(%ld): Adding timer.\n", __func__,
-- ha->host_no);)
-+ ha->host_no));
- add_timer(&tmp_intr_timer);
-
- DEBUG11(printk("%s(%ld): going to unlock & sleep. "
-- "time=0x%lx.\n", __func__, ha->host_no, jiffies);)
-+ "time=0x%lx.\n", __func__, ha->host_no, jiffies));
-
- set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
-
-@@ -194,14 +183,14 @@ qla2x00_mailbox_command(scsi_qla_host_t
- down(&ha->mbx_intr_sem);
-
- DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__,
-- ha->host_no, jiffies);)
-+ ha->host_no, jiffies));
- clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
-
- /* delete the timer */
- del_timer(&tmp_intr_timer);
- } else {
- DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
-- ha->host_no, command);)
-+ ha->host_no, command));
-
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
- WRT_REG_DWORD(&reg24->hccr, HCCRX_SET_HOST_INT);
-@@ -232,7 +221,7 @@ qla2x00_mailbox_command(scsi_qla_host_t
- uint16_t *iptr2;
-
- DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__,
-- ha->host_no, command);)
-+ ha->host_no, command));
-
- /* Got interrupt. Clear the flag. */
- ha->flags.mbox_int = 0;
-@@ -293,7 +282,7 @@ qla2x00_mailbox_command(scsi_qla_host_t
-
- if (!abort_active) {
- DEBUG11(printk("%s(%ld): checking for additional resp "
-- "interrupt.\n", __func__, ha->host_no);)
-+ "interrupt.\n", __func__, ha->host_no));
-
- /* polling mode for non isp_abort commands. */
- qla2x00_poll(ha);
-@@ -304,9 +293,9 @@ qla2x00_mailbox_command(scsi_qla_host_t
- if (!io_lock_on || (mcp->flags & IOCTL_CMD)) {
- /* not in dpc. schedule it for dpc to take over. */
- DEBUG(printk("%s(%ld): timeout schedule "
-- "isp_abort_needed.\n", __func__, ha->host_no);)
-+ "isp_abort_needed.\n", __func__, ha->host_no));
- DEBUG2_3_11(printk("%s(%ld): timeout schedule "
-- "isp_abort_needed.\n", __func__, ha->host_no);)
-+ "isp_abort_needed.\n", __func__, ha->host_no));
- qla_printk(KERN_WARNING, ha,
- "Mailbox command timeout occured. Scheduling ISP "
- "abort.\n");
-@@ -317,9 +306,9 @@ qla2x00_mailbox_command(scsi_qla_host_t
- } else if (!abort_active) {
- /* call abort directly since we are in the DPC thread */
- DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
-- __func__, ha->host_no);)
-+ __func__, ha->host_no));
- DEBUG2_3_11(printk("%s(%ld): timeout calling "
-- "abort_isp\n", __func__, ha->host_no);)
-+ "abort_isp\n", __func__, ha->host_no));
- qla_printk(KERN_WARNING, ha,
- "Mailbox command timeout occured. Issuing ISP "
- "abort.\n");
-@@ -332,9 +321,9 @@ qla2x00_mailbox_command(scsi_qla_host_t
- }
- clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
- DEBUG(printk("%s(%ld): finished abort_isp\n", __func__,
-- ha->host_no);)
-+ ha->host_no));
- DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n",
-- __func__, ha->host_no);)
-+ __func__, ha->host_no));
- }
- }
-
-@@ -345,9 +334,9 @@ qla2x00_mailbox_command(scsi_qla_host_t
- if (rval) {
- DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
- "mbx2=%x, cmd=%x ****\n", __func__, ha->host_no,
-- mcp->mb[0], mcp->mb[1], mcp->mb[2], command);)
-+ mcp->mb[0], mcp->mb[1], mcp->mb[2], command));
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- return rval;
-@@ -379,7 +368,7 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dm
- uint32_t normalized;
-
- DEBUG11(printk("qla2x00_load_ram(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- req_len = risc_code_size;
- nml_dma = 0;
-@@ -420,11 +409,11 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dm
-
- if (rval == QLA_SUCCESS) {
- /* Empty */
-- DEBUG11(printk("qla2x00_load_ram(%ld): done.\n", ha->host_no);)
-+ DEBUG11(printk("qla2x00_load_ram(%ld): done.\n", ha->host_no));
- } else {
- /* Empty */
- DEBUG2_3_11(printk("qla2x00_load_ram(%ld): failed. rval=%x "
-- "mb[0]=%x.\n", ha->host_no, rval, mcp->mb[0]);)
-+ "mb[0]=%x.\n", ha->host_no, rval, mcp->mb[0]));
- }
- return rval;
- }
-@@ -506,7 +495,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha,
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- mcp->mb[0] = MBC_EXECUTE_FIRMWARE;
- mcp->out_mb = MBX_0;
-@@ -536,10 +525,10 @@ qla2x00_execute_fw(scsi_qla_host_t *ha,
- } else {
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- DEBUG11(printk("%s(%ld): done exchanges=%x.\n",
-- __func__, ha->host_no, mcp->mb[1]);)
-+ __func__, ha->host_no, mcp->mb[1]));
- } else {
- DEBUG11(printk("%s(%ld): done.\n", __func__,
-- ha->host_no);)
-+ ha->host_no));
- }
- }
-
-@@ -723,7 +712,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
-- DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", ha->host_no);)
-+ DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", ha->host_no));
-
- mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST;
- mcp->mb[1] = 0xAAAA;
-@@ -751,11 +740,11 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -783,7 +772,7 @@ qla2x00_verify_checksum(scsi_qla_host_t
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- mcp->mb[0] = MBC_VERIFY_CHECKSUM;
- mcp->out_mb = MBX_0;
-@@ -806,9 +795,9 @@ qla2x00_verify_checksum(scsi_qla_host_t
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__,
- ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA54XX(ha) ?
-- (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1]));)
-+ (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1])));
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- return rval;
-@@ -855,9 +844,9 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha,
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n",
-- ha->host_no,rval);)
-+ ha->host_no,rval));
- DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n",
-- ha->host_no,rval);)
-+ ha->host_no,rval));
- } else {
- sts_entry_t *sts_entry = (sts_entry_t *) buffer;
-
-@@ -898,7 +887,7 @@ qla2x00_abort_command(scsi_qla_host_t *h
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
- return qla24xx_abort_command(ha, sp);
-
-- DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no);)
-+ DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no));
-
- fcport = sp->fclun->fcport;
-
-@@ -935,11 +924,11 @@ qla2x00_abort_command(scsi_qla_host_t *h
-
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- sp->flags |= SRB_ABORT_PENDING;
- DEBUG11(printk("qla2x00_abort_command(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -967,7 +956,7 @@ qla2x00_abort_target(fc_port_t *fcport)
- mbx_cmd_t *mcp = &mc;
- scsi_qla_host_t *ha;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no));
-
- if (fcport == NULL) {
- /* no target to abort */
-@@ -998,11 +987,11 @@ qla2x00_abort_target(fc_port_t *fcport)
-
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("qla2x00_abort_target(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_abort_target(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1038,7 +1027,7 @@ qla2x00_get_adapter_id(scsi_qla_host_t *
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID;
- mcp->out_mb = MBX_0;
-@@ -1059,11 +1048,11 @@ qla2x00_get_adapter_id(scsi_qla_host_t *
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1094,7 +1083,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *h
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_GET_RETRY_COUNT;
- mcp->out_mb = MBX_0;
-@@ -1106,7 +1095,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *h
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n",
-- ha->host_no, mcp->mb[0]);)
-+ ha->host_no, mcp->mb[0]));
- } else {
- /* Convert returned data and check our values. */
- *r_a_tov = mcp->mb[3] / 2;
-@@ -1118,7 +1107,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *h
- }
-
- DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d "
-- "ratov=%d.\n", ha->host_no, mcp->mb[3], ratov);)
-+ "ratov=%d.\n", ha->host_no, mcp->mb[3], ratov));
- }
-
- return rval;
-@@ -1149,7 +1138,7 @@ qla2x00_init_firmware(scsi_qla_host_t *h
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_INITIALIZE_FIRMWARE;
- mcp->mb[2] = MSW(ha->init_cb_dma);
-@@ -1169,11 +1158,11 @@ qla2x00_init_firmware(scsi_qla_host_t *h
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x "
- "mb0=%x.\n",
-- ha->host_no, rval, mcp->mb[0]);)
-+ ha->host_no, rval, mcp->mb[0]));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1205,7 +1194,7 @@ qla2x00_get_port_database(scsi_qla_host_
- struct port_database_24xx *pd24;
- dma_addr_t pd_dma;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- pd24 = NULL;
- pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma);
-@@ -1295,8 +1284,8 @@ qla2x00_get_port_database(scsi_qla_host_
- fcport->d_id.b.rsvd_1 = 0;
-
- /* Check for device require authentication. */
-- pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) :
-- (fcport->flags &= ~FCF_AUTH_REQ);
-+ pd->common_features & BIT_5 ? (fcport->flags |= FC_AUTH_REQ) :
-+ (fcport->flags &= ~FC_AUTH_REQ);
-
- /* If not target must be initiator or unknown type. */
- if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0)
-@@ -1342,7 +1331,7 @@ qla2x00_get_firmware_state(scsi_qla_host
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_GET_FIRMWARE_STATE;
- mcp->out_mb = MBX_0;
-@@ -1357,11 +1346,11 @@ qla2x00_get_firmware_state(scsi_qla_host
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): "
-- "failed=%x.\n", ha->host_no, rval);)
-+ "failed=%x.\n", ha->host_no, rval));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1394,7 +1383,7 @@ qla2x00_get_port_name(scsi_qla_host_t *h
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_GET_PORT_NAME;
- mcp->out_mb = MBX_1|MBX_0;
-@@ -1414,7 +1403,7 @@ qla2x00_get_port_name(scsi_qla_host_t *h
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- if (name != NULL) {
- /* This function returns name in big endian. */
-@@ -1429,12 +1418,176 @@ qla2x00_get_port_name(scsi_qla_host_t *h
- }
-
- DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
-+ }
-+
-+ return rval;
-+}
-+
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * qla2x00_get_link_status
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * loop_id = device loop ID.
-+ * ret_buf = pointer to link status return buffer.
-+ *
-+ * Returns:
-+ * 0 = success.
-+ * BIT_0 = mem alloc error.
-+ * BIT_1 = mailbox error.
-+ */
-+uint8_t
-+qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
-+ link_stat_t *ret_buf, uint16_t *status)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+ link_stat_t *stat_buf;
-+ dma_addr_t stat_buf_dma;
-+
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma);
-+ if (stat_buf == NULL) {
-+ DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
-+ __func__, ha->host_no));
-+ return BIT_0;
-+ }
-+ memset(stat_buf, 0, sizeof(link_stat_t));
-+
-+ mcp->mb[0] = MBC_GET_LINK_STATUS;
-+ mcp->mb[2] = MSW(stat_buf_dma);
-+ mcp->mb[3] = LSW(stat_buf_dma);
-+ mcp->mb[6] = MSW(MSD(stat_buf_dma));
-+ mcp->mb[7] = LSW(MSD(stat_buf_dma));
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-+ mcp->in_mb = MBX_0;
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ mcp->mb[1] = loop_id;
-+ mcp->mb[4] = 0;
-+ mcp->mb[10] = 0;
-+ mcp->out_mb |= MBX_10|MBX_4|MBX_1;
-+ mcp->in_mb |= MBX_1;
-+ } else if (HAS_EXTENDED_IDS(ha)) {
-+ mcp->mb[1] = loop_id;
-+ mcp->mb[10] = 0;
-+ mcp->out_mb |= MBX_10|MBX_1;
-+ } else {
-+ mcp->mb[1] = loop_id << 8;
-+ mcp->out_mb |= MBX_1;
- }
-+ mcp->tov = 30;
-+ mcp->flags = IOCTL_CMD;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval == QLA_SUCCESS) {
-+ if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-+ DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
-+ __func__, ha->host_no, mcp->mb[0]));
-+ status[0] = mcp->mb[0];
-+ rval = BIT_1;
-+ } else {
-+ /* copy over data -- firmware data is LE. */
-+ ret_buf->link_fail_cnt =
-+ le32_to_cpu(stat_buf->link_fail_cnt);
-+ ret_buf->loss_sync_cnt =
-+ le32_to_cpu(stat_buf->loss_sync_cnt);
-+ ret_buf->loss_sig_cnt =
-+ le32_to_cpu(stat_buf->loss_sig_cnt);
-+ ret_buf->prim_seq_err_cnt =
-+ le32_to_cpu(stat_buf->prim_seq_err_cnt);
-+ ret_buf->inval_xmit_word_cnt =
-+ le32_to_cpu(stat_buf->inval_xmit_word_cnt);
-+ ret_buf->inval_crc_cnt =
-+ le32_to_cpu(stat_buf->inval_crc_cnt);
-+
-+ DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d "
-+ "loss_sync=%d loss_sig=%d seq_err=%d "
-+ "inval_xmt_word=%d inval_crc=%d.\n", __func__,
-+ ha->host_no, stat_buf->link_fail_cnt,
-+ stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt,
-+ stat_buf->prim_seq_err_cnt,
-+ stat_buf->inval_xmit_word_cnt,
-+ stat_buf->inval_crc_cnt));
-+ }
-+ } else {
-+ /* Failed. */
-+ DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-+ ha->host_no, rval));
-+ rval = BIT_1;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma);
-
- return rval;
- }
-
-+uint8_t
-+qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
-+ uint16_t *status)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+ uint32_t *sbuf, *siter;
-+ dma_addr_t sbuf_dma;
-+
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ if (dwords > (DMA_POOL_SIZE / 4)) {
-+ DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs "
-+ "(max %d).\n", __func__, ha->host_no, dwords,
-+ DMA_POOL_SIZE / 4));
-+ return BIT_0;
-+ }
-+ sbuf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &sbuf_dma);
-+ if (sbuf == NULL) {
-+ DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
-+ __func__, ha->host_no));
-+ return BIT_0;
-+ }
-+ memset(sbuf, 0, DMA_POOL_SIZE);
-+
-+ mcp->mb[0] = MBC_GET_LINK_PRIV_STATS;
-+ mcp->mb[2] = MSW(sbuf_dma);
-+ mcp->mb[3] = LSW(sbuf_dma);
-+ mcp->mb[6] = MSW(MSD(sbuf_dma));
-+ mcp->mb[7] = LSW(MSD(sbuf_dma));
-+ mcp->mb[8] = dwords;
-+ mcp->mb[10] = 0;
-+ mcp->out_mb = MBX_10|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
-+ mcp->in_mb = MBX_2|MBX_1|MBX_0;
-+ mcp->tov = 30;
-+ mcp->flags = IOCTL_CMD;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval == QLA_SUCCESS) {
-+ if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-+ DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
-+ __func__, ha->host_no, mcp->mb[0]));
-+ status[0] = mcp->mb[0];
-+ rval = BIT_1;
-+ } else {
-+ /* Copy over data -- firmware data is LE. */
-+ siter = sbuf;
-+ while (dwords--)
-+ *dwbuf++ = le32_to_cpu(*siter++);
-+ }
-+ } else {
-+ /* Failed. */
-+ DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-+ ha->host_no, rval));
-+ rval = BIT_1;
-+ }
-+
-+ dma_pool_free(ha->s_dma_pool, sbuf, sbuf_dma);
-+
-+ return rval;
-+}
-+#endif
- /*
- * qla2x00_lip_reset
- * Issue LIP reset mailbox command.
-@@ -1457,7 +1610,7 @@ qla2x00_lip_reset(scsi_qla_host_t *ha)
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- mcp->mb[0] = MBC_LIP_FULL_LOGIN;
-@@ -1486,10 +1639,10 @@ qla2x00_lip_reset(scsi_qla_host_t *ha)
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("%s(%ld): failed=%x.\n",
-- __func__, ha->host_no, rval);)
-+ __func__, ha->host_no, rval));
- } else {
- /*EMPTY*/
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- return rval;
-@@ -1522,10 +1675,10 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dm
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total "
-- "tov=%d.\n", ha->retry_count, ha->login_timeout, mcp->tov);)
-+ "tov=%d.\n", ha->retry_count, ha->login_timeout, mcp->tov));
-
- mcp->mb[0] = MBC_SEND_SNS_COMMAND;
- mcp->mb[1] = cmd_size;
-@@ -1543,12 +1696,12 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dm
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
-- "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]);)
-+ "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
- DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
-- "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]);)
-+ "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
- } else {
- /*EMPTY*/
-- DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", ha->host_no);)
-+ DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", ha->host_no));
- }
-
- return rval;
-@@ -1564,7 +1717,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha
- dma_addr_t lg_dma;
- uint32_t iop[2];
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
- if (lg == NULL) {
-@@ -1580,13 +1733,15 @@ qla24xx_login_fabric(scsi_qla_host_t *ha
- lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI);
- if (opt & BIT_0)
- lg->control_flags |= __constant_cpu_to_le16(LCF_COND_PLOGI);
-+ if (opt & BIT_1)
-+ lg->control_flags |= __constant_cpu_to_le16(LCF_SKIP_PRLI);
- lg->port_id[0] = al_pa;
- lg->port_id[1] = area;
- lg->port_id[2] = domain;
- rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- } else if (lg->entry_status != 0) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- error status (%x).\n", __func__, ha->host_no,
-@@ -1627,7 +1782,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha
- break;
- }
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
-
- iop[0] = le32_to_cpu(lg->io_parameter[0]);
-
-@@ -1678,7 +1833,7 @@ qla2x00_login_fabric(scsi_qla_host_t *ha
- return qla24xx_login_fabric(ha, loop_id, domain, area, al_pa,
- mb, opt);
-
-- DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", ha->host_no);)
-+ DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", ha->host_no));
-
- mcp->mb[0] = MBC_LOGIN_FABRIC_PORT;
- mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
-@@ -1721,11 +1876,11 @@ qla2x00_login_fabric(scsi_qla_host_t *ha
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x "
- "mb[0]=%x mb[1]=%x mb[2]=%x.\n", ha->host_no, rval,
-- mcp->mb[0], mcp->mb[1], mcp->mb[2]);)
-+ mcp->mb[0], mcp->mb[1], mcp->mb[2]));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1761,7 +1916,7 @@ qla2x00_login_local_device(scsi_qla_host
- fcport->d_id.b.domain, fcport->d_id.b.area,
- fcport->d_id.b.al_pa, mb_ret, opt);
-
-- DEBUG3(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG3(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- mcp->mb[0] = MBC_LOGIN_LOOP_PORT;
- if (HAS_EXTENDED_IDS(ha))
-@@ -1795,13 +1950,13 @@ qla2x00_login_local_device(scsi_qla_host
-
- DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
- "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval,
-- mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]);)
-+ mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
- DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
- "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval,
-- mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]);)
-+ mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
- } else {
- /*EMPTY*/
-- DEBUG3(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG3(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- return (rval);
-@@ -1815,7 +1970,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *h
- struct logio_entry_24xx *lg;
- dma_addr_t lg_dma;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
- if (lg == NULL) {
-@@ -1836,7 +1991,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *h
- rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- } else if (lg->entry_status != 0) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- error status (%x).\n", __func__, ha->host_no,
-@@ -1847,10 +2002,10 @@ qla24xx_fabric_logout(scsi_qla_host_t *h
- "-- completion status (%x) ioparam=%x/%x.\n", __func__,
- ha->host_no, le16_to_cpu(lg->comp_status),
- le32_to_cpu(lg->io_parameter[0]),
-- le32_to_cpu(lg->io_parameter[1]));)
-+ le32_to_cpu(lg->io_parameter[1])));
- } else {
- /*EMPTY*/
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- dma_pool_free(ha->s_dma_pool, lg, lg_dma);
-@@ -1886,7 +2041,7 @@ qla2x00_fabric_logout(scsi_qla_host_t *h
- return qla24xx_fabric_logout(ha, loop_id, domain, area, al_pa);
-
- DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT;
- mcp->out_mb = MBX_1|MBX_0;
-@@ -1905,11 +2060,11 @@ qla2x00_fabric_logout(scsi_qla_host_t *h
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x "
-- "mbx1=%x.\n", ha->host_no, rval, mcp->mb[1]);)
-+ "mbx1=%x.\n", ha->host_no, rval, mcp->mb[1]));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1938,7 +2093,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- mcp->mb[0] = MBC_LIP_FULL_LOGIN;
- mcp->mb[1] = 0;
-@@ -1953,11 +2108,11 @@ qla2x00_full_login_lip(scsi_qla_host_t *
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- /*EMPTY*/
- DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return rval;
-@@ -1984,7 +2139,7 @@ qla2x00_get_id_list(scsi_qla_host_t *ha,
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n",
-- ha->host_no);)
-+ ha->host_no));
-
- if (id_list == NULL)
- return QLA_FUNCTION_FAILED;
-@@ -2013,16 +2168,264 @@ qla2x00_get_id_list(scsi_qla_host_t *ha,
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n",
-- ha->host_no, rval);)
-+ ha->host_no, rval));
- } else {
- *entries = mcp->mb[1];
- DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n",
-- ha->host_no);)
-+ ha->host_no));
-+ }
-+
-+ return rval;
-+}
-+
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * qla2x00_lun_reset
-+ * Issue lun reset mailbox command.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * loop_id = device loop ID.
-+ * lun = lun to be reset.
-+ * TARGET_QUEUE_LOCK must be released.
-+ * ADAPTER_STATE_LOCK must be released.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+__qla2x00_lun_reset(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ return qla24xx_lun_reset(ha, fcport, lun);
-+
-+ mcp->mb[0] = MBC_LUN_RESET;
-+ if (HAS_EXTENDED_IDS(ha))
-+ mcp->mb[1] = fcport->loop_id;
-+ else
-+ mcp->mb[1] = fcport->loop_id << 8;
-+ mcp->mb[2] = lun;
-+ mcp->mb[3] = 0;
-+ mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_0;
-+ mcp->tov = 60;
-+ mcp->flags = 0;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ /*EMPTY*/
-+ printk(KERN_WARNING "%s(%ld): failed = %d", __func__,
-+ ha->host_no, rval);
-+ } else {
-+ rval = qla2x00_marker(ha, fcport->loop_id, lun,
-+ MK_SYNC_ID_LUN);
-+ if (rval != QLA_SUCCESS)
-+ printk(KERN_WARNING "%s(%ld): failed to issue marker = "
-+ "%d", __func__, ha->host_no, rval);
- }
-
- return rval;
- }
-
-+int
-+qla2x00_lun_reset(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun)
-+{
-+ int retry;
-+ int rval;
-+
-+ retry = 2;
-+ do {
-+ rval = __qla2x00_lun_reset(ha, fcport, lun);
-+ if (rval != QLA_SUCCESS) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(10);
-+ }
-+ } while (rval != QLA_SUCCESS && retry--);
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_send_rnid_mbx
-+ * Issue RNID ELS using mailbox command
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * loop_id = loop ID of the target device.
-+ * data_fmt = currently supports only 0xDF.
-+ * buffer = buffer pointer.
-+ * buf_size = size of buffer.
-+ * mb_reg = pointer to return mailbox registers.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_send_rnid_mbx(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t data_fmt,
-+ dma_addr_t buf_phys_addr, size_t buf_size, uint16_t *mb_reg)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ DEBUG11(printk("qla2x00_send_rnid_mbx(%ld): entered.\n",
-+ ha->host_no));
-+
-+ mcp->mb[0] = MBC_SEND_RNID_ELS;
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-+ if (HAS_EXTENDED_IDS(ha)) {
-+ mcp->mb[1] = loop_id;
-+ mcp->mb[10] = data_fmt;
-+ mcp->out_mb |= MBX_10;
-+ } else {
-+ mcp->mb[1] = (loop_id << 8) | data_fmt;
-+ }
-+ mcp->mb[2] = MSW(buf_phys_addr);
-+ mcp->mb[3] = LSW(buf_phys_addr);
-+ mcp->mb[6] = MSW(MSD(buf_phys_addr));
-+ mcp->mb[7] = LSW(MSD(buf_phys_addr));
-+
-+ mcp->in_mb = MBX_1|MBX_0;
-+ mcp->buf_size = buf_size;
-+ mcp->flags = MBX_DMA_IN;
-+ mcp->tov = 30;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ memcpy(mb_reg, mcp->mb, 2 * 2); /* 2 status regs */
-+
-+ DEBUG2_3_11(printk("qla2x00_send_rnid_mbx(%ld): failed=%x "
-+ "mb[1]=%x.\n",
-+ ha->host_no, mcp->mb[0], mcp->mb[1]));
-+ } else {
-+ /*EMPTY*/
-+ DEBUG11(printk("qla2x00_send_rnid_mbx(%ld): done.\n",
-+ ha->host_no));
-+ }
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla2x00_set_rnid_params_mbx
-+ * Set RNID parameters using mailbox command
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * buffer = buffer pointer.
-+ * buf_size = size of buffer.
-+ * mb_reg = pointer to return mailbox registers.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_set_rnid_params_mbx(scsi_qla_host_t *ha, dma_addr_t buf_phys_addr,
-+ size_t buf_size, uint16_t *mb_reg)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ DEBUG11(printk("qla2x00_set_rnid_params_mbx(%ld): entered.\n",
-+ ha->host_no));
-+
-+ mcp->mb[0] = MBC_SET_RNID_PARAMS;
-+ mcp->mb[1] = 0;
-+ mcp->mb[2] = MSW(buf_phys_addr);
-+ mcp->mb[3] = LSW(buf_phys_addr);
-+ mcp->mb[6] = MSW(MSD(buf_phys_addr));
-+ mcp->mb[7] = LSW(MSD(buf_phys_addr));
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_1|MBX_0;
-+ mcp->buf_size = buf_size;
-+ mcp->flags = MBX_DMA_OUT;
-+ mcp->tov = 30;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ memcpy(mb_reg, mcp->mb, 2 * 2); /* 2 status regs */
-+
-+ DEBUG2_3_11(printk("qla2x00_set_rnid_params_mbx(%ld): "
-+ "failed=%x mb[1]=%x.\n", ha->host_no, mcp->mb[0],
-+ mcp->mb[1]));
-+ } else {
-+ /*EMPTY*/
-+ DEBUG11(printk("qla2x00_set_rnid_params_mbx(%ld): done.\n",
-+ ha->host_no));
-+ }
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla2x00_get_rnid_params_mbx
-+ * Get RNID parameters using mailbox command
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * buffer = buffer pointer.
-+ * buf_size = size of buffer.
-+ * mb_reg = pointer to return mailbox registers.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_get_rnid_params_mbx(scsi_qla_host_t *ha, dma_addr_t buf_phys_addr,
-+ size_t buf_size, uint16_t *mb_reg)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ DEBUG11(printk("qla2x00_get_rnid_params_mbx(%ld): entered.\n",
-+ ha->host_no));
-+
-+ mcp->mb[0] = MBC_GET_RNID_PARAMS;
-+ mcp->mb[1] = 0;
-+ mcp->mb[2] = MSW(buf_phys_addr);
-+ mcp->mb[3] = LSW(buf_phys_addr);
-+ mcp->mb[6] = MSW(MSD(buf_phys_addr));
-+ mcp->mb[7] = LSW(MSD(buf_phys_addr));
-+ mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_1|MBX_0;
-+ mcp->buf_size = buf_size;
-+ mcp->flags = MBX_DMA_IN;
-+ mcp->tov = 30;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ memcpy(mb_reg, mcp->mb, 2 * 2); /* 2 status regs */
-+
-+ DEBUG2_3_11(printk("qla2x00_get_rnid_params_mbx(%ld): "
-+ "failed=%x mb[1]=%x.\n", ha->host_no, mcp->mb[0],
-+ mcp->mb[1]));
-+ } else {
-+ /*EMPTY*/
-+ DEBUG11(printk("qla2x00_get_rnid_params_mbx(%ld): done.\n",
-+ ha->host_no));
-+ }
-+
-+ return (rval);
-+}
-+#endif
- /*
- * qla2x00_get_resource_cnts
- * Get current firmware resource counts.
-@@ -2056,7 +2459,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_
- if (rval != QLA_SUCCESS) {
- /*EMPTY*/
- DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__,
-- ha->host_no, mcp->mb[0]);)
-+ ha->host_no, mcp->mb[0]));
- } else {
- DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x "
- "mb7=%x mb10=%x.\n", __func__, ha->host_no,
-@@ -2159,7 +2562,7 @@ qla24xx_abort_command(scsi_qla_host_t *h
- dma_addr_t abt_dma;
- uint32_t handle;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- fcport = sp->fclun->fcport;
-
-@@ -2192,7 +2595,7 @@ qla24xx_abort_command(scsi_qla_host_t *h
- rval = qla2x00_issue_iocb(ha, abt, abt_dma, 0);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n",
-- __func__, ha->host_no, rval);)
-+ __func__, ha->host_no, rval));
- } else if (abt->entry_status != 0) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- error status (%x).\n", __func__, ha->host_no,
-@@ -2201,10 +2604,10 @@ qla24xx_abort_command(scsi_qla_host_t *h
- } else if (abt->nport_handle != __constant_cpu_to_le16(0)) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- completion status (%x).\n", __func__, ha->host_no,
-- le16_to_cpu(abt->nport_handle));)
-+ le16_to_cpu(abt->nport_handle)));
- rval = QLA_FUNCTION_FAILED;
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- sp->flags |= SRB_ABORT_PENDING;
- }
-
-@@ -2231,7 +2634,7 @@ qla24xx_abort_target(scsi_qla_host_t *ha
- struct tsk_mgmt_cmd *tsk;
- dma_addr_t tsk_dma;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
- if (tsk == NULL) {
-@@ -2252,7 +2655,7 @@ qla24xx_abort_target(scsi_qla_host_t *ha
- rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Target Reset IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- goto atarget_done;
- } else if (tsk->p.sts.entry_status != 0) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-@@ -2260,11 +2663,17 @@ qla24xx_abort_target(scsi_qla_host_t *ha
- tsk->p.sts.entry_status));
- rval = QLA_FUNCTION_FAILED;
- goto atarget_done;
-+ } else if (tsk->p.sts.comp_status ==
-+ __constant_cpu_to_le16(CS_PORT_LOGGED_OUT)) {
-+ DEBUG2_3_11(printk("%s(%ld): port %x logged out.\n", __func__,
-+ ha->host_no, fcport->d_id.b24));
-+ rval = QLA_PORT_LOGGED_OUT;
-+ goto atarget_done;
- } else if (tsk->p.sts.comp_status !=
- __constant_cpu_to_le16(CS_COMPLETE)) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- completion status (%x).\n", __func__,
-- ha->host_no, le16_to_cpu(tsk->p.sts.comp_status));)
-+ ha->host_no, le16_to_cpu(tsk->p.sts.comp_status)));
- rval = QLA_FUNCTION_FAILED;
- goto atarget_done;
- }
-@@ -2273,9 +2682,9 @@ qla24xx_abort_target(scsi_qla_host_t *ha
- rval = qla2x00_marker(ha, fcport->loop_id, 0, MK_SYNC_ID);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- atarget_done:
-@@ -2284,7 +2693,7 @@ atarget_done:
- return rval;
- }
-
--int
-+static int
- qla24xx_lun_reset(scsi_qla_host_t *ha, fc_port_t *fcport, uint16_t lun)
- {
- int rval;
-@@ -2292,7 +2701,7 @@ qla24xx_lun_reset(scsi_qla_host_t *ha, f
- struct tsk_mgmt_cmd *tsk;
- dma_addr_t tsk_dma;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
- if (tsk == NULL) {
-@@ -2308,6 +2717,7 @@ qla24xx_lun_reset(scsi_qla_host_t *ha, f
- tsk->p.tsk.timeout = __constant_cpu_to_le16(120);
- tsk->p.tsk.lun[1] = LSB(lun);
- tsk->p.tsk.lun[2] = MSB(lun);
-+ host_to_fcp_swap(tsk->p.tsk.lun, sizeof(tsk->p.tsk.lun));
- tsk->p.tsk.control_flags = __constant_cpu_to_le32(TCF_LUN_RESET);
- tsk->p.tsk.port_id[0] = fcport->d_id.b.al_pa;
- tsk->p.tsk.port_id[1] = fcport->d_id.b.area;
-@@ -2315,7 +2725,7 @@ qla24xx_lun_reset(scsi_qla_host_t *ha, f
- rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Lun Reset IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- goto lreset_done;
- } else if (tsk->p.sts.entry_status != 0) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-@@ -2327,7 +2737,7 @@ qla24xx_lun_reset(scsi_qla_host_t *ha, f
- __constant_cpu_to_le16(CS_COMPLETE)) {
- DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
- "-- completion status (%x).\n", __func__,
-- ha->host_no, le16_to_cpu(tsk->p.sts.comp_status));)
-+ ha->host_no, le16_to_cpu(tsk->p.sts.comp_status)));
- rval = QLA_FUNCTION_FAILED;
- goto lreset_done;
- }
-@@ -2336,9 +2746,9 @@ qla24xx_lun_reset(scsi_qla_host_t *ha, f
- rval = qla2x00_marker(ha, fcport->loop_id, lun, MK_SYNC_ID_LUN);
- if (rval != QLA_SUCCESS) {
- DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
-- "(%x).\n", __func__, ha->host_no, rval);)
-+ "(%x).\n", __func__, ha->host_no, rval));
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- lreset_done:
-@@ -2355,7 +2765,7 @@ qla24xx_full_login_lip(scsi_qla_host_t *
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
-- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- mcp->mb[0] = MBC_LIP_FULL_LOGIN;
- mcp->mb[1] = BIT_0;
-@@ -2371,7 +2781,7 @@ qla24xx_full_login_lip(scsi_qla_host_t *
- DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
- ha->host_no, rval, mcp->mb[0]));
- } else {
-- DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
- }
-
- return rval;
-@@ -2526,3 +2936,81 @@ qla2x00_stop_firmware(scsi_qla_host_t *h
-
- return rval;
- }
-+
-+int
-+qla2x00_trace_control(scsi_qla_host_t *ha, uint16_t ctrl, dma_addr_t eft_dma,
-+ uint16_t buffers)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
-+ return QLA_FUNCTION_FAILED;
-+
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ mcp->mb[0] = MBC_TRACE_CONTROL;
-+ mcp->mb[1] = ctrl;
-+ mcp->out_mb = MBX_1|MBX_0;
-+ mcp->in_mb = MBX_1|MBX_0;
-+ if (ctrl == TC_ENABLE) {
-+ mcp->mb[2] = LSW(eft_dma);
-+ mcp->mb[3] = MSW(eft_dma);
-+ mcp->mb[4] = LSW(MSD(eft_dma));
-+ mcp->mb[5] = MSW(MSD(eft_dma));
-+ mcp->mb[6] = buffers;
-+ mcp->mb[7] = buffers;
-+ mcp->out_mb |= MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2;
-+ }
-+ mcp->tov = 30;
-+ mcp->flags = 0;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-+ __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
-+ } else {
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
-+ }
-+
-+ return rval;
-+}
-+
-+int
-+qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr,
-+ uint16_t off, uint16_t count)
-+{
-+ int rval;
-+ mbx_cmd_t mc;
-+ mbx_cmd_t *mcp = &mc;
-+
-+ if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
-+ return QLA_FUNCTION_FAILED;
-+
-+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-+
-+ mcp->mb[0] = MBC_READ_SFP;
-+ mcp->mb[1] = addr;
-+ mcp->mb[2] = MSW(sfp_dma);
-+ mcp->mb[3] = LSW(sfp_dma);
-+ mcp->mb[6] = MSW(MSD(sfp_dma));
-+ mcp->mb[7] = LSW(MSD(sfp_dma));
-+ mcp->mb[8] = count;
-+ mcp->mb[9] = off;
-+ mcp->mb[10] = 0;
-+ mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-+ mcp->in_mb = MBX_0;
-+ mcp->tov = 30;
-+ mcp->flags = 0;
-+ rval = qla2x00_mailbox_command(ha, mcp);
-+
-+ if (rval != QLA_SUCCESS) {
-+ DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
-+ ha->host_no, rval, mcp->mb[0]));
-+ } else {
-+ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
-+ }
-+
-+ return rval;
-+}
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_opts.h ./drivers/scsi/qla2xxx/qla_opts.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_opts.h 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_opts.h 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,186 @@
-+/* qla_opts.h
-+ *
-+ * Persistent binding structures.
-+ *
-+ * Original copyright notice below:
-+ *
-+ */
-+
-+/*
-+ * Include file for defining configuration variables.
-+ *
-+ * Configuration variables are pairs of strings, similar to getenv.
-+ * Using this file allows the configuration information in the actual
-+ * executable file to be modified later by running the configprog program.
-+ * This avoids having to rebuild the program in order to change the
-+ * default string values such as path names, which can be very useful.
-+ *
-+ * Configuration variable names which do not begin with a period are
-+ * also looked up using getenv, so that the user can override these
-+ * default values.
-+ *
-+ * Configuration variable names beginning with a period cannot be
-+ * overridden by getenv and thus are good for critical definitions.
-+ * The maximum configuration variable name size is 16 characters.
-+ * The maximum configuration variable value size is set at compile time
-+ * by CONFIG_SIZE. But when running configprog, some of the
-+ * configuration variable values can be made longer since all config
-+ * variables share the same buffer.
-+ *
-+ * There can be multiple configuration tables within one executable.
-+ * Each one is identified by a unique table name. This allows each
-+ * library used within a program to have its own configuration table.
-+ * The main program itself uses a table name of "main".
-+ *
-+ * This file includes <stdlib.h> in order to define getenv.
-+ *
-+ * Copyright (c) 2003 by David I. Bell
-+ * Permission is granted to copy, distribute, modify, and use this source
-+ * file provided that this copyright notice remains intact.
-+ */
-+
-+#ifndef QLA_OPTS_H
-+#define QLA_OPTS_H
-+
-+
-+/*
-+ * The version of the configuration program that handles us.
-+ */
-+#define CONFIG_VERSION "QLA_OPTS 2.0"
-+
-+
-+#ifndef __KERNEL__
-+/*
-+ * We need the definition of getenv.
-+ */
-+#include <stdlib.h>
-+#endif
-+
-+/*
-+ * The maximum size of a configuration variable value at compile time.
-+ * This can be changed by defining CONFIG_SIZE before including this file.
-+ * For backward compatibility with the configuration utilities the maximum
-+ * working value is 10 times of the value provided in the first distribution
-+ * -- 300000.
-+ */
-+#ifndef CONFIG_SIZE
-+#define CONFIG_SIZE 300000
-+#endif
-+
-+
-+/*
-+ * The maximum size of a configuration variable name.
-+ * This must not be changed since configprog can't handle multiple sizes.
-+ */
-+#define CONFIG_NAME_SIZE 16
-+
-+#define SHORT_ENT_SIZE 40
-+#define CFG_ITEM_SIZE CONFIG_SIZE
-+
-+/*
-+ * One entry in the configuration variable table.
-+ * At compile time all entries must be the same size since they are defined
-+ * in an array. But the configprog program is able to shuffle the elements
-+ * around, so later on the entries will have different sizes (the 'value'
-+ * field can change size).
-+ */
-+typedef struct _config_s_entry_
-+{
-+ char name[CONFIG_NAME_SIZE]; /* name of configuration variable */
-+ int next; /* offset to next entry */
-+ int reserved;
-+ char value[SHORT_ENT_SIZE]; /* value of begin/end entries */
-+} config_s_entry_t;
-+
-+typedef struct _config_entry_
-+{
-+ char name[CONFIG_NAME_SIZE]; /* name of configuration variable */
-+ int next; /* offset to next entry */
-+ int reserved;
-+ char value[CFG_ITEM_SIZE]; /* value of configuration variable */
-+} config_entry_t;
-+
-+typedef config_entry_t config_l_entry_t;
-+
-+typedef struct _config_table_def_
-+{
-+ config_s_entry_t name_st;
-+ config_s_entry_t id_st;
-+ config_l_entry_t item1_st;
-+ config_s_entry_t end_st;
-+} config_table_def_t;
-+
-+/*
-+ * Special strings used to begin and end the configuration table.
-+ * These are obscure so that there is minimal chance that random data
-+ * in the executable will match these.
-+ */
-+#define CONFIG_NAME_MAGIC "\007<CoNfIg\007NaMe>\007"
-+#define CONFIG_VALUE_MAGIC "\007<cOnFiG\007vAlUe>\007"
-+#define CONFIG_ID_MAGIC "\007<cOnFiG\007iD>\007"
-+#define CONFIG_END_NAME "\007<EnD\007cOnFiG>\007"
-+
-+#define NAME_SIZE sizeof(CONFIG_NAME_MAGIC)
-+#define ID_SIZE sizeof(CONFIG_ID_MAGIC)
-+
-+
-+/*
-+ * Macros to build the configuration table.
-+ * CONFIG_BEGIN begins the named configuration table
-+ * CONFIG_ITEM defines one configuration variable
-+ * CONFIG_END ends the configuration table
-+ */
-+#define CONFIG_BEGIN(id) \
-+ static config_table_def_t _config_table_ = \
-+ { \
-+ { \
-+ CONFIG_NAME_MAGIC, sizeof(config_s_entry_t), \
-+ 0, CONFIG_VALUE_MAGIC \
-+ }, \
-+ { \
-+ CONFIG_ID_MAGIC, sizeof(config_s_entry_t), \
-+ 0, (id) \
-+ },
-+
-+#define CONFIG_ITEM(name, value) \
-+ { \
-+ (name), sizeof(config_l_entry_t), \
-+ 0, (value) \
-+ },
-+
-+#define CONFIG_END \
-+ { \
-+ CONFIG_END_NAME, 0, 0, "" \
-+ } \
-+ };
-+
-+/*
-+ * Macro to do the configuration.
-+ * This must be executed for each file which defines a configuration table.
-+ * If a valid config item is found, it sets the specified pointer to the
-+ * specified value. Note: the supposedly useless do statement
-+ * makes this macro usable in an IF THEN ELSE statement.
-+ */
-+#define QLOPTS_CONFIGURE(qla_persistent_str) \
-+ do { \
-+ config_entry_t *_config_ep_; \
-+ _config_ep_ = (config_entry_t *)&_config_table_; \
-+ for (;;) { \
-+ _config_ep_ = (config_entry_t *) \
-+ (((char *) _config_ep_) + _config_ep_->next); \
-+ if (_config_ep_->next == 0) \
-+ break; \
-+ if (memcmp(_config_ep_->name, CONFIG_NAME_MAGIC,\
-+ NAME_SIZE) == 0 || \
-+ memcmp(_config_ep_->name, CONFIG_ID_MAGIC,\
-+ ID_SIZE) == 0)\
-+ continue; \
-+ qla_persistent_str = _config_ep_->value; \
-+ if (_config_ep_->value[0] == '\0') \
-+ memset(_config_ep_->value, '\0', CFG_ITEM_SIZE); \
-+ } \
-+ } while (0)
-+
-+#endif
-+
-+/* END CODE */
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_os.c ./drivers/scsi/qla2xxx/qla_os.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_os.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_os.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,37 +1,24 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
--#include <linux/version.h>
- #include <linux/moduleparam.h>
- #include <linux/vmalloc.h>
- #include <linux/smp_lock.h>
--#include <linux/delay.h>
-
- #include <scsi/scsi_tcq.h>
- #include <scsi/scsicam.h>
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
- #include <scsi/scsi_transport.h>
- #include <scsi/scsi_transport_fc.h>
-+#endif
-
--static int qla2xxx_dump_sanity_check(struct scsi_device *sdev);
--static int qla2xxx_dump_quiesce(struct scsi_device *sdev);
--static void qla2xxx_dump_poll(struct scsi_device *sdev);
-+#include <linux/delay.h>
-
- /*
- * Driver version
-@@ -74,7 +61,11 @@ MODULE_PARM_DESC(qlport_down_retry,
- "Maximum number of command retries to a port that returns"
- "a PORT-DOWN status.");
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int ql2xretrycount = 80;
-+#else
- int ql2xretrycount = 20;
-+#endif
- module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR);
- MODULE_PARM_DESC(ql2xretrycount,
- "Maximum number of mid-layer retries allowed for a command. "
-@@ -148,6 +139,15 @@ MODULE_PARM_DESC(ql2xprocessrscn,
- "Option to enable port RSCN handling via a series of less"
- "fabric intrusive ADISCs and PLOGIs.");
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int ql2xioctltimeout = QLA_PT_CMD_TOV;
-+module_param(ql2xioctltimeout, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql2xioctltimeout,
-+ "IOCTL timeout value in seconds for pass-thur commands. "
-+ "Default is 66 seconds.");
-+
-+char *ql2xdevconf;
-+#endif
-
- int extended_error_logging;
- module_param(extended_error_logging, int, S_IRUGO|S_IRUSR);
-@@ -171,16 +171,12 @@ MODULE_PARM_DESC(ql2xfdmienable,
- "Enables FDMI registratons "
- "Default is 0 - no FDMI. 1 - perfom FDMI.");
-
--/*
-- * List of host adapters
-- */
--LIST_HEAD(qla_hostlist);
--rwlock_t qla_hostlist_lock = RW_LOCK_UNLOCKED;
--
--struct list_head *qla2xxx_hostlist_ptr = &qla_hostlist;
--rwlock_t *qla2xxx_hostlist_lock_ptr = &qla_hostlist_lock;
--EXPORT_SYMBOL_GPL(qla2xxx_hostlist_ptr);
--EXPORT_SYMBOL_GPL(qla2xxx_hostlist_lock_ptr);
-+int ql2xallocfwdump = 1;
-+module_param(ql2xallocfwdump, int, S_IRUGO|S_IRUSR);
-+MODULE_PARM_DESC(ql2xallocfwdump,
-+ "Option to enable allocation of memory for a firmware dump "
-+ "during HBA initialization. Memory allocation requirements "
-+ "vary by ISP type. Default is 1 - allocate memory.");
-
- /*
- * Proc structures and functions
-@@ -195,6 +191,13 @@ struct info_str {
- static void copy_mem_info(struct info_str *, char *, int);
- static int copy_info(struct info_str *, char *, ...);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * List of host adapters
-+ */
-+LIST_HEAD(qla_hostlist);
-+rwlock_t qla_hostlist_lock = RW_LOCK_UNLOCKED;
-+#endif
- static void qla2x00_free_device(scsi_qla_host_t *);
-
- static int qla2x00_config_dma_addressing(scsi_qla_host_t *ha);
-@@ -203,8 +206,12 @@ static int qla2x00_config_dma_addressing
- * SCSI host template entry points
- */
- static int qla2xxx_slave_configure(struct scsi_device * device);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+void qla2x00_ioctl_error_recovery(scsi_qla_host_t *);
-+#else
- static int qla2x00_queuecommand(struct scsi_cmnd *cmd,
- void (*fn)(struct scsi_cmnd *));
-+#endif
- static int qla2xxx_eh_abort(struct scsi_cmnd *);
- static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
- static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
-@@ -214,6 +221,8 @@ static int qla2x00_device_reset(scsi_qla
-
- static int qla2x00_proc_info(struct Scsi_Host *, char *, char **,
- off_t, int, int);
-+
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
- static ssize_t qla2xxx_store_queue_depth(struct device *, const char *, size_t);
-
- static struct device_attribute qla2xxx_queue_depth_attr = {
-@@ -228,6 +237,7 @@ static struct device_attribute *qla2xxx_
- &qla2xxx_queue_depth_attr,
- NULL,
- };
-+#endif
-
- static struct scsi_host_template qla2x00_driver_template = {
- .module = THIS_MODULE,
-@@ -243,6 +253,9 @@ static struct scsi_host_template qla2x00
-
- .slave_configure = qla2xxx_slave_configure,
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ .ioctl = qla2x00_ioctl,
-+#endif
- .this_id = -1,
- .cmd_per_lun = 3,
- .use_clustering = ENABLE_CLUSTERING,
-@@ -254,17 +267,23 @@ static struct scsi_host_template qla2x00
- */
- .max_sectors = 0xFFFF,
-
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
- .sdev_attrs = qla2xxx_dev_attrs,
--
-- .dump_sanity_check = qla2xxx_dump_sanity_check,
-- .dump_quiesce = qla2xxx_dump_quiesce,
-- .dump_poll = qla2xxx_dump_poll,
-+#endif
- };
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
- static struct scsi_transport_template *qla2xxx_transport_template = NULL;
-+#endif
-
- static void qla2x00_display_fc_names(scsi_qla_host_t *);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+void qla23xx_blink_led(scsi_qla_host_t *);
-+static void qla23xx_stop_beacon(scsi_qla_host_t *);
-+static void qla24xx_stop_beacon(scsi_qla_host_t *);
-+#endif
- /* TODO Convert to inlines
- *
- * Timer routines
-@@ -322,7 +341,7 @@ qla2x00_delete_from_done_queue(scsi_qla_
- * Note:From failover point of view we always get the sp
- * from vis_ha pool in queuecommand.So when we put it
- * back to the pool it has to be the vis_ha.
--* So rely on struct scsi_cmnd to get the vis_ha and not on sp.
-+* So rely on struct scsi_cmnd to get the vis_ha and not on sp.
- */
- static inline void
- qla2x00_callback(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-@@ -340,7 +359,6 @@ qla2x00_callback(scsi_qla_host_t *ha, st
- qla_printk(KERN_INFO, ha,
- "%s(): **** CMD derives a NULL SP\n",
- __func__);
-- DEBUG2(BUG();)
- return;
- }
-
-@@ -402,7 +420,8 @@ sp_put(struct scsi_qla_host * ha, srb_t
- qla_printk(KERN_INFO, ha,
- "%s(): **** SP->ref_count not zero\n",
- __func__);
-- DEBUG2(BUG();)
-+printk("%s SP->ref_count zero\n", __func__);
-+ DEBUG2(BUG());
-
- return;
- }
-@@ -435,7 +454,7 @@ sp_get(struct scsi_qla_host * ha, srb_t
- qla_printk(KERN_INFO, ha,
- "%s(): **** SP->ref_count greater than two\n",
- __func__);
-- DEBUG2(BUG();)
-+ DEBUG2(BUG());
-
- return;
- }
-@@ -465,7 +484,6 @@ qla2x00_delete_from_done_queue(scsi_qla_
- }
-
- static int qla2x00_do_dpc(void *data);
--static int __qla2x00_do_dpc(scsi_qla_host_t *ha);
-
- static void qla2x00_rst_aen(scsi_qla_host_t *);
-
-@@ -473,189 +491,42 @@ static uint8_t qla2x00_mem_alloc(scsi_ql
- static void qla2x00_mem_free(scsi_qla_host_t *ha);
- static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha);
- static void qla2x00_free_sp_pool(scsi_qla_host_t *ha);
-+#ifndef CONFIG_SCSI_QLA2XXX_FAILOVER
- static srb_t *qla2x00_get_new_sp(scsi_qla_host_t *ha);
-+#endif
-
--static ssize_t qla2x00_sysfs_read_fw_dump(struct kobject *, char *, loff_t,
-- size_t);
--static ssize_t qla2x00_sysfs_write_fw_dump(struct kobject *, char *, loff_t,
-- size_t);
--static struct bin_attribute sysfs_fw_dump_attr = {
-- .attr = {
-- .name = "fw_dump",
-- .mode = S_IRUSR | S_IWUSR,
-- .owner = THIS_MODULE,
-- },
-- .size = 0,
-- .read = qla2x00_sysfs_read_fw_dump,
-- .write = qla2x00_sysfs_write_fw_dump,
--};
--static ssize_t qla2x00_sysfs_read_nvram(struct kobject *, char *, loff_t,
-- size_t);
--static ssize_t qla2x00_sysfs_write_nvram(struct kobject *, char *, loff_t,
-- size_t);
--static struct bin_attribute sysfs_nvram_attr = {
-- .attr = {
-- .name = "nvram",
-- .mode = S_IRUSR | S_IWUSR,
-- .owner = THIS_MODULE,
-- },
-- .size = 0,
-- .read = qla2x00_sysfs_read_nvram,
-- .write = qla2x00_sysfs_write_nvram,
--};
--
--/* -------------------------------------------------------------------------- */
--
--
--/* SysFS attributes. */
--static ssize_t qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf,
-- loff_t off, size_t count)
--{
-- struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-- struct device, kobj)));
--
-- if (ha->fw_dump_reading == 0)
-- return 0;
-- if (off > ha->fw_dump_buffer_len)
-- return 0;
-- if (off + count > ha->fw_dump_buffer_len)
-- count = ha->fw_dump_buffer_len - off;
--
-- memcpy(buf, &ha->fw_dump_buffer[off], count);
--
-- return (count);
--}
--
--static ssize_t qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf,
-- loff_t off, size_t count)
--{
-- struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-- struct device, kobj)));
-- int reading;
-- uint32_t dump_size;
--
-- if (off != 0)
-- return (0);
--
-- reading = simple_strtol(buf, NULL, 10);
-- switch (reading) {
-- case 0:
-- if (ha->fw_dump_reading == 1) {
-- qla_printk(KERN_INFO, ha,
-- "Firmware dump cleared on (%ld).\n",
-- ha->host_no);
--
-- vfree(ha->fw_dump_buffer);
-- if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
-- free_pages((unsigned long)ha->fw_dump,
-- ha->fw_dump_order);
-- ha->fw_dump_reading = 0;
-- ha->fw_dump_buffer = NULL;
-- ha->fw_dump = NULL;
-- ha->fw_dumped = 0;
-- }
-- break;
-- case 1:
-- if ((ha->fw_dump || ha->fw_dumped) && !ha->fw_dump_reading) {
-- ha->fw_dump_reading = 1;
--
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- dump_size = FW_DUMP_SIZE_24XX;
-- else {
-- dump_size = FW_DUMP_SIZE_1M;
-- if (ha->fw_memory_size < 0x20000)
-- dump_size = FW_DUMP_SIZE_128K;
-- else if (ha->fw_memory_size < 0x80000)
-- dump_size = FW_DUMP_SIZE_512K;
-- }
-- ha->fw_dump_buffer = (char *)vmalloc(dump_size);
-- if (ha->fw_dump_buffer == NULL) {
-- qla_printk(KERN_WARNING, ha,
-- "Unable to allocate memory for firmware "
-- "dump buffer (%d).\n", dump_size);
--
-- ha->fw_dump_reading = 0;
-- return (count);
-- }
-- qla_printk(KERN_INFO, ha,
-- "Firmware dump ready for read on (%ld).\n",
-- ha->host_no);
-- memset(ha->fw_dump_buffer, 0, dump_size);
-- if (IS_QLA2100(ha) || IS_QLA2200(ha))
-- qla2100_ascii_fw_dump(ha);
-- else if (IS_QLA23XX(ha))
-- qla2300_ascii_fw_dump(ha);
-- else if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-- qla24xx_ascii_fw_dump(ha);
-- ha->fw_dump_buffer_len = strlen(ha->fw_dump_buffer);
-- }
-- break;
-- }
-- return (count);
--}
--
--static ssize_t qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf,
-- loff_t off, size_t count)
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int
-+qla2x00_set_info(char *buffer, int length, struct Scsi_Host *shost)
- {
-- struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-- struct device, kobj)));
-- unsigned long flags;
--
-- if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
-- return 0;
--
-- /* Read NVRAM. */
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- qla2x00_read_nvram_data(ha, (uint8_t *)buf, ha->nvram_base,
-- ha->nvram_size);
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+ scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-
-- return (count);
--}
-+ if (length < 12 || strncmp("scsi-qla", buffer, 8))
-+ goto out;
-
--static ssize_t qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf,
-- loff_t off, size_t count)
--{
-- struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
-- struct device, kobj)));
-- unsigned long flags;
-- uint16_t cnt;
-+ ha = (scsi_qla_host_t *) shost->hostdata;
-
-- if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
-- return 0;
-+ if (!strncmp("scan", buffer + 8, 4)) {
-+ qla_printk(KERN_INFO, ha,
-+ "Scheduling rescan for new luns...\n");
-
-- /* Checksum NVRAM. */
-- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-- uint32_t *iter;
-- uint32_t chksum;
-+ list_for_each_entry(fcport, &ha->fcports, list)
-+ if (fcport->port_type == FCT_TARGET)
-+ fcport->flags |= FC_RESCAN_NEEDED;
-
-- iter = (uint32_t *)buf;
-- chksum = 0;
-- for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
-- chksum += le32_to_cpu(*iter++);
-- chksum = ~chksum + 1;
-- *iter = cpu_to_le32(chksum);
-- } else {
-- uint8_t *iter;
-- uint8_t chksum;
-+ set_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags);
-+ } else if (!strncmp("lip", buffer + 8, 3)) {
-+ qla_printk(KERN_INFO, ha, "Scheduling LIP...\n");
-
-- iter = (uint8_t *)buf;
-- chksum = 0;
-- for (cnt = 0; cnt < count - 1; cnt++)
-- chksum += *iter++;
-- chksum = ~chksum + 1;
-- *iter = chksum;
-+ set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
- }
-
-- /* Write NVRAM. */
-- spin_lock_irqsave(&ha->hardware_lock, flags);
-- qla2x00_write_nvram_data(ha, (uint8_t *)buf, ha->nvram_base, count);
-- spin_unlock_irqrestore(&ha->hardware_lock, flags);
--
-- return (count);
-+out:
-+ return (length);
- }
-+#endif
-
--/* -------------------------------------------------------------------------- */
- static char *
- qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str)
- {
-@@ -785,7 +656,11 @@ qla2x00_get_fw_version_str(struct scsi_q
- * interrupt handler may call this routine as part of request-completion
- * handling).
- **************************************************************************/
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int
-+#else
- static int
-+#endif
- qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
- {
- fc_port_t *fcport;
-@@ -802,7 +677,7 @@ qla2x00_queuecommand(struct scsi_cmnd *c
-
- cmd->scsi_done = fn;
-
-- spin_unlock_irq_dump(ha->host->host_lock);
-+ spin_unlock_irq(ha->host->host_lock);
-
- /*
- * Allocate a command packet from the "sp" pool. If we cant get back
-@@ -864,8 +739,10 @@ qla2x00_queuecommand(struct scsi_cmnd *c
- lq = NULL;
- }
- } else {
-- fcport = lq->fclun->fcport;
-- ha2 = fcport->ha;
-+ if (lq->fclun && lq->fclun->fcport) {
-+ fcport = lq->fclun->fcport;
-+ ha2 = fcport->ha;
-+ }
- }
- }
-
-@@ -907,7 +784,7 @@ qla2x00_queuecommand(struct scsi_cmnd *c
- }
-
- /* Only modify the allowed count if the target is a *non* tape device */
-- if ((fcport->flags & FCF_TAPE_PRESENT) == 0) {
-+ if ((fcport->flags & FC_TAPE_PRESENT) == 0) {
- sp->flags &= ~SRB_TAPE;
- if (cmd->allowed < ql2xretrycount) {
- cmd->allowed = ql2xretrycount;
-@@ -956,6 +833,20 @@ qla2x00_queuecommand(struct scsi_cmnd *c
- spin_lock_irq(ha->host->host_lock);
- return (0);
- }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Ignore SPINUP commands for MSA1000 and EVA. */
-+ if ((fcport->flags & (FC_MSA_DEVICE | FC_EVA_DEVICE)) &&
-+ cmd->cmnd[0] == START_STOP) {
-+ DEBUG2(printk(KERN_INFO
-+ "%s(): Ignoring START_STOP scsi command...\n ", __func__));
-+ cmd->result = DID_OK << 16;
-+ add_to_done_queue(ha, sp);
-+ qla2x00_done(ha);
-+
-+ spin_lock_irq(ha->host->host_lock);
-+ return (0);
-+ }
-+#endif
-
- if (tq && test_bit(TQF_SUSPENDED, &tq->flags) &&
- (sp->flags & SRB_TAPE) == 0) {
-@@ -1023,12 +914,19 @@ qla2x00_eh_wait_on_command(scsi_qla_host
- if (cmd == rp->cmd) {
- found++;
- DEBUG3(printk("%s: found in done queue.\n",
-- __func__);)
-+ __func__));
- break;
- }
- }
- spin_unlock_irqrestore(&ha->list_lock, flags);
-
-+ /* Checking to see if its returned to OS */
-+ rp = (srb_t *) CMD_SP(cmd);
-+ if (rp == NULL) {
-+ done++;
-+ break;
-+ }
-+
- /* Complete the cmd right away. */
- if (found) {
- qla2x00_delete_from_done_queue(ha, rp);
-@@ -1064,7 +962,11 @@ qla2x00_eh_wait_on_command(scsi_qla_host
- * Success (Adapter is online) : 0
- * Failed (Adapter is offline/disabled) : 1
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+int
-+#else
- static int
-+#endif
- qla2x00_wait_for_hba_online(scsi_qla_host_t *ha)
- {
- int return_status;
-@@ -1076,7 +978,8 @@ qla2x00_wait_for_hba_online(scsi_qla_hos
- test_bit(ISP_ABORT_RETRY, &ha->dpc_flags) ||
- ha->dpc_active) && time_before(jiffies, wait_online)) {
-
-- msleep(1000);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ);
- }
- if (ha->flags.online)
- return_status = QLA_SUCCESS;
-@@ -1163,7 +1066,12 @@ qla2x00_wait_for_loop_ready(scsi_qla_hos
- atomic_read(&ha->loop_state) == LOOP_DOWN) ||
- test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
- atomic_read(&ha->loop_state) != LOOP_READY) {
-- msleep(1000);
-+ if (atomic_read(&ha->loop_state) == LOOP_DEAD) {
-+ return_status = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ);
- if (time_after_eq(jiffies, loop_timeout)) {
- return_status = QLA_FUNCTION_FAILED;
- break;
-@@ -1212,17 +1120,25 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- if ((sp == NULL)) {
- /* no action - we don't have command */
- qla_printk(KERN_INFO, to_qla_host(cmd->device->host),
-- "qla2xxx_eh_abort: cmd already done sp=%p\n", sp);
-- DEBUG(printk("qla2xxx_eh_abort: cmd already done sp=%p\n", sp);)
-+ "qla2xxx_eh_abort: cmd already done sp=%p "
-+ "timeout=0x%x\n", sp, cmd->timeout_per_command / HZ);
-+ DEBUG(printk("qla2xxx_eh_abort: cmd already done sp=%p\n", sp));
- return SUCCESS;
- }
- if (sp) {
- DEBUG(printk("qla2xxx_eh_abort: refcount %i \n",
-- atomic_read(&sp->ref_count));)
-+ atomic_read(&sp->ref_count)));
- }
-
- vis_ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(vis_ha))
-+ ha = (scsi_qla_host_t *)sp->ha;
-+ else
-+ ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
-+#else
- ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
-+#endif
-
- /* Generate LU queue on bus, target, LUN */
- b = cmd->device->channel;
-@@ -1252,10 +1168,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- ha->dpc_flags, vis_ha->dpc_flags, q->q_flag));
- DEBUG2(qla2x00_print_scsi_cmd(cmd));
-
-- spin_unlock_irq_dump(vis_ha->host->host_lock);
-+ spin_unlock_irq(vis_ha->host->host_lock);
-
- if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
-- DEBUG2(printk("%s failed:board disabled\n", __func__);)
-+ DEBUG2(printk("%s failed:board disabled\n", __func__));
- goto eh_abort_complete;
- }
-
-@@ -1295,7 +1211,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- * See if this command is in the retry queue
- */
- DEBUG3(printk("qla2xxx_eh_abort: searching sp %p in retry "
-- "queue.\n", sp);)
-+ "queue.\n", sp));
-
- spin_lock_irqsave(&ha->list_lock, flags);
- list_for_each_safe(list, temp, &ha->retry_queue) {
-@@ -1306,7 +1222,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
-
-
- DEBUG2(printk("qla2xxx_eh_abort: found "
-- "in retry queue. SP=%p\n", sp);)
-+ "in retry queue. SP=%p\n", sp));
-
- __del_from_retry_queue(ha, rp);
- cmd->result = DID_ABORT << 16;
-@@ -1320,6 +1236,17 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- }
- spin_unlock_irqrestore(&ha->list_lock, flags);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /*
-+ * Search failover queue
-+ */
-+ if (qla2x00_failover_enabled(ha)) {
-+ if (!found && qla2x00_search_failover_queue(ha, cmd)) {
-+ return_status = SUCCESS;
-+ found++;
-+ }
-+ }
-+#endif
-
- /*
- * Our SP pointer points at the command we want to remove from the
-@@ -1327,7 +1254,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- */
- if (!found) {
- DEBUG3(printk("qla2xxx_eh_abort: searching sp %p "
-- "in pending queue.\n", sp);)
-+ "in pending queue.\n", sp));
-
- spin_lock_irqsave(&vis_ha->list_lock, flags);
- list_for_each_safe(list, temp, &vis_ha->pending_queue) {
-@@ -1341,7 +1268,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
-
- DEBUG2(printk("qla2xxx_eh_abort: Cmd in pending queue."
- " serial_number %ld.\n",
-- sp->cmd->serial_number);)
-+ sp->cmd->serial_number));
-
- __del_from_pending_queue(vis_ha, rp);
- cmd->result = DID_ABORT << 16;
-@@ -1358,7 +1285,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
-
- if (!found) { /* find the command in our active list */
- DEBUG3(printk("qla2xxx_eh_abort: searching sp %p "
-- "in outstanding queue.\n", sp);)
-+ "in outstanding queue.\n", sp));
-
- spin_lock_irqsave(&ha->hardware_lock, flags);
- for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
-@@ -1373,7 +1300,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
- DEBUG2(printk("qla2xxx_eh_abort(%ld): aborting sp %p "
- "from RISC. pid=%ld sp->state=%x q->q_flag=%lx\n",
- ha->host_no, sp, sp->cmd->serial_number,
-- sp->state, q->q_flag);)
-+ sp->state, q->q_flag));
-
- /* Get a reference to the sp and drop the lock.*/
- sp_get(ha, sp);
-@@ -1382,11 +1309,11 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
-
- if (qla2x00_abort_command(ha, sp)) {
- DEBUG2(printk("qla2xxx_eh_abort: abort_command "
-- "mbx failed.\n");)
-+ "mbx failed.\n"));
- return_status = FAILED;
- } else {
- DEBUG3(printk("qla2xxx_eh_abort: abort_command "
-- " mbx success.\n");)
-+ " mbx success.\n"));
- return_status = SUCCESS;
- }
-
-@@ -1407,7 +1334,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
-
- /* Waiting for our command in done_queue to be returned to OS.*/
- if (qla2x00_eh_wait_on_command(ha, cmd) != 0) {
-- DEBUG2(printk("qla2xxx_eh_abort: cmd returned back to OS.\n");)
-+ DEBUG2(printk("qla2xxx_eh_abort: cmd returned back to OS.\n"));
- return_status = SUCCESS;
- }
-
-@@ -1472,7 +1399,6 @@ qla2x00_eh_wait_for_pending_target_comma
- return (status);
- }
-
--
- /**************************************************************************
- * qla2xxx_eh_device_reset
- *
-@@ -1543,11 +1469,11 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
-
- DEBUG2(printk(KERN_INFO
- "scsi(%ld): DEVICE_RESET cmd=%p jiffies = 0x%lx, timeout=%x, "
-- "dpc_flags=%lx, status=%x allowed=%d cmd.state=%x\n",
-+ "dpc_flags=%lx, status=%x allowed=%d.\n",
- ha->host_no, cmd, jiffies, cmd->timeout_per_command / HZ,
-- ha->dpc_flags, cmd->result, cmd->allowed, cmd->state));
-+ ha->dpc_flags, cmd->result, cmd->allowed));
-
-- spin_unlock_irq_dump(vis_ha->host->host_lock);
-+ spin_unlock_irq(vis_ha->host->host_lock);
-
- /* Clear commands from the retry queue. */
- spin_lock_irqsave(&vis_ha->list_lock, flags);
-@@ -1591,7 +1517,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
- #endif
- } else {
- DEBUG2(printk(KERN_INFO
-- "%s failed: loop not ready\n",__func__);)
-+ "%s failed: loop not ready\n",__func__));
- }
-
- if (return_status == FAILED) {
-@@ -1607,7 +1533,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
- * If we are coming down the EH path, wait for all commands to
- * complete for the device.
- */
-- if (cmd->device->host->eh_active) {
-+ if (qla2x00_is_eh_active(cmd->device->host)) {
- if (qla2x00_eh_wait_for_pending_target_commands(ha, t))
- return_status = FAILED;
-
-@@ -1681,6 +1607,40 @@ qla2x00_eh_wait_for_pending_commands(scs
- return (status);
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+scsi_qla_host_t *
-+qla2xxx_find_dest_hba(struct scsi_cmnd *cmd)
-+{
-+ os_tgt_t *tq;
-+ os_lun_t *lq;
-+ scsi_qla_host_t *vis_ha;
-+ scsi_qla_host_t *dest_ha = NULL;
-+ unsigned int t, l;
-+
-+ vis_ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
-+ t = cmd->device->id;
-+ l = cmd->device->lun;
-+
-+ tq = TGT_Q(vis_ha, t);
-+ if (tq == NULL) {
-+ qla_printk(KERN_INFO, vis_ha,
-+ "%s(): **** CMD derives a NULL TGT_Q\n", __func__);
-+
-+ return (dest_ha);
-+ }
-+ lq = (os_lun_t *)LUN_Q(vis_ha, t, l);
-+ if (lq == NULL) {
-+ printk(KERN_INFO
-+ "%s(): **** CMD derives a NULL LUN_Q\n", __func__);
-+
-+ return (dest_ha);
-+ }
-+ dest_ha = lq->fclun->fcport->ha;
-+
-+ return (dest_ha);
-+}
-+#endif
-+
-
- /**************************************************************************
- * qla2xxx_eh_bus_reset
-@@ -1704,12 +1664,26 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c
- (scsi_qla_host_t *)cmd->device->host->hostdata;
- scsi_qla_host_t *ha = vis_ha;
- int rval = FAILED;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ srb_t *sp = (srb_t *)CMD_SP(cmd);
-+
-+ /* Find actual ha */
-+ if (qla2x00_failover_enabled(vis_ha) &&
-+ qla2x00_is_eh_active(cmd->device->host)) {
-+ if (sp) {
-+ ha = sp->ha;
-+ } else {
-+ if ((ha = qla2xxx_find_dest_hba(cmd)) == NULL)
-+ return rval;
-+ }
-+ }
-+#endif
-
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d:%d): LOOP RESET ISSUED.\n", ha->host_no,
- cmd->device->channel, cmd->device->id, cmd->device->lun);
-
-- spin_unlock_irq_dump(vis_ha->host->host_lock);
-+ spin_unlock_irq(vis_ha->host->host_lock);
-
- if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
- DEBUG2(printk("%s failed:board disabled\n",__func__));
-@@ -1724,7 +1698,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c
- goto eh_bus_reset_done;
-
- /* Waiting for our command in done_queue to be returned to OS.*/
-- if (cmd->device->host->eh_active)
-+ if (qla2x00_is_eh_active(cmd->device->host))
- if (!qla2x00_eh_wait_for_pending_commands(ha))
- rval = FAILED;
-
-@@ -1757,6 +1731,20 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *
- scsi_qla_host_t *vis_ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
- scsi_qla_host_t *ha = vis_ha;
- int rval = SUCCESS;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ srb_t *sp = (srb_t *)CMD_SP(cmd);
-+
-+ /* Find actual ha */
-+ if (qla2x00_failover_enabled(vis_ha) &&
-+ qla2x00_is_eh_active(cmd->device->host)) {
-+ if (sp) {
-+ ha = sp->ha;
-+ } else {
-+ if ((ha = qla2xxx_find_dest_hba(cmd)) == NULL)
-+ return rval;
-+ }
-+ }
-+#endif
-
- /* Display which one we're actually resetting for debug. */
- DEBUG(printk("qla2xxx_eh_host_reset:Resetting scsi(%ld).\n",
-@@ -1769,7 +1757,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *
- "scsi(%ld:%d:%d:%d): ADAPTER RESET issued.\n", ha->host_no,
- cmd->device->channel, cmd->device->id, cmd->device->lun);
-
-- spin_unlock_irq_dump(vis_ha->host->host_lock);
-+ spin_unlock_irq(vis_ha->host->host_lock);
-
- if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
- rval = FAILED;
-@@ -1847,9 +1835,8 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
- continue;
-
- status = qla2x00_device_reset(ha, tq->fcport);
-- if (status != QLA_SUCCESS) {
-+ if (status != QLA_SUCCESS && status != QLA_PORT_LOGGED_OUT)
- break;
-- }
- }
- }
-
-@@ -1868,12 +1855,12 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
- /* Empty */
- DEBUG2_3(printk("%s(%ld): **** FAILED ****\n",
- __func__,
-- ha->host_no);)
-+ ha->host_no));
- } else {
- /* Empty */
- DEBUG3(printk("%s(%ld): exiting normally.\n",
- __func__,
-- ha->host_no);)
-+ ha->host_no));
- }
-
- return(status);
-@@ -1936,6 +1923,7 @@ qla2xxx_slave_configure(struct scsi_devi
- return (0);
- }
-
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
- static ssize_t
- qla2xxx_store_queue_depth(struct device *dev, const char *buf, size_t count)
- {
-@@ -1950,6 +1938,7 @@ qla2xxx_store_queue_depth(struct device
- }
- return count;
- }
-+#endif
-
- /**
- * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
-@@ -2065,6 +2054,22 @@ iospace_error_exit:
- return (-ENOMEM);
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+static int
-+qla2x00_count_hbas(void)
-+{
-+ int count = 0;
-+ scsi_qla_host_t *ha;
-+
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(ha, &qla_hostlist, list)
-+ count++;
-+ read_unlock(&qla_hostlist_lock);
-+
-+ return count;
-+}
-+#endif
-+
- /*
- * PCI driver interface
- */
-@@ -2170,9 +2175,6 @@ int qla2x00_probe_one(struct pci_dev *pd
- }
- host->can_queue = ha->request_q_length + 128;
-
-- /* load the F/W, read paramaters, and init the H/W */
-- ha->instance = num_hosts;
--
- init_MUTEX(&ha->mbx_cmd_sem);
- init_MUTEX_LOCKED(&ha->mbx_intr_sem);
-
-@@ -2182,6 +2184,9 @@ int qla2x00_probe_one(struct pci_dev *pd
- INIT_LIST_HEAD(&ha->done_queue);
- INIT_LIST_HEAD(&ha->retry_queue);
- INIT_LIST_HEAD(&ha->scsi_retry_queue);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ INIT_LIST_HEAD(&ha->failover_queue);
-+#endif
- INIT_LIST_HEAD(&ha->pending_queue);
-
- /*
-@@ -2197,7 +2202,22 @@ int qla2x00_probe_one(struct pci_dev *pd
- init_completion(&ha->dpc_inited);
- init_completion(&ha->dpc_exited);
-
--
-+ /* load the F/W, read paramaters, and init the H/W */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_count_hbas() == num_hosts) {
-+ ha->instance = num_hosts;
-+ } else {
-+ /* error */
-+ qla_printk(KERN_WARNING, ha,
-+ "scsi(%ld): qla2xxx - HBA instance mismatch!\n",
-+ ha->host_no);
-+
-+ goto probe_failed;
-+ }
-+#else
-+ ha->instance = num_hosts;
-+#endif
-+
- if (qla2x00_config_dma_addressing(ha)) {
- qla_printk(KERN_WARNING, ha,
- "[ERROR] Unable to set proper DMA mask\n");
-@@ -2243,8 +2263,11 @@ int qla2x00_probe_one(struct pci_dev *pd
- host->max_cmd_len = MAX_CMDSZ;
- host->max_channel = ha->ports - 1;
- host->max_lun = ha->max_luns;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
- BUG_ON(qla2xxx_transport_template == NULL);
- host->transportt = qla2xxx_transport_template;
-+#endif
- host->unique_id = ha->instance;
- host->max_id = ha->max_targets;
-
-@@ -2313,20 +2336,24 @@ int qla2x00_probe_one(struct pci_dev *pd
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
- }
-
-- strcpy(ha->driver_verstr, QLA2XXX_VERSION);
-- ha->driver_version[0] = QLA_DRIVER_MAJOR_VER;
-- ha->driver_version[1] = QLA_DRIVER_MINOR_VER;
-- ha->driver_version[2] = QLA_DRIVER_PATCH_VER;
-- ha->driver_version[3] = QLA_DRIVER_BETA_VER;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /*
-+ * if failover is enabled read the user configuration
-+ */
-+ if (qla2x00_failover_enabled(ha)) {
-+ if (ConfigRequired > 0)
-+ mp_config_required = 1;
-+ else
-+ mp_config_required = 0;
-+
-+ qla2x00_cfg_init(ha);
-+ }
-
- /* Insert new entry into the list of adapters */
- write_lock(&qla_hostlist_lock);
- list_add_tail(&ha->list, &qla_hostlist);
- write_unlock(&qla_hostlist_lock);
--
-- DEBUG(printk("qla2xxx: lock=%p listhead=%p, done adding ha list=%p.\n",
-- &qla_hostlist_lock, &qla_hostlist, &ha->list);)
--
-+#endif
- /* Enable chip interrupts. */
- qla2x00_enable_intrs(ha);
-
-@@ -2343,7 +2370,8 @@ int qla2x00_probe_one(struct pci_dev *pd
-
- qla2x00_check_fabric_devices(ha);
-
-- msleep(10);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/100);
- }
-
- pci_set_drvdata(pdev, ha);
-@@ -2352,15 +2380,27 @@ int qla2x00_probe_one(struct pci_dev *pd
-
- /* List the target we have found */
- if (displayConfig) {
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha)) {
-+ qla2x00_cfg_display_devices(displayConfig == 2);
-+ } else {
-+ qla2x00_display_fc_names(ha);
-+ }
-+#else
- qla2x00_display_fc_names(ha);
-+#endif
-+ }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha)) {
-+ /* remap any paths on other hbas */
-+ qla2x00_cfg_remap(ha);
- }
-+#endif
-
- if (scsi_add_host(host, &pdev->dev))
- goto probe_failed;
-
-- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
-- sysfs_nvram_attr.size = ha->nvram_size;
-- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
-+ qla2x00_alloc_sysfs_attr(ha);
-
- qla_printk(KERN_INFO, ha, "\n"
- " QLogic Fibre Channel HBA Driver: %s\n"
-@@ -2395,13 +2435,13 @@ void qla2x00_remove_one(struct pci_dev *
-
- ha = pci_get_drvdata(pdev);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
- write_lock(&qla_hostlist_lock);
- list_del(&ha->list);
- write_unlock(&qla_hostlist_lock);
-+#endif
-
-- sysfs_remove_bin_file(&ha->host->shost_gendev.kobj,
-- &sysfs_fw_dump_attr);
-- sysfs_remove_bin_file(&ha->host->shost_gendev.kobj, &sysfs_nvram_attr);
-+ qla2x00_free_sysfs_attr(ha);
-
- scsi_remove_host(ha->host);
-
-@@ -2422,6 +2462,16 @@ qla2x00_free_device(scsi_qla_host_t *ha)
- if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
- qla2x00_cancel_io_descriptors(ha);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (ha->beacon_blink_led) {
-+ /* In case someone left it on */
-+ if (IS_QLA23XX(ha))
-+ qla23xx_stop_beacon(ha);
-+ else if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ qla24xx_stop_beacon(ha);
-+ }
-+#endif
-+
- /* Disable timer */
- if (ha->timer_active)
- qla2x00_stop_timer(ha);
-@@ -2441,6 +2491,9 @@ qla2x00_free_device(scsi_qla_host_t *ha)
- }
- }
-
-+ if (ha->eft)
-+ qla2x00_trace_control(ha, TC_DISABLE, 0, 0);
-+
- /* Stop currently executing firmware. */
- qla2x00_stop_firmware(ha);
-
-@@ -2450,11 +2503,16 @@ qla2x00_free_device(scsi_qla_host_t *ha)
-
- qla2x00_mem_free(ha);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha))
-+ qla2x00_cfg_mem_free(ha);
-+#endif
-+
- ha->flags.online = 0;
-
- /* Detach interrupts */
-- if (ha->pdev->irq)
-- free_irq(ha->pdev->irq, ha);
-+ if (ha->host->irq)
-+ free_irq(ha->host->irq, ha);
-
- #ifdef ENABLE_MSI
- if (ha->flags.msi_enabled)
-@@ -2553,7 +2611,7 @@ qla2x00_proc_info(struct Scsi_Host *shos
-
- DEBUG3(printk(KERN_INFO
- "Entering proc_info buff_in=%p, offset=0x%lx, length=0x%x\n",
-- buffer, offset, length);)
-+ buffer, offset, length));
-
- ha = (scsi_qla_host_t *) shost->hostdata;
-
-@@ -2561,8 +2619,12 @@ qla2x00_proc_info(struct Scsi_Host *shos
- /* Has data been written to the file? */
- DEBUG3(printk(
- "%s: has data been written to the file. \n",
-- __func__);)
-+ __func__));
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ return qla2x00_set_info(buffer, length, shost);
-+#else
- return -ENOSYS;
-+#endif
- }
-
- if (start) {
-@@ -2635,6 +2697,13 @@ qla2x00_proc_info(struct Scsi_Host *shos
- ha->qthreads, ha->retry_q_cnt,
- ha->done_q_cnt, ha->scsi_retry_q_cnt);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha)) {
-+ copy_info(&info,
-+ "Number of reqs in failover_q= %d\n",
-+ ha->failover_cnt);
-+ }
-+#endif
-
- flags = (uint32_t *) &ha->flags;
-
-@@ -2710,7 +2779,8 @@ qla2x00_proc_info(struct Scsi_Host *shos
- tq->port_name[4], tq->port_name[5],
- tq->port_name[6], tq->port_name[7]);
- }
--
-+//#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+// if (qla2x00_failover_enabled(ha)) {
- if (1) {
- fc_port_t *fcport;
-
-@@ -2718,6 +2788,9 @@ qla2x00_proc_info(struct Scsi_Host *shos
- fcport = NULL;
- copy_info(&info, "\nFC Port Information:\n");
- list_for_each_entry(fcport, &ha->fcports, list) {
-+// if (fcport->port_type != FCT_TARGET)
-+// continue;
-+
- copy_info(&info,
- "scsi-qla%ld-port-%d="
- "%02x%02x%02x%02x%02x%02x%02x%02x:"
-@@ -2738,6 +2811,7 @@ qla2x00_proc_info(struct Scsi_Host *shos
- t++;
- }
- }
-+//#endif
-
- copy_info(&info, "\nSCSI LUN Information:\n");
- copy_info(&info,
-@@ -2802,7 +2876,7 @@ profile_stop:
-
- DEBUG3(printk(KERN_INFO
- "Exiting proc_info: info.pos=%d, offset=0x%lx, "
-- "length=0x%x\n", info.pos, offset, length);)
-+ "length=0x%x\n", info.pos, offset, length));
-
- return (retval);
- }
-@@ -3077,7 +3151,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - request_ring\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3090,7 +3165,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - response_ring\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3102,7 +3178,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - gid_list\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3114,7 +3191,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - rlc");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3127,7 +3205,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - s_dma_pool\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3140,7 +3219,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - init_cb\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3155,7 +3235,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - iodesc_pd\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3167,7 +3248,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - ioctl_mem\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3178,7 +3260,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "qla2x00_allocate_sp_pool()\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3195,7 +3278,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - sns_cmd\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3210,7 +3294,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - ms_iocb\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
-@@ -3229,13 +3314,56 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
- "Memory Allocation failed - ct_sns\n");
-
- qla2x00_mem_free(ha);
-- msleep(100);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-
- continue;
- }
- memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt));
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ /*
-+ * Get consistent memory allocated for SFP
-+ * block.
-+ */
-+ ha->sfp_data = dma_pool_alloc(ha->s_dma_pool,
-+ GFP_KERNEL, &ha->sfp_data_dma);
-+ if (ha->sfp_data == NULL) {
-+ qla_printk(KERN_WARNING, ha,
-+ "Memory Allocation failed - "
-+ "sfp_data\n");
-+
-+ qla2x00_mem_free(ha);
-+ msleep(100);
-+
-+ continue;
-+ }
-+ memset(ha->sfp_data, 0, SFP_BLOCK_SIZE);
-+ }
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-+ /* Get consistent memory allocated for SNS commands */
-+ ha->risc_rec_q = dma_alloc_coherent(&ha->pdev->dev,
-+ IP_BUFFER_QUEUE_DEPTH *
-+ sizeof(struct risc_rec_entry),
-+ &ha->risc_rec_q_dma, GFP_KERNEL);
-+ if (ha->risc_rec_q == NULL) {
-+ /* error */
-+ qla_printk(KERN_WARNING, ha,
-+ "Memory Allocation failed - risc_rec_q\n");
-+
-+ qla2x00_mem_free(ha);
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ/10);
-+
-+ continue;
-+ }
-+ memset(ha->risc_rec_q, 0, IP_BUFFER_QUEUE_DEPTH *
-+ sizeof(struct risc_rec_entry));
-+ }
-+#endif
- /* Done all allocations without any error. */
- status = 0;
-
-@@ -3290,6 +3418,20 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
- /* free sp pool */
- qla2x00_free_sp_pool(ha);
-
-+ if (ha->fw_dump) {
-+ if (ha->eft)
-+ dma_free_coherent(&ha->pdev->dev,
-+ ntohl(ha->fw_dump->eft_size), ha->eft, ha->eft_dma);
-+ vfree(ha->fw_dump);
-+ }
-+
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (ha->risc_rec_q)
-+ dma_free_coherent(&ha->pdev->dev, IP_BUFFER_QUEUE_DEPTH *
-+ sizeof(struct risc_rec_entry), ha->risc_rec_q,
-+ ha->risc_rec_q_dma);
-+#endif
-+
- if (ha->sns_cmd)
- dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt),
- ha->sns_cmd, ha->sns_cmd_dma);
-@@ -3298,6 +3440,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
- dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt),
- ha->ct_sns, ha->ct_sns_dma);
-
-+ if (ha->sfp_data)
-+ dma_pool_free(ha->s_dma_pool, ha->sfp_data, ha->sfp_data_dma);
-+
- if (ha->ms_iocb)
- dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
-
-@@ -3329,6 +3474,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
- (ha->request_q_length + 1) * sizeof(request_t),
- ha->request_ring, ha->request_dma);
-
-+ ha->eft = NULL;
-+ ha->eft_dma = 0;
- ha->sns_cmd = NULL;
- ha->sns_cmd_dma = 0;
- ha->ct_sns = NULL;
-@@ -3369,20 +3516,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
- }
- INIT_LIST_HEAD(&ha->fcports);
-
-- if (ha->fw_dump)
-- free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
--
-- if (ha->fw_dump24)
-- vfree(ha->fw_dump24);
--
-- if (ha->fw_dump_buffer)
-- vfree(ha->fw_dump_buffer);
--
- ha->fw_dump = NULL;
-- ha->fw_dump24 = NULL;
- ha->fw_dumped = 0;
- ha->fw_dump_reading = 0;
-- ha->fw_dump_buffer = NULL;
- }
-
- /*
-@@ -3444,6 +3580,17 @@ qla2x00_do_dpc(void *data)
- {
- DECLARE_MUTEX_LOCKED(sem);
- scsi_qla_host_t *ha;
-+ fc_port_t *fcport;
-+ os_lun_t *q;
-+ srb_t *sp;
-+ uint8_t status;
-+ unsigned long flags = 0;
-+ struct list_head *list, *templist;
-+ int dead_cnt, online_cnt;
-+ int retry_cmds = 0;
-+ uint16_t next_loopid;
-+ int t;
-+ os_tgt_t *tq;
-
- ha = (scsi_qla_host_t *)data;
-
-@@ -3477,43 +3624,6 @@ qla2x00_do_dpc(void *data)
-
- DEBUG3(printk("scsi(%ld): DPC handler\n", ha->host_no));
-
-- /* do dpc core part*/
-- __qla2x00_do_dpc(ha);
-- }
--
-- DEBUG(printk("scsi(%ld): DPC handler exiting\n", ha->host_no));
--
-- /*
-- * Make sure that nobody tries to wake us up again.
-- */
-- ha->dpc_wait = NULL;
-- ha->dpc_active = 0;
--
-- complete_and_exit(&ha->dpc_exited, 0);
--}
--
--/*
-- * dpc common part
-- * This is called from
-- * - qla2x00_do_dpc(),
-- * - qla2xxx_dump_poll().
-- */
--static int
--__qla2x00_do_dpc(scsi_qla_host_t *ha)
--{
-- fc_port_t *fcport;
-- os_lun_t *q;
-- srb_t *sp;
-- uint8_t status;
-- unsigned long flags = 0;
-- struct list_head *list, *templist;
-- int dead_cnt, online_cnt;
-- int retry_cmds = 0;
-- uint16_t next_loopid;
-- int t;
-- os_tgt_t *tq;
--
-- do {
- ha->dpc_active = 1;
-
- if (!list_empty(&ha->done_queue))
-@@ -3558,12 +3668,26 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- FCS_DEVICE_LOST) {
-
- __del_from_retry_queue(ha, sp);
-- sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->result = DID_IMM_RETRY << 16;
-+ DEBUG2(printk("scsi(%ld): device in state other than LOST "
-+ "\n ",
-+ ha->host_no));
- sp->cmd->host_scribble =
- (unsigned char *) NULL;
- __add_to_done_queue(ha, sp);
- online_cnt++;
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ } else if ( qla2x00_cfg_is_lbenable(
-+ q->fclun) ){
-+ __del_from_retry_queue(ha, sp);
-+ sp->cmd->result = DID_NO_CONNECT << 16;
-+ sp->err_id = SRB_ERR_RETRY;
-+ sp->cmd->host_scribble =
-+ (unsigned char *) NULL;
-+ __add_to_done_queue(ha, sp);
-+#endif
- }
-+
- } /* list_for_each_safe() */
- spin_unlock_irqrestore(&ha->list_lock, flags);
-
-@@ -3639,10 +3763,10 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- if (retry_cmds)
- qla2x00_next(ha);
-
-- DEBUG(if (online_cnt > 0))
-- DEBUG(printk("scsi(%ld): dpc() found scsi reqs to "
-- "restart= %d\n",
-- ha->host_no, online_cnt));
-+ if (online_cnt > 0)
-+ DEBUG(printk("scsi(%ld): dpc() found scsi "
-+ "reqs to restart= %d\n", ha->host_no,
-+ online_cnt));
- }
-
- if (ha->flags.mbox_busy) {
-@@ -3711,9 +3835,9 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- fcport->login_retry) {
-
- fcport->login_retry--;
-- if (fcport->flags & FCF_FABRIC_DEVICE) {
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
- if (fcport->flags &
-- FCF_TAPE_PRESENT)
-+ FC_TAPE_PRESENT)
- qla2x00_fabric_logout(
- ha,
- fcport->loop_id,
-@@ -3787,6 +3911,10 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- ha->host_no));
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha))
-+ qla2x00_process_failover_event(ha);
-+#endif
-
- if (test_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags)) {
- DEBUG(printk("scsi(%ld): qla2x00_restart_queues()\n",
-@@ -3821,6 +3949,11 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- ha->host_no));
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (test_and_clear_bit(IOCTL_ERROR_RECOVERY, &ha->dpc_flags)) {
-+ qla2x00_ioctl_error_recovery(ha);
-+ }
-+#endif
-
- if (!ha->interrupts_on)
- qla2x00_enable_intrs(ha);
-@@ -3828,10 +3961,33 @@ __qla2x00_do_dpc(scsi_qla_host_t *ha)
- if (!list_empty(&ha->done_queue))
- qla2x00_done(ha);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (test_and_clear_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags)) {
-+ DEBUG9(printk("scsi(%ld): blink led start.\n",
-+ ha->host_no));
-+
-+ /* beacon function */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ qla24xx_blink_led(ha);
-+ else if (IS_QLA23XX(ha))
-+ qla23xx_blink_led(ha);
-+
-+ DEBUG9(printk("scsi(%ld): blink led end.\n",
-+ ha->host_no));
-+ }
-+#endif
- ha->dpc_active = 0;
-- } while (0);
-+ } /* End of while(1) */
-
-- return 0;
-+ DEBUG(printk("scsi(%ld): DPC handler exiting\n", ha->host_no));
-+
-+ /*
-+ * Make sure that nobody tries to wake us up again.
-+ */
-+ ha->dpc_wait = NULL;
-+ ha->dpc_active = 0;
-+
-+ complete_and_exit(&ha->dpc_exited, 0);
- }
-
- /*
-@@ -3866,7 +4022,7 @@ qla2x00_abort_queues(scsi_qla_host_t *ha
- __del_from_pending_queue(ha, sp);
-
- /* Set ending status. */
-- sp->cmd->result = DID_BUS_BUSY << 16;
-+ sp->cmd->result = DID_IMM_RETRY << 16;
-
- __add_to_done_queue(ha, sp);
- }
-@@ -3907,7 +4063,11 @@ qla2x00_rst_aen(scsi_qla_host_t *ha)
- * output:
- * srb_t * or NULL
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+srb_t *
-+#else
- static srb_t *
-+#endif
- qla2x00_get_new_sp(scsi_qla_host_t *ha)
- {
- srb_t *sp;
-@@ -3918,6 +4078,286 @@ qla2x00_get_new_sp(scsi_qla_host_t *ha)
- return (sp);
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/**************************************************************************
-+ * qla23xx_blink_led
-+ *
-+ * Description:
-+ * This function sets the colour of the LED for 23xx while preserving the
-+ * unsued GPIO pins every sec.
-+ *
-+ * Input:
-+ * ha - Host adapter structure
-+ *
-+ * Return:
-+ * None
-+ *
-+ * Context: qla2x00_timer() Interrupt
-+ ***************************************************************************/
-+inline void
-+qla23xx_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags)
-+{
-+ if (IS_QLA2322(ha)) {
-+ /* flip all colors */
-+ if (ha->beacon_color_state == QLA_LED_RGA_ON) {
-+ /* turn off */
-+ ha->beacon_color_state = 0;
-+ *pflags = GPIO_LED_ALL_OFF;
-+ } else {
-+ /* turn on */
-+ ha->beacon_color_state = QLA_LED_RGA_ON;
-+ *pflags = GPIO_LED_RGA_ON;
-+ }
-+ } else {
-+ /* flip green led only */
-+ if (ha->beacon_color_state == QLA_LED_GRN_ON) {
-+ /* turn off */
-+ ha->beacon_color_state = 0;
-+ *pflags = GPIO_LED_GREEN_OFF_AMBER_OFF;
-+ } else {
-+ /* turn on */
-+ ha->beacon_color_state = QLA_LED_GRN_ON;
-+ *pflags = GPIO_LED_GREEN_ON_AMBER_OFF;
-+ }
-+ }
-+}
-+
-+void
-+qla23xx_blink_led(scsi_qla_host_t *ha)
-+{
-+ uint16_t gpio_enable;
-+ uint16_t gpio_data;
-+ uint16_t led_color = 0;
-+ unsigned long cpu_flags = 0;
-+ device_reg_t *reg = ha->iobase;
-+
-+
-+ if (ha->pio_address)
-+ reg = (device_reg_t *)ha->pio_address;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+
-+ /* Save the Original GPIOE */
-+ if (ha->pio_address) {
-+ gpio_enable = RD_REG_WORD_PIO(&reg->gpioe);
-+ gpio_data = RD_REG_WORD_PIO(&reg->gpiod);
-+ } else {
-+ gpio_enable = RD_REG_WORD(&reg->gpioe);
-+ gpio_data = RD_REG_WORD(&reg->gpiod);
-+ }
-+
-+ DEBUG9(printk("%s Original data of gpio_enable_reg=0x%x"
-+ " gpio_data_reg=0x%x\n",
-+ __func__,gpio_enable,gpio_data));
-+
-+ /* Set the modified gpio_enable values */
-+ gpio_enable |= GPIO_LED_MASK;
-+
-+ DEBUG9(printk("%s Before writing enable : gpio_enable_reg=0x%x"
-+ " gpio_data_reg=0x%x led_color=0x%x\n",
-+ __func__, gpio_enable, gpio_data, led_color));
-+
-+ if (ha->pio_address)
-+ WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable);
-+ else {
-+ WRT_REG_WORD(&reg->gpioe, gpio_enable);
-+ RD_REG_WORD(&reg->gpioe);
-+ }
-+
-+ qla23xx_flip_colors(ha, &led_color);
-+
-+ /* Clear out any previously set LED color */
-+ gpio_data &= ~GPIO_LED_MASK;
-+
-+ /* Set the new input LED color to GPIOD */
-+ gpio_data |= led_color;
-+
-+ DEBUG9(printk("%s Before writing data: gpio_enable_reg=0x%x"
-+ " gpio_data_reg=0x%x led_color=0x%x\n",
-+ __func__,gpio_enable,gpio_data,led_color));
-+
-+ /* Set the modified gpio_data values */
-+ if (ha->pio_address)
-+ WRT_REG_WORD_PIO(&reg->gpiod, gpio_data);
-+ else {
-+ WRT_REG_WORD(&reg->gpiod, gpio_data);
-+ RD_REG_WORD(&reg->gpiod);
-+ }
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ return;
-+}
-+
-+static void
-+qla23xx_stop_beacon(scsi_qla_host_t *ha)
-+{
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ha->beacon_blink_led = 0;
-+ /* Set the on flag so when it gets flipped it will be off */
-+ if (IS_QLA2322(ha)) {
-+ ha->beacon_color_state = QLA_LED_RGA_ON;
-+ } else {
-+ ha->beacon_color_state = QLA_LED_GRN_ON;
-+ }
-+ qla23xx_blink_led(ha); /* This turns green LED off */
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld done qla23xx_blink_led. orig firmware"
-+ " options fw_options1=0x%x fw_options2=0x%x fw_options3=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, ha->fw_options[1],
-+ ha->fw_options[2], ha->fw_options[3]));
-+
-+ ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-+ ha->fw_options[1] &= ~FO1_DISABLE_GPIO6_7;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return;
-+}
-+
-+/**************************************************************************
-+ * qla24xx_blink_led
-+ *
-+ * Description:
-+ * This function is same as qla2x00_blink_led but used for 24xx and 25xx.
-+ *
-+ * Input:
-+ * ha - Host adapter structure
-+ *
-+ * Return:
-+ * None
-+ *
-+ * Context: qla2x00_timer() Interrupt
-+ ***************************************************************************/
-+inline void
-+qla24xx_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags)
-+{
-+ /* flip all colors */
-+ if (ha->beacon_color_state == QLA_LED_ALL_ON) {
-+ /* turn off */
-+ ha->beacon_color_state = 0;
-+ *pflags = 0;
-+ } else {
-+ /* turn on */
-+ ha->beacon_color_state = QLA_LED_ALL_ON;
-+ *pflags = GPDX_LED_YELLOW_ON | GPDX_LED_AMBER_ON;
-+ }
-+}
-+
-+void
-+qla24xx_blink_led(scsi_qla_host_t *ha)
-+{
-+ uint16_t led_color = 0;
-+ uint32_t gpio_data;
-+ unsigned long cpu_flags = 0;
-+ struct device_reg_24xx __iomem *reg24 =
-+ (struct device_reg_24xx __iomem *)ha->iobase;
-+
-+
-+ /* Save the Original GPIOD */
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+
-+ DEBUG9(printk("%s Original data of gpio_data_reg=0x%x\n",
-+ __func__, gpio_data));
-+
-+ /* Enable the gpio_data reg for update */
-+ gpio_data |= GPDX_LED_UPDATE_MASK;
-+
-+ DEBUG9(printk("%s(%ld): Before writing enable, gpio_data_reg=0x%x.\n",
-+ __func__, ha->host_no, gpio_data));
-+
-+ WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+
-+ DEBUG9(printk("%s(%ld): Before writing color: gpio_data_reg=0x%x.\n",
-+ __func__, ha->host_no, gpio_data));
-+
-+ /* Set the color bits */
-+ qla24xx_flip_colors(ha, &led_color);
-+
-+ /* Clear out any previously set LED color */
-+ gpio_data &= ~GPDX_LED_COLOR_MASK;
-+
-+ /* Set the new input LED color to GPIOD */
-+ gpio_data |= led_color;
-+
-+ /* Set the modified gpio_data values */
-+ WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ DEBUG9(printk("%s(%ld): After writing color: gpio_data_reg=0x%x.\n",
-+ __func__, ha->host_no, gpio_data));
-+
-+ return;
-+}
-+
-+static void
-+qla24xx_stop_beacon(scsi_qla_host_t *ha)
-+{
-+ uint32_t gpio_data;
-+ unsigned long cpu_flags = 0;
-+ struct device_reg_24xx __iomem *reg24 =
-+ (struct device_reg_24xx __iomem *)ha->iobase;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ha->beacon_blink_led = 0;
-+ ha->beacon_color_state = QLA_LED_ALL_ON;
-+ qla24xx_blink_led(ha); /* will flip to all off */
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld done qla24xx_blink_led.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* give control back to firmware */
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+
-+ /* Disable the gpio_data reg for update */
-+ gpio_data &= ~GPDX_LED_UPDATE_MASK;
-+ WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-+ RD_REG_DWORD(&reg24->gpiod);
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return;
-+ }
-+
-+ if (qla2x00_get_fw_options(ha, ha->fw_options) !=
-+ QLA_SUCCESS) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld get"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return;
-+}
-+
-+#endif
-
- /**************************************************************************
- * qla2x00_timer
-@@ -3954,6 +4394,21 @@ qla2x00_timer(scsi_qla_host_t *ha)
- set_bit(SCSI_RESTART_NEEDED, &ha->dpc_flags);
- start_dpc++;
- }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ /* Check if beacon LED needs to be blinked */
-+ if (ha->beacon_blink_led) {
-+ set_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags);
-+ start_dpc++;
-+ }
-+
-+ /*
-+ * We try and failover any request in the failover queue every second.
-+ */
-+ if (!list_empty(&ha->failover_queue)) {
-+ set_bit(FAILOVER_NEEDED, &ha->dpc_flags);
-+ start_dpc++;
-+ }
-+#endif
-
- /*
- * Ports - Port down timer.
-@@ -4059,7 +4514,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
- if (!sp)
- continue;
- if (!(sp->fclun->fcport->flags &
-- FCF_TAPE_PRESENT))
-+ FC_TAPE_PRESENT))
- continue;
-
- set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-@@ -4080,7 +4535,12 @@ qla2x00_timer(scsi_qla_host_t *ha)
- set_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags);
- start_dpc++;
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (!qla2x00_failover_enabled(ha) &&
-+ !(ha->device_flags & DFLG_NO_CABLE)) {
-+#else
- if (!(ha->device_flags & DFLG_NO_CABLE)) {
-+#endif
- DEBUG(printk("scsi(%ld): Loop down - "
- "aborting ISP.\n",
- ha->host_no));
-@@ -4095,13 +4555,25 @@ qla2x00_timer(scsi_qla_host_t *ha)
- atomic_read(&ha->loop_down_timer)));
- }
-
-- /*
-- * Done Q Handler -- dgFIXME This handler will kick off doneq if we
-- * haven't process it in 2 seconds.
-- */
-+ /* Need to flush the done queue. */
- if (!list_empty(&ha->done_queue))
-- qla2x00_done(ha);
-+ start_dpc++;
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (test_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags)) {
-+ if (ha->failback_delay) {
-+ ha->failback_delay--;
-+ if (ha->failback_delay == 0) {
-+ set_bit(FAILOVER_EVENT, &ha->dpc_flags);
-+ clear_bit(FAILOVER_EVENT_NEEDED,
-+ &ha->dpc_flags);
-+ }
-+ } else {
-+ set_bit(FAILOVER_EVENT, &ha->dpc_flags);
-+ clear_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags);
-+ }
-+ }
-+#endif
-
- /* Schedule the DPC routine if needed */
- if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-@@ -4111,6 +4583,12 @@ qla2x00_timer(scsi_qla_host_t *ha)
- test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||
- test_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags) ||
- test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) ||
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ test_bit(FAILOVER_EVENT, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_NEEDED, &ha->dpc_flags) ||
-+ test_bit(IOCTL_ERROR_RECOVERY, &ha->dpc_flags) ||
-+ test_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags) ||
-+#endif
- test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) &&
- ha->dpc_wait && !ha->dpc_active) {
-
-@@ -4218,7 +4696,7 @@ qla2x00_cmd_timeout(srb_t *sp)
- else
- sp->err_id = SRB_ERR_PORT;
- } else {
-- cmd->result = DID_BUS_BUSY << 16;
-+ cmd->result = DID_IMM_RETRY << 16;
- }
- __add_to_done_queue(vis_ha, sp);
- processed++;
-@@ -4232,6 +4710,9 @@ qla2x00_cmd_timeout(srb_t *sp)
-
- spin_lock_irqsave(&dest_ha->list_lock, flags);
- if ((sp->state == SRB_RETRY_STATE) ||
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ (sp->state == SRB_FAILOVER_STATE) ||
-+#endif
- (sp->state == SRB_SCSI_RETRY_STATE)) {
-
- DEBUG2(printk("scsi(%ld): Found in (Scsi) Retry queue or "
-@@ -4245,12 +4726,35 @@ qla2x00_cmd_timeout(srb_t *sp)
- } else if ((sp->state == SRB_SCSI_RETRY_STATE)) {
- __del_from_scsi_retry_queue(dest_ha, sp);
- }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ else if ((sp->state == SRB_FAILOVER_STATE)) {
-+ __del_from_failover_queue(dest_ha, sp);
-+ }
-+#endif
-
- /*
- * If FC_DEVICE is marked as dead return the cmd with
- * DID_NO_CONNECT status. Otherwise set the host_byte to
- * DID_BUS_BUSY to let the OS retry this cmd.
- */
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(dest_ha)) {
-+ cmd->result = DID_IMM_RETRY << 16;
-+ } else {
-+ if ((atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
-+ atomic_read(&dest_ha->loop_state) == LOOP_DEAD) {
-+ qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT);
-+ cmd->result = DID_NO_CONNECT << 16;
-+ if (atomic_read(&dest_ha->loop_state) ==
-+ LOOP_DOWN)
-+ sp->err_id = SRB_ERR_LOOP;
-+ else
-+ sp->err_id = SRB_ERR_PORT;
-+ } else {
-+ cmd->result = DID_IMM_RETRY << 16;
-+ }
-+ }
-+#else
- if ((atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
- atomic_read(&dest_ha->loop_state) == LOOP_DEAD) {
- qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT);
-@@ -4260,8 +4764,9 @@ qla2x00_cmd_timeout(srb_t *sp)
- else
- sp->err_id = SRB_ERR_PORT;
- } else {
-- cmd->result = DID_BUS_BUSY << 16;
-+ cmd->result = DID_IMM_RETRY << 16;
- }
-+#endif
-
- __add_to_done_queue(dest_ha, sp);
- processed++;
-@@ -4282,7 +4787,7 @@ qla2x00_cmd_timeout(srb_t *sp)
- DEBUG(printk("scsi(%ld): Found SP %p in suspended state "
- "- pid %ld:\n",
- dest_ha->host_no, sp, cmd->serial_number));
-- DEBUG(qla2x00_dump_buffer((uint8_t *)sp, sizeof(srb_t));)
-+ DEBUG(qla2x00_dump_buffer((uint8_t *)sp, sizeof(srb_t)));
- } else if (sp->state == SRB_ACTIVE_STATE) {
- /*
- * IO is with ISP find the command in our active list.
-@@ -4296,7 +4801,7 @@ qla2x00_cmd_timeout(srb_t *sp)
- "hdl=%ld\n", dest_ha->host_no, cmd->serial_number,
- (unsigned long)sp->cmd->host_scribble));
-
-- if (sp->flags & SRB_TAPE) {
-+ if (!(sp->flags & SRB_IOCTL)) {
- /*
- * We cannot allow the midlayer error handler
- * to wakeup and begin the abort process.
-@@ -4308,6 +4813,15 @@ qla2x00_cmd_timeout(srb_t *sp)
- qla2x00_extend_timeout(sp->cmd,
- EXTEND_CMD_TIMEOUT);
- }
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ else {
-+ dest_ha->ioctl_err_cmd = sp->cmd;
-+ set_bit(IOCTL_ERROR_RECOVERY,
-+ &dest_ha->dpc_flags);
-+ if (dest_ha->dpc_wait && !dest_ha->dpc_active)
-+ up(dest_ha->dpc_wait);
-+ }
-+#endif
- sp->state = SRB_ACTIVE_TIMEOUT_STATE;
- spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
- } else {
-@@ -4321,19 +4835,19 @@ qla2x00_cmd_timeout(srb_t *sp)
- DEBUG(printk("qla2100%ld: Found in Active timeout state"
- "pid %ld, State = %x., \n",
- dest_ha->host_no,
-- sp->cmd->serial_number, sp->state);)
-+ sp->cmd->serial_number, sp->state));
- } else {
- /* EMPTY */
- DEBUG2(printk("cmd_timeout%ld: LOST command state = "
- "0x%x, sp=%p\n",
-- vis_ha->host_no, sp->state,sp);)
-+ vis_ha->host_no, sp->state,sp));
-
- qla_printk(KERN_INFO, vis_ha,
- "cmd_timeout: LOST command state = 0x%x\n", sp->state);
- }
- spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
-
-- DEBUG3(printk("cmd_timeout: Leaving\n");)
-+ DEBUG3(printk("cmd_timeout: Leaving\n"));
- }
-
- /**************************************************************************
-@@ -4396,6 +4910,12 @@ qla2x00_done(scsi_qla_host_t *old_ha)
- }
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(ha) &&
-+ !(sp->flags & (SRB_IOCTL | SRB_TAPE)))
-+ if (qla2x00_do_fo_check(ha, sp, vis_ha))
-+ continue;
-+#endif
-
- switch (host_byte(cmd->result)) {
- case DID_OK:
-@@ -4421,7 +4941,7 @@ qla2x00_done(scsi_qla_host_t *old_ha)
- * backdoor method.
- *
- */
-- if (ha->host->eh_active != EH_ACTIVE)
-+ if (!qla2x00_is_eh_active(ha->host))
- cmd->result = DID_BUS_BUSY << 16;
- break;
-
-@@ -4515,6 +5035,19 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
- while (!list_empty(&vis_ha->pending_queue)) {
- sp = list_entry(vis_ha->pending_queue.next, srb_t, list);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (qla2x00_failover_enabled(vis_ha) &&
-+ !(sp->lun_queue->fclun->fcport->flags &
-+ FC_FAILOVER_DISABLE) &&
-+ !(sp->lun_queue->fclun->flags & FLF_VISIBLE_LUN) &&
-+ !(sp->flags & (SRB_IOCTL | SRB_TAPE)))
-+ qla2x00_cfg_select_route(sp);
-+ else
-+ sp->fclun = sp->lun_queue->fclun;
-+#else
-+ sp->fclun = sp->lun_queue->fclun;
-+#endif
-+
- fcport = sp->fclun->fcport;
- dest_ha = fcport->ha;
-
-@@ -4528,7 +5061,7 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
- else
- sp->err_id = SRB_ERR_PORT;
-
-- DEBUG3(printk("scsi(%ld): loop/port is down - pid=%ld, "
-+ DEBUG2(printk("scsi(%ld): loop/port is down - pid=%ld, "
- "sp=%p err_id=%d loopid=0x%x queued to dest HBA "
- "scsi%ld.\n", dest_ha->host_no,
- sp->cmd->serial_number, sp, sp->err_id,
-@@ -4558,6 +5091,9 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
- if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
- (atomic_read(&fcport->state) != FCS_ONLINE ||
- test_bit(ABORT_ISP_ACTIVE, &dest_ha->dpc_flags) ||
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ (sp->flags & SRB_FAILOVER) ||
-+#endif
- atomic_read(&dest_ha->loop_state) != LOOP_READY)) {
-
- DEBUG3(printk("scsi(%ld): pid=%ld port=0x%x state=%d "
-@@ -4614,9 +5150,110 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
- /* Process response_queue if ZIO support is enabled. */
- qla2x00_process_response_queue_in_zio_mode(vis_ha);
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (dest_ha && qla2x00_failover_enabled(dest_ha))
-+ qla2x00_process_response_queue_in_zio_mode(dest_ha);
-+#endif
- }
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * qla2x00_flush_failover_queue
-+ * Return cmds of a "specific" LUN from the failover queue with
-+ * DID_BUS_BUSY status.
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ * q = lun queue.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+void
-+qla2x00_flush_failover_q(scsi_qla_host_t *ha, os_lun_t *q)
-+{
-+ srb_t *sp;
-+ struct list_head *list, *temp;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_safe(list, temp, &ha->failover_queue) {
-+ sp = list_entry(list, srb_t, list);
-+ /*
-+ * If request originated from the same lun_q then delete it
-+ * from the failover queue
-+ */
-+ if (q == sp->lun_queue) {
-+ /* Remove srb from failover queue. */
-+ __del_from_failover_queue(ha, sp);
-+ // sp->cmd->result = DID_BUS_BUSY << 16;
-+ // sp->cmd->host_scribble = (unsigned char *) NULL;
-+ qla2x00_failover_cleanup(sp);
-+ __add_to_done_queue(ha, sp);
-+ }
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+}
-+
-+
-+/*
-+ * qla2x00_reset_lun_fo_counts
-+ * Reset failover retry counts
-+ *
-+ * Input:
-+ * ha = adapter block pointer.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+void
-+qla2x00_reset_lun_fo_counts(scsi_qla_host_t *ha, os_lun_t *lq)
-+{
-+ srb_t *tsp;
-+ os_lun_t *orig_lq;
-+ struct list_head *list;
-+ unsigned long flags;
-+ uint16_t path_id;
-+ struct osl_fo_info *osl_fo;
-+
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ /*
-+ * the pending queue.
-+ */
-+ list_for_each(list,&ha->pending_queue) {
-+ tsp = list_entry(list, srb_t, list);
-+ orig_lq = tsp->lun_queue;
-+ if (orig_lq == lq)
-+ tsp->fo_retry_cnt = 0;
-+ }
-+ /*
-+ * the retry queue.
-+ */
-+ list_for_each(list,&ha->retry_queue) {
-+ tsp = list_entry(list, srb_t, list);
-+ orig_lq = tsp->lun_queue;
-+ if (orig_lq == lq)
-+ tsp->fo_retry_cnt = 0;
-+ }
-+
-+ /*
-+ * the done queue.
-+ */
-+ list_for_each(list, &ha->done_queue) {
-+ tsp = list_entry(list, srb_t, list);
-+ orig_lq = tsp->lun_queue;
-+ if (orig_lq == lq)
-+ tsp->fo_retry_cnt = 0;
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ /* reset the failover retry count on all the paths */
-+ osl_fo = (struct osl_fo_info *) lq->fo_ptr;
-+ for (path_id = 0; path_id < MAX_PATHS_PER_DEVICE ; path_id++)
-+ osl_fo->fo_retry_cnt[path_id] = 0;
-+}
-+#endif
- /* XXX(hch): crude hack to emulate a down_timeout() */
- int
- qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
-@@ -4645,8 +5282,8 @@ qla2xxx_get_port_id(struct scsi_device *
- list_for_each_entry(fc, &ha->fcports, list) {
- if (fc->os_target_id == sdev->id) {
- fc_port_id(sdev) = fc->d_id.b.domain << 16 |
-- fc->d_id.b.area << 8 |
-- fc->d_id.b.al_pa;
-+ fc->d_id.b.area << 8 |
-+ fc->d_id.b.al_pa;
- return;
- }
- }
-@@ -4662,7 +5299,7 @@ qla2xxx_get_port_name(struct scsi_device
- list_for_each_entry(fc, &ha->fcports, list) {
- if (fc->os_target_id == sdev->id) {
- fc_port_name(sdev) =
-- __be64_to_cpu(*(uint64_t *)fc->port_name);
-+ __be64_to_cpu(*(uint64_t *)fc->port_name);
- return;
- }
- }
-@@ -4678,7 +5315,7 @@ qla2xxx_get_node_name(struct scsi_device
- list_for_each_entry(fc, &ha->fcports, list) {
- if (fc->os_target_id == sdev->id) {
- fc_node_name(sdev) =
-- __be64_to_cpu(*(uint64_t *)fc->node_name);
-+ __be64_to_cpu(*(uint64_t *)fc->node_name);
- return;
- }
- }
-@@ -4693,172 +5330,47 @@ static struct fc_function_template qla2x
- .get_node_name = qla2xxx_get_node_name,
- .show_node_name = 1,
- };
--#else
--static void
--qla2xxx_get_port_id(struct scsi_target *starget)
--{
-- struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
-- scsi_qla_host_t *ha = to_qla_host(shost);
-- struct fc_port *fc;
--
-- list_for_each_entry(fc, &ha->fcports, list) {
-- if (fc->os_target_id == starget->id) {
-- fc_starget_port_id(starget) = fc->d_id.b.domain << 16 |
-- fc->d_id.b.area << 8 |
-- fc->d_id.b.al_pa;
-- return;
-- }
-- }
-- fc_starget_port_id(starget) = -1;
--}
--
--static void
--qla2xxx_get_port_name(struct scsi_target *starget)
--{
-- struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
-- scsi_qla_host_t *ha = to_qla_host(shost);
-- struct fc_port *fc;
--
-- list_for_each_entry(fc, &ha->fcports, list) {
-- if (fc->os_target_id == starget->id) {
-- fc_starget_port_name(starget) =
-- __be64_to_cpu(*(uint64_t *)fc->port_name);
-- return;
-- }
-- }
-- fc_starget_port_name(starget) = -1;
--}
-+#endif
-
--static void
--qla2xxx_get_node_name(struct scsi_target *starget)
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+void
-+qla2x00_ioctl_error_recovery(scsi_qla_host_t *ha)
- {
-- struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
-- scsi_qla_host_t *ha = to_qla_host(shost);
-- struct fc_port *fc;
-+ int status;
-+ unsigned long flags;
-
-- list_for_each_entry(fc, &ha->fcports, list) {
-- if (fc->os_target_id == starget->id) {
-- fc_starget_node_name(starget) =
-- __be64_to_cpu(*(uint64_t *)fc->node_name);
-- return;
-- }
-+ if (!ha->ioctl_err_cmd) {
-+ printk("%s(%ld) No command to fail...\n", __func__,
-+ ha->host_no);
-+ return;
- }
-- fc_starget_node_name(starget) = -1;
--}
-
--static int
--qla2xxx_dump_sanity_check(struct scsi_device *sdev)
--{
-- scsi_qla_host_t *ha = to_qla_host(sdev->host);
-- fc_port_t *fcport;
-- os_lun_t *lq;
-- uint32_t id;
--
-- if (ha == NULL)
-- return -ENXIO;
--
-- if (ha->dpc_wait == NULL)
-- return -ENXIO;
--
-- /* message host lock is busy */
-- if (spin_is_locked(ha->host->host_lock))
-- return -EBUSY;
--
-- /* A link down judgment */
-- if ((lq = (os_lun_t *) GET_LU_Q(ha, sdev->id, sdev->lun)) != NULL) {
-- fcport = lq->fclun->fcport;
-- if (atomic_read(&fcport->state) != FCS_ONLINE)
-- return -ENXIO;
-- } else {
-- return -ENXIO;
-- }
-+ printk(KERN_INFO
-+ "%s(%ld) Issuing device reset.\n", __func__, ha->host_no);
-
-- /* Check for Verndor ID */
-- pci_read_config_dword(ha->pdev, PCI_VENDOR_ID, &id);
-- if (id == 0xffffffff) {
-- printk(KERN_WARNING "qla sanity check for diskdump: HBA is not available!\n");
-- return -ENXIO;
-+ spin_lock_irqsave(ha->host->host_lock, flags);
-+ status = qla2xxx_eh_device_reset(ha->ioctl_err_cmd);
-+ if (status != SUCCESS) {
-+ printk("%s(%ld) Elevation to host_reset\n", __func__,
-+ ha->host_no);
-+ status = qla2xxx_eh_host_reset(ha->ioctl_err_cmd);
-+ printk("%s(%ld) Return_status=%x\n", __func__, ha->host_no,
-+ status);
- }
--
-- return 0;
--}
--
--static int
--qla2xxx_dump_quiesce(struct scsi_device *sdev)
--{
-- scsi_qla_host_t *ha = to_qla_host(sdev->host);
--
-- if (ha == NULL)
-- return -ENXIO;
-- if (ha->dpc_wait == NULL)
-- return -ENXIO;
--
-- /* clear semaphores */
-- init_MUTEX(&ha->mbx_cmd_sem);
-- init_MUTEX_LOCKED(&ha->mbx_intr_sem);
-- init_MUTEX_LOCKED(ha->dpc_wait);
--
-- /* Initialized the timer */
-- qla2x00_stop_timer(ha);
-- qla2x00_start_timer(ha, qla2x00_timer, WATCH_INTERVAL);
--
-- ha->dpc_active = 0;
--
-- return 0;
--}
--
--static void
--qla2xxx_dump_poll(struct scsi_device *sdev)
--{
-- scsi_qla_host_t *ha = to_qla_host(sdev->host);
--
-- if (ha->dpc_wait == NULL)
-- return;
--
-- /* Unlock the semaphore to force to run DPC handler */
-- sema_init(ha->dpc_wait, 0);
--
-- /* check interrupt pending */
-- qla2x00_poll(ha);
--
-- __qla2x00_do_dpc(ha);
--}
--
--static void
--qla2x00_get_host_port_id(struct Scsi_Host *shost)
--{
-- scsi_qla_host_t *ha = to_qla_host(shost);
--
-- fc_host_port_id(shost) = ha->d_id.b.domain << 16 |
-- ha->d_id.b.area << 8 | ha->d_id.b.al_pa;
-+ ha->ioctl_err_cmd = NULL ;
-+ spin_unlock_irqrestore(ha->host->host_lock, flags);
- }
--
--static int
--qla2x00_issue_lip(struct Scsi_Host *shost)
--{
-- scsi_qla_host_t *ha = to_qla_host(shost);
-- set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
--
-- return 0;
--}
--
--static struct fc_function_template qla2xxx_transport_functions = {
-- .get_starget_port_id = qla2xxx_get_port_id,
-- .show_starget_port_id = 1,
-- .get_starget_port_name = qla2xxx_get_port_name,
-- .show_starget_port_name = 1,
-- .get_starget_node_name = qla2xxx_get_node_name,
-- .show_starget_node_name = 1,
-- .get_host_port_id = qla2x00_get_host_port_id,
-- .show_host_port_id = 1,
--
-- .issue_fc_host_lip = qla2x00_issue_lip,
--};
- #endif
-
- static void
- qla2x00_cleanup_module_exit(void)
- {
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ qla2x00_ioctl_exit();
-+
-+ if (ql2xdevconf)
-+ inter_module_put("qla2xxx_conf");
-+#endif
- /* Free SRBs cache. */
- if (srb_cachep != NULL) {
- if (kmem_cache_destroy(srb_cachep) != 0) {
-@@ -4868,7 +5380,10 @@ qla2x00_cleanup_module_exit(void)
- }
- srb_cachep = NULL;
- }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
- fc_release_transport(qla2xxx_transport_template);
-+#endif
- }
-
- /**
-@@ -4892,9 +5407,25 @@ qla2x00_module_init(void)
- if (extended_error_logging)
- strcat(qla2x00_version_str, "-debug");
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5) && \
-+ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
- qla2xxx_transport_template = fc_attach_transport(&qla2xxx_transport_functions);
- if (!qla2xxx_transport_template)
- return -ENODEV;
-+#endif
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+ if (ql2xfailover)
-+ strcat(qla2x00_version_str, "-fo");
-+
-+ ql2xdevconf = (char *) inter_module_get_request("qla2xxx_conf",
-+ "qla2xxx_conf");
-+ if (ql2xdevconf != NULL && *ql2xdevconf != '\0') {
-+ DEBUG2(printk("qla2xxx: Using conf-options: fchar=%c\n",
-+ *ql2xdevconf));
-+ }
-+
-+ qla2x00_ioctl_init();
-+#endif
-
- printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n");
- return 0;
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_rscn.c ./drivers/scsi/qla2xxx/qla_rscn.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_rscn.c 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_rscn.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,20 +1,8 @@
- /*
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
- */
- #include "qla_def.h"
-
-@@ -318,7 +306,7 @@ qla2x00_update_login_fcport(scsi_qla_hos
- } else {
- fcport->port_type = FCT_TARGET;
- if (le16_to_cpu(mbxstat->mb1) & BIT_1) {
-- fcport->flags |= FCF_TAPE_PRESENT;
-+ fcport->flags |= FC_TAPE_PRESENT;
- }
- }
- fcport->login_retry = 0;
-@@ -326,8 +314,8 @@ qla2x00_update_login_fcport(scsi_qla_hos
- PORT_RETRY_TIME;
- atomic_set(&fcport->port_down_timer, ha->port_down_retry_count *
- PORT_RETRY_TIME);
-- fcport->flags |= FCF_FABRIC_DEVICE;
-- fcport->flags &= ~FCF_FAILOVER_NEEDED;
-+ fcport->flags |= FC_FABRIC_DEVICE;
-+ fcport->flags &= ~FC_FAILOVER_NEEDED;
- fcport->iodesc_idx_sent = IODESC_INVALID_INDEX;
- atomic_set(&fcport->state, FCS_ONLINE);
- }
-@@ -939,7 +927,7 @@ qla2x00_send_login_iocb_cb(scsi_qla_host
- remote_fcport->d_id.b.area, remote_fcport->d_id.b.al_pa));
-
- list_del(&remote_fcport->list);
-- remote_fcport->flags = (FCF_RLC_SUPPORT | FCF_RESCAN_NEEDED);
-+ remote_fcport->flags = (FC_RLC_SUPPORT | FC_RESCAN_NEEDED);
- qla2x00_update_login_fcport(ha, mbxstat, remote_fcport);
- list_add_tail(&remote_fcport->list, &ha->fcports);
- set_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags);
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_settings.h ./drivers/scsi/qla2xxx/qla_settings.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_settings.h 2006-08-23 11:10:13.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_settings.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- /*
- * Compile time Options:
- * 0 - Disable and 1 - Enable
-@@ -53,6 +41,10 @@
- #define MAX_LOOP_TIMEOUT (60 * 5)
- #define EH_ACTIVE 1 /* Error handler active */
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/* Default: IOCTL pass-thru command timeout in seconds. */
-+#define QLA_PT_CMD_TOV (66)
-+#endif
- /*
- * Some vendor subsystems do not recover properly after a device reset. Define
- * the following to force a logout after a successful device reset.
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_sup.c ./drivers/scsi/qla2xxx/qla_sup.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_sup.c 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_sup.c 2006-07-07 03:06:49.000000000 +0400
-@@ -1,22 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
--
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #include "qla_def.h"
-
- #include <linux/delay.h>
-@@ -29,6 +16,24 @@ static int qla2x00_clear_nvram_protectio
- static void qla2x00_set_nvram_protection(scsi_qla_host_t *, int);
- static int qla2x00_write_nvram_word_tmo(scsi_qla_host_t *, uint32_t, uint16_t,
- uint32_t);
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+uint8_t qla2x00_read_flash_byte(scsi_qla_host_t *, uint32_t);
-+static void qla2x00_write_flash_byte(scsi_qla_host_t *, uint32_t, uint8_t);
-+static uint8_t qla2x00_poll_flash(scsi_qla_host_t *, uint32_t, uint8_t,
-+ uint8_t, uint8_t);
-+static uint8_t qla2x00_program_flash_address(scsi_qla_host_t *, uint32_t,
-+ uint8_t, uint8_t, uint8_t);
-+static uint8_t qla2x00_erase_flash(scsi_qla_host_t *, uint8_t, uint8_t);
-+static uint8_t qla2x00_erase_flash_sector(scsi_qla_host_t *, uint32_t,
-+ uint32_t, uint8_t, uint8_t);
-+void qla2x00_get_flash_manufacturer(scsi_qla_host_t *, uint8_t *,
-+ uint8_t *);
-+int qla2x00_get_flash_version(scsi_qla_host_t *);
-+static int qla2x00_get_fcode_version(scsi_qla_host_t *, uint32_t);
-+uint16_t qla2x00_get_flash_image(scsi_qla_host_t *, uint8_t *);
-+uint16_t qla2x00_set_flash_image(scsi_qla_host_t *, uint8_t *, uint32_t,
-+ uint32_t);
-+#endif
- uint16_t qla24xx_update_or_read_flash(scsi_qla_host_t *, uint8_t *,
- uint32_t, uint32_t, uint8_t);
- int qla24xx_get_flash_version(scsi_qla_host_t *, uint8_t *);
-@@ -94,18 +99,18 @@ qla2x00_clear_nvram_protection(scsi_qla_
- {
- int ret, stat;
- device_reg_t __iomem *reg;
-- uint32_t word;
-+ uint32_t word, wait_cnt;
- uint16_t wprot, wprot_old;
-
- reg = ha->iobase;
-
- /* Clear NVRAM write protection. */
- ret = QLA_FUNCTION_FAILED;
-- wprot_old = cpu_to_le16(qla2x00_get_nvram_word(ha, 0));
-- stat = qla2x00_write_nvram_word_tmo(ha, 0,
-+ wprot_old = cpu_to_le16(qla2x00_get_nvram_word(ha, ha->nvram_base));
-+ stat = qla2x00_write_nvram_word_tmo(ha, ha->nvram_base,
- __constant_cpu_to_le16(0x1234), 100000);
-- wprot = cpu_to_le16(qla2x00_get_nvram_word(ha, 0));
-- if (stat != QLA_SUCCESS || wprot != __constant_cpu_to_le16(0x1234)) {
-+ wprot = cpu_to_le16(qla2x00_get_nvram_word(ha, ha->nvram_base));
-+ if (stat != QLA_SUCCESS || wprot != 0x1234) {
- /* Write enable. */
- qla2x00_nv_write(ha, NVR_DATA_OUT);
- qla2x00_nv_write(ha, 0);
-@@ -136,14 +141,22 @@ qla2x00_clear_nvram_protection(scsi_qla_
- /* Wait for NVRAM to become ready. */
- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-+ wait_cnt = NVR_WAIT_CNT;
- do {
-+ if (!--wait_cnt) {
-+ DEBUG9_10(printk("%s(%ld): NVRAM didn't go "
-+ "ready...\n", __func__,
-+ ha->host_no));
-+ break;
-+ }
- NVRAM_DELAY();
- word = RD_REG_WORD(&reg->nvram);
- } while ((word & NVR_DATA_IN) == 0);
-
-- ret = QLA_SUCCESS;
-+ if (wait_cnt)
-+ ret = QLA_SUCCESS;
- } else
-- qla2x00_write_nvram_word(ha, 0, wprot_old);
-+ qla2x00_write_nvram_word(ha, ha->nvram_base, wprot_old);
-
- return ret;
- }
-@@ -152,7 +165,8 @@ static void
- qla2x00_set_nvram_protection(scsi_qla_host_t *ha, int stat)
- {
- device_reg_t __iomem *reg;
-- uint32_t word;
-+ uint32_t word, wait_cnt;
-+
- reg = ha->iobase;
-
- if (stat != QLA_SUCCESS)
-@@ -189,7 +203,13 @@ qla2x00_set_nvram_protection(scsi_qla_ho
- /* Wait for NVRAM to become ready. */
- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-+ wait_cnt = NVR_WAIT_CNT;
- do {
-+ if (!--wait_cnt) {
-+ DEBUG9_10(printk("%s(%ld): NVRAM didn't go ready...\n",
-+ __func__, ha->host_no));
-+ break;
-+ }
- NVRAM_DELAY();
- word = RD_REG_WORD(&reg->nvram);
- } while ((word & NVR_DATA_IN) == 0);
-@@ -227,7 +247,7 @@ qla2x00_write_nvram_word(scsi_qla_host_t
- {
- int count;
- uint16_t word;
-- uint32_t nv_cmd;
-+ uint32_t nv_cmd, wait_cnt;
- device_reg_t __iomem *reg = ha->iobase;
-
- qla2x00_nv_write(ha, NVR_DATA_OUT);
-@@ -257,7 +277,13 @@ qla2x00_write_nvram_word(scsi_qla_host_t
- /* Wait for NVRAM to become ready */
- WRT_REG_WORD(&reg->nvram, NVR_SELECT);
- RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-+ wait_cnt = NVR_WAIT_CNT;
- do {
-+ if (!--wait_cnt) {
-+ DEBUG9_10(printk("%s(%ld): NVRAM didn't go ready...\n",
-+ __func__, ha->host_no));
-+ break;
-+ }
- NVRAM_DELAY();
- word = RD_REG_WORD(&reg->nvram);
- } while ((word & NVR_DATA_IN) == 0);
-@@ -422,6 +448,1108 @@ qla2x00_nv_write(scsi_qla_host_t *ha, ui
- NVRAM_DELAY();
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+/*
-+ * Flash support routines
-+ */
-+
-+/**
-+ * qla2x00_flash_enable() - Setup flash for reading and writing.
-+ * @ha: HA context
-+ */
-+void
-+qla2x00_flash_enable(scsi_qla_host_t *ha)
-+{
-+ uint16_t data;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ data = RD_REG_WORD(&reg->ctrl_status);
-+ data |= CSR_FLASH_ENABLE;
-+ WRT_REG_WORD(&reg->ctrl_status, data);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+}
-+
-+/**
-+ * qla2x00_flash_disable() - Disable flash and allow RISC to run.
-+ * @ha: HA context
-+ */
-+void
-+qla2x00_flash_disable(scsi_qla_host_t *ha)
-+{
-+ uint16_t data;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ data = RD_REG_WORD(&reg->ctrl_status);
-+ data &= ~(CSR_FLASH_ENABLE);
-+ WRT_REG_WORD(&reg->ctrl_status, data);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+}
-+
-+/**
-+ * qla2x00_read_flash_byte() - Reads a byte from flash
-+ * @ha: HA context
-+ * @addr: Address in flash to read
-+ *
-+ * A word is read from the chip, but, only the lower byte is valid.
-+ *
-+ * Returns the byte read from flash @addr.
-+ */
-+uint8_t
-+qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
-+{
-+ uint16_t data;
-+ uint16_t bank_select;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ bank_select = RD_REG_WORD(&reg->ctrl_status);
-+
-+ if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-+ /* Specify 64K address range: */
-+ /* clear out Module Select and Flash Address bits [19:16]. */
-+ bank_select &= ~0xf8;
-+ bank_select |= addr >> 12 & 0xf0;
-+ bank_select |= CSR_FLASH_64K_BANK;
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+
-+ WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-+ data = RD_REG_WORD(&reg->flash_data);
-+
-+ return ((uint8_t)data);
-+ }
-+
-+ /* Setup bit 16 of flash address. */
-+ if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-+ bank_select |= CSR_FLASH_64K_BANK;
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ } else if (((addr & BIT_16) == 0) &&
-+ (bank_select & CSR_FLASH_64K_BANK)) {
-+ bank_select &= ~(CSR_FLASH_64K_BANK);
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ }
-+
-+ /* Always perform IO mapped accesses to the FLASH registers. */
-+ if (ha->pio_address) {
-+ uint16_t data2;
-+
-+ reg = (device_reg_t *)ha->pio_address;
-+ WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
-+ do {
-+ data = RD_REG_WORD_PIO(&reg->flash_data);
-+ barrier();
-+ cpu_relax();
-+ data2 = RD_REG_WORD_PIO(&reg->flash_data);
-+ } while (data != data2);
-+ } else {
-+ WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-+ data = qla2x00_debounce_register(&reg->flash_data);
-+ }
-+
-+ return ((uint8_t)data);
-+}
-+
-+/**
-+ * qla2x00_write_flash_byte() - Write a byte to flash
-+ * @ha: HA context
-+ * @addr: Address in flash to write
-+ * @data: Data to write
-+ */
-+static void
-+qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
-+{
-+ uint16_t bank_select;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ bank_select = RD_REG_WORD(&reg->ctrl_status);
-+ if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-+ /* Specify 64K address range: */
-+ /* clear out Module Select and Flash Address bits [19:16]. */
-+ bank_select &= ~0xf8;
-+ bank_select |= addr >> 12 & 0xf0;
-+ bank_select |= CSR_FLASH_64K_BANK;
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+
-+ WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+
-+ return;
-+ }
-+
-+ /* Setup bit 16 of flash address. */
-+ if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-+ bank_select |= CSR_FLASH_64K_BANK;
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ } else if (((addr & BIT_16) == 0) &&
-+ (bank_select & CSR_FLASH_64K_BANK)) {
-+ bank_select &= ~(CSR_FLASH_64K_BANK);
-+ WRT_REG_WORD(&reg->ctrl_status, bank_select);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ }
-+
-+ /* Always perform IO mapped accesses to the FLASH registers. */
-+ if (ha->pio_address) {
-+ reg = (device_reg_t *)ha->pio_address;
-+ WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
-+ WRT_REG_WORD_PIO(&reg->flash_data, (uint16_t)data);
-+ } else {
-+ WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
-+ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
-+ }
-+}
-+
-+/**
-+ * qla2x00_poll_flash() - Polls flash for completion.
-+ * @ha: HA context
-+ * @addr: Address in flash to poll
-+ * @poll_data: Data to be polled
-+ * @man_id: Flash manufacturer ID
-+ * @flash_id: Flash ID
-+ *
-+ * This function polls the device until bit 7 of what is read matches data
-+ * bit 7 or until data bit 5 becomes a 1. If that hapens, the flash ROM timed
-+ * out (a fatal error). The flash book recommeds reading bit 7 again after
-+ * reading bit 5 as a 1.
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+static uint8_t
-+qla2x00_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data,
-+ uint8_t man_id, uint8_t flash_id)
-+{
-+ uint8_t status;
-+ uint8_t flash_data;
-+ uint32_t cnt;
-+
-+ status = 1;
-+
-+ /* Wait for 30 seconds for command to finish. */
-+ poll_data &= BIT_7;
-+ for (cnt = 3000000; cnt; cnt--) {
-+ flash_data = qla2x00_read_flash_byte(ha, addr);
-+ if ((flash_data & BIT_7) == poll_data) {
-+ status = 0;
-+ break;
-+ }
-+
-+ if (man_id != 0x40 && man_id != 0xda) {
-+ if ((flash_data & BIT_5) && cnt > 2)
-+ cnt = 2;
-+ }
-+ udelay(10);
-+ barrier();
-+ }
-+ return (status);
-+}
-+
-+/**
-+ * qla2x00_program_flash_address() - Programs a flash address
-+ * @ha: HA context
-+ * @addr: Address in flash to program
-+ * @data: Data to be written in flash
-+ * @man_id: Flash manufacturer ID
-+ * @flash_id: Flash ID
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+static uint8_t
-+qla2x00_program_flash_address(scsi_qla_host_t *ha, uint32_t addr, uint8_t data,
-+ uint8_t man_id, uint8_t flash_id)
-+{
-+ /* Write Program Command Sequence */
-+ if (IS_OEM_001(ha)) {
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x555, 0x55);
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0xa0);
-+ qla2x00_write_flash_byte(ha, addr, data);
-+ } else {
-+ if (man_id == 0xda && flash_id == 0xc1) {
-+ qla2x00_write_flash_byte(ha, addr, data);
-+ if (addr & 0x7e)
-+ return 0;
-+ } else {
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xa0);
-+ qla2x00_write_flash_byte(ha, addr, data);
-+ }
-+ }
-+
-+ udelay(150);
-+
-+ /* Wait for write to complete. */
-+ return (qla2x00_poll_flash(ha, addr, data, man_id, flash_id));
-+}
-+
-+/**
-+ * qla2x00_erase_flash() - Erase the flash.
-+ * @ha: HA context
-+ * @man_id: Flash manufacturer ID
-+ * @flash_id: Flash ID
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+static uint8_t
-+qla2x00_erase_flash(scsi_qla_host_t *ha, uint8_t man_id, uint8_t flash_id)
-+{
-+ /* Individual Sector Erase Command Sequence */
-+ if (IS_OEM_001(ha)) {
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x555, 0x55);
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0x80);
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x555, 0x55);
-+ qla2x00_write_flash_byte(ha, 0xaaa, 0x10);
-+ } else {
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0x80);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0x10);
-+ }
-+
-+ udelay(150);
-+
-+ /* Wait for erase to complete. */
-+ return (qla2x00_poll_flash(ha, 0x00, 0x80, man_id, flash_id));
-+}
-+
-+/**
-+ * qla2x00_erase_flash_sector() - Erase a flash sector.
-+ * @ha: HA context
-+ * @addr: Flash sector to erase
-+ * @sec_mask: Sector address mask
-+ * @man_id: Flash manufacturer ID
-+ * @flash_id: Flash ID
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+static uint8_t
-+qla2x00_erase_flash_sector(scsi_qla_host_t *ha, uint32_t addr,
-+ uint32_t sec_mask, uint8_t man_id, uint8_t flash_id)
-+{
-+ /* Individual Sector Erase Command Sequence */
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0x80);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ if (man_id == 0x1f && flash_id == 0x13)
-+ qla2x00_write_flash_byte(ha, addr & sec_mask, 0x10);
-+ else
-+ qla2x00_write_flash_byte(ha, addr & sec_mask, 0x30);
-+
-+ udelay(150);
-+
-+ /* Wait for erase to complete. */
-+ return (qla2x00_poll_flash(ha, addr, 0x80, man_id, flash_id));
-+}
-+
-+/**
-+ * qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip.
-+ * @man_id: Flash manufacturer ID
-+ * @flash_id: Flash ID
-+ *
-+ */
-+void
-+qla2x00_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
-+ uint8_t *flash_id)
-+{
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0x90);
-+ *man_id = qla2x00_read_flash_byte(ha, 0x0000);
-+ *flash_id = qla2x00_read_flash_byte(ha, 0x0001);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555, 0xf0);
-+}
-+
-+static void
-+qla2x00_read_flash_data(scsi_qla_host_t *ha, uint8_t *tmp_buf, uint32_t saddr,
-+ uint32_t length)
-+{
-+ device_reg_t __iomem *reg = ha->iobase;
-+ uint32_t midpoint;
-+ uint8_t data;
-+ uint32_t ilength;
-+
-+ midpoint = length / 2;
-+
-+ WRT_REG_WORD(&reg->nvram, 0);
-+ RD_REG_WORD(&reg->nvram);
-+ for (ilength = 0; ilength < length; saddr++, ilength++, tmp_buf++) {
-+ if (ilength == midpoint){
-+ WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-+ RD_REG_WORD(&reg->nvram);
-+ }
-+ data = qla2x00_read_flash_byte(ha, saddr);
-+ if (saddr % 100)
-+ udelay(10);
-+ *tmp_buf = data;
-+ }
-+}
-+
-+/**
-+ * qla2x00_get_flash_version() - Read version information from flash.
-+ * @ha: HA context
-+ *
-+ * Returns QLA_SUCCESS on successful retrieval of flash version.
-+ */
-+int
-+qla2x00_get_flash_version(scsi_qla_host_t *ha)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint8_t code_type, last_image;
-+ uint32_t pcihdr, pcids;
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ return qla24xx_get_flash_version(ha,
-+ (uint8_t *)ha->request_ring);
-+
-+ if (!ha->pio_address)
-+ return QLA_FUNCTION_FAILED;
-+
-+ qla2x00_flash_enable(ha);
-+
-+ /* Begin with first PCI expansion ROM header. */
-+ pcihdr = 0;
-+ last_image = 1;
-+ do {
-+ /* Verify PCI expansion ROM header. */
-+ if (qla2x00_read_flash_byte(ha, pcihdr) != 0x55 ||
-+ qla2x00_read_flash_byte(ha, pcihdr + 0x01) != 0xaa) {
-+ /* No signature */
-+ DEBUG2(printk("scsi(%ld): No matching ROM signature.\n",
-+ ha->host_no));
-+ ret = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ /* Locate PCI data structure. */
-+ pcids = pcihdr +
-+ ((qla2x00_read_flash_byte(ha, pcihdr + 0x19) << 8) |
-+ qla2x00_read_flash_byte(ha, pcihdr + 0x18));
-+
-+ /* Validate signature of PCI data structure. */
-+ if (qla2x00_read_flash_byte(ha, pcids) != 'P' ||
-+ qla2x00_read_flash_byte(ha, pcids + 0x1) != 'C' ||
-+ qla2x00_read_flash_byte(ha, pcids + 0x2) != 'I' ||
-+ qla2x00_read_flash_byte(ha, pcids + 0x3) != 'R') {
-+ /* Incorrect header. */
-+ DEBUG2(printk("%s(): PCI data struct not found "
-+ "pcir_adr=%x.\n",
-+ __func__, pcids));
-+ ret = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ /* Read version */
-+ code_type = qla2x00_read_flash_byte(ha, pcids + 0x14);
-+ switch (code_type) {
-+ case ROM_CODE_TYPE_BIOS:
-+ /* Intel x86, PC-AT compatible. */
-+ set_bit(ROM_CODE_TYPE_BIOS, &ha->code_types);
-+ ha->bios_revision[0] =
-+ qla2x00_read_flash_byte(ha, pcids + 0x12);
-+ ha->bios_revision[1] =
-+ qla2x00_read_flash_byte(ha, pcids + 0x13);
-+ DEBUG3(printk("%s(): read BIOS %d.%d.\n", __func__,
-+ ha->bios_revision[1], ha->bios_revision[0]));
-+ break;
-+ case ROM_CODE_TYPE_FCODE:
-+ /* Open Firmware standard for PCI (FCode). */
-+ /* Eeeewww... */
-+ if (qla2x00_get_fcode_version(ha, pcids) == QLA_SUCCESS)
-+ set_bit(ROM_CODE_TYPE_FCODE, &ha->code_types);
-+ break;
-+ case ROM_CODE_TYPE_EFI:
-+ /* Extensible Firmware Interface (EFI). */
-+ set_bit(ROM_CODE_TYPE_EFI, &ha->code_types);
-+ ha->efi_revision[0] =
-+ qla2x00_read_flash_byte(ha, pcids + 0x12);
-+ ha->efi_revision[1] =
-+ qla2x00_read_flash_byte(ha, pcids + 0x13);
-+ DEBUG3(printk("%s(): read EFI %d.%d.\n", __func__,
-+ ha->efi_revision[1], ha->efi_revision[0]));
-+ break;
-+ default:
-+ DEBUG2(printk("%s(): Unrecognized code type %x at "
-+ "pcids %x.\n", __func__, code_type, pcids));
-+ break;
-+ }
-+
-+ last_image = qla2x00_read_flash_byte(ha, pcids + 0x15) & BIT_7;
-+
-+ /* Locate next PCI expansion ROM. */
-+ pcihdr += ((qla2x00_read_flash_byte(ha, pcids + 0x11) << 8) |
-+ qla2x00_read_flash_byte(ha, pcids + 0x10)) * 512;
-+ } while (!last_image);
-+
-+ if (IS_QLA2322(ha)) {
-+ uint8_t dbyte[8];
-+ uint8_t length;
-+ uint16_t *dcode;
-+
-+ length = sizeof(dbyte);
-+
-+ /* Read firmware image information. */
-+ memset(ha->fw_revision, 0, sizeof(ha->fw_revision));
-+ memset(dbyte, 0, sizeof(dbyte));
-+ dcode = (uint16_t *)dbyte;
-+
-+ qla2x00_read_flash_data(ha, dbyte, FA_RISC_CODE_ADDR*4 + 10,
-+ length);
-+ DEBUG9(printk("%s(%ld): dumping fw ver from flash:\n",
-+ __func__, ha->host_no));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)dbyte, length));
-+
-+ if ((dcode[0] == 0xffff && dcode[1] == 0xffff &&
-+ dcode[2] == 0xffff && dcode[3] == 0xffff) ||
-+ (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
-+ dcode[3] == 0)) {
-+ DEBUG10(printk(
-+ "%s(): Unrecognized fw revision at %x.\n",
-+ __func__, FA_RISC_CODE_ADDR*4));
-+ } else {
-+ /* values are in big endian */
-+ ha->fw_revision[0] = dbyte[0] << 16 | dbyte[1];
-+ ha->fw_revision[1] = dbyte[2] << 16 | dbyte[3];
-+ ha->fw_revision[2] = dbyte[4] << 16 | dbyte[5];
-+ }
-+ }
-+
-+ qla2x00_flash_disable(ha);
-+
-+ return ret;
-+}
-+
-+/**
-+ * qla2x00_get_fcode_version() - Determine an FCODE image's version.
-+ * @ha: HA context
-+ * @pcids: Pointer to the FCODE PCI data structure
-+ *
-+ * The process of retrieving the FCODE version information is at best
-+ * described as interesting.
-+ *
-+ * Within the first 100h bytes of the image an ASCII string is present
-+ * which contains several pieces of information including the FCODE
-+ * version. Unfortunately it seems the only reliable way to retrieve
-+ * the version is by scanning for another sentinel within the string,
-+ * the FCODE build date:
-+ *
-+ * ... 2.00.02 10/17/02 ...
-+ *
-+ * Returns QLA_SUCCESS on successful retrieval of version.
-+ */
-+static int
-+qla2x00_get_fcode_version(scsi_qla_host_t *ha, uint32_t pcids)
-+{
-+ int ret = QLA_FUNCTION_FAILED;
-+ uint32_t istart, iend, iter, vend;
-+ uint8_t do_next, rbyte, *vbyte;
-+
-+ memset(ha->fcode_revision, 0, sizeof(ha->fcode_revision));
-+
-+ /* Skip the PCI data structure. */
-+ istart = pcids +
-+ ((qla2x00_read_flash_byte(ha, pcids + 0x0B) << 8) |
-+ qla2x00_read_flash_byte(ha, pcids + 0x0A));
-+ iend = istart + 0x100;
-+ do {
-+ /* Scan for the sentinel date string...eeewww. */
-+ do_next = 0;
-+ iter = istart;
-+ while ((iter < iend) && !do_next) {
-+ iter++;
-+ if (qla2x00_read_flash_byte(ha, iter) == '/') {
-+ if (qla2x00_read_flash_byte(ha, iter + 2) ==
-+ '/')
-+ do_next++;
-+ else if (qla2x00_read_flash_byte(ha,
-+ iter + 3) == '/')
-+ do_next++;
-+ }
-+ }
-+ if (!do_next)
-+ break;
-+
-+ /* Backtrack to previous ' ' (space). */
-+ do_next = 0;
-+ while ((iter > istart) && !do_next) {
-+ iter--;
-+ if (qla2x00_read_flash_byte(ha, iter) == ' ')
-+ do_next++;
-+ }
-+ if (!do_next)
-+ break;
-+
-+ /*
-+ * Mark end of version tag, and find previous ' ' (space) or
-+ * string length (recent FCODE images -- major hack ahead!!!).
-+ */
-+ vend = iter - 1;
-+ do_next = 0;
-+ while ((iter > istart) && !do_next) {
-+ iter--;
-+ rbyte = qla2x00_read_flash_byte(ha, iter);
-+ if (rbyte == ' ' || rbyte == 0xd || rbyte == 0x10)
-+ do_next++;
-+ }
-+ if (!do_next)
-+ break;
-+
-+ /* Mark beginning of version tag, and copy data. */
-+ iter++;
-+ if ((vend - iter) &&
-+ ((vend - iter) < sizeof(ha->fcode_revision))) {
-+ vbyte = ha->fcode_revision;
-+ while (iter <= vend) {
-+ *vbyte++ = qla2x00_read_flash_byte(ha, iter);
-+ iter++;
-+ }
-+ ret = QLA_SUCCESS;
-+ }
-+ } while (0);
-+
-+ return ret;
-+}
-+
-+/**
-+ * qla2x00_get_flash_image() - Read image from flash chip.
-+ * @ha: HA context
-+ * @image: Buffer to receive flash image
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+uint16_t
-+qla2x00_get_flash_image(scsi_qla_host_t *ha, uint8_t *image)
-+{
-+ uint32_t addr;
-+ uint32_t midpoint;
-+ uint8_t *data;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ midpoint = FLASH_IMAGE_SIZE / 2;
-+
-+ qla2x00_flash_enable(ha);
-+ WRT_REG_WORD(&reg->nvram, 0);
-+ RD_REG_WORD(&reg->nvram); /* PCI Posting. */
-+ for (addr = 0, data = image; addr < FLASH_IMAGE_SIZE; addr++, data++) {
-+ if (addr == midpoint)
-+ WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-+
-+ *data = qla2x00_read_flash_byte(ha, addr);
-+ }
-+ qla2x00_flash_disable(ha);
-+
-+ return (0);
-+}
-+
-+/**
-+ * qla2x00_set_flash_image() - Write image to flash chip.
-+ * @ha: HA context
-+ * @image: Source image to write to flash
-+ *
-+ * Returns 0 on success, else non-zero.
-+ */
-+uint16_t
-+qla2x00_set_flash_image(scsi_qla_host_t *ha, uint8_t *image, uint32_t saddr,
-+ uint32_t length)
-+{
-+ uint16_t status;
-+ uint32_t addr;
-+ uint32_t liter;
-+ uint32_t sec_mask;
-+ uint32_t rest_addr;
-+ uint8_t man_id, flash_id;
-+ uint8_t sec_number;
-+ uint8_t data;
-+ device_reg_t __iomem *reg = ha->iobase;
-+ uint16_t wd;
-+
-+ status = 0;
-+ sec_number = 0;
-+
-+ /* Reset ISP chip. */
-+ WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-+ pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
-+
-+ qla2x00_flash_enable(ha);
-+ do { /* Loop once to provide quick error exit */
-+ /* Structure of flash memory based on manufacturer */
-+ if (IS_OEM_001(ha)) {
-+ // OEM variant with special flash part.
-+ man_id = flash_id = 0;
-+ rest_addr = 0xffff;
-+ sec_mask = 0x10000;
-+ goto update_flash;
-+ }
-+ qla2x00_get_flash_manufacturer(ha, &man_id, &flash_id);
-+ DEBUG9(printk("%s(%ld): Flash man_id=%d flash_id=%d\n",
-+ __func__, ha->host_no, man_id, flash_id));
-+ switch (man_id) {
-+ case 0x20: // ST flash
-+ if (flash_id == 0xd2 || flash_id == 0xe3) {
-+ // ST m29w008at part - 64kb sector size with
-+ // 32kb,8kb,8kb,16kb sectors at memory address
-+ // 0xf0000
-+ rest_addr = 0xffff;
-+ sec_mask = 0x10000;
-+ break;
-+ }
-+ // ST m29w010b part - 16kb sector size
-+ // Default to 16kb sectors
-+ rest_addr = 0x3fff;
-+ sec_mask = 0x1c000;
-+ break;
-+ case 0x40: // Mostel flash
-+ // Mostel v29c51001 part - 512 byte sector size
-+ rest_addr = 0x1ff;
-+ sec_mask = 0x1fe00;
-+ break;
-+ case 0xbf: // SST flash
-+ // SST39sf10 part - 4kb sector size
-+ rest_addr = 0xfff;
-+ sec_mask = 0x1f000;
-+ break;
-+ case 0xda: // Winbond flash
-+ // Winbond W29EE011 part - 256 byte sector size
-+ rest_addr = 0x7f;
-+ sec_mask = 0x1ff80;
-+ break;
-+ case 0xc2: // Macronix flash
-+ // 64k sector size
-+ if (flash_id == 0x38 || flash_id == 0x4f) {
-+ rest_addr = 0xffff;
-+ sec_mask = 0x10000;
-+ break;
-+ }
-+ // Fall through...
-+
-+ case 0x1f: // Atmel flash
-+ // 512k sector size
-+ if (flash_id == 0x13) {
-+ rest_addr = 0x7fffffff;
-+ sec_mask = 0x80000000;
-+ break;
-+ }
-+ // Fall through...
-+
-+ case 0x01: // AMD flash
-+ if (flash_id == 0x38 || flash_id == 0x40 ||
-+ flash_id == 0x4f) {
-+ // Am29LV081 part - 64kb sector size
-+ // Am29LV002BT part - 64kb sector size
-+ rest_addr = 0xffff;
-+ sec_mask = 0x10000;
-+ break;
-+ } else if (flash_id == 0x3e) {
-+ // Am29LV008b part - 64kb sector size with
-+ // 32kb,8kb,8kb,16kb sector at memory address
-+ // 0xf0000
-+ rest_addr = 0xffff;
-+ sec_mask = 0x10000;
-+ break;
-+ } else if (flash_id == 0x20 || flash_id == 0x6e) {
-+ // Am29LV010 part or AM29f010 - 16kb sector
-+ // size
-+ rest_addr = 0x3fff;
-+ sec_mask = 0x1c000;
-+ break;
-+ } else if (flash_id == 0x6d) {
-+ // Am29LV001 part - 8kb sector size
-+ rest_addr = 0x1fff;
-+ sec_mask = 0x1e000;
-+ break;
-+ }
-+ default:
-+ // Default to 16 kb sector size
-+ rest_addr = 0x3fff;
-+ sec_mask = 0x1c000;
-+ break;
-+ }
-+
-+update_flash:
-+ if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-+ if (qla2x00_erase_flash(ha, man_id, flash_id)) {
-+ status = 1;
-+ break;
-+ }
-+ }
-+
-+ for (addr = saddr, liter = 0; liter < length; liter++, addr++) {
-+ data = image[liter];
-+ /* Are we at the beginning of a sector? */
-+ if ((addr & rest_addr) == 0) {
-+ if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
-+ if (addr >= 0x10000UL) {
-+ if (((addr >> 12) & 0xf0) &&
-+ ((man_id == 0x01 && flash_id == 0x3e) ||
-+ (man_id == 0x20 && flash_id == 0xd2))) {
-+ sec_number++;
-+ if (sec_number == 1) {
-+ rest_addr = 0x7fff;
-+ sec_mask = 0x18000;
-+ } else if (sec_number == 2 ||
-+ sec_number == 3) {
-+ rest_addr = 0x1fff;
-+ sec_mask = 0x1e000;
-+ } else if (sec_number == 4) {
-+ rest_addr = 0x3fff;
-+ sec_mask = 0x1c000;
-+ }
-+ }
-+ }
-+ } else if (addr == FLASH_IMAGE_SIZE / 2) {
-+ WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-+ RD_REG_WORD(&reg->nvram);
-+ }
-+
-+ if (flash_id == 0xda && man_id == 0xc1) {
-+ qla2x00_write_flash_byte(ha, 0x5555,
-+ 0xaa);
-+ qla2x00_write_flash_byte(ha, 0x2aaa,
-+ 0x55);
-+ qla2x00_write_flash_byte(ha, 0x5555,
-+ 0xa0);
-+ } else if (!IS_QLA2322(ha) && !IS_QLA6322(ha)) {
-+ /* Then erase it */
-+ if (qla2x00_erase_flash_sector(ha, addr,
-+ sec_mask, man_id, flash_id)) {
-+ DEBUG9(printk("%s(%ld) Unable "
-+ "to erase flash sector "
-+ "addr=%x mask=%x.\n",
-+ __func__, ha->host_no, addr,
-+ sec_mask));
-+ status = 1;
-+ break;
-+ }
-+ if (man_id == 0x01 && flash_id == 0x6d)
-+ sec_number++;
-+ }
-+ }
-+
-+ if (man_id == 0x01 && flash_id == 0x6d) {
-+ if (sec_number == 1 &&
-+ addr == (rest_addr - 1)) {
-+ rest_addr = 0x0fff;
-+ sec_mask = 0x1f000;
-+ } else if (sec_number == 3 && (addr & 0x7ffe)) {
-+ rest_addr = 0x3fff;
-+ sec_mask = 0x1c000;
-+ }
-+ }
-+
-+ if (qla2x00_program_flash_address(ha, addr, data,
-+ man_id, flash_id)) {
-+ DEBUG9(printk("%s(%ld) Unable to program flash "
-+ "address=%x data=%x.\n", __func__,
-+ ha->host_no, addr, data));
-+ status = 1;
-+ break;
-+ }
-+ }
-+ } while (0);
-+ qla2x00_flash_disable(ha);
-+
-+ return (status);
-+}
-+
-+/* qla2x00_cmd_wait
-+ * Stall driver until all outstanding commands are returned.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Return;
-+ * 0 -- Done
-+ * 1 -- cmds still outstanding
-+ *
-+ * Context:
-+ * This routine must be called without hardware_lock held.
-+ */
-+int
-+qla2x00_cmd_wait(scsi_qla_host_t *ha)
-+{
-+ int status = 0;
-+ int index = 0;
-+ int wait_cnt = 30;
-+ unsigned long cpu_flags;
-+
-+ DEBUG(printk("%s(%ld): Started\n",__func__,ha->host_no));
-+
-+ while (wait_cnt) {
-+ /* Find a command that hasn't completed. */
-+ for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ if (ha->outstanding_cmds[index] != NULL) {
-+ spin_unlock_irqrestore(&ha->hardware_lock,
-+ cpu_flags);
-+ break;
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+ }
-+
-+ /* If No Commands are pending wait is complete */
-+ if (index == MAX_OUTSTANDING_COMMANDS)
-+ break;
-+
-+ /*
-+ * If we timed out on waiting for commands to come back Reset
-+ * the ISP
-+ */
-+ wait_cnt--;
-+ if (wait_cnt == 0) {
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ status = 1;
-+ DEBUG(printk("%s(%ld): ISP abort - handle %d\n",
-+ __func__, ha->host_no, index));
-+ } else {
-+ /* sleep a second */
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ }
-+ }
-+
-+ DEBUG(printk("%s(%ld): Done waiting on commands - ind=%d\n",
-+ __func__, ha->host_no, index));
-+
-+ return status;
-+}
-+
-+/*
-+ * qla2x00_suspend_target
-+ * Suspend target
-+ *
-+ * Input:
-+ * ha = visable adapter block pointer.
-+ * target = target queue
-+ * time = time in seconds
-+ *
-+ * Return:
-+ * QL_STATUS_SUCCESS -- suspended lun
-+ * QL_STATUS_ERROR -- Didn't suspend lun
-+ *
-+ * Context:
-+ * Interrupt context.
-+ */
-+int
-+qla2x00_suspend_target(scsi_qla_host_t *ha, os_tgt_t *tq, int time)
-+{
-+ srb_t *sp, *sptemp;
-+ unsigned long flags;
-+
-+ if (test_bit(TQF_SUSPENDED, &tq->flags))
-+ return QLA_FUNCTION_FAILED;
-+
-+ /* now suspend the lun */
-+ set_bit(TQF_SUSPENDED, &tq->flags);
-+
-+ DEBUG2(printk(KERN_INFO
-+ "scsi%ld: Starting - suspend target for %d secs\n", ha->host_no,
-+ time));
-+
-+ /*
-+ * Remove all (TARGET) pending commands from request queue and put them
-+ * in the scsi_retry queue.
-+ */
-+ spin_lock_irqsave(&ha->list_lock, flags);
-+ list_for_each_entry_safe(sp, sptemp, &ha->pending_queue, list) {
-+ if (sp->tgt_queue != tq)
-+ continue;
-+
-+ DEBUG3(printk("scsi%ld: %s requeue for suspended target %p\n",
-+ ha->host_no, __func__, sp));
-+
-+ __del_from_pending_queue(ha, sp);
-+ __add_to_scsi_retry_queue(ha,sp);
-+ }
-+ spin_unlock_irqrestore(&ha->list_lock, flags);
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla2x00_unsuspend_all_target
-+ * Unsuspend all target.
-+ *
-+ * Input:
-+ * ha = visable adapter block pointer.
-+ *
-+ * Return:
-+ *
-+ * Context:
-+ * Process context.
-+ */
-+void
-+qla2x00_unsuspend_all_target(scsi_qla_host_t *ha)
-+{
-+ os_tgt_t *tq;
-+ int t;
-+
-+ for (t = 0; t < ha->max_targets; t++) {
-+ if ((tq = ha->otgt[t]) == NULL)
-+ continue;
-+
-+ clear_bit(TQF_SUSPENDED, &tq->flags);
-+ }
-+}
-+
-+/*
-+ * qla2x00_suspend_all_target
-+ * Suspend all target indefinitely. Caller need to make sure
-+ * to explicitly unsuspend it later on.
-+ *
-+ * Input:
-+ * ha = visable adapter block pointer.
-+ * target = target queue
-+ * time = time in seconds
-+ *
-+ * Return:
-+ * QL_STATUS_SUCCESS -- suspended lun
-+ * QL_STATUS_ERROR -- Didn't suspend lun
-+ *
-+ * Context:
-+ * qla2x00_suspend_target can be called in Interrupt context.
-+ * Hold the hardware lock for synchronisation.
-+ */
-+int
-+qla2x00_suspend_all_target(scsi_qla_host_t *ha)
-+{
-+ int status = 0;
-+ os_tgt_t *tq;
-+ int t, time;
-+ unsigned long cpu_flags = 0;
-+
-+ /* Suspend the Target until explicitly cleared */
-+ time = 0;
-+
-+ for (t = 0; t < ha->max_targets; t++) {
-+ if ((tq = ha->otgt[t]) == NULL)
-+ continue;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ status = qla2x00_suspend_target(ha, tq, time);
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+ }
-+
-+ return status;
-+}
-+
-+uint16_t
-+qla2x00_read_flash_image(scsi_qla_host_t *ha, uint8_t *usr_tmp, uint32_t saddr,
-+ uint32_t length)
-+{
-+ device_reg_t __iomem *reg = ha->iobase;
-+ uint32_t midpoint;
-+ uint8_t data;
-+ uint32_t ilength;
-+ uint16_t status = 0;
-+
-+ midpoint = length / 2;
-+ qla2x00_flash_enable(ha);
-+ WRT_REG_WORD(&reg->nvram, 0);
-+ RD_REG_WORD(&reg->nvram);
-+ for (ilength = 0; ilength < length; saddr++, ilength++, usr_tmp++) {
-+ if (ilength == midpoint) {
-+ WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-+ RD_REG_WORD(&reg->nvram);
-+ }
-+ data = qla2x00_read_flash_byte(ha, saddr);
-+ if (saddr % 100)
-+ udelay(10);
-+ __put_user(data, usr_tmp);
-+ }
-+ qla2x00_flash_disable(ha);
-+
-+ return (status);
-+}
-+
-+uint16_t
-+qla2x00_update_or_read_flash(scsi_qla_host_t *ha, uint8_t *image,
-+ uint32_t saddr, uint32_t length, uint8_t direction)
-+{
-+ uint16_t status;
-+ unsigned long flags;
-+ uint32_t cnt;
-+ device_reg_t __iomem *reg = ha->iobase;
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ return qla24xx_update_or_read_flash(ha, image, saddr, length,
-+ direction);
-+
-+ /* Not setting the timer so that tgt remains unsuspended */
-+ qla2x00_suspend_all_target(ha);
-+
-+ /* wait for big hammer to complete if it fails */
-+ status = qla2x00_cmd_wait(ha);
-+ if (status)
-+ status = qla2x00_wait_for_hba_online(ha);
-+
-+ if (status)
-+ return status;
-+
-+ /* Dont process mailbox cmd until flash operation is done */
-+ set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
-+
-+ qla2x00_disable_intrs(ha);
-+
-+ /* Pause RISC. */
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
-+ RD_REG_WORD(&reg->hccr);
-+ if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
-+ for (cnt = 0; cnt < 30000; cnt++) {
-+ if ((RD_REG_WORD(&reg->hccr) &
-+ HCCR_RISC_PAUSE) != 0)
-+ break;
-+ udelay(100);
-+ }
-+ } else {
-+ udelay(10);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
-+
-+ switch (direction) {
-+ case QLA2X00_READ:
-+ DEBUG9(printk("%s(%ld): Reading image=%p saddr=0x%x "
-+ "length=0x%x\n", __func__, ha->host_no, image, saddr,
-+ length));
-+ status = qla2x00_read_flash_image(ha, image, saddr, length);
-+ break;
-+
-+ case QLA2X00_WRITE:
-+ DEBUG9(printk("%s(%ld): Writing image=%p saddr=0x%x "
-+ "length=0x%x\n", __func__, ha->host_no, image, saddr,
-+ length));
-+ status = qla2x00_set_flash_image(ha, image, saddr, length);
-+ break;
-+ default:
-+ printk(KERN_INFO "%s unknown operation\n", __func__);
-+ break;
-+ }
-+
-+ /* Schedule DPC to restart the RISC */
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ up(ha->dpc_wait);
-+ qla2x00_wait_for_hba_online(ha);
-+
-+ clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
-+
-+ qla2x00_unsuspend_all_target(ha);
-+
-+ return status;
-+}
-+#endif
-
- //ISP 24xx
- //
-@@ -554,6 +1682,20 @@ qla24xx_get_flash_manufacturer(scsi_qla_
- ids = qla24xx_read_flash_dword(ha, flash_data_to_access_addr(0xd03ab));
- *man_id = LSB(ids);
- *flash_id = MSB(ids);
-+
-+ /* Check if man_id and flash_id are valid. */
-+ if (ids != 0xDEADDEAD && (*man_id == 0 || *flash_id == 0)) {
-+ /* Read information using 0x9f opcode
-+ * Device ID, Mfg ID would be read in the format:
-+ * <Ext Dev Info><Device ID Part2><Device ID Part 1><Mfg ID>
-+ * Example: ATMEL 0x00 01 45 1F
-+ * Extract MFG and Dev ID from last two bytes.
-+ */
-+ ids = qla24xx_read_flash_dword(ha,
-+ flash_data_to_access_addr(0xd009f));
-+ *man_id = LSB(ids);
-+ *flash_id = MSB(ids);
-+ }
- }
-
- int
-@@ -562,8 +1704,8 @@ qla24xx_write_flash_data(scsi_qla_host_t
- {
- int ret;
- uint32_t liter;
-- uint32_t sec_mask, rest_addr, conf_addr;
-- uint32_t fdata;
-+ uint32_t sec_mask, rest_addr, conf_addr, sec_end_mask;
-+ uint32_t fdata, findex ;
- uint8_t man_id, flash_id;
- struct device_reg_24xx __iomem *reg =
- (struct device_reg_24xx __iomem *)ha->iobase;
-@@ -574,6 +1716,7 @@ qla24xx_write_flash_data(scsi_qla_host_t
- DEBUG9(printk("%s(%ld): Flash man_id=%d flash_id=%d\n", __func__,
- ha->host_no, man_id, flash_id));
-
-+ sec_end_mask = 0;
- conf_addr = flash_conf_to_access_addr(0x03d8);
- switch (man_id) {
- case 0xbf: // STT flash
-@@ -586,6 +1729,12 @@ qla24xx_write_flash_data(scsi_qla_host_t
- rest_addr = 0x3fff;
- sec_mask = 0x3c000;
- break;
-+ case 0x1f: // Atmel 26DF081A
-+ rest_addr = 0x0fff;
-+ sec_mask = 0xff000;
-+ sec_end_mask = 0x003ff;
-+ conf_addr = flash_conf_to_access_addr(0x0320);
-+ break;
- default:
- // Default to 64 kb sector size
- rest_addr = 0x3fff;
-@@ -600,11 +1749,30 @@ qla24xx_write_flash_data(scsi_qla_host_t
-
- /* Disable flash write-protection. */
- qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0);
-+ /* Some flash parts need an additional zero-write to clear bits.*/
-+ qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0);
-
- do { /* Loop once to provide quick error exit. */
- for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
-+ if (man_id == 0x1f) {
-+ findex = faddr << 2;
-+ fdata = findex & sec_mask;
-+ } else {
-+ findex = faddr;
-+ fdata = (findex & sec_mask) << 2;
-+ }
-+
- /* Are we at the beginning of a sector? */
-- if ((faddr & rest_addr) == 0) {
-+ if ((findex & rest_addr) == 0) {
-+ /*
-+ * Do sector unprotect at 4K boundry for Atmel
-+ * part.
-+ */
-+ if (man_id == 0x1f)
-+ qla24xx_write_flash_dword(ha,
-+ flash_conf_to_access_addr(0x0339),
-+ (fdata & 0xff00) | ((fdata << 16) &
-+ 0xff0000) | ((fdata >> 16) & 0xff));
- fdata = (faddr & sec_mask) << 2;
- ret = qla24xx_write_flash_dword(ha, conf_addr,
- (fdata & 0xff00) |((fdata << 16) &
-@@ -625,6 +1793,14 @@ qla24xx_write_flash_data(scsi_qla_host_t
- ha->host_no, faddr, *dwptr));
- break;
- }
-+
-+ /* Do sector protect at 4K boundry for Atmel part. */
-+ if (man_id == 0x1f &&
-+ ((faddr & sec_end_mask) == 0x3ff))
-+ qla24xx_write_flash_dword(ha,
-+ flash_conf_to_access_addr(0x0336),
-+ (fdata & 0xff00) | ((fdata << 16) &
-+ 0xff0000) | ((fdata >> 16) & 0xff));
- }
- } while (0);
-
-@@ -710,3 +1886,232 @@ qla2x00_write_nvram_data(scsi_qla_host_t
- return ret;
- }
-
-+#ifdef CONFIG_SCSI_QLA2XXX_FAILOVER
-+uint16_t
-+qla24xx_update_or_read_flash(scsi_qla_host_t *ha, uint8_t *image,
-+ uint32_t saddr, uint32_t length, uint8_t direction)
-+{
-+ uint32_t status;
-+
-+ /* Not setting the timer so that tgt remains unsuspended */
-+ qla2x00_suspend_all_target(ha);
-+
-+ /* wait for big hammer to complete if it fails */
-+ status = qla2x00_cmd_wait(ha);
-+ if (status)
-+ qla2x00_wait_for_hba_online(ha);
-+
-+ /* Dont process mailbox cmd until flash operation is done */
-+ set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
-+
-+ qla2x00_disable_intrs(ha);
-+
-+ switch (direction) {
-+ case QLA2X00_READ:
-+ DEBUG9(printk("%s(%ld): Reading image=%p saddr=0x%x "
-+ "length=0x%x\n", __func__, ha->host_no, image, saddr >> 2,
-+ length >> 2));
-+ qla24xx_read_flash_data(ha, (uint32_t *)image, saddr >> 2,
-+ length >> 2);
-+ break;
-+
-+ case QLA2X00_WRITE:
-+ DEBUG9(printk("%s(%ld): Writing image=%p saddr=0x%x "
-+ "length=0x%x\n", __func__, ha->host_no, image, saddr >> 2,
-+ length >> 2));
-+ status = qla24xx_write_flash_data(ha, (uint32_t *)image,
-+ saddr >> 2, length >> 2);
-+ break;
-+ default:
-+ printk(KERN_INFO "%s unknown operation\n", __func__);
-+ break;
-+ }
-+
-+ if (ql2xfwloadbin == 1 && direction == QLA2X00_WRITE) {
-+ scsi_qla_host_t *hba2 = NULL;
-+
-+ /* Reset the first function */
-+ DEBUG9(printk("%s(%ld) resetting first function\n", __func__,
-+ ha->host_no));
-+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-+ up(ha->dpc_wait);
-+ qla2x00_wait_for_hba_online(ha);
-+
-+ /* Reset the second function if exist */
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each_entry(hba2, &qla_hostlist, list) {
-+ if (PCI_SLOT(hba2->pdev->devfn) ==
-+ PCI_SLOT(ha->pdev->devfn) &&
-+ PCI_FUNC(hba2->pdev->devfn) !=
-+ PCI_FUNC(ha->pdev->devfn)) {
-+ DEBUG9(printk("%s(%ld) resetting second "
-+ "function\n", __func__, hba2->host_no));
-+ set_bit(ISP_ABORT_NEEDED, &hba2->dpc_flags);
-+ up(hba2->dpc_wait);
-+ qla2x00_wait_for_hba_online(hba2);
-+ break;
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+ }
-+
-+ qla2x00_enable_intrs(ha);
-+
-+ clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
-+
-+ qla2x00_unsuspend_all_target(ha);
-+
-+ return status;
-+}
-+
-+int
-+qla24xx_get_flash_version(scsi_qla_host_t *ha, uint8_t *ptmp_mem)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint32_t pcihdr, pcids;
-+ uint32_t *dcode;
-+ uint8_t *bcode;
-+ uint8_t code_type, last_image;
-+ int i;
-+
-+
-+ if (ptmp_mem == NULL) {
-+ /* error */
-+ return(QLA_FUNCTION_FAILED);
-+ }
-+
-+ dcode = (uint32_t *)ptmp_mem;
-+
-+ /* Begin with first PCI expansion ROM header. */
-+ pcihdr = 0;
-+ last_image = 1;
-+ do {
-+ /* Verify PCI expansion ROM header. */
-+ qla24xx_read_flash_data(ha, dcode, pcihdr >> 2, 0x20);
-+ bcode = (uint8_t *)ptmp_mem + (pcihdr % 4);
-+ if (bcode[0x0] != 0x55 || bcode[0x1] != 0xaa) {
-+ /* No signature */
-+ DEBUG10(printk("scsi(%ld): No matching ROM signature.\n",
-+ ha->host_no));
-+ ret = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ /* Locate PCI data structure. */
-+ pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]);
-+
-+ qla24xx_read_flash_data(ha, dcode, pcids >> 2, 0x20);
-+ bcode = (uint8_t *)ptmp_mem + (pcihdr % 4);
-+
-+ /* Validate signature of PCI data structure. */
-+ if (bcode[0x0] != 'P' || bcode[0x1] != 'C' ||
-+ bcode[0x2] != 'I' || bcode[0x3] != 'R') {
-+ /* Incorrect header. */
-+ DEBUG10(printk("%s(): PCI data struct not found "
-+ "pcir_adr=%x.\n",
-+ __func__, pcids));
-+ ret = QLA_FUNCTION_FAILED;
-+ break;
-+ }
-+
-+ /* Read version */
-+ code_type = bcode[0x14];
-+ switch (code_type) {
-+ case ROM_CODE_TYPE_BIOS:
-+ /* Intel x86, PC-AT compatible. */
-+ set_bit(ROM_CODE_TYPE_BIOS, &ha->code_types);
-+ ha->bios_revision[0] = bcode[0x12];
-+ ha->bios_revision[1] = bcode[0x13];
-+ DEBUG9(printk("%s(): read BIOS %d.%d.\n", __func__,
-+ ha->bios_revision[1], ha->bios_revision[0]));
-+ break;
-+ case ROM_CODE_TYPE_FCODE:
-+ /* Open Firmware standard for PCI (FCode). */
-+ set_bit(ROM_CODE_TYPE_FCODE, &ha->code_types);
-+ ha->fcode_revision[0] = bcode[0x12];
-+ ha->fcode_revision[1] = bcode[0x13];
-+ DEBUG9(printk("%s(): read FCODE %d.%d.\n", __func__,
-+ ha->fcode_revision[1], ha->fcode_revision[0]));
-+ break;
-+ case ROM_CODE_TYPE_EFI:
-+ /* Extensible Firmware Interface (EFI). */
-+ set_bit(ROM_CODE_TYPE_EFI, &ha->code_types);
-+ ha->efi_revision[0] = bcode[0x12];
-+ ha->efi_revision[1] = bcode[0x13];
-+ DEBUG9(printk("%s(): read EFI %d.%d.\n", __func__,
-+ ha->efi_revision[1], ha->efi_revision[0]));
-+ break;
-+ default:
-+ DEBUG10(printk("%s(): Unrecognized code type %x at "
-+ "pcids %x.\n", __func__, code_type, pcids));
-+ break;
-+ }
-+
-+ last_image = bcode[0x15] & BIT_7;
-+
-+ /* Locate next PCI expansion ROM. */
-+ pcihdr += ((bcode[0x11] << 8) | bcode[0x10]) * 512;
-+ } while (!last_image);
-+
-+ /* Read firmware image information. */
-+ memset(ha->fw_revision, 0, sizeof(ha->fw_revision));
-+ dcode = (uint32_t *)ptmp_mem;
-+
-+ qla24xx_read_flash_data(ha, dcode, FA_RISC_CODE_ADDR + 4, 4);
-+ for (i = 0; i < 4; i++)
-+ dcode[i] = be32_to_cpu(dcode[i]);
-+
-+ if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
-+ dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
-+ (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
-+ dcode[3] == 0)) {
-+ DEBUG10(printk("%s(): Unrecognized fw version at %x.\n",
-+ __func__, FA_RISC_CODE_ADDR));
-+ } else {
-+ ha->fw_revision[0] = dcode[0];
-+ ha->fw_revision[1] = dcode[1];
-+ ha->fw_revision[2] = dcode[2];
-+ ha->fw_revision[3] = dcode[3];
-+ }
-+
-+ return ret;
-+}
-+
-+int
-+qla24xx_refresh_flash_version(scsi_qla_host_t *ha, uint8_t *ptmp_mem)
-+{
-+ unsigned long flags;
-+ int ret = 0;
-+ int status;
-+
-+ /* suspend targets */
-+ qla2x00_suspend_all_target(ha);
-+
-+ /* wait for big hammer to complete if it fails */
-+ status = qla2x00_cmd_wait(ha);
-+ if (status)
-+ qla2x00_wait_for_hba_online(ha);
-+
-+ /* Dont process mailbox cmd until flash
-+ * operation is done.
-+ */
-+ set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
-+
-+ qla2x00_disable_intrs(ha);
-+
-+ spin_lock_irqsave(&ha->hardware_lock, flags);
-+ if (qla24xx_get_flash_version(ha, ptmp_mem)) {
-+ ret = QLA_FUNCTION_FAILED;
-+ DEBUG9_10(printk( "%s: ERROR reading flash versions.\n",
-+ __func__));
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock,flags);
-+
-+ qla2x00_enable_intrs(ha);
-+ clear_bit(MBX_UPDATE_FLASH_ACTIVE,
-+ &ha->mbx_cmd_flags);
-+ qla2x00_unsuspend_all_target(ha);
-+
-+ return (ret);
-+}
-+#endif
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_version.h ./drivers/scsi/qla2xxx/qla_version.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_version.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qla_version.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,27 +1,16 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+
- /*
- * Driver version
- */
--#define QLA2XXX_VERSION "8.01.04-d7"
-+#define QLA2XXX_VERSION "8.01.05"
-
- #define QLA_DRIVER_MAJOR_VER 8
- #define QLA_DRIVER_MINOR_VER 1
--#define QLA_DRIVER_PATCH_VER 4
-+#define QLA_DRIVER_PATCH_VER 5
- #define QLA_DRIVER_BETA_VER 0
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qla_xioct.c ./drivers/scsi/qla2xxx/qla_xioct.c
---- ./drivers/scsi/qla2xxx.qla2xxx/qla_xioct.c 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/qla_xioct.c 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,6518 @@
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
-+ *
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-+#include "qla_def.h"
-+
-+#include <linux/blkdev.h>
-+#include <asm/uaccess.h>
-+#include <linux/vmalloc.h>
-+
-+#include "exioct.h"
-+#include "qla_foln.h"
-+#include "qlfoln.h"
-+#include "inioct.h"
-+
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+#include "qla_32ioctl.h"
-+#endif
-+
-+#define QLA_PT_CMD_DRV_TOV (ql2xioctltimeout + 1) /* drv timeout */
-+#define QLA_IOCTL_ACCESS_WAIT_TIME (ql2xioctltimeout + 10) /* wait_q tov */
-+#define QLA_INITIAL_IOCTLMEM_SIZE 8192
-+#define QLA_IOCTL_SCRAP_SIZE 16384 /* scrap memory for local use. */
-+
-+/* ELS related defines */
-+#define FC_HEADER_LEN 24
-+#define ELS_RJT_LENGTH 0x08 /* 8 */
-+#define ELS_RPS_ACC_LENGTH 0x40 /* 64 */
-+#define ELS_RLS_ACC_LENGTH 0x1C /* 28 */
-+
-+/* ELS cmd Reply Codes */
-+#define ELS_STAT_LS_RJT 0x01
-+#define ELS_STAT_LS_ACC 0x02
-+
-+#define IOCTL_INVALID_STATUS 0xffff
-+
-+
-+struct hba_ioctl {
-+ /* Ioctl cmd serialization */
-+ struct semaphore access_sem;
-+
-+ /* Passthru cmd/completion */
-+ struct semaphore cmpl_sem;
-+ struct timer_list cmpl_timer;
-+ uint8_t ioctl_tov;
-+ uint8_t SCSIPT_InProgress;
-+ uint8_t MSIOCB_InProgress;
-+
-+ os_tgt_t *ioctl_tq;
-+ os_lun_t *ioctl_lq;
-+
-+ /* AEN queue */
-+ void *aen_tracking_queue;/* points to async events buffer */
-+ uint8_t aen_q_head; /* index to the current head of q */
-+ uint8_t aen_q_tail; /* index to the current tail of q */
-+
-+ /* Misc. */
-+ uint32_t flags;
-+#define IOCTL_OPEN BIT_0
-+#define IOCTL_AEN_TRACKING_ENABLE BIT_1
-+ uint8_t *scrap_mem; /* per ha scrap buf for ioctl usage */
-+ uint32_t scrap_mem_size; /* total size */
-+ uint32_t scrap_mem_used; /* portion used */
-+};
-+
-+/*
-+ * From qla_inioctl.c
-+ */
-+extern int qla2x00_read_nvram(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_update_nvram(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_send_loopback(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_read_option_rom(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_update_option_rom(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_get_option_rom_layout(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_get_vpd(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_update_vpd(scsi_qla_host_t *, EXT_IOCTL *, int);
-+extern int qla2x00_get_sfp_data(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+/*
-+ * Local prototypes
-+ */
-+static int qla2x00_get_new_ioctl_dma_mem(scsi_qla_host_t *, uint32_t);
-+
-+static int qla2x00_find_curr_ha(uint16_t, scsi_qla_host_t **);
-+
-+static int qla2x00_get_driver_specifics(EXT_IOCTL *, scsi_qla_host_t *);
-+
-+static int qla2x00_aen_reg(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_aen_get(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+static int qla2x00_query(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_hba_node(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_hba_port(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_disc_port(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_disc_tgt(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_chip(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+static int qla2x00_get_data(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_get_statistics(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_get_fc_statistics(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_get_port_summary(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_get_fcport_summary(scsi_qla_host_t *, EXT_DEVICEDATAENTRY *,
-+ void *, uint32_t, uint32_t, uint32_t *, uint32_t *);
-+static int qla2x00_std_missing_port_summary(scsi_qla_host_t *,
-+ EXT_DEVICEDATAENTRY *, void *, uint32_t, uint32_t *, uint32_t *);
-+static int qla2x00_query_driver(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_query_fw(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+static int qla2x00_msiocb_passthru(scsi_qla_host_t *, EXT_IOCTL *, int, int);
-+static int qla2x00_send_els_passthru(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, fc_port_t *, fc_lun_t *, int);
-+static int qla2x00_send_fcct(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, fc_port_t *, fc_lun_t *, int);
-+static int qla2x00_ioctl_ms_queuecommand(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, fc_port_t *, fc_lun_t *, EXT_ELS_PT_REQ *);
-+static int qla2x00_start_ms_cmd(scsi_qla_host_t *, EXT_IOCTL *, srb_t *,
-+ EXT_ELS_PT_REQ *);
-+
-+static int qla2x00_wwpn_to_scsiaddr(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_scsi_passthru(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_sc_scsi_passthru(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, struct scsi_device *, int);
-+static int qla2x00_sc_fc_scsi_passthru(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, struct scsi_device *, int);
-+static int qla2x00_sc_scsi3_passthru(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, struct scsi_device *, int);
-+static int qla2x00_ioctl_scsi_queuecommand(scsi_qla_host_t *, EXT_IOCTL *,
-+ struct scsi_cmnd *, struct scsi_device *, fc_port_t *, fc_lun_t *);
-+
-+static int qla2x00_send_els_rnid(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_get_rnid_params(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_host_data(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_rnid_params(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+static int qla2x00_get_led_state(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_led_state(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_led_23xx(scsi_qla_host_t *, EXT_BEACON_CONTROL *,
-+ uint32_t *, uint32_t *);
-+
-+static int qla2x00_get_led_state(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_led_state(scsi_qla_host_t *, EXT_IOCTL *, int);
-+static int qla2x00_set_led_23xx(scsi_qla_host_t *, EXT_BEACON_CONTROL *,
-+ uint32_t *, uint32_t *);
-+static int qla2x00_set_led_24xx(scsi_qla_host_t *, EXT_BEACON_CONTROL *,
-+ uint32_t *, uint32_t *);
-+
-+static int qla2x00_get_tgt_lun_by_q(scsi_qla_host_t *, EXT_IOCTL *, int);
-+
-+
-+/* Init/Exit routines */
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-+static struct class *apidev_class;
-+#else
-+static struct class_simple *apidev_class;
-+#endif
-+static int apidev_major;
-+
-+static int
-+apidev_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ return (qla2x00_ioctl(NULL, (int)cmd, (void*)arg));
-+}
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
-+static long
-+qla2xxx_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
-+{
-+ int rval = -ENOIOCTLCMD;
-+
-+ lock_kernel();
-+ rval = apidev_ioctl(file->f_dentry->d_inode, file, cmd, arg);
-+ unlock_kernel();
-+
-+ return rval;
-+}
-+#endif
-+
-+static struct file_operations apidev_fops = {
-+ .owner = THIS_MODULE,
-+ .ioctl = apidev_ioctl,
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
-+ .compat_ioctl = qla2xxx_ioctl32,
-+#endif
-+};
-+
-+int
-+qla2x00_ioctl_init(void)
-+{
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-+ apidev_class = class_create(THIS_MODULE, "qla2xxx");
-+#else
-+ apidev_class = class_simple_create(THIS_MODULE, "qla2xxx");
-+#endif
-+ if (IS_ERR(apidev_class)) {
-+ DEBUG(printk("%s(): Unable to sysfs class for qla2xxx.\n",
-+ __func__));
-+
-+ apidev_class = NULL;
-+ return 1;
-+
-+ }
-+
-+ apidev_major = register_chrdev(0, "qla2xxx", &apidev_fops);
-+ if (apidev_major < 0) {
-+ DEBUG(printk("%s(): Unable to register CHAR device (%d)\n",
-+ __func__, apidev_major));
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-+ class_destroy(apidev_class);
-+#else
-+ class_simple_destroy(apidev_class);
-+#endif
-+ apidev_class = NULL;
-+
-+ return apidev_major;
-+ }
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-+ class_simple_device_add(apidev_class, MKDEV(apidev_major, 0), NULL,
-+ "qla2xxx");
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
-+ class_device_create(apidev_class, MKDEV(apidev_major, 0), NULL,
-+ "qla2xxx");
-+#else
-+ class_device_create(apidev_class, NULL, MKDEV(apidev_major, 0), NULL,
-+ "qla2xxx");
-+#endif
-+
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+ apidev_init_32ioctl_reg();
-+#endif
-+
-+ return 0;
-+}
-+
-+int
-+qla2x00_ioctl_exit(void)
-+{
-+ if (!apidev_class)
-+ return 1;
-+
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+ apidev_cleanup_32ioctl_unreg();
-+#endif
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-+ class_device_destroy(apidev_class, MKDEV(apidev_major, 0));
-+#else
-+ class_simple_device_remove(MKDEV(apidev_major, 0));
-+#endif
-+
-+ unregister_chrdev(apidev_major, "qla2xxx");
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-+ class_destroy(apidev_class);
-+#else
-+ class_simple_destroy(apidev_class);
-+#endif
-+
-+ apidev_class = NULL;
-+
-+ return 0;
-+}
-+
-+void *
-+Q64BIT_TO_PTR(uint64_t buf_addr, uint16_t addr_mode)
-+{
-+#if (defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)) || !defined(CONFIG_64BIT)
-+ union ql_doublelong {
-+ struct {
-+ uint32_t lsl;
-+ uint32_t msl;
-+ } longs;
-+ uint64_t dl;
-+ };
-+
-+ union ql_doublelong tmpval;
-+
-+ tmpval.dl = buf_addr;
-+/*
-+#if defined(CONFIG_X86_64)
-+ if (addr_mode == EXT_DEF_ADDR_MODE_32)
-+ return((void *)(uint64_t)(tmpval.longs.lsl));
-+ else
-+ return((void *)buf_addr);
-+*/
-+#if defined(CONFIG_COMPAT) && !defined(CONFIG_IA64)
-+ /* 32bit user - 64bit kernel */
-+ if (addr_mode == EXT_DEF_ADDR_MODE_32) {
-+ DEBUG9(printk("%s: got 32bit user address.\n", __func__));
-+ return((void *)(uint64_t)(tmpval.longs.lsl));
-+ } else {
-+ DEBUG9(printk("%s: got 64bit user address.\n", __func__));
-+ return((void *)buf_addr);
-+ }
-+#else
-+ return((void *)(tmpval.longs.lsl));
-+#endif
-+#else
-+ return((void *)buf_addr);
-+#endif
-+}
-+
-+/*****************************************************************************/
-+
-+/*
-+ * qla2x00_ioctl_sleep_done
-+ *
-+ * Description:
-+ * This is the callback function to wakeup ioctl completion semaphore
-+ * for the ioctl request that is waiting.
-+ *
-+ * Input:
-+ * sem - pointer to the ioctl completion semaphore.
-+ *
-+ * Returns:
-+ */
-+static void
-+qla2x00_ioctl_sleep_done(struct semaphore * sem)
-+{
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ if (sem != NULL){
-+ DEBUG9(printk("ioctl_sleep: wake up sem.\n"));
-+ up(sem);
-+ }
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+}
-+
-+/*
-+ * qla2x00_ioctl_sem_init
-+ *
-+ * Description:
-+ * Initialize the ioctl timer and semaphore used to wait for passthru
-+ * completion.
-+ *
-+ * Input:
-+ * ha - pointer to scsi_qla_host_t structure used for initialization.
-+ *
-+ * Returns:
-+ * None.
-+ */
-+static void
-+qla2x00_ioctl_sem_init(scsi_qla_host_t *ha)
-+{
-+ init_MUTEX_LOCKED(&ha->ioctl->cmpl_sem);
-+ init_timer(&(ha->ioctl->cmpl_timer));
-+ ha->ioctl->cmpl_timer.data = (unsigned long)&ha->ioctl->cmpl_sem;
-+ ha->ioctl->cmpl_timer.function =
-+ (void (*)(unsigned long))qla2x00_ioctl_sleep_done;
-+}
-+
-+/*
-+ * qla2x00_scsi_pt_done
-+ *
-+ * Description:
-+ * Resets ioctl progress flag and wakes up the ioctl completion semaphore.
-+ *
-+ * Input:
-+ * pscsi_cmd - pointer to the passthru Scsi cmd structure which has completed.
-+ *
-+ * Returns:
-+ */
-+static void
-+qla2x00_scsi_pt_done(struct scsi_cmnd *pscsi_cmd)
-+{
-+ struct Scsi_Host *host;
-+ scsi_qla_host_t *ha;
-+
-+ host = pscsi_cmd->device->host;
-+ ha = (scsi_qla_host_t *) host->hostdata;
-+
-+ DEBUG9(printk("%s post function called OK\n", __func__));
-+
-+ /* save detail status for IOCTL reporting */
-+ ha->ioctl->SCSIPT_InProgress = 0;
-+ ha->ioctl->ioctl_tov = 0;
-+ ha->ioctl_err_cmd = NULL;
-+
-+ up(&ha->ioctl->cmpl_sem);
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return;
-+}
-+
-+/*
-+ * qla2x00_msiocb_done
-+ *
-+ * Description:
-+ * Resets MSIOCB ioctl progress flag and wakes up the ioctl completion
-+ * semaphore.
-+ *
-+ * Input:
-+ * cmd - pointer to the passthru Scsi cmd structure which has completed.
-+ *
-+ * Returns:
-+ */
-+static void
-+qla2x00_msiocb_done(struct scsi_cmnd *pscsi_cmd)
-+{
-+ struct Scsi_Host *host;
-+ scsi_qla_host_t *ha;
-+
-+ host = pscsi_cmd->device->host;
-+ ha = (scsi_qla_host_t *) host->hostdata;
-+
-+ DEBUG9(printk("%s post function called OK\n", __func__));
-+
-+ ha->ioctl->MSIOCB_InProgress = 0;
-+ ha->ioctl->ioctl_tov = 0;
-+
-+ up(&ha->ioctl->cmpl_sem);
-+
-+ DEBUG9(printk("%s: exiting.\n", __func__));
-+
-+ return;
-+}
-+
-+/*************************************************************************
-+ * qla2x00_ioctl
-+ *
-+ * Description:
-+ * Performs additional ioctl requests not satisfied by the upper levels.
-+ *
-+ * Returns:
-+ * ret = 0 Success
-+ * ret != 0 Failed; detailed status copied to EXT_IOCTL structure
-+ * if possible
-+ *************************************************************************/
-+int
-+qla2x00_ioctl(struct scsi_device *dev, int cmd, void *arg)
-+{
-+ int mode = 0;
-+ int tmp_rval = 0;
-+ int ret = -EINVAL;
-+
-+ uint8_t *temp;
-+ uint8_t tempbuf[8];
-+ uint32_t i;
-+ uint32_t status;
-+
-+ EXT_IOCTL *pext;
-+
-+ scsi_qla_host_t *ha;
-+
-+
-+ DEBUG9(printk("%s: entry to command (%x), arg (%p)\n",
-+ __func__, cmd, arg));
-+
-+ /* Catch any non-exioct ioctls */
-+ if (_IOC_TYPE(cmd) != QLMULTIPATH_MAGIC) {
-+ return (ret);
-+ }
-+
-+ /* Allocate ioctl structure buffer to support multiple concurrent
-+ * entries.
-+ */
-+ pext = kmalloc(sizeof(EXT_IOCTL), GFP_KERNEL);
-+ if (pext == NULL) {
-+ /* error */
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in main ioctl buffer allocation.\n");
-+ return (-ENOMEM);
-+ }
-+
-+ /* copy in application layer EXT_IOCTL */
-+ ret = copy_from_user(pext, arg, sizeof(EXT_IOCTL));
-+ if (ret) {
-+ DEBUG9_10(printk("%s: ERROR COPY_FROM_USER "
-+ "EXT_IOCTL sturct. cmd=%x arg=%p.\n",
-+ __func__, cmd, arg));
-+
-+ kfree(pext);
-+ return (ret);
-+ }
-+
-+ /* check signature of this ioctl */
-+ temp = (uint8_t *) &pext->Signature;
-+
-+ for (i = 0; i < 4; i++, temp++)
-+ tempbuf[i] = *temp;
-+
-+ if ((tempbuf[0] == 'Q') && (tempbuf[1] == 'L') &&
-+ (tempbuf[2] == 'O') && (tempbuf[3] == 'G'))
-+ status = 0;
-+ else
-+ status = 1;
-+
-+ if (status != 0) {
-+ DEBUG9_10(printk("%s: signature did not match. "
-+ "cmd=%x arg=%p.\n", __func__, cmd, arg));
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ kfree(pext);
-+ return (ret);
-+ }
-+
-+ /* check version of this ioctl */
-+ if (pext->Version > EXT_VERSION) {
-+ printk(KERN_WARNING
-+ "qla2x00: ioctl interface version not supported = %d.\n",
-+ pext->Version);
-+
-+ kfree(pext);
-+ return (-EINVAL);
-+ }
-+
-+ /* check for special cmds used during application's setup time. */
-+ switch (cmd) {
-+ case EXT_CC_GET_HBA_CNT:
-+ DEBUG9(printk("%s: got startioctl command.\n", __func__));
-+
-+ pext->Instance = num_hosts;
-+ pext->Status = EXT_STATUS_OK;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ kfree(pext);
-+ return (ret);
-+
-+ case EXT_CC_SETINSTANCE:
-+ /* This call is used to return the HBA's host number to
-+ * ioctl caller. All subsequent ioctl commands will put
-+ * the host number in HbaSelect field to tell us which
-+ * HBA is the destination.
-+ */
-+ if (pext->Instance < num_hosts) {
-+ if (!(pext->VendorSpecificData &
-+ EXT_DEF_USE_HBASELECT)) {
-+ DEBUG9(printk(
-+ "%s: got setinstance cmd w/o HbaSelect.\n",
-+ __func__));
-+ /* Backward compatible code. */
-+ apiHBAInstance = pext->Instance;
-+ }
-+
-+ /*
-+ * Return host number via pext->HbaSelect for
-+ * specified API instance number.
-+ */
-+ if (qla2x00_find_curr_ha(pext->Instance, &ha) != 0) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ ret = copy_to_user(arg, pext,
-+ sizeof(EXT_IOCTL));
-+ DEBUG9_10(printk("%s: SETINSTANCE invalid inst "
-+ "%d. num_hosts=%d ha=%p ret=%d.\n",
-+ __func__, pext->Instance, num_hosts, ha,
-+ ret));
-+
-+ kfree(pext);
-+ return (ret); /* ioctl completed ok */
-+ }
-+
-+ pext->HbaSelect = ha->host_no;
-+ pext->Status = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s: Matching instance %d to hba "
-+ "%ld.\n", __func__, pext->Instance, ha->host_no));
-+ } else {
-+ DEBUG9_10(printk("%s: ERROR EXT_SETINSTANCE."
-+ " Instance=%d num_hosts=%d ha=%p.\n",
-+ __func__, pext->Instance, num_hosts, ha));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ }
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+ kfree(pext);
-+
-+ DEBUG9(printk("%s: SETINSTANCE exiting. ret=%d.\n",
-+ __func__, ret));
-+
-+ return (ret);
-+
-+ case EXT_CC_DRIVER_SPECIFIC:
-+ if (qla2x00_find_curr_ha(pext->HbaSelect, &ha) != 0) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+ } else {
-+ ret = qla2x00_get_driver_specifics(pext, ha);
-+ tmp_rval = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ if (ret == 0)
-+ ret = tmp_rval;
-+ }
-+
-+ kfree(pext);
-+ return (ret);
-+
-+ default:
-+ break;
-+ }
-+
-+ if (!(pext->VendorSpecificData & EXT_DEF_USE_HBASELECT)) {
-+ /* Backward compatible code. */
-+ /* Will phase out soon. */
-+
-+ /* Check for valid apiHBAInstance (set previously by
-+ * EXT_SETINSTANCE or default 0) and set ha context
-+ * for this IOCTL.
-+ */
-+ DEBUG9(printk("%s: not using HbaSelect. apiHBAInstance=%d.\n",
-+ __func__, apiHBAInstance));
-+ if (qla2x00_find_curr_ha(apiHBAInstance, &ha) != 0) {
-+
-+ DEBUG9_10(printk("%s: ERROR matching apiHBAInstance "
-+ "%d to an HBA Instance.\n",
-+ __func__, apiHBAInstance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ kfree(pext);
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: active apiHBAInstance=%d host_no=%ld "
-+ "CC=%x SC=%x.\n",
-+ __func__, apiHBAInstance, ha->host_no, cmd, pext->SubCode));
-+
-+ } else {
-+ /* Use HbaSelect value to get a matching ha instance
-+ * for this ioctl command.
-+ */
-+ if (qla2x00_find_curr_ha(pext->HbaSelect, &ha) != 0) {
-+
-+ DEBUG9_10(printk("%s: ERROR matching pext->HbaSelect "
-+ "%d to an HBA Instance.\n",
-+ __func__, pext->HbaSelect));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ kfree(pext);
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s: active host_inst=%ld CC=%x SC=%x.\n",
-+ __func__, ha->instance, cmd, pext->SubCode));
-+ }
-+
-+ /*
-+ * Get permission to process ioctl command. Only one will proceed
-+ * at a time.
-+ */
-+ if (qla2x00_down_timeout(&ha->ioctl->access_sem,
-+ QLA_IOCTL_ACCESS_WAIT_TIME * HZ) != 0) {
-+ /* error timed out */
-+ DEBUG9_10(printk("%s: ERROR timeout getting ioctl "
-+ "access. host no=%d.\n", __func__, pext->HbaSelect));
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ ret = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ kfree(pext);
-+ return (ret);
-+ }
-+
-+
-+ while (test_bit(CFG_ACTIVE, &ha->cfg_flags) || ha->dpc_active) {
-+ if (signal_pending(current))
-+ break; /* get out */
-+
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ schedule_timeout(HZ);
-+ }
-+
-+ switch (cmd) { /* switch on EXT IOCTL COMMAND CODE */
-+
-+ case EXT_CC_QUERY:
-+ DEBUG9(printk("%s: got query command.\n", __func__));
-+
-+ ret = qla2x00_query(ha, pext, 0);
-+
-+ break;
-+
-+ case EXT_CC_GET_DATA:
-+ DEBUG9(printk("%s: got get_data command.\n", __func__));
-+
-+ ret = qla2x00_get_data(ha, pext, 0);
-+
-+ break;
-+
-+ case EXT_CC_SEND_SCSI_PASSTHRU:
-+ DEBUG9(printk("%s: got SCSI passthru cmd.\n", __func__));
-+
-+ ret = qla2x00_scsi_passthru(ha, pext, mode);
-+
-+ break;
-+
-+ case EXT_CC_REG_AEN:
-+ ret = qla2x00_aen_reg(ha, pext, mode);
-+
-+ break;
-+
-+ case EXT_CC_GET_AEN:
-+ ret = qla2x00_aen_get(ha, pext, mode);
-+
-+ break;
-+
-+ case EXT_CC_WWPN_TO_SCSIADDR:
-+ ret = qla2x00_wwpn_to_scsiaddr(ha, pext, 0);
-+ break;
-+
-+ case EXT_CC_SEND_ELS_PASSTHRU:
-+ if (IS_QLA2100(ha) || IS_QLA2200(ha))
-+ goto fail;
-+ /*FALLTHROUGH*/
-+ case EXT_CC_SEND_FCCT_PASSTHRU:
-+ ret = qla2x00_msiocb_passthru(ha, pext, cmd, mode);
-+
-+ break;
-+
-+ case EXT_CC_SEND_ELS_RNID:
-+ DEBUG9(printk("%s: got ELS RNID cmd.\n", __func__));
-+
-+ ret = qla2x00_send_els_rnid(ha, pext, mode);
-+ break;
-+
-+ case EXT_CC_SET_DATA:
-+ ret = qla2x00_set_host_data(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_READ_NVRAM:
-+ ret = qla2x00_read_nvram(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_UPDATE_NVRAM:
-+ ret = qla2x00_update_nvram(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_LOOPBACK:
-+ ret = qla2x00_send_loopback(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_READ_OPTION_ROM:
-+ ret = qla2x00_read_option_rom(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_UPDATE_OPTION_ROM:
-+ ret = qla2x00_update_option_rom(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_GET_OPTION_ROM_LAYOUT:
-+ ret = qla2x00_get_option_rom_layout(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_GET_VPD:
-+ ret = qla2x00_get_vpd(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_UPDATE_VPD:
-+ ret = qla2x00_update_vpd(ha, pext, mode);
-+ break;
-+
-+ case INT_CC_GET_SFP_DATA:
-+ ret = qla2x00_get_sfp_data(ha, pext, mode);
-+ break;
-+
-+ /* all others go here */
-+ /*
-+ case EXT_CC_PLATFORM_REG:
-+ break;
-+ */
-+
-+#if defined(CONFIG_SCSI_QLA2XXX_FAILOVER)
-+ /* Failover IOCTLs */
-+ case FO_CC_GET_PARAMS:
-+ case FO_CC_SET_PARAMS:
-+ case FO_CC_GET_PATHS:
-+ case FO_CC_SET_CURRENT_PATH:
-+ case FO_CC_RESET_HBA_STAT:
-+ case FO_CC_GET_HBA_STAT:
-+ case FO_CC_GET_LUN_DATA:
-+ case FO_CC_SET_LUN_DATA:
-+ case FO_CC_GET_TARGET_DATA:
-+ case FO_CC_SET_TARGET_DATA:
-+ case FO_CC_GET_LBTYPE:
-+ case FO_CC_SET_LBTYPE:
-+ DEBUG9(printk("%s: failover arg (%p):\n", __func__, arg));
-+
-+ qla2x00_fo_ioctl(ha, cmd, pext, mode);
-+
-+ break;
-+#endif
-+
-+ default:
-+ fail:
-+ pext->Status = EXT_STATUS_INVALID_REQUEST;
-+ break;
-+
-+ } /* end of CC decode switch */
-+
-+ /* Always try to copy values back regardless what happened before. */
-+ tmp_rval = copy_to_user(arg, pext, sizeof(EXT_IOCTL));
-+
-+ if (ret == 0)
-+ ret = tmp_rval;
-+
-+ DEBUG9(printk("%s: exiting. tmp_rval(%d) ret(%d)\n",
-+ __func__, tmp_rval, ret));
-+
-+ up(&ha->ioctl->access_sem);
-+
-+ kfree(pext);
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_alloc_ioctl_mem
-+ * Allocates memory needed by IOCTL code.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_alloc_ioctl_mem(scsi_qla_host_t *ha)
-+{
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_new_ioctl_dma_mem(ha, QLA_INITIAL_IOCTLMEM_SIZE) !=
-+ QLA_SUCCESS) {
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl physical memory allocation\n");
-+
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+
-+ /* Allocate context memory buffer */
-+ ha->ioctl = kmalloc(sizeof(struct hba_ioctl), GFP_KERNEL);
-+ if (ha->ioctl == NULL) {
-+ /* error */
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl context allocation.\n");
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ memset(ha->ioctl, 0, sizeof(struct hba_ioctl));
-+
-+ /* Allocate AEN tracking buffer */
-+ ha->ioctl->aen_tracking_queue =
-+ kmalloc(EXT_DEF_MAX_AEN_QUEUE * sizeof(EXT_ASYNC_EVENT), GFP_KERNEL);
-+ if (ha->ioctl->aen_tracking_queue == NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl aen_queue allocation.\n");
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ memset(ha->ioctl->aen_tracking_queue, 0,
-+ EXT_DEF_MAX_AEN_QUEUE * sizeof(EXT_ASYNC_EVENT));
-+
-+ ha->ioctl->ioctl_tq = kmalloc(sizeof(os_tgt_t), GFP_KERNEL);
-+ if (ha->ioctl->ioctl_tq == NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl tgt queue allocation.\n");
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ memset(ha->ioctl->ioctl_tq, 0, sizeof(os_tgt_t));
-+
-+ ha->ioctl->ioctl_lq = kmalloc(sizeof(os_lun_t), GFP_KERNEL);
-+ if (ha->ioctl->ioctl_lq == NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl lun queue allocation.\n");
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ memset(ha->ioctl->ioctl_lq, 0, sizeof(os_lun_t));
-+
-+ /* Pick the largest size we'll need per ha of all ioctl cmds.
-+ * Use this size when freeing.
-+ */
-+ ha->ioctl->scrap_mem = kmalloc(QLA_IOCTL_SCRAP_SIZE, GFP_KERNEL);
-+ if (ha->ioctl->scrap_mem == NULL) {
-+ printk(KERN_WARNING
-+ "qla2x00: ERROR in ioctl scrap_mem allocation.\n");
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ memset(ha->ioctl->scrap_mem, 0, QLA_IOCTL_SCRAP_SIZE);
-+
-+ ha->ioctl->scrap_mem_size = QLA_IOCTL_SCRAP_SIZE;
-+ ha->ioctl->scrap_mem_used = 0;
-+ DEBUG9(printk("%s(%ld): scrap_mem_size=%d.\n",
-+ __func__, ha->host_no, ha->ioctl->scrap_mem_size));
-+
-+ ha->ioctl->ioctl_lq->q_state = LUN_STATE_READY;
-+ ha->ioctl->ioctl_lq->q_lock = SPIN_LOCK_UNLOCKED;
-+
-+ init_MUTEX(&ha->ioctl->access_sem);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla2x00_get_new_ioctl_dma_mem
-+ * Allocates dma memory of the specified size.
-+ * This is done to replace any previously allocated ioctl dma buffer.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_new_ioctl_dma_mem(scsi_qla_host_t *ha, uint32_t size)
-+{
-+ DEBUG9(printk("%s entered.\n", __func__));
-+
-+ if (ha->ioctl_mem) {
-+ DEBUG9(printk("%s: ioctl_mem was previously allocated. "
-+ "Dealloc old buffer.\n", __func__));
-+
-+ /* free the memory first */
-+ pci_free_consistent(ha->pdev, ha->ioctl_mem_size, ha->ioctl_mem,
-+ ha->ioctl_mem_phys);
-+ }
-+
-+ /* Get consistent memory allocated for ioctl I/O operations. */
-+ ha->ioctl_mem = dma_alloc_coherent(&ha->pdev->dev, size,
-+ &ha->ioctl_mem_phys, GFP_KERNEL);
-+ if (ha->ioctl_mem == NULL) {
-+ printk(KERN_WARNING
-+ "%s: ERROR in ioctl physical memory allocation. "
-+ "Requested length=%x.\n", __func__, size);
-+
-+ ha->ioctl_mem_size = 0;
-+ return QLA_MEMORY_ALLOC_FAILED;
-+ }
-+ ha->ioctl_mem_size = size;
-+
-+ DEBUG9(printk("%s exiting.\n", __func__));
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla2x00_free_ioctl_mem
-+ * Frees memory used by IOCTL code for the specified ha.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+void
-+qla2x00_free_ioctl_mem(scsi_qla_host_t *ha)
-+{
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (ha->ioctl) {
-+ kfree(ha->ioctl->scrap_mem);
-+ ha->ioctl->scrap_mem = NULL;
-+ ha->ioctl->scrap_mem_size = 0;
-+
-+ kfree(ha->ioctl->ioctl_tq);
-+ ha->ioctl->ioctl_tq = NULL;
-+
-+ kfree(ha->ioctl->ioctl_lq);
-+ ha->ioctl->ioctl_lq = NULL;
-+
-+ kfree(ha->ioctl->aen_tracking_queue);
-+ ha->ioctl->aen_tracking_queue = NULL;
-+
-+ kfree(ha->ioctl);
-+ ha->ioctl = NULL;
-+ }
-+
-+ /* free memory allocated for ioctl operations */
-+ if (ha->ioctl_mem)
-+ dma_free_coherent(&ha->pdev->dev, ha->ioctl_mem_size,
-+ ha->ioctl_mem, ha->ioctl_mem_phys);
-+ ha->ioctl_mem = NULL;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+}
-+
-+/*
-+ * qla2x00_get_ioctl_scrap_mem
-+ * Returns pointer to memory of the specified size from the scrap buffer.
-+ * This can be called multiple times before the free call as long
-+ * as the memory is to be used by the same ioctl command and
-+ * there's still memory left in the scrap buffer.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * ppmem = pointer to return a buffer pointer.
-+ * size = size of buffer to return.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+int
-+qla2x00_get_ioctl_scrap_mem(scsi_qla_host_t *ha, void **ppmem, uint32_t size)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint32_t free_mem;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered. size=%d.\n",
-+ __func__, ha->host_no, ha->instance, size));
-+
-+ free_mem = ha->ioctl->scrap_mem_size - ha->ioctl->scrap_mem_used;
-+ if (free_mem >= size) {
-+ *ppmem = ha->ioctl->scrap_mem + ha->ioctl->scrap_mem_used;
-+ ha->ioctl->scrap_mem_used += size;
-+ } else {
-+ DEBUG10(printk("%s(%ld): no more scrap memory.\n",
-+ __func__, ha->host_no));
-+
-+ ret = QLA_FUNCTION_FAILED;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): exiting. ret=%d.\n",
-+ __func__, ha->host_no, ret));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_free_ioctl_scrap_mem
-+ * Makes the entire scrap buffer free for use.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ */
-+void
-+qla2x00_free_ioctl_scrap_mem(scsi_qla_host_t *ha)
-+{
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ memset(ha->ioctl->scrap_mem, 0, ha->ioctl->scrap_mem_size);
-+ ha->ioctl->scrap_mem_used = 0;
-+
-+ DEBUG9(printk("%s(%ld): exiting.\n",
-+ __func__, ha->host_no));
-+}
-+
-+/*
-+ * qla2x00_find_curr_ha
-+ * Searches and returns the pointer to the adapter host_no specified.
-+ *
-+ * Input:
-+ * host_inst = driver internal adapter instance number to search.
-+ * ha = adapter state pointer of the instance requested.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_find_curr_ha(uint16_t host_inst, scsi_qla_host_t **ret_ha)
-+{
-+ int rval = QLA_SUCCESS;
-+ int found;
-+ struct list_head *hal;
-+ scsi_qla_host_t *search_ha = NULL;
-+
-+ /*
-+ * Set ha context for this IOCTL by matching host_no.
-+ */
-+ found = 0;
-+ read_lock(&qla_hostlist_lock);
-+ list_for_each(hal, &qla_hostlist) {
-+ search_ha = list_entry(hal, scsi_qla_host_t, list);
-+
-+ if (search_ha->instance == host_inst) {
-+ found++;
-+ break;
-+ }
-+ }
-+ read_unlock(&qla_hostlist_lock);
-+
-+ if (!found) {
-+ DEBUG10(printk("%s: ERROR matching host_inst "
-+ "%d to an HBA Instance.\n", __func__, host_inst));
-+ rval = QLA_FUNCTION_FAILED;
-+ } else {
-+ DEBUG9(printk("%s: found matching host_inst "
-+ "%d to an HBA Instance.\n", __func__, host_inst));
-+ *ret_ha = search_ha;
-+ }
-+
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_get_driver_specifics
-+ * Returns driver specific data in the response buffer.
-+ *
-+ * Input:
-+ * pext = pointer to EXT_IOCTL structure containing values from user.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_driver_specifics(EXT_IOCTL *pext, scsi_qla_host_t *ha)
-+{
-+ int ret = 0;
-+ EXT_LN_DRIVER_DATA data;
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ if (pext->ResponseLen < sizeof(EXT_LN_DRIVER_DATA)) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s: ERROR ResponseLen too small.\n",
-+ __func__));
-+
-+ return (ret);
-+ }
-+
-+ data.DrvVer.Major = QLA_DRIVER_MAJOR_VER;
-+ data.DrvVer.Minor = QLA_DRIVER_MINOR_VER;
-+ data.DrvVer.Patch = QLA_DRIVER_PATCH_VER;
-+ data.DrvVer.Beta = QLA_DRIVER_BETA_VER;
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ &data, sizeof(EXT_LN_DRIVER_DATA));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s: ERROR copy resp buf = %d.\n",
-+ __func__, ret));
-+ ret = -EFAULT;
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ }
-+
-+ DEBUG9(printk("%s: exiting. ret=%d.\n", __func__, ret));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_aen_reg
-+ * IOCTL management server Asynchronous Event Tracking Enable/Disable.
-+ *
-+ * Input:
-+ * ha = pointer to the adapter struct of the adapter to register.
-+ * cmd = pointer to EXT_IOCTL structure containing values from user.
-+ * mode = flags. not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_aen_reg(scsi_qla_host_t *ha, EXT_IOCTL *cmd, int mode)
-+{
-+ int rval = 0;
-+ EXT_REG_AEN reg_struct;
-+
-+ DEBUG9(printk("%s(%ld): inst %ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ rval = copy_from_user(&reg_struct, Q64BIT_TO_PTR(cmd->RequestAdr,
-+ cmd->AddrMode), sizeof(EXT_REG_AEN));
-+ if (rval == 0) {
-+ cmd->Status = EXT_STATUS_OK;
-+ if (reg_struct.Enable) {
-+ ha->ioctl->flags |= IOCTL_AEN_TRACKING_ENABLE;
-+ } else {
-+ ha->ioctl->flags &= ~IOCTL_AEN_TRACKING_ENABLE;
-+ }
-+ } else {
-+ DEBUG9(printk("%s(%ld): inst %ld copy error=%d.\n",
-+ __func__, ha->host_no, ha->instance, rval));
-+
-+ cmd->Status = EXT_STATUS_COPY_ERR;
-+ rval = -EFAULT;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst %ld reg_struct.Enable(%d) "
-+ "ha->ioctl_flag(%x) cmd->Status(%d).",
-+ __func__, ha->host_no, ha->instance, reg_struct.Enable,
-+ ha->ioctl->flags, cmd->Status));
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla2x00_aen_get
-+ * Asynchronous Event Record Transfer to user.
-+ * The entire queue will be emptied and transferred back.
-+ *
-+ * Input:
-+ * ha = pointer to the adapter struct of the specified adapter.
-+ * pext = pointer to EXT_IOCTL structure containing values from user.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ *
-+ * NOTE: Need to use hardware lock to protect the queues from updates
-+ * via isr/enqueue_aen after we get rid of io_request_lock.
-+ */
-+static int
-+qla2x00_aen_get(scsi_qla_host_t *ha, EXT_IOCTL *cmd, int mode)
-+{
-+ int rval = 0;
-+ EXT_ASYNC_EVENT *tmp_q;
-+ EXT_ASYNC_EVENT *paen;
-+ uint8_t i;
-+ uint8_t queue_cnt;
-+ uint8_t request_cnt;
-+ uint32_t stat = EXT_STATUS_OK;
-+ uint32_t ret_len = 0;
-+ unsigned long cpu_flags = 0;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ request_cnt = (uint8_t)(cmd->ResponseLen / sizeof(EXT_ASYNC_EVENT));
-+
-+ if (request_cnt < EXT_DEF_MAX_AEN_QUEUE) {
-+ /* We require caller to alloc for the maximum request count */
-+ cmd->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld Buffer size %ld too small. "
-+ "Exiting normally.",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)cmd->ResponseLen));
-+
-+ return (rval);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&paen,
-+ sizeof(EXT_ASYNC_EVENT) * EXT_DEF_MAX_AEN_QUEUE)) {
-+ /* not enough memory */
-+ cmd->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_ASYNC_EVENT)*EXT_DEF_MAX_AEN_QUEUE));
-+ return (rval);
-+ }
-+
-+ /* 1st: Make a local copy of the entire queue content. */
-+ tmp_q = (EXT_ASYNC_EVENT *)ha->ioctl->aen_tracking_queue;
-+ queue_cnt = 0;
-+
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ i = ha->ioctl->aen_q_head;
-+
-+ for (; queue_cnt < EXT_DEF_MAX_AEN_QUEUE;) {
-+ if (tmp_q[i].AsyncEventCode != 0) {
-+ memcpy(&paen[queue_cnt], &tmp_q[i],
-+ sizeof(EXT_ASYNC_EVENT));
-+ queue_cnt++;
-+ tmp_q[i].AsyncEventCode = 0; /* empty out the slot */
-+ }
-+
-+ if (i == ha->ioctl->aen_q_tail) {
-+ /* done. */
-+ break;
-+ }
-+
-+ i++;
-+
-+ if (i == EXT_DEF_MAX_AEN_QUEUE) {
-+ i = 0;
-+ }
-+ }
-+
-+ /* Empty the queue. */
-+ ha->ioctl->aen_q_head = 0;
-+ ha->ioctl->aen_q_tail = 0;
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ /* 2nd: Now transfer the queue content to user buffer */
-+ /* Copy the entire queue to user's buffer. */
-+ ret_len = (uint32_t)(queue_cnt * sizeof(EXT_ASYNC_EVENT));
-+ if (queue_cnt != 0) {
-+ rval = copy_to_user(Q64BIT_TO_PTR(cmd->ResponseAdr,
-+ cmd->AddrMode), paen, ret_len);
-+ }
-+ cmd->ResponseLen = ret_len;
-+
-+ if (rval != 0) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld copy FAILED. error = %d\n",
-+ __func__, ha->host_no, ha->instance, rval));
-+ rval = -EFAULT;
-+ stat = EXT_STATUS_COPY_ERR;
-+ } else {
-+ stat = EXT_STATUS_OK;
-+ }
-+
-+ cmd->Status = stat;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting. rval=%d.\n",
-+ __func__, ha->host_no, ha->instance, rval));
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla2x00_enqueue_aen
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * event_code = async event code of the event to add to queue.
-+ * payload = event payload for the queue.
-+ *
-+ * Context:
-+ * Interrupt context.
-+ * NOTE: Need to hold the hardware lock to protect the queues from
-+ * aen_get after we get rid of the io_request_lock.
-+ */
-+void
-+qla2x00_enqueue_aen(scsi_qla_host_t *ha, uint16_t event_code, void *payload)
-+{
-+ uint8_t new_entry; /* index to current entry */
-+ uint16_t *mbx;
-+ EXT_ASYNC_EVENT *aen_queue;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (!(ha->ioctl->flags & IOCTL_AEN_TRACKING_ENABLE))
-+ return;
-+
-+ aen_queue = (EXT_ASYNC_EVENT *)ha->ioctl->aen_tracking_queue;
-+ if (aen_queue[ha->ioctl->aen_q_tail].AsyncEventCode != 0) {
-+ /* Need to change queue pointers to make room. */
-+
-+ /* Increment tail for adding new entry. */
-+ ha->ioctl->aen_q_tail++;
-+ if (ha->ioctl->aen_q_tail == EXT_DEF_MAX_AEN_QUEUE) {
-+ ha->ioctl->aen_q_tail = 0;
-+ }
-+
-+ if (ha->ioctl->aen_q_head == ha->ioctl->aen_q_tail) {
-+ /*
-+ * We're overwriting the oldest entry, so need to
-+ * update the head pointer.
-+ */
-+ ha->ioctl->aen_q_head++;
-+ if (ha->ioctl->aen_q_head == EXT_DEF_MAX_AEN_QUEUE) {
-+ ha->ioctl->aen_q_head = 0;
-+ }
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld Adding code 0x%x to aen_q %p @ %d\n",
-+ __func__, ha->host_no, ha->instance, event_code, aen_queue,
-+ ha->ioctl->aen_q_tail));
-+
-+ new_entry = ha->ioctl->aen_q_tail;
-+ aen_queue[new_entry].AsyncEventCode = event_code;
-+
-+ /* Update payload */
-+ switch (event_code) {
-+ case MBA_LIP_OCCURRED:
-+ case MBA_LOOP_UP:
-+ case MBA_LOOP_DOWN:
-+ case MBA_LIP_RESET:
-+ case MBA_PORT_UPDATE:
-+ /* empty */
-+ break;
-+
-+ case MBA_RSCN_UPDATE:
-+ mbx = (uint16_t *)payload;
-+ aen_queue[new_entry].Payload.RSCN.AddrFormat = MSB(mbx[1]);
-+ /* domain */
-+ aen_queue[new_entry].Payload.RSCN.RSCNInfo[0] = LSB(mbx[1]);
-+ /* area */
-+ aen_queue[new_entry].Payload.RSCN.RSCNInfo[1] = MSB(mbx[2]);
-+ /* al_pa */
-+ aen_queue[new_entry].Payload.RSCN.RSCNInfo[2] = LSB(mbx[2]);
-+
-+ break;
-+
-+ default:
-+ /* Not supported */
-+ aen_queue[new_entry].AsyncEventCode = 0;
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+}
-+
-+/*
-+ * qla2x00_query
-+ * Handles all subcommands of the EXT_CC_QUERY command.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int rval = 0;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* All Query type ioctls are done here */
-+ switch(pext->SubCode) {
-+
-+ case EXT_SC_QUERY_HBA_NODE:
-+ /* fill in HBA NODE Information */
-+ rval = qla2x00_query_hba_node(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_HBA_PORT:
-+ /* return HBA PORT related info */
-+ rval = qla2x00_query_hba_port(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_DISC_PORT:
-+ /* return discovered port information */
-+ rval = qla2x00_query_disc_port(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_DISC_TGT:
-+ /* return discovered target information */
-+ rval = qla2x00_query_disc_tgt(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_CHIP:
-+ rval = qla2x00_query_chip(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_DISC_LUN:
-+ pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+
-+ default:
-+ DEBUG9_10(printk("%s(%ld): inst=%ld unknown SubCode %d.\n",
-+ __func__, ha->host_no, ha->instance, pext->SubCode));
-+ pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return rval;
-+}
-+
-+/*
-+ * qla2x00_query_hba_node
-+ * Handles EXT_SC_QUERY_HBA_NODE subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_hba_node(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint32_t i, transfer_size;
-+ EXT_HBA_NODE *ptmp_hba_node;
-+ uint8_t *next_str;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_hba_node,
-+ sizeof(EXT_HBA_NODE))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_NODE)));
-+ return (ret);
-+ }
-+
-+ /* fill all available HBA NODE Information */
-+ for (i = 0; i < 8 ; i++)
-+ ptmp_hba_node->WWNN[i] = ha->node_name[i];
-+
-+ sprintf((char *)(ptmp_hba_node->Manufacturer), "QLogic Corporation");
-+ sprintf((char *)(ptmp_hba_node->Model), ha->model_number);
-+
-+ ptmp_hba_node->SerialNum[0] = ha->serial0;
-+ ptmp_hba_node->SerialNum[1] = ha->serial1;
-+ ptmp_hba_node->SerialNum[2] = ha->serial2;
-+ sprintf((char *)(ptmp_hba_node->DriverVersion), qla2x00_version_str);
-+ sprintf((char *)(ptmp_hba_node->FWVersion),"%2d.%02d.%02d",
-+ ha->fw_major_version,
-+ ha->fw_minor_version,
-+ ha->fw_subminor_version);
-+ DEBUG9_10(printk("%s(%ld): inst=%ld fw ver=%02d.%02d.%02d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ha->fw_major_version, ha->fw_minor_version, ha->fw_subminor_version));
-+
-+ /* Option ROM version string. */
-+ memset(ptmp_hba_node->OptRomVersion, 0,
-+ sizeof(ptmp_hba_node->OptRomVersion));
-+ next_str = ptmp_hba_node->OptRomVersion;
-+ sprintf(next_str, "0.00");
-+ if (test_bit(ROM_CODE_TYPE_BIOS, &ha->code_types)) {
-+ sprintf(next_str, "%d.%02d", ha->bios_revision[1],
-+ ha->bios_revision[0]);
-+ }
-+ /* Extended Option ROM versions. */
-+ ptmp_hba_node->BIValid = 0;
-+ memset(ptmp_hba_node->BIEfiVersion, 0,
-+ sizeof(ptmp_hba_node->BIEfiVersion));
-+ memset(ptmp_hba_node->BIFCodeVersion, 0,
-+ sizeof(ptmp_hba_node->BIFCodeVersion));
-+ if (test_bit(ROM_CODE_TYPE_FCODE, &ha->code_types)) {
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ ptmp_hba_node->BIValid |= EXT_HN_BI_FCODE_VALID;
-+ ptmp_hba_node->BIFCodeVersion[0] = ha->fcode_revision[1];
-+ ptmp_hba_node->BIFCodeVersion[1] = ha->fcode_revision[0];
-+ } else {
-+ unsigned int barray[3];
-+
-+ memset (barray, 0, sizeof(barray));
-+ ptmp_hba_node->BIValid |= EXT_HN_BI_FCODE_VALID;
-+ sscanf(ha->fcode_revision, "%u.%u.%u", &barray[0],
-+ &barray[1], &barray[2]);
-+ ptmp_hba_node->BIFCodeVersion[0] = barray[0];
-+ ptmp_hba_node->BIFCodeVersion[1] = barray[1];
-+ ptmp_hba_node->BIFCodeVersion[2] = barray[2];
-+ }
-+ }
-+ if (test_bit(ROM_CODE_TYPE_EFI, &ha->code_types)) {
-+ ptmp_hba_node->BIValid |= EXT_HN_BI_EFI_VALID;
-+ ptmp_hba_node->BIEfiVersion[0] = ha->efi_revision[1];
-+ ptmp_hba_node->BIEfiVersion[1] = ha->efi_revision[0];
-+ }
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha) || IS_QLA2322(ha)) {
-+ ptmp_hba_node->BIValid |= EXT_HN_BI_FW_VALID;
-+ ptmp_hba_node->BIFwVersion[0] = ha->fw_revision[0];
-+ ptmp_hba_node->BIFwVersion[1] = ha->fw_revision[1];
-+ ptmp_hba_node->BIFwVersion[2] = ha->fw_revision[2];
-+ ptmp_hba_node->BIFwVersion[3] = ha->fw_revision[3];
-+
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld fw rev=%04d.%04d.%04d.%04d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ha->fw_revision[0], ha->fw_revision[1],
-+ ha->fw_revision[2], ha->fw_revision[3]));
-+ }
-+
-+ ptmp_hba_node->InterfaceType = EXT_DEF_FC_INTF_TYPE;
-+ ptmp_hba_node->PortCount = 1;
-+ ptmp_hba_node->DriverAttr = 0;
-+
-+#if defined(CONFIG_SCSI_QLA2XXX_FAILOVER)
-+ if (qla2x00_failover_enabled(ha))
-+ ptmp_hba_node->DriverAttr |= DRVR_FO_ENABLED;
-+#endif
-+
-+ /* now copy up the HBA_NODE to user */
-+ if (pext->ResponseLen < sizeof(EXT_HBA_NODE))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_HBA_NODE);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_hba_node, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_query_hba_port
-+ * Handles EXT_SC_QUERY_HBA_PORT subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_hba_port(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint32_t tgt_cnt, tgt, transfer_size;
-+ uint32_t port_cnt;
-+ fc_port_t *fcport;
-+ EXT_HBA_PORT *ptmp_hba_port;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_hba_port,
-+ sizeof(EXT_HBA_PORT))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_PORT)));
-+ return (ret);
-+ }
-+
-+ /* reflect all HBA PORT related info */
-+ ptmp_hba_port->WWPN[7] = ha->port_name[7];
-+ ptmp_hba_port->WWPN[6] = ha->port_name[6];
-+ ptmp_hba_port->WWPN[5] = ha->port_name[5];
-+ ptmp_hba_port->WWPN[4] = ha->port_name[4];
-+ ptmp_hba_port->WWPN[3] = ha->port_name[3];
-+ ptmp_hba_port->WWPN[2] = ha->port_name[2];
-+ ptmp_hba_port->WWPN[1] = ha->port_name[1];
-+ ptmp_hba_port->WWPN[0] = ha->port_name[0];
-+ ptmp_hba_port->Id[0] = 0;
-+ ptmp_hba_port->Id[1] = ha->d_id.r.d_id[2];
-+ ptmp_hba_port->Id[2] = ha->d_id.r.d_id[1];
-+ ptmp_hba_port->Id[3] = ha->d_id.r.d_id[0];
-+ ptmp_hba_port->Type = EXT_DEF_INITIATOR_DEV;
-+
-+ switch (ha->current_topology) {
-+ case ISP_CFG_NL:
-+ case ISP_CFG_FL:
-+ ptmp_hba_port->Mode = EXT_DEF_LOOP_MODE;
-+ break;
-+
-+ case ISP_CFG_N:
-+ case ISP_CFG_F:
-+ ptmp_hba_port->Mode = EXT_DEF_P2P_MODE;
-+ break;
-+
-+ default:
-+ ptmp_hba_port->Mode = EXT_DEF_UNKNOWN_MODE;
-+ break;
-+ }
-+
-+ port_cnt = 0;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET) {
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld port "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x not target dev\n",
-+ __func__, ha->host_no, ha->instance,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+ continue;
-+ }
-+
-+ /* if removed or missing */
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld port "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x not online\n",
-+ __func__, ha->host_no, ha->instance,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7]));
-+ continue;
-+ }
-+ port_cnt++;
-+ }
-+
-+ tgt_cnt = 0;
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (ha->otgt[tgt] == NULL) {
-+ continue;
-+ }
-+ if (ha->otgt[tgt]->fcport == NULL) {
-+ /* port doesn't exist */
-+ DEBUG9(printk("%s(%ld): tgt %d port not exist.\n",
-+ __func__, ha->host_no, tgt));
-+ continue;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld found port at %d. ",
-+ __func__, ha->host_no, ha->instance, tgt));
-+ DEBUG9(printk("ostgtid=%d, flags=%x, tgt_q=%p, cfg_id=%d.\n",
-+ ha->otgt[tgt]->fcport->os_target_id,
-+ ha->otgt[tgt]->fcport->flags,
-+ ha->otgt[tgt]->fcport->tgt_queue,
-+ ha->otgt[tgt]->fcport->cfg_id));
-+
-+ tgt_cnt++;
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld disc_port cnt=%d, tgt cnt=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ port_cnt, tgt_cnt));
-+ ptmp_hba_port->DiscPortCount = port_cnt;
-+ ptmp_hba_port->DiscTargetCount = tgt_cnt;
-+
-+ if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
-+ atomic_read(&ha->loop_state) == LOOP_DEAD) {
-+ ptmp_hba_port->State = EXT_DEF_HBA_LOOP_DOWN;
-+ } else if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags)) {
-+
-+ ptmp_hba_port->State = EXT_DEF_HBA_SUSPENDED;
-+ } else {
-+ ptmp_hba_port->State = EXT_DEF_HBA_OK;
-+ }
-+
-+ ptmp_hba_port->DiscPortNameType = EXT_DEF_USE_PORT_NAME;
-+
-+ /* Return supported FC4 type depending on driver support. */
-+ ptmp_hba_port->PortSupportedFC4Types = EXT_DEF_FC4_TYPE_SCSI;
-+ ptmp_hba_port->PortActiveFC4Types = EXT_DEF_FC4_TYPE_SCSI;
-+ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-+ ptmp_hba_port->PortSupportedFC4Types |= EXT_DEF_FC4_TYPE_IP;
-+ ptmp_hba_port->PortActiveFC4Types |= EXT_DEF_FC4_TYPE_IP;
-+ }
-+
-+ /* Return supported speed depending on adapter type */
-+ if (IS_QLA2100(ha) || IS_QLA2200(ha))
-+ ptmp_hba_port->PortSupportedSpeed = EXT_DEF_PORTSPEED_1GBIT;
-+ else
-+ ptmp_hba_port->PortSupportedSpeed = EXT_DEF_PORTSPEED_2GBIT;
-+
-+ switch (ha->link_data_rate) {
-+ case 0:
-+ ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_1GBIT;
-+ break;
-+ case 1:
-+ ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_2GBIT;
-+ break;
-+ case 3:
-+ ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_4GBIT;
-+ break;
-+ case 4:
-+ ptmp_hba_port->PortSpeed = EXT_DEF_PORTSPEED_10GBIT;
-+ break;
-+ default:
-+ /* unknown */
-+ ptmp_hba_port->PortSpeed = 0;
-+ break;
-+ }
-+
-+ /* now copy up the HBA_PORT to user */
-+ if (pext->ResponseLen < sizeof(EXT_HBA_PORT))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_HBA_PORT);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_hba_port, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return ret;
-+}
-+
-+/*
-+ * qla2x00_query_disc_port
-+ * Handles EXT_SC_QUERY_DISC_PORT subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_disc_port(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ int found;
-+ uint32_t tgt, transfer_size, inst;
-+ fc_port_t *fcport;
-+ os_tgt_t *tq;
-+ EXT_DISC_PORT *ptmp_disc_port;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered. Port inst=%02d.\n",
-+ __func__, ha->host_no, ha->instance, pext->Instance));
-+
-+ inst = 0;
-+ found = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if(fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (atomic_read(&fcport->state) != FCS_ONLINE) {
-+ /* port does not exist anymore */
-+ DEBUG9(printk("%s(%ld): fcport marked lost. "
-+ "port=%02x%02x%02x%02x%02x%02x%02x%02x "
-+ "loop_id=%02x not online.\n",
-+ __func__, ha->host_no,
-+ fcport->port_name[0], fcport->port_name[1],
-+ fcport->port_name[2], fcport->port_name[3],
-+ fcport->port_name[4], fcport->port_name[5],
-+ fcport->port_name[6], fcport->port_name[7],
-+ fcport->loop_id));
-+ continue;
-+ }
-+
-+ if (inst != pext->Instance) {
-+ DEBUG9(printk("%s(%ld): found fcport %02d "
-+ "d_id=%02x%02x%02x. Skipping.\n",
-+ __func__, ha->host_no, inst,
-+ fcport->d_id.b.domain,
-+ fcport->d_id.b.area,
-+ fcport->d_id.b.al_pa));
-+
-+ inst++;
-+ continue;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld found matching fcport %02d "
-+ "online. d_id=%02x%02x%02x loop_id=%02x online.\n",
-+ __func__, ha->host_no, ha->instance, inst,
-+ fcport->d_id.b.domain,
-+ fcport->d_id.b.area,
-+ fcport->d_id.b.al_pa,
-+ fcport->loop_id));
-+
-+ /* Found the matching port still connected. */
-+ found++;
-+ break;
-+ }
-+
-+ if (!found) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld dev not found.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_disc_port,
-+ sizeof(EXT_DISC_PORT))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DISC_PORT)));
-+ return (ret);
-+ }
-+
-+ memcpy(ptmp_disc_port->WWNN, fcport->node_name, WWN_SIZE);
-+ memcpy(ptmp_disc_port->WWPN, fcport->port_name, WWN_SIZE);
-+
-+ ptmp_disc_port->Id[0] = 0;
-+ ptmp_disc_port->Id[1] = fcport->d_id.r.d_id[2];
-+ ptmp_disc_port->Id[2] = fcport->d_id.r.d_id[1];
-+ ptmp_disc_port->Id[3] = fcport->d_id.r.d_id[0];
-+
-+ /* Currently all devices on fcport list are target capable devices */
-+ /* This default value may need to be changed after we add non target
-+ * devices also to this list.
-+ */
-+ ptmp_disc_port->Type = EXT_DEF_TARGET_DEV;
-+
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
-+ ptmp_disc_port->Type |= EXT_DEF_FABRIC_DEV;
-+ }
-+ if (fcport->flags & FC_TAPE_PRESENT) {
-+ ptmp_disc_port->Type |= EXT_DEF_TAPE_DEV;
-+ }
-+ if (fcport->port_type == FCT_INITIATOR) {
-+ ptmp_disc_port->Type |= EXT_DEF_INITIATOR_DEV;
-+ }
-+
-+ ptmp_disc_port->LoopID = fcport->loop_id;
-+ ptmp_disc_port->Status = 0;
-+ ptmp_disc_port->Bus = 0;
-+
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if ((tq = ha->otgt[tgt]) == NULL) {
-+ continue;
-+ }
-+
-+ if (tq->fcport == NULL) /* dg 08/14/01 */
-+ continue;
-+
-+ if (memcmp(fcport->port_name, tq->fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+ ptmp_disc_port->TargetId = tgt;
-+ break;
-+ }
-+ }
-+
-+ /* now copy up the DISC_PORT to user */
-+ if (pext->ResponseLen < sizeof(EXT_DISC_PORT))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_DISC_PORT);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_disc_port, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_query_disc_tgt
-+ * Handles EXT_SC_QUERY_DISC_TGT subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_disc_tgt(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint32_t tgt, transfer_size, inst;
-+ uint32_t cnt, i;
-+ fc_port_t *tgt_fcport;
-+ os_tgt_t *tq;
-+ EXT_DISC_TARGET *ptmp_disc_target;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered for tgt inst %d.\n",
-+ __func__, ha->host_no, ha->instance, pext->Instance));
-+
-+ tq = NULL;
-+ for (tgt = 0, inst = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (ha->otgt[tgt] == NULL) {
-+ continue;
-+ }
-+ /* if wrong target id then skip to next entry */
-+ if (inst != pext->Instance) {
-+ inst++;
-+ continue;
-+ }
-+ tq = ha->otgt[tgt];
-+ break;
-+ }
-+
-+ if (tq == NULL || tgt == MAX_TARGETS) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld target dev not found. "
-+ "tq=%p, tgt=%d.\n",
-+ __func__, ha->host_no, ha->instance, tq, tgt));
-+ return (ret);
-+ }
-+
-+ if (tq->fcport == NULL) { /* dg 08/14/01 */
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld target %d port not found. "
-+ "tq=%p.\n",
-+ __func__, ha->host_no, ha->instance, tgt, tq));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_disc_target,
-+ sizeof(EXT_DISC_TARGET))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DISC_TARGET)));
-+ return (ret);
-+ }
-+
-+ tgt_fcport = tq->fcport;
-+ if (tgt_fcport->flags & (FC_XP_DEVICE|FC_NVSXXX_DEVICE))
-+ memcpy(ptmp_disc_target->WWNN, tq->node_name, WWN_SIZE);
-+ else
-+ memcpy(ptmp_disc_target->WWNN, tgt_fcport->node_name, WWN_SIZE);
-+ memcpy(ptmp_disc_target->WWPN, tgt_fcport->port_name, WWN_SIZE);
-+
-+ ptmp_disc_target->Id[0] = 0;
-+ ptmp_disc_target->Id[1] = tgt_fcport->d_id.r.d_id[2];
-+ ptmp_disc_target->Id[2] = tgt_fcport->d_id.r.d_id[1];
-+ ptmp_disc_target->Id[3] = tgt_fcport->d_id.r.d_id[0];
-+
-+ /* All devices on ha->otgt list are target capable devices. */
-+ ptmp_disc_target->Type = EXT_DEF_TARGET_DEV;
-+
-+ if (tgt_fcport->flags & FC_FABRIC_DEVICE) {
-+ ptmp_disc_target->Type |= EXT_DEF_FABRIC_DEV;
-+ }
-+ if (tgt_fcport->flags & FC_TAPE_PRESENT) {
-+ ptmp_disc_target->Type |= EXT_DEF_TAPE_DEV;
-+ }
-+ if (tgt_fcport->port_type & FCT_INITIATOR) {
-+ ptmp_disc_target->Type |= EXT_DEF_INITIATOR_DEV;
-+ }
-+
-+ ptmp_disc_target->LoopID = tgt_fcport->loop_id;
-+ ptmp_disc_target->Status = 0;
-+ if (atomic_read(&tq->fcport->state) != FCS_ONLINE) {
-+ ptmp_disc_target->Status |= EXT_DEF_TGTSTAT_OFFLINE;
-+ }
-+ if (qla2x00_is_fcport_in_config(ha, tq->fcport)) {
-+ ptmp_disc_target->Status |= EXT_DEF_TGTSTAT_IN_CFG;
-+ }
-+
-+ ptmp_disc_target->Bus = 0;
-+ ptmp_disc_target->TargetId = tgt;
-+
-+ cnt = 0;
-+ /* enumerate available LUNs under this TGT (if any) */
-+ if (ha->otgt[tgt] != NULL) {
-+ for (i = 0; i < MAX_LUNS ; i++) {
-+ if ((ha->otgt[tgt])->olun[i] !=0)
-+ cnt++;
-+ }
-+ }
-+
-+ ptmp_disc_target->LunCount = cnt;
-+
-+ DEBUG9(printk("%s(%ld): copying data for tgt id %d. ",
-+ __func__, ha->host_no, tgt));
-+ DEBUG9(printk("port=%p:%02x%02x%02x%02x%02x%02x%02x%02x. "
-+ "lun cnt=%d.\n",
-+ tgt_fcport,
-+ tgt_fcport->port_name[0],
-+ tgt_fcport->port_name[1],
-+ tgt_fcport->port_name[2],
-+ tgt_fcport->port_name[3],
-+ tgt_fcport->port_name[4],
-+ tgt_fcport->port_name[5],
-+ tgt_fcport->port_name[6],
-+ tgt_fcport->port_name[7],
-+ cnt));
-+
-+ /* now copy up the DISC_PORT to user */
-+ if (pext->ResponseLen < sizeof(EXT_DISC_PORT))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_DISC_TARGET);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_disc_target, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_query_chip
-+ * Handles EXT_SC_QUERY_CHIP subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_chip(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint32_t transfer_size, i;
-+ EXT_CHIP *ptmp_isp;
-+ struct Scsi_Host *host;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_isp,
-+ sizeof(EXT_CHIP))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_CHIP)));
-+ return (ret);
-+ }
-+
-+ host = ha->host;
-+ ptmp_isp->VendorId = ha->pdev->vendor;
-+ ptmp_isp->DeviceId = ha->pdev->device;
-+ ptmp_isp->SubVendorId = ha->pdev->subsystem_vendor;
-+ ptmp_isp->SubSystemId = ha->pdev->subsystem_device;
-+ ptmp_isp->PciBusNumber = ha->pdev->bus->number;
-+ ptmp_isp->PciDevFunc = ha->pdev->devfn;
-+ ptmp_isp->PciSlotNumber = PCI_SLOT(ha->pdev->devfn);
-+ ptmp_isp->DomainNr = pci_domain_nr(ha->pdev->bus);
-+ /* These values are not 64bit architecture safe. */
-+ ptmp_isp->IoAddr = 0; //(UINT32)ha->pio_address;
-+ ptmp_isp->IoAddrLen = 0; //(UINT32)ha->pio_length;
-+ ptmp_isp->MemAddr = 0; //(UINT32)ha->mmio_address;
-+ ptmp_isp->MemAddrLen = 0; //(UINT32)ha->mmio_length;
-+ ptmp_isp->ChipType = 0; /* ? */
-+ ptmp_isp->InterruptLevel = ha->pdev->irq;
-+
-+ for (i = 0; i < 8; i++)
-+ ptmp_isp->OutMbx[i] = 0;
-+
-+ /* now copy up the ISP to user */
-+ if (pext->ResponseLen < sizeof(EXT_CHIP))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_CHIP);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ptmp_isp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_get_data
-+ * Handles all subcommands of the EXT_CC_GET_DATA command.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_data(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int tmp_rval = 0;
-+
-+ switch(pext->SubCode) {
-+ case EXT_SC_GET_STATISTICS:
-+ tmp_rval = qla2x00_get_statistics(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_GET_FC_STATISTICS:
-+ tmp_rval = qla2x00_get_fc_statistics(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_GET_PORT_SUMMARY:
-+ tmp_rval = qla2x00_get_port_summary(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_DRIVER:
-+ tmp_rval = qla2x00_query_driver(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_QUERY_FW:
-+ tmp_rval = qla2x00_query_fw(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_GET_RNID:
-+ tmp_rval = qla2x00_get_rnid_params(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_GET_LUN_BY_Q:
-+ tmp_rval = qla2x00_get_tgt_lun_by_q(ha, pext, mode);
-+ break;
-+
-+ case EXT_SC_GET_BEACON_STATE:
-+ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-+ tmp_rval = qla2x00_get_led_state(ha, pext, mode);
-+ break;
-+ }
-+ /*FALLTHROUGH*/
-+
-+ default:
-+ DEBUG10(printk("%s(%ld): inst=%ld unknown SubCode %d.\n",
-+ __func__, ha->host_no, ha->instance, pext->SubCode));
-+ pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ return (tmp_rval);
-+}
-+
-+/*
-+ * qla2x00_get_statistics
-+ * Issues get_link_status mbx cmd and returns statistics
-+ * relavent to the specified adapter.
-+ *
-+ * Input:
-+ * ha = pointer to adapter struct of the specified adapter.
-+ * pext = pointer to EXT_IOCTL structure containing values from user.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_statistics(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ EXT_HBA_PORT_STAT *ptmp_stat;
-+ int ret = 0;
-+ link_stat_t stat_buf;
-+ uint8_t rval;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint16_t mb_stat[1];
-+ uint32_t transfer_size;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on loop down */
-+ if ((!IS_QLA24XX(ha) && !IS_QLA54XX(ha) &&
-+ atomic_read(&ha->loop_state) != LOOP_READY) ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-+ ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ /* Send mailbox cmd to get more. */
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-+ rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf,
-+ sizeof(stat_buf) / 4, mb_stat);
-+ else
-+ rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf,
-+ mb_stat);
-+ if (rval != QLA_SUCCESS) {
-+ if (rval == BIT_0) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ } else if (rval == BIT_1) {
-+ pext->Status = EXT_STATUS_MAILBOX;
-+ pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-+ } else {
-+ pext->Status = EXT_STATUS_ERR;
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR mailbox failed. "
-+ "mb[0]=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb_stat[0]));
-+ printk(KERN_WARNING
-+ "%s(%ld): inst=%ld ERROR mailbox failed. mb[0]=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb_stat[0]);
-+
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_stat,
-+ sizeof(EXT_HBA_PORT_STAT))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_PORT_STAT)));
-+ return (ret);
-+ }
-+
-+ ptmp_stat->ControllerErrorCount = ha->total_isp_aborts;
-+ ptmp_stat->DeviceErrorCount = ha->total_dev_errs;
-+ ptmp_stat->TotalIoCount = ha->total_ios;
-+ ptmp_stat->TotalMBytes = ha->total_bytes >> 20;
-+ ptmp_stat->TotalLipResets = ha->total_lip_cnt;
-+ /*
-+ ptmp_stat->TotalInterrupts = ha->total_isr_cnt;
-+ */
-+
-+ ptmp_stat->TotalLinkFailures = stat_buf.link_fail_cnt;
-+ ptmp_stat->TotalLossOfSync = stat_buf.loss_sync_cnt;
-+ ptmp_stat->TotalLossOfSignals = stat_buf.loss_sig_cnt;
-+ ptmp_stat->PrimitiveSeqProtocolErrorCount = stat_buf.prim_seq_err_cnt;
-+ ptmp_stat->InvalidTransmissionWordCount = stat_buf.inval_xmit_word_cnt;
-+ ptmp_stat->InvalidCRCCount = stat_buf.inval_crc_cnt;
-+
-+ /* now copy up the STATISTICS to user */
-+ if (pext->ResponseLen < sizeof(EXT_HBA_PORT_STAT))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_HBA_PORT_STAT);
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ptmp_stat;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_get_fc_statistics
-+ * Issues get_link_status mbx cmd to the target device with
-+ * the specified WWN and returns statistics relavent to the
-+ * device.
-+ *
-+ * Input:
-+ * ha = pointer to adapter struct of the specified device.
-+ * pext = pointer to EXT_IOCTL structure containing values from user.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_fc_statistics(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ EXT_HBA_PORT_STAT *ptmp_stat;
-+ EXT_DEST_ADDR addr_struct;
-+ fc_port_t *fcport;
-+ int port_found;
-+ link_stat_t stat_buf;
-+ int ret = 0;
-+ uint8_t rval;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint8_t *req_name;
-+ uint16_t mb_stat[1];
-+ uint32_t transfer_size;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ret = copy_from_user(&addr_struct, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy req buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ return (-EFAULT);
-+ }
-+
-+ /* find the device's loop_id */
-+ port_found = 0;
-+ fcport = NULL;
-+ switch (addr_struct.DestType) {
-+ case EXT_DEF_DESTTYPE_WWPN:
-+ req_name = addr_struct.DestAddr.WWPN;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (memcmp(fcport->port_name, req_name,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+ port_found = 1;
-+ break;
-+ }
-+ }
-+ break;
-+
-+ case EXT_DEF_DESTTYPE_WWNN:
-+ case EXT_DEF_DESTTYPE_PORTID:
-+ case EXT_DEF_DESTTYPE_FABRIC:
-+ case EXT_DEF_DESTTYPE_SCSI:
-+ default:
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR Unsupported subcode "
-+ "address type.\n", __func__, ha->host_no, ha->instance));
-+ return (ret);
-+
-+ break;
-+ }
-+
-+ if (!port_found) {
-+ /* not found */
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ pext->DetailStatus = EXT_DSTATUS_TARGET;
-+ return (ret);
-+ }
-+
-+ /* check for suspended/lost device */
-+ /*
-+ if (ha->fcport is suspended/lost) {
-+ pext->Status = EXT_STATUS_SUSPENDED;
-+ pext->DetailStatus = EXT_DSTATUS_TARGET;
-+ return pext->Status;
-+ }
-+ */
-+
-+ /* check on loop down */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-+ ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ /* Send mailbox cmd to get more. */
-+ if ((rval = qla2x00_get_link_status(ha, fcport->loop_id,
-+ &stat_buf, mb_stat)) != QLA_SUCCESS) {
-+ if (rval == BIT_0) {
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ } else if (rval == BIT_1) {
-+ pext->Status = EXT_STATUS_MAILBOX;
-+ pext->DetailStatus = EXT_DSTATUS_NOADNL_INFO;
-+ } else {
-+ pext->Status = EXT_STATUS_ERR;
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR mailbox failed. "
-+ "mb[0]=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb_stat[0]));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptmp_stat,
-+ sizeof(EXT_HBA_PORT_STAT))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_HBA_PORT_STAT)));
-+ return (ret);
-+ }
-+
-+ ptmp_stat->ControllerErrorCount = ha->total_isp_aborts;
-+ ptmp_stat->DeviceErrorCount = ha->total_dev_errs;
-+ ptmp_stat->TotalIoCount = ha->total_ios;
-+ ptmp_stat->TotalMBytes = ha->total_bytes >> 20;
-+ ptmp_stat->TotalLipResets = ha->total_lip_cnt;
-+ /*
-+ ptmp_stat->TotalInterrupts = ha->total_isr_cnt;
-+ */
-+
-+ ptmp_stat->TotalLinkFailures = stat_buf.link_fail_cnt;
-+ ptmp_stat->TotalLossOfSync = stat_buf.loss_sync_cnt;
-+ ptmp_stat->TotalLossOfSignals = stat_buf.loss_sig_cnt;
-+ ptmp_stat->PrimitiveSeqProtocolErrorCount = stat_buf.prim_seq_err_cnt;
-+ ptmp_stat->InvalidTransmissionWordCount = stat_buf.inval_xmit_word_cnt;
-+ ptmp_stat->InvalidCRCCount = stat_buf.inval_crc_cnt;
-+
-+ /* now copy up the STATISTICS to user */
-+ if (pext->ResponseLen < sizeof(EXT_HBA_PORT_STAT))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_HBA_PORT_STAT);
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ptmp_stat;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_get_port_summary
-+ * Handles EXT_SC_GET_PORT_SUMMARY subcommand.
-+ * Returns values of devicedata and dd_entry list.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_port_summary(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t entry_cnt = 0;
-+ uint32_t port_cnt = 0;
-+ uint32_t top_xfr_size;
-+ uint32_t usr_no_of_entries = 0;
-+ uint32_t device_types;
-+ void *start_of_entry_list;
-+ fc_port_t *fcport;
-+
-+ EXT_DEVICEDATA *pdevicedata;
-+ EXT_DEVICEDATAENTRY *pdd_entry;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pdevicedata,
-+ sizeof(EXT_DEVICEDATA))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "pdevicedata requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DEVICEDATA)));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pdd_entry,
-+ sizeof(EXT_DEVICEDATAENTRY))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "pdd_entry requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DEVICEDATAENTRY)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ /* Get device types to query. */
-+ device_types = 0;
-+ ret = copy_from_user(&device_types, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), sizeof(device_types));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-+ "copy_from_user() of struct failed ret=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ /* Get maximum number of entries allowed in response buf */
-+ usr_no_of_entries = pext->ResponseLen / sizeof(EXT_DEVICEDATAENTRY);
-+
-+ /* reserve some spaces to be filled in later. */
-+ top_xfr_size = sizeof(pdevicedata->ReturnListEntryCount) +
-+ sizeof(pdevicedata->TotalDevices);
-+
-+ start_of_entry_list = Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode) +
-+ top_xfr_size;
-+
-+ /* Start copying from devices that exist. */
-+ ret = qla2x00_get_fcport_summary(ha, pdd_entry, start_of_entry_list,
-+ device_types, usr_no_of_entries, &entry_cnt, &pext->Status);
-+
-+ DEBUG9(printk("%s(%ld): after get_fcport_summary, entry_cnt=%d.\n",
-+ __func__, ha->host_no, entry_cnt));
-+
-+ /* If there's still space in user buffer, return devices found
-+ * in config file which don't actually exist (missing).
-+ */
-+ if (ret == 0) {
-+ if (!qla2x00_failover_enabled(ha)) {
-+ ret = qla2x00_std_missing_port_summary(ha, pdd_entry,
-+ start_of_entry_list, usr_no_of_entries,
-+ &entry_cnt, &pext->Status);
-+ } else {
-+ ret = qla2x00_fo_missing_port_summary(ha, pdd_entry,
-+ start_of_entry_list, usr_no_of_entries,
-+ &entry_cnt, &pext->Status);
-+
-+ }
-+ }
-+
-+ DEBUG9(printk(
-+ "%s(%ld): after get_missing_port_summary. entry_cnt=%d.\n",
-+ __func__, ha->host_no, entry_cnt));
-+
-+ if (ret) {
-+ DEBUG9_10(printk("%s(%ld): failed getting port info.\n",
-+ __func__, ha->host_no));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ pdevicedata->ReturnListEntryCount = entry_cnt;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ port_cnt++;
-+ }
-+ if (port_cnt > entry_cnt)
-+ pdevicedata->TotalDevices = port_cnt;
-+ else
-+ pdevicedata->TotalDevices = entry_cnt;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld EXT_SC_GET_PORT_SUMMARY "
-+ "return entry cnt=%d port_cnt=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ entry_cnt, port_cnt));
-+
-+ /* copy top of devicedata, which is everything other than the
-+ * actual entry list data.
-+ */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pdevicedata;
-+ ret = copy_to_user(usr_temp, kernel_tmp, top_xfr_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp "
-+ "devicedata buffer=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_get_fcport_summary
-+ * Returns port values in user's dd_entry list.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pdd_entry = pointer to a temporary EXT_DEVICEDATAENTRY struct
-+ * pstart_of_entry_list = start of user addr of buffer for dd_entry entries
-+ * max_entries = max number of entries allowed by user buffer
-+ * pentry_cnt = pointer to total number of entries so far
-+ * ret_status = pointer to ioctl status field
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_fcport_summary(scsi_qla_host_t *ha, EXT_DEVICEDATAENTRY *pdd_entry,
-+ void *pstart_of_entry_list, uint32_t device_types, uint32_t max_entries,
-+ uint32_t *pentry_cnt, uint32_t *ret_status)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t b;
-+ uint32_t current_offset;
-+ uint32_t tgt;
-+ uint32_t transfer_size;
-+ fc_port_t *fcport;
-+ os_tgt_t *tq;
-+ mp_host_t *host = NULL;
-+ uint16_t idx;
-+ mp_device_t *tmp_dp = NULL;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (*pentry_cnt >= max_entries)
-+ break;
-+ if (fcport->port_type != FCT_TARGET) {
-+ /* Don't report initiators or broadcast devices. */
-+ DEBUG2_9_10(printk("%s(%ld): not reporting non-target "
-+ "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-+ "port_type=%x.\n",
-+ __func__, ha->host_no, fcport->port_name[0],
-+ fcport->port_name[1], fcport->port_name[2],
-+ fcport->port_name[3], fcport->port_name[4],
-+ fcport->port_name[5], fcport->port_name[6],
-+ fcport->port_name[7], fcport->port_type));
-+ continue;
-+ }
-+
-+ if ((atomic_read(&fcport->state) != FCS_ONLINE) &&
-+ !qla2x00_is_fcport_in_config(ha, fcport)) {
-+ /* no need to report */
-+ DEBUG2_9_10(printk("%s(%ld): not reporting "
-+ "fcport %02x%02x%02x%02x%02x%02x%02x%02x. "
-+ "state=%i, flags=%02x.\n",
-+ __func__, ha->host_no, fcport->port_name[0],
-+ fcport->port_name[1], fcport->port_name[2],
-+ fcport->port_name[3], fcport->port_name[4],
-+ fcport->port_name[5], fcport->port_name[6],
-+ fcport->port_name[7], atomic_read(&fcport->state),
-+ fcport->flags));
-+ continue;
-+ }
-+
-+ /* copy from fcport to dd_entry */
-+
-+ for (b = 0; b < 3 ; b++)
-+ pdd_entry->PortID[b] = fcport->d_id.r.d_id[2-b];
-+
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
-+ pdd_entry->ControlFlags = EXT_DEF_GET_FABRIC_DEVICE;
-+ } else {
-+ pdd_entry->ControlFlags = 0;
-+ }
-+
-+ pdd_entry->TargetAddress.Bus = 0;
-+ /* Retrieve 'Target' number for port */
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if ((tq = ha->otgt[tgt]) == NULL) {
-+ continue;
-+ }
-+
-+ if (tq->fcport == NULL)
-+ continue;
-+
-+ if (memcmp(fcport->port_name, tq->fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+ pdd_entry->TargetAddress.Target = tgt;
-+ if ((fcport->flags & (FC_XP_DEVICE|FC_NVSXXX_DEVICE)) &&
-+ !(device_types &
-+ EXT_DEF_GET_TRUE_NN_DEVICE)) {
-+ memcpy(pdd_entry->NodeWWN,
-+ tq->node_name, WWN_SIZE);
-+ } else {
-+ memcpy(pdd_entry->NodeWWN,
-+ fcport->node_name, WWN_SIZE);
-+ }
-+ break;
-+ }
-+ }
-+ if (tgt == MAX_TARGETS) {
-+ if (qla2x00_failover_enabled(ha)) {
-+ if (((host = qla2x00_cfg_find_host(ha)) !=
-+ NULL) && (fcport->flags & (FC_XP_DEVICE|FC_NVSXXX_DEVICE)) &&
-+ !(device_types &
-+ EXT_DEF_GET_TRUE_NN_DEVICE)) {
-+ if ((tmp_dp =
-+ qla2x00_find_mp_dev_by_portname(
-+ host, fcport->port_name,
-+ &idx)) != NULL)
-+ memcpy(pdd_entry->NodeWWN,
-+ tmp_dp->nodename, WWN_SIZE);
-+ } else
-+ memcpy(pdd_entry->NodeWWN,
-+ fcport->node_name, WWN_SIZE);
-+ } else
-+ memcpy(pdd_entry->NodeWWN, fcport->node_name,
-+ WWN_SIZE);
-+ }
-+ memcpy(pdd_entry->PortWWN, fcport->port_name, WWN_SIZE);
-+
-+ pdd_entry->TargetAddress.Lun = 0;
-+ pdd_entry->DeviceFlags = 0;
-+ pdd_entry->LoopID = fcport->loop_id;
-+ pdd_entry->BaseLunNumber = 0;
-+
-+ DEBUG9_10(printk("%s(%ld): reporting "
-+ "fcport %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, fcport->port_name[0],
-+ fcport->port_name[1], fcport->port_name[2],
-+ fcport->port_name[3], fcport->port_name[4],
-+ fcport->port_name[5], fcport->port_name[6],
-+ fcport->port_name[7]));
-+
-+ current_offset = *pentry_cnt * sizeof(EXT_DEVICEDATAENTRY);
-+
-+ transfer_size = sizeof(EXT_DEVICEDATAENTRY);
-+
-+ /* now copy up this dd_entry to user */
-+ usr_temp = (uint8_t *)pstart_of_entry_list + current_offset;
-+ kernel_tmp = (uint8_t *)pdd_entry;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-+ if (ret) {
-+ *ret_status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp "
-+ "entry list buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ return (-EFAULT);
-+ }
-+
-+ *pentry_cnt += 1;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_fo_missing_port_summary is in qla_fo.c
-+ */
-+
-+static int
-+qla2x00_std_missing_port_summary(scsi_qla_host_t *ha,
-+ EXT_DEVICEDATAENTRY *pdd_entry, void *pstart_of_entry_list,
-+ uint32_t max_entries, uint32_t *pentry_cnt, uint32_t *ret_status)
-+{
-+ int ret = QLA_SUCCESS;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint16_t idx;
-+ uint32_t b;
-+ uint32_t current_offset;
-+ uint32_t transfer_size;
-+ os_tgt_t *tq;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ for (idx = 0; idx < MAX_FIBRE_DEVICES && *pentry_cnt < max_entries;
-+ idx++) {
-+ if ((tq = TGT_Q(ha, idx)) == NULL)
-+ continue;
-+
-+ /* Target present in configuration data but
-+ * missing during device discovery*/
-+ if (tq->fcport == NULL) {
-+ DEBUG10(printk("%s: returning missing device "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__,
-+ tq->port_name[0],tq->port_name[1],
-+ tq->port_name[2],tq->port_name[3],
-+ tq->port_name[4],tq->port_name[5],
-+ tq->port_name[6],tq->port_name[7]));
-+
-+ /* This device was not found. Return
-+ * as unconfigured.
-+ */
-+ memcpy(pdd_entry->NodeWWN, tq->node_name, WWN_SIZE);
-+ memcpy(pdd_entry->PortWWN, tq->port_name, WWN_SIZE);
-+
-+ for (b = 0; b < 3 ; b++)
-+ pdd_entry->PortID[b] = 0;
-+
-+ /* assume fabric dev so api won't translate
-+ * the portid from loopid */
-+ pdd_entry->ControlFlags = EXT_DEF_GET_FABRIC_DEVICE;
-+
-+ pdd_entry->TargetAddress.Bus = 0;
-+ pdd_entry->TargetAddress.Target = idx;
-+ pdd_entry->TargetAddress.Lun = 0;
-+ pdd_entry->DeviceFlags = 0;
-+ pdd_entry->LoopID = 0;
-+ pdd_entry->BaseLunNumber = 0;
-+
-+ current_offset = *pentry_cnt *
-+ sizeof(EXT_DEVICEDATAENTRY);
-+
-+ transfer_size = sizeof(EXT_DEVICEDATAENTRY);
-+
-+ /* now copy up this dd_entry to user */
-+ usr_temp = (uint8_t *)pstart_of_entry_list +
-+ current_offset;
-+ kernel_tmp = (uint8_t *)pdd_entry;
-+ ret = copy_to_user(usr_temp, kernel_tmp,
-+ transfer_size);
-+ if (ret) {
-+ *ret_status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld "
-+ "ERROR copy rsp list buffer.\n",
-+ __func__, ha->host_no,
-+ ha->instance));
-+ ret = -EFAULT;
-+ break;
-+ } else {
-+ *pentry_cnt+=1;
-+ }
-+ }
-+ if (ret || *ret_status)
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting. ret=%d.\n", __func__,
-+ ha->host_no, ha->instance, ret));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_query_driver
-+ * Handles EXT_SC_QUERY_DRIVER subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_driver(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t transfer_size;
-+ EXT_DRIVER *pdriver_prop;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pdriver_prop,
-+ sizeof(EXT_DRIVER))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_DRIVER)));
-+ return (ret);
-+ }
-+
-+ sprintf(pdriver_prop->Version, qla2x00_version_str);
-+ pdriver_prop->NumOfBus = MAX_BUSES;
-+ pdriver_prop->TargetsPerBus = MAX_FIBRE_DEVICES;
-+ pdriver_prop->LunsPerTarget = MAX_LUNS;
-+ pdriver_prop->MaxTransferLen = 0xffffffff;
-+ pdriver_prop->MaxDataSegments = ha->host->sg_tablesize;
-+
-+ if (ha->flags.enable_64bit_addressing == 1)
-+ pdriver_prop->DmaBitAddresses = 64;
-+ else
-+ pdriver_prop->DmaBitAddresses = 32;
-+
-+ if (pext->ResponseLen < sizeof(EXT_DRIVER))
-+ transfer_size = pext->ResponseLen;
-+ else
-+ transfer_size = sizeof(EXT_DRIVER);
-+
-+ /* now copy up the ISP to user */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pdriver_prop;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_query_fw
-+ * Handles EXT_SC_QUERY_FW subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_query_fw(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t transfer_size;
-+ EXT_FW *pfw_prop;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pfw_prop,
-+ sizeof(EXT_FW))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_FW)));
-+ return (ret);
-+ }
-+
-+ pfw_prop->Version[0] = ha->fw_major_version;
-+ pfw_prop->Version[1] = ha->fw_minor_version;
-+ pfw_prop->Version[2] = ha->fw_subminor_version;
-+
-+ transfer_size = sizeof(EXT_FW);
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pfw_prop;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_size);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_msiocb_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext, int cmd,
-+ int mode)
-+{
-+ int ret = 0;
-+ fc_lun_t *ptemp_fclun = NULL; /* buf from scrap mem */
-+ fc_port_t *ptemp_fcport = NULL; /* buf from scrap mem */
-+ struct scsi_cmnd *pscsi_cmd = NULL; /* buf from scrap mem */
-+ struct scsi_device *pscsi_dev = NULL; /* buf from scrap mem */
-+ struct request *request = NULL;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on current topology */
-+ if ((ha->current_topology != ISP_CFG_F) &&
-+ (ha->current_topology != ISP_CFG_FL)) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR not in F/FL mode\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ if (ha->ioctl_mem_size <= 0) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha,
-+ QLA_INITIAL_IOCTLMEM_SIZE) != QLA_SUCCESS) {
-+
-+ DEBUG9_10(printk("%s: ERROR cannot alloc DMA "
-+ "buffer size=%x.\n",
-+ __func__, QLA_INITIAL_IOCTLMEM_SIZE));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+ }
-+
-+ if (pext->ResponseLen > ha->ioctl_mem_size) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-+ QLA_SUCCESS) {
-+
-+ DEBUG9_10(printk("%s: ERROR cannot alloc requested"
-+ "DMA buffer size %x.\n",
-+ __func__, pext->ResponseLen));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld rsp buf length larger than "
-+ "existing size. Additional mem alloc successful.\n",
-+ __func__, ha->host_no, ha->instance));
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld req buf verified.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi_cmd,
-+ sizeof(struct scsi_cmnd))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "cmd size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_cmnd)));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi_dev,
-+ sizeof(struct scsi_device))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "cmd size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_device)));
-+ return (ret);
-+ }
-+
-+ pscsi_cmd->device = pscsi_dev;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&request,
-+ sizeof(struct request))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct request)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+ pscsi_cmd->request = request;
-+ pscsi_cmd->request->nr_hw_segments = 1;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptemp_fcport,
-+ sizeof(fc_port_t))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "fcport size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(fc_port_t)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&ptemp_fclun,
-+ sizeof(fc_lun_t))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "fclun size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(fc_lun_t)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ /* initialize */
-+ memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
-+
-+ if (pscsi_cmd->timeout_per_command == 0)
-+ pscsi_cmd->timeout_per_command = (ql2xioctltimeout + 3) * HZ;
-+
-+ switch (cmd) {
-+ case EXT_CC_SEND_FCCT_PASSTHRU:
-+ DEBUG9(printk("%s: got CT passthru cmd.\n", __func__));
-+ ret = qla2x00_send_fcct(ha, pext, pscsi_cmd, ptemp_fcport,
-+ ptemp_fclun, mode);
-+ break;
-+ case EXT_CC_SEND_ELS_PASSTHRU:
-+ DEBUG9(printk("%s: got ELS passthru cmd.\n", __func__));
-+ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-+ ret = qla2x00_send_els_passthru(ha, pext, pscsi_cmd,
-+ ptemp_fcport, ptemp_fclun, mode);
-+ break;
-+ }
-+ /*FALLTHROUGH */
-+ default:
-+ DEBUG9_10(printk("%s: got invalid cmd.\n", __func__));
-+ break;
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_send_els_passthru
-+ * Passes the ELS command down to firmware as MSIOCB and
-+ * copies the response back when it completes.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_send_els_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd, fc_port_t *ptmp_fcport, fc_lun_t *ptmp_fclun,
-+ int mode)
-+{
-+ int ret = 0;
-+
-+ uint8_t invalid_wwn = 0;
-+ uint8_t *ptmp_stat;
-+ uint8_t *pusr_req_buf;
-+ uint8_t *presp_payload;
-+ uint32_t payload_len;
-+ uint32_t usr_req_len;
-+
-+ int found;
-+ uint16_t next_loop_id;
-+ fc_port_t *fcport;
-+
-+ EXT_ELS_PT_REQ *pels_pt_req;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ usr_req_len = pext->RequestLen - sizeof(EXT_ELS_PT_REQ);
-+ if (usr_req_len > ha->ioctl_mem_size) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR ReqLen too big=%x.\n",
-+ __func__, ha->host_no, ha->instance, pext->RequestLen));
-+
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pels_pt_req,
-+ sizeof(EXT_ELS_PT_REQ))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "els_pt_req size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_ELS_PT_REQ)));
-+ return (ret);
-+ }
-+
-+ /* copy request buffer */
-+
-+ ret = copy_from_user(pels_pt_req, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), sizeof(EXT_ELS_PT_REQ));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-+ "copy_from_user() of struct failed (%d).\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+
-+ return (-EFAULT);
-+ }
-+
-+ pusr_req_buf = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode) + sizeof(EXT_ELS_PT_REQ);
-+
-+ ret = copy_from_user(ha->ioctl_mem, pusr_req_buf, usr_req_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR"
-+ "copy_from_user() of request buf failed (%d).\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld after copy request.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on loop down (1) */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {
-+
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld before dest port validation- loop not "
-+ "ready; cannot proceed.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+
-+ return (ret);
-+ }
-+
-+ /*********************************/
-+ /* Validate the destination port */
-+ /*********************************/
-+
-+ /* first: WWN cannot be zero if no PID is specified */
-+ invalid_wwn = qla2x00_is_wwn_zero(pels_pt_req->WWPN);
-+ if (invalid_wwn && !(pels_pt_req->ValidMask & EXT_DEF_PID_VALID)) {
-+ /* error: both are not set. */
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR no valid WWPN/PID\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ /* second: it cannot be the local/current HBA itself */
-+ if (!invalid_wwn) {
-+ if (memcmp(ha->port_name, pels_pt_req->WWPN,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+
-+ /* local HBA specified. */
-+
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR local HBA's "
-+ "WWPN found.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+ } else { /* using PID */
-+ if (pels_pt_req->Id[1] == ha->d_id.r.d_id[2]
-+ && pels_pt_req->Id[2] == ha->d_id.r.d_id[1]
-+ && pels_pt_req->Id[3] == ha->d_id.r.d_id[0]) {
-+
-+ /* local HBA specified. */
-+
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR local HBA's "
-+ "PID found.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+ }
-+
-+ /************************/
-+ /* Now find the loop ID */
-+ /************************/
-+
-+ found = 0;
-+ fcport = NULL;
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_INITIATOR ||
-+ fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (!invalid_wwn) {
-+ /* search with WWPN */
-+ if (memcmp(pels_pt_req->WWPN, fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE))
-+ continue;
-+ } else {
-+ /* search with PID */
-+ if (pels_pt_req->Id[1] != fcport->d_id.r.d_id[2]
-+ || pels_pt_req->Id[2] != fcport->d_id.r.d_id[1]
-+ || pels_pt_req->Id[3] != fcport->d_id.r.d_id[0])
-+ continue;
-+ }
-+
-+ found++;
-+ }
-+
-+ if (!found) {
-+ /* invalid WWN or PID specified */
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR WWPN/PID invalid.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ /* If this is for a host device, check if we need to perform login */
-+ if (fcport->port_type == FCT_INITIATOR &&
-+ fcport->loop_id >= ha->last_loop_id) {
-+
-+ next_loop_id = 0;
-+ ret = qla2x00_fabric_login(ha, fcport, &next_loop_id);
-+ if (ret != QLA_SUCCESS) {
-+ /* login failed. */
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR login to "
-+ "host port failed. loop_id=%02x pid=%02x%02x%02x "
-+ "ret=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ fcport->loop_id, fcport->d_id.b.domain,
-+ fcport->d_id.b.area, fcport->d_id.b.al_pa, ret));
-+
-+ return (ret);
-+ }
-+ }
-+
-+ /* queue command */
-+ pels_pt_req->Lid = fcport->loop_id;
-+
-+ if ((ret = qla2x00_ioctl_ms_queuecommand(ha, pext, pscsi_cmd,
-+ ptmp_fcport, ptmp_fclun, pels_pt_req))) {
-+ return (ret);
-+ }
-+
-+ /* check on data returned */
-+ ptmp_stat = (uint8_t *)ha->ioctl_mem + FC_HEADER_LEN;
-+
-+ if (*ptmp_stat == ELS_STAT_LS_RJT) {
-+ payload_len = FC_HEADER_LEN + ELS_RJT_LENGTH;
-+
-+ } else if (*ptmp_stat == ELS_STAT_LS_ACC) {
-+ payload_len = pext->ResponseLen - sizeof(EXT_ELS_PT_REQ);
-+
-+ } else {
-+ /* invalid. just copy the status word. */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld invalid stat "
-+ "returned =0x%x.\n",
-+ __func__, ha->host_no, ha->instance, *ptmp_stat));
-+
-+ payload_len = FC_HEADER_LEN + 4;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld data dump-\n",
-+ __func__, ha->host_no, ha->instance));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)ptmp_stat,
-+ pext->ResponseLen - sizeof(EXT_ELS_PT_REQ) - FC_HEADER_LEN));
-+
-+ /* Verify response buffer to be written */
-+ /* The data returned include FC frame header */
-+ presp_payload = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode) + sizeof(EXT_ELS_PT_REQ);
-+
-+ /* copy back data returned to response buffer */
-+ ret = copy_to_user(presp_payload, ha->ioctl_mem, payload_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_send_fcct
-+ * Passes the FC CT command down to firmware as MSIOCB and
-+ * copies the response back when it completes.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_send_fcct(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd, fc_port_t *ptmp_fcport, fc_lun_t *ptmp_fclun,
-+ int mode)
-+{
-+ int ret = 0;
-+ int tmp_rval = 0;
-+ uint16_t mb[MAILBOX_REGISTER_COUNT];
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (pext->RequestLen > ha->ioctl_mem_size) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR ReqLen too big=%x.\n",
-+ __func__, ha->host_no, ha->instance, pext->RequestLen));
-+
-+ return (ret);
-+ }
-+
-+ /* copy request buffer */
-+ ret = copy_from_user(ha->ioctl_mem, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf. ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld after copy request.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on management server login status */
-+ if (ha->flags.management_server_logged_in == 0) {
-+ /* login to management server device */
-+
-+ tmp_rval = qla2x00_login_fabric(ha, MANAGEMENT_SERVER,
-+ 0xff, 0xff, 0xfa, &mb[0], BIT_1);
-+
-+ if (tmp_rval != 0 || mb[0] != 0x4000) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR login to MS.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ ha->flags.management_server_logged_in = 1;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): success login to MS.\n",
-+ __func__, ha->host_no));
-+
-+ /* queue command */
-+ if ((ret = qla2x00_ioctl_ms_queuecommand(ha, pext, pscsi_cmd,
-+ ptmp_fcport, ptmp_fclun, NULL))) {
-+ return (ret);
-+ }
-+
-+ if ((CMD_COMPL_STATUS(pscsi_cmd) != 0 &&
-+ CMD_COMPL_STATUS(pscsi_cmd) != CS_DATA_UNDERRUN &&
-+ CMD_COMPL_STATUS(pscsi_cmd) != CS_DATA_OVERRUN)||
-+ CMD_ENTRY_STATUS(pscsi_cmd) != 0) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld cmd returned error=%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ CMD_COMPL_STATUS(pscsi_cmd)));
-+ pext->Status = EXT_STATUS_ERR;
-+ return (ret);
-+ }
-+
-+ /* sending back data returned from Management Server */
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ha->ioctl_mem, pext->ResponseLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_ioctl_ms_queuecommand(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd, fc_port_t *pfcport, fc_lun_t *pfclun,
-+ EXT_ELS_PT_REQ *pels_pt_req)
-+{
-+ int ret = 0;
-+ int tmp_rval = 0;
-+ os_lun_t *plq;
-+ os_tgt_t *ptq;
-+
-+ srb_t *sp = NULL;
-+
-+ /* alloc sp */
-+ if ((sp = qla2x00_get_new_sp(ha)) == NULL) {
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s: ERROR cannot alloc sp %p.\n",
-+ __func__, sp));
-+
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld after alloc sp.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ DEBUG9(printk("%s(%ld): ioctl_tq=%p ioctl_lq=%p.\n",
-+ __func__, ha->host_no, ha->ioctl->ioctl_tq, ha->ioctl->ioctl_lq));
-+
-+ /* setup sp for this command */
-+ ptq = ha->ioctl->ioctl_tq;
-+ plq = ha->ioctl->ioctl_lq;
-+
-+ DEBUG9(printk("%s(%ld): pfclun=%p pfcport=%p pscsi_cmd=%p.\n",
-+ __func__, ha->host_no, pfclun, pfcport, pscsi_cmd));
-+
-+ sp->cmd = pscsi_cmd;
-+ sp->flags = SRB_IOCTL;
-+ sp->lun_queue = plq;
-+ sp->tgt_queue = ptq;
-+ pfclun->fcport = pfcport;
-+ pfclun->lun = 0;
-+ plq->fclun = pfclun;
-+ plq->fclun->fcport->ha = ha;
-+
-+ DEBUG9(printk("%s(%ld): pscsi_cmd->device=%p.\n",
-+ __func__, ha->host_no, pscsi_cmd->device));
-+
-+ /* init scsi_cmd */
-+ pscsi_cmd->device->host = ha->host;
-+ pscsi_cmd->scsi_done = qla2x00_msiocb_done;
-+
-+ /* check on loop down (2)- check again just before sending cmd out. */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld before issue cmd- loop "
-+ "not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld going to issue command.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ tmp_rval = qla2x00_start_ms_cmd(ha, pext, sp, pels_pt_req);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld after issue command.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (tmp_rval != 0) {
-+ /* We waited and post function did not get called */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld command timed out.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ pext->Status = EXT_STATUS_MS_NO_RESPONSE;
-+
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+
-+ return (ret);
-+ }
-+
-+ return (ret);
-+}
-+
-+
-+/*
-+ * qla2x00_start_ms_cmd
-+ * Allocates an MSIOCB request pkt and sends out the passthru cmd.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ *
-+ * Returns:
-+ * qla2x00 local function return status code.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_start_ms_cmd(scsi_qla_host_t *ha, EXT_IOCTL *pext, srb_t *sp,
-+ EXT_ELS_PT_REQ *pels_pt_req)
-+{
-+#define ELS_REQUEST_RCTL 0x22
-+#define ELS_REPLY_RCTL 0x23
-+
-+ uint32_t usr_req_len;
-+ uint32_t usr_resp_len;
-+
-+ ms_iocb_entry_t *pkt;
-+ unsigned long cpu_flags = 0;
-+
-+
-+ /* get spin lock for this operation */
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+
-+ /* Get MS request packet. */
-+ pkt = (ms_iocb_entry_t *)qla2x00_ms_req_pkt(ha, sp);
-+ if (pkt == NULL) {
-+ /* release spin lock and return error. */
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld MSIOCB PT - could not get "
-+ "Request Packet.\n", __func__, ha->host_no, ha->instance));
-+ return (QLA_MEMORY_ALLOC_FAILED);
-+ }
-+
-+ usr_req_len = pext->RequestLen;
-+ usr_resp_len = pext->ResponseLen;
-+
-+ if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ struct ct_entry_24xx *ct_pkt;
-+ struct els_entry_24xx *els_pkt;
-+
-+ ct_pkt = (struct ct_entry_24xx *)pkt;
-+ els_pkt = (struct els_entry_24xx *)pkt;
-+
-+ if (pels_pt_req != NULL) {
-+ /* ELS Passthru */
-+ usr_req_len -= sizeof(EXT_ELS_PT_REQ);
-+ usr_resp_len -= sizeof(EXT_ELS_PT_REQ);
-+
-+ els_pkt->entry_type = ELS_IOCB_TYPE;
-+ els_pkt->entry_count = 1;
-+ els_pkt->nport_handle = cpu_to_le16(pels_pt_req->Lid);
-+ els_pkt->tx_dsd_count = __constant_cpu_to_le16(1);
-+ els_pkt->rx_dsd_count = __constant_cpu_to_le16(1);
-+ els_pkt->rx_byte_count = cpu_to_le32(usr_resp_len);
-+ els_pkt->tx_byte_count = cpu_to_le32(usr_req_len);
-+ els_pkt->sof_type = EST_SOFI3; /* assume class 3 */
-+ els_pkt->opcode = 0;
-+ els_pkt->control_flags = 0;
-+
-+ if (pext->ResponseLen == 0) {
-+ memcpy(els_pkt->port_id, &pels_pt_req->Id[1],
-+ 3);
-+ }
-+
-+ els_pkt->tx_address[0] =
-+ cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ els_pkt->tx_address[1] =
-+ cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ els_pkt->tx_len = els_pkt->tx_byte_count;
-+ els_pkt->rx_address[0] =
-+ cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ els_pkt->rx_address[1] =
-+ cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ els_pkt->rx_len = els_pkt->rx_byte_count;
-+ } else {
-+ /* CT Passthru */
-+ ct_pkt->entry_type = CT_IOCB_TYPE;
-+ ct_pkt->entry_count = 1;
-+ ct_pkt->nport_handle =
-+ __constant_cpu_to_le16(MANAGEMENT_SERVER);
-+ ct_pkt->timeout = cpu_to_le16(ql2xioctltimeout);
-+ ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
-+ ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
-+ ct_pkt->rsp_byte_count = cpu_to_le32(usr_resp_len);
-+ ct_pkt->cmd_byte_count = cpu_to_le32(usr_req_len);
-+ ct_pkt->dseg_0_address[0] =
-+ cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ ct_pkt->dseg_0_address[1] =
-+ cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
-+ ct_pkt->dseg_1_address[0] =
-+ cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ ct_pkt->dseg_1_address[1] =
-+ cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
-+ }
-+ } else {
-+ pkt->entry_type = MS_IOCB_TYPE;
-+ pkt->entry_count = 1;
-+
-+ if (pels_pt_req != NULL) {
-+ /* process ELS passthru command */
-+ usr_req_len -= sizeof(EXT_ELS_PT_REQ);
-+ usr_resp_len -= sizeof(EXT_ELS_PT_REQ);
-+
-+ /* ELS passthru enabled */
-+ pkt->control_flags = cpu_to_le16(BIT_15);
-+ SET_TARGET_ID(ha, pkt->loop_id, pels_pt_req->Lid);
-+ pkt->type = 1; /* ELS frame */
-+
-+ if (pext->ResponseLen != 0) {
-+ pkt->r_ctl = ELS_REQUEST_RCTL;
-+ pkt->rx_id = 0;
-+ } else {
-+ pkt->r_ctl = ELS_REPLY_RCTL;
-+ pkt->rx_id =
-+ cpu_to_le16(pels_pt_req->Rxid);
-+ }
-+ } else {
-+ usr_req_len = pext->RequestLen;
-+ usr_resp_len = pext->ResponseLen;
-+ SET_TARGET_ID(ha, pkt->loop_id, MANAGEMENT_SERVER);
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld using loop_id=%02x "
-+ "req_len=%d, resp_len=%d. Initializing pkt.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pkt->loop_id.extended, usr_req_len, usr_resp_len));
-+
-+ pkt->timeout = cpu_to_le16(ql2xioctltimeout);
-+ pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
-+ pkt->total_dsd_count = __constant_cpu_to_le16(2);
-+ pkt->rsp_bytecount = cpu_to_le32(usr_resp_len);
-+ pkt->req_bytecount = cpu_to_le32(usr_req_len);
-+
-+ /*
-+ * Loading command payload address. user request is assumed
-+ * to have been copied to ioctl_mem.
-+ */
-+ pkt->dseg_req_address[0] = cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ pkt->dseg_req_address[1] = cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ pkt->dseg_req_length = cpu_to_le32(usr_req_len);
-+
-+ /* loading response payload address */
-+ pkt->dseg_rsp_address[0] = cpu_to_le32(LSD(ha->ioctl_mem_phys));
-+ pkt->dseg_rsp_address[1] =cpu_to_le32(MSD(ha->ioctl_mem_phys));
-+ pkt->dseg_rsp_length = cpu_to_le32(usr_resp_len);
-+ }
-+
-+ /* set flag to indicate IOCTL MSIOCB cmd in progress */
-+ ha->ioctl->MSIOCB_InProgress = 1;
-+ ha->ioctl->ioctl_tov = pkt->timeout + 1; /* 1 second more */
-+
-+ /* prepare for receiving completion. */
-+ qla2x00_ioctl_sem_init(ha);
-+
-+ /* Time the command via our standard driver-timer */
-+ if ((sp->cmd->timeout_per_command / HZ) > QLA_CMD_TIMER_DELTA)
-+ qla2x00_add_timer_to_cmd(sp,
-+ (sp->cmd->timeout_per_command/HZ) - QLA_CMD_TIMER_DELTA);
-+ else
-+ qla2x00_add_timer_to_cmd(sp, sp->cmd->timeout_per_command/HZ);
-+ /* Issue command to ISP */
-+ qla2x00_isp_cmd(ha);
-+
-+ ha->ioctl->cmpl_timer.expires = jiffies + ha->ioctl->ioctl_tov * HZ;
-+ add_timer(&ha->ioctl->cmpl_timer);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld releasing hardware_lock.\n",
-+ __func__, ha->host_no, ha->instance));
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld sleep for completion.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ down(&ha->ioctl->cmpl_sem);
-+
-+ del_timer(&ha->ioctl->cmpl_timer);
-+
-+ if (ha->ioctl->MSIOCB_InProgress == 1) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld timed out. exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return QLA_FUNCTION_FAILED;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return QLA_SUCCESS;
-+}
-+
-+/*
-+ * qla2x00_wwpn_to_scsiaddr
-+ * Handles the EXT_CC_WWPN_TO_SCSIADDR command.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_wwpn_to_scsiaddr(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ fc_port_t *tgt_fcport;
-+ os_tgt_t *tq;
-+ uint8_t tmp_wwpn[EXT_DEF_WWN_NAME_SIZE];
-+ uint32_t b, tgt, l;
-+ EXT_SCSI_ADDR tmp_addr;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (pext->RequestLen != EXT_DEF_WWN_NAME_SIZE ||
-+ pext->ResponseLen < sizeof(EXT_SCSI_ADDR)) {
-+ /* error */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld invalid WWN buffer size %d "
-+ "received.\n",
-+ __func__, ha->host_no, ha->instance, pext->ResponseLen));
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ return (ret);
-+ }
-+
-+ ret = copy_from_user(tmp_wwpn, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (ret) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy_from_user "
-+ "failed(%d) on request buf.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ return (-EFAULT);
-+ }
-+
-+ tq = NULL;
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if (ha->otgt[tgt] == NULL) {
-+ continue;
-+ }
-+
-+ tq = ha->otgt[tgt];
-+ if (tq->fcport == NULL) {
-+ break;
-+ }
-+
-+ tgt_fcport = tq->fcport;
-+ if (memcmp(tmp_wwpn, tgt_fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE) == 0) {
-+ break;
-+ }
-+ }
-+
-+ if (tq == NULL || tgt >= MAX_TARGETS) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld target dev not found. "
-+ "tq=%p, tgt=%x.\n", __func__, ha->host_no, ha->instance,
-+ tq, tgt));
-+ return (ret);
-+ }
-+
-+ if (tq->fcport == NULL) { /* dg 08/14/01 */
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld target port not found. "
-+ "tq=%p, tgt=%x.\n",
-+ __func__, ha->host_no, ha->instance, tq, tgt));
-+ return (ret);
-+ }
-+
-+ /* Currently we only have bus 0 and no translation on LUN */
-+ b = 0;
-+ l = 0;
-+
-+ /*
-+ * Return SCSI address. Currently no translation is done for
-+ * LUN.
-+ */
-+ tmp_addr.Bus = b;
-+ tmp_addr.Target = tgt;
-+ tmp_addr.Lun = l;
-+ if (pext->ResponseLen > sizeof(EXT_SCSI_ADDR))
-+ pext->ResponseLen = sizeof(EXT_SCSI_ADDR);
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ &tmp_addr, pext->ResponseLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+
-+ DEBUG9(printk(KERN_INFO
-+ "%s(%ld): Found t%d l%d for %02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no,
-+ tmp_addr.Target, tmp_addr.Lun,
-+ tmp_wwpn[0], tmp_wwpn[1], tmp_wwpn[2], tmp_wwpn[3],
-+ tmp_wwpn[4], tmp_wwpn[5], tmp_wwpn[6], tmp_wwpn[7]));
-+
-+ pext->Status = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_ioctl_passthru_rsp_handling
-+ * Handles the return status for IOCTL passthru commands.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * pscsi_cmd = pointer to scsi command.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static inline int
-+qla2x00_ioctl_passthru_rsp_handling(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd)
-+{
-+ int ret = 0;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (ha->ioctl->SCSIPT_InProgress == 1) {
-+ printk(KERN_WARNING
-+ "qla2x00: scsi%ld ERROR passthru command timeout.\n",
-+ ha->host_no);
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ ret = 1;
-+ return (ret);
-+ }
-+
-+ if (CMD_COMPL_STATUS(pscsi_cmd) == (int)IOCTL_INVALID_STATUS) {
-+ DEBUG9(printk("%s(%ld): inst=%ld ERROR - cmd not completed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_ERR;
-+ ret = 1;
-+ return (ret);
-+ }
-+
-+ switch (CMD_COMPL_STATUS(pscsi_cmd)) {
-+ case CS_INCOMPLETE:
-+ case CS_ABORTED:
-+ case CS_PORT_UNAVAILABLE:
-+ case CS_PORT_LOGGED_OUT:
-+ case CS_PORT_CONFIG_CHG:
-+ case CS_PORT_BUSY:
-+ case CS_TIMEOUT:
-+ DEBUG9_10(printk("%s(%ld): inst=%ld cs err = %x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ CMD_COMPL_STATUS(pscsi_cmd)));
-+ pext->Status = EXT_STATUS_BUSY;
-+ ret = 1;
-+ return (ret);
-+ case CS_RESET:
-+ case CS_QUEUE_FULL:
-+ pext->Status = EXT_STATUS_ERR;
-+ break;
-+ case CS_DATA_OVERRUN:
-+ pext->Status = EXT_STATUS_DATA_OVERRUN;
-+ DEBUG9_10(printk(KERN_INFO
-+ "%s(%ld): inst=%ld return overrun.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ case CS_DATA_UNDERRUN:
-+ pext->Status = EXT_STATUS_DATA_UNDERRUN;
-+ DEBUG9_10(printk(KERN_INFO
-+ "%s(%ld): inst=%ld return underrun.\n",
-+ __func__, ha->host_no, ha->instance));
-+ if (CMD_SCSI_STATUS(pscsi_cmd) & SS_RESIDUAL_UNDER) {
-+ pext->Status = EXT_STATUS_OK;
-+ } else {
-+ DEBUG10(printk(KERN_INFO
-+ "%s(%ld): inst=%ld failed. transfer error\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_ERR;
-+ }
-+ break;
-+ }
-+
-+ if (CMD_COMPL_STATUS(pscsi_cmd) == CS_COMPLETE &&
-+ CMD_SCSI_STATUS(pscsi_cmd) == 0) {
-+ DEBUG9_10(printk(KERN_INFO
-+ "%s(%ld): Correct completion inst=%ld\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ } else {
-+ DEBUG9_10(printk(KERN_INFO "%s(%ld): inst=%ld scsi err. "
-+ "host status =0x%x, scsi status = 0x%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ CMD_COMPL_STATUS(pscsi_cmd), CMD_SCSI_STATUS(pscsi_cmd)));
-+
-+ if (CMD_SCSI_STATUS(pscsi_cmd) & SS_CHECK_CONDITION) {
-+ pext->Status = EXT_STATUS_SCSI_STATUS;
-+ pext->DetailStatus = CMD_SCSI_STATUS(pscsi_cmd) & 0xff;
-+ }
-+ }
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_scsi_passthru
-+ * Handles all subcommands of the EXT_CC_SEND_SCSI_PASSTHRU command.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_scsi_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ struct scsi_cmnd *pscsi_cmd = NULL;
-+ struct scsi_device *pscsi_device = NULL;
-+ struct request *request = NULL;
-+
-+ DEBUG9(printk("%s(%ld): entered.\n",
-+ __func__, ha->host_no));
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi_cmd,
-+ sizeof(struct scsi_cmnd))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_cmnd)));
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi_device,
-+ sizeof(struct scsi_device))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct scsi_device)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+ pscsi_cmd->device = pscsi_device;
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&request,
-+ sizeof(struct request))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(struct request)));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+ pscsi_cmd->request = request;
-+ pscsi_cmd->request->nr_hw_segments = 1;
-+
-+ switch(pext->SubCode) {
-+ case EXT_SC_SEND_SCSI_PASSTHRU:
-+ DEBUG9(printk("%s(%ld): got SCSI passthru cmd.\n",
-+ __func__, ha->host_no));
-+ ret = qla2x00_sc_scsi_passthru(ha, pext, pscsi_cmd,
-+ pscsi_device, mode);
-+ break;
-+ case EXT_SC_SEND_FC_SCSI_PASSTHRU:
-+ DEBUG9(printk("%s(%ld): got FC SCSI passthru cmd.\n",
-+ __func__, ha->host_no));
-+ ret = qla2x00_sc_fc_scsi_passthru(ha, pext, pscsi_cmd,
-+ pscsi_device, mode);
-+ break;
-+ case EXT_SC_SCSI3_PASSTHRU:
-+ DEBUG9(printk("%s(%ld): got SCSI3 passthru cmd.\n",
-+ __func__, ha->host_no));
-+ ret = qla2x00_sc_scsi3_passthru(ha, pext, pscsi_cmd,
-+ pscsi_device, mode);
-+ break;
-+ default:
-+ DEBUG9_10(printk("%s: got invalid cmd.\n", __func__));
-+ break;
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ DEBUG9(printk("%s(%ld): exiting.\n",
-+ __func__, ha->host_no));
-+
-+ return (ret);
-+}
-+
-+/**************************************************************************
-+* qla2x00_check_tgt_status
-+*
-+* Description:
-+* Checks to see if the target or loop is down.
-+*
-+* Input:
-+* cmd - pointer to Scsi cmd structure
-+*
-+* Returns:
-+* 1 - if target is present
-+* 0 - if target is not present
-+*
-+**************************************************************************/
-+static int
-+qla2x00_check_tgt_status(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-+{
-+ os_lun_t *lq;
-+ unsigned int b, t, l;
-+ fc_port_t *fcport;
-+
-+ /* Generate LU queue on bus, target, LUN */
-+ b = cmd->device->channel;
-+ t = cmd->device->id;
-+ l = cmd->device->lun;
-+
-+ if ((lq = GET_LU_Q(ha,t,l)) == NULL) {
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ fcport = lq->fclun->fcport;
-+
-+ if (TGT_Q(ha, t) == NULL ||
-+ l >= ha->max_luns ||
-+ atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-+ atomic_read(&ha->loop_state) == LOOP_DEAD ||
-+ (!atomic_read(&ha->loop_down_timer) &&
-+ atomic_read(&ha->loop_state) == LOOP_DOWN) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-+ atomic_read(&ha->loop_state) != LOOP_READY) {
-+
-+ DEBUG(printk(KERN_INFO
-+ "scsi(%ld:%2d:%2d:%2d): %s connection is down\n",
-+ ha->host_no,
-+ b, t, l,
-+ __func__));
-+
-+ cmd->result = DID_NO_CONNECT << 16;
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+ return (QLA_SUCCESS);
-+}
-+
-+/**************************************************************************
-+* qla2x00_check_port_status
-+*
-+* Description:
-+* Checks to see if the port or loop is down.
-+*
-+* Input:
-+* fcport - pointer to fc_port_t structure.
-+*
-+* Returns:
-+* 1 - if port is present
-+* 0 - if port is not present
-+*
-+**************************************************************************/
-+static int
-+qla2x00_check_port_status(scsi_qla_host_t *ha, fc_port_t *fcport)
-+{
-+ if (fcport == NULL) {
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-+ atomic_read(&ha->loop_state) == LOOP_DEAD) {
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ if ((atomic_read(&fcport->state) != FCS_ONLINE) ||
-+ (!atomic_read(&ha->loop_down_timer) &&
-+ atomic_read(&ha->loop_state) == LOOP_DOWN) ||
-+ (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
-+ atomic_read(&ha->loop_state) != LOOP_READY) {
-+
-+ DEBUG(printk(KERN_INFO
-+ "scsi(%ld): Connection is down. fcport=%p.\n",
-+ ha->host_no, fcport));
-+
-+ return (QLA_BUSY);
-+ }
-+
-+ return (QLA_SUCCESS);
-+}
-+
-+static int
-+qla2x00_ioctl_scsi_queuecommand(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd, struct scsi_device *pscsi_dev,
-+ fc_port_t *pfcport, fc_lun_t *pfclun)
-+{
-+ int ret = 0;
-+ int ret2 = 0;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t lun = 0, tgt = 0;
-+#if defined(QL_DEBUG_LEVEL_9)
-+ uint32_t b, t, l;
-+#endif
-+ os_lun_t *lq = NULL;
-+ os_tgt_t *tq = NULL;
-+ srb_t *sp = NULL;
-+
-+
-+ DEBUG9(printk("%s(%ld): entered.\n",
-+ __func__, ha->host_no));
-+
-+ if ((sp = qla2x00_get_new_sp(ha)) == NULL) {
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc sp.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ switch(pext->SubCode) {
-+ case EXT_SC_SEND_SCSI_PASSTHRU:
-+
-+ tgt = pscsi_cmd->device->id;
-+ lun = pscsi_cmd->device->lun;
-+
-+ tq = (os_tgt_t *)TGT_Q(ha, tgt);
-+ lq = (os_lun_t *)LUN_Q(ha, tgt, lun);
-+
-+ break;
-+ case EXT_SC_SEND_FC_SCSI_PASSTHRU:
-+ if (pfcport == NULL || pfclun == NULL) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld received invalid "
-+ "pointers. fcport=%p fclun=%p.\n",
-+ __func__, ha->host_no, ha->instance, pfcport, pfclun));
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ if (pscsi_cmd->cmd_len != 6 && pscsi_cmd->cmd_len != 0x0A &&
-+ pscsi_cmd->cmd_len != 0x0C && pscsi_cmd->cmd_len != 0x10) {
-+ DEBUG9_10(printk(KERN_WARNING
-+ "%s(%ld): invalid Cdb Length 0x%x received.\n",
-+ __func__, ha->host_no,
-+ pscsi_cmd->cmd_len));
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+ tq = ha->ioctl->ioctl_tq;
-+ lq = ha->ioctl->ioctl_lq;
-+
-+ break;
-+ case EXT_SC_SCSI3_PASSTHRU:
-+ if (pfcport == NULL || pfclun == NULL) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld received invalid "
-+ "pointers. fcport=%p fclun=%p.\n",
-+ __func__,
-+ ha->host_no, ha->instance, pfcport, pfclun));
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ tq = ha->ioctl->ioctl_tq;
-+ lq = ha->ioctl->ioctl_lq;
-+
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ sp->ha = ha;
-+ sp->cmd = pscsi_cmd;
-+ sp->flags = SRB_IOCTL;
-+
-+ /* set local fc_scsi_cmd's sp pointer to sp */
-+ CMD_SP(pscsi_cmd) = (void *) sp;
-+
-+ if (pscsi_cmd->sc_data_direction == DMA_TO_DEVICE) {
-+ /* sending user data from pext->ResponseAdr to device */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ha->ioctl_mem;
-+ ret = copy_from_user(kernel_tmp, usr_temp, pext->ResponseLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy "
-+ "failed(%d) on rsp buf.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ pscsi_cmd->device->host = ha->host;
-+
-+ /* mark this as a special delivery and collection command */
-+ pscsi_cmd->scsi_done = qla2x00_scsi_pt_done;
-+ pscsi_cmd->device->tagged_supported = 0;
-+ pscsi_cmd->use_sg = 0; /* no ScatterGather */
-+ pscsi_cmd->request_bufflen = pext->ResponseLen;
-+ pscsi_cmd->request_buffer = ha->ioctl_mem;
-+ if (pscsi_cmd->timeout_per_command == 0)
-+ pscsi_cmd->timeout_per_command = ql2xioctltimeout * HZ;
-+
-+ if (tq && lq) {
-+ if (pext->SubCode == EXT_SC_SEND_SCSI_PASSTHRU) {
-+ pfcport = lq->fclun->fcport;
-+ pfclun = lq->fclun;
-+
-+ if (pfcport == NULL || pfclun == NULL) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scsi pt "
-+ "rcvd invalid ptrs. fcport=%p fclun=%p.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pfcport, pfclun));
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+
-+ } else {
-+ if (pext->SubCode == EXT_SC_SCSI3_PASSTHRU)
-+ /* The LUN value is of FCP LUN format */
-+ tq->olun[pfclun->lun & 0xff] = lq;
-+ else
-+ tq->olun[pfclun->lun] = lq;
-+
-+ tq->ha = ha;
-+ lq->fclun = pfclun;
-+ }
-+
-+ sp->lun_queue = lq;
-+ sp->tgt_queue = tq;
-+ sp->fclun = pfclun;
-+ } else {
-+ /* cannot send command without a queue. force error. */
-+ pfcport = NULL;
-+ DEBUG9_10(printk("%s(%ld): error dev q not found. tq=%p lq=%p.\n",
-+ __func__, ha->host_no, tq, lq));
-+ }
-+
-+#if defined(QL_DEBUG_LEVEL_9)
-+ b = pscsi_cmd->device->channel;
-+ t = pscsi_cmd->device->id;
-+ l = pscsi_cmd->device->lun;
-+
-+ printk("%s(%ld): ha instance=%ld tq=%p lq=%p "
-+ "pfclun=%p pfcport=%p.\n",
-+ __func__, ha->host_no, ha->instance, tq, lq, pfclun,
-+ pfcport);
-+ printk("\tCDB=%02x %02x %02x %02x; b=%x t=%x l=%x.\n",
-+ pscsi_cmd->cmnd[0], pscsi_cmd->cmnd[1], pscsi_cmd->cmnd[2],
-+ pscsi_cmd->cmnd[3], b, t, l);
-+#endif
-+
-+ /*
-+ * Check the status of the port
-+ */
-+ if (pext->SubCode == EXT_SC_SEND_SCSI_PASSTHRU) {
-+ if (qla2x00_check_tgt_status(ha, pscsi_cmd)) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld check_tgt_status "
-+ "failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+ } else {
-+ ret2 = qla2x00_check_port_status(ha, pfcport);
-+ if (ret2 != QLA_SUCCESS) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld check_port_status "
-+ "failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ if (ret2 == QLA_BUSY)
-+ pext->Status = EXT_STATUS_BUSY;
-+ else
-+ pext->Status = EXT_STATUS_ERR;
-+ atomic_set(&sp->ref_count, 0);
-+ add_to_free_queue (ha, sp);
-+ return (QLA_FUNCTION_FAILED);
-+ }
-+ }
-+
-+ /* set flag to indicate IOCTL SCSI PassThru in progress */
-+ ha->ioctl->SCSIPT_InProgress = 1;
-+ ha->ioctl->ioctl_tov = (int)QLA_PT_CMD_DRV_TOV;
-+
-+ /* prepare for receiving completion. */
-+ qla2x00_ioctl_sem_init(ha);
-+ CMD_COMPL_STATUS(pscsi_cmd) = (int) IOCTL_INVALID_STATUS;
-+
-+ /* send command to adapter */
-+ DEBUG9(printk("%s(%ld): inst=%ld sending command.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* Time the command via our standard driver-timer */
-+ if ((pscsi_cmd->timeout_per_command / HZ) > QLA_CMD_TIMER_DELTA)
-+ qla2x00_add_timer_to_cmd(sp,
-+ (pscsi_cmd->timeout_per_command/HZ) - QLA_CMD_TIMER_DELTA);
-+ else
-+ qla2x00_add_timer_to_cmd(sp, pscsi_cmd->timeout_per_command/HZ);
-+
-+ add_to_pending_queue(ha, sp);
-+
-+ qla2x00_next(ha);
-+
-+ DEBUG9(printk("%s(%ld): exiting.\n",
-+ __func__, ha->host_no));
-+ return (ret);
-+}
-+
-+
-+/*
-+ * qla2x00_sc_scsi_passthru
-+ * Handles EXT_SC_SEND_SCSI_PASSTHRU subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_sc_scsi_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi_cmd, struct scsi_device *pscsi_device, int mode)
-+{
-+ int ret = 0;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t i;
-+
-+ uint32_t transfer_len;
-+
-+ EXT_SCSI_PASSTHRU *pscsi_pass;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (test_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_EVENT, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_NEEDED, &ha->dpc_flags)) {
-+ /* Stall intrusive passthru commands until failover complete */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-+ "returning busy.\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_BUSY;
-+ return (ret);
-+ }
-+
-+ if (pext->ResponseLen > ha->ioctl_mem_size) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-+ QLA_SUCCESS) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-+ "requested DMA buffer size %x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pext->ResponseLen));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi_pass,
-+ sizeof(EXT_SCSI_PASSTHRU))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_SCSI_PASSTHRU)));
-+ return (ret);
-+ }
-+
-+ /* clear ioctl_mem to be used */
-+ memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
-+
-+ /* Copy request buffer */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pscsi_pass;
-+ ret = copy_from_user(kernel_tmp, usr_temp, sizeof(EXT_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ return (-EFAULT);
-+ }
-+
-+ /* set target coordinates */
-+ pscsi_cmd->device->id = pscsi_pass->TargetAddr.Target;
-+ pscsi_cmd->device->lun = pscsi_pass->TargetAddr.Lun;
-+
-+ /* Verify target exists */
-+ if (TGT_Q(ha, pscsi_cmd->device->id) == NULL) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR tgt %d not found.\n",
-+ __func__,
-+ ha->host_no, ha->instance, pscsi_cmd->device->id));
-+ return (ret);
-+ }
-+
-+ /* Copy over cdb */
-+
-+ if (pscsi_pass->CdbLength == 6) {
-+ pscsi_cmd->cmd_len = 6;
-+
-+ } else if (pscsi_pass->CdbLength == 10) {
-+ pscsi_cmd->cmd_len = 0x0A;
-+
-+ } else if (pscsi_pass->CdbLength == 12) {
-+ pscsi_cmd->cmd_len = 0x0C;
-+
-+ } else {
-+ printk(KERN_WARNING
-+ "%s: Unsupported Cdb Length=%x.\n",
-+ __func__, pscsi_pass->CdbLength);
-+
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ return (ret);
-+ }
-+
-+ memcpy(pscsi_cmd->data_cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
-+ memcpy(pscsi_cmd->cmnd, pscsi_pass->Cdb, pscsi_cmd->cmd_len);
-+
-+ DEBUG9(printk("%s Dump of cdb buffer:\n", __func__));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)&pscsi_cmd->data_cmnd[0],
-+ pscsi_cmd->cmd_len));
-+
-+ switch (pscsi_pass->Direction) {
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-+ pscsi_cmd->sc_data_direction = DMA_TO_DEVICE;
-+ break;
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-+ pscsi_cmd->sc_data_direction = DMA_FROM_DEVICE;
-+ break;
-+ default :
-+ pscsi_cmd->sc_data_direction = DMA_NONE;
-+ break;
-+ }
-+
-+ /* send command to adapter */
-+ DEBUG9(printk("%s(%ld): inst=%ld sending command.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_ioctl_scsi_queuecommand(ha, pext, pscsi_cmd, pscsi_device,
-+ NULL, NULL)) {
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld waiting for completion.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* Wait for completion */
-+ down(&ha->ioctl->cmpl_sem);
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld completed.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_ioctl_passthru_rsp_handling(ha, pext, pscsi_cmd))
-+ return (ret);
-+
-+ /* copy up structure to make sense data available to user */
-+ pscsi_pass->SenseLength = CMD_ACTUAL_SNSLEN(pscsi_cmd);
-+ if (CMD_ACTUAL_SNSLEN(pscsi_cmd)) {
-+ for (i = 0; i < CMD_ACTUAL_SNSLEN(pscsi_cmd); i++)
-+ pscsi_pass->SenseData[i] = pscsi_cmd->sense_buffer[i];
-+
-+ DEBUG10(printk("%s Dump of sense buffer:\n", __func__));
-+ DEBUG10(qla2x00_dump_buffer(
-+ (uint8_t *)&pscsi_pass->SenseData[0],
-+ CMD_ACTUAL_SNSLEN(pscsi_cmd)));
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pscsi_pass;
-+ ret = copy_to_user(usr_temp, kernel_tmp,
-+ sizeof(EXT_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-+ "buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ if (pscsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-+ DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* now copy up the READ data to user */
-+ if ((CMD_COMPL_STATUS(pscsi_cmd) == CS_DATA_UNDERRUN) &&
-+ (CMD_RESID_LEN(pscsi_cmd))) {
-+
-+ transfer_len = pext->ResponseLen -
-+ CMD_RESID_LEN(pscsi_cmd);
-+
-+ pext->ResponseLen = transfer_len;
-+ } else {
-+ transfer_len = pext->ResponseLen;
-+ }
-+
-+ DEBUG9_10(printk(KERN_INFO
-+ "%s(%ld): final transferlen=%d.\n",
-+ __func__, ha->host_no, transfer_len));
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ha->ioctl_mem;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_sc_fc_scsi_passthru
-+ * Handles EXT_SC_SEND_FC_SCSI_PASSTHRU subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_sc_fc_scsi_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pfc_scsi_cmd, struct scsi_device *pfc_scsi_device,
-+ int mode)
-+{
-+ int ret = 0;
-+ int port_found, lun_found;
-+ fc_lun_t temp_fclun;
-+ struct list_head *fcpl;
-+ fc_port_t *fcport;
-+ struct list_head *fcll;
-+ fc_lun_t *fclun;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t i;
-+
-+ uint32_t transfer_len;
-+
-+ EXT_FC_SCSI_PASSTHRU *pfc_scsi_pass;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+#if defined(QL_DEBUG_LEVEL_9) || defined(QL_DEBUG_LEVEL_10)
-+ if (!pfc_scsi_cmd || !pfc_scsi_device) {
-+ printk("%s(%ld): invalid pointer received. pfc_scsi_cmd=%p, "
-+ "pfc_scsi_device=%p.\n", __func__, ha->host_no,
-+ pfc_scsi_cmd, pfc_scsi_device);
-+ return (ret);
-+ }
-+#endif
-+
-+ if (test_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_EVENT, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_NEEDED, &ha->dpc_flags)) {
-+ /* Stall intrusive passthru commands until failover complete */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-+ "returning busy.\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_BUSY;
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pfc_scsi_pass,
-+ sizeof(EXT_FC_SCSI_PASSTHRU))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_FC_SCSI_PASSTHRU)));
-+ return (ret);
-+ }
-+
-+ /* clear ioctl_mem to be used */
-+ memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
-+
-+ if (pext->ResponseLen > ha->ioctl_mem_size) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-+ QLA_SUCCESS) {
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-+ "requested DMA buffer size %x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pext->ResponseLen));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+ }
-+
-+ /* Copy request buffer */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pfc_scsi_pass;
-+ ret = copy_from_user(kernel_tmp, usr_temp,
-+ sizeof(EXT_FC_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+
-+ return (-EFAULT);
-+ }
-+
-+ if (pfc_scsi_pass->FCScsiAddr.DestType != EXT_DEF_DESTTYPE_WWPN) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR -wrong Dest type. \n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ fcport = NULL;
-+ fclun = NULL;
-+ port_found = lun_found = 0;
-+ list_for_each(fcpl, &ha->fcports) {
-+ fcport = list_entry(fcpl, fc_port_t, list);
-+
-+ if (memcmp(fcport->port_name,
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN, 8) != 0) {
-+ continue;
-+
-+ }
-+ port_found++;
-+
-+ list_for_each(fcll, &fcport->fcluns) {
-+ fclun = list_entry(fcll, fc_lun_t, list);
-+
-+ if (fclun->lun == pfc_scsi_pass->FCScsiAddr.Lun) {
-+ /* Found the right LUN */
-+ lun_found++;
-+ break;
-+ }
-+ }
-+ break;
-+ }
-+
-+ if (!port_found) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld FC AddrFormat - DID NOT "
-+ "FIND Port matching WWPN.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ /* v5.21b9 - use a temporary fclun */
-+ if (!lun_found) {
-+ fclun = &temp_fclun;
-+ fclun->fcport = fcport;
-+ fclun->lun = pfc_scsi_pass->FCScsiAddr.Lun;
-+ }
-+
-+ /* set target coordinates */
-+ pfc_scsi_cmd->device->id = 0xff; /* not used. just put something there. */
-+ pfc_scsi_cmd->device->lun = pfc_scsi_pass->FCScsiAddr.Lun;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld cmd for loopid=%04x L=%04x "
-+ "WWPN=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, ha->instance, fclun->fcport->loop_id,
-+ pfc_scsi_cmd->device->lun,
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[0],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[1],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[2],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[3],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[4],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[5],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[6],
-+ pfc_scsi_pass->FCScsiAddr.DestAddr.WWPN[7]));
-+
-+ if (pfc_scsi_pass->CdbLength == 6) {
-+ pfc_scsi_cmd->cmd_len = 6;
-+
-+ } else if (pfc_scsi_pass->CdbLength == 0x0A) {
-+ pfc_scsi_cmd->cmd_len = 0x0A;
-+
-+ } else if (pfc_scsi_pass->CdbLength == 0x0C) {
-+ pfc_scsi_cmd->cmd_len = 0x0C;
-+
-+ } else if (pfc_scsi_pass->CdbLength == 0x10) {
-+ pfc_scsi_cmd->cmd_len = 0x10;
-+ } else {
-+ printk(KERN_WARNING
-+ "qla2x00_ioctl: FC_SCSI_PASSTHRU Unknown Cdb Length=%x.\n",
-+ pfc_scsi_pass->CdbLength);
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+
-+ return (ret);
-+ }
-+
-+ memcpy(pfc_scsi_cmd->data_cmnd, pfc_scsi_pass->Cdb,
-+ pfc_scsi_cmd->cmd_len);
-+ memcpy(pfc_scsi_cmd->cmnd, pfc_scsi_pass->Cdb,
-+ pfc_scsi_cmd->cmd_len);
-+
-+ DEBUG9(printk("%s Dump of cdb buffer:\n", __func__));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)&pfc_scsi_cmd->data_cmnd[0], 16));
-+
-+ switch (pfc_scsi_pass->Direction) {
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-+ pfc_scsi_cmd->sc_data_direction = DMA_TO_DEVICE;
-+ break;
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-+ pfc_scsi_cmd->sc_data_direction = DMA_FROM_DEVICE;
-+ break;
-+ default :
-+ pfc_scsi_cmd->sc_data_direction = DMA_NONE;
-+ break;
-+ }
-+
-+ /* send command to adapter */
-+ DEBUG9(printk("%s(%ld): inst=%ld queuing command.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (qla2x00_ioctl_scsi_queuecommand(ha, pext, pfc_scsi_cmd,
-+ pfc_scsi_device, fcport, fclun)) {
-+ return (ret);
-+ }
-+
-+ /* Wait for comletion */
-+ down(&ha->ioctl->cmpl_sem);
-+
-+ if (qla2x00_ioctl_passthru_rsp_handling(ha, pext, pfc_scsi_cmd))
-+ return (ret);
-+
-+ /* Process completed command */
-+ DEBUG9(printk("%s(%ld): inst=%ld done. host status=0x%x, "
-+ "scsi status=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, CMD_COMPL_STATUS(pfc_scsi_cmd),
-+ CMD_SCSI_STATUS(pfc_scsi_cmd)));
-+
-+ /* copy up structure to make sense data available to user */
-+ pfc_scsi_pass->SenseLength = CMD_ACTUAL_SNSLEN(pfc_scsi_cmd);
-+ if (CMD_ACTUAL_SNSLEN(pfc_scsi_cmd)) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld sense[0]=%x sense[2]=%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pfc_scsi_cmd->sense_buffer[0],
-+ pfc_scsi_cmd->sense_buffer[2]));
-+
-+ for (i = 0; i < CMD_ACTUAL_SNSLEN(pfc_scsi_cmd); i++) {
-+ pfc_scsi_pass->SenseData[i] =
-+ pfc_scsi_cmd->sense_buffer[i];
-+ }
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pfc_scsi_pass;
-+ ret = copy_to_user(usr_temp, kernel_tmp,
-+ sizeof(EXT_FC_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-+ "buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ if (pfc_scsi_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* now copy up the READ data to user */
-+ if ((CMD_COMPL_STATUS(pfc_scsi_cmd) == CS_DATA_UNDERRUN) &&
-+ (CMD_RESID_LEN(pfc_scsi_cmd))) {
-+
-+ transfer_len = pext->ResponseLen -
-+ CMD_RESID_LEN(pfc_scsi_cmd);
-+
-+ pext->ResponseLen = transfer_len;
-+ } else {
-+ transfer_len = pext->ResponseLen;
-+ }
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ha->ioctl_mem;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_sc_scsi3_passthru
-+ * Handles EXT_SC_SCSI3_PASSTHRU subcommand.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = EXT_IOCTL structure pointer.
-+ * mode = not used.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_sc_scsi3_passthru(scsi_qla_host_t *ha, EXT_IOCTL *pext,
-+ struct scsi_cmnd *pscsi3_cmd, struct scsi_device *pscsi3_device, int mode)
-+{
-+#define MAX_SCSI3_CDB_LEN 16
-+
-+ int ret = 0;
-+ int found;
-+ fc_lun_t temp_fclun;
-+ fc_lun_t *fclun = NULL;
-+ struct list_head *fcpl;
-+ fc_port_t *fcport;
-+ uint8_t *usr_temp, *kernel_tmp;
-+ uint32_t transfer_len;
-+ uint32_t i;
-+
-+ EXT_FC_SCSI_PASSTHRU *pscsi3_pass;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+#if defined(QL_DEBUG_LEVEL_9) || defined(QL_DEBUG_LEVEL_10)
-+ if (!pscsi3_cmd || !pscsi3_device) {
-+ printk("%s(%ld): invalid pointer received. pfc_scsi_cmd=%p, "
-+ "pfc_scsi_device=%p.\n", __func__, ha->host_no,
-+ pscsi3_cmd, pscsi3_device);
-+ return (ret);
-+ }
-+#endif
-+
-+ if (test_bit(FAILOVER_EVENT_NEEDED, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_EVENT, &ha->dpc_flags) ||
-+ test_bit(FAILOVER_NEEDED, &ha->dpc_flags)) {
-+ /* Stall intrusive passthru commands until failover complete */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld failover in progress -- "
-+ "returning busy.\n",
-+ __func__, ha->host_no, ha->instance));
-+ pext->Status = EXT_STATUS_BUSY;
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&pscsi3_pass,
-+ sizeof(EXT_FC_SCSI_PASSTHRU))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_FC_SCSI_PASSTHRU)));
-+ return (ret);
-+ }
-+
-+
-+ /* clear ioctl_mem to be used */
-+ memset(ha->ioctl_mem, 0, ha->ioctl_mem_size);
-+
-+ if (pext->ResponseLen > ha->ioctl_mem_size) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha, pext->ResponseLen) !=
-+ QLA_SUCCESS) {
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot "
-+ "alloc requested DMA buffer size=%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pext->ResponseLen));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+ }
-+
-+ /* Copy request buffer */
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pscsi3_pass;
-+ ret = copy_from_user(kernel_tmp, usr_temp,
-+ sizeof(EXT_FC_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ return (-EFAULT);
-+ }
-+
-+ if (pscsi3_pass->FCScsiAddr.DestType != EXT_DEF_DESTTYPE_WWPN) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR - wrong Dest type.\n",
-+ __func__, ha->host_no, ha->instance));
-+ ret = EXT_STATUS_ERR;
-+
-+ return (ret);
-+ }
-+
-+ /*
-+ * For this ioctl command we always assume all 16 bytes are
-+ * initialized.
-+ */
-+ if (pscsi3_pass->CdbLength != MAX_SCSI3_CDB_LEN) {
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR -wrong Cdb Len %d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pscsi3_pass->CdbLength));
-+ return (ret);
-+ }
-+
-+ fcport = NULL;
-+ found = 0;
-+ list_for_each(fcpl, &ha->fcports) {
-+ fcport = list_entry(fcpl, fc_port_t, list);
-+
-+ if (memcmp(fcport->port_name,
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN, 8) == 0) {
-+ found++;
-+ break;
-+ }
-+ }
-+ if (!found) {
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld DID NOT FIND Port for WWPN "
-+ "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[0],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[1],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[2],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[3],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[4],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[5],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[6],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[7]));
-+
-+ return (ret);
-+ }
-+
-+ /* Use a temporary fclun to send out the command. */
-+ fclun = &temp_fclun;
-+ fclun->fcport = fcport;
-+ fclun->lun = pscsi3_pass->FCScsiAddr.Lun;
-+
-+ /* set target coordinates */
-+ pscsi3_cmd->device->id = 0xff; /* not used. just put something there. */
-+ pscsi3_cmd->device->lun = pscsi3_pass->FCScsiAddr.Lun;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld cmd for loopid=%04x L=%04x "
-+ "WWPN=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ fclun->fcport->loop_id, pscsi3_cmd->device->lun,
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[0],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[1],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[2],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[3],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[4],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[5],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[6],
-+ pscsi3_pass->FCScsiAddr.DestAddr.WWPN[7]));
-+
-+ pscsi3_cmd->cmd_len = MAX_SCSI3_CDB_LEN;
-+ memcpy(pscsi3_cmd->data_cmnd, pscsi3_pass->Cdb, pscsi3_cmd->cmd_len);
-+ memcpy(pscsi3_cmd->cmnd, pscsi3_pass->Cdb, pscsi3_cmd->cmd_len);
-+
-+ switch (pscsi3_pass->Direction) {
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_OUT:
-+ pscsi3_cmd->sc_data_direction = DMA_TO_DEVICE;
-+ break;
-+ case EXT_DEF_SCSI_PASSTHRU_DATA_IN:
-+ pscsi3_cmd->sc_data_direction = DMA_FROM_DEVICE;
-+ break;
-+ default :
-+ pscsi3_cmd->sc_data_direction = DMA_NONE;
-+ break;
-+ }
-+
-+ if (pscsi3_pass->Timeout)
-+ pscsi3_cmd->timeout_per_command = pscsi3_pass->Timeout * HZ;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld cdb buffer dump:\n",
-+ __func__, ha->host_no, ha->instance));
-+ DEBUG9(qla2x00_dump_buffer((uint8_t *)&pscsi3_cmd->data_cmnd[0], 16));
-+
-+ if (qla2x00_ioctl_scsi_queuecommand(ha, pext, pscsi3_cmd,
-+ pscsi3_device, fcport, fclun)) {
-+ return (ret);
-+ }
-+
-+ /* Wait for comletion */
-+ down(&ha->ioctl->cmpl_sem);
-+
-+ if (qla2x00_ioctl_passthru_rsp_handling(ha, pext, pscsi3_cmd))
-+ return (ret);
-+
-+ /* Process completed command */
-+ DEBUG9(printk("%s(%ld): inst=%ld done. host status=0x%x, "
-+ "scsi status=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, CMD_COMPL_STATUS(pscsi3_cmd),
-+ CMD_SCSI_STATUS(pscsi3_cmd)));
-+
-+ /* copy up structure to make sense data available to user */
-+ pscsi3_pass->SenseLength = CMD_ACTUAL_SNSLEN(pscsi3_cmd);
-+ if (CMD_ACTUAL_SNSLEN(pscsi3_cmd)) {
-+ DEBUG9_10(printk("%s(%ld): inst=%ld sense[0]=%x sense[2]=%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ pscsi3_cmd->sense_buffer[0],
-+ pscsi3_cmd->sense_buffer[2]));
-+
-+ for (i = 0; i < CMD_ACTUAL_SNSLEN(pscsi3_cmd); i++) {
-+ pscsi3_pass->SenseData[i] =
-+ pscsi3_cmd->sense_buffer[i];
-+ }
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)pscsi3_pass;
-+ ret = copy_to_user(usr_temp, kernel_tmp,
-+ sizeof(EXT_FC_SCSI_PASSTHRU));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy sense "
-+ "buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ if (pscsi3_pass->Direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld copying data.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* now copy up the READ data to user */
-+ if ((CMD_COMPL_STATUS(pscsi3_cmd) == CS_DATA_UNDERRUN) &&
-+ (CMD_RESID_LEN(pscsi3_cmd))) {
-+
-+ transfer_len = pext->ResponseLen -
-+ CMD_RESID_LEN(pscsi3_cmd);
-+
-+ pext->ResponseLen = transfer_len;
-+ } else {
-+ transfer_len = pext->ResponseLen;
-+ }
-+
-+ DEBUG9_10(printk(KERN_INFO
-+ "%s(%ld): final transferlen=%d.\n",
-+ __func__, ha->host_no, transfer_len));
-+
-+ usr_temp = (uint8_t *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ kernel_tmp = (uint8_t *)ha->ioctl_mem;
-+ ret = copy_to_user(usr_temp, kernel_tmp, transfer_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_send_els_rnid
-+ * IOCTL to send extended link service RNID command to a target.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_send_els_rnid(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ EXT_RNID_REQ *tmp_rnid;
-+ int ret = 0;
-+ uint16_t mb[MAILBOX_REGISTER_COUNT];
-+ uint32_t copy_len;
-+ int found;
-+ uint16_t next_loop_id;
-+ fc_port_t *fcport;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (ha->ioctl_mem_size < SEND_RNID_RSP_SIZE) {
-+ if (qla2x00_get_new_ioctl_dma_mem(ha,
-+ SEND_RNID_RSP_SIZE) != QLA_SUCCESS) {
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR cannot alloc "
-+ "DMA buffer. size=%x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ SEND_RNID_RSP_SIZE));
-+
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (ret);
-+ }
-+ }
-+
-+ if (pext->RequestLen != sizeof(EXT_RNID_REQ)) {
-+ /* parameter error */
-+ DEBUG9_10(printk("%s(%ld): inst=%ld invalid req length %d.\n",
-+ __func__, ha->host_no, ha->instance, pext->RequestLen));
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ return (ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&tmp_rnid,
-+ sizeof(EXT_RNID_REQ))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_RNID_REQ)));
-+ return (ret);
-+ }
-+
-+ ret = copy_from_user(tmp_rnid, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ /* Find loop ID of the device */
-+ found = 0;
-+ fcport = NULL;
-+ switch (tmp_rnid->Addr.Type) {
-+ case EXT_DEF_TYPE_WWNN:
-+ DEBUG9(printk("%s(%ld): inst=%ld got node name.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_INITIATOR ||
-+ fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (memcmp(tmp_rnid->Addr.FcAddr.WWNN,
-+ fcport->node_name, EXT_DEF_WWN_NAME_SIZE))
-+ continue;
-+
-+ if (fcport->port_type == FCT_TARGET) {
-+ if (atomic_read(&fcport->state) != FCS_ONLINE)
-+ continue;
-+ } else { /* FCT_INITIATOR */
-+ if (!fcport->d_id.b24)
-+ continue;
-+ }
-+
-+ found++;
-+ }
-+ break;
-+
-+ case EXT_DEF_TYPE_WWPN:
-+ DEBUG9(printk("%s(%ld): inst=%ld got port name.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_INITIATOR ||
-+ fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ if (memcmp(tmp_rnid->Addr.FcAddr.WWPN,
-+ fcport->port_name, EXT_DEF_WWN_NAME_SIZE))
-+ continue;
-+
-+ if (fcport->port_type == FCT_TARGET) {
-+ if (atomic_read(&fcport->state) != FCS_ONLINE)
-+ continue;
-+ } else { /* FCT_INITIATOR */
-+ if (!fcport->d_id.b24)
-+ continue;
-+ }
-+
-+ found++;
-+ }
-+ break;
-+
-+ case EXT_DEF_TYPE_PORTID:
-+ DEBUG9(printk("%s(%ld): inst=%ld got port ID.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ list_for_each_entry(fcport, &ha->fcports, list) {
-+ if (fcport->port_type != FCT_INITIATOR ||
-+ fcport->port_type != FCT_TARGET)
-+ continue;
-+
-+ /* PORTID bytes entered must already be big endian */
-+ if (memcmp(&tmp_rnid->Addr.FcAddr.Id[1],
-+ &fcport->d_id, EXT_DEF_PORTID_SIZE_ACTUAL))
-+ continue;
-+
-+ if (fcport->port_type == FCT_TARGET) {
-+ if (atomic_read(&fcport->state) != FCS_ONLINE)
-+ continue;
-+ }
-+
-+ found++;
-+ }
-+ break;
-+ default:
-+ /* parameter error */
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld invalid addressing type.\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ if (!found || (fcport->port_type == FCT_TARGET &&
-+ fcport->loop_id > ha->last_loop_id)) {
-+ /*
-+ * No matching device or the target device is not configured;
-+ * just return error.
-+ */
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ /* check on loop down */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ /* If this is for a host device, check if we need to perform login */
-+ if (fcport->port_type == FCT_INITIATOR &&
-+ fcport->loop_id >= ha->last_loop_id) {
-+ next_loop_id = 0;
-+ ret = qla2x00_fabric_login(ha, fcport, &next_loop_id);
-+ if (ret != QLA_SUCCESS) {
-+ /* login failed. */
-+ pext->Status = EXT_STATUS_DEV_NOT_FOUND;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR login to "
-+ "host port failed. loop_id=%02x pid=%02x%02x%02x "
-+ "ret=%d.\n",
-+ __func__, ha->host_no, ha->instance,
-+ fcport->loop_id, fcport->d_id.b.domain,
-+ fcport->d_id.b.area, fcport->d_id.b.al_pa, ret));
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+ }
-+
-+ /* Send command */
-+ DEBUG9(printk("%s(%ld): inst=%ld sending rnid cmd.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ret = qla2x00_send_rnid_mbx(ha, fcport->loop_id,
-+ (uint8_t)tmp_rnid->DataFormat, ha->ioctl_mem_phys,
-+ SEND_RNID_RSP_SIZE, &mb[0]);
-+
-+ if (ret != QLA_SUCCESS) {
-+ /* error */
-+ pext->Status = EXT_STATUS_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld FAILED. rval = %x.\n",
-+ __func__, ha->host_no, ha->instance, mb[0]));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld rnid cmd sent ok.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* Copy the response */
-+ copy_len = (pext->ResponseLen > SEND_RNID_RSP_SIZE) ?
-+ SEND_RNID_RSP_SIZE : pext->ResponseLen;
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ha->ioctl_mem, copy_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy rsp buf\n",
-+ __func__, ha->host_no, ha->instance));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ if (SEND_RNID_RSP_SIZE > pext->ResponseLen) {
-+ pext->Status = EXT_STATUS_DATA_OVERRUN;
-+ DEBUG9(printk("%s(%ld): inst=%ld data overrun. "
-+ "exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ }
-+ pext->ResponseLen = copy_len;
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_get_rnid_params
-+ * IOCTL to get RNID parameters of the adapter.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_rnid_params(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ int tmp_rval = 0;
-+ uint32_t copy_len;
-+ uint16_t mb[MAILBOX_REGISTER_COUNT];
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on loop down */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ /* Send command */
-+ tmp_rval = qla2x00_get_rnid_params_mbx(ha, ha->ioctl_mem_phys,
-+ sizeof(EXT_RNID_DATA), &mb[0]);
-+
-+ if (tmp_rval != QLA_SUCCESS) {
-+ /* error */
-+ pext->Status = EXT_STATUS_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld cmd FAILED=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb[0]));
-+ return (ret);
-+ }
-+
-+ /* Copy the response */
-+ copy_len = (pext->ResponseLen > sizeof(EXT_RNID_DATA)) ?
-+ (uint32_t)sizeof(EXT_RNID_DATA) : pext->ResponseLen;
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ ha->ioctl_mem, copy_len);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buf\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+
-+ pext->ResponseLen = copy_len;
-+ if (copy_len < sizeof(EXT_RNID_DATA)) {
-+ pext->Status = EXT_STATUS_DATA_OVERRUN;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld data overrun. "
-+ "exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ } else if (pext->ResponseLen > sizeof(EXT_RNID_DATA)) {
-+ pext->Status = EXT_STATUS_DATA_UNDERRUN;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld data underrun. "
-+ "exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ }
-+
-+ return (ret);
-+}
-+
-+/*
-+ *qla2x00_get_led_state
-+ * IOCTL to get QLA2XXX HBA LED state
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_led_state(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ EXT_BEACON_CONTROL tmp_led_state;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (pext->ResponseLen < sizeof(EXT_BEACON_CONTROL)) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s: ERROR ResponseLen too small.\n",
-+ __func__));
-+
-+ return (ret);
-+ }
-+
-+ if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ /* Return current state */
-+ if (ha->beacon_blink_led) {
-+ tmp_led_state.State = EXT_DEF_GRN_BLINK_ON;
-+ } else {
-+ tmp_led_state.State = EXT_DEF_GRN_BLINK_OFF;
-+ }
-+
-+ ret = copy_to_user(Q64BIT_TO_PTR(pext->ResponseAdr, pext->AddrMode),
-+ &tmp_led_state, sizeof(EXT_BEACON_CONTROL));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy rsp buffer.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (-EFAULT);
-+ }
-+
-+ pext->Status = EXT_STATUS_OK;
-+ pext->DetailStatus = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+
-+}
-+
-+/*
-+ * qla2x00_set_host_data
-+ * IOCTL command to set host/adapter related data.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_set_host_data(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* switch on command subcode */
-+ switch (pext->SubCode) {
-+ case EXT_SC_SET_RNID:
-+ ret = qla2x00_set_rnid_params(ha, pext, mode);
-+ break;
-+ case EXT_SC_SET_BEACON_STATE:
-+ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
-+ ret = qla2x00_set_led_state(ha, pext, mode);
-+ break;
-+ }
-+ /*FALLTHROUGH*/
-+ default:
-+ /* function not supported. */
-+ pext->Status = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+/*
-+ * qla2x00_set_rnid_params
-+ * IOCTL to set RNID parameters of the adapter.
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_set_rnid_params(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ EXT_SET_RNID_REQ *tmp_set;
-+ EXT_RNID_DATA *tmp_buf;
-+ int ret = 0;
-+ int tmp_rval = 0;
-+ uint16_t mb[MAILBOX_REGISTER_COUNT];
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ /* check on loop down */
-+ if (atomic_read(&ha->loop_state) != LOOP_READY ||
-+ test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
-+ test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
-+ test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || ha->dpc_active) {
-+
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld loop not ready.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+ }
-+
-+ if (pext->RequestLen != sizeof(EXT_SET_RNID_REQ)) {
-+ /* parameter error */
-+ pext->Status = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld invalid request length.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return(ret);
-+ }
-+
-+ if (qla2x00_get_ioctl_scrap_mem(ha, (void **)&tmp_set,
-+ sizeof(EXT_SET_RNID_REQ))) {
-+ /* not enough memory */
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld scrap not big enough. "
-+ "size requested=%ld.\n",
-+ __func__, ha->host_no, ha->instance,
-+ (ulong)sizeof(EXT_SET_RNID_REQ)));
-+ return (ret);
-+ }
-+
-+ ret = copy_from_user(tmp_set, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), pext->RequestLen);
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld ERROR copy req buf ret=%d\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (-EFAULT);
-+ }
-+
-+ tmp_rval = qla2x00_get_rnid_params_mbx(ha, ha->ioctl_mem_phys,
-+ sizeof(EXT_RNID_DATA), &mb[0]);
-+ if (tmp_rval != QLA_SUCCESS) {
-+ /* error */
-+ pext->Status = EXT_STATUS_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld read cmd FAILED=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb[0]));
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+ }
-+
-+ tmp_buf = (EXT_RNID_DATA *)ha->ioctl_mem;
-+ /* Now set the params. */
-+ memcpy(tmp_buf->IPVersion, tmp_set->IPVersion, 2);
-+ memcpy(tmp_buf->UDPPortNumber, tmp_set->UDPPortNumber, 2);
-+ memcpy(tmp_buf->IPAddress, tmp_set->IPAddress, 16);
-+ tmp_rval = qla2x00_set_rnid_params_mbx(ha, ha->ioctl_mem_phys,
-+ sizeof(EXT_RNID_DATA), &mb[0]);
-+
-+ if (tmp_rval != QLA_SUCCESS) {
-+ /* error */
-+ pext->Status = EXT_STATUS_ERR;
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set cmd FAILED=%x.\n",
-+ __func__, ha->host_no, ha->instance, mb[0]));
-+ } else {
-+ pext->Status = EXT_STATUS_OK;
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting normally.\n",
-+ __func__, ha->host_no, ha->instance));
-+ }
-+
-+ qla2x00_free_ioctl_scrap_mem(ha);
-+ return (ret);
-+}
-+
-+/*
-+ *qla2x00_set_led_state
-+ * IOCTL to set QLA2XXX HBA LED state
-+ *
-+ * Input:
-+ * ha = adapter state pointer.
-+ * pext = User space CT arguments pointer.
-+ * mode = flags.
-+ *
-+ * Returns:
-+ * 0 = success
-+ * others = errno value
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_set_led_state(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ int ret = 0;
-+ uint32_t tmp_ext_stat = 0;
-+ uint32_t tmp_ext_dstat = 0;
-+ EXT_BEACON_CONTROL tmp_led_state;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (pext->RequestLen < sizeof(EXT_BEACON_CONTROL)) {
-+ pext->Status = EXT_STATUS_BUFFER_TOO_SMALL;
-+ DEBUG9_10(printk("%s: ERROR RequestLen too small.\n",
-+ __func__));
-+ return (ret);
-+ }
-+
-+ if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-+ pext->Status = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ ret = copy_from_user(&tmp_led_state, Q64BIT_TO_PTR(pext->RequestAdr,
-+ pext->AddrMode), sizeof(EXT_BEACON_CONTROL));
-+ if (ret) {
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld ERROR copy req buf=%d.\n",
-+ __func__, ha->host_no, ha->instance, ret));
-+ return (-EFAULT);
-+ }
-+
-+ if (IS_QLA23XX(ha)) {
-+ ret = qla2x00_set_led_23xx(ha, &tmp_led_state, &tmp_ext_stat,
-+ &tmp_ext_dstat);
-+ } else if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
-+ ret = qla2x00_set_led_24xx(ha, &tmp_led_state, &tmp_ext_stat,
-+ &tmp_ext_dstat);
-+ } else {
-+ /* not supported */
-+ tmp_ext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ }
-+
-+ pext->Status = tmp_ext_stat;
-+ pext->DetailStatus = tmp_ext_dstat;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_set_led_23xx(scsi_qla_host_t *ha, EXT_BEACON_CONTROL *ptmp_led_state,
-+ uint32_t *pext_stat, uint32_t *pext_dstat)
-+{
-+ int ret = 0;
-+ device_reg_t __iomem *reg = ha->iobase;
-+ uint16_t gpio_enable, gpio_data;
-+ unsigned long cpu_flags = 0;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (ptmp_led_state->State != EXT_DEF_GRN_BLINK_ON &&
-+ ptmp_led_state->State != EXT_DEF_GRN_BLINK_OFF) {
-+ *pext_stat = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld Unknown Led State set "
-+ "operation recieved %x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ptmp_led_state->State));
-+ return (ret);
-+ }
-+
-+ if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-+ *pext_stat = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (ret);
-+ }
-+
-+ switch (ptmp_led_state->State) {
-+ case EXT_DEF_GRN_BLINK_ON:
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld start blinking led \n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld orig firmware options "
-+ "fw_options1=0x%x fw_options2=0x%x fw_options3=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, ha->fw_options[1],
-+ ha->fw_options[2], ha->fw_options[3]));
-+
-+ ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-+ ha->fw_options[1] |= FO1_DISABLE_GPIO6_7;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ if (ha->pio_address)
-+ reg = (device_reg_t *)ha->pio_address;
-+
-+ /* Turn off LEDs */
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ if (ha->pio_address) {
-+ gpio_enable = RD_REG_WORD_PIO(&reg->gpioe);
-+ gpio_data = RD_REG_WORD_PIO(&reg->gpiod);
-+ } else {
-+ gpio_enable = RD_REG_WORD(&reg->gpioe);
-+ gpio_data = RD_REG_WORD(&reg->gpiod);
-+ }
-+ gpio_enable |= GPIO_LED_MASK;
-+
-+ /* Set the modified gpio_enable values */
-+ if (ha->pio_address)
-+ WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable);
-+ else {
-+ WRT_REG_WORD(&reg->gpioe, gpio_enable);
-+ RD_REG_WORD(&reg->gpioe);
-+ }
-+
-+ /* Clear out previously set LED colour */
-+ gpio_data &= ~GPIO_LED_MASK;
-+ if (ha->pio_address)
-+ WRT_REG_WORD_PIO(&reg->gpiod, gpio_data);
-+ else {
-+ WRT_REG_WORD(&reg->gpiod, gpio_data);
-+ RD_REG_WORD(&reg->gpiod);
-+ }
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ /* Let the per HBA timer kick off the blinking process based on
-+ * the following flags. No need to do anything else now.
-+ */
-+ ha->beacon_blink_led = 1;
-+ ha->beacon_color_state = 0;
-+
-+ /* end of if(ptmp_led_state.State == EXT_DEF_GRN_BLINK_ON) ) */
-+
-+ *pext_stat = EXT_STATUS_OK;
-+ *pext_dstat = EXT_STATUS_OK;
-+ break;
-+
-+ case EXT_DEF_GRN_BLINK_OFF:
-+ DEBUG9(printk("%s(%ld): inst=%ld stop blinking led \n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ha->beacon_blink_led = 0;
-+ /* Set the on flag so when it gets flipped it will be off */
-+ if (IS_QLA2322(ha)) {
-+ ha->beacon_color_state = QLA_LED_RGA_ON;
-+ } else {
-+ ha->beacon_color_state = QLA_LED_GRN_ON;
-+ }
-+ qla23xx_blink_led(ha); /* This turns green LED off */
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld orig firmware"
-+ " options fw_options1=0x%x fw_options2=0x%x "
-+ "fw_options3=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, ha->fw_options[1],
-+ ha->fw_options[2], ha->fw_options[3]));
-+
-+ ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-+ ha->fw_options[1] &= ~FO1_DISABLE_GPIO6_7;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_ERR;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ /* end of if(ptmp_led_state.State == EXT_DEF_GRN_BLINK_OFF) */
-+
-+ *pext_stat = EXT_STATUS_OK;
-+ *pext_dstat = EXT_STATUS_OK;
-+ break;
-+ default:
-+ *pext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (ret);
-+}
-+
-+static int
-+qla2x00_set_led_24xx(scsi_qla_host_t *ha, EXT_BEACON_CONTROL *ptmp_led_state,
-+ uint32_t *pext_stat, uint32_t *pext_dstat)
-+{
-+ int rval = 0;
-+ struct device_reg_24xx __iomem *reg24 =
-+ (struct device_reg_24xx __iomem *)ha->iobase;
-+ uint32_t gpio_data;
-+ uint32_t led_state;
-+ unsigned long cpu_flags = 0;
-+
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld entered.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ led_state = ptmp_led_state->State;
-+ if (led_state != EXT_DEF_GRN_BLINK_ON &&
-+ led_state != EXT_DEF_GRN_BLINK_OFF) {
-+ *pext_stat = EXT_STATUS_INVALID_PARAM;
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld Unknown Led State set "
-+ "operation recieved %x.\n",
-+ __func__, ha->host_no, ha->instance,
-+ ptmp_led_state->State));
-+ return (rval);
-+ }
-+
-+ if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
-+ *pext_stat = EXT_STATUS_BUSY;
-+ DEBUG9_10(printk("%s(%ld): inst=%ld abort isp active.\n",
-+ __func__, ha->host_no, ha->instance));
-+ return (rval);
-+ }
-+
-+ DEBUG9_10(printk("%s(%ld): inst=%ld orig firmware options "
-+ "fw_options1=0x%x fw_options2=0x%x fw_options3=0x%x.\n",
-+ __func__, ha->host_no, ha->instance, ha->fw_options[1],
-+ ha->fw_options[2], ha->fw_options[3]));
-+
-+ switch (led_state) {
-+ case EXT_DEF_GRN_BLINK_ON:
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld start blinking led \n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ if (!ha->beacon_blink_led) {
-+ /* Enable firmware for update */
-+ ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) !=
-+ QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_MAILBOX;
-+ *pext_dstat = ha->fw_options[0];
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ if (qla2x00_get_fw_options(ha, ha->fw_options) !=
-+ QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_MAILBOX;
-+ *pext_dstat = ha->fw_options[0];
-+ DEBUG9_10(printk("%s(%ld): inst=%ld get"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+
-+ /* Enable the gpio_data reg for update */
-+ gpio_data |= GPDX_LED_UPDATE_MASK;
-+ WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-+ RD_REG_DWORD(&reg24->gpiod);
-+
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+ }
-+
-+ ha->beacon_color_state = 0; /* so all colors blink together */
-+
-+ /* Let the per HBA timer kick off the blinking process*/
-+ ha->beacon_blink_led = 1;
-+
-+ *pext_stat = EXT_STATUS_OK;
-+ *pext_dstat = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld LED setup to blink.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ break;
-+
-+ case EXT_DEF_GRN_BLINK_OFF:
-+ DEBUG9(printk("%s(%ld): inst=%ld stop blinking led \n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ ha->beacon_blink_led = 0;
-+ ha->beacon_color_state = QLA_LED_ALL_ON;
-+ qla24xx_blink_led(ha); /* will flip to all off */
-+
-+ /* give control back to firmware */
-+ spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
-+ gpio_data = RD_REG_DWORD(&reg24->gpiod);
-+
-+ /* Disable the gpio_data reg for update */
-+ gpio_data &= ~GPDX_LED_UPDATE_MASK;
-+ WRT_REG_DWORD(&reg24->gpiod, gpio_data);
-+ RD_REG_DWORD(&reg24->gpiod);
-+ spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
-+
-+ ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
-+
-+ if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_MAILBOX;
-+ *pext_dstat = ha->fw_options[0];
-+ DEBUG9_10(printk("%s(%ld): inst=%ld set"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ if (qla2x00_get_fw_options(ha, ha->fw_options) !=
-+ QLA_SUCCESS) {
-+ *pext_stat = EXT_STATUS_MAILBOX;
-+ *pext_dstat = ha->fw_options[0];
-+ DEBUG9_10(printk("%s(%ld): inst=%ld get"
-+ "firmware options failed.\n",
-+ __func__, ha->host_no, ha->instance));
-+ break;
-+ }
-+
-+ *pext_stat = EXT_STATUS_OK;
-+ *pext_dstat = EXT_STATUS_OK;
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld all LED blinking stopped.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ break;
-+
-+ default:
-+ DEBUG9_10(printk(
-+ "%s(%ld): inst=%ld invalid state received=%x.\n",
-+ __func__, ha->host_no, ha->instance, led_state));
-+
-+ *pext_stat = EXT_STATUS_UNSUPPORTED_SUBCODE;
-+ break;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): inst=%ld exiting.\n",
-+ __func__, ha->host_no, ha->instance));
-+
-+ return (rval);
-+}
-+
-+/*
-+ * qla2x00_get_tgt_lun_by_q
-+ * Get list of enabled luns from all target devices attached to the HBA
-+ * by searching through lun queue.
-+ *
-+ * Input:
-+ * ha = pointer to adapter
-+ *
-+ * Return;
-+ * 0 on success or errno.
-+ *
-+ * Context:
-+ * Kernel context.
-+ */
-+static int
-+qla2x00_get_tgt_lun_by_q(scsi_qla_host_t *ha, EXT_IOCTL *pext, int mode)
-+{
-+ fc_port_t *fcport;
-+ int ret = 0;
-+ os_tgt_t *ostgt;
-+ os_lun_t *up;
-+ uint16_t lun;
-+ uint16_t tgt;
-+ TGT_LUN_DATA_ENTRY *u_entry, *entry;
-+ TGT_LUN_DATA_LIST *u_list, *llist;
-+
-+
-+ DEBUG9(printk("%s: entered.\n", __func__));
-+
-+ llist = vmalloc(sizeof(TGT_LUN_DATA_LIST));
-+ if (llist == NULL) {
-+ DEBUG2_9_10(printk("%s: failed to alloc memory of size (%d)\n",
-+ __func__, (int)sizeof(TGT_LUN_DATA_LIST)));
-+ pext->Status = EXT_STATUS_NO_MEMORY;
-+ return (-ENOMEM);
-+ }
-+ memset(llist, 0, sizeof(TGT_LUN_DATA_LIST));
-+
-+ entry = &llist->DataEntry[0];
-+
-+ u_list = (TGT_LUN_DATA_LIST *)Q64BIT_TO_PTR(pext->ResponseAdr,
-+ pext->AddrMode);
-+ u_entry = &u_list->DataEntry[0];
-+
-+ DEBUG9(printk("%s(%ld): entry->Data size=%ld.\n",
-+ __func__, ha->host_no, (ulong)sizeof(entry->Data)));
-+
-+ /* Check thru this adapter's target list */
-+ for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
-+ if ((ostgt = (os_tgt_t *)TGT_Q(ha, tgt)) == NULL) {
-+ continue;
-+ }
-+
-+ if (ostgt->fcport == NULL) {
-+ /* no port */
-+ DEBUG9(printk("%s(%ld): tgt %d port not exist.\n",
-+ __func__, ha->host_no, tgt));
-+ continue;
-+ }
-+
-+ fcport = ostgt->fcport;
-+
-+ if (fcport->port_type != FCT_TARGET) {
-+ /* sanity check */
-+ DEBUG9(printk("%s(%ld): tgt %d port not target.\n",
-+ __func__, ha->host_no, tgt));
-+ continue;
-+ }
-+
-+ memcpy(entry->PortName, fcport->port_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ memcpy(entry->NodeName, fcport->node_name,
-+ EXT_DEF_WWN_NAME_SIZE);
-+ entry->BusNumber = 0;
-+ entry->TargetId = tgt;
-+
-+ entry->DevType = EXT_DEF_TARGET_DEV;
-+
-+ if (fcport->flags & FC_FABRIC_DEVICE) {
-+ entry->DevType |= EXT_DEF_FABRIC_DEV;
-+ }
-+ if (fcport->flags & FC_TAPE_PRESENT) {
-+ entry->DevType |= EXT_DEF_TAPE_DEV;
-+ }
-+ if (fcport->port_type & FCT_INITIATOR) {
-+ entry->DevType |= EXT_DEF_INITIATOR_DEV;
-+ }
-+
-+ entry->LoopId = fcport->loop_id;
-+
-+ entry->PortId[0] = 0;
-+ entry->PortId[1] = fcport->d_id.r.d_id[2];
-+ entry->PortId[2] = fcport->d_id.r.d_id[1];
-+ entry->PortId[3] = fcport->d_id.r.d_id[0];
-+
-+ memset(entry->Data, 0, sizeof(entry->Data));
-+
-+ for (lun = 0; lun < ha->max_luns && lun < EXTERNAL_LUN_COUNT;
-+ lun++) {
-+ up = (os_lun_t *) GET_LU_Q(ha, tgt, lun);
-+ if (up == NULL) {
-+ continue;
-+ }
-+ if (up->fclun == NULL) {
-+ continue;
-+ }
-+
-+ DEBUG9(printk("%s(%ld): lun %d io_cnt=%ld.\n",
-+ __func__, ha->host_no, lun, up->io_cnt));
-+
-+/* Disabled checking per customer request. */
-+#if 0
-+ if (up->io_cnt < 1) {
-+ /* not registered with OS */
-+ continue;
-+ }
-+#endif
-+
-+ DEBUG9(printk("%s(%ld): lun %d enabled.\n",
-+ __func__, ha->host_no, lun));
-+
-+ entry->Data[lun] |= LUN_DATA_ENABLED;
-+ }
-+
-+ entry->LunCount = lun;
-+
-+ DEBUG9(printk("%s(%ld): tgt %d lun count=%d.\n",
-+ __func__, ha->host_no, tgt, entry->LunCount));
-+
-+ ret = copy_to_user(u_entry, entry,
-+ sizeof(TGT_LUN_DATA_ENTRY));
-+
-+ if (ret) {
-+ /* error */
-+ DEBUG9_10(printk("%s: u_entry %p copy "
-+ "error. list->EntryCount=%d.\n",
-+ __func__, u_entry, llist->EntryCount));
-+ pext->Status = EXT_STATUS_COPY_ERR;
-+ ret = -EFAULT;
-+ break;
-+ }
-+
-+ llist->EntryCount++;
-+
-+ /* Go to next target */
-+ u_entry++;
-+ }
-+
-+ DEBUG9(printk("%s: final entry count = %d\n",
-+ __func__, llist->EntryCount));
-+
-+ if (ret == 0) {
-+ /* copy number of entries */
-+ ret = copy_to_user(&u_list->EntryCount, &llist->EntryCount,
-+ sizeof(llist->EntryCount));
-+ pext->ResponseLen = sizeof(TGT_LUN_DATA_LIST) +
-+ sizeof(TGT_LUN_DATA_ENTRY ) * (llist->EntryCount-1);
-+ }
-+
-+ vfree(llist);
-+ DEBUG9(printk("%s: exiting. ret=%d.\n", __func__, ret));
-+
-+ return ret;
-+}
-+
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qlfo.h ./drivers/scsi/qla2xxx/qlfo.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qlfo.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qlfo.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * San/Device Management Failover Ioctl Header
-@@ -101,17 +89,19 @@
- * IOCTL Commands
- */
-
--#define FO_CC_GET_PARAMS FO_CC_GET_PARAMS_OS
--#define FO_CC_SET_PARAMS FO_CC_SET_PARAMS_OS
--#define FO_CC_GET_PATHS FO_CC_GET_PATHS_OS
-+#define FO_CC_GET_PARAMS FO_CC_GET_PARAMS_OS
-+#define FO_CC_SET_PARAMS FO_CC_SET_PARAMS_OS
-+#define FO_CC_GET_PATHS FO_CC_GET_PATHS_OS
- #define FO_CC_SET_CURRENT_PATH FO_CC_SET_CURRENT_PATH_OS
--#define FO_CC_GET_HBA_STAT FO_CC_GET_HBA_STAT_OS
-+#define FO_CC_GET_HBA_STAT FO_CC_GET_HBA_STAT_OS
- #define FO_CC_RESET_HBA_STAT FO_CC_RESET_HBA_STAT_OS
- #define FO_CC_GET_LUN_DATA FO_CC_GET_LUN_DATA_OS
- #define FO_CC_SET_LUN_DATA FO_CC_SET_LUN_DATA_OS
- #define FO_CC_GET_TARGET_DATA FO_CC_GET_TARGET_DATA_OS
- #define FO_CC_SET_TARGET_DATA FO_CC_SET_TARGET_DATA_OS
- #define FO_CC_GET_FO_DRIVER_VERSION FO_CC_GET_FO_DRIVER_VERSION_OS
-+#define FO_CC_GET_LBTYPE FO_CC_GET_LBTYPE_OS
-+#define FO_CC_SET_LBTYPE FO_CC_SET_LBTYPE_OS
-
-
- /* Systemwide failover parameters. */
-@@ -399,6 +389,30 @@ typedef struct _FO_DRIVER_VERSION
- }
- FO_DRIVER_VERSION, *PFO_DRIVER_VERSION;
-
-+/* LB Type structures */
-+#define MAX_LB_ENTRIES 256
-+typedef struct _FO_LBTYPE_DATA
-+{
-+ UINT8 NodeName[FO_DEF_WWN_SIZE]; /* 8 */
-+ UINT32 LBPolicy; /* 4 */
-+ UINT8 Reserved0[12]; /* 12 */
-+}
-+FO_LBTYPE_DATA, *PFO_LBTYPE_DATA;
-+
-+typedef struct _FOTGTLBDATALIST
-+{
-+ UINT16 Reserved0;
-+ UINT16 EntryCount;
-+ UINT32 Reserved1;
-+ UINT32 Reserved2;
-+ UINT32 Reserved3;
-+ UINT32 Reserved4;
-+ UINT32 Reserved5;
-+ UINT32 Reserved6;
-+ UINT32 Reserved7;
-+ FO_LBTYPE_DATA Entry[MAX_LB_ENTRIES];
-+} FOTGTLBDATALIST, *PFOTGTLBDATALIST;
-+
-
- #define FO_LUN_DATA_LIST_MIN_ENTRIES 1
- #define FO_LUN_DATA_LIST_MAX_ENTRIES 256
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qlfolimits.h ./drivers/scsi/qla2xxx/qlfolimits.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qlfolimits.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qlfolimits.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
-
- /*
- * Minimums, maximums, defaults, and other definitions for MC_PARAMS.
-@@ -26,8 +14,8 @@
- #define FO_INSPECTION_INTERVAL_DEF 600
-
- #define FO_MAX_PATHS_PER_DEVICE_MIN 1
--#define FO_MAX_PATHS_PER_DEVICE_MAX 8
--#define FO_MAX_PATHS_PER_DEVICE_DEF 8
-+#define FO_MAX_PATHS_PER_DEVICE_MAX 64
-+#define FO_MAX_PATHS_PER_DEVICE_DEF 64
-
- #define FO_MAX_RETRIES_PER_PATH_MIN 1
- #define FO_MAX_RETRIES_PER_PATH_MAX 8
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/qlfoln.h ./drivers/scsi/qla2xxx/qlfoln.h
---- ./drivers/scsi/qla2xxx.qla2xxx/qlfoln.h 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/qlfoln.h 2006-07-07 03:06:49.000000000 +0400
-@@ -1,21 +1,9 @@
--/******************************************************************************
-- * QLOGIC LINUX SOFTWARE
-- *
-- * QLogic ISP2x00 device driver for Linux 2.6.x
-- * Copyright (C) 2003-2005 QLogic Corporation
-- * (www.qlogic.com)
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License as published by the
-- * Free Software Foundation; either version 2, or (at your option) any
-- * later version.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License for more details.
-+/*
-+ * QLogic Fibre Channel HBA Driver
-+ * Copyright (c) 2003-2005 QLogic Corporation
- *
-- ******************************************************************************/
-+ * See LICENSE.qla2xxx for copyright and licensing details.
-+ */
- #ifndef _QLFO_LN_H_
- #define _QLFO_LN_H_
-
-@@ -48,7 +36,11 @@
- QL_IOCTL_CMD(0xd1) /* 0xd1 */
- #define FO_CC_GET_FO_DRIVER_VERSION_OS \
- QL_IOCTL_CMD(0xd2) /* 0xd2 */
--#define FO_CC_END_IDX 0xd2 /* fo ioctl end idx */
-+#define FO_CC_GET_LBTYPE_OS \
-+ QL_IOCTL_CMD(0xd3) /* 0xd3 */
-+#define FO_CC_SET_LBTYPE_OS \
-+ QL_IOCTL_CMD(0xd4) /* 0xd4 */
-+#define FO_CC_END_IDX 0xd4 /* fo ioctl end idx */
-
-
- #define BOOLEAN uint8_t
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/release.txt ./drivers/scsi/qla2xxx/release.txt
---- ./drivers/scsi/qla2xxx.qla2xxx/release.txt 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/release.txt 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,40 @@
-+ Release Notes
-+
-+Driver Name : QLogic QLA21xx/QLA22xx/QLA23xx/QLA63xx/QLA24xx
-+ PCI Fibre Channel Linux Driver
-+Version : 8.01.05
-+OS platform : Red Hat RHEL 4 AS (IA32, PPC64, IA64 & AMD64)
-+ SuSE SLES9 (IA32, PPC64, AMD64 & IA64)
-+HBA Support : QLA21xx, QLA22xx, QLA23xx, QLA63xx, QLE236X, QLA24xx
-+FW version : QLA21xx: 1.19.25,
-+ QLA22xx: 2.02.08 TP,
-+ QLA23xx: 3.03.19 IPX,
-+ QLA24xx: 4.00.23
-+
-+
-+Table of Contents
-+I. Overview
-+II. Enhancements
-+III. Bug Fixes
-+IV. Known Issues
-+V. Additional Information
-+
-+
-+I. Overview
-+
-+This document describes the changes between versions 8.01.05b9 and
-+8.01.05 of the QLogic Fibre Channel driver for Linux.
-+
-+II. Enhancements
-+
-+III. Bug Fixes
-+- Correct issue while re-reading option-rom version information.
-+- Correct endianess problem while issuing a Marker IOCB on ISP24xx.
-+
-+IV. Known Issues
-+
-+There are no known issues at this time.
-+
-+V. Additional Information
-+
-+This driver must be used with API library v2.03-build13.
-diff -Nurap ./drivers/scsi/qla2xxx.qla2xxx/revision.notes ./drivers/scsi/qla2xxx/revision.notes
---- ./drivers/scsi/qla2xxx.qla2xxx/revision.notes 1970-01-01 03:00:00.000000000 +0300
-+++ ./drivers/scsi/qla2xxx/revision.notes 2006-07-07 03:06:49.000000000 +0400
-@@ -0,0 +1,1159 @@
-+/*
-+ * QLogic ISP2XXX Linux Driver Revision List File.
-+ *
-+ ********************************************************************
-+ *
-+ * Revision History
-+ *
-+ * Rev 8.01.05 July 06, 2006 LC/SS/AV
-+ *
-+ * - Correct issue while re-reading option-rom version
-+ * information.
-+ * - Correct endianess problem while issuing a Marker IOCB on
-+ * ISP24xx.
-+ * - Additional build.sh script updates.
-+ * - Simplify re-reading of option-rom version information.
-+ *
-+ * Rev 8.01.05b9 June 29, 2006 RA/DG/LC/AV
-+ *
-+ * - Correct panic durng CT passthrus due to timer not being
-+ * - Further tightening of LUN_Q member checks to handle
-+ * stale saved configurations.
-+ * - Fixes issue with Selective LUN failover using SANsurfer.
-+ * - Additional conf-module layout scanning logic fixes.
-+ * - Correct issue where LB settings were not being propegated
-+ * to the proper device.
-+ * - Consolidate disparite passthru response handling.
-+ * - Pass NVRAM link-down-on-NOS value to initialization
-+ * control block.
-+ * - Correctly set the firmware NOS/OLS timeout during
-+ * initialization.
-+ * - Correct buffer-overrun while updating conf-data.
-+ * - Correct conf-module layout scanning logic.
-+ * - Resync with latest released ISP24xx firmware -- 4.00.23.
-+ *
-+ * Rev 8.01.05b8 June 16, 2006 RA/DG/LC/AV
-+ *
-+ * - Correct panic durng CT passthrus due to timer not being
-+ * attached.
-+ * - Correct compilation issue when DEBUG2 enabled.
-+ * - Correct panic resulting from discrepency in stale saved
-+ * configuration.
-+ * - Fix issue where flushed-queued commands were returned
-+ * with wrong retry state.
-+ * - Make init code discardable.
-+ * - Correct stale references to IS_QLA25XX() macros.
-+ * - Revert "Remove all traces of FC-IP support."
-+ * - Revert "Really remove all traces of FC-IP support."
-+ * - Correct issue where LUN_Q objects were not properly
-+ * being freed.
-+ * - Correct usage of EFT size within driver.
-+ * - Add initial 24xx IP support.
-+ *
-+ * Rev 8.01.05b7 June 16, 2006 RA/DG/LC/AV
-+ *
-+ * - Correct 'loop-down' determination logic in
-+ * qla2x00_fw_ready().
-+ * - Update cached flash-versions during option ROM update.
-+ * - Cleanup DEBUG macro usage.
-+ * - Add DMI (Diagnostics Monitoring Interface) support.
-+ * - Rework firmware-trace facilities.
-+ * - Factor out SYSFS attribute manipulations to separate file.
-+ * - Really remove all traces of FC-IP support.
-+ * - Correct SLES10 initrd build failure.
-+ * - Correct issue where CT passthrus IOCBs were being sent to
-+ * wrong Nport ID.
-+ * - Honour 'skip process-login' option during fabric-login IOCB.
-+ * - Add NVRAM 'Disable Serdes' bit support.
-+ * - Correct setting of ISP54XX 'Supported Speed' during FDMI.
-+ * - Add support for ISP54XX option-rom layout.
-+ * - Remove all traces of FC-IP support.
-+ * - Resync with latest HBA SSID specification -- 2.2j.
-+ * - First-pass search-replace rename of FCF_ -> FC_ flags.
-+ *
-+ * Rev 8.01.05b6 May 18, 2006 RA/DG/LC/AV
-+ *
-+ * - Correct compilation errors introduced with recent commits.
-+ * - Fixed false failovers when a connection is reestablished.
-+ * - Fixed setting preferred paths on hitachi's DFXXX.
-+ * - Resync with latest released ISP24xx firmware -- 4.00.22.
-+ * - qla2xxx: Correct issue where driver improperly issued SNS
-+ * commands in N2N topologies.
-+ * - Consolidate firmware-dump handling across ISPs.
-+ * - Add support for alternate WWN NVRAM setting.
-+ * - Correct endianess comparisons during ISP24xx NVRAM
-+ * configuration.
-+ * - ABBA lock ordering fix.
-+ * - Update LICENSE file verbaige.
-+ * - Add Modules.symvers.
-+ * - Added 2/2/4/0 check condition trigger for NVSXXX device.
-+ * - Verify path is not switching before getting the TPG
-+ * information.
-+ * - Prevent ping ponging between controllers on the MSA1500
-+ * during failback.
-+ * - Correct TRS task-management handling during a bus reset.
-+ * - Correct compilation issue on SLES9.
-+ *
-+ * Rev 8.01.05b5 April 28, 2006 RA/DG/LC/AV
-+ *
-+ * - Added Datacore failover support.
-+ * - Correct 'already-completed' command handling in EH
-+ * code paths.
-+ * - Only free_irq() after request_irq() succeeds.
-+ * - Use FW calculated residual count for underrun handling.
-+ * - Correct ioctl32() compilation issue for 2.6.15 and
-+ * above.
-+ * - Add support for new flash part.
-+ * - Extend driver command-timer logic handling I/O with RISC
-+ * to non tape device.
-+ * - Flush the done queue in dpc rather than in timer context.
-+ * - Dont wait for loop transition to complete if LOOP_DEAD
-+ * state is attained.
-+ * - Don't depend on CONFIG_SCSI_QLA* defines for modules
-+ * compilation.
-+ * - Drop use of deprecated MODULE_PARAM() macro.
-+ * - Resync with latest released ISP24xx firmware -- 4.00.20.
-+
-+ * Rev 8.01.04 March 16, 2006 RA/DG/AV
-+ *
-+ * Rev 8.01.04b6 March 8, 2006 RA/DG/AV
-+ *
-+ * - Revert "Resync with latest released ISP23xx firmware
-+ * -- 3.03.20."
-+ * - Do *not* default to ZIO mode 6 on ISP24xx.
-+ *
-+ * Rev 8.01.04b5 March 7, 2006 RA/DG/AV
-+ *
-+ * - Add Incipient failover support.
-+ * - Revert "Pass buffer size to Get ID List mailbox command."
-+ * - Pass input-buffer length to Get-ID-List mailbox command.
-+ * - Drop noisy 'ZIO completion' messages.
-+ * - Don't try to free unallocated consistent memory.
-+ * - Resync with latest released ISP23xx firmware -- 3.03.20.
-+ * - Correct swing/emphasis settings on ISP24xx.
-+ * - Correct issue where ALUA information is not set.
-+ * - Drop excess DEBUG() statements.
-+ * - Properly free tpg_dma in qla2x00_get_target_xports().
-+ * - Issue the lun reset before changing the TPG state.
-+ * - Insure path is online before trying to failover to the
-+ * new HBA.
-+ * - Suspending all I/O on other path before failing back the
-+ * lun.
-+ * - Increase lun-reset task management function timeout.
-+ * - Correct FCAL login retry logic for ISP24xx.
-+ *
-+ * Rev 8.01.04b4 February 1, 2006 RA/DG/AV
-+ *
-+ * - Convert IS_QLA*() defines to bit-operations.
-+ * - Add ISP54xx support.
-+ * - Consolidate ISP63xx handling.
-+ * - Remove legacy ISP6312 firmware loader.
-+ * - Firmware updates.
-+ * - NVRAM id-list updates.
-+ * - Default to ZIO mode 6 on ISP24xx.
-+ * - Revert "Correct issue where firmware doesn't return
-+ * all commands after LOOP DOWN.
-+ * - Drop noisy 'UNDERRUN' status message.
-+ * - Correct compilation issues when additional DEBUG options
-+ * set.
-+ * - Pass buffer size to Get ID List mailbox command.
-+ *
-+ * Rev 8.01.04b3 January 13, 2006 RA/DG/RLU/AV
-+ *
-+ * - Update firmware-dump procedure for ISP24xx.
-+ * - Update serial-number /proc display code.
-+ * - Version-check export 'queue-depth' sysfs attribute.
-+ * - Version-check usage of 'shost->eh_active'.
-+ * - Version-check usage of class device API.
-+ * - Correct '#if/#ifdef <value>' inconsistencies.
-+ * - Correct 'auto'-inline compilation issues.
-+ * - Correct swing/emphasis settings for ISP24XX.
-+ * - Correct execution-throttle setting for ISP24xx.
-+ * - Correct setting of FDMI supported/current port speed.
-+ * - Allow preferred setting override of LB type.
-+ * - Correct XP visibility issue.
-+ * - Correct oops when unloading driver.
-+ * - Correct timer-extension logic.
-+ * - Correct issue where firmware doesn't return all commands
-+ * after LOOP DOWN.
-+ * - Delete references to the EXT_ADDR_MODE_OS define.
-+ *
-+ * Rev 8.01.04b2 December 02, 2005 RA/DG/AV
-+ *
-+ * - Correct short-WRITE status handling.
-+ * - Additional MSA active/active fixes.
-+ * - Add support for new flash part on qlx24xx.
-+ * - Fixed the panic for SPIFFI devices during failover.
-+ * - Corrected the handling for set preferred path.
-+ * - Disable auto-restore for MSA1500.
-+ * - Dont wait to return cmd's for backdoor device reset.
-+ *
-+ * Rev 8.01.04b1 November 23, 2005 RA/DG/RLU/AV
-+ *
-+ * - Correct PCI posting issues after initiating an ISP
-+ * soft-reset.
-+ * - Interrupts are disabled too early during the tear-down
-+ * process.
-+ * - Wait at least 100us after a soft-reset has been initiated
-+ * on an ISP24xx.
-+ * - Correct writing of NVRAM access-bits.
-+ * - Final NVRAM/FLASH protection-bit updates.
-+ * - Correct FCIP registration of supported FC4 types.
-+ * - Correct FC4 feature assignment during RFF_ID.
-+ * - Correct issue where TMF lun-reset issuance on ISP24xx.
-+ * - Correct endianess issue during TMF lun-reset submission.
-+ * - Correct issue where portstate does not transition during
-+ * loop-resync.
-+ * - Fixed panic during bus_resets with non-lunid storages.
-+ * - Correct setting of path-preference while load-balancing.
-+ * - Correct reservation handling during failover.
-+ * - Correct reservation conflicts on MSA1500.
-+ * - Correct issue during reset-handling.
-+ * - Correct issue where commands were being returned too early.
-+ * - Further corrections of command-timer modifications.
-+ * - Correct I/O failures during path selection.
-+ * - Don't base reset handling on eh_active flag.
-+ * - Disabled IO count checking in qla2x00_get_tgt_lun_by_q().
-+ *
-+ * Rev 8.01.03b9 November 3, 2005 AV
-+ * - Correct additional posting issues during NVRAM accesses.
-+ * - Correct HBA aliasing during nodename update.
-+ * - Update license.
-+ * - Resync with latest released ISP24xx firmware -- 4.00.16.
-+ *
-+ * Rev 8.01.03b8 November 1, 2005 RA/DG/AV
-+ * - Further limit select-route issuance.
-+ *
-+ * Rev 8.01.03b7 October 29, 2005 RA/DG/RL
-+ * - Fixed unconfigured issue when target number is changed from
-+ * from default.
-+ *
-+ * Rev 8.01.03b6 October 29, 2005 RA/DG/AV
-+ * - Added support to move the luns from passive to active on
-+ * single path configurations for HP active/passive
-+ * arrays.
-+ * - Fixed compilation warnings/Oop's in fo ioctl.
-+ *
-+ * Rev 8.01.03b5 October 28, 2005 RA/DG/RLU/AV
-+ *
-+ * - Use proper IOCB-type during SET_TARGET_PORT_GRP.
-+ * - Relax extranous debug messages during path-selection.
-+ * - Revert "Correct additional failover issues."
-+ * - Correct failover issues.
-+ * - Correct additional failover issues.
-+ * - Correct preferred-path setting issues.
-+ * - Disable auto-restore during failback on MSA/EVA.
-+ * - Extend maximum number of support paths.
-+ * - Correct modification of SCSI command timer after EH
-+ * thread is active.
-+ * - Correct abort issue during loop-down state.
-+ * - Add a new ioctl function and fixed ioctl memory problem.
-+ *
-+ * Rev 8.01.03b4 October 21, 2005 RA/DG/AV
-+ *
-+ * - Correct issue during instance-match failing case.
-+ * - Correct load-balancing/failover issues.
-+ *
-+ * Rev 8.01.03b3 October 18, 2005 RA/DG/AV
-+ *
-+ * - Force failover-capable compilation.
-+ * - Add Load-Balancing support.
-+ * - Selectable preferred paths for A/A and A/P devices.
-+ * - Correct loop-in-transition issues.
-+ *
-+ * Rev 8.01.03b2 October 10, 2005 RA/DG/RLU/AV
-+ *
-+ * - Correct issue where driver would not properly
-+ * failback luns.
-+ * - Corrected usage of Q64BIT_TO_PTR() by fo_ioctl
-+ * functions.
-+ *
-+ * Rev 8.01.03b1 Septemper 28, 2005 RA/DG/RLU/AV
-+ *
-+ * - PCI_ROM_ADDRESS is a 32 bit register and as such should be.
-+ * - Stop firmware execution at unintialization time.
-+ * - Resync with latest released ISP23xx/63xx firmware -- 3.03.18.
-+ * - Drop affinity checks during I/O submission.
-+ * - Correct issue where fcport is prematurely marked DEAD.
-+ * - Update version to 8.01.03b1.
-+ * - Add DFXXX failover support.
-+ * - Disable /proc (*) display for controller luns.
-+ * - Add EVA AA vendor/product IDs.
-+ * - Correct MSA active-standby issue.
-+ * - Remove build-initrd support from build.sh.
-+ * - Prevent driver from loading when instance# is wrong.
-+ * - Add translation of FW timeout status in scsi3_passthru.
-+ * - Save and report 2322 firmware version in flash.
-+ *
-+ * Rev 8.01.01 August 26, 2005 RA/AV
-+ *
-+ * - Add support for embedded ISP24xx firmware.
-+ * - Add support to reset ISP24XX hba during flash
-+ * update.
-+ * - Add 24xx firmwares (4.00.12).
-+ *
-+ * Rev 8.01.00 August 5, 2005 AV
-+ *
-+ * - Correct compilation issue on 2.6.12.
-+ * - Add new release.txt file to package.
-+ *
-+ * Rev 8.01.00b10 July 29, 2005 AV
-+ *
-+ * - Perform IO mapped accesses to the FLASH registers.
-+ * - Perform BIG hammer after NVRAM update to all ISPs
-+ *
-+ * Rev 8.01.00b9 July 26, 2005 DG/RA/AV
-+ *
-+ * - Update version to 8.01.00b9.
-+ * - Correct domain/area exclusion logic within FCAL.
-+ * - Remove RISC pause/release barriers during flash
-+ * manipulation.
-+ * - Correct ISP24xx soft-reset handling.
-+ * - Correct LED scheme definition.
-+ * - Fixed DS400 handling of check conditions.
-+ * - Add DSXXX failover support.
-+ *
-+ * Rev 8.01.00b8 July 20, 2005 DG/RA/AV
-+ *
-+ * - Updated target port group support.
-+ *
-+ * Rev 8.01.00b7 July 15, 2005 LC/AV
-+ *
-+ * - Update version to 8.01.00b7.
-+ * - Correct compilation issue on non-x86 platforms.
-+ *
-+ * Rev 8.01.00b6 July 14, 2005 LC/RLU/AV
-+ *
-+ * - Update version to 8.01.00b6.
-+ * - Correct bus-reset logic.
-+ * - Simplify redundant target/device reset logic.
-+ * - Bypass ports in same domain and area of adapter.
-+ * - Add FDMI support.
-+ * - Correct port-id binding issue during cable swaps.
-+ * - Consolidate ISP24xx chip reset logic.
-+ * - Add MODULE_PARM_DESC for ql2xprocessrscn and
-+ * ql2xfwloadbin.
-+ * - Add Kconfig option for ISP24xx support.
-+ * - Correct build issue during non-failover compilation.
-+ * - Correct permissions issue during 'build.sh install'
-+ * - Add 64bit ioctl support for x86_64 and ppc64.
-+ * - Fix an ioctl memory allocation problem on ia64 platforms.
-+ *
-+ * Rev 8.01.00b5 Jun 10, 2005 DG/RA/RLU/AV
-+ *
-+ * - Display proper fc_lun_t object while printing scsi_cmnd.
-+ * - Remove extraneous variable from qla2x00_next().
-+ * - Re-enable old FC-transport support for kernels < 2.6.9.
-+ * - Correct locking during ISP24xx flash manipulation.
-+ * - Merge with hba-mask
-+ * - Add support for HBA masking.
-+ * - Correct race condition while handling timed-out commands.
-+ * - Update test version 8.01.00b5-test5.
-+ * - Correct handling of residual-underrun/check-condition
-+ * during RLC.
-+ * - Merge with eh_fixes.
-+ * - Call proper start_scsi() callback during command
-+ * queueing.
-+ * - Additional EH fixes.
-+ * - Handle class_*() class_simple_*() interface deltas.
-+ * - Depend exclusively on extended_error_logging for debug
-+ * messages.
-+ * - Correct deficiencies in bus-reset EH function.
-+ * - Correct deficiencies in device-reset EH function.
-+ * - Correct locking issues with EH routines.
-+ * - Remove unused variable from
-+ * qla24xx_update_or_read_flash().
-+ * - Resync with latest isp21xx, isp22xx firmwares.
-+ * - Resync with latest released firmware -- 3.03.15.
-+ * - Misc. MSA/EVA failover fixes from 7.x.
-+ * - Correct handling of a LOGO during device-discovery.
-+ * - Updated build.sh for 8.x driver modified
-+ * - Add aditional __iomem annotations for register access.
-+ * - Correct VPD access issues.
-+ *
-+ * Rev 8.01.00b4 May 16, 2005 DG/RA/RLU/AV
-+ * - Don't dereference invalid host structure in
-+ * qla2x00_fo_get_tgt.
-+ * - Correct NVRAM write-protection disabling-code.
-+ * - Consistently reference the pdev variable within
-+ * the qla2x00_probe_one() context.
-+ * - Resync with latest HBA SSIS specification --
-+ * 2.1s.
-+ * - General cleansing of trailing white-space within
-+ * source files.
-+ * - Correct incorrect bit-wise assignment of mailbox
-+ * inputs.
-+ * - Correct flash-update issues on BE platforms.
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.14).
-+ *
-+ * Rev 8.01.00b2 April 21, 2005 DG/RA/RLU/AV
-+ * - Fix ISP24xx endianess issues while running on BE
-+ * machines.
-+ * - Add addition CFG device white-list entries for AA
-+ * storage.
-+ * - Add PCI-X/PCIe adjuments to config-space registers to
-+ * optimize throughput on ISP2422 and ISP2432.
-+ * - Small cosmetic cleanups of trailing white-space.
-+ *
-+ * Rev 8.01.00b1 April 04, 2005 DG/RA/RLU/AV
-+ * - Add ISP24xx support.
-+ * - Add FCIP support for ISP23xx.
-+ *
-+ * Rev 8.00.03b2 March XX, 2005 DG/RA/AV
-+ * - Correct issue with 'selective exclusion of failover'
-+ * patch.
-+ * - Do not perform any failover operations on tape storage.
-+ *
-+ * Rev 8.00.03b1 March 17, 2005 AV
-+ * - Revert to original pci_map_sg() usage in determining
-+ * the number of request-queue entries during I/O
-+ * submission.
-+ * - Add patch which properly errors-out when device is
-+ * disabled -- RH.
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.13).
-+ *
-+ * Rev 8.00.02b11 March 10, 2005 RL/AV
-+ * - Add support for selective exclusion of failover
-+ * devices based on known types.
-+ * - Updated Options Rom region code definition.
-+ * - Sync up ioctl definition files with 2.02beta5 api lib.
-+ * - Code formatting changes.
-+ * - Add support for new NVRAM parts.
-+ * - Add 'extended_error_logging' modules-parameter support
-+ * to enable DEBUG/DEBUG2.
-+ * - Fix bug in ISP2322 beacon support. Added clean up.
-+ * - Added checking and returning of "missing" devices that
-+ * are still found in persistent binding configuration
-+ * in qla2x00_std_get_tgt().
-+ * - Added returning of PCI Domain value used to identify
-+ * PCI devices in 2.6 kernel via query_chip ioctl.
-+ * - Added more port speed definition in exioct.h,
-+ * updated exioctln.h with latest version, and corrected
-+ * ha->link_data_rate assignment.
-+ * - Corrected return status value used when copy error.
-+ *
-+ * Rev 8.00.02b10 February 22, 2005 RL/AV
-+ * - Corrected ISP23xx beacon support.
-+ * - Corrected additional compilation warnings with certain
-+ * kernel distributions.
-+ * - Added checking of ConfigRequired flag in fcport_bind
-+ * in order to support "unconfigure" of devices.
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.11).
-+ *
-+ * Rev 8.00.02b9 January 20, 2005 AV
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.10).
-+ *
-+ * Rev 8.00.02b8 January 17, 2005 AV
-+ * - Add shell script to assist in driver compilation:
-+ * - extras/build.sh.
-+ * - Add support for failover compilation support under
-+ * non-SLES9 environments.
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.09).
-+ *
-+ * Rev 8.00.02b7 December 21, 2004 DG
-+ * - Fixed issue reading tpg_id from pg 83 of inquiry.
-+ * buffer too small.
-+ *
-+ * Rev 8.00.02b6 December 17, 2004 AV
-+ * - Backout previous change until further testing:
-+ * - Add code to exclude non-disk storage from failover
-+ * processing and handling.
-+ *
-+ * Rev 8.00.02b5 December 17, 2004 DG/AV
-+ * - Correct code for Guadalupe flash part.
-+ * - Return the proper IOCTL state during a loop-dead
-+ * condition.
-+ * - Add code to exclude non-disk storage from failover
-+ * processing and handling.
-+ *
-+ * Rev 8.00.02b4 December 9, 2004 AV
-+ * - Resync with Linux Kernel 2.6.10-rc2.
-+ * - Additional code cleanup of unsused functions (Adrian
-+ * - [PATCH] qla2xxx: remove dead code, add missing statics
-+ * (Christoph Hellwig <hch@lst.de>).
-+ * - Additional code cleanup of unsused functions (Adrian
-+ * Bunk).
-+ *
-+ * Rev 8.00.02b3 December 3, 2004 RA/AV
-+ * - Added the support for Guadalupe flash part.
-+ * - Cleanup ISP6312/ISP6322 code consolidation.
-+ * - Add fix to report the correct target port group based on
-+ * state.
-+ * - Add fix to address the panic for devices which does not
-+ * support Tgt Port Group -- initialize the TPG List
-+ * irrespective whether devices support TPG or not.
-+ * - Add fix to handle the transition wait time from standby
-+ * to active state for Adaptec storage during the execution
-+ * of the set_target_port_grp().
-+ * - Add support for failover compilation under RHEL4.
-+ *
-+ * Rev 8.00.02b2 November 29, 2004 RA/DG
-+ * - Added the support for devices which support Target Port Group.
-+ * - Fixed the segmentation fault while freeing tgt_port/lu_path memory
-+ * - Static Load balancing turned off by default. Default behaviour is
-+ * to expose all the luns on the first active path.
-+ * - Fixed the incorrect masking off ALUA field from inquiry data.
-+ * - Add the luns to active lu_path irrespective of ALUA support.
-+ * - Free the tgt_port_grp/lu_path/mp_port memory during unload.
-+ * - Added the lu_path to describe path on a per lun basis.
-+ * - Mark the fclun as active if tgt_port_grp is in active state.
-+ * - Added the support for Target Port Groups and Set Target Port Groups.
-+ *
-+ * Rev 8.00.02b1-pre1 November ??, 2004 AV
-+ * - Correct failover issue while dealing with handling multi-
-+ * controller/multi-ported storage.
-+ * - Moved inline functions from qla_32ioctl.c to qla_32ioctl.h
-+ * to eliminate compile error on gcc 3.4.2.
-+ * - Add support for HBA portname aliasing.
-+ * - Add SYSFS queue-depth override (Jeremy Higdon -- SGI).
-+ * - Merge patch from Christoph Hellwig [hch@lst.de]:
-+ * - Properly iounmap() allocations.
-+ * - Sparse __iomem annotations.
-+ * - Add new 2300/2322 IPX and 6312 FLX firmwares (3.03.08).
-+ * - Remove 6322 FLX image, since 6312 FLX can handle both
-+ * chips.
-+ *
-+ * Rev 8.00.01 November 12, 2004 AV
-+ * - Released to DVT.
-+ *
-+ *
-+ * Rev 8.00.01b3 October 12, 2004 RA/RL/AV
-+ * - Sync up with latest api in distribution package.
-+ *
-+ * Rev 8.00.01b2 October 12, 2004 RA/RL/AV
-+ * - Packed the loopback related ioctl structures so the sizes
-+ * are consistent between user and kernel spaces on certain
-+ * platforms.
-+ * - Use proper return codes in qla2x00_fabric_login() to
-+ * ensure DPC process login requests correctly.
-+ * - qla_nvr updates:
-+ * - Calculate the checksum of the incoming binary file
-+ * AFTER writing the ascii file and return an exit status
-+ * of 2 for an invalid checksum.
-+ * - When verifying the portname of the incoming ascii file,
-+ * return an exit status of 1 on error.
-+ * - Return an exit status of 3 on command line argument
-+ * errors.
-+ * - Add support for new flash part used with ISP2322.
-+ *
-+ * Rev 8.00.01b1 October 5, 2004 RA/RL/AV
-+ * - Handle PLOGI reject failures during qla2x00_fabric_login().
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.03.06).
-+ *
-+ * Rev 8.00.00 October 1, 2004 RA/RL/AV
-+ * - 2300/2322 IPX and 6312/6322 FLX firmwares (3.03.01).
-+ *
-+ * Rev 8.00.00b22 September 10, 2004 RA/RL/AV
-+ * - Resync with 7.03.00b3.
-+ * - Check for additional ASC/ASCQ values during
-+ * qla2x00_fo_check_device().
-+ * - Rename s/_REG_WORD_IOMEM/_REG_WORD_PIO to more accurately
-+ * reflect the operation.
-+ * - Add MODULE_VERSION() support for all modules.
-+ * - Add qla2xxx_conf module support.
-+ * - Add support for new swing/emphasis/sensitivity settings.
-+ * - Add support for new LED scheme.
-+ * - Packed the EXT_IOCTL structure so the ioctl command values
-+ * are consistent across all platforms.
-+ * - Added persistent config save.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.03.05).
-+ *
-+ * Rev 8.00.00b21 September 02, 2004 AV
-+ * - Always set TCQ modifier for each command submitted.
-+ *
-+ * Rev 8.00.00b20 August 30, 2004 RL
-+ * - Changed the CONFIG defines used to determine whether to
-+ * use the ResponseAdr and RequestAdr fields in ioctl struct
-+ * as 32bit or 64bit pointers.
-+ *
-+ * Rev 8.00.00b19 August 27, 2004 RL
-+ * - Corrected UINT64 type definition to be true 64bit instead
-+ * of "void *". Renamed the old type to UINT64_O for backward
-+ * compatibility in the API source.
-+ * - Updated exioct header files to latest version.
-+ * - Added 64bit to pointer conversion in ioctl functions to
-+ * handle the new 64bit field.
-+ * - Added code to support/register 32bit ioctl calls.
-+ *
-+ * Rev 8.00.00b18 August 23, 2004 DG/RA/AV
-+ * - Add 're-scan' and 'initiate lip' support via /proc --
-+ * similar to the 7.x series drivers.
-+ * - Fix bus-reset issue during back-door execution.
-+ * - Add pci_disable_device() calls to proper locations during
-+ * pci-probe failure and pci-remove.
-+ * - Fix bus-reset issue during back-door execution.
-+ * - Fix allocation-flag issues during mempool allocations in
-+ * qla2x00_queuecommand().
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.03.02).
-+ *
-+ * Rev 8.00.00b17 July 23, 2004 DG/RA/AV
-+ * - Rework driver DMA allocations to use the DMA pool
-+ * facilities to minimize potential run-time allocation
-+ * failures.
-+ * - Add module parameter ql2xprocessnotready, to selectively
-+ * enable/disable the driver's internal NOT_READY check-
-+ * condition handling.
-+ * - Rework interrupt-handler registration in anticipation of
-+ * future chip types.
-+ *
-+ * Rev 8.00.00b16 July 16, 2004 DG/RA/AV
-+ * - Resync with Linux Kernel 2.6.8-rc1-mm1.
-+ * - Resync with 7.00.04b4.
-+ * - Fix issue where host-reset would incorrectly return a
-+ * FAILED status.
-+ * - Fix issue where firmware options were not set before
-+ * firmware initialization.
-+ * - Fix issue while parsing for the FCODE version string.
-+ * - Fix additional PCI posting issues.
-+ * - Dynamically resize request-queue during initialization
-+ * based on the amount of memory available to the ISP.
-+ * - Fix compilation issues with inline functions and GCC 3.4
-+ * (Adrian Bunk [bunk@fs.tum.de]).
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.03.01):
-+ *
-+ * Rev 8.00.00b14 June 21, 2004 DG/RA/AV
-+ * - Resync with Linux Kernel 2.6.7.
-+ * - Resync with 7.00.04b2.
-+ * - Add modules parameter to enable ZIO -- Support mode 5 only.
-+ * - Remove incorrect and unused ISP2100 #define
-+ * SS_RESIDUAL_LEN_VALID.
-+ * - Fix several additional tape-handling issues.
-+ * - Correct interrupt-handler problems while the RISC is paused.
-+ * - Fix problem where an incorrect status would be returned for
-+ * qla2x00_configure_fabric() if the driver was unable to log
-+ * into a fabric's SNS.
-+ * - Check for the additional WAIT_FOR_AL_PA state in
-+ * qla2x00_fw_ready() since switch vendors may push NOS/OLS
-+ * primitives during a 'port disabled' state.
-+ * - Add firmware dump support for ISPs with memory chips larger
-+ * than 128KB (512/1024KB).
-+ * - Remove TRUE/FALSE #define usage within the driver.
-+ * - Remove dependency on depricated drivers/scsi/* headers.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.30):
-+ *
-+ * Rev 8.00.00b13 May 21, 2004 DG/RA/AV
-+ * - Resync with Linux Kernel 2.6.6-mm3.
-+ * - Resync with 7.00.00b27.
-+ * - Add permissions to module_param()s.
-+ * - Fix fabric scan and SNS registration logic for ISP2100.
-+ * - Don't use the 'point-to-point preferred, else loop'
-+ * connection mode setting on an ISP2200.
-+ * - Interrogate the proper CDB array when attempting to
-+ * determine data direction.
-+ * - Restructure qla2x00_start_scsi() so that PCI mappings are
-+ * done after we've verified command list and request queue
-+ * resource availability.
-+ * - Properly calculate data-transfer residuals during command
-+ * post-processing (Tony Battersby [tonyb@cybernetics.com]).
-+ * - Fixup nested spinlock usage in error-hanlding functions.
-+ * - Add wmb() to selected locations during request-queue
-+ * modifications.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.29):
-+ *
-+ * Rev 8.00.00b12 April 23, 2004 DG/RA/AV
-+ * - Resync with Linux Kernel 2.6.6-rc2-mm1.
-+ * - Resync with 7.00.00b27.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.28):
-+ *
-+ * Rev 8.00.00b11 February 27, 2004 DG/RA/AV
-+ * - Resync with Linux Kernel 2.6.3-mm3.
-+ * - Resync with 7.00.00b17.
-+ * - Failover feature-complete.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.24):
-+ *
-+ * Rev 8.00.00b10 January 20, 2004 AV
-+ * - Resync with Linux Kernel 2.6.1-mm5.
-+ * - Add #ifdefs around failover and IOCTL code in the common
-+ * driver for easy removal with unifdef.
-+ * - Parcel out ISP recognition to per-firmware loaders:
-+ * - ISP2322 - qla2322, ISP6312 - qla6312, ISP6322 - qla6322.
-+ * - Patch: Older gcc's don't understand anonymous unions
-+ * (Andrew Morton [akpm@osdl.org]).
-+ * - Removed extras/add_to_kernel.diff file.
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.21):
-+ *
-+ * Rev 8.00.00b9 January 14, 2004 AV
-+ * - Resync with Linux Kernel 2.6.1.
-+ * - Merge several patches from Christoph Hellwig [hch@lst.de]:
-+ * - use select for CONFIG_SCSI_QLA2XXX, shorten the name of
-+ * the failover option, sanitize kconfig texts.
-+ * - make ioctl code optional.
-+ * - use a common and simpler variant of the down with
-+ * timeout scheme.
-+ * - use new-style module_param() everywhere (works also for
-+ * the compiled-in case).
-+ * - Move some debug defines from qla_def.h to qla_dbg.h
-+ * - Use kmalloc directly instead of qla2xxx_kmem_zalloc and
-+ * associated wrappers.
-+ * - Misc changes that don't affect generated code.
-+ * - Minimize device_id checks in register access functions
-+ * (IS_QLA23XX(), ISP_*_Q_*(), ...), emphasis on
-+ * non-ISP2[12]00 chips.
-+ * - Add initial ISP6312/ISP6322 definitions and checks during
-+ * board configuration.
-+ * - Only retrieve firmware version and resource counts if
-+ * we've successfully initialized the firmware.
-+ * - Ensure the driver is logged into the SNS port before
-+ * performing any registrations.
-+ * - Always use MMIO for chip register accesses.
-+ * - Remove MEMORY_MAPPED_IO define.
-+ * - Address FLASH deficiencies with ISP2312 v2 chips.
-+ * - Fix more PCI posting issues.
-+ * - Wait for at most MAX_LOOP_TIMEOUT in
-+ * qla2x00_wait_for_hba_online().
-+ * - Generalize descriptive name used for the driver
-+ * (i.e. QLogic ISP2xxx FC Driver --> QLogic FC Driver).
-+ * - Remove unused debug routines (ENTER/LEAVE(), etc.).
-+ * - Add new 2300/2322 IPX and 6312/6322 FLX firmwares (3.02.20):
-+ * - Remove 2300 TPX firmware from distribution.
-+ *
-+ * Rev 8.00.00b8 December 5, 2003 AV
-+ * - Instruct mid-layer to perform initial scan.
-+ *
-+ * Rev 8.00.00b7 December 5, 2003 AV
-+ * - Resync with Linux Kernel 2.6.0-test11.
-+ * - Add basic NVRAM parser (extras/qla_nvr).
-+ *
-+ * Rev 8.00.00b7-pre11 December 3, 2003 AV
-+ * - Sanitize the scsi_qla_host structure:
-+ * - Purge unused elements.
-+ * - Reorganize high-priority members (cache coherency).
-+ * - Add support for NVRAM access via a sysfs binary attribute:
-+ * - Consolidate semaphore locking access.
-+ * - Fix more PCI posting issues.
-+ * - Add extras directory for dump/NVRAM tools.
-+ * - Remove unused qla_vendor.c file.
-+ *
-+ * Rev 8.00.00b7-pre11 November 26, 2003 DG/AV
-+ * - Merge several patches from Christoph Hellwig [hch@lst.de]:
-+ * - in Linux 2.6 both pci and the scsi layer use the generic
-+ * dma direction bits, use them directly instead of the scsi
-+ * and pci variants and the (noop) conversion routines.
-+ * - Fix _IOXX_BAD() usage for external IOCTL interface.
-+ * - Use atomic construct for HA loop_state member.
-+ * - Add generic model description text for HBA types.
-+ *
-+ * Rev 8.00.00b7-pre5 November 17, 2003 AV
-+ * - Merge several patches from Christoph Hellwig [hch@lst.de]:
-+ * - patch to split the driver into a common qla2xxx.ko and a
-+ * qla2?00.ko for each HBA type - the latter modules are
-+ * only very small wrappers, mostly for the firmware
-+ * images, all the meat is in the common qla2xxx.ko.
-+ * - make the failover code optional.
-+ * - kill useless lock_kernel in dpc thread startup.
-+ * - no need for modversions hacks in 2.6 (or 2.4).
-+ * - kill qla2x00_register_with_Linux.
-+ * - simplify EH code, cmd or it's hostdata can't be NULL, no
-+ * need to search whether the host it's ours, the midlayer
-+ * makes sure it won't call into a driver for some else
-+ * host.
-+ * - Merge several patches from Jes Sorensen
-+ * [jes@wildopensource.com]:
-+ * - Call qla2x00_config_dma_addressing() before performing
-+ * any consistent allocations. This is required since the
-+ * dma mask settings will affect the memory
-+ * pci_alloc_consistent() will return.
-+ * - Call pci_set_consistent_dma_mask() to allow for 64 bit
-+ * consistent allocations, required on some platforms such
-+ * as the SN2.
-+ * - Wait 20 usecs (not sure how long is really necessary,
-+ * but this seems safe) after setting CSR_ISP_SOFT_RESET in
-+ * the ctrl_status register as the card doesn't respond to
-+ * PCI reads while in reset state. This causes a machine
-+ * check on some architectures.
-+ * - Flush PCI writes before calling udelay() to ensure the
-+ * write is not sitting idle in-flight for a while before
-+ * hitting the hardware.
-+ * - Include linux/vmalloc.h in qla_os.c since it uses
-+ * vmalloc().
-+ * - Use auto-negotiate link speed when using default
-+ * parameters rather than NVRAM settings. Disable NVRAM
-+ * reading on SN2 since it's not possible to execute the
-+ * HBA's BIOS on an SN2. I suggest doing something similar
-+ * for all architectures that do not provide x86 BIOS
-+ * emulation.
-+ * - Clean-up slab-cache allocations:
-+ * - locking.
-+ * - mempool allocations in case of low-memory situations.
-+ * - Fallback to GA_NXT scan if GID_PT call returns more than
-+ * MAX_FIBRE_DEVICES.
-+ * - Preserve iterating port ID across GA_NXT calls in
-+ * qla2x00_find_all_fabric_devs().
-+ * - Pre-calculate ASCII firmware dump length as to not incur the
-+ * cost-to-calculate at each invocation of a read().
-+ *
-+ * Rev 8.00.00b6 November 4, 2003 AV
-+ * - Add new 2300 TPX firmware (3.02.18).
-+ *
-+ * Rev 8.00.00b6-pre25 October 20, 2003 RA/AV
-+ * - Resync with Linux Kernel 2.6.0-test9.
-+ * - Rework firmware dump process:
-+ * - Use binary attribute within sysfs tree.
-+ * - Add user-space tool (gdump.sh) to retrieve formatted
-+ * buffer.
-+ * - Add ISP2100 support.
-+ * - Use a slab cache for SRB allocations to reduce memory
-+ * pressure.
-+ * - Initial conversion of driver logging methods to a new
-+ * qla_printk() function which uses dev_printk (Daniel
-+ * Stekloff, IBM).
-+ * - Further reduce stack usage in qla2x00_configure_local_loop()
-+ * and qla2x00_find_all_fabric_devs().
-+ * - Separate port state used for routing of I/O's from port
-+ * mgmt-login retry etc.
-+ *
-+ * Rev 8.00.00b6-pre19 October 13, 2003 AV
-+ * - Resync with Linux Kernel 2.6.0-test7-bk5.
-+ * - Add intelligent RSCN event handling:
-+ * - reduce scan time during 'port' RSCN events by only
-+ * querying specified port ids.
-+ * - Available on ISP23xx cards only.
-+ * - Increase maximum number of recognizable targets from 256
-+ * to 512.
-+ * - Backend changes were previously added to support TPX
-+ * (2K logins) firmware. Mid-layer can now scan for targets
-+ * (H, B, T, L) where 512 < T >= 0.
-+ * - Remove IP support from driver.
-+ * - Switch firmware types from IP->TP for ISP22xx and
-+ * IPX->TPX for ISP23xx cards.
-+ * - Remove files qla_ip.[ch].
-+ * - Remove type designations from firmware filenames.
-+ *
-+ * Rev 8.00.00b6-pre11 September 15, 2003 DG/AV
-+ * - Resync with 6.06.00.
-+ * - Resync with Linux Kernel 2.6.0-test5-bk3.
-+ * - Add new 2300 IPX firmware (3.02.15).
-+ *
-+ * Rev 8.00.00b5 July 31, 2003 AV
-+ * - Always create an fc_lun_t entry for lun 0 - as the mid-
-+ * layer requires access to this lun for discovery to occur.
-+ * - General sanitizing:
-+ * - Add generic firmware option definitions.
-+ * - Generalize retrieval/update of firmware options.
-+ * - Fix compile errors which occur with extended debug.
-+ * - Handle failure cases for scsi_add_host() and
-+ * down_interruptible().
-+ * - Host template updates:
-+ * - Use standard bios_param callback function.
-+ * - Disable clustering.
-+ * - Remove unchecked_is_dma entry.
-+ *
-+ * Rev 8.00.00b5-pre5 July 29, 2003 DG/AV
-+ * - Resync with 6.06.00b13.
-+ * - Resync with Linux Kernel 2.6.0-test2.
-+ * - Pass the complete loop_id, not the masked (0xff) value
-+ * while issuing mailbox commands (qla_mbx.c/qla_fo.c/
-+ * qla_iocb.c/qla_init.c).
-+ * - Properly handle zero-length return status for an RLC CDB.
-+ * - Create an fclun_t structure for 'disconnected' luns,
-+ * peripheral-qualifier of 001b.
-+ * - Remove unused LIP-sequence register access during AE 8010.
-+ * - Generalize qla2x00_mark_device_lost() to handle forced
-+ * login request -- modify all direct/indirect invocations
-+ * with proper flag.
-+ * - Save RSCN notification (AE 8015h) data in a proper and
-+ * consistent format (domain, area, al_pa).
-+ * - General sanitizing:
-+ * - scsi_qla_host structure member reordering for cache-line
-+ * coherency.
-+ * - Remove unused SCSI opcodes, endian-swap definitions.
-+ * - Remove CMD_* pre-processor defines.
-+ * - Remove unused SCSIFCHOTSWAP/GAMAP/MULTIHOST codes.
-+ * - Backout patch which added a per-scsi_qla_host scsi host
-+ * spinlock, since mid-layer already defines one.
-+ * - Add new 2300 IPX firmware (3.02.15).
-+ *
-+ * Rev 8.00.00b4 July 14, 2003 RA/DG/AV
-+ * - Resync with 6.06.00b12.
-+ * - Resync with Linux Kernel 2.6.0-test1.
-+ * - Remove IOCB throttling code -- originally #if'd.
-+ * - Remove apidev_*() routines since proc_mknod() has been
-+ * removed -- need alternate IOCTL interface.
-+ * - Merge several performance/fix patches from Arjan van de
-+ * Ven:
-+ * - Undefined operation >> 32.
-+ * - No need to acquire mid-layer lock during command
-+ * callback.
-+ * - Use a per-HBA mid-layer lock.
-+ * - Use a non-locked cycle for setting the count of the
-+ * newly allocated sp (qla2x00_get_new_sp()).
-+ * - Modify semantic behavior of qla2x00_queuecommand():
-+ * - Reduce cacheline bouncing by having I/Os submitted
-+ * by the IRQ handler.
-+ * - Remove extraneous calls to qla2x00_next() during I/O
-+ * queuing.
-+ * - Use list_splice_init() during qla2x00_done() handling
-+ * of commands to reduce list_lock contention.
-+ * - RIO mode support for ISP2200:
-+ * - Implementation differs slightly from original patch.
-+ * - Do not use bottom-half handler (tasklet/work queue)
-+ * for qla2x00_done() processing.
-+ *
-+ * Rev 8.00.00b4-pre22 July 12, 2003 AV
-+ * - Check for 'Process Response Queue' requests early during
-+ * the Host Status check.
-+ * - General sanitizing:
-+ * - srb_t structure rewrite, removal of unused members.
-+ * - Remove unused fcdev array, fabricid, and PORT_*
-+ * definitions.
-+ * - Remove unused config_reg_t PCI definitions.
-+ * - Add new 2200 IP firmware (2.02.06).
-+ * - Add new 2300 IPX firmware (3.02.14).
-+ *
-+ * Rev 8.00.00b4-pre19 June 30, 2003 AV
-+ * - Resync with Linux Kernel 2.5.73-bk8.
-+ * - Rework IOCB command queuing methods:
-+ * - Upper-layer driver *MUST* properly set the direction
-+ * bit of SCSI commands.
-+ * - Generalize 32bit/64bit queuing path functions.
-+ * - Remove costly page-boundary cross check when using
-+ * 64bit address capable IOCBs.
-+ *
-+ * Rev 8.00.00b4-pre15 June 19, 2003 AV
-+ * - Resync with 6.06.00b11.
-+ * - Continue fcport list consolidation work:
-+ * - Updated IOCTL implementations to use new fcports
-+ * list.
-+ * - Modified product ID check to not verify ISP chip
-+ * revision -- ISP2312 v3 (qla2x00_chip_diag()).
-+ * - Add new 2300 IPX firmware (3.02.13):
-+ *
-+ * Rev 8.00.00b4-pre13 June 19, 2003 AV
-+ * - Fix build process for qla2100 driver -- no support
-+ * for IP.
-+ * - SCSI host template modifications:
-+ * - Set sg_tablesize based on the derived DMA mask.
-+ * - Increase max_sectors since only limit within RISC
-+ * is transfer of (((2^32) - 1) >> 9) sectors.
-+ *
-+ * Rev 8.00.00b4-pre12 June 18, 2003 RA, DG, RL, AV
-+ * - Resync with 6.06.00b10.
-+ * - Resync with Linux Kernel 2.5.72.
-+ * - Initial fcport list consolidation work:
-+ * - fcports/fcinitiators/fcdev/fc_ip --> ha->fcports
-+ * list.
-+ *
-+ * Rev 8.00.00b4-pre7 June 05, 2003 AV
-+ * - Properly release PCI resouces in init-failure case.
-+ * - Reconcile disparite function return code definitions.
-+ *
-+ * Rev 8.00.00b4-pre4 June 03, 2003 AV
-+ * - Resync with Linux Kernel 2.5.70-bk8:
-+ * - SHT proc_info() changes.
-+ * - Restructure SNS Generic Services routines:
-+ * - Add qla_gs.c file to driver distribution.
-+ * - Configure PCI latency timer for ISP23xx.
-+ *
-+ * Rev 8.00.00b4-pre3 June 02, 2003 RA, DG, RL, AV
-+ * - Resync with 6.06.00b5.
-+ * - Rework (again) PCI I/O space configuration
-+ * (Anton Blanchard):
-+ * - Use pci_set_mwi() routine;
-+ * - Remove uneeded qla2x00_set_cache_line() function.
-+ * - Remove extraneous modification of PCI_COMMAND word.
-+ *
-+ * Rev 8.00.00b3 May 29, 2003 AV
-+ * - Resync with Linux Kernel 2.5.70.
-+ * - Move RISC paused check from ISR fast-path.
-+ *
-+ * Rev 8.00.00b3-pre8 May 26, 2003 AV
-+ * - Add new 2300 IPX firmware (3.02.12):
-+ * - Rework PCI I/O space configuration.
-+ *
-+ * Rev 8.00.00b3-pre6 May 22, 2003 RA, DG, RL, AV
-+ * - Resync with 6.06.00b3.
-+ *
-+ * Rev 8.00.00b3-pre4 May 21 2003 AV
-+ * - Add new 2300 IPX firmware (3.02.11):
-+ * - Remove 2300 TPX firmware from distribution.
-+ *
-+ * Rev 8.00.00b3-pre3 May 21 2003 AV
-+ * - Properly setup PCI configuation space during
-+ * initialization:
-+ * - Properly configure Memory-Mapped I/O during early
-+ * configuration stage.
-+ * - Rework IP functionality to support 2k logins.
-+ * - Add new 2300 IPX firmware (3.02.11):
-+ * - Remove 2300 TPX firmware from distribution.
-+ *
-+ * Rev 8.00.00b3-pre2 May ??, 2003 RA, DG, RL, AV
-+ * - Resync with 6.06.00b1.
-+ *
-+ * Rev 8.00.00b3-pre1 May ??, 2003 RA, DG, RL, AV
-+ * - Resync with 6.05.00.
-+ *
-+ * Rev 8.00.00b2 May 19, 2003 AV
-+ * - Simplify dma_addr_t handling during command queuing given
-+ * new block-layer defined restrictions:
-+ * - Physical addresses not spanning 4GB boundaries.
-+ * - Firmware versions: 2100 TP (1.19.24), 2200 IP (2.02.05),
-+ * 2300 TPX (3.02.10).
-+ *
-+ * Rev 8.00.00b2-pre1 May 13, 2003 AV
-+ * - Add support for new 'Hotplug initialization' model.
-+ * - Simplify host template by removing unused callbacks.
-+ * - Use scsicam facilities to determine geometry.
-+ * - Fix compilation issues for non-ISP23xx builds:
-+ * - Correct register references in qla_dbg.c.
-+ * - Correct Makefile build process.
-+ *
-+ * Rev 8.00.00b1 May 05, 2003 AV
-+ * - Resync with Linux Kernel 2.5.69.
-+ * - Firmware versions: 2100 TP (1.19.24), 2200 TP (2.02.05),
-+ * 2300 TPX (3.02.10).
-+ *
-+ * Rev 8.00.00b1-pre45 April ??, 2003 AV
-+ * - Resync with Linux Kernel 2.5.68-bk11:
-+ * - Fix improper return-code assignment during fabric
-+ * discovery.
-+ * - Remove additional extraneous #defines from
-+ * qla_settings.h.
-+ * - USE_PORTNAME -- FO will always use portname.
-+ * - Default queue depth size set to 64.
-+ *
-+ * Rev 8.00.00b1-pre42 April ??, 2003 AV
-+ * - Convert bottom-half tasklet to a work_queue.
-+ * - Initial basic coding of dynamic queue depth handling
-+ * during QUEUE FULL statuses.
-+ * - Fix mailbox interface problem with
-+ * qla2x00_get_retry_cnt().
-+ *
-+ * Rev 8.00.00b1-pre41 April ??, 2003 AV
-+ * - Convert build defines qla2[1|2|3]00 macros to
-+ * qla2[1|2|3]xx due to module name stringification clashes.
-+ * - Add additional ISP2322 checks during board configuration.
-+ *
-+ * Rev 8.00.00b1-pre40 April ??, 2003 AV
-+ * - Resync with Linux Kernel 2.5.68-bk8:
-+ * - Updated IRQ handler interface.
-+ * - Add ISP dump code (stub) in case of SYSTEM_ERROR on
-+ * ISP2100.
-+ * - Add new 2200 IP firmware (2.02.05).
-+ *
-+ * Rev 8.00.00b1-pre39 April ??, 2003 AV
-+ * - Resync with Linux Kernel 2.5.68.
-+ * - Add simple build.sh script to aid in external compilation.
-+ * - Clean-break with Kernel 2.4 compatibility.
-+ * - Rework DPC routine -- completion routines for signaling.
-+ * - Re-add HBAAPI character device node for IOCTL support.
-+ * - Remove residual QLA2X_PERFORMANCE defines.
-+ * - Allocate SP pool via __get_free_pages() rather than
-+ * individual kmalloc()'s.
-+ * - Inform SCSI mid-layer of 16-byte CDB support
-+ * (host->max_cmd_len):
-+ * - Remove unecessary 'more_cdb' handling code from
-+ * qla_iocb.c and qla_xioct.c.
-+ * - Reduce duplicate code in fabric scanning logic (MS IOCB
-+ * preparation).
-+ * - Add ISP dump code in case of SYSTEM_ERROR.
-+ * - Remove 2300 VIX firmware from distribution:
-+ * - Add initial code for IPX support.
-+ * - Add new 2300 TPX firmware (3.02.10).
-+ *
-+ * Rev 8.00.00b1-pre34 April ??, 2003 AV
-+ * - Resync with Linux Kernel 2.5.67.
-+ * - Use domain/area/al_pa fields when displaying PortID
-+ * values -- addresses endianess issues.
-+ * - Rework large case statement to check 'common' CDB commands
-+ * early in qla2x00_get_cmd_direction().
-+ *
-+ * Rev 8.00.00b1-pre31 April ??, 2003 AV
-+ * - Update makefile to support PPC64 build.
-+ * - Retool NVRAM configuration routine and structures:
-+ * - Consoldate ISP21xx/ISP22xx/ISP23xx configuration
-+ * (struct nvram_t).
-+ * - Remove big/little endian support structures in favor of
-+ * simplified bit-operations within byte fields.
-+ * - Fix long-standing 'static' buffer sharing problem in
-+ * qla2x00_configure_fabric().
-+ *
-+ * Rev 8.00.00b1-pre30 April ??, 2003 AV
-+ * - Complete implementation of GID_PT scan.
-+ * - Use consistent MS IOCB invocation method to query SNS:
-+ * - Add RNN_ID and RSNN_NN registrations in a fabric.
-+ * - Remove unused Mailbox Command 6Eh (Send SNS) support
-+ * structures.
-+ * - Use 64bit safe IOCBs while issuing INQUIRY and RLC during
-+ * topology scan.
-+ * - Until reimplementation of fcdev_t/fcport list
-+ * consolidation, valid loop_id ranges are still limited from
-+ * 0x00 through 0xFF -- enforce this within the code.
-+ *
-+ * Rev 8.00.00b1-pre27 March ??, 2003 AV
-+ * - Resync with 6.05.00b9.
-+ * - Retool HBA PCI configuration -- qla2x00_pci_config().
-+ * - Remove inconsistent use of delay routines (UDELAY/SYS*).
-+ * - Continue to teardown/clean/add comments and debug
-+ * routines.
-+ * - Properly swap bytes of the device's nodename in
-+ * qla2x00_configure_local_loop().
-+ *
-+ * Rev 8.00.00b1-pre25 March ??, 2003 AV
-+ * - Resync with 6.05.00b8.
-+ *
-+ * Rev 8.00.00b1-pre23 March ??, 2003 AV
-+ * - Remove (#define) IOCB usage throttling.
-+ * - Abstract interrupt polling with qla2x00_poll().
-+ * - Modify lun scanning logic:
-+ * - If the device does not support the SCSI Report Luns
-+ * command, the driver will now only scan from 0 to the
-+ * max#-luns as defined in the NVRAM (BIOS), rather than
-+ * blindly scanning from 0 to 255 -- which could result in
-+ * an increase in startup time when running against slow
-+ * (JBOD) devices.
-+ * - Rework reset logic in qla2x00_reset_chip() (spec).
-+ *
-+ * Rev 8.00.00b1-pre22 March ??, 2003 AV
-+ * - Resync with 6.05.00b7.
-+ * - Cleanup (rewrite) ISR handler.
-+ * - Rename kmem_zalloc --> qla2x00_kmem_zalloc():
-+ * - This function will eventually be removed.
-+ * - Add new 2300 VIX firmware (3.02.09):
-+ * - Support for Tape, Fabric, 2K logins, IP, and VI.
-+ *
-+ * Rev 8.00.00b1-pre18 March ??, 2003 AV
-+ * - Support 232x type ISPs.
-+ * - Support single firmware for each ISP type:
-+ * - Restructure brd_info/fw_info methods.
-+ * - Streamline firmware load process.
-+ * - Properly query firmware for version information.
-+ * - Remove extraneous scsi_qla_host members:
-+ * - device_id ==> pdev->device
-+ * - Fix fc4 features (RFF_ID) registration.
-+ * - Convert kmem_zalloc --> qla2x00_kmem_zalloc().
-+ * - Remove unused/extraneous #defines (USE_PORTNAME).
-+ *
-+ * Rev 8.00.00b1-pre14 March ??, 2003 AV
-+ * - Resync with 6.05.00b6.
-+ * - Initial source-code restructuring effort.
-+ * - Build procedure.
-+ * - Source file layout -- intuitive component layout.
-+ * - Remove unused #defines (*PERFORMANCE, WORD_FW_LOAD, etc).
-+ * - Add support for 2K logins (TPX -- firmware).
-+ * - Add module parameter ql2xsuspendcount.
-+ * - Add new 2200 IP/TP firmware (2.02.04).
-+ *
-+ * Rev 8.00.00b1-pre9 March ??, 2003 RL/DG/RA/AV
-+ * - Use kernel struct list_head for fcport and fclun lists.
-+ * - Remove extraneous (L|M)S_64BITS() and QL21_64*() defines.
-+ *
-+ * Rev 8.00.00b1-pre8 February 28, 2003 RL/DG/RA/AV
-+ * - Resync with 6.05.00b3.
-+ *
-+ * Rev 8.00.00b1-pre7 February 23, 2003 RL/DG/RA/AV
-+ * - Add alternate fabric scanning logic (GID_PT/GNN_ID/GPN_ID).
-+ * - Remove use of deprecated function check_region().
-+ * - Add new 2300 IP/TP firmware (3.02.08).
-+ *
-+ * Rev 8.00.00b1-pre5 January 28, 2003 RL/DG/RA/AV
-+ * - Resync with 6.05.00b3.
-+ * - Consolidate device_reg structure definitions for ISP types.
-+ * - Add support for new queue-depth selection.
-+ * - Add new 2300 IP/TP firmware (3.02.07).
-+ *
-+ * Rev 8.00.00b1-pre1 January 17, 2003 AV
-+ * - Initial branch from 6.04.00b8 driver.
-+ * - Remove VMWARE specific code.
-+ * - Add support for pci_driver interface.
-+ *
-+ ********************************************************************/
---- ./drivers/scsi/qla2xxx/LICENSE.qla2xxx 2006-07-07 03:06:49.000000000 +0400
-+++ ./drivers/scsi/qla2xxx/LICENSE 1970-01-01 03:00:00.000000000 +0300
-@@ -1,327 +0,0 @@
--Copyright (c) 2003-2006 QLogic Corporation
--QLogic Linux Fibre Channel HBA Driver
--
--This program includes a device driver for Linux 2.6 that may be
--distributed with QLogic hardware specific firmware binary file.
--You may modify and redistribute the device driver code under the
--GNU General Public License (a copy of which is attached hereto as
--Exhibit A) published by the Free Software Foundation (version 2).
--
--You may redistribute the hardware specific firmware binary file
--under the following terms:
--
-- 1. Redistribution of source code (only if applicable),
-- must retain the above copyright notice, this list of
-- conditions and the following disclaimer.
--
-- 2. Redistribution in binary form must reproduce the above
-- copyright notice, this list of conditions and the
-- following disclaimer in the documentation and/or other
-- materials provided with the distribution.
--
-- 3. The name of QLogic Corporation may not be used to
-- endorse or promote products derived from this software
-- without specific prior written permission
--
--REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,
--THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY
--EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
--IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
--PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
--BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
--EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
--TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
--ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
--OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
--OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
--POSSIBILITY OF SUCH DAMAGE.
--
--USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT
--CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR
--OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT,
--TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN
--ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN
--COMBINATION WITH THIS PROGRAM.
--
--
--EXHIBIT A
--
-- GNU GENERAL PUBLIC LICENSE
-- Version 2, June 1991
--
-- Copyright (C) 1989, 1991 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.
--
-- Preamble
--
-- The licenses for most software are designed to take away your
--freedom to share and change it. By contrast, the GNU General Public
--License is intended to guarantee your freedom to share and change free
--software--to make sure the software is free for all its users. This
--General Public License applies to most of the Free Software
--Foundation's software and to any other program whose authors commit to
--using it. (Some other Free Software Foundation software is covered by
--the GNU Lesser General Public License instead.) You can apply it to
--your programs, too.
--
-- When we speak of free software, we are referring to freedom, 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 or use pieces of it
--in new free programs; and that you know you can do these things.
--
-- To protect your rights, we need to make restrictions that forbid
--anyone to deny you these rights or to ask you to surrender the rights.
--These restrictions translate to certain responsibilities for you if you
--distribute copies of the software, or if you modify it.
--
-- For example, if you distribute copies of such a program, whether
--gratis or for a fee, you must give the recipients all the rights that
--you have. You must make sure that they, too, receive or can get the
--source code. And you must show them these terms so they know their
--rights.
--
-- We protect your rights with two steps: (1) copyright the software, and
--(2) offer you this license which gives you legal permission to copy,
--distribute and/or modify the software.
--
-- Also, for each author's protection and ours, we want to make certain
--that everyone understands that there is no warranty for this free
--software. If the software is modified by someone else and passed on, we
--want its recipients to know that what they have is not the original, so
--that any problems introduced by others will not reflect on the original
--authors' reputations.
--
-- Finally, any free program is threatened constantly by software
--patents. We wish to avoid the danger that redistributors of a free
--program will individually obtain patent licenses, in effect making the
--program proprietary. To prevent this, we have made it clear that any
--patent must be licensed for everyone's free use or not licensed at all.
--
-- The precise terms and conditions for copying, distribution and
--modification follow.
--
-- GNU GENERAL PUBLIC LICENSE
-- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
--
-- 0. This License applies to any program or other work which contains
--a notice placed by the copyright holder saying it may be distributed
--under the terms of this General Public License. The "Program", below,
--refers to any such program or work, and a "work based on the Program"
--means either the Program or any derivative work under copyright law:
--that is to say, a work containing the Program or a portion of it,
--either verbatim or with modifications and/or translated into another
--language. (Hereinafter, translation is included without limitation in
--the term "modification".) Each licensee is addressed as "you".
--
--Activities other than copying, distribution and modification are not
--covered by this License; they are outside its scope. The act of
--running the Program is not restricted, and the output from the Program
--is covered only if its contents constitute a work based on the
--Program (independent of having been made by running the Program).
--Whether that is true depends on what the Program does.
--
-- 1. You may copy and distribute verbatim copies of the Program's
--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 give any other recipients of the Program a copy of this License
--along with the Program.
--
--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 Program or any portion
--of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
-- stating that you changed the files and the date of any change.
--
-- b) You must cause any work that you distribute or publish, that in
-- whole or in part contains or is derived from the Program or any
-- part thereof, to be licensed as a whole at no charge to all third
-- parties under the terms of this License.
--
-- c) If the modified program normally reads commands interactively
-- when run, you must cause it, when started running for such
-- interactive use in the most ordinary way, to print or display an
-- announcement including an appropriate copyright notice and a
-- notice that there is no warranty (or else, saying that you provide
-- a warranty) and that users may redistribute the program under
-- these conditions, and telling the user how to view a copy of this
-- License. (Exception: if the Program itself is interactive but
-- does not normally print such an announcement, your work based on
-- the Program is not required to print an announcement.)
--
--These requirements apply to the modified work as a whole. If
--identifiable sections of that work are not derived from the Program,
--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 Program, 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 Program.
--
--In addition, mere aggregation of another work not based on the Program
--with the Program (or with a work based on the Program) on a volume of
--a storage or distribution medium does not bring the other work under
--the scope of this License.
--
-- 3. You may copy and distribute the Program (or a work based on it,
--under Section 2) in object code or executable form under the terms of
--Sections 1 and 2 above provided that you also do one of the following:
--
-- a) 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; or,
--
-- b) Accompany it with a written offer, valid for at least three
-- years, to give any third party, for a charge no more than your
-- cost of physically performing source distribution, a complete
-- machine-readable copy of the corresponding source code, to be
-- distributed under the terms of Sections 1 and 2 above on a medium
-- customarily used for software interchange; or,
--
-- c) Accompany it with the information you received as to the offer
-- to distribute corresponding source code. (This alternative is
-- allowed only for noncommercial distribution and only if you
-- received the program in object code or executable form with such
-- an offer, in accord with Subsection b above.)
--
--The source code for a work means the preferred form of the work for
--making modifications to it. For an executable work, 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 executable. However, as a
--special exception, the source code 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.
--
--If distribution of executable or 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 counts as
--distribution of the source code, even though third parties are not
--compelled to copy the source along with the object code.
--
-- 4. You may not copy, modify, sublicense, or distribute the Program
--except as expressly provided under this License. Any attempt
--otherwise to copy, modify, sublicense or distribute the Program 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.
--
-- 5. 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 Program or its derivative works. These actions are
--prohibited by law if you do not accept this License. Therefore, by
--modifying or distributing the Program (or any work based on the
--Program), you indicate your acceptance of this License to do so, and
--all its terms and conditions for copying, distributing or modifying
--the Program or works based on it.
--
-- 6. Each time you redistribute the Program (or any work based on the
--Program), the recipient automatically receives a license from the
--original licensor to copy, distribute or modify the Program 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 to
--this License.
--
-- 7. 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 Program at all. For example, if a patent
--license would not permit royalty-free redistribution of the Program 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 Program.
--
--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.
--
-- 8. If the distribution and/or use of the Program is restricted in
--certain countries either by patents or by copyrighted interfaces, the
--original copyright holder who places the Program 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.
--
-- 9. The Free Software Foundation may publish revised and/or new versions
--of the 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 Program
--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 Program does not specify a version number of
--this License, you may choose any version ever published by the Free Software
--Foundation.
--
-- 10. If you wish to incorporate parts of the Program into other free
--programs whose distribution conditions are different, 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
--
-- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
--FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
--OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
--PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
--PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
--REPAIR OR CORRECTION.
--
-- 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
--PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
--POSSIBILITY OF SUCH DAMAGES.
diff --git a/openvz-sources/023.030/5210_diff-drv-megaraid-entropy-20051025.patch b/openvz-sources/023.030/5210_diff-drv-megaraid-entropy-20051025.patch
deleted file mode 100644
index 69ebaf9..0000000
--- a/openvz-sources/023.030/5210_diff-drv-megaraid-entropy-20051025.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- ./drivers/scsi/megaraid/megaraid_mbox.c.megaent 2005-10-25 13:18:59.000000000 +0400
-+++ ./drivers/scsi/megaraid/megaraid_mbox.c 2005-10-25 13:20:15.705441392 +0400
-@@ -840,9 +840,8 @@ megaraid_init_mbox(adapter_t *adapter)
- //
-
- // request IRQ and register the interrupt service routine
-- if (request_irq(adapter->irq, megaraid_isr, SA_SHIRQ, "megaraid",
-- adapter)) {
--
-+ if (request_irq(adapter->irq, megaraid_isr, SA_SHIRQ | SA_SAMPLE_RANDOM,
-+ "megaraid", adapter)) {
- con_log(CL_ANN, (KERN_WARNING
- "megaraid: Couldn't register IRQ %d!\n", adapter->irq));
-
---- ./drivers/scsi/megaraid.c.megaent 2005-10-25 13:18:59.000000000 +0400
-+++ ./drivers/scsi/megaraid.c 2005-10-25 13:19:29.546458624 +0400
-@@ -4729,7 +4729,8 @@ megaraid_probe_one(struct pci_dev *pdev,
-
- if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ?
- megaraid_isr_memmapped : megaraid_isr_iomapped,
-- SA_SHIRQ, "megaraid", adapter)) {
-+ SA_SHIRQ | SA_SAMPLE_RANDOM,
-+ "megaraid", adapter)) {
- printk(KERN_WARNING
- "megaraid: Couldn't register IRQ %d!\n", irq);
- goto out_free_scb_list;
diff --git a/openvz-sources/023.030/5224_diff-cciss-timeout-20060228.patch b/openvz-sources/023.030/5224_diff-cciss-timeout-20060228.patch
deleted file mode 100644
index 75f1379..0000000
--- a/openvz-sources/023.030/5224_diff-cciss-timeout-20060228.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- ./drivers/block/cciss.c.8 2006-03-01 12:59:45.000000000 +0300
-+++ ./drivers/block/cciss.c 2006-03-01 17:36:20.000000000 +0300
-@@ -1765,8 +1765,7 @@ static unsigned long pollcomplete(int ct
- for (i = 20 * HZ; i > 0; i--) {
- done = hba[ctlr]->access.command_completed(hba[ctlr]);
- if (done == FIFO_EMPTY) {
-- set_current_state(TASK_UNINTERRUPTIBLE);
-- schedule_timeout(1);
-+ msleep(1);
- } else
- return (done);
- }
-@@ -2500,8 +2499,7 @@ static int cciss_pci_init(ctlr_info_t *c
- scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
- if (scratchpad == CCISS_FIRMWARE_READY)
- break;
-- set_current_state(TASK_INTERRUPTIBLE);
-- schedule_timeout(HZ / 10); /* wait 100ms */
-+ msleep(100); /* wait 100ms */
- }
- if (scratchpad != CCISS_FIRMWARE_READY) {
- printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
-@@ -2586,8 +2584,7 @@ static int cciss_pci_init(ctlr_info_t *c
- if (!(readl(c->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
- break;
- /* delay and try again */
-- set_current_state(TASK_INTERRUPTIBLE);
-- schedule_timeout(10);
-+ msleep(10);
- }
-
- #ifdef CCISS_DEBUG
diff --git a/openvz-sources/023.030/5232_diff-scsi-megaraid-dma64-20060621.patch b/openvz-sources/023.030/5232_diff-scsi-megaraid-dma64-20060621.patch
deleted file mode 100644
index 7718a7d..0000000
--- a/openvz-sources/023.030/5232_diff-scsi-megaraid-dma64-20060621.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- ./drivers/scsi/megaraid/megaraid_mbox.c.s1504 2006-06-21 12:31:44.000000000 +0400
-+++ ./drivers/scsi/megaraid/megaraid_mbox.c 2006-06-21 06:47:28.000000000 +0400
-@@ -937,6 +937,12 @@ megaraid_init_mbox(adapter_t *adapter)
- // DMA in this range
- pci_read_config_dword(adapter->pdev, PCI_CONF_AMISIG64, &magic64);
-
-+/* MegaRAID SATA 150-4 not supported 64-bit DMA */
-+if (!(adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC &&
-+ adapter->pdev->device == PCI_DEVICE_ID_MEGARAID_SATA_150_4 &&
-+ adapter->pdev->subsystem_vendor == PCI_VENDOR_ID_LSI_LOGIC &&
-+ adapter->pdev->subsystem_device == PCI_SUBSYS_ID_MEGARAID_SATA_150_4)) {
-+
- if ((magic64 == HBA_SIGNATURE_64BIT) ||
- (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&
- adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) ||
-@@ -955,7 +961,7 @@ megaraid_init_mbox(adapter_t *adapter)
- goto out_free_sysfs_res;
- }
- }
--
-+}
- // setup tasklet for DPC
- tasklet_init(&adapter->dpc_h, megaraid_mbox_dpc,
- (unsigned long)adapter);
diff --git a/openvz-sources/023.030/5233_diff-scsi-mpt-fusion-sleeps.patch b/openvz-sources/023.030/5233_diff-scsi-mpt-fusion-sleeps.patch
deleted file mode 100644
index 2760c56..0000000
--- a/openvz-sources/023.030/5233_diff-scsi-mpt-fusion-sleeps.patch
+++ /dev/null
@@ -1,148 +0,0 @@
---- ./drivers/message/fusion/mptbase.c.fusion 2006-05-15 14:17:50.000000000 +0400
-+++ ./drivers/message/fusion/mptbase.c 2006-06-15 18:29:32.000000000 +0400
-@@ -2505,7 +2505,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
- }
-
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1);
-+ msleep(1);
- else
- MPT_MDELAY(1); /* 1 msec delay */
-
-@@ -2901,7 +2901,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepF
- state = mpt_GetIocState(ioc, 1);
- while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1);
-+ msleep(1);
- else
- MPT_MDELAY(1);
-
-@@ -3153,7 +3153,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
-
- /* wait 1 msec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1);
-+ msleep(1);
- else
- MPT_MDELAY(1);
-
-@@ -3170,7 +3170,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
- }
- /* wait .1 sec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(100);
-+ msleep(100);
- else
- MPT_MDELAY(100);
- }
-@@ -3258,7 +3258,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
-
- /* wait 1 msec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1);
-+ msleep(1);
- else
- MPT_MDELAY(1);
- }
-@@ -3305,7 +3305,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
- return 0;
- }
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(10);
-+ msleep(10);
- else
- MPT_MDELAY(10);
- }
-@@ -3356,7 +3356,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
- SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag);
-
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1000);
-+ msleep(1000);
- else
- MPT_MDELAY(1000);
- }
-@@ -3377,7 +3377,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
- return hard_reset_done;
- }
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(10);
-+ msleep(10);
- else
- MPT_MDELAY(10);
- }
-@@ -3447,7 +3447,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
-
- /* wait 100 msec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(100);
-+ msleep(100);
- else
- MPT_MDELAY(100);
-
-@@ -3527,7 +3527,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
- ioc->name, diag0val, count));
- /* wait 1 sec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1000);
-+ msleep(1000);
- else
- MPT_MDELAY(1000);
- }
-@@ -3555,7 +3555,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
- ioc->name, doorbell, count));
- /* wait 1 sec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1000);
-+ msleep(1000);
- else
- MPT_MDELAY(1000);
- }
-@@ -3588,7 +3588,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
-
- /* wait 100 msec */
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(100);
-+ msleep(100);
- else
- MPT_MDELAY(100);
-
-@@ -3681,7 +3681,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_
- }
-
- if (sleepFlag == CAN_SLEEP)
-- msleep_interruptible(1);
-+ msleep(1);
- else
- MPT_MDELAY(1); /* 1 msec delay */
- }
-@@ -4147,7 +4147,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int
- intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
- if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
- break;
-- msleep_interruptible(1);
-+ msleep(1);
- count++;
- }
- } else {
-@@ -4196,7 +4196,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
- intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
- if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
- break;
-- msleep_interruptible(1);
-+ msleep(1);
- count++;
- }
- } else {
---- ./drivers/message/fusion/mptscsi.c.fusion 2006-05-15 14:17:50.000000000 +0400
-+++ ./drivers/message/fusion/mptscsi.c 2006-06-15 16:55:17.000000000 +0400
-@@ -2389,7 +2389,7 @@ mptscsih_tm_wait_for_completion(MPT_SCSI
- break;
- }
- spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-- msleep_interruptible(250);
-+ msleep(250);
- } while (--loop_count);
-
- return status;
diff --git a/openvz-sources/023.030/5234_diff-drv-adp94xx-freeze-20060906.patch b/openvz-sources/023.030/5234_diff-drv-adp94xx-freeze-20060906.patch
deleted file mode 100644
index 43fbfba..0000000
--- a/openvz-sources/023.030/5234_diff-drv-adp94xx-freeze-20060906.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- ./drivers/scsi/adp94xx/adp94xx_osm.c.freeze 2006-08-23 11:10:18.000000000 +0400
-+++ ./drivers/scsi/adp94xx/adp94xx_osm.c 2006-09-06 13:06:27.000000000 +0400
-@@ -2265,7 +2265,6 @@ asd_discovery_thread(void *data)
- sprintf(current->comm, "asd_disc_%d", asd->profile.unit);
- #else
- daemonize("asd_disc_%d", asd->profile.unit);
-- current->flags |= PF_FREEZE;
- #endif
- unlock_kernel();
-
-@@ -5289,7 +5288,6 @@ asd_ehandler_thread(void *data)
- sprintf(current->comm, "asd_eh_%d", asd->profile.unit);
- #else
- daemonize("asd_eh_%d", asd->profile.unit);
-- current->flags |= PF_FREEZE;
- #endif
- unlock_kernel();
-
diff --git a/openvz-sources/023.030/5235_diff-wrn-implicit-funcs-20060906.patch b/openvz-sources/023.030/5235_diff-wrn-implicit-funcs-20060906.patch
deleted file mode 100644
index c46c463..0000000
--- a/openvz-sources/023.030/5235_diff-wrn-implicit-funcs-20060906.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- ./arch/i386/kernel/setup.c.implicit 2006-09-05 11:38:26.000000000 +0400
-+++ ./arch/i386/kernel/setup.c 2006-09-06 14:22:26.000000000 +0400
-@@ -122,6 +122,8 @@ unsigned char aux_device_present;
- extern void early_cpu_init(void);
- extern void dmi_scan_machine(void);
- extern void generic_apic_probe(char *);
-+extern void noht_init(void);
-+extern void check_ioapic(void);
- extern int root_mountflags;
- extern int disable_timer_pin_1;
-
---- ./drivers/scsi/aacraid/commsup.c.implicit 2006-08-23 11:10:17.000000000 +0400
-+++ ./drivers/scsi/aacraid/commsup.c 2006-09-06 14:22:59.000000000 +0400
-@@ -49,6 +49,8 @@
-
- #include "aacraid.h"
-
-+extern void scsi_rescan_device(struct device *);
-+
- /**
- * fib_map_alloc - allocate the fib objects
- * @dev: Adapter to allocate for
-@@ -781,7 +783,6 @@ void aac_printf(struct aac_dev *dev, u32
- memset(cp, 0, 256);
- }
-
--
- /**
- * aac_handle_aif - Handle a message from the firmware
- * @dev: Which adapter this fib is from
---- ./arch/x86_64/kernel/mpparse.c.implicit 2006-08-23 11:10:09.000000000 +0400
-+++ ./arch/x86_64/kernel/mpparse.c 2006-09-06 14:32:46.000000000 +0400
-@@ -84,6 +84,10 @@ extern int acpi_parse_ioapic (acpi_table
- #endif /*CONFIG_X86_IO_APIC*/
- #endif /*CONFIG_ACPI_BOOT*/
-
-+#ifdef CONFIG_ACPI_NUMA
-+extern void acpi_numa_setup_cpu(int cpu, int apicid);
-+#endif /*CONFIG_ACPI_NUMA*/
-+
- u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
-
-
---- ./arch/x86_64/kernel/setup.c.implicit 2006-09-06 14:28:43.000000000 +0400
-+++ ./arch/x86_64/kernel/setup.c 2006-09-06 14:28:57.000000000 +0400
-@@ -108,6 +108,7 @@ struct e820map e820;
-
- unsigned char aux_device_present;
-
-+extern void dmi_scan_machine(void);
- extern int root_mountflags;
- extern char _text, _etext, _edata, _end;
-